From: support Date: Tue, 4 Apr 2023 07:36:48 +0000 (+0000) Subject: Built motion from commit 511216ff.|2.6.34 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=d49179b33ee0d68ac7fe8d7a72ddb052882650b3;p=motion2.git Built motion from commit 511216ff.|2.6.34 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 87dbaf3..137a5a3 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-28T09:17:06.964Z", + "time": "2023-04-04T07:25:29.663Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index ae8e355..5317a45 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-28T09:17:06.964Z", + "time": "2023-04-04T07:25:29.663Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 22e1ad1..31ddbb1 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.33", + "version": "2.6.34", "dependencies": { "@babel/code-frame": { "version": "7.18.6", diff --git a/package.json b/package.json index b4c0db1..d3f1a90 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.33", + "version": "2.6.34", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 9897251..62c3afe 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 _0x9b25=['contactManager','motionbar','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[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','exports','getDataValue','action','STRING'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x9b25,0x175));var _0x59b2=function(_0xbfe8e9,_0x5a8b43){_0xbfe8e9=_0xbfe8e9-0x0;var _0x2a278f=_0x9b25[_0xbfe8e9];return _0x2a278f;};'use strict';var Sequelize=require(_0x59b2('0x0'));module[_0x59b2('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xed1df0){return this[_0x59b2('0x2')](_0x59b2('0x3'));}},'action':{'type':Sequelize[_0x59b2('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x59b2('0x5'),'integration',_0x59b2('0x6'),'jscripty','urlForward',_0x59b2('0x7'),_0x59b2('0x8'),_0x59b2('0x9')]],'msg':_0x59b2('0xa')}},'comment':_0x59b2('0xa')},'data1':{'type':Sequelize[_0x59b2('0x4')](0x1000),'comment':_0x59b2('0xb')},'data2':{'type':Sequelize[_0x59b2('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x59b2('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x59b2('0xd')},'data5':{'type':Sequelize[_0x59b2('0x4')](0x1000),'comments':_0x59b2('0xe')},'data6':{'type':Sequelize[_0x59b2('0x4')],'comments':_0x59b2('0xf')},'data7':{'type':Sequelize[_0x59b2('0x10')],'comments':_0x59b2('0x11')}}; \ No newline at end of file +var _0x5ff9=['contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','action','contactManager','integration','motionbar','jscripty','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING'];(function(_0x3da096,_0x59b644){var _0x144fbf=function(_0x14c243){while(--_0x14c243){_0x3da096['push'](_0x3da096['shift']());}};_0x144fbf(++_0x59b644);}(_0x5ff9,0x155));var _0x95ff=function(_0x3262c5,_0x2773e0){_0x3262c5=_0x3262c5-0x0;var _0x2737da=_0x5ff9[_0x3262c5];return _0x2737da;};'use strict';var Sequelize=require(_0x95ff('0x0'));module[_0x95ff('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x312ecc){return this['getDataValue'](_0x95ff('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x95ff('0x3'),_0x95ff('0x4'),_0x95ff('0x5'),_0x95ff('0x6'),'urlForward','browser',_0x95ff('0x7'),_0x95ff('0x8')]],'msg':_0x95ff('0x9')}},'comment':_0x95ff('0x9')},'data1':{'type':Sequelize[_0x95ff('0xa')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x95ff('0xa')](0x1000),'comment':_0x95ff('0xb')},'data3':{'type':Sequelize[_0x95ff('0xa')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x95ff('0xa')](0x1000),'comments':_0x95ff('0xc')},'data5':{'type':Sequelize[_0x95ff('0xa')](0x1000),'comments':_0x95ff('0xd')},'data6':{'type':Sequelize[_0x95ff('0xa')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x95ff('0xe')],'comments':_0x95ff('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index e7451fb..5d8ae06 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 _0x4130=['params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','body','Action','find','catch'];(function(_0x4f51c9,_0x7d55fa){var _0x5e1d6b=function(_0x36e5b0){while(--_0x36e5b0){_0x4f51c9['push'](_0x4f51c9['shift']());}};_0x5e1d6b(++_0x7d55fa);}(_0x4130,0x1a8));var _0x0413=function(_0x5a5939,_0x5af371){_0x5a5939=_0x5a5939-0x0;var _0x336804=_0x4130[_0x5a5939];return _0x336804;};'use strict';var emlformat=require(_0x0413('0x0'));var rimraf=require(_0x0413('0x1'));var zipdir=require(_0x0413('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0413('0x3'));var moment=require(_0x0413('0x4'));var BPromise=require(_0x0413('0x5'));var Mustache=require(_0x0413('0x6'));var util=require(_0x0413('0x7'));var path=require(_0x0413('0x8'));var sox=require('sox');var csv=require(_0x0413('0x9'));var ejs=require(_0x0413('0xa'));var fs=require('fs');var fs_extra=require(_0x0413('0xb'));var _=require('lodash');var squel=require(_0x0413('0xc'));var crypto=require(_0x0413('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0413('0x9'));var querystring=require(_0x0413('0xe'));var Papa=require(_0x0413('0xf'));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(_0x0413('0x10'));var logger=require(_0x0413('0x11'))(_0x0413('0x12'));var utils=require(_0x0413('0x13'));var config=require(_0x0413('0x14'));var licenseUtil=require(_0x0413('0x15'));var db=require(_0x0413('0x16'))['db'];function respondWithStatusCode(_0x3a704c,_0xcb1e70){_0xcb1e70=_0xcb1e70||0xcc;return function(_0x1c966e){if(_0x1c966e){return _0x3a704c[_0x0413('0x17')](_0xcb1e70);}return _0x3a704c['status'](_0xcb1e70)['end']();};}function respondWithResult(_0xfd7e13,_0x380e93){_0x380e93=_0x380e93||0xc8;return function(_0x368635){if(_0x368635){return _0xfd7e13[_0x0413('0x18')](_0x380e93)[_0x0413('0x19')](_0x368635);}};}function respondWithFilteredResult(_0x501d42,_0x232e86){return function(_0x41c548){if(_0x41c548){var _0xc6200e=typeof _0x232e86['offset']==='undefined'&&typeof _0x232e86[_0x0413('0x1a')]===_0x0413('0x1b');var _0x3a87b0=_0x41c548['count'];var _0x115429=_0xc6200e?0x0:_0x232e86[_0x0413('0x1c')];var _0x48d42a=_0xc6200e?_0x41c548[_0x0413('0x1d')]:_0x232e86[_0x0413('0x1c')]+_0x232e86[_0x0413('0x1a')];var _0x1ad095;if(_0x48d42a>=_0x3a87b0){_0x48d42a=_0x3a87b0;_0x1ad095=0xc8;}else{_0x1ad095=0xce;}_0x501d42[_0x0413('0x18')](_0x1ad095);return _0x501d42[_0x0413('0x1e')](_0x0413('0x1f'),_0x115429+'-'+_0x48d42a+'/'+_0x3a87b0)[_0x0413('0x19')](_0x41c548);}return null;};}function patchUpdates(_0x33969b){return function(_0x11024f){try{jsonpatch[_0x0413('0x20')](_0x11024f,_0x33969b,!![]);}catch(_0x3ebcaa){return BPromise[_0x0413('0x21')](_0x3ebcaa);}return _0x11024f[_0x0413('0x22')]();};}function saveUpdates(_0x1559ce,_0x50a481){return function(_0x2b50b9){if(_0x2b50b9){return _0x2b50b9[_0x0413('0x23')](_0x1559ce)[_0x0413('0x24')](function(_0x32e31b){return _0x32e31b;});}return null;};}function removeEntity(_0xb3f479,_0x23297d){return function(_0x7643d4){if(_0x7643d4){return _0x7643d4[_0x0413('0x25')]()[_0x0413('0x24')](function(){_0xb3f479[_0x0413('0x18')](0xcc)[_0x0413('0x26')]();});}};}function handleEntityNotFound(_0x175feb,_0x84d03a){return function(_0x45c541){if(!_0x45c541){_0x175feb[_0x0413('0x17')](0x194);}return _0x45c541;};}function handleError(_0x268be9,_0xf9bd31){_0xf9bd31=_0xf9bd31||0x1f4;return function(_0x21d191){logger[_0x0413('0x27')](_0x21d191['stack']);if(_0x21d191[_0x0413('0x28')]){delete _0x21d191['name'];}_0x268be9[_0x0413('0x18')](_0xf9bd31)[_0x0413('0x29')](_0x21d191);};}exports[_0x0413('0x23')]=function(_0x535051,_0x1ef9f4){if(_0x535051['body']['id']){delete _0x535051[_0x0413('0x2a')]['id'];}return db[_0x0413('0x2b')][_0x0413('0x2c')]({'where':{'id':_0x535051['params']['id']}})['then'](handleEntityNotFound(_0x1ef9f4,null))['then'](saveUpdates(_0x535051[_0x0413('0x2a')],null))[_0x0413('0x24')](respondWithResult(_0x1ef9f4,null))[_0x0413('0x2d')](handleError(_0x1ef9f4,null));};exports[_0x0413('0x25')]=function(_0x2e876a,_0xc374ab){return db['Action']['find']({'where':{'id':_0x2e876a[_0x0413('0x2e')]['id']}})[_0x0413('0x24')](handleEntityNotFound(_0xc374ab,null))[_0x0413('0x24')](removeEntity(_0xc374ab,null))[_0x0413('0x2d')](handleError(_0xc374ab,null));}; \ No newline at end of file +var _0x5709=['apply','reject','save','update','then','destroy','end','error','stack','name','body','params','catch','Action','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','count','offset','limit','json'];(function(_0x11a83e,_0x1533ee){var _0xbd3bd5=function(_0xc15afd){while(--_0xc15afd){_0x11a83e['push'](_0x11a83e['shift']());}};_0xbd3bd5(++_0x1533ee);}(_0x5709,0x158));var _0x9570=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5709[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9570('0x0'));var rimraf=require(_0x9570('0x1'));var zipdir=require(_0x9570('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9570('0x3'));var moment=require(_0x9570('0x4'));var BPromise=require(_0x9570('0x5'));var Mustache=require('mustache');var util=require(_0x9570('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9570('0x7'));var ejs=require(_0x9570('0x8'));var fs=require('fs');var fs_extra=require(_0x9570('0x9'));var _=require(_0x9570('0xa'));var squel=require(_0x9570('0xb'));var crypto=require(_0x9570('0xc'));var jsforce=require(_0x9570('0xd'));var deskjs=require(_0x9570('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9570('0xf'));var Redis=require(_0x9570('0x10'));var authService=require(_0x9570('0x11'));var qs=require(_0x9570('0x12'));var as=require(_0x9570('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9570('0x14'))(_0x9570('0x15'));var utils=require(_0x9570('0x16'));var config=require(_0x9570('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9570('0x18'))['db'];function respondWithStatusCode(_0x4e1e96,_0x2575c5){_0x2575c5=_0x2575c5||0xcc;return function(_0x588aa5){if(_0x588aa5){return _0x4e1e96[_0x9570('0x19')](_0x2575c5);}return _0x4e1e96[_0x9570('0x1a')](_0x2575c5)['end']();};}function respondWithResult(_0x26b898,_0x43a3cd){_0x43a3cd=_0x43a3cd||0xc8;return function(_0xb8d323){if(_0xb8d323){return _0x26b898[_0x9570('0x1a')](_0x43a3cd)['json'](_0xb8d323);}};}function respondWithFilteredResult(_0x29dff8,_0x1e628d){return function(_0x44fad0){if(_0x44fad0){var _0x362ebd=typeof _0x1e628d['offset']===_0x9570('0x1b')&&typeof _0x1e628d['limit']==='undefined';var _0x2c8cac=_0x44fad0[_0x9570('0x1c')];var _0x1ca5ec=_0x362ebd?0x0:_0x1e628d[_0x9570('0x1d')];var _0x8a3dc8=_0x362ebd?_0x44fad0[_0x9570('0x1c')]:_0x1e628d[_0x9570('0x1d')]+_0x1e628d[_0x9570('0x1e')];var _0x427ce3;if(_0x8a3dc8>=_0x2c8cac){_0x8a3dc8=_0x2c8cac;_0x427ce3=0xc8;}else{_0x427ce3=0xce;}_0x29dff8[_0x9570('0x1a')](_0x427ce3);return _0x29dff8['set']('Content-Range',_0x1ca5ec+'-'+_0x8a3dc8+'/'+_0x2c8cac)[_0x9570('0x1f')](_0x44fad0);}return null;};}function patchUpdates(_0x21807d){return function(_0x43cf3e){try{jsonpatch[_0x9570('0x20')](_0x43cf3e,_0x21807d,!![]);}catch(_0x4b0f0a){return BPromise[_0x9570('0x21')](_0x4b0f0a);}return _0x43cf3e[_0x9570('0x22')]();};}function saveUpdates(_0x4508f1,_0x4c7493){return function(_0xaac112){if(_0xaac112){return _0xaac112[_0x9570('0x23')](_0x4508f1)[_0x9570('0x24')](function(_0x5f069){return _0x5f069;});}return null;};}function removeEntity(_0x1104f8,_0x5066bc){return function(_0x2f5032){if(_0x2f5032){return _0x2f5032[_0x9570('0x25')]()[_0x9570('0x24')](function(){_0x1104f8[_0x9570('0x1a')](0xcc)[_0x9570('0x26')]();});}};}function handleEntityNotFound(_0x2c0664,_0x3717b1){return function(_0x48f3bf){if(!_0x48f3bf){_0x2c0664[_0x9570('0x19')](0x194);}return _0x48f3bf;};}function handleError(_0xb402c0,_0xcd2097){_0xcd2097=_0xcd2097||0x1f4;return function(_0x1e7378){logger[_0x9570('0x27')](_0x1e7378[_0x9570('0x28')]);if(_0x1e7378['name']){delete _0x1e7378[_0x9570('0x29')];}_0xb402c0[_0x9570('0x1a')](_0xcd2097)['send'](_0x1e7378);};}exports[_0x9570('0x23')]=function(_0x3ccb08,_0x170a51){if(_0x3ccb08[_0x9570('0x2a')]['id']){delete _0x3ccb08[_0x9570('0x2a')]['id'];}return db['Action']['find']({'where':{'id':_0x3ccb08[_0x9570('0x2b')]['id']}})['then'](handleEntityNotFound(_0x170a51,null))[_0x9570('0x24')](saveUpdates(_0x3ccb08[_0x9570('0x2a')],null))['then'](respondWithResult(_0x170a51,null))[_0x9570('0x2c')](handleError(_0x170a51,null));};exports[_0x9570('0x25')]=function(_0x53edaf,_0x463aa6){return db[_0x9570('0x2d')][_0x9570('0x2e')]({'where':{'id':_0x53edaf[_0x9570('0x2b')]['id']}})[_0x9570('0x24')](handleEntityNotFound(_0x463aa6,null))[_0x9570('0x24')](removeEntity(_0x463aa6,null))[_0x9570('0x2c')](handleError(_0x463aa6,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 9d9546c..3d40cef 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 _0x9605=['define','Action','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes'];(function(_0x3f3a34,_0x3456ef){var _0x27328b=function(_0x36cf83){while(--_0x36cf83){_0x3f3a34['push'](_0x3f3a34['shift']());}};_0x27328b(++_0x3456ef);}(_0x9605,0xde));var _0x5960=function(_0x18ff1f,_0x4cb2c0){_0x18ff1f=_0x18ff1f-0x0;var _0x3c67fa=_0x9605[_0x18ff1f];return _0x3c67fa;};'use strict';var _=require(_0x5960('0x0'));var util=require('util');var logger=require(_0x5960('0x1'))('api');var moment=require(_0x5960('0x2'));var BPromise=require(_0x5960('0x3'));var rp=require(_0x5960('0x4'));var fs=require('fs');var path=require(_0x5960('0x5'));var rimraf=require(_0x5960('0x6'));var config=require(_0x5960('0x7'));var attributes=require(_0x5960('0x8'));module['exports']=function(_0x57d502,_0x1e4248){return _0x57d502[_0x5960('0x9')](_0x5960('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d41=['path','rimraf','./action.attributes','exports','define','Action','lodash','../../config/logger','moment','bluebird'];(function(_0x5b734f,_0x474dbe){var _0x50ce5c=function(_0x144911){while(--_0x144911){_0x5b734f['push'](_0x5b734f['shift']());}};_0x50ce5c(++_0x474dbe);}(_0x4d41,0x1a0));var _0x14d4=function(_0x3a833e,_0x5a1878){_0x3a833e=_0x3a833e-0x0;var _0xdff445=_0x4d41[_0x3a833e];return _0xdff445;};'use strict';var _=require(_0x14d4('0x0'));var util=require('util');var logger=require(_0x14d4('0x1'))('api');var moment=require(_0x14d4('0x2'));var BPromise=require(_0x14d4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x14d4('0x4'));var rimraf=require(_0x14d4('0x5'));var config=require('../../config/environment');var attributes=require(_0x14d4('0x6'));module[_0x14d4('0x7')]=function(_0x2b1c1d,_0x2fb9b5){return _0x2b1c1d[_0x14d4('0x8')](_0x14d4('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 93d27d0..6e87f51 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x7217,0x19e));var _0x7721=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x7217[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2091fd,_0x54cb51){var _0x1169e6=function(_0x205526){while(--_0x205526){_0x2091fd['push'](_0x2091fd['shift']());}};_0x1169e6(++_0x54cb51);}(_0x1261,0x144));var _0x1126=function(_0x1c3b41,_0x50f776){_0x1c3b41=_0x1c3b41-0x0;var _0x41e3fe=_0x1261[_0x1c3b41];return _0x41e3fe;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index db2260a..6df1b26 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 _0x8246=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./action.controller','put','isAuthenticated','delete','/:id','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8246,0x9d));var _0x6824=function(_0x32855c,_0x1733cb){_0x32855c=_0x32855c-0x0;var _0x783e1c=_0x8246[_0x32855c];return _0x783e1c;};'use strict';var multer=require(_0x6824('0x0'));var util=require(_0x6824('0x1'));var path=require('path');var timeout=require(_0x6824('0x2'));var express=require(_0x6824('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6824('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6824('0x5'));var controller=require(_0x6824('0x6'));router[_0x6824('0x7')]('/:id',auth[_0x6824('0x8')](),controller['update']);router[_0x6824('0x9')](_0x6824('0xa'),auth[_0x6824('0x8')](),controller[_0x6824('0xb')]);module[_0x6824('0xc')]=router; \ No newline at end of file +var _0xd3af=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','destroy','multer','path'];(function(_0x4291bc,_0x153760){var _0x7167ed=function(_0x433d5c){while(--_0x433d5c){_0x4291bc['push'](_0x4291bc['shift']());}};_0x7167ed(++_0x153760);}(_0xd3af,0x8a));var _0xfd3a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd3af[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xfd3a('0x0'));var util=require('util');var path=require(_0xfd3a('0x1'));var timeout=require('connect-timeout');var express=require(_0xfd3a('0x2'));var router=express[_0xfd3a('0x3')]();var fs_extra=require(_0xfd3a('0x4'));var auth=require(_0xfd3a('0x5'));var interaction=require(_0xfd3a('0x6'));var config=require(_0xfd3a('0x7'));var controller=require(_0xfd3a('0x8'));router['put'](_0xfd3a('0x9'),auth[_0xfd3a('0xa')](),controller[_0xfd3a('0xb')]);router[_0xfd3a('0xc')](_0xfd3a('0x9'),auth['isAuthenticated'](),controller[_0xfd3a('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ae92a6a..3c7549c 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 _0xda19=['exports','STRING','TEXT'];(function(_0x4a1195,_0x253862){var _0x360fa1=function(_0x207882){while(--_0x207882){_0x4a1195['push'](_0x4a1195['shift']());}};_0x360fa1(++_0x253862);}(_0xda19,0xd5));var _0x9da1=function(_0x152240,_0x4da254){_0x152240=_0x152240-0x0;var _0x48da00=_0xda19[_0x152240];return _0x48da00;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x31f0=['sequelize','STRING','TEXT'];(function(_0x2ce6ea,_0x4f06f6){var _0x512085=function(_0x315de3){while(--_0x315de3){_0x2ce6ea['push'](_0x2ce6ea['shift']());}};_0x512085(++_0x4f06f6);}(_0x31f0,0xb7));var _0x031f=function(_0x1447fd,_0x313162){_0x1447fd=_0x1447fd-0x0;var _0x721a7e=_0x31f0[_0x1447fd];return _0x721a7e;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 32046bd..1e6d013 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 _0x0c74=['value','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','fork','../../components/export/','countTable','COUNT(*)','run','runReport','MAX(%s)','AVG(%s)','UNIX_TIMESTAMP(%s)','debug','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','CustomReports','UserProfileResource','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s)','IS\x20EMPTY'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0x0c74,0xc1));var _0x40c7=function(_0x1c60bd,_0x207c9b){_0x1c60bd=_0x1c60bd-0x0;var _0xc46ef9=_0x0c74[_0x1c60bd];return _0xc46ef9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40c7('0x0'));var zipdir=require(_0x40c7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40c7('0x2'));var moment=require(_0x40c7('0x3'));var BPromise=require(_0x40c7('0x4'));var Mustache=require(_0x40c7('0x5'));var util=require('util');var path=require(_0x40c7('0x6'));var sox=require('sox');var csv=require(_0x40c7('0x7'));var ejs=require(_0x40c7('0x8'));var fs=require('fs');var fs_extra=require(_0x40c7('0x9'));var _=require('lodash');var squel=require(_0x40c7('0xa'));var crypto=require(_0x40c7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x40c7('0xc'));var toCsv=require(_0x40c7('0x7'));var querystring=require(_0x40c7('0xd'));var Papa=require(_0x40c7('0xe'));var Redis=require(_0x40c7('0xf'));var authService=require(_0x40c7('0x10'));var qs=require(_0x40c7('0x11'));var as=require(_0x40c7('0x12'));var hardwareService=require(_0x40c7('0x13'));var logger=require(_0x40c7('0x14'))(_0x40c7('0x15'));var utils=require(_0x40c7('0x16'));var config=require(_0x40c7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x40c7('0x18'))['db'];var dbH=require('../../mysqldb')[_0x40c7('0x19')];function respondWithStatusCode(_0x164c1,_0x3c86e8){_0x3c86e8=_0x3c86e8||0xcc;return function(_0x302ea4){if(_0x302ea4){return _0x164c1['sendStatus'](_0x3c86e8);}return _0x164c1[_0x40c7('0x1a')](_0x3c86e8)[_0x40c7('0x1b')]();};}function respondWithResult(_0x2bde2a,_0x32e6ca){_0x32e6ca=_0x32e6ca||0xc8;return function(_0x16a10f){if(_0x16a10f){return _0x2bde2a[_0x40c7('0x1a')](_0x32e6ca)['json'](_0x16a10f);}};}function respondWithFilteredResult(_0x586a75,_0x326b01){return function(_0x151697){if(_0x151697){var _0x54a863=typeof _0x326b01['offset']===_0x40c7('0x1c')&&typeof _0x326b01[_0x40c7('0x1d')]===_0x40c7('0x1c');var _0x2cd6f9=_0x151697['count'];var _0x41decf=_0x54a863?0x0:_0x326b01[_0x40c7('0x1e')];var _0x35eaee=_0x54a863?_0x151697[_0x40c7('0x1f')]:_0x326b01['offset']+_0x326b01['limit'];var _0x2b8df4;if(_0x35eaee>=_0x2cd6f9){_0x35eaee=_0x2cd6f9;_0x2b8df4=0xc8;}else{_0x2b8df4=0xce;}_0x586a75[_0x40c7('0x1a')](_0x2b8df4);return _0x586a75[_0x40c7('0x20')](_0x40c7('0x21'),_0x41decf+'-'+_0x35eaee+'/'+_0x2cd6f9)[_0x40c7('0x22')](_0x151697);}return null;};}function patchUpdates(_0x53decd){return function(_0x39b8cc){try{jsonpatch[_0x40c7('0x23')](_0x39b8cc,_0x53decd,!![]);}catch(_0x2eddf9){return BPromise[_0x40c7('0x24')](_0x2eddf9);}return _0x39b8cc[_0x40c7('0x25')]();};}function saveUpdates(_0x1b658b,_0xb8e270){return function(_0x2be352){if(_0x2be352){return _0x2be352[_0x40c7('0x26')](_0x1b658b)['then'](function(_0x1c8bfa){return _0x1c8bfa;});}return null;};}function removeEntity(_0x3b1ec2,_0x46ec11){return function(_0x28ba63){if(_0x28ba63){return _0x28ba63[_0x40c7('0x27')]()[_0x40c7('0x28')](function(){var _0xe0b88c=_0x28ba63[_0x40c7('0x29')]({'plain':!![]});var _0x26377c=_0x40c7('0x2a');return db[_0x40c7('0x2b')]['destroy']({'where':{'type':_0x26377c,'resourceId':_0xe0b88c['id']}})[_0x40c7('0x28')](function(){return _0x28ba63;});})[_0x40c7('0x28')](function(){_0x3b1ec2['status'](0xcc)[_0x40c7('0x1b')]();});}};}function handleEntityNotFound(_0x53cfe2,_0xb02519){return function(_0x52789a){if(!_0x52789a){_0x53cfe2['sendStatus'](0x194);}return _0x52789a;};}function handleError(_0x5e3306,_0x8e8964){_0x8e8964=_0x8e8964||0x1f4;return function(_0x2ef31f){logger[_0x40c7('0x2c')](_0x2ef31f[_0x40c7('0x2d')]);if(_0x2ef31f['name']){delete _0x2ef31f[_0x40c7('0x2e')];}_0x5e3306['status'](_0x8e8964)[_0x40c7('0x2f')](_0x2ef31f);};}exports['index']=function(_0x48ddcb,_0x56337f){var _0x3d179f={},_0x4cee00={},_0x2d588f={'count':0x0,'rows':[]};var _0x27cd86=_[_0x40c7('0x30')](db[_0x40c7('0x31')][_0x40c7('0x32')],function(_0x31906a){return{'name':_0x31906a[_0x40c7('0x33')],'type':_0x31906a[_0x40c7('0x34')][_0x40c7('0x35')]};});_0x4cee00[_0x40c7('0x36')]=_[_0x40c7('0x30')](_0x27cd86,_0x40c7('0x2e'));_0x4cee00['query']=_[_0x40c7('0x37')](_0x48ddcb[_0x40c7('0x38')]);_0x4cee00[_0x40c7('0x39')]=_[_0x40c7('0x3a')](_0x4cee00[_0x40c7('0x36')],_0x4cee00[_0x40c7('0x38')]);_0x3d179f[_0x40c7('0x3b')]=_[_0x40c7('0x3a')](_0x4cee00[_0x40c7('0x36')],qs[_0x40c7('0x3c')](_0x48ddcb[_0x40c7('0x38')]['fields']));_0x3d179f['attributes']=_0x3d179f['attributes'][_0x40c7('0x3d')]?_0x3d179f[_0x40c7('0x3b')]:_0x4cee00['model'];if(!_0x48ddcb[_0x40c7('0x38')][_0x40c7('0x3e')](_0x40c7('0x3f'))){_0x3d179f[_0x40c7('0x1d')]=qs[_0x40c7('0x1d')](_0x48ddcb[_0x40c7('0x38')][_0x40c7('0x1d')]);_0x3d179f[_0x40c7('0x1e')]=qs[_0x40c7('0x1e')](_0x48ddcb['query'][_0x40c7('0x1e')]);}_0x3d179f[_0x40c7('0x40')]=qs[_0x40c7('0x41')](_0x48ddcb[_0x40c7('0x38')][_0x40c7('0x41')]);_0x3d179f[_0x40c7('0x42')]=qs[_0x40c7('0x39')](_[_0x40c7('0x43')](_0x48ddcb['query'],_0x4cee00['filters']),_0x27cd86);if(_0x48ddcb[_0x40c7('0x38')][_0x40c7('0x44')]){_0x3d179f[_0x40c7('0x42')]=_[_0x40c7('0x45')](_0x3d179f[_0x40c7('0x42')],{'$or':_['map'](_0x27cd86,function(_0x4145f5){if(_0x4145f5['type']!==_0x40c7('0x46')){var _0x6c855c={};_0x6c855c[_0x4145f5[_0x40c7('0x2e')]]={'$like':'%'+_0x48ddcb['query']['filter']+'%'};return _0x6c855c;}})});}_0x3d179f=_[_0x40c7('0x45')]({},_0x3d179f,_0x48ddcb[_0x40c7('0x47')]);var _0x1e078f={'where':_0x3d179f[_0x40c7('0x42')]};return db[_0x40c7('0x31')][_0x40c7('0x1f')](_0x1e078f)[_0x40c7('0x28')](function(_0x26c16d){_0x2d588f[_0x40c7('0x1f')]=_0x26c16d;if(_0x48ddcb[_0x40c7('0x38')][_0x40c7('0x48')]){_0x3d179f[_0x40c7('0x49')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x40c7('0x4a')](_0x3d179f);})[_0x40c7('0x28')](function(_0x4bf927){_0x2d588f[_0x40c7('0x4b')]=_0x4bf927;return _0x2d588f;})[_0x40c7('0x28')](respondWithFilteredResult(_0x56337f,_0x3d179f))[_0x40c7('0x4c')](handleError(_0x56337f,null));};exports[_0x40c7('0x4d')]=function(_0x28e2b2,_0x4d2cb9){var _0x1dbcc4={'raw':![],'where':{'id':_0x28e2b2[_0x40c7('0x4e')]['id']}},_0x3f266b={};_0x3f266b[_0x40c7('0x36')]=_['keys'](db[_0x40c7('0x31')]['rawAttributes']);_0x3f266b[_0x40c7('0x38')]=_['keys'](_0x28e2b2['query']);_0x3f266b['filters']=_[_0x40c7('0x3a')](_0x3f266b[_0x40c7('0x36')],_0x3f266b[_0x40c7('0x38')]);_0x1dbcc4[_0x40c7('0x3b')]=_['intersection'](_0x3f266b[_0x40c7('0x36')],qs['fields'](_0x28e2b2['query'][_0x40c7('0x3c')]));_0x1dbcc4[_0x40c7('0x3b')]=_0x1dbcc4[_0x40c7('0x3b')][_0x40c7('0x3d')]?_0x1dbcc4[_0x40c7('0x3b')]:_0x3f266b['model'];if(_0x28e2b2[_0x40c7('0x38')][_0x40c7('0x48')]){_0x1dbcc4['include']=[{'all':!![]}];}_0x1dbcc4=_[_0x40c7('0x45')]({},_0x1dbcc4,_0x28e2b2[_0x40c7('0x47')]);return db['AnalyticCustomReport'][_0x40c7('0x4f')](_0x1dbcc4)[_0x40c7('0x28')](handleEntityNotFound(_0x4d2cb9,null))['then'](respondWithResult(_0x4d2cb9,null))[_0x40c7('0x4c')](handleError(_0x4d2cb9,null));};exports['create']=function(_0x28fc4d,_0x3315c3){return db['AnalyticCustomReport']['create'](_0x28fc4d['body'],{})['then'](function(_0x5ad102){var _0x5735dc=_0x28fc4d[_0x40c7('0x50')]['get']({'plain':!![]});if(!_0x5735dc)throw new Error(_0x40c7('0x51'));if(_0x5735dc[_0x40c7('0x52')]===_0x40c7('0x50')){var _0x5e3433=_0x5ad102['get']({'plain':!![]});var _0x574803=_0x40c7('0x53');return db['UserProfileSection'][_0x40c7('0x4f')]({'where':{'name':_0x574803,'userProfileId':_0x5735dc[_0x40c7('0x54')]},'raw':!![]})[_0x40c7('0x28')](function(_0x8b1776){if(_0x8b1776&&_0x8b1776[_0x40c7('0x55')]===0x0){return db[_0x40c7('0x2b')][_0x40c7('0x56')]({'name':_0x5e3433[_0x40c7('0x2e')],'resourceId':_0x5e3433['id'],'type':_0x40c7('0x2a'),'sectionId':_0x8b1776['id']},{})['then'](function(){return _0x5ad102;});}else{return _0x5ad102;}})[_0x40c7('0x4c')](function(_0x1d911b){logger[_0x40c7('0x2c')](_0x40c7('0x57'),_0x1d911b);throw _0x1d911b;});}return _0x5ad102;})[_0x40c7('0x28')](respondWithResult(_0x3315c3,0xc9))['catch'](handleError(_0x3315c3,null));};exports[_0x40c7('0x26')]=function(_0x4c4d28,_0x507d76){if(_0x4c4d28[_0x40c7('0x58')]['id']){delete _0x4c4d28[_0x40c7('0x58')]['id'];}return db[_0x40c7('0x31')][_0x40c7('0x4f')]({'where':{'id':_0x4c4d28[_0x40c7('0x4e')]['id']}})[_0x40c7('0x28')](handleEntityNotFound(_0x507d76,null))[_0x40c7('0x28')](saveUpdates(_0x4c4d28['body'],null))[_0x40c7('0x28')](respondWithResult(_0x507d76,null))[_0x40c7('0x4c')](handleError(_0x507d76,null));};exports[_0x40c7('0x27')]=function(_0x28eb9b,_0x58c99d){return db['AnalyticCustomReport'][_0x40c7('0x4f')]({'where':{'id':_0x28eb9b['params']['id']}})[_0x40c7('0x28')](handleEntityNotFound(_0x58c99d,null))[_0x40c7('0x28')](removeEntity(_0x58c99d,null))[_0x40c7('0x4c')](handleError(_0x58c99d,null));};exports[_0x40c7('0x59')]=function(_0x15e596,_0x54f952){var _0x50d744=0xa;var _0xd82fba=[_0x40c7('0x5a'),_0x40c7('0x5b'),_0x40c7('0x5c'),_0x40c7('0x5d')];var _0x37c826={'SUM':_0x40c7('0x5e'),'COUNT':_0x40c7('0x5f'),'COUNT DISTINCT':_0x40c7('0x60'),'MAX':'MAX(%s)','MIN':_0x40c7('0x61'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x40c7('0x62'),'GROUP_CONCAT DESC':_0x40c7('0x63')};var _0x58ebb0={'SEC_TO_TIME':_0x40c7('0x64'),'DATE':_0x40c7('0x65'),'HOUR':_0x40c7('0x66'),'ROUND':_0x40c7('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1e93d2=function(_0xb1cfb8){return!_[_0x40c7('0x68')]([_0x40c7('0x69'),_0x40c7('0x6a'),'IS\x20EMPTY',_0x40c7('0x6b')],_0xb1cfb8);};var _0xe41013=function(_0xc379b3){if(!_0xc379b3||!_0xc379b3[_0x40c7('0x6c')]['length']){return'';}for(var _0x27677d='(',_0x4289bb=0x0;_0x4289bb<_0xc379b3[_0x40c7('0x6c')][_0x40c7('0x3d')];_0x4289bb+=0x1){_0x4289bb>0x0&&(_0x27677d+='\x20'+_0xc379b3[_0x40c7('0x6d')]+'\x20');_0x27677d+=_0xc379b3[_0x40c7('0x6c')][_0x4289bb][_0x40c7('0x6e')]?_0xe41013(_0xc379b3['rules'][_0x4289bb][_0x40c7('0x6e')]):_0xc379b3[_0x40c7('0x6c')][_0x4289bb][_0x40c7('0x6f')]+'\x20'+_0xc379b3[_0x40c7('0x6c')][_0x4289bb][_0x40c7('0x70')]+(_0x1e93d2(_0xc379b3[_0x40c7('0x6c')][_0x4289bb]['condition'])?'\x20'+_0xc379b3['rules'][_0x4289bb]['value']:'');}return _0x27677d+')';};var _0x53b854={'where':{'id':_0x15e596[_0x40c7('0x4e')]['id']}},_0x457cb0,_0x2c76da,_0x147506,_0x1557ef,_0x3dc9be;_0x53b854=_[_0x40c7('0x45')]({},_0x53b854,_0x15e596[_0x40c7('0x47')]);return db[_0x40c7('0x31')][_0x40c7('0x4f')](_0x53b854)['then'](function(_0x4745c7){if(_0x4745c7){_0x457cb0=_0x4745c7;return _0x4745c7[_0x40c7('0x71')]();}return null;})[_0x40c7('0x28')](function(_0x26951f){if(_0x26951f){if(!_0x26951f[_0x40c7('0x3d')]){throw new db[(_0x40c7('0x72'))][(_0x40c7('0x73'))](_0x40c7('0x74'),0x193);}_0x2c76da=_0x26951f;return db[_0x40c7('0x75')][_0x40c7('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x553fb9){if(_0x553fb9){_0x147506=_[_0x40c7('0x76')](_0x553fb9,'id');var _0x2054aa;var _0x13ee44=squel[_0x40c7('0x77')]();_0x13ee44[_0x40c7('0x78')](_0x457cb0[_0x40c7('0x79')]);for(var _0x353b11=0x0;_0x353b11<_0x2c76da['length'];_0x353b11+=0x1){_0x2054aa=_0x2c76da[_0x353b11][_0x40c7('0x7a')]?_0x147506[_0x2c76da[_0x353b11][_0x40c7('0x7a')]][_0x40c7('0x7b')]:_0x2c76da[_0x353b11][_0x40c7('0x6f')];_0x2054aa=_0x2c76da[_0x353b11][_0x40c7('0x7c')]?_[_0x40c7('0x7d')](_0x37c826[_0x2c76da[_0x353b11]['function']],'%s',_0x2054aa):_0x2054aa;_0x2054aa=_0x2c76da[_0x353b11][_0x40c7('0x7e')]?_[_0x40c7('0x7d')](_0x58ebb0[_0x2c76da[_0x353b11][_0x40c7('0x7e')]],'%s',_0x2054aa):_0x2054aa;if(_0x2c76da[_0x353b11][_0x40c7('0x7f')]){_0x13ee44[_0x40c7('0x6e')](_0x2054aa);}_0x2c76da[_0x353b11][_0x40c7('0x80')]&&_0x13ee44[_0x40c7('0x40')](_0x2054aa,_0x2c76da[_0x353b11][_0x40c7('0x80')]===_0x40c7('0x81')?![]:!![]);_0x13ee44['field'](_0x2054aa,_0x2c76da[_0x353b11][_0x40c7('0x82')]||_0x2054aa);}if(_0x457cb0['joins']){_0x457cb0[_0x40c7('0x83')]=JSON['parse'](_0x457cb0[_0x40c7('0x83')]);for(var _0xd6184c=0x0;_0xd6184c<_0x457cb0['joins'][_0x40c7('0x3d')];_0xd6184c+=0x1){if(_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x34')]&&_[_0x40c7('0x68')](_0xd82fba,_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x34')])&&_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x84')]&&_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x85')]&&_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x86')]){_0x13ee44[_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x34')]](_0x457cb0['joins'][_0xd6184c]['foreignTable'],null,util[_0x40c7('0x7e')](_0x40c7('0x87'),_0x457cb0[_0x40c7('0x79')],_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x84')],_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x85')],_0x457cb0[_0x40c7('0x83')][_0xd6184c][_0x40c7('0x86')]));}}}if(_0x457cb0[_0x40c7('0x88')]){_0x457cb0[_0x40c7('0x88')]=JSON[_0x40c7('0x89')](_0x457cb0[_0x40c7('0x88')]);_0x13ee44['where'](_0xe41013(_0x457cb0[_0x40c7('0x88')][_0x40c7('0x6e')]));}_0x3dc9be=_0x13ee44['clone']();_0x13ee44[_0x40c7('0x1d')](_0x50d744);_0x13ee44['offset'](0x0);logger['debug'](_0x40c7('0x8a'),_0x13ee44[_0x40c7('0x8b')]());return dbH[_0x40c7('0x8c')][_0x40c7('0x38')](_0x13ee44[_0x40c7('0x8b')](),{'type':dbH[_0x40c7('0x8c')][_0x40c7('0x8d')][_0x40c7('0x8e')]});}})[_0x40c7('0x28')](respondWithResult(_0x54f952,null))[_0x40c7('0x4c')](handleError(_0x54f952,null));};function runReport(_0x46068d,_0x1bc791,_0x183f17){var _0xcc758e=_0x1bc791[_0x40c7('0x2e')];var _0x3b6310=0xa;var _0x5b1931=['join',_0x40c7('0x5b'),_0x40c7('0x5c'),_0x40c7('0x5d')];var _0x2d43e2={'SUM':_0x40c7('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x40c7('0x60'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x40c7('0x8f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x40c7('0x63')};var _0x550d87={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x40c7('0x65'),'HOUR':_0x40c7('0x66'),'ROUND':_0x40c7('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1e9=function(_0x41f304){return!_[_0x40c7('0x68')]([_0x40c7('0x69'),'IS\x20NOT\x20NULL',_0x40c7('0x90'),'IS\x20NOT\x20EMPTY'],_0x41f304);};var _0x205753=function(_0x39c482){if(!_0x39c482||!_0x39c482['rules']['length']){return'';}for(var _0x1bd470='(',_0x2a1cdb=0x0;_0x2a1cdb<_0x39c482['rules']['length'];_0x2a1cdb+=0x1){_0x2a1cdb>0x0&&(_0x1bd470+='\x20'+_0x39c482['operator']+'\x20');_0x1bd470+=_0x39c482[_0x40c7('0x6c')][_0x2a1cdb][_0x40c7('0x6e')]?_0x205753(_0x39c482[_0x40c7('0x6c')][_0x2a1cdb][_0x40c7('0x6e')]):_0x39c482[_0x40c7('0x6c')][_0x2a1cdb]['field']+'\x20'+_0x39c482[_0x40c7('0x6c')][_0x2a1cdb]['condition']+(_0x34c1e9(_0x39c482[_0x40c7('0x6c')][_0x2a1cdb][_0x40c7('0x70')])?'\x20'+_0x39c482['rules'][_0x2a1cdb][_0x40c7('0x91')]:'');}return _0x1bd470+')';};var _0x2ae098={'where':{'id':_0x46068d['id']}},_0x3a179c,_0x1a33a2,_0x25ebfe,_0x433f0a,_0x3a2bc6;_0x2ae098=_[_0x40c7('0x45')]({},_0x2ae098,_0x183f17);return db['AnalyticCustomReport'][_0x40c7('0x4f')](_0x2ae098)[_0x40c7('0x28')](function(_0x5c60f1){if(_0x5c60f1){_0x3a179c=_0x5c60f1;return _0x5c60f1[_0x40c7('0x71')]();}return null;})['then'](function(_0x3d4b47){if(_0x3d4b47){if(!_0x3d4b47[_0x40c7('0x3d')]){throw new db['Sequelize'][(_0x40c7('0x73'))](_0x40c7('0x74'),0x193);}_0x1a33a2=_0x3d4b47;return db['AnalyticMetric'][_0x40c7('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x207518){if(_0x207518){_0x25ebfe=_[_0x40c7('0x76')](_0x207518,'id');var _0x52c54c;var _0x3b989e=squel[_0x40c7('0x77')]();_0x3b989e[_0x40c7('0x78')](_0x3a179c[_0x40c7('0x79')]);for(var _0x348025=0x0;_0x348025<_0x1a33a2[_0x40c7('0x3d')];_0x348025+=0x1){_0x52c54c=_0x1a33a2[_0x348025][_0x40c7('0x7a')]?_0x25ebfe[_0x1a33a2[_0x348025][_0x40c7('0x7a')]][_0x40c7('0x7b')]:_0x1a33a2[_0x348025][_0x40c7('0x6f')];_0x52c54c=_0x1a33a2[_0x348025][_0x40c7('0x7c')]?_[_0x40c7('0x7d')](_0x2d43e2[_0x1a33a2[_0x348025]['function']],'%s',_0x52c54c):_0x52c54c;_0x52c54c=_0x1a33a2[_0x348025][_0x40c7('0x7e')]?_[_0x40c7('0x7d')](_0x550d87[_0x1a33a2[_0x348025][_0x40c7('0x7e')]],'%s',_0x52c54c):_0x52c54c;if(_0x1a33a2[_0x348025][_0x40c7('0x7f')]){_0x3b989e[_0x40c7('0x6e')](_0x52c54c);}_0x1a33a2[_0x348025]['orderBy']&&_0x3b989e[_0x40c7('0x40')](_0x52c54c,_0x1a33a2[_0x348025][_0x40c7('0x80')]===_0x40c7('0x81')?![]:!![]);_0x3b989e['field'](_0x52c54c,_0x1a33a2[_0x348025][_0x40c7('0x82')]||_0x52c54c);}if(_0x3a179c[_0x40c7('0x83')]){_0x3a179c[_0x40c7('0x83')]=JSON['parse'](_0x3a179c[_0x40c7('0x83')]);for(var _0x3c3e99=0x0;_0x3c3e99<_0x3a179c[_0x40c7('0x83')][_0x40c7('0x3d')];_0x3c3e99+=0x1){if(_0x3a179c[_0x40c7('0x83')][_0x3c3e99][_0x40c7('0x34')]&&_['includes'](_0x5b1931,_0x3a179c['joins'][_0x3c3e99][_0x40c7('0x34')])&&_0x3a179c[_0x40c7('0x83')][_0x3c3e99][_0x40c7('0x84')]&&_0x3a179c[_0x40c7('0x83')][_0x3c3e99][_0x40c7('0x85')]&&_0x3a179c['joins'][_0x3c3e99]['foreignKey']){_0x3b989e[_0x3a179c[_0x40c7('0x83')][_0x3c3e99]['type']](_0x3a179c[_0x40c7('0x83')][_0x3c3e99][_0x40c7('0x85')],null,util[_0x40c7('0x7e')](_0x40c7('0x87'),_0x3a179c[_0x40c7('0x79')],_0x3a179c['joins'][_0x3c3e99][_0x40c7('0x84')],_0x3a179c[_0x40c7('0x83')][_0x3c3e99][_0x40c7('0x85')],_0x3a179c[_0x40c7('0x83')][_0x3c3e99][_0x40c7('0x86')]));}}}if(_0x3a179c[_0x40c7('0x88')]){_0x3a179c[_0x40c7('0x88')]=JSON[_0x40c7('0x89')](_0x3a179c[_0x40c7('0x88')]);_0x3b989e[_0x40c7('0x42')](_0x205753(_0x3a179c[_0x40c7('0x88')][_0x40c7('0x6e')]));}_0x3a2bc6=_0x3b989e[_0x40c7('0x92')]();_0x3b989e[_0x40c7('0x1d')](_0x3b6310);_0x3b989e[_0x40c7('0x1e')](0x0);return;}})[_0x40c7('0x28')](function(){if(_0x1bc791[_0x40c7('0x93')]===_0x40c7('0x94')){return null;}var _0x14c8b9=_['merge'](_0x1bc791,{'name':_0x1bc791[_0x40c7('0x95')]||_0x1bc791[_0x40c7('0x2e')]||_0x3a179c[_0x40c7('0x2e')],'basename':_0xcc758e,'savename':util['format'](_0x40c7('0x96'),_0x1bc791[_0x40c7('0x2e')]||_0x3a179c[_0x40c7('0x2e')],require(_0x40c7('0x97'))[_0x40c7('0x98')](0x4),_0x1bc791[_0x40c7('0x93')]||_0x40c7('0x99')),'reportId':_0x3a179c['id'],'reportType':_0x40c7('0x9a')});return db[_0x40c7('0x9b')][_0x40c7('0x56')](_0x14c8b9,{'raw':!![]});})[_0x40c7('0x28')](function(_0x15afec){if(_0x3a179c[_0x40c7('0x79')]==='cdr'){_0x3a2bc6['where'](_0x3a179c[_0x40c7('0x79')]+_0x40c7('0x9c'),_0x1bc791['startDate'],_0x1bc791[_0x40c7('0x9d')]);}else{_0x3a2bc6[_0x40c7('0x42')](_0x3a179c['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1bc791[_0x40c7('0x9e')],_0x1bc791['endDate']);}if(_0x15afec){logger['info']('Run\x20Query:',_0x3a2bc6[_0x40c7('0x8b')]());require('child_process')[_0x40c7('0x9f')](path[_0x40c7('0x5a')](__dirname,_0x40c7('0xa0'),_0x15afec['output']),[_0x15afec['id'],_0x3a2bc6[_0x40c7('0x8b')](),path['join'](__dirname,'../../files/reports',_0x15afec['savename']),_0xcc758e]);return _0x15afec;}else{var _0x392ce9=squel[_0x40c7('0x77')]();_0x392ce9['from']('('+_0x3a2bc6[_0x40c7('0x8b')]()+')',_0x40c7('0xa1'));_0x392ce9['field'](_0x40c7('0xa2'),_0x40c7('0x1f'));_0x3a2bc6[_0x40c7('0x1d')](_0x1bc791[_0x40c7('0x1d')]||_0x3b6310);_0x3a2bc6[_0x40c7('0x1e')](_0x1bc791[_0x40c7('0x1e')]||0x0);return dbH[_0x40c7('0x8c')][_0x40c7('0x38')](_0x392ce9[_0x40c7('0x8b')](),{'type':dbH['sequelize'][_0x40c7('0x8d')][_0x40c7('0x8e')]})[_0x40c7('0x28')](function(_0x18795d){if(!_0x18795d[_0x40c7('0x3d')]){_0x433f0a=0x0;}else{_0x433f0a=_0x18795d[0x0][_0x40c7('0x1f')]||0x0;}return dbH[_0x40c7('0x8c')][_0x40c7('0x38')](_0x3a2bc6[_0x40c7('0x8b')](),{'type':dbH['sequelize'][_0x40c7('0x8d')][_0x40c7('0x8e')]});})[_0x40c7('0x28')](function(_0x2a2ae8){return{'rows':_0x2a2ae8||[],'count':_0x433f0a};});}});}exports[_0x40c7('0xa3')]=function(_0x389e64,_0x399349){return runReport(_0x389e64[_0x40c7('0x4e')],_0x389e64[_0x40c7('0x38')],_0x389e64[_0x40c7('0x47')])[_0x40c7('0x28')](respondWithResult(_0x399349,null))[_0x40c7('0x4c')](handleError(_0x399349,null));};exports[_0x40c7('0xa4')]=runReport;exports[_0x40c7('0x38')]=function(_0x4d8c1f,_0x138f19){var _0x1c49e2=0xa;var _0x503267=[_0x40c7('0x5a'),_0x40c7('0x5b'),_0x40c7('0x5c'),_0x40c7('0x5d')];var _0x39fcc0={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x40c7('0x60'),'MAX':_0x40c7('0xa5'),'MIN':_0x40c7('0x61'),'AVG':_0x40c7('0xa6'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x40c7('0x62'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x12db73={'SEC_TO_TIME':_0x40c7('0x64'),'DATE':_0x40c7('0x65'),'HOUR':_0x40c7('0x66'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x40c7('0xa7')};var _0x255ddb=function(_0x18c899){return!_[_0x40c7('0x68')]([_0x40c7('0x69'),_0x40c7('0x6a'),_0x40c7('0x90'),'IS\x20NOT\x20EMPTY'],_0x18c899);};var _0x2b936c=function(_0x138ed3){if(!_0x138ed3||!_0x138ed3[_0x40c7('0x6c')][_0x40c7('0x3d')]){return'';}for(var _0x51ee73='(',_0x16572e=0x0;_0x16572e<_0x138ed3[_0x40c7('0x6c')]['length'];_0x16572e+=0x1){_0x16572e>0x0&&(_0x51ee73+='\x20'+_0x138ed3[_0x40c7('0x6d')]+'\x20');_0x51ee73+=_0x138ed3[_0x40c7('0x6c')][_0x16572e][_0x40c7('0x6e')]?_0x2b936c(_0x138ed3[_0x40c7('0x6c')][_0x16572e][_0x40c7('0x6e')]):_0x138ed3[_0x40c7('0x6c')][_0x16572e][_0x40c7('0x6f')]+'\x20'+_0x138ed3[_0x40c7('0x6c')][_0x16572e][_0x40c7('0x70')]+(_0x255ddb(_0x138ed3[_0x40c7('0x6c')][_0x16572e][_0x40c7('0x70')])?'\x20'+_0x138ed3[_0x40c7('0x6c')][_0x16572e][_0x40c7('0x91')]:'');}return _0x51ee73+')';};var _0x16e1fc={'where':{'id':_0x4d8c1f['params']['id']}},_0x5034ad,_0x4cdf28,_0x55e111,_0x4567fc,_0xeb3b6;_0x16e1fc=_[_0x40c7('0x45')]({},_0x16e1fc,_0x4d8c1f[_0x40c7('0x47')]);return db[_0x40c7('0x31')][_0x40c7('0x4f')](_0x16e1fc)[_0x40c7('0x28')](function(_0x3d4a6b){if(_0x3d4a6b){_0x5034ad=_0x3d4a6b;return _0x3d4a6b['getFields']();}return null;})[_0x40c7('0x28')](function(_0x3b6c1b){if(_0x3b6c1b){if(!_0x3b6c1b[_0x40c7('0x3d')]){throw new db['Sequelize'][(_0x40c7('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cdf28=_0x3b6c1b;return db['AnalyticMetric'][_0x40c7('0x4a')]({'raw':!![]});}return null;})[_0x40c7('0x28')](function(_0x557f06){if(_0x557f06){_0x55e111=_['keyBy'](_0x557f06,'id');var _0x1319ae;var _0x2e1407=squel[_0x40c7('0x77')]();_0x2e1407[_0x40c7('0x78')](_0x5034ad[_0x40c7('0x79')]);for(var _0x50c065=0x0;_0x50c065<_0x4cdf28[_0x40c7('0x3d')];_0x50c065+=0x1){_0x1319ae=_0x4cdf28[_0x50c065][_0x40c7('0x7a')]?_0x55e111[_0x4cdf28[_0x50c065][_0x40c7('0x7a')]][_0x40c7('0x7b')]:_0x4cdf28[_0x50c065][_0x40c7('0x6f')];_0x1319ae=_0x4cdf28[_0x50c065][_0x40c7('0x7c')]?_[_0x40c7('0x7d')](_0x39fcc0[_0x4cdf28[_0x50c065]['function']],'%s',_0x1319ae):_0x1319ae;_0x1319ae=_0x4cdf28[_0x50c065][_0x40c7('0x7e')]?_['replace'](_0x12db73[_0x4cdf28[_0x50c065]['format']],'%s',_0x1319ae):_0x1319ae;if(_0x4cdf28[_0x50c065][_0x40c7('0x7f')]){_0x2e1407[_0x40c7('0x6e')](_0x1319ae);}_0x4cdf28[_0x50c065][_0x40c7('0x80')]&&_0x2e1407[_0x40c7('0x40')](_0x1319ae,_0x4cdf28[_0x50c065][_0x40c7('0x80')]===_0x40c7('0x81')?![]:!![]);_0x2e1407[_0x40c7('0x6f')](_0x1319ae,_0x4cdf28[_0x50c065][_0x40c7('0x82')]||_0x1319ae);}if(_0x5034ad[_0x40c7('0x83')]){_0x5034ad[_0x40c7('0x83')]=JSON['parse'](_0x5034ad[_0x40c7('0x83')]);for(var _0x31c259=0x0;_0x31c259<_0x5034ad[_0x40c7('0x83')][_0x40c7('0x3d')];_0x31c259+=0x1){if(_0x5034ad[_0x40c7('0x83')][_0x31c259][_0x40c7('0x34')]&&_['includes'](_0x503267,_0x5034ad[_0x40c7('0x83')][_0x31c259][_0x40c7('0x34')])&&_0x5034ad['joins'][_0x31c259][_0x40c7('0x84')]&&_0x5034ad['joins'][_0x31c259][_0x40c7('0x85')]&&_0x5034ad['joins'][_0x31c259][_0x40c7('0x86')]){_0x2e1407[_0x5034ad['joins'][_0x31c259][_0x40c7('0x34')]](_0x5034ad[_0x40c7('0x83')][_0x31c259][_0x40c7('0x85')],null,util[_0x40c7('0x7e')]('%s.%s\x20=\x20%s.%s',_0x5034ad[_0x40c7('0x79')],_0x5034ad['joins'][_0x31c259][_0x40c7('0x84')],_0x5034ad[_0x40c7('0x83')][_0x31c259]['foreignTable'],_0x5034ad[_0x40c7('0x83')][_0x31c259][_0x40c7('0x86')]));}}}if(_0x5034ad[_0x40c7('0x88')]){_0x5034ad[_0x40c7('0x88')]=JSON['parse'](_0x5034ad[_0x40c7('0x88')]);_0x2e1407['where'](_0x2b936c(_0x5034ad['conditions'][_0x40c7('0x6e')]));}_0xeb3b6=_0x2e1407['clone']();_0x2e1407['limit'](_0x1c49e2);_0x2e1407[_0x40c7('0x1e')](0x0);logger[_0x40c7('0xa8')]('Limited\x20Query:',_0x2e1407[_0x40c7('0x8b')]());return dbH[_0x40c7('0x8c')]['query'](_0x2e1407[_0x40c7('0x8b')](),{'type':dbH[_0x40c7('0x8c')][_0x40c7('0x8d')][_0x40c7('0x8e')]});}})[_0x40c7('0x28')](function(){return{'sql':_0xeb3b6[_0x40c7('0x8b')]()};})[_0x40c7('0x28')](respondWithResult(_0x138f19,null))['catch'](handleError(_0x138f19,null));}; \ No newline at end of file +var _0x1aac=['right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','replace','function','format','groupBy','orderBy','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','toString','sequelize','QueryTypes','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','select','metric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','SELECT','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','IS\x20NOT\x20NULL','DESC','alias','debug','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','get','CustomReports','UserProfileResource','error','name','send','map','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x1aac,0xf7));var _0xc1aa=function(_0x33eb9b,_0x58cfb6){_0x33eb9b=_0x33eb9b-0x0;var _0x4ee9bd=_0x1aac[_0x33eb9b];return _0x4ee9bd;};'use strict';var emlformat=require(_0xc1aa('0x0'));var rimraf=require(_0xc1aa('0x1'));var zipdir=require(_0xc1aa('0x2'));var jsonpatch=require(_0xc1aa('0x3'));var rp=require(_0xc1aa('0x4'));var moment=require('moment');var BPromise=require(_0xc1aa('0x5'));var Mustache=require(_0xc1aa('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc1aa('0x7'));var csv=require(_0xc1aa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1aa('0x9'));var squel=require('squel');var crypto=require(_0xc1aa('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc1aa('0x8'));var querystring=require(_0xc1aa('0xb'));var Papa=require(_0xc1aa('0xc'));var Redis=require(_0xc1aa('0xd'));var authService=require(_0xc1aa('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1aa('0xf'));var logger=require(_0xc1aa('0x10'))(_0xc1aa('0x11'));var utils=require(_0xc1aa('0x12'));var config=require(_0xc1aa('0x13'));var licenseUtil=require(_0xc1aa('0x14'));var db=require(_0xc1aa('0x15'))['db'];var dbH=require('../../mysqldb')[_0xc1aa('0x16')];function respondWithStatusCode(_0x44eeb3,_0x41a57c){_0x41a57c=_0x41a57c||0xcc;return function(_0xb69689){if(_0xb69689){return _0x44eeb3[_0xc1aa('0x17')](_0x41a57c);}return _0x44eeb3[_0xc1aa('0x18')](_0x41a57c)['end']();};}function respondWithResult(_0x393fb2,_0x4a8859){_0x4a8859=_0x4a8859||0xc8;return function(_0x28ce5b){if(_0x28ce5b){return _0x393fb2['status'](_0x4a8859)['json'](_0x28ce5b);}};}function respondWithFilteredResult(_0x224a68,_0x441d00){return function(_0x46ae13){if(_0x46ae13){var _0x14a4a0=typeof _0x441d00[_0xc1aa('0x19')]===_0xc1aa('0x1a')&&typeof _0x441d00[_0xc1aa('0x1b')]===_0xc1aa('0x1a');var _0xa8a1b5=_0x46ae13[_0xc1aa('0x1c')];var _0x9a33b8=_0x14a4a0?0x0:_0x441d00[_0xc1aa('0x19')];var _0x3d3ae7=_0x14a4a0?_0x46ae13[_0xc1aa('0x1c')]:_0x441d00[_0xc1aa('0x19')]+_0x441d00[_0xc1aa('0x1b')];var _0x455c5b;if(_0x3d3ae7>=_0xa8a1b5){_0x3d3ae7=_0xa8a1b5;_0x455c5b=0xc8;}else{_0x455c5b=0xce;}_0x224a68['status'](_0x455c5b);return _0x224a68[_0xc1aa('0x1d')](_0xc1aa('0x1e'),_0x9a33b8+'-'+_0x3d3ae7+'/'+_0xa8a1b5)[_0xc1aa('0x1f')](_0x46ae13);}return null;};}function patchUpdates(_0x7596b0){return function(_0x351a87){try{jsonpatch[_0xc1aa('0x20')](_0x351a87,_0x7596b0,!![]);}catch(_0x3b0867){return BPromise['reject'](_0x3b0867);}return _0x351a87[_0xc1aa('0x21')]();};}function saveUpdates(_0x16d0c0,_0x831d12){return function(_0x372848){if(_0x372848){return _0x372848['update'](_0x16d0c0)[_0xc1aa('0x22')](function(_0x4ad892){return _0x4ad892;});}return null;};}function removeEntity(_0x277907,_0x477e84){return function(_0x413d26){if(_0x413d26){return _0x413d26[_0xc1aa('0x23')]()[_0xc1aa('0x22')](function(){var _0x14dc74=_0x413d26[_0xc1aa('0x24')]({'plain':!![]});var _0x49396d=_0xc1aa('0x25');return db[_0xc1aa('0x26')]['destroy']({'where':{'type':_0x49396d,'resourceId':_0x14dc74['id']}})['then'](function(){return _0x413d26;});})[_0xc1aa('0x22')](function(){_0x277907[_0xc1aa('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11eaa9,_0xc3d52){return function(_0x4a6858){if(!_0x4a6858){_0x11eaa9[_0xc1aa('0x17')](0x194);}return _0x4a6858;};}function handleError(_0x21ff83,_0x68f243){_0x68f243=_0x68f243||0x1f4;return function(_0x4fac78){logger[_0xc1aa('0x27')](_0x4fac78['stack']);if(_0x4fac78[_0xc1aa('0x28')]){delete _0x4fac78['name'];}_0x21ff83['status'](_0x68f243)[_0xc1aa('0x29')](_0x4fac78);};}exports['index']=function(_0x56b21b,_0x23186e){var _0x242f8d={},_0x227aee={},_0x1c3e9b={'count':0x0,'rows':[]};var _0xae966e=_[_0xc1aa('0x2a')](db['AnalyticCustomReport']['rawAttributes'],function(_0x39c00c){return{'name':_0x39c00c['fieldName'],'type':_0x39c00c['type'][_0xc1aa('0x2b')]};});_0x227aee['model']=_[_0xc1aa('0x2a')](_0xae966e,'name');_0x227aee[_0xc1aa('0x2c')]=_['keys'](_0x56b21b[_0xc1aa('0x2c')]);_0x227aee[_0xc1aa('0x2d')]=_[_0xc1aa('0x2e')](_0x227aee[_0xc1aa('0x2f')],_0x227aee[_0xc1aa('0x2c')]);_0x242f8d[_0xc1aa('0x30')]=_[_0xc1aa('0x2e')](_0x227aee[_0xc1aa('0x2f')],qs[_0xc1aa('0x31')](_0x56b21b[_0xc1aa('0x2c')][_0xc1aa('0x31')]));_0x242f8d[_0xc1aa('0x30')]=_0x242f8d[_0xc1aa('0x30')][_0xc1aa('0x32')]?_0x242f8d[_0xc1aa('0x30')]:_0x227aee['model'];if(!_0x56b21b['query'][_0xc1aa('0x33')]('nolimit')){_0x242f8d[_0xc1aa('0x1b')]=qs['limit'](_0x56b21b[_0xc1aa('0x2c')][_0xc1aa('0x1b')]);_0x242f8d[_0xc1aa('0x19')]=qs[_0xc1aa('0x19')](_0x56b21b[_0xc1aa('0x2c')]['offset']);}_0x242f8d[_0xc1aa('0x34')]=qs[_0xc1aa('0x35')](_0x56b21b[_0xc1aa('0x2c')][_0xc1aa('0x35')]);_0x242f8d[_0xc1aa('0x36')]=qs[_0xc1aa('0x2d')](_[_0xc1aa('0x37')](_0x56b21b['query'],_0x227aee[_0xc1aa('0x2d')]),_0xae966e);if(_0x56b21b[_0xc1aa('0x2c')][_0xc1aa('0x38')]){_0x242f8d[_0xc1aa('0x36')]=_[_0xc1aa('0x39')](_0x242f8d['where'],{'$or':_[_0xc1aa('0x2a')](_0xae966e,function(_0x2735df){if(_0x2735df['type']!==_0xc1aa('0x3a')){var _0x2d7bfe={};_0x2d7bfe[_0x2735df[_0xc1aa('0x28')]]={'$like':'%'+_0x56b21b['query'][_0xc1aa('0x38')]+'%'};return _0x2d7bfe;}})});}_0x242f8d=_[_0xc1aa('0x39')]({},_0x242f8d,_0x56b21b[_0xc1aa('0x3b')]);var _0x30a5ed={'where':_0x242f8d['where']};return db[_0xc1aa('0x3c')]['count'](_0x30a5ed)[_0xc1aa('0x22')](function(_0x2c782b){_0x1c3e9b[_0xc1aa('0x1c')]=_0x2c782b;if(_0x56b21b['query'][_0xc1aa('0x3d')]){_0x242f8d[_0xc1aa('0x3e')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xc1aa('0x3f')](_0x242f8d);})[_0xc1aa('0x22')](function(_0xa07b3a){_0x1c3e9b[_0xc1aa('0x40')]=_0xa07b3a;return _0x1c3e9b;})[_0xc1aa('0x22')](respondWithFilteredResult(_0x23186e,_0x242f8d))[_0xc1aa('0x41')](handleError(_0x23186e,null));};exports[_0xc1aa('0x42')]=function(_0xeebe07,_0x2ef2bc){var _0x19334e={'raw':![],'where':{'id':_0xeebe07[_0xc1aa('0x43')]['id']}},_0x7c124={};_0x7c124[_0xc1aa('0x2f')]=_[_0xc1aa('0x44')](db[_0xc1aa('0x3c')][_0xc1aa('0x45')]);_0x7c124[_0xc1aa('0x2c')]=_[_0xc1aa('0x44')](_0xeebe07[_0xc1aa('0x2c')]);_0x7c124['filters']=_[_0xc1aa('0x2e')](_0x7c124[_0xc1aa('0x2f')],_0x7c124[_0xc1aa('0x2c')]);_0x19334e[_0xc1aa('0x30')]=_[_0xc1aa('0x2e')](_0x7c124['model'],qs[_0xc1aa('0x31')](_0xeebe07[_0xc1aa('0x2c')][_0xc1aa('0x31')]));_0x19334e[_0xc1aa('0x30')]=_0x19334e['attributes'][_0xc1aa('0x32')]?_0x19334e[_0xc1aa('0x30')]:_0x7c124[_0xc1aa('0x2f')];if(_0xeebe07[_0xc1aa('0x2c')][_0xc1aa('0x3d')]){_0x19334e[_0xc1aa('0x3e')]=[{'all':!![]}];}_0x19334e=_[_0xc1aa('0x39')]({},_0x19334e,_0xeebe07[_0xc1aa('0x3b')]);return db['AnalyticCustomReport'][_0xc1aa('0x46')](_0x19334e)['then'](handleEntityNotFound(_0x2ef2bc,null))[_0xc1aa('0x22')](respondWithResult(_0x2ef2bc,null))[_0xc1aa('0x41')](handleError(_0x2ef2bc,null));};exports[_0xc1aa('0x47')]=function(_0x56ce29,_0x150180){return db[_0xc1aa('0x3c')][_0xc1aa('0x47')](_0x56ce29['body'],{})[_0xc1aa('0x22')](function(_0x9ce796){var _0x30a113=_0x56ce29[_0xc1aa('0x48')][_0xc1aa('0x24')]({'plain':!![]});if(!_0x30a113)throw new Error(_0xc1aa('0x49'));if(_0x30a113[_0xc1aa('0x4a')]===_0xc1aa('0x48')){var _0x42383e=_0x9ce796[_0xc1aa('0x24')]({'plain':!![]});var _0x3d6bc5=_0xc1aa('0x4b');return db[_0xc1aa('0x4c')][_0xc1aa('0x46')]({'where':{'name':_0x3d6bc5,'userProfileId':_0x30a113[_0xc1aa('0x4d')]},'raw':!![]})[_0xc1aa('0x22')](function(_0xb27003){if(_0xb27003&&_0xb27003[_0xc1aa('0x4e')]===0x0){return db[_0xc1aa('0x26')][_0xc1aa('0x47')]({'name':_0x42383e[_0xc1aa('0x28')],'resourceId':_0x42383e['id'],'type':'CustomReports','sectionId':_0xb27003['id']},{})['then'](function(){return _0x9ce796;});}else{return _0x9ce796;}})[_0xc1aa('0x41')](function(_0x4083fe){logger[_0xc1aa('0x27')](_0xc1aa('0x4f'),_0x4083fe);throw _0x4083fe;});}return _0x9ce796;})[_0xc1aa('0x22')](respondWithResult(_0x150180,0xc9))[_0xc1aa('0x41')](handleError(_0x150180,null));};exports[_0xc1aa('0x50')]=function(_0x2ff238,_0x50877c){if(_0x2ff238[_0xc1aa('0x51')]['id']){delete _0x2ff238[_0xc1aa('0x51')]['id'];}return db[_0xc1aa('0x3c')][_0xc1aa('0x46')]({'where':{'id':_0x2ff238[_0xc1aa('0x43')]['id']}})[_0xc1aa('0x22')](handleEntityNotFound(_0x50877c,null))[_0xc1aa('0x22')](saveUpdates(_0x2ff238['body'],null))[_0xc1aa('0x22')](respondWithResult(_0x50877c,null))[_0xc1aa('0x41')](handleError(_0x50877c,null));};exports['destroy']=function(_0x3f873c,_0x288362){return db['AnalyticCustomReport'][_0xc1aa('0x46')]({'where':{'id':_0x3f873c[_0xc1aa('0x43')]['id']}})[_0xc1aa('0x22')](handleEntityNotFound(_0x288362,null))[_0xc1aa('0x22')](removeEntity(_0x288362,null))[_0xc1aa('0x41')](handleError(_0x288362,null));};exports[_0xc1aa('0x52')]=function(_0x24980f,_0x572060){var _0x53cd73=0xa;var _0x5843e7=[_0xc1aa('0x53'),_0xc1aa('0x54'),_0xc1aa('0x55'),_0xc1aa('0x56')];var _0x157d9f={'SUM':_0xc1aa('0x57'),'COUNT':_0xc1aa('0x58'),'COUNT DISTINCT':_0xc1aa('0x59'),'MAX':_0xc1aa('0x5a'),'MIN':_0xc1aa('0x5b'),'AVG':_0xc1aa('0x5c'),'GROUP_CONCAT':_0xc1aa('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x423ad3={'SEC_TO_TIME':_0xc1aa('0x5e'),'DATE':_0xc1aa('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0xc1aa('0x60'),'UNIX_TIMESTAMP':_0xc1aa('0x61')};var _0x547c3c=function(_0x35e814){return!_[_0xc1aa('0x62')]([_0xc1aa('0x63'),'IS\x20NOT\x20NULL',_0xc1aa('0x64'),_0xc1aa('0x65')],_0x35e814);};var _0x5dae7d=function(_0x35f8d8){if(!_0x35f8d8||!_0x35f8d8[_0xc1aa('0x66')][_0xc1aa('0x32')]){return'';}for(var _0x4c1db4='(',_0x1fc32a=0x0;_0x1fc32a<_0x35f8d8[_0xc1aa('0x66')][_0xc1aa('0x32')];_0x1fc32a+=0x1){_0x1fc32a>0x0&&(_0x4c1db4+='\x20'+_0x35f8d8[_0xc1aa('0x67')]+'\x20');_0x4c1db4+=_0x35f8d8[_0xc1aa('0x66')][_0x1fc32a][_0xc1aa('0x68')]?_0x5dae7d(_0x35f8d8['rules'][_0x1fc32a][_0xc1aa('0x68')]):_0x35f8d8['rules'][_0x1fc32a][_0xc1aa('0x69')]+'\x20'+_0x35f8d8[_0xc1aa('0x66')][_0x1fc32a]['condition']+(_0x547c3c(_0x35f8d8[_0xc1aa('0x66')][_0x1fc32a][_0xc1aa('0x6a')])?'\x20'+_0x35f8d8[_0xc1aa('0x66')][_0x1fc32a][_0xc1aa('0x6b')]:'');}return _0x4c1db4+')';};var _0x28769c={'where':{'id':_0x24980f['params']['id']}},_0x3fe7ce,_0x529171,_0x3389b1,_0x21e802,_0x4e509c;_0x28769c=_['merge']({},_0x28769c,_0x24980f[_0xc1aa('0x3b')]);return db[_0xc1aa('0x3c')]['find'](_0x28769c)[_0xc1aa('0x22')](function(_0x336eb0){if(_0x336eb0){_0x3fe7ce=_0x336eb0;return _0x336eb0[_0xc1aa('0x6c')]();}return null;})['then'](function(_0x13548c){if(_0x13548c){if(!_0x13548c[_0xc1aa('0x32')]){throw new db[(_0xc1aa('0x6d'))][(_0xc1aa('0x6e'))](_0xc1aa('0x6f'),0x193);}_0x529171=_0x13548c;return db[_0xc1aa('0x70')][_0xc1aa('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x3da79d){if(_0x3da79d){_0x3389b1=_[_0xc1aa('0x71')](_0x3da79d,'id');var _0x6d94f5;var _0xb1505=squel['select']();_0xb1505[_0xc1aa('0x72')](_0x3fe7ce[_0xc1aa('0x73')]);for(var _0x40fb18=0x0;_0x40fb18<_0x529171[_0xc1aa('0x32')];_0x40fb18+=0x1){_0x6d94f5=_0x529171[_0x40fb18][_0xc1aa('0x74')]?_0x3389b1[_0x529171[_0x40fb18][_0xc1aa('0x74')]]['metric']:_0x529171[_0x40fb18][_0xc1aa('0x69')];_0x6d94f5=_0x529171[_0x40fb18]['function']?_[_0xc1aa('0x75')](_0x157d9f[_0x529171[_0x40fb18][_0xc1aa('0x76')]],'%s',_0x6d94f5):_0x6d94f5;_0x6d94f5=_0x529171[_0x40fb18][_0xc1aa('0x77')]?_['replace'](_0x423ad3[_0x529171[_0x40fb18][_0xc1aa('0x77')]],'%s',_0x6d94f5):_0x6d94f5;if(_0x529171[_0x40fb18][_0xc1aa('0x78')]){_0xb1505[_0xc1aa('0x68')](_0x6d94f5);}_0x529171[_0x40fb18]['orderBy']&&_0xb1505[_0xc1aa('0x34')](_0x6d94f5,_0x529171[_0x40fb18][_0xc1aa('0x79')]==='DESC'?![]:!![]);_0xb1505[_0xc1aa('0x69')](_0x6d94f5,_0x529171[_0x40fb18]['alias']||_0x6d94f5);}if(_0x3fe7ce[_0xc1aa('0x7a')]){_0x3fe7ce[_0xc1aa('0x7a')]=JSON[_0xc1aa('0x7b')](_0x3fe7ce[_0xc1aa('0x7a')]);for(var _0x613e01=0x0;_0x613e01<_0x3fe7ce[_0xc1aa('0x7a')][_0xc1aa('0x32')];_0x613e01+=0x1){if(_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01][_0xc1aa('0x7c')]&&_[_0xc1aa('0x62')](_0x5843e7,_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01]['type'])&&_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01][_0xc1aa('0x7d')]&&_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01][_0xc1aa('0x7e')]&&_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01][_0xc1aa('0x7f')]){_0xb1505[_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01][_0xc1aa('0x7c')]](_0x3fe7ce['joins'][_0x613e01][_0xc1aa('0x7e')],null,util['format'](_0xc1aa('0x80'),_0x3fe7ce[_0xc1aa('0x73')],_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01]['parentKey'],_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01][_0xc1aa('0x7e')],_0x3fe7ce[_0xc1aa('0x7a')][_0x613e01]['foreignKey']));}}}if(_0x3fe7ce['conditions']){_0x3fe7ce[_0xc1aa('0x81')]=JSON[_0xc1aa('0x7b')](_0x3fe7ce[_0xc1aa('0x81')]);_0xb1505[_0xc1aa('0x36')](_0x5dae7d(_0x3fe7ce[_0xc1aa('0x81')][_0xc1aa('0x68')]));}_0x4e509c=_0xb1505[_0xc1aa('0x82')]();_0xb1505['limit'](_0x53cd73);_0xb1505['offset'](0x0);logger['debug']('Limited\x20Query:',_0xb1505[_0xc1aa('0x83')]());return dbH['sequelize']['query'](_0xb1505[_0xc1aa('0x83')](),{'type':dbH[_0xc1aa('0x84')][_0xc1aa('0x85')]['SELECT']});}})[_0xc1aa('0x22')](respondWithResult(_0x572060,null))[_0xc1aa('0x41')](handleError(_0x572060,null));};function runReport(_0x3ec401,_0x256293,_0x312047){var _0x407622=_0x256293['name'];var _0x476337=0xa;var _0x1a93de=[_0xc1aa('0x53'),_0xc1aa('0x54'),_0xc1aa('0x55'),_0xc1aa('0x56')];var _0x582f89={'SUM':_0xc1aa('0x57'),'COUNT':_0xc1aa('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc1aa('0x5a'),'MIN':_0xc1aa('0x5b'),'AVG':_0xc1aa('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc1aa('0x86')};var _0x1cccb8={'SEC_TO_TIME':_0xc1aa('0x5e'),'DATE':_0xc1aa('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0xc1aa('0x60'),'UNIX_TIMESTAMP':_0xc1aa('0x61')};var _0x5d3d67=function(_0x14213e){return!_[_0xc1aa('0x62')]([_0xc1aa('0x63'),'IS\x20NOT\x20NULL',_0xc1aa('0x64'),_0xc1aa('0x65')],_0x14213e);};var _0x37a967=function(_0x122cd4){if(!_0x122cd4||!_0x122cd4[_0xc1aa('0x66')][_0xc1aa('0x32')]){return'';}for(var _0x295fcd='(',_0x320227=0x0;_0x320227<_0x122cd4['rules'][_0xc1aa('0x32')];_0x320227+=0x1){_0x320227>0x0&&(_0x295fcd+='\x20'+_0x122cd4[_0xc1aa('0x67')]+'\x20');_0x295fcd+=_0x122cd4[_0xc1aa('0x66')][_0x320227][_0xc1aa('0x68')]?_0x37a967(_0x122cd4['rules'][_0x320227][_0xc1aa('0x68')]):_0x122cd4[_0xc1aa('0x66')][_0x320227][_0xc1aa('0x69')]+'\x20'+_0x122cd4[_0xc1aa('0x66')][_0x320227]['condition']+(_0x5d3d67(_0x122cd4[_0xc1aa('0x66')][_0x320227][_0xc1aa('0x6a')])?'\x20'+_0x122cd4['rules'][_0x320227][_0xc1aa('0x6b')]:'');}return _0x295fcd+')';};var _0x800f31={'where':{'id':_0x3ec401['id']}},_0x5886af,_0x2952e5,_0x42987d,_0x259f7e,_0x5abd74;_0x800f31=_[_0xc1aa('0x39')]({},_0x800f31,_0x312047);return db[_0xc1aa('0x3c')][_0xc1aa('0x46')](_0x800f31)[_0xc1aa('0x22')](function(_0x243fd8){if(_0x243fd8){_0x5886af=_0x243fd8;return _0x243fd8[_0xc1aa('0x6c')]();}return null;})[_0xc1aa('0x22')](function(_0xc63595){if(_0xc63595){if(!_0xc63595[_0xc1aa('0x32')]){throw new db[(_0xc1aa('0x6d'))][(_0xc1aa('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2952e5=_0xc63595;return db['AnalyticMetric'][_0xc1aa('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x4973b8){if(_0x4973b8){_0x42987d=_[_0xc1aa('0x71')](_0x4973b8,'id');var _0xd860ba;var _0x91a980=squel[_0xc1aa('0x87')]();_0x91a980[_0xc1aa('0x72')](_0x5886af[_0xc1aa('0x73')]);for(var _0x573fc9=0x0;_0x573fc9<_0x2952e5[_0xc1aa('0x32')];_0x573fc9+=0x1){_0xd860ba=_0x2952e5[_0x573fc9][_0xc1aa('0x74')]?_0x42987d[_0x2952e5[_0x573fc9]['MetricId']][_0xc1aa('0x88')]:_0x2952e5[_0x573fc9]['field'];_0xd860ba=_0x2952e5[_0x573fc9][_0xc1aa('0x76')]?_['replace'](_0x582f89[_0x2952e5[_0x573fc9][_0xc1aa('0x76')]],'%s',_0xd860ba):_0xd860ba;_0xd860ba=_0x2952e5[_0x573fc9][_0xc1aa('0x77')]?_[_0xc1aa('0x75')](_0x1cccb8[_0x2952e5[_0x573fc9][_0xc1aa('0x77')]],'%s',_0xd860ba):_0xd860ba;if(_0x2952e5[_0x573fc9]['groupBy']){_0x91a980[_0xc1aa('0x68')](_0xd860ba);}_0x2952e5[_0x573fc9][_0xc1aa('0x79')]&&_0x91a980[_0xc1aa('0x34')](_0xd860ba,_0x2952e5[_0x573fc9][_0xc1aa('0x79')]==='DESC'?![]:!![]);_0x91a980[_0xc1aa('0x69')](_0xd860ba,_0x2952e5[_0x573fc9]['alias']||_0xd860ba);}if(_0x5886af['joins']){_0x5886af[_0xc1aa('0x7a')]=JSON[_0xc1aa('0x7b')](_0x5886af[_0xc1aa('0x7a')]);for(var _0x5ea8f4=0x0;_0x5ea8f4<_0x5886af[_0xc1aa('0x7a')]['length'];_0x5ea8f4+=0x1){if(_0x5886af[_0xc1aa('0x7a')][_0x5ea8f4]['type']&&_[_0xc1aa('0x62')](_0x1a93de,_0x5886af[_0xc1aa('0x7a')][_0x5ea8f4][_0xc1aa('0x7c')])&&_0x5886af[_0xc1aa('0x7a')][_0x5ea8f4][_0xc1aa('0x7d')]&&_0x5886af['joins'][_0x5ea8f4][_0xc1aa('0x7e')]&&_0x5886af[_0xc1aa('0x7a')][_0x5ea8f4]['foreignKey']){_0x91a980[_0x5886af[_0xc1aa('0x7a')][_0x5ea8f4][_0xc1aa('0x7c')]](_0x5886af['joins'][_0x5ea8f4][_0xc1aa('0x7e')],null,util[_0xc1aa('0x77')](_0xc1aa('0x80'),_0x5886af[_0xc1aa('0x73')],_0x5886af['joins'][_0x5ea8f4][_0xc1aa('0x7d')],_0x5886af[_0xc1aa('0x7a')][_0x5ea8f4]['foreignTable'],_0x5886af[_0xc1aa('0x7a')][_0x5ea8f4]['foreignKey']));}}}if(_0x5886af[_0xc1aa('0x81')]){_0x5886af[_0xc1aa('0x81')]=JSON[_0xc1aa('0x7b')](_0x5886af[_0xc1aa('0x81')]);_0x91a980[_0xc1aa('0x36')](_0x37a967(_0x5886af[_0xc1aa('0x81')][_0xc1aa('0x68')]));}_0x5abd74=_0x91a980[_0xc1aa('0x82')]();_0x91a980['limit'](_0x476337);_0x91a980[_0xc1aa('0x19')](0x0);return;}})[_0xc1aa('0x22')](function(){if(_0x256293[_0xc1aa('0x89')]===_0xc1aa('0x8a')){return null;}var _0x5297d6=_[_0xc1aa('0x39')](_0x256293,{'name':_0x256293[_0xc1aa('0x8b')]||_0x256293[_0xc1aa('0x28')]||_0x5886af[_0xc1aa('0x28')],'basename':_0x407622,'savename':util[_0xc1aa('0x77')](_0xc1aa('0x8c'),_0x256293[_0xc1aa('0x28')]||_0x5886af[_0xc1aa('0x28')],require(_0xc1aa('0x8d'))[_0xc1aa('0x8e')](0x4),_0x256293[_0xc1aa('0x89')]||_0xc1aa('0x8f')),'reportId':_0x5886af['id'],'reportType':'custom'});return db[_0xc1aa('0x90')][_0xc1aa('0x47')](_0x5297d6,{'raw':!![]});})[_0xc1aa('0x22')](function(_0x3f8f3e){if(_0x5886af['table']===_0xc1aa('0x91')){_0x5abd74[_0xc1aa('0x36')](_0x5886af[_0xc1aa('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x256293[_0xc1aa('0x92')],_0x256293[_0xc1aa('0x93')]);}else{_0x5abd74[_0xc1aa('0x36')](_0x5886af['table']+_0xc1aa('0x94'),_0x256293[_0xc1aa('0x92')],_0x256293[_0xc1aa('0x93')]);}if(_0x3f8f3e){logger['info'](_0xc1aa('0x95'),_0x5abd74[_0xc1aa('0x83')]());require(_0xc1aa('0x96'))[_0xc1aa('0x97')](path[_0xc1aa('0x53')](__dirname,_0xc1aa('0x98'),_0x3f8f3e[_0xc1aa('0x89')]),[_0x3f8f3e['id'],_0x5abd74[_0xc1aa('0x83')](),path[_0xc1aa('0x53')](__dirname,'../../files/reports',_0x3f8f3e[_0xc1aa('0x99')]),_0x407622]);return _0x3f8f3e;}else{var _0x9af7fc=squel['select']();_0x9af7fc[_0xc1aa('0x72')]('('+_0x5abd74[_0xc1aa('0x83')]()+')',_0xc1aa('0x9a'));_0x9af7fc['field'](_0xc1aa('0x9b'),_0xc1aa('0x1c'));_0x5abd74['limit'](_0x256293[_0xc1aa('0x1b')]||_0x476337);_0x5abd74[_0xc1aa('0x19')](_0x256293['offset']||0x0);return dbH[_0xc1aa('0x84')][_0xc1aa('0x2c')](_0x9af7fc['toString'](),{'type':dbH[_0xc1aa('0x84')][_0xc1aa('0x85')][_0xc1aa('0x9c')]})[_0xc1aa('0x22')](function(_0x5f1303){if(!_0x5f1303[_0xc1aa('0x32')]){_0x259f7e=0x0;}else{_0x259f7e=_0x5f1303[0x0]['count']||0x0;}return dbH[_0xc1aa('0x84')]['query'](_0x5abd74[_0xc1aa('0x83')](),{'type':dbH['sequelize'][_0xc1aa('0x85')][_0xc1aa('0x9c')]});})[_0xc1aa('0x22')](function(_0x1b5b00){return{'rows':_0x1b5b00||[],'count':_0x259f7e};});}});}exports[_0xc1aa('0x9d')]=function(_0x82d754,_0x2cca8b){return runReport(_0x82d754[_0xc1aa('0x43')],_0x82d754[_0xc1aa('0x2c')],_0x82d754[_0xc1aa('0x3b')])['then'](respondWithResult(_0x2cca8b,null))[_0xc1aa('0x41')](handleError(_0x2cca8b,null));};exports[_0xc1aa('0x9e')]=runReport;exports[_0xc1aa('0x2c')]=function(_0x2c9511,_0x22cd7d){var _0x3a83f6=0xa;var _0x5d6c2c=[_0xc1aa('0x53'),_0xc1aa('0x54'),_0xc1aa('0x55'),_0xc1aa('0x56')];var _0x4ec664={'SUM':_0xc1aa('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc1aa('0x59'),'MAX':_0xc1aa('0x5a'),'MIN':'MIN(%s)','AVG':_0xc1aa('0x5c'),'GROUP_CONCAT':_0xc1aa('0x5d'),'GROUP_CONCAT ASC':_0xc1aa('0x9f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x151873={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xc1aa('0x5f'),'HOUR':_0xc1aa('0xa0'),'ROUND':_0xc1aa('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x426980=function(_0x10af7a){return!_[_0xc1aa('0x62')](['IS\x20NULL',_0xc1aa('0xa1'),_0xc1aa('0x64'),_0xc1aa('0x65')],_0x10af7a);};var _0x4cb823=function(_0x360a10){if(!_0x360a10||!_0x360a10[_0xc1aa('0x66')][_0xc1aa('0x32')]){return'';}for(var _0x3aa935='(',_0x535ef3=0x0;_0x535ef3<_0x360a10[_0xc1aa('0x66')][_0xc1aa('0x32')];_0x535ef3+=0x1){_0x535ef3>0x0&&(_0x3aa935+='\x20'+_0x360a10['operator']+'\x20');_0x3aa935+=_0x360a10[_0xc1aa('0x66')][_0x535ef3][_0xc1aa('0x68')]?_0x4cb823(_0x360a10['rules'][_0x535ef3][_0xc1aa('0x68')]):_0x360a10[_0xc1aa('0x66')][_0x535ef3][_0xc1aa('0x69')]+'\x20'+_0x360a10['rules'][_0x535ef3]['condition']+(_0x426980(_0x360a10[_0xc1aa('0x66')][_0x535ef3][_0xc1aa('0x6a')])?'\x20'+_0x360a10['rules'][_0x535ef3][_0xc1aa('0x6b')]:'');}return _0x3aa935+')';};var _0x4bd2cc={'where':{'id':_0x2c9511[_0xc1aa('0x43')]['id']}},_0x5e3ed6,_0x1551c5,_0x1d189c,_0x26e98f,_0x4c9c7f;_0x4bd2cc=_[_0xc1aa('0x39')]({},_0x4bd2cc,_0x2c9511[_0xc1aa('0x3b')]);return db[_0xc1aa('0x3c')][_0xc1aa('0x46')](_0x4bd2cc)[_0xc1aa('0x22')](function(_0x5a893e){if(_0x5a893e){_0x5e3ed6=_0x5a893e;return _0x5a893e['getFields']();}return null;})['then'](function(_0x222a3f){if(_0x222a3f){if(!_0x222a3f['length']){throw new db[(_0xc1aa('0x6d'))][(_0xc1aa('0x6e'))](_0xc1aa('0x6f'),0x193);}_0x1551c5=_0x222a3f;return db[_0xc1aa('0x70')][_0xc1aa('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x5a6188){if(_0x5a6188){_0x1d189c=_[_0xc1aa('0x71')](_0x5a6188,'id');var _0x1f1a31;var _0x2fc693=squel['select']();_0x2fc693[_0xc1aa('0x72')](_0x5e3ed6['table']);for(var _0x52b978=0x0;_0x52b978<_0x1551c5[_0xc1aa('0x32')];_0x52b978+=0x1){_0x1f1a31=_0x1551c5[_0x52b978][_0xc1aa('0x74')]?_0x1d189c[_0x1551c5[_0x52b978][_0xc1aa('0x74')]][_0xc1aa('0x88')]:_0x1551c5[_0x52b978][_0xc1aa('0x69')];_0x1f1a31=_0x1551c5[_0x52b978]['function']?_['replace'](_0x4ec664[_0x1551c5[_0x52b978][_0xc1aa('0x76')]],'%s',_0x1f1a31):_0x1f1a31;_0x1f1a31=_0x1551c5[_0x52b978][_0xc1aa('0x77')]?_[_0xc1aa('0x75')](_0x151873[_0x1551c5[_0x52b978][_0xc1aa('0x77')]],'%s',_0x1f1a31):_0x1f1a31;if(_0x1551c5[_0x52b978][_0xc1aa('0x78')]){_0x2fc693[_0xc1aa('0x68')](_0x1f1a31);}_0x1551c5[_0x52b978][_0xc1aa('0x79')]&&_0x2fc693[_0xc1aa('0x34')](_0x1f1a31,_0x1551c5[_0x52b978][_0xc1aa('0x79')]===_0xc1aa('0xa2')?![]:!![]);_0x2fc693[_0xc1aa('0x69')](_0x1f1a31,_0x1551c5[_0x52b978][_0xc1aa('0xa3')]||_0x1f1a31);}if(_0x5e3ed6[_0xc1aa('0x7a')]){_0x5e3ed6['joins']=JSON[_0xc1aa('0x7b')](_0x5e3ed6['joins']);for(var _0x335994=0x0;_0x335994<_0x5e3ed6[_0xc1aa('0x7a')][_0xc1aa('0x32')];_0x335994+=0x1){if(_0x5e3ed6[_0xc1aa('0x7a')][_0x335994]['type']&&_[_0xc1aa('0x62')](_0x5d6c2c,_0x5e3ed6[_0xc1aa('0x7a')][_0x335994][_0xc1aa('0x7c')])&&_0x5e3ed6[_0xc1aa('0x7a')][_0x335994]['parentKey']&&_0x5e3ed6[_0xc1aa('0x7a')][_0x335994][_0xc1aa('0x7e')]&&_0x5e3ed6[_0xc1aa('0x7a')][_0x335994][_0xc1aa('0x7f')]){_0x2fc693[_0x5e3ed6[_0xc1aa('0x7a')][_0x335994]['type']](_0x5e3ed6['joins'][_0x335994][_0xc1aa('0x7e')],null,util['format'](_0xc1aa('0x80'),_0x5e3ed6[_0xc1aa('0x73')],_0x5e3ed6[_0xc1aa('0x7a')][_0x335994]['parentKey'],_0x5e3ed6[_0xc1aa('0x7a')][_0x335994][_0xc1aa('0x7e')],_0x5e3ed6[_0xc1aa('0x7a')][_0x335994][_0xc1aa('0x7f')]));}}}if(_0x5e3ed6[_0xc1aa('0x81')]){_0x5e3ed6[_0xc1aa('0x81')]=JSON['parse'](_0x5e3ed6[_0xc1aa('0x81')]);_0x2fc693[_0xc1aa('0x36')](_0x4cb823(_0x5e3ed6[_0xc1aa('0x81')][_0xc1aa('0x68')]));}_0x4c9c7f=_0x2fc693['clone']();_0x2fc693['limit'](_0x3a83f6);_0x2fc693[_0xc1aa('0x19')](0x0);logger[_0xc1aa('0xa4')](_0xc1aa('0xa5'),_0x2fc693[_0xc1aa('0x83')]());return dbH[_0xc1aa('0x84')]['query'](_0x2fc693[_0xc1aa('0x83')](),{'type':dbH['sequelize'][_0xc1aa('0x85')][_0xc1aa('0x9c')]});}})[_0xc1aa('0x22')](function(){return{'sql':_0x4c9c7f['toString']()};})[_0xc1aa('0x22')](respondWithResult(_0x22cd7d,null))[_0xc1aa('0x41')](handleError(_0x22cd7d,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index edf7764..5170c20 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 _0x0e11=['path','../../config/environment','./analyticCustomReport.attributes','analytics_custom_reports','../../config/logger','moment'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x0e11,0xac));var _0x10e1=function(_0x2c14dc,_0xccf442){_0x2c14dc=_0x2c14dc-0x0;var _0x1f18e5=_0x0e11[_0x2c14dc];return _0x1f18e5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x10e1('0x0'))('api');var moment=require(_0x10e1('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x10e1('0x2'));var rimraf=require('rimraf');var config=require(_0x10e1('0x3'));var attributes=require(_0x10e1('0x4'));module['exports']=function(_0x3dfd3e,_0x45a19c){return _0x3dfd3e['define']('AnalyticCustomReport',attributes,{'tableName':_0x10e1('0x5'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x434d=['util','../../config/logger','api','moment','request-promise','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x434d,0x11f));var _0xd434=function(_0x657cd3,_0x52504f){_0x657cd3=_0x657cd3-0x0;var _0x4671d4=_0x434d[_0x657cd3];return _0x4671d4;};'use strict';var _=require(_0xd434('0x0'));var util=require(_0xd434('0x1'));var logger=require(_0xd434('0x2'))(_0xd434('0x3'));var moment=require(_0xd434('0x4'));var BPromise=require('bluebird');var rp=require(_0xd434('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd434('0x6'));var config=require('../../config/environment');var attributes=require(_0xd434('0x7'));module[_0xd434('0x8')]=function(_0x31057e,_0x335500){return _0x31057e[_0xd434('0x9')](_0xd434('0xa'),attributes,{'tableName':_0xd434('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index b81d571..c0e9db5 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 _0xc762=['jayson/promise','client','http','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x23f132,_0x5d919e){var _0x2b10bf=function(_0x396c0d){while(--_0x396c0d){_0x23f132['push'](_0x23f132['shift']());}};_0x2b10bf(++_0x5d919e);}(_0xc762,0x19d));var _0x2c76=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0xc762[_0x126f47];return _0x49508a;};'use strict';var _=require(_0x2c76('0x0'));var util=require(_0x2c76('0x1'));var moment=require('moment');var BPromise=require(_0x2c76('0x2'));var rs=require(_0x2c76('0x3'));var fs=require('fs');var Redis=require(_0x2c76('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c76('0x5'));var logger=require('../../config/logger')(_0x2c76('0x6'));var config=require('../../config/environment');var jayson=require(_0x2c76('0x7'));var client=jayson[_0x2c76('0x8')][_0x2c76('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x539f86,_0x214c57,_0x474187){return new BPromise(function(_0x3acafe,_0x321529){return client['request'](_0x539f86,_0x474187)[_0x2c76('0xa')](function(_0x5578d9){logger['info'](_0x2c76('0xb'),_0x214c57,_0x2c76('0xc'));logger[_0x2c76('0xd')](_0x2c76('0xe'),_0x214c57,'request\x20sent',JSON['stringify'](_0x5578d9));if(_0x5578d9['error']){if(_0x5578d9['error']['code']===0x1f4){logger[_0x2c76('0xf')](_0x2c76('0xb'),_0x214c57,_0x5578d9[_0x2c76('0xf')][_0x2c76('0x10')]);return _0x321529(_0x5578d9['error']['message']);}logger['error'](_0x2c76('0xb'),_0x214c57,_0x5578d9[_0x2c76('0xf')][_0x2c76('0x10')]);return _0x3acafe(_0x5578d9['error'][_0x2c76('0x10')]);}else{logger[_0x2c76('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x214c57,_0x2c76('0xc'));_0x3acafe(_0x5578d9[_0x2c76('0x12')][_0x2c76('0x10')]);}})[_0x2c76('0x13')](function(_0x2ca778){logger['error'](_0x2c76('0xb'),_0x214c57,_0x2ca778);_0x321529(_0x2ca778);});});} \ No newline at end of file +var _0x272c=['debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x272c,0x196));var _0xc272=function(_0x44c5ca,_0x2148fe){_0x44c5ca=_0x44c5ca-0x0;var _0x2c4085=_0x272c[_0x44c5ca];return _0x2c4085;};'use strict';var _=require(_0xc272('0x0'));var util=require(_0xc272('0x1'));var moment=require(_0xc272('0x2'));var BPromise=require(_0xc272('0x3'));var rs=require(_0xc272('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc272('0x5'));var logger=require(_0xc272('0x6'))('rpc');var config=require(_0xc272('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc272('0x8')][_0xc272('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45eb0d,_0x4034f6,_0x1e7943){return new BPromise(function(_0x5938a4,_0x159eb4){return client['request'](_0x45eb0d,_0x1e7943)[_0xc272('0xa')](function(_0x256325){logger[_0xc272('0xb')](_0xc272('0xc'),_0x4034f6,_0xc272('0xd'));logger[_0xc272('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4034f6,'request\x20sent',JSON[_0xc272('0xf')](_0x256325));if(_0x256325[_0xc272('0x10')]){if(_0x256325['error']['code']===0x1f4){logger[_0xc272('0x10')](_0xc272('0xc'),_0x4034f6,_0x256325[_0xc272('0x10')][_0xc272('0x11')]);return _0x159eb4(_0x256325['error']['message']);}logger[_0xc272('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4034f6,_0x256325[_0xc272('0x10')][_0xc272('0x11')]);return _0x5938a4(_0x256325['error'][_0xc272('0x11')]);}else{logger['info'](_0xc272('0xc'),_0x4034f6,'request\x20sent');_0x5938a4(_0x256325[_0xc272('0x12')][_0xc272('0x11')]);}})[_0xc272('0x13')](function(_0x291d98){logger[_0xc272('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4034f6,_0x291d98);_0x159eb4(_0x291d98);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index d180093..1d7bb64 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 _0x050b=['/:id/query','query','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run'];(function(_0x35d753,_0x49b3d8){var _0x206b94=function(_0x7ddf74){while(--_0x7ddf74){_0x35d753['push'](_0x35d753['shift']());}};_0x206b94(++_0x49b3d8);}(_0x050b,0xc6));var _0xb050=function(_0x522d54,_0x30e08f){_0x522d54=_0x522d54-0x0;var _0x28eec0=_0x050b[_0x522d54];return _0x28eec0;};'use strict';var multer=require(_0xb050('0x0'));var util=require('util');var path=require(_0xb050('0x1'));var timeout=require(_0xb050('0x2'));var express=require(_0xb050('0x3'));var router=express[_0xb050('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb050('0x5'));var interaction=require(_0xb050('0x6'));var config=require(_0xb050('0x7'));var controller=require(_0xb050('0x8'));router['get']('/',auth[_0xb050('0x9')](),controller[_0xb050('0xa')]);router[_0xb050('0xb')](_0xb050('0xc'),auth['isAuthenticated'](),controller[_0xb050('0xd')]);router[_0xb050('0xb')](_0xb050('0xe'),auth[_0xb050('0x9')](),controller[_0xb050('0xf')]);router[_0xb050('0xb')](_0xb050('0x10'),auth[_0xb050('0x9')](),controller[_0xb050('0x11')]);router['get'](_0xb050('0x12'),auth[_0xb050('0x9')](),controller[_0xb050('0x13')]);router[_0xb050('0x14')]('/',auth[_0xb050('0x9')](),controller[_0xb050('0x15')]);router[_0xb050('0x16')]('/:id',auth[_0xb050('0x9')](),controller[_0xb050('0x17')]);router[_0xb050('0x18')](_0xb050('0xc'),auth[_0xb050('0x9')](),controller[_0xb050('0x19')]);module[_0xb050('0x1a')]=router; \ No newline at end of file +var _0x283a=['show','/:id/preview','preview','run','query','post','create','put','destroy','multer','util','connect-timeout','express','Router','get','isAuthenticated','/:id'];(function(_0x2a93b1,_0x3563d9){var _0xfb1537=function(_0x5e12f1){while(--_0x5e12f1){_0x2a93b1['push'](_0x2a93b1['shift']());}};_0xfb1537(++_0x3563d9);}(_0x283a,0xe6));var _0xa283=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x283a[_0x4c1ec2];return _0x3f6f1c;};'use strict';var multer=require(_0xa283('0x0'));var util=require(_0xa283('0x1'));var path=require('path');var timeout=require(_0xa283('0x2'));var express=require(_0xa283('0x3'));var router=express[_0xa283('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('./analyticCustomReport.controller');router[_0xa283('0x5')]('/',auth[_0xa283('0x6')](),controller['index']);router['get'](_0xa283('0x7'),auth['isAuthenticated'](),controller[_0xa283('0x8')]);router[_0xa283('0x5')](_0xa283('0x9'),auth[_0xa283('0x6')](),controller[_0xa283('0xa')]);router[_0xa283('0x5')]('/:id/run',auth[_0xa283('0x6')](),controller[_0xa283('0xb')]);router[_0xa283('0x5')]('/:id/query',auth['isAuthenticated'](),controller[_0xa283('0xc')]);router[_0xa283('0xd')]('/',auth[_0xa283('0x6')](),controller[_0xa283('0xe')]);router[_0xa283('0xf')](_0xa283('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa283('0x7'),auth[_0xa283('0x6')](),controller[_0xa283('0x10')]);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 8be04e1..d65d34c 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 _0xc4aa=['STRING','sequelize','exports'];(function(_0x3840fe,_0x4c9105){var _0xfbc02=function(_0x4796c1){while(--_0x4796c1){_0x3840fe['push'](_0x3840fe['shift']());}};_0xfbc02(++_0x4c9105);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xac4a('0x2')]},'parent':{'type':Sequelize[_0xac4a('0x2')]},'table':{'type':Sequelize[_0xac4a('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x326f=['STRING','TEXT','sequelize'];(function(_0x1ed19e,_0x48e01c){var _0x53a7e3=function(_0x37c41b){while(--_0x37c41b){_0x1ed19e['push'](_0x1ed19e['shift']());}};_0x53a7e3(++_0x48e01c);}(_0x326f,0xd1));var _0xf326=function(_0x141eb8,_0x4e2201){_0x141eb8=_0x141eb8-0x0;var _0x139f8d=_0x326f[_0x141eb8];return _0x139f8d;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf326('0x1')]},'parent':{'type':Sequelize[_0xf326('0x1')]},'table':{'type':Sequelize[_0xf326('0x1')]},'conditions':{'type':Sequelize[_0xf326('0x2')]},'joins':{'type':Sequelize[_0xf326('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index dd5ecf3..36aef66 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x347ea8,_0x2ac098){var _0x2e83f4=function(_0x430d5f){while(--_0x430d5f){_0x347ea8['push'](_0x347ea8['shift']());}};_0x2e83f4(++_0x2ac098);}(_0xda19,0xd5));var _0x9da1=function(_0x2df852,_0x1bba56){_0x2df852=_0x2df852-0x0;var _0x539ff8=_0xda19[_0x2df852];return _0x539ff8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file +var _0x814b=['attributes','intersection','length','nolimit','limit','order','where','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%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','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','MAX(%s)','operator','value','Sequelize','keyBy','from','groupBy','%s.%s\x20=\x20%s.%s','output','web','fullPath','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','map','AnalyticDefaultReport','fieldName','type','model','query','keys','filters'];(function(_0x5bdc18,_0x57552b){var _0x4fb79e=function(_0x565faf){while(--_0x565faf){_0x5bdc18['push'](_0x5bdc18['shift']());}};_0x4fb79e(++_0x57552b);}(_0x814b,0x1a2));var _0xb814=function(_0x2abd13,_0x501317){_0x2abd13=_0x2abd13-0x0;var _0x5ad645=_0x814b[_0x2abd13];return _0x5ad645;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];var dbH=require(_0xb814('0x1a'))[_0xb814('0x1b')];function respondWithStatusCode(_0x2ce718,_0x3bde14){_0x3bde14=_0x3bde14||0xcc;return function(_0x1438e7){if(_0x1438e7){return _0x2ce718[_0xb814('0x1c')](_0x3bde14);}return _0x2ce718[_0xb814('0x1d')](_0x3bde14)[_0xb814('0x1e')]();};}function respondWithResult(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xc8;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x1d')](_0x44fb96)[_0xb814('0x1f')](_0x17f5bd);}};}function respondWithFilteredResult(_0x3a71d6,_0x45e0d0){return function(_0x265a83){if(_0x265a83){var _0x125ce2=typeof _0x45e0d0[_0xb814('0x20')]===_0xb814('0x21')&&typeof _0x45e0d0['limit']===_0xb814('0x21');var _0x55ba16=_0x265a83[_0xb814('0x22')];var _0xfac75b=_0x125ce2?0x0:_0x45e0d0['offset'];var _0x4b55a7=_0x125ce2?_0x265a83['count']:_0x45e0d0[_0xb814('0x20')]+_0x45e0d0['limit'];var _0x57c128;if(_0x4b55a7>=_0x55ba16){_0x4b55a7=_0x55ba16;_0x57c128=0xc8;}else{_0x57c128=0xce;}_0x3a71d6[_0xb814('0x1d')](_0x57c128);return _0x3a71d6[_0xb814('0x23')](_0xb814('0x24'),_0xfac75b+'-'+_0x4b55a7+'/'+_0x55ba16)['json'](_0x265a83);}return null;};}function patchUpdates(_0xf5b8aa){return function(_0x531032){try{jsonpatch[_0xb814('0x25')](_0x531032,_0xf5b8aa,!![]);}catch(_0x1808a3){return BPromise[_0xb814('0x26')](_0x1808a3);}return _0x531032[_0xb814('0x27')]();};}function saveUpdates(_0x27352e,_0x2bd039){return function(_0x1f5d40){if(_0x1f5d40){return _0x1f5d40['update'](_0x27352e)[_0xb814('0x28')](function(_0x52b7a3){return _0x52b7a3;});}return null;};}function removeEntity(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x29')]()[_0xb814('0x28')](function(){var _0xb9e57d=_0x31c7ec[_0xb814('0x2a')]({'plain':!![]});var _0x5755ea=_0xb814('0x2b');return db[_0xb814('0x2c')][_0xb814('0x29')]({'where':{'type':_0x5755ea,'resourceId':_0xb9e57d['id']}})[_0xb814('0x28')](function(){return _0x31c7ec;});})[_0xb814('0x28')](function(){_0x3f81d0[_0xb814('0x1d')](0xcc)[_0xb814('0x1e')]();});}};}function handleEntityNotFound(_0x1e4e89,_0x5a6291){return function(_0x271aa8){if(!_0x271aa8){_0x1e4e89[_0xb814('0x1c')](0x194);}return _0x271aa8;};}function handleError(_0x52ed64,_0x9008b2){_0x9008b2=_0x9008b2||0x1f4;return function(_0x37d24d){logger[_0xb814('0x2d')](_0x37d24d['stack']);if(_0x37d24d[_0xb814('0x2e')]){delete _0x37d24d[_0xb814('0x2e')];}_0x52ed64['status'](_0x9008b2)[_0xb814('0x2f')](_0x37d24d);};}exports['index']=function(_0x6efe9a,_0x5f3e9b){var _0x4cfc58={},_0x419cd9={},_0x4a4f27={'count':0x0,'rows':[]};var _0x2431e2=_[_0xb814('0x30')](db[_0xb814('0x31')]['rawAttributes'],function(_0x51d5ae){return{'name':_0x51d5ae[_0xb814('0x32')],'type':_0x51d5ae[_0xb814('0x33')]['key']};});_0x419cd9[_0xb814('0x34')]=_[_0xb814('0x30')](_0x2431e2,_0xb814('0x2e'));_0x419cd9[_0xb814('0x35')]=_[_0xb814('0x36')](_0x6efe9a[_0xb814('0x35')]);_0x419cd9[_0xb814('0x37')]=_['intersection'](_0x419cd9[_0xb814('0x34')],_0x419cd9[_0xb814('0x35')]);_0x4cfc58[_0xb814('0x38')]=_[_0xb814('0x39')](_0x419cd9[_0xb814('0x34')],qs['fields'](_0x6efe9a[_0xb814('0x35')]['fields']));_0x4cfc58[_0xb814('0x38')]=_0x4cfc58[_0xb814('0x38')][_0xb814('0x3a')]?_0x4cfc58['attributes']:_0x419cd9[_0xb814('0x34')];if(!_0x6efe9a[_0xb814('0x35')]['hasOwnProperty'](_0xb814('0x3b'))){_0x4cfc58[_0xb814('0x3c')]=qs[_0xb814('0x3c')](_0x6efe9a[_0xb814('0x35')][_0xb814('0x3c')]);_0x4cfc58[_0xb814('0x20')]=qs['offset'](_0x6efe9a[_0xb814('0x35')]['offset']);}_0x4cfc58[_0xb814('0x3d')]=qs['sort'](_0x6efe9a[_0xb814('0x35')]['sort']);_0x4cfc58[_0xb814('0x3e')]=qs[_0xb814('0x37')](_['pick'](_0x6efe9a['query'],_0x419cd9['filters']),_0x2431e2);if(_0x6efe9a['query'][_0xb814('0x3f')]){_0x4cfc58[_0xb814('0x3e')]=_[_0xb814('0x40')](_0x4cfc58[_0xb814('0x3e')],{'$or':_['map'](_0x2431e2,function(_0x47d782){if(_0x47d782[_0xb814('0x33')]!=='VIRTUAL'){var _0x2a93da={};_0x2a93da[_0x47d782[_0xb814('0x2e')]]={'$like':'%'+_0x6efe9a[_0xb814('0x35')][_0xb814('0x3f')]+'%'};return _0x2a93da;}})});}_0x4cfc58=_[_0xb814('0x40')]({},_0x4cfc58,_0x6efe9a[_0xb814('0x41')]);var _0x3b7f5a={'where':_0x4cfc58[_0xb814('0x3e')]};return db[_0xb814('0x31')]['count'](_0x3b7f5a)['then'](function(_0x5d26be){_0x4a4f27[_0xb814('0x22')]=_0x5d26be;if(_0x6efe9a['query'][_0xb814('0x42')]){_0x4cfc58['include']=[{'all':!![]}];}return db[_0xb814('0x31')][_0xb814('0x43')](_0x4cfc58);})[_0xb814('0x28')](function(_0x2e97cc){_0x4a4f27['rows']=_0x2e97cc;return _0x4a4f27;})[_0xb814('0x28')](respondWithFilteredResult(_0x5f3e9b,_0x4cfc58))[_0xb814('0x44')](handleError(_0x5f3e9b,null));};exports[_0xb814('0x45')]=function(_0x22cf27,_0x7d92aa){var _0x450a08={'raw':!![],'where':{'id':_0x22cf27[_0xb814('0x46')]['id']}},_0x534eb8={};_0x534eb8[_0xb814('0x34')]=_[_0xb814('0x36')](db[_0xb814('0x31')][_0xb814('0x47')]);_0x534eb8[_0xb814('0x35')]=_[_0xb814('0x36')](_0x22cf27['query']);_0x534eb8['filters']=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],_0x534eb8[_0xb814('0x35')]);_0x450a08[_0xb814('0x38')]=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],qs[_0xb814('0x48')](_0x22cf27[_0xb814('0x35')][_0xb814('0x48')]));_0x450a08[_0xb814('0x38')]=_0x450a08[_0xb814('0x38')]['length']?_0x450a08[_0xb814('0x38')]:_0x534eb8[_0xb814('0x34')];if(_0x22cf27['query'][_0xb814('0x42')]){_0x450a08['include']=[{'all':!![]}];}_0x450a08=_[_0xb814('0x40')]({},_0x450a08,_0x22cf27[_0xb814('0x41')]);return db[_0xb814('0x31')][_0xb814('0x49')](_0x450a08)[_0xb814('0x28')](handleEntityNotFound(_0x7d92aa,null))[_0xb814('0x28')](respondWithResult(_0x7d92aa,null))[_0xb814('0x44')](handleError(_0x7d92aa,null));};exports[_0xb814('0x4a')]=function(_0x32a397,_0x2a422a){return db['AnalyticDefaultReport']['create'](_0x32a397[_0xb814('0x4b')],{})[_0xb814('0x28')](function(_0x4156d8){var _0x3f8e29=_0x32a397[_0xb814('0x4c')][_0xb814('0x2a')]({'plain':!![]});if(!_0x3f8e29)throw new Error(_0xb814('0x4d'));if(_0x3f8e29['role']===_0xb814('0x4c')){var _0x388324=_0x4156d8[_0xb814('0x2a')]({'plain':!![]});var _0x5a916d=_0xb814('0x4e');return db['UserProfileSection'][_0xb814('0x49')]({'where':{'name':_0x5a916d,'userProfileId':_0x3f8e29['userProfileId']},'raw':!![]})[_0xb814('0x28')](function(_0x3cf8f8){if(_0x3cf8f8&&_0x3cf8f8['autoAssociation']===0x0){return db[_0xb814('0x2c')][_0xb814('0x4a')]({'name':_0x388324[_0xb814('0x2e')],'resourceId':_0x388324['id'],'type':'DefaultReports','sectionId':_0x3cf8f8['id']},{})[_0xb814('0x28')](function(){return _0x4156d8;});}else{return _0x4156d8;}})['catch'](function(_0x13bdcf){logger[_0xb814('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bdcf);throw _0x13bdcf;});}return _0x4156d8;})[_0xb814('0x28')](respondWithResult(_0x2a422a,0xc9))['catch'](handleError(_0x2a422a,null));};exports['update']=function(_0x3b9709,_0x35f59a){if(_0x3b9709[_0xb814('0x4b')]['id']){delete _0x3b9709['body']['id'];}return db[_0xb814('0x31')]['find']({'where':{'id':_0x3b9709[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x35f59a,null))['then'](saveUpdates(_0x3b9709[_0xb814('0x4b')],null))['then'](respondWithResult(_0x35f59a,null))[_0xb814('0x44')](handleError(_0x35f59a,null));};exports[_0xb814('0x29')]=function(_0xb2bd82,_0x113fe5){return db[_0xb814('0x31')][_0xb814('0x49')]({'where':{'id':_0xb2bd82[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x113fe5,null))['then'](removeEntity(_0x113fe5,null))[_0xb814('0x44')](handleError(_0x113fe5,null));};exports[_0xb814('0x4f')]=function(_0x5d71d5,_0x29a127){var _0xe14249=0xa;var _0x4d13db=[_0xb814('0x50'),'left_join','right_join',_0xb814('0x51')];var _0x5257be={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb814('0x56'),'GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x176585={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x4d611d=function(_0x211194){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x211194);};var _0x52edfa=function(_0x135e13){if(!_0x135e13||!_0x135e13['rules'][_0xb814('0x3a')]){return'';}for(var _0x39b754='(',_0xac95cf=0x0;_0xac95cf<_0x135e13['rules'][_0xb814('0x3a')];_0xac95cf+=0x1){_0xac95cf>0x0&&(_0x39b754+='\x20'+_0x135e13['operator']+'\x20');_0x39b754+=_0x135e13[_0xb814('0x63')][_0xac95cf]['group']?_0x52edfa(_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x64')]):_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x65')]+'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x66')]+(_0x4d611d(_0x135e13[_0xb814('0x63')][_0xac95cf]['condition'])?'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf]['value']:'');}return _0x39b754+')';};var _0x255047={'where':{'id':_0x5d71d5['params']['id']}},_0x22c73f,_0x1b989d,_0x3dcaeb,_0x19fa45,_0x139531;_0x255047=_[_0xb814('0x40')]({},_0x255047,_0x5d71d5[_0xb814('0x41')]);return db['AnalyticDefaultReport'][_0xb814('0x49')](_0x255047)[_0xb814('0x28')](function(_0x263699){if(_0x263699){_0x22c73f=_0x263699;return _0x263699[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x51d834){if(_0x51d834){if(!_0x51d834[_0xb814('0x3a')]){throw new db['Sequelize'][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x1b989d=_0x51d834;return db[_0xb814('0x6a')][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x41bcaf){if(_0x41bcaf){_0x3dcaeb=_['keyBy'](_0x41bcaf,'id');var _0x506bf2;var _0x5d064b=squel[_0xb814('0x6b')]();_0x5d064b['from'](_0x22c73f[_0xb814('0x6c')]);for(var _0x1d3954=0x0;_0x1d3954<_0x1b989d[_0xb814('0x3a')];_0x1d3954+=0x1){_0x506bf2=_0x1b989d[_0x1d3954]['MetricId']?_0x3dcaeb[_0x1b989d[_0x1d3954][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x1b989d[_0x1d3954][_0xb814('0x65')];_0x506bf2=_0x1b989d[_0x1d3954]['function']?_[_0xb814('0x6f')](_0x5257be[_0x1b989d[_0x1d3954][_0xb814('0x70')]],'%s',_0x506bf2):_0x506bf2;_0x506bf2=_0x1b989d[_0x1d3954][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x176585[_0x1b989d[_0x1d3954]['format']],'%s',_0x506bf2):_0x506bf2;if(_0x1b989d[_0x1d3954]['groupBy']){_0x5d064b[_0xb814('0x64')](_0x506bf2);}_0x1b989d[_0x1d3954][_0xb814('0x72')]&&_0x5d064b[_0xb814('0x3d')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x5d064b[_0xb814('0x65')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x74')]||_0x506bf2);}if(_0x22c73f[_0xb814('0x75')]){_0x22c73f[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x22c73f[_0xb814('0x75')]);for(var _0x226b0e=0x0;_0x226b0e<_0x22c73f[_0xb814('0x75')][_0xb814('0x3a')];_0x226b0e+=0x1){if(_0x22c73f[_0xb814('0x75')][_0x226b0e]['type']&&_[_0xb814('0x5e')](_0x4d13db,_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')])&&_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')]&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignTable']&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignKey']){_0x5d064b[_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')]](_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],null,util[_0xb814('0x71')]('%s.%s\x20=\x20%s.%s',_0x22c73f['table'],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],_0x22c73f['joins'][_0x226b0e][_0xb814('0x79')]));}}}if(_0x22c73f['conditions']){_0x22c73f[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x22c73f['conditions']);_0x5d064b['where'](_0x52edfa(_0x22c73f[_0xb814('0x7a')]['group']));}_0x139531=_0x5d064b[_0xb814('0x7b')]();_0x5d064b[_0xb814('0x3c')](_0xe14249);_0x5d064b[_0xb814('0x20')](0x0);logger[_0xb814('0x7c')](_0xb814('0x7d'),_0x5d064b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')]['query'](_0x5d064b[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')]['SELECT']});}})[_0xb814('0x28')](respondWithResult(_0x29a127,null))[_0xb814('0x44')](handleError(_0x29a127,null));};function runReport(_0x58d56c,_0x10a90d,_0x583f26){var _0x37adec=_0x10a90d[_0xb814('0x2e')];var _0x4e15c2=0xa;var _0x5a0c4a=[_0xb814('0x50'),_0xb814('0x81'),_0xb814('0x82'),_0xb814('0x51')];var _0x220f8b={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':_0xb814('0x83'),'MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x52b6da={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1fb1ea=function(_0x31c072){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x31c072);};var _0x5cf5ad=function(_0x20efc3){if(!_0x20efc3||!_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x30faa0='(',_0x55ceb8=0x0;_0x55ceb8<_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')];_0x55ceb8+=0x1){_0x55ceb8>0x0&&(_0x30faa0+='\x20'+_0x20efc3[_0xb814('0x84')]+'\x20');_0x30faa0+=_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x64')]?_0x5cf5ad(_0x20efc3['rules'][_0x55ceb8]['group']):_0x20efc3[_0xb814('0x63')][_0x55ceb8]['field']+'\x20'+_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x66')]+(_0x1fb1ea(_0x20efc3['rules'][_0x55ceb8][_0xb814('0x66')])?'\x20'+_0x20efc3['rules'][_0x55ceb8][_0xb814('0x85')]:'');}return _0x30faa0+')';};var _0x520d0f={'where':{'id':_0x58d56c['id']}},_0x44e668,_0x1aff2b,_0x41867b,_0x2c3948,_0x2d8899;_0x520d0f=_[_0xb814('0x40')]({},_0x520d0f,_0x583f26);return db[_0xb814('0x31')]['find'](_0x520d0f)['then'](function(_0x21aa36){if(_0x21aa36){_0x44e668=_0x21aa36;return _0x21aa36['getFields']();}return null;})['then'](function(_0x2d0061){if(_0x2d0061){if(!_0x2d0061[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))]['ValidationErrorItem'](_0xb814('0x69'),0x193);}_0x1aff2b=_0x2d0061;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x14ec54){if(_0x14ec54){_0x41867b=_[_0xb814('0x87')](_0x14ec54,'id');var _0x4c8a00;var _0x1454b3=squel[_0xb814('0x6b')]();_0x1454b3[_0xb814('0x88')](_0x44e668['table']);for(var _0x1ebbf6=0x0;_0x1ebbf6<_0x1aff2b[_0xb814('0x3a')];_0x1ebbf6+=0x1){_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x6d')]?_0x41867b[_0x1aff2b[_0x1ebbf6]['MetricId']][_0xb814('0x6e')]:_0x1aff2b[_0x1ebbf6][_0xb814('0x65')];_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]?_[_0xb814('0x6f')](_0x220f8b[_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]],'%s',_0x4c8a00):_0x4c8a00;_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x52b6da[_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]],'%s',_0x4c8a00):_0x4c8a00;if(_0x1aff2b[_0x1ebbf6][_0xb814('0x89')]){_0x1454b3[_0xb814('0x64')](_0x4c8a00);}_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]&&_0x1454b3[_0xb814('0x3d')](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]==='DESC'?![]:!![]);_0x1454b3['field'](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x74')]||_0x4c8a00);}if(_0x44e668['joins']){_0x44e668[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x44e668[_0xb814('0x75')]);for(var _0x2bc95b=0x0;_0x2bc95b<_0x44e668[_0xb814('0x75')][_0xb814('0x3a')];_0x2bc95b+=0x1){if(_0x44e668[_0xb814('0x75')][_0x2bc95b]['type']&&_['includes'](_0x5a0c4a,_0x44e668[_0xb814('0x75')][_0x2bc95b]['type'])&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')]&&_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable']&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]){_0x1454b3[_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x33')]](_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],null,util[_0xb814('0x71')](_0xb814('0x8a'),_0x44e668['table'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')],_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]));}}}if(_0x44e668['conditions']){_0x44e668[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x44e668['conditions']);_0x1454b3[_0xb814('0x3e')](_0x5cf5ad(_0x44e668[_0xb814('0x7a')][_0xb814('0x64')]));}_0x2d8899=_0x1454b3[_0xb814('0x7b')]();_0x1454b3[_0xb814('0x3c')](_0x4e15c2);_0x1454b3[_0xb814('0x20')](0x0);return;}})[_0xb814('0x28')](function(){if(_0x10a90d[_0xb814('0x8b')]===_0xb814('0x8c')){return null;}var _0x1f8c7a=_[_0xb814('0x40')](_0x10a90d,{'name':_0x10a90d[_0xb814('0x8d')]||_0x10a90d['name']||_0x44e668['name'],'basename':_0x37adec,'savename':util[_0xb814('0x71')]('%s-%s.%s',_0x10a90d['name']||_0x44e668[_0xb814('0x2e')],require('randomstring')['generate'](0x4),_0x10a90d['output']||_0xb814('0x8e')),'reportId':_0x44e668['id'],'reportType':_0xb814('0x8f')});return db[_0xb814('0x90')]['create'](_0x1f8c7a,{'raw':!![]});})[_0xb814('0x28')](function(_0x4dbe89){if(_0x44e668[_0xb814('0x6c')]===_0xb814('0x91')){_0x2d8899['where'](_0x44e668[_0xb814('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}else{_0x2d8899[_0xb814('0x3e')](_0x44e668[_0xb814('0x6c')]+_0xb814('0x94'),_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}if(_0x4dbe89){logger[_0xb814('0x95')](_0xb814('0x96'),_0x2d8899[_0xb814('0x7e')]());require(_0xb814('0x97'))[_0xb814('0x98')](path[_0xb814('0x50')](__dirname,_0xb814('0x99'),_0x4dbe89[_0xb814('0x8b')]),[_0x4dbe89['id'],_0x2d8899['toString'](),path[_0xb814('0x50')](__dirname,_0xb814('0x9a'),_0x4dbe89['savename']),_0x37adec]);return _0x4dbe89;}else{var _0x2c7cd6=squel[_0xb814('0x6b')]();_0x2c7cd6[_0xb814('0x88')]('('+_0x2d8899['toString']()+')','countTable');_0x2c7cd6[_0xb814('0x65')]('COUNT(*)',_0xb814('0x22'));_0x2d8899['limit'](_0x10a90d[_0xb814('0x3c')]||_0x4e15c2);_0x2d8899['offset'](_0x10a90d['offset']||0x0);return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x2c7cd6[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]})[_0xb814('0x28')](function(_0x4543c3){if(!_0x4543c3[_0xb814('0x3a')]){_0x2c3948=0x0;}else{_0x2c3948=_0x4543c3[0x0][_0xb814('0x22')]||0x0;}return dbH[_0xb814('0x7f')]['query'](_0x2d8899[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')][_0xb814('0x9b')]});})[_0xb814('0x28')](function(_0x4fde6a){return{'rows':_0x4fde6a||[],'count':_0x2c3948};});}});}exports[_0xb814('0x9c')]=function(_0x18fb74,_0x371e92){return runReport(_0x18fb74[_0xb814('0x46')],_0x18fb74[_0xb814('0x35')],_0x18fb74[_0xb814('0x41')])[_0xb814('0x28')](respondWithResult(_0x371e92,null))[_0xb814('0x44')](handleError(_0x371e92,null));};exports[_0xb814('0x9d')]=runReport;exports[_0xb814('0x35')]=function(_0x3b65c0,_0x11e0c3){var _0x22c811=0xa;var _0x3fd24c=[_0xb814('0x50'),'left_join',_0xb814('0x82'),_0xb814('0x51')];var _0x3e61eb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x5be0bb={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1bd9ab=function(_0x20e608){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),'IS\x20NOT\x20EMPTY'],_0x20e608);};var _0x2a5dff=function(_0x553635){if(!_0x553635||!_0x553635[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x35e8f7='(',_0xa7ff62=0x0;_0xa7ff62<_0x553635[_0xb814('0x63')][_0xb814('0x3a')];_0xa7ff62+=0x1){_0xa7ff62>0x0&&(_0x35e8f7+='\x20'+_0x553635[_0xb814('0x84')]+'\x20');_0x35e8f7+=_0x553635[_0xb814('0x63')][_0xa7ff62]['group']?_0x2a5dff(_0x553635['rules'][_0xa7ff62]['group']):_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x65')]+'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')]+(_0x1bd9ab(_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')])?'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x85')]:'');}return _0x35e8f7+')';};var _0x41847e={'where':{'id':_0x3b65c0[_0xb814('0x46')]['id']}},_0x1a5685,_0x51313d,_0x5c989a,_0x41486b,_0x16c05b;_0x41847e=_[_0xb814('0x40')]({},_0x41847e,_0x3b65c0[_0xb814('0x41')]);return db[_0xb814('0x31')]['find'](_0x41847e)[_0xb814('0x28')](function(_0x52899a){if(_0x52899a){_0x1a5685=_0x52899a;return _0x52899a[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x205c6c){if(_0x205c6c){if(!_0x205c6c[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x51313d=_0x205c6c;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x1f04eb){if(_0x1f04eb){_0x5c989a=_[_0xb814('0x87')](_0x1f04eb,'id');var _0x4a1c4e;var _0x17c63b=squel[_0xb814('0x6b')]();_0x17c63b[_0xb814('0x88')](_0x1a5685[_0xb814('0x6c')]);for(var _0xa66ca3=0x0;_0xa66ca3<_0x51313d['length'];_0xa66ca3+=0x1){_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x6d')]?_0x5c989a[_0x51313d[_0xa66ca3][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x51313d[_0xa66ca3]['field'];_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x70')]?_['replace'](_0x3e61eb[_0x51313d[_0xa66ca3][_0xb814('0x70')]],'%s',_0x4a1c4e):_0x4a1c4e;_0x4a1c4e=_0x51313d[_0xa66ca3]['format']?_[_0xb814('0x6f')](_0x5be0bb[_0x51313d[_0xa66ca3][_0xb814('0x71')]],'%s',_0x4a1c4e):_0x4a1c4e;if(_0x51313d[_0xa66ca3][_0xb814('0x89')]){_0x17c63b[_0xb814('0x64')](_0x4a1c4e);}_0x51313d[_0xa66ca3]['orderBy']&&_0x17c63b[_0xb814('0x3d')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x17c63b[_0xb814('0x65')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x74')]||_0x4a1c4e);}if(_0x1a5685[_0xb814('0x75')]){_0x1a5685[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x75')]);for(var _0x152260=0x0;_0x152260<_0x1a5685[_0xb814('0x75')][_0xb814('0x3a')];_0x152260+=0x1){if(_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]&&_[_0xb814('0x5e')](_0x3fd24c,_0x1a5685['joins'][_0x152260][_0xb814('0x33')])&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')]&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')]&&_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']){_0x17c63b[_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]](_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1a5685[_0xb814('0x6c')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']));}}}if(_0x1a5685[_0xb814('0x7a')]){_0x1a5685[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x7a')]);_0x17c63b['where'](_0x2a5dff(_0x1a5685[_0xb814('0x7a')][_0xb814('0x64')]));}_0x16c05b=_0x17c63b[_0xb814('0x7b')]();_0x17c63b[_0xb814('0x3c')](_0x22c811);_0x17c63b[_0xb814('0x20')](0x0);logger['debug'](_0xb814('0x7d'),_0x17c63b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x17c63b[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]});}})[_0xb814('0x28')](function(){return{'sql':_0x16c05b[_0xb814('0x7e')]()};})[_0xb814('0x28')](respondWithResult(_0x11e0c3,null))[_0xb814('0x44')](handleError(_0x11e0c3,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index b60eb38..7f35440 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 _0x7fe0=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird'];(function(_0x38b02e,_0x5177cf){var _0x5cd622=function(_0x251d79){while(--_0x251d79){_0x38b02e['push'](_0x38b02e['shift']());}};_0x5cd622(++_0x5177cf);}(_0x7fe0,0xb1));var _0x07fe=function(_0x3bb12e,_0x5ebafa){_0x3bb12e=_0x3bb12e-0x0;var _0x536b9a=_0x7fe0[_0x3bb12e];return _0x536b9a;};'use strict';var _=require(_0x07fe('0x0'));var util=require(_0x07fe('0x1'));var logger=require('../../config/logger')(_0x07fe('0x2'));var moment=require(_0x07fe('0x3'));var BPromise=require(_0x07fe('0x4'));var rp=require(_0x07fe('0x5'));var fs=require('fs');var path=require(_0x07fe('0x6'));var rimraf=require(_0x07fe('0x7'));var config=require(_0x07fe('0x8'));var attributes=require(_0x07fe('0x9'));module[_0x07fe('0xa')]=function(_0x450ac1,_0x154a0a){return _0x450ac1[_0x07fe('0xb')](_0x07fe('0xc'),attributes,{'tableName':_0x07fe('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x594f=['exports','define','AnalyticDefaultReport','lodash','util','../../config/logger','bluebird','path','./analyticDefaultReport.attributes'];(function(_0x3a76e4,_0x82586d){var _0x56fd7c=function(_0x5ab5af){while(--_0x5ab5af){_0x3a76e4['push'](_0x3a76e4['shift']());}};_0x56fd7c(++_0x82586d);}(_0x594f,0x78));var _0xf594=function(_0xb27b4b,_0x17546c){_0xb27b4b=_0xb27b4b-0x0;var _0x2dc7a9=_0x594f[_0xb27b4b];return _0x2dc7a9;};'use strict';var _=require(_0xf594('0x0'));var util=require(_0xf594('0x1'));var logger=require(_0xf594('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf594('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf594('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf594('0x5'));module[_0xf594('0x6')]=function(_0x3c25eb,_0x2303f4){return _0x3c25eb[_0xf594('0x7')](_0xf594('0x8'),attributes,{'tableName':'analytics_default_reports','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 d8bc02b..5c85172 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 _0xadd6=['info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','AnalyticDefaultReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x4c1a15,_0x36abe4){var _0x195acb=function(_0x1104ee){while(--_0x1104ee){_0x4c1a15['push'](_0x4c1a15['shift']());}};_0x195acb(++_0x36abe4);}(_0xadd6,0x75));var _0x6add=function(_0x35e290,_0x1156b1){_0x35e290=_0x35e290-0x0;var _0x19dd62=_0xadd6[_0x35e290];return _0x19dd62;};'use strict';var _=require(_0x6add('0x0'));var util=require('util');var moment=require(_0x6add('0x1'));var BPromise=require('bluebird');var rs=require(_0x6add('0x2'));var fs=require('fs');var Redis=require(_0x6add('0x3'));var db=require(_0x6add('0x4'))['db'];var utils=require(_0x6add('0x5'));var logger=require('../../config/logger')(_0x6add('0x6'));var config=require(_0x6add('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6add('0x8')][_0x6add('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14570d,_0x465e11,_0x5ac775){return new BPromise(function(_0x4ec15f,_0x35b981){return client['request'](_0x14570d,_0x5ac775)['then'](function(_0x5df483){logger['info'](_0x6add('0xa'),_0x465e11,'request\x20sent');logger[_0x6add('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x465e11,_0x6add('0xc'),JSON['stringify'](_0x5df483));if(_0x5df483[_0x6add('0xd')]){if(_0x5df483[_0x6add('0xd')][_0x6add('0xe')]===0x1f4){logger[_0x6add('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x465e11,_0x5df483[_0x6add('0xd')][_0x6add('0xf')]);return _0x35b981(_0x5df483[_0x6add('0xd')][_0x6add('0xf')]);}logger[_0x6add('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x465e11,_0x5df483['error'][_0x6add('0xf')]);return _0x4ec15f(_0x5df483['error'][_0x6add('0xf')]);}else{logger[_0x6add('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x465e11,_0x6add('0xc'));_0x4ec15f(_0x5df483[_0x6add('0x11')][_0x6add('0xf')]);}})[_0x6add('0x12')](function(_0x196974){logger[_0x6add('0xd')](_0x6add('0xa'),_0x465e11,_0x196974);_0x35b981(_0x196974);});});} \ No newline at end of file +var _0x338c=['then','info','request\x20sent','debug','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x1dfdd5,_0x3e2af3){var _0x4524b6=function(_0x45a29b){while(--_0x45a29b){_0x1dfdd5['push'](_0x1dfdd5['shift']());}};_0x4524b6(++_0x3e2af3);}(_0x338c,0xf1));var _0xc338=function(_0x4ea1bb,_0x35efe8){_0x4ea1bb=_0x4ea1bb-0x0;var _0x2b6fab=_0x338c[_0x4ea1bb];return _0x2b6fab;};'use strict';var _=require(_0xc338('0x0'));var util=require('util');var moment=require(_0xc338('0x1'));var BPromise=require(_0xc338('0x2'));var rs=require(_0xc338('0x3'));var fs=require('fs');var Redis=require(_0xc338('0x4'));var db=require(_0xc338('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc338('0x6'))('rpc');var config=require(_0xc338('0x7'));var jayson=require(_0xc338('0x8'));var client=jayson[_0xc338('0x9')][_0xc338('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1eaa24,_0x305e74,_0x10cad0){return new BPromise(function(_0x30f9cb,_0xd3d3a1){return client[_0xc338('0xb')](_0x1eaa24,_0x10cad0)[_0xc338('0xc')](function(_0x20da44){logger[_0xc338('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x305e74,_0xc338('0xe'));logger[_0xc338('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x305e74,'request\x20sent',JSON[_0xc338('0x10')](_0x20da44));if(_0x20da44[_0xc338('0x11')]){if(_0x20da44[_0xc338('0x11')][_0xc338('0x12')]===0x1f4){logger['error'](_0xc338('0x13'),_0x305e74,_0x20da44[_0xc338('0x11')][_0xc338('0x14')]);return _0xd3d3a1(_0x20da44[_0xc338('0x11')][_0xc338('0x14')]);}logger[_0xc338('0x11')](_0xc338('0x13'),_0x305e74,_0x20da44[_0xc338('0x11')]['message']);return _0x30f9cb(_0x20da44['error']['message']);}else{logger[_0xc338('0xd')](_0xc338('0x13'),_0x305e74,'request\x20sent');_0x30f9cb(_0x20da44[_0xc338('0x15')][_0xc338('0x14')]);}})[_0xc338('0x16')](function(_0x58cc19){logger[_0xc338('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x305e74,_0x58cc19);_0xd3d3a1(_0x58cc19);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index a9fc632..f6825bc 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 _0x3600=['/:id/run','run','/:id/query','query','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show'];(function(_0x851fe,_0x25657a){var _0x2778ac=function(_0x3f94a7){while(--_0x3f94a7){_0x851fe['push'](_0x851fe['shift']());}};_0x2778ac(++_0x25657a);}(_0x3600,0x142));var _0x0360=function(_0x5b3906,_0x44dd0b){_0x5b3906=_0x5b3906-0x0;var _0x1c5844=_0x3600[_0x5b3906];return _0x1c5844;};'use strict';var multer=require(_0x0360('0x0'));var util=require(_0x0360('0x1'));var path=require(_0x0360('0x2'));var timeout=require(_0x0360('0x3'));var express=require(_0x0360('0x4'));var router=express[_0x0360('0x5')]();var fs_extra=require(_0x0360('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0360('0x7'));var config=require(_0x0360('0x8'));var controller=require(_0x0360('0x9'));router[_0x0360('0xa')]('/',auth[_0x0360('0xb')](),controller['index']);router[_0x0360('0xa')](_0x0360('0xc'),auth[_0x0360('0xb')](),controller[_0x0360('0xd')]);router[_0x0360('0xa')]('/:id/preview',auth[_0x0360('0xb')](),controller['preview']);router[_0x0360('0xa')](_0x0360('0xe'),auth[_0x0360('0xb')](),controller[_0x0360('0xf')]);router['get'](_0x0360('0x10'),auth[_0x0360('0xb')](),controller[_0x0360('0x11')]);router[_0x0360('0x12')]('/',auth[_0x0360('0xb')](),controller[_0x0360('0x13')]);router['put']('/:id',auth[_0x0360('0xb')](),controller[_0x0360('0x14')]);router[_0x0360('0x15')](_0x0360('0xc'),auth[_0x0360('0xb')](),controller[_0x0360('0x16')]);module[_0x0360('0x17')]=router; \ No newline at end of file +var _0x8c25=['../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','show','/:id/preview','preview','run','get','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x51ef6c,_0x1ecc7c){var _0x4ae3a5=function(_0x34b006){while(--_0x34b006){_0x51ef6c['push'](_0x51ef6c['shift']());}};_0x4ae3a5(++_0x1ecc7c);}(_0x8c25,0xe2));var _0x58c2=function(_0x5508a6,_0x41cb72){_0x5508a6=_0x5508a6-0x0;var _0x4660a1=_0x8c25[_0x5508a6];return _0x4660a1;};'use strict';var multer=require('multer');var util=require(_0x58c2('0x0'));var path=require('path');var timeout=require(_0x58c2('0x1'));var express=require(_0x58c2('0x2'));var router=express[_0x58c2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x58c2('0x4'));var config=require(_0x58c2('0x5'));var controller=require(_0x58c2('0x6'));router['get']('/',auth[_0x58c2('0x7')](),controller[_0x58c2('0x8')]);router['get']('/:id',auth[_0x58c2('0x7')](),controller[_0x58c2('0x9')]);router['get'](_0x58c2('0xa'),auth[_0x58c2('0x7')](),controller[_0x58c2('0xb')]);router['get']('/:id/run',auth[_0x58c2('0x7')](),controller[_0x58c2('0xc')]);router[_0x58c2('0xd')]('/:id/query',auth[_0x58c2('0x7')](),controller['query']);router['post']('/',auth[_0x58c2('0x7')](),controller[_0x58c2('0xe')]);router[_0x58c2('0xf')](_0x58c2('0x10'),auth[_0x58c2('0x7')](),controller[_0x58c2('0x11')]);router[_0x58c2('0x12')]('/:id',auth[_0x58c2('0x7')](),controller[_0x58c2('0x13')]);module[_0x58c2('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 7d65b0b..f9ccae4 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 _0x1a03=['exports','STRING','csv','pdf','xlsx','DATE','ENUM','manual','UNSIGNED','moment'];(function(_0x5965c7,_0x1ab31d){var _0x111855=function(_0x2b7ced){while(--_0x2b7ced){_0x5965c7['push'](_0x5965c7['shift']());}};_0x111855(++_0x1ab31d);}(_0x1a03,0x149));var _0x31a0=function(_0x403f5f,_0x283f67){_0x403f5f=_0x403f5f-0x0;var _0x15b1cd=_0x1a03[_0x403f5f];return _0x15b1cd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x31a0('0x0'));module[_0x31a0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x31a0('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x31a0('0x3'),_0x31a0('0x4'),_0x31a0('0x5')),'allowNull':![],'defaultValue':_0x31a0('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x31a0('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x31a0('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x31a0('0x7')]('manual','scheduled'),'allowNull':![],'defaultValue':_0x31a0('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x31a0('0x9')]},'reportType':{'type':Sequelize[_0x31a0('0x2')]}}; \ No newline at end of file +var _0xe3f7=['sequelize','moment','STRING','pdf','xlsx','csv','DATE','Loading','ENUM','manual','scheduled','INTEGER'];(function(_0x38043c,_0x46d1ec){var _0x32088d=function(_0x56d01a){while(--_0x56d01a){_0x38043c['push'](_0x38043c['shift']());}};_0x32088d(++_0x46d1ec);}(_0xe3f7,0x1ec));var _0x7e3f=function(_0xfc2c73,_0x2a6325){_0xfc2c73=_0xfc2c73-0x0;var _0x2c0ba5=_0xe3f7[_0xfc2c73];return _0x2c0ba5;};'use strict';var Sequelize=require(_0x7e3f('0x0'));var moment=require(_0x7e3f('0x1'));module['exports']={'name':{'type':Sequelize[_0x7e3f('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0x7e3f('0x3'),_0x7e3f('0x4')),'allowNull':![],'defaultValue':_0x7e3f('0x5')},'savename':{'type':Sequelize[_0x7e3f('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x7e3f('0x6')]},'status':{'type':Sequelize[_0x7e3f('0x2')],'defaultValue':_0x7e3f('0x7')},'type':{'type':Sequelize[_0x7e3f('0x8')](_0x7e3f('0x9'),_0x7e3f('0xa')),'allowNull':![],'defaultValue':_0x7e3f('0x9')},'reportId':{'type':Sequelize[_0x7e3f('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x7e3f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 7f358d0..5e3c851 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 _0x606c=['eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','ExtractedReports','UserProfileResource','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','order','sort','where','filters','filter','merge','options','include','findAll','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','download','output','existsSync','join','root','server/files/reports','savename','ValidationError','Report\x20not\x20found\x20or\x20empty','format','%s.%s','basename','toLowerCase'];(function(_0x5233d4,_0x323ed8){var _0x1b7f4f=function(_0x1b41b4){while(--_0x1b41b4){_0x5233d4['push'](_0x5233d4['shift']());}};_0x1b7f4f(++_0x323ed8);}(_0x606c,0x16c));var _0xc606=function(_0x12b83d,_0x4bcec7){_0x12b83d=_0x12b83d-0x0;var _0x1fd39d=_0x606c[_0x12b83d];return _0x1fd39d;};'use strict';var emlformat=require(_0xc606('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc606('0x1'));var jsonpatch=require(_0xc606('0x2'));var rp=require(_0xc606('0x3'));var moment=require(_0xc606('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc606('0x5'));var util=require('util');var path=require(_0xc606('0x6'));var sox=require(_0xc606('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc606('0x8'));var squel=require('squel');var crypto=require(_0xc606('0x9'));var jsforce=require(_0xc606('0xa'));var deskjs=require(_0xc606('0xb'));var toCsv=require(_0xc606('0xc'));var querystring=require('querystring');var Papa=require(_0xc606('0xd'));var Redis=require(_0xc606('0xe'));var authService=require(_0xc606('0xf'));var qs=require(_0xc606('0x10'));var as=require(_0xc606('0x11'));var hardwareService=require(_0xc606('0x12'));var logger=require('../../config/logger')(_0xc606('0x13'));var utils=require(_0xc606('0x14'));var config=require(_0xc606('0x15'));var licenseUtil=require(_0xc606('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1305e1,_0x9f6164){_0x9f6164=_0x9f6164||0xcc;return function(_0x338e43){if(_0x338e43){return _0x1305e1[_0xc606('0x17')](_0x9f6164);}return _0x1305e1[_0xc606('0x18')](_0x9f6164)[_0xc606('0x19')]();};}function respondWithResult(_0x4e7cf3,_0x35249d){_0x35249d=_0x35249d||0xc8;return function(_0x228e0a){if(_0x228e0a){return _0x4e7cf3[_0xc606('0x18')](_0x35249d)[_0xc606('0x1a')](_0x228e0a);}};}function respondWithFilteredResult(_0x20c4ec,_0x502420){return function(_0x1da617){if(_0x1da617){var _0x51d26c=typeof _0x502420[_0xc606('0x1b')]==='undefined'&&typeof _0x502420[_0xc606('0x1c')]===_0xc606('0x1d');var _0x3c53d3=_0x1da617[_0xc606('0x1e')];var _0xbaed22=_0x51d26c?0x0:_0x502420[_0xc606('0x1b')];var _0x3d04e1=_0x51d26c?_0x1da617[_0xc606('0x1e')]:_0x502420[_0xc606('0x1b')]+_0x502420[_0xc606('0x1c')];var _0x2ed9dd;if(_0x3d04e1>=_0x3c53d3){_0x3d04e1=_0x3c53d3;_0x2ed9dd=0xc8;}else{_0x2ed9dd=0xce;}_0x20c4ec[_0xc606('0x18')](_0x2ed9dd);return _0x20c4ec[_0xc606('0x1f')]('Content-Range',_0xbaed22+'-'+_0x3d04e1+'/'+_0x3c53d3)['json'](_0x1da617);}return null;};}function patchUpdates(_0x424b1e){return function(_0x58216c){try{jsonpatch[_0xc606('0x20')](_0x58216c,_0x424b1e,!![]);}catch(_0x461a9b){return BPromise[_0xc606('0x21')](_0x461a9b);}return _0x58216c[_0xc606('0x22')]();};}function saveUpdates(_0x5192d6,_0x4c6575){return function(_0x13b8c0){if(_0x13b8c0){return _0x13b8c0[_0xc606('0x23')](_0x5192d6)['then'](function(_0x34320b){return _0x34320b;});}return null;};}function removeEntity(_0x4da495,_0x54c1b9){return function(_0x35ec90){if(_0x35ec90){return _0x35ec90['destroy']()[_0xc606('0x24')](function(){var _0x3fdfcd=_0x35ec90['get']({'plain':!![]});var _0x2e434a=_0xc606('0x25');return db[_0xc606('0x26')]['destroy']({'where':{'type':_0x2e434a,'resourceId':_0x3fdfcd['id']}})['then'](function(){return _0x35ec90;});})['then'](function(){_0x4da495['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fd144,_0x13e5a6){return function(_0x3563f6){if(!_0x3563f6){_0x3fd144[_0xc606('0x17')](0x194);}return _0x3563f6;};}function handleError(_0x5131da,_0x4aacd6){_0x4aacd6=_0x4aacd6||0x1f4;return function(_0x2df772){logger[_0xc606('0x27')](_0x2df772['stack']);if(_0x2df772[_0xc606('0x28')]){delete _0x2df772[_0xc606('0x28')];}_0x5131da[_0xc606('0x18')](_0x4aacd6)[_0xc606('0x29')](_0x2df772);};}exports[_0xc606('0x2a')]=function(_0x5558c8,_0x22bb47){var _0x5413f6={},_0x3829ee={},_0x2e1c9a={'count':0x0,'rows':[]};var _0x57ccae=_[_0xc606('0x2b')](db[_0xc606('0x2c')][_0xc606('0x2d')],function(_0x39c5a1){return{'name':_0x39c5a1[_0xc606('0x2e')],'type':_0x39c5a1[_0xc606('0x2f')]['key']};});_0x3829ee[_0xc606('0x30')]=_[_0xc606('0x2b')](_0x57ccae,_0xc606('0x28'));_0x3829ee[_0xc606('0x31')]=_[_0xc606('0x32')](_0x5558c8[_0xc606('0x31')]);_0x3829ee['filters']=_[_0xc606('0x33')](_0x3829ee[_0xc606('0x30')],_0x3829ee['query']);_0x5413f6[_0xc606('0x34')]=_['intersection'](_0x3829ee[_0xc606('0x30')],qs[_0xc606('0x35')](_0x5558c8[_0xc606('0x31')]['fields']));_0x5413f6[_0xc606('0x34')]=_0x5413f6['attributes']['length']?_0x5413f6[_0xc606('0x34')]:_0x3829ee[_0xc606('0x30')];if(!_0x5558c8[_0xc606('0x31')]['hasOwnProperty']('nolimit')){_0x5413f6[_0xc606('0x1c')]=qs[_0xc606('0x1c')](_0x5558c8['query'][_0xc606('0x1c')]);_0x5413f6['offset']=qs['offset'](_0x5558c8[_0xc606('0x31')][_0xc606('0x1b')]);}_0x5413f6[_0xc606('0x36')]=qs['sort'](_0x5558c8['query'][_0xc606('0x37')]);_0x5413f6[_0xc606('0x38')]=qs[_0xc606('0x39')](_['pick'](_0x5558c8[_0xc606('0x31')],_0x3829ee[_0xc606('0x39')]),_0x57ccae);if(_0x5558c8[_0xc606('0x31')][_0xc606('0x3a')]){_0x5413f6[_0xc606('0x38')]=_[_0xc606('0x3b')](_0x5413f6[_0xc606('0x38')],{'$or':_[_0xc606('0x2b')](_0x57ccae,function(_0x3c1963){if(_0x3c1963[_0xc606('0x2f')]!=='VIRTUAL'){var _0x6c5930={};_0x6c5930[_0x3c1963[_0xc606('0x28')]]={'$like':'%'+_0x5558c8[_0xc606('0x31')][_0xc606('0x3a')]+'%'};return _0x6c5930;}})});}_0x5413f6=_[_0xc606('0x3b')]({},_0x5413f6,_0x5558c8[_0xc606('0x3c')]);var _0x56fd1b={'where':_0x5413f6[_0xc606('0x38')]};return db[_0xc606('0x2c')][_0xc606('0x1e')](_0x56fd1b)['then'](function(_0x45b98d){_0x2e1c9a['count']=_0x45b98d;if(_0x5558c8[_0xc606('0x31')]['includeAll']){_0x5413f6[_0xc606('0x3d')]=[{'all':!![]}];}return db[_0xc606('0x2c')][_0xc606('0x3e')](_0x5413f6);})['then'](function(_0x1d78d6){_0x2e1c9a['rows']=_0x1d78d6;return _0x2e1c9a;})[_0xc606('0x24')](respondWithFilteredResult(_0x22bb47,_0x5413f6))['catch'](handleError(_0x22bb47,null));};exports['show']=function(_0x3c93c7,_0x4ec9b6){var _0x25d2fe={'raw':!![],'where':{'id':_0x3c93c7['params']['id']}},_0x15acbd={};_0x15acbd[_0xc606('0x30')]=_['keys'](db[_0xc606('0x2c')]['rawAttributes']);_0x15acbd['query']=_[_0xc606('0x32')](_0x3c93c7['query']);_0x15acbd[_0xc606('0x39')]=_[_0xc606('0x33')](_0x15acbd['model'],_0x15acbd[_0xc606('0x31')]);_0x25d2fe[_0xc606('0x34')]=_[_0xc606('0x33')](_0x15acbd['model'],qs[_0xc606('0x35')](_0x3c93c7[_0xc606('0x31')][_0xc606('0x35')]));_0x25d2fe['attributes']=_0x25d2fe[_0xc606('0x34')][_0xc606('0x3f')]?_0x25d2fe['attributes']:_0x15acbd[_0xc606('0x30')];if(_0x3c93c7['query'][_0xc606('0x40')]){_0x25d2fe[_0xc606('0x3d')]=[{'all':!![]}];}_0x25d2fe=_[_0xc606('0x3b')]({},_0x25d2fe,_0x3c93c7[_0xc606('0x3c')]);return db[_0xc606('0x2c')][_0xc606('0x41')](_0x25d2fe)[_0xc606('0x24')](handleEntityNotFound(_0x4ec9b6,null))[_0xc606('0x24')](respondWithResult(_0x4ec9b6,null))[_0xc606('0x42')](handleError(_0x4ec9b6,null));};exports[_0xc606('0x43')]=function(_0x4ef4cf,_0x479669){return db[_0xc606('0x2c')][_0xc606('0x43')](_0x4ef4cf[_0xc606('0x44')],{})[_0xc606('0x24')](function(_0x353e46){var _0x2b6793=_0x4ef4cf[_0xc606('0x45')]['get']({'plain':!![]});if(!_0x2b6793)throw new Error(_0xc606('0x46'));if(_0x2b6793[_0xc606('0x47')]===_0xc606('0x45')){var _0x131ceb=_0x353e46[_0xc606('0x48')]({'plain':!![]});var _0x58e081=_0xc606('0x25');return db[_0xc606('0x49')]['find']({'where':{'name':_0x58e081,'userProfileId':_0x2b6793[_0xc606('0x4a')]},'raw':!![]})[_0xc606('0x24')](function(_0x89704){if(_0x89704&&_0x89704['autoAssociation']===0x0){return db[_0xc606('0x26')][_0xc606('0x43')]({'name':_0x131ceb[_0xc606('0x28')],'resourceId':_0x131ceb['id'],'type':_0x89704['name'],'sectionId':_0x89704['id']},{})[_0xc606('0x24')](function(){return _0x353e46;});}else{return _0x353e46;}})[_0xc606('0x42')](function(_0x1d6f3c){logger['error'](_0xc606('0x4b'),_0x1d6f3c);throw _0x1d6f3c;});}return _0x353e46;})[_0xc606('0x24')](respondWithResult(_0x479669,0xc9))[_0xc606('0x42')](handleError(_0x479669,null));};exports[_0xc606('0x23')]=function(_0x1a9a97,_0x1549b8){if(_0x1a9a97[_0xc606('0x44')]['id']){delete _0x1a9a97[_0xc606('0x44')]['id'];}return db['AnalyticExtractedReport'][_0xc606('0x41')]({'where':{'id':_0x1a9a97[_0xc606('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1549b8,null))[_0xc606('0x24')](saveUpdates(_0x1a9a97[_0xc606('0x44')],null))[_0xc606('0x24')](respondWithResult(_0x1549b8,null))['catch'](handleError(_0x1549b8,null));};exports[_0xc606('0x4d')]=function(_0x17fba7,_0xe0b8cf){return db[_0xc606('0x2c')][_0xc606('0x41')]({'where':{'id':_0x17fba7['params']['id']}})[_0xc606('0x24')](handleEntityNotFound(_0xe0b8cf,null))['then'](removeEntity(_0xe0b8cf,null))['catch'](handleError(_0xe0b8cf,null));};exports[_0xc606('0x4e')]=function(_0x5a3146,_0xdac000,_0x344420){return db[_0xc606('0x2c')][_0xc606('0x41')]({'where':{'id':_0x5a3146[_0xc606('0x4c')]['id']},'attributes':[_0xc606('0x28'),'basename','savename',_0xc606('0x4f')],'raw':!![]})[_0xc606('0x24')](handleEntityNotFound(_0xdac000,null))[_0xc606('0x24')](function(_0x353583){if(_0x353583){if(!fs[_0xc606('0x50')](path[_0xc606('0x51')](config[_0xc606('0x52')],_0xc606('0x53'),_0x353583[_0xc606('0x54')]))){throw new db['Sequelize'][(_0xc606('0x55'))](_0xc606('0x56'));}if(_0x5a3146['query']['exists']){return _0xdac000[_0xc606('0x17')](0xc8);}return _0xdac000['download'](path['join'](config['root'],_0xc606('0x53'),_0x353583[_0xc606('0x54')]),util[_0xc606('0x57')](_0xc606('0x58'),_0x353583[_0xc606('0x59')]||_0x353583[_0xc606('0x28')],_0x353583['output'][_0xc606('0x5a')]()));}})[_0xc606('0x42')](handleError(_0xdac000,null));}; \ No newline at end of file +var _0xaf76=['sox','fs-extra','lodash','crypto','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','ExtractedReports','destroy','then','stack','name','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','%s.%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x123599,_0x374e14){var _0x3bf01d=function(_0x60b9bc){while(--_0x60b9bc){_0x123599['push'](_0x123599['shift']());}};_0x3bf01d(++_0x374e14);}(_0xaf76,0xb0));var _0x6af7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf76[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6af7('0x0'));var rimraf=require(_0x6af7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6af7('0x2'));var rp=require(_0x6af7('0x3'));var moment=require(_0x6af7('0x4'));var BPromise=require(_0x6af7('0x5'));var Mustache=require('mustache');var util=require(_0x6af7('0x6'));var path=require(_0x6af7('0x7'));var sox=require(_0x6af7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6af7('0x9'));var _=require(_0x6af7('0xa'));var squel=require('squel');var crypto=require(_0x6af7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6af7('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6af7('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x6af7('0xe'));var hardwareService=require(_0x6af7('0xf'));var logger=require(_0x6af7('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x6af7('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x6af7('0x12'))['db'];function respondWithStatusCode(_0x22135d,_0x1c3604){_0x1c3604=_0x1c3604||0xcc;return function(_0x3d4301){if(_0x3d4301){return _0x22135d[_0x6af7('0x13')](_0x1c3604);}return _0x22135d[_0x6af7('0x14')](_0x1c3604)[_0x6af7('0x15')]();};}function respondWithResult(_0x447ccf,_0x1f4eef){_0x1f4eef=_0x1f4eef||0xc8;return function(_0x507372){if(_0x507372){return _0x447ccf['status'](_0x1f4eef)[_0x6af7('0x16')](_0x507372);}};}function respondWithFilteredResult(_0x3a94a4,_0x4e7f76){return function(_0x432896){if(_0x432896){var _0x3fa345=typeof _0x4e7f76[_0x6af7('0x17')]===_0x6af7('0x18')&&typeof _0x4e7f76[_0x6af7('0x19')]===_0x6af7('0x18');var _0x57d79d=_0x432896[_0x6af7('0x1a')];var _0x351fdb=_0x3fa345?0x0:_0x4e7f76[_0x6af7('0x17')];var _0x495c75=_0x3fa345?_0x432896[_0x6af7('0x1a')]:_0x4e7f76[_0x6af7('0x17')]+_0x4e7f76[_0x6af7('0x19')];var _0x4a071a;if(_0x495c75>=_0x57d79d){_0x495c75=_0x57d79d;_0x4a071a=0xc8;}else{_0x4a071a=0xce;}_0x3a94a4[_0x6af7('0x14')](_0x4a071a);return _0x3a94a4[_0x6af7('0x1b')]('Content-Range',_0x351fdb+'-'+_0x495c75+'/'+_0x57d79d)[_0x6af7('0x16')](_0x432896);}return null;};}function patchUpdates(_0x50e996){return function(_0x499567){try{jsonpatch[_0x6af7('0x1c')](_0x499567,_0x50e996,!![]);}catch(_0x202e4c){return BPromise[_0x6af7('0x1d')](_0x202e4c);}return _0x499567[_0x6af7('0x1e')]();};}function saveUpdates(_0x54ecdf,_0x3b550d){return function(_0x23e8b5){if(_0x23e8b5){return _0x23e8b5[_0x6af7('0x1f')](_0x54ecdf)['then'](function(_0xb93ce2){return _0xb93ce2;});}return null;};}function removeEntity(_0xd8eb5b,_0x1243d6){return function(_0x38b97c){if(_0x38b97c){return _0x38b97c['destroy']()['then'](function(){var _0x32642f=_0x38b97c['get']({'plain':!![]});var _0x40c380=_0x6af7('0x20');return db['UserProfileResource'][_0x6af7('0x21')]({'where':{'type':_0x40c380,'resourceId':_0x32642f['id']}})['then'](function(){return _0x38b97c;});})[_0x6af7('0x22')](function(){_0xd8eb5b[_0x6af7('0x14')](0xcc)[_0x6af7('0x15')]();});}};}function handleEntityNotFound(_0x15d50d,_0x262654){return function(_0x46e99f){if(!_0x46e99f){_0x15d50d[_0x6af7('0x13')](0x194);}return _0x46e99f;};}function handleError(_0x57023e,_0x7b6191){_0x7b6191=_0x7b6191||0x1f4;return function(_0x435cc6){logger['error'](_0x435cc6[_0x6af7('0x23')]);if(_0x435cc6[_0x6af7('0x24')]){delete _0x435cc6[_0x6af7('0x24')];}_0x57023e[_0x6af7('0x14')](_0x7b6191)['send'](_0x435cc6);};}exports[_0x6af7('0x25')]=function(_0x3304a3,_0x1adb71){var _0x1648f5={},_0x489c22={},_0xf562fe={'count':0x0,'rows':[]};var _0x26ace8=_[_0x6af7('0x26')](db[_0x6af7('0x27')]['rawAttributes'],function(_0x56a35b){return{'name':_0x56a35b[_0x6af7('0x28')],'type':_0x56a35b[_0x6af7('0x29')][_0x6af7('0x2a')]};});_0x489c22[_0x6af7('0x2b')]=_[_0x6af7('0x26')](_0x26ace8,_0x6af7('0x24'));_0x489c22[_0x6af7('0x2c')]=_[_0x6af7('0x2d')](_0x3304a3[_0x6af7('0x2c')]);_0x489c22[_0x6af7('0x2e')]=_['intersection'](_0x489c22['model'],_0x489c22[_0x6af7('0x2c')]);_0x1648f5[_0x6af7('0x2f')]=_[_0x6af7('0x30')](_0x489c22['model'],qs[_0x6af7('0x31')](_0x3304a3['query'][_0x6af7('0x31')]));_0x1648f5[_0x6af7('0x2f')]=_0x1648f5[_0x6af7('0x2f')][_0x6af7('0x32')]?_0x1648f5[_0x6af7('0x2f')]:_0x489c22['model'];if(!_0x3304a3[_0x6af7('0x2c')][_0x6af7('0x33')](_0x6af7('0x34'))){_0x1648f5[_0x6af7('0x19')]=qs[_0x6af7('0x19')](_0x3304a3[_0x6af7('0x2c')][_0x6af7('0x19')]);_0x1648f5[_0x6af7('0x17')]=qs[_0x6af7('0x17')](_0x3304a3[_0x6af7('0x2c')][_0x6af7('0x17')]);}_0x1648f5[_0x6af7('0x35')]=qs[_0x6af7('0x36')](_0x3304a3[_0x6af7('0x2c')][_0x6af7('0x36')]);_0x1648f5[_0x6af7('0x37')]=qs[_0x6af7('0x2e')](_[_0x6af7('0x38')](_0x3304a3[_0x6af7('0x2c')],_0x489c22[_0x6af7('0x2e')]),_0x26ace8);if(_0x3304a3['query'][_0x6af7('0x39')]){_0x1648f5['where']=_[_0x6af7('0x3a')](_0x1648f5[_0x6af7('0x37')],{'$or':_[_0x6af7('0x26')](_0x26ace8,function(_0x10cda5){if(_0x10cda5['type']!=='VIRTUAL'){var _0x106fa5={};_0x106fa5[_0x10cda5[_0x6af7('0x24')]]={'$like':'%'+_0x3304a3[_0x6af7('0x2c')][_0x6af7('0x39')]+'%'};return _0x106fa5;}})});}_0x1648f5=_[_0x6af7('0x3a')]({},_0x1648f5,_0x3304a3[_0x6af7('0x3b')]);var _0x37a6bd={'where':_0x1648f5[_0x6af7('0x37')]};return db[_0x6af7('0x27')][_0x6af7('0x1a')](_0x37a6bd)[_0x6af7('0x22')](function(_0x2426b5){_0xf562fe[_0x6af7('0x1a')]=_0x2426b5;if(_0x3304a3[_0x6af7('0x2c')][_0x6af7('0x3c')]){_0x1648f5['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x6af7('0x3d')](_0x1648f5);})[_0x6af7('0x22')](function(_0x193cc4){_0xf562fe[_0x6af7('0x3e')]=_0x193cc4;return _0xf562fe;})['then'](respondWithFilteredResult(_0x1adb71,_0x1648f5))[_0x6af7('0x3f')](handleError(_0x1adb71,null));};exports[_0x6af7('0x40')]=function(_0x335c51,_0x1a4515){var _0x45bb37={'raw':!![],'where':{'id':_0x335c51[_0x6af7('0x41')]['id']}},_0x1d5a76={};_0x1d5a76[_0x6af7('0x2b')]=_[_0x6af7('0x2d')](db[_0x6af7('0x27')]['rawAttributes']);_0x1d5a76[_0x6af7('0x2c')]=_[_0x6af7('0x2d')](_0x335c51['query']);_0x1d5a76[_0x6af7('0x2e')]=_['intersection'](_0x1d5a76['model'],_0x1d5a76[_0x6af7('0x2c')]);_0x45bb37[_0x6af7('0x2f')]=_[_0x6af7('0x30')](_0x1d5a76[_0x6af7('0x2b')],qs[_0x6af7('0x31')](_0x335c51[_0x6af7('0x2c')][_0x6af7('0x31')]));_0x45bb37[_0x6af7('0x2f')]=_0x45bb37[_0x6af7('0x2f')][_0x6af7('0x32')]?_0x45bb37[_0x6af7('0x2f')]:_0x1d5a76[_0x6af7('0x2b')];if(_0x335c51[_0x6af7('0x2c')][_0x6af7('0x3c')]){_0x45bb37[_0x6af7('0x42')]=[{'all':!![]}];}_0x45bb37=_[_0x6af7('0x3a')]({},_0x45bb37,_0x335c51['options']);return db['AnalyticExtractedReport'][_0x6af7('0x43')](_0x45bb37)['then'](handleEntityNotFound(_0x1a4515,null))[_0x6af7('0x22')](respondWithResult(_0x1a4515,null))[_0x6af7('0x3f')](handleError(_0x1a4515,null));};exports[_0x6af7('0x44')]=function(_0x4e73c9,_0x3f738f){return db[_0x6af7('0x27')][_0x6af7('0x44')](_0x4e73c9[_0x6af7('0x45')],{})[_0x6af7('0x22')](function(_0x4e0e50){var _0x43ccf5=_0x4e73c9['user']['get']({'plain':!![]});if(!_0x43ccf5)throw new Error(_0x6af7('0x46'));if(_0x43ccf5[_0x6af7('0x47')]===_0x6af7('0x48')){var _0x3c737d=_0x4e0e50[_0x6af7('0x49')]({'plain':!![]});var _0x59ffbc='ExtractedReports';return db[_0x6af7('0x4a')][_0x6af7('0x43')]({'where':{'name':_0x59ffbc,'userProfileId':_0x43ccf5[_0x6af7('0x4b')]},'raw':!![]})[_0x6af7('0x22')](function(_0x332a60){if(_0x332a60&&_0x332a60[_0x6af7('0x4c')]===0x0){return db[_0x6af7('0x4d')]['create']({'name':_0x3c737d[_0x6af7('0x24')],'resourceId':_0x3c737d['id'],'type':_0x332a60[_0x6af7('0x24')],'sectionId':_0x332a60['id']},{})[_0x6af7('0x22')](function(){return _0x4e0e50;});}else{return _0x4e0e50;}})[_0x6af7('0x3f')](function(_0x3acb42){logger[_0x6af7('0x4e')](_0x6af7('0x4f'),_0x3acb42);throw _0x3acb42;});}return _0x4e0e50;})[_0x6af7('0x22')](respondWithResult(_0x3f738f,0xc9))[_0x6af7('0x3f')](handleError(_0x3f738f,null));};exports[_0x6af7('0x1f')]=function(_0xaf09b1,_0x36528f){if(_0xaf09b1[_0x6af7('0x45')]['id']){delete _0xaf09b1['body']['id'];}return db[_0x6af7('0x27')][_0x6af7('0x43')]({'where':{'id':_0xaf09b1[_0x6af7('0x41')]['id']}})['then'](handleEntityNotFound(_0x36528f,null))[_0x6af7('0x22')](saveUpdates(_0xaf09b1['body'],null))['then'](respondWithResult(_0x36528f,null))[_0x6af7('0x3f')](handleError(_0x36528f,null));};exports[_0x6af7('0x21')]=function(_0x24534a,_0x1e7e73){return db[_0x6af7('0x27')][_0x6af7('0x43')]({'where':{'id':_0x24534a[_0x6af7('0x41')]['id']}})[_0x6af7('0x22')](handleEntityNotFound(_0x1e7e73,null))[_0x6af7('0x22')](removeEntity(_0x1e7e73,null))[_0x6af7('0x3f')](handleError(_0x1e7e73,null));};exports[_0x6af7('0x50')]=function(_0x584c14,_0x423e86,_0x21e1cb){return db[_0x6af7('0x27')][_0x6af7('0x43')]({'where':{'id':_0x584c14[_0x6af7('0x41')]['id']},'attributes':[_0x6af7('0x24'),_0x6af7('0x51'),_0x6af7('0x52'),'output'],'raw':!![]})[_0x6af7('0x22')](handleEntityNotFound(_0x423e86,null))['then'](function(_0x3e2a4e){if(_0x3e2a4e){if(!fs[_0x6af7('0x53')](path[_0x6af7('0x54')](config[_0x6af7('0x55')],'server/files/reports',_0x3e2a4e[_0x6af7('0x52')]))){throw new db[(_0x6af7('0x56'))][(_0x6af7('0x57'))](_0x6af7('0x58'));}if(_0x584c14[_0x6af7('0x2c')][_0x6af7('0x59')]){return _0x423e86[_0x6af7('0x13')](0xc8);}return _0x423e86[_0x6af7('0x50')](path[_0x6af7('0x54')](config[_0x6af7('0x55')],_0x6af7('0x5a'),_0x3e2a4e['savename']),util['format'](_0x6af7('0x5b'),_0x3e2a4e[_0x6af7('0x51')]||_0x3e2a4e[_0x6af7('0x24')],_0x3e2a4e['output']['toLowerCase']()));}})[_0x6af7('0x3f')](handleError(_0x423e86,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 146311c..d3abc2b 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 _0x6567=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api'];(function(_0x1e2072,_0x145d84){var _0x1a72ce=function(_0xd30383){while(--_0xd30383){_0x1e2072['push'](_0x1e2072['shift']());}};_0x1a72ce(++_0x145d84);}(_0x6567,0x168));var _0x7656=function(_0xfacbc8,_0x3cf35b){_0xfacbc8=_0xfacbc8-0x0;var _0x512376=_0x6567[_0xfacbc8];return _0x512376;};'use strict';var _=require(_0x7656('0x0'));var util=require(_0x7656('0x1'));var logger=require(_0x7656('0x2'))(_0x7656('0x3'));var moment=require(_0x7656('0x4'));var BPromise=require(_0x7656('0x5'));var rp=require(_0x7656('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7656('0x7'));var config=require(_0x7656('0x8'));var attributes=require(_0x7656('0x9'));module['exports']=function(_0x3b9092,_0x19e3d3){return _0x3b9092[_0x7656('0xa')](_0x7656('0xb'),attributes,{'tableName':_0x7656('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa02f=['analytics_extracted_reports','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x998637,_0x16e418){var _0x32e308=function(_0x4ad169){while(--_0x4ad169){_0x998637['push'](_0x998637['shift']());}};_0x32e308(++_0x16e418);}(_0xa02f,0xbc));var _0xfa02=function(_0x427bee,_0x173029){_0x427bee=_0x427bee-0x0;var _0x1d7f7a=_0xa02f[_0x427bee];return _0x1d7f7a;};'use strict';var _=require(_0xfa02('0x0'));var util=require(_0xfa02('0x1'));var logger=require(_0xfa02('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfa02('0x3'));var rp=require(_0xfa02('0x4'));var fs=require('fs');var path=require(_0xfa02('0x5'));var rimraf=require(_0xfa02('0x6'));var config=require(_0xfa02('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0xfa02('0x8')]=function(_0x492275,_0x19af77){return _0x492275[_0xfa02('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0xfa02('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 d09f2a0..27060ef 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 _0xcc98=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xcc98,0xb2));var _0x8cc9=function(_0x382492,_0x2b8cde){_0x382492=_0x382492-0x0;var _0xbaaf9d=_0xcc98[_0x382492];return _0xbaaf9d;};'use strict';var _=require(_0x8cc9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8cc9('0x1'));var rs=require(_0x8cc9('0x2'));var fs=require('fs');var Redis=require(_0x8cc9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8cc9('0x4'))(_0x8cc9('0x5'));var config=require(_0x8cc9('0x6'));var jayson=require(_0x8cc9('0x7'));var client=jayson[_0x8cc9('0x8')][_0x8cc9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cd59d,_0x365276,_0x189baa){return new BPromise(function(_0x13b48c,_0x167350){return client['request'](_0x3cd59d,_0x189baa)[_0x8cc9('0xa')](function(_0xeabd12){logger[_0x8cc9('0xb')](_0x8cc9('0xc'),_0x365276,_0x8cc9('0xd'));logger['debug'](_0x8cc9('0xe'),_0x365276,_0x8cc9('0xd'),JSON[_0x8cc9('0xf')](_0xeabd12));if(_0xeabd12[_0x8cc9('0x10')]){if(_0xeabd12[_0x8cc9('0x10')][_0x8cc9('0x11')]===0x1f4){logger[_0x8cc9('0x10')](_0x8cc9('0xc'),_0x365276,_0xeabd12[_0x8cc9('0x10')][_0x8cc9('0x12')]);return _0x167350(_0xeabd12['error'][_0x8cc9('0x12')]);}logger[_0x8cc9('0x10')](_0x8cc9('0xc'),_0x365276,_0xeabd12[_0x8cc9('0x10')][_0x8cc9('0x12')]);return _0x13b48c(_0xeabd12['error']['message']);}else{logger[_0x8cc9('0xb')](_0x8cc9('0xc'),_0x365276,_0x8cc9('0xd'));_0x13b48c(_0xeabd12[_0x8cc9('0x13')][_0x8cc9('0x12')]);}})[_0x8cc9('0x14')](function(_0x2ad65f){logger[_0x8cc9('0x10')](_0x8cc9('0xc'),_0x365276,_0x2ad65f);_0x167350(_0x2ad65f);});});} \ No newline at end of file +var _0x8748=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x52ab80,_0x3878bd){var _0x3ba0bb=function(_0x362694){while(--_0x362694){_0x52ab80['push'](_0x52ab80['shift']());}};_0x3ba0bb(++_0x3878bd);}(_0x8748,0x9e));var _0x8874=function(_0x1d2323,_0x2b56f1){_0x1d2323=_0x1d2323-0x0;var _0x36cdd8=_0x8748[_0x1d2323];return _0x36cdd8;};'use strict';var _=require(_0x8874('0x0'));var util=require(_0x8874('0x1'));var moment=require(_0x8874('0x2'));var BPromise=require(_0x8874('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8874('0x4'));var db=require(_0x8874('0x5'))['db'];var utils=require(_0x8874('0x6'));var logger=require(_0x8874('0x7'))(_0x8874('0x8'));var config=require(_0x8874('0x9'));var jayson=require(_0x8874('0xa'));var client=jayson['client'][_0x8874('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b372a,_0x1f57b3,_0x482f29){return new BPromise(function(_0x548467,_0x424872){return client['request'](_0x5b372a,_0x482f29)[_0x8874('0xc')](function(_0x21b54d){logger[_0x8874('0xd')](_0x8874('0xe'),_0x1f57b3,_0x8874('0xf'));logger[_0x8874('0x10')](_0x8874('0x11'),_0x1f57b3,_0x8874('0xf'),JSON[_0x8874('0x12')](_0x21b54d));if(_0x21b54d[_0x8874('0x13')]){if(_0x21b54d[_0x8874('0x13')][_0x8874('0x14')]===0x1f4){logger[_0x8874('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1f57b3,_0x21b54d[_0x8874('0x13')][_0x8874('0x15')]);return _0x424872(_0x21b54d['error'][_0x8874('0x15')]);}logger['error'](_0x8874('0xe'),_0x1f57b3,_0x21b54d[_0x8874('0x13')][_0x8874('0x15')]);return _0x548467(_0x21b54d[_0x8874('0x13')]['message']);}else{logger[_0x8874('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1f57b3,_0x8874('0xf'));_0x548467(_0x21b54d[_0x8874('0x16')][_0x8874('0x15')]);}})['catch'](function(_0x1b0501){logger['error'](_0x8874('0xe'),_0x1f57b3,_0x1b0501);_0x424872(_0x1b0501);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index a5fc1a4..a806e7b 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 _0xade5=['../../config/environment','get','index','/:id','show','/:id/download','isAuthenticated','download','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x7ad6cb,_0xffee6c){var _0x22a0ba=function(_0x47f291){while(--_0x47f291){_0x7ad6cb['push'](_0x7ad6cb['shift']());}};_0x22a0ba(++_0xffee6c);}(_0xade5,0x172));var _0x5ade=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xade5[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x5ade('0x0'));var util=require(_0x5ade('0x1'));var path=require(_0x5ade('0x2'));var timeout=require(_0x5ade('0x3'));var express=require(_0x5ade('0x4'));var router=express[_0x5ade('0x5')]();var fs_extra=require(_0x5ade('0x6'));var auth=require(_0x5ade('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5ade('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x5ade('0x9')]('/',auth['isAuthenticated'](),controller[_0x5ade('0xa')]);router['get'](_0x5ade('0xb'),auth['isAuthenticated'](),controller[_0x5ade('0xc')]);router['get'](_0x5ade('0xd'),auth[_0x5ade('0xe')](),controller[_0x5ade('0xf')]);router[_0x5ade('0x10')]('/',auth[_0x5ade('0xe')](),controller[_0x5ade('0x11')]);router['put'](_0x5ade('0xb'),auth['isAuthenticated'](),controller[_0x5ade('0x12')]);router[_0x5ade('0x13')](_0x5ade('0xb'),auth[_0x5ade('0xe')](),controller['destroy']);module[_0x5ade('0x14')]=router; \ No newline at end of file +var _0x539f=['index','/:id','show','/:id/download','post','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated'];(function(_0x270a54,_0x307ff6){var _0x4d07d0=function(_0x59ac5a){while(--_0x59ac5a){_0x270a54['push'](_0x270a54['shift']());}};_0x4d07d0(++_0x307ff6);}(_0x539f,0x100));var _0xf539=function(_0x592b77,_0x5b35f1){_0x592b77=_0x592b77-0x0;var _0x3a4849=_0x539f[_0x592b77];return _0x3a4849;};'use strict';var multer=require(_0xf539('0x0'));var util=require(_0xf539('0x1'));var path=require(_0xf539('0x2'));var timeout=require(_0xf539('0x3'));var express=require('express');var router=express[_0xf539('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf539('0x5'));var interaction=require(_0xf539('0x6'));var config=require(_0xf539('0x7'));var controller=require(_0xf539('0x8'));router['get']('/',auth[_0xf539('0x9')](),controller[_0xf539('0xa')]);router['get'](_0xf539('0xb'),auth[_0xf539('0x9')](),controller[_0xf539('0xc')]);router['get'](_0xf539('0xd'),auth[_0xf539('0x9')](),controller['download']);router[_0xf539('0xe')]('/',auth[_0xf539('0x9')](),controller['create']);router['put'](_0xf539('0xb'),auth[_0xf539('0x9')](),controller[_0xf539('0xf')]);router[_0xf539('0x10')](_0xf539('0xb'),auth['isAuthenticated'](),controller[_0xf539('0x11')]);module[_0xf539('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 8f5b37a..494a0e5 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 _0x2fd8=['sequelize','TEXT','STRING'];(function(_0x41a127,_0x546a15){var _0x526801=function(_0x3a936d){while(--_0x3a936d){_0x41a127['push'](_0x41a127['shift']());}};_0x526801(++_0x546a15);}(_0x2fd8,0xc3));var _0x82fd=function(_0x412cf9,_0x1a4932){_0x412cf9=_0x412cf9-0x0;var _0x9d24e4=_0x2fd8[_0x412cf9];return _0x9d24e4;};'use strict';var Sequelize=require(_0x82fd('0x0'));module['exports']={'field':{'type':Sequelize[_0x82fd('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x82fd('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x82fd('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1b9b=['exports','TEXT','STRING','BOOLEAN'];(function(_0x964d16,_0x22e8b2){var _0x5af22b=function(_0x16bcb9){while(--_0x16bcb9){_0x964d16['push'](_0x964d16['shift']());}};_0x5af22b(++_0x22e8b2);}(_0x1b9b,0x1dc));var _0xb1b9=function(_0x17809c,_0xa6ceb9){_0x17809c=_0x17809c-0x0;var _0x144a29=_0x1b9b[_0x17809c];return _0x144a29;};'use strict';var Sequelize=require('sequelize');module[_0xb1b9('0x0')]={'field':{'type':Sequelize[_0xb1b9('0x1')]},'alias':{'type':Sequelize[_0xb1b9('0x2')]},'function':{'type':Sequelize[_0xb1b9('0x2')]},'format':{'type':Sequelize[_0xb1b9('0x2')]},'groupBy':{'type':Sequelize[_0xb1b9('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb1b9('0x2')]},'custom':{'type':Sequelize[_0xb1b9('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 3a22be6..403a6ea 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 _0x91cd=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','merge','AnalyticFieldReport','then','includeAll','include','findAll','catch','show','length','options','find','create','body','bulkCreate','params','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x48f94e,_0x62515d){var _0x25be89=function(_0x37bdd4){while(--_0x37bdd4){_0x48f94e['push'](_0x48f94e['shift']());}};_0x25be89(++_0x62515d);}(_0x91cd,0x12d));var _0xd91c=function(_0x4dbba7,_0x34d6d1){_0x4dbba7=_0x4dbba7-0x0;var _0x43ef83=_0x91cd[_0x4dbba7];return _0x43ef83;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd91c('0x0'));var zipdir=require(_0xd91c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd91c('0x2'));var moment=require(_0xd91c('0x3'));var BPromise=require(_0xd91c('0x4'));var Mustache=require('mustache');var util=require(_0xd91c('0x5'));var path=require('path');var sox=require(_0xd91c('0x6'));var csv=require(_0xd91c('0x7'));var ejs=require(_0xd91c('0x8'));var fs=require('fs');var fs_extra=require(_0xd91c('0x9'));var _=require(_0xd91c('0xa'));var squel=require(_0xd91c('0xb'));var crypto=require(_0xd91c('0xc'));var jsforce=require(_0xd91c('0xd'));var deskjs=require(_0xd91c('0xe'));var toCsv=require(_0xd91c('0x7'));var querystring=require('querystring');var Papa=require(_0xd91c('0xf'));var Redis=require(_0xd91c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd91c('0x11'));var as=require(_0xd91c('0x12'));var hardwareService=require(_0xd91c('0x13'));var logger=require(_0xd91c('0x14'))(_0xd91c('0x15'));var utils=require('../../config/utils');var config=require(_0xd91c('0x16'));var licenseUtil=require(_0xd91c('0x17'));var db=require(_0xd91c('0x18'))['db'];function respondWithStatusCode(_0xa62588,_0x1a8263){_0x1a8263=_0x1a8263||0xcc;return function(_0x47fc56){if(_0x47fc56){return _0xa62588[_0xd91c('0x19')](_0x1a8263);}return _0xa62588[_0xd91c('0x1a')](_0x1a8263)[_0xd91c('0x1b')]();};}function respondWithResult(_0x5a9a34,_0x321d51){_0x321d51=_0x321d51||0xc8;return function(_0x43a300){if(_0x43a300){return _0x5a9a34[_0xd91c('0x1a')](_0x321d51)[_0xd91c('0x1c')](_0x43a300);}};}function respondWithFilteredResult(_0x445732,_0x43f01a){return function(_0x1f749a){if(_0x1f749a){var _0xf83191=typeof _0x43f01a[_0xd91c('0x1d')]===_0xd91c('0x1e')&&typeof _0x43f01a[_0xd91c('0x1f')]===_0xd91c('0x1e');var _0x2494c6=_0x1f749a[_0xd91c('0x20')];var _0x56fef=_0xf83191?0x0:_0x43f01a[_0xd91c('0x1d')];var _0x53ca16=_0xf83191?_0x1f749a[_0xd91c('0x20')]:_0x43f01a[_0xd91c('0x1d')]+_0x43f01a[_0xd91c('0x1f')];var _0x2c3317;if(_0x53ca16>=_0x2494c6){_0x53ca16=_0x2494c6;_0x2c3317=0xc8;}else{_0x2c3317=0xce;}_0x445732['status'](_0x2c3317);return _0x445732[_0xd91c('0x21')](_0xd91c('0x22'),_0x56fef+'-'+_0x53ca16+'/'+_0x2494c6)['json'](_0x1f749a);}return null;};}function patchUpdates(_0x13e6f0){return function(_0x43a577){try{jsonpatch[_0xd91c('0x23')](_0x43a577,_0x13e6f0,!![]);}catch(_0x5b48f1){return BPromise[_0xd91c('0x24')](_0x5b48f1);}return _0x43a577[_0xd91c('0x25')]();};}function saveUpdates(_0x38895a,_0x53a6bc){return function(_0x22b0d4){if(_0x22b0d4){return _0x22b0d4[_0xd91c('0x26')](_0x38895a)['then'](function(_0x149399){return _0x149399;});}return null;};}function removeEntity(_0x3f976d,_0x3fc434){return function(_0x42b4e3){if(_0x42b4e3){return _0x42b4e3['destroy']()['then'](function(){_0x3f976d['status'](0xcc)[_0xd91c('0x1b')]();});}};}function handleEntityNotFound(_0x105097,_0x32c93e){return function(_0x3a16c4){if(!_0x3a16c4){_0x105097[_0xd91c('0x19')](0x194);}return _0x3a16c4;};}function handleError(_0x39ffc2,_0x20e06e){_0x20e06e=_0x20e06e||0x1f4;return function(_0x3a430d){logger[_0xd91c('0x27')](_0x3a430d[_0xd91c('0x28')]);if(_0x3a430d[_0xd91c('0x29')]){delete _0x3a430d['name'];}_0x39ffc2[_0xd91c('0x1a')](_0x20e06e)[_0xd91c('0x2a')](_0x3a430d);};}exports[_0xd91c('0x2b')]=function(_0x40091c,_0x1606cd){var _0x47d829={},_0x1492b7={},_0x4c3284={'count':0x0,'rows':[]};var _0x523582=_['map'](db['AnalyticFieldReport'][_0xd91c('0x2c')],function(_0x100fda){return{'name':_0x100fda['fieldName'],'type':_0x100fda[_0xd91c('0x2d')][_0xd91c('0x2e')]};});_0x1492b7[_0xd91c('0x2f')]=_[_0xd91c('0x30')](_0x523582,'name');_0x1492b7['query']=_[_0xd91c('0x31')](_0x40091c[_0xd91c('0x32')]);_0x1492b7[_0xd91c('0x33')]=_[_0xd91c('0x34')](_0x1492b7[_0xd91c('0x2f')],_0x1492b7[_0xd91c('0x32')]);_0x47d829[_0xd91c('0x35')]=_['intersection'](_0x1492b7['model'],qs[_0xd91c('0x36')](_0x40091c['query'][_0xd91c('0x36')]));_0x47d829[_0xd91c('0x35')]=_0x47d829[_0xd91c('0x35')]['length']?_0x47d829[_0xd91c('0x35')]:_0x1492b7['model'];if(!_0x40091c[_0xd91c('0x32')][_0xd91c('0x37')]('nolimit')){_0x47d829[_0xd91c('0x1f')]=qs[_0xd91c('0x1f')](_0x40091c[_0xd91c('0x32')][_0xd91c('0x1f')]);_0x47d829[_0xd91c('0x1d')]=qs[_0xd91c('0x1d')](_0x40091c[_0xd91c('0x32')][_0xd91c('0x1d')]);}_0x47d829['order']=qs[_0xd91c('0x38')](_0x40091c[_0xd91c('0x32')]['sort']);_0x47d829[_0xd91c('0x39')]=qs[_0xd91c('0x33')](_[_0xd91c('0x3a')](_0x40091c[_0xd91c('0x32')],_0x1492b7[_0xd91c('0x33')]),_0x523582);if(_0x40091c[_0xd91c('0x32')]['filter']){_0x47d829[_0xd91c('0x39')]=_[_0xd91c('0x3b')](_0x47d829[_0xd91c('0x39')],{'$or':_['map'](_0x523582,function(_0x286f1c){if(_0x286f1c['type']!=='VIRTUAL'){var _0x3188b6={};_0x3188b6[_0x286f1c[_0xd91c('0x29')]]={'$like':'%'+_0x40091c['query']['filter']+'%'};return _0x3188b6;}})});}_0x47d829=_['merge']({},_0x47d829,_0x40091c['options']);var _0x15659f={'where':_0x47d829[_0xd91c('0x39')]};return db[_0xd91c('0x3c')]['count'](_0x15659f)[_0xd91c('0x3d')](function(_0x5f01a3){_0x4c3284[_0xd91c('0x20')]=_0x5f01a3;if(_0x40091c[_0xd91c('0x32')][_0xd91c('0x3e')]){_0x47d829[_0xd91c('0x3f')]=[{'all':!![]}];}return db[_0xd91c('0x3c')][_0xd91c('0x40')](_0x47d829);})[_0xd91c('0x3d')](function(_0x1ce662){_0x4c3284['rows']=_0x1ce662;return _0x4c3284;})['then'](respondWithFilteredResult(_0x1606cd,_0x47d829))[_0xd91c('0x41')](handleError(_0x1606cd,null));};exports[_0xd91c('0x42')]=function(_0x1af82c,_0x452811){var _0x5862fb={'raw':![],'where':{'id':_0x1af82c['params']['id']}},_0x4730d8={};_0x4730d8[_0xd91c('0x2f')]=_[_0xd91c('0x31')](db[_0xd91c('0x3c')][_0xd91c('0x2c')]);_0x4730d8[_0xd91c('0x32')]=_['keys'](_0x1af82c['query']);_0x4730d8[_0xd91c('0x33')]=_['intersection'](_0x4730d8[_0xd91c('0x2f')],_0x4730d8[_0xd91c('0x32')]);_0x5862fb['attributes']=_[_0xd91c('0x34')](_0x4730d8[_0xd91c('0x2f')],qs[_0xd91c('0x36')](_0x1af82c[_0xd91c('0x32')][_0xd91c('0x36')]));_0x5862fb[_0xd91c('0x35')]=_0x5862fb[_0xd91c('0x35')][_0xd91c('0x43')]?_0x5862fb[_0xd91c('0x35')]:_0x4730d8[_0xd91c('0x2f')];if(_0x1af82c[_0xd91c('0x32')][_0xd91c('0x3e')]){_0x5862fb[_0xd91c('0x3f')]=[{'all':!![]}];}_0x5862fb=_['merge']({},_0x5862fb,_0x1af82c[_0xd91c('0x44')]);return db['AnalyticFieldReport'][_0xd91c('0x45')](_0x5862fb)['then'](handleEntityNotFound(_0x452811,null))[_0xd91c('0x3d')](respondWithResult(_0x452811,null))['catch'](handleError(_0x452811,null));};exports[_0xd91c('0x46')]=function(_0x2194cf,_0x56ae1){return db[_0xd91c('0x3c')][_0xd91c('0x46')](_0x2194cf[_0xd91c('0x47')],{})[_0xd91c('0x3d')](respondWithResult(_0x56ae1,0xc9))[_0xd91c('0x41')](handleError(_0x56ae1,null));};exports[_0xd91c('0x48')]=function(_0x1dedaf,_0x2f7baa){return db[_0xd91c('0x3c')][_0xd91c('0x48')](_0x1dedaf[_0xd91c('0x47')],{'raw':![],'individualHooks':!![]})[_0xd91c('0x3d')](respondWithResult(_0x2f7baa,0xc9))['catch'](handleError(_0x2f7baa,null));};exports['update']=function(_0x4871db,_0x51daab){if(_0x4871db['body']['id']){delete _0x4871db[_0xd91c('0x47')]['id'];}return db[_0xd91c('0x3c')][_0xd91c('0x45')]({'where':{'id':_0x4871db[_0xd91c('0x49')]['id']}})[_0xd91c('0x3d')](handleEntityNotFound(_0x51daab,null))[_0xd91c('0x3d')](saveUpdates(_0x4871db[_0xd91c('0x47')],null))['then'](respondWithResult(_0x51daab,null))[_0xd91c('0x41')](handleError(_0x51daab,null));};exports[_0xd91c('0x4a')]=function(_0x21c1d9,_0x2ef4a4){return db['AnalyticFieldReport']['find']({'where':{'id':_0x21c1d9[_0xd91c('0x49')]['id']}})[_0xd91c('0x3d')](handleEntityNotFound(_0x2ef4a4,null))[_0xd91c('0x3d')](removeEntity(_0x2ef4a4,null))['catch'](handleError(_0x2ef4a4,null));};exports[_0xd91c('0x4b')]=function(_0x10a734,_0x302211){return db[_0xd91c('0x3c')][_0xd91c('0x4a')]({'where':{'id':_0x10a734[_0xd91c('0x32')][_0xd91c('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xd91c('0x3d')](respondWithResult(_0x302211,0xcc))['catch'](handleError(_0x302211,null));};exports[_0xd91c('0x4d')]=function(_0x20b0ed,_0x2a60ed,_0x24518b){return db[_0xd91c('0x4e')]['findOne']({'where':{'id':_0x20b0ed[_0xd91c('0x49')]['id']}})[_0xd91c('0x3d')](handleEntityNotFound(_0x2a60ed,null))[_0xd91c('0x3d')](function(_0x1c5af2){if(_0x1c5af2){return db[_0xd91c('0x4f')][_0xd91c('0x50')](function(_0x1ca515){return db[_0xd91c('0x3c')][_0xd91c('0x4a')]({'where':{'CustomReportId':_0x20b0ed[_0xd91c('0x49')]['id']},'transaction':_0x1ca515})[_0xd91c('0x3d')](function(_0x1db69a){var _0x55a5f6=_[_0xd91c('0x30')](_0x20b0ed[_0xd91c('0x47')],function(_0x476591){delete _0x476591['id'];_0x476591[_0xd91c('0x51')]=_0x20b0ed[_0xd91c('0x49')]['id'];return _0x476591;});return db[_0xd91c('0x3c')][_0xd91c('0x48')](_0x55a5f6,{'transaction':_0x1ca515});});})[_0xd91c('0x3d')](function(){return db['AnalyticFieldReport'][_0xd91c('0x40')]({'where':{'CustomReportId':_0x20b0ed[_0xd91c('0x49')]['id']}});});}})[_0xd91c('0x3d')](respondWithResult(_0x2a60ed,null))[_0xd91c('0x41')](handleError(_0x2a60ed,null));}; \ No newline at end of file +var _0xc6af=['json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','name','send','index','map','AnalyticFieldReport','fieldName','key','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0xc6af,0x137));var _0xfc6a=function(_0x4ea38e,_0xc50e8a){_0x4ea38e=_0x4ea38e-0x0;var _0x31dc07=_0xc6af[_0x4ea38e];return _0x31dc07;};'use strict';var emlformat=require(_0xfc6a('0x0'));var rimraf=require(_0xfc6a('0x1'));var zipdir=require(_0xfc6a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc6a('0x3'));var moment=require(_0xfc6a('0x4'));var BPromise=require(_0xfc6a('0x5'));var Mustache=require(_0xfc6a('0x6'));var util=require(_0xfc6a('0x7'));var path=require(_0xfc6a('0x8'));var sox=require(_0xfc6a('0x9'));var csv=require(_0xfc6a('0xa'));var ejs=require(_0xfc6a('0xb'));var fs=require('fs');var fs_extra=require(_0xfc6a('0xc'));var _=require(_0xfc6a('0xd'));var squel=require('squel');var crypto=require(_0xfc6a('0xe'));var jsforce=require(_0xfc6a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfc6a('0xa'));var querystring=require(_0xfc6a('0x10'));var Papa=require('papaparse');var Redis=require(_0xfc6a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfc6a('0x12'));var as=require(_0xfc6a('0x13'));var hardwareService=require(_0xfc6a('0x14'));var logger=require(_0xfc6a('0x15'))(_0xfc6a('0x16'));var utils=require(_0xfc6a('0x17'));var config=require(_0xfc6a('0x18'));var licenseUtil=require(_0xfc6a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a6321,_0x304cd4){_0x304cd4=_0x304cd4||0xcc;return function(_0x3156a5){if(_0x3156a5){return _0x2a6321[_0xfc6a('0x1a')](_0x304cd4);}return _0x2a6321[_0xfc6a('0x1b')](_0x304cd4)[_0xfc6a('0x1c')]();};}function respondWithResult(_0x39fb0a,_0x33461e){_0x33461e=_0x33461e||0xc8;return function(_0x566647){if(_0x566647){return _0x39fb0a[_0xfc6a('0x1b')](_0x33461e)[_0xfc6a('0x1d')](_0x566647);}};}function respondWithFilteredResult(_0x39d866,_0x50881b){return function(_0x433210){if(_0x433210){var _0x322eab=typeof _0x50881b[_0xfc6a('0x1e')]===_0xfc6a('0x1f')&&typeof _0x50881b[_0xfc6a('0x20')]===_0xfc6a('0x1f');var _0x4f1709=_0x433210[_0xfc6a('0x21')];var _0x2a7868=_0x322eab?0x0:_0x50881b['offset'];var _0x2dc33d=_0x322eab?_0x433210[_0xfc6a('0x21')]:_0x50881b['offset']+_0x50881b[_0xfc6a('0x20')];var _0x5d51cb;if(_0x2dc33d>=_0x4f1709){_0x2dc33d=_0x4f1709;_0x5d51cb=0xc8;}else{_0x5d51cb=0xce;}_0x39d866[_0xfc6a('0x1b')](_0x5d51cb);return _0x39d866[_0xfc6a('0x22')](_0xfc6a('0x23'),_0x2a7868+'-'+_0x2dc33d+'/'+_0x4f1709)[_0xfc6a('0x1d')](_0x433210);}return null;};}function patchUpdates(_0x142c8f){return function(_0x5938e5){try{jsonpatch['apply'](_0x5938e5,_0x142c8f,!![]);}catch(_0x7bee97){return BPromise['reject'](_0x7bee97);}return _0x5938e5[_0xfc6a('0x24')]();};}function saveUpdates(_0x3fcf99,_0x21cfdf){return function(_0x23119f){if(_0x23119f){return _0x23119f[_0xfc6a('0x25')](_0x3fcf99)[_0xfc6a('0x26')](function(_0x4d3c6a){return _0x4d3c6a;});}return null;};}function removeEntity(_0x3a3e70,_0x1ad5e9){return function(_0x5f4c1e){if(_0x5f4c1e){return _0x5f4c1e[_0xfc6a('0x27')]()[_0xfc6a('0x26')](function(){_0x3a3e70['status'](0xcc)[_0xfc6a('0x1c')]();});}};}function handleEntityNotFound(_0x8c8cde,_0x37d2a4){return function(_0x45537a){if(!_0x45537a){_0x8c8cde[_0xfc6a('0x1a')](0x194);}return _0x45537a;};}function handleError(_0x569392,_0x4ae030){_0x4ae030=_0x4ae030||0x1f4;return function(_0x40f8bc){logger[_0xfc6a('0x28')](_0x40f8bc['stack']);if(_0x40f8bc[_0xfc6a('0x29')]){delete _0x40f8bc[_0xfc6a('0x29')];}_0x569392[_0xfc6a('0x1b')](_0x4ae030)[_0xfc6a('0x2a')](_0x40f8bc);};}exports[_0xfc6a('0x2b')]=function(_0x141134,_0x7b7923){var _0x1b74c5={},_0x1a700f={},_0x3e0fa3={'count':0x0,'rows':[]};var _0x5bbda2=_[_0xfc6a('0x2c')](db[_0xfc6a('0x2d')]['rawAttributes'],function(_0x4852ec){return{'name':_0x4852ec[_0xfc6a('0x2e')],'type':_0x4852ec['type'][_0xfc6a('0x2f')]};});_0x1a700f['model']=_[_0xfc6a('0x2c')](_0x5bbda2,_0xfc6a('0x29'));_0x1a700f['query']=_[_0xfc6a('0x30')](_0x141134['query']);_0x1a700f[_0xfc6a('0x31')]=_['intersection'](_0x1a700f[_0xfc6a('0x32')],_0x1a700f[_0xfc6a('0x33')]);_0x1b74c5[_0xfc6a('0x34')]=_[_0xfc6a('0x35')](_0x1a700f['model'],qs[_0xfc6a('0x36')](_0x141134[_0xfc6a('0x33')][_0xfc6a('0x36')]));_0x1b74c5[_0xfc6a('0x34')]=_0x1b74c5[_0xfc6a('0x34')][_0xfc6a('0x37')]?_0x1b74c5[_0xfc6a('0x34')]:_0x1a700f[_0xfc6a('0x32')];if(!_0x141134[_0xfc6a('0x33')][_0xfc6a('0x38')](_0xfc6a('0x39'))){_0x1b74c5[_0xfc6a('0x20')]=qs[_0xfc6a('0x20')](_0x141134['query'][_0xfc6a('0x20')]);_0x1b74c5[_0xfc6a('0x1e')]=qs[_0xfc6a('0x1e')](_0x141134['query']['offset']);}_0x1b74c5[_0xfc6a('0x3a')]=qs[_0xfc6a('0x3b')](_0x141134[_0xfc6a('0x33')][_0xfc6a('0x3b')]);_0x1b74c5['where']=qs[_0xfc6a('0x31')](_['pick'](_0x141134[_0xfc6a('0x33')],_0x1a700f[_0xfc6a('0x31')]),_0x5bbda2);if(_0x141134[_0xfc6a('0x33')][_0xfc6a('0x3c')]){_0x1b74c5[_0xfc6a('0x3d')]=_[_0xfc6a('0x3e')](_0x1b74c5[_0xfc6a('0x3d')],{'$or':_['map'](_0x5bbda2,function(_0x5069d7){if(_0x5069d7[_0xfc6a('0x3f')]!==_0xfc6a('0x40')){var _0x3ae67e={};_0x3ae67e[_0x5069d7[_0xfc6a('0x29')]]={'$like':'%'+_0x141134[_0xfc6a('0x33')][_0xfc6a('0x3c')]+'%'};return _0x3ae67e;}})});}_0x1b74c5=_[_0xfc6a('0x3e')]({},_0x1b74c5,_0x141134[_0xfc6a('0x41')]);var _0x49910b={'where':_0x1b74c5[_0xfc6a('0x3d')]};return db[_0xfc6a('0x2d')][_0xfc6a('0x21')](_0x49910b)[_0xfc6a('0x26')](function(_0x1b1008){_0x3e0fa3[_0xfc6a('0x21')]=_0x1b1008;if(_0x141134[_0xfc6a('0x33')][_0xfc6a('0x42')]){_0x1b74c5[_0xfc6a('0x43')]=[{'all':!![]}];}return db[_0xfc6a('0x2d')][_0xfc6a('0x44')](_0x1b74c5);})[_0xfc6a('0x26')](function(_0x3c9225){_0x3e0fa3['rows']=_0x3c9225;return _0x3e0fa3;})[_0xfc6a('0x26')](respondWithFilteredResult(_0x7b7923,_0x1b74c5))[_0xfc6a('0x45')](handleError(_0x7b7923,null));};exports[_0xfc6a('0x46')]=function(_0x5c055d,_0x14004b){var _0x3c17e3={'raw':![],'where':{'id':_0x5c055d[_0xfc6a('0x47')]['id']}},_0x42f972={};_0x42f972[_0xfc6a('0x32')]=_[_0xfc6a('0x30')](db[_0xfc6a('0x2d')][_0xfc6a('0x48')]);_0x42f972['query']=_[_0xfc6a('0x30')](_0x5c055d[_0xfc6a('0x33')]);_0x42f972[_0xfc6a('0x31')]=_[_0xfc6a('0x35')](_0x42f972[_0xfc6a('0x32')],_0x42f972['query']);_0x3c17e3[_0xfc6a('0x34')]=_[_0xfc6a('0x35')](_0x42f972[_0xfc6a('0x32')],qs['fields'](_0x5c055d[_0xfc6a('0x33')][_0xfc6a('0x36')]));_0x3c17e3[_0xfc6a('0x34')]=_0x3c17e3[_0xfc6a('0x34')]['length']?_0x3c17e3['attributes']:_0x42f972[_0xfc6a('0x32')];if(_0x5c055d[_0xfc6a('0x33')][_0xfc6a('0x42')]){_0x3c17e3[_0xfc6a('0x43')]=[{'all':!![]}];}_0x3c17e3=_[_0xfc6a('0x3e')]({},_0x3c17e3,_0x5c055d[_0xfc6a('0x41')]);return db[_0xfc6a('0x2d')][_0xfc6a('0x49')](_0x3c17e3)['then'](handleEntityNotFound(_0x14004b,null))[_0xfc6a('0x26')](respondWithResult(_0x14004b,null))['catch'](handleError(_0x14004b,null));};exports['create']=function(_0x40da92,_0x19e293){return db[_0xfc6a('0x2d')][_0xfc6a('0x4a')](_0x40da92[_0xfc6a('0x4b')],{})['then'](respondWithResult(_0x19e293,0xc9))[_0xfc6a('0x45')](handleError(_0x19e293,null));};exports['bulkCreate']=function(_0x27d782,_0x5dfe5e){return db['AnalyticFieldReport'][_0xfc6a('0x4c')](_0x27d782[_0xfc6a('0x4b')],{'raw':![],'individualHooks':!![]})[_0xfc6a('0x26')](respondWithResult(_0x5dfe5e,0xc9))[_0xfc6a('0x45')](handleError(_0x5dfe5e,null));};exports[_0xfc6a('0x25')]=function(_0x13ce17,_0x52ab42){if(_0x13ce17['body']['id']){delete _0x13ce17[_0xfc6a('0x4b')]['id'];}return db[_0xfc6a('0x2d')]['find']({'where':{'id':_0x13ce17[_0xfc6a('0x47')]['id']}})[_0xfc6a('0x26')](handleEntityNotFound(_0x52ab42,null))[_0xfc6a('0x26')](saveUpdates(_0x13ce17['body'],null))[_0xfc6a('0x26')](respondWithResult(_0x52ab42,null))[_0xfc6a('0x45')](handleError(_0x52ab42,null));};exports[_0xfc6a('0x27')]=function(_0x159f9f,_0x3dff6a){return db[_0xfc6a('0x2d')][_0xfc6a('0x49')]({'where':{'id':_0x159f9f[_0xfc6a('0x47')]['id']}})[_0xfc6a('0x26')](handleEntityNotFound(_0x3dff6a,null))['then'](removeEntity(_0x3dff6a,null))[_0xfc6a('0x45')](handleError(_0x3dff6a,null));};exports[_0xfc6a('0x4d')]=function(_0x134a92,_0x31efcc){return db[_0xfc6a('0x2d')][_0xfc6a('0x27')]({'where':{'id':_0x134a92[_0xfc6a('0x33')][_0xfc6a('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0xfc6a('0x26')](respondWithResult(_0x31efcc,0xcc))[_0xfc6a('0x45')](handleError(_0x31efcc,null));};exports[_0xfc6a('0x4f')]=function(_0x37ae5a,_0x5a258c,_0x68b9b4){return db[_0xfc6a('0x50')][_0xfc6a('0x51')]({'where':{'id':_0x37ae5a[_0xfc6a('0x47')]['id']}})[_0xfc6a('0x26')](handleEntityNotFound(_0x5a258c,null))['then'](function(_0x1d354c){if(_0x1d354c){return db[_0xfc6a('0x52')][_0xfc6a('0x53')](function(_0x12c002){return db['AnalyticFieldReport'][_0xfc6a('0x27')]({'where':{'CustomReportId':_0x37ae5a['params']['id']},'transaction':_0x12c002})['then'](function(_0x4de021){var _0x2dad31=_[_0xfc6a('0x2c')](_0x37ae5a[_0xfc6a('0x4b')],function(_0x5c0328){delete _0x5c0328['id'];_0x5c0328[_0xfc6a('0x54')]=_0x37ae5a[_0xfc6a('0x47')]['id'];return _0x5c0328;});return db[_0xfc6a('0x2d')][_0xfc6a('0x4c')](_0x2dad31,{'transaction':_0x12c002});});})['then'](function(){return db[_0xfc6a('0x2d')]['findAll']({'where':{'CustomReportId':_0x37ae5a[_0xfc6a('0x47')]['id']}});});}})[_0xfc6a('0x26')](respondWithResult(_0x5a258c,null))[_0xfc6a('0x45')](handleError(_0x5a258c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index a509dbe..5fbb89e 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 _0xd204=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','bluebird','rimraf','./analyticFieldReport.attributes'];(function(_0x26996f,_0x295984){var _0x3ab19c=function(_0x2a86d2){while(--_0x2a86d2){_0x26996f['push'](_0x26996f['shift']());}};_0x3ab19c(++_0x295984);}(_0xd204,0x1ea));var _0x4d20=function(_0x1854ef,_0x4fe295){_0x1854ef=_0x1854ef-0x0;var _0x4cbe36=_0xd204[_0x1854ef];return _0x4cbe36;};'use strict';var _=require(_0x4d20('0x0'));var util=require(_0x4d20('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4d20('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4d20('0x3'));var config=require('../../config/environment');var attributes=require(_0x4d20('0x4'));module[_0x4d20('0x5')]=function(_0x3379bb,_0x265a10){return _0x3379bb[_0x4d20('0x6')](_0x4d20('0x7'),attributes,{'tableName':_0x4d20('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0cb=['AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','define'];(function(_0x253b7b,_0x5f4bf9){var _0xab484=function(_0x12ef6f){while(--_0x12ef6f){_0x253b7b['push'](_0x253b7b['shift']());}};_0xab484(++_0x5f4bf9);}(_0xb0cb,0x17b));var _0xbb0c=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xb0cb[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xbb0c('0x0'));var util=require(_0xbb0c('0x1'));var logger=require(_0xbb0c('0x2'))(_0xbb0c('0x3'));var moment=require(_0xbb0c('0x4'));var BPromise=require(_0xbb0c('0x5'));var rp=require(_0xbb0c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb0c('0x7'));var config=require(_0xbb0c('0x8'));var attributes=require(_0xbb0c('0x9'));module['exports']=function(_0x1a19f0,_0x49bc9f){return _0x1a19f0[_0xbb0c('0xa')](_0xbb0c('0xb'),attributes,{'tableName':_0xbb0c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 4e487a6..580cb3e 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 _0x35f0=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x35f0,0x80));var _0x035f=function(_0x27183b,_0x4f8348){_0x27183b=_0x27183b-0x0;var _0x5a5f9f=_0x35f0[_0x27183b];return _0x5a5f9f;};'use strict';var _=require(_0x035f('0x0'));var util=require('util');var moment=require(_0x035f('0x1'));var BPromise=require(_0x035f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x035f('0x3'));var db=require(_0x035f('0x4'))['db'];var utils=require(_0x035f('0x5'));var logger=require(_0x035f('0x6'))(_0x035f('0x7'));var config=require('../../config/environment');var jayson=require(_0x035f('0x8'));var client=jayson[_0x035f('0x9')][_0x035f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3320f4,_0x793abe,_0x5b1ec4){return new BPromise(function(_0x4f0890,_0x449b99){return client['request'](_0x3320f4,_0x5b1ec4)['then'](function(_0x4d8e47){logger[_0x035f('0xb')](_0x035f('0xc'),_0x793abe,_0x035f('0xd'));logger[_0x035f('0xe')](_0x035f('0xf'),_0x793abe,'request\x20sent',JSON[_0x035f('0x10')](_0x4d8e47));if(_0x4d8e47['error']){if(_0x4d8e47[_0x035f('0x11')][_0x035f('0x12')]===0x1f4){logger[_0x035f('0x11')](_0x035f('0xc'),_0x793abe,_0x4d8e47['error'][_0x035f('0x13')]);return _0x449b99(_0x4d8e47[_0x035f('0x11')][_0x035f('0x13')]);}logger[_0x035f('0x11')](_0x035f('0xc'),_0x793abe,_0x4d8e47[_0x035f('0x11')][_0x035f('0x13')]);return _0x4f0890(_0x4d8e47[_0x035f('0x11')][_0x035f('0x13')]);}else{logger['info'](_0x035f('0xc'),_0x793abe,'request\x20sent');_0x4f0890(_0x4d8e47[_0x035f('0x14')][_0x035f('0x13')]);}})[_0x035f('0x15')](function(_0x78ede1){logger[_0x035f('0x11')](_0x035f('0xc'),_0x793abe,_0x78ede1);_0x449b99(_0x78ede1);});});} \ No newline at end of file +var _0x374e=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x374e,0xba));var _0xe374=function(_0x1f2e32,_0x5eb322){_0x1f2e32=_0x1f2e32-0x0;var _0x4e0b6d=_0x374e[_0x1f2e32];return _0x4e0b6d;};'use strict';var _=require(_0xe374('0x0'));var util=require('util');var moment=require(_0xe374('0x1'));var BPromise=require(_0xe374('0x2'));var rs=require(_0xe374('0x3'));var fs=require('fs');var Redis=require(_0xe374('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe374('0x5'));var logger=require(_0xe374('0x6'))('rpc');var config=require(_0xe374('0x7'));var jayson=require(_0xe374('0x8'));var client=jayson[_0xe374('0x9')][_0xe374('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227423,_0x3b9afd,_0x39fea0){return new BPromise(function(_0x37922a,_0x4f31e3){return client[_0xe374('0xb')](_0x227423,_0x39fea0)[_0xe374('0xc')](function(_0x3da1d1){logger[_0xe374('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3b9afd,'request\x20sent');logger[_0xe374('0xe')](_0xe374('0xf'),_0x3b9afd,_0xe374('0x10'),JSON[_0xe374('0x11')](_0x3da1d1));if(_0x3da1d1[_0xe374('0x12')]){if(_0x3da1d1[_0xe374('0x12')][_0xe374('0x13')]===0x1f4){logger[_0xe374('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3b9afd,_0x3da1d1[_0xe374('0x12')]['message']);return _0x4f31e3(_0x3da1d1[_0xe374('0x12')][_0xe374('0x14')]);}logger[_0xe374('0x12')](_0xe374('0x15'),_0x3b9afd,_0x3da1d1['error'][_0xe374('0x14')]);return _0x37922a(_0x3da1d1['error'][_0xe374('0x14')]);}else{logger[_0xe374('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3b9afd,_0xe374('0x10'));_0x37922a(_0x3da1d1[_0xe374('0x16')]['message']);}})[_0xe374('0x17')](function(_0x58ddc4){logger[_0xe374('0x12')](_0xe374('0x15'),_0x3b9afd,_0x58ddc4);_0x4f31e3(_0x58ddc4);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 1791f4d..17bc258 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(_0x2b3a60,_0x146ec1){var _0xd21365=function(_0x59ad5a){while(--_0x59ad5a){_0x2b3a60['push'](_0x2b3a60['shift']());}};_0xd21365(++_0x146ec1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x1d638b,_0x52dd72){var _0x492ad9=function(_0x4ae4d7){while(--_0x4ae4d7){_0x1d638b['push'](_0x1d638b['shift']());}};_0x492ad9(++_0x52dd72);}(_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['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 c7fdc8e..7e17130 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 _0xa74f=['STRING','TEXT'];(function(_0x3d1f60,_0x166b36){var _0x4f68ec=function(_0xd8d6f0){while(--_0xd8d6f0){_0x3d1f60['push'](_0x3d1f60['shift']());}};_0x4f68ec(++_0x166b36);}(_0xa74f,0x9a));var _0xfa74=function(_0x424357,_0x9ebe3e){_0x424357=_0x424357-0x0;var _0x29c68e=_0xa74f[_0x424357];return _0x29c68e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfa74('0x0')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xfa74('0x1')]},'description':{'type':Sequelize[_0xfa74('0x0')]}}; \ No newline at end of file +var _0xede3=['exports','name','STRING','TEXT'];(function(_0xdba210,_0x17d434){var _0x5c7712=function(_0x36ad83){while(--_0x36ad83){_0xdba210['push'](_0xdba210['shift']());}};_0x5c7712(++_0x17d434);}(_0xede3,0xc0));var _0x3ede=function(_0x1f1ea6,_0x51eb08){_0x1f1ea6=_0x1f1ea6-0x0;var _0x4ead57=_0xede3[_0x1f1ea6];return _0x4ead57;};'use strict';var Sequelize=require('sequelize');module[_0x3ede('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3ede('0x1')},'table':{'type':Sequelize[_0x3ede('0x2')]},'metric':{'type':Sequelize[_0x3ede('0x3')]},'description':{'type':Sequelize[_0x3ede('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 080d1a3..4ca3d27 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 _0xdc97=['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','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x17259a,_0x44b48f){var _0x1ed9cd=function(_0x1f216a){while(--_0x1f216a){_0x17259a['push'](_0x17259a['shift']());}};_0x1ed9cd(++_0x44b48f);}(_0xdc97,0x13b));var _0x7dc9=function(_0x129b3a,_0x32828f){_0x129b3a=_0x129b3a-0x0;var _0x52ee3c=_0xdc97[_0x129b3a];return _0x52ee3c;};'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(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file +var _0x98a8=['../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Metrics','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','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(_0x6c1057,_0x1e35a6){var _0x515a94=function(_0x355b51){while(--_0x355b51){_0x6c1057['push'](_0x6c1057['shift']());}};_0x515a94(++_0x1e35a6);}(_0x98a8,0x12c));var _0x898a=function(_0xf84bc9,_0x27d951){_0xf84bc9=_0xf84bc9-0x0;var _0x55fc35=_0x98a8[_0xf84bc9];return _0x55fc35;};'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'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){var _0x32eca5=_0x274cdf[_0x898a('0x25')]({'plain':!![]});var _0x1426e3='Metrics';return db[_0x898a('0x26')]['destroy']({'where':{'type':_0x1426e3,'resourceId':_0x32eca5['id']}})['then'](function(){return _0x274cdf;});})['then'](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x420b25,_0x40b3db){return function(_0x28ae6a){if(!_0x28ae6a){_0x420b25[_0x898a('0x27')](0x194);}return _0x28ae6a;};}function handleError(_0x398e98,_0xac1fc4){_0xac1fc4=_0xac1fc4||0x1f4;return function(_0xd31922){logger['error'](_0xd31922['stack']);if(_0xd31922['name']){delete _0xd31922[_0x898a('0x28')];}_0x398e98[_0x898a('0x1a')](_0xac1fc4)[_0x898a('0x29')](_0xd31922);};}exports[_0x898a('0x2a')]=function(_0x34f447,_0x560000){var _0xe3c983={},_0xf74645={},_0x18773a={'count':0x0,'rows':[]};var _0x4287da=_[_0x898a('0x2b')](db[_0x898a('0x2c')]['rawAttributes'],function(_0x7a1eb5){return{'name':_0x7a1eb5[_0x898a('0x2d')],'type':_0x7a1eb5[_0x898a('0x2e')][_0x898a('0x2f')]};});_0xf74645[_0x898a('0x30')]=_['map'](_0x4287da,'name');_0xf74645[_0x898a('0x31')]=_[_0x898a('0x32')](_0x34f447[_0x898a('0x31')]);_0xf74645['filters']=_[_0x898a('0x33')](_0xf74645[_0x898a('0x30')],_0xf74645[_0x898a('0x31')]);_0xe3c983[_0x898a('0x34')]=_[_0x898a('0x33')](_0xf74645[_0x898a('0x30')],qs[_0x898a('0x35')](_0x34f447[_0x898a('0x31')]['fields']));_0xe3c983[_0x898a('0x34')]=_0xe3c983['attributes']['length']?_0xe3c983[_0x898a('0x34')]:_0xf74645['model'];if(!_0x34f447[_0x898a('0x31')]['hasOwnProperty'](_0x898a('0x36'))){_0xe3c983['limit']=qs[_0x898a('0x37')](_0x34f447[_0x898a('0x31')][_0x898a('0x37')]);_0xe3c983['offset']=qs['offset'](_0x34f447['query'][_0x898a('0x1e')]);}_0xe3c983[_0x898a('0x38')]=qs['sort'](_0x34f447[_0x898a('0x31')][_0x898a('0x39')]);_0xe3c983[_0x898a('0x3a')]=qs[_0x898a('0x3b')](_['pick'](_0x34f447['query'],_0xf74645[_0x898a('0x3b')]),_0x4287da);if(_0x34f447[_0x898a('0x31')]['filter']){_0xe3c983['where']=_[_0x898a('0x3c')](_0xe3c983[_0x898a('0x3a')],{'$or':_[_0x898a('0x2b')](_0x4287da,function(_0xa45405){if(_0xa45405['type']!==_0x898a('0x3d')){var _0x369c02={};_0x369c02[_0xa45405['name']]={'$like':'%'+_0x34f447['query']['filter']+'%'};return _0x369c02;}})});}_0xe3c983=_[_0x898a('0x3c')]({},_0xe3c983,_0x34f447[_0x898a('0x3e')]);var _0x35d767={'where':_0xe3c983[_0x898a('0x3a')]};return db[_0x898a('0x2c')][_0x898a('0x1d')](_0x35d767)[_0x898a('0x23')](function(_0x1432ec){_0x18773a[_0x898a('0x1d')]=_0x1432ec;if(_0x34f447[_0x898a('0x31')][_0x898a('0x3f')]){_0xe3c983[_0x898a('0x40')]=[{'all':!![]}];}return db[_0x898a('0x2c')][_0x898a('0x41')](_0xe3c983);})[_0x898a('0x23')](function(_0x4c8628){_0x18773a[_0x898a('0x42')]=_0x4c8628;return _0x18773a;})[_0x898a('0x23')](respondWithFilteredResult(_0x560000,_0xe3c983))[_0x898a('0x43')](handleError(_0x560000,null));};exports['show']=function(_0x34029e,_0x2e5451){var _0x3a8663={'raw':!![],'where':{'id':_0x34029e[_0x898a('0x44')]['id']}},_0x6ab441={};_0x6ab441[_0x898a('0x30')]=_[_0x898a('0x32')](db[_0x898a('0x2c')]['rawAttributes']);_0x6ab441[_0x898a('0x31')]=_[_0x898a('0x32')](_0x34029e[_0x898a('0x31')]);_0x6ab441[_0x898a('0x3b')]=_['intersection'](_0x6ab441[_0x898a('0x30')],_0x6ab441[_0x898a('0x31')]);_0x3a8663['attributes']=_[_0x898a('0x33')](_0x6ab441['model'],qs[_0x898a('0x35')](_0x34029e['query']['fields']));_0x3a8663[_0x898a('0x34')]=_0x3a8663['attributes'][_0x898a('0x45')]?_0x3a8663[_0x898a('0x34')]:_0x6ab441['model'];if(_0x34029e[_0x898a('0x31')][_0x898a('0x3f')]){_0x3a8663['include']=[{'all':!![]}];}_0x3a8663=_[_0x898a('0x3c')]({},_0x3a8663,_0x34029e[_0x898a('0x3e')]);return db[_0x898a('0x2c')][_0x898a('0x46')](_0x3a8663)['then'](handleEntityNotFound(_0x2e5451,null))[_0x898a('0x23')](respondWithResult(_0x2e5451,null))[_0x898a('0x43')](handleError(_0x2e5451,null));};exports['create']=function(_0x25adcc,_0x1d8c16){return db['AnalyticMetric'][_0x898a('0x47')](_0x25adcc['body'],{})[_0x898a('0x23')](function(_0x41f291){var _0x32ccb9=_0x25adcc['user'][_0x898a('0x25')]({'plain':!![]});if(!_0x32ccb9)throw new Error(_0x898a('0x48'));if(_0x32ccb9[_0x898a('0x49')]===_0x898a('0x4a')){var _0x5a8a2c=_0x41f291[_0x898a('0x25')]({'plain':!![]});var _0x529d7c=_0x898a('0x4b');return db[_0x898a('0x4c')][_0x898a('0x46')]({'where':{'name':_0x529d7c,'userProfileId':_0x32ccb9['userProfileId']},'raw':!![]})[_0x898a('0x23')](function(_0x3c4db0){if(_0x3c4db0&&_0x3c4db0[_0x898a('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x5a8a2c[_0x898a('0x28')],'resourceId':_0x5a8a2c['id'],'type':_0x3c4db0[_0x898a('0x28')],'sectionId':_0x3c4db0['id']},{})[_0x898a('0x23')](function(){return _0x41f291;});}else{return _0x41f291;}})[_0x898a('0x43')](function(_0x28b8c9){logger[_0x898a('0x4e')](_0x898a('0x4f'),_0x28b8c9);throw _0x28b8c9;});}return _0x41f291;})[_0x898a('0x23')](respondWithResult(_0x1d8c16,0xc9))[_0x898a('0x43')](handleError(_0x1d8c16,null));};exports[_0x898a('0x22')]=function(_0x2382a9,_0x5e9329){if(_0x2382a9[_0x898a('0x50')]['id']){delete _0x2382a9[_0x898a('0x50')]['id'];}return db['AnalyticMetric'][_0x898a('0x46')]({'where':{'id':_0x2382a9['params']['id']}})['then'](handleEntityNotFound(_0x5e9329,null))[_0x898a('0x23')](saveUpdates(_0x2382a9[_0x898a('0x50')],null))[_0x898a('0x23')](respondWithResult(_0x5e9329,null))['catch'](handleError(_0x5e9329,null));};exports['destroy']=function(_0x11a07a,_0x1f5e4b){return db['AnalyticMetric'][_0x898a('0x46')]({'where':{'id':_0x11a07a[_0x898a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f5e4b,null))[_0x898a('0x23')](removeEntity(_0x1f5e4b,null))[_0x898a('0x43')](handleError(_0x1f5e4b,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 07013cb..6c84d39 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 _0x6869=['rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util','../../config/logger','moment','path'];(function(_0x4f310a,_0x2a5f79){var _0x3c7876=function(_0x4fcb41){while(--_0x4fcb41){_0x4f310a['push'](_0x4f310a['shift']());}};_0x3c7876(++_0x2a5f79);}(_0x6869,0xe2));var _0x9686=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6869[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x9686('0x0'));var util=require(_0x9686('0x1'));var logger=require(_0x9686('0x2'))('api');var moment=require(_0x9686('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9686('0x4'));var rimraf=require(_0x9686('0x5'));var config=require(_0x9686('0x6'));var attributes=require(_0x9686('0x7'));module[_0x9686('0x8')]=function(_0x4a0657,_0x35591e){return _0x4a0657[_0x9686('0x9')](_0x9686('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfa0=['path','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x214ec2,_0x3a437b){var _0x18b531=function(_0x48234f){while(--_0x48234f){_0x214ec2['push'](_0x214ec2['shift']());}};_0x18b531(++_0x3a437b);}(_0xdfa0,0x69));var _0x0dfa=function(_0x2761f8,_0x54996e){_0x2761f8=_0x2761f8-0x0;var _0x33f750=_0xdfa0[_0x2761f8];return _0x33f750;};'use strict';var _=require(_0x0dfa('0x0'));var util=require('util');var logger=require(_0x0dfa('0x1'))(_0x0dfa('0x2'));var moment=require('moment');var BPromise=require(_0x0dfa('0x3'));var rp=require(_0x0dfa('0x4'));var fs=require('fs');var path=require(_0x0dfa('0x5'));var rimraf=require('rimraf');var config=require(_0x0dfa('0x6'));var attributes=require('./analyticMetric.attributes');module[_0x0dfa('0x7')]=function(_0x2efe20,_0x4830b6){return _0x2efe20[_0x0dfa('0x8')](_0x0dfa('0x9'),attributes,{'tableName':_0x0dfa('0xa'),'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 eab39ad..f434bec 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 _0x9c50=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment'];(function(_0x12b207,_0x3d4861){var _0x217e94=function(_0x4873f1){while(--_0x4873f1){_0x12b207['push'](_0x12b207['shift']());}};_0x217e94(++_0x3d4861);}(_0x9c50,0x67));var _0x09c5=function(_0x4156eb,_0x17ec35){_0x4156eb=_0x4156eb-0x0;var _0x4e6c64=_0x9c50[_0x4156eb];return _0x4e6c64;};'use strict';var _=require('lodash');var util=require(_0x09c5('0x0'));var moment=require(_0x09c5('0x1'));var BPromise=require(_0x09c5('0x2'));var rs=require(_0x09c5('0x3'));var fs=require('fs');var Redis=require(_0x09c5('0x4'));var db=require(_0x09c5('0x5'))['db'];var utils=require(_0x09c5('0x6'));var logger=require(_0x09c5('0x7'))(_0x09c5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x09c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e211e,_0x4d1f00,_0x264bbb){return new BPromise(function(_0x18f886,_0x3286b7){return client[_0x09c5('0xa')](_0x1e211e,_0x264bbb)['then'](function(_0x4fdf97){logger[_0x09c5('0xb')](_0x09c5('0xc'),_0x4d1f00,_0x09c5('0xd'));logger[_0x09c5('0xe')](_0x09c5('0xf'),_0x4d1f00,_0x09c5('0xd'),JSON['stringify'](_0x4fdf97));if(_0x4fdf97[_0x09c5('0x10')]){if(_0x4fdf97[_0x09c5('0x10')][_0x09c5('0x11')]===0x1f4){logger[_0x09c5('0x10')](_0x09c5('0xc'),_0x4d1f00,_0x4fdf97[_0x09c5('0x10')][_0x09c5('0x12')]);return _0x3286b7(_0x4fdf97[_0x09c5('0x10')][_0x09c5('0x12')]);}logger[_0x09c5('0x10')](_0x09c5('0xc'),_0x4d1f00,_0x4fdf97['error'][_0x09c5('0x12')]);return _0x18f886(_0x4fdf97['error']['message']);}else{logger['info'](_0x09c5('0xc'),_0x4d1f00,_0x09c5('0xd'));_0x18f886(_0x4fdf97[_0x09c5('0x13')][_0x09c5('0x12')]);}})[_0x09c5('0x14')](function(_0x1fa006){logger['error'](_0x09c5('0xc'),_0x4d1f00,_0x1fa006);_0x3286b7(_0x1fa006);});});} \ No newline at end of file +var _0xff84=['rpc','../../config/environment','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x26d720,_0x25c8eb){var _0x37fcc1=function(_0x40b59e){while(--_0x40b59e){_0x26d720['push'](_0x26d720['shift']());}};_0x37fcc1(++_0x25c8eb);}(_0xff84,0x120));var _0x4ff8=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xff84[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x4ff8('0x0'));var moment=require(_0x4ff8('0x1'));var BPromise=require(_0x4ff8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ff8('0x3'));var db=require(_0x4ff8('0x4'))['db'];var utils=require(_0x4ff8('0x5'));var logger=require('../../config/logger')(_0x4ff8('0x6'));var config=require(_0x4ff8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4ff8('0x8')][_0x4ff8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cabe5,_0x2effc6,_0x811f5f){return new BPromise(function(_0x11a6db,_0x4bb5ef){return client['request'](_0x5cabe5,_0x811f5f)[_0x4ff8('0xa')](function(_0x3037c7){logger[_0x4ff8('0xb')](_0x4ff8('0xc'),_0x2effc6,_0x4ff8('0xd'));logger['debug'](_0x4ff8('0xe'),_0x2effc6,'request\x20sent',JSON[_0x4ff8('0xf')](_0x3037c7));if(_0x3037c7['error']){if(_0x3037c7[_0x4ff8('0x10')][_0x4ff8('0x11')]===0x1f4){logger[_0x4ff8('0x10')](_0x4ff8('0xc'),_0x2effc6,_0x3037c7['error']['message']);return _0x4bb5ef(_0x3037c7[_0x4ff8('0x10')][_0x4ff8('0x12')]);}logger[_0x4ff8('0x10')](_0x4ff8('0xc'),_0x2effc6,_0x3037c7[_0x4ff8('0x10')][_0x4ff8('0x12')]);return _0x11a6db(_0x3037c7[_0x4ff8('0x10')]['message']);}else{logger[_0x4ff8('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x2effc6,_0x4ff8('0xd'));_0x11a6db(_0x3037c7[_0x4ff8('0x13')]['message']);}})[_0x4ff8('0x14')](function(_0x2843b3){logger[_0x4ff8('0x10')](_0x4ff8('0xc'),_0x2effc6,_0x2843b3);_0x4bb5ef(_0x2843b3);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 4620235..7ff0441 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 _0x5395=['index','/:id','post','create','put','destroy','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x7457fe,_0x564a5e){var _0x57a6e4=function(_0x566577){while(--_0x566577){_0x7457fe['push'](_0x7457fe['shift']());}};_0x57a6e4(++_0x564a5e);}(_0x5395,0x150));var _0x5539=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5395[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x5539('0x0'));var util=require('util');var path=require(_0x5539('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5539('0x2')]();var fs_extra=require(_0x5539('0x3'));var auth=require(_0x5539('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5539('0x5'));var controller=require(_0x5539('0x6'));router[_0x5539('0x7')]('/',auth[_0x5539('0x8')](),controller[_0x5539('0x9')]);router[_0x5539('0x7')](_0x5539('0xa'),auth[_0x5539('0x8')](),controller['show']);router[_0x5539('0xb')]('/',auth[_0x5539('0x8')](),controller[_0x5539('0xc')]);router[_0x5539('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x5539('0xa'),auth['isAuthenticated'](),controller[_0x5539('0xe')]);module['exports']=router; \ No newline at end of file +var _0x37a7=['util','Router','fs-extra','./analyticMetric.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer'];(function(_0x2de753,_0x4a544d){var _0x8e70a5=function(_0x498455){while(--_0x498455){_0x2de753['push'](_0x2de753['shift']());}};_0x8e70a5(++_0x4a544d);}(_0x37a7,0x6f));var _0x737a=function(_0x4cf382,_0x1533d4){_0x4cf382=_0x4cf382-0x0;var _0x1fed91=_0x37a7[_0x4cf382];return _0x1fed91;};'use strict';var multer=require(_0x737a('0x0'));var util=require(_0x737a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x737a('0x2')]();var fs_extra=require(_0x737a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x737a('0x4'));router[_0x737a('0x5')]('/',auth[_0x737a('0x6')](),controller[_0x737a('0x7')]);router[_0x737a('0x5')]('/:id',auth[_0x737a('0x6')](),controller[_0x737a('0x8')]);router[_0x737a('0x9')]('/',auth[_0x737a('0x6')](),controller['create']);router[_0x737a('0xa')](_0x737a('0xb'),auth['isAuthenticated'](),controller[_0x737a('0xc')]);router[_0x737a('0xd')](_0x737a('0xb'),auth[_0x737a('0x6')](),controller[_0x737a('0xe')]);module[_0x737a('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 866825c..8a6dd55 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 _0xa690=['sequelize','TEXT'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa690,0xc4));var _0x0a69=function(_0x3c858f,_0x235201){_0x3c858f=_0x3c858f-0x0;var _0x198090=_0xa690[_0x3c858f];return _0x198090;};'use strict';var Sequelize=require(_0x0a69('0x0'));module['exports']={'tree':{'type':Sequelize[_0x0a69('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xdedc=['TEXT','sequelize'];(function(_0x2dcefe,_0x1b804a){var _0x47c352=function(_0x1a4fdf){while(--_0x1a4fdf){_0x2dcefe['push'](_0x2dcefe['shift']());}};_0x47c352(++_0x1b804a);}(_0xdedc,0x151));var _0xcded=function(_0x4b078b,_0x53030c){_0x4b078b=_0x4b078b-0x0;var _0x4bc65c=_0xdedc[_0x4b078b];return _0x4bc65c;};'use strict';var Sequelize=require(_0xcded('0x0'));module['exports']={'tree':{'type':Sequelize[_0xcded('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index cc54aad..14476c5 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 _0xa6dc=['params','length','options','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','show'];(function(_0x4f5eb1,_0x3ababf){var _0x14bcb1=function(_0x105091){while(--_0x105091){_0x4f5eb1['push'](_0x4f5eb1['shift']());}};_0x14bcb1(++_0x3ababf);}(_0xa6dc,0x11e));var _0xca6d=function(_0x371bd7,_0x27a8c7){_0x371bd7=_0x371bd7-0x0;var _0x54b744=_0xa6dc[_0x371bd7];return _0x54b744;};'use strict';var emlformat=require(_0xca6d('0x0'));var rimraf=require(_0xca6d('0x1'));var zipdir=require(_0xca6d('0x2'));var jsonpatch=require(_0xca6d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xca6d('0x4'));var path=require(_0xca6d('0x5'));var sox=require(_0xca6d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca6d('0x7'));var _=require(_0xca6d('0x8'));var squel=require('squel');var crypto=require(_0xca6d('0x9'));var jsforce=require(_0xca6d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xca6d('0xb'));var querystring=require(_0xca6d('0xc'));var Papa=require(_0xca6d('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xca6d('0xe'));var as=require(_0xca6d('0xf'));var hardwareService=require(_0xca6d('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xca6d('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xca6d('0x12'));var db=require(_0xca6d('0x13'))['db'];function respondWithStatusCode(_0x314b98,_0x2224ca){_0x2224ca=_0x2224ca||0xcc;return function(_0x41c433){if(_0x41c433){return _0x314b98[_0xca6d('0x14')](_0x2224ca);}return _0x314b98['status'](_0x2224ca)[_0xca6d('0x15')]();};}function respondWithResult(_0x3b2063,_0x2f9bf5){_0x2f9bf5=_0x2f9bf5||0xc8;return function(_0x298df0){if(_0x298df0){return _0x3b2063[_0xca6d('0x16')](_0x2f9bf5)[_0xca6d('0x17')](_0x298df0);}};}function respondWithFilteredResult(_0x533f72,_0x5464ab){return function(_0x3baab7){if(_0x3baab7){var _0x16f54a=typeof _0x5464ab[_0xca6d('0x18')]==='undefined'&&typeof _0x5464ab[_0xca6d('0x19')]===_0xca6d('0x1a');var _0x172de0=_0x3baab7['count'];var _0x540422=_0x16f54a?0x0:_0x5464ab[_0xca6d('0x18')];var _0x35b91f=_0x16f54a?_0x3baab7[_0xca6d('0x1b')]:_0x5464ab[_0xca6d('0x18')]+_0x5464ab[_0xca6d('0x19')];var _0x1e9aeb;if(_0x35b91f>=_0x172de0){_0x35b91f=_0x172de0;_0x1e9aeb=0xc8;}else{_0x1e9aeb=0xce;}_0x533f72[_0xca6d('0x16')](_0x1e9aeb);return _0x533f72['set'](_0xca6d('0x1c'),_0x540422+'-'+_0x35b91f+'/'+_0x172de0)[_0xca6d('0x17')](_0x3baab7);}return null;};}function patchUpdates(_0x1b0f7e){return function(_0x32cf01){try{jsonpatch[_0xca6d('0x1d')](_0x32cf01,_0x1b0f7e,!![]);}catch(_0x1f7c08){return BPromise[_0xca6d('0x1e')](_0x1f7c08);}return _0x32cf01[_0xca6d('0x1f')]();};}function saveUpdates(_0x485280,_0x1ecabc){return function(_0x5bdf90){if(_0x5bdf90){return _0x5bdf90[_0xca6d('0x20')](_0x485280)[_0xca6d('0x21')](function(_0x2e0577){return _0x2e0577;});}return null;};}function removeEntity(_0x15c980,_0xb199de){return function(_0x163f31){if(_0x163f31){return _0x163f31['destroy']()[_0xca6d('0x21')](function(){_0x15c980[_0xca6d('0x16')](0xcc)[_0xca6d('0x15')]();});}};}function handleEntityNotFound(_0x499aa7,_0x5acb38){return function(_0x4d1be7){if(!_0x4d1be7){_0x499aa7[_0xca6d('0x14')](0x194);}return _0x4d1be7;};}function handleError(_0x1b6f66,_0x3b91b0){_0x3b91b0=_0x3b91b0||0x1f4;return function(_0x4cda46){logger[_0xca6d('0x22')](_0x4cda46[_0xca6d('0x23')]);if(_0x4cda46[_0xca6d('0x24')]){delete _0x4cda46['name'];}_0x1b6f66[_0xca6d('0x16')](_0x3b91b0)[_0xca6d('0x25')](_0x4cda46);};}exports[_0xca6d('0x26')]=function(_0x506689,_0x225c9d){var _0x24265c={},_0x1a3f09={},_0x3ef101={'count':0x0,'rows':[]};var _0x5d0391=_[_0xca6d('0x27')](db[_0xca6d('0x28')][_0xca6d('0x29')],function(_0x3fef4f){return{'name':_0x3fef4f[_0xca6d('0x2a')],'type':_0x3fef4f['type'][_0xca6d('0x2b')]};});_0x1a3f09[_0xca6d('0x2c')]=_[_0xca6d('0x27')](_0x5d0391,'name');_0x1a3f09[_0xca6d('0x2d')]=_[_0xca6d('0x2e')](_0x506689['query']);_0x1a3f09[_0xca6d('0x2f')]=_[_0xca6d('0x30')](_0x1a3f09[_0xca6d('0x2c')],_0x1a3f09['query']);_0x24265c[_0xca6d('0x31')]=_[_0xca6d('0x30')](_0x1a3f09[_0xca6d('0x2c')],qs[_0xca6d('0x32')](_0x506689[_0xca6d('0x2d')][_0xca6d('0x32')]));_0x24265c[_0xca6d('0x31')]=_0x24265c[_0xca6d('0x31')]['length']?_0x24265c['attributes']:_0x1a3f09[_0xca6d('0x2c')];if(!_0x506689['query'][_0xca6d('0x33')]('nolimit')){_0x24265c['limit']=qs[_0xca6d('0x19')](_0x506689['query'][_0xca6d('0x19')]);_0x24265c[_0xca6d('0x18')]=qs['offset'](_0x506689[_0xca6d('0x2d')][_0xca6d('0x18')]);}_0x24265c[_0xca6d('0x34')]=qs['sort'](_0x506689[_0xca6d('0x2d')][_0xca6d('0x35')]);_0x24265c[_0xca6d('0x36')]=qs[_0xca6d('0x2f')](_[_0xca6d('0x37')](_0x506689[_0xca6d('0x2d')],_0x1a3f09[_0xca6d('0x2f')]),_0x5d0391);if(_0x506689['query']['filter']){_0x24265c['where']=_[_0xca6d('0x38')](_0x24265c[_0xca6d('0x36')],{'$or':_[_0xca6d('0x27')](_0x5d0391,function(_0x4b447b){if(_0x4b447b[_0xca6d('0x39')]!==_0xca6d('0x3a')){var _0x54208b={};_0x54208b[_0x4b447b[_0xca6d('0x24')]]={'$like':'%'+_0x506689[_0xca6d('0x2d')][_0xca6d('0x3b')]+'%'};return _0x54208b;}})});}_0x24265c=_[_0xca6d('0x38')]({},_0x24265c,_0x506689['options']);var _0x22e335={'where':_0x24265c[_0xca6d('0x36')]};return db[_0xca6d('0x28')]['count'](_0x22e335)['then'](function(_0x12ab55){_0x3ef101['count']=_0x12ab55;if(_0x506689[_0xca6d('0x2d')][_0xca6d('0x3c')]){_0x24265c[_0xca6d('0x3d')]=[{'all':!![]}];}return db[_0xca6d('0x28')][_0xca6d('0x3e')](_0x24265c);})['then'](function(_0x50028a){_0x3ef101['rows']=_0x50028a;return _0x3ef101;})[_0xca6d('0x21')](respondWithFilteredResult(_0x225c9d,_0x24265c))['catch'](handleError(_0x225c9d,null));};exports[_0xca6d('0x3f')]=function(_0x1c888c,_0x23eb75){var _0x5eddf3={'raw':!![],'where':{'id':_0x1c888c[_0xca6d('0x40')]['id']}},_0x192f24={};_0x192f24['model']=_[_0xca6d('0x2e')](db[_0xca6d('0x28')][_0xca6d('0x29')]);_0x192f24[_0xca6d('0x2d')]=_[_0xca6d('0x2e')](_0x1c888c[_0xca6d('0x2d')]);_0x192f24[_0xca6d('0x2f')]=_[_0xca6d('0x30')](_0x192f24[_0xca6d('0x2c')],_0x192f24['query']);_0x5eddf3[_0xca6d('0x31')]=_['intersection'](_0x192f24[_0xca6d('0x2c')],qs[_0xca6d('0x32')](_0x1c888c['query'][_0xca6d('0x32')]));_0x5eddf3[_0xca6d('0x31')]=_0x5eddf3['attributes'][_0xca6d('0x41')]?_0x5eddf3[_0xca6d('0x31')]:_0x192f24[_0xca6d('0x2c')];if(_0x1c888c[_0xca6d('0x2d')][_0xca6d('0x3c')]){_0x5eddf3['include']=[{'all':!![]}];}_0x5eddf3=_['merge']({},_0x5eddf3,_0x1c888c[_0xca6d('0x42')]);return db[_0xca6d('0x28')][_0xca6d('0x43')](_0x5eddf3)['then'](handleEntityNotFound(_0x23eb75,null))[_0xca6d('0x21')](respondWithResult(_0x23eb75,null))['catch'](handleError(_0x23eb75,null));};exports['create']=function(_0x4eba59,_0x41e0d9){return db[_0xca6d('0x28')]['create'](_0x4eba59[_0xca6d('0x44')],{})['then'](respondWithResult(_0x41e0d9,0xc9))['catch'](handleError(_0x41e0d9,null));};exports[_0xca6d('0x20')]=function(_0x2df1eb,_0x34cf4b){if(_0x2df1eb[_0xca6d('0x44')]['id']){delete _0x2df1eb[_0xca6d('0x44')]['id'];}return db[_0xca6d('0x28')]['find']({'where':{'id':_0x2df1eb[_0xca6d('0x40')]['id']}})['then'](handleEntityNotFound(_0x34cf4b,null))[_0xca6d('0x21')](saveUpdates(_0x2df1eb[_0xca6d('0x44')],null))[_0xca6d('0x21')](respondWithResult(_0x34cf4b,null))[_0xca6d('0x45')](handleError(_0x34cf4b,null));};exports['destroy']=function(_0x4656a5,_0xc4658){return db['AnalyticTreeReport'][_0xca6d('0x43')]({'where':{'id':_0x4656a5[_0xca6d('0x40')]['id']}})[_0xca6d('0x21')](handleEntityNotFound(_0xc4658,null))[_0xca6d('0x21')](removeEntity(_0xc4658,null))[_0xca6d('0x45')](handleError(_0xc4658,null));}; \ No newline at end of file +var _0x610c=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','json','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','AnalyticTreeReport','findAll','rows','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x610c,0x1b4));var _0xc610=function(_0x31281a,_0x10040e){_0x31281a=_0x31281a-0x0;var _0x23aa3f=_0x610c[_0x31281a];return _0x23aa3f;};'use strict';var emlformat=require(_0xc610('0x0'));var rimraf=require(_0xc610('0x1'));var zipdir=require(_0xc610('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc610('0x3'));var moment=require(_0xc610('0x4'));var BPromise=require(_0xc610('0x5'));var Mustache=require(_0xc610('0x6'));var util=require(_0xc610('0x7'));var path=require(_0xc610('0x8'));var sox=require(_0xc610('0x9'));var csv=require('to-csv');var ejs=require(_0xc610('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc610('0xb'));var squel=require(_0xc610('0xc'));var crypto=require(_0xc610('0xd'));var jsforce=require(_0xc610('0xe'));var deskjs=require(_0xc610('0xf'));var toCsv=require(_0xc610('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc610('0x11'));var authService=require(_0xc610('0x12'));var qs=require(_0xc610('0x13'));var as=require(_0xc610('0x14'));var hardwareService=require(_0xc610('0x15'));var logger=require('../../config/logger')(_0xc610('0x16'));var utils=require(_0xc610('0x17'));var config=require(_0xc610('0x18'));var licenseUtil=require(_0xc610('0x19'));var db=require(_0xc610('0x1a'))['db'];function respondWithStatusCode(_0x88bac0,_0x26f697){_0x26f697=_0x26f697||0xcc;return function(_0x449b69){if(_0x449b69){return _0x88bac0[_0xc610('0x1b')](_0x26f697);}return _0x88bac0[_0xc610('0x1c')](_0x26f697)[_0xc610('0x1d')]();};}function respondWithResult(_0x2b4070,_0x28ef86){_0x28ef86=_0x28ef86||0xc8;return function(_0x494c1c){if(_0x494c1c){return _0x2b4070[_0xc610('0x1c')](_0x28ef86)['json'](_0x494c1c);}};}function respondWithFilteredResult(_0xa1eefc,_0x178373){return function(_0x3d9d17){if(_0x3d9d17){var _0x1432ef=typeof _0x178373['offset']===_0xc610('0x1e')&&typeof _0x178373[_0xc610('0x1f')]===_0xc610('0x1e');var _0x3441de=_0x3d9d17[_0xc610('0x20')];var _0x2caa07=_0x1432ef?0x0:_0x178373[_0xc610('0x21')];var _0x139e16=_0x1432ef?_0x3d9d17[_0xc610('0x20')]:_0x178373[_0xc610('0x21')]+_0x178373['limit'];var _0x114dab;if(_0x139e16>=_0x3441de){_0x139e16=_0x3441de;_0x114dab=0xc8;}else{_0x114dab=0xce;}_0xa1eefc[_0xc610('0x1c')](_0x114dab);return _0xa1eefc['set']('Content-Range',_0x2caa07+'-'+_0x139e16+'/'+_0x3441de)[_0xc610('0x22')](_0x3d9d17);}return null;};}function patchUpdates(_0x171e79){return function(_0x376d8f){try{jsonpatch[_0xc610('0x23')](_0x376d8f,_0x171e79,!![]);}catch(_0x2b2f4e){return BPromise[_0xc610('0x24')](_0x2b2f4e);}return _0x376d8f[_0xc610('0x25')]();};}function saveUpdates(_0x5986b8,_0x55a19f){return function(_0x436826){if(_0x436826){return _0x436826[_0xc610('0x26')](_0x5986b8)[_0xc610('0x27')](function(_0x59f3fb){return _0x59f3fb;});}return null;};}function removeEntity(_0x1a9aa4,_0x4e2180){return function(_0x4d2471){if(_0x4d2471){return _0x4d2471[_0xc610('0x28')]()[_0xc610('0x27')](function(){_0x1a9aa4[_0xc610('0x1c')](0xcc)[_0xc610('0x1d')]();});}};}function handleEntityNotFound(_0x4ef396,_0x55a7fd){return function(_0x3e202e){if(!_0x3e202e){_0x4ef396[_0xc610('0x1b')](0x194);}return _0x3e202e;};}function handleError(_0x3ad415,_0x472403){_0x472403=_0x472403||0x1f4;return function(_0x1dd4a9){logger['error'](_0x1dd4a9[_0xc610('0x29')]);if(_0x1dd4a9[_0xc610('0x2a')]){delete _0x1dd4a9[_0xc610('0x2a')];}_0x3ad415[_0xc610('0x1c')](_0x472403)[_0xc610('0x2b')](_0x1dd4a9);};}exports[_0xc610('0x2c')]=function(_0x285839,_0x225ffd){var _0x3353de={},_0x311cdb={},_0x1d70e3={'count':0x0,'rows':[]};var _0x3dde9f=_['map'](db['AnalyticTreeReport'][_0xc610('0x2d')],function(_0x23ad48){return{'name':_0x23ad48[_0xc610('0x2e')],'type':_0x23ad48['type'][_0xc610('0x2f')]};});_0x311cdb[_0xc610('0x30')]=_[_0xc610('0x31')](_0x3dde9f,_0xc610('0x2a'));_0x311cdb[_0xc610('0x32')]=_[_0xc610('0x33')](_0x285839[_0xc610('0x32')]);_0x311cdb['filters']=_['intersection'](_0x311cdb['model'],_0x311cdb[_0xc610('0x32')]);_0x3353de[_0xc610('0x34')]=_[_0xc610('0x35')](_0x311cdb[_0xc610('0x30')],qs[_0xc610('0x36')](_0x285839[_0xc610('0x32')][_0xc610('0x36')]));_0x3353de[_0xc610('0x34')]=_0x3353de[_0xc610('0x34')][_0xc610('0x37')]?_0x3353de[_0xc610('0x34')]:_0x311cdb[_0xc610('0x30')];if(!_0x285839['query']['hasOwnProperty'](_0xc610('0x38'))){_0x3353de[_0xc610('0x1f')]=qs[_0xc610('0x1f')](_0x285839['query'][_0xc610('0x1f')]);_0x3353de['offset']=qs[_0xc610('0x21')](_0x285839[_0xc610('0x32')]['offset']);}_0x3353de['order']=qs[_0xc610('0x39')](_0x285839[_0xc610('0x32')][_0xc610('0x39')]);_0x3353de[_0xc610('0x3a')]=qs[_0xc610('0x3b')](_['pick'](_0x285839['query'],_0x311cdb[_0xc610('0x3b')]),_0x3dde9f);if(_0x285839[_0xc610('0x32')][_0xc610('0x3c')]){_0x3353de[_0xc610('0x3a')]=_[_0xc610('0x3d')](_0x3353de['where'],{'$or':_[_0xc610('0x31')](_0x3dde9f,function(_0x35fa6c){if(_0x35fa6c[_0xc610('0x3e')]!==_0xc610('0x3f')){var _0x34e365={};_0x34e365[_0x35fa6c[_0xc610('0x2a')]]={'$like':'%'+_0x285839[_0xc610('0x32')]['filter']+'%'};return _0x34e365;}})});}_0x3353de=_[_0xc610('0x3d')]({},_0x3353de,_0x285839['options']);var _0x56e4ac={'where':_0x3353de[_0xc610('0x3a')]};return db['AnalyticTreeReport'][_0xc610('0x20')](_0x56e4ac)[_0xc610('0x27')](function(_0x1e1fd7){_0x1d70e3[_0xc610('0x20')]=_0x1e1fd7;if(_0x285839[_0xc610('0x32')][_0xc610('0x40')]){_0x3353de[_0xc610('0x41')]=[{'all':!![]}];}return db[_0xc610('0x42')][_0xc610('0x43')](_0x3353de);})['then'](function(_0x30f7f4){_0x1d70e3[_0xc610('0x44')]=_0x30f7f4;return _0x1d70e3;})['then'](respondWithFilteredResult(_0x225ffd,_0x3353de))['catch'](handleError(_0x225ffd,null));};exports[_0xc610('0x45')]=function(_0x4c1717,_0x5e476e){var _0x2aad46={'raw':!![],'where':{'id':_0x4c1717[_0xc610('0x46')]['id']}},_0x4bbe4f={};_0x4bbe4f[_0xc610('0x30')]=_[_0xc610('0x33')](db['AnalyticTreeReport']['rawAttributes']);_0x4bbe4f[_0xc610('0x32')]=_[_0xc610('0x33')](_0x4c1717[_0xc610('0x32')]);_0x4bbe4f[_0xc610('0x3b')]=_[_0xc610('0x35')](_0x4bbe4f['model'],_0x4bbe4f['query']);_0x2aad46[_0xc610('0x34')]=_[_0xc610('0x35')](_0x4bbe4f[_0xc610('0x30')],qs[_0xc610('0x36')](_0x4c1717[_0xc610('0x32')][_0xc610('0x36')]));_0x2aad46[_0xc610('0x34')]=_0x2aad46[_0xc610('0x34')][_0xc610('0x37')]?_0x2aad46[_0xc610('0x34')]:_0x4bbe4f[_0xc610('0x30')];if(_0x4c1717['query'][_0xc610('0x40')]){_0x2aad46[_0xc610('0x41')]=[{'all':!![]}];}_0x2aad46=_[_0xc610('0x3d')]({},_0x2aad46,_0x4c1717[_0xc610('0x47')]);return db[_0xc610('0x42')][_0xc610('0x48')](_0x2aad46)[_0xc610('0x27')](handleEntityNotFound(_0x5e476e,null))['then'](respondWithResult(_0x5e476e,null))[_0xc610('0x49')](handleError(_0x5e476e,null));};exports[_0xc610('0x4a')]=function(_0x4c1135,_0x455f70){return db[_0xc610('0x42')][_0xc610('0x4a')](_0x4c1135[_0xc610('0x4b')],{})[_0xc610('0x27')](respondWithResult(_0x455f70,0xc9))[_0xc610('0x49')](handleError(_0x455f70,null));};exports[_0xc610('0x26')]=function(_0x47b94a,_0x42b85a){if(_0x47b94a[_0xc610('0x4b')]['id']){delete _0x47b94a[_0xc610('0x4b')]['id'];}return db[_0xc610('0x42')]['find']({'where':{'id':_0x47b94a[_0xc610('0x46')]['id']}})['then'](handleEntityNotFound(_0x42b85a,null))[_0xc610('0x27')](saveUpdates(_0x47b94a[_0xc610('0x4b')],null))['then'](respondWithResult(_0x42b85a,null))[_0xc610('0x49')](handleError(_0x42b85a,null));};exports[_0xc610('0x28')]=function(_0x10c1bb,_0x48ff77){return db[_0xc610('0x42')][_0xc610('0x48')]({'where':{'id':_0x10c1bb[_0xc610('0x46')]['id']}})[_0xc610('0x27')](handleEntityNotFound(_0x48ff77,null))[_0xc610('0x27')](removeEntity(_0x48ff77,null))[_0xc610('0x49')](handleError(_0x48ff77,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 59601ba..e187928 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 _0xb586=['define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x42cca6,_0x5b96e0){var _0x1c4d12=function(_0xf0f7ba){while(--_0xf0f7ba){_0x42cca6['push'](_0x42cca6['shift']());}};_0x1c4d12(++_0x5b96e0);}(_0xb586,0x8a));var _0x6b58=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0xb586[_0x5bf420];return _0x1c5255;};'use strict';var _=require(_0x6b58('0x0'));var util=require(_0x6b58('0x1'));var logger=require(_0x6b58('0x2'))(_0x6b58('0x3'));var moment=require(_0x6b58('0x4'));var BPromise=require(_0x6b58('0x5'));var rp=require(_0x6b58('0x6'));var fs=require('fs');var path=require(_0x6b58('0x7'));var rimraf=require(_0x6b58('0x8'));var config=require(_0x6b58('0x9'));var attributes=require(_0x6b58('0xa'));module[_0x6b58('0xb')]=function(_0x5adeec,_0x2f2a0b){return _0x5adeec[_0x6b58('0xc')](_0x6b58('0xd'),attributes,{'tableName':_0x6b58('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b9=['AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define'];(function(_0xd250ec,_0x446153){var _0x108b01=function(_0x3ce68f){while(--_0x3ce68f){_0xd250ec['push'](_0xd250ec['shift']());}};_0x108b01(++_0x446153);}(_0xd8b9,0x6a));var _0x9d8b=function(_0x25b4b7,_0x315052){_0x25b4b7=_0x25b4b7-0x0;var _0x5edf88=_0xd8b9[_0x25b4b7];return _0x5edf88;};'use strict';var _=require(_0x9d8b('0x0'));var util=require('util');var logger=require(_0x9d8b('0x1'))(_0x9d8b('0x2'));var moment=require(_0x9d8b('0x3'));var BPromise=require(_0x9d8b('0x4'));var rp=require(_0x9d8b('0x5'));var fs=require('fs');var path=require(_0x9d8b('0x6'));var rimraf=require(_0x9d8b('0x7'));var config=require(_0x9d8b('0x8'));var attributes=require(_0x9d8b('0x9'));module['exports']=function(_0x21b3fd,_0x4813ab){return _0x21b3fd[_0x9d8b('0xa')](_0x9d8b('0xb'),attributes,{'tableName':_0x9d8b('0xc'),'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 ec9d8b5..edab94f 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x22b47c,_0x5568b5){var _0x29d752=function(_0x443a64){while(--_0x443a64){_0x22b47c['push'](_0x22b47c['shift']());}};_0x29d752(++_0x5568b5);}(_0xdb28,0x106));var _0x8db2=function(_0x4be889,_0x191f81){_0x4be889=_0x4be889-0x0;var _0x3d7067=_0xdb28[_0x4be889];return _0x3d7067;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x5516a1,_0x215ca4){var _0x4a957b=function(_0x39b0e6){while(--_0x39b0e6){_0x5516a1['push'](_0x5516a1['shift']());}};_0x4a957b(++_0x215ca4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 09ee15a..7a0ffdf 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 _0xba99=['update','delete','/:id','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x57a51c,_0x55bcea){var _0x573a22=function(_0x17e475){while(--_0x17e475){_0x57a51c['push'](_0x57a51c['shift']());}};_0x573a22(++_0x55bcea);}(_0xba99,0x1cf));var _0x9ba9=function(_0x23a477,_0x36bd86){_0x23a477=_0x23a477-0x0;var _0x1a6fb2=_0xba99[_0x23a477];return _0x1a6fb2;};'use strict';var multer=require(_0x9ba9('0x0'));var util=require('util');var path=require(_0x9ba9('0x1'));var timeout=require(_0x9ba9('0x2'));var express=require(_0x9ba9('0x3'));var router=express[_0x9ba9('0x4')]();var fs_extra=require(_0x9ba9('0x5'));var auth=require(_0x9ba9('0x6'));var interaction=require(_0x9ba9('0x7'));var config=require(_0x9ba9('0x8'));var controller=require(_0x9ba9('0x9'));router[_0x9ba9('0xa')]('/',auth[_0x9ba9('0xb')](),controller[_0x9ba9('0xc')]);router[_0x9ba9('0xa')]('/:id',auth[_0x9ba9('0xb')](),controller[_0x9ba9('0xd')]);router[_0x9ba9('0xe')]('/',auth[_0x9ba9('0xb')](),controller[_0x9ba9('0xf')]);router[_0x9ba9('0x10')]('/:id',auth[_0x9ba9('0xb')](),controller[_0x9ba9('0x11')]);router[_0x9ba9('0x12')](_0x9ba9('0x13'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc03d=['/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get'];(function(_0x3fdf10,_0x420bb1){var _0x3acf07=function(_0x7dd2ea){while(--_0x7dd2ea){_0x3fdf10['push'](_0x3fdf10['shift']());}};_0x3acf07(++_0x420bb1);}(_0xc03d,0xef));var _0xdc03=function(_0x3d76e8,_0x1f965d){_0x3d76e8=_0x3d76e8-0x0;var _0x198af2=_0xc03d[_0x3d76e8];return _0x198af2;};'use strict';var multer=require(_0xdc03('0x0'));var util=require(_0xdc03('0x1'));var path=require(_0xdc03('0x2'));var timeout=require(_0xdc03('0x3'));var express=require(_0xdc03('0x4'));var router=express[_0xdc03('0x5')]();var fs_extra=require(_0xdc03('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdc03('0x7'));var config=require(_0xdc03('0x8'));var controller=require(_0xdc03('0x9'));router['get']('/',auth[_0xdc03('0xa')](),controller[_0xdc03('0xb')]);router[_0xdc03('0xc')](_0xdc03('0xd'),auth[_0xdc03('0xa')](),controller[_0xdc03('0xe')]);router[_0xdc03('0xf')]('/',auth[_0xdc03('0xa')](),controller[_0xdc03('0x10')]);router[_0xdc03('0x11')](_0xdc03('0xd'),auth[_0xdc03('0xa')](),controller[_0xdc03('0x12')]);router[_0xdc03('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xdc03('0x14')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index b696283..5920897 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 _0x86dd=['exports','STRING'];(function(_0x168900,_0x3a06f2){var _0x3f3845=function(_0x33164b){while(--_0x33164b){_0x168900['push'](_0x168900['shift']());}};_0x3f3845(++_0x3a06f2);}(_0x86dd,0x1ee));var _0xd86d=function(_0x11a0b1,_0x12a2f9){_0x11a0b1=_0x11a0b1-0x0;var _0x5ac291=_0x86dd[_0x11a0b1];return _0x5ac291;};'use strict';var Sequelize=require('sequelize');module[_0xd86d('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xd86d('0x1')]},'type':{'type':Sequelize[_0xd86d('0x1')]}}; \ No newline at end of file +var _0x2d17=['STRING','sequelize','exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x2d17,0x17e));var _0x72d1=function(_0x5bcae4,_0x5f56d0){_0x5bcae4=_0x5bcae4-0x0;var _0x18289d=_0x2d17[_0x5bcae4];return _0x18289d;};'use strict';var Sequelize=require(_0x72d1('0x0'));module[_0x72d1('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x72d1('0x2')]},'type':{'type':Sequelize[_0x72d1('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index a0ae660..87a5140 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 _0x2f54=['end','json','offset','undefined','limit','count','set','apply','save','then','destroy','stack','send','index','rawAttributes','fieldName','type','key','model','map','name','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','Attachment','findAll','catch','show','params','keys','length','includeAll','include','merge','options','find','clone','get','omit','updatedAt','body','createdAt','create','update','file','originalname','basename','filename','mimetype','findOne','root','server/files/attachments/','join','download','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x2f54,0x197));var _0x42f5=function(_0x5ee748,_0x552a2b){_0x5ee748=_0x5ee748-0x0;var _0x36da37=_0x2f54[_0x5ee748];return _0x36da37;};'use strict';var emlformat=require(_0x42f5('0x0'));var rimraf=require(_0x42f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x42f5('0x2'));var moment=require('moment');var BPromise=require(_0x42f5('0x3'));var Mustache=require(_0x42f5('0x4'));var util=require(_0x42f5('0x5'));var path=require(_0x42f5('0x6'));var sox=require(_0x42f5('0x7'));var csv=require(_0x42f5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42f5('0x9'));var squel=require(_0x42f5('0xa'));var crypto=require(_0x42f5('0xb'));var jsforce=require(_0x42f5('0xc'));var deskjs=require(_0x42f5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x42f5('0xe'));var Papa=require(_0x42f5('0xf'));var Redis=require(_0x42f5('0x10'));var authService=require(_0x42f5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x42f5('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x42f5('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x42f5('0x14'))['db'];function respondWithStatusCode(_0x1ffb2c,_0x18158b){_0x18158b=_0x18158b||0xcc;return function(_0x2fda62){if(_0x2fda62){return _0x1ffb2c[_0x42f5('0x15')](_0x18158b);}return _0x1ffb2c[_0x42f5('0x16')](_0x18158b)[_0x42f5('0x17')]();};}function respondWithResult(_0x4f9d0e,_0x5b0fac){_0x5b0fac=_0x5b0fac||0xc8;return function(_0x2a3976){if(_0x2a3976){return _0x4f9d0e[_0x42f5('0x16')](_0x5b0fac)[_0x42f5('0x18')](_0x2a3976);}};}function respondWithFilteredResult(_0x12e4c5,_0x53f794){return function(_0x20a442){if(_0x20a442){var _0x3b7d36=typeof _0x53f794[_0x42f5('0x19')]===_0x42f5('0x1a')&&typeof _0x53f794[_0x42f5('0x1b')]===_0x42f5('0x1a');var _0x38a237=_0x20a442[_0x42f5('0x1c')];var _0x30d2c7=_0x3b7d36?0x0:_0x53f794[_0x42f5('0x19')];var _0xef75f8=_0x3b7d36?_0x20a442[_0x42f5('0x1c')]:_0x53f794[_0x42f5('0x19')]+_0x53f794[_0x42f5('0x1b')];var _0x1b8c12;if(_0xef75f8>=_0x38a237){_0xef75f8=_0x38a237;_0x1b8c12=0xc8;}else{_0x1b8c12=0xce;}_0x12e4c5[_0x42f5('0x16')](_0x1b8c12);return _0x12e4c5[_0x42f5('0x1d')]('Content-Range',_0x30d2c7+'-'+_0xef75f8+'/'+_0x38a237)['json'](_0x20a442);}return null;};}function patchUpdates(_0x245701){return function(_0xede24e){try{jsonpatch[_0x42f5('0x1e')](_0xede24e,_0x245701,!![]);}catch(_0x445130){return BPromise['reject'](_0x445130);}return _0xede24e[_0x42f5('0x1f')]();};}function saveUpdates(_0x433c00,_0x497363){return function(_0x42f6e4){if(_0x42f6e4){return _0x42f6e4['update'](_0x433c00)[_0x42f5('0x20')](function(_0x1f3ece){return _0x1f3ece;});}return null;};}function removeEntity(_0x4e275d,_0x38ff24){return function(_0x5ac26b){if(_0x5ac26b){return _0x5ac26b[_0x42f5('0x21')]()[_0x42f5('0x20')](function(){_0x4e275d[_0x42f5('0x16')](0xcc)[_0x42f5('0x17')]();});}};}function handleEntityNotFound(_0x50d577,_0x1b9387){return function(_0xf5d7e0){if(!_0xf5d7e0){_0x50d577[_0x42f5('0x15')](0x194);}return _0xf5d7e0;};}function handleError(_0x1cd2f0,_0x32ef05){_0x32ef05=_0x32ef05||0x1f4;return function(_0x4e43b0){logger['error'](_0x4e43b0[_0x42f5('0x22')]);if(_0x4e43b0['name']){delete _0x4e43b0['name'];}_0x1cd2f0[_0x42f5('0x16')](_0x32ef05)[_0x42f5('0x23')](_0x4e43b0);};}exports[_0x42f5('0x24')]=function(_0x45b504,_0x2c4d50){var _0x220d51={},_0x2920b1={},_0x5a7c2a={'count':0x0,'rows':[]};var _0x35c57c=_['map'](db['Attachment'][_0x42f5('0x25')],function(_0xc7d89){return{'name':_0xc7d89[_0x42f5('0x26')],'type':_0xc7d89[_0x42f5('0x27')][_0x42f5('0x28')]};});_0x2920b1[_0x42f5('0x29')]=_[_0x42f5('0x2a')](_0x35c57c,_0x42f5('0x2b'));_0x2920b1['query']=_['keys'](_0x45b504[_0x42f5('0x2c')]);_0x2920b1['filters']=_['intersection'](_0x2920b1['model'],_0x2920b1[_0x42f5('0x2c')]);_0x220d51[_0x42f5('0x2d')]=_[_0x42f5('0x2e')](_0x2920b1['model'],qs[_0x42f5('0x2f')](_0x45b504[_0x42f5('0x2c')][_0x42f5('0x2f')]));_0x220d51[_0x42f5('0x2d')]=_0x220d51['attributes']['length']?_0x220d51[_0x42f5('0x2d')]:_0x2920b1['model'];if(!_0x45b504[_0x42f5('0x2c')][_0x42f5('0x30')](_0x42f5('0x31'))){_0x220d51[_0x42f5('0x1b')]=qs[_0x42f5('0x1b')](_0x45b504['query']['limit']);_0x220d51['offset']=qs['offset'](_0x45b504['query']['offset']);}_0x220d51[_0x42f5('0x32')]=qs[_0x42f5('0x33')](_0x45b504[_0x42f5('0x2c')][_0x42f5('0x33')]);_0x220d51[_0x42f5('0x34')]=qs[_0x42f5('0x35')](_['pick'](_0x45b504[_0x42f5('0x2c')],_0x2920b1[_0x42f5('0x35')]),_0x35c57c);if(_0x45b504[_0x42f5('0x2c')][_0x42f5('0x36')]){_0x220d51[_0x42f5('0x34')]=_['merge'](_0x220d51['where'],{'$or':_[_0x42f5('0x2a')](_0x35c57c,function(_0xbcd444){if(_0xbcd444['type']!==_0x42f5('0x37')){var _0x3335a1={};_0x3335a1[_0xbcd444[_0x42f5('0x2b')]]={'$like':'%'+_0x45b504[_0x42f5('0x2c')][_0x42f5('0x36')]+'%'};return _0x3335a1;}})});}_0x220d51=_['merge']({},_0x220d51,_0x45b504['options']);var _0x22fff2={'where':_0x220d51[_0x42f5('0x34')]};return db[_0x42f5('0x38')][_0x42f5('0x1c')](_0x22fff2)[_0x42f5('0x20')](function(_0x42218e){_0x5a7c2a[_0x42f5('0x1c')]=_0x42218e;if(_0x45b504[_0x42f5('0x2c')]['includeAll']){_0x220d51['include']=[{'all':!![]}];}return db['Attachment'][_0x42f5('0x39')](_0x220d51);})[_0x42f5('0x20')](function(_0x2c9bb3){_0x5a7c2a['rows']=_0x2c9bb3;return _0x5a7c2a;})[_0x42f5('0x20')](respondWithFilteredResult(_0x2c4d50,_0x220d51))[_0x42f5('0x3a')](handleError(_0x2c4d50,null));};exports[_0x42f5('0x3b')]=function(_0x4d9ddb,_0x4a9c2d){var _0x4e7381={'raw':!![],'where':{'id':_0x4d9ddb[_0x42f5('0x3c')]['id']}},_0xba5293={};_0xba5293[_0x42f5('0x29')]=_['keys'](db[_0x42f5('0x38')][_0x42f5('0x25')]);_0xba5293[_0x42f5('0x2c')]=_[_0x42f5('0x3d')](_0x4d9ddb[_0x42f5('0x2c')]);_0xba5293[_0x42f5('0x35')]=_['intersection'](_0xba5293[_0x42f5('0x29')],_0xba5293[_0x42f5('0x2c')]);_0x4e7381[_0x42f5('0x2d')]=_[_0x42f5('0x2e')](_0xba5293[_0x42f5('0x29')],qs[_0x42f5('0x2f')](_0x4d9ddb[_0x42f5('0x2c')][_0x42f5('0x2f')]));_0x4e7381['attributes']=_0x4e7381[_0x42f5('0x2d')][_0x42f5('0x3e')]?_0x4e7381[_0x42f5('0x2d')]:_0xba5293[_0x42f5('0x29')];if(_0x4d9ddb[_0x42f5('0x2c')][_0x42f5('0x3f')]){_0x4e7381[_0x42f5('0x40')]=[{'all':!![]}];}_0x4e7381=_[_0x42f5('0x41')]({},_0x4e7381,_0x4d9ddb[_0x42f5('0x42')]);return db[_0x42f5('0x38')][_0x42f5('0x43')](_0x4e7381)['then'](handleEntityNotFound(_0x4a9c2d,null))[_0x42f5('0x20')](respondWithResult(_0x4a9c2d,null))[_0x42f5('0x3a')](handleError(_0x4a9c2d,null));};exports[_0x42f5('0x44')]=function(_0x48625f,_0x18c8b4){var _0x1370ee={'where':{'id':_0x48625f[_0x42f5('0x3c')]['id']}},_0x36b62b={};_0x36b62b[_0x42f5('0x29')]=_['keys'](db[_0x42f5('0x38')]['rawAttributes']);_0x1370ee['attributes']=_[_0x42f5('0x2e')](_0x36b62b[_0x42f5('0x29')],qs[_0x42f5('0x2f')](_0x48625f[_0x42f5('0x2c')][_0x42f5('0x2f')]));_0x1370ee[_0x42f5('0x2d')]=_0x1370ee[_0x42f5('0x2d')][_0x42f5('0x3e')]?_0x1370ee[_0x42f5('0x2d')]:_0x36b62b[_0x42f5('0x29')];if(_0x48625f[_0x42f5('0x2c')][_0x42f5('0x3f')]){_0x1370ee['include']=[{'all':!![]}];}_0x1370ee=_[_0x42f5('0x41')]({},_0x1370ee,_0x48625f[_0x42f5('0x42')]);return db[_0x42f5('0x38')][_0x42f5('0x43')](_0x1370ee)[_0x42f5('0x20')](handleEntityNotFound(_0x18c8b4,null))['then'](function(_0x4c56d1){if(_0x4c56d1){var _0x2c8977=_0x4c56d1[_0x42f5('0x45')]({'plain':!![]});_0x2c8977=qs[_0x42f5('0x46')](_0x2c8977,['id','createdAt',_0x42f5('0x47')]);_0x48625f[_0x42f5('0x48')]=_[_0x42f5('0x46')](_0x48625f[_0x42f5('0x48')],['id',_0x42f5('0x49'),'updatedAt']);return db['Attachment'][_0x42f5('0x4a')](_[_0x42f5('0x41')](_0x2c8977,_0x48625f[_0x42f5('0x48')]),{'include':_0x48625f[_0x42f5('0x2c')][_0x42f5('0x3f')]?[{'all':!![]}]:undefined});}})[_0x42f5('0x20')](respondWithResult(_0x18c8b4,0xc9))[_0x42f5('0x3a')](handleError(_0x18c8b4,null));};exports[_0x42f5('0x4b')]=function(_0x42cb32,_0x44960d){if(_0x42cb32[_0x42f5('0x48')]['id']){delete _0x42cb32['body']['id'];}return db[_0x42f5('0x38')]['find']({'where':{'id':_0x42cb32[_0x42f5('0x3c')]['id']}})[_0x42f5('0x20')](handleEntityNotFound(_0x44960d,null))[_0x42f5('0x20')](saveUpdates(_0x42cb32['body'],null))[_0x42f5('0x20')](respondWithResult(_0x44960d,null))[_0x42f5('0x3a')](handleError(_0x44960d,null));};exports[_0x42f5('0x21')]=function(_0x3402aa,_0x3184c3){return db[_0x42f5('0x38')][_0x42f5('0x43')]({'where':{'id':_0x3402aa[_0x42f5('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3184c3,null))[_0x42f5('0x20')](removeEntity(_0x3184c3,null))['catch'](handleError(_0x3184c3,null));};exports['create']=function(_0x40f64a,_0x151573,_0x16d94e){_0x40f64a[_0x42f5('0x48')]['name']=_0x40f64a[_0x42f5('0x4c')][_0x42f5('0x4d')];_0x40f64a[_0x42f5('0x48')][_0x42f5('0x4e')]=_0x40f64a[_0x42f5('0x4c')][_0x42f5('0x4f')];_0x40f64a[_0x42f5('0x48')][_0x42f5('0x27')]=_0x40f64a[_0x42f5('0x4c')][_0x42f5('0x50')];return db[_0x42f5('0x38')][_0x42f5('0x4a')](_0x40f64a[_0x42f5('0x48')])[_0x42f5('0x20')](respondWithResult(_0x151573,0xc9))[_0x42f5('0x3a')](handleError(_0x151573,null));};exports['download']=function(_0x1c2ba5,_0x1ab3a5,_0x197ed6){return db['Attachment'][_0x42f5('0x51')]({'where':{'id':_0x1c2ba5[_0x42f5('0x3c')]['id']},'raw':!![]})[_0x42f5('0x20')](handleEntityNotFound(_0x1ab3a5,null))[_0x42f5('0x20')](function(_0x520f16){if(_0x520f16){var _0x381217=_0x520f16['ChatOfflineMessageId']!==null;var _0x533295=path['join'](config[_0x42f5('0x52')],_0x42f5('0x53'));if(_0x381217){_0x533295=path[_0x42f5('0x54')](_0x533295,'offline-chat/');}var _0x1a7731=path[_0x42f5('0x54')](_0x533295,_0x520f16[_0x42f5('0x4e')]);return _0x1ab3a5[_0x42f5('0x55')](_0x1a7731);}})[_0x42f5('0x3a')](handleError(_0x1ab3a5,null));}; \ No newline at end of file +var _0xe5fd=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','rows','catch','keys','rawAttributes','length','merge','find','clone','params','omit','updatedAt','body','createdAt','create','file','originalname','basename','mimetype','findOne','root','server/files/attachments/','join','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','fieldName','type','key','model','query','filters','intersection'];(function(_0x372d95,_0x14b2e8){var _0x258f8e=function(_0x62d3c0){while(--_0x62d3c0){_0x372d95['push'](_0x372d95['shift']());}};_0x258f8e(++_0x14b2e8);}(_0xe5fd,0x7d));var _0xde5f=function(_0x23a6b7,_0x5a3533){_0x23a6b7=_0x23a6b7-0x0;var _0x43bf1f=_0xe5fd[_0x23a6b7];return _0x43bf1f;};'use strict';var emlformat=require(_0xde5f('0x0'));var rimraf=require(_0xde5f('0x1'));var zipdir=require(_0xde5f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde5f('0x3'));var moment=require(_0xde5f('0x4'));var BPromise=require(_0xde5f('0x5'));var Mustache=require(_0xde5f('0x6'));var util=require(_0xde5f('0x7'));var path=require(_0xde5f('0x8'));var sox=require(_0xde5f('0x9'));var csv=require(_0xde5f('0xa'));var ejs=require(_0xde5f('0xb'));var fs=require('fs');var fs_extra=require(_0xde5f('0xc'));var _=require(_0xde5f('0xd'));var squel=require('squel');var crypto=require(_0xde5f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xde5f('0xf'));var toCsv=require(_0xde5f('0xa'));var querystring=require(_0xde5f('0x10'));var Papa=require(_0xde5f('0x11'));var Redis=require(_0xde5f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xde5f('0x13'));var hardwareService=require(_0xde5f('0x14'));var logger=require(_0xde5f('0x15'))('api');var utils=require(_0xde5f('0x16'));var config=require(_0xde5f('0x17'));var licenseUtil=require(_0xde5f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44eb64,_0x586236){_0x586236=_0x586236||0xcc;return function(_0x5f3ae1){if(_0x5f3ae1){return _0x44eb64['sendStatus'](_0x586236);}return _0x44eb64[_0xde5f('0x19')](_0x586236)['end']();};}function respondWithResult(_0x5f18a5,_0x1251b5){_0x1251b5=_0x1251b5||0xc8;return function(_0x34f433){if(_0x34f433){return _0x5f18a5['status'](_0x1251b5)['json'](_0x34f433);}};}function respondWithFilteredResult(_0x85ac7c,_0x20215c){return function(_0x4312e8){if(_0x4312e8){var _0x9bac3a=typeof _0x20215c[_0xde5f('0x1a')]===_0xde5f('0x1b')&&typeof _0x20215c[_0xde5f('0x1c')]==='undefined';var _0x56c110=_0x4312e8['count'];var _0x23a19f=_0x9bac3a?0x0:_0x20215c['offset'];var _0xf232c8=_0x9bac3a?_0x4312e8[_0xde5f('0x1d')]:_0x20215c[_0xde5f('0x1a')]+_0x20215c[_0xde5f('0x1c')];var _0x44f842;if(_0xf232c8>=_0x56c110){_0xf232c8=_0x56c110;_0x44f842=0xc8;}else{_0x44f842=0xce;}_0x85ac7c[_0xde5f('0x19')](_0x44f842);return _0x85ac7c[_0xde5f('0x1e')]('Content-Range',_0x23a19f+'-'+_0xf232c8+'/'+_0x56c110)[_0xde5f('0x1f')](_0x4312e8);}return null;};}function patchUpdates(_0x4ddec9){return function(_0x2ade30){try{jsonpatch[_0xde5f('0x20')](_0x2ade30,_0x4ddec9,!![]);}catch(_0x333918){return BPromise[_0xde5f('0x21')](_0x333918);}return _0x2ade30[_0xde5f('0x22')]();};}function saveUpdates(_0x32c71e,_0x7adf){return function(_0x41c58f){if(_0x41c58f){return _0x41c58f[_0xde5f('0x23')](_0x32c71e)[_0xde5f('0x24')](function(_0x397dd3){return _0x397dd3;});}return null;};}function removeEntity(_0x16fcf,_0x6180ed){return function(_0x586ec3){if(_0x586ec3){return _0x586ec3[_0xde5f('0x25')]()['then'](function(){_0x16fcf[_0xde5f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb013e9,_0x385869){return function(_0xadbd4b){if(!_0xadbd4b){_0xb013e9[_0xde5f('0x26')](0x194);}return _0xadbd4b;};}function handleError(_0x545874,_0x31b07e){_0x31b07e=_0x31b07e||0x1f4;return function(_0x288c90){logger[_0xde5f('0x27')](_0x288c90[_0xde5f('0x28')]);if(_0x288c90[_0xde5f('0x29')]){delete _0x288c90[_0xde5f('0x29')];}_0x545874[_0xde5f('0x19')](_0x31b07e)[_0xde5f('0x2a')](_0x288c90);};}exports[_0xde5f('0x2b')]=function(_0x17ad3c,_0x7f0eb7){var _0x95006e={},_0x391384={},_0x18d335={'count':0x0,'rows':[]};var _0x50f094=_[_0xde5f('0x2c')](db[_0xde5f('0x2d')]['rawAttributes'],function(_0x575366){return{'name':_0x575366[_0xde5f('0x2e')],'type':_0x575366[_0xde5f('0x2f')][_0xde5f('0x30')]};});_0x391384[_0xde5f('0x31')]=_[_0xde5f('0x2c')](_0x50f094,_0xde5f('0x29'));_0x391384['query']=_['keys'](_0x17ad3c[_0xde5f('0x32')]);_0x391384[_0xde5f('0x33')]=_[_0xde5f('0x34')](_0x391384[_0xde5f('0x31')],_0x391384[_0xde5f('0x32')]);_0x95006e[_0xde5f('0x35')]=_[_0xde5f('0x34')](_0x391384[_0xde5f('0x31')],qs[_0xde5f('0x36')](_0x17ad3c[_0xde5f('0x32')][_0xde5f('0x36')]));_0x95006e['attributes']=_0x95006e[_0xde5f('0x35')]['length']?_0x95006e[_0xde5f('0x35')]:_0x391384[_0xde5f('0x31')];if(!_0x17ad3c[_0xde5f('0x32')][_0xde5f('0x37')](_0xde5f('0x38'))){_0x95006e[_0xde5f('0x1c')]=qs[_0xde5f('0x1c')](_0x17ad3c[_0xde5f('0x32')][_0xde5f('0x1c')]);_0x95006e[_0xde5f('0x1a')]=qs[_0xde5f('0x1a')](_0x17ad3c[_0xde5f('0x32')][_0xde5f('0x1a')]);}_0x95006e[_0xde5f('0x39')]=qs[_0xde5f('0x3a')](_0x17ad3c['query']['sort']);_0x95006e[_0xde5f('0x3b')]=qs[_0xde5f('0x33')](_[_0xde5f('0x3c')](_0x17ad3c[_0xde5f('0x32')],_0x391384[_0xde5f('0x33')]),_0x50f094);if(_0x17ad3c[_0xde5f('0x32')]['filter']){_0x95006e[_0xde5f('0x3b')]=_['merge'](_0x95006e[_0xde5f('0x3b')],{'$or':_[_0xde5f('0x2c')](_0x50f094,function(_0x5a80a1){if(_0x5a80a1[_0xde5f('0x2f')]!==_0xde5f('0x3d')){var _0x4fa755={};_0x4fa755[_0x5a80a1[_0xde5f('0x29')]]={'$like':'%'+_0x17ad3c[_0xde5f('0x32')][_0xde5f('0x3e')]+'%'};return _0x4fa755;}})});}_0x95006e=_['merge']({},_0x95006e,_0x17ad3c[_0xde5f('0x3f')]);var _0x2741c3={'where':_0x95006e[_0xde5f('0x3b')]};return db['Attachment'][_0xde5f('0x1d')](_0x2741c3)[_0xde5f('0x24')](function(_0x46c204){_0x18d335[_0xde5f('0x1d')]=_0x46c204;if(_0x17ad3c[_0xde5f('0x32')][_0xde5f('0x40')]){_0x95006e[_0xde5f('0x41')]=[{'all':!![]}];}return db[_0xde5f('0x2d')]['findAll'](_0x95006e);})['then'](function(_0x24df70){_0x18d335[_0xde5f('0x42')]=_0x24df70;return _0x18d335;})[_0xde5f('0x24')](respondWithFilteredResult(_0x7f0eb7,_0x95006e))[_0xde5f('0x43')](handleError(_0x7f0eb7,null));};exports['show']=function(_0x47b6aa,_0x5e41ce){var _0x2556f7={'raw':!![],'where':{'id':_0x47b6aa['params']['id']}},_0x5503d1={};_0x5503d1[_0xde5f('0x31')]=_[_0xde5f('0x44')](db[_0xde5f('0x2d')][_0xde5f('0x45')]);_0x5503d1[_0xde5f('0x32')]=_[_0xde5f('0x44')](_0x47b6aa['query']);_0x5503d1[_0xde5f('0x33')]=_[_0xde5f('0x34')](_0x5503d1[_0xde5f('0x31')],_0x5503d1[_0xde5f('0x32')]);_0x2556f7[_0xde5f('0x35')]=_['intersection'](_0x5503d1[_0xde5f('0x31')],qs['fields'](_0x47b6aa[_0xde5f('0x32')][_0xde5f('0x36')]));_0x2556f7[_0xde5f('0x35')]=_0x2556f7[_0xde5f('0x35')][_0xde5f('0x46')]?_0x2556f7[_0xde5f('0x35')]:_0x5503d1['model'];if(_0x47b6aa[_0xde5f('0x32')]['includeAll']){_0x2556f7['include']=[{'all':!![]}];}_0x2556f7=_[_0xde5f('0x47')]({},_0x2556f7,_0x47b6aa['options']);return db['Attachment'][_0xde5f('0x48')](_0x2556f7)[_0xde5f('0x24')](handleEntityNotFound(_0x5e41ce,null))[_0xde5f('0x24')](respondWithResult(_0x5e41ce,null))[_0xde5f('0x43')](handleError(_0x5e41ce,null));};exports[_0xde5f('0x49')]=function(_0xf9b310,_0x3f99ca){var _0x1a6676={'where':{'id':_0xf9b310[_0xde5f('0x4a')]['id']}},_0xdaef1a={};_0xdaef1a[_0xde5f('0x31')]=_['keys'](db[_0xde5f('0x2d')][_0xde5f('0x45')]);_0x1a6676[_0xde5f('0x35')]=_[_0xde5f('0x34')](_0xdaef1a[_0xde5f('0x31')],qs[_0xde5f('0x36')](_0xf9b310[_0xde5f('0x32')][_0xde5f('0x36')]));_0x1a6676[_0xde5f('0x35')]=_0x1a6676[_0xde5f('0x35')][_0xde5f('0x46')]?_0x1a6676[_0xde5f('0x35')]:_0xdaef1a[_0xde5f('0x31')];if(_0xf9b310['query'][_0xde5f('0x40')]){_0x1a6676[_0xde5f('0x41')]=[{'all':!![]}];}_0x1a6676=_[_0xde5f('0x47')]({},_0x1a6676,_0xf9b310[_0xde5f('0x3f')]);return db[_0xde5f('0x2d')][_0xde5f('0x48')](_0x1a6676)['then'](handleEntityNotFound(_0x3f99ca,null))[_0xde5f('0x24')](function(_0x2f3a53){if(_0x2f3a53){var _0xbe17d4=_0x2f3a53['get']({'plain':!![]});_0xbe17d4=qs[_0xde5f('0x4b')](_0xbe17d4,['id','createdAt',_0xde5f('0x4c')]);_0xf9b310[_0xde5f('0x4d')]=_[_0xde5f('0x4b')](_0xf9b310[_0xde5f('0x4d')],['id',_0xde5f('0x4e'),_0xde5f('0x4c')]);return db[_0xde5f('0x2d')][_0xde5f('0x4f')](_[_0xde5f('0x47')](_0xbe17d4,_0xf9b310[_0xde5f('0x4d')]),{'include':_0xf9b310['query'][_0xde5f('0x40')]?[{'all':!![]}]:undefined});}})[_0xde5f('0x24')](respondWithResult(_0x3f99ca,0xc9))[_0xde5f('0x43')](handleError(_0x3f99ca,null));};exports[_0xde5f('0x23')]=function(_0x3d24ed,_0xc7c722){if(_0x3d24ed['body']['id']){delete _0x3d24ed[_0xde5f('0x4d')]['id'];}return db[_0xde5f('0x2d')][_0xde5f('0x48')]({'where':{'id':_0x3d24ed[_0xde5f('0x4a')]['id']}})[_0xde5f('0x24')](handleEntityNotFound(_0xc7c722,null))['then'](saveUpdates(_0x3d24ed[_0xde5f('0x4d')],null))['then'](respondWithResult(_0xc7c722,null))[_0xde5f('0x43')](handleError(_0xc7c722,null));};exports[_0xde5f('0x25')]=function(_0x390e96,_0x4e173f){return db['Attachment'][_0xde5f('0x48')]({'where':{'id':_0x390e96[_0xde5f('0x4a')]['id']}})[_0xde5f('0x24')](handleEntityNotFound(_0x4e173f,null))['then'](removeEntity(_0x4e173f,null))[_0xde5f('0x43')](handleError(_0x4e173f,null));};exports[_0xde5f('0x4f')]=function(_0x3b9925,_0x2170b4,_0x5b334b){_0x3b9925[_0xde5f('0x4d')][_0xde5f('0x29')]=_0x3b9925[_0xde5f('0x50')][_0xde5f('0x51')];_0x3b9925['body'][_0xde5f('0x52')]=_0x3b9925[_0xde5f('0x50')]['filename'];_0x3b9925[_0xde5f('0x4d')][_0xde5f('0x2f')]=_0x3b9925['file'][_0xde5f('0x53')];return db[_0xde5f('0x2d')][_0xde5f('0x4f')](_0x3b9925[_0xde5f('0x4d')])['then'](respondWithResult(_0x2170b4,0xc9))[_0xde5f('0x43')](handleError(_0x2170b4,null));};exports['download']=function(_0x587178,_0x5b6b14,_0xd5c96d){return db[_0xde5f('0x2d')][_0xde5f('0x54')]({'where':{'id':_0x587178[_0xde5f('0x4a')]['id']},'raw':!![]})[_0xde5f('0x24')](handleEntityNotFound(_0x5b6b14,null))[_0xde5f('0x24')](function(_0x45ec1e){if(_0x45ec1e){var _0x430b69=_0x45ec1e['ChatOfflineMessageId']!==null;var _0x4b4205=path['join'](config[_0xde5f('0x55')],_0xde5f('0x56'));if(_0x430b69){_0x4b4205=path[_0xde5f('0x57')](_0x4b4205,'offline-chat/');}var _0x223512=path[_0xde5f('0x57')](_0x4b4205,_0x45ec1e[_0xde5f('0x52')]);return _0x5b6b14[_0xde5f('0x58')](_0x223512);}})[_0xde5f('0x43')](handleError(_0x5b6b14,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 95bf8c7..0679cc1 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 _0xbb64=['util','moment','bluebird','request-promise','../../config/environment','./attachment.attributes','define','Attachment','lodash'];(function(_0x52f1a7,_0x4da82f){var _0x227c86=function(_0x1e8686){while(--_0x1e8686){_0x52f1a7['push'](_0x52f1a7['shift']());}};_0x227c86(++_0x4da82f);}(_0xbb64,0x1dc));var _0x4bb6=function(_0x27bc7b,_0xb3a76d){_0x27bc7b=_0x27bc7b-0x0;var _0x348d71=_0xbb64[_0x27bc7b];return _0x348d71;};'use strict';var _=require(_0x4bb6('0x0'));var util=require(_0x4bb6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4bb6('0x2'));var BPromise=require(_0x4bb6('0x3'));var rp=require(_0x4bb6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4bb6('0x5'));var attributes=require(_0x4bb6('0x6'));module['exports']=function(_0x59ac41,_0x5d59f1){return _0x59ac41[_0x4bb6('0x7')](_0x4bb6('0x8'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8438=['./attachment.attributes','exports','define','attachments','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5292ed,_0x74bd26){var _0x2a2bc7=function(_0x5b3dbe){while(--_0x5b3dbe){_0x5292ed['push'](_0x5292ed['shift']());}};_0x2a2bc7(++_0x74bd26);}(_0x8438,0x13c));var _0x8843=function(_0xe94610,_0x2e3b8b){_0xe94610=_0xe94610-0x0;var _0x9b6f20=_0x8438[_0xe94610];return _0x9b6f20;};'use strict';var _=require(_0x8843('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8843('0x1'));var moment=require(_0x8843('0x2'));var BPromise=require(_0x8843('0x3'));var rp=require(_0x8843('0x4'));var fs=require('fs');var path=require(_0x8843('0x5'));var rimraf=require(_0x8843('0x6'));var config=require(_0x8843('0x7'));var attributes=require(_0x8843('0x8'));module[_0x8843('0x9')]=function(_0x5ee512,_0x213ddc){return _0x5ee512[_0x8843('0xa')]('Attachment',attributes,{'tableName':_0x8843('0xb'),'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 7564502..d071351 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 _0xe13e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateAttachment','Attachment','body','options','raw','moment','bluebird'];(function(_0x580ff5,_0xd4a51a){var _0x2ea54f=function(_0xa7771c){while(--_0xa7771c){_0x580ff5['push'](_0x580ff5['shift']());}};_0x2ea54f(++_0xd4a51a);}(_0xe13e,0xde));var _0xee13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe13e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee13('0x0'));var BPromise=require(_0xee13('0x1'));var rs=require(_0xee13('0x2'));var fs=require('fs');var Redis=require(_0xee13('0x3'));var db=require(_0xee13('0x4'))['db'];var utils=require(_0xee13('0x5'));var logger=require(_0xee13('0x6'))(_0xee13('0x7'));var config=require(_0xee13('0x8'));var jayson=require(_0xee13('0x9'));var client=jayson[_0xee13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8f606d,_0x3ae6e2,_0xfdb836){return new BPromise(function(_0x64ee02,_0x4810bd){return client[_0xee13('0xb')](_0x8f606d,_0xfdb836)[_0xee13('0xc')](function(_0x1cc55b){logger[_0xee13('0xd')](_0xee13('0xe'),_0x3ae6e2,'request\x20sent');logger[_0xee13('0xf')](_0xee13('0x10'),_0x3ae6e2,'request\x20sent',JSON[_0xee13('0x11')](_0x1cc55b));if(_0x1cc55b['error']){if(_0x1cc55b['error']['code']===0x1f4){logger[_0xee13('0x12')]('Attachment,\x20%s,\x20%s',_0x3ae6e2,_0x1cc55b[_0xee13('0x12')][_0xee13('0x13')]);return _0x4810bd(_0x1cc55b[_0xee13('0x12')][_0xee13('0x13')]);}logger[_0xee13('0x12')](_0xee13('0xe'),_0x3ae6e2,_0x1cc55b[_0xee13('0x12')]['message']);return _0x64ee02(_0x1cc55b[_0xee13('0x12')][_0xee13('0x13')]);}else{logger[_0xee13('0xd')]('Attachment,\x20%s,\x20%s',_0x3ae6e2,_0xee13('0x14'));_0x64ee02(_0x1cc55b[_0xee13('0x15')]['message']);}})[_0xee13('0x16')](function(_0xcd1482){logger[_0xee13('0x12')](_0xee13('0xe'),_0x3ae6e2,_0xcd1482);_0x4810bd(_0xcd1482);});});}exports[_0xee13('0x17')]=function(_0x3a5819){var _0xd353d0=this;return new Promise(function(_0x33bd9c,_0x3806b0){return db[_0xee13('0x18')]['create'](_0x3a5819[_0xee13('0x19')],{'raw':_0x3a5819[_0xee13('0x1a')]?_0x3a5819['options'][_0xee13('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x17e664){logger['info'](_0xee13('0x17'),_0x3a5819);logger[_0xee13('0xf')]('CreateAttachment',_0x3a5819,JSON[_0xee13('0x11')](_0x17e664));_0x33bd9c(_0x17e664);})[_0xee13('0x16')](function(_0x3f9dfd){logger[_0xee13('0x12')](_0xee13('0x17'),_0x3f9dfd['message'],_0x3a5819);_0x3806b0(_0xd353d0[_0xee13('0x12')](0x1f4,_0x3f9dfd[_0xee13('0x13')]));});});}; \ No newline at end of file +var _0x202c=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateAttachment','Attachment','options','raw','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x1e896c,_0x3f9948){var _0xd149d9=function(_0x3281e5){while(--_0x3281e5){_0x1e896c['push'](_0x1e896c['shift']());}};_0xd149d9(++_0x3f9948);}(_0x202c,0x178));var _0xc202=function(_0x5e5d33,_0x3f76f5){_0x5e5d33=_0x5e5d33-0x0;var _0x8d2331=_0x202c[_0x5e5d33];return _0x8d2331;};'use strict';var _=require(_0xc202('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc202('0x1'));var rs=require(_0xc202('0x2'));var fs=require('fs');var Redis=require(_0xc202('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc202('0x4'));var logger=require(_0xc202('0x5'))(_0xc202('0x6'));var config=require(_0xc202('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc202('0x8')][_0xc202('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59563a,_0xc2b3eb,_0x574549){return new BPromise(function(_0x872c1a,_0x5978fe){return client[_0xc202('0xa')](_0x59563a,_0x574549)[_0xc202('0xb')](function(_0x36fcb7){logger[_0xc202('0xc')](_0xc202('0xd'),_0xc2b3eb,_0xc202('0xe'));logger[_0xc202('0xf')](_0xc202('0x10'),_0xc2b3eb,_0xc202('0xe'),JSON[_0xc202('0x11')](_0x36fcb7));if(_0x36fcb7[_0xc202('0x12')]){if(_0x36fcb7['error'][_0xc202('0x13')]===0x1f4){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);return _0x5978fe(_0x36fcb7[_0xc202('0x12')][_0xc202('0x14')]);}logger['error'](_0xc202('0xd'),_0xc2b3eb,_0x36fcb7[_0xc202('0x12')]['message']);return _0x872c1a(_0x36fcb7['error']['message']);}else{logger[_0xc202('0xc')]('Attachment,\x20%s,\x20%s',_0xc2b3eb,_0xc202('0xe'));_0x872c1a(_0x36fcb7['result'][_0xc202('0x14')]);}})[_0xc202('0x15')](function(_0x3018c8){logger[_0xc202('0x12')](_0xc202('0xd'),_0xc2b3eb,_0x3018c8);_0x5978fe(_0x3018c8);});});}exports[_0xc202('0x16')]=function(_0x9620a0){var _0x591ecc=this;return new Promise(function(_0x16ec7c,_0x2c5557){return db[_0xc202('0x17')]['create'](_0x9620a0['body'],{'raw':_0x9620a0[_0xc202('0x18')]?_0x9620a0[_0xc202('0x18')][_0xc202('0x19')]===undefined?!![]:![]:!![]})[_0xc202('0xb')](function(_0x2ae3c1){logger['info']('CreateAttachment',_0x9620a0);logger[_0xc202('0xf')]('CreateAttachment',_0x9620a0,JSON[_0xc202('0x11')](_0x2ae3c1));_0x16ec7c(_0x2ae3c1);})[_0xc202('0x15')](function(_0x56e979){logger['error'](_0xc202('0x16'),_0x56e979['message'],_0x9620a0);_0x2c5557(_0x591ecc[_0xc202('0x12')](0x1f4,_0x56e979[_0xc202('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index cbc5888..88f0783 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(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x12aba8,_0x40a036){_0x12aba8=_0x12aba8-0x0;var _0x2aac66=_0x0b0e[_0x12aba8];return _0x2aac66;};'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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x509e7f,_0x2d9f99){var _0x28a735=function(_0x1c080a){while(--_0x1c080a){_0x509e7f['push'](_0x509e7f['shift']());}};_0x28a735(++_0x2d9f99);}(_0xb10b,0x12a));var _0xbb10=function(_0x14eb9e,_0x29fe9e){_0x14eb9e=_0x14eb9e-0x0;var _0x4c59c4=_0xb10b[_0x14eb9e];return _0x4c59c4;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 7c268ad..071b8b7 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 _0x8d5d=['adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','role','disabled','blockedAt','online','admin','user','agent','blocked','add','minutes','clearBlockUser','getLicense','catch','status','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','name','User','passport','passport-local','Strategy','moment','bluebird','util','../../mysqldb','../../config/utils','../../config/environment','api','undefined','activedirectory','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','then'];(function(_0x5f4b36,_0x18cb34){var _0x4765ec=function(_0x2a6c85){while(--_0x2a6c85){_0x5f4b36['push'](_0x5f4b36['shift']());}};_0x4765ec(++_0x18cb34);}(_0x8d5d,0x10e));var _0xd8d5=function(_0x5bb3f0,_0x263eea){_0x5bb3f0=_0x5bb3f0-0x0;var _0x4a3015=_0x8d5d[_0x5bb3f0];return _0x4a3015;};'use strict';var passport=require(_0xd8d5('0x0'));var LocalStrategy=require(_0xd8d5('0x1'))[_0xd8d5('0x2')];var moment=require(_0xd8d5('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xd8d5('0x4'));var util=require(_0xd8d5('0x5'));var db=require(_0xd8d5('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xd8d5('0x7'));var config=require(_0xd8d5('0x8'));var logger=require('../../config/logger')(_0xd8d5('0x9'));function isActiveDirectoryConfigured(_0x144466){var _0x56d620=![];if(typeof _0x144466['activedirectory']!==_0xd8d5('0xa')){_0x56d620=_0x144466[_0xd8d5('0xb')]['baseDN']&&_0x144466[_0xd8d5('0xb')][_0xd8d5('0xc')]&&_0x144466[_0xd8d5('0xb')]['domain'];}return _0x56d620;}function adAuthenticate(_0x3aab7f,_0x4f6f51,_0x7e3601){return new BPromise(function(_0x3423ba,_0x5ad02c){try{var _0x2c5efa=new ActiveDirectory(_0x3aab7f);_0x2c5efa[_0xd8d5('0xd')](_0x4f6f51,_0x7e3601,function(_0x45a0f4,_0x31ebe6){if(_0x45a0f4){logger[_0xd8d5('0xe')](_0xd8d5('0xf'),_0x4f6f51,util[_0xd8d5('0x10')](_0x45a0f4,{'showHidden':![],'depth':null}));_0x5ad02c(_0xd8d5('0x11'));}else if(!_0x31ebe6){logger[_0xd8d5('0xe')](_0xd8d5('0x12'),_0x4f6f51);_0x5ad02c(_0xd8d5('0x11'));}else{_0x3423ba(_0x31ebe6);}});}catch(_0x4bca58){_0x5ad02c(_0x4bca58);}});}function ActiveDirectoryAuthenticate(_0x507dd3,_0x5b0b8a,_0x37ae00,_0x327417){var _0x2e5c3f,_0x115852;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xd8d5('0x13'),_0x5b0b8a);return _0x327417(null,![],{'message':_0xd8d5('0x11')});}return db[_0xd8d5('0x14')][_0xd8d5('0x15')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xd8d5('0x16')],'raw':!![]})[_0xd8d5('0x17')](function(_0x4d28ae){_0x2e5c3f=_0x4d28ae;if(!_0x2e5c3f[_0xd8d5('0x18')]){logger[_0xd8d5('0xe')](_0xd8d5('0x19'),_0x5b0b8a);throw new Error(_0xd8d5('0x11'));}return _0x507dd3[_0xd8d5('0x15')]({'attributes':['id','name',_0xd8d5('0x1a'),'salt',_0xd8d5('0x1b'),_0xd8d5('0x1c'),'blocked',_0xd8d5('0x1d'),_0xd8d5('0x1e')],'where':{'name':_0x5b0b8a,'role':{'$or':[_0xd8d5('0x1f'),_0xd8d5('0x20'),_0xd8d5('0x21')]},'adSsoEnabled':!![]}});})[_0xd8d5('0x17')](function(_0xdf5921){if(!_0xdf5921||_0xdf5921&&_0xdf5921['name']!==_0x5b0b8a){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x115852=_0xdf5921;var _0x4c8d98=_0x115852['name']+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0xd8d5('0xb')],_0x4c8d98,_0x37ae00);})[_0xd8d5('0x17')](function(_0x12c113){if(_0x115852['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x2e5c3f[_0xd8d5('0x16')]>0x0){if(_0x115852[_0xd8d5('0x22')]){if(moment(_0x115852[_0xd8d5('0x1d')])[_0xd8d5('0x23')](_0x2e5c3f['blockDuration'],_0xd8d5('0x24'))>moment()){throw new Error(_0xd8d5('0x11'));}return utils[_0xd8d5('0x25')](_0x115852,0x0,![],null)[_0xd8d5('0x17')](function(){return utils[_0xd8d5('0x26')](_0x115852);})[_0xd8d5('0x17')](function(){return _0x327417(null,_0x115852);});}else{return utils['getLicense'](_0x115852)['then'](function(){return _0x327417(null,_0x115852);});}}else{return utils[_0xd8d5('0x26')](_0x115852)['then'](function(){return _0x327417(null,_0x115852);});}})[_0xd8d5('0x27')](function(_0x51e77b){return _0x327417(null,![],_0x51e77b);});}function handleError(_0x444f5b,_0x4238c3,_0x54d56b){return _0x444f5b[_0xd8d5('0x28')](_0x4238c3||0x1f4)['send']({'message':_0x54d56b?_0x54d56b[_0xd8d5('0x29')]||_0x54d56b:''});}exports[_0xd8d5('0x2a')]=function(_0x5a5335,_0x2daee2,_0x379737){passport[_0xd8d5('0xd')](_0xd8d5('0x2b'),function(_0x2c24e3,_0x5ad95e,_0x1326ad){var _0x29a93b=_0x2c24e3||_0x1326ad;if(_0x29a93b){return handleError(_0x2daee2,0x191,_0x29a93b);}if(!_0x5ad95e){return handleError(_0x2daee2,0x194,{'message':_0xd8d5('0x2c')});}else{var _0x4481d6={'payload':{'id':_0x5ad95e['id'],'role':_0x5ad95e[_0xd8d5('0x1b')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4481d6)[_0xd8d5('0x17')](function(_0x100270){_0x2daee2[_0xd8d5('0x2d')]({'id':_0x5ad95e['id'],'token':_0x100270,'statusCall':'','isAlreadyLogged':_0x5ad95e[_0xd8d5('0x1e')]});});}})(_0x5a5335,_0x2daee2,_0x379737);};passport[_0xd8d5('0x2e')]('ad-login',new LocalStrategy({'usernameField':_0xd8d5('0x2f'),'passwordField':_0xd8d5('0x1a')},function(_0x2c2c50,_0x56a25f,_0x13f18a){return ActiveDirectoryAuthenticate(db[_0xd8d5('0x30')],_0x2c2c50,_0x56a25f,_0x13f18a);})); \ No newline at end of file +var _0x8ba5=['../../mysqldb','../../components/auth/service','../../config/logger','activedirectory','undefined','baseDN','url','domain','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','user','then','getLicense','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','util'];(function(_0x426bdf,_0x45f9be){var _0x5aad3a=function(_0x2ead03){while(--_0x2ead03){_0x426bdf['push'](_0x426bdf['shift']());}};_0x5aad3a(++_0x45f9be);}(_0x8ba5,0x1da));var _0x58ba=function(_0x2199db,_0x64fe69){_0x2199db=_0x2199db-0x0;var _0x1823bc=_0x8ba5[_0x2199db];return _0x1823bc;};'use strict';var passport=require(_0x58ba('0x0'));var LocalStrategy=require(_0x58ba('0x1'))[_0x58ba('0x2')];var moment=require(_0x58ba('0x3'));var ActiveDirectory=require(_0x58ba('0x4'));var BPromise=require('bluebird');var util=require(_0x58ba('0x5'));var db=require(_0x58ba('0x6'))['db'];var authService=require(_0x58ba('0x7'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require(_0x58ba('0x8'))('api');function isActiveDirectoryConfigured(_0x4fb96e){var _0x48b43b=![];if(typeof _0x4fb96e[_0x58ba('0x9')]!==_0x58ba('0xa')){_0x48b43b=_0x4fb96e[_0x58ba('0x9')][_0x58ba('0xb')]&&_0x4fb96e['activedirectory'][_0x58ba('0xc')]&&_0x4fb96e['activedirectory'][_0x58ba('0xd')];}return _0x48b43b;}function adAuthenticate(_0x223b7e,_0x63c802,_0x5b1607){return new BPromise(function(_0x44bf4d,_0x57a2e5){try{var _0xfbe7f1=new ActiveDirectory(_0x223b7e);_0xfbe7f1['authenticate'](_0x63c802,_0x5b1607,function(_0x4ba989,_0x11aa55){if(_0x4ba989){logger[_0x58ba('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x63c802,util[_0x58ba('0xf')](_0x4ba989,{'showHidden':![],'depth':null}));_0x57a2e5(_0x58ba('0x10'));}else if(!_0x11aa55){logger[_0x58ba('0xe')](_0x58ba('0x11'),_0x63c802);_0x57a2e5(_0x58ba('0x10'));}else{_0x44bf4d(_0x11aa55);}});}catch(_0x5b6cc0){_0x57a2e5(_0x5b6cc0);}});}function ActiveDirectoryAuthenticate(_0x2be273,_0x235a5a,_0x4c5cd1,_0x43107d){var _0x3dbbdb,_0x464b8e;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x58ba('0x12'),_0x235a5a);return _0x43107d(null,![],{'message':_0x58ba('0x10')});}return db['Setting'][_0x58ba('0x13')]({'where':{'id':0x1},'attributes':[_0x58ba('0x14'),_0x58ba('0x15')],'raw':!![]})['then'](function(_0x5783de){_0x3dbbdb=_0x5783de;if(!_0x3dbbdb[_0x58ba('0x14')]){logger[_0x58ba('0xe')](_0x58ba('0x16'),_0x235a5a);throw new Error(_0x58ba('0x10'));}return _0x2be273[_0x58ba('0x13')]({'attributes':['id',_0x58ba('0x17'),_0x58ba('0x18'),_0x58ba('0x19'),_0x58ba('0x1a'),_0x58ba('0x1b'),_0x58ba('0x1c'),_0x58ba('0x1d'),_0x58ba('0x1e')],'where':{'name':_0x235a5a,'role':{'$or':['admin',_0x58ba('0x1f'),'agent']},'adSsoEnabled':!![]}});})[_0x58ba('0x20')](function(_0x78c779){if(!_0x78c779||_0x78c779&&_0x78c779[_0x58ba('0x17')]!==_0x235a5a){throw new Error(_0x58ba('0x10'));}_0x464b8e=_0x78c779;var _0x3d8b11=_0x464b8e[_0x58ba('0x17')]+'@'+config['activedirectory'][_0x58ba('0xd')];return adAuthenticate(config['activedirectory'],_0x3d8b11,_0x4c5cd1);})[_0x58ba('0x20')](function(_0x56d333){if(_0x464b8e[_0x58ba('0x1b')]){throw new Error(_0x58ba('0x10'));}if(_0x3dbbdb[_0x58ba('0x15')]>0x0){if(_0x464b8e[_0x58ba('0x1c')]){if(moment(_0x464b8e[_0x58ba('0x1d')])['add'](_0x3dbbdb[_0x58ba('0x15')],'minutes')>moment()){throw new Error(_0x58ba('0x10'));}return utils['clearBlockUser'](_0x464b8e,0x0,![],null)[_0x58ba('0x20')](function(){return utils['getLicense'](_0x464b8e);})[_0x58ba('0x20')](function(){return _0x43107d(null,_0x464b8e);});}else{return utils[_0x58ba('0x21')](_0x464b8e)[_0x58ba('0x20')](function(){return _0x43107d(null,_0x464b8e);});}}else{return utils[_0x58ba('0x21')](_0x464b8e)['then'](function(){return _0x43107d(null,_0x464b8e);});}})['catch'](function(_0x13e87b){return _0x43107d(null,![],_0x13e87b);});}function handleError(_0x596236,_0x30238b,_0x14cf8a){return _0x596236['status'](_0x30238b||0x1f4)['send']({'message':_0x14cf8a?_0x14cf8a['message']||_0x14cf8a:''});}exports['login']=function(_0x7d7698,_0x157ed0,_0x40fa38){passport[_0x58ba('0x22')](_0x58ba('0x23'),function(_0x447638,_0x4abae0,_0x50c59e){var _0x4651fa=_0x447638||_0x50c59e;if(_0x4651fa){return handleError(_0x157ed0,0x191,_0x4651fa);}if(!_0x4abae0){return handleError(_0x157ed0,0x194,{'message':_0x58ba('0x24')});}else{var _0x36714c={'payload':{'id':_0x4abae0['id'],'role':_0x4abae0[_0x58ba('0x1a')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x36714c)['then'](function(_0x3cd688){_0x157ed0[_0x58ba('0x25')]({'id':_0x4abae0['id'],'token':_0x3cd688,'statusCall':'','isAlreadyLogged':_0x4abae0[_0x58ba('0x1e')]});});}})(_0x7d7698,_0x157ed0,_0x40fa38);};passport[_0x58ba('0x26')](_0x58ba('0x23'),new LocalStrategy({'usernameField':'name','passwordField':_0x58ba('0x18')},function(_0x13aefd,_0x288d61,_0x3bbb99){return ActiveDirectoryAuthenticate(db[_0x58ba('0x27')],_0x13aefd,_0x288d61,_0x3bbb99);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 0790430..0c29f7d 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 _0x7cf7=['Router','./authActiveDirectory.controller','post','login','express'];(function(_0x13a201,_0x54bc68){var _0x1c2040=function(_0xaeca05){while(--_0xaeca05){_0x13a201['push'](_0x13a201['shift']());}};_0x1c2040(++_0x54bc68);}(_0x7cf7,0x1b2));var _0x77cf=function(_0x21ed11,_0x4ff1f7){_0x21ed11=_0x21ed11-0x0;var _0x126e3=_0x7cf7[_0x21ed11];return _0x126e3;};'use strict';var express=require(_0x77cf('0x0'));var router=express[_0x77cf('0x1')]();var controller=require(_0x77cf('0x2'));router[_0x77cf('0x3')]('/',controller[_0x77cf('0x4')]);module['exports']=router; \ No newline at end of file +var _0xace5=['login','exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xace5,0x1ca));var _0x5ace=function(_0x55bb3e,_0x55846c){_0x55bb3e=_0x55bb3e-0x0;var _0x335c3f=_0xace5[_0x55bb3e];return _0x335c3f;};'use strict';var express=require(_0x5ace('0x0'));var router=express[_0x5ace('0x1')]();var controller=require(_0x5ace('0x2'));router[_0x5ace('0x3')]('/',controller[_0x5ace('0x4')]);module[_0x5ace('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index f6b181c..27a5829 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(_0x52d837,_0x385684){var _0x46890e=function(_0x3045d7){while(--_0x3045d7){_0x52d837['push'](_0x52d837['shift']());}};_0x46890e(++_0x385684);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x3840fc,_0x403990){var _0x1af7ae=function(_0x4153b3){while(--_0x4153b3){_0x3840fc['push'](_0x3840fc['shift']());}};_0x1af7ae(++_0x403990);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index f1aec19..6cfd8e6 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 _0x26b7=['Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport'];(function(_0x343e89,_0x9ca261){var _0x1c3623=function(_0x25410f){while(--_0x25410f){_0x343e89['push'](_0x343e89['shift']());}};_0x1c3623(++_0x9ca261);}(_0x26b7,0x16a));var _0x726b=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x26b7[_0x465a0c];return _0x1e202e;};'use strict';var express=require(_0x726b('0x0'));var passport=require(_0x726b('0x1'));var router=express[_0x726b('0x2')]();var controller=require(_0x726b('0x3'));var userController=require(_0x726b('0x4'));var authService=require(_0x726b('0x5'));router[_0x726b('0x6')]('/',controller[_0x726b('0x7')]);router[_0x726b('0x6')](_0x726b('0x8'),controller[_0x726b('0x9')],authService[_0x726b('0xa')],userController['login'],authService[_0x726b('0xb')]);module[_0x726b('0xc')]=router; \ No newline at end of file +var _0xb555=['exports','express','passport','Router','./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie'];(function(_0x5d8c9a,_0x5858ea){var _0x45d9a5=function(_0x506850){while(--_0x506850){_0x5d8c9a['push'](_0x5d8c9a['shift']());}};_0x45d9a5(++_0x5858ea);}(_0xb555,0xe5));var _0x5b55=function(_0x4d0b53,_0xb4d39a){_0x4d0b53=_0x4d0b53-0x0;var _0x3638db=_0xb555[_0x4d0b53];return _0x3638db;};'use strict';var express=require(_0x5b55('0x0'));var passport=require(_0x5b55('0x1'));var router=express[_0x5b55('0x2')]();var controller=require(_0x5b55('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0x5b55('0x4'));router[_0x5b55('0x5')]('/',controller[_0x5b55('0x6')]);router[_0x5b55('0x5')](_0x5b55('0x7'),controller[_0x5b55('0x8')],authService[_0x5b55('0x9')],userController['login'],authService[_0x5b55('0xa')]);module[_0x5b55('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 0641f07..cbb788a 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 _0xa7ba=['token','now','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','Setting','allowedLoginAttempts','blockDuration','name','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','request','SendMail','message','stringify','error','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','findOne','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','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://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset'];(function(_0x34b87f,_0x28aef2){var _0x449805=function(_0x3735b7){while(--_0x3735b7){_0x34b87f['push'](_0x34b87f['shift']());}};_0x449805(++_0x28aef2);}(_0xa7ba,0x1aa));var _0xaa7b=function(_0x3a683a,_0x353ce3){_0x3a683a=_0x3a683a-0x0;var _0x8e4b97=_0xa7ba[_0x3a683a];return _0x8e4b97;};'use strict';var util=require(_0xaa7b('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0xaa7b('0x1')];var jayson=require(_0xaa7b('0x2'));var _=require(_0xaa7b('0x3'));var rs=require(_0xaa7b('0x4'));var moment=require(_0xaa7b('0x5'));var db=require(_0xaa7b('0x6'))['db'];var authService=require(_0xaa7b('0x7'));var utils=require('../../config/utils');var client=jayson[_0xaa7b('0x8')][_0xaa7b('0x9')]({'port':0x232b});function localAuthenticate(_0x2bca95,_0x3bfd84,_0x45e5fa,_0x592e92){var _0x54274e,_0x4b6b99;return db[_0xaa7b('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xaa7b('0xb'),_0xaa7b('0xc')],'raw':!![]})['then'](function(_0x1c8dc0){_0x54274e=_0x1c8dc0;return _0x2bca95['findOne']({'attributes':['id',_0xaa7b('0xd'),'password','salt',_0xaa7b('0xe'),_0xaa7b('0xf'),_0xaa7b('0x10'),_0xaa7b('0x11'),_0xaa7b('0x12')],'where':{'name':_0x3bfd84,'role':{'$or':[_0xaa7b('0x13'),_0xaa7b('0x14'),_0xaa7b('0x15')]}}});})[_0xaa7b('0x16')](function(_0x5300cf){if(!_0x5300cf||_0x5300cf&&_0x5300cf[_0xaa7b('0xd')]!==_0x3bfd84){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x4b6b99=_0x5300cf;return _0x4b6b99;}})[_0xaa7b('0x16')](function(){_0x4b6b99[_0xaa7b('0x17')](_0x45e5fa,function(_0x384bbf,_0xc35dfa){var _0x1e59c2=_0x4b6b99[_0xaa7b('0x12')]+0x1;if(_0x384bbf){return _0x592e92(_0x384bbf);}else if(!_0xc35dfa){if(_0x4b6b99['disabled']){return _0x592e92(null,![],{'message':_0xaa7b('0x18')});}else if(_0x54274e[_0xaa7b('0xb')]>0x0){if(_0x4b6b99[_0xaa7b('0x10')]){if(_0x54274e[_0xaa7b('0xc')]>0x0){if(moment(_0x4b6b99[_0xaa7b('0x11')])['add'](_0x54274e[_0xaa7b('0xc')],_0xaa7b('0x19'))>moment()){return _0x592e92(null,![],{'message':_0xaa7b('0x18')});}else{return utils['clearBlockUser'](_0x4b6b99,_0x1e59c2,![],null)[_0xaa7b('0x16')](function(){return _0x592e92(null,![],{'message':_0xaa7b('0x18')});});}}else{return _0x592e92(null,![],{'message':_0xaa7b('0x18')});}}else{if(_0x1e59c2>=_0x54274e['allowedLoginAttempts']){return utils[_0xaa7b('0x1a')](_0x4b6b99,0x0,!![],moment())[_0xaa7b('0x16')](function(){return _0x592e92(null,![],{'message':_0xaa7b('0x18')});});}else{return utils[_0xaa7b('0x1a')](_0x4b6b99,_0x1e59c2,![],null)[_0xaa7b('0x16')](function(){return _0x592e92(null,![],{'message':_0xaa7b('0x18')});});}}}else{return _0x592e92(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4b6b99[_0xaa7b('0xf')]){return _0x592e92(null,![],{'message':_0xaa7b('0x18')});}else if(_0x54274e['allowedLoginAttempts']>0x0){if(_0x4b6b99[_0xaa7b('0x10')]){if(_0x54274e[_0xaa7b('0xc')]>0x0){if(moment(_0x4b6b99[_0xaa7b('0x11')])[_0xaa7b('0x1b')](_0x54274e[_0xaa7b('0xc')],_0xaa7b('0x19'))>moment()){return _0x592e92(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xaa7b('0x1a')](_0x4b6b99,0x0,![],null)[_0xaa7b('0x16')](function(){return utils['getLicense'](_0x4b6b99);})[_0xaa7b('0x16')](function(){return _0x592e92(null,_0x4b6b99);});}}else{return _0x592e92(null,![],{'message':_0xaa7b('0x18')});}}else{return utils[_0xaa7b('0x1a')](_0x4b6b99,0x0,![],null)['then'](function(){return utils[_0xaa7b('0x1c')](_0x4b6b99);})['then'](function(){return _0x592e92(null,_0x4b6b99);})[_0xaa7b('0x1d')](function(_0x3865d7){return _0x592e92(null,![],_0x3865d7);});}}else{if(_0x4b6b99[_0xaa7b('0x10')]){return _0x592e92(null,![],{'message':_0xaa7b('0x18')});}else{return utils[_0xaa7b('0x1c')](_0x4b6b99)['then'](function(){return _0x592e92(null,_0x4b6b99);});}}}});})[_0xaa7b('0x1d')](function(_0x439cb0){return _0x592e92(null,![],_0x439cb0);});}function sendServiceMail(_0x5efae7){return db[_0xaa7b('0x1e')][_0xaa7b('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0xaa7b('0x20')],'include':[{'model':db['MailServerOut'],'as':_0xaa7b('0x21'),'include':[{'model':db[_0xaa7b('0x22')],'as':'CloudProvider'}]}]})['then'](function(_0x38b9d3){if(!_0x38b9d3){throw new Error(_0xaa7b('0x23'));}var _0x452917=_0x38b9d3['getSmtpOptions']();var _0x5195e2={'account':_0x452917,'message':_[_0xaa7b('0x24')]({'from':util[_0xaa7b('0x25')](_0xaa7b('0x26'),_0x38b9d3['name'],_0x38b9d3[_0xaa7b('0x20')]||_0x38b9d3[_0xaa7b('0x21')]['user'])},_0x5efae7)};return client[_0xaa7b('0x27')](_0xaa7b('0x28'),_0x5195e2);})['then'](function(_0x4f4c80){if(_0x4f4c80['error']){throw new Error(util[_0xaa7b('0x25')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x4f4c80['error'][_0xaa7b('0x29')]||JSON[_0xaa7b('0x2a')](_0x4f4c80[_0xaa7b('0x2b')])));}return!![];});}function handleError(_0x354e4f,_0x148fce,_0x30b0d5){return _0x354e4f[_0xaa7b('0x2c')](_0x148fce||0x1f4)[_0xaa7b('0x2d')]({'message':_0x30b0d5?_0x30b0d5['message']||_0x30b0d5:''});}exports['login']=function(_0xe2550e,_0x3a8ee1,_0x918ba){passport[_0xaa7b('0x17')](_0xaa7b('0x2e'),function(_0x52f5f0,_0x3f70a0,_0xe28a50){var _0x3ce630=_0x52f5f0||_0xe28a50;if(_0x3ce630){return handleError(_0x3a8ee1,0x191,_0x3ce630);}if(!_0x3f70a0){return handleError(_0x3a8ee1,0x194,{'message':_0xaa7b('0x2f')});}else{var _0x4c8f1a={'payload':{'id':_0x3f70a0['id'],'role':_0x3f70a0[_0xaa7b('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0xaa7b('0x30')](_0x4c8f1a)[_0xaa7b('0x16')](function(_0x375bac){_0x3a8ee1[_0xaa7b('0x31')]({'id':_0x3f70a0['id'],'token':_0x375bac,'statusCall':'','isAlreadyLogged':_0x3f70a0[_0xaa7b('0x32')]});});}})(_0xe2550e,_0x3a8ee1,_0x918ba);};exports[_0xaa7b('0x33')]=function(_0x154000,_0x116372){if(!_0x154000[_0xaa7b('0x34')][_0xaa7b('0x20')]){return handleError(_0x116372,0x1f4,{'message':_0xaa7b('0x35')});}var _0x347e62=rs[_0xaa7b('0x36')]();_0x154000[_0xaa7b('0x34')][_0xaa7b('0x20')]=_0x154000['body'][_0xaa7b('0x20')][_0xaa7b('0x37')]()[_0xaa7b('0x38')]();var _0x1ac325;return db[_0xaa7b('0xa')][_0xaa7b('0x39')]({'where':{'id':0x1},'attributes':[_0xaa7b('0xb'),_0xaa7b('0xc')],'raw':!![]})[_0xaa7b('0x16')](function(_0x19f591){_0x1ac325=_0x19f591;return db[_0xaa7b('0x3a')][_0xaa7b('0x1f')]({'where':{'email':_0x154000[_0xaa7b('0x34')][_0xaa7b('0x20')]}});})[_0xaa7b('0x16')](function(_0x2d7a45){if(!_0x2d7a45){throw new Error(_0xaa7b('0x3b'));}if(_0x2d7a45[_0xaa7b('0xf')]){throw new Error(_0xaa7b('0x3c'));}if(_0x2d7a45['blocked']){if(moment(_0x2d7a45[_0xaa7b('0x11')])[_0xaa7b('0x1b')](_0x1ac325[_0xaa7b('0xc')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x2d7a45[_0xaa7b('0x10')]=![];_0x2d7a45[_0xaa7b('0x11')]=null;}}_0x2d7a45[_0xaa7b('0x3d')]=_0x347e62;_0x2d7a45[_0xaa7b('0x3e')]=Date['now']()+0x36ee80;return _0x2d7a45[_0xaa7b('0x3f')]();})[_0xaa7b('0x16')](function(){return sendServiceMail({'to':_0x154000[_0xaa7b('0x34')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xaa7b('0x40')+_0xaa7b('0x41')+_0xaa7b('0x42')+_0x154000['headers'][_0xaa7b('0x43')]+_0xaa7b('0x44')+_0x347e62+'\x0a\x0a'+_0xaa7b('0x45')});})[_0xaa7b('0x16')](function(){_0x116372[_0xaa7b('0x2c')](0xc8)[_0xaa7b('0x2d')]({'message':_0xaa7b('0x46')});})[_0xaa7b('0x1d')](function(_0x41cd22){return handleError(_0x116372,0x1f4,_0x41cd22);});};exports[_0xaa7b('0x47')]=function(_0x22bd7b,_0x1e3927){return db[_0xaa7b('0x3a')]['find']({'where':{'resetPasswordToken':_0x22bd7b['params'][_0xaa7b('0x48')],'resetPasswordExpires':{'$gt':Date[_0xaa7b('0x49')]()}}})[_0xaa7b('0x16')](function(_0x46d39c){if(!_0x46d39c){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xaa7b('0xa')]['findOne']({'attributes':['id',_0xaa7b('0x4a'),_0xaa7b('0x4b'),_0xaa7b('0x4c')]})['then'](function(_0x12a215){if(_0x12a215[_0xaa7b('0x4a')])authService[_0xaa7b('0x4d')](_0x22bd7b[_0xaa7b('0x34')][_0xaa7b('0x4e')]);if(!_0x12a215[_0xaa7b('0x4b')]||!_0x46d39c[_0xaa7b('0x4f')])return _0x46d39c;authService[_0xaa7b('0x50')](_0x22bd7b[_0xaa7b('0x34')][_0xaa7b('0x4e')],_0x46d39c['previousPasswords'],_0x12a215[_0xaa7b('0x4c')]);return _0x46d39c;})[_0xaa7b('0x16')](function(){_0x46d39c[_0xaa7b('0x4e')]=_0x22bd7b[_0xaa7b('0x34')][_0xaa7b('0x4e')];_0x46d39c[_0xaa7b('0x3d')]=null;_0x46d39c[_0xaa7b('0x3e')]=null;return _0x46d39c['save']();});})[_0xaa7b('0x16')](function(){_0x1e3927[_0xaa7b('0x2c')](0xc8)[_0xaa7b('0x2d')]({'message':_0xaa7b('0x51')});})[_0xaa7b('0x1d')](function(_0x50dc81){return handleError(_0x1e3927,0x1f4,_0x50dc81);});};passport[_0xaa7b('0x52')](_0xaa7b('0x2e'),new LocalStrategy({'usernameField':_0xaa7b('0xd'),'passwordField':'password'},function(_0x369ed1,_0x2e702e,_0x9478cb){return localAuthenticate(db['User'],_0x369ed1,_0x2e702e,_0x9478cb);})); \ No newline at end of file +var _0x9d27=['signToken','json','online','generate','trim','toLowerCase','User','body','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','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','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','password','enforcePasswordHistory','validatePasswordHistory','previousPasswords','passwordHistoryLimit','use','util','passport','jayson/promise','randomstring','moment','../../components/auth/service','../../config/utils','client','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','salt','role','disabled','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','email','Smtp','user','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0xe19c82,_0x2e9ec9){var _0x60433d=function(_0xaf76a7){while(--_0xaf76a7){_0xe19c82['push'](_0xe19c82['shift']());}};_0x60433d(++_0x2e9ec9);}(_0x9d27,0xcd));var _0x79d2=function(_0x34b6aa,_0x5ddd29){_0x34b6aa=_0x34b6aa-0x0;var _0x3ead29=_0x9d27[_0x34b6aa];return _0x3ead29;};'use strict';var util=require(_0x79d2('0x0'));var passport=require(_0x79d2('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0x79d2('0x2'));var _=require('lodash');var rs=require(_0x79d2('0x3'));var moment=require(_0x79d2('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x79d2('0x5'));var utils=require(_0x79d2('0x6'));var client=jayson[_0x79d2('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x221af7,_0x2fe8fc,_0x5c5720,_0x36a09a){var _0x3b521c,_0x24f06c;return db[_0x79d2('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x79d2('0x9'),_0x79d2('0xa')],'raw':!![]})[_0x79d2('0xb')](function(_0x7b01fa){_0x3b521c=_0x7b01fa;return _0x221af7[_0x79d2('0xc')]({'attributes':['id',_0x79d2('0xd'),'password',_0x79d2('0xe'),_0x79d2('0xf'),_0x79d2('0x10'),'blocked',_0x79d2('0x11'),_0x79d2('0x12')],'where':{'name':_0x2fe8fc,'role':{'$or':[_0x79d2('0x13'),'user',_0x79d2('0x14')]}}});})[_0x79d2('0xb')](function(_0x309c02){if(!_0x309c02||_0x309c02&&_0x309c02[_0x79d2('0xd')]!==_0x2fe8fc){throw new Error(_0x79d2('0x15'));}else{_0x24f06c=_0x309c02;return _0x24f06c;}})['then'](function(){_0x24f06c[_0x79d2('0x16')](_0x5c5720,function(_0xd283c9,_0x563461){var _0x569e33=_0x24f06c[_0x79d2('0x12')]+0x1;if(_0xd283c9){return _0x36a09a(_0xd283c9);}else if(!_0x563461){if(_0x24f06c['disabled']){return _0x36a09a(null,![],{'message':_0x79d2('0x15')});}else if(_0x3b521c[_0x79d2('0x9')]>0x0){if(_0x24f06c[_0x79d2('0x17')]){if(_0x3b521c[_0x79d2('0xa')]>0x0){if(moment(_0x24f06c['blockedAt'])[_0x79d2('0x18')](_0x3b521c[_0x79d2('0xa')],_0x79d2('0x19'))>moment()){return _0x36a09a(null,![],{'message':_0x79d2('0x15')});}else{return utils[_0x79d2('0x1a')](_0x24f06c,_0x569e33,![],null)[_0x79d2('0xb')](function(){return _0x36a09a(null,![],{'message':_0x79d2('0x15')});});}}else{return _0x36a09a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x569e33>=_0x3b521c[_0x79d2('0x9')]){return utils['clearBlockUser'](_0x24f06c,0x0,!![],moment())[_0x79d2('0xb')](function(){return _0x36a09a(null,![],{'message':_0x79d2('0x15')});});}else{return utils[_0x79d2('0x1a')](_0x24f06c,_0x569e33,![],null)[_0x79d2('0xb')](function(){return _0x36a09a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x36a09a(null,![],{'message':_0x79d2('0x15')});}}else{if(_0x24f06c[_0x79d2('0x10')]){return _0x36a09a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3b521c[_0x79d2('0x9')]>0x0){if(_0x24f06c[_0x79d2('0x17')]){if(_0x3b521c[_0x79d2('0xa')]>0x0){if(moment(_0x24f06c['blockedAt'])[_0x79d2('0x18')](_0x3b521c[_0x79d2('0xa')],_0x79d2('0x19'))>moment()){return _0x36a09a(null,![],{'message':_0x79d2('0x15')});}else{return utils[_0x79d2('0x1a')](_0x24f06c,0x0,![],null)['then'](function(){return utils[_0x79d2('0x1b')](_0x24f06c);})['then'](function(){return _0x36a09a(null,_0x24f06c);});}}else{return _0x36a09a(null,![],{'message':_0x79d2('0x15')});}}else{return utils[_0x79d2('0x1a')](_0x24f06c,0x0,![],null)[_0x79d2('0xb')](function(){return utils[_0x79d2('0x1b')](_0x24f06c);})[_0x79d2('0xb')](function(){return _0x36a09a(null,_0x24f06c);})[_0x79d2('0x1c')](function(_0x59382d){return _0x36a09a(null,![],_0x59382d);});}}else{if(_0x24f06c[_0x79d2('0x17')]){return _0x36a09a(null,![],{'message':_0x79d2('0x15')});}else{return utils[_0x79d2('0x1b')](_0x24f06c)['then'](function(){return _0x36a09a(null,_0x24f06c);});}}}});})[_0x79d2('0x1c')](function(_0x2280eb){return _0x36a09a(null,![],_0x2280eb);});}function sendServiceMail(_0x4f4407){return db[_0x79d2('0x1d')][_0x79d2('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x79d2('0xd'),'email'],'include':[{'model':db[_0x79d2('0x1f')],'as':'Smtp','include':[{'model':db[_0x79d2('0x20')],'as':_0x79d2('0x20')}]}]})['then'](function(_0xcc1d80){if(!_0xcc1d80){throw new Error(_0x79d2('0x21'));}var _0x4bc086=_0xcc1d80[_0x79d2('0x22')]();var _0x583655={'account':_0x4bc086,'message':_[_0x79d2('0x23')]({'from':util[_0x79d2('0x24')]('\x22%s\x22\x20<%s>',_0xcc1d80[_0x79d2('0xd')],_0xcc1d80[_0x79d2('0x25')]||_0xcc1d80[_0x79d2('0x26')][_0x79d2('0x27')])},_0x4f4407)};return client['request'](_0x79d2('0x28'),_0x583655);})[_0x79d2('0xb')](function(_0xae6f26){if(_0xae6f26[_0x79d2('0x29')]){throw new Error(util[_0x79d2('0x24')](_0x79d2('0x2a'),_0xae6f26['error'][_0x79d2('0x2b')]||JSON[_0x79d2('0x2c')](_0xae6f26[_0x79d2('0x29')])));}return!![];});}function handleError(_0x46d06b,_0x141569,_0x4ce9eb){return _0x46d06b[_0x79d2('0x2d')](_0x141569||0x1f4)[_0x79d2('0x2e')]({'message':_0x4ce9eb?_0x4ce9eb['message']||_0x4ce9eb:''});}exports[_0x79d2('0x2f')]=function(_0x2f0c6b,_0x1e02d6,_0x5dc7d6){passport[_0x79d2('0x16')](_0x79d2('0x30'),function(_0x20ce31,_0x867957,_0x5a6c53){var _0x575511=_0x20ce31||_0x5a6c53;if(_0x575511){return handleError(_0x1e02d6,0x191,_0x575511);}if(!_0x867957){return handleError(_0x1e02d6,0x194,{'message':_0x79d2('0x31')});}else{var _0x176d74={'payload':{'id':_0x867957['id'],'role':_0x867957[_0x79d2('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x79d2('0x32')](_0x176d74)[_0x79d2('0xb')](function(_0x1261c5){_0x1e02d6[_0x79d2('0x33')]({'id':_0x867957['id'],'token':_0x1261c5,'statusCall':'','isAlreadyLogged':_0x867957[_0x79d2('0x34')]});});}})(_0x2f0c6b,_0x1e02d6,_0x5dc7d6);};exports['forgot']=function(_0x183da7,_0x2470a5){if(!_0x183da7['body'][_0x79d2('0x25')]){return handleError(_0x2470a5,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x4141c8=rs[_0x79d2('0x35')]();_0x183da7['body']['email']=_0x183da7['body'][_0x79d2('0x25')][_0x79d2('0x36')]()[_0x79d2('0x37')]();var _0x510a2b;return db[_0x79d2('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x79d2('0x9'),_0x79d2('0xa')],'raw':!![]})['then'](function(_0x27a339){_0x510a2b=_0x27a339;return db[_0x79d2('0x38')][_0x79d2('0x1e')]({'where':{'email':_0x183da7[_0x79d2('0x39')]['email']}});})['then'](function(_0x364353){if(!_0x364353){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x364353[_0x79d2('0x10')]){throw new Error(_0x79d2('0x3a'));}if(_0x364353[_0x79d2('0x17')]){if(moment(_0x364353[_0x79d2('0x11')])[_0x79d2('0x18')](_0x510a2b[_0x79d2('0xa')],'minutes')>moment()){throw new Error(_0x79d2('0x3b'));}else{_0x364353[_0x79d2('0x17')]=![];_0x364353[_0x79d2('0x11')]=null;}}_0x364353[_0x79d2('0x3c')]=_0x4141c8;_0x364353[_0x79d2('0x3d')]=Date[_0x79d2('0x3e')]()+0x36ee80;return _0x364353[_0x79d2('0x3f')]();})[_0x79d2('0xb')](function(){return sendServiceMail({'to':_0x183da7[_0x79d2('0x39')][_0x79d2('0x25')],'subject':_0x79d2('0x40'),'text':_0x79d2('0x41')+_0x79d2('0x42')+_0x79d2('0x43')+_0x183da7[_0x79d2('0x44')][_0x79d2('0x45')]+_0x79d2('0x46')+_0x4141c8+'\x0a\x0a'+_0x79d2('0x47')});})[_0x79d2('0xb')](function(){_0x2470a5['status'](0xc8)[_0x79d2('0x2e')]({'message':_0x79d2('0x48')});})[_0x79d2('0x1c')](function(_0x382434){return handleError(_0x2470a5,0x1f4,_0x382434);});};exports[_0x79d2('0x49')]=function(_0x43994c,_0x56586d){return db['User'][_0x79d2('0x1e')]({'where':{'resetPasswordToken':_0x43994c[_0x79d2('0x4a')][_0x79d2('0x4b')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x79d2('0xb')](function(_0x5e9171){if(!_0x5e9171){throw new Error(_0x79d2('0x4c'));}return db[_0x79d2('0x8')][_0x79d2('0xc')]({'attributes':['id',_0x79d2('0x4d'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x79d2('0xb')](function(_0x9bf9c2){if(_0x9bf9c2[_0x79d2('0x4d')])authService[_0x79d2('0x4e')](_0x43994c[_0x79d2('0x39')][_0x79d2('0x4f')]);if(!_0x9bf9c2[_0x79d2('0x50')]||!_0x5e9171['previousPasswords'])return _0x5e9171;authService[_0x79d2('0x51')](_0x43994c[_0x79d2('0x39')][_0x79d2('0x4f')],_0x5e9171[_0x79d2('0x52')],_0x9bf9c2[_0x79d2('0x53')]);return _0x5e9171;})['then'](function(){_0x5e9171[_0x79d2('0x4f')]=_0x43994c['body'][_0x79d2('0x4f')];_0x5e9171[_0x79d2('0x3c')]=null;_0x5e9171['resetPasswordExpires']=null;return _0x5e9171[_0x79d2('0x3f')]();});})[_0x79d2('0xb')](function(){_0x56586d['status'](0xc8)[_0x79d2('0x2e')]({'message':'Password\x20reset!'});})['catch'](function(_0x7ba7aa){return handleError(_0x56586d,0x1f4,_0x7ba7aa);});};passport[_0x79d2('0x54')](_0x79d2('0x30'),new LocalStrategy({'usernameField':_0x79d2('0xd'),'passwordField':'password'},function(_0x10b13f,_0x2186de,_0x2fb732){return localAuthenticate(db[_0x79d2('0x38')],_0x10b13f,_0x2186de,_0x2fb732);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 436bb8f..d39329e 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 _0xe48a=['Router','./authLocal.controller','post','login','/forgot','/reset/:token','reset'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0xe48a,0x1e3));var _0xae48=function(_0xf43cb,_0x465374){_0xf43cb=_0xf43cb-0x0;var _0x14e869=_0xe48a[_0xf43cb];return _0x14e869;};'use strict';var express=require('express');var router=express[_0xae48('0x0')]();var controller=require(_0xae48('0x1'));router[_0xae48('0x2')]('/',controller[_0xae48('0x3')]);router[_0xae48('0x2')](_0xae48('0x4'),controller['forgot']);router['post'](_0xae48('0x5'),controller[_0xae48('0x6')]);module['exports']=router; \ No newline at end of file +var _0x248c=['/reset/:token','exports','express','Router','./authLocal.controller','post','login','forgot'];(function(_0x1c95d5,_0xc1059b){var _0x20f69b=function(_0x18128b){while(--_0x18128b){_0x1c95d5['push'](_0x1c95d5['shift']());}};_0x20f69b(++_0xc1059b);}(_0x248c,0x10a));var _0xc248=function(_0x18b42a,_0x226226){_0x18b42a=_0x18b42a-0x0;var _0x4e3ed3=_0x248c[_0x18b42a];return _0x4e3ed3;};'use strict';var express=require(_0xc248('0x0'));var router=express[_0xc248('0x1')]();var controller=require(_0xc248('0x2'));router[_0xc248('0x3')]('/',controller[_0xc248('0x4')]);router['post']('/forgot',controller[_0xc248('0x5')]);router[_0xc248('0x3')](_0xc248('0x6'),controller['reset']);module[_0xc248('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 39d2a12..e9a42cb 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 _0xee69=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x2aa997,_0x35e10a){var _0x279a25=function(_0x45d656){while(--_0x45d656){_0x2aa997['push'](_0x2aa997['shift']());}};_0x279a25(++_0x35e10a);}(_0xee69,0x92));var _0x9ee6=function(_0x1327c6,_0x5ccd76){_0x1327c6=_0x1327c6-0x0;var _0x2cadd2=_0xee69[_0x1327c6];return _0x2cadd2;};'use strict';var Sequelize=require(_0x9ee6('0x0'));module[_0x9ee6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x9ee6('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x9ee6('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9ee6('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x042a=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x2e54cb,_0x268ff3){var _0x2aedfc=function(_0x3a05e3){while(--_0x3a05e3){_0x2e54cb['push'](_0x2e54cb['shift']());}};_0x2aedfc(++_0x268ff3);}(_0x042a,0x14c));var _0xa042=function(_0x4f993a,_0x1f3a4b){_0x4f993a=_0x4f993a-0x0;var _0xaaaef6=_0x042a[_0x4f993a];return _0xaaaef6;};'use strict';var Sequelize=require(_0xa042('0x0'));module[_0xa042('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xa042('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xa042('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa042('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 529f4bc..05342e1 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 _0xbd66=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','update','Condition','addConditions','ids','getConditions','findOne','rawAttributes','order','addActions','Action','omit','getActions','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','error','stack','name','send','map','Automation','fieldName','type'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xbd66,0x177));var _0x6bd6=function(_0x55e12b,_0x3bbb99){_0x55e12b=_0x55e12b-0x0;var _0x507b79=_0xbd66[_0x55e12b];return _0x507b79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6bd6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6bd6('0x1'));var moment=require(_0x6bd6('0x2'));var BPromise=require(_0x6bd6('0x3'));var Mustache=require(_0x6bd6('0x4'));var util=require('util');var path=require(_0x6bd6('0x5'));var sox=require(_0x6bd6('0x6'));var csv=require('to-csv');var ejs=require(_0x6bd6('0x7'));var fs=require('fs');var fs_extra=require(_0x6bd6('0x8'));var _=require(_0x6bd6('0x9'));var squel=require(_0x6bd6('0xa'));var crypto=require(_0x6bd6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6bd6('0xc'));var querystring=require('querystring');var Papa=require(_0x6bd6('0xd'));var Redis=require(_0x6bd6('0xe'));var authService=require(_0x6bd6('0xf'));var qs=require(_0x6bd6('0x10'));var as=require(_0x6bd6('0x11'));var hardwareService=require(_0x6bd6('0x12'));var logger=require(_0x6bd6('0x13'))(_0x6bd6('0x14'));var utils=require(_0x6bd6('0x15'));var config=require(_0x6bd6('0x16'));var licenseUtil=require(_0x6bd6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bccfd,_0x305a90){_0x305a90=_0x305a90||0xcc;return function(_0x1272db){if(_0x1272db){return _0x1bccfd[_0x6bd6('0x18')](_0x305a90);}return _0x1bccfd['status'](_0x305a90)[_0x6bd6('0x19')]();};}function respondWithResult(_0x1f7973,_0x4157ab){_0x4157ab=_0x4157ab||0xc8;return function(_0x3befd3){if(_0x3befd3){return _0x1f7973[_0x6bd6('0x1a')](_0x4157ab)[_0x6bd6('0x1b')](_0x3befd3);}};}function respondWithFilteredResult(_0x3a4b3c,_0x3cfd0f){return function(_0xd1cd14){if(_0xd1cd14){var _0x5a877b=typeof _0x3cfd0f[_0x6bd6('0x1c')]===_0x6bd6('0x1d')&&typeof _0x3cfd0f[_0x6bd6('0x1e')]===_0x6bd6('0x1d');var _0x328cbd=_0xd1cd14[_0x6bd6('0x1f')];var _0x2adb33=_0x5a877b?0x0:_0x3cfd0f[_0x6bd6('0x1c')];var _0x31173b=_0x5a877b?_0xd1cd14['count']:_0x3cfd0f[_0x6bd6('0x1c')]+_0x3cfd0f['limit'];var _0xa31c8f;if(_0x31173b>=_0x328cbd){_0x31173b=_0x328cbd;_0xa31c8f=0xc8;}else{_0xa31c8f=0xce;}_0x3a4b3c['status'](_0xa31c8f);return _0x3a4b3c[_0x6bd6('0x20')](_0x6bd6('0x21'),_0x2adb33+'-'+_0x31173b+'/'+_0x328cbd)['json'](_0xd1cd14);}return null;};}function patchUpdates(_0xbacccf){return function(_0x67243d){try{jsonpatch[_0x6bd6('0x22')](_0x67243d,_0xbacccf,!![]);}catch(_0x47ad83){return BPromise['reject'](_0x47ad83);}return _0x67243d['save']();};}function saveUpdates(_0x8e9b11,_0x16683d){return function(_0x294c09){if(_0x294c09){return _0x294c09['update'](_0x8e9b11)[_0x6bd6('0x23')](function(_0x2eb33e){return _0x2eb33e;});}return null;};}function removeEntity(_0x236fa4,_0x12392e){return function(_0x1dc809){if(_0x1dc809){return _0x1dc809[_0x6bd6('0x24')]()['then'](function(){_0x236fa4['status'](0xcc)[_0x6bd6('0x19')]();});}};}function handleEntityNotFound(_0x3f43d4,_0x4c5d25){return function(_0xcceb51){if(!_0xcceb51){_0x3f43d4[_0x6bd6('0x18')](0x194);}return _0xcceb51;};}function handleError(_0x195c26,_0x2971aa){_0x2971aa=_0x2971aa||0x1f4;return function(_0x34721f){logger[_0x6bd6('0x25')](_0x34721f[_0x6bd6('0x26')]);if(_0x34721f[_0x6bd6('0x27')]){delete _0x34721f[_0x6bd6('0x27')];}_0x195c26['status'](_0x2971aa)[_0x6bd6('0x28')](_0x34721f);};}exports['index']=function(_0x366f12,_0x52a656){var _0x23aa16={},_0x437447={},_0xd657f7={'count':0x0,'rows':[]};var _0x28a608=_[_0x6bd6('0x29')](db[_0x6bd6('0x2a')]['rawAttributes'],function(_0x5c8346){return{'name':_0x5c8346[_0x6bd6('0x2b')],'type':_0x5c8346[_0x6bd6('0x2c')][_0x6bd6('0x2d')]};});_0x437447[_0x6bd6('0x2e')]=_[_0x6bd6('0x29')](_0x28a608,_0x6bd6('0x27'));_0x437447[_0x6bd6('0x2f')]=_[_0x6bd6('0x30')](_0x366f12[_0x6bd6('0x2f')]);_0x437447[_0x6bd6('0x31')]=_[_0x6bd6('0x32')](_0x437447[_0x6bd6('0x2e')],_0x437447[_0x6bd6('0x2f')]);_0x23aa16[_0x6bd6('0x33')]=_['intersection'](_0x437447[_0x6bd6('0x2e')],qs['fields'](_0x366f12[_0x6bd6('0x2f')][_0x6bd6('0x34')]));_0x23aa16[_0x6bd6('0x33')]=_0x23aa16['attributes'][_0x6bd6('0x35')]?_0x23aa16['attributes']:_0x437447[_0x6bd6('0x2e')];if(!_0x366f12[_0x6bd6('0x2f')][_0x6bd6('0x36')](_0x6bd6('0x37'))){_0x23aa16[_0x6bd6('0x1e')]=qs[_0x6bd6('0x1e')](_0x366f12[_0x6bd6('0x2f')]['limit']);_0x23aa16[_0x6bd6('0x1c')]=qs[_0x6bd6('0x1c')](_0x366f12[_0x6bd6('0x2f')][_0x6bd6('0x1c')]);}_0x23aa16['order']=qs['sort'](_0x366f12[_0x6bd6('0x2f')][_0x6bd6('0x38')]);_0x23aa16[_0x6bd6('0x39')]=qs['filters'](_[_0x6bd6('0x3a')](_0x366f12[_0x6bd6('0x2f')],_0x437447[_0x6bd6('0x31')]),_0x28a608);if(_0x366f12[_0x6bd6('0x2f')][_0x6bd6('0x3b')]){_0x23aa16[_0x6bd6('0x39')]=_[_0x6bd6('0x3c')](_0x23aa16[_0x6bd6('0x39')],{'$or':_['map'](_0x28a608,function(_0x355946){if(_0x355946[_0x6bd6('0x2c')]!=='VIRTUAL'){var _0x91849e={};_0x91849e[_0x355946[_0x6bd6('0x27')]]={'$like':'%'+_0x366f12[_0x6bd6('0x2f')][_0x6bd6('0x3b')]+'%'};return _0x91849e;}})});}_0x23aa16=_[_0x6bd6('0x3c')]({},_0x23aa16,_0x366f12[_0x6bd6('0x3d')]);var _0x56ab41={'where':_0x23aa16[_0x6bd6('0x39')]};return db[_0x6bd6('0x2a')][_0x6bd6('0x1f')](_0x56ab41)[_0x6bd6('0x23')](function(_0x1bf5ba){_0xd657f7[_0x6bd6('0x1f')]=_0x1bf5ba;if(_0x366f12[_0x6bd6('0x2f')]['includeAll']){_0x23aa16[_0x6bd6('0x3e')]=[{'all':!![]}];}return db[_0x6bd6('0x2a')][_0x6bd6('0x3f')](_0x23aa16);})['then'](function(_0x2b3ac8){_0xd657f7[_0x6bd6('0x40')]=_0x2b3ac8;return _0xd657f7;})[_0x6bd6('0x23')](respondWithFilteredResult(_0x52a656,_0x23aa16))['catch'](handleError(_0x52a656,null));};exports[_0x6bd6('0x41')]=function(_0x98f6f0,_0x1b67ea){var _0x67ccaa={'raw':![],'where':{'id':_0x98f6f0[_0x6bd6('0x42')]['id']}},_0xb118fb={};_0xb118fb[_0x6bd6('0x2e')]=_['keys'](db[_0x6bd6('0x2a')]['rawAttributes']);_0xb118fb['query']=_[_0x6bd6('0x30')](_0x98f6f0[_0x6bd6('0x2f')]);_0xb118fb[_0x6bd6('0x31')]=_[_0x6bd6('0x32')](_0xb118fb['model'],_0xb118fb['query']);_0x67ccaa[_0x6bd6('0x33')]=_[_0x6bd6('0x32')](_0xb118fb[_0x6bd6('0x2e')],qs[_0x6bd6('0x34')](_0x98f6f0[_0x6bd6('0x2f')]['fields']));_0x67ccaa[_0x6bd6('0x33')]=_0x67ccaa[_0x6bd6('0x33')]['length']?_0x67ccaa[_0x6bd6('0x33')]:_0xb118fb['model'];if(_0x98f6f0[_0x6bd6('0x2f')][_0x6bd6('0x43')]){_0x67ccaa[_0x6bd6('0x3e')]=[{'all':!![]}];}_0x67ccaa=_[_0x6bd6('0x3c')]({},_0x67ccaa,_0x98f6f0['options']);return db[_0x6bd6('0x2a')][_0x6bd6('0x44')](_0x67ccaa)[_0x6bd6('0x23')](handleEntityNotFound(_0x1b67ea,null))[_0x6bd6('0x23')](respondWithResult(_0x1b67ea,null))[_0x6bd6('0x45')](handleError(_0x1b67ea,null));};exports['create']=function(_0x36f23b,_0x8cbe){return db[_0x6bd6('0x2a')][_0x6bd6('0x46')](_0x36f23b[_0x6bd6('0x47')],{})[_0x6bd6('0x23')](respondWithResult(_0x8cbe,0xc9))['catch'](handleError(_0x8cbe,null));};exports[_0x6bd6('0x48')]=function(_0x36226b,_0x4aee5e){if(_0x36226b[_0x6bd6('0x47')]['id']){delete _0x36226b[_0x6bd6('0x47')]['id'];}return db[_0x6bd6('0x2a')][_0x6bd6('0x44')]({'where':{'id':_0x36226b['params']['id']}})['then'](handleEntityNotFound(_0x4aee5e,null))['then'](saveUpdates(_0x36226b[_0x6bd6('0x47')],null))[_0x6bd6('0x23')](respondWithResult(_0x4aee5e,null))['catch'](handleError(_0x4aee5e,null));};exports[_0x6bd6('0x24')]=function(_0x114aad,_0x521042){return db['Automation']['find']({'where':{'id':_0x114aad[_0x6bd6('0x42')]['id']}})[_0x6bd6('0x23')](handleEntityNotFound(_0x521042,null))[_0x6bd6('0x23')](removeEntity(_0x521042,null))[_0x6bd6('0x45')](handleError(_0x521042,null));};exports['addConditions']=function(_0x16d0f8,_0x5e8fb6,_0x36d4c6){return db[_0x6bd6('0x49')][_0x6bd6('0x44')]({'where':{'id':_0x16d0f8[_0x6bd6('0x42')]['id']}})[_0x6bd6('0x23')](handleEntityNotFound(_0x5e8fb6,null))['then'](function(_0x495aba){if(_0x495aba){return _0x495aba[_0x6bd6('0x4a')](_0x16d0f8['body'][_0x6bd6('0x4b')],_['omit'](_0x16d0f8[_0x6bd6('0x47')],[_0x6bd6('0x4b'),'id'])||{});}})[_0x6bd6('0x23')](respondWithResult(_0x5e8fb6,null))[_0x6bd6('0x45')](handleError(_0x5e8fb6,null));};exports[_0x6bd6('0x4c')]=function(_0x4fd146,_0xe540a1,_0x5335a4){var _0x18db85={};var _0x21ddbc={};var _0x2dbbb1;var _0x2af209;return db['Automation'][_0x6bd6('0x4d')]({'where':{'id':_0x4fd146['params']['id']}})[_0x6bd6('0x23')](handleEntityNotFound(_0xe540a1,null))[_0x6bd6('0x23')](function(_0x400aa6){if(_0x400aa6){_0x2dbbb1=_0x400aa6;_0x21ddbc[_0x6bd6('0x2e')]=_[_0x6bd6('0x30')](db['Condition'][_0x6bd6('0x4e')]);_0x21ddbc[_0x6bd6('0x2f')]=_[_0x6bd6('0x30')](_0x4fd146[_0x6bd6('0x2f')]);_0x21ddbc['filters']=_[_0x6bd6('0x32')](_0x21ddbc[_0x6bd6('0x2e')],_0x21ddbc[_0x6bd6('0x2f')]);_0x18db85[_0x6bd6('0x33')]=_[_0x6bd6('0x32')](_0x21ddbc[_0x6bd6('0x2e')],qs[_0x6bd6('0x34')](_0x4fd146[_0x6bd6('0x2f')][_0x6bd6('0x34')]));_0x18db85['attributes']=_0x18db85[_0x6bd6('0x33')][_0x6bd6('0x35')]?_0x18db85[_0x6bd6('0x33')]:_0x21ddbc[_0x6bd6('0x2e')];_0x18db85[_0x6bd6('0x4f')]=qs[_0x6bd6('0x38')](_0x4fd146[_0x6bd6('0x2f')][_0x6bd6('0x38')]);_0x18db85['where']=qs[_0x6bd6('0x31')](_[_0x6bd6('0x3a')](_0x4fd146[_0x6bd6('0x2f')],_0x21ddbc[_0x6bd6('0x31')]));if(_0x4fd146['query'][_0x6bd6('0x3b')]){_0x18db85[_0x6bd6('0x39')]=_[_0x6bd6('0x3c')](_0x18db85['where'],{'$or':_[_0x6bd6('0x29')](_0x18db85[_0x6bd6('0x33')],function(_0x53f2a6){var _0x39b60b={};_0x39b60b[_0x53f2a6]={'$like':'%'+_0x4fd146[_0x6bd6('0x2f')][_0x6bd6('0x3b')]+'%'};return _0x39b60b;})});}_0x18db85=_[_0x6bd6('0x3c')]({},_0x18db85,_0x4fd146[_0x6bd6('0x3d')]);return _0x2dbbb1[_0x6bd6('0x4c')](_0x18db85);}})['then'](function(_0x3a82d0){if(_0x3a82d0){_0x2af209=_0x3a82d0[_0x6bd6('0x35')];if(!_0x4fd146[_0x6bd6('0x2f')][_0x6bd6('0x36')](_0x6bd6('0x37'))){_0x18db85['limit']=qs[_0x6bd6('0x1e')](_0x4fd146[_0x6bd6('0x2f')][_0x6bd6('0x1e')]);_0x18db85[_0x6bd6('0x1c')]=qs[_0x6bd6('0x1c')](_0x4fd146[_0x6bd6('0x2f')][_0x6bd6('0x1c')]);}return _0x2dbbb1['getConditions'](_0x18db85);}})['then'](function(_0x2002af){if(_0x2002af){return _0x2002af?{'count':_0x2af209,'rows':_0x2002af}:null;}})[_0x6bd6('0x23')](respondWithResult(_0xe540a1,null))[_0x6bd6('0x45')](handleError(_0xe540a1,null));};exports[_0x6bd6('0x50')]=function(_0x2602ee,_0x15503b,_0x30b2c2){return db[_0x6bd6('0x51')][_0x6bd6('0x44')]({'where':{'id':_0x2602ee[_0x6bd6('0x42')]['id']}})[_0x6bd6('0x23')](handleEntityNotFound(_0x15503b,null))[_0x6bd6('0x23')](function(_0x201c92){if(_0x201c92){return _0x201c92['addActions'](_0x2602ee[_0x6bd6('0x47')][_0x6bd6('0x4b')],_[_0x6bd6('0x52')](_0x2602ee[_0x6bd6('0x47')],[_0x6bd6('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x15503b,null))[_0x6bd6('0x45')](handleError(_0x15503b,null));};exports[_0x6bd6('0x53')]=function(_0x10ae88,_0xeb87ed,_0x571467){var _0x38cb96={};var _0x3bb52d={};var _0x1a2d93;var _0x252f13;return db[_0x6bd6('0x2a')]['findOne']({'where':{'id':_0x10ae88[_0x6bd6('0x42')]['id']}})[_0x6bd6('0x23')](handleEntityNotFound(_0xeb87ed,null))[_0x6bd6('0x23')](function(_0x3706da){if(_0x3706da){_0x1a2d93=_0x3706da;_0x3bb52d[_0x6bd6('0x2e')]=_[_0x6bd6('0x30')](db[_0x6bd6('0x51')][_0x6bd6('0x4e')]);_0x3bb52d[_0x6bd6('0x2f')]=_[_0x6bd6('0x30')](_0x10ae88['query']);_0x3bb52d[_0x6bd6('0x31')]=_[_0x6bd6('0x32')](_0x3bb52d[_0x6bd6('0x2e')],_0x3bb52d[_0x6bd6('0x2f')]);_0x38cb96[_0x6bd6('0x33')]=_[_0x6bd6('0x32')](_0x3bb52d['model'],qs[_0x6bd6('0x34')](_0x10ae88['query'][_0x6bd6('0x34')]));_0x38cb96['attributes']=_0x38cb96[_0x6bd6('0x33')][_0x6bd6('0x35')]?_0x38cb96['attributes']:_0x3bb52d['model'];_0x38cb96['order']=qs[_0x6bd6('0x38')](_0x10ae88[_0x6bd6('0x2f')][_0x6bd6('0x38')]);_0x38cb96[_0x6bd6('0x39')]=qs[_0x6bd6('0x31')](_[_0x6bd6('0x3a')](_0x10ae88[_0x6bd6('0x2f')],_0x3bb52d['filters']));if(_0x10ae88['query']['filter']){_0x38cb96[_0x6bd6('0x39')]=_['merge'](_0x38cb96['where'],{'$or':_[_0x6bd6('0x29')](_0x38cb96[_0x6bd6('0x33')],function(_0x43c648){var _0x519671={};_0x519671[_0x43c648]={'$like':'%'+_0x10ae88[_0x6bd6('0x2f')][_0x6bd6('0x3b')]+'%'};return _0x519671;})});}_0x38cb96=_[_0x6bd6('0x3c')]({},_0x38cb96,_0x10ae88[_0x6bd6('0x3d')]);return _0x1a2d93['getActions'](_0x38cb96);}})[_0x6bd6('0x23')](function(_0x441f04){if(_0x441f04){_0x252f13=_0x441f04[_0x6bd6('0x35')];if(!_0x10ae88[_0x6bd6('0x2f')][_0x6bd6('0x36')](_0x6bd6('0x37'))){_0x38cb96[_0x6bd6('0x1e')]=qs['limit'](_0x10ae88['query'][_0x6bd6('0x1e')]);_0x38cb96['offset']=qs[_0x6bd6('0x1c')](_0x10ae88[_0x6bd6('0x2f')][_0x6bd6('0x1c')]);}return _0x1a2d93[_0x6bd6('0x53')](_0x38cb96);}})[_0x6bd6('0x23')](function(_0x2f7303){if(_0x2f7303){return _0x2f7303?{'count':_0x252f13,'rows':_0x2f7303}:null;}})[_0x6bd6('0x23')](respondWithResult(_0xeb87ed,null))[_0x6bd6('0x45')](handleError(_0xeb87ed,null));}; \ No newline at end of file +var _0xade5=['limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','Automation','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','intersection','include','merge','find','create','update','body','addConditions','ids','omit','findOne','Condition','order','getConditions','Action','addActions','getActions','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','json','offset'];(function(_0x5b7eee,_0x50f167){var _0x506ad8=function(_0x11edcd){while(--_0x11edcd){_0x5b7eee['push'](_0x5b7eee['shift']());}};_0x506ad8(++_0x50f167);}(_0xade5,0x143));var _0x5ade=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xade5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ade('0x0'));var zipdir=require(_0x5ade('0x1'));var jsonpatch=require(_0x5ade('0x2'));var rp=require(_0x5ade('0x3'));var moment=require(_0x5ade('0x4'));var BPromise=require(_0x5ade('0x5'));var Mustache=require('mustache');var util=require(_0x5ade('0x6'));var path=require(_0x5ade('0x7'));var sox=require(_0x5ade('0x8'));var csv=require(_0x5ade('0x9'));var ejs=require(_0x5ade('0xa'));var fs=require('fs');var fs_extra=require(_0x5ade('0xb'));var _=require(_0x5ade('0xc'));var squel=require(_0x5ade('0xd'));var crypto=require(_0x5ade('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5ade('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5ade('0x10'));var Papa=require(_0x5ade('0x11'));var Redis=require(_0x5ade('0x12'));var authService=require(_0x5ade('0x13'));var qs=require(_0x5ade('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ade('0x15'));var logger=require(_0x5ade('0x16'))(_0x5ade('0x17'));var utils=require(_0x5ade('0x18'));var config=require(_0x5ade('0x19'));var licenseUtil=require(_0x5ade('0x1a'));var db=require(_0x5ade('0x1b'))['db'];function respondWithStatusCode(_0x2b51da,_0x35f52a){_0x35f52a=_0x35f52a||0xcc;return function(_0x2a7393){if(_0x2a7393){return _0x2b51da[_0x5ade('0x1c')](_0x35f52a);}return _0x2b51da[_0x5ade('0x1d')](_0x35f52a)[_0x5ade('0x1e')]();};}function respondWithResult(_0x34c9ad,_0x10f676){_0x10f676=_0x10f676||0xc8;return function(_0x8bdf90){if(_0x8bdf90){return _0x34c9ad[_0x5ade('0x1d')](_0x10f676)[_0x5ade('0x1f')](_0x8bdf90);}};}function respondWithFilteredResult(_0x3d19fa,_0x1dc8b3){return function(_0xf6a03c){if(_0xf6a03c){var _0x17ea65=typeof _0x1dc8b3[_0x5ade('0x20')]==='undefined'&&typeof _0x1dc8b3['limit']==='undefined';var _0x2f1f79=_0xf6a03c['count'];var _0x451d8a=_0x17ea65?0x0:_0x1dc8b3[_0x5ade('0x20')];var _0x5d0c48=_0x17ea65?_0xf6a03c['count']:_0x1dc8b3['offset']+_0x1dc8b3[_0x5ade('0x21')];var _0x102b79;if(_0x5d0c48>=_0x2f1f79){_0x5d0c48=_0x2f1f79;_0x102b79=0xc8;}else{_0x102b79=0xce;}_0x3d19fa['status'](_0x102b79);return _0x3d19fa[_0x5ade('0x22')](_0x5ade('0x23'),_0x451d8a+'-'+_0x5d0c48+'/'+_0x2f1f79)[_0x5ade('0x1f')](_0xf6a03c);}return null;};}function patchUpdates(_0x2ff7ec){return function(_0x208ee9){try{jsonpatch[_0x5ade('0x24')](_0x208ee9,_0x2ff7ec,!![]);}catch(_0x47c080){return BPromise[_0x5ade('0x25')](_0x47c080);}return _0x208ee9['save']();};}function saveUpdates(_0x367dcc,_0x56923d){return function(_0x3344ac){if(_0x3344ac){return _0x3344ac['update'](_0x367dcc)[_0x5ade('0x26')](function(_0x170102){return _0x170102;});}return null;};}function removeEntity(_0x1a8da4,_0x2741fa){return function(_0x4dcb26){if(_0x4dcb26){return _0x4dcb26[_0x5ade('0x27')]()['then'](function(){_0x1a8da4[_0x5ade('0x1d')](0xcc)[_0x5ade('0x1e')]();});}};}function handleEntityNotFound(_0x5cca47,_0x16b6a0){return function(_0x731eed){if(!_0x731eed){_0x5cca47['sendStatus'](0x194);}return _0x731eed;};}function handleError(_0x4f9628,_0x144dd0){_0x144dd0=_0x144dd0||0x1f4;return function(_0x27db87){logger[_0x5ade('0x28')](_0x27db87[_0x5ade('0x29')]);if(_0x27db87[_0x5ade('0x2a')]){delete _0x27db87[_0x5ade('0x2a')];}_0x4f9628[_0x5ade('0x1d')](_0x144dd0)[_0x5ade('0x2b')](_0x27db87);};}exports[_0x5ade('0x2c')]=function(_0x367c94,_0x4f6878){var _0x358c5b={},_0x3b6f2a={},_0x3887c8={'count':0x0,'rows':[]};var _0x154252=_['map'](db[_0x5ade('0x2d')][_0x5ade('0x2e')],function(_0x470be4){return{'name':_0x470be4[_0x5ade('0x2f')],'type':_0x470be4[_0x5ade('0x30')]['key']};});_0x3b6f2a[_0x5ade('0x31')]=_['map'](_0x154252,_0x5ade('0x2a'));_0x3b6f2a['query']=_[_0x5ade('0x32')](_0x367c94[_0x5ade('0x33')]);_0x3b6f2a[_0x5ade('0x34')]=_['intersection'](_0x3b6f2a[_0x5ade('0x31')],_0x3b6f2a['query']);_0x358c5b[_0x5ade('0x35')]=_['intersection'](_0x3b6f2a[_0x5ade('0x31')],qs[_0x5ade('0x36')](_0x367c94[_0x5ade('0x33')]['fields']));_0x358c5b['attributes']=_0x358c5b[_0x5ade('0x35')][_0x5ade('0x37')]?_0x358c5b[_0x5ade('0x35')]:_0x3b6f2a[_0x5ade('0x31')];if(!_0x367c94[_0x5ade('0x33')][_0x5ade('0x38')](_0x5ade('0x39'))){_0x358c5b['limit']=qs[_0x5ade('0x21')](_0x367c94[_0x5ade('0x33')][_0x5ade('0x21')]);_0x358c5b[_0x5ade('0x20')]=qs[_0x5ade('0x20')](_0x367c94[_0x5ade('0x33')][_0x5ade('0x20')]);}_0x358c5b['order']=qs[_0x5ade('0x3a')](_0x367c94[_0x5ade('0x33')][_0x5ade('0x3a')]);_0x358c5b[_0x5ade('0x3b')]=qs[_0x5ade('0x34')](_[_0x5ade('0x3c')](_0x367c94['query'],_0x3b6f2a[_0x5ade('0x34')]),_0x154252);if(_0x367c94[_0x5ade('0x33')][_0x5ade('0x3d')]){_0x358c5b[_0x5ade('0x3b')]=_['merge'](_0x358c5b[_0x5ade('0x3b')],{'$or':_['map'](_0x154252,function(_0x4c980a){if(_0x4c980a['type']!==_0x5ade('0x3e')){var _0x523c26={};_0x523c26[_0x4c980a[_0x5ade('0x2a')]]={'$like':'%'+_0x367c94['query'][_0x5ade('0x3d')]+'%'};return _0x523c26;}})});}_0x358c5b=_['merge']({},_0x358c5b,_0x367c94[_0x5ade('0x3f')]);var _0x1b7d63={'where':_0x358c5b['where']};return db[_0x5ade('0x2d')][_0x5ade('0x40')](_0x1b7d63)[_0x5ade('0x26')](function(_0x4ded5c){_0x3887c8[_0x5ade('0x40')]=_0x4ded5c;if(_0x367c94['query'][_0x5ade('0x41')]){_0x358c5b['include']=[{'all':!![]}];}return db[_0x5ade('0x2d')][_0x5ade('0x42')](_0x358c5b);})[_0x5ade('0x26')](function(_0x4c6fe4){_0x3887c8[_0x5ade('0x43')]=_0x4c6fe4;return _0x3887c8;})[_0x5ade('0x26')](respondWithFilteredResult(_0x4f6878,_0x358c5b))[_0x5ade('0x44')](handleError(_0x4f6878,null));};exports[_0x5ade('0x45')]=function(_0x55038a,_0x25a3dd){var _0x4b184d={'raw':![],'where':{'id':_0x55038a[_0x5ade('0x46')]['id']}},_0x1be665={};_0x1be665[_0x5ade('0x31')]=_[_0x5ade('0x32')](db[_0x5ade('0x2d')][_0x5ade('0x2e')]);_0x1be665['query']=_['keys'](_0x55038a[_0x5ade('0x33')]);_0x1be665[_0x5ade('0x34')]=_[_0x5ade('0x47')](_0x1be665[_0x5ade('0x31')],_0x1be665[_0x5ade('0x33')]);_0x4b184d[_0x5ade('0x35')]=_[_0x5ade('0x47')](_0x1be665[_0x5ade('0x31')],qs[_0x5ade('0x36')](_0x55038a[_0x5ade('0x33')][_0x5ade('0x36')]));_0x4b184d[_0x5ade('0x35')]=_0x4b184d[_0x5ade('0x35')][_0x5ade('0x37')]?_0x4b184d['attributes']:_0x1be665[_0x5ade('0x31')];if(_0x55038a[_0x5ade('0x33')][_0x5ade('0x41')]){_0x4b184d[_0x5ade('0x48')]=[{'all':!![]}];}_0x4b184d=_[_0x5ade('0x49')]({},_0x4b184d,_0x55038a[_0x5ade('0x3f')]);return db[_0x5ade('0x2d')][_0x5ade('0x4a')](_0x4b184d)['then'](handleEntityNotFound(_0x25a3dd,null))[_0x5ade('0x26')](respondWithResult(_0x25a3dd,null))[_0x5ade('0x44')](handleError(_0x25a3dd,null));};exports[_0x5ade('0x4b')]=function(_0x169317,_0x441cc2){return db[_0x5ade('0x2d')][_0x5ade('0x4b')](_0x169317['body'],{})[_0x5ade('0x26')](respondWithResult(_0x441cc2,0xc9))['catch'](handleError(_0x441cc2,null));};exports[_0x5ade('0x4c')]=function(_0x3fcbb8,_0x593df1){if(_0x3fcbb8['body']['id']){delete _0x3fcbb8[_0x5ade('0x4d')]['id'];}return db[_0x5ade('0x2d')][_0x5ade('0x4a')]({'where':{'id':_0x3fcbb8[_0x5ade('0x46')]['id']}})[_0x5ade('0x26')](handleEntityNotFound(_0x593df1,null))[_0x5ade('0x26')](saveUpdates(_0x3fcbb8[_0x5ade('0x4d')],null))[_0x5ade('0x26')](respondWithResult(_0x593df1,null))[_0x5ade('0x44')](handleError(_0x593df1,null));};exports['destroy']=function(_0x1253c4,_0x5c7f69){return db[_0x5ade('0x2d')][_0x5ade('0x4a')]({'where':{'id':_0x1253c4[_0x5ade('0x46')]['id']}})[_0x5ade('0x26')](handleEntityNotFound(_0x5c7f69,null))[_0x5ade('0x26')](removeEntity(_0x5c7f69,null))['catch'](handleError(_0x5c7f69,null));};exports[_0x5ade('0x4e')]=function(_0x50f4c2,_0x51c7ee,_0x135c2c){return db['Condition'][_0x5ade('0x4a')]({'where':{'id':_0x50f4c2[_0x5ade('0x46')]['id']}})[_0x5ade('0x26')](handleEntityNotFound(_0x51c7ee,null))['then'](function(_0x5b2e07){if(_0x5b2e07){return _0x5b2e07[_0x5ade('0x4e')](_0x50f4c2[_0x5ade('0x4d')][_0x5ade('0x4f')],_[_0x5ade('0x50')](_0x50f4c2['body'],[_0x5ade('0x4f'),'id'])||{});}})[_0x5ade('0x26')](respondWithResult(_0x51c7ee,null))[_0x5ade('0x44')](handleError(_0x51c7ee,null));};exports['getConditions']=function(_0x1a1a5d,_0x5514ba,_0xe31a5){var _0x4c382b={};var _0x42bd8c={};var _0x4aca4e;var _0x3ae420;return db[_0x5ade('0x2d')][_0x5ade('0x51')]({'where':{'id':_0x1a1a5d[_0x5ade('0x46')]['id']}})[_0x5ade('0x26')](handleEntityNotFound(_0x5514ba,null))[_0x5ade('0x26')](function(_0x33a1ee){if(_0x33a1ee){_0x4aca4e=_0x33a1ee;_0x42bd8c[_0x5ade('0x31')]=_[_0x5ade('0x32')](db[_0x5ade('0x52')][_0x5ade('0x2e')]);_0x42bd8c['query']=_[_0x5ade('0x32')](_0x1a1a5d[_0x5ade('0x33')]);_0x42bd8c[_0x5ade('0x34')]=_['intersection'](_0x42bd8c[_0x5ade('0x31')],_0x42bd8c['query']);_0x4c382b[_0x5ade('0x35')]=_['intersection'](_0x42bd8c[_0x5ade('0x31')],qs[_0x5ade('0x36')](_0x1a1a5d[_0x5ade('0x33')]['fields']));_0x4c382b[_0x5ade('0x35')]=_0x4c382b[_0x5ade('0x35')][_0x5ade('0x37')]?_0x4c382b[_0x5ade('0x35')]:_0x42bd8c[_0x5ade('0x31')];_0x4c382b[_0x5ade('0x53')]=qs['sort'](_0x1a1a5d[_0x5ade('0x33')][_0x5ade('0x3a')]);_0x4c382b['where']=qs[_0x5ade('0x34')](_['pick'](_0x1a1a5d[_0x5ade('0x33')],_0x42bd8c[_0x5ade('0x34')]));if(_0x1a1a5d[_0x5ade('0x33')][_0x5ade('0x3d')]){_0x4c382b[_0x5ade('0x3b')]=_['merge'](_0x4c382b['where'],{'$or':_['map'](_0x4c382b[_0x5ade('0x35')],function(_0x3dd551){var _0x485594={};_0x485594[_0x3dd551]={'$like':'%'+_0x1a1a5d[_0x5ade('0x33')][_0x5ade('0x3d')]+'%'};return _0x485594;})});}_0x4c382b=_[_0x5ade('0x49')]({},_0x4c382b,_0x1a1a5d[_0x5ade('0x3f')]);return _0x4aca4e[_0x5ade('0x54')](_0x4c382b);}})[_0x5ade('0x26')](function(_0x49487d){if(_0x49487d){_0x3ae420=_0x49487d[_0x5ade('0x37')];if(!_0x1a1a5d[_0x5ade('0x33')]['hasOwnProperty']('nolimit')){_0x4c382b[_0x5ade('0x21')]=qs[_0x5ade('0x21')](_0x1a1a5d[_0x5ade('0x33')][_0x5ade('0x21')]);_0x4c382b[_0x5ade('0x20')]=qs['offset'](_0x1a1a5d[_0x5ade('0x33')][_0x5ade('0x20')]);}return _0x4aca4e[_0x5ade('0x54')](_0x4c382b);}})[_0x5ade('0x26')](function(_0x3068ca){if(_0x3068ca){return _0x3068ca?{'count':_0x3ae420,'rows':_0x3068ca}:null;}})[_0x5ade('0x26')](respondWithResult(_0x5514ba,null))[_0x5ade('0x44')](handleError(_0x5514ba,null));};exports['addActions']=function(_0xe2090c,_0x240426,_0x15266c){return db[_0x5ade('0x55')]['find']({'where':{'id':_0xe2090c[_0x5ade('0x46')]['id']}})[_0x5ade('0x26')](handleEntityNotFound(_0x240426,null))[_0x5ade('0x26')](function(_0x53e25c){if(_0x53e25c){return _0x53e25c[_0x5ade('0x56')](_0xe2090c[_0x5ade('0x4d')][_0x5ade('0x4f')],_[_0x5ade('0x50')](_0xe2090c[_0x5ade('0x4d')],[_0x5ade('0x4f'),'id'])||{});}})[_0x5ade('0x26')](respondWithResult(_0x240426,null))[_0x5ade('0x44')](handleError(_0x240426,null));};exports[_0x5ade('0x57')]=function(_0x3045dc,_0x29fdc4,_0xca5ddf){var _0x5667c7={};var _0x2cfd2f={};var _0xc569df;var _0x299f15;return db[_0x5ade('0x2d')][_0x5ade('0x51')]({'where':{'id':_0x3045dc[_0x5ade('0x46')]['id']}})[_0x5ade('0x26')](handleEntityNotFound(_0x29fdc4,null))[_0x5ade('0x26')](function(_0x4f543d){if(_0x4f543d){_0xc569df=_0x4f543d;_0x2cfd2f[_0x5ade('0x31')]=_[_0x5ade('0x32')](db['Action'][_0x5ade('0x2e')]);_0x2cfd2f[_0x5ade('0x33')]=_['keys'](_0x3045dc[_0x5ade('0x33')]);_0x2cfd2f[_0x5ade('0x34')]=_['intersection'](_0x2cfd2f[_0x5ade('0x31')],_0x2cfd2f[_0x5ade('0x33')]);_0x5667c7['attributes']=_[_0x5ade('0x47')](_0x2cfd2f['model'],qs[_0x5ade('0x36')](_0x3045dc[_0x5ade('0x33')][_0x5ade('0x36')]));_0x5667c7[_0x5ade('0x35')]=_0x5667c7[_0x5ade('0x35')][_0x5ade('0x37')]?_0x5667c7[_0x5ade('0x35')]:_0x2cfd2f['model'];_0x5667c7[_0x5ade('0x53')]=qs[_0x5ade('0x3a')](_0x3045dc[_0x5ade('0x33')][_0x5ade('0x3a')]);_0x5667c7[_0x5ade('0x3b')]=qs[_0x5ade('0x34')](_[_0x5ade('0x3c')](_0x3045dc['query'],_0x2cfd2f[_0x5ade('0x34')]));if(_0x3045dc[_0x5ade('0x33')][_0x5ade('0x3d')]){_0x5667c7[_0x5ade('0x3b')]=_[_0x5ade('0x49')](_0x5667c7[_0x5ade('0x3b')],{'$or':_[_0x5ade('0x58')](_0x5667c7[_0x5ade('0x35')],function(_0x1b0e12){var _0x1863b8={};_0x1863b8[_0x1b0e12]={'$like':'%'+_0x3045dc[_0x5ade('0x33')][_0x5ade('0x3d')]+'%'};return _0x1863b8;})});}_0x5667c7=_[_0x5ade('0x49')]({},_0x5667c7,_0x3045dc[_0x5ade('0x3f')]);return _0xc569df[_0x5ade('0x57')](_0x5667c7);}})[_0x5ade('0x26')](function(_0x475383){if(_0x475383){_0x299f15=_0x475383[_0x5ade('0x37')];if(!_0x3045dc[_0x5ade('0x33')][_0x5ade('0x38')](_0x5ade('0x39'))){_0x5667c7['limit']=qs[_0x5ade('0x21')](_0x3045dc[_0x5ade('0x33')][_0x5ade('0x21')]);_0x5667c7[_0x5ade('0x20')]=qs[_0x5ade('0x20')](_0x3045dc['query'][_0x5ade('0x20')]);}return _0xc569df[_0x5ade('0x57')](_0x5667c7);}})[_0x5ade('0x26')](function(_0x500c18){if(_0x500c18){return _0x500c18?{'count':_0x299f15,'rows':_0x500c18}:null;}})[_0x5ade('0x26')](respondWithResult(_0x29fdc4,null))['catch'](handleError(_0x29fdc4,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 4ee136b..88c181e 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 _0x4686=['rimraf','./automation.attributes','exports','define','Automation','tools_automations','lodash','../../config/logger','api','bluebird','path'];(function(_0x2c924f,_0x46d106){var _0x483508=function(_0x528609){while(--_0x528609){_0x2c924f['push'](_0x2c924f['shift']());}};_0x483508(++_0x46d106);}(_0x4686,0x171));var _0x6468=function(_0x49d58d,_0x4e0f67){_0x49d58d=_0x49d58d-0x0;var _0x350063=_0x4686[_0x49d58d];return _0x350063;};'use strict';var _=require(_0x6468('0x0'));var util=require('util');var logger=require(_0x6468('0x1'))(_0x6468('0x2'));var moment=require('moment');var BPromise=require(_0x6468('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6468('0x4'));var rimraf=require(_0x6468('0x5'));var config=require('../../config/environment');var attributes=require(_0x6468('0x6'));module[_0x6468('0x7')]=function(_0x48bc9d,_0x50a7c3){return _0x48bc9d[_0x6468('0x8')](_0x6468('0x9'),attributes,{'tableName':_0x6468('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19b9=['./automation.attributes','exports','Automation','tools_automations','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x4114dd,_0x2ad862){var _0x26f44c=function(_0xad2246){while(--_0xad2246){_0x4114dd['push'](_0x4114dd['shift']());}};_0x26f44c(++_0x2ad862);}(_0x19b9,0xc2));var _0x919b=function(_0x1cb890,_0x3b3a68){_0x1cb890=_0x1cb890-0x0;var _0x143993=_0x19b9[_0x1cb890];return _0x143993;};'use strict';var _=require(_0x919b('0x0'));var util=require(_0x919b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x919b('0x2'));var rp=require(_0x919b('0x3'));var fs=require('fs');var path=require(_0x919b('0x4'));var rimraf=require(_0x919b('0x5'));var config=require('../../config/environment');var attributes=require(_0x919b('0x6'));module[_0x919b('0x7')]=function(_0x58c530,_0x33a0ac){return _0x58c530['define'](_0x919b('0x8'),attributes,{'tableName':_0x919b('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 07f4093..a51f423 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 _0x20d6=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s'];(function(_0x456551,_0x4c9050){var _0x1af692=function(_0x2dabdd){while(--_0x2dabdd){_0x456551['push'](_0x456551['shift']());}};_0x1af692(++_0x4c9050);}(_0x20d6,0x1b8));var _0x620d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x20d6[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var moment=require(_0x620d('0x2'));var BPromise=require(_0x620d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x620d('0x4'));var db=require(_0x620d('0x5'))['db'];var utils=require(_0x620d('0x6'));var logger=require(_0x620d('0x7'))(_0x620d('0x8'));var config=require(_0x620d('0x9'));var jayson=require(_0x620d('0xa'));var client=jayson[_0x620d('0xb')][_0x620d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3aa4f3,_0x260d43,_0x52657f){return new BPromise(function(_0x3d93af,_0x478aeb){return client['request'](_0x3aa4f3,_0x52657f)[_0x620d('0xd')](function(_0x473790){logger[_0x620d('0xe')](_0x620d('0xf'),_0x260d43,_0x620d('0x10'));logger[_0x620d('0x11')]('Automation,\x20%s,\x20%s,\x20%s',_0x260d43,_0x620d('0x10'),JSON[_0x620d('0x12')](_0x473790));if(_0x473790['error']){if(_0x473790[_0x620d('0x13')][_0x620d('0x14')]===0x1f4){logger[_0x620d('0x13')](_0x620d('0xf'),_0x260d43,_0x473790[_0x620d('0x13')][_0x620d('0x15')]);return _0x478aeb(_0x473790[_0x620d('0x13')][_0x620d('0x15')]);}logger['error'](_0x620d('0xf'),_0x260d43,_0x473790[_0x620d('0x13')][_0x620d('0x15')]);return _0x3d93af(_0x473790[_0x620d('0x13')][_0x620d('0x15')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x260d43,'request\x20sent');_0x3d93af(_0x473790[_0x620d('0x16')]['message']);}})[_0x620d('0x17')](function(_0x20a91e){logger[_0x620d('0x13')](_0x620d('0xf'),_0x260d43,_0x20a91e);_0x478aeb(_0x20a91e);});});} \ No newline at end of file +var _0x17a7=['Automation,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info'];(function(_0x1569fc,_0x115095){var _0x277783=function(_0x49e9c1){while(--_0x49e9c1){_0x1569fc['push'](_0x1569fc['shift']());}};_0x277783(++_0x115095);}(_0x17a7,0xc2));var _0x717a=function(_0x8d5d35,_0x4e289b){_0x8d5d35=_0x8d5d35-0x0;var _0x309712=_0x17a7[_0x8d5d35];return _0x309712;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x717a('0x0'));var rs=require(_0x717a('0x1'));var fs=require('fs');var Redis=require(_0x717a('0x2'));var db=require(_0x717a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x717a('0x4'))('rpc');var config=require(_0x717a('0x5'));var jayson=require(_0x717a('0x6'));var client=jayson['client'][_0x717a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ca7a6,_0xd7d2ce,_0x311738){return new BPromise(function(_0x536824,_0x1066d4){return client['request'](_0x1ca7a6,_0x311738)[_0x717a('0x8')](function(_0x567130){logger[_0x717a('0x9')](_0x717a('0xa'),_0xd7d2ce,_0x717a('0xb'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'),JSON[_0x717a('0xc')](_0x567130));if(_0x567130[_0x717a('0xd')]){if(_0x567130[_0x717a('0xd')][_0x717a('0xe')]===0x1f4){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x567130['error'][_0x717a('0xf')]);return _0x1066d4(_0x567130['error']['message']);}logger['error']('Automation,\x20%s,\x20%s',_0xd7d2ce,_0x567130[_0x717a('0xd')]['message']);return _0x536824(_0x567130[_0x717a('0xd')]['message']);}else{logger[_0x717a('0x9')]('Automation,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'));_0x536824(_0x567130[_0x717a('0x10')][_0x717a('0xf')]);}})['catch'](function(_0x186b4d){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x186b4d);_0x1066d4(_0x186b4d);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 891d10e..8cc5f05 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 _0x710b=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','getConditions','getActions','post','create','addConditions','/:id/actions','put','update','destroy','multer'];(function(_0x5ee3d4,_0x40da86){var _0x7f69d=function(_0x969be8){while(--_0x969be8){_0x5ee3d4['push'](_0x5ee3d4['shift']());}};_0x7f69d(++_0x40da86);}(_0x710b,0x110));var _0xb710=function(_0x469d01,_0x18c899){_0x469d01=_0x469d01-0x0;var _0x5078d3=_0x710b[_0x469d01];return _0x5078d3;};'use strict';var multer=require(_0xb710('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb710('0x1'));var express=require(_0xb710('0x2'));var router=express[_0xb710('0x3')]();var fs_extra=require(_0xb710('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb710('0x5'));var config=require(_0xb710('0x6'));var controller=require(_0xb710('0x7'));router[_0xb710('0x8')]('/',auth[_0xb710('0x9')](),controller['index']);router[_0xb710('0x8')](_0xb710('0xa'),auth['isAuthenticated'](),controller[_0xb710('0xb')]);router[_0xb710('0x8')]('/:id/conditions',auth[_0xb710('0x9')](),controller[_0xb710('0xc')]);router['get']('/:id/actions',auth[_0xb710('0x9')](),controller[_0xb710('0xd')]);router[_0xb710('0xe')]('/',auth['isAuthenticated'](),controller[_0xb710('0xf')]);router[_0xb710('0xe')]('/:id/conditions',auth[_0xb710('0x9')](),controller[_0xb710('0x10')]);router[_0xb710('0xe')](_0xb710('0x11'),auth[_0xb710('0x9')](),controller['addActions']);router[_0xb710('0x12')](_0xb710('0xa'),auth[_0xb710('0x9')](),controller[_0xb710('0x13')]);router['delete'](_0xb710('0xa'),auth[_0xb710('0x9')](),controller[_0xb710('0x14')]);module['exports']=router; \ No newline at end of file +var _0xbefb=['get','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xbefb,0x13c));var _0xbbef=function(_0x1ebd5c,_0x36150e){_0x1ebd5c=_0x1ebd5c-0x0;var _0x26eefc=_0xbefb[_0x1ebd5c];return _0x26eefc;};'use strict';var multer=require(_0xbbef('0x0'));var util=require(_0xbbef('0x1'));var path=require('path');var timeout=require(_0xbbef('0x2'));var express=require(_0xbbef('0x3'));var router=express['Router']();var fs_extra=require(_0xbbef('0x4'));var auth=require(_0xbbef('0x5'));var interaction=require(_0xbbef('0x6'));var config=require('../../config/environment');var controller=require('./automation.controller');router['get']('/',auth[_0xbbef('0x7')](),controller['index']);router[_0xbbef('0x8')](_0xbbef('0x9'),auth[_0xbbef('0x7')](),controller['show']);router[_0xbbef('0x8')](_0xbbef('0xa'),auth[_0xbbef('0x7')](),controller[_0xbbef('0xb')]);router['get'](_0xbbef('0xc'),auth['isAuthenticated'](),controller[_0xbbef('0xd')]);router[_0xbbef('0xe')]('/',auth[_0xbbef('0x7')](),controller['create']);router['post'](_0xbbef('0xa'),auth[_0xbbef('0x7')](),controller[_0xbbef('0xf')]);router['post']('/:id/actions',auth[_0xbbef('0x7')](),controller[_0xbbef('0x10')]);router['put'](_0xbbef('0x9'),auth[_0xbbef('0x7')](),controller['update']);router[_0xbbef('0x11')](_0xbbef('0x9'),auth[_0xbbef('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 6f9b33e..22f9ad5 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 _0x4240=['#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','UNSIGNED','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','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','#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)'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x4240,0x10c));var _0x0424=function(_0x112ed0,_0x737772){_0x112ed0=_0x112ed0-0x0;var _0x197bc7=_0x4240[_0x112ed0];return _0x197bc7;};'use strict';var Sequelize=require('sequelize');module[_0x0424('0x0')]={'name':{'type':Sequelize[_0x0424('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0424('0x2')](_0x0424('0x3')),'allowNull':![],'defaultValue':_0x0424('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0424('0x4')},'limitCalls':{'type':Sequelize[_0x0424('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0424('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0424('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0424('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x0424('0x5')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0424('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0424('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0424('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)[_0x0424('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0424('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x0424('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0424('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)[_0x0424('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0424('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0424('0x5')](0x3)[_0x0424('0x9')],'defaultValue':0x3,'comment':_0x0424('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0424('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0424('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0424('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0424('0x1')],'defaultValue':_0x0424('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x0424('0x2')](_0x0424('0x11'),_0x0424('0x12'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0424('0x13')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0424('0x5')](0x9)[_0x0424('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0424('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x0424('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0424('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0424('0x5')](0x9)[_0x0424('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0424('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0424('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0424('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0424('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0424('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0424('0x5')](0x9)[_0x0424('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0424('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0424('0x5')](0x5)[_0x0424('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0424('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0424('0x5')](0x9)[_0x0424('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0424('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0424('0x2')](_0x0424('0x1c'),_0x0424('0x1d')),'defaultValue':_0x0424('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0424('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0424('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0424('0x5')](0x3)[_0x0424('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0424('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)[_0x0424('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0424('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0424('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0424('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)[_0x0424('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0424('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0424('0x5')](0x3)[_0x0424('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0424('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)[_0x0424('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0424('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x0424('0x5')](0x3)[_0x0424('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0424('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0424('0x5')](0x3)[_0x0424('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0424('0x5')](0x5)[_0x0424('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0424('0x25')}}; \ No newline at end of file +var _0x5857=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\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\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#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)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x145450,_0x8d1918){var _0x39b89d=function(_0x51f5e7){while(--_0x51f5e7){_0x145450['push'](_0x145450['shift']());}};_0x39b89d(++_0x8d1918);}(_0x5857,0xbf));var _0x7585=function(_0x4ac523,_0x5ce50e){_0x4ac523=_0x4ac523-0x0;var _0x53aa8d=_0x5857[_0x4ac523];return _0x53aa8d;};'use strict';var Sequelize=require(_0x7585('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7585('0x1')](_0x7585('0x2')),'allowNull':![],'defaultValue':_0x7585('0x2')},'description':{'type':Sequelize[_0x7585('0x3')]},'active':{'type':Sequelize[_0x7585('0x4')],'defaultValue':0x0,'comment':_0x7585('0x5')},'limitCalls':{'type':Sequelize[_0x7585('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7585('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7585('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x7585('0x6')](0x3)[_0x7585('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7585('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7585('0x6')](0x3)[_0x7585('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7585('0x6')](0x5)[_0x7585('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7585('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x7585('0x6')](0x3)[_0x7585('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7585('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x7585('0x6')](0x5)[_0x7585('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7585('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7585('0x6')](0x3)[_0x7585('0x8')],'defaultValue':0x3,'comment':_0x7585('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7585('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7585('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7585('0x6')](0x3)[_0x7585('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7585('0xf')},'dialTimezone':{'type':Sequelize[_0x7585('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7585('0x3')],'defaultValue':_0x7585('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x7585('0x1')](_0x7585('0x11'),_0x7585('0x12'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x7585('0x4')],'defaultValue':0x0,'comment':_0x7585('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7585('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7585('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x7585('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7585('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7585('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7585('0x6')](0x9)[_0x7585('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x7585('0x6')](0x9)[_0x7585('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7585('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7585('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7585('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x7585('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7585('0x6')](0x5)[_0x7585('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7585('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x7585('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7585('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7585('0x1')](_0x7585('0x1b'),_0x7585('0x1c')),'defaultValue':_0x7585('0x1b')},'dialPrefix':{'type':Sequelize[_0x7585('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x7585('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7585('0x1d')},'dialCutDigit':{'type':Sequelize[_0x7585('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7585('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7585('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7585('0x6')](0x5)[_0x7585('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7585('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7585('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x7585('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7585('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7585('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7585('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7585('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7585('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x7585('0x6')](0x3)[_0x7585('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7585('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x7585('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7585('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7585('0x6')](0x3)[_0x7585('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7585('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7585('0x6')](0x5)[_0x7585('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 0c2a092..b97a0c6 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 _0x486e=['cm_contacts','toString','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','ListId\x20=\x20?','cm_hopper_additional_phones','OrderBy','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','then','destroy','IvrCampaigns','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','merge','options','Campaign','includeAll','findAll','rows','catch','show','intersection','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','clone','include','omit','createdAt','updatedAt','params','getHoppers','findOne','hasOwnProperty','CampaignId','filter','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','from'];(function(_0xf855a1,_0x420a35){var _0x9ed54c=function(_0x15d8dd){while(--_0x15d8dd){_0xf855a1['push'](_0xf855a1['shift']());}};_0x9ed54c(++_0x420a35);}(_0x486e,0xb2));var _0xe486=function(_0x252cf9,_0x5221f9){_0x252cf9=_0x252cf9-0x0;var _0x1eb966=_0x486e[_0x252cf9];return _0x1eb966;};'use strict';var emlformat=require(_0xe486('0x0'));var rimraf=require(_0xe486('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe486('0x2'));var rp=require(_0xe486('0x3'));var moment=require(_0xe486('0x4'));var BPromise=require(_0xe486('0x5'));var Mustache=require(_0xe486('0x6'));var util=require(_0xe486('0x7'));var path=require(_0xe486('0x8'));var sox=require(_0xe486('0x9'));var csv=require(_0xe486('0xa'));var ejs=require(_0xe486('0xb'));var fs=require('fs');var fs_extra=require(_0xe486('0xc'));var _=require('lodash');var squel=require(_0xe486('0xd'));var crypto=require(_0xe486('0xe'));var jsforce=require(_0xe486('0xf'));var deskjs=require(_0xe486('0x10'));var toCsv=require(_0xe486('0xa'));var querystring=require(_0xe486('0x11'));var Papa=require(_0xe486('0x12'));var Redis=require(_0xe486('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe486('0x14'));var hardwareService=require(_0xe486('0x15'));var logger=require(_0xe486('0x16'))(_0xe486('0x17'));var utils=require(_0xe486('0x18'));var config=require(_0xe486('0x19'));var licenseUtil=require(_0xe486('0x1a'));var db=require(_0xe486('0x1b'))['db'];function respondWithStatusCode(_0x372057,_0x530344){_0x530344=_0x530344||0xcc;return function(_0x5a1aad){if(_0x5a1aad){return _0x372057[_0xe486('0x1c')](_0x530344);}return _0x372057[_0xe486('0x1d')](_0x530344)[_0xe486('0x1e')]();};}function respondWithResult(_0x564a6f,_0x5ddb65){_0x5ddb65=_0x5ddb65||0xc8;return function(_0x339746){if(_0x339746){return _0x564a6f['status'](_0x5ddb65)[_0xe486('0x1f')](_0x339746);}};}function respondWithFilteredResult(_0x3da621,_0x4a0259){return function(_0x355002){if(_0x355002){var _0x5016f0=typeof _0x4a0259['offset']===_0xe486('0x20')&&typeof _0x4a0259[_0xe486('0x21')]==='undefined';var _0x3d983b=_0x355002['count'];var _0x25e946=_0x5016f0?0x0:_0x4a0259[_0xe486('0x22')];var _0x5d209a=_0x5016f0?_0x355002[_0xe486('0x23')]:_0x4a0259[_0xe486('0x22')]+_0x4a0259['limit'];var _0xf0697f;if(_0x5d209a>=_0x3d983b){_0x5d209a=_0x3d983b;_0xf0697f=0xc8;}else{_0xf0697f=0xce;}_0x3da621[_0xe486('0x1d')](_0xf0697f);return _0x3da621[_0xe486('0x24')]('Content-Range',_0x25e946+'-'+_0x5d209a+'/'+_0x3d983b)[_0xe486('0x1f')](_0x355002);}return null;};}function patchUpdates(_0x301344){return function(_0x2c34e3){try{jsonpatch[_0xe486('0x25')](_0x2c34e3,_0x301344,!![]);}catch(_0x4650bf){return BPromise[_0xe486('0x26')](_0x4650bf);}return _0x2c34e3[_0xe486('0x27')]();};}function saveUpdates(_0xdc43f0,_0x5b61cc){return function(_0x22efff){if(_0x22efff){return _0x22efff['update'](_0xdc43f0)[_0xe486('0x28')](function(_0x50ae4c){return _0x50ae4c;});}return null;};}function removeEntity(_0x3020e7,_0x47a811){return function(_0x39113f){if(_0x39113f){return _0x39113f[_0xe486('0x29')]()[_0xe486('0x28')](function(){var _0x9f77fc=_0x39113f['get']({'plain':!![]});var _0x2e7182=_0xe486('0x2a');return db[_0xe486('0x2b')][_0xe486('0x29')]({'where':{'type':_0x2e7182,'resourceId':_0x9f77fc['id']}})[_0xe486('0x28')](function(){return _0x39113f;});})[_0xe486('0x28')](function(){_0x3020e7['status'](0xcc)[_0xe486('0x1e')]();});}};}function handleEntityNotFound(_0x2b08d0,_0x502b4c){return function(_0x87ece6){if(!_0x87ece6){_0x2b08d0['sendStatus'](0x194);}return _0x87ece6;};}function handleError(_0x48ab9f,_0x4ecdac){_0x4ecdac=_0x4ecdac||0x1f4;return function(_0x361b51){logger[_0xe486('0x2c')](_0x361b51[_0xe486('0x2d')]);if(_0x361b51['name']){delete _0x361b51[_0xe486('0x2e')];}_0x48ab9f['status'](_0x4ecdac)['send'](_0x361b51);};}exports[_0xe486('0x2f')]=function(_0x1c6d22,_0x22a1c9){var _0x2fc3a7={},_0x39f3f9={},_0x70e1bb={'count':0x0,'rows':[]};var _0x39b179=_['map'](db['Campaign'][_0xe486('0x30')],function(_0x5f3b54){return{'name':_0x5f3b54[_0xe486('0x31')],'type':_0x5f3b54[_0xe486('0x32')][_0xe486('0x33')]};});_0x39f3f9[_0xe486('0x34')]=_[_0xe486('0x35')](_0x39b179,'name');_0x39f3f9[_0xe486('0x36')]=_[_0xe486('0x37')](_0x1c6d22[_0xe486('0x36')]);_0x39f3f9[_0xe486('0x38')]=_['intersection'](_0x39f3f9[_0xe486('0x34')],_0x39f3f9[_0xe486('0x36')]);_0x2fc3a7[_0xe486('0x39')]=_['intersection'](_0x39f3f9[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x1c6d22[_0xe486('0x36')][_0xe486('0x3a')]));_0x2fc3a7['attributes']=_0x2fc3a7[_0xe486('0x39')][_0xe486('0x3b')]?_0x2fc3a7[_0xe486('0x39')]:_0x39f3f9[_0xe486('0x34')];if(!_0x1c6d22['query']['hasOwnProperty'](_0xe486('0x3c'))){_0x2fc3a7[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x1c6d22[_0xe486('0x36')]['limit']);_0x2fc3a7[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x1c6d22[_0xe486('0x36')]['offset']);}_0x2fc3a7[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x1c6d22[_0xe486('0x36')][_0xe486('0x3e')]);_0x2fc3a7['where']=qs['filters'](_[_0xe486('0x3f')](_0x1c6d22[_0xe486('0x36')],_0x39f3f9[_0xe486('0x38')]),_0x39b179);if(_0x1c6d22[_0xe486('0x36')]['filter']){_0x2fc3a7[_0xe486('0x40')]=_['merge'](_0x2fc3a7[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x39b179,function(_0xecdc73){if(_0xecdc73[_0xe486('0x32')]!==_0xe486('0x41')){var _0x178fcc={};_0x178fcc[_0xecdc73['name']]={'$like':'%'+_0x1c6d22[_0xe486('0x36')]['filter']+'%'};return _0x178fcc;}})});}_0x2fc3a7=_[_0xe486('0x42')]({},_0x2fc3a7,_0x1c6d22[_0xe486('0x43')]);var _0x1ba5e3={'where':_0x2fc3a7['where']};return db[_0xe486('0x44')]['count'](_0x1ba5e3)[_0xe486('0x28')](function(_0x22c5d2){_0x70e1bb[_0xe486('0x23')]=_0x22c5d2;if(_0x1c6d22['query'][_0xe486('0x45')]){_0x2fc3a7['include']=[{'all':!![]}];}return db[_0xe486('0x44')][_0xe486('0x46')](_0x2fc3a7);})['then'](function(_0x312a3a){_0x70e1bb[_0xe486('0x47')]=_0x312a3a;return _0x70e1bb;})[_0xe486('0x28')](respondWithFilteredResult(_0x22a1c9,_0x2fc3a7))[_0xe486('0x48')](handleError(_0x22a1c9,null));};exports[_0xe486('0x49')]=function(_0x9d6953,_0x5c4c9c){var _0x20b6b5={'raw':![],'where':{'id':_0x9d6953['params']['id']}},_0x45c705={};_0x45c705[_0xe486('0x34')]=_['keys'](db[_0xe486('0x44')][_0xe486('0x30')]);_0x45c705['query']=_[_0xe486('0x37')](_0x9d6953[_0xe486('0x36')]);_0x45c705[_0xe486('0x38')]=_['intersection'](_0x45c705[_0xe486('0x34')],_0x45c705[_0xe486('0x36')]);_0x20b6b5[_0xe486('0x39')]=_[_0xe486('0x4a')](_0x45c705['model'],qs[_0xe486('0x3a')](_0x9d6953[_0xe486('0x36')][_0xe486('0x3a')]));_0x20b6b5[_0xe486('0x39')]=_0x20b6b5[_0xe486('0x39')][_0xe486('0x3b')]?_0x20b6b5[_0xe486('0x39')]:_0x45c705['model'];if(_0x9d6953[_0xe486('0x36')][_0xe486('0x45')]){_0x20b6b5['include']=[{'all':!![]}];}_0x20b6b5=_[_0xe486('0x42')]({},_0x20b6b5,_0x9d6953[_0xe486('0x43')]);return db['Campaign'][_0xe486('0x4b')](_0x20b6b5)[_0xe486('0x28')](handleEntityNotFound(_0x5c4c9c,null))[_0xe486('0x28')](respondWithResult(_0x5c4c9c,null))[_0xe486('0x48')](handleError(_0x5c4c9c,null));};exports[_0xe486('0x4c')]=function(_0x10b115,_0x43f2da){return db['Campaign'][_0xe486('0x4c')](_0x10b115[_0xe486('0x4d')],{})['then'](function(_0x3bc7dd){var _0x26e8c5=_0x10b115[_0xe486('0x4e')][_0xe486('0x4f')]({'plain':!![]});if(!_0x26e8c5)throw new Error(_0xe486('0x50'));if(_0x26e8c5[_0xe486('0x51')]==='user'){var _0x1c8ad5=_0x3bc7dd[_0xe486('0x4f')]({'plain':!![]});var _0x4e781c=_0xe486('0x2a');return db[_0xe486('0x52')][_0xe486('0x4b')]({'where':{'name':_0x4e781c,'userProfileId':_0x26e8c5[_0xe486('0x53')]},'raw':!![]})[_0xe486('0x28')](function(_0x319585){if(_0x319585&&_0x319585[_0xe486('0x54')]===0x0){return db[_0xe486('0x2b')][_0xe486('0x4c')]({'name':_0x1c8ad5[_0xe486('0x2e')],'resourceId':_0x1c8ad5['id'],'type':_0x319585['name'],'sectionId':_0x319585['id']},{})[_0xe486('0x28')](function(){return _0x3bc7dd;});}else{return _0x3bc7dd;}})[_0xe486('0x48')](function(_0x3c9cf2){logger[_0xe486('0x2c')](_0xe486('0x55'),_0x3c9cf2);throw _0x3c9cf2;});}return _0x3bc7dd;})[_0xe486('0x28')](respondWithResult(_0x43f2da,0xc9))['catch'](handleError(_0x43f2da,null));};exports[_0xe486('0x56')]=function(_0x1592d5,_0x4df7c6){var _0x31e57a={'where':{'id':_0x1592d5['params']['id']}},_0x4de708={};_0x4de708[_0xe486('0x34')]=_[_0xe486('0x37')](db[_0xe486('0x44')]['rawAttributes']);_0x31e57a[_0xe486('0x39')]=_['intersection'](_0x4de708[_0xe486('0x34')],qs['fields'](_0x1592d5[_0xe486('0x36')]['fields']));_0x31e57a['attributes']=_0x31e57a['attributes'][_0xe486('0x3b')]?_0x31e57a[_0xe486('0x39')]:_0x4de708[_0xe486('0x34')];if(_0x1592d5[_0xe486('0x36')][_0xe486('0x45')]){_0x31e57a[_0xe486('0x57')]=[{'all':!![]}];}_0x31e57a=_['merge']({},_0x31e57a,_0x1592d5['options']);return db[_0xe486('0x44')]['find'](_0x31e57a)[_0xe486('0x28')](handleEntityNotFound(_0x4df7c6,null))[_0xe486('0x28')](function(_0x1b96f1){if(_0x1b96f1){var _0x50732c=_0x1b96f1['get']({'plain':!![]});_0x50732c=qs[_0xe486('0x58')](_0x50732c,['id',_0xe486('0x59'),_0xe486('0x5a')]);_0x1592d5[_0xe486('0x4d')]=_[_0xe486('0x58')](_0x1592d5[_0xe486('0x4d')],['id',_0xe486('0x59'),_0xe486('0x5a')]);return db[_0xe486('0x44')]['create'](_['merge'](_0x50732c,_0x1592d5[_0xe486('0x4d')]),{'include':_0x1592d5[_0xe486('0x36')][_0xe486('0x45')]?[{'all':!![]}]:undefined})[_0xe486('0x28')](function(_0x358bce){var _0x2ec277=_0x1592d5['user']['get']({'plain':!![]});if(!_0x2ec277)throw new Error(_0xe486('0x50'));if(_0x2ec277[_0xe486('0x51')]===_0xe486('0x4e')){var _0x148bad=_0x358bce[_0xe486('0x4f')]({'plain':!![]});var _0x33f2f6='IvrCampaigns';return db[_0xe486('0x52')][_0xe486('0x4b')]({'where':{'name':_0x33f2f6,'userProfileId':_0x2ec277[_0xe486('0x53')]},'raw':!![]})[_0xe486('0x28')](function(_0x512d18){if(_0x512d18&&_0x512d18[_0xe486('0x54')]===0x0){return db[_0xe486('0x2b')]['create']({'name':_0x148bad[_0xe486('0x2e')],'resourceId':_0x148bad['id'],'type':_0x512d18[_0xe486('0x2e')],'sectionId':_0x512d18['id']},{})[_0xe486('0x28')](function(){return _0x358bce;});}else{return _0x358bce;}})[_0xe486('0x48')](function(_0x4feeb5){logger[_0xe486('0x2c')](_0xe486('0x55'),_0x4feeb5);throw _0x4feeb5;});}return _0x358bce;});}})[_0xe486('0x28')](respondWithResult(_0x4df7c6,0xc9))[_0xe486('0x48')](handleError(_0x4df7c6,null));};exports['update']=function(_0x39a093,_0x290dc1){if(_0x39a093[_0xe486('0x4d')]['id']){delete _0x39a093[_0xe486('0x4d')]['id'];}return db[_0xe486('0x44')][_0xe486('0x4b')]({'where':{'id':_0x39a093[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x290dc1,null))['then'](saveUpdates(_0x39a093[_0xe486('0x4d')],null))[_0xe486('0x28')](respondWithResult(_0x290dc1,null))[_0xe486('0x48')](handleError(_0x290dc1,null));};exports[_0xe486('0x29')]=function(_0x8f0b78,_0x276742){return db['Campaign']['find']({'where':{'id':_0x8f0b78[_0xe486('0x5b')]['id']}})['then'](handleEntityNotFound(_0x276742,null))[_0xe486('0x28')](removeEntity(_0x276742,null))[_0xe486('0x48')](handleError(_0x276742,null));};exports[_0xe486('0x5c')]=function(_0x1dfdc0,_0x2bec02,_0x22b50d){var _0x696632={'raw':!![],'where':{}};var _0x183700={};var _0x12863d={'count':0x0,'rows':[]};return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x1dfdc0[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x2bec02,null))[_0xe486('0x28')](function(_0x333a1f){if(_0x333a1f){_0x183700['model']=_['keys'](db['CmHopper'][_0xe486('0x30')]);_0x183700[_0xe486('0x36')]=_['keys'](_0x1dfdc0[_0xe486('0x36')]);_0x183700[_0xe486('0x38')]=_['intersection'](_0x183700['model'],_0x183700[_0xe486('0x36')]);_0x696632[_0xe486('0x39')]=_['intersection'](_0x183700['model'],qs[_0xe486('0x3a')](_0x1dfdc0[_0xe486('0x36')][_0xe486('0x3a')]));_0x696632[_0xe486('0x39')]=_0x696632['attributes'][_0xe486('0x3b')]?_0x696632[_0xe486('0x39')]:_0x183700[_0xe486('0x34')];if(!_0x1dfdc0[_0xe486('0x36')][_0xe486('0x5e')]('nolimit')){_0x696632[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x1dfdc0[_0xe486('0x36')]['limit']);_0x696632[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x1dfdc0['query'][_0xe486('0x22')]);}_0x696632[_0xe486('0x3d')]=qs['sort'](_0x1dfdc0['query'][_0xe486('0x3e')]);_0x696632[_0xe486('0x40')]=qs[_0xe486('0x38')](_[_0xe486('0x3f')](_0x1dfdc0[_0xe486('0x36')],_0x183700[_0xe486('0x38')]));_0x696632[_0xe486('0x40')][_0xe486('0x5f')]=_0x333a1f['id'];if(_0x1dfdc0['query'][_0xe486('0x60')]){_0x696632['where']=_[_0xe486('0x42')](_0x696632['where'],{'$or':_[_0xe486('0x35')](_0x696632[_0xe486('0x39')],function(_0x193204){var _0x403cb1={};_0x403cb1[_0x193204]={'$like':'%'+_0x1dfdc0[_0xe486('0x36')]['filter']+'%'};return _0x403cb1;})});}_0x696632=_[_0xe486('0x42')]({},_0x696632,_0x1dfdc0[_0xe486('0x43')]);return db[_0xe486('0x61')][_0xe486('0x23')]({'where':_0x696632['where']})[_0xe486('0x28')](function(_0x43a082){_0x12863d['count']=_0x43a082;if(_0x1dfdc0['query']['includeAll']){_0x696632[_0xe486('0x57')]=[{'all':!![]}];}return db['CmHopper'][_0xe486('0x46')](_0x696632);})[_0xe486('0x28')](function(_0x17f9c9){_0x12863d['rows']=_0x17f9c9;return _0x12863d;});}})[_0xe486('0x28')](respondWithFilteredResult(_0x2bec02,_0x696632))[_0xe486('0x48')](handleError(_0x2bec02,null));};exports[_0xe486('0x62')]=function(_0x1c092d,_0x4ea43e,_0x341960){var _0x2f28f5={'raw':!![],'where':{}};var _0x351154={};var _0x394eca={'count':0x0,'rows':[]};return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x1c092d[_0xe486('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4ea43e,null))[_0xe486('0x28')](function(_0x3603d2){if(_0x3603d2){_0x351154[_0xe486('0x34')]=_[_0xe486('0x37')](db[_0xe486('0x63')]['rawAttributes']);_0x351154['query']=_[_0xe486('0x37')](_0x1c092d[_0xe486('0x36')]);_0x351154[_0xe486('0x38')]=_[_0xe486('0x4a')](_0x351154[_0xe486('0x34')],_0x351154[_0xe486('0x36')]);_0x2f28f5[_0xe486('0x39')]=_['intersection'](_0x351154[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x1c092d[_0xe486('0x36')]['fields']));_0x2f28f5[_0xe486('0x39')]=_0x2f28f5[_0xe486('0x39')][_0xe486('0x3b')]?_0x2f28f5[_0xe486('0x39')]:_0x351154[_0xe486('0x34')];if(!_0x1c092d[_0xe486('0x36')][_0xe486('0x5e')](_0xe486('0x3c'))){_0x2f28f5[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x1c092d[_0xe486('0x36')][_0xe486('0x21')]);_0x2f28f5[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x1c092d[_0xe486('0x36')]['offset']);}_0x2f28f5[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x1c092d[_0xe486('0x36')][_0xe486('0x3e')]);_0x2f28f5[_0xe486('0x40')]=qs[_0xe486('0x38')](_[_0xe486('0x3f')](_0x1c092d[_0xe486('0x36')],_0x351154[_0xe486('0x38')]));_0x2f28f5[_0xe486('0x40')][_0xe486('0x5f')]=_0x3603d2['id'];if(_0x1c092d[_0xe486('0x36')][_0xe486('0x60')]){_0x2f28f5[_0xe486('0x40')]=_[_0xe486('0x42')](_0x2f28f5[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x2f28f5['attributes'],function(_0x4d0144){var _0x540206={};_0x540206[_0x4d0144]={'$like':'%'+_0x1c092d[_0xe486('0x36')][_0xe486('0x60')]+'%'};return _0x540206;})});}_0x2f28f5=_['merge']({},_0x2f28f5,_0x1c092d[_0xe486('0x43')]);return db[_0xe486('0x63')]['count']({'where':_0x2f28f5[_0xe486('0x40')]})[_0xe486('0x28')](function(_0x2b16ed){_0x394eca[_0xe486('0x23')]=_0x2b16ed;if(_0x1c092d[_0xe486('0x36')][_0xe486('0x45')]){_0x2f28f5[_0xe486('0x57')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xe486('0x46')](_0x2f28f5);})[_0xe486('0x28')](function(_0x10678b){_0x394eca['rows']=_0x10678b;return _0x394eca;});}})[_0xe486('0x28')](respondWithFilteredResult(_0x4ea43e,_0x2f28f5))[_0xe486('0x48')](handleError(_0x4ea43e,null));};exports[_0xe486('0x64')]=function(_0x3e2a12,_0x5b6052,_0x14bd14){var _0x63f070={'raw':!![],'where':{}};var _0xd82fd4={};var _0x13b8ec={'count':0x0,'rows':[]};return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x3e2a12[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x5b6052,null))[_0xe486('0x28')](function(_0x3e15e1){if(_0x3e15e1){_0xd82fd4[_0xe486('0x34')]=_[_0xe486('0x37')](db['CmHopperFinal'][_0xe486('0x30')]);_0xd82fd4[_0xe486('0x36')]=_[_0xe486('0x37')](_0x3e2a12['query']);_0xd82fd4[_0xe486('0x38')]=_[_0xe486('0x4a')](_0xd82fd4['model'],_0xd82fd4[_0xe486('0x36')]);_0x63f070[_0xe486('0x39')]=_[_0xe486('0x4a')](_0xd82fd4[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x3e2a12[_0xe486('0x36')]['fields']));_0x63f070[_0xe486('0x39')]=_0x63f070['attributes'][_0xe486('0x3b')]?_0x63f070[_0xe486('0x39')]:_0xd82fd4[_0xe486('0x34')];if(!_0x3e2a12['query'][_0xe486('0x5e')](_0xe486('0x3c'))){_0x63f070[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x3e2a12[_0xe486('0x36')][_0xe486('0x21')]);_0x63f070[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x3e2a12[_0xe486('0x36')][_0xe486('0x22')]);}_0x63f070[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x3e2a12[_0xe486('0x36')][_0xe486('0x3e')]);_0x63f070[_0xe486('0x40')]=qs[_0xe486('0x38')](_[_0xe486('0x3f')](_0x3e2a12[_0xe486('0x36')],_0xd82fd4['filters']));_0x63f070[_0xe486('0x40')][_0xe486('0x5f')]=_0x3e15e1['id'];if(_0x3e2a12['query'][_0xe486('0x60')]){_0x63f070[_0xe486('0x40')]=_[_0xe486('0x42')](_0x63f070['where'],{'$or':_[_0xe486('0x35')](_0x63f070['attributes'],function(_0x37c8c8){var _0x4537e3={};_0x4537e3[_0x37c8c8]={'$like':'%'+_0x3e2a12['query'][_0xe486('0x60')]+'%'};return _0x4537e3;})});}_0x63f070=_[_0xe486('0x42')]({},_0x63f070,_0x3e2a12['options']);return db[_0xe486('0x65')][_0xe486('0x23')]({'where':_0x63f070['where']})[_0xe486('0x28')](function(_0x20e28c){_0x13b8ec['count']=_0x20e28c;if(_0x3e2a12[_0xe486('0x36')][_0xe486('0x45')]){_0x63f070[_0xe486('0x57')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xe486('0x46')](_0x63f070);})[_0xe486('0x28')](function(_0x216ea8){_0x13b8ec['rows']=_0x216ea8;return _0x13b8ec;});}})[_0xe486('0x28')](respondWithFilteredResult(_0x5b6052,_0x63f070))[_0xe486('0x48')](handleError(_0x5b6052,null));};exports[_0xe486('0x66')]=function(_0x31f489,_0x1ef654,_0x2c583f){var _0x4ebc75={'raw':!![],'where':{}};var _0x1b0f9d={};var _0x57fe91={'count':0x0,'rows':[]};return db[_0xe486('0x44')]['findOne']({'where':{'id':_0x31f489['params']['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x1ef654,null))['then'](function(_0x44b4af){if(_0x44b4af){_0x1b0f9d[_0xe486('0x34')]=_[_0xe486('0x37')](db[_0xe486('0x67')][_0xe486('0x30')]);_0x1b0f9d[_0xe486('0x36')]=_[_0xe486('0x37')](_0x31f489[_0xe486('0x36')]);_0x1b0f9d[_0xe486('0x38')]=_['intersection'](_0x1b0f9d[_0xe486('0x34')],_0x1b0f9d['query']);_0x4ebc75[_0xe486('0x39')]=_[_0xe486('0x4a')](_0x1b0f9d[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x31f489[_0xe486('0x36')][_0xe486('0x3a')]));_0x4ebc75[_0xe486('0x39')]=_0x4ebc75['attributes'][_0xe486('0x3b')]?_0x4ebc75[_0xe486('0x39')]:_0x1b0f9d[_0xe486('0x34')];if(!_0x31f489[_0xe486('0x36')]['hasOwnProperty'](_0xe486('0x3c'))){_0x4ebc75[_0xe486('0x21')]=qs['limit'](_0x31f489[_0xe486('0x36')][_0xe486('0x21')]);_0x4ebc75[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x31f489['query']['offset']);}_0x4ebc75[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x31f489[_0xe486('0x36')]['sort']);_0x4ebc75['where']=qs['filters'](_[_0xe486('0x3f')](_0x31f489['query'],_0x1b0f9d[_0xe486('0x38')]));_0x4ebc75[_0xe486('0x40')][_0xe486('0x5f')]=_0x44b4af['id'];if(_0x31f489[_0xe486('0x36')][_0xe486('0x60')]){_0x4ebc75[_0xe486('0x40')]=_[_0xe486('0x42')](_0x4ebc75[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x4ebc75['attributes'],function(_0x521de9){var _0x15ac77={};_0x15ac77[_0x521de9]={'$like':'%'+_0x31f489[_0xe486('0x36')][_0xe486('0x60')]+'%'};return _0x15ac77;})});}_0x4ebc75=_[_0xe486('0x42')]({},_0x4ebc75,_0x31f489[_0xe486('0x43')]);return db[_0xe486('0x67')][_0xe486('0x23')]({'where':_0x4ebc75[_0xe486('0x40')]})['then'](function(_0x379e25){_0x57fe91[_0xe486('0x23')]=_0x379e25;if(_0x31f489['query'][_0xe486('0x45')]){_0x4ebc75[_0xe486('0x57')]=[{'all':!![]}];}return db[_0xe486('0x67')][_0xe486('0x46')](_0x4ebc75);})['then'](function(_0x512151){_0x57fe91[_0xe486('0x47')]=_0x512151;return _0x57fe91;});}})[_0xe486('0x28')](respondWithFilteredResult(_0x1ef654,_0x4ebc75))[_0xe486('0x48')](handleError(_0x1ef654,null));};exports[_0xe486('0x68')]=function(_0x27dbdd,_0x3775c8,_0x5d1e03){var _0x5dbec8={};var _0x884f99={};var _0x1d0271;var _0x178857;return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x27dbdd['params']['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x3775c8,null))[_0xe486('0x28')](function(_0x4867f9){if(_0x4867f9){_0x1d0271=_0x4867f9;_0x884f99[_0xe486('0x34')]=_[_0xe486('0x37')](db[_0xe486('0x69')][_0xe486('0x30')]);_0x884f99[_0xe486('0x36')]=_[_0xe486('0x37')](_0x27dbdd[_0xe486('0x36')]);_0x884f99[_0xe486('0x38')]=_[_0xe486('0x4a')](_0x884f99[_0xe486('0x34')],_0x884f99[_0xe486('0x36')]);_0x5dbec8[_0xe486('0x39')]=_[_0xe486('0x4a')](_0x884f99[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x27dbdd[_0xe486('0x36')][_0xe486('0x3a')]));_0x5dbec8['attributes']=_0x5dbec8[_0xe486('0x39')][_0xe486('0x3b')]?_0x5dbec8['attributes']:_0x884f99[_0xe486('0x34')];_0x5dbec8[_0xe486('0x3d')]=qs['sort'](_0x27dbdd[_0xe486('0x36')][_0xe486('0x3e')]);_0x5dbec8['where']=qs['filters'](_[_0xe486('0x3f')](_0x27dbdd[_0xe486('0x36')],_0x884f99[_0xe486('0x38')]));if(_0x27dbdd[_0xe486('0x36')][_0xe486('0x60')]){_0x5dbec8[_0xe486('0x40')]=_['merge'](_0x5dbec8[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x5dbec8[_0xe486('0x39')],function(_0x2d57a7){var _0x46fd1b={};_0x46fd1b[_0x2d57a7]={'$like':'%'+_0x27dbdd['query']['filter']+'%'};return _0x46fd1b;})});}_0x5dbec8=_[_0xe486('0x42')]({},_0x5dbec8,_0x27dbdd[_0xe486('0x43')]);return _0x1d0271['getLists'](_0x5dbec8);}})[_0xe486('0x28')](function(_0xaa4f8){if(_0xaa4f8){_0x178857=_0xaa4f8[_0xe486('0x3b')];if(!_0x27dbdd[_0xe486('0x36')]['hasOwnProperty'](_0xe486('0x3c'))){_0x5dbec8[_0xe486('0x21')]=qs[_0xe486('0x21')](_0x27dbdd[_0xe486('0x36')][_0xe486('0x21')]);_0x5dbec8[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x27dbdd[_0xe486('0x36')][_0xe486('0x22')]);}return _0x1d0271[_0xe486('0x68')](_0x5dbec8);}})[_0xe486('0x28')](function(_0x364af4){if(_0x364af4){return _0x364af4?{'count':_0x178857,'rows':_0x364af4}:null;}})[_0xe486('0x28')](respondWithResult(_0x3775c8,null))[_0xe486('0x48')](handleError(_0x3775c8,null));};exports['addLists']=function(_0x506598,_0x5a2dd0,_0x37fc31){var _0x2f25ed,_0x414e50;var _0x4e2250=[];var _0x491543=moment()[_0xe486('0x6a')](_0xe486('0x6b'));return db[_0xe486('0x44')][_0xe486('0x4b')]({'where':{'id':_0x506598[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x5a2dd0,null))[_0xe486('0x28')](function(_0xf214d8){if(_0xf214d8){_0x414e50=_0xf214d8;return _0xf214d8['addLists'](_0x506598['body'][_0xe486('0x6c')],_[_0xe486('0x58')](_0x506598[_0xe486('0x4d')],[_0xe486('0x6c'),'id'])||{});}return null;})['spread'](function(_0x1289e5){var _0x439f75;var _0x7bf3ff;_0x2f25ed=_0x1289e5||[];var _0x369b45=[];if(_0x1289e5){for(var _0x14d9ed=0x0;_0x14d9ed<_0x1289e5[_0xe486('0x3b')];_0x14d9ed+=0x1){var _0x1f953d=_0x1289e5[_0x14d9ed][_0xe486('0x4f')]({'plain':!![]});_0x414e50['dialCheckDuplicateType']=_0x506598[_0xe486('0x4d')]['dialCheckDuplicateType']?_0x506598[_0xe486('0x4d')]['dialCheckDuplicateType']:_0x414e50[_0xe486('0x6d')];switch(_0x414e50['dialCheckDuplicateType']){case _0xe486('0x6e'):_0x439f75=squel[_0xe486('0x6f')]()['into'](_0xe486('0x70'))[_0xe486('0x71')]([_0xe486('0x72'),_0xe486('0x73'),_0xe486('0x74'),_0xe486('0x75'),_0xe486('0x5f'),_0xe486('0x59'),'updatedAt'],squel['select']()[_0xe486('0x76')](_0xe486('0x72'),_0xe486('0x72'))[_0xe486('0x76')](_0xe486('0x77'),_0xe486('0x73'))[_0xe486('0x76')]('id',_0xe486('0x74'))['field'](_0x1f953d[_0xe486('0x78')]['toString'](),_0xe486('0x75'))[_0xe486('0x76')](_0x506598[_0xe486('0x5b')]['id']['toString'](),'CampaignId')['field']('\x27'+_0x491543+'\x27',_0xe486('0x59'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x5a'))[_0xe486('0x79')](_0xe486('0x7a'))[_0xe486('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x1f953d[_0xe486('0x78')][_0xe486('0x7b')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe486('0x40')](_0xe486('0x7c'),squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x7e'))[_0xe486('0x79')](_0xe486('0x7f'))[_0xe486('0x40')](_0xe486('0x80'),_0x506598[_0xe486('0x5b')]['id'][_0xe486('0x7b')]()))[_0xe486('0x40')](_0xe486('0x7c'),squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x81'))[_0xe486('0x79')](_0xe486('0x70'))[_0xe486('0x40')](_0xe486('0x80'),_0x506598[_0xe486('0x5b')]['id']['toString']())))[_0xe486('0x7b')]();break;case _0xe486('0x82'):_0x439f75=squel['insert']()[_0xe486('0x83')](_0xe486('0x70'))[_0xe486('0x71')]([_0xe486('0x72'),'scheduledAt','ContactId','ListId','CampaignId',_0xe486('0x59'),_0xe486('0x5a')],squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x72'),_0xe486('0x72'))[_0xe486('0x76')]('NOW()',_0xe486('0x73'))[_0xe486('0x76')]('id',_0xe486('0x74'))[_0xe486('0x76')](_0x1f953d[_0xe486('0x78')]['toString'](),_0xe486('0x75'))['field'](_0x506598['params']['id'][_0xe486('0x7b')](),_0xe486('0x5f'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x59'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x5a'))[_0xe486('0x79')](_0xe486('0x7a'))[_0xe486('0x40')](_0xe486('0x84'))[_0xe486('0x40')]('ListId\x20=\x20?',_0x1f953d[_0xe486('0x78')][_0xe486('0x7b')]())['where'](_0xe486('0x85'))['where'](_0xe486('0x7c'),squel[_0xe486('0x7d')]()[_0xe486('0x76')]('COALESCE(phone,\x27\x27)')[_0xe486('0x79')](_0xe486('0x70'))['where'](_0xe486('0x80'),_0x506598[_0xe486('0x5b')]['id'][_0xe486('0x7b')]())))[_0xe486('0x7b')]();break;default:_0x439f75=squel[_0xe486('0x6f')]()[_0xe486('0x83')]('cm_hopper')[_0xe486('0x71')](['phone',_0xe486('0x73'),_0xe486('0x74'),'ListId',_0xe486('0x5f'),_0xe486('0x59'),_0xe486('0x5a')],squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x72'),'phone')[_0xe486('0x76')](_0xe486('0x77'),_0xe486('0x73'))['field']('id',_0xe486('0x74'))[_0xe486('0x76')](_0x1f953d[_0xe486('0x78')]['toString'](),_0xe486('0x75'))[_0xe486('0x76')](_0x506598[_0xe486('0x5b')]['id'][_0xe486('0x7b')](),_0xe486('0x5f'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x59'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27',_0xe486('0x5a'))[_0xe486('0x79')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xe486('0x40')](_0xe486('0x86'),_0x1f953d[_0xe486('0x78')][_0xe486('0x7b')]())[_0xe486('0x40')](_0xe486('0x85')))[_0xe486('0x7b')]();}_0x7bf3ff=squel[_0xe486('0x6f')]()[_0xe486('0x83')](_0xe486('0x87'))[_0xe486('0x71')](['cmHopperId',_0xe486('0x73'),_0xe486('0x72'),_0xe486('0x88'),_0xe486('0x59'),_0xe486('0x5a')],squel['select']()[_0xe486('0x76')]('h.id','id')[_0xe486('0x76')]('NOW()','scheduledAt')[_0xe486('0x76')]('ci.item',_0xe486('0x72'))[_0xe486('0x76')](_0xe486('0x89'),_0xe486('0x88'))[_0xe486('0x76')]('\x27'+_0x491543+'\x27','createdAt')[_0xe486('0x76')]('\x27'+_0x491543+'\x27','updatedAt')[_0xe486('0x79')]('cm_contact_has_items','ci')[_0xe486('0x8a')]('cm_hopper','h',_0xe486('0x8b'))[_0xe486('0x40')]('h.ListId\x20=\x20?',_0x1f953d[_0xe486('0x78')]['toString']())[_0xe486('0x40')](_0xe486('0x8c'),_0x506598[_0xe486('0x5b')]['id'][_0xe486('0x7b')]())['where'](_0xe486('0x8d'),_0x491543))['toString']();_0x369b45[_0xe486('0x8e')](db[_0xe486('0x8f')][_0xe486('0x36')](_0x439f75));_0x4e2250[_0xe486('0x8e')](db[_0xe486('0x8f')][_0xe486('0x36')](_0x7bf3ff));}return BPromise[_0xe486('0x90')](_0x369b45);}})[_0xe486('0x28')](function(){return BPromise[_0xe486('0x90')](_0x4e2250);})[_0xe486('0x28')](function(){return _0x2f25ed;})[_0xe486('0x28')](respondWithResult(_0x5a2dd0,null))[_0xe486('0x48')](handleError(_0x5a2dd0,null));};exports[_0xe486('0x91')]=function(_0x319924,_0x11fc68,_0x36f91f){return db[_0xe486('0x44')][_0xe486('0x4b')]({'where':{'id':_0x319924['params']['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x11fc68,null))[_0xe486('0x28')](function(_0x382cdd){if(_0x382cdd){return _0x382cdd[_0xe486('0x91')](_0x319924[_0xe486('0x36')][_0xe486('0x6c')]);}})['then'](function(_0x4c032d){if(_0x4c032d){return db[_0xe486('0x61')]['destroy']({'where':{'ListId':_0x319924[_0xe486('0x36')][_0xe486('0x6c')],'CampaignId':_0x319924['params']['id']}})['then'](function(){return _0x4c032d;});}})[_0xe486('0x28')](respondWithStatusCode(_0x11fc68,null))['catch'](handleError(_0x11fc68,null));};exports[_0xe486('0x92')]=function(_0x40e0f3,_0x53b45d,_0x1a804d){var _0x23c08a={};var _0x42379b={};var _0xeb13bf;var _0x4314a8;return db[_0xe486('0x44')][_0xe486('0x5d')]({'where':{'id':_0x40e0f3[_0xe486('0x5b')]['id']}})['then'](handleEntityNotFound(_0x53b45d,null))['then'](function(_0x660778){if(_0x660778){_0xeb13bf=_0x660778;_0x42379b['model']=_[_0xe486('0x37')](db[_0xe486('0x69')]['rawAttributes']);_0x42379b[_0xe486('0x36')]=_[_0xe486('0x37')](_0x40e0f3['query']);_0x42379b[_0xe486('0x38')]=_[_0xe486('0x4a')](_0x42379b[_0xe486('0x34')],_0x42379b[_0xe486('0x36')]);_0x23c08a[_0xe486('0x39')]=_[_0xe486('0x4a')](_0x42379b[_0xe486('0x34')],qs[_0xe486('0x3a')](_0x40e0f3[_0xe486('0x36')][_0xe486('0x3a')]));_0x23c08a[_0xe486('0x39')]=_0x23c08a['attributes']['length']?_0x23c08a[_0xe486('0x39')]:_0x42379b[_0xe486('0x34')];_0x23c08a[_0xe486('0x3d')]=qs[_0xe486('0x3e')](_0x40e0f3[_0xe486('0x36')][_0xe486('0x3e')]);_0x23c08a[_0xe486('0x40')]=qs[_0xe486('0x38')](_['pick'](_0x40e0f3[_0xe486('0x36')],_0x42379b[_0xe486('0x38')]));if(_0x40e0f3[_0xe486('0x36')][_0xe486('0x60')]){_0x23c08a[_0xe486('0x40')]=_[_0xe486('0x42')](_0x23c08a[_0xe486('0x40')],{'$or':_[_0xe486('0x35')](_0x23c08a[_0xe486('0x39')],function(_0x2e8d19){var _0x8bc29c={};_0x8bc29c[_0x2e8d19]={'$like':'%'+_0x40e0f3[_0xe486('0x36')]['filter']+'%'};return _0x8bc29c;})});}_0x23c08a=_[_0xe486('0x42')]({},_0x23c08a,_0x40e0f3['options']);return _0xeb13bf['getBlackLists'](_0x23c08a);}})[_0xe486('0x28')](function(_0x2ca599){if(_0x2ca599){_0x4314a8=_0x2ca599['length'];if(!_0x40e0f3[_0xe486('0x36')][_0xe486('0x5e')](_0xe486('0x3c'))){_0x23c08a[_0xe486('0x21')]=qs['limit'](_0x40e0f3[_0xe486('0x36')]['limit']);_0x23c08a[_0xe486('0x22')]=qs[_0xe486('0x22')](_0x40e0f3[_0xe486('0x36')][_0xe486('0x22')]);}return _0xeb13bf['getBlackLists'](_0x23c08a);}})[_0xe486('0x28')](function(_0x2b863d){if(_0x2b863d){return _0x2b863d?{'count':_0x4314a8,'rows':_0x2b863d}:null;}})[_0xe486('0x28')](respondWithResult(_0x53b45d,null))[_0xe486('0x48')](handleError(_0x53b45d,null));};exports['addBlackLists']=function(_0x501d3f,_0x9c7f9b,_0x1fe136){var _0x248db2,_0xba5703;var _0x250045=[];var _0x4f874d=moment()[_0xe486('0x6a')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xe486('0x44')][_0xe486('0x4b')]({'where':{'id':_0x501d3f[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x9c7f9b,null))['then'](function(_0x73e5c5){if(_0x73e5c5){_0xba5703=_0x73e5c5;return _0x73e5c5['addBlackLists'](_0x501d3f[_0xe486('0x4d')]['ids'],_[_0xe486('0x58')](_0x501d3f[_0xe486('0x4d')],[_0xe486('0x6c'),'id'])||{});}return null;})[_0xe486('0x93')](function(_0x4dddb2){var _0x2fbc7c;var _0x2bfd7c;_0x248db2=_0x4dddb2||[];var _0x2ec0d7=[];if(_0x4dddb2){for(var _0x10b6b9=0x0;_0x10b6b9<_0x4dddb2[_0xe486('0x3b')];_0x10b6b9+=0x1){var _0x3d2c9c=_0x4dddb2[_0x10b6b9]['get']({'plain':!![]});_0x2fbc7c=squel['insert']()[_0xe486('0x83')](_0xe486('0x94'))[_0xe486('0x71')]([_0xe486('0x72'),_0xe486('0x74'),_0xe486('0x75'),_0xe486('0x5f'),_0xe486('0x59'),_0xe486('0x5a')],squel[_0xe486('0x7d')]()[_0xe486('0x76')](_0xe486('0x72'),_0xe486('0x72'))['field']('id','ContactId')[_0xe486('0x76')](_0x3d2c9c[_0xe486('0x78')][_0xe486('0x7b')](),'ListId')['field'](_0x501d3f['params']['id']['toString'](),_0xe486('0x5f'))['field'](_0xe486('0x77'),'createdAt')[_0xe486('0x76')](_0xe486('0x77'),_0xe486('0x5a'))[_0xe486('0x79')](_0xe486('0x7a'))['where'](_0xe486('0x84'))[_0xe486('0x40')]('ListId\x20=\x20?',_0x3d2c9c[_0xe486('0x78')][_0xe486('0x7b')]())[_0xe486('0x40')](_0xe486('0x85')))[_0xe486('0x7b')]();_0x2ec0d7[_0xe486('0x8e')](db[_0xe486('0x8f')][_0xe486('0x36')](_0x2fbc7c));}return BPromise[_0xe486('0x90')](_0x2ec0d7);}})[_0xe486('0x28')](function(){return _0x248db2;})[_0xe486('0x28')](respondWithResult(_0x9c7f9b,null))['catch'](handleError(_0x9c7f9b,null));};exports[_0xe486('0x95')]=function(_0x5b6077,_0x4e28c6,_0x32d8ba){return db['Campaign']['find']({'where':{'id':_0x5b6077[_0xe486('0x5b')]['id']}})[_0xe486('0x28')](handleEntityNotFound(_0x4e28c6,null))[_0xe486('0x28')](function(_0xc7e200){if(_0xc7e200){return _0xc7e200[_0xe486('0x95')](_0x5b6077[_0xe486('0x36')][_0xe486('0x6c')]);}})[_0xe486('0x28')](function(_0x2a9cb9){if(_0x2a9cb9){return db[_0xe486('0x67')]['destroy']({'where':{'ListId':_0x5b6077[_0xe486('0x36')]['ids'],'CampaignId':_0x5b6077[_0xe486('0x5b')]['id']}})['then'](function(){return _0x2a9cb9;});}})[_0xe486('0x28')](respondWithStatusCode(_0x4e28c6,null))[_0xe486('0x48')](handleError(_0x4e28c6,null));}; \ No newline at end of file +var _0x3276=['hasOwnProperty','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','NOW()','CmListId','toString','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','select','onlyIfOpen','ContactId','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','OrderBy','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','ListId\x20=\x20?','removeBlackLists','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','IvrCampaigns','error','stack','name','send','Campaign','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filters','filter','merge','where','map','type','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','getHoppers','findOne'];(function(_0x24e91d,_0x5d6ffe){var _0x324d8d=function(_0x53a0e0){while(--_0x53a0e0){_0x24e91d['push'](_0x24e91d['shift']());}};_0x324d8d(++_0x5d6ffe);}(_0x3276,0xc7));var _0x6327=function(_0xd49307,_0x494d50){_0xd49307=_0xd49307-0x0;var _0x5c519=_0x3276[_0xd49307];return _0x5c519;};'use strict';var emlformat=require(_0x6327('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6327('0x1'));var rp=require(_0x6327('0x2'));var moment=require(_0x6327('0x3'));var BPromise=require(_0x6327('0x4'));var Mustache=require(_0x6327('0x5'));var util=require(_0x6327('0x6'));var path=require(_0x6327('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6327('0x8'));var fs=require('fs');var fs_extra=require(_0x6327('0x9'));var _=require(_0x6327('0xa'));var squel=require('squel');var crypto=require(_0x6327('0xb'));var jsforce=require(_0x6327('0xc'));var deskjs=require(_0x6327('0xd'));var toCsv=require(_0x6327('0xe'));var querystring=require('querystring');var Papa=require(_0x6327('0xf'));var Redis=require(_0x6327('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6327('0x11'));var as=require(_0x6327('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6327('0x13'))(_0x6327('0x14'));var utils=require(_0x6327('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6327('0x16'));var db=require(_0x6327('0x17'))['db'];function respondWithStatusCode(_0xb6de72,_0x32408c){_0x32408c=_0x32408c||0xcc;return function(_0x3ff61b){if(_0x3ff61b){return _0xb6de72[_0x6327('0x18')](_0x32408c);}return _0xb6de72[_0x6327('0x19')](_0x32408c)[_0x6327('0x1a')]();};}function respondWithResult(_0x576b1c,_0x306095){_0x306095=_0x306095||0xc8;return function(_0x48eb75){if(_0x48eb75){return _0x576b1c[_0x6327('0x19')](_0x306095)['json'](_0x48eb75);}};}function respondWithFilteredResult(_0x441ff9,_0x1e850c){return function(_0x43186f){if(_0x43186f){var _0x4e9741=typeof _0x1e850c[_0x6327('0x1b')]===_0x6327('0x1c')&&typeof _0x1e850c[_0x6327('0x1d')]===_0x6327('0x1c');var _0x3ea016=_0x43186f[_0x6327('0x1e')];var _0x341a51=_0x4e9741?0x0:_0x1e850c[_0x6327('0x1b')];var _0x287899=_0x4e9741?_0x43186f[_0x6327('0x1e')]:_0x1e850c[_0x6327('0x1b')]+_0x1e850c[_0x6327('0x1d')];var _0x55cf65;if(_0x287899>=_0x3ea016){_0x287899=_0x3ea016;_0x55cf65=0xc8;}else{_0x55cf65=0xce;}_0x441ff9[_0x6327('0x19')](_0x55cf65);return _0x441ff9[_0x6327('0x1f')](_0x6327('0x20'),_0x341a51+'-'+_0x287899+'/'+_0x3ea016)[_0x6327('0x21')](_0x43186f);}return null;};}function patchUpdates(_0x4cbc80){return function(_0x56249b){try{jsonpatch[_0x6327('0x22')](_0x56249b,_0x4cbc80,!![]);}catch(_0x700766){return BPromise[_0x6327('0x23')](_0x700766);}return _0x56249b[_0x6327('0x24')]();};}function saveUpdates(_0x3078c5,_0x76c718){return function(_0x5754e1){if(_0x5754e1){return _0x5754e1[_0x6327('0x25')](_0x3078c5)[_0x6327('0x26')](function(_0x2f153c){return _0x2f153c;});}return null;};}function removeEntity(_0x1c3d7f,_0x302b3f){return function(_0x254c2f){if(_0x254c2f){return _0x254c2f[_0x6327('0x27')]()[_0x6327('0x26')](function(){var _0x10e312=_0x254c2f['get']({'plain':!![]});var _0x51dbe9=_0x6327('0x28');return db['UserProfileResource'][_0x6327('0x27')]({'where':{'type':_0x51dbe9,'resourceId':_0x10e312['id']}})['then'](function(){return _0x254c2f;});})[_0x6327('0x26')](function(){_0x1c3d7f['status'](0xcc)[_0x6327('0x1a')]();});}};}function handleEntityNotFound(_0x1eae65,_0x486f8e){return function(_0x44caac){if(!_0x44caac){_0x1eae65[_0x6327('0x18')](0x194);}return _0x44caac;};}function handleError(_0x14b41b,_0x2540bf){_0x2540bf=_0x2540bf||0x1f4;return function(_0x894157){logger[_0x6327('0x29')](_0x894157[_0x6327('0x2a')]);if(_0x894157[_0x6327('0x2b')]){delete _0x894157['name'];}_0x14b41b[_0x6327('0x19')](_0x2540bf)[_0x6327('0x2c')](_0x894157);};}exports['index']=function(_0x269c33,_0x40e927){var _0x5e8ff5={},_0x43bcd0={},_0x41ecd5={'count':0x0,'rows':[]};var _0x330471=_['map'](db[_0x6327('0x2d')][_0x6327('0x2e')],function(_0x1066d9){return{'name':_0x1066d9[_0x6327('0x2f')],'type':_0x1066d9['type'][_0x6327('0x30')]};});_0x43bcd0['model']=_['map'](_0x330471,_0x6327('0x2b'));_0x43bcd0[_0x6327('0x31')]=_[_0x6327('0x32')](_0x269c33[_0x6327('0x31')]);_0x43bcd0['filters']=_[_0x6327('0x33')](_0x43bcd0[_0x6327('0x34')],_0x43bcd0[_0x6327('0x31')]);_0x5e8ff5[_0x6327('0x35')]=_['intersection'](_0x43bcd0[_0x6327('0x34')],qs[_0x6327('0x36')](_0x269c33[_0x6327('0x31')]['fields']));_0x5e8ff5[_0x6327('0x35')]=_0x5e8ff5[_0x6327('0x35')][_0x6327('0x37')]?_0x5e8ff5['attributes']:_0x43bcd0['model'];if(!_0x269c33[_0x6327('0x31')]['hasOwnProperty'](_0x6327('0x38'))){_0x5e8ff5['limit']=qs[_0x6327('0x1d')](_0x269c33[_0x6327('0x31')][_0x6327('0x1d')]);_0x5e8ff5[_0x6327('0x1b')]=qs[_0x6327('0x1b')](_0x269c33[_0x6327('0x31')]['offset']);}_0x5e8ff5[_0x6327('0x39')]=qs[_0x6327('0x3a')](_0x269c33[_0x6327('0x31')][_0x6327('0x3a')]);_0x5e8ff5['where']=qs['filters'](_[_0x6327('0x3b')](_0x269c33[_0x6327('0x31')],_0x43bcd0[_0x6327('0x3c')]),_0x330471);if(_0x269c33[_0x6327('0x31')][_0x6327('0x3d')]){_0x5e8ff5['where']=_[_0x6327('0x3e')](_0x5e8ff5[_0x6327('0x3f')],{'$or':_[_0x6327('0x40')](_0x330471,function(_0x10b988){if(_0x10b988[_0x6327('0x41')]!=='VIRTUAL'){var _0x49a887={};_0x49a887[_0x10b988[_0x6327('0x2b')]]={'$like':'%'+_0x269c33['query'][_0x6327('0x3d')]+'%'};return _0x49a887;}})});}_0x5e8ff5=_[_0x6327('0x3e')]({},_0x5e8ff5,_0x269c33[_0x6327('0x42')]);var _0x46b813={'where':_0x5e8ff5['where']};return db[_0x6327('0x2d')][_0x6327('0x1e')](_0x46b813)[_0x6327('0x26')](function(_0x592f0e){_0x41ecd5[_0x6327('0x1e')]=_0x592f0e;if(_0x269c33[_0x6327('0x31')]['includeAll']){_0x5e8ff5[_0x6327('0x43')]=[{'all':!![]}];}return db[_0x6327('0x2d')][_0x6327('0x44')](_0x5e8ff5);})[_0x6327('0x26')](function(_0xab88fb){_0x41ecd5[_0x6327('0x45')]=_0xab88fb;return _0x41ecd5;})[_0x6327('0x26')](respondWithFilteredResult(_0x40e927,_0x5e8ff5))[_0x6327('0x46')](handleError(_0x40e927,null));};exports[_0x6327('0x47')]=function(_0xc73e4a,_0x446f7c){var _0x3550c9={'raw':![],'where':{'id':_0xc73e4a[_0x6327('0x48')]['id']}},_0x115ed4={};_0x115ed4[_0x6327('0x34')]=_[_0x6327('0x32')](db[_0x6327('0x2d')][_0x6327('0x2e')]);_0x115ed4['query']=_[_0x6327('0x32')](_0xc73e4a[_0x6327('0x31')]);_0x115ed4['filters']=_['intersection'](_0x115ed4['model'],_0x115ed4[_0x6327('0x31')]);_0x3550c9[_0x6327('0x35')]=_['intersection'](_0x115ed4[_0x6327('0x34')],qs[_0x6327('0x36')](_0xc73e4a[_0x6327('0x31')][_0x6327('0x36')]));_0x3550c9[_0x6327('0x35')]=_0x3550c9[_0x6327('0x35')][_0x6327('0x37')]?_0x3550c9[_0x6327('0x35')]:_0x115ed4[_0x6327('0x34')];if(_0xc73e4a['query'][_0x6327('0x49')]){_0x3550c9[_0x6327('0x43')]=[{'all':!![]}];}_0x3550c9=_[_0x6327('0x3e')]({},_0x3550c9,_0xc73e4a['options']);return db[_0x6327('0x2d')][_0x6327('0x4a')](_0x3550c9)[_0x6327('0x26')](handleEntityNotFound(_0x446f7c,null))[_0x6327('0x26')](respondWithResult(_0x446f7c,null))['catch'](handleError(_0x446f7c,null));};exports[_0x6327('0x4b')]=function(_0x317edf,_0x3fc622){return db[_0x6327('0x2d')][_0x6327('0x4b')](_0x317edf[_0x6327('0x4c')],{})[_0x6327('0x26')](function(_0x33e8d3){var _0x11030e=_0x317edf[_0x6327('0x4d')][_0x6327('0x4e')]({'plain':!![]});if(!_0x11030e)throw new Error(_0x6327('0x4f'));if(_0x11030e[_0x6327('0x50')]===_0x6327('0x4d')){var _0x5e664d=_0x33e8d3['get']({'plain':!![]});var _0x1f95b6=_0x6327('0x28');return db[_0x6327('0x51')][_0x6327('0x4a')]({'where':{'name':_0x1f95b6,'userProfileId':_0x11030e[_0x6327('0x52')]},'raw':!![]})[_0x6327('0x26')](function(_0xc07c32){if(_0xc07c32&&_0xc07c32[_0x6327('0x53')]===0x0){return db[_0x6327('0x54')][_0x6327('0x4b')]({'name':_0x5e664d[_0x6327('0x2b')],'resourceId':_0x5e664d['id'],'type':_0xc07c32[_0x6327('0x2b')],'sectionId':_0xc07c32['id']},{})[_0x6327('0x26')](function(){return _0x33e8d3;});}else{return _0x33e8d3;}})[_0x6327('0x46')](function(_0x5daaed){logger[_0x6327('0x29')](_0x6327('0x55'),_0x5daaed);throw _0x5daaed;});}return _0x33e8d3;})[_0x6327('0x26')](respondWithResult(_0x3fc622,0xc9))[_0x6327('0x46')](handleError(_0x3fc622,null));};exports['clone']=function(_0x3e2b4f,_0x2ad46b){var _0x12862d={'where':{'id':_0x3e2b4f[_0x6327('0x48')]['id']}},_0x1bf90e={};_0x1bf90e['model']=_[_0x6327('0x32')](db['Campaign'][_0x6327('0x2e')]);_0x12862d[_0x6327('0x35')]=_[_0x6327('0x33')](_0x1bf90e[_0x6327('0x34')],qs[_0x6327('0x36')](_0x3e2b4f[_0x6327('0x31')]['fields']));_0x12862d[_0x6327('0x35')]=_0x12862d[_0x6327('0x35')]['length']?_0x12862d[_0x6327('0x35')]:_0x1bf90e[_0x6327('0x34')];if(_0x3e2b4f[_0x6327('0x31')][_0x6327('0x49')]){_0x12862d[_0x6327('0x43')]=[{'all':!![]}];}_0x12862d=_[_0x6327('0x3e')]({},_0x12862d,_0x3e2b4f[_0x6327('0x42')]);return db[_0x6327('0x2d')]['find'](_0x12862d)[_0x6327('0x26')](handleEntityNotFound(_0x2ad46b,null))[_0x6327('0x26')](function(_0x46c6bd){if(_0x46c6bd){var _0x2188c2=_0x46c6bd[_0x6327('0x4e')]({'plain':!![]});_0x2188c2=qs[_0x6327('0x56')](_0x2188c2,['id','createdAt',_0x6327('0x57')]);_0x3e2b4f['body']=_[_0x6327('0x56')](_0x3e2b4f[_0x6327('0x4c')],['id',_0x6327('0x58'),_0x6327('0x57')]);return db[_0x6327('0x2d')][_0x6327('0x4b')](_[_0x6327('0x3e')](_0x2188c2,_0x3e2b4f[_0x6327('0x4c')]),{'include':_0x3e2b4f[_0x6327('0x31')][_0x6327('0x49')]?[{'all':!![]}]:undefined})[_0x6327('0x26')](function(_0x36f28a){var _0x3f0115=_0x3e2b4f['user'][_0x6327('0x4e')]({'plain':!![]});if(!_0x3f0115)throw new Error(_0x6327('0x4f'));if(_0x3f0115[_0x6327('0x50')]==='user'){var _0xbf5d09=_0x36f28a[_0x6327('0x4e')]({'plain':!![]});var _0x57ca83='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x57ca83,'userProfileId':_0x3f0115[_0x6327('0x52')]},'raw':!![]})[_0x6327('0x26')](function(_0x36f8c2){if(_0x36f8c2&&_0x36f8c2[_0x6327('0x53')]===0x0){return db[_0x6327('0x54')]['create']({'name':_0xbf5d09['name'],'resourceId':_0xbf5d09['id'],'type':_0x36f8c2[_0x6327('0x2b')],'sectionId':_0x36f8c2['id']},{})[_0x6327('0x26')](function(){return _0x36f28a;});}else{return _0x36f28a;}})['catch'](function(_0x28f13e){logger[_0x6327('0x29')](_0x6327('0x55'),_0x28f13e);throw _0x28f13e;});}return _0x36f28a;});}})[_0x6327('0x26')](respondWithResult(_0x2ad46b,0xc9))[_0x6327('0x46')](handleError(_0x2ad46b,null));};exports[_0x6327('0x25')]=function(_0x4b4031,_0x5446db){if(_0x4b4031['body']['id']){delete _0x4b4031[_0x6327('0x4c')]['id'];}return db[_0x6327('0x2d')]['find']({'where':{'id':_0x4b4031['params']['id']}})['then'](handleEntityNotFound(_0x5446db,null))[_0x6327('0x26')](saveUpdates(_0x4b4031[_0x6327('0x4c')],null))[_0x6327('0x26')](respondWithResult(_0x5446db,null))[_0x6327('0x46')](handleError(_0x5446db,null));};exports['destroy']=function(_0x3e66b5,_0x276fe1){return db[_0x6327('0x2d')]['find']({'where':{'id':_0x3e66b5['params']['id']}})['then'](handleEntityNotFound(_0x276fe1,null))[_0x6327('0x26')](removeEntity(_0x276fe1,null))[_0x6327('0x46')](handleError(_0x276fe1,null));};exports[_0x6327('0x59')]=function(_0x4c9e12,_0x513e06,_0x54326a){var _0x17b571={'raw':!![],'where':{}};var _0x5bbc4a={};var _0x1e2376={'count':0x0,'rows':[]};return db['Campaign'][_0x6327('0x5a')]({'where':{'id':_0x4c9e12[_0x6327('0x48')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x513e06,null))['then'](function(_0x4bdeab){if(_0x4bdeab){_0x5bbc4a[_0x6327('0x34')]=_[_0x6327('0x32')](db['CmHopper'][_0x6327('0x2e')]);_0x5bbc4a[_0x6327('0x31')]=_[_0x6327('0x32')](_0x4c9e12['query']);_0x5bbc4a[_0x6327('0x3c')]=_['intersection'](_0x5bbc4a[_0x6327('0x34')],_0x5bbc4a[_0x6327('0x31')]);_0x17b571[_0x6327('0x35')]=_[_0x6327('0x33')](_0x5bbc4a[_0x6327('0x34')],qs[_0x6327('0x36')](_0x4c9e12[_0x6327('0x31')][_0x6327('0x36')]));_0x17b571['attributes']=_0x17b571[_0x6327('0x35')][_0x6327('0x37')]?_0x17b571[_0x6327('0x35')]:_0x5bbc4a[_0x6327('0x34')];if(!_0x4c9e12['query'][_0x6327('0x5b')](_0x6327('0x38'))){_0x17b571[_0x6327('0x1d')]=qs[_0x6327('0x1d')](_0x4c9e12['query'][_0x6327('0x1d')]);_0x17b571[_0x6327('0x1b')]=qs['offset'](_0x4c9e12[_0x6327('0x31')][_0x6327('0x1b')]);}_0x17b571['order']=qs[_0x6327('0x3a')](_0x4c9e12['query'][_0x6327('0x3a')]);_0x17b571[_0x6327('0x3f')]=qs[_0x6327('0x3c')](_['pick'](_0x4c9e12[_0x6327('0x31')],_0x5bbc4a['filters']));_0x17b571['where'][_0x6327('0x5c')]=_0x4bdeab['id'];if(_0x4c9e12['query'][_0x6327('0x3d')]){_0x17b571[_0x6327('0x3f')]=_[_0x6327('0x3e')](_0x17b571[_0x6327('0x3f')],{'$or':_[_0x6327('0x40')](_0x17b571[_0x6327('0x35')],function(_0x1b3a5e){var _0x29ee0f={};_0x29ee0f[_0x1b3a5e]={'$like':'%'+_0x4c9e12[_0x6327('0x31')][_0x6327('0x3d')]+'%'};return _0x29ee0f;})});}_0x17b571=_['merge']({},_0x17b571,_0x4c9e12[_0x6327('0x42')]);return db[_0x6327('0x5d')][_0x6327('0x1e')]({'where':_0x17b571['where']})['then'](function(_0x55645d){_0x1e2376['count']=_0x55645d;if(_0x4c9e12[_0x6327('0x31')][_0x6327('0x49')]){_0x17b571[_0x6327('0x43')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x17b571);})[_0x6327('0x26')](function(_0x45bc3d){_0x1e2376[_0x6327('0x45')]=_0x45bc3d;return _0x1e2376;});}})[_0x6327('0x26')](respondWithFilteredResult(_0x513e06,_0x17b571))['catch'](handleError(_0x513e06,null));};exports[_0x6327('0x5e')]=function(_0x7d3f15,_0x4346b8,_0x3973dd){var _0x188557={'raw':!![],'where':{}};var _0x33b36f={};var _0x3ecb75={'count':0x0,'rows':[]};return db['Campaign'][_0x6327('0x5a')]({'where':{'id':_0x7d3f15['params']['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x4346b8,null))[_0x6327('0x26')](function(_0x101a46){if(_0x101a46){_0x33b36f['model']=_[_0x6327('0x32')](db[_0x6327('0x5f')][_0x6327('0x2e')]);_0x33b36f[_0x6327('0x31')]=_[_0x6327('0x32')](_0x7d3f15['query']);_0x33b36f['filters']=_[_0x6327('0x33')](_0x33b36f[_0x6327('0x34')],_0x33b36f[_0x6327('0x31')]);_0x188557['attributes']=_[_0x6327('0x33')](_0x33b36f[_0x6327('0x34')],qs[_0x6327('0x36')](_0x7d3f15[_0x6327('0x31')]['fields']));_0x188557['attributes']=_0x188557[_0x6327('0x35')][_0x6327('0x37')]?_0x188557['attributes']:_0x33b36f['model'];if(!_0x7d3f15[_0x6327('0x31')][_0x6327('0x5b')](_0x6327('0x38'))){_0x188557[_0x6327('0x1d')]=qs[_0x6327('0x1d')](_0x7d3f15[_0x6327('0x31')][_0x6327('0x1d')]);_0x188557[_0x6327('0x1b')]=qs['offset'](_0x7d3f15['query'][_0x6327('0x1b')]);}_0x188557[_0x6327('0x39')]=qs[_0x6327('0x3a')](_0x7d3f15['query']['sort']);_0x188557['where']=qs[_0x6327('0x3c')](_['pick'](_0x7d3f15[_0x6327('0x31')],_0x33b36f['filters']));_0x188557['where']['CampaignId']=_0x101a46['id'];if(_0x7d3f15[_0x6327('0x31')]['filter']){_0x188557[_0x6327('0x3f')]=_[_0x6327('0x3e')](_0x188557[_0x6327('0x3f')],{'$or':_[_0x6327('0x40')](_0x188557['attributes'],function(_0x2936da){var _0x5e721b={};_0x5e721b[_0x2936da]={'$like':'%'+_0x7d3f15[_0x6327('0x31')][_0x6327('0x3d')]+'%'};return _0x5e721b;})});}_0x188557=_[_0x6327('0x3e')]({},_0x188557,_0x7d3f15[_0x6327('0x42')]);return db[_0x6327('0x5f')][_0x6327('0x1e')]({'where':_0x188557[_0x6327('0x3f')]})[_0x6327('0x26')](function(_0x52b63f){_0x3ecb75['count']=_0x52b63f;if(_0x7d3f15[_0x6327('0x31')][_0x6327('0x49')]){_0x188557[_0x6327('0x43')]=[{'all':!![]}];}return db[_0x6327('0x5f')][_0x6327('0x44')](_0x188557);})[_0x6327('0x26')](function(_0x561b1a){_0x3ecb75[_0x6327('0x45')]=_0x561b1a;return _0x3ecb75;});}})[_0x6327('0x26')](respondWithFilteredResult(_0x4346b8,_0x188557))[_0x6327('0x46')](handleError(_0x4346b8,null));};exports['getHopperFinals']=function(_0x59a5cc,_0x15a1dc,_0x424e54){var _0x35477c={'raw':!![],'where':{}};var _0x1193c5={};var _0x12726d={'count':0x0,'rows':[]};return db[_0x6327('0x2d')]['findOne']({'where':{'id':_0x59a5cc[_0x6327('0x48')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x15a1dc,null))[_0x6327('0x26')](function(_0x40019b){if(_0x40019b){_0x1193c5[_0x6327('0x34')]=_[_0x6327('0x32')](db[_0x6327('0x60')]['rawAttributes']);_0x1193c5[_0x6327('0x31')]=_[_0x6327('0x32')](_0x59a5cc[_0x6327('0x31')]);_0x1193c5[_0x6327('0x3c')]=_[_0x6327('0x33')](_0x1193c5['model'],_0x1193c5['query']);_0x35477c[_0x6327('0x35')]=_[_0x6327('0x33')](_0x1193c5[_0x6327('0x34')],qs[_0x6327('0x36')](_0x59a5cc[_0x6327('0x31')][_0x6327('0x36')]));_0x35477c['attributes']=_0x35477c[_0x6327('0x35')][_0x6327('0x37')]?_0x35477c[_0x6327('0x35')]:_0x1193c5['model'];if(!_0x59a5cc[_0x6327('0x31')][_0x6327('0x5b')](_0x6327('0x38'))){_0x35477c[_0x6327('0x1d')]=qs['limit'](_0x59a5cc[_0x6327('0x31')][_0x6327('0x1d')]);_0x35477c[_0x6327('0x1b')]=qs[_0x6327('0x1b')](_0x59a5cc[_0x6327('0x31')][_0x6327('0x1b')]);}_0x35477c[_0x6327('0x39')]=qs[_0x6327('0x3a')](_0x59a5cc[_0x6327('0x31')]['sort']);_0x35477c[_0x6327('0x3f')]=qs['filters'](_[_0x6327('0x3b')](_0x59a5cc[_0x6327('0x31')],_0x1193c5['filters']));_0x35477c[_0x6327('0x3f')]['CampaignId']=_0x40019b['id'];if(_0x59a5cc[_0x6327('0x31')]['filter']){_0x35477c[_0x6327('0x3f')]=_['merge'](_0x35477c[_0x6327('0x3f')],{'$or':_['map'](_0x35477c[_0x6327('0x35')],function(_0xb46760){var _0x173560={};_0x173560[_0xb46760]={'$like':'%'+_0x59a5cc['query']['filter']+'%'};return _0x173560;})});}_0x35477c=_[_0x6327('0x3e')]({},_0x35477c,_0x59a5cc[_0x6327('0x42')]);return db['CmHopperFinal'][_0x6327('0x1e')]({'where':_0x35477c[_0x6327('0x3f')]})[_0x6327('0x26')](function(_0x5d6a16){_0x12726d[_0x6327('0x1e')]=_0x5d6a16;if(_0x59a5cc[_0x6327('0x31')]['includeAll']){_0x35477c['include']=[{'all':!![]}];}return db[_0x6327('0x60')][_0x6327('0x44')](_0x35477c);})[_0x6327('0x26')](function(_0x3f23c4){_0x12726d['rows']=_0x3f23c4;return _0x12726d;});}})[_0x6327('0x26')](respondWithFilteredResult(_0x15a1dc,_0x35477c))[_0x6327('0x46')](handleError(_0x15a1dc,null));};exports[_0x6327('0x61')]=function(_0x48645b,_0xf25a85,_0x18cba6){var _0x6c8c4c={'raw':!![],'where':{}};var _0x1b6b96={};var _0x254fdc={'count':0x0,'rows':[]};return db[_0x6327('0x2d')][_0x6327('0x5a')]({'where':{'id':_0x48645b[_0x6327('0x48')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0xf25a85,null))[_0x6327('0x26')](function(_0x43eae1){if(_0x43eae1){_0x1b6b96['model']=_[_0x6327('0x32')](db['CmHopperBlack'][_0x6327('0x2e')]);_0x1b6b96[_0x6327('0x31')]=_[_0x6327('0x32')](_0x48645b[_0x6327('0x31')]);_0x1b6b96[_0x6327('0x3c')]=_['intersection'](_0x1b6b96[_0x6327('0x34')],_0x1b6b96['query']);_0x6c8c4c[_0x6327('0x35')]=_[_0x6327('0x33')](_0x1b6b96[_0x6327('0x34')],qs[_0x6327('0x36')](_0x48645b[_0x6327('0x31')][_0x6327('0x36')]));_0x6c8c4c[_0x6327('0x35')]=_0x6c8c4c[_0x6327('0x35')][_0x6327('0x37')]?_0x6c8c4c[_0x6327('0x35')]:_0x1b6b96[_0x6327('0x34')];if(!_0x48645b[_0x6327('0x31')][_0x6327('0x5b')]('nolimit')){_0x6c8c4c[_0x6327('0x1d')]=qs['limit'](_0x48645b['query'][_0x6327('0x1d')]);_0x6c8c4c[_0x6327('0x1b')]=qs[_0x6327('0x1b')](_0x48645b[_0x6327('0x31')]['offset']);}_0x6c8c4c[_0x6327('0x39')]=qs['sort'](_0x48645b['query']['sort']);_0x6c8c4c['where']=qs[_0x6327('0x3c')](_['pick'](_0x48645b[_0x6327('0x31')],_0x1b6b96[_0x6327('0x3c')]));_0x6c8c4c[_0x6327('0x3f')]['CampaignId']=_0x43eae1['id'];if(_0x48645b[_0x6327('0x31')][_0x6327('0x3d')]){_0x6c8c4c[_0x6327('0x3f')]=_['merge'](_0x6c8c4c[_0x6327('0x3f')],{'$or':_[_0x6327('0x40')](_0x6c8c4c[_0x6327('0x35')],function(_0x267bdc){var _0x30e33c={};_0x30e33c[_0x267bdc]={'$like':'%'+_0x48645b[_0x6327('0x31')][_0x6327('0x3d')]+'%'};return _0x30e33c;})});}_0x6c8c4c=_[_0x6327('0x3e')]({},_0x6c8c4c,_0x48645b[_0x6327('0x42')]);return db[_0x6327('0x62')][_0x6327('0x1e')]({'where':_0x6c8c4c['where']})['then'](function(_0x2a225b){_0x254fdc[_0x6327('0x1e')]=_0x2a225b;if(_0x48645b[_0x6327('0x31')]['includeAll']){_0x6c8c4c['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x6327('0x44')](_0x6c8c4c);})['then'](function(_0x43381e){_0x254fdc[_0x6327('0x45')]=_0x43381e;return _0x254fdc;});}})['then'](respondWithFilteredResult(_0xf25a85,_0x6c8c4c))[_0x6327('0x46')](handleError(_0xf25a85,null));};exports[_0x6327('0x63')]=function(_0x2bb6e5,_0x59b7f0,_0x1c9921){var _0x3fed01={};var _0x345f6c={};var _0xd091e1;var _0x9f1c8d;return db[_0x6327('0x2d')][_0x6327('0x5a')]({'where':{'id':_0x2bb6e5['params']['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x59b7f0,null))[_0x6327('0x26')](function(_0x27e847){if(_0x27e847){_0xd091e1=_0x27e847;_0x345f6c[_0x6327('0x34')]=_[_0x6327('0x32')](db[_0x6327('0x64')][_0x6327('0x2e')]);_0x345f6c['query']=_[_0x6327('0x32')](_0x2bb6e5[_0x6327('0x31')]);_0x345f6c[_0x6327('0x3c')]=_[_0x6327('0x33')](_0x345f6c[_0x6327('0x34')],_0x345f6c[_0x6327('0x31')]);_0x3fed01[_0x6327('0x35')]=_[_0x6327('0x33')](_0x345f6c[_0x6327('0x34')],qs[_0x6327('0x36')](_0x2bb6e5[_0x6327('0x31')][_0x6327('0x36')]));_0x3fed01[_0x6327('0x35')]=_0x3fed01['attributes']['length']?_0x3fed01[_0x6327('0x35')]:_0x345f6c[_0x6327('0x34')];_0x3fed01[_0x6327('0x39')]=qs[_0x6327('0x3a')](_0x2bb6e5[_0x6327('0x31')][_0x6327('0x3a')]);_0x3fed01[_0x6327('0x3f')]=qs[_0x6327('0x3c')](_[_0x6327('0x3b')](_0x2bb6e5[_0x6327('0x31')],_0x345f6c['filters']));if(_0x2bb6e5[_0x6327('0x31')][_0x6327('0x3d')]){_0x3fed01[_0x6327('0x3f')]=_[_0x6327('0x3e')](_0x3fed01[_0x6327('0x3f')],{'$or':_[_0x6327('0x40')](_0x3fed01[_0x6327('0x35')],function(_0x13abc5){var _0x518315={};_0x518315[_0x13abc5]={'$like':'%'+_0x2bb6e5[_0x6327('0x31')][_0x6327('0x3d')]+'%'};return _0x518315;})});}_0x3fed01=_[_0x6327('0x3e')]({},_0x3fed01,_0x2bb6e5['options']);return _0xd091e1[_0x6327('0x63')](_0x3fed01);}})[_0x6327('0x26')](function(_0x42d4ff){if(_0x42d4ff){_0x9f1c8d=_0x42d4ff[_0x6327('0x37')];if(!_0x2bb6e5[_0x6327('0x31')][_0x6327('0x5b')](_0x6327('0x38'))){_0x3fed01[_0x6327('0x1d')]=qs[_0x6327('0x1d')](_0x2bb6e5[_0x6327('0x31')]['limit']);_0x3fed01[_0x6327('0x1b')]=qs[_0x6327('0x1b')](_0x2bb6e5[_0x6327('0x31')][_0x6327('0x1b')]);}return _0xd091e1[_0x6327('0x63')](_0x3fed01);}})['then'](function(_0x48888c){if(_0x48888c){return _0x48888c?{'count':_0x9f1c8d,'rows':_0x48888c}:null;}})['then'](respondWithResult(_0x59b7f0,null))[_0x6327('0x46')](handleError(_0x59b7f0,null));};exports[_0x6327('0x65')]=function(_0x3f1526,_0x3cd50a,_0x718062){var _0x132990,_0x486571;var _0x56c2b0=[];var _0x364719=moment()[_0x6327('0x66')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x6327('0x4a')]({'where':{'id':_0x3f1526[_0x6327('0x48')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x3cd50a,null))[_0x6327('0x26')](function(_0x594fb3){if(_0x594fb3){_0x486571=_0x594fb3;return _0x594fb3[_0x6327('0x65')](_0x3f1526[_0x6327('0x4c')][_0x6327('0x67')],_[_0x6327('0x56')](_0x3f1526[_0x6327('0x4c')],[_0x6327('0x67'),'id'])||{});}return null;})[_0x6327('0x68')](function(_0x9e2e85){var _0x4174e4;var _0x4fa038;_0x132990=_0x9e2e85||[];var _0x570605=[];if(_0x9e2e85){for(var _0x1aa3ba=0x0;_0x1aa3ba<_0x9e2e85[_0x6327('0x37')];_0x1aa3ba+=0x1){var _0x3534a9=_0x9e2e85[_0x1aa3ba]['get']({'plain':!![]});_0x486571['dialCheckDuplicateType']=_0x3f1526[_0x6327('0x4c')]['dialCheckDuplicateType']?_0x3f1526[_0x6327('0x4c')][_0x6327('0x69')]:_0x486571[_0x6327('0x69')];switch(_0x486571[_0x6327('0x69')]){case _0x6327('0x6a'):_0x4174e4=squel[_0x6327('0x6b')]()[_0x6327('0x6c')](_0x6327('0x6d'))[_0x6327('0x6e')]([_0x6327('0x6f'),_0x6327('0x70'),'ContactId',_0x6327('0x71'),_0x6327('0x5c'),_0x6327('0x58'),_0x6327('0x57')],squel['select']()[_0x6327('0x72')](_0x6327('0x6f'),_0x6327('0x6f'))[_0x6327('0x72')](_0x6327('0x73'),_0x6327('0x70'))[_0x6327('0x72')]('id','ContactId')[_0x6327('0x72')](_0x3534a9[_0x6327('0x74')][_0x6327('0x75')](),'ListId')[_0x6327('0x72')](_0x3f1526['params']['id'][_0x6327('0x75')](),_0x6327('0x5c'))[_0x6327('0x72')]('\x27'+_0x364719+'\x27','createdAt')[_0x6327('0x72')]('\x27'+_0x364719+'\x27',_0x6327('0x57'))[_0x6327('0x76')](_0x6327('0x77'))[_0x6327('0x3f')]('deletedAt\x20IS\x20NULL')[_0x6327('0x3f')]('ListId\x20=\x20?',_0x3534a9[_0x6327('0x74')][_0x6327('0x75')]())[_0x6327('0x3f')](_0x6327('0x78'))[_0x6327('0x3f')](_0x6327('0x79'),squel['select']()['field'](_0x6327('0x7a'))['from'](_0x6327('0x7b'))[_0x6327('0x3f')](_0x6327('0x7c'),_0x3f1526[_0x6327('0x48')]['id'][_0x6327('0x75')]()))[_0x6327('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6327('0x7d')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x6327('0x6d'))[_0x6327('0x3f')]('CampaignId\x20=\x20?',_0x3f1526[_0x6327('0x48')]['id'][_0x6327('0x75')]())))['toString']();break;case _0x6327('0x7e'):_0x4174e4=squel[_0x6327('0x6b')]()[_0x6327('0x6c')](_0x6327('0x6d'))[_0x6327('0x6e')]([_0x6327('0x6f'),_0x6327('0x70'),_0x6327('0x7f'),_0x6327('0x71'),_0x6327('0x5c'),_0x6327('0x58'),_0x6327('0x57')],squel[_0x6327('0x7d')]()[_0x6327('0x72')](_0x6327('0x6f'),_0x6327('0x6f'))[_0x6327('0x72')]('NOW()',_0x6327('0x70'))[_0x6327('0x72')]('id',_0x6327('0x7f'))[_0x6327('0x72')](_0x3534a9[_0x6327('0x74')][_0x6327('0x75')](),_0x6327('0x71'))[_0x6327('0x72')](_0x3f1526[_0x6327('0x48')]['id']['toString'](),_0x6327('0x5c'))[_0x6327('0x72')]('\x27'+_0x364719+'\x27','createdAt')[_0x6327('0x72')]('\x27'+_0x364719+'\x27','updatedAt')[_0x6327('0x76')](_0x6327('0x77'))[_0x6327('0x3f')]('deletedAt\x20IS\x20NULL')[_0x6327('0x3f')]('ListId\x20=\x20?',_0x3534a9[_0x6327('0x74')][_0x6327('0x75')]())[_0x6327('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x6327('0x3f')](_0x6327('0x79'),squel[_0x6327('0x7d')]()[_0x6327('0x72')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x6327('0x3f')]('CampaignId\x20=\x20?',_0x3f1526['params']['id'][_0x6327('0x75')]())))[_0x6327('0x75')]();break;default:_0x4174e4=squel[_0x6327('0x6b')]()[_0x6327('0x6c')]('cm_hopper')['fromQuery']([_0x6327('0x6f'),'scheduledAt',_0x6327('0x7f'),_0x6327('0x71'),'CampaignId',_0x6327('0x58'),'updatedAt'],squel[_0x6327('0x7d')]()['field'](_0x6327('0x6f'),'phone')[_0x6327('0x72')](_0x6327('0x73'),_0x6327('0x70'))[_0x6327('0x72')]('id',_0x6327('0x7f'))[_0x6327('0x72')](_0x3534a9['CmListId'][_0x6327('0x75')](),_0x6327('0x71'))['field'](_0x3f1526['params']['id']['toString'](),_0x6327('0x5c'))['field']('\x27'+_0x364719+'\x27',_0x6327('0x58'))[_0x6327('0x72')]('\x27'+_0x364719+'\x27',_0x6327('0x57'))['from']('cm_contacts')['where'](_0x6327('0x80'))[_0x6327('0x3f')]('ListId\x20=\x20?',_0x3534a9['CmListId'][_0x6327('0x75')]())[_0x6327('0x3f')](_0x6327('0x78')))['toString']();}_0x4fa038=squel[_0x6327('0x6b')]()[_0x6327('0x6c')](_0x6327('0x81'))['fromQuery'](['cmHopperId',_0x6327('0x70'),_0x6327('0x6f'),_0x6327('0x82'),'createdAt','updatedAt'],squel[_0x6327('0x7d')]()[_0x6327('0x72')]('h.id','id')[_0x6327('0x72')](_0x6327('0x73'),'scheduledAt')[_0x6327('0x72')]('ci.item','phone')[_0x6327('0x72')](_0x6327('0x83'),_0x6327('0x82'))[_0x6327('0x72')]('\x27'+_0x364719+'\x27',_0x6327('0x58'))[_0x6327('0x72')]('\x27'+_0x364719+'\x27',_0x6327('0x57'))[_0x6327('0x76')](_0x6327('0x84'),'ci')[_0x6327('0x85')](_0x6327('0x6d'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x6327('0x3f')](_0x6327('0x86'),_0x3534a9[_0x6327('0x74')][_0x6327('0x75')]())[_0x6327('0x3f')](_0x6327('0x87'),_0x3f1526[_0x6327('0x48')]['id'][_0x6327('0x75')]())[_0x6327('0x3f')](_0x6327('0x88'),_0x364719))[_0x6327('0x75')]();_0x570605[_0x6327('0x89')](db[_0x6327('0x8a')]['query'](_0x4174e4));_0x56c2b0[_0x6327('0x89')](db[_0x6327('0x8a')][_0x6327('0x31')](_0x4fa038));}return BPromise[_0x6327('0x8b')](_0x570605);}})['then'](function(){return BPromise[_0x6327('0x8b')](_0x56c2b0);})[_0x6327('0x26')](function(){return _0x132990;})[_0x6327('0x26')](respondWithResult(_0x3cd50a,null))[_0x6327('0x46')](handleError(_0x3cd50a,null));};exports[_0x6327('0x8c')]=function(_0x1a719a,_0x13a38c,_0x457343){return db[_0x6327('0x2d')][_0x6327('0x4a')]({'where':{'id':_0x1a719a[_0x6327('0x48')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x13a38c,null))[_0x6327('0x26')](function(_0xdad37e){if(_0xdad37e){return _0xdad37e[_0x6327('0x8c')](_0x1a719a[_0x6327('0x31')][_0x6327('0x67')]);}})[_0x6327('0x26')](function(_0x1f4b95){if(_0x1f4b95){return db[_0x6327('0x5d')][_0x6327('0x27')]({'where':{'ListId':_0x1a719a[_0x6327('0x31')][_0x6327('0x67')],'CampaignId':_0x1a719a[_0x6327('0x48')]['id']}})[_0x6327('0x26')](function(){return _0x1f4b95;});}})[_0x6327('0x26')](respondWithStatusCode(_0x13a38c,null))[_0x6327('0x46')](handleError(_0x13a38c,null));};exports[_0x6327('0x8d')]=function(_0x49975c,_0x6546a9,_0x526d09){var _0x26582e={};var _0x4f0579={};var _0x4ec482;var _0xf593bf;return db[_0x6327('0x2d')][_0x6327('0x5a')]({'where':{'id':_0x49975c[_0x6327('0x48')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x6546a9,null))[_0x6327('0x26')](function(_0xaee17e){if(_0xaee17e){_0x4ec482=_0xaee17e;_0x4f0579[_0x6327('0x34')]=_[_0x6327('0x32')](db[_0x6327('0x64')][_0x6327('0x2e')]);_0x4f0579[_0x6327('0x31')]=_[_0x6327('0x32')](_0x49975c[_0x6327('0x31')]);_0x4f0579['filters']=_[_0x6327('0x33')](_0x4f0579[_0x6327('0x34')],_0x4f0579[_0x6327('0x31')]);_0x26582e['attributes']=_['intersection'](_0x4f0579['model'],qs['fields'](_0x49975c[_0x6327('0x31')][_0x6327('0x36')]));_0x26582e[_0x6327('0x35')]=_0x26582e['attributes'][_0x6327('0x37')]?_0x26582e[_0x6327('0x35')]:_0x4f0579[_0x6327('0x34')];_0x26582e[_0x6327('0x39')]=qs[_0x6327('0x3a')](_0x49975c[_0x6327('0x31')][_0x6327('0x3a')]);_0x26582e[_0x6327('0x3f')]=qs[_0x6327('0x3c')](_[_0x6327('0x3b')](_0x49975c[_0x6327('0x31')],_0x4f0579[_0x6327('0x3c')]));if(_0x49975c[_0x6327('0x31')][_0x6327('0x3d')]){_0x26582e[_0x6327('0x3f')]=_[_0x6327('0x3e')](_0x26582e[_0x6327('0x3f')],{'$or':_[_0x6327('0x40')](_0x26582e[_0x6327('0x35')],function(_0x3d7eea){var _0x30f233={};_0x30f233[_0x3d7eea]={'$like':'%'+_0x49975c[_0x6327('0x31')][_0x6327('0x3d')]+'%'};return _0x30f233;})});}_0x26582e=_[_0x6327('0x3e')]({},_0x26582e,_0x49975c[_0x6327('0x42')]);return _0x4ec482[_0x6327('0x8d')](_0x26582e);}})[_0x6327('0x26')](function(_0x21df66){if(_0x21df66){_0xf593bf=_0x21df66[_0x6327('0x37')];if(!_0x49975c[_0x6327('0x31')][_0x6327('0x5b')]('nolimit')){_0x26582e['limit']=qs[_0x6327('0x1d')](_0x49975c[_0x6327('0x31')]['limit']);_0x26582e[_0x6327('0x1b')]=qs['offset'](_0x49975c[_0x6327('0x31')]['offset']);}return _0x4ec482[_0x6327('0x8d')](_0x26582e);}})[_0x6327('0x26')](function(_0x52c67a){if(_0x52c67a){return _0x52c67a?{'count':_0xf593bf,'rows':_0x52c67a}:null;}})['then'](respondWithResult(_0x6546a9,null))[_0x6327('0x46')](handleError(_0x6546a9,null));};exports[_0x6327('0x8e')]=function(_0x4e7082,_0x497d7f,_0x3f5ddc){var _0x40047b,_0xf8d14c;var _0x431412=[];var _0x3f1690=moment()[_0x6327('0x66')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x6327('0x2d')][_0x6327('0x4a')]({'where':{'id':_0x4e7082[_0x6327('0x48')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x497d7f,null))[_0x6327('0x26')](function(_0x4bf469){if(_0x4bf469){_0xf8d14c=_0x4bf469;return _0x4bf469['addBlackLists'](_0x4e7082['body'][_0x6327('0x67')],_['omit'](_0x4e7082[_0x6327('0x4c')],['ids','id'])||{});}return null;})[_0x6327('0x68')](function(_0x2e28c7){var _0x464324;var _0x86039;_0x40047b=_0x2e28c7||[];var _0x2980d1=[];if(_0x2e28c7){for(var _0x589d31=0x0;_0x589d31<_0x2e28c7[_0x6327('0x37')];_0x589d31+=0x1){var _0x2d6ed2=_0x2e28c7[_0x589d31][_0x6327('0x4e')]({'plain':!![]});_0x464324=squel[_0x6327('0x6b')]()['into']('cm_hopper_black')[_0x6327('0x6e')]([_0x6327('0x6f'),_0x6327('0x7f'),_0x6327('0x71'),_0x6327('0x5c'),_0x6327('0x58'),_0x6327('0x57')],squel['select']()[_0x6327('0x72')](_0x6327('0x6f'),_0x6327('0x6f'))['field']('id','ContactId')[_0x6327('0x72')](_0x2d6ed2[_0x6327('0x74')][_0x6327('0x75')](),'ListId')['field'](_0x4e7082[_0x6327('0x48')]['id'][_0x6327('0x75')](),'CampaignId')[_0x6327('0x72')](_0x6327('0x73'),'createdAt')[_0x6327('0x72')](_0x6327('0x73'),_0x6327('0x57'))[_0x6327('0x76')](_0x6327('0x77'))[_0x6327('0x3f')](_0x6327('0x80'))[_0x6327('0x3f')](_0x6327('0x8f'),_0x2d6ed2[_0x6327('0x74')][_0x6327('0x75')]())[_0x6327('0x3f')](_0x6327('0x78')))[_0x6327('0x75')]();_0x2980d1[_0x6327('0x89')](db[_0x6327('0x8a')][_0x6327('0x31')](_0x464324));}return BPromise[_0x6327('0x8b')](_0x2980d1);}})['then'](function(){return _0x40047b;})[_0x6327('0x26')](respondWithResult(_0x497d7f,null))['catch'](handleError(_0x497d7f,null));};exports['removeBlackLists']=function(_0x458d83,_0x440bb7,_0xb44077){return db[_0x6327('0x2d')]['find']({'where':{'id':_0x458d83['params']['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x440bb7,null))[_0x6327('0x26')](function(_0x1dc095){if(_0x1dc095){return _0x1dc095[_0x6327('0x90')](_0x458d83['query'][_0x6327('0x67')]);}})[_0x6327('0x26')](function(_0x593782){if(_0x593782){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x458d83[_0x6327('0x31')][_0x6327('0x67')],'CampaignId':_0x458d83[_0x6327('0x48')]['id']}})[_0x6327('0x26')](function(){return _0x593782;});}})[_0x6327('0x26')](respondWithStatusCode(_0x440bb7,null))[_0x6327('0x46')](handleError(_0x440bb7,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 3995c6d..dd7dfbd 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(_0x4cc79a,_0xf85adc){var _0x176af9=function(_0x44ebcb){while(--_0x44ebcb){_0x4cc79a['push'](_0x4cc79a['shift']());}};_0x176af9(++_0xf85adc);}(_0x7a54,0x106));var _0x47a5=function(_0x3f32f8,_0x55bcb2){_0x3f32f8=_0x3f32f8-0x0;var _0x5cb275=_0x7a54[_0x3f32f8];return _0x5cb275;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 16117d2..b54298e 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 _0xf675=['../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1c77e7,_0x520524){var _0x45b345=function(_0x4e9a95){while(--_0x4e9a95){_0x1c77e7['push'](_0x1c77e7['shift']());}};_0x45b345(++_0x520524);}(_0xf675,0x199));var _0x5f67=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0xf675[_0x297eea];return _0x1c42d2;};'use strict';var _=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var moment=require(_0x5f67('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f67('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f67('0x4'))['db'];var utils=require(_0x5f67('0x5'));var logger=require(_0x5f67('0x6'))('rpc');var config=require(_0x5f67('0x7'));var jayson=require(_0x5f67('0x8'));var client=jayson[_0x5f67('0x9')][_0x5f67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b67eb,_0xc71a7,_0x121d19){return new BPromise(function(_0x55efcd,_0x5749f5){return client[_0x5f67('0xb')](_0x5b67eb,_0x121d19)[_0x5f67('0xc')](function(_0x530ef1){logger['info'](_0x5f67('0xd'),_0xc71a7,_0x5f67('0xe'));logger[_0x5f67('0xf')]('Campaign,\x20%s,\x20%s,\x20%s',_0xc71a7,'request\x20sent',JSON['stringify'](_0x530ef1));if(_0x530ef1[_0x5f67('0x10')]){if(_0x530ef1[_0x5f67('0x10')]['code']===0x1f4){logger[_0x5f67('0x10')]('Campaign,\x20%s,\x20%s',_0xc71a7,_0x530ef1[_0x5f67('0x10')]['message']);return _0x5749f5(_0x530ef1[_0x5f67('0x10')][_0x5f67('0x11')]);}logger[_0x5f67('0x10')]('Campaign,\x20%s,\x20%s',_0xc71a7,_0x530ef1[_0x5f67('0x10')]['message']);return _0x55efcd(_0x530ef1[_0x5f67('0x10')]['message']);}else{logger[_0x5f67('0x12')]('Campaign,\x20%s,\x20%s',_0xc71a7,_0x5f67('0xe'));_0x55efcd(_0x530ef1[_0x5f67('0x13')][_0x5f67('0x11')]);}})[_0x5f67('0x14')](function(_0x444ee5){logger[_0x5f67('0x10')](_0x5f67('0xd'),_0xc71a7,_0x444ee5);_0x5749f5(_0x444ee5);});});}exports[_0x5f67('0x15')]=function(_0xc539c6){var _0x8f3bd6=this;return new Promise(function(_0x5275d6,_0x5bc956){return db[_0x5f67('0x16')][_0x5f67('0x17')]({'raw':_0xc539c6['options']?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x19')]===undefined?!![]:![]:!![],'where':_0xc539c6[_0x5f67('0x18')]?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x1a')]||null:null,'attributes':_0xc539c6[_0x5f67('0x18')]?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x1b')]||null:null,'limit':_0xc539c6[_0x5f67('0x18')]?_0xc539c6[_0x5f67('0x18')][_0x5f67('0x1c')]||null:null,'include':_0xc539c6[_0x5f67('0x18')]?_0xc539c6['options'][_0x5f67('0x1d')]?_[_0x5f67('0x1e')](_0xc539c6[_0x5f67('0x18')]['include'],function(_0x537b39){return{'model':db[_0x537b39[_0x5f67('0x1f')]],'as':_0x537b39['as'],'attributes':_0x537b39[_0x5f67('0x1b')],'include':_0x537b39['include']?_[_0x5f67('0x1e')](_0x537b39[_0x5f67('0x1d')],function(_0x241d17){return{'model':db[_0x241d17[_0x5f67('0x1f')]],'as':_0x241d17['as'],'attributes':_0x241d17['attributes'],'include':_0x241d17[_0x5f67('0x1d')]?_['map'](_0x241d17[_0x5f67('0x1d')],function(_0x167601){return{'model':db[_0x167601['model']],'as':_0x167601['as'],'attributes':_0x167601[_0x5f67('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5f67('0xc')](function(_0x57f373){logger['info'](_0x5f67('0x15'),_0xc539c6);logger[_0x5f67('0xf')](_0x5f67('0x15'),_0xc539c6,JSON['stringify'](_0x57f373));_0x5275d6(_0x57f373);})[_0x5f67('0x14')](function(_0xd36b79){logger['error'](_0x5f67('0x15'),_0xd36b79[_0x5f67('0x11')],_0xc539c6);_0x5bc956(_0x8f3bd6['error'](0x1f4,_0xd36b79[_0x5f67('0x11')]));});});}; \ No newline at end of file +var _0xbbb8=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','attributes','limit','include','model','map','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2c5bc7,_0x4975a6){var _0x4273b1=function(_0x4d82a0){while(--_0x4d82a0){_0x2c5bc7['push'](_0x2c5bc7['shift']());}};_0x4273b1(++_0x4975a6);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x3a268d,_0xef058a){_0x3a268d=_0x3a268d-0x0;var _0x224362=_0xbbb8[_0x3a268d];return _0x224362;};'use strict';var _=require(_0x8bbb('0x0'));var util=require(_0x8bbb('0x1'));var moment=require('moment');var BPromise=require(_0x8bbb('0x2'));var rs=require(_0x8bbb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bbb('0x4'))['db'];var utils=require(_0x8bbb('0x5'));var logger=require(_0x8bbb('0x6'))(_0x8bbb('0x7'));var config=require(_0x8bbb('0x8'));var jayson=require(_0x8bbb('0x9'));var client=jayson[_0x8bbb('0xa')][_0x8bbb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d7098,_0x4bbc55,_0x5c744c){return new BPromise(function(_0x4da98e,_0x2d69aa){return client[_0x8bbb('0xc')](_0x2d7098,_0x5c744c)[_0x8bbb('0xd')](function(_0x3a6ced){logger[_0x8bbb('0xe')](_0x8bbb('0xf'),_0x4bbc55,_0x8bbb('0x10'));logger[_0x8bbb('0x11')]('Campaign,\x20%s,\x20%s,\x20%s',_0x4bbc55,_0x8bbb('0x10'),JSON[_0x8bbb('0x12')](_0x3a6ced));if(_0x3a6ced[_0x8bbb('0x13')]){if(_0x3a6ced['error'][_0x8bbb('0x14')]===0x1f4){logger[_0x8bbb('0x13')](_0x8bbb('0xf'),_0x4bbc55,_0x3a6ced['error'][_0x8bbb('0x15')]);return _0x2d69aa(_0x3a6ced[_0x8bbb('0x13')][_0x8bbb('0x15')]);}logger[_0x8bbb('0x13')]('Campaign,\x20%s,\x20%s',_0x4bbc55,_0x3a6ced[_0x8bbb('0x13')][_0x8bbb('0x15')]);return _0x4da98e(_0x3a6ced['error'][_0x8bbb('0x15')]);}else{logger[_0x8bbb('0xe')](_0x8bbb('0xf'),_0x4bbc55,_0x8bbb('0x10'));_0x4da98e(_0x3a6ced[_0x8bbb('0x16')][_0x8bbb('0x15')]);}})[_0x8bbb('0x17')](function(_0x15643c){logger[_0x8bbb('0x13')](_0x8bbb('0xf'),_0x4bbc55,_0x15643c);_0x2d69aa(_0x15643c);});});}exports[_0x8bbb('0x18')]=function(_0x2c2cd4){var _0x12486b=this;return new Promise(function(_0x4abd04,_0x2a6e0){return db[_0x8bbb('0x19')][_0x8bbb('0x1a')]({'raw':_0x2c2cd4[_0x8bbb('0x1b')]?_0x2c2cd4[_0x8bbb('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2c2cd4[_0x8bbb('0x1b')]?_0x2c2cd4['options']['where']||null:null,'attributes':_0x2c2cd4[_0x8bbb('0x1b')]?_0x2c2cd4['options'][_0x8bbb('0x1c')]||null:null,'limit':_0x2c2cd4['options']?_0x2c2cd4[_0x8bbb('0x1b')][_0x8bbb('0x1d')]||null:null,'include':_0x2c2cd4['options']?_0x2c2cd4[_0x8bbb('0x1b')][_0x8bbb('0x1e')]?_['map'](_0x2c2cd4[_0x8bbb('0x1b')][_0x8bbb('0x1e')],function(_0x4b2ba6){return{'model':db[_0x4b2ba6[_0x8bbb('0x1f')]],'as':_0x4b2ba6['as'],'attributes':_0x4b2ba6['attributes'],'include':_0x4b2ba6[_0x8bbb('0x1e')]?_[_0x8bbb('0x20')](_0x4b2ba6[_0x8bbb('0x1e')],function(_0x2fff2e){return{'model':db[_0x2fff2e['model']],'as':_0x2fff2e['as'],'attributes':_0x2fff2e[_0x8bbb('0x1c')],'include':_0x2fff2e['include']?_[_0x8bbb('0x20')](_0x2fff2e['include'],function(_0x22a074){return{'model':db[_0x22a074[_0x8bbb('0x1f')]],'as':_0x22a074['as'],'attributes':_0x22a074[_0x8bbb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1375a9){logger['info'](_0x8bbb('0x18'),_0x2c2cd4);logger[_0x8bbb('0x11')](_0x8bbb('0x18'),_0x2c2cd4,JSON[_0x8bbb('0x12')](_0x1375a9));_0x4abd04(_0x1375a9);})['catch'](function(_0x51c251){logger[_0x8bbb('0x13')]('GetCampaign',_0x51c251[_0x8bbb('0x15')],_0x2c2cd4);_0x2a6e0(_0x12486b[_0x8bbb('0x13')](0x1f4,_0x51c251['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 480a36a..79ffbda 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 _0xca04=['path','Router','fs-extra','../../config/environment','./campaign.controller','index','/:id','show','get','/:id/hoppers','isAuthenticated','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','create','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer'];(function(_0x12c4fe,_0x3f2d61){var _0x56b681=function(_0x3f3605){while(--_0x3f3605){_0x12c4fe['push'](_0x12c4fe['shift']());}};_0x56b681(++_0x3f2d61);}(_0xca04,0xa4));var _0x4ca0=function(_0x109e60,_0x1634ac){_0x109e60=_0x109e60-0x0;var _0x4b239d=_0xca04[_0x109e60];return _0x4b239d;};'use strict';var multer=require(_0x4ca0('0x0'));var util=require('util');var path=require(_0x4ca0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4ca0('0x2')]();var fs_extra=require(_0x4ca0('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ca0('0x4'));var controller=require(_0x4ca0('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x4ca0('0x6')]);router['get'](_0x4ca0('0x7'),auth['isAuthenticated'](),controller[_0x4ca0('0x8')]);router[_0x4ca0('0x9')](_0x4ca0('0xa'),auth[_0x4ca0('0xb')](),controller[_0x4ca0('0xc')]);router[_0x4ca0('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x4ca0('0xd')]);router[_0x4ca0('0x9')](_0x4ca0('0xe'),auth[_0x4ca0('0xb')](),controller['getHopperFinals']);router[_0x4ca0('0x9')](_0x4ca0('0xf'),auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x10')]);router[_0x4ca0('0x9')](_0x4ca0('0x11'),auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x12')]);router[_0x4ca0('0x9')](_0x4ca0('0x13'),auth[_0x4ca0('0xb')](),controller['getBlackLists']);router['post']('/',auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x14')]);router[_0x4ca0('0x15')](_0x4ca0('0x16'),auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x17')]);router[_0x4ca0('0x15')]('/:id/lists',auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x18')]);router['post'](_0x4ca0('0x13'),auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x19')]);router[_0x4ca0('0x1a')](_0x4ca0('0x7'),auth['isAuthenticated'](),controller[_0x4ca0('0x1b')]);router[_0x4ca0('0x1c')]('/:id',auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x1d')]);router[_0x4ca0('0x1c')](_0x4ca0('0x11'),auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x1e')]);router[_0x4ca0('0x1c')](_0x4ca0('0x13'),auth[_0x4ca0('0xb')](),controller[_0x4ca0('0x1f')]);module[_0x4ca0('0x20')]=router; \ No newline at end of file +var _0x6cf2=['/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','delete','removeLists','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0x4c42da,_0x2b1f58){var _0x11c56a=function(_0x3a297d){while(--_0x3a297d){_0x4c42da['push'](_0x4c42da['shift']());}};_0x11c56a(++_0x2b1f58);}(_0x6cf2,0x7c));var _0x26cf=function(_0x39197d,_0x785a79){_0x39197d=_0x39197d-0x0;var _0x48cfab=_0x6cf2[_0x39197d];return _0x48cfab;};'use strict';var multer=require('multer');var util=require(_0x26cf('0x0'));var path=require(_0x26cf('0x1'));var timeout=require(_0x26cf('0x2'));var express=require(_0x26cf('0x3'));var router=express[_0x26cf('0x4')]();var fs_extra=require(_0x26cf('0x5'));var auth=require(_0x26cf('0x6'));var interaction=require(_0x26cf('0x7'));var config=require(_0x26cf('0x8'));var controller=require(_0x26cf('0x9'));router[_0x26cf('0xa')]('/',auth[_0x26cf('0xb')](),controller[_0x26cf('0xc')]);router[_0x26cf('0xa')](_0x26cf('0xd'),auth['isAuthenticated'](),controller[_0x26cf('0xe')]);router['get'](_0x26cf('0xf'),auth[_0x26cf('0xb')](),controller['getHoppers']);router[_0x26cf('0xa')](_0x26cf('0x10'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x11')]);router[_0x26cf('0xa')](_0x26cf('0x12'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x13')]);router['get'](_0x26cf('0x14'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x15')]);router[_0x26cf('0xa')](_0x26cf('0x16'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x17')]);router['get'](_0x26cf('0x18'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x19')]);router[_0x26cf('0x1a')]('/',auth[_0x26cf('0xb')](),controller[_0x26cf('0x1b')]);router[_0x26cf('0x1a')](_0x26cf('0x1c'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x1d')]);router[_0x26cf('0x1a')](_0x26cf('0x16'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x1e')]);router[_0x26cf('0x1a')]('/:id/blacklists',auth[_0x26cf('0xb')](),controller[_0x26cf('0x1f')]);router[_0x26cf('0x20')](_0x26cf('0xd'),auth[_0x26cf('0xb')](),controller['update']);router['delete']('/:id',auth[_0x26cf('0xb')](),controller['destroy']);router[_0x26cf('0x21')](_0x26cf('0x16'),auth[_0x26cf('0xb')](),controller[_0x26cf('0x22')]);router[_0x26cf('0x21')](_0x26cf('0x18'),auth[_0x26cf('0xb')](),controller['removeBlackLists']);module[_0x26cf('0x23')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 056eac9..4a3182a 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 _0xafa9=['medium','VIRTUAL','sequelize','exports','TEXT'];(function(_0x4c5fff,_0x50d286){var _0x2bd2da=function(_0x57f1ba){while(--_0x57f1ba){_0x4c5fff['push'](_0x4c5fff['shift']());}};_0x2bd2da(++_0x50d286);}(_0xafa9,0x15b));var _0x9afa=function(_0x5bb1e9,_0x15f025){_0x5bb1e9=_0x5bb1e9-0x0;var _0x262c24=_0xafa9[_0x5bb1e9];return _0x262c24;};'use strict';var Sequelize=require(_0x9afa('0x0'));module[_0x9afa('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x9afa('0x2')],'length':_0x9afa('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x9afa('0x4')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0x8cd3=['exports','TEXT','medium','VIRTUAL','getDataValue','key','sequelize'];(function(_0x255a0a,_0x4d809f){var _0xcb9924=function(_0x52d945){while(--_0x52d945){_0x255a0a['push'](_0x255a0a['shift']());}};_0xcb9924(++_0x4d809f);}(_0x8cd3,0xe6));var _0x38cd=function(_0x1987c2,_0x25e5ea){_0x1987c2=_0x1987c2-0x0;var _0x3fbcf3=_0x8cd3[_0x1987c2];return _0x3fbcf3;};'use strict';var Sequelize=require(_0x38cd('0x0'));module[_0x38cd('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x38cd('0x2')],'length':_0x38cd('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x38cd('0x4')],'get':function(){return this[_0x38cd('0x5')](_0x38cd('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index a5013d8..a637e01 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 _0x8de5=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','sort','where','filter','merge','options','findAll','catch','show','params','length','includeAll','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','find','Sequelize','ValidationError','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x8de5,0x1e1));var _0x58de=function(_0x31c115,_0x571962){_0x31c115=_0x31c115-0x0;var _0x3b7834=_0x8de5[_0x31c115];return _0x3b7834;};'use strict';var emlformat=require(_0x58de('0x0'));var rimraf=require(_0x58de('0x1'));var zipdir=require(_0x58de('0x2'));var jsonpatch=require(_0x58de('0x3'));var rp=require(_0x58de('0x4'));var moment=require(_0x58de('0x5'));var BPromise=require(_0x58de('0x6'));var Mustache=require(_0x58de('0x7'));var util=require(_0x58de('0x8'));var path=require(_0x58de('0x9'));var sox=require(_0x58de('0xa'));var csv=require('to-csv');var ejs=require(_0x58de('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x58de('0xc'));var squel=require(_0x58de('0xd'));var crypto=require(_0x58de('0xe'));var jsforce=require(_0x58de('0xf'));var deskjs=require(_0x58de('0x10'));var toCsv=require(_0x58de('0x11'));var querystring=require(_0x58de('0x12'));var Papa=require('papaparse');var Redis=require(_0x58de('0x13'));var authService=require(_0x58de('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x58de('0x15'));var hardwareService=require(_0x58de('0x16'));var logger=require(_0x58de('0x17'))(_0x58de('0x18'));var utils=require('../../config/utils');var config=require(_0x58de('0x19'));var licenseUtil=require(_0x58de('0x1a'));var db=require(_0x58de('0x1b'))['db'];function respondWithStatusCode(_0x31804c,_0x3b4b86){_0x3b4b86=_0x3b4b86||0xcc;return function(_0x92b35){if(_0x92b35){return _0x31804c[_0x58de('0x1c')](_0x3b4b86);}return _0x31804c[_0x58de('0x1d')](_0x3b4b86)[_0x58de('0x1e')]();};}function respondWithResult(_0x3b5ace,_0x567a80){_0x567a80=_0x567a80||0xc8;return function(_0x41f465){if(_0x41f465){return _0x3b5ace['status'](_0x567a80)[_0x58de('0x1f')](_0x41f465);}};}function respondWithFilteredResult(_0x22d1c3,_0x6f72a3){return function(_0x13cdb9){if(_0x13cdb9){var _0x720a38=typeof _0x6f72a3[_0x58de('0x20')]===_0x58de('0x21')&&typeof _0x6f72a3[_0x58de('0x22')]===_0x58de('0x21');var _0x55364e=_0x13cdb9[_0x58de('0x23')];var _0x53eb78=_0x720a38?0x0:_0x6f72a3[_0x58de('0x20')];var _0x819ad=_0x720a38?_0x13cdb9[_0x58de('0x23')]:_0x6f72a3[_0x58de('0x20')]+_0x6f72a3[_0x58de('0x22')];var _0x41ce69;if(_0x819ad>=_0x55364e){_0x819ad=_0x55364e;_0x41ce69=0xc8;}else{_0x41ce69=0xce;}_0x22d1c3['status'](_0x41ce69);return _0x22d1c3[_0x58de('0x24')](_0x58de('0x25'),_0x53eb78+'-'+_0x819ad+'/'+_0x55364e)['json'](_0x13cdb9);}return null;};}function patchUpdates(_0x48b823){return function(_0x3046f1){try{jsonpatch[_0x58de('0x26')](_0x3046f1,_0x48b823,!![]);}catch(_0x15c64c){return BPromise[_0x58de('0x27')](_0x15c64c);}return _0x3046f1[_0x58de('0x28')]();};}function saveUpdates(_0x286a76,_0x4e71be){return function(_0x5097c4){if(_0x5097c4){return _0x5097c4[_0x58de('0x29')](_0x286a76)[_0x58de('0x2a')](function(_0x4ca3a7){return _0x4ca3a7;});}return null;};}function removeEntity(_0x3ef53f,_0x5d3b44){return function(_0x3b8068){if(_0x3b8068){return _0x3b8068[_0x58de('0x2b')]()['then'](function(){var _0x61b6a7=_0x3b8068['get']({'plain':!![]});var _0x2b7c00=_0x58de('0x2c');return db[_0x58de('0x2d')][_0x58de('0x2b')]({'where':{'type':_0x2b7c00,'resourceId':_0x61b6a7['id']}})[_0x58de('0x2a')](function(){return _0x3b8068;});})[_0x58de('0x2a')](function(){_0x3ef53f[_0x58de('0x1d')](0xcc)[_0x58de('0x1e')]();});}};}function handleEntityNotFound(_0x314416,_0x3dadfc){return function(_0x117969){if(!_0x117969){_0x314416[_0x58de('0x1c')](0x194);}return _0x117969;};}function handleError(_0x2aa607,_0x2e79e0){_0x2e79e0=_0x2e79e0||0x1f4;return function(_0x1ad98a){logger['error'](_0x1ad98a[_0x58de('0x2e')]);if(_0x1ad98a[_0x58de('0x2f')]){delete _0x1ad98a[_0x58de('0x2f')];}_0x2aa607[_0x58de('0x1d')](_0x2e79e0)[_0x58de('0x30')](_0x1ad98a);};}exports[_0x58de('0x31')]=function(_0x534b9c,_0x2a7baa){var _0x2933fb={},_0x5774dd={},_0x14e7c3={'count':0x0,'rows':[]};var _0x4ca5a2=_[_0x58de('0x32')](db[_0x58de('0x33')][_0x58de('0x34')],function(_0x295081){return{'name':_0x295081[_0x58de('0x35')],'type':_0x295081[_0x58de('0x36')][_0x58de('0x37')]};});_0x5774dd[_0x58de('0x38')]=_[_0x58de('0x32')](_0x4ca5a2,_0x58de('0x2f'));_0x5774dd[_0x58de('0x39')]=_[_0x58de('0x3a')](_0x534b9c[_0x58de('0x39')]);_0x5774dd[_0x58de('0x3b')]=_[_0x58de('0x3c')](_0x5774dd[_0x58de('0x38')],_0x5774dd[_0x58de('0x39')]);_0x2933fb['attributes']=_['intersection'](_0x5774dd[_0x58de('0x38')],qs[_0x58de('0x3d')](_0x534b9c[_0x58de('0x39')][_0x58de('0x3d')]));_0x2933fb[_0x58de('0x3e')]=_0x2933fb['attributes']['length']?_0x2933fb[_0x58de('0x3e')]:_0x5774dd[_0x58de('0x38')];if(!_0x534b9c['query']['hasOwnProperty']('nolimit')){_0x2933fb[_0x58de('0x22')]=qs[_0x58de('0x22')](_0x534b9c[_0x58de('0x39')][_0x58de('0x22')]);_0x2933fb[_0x58de('0x20')]=qs[_0x58de('0x20')](_0x534b9c[_0x58de('0x39')][_0x58de('0x20')]);}_0x2933fb['order']=qs['sort'](_0x534b9c[_0x58de('0x39')][_0x58de('0x3f')]);_0x2933fb[_0x58de('0x40')]=qs['filters'](_['pick'](_0x534b9c['query'],_0x5774dd[_0x58de('0x3b')]),_0x4ca5a2);if(_0x534b9c['query'][_0x58de('0x41')]){_0x2933fb[_0x58de('0x40')]=_[_0x58de('0x42')](_0x2933fb[_0x58de('0x40')],{'$or':[{'key':{'$like':'%'+_0x534b9c[_0x58de('0x39')][_0x58de('0x41')]+'%'}},{'value':{'$like':'%'+_0x534b9c[_0x58de('0x39')]['filter']+'%'}}]});}_0x2933fb=_['merge']({},_0x2933fb,_0x534b9c[_0x58de('0x43')]);var _0x5814bd={'where':_0x2933fb[_0x58de('0x40')]};return db['CannedAnswer']['count'](_0x5814bd)['then'](function(_0x51fce6){_0x14e7c3[_0x58de('0x23')]=_0x51fce6;if(_0x534b9c['query']['includeAll']){_0x2933fb['include']=[{'all':!![]}];}return db[_0x58de('0x33')][_0x58de('0x44')](_0x2933fb);})[_0x58de('0x2a')](function(_0x30eb4b){_0x14e7c3['rows']=_0x30eb4b;return _0x14e7c3;})[_0x58de('0x2a')](respondWithFilteredResult(_0x2a7baa,_0x2933fb))[_0x58de('0x45')](handleError(_0x2a7baa,null));};exports[_0x58de('0x46')]=function(_0x3a6726,_0x3db979){var _0x2e842b={'raw':!![],'where':{'id':_0x3a6726[_0x58de('0x47')]['id']}},_0x51dad2={};_0x51dad2['model']=_[_0x58de('0x3a')](db['CannedAnswer'][_0x58de('0x34')]);_0x51dad2['query']=_[_0x58de('0x3a')](_0x3a6726['query']);_0x51dad2['filters']=_[_0x58de('0x3c')](_0x51dad2['model'],_0x51dad2[_0x58de('0x39')]);_0x2e842b['attributes']=_[_0x58de('0x3c')](_0x51dad2[_0x58de('0x38')],qs[_0x58de('0x3d')](_0x3a6726[_0x58de('0x39')][_0x58de('0x3d')]));_0x2e842b['attributes']=_0x2e842b[_0x58de('0x3e')][_0x58de('0x48')]?_0x2e842b[_0x58de('0x3e')]:_0x51dad2[_0x58de('0x38')];if(_0x3a6726['query'][_0x58de('0x49')]){_0x2e842b['include']=[{'all':!![]}];}_0x2e842b=_['merge']({},_0x2e842b,_0x3a6726[_0x58de('0x43')]);return db[_0x58de('0x33')]['find'](_0x2e842b)['then'](handleEntityNotFound(_0x3db979,null))[_0x58de('0x2a')](respondWithResult(_0x3db979,null))[_0x58de('0x45')](handleError(_0x3db979,null));};exports[_0x58de('0x29')]=function(_0x4806dc,_0x265248){if(_0x4806dc[_0x58de('0x4a')]['id']){delete _0x4806dc[_0x58de('0x4a')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x4806dc[_0x58de('0x47')]['id']}})[_0x58de('0x2a')](handleEntityNotFound(_0x265248,null))[_0x58de('0x2a')](saveUpdates(_0x4806dc[_0x58de('0x4a')],null))[_0x58de('0x2a')](respondWithResult(_0x265248,null))['catch'](handleError(_0x265248,null));};exports[_0x58de('0x2b')]=function(_0x254323,_0x4eed10){return db[_0x58de('0x33')]['find']({'where':{'id':_0x254323[_0x58de('0x47')]['id']}})[_0x58de('0x2a')](handleEntityNotFound(_0x4eed10,null))[_0x58de('0x2a')](removeEntity(_0x4eed10,null))[_0x58de('0x45')](handleError(_0x4eed10,null));};exports[_0x58de('0x4b')]=function(_0x244611,_0x5a6b62){var _0xf7b558={'key':_0x244611[_0x58de('0x4a')][_0x58de('0x37')]};if(_0x244611[_0x58de('0x4a')][_0x58de('0x4c')]){_0xf7b558[_0x58de('0x4c')]=_0x244611[_0x58de('0x4a')]['MailAccountId'];}else if(_0x244611[_0x58de('0x4a')]['SmsAccountId']){_0xf7b558[_0x58de('0x4d')]=_0x244611[_0x58de('0x4a')][_0x58de('0x4d')];}else if(_0x244611[_0x58de('0x4a')][_0x58de('0x4e')]){_0xf7b558['OpenchannelAccountId']=_0x244611[_0x58de('0x4a')]['OpenchannelAccountId'];}else if(_0x244611['body'][_0x58de('0x4f')]){_0xf7b558['ChatWebsiteId']=_0x244611[_0x58de('0x4a')][_0x58de('0x4f')];}return db[_0x58de('0x33')][_0x58de('0x50')]({'where':_0xf7b558})[_0x58de('0x2a')](function(_0x1f1c0e){if(_0x1f1c0e){throw new db[(_0x58de('0x51'))][(_0x58de('0x52'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x58de('0x33')][_0x58de('0x4b')](_0x244611[_0x58de('0x4a')]);})[_0x58de('0x2a')](function(_0x305f38){var _0x15f28a=_0x244611[_0x58de('0x53')][_0x58de('0x54')]({'plain':!![]});if(!_0x15f28a)throw new Error(_0x58de('0x55'));if(_0x15f28a[_0x58de('0x56')]===_0x58de('0x53')){var _0x309551=_0x305f38[_0x58de('0x54')]({'plain':!![]});return db[_0x58de('0x57')][_0x58de('0x50')]({'where':{'name':_0x58de('0x2c'),'userProfileId':_0x15f28a[_0x58de('0x58')]},'raw':!![]})['then'](function(_0x5eab15){if(_0x5eab15&&_0x5eab15['autoAssociation']===0x0){return db[_0x58de('0x2d')]['create']({'name':_0x309551[_0x58de('0x2f')],'resourceId':_0x309551['id'],'type':_0x5eab15['name'],'sectionId':_0x5eab15['id']},{})[_0x58de('0x2a')](function(){return _0x305f38;});}else{return _0x305f38;}})[_0x58de('0x45')](function(_0xf2f903){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf2f903);throw _0xf2f903;});}return _0x305f38;})[_0x58de('0x2a')](respondWithResult(_0x5a6b62,0xc9))[_0x58de('0x45')](handleError(_0x5a6b62,null));}; \ No newline at end of file +var _0x6107=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','rawAttributes','fields','includeAll','find','body','params','destroy','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x2a5b1f,_0x14f7a8){var _0x374b10=function(_0x5f039e){while(--_0x5f039e){_0x2a5b1f['push'](_0x2a5b1f['shift']());}};_0x374b10(++_0x14f7a8);}(_0x6107,0x9e));var _0x7610=function(_0x3ef412,_0x28691b){_0x3ef412=_0x3ef412-0x0;var _0x2cbaeb=_0x6107[_0x3ef412];return _0x2cbaeb;};'use strict';var emlformat=require(_0x7610('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7610('0x1'));var jsonpatch=require(_0x7610('0x2'));var rp=require(_0x7610('0x3'));var moment=require(_0x7610('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7610('0x5'));var util=require('util');var path=require(_0x7610('0x6'));var sox=require(_0x7610('0x7'));var csv=require(_0x7610('0x8'));var ejs=require(_0x7610('0x9'));var fs=require('fs');var fs_extra=require(_0x7610('0xa'));var _=require(_0x7610('0xb'));var squel=require(_0x7610('0xc'));var crypto=require(_0x7610('0xd'));var jsforce=require(_0x7610('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7610('0x8'));var querystring=require(_0x7610('0xf'));var Papa=require(_0x7610('0x10'));var Redis=require(_0x7610('0x11'));var authService=require(_0x7610('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7610('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7610('0x14'))(_0x7610('0x15'));var utils=require(_0x7610('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7610('0x17'));var db=require(_0x7610('0x18'))['db'];function respondWithStatusCode(_0x22fd75,_0x36e45c){_0x36e45c=_0x36e45c||0xcc;return function(_0x11fc2c){if(_0x11fc2c){return _0x22fd75[_0x7610('0x19')](_0x36e45c);}return _0x22fd75[_0x7610('0x1a')](_0x36e45c)[_0x7610('0x1b')]();};}function respondWithResult(_0x11c178,_0x35a6fb){_0x35a6fb=_0x35a6fb||0xc8;return function(_0x52884e){if(_0x52884e){return _0x11c178[_0x7610('0x1a')](_0x35a6fb)[_0x7610('0x1c')](_0x52884e);}};}function respondWithFilteredResult(_0x39a851,_0x20e869){return function(_0x5e6a39){if(_0x5e6a39){var _0x5e3bb3=typeof _0x20e869[_0x7610('0x1d')]===_0x7610('0x1e')&&typeof _0x20e869[_0x7610('0x1f')]==='undefined';var _0x112218=_0x5e6a39[_0x7610('0x20')];var _0x41f5b6=_0x5e3bb3?0x0:_0x20e869[_0x7610('0x1d')];var _0x4f30b3=_0x5e3bb3?_0x5e6a39[_0x7610('0x20')]:_0x20e869[_0x7610('0x1d')]+_0x20e869[_0x7610('0x1f')];var _0x3b2e2d;if(_0x4f30b3>=_0x112218){_0x4f30b3=_0x112218;_0x3b2e2d=0xc8;}else{_0x3b2e2d=0xce;}_0x39a851[_0x7610('0x1a')](_0x3b2e2d);return _0x39a851[_0x7610('0x21')](_0x7610('0x22'),_0x41f5b6+'-'+_0x4f30b3+'/'+_0x112218)[_0x7610('0x1c')](_0x5e6a39);}return null;};}function patchUpdates(_0x443d4e){return function(_0x41ee76){try{jsonpatch[_0x7610('0x23')](_0x41ee76,_0x443d4e,!![]);}catch(_0x12c64d){return BPromise[_0x7610('0x24')](_0x12c64d);}return _0x41ee76['save']();};}function saveUpdates(_0x4144f7,_0x501f8a){return function(_0x35dd30){if(_0x35dd30){return _0x35dd30[_0x7610('0x25')](_0x4144f7)[_0x7610('0x26')](function(_0x44af3d){return _0x44af3d;});}return null;};}function removeEntity(_0x4aa706,_0x4d7eaa){return function(_0x30fdca){if(_0x30fdca){return _0x30fdca['destroy']()[_0x7610('0x26')](function(){var _0x339d3f=_0x30fdca[_0x7610('0x27')]({'plain':!![]});var _0x22b929=_0x7610('0x28');return db[_0x7610('0x29')]['destroy']({'where':{'type':_0x22b929,'resourceId':_0x339d3f['id']}})[_0x7610('0x26')](function(){return _0x30fdca;});})[_0x7610('0x26')](function(){_0x4aa706[_0x7610('0x1a')](0xcc)[_0x7610('0x1b')]();});}};}function handleEntityNotFound(_0xcccc58,_0x1ed072){return function(_0x458200){if(!_0x458200){_0xcccc58[_0x7610('0x19')](0x194);}return _0x458200;};}function handleError(_0x13e771,_0x30ae04){_0x30ae04=_0x30ae04||0x1f4;return function(_0x3c494f){logger[_0x7610('0x2a')](_0x3c494f[_0x7610('0x2b')]);if(_0x3c494f[_0x7610('0x2c')]){delete _0x3c494f[_0x7610('0x2c')];}_0x13e771[_0x7610('0x1a')](_0x30ae04)[_0x7610('0x2d')](_0x3c494f);};}exports[_0x7610('0x2e')]=function(_0x530025,_0x1508a5){var _0x49d692={},_0x24d5ed={},_0x4c9564={'count':0x0,'rows':[]};var _0x57ef2d=_[_0x7610('0x2f')](db[_0x7610('0x30')]['rawAttributes'],function(_0x3375e2){return{'name':_0x3375e2[_0x7610('0x31')],'type':_0x3375e2[_0x7610('0x32')][_0x7610('0x33')]};});_0x24d5ed[_0x7610('0x34')]=_[_0x7610('0x2f')](_0x57ef2d,_0x7610('0x2c'));_0x24d5ed[_0x7610('0x35')]=_[_0x7610('0x36')](_0x530025[_0x7610('0x35')]);_0x24d5ed[_0x7610('0x37')]=_['intersection'](_0x24d5ed['model'],_0x24d5ed[_0x7610('0x35')]);_0x49d692[_0x7610('0x38')]=_[_0x7610('0x39')](_0x24d5ed['model'],qs['fields'](_0x530025[_0x7610('0x35')]['fields']));_0x49d692['attributes']=_0x49d692['attributes'][_0x7610('0x3a')]?_0x49d692[_0x7610('0x38')]:_0x24d5ed[_0x7610('0x34')];if(!_0x530025['query'][_0x7610('0x3b')](_0x7610('0x3c'))){_0x49d692[_0x7610('0x1f')]=qs[_0x7610('0x1f')](_0x530025[_0x7610('0x35')][_0x7610('0x1f')]);_0x49d692[_0x7610('0x1d')]=qs[_0x7610('0x1d')](_0x530025['query'][_0x7610('0x1d')]);}_0x49d692['order']=qs[_0x7610('0x3d')](_0x530025[_0x7610('0x35')][_0x7610('0x3d')]);_0x49d692['where']=qs[_0x7610('0x37')](_[_0x7610('0x3e')](_0x530025[_0x7610('0x35')],_0x24d5ed[_0x7610('0x37')]),_0x57ef2d);if(_0x530025[_0x7610('0x35')][_0x7610('0x3f')]){_0x49d692[_0x7610('0x40')]=_[_0x7610('0x41')](_0x49d692[_0x7610('0x40')],{'$or':[{'key':{'$like':'%'+_0x530025['query'][_0x7610('0x3f')]+'%'}},{'value':{'$like':'%'+_0x530025[_0x7610('0x35')][_0x7610('0x3f')]+'%'}}]});}_0x49d692=_[_0x7610('0x41')]({},_0x49d692,_0x530025[_0x7610('0x42')]);var _0x103103={'where':_0x49d692[_0x7610('0x40')]};return db[_0x7610('0x30')][_0x7610('0x20')](_0x103103)[_0x7610('0x26')](function(_0xc64d8f){_0x4c9564[_0x7610('0x20')]=_0xc64d8f;if(_0x530025[_0x7610('0x35')]['includeAll']){_0x49d692[_0x7610('0x43')]=[{'all':!![]}];}return db[_0x7610('0x30')][_0x7610('0x44')](_0x49d692);})['then'](function(_0x5c983d){_0x4c9564[_0x7610('0x45')]=_0x5c983d;return _0x4c9564;})[_0x7610('0x26')](respondWithFilteredResult(_0x1508a5,_0x49d692))[_0x7610('0x46')](handleError(_0x1508a5,null));};exports[_0x7610('0x47')]=function(_0x280d48,_0x96dfb3){var _0x331cff={'raw':!![],'where':{'id':_0x280d48['params']['id']}},_0x579949={};_0x579949['model']=_['keys'](db[_0x7610('0x30')][_0x7610('0x48')]);_0x579949[_0x7610('0x35')]=_['keys'](_0x280d48[_0x7610('0x35')]);_0x579949['filters']=_[_0x7610('0x39')](_0x579949[_0x7610('0x34')],_0x579949[_0x7610('0x35')]);_0x331cff[_0x7610('0x38')]=_['intersection'](_0x579949['model'],qs[_0x7610('0x49')](_0x280d48[_0x7610('0x35')][_0x7610('0x49')]));_0x331cff['attributes']=_0x331cff[_0x7610('0x38')][_0x7610('0x3a')]?_0x331cff[_0x7610('0x38')]:_0x579949['model'];if(_0x280d48['query'][_0x7610('0x4a')]){_0x331cff[_0x7610('0x43')]=[{'all':!![]}];}_0x331cff=_[_0x7610('0x41')]({},_0x331cff,_0x280d48[_0x7610('0x42')]);return db['CannedAnswer'][_0x7610('0x4b')](_0x331cff)[_0x7610('0x26')](handleEntityNotFound(_0x96dfb3,null))[_0x7610('0x26')](respondWithResult(_0x96dfb3,null))[_0x7610('0x46')](handleError(_0x96dfb3,null));};exports[_0x7610('0x25')]=function(_0x11ff14,_0x4f7adf){if(_0x11ff14[_0x7610('0x4c')]['id']){delete _0x11ff14[_0x7610('0x4c')]['id'];}return db[_0x7610('0x30')]['find']({'where':{'id':_0x11ff14[_0x7610('0x4d')]['id']}})[_0x7610('0x26')](handleEntityNotFound(_0x4f7adf,null))['then'](saveUpdates(_0x11ff14[_0x7610('0x4c')],null))[_0x7610('0x26')](respondWithResult(_0x4f7adf,null))[_0x7610('0x46')](handleError(_0x4f7adf,null));};exports[_0x7610('0x4e')]=function(_0x1c8032,_0x4d8115){return db[_0x7610('0x30')][_0x7610('0x4b')]({'where':{'id':_0x1c8032['params']['id']}})[_0x7610('0x26')](handleEntityNotFound(_0x4d8115,null))[_0x7610('0x26')](removeEntity(_0x4d8115,null))[_0x7610('0x46')](handleError(_0x4d8115,null));};exports[_0x7610('0x4f')]=function(_0x3530f9,_0x2a51a3){var _0x1b9116={'key':_0x3530f9[_0x7610('0x4c')][_0x7610('0x33')]};if(_0x3530f9[_0x7610('0x4c')][_0x7610('0x50')]){_0x1b9116[_0x7610('0x50')]=_0x3530f9['body'][_0x7610('0x50')];}else if(_0x3530f9[_0x7610('0x4c')][_0x7610('0x51')]){_0x1b9116[_0x7610('0x51')]=_0x3530f9['body'][_0x7610('0x51')];}else if(_0x3530f9['body'][_0x7610('0x52')]){_0x1b9116[_0x7610('0x52')]=_0x3530f9[_0x7610('0x4c')][_0x7610('0x52')];}else if(_0x3530f9[_0x7610('0x4c')][_0x7610('0x53')]){_0x1b9116[_0x7610('0x53')]=_0x3530f9[_0x7610('0x4c')][_0x7610('0x53')];}return db['CannedAnswer']['find']({'where':_0x1b9116})[_0x7610('0x26')](function(_0x2262fd){if(_0x2262fd){throw new db[(_0x7610('0x54'))][(_0x7610('0x55'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x7610('0x30')]['create'](_0x3530f9[_0x7610('0x4c')]);})[_0x7610('0x26')](function(_0x142766){var _0x374852=_0x3530f9['user'][_0x7610('0x27')]({'plain':!![]});if(!_0x374852)throw new Error(_0x7610('0x56'));if(_0x374852[_0x7610('0x57')]==='user'){var _0x4bea7b=_0x142766[_0x7610('0x27')]({'plain':!![]});return db[_0x7610('0x58')][_0x7610('0x4b')]({'where':{'name':_0x7610('0x28'),'userProfileId':_0x374852['userProfileId']},'raw':!![]})[_0x7610('0x26')](function(_0x2f43f0){if(_0x2f43f0&&_0x2f43f0['autoAssociation']===0x0){return db[_0x7610('0x29')][_0x7610('0x4f')]({'name':_0x4bea7b[_0x7610('0x2c')],'resourceId':_0x4bea7b['id'],'type':_0x2f43f0[_0x7610('0x2c')],'sectionId':_0x2f43f0['id']},{})[_0x7610('0x26')](function(){return _0x142766;});}else{return _0x142766;}})[_0x7610('0x46')](function(_0x3a684b){logger['error'](_0x7610('0x59'),_0x3a684b);throw _0x3a684b;});}return _0x142766;})[_0x7610('0x26')](respondWithResult(_0x2a51a3,0xc9))[_0x7610('0x46')](handleError(_0x2a51a3,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index a709f16..20e49e9 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 _0xcb8e=['request-promise','rimraf','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','lodash','../../config/logger','api','moment','bluebird'];(function(_0x291717,_0x54b354){var _0x5d1e50=function(_0x4309ac){while(--_0x4309ac){_0x291717['push'](_0x291717['shift']());}};_0x5d1e50(++_0x54b354);}(_0xcb8e,0x1f3));var _0xecb8=function(_0x511ef8,_0x485338){_0x511ef8=_0x511ef8-0x0;var _0x1bbc3f=_0xcb8e[_0x511ef8];return _0x1bbc3f;};'use strict';var _=require(_0xecb8('0x0'));var util=require('util');var logger=require(_0xecb8('0x1'))(_0xecb8('0x2'));var moment=require(_0xecb8('0x3'));var BPromise=require(_0xecb8('0x4'));var rp=require(_0xecb8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xecb8('0x6'));var config=require(_0xecb8('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0xecb8('0x8')]=function(_0x2e1101,_0x3a2100){return _0x2e1101[_0xecb8('0x9')](_0xecb8('0xa'),attributes,{'tableName':_0xecb8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xff28=['lodash','util','../../config/logger','api','bluebird','path','rimraf','exports','define','tools_canned_answers','utf8mb4'];(function(_0x7b484,_0x195ad4){var _0x2ae1cf=function(_0x2e6247){while(--_0x2e6247){_0x7b484['push'](_0x7b484['shift']());}};_0x2ae1cf(++_0x195ad4);}(_0xff28,0xdc));var _0x8ff2=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0xff28[_0x443494];return _0x4a6794;};'use strict';var _=require(_0x8ff2('0x0'));var util=require(_0x8ff2('0x1'));var logger=require(_0x8ff2('0x2'))(_0x8ff2('0x3'));var moment=require('moment');var BPromise=require(_0x8ff2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ff2('0x5'));var rimraf=require(_0x8ff2('0x6'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x8ff2('0x7')]=function(_0x3bc7e4,_0x2e8993){return _0x3bc7e4[_0x8ff2('0x8')]('CannedAnswer',attributes,{'tableName':_0x8ff2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8ff2('0xa'),'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 ddb254c..fa50cd4 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(_0x44b714,_0x46e6e8){var _0x66fd8b=function(_0x11056c){while(--_0x11056c){_0x44b714['push'](_0x44b714['shift']());}};_0x66fd8b(++_0x46e6e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x23f553,_0x445bf3){var _0x26ab08=function(_0x44d3a3){while(--_0x44d3a3){_0x23f553['push'](_0x23f553['shift']());}};_0x26ab08(++_0x445bf3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 63b765e..2b2d411 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 _0xf655=['isAuthenticated','index','get','show','post','put','delete','/:id','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller'];(function(_0x2bdf17,_0x6d8f38){var _0xdde346=function(_0x2dfbe3){while(--_0x2dfbe3){_0x2bdf17['push'](_0x2bdf17['shift']());}};_0xdde346(++_0x6d8f38);}(_0xf655,0x199));var _0x5f65=function(_0x5239e2,_0x5e0d5b){_0x5239e2=_0x5239e2-0x0;var _0x1f6a59=_0xf655[_0x5239e2];return _0x1f6a59;};'use strict';var multer=require(_0x5f65('0x0'));var util=require(_0x5f65('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5f65('0x2')]();var fs_extra=require(_0x5f65('0x3'));var auth=require(_0x5f65('0x4'));var interaction=require(_0x5f65('0x5'));var config=require('../../config/environment');var controller=require(_0x5f65('0x6'));router['get']('/',auth[_0x5f65('0x7')](),controller[_0x5f65('0x8')]);router[_0x5f65('0x9')]('/:id',auth[_0x5f65('0x7')](),controller[_0x5f65('0xa')]);router[_0x5f65('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5f65('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5f65('0xd')](_0x5f65('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x5f65('0xf')]=router; \ No newline at end of file +var _0x6ff1=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','/:id','isAuthenticated','post'];(function(_0x41daaf,_0x9c8ae8){var _0x492873=function(_0x4283b3){while(--_0x4283b3){_0x41daaf['push'](_0x41daaf['shift']());}};_0x492873(++_0x9c8ae8);}(_0x6ff1,0xf0));var _0x16ff=function(_0x48787a,_0x13f971){_0x48787a=_0x48787a-0x0;var _0x452d03=_0x6ff1[_0x48787a];return _0x452d03;};'use strict';var multer=require(_0x16ff('0x0'));var util=require(_0x16ff('0x1'));var path=require('path');var timeout=require(_0x16ff('0x2'));var express=require(_0x16ff('0x3'));var router=express['Router']();var fs_extra=require(_0x16ff('0x4'));var auth=require(_0x16ff('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x16ff('0x6'));var controller=require(_0x16ff('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x16ff('0x8')](_0x16ff('0x9'),auth[_0x16ff('0xa')](),controller['show']);router[_0x16ff('0xb')]('/',auth[_0x16ff('0xa')](),controller[_0x16ff('0xc')]);router[_0x16ff('0xd')](_0x16ff('0x9'),auth['isAuthenticated'](),controller[_0x16ff('0xe')]);router[_0x16ff('0xf')]('/:id',auth[_0x16ff('0xa')](),controller[_0x16ff('0x10')]);module[_0x16ff('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 886342f..e5b5345 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 _0xee5b=['sequelize','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x59513e,_0x15eec4){var _0x469a1b=function(_0x3a4dc7){while(--_0x3a4dc7){_0x59513e['push'](_0x59513e['shift']());}};_0x469a1b(++_0x15eec4);}(_0xee5b,0x1f4));var _0xbee5=function(_0x34ea19,_0x4a8ffe){_0x34ea19=_0x34ea19-0x0;var _0x31e059=_0xee5b[_0x34ea19];return _0x31e059;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xbee5('0x1')],'allowNull':![],'defaultValue':_0xbee5('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xbee5('0x3')]},'dst':{'type':Sequelize[_0xbee5('0x3')]},'dcontext':{'type':Sequelize[_0xbee5('0x3')]},'channel':{'type':Sequelize[_0xbee5('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xbee5('0x3')]},'duration':{'type':Sequelize[_0xbee5('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xbee5('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbee5('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xbee5('0x3')]},'peeraccount':{'type':Sequelize[_0xbee5('0x3')]},'type':{'type':Sequelize[_0xbee5('0x3')]},'tag':{'type':Sequelize[_0xbee5('0x3')]}}; \ No newline at end of file +var _0xc540=['INTEGER','1970-01-01\x2000:00:01','STRING'];(function(_0xc1c93f,_0x1fba71){var _0x3f81cb=function(_0x20b66f){while(--_0x20b66f){_0xc1c93f['push'](_0xc1c93f['shift']());}};_0x3f81cb(++_0x1fba71);}(_0xc540,0x184));var _0x0c54=function(_0x3956ff,_0x4cd334){_0x3956ff=_0x3956ff-0x0;var _0x3bd57d=_0xc540[_0x3956ff];return _0x3bd57d;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x0c54('0x0')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x0c54('0x1')]},'dst':{'type':Sequelize[_0x0c54('0x1')]},'dcontext':{'type':Sequelize[_0x0c54('0x1')]},'channel':{'type':Sequelize[_0x0c54('0x1')]},'dstchannel':{'type':Sequelize[_0x0c54('0x1')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x0c54('0x1')]},'duration':{'type':Sequelize[_0x0c54('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0c54('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0c54('0x1')]},'amaflags':{'type':Sequelize[_0x0c54('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0c54('0x1')]},'userfield':{'type':Sequelize[_0x0c54('0x1')]},'uniqueid':{'type':Sequelize[_0x0c54('0x1')]},'linkedid':{'type':Sequelize[_0x0c54('0x1')]},'sequence':{'type':Sequelize[_0x0c54('0x1')]},'peeraccount':{'type':Sequelize[_0x0c54('0x1')]},'type':{'type':Sequelize[_0x0c54('0x1')]},'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 9395ba1..30a37b5 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 _0xb138=['filters','pick','VIRTUAL','merge','includeAll','include','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where'];(function(_0x2ec0b7,_0x1931c){var _0x44b5a7=function(_0x5285de){while(--_0x5285de){_0x2ec0b7['push'](_0x2ec0b7['shift']());}};_0x44b5a7(++_0x1931c);}(_0xb138,0x1dd));var _0x8b13=function(_0x39ff9c,_0x35d13a){_0x39ff9c=_0x39ff9c-0x0;var _0x4ff2d2=_0xb138[_0x39ff9c];return _0x4ff2d2;};'use strict';var emlformat=require(_0x8b13('0x0'));var rimraf=require(_0x8b13('0x1'));var zipdir=require(_0x8b13('0x2'));var jsonpatch=require(_0x8b13('0x3'));var rp=require(_0x8b13('0x4'));var moment=require(_0x8b13('0x5'));var BPromise=require(_0x8b13('0x6'));var Mustache=require('mustache');var util=require(_0x8b13('0x7'));var path=require(_0x8b13('0x8'));var sox=require(_0x8b13('0x9'));var csv=require('to-csv');var ejs=require(_0x8b13('0xa'));var fs=require('fs');var fs_extra=require(_0x8b13('0xb'));var _=require('lodash');var squel=require(_0x8b13('0xc'));var crypto=require(_0x8b13('0xd'));var jsforce=require(_0x8b13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8b13('0xf'));var querystring=require(_0x8b13('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b13('0x11'));var qs=require(_0x8b13('0x12'));var as=require(_0x8b13('0x13'));var hardwareService=require(_0x8b13('0x14'));var logger=require(_0x8b13('0x15'))('api');var utils=require(_0x8b13('0x16'));var config=require(_0x8b13('0x17'));var licenseUtil=require(_0x8b13('0x18'));var db=require(_0x8b13('0x19'))['db'];function respondWithStatusCode(_0xb227e0,_0x1893b1){_0x1893b1=_0x1893b1||0xcc;return function(_0x58f97e){if(_0x58f97e){return _0xb227e0['sendStatus'](_0x1893b1);}return _0xb227e0[_0x8b13('0x1a')](_0x1893b1)[_0x8b13('0x1b')]();};}function respondWithResult(_0x5f12b5,_0x51a935){_0x51a935=_0x51a935||0xc8;return function(_0x479773){if(_0x479773){return _0x5f12b5[_0x8b13('0x1a')](_0x51a935)[_0x8b13('0x1c')](_0x479773);}};}function respondWithFilteredResult(_0xf29086,_0x2c615a){return function(_0x13f956){if(_0x13f956){var _0x542357=typeof _0x2c615a[_0x8b13('0x1d')]===_0x8b13('0x1e')&&typeof _0x2c615a[_0x8b13('0x1f')]===_0x8b13('0x1e');var _0x3eed21=_0x13f956[_0x8b13('0x20')];var _0x10fbde=_0x542357?0x0:_0x2c615a[_0x8b13('0x1d')];var _0x4989d3=_0x542357?_0x13f956['count']:_0x2c615a[_0x8b13('0x1d')]+_0x2c615a[_0x8b13('0x1f')];var _0x14a8ac;if(_0x4989d3>=_0x3eed21){_0x4989d3=_0x3eed21;_0x14a8ac=0xc8;}else{_0x14a8ac=0xce;}_0xf29086[_0x8b13('0x1a')](_0x14a8ac);return _0xf29086[_0x8b13('0x21')](_0x8b13('0x22'),_0x10fbde+'-'+_0x4989d3+'/'+_0x3eed21)['json'](_0x13f956);}return null;};}function patchUpdates(_0x1e8a48){return function(_0x3c4d4f){try{jsonpatch[_0x8b13('0x23')](_0x3c4d4f,_0x1e8a48,!![]);}catch(_0x54a309){return BPromise['reject'](_0x54a309);}return _0x3c4d4f[_0x8b13('0x24')]();};}function saveUpdates(_0xcb7621,_0x4f9902){return function(_0x3187ed){if(_0x3187ed){return _0x3187ed[_0x8b13('0x25')](_0xcb7621)[_0x8b13('0x26')](function(_0x213280){return _0x213280;});}return null;};}function removeEntity(_0xc05d5c,_0x583639){return function(_0x339271){if(_0x339271){return _0x339271[_0x8b13('0x27')]()['then'](function(){_0xc05d5c[_0x8b13('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420772,_0x325d68){return function(_0x54786a){if(!_0x54786a){_0x420772[_0x8b13('0x28')](0x194);}return _0x54786a;};}function handleError(_0x3223d8,_0x4f8e58){_0x4f8e58=_0x4f8e58||0x1f4;return function(_0x134c5e){logger[_0x8b13('0x29')](_0x134c5e[_0x8b13('0x2a')]);if(_0x134c5e[_0x8b13('0x2b')]){delete _0x134c5e[_0x8b13('0x2b')];}_0x3223d8['status'](_0x4f8e58)[_0x8b13('0x2c')](_0x134c5e);};}exports[_0x8b13('0x2d')]=function(_0x3475d8,_0x1511bf){var _0x114b01={},_0x2bb51d={},_0x5ab161={'count':0x0,'rows':[]};var _0x35fdca=_[_0x8b13('0x2e')](db[_0x8b13('0x2f')][_0x8b13('0x30')],function(_0x23fde7){return{'name':_0x23fde7[_0x8b13('0x31')],'type':_0x23fde7[_0x8b13('0x32')][_0x8b13('0x33')]};});_0x2bb51d[_0x8b13('0x34')]=_['map'](_0x35fdca,_0x8b13('0x2b'));_0x2bb51d[_0x8b13('0x35')]=_[_0x8b13('0x36')](_0x3475d8[_0x8b13('0x35')]);_0x2bb51d['filters']=_['intersection'](_0x2bb51d[_0x8b13('0x34')],_0x2bb51d['query']);_0x114b01['attributes']=_[_0x8b13('0x37')](_0x2bb51d['model'],qs[_0x8b13('0x38')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x38')]));_0x114b01[_0x8b13('0x39')]=_0x114b01[_0x8b13('0x39')][_0x8b13('0x3a')]?_0x114b01[_0x8b13('0x39')]:_0x2bb51d[_0x8b13('0x34')];if(!_0x3475d8[_0x8b13('0x35')][_0x8b13('0x3b')]('nolimit')){_0x114b01[_0x8b13('0x1f')]=qs[_0x8b13('0x1f')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x1f')]);_0x114b01[_0x8b13('0x1d')]=qs[_0x8b13('0x1d')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x1d')]);}_0x114b01['order']=qs[_0x8b13('0x3c')](_0x3475d8['query'][_0x8b13('0x3c')]);_0x114b01[_0x8b13('0x3d')]=qs[_0x8b13('0x3e')](_[_0x8b13('0x3f')](_0x3475d8[_0x8b13('0x35')],_0x2bb51d[_0x8b13('0x3e')]),_0x35fdca);if(_0x3475d8['query']['filter']){_0x114b01[_0x8b13('0x3d')]=_['merge'](_0x114b01[_0x8b13('0x3d')],{'$or':_['map'](_0x35fdca,function(_0x590a23){if(_0x590a23[_0x8b13('0x32')]!==_0x8b13('0x40')){var _0x2bc877={};_0x2bc877[_0x590a23[_0x8b13('0x2b')]]={'$like':'%'+_0x3475d8['query']['filter']+'%'};return _0x2bc877;}})});}_0x114b01=_[_0x8b13('0x41')]({},_0x114b01,_0x3475d8['options']);var _0x6ba2f3={'where':_0x114b01[_0x8b13('0x3d')]};return db['Cdr'][_0x8b13('0x20')](_0x6ba2f3)[_0x8b13('0x26')](function(_0x35c1d6){_0x5ab161[_0x8b13('0x20')]=_0x35c1d6;if(_0x3475d8[_0x8b13('0x35')][_0x8b13('0x42')]){_0x114b01[_0x8b13('0x43')]=[{'all':!![]}];}return db['Cdr']['findAll'](_0x114b01);})['then'](function(_0x3eb3c5){_0x5ab161[_0x8b13('0x44')]=_0x3eb3c5;return _0x5ab161;})[_0x8b13('0x26')](respondWithFilteredResult(_0x1511bf,_0x114b01))[_0x8b13('0x45')](handleError(_0x1511bf,null));};exports[_0x8b13('0x46')]=function(_0x271507,_0x492f7d){var _0x4342db={'raw':!![],'where':{'id':_0x271507[_0x8b13('0x47')]['id']}},_0x50e535={};_0x50e535['model']=_[_0x8b13('0x36')](db[_0x8b13('0x2f')][_0x8b13('0x30')]);_0x50e535[_0x8b13('0x35')]=_[_0x8b13('0x36')](_0x271507[_0x8b13('0x35')]);_0x50e535[_0x8b13('0x3e')]=_['intersection'](_0x50e535['model'],_0x50e535['query']);_0x4342db[_0x8b13('0x39')]=_[_0x8b13('0x37')](_0x50e535[_0x8b13('0x34')],qs[_0x8b13('0x38')](_0x271507['query']['fields']));_0x4342db[_0x8b13('0x39')]=_0x4342db['attributes'][_0x8b13('0x3a')]?_0x4342db[_0x8b13('0x39')]:_0x50e535[_0x8b13('0x34')];if(_0x271507[_0x8b13('0x35')][_0x8b13('0x42')]){_0x4342db['include']=[{'all':!![]}];}_0x4342db=_[_0x8b13('0x41')]({},_0x4342db,_0x271507[_0x8b13('0x48')]);return db[_0x8b13('0x2f')][_0x8b13('0x49')](_0x4342db)[_0x8b13('0x26')](handleEntityNotFound(_0x492f7d,null))[_0x8b13('0x26')](respondWithResult(_0x492f7d,null))[_0x8b13('0x45')](handleError(_0x492f7d,null));};exports[_0x8b13('0x4a')]=function(_0x3e192b,_0x518298){return db[_0x8b13('0x2f')]['create'](_0x3e192b[_0x8b13('0x4b')],{})[_0x8b13('0x26')](respondWithResult(_0x518298,0xc9))[_0x8b13('0x45')](handleError(_0x518298,null));};exports['update']=function(_0x148efb,_0x35f612){if(_0x148efb[_0x8b13('0x4b')]['id']){delete _0x148efb[_0x8b13('0x4b')]['id'];}return db[_0x8b13('0x2f')][_0x8b13('0x49')]({'where':{'id':_0x148efb[_0x8b13('0x47')]['id']}})['then'](handleEntityNotFound(_0x35f612,null))[_0x8b13('0x26')](saveUpdates(_0x148efb['body'],null))[_0x8b13('0x26')](respondWithResult(_0x35f612,null))[_0x8b13('0x45')](handleError(_0x35f612,null));};exports[_0x8b13('0x27')]=function(_0x435867,_0x2be640){return db[_0x8b13('0x2f')][_0x8b13('0x49')]({'where':{'id':_0x435867[_0x8b13('0x47')]['id']}})[_0x8b13('0x26')](handleEntityNotFound(_0x2be640,null))[_0x8b13('0x26')](removeEntity(_0x2be640,null))[_0x8b13('0x45')](handleError(_0x2be640,null));};exports[_0x8b13('0x4c')]=function(_0xd55f3b,_0x2bdfae){return db[_0x8b13('0x2f')][_0x8b13('0x4c')]()[_0x8b13('0x26')](respondWithResult(_0x2bdfae,null))['catch'](handleError(_0x2bdfae,null));}; \ No newline at end of file +var _0xf006=['fieldName','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','destroy','describe','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0xf006,0x146));var _0x6f00=function(_0x57ab57,_0x35db53){_0x57ab57=_0x57ab57-0x0;var _0x5ddf03=_0xf006[_0x57ab57];return _0x5ddf03;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f00('0x0'));var jsonpatch=require(_0x6f00('0x1'));var rp=require('request-promise');var moment=require(_0x6f00('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6f00('0x3'));var util=require('util');var path=require('path');var sox=require(_0x6f00('0x4'));var csv=require(_0x6f00('0x5'));var ejs=require(_0x6f00('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f00('0x7'));var squel=require('squel');var crypto=require(_0x6f00('0x8'));var jsforce=require(_0x6f00('0x9'));var deskjs=require(_0x6f00('0xa'));var toCsv=require(_0x6f00('0x5'));var querystring=require(_0x6f00('0xb'));var Papa=require(_0x6f00('0xc'));var Redis=require(_0x6f00('0xd'));var authService=require(_0x6f00('0xe'));var qs=require(_0x6f00('0xf'));var as=require(_0x6f00('0x10'));var hardwareService=require(_0x6f00('0x11'));var logger=require(_0x6f00('0x12'))(_0x6f00('0x13'));var utils=require('../../config/utils');var config=require(_0x6f00('0x14'));var licenseUtil=require(_0x6f00('0x15'));var db=require(_0x6f00('0x16'))['db'];function respondWithStatusCode(_0x36a2ec,_0x289fe9){_0x289fe9=_0x289fe9||0xcc;return function(_0x5e3264){if(_0x5e3264){return _0x36a2ec[_0x6f00('0x17')](_0x289fe9);}return _0x36a2ec['status'](_0x289fe9)[_0x6f00('0x18')]();};}function respondWithResult(_0x5047f5,_0x324e67){_0x324e67=_0x324e67||0xc8;return function(_0x220e68){if(_0x220e68){return _0x5047f5[_0x6f00('0x19')](_0x324e67)[_0x6f00('0x1a')](_0x220e68);}};}function respondWithFilteredResult(_0xa6e7a1,_0x411203){return function(_0x46bc2c){if(_0x46bc2c){var _0x4d8aee=typeof _0x411203[_0x6f00('0x1b')]==='undefined'&&typeof _0x411203[_0x6f00('0x1c')]==='undefined';var _0x534275=_0x46bc2c[_0x6f00('0x1d')];var _0x6cf83f=_0x4d8aee?0x0:_0x411203[_0x6f00('0x1b')];var _0x340f78=_0x4d8aee?_0x46bc2c[_0x6f00('0x1d')]:_0x411203[_0x6f00('0x1b')]+_0x411203[_0x6f00('0x1c')];var _0x295640;if(_0x340f78>=_0x534275){_0x340f78=_0x534275;_0x295640=0xc8;}else{_0x295640=0xce;}_0xa6e7a1[_0x6f00('0x19')](_0x295640);return _0xa6e7a1[_0x6f00('0x1e')](_0x6f00('0x1f'),_0x6cf83f+'-'+_0x340f78+'/'+_0x534275)[_0x6f00('0x1a')](_0x46bc2c);}return null;};}function patchUpdates(_0x4e11de){return function(_0x4f3031){try{jsonpatch['apply'](_0x4f3031,_0x4e11de,!![]);}catch(_0x2a5286){return BPromise[_0x6f00('0x20')](_0x2a5286);}return _0x4f3031[_0x6f00('0x21')]();};}function saveUpdates(_0x57340f,_0xe301e5){return function(_0x9066ff){if(_0x9066ff){return _0x9066ff[_0x6f00('0x22')](_0x57340f)[_0x6f00('0x23')](function(_0x388983){return _0x388983;});}return null;};}function removeEntity(_0x1cbf1c,_0x90d74c){return function(_0x1ea061){if(_0x1ea061){return _0x1ea061['destroy']()[_0x6f00('0x23')](function(){_0x1cbf1c[_0x6f00('0x19')](0xcc)[_0x6f00('0x18')]();});}};}function handleEntityNotFound(_0x4d41ef,_0x37f062){return function(_0x4f7e29){if(!_0x4f7e29){_0x4d41ef[_0x6f00('0x17')](0x194);}return _0x4f7e29;};}function handleError(_0x511293,_0x434735){_0x434735=_0x434735||0x1f4;return function(_0x39375d){logger[_0x6f00('0x24')](_0x39375d[_0x6f00('0x25')]);if(_0x39375d[_0x6f00('0x26')]){delete _0x39375d['name'];}_0x511293[_0x6f00('0x19')](_0x434735)[_0x6f00('0x27')](_0x39375d);};}exports[_0x6f00('0x28')]=function(_0x4366a4,_0x2671fe){var _0x235a86={},_0xff36ce={},_0x451849={'count':0x0,'rows':[]};var _0x22f107=_[_0x6f00('0x29')](db[_0x6f00('0x2a')][_0x6f00('0x2b')],function(_0x29555d){return{'name':_0x29555d[_0x6f00('0x2c')],'type':_0x29555d['type']['key']};});_0xff36ce['model']=_['map'](_0x22f107,'name');_0xff36ce['query']=_[_0x6f00('0x2d')](_0x4366a4['query']);_0xff36ce[_0x6f00('0x2e')]=_[_0x6f00('0x2f')](_0xff36ce[_0x6f00('0x30')],_0xff36ce[_0x6f00('0x31')]);_0x235a86[_0x6f00('0x32')]=_[_0x6f00('0x2f')](_0xff36ce['model'],qs[_0x6f00('0x33')](_0x4366a4[_0x6f00('0x31')][_0x6f00('0x33')]));_0x235a86[_0x6f00('0x32')]=_0x235a86[_0x6f00('0x32')]['length']?_0x235a86['attributes']:_0xff36ce['model'];if(!_0x4366a4[_0x6f00('0x31')][_0x6f00('0x34')](_0x6f00('0x35'))){_0x235a86[_0x6f00('0x1c')]=qs[_0x6f00('0x1c')](_0x4366a4['query'][_0x6f00('0x1c')]);_0x235a86[_0x6f00('0x1b')]=qs[_0x6f00('0x1b')](_0x4366a4[_0x6f00('0x31')][_0x6f00('0x1b')]);}_0x235a86[_0x6f00('0x36')]=qs[_0x6f00('0x37')](_0x4366a4['query'][_0x6f00('0x37')]);_0x235a86[_0x6f00('0x38')]=qs[_0x6f00('0x2e')](_['pick'](_0x4366a4[_0x6f00('0x31')],_0xff36ce[_0x6f00('0x2e')]),_0x22f107);if(_0x4366a4[_0x6f00('0x31')]['filter']){_0x235a86[_0x6f00('0x38')]=_['merge'](_0x235a86[_0x6f00('0x38')],{'$or':_['map'](_0x22f107,function(_0x3dc8e3){if(_0x3dc8e3[_0x6f00('0x39')]!==_0x6f00('0x3a')){var _0x896b3f={};_0x896b3f[_0x3dc8e3['name']]={'$like':'%'+_0x4366a4[_0x6f00('0x31')]['filter']+'%'};return _0x896b3f;}})});}_0x235a86=_[_0x6f00('0x3b')]({},_0x235a86,_0x4366a4['options']);var _0x7785e1={'where':_0x235a86[_0x6f00('0x38')]};return db[_0x6f00('0x2a')][_0x6f00('0x1d')](_0x7785e1)['then'](function(_0x53dc8c){_0x451849[_0x6f00('0x1d')]=_0x53dc8c;if(_0x4366a4['query'][_0x6f00('0x3c')]){_0x235a86[_0x6f00('0x3d')]=[{'all':!![]}];}return db['Cdr'][_0x6f00('0x3e')](_0x235a86);})['then'](function(_0x4cac2c){_0x451849[_0x6f00('0x3f')]=_0x4cac2c;return _0x451849;})[_0x6f00('0x23')](respondWithFilteredResult(_0x2671fe,_0x235a86))[_0x6f00('0x40')](handleError(_0x2671fe,null));};exports[_0x6f00('0x41')]=function(_0x56399a,_0x38ee25){var _0x4523f2={'raw':!![],'where':{'id':_0x56399a[_0x6f00('0x42')]['id']}},_0x2bb5aa={};_0x2bb5aa[_0x6f00('0x30')]=_[_0x6f00('0x2d')](db['Cdr'][_0x6f00('0x2b')]);_0x2bb5aa[_0x6f00('0x31')]=_[_0x6f00('0x2d')](_0x56399a[_0x6f00('0x31')]);_0x2bb5aa[_0x6f00('0x2e')]=_[_0x6f00('0x2f')](_0x2bb5aa['model'],_0x2bb5aa[_0x6f00('0x31')]);_0x4523f2[_0x6f00('0x32')]=_[_0x6f00('0x2f')](_0x2bb5aa['model'],qs[_0x6f00('0x33')](_0x56399a['query'][_0x6f00('0x33')]));_0x4523f2[_0x6f00('0x32')]=_0x4523f2['attributes'][_0x6f00('0x43')]?_0x4523f2['attributes']:_0x2bb5aa[_0x6f00('0x30')];if(_0x56399a[_0x6f00('0x31')][_0x6f00('0x3c')]){_0x4523f2[_0x6f00('0x3d')]=[{'all':!![]}];}_0x4523f2=_['merge']({},_0x4523f2,_0x56399a[_0x6f00('0x44')]);return db['Cdr'][_0x6f00('0x45')](_0x4523f2)['then'](handleEntityNotFound(_0x38ee25,null))[_0x6f00('0x23')](respondWithResult(_0x38ee25,null))[_0x6f00('0x40')](handleError(_0x38ee25,null));};exports[_0x6f00('0x46')]=function(_0x9b003,_0x470ff3){return db[_0x6f00('0x2a')][_0x6f00('0x46')](_0x9b003[_0x6f00('0x47')],{})['then'](respondWithResult(_0x470ff3,0xc9))[_0x6f00('0x40')](handleError(_0x470ff3,null));};exports['update']=function(_0x265666,_0x31fb17){if(_0x265666[_0x6f00('0x47')]['id']){delete _0x265666['body']['id'];}return db['Cdr'][_0x6f00('0x45')]({'where':{'id':_0x265666[_0x6f00('0x42')]['id']}})['then'](handleEntityNotFound(_0x31fb17,null))[_0x6f00('0x23')](saveUpdates(_0x265666['body'],null))[_0x6f00('0x23')](respondWithResult(_0x31fb17,null))['catch'](handleError(_0x31fb17,null));};exports[_0x6f00('0x48')]=function(_0x222b4c,_0x4c6e06){return db['Cdr'][_0x6f00('0x45')]({'where':{'id':_0x222b4c[_0x6f00('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c6e06,null))[_0x6f00('0x23')](removeEntity(_0x4c6e06,null))['catch'](handleError(_0x4c6e06,null));};exports[_0x6f00('0x49')]=function(_0x7f80ed,_0x3100ee){return db[_0x6f00('0x2a')][_0x6f00('0x49')]()[_0x6f00('0x23')](respondWithResult(_0x3100ee,null))[_0x6f00('0x40')](handleError(_0x3100ee,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index e5f94ef..a45d0e5 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3d5cd9,_0x16db35){var _0x116080=function(_0x4c80fc){while(--_0x4c80fc){_0x3d5cd9['push'](_0x3d5cd9['shift']());}};_0x116080(++_0x16db35);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x1220c0,_0x5c06f9){var _0x1cc1b7=function(_0x2ab880){while(--_0x2ab880){_0x1220c0['push'](_0x1220c0['shift']());}};_0x1cc1b7(++_0x5c06f9);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 0affbb7..ded0adb 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 _0x5b4c=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment'];(function(_0x52967f,_0x5a463d){var _0x5e671f=function(_0x2b3dbb){while(--_0x2b3dbb){_0x52967f['push'](_0x52967f['shift']());}};_0x5e671f(++_0x5a463d);}(_0x5b4c,0xb1));var _0xc5b4=function(_0x14e704,_0x2ae9f4){_0x14e704=_0x14e704-0x0;var _0x2ff43b=_0x5b4c[_0x14e704];return _0x2ff43b;};'use strict';var _=require(_0xc5b4('0x0'));var util=require(_0xc5b4('0x1'));var moment=require(_0xc5b4('0x2'));var BPromise=require(_0xc5b4('0x3'));var rs=require(_0xc5b4('0x4'));var fs=require('fs');var Redis=require(_0xc5b4('0x5'));var db=require(_0xc5b4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc5b4('0x7'));var config=require('../../config/environment');var jayson=require(_0xc5b4('0x8'));var client=jayson[_0xc5b4('0x9')][_0xc5b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x522f38,_0x148217,_0x3633c1){return new BPromise(function(_0xa5acc,_0x598210){return client['request'](_0x522f38,_0x3633c1)[_0xc5b4('0xb')](function(_0x93c855){logger[_0xc5b4('0xc')](_0xc5b4('0xd'),_0x148217,'request\x20sent');logger[_0xc5b4('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x148217,_0xc5b4('0xf'),JSON['stringify'](_0x93c855));if(_0x93c855[_0xc5b4('0x10')]){if(_0x93c855['error'][_0xc5b4('0x11')]===0x1f4){logger['error'](_0xc5b4('0xd'),_0x148217,_0x93c855[_0xc5b4('0x10')][_0xc5b4('0x12')]);return _0x598210(_0x93c855[_0xc5b4('0x10')]['message']);}logger[_0xc5b4('0x10')](_0xc5b4('0xd'),_0x148217,_0x93c855[_0xc5b4('0x10')][_0xc5b4('0x12')]);return _0xa5acc(_0x93c855[_0xc5b4('0x10')][_0xc5b4('0x12')]);}else{logger['info'](_0xc5b4('0xd'),_0x148217,'request\x20sent');_0xa5acc(_0x93c855['result'][_0xc5b4('0x12')]);}})[_0xc5b4('0x13')](function(_0x47dddd){logger[_0xc5b4('0x10')](_0xc5b4('0xd'),_0x148217,_0x47dddd);_0x598210(_0x47dddd);});});} \ No newline at end of file +var _0xb5f9=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring'];(function(_0x4dc3a4,_0x886144){var _0x45b80c=function(_0x40f6f8){while(--_0x40f6f8){_0x4dc3a4['push'](_0x4dc3a4['shift']());}};_0x45b80c(++_0x886144);}(_0xb5f9,0x13d));var _0x9b5f=function(_0x137092,_0x446f4f){_0x137092=_0x137092-0x0;var _0x4c0917=_0xb5f9[_0x137092];return _0x4c0917;};'use strict';var _=require('lodash');var util=require(_0x9b5f('0x0'));var moment=require(_0x9b5f('0x1'));var BPromise=require('bluebird');var rs=require(_0x9b5f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9b5f('0x3'));var logger=require(_0x9b5f('0x4'))(_0x9b5f('0x5'));var config=require(_0x9b5f('0x6'));var jayson=require(_0x9b5f('0x7'));var client=jayson[_0x9b5f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cdbdf,_0x255352,_0xacf955){return new BPromise(function(_0x5ada19,_0x272249){return client[_0x9b5f('0x9')](_0x4cdbdf,_0xacf955)['then'](function(_0x17d892){logger[_0x9b5f('0xa')](_0x9b5f('0xb'),_0x255352,_0x9b5f('0xc'));logger[_0x9b5f('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x255352,'request\x20sent',JSON[_0x9b5f('0xe')](_0x17d892));if(_0x17d892[_0x9b5f('0xf')]){if(_0x17d892[_0x9b5f('0xf')][_0x9b5f('0x10')]===0x1f4){logger[_0x9b5f('0xf')](_0x9b5f('0xb'),_0x255352,_0x17d892[_0x9b5f('0xf')][_0x9b5f('0x11')]);return _0x272249(_0x17d892[_0x9b5f('0xf')][_0x9b5f('0x11')]);}logger['error'](_0x9b5f('0xb'),_0x255352,_0x17d892[_0x9b5f('0xf')]['message']);return _0x5ada19(_0x17d892[_0x9b5f('0xf')][_0x9b5f('0x11')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x255352,'request\x20sent');_0x5ada19(_0x17d892[_0x9b5f('0x12')][_0x9b5f('0x11')]);}})[_0x9b5f('0x13')](function(_0x1b3f4a){logger[_0x9b5f('0xf')](_0x9b5f('0xb'),_0x255352,_0x1b3f4a);_0x272249(_0x1b3f4a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 7d2518e..40bf504 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(_0x1e8972,_0x12b85d){var _0x353f33=function(_0x16f1da){while(--_0x16f1da){_0x1e8972['push'](_0x1e8972['shift']());}};_0x353f33(++_0x12b85d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +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(_0x608e20,_0x2c546d){var _0x5f498a=function(_0x7ee427){while(--_0x7ee427){_0x608e20['push'](_0x608e20['shift']());}};_0x5f498a(++_0x2c546d);}(_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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 5f1a7c3..2205af9 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 _0x439c=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x439c,0xbb));var _0xc439=function(_0x7f31fe,_0x28e264){_0x7f31fe=_0x7f31fe-0x0;var _0x1bbdff=_0x439c[_0x7f31fe];return _0x1bbdff;};'use strict';var Sequelize=require(_0xc439('0x0'));module[_0xc439('0x1')]={'priority':{'type':Sequelize[_0xc439('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc439('0x3')],'allowNull':![],'defaultValue':_0xc439('0x4')},'appdata':{'type':Sequelize[_0xc439('0x5')]()},'description':{'type':Sequelize[_0xc439('0x3')]},'interval':{'type':Sequelize[_0xc439('0x3')],'defaultValue':_0xc439('0x6')}}; \ No newline at end of file +var _0xfc22=['*,*,*,*','exports','INTEGER','STRING'];(function(_0x9adf1b,_0x3ac695){var _0x960269=function(_0x368ca6){while(--_0x368ca6){_0x9adf1b['push'](_0x9adf1b['shift']());}};_0x960269(++_0x3ac695);}(_0xfc22,0x79));var _0x2fc2=function(_0x40a614,_0x2ac5ee){_0x40a614=_0x40a614-0x0;var _0x40eeac=_0xfc22[_0x40a614];return _0x40eeac;};'use strict';var Sequelize=require('sequelize');module[_0x2fc2('0x0')]={'priority':{'type':Sequelize[_0x2fc2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2fc2('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2fc2('0x2')],'defaultValue':_0x2fc2('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 1443739..a3e95ff 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 _0x6a24=['error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x26addd,_0x255a1e){var _0x13a6b2=function(_0xb4d373){while(--_0xb4d373){_0x26addd['push'](_0x26addd['shift']());}};_0x13a6b2(++_0x255a1e);}(_0x6a24,0xd1));var _0x46a2=function(_0xe4fe77,_0xd8330e){_0xe4fe77=_0xe4fe77-0x0;var _0xeb8cd6=_0x6a24[_0xe4fe77];return _0xeb8cd6;};'use strict';var emlformat=require(_0x46a2('0x0'));var rimraf=require(_0x46a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46a2('0x2'));var rp=require(_0x46a2('0x3'));var moment=require(_0x46a2('0x4'));var BPromise=require(_0x46a2('0x5'));var Mustache=require(_0x46a2('0x6'));var util=require('util');var path=require(_0x46a2('0x7'));var sox=require(_0x46a2('0x8'));var csv=require('to-csv');var ejs=require(_0x46a2('0x9'));var fs=require('fs');var fs_extra=require(_0x46a2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x46a2('0xb'));var jsforce=require(_0x46a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x46a2('0xd'));var querystring=require('querystring');var Papa=require(_0x46a2('0xe'));var Redis=require('ioredis');var authService=require(_0x46a2('0xf'));var qs=require(_0x46a2('0x10'));var as=require(_0x46a2('0x11'));var hardwareService=require(_0x46a2('0x12'));var logger=require(_0x46a2('0x13'))(_0x46a2('0x14'));var utils=require(_0x46a2('0x15'));var config=require(_0x46a2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403282,_0x18e584){_0x18e584=_0x18e584||0xcc;return function(_0x5c5d10){if(_0x5c5d10){return _0x403282[_0x46a2('0x17')](_0x18e584);}return _0x403282[_0x46a2('0x18')](_0x18e584)[_0x46a2('0x19')]();};}function respondWithResult(_0x18a038,_0xddc328){_0xddc328=_0xddc328||0xc8;return function(_0x2fd383){if(_0x2fd383){return _0x18a038[_0x46a2('0x18')](_0xddc328)[_0x46a2('0x1a')](_0x2fd383);}};}function respondWithFilteredResult(_0x577591,_0x4a7e7a){return function(_0x3c81e8){if(_0x3c81e8){var _0x2deb20=typeof _0x4a7e7a['offset']===_0x46a2('0x1b')&&typeof _0x4a7e7a[_0x46a2('0x1c')]==='undefined';var _0xa2eb96=_0x3c81e8[_0x46a2('0x1d')];var _0x577f18=_0x2deb20?0x0:_0x4a7e7a[_0x46a2('0x1e')];var _0x24f75f=_0x2deb20?_0x3c81e8['count']:_0x4a7e7a[_0x46a2('0x1e')]+_0x4a7e7a[_0x46a2('0x1c')];var _0x5144c7;if(_0x24f75f>=_0xa2eb96){_0x24f75f=_0xa2eb96;_0x5144c7=0xc8;}else{_0x5144c7=0xce;}_0x577591[_0x46a2('0x18')](_0x5144c7);return _0x577591[_0x46a2('0x1f')](_0x46a2('0x20'),_0x577f18+'-'+_0x24f75f+'/'+_0xa2eb96)[_0x46a2('0x1a')](_0x3c81e8);}return null;};}function patchUpdates(_0x202294){return function(_0x2d65c2){try{jsonpatch[_0x46a2('0x21')](_0x2d65c2,_0x202294,!![]);}catch(_0x473cfb){return BPromise[_0x46a2('0x22')](_0x473cfb);}return _0x2d65c2[_0x46a2('0x23')]();};}function saveUpdates(_0x5c7586,_0xa37d90){return function(_0x504b9e){if(_0x504b9e){return _0x504b9e[_0x46a2('0x24')](_0x5c7586)[_0x46a2('0x25')](function(_0x511ff6){return _0x511ff6;});}return null;};}function removeEntity(_0x43dc69,_0x15e5bb){return function(_0x233c4e){if(_0x233c4e){return _0x233c4e[_0x46a2('0x26')]()['then'](function(){_0x43dc69[_0x46a2('0x18')](0xcc)[_0x46a2('0x19')]();});}};}function handleEntityNotFound(_0x1e48f5,_0x297158){return function(_0x74bb6a){if(!_0x74bb6a){_0x1e48f5[_0x46a2('0x17')](0x194);}return _0x74bb6a;};}function handleError(_0x3e9554,_0xfa9e13){_0xfa9e13=_0xfa9e13||0x1f4;return function(_0x218f1c){logger[_0x46a2('0x27')](_0x218f1c[_0x46a2('0x28')]);if(_0x218f1c['name']){delete _0x218f1c[_0x46a2('0x29')];}_0x3e9554[_0x46a2('0x18')](_0xfa9e13)[_0x46a2('0x2a')](_0x218f1c);};}exports[_0x46a2('0x2b')]=function(_0x435155,_0x33f42a){var _0x577fd2={'raw':!![],'where':{'id':_0x435155[_0x46a2('0x2c')]['id']}},_0x185647={};_0x185647[_0x46a2('0x2d')]=_[_0x46a2('0x2e')](db[_0x46a2('0x2f')][_0x46a2('0x30')]);_0x185647[_0x46a2('0x31')]=_['keys'](_0x435155[_0x46a2('0x31')]);_0x185647[_0x46a2('0x32')]=_[_0x46a2('0x33')](_0x185647[_0x46a2('0x2d')],_0x185647[_0x46a2('0x31')]);_0x577fd2[_0x46a2('0x34')]=_[_0x46a2('0x33')](_0x185647[_0x46a2('0x2d')],qs[_0x46a2('0x35')](_0x435155['query'][_0x46a2('0x35')]));_0x577fd2[_0x46a2('0x34')]=_0x577fd2[_0x46a2('0x34')][_0x46a2('0x36')]?_0x577fd2[_0x46a2('0x34')]:_0x185647['model'];if(_0x435155['query'][_0x46a2('0x37')]){_0x577fd2[_0x46a2('0x38')]=[{'all':!![]}];}_0x577fd2=_[_0x46a2('0x39')]({},_0x577fd2,_0x435155[_0x46a2('0x3a')]);return db[_0x46a2('0x2f')][_0x46a2('0x3b')](_0x577fd2)['then'](handleEntityNotFound(_0x33f42a,null))['then'](respondWithResult(_0x33f42a,null))[_0x46a2('0x3c')](handleError(_0x33f42a,null));};exports['update']=function(_0x462374,_0x3fe076){if(_0x462374[_0x46a2('0x3d')]['id']){delete _0x462374[_0x46a2('0x3d')]['id'];}return db['ChatApplication'][_0x46a2('0x3b')]({'where':{'id':_0x462374[_0x46a2('0x2c')]['id']}})[_0x46a2('0x25')](handleEntityNotFound(_0x3fe076,null))[_0x46a2('0x25')](saveUpdates(_0x462374['body'],null))[_0x46a2('0x25')](respondWithResult(_0x3fe076,null))[_0x46a2('0x3c')](handleError(_0x3fe076,null));};exports[_0x46a2('0x26')]=function(_0x1cff82,_0x4fa161){return db[_0x46a2('0x2f')]['find']({'where':{'id':_0x1cff82[_0x46a2('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4fa161,null))[_0x46a2('0x25')](removeEntity(_0x4fa161,null))[_0x46a2('0x3c')](handleError(_0x4fa161,null));}; \ No newline at end of file +var _0x3e5c=['Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','params','rawAttributes','query','keys','filters','intersection','attributes','model','fields','length','include','merge','options','ChatApplication','body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x40b54c,_0x19014b){_0x40b54c=_0x40b54c-0x0;var _0x272365=_0x3e5c[_0x40b54c];return _0x272365;};'use strict';var emlformat=require(_0xc3e5('0x0'));var rimraf=require(_0xc3e5('0x1'));var zipdir=require(_0xc3e5('0x2'));var jsonpatch=require(_0xc3e5('0x3'));var rp=require('request-promise');var moment=require(_0xc3e5('0x4'));var BPromise=require(_0xc3e5('0x5'));var Mustache=require(_0xc3e5('0x6'));var util=require(_0xc3e5('0x7'));var path=require(_0xc3e5('0x8'));var sox=require(_0xc3e5('0x9'));var csv=require('to-csv');var ejs=require(_0xc3e5('0xa'));var fs=require('fs');var fs_extra=require(_0xc3e5('0xb'));var _=require(_0xc3e5('0xc'));var squel=require(_0xc3e5('0xd'));var crypto=require(_0xc3e5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc3e5('0xf'));var toCsv=require(_0xc3e5('0x10'));var querystring=require(_0xc3e5('0x11'));var Papa=require(_0xc3e5('0x12'));var Redis=require(_0xc3e5('0x13'));var authService=require(_0xc3e5('0x14'));var qs=require(_0xc3e5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3e5('0x16'));var logger=require(_0xc3e5('0x17'))(_0xc3e5('0x18'));var utils=require(_0xc3e5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc3e5('0x1a'));var db=require(_0xc3e5('0x1b'))['db'];function respondWithStatusCode(_0x36193e,_0x3f0395){_0x3f0395=_0x3f0395||0xcc;return function(_0x3b7441){if(_0x3b7441){return _0x36193e[_0xc3e5('0x1c')](_0x3f0395);}return _0x36193e['status'](_0x3f0395)['end']();};}function respondWithResult(_0x52cca7,_0x27c226){_0x27c226=_0x27c226||0xc8;return function(_0x5a52f1){if(_0x5a52f1){return _0x52cca7[_0xc3e5('0x1d')](_0x27c226)[_0xc3e5('0x1e')](_0x5a52f1);}};}function respondWithFilteredResult(_0x4d1ad9,_0x353dc0){return function(_0x3e3eaa){if(_0x3e3eaa){var _0x2cc476=typeof _0x353dc0[_0xc3e5('0x1f')]===_0xc3e5('0x20')&&typeof _0x353dc0['limit']===_0xc3e5('0x20');var _0x277063=_0x3e3eaa[_0xc3e5('0x21')];var _0xa33d84=_0x2cc476?0x0:_0x353dc0[_0xc3e5('0x1f')];var _0x1e1eea=_0x2cc476?_0x3e3eaa['count']:_0x353dc0[_0xc3e5('0x1f')]+_0x353dc0[_0xc3e5('0x22')];var _0x4a1d86;if(_0x1e1eea>=_0x277063){_0x1e1eea=_0x277063;_0x4a1d86=0xc8;}else{_0x4a1d86=0xce;}_0x4d1ad9[_0xc3e5('0x1d')](_0x4a1d86);return _0x4d1ad9['set'](_0xc3e5('0x23'),_0xa33d84+'-'+_0x1e1eea+'/'+_0x277063)[_0xc3e5('0x1e')](_0x3e3eaa);}return null;};}function patchUpdates(_0x2d551b){return function(_0xebf6dc){try{jsonpatch[_0xc3e5('0x24')](_0xebf6dc,_0x2d551b,!![]);}catch(_0x4a7806){return BPromise[_0xc3e5('0x25')](_0x4a7806);}return _0xebf6dc[_0xc3e5('0x26')]();};}function saveUpdates(_0x2d8c6f,_0x3eb513){return function(_0x414ba9){if(_0x414ba9){return _0x414ba9[_0xc3e5('0x27')](_0x2d8c6f)[_0xc3e5('0x28')](function(_0x47f344){return _0x47f344;});}return null;};}function removeEntity(_0x3a2800,_0x430cb4){return function(_0x43d01e){if(_0x43d01e){return _0x43d01e[_0xc3e5('0x29')]()[_0xc3e5('0x28')](function(){_0x3a2800[_0xc3e5('0x1d')](0xcc)[_0xc3e5('0x2a')]();});}};}function handleEntityNotFound(_0x45556e,_0x564748){return function(_0x25d3a3){if(!_0x25d3a3){_0x45556e['sendStatus'](0x194);}return _0x25d3a3;};}function handleError(_0x4c0cf4,_0x8815af){_0x8815af=_0x8815af||0x1f4;return function(_0x12ad6e){logger[_0xc3e5('0x2b')](_0x12ad6e['stack']);if(_0x12ad6e[_0xc3e5('0x2c')]){delete _0x12ad6e[_0xc3e5('0x2c')];}_0x4c0cf4[_0xc3e5('0x1d')](_0x8815af)[_0xc3e5('0x2d')](_0x12ad6e);};}exports['show']=function(_0xa6766d,_0x497ecf){var _0x45ca6d={'raw':!![],'where':{'id':_0xa6766d[_0xc3e5('0x2e')]['id']}},_0xc0e6e7={};_0xc0e6e7['model']=_['keys'](db['ChatApplication'][_0xc3e5('0x2f')]);_0xc0e6e7[_0xc3e5('0x30')]=_[_0xc3e5('0x31')](_0xa6766d[_0xc3e5('0x30')]);_0xc0e6e7[_0xc3e5('0x32')]=_[_0xc3e5('0x33')](_0xc0e6e7['model'],_0xc0e6e7[_0xc3e5('0x30')]);_0x45ca6d[_0xc3e5('0x34')]=_[_0xc3e5('0x33')](_0xc0e6e7[_0xc3e5('0x35')],qs[_0xc3e5('0x36')](_0xa6766d[_0xc3e5('0x30')][_0xc3e5('0x36')]));_0x45ca6d[_0xc3e5('0x34')]=_0x45ca6d[_0xc3e5('0x34')][_0xc3e5('0x37')]?_0x45ca6d[_0xc3e5('0x34')]:_0xc0e6e7['model'];if(_0xa6766d[_0xc3e5('0x30')]['includeAll']){_0x45ca6d[_0xc3e5('0x38')]=[{'all':!![]}];}_0x45ca6d=_[_0xc3e5('0x39')]({},_0x45ca6d,_0xa6766d[_0xc3e5('0x3a')]);return db[_0xc3e5('0x3b')]['find'](_0x45ca6d)[_0xc3e5('0x28')](handleEntityNotFound(_0x497ecf,null))['then'](respondWithResult(_0x497ecf,null))['catch'](handleError(_0x497ecf,null));};exports[_0xc3e5('0x27')]=function(_0x4f6fe1,_0x3c407f){if(_0x4f6fe1[_0xc3e5('0x3c')]['id']){delete _0x4f6fe1[_0xc3e5('0x3c')]['id'];}return db[_0xc3e5('0x3b')][_0xc3e5('0x3d')]({'where':{'id':_0x4f6fe1['params']['id']}})[_0xc3e5('0x28')](handleEntityNotFound(_0x3c407f,null))[_0xc3e5('0x28')](saveUpdates(_0x4f6fe1[_0xc3e5('0x3c')],null))[_0xc3e5('0x28')](respondWithResult(_0x3c407f,null))[_0xc3e5('0x3e')](handleError(_0x3c407f,null));};exports['destroy']=function(_0x3ab3be,_0x484e21){return db[_0xc3e5('0x3b')][_0xc3e5('0x3d')]({'where':{'id':_0x3ab3be['params']['id']}})[_0xc3e5('0x28')](handleEntityNotFound(_0x484e21,null))['then'](removeEntity(_0x484e21,null))[_0xc3e5('0x3e')](handleError(_0x484e21,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index ce5fa92..9f30292 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 _0x67c7=['bluebird','request-promise','path','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x32290e,_0x1a0749){var _0x12762f=function(_0x2b1d2b){while(--_0x2b1d2b){_0x32290e['push'](_0x32290e['shift']());}};_0x12762f(++_0x1a0749);}(_0x67c7,0x172));var _0x767c=function(_0xa599e2,_0x3046be){_0xa599e2=_0xa599e2-0x0;var _0x122f49=_0x67c7[_0xa599e2];return _0x122f49;};'use strict';var _=require(_0x767c('0x0'));var util=require(_0x767c('0x1'));var logger=require(_0x767c('0x2'))(_0x767c('0x3'));var moment=require(_0x767c('0x4'));var BPromise=require(_0x767c('0x5'));var rp=require(_0x767c('0x6'));var fs=require('fs');var path=require(_0x767c('0x7'));var rimraf=require('rimraf');var config=require(_0x767c('0x8'));var attributes=require(_0x767c('0x9'));module['exports']=function(_0x116f27,_0xf3bf74){return _0x116f27[_0x767c('0xa')](_0x767c('0xb'),attributes,{'tableName':_0x767c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x767c('0xd'),'collate':_0x767c('0xe')});}; \ No newline at end of file +var _0x12d7=['request-promise','path','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0x12d7,0x181));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x712d('0x0'));var util=require('util');var logger=require(_0x712d('0x1'))(_0x712d('0x2'));var moment=require(_0x712d('0x3'));var BPromise=require(_0x712d('0x4'));var rp=require(_0x712d('0x5'));var fs=require('fs');var path=require(_0x712d('0x6'));var rimraf=require('rimraf');var config=require(_0x712d('0x7'));var attributes=require(_0x712d('0x8'));module[_0x712d('0x9')]=function(_0x2cf71a,_0x498a92){return _0x2cf71a[_0x712d('0xa')](_0x712d('0xb'),attributes,{'tableName':_0x712d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x712d('0xd'),'collate':_0x712d('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index b011bab..57e561e 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 _0xb599=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x249935,_0x2c405d){var _0x305bb0=function(_0x4fe26f){while(--_0x4fe26f){_0x249935['push'](_0x249935['shift']());}};_0x305bb0(++_0x2c405d);}(_0xb599,0x6e));var _0x9b59=function(_0x2d1817,_0x10589e){_0x2d1817=_0x2d1817-0x0;var _0x130746=_0xb599[_0x2d1817];return _0x130746;};'use strict';var _=require('lodash');var util=require(_0x9b59('0x0'));var moment=require(_0x9b59('0x1'));var BPromise=require(_0x9b59('0x2'));var rs=require(_0x9b59('0x3'));var fs=require('fs');var Redis=require(_0x9b59('0x4'));var db=require(_0x9b59('0x5'))['db'];var utils=require(_0x9b59('0x6'));var logger=require(_0x9b59('0x7'))(_0x9b59('0x8'));var config=require(_0x9b59('0x9'));var jayson=require(_0x9b59('0xa'));var client=jayson[_0x9b59('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xef7f55,_0x170f99,_0x2b5c11){return new BPromise(function(_0x140b37,_0x499f73){return client['request'](_0xef7f55,_0x2b5c11)[_0x9b59('0xc')](function(_0xf5cd5f){logger[_0x9b59('0xd')](_0x9b59('0xe'),_0x170f99,_0x9b59('0xf'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x170f99,'request\x20sent',JSON[_0x9b59('0x10')](_0xf5cd5f));if(_0xf5cd5f[_0x9b59('0x11')]){if(_0xf5cd5f[_0x9b59('0x11')][_0x9b59('0x12')]===0x1f4){logger[_0x9b59('0x11')](_0x9b59('0xe'),_0x170f99,_0xf5cd5f[_0x9b59('0x11')][_0x9b59('0x13')]);return _0x499f73(_0xf5cd5f['error'][_0x9b59('0x13')]);}logger[_0x9b59('0x11')](_0x9b59('0xe'),_0x170f99,_0xf5cd5f[_0x9b59('0x11')]['message']);return _0x140b37(_0xf5cd5f['error']['message']);}else{logger[_0x9b59('0xd')](_0x9b59('0xe'),_0x170f99,_0x9b59('0xf'));_0x140b37(_0xf5cd5f[_0x9b59('0x14')][_0x9b59('0x13')]);}})[_0x9b59('0x15')](function(_0x31700a){logger['error'](_0x9b59('0xe'),_0x170f99,_0x31700a);_0x499f73(_0x31700a);});});} \ No newline at end of file +var _0x3a4a=['error','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x27eda0,_0x42a3cf){var _0x2b63a5=function(_0x431084){while(--_0x431084){_0x27eda0['push'](_0x27eda0['shift']());}};_0x2b63a5(++_0x42a3cf);}(_0x3a4a,0x15e));var _0xa3a4=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x3a4a[_0x1a7550];return _0x426e22;};'use strict';var _=require(_0xa3a4('0x0'));var util=require(_0xa3a4('0x1'));var moment=require(_0xa3a4('0x2'));var BPromise=require(_0xa3a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3a4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa3a4('0x5'));var logger=require(_0xa3a4('0x6'))(_0xa3a4('0x7'));var config=require(_0xa3a4('0x8'));var jayson=require(_0xa3a4('0x9'));var client=jayson[_0xa3a4('0xa')][_0xa3a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d4546,_0x1b145d,_0x6c0f54){return new BPromise(function(_0x22cc83,_0x5d79dc){return client[_0xa3a4('0xc')](_0x3d4546,_0x6c0f54)[_0xa3a4('0xd')](function(_0x1e57dd){logger[_0xa3a4('0xe')]('ChatApplication,\x20%s,\x20%s',_0x1b145d,_0xa3a4('0xf'));logger[_0xa3a4('0x10')](_0xa3a4('0x11'),_0x1b145d,_0xa3a4('0xf'),JSON['stringify'](_0x1e57dd));if(_0x1e57dd[_0xa3a4('0x12')]){if(_0x1e57dd[_0xa3a4('0x12')]['code']===0x1f4){logger[_0xa3a4('0x12')](_0xa3a4('0x13'),_0x1b145d,_0x1e57dd['error']['message']);return _0x5d79dc(_0x1e57dd[_0xa3a4('0x12')][_0xa3a4('0x14')]);}logger[_0xa3a4('0x12')](_0xa3a4('0x13'),_0x1b145d,_0x1e57dd[_0xa3a4('0x12')]['message']);return _0x22cc83(_0x1e57dd['error'][_0xa3a4('0x14')]);}else{logger[_0xa3a4('0xe')]('ChatApplication,\x20%s,\x20%s',_0x1b145d,_0xa3a4('0xf'));_0x22cc83(_0x1e57dd[_0xa3a4('0x15')][_0xa3a4('0x14')]);}})[_0xa3a4('0x16')](function(_0x49be11){logger[_0xa3a4('0x12')](_0xa3a4('0x13'),_0x1b145d,_0x49be11);_0x5d79dc(_0x49be11);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index ff8209f..7266147 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 _0x95f7=['../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5825be,_0x1c8318){var _0x5b7559=function(_0x115086){while(--_0x115086){_0x5825be['push'](_0x5825be['shift']());}};_0x5b7559(++_0x1c8318);}(_0x95f7,0x1a2));var _0x795f=function(_0x7e1895,_0x11758a){_0x7e1895=_0x7e1895-0x0;var _0x5b5320=_0x95f7[_0x7e1895];return _0x5b5320;};'use strict';var multer=require(_0x795f('0x0'));var util=require(_0x795f('0x1'));var path=require(_0x795f('0x2'));var timeout=require(_0x795f('0x3'));var express=require(_0x795f('0x4'));var router=express[_0x795f('0x5')]();var fs_extra=require(_0x795f('0x6'));var auth=require(_0x795f('0x7'));var interaction=require(_0x795f('0x8'));var config=require('../../config/environment');var controller=require(_0x795f('0x9'));router[_0x795f('0xa')](_0x795f('0xb'),auth[_0x795f('0xc')](),controller[_0x795f('0xd')]);router['put'](_0x795f('0xb'),auth[_0x795f('0xc')](),controller[_0x795f('0xe')]);router[_0x795f('0xf')](_0x795f('0xb'),auth[_0x795f('0xc')](),controller[_0x795f('0x10')]);module['exports']=router; \ No newline at end of file +var _0xdfc2=['connect-timeout','express','fs-extra','../../components/auth/service','./chatApplication.controller','get','/:id','show','update','isAuthenticated','destroy','exports','multer','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdfc2,0xfc));var _0x2dfc=function(_0x321d0b,_0x41fbca){_0x321d0b=_0x321d0b-0x0;var _0x24b79a=_0xdfc2[_0x321d0b];return _0x24b79a;};'use strict';var multer=require(_0x2dfc('0x0'));var util=require(_0x2dfc('0x1'));var path=require(_0x2dfc('0x2'));var timeout=require(_0x2dfc('0x3'));var express=require(_0x2dfc('0x4'));var router=express['Router']();var fs_extra=require(_0x2dfc('0x5'));var auth=require(_0x2dfc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2dfc('0x7'));router[_0x2dfc('0x8')](_0x2dfc('0x9'),auth['isAuthenticated'](),controller[_0x2dfc('0xa')]);router['put'](_0x2dfc('0x9'),auth['isAuthenticated'](),controller[_0x2dfc('0xb')]);router['delete'](_0x2dfc('0x9'),auth[_0x2dfc('0xc')](),controller[_0x2dfc('0xd')]);module[_0x2dfc('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index b5c9881..08ac495 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 _0x0018=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4e3c21,_0x286f50){var _0x50250d=function(_0x401f37){while(--_0x401f37){_0x4e3c21['push'](_0x4e3c21['shift']());}};_0x50250d(++_0x286f50);}(_0x0018,0x1aa));var _0x8001=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0018[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x8001('0x0'));module[_0x8001('0x1')]={'name':{'type':Sequelize[_0x8001('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8001('0x2')]},'write':{'type':Sequelize[_0x8001('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8786=['sequelize','STRING'];(function(_0x4f4c85,_0x1fba10){var _0x1a189a=function(_0x4c88a1){while(--_0x4c88a1){_0x4f4c85['push'](_0x4f4c85['shift']());}};_0x1a189a(++_0x1fba10);}(_0x8786,0x138));var _0x6878=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8786[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x6878('0x0'));module['exports']={'name':{'type':Sequelize[_0x6878('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6878('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index ecde9af..b4d2891 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 _0x1a2e=['addMembers','omit','getMembers','findOne','User','pick','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','ChatGroup','findAll','rows','show','rawAttributes','find','create','catch','body','params','destroy','getUnread','ChatInternalMessage','user','toInteger'];(function(_0x4634ac,_0x540b17){var _0x34baf5=function(_0x4c7a22){while(--_0x4c7a22){_0x4634ac['push'](_0x4634ac['shift']());}};_0x34baf5(++_0x540b17);}(_0x1a2e,0x19e));var _0xe1a2=function(_0x22f373,_0xfe4768){_0x22f373=_0x22f373-0x0;var _0x1da590=_0x1a2e[_0x22f373];return _0x1da590;};'use strict';var emlformat=require(_0xe1a2('0x0'));var rimraf=require(_0xe1a2('0x1'));var zipdir=require(_0xe1a2('0x2'));var jsonpatch=require(_0xe1a2('0x3'));var rp=require(_0xe1a2('0x4'));var moment=require(_0xe1a2('0x5'));var BPromise=require(_0xe1a2('0x6'));var Mustache=require(_0xe1a2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe1a2('0x8'));var csv=require(_0xe1a2('0x9'));var ejs=require(_0xe1a2('0xa'));var fs=require('fs');var fs_extra=require(_0xe1a2('0xb'));var _=require(_0xe1a2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe1a2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe1a2('0xe'));var Papa=require('papaparse');var Redis=require(_0xe1a2('0xf'));var authService=require(_0xe1a2('0x10'));var qs=require(_0xe1a2('0x11'));var as=require(_0xe1a2('0x12'));var hardwareService=require(_0xe1a2('0x13'));var logger=require(_0xe1a2('0x14'))(_0xe1a2('0x15'));var utils=require(_0xe1a2('0x16'));var config=require(_0xe1a2('0x17'));var licenseUtil=require(_0xe1a2('0x18'));var db=require('../../mysqldb')['db'];config[_0xe1a2('0x19')]=_[_0xe1a2('0x1a')](config[_0xe1a2('0x19')],{'host':_0xe1a2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1a2('0x19')]));require(_0xe1a2('0x1c'))[_0xe1a2('0x1d')](socket);function respondWithStatusCode(_0x5ac147,_0x4cf4d1){_0x4cf4d1=_0x4cf4d1||0xcc;return function(_0x499cd9){if(_0x499cd9){return _0x5ac147[_0xe1a2('0x1e')](_0x4cf4d1);}return _0x5ac147[_0xe1a2('0x1f')](_0x4cf4d1)[_0xe1a2('0x20')]();};}function respondWithResult(_0x19f642,_0x33a5cf){_0x33a5cf=_0x33a5cf||0xc8;return function(_0xd1cc51){if(_0xd1cc51){return _0x19f642[_0xe1a2('0x1f')](_0x33a5cf)['json'](_0xd1cc51);}};}function respondWithFilteredResult(_0x4fb369,_0xbf5ff4){return function(_0x340853){if(_0x340853){var _0x21d42b=typeof _0xbf5ff4[_0xe1a2('0x21')]===_0xe1a2('0x22')&&typeof _0xbf5ff4[_0xe1a2('0x23')]===_0xe1a2('0x22');var _0x20ea68=_0x340853['count'];var _0x2c7f23=_0x21d42b?0x0:_0xbf5ff4[_0xe1a2('0x21')];var _0x496027=_0x21d42b?_0x340853[_0xe1a2('0x24')]:_0xbf5ff4[_0xe1a2('0x21')]+_0xbf5ff4[_0xe1a2('0x23')];var _0x34ae71;if(_0x496027>=_0x20ea68){_0x496027=_0x20ea68;_0x34ae71=0xc8;}else{_0x34ae71=0xce;}_0x4fb369['status'](_0x34ae71);return _0x4fb369[_0xe1a2('0x25')]('Content-Range',_0x2c7f23+'-'+_0x496027+'/'+_0x20ea68)[_0xe1a2('0x26')](_0x340853);}return null;};}function patchUpdates(_0x54e300){return function(_0xb20dcc){try{jsonpatch[_0xe1a2('0x27')](_0xb20dcc,_0x54e300,!![]);}catch(_0x1c679b){return BPromise[_0xe1a2('0x28')](_0x1c679b);}return _0xb20dcc[_0xe1a2('0x29')]();};}function saveUpdates(_0x5e7ee6,_0x53addc){return function(_0x560fa1){if(_0x560fa1){return _0x560fa1[_0xe1a2('0x2a')](_0x5e7ee6)[_0xe1a2('0x2b')](function(_0x23431b){return _0x23431b;});}return null;};}function removeEntity(_0x130f21,_0x17a2f6){return function(_0x1d7608){if(_0x1d7608){return _0x1d7608['destroy']()['then'](function(){_0x130f21[_0xe1a2('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53fdb6,_0x2034ed){return function(_0x5922b7){if(!_0x5922b7){_0x53fdb6[_0xe1a2('0x1e')](0x194);}return _0x5922b7;};}function handleError(_0x13f410,_0x146a25){_0x146a25=_0x146a25||0x1f4;return function(_0xb14844){logger[_0xe1a2('0x2c')](_0xb14844[_0xe1a2('0x2d')]);if(_0xb14844[_0xe1a2('0x2e')]){delete _0xb14844[_0xe1a2('0x2e')];}_0x13f410[_0xe1a2('0x1f')](_0x146a25)[_0xe1a2('0x2f')](_0xb14844);};}exports[_0xe1a2('0x30')]=function(_0x47b86a,_0x2b0385){var _0x5601ff={},_0x393cbb={},_0x30998d={'count':0x0,'rows':[]};var _0x18403e=_[_0xe1a2('0x31')](db['ChatGroup']['rawAttributes'],function(_0x1d7b03){return{'name':_0x1d7b03[_0xe1a2('0x32')],'type':_0x1d7b03[_0xe1a2('0x33')][_0xe1a2('0x34')]};});_0x393cbb['model']=_[_0xe1a2('0x31')](_0x18403e,_0xe1a2('0x2e'));_0x393cbb[_0xe1a2('0x35')]=_[_0xe1a2('0x36')](_0x47b86a['query']);_0x393cbb[_0xe1a2('0x37')]=_['intersection'](_0x393cbb[_0xe1a2('0x38')],_0x393cbb[_0xe1a2('0x35')]);_0x5601ff[_0xe1a2('0x39')]=_[_0xe1a2('0x3a')](_0x393cbb[_0xe1a2('0x38')],qs[_0xe1a2('0x3b')](_0x47b86a[_0xe1a2('0x35')][_0xe1a2('0x3b')]));_0x5601ff[_0xe1a2('0x39')]=_0x5601ff[_0xe1a2('0x39')][_0xe1a2('0x3c')]?_0x5601ff[_0xe1a2('0x39')]:_0x393cbb[_0xe1a2('0x38')];if(!_0x47b86a[_0xe1a2('0x35')][_0xe1a2('0x3d')](_0xe1a2('0x3e'))){_0x5601ff[_0xe1a2('0x23')]=qs[_0xe1a2('0x23')](_0x47b86a[_0xe1a2('0x35')]['limit']);_0x5601ff['offset']=qs[_0xe1a2('0x21')](_0x47b86a[_0xe1a2('0x35')][_0xe1a2('0x21')]);}_0x5601ff[_0xe1a2('0x3f')]=qs[_0xe1a2('0x40')](_0x47b86a[_0xe1a2('0x35')][_0xe1a2('0x40')]);_0x5601ff['where']=qs[_0xe1a2('0x37')](_['pick'](_0x47b86a[_0xe1a2('0x35')],_0x393cbb[_0xe1a2('0x37')]),_0x18403e);if(_0x47b86a[_0xe1a2('0x35')][_0xe1a2('0x41')]){_0x5601ff[_0xe1a2('0x42')]=_[_0xe1a2('0x43')](_0x5601ff[_0xe1a2('0x42')],{'$or':_[_0xe1a2('0x31')](_0x18403e,function(_0x2b0f0f){if(_0x2b0f0f[_0xe1a2('0x33')]!=='VIRTUAL'){var _0x1e8db7={};_0x1e8db7[_0x2b0f0f[_0xe1a2('0x2e')]]={'$like':'%'+_0x47b86a[_0xe1a2('0x35')]['filter']+'%'};return _0x1e8db7;}})});}_0x5601ff=_[_0xe1a2('0x43')]({},_0x5601ff,_0x47b86a[_0xe1a2('0x44')]);var _0x41a156={'where':_0x5601ff[_0xe1a2('0x42')]};return db['ChatGroup'][_0xe1a2('0x24')](_0x41a156)[_0xe1a2('0x2b')](function(_0x302f){_0x30998d[_0xe1a2('0x24')]=_0x302f;if(_0x47b86a[_0xe1a2('0x35')][_0xe1a2('0x45')]){_0x5601ff[_0xe1a2('0x46')]=[{'all':!![]}];}return db[_0xe1a2('0x47')][_0xe1a2('0x48')](_0x5601ff);})[_0xe1a2('0x2b')](function(_0x8ed0da){_0x30998d[_0xe1a2('0x49')]=_0x8ed0da;return _0x30998d;})[_0xe1a2('0x2b')](respondWithFilteredResult(_0x2b0385,_0x5601ff))['catch'](handleError(_0x2b0385,null));};exports[_0xe1a2('0x4a')]=function(_0x292ee1,_0x5abfa5){var _0x31dd26={'raw':!![],'where':{'id':_0x292ee1['params']['id']}},_0x2dc026={};_0x2dc026[_0xe1a2('0x38')]=_[_0xe1a2('0x36')](db[_0xe1a2('0x47')][_0xe1a2('0x4b')]);_0x2dc026[_0xe1a2('0x35')]=_[_0xe1a2('0x36')](_0x292ee1[_0xe1a2('0x35')]);_0x2dc026[_0xe1a2('0x37')]=_[_0xe1a2('0x3a')](_0x2dc026['model'],_0x2dc026[_0xe1a2('0x35')]);_0x31dd26[_0xe1a2('0x39')]=_['intersection'](_0x2dc026[_0xe1a2('0x38')],qs[_0xe1a2('0x3b')](_0x292ee1['query'][_0xe1a2('0x3b')]));_0x31dd26[_0xe1a2('0x39')]=_0x31dd26['attributes']['length']?_0x31dd26['attributes']:_0x2dc026[_0xe1a2('0x38')];if(_0x292ee1[_0xe1a2('0x35')][_0xe1a2('0x45')]){_0x31dd26[_0xe1a2('0x46')]=[{'all':!![]}];}_0x31dd26=_[_0xe1a2('0x43')]({},_0x31dd26,_0x292ee1['options']);return db[_0xe1a2('0x47')][_0xe1a2('0x4c')](_0x31dd26)[_0xe1a2('0x2b')](handleEntityNotFound(_0x5abfa5,null))['then'](respondWithResult(_0x5abfa5,null))['catch'](handleError(_0x5abfa5,null));};exports[_0xe1a2('0x4d')]=function(_0x203df2,_0x50c3ed){return db[_0xe1a2('0x47')][_0xe1a2('0x4d')](_0x203df2['body'],{})[_0xe1a2('0x2b')](respondWithResult(_0x50c3ed,0xc9))[_0xe1a2('0x4e')](handleError(_0x50c3ed,null));};exports[_0xe1a2('0x2a')]=function(_0x494690,_0x4eb9ef){if(_0x494690[_0xe1a2('0x4f')]['id']){delete _0x494690['body']['id'];}return db[_0xe1a2('0x47')]['find']({'where':{'id':_0x494690[_0xe1a2('0x50')]['id']}})[_0xe1a2('0x2b')](handleEntityNotFound(_0x4eb9ef,null))[_0xe1a2('0x2b')](saveUpdates(_0x494690[_0xe1a2('0x4f')],null))[_0xe1a2('0x2b')](respondWithResult(_0x4eb9ef,null))['catch'](handleError(_0x4eb9ef,null));};exports[_0xe1a2('0x51')]=function(_0x33e501,_0x1cb45a){return db[_0xe1a2('0x47')][_0xe1a2('0x4c')]({'where':{'id':_0x33e501[_0xe1a2('0x50')]['id']}})[_0xe1a2('0x2b')](handleEntityNotFound(_0x1cb45a,null))[_0xe1a2('0x2b')](removeEntity(_0x1cb45a,null))[_0xe1a2('0x4e')](handleError(_0x1cb45a,null));};exports['describe']=function(_0x1ed659,_0x3f953e){return db[_0xe1a2('0x47')]['describe']()[_0xe1a2('0x2b')](respondWithResult(_0x3f953e,null))[_0xe1a2('0x4e')](handleError(_0x3f953e,null));};exports[_0xe1a2('0x52')]=function(_0x5cfe72,_0x1264e9,_0x3e61a9){return db[_0xe1a2('0x53')][_0xe1a2('0x24')]({'where':{'ChatGroupId':_0x5cfe72[_0xe1a2('0x50')]['id'],'ToId':_0x5cfe72[_0xe1a2('0x54')]['id'],'read':![]}})[_0xe1a2('0x2b')](function(_0x18246b){return{'id':_[_0xe1a2('0x55')](_0x5cfe72[_0xe1a2('0x50')]['id']),'count':_0x18246b};})[_0xe1a2('0x2b')](respondWithResult(_0x1264e9,null))['catch'](handleError(_0x1264e9,null));};exports[_0xe1a2('0x56')]=function(_0x4768d5,_0x50459e,_0x19ede3){return db['ChatGroup'][_0xe1a2('0x4c')]({'where':{'id':_0x4768d5[_0xe1a2('0x50')]['id']}})[_0xe1a2('0x2b')](handleEntityNotFound(_0x50459e,null))[_0xe1a2('0x2b')](function(_0x2076e0){if(_0x2076e0){return _0x2076e0['addMembers'](_0x4768d5['body']['ids'],_[_0xe1a2('0x57')](_0x4768d5[_0xe1a2('0x4f')],['ids','id'])||{});}})['then'](respondWithResult(_0x50459e,null))[_0xe1a2('0x4e')](handleError(_0x50459e,null));};exports[_0xe1a2('0x58')]=function(_0x4dcd17,_0x36a808,_0xcebe3){var _0x3a1e07={};var _0x4df061={};var _0xa4612d;var _0x5949ba;return db[_0xe1a2('0x47')][_0xe1a2('0x59')]({'where':{'id':_0x4dcd17[_0xe1a2('0x50')]['id']}})[_0xe1a2('0x2b')](handleEntityNotFound(_0x36a808,null))[_0xe1a2('0x2b')](function(_0x270b83){if(_0x270b83){_0xa4612d=_0x270b83;_0x4df061[_0xe1a2('0x38')]=_[_0xe1a2('0x36')](db[_0xe1a2('0x5a')][_0xe1a2('0x4b')]);_0x4df061[_0xe1a2('0x35')]=_[_0xe1a2('0x36')](_0x4dcd17[_0xe1a2('0x35')]);_0x4df061[_0xe1a2('0x37')]=_['intersection'](_0x4df061['model'],_0x4df061[_0xe1a2('0x35')]);_0x3a1e07[_0xe1a2('0x39')]=_['intersection'](_0x4df061['model'],qs['fields'](_0x4dcd17['query'][_0xe1a2('0x3b')]));_0x3a1e07['attributes']=_0x3a1e07[_0xe1a2('0x39')][_0xe1a2('0x3c')]?_0x3a1e07[_0xe1a2('0x39')]:_0x4df061[_0xe1a2('0x38')];_0x3a1e07[_0xe1a2('0x3f')]=qs[_0xe1a2('0x40')](_0x4dcd17['query'][_0xe1a2('0x40')]);_0x3a1e07[_0xe1a2('0x42')]=qs[_0xe1a2('0x37')](_[_0xe1a2('0x5b')](_0x4dcd17[_0xe1a2('0x35')],_0x4df061[_0xe1a2('0x37')]));if(_0x4dcd17[_0xe1a2('0x35')][_0xe1a2('0x41')]){_0x3a1e07[_0xe1a2('0x42')]=_[_0xe1a2('0x43')](_0x3a1e07[_0xe1a2('0x42')],{'$or':_[_0xe1a2('0x31')](_0x3a1e07[_0xe1a2('0x39')],function(_0x1ff9ff){var _0x5c1505={};_0x5c1505[_0x1ff9ff]={'$like':'%'+_0x4dcd17[_0xe1a2('0x35')][_0xe1a2('0x41')]+'%'};return _0x5c1505;})});}_0x3a1e07=_[_0xe1a2('0x43')]({},_0x3a1e07,_0x4dcd17['options']);return _0xa4612d['getMembers'](_0x3a1e07);}})[_0xe1a2('0x2b')](function(_0x336ac7){if(_0x336ac7){_0x5949ba=_0x336ac7['length'];if(!_0x4dcd17[_0xe1a2('0x35')][_0xe1a2('0x3d')](_0xe1a2('0x3e'))){_0x3a1e07['limit']=qs[_0xe1a2('0x23')](_0x4dcd17[_0xe1a2('0x35')][_0xe1a2('0x23')]);_0x3a1e07[_0xe1a2('0x21')]=qs[_0xe1a2('0x21')](_0x4dcd17[_0xe1a2('0x35')][_0xe1a2('0x21')]);}return _0xa4612d[_0xe1a2('0x58')](_0x3a1e07);}})[_0xe1a2('0x2b')](function(_0x3c95d9){if(_0x3c95d9){return _0x3c95d9?{'count':_0x5949ba,'rows':_0x3c95d9}:null;}})[_0xe1a2('0x2b')](respondWithResult(_0x36a808,null))[_0xe1a2('0x4e')](handleError(_0x36a808,null));};exports[_0xe1a2('0x5c')]=function(_0x55e162,_0xdbdfbd,_0x342350){return db[_0xe1a2('0x47')][_0xe1a2('0x4c')]({'where':{'id':_0x55e162[_0xe1a2('0x50')]['id']}})[_0xe1a2('0x2b')](handleEntityNotFound(_0xdbdfbd,null))[_0xe1a2('0x2b')](function(_0xd0fcf1){if(_0xd0fcf1){return _0xd0fcf1[_0xe1a2('0x5c')](_0x55e162[_0xe1a2('0x35')]['ids']);}})[_0xe1a2('0x2b')](respondWithStatusCode(_0xdbdfbd,null))[_0xe1a2('0x4e')](handleError(_0xdbdfbd,null));};exports[_0xe1a2('0x5d')]=function(_0x1cdc4d,_0x22282a,_0x4a0ff6){if(_0x1cdc4d[_0xe1a2('0x4f')]['id']){delete _0x1cdc4d[_0xe1a2('0x4f')]['id'];}return db[_0xe1a2('0x47')]['find']({'where':{'id':_0x1cdc4d[_0xe1a2('0x50')]['id']}})[_0xe1a2('0x2b')](handleEntityNotFound(_0x22282a,null))['then'](function(_0x3cadf3){if(_0x3cadf3){_0x1cdc4d['body'][_0xe1a2('0x5e')]=_0x3cadf3['id'];return db[_0xe1a2('0x53')]['create'](_0x1cdc4d[_0xe1a2('0x4f')]);}})[_0xe1a2('0x2b')](respondWithResult(_0x22282a,null))[_0xe1a2('0x4e')](handleError(_0x22282a,null));};exports[_0xe1a2('0x5f')]=function(_0x240be3,_0x5d1021,_0x53107f){var _0x4b00b7={};var _0xc98fbe={};var _0x57d502;var _0x2246ac;return db[_0xe1a2('0x47')]['findOne']({'where':{'id':_0x240be3[_0xe1a2('0x50')]['id']}})['then'](handleEntityNotFound(_0x5d1021,null))[_0xe1a2('0x2b')](function(_0xabf1d3){if(_0xabf1d3){_0x57d502=_0xabf1d3;_0xc98fbe[_0xe1a2('0x38')]=_[_0xe1a2('0x36')](db[_0xe1a2('0x53')][_0xe1a2('0x4b')]);_0xc98fbe[_0xe1a2('0x35')]=_[_0xe1a2('0x36')](_0x240be3[_0xe1a2('0x35')]);_0xc98fbe[_0xe1a2('0x37')]=_['intersection'](_0xc98fbe['model'],_0xc98fbe[_0xe1a2('0x35')]);_0x4b00b7[_0xe1a2('0x39')]=_['intersection'](_0xc98fbe[_0xe1a2('0x38')],qs[_0xe1a2('0x3b')](_0x240be3[_0xe1a2('0x35')][_0xe1a2('0x3b')]));_0x4b00b7[_0xe1a2('0x39')]=_0x4b00b7['attributes']['length']?_0x4b00b7['attributes']:_0xc98fbe[_0xe1a2('0x38')];_0x4b00b7[_0xe1a2('0x3f')]=qs[_0xe1a2('0x40')](_0x240be3['query'][_0xe1a2('0x40')]);_0x4b00b7[_0xe1a2('0x42')]=qs[_0xe1a2('0x37')](_[_0xe1a2('0x5b')](_0x240be3['query'],_0xc98fbe[_0xe1a2('0x37')]));if(_0x240be3[_0xe1a2('0x35')][_0xe1a2('0x41')]){_0x4b00b7[_0xe1a2('0x42')]=_[_0xe1a2('0x43')](_0x4b00b7[_0xe1a2('0x42')],{'$or':_[_0xe1a2('0x31')](_0x4b00b7[_0xe1a2('0x39')],function(_0x5c2824){var _0x28d504={};_0x28d504[_0x5c2824]={'$like':'%'+_0x240be3[_0xe1a2('0x35')][_0xe1a2('0x41')]+'%'};return _0x28d504;})});}if(_0x240be3['query']['$gte']){var _0x3d0da1=_0x240be3[_0xe1a2('0x35')][_0xe1a2('0x60')][_0xe1a2('0x61')](',');var _0x26c8fa={};_0x26c8fa[_0x3d0da1[0x0]]={'$gte':moment(_0x3d0da1[0x1])[_0xe1a2('0x62')](_0xe1a2('0x63'))};_0x4b00b7[_0xe1a2('0x42')]=_[_0xe1a2('0x43')](_0x4b00b7['where'],_0x26c8fa);}_0x4b00b7=_['merge']({},_0x4b00b7,_0x240be3[_0xe1a2('0x44')]);return _0x57d502[_0xe1a2('0x5f')](_0x4b00b7);}})[_0xe1a2('0x2b')](function(_0x2609e9){if(_0x2609e9){_0x2246ac=_0x2609e9[_0xe1a2('0x3c')];if(!_0x240be3[_0xe1a2('0x35')][_0xe1a2('0x3d')](_0xe1a2('0x3e'))){_0x4b00b7['limit']=qs[_0xe1a2('0x23')](_0x240be3[_0xe1a2('0x35')][_0xe1a2('0x23')]);_0x4b00b7[_0xe1a2('0x21')]=qs[_0xe1a2('0x21')](_0x240be3['query'][_0xe1a2('0x21')]);}return _0x57d502[_0xe1a2('0x5f')](_0x4b00b7);}})[_0xe1a2('0x2b')](function(_0x276797){if(_0x276797){return _0x276797?{'count':_0x2246ac,'rows':_0x276797}:null;}})[_0xe1a2('0x2b')](respondWithResult(_0x5d1021,null))[_0xe1a2('0x4e')](handleError(_0x5d1021,null));}; \ No newline at end of file +var _0xc277=['send','index','ChatGroup','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','rows','show','params','includeAll','find','catch','create','body','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','User','pick','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error'];(function(_0x253c18,_0x405d0a){var _0xe2752b=function(_0xc0c166){while(--_0xc0c166){_0x253c18['push'](_0x253c18['shift']());}};_0xe2752b(++_0x405d0a);}(_0xc277,0x1b9));var _0x7c27=function(_0x4c1f7b,_0x312d83){_0x4c1f7b=_0x4c1f7b-0x0;var _0x1a0ead=_0xc277[_0x4c1f7b];return _0x1a0ead;};'use strict';var emlformat=require(_0x7c27('0x0'));var rimraf=require(_0x7c27('0x1'));var zipdir=require(_0x7c27('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c27('0x3'));var moment=require('moment');var BPromise=require(_0x7c27('0x4'));var Mustache=require(_0x7c27('0x5'));var util=require(_0x7c27('0x6'));var path=require(_0x7c27('0x7'));var sox=require('sox');var csv=require(_0x7c27('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c27('0x9'));var _=require(_0x7c27('0xa'));var squel=require('squel');var crypto=require(_0x7c27('0xb'));var jsforce=require(_0x7c27('0xc'));var deskjs=require(_0x7c27('0xd'));var toCsv=require(_0x7c27('0x8'));var querystring=require('querystring');var Papa=require(_0x7c27('0xe'));var Redis=require('ioredis');var authService=require(_0x7c27('0xf'));var qs=require(_0x7c27('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c27('0x11'));var logger=require(_0x7c27('0x12'))(_0x7c27('0x13'));var utils=require(_0x7c27('0x14'));var config=require(_0x7c27('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7c27('0x16')]=_['defaults'](config[_0x7c27('0x16')],{'host':_0x7c27('0x17'),'port':0x18eb});var socket=require(_0x7c27('0x18'))(new Redis(config[_0x7c27('0x16')]));require(_0x7c27('0x19'))[_0x7c27('0x1a')](socket);function respondWithStatusCode(_0x559e8d,_0x1fcc4c){_0x1fcc4c=_0x1fcc4c||0xcc;return function(_0x53cf31){if(_0x53cf31){return _0x559e8d['sendStatus'](_0x1fcc4c);}return _0x559e8d[_0x7c27('0x1b')](_0x1fcc4c)[_0x7c27('0x1c')]();};}function respondWithResult(_0x4f7e9c,_0x276363){_0x276363=_0x276363||0xc8;return function(_0x492888){if(_0x492888){return _0x4f7e9c[_0x7c27('0x1b')](_0x276363)[_0x7c27('0x1d')](_0x492888);}};}function respondWithFilteredResult(_0x2dd073,_0x5d41c3){return function(_0x5f7eda){if(_0x5f7eda){var _0x454ea9=typeof _0x5d41c3[_0x7c27('0x1e')]==='undefined'&&typeof _0x5d41c3[_0x7c27('0x1f')]===_0x7c27('0x20');var _0xd9a4e9=_0x5f7eda['count'];var _0x29e33c=_0x454ea9?0x0:_0x5d41c3['offset'];var _0x2f9943=_0x454ea9?_0x5f7eda[_0x7c27('0x21')]:_0x5d41c3[_0x7c27('0x1e')]+_0x5d41c3[_0x7c27('0x1f')];var _0x3dcd37;if(_0x2f9943>=_0xd9a4e9){_0x2f9943=_0xd9a4e9;_0x3dcd37=0xc8;}else{_0x3dcd37=0xce;}_0x2dd073[_0x7c27('0x1b')](_0x3dcd37);return _0x2dd073[_0x7c27('0x22')](_0x7c27('0x23'),_0x29e33c+'-'+_0x2f9943+'/'+_0xd9a4e9)['json'](_0x5f7eda);}return null;};}function patchUpdates(_0x1feef8){return function(_0x41f9cc){try{jsonpatch[_0x7c27('0x24')](_0x41f9cc,_0x1feef8,!![]);}catch(_0x5c5bc9){return BPromise[_0x7c27('0x25')](_0x5c5bc9);}return _0x41f9cc[_0x7c27('0x26')]();};}function saveUpdates(_0x3bf5c5,_0x56955a){return function(_0x5651ea){if(_0x5651ea){return _0x5651ea[_0x7c27('0x27')](_0x3bf5c5)[_0x7c27('0x28')](function(_0x1ede25){return _0x1ede25;});}return null;};}function removeEntity(_0x1d8b03,_0x37d215){return function(_0x5bbde0){if(_0x5bbde0){return _0x5bbde0[_0x7c27('0x29')]()['then'](function(){_0x1d8b03[_0x7c27('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x298d7a,_0x219935){return function(_0x19c452){if(!_0x19c452){_0x298d7a[_0x7c27('0x2a')](0x194);}return _0x19c452;};}function handleError(_0x509825,_0x5eb260){_0x5eb260=_0x5eb260||0x1f4;return function(_0x24d0d9){logger[_0x7c27('0x2b')](_0x24d0d9['stack']);if(_0x24d0d9['name']){delete _0x24d0d9['name'];}_0x509825[_0x7c27('0x1b')](_0x5eb260)[_0x7c27('0x2c')](_0x24d0d9);};}exports[_0x7c27('0x2d')]=function(_0x5f1d02,_0x9b7e3f){var _0x5941a0={},_0x126143={},_0x25ca1e={'count':0x0,'rows':[]};var _0x37dc5f=_['map'](db[_0x7c27('0x2e')][_0x7c27('0x2f')],function(_0x2a88ca){return{'name':_0x2a88ca[_0x7c27('0x30')],'type':_0x2a88ca[_0x7c27('0x31')][_0x7c27('0x32')]};});_0x126143[_0x7c27('0x33')]=_[_0x7c27('0x34')](_0x37dc5f,_0x7c27('0x35'));_0x126143[_0x7c27('0x36')]=_[_0x7c27('0x37')](_0x5f1d02[_0x7c27('0x36')]);_0x126143[_0x7c27('0x38')]=_[_0x7c27('0x39')](_0x126143[_0x7c27('0x33')],_0x126143[_0x7c27('0x36')]);_0x5941a0['attributes']=_[_0x7c27('0x39')](_0x126143['model'],qs[_0x7c27('0x3a')](_0x5f1d02[_0x7c27('0x36')][_0x7c27('0x3a')]));_0x5941a0[_0x7c27('0x3b')]=_0x5941a0[_0x7c27('0x3b')][_0x7c27('0x3c')]?_0x5941a0[_0x7c27('0x3b')]:_0x126143[_0x7c27('0x33')];if(!_0x5f1d02['query']['hasOwnProperty'](_0x7c27('0x3d'))){_0x5941a0[_0x7c27('0x1f')]=qs[_0x7c27('0x1f')](_0x5f1d02['query'][_0x7c27('0x1f')]);_0x5941a0[_0x7c27('0x1e')]=qs['offset'](_0x5f1d02[_0x7c27('0x36')]['offset']);}_0x5941a0[_0x7c27('0x3e')]=qs[_0x7c27('0x3f')](_0x5f1d02[_0x7c27('0x36')][_0x7c27('0x3f')]);_0x5941a0[_0x7c27('0x40')]=qs[_0x7c27('0x38')](_['pick'](_0x5f1d02[_0x7c27('0x36')],_0x126143[_0x7c27('0x38')]),_0x37dc5f);if(_0x5f1d02[_0x7c27('0x36')][_0x7c27('0x41')]){_0x5941a0['where']=_[_0x7c27('0x42')](_0x5941a0[_0x7c27('0x40')],{'$or':_[_0x7c27('0x34')](_0x37dc5f,function(_0x143e74){if(_0x143e74[_0x7c27('0x31')]!==_0x7c27('0x43')){var _0x4982fe={};_0x4982fe[_0x143e74[_0x7c27('0x35')]]={'$like':'%'+_0x5f1d02['query'][_0x7c27('0x41')]+'%'};return _0x4982fe;}})});}_0x5941a0=_[_0x7c27('0x42')]({},_0x5941a0,_0x5f1d02[_0x7c27('0x44')]);var _0x217e05={'where':_0x5941a0[_0x7c27('0x40')]};return db[_0x7c27('0x2e')][_0x7c27('0x21')](_0x217e05)[_0x7c27('0x28')](function(_0x37ac66){_0x25ca1e[_0x7c27('0x21')]=_0x37ac66;if(_0x5f1d02[_0x7c27('0x36')]['includeAll']){_0x5941a0['include']=[{'all':!![]}];}return db[_0x7c27('0x2e')]['findAll'](_0x5941a0);})['then'](function(_0x3885bc){_0x25ca1e[_0x7c27('0x45')]=_0x3885bc;return _0x25ca1e;})[_0x7c27('0x28')](respondWithFilteredResult(_0x9b7e3f,_0x5941a0))['catch'](handleError(_0x9b7e3f,null));};exports[_0x7c27('0x46')]=function(_0x1a1a79,_0x589fd4){var _0x41cac6={'raw':!![],'where':{'id':_0x1a1a79[_0x7c27('0x47')]['id']}},_0x3528fe={};_0x3528fe[_0x7c27('0x33')]=_[_0x7c27('0x37')](db['ChatGroup'][_0x7c27('0x2f')]);_0x3528fe['query']=_['keys'](_0x1a1a79[_0x7c27('0x36')]);_0x3528fe['filters']=_[_0x7c27('0x39')](_0x3528fe[_0x7c27('0x33')],_0x3528fe[_0x7c27('0x36')]);_0x41cac6[_0x7c27('0x3b')]=_['intersection'](_0x3528fe[_0x7c27('0x33')],qs['fields'](_0x1a1a79[_0x7c27('0x36')][_0x7c27('0x3a')]));_0x41cac6['attributes']=_0x41cac6['attributes'][_0x7c27('0x3c')]?_0x41cac6[_0x7c27('0x3b')]:_0x3528fe['model'];if(_0x1a1a79[_0x7c27('0x36')][_0x7c27('0x48')]){_0x41cac6['include']=[{'all':!![]}];}_0x41cac6=_[_0x7c27('0x42')]({},_0x41cac6,_0x1a1a79[_0x7c27('0x44')]);return db[_0x7c27('0x2e')][_0x7c27('0x49')](_0x41cac6)[_0x7c27('0x28')](handleEntityNotFound(_0x589fd4,null))[_0x7c27('0x28')](respondWithResult(_0x589fd4,null))[_0x7c27('0x4a')](handleError(_0x589fd4,null));};exports['create']=function(_0x111117,_0x4cbe47){return db['ChatGroup'][_0x7c27('0x4b')](_0x111117[_0x7c27('0x4c')],{})[_0x7c27('0x28')](respondWithResult(_0x4cbe47,0xc9))['catch'](handleError(_0x4cbe47,null));};exports[_0x7c27('0x27')]=function(_0x462c48,_0x16e150){if(_0x462c48[_0x7c27('0x4c')]['id']){delete _0x462c48[_0x7c27('0x4c')]['id'];}return db[_0x7c27('0x2e')][_0x7c27('0x49')]({'where':{'id':_0x462c48[_0x7c27('0x47')]['id']}})[_0x7c27('0x28')](handleEntityNotFound(_0x16e150,null))[_0x7c27('0x28')](saveUpdates(_0x462c48[_0x7c27('0x4c')],null))[_0x7c27('0x28')](respondWithResult(_0x16e150,null))['catch'](handleError(_0x16e150,null));};exports['destroy']=function(_0x2a3299,_0xa5ebfd){return db['ChatGroup'][_0x7c27('0x49')]({'where':{'id':_0x2a3299['params']['id']}})[_0x7c27('0x28')](handleEntityNotFound(_0xa5ebfd,null))['then'](removeEntity(_0xa5ebfd,null))[_0x7c27('0x4a')](handleError(_0xa5ebfd,null));};exports['describe']=function(_0x1ab399,_0x4105b1){return db[_0x7c27('0x2e')]['describe']()[_0x7c27('0x28')](respondWithResult(_0x4105b1,null))[_0x7c27('0x4a')](handleError(_0x4105b1,null));};exports[_0x7c27('0x4d')]=function(_0x48b66d,_0x4a9424,_0x43651d){return db[_0x7c27('0x4e')][_0x7c27('0x21')]({'where':{'ChatGroupId':_0x48b66d[_0x7c27('0x47')]['id'],'ToId':_0x48b66d[_0x7c27('0x4f')]['id'],'read':![]}})['then'](function(_0x4ec4c3){return{'id':_[_0x7c27('0x50')](_0x48b66d[_0x7c27('0x47')]['id']),'count':_0x4ec4c3};})[_0x7c27('0x28')](respondWithResult(_0x4a9424,null))[_0x7c27('0x4a')](handleError(_0x4a9424,null));};exports[_0x7c27('0x51')]=function(_0xbeecac,_0x18dd50,_0x165910){return db[_0x7c27('0x2e')][_0x7c27('0x49')]({'where':{'id':_0xbeecac[_0x7c27('0x47')]['id']}})[_0x7c27('0x28')](handleEntityNotFound(_0x18dd50,null))[_0x7c27('0x28')](function(_0x55e65a){if(_0x55e65a){return _0x55e65a[_0x7c27('0x51')](_0xbeecac[_0x7c27('0x4c')]['ids'],_[_0x7c27('0x52')](_0xbeecac[_0x7c27('0x4c')],[_0x7c27('0x53'),'id'])||{});}})[_0x7c27('0x28')](respondWithResult(_0x18dd50,null))[_0x7c27('0x4a')](handleError(_0x18dd50,null));};exports[_0x7c27('0x54')]=function(_0xcebf5b,_0x552a2d,_0x37c8c6){var _0x1ef71b={};var _0x5c2624={};var _0x40f43e;var _0x269541;return db[_0x7c27('0x2e')]['findOne']({'where':{'id':_0xcebf5b['params']['id']}})[_0x7c27('0x28')](handleEntityNotFound(_0x552a2d,null))[_0x7c27('0x28')](function(_0x26201c){if(_0x26201c){_0x40f43e=_0x26201c;_0x5c2624['model']=_[_0x7c27('0x37')](db[_0x7c27('0x55')][_0x7c27('0x2f')]);_0x5c2624[_0x7c27('0x36')]=_[_0x7c27('0x37')](_0xcebf5b[_0x7c27('0x36')]);_0x5c2624['filters']=_['intersection'](_0x5c2624[_0x7c27('0x33')],_0x5c2624['query']);_0x1ef71b[_0x7c27('0x3b')]=_[_0x7c27('0x39')](_0x5c2624[_0x7c27('0x33')],qs['fields'](_0xcebf5b[_0x7c27('0x36')][_0x7c27('0x3a')]));_0x1ef71b['attributes']=_0x1ef71b[_0x7c27('0x3b')][_0x7c27('0x3c')]?_0x1ef71b[_0x7c27('0x3b')]:_0x5c2624[_0x7c27('0x33')];_0x1ef71b['order']=qs['sort'](_0xcebf5b['query'][_0x7c27('0x3f')]);_0x1ef71b['where']=qs['filters'](_[_0x7c27('0x56')](_0xcebf5b['query'],_0x5c2624[_0x7c27('0x38')]));if(_0xcebf5b['query'][_0x7c27('0x41')]){_0x1ef71b[_0x7c27('0x40')]=_[_0x7c27('0x42')](_0x1ef71b[_0x7c27('0x40')],{'$or':_[_0x7c27('0x34')](_0x1ef71b[_0x7c27('0x3b')],function(_0x108f98){var _0x203df2={};_0x203df2[_0x108f98]={'$like':'%'+_0xcebf5b[_0x7c27('0x36')][_0x7c27('0x41')]+'%'};return _0x203df2;})});}_0x1ef71b=_['merge']({},_0x1ef71b,_0xcebf5b['options']);return _0x40f43e[_0x7c27('0x54')](_0x1ef71b);}})[_0x7c27('0x28')](function(_0x47c4b0){if(_0x47c4b0){_0x269541=_0x47c4b0[_0x7c27('0x3c')];if(!_0xcebf5b[_0x7c27('0x36')][_0x7c27('0x57')](_0x7c27('0x3d'))){_0x1ef71b[_0x7c27('0x1f')]=qs[_0x7c27('0x1f')](_0xcebf5b[_0x7c27('0x36')][_0x7c27('0x1f')]);_0x1ef71b[_0x7c27('0x1e')]=qs['offset'](_0xcebf5b['query'][_0x7c27('0x1e')]);}return _0x40f43e[_0x7c27('0x54')](_0x1ef71b);}})[_0x7c27('0x28')](function(_0x22d718){if(_0x22d718){return _0x22d718?{'count':_0x269541,'rows':_0x22d718}:null;}})[_0x7c27('0x28')](respondWithResult(_0x552a2d,null))['catch'](handleError(_0x552a2d,null));};exports[_0x7c27('0x58')]=function(_0x17a50f,_0x1c9f62,_0x423134){return db[_0x7c27('0x2e')][_0x7c27('0x49')]({'where':{'id':_0x17a50f[_0x7c27('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c9f62,null))[_0x7c27('0x28')](function(_0x11b120){if(_0x11b120){return _0x11b120[_0x7c27('0x58')](_0x17a50f[_0x7c27('0x36')][_0x7c27('0x53')]);}})['then'](respondWithStatusCode(_0x1c9f62,null))[_0x7c27('0x4a')](handleError(_0x1c9f62,null));};exports[_0x7c27('0x59')]=function(_0x3fe3ea,_0x10e081,_0x3921b3){if(_0x3fe3ea[_0x7c27('0x4c')]['id']){delete _0x3fe3ea[_0x7c27('0x4c')]['id'];}return db[_0x7c27('0x2e')]['find']({'where':{'id':_0x3fe3ea[_0x7c27('0x47')]['id']}})[_0x7c27('0x28')](handleEntityNotFound(_0x10e081,null))[_0x7c27('0x28')](function(_0x2c6c60){if(_0x2c6c60){_0x3fe3ea[_0x7c27('0x4c')][_0x7c27('0x5a')]=_0x2c6c60['id'];return db[_0x7c27('0x4e')][_0x7c27('0x4b')](_0x3fe3ea[_0x7c27('0x4c')]);}})[_0x7c27('0x28')](respondWithResult(_0x10e081,null))[_0x7c27('0x4a')](handleError(_0x10e081,null));};exports[_0x7c27('0x5b')]=function(_0x16c65c,_0x15d3dd,_0x50b147){var _0x56aa6c={};var _0xfcc6fa={};var _0x38c786;var _0x2e5827;return db['ChatGroup'][_0x7c27('0x5c')]({'where':{'id':_0x16c65c[_0x7c27('0x47')]['id']}})[_0x7c27('0x28')](handleEntityNotFound(_0x15d3dd,null))[_0x7c27('0x28')](function(_0x4ab432){if(_0x4ab432){_0x38c786=_0x4ab432;_0xfcc6fa[_0x7c27('0x33')]=_[_0x7c27('0x37')](db['ChatInternalMessage'][_0x7c27('0x2f')]);_0xfcc6fa['query']=_[_0x7c27('0x37')](_0x16c65c[_0x7c27('0x36')]);_0xfcc6fa[_0x7c27('0x38')]=_[_0x7c27('0x39')](_0xfcc6fa[_0x7c27('0x33')],_0xfcc6fa['query']);_0x56aa6c[_0x7c27('0x3b')]=_[_0x7c27('0x39')](_0xfcc6fa[_0x7c27('0x33')],qs[_0x7c27('0x3a')](_0x16c65c[_0x7c27('0x36')][_0x7c27('0x3a')]));_0x56aa6c[_0x7c27('0x3b')]=_0x56aa6c[_0x7c27('0x3b')][_0x7c27('0x3c')]?_0x56aa6c['attributes']:_0xfcc6fa['model'];_0x56aa6c['order']=qs['sort'](_0x16c65c['query'][_0x7c27('0x3f')]);_0x56aa6c[_0x7c27('0x40')]=qs[_0x7c27('0x38')](_['pick'](_0x16c65c['query'],_0xfcc6fa['filters']));if(_0x16c65c['query']['filter']){_0x56aa6c['where']=_[_0x7c27('0x42')](_0x56aa6c['where'],{'$or':_[_0x7c27('0x34')](_0x56aa6c['attributes'],function(_0x263e36){var _0x437f27={};_0x437f27[_0x263e36]={'$like':'%'+_0x16c65c[_0x7c27('0x36')][_0x7c27('0x41')]+'%'};return _0x437f27;})});}if(_0x16c65c[_0x7c27('0x36')][_0x7c27('0x5d')]){var _0x6ed7f5=_0x16c65c[_0x7c27('0x36')][_0x7c27('0x5d')][_0x7c27('0x5e')](',');var _0x3bc2bd={};_0x3bc2bd[_0x6ed7f5[0x0]]={'$gte':moment(_0x6ed7f5[0x1])[_0x7c27('0x5f')](_0x7c27('0x60'))};_0x56aa6c[_0x7c27('0x40')]=_[_0x7c27('0x42')](_0x56aa6c[_0x7c27('0x40')],_0x3bc2bd);}_0x56aa6c=_[_0x7c27('0x42')]({},_0x56aa6c,_0x16c65c[_0x7c27('0x44')]);return _0x38c786['getMessages'](_0x56aa6c);}})[_0x7c27('0x28')](function(_0x43eeec){if(_0x43eeec){_0x2e5827=_0x43eeec[_0x7c27('0x3c')];if(!_0x16c65c[_0x7c27('0x36')]['hasOwnProperty']('nolimit')){_0x56aa6c[_0x7c27('0x1f')]=qs[_0x7c27('0x1f')](_0x16c65c[_0x7c27('0x36')][_0x7c27('0x1f')]);_0x56aa6c[_0x7c27('0x1e')]=qs[_0x7c27('0x1e')](_0x16c65c[_0x7c27('0x36')][_0x7c27('0x1e')]);}return _0x38c786[_0x7c27('0x5b')](_0x56aa6c);}})[_0x7c27('0x28')](function(_0x9a6299){if(_0x9a6299){return _0x9a6299?{'count':_0x2e5827,'rows':_0x9a6299}:null;}})[_0x7c27('0x28')](respondWithResult(_0x15d3dd,null))[_0x7c27('0x4a')](handleError(_0x15d3dd,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index bed7fc6..9021ba0 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 _0xb5bf=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','save','remove','emit'];(function(_0x444c84,_0x4f2b54){var _0x5c1fc5=function(_0x45636b){while(--_0x45636b){_0x444c84['push'](_0x444c84['shift']());}};_0x5c1fc5(++_0x4f2b54);}(_0xb5bf,0x1d7));var _0xfb5b=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xb5bf[_0x9c2427];return _0x51984f;};'use strict';var EventEmitter=require(_0xfb5b('0x0'));var ChatGroup=require(_0xfb5b('0x1'))['db'][_0xfb5b('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfb5b('0x3'),'afterUpdate':'update','afterDestroy':_0xfb5b('0x4')};function emitEvent(_0x315c48){return function(_0x2e8dd6,_0x72f94d,_0x23dfaf){ChatGroupEvents[_0xfb5b('0x5')](_0x315c48+':'+_0x2e8dd6['id'],_0x2e8dd6);ChatGroupEvents['emit'](_0x315c48,_0x2e8dd6);_0x23dfaf(null);};}for(var e in events){if(events[_0xfb5b('0x6')](e)){var event=events[e];ChatGroup[_0xfb5b('0x7')](e,emitEvent(event));}}module[_0xfb5b('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xc5e4=['ChatGroup','save','update','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x2d06b1,_0x3aef78){var _0x40532d=function(_0x262c1a){while(--_0x262c1a){_0x2d06b1['push'](_0x2d06b1['shift']());}};_0x40532d(++_0x3aef78);}(_0xc5e4,0x117));var _0x4c5e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc5e4[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x4c5e('0x0'))['db'][_0x4c5e('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4c5e('0x2'),'afterUpdate':_0x4c5e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1197ab){return function(_0xbf9f24,_0x202246,_0x45cfd9){ChatGroupEvents[_0x4c5e('0x4')](_0x1197ab+':'+_0xbf9f24['id'],_0xbf9f24);ChatGroupEvents[_0x4c5e('0x4')](_0x1197ab,_0xbf9f24);_0x45cfd9(null);};}for(var e in events){if(events[_0x4c5e('0x5')](e)){var event=events[e];ChatGroup[_0x4c5e('0x6')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 13de016..9462000 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 _0x8b76=['./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b76,0x1c0));var _0x68b7=function(_0x398306,_0x560fd1){_0x398306=_0x398306-0x0;var _0x42644b=_0x8b76[_0x398306];return _0x42644b;};'use strict';var _=require(_0x68b7('0x0'));var util=require('util');var logger=require(_0x68b7('0x1'))(_0x68b7('0x2'));var moment=require(_0x68b7('0x3'));var BPromise=require(_0x68b7('0x4'));var rp=require(_0x68b7('0x5'));var fs=require('fs');var path=require(_0x68b7('0x6'));var rimraf=require('rimraf');var config=require(_0x68b7('0x7'));var attributes=require(_0x68b7('0x8'));module['exports']=function(_0x421c31,_0x175961){return _0x421c31[_0x68b7('0x9')](_0x68b7('0xa'),attributes,{'tableName':_0x68b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc587=['define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports'];(function(_0x3ed86a,_0x2e6a73){var _0x5a71f1=function(_0x47f9e5){while(--_0x47f9e5){_0x3ed86a['push'](_0x3ed86a['shift']());}};_0x5a71f1(++_0x2e6a73);}(_0xc587,0x129));var _0x7c58=function(_0x1865ff,_0x34ab23){_0x1865ff=_0x1865ff-0x0;var _0x493d64=_0xc587[_0x1865ff];return _0x493d64;};'use strict';var _=require(_0x7c58('0x0'));var util=require(_0x7c58('0x1'));var logger=require(_0x7c58('0x2'))(_0x7c58('0x3'));var moment=require(_0x7c58('0x4'));var BPromise=require(_0x7c58('0x5'));var rp=require(_0x7c58('0x6'));var fs=require('fs');var path=require(_0x7c58('0x7'));var rimraf=require(_0x7c58('0x8'));var config=require('../../config/environment');var attributes=require(_0x7c58('0x9'));module[_0x7c58('0xa')]=function(_0x6c954,_0x2581fd){return _0x6c954[_0x7c58('0xb')](_0x7c58('0xc'),attributes,{'tableName':_0x7c58('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 fc33b4c..9ea74a9 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 _0xaf3e=['util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','catch','lodash'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xaf3e,0xcf));var _0xeaf3=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0xaf3e[_0x4defd6];return _0x4c9276;};'use strict';var _=require(_0xeaf3('0x0'));var util=require(_0xeaf3('0x1'));var moment=require('moment');var BPromise=require(_0xeaf3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeaf3('0x3'));var db=require(_0xeaf3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeaf3('0x5'))(_0xeaf3('0x6'));var config=require(_0xeaf3('0x7'));var jayson=require(_0xeaf3('0x8'));var client=jayson[_0xeaf3('0x9')]['http']({'port':0x232a});config[_0xeaf3('0xa')]=_[_0xeaf3('0xb')](config[_0xeaf3('0xa')],{'host':_0xeaf3('0xc'),'port':0x18eb});var socket=require(_0xeaf3('0xd'))(new Redis(config[_0xeaf3('0xa')]));require('./chatGroup.socket')[_0xeaf3('0xe')](socket);function respondWithRpcPromise(_0x48bcf7,_0x5eb9d,_0x37a947){return new BPromise(function(_0xc0a479,_0x5c21aa){return client[_0xeaf3('0xf')](_0x48bcf7,_0x37a947)[_0xeaf3('0x10')](function(_0x596ea8){logger[_0xeaf3('0x11')]('ChatGroup,\x20%s,\x20%s',_0x5eb9d,_0xeaf3('0x12'));logger[_0xeaf3('0x13')](_0xeaf3('0x14'),_0x5eb9d,_0xeaf3('0x12'),JSON['stringify'](_0x596ea8));if(_0x596ea8[_0xeaf3('0x15')]){if(_0x596ea8[_0xeaf3('0x15')][_0xeaf3('0x16')]===0x1f4){logger[_0xeaf3('0x15')]('ChatGroup,\x20%s,\x20%s',_0x5eb9d,_0x596ea8[_0xeaf3('0x15')]['message']);return _0x5c21aa(_0x596ea8[_0xeaf3('0x15')]['message']);}logger['error'](_0xeaf3('0x17'),_0x5eb9d,_0x596ea8[_0xeaf3('0x15')][_0xeaf3('0x18')]);return _0xc0a479(_0x596ea8[_0xeaf3('0x15')][_0xeaf3('0x18')]);}else{logger[_0xeaf3('0x11')]('ChatGroup,\x20%s,\x20%s',_0x5eb9d,_0xeaf3('0x12'));_0xc0a479(_0x596ea8['result'][_0xeaf3('0x18')]);}})[_0xeaf3('0x19')](function(_0x48e609){logger[_0xeaf3('0x15')](_0xeaf3('0x17'),_0x5eb9d,_0x48e609);_0x5c21aa(_0x48e609);});});} \ No newline at end of file +var _0x22d3=['stringify','error','message','result','catch','ChatGroup,\x20%s,\x20%s','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x525646,_0x5e435b){var _0x47ce97=function(_0x30e17a){while(--_0x30e17a){_0x525646['push'](_0x525646['shift']());}};_0x47ce97(++_0x5e435b);}(_0x22d3,0x66));var _0x322d=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x22d3[_0x3ceb54];return _0x26d8a6;};'use strict';var _=require('lodash');var util=require(_0x322d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x322d('0x1'));var fs=require('fs');var Redis=require(_0x322d('0x2'));var db=require(_0x322d('0x3'))['db'];var utils=require(_0x322d('0x4'));var logger=require(_0x322d('0x5'))('rpc');var config=require(_0x322d('0x6'));var jayson=require(_0x322d('0x7'));var client=jayson['client'][_0x322d('0x8')]({'port':0x232a});config[_0x322d('0x9')]=_[_0x322d('0xa')](config[_0x322d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x322d('0xb'))(new Redis(config[_0x322d('0x9')]));require(_0x322d('0xc'))[_0x322d('0xd')](socket);function respondWithRpcPromise(_0x2a6b87,_0x29c770,_0xf41a3e){return new BPromise(function(_0x3710a4,_0x2b3a39){return client[_0x322d('0xe')](_0x2a6b87,_0xf41a3e)['then'](function(_0x4e08a3){logger[_0x322d('0xf')]('ChatGroup,\x20%s,\x20%s',_0x29c770,_0x322d('0x10'));logger['debug'](_0x322d('0x11'),_0x29c770,_0x322d('0x10'),JSON[_0x322d('0x12')](_0x4e08a3));if(_0x4e08a3[_0x322d('0x13')]){if(_0x4e08a3[_0x322d('0x13')]['code']===0x1f4){logger[_0x322d('0x13')]('ChatGroup,\x20%s,\x20%s',_0x29c770,_0x4e08a3[_0x322d('0x13')]['message']);return _0x2b3a39(_0x4e08a3['error'][_0x322d('0x14')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x29c770,_0x4e08a3[_0x322d('0x13')][_0x322d('0x14')]);return _0x3710a4(_0x4e08a3[_0x322d('0x13')][_0x322d('0x14')]);}else{logger[_0x322d('0xf')]('ChatGroup,\x20%s,\x20%s',_0x29c770,_0x322d('0x10'));_0x3710a4(_0x4e08a3[_0x322d('0x15')][_0x322d('0x14')]);}})[_0x322d('0x16')](function(_0x497a4f){logger[_0x322d('0x13')](_0x322d('0x17'),_0x29c770,_0x497a4f);_0x2b3a39(_0x497a4f);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 1e3a5e7..e5259ad 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 _0xbb20=['register','chatGroup:','save','remove','update','removeListener'];(function(_0x129f0e,_0x47b168){var _0x365540=function(_0x4a9cb0){while(--_0x4a9cb0){_0x129f0e['push'](_0x129f0e['shift']());}};_0x365540(++_0x47b168);}(_0xbb20,0x152));var _0x0bb2=function(_0x4b03a7,_0x49698b){_0x4b03a7=_0x4b03a7-0x0;var _0x644e66=_0xbb20[_0x4b03a7];return _0x644e66;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x0bb2('0x0'),_0x0bb2('0x1'),_0x0bb2('0x2')];function createListener(_0x148fde,_0x5ba338){return function(_0x3e0362){_0x5ba338['emit'](_0x148fde,_0x3e0362);};}function removeListener(_0x3b86f3,_0x5de495){return function(){ChatGroupEvents[_0x0bb2('0x3')](_0x3b86f3,_0x5de495);};}exports[_0x0bb2('0x4')]=function(_0x963831){for(var _0x4a3cac=0x0,_0xebdd98=events['length'];_0x4a3cac<_0xebdd98;_0x4a3cac++){var _0x4b4fcc=events[_0x4a3cac];var _0x5470ac=createListener(_0x0bb2('0x5')+_0x4b4fcc,_0x963831);ChatGroupEvents['on'](_0x4b4fcc,_0x5470ac);}}; \ No newline at end of file +var _0xfe30=['chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0xd48ed9,_0x4aa193){var _0x6cf52a=function(_0x254f76){while(--_0x254f76){_0xd48ed9['push'](_0xd48ed9['shift']());}};_0x6cf52a(++_0x4aa193);}(_0xfe30,0x1ed));var _0x0fe3=function(_0x1adf19,_0x44af9c){_0x1adf19=_0x1adf19-0x0;var _0x17faa2=_0xfe30[_0x1adf19];return _0x17faa2;};'use strict';var ChatGroupEvents=require(_0x0fe3('0x0'));var events=[_0x0fe3('0x1'),_0x0fe3('0x2'),_0x0fe3('0x3')];function createListener(_0x2a7a8e,_0x2e16ff){return function(_0x20d741){_0x2e16ff[_0x0fe3('0x4')](_0x2a7a8e,_0x20d741);};}function removeListener(_0x4cbbdf,_0x491be0){return function(){ChatGroupEvents['removeListener'](_0x4cbbdf,_0x491be0);};}exports['register']=function(_0x1da10e){for(var _0x366347=0x0,_0x466129=events['length'];_0x366347<_0x466129;_0x366347++){var _0x7d2dd4=events[_0x366347];var _0x1a125b=createListener(_0x0fe3('0x5')+_0x7d2dd4,_0x1da10e);ChatGroupEvents['on'](_0x7d2dd4,_0x1a125b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 7ded9c8..90a6e3f 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 _0xd27d=['show','/:id/unread','/:id/members','getMembers','/:id/messages','post','addMessage','update','delete','destroy','removeMembers','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x50357c,_0x1cca99){var _0x18338e=function(_0x447e73){while(--_0x447e73){_0x50357c['push'](_0x50357c['shift']());}};_0x18338e(++_0x1cca99);}(_0xd27d,0x144));var _0xdd27=function(_0xd344ef,_0x132b5f){_0xd344ef=_0xd344ef-0x0;var _0x50a171=_0xd27d[_0xd344ef];return _0x50a171;};'use strict';var multer=require('multer');var util=require(_0xdd27('0x0'));var path=require(_0xdd27('0x1'));var timeout=require(_0xdd27('0x2'));var express=require(_0xdd27('0x3'));var router=express['Router']();var fs_extra=require(_0xdd27('0x4'));var auth=require(_0xdd27('0x5'));var interaction=require(_0xdd27('0x6'));var config=require('../../config/environment');var controller=require(_0xdd27('0x7'));router[_0xdd27('0x8')]('/',auth[_0xdd27('0x9')](),controller[_0xdd27('0xa')]);router[_0xdd27('0x8')](_0xdd27('0xb'),auth[_0xdd27('0x9')](),controller[_0xdd27('0xc')]);router[_0xdd27('0x8')](_0xdd27('0xd'),auth['isAuthenticated'](),controller[_0xdd27('0xe')]);router[_0xdd27('0x8')](_0xdd27('0xf'),auth[_0xdd27('0x9')](),controller['getUnread']);router[_0xdd27('0x8')](_0xdd27('0x10'),auth['isAuthenticated'](),controller[_0xdd27('0x11')]);router[_0xdd27('0x8')](_0xdd27('0x12'),auth[_0xdd27('0x9')](),controller['getMessages']);router[_0xdd27('0x13')]('/',auth[_0xdd27('0x9')](),controller['create']);router[_0xdd27('0x13')]('/:id/members',auth[_0xdd27('0x9')](),controller['addMembers']);router[_0xdd27('0x13')](_0xdd27('0x12'),auth[_0xdd27('0x9')](),controller[_0xdd27('0x14')]);router['put']('/:id',auth[_0xdd27('0x9')](),controller[_0xdd27('0x15')]);router[_0xdd27('0x16')](_0xdd27('0xd'),auth[_0xdd27('0x9')](),controller[_0xdd27('0x17')]);router['delete'](_0xdd27('0x10'),auth[_0xdd27('0x9')](),controller[_0xdd27('0x18')]);module[_0xdd27('0x19')]=router; \ No newline at end of file +var _0x81db=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','delete','/:id','destroy','multer','util','path'];(function(_0x494aab,_0x4e1cef){var _0x1bc60f=function(_0xfbc68e){while(--_0xfbc68e){_0x494aab['push'](_0x494aab['shift']());}};_0x1bc60f(++_0x4e1cef);}(_0x81db,0x183));var _0xb81d=function(_0x52e572,_0x4c318b){_0x52e572=_0x52e572-0x0;var _0x112a42=_0x81db[_0x52e572];return _0x112a42;};'use strict';var multer=require(_0xb81d('0x0'));var util=require(_0xb81d('0x1'));var path=require(_0xb81d('0x2'));var timeout=require(_0xb81d('0x3'));var express=require(_0xb81d('0x4'));var router=express[_0xb81d('0x5')]();var fs_extra=require(_0xb81d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb81d('0x7'));var config=require(_0xb81d('0x8'));var controller=require('./chatGroup.controller');router[_0xb81d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb81d('0x9')](_0xb81d('0xa'),auth[_0xb81d('0xb')](),controller[_0xb81d('0xc')]);router[_0xb81d('0x9')]('/:id',auth[_0xb81d('0xb')](),controller['show']);router[_0xb81d('0x9')](_0xb81d('0xd'),auth[_0xb81d('0xb')](),controller['getUnread']);router[_0xb81d('0x9')](_0xb81d('0xe'),auth[_0xb81d('0xb')](),controller[_0xb81d('0xf')]);router[_0xb81d('0x9')](_0xb81d('0x10'),auth[_0xb81d('0xb')](),controller[_0xb81d('0x11')]);router[_0xb81d('0x12')]('/',auth[_0xb81d('0xb')](),controller[_0xb81d('0x13')]);router[_0xb81d('0x12')]('/:id/members',auth['isAuthenticated'](),controller[_0xb81d('0x14')]);router[_0xb81d('0x12')]('/:id/messages',auth[_0xb81d('0xb')](),controller[_0xb81d('0x15')]);router[_0xb81d('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb81d('0x17')](_0xb81d('0x18'),auth[_0xb81d('0xb')](),controller[_0xb81d('0x19')]);router[_0xb81d('0x17')]('/:id/members',auth['isAuthenticated'](),controller['removeMembers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 28b9404..9cf99fa 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 _0x8870=['sequelize','exports','INTEGER','ENUM','thumb','star','TEXT','STRING','DATE','long','BOOLEAN'];(function(_0x4acfd2,_0x5b9374){var _0x12afbe=function(_0x5bc178){while(--_0x5bc178){_0x4acfd2['push'](_0x4acfd2['shift']());}};_0x12afbe(++_0x5b9374);}(_0x8870,0xfd));var _0x0887=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8870[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0x0887('0x0'));module[_0x0887('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x0887('0x2')]},'ratingType':{'type':Sequelize[_0x0887('0x3')]('star',_0x0887('0x4')),'defaultValue':_0x0887('0x5')},'ratingMessage':{'type':Sequelize[_0x0887('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x0887('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0887('0x8')]},'disposition':{'type':Sequelize[_0x0887('0x7')]},'secondDisposition':{'type':Sequelize[_0x0887('0x7')]},'thirdDisposition':{'type':Sequelize[_0x0887('0x7')]},'note':{'type':Sequelize[_0x0887('0x7')]},'browserName':{'type':Sequelize[_0x0887('0x7')]},'browserVersion':{'type':Sequelize[_0x0887('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x0887('0x7')]},'deviceModel':{'type':Sequelize[_0x0887('0x7')]},'deviceVendor':{'type':Sequelize[_0x0887('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x0887('0x7')]},'formData':{'type':Sequelize['TEXT'](_0x0887('0x9'))},'read1stAt':{'type':Sequelize[_0x0887('0x8')]},'lastMsgAt':{'type':Sequelize[_0x0887('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x0887('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x0887('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x0887('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x0887('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0887('0x2')]}}; \ No newline at end of file +var _0x6c1a=['BOOLEAN','sequelize','exports','INTEGER','star','thumb','TEXT','STRING','DATE','long','out'];(function(_0x2697ff,_0x1850ac){var _0x5b56d7=function(_0x114886){while(--_0x114886){_0x2697ff['push'](_0x2697ff['shift']());}};_0x5b56d7(++_0x1850ac);}(_0x6c1a,0x1f0));var _0xa6c1=function(_0x2a6a75,_0x1df599){_0x2a6a75=_0x2a6a75-0x0;var _0x227550=_0x6c1a[_0x2a6a75];return _0x227550;};'use strict';var Sequelize=require(_0xa6c1('0x0'));module[_0xa6c1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xa6c1('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0xa6c1('0x3'),_0xa6c1('0x4')),'defaultValue':_0xa6c1('0x3')},'ratingMessage':{'type':Sequelize[_0xa6c1('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xa6c1('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa6c1('0x7')]},'disposition':{'type':Sequelize[_0xa6c1('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xa6c1('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xa6c1('0x6')]},'deviceVendor':{'type':Sequelize[_0xa6c1('0x6')]},'deviceType':{'type':Sequelize[_0xa6c1('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xa6c1('0x6')]},'formData':{'type':Sequelize[_0xa6c1('0x5')](_0xa6c1('0x8'))},'read1stAt':{'type':Sequelize[_0xa6c1('0x7')]},'lastMsgAt':{'type':Sequelize[_0xa6c1('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa6c1('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa6c1('0x6')]},'customerPort':{'type':Sequelize[_0xa6c1('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xa6c1('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 126b873..ae215f2 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 _0x5595=['browserName','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','firstName','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','mustache','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','http','client','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','stack','name','send','render','merge','contact','interaction','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','user','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','options','find','create','body','update','describe','createVidaooSession','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','email','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','basename','filename','mimetype','Attachment','findOne','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','User','ContactId','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','MailAccount','MailServerOut','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ChatMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','rows','getMyMessages','secret','push','addTags','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','tmp','files','attachments','transcript-%d-%s.zip','lastName','read','Account','get','mkdirSync','Chat','Owner','closedAt','toString'];(function(_0x2d5a9d,_0x499b8c){var _0x40fd1f=function(_0x3ec2ef){while(--_0x3ec2ef){_0x2d5a9d['push'](_0x2d5a9d['shift']());}};_0x40fd1f(++_0x499b8c);}(_0x5595,0xe4));var _0x5559=function(_0x5c8020,_0x1f3a3a){_0x5c8020=_0x5c8020-0x0;var _0x4c835a=_0x5595[_0x5c8020];return _0x4c835a;};'use strict';var rimraf=require(_0x5559('0x0'));var zipdir=require('zip-dir');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5559('0x1'));var util=require('util');var path=require('path');var ejs=require(_0x5559('0x2'));var fs=require('fs');var _=require(_0x5559('0x3'));var Redis=require(_0x5559('0x4'));var interaction=require(_0x5559('0x5'));var qs=require(_0x5559('0x6'));var pdf=require(_0x5559('0x7'));var logger=require(_0x5559('0x8'))(_0x5559('0x9'));var config=require('../../config/environment');var db=require(_0x5559('0xa'))['db'];config[_0x5559('0xb')]=_[_0x5559('0xc')](config[_0x5559('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5559('0xd'))(new Redis(config[_0x5559('0xb')]));require(_0x5559('0xe'))[_0x5559('0xf')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5559('0x10')]({'port':0x232b});var client9004=jayson[_0x5559('0x11')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2208e4,_0x289a04,_0x284fd7,_0x3f9c73){return new BPromise(function(_0x35e478,_0x548f14){var _0x314ae2=_0x3f9c73||client;return _0x314ae2[_0x5559('0x12')](_0x2208e4,_0x284fd7)[_0x5559('0x13')](function(_0x4276ce){logger[_0x5559('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x289a04,_0x5559('0x15'));logger['debug'](_0x5559('0x16'),_0x289a04,_0x5559('0x15'),JSON[_0x5559('0x17')](_0x4276ce));if(_0x4276ce[_0x5559('0x18')]){if(_0x4276ce[_0x5559('0x18')][_0x5559('0x19')]===0x1f4){logger['error'](_0x5559('0x1a'),_0x289a04,_0x4276ce[_0x5559('0x18')][_0x5559('0x1b')]);return _0x548f14(_0x4276ce['error'][_0x5559('0x1b')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x289a04,_0x4276ce['error'][_0x5559('0x1b')]);return _0x35e478(_0x4276ce[_0x5559('0x18')][_0x5559('0x1b')]);}else{logger[_0x5559('0x14')](_0x5559('0x1a'),_0x289a04,_0x5559('0x15'));_0x35e478(_0x4276ce[_0x5559('0x1c')][_0x5559('0x1b')]);}})[_0x5559('0x1d')](function(_0x3d1075){logger[_0x5559('0x18')](_0x5559('0x1a'),_0x289a04,_0x3d1075);_0x548f14(_0x3d1075);});});}function respondWithStatusCode(_0x389147,_0x4a942a){_0x4a942a=_0x4a942a||0xcc;return function(_0x30d2aa){if(_0x30d2aa){return _0x389147[_0x5559('0x1e')](_0x4a942a);}return _0x389147[_0x5559('0x1f')](_0x4a942a)[_0x5559('0x20')]();};}function respondWithResult(_0x2aa819,_0x1bed36){_0x1bed36=_0x1bed36||0xc8;return function(_0x1426e7){if(_0x1426e7){return _0x2aa819[_0x5559('0x1f')](_0x1bed36)[_0x5559('0x21')](_0x1426e7);}};}function respondWithFilteredResult(_0x21412e,_0x4bf08b){return function(_0x58e391){if(_0x58e391){var _0x4cb2ad=typeof _0x4bf08b[_0x5559('0x22')]===_0x5559('0x23')&&typeof _0x4bf08b[_0x5559('0x24')]===_0x5559('0x23');var _0x146861=_0x58e391[_0x5559('0x25')];var _0x3798e0=_0x4cb2ad?0x0:_0x4bf08b[_0x5559('0x22')];var _0x5e9392=_0x4cb2ad?_0x58e391[_0x5559('0x25')]:_0x4bf08b[_0x5559('0x22')]+_0x4bf08b[_0x5559('0x24')];var _0x25ca5e;if(_0x5e9392>=_0x146861){_0x5e9392=_0x146861;_0x25ca5e=0xc8;}else{_0x25ca5e=0xce;}_0x21412e[_0x5559('0x1f')](_0x25ca5e);return _0x21412e[_0x5559('0x26')](_0x5559('0x27'),_0x3798e0+'-'+_0x5e9392+'/'+_0x146861)['json'](_0x58e391);}return null;};}function saveUpdates(_0x32f113){return function(_0x4e732c){if(_0x4e732c){return _0x4e732c['update'](_0x32f113)['then'](function(_0x2bcc72){return _0x2bcc72;});}return null;};}function removeEntity(_0x3e6a8c){return function(_0x2a9567){if(_0x2a9567){return _0x2a9567[_0x5559('0x28')]()[_0x5559('0x13')](function(){_0x3e6a8c[_0x5559('0x1f')](0xcc)[_0x5559('0x20')]();});}};}function handleEntityNotFound(_0x4fa5f5){return function(_0x4b3631){if(!_0x4b3631){_0x4fa5f5[_0x5559('0x1e')](0x194);}return _0x4b3631;};}function handleError(_0x2ca821,_0x1fcf7a){_0x1fcf7a=_0x1fcf7a||0x1f4;return function(_0x425419){logger[_0x5559('0x18')](_0x425419[_0x5559('0x29')]);if(_0x425419[_0x5559('0x2a')]){delete _0x425419[_0x5559('0x2a')];}_0x2ca821['status'](_0x1fcf7a)[_0x5559('0x2b')](_0x425419);};}function getMustacheRender(_0x22b96d,_0x2b9301){return Mustache[_0x5559('0x2c')](_0x22b96d,_[_0x5559('0x2d')](_0x2b9301['body'],{'contact':_0x2b9301[_0x5559('0x2e')],'message':_0x2b9301[_0x5559('0x1b')],'agent':_0x2b9301['agent'],'interaction':_0x2b9301[_0x5559('0x2f')],'account':_0x2b9301['account']}))||'';}exports[_0x5559('0x30')]=function(_0x4e27a7,_0x3d25df){var _0x3d2f59={};var _0x1cc3ad=_[_0x5559('0x31')](db[_0x5559('0x32')][_0x5559('0x33')],function(_0x9c7a49){return{'name':_0x9c7a49[_0x5559('0x34')],'type':_0x9c7a49[_0x5559('0x35')][_0x5559('0x36')]};});_0x3d2f59=qs[_0x5559('0x37')](_0x1cc3ad,_0x4e27a7);return interaction[_0x5559('0x38')](_0x5559('0x39'),_0x4e27a7['query'],_0x4e27a7[_0x5559('0x3a')],_0x3d2f59,_0x1cc3ad)['then'](respondWithFilteredResult(_0x3d25df,_0x3d2f59))[_0x5559('0x1d')](handleError(_0x3d25df,null));};exports[_0x5559('0x3b')]=function(_0x5bfe2e,_0x5a7846){var _0x3301e8={'raw':![],'where':{'id':_0x5bfe2e[_0x5559('0x3c')]['id']}},_0x42a221={};_0x42a221[_0x5559('0x3d')]=_[_0x5559('0x3e')](db[_0x5559('0x32')][_0x5559('0x33')]);_0x42a221[_0x5559('0x3f')]=_[_0x5559('0x3e')](_0x5bfe2e['query']);_0x42a221[_0x5559('0x40')]=_[_0x5559('0x41')](_0x42a221[_0x5559('0x3d')],_0x42a221[_0x5559('0x3f')]);_0x3301e8[_0x5559('0x42')]=_['intersection'](_0x42a221['model'],qs[_0x5559('0x43')](_0x5bfe2e[_0x5559('0x3f')]['fields']));_0x3301e8[_0x5559('0x42')]=_0x3301e8[_0x5559('0x42')][_0x5559('0x44')]?_0x3301e8[_0x5559('0x42')]:_0x42a221[_0x5559('0x3d')];if(_0x5bfe2e['query'][_0x5559('0x45')]){_0x3301e8['include']=[{'all':!![]}];}_0x3301e8=_[_0x5559('0x2d')]({},_0x3301e8,_0x5bfe2e[_0x5559('0x46')]);return db[_0x5559('0x32')][_0x5559('0x47')](_0x3301e8)[_0x5559('0x13')](handleEntityNotFound(_0x5a7846,null))['then'](respondWithResult(_0x5a7846,null))['catch'](handleError(_0x5a7846,null));};exports[_0x5559('0x48')]=function(_0x417e3d,_0x280e8a){return db[_0x5559('0x32')]['create'](_0x417e3d[_0x5559('0x49')],{})['then'](respondWithResult(_0x280e8a,0xc9))[_0x5559('0x1d')](handleError(_0x280e8a,null));};exports[_0x5559('0x4a')]=function(_0x2d917a,_0x2c9d0){if(_0x2d917a[_0x5559('0x49')]['id']){delete _0x2d917a[_0x5559('0x49')]['id'];}return db[_0x5559('0x32')][_0x5559('0x47')]({'where':{'id':_0x2d917a[_0x5559('0x3c')]['id']}})[_0x5559('0x13')](handleEntityNotFound(_0x2c9d0,null))[_0x5559('0x13')](saveUpdates(_0x2d917a['body'],null))['then'](respondWithResult(_0x2c9d0,null))[_0x5559('0x1d')](handleError(_0x2c9d0,null));};exports[_0x5559('0x28')]=function(_0x1ed677,_0xb7b56b){return db[_0x5559('0x32')][_0x5559('0x47')]({'where':{'id':_0x1ed677[_0x5559('0x3c')]['id']}})['then'](handleEntityNotFound(_0xb7b56b,null))[_0x5559('0x13')](removeEntity(_0xb7b56b,null))[_0x5559('0x1d')](handleError(_0xb7b56b,null));};exports[_0x5559('0x4b')]=function(_0xf0d8f9,_0x184ba1){return db[_0x5559('0x32')][_0x5559('0x4b')]()[_0x5559('0x13')](respondWithResult(_0x184ba1,null))[_0x5559('0x1d')](handleError(_0x184ba1,null));};exports[_0x5559('0x4c')]=function(_0x216bb6,_0x2d7aeb){var _0x469bc3=_0x216bb6[_0x5559('0x3c')]['id'];var _0x6e8db0;var _0x4d08e6;var _0x5c9bfe;return db[_0x5559('0x32')]['findOne']({'where':{'id':_0x469bc3}})['then'](function(_0x1d1b17){_0x6e8db0=_0x1d1b17;return db[_0x5559('0x4d')]['findOne']({'where':{'id':_0x1d1b17[_0x5559('0x4e')]},'attributes':['id','vidaooApiKey',_0x5559('0x4f'),_0x5559('0x50'),_0x5559('0x51'),_0x5559('0x52')],'raw':!![]});})['then'](function(_0x2b5207){if(_0x2b5207&&_0x2b5207['vidaooApiKey']&&_0x2b5207[_0x5559('0x4f')]){_0x4d08e6=_0x2b5207;var _0x5de5e3={'interaction':{'id':_0x469bc3},'agent':{'id':_0x216bb6[_0x5559('0x3a')]['id'],'name':_0x216bb6[_0x5559('0x3a')][_0x5559('0x2a')],'fullname':_0x216bb6[_0x5559('0x3a')]['fullname'],'email':_0x216bb6['user']['email']},'contact':_0x216bb6[_0x5559('0x49')]['contact'],'account':_0x216bb6['body'][_0x5559('0x53')]};var _0x138302={'rejectUnauthorized':![],'method':_0x5559('0x54'),'url':_0x5559('0x55'),'headers':{'X-APIKEY':_0x2b5207[_0x5559('0x56')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x216bb6[_0x5559('0x3a')][_0x5559('0x57')]],'buttons':null,'topic':_0x4d08e6[_0x5559('0x50')],'note':_[_0x5559('0x58')](_0x4d08e6[_0x5559('0x51')])?null:getMustacheRender(_0x4d08e6[_0x5559('0x51')],_0x5de5e3),'metadata':null},'redirect':_0x5559('0x59'),'json':!![]};try{if(!_[_0x5559('0x58')](_0x4d08e6[_0x5559('0x52')])){var _0x2d8f88=getMustacheRender(_0x4d08e6[_0x5559('0x52')],_0x5de5e3);var _0x2143f6=JSON[_0x5559('0x5a')](_0x2d8f88);_0x138302[_0x5559('0x49')][_0x5559('0x5b')]=_0x2143f6;}}catch(_0x361080){throw new db[(_0x5559('0x5c'))][(_0x5559('0x5d'))](_0x5559('0x5e'));}return rp(_0x138302);}else{throw new db['Sequelize'][(_0x5559('0x5d'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x5559('0x13')](function(_0x4b7995){_0x5c9bfe=_0x4b7995;if(_0x5c9bfe['id']){var _0x1c0b96={'body':_0x5c9bfe['join_url'],'ChatWebsiteId':_0x4d08e6['id'],'ChatInteractionId':_0x6e8db0['id'],'direction':_0x5559('0x5f'),'UserId':_0x216bb6[_0x5559('0x3a')]['id']};return db['ChatMessage']['create'](_0x1c0b96,{});}else{throw new db[(_0x5559('0x5c'))][(_0x5559('0x5d'))](_0x5559('0x60'));}})[_0x5559('0x13')](function(){return _0x6e8db0[_0x5559('0x61')]({'vidaooSessionId':_0x5c9bfe['id']});})[_0x5559('0x13')](respondWithResult(_0x2d7aeb,null))[_0x5559('0x1d')](handleError(_0x2d7aeb,null));};exports[_0x5559('0x62')]=function(_0x2a603b,_0x2057b7){if(_0x2a603b['body']['id']){delete _0x2a603b[_0x5559('0x49')]['id'];}return db[_0x5559('0x32')][_0x5559('0x47')]({'where':{'id':_0x2a603b[_0x5559('0x3c')]['id']},'include':[{'model':db[_0x5559('0x63')],'as':_0x5559('0x64')}]})[_0x5559('0x13')](handleEntityNotFound(_0x2057b7,null))[_0x5559('0x13')](saveUpdates(_0x2a603b[_0x5559('0x49')],null))[_0x5559('0x13')](respondWithResult(_0x2057b7,null))[_0x5559('0x1d')](handleError(_0x2057b7,null));};exports[_0x5559('0x65')]=function(_0x3d2f11,_0x2d29f7){if(_0x3d2f11[_0x5559('0x49')]['id']){delete _0x3d2f11[_0x5559('0x49')]['id'];}return db[_0x5559('0x32')][_0x5559('0x47')]({'where':{'id':_0x3d2f11[_0x5559('0x3c')]['id']}})[_0x5559('0x13')](function(_0x142134){if(!_0x142134){logger[_0x5559('0x18')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x5559('0x66'));_0x2d29f7[_0x5559('0x1e')](0x194);}else{if(_0x142134[_0x5559('0x67')]){throw new db[(_0x5559('0x5c'))][(_0x5559('0x5d'))](_0x5559('0x68'));}}return _0x142134;})[_0x5559('0x13')](function(_0x2675cf){if(_0x2675cf){return _0x2675cf[_0x5559('0x4a')]({'closed':_0x3d2f11[_0x5559('0x49')][_0x5559('0x69')],'disposition':_0x3d2f11[_0x5559('0x49')][_0x5559('0x6a')]})[_0x5559('0x13')](function(_0x18c649){return _0x18c649;});}})[_0x5559('0x13')](function(){return respondWithRpcPromise(_0x5559('0x6b'),'abandon',_0x3d2f11[_0x5559('0x49')],client9004);})[_0x5559('0x13')](respondWithResult(_0x2d29f7,null))[_0x5559('0x1d')](handleError(_0x2d29f7,null));};exports[_0x5559('0x6c')]=function(_0x18717d,_0x3665ce){_0x18717d[_0x5559('0x49')][_0x5559('0x2a')]=_0x18717d[_0x5559('0x6d')]['originalname'];_0x18717d[_0x5559('0x49')][_0x5559('0x6e')]=_0x18717d[_0x5559('0x6d')][_0x5559('0x6f')];_0x18717d[_0x5559('0x49')][_0x5559('0x35')]=_0x18717d[_0x5559('0x6d')][_0x5559('0x70')];return db[_0x5559('0x71')]['create'](_0x18717d[_0x5559('0x49')])[_0x5559('0x13')](respondWithResult(_0x3665ce,0xc9))[_0x5559('0x1d')](handleError(_0x3665ce,null));};exports['attachmentDownload']=function(_0x4164a5,_0x38e299){return db['ChatInteraction'][_0x5559('0x72')]({'where':{'id':_0x4164a5['params']['id']},'raw':!![]})[_0x5559('0x13')](handleEntityNotFound(_0x38e299,null))[_0x5559('0x13')](function(_0x5663fa){if(_0x5663fa){if(_0x5663fa[_0x5559('0x69')]){return _0x38e299[_0x5559('0x1f')](0x193)[_0x5559('0x21')]({'status':0x193,'message':_0x5559('0x73')});}return db[_0x5559('0x71')][_0x5559('0x72')]({'where':{'id':_0x4164a5['query']['attachId']},'raw':!![]})[_0x5559('0x13')](handleEntityNotFound(_0x38e299,null));}})[_0x5559('0x13')](function(_0x56f4b7){if(_0x56f4b7){var _0x1cd61d=_0x56f4b7[_0x5559('0x74')]!==null;var _0x240a97=path[_0x5559('0x75')](config[_0x5559('0x76')],_0x5559('0x77'));if(_0x1cd61d){_0x240a97=path[_0x5559('0x75')](_0x240a97,_0x5559('0x78'));}var _0x220fb9=path['join'](_0x240a97,_0x56f4b7[_0x5559('0x6e')]);return _0x38e299[_0x5559('0x79')](_0x220fb9);}})[_0x5559('0x1d')](handleError(_0x38e299,null));};exports[_0x5559('0x7a')]=function(_0x225576,_0x55d912){var _0x26a487=null;var _0x4ce132=null;var _0x563ec1=null;if(_0x225576[_0x5559('0x49')]['id']){delete _0x225576[_0x5559('0x49')]['id'];}if(_0x225576[_0x5559('0x49')]['mailTranscript']){_0x563ec1=path[_0x5559('0x75')](config[_0x5559('0x76')],_0x5559('0x7b'),util[_0x5559('0x7c')](_0x5559('0x7d'),Date[_0x5559('0x7e')]()));_0x225576['body']['pathTranscript']=_0x563ec1;}return db['ChatInteraction'][_0x5559('0x47')]({'where':{'id':_0x225576[_0x5559('0x3c')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x5559('0x7f'),'include':[{'model':db[_0x5559('0x80')],'as':_0x5559('0x80')}]}]})[_0x5559('0x13')](handleEntityNotFound(_0x55d912,null))[_0x5559('0x13')](saveUpdates(_0x225576[_0x5559('0x49')],null))[_0x5559('0x13')](function(_0x31f4e3){if(_0x31f4e3){_0x26a487=_0x31f4e3;return db['ChatWebsite'][_0x5559('0x47')]({'where':{'id':_0x26a487[_0x5559('0x4e')]}});}})[_0x5559('0x13')](function(_0x167280){if(_0x167280){_0x4ce132=_0x167280;return db[_0x5559('0x63')][_0x5559('0x47')]({'where':{'id':_0x26a487[_0x5559('0x81')]}});}})[_0x5559('0x13')](function(_0x3718cd){if(_0x3718cd){if(_0x563ec1){var _0x2b2452=null;for(var _0x1dab61=0x1;_0x1dab61<_0x26a487[_0x5559('0x7f')]['length'];++_0x1dab61){_0x2b2452=_0x26a487[_0x5559('0x7f')][_0x1dab61];var _0x42b29c=_0x2b2452[_0x5559('0x67')]?util[_0x5559('0x7c')](_0x5559('0x82'),_0x4ce132[_0x5559('0x83')],_0x2b2452[_0x5559('0x67')]):_0x5559('0x84');var _0xed2e2c=_0x225576[_0x5559('0x49')]['customer']||util[_0x5559('0x7c')](_0x5559('0x82'),_0x5559('0x85'),_0x2b2452[_0x5559('0x81')]);switch(_0x4ce132[_0x5559('0x86')]){case _0x5559('0x87'):_0x42b29c=_0x2b2452['UserId']?util[_0x5559('0x7c')]('%s%d',_0x4ce132[_0x5559('0x83')],_0x2b2452[_0x5559('0x67')]):_0x5559('0x84');break;case _0x5559('0x88'):_0x42b29c=_0x2b2452[_0x5559('0x67')]?_0x2b2452[_0x5559('0x80')][_0x5559('0x89')]||_0x2b2452['User'][_0x5559('0x8a')]:'System';break;case'agent_fullname':_0x42b29c=_0x2b2452[_0x5559('0x67')]?_0x2b2452['User'][_0x5559('0x8a')]:'System';break;default:_0x42b29c=_0x2b2452[_0x5559('0x67')]?util[_0x5559('0x7c')](_0x5559('0x82'),_0x4ce132[_0x5559('0x83')],_0x2b2452[_0x5559('0x67')]):_0x5559('0x84');}var _0x4909d6=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x2b2452[_0x5559('0x8b')])[_0x5559('0x7c')](_0x5559('0x8c')),_0x2b2452[_0x5559('0x8d')]==='in'?_0xed2e2c:_0x42b29c,_0x2b2452['body']);if(!_0x2b2452['secret']){fs['appendFileSync'](_0x563ec1,_0x4909d6);}}return db[_0x5559('0x8e')][_0x5559('0x72')]({'where':{'service':!![]},'include':[{'model':db[_0x5559('0x8f')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x5559('0x90')],'as':_0x5559('0x90'),'raw':!![]}]}]});}}})[_0x5559('0x13')](function(_0x5c59f7){if(!_0x5c59f7||!_0x5c59f7['Smtp']||!_0x225576[_0x5559('0x49')])return _0x26a487;var _0x655f0b=_0x5c59f7['getSmtpOptions']();return respondWithRpcPromise(_0x5559('0x91'),_0x5559('0x92'),{'account':_0x655f0b,'message':{'from':util[_0x5559('0x7c')](_0x5559('0x93'),_0x5c59f7[_0x5559('0x2a')],_0x5c59f7[_0x5559('0x57')]||_0x5c59f7['Smtp'][_0x5559('0x3a')]),'to':_0x225576[_0x5559('0x49')]['mailTranscript'],'subject':_0x5559('0x94'),'text':util['format'](_0x5559('0x95'),_0x225576[_0x5559('0x49')]['mailTranscript']),'attachments':[{'path':_0x563ec1}]}})[_0x5559('0x13')](function(){return _0x26a487;})['catch'](function(_0x2aa9e3){logger['error'](_0x2aa9e3);});})['then'](respondWithStatusCode(_0x55d912,0xc8))[_0x5559('0x1d')](handleError(_0x55d912,null));};exports[_0x5559('0x96')]=function(_0x5c6c38,_0x3aee72){return db[_0x5559('0x97')][_0x5559('0x47')]({'where':{'id':_0x5c6c38[_0x5559('0x3c')]['id']}})[_0x5559('0x13')](handleEntityNotFound(_0x3aee72,null))[_0x5559('0x13')](function(_0x335125){if(_0x335125){return _0x335125[_0x5559('0x96')](_0x5c6c38[_0x5559('0x49')][_0x5559('0x98')],_['omit'](_0x5c6c38[_0x5559('0x49')],['ids','id'])||{});}})[_0x5559('0x13')](respondWithResult(_0x3aee72,null))['catch'](handleError(_0x3aee72,null));};exports[_0x5559('0x99')]=function(_0xeff41b,_0x18cd36){var _0x470c36={'raw':![],'where':{}};var _0x5a28c7={};var _0x1e23e0={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x5559('0x72')]({'where':{'id':_0xeff41b[_0x5559('0x3c')]['id']}})[_0x5559('0x13')](handleEntityNotFound(_0x18cd36,null))[_0x5559('0x13')](function(_0x5250b5){if(_0x5250b5){_0x5a28c7[_0x5559('0x3d')]=_[_0x5559('0x3e')](db[_0x5559('0x97')][_0x5559('0x33')]);_0x5a28c7[_0x5559('0x3f')]=_[_0x5559('0x3e')](_0xeff41b['query']);_0x5a28c7[_0x5559('0x40')]=_['intersection'](_0x5a28c7['model'],_0x5a28c7[_0x5559('0x3f')]);_0x470c36[_0x5559('0x42')]=_[_0x5559('0x41')](_0x5a28c7[_0x5559('0x3d')],qs[_0x5559('0x43')](_0xeff41b[_0x5559('0x3f')][_0x5559('0x43')]));_0x470c36[_0x5559('0x42')]=_0x470c36['attributes'][_0x5559('0x44')]?_0x470c36[_0x5559('0x42')]:_0x5a28c7['model'];if(!_0xeff41b[_0x5559('0x3f')][_0x5559('0x9a')](_0x5559('0x9b'))){_0x470c36[_0x5559('0x24')]=qs[_0x5559('0x24')](_0xeff41b['query']['limit']);_0x470c36[_0x5559('0x22')]=qs[_0x5559('0x22')](_0xeff41b[_0x5559('0x3f')][_0x5559('0x22')]);}_0x470c36[_0x5559('0x9c')]=qs[_0x5559('0x9d')](_0xeff41b[_0x5559('0x3f')]['sort']);_0x470c36[_0x5559('0x9e')]=qs[_0x5559('0x40')](_[_0x5559('0x9f')](_0xeff41b[_0x5559('0x3f')],_0x5a28c7[_0x5559('0x40')]));_0x470c36[_0x5559('0x9e')][_0x5559('0xa0')]=_0x5250b5['id'];if(_0xeff41b[_0x5559('0x3f')][_0x5559('0xa1')]){_0x470c36['where']=_[_0x5559('0x2d')](_0x470c36[_0x5559('0x9e')],{'$or':_[_0x5559('0x31')](_0x470c36[_0x5559('0x42')],function(_0x203407){var _0x2933f2={};_0x2933f2[_0x203407]={'$like':'%'+_0xeff41b[_0x5559('0x3f')]['filter']+'%'};return _0x2933f2;})});}if(_0xeff41b['query'][_0x5559('0xa2')]){var _0x296887=_0xeff41b['query']['$gte'][_0x5559('0xa3')](',');var _0xecd74a={};_0xecd74a[_0x296887[0x0]]={'$gte':moment(_0x296887[0x1])[_0x5559('0x7c')](_0x5559('0xa4'))};_0x470c36[_0x5559('0x9e')]=_[_0x5559('0x2d')](_0x470c36['where'],_0xecd74a);}_0x470c36=_[_0x5559('0x2d')]({},_0x470c36,_0xeff41b[_0x5559('0x46')]);return db['ChatMessage']['count']({'where':_0x470c36[_0x5559('0x9e')]})[_0x5559('0x13')](function(_0x39d217){_0x1e23e0['count']=_0x39d217;if(_0xeff41b['query'][_0x5559('0x45')]){_0x470c36[_0x5559('0xa5')]=[{'all':!![]}];}return db[_0x5559('0x97')][_0x5559('0x38')](_0x470c36);})['then'](function(_0x20f926){_0x1e23e0[_0x5559('0xa6')]=_0x20f926;return _0x1e23e0;});}})[_0x5559('0x13')](respondWithFilteredResult(_0x18cd36,_0x470c36))[_0x5559('0x1d')](handleError(_0x18cd36,null));};exports[_0x5559('0xa7')]=function(_0x376f19,_0x1144c4){var _0x330dfc={'where':{}},_0x5398ab={},_0x1a04ee={'count':0x0,'rows':[]};return db[_0x5559('0x32')][_0x5559('0x72')]({'where':{'id':_0x376f19[_0x5559('0x3c')]['id']}})[_0x5559('0x13')](handleEntityNotFound(_0x1144c4,null))[_0x5559('0x13')](function(_0x5ccb79){if(_0x5ccb79){_0x5398ab['model']=_[_0x5559('0x3e')](db['ChatMessage'][_0x5559('0x33')]);_0x5398ab[_0x5559('0x3f')]=_[_0x5559('0x3e')](_0x376f19[_0x5559('0x3f')]);_0x5398ab[_0x5559('0x40')]=_[_0x5559('0x41')](_0x5398ab['model'],_0x5398ab[_0x5559('0x3f')]);_0x330dfc['attributes']=_[_0x5559('0x41')](_0x5398ab[_0x5559('0x3d')],qs[_0x5559('0x43')](_0x376f19['query'][_0x5559('0x43')]));_0x330dfc[_0x5559('0x42')]=_0x330dfc[_0x5559('0x42')]['length']?_0x330dfc[_0x5559('0x42')]:_0x5398ab['model'];if(!_0x376f19[_0x5559('0x3f')][_0x5559('0x9a')]('nolimit')){_0x330dfc[_0x5559('0x24')]=qs['limit'](_0x376f19[_0x5559('0x3f')][_0x5559('0x24')]);_0x330dfc[_0x5559('0x22')]=qs[_0x5559('0x22')](_0x376f19[_0x5559('0x3f')]['offset']);}_0x330dfc[_0x5559('0x9c')]=qs[_0x5559('0x9d')](_0x376f19['query']['sort']);_0x330dfc[_0x5559('0x9e')]=qs[_0x5559('0x40')](_['pick'](_0x376f19['query'],_0x5398ab[_0x5559('0x40')]));_0x330dfc['where'][_0x5559('0xa0')]=_0x5ccb79['id'];if(_0x376f19[_0x5559('0x3f')]['filter']){_0x330dfc[_0x5559('0x9e')]=_[_0x5559('0x2d')](_0x330dfc[_0x5559('0x9e')],{'$or':_['map'](_0x330dfc[_0x5559('0x42')],function(_0x4c7869){var _0x53e0ef={};_0x53e0ef[_0x4c7869]={'$like':'%'+_0x376f19[_0x5559('0x3f')]['filter']+'%'};return _0x53e0ef;})});}_0x330dfc[_0x5559('0x9e')][_0x5559('0xa8')]=![];if(_0x376f19[_0x5559('0x3f')]['id']){_0x330dfc[_0x5559('0x9e')]['id']={'$gt':_0x376f19[_0x5559('0x3f')]['id']};}_0x330dfc=_[_0x5559('0x2d')]({},_0x330dfc,_0x376f19['options']);return db[_0x5559('0x97')][_0x5559('0x25')]({'where':_0x330dfc[_0x5559('0x9e')]})['then'](function(_0x7fb6e1){_0x1a04ee[_0x5559('0x25')]=_0x7fb6e1;_0x330dfc['include']=[];if(_0x376f19['query']['includeAgent']){_0x330dfc['include'][_0x5559('0xa9')]({'model':db[_0x5559('0x80')],'as':_0x5559('0x80'),'attributes':['id',_0x5559('0x8a'),'alias']});}if(_0x376f19[_0x5559('0x3f')][_0x5559('0x45')]){_0x330dfc[_0x5559('0xa5')]=[{'all':!![]}];}return db[_0x5559('0x97')][_0x5559('0x38')](_0x330dfc);})[_0x5559('0x13')](function(_0x5376f5){_0x1a04ee[_0x5559('0xa6')]=_0x5376f5;return _0x1a04ee;});}})[_0x5559('0x13')](respondWithFilteredResult(_0x1144c4,_0x330dfc))[_0x5559('0x1d')](handleError(_0x1144c4,null));};exports[_0x5559('0xaa')]=function(_0x1f5fe2,_0x38f282){return db[_0x5559('0x32')][_0x5559('0x47')]({'where':{'id':_0x1f5fe2[_0x5559('0x3c')]['id']}})['then'](handleEntityNotFound(_0x38f282,null))[_0x5559('0x13')](function(_0x482d26){if(_0x482d26){return _0x482d26[_0x5559('0xab')](_0x1f5fe2[_0x5559('0x49')]['ids'],_['omit'](_0x1f5fe2['body'],[_0x5559('0x98'),'id'])||{})['spread'](function(){return db[_0x5559('0xac')][_0x5559('0x38')]({'attributes':['id',_0x5559('0x2a'),_0x5559('0xad')],'where':{'id':_0x1f5fe2[_0x5559('0x49')][_0x5559('0x98')]}});})[_0x5559('0x13')](function(_0x56a7fb){socket[_0x5559('0xae')](_0x5559('0xaf'),{'id':Number(_0x1f5fe2[_0x5559('0x3c')]['id']),'tags':_0x56a7fb||[]});return{'id':Number(_0x1f5fe2['params']['id']),'tags':_0x56a7fb||[]};});}})[_0x5559('0x13')](respondWithResult(_0x38f282,null))[_0x5559('0x1d')](handleError(_0x38f282,null));};exports[_0x5559('0xb0')]=function(_0x3b80eb,_0x476305){return db['ChatInteraction'][_0x5559('0x47')]({'where':{'id':_0x3b80eb[_0x5559('0x3c')]['id']}})[_0x5559('0x13')](handleEntityNotFound(_0x476305,null))[_0x5559('0x13')](function(_0x3c4e32){if(_0x3c4e32){return _0x3c4e32[_0x5559('0xb0')](_0x3b80eb[_0x5559('0x3f')][_0x5559('0x98')]);}})['then'](respondWithStatusCode(_0x476305,null))['catch'](handleError(_0x476305,null));};exports[_0x5559('0x79')]=function(_0x4c1e72,_0x22223d){var _0x52850a=moment()[_0x5559('0xb1')]()['toString']();var _0x2285ef=path[_0x5559('0x75')](config[_0x5559('0x76')],_0x5559('0xb2'),'files',_0x5559('0xb3'));var _0x2c3458=path[_0x5559('0x75')](config[_0x5559('0x76')],_0x5559('0xb2'),_0x5559('0xb4'),_0x5559('0xb5'));var _0x87671b=path['join'](_0x2285ef,_0x52850a);var _0x137db3=util[_0x5559('0x7c')](_0x5559('0xb6'),_0x4c1e72['params']['id'],_0x52850a);var _0x3ad6d8=path[_0x5559('0x75')](_0x2285ef,_0x137db3);var _0x26ca43=[];_0x26ca43[_0x5559('0xa9')]({'model':db[_0x5559('0x80')],'as':_0x5559('0x80'),'attributes':['id',_0x5559('0x8a')],'raw':!![]});_0x26ca43[_0x5559('0xa9')]({'model':db[_0x5559('0x63')],'as':'Contact','attributes':['id','firstName',_0x5559('0xb7')],'raw':!![]});if(_0x4c1e72[_0x5559('0x3f')][_0x5559('0xb5')]){_0x26ca43['push']({'model':db[_0x5559('0x71')],'as':_0x5559('0x71'),'raw':!![]});}var _0x11871e=[{'model':db[_0x5559('0x97')],'as':'Messages','attributes':['id',_0x5559('0x49'),_0x5559('0x8b'),_0x5559('0x8d'),'secret',_0x5559('0xb8')],'include':_0x26ca43}];_0x11871e[_0x5559('0xa9')]({'model':db['ChatWebsite'],'as':_0x5559('0xb9'),'attributes':['id',_0x5559('0x2a')]});_0x11871e[_0x5559('0xa9')]({'model':db[_0x5559('0x80')],'as':'Owner','attributes':['id',_0x5559('0x8a')]});return db[_0x5559('0x32')][_0x5559('0x47')]({'where':{'id':_0x4c1e72[_0x5559('0x3c')]['id']},'include':_0x11871e})['then'](handleEntityNotFound(_0x22223d,null))[_0x5559('0x13')](function(_0x38d71f){if(_0x38d71f){var _0x2bc3ca=_0x38d71f[_0x5559('0xba')]({'plain':!![]});fs[_0x5559('0xbb')](_0x87671b);var _0x2f57cd={'channel':_0x5559('0xbc'),'account':_0x2bc3ca[_0x5559('0xb9')]['name'],'agent':_0x2bc3ca['Owner']?_0x2bc3ca[_0x5559('0xbd')][_0x5559('0x8a')]:'N.A.','createdAt':moment(_0x2bc3ca[_0x5559('0x8b')])[_0x5559('0x7c')](_0x5559('0xa4'))['toString'](),'closedAt':_0x2bc3ca[_0x5559('0x69')]?moment(_0x2bc3ca[_0x5559('0xbe')])[_0x5559('0x7c')](_0x5559('0xa4'))[_0x5559('0xbf')]():'','disposition':_0x2bc3ca[_0x5559('0x6a')],'chatInfo':{'browser':_0x2bc3ca[_0x5559('0xc0')],'os':_0x2bc3ca[_0x5559('0xc1')],'referer':_0x2bc3ca[_0x5559('0xc2')],'customerIp':_0x2bc3ca[_0x5559('0xc3')],'customerPort':_0x2bc3ca[_0x5559('0xc4')]?_0x2bc3ca[_0x5559('0xc4')]:_0x5559('0xc5')},'messages':_(_0x2bc3ca['Messages'])[_0x5559('0xc6')]()[_0x5559('0xa1')]({'secret':![]})['map'](function(_0x47cf76){if(_0x47cf76[_0x5559('0x71')]){var _0x4a2b7c=path['join'](_0x2c3458,_0x47cf76['Attachment'][_0x5559('0x6e')]);if(fs[_0x5559('0xc7')](_0x4a2b7c)){fs[_0x5559('0xc8')](_0x4a2b7c)['pipe'](fs['createWriteStream'](path[_0x5559('0x75')](_0x87671b,_0x47cf76[_0x5559('0x71')][_0x5559('0x6e')])));}}return{'date':moment(_0x47cf76[_0x5559('0x8b')])[_0x5559('0x7c')](_0x5559('0xa4'))[_0x5559('0xbf')](),'sender':_0x47cf76[_0x5559('0x8d')]===_0x5559('0x5f')?_0x47cf76[_0x5559('0x80')]?_0x47cf76[_0x5559('0x80')][_0x5559('0x8a')]:_0x5559('0x84'):_0x47cf76['Contact'][_0x5559('0xc9')]+(_0x47cf76['Contact']['lastName']?'\x20'+_0x47cf76[_0x5559('0x64')][_0x5559('0xb7')]:''),'body':_0x47cf76[_0x5559('0x71')]?_0x47cf76[_0x5559('0x71')][_0x5559('0x6e')]:_0x47cf76[_0x5559('0x49')],'direction':_0x47cf76[_0x5559('0x8d')]===_0x5559('0x5f')?'A':'C','secret':_0x47cf76[_0x5559('0xa8')],'read':_0x47cf76[_0x5559('0xb8')],'attachment':_0x47cf76[_0x5559('0x71')]};})[_0x5559('0xca')]()};return ejs['renderFile'](path[_0x5559('0x75')](config[_0x5559('0x76')],_0x5559('0xb2'),_0x5559('0xcb'),_0x5559('0xcc')),{'interaction':_0x2f57cd})['then'](function(_0x4e87d0){var _0x62bc7a=path[_0x5559('0x75')](_0x87671b,_0x5559('0xcd')+_0x2bc3ca['id']+'-'+_0x52850a+_0x5559('0xce'));var _0x2749d0={'path':_0x62bc7a,'channel':_0x5559('0xbc'),'interactionId':_0x2bc3ca['id']};return pdf[_0x5559('0xcf')](_0x4e87d0,_0x2749d0);})[_0x5559('0x13')](function(){return new Promise(function(_0x27dae7,_0x548a9f){zipdir(_0x87671b,{'saveTo':_0x3ad6d8},function(_0x214e80,_0x35ea2c){if(_0x214e80)return _0x548a9f(_0x214e80);return _0x27dae7(_0x35ea2c);});})['then'](function(){return new BPromise(function(_0x141bce,_0x3c417f){rimraf(_0x87671b,function(_0x503bf6){if(_0x503bf6)_0x3c417f(_0x503bf6);return _0x141bce();});});})[_0x5559('0x13')](function(){return _0x22223d[_0x5559('0x79')](_0x3ad6d8,_0x137db3,function(_0x432c95){if(_0x432c95){logger[_0x5559('0x18')](_0x5559('0xd0'),_0x432c95);}else{fs[_0x5559('0xd1')](_0x3ad6d8);}});});});}else{return _0x22223d['sendStatus'](0xc8);}})[_0x5559('0x1d')](handleError(_0x22223d,null));}; \ No newline at end of file +var _0xfff7=['Chat','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','out','Contact','lastName','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','redis','./chatInteraction.socket','register','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','destroy','then','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','fieldName','type','key','findAll','chat','query','user','show','params','keys','rawAttributes','filters','intersection','attributes','model','fields','length','includeAll','include','options','ChatInteraction','find','create','update','describe','ChatWebsite','findOne','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooEscalation','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','closed','disposition','attachmentUpload','file','originalname','basename','filename','mimetype','Unauthorized','Attachment','ChatOfflineMessageId','join','root','server/files/attachments/','download','close','server/files/chat/upload/','format','now','pathTranscript','Messages','User','CmContact','%s%d','agentAlias','customer','ContactId','agentIdentifier','agent_alias','alias','System','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','mailTranscript','ids','getMessages','hasOwnProperty','sort','pick','where','ChatInteractionId','filter','$gte','split','count','rows','nolimit','order','includeAgent','push','setTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','createdAt','read','Owner','get','mkdirSync'];(function(_0x5c6bc9,_0x4276f7){var _0x5b1fa5=function(_0x351e82){while(--_0x351e82){_0x5c6bc9['push'](_0x5c6bc9['shift']());}};_0x5b1fa5(++_0x4276f7);}(_0xfff7,0x1b5));var _0x7fff=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfff7[_0x122ef9];return _0x42fba0;};'use strict';var rimraf=require(_0x7fff('0x0'));var zipdir=require(_0x7fff('0x1'));var rp=require(_0x7fff('0x2'));var moment=require(_0x7fff('0x3'));var BPromise=require(_0x7fff('0x4'));var Mustache=require(_0x7fff('0x5'));var util=require(_0x7fff('0x6'));var path=require(_0x7fff('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7fff('0x8'));var Redis=require(_0x7fff('0x9'));var interaction=require(_0x7fff('0xa'));var qs=require(_0x7fff('0xb'));var pdf=require(_0x7fff('0xc'));var logger=require(_0x7fff('0xd'))(_0x7fff('0xe'));var config=require(_0x7fff('0xf'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7fff('0x10')](config[_0x7fff('0x11')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7fff('0x11')]));require(_0x7fff('0x12'))[_0x7fff('0x13')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7fff('0x14')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3173c9,_0x23cab8,_0x2009df,_0x55a2d5){return new BPromise(function(_0x2fef2d,_0x5e9446){var _0x34dc86=_0x55a2d5||client;return _0x34dc86[_0x7fff('0x15')](_0x3173c9,_0x2009df)['then'](function(_0x1a7cb8){logger[_0x7fff('0x16')](_0x7fff('0x17'),_0x23cab8,_0x7fff('0x18'));logger[_0x7fff('0x19')](_0x7fff('0x1a'),_0x23cab8,_0x7fff('0x18'),JSON['stringify'](_0x1a7cb8));if(_0x1a7cb8[_0x7fff('0x1b')]){if(_0x1a7cb8[_0x7fff('0x1b')][_0x7fff('0x1c')]===0x1f4){logger[_0x7fff('0x1b')](_0x7fff('0x17'),_0x23cab8,_0x1a7cb8[_0x7fff('0x1b')]['message']);return _0x5e9446(_0x1a7cb8[_0x7fff('0x1b')][_0x7fff('0x1d')]);}logger[_0x7fff('0x1b')](_0x7fff('0x17'),_0x23cab8,_0x1a7cb8[_0x7fff('0x1b')][_0x7fff('0x1d')]);return _0x2fef2d(_0x1a7cb8[_0x7fff('0x1b')][_0x7fff('0x1d')]);}else{logger['info'](_0x7fff('0x17'),_0x23cab8,_0x7fff('0x18'));_0x2fef2d(_0x1a7cb8['result']['message']);}})[_0x7fff('0x1e')](function(_0x2473f6){logger[_0x7fff('0x1b')](_0x7fff('0x17'),_0x23cab8,_0x2473f6);_0x5e9446(_0x2473f6);});});}function respondWithStatusCode(_0x408b8b,_0xe00102){_0xe00102=_0xe00102||0xcc;return function(_0x1c21db){if(_0x1c21db){return _0x408b8b[_0x7fff('0x1f')](_0xe00102);}return _0x408b8b[_0x7fff('0x20')](_0xe00102)[_0x7fff('0x21')]();};}function respondWithResult(_0x3b3300,_0x1cbc11){_0x1cbc11=_0x1cbc11||0xc8;return function(_0x594cdc){if(_0x594cdc){return _0x3b3300[_0x7fff('0x20')](_0x1cbc11)[_0x7fff('0x22')](_0x594cdc);}};}function respondWithFilteredResult(_0x496645,_0x4c19ef){return function(_0xc8c6af){if(_0xc8c6af){var _0x391611=typeof _0x4c19ef[_0x7fff('0x23')]===_0x7fff('0x24')&&typeof _0x4c19ef[_0x7fff('0x25')]===_0x7fff('0x24');var _0x26ac9c=_0xc8c6af['count'];var _0x2e0b3f=_0x391611?0x0:_0x4c19ef[_0x7fff('0x23')];var _0x490aea=_0x391611?_0xc8c6af['count']:_0x4c19ef[_0x7fff('0x23')]+_0x4c19ef[_0x7fff('0x25')];var _0x2a8fdf;if(_0x490aea>=_0x26ac9c){_0x490aea=_0x26ac9c;_0x2a8fdf=0xc8;}else{_0x2a8fdf=0xce;}_0x496645['status'](_0x2a8fdf);return _0x496645[_0x7fff('0x26')](_0x7fff('0x27'),_0x2e0b3f+'-'+_0x490aea+'/'+_0x26ac9c)['json'](_0xc8c6af);}return null;};}function saveUpdates(_0x49e7b3){return function(_0x1349f1){if(_0x1349f1){return _0x1349f1['update'](_0x49e7b3)['then'](function(_0x3cf50c){return _0x3cf50c;});}return null;};}function removeEntity(_0x281d73){return function(_0x514496){if(_0x514496){return _0x514496[_0x7fff('0x28')]()[_0x7fff('0x29')](function(){_0x281d73[_0x7fff('0x20')](0xcc)[_0x7fff('0x21')]();});}};}function handleEntityNotFound(_0x1b9b0b){return function(_0x12dd0b){if(!_0x12dd0b){_0x1b9b0b[_0x7fff('0x1f')](0x194);}return _0x12dd0b;};}function handleError(_0xd7b598,_0x168748){_0x168748=_0x168748||0x1f4;return function(_0x45910e){logger[_0x7fff('0x1b')](_0x45910e[_0x7fff('0x2a')]);if(_0x45910e[_0x7fff('0x2b')]){delete _0x45910e[_0x7fff('0x2b')];}_0xd7b598[_0x7fff('0x20')](_0x168748)[_0x7fff('0x2c')](_0x45910e);};}function getMustacheRender(_0x31aa1e,_0xbe71d8){return Mustache[_0x7fff('0x2d')](_0x31aa1e,_[_0x7fff('0x2e')](_0xbe71d8[_0x7fff('0x2f')],{'contact':_0xbe71d8[_0x7fff('0x30')],'message':_0xbe71d8['message'],'agent':_0xbe71d8[_0x7fff('0x31')],'interaction':_0xbe71d8[_0x7fff('0x32')],'account':_0xbe71d8[_0x7fff('0x33')]}))||'';}exports[_0x7fff('0x34')]=function(_0x2f785a,_0x485d2f){var _0x3fd41e={};var _0x3f0c9c=_[_0x7fff('0x35')](db['ChatInteraction']['rawAttributes'],function(_0x15e0b3){return{'name':_0x15e0b3[_0x7fff('0x36')],'type':_0x15e0b3[_0x7fff('0x37')][_0x7fff('0x38')]};});_0x3fd41e=qs['getOptions'](_0x3f0c9c,_0x2f785a);return interaction[_0x7fff('0x39')](_0x7fff('0x3a'),_0x2f785a[_0x7fff('0x3b')],_0x2f785a[_0x7fff('0x3c')],_0x3fd41e,_0x3f0c9c)['then'](respondWithFilteredResult(_0x485d2f,_0x3fd41e))['catch'](handleError(_0x485d2f,null));};exports[_0x7fff('0x3d')]=function(_0x155eac,_0x33ce23){var _0xec44={'raw':![],'where':{'id':_0x155eac[_0x7fff('0x3e')]['id']}},_0x5e33f8={};_0x5e33f8['model']=_[_0x7fff('0x3f')](db['ChatInteraction'][_0x7fff('0x40')]);_0x5e33f8[_0x7fff('0x3b')]=_['keys'](_0x155eac['query']);_0x5e33f8[_0x7fff('0x41')]=_[_0x7fff('0x42')](_0x5e33f8['model'],_0x5e33f8['query']);_0xec44[_0x7fff('0x43')]=_['intersection'](_0x5e33f8[_0x7fff('0x44')],qs[_0x7fff('0x45')](_0x155eac['query'][_0x7fff('0x45')]));_0xec44[_0x7fff('0x43')]=_0xec44[_0x7fff('0x43')][_0x7fff('0x46')]?_0xec44[_0x7fff('0x43')]:_0x5e33f8[_0x7fff('0x44')];if(_0x155eac[_0x7fff('0x3b')][_0x7fff('0x47')]){_0xec44[_0x7fff('0x48')]=[{'all':!![]}];}_0xec44=_['merge']({},_0xec44,_0x155eac[_0x7fff('0x49')]);return db[_0x7fff('0x4a')][_0x7fff('0x4b')](_0xec44)[_0x7fff('0x29')](handleEntityNotFound(_0x33ce23,null))[_0x7fff('0x29')](respondWithResult(_0x33ce23,null))[_0x7fff('0x1e')](handleError(_0x33ce23,null));};exports[_0x7fff('0x4c')]=function(_0x21c33b,_0x3c7f28){return db['ChatInteraction'][_0x7fff('0x4c')](_0x21c33b[_0x7fff('0x2f')],{})[_0x7fff('0x29')](respondWithResult(_0x3c7f28,0xc9))[_0x7fff('0x1e')](handleError(_0x3c7f28,null));};exports[_0x7fff('0x4d')]=function(_0x343ec3,_0x428d59){if(_0x343ec3[_0x7fff('0x2f')]['id']){delete _0x343ec3['body']['id'];}return db['ChatInteraction'][_0x7fff('0x4b')]({'where':{'id':_0x343ec3[_0x7fff('0x3e')]['id']}})['then'](handleEntityNotFound(_0x428d59,null))['then'](saveUpdates(_0x343ec3[_0x7fff('0x2f')],null))[_0x7fff('0x29')](respondWithResult(_0x428d59,null))[_0x7fff('0x1e')](handleError(_0x428d59,null));};exports[_0x7fff('0x28')]=function(_0x3c55f8,_0x447bdb){return db[_0x7fff('0x4a')][_0x7fff('0x4b')]({'where':{'id':_0x3c55f8[_0x7fff('0x3e')]['id']}})[_0x7fff('0x29')](handleEntityNotFound(_0x447bdb,null))['then'](removeEntity(_0x447bdb,null))['catch'](handleError(_0x447bdb,null));};exports[_0x7fff('0x4e')]=function(_0x28cfea,_0x2dc272){return db[_0x7fff('0x4a')]['describe']()[_0x7fff('0x29')](respondWithResult(_0x2dc272,null))[_0x7fff('0x1e')](handleError(_0x2dc272,null));};exports['createVidaooSession']=function(_0x2bf4a6,_0x55fa3e){var _0x292e93=_0x2bf4a6['params']['id'];var _0x1bf1d0;var _0x14426f;var _0x5c0961;return db[_0x7fff('0x4a')]['findOne']({'where':{'id':_0x292e93}})['then'](function(_0x36f3a4){_0x1bf1d0=_0x36f3a4;return db[_0x7fff('0x4f')][_0x7fff('0x50')]({'where':{'id':_0x36f3a4[_0x7fff('0x51')]},'attributes':['id',_0x7fff('0x52'),'vidaooEscalation',_0x7fff('0x53'),_0x7fff('0x54'),'vidaooMetadata'],'raw':!![]});})[_0x7fff('0x29')](function(_0x594e1b){if(_0x594e1b&&_0x594e1b[_0x7fff('0x52')]&&_0x594e1b[_0x7fff('0x55')]){_0x14426f=_0x594e1b;var _0x3396d2={'interaction':{'id':_0x292e93},'agent':{'id':_0x2bf4a6[_0x7fff('0x3c')]['id'],'name':_0x2bf4a6[_0x7fff('0x3c')][_0x7fff('0x2b')],'fullname':_0x2bf4a6[_0x7fff('0x3c')][_0x7fff('0x56')],'email':_0x2bf4a6[_0x7fff('0x3c')][_0x7fff('0x57')]},'contact':_0x2bf4a6[_0x7fff('0x2f')][_0x7fff('0x30')],'account':_0x2bf4a6[_0x7fff('0x2f')][_0x7fff('0x33')]};var _0x5929c1={'rejectUnauthorized':![],'method':_0x7fff('0x58'),'url':_0x7fff('0x59'),'headers':{'X-APIKEY':_0x594e1b[_0x7fff('0x52')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2bf4a6[_0x7fff('0x3c')][_0x7fff('0x57')]],'buttons':null,'topic':_0x14426f[_0x7fff('0x53')],'note':_[_0x7fff('0x5a')](_0x14426f['vidaooNote'])?null:getMustacheRender(_0x14426f['vidaooNote'],_0x3396d2),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x7fff('0x5a')](_0x14426f['vidaooMetadata'])){var _0x464a0a=getMustacheRender(_0x14426f['vidaooMetadata'],_0x3396d2);var _0xaebe30=JSON[_0x7fff('0x5b')](_0x464a0a);_0x5929c1[_0x7fff('0x2f')]['metadata']=_0xaebe30;}}catch(_0x4ac08b){throw new db['Sequelize'][(_0x7fff('0x5c'))](_0x7fff('0x5d'));}return rp(_0x5929c1);}else{throw new db['Sequelize']['ValidationError'](_0x7fff('0x5e'));}})['then'](function(_0x41ec9a){_0x5c0961=_0x41ec9a;if(_0x5c0961['id']){var _0x1a8e7e={'body':_0x5c0961['join_url'],'ChatWebsiteId':_0x14426f['id'],'ChatInteractionId':_0x1bf1d0['id'],'direction':'out','UserId':_0x2bf4a6[_0x7fff('0x3c')]['id']};return db[_0x7fff('0x5f')][_0x7fff('0x4c')](_0x1a8e7e,{});}else{throw new db[(_0x7fff('0x60'))]['ValidationError'](_0x7fff('0x61'));}})[_0x7fff('0x29')](function(){return _0x1bf1d0[_0x7fff('0x62')]({'vidaooSessionId':_0x5c0961['id']});})['then'](respondWithResult(_0x55fa3e,null))['catch'](handleError(_0x55fa3e,null));};exports[_0x7fff('0x63')]=function(_0x531331,_0x31ed3b){if(_0x531331['body']['id']){delete _0x531331[_0x7fff('0x2f')]['id'];}return db[_0x7fff('0x4a')][_0x7fff('0x4b')]({'where':{'id':_0x531331['params']['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x7fff('0x29')](handleEntityNotFound(_0x31ed3b,null))[_0x7fff('0x29')](saveUpdates(_0x531331['body'],null))['then'](respondWithResult(_0x31ed3b,null))[_0x7fff('0x1e')](handleError(_0x31ed3b,null));};exports['abandon']=function(_0x365a36,_0xc84c15){if(_0x365a36['body']['id']){delete _0x365a36[_0x7fff('0x2f')]['id'];}return db[_0x7fff('0x4a')][_0x7fff('0x4b')]({'where':{'id':_0x365a36[_0x7fff('0x3e')]['id']}})[_0x7fff('0x29')](function(_0x28d6a1){if(!_0x28d6a1){logger[_0x7fff('0x1b')](_0x7fff('0x64'),'abandon',0x194,_0x7fff('0x65'));_0xc84c15[_0x7fff('0x1f')](0x194);}else{if(_0x28d6a1[_0x7fff('0x66')]){throw new db[(_0x7fff('0x60'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x28d6a1;})[_0x7fff('0x29')](function(_0x44bffa){if(_0x44bffa){return _0x44bffa[_0x7fff('0x4d')]({'closed':_0x365a36[_0x7fff('0x2f')][_0x7fff('0x67')],'disposition':_0x365a36[_0x7fff('0x2f')][_0x7fff('0x68')]})['then'](function(_0x340022){return _0x340022;});}})[_0x7fff('0x29')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x365a36[_0x7fff('0x2f')],client9004);})[_0x7fff('0x29')](respondWithResult(_0xc84c15,null))[_0x7fff('0x1e')](handleError(_0xc84c15,null));};exports[_0x7fff('0x69')]=function(_0x1f033a,_0x406d42){_0x1f033a['body'][_0x7fff('0x2b')]=_0x1f033a[_0x7fff('0x6a')][_0x7fff('0x6b')];_0x1f033a['body'][_0x7fff('0x6c')]=_0x1f033a['file'][_0x7fff('0x6d')];_0x1f033a['body'][_0x7fff('0x37')]=_0x1f033a[_0x7fff('0x6a')][_0x7fff('0x6e')];return db['Attachment']['create'](_0x1f033a['body'])[_0x7fff('0x29')](respondWithResult(_0x406d42,0xc9))[_0x7fff('0x1e')](handleError(_0x406d42,null));};exports['attachmentDownload']=function(_0x1fafdd,_0x53db10){return db['ChatInteraction'][_0x7fff('0x50')]({'where':{'id':_0x1fafdd['params']['id']},'raw':!![]})[_0x7fff('0x29')](handleEntityNotFound(_0x53db10,null))[_0x7fff('0x29')](function(_0x30258f){if(_0x30258f){if(_0x30258f[_0x7fff('0x67')]){return _0x53db10['status'](0x193)['json']({'status':0x193,'message':_0x7fff('0x6f')});}return db[_0x7fff('0x70')]['findOne']({'where':{'id':_0x1fafdd['query']['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x53db10,null));}})[_0x7fff('0x29')](function(_0x27ae53){if(_0x27ae53){var _0xeaf5f4=_0x27ae53[_0x7fff('0x71')]!==null;var _0x4e9124=path[_0x7fff('0x72')](config[_0x7fff('0x73')],_0x7fff('0x74'));if(_0xeaf5f4){_0x4e9124=path[_0x7fff('0x72')](_0x4e9124,'offline-chat/');}var _0x103109=path['join'](_0x4e9124,_0x27ae53[_0x7fff('0x6c')]);return _0x53db10[_0x7fff('0x75')](_0x103109);}})[_0x7fff('0x1e')](handleError(_0x53db10,null));};exports[_0x7fff('0x76')]=function(_0x131392,_0x2c552c){var _0x1a8931=null;var _0x3d367c=null;var _0x267f78=null;if(_0x131392[_0x7fff('0x2f')]['id']){delete _0x131392[_0x7fff('0x2f')]['id'];}if(_0x131392[_0x7fff('0x2f')]['mailTranscript']){_0x267f78=path[_0x7fff('0x72')](config['root'],_0x7fff('0x77'),util[_0x7fff('0x78')]('transcript-%s.txt',Date[_0x7fff('0x79')]()));_0x131392[_0x7fff('0x2f')][_0x7fff('0x7a')]=_0x267f78;}return db[_0x7fff('0x4a')][_0x7fff('0x4b')]({'where':{'id':_0x131392[_0x7fff('0x3e')]['id']},'include':[{'model':db[_0x7fff('0x5f')],'as':_0x7fff('0x7b'),'include':[{'model':db[_0x7fff('0x7c')],'as':_0x7fff('0x7c')}]}]})[_0x7fff('0x29')](handleEntityNotFound(_0x2c552c,null))[_0x7fff('0x29')](saveUpdates(_0x131392[_0x7fff('0x2f')],null))['then'](function(_0x3d991c){if(_0x3d991c){_0x1a8931=_0x3d991c;return db[_0x7fff('0x4f')][_0x7fff('0x4b')]({'where':{'id':_0x1a8931[_0x7fff('0x51')]}});}})[_0x7fff('0x29')](function(_0x2c76fd){if(_0x2c76fd){_0x3d367c=_0x2c76fd;return db[_0x7fff('0x7d')][_0x7fff('0x4b')]({'where':{'id':_0x1a8931['ContactId']}});}})[_0x7fff('0x29')](function(_0x2cdc5b){if(_0x2cdc5b){if(_0x267f78){var _0x44fd2c=null;for(var _0xdc32dd=0x1;_0xdc32dd<_0x1a8931['Messages'][_0x7fff('0x46')];++_0xdc32dd){_0x44fd2c=_0x1a8931[_0x7fff('0x7b')][_0xdc32dd];var _0x5ef227=_0x44fd2c['UserId']?util[_0x7fff('0x78')](_0x7fff('0x7e'),_0x3d367c[_0x7fff('0x7f')],_0x44fd2c[_0x7fff('0x66')]):'System';var _0x2054c6=_0x131392[_0x7fff('0x2f')][_0x7fff('0x80')]||util[_0x7fff('0x78')](_0x7fff('0x7e'),'Visitor',_0x44fd2c[_0x7fff('0x81')]);switch(_0x3d367c[_0x7fff('0x82')]){case'website_alias':_0x5ef227=_0x44fd2c[_0x7fff('0x66')]?util['format'](_0x7fff('0x7e'),_0x3d367c[_0x7fff('0x7f')],_0x44fd2c['UserId']):'System';break;case _0x7fff('0x83'):_0x5ef227=_0x44fd2c[_0x7fff('0x66')]?_0x44fd2c[_0x7fff('0x7c')][_0x7fff('0x84')]||_0x44fd2c[_0x7fff('0x7c')][_0x7fff('0x56')]:_0x7fff('0x85');break;case'agent_fullname':_0x5ef227=_0x44fd2c[_0x7fff('0x66')]?_0x44fd2c['User'][_0x7fff('0x56')]:_0x7fff('0x85');break;default:_0x5ef227=_0x44fd2c[_0x7fff('0x66')]?util['format'](_0x7fff('0x7e'),_0x3d367c[_0x7fff('0x7f')],_0x44fd2c[_0x7fff('0x66')]):_0x7fff('0x85');}var _0x23ba0c=util[_0x7fff('0x78')](_0x7fff('0x86'),moment(_0x44fd2c['createdAt'])[_0x7fff('0x78')]('MM/DD/YYYY\x20HH:mm:ss'),_0x44fd2c[_0x7fff('0x87')]==='in'?_0x2054c6:_0x5ef227,_0x44fd2c[_0x7fff('0x2f')]);if(!_0x44fd2c[_0x7fff('0x88')]){fs[_0x7fff('0x89')](_0x267f78,_0x23ba0c);}}return db[_0x7fff('0x8a')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x7fff('0x8b')],'as':_0x7fff('0x8c'),'raw':!![],'include':[{'model':db[_0x7fff('0x8d')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x7fff('0x29')](function(_0x13c07e){if(!_0x13c07e||!_0x13c07e['Smtp']||!_0x131392[_0x7fff('0x2f')])return _0x1a8931;var _0x4381df=_0x13c07e['getSmtpOptions']();return respondWithRpcPromise(_0x7fff('0x8e'),_0x7fff('0x8f'),{'account':_0x4381df,'message':{'from':util[_0x7fff('0x78')](_0x7fff('0x90'),_0x13c07e[_0x7fff('0x2b')],_0x13c07e[_0x7fff('0x57')]||_0x13c07e[_0x7fff('0x8c')][_0x7fff('0x3c')]),'to':_0x131392['body']['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x7fff('0x78')](_0x7fff('0x91'),_0x131392[_0x7fff('0x2f')][_0x7fff('0x92')]),'attachments':[{'path':_0x267f78}]}})[_0x7fff('0x29')](function(){return _0x1a8931;})[_0x7fff('0x1e')](function(_0x5f7bb0){logger[_0x7fff('0x1b')](_0x5f7bb0);});})[_0x7fff('0x29')](respondWithStatusCode(_0x2c552c,0xc8))['catch'](handleError(_0x2c552c,null));};exports['addMessage']=function(_0x5f5ad3,_0x17dbc2){return db[_0x7fff('0x5f')]['find']({'where':{'id':_0x5f5ad3[_0x7fff('0x3e')]['id']}})[_0x7fff('0x29')](handleEntityNotFound(_0x17dbc2,null))[_0x7fff('0x29')](function(_0x2b88d4){if(_0x2b88d4){return _0x2b88d4['addMessage'](_0x5f5ad3['body'][_0x7fff('0x93')],_['omit'](_0x5f5ad3['body'],['ids','id'])||{});}})[_0x7fff('0x29')](respondWithResult(_0x17dbc2,null))[_0x7fff('0x1e')](handleError(_0x17dbc2,null));};exports[_0x7fff('0x94')]=function(_0x4f0e51,_0x54b4e2){var _0x1771ad={'raw':![],'where':{}};var _0x406aa6={};var _0x607e4d={'count':0x0,'rows':[]};return db[_0x7fff('0x4a')]['findOne']({'where':{'id':_0x4f0e51['params']['id']}})[_0x7fff('0x29')](handleEntityNotFound(_0x54b4e2,null))[_0x7fff('0x29')](function(_0x22a481){if(_0x22a481){_0x406aa6[_0x7fff('0x44')]=_[_0x7fff('0x3f')](db['ChatMessage'][_0x7fff('0x40')]);_0x406aa6[_0x7fff('0x3b')]=_[_0x7fff('0x3f')](_0x4f0e51['query']);_0x406aa6[_0x7fff('0x41')]=_[_0x7fff('0x42')](_0x406aa6[_0x7fff('0x44')],_0x406aa6[_0x7fff('0x3b')]);_0x1771ad[_0x7fff('0x43')]=_[_0x7fff('0x42')](_0x406aa6[_0x7fff('0x44')],qs['fields'](_0x4f0e51[_0x7fff('0x3b')][_0x7fff('0x45')]));_0x1771ad[_0x7fff('0x43')]=_0x1771ad['attributes'][_0x7fff('0x46')]?_0x1771ad[_0x7fff('0x43')]:_0x406aa6[_0x7fff('0x44')];if(!_0x4f0e51[_0x7fff('0x3b')][_0x7fff('0x95')]('nolimit')){_0x1771ad[_0x7fff('0x25')]=qs['limit'](_0x4f0e51['query'][_0x7fff('0x25')]);_0x1771ad['offset']=qs[_0x7fff('0x23')](_0x4f0e51[_0x7fff('0x3b')][_0x7fff('0x23')]);}_0x1771ad['order']=qs['sort'](_0x4f0e51[_0x7fff('0x3b')][_0x7fff('0x96')]);_0x1771ad['where']=qs[_0x7fff('0x41')](_[_0x7fff('0x97')](_0x4f0e51[_0x7fff('0x3b')],_0x406aa6[_0x7fff('0x41')]));_0x1771ad[_0x7fff('0x98')][_0x7fff('0x99')]=_0x22a481['id'];if(_0x4f0e51[_0x7fff('0x3b')][_0x7fff('0x9a')]){_0x1771ad[_0x7fff('0x98')]=_['merge'](_0x1771ad[_0x7fff('0x98')],{'$or':_[_0x7fff('0x35')](_0x1771ad[_0x7fff('0x43')],function(_0x6f67ce){var _0x5083c7={};_0x5083c7[_0x6f67ce]={'$like':'%'+_0x4f0e51[_0x7fff('0x3b')][_0x7fff('0x9a')]+'%'};return _0x5083c7;})});}if(_0x4f0e51['query'][_0x7fff('0x9b')]){var _0x1ae7ee=_0x4f0e51[_0x7fff('0x3b')]['$gte'][_0x7fff('0x9c')](',');var _0x58d4de={};_0x58d4de[_0x1ae7ee[0x0]]={'$gte':moment(_0x1ae7ee[0x1])[_0x7fff('0x78')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1771ad[_0x7fff('0x98')]=_[_0x7fff('0x2e')](_0x1771ad[_0x7fff('0x98')],_0x58d4de);}_0x1771ad=_[_0x7fff('0x2e')]({},_0x1771ad,_0x4f0e51[_0x7fff('0x49')]);return db['ChatMessage']['count']({'where':_0x1771ad[_0x7fff('0x98')]})[_0x7fff('0x29')](function(_0x3c6fdd){_0x607e4d[_0x7fff('0x9d')]=_0x3c6fdd;if(_0x4f0e51[_0x7fff('0x3b')][_0x7fff('0x47')]){_0x1771ad[_0x7fff('0x48')]=[{'all':!![]}];}return db[_0x7fff('0x5f')][_0x7fff('0x39')](_0x1771ad);})['then'](function(_0x5668b9){_0x607e4d[_0x7fff('0x9e')]=_0x5668b9;return _0x607e4d;});}})['then'](respondWithFilteredResult(_0x54b4e2,_0x1771ad))[_0x7fff('0x1e')](handleError(_0x54b4e2,null));};exports['getMyMessages']=function(_0x4afdbc,_0x1a5b16){var _0x267ed2={'where':{}},_0x1e4c7f={},_0x5d7cb7={'count':0x0,'rows':[]};return db[_0x7fff('0x4a')][_0x7fff('0x50')]({'where':{'id':_0x4afdbc['params']['id']}})[_0x7fff('0x29')](handleEntityNotFound(_0x1a5b16,null))[_0x7fff('0x29')](function(_0x301788){if(_0x301788){_0x1e4c7f['model']=_['keys'](db['ChatMessage'][_0x7fff('0x40')]);_0x1e4c7f[_0x7fff('0x3b')]=_[_0x7fff('0x3f')](_0x4afdbc[_0x7fff('0x3b')]);_0x1e4c7f[_0x7fff('0x41')]=_[_0x7fff('0x42')](_0x1e4c7f[_0x7fff('0x44')],_0x1e4c7f[_0x7fff('0x3b')]);_0x267ed2['attributes']=_[_0x7fff('0x42')](_0x1e4c7f[_0x7fff('0x44')],qs['fields'](_0x4afdbc[_0x7fff('0x3b')]['fields']));_0x267ed2['attributes']=_0x267ed2[_0x7fff('0x43')][_0x7fff('0x46')]?_0x267ed2[_0x7fff('0x43')]:_0x1e4c7f[_0x7fff('0x44')];if(!_0x4afdbc[_0x7fff('0x3b')]['hasOwnProperty'](_0x7fff('0x9f'))){_0x267ed2['limit']=qs['limit'](_0x4afdbc[_0x7fff('0x3b')]['limit']);_0x267ed2['offset']=qs[_0x7fff('0x23')](_0x4afdbc[_0x7fff('0x3b')][_0x7fff('0x23')]);}_0x267ed2[_0x7fff('0xa0')]=qs[_0x7fff('0x96')](_0x4afdbc[_0x7fff('0x3b')][_0x7fff('0x96')]);_0x267ed2[_0x7fff('0x98')]=qs[_0x7fff('0x41')](_[_0x7fff('0x97')](_0x4afdbc[_0x7fff('0x3b')],_0x1e4c7f['filters']));_0x267ed2['where'][_0x7fff('0x99')]=_0x301788['id'];if(_0x4afdbc[_0x7fff('0x3b')][_0x7fff('0x9a')]){_0x267ed2[_0x7fff('0x98')]=_[_0x7fff('0x2e')](_0x267ed2['where'],{'$or':_['map'](_0x267ed2[_0x7fff('0x43')],function(_0x472859){var _0x3d5ff8={};_0x3d5ff8[_0x472859]={'$like':'%'+_0x4afdbc[_0x7fff('0x3b')][_0x7fff('0x9a')]+'%'};return _0x3d5ff8;})});}_0x267ed2[_0x7fff('0x98')]['secret']=![];if(_0x4afdbc[_0x7fff('0x3b')]['id']){_0x267ed2[_0x7fff('0x98')]['id']={'$gt':_0x4afdbc['query']['id']};}_0x267ed2=_[_0x7fff('0x2e')]({},_0x267ed2,_0x4afdbc[_0x7fff('0x49')]);return db[_0x7fff('0x5f')][_0x7fff('0x9d')]({'where':_0x267ed2[_0x7fff('0x98')]})['then'](function(_0x2f2ac7){_0x5d7cb7['count']=_0x2f2ac7;_0x267ed2[_0x7fff('0x48')]=[];if(_0x4afdbc[_0x7fff('0x3b')][_0x7fff('0xa1')]){_0x267ed2[_0x7fff('0x48')][_0x7fff('0xa2')]({'model':db['User'],'as':_0x7fff('0x7c'),'attributes':['id',_0x7fff('0x56'),_0x7fff('0x84')]});}if(_0x4afdbc['query']['includeAll']){_0x267ed2[_0x7fff('0x48')]=[{'all':!![]}];}return db[_0x7fff('0x5f')][_0x7fff('0x39')](_0x267ed2);})['then'](function(_0x4a8f98){_0x5d7cb7[_0x7fff('0x9e')]=_0x4a8f98;return _0x5d7cb7;});}})['then'](respondWithFilteredResult(_0x1a5b16,_0x267ed2))[_0x7fff('0x1e')](handleError(_0x1a5b16,null));};exports['addTags']=function(_0x4b1dcd,_0x520b84){return db[_0x7fff('0x4a')][_0x7fff('0x4b')]({'where':{'id':_0x4b1dcd[_0x7fff('0x3e')]['id']}})[_0x7fff('0x29')](handleEntityNotFound(_0x520b84,null))[_0x7fff('0x29')](function(_0x43fb79){if(_0x43fb79){return _0x43fb79[_0x7fff('0xa3')](_0x4b1dcd['body']['ids'],_[_0x7fff('0xa4')](_0x4b1dcd['body'],[_0x7fff('0x93'),'id'])||{})[_0x7fff('0xa5')](function(){return db[_0x7fff('0xa6')]['findAll']({'attributes':['id',_0x7fff('0x2b'),_0x7fff('0xa7')],'where':{'id':_0x4b1dcd[_0x7fff('0x2f')][_0x7fff('0x93')]}});})['then'](function(_0x2e47ae){socket[_0x7fff('0xa8')](_0x7fff('0xa9'),{'id':Number(_0x4b1dcd[_0x7fff('0x3e')]['id']),'tags':_0x2e47ae||[]});return{'id':Number(_0x4b1dcd[_0x7fff('0x3e')]['id']),'tags':_0x2e47ae||[]};});}})[_0x7fff('0x29')](respondWithResult(_0x520b84,null))[_0x7fff('0x1e')](handleError(_0x520b84,null));};exports[_0x7fff('0xaa')]=function(_0x4db5de,_0x85136b){return db['ChatInteraction'][_0x7fff('0x4b')]({'where':{'id':_0x4db5de[_0x7fff('0x3e')]['id']}})[_0x7fff('0x29')](handleEntityNotFound(_0x85136b,null))[_0x7fff('0x29')](function(_0x5ab450){if(_0x5ab450){return _0x5ab450['removeTags'](_0x4db5de[_0x7fff('0x3b')][_0x7fff('0x93')]);}})[_0x7fff('0x29')](respondWithStatusCode(_0x85136b,null))[_0x7fff('0x1e')](handleError(_0x85136b,null));};exports[_0x7fff('0x75')]=function(_0x3cf840,_0x261a43){var _0x1b4479=moment()[_0x7fff('0xab')]()[_0x7fff('0xac')]();var _0x1c30f4=path['join'](config[_0x7fff('0x73')],_0x7fff('0xad'),'files',_0x7fff('0xae'));var _0x24c334=path[_0x7fff('0x72')](config['root'],_0x7fff('0xad'),_0x7fff('0xaf'),_0x7fff('0xb0'));var _0x50be2e=path['join'](_0x1c30f4,_0x1b4479);var _0x2622da=util['format'](_0x7fff('0xb1'),_0x3cf840['params']['id'],_0x1b4479);var _0x159c79=path[_0x7fff('0x72')](_0x1c30f4,_0x2622da);var _0x21b94e=[];_0x21b94e[_0x7fff('0xa2')]({'model':db['User'],'as':_0x7fff('0x7c'),'attributes':['id',_0x7fff('0x56')],'raw':!![]});_0x21b94e['push']({'model':db[_0x7fff('0x7d')],'as':'Contact','attributes':['id',_0x7fff('0xb2'),'lastName'],'raw':!![]});if(_0x3cf840['query'][_0x7fff('0xb0')]){_0x21b94e[_0x7fff('0xa2')]({'model':db[_0x7fff('0x70')],'as':'Attachment','raw':!![]});}var _0x33ba6a=[{'model':db[_0x7fff('0x5f')],'as':'Messages','attributes':['id',_0x7fff('0x2f'),_0x7fff('0xb3'),_0x7fff('0x87'),_0x7fff('0x88'),_0x7fff('0xb4')],'include':_0x21b94e}];_0x33ba6a[_0x7fff('0xa2')]({'model':db[_0x7fff('0x4f')],'as':'Account','attributes':['id',_0x7fff('0x2b')]});_0x33ba6a['push']({'model':db[_0x7fff('0x7c')],'as':_0x7fff('0xb5'),'attributes':['id',_0x7fff('0x56')]});return db[_0x7fff('0x4a')][_0x7fff('0x4b')]({'where':{'id':_0x3cf840[_0x7fff('0x3e')]['id']},'include':_0x33ba6a})[_0x7fff('0x29')](handleEntityNotFound(_0x261a43,null))[_0x7fff('0x29')](function(_0x3f17bd){if(_0x3f17bd){var _0x1b3581=_0x3f17bd[_0x7fff('0xb6')]({'plain':!![]});fs[_0x7fff('0xb7')](_0x50be2e);var _0x4bc558={'channel':_0x7fff('0xb8'),'account':_0x1b3581[_0x7fff('0xb9')]['name'],'agent':_0x1b3581[_0x7fff('0xb5')]?_0x1b3581[_0x7fff('0xb5')]['fullname']:_0x7fff('0xba'),'createdAt':moment(_0x1b3581['createdAt'])[_0x7fff('0x78')](_0x7fff('0xbb'))['toString'](),'closedAt':_0x1b3581[_0x7fff('0x67')]?moment(_0x1b3581[_0x7fff('0xbc')])['format'](_0x7fff('0xbb'))['toString']():'','disposition':_0x1b3581[_0x7fff('0x68')],'chatInfo':{'browser':_0x1b3581[_0x7fff('0xbd')],'os':_0x1b3581[_0x7fff('0xbe')],'referer':_0x1b3581[_0x7fff('0xbf')],'customerIp':_0x1b3581[_0x7fff('0xc0')],'customerPort':_0x1b3581[_0x7fff('0xc1')]?_0x1b3581['customerPort']:_0x7fff('0xba')},'messages':_(_0x1b3581[_0x7fff('0x7b')])[_0x7fff('0xc2')]()['filter']({'secret':![]})[_0x7fff('0x35')](function(_0x1bc8ab){if(_0x1bc8ab['Attachment']){var _0x2b2d71=path[_0x7fff('0x72')](_0x24c334,_0x1bc8ab['Attachment'][_0x7fff('0x6c')]);if(fs[_0x7fff('0xc3')](_0x2b2d71)){fs['createReadStream'](_0x2b2d71)[_0x7fff('0xc4')](fs[_0x7fff('0xc5')](path['join'](_0x50be2e,_0x1bc8ab[_0x7fff('0x70')][_0x7fff('0x6c')])));}}return{'date':moment(_0x1bc8ab[_0x7fff('0xb3')])[_0x7fff('0x78')](_0x7fff('0xbb'))[_0x7fff('0xac')](),'sender':_0x1bc8ab[_0x7fff('0x87')]===_0x7fff('0xc6')?_0x1bc8ab['User']?_0x1bc8ab[_0x7fff('0x7c')]['fullname']:_0x7fff('0x85'):_0x1bc8ab[_0x7fff('0xc7')][_0x7fff('0xb2')]+(_0x1bc8ab[_0x7fff('0xc7')][_0x7fff('0xc8')]?'\x20'+_0x1bc8ab[_0x7fff('0xc7')][_0x7fff('0xc8')]:''),'body':_0x1bc8ab[_0x7fff('0x70')]?_0x1bc8ab[_0x7fff('0x70')]['basename']:_0x1bc8ab[_0x7fff('0x2f')],'direction':_0x1bc8ab[_0x7fff('0x87')]===_0x7fff('0xc6')?'A':'C','secret':_0x1bc8ab[_0x7fff('0x88')],'read':_0x1bc8ab[_0x7fff('0xb4')],'attachment':_0x1bc8ab[_0x7fff('0x70')]};})['value']()};return ejs['renderFile'](path[_0x7fff('0x72')](config[_0x7fff('0x73')],_0x7fff('0xad'),_0x7fff('0xc9'),_0x7fff('0xca')),{'interaction':_0x4bc558})['then'](function(_0x504d4d){var _0x3e1159=path['join'](_0x50be2e,_0x7fff('0xcb')+_0x1b3581['id']+'-'+_0x1b4479+_0x7fff('0xcc'));var _0x433c4e={'path':_0x3e1159,'channel':_0x7fff('0xb8'),'interactionId':_0x1b3581['id']};return pdf['createPdfFromHTML'](_0x504d4d,_0x433c4e);})[_0x7fff('0x29')](function(){return new Promise(function(_0x3ca6db,_0x1481bb){zipdir(_0x50be2e,{'saveTo':_0x159c79},function(_0x418737,_0x618339){if(_0x418737)return _0x1481bb(_0x418737);return _0x3ca6db(_0x618339);});})[_0x7fff('0x29')](function(){return new BPromise(function(_0x480ece,_0x157b7d){rimraf(_0x50be2e,function(_0x2f209d){if(_0x2f209d)_0x157b7d(_0x2f209d);return _0x480ece();});});})[_0x7fff('0x29')](function(){return _0x261a43['download'](_0x159c79,_0x2622da,function(_0x568f8b){if(_0x568f8b){logger[_0x7fff('0x1b')](_0x7fff('0xcd'),_0x568f8b);}else{fs[_0x7fff('0xce')](_0x159c79);}});});});}else{return _0x261a43['sendStatus'](0xc8);}})[_0x7fff('0x1e')](handleError(_0x261a43,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index f5ae0eb..38d6566 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 _0x3562=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x21be1a,_0x598997){var _0x2f2ab5=function(_0x3be34b){while(--_0x3be34b){_0x21be1a['push'](_0x21be1a['shift']());}};_0x2f2ab5(++_0x598997);}(_0x3562,0x19b));var _0x2356=function(_0x59df9c,_0x5668b9){_0x59df9c=_0x59df9c-0x0;var _0x248b8a=_0x3562[_0x59df9c];return _0x248b8a;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x2356('0x0'))['db'][_0x2356('0x1')];var ChatMessage=require(_0x2356('0x0'))['db'][_0x2356('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2356('0x3')](0x0);var events={'afterCreate':_0x2356('0x4'),'afterUpdate':_0x2356('0x5'),'afterDestroy':_0x2356('0x6')};function emitEvent(_0x3b7fcd){return function(_0x43e75a,_0x1bbf6a,_0x57a4b2){_0x43e75a[_0x2356('0x7')]({'attributes':['id'],'raw':!![]})[_0x2356('0x8')](function(_0x4e5da1){_0x43e75a[_0x2356('0x9')](_0x2356('0xa'),_0x4e5da1[_0x2356('0xb')](function(_0x371e38){return{'id':_0x371e38['id']};}));return ChatMessage[_0x2356('0xc')]({'where':{'ChatInteractionId':_0x43e75a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x8ad3cc){_0x43e75a[_0x2356('0x9')](_0x2356('0xd'),_0x8ad3cc[_0x2356('0xe')]);ChatInteractionEvents[_0x2356('0xf')](_0x3b7fcd+':'+_0x43e75a['id'],_0x43e75a);ChatInteractionEvents[_0x2356('0xf')](_0x3b7fcd,_0x43e75a);_0x57a4b2(null);})[_0x2356('0x10')](_0x57a4b2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x2356('0x11')](e,emitEvent(event));}}module[_0x2356('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0xec0a=['ChatMessage','setMaxListeners','update','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x218c0c,_0x2b21e3){var _0xf0347d=function(_0xb3b51c){while(--_0xb3b51c){_0x218c0c['push'](_0x218c0c['shift']());}};_0xf0347d(++_0x2b21e3);}(_0xec0a,0x17e));var _0xaec0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xec0a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xaec0('0x0'));var ChatInteraction=require(_0xaec0('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xaec0('0x1'))['db'][_0xaec0('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xaec0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaec0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f4c58){return function(_0x2e5ea7,_0x9495ef,_0x239765){_0x2e5ea7[_0xaec0('0x5')]({'attributes':['id'],'raw':!![]})[_0xaec0('0x6')](function(_0x4cbd60){_0x2e5ea7[_0xaec0('0x7')]('Users',_0x4cbd60['map'](function(_0x12db3e){return{'id':_0x12db3e['id']};}));return ChatMessage[_0xaec0('0x8')]({'where':{'ChatInteractionId':_0x2e5ea7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x8cd841){_0x2e5ea7[_0xaec0('0x7')](_0xaec0('0x9'),_0x8cd841[_0xaec0('0xa')]);ChatInteractionEvents[_0xaec0('0xb')](_0x5f4c58+':'+_0x2e5ea7['id'],_0x2e5ea7);ChatInteractionEvents[_0xaec0('0xb')](_0x5f4c58,_0x2e5ea7);_0x239765(null);})[_0xaec0('0xc')](_0x239765(null));};}for(var e in events){if(events[_0xaec0('0xd')](e)){var event=events[e];ChatInteraction[_0xaec0('0xe')](e,emitEvent(event));}}module[_0xaec0('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 4836f62..ab22805 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 _0x78b2=['exports','ChatInteraction','chat_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x450689,_0x3b857c){var _0x46ffb0=function(_0x5d3679){while(--_0x5d3679){_0x450689['push'](_0x450689['shift']());}};_0x46ffb0(++_0x3b857c);}(_0x78b2,0x1b9));var _0x278b=function(_0x15dd6b,_0x156756){_0x15dd6b=_0x15dd6b-0x0;var _0x531461=_0x78b2[_0x15dd6b];return _0x531461;};'use strict';var _=require(_0x278b('0x0'));var util=require(_0x278b('0x1'));var logger=require(_0x278b('0x2'))('api');var moment=require(_0x278b('0x3'));var BPromise=require(_0x278b('0x4'));var rp=require(_0x278b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x278b('0x6'));var config=require(_0x278b('0x7'));var attributes=require(_0x278b('0x8'));module[_0x278b('0x9')]=function(_0x18a402,_0x4090cc){return _0x18a402['define'](_0x278b('0xa'),attributes,{'tableName':_0x278b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a06e6,_0x5b1ede,_0x26132d){if(_0x5a06e6['changed'](_0x278b('0xc'))){_0x5a06e6['closedAt']=moment()[_0x278b('0xd')](_0x278b('0xe'));}_0x26132d(null,_0x5a06e6);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd85b=['request-promise','rimraf','../../config/environment','exports','define','ChatInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird'];(function(_0x2acb93,_0x419a08){var _0x50ffbd=function(_0x34c094){while(--_0x34c094){_0x2acb93['push'](_0x2acb93['shift']());}};_0x50ffbd(++_0x419a08);}(_0xd85b,0xfb));var _0xbd85=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd85b[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbd85('0x0'))(_0xbd85('0x1'));var moment=require(_0xbd85('0x2'));var BPromise=require(_0xbd85('0x3'));var rp=require(_0xbd85('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd85('0x5'));var config=require(_0xbd85('0x6'));var attributes=require('./chatInteraction.attributes');module[_0xbd85('0x7')]=function(_0xaa5286,_0x4b7294){return _0xaa5286[_0xbd85('0x8')](_0xbd85('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8b7c06,_0x3c9ad9,_0x4f2065){if(_0x8b7c06[_0xbd85('0xa')](_0xbd85('0xb'))){_0x8b7c06[_0xbd85('0xc')]=moment()[_0xbd85('0xd')](_0xbd85('0xe'));}_0x4f2065(null,_0x8b7c06);}},'charset':_0xbd85('0xf'),'collate':_0xbd85('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 7bd582e..4093051 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 _0x70bd=['options','raw','where','limit','debug','stringify','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','ChatInteraction,\x20%s,\x20%s','catch','UpdateChatInteraction','body'];(function(_0x35f342,_0x1f91e5){var _0x4e6b42=function(_0x54194d){while(--_0x54194d){_0x35f342['push'](_0x35f342['shift']());}};_0x4e6b42(++_0x1f91e5);}(_0x70bd,0x191));var _0xd70b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x70bd[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xd70b('0x0'));var util=require(_0xd70b('0x1'));var moment=require(_0xd70b('0x2'));var BPromise=require('bluebird');var rs=require(_0xd70b('0x3'));var fs=require('fs');var Redis=require(_0xd70b('0x4'));var db=require(_0xd70b('0x5'))['db'];var utils=require(_0xd70b('0x6'));var logger=require('../../config/logger')(_0xd70b('0x7'));var config=require(_0xd70b('0x8'));var jayson=require(_0xd70b('0x9'));var client=jayson[_0xd70b('0xa')][_0xd70b('0xb')]({'port':0x232a});config[_0xd70b('0xc')]=_['defaults'](config[_0xd70b('0xc')],{'host':_0xd70b('0xd'),'port':0x18eb});var socket=require(_0xd70b('0xe'))(new Redis(config[_0xd70b('0xc')]));require(_0xd70b('0xf'))[_0xd70b('0x10')](socket);function respondWithRpcPromise(_0x447e4a,_0x3b4ade,_0x5517bd){return new BPromise(function(_0x816cce,_0x3de935){return client[_0xd70b('0x11')](_0x447e4a,_0x5517bd)[_0xd70b('0x12')](function(_0x3c90ba){logger[_0xd70b('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x3b4ade,_0xd70b('0x14'));logger['debug'](_0xd70b('0x15'),_0x3b4ade,_0xd70b('0x14'),JSON['stringify'](_0x3c90ba));if(_0x3c90ba[_0xd70b('0x16')]){if(_0x3c90ba['error'][_0xd70b('0x17')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3b4ade,_0x3c90ba['error'][_0xd70b('0x18')]);return _0x3de935(_0x3c90ba[_0xd70b('0x16')][_0xd70b('0x18')]);}logger[_0xd70b('0x16')](_0xd70b('0x19'),_0x3b4ade,_0x3c90ba[_0xd70b('0x16')][_0xd70b('0x18')]);return _0x816cce(_0x3c90ba[_0xd70b('0x16')]['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x3b4ade,_0xd70b('0x14'));_0x816cce(_0x3c90ba['result'][_0xd70b('0x18')]);}})[_0xd70b('0x1a')](function(_0x1c73ad){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3b4ade,_0x1c73ad);_0x3de935(_0x1c73ad);});});}exports[_0xd70b('0x1b')]=function(_0x507f47){var _0x67ea74=this;return new Promise(function(_0x5f5f38,_0x31b971){return db['ChatInteraction']['update'](_0x507f47[_0xd70b('0x1c')],{'raw':_0x507f47[_0xd70b('0x1d')]?_0x507f47[_0xd70b('0x1d')][_0xd70b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x507f47[_0xd70b('0x1d')]?_0x507f47[_0xd70b('0x1d')][_0xd70b('0x1f')]||null:null,'attributes':_0x507f47[_0xd70b('0x1d')]?_0x507f47['options']['attributes']||null:null,'limit':_0x507f47['options']?_0x507f47[_0xd70b('0x1d')][_0xd70b('0x20')]||null:null})[_0xd70b('0x12')](function(_0xe04978){logger[_0xd70b('0x13')](_0xd70b('0x1b'),_0x507f47);logger[_0xd70b('0x21')](_0xd70b('0x1b'),_0x507f47,JSON[_0xd70b('0x22')](_0xe04978));_0x5f5f38(_0xe04978);})[_0xd70b('0x1a')](function(_0x42dea6){logger[_0xd70b('0x16')](_0xd70b('0x1b'),_0x42dea6['message'],_0x507f47);_0x31b971(_0x67ea74['error'](0x1f4,_0x42dea6['message']));});});};exports[_0xd70b('0x23')]=function(_0x327012){return new Promise(function(_0x1ffb00,_0xfd4503){return db[_0xd70b('0x24')][_0xd70b('0x25')]({'where':_0x327012[_0xd70b('0x1d')]?_0x327012[_0xd70b('0x1d')][_0xd70b('0x1f')]||null:null})[_0xd70b('0x12')](function(_0x3ed0ef){if(_0x3ed0ef){return _0x3ed0ef[_0xd70b('0x26')](_0x327012[_0xd70b('0x1c')][_0xd70b('0x27')],_[_0xd70b('0x28')](_0x327012[_0xd70b('0x1c')],[_0xd70b('0x27'),'id'])||{});}})[_0xd70b('0x29')](function(_0x2890e2){logger[_0xd70b('0x13')](_0xd70b('0x2a'),_0x327012);logger['debug'](_0xd70b('0x2a'),_0x327012,JSON[_0xd70b('0x22')](_0x2890e2));_0x1ffb00(_0x2890e2);})[_0xd70b('0x1a')](function(_0xb2d753){logger[_0xd70b('0x16')]('AddTags',_0xb2d753[_0xd70b('0x18')],_0x327012);_0xfd4503(_this['error'](0x1f4,_0xb2d753['message']));});});}; \ No newline at end of file +var _0x75ad=['localhost','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','find','addTags','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5520bf,_0x30866b){var _0x3c5ef2=function(_0x1bcc23){while(--_0x1bcc23){_0x5520bf['push'](_0x5520bf['shift']());}};_0x3c5ef2(++_0x30866b);}(_0x75ad,0xc4));var _0xd75a=function(_0x4b6ec2,_0x13725c){_0x4b6ec2=_0x4b6ec2-0x0;var _0x3fe2c5=_0x75ad[_0x4b6ec2];return _0x3fe2c5;};'use strict';var _=require(_0xd75a('0x0'));var util=require(_0xd75a('0x1'));var moment=require(_0xd75a('0x2'));var BPromise=require(_0xd75a('0x3'));var rs=require(_0xd75a('0x4'));var fs=require('fs');var Redis=require(_0xd75a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd75a('0x6'));var logger=require(_0xd75a('0x7'))(_0xd75a('0x8'));var config=require(_0xd75a('0x9'));var jayson=require(_0xd75a('0xa'));var client=jayson[_0xd75a('0xb')][_0xd75a('0xc')]({'port':0x232a});config[_0xd75a('0xd')]=_['defaults'](config[_0xd75a('0xd')],{'host':_0xd75a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd75a('0xd')]));require(_0xd75a('0xf'))[_0xd75a('0x10')](socket);function respondWithRpcPromise(_0x166cd4,_0x3b8610,_0x513455){return new BPromise(function(_0xb36732,_0x202e5a){return client['request'](_0x166cd4,_0x513455)[_0xd75a('0x11')](function(_0x44a98e){logger[_0xd75a('0x12')](_0xd75a('0x13'),_0x3b8610,_0xd75a('0x14'));logger[_0xd75a('0x15')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3b8610,_0xd75a('0x14'),JSON[_0xd75a('0x16')](_0x44a98e));if(_0x44a98e['error']){if(_0x44a98e[_0xd75a('0x17')][_0xd75a('0x18')]===0x1f4){logger['error'](_0xd75a('0x13'),_0x3b8610,_0x44a98e['error'][_0xd75a('0x19')]);return _0x202e5a(_0x44a98e[_0xd75a('0x17')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3b8610,_0x44a98e[_0xd75a('0x17')][_0xd75a('0x19')]);return _0xb36732(_0x44a98e[_0xd75a('0x17')][_0xd75a('0x19')]);}else{logger[_0xd75a('0x12')](_0xd75a('0x13'),_0x3b8610,_0xd75a('0x14'));_0xb36732(_0x44a98e[_0xd75a('0x1a')][_0xd75a('0x19')]);}})['catch'](function(_0x457c8f){logger[_0xd75a('0x17')](_0xd75a('0x13'),_0x3b8610,_0x457c8f);_0x202e5a(_0x457c8f);});});}exports[_0xd75a('0x1b')]=function(_0x5d7279){var _0xe3ae73=this;return new Promise(function(_0x4e76d5,_0x494489){return db[_0xd75a('0x1c')][_0xd75a('0x1d')](_0x5d7279[_0xd75a('0x1e')],{'raw':_0x5d7279[_0xd75a('0x1f')]?_0x5d7279[_0xd75a('0x1f')][_0xd75a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d7279[_0xd75a('0x1f')]?_0x5d7279[_0xd75a('0x1f')][_0xd75a('0x21')]||null:null,'attributes':_0x5d7279[_0xd75a('0x1f')]?_0x5d7279['options'][_0xd75a('0x22')]||null:null,'limit':_0x5d7279[_0xd75a('0x1f')]?_0x5d7279['options'][_0xd75a('0x23')]||null:null})['then'](function(_0x5b6ebb){logger[_0xd75a('0x12')](_0xd75a('0x1b'),_0x5d7279);logger[_0xd75a('0x15')]('UpdateChatInteraction',_0x5d7279,JSON[_0xd75a('0x16')](_0x5b6ebb));_0x4e76d5(_0x5b6ebb);})[_0xd75a('0x24')](function(_0x24feb8){logger[_0xd75a('0x17')](_0xd75a('0x1b'),_0x24feb8['message'],_0x5d7279);_0x494489(_0xe3ae73[_0xd75a('0x17')](0x1f4,_0x24feb8[_0xd75a('0x19')]));});});};exports[_0xd75a('0x25')]=function(_0xe55f98){return new Promise(function(_0x4d67af,_0x283c1a){return db['ChatInteraction'][_0xd75a('0x26')]({'where':_0xe55f98['options']?_0xe55f98[_0xd75a('0x1f')][_0xd75a('0x21')]||null:null})[_0xd75a('0x11')](function(_0xfcbb10){if(_0xfcbb10){return _0xfcbb10[_0xd75a('0x27')](_0xe55f98[_0xd75a('0x1e')][_0xd75a('0x28')],_['omit'](_0xe55f98[_0xd75a('0x1e')],[_0xd75a('0x28'),'id'])||{});}})['spread'](function(_0x4af248){logger[_0xd75a('0x12')](_0xd75a('0x29'),_0xe55f98);logger[_0xd75a('0x15')](_0xd75a('0x29'),_0xe55f98,JSON[_0xd75a('0x16')](_0x4af248));_0x4d67af(_0x4af248);})[_0xd75a('0x24')](function(_0x1a2a28){logger[_0xd75a('0x17')](_0xd75a('0x29'),_0x1a2a28['message'],_0xe55f98);_0x283c1a(_this[_0xd75a('0x17')](0x1f4,_0x1a2a28['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 99d1228..15c8143 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 _0xe784=['length','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0xcec18a,_0x663b4f){var _0x52d111=function(_0x23a999){while(--_0x23a999){_0xcec18a['push'](_0xcec18a['shift']());}};_0x52d111(++_0x663b4f);}(_0xe784,0x1b9));var _0x4e78=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xe784[_0x1e4360];return _0x31e6b4;};'use strict';var ChatInteractionEvents=require(_0x4e78('0x0'));var events=[_0x4e78('0x1'),_0x4e78('0x2'),_0x4e78('0x3')];function createListener(_0x44558a,_0x4d424b){return function(_0x3f2ad7){_0x4d424b[_0x4e78('0x4')](_0x44558a,_0x3f2ad7);};}function removeListener(_0x9e71c7,_0x2faac3){return function(){ChatInteractionEvents[_0x4e78('0x5')](_0x9e71c7,_0x2faac3);};}exports[_0x4e78('0x6')]=function(_0x5901b2){for(var _0x312472=0x0,_0x5dcadd=events[_0x4e78('0x7')];_0x312472<_0x5dcadd;_0x312472++){var _0xda6372=events[_0x312472];var _0x4aec57=createListener('chatInteraction:'+_0xda6372,_0x5901b2);ChatInteractionEvents['on'](_0xda6372,_0x4aec57);}}; \ No newline at end of file +var _0x0064=['remove','update','removeListener','register','length','chatInteraction:','save'];(function(_0x3d8240,_0x2663d4){var _0x3d0372=function(_0xc47c6b){while(--_0xc47c6b){_0x3d8240['push'](_0x3d8240['shift']());}};_0x3d0372(++_0x2663d4);}(_0x0064,0x68));var _0x4006=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0064[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x4006('0x0'),_0x4006('0x1'),_0x4006('0x2')];function createListener(_0x24571d,_0x4022ac){return function(_0x221755){_0x4022ac['emit'](_0x24571d,_0x221755);};}function removeListener(_0x212654,_0x5643a9){return function(){ChatInteractionEvents[_0x4006('0x3')](_0x212654,_0x5643a9);};}exports[_0x4006('0x4')]=function(_0x14aaa5){for(var _0x2544c3=0x0,_0x5d86c6=events[_0x4006('0x5')];_0x2544c3<_0x5d86c6;_0x2544c3++){var _0x28792a=events[_0x2544c3];var _0x165e0b=createListener(_0x4006('0x6')+_0x28792a,_0x14aaa5);ChatInteractionEvents['on'](_0x28792a,_0x165e0b);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index d4b7812..3ec59ab 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 _0x9aca=['single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','abandon','close','chatinteraction:destroy','destroy','delete','removeTags','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','root','%s-%s','originalname','replace','/:id/attachment_upload'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9aca,0x118));var _0xa9ac=function(_0x475ac5,_0x30737c){_0x475ac5=_0x475ac5-0x0;var _0x1e5e19=_0x9aca[_0x475ac5];return _0x1e5e19;};'use strict';var multer=require('multer');var util=require(_0xa9ac('0x0'));var path=require('path');var timeout=require(_0xa9ac('0x1'));var express=require('express');var router=express[_0xa9ac('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa9ac('0x3'));var interaction=require(_0xa9ac('0x4'));var config=require('../../config/environment');var controller=require(_0xa9ac('0x5'));router['get']('/',auth[_0xa9ac('0x6')](),controller[_0xa9ac('0x7')]);router['get'](_0xa9ac('0x8'),auth['isAuthenticated'](),controller[_0xa9ac('0x9')]);router[_0xa9ac('0xa')](_0xa9ac('0xb'),auth['isChatInteractionAuthorized'](),controller[_0xa9ac('0xc')]);router[_0xa9ac('0xa')](_0xa9ac('0xd'),auth[_0xa9ac('0xe')](),controller[_0xa9ac('0xf')]);router[_0xa9ac('0xa')](_0xa9ac('0x10'),auth['isAuthenticated'](),controller[_0xa9ac('0x11')]);router[_0xa9ac('0xa')](_0xa9ac('0x12'),auth[_0xa9ac('0xe')](),controller[_0xa9ac('0x13')]);router[_0xa9ac('0xa')](_0xa9ac('0x14'),auth[_0xa9ac('0x6')](),controller[_0xa9ac('0x15')]);router['post']('/',auth[_0xa9ac('0x6')](),controller[_0xa9ac('0x16')]);router[_0xa9ac('0x17')](_0xa9ac('0x18'),auth[_0xa9ac('0x6')](),controller[_0xa9ac('0x19')]);var upload=multer({'storage':multer[_0xa9ac('0x1a')]({'destination':function(_0x5aa2b2,_0x380e34,_0x431efa){_0x431efa(null,path['join'](config[_0xa9ac('0x1b')],'server/files/attachments/'));},'filename':function(_0x193d94,_0x1e2263,_0xd45629){_0xd45629(null,util['format'](_0xa9ac('0x1c'),Date['now'](),_0x1e2263[_0xa9ac('0x1d')][_0xa9ac('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xa9ac('0x1f'),upload[_0xa9ac('0x20')](_0xa9ac('0x21')),controller[_0xa9ac('0x22')]);router['post']('/:id/messages',auth[_0xa9ac('0xe')](),controller[_0xa9ac('0x23')]);router['post'](_0xa9ac('0x24'),auth[_0xa9ac('0x6')](),interaction['tracked'](_0xa9ac('0x25'),_0xa9ac('0x26')),controller[_0xa9ac('0x27')]);router[_0xa9ac('0x28')]('/:id',auth['isAuthenticated'](),interaction[_0xa9ac('0x29')](_0xa9ac('0x25'),_0xa9ac('0x2a')),controller[_0xa9ac('0x2b')]);router[_0xa9ac('0x28')](_0xa9ac('0x2c'),controller['customUpdate']);router[_0xa9ac('0x28')]('/:id/abandon',auth[_0xa9ac('0xe')](),controller[_0xa9ac('0x2d')]);router[_0xa9ac('0x28')]('/:id/close',controller[_0xa9ac('0x2e')]);router['delete']('/:id',auth[_0xa9ac('0x6')](),interaction[_0xa9ac('0x29')](_0xa9ac('0x25'),_0xa9ac('0x2f')),controller[_0xa9ac('0x30')]);router[_0xa9ac('0x31')](_0xa9ac('0x24'),auth[_0xa9ac('0x6')](),controller[_0xa9ac('0x32')]);module[_0xa9ac('0x33')]=router; \ No newline at end of file +var _0x201e=['getMyMessages','/:id/download','post','createVidaooSession','diskStorage','join','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','/:id/messages','addMessage','/:id/tags','tracked','chat','addTags','/:id','chatinteraction:update','update','put','/:id/custom_update','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','getMessages','/:id/my_messages'];(function(_0x2bc810,_0x4a1300){var _0x56b881=function(_0x447fa2){while(--_0x447fa2){_0x2bc810['push'](_0x2bc810['shift']());}};_0x56b881(++_0x4a1300);}(_0x201e,0xb0));var _0xe201=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x201e[_0x1a9204];return _0x17ca68;};'use strict';var multer=require('multer');var util=require(_0xe201('0x0'));var path=require(_0xe201('0x1'));var timeout=require(_0xe201('0x2'));var express=require(_0xe201('0x3'));var router=express[_0xe201('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe201('0x5'));var interaction=require(_0xe201('0x6'));var config=require(_0xe201('0x7'));var controller=require('./chatInteraction.controller');router[_0xe201('0x8')]('/',auth[_0xe201('0x9')](),controller[_0xe201('0xa')]);router[_0xe201('0x8')](_0xe201('0xb'),auth[_0xe201('0x9')](),controller[_0xe201('0xc')]);router[_0xe201('0x8')]('/:id',auth[_0xe201('0xd')](),controller['show']);router[_0xe201('0x8')]('/:id/attachment_download',auth[_0xe201('0xd')](),controller['attachmentDownload']);router[_0xe201('0x8')]('/:id/messages',auth[_0xe201('0x9')](),controller[_0xe201('0xe')]);router[_0xe201('0x8')](_0xe201('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xe201('0x10')]);router[_0xe201('0x8')](_0xe201('0x11'),auth[_0xe201('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe201('0x12')]('/:id/vidaoo',auth[_0xe201('0x9')](),controller[_0xe201('0x13')]);var upload=multer({'storage':multer[_0xe201('0x14')]({'destination':function(_0x333f35,_0x20d444,_0x8aa5b4){_0x8aa5b4(null,path[_0xe201('0x15')](config['root'],_0xe201('0x16')));},'filename':function(_0x3e96cc,_0x570461,_0x2a6306){_0x2a6306(null,util[_0xe201('0x17')]('%s-%s',Date[_0xe201('0x18')](),_0x570461[_0xe201('0x19')][_0xe201('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe201('0x12')](_0xe201('0x1b'),upload[_0xe201('0x1c')]('file'),controller['attachmentUpload']);router['post'](_0xe201('0x1d'),auth[_0xe201('0xd')](),controller[_0xe201('0x1e')]);router[_0xe201('0x12')](_0xe201('0x1f'),auth[_0xe201('0x9')](),interaction[_0xe201('0x20')](_0xe201('0x21'),'chatinteraction:addtags'),controller[_0xe201('0x22')]);router['put'](_0xe201('0x23'),auth['isAuthenticated'](),interaction[_0xe201('0x20')]('chat',_0xe201('0x24')),controller[_0xe201('0x25')]);router[_0xe201('0x26')](_0xe201('0x27'),controller['customUpdate']);router[_0xe201('0x26')](_0xe201('0x28'),auth[_0xe201('0xd')](),controller['abandon']);router[_0xe201('0x26')](_0xe201('0x29'),controller[_0xe201('0x2a')]);router[_0xe201('0x2b')](_0xe201('0x23'),auth[_0xe201('0x9')](),interaction[_0xe201('0x20')](_0xe201('0x21'),_0xe201('0x2c')),controller[_0xe201('0x2d')]);router[_0xe201('0x2b')](_0xe201('0x1f'),auth['isAuthenticated'](),controller[_0xe201('0x2e')]);module[_0xe201('0x2f')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 703700a..cf00b05 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 _0xd01f=['exports','TEXT','medium','sequelize'];(function(_0x56bd4c,_0x3cd91d){var _0x462287=function(_0x3f982c){while(--_0x3f982c){_0x56bd4c['push'](_0x56bd4c['shift']());}};_0x462287(++_0x3cd91d);}(_0xd01f,0x1cf));var _0xfd01=function(_0x1cb45d,_0x46aa83){_0x1cb45d=_0x1cb45d-0x0;var _0x3ea23c=_0xd01f[_0x1cb45d];return _0x3ea23c;};'use strict';var Sequelize=require(_0xfd01('0x0'));module[_0xfd01('0x1')]={'body':{'type':Sequelize[_0xfd01('0x2')](_0xfd01('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3a0d=['INTEGER','medium','BOOLEAN'];(function(_0x31b59c,_0x136fc7){var _0x56db60=function(_0x38f02e){while(--_0x38f02e){_0x31b59c['push'](_0x31b59c['shift']());}};_0x56db60(++_0x136fc7);}(_0x3a0d,0x14b));var _0xd3a0=function(_0x4a1196,_0x21e0c3){_0x4a1196=_0x4a1196-0x0;var _0x58604e=_0x3a0d[_0x4a1196];return _0x58604e;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xd3a0('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0xd3a0('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xd3a0('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 9a84261..d367817 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 _0xbc68=['User','agent','admin','user','userpic','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','read','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ChatInternalMessage','count','findAll','rows','catch','show','params','include','create','body','find','describe','get','messages','lastMessage','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2a4813,_0x1c9e07){var _0x75858e=function(_0x1a48d9){while(--_0x1a48d9){_0x2a4813['push'](_0x2a4813['shift']());}};_0x75858e(++_0x1c9e07);}(_0xbc68,0x155));var _0x8bc6=function(_0x4d3016,_0x3351a0){_0x4d3016=_0x4d3016-0x0;var _0x20057c=_0xbc68[_0x4d3016];return _0x20057c;};'use strict';var emlformat=require(_0x8bc6('0x0'));var rimraf=require(_0x8bc6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8bc6('0x2'));var moment=require('moment');var BPromise=require(_0x8bc6('0x3'));var Mustache=require(_0x8bc6('0x4'));var util=require(_0x8bc6('0x5'));var path=require(_0x8bc6('0x6'));var sox=require(_0x8bc6('0x7'));var csv=require(_0x8bc6('0x8'));var ejs=require(_0x8bc6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bc6('0xa'));var squel=require(_0x8bc6('0xb'));var crypto=require(_0x8bc6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8bc6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8bc6('0xe'));var Papa=require(_0x8bc6('0xf'));var Redis=require(_0x8bc6('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8bc6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bc6('0x12'))(_0x8bc6('0x13'));var utils=require(_0x8bc6('0x14'));var config=require(_0x8bc6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bc6('0x16'))['db'];config[_0x8bc6('0x17')]=_[_0x8bc6('0x18')](config['redis'],{'host':_0x8bc6('0x19'),'port':0x18eb});var socket=require(_0x8bc6('0x1a'))(new Redis(config[_0x8bc6('0x17')]));require(_0x8bc6('0x1b'))[_0x8bc6('0x1c')](socket);function respondWithStatusCode(_0x559a88,_0x2786e0){_0x2786e0=_0x2786e0||0xcc;return function(_0x3e8366){if(_0x3e8366){return _0x559a88['sendStatus'](_0x2786e0);}return _0x559a88[_0x8bc6('0x1d')](_0x2786e0)['end']();};}function respondWithResult(_0x28cb2a,_0x3ef1ed){_0x3ef1ed=_0x3ef1ed||0xc8;return function(_0x14816c){if(_0x14816c){return _0x28cb2a[_0x8bc6('0x1d')](_0x3ef1ed)['json'](_0x14816c);}};}function respondWithFilteredResult(_0x17c09f,_0x108043){return function(_0x3a5c8e){if(_0x3a5c8e){var _0x41dae0=typeof _0x108043[_0x8bc6('0x1e')]===_0x8bc6('0x1f')&&typeof _0x108043[_0x8bc6('0x20')]===_0x8bc6('0x1f');var _0x2d7805=_0x3a5c8e['count'];var _0x90bf59=_0x41dae0?0x0:_0x108043[_0x8bc6('0x1e')];var _0x5bbc8e=_0x41dae0?_0x3a5c8e['count']:_0x108043[_0x8bc6('0x1e')]+_0x108043[_0x8bc6('0x20')];var _0x7fbb55;if(_0x5bbc8e>=_0x2d7805){_0x5bbc8e=_0x2d7805;_0x7fbb55=0xc8;}else{_0x7fbb55=0xce;}_0x17c09f[_0x8bc6('0x1d')](_0x7fbb55);return _0x17c09f[_0x8bc6('0x21')](_0x8bc6('0x22'),_0x90bf59+'-'+_0x5bbc8e+'/'+_0x2d7805)['json'](_0x3a5c8e);}return null;};}function patchUpdates(_0xdfd7cf){return function(_0x3cf819){try{jsonpatch[_0x8bc6('0x23')](_0x3cf819,_0xdfd7cf,!![]);}catch(_0x351606){return BPromise['reject'](_0x351606);}return _0x3cf819[_0x8bc6('0x24')]();};}function saveUpdates(_0xa90f66,_0xa04593){return function(_0x121d02){if(_0x121d02){return _0x121d02[_0x8bc6('0x25')](_0xa90f66)[_0x8bc6('0x26')](function(_0x185716){return _0x185716;});}return null;};}function removeEntity(_0x4bdde9,_0x4d1e7d){return function(_0x25d326){if(_0x25d326){return _0x25d326[_0x8bc6('0x27')]()[_0x8bc6('0x26')](function(){_0x4bdde9[_0x8bc6('0x1d')](0xcc)[_0x8bc6('0x28')]();});}};}function handleEntityNotFound(_0x541ad9,_0x4bdd87){return function(_0x24330d){if(!_0x24330d){_0x541ad9[_0x8bc6('0x29')](0x194);}return _0x24330d;};}function handleError(_0x478ea6,_0x523784){_0x523784=_0x523784||0x1f4;return function(_0x109844){logger[_0x8bc6('0x2a')](_0x109844[_0x8bc6('0x2b')]);if(_0x109844[_0x8bc6('0x2c')]){delete _0x109844[_0x8bc6('0x2c')];}_0x478ea6['status'](_0x523784)[_0x8bc6('0x2d')](_0x109844);};}exports[_0x8bc6('0x2e')]=function(_0x76c48d,_0x1a6853){var _0x186768={},_0x4fbcce={},_0x46810c={'count':0x0,'rows':[]};var _0x156871=_[_0x8bc6('0x2f')](db['ChatInternalMessage'][_0x8bc6('0x30')],function(_0x32719a){return{'name':_0x32719a[_0x8bc6('0x31')],'type':_0x32719a[_0x8bc6('0x32')]['key']};});_0x4fbcce[_0x8bc6('0x33')]=_['map'](_0x156871,_0x8bc6('0x2c'));_0x4fbcce['query']=_[_0x8bc6('0x34')](_0x76c48d[_0x8bc6('0x35')]);_0x4fbcce['filters']=_['intersection'](_0x4fbcce['model'],_0x4fbcce[_0x8bc6('0x35')]);_0x186768[_0x8bc6('0x36')]=_[_0x8bc6('0x37')](_0x4fbcce[_0x8bc6('0x33')],qs[_0x8bc6('0x38')](_0x76c48d[_0x8bc6('0x35')][_0x8bc6('0x38')]));_0x186768['attributes']=_0x186768[_0x8bc6('0x36')][_0x8bc6('0x39')]?_0x186768[_0x8bc6('0x36')]:_0x4fbcce['model'];if(!_0x76c48d[_0x8bc6('0x35')]['hasOwnProperty']('nolimit')){_0x186768[_0x8bc6('0x20')]=qs['limit'](_0x76c48d['query'][_0x8bc6('0x20')]);_0x186768['offset']=qs['offset'](_0x76c48d['query'][_0x8bc6('0x1e')]);}_0x186768[_0x8bc6('0x3a')]=qs[_0x8bc6('0x3b')](_0x76c48d[_0x8bc6('0x35')]['sort']);_0x186768[_0x8bc6('0x3c')]=qs[_0x8bc6('0x3d')](_[_0x8bc6('0x3e')](_0x76c48d['query'],_0x4fbcce[_0x8bc6('0x3d')]),_0x156871);if(_0x76c48d[_0x8bc6('0x35')][_0x8bc6('0x3f')]){_0x186768[_0x8bc6('0x3c')]=_['merge'](_0x186768[_0x8bc6('0x3c')],{'$or':_[_0x8bc6('0x2f')](_0x156871,function(_0x22ed3a){if(_0x22ed3a[_0x8bc6('0x32')]!==_0x8bc6('0x40')){var _0x4ac7b7={};_0x4ac7b7[_0x22ed3a[_0x8bc6('0x2c')]]={'$like':'%'+_0x76c48d[_0x8bc6('0x35')]['filter']+'%'};return _0x4ac7b7;}})});}_0x186768=_[_0x8bc6('0x41')]({},_0x186768,_0x76c48d[_0x8bc6('0x42')]);var _0x52c915={'where':_0x186768['where']};return db[_0x8bc6('0x43')]['count'](_0x52c915)['then'](function(_0x110b6f){_0x46810c[_0x8bc6('0x44')]=_0x110b6f;if(_0x76c48d[_0x8bc6('0x35')]['includeAll']){_0x186768['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0x8bc6('0x45')](_0x186768);})[_0x8bc6('0x26')](function(_0xc3b6e){_0x46810c[_0x8bc6('0x46')]=_0xc3b6e;return _0x46810c;})[_0x8bc6('0x26')](respondWithFilteredResult(_0x1a6853,_0x186768))[_0x8bc6('0x47')](handleError(_0x1a6853,null));};exports[_0x8bc6('0x48')]=function(_0xa3a962,_0x257370){var _0x222a66={'raw':!![],'where':{'id':_0xa3a962[_0x8bc6('0x49')]['id']}},_0x134ef3={};_0x134ef3[_0x8bc6('0x33')]=_[_0x8bc6('0x34')](db[_0x8bc6('0x43')][_0x8bc6('0x30')]);_0x134ef3[_0x8bc6('0x35')]=_[_0x8bc6('0x34')](_0xa3a962[_0x8bc6('0x35')]);_0x134ef3[_0x8bc6('0x3d')]=_[_0x8bc6('0x37')](_0x134ef3['model'],_0x134ef3[_0x8bc6('0x35')]);_0x222a66['attributes']=_['intersection'](_0x134ef3[_0x8bc6('0x33')],qs['fields'](_0xa3a962[_0x8bc6('0x35')][_0x8bc6('0x38')]));_0x222a66[_0x8bc6('0x36')]=_0x222a66['attributes']['length']?_0x222a66['attributes']:_0x134ef3[_0x8bc6('0x33')];if(_0xa3a962['query']['includeAll']){_0x222a66[_0x8bc6('0x4a')]=[{'all':!![]}];}_0x222a66=_[_0x8bc6('0x41')]({},_0x222a66,_0xa3a962[_0x8bc6('0x42')]);return db[_0x8bc6('0x43')]['find'](_0x222a66)[_0x8bc6('0x26')](handleEntityNotFound(_0x257370,null))['then'](respondWithResult(_0x257370,null))['catch'](handleError(_0x257370,null));};exports[_0x8bc6('0x4b')]=function(_0x5114ea,_0x58e778){return db[_0x8bc6('0x43')][_0x8bc6('0x4b')](_0x5114ea[_0x8bc6('0x4c')],{})[_0x8bc6('0x26')](respondWithResult(_0x58e778,0xc9))['catch'](handleError(_0x58e778,null));};exports[_0x8bc6('0x25')]=function(_0x372501,_0x10389e){if(_0x372501['body']['id']){delete _0x372501['body']['id'];}return db[_0x8bc6('0x43')][_0x8bc6('0x4d')]({'where':{'id':_0x372501[_0x8bc6('0x49')]['id']}})[_0x8bc6('0x26')](handleEntityNotFound(_0x10389e,null))['then'](saveUpdates(_0x372501[_0x8bc6('0x4c')],null))[_0x8bc6('0x26')](respondWithResult(_0x10389e,null))['catch'](handleError(_0x10389e,null));};exports[_0x8bc6('0x27')]=function(_0x1f12bb,_0x5447cd){return db[_0x8bc6('0x43')][_0x8bc6('0x4d')]({'where':{'id':_0x1f12bb[_0x8bc6('0x49')]['id']}})[_0x8bc6('0x26')](handleEntityNotFound(_0x5447cd,null))[_0x8bc6('0x26')](removeEntity(_0x5447cd,null))['catch'](handleError(_0x5447cd,null));};exports[_0x8bc6('0x4e')]=function(_0x1c3429,_0x43dc59){return db[_0x8bc6('0x43')][_0x8bc6('0x4e')]()[_0x8bc6('0x26')](respondWithResult(_0x43dc59,null))['catch'](handleError(_0x43dc59,null));};function wrapUser(_0x184eff){return function(_0x140721){var _0xb6d743=_0x184eff[_0x8bc6('0x4f')]({'plain':!![]});_0xb6d743[_0x8bc6('0x50')]=[];if(_0x140721){_0xb6d743['lastMessageAt']=_0x140721['createdAt'];_0xb6d743[_0x8bc6('0x51')]=_0x140721;}else{_0xb6d743['lastMessageAt']=moment(0x0)['format'](_0x8bc6('0x52'));_0xb6d743['lastMessage']={};}return _0xb6d743;};}exports['getUsers']=function(_0x1f2952,_0xf3e194,_0x4c5f4f){var _0xc06c98=[];return db[_0x8bc6('0x53')]['findAll']({'where':{'role':[_0x8bc6('0x54'),_0x8bc6('0x55'),_0x8bc6('0x56')]},'attributes':['id','fullname',_0x8bc6('0x2c'),'role',_0x8bc6('0x57'),'internal','online',_0x8bc6('0x58'),_0x8bc6('0x59'),_0x8bc6('0x5a')],'order':qs[_0x8bc6('0x3b')](_0x8bc6('0x5b')),'include':[{'model':db[_0x8bc6('0x5c')],'as':_0x8bc6('0x5d'),'attributes':['id',_0x8bc6('0x2c'),_0x8bc6('0x32')],'through':{'attributes':[]}}]})[_0x8bc6('0x26')](function(_0x423bed){if(_0x423bed){var _0x29cc64=_0x1f2952[_0x8bc6('0x56')]['get']({'plain':!![]});if(!_0x29cc64)throw new Error(_0x8bc6('0x5e'));if(_0x29cc64[_0x8bc6('0x5f')]===_0x8bc6('0x56')){return db[_0x8bc6('0x60')]['find']({'where':{'name':_0x8bc6('0x61'),'userProfileId':_0x29cc64['userProfileId']},'raw':!![]})[_0x8bc6('0x26')](function(_0x2484e9){if(_0x2484e9){if(_0x2484e9[_0x8bc6('0x62')]===0x0){return db[_0x8bc6('0x63')][_0x8bc6('0x45')]({'where':{'sectionId':_0x2484e9['id']},'raw':!![]})[_0x8bc6('0x26')](function(_0x337cfd){var _0x8b57a1=[];if(_[_0x8bc6('0x64')](_0x337cfd)){_0x8b57a1=_[_0x8bc6('0x3f')](_0x423bed,function(_0x5ed501){if(_0x5ed501[_0x8bc6('0x5f')]!==_0x8bc6('0x54')){return _0x5ed501;}});return _0x8b57a1;}else{for(var _0x2b2de5=0x0;_0x2b2de5<_0x423bed[_0x8bc6('0x39')];_0x2b2de5++){var _0x16f762=_0x423bed[_0x2b2de5];if(_0x16f762['role']===_0x8bc6('0x54')){var _0x1a54f0=_[_0x8bc6('0x4d')](_0x337cfd,function(_0x14868e){return _0x14868e[_0x8bc6('0x65')]===_0x16f762['id'];});if(_0x1a54f0)_0x8b57a1['push'](_0x16f762);}else{_0x8b57a1[_0x8bc6('0x66')](_0x16f762);}}return _0x8b57a1;}});}else{return _0x423bed;}}else{var _0x32caef=_[_0x8bc6('0x3f')](_0x423bed,function(_0x2f6a23){if(_0x2f6a23[_0x8bc6('0x5f')]!==_0x8bc6('0x54')){return _0x2f6a23;}});return _0x32caef;}});}else{return _0x423bed;}}})[_0x8bc6('0x26')](function(_0x5d18f1){var _0x35168c=[];if(_0x5d18f1){_0xc06c98=_0x5d18f1;for(var _0x2681c3=0x0;_0x2681c3<_0x5d18f1[_0x8bc6('0x39')];_0x2681c3+=0x1){_0xc06c98[_0x2681c3][_0x8bc6('0x50')]=[];_0x35168c[_0x8bc6('0x66')](db[_0x8bc6('0x43')][_0x8bc6('0x4d')]({'where':{'FromId':[_0x1f2952['user']['id'],_0x5d18f1[_0x2681c3]['id']],'ToId':[_0x1f2952['user']['id'],_0x5d18f1[_0x2681c3]['id']],'ChatGroupId':null},'attributes':['id',_0x8bc6('0x67'),_0x8bc6('0x68'),'ToId',_0x8bc6('0x69'),_0x8bc6('0x4c')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5d18f1[_0x2681c3])));}return BPromise['all'](_0x35168c);}return[];})[_0x8bc6('0x26')](function(_0x4eff6){return{'rows':_0x4eff6,'count':_0x4eff6[_0x8bc6('0x39')]};})[_0x8bc6('0x26')](respondWithResult(_0xf3e194,null))['catch'](handleError(_0xf3e194,null));}; \ No newline at end of file +var _0xe285=['redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','apply','save','update','then','destroy','stack','name','index','map','ChatInternalMessage','fieldName','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','describe','get','messages','lastMessageAt','format','getUsers','findAll','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2bcddb,_0x3eaf37){var _0x12a9e8=function(_0xeeb678){while(--_0xeeb678){_0x2bcddb['push'](_0x2bcddb['shift']());}};_0x12a9e8(++_0x3eaf37);}(_0xe285,0x19a));var _0x5e28=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xe285[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require(_0x5e28('0x0'));var rimraf=require(_0x5e28('0x1'));var zipdir=require(_0x5e28('0x2'));var jsonpatch=require(_0x5e28('0x3'));var rp=require(_0x5e28('0x4'));var moment=require(_0x5e28('0x5'));var BPromise=require(_0x5e28('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5e28('0x7'));var sox=require(_0x5e28('0x8'));var csv=require(_0x5e28('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5e28('0xa'));var _=require(_0x5e28('0xb'));var squel=require(_0x5e28('0xc'));var crypto=require(_0x5e28('0xd'));var jsforce=require(_0x5e28('0xe'));var deskjs=require(_0x5e28('0xf'));var toCsv=require(_0x5e28('0x9'));var querystring=require('querystring');var Papa=require(_0x5e28('0x10'));var Redis=require(_0x5e28('0x11'));var authService=require(_0x5e28('0x12'));var qs=require(_0x5e28('0x13'));var as=require(_0x5e28('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e28('0x15'))(_0x5e28('0x16'));var utils=require(_0x5e28('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5e28('0x18'));var db=require(_0x5e28('0x19'))['db'];config[_0x5e28('0x1a')]=_[_0x5e28('0x1b')](config[_0x5e28('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e28('0x1c'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x5e28('0x1d')](socket);function respondWithStatusCode(_0x486c03,_0x17cea6){_0x17cea6=_0x17cea6||0xcc;return function(_0x20d197){if(_0x20d197){return _0x486c03[_0x5e28('0x1e')](_0x17cea6);}return _0x486c03[_0x5e28('0x1f')](_0x17cea6)[_0x5e28('0x20')]();};}function respondWithResult(_0x3af812,_0xf74a7f){_0xf74a7f=_0xf74a7f||0xc8;return function(_0x50ea92){if(_0x50ea92){return _0x3af812[_0x5e28('0x1f')](_0xf74a7f)['json'](_0x50ea92);}};}function respondWithFilteredResult(_0x5308bb,_0x455bab){return function(_0x4be1b9){if(_0x4be1b9){var _0x4e7d05=typeof _0x455bab[_0x5e28('0x21')]===_0x5e28('0x22')&&typeof _0x455bab['limit']===_0x5e28('0x22');var _0x10e5dd=_0x4be1b9[_0x5e28('0x23')];var _0x252ce3=_0x4e7d05?0x0:_0x455bab[_0x5e28('0x21')];var _0x229d40=_0x4e7d05?_0x4be1b9[_0x5e28('0x23')]:_0x455bab[_0x5e28('0x21')]+_0x455bab[_0x5e28('0x24')];var _0x3ddfd1;if(_0x229d40>=_0x10e5dd){_0x229d40=_0x10e5dd;_0x3ddfd1=0xc8;}else{_0x3ddfd1=0xce;}_0x5308bb[_0x5e28('0x1f')](_0x3ddfd1);return _0x5308bb['set']('Content-Range',_0x252ce3+'-'+_0x229d40+'/'+_0x10e5dd)['json'](_0x4be1b9);}return null;};}function patchUpdates(_0x485388){return function(_0x25762d){try{jsonpatch[_0x5e28('0x25')](_0x25762d,_0x485388,!![]);}catch(_0x28b28b){return BPromise['reject'](_0x28b28b);}return _0x25762d[_0x5e28('0x26')]();};}function saveUpdates(_0x461b86,_0x1da8cc){return function(_0x1f3e9f){if(_0x1f3e9f){return _0x1f3e9f[_0x5e28('0x27')](_0x461b86)[_0x5e28('0x28')](function(_0x531595){return _0x531595;});}return null;};}function removeEntity(_0x11bee5,_0x51e9bf){return function(_0x2ea05a){if(_0x2ea05a){return _0x2ea05a[_0x5e28('0x29')]()['then'](function(){_0x11bee5[_0x5e28('0x1f')](0xcc)[_0x5e28('0x20')]();});}};}function handleEntityNotFound(_0x5e7144,_0x528921){return function(_0xcb8b60){if(!_0xcb8b60){_0x5e7144[_0x5e28('0x1e')](0x194);}return _0xcb8b60;};}function handleError(_0x353a3b,_0x419c61){_0x419c61=_0x419c61||0x1f4;return function(_0x4a9036){logger['error'](_0x4a9036[_0x5e28('0x2a')]);if(_0x4a9036[_0x5e28('0x2b')]){delete _0x4a9036[_0x5e28('0x2b')];}_0x353a3b[_0x5e28('0x1f')](_0x419c61)['send'](_0x4a9036);};}exports[_0x5e28('0x2c')]=function(_0x152315,_0xbc7ddf){var _0x554939={},_0x3d1091={},_0x1c15a3={'count':0x0,'rows':[]};var _0x25b512=_[_0x5e28('0x2d')](db[_0x5e28('0x2e')]['rawAttributes'],function(_0x497652){return{'name':_0x497652[_0x5e28('0x2f')],'type':_0x497652['type']['key']};});_0x3d1091[_0x5e28('0x30')]=_['map'](_0x25b512,'name');_0x3d1091['query']=_[_0x5e28('0x31')](_0x152315['query']);_0x3d1091[_0x5e28('0x32')]=_[_0x5e28('0x33')](_0x3d1091['model'],_0x3d1091[_0x5e28('0x34')]);_0x554939['attributes']=_[_0x5e28('0x33')](_0x3d1091[_0x5e28('0x30')],qs[_0x5e28('0x35')](_0x152315[_0x5e28('0x34')]['fields']));_0x554939['attributes']=_0x554939[_0x5e28('0x36')][_0x5e28('0x37')]?_0x554939['attributes']:_0x3d1091['model'];if(!_0x152315[_0x5e28('0x34')][_0x5e28('0x38')](_0x5e28('0x39'))){_0x554939[_0x5e28('0x24')]=qs[_0x5e28('0x24')](_0x152315['query'][_0x5e28('0x24')]);_0x554939[_0x5e28('0x21')]=qs[_0x5e28('0x21')](_0x152315[_0x5e28('0x34')][_0x5e28('0x21')]);}_0x554939['order']=qs[_0x5e28('0x3a')](_0x152315[_0x5e28('0x34')][_0x5e28('0x3a')]);_0x554939['where']=qs[_0x5e28('0x32')](_[_0x5e28('0x3b')](_0x152315[_0x5e28('0x34')],_0x3d1091[_0x5e28('0x32')]),_0x25b512);if(_0x152315[_0x5e28('0x34')]['filter']){_0x554939[_0x5e28('0x3c')]=_[_0x5e28('0x3d')](_0x554939[_0x5e28('0x3c')],{'$or':_['map'](_0x25b512,function(_0x113c62){if(_0x113c62[_0x5e28('0x3e')]!==_0x5e28('0x3f')){var _0x58522e={};_0x58522e[_0x113c62[_0x5e28('0x2b')]]={'$like':'%'+_0x152315['query'][_0x5e28('0x40')]+'%'};return _0x58522e;}})});}_0x554939=_[_0x5e28('0x3d')]({},_0x554939,_0x152315[_0x5e28('0x41')]);var _0x3ecb3d={'where':_0x554939[_0x5e28('0x3c')]};return db[_0x5e28('0x2e')][_0x5e28('0x23')](_0x3ecb3d)['then'](function(_0x26bb37){_0x1c15a3[_0x5e28('0x23')]=_0x26bb37;if(_0x152315[_0x5e28('0x34')][_0x5e28('0x42')]){_0x554939[_0x5e28('0x43')]=[{'all':!![]}];}return db[_0x5e28('0x2e')]['findAll'](_0x554939);})[_0x5e28('0x28')](function(_0x1e681b){_0x1c15a3[_0x5e28('0x44')]=_0x1e681b;return _0x1c15a3;})[_0x5e28('0x28')](respondWithFilteredResult(_0xbc7ddf,_0x554939))[_0x5e28('0x45')](handleError(_0xbc7ddf,null));};exports[_0x5e28('0x46')]=function(_0x31cdff,_0x52ac7a){var _0x22c82d={'raw':!![],'where':{'id':_0x31cdff[_0x5e28('0x47')]['id']}},_0x68eaff={};_0x68eaff['model']=_[_0x5e28('0x31')](db[_0x5e28('0x2e')]['rawAttributes']);_0x68eaff[_0x5e28('0x34')]=_['keys'](_0x31cdff[_0x5e28('0x34')]);_0x68eaff[_0x5e28('0x32')]=_[_0x5e28('0x33')](_0x68eaff[_0x5e28('0x30')],_0x68eaff[_0x5e28('0x34')]);_0x22c82d[_0x5e28('0x36')]=_[_0x5e28('0x33')](_0x68eaff[_0x5e28('0x30')],qs[_0x5e28('0x35')](_0x31cdff[_0x5e28('0x34')][_0x5e28('0x35')]));_0x22c82d[_0x5e28('0x36')]=_0x22c82d[_0x5e28('0x36')]['length']?_0x22c82d['attributes']:_0x68eaff[_0x5e28('0x30')];if(_0x31cdff[_0x5e28('0x34')][_0x5e28('0x42')]){_0x22c82d['include']=[{'all':!![]}];}_0x22c82d=_[_0x5e28('0x3d')]({},_0x22c82d,_0x31cdff[_0x5e28('0x41')]);return db[_0x5e28('0x2e')][_0x5e28('0x48')](_0x22c82d)[_0x5e28('0x28')](handleEntityNotFound(_0x52ac7a,null))['then'](respondWithResult(_0x52ac7a,null))[_0x5e28('0x45')](handleError(_0x52ac7a,null));};exports[_0x5e28('0x49')]=function(_0x41579c,_0x47372f){return db[_0x5e28('0x2e')]['create'](_0x41579c['body'],{})['then'](respondWithResult(_0x47372f,0xc9))[_0x5e28('0x45')](handleError(_0x47372f,null));};exports['update']=function(_0x431958,_0x268f42){if(_0x431958[_0x5e28('0x4a')]['id']){delete _0x431958[_0x5e28('0x4a')]['id'];}return db['ChatInternalMessage'][_0x5e28('0x48')]({'where':{'id':_0x431958['params']['id']}})[_0x5e28('0x28')](handleEntityNotFound(_0x268f42,null))[_0x5e28('0x28')](saveUpdates(_0x431958[_0x5e28('0x4a')],null))[_0x5e28('0x28')](respondWithResult(_0x268f42,null))[_0x5e28('0x45')](handleError(_0x268f42,null));};exports[_0x5e28('0x29')]=function(_0xb4b1ad,_0x3da50d){return db[_0x5e28('0x2e')][_0x5e28('0x48')]({'where':{'id':_0xb4b1ad[_0x5e28('0x47')]['id']}})[_0x5e28('0x28')](handleEntityNotFound(_0x3da50d,null))[_0x5e28('0x28')](removeEntity(_0x3da50d,null))[_0x5e28('0x45')](handleError(_0x3da50d,null));};exports[_0x5e28('0x4b')]=function(_0x4035a0,_0x8cb609){return db[_0x5e28('0x2e')]['describe']()[_0x5e28('0x28')](respondWithResult(_0x8cb609,null))['catch'](handleError(_0x8cb609,null));};function wrapUser(_0x2107ae){return function(_0x5293f3){var _0x278d45=_0x2107ae[_0x5e28('0x4c')]({'plain':!![]});_0x278d45[_0x5e28('0x4d')]=[];if(_0x5293f3){_0x278d45[_0x5e28('0x4e')]=_0x5293f3['createdAt'];_0x278d45['lastMessage']=_0x5293f3;}else{_0x278d45['lastMessageAt']=moment(0x0)[_0x5e28('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x278d45['lastMessage']={};}return _0x278d45;};}exports[_0x5e28('0x50')]=function(_0x3dbc95,_0x532549,_0x3183b2){var _0x1b01a6=[];return db['User'][_0x5e28('0x51')]({'where':{'role':[_0x5e28('0x52'),_0x5e28('0x53'),_0x5e28('0x54')]},'attributes':['id',_0x5e28('0x55'),_0x5e28('0x2b'),_0x5e28('0x56'),_0x5e28('0x57'),_0x5e28('0x58'),_0x5e28('0x59'),_0x5e28('0x5a'),_0x5e28('0x5b'),_0x5e28('0x5c')],'order':qs['sort'](_0x5e28('0x5d')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x5e28('0x2b'),_0x5e28('0x3e')],'through':{'attributes':[]}}]})['then'](function(_0x22e6c3){if(_0x22e6c3){var _0x404567=_0x3dbc95[_0x5e28('0x54')][_0x5e28('0x4c')]({'plain':!![]});if(!_0x404567)throw new Error(_0x5e28('0x5e'));if(_0x404567[_0x5e28('0x56')]===_0x5e28('0x54')){return db[_0x5e28('0x5f')][_0x5e28('0x48')]({'where':{'name':_0x5e28('0x60'),'userProfileId':_0x404567[_0x5e28('0x61')]},'raw':!![]})[_0x5e28('0x28')](function(_0x2e1cac){if(_0x2e1cac){if(_0x2e1cac[_0x5e28('0x62')]===0x0){return db[_0x5e28('0x63')][_0x5e28('0x51')]({'where':{'sectionId':_0x2e1cac['id']},'raw':!![]})[_0x5e28('0x28')](function(_0x46e3c5){var _0x5a3095=[];if(_[_0x5e28('0x64')](_0x46e3c5)){_0x5a3095=_[_0x5e28('0x40')](_0x22e6c3,function(_0x543740){if(_0x543740[_0x5e28('0x56')]!==_0x5e28('0x52')){return _0x543740;}});return _0x5a3095;}else{for(var _0x2e9e11=0x0;_0x2e9e11<_0x22e6c3[_0x5e28('0x37')];_0x2e9e11++){var _0x41348e=_0x22e6c3[_0x2e9e11];if(_0x41348e[_0x5e28('0x56')]===_0x5e28('0x52')){var _0x3da5d8=_['find'](_0x46e3c5,function(_0xc135ab){return _0xc135ab[_0x5e28('0x65')]===_0x41348e['id'];});if(_0x3da5d8)_0x5a3095['push'](_0x41348e);}else{_0x5a3095[_0x5e28('0x66')](_0x41348e);}}return _0x5a3095;}});}else{return _0x22e6c3;}}else{var _0x330227=_[_0x5e28('0x40')](_0x22e6c3,function(_0x29aaa5){if(_0x29aaa5[_0x5e28('0x56')]!==_0x5e28('0x52')){return _0x29aaa5;}});return _0x330227;}});}else{return _0x22e6c3;}}})[_0x5e28('0x28')](function(_0x176ca4){var _0x2364f2=[];if(_0x176ca4){_0x1b01a6=_0x176ca4;for(var _0x135b81=0x0;_0x135b81<_0x176ca4[_0x5e28('0x37')];_0x135b81+=0x1){_0x1b01a6[_0x135b81][_0x5e28('0x4d')]=[];_0x2364f2['push'](db[_0x5e28('0x2e')]['find']({'where':{'FromId':[_0x3dbc95[_0x5e28('0x54')]['id'],_0x176ca4[_0x135b81]['id']],'ToId':[_0x3dbc95['user']['id'],_0x176ca4[_0x135b81]['id']],'ChatGroupId':null},'attributes':['id',_0x5e28('0x67'),_0x5e28('0x68'),_0x5e28('0x69'),_0x5e28('0x6a'),_0x5e28('0x4a')],'order':qs[_0x5e28('0x3a')](_0x5e28('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5e28('0x28')](wrapUser(_0x176ca4[_0x135b81])));}return BPromise[_0x5e28('0x6c')](_0x2364f2);}return[];})[_0x5e28('0x28')](function(_0x10acb2){return{'rows':_0x10acb2,'count':_0x10acb2['length']};})[_0x5e28('0x28')](respondWithResult(_0x532549,null))['catch'](handleError(_0x532549,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index f251414..0ed7172 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 _0xf5ff=['setMaxListeners','save','emit','exports','events','ChatInternalMessage'];(function(_0x8bb2ba,_0x1d2097){var _0x2464c5=function(_0x1baee4){while(--_0x1baee4){_0x8bb2ba['push'](_0x8bb2ba['shift']());}};_0x2464c5(++_0x1d2097);}(_0xf5ff,0xbe));var _0xff5f=function(_0xc60eb5,_0x59eea4){_0xc60eb5=_0xc60eb5-0x0;var _0x3c5554=_0xf5ff[_0xc60eb5];return _0x3c5554;};'use strict';var EventEmitter=require(_0xff5f('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xff5f('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xff5f('0x2')](0x0);var events={'afterCreate':_0xff5f('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x592538){return function(_0x7f44f2,_0x1cc84f,_0x4606a2){ChatInternalMessageEvents[_0xff5f('0x4')](_0x592538+':'+_0x7f44f2['id'],_0x7f44f2);ChatInternalMessageEvents[_0xff5f('0x4')](_0x592538,_0x7f44f2);_0x4606a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xff5f('0x5')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xea69=['exports','events','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x356d31,_0x151a64){var _0x3b6088=function(_0x26654a){while(--_0x26654a){_0x356d31['push'](_0x356d31['shift']());}};_0x3b6088(++_0x151a64);}(_0xea69,0x97));var _0x9ea6=function(_0x59c45a,_0x1886c4){_0x59c45a=_0x59c45a-0x0;var _0x527e17=_0xea69[_0x59c45a];return _0x527e17;};'use strict';var EventEmitter=require(_0x9ea6('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x9ea6('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x9ea6('0x2')](0x0);var events={'afterCreate':_0x9ea6('0x3'),'afterUpdate':_0x9ea6('0x4'),'afterDestroy':_0x9ea6('0x5')};function emitEvent(_0x43df72){return function(_0x2326e9,_0x58927f,_0x43ecb9){ChatInternalMessageEvents[_0x9ea6('0x6')](_0x43df72+':'+_0x2326e9['id'],_0x2326e9);ChatInternalMessageEvents[_0x9ea6('0x6')](_0x43df72,_0x2326e9);_0x43ecb9(null);};}for(var e in events){if(events[_0x9ea6('0x7')](e)){var event=events[e];ChatInternalMessage[_0x9ea6('0x8')](e,emitEvent(event));}}module[_0x9ea6('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index de6e50f..7d0361d 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 _0x58be=['rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x58be,0x158));var _0xe58b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x58be[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe58b('0x0'));var util=require(_0xe58b('0x1'));var logger=require('../../config/logger')(_0xe58b('0x2'));var moment=require(_0xe58b('0x3'));var BPromise=require('bluebird');var rp=require(_0xe58b('0x4'));var fs=require('fs');var path=require(_0xe58b('0x5'));var rimraf=require(_0xe58b('0x6'));var config=require(_0xe58b('0x7'));var attributes=require(_0xe58b('0x8'));module['exports']=function(_0x1f1237,_0x4cdbe9){return _0x1f1237[_0xe58b('0x9')](_0xe58b('0xa'),attributes,{'tableName':_0xe58b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe58b('0xc'),'collate':_0xe58b('0xd')});}; \ No newline at end of file +var _0xc006=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x31ed20,_0x2709b4){var _0x2379c9=function(_0x20ed02){while(--_0x20ed02){_0x31ed20['push'](_0x31ed20['shift']());}};_0x2379c9(++_0x2709b4);}(_0xc006,0x1de));var _0x6c00=function(_0x5c8f3e,_0x33ba70){_0x5c8f3e=_0x5c8f3e-0x0;var _0xb55f35=_0xc006[_0x5c8f3e];return _0xb55f35;};'use strict';var _=require(_0x6c00('0x0'));var util=require(_0x6c00('0x1'));var logger=require(_0x6c00('0x2'))(_0x6c00('0x3'));var moment=require(_0x6c00('0x4'));var BPromise=require(_0x6c00('0x5'));var rp=require(_0x6c00('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c00('0x7'));var config=require(_0x6c00('0x8'));var attributes=require(_0x6c00('0x9'));module[_0x6c00('0xa')]=function(_0x215e5b,_0x25671c){return _0x215e5b[_0x6c00('0xb')]('ChatInternalMessage',attributes,{'tableName':_0x6c00('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6c00('0xd'),'collate':_0x6c00('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 9ac1786..335eb99 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 _0x0b31=['then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0x0b31,0x1a2));var _0x10b3=function(_0x59f15c,_0x24bf17){_0x59f15c=_0x59f15c-0x0;var _0xfb1050=_0x0b31[_0x59f15c];return _0xfb1050;};'use strict';var _=require(_0x10b3('0x0'));var util=require(_0x10b3('0x1'));var moment=require(_0x10b3('0x2'));var BPromise=require('bluebird');var rs=require(_0x10b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x10b3('0x4'));var logger=require(_0x10b3('0x5'))(_0x10b3('0x6'));var config=require(_0x10b3('0x7'));var jayson=require(_0x10b3('0x8'));var client=jayson[_0x10b3('0x9')][_0x10b3('0xa')]({'port':0x232a});config[_0x10b3('0xb')]=_[_0x10b3('0xc')](config['redis'],{'host':_0x10b3('0xd'),'port':0x18eb});var socket=require(_0x10b3('0xe'))(new Redis(config[_0x10b3('0xb')]));require(_0x10b3('0xf'))['register'](socket);function respondWithRpcPromise(_0x1fd8a6,_0x38c841,_0x5dc288){return new BPromise(function(_0x133c70,_0x43aaf2){return client[_0x10b3('0x10')](_0x1fd8a6,_0x5dc288)[_0x10b3('0x11')](function(_0x3341e4){logger['info'](_0x10b3('0x12'),_0x38c841,_0x10b3('0x13'));logger[_0x10b3('0x14')](_0x10b3('0x15'),_0x38c841,'request\x20sent',JSON[_0x10b3('0x16')](_0x3341e4));if(_0x3341e4[_0x10b3('0x17')]){if(_0x3341e4[_0x10b3('0x17')][_0x10b3('0x18')]===0x1f4){logger[_0x10b3('0x17')](_0x10b3('0x12'),_0x38c841,_0x3341e4[_0x10b3('0x17')][_0x10b3('0x19')]);return _0x43aaf2(_0x3341e4['error']['message']);}logger['error'](_0x10b3('0x12'),_0x38c841,_0x3341e4['error'][_0x10b3('0x19')]);return _0x133c70(_0x3341e4[_0x10b3('0x17')]['message']);}else{logger[_0x10b3('0x1a')](_0x10b3('0x12'),_0x38c841,'request\x20sent');_0x133c70(_0x3341e4[_0x10b3('0x1b')][_0x10b3('0x19')]);}})[_0x10b3('0x1c')](function(_0x19e3fe){logger['error'](_0x10b3('0x12'),_0x38c841,_0x19e3fe);_0x43aaf2(_0x19e3fe);});});} \ No newline at end of file +var _0xbe43=['../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4ded39,_0x146dd4){var _0x1259b1=function(_0x3f3ae4){while(--_0x3f3ae4){_0x4ded39['push'](_0x4ded39['shift']());}};_0x1259b1(++_0x146dd4);}(_0xbe43,0xbb));var _0x3be4=function(_0x2cc338,_0x5585d8){_0x2cc338=_0x2cc338-0x0;var _0x2a8920=_0xbe43[_0x2cc338];return _0x2a8920;};'use strict';var _=require(_0x3be4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3be4('0x1'));var fs=require('fs');var Redis=require(_0x3be4('0x2'));var db=require(_0x3be4('0x3'))['db'];var utils=require(_0x3be4('0x4'));var logger=require(_0x3be4('0x5'))('rpc');var config=require(_0x3be4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3be4('0x7')][_0x3be4('0x8')]({'port':0x232a});config[_0x3be4('0x9')]=_['defaults'](config['redis'],{'host':_0x3be4('0xa'),'port':0x18eb});var socket=require(_0x3be4('0xb'))(new Redis(config[_0x3be4('0x9')]));require(_0x3be4('0xc'))['register'](socket);function respondWithRpcPromise(_0x3d7c0d,_0x15b4e6,_0x5ef2ea){return new BPromise(function(_0x11209b,_0x5effd4){return client[_0x3be4('0xd')](_0x3d7c0d,_0x5ef2ea)[_0x3be4('0xe')](function(_0x4ae979){logger[_0x3be4('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x15b4e6,_0x3be4('0x10'));logger['debug'](_0x3be4('0x11'),_0x15b4e6,_0x3be4('0x10'),JSON[_0x3be4('0x12')](_0x4ae979));if(_0x4ae979[_0x3be4('0x13')]){if(_0x4ae979[_0x3be4('0x13')][_0x3be4('0x14')]===0x1f4){logger['error'](_0x3be4('0x15'),_0x15b4e6,_0x4ae979[_0x3be4('0x13')]['message']);return _0x5effd4(_0x4ae979[_0x3be4('0x13')][_0x3be4('0x16')]);}logger['error'](_0x3be4('0x15'),_0x15b4e6,_0x4ae979['error'][_0x3be4('0x16')]);return _0x11209b(_0x4ae979['error'][_0x3be4('0x16')]);}else{logger[_0x3be4('0xf')](_0x3be4('0x15'),_0x15b4e6,_0x3be4('0x10'));_0x11209b(_0x4ae979[_0x3be4('0x17')][_0x3be4('0x16')]);}})['catch'](function(_0x547a92){logger[_0x3be4('0x13')](_0x3be4('0x15'),_0x15b4e6,_0x547a92);_0x5effd4(_0x547a92);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 0d4bfdc..4cd5f7c 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 _0xfc00=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','remove','update'];(function(_0x237a26,_0x4d9a41){var _0x2b12c9=function(_0x4103f5){while(--_0x4103f5){_0x237a26['push'](_0x237a26['shift']());}};_0x2b12c9(++_0x4d9a41);}(_0xfc00,0x1d5));var _0x0fc0=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xfc00[_0x3826ad];return _0x17b900;};'use strict';var ChatInternalMessageEvents=require(_0x0fc0('0x0'));var events=['save',_0x0fc0('0x1'),_0x0fc0('0x2')];function createListener(_0xcc99d7,_0xa5cc2){return function(_0x5e49dd){_0xa5cc2[_0x0fc0('0x3')](_0xcc99d7,_0x5e49dd);};}function removeListener(_0x9b95e5,_0x3832bb){return function(){ChatInternalMessageEvents[_0x0fc0('0x4')](_0x9b95e5,_0x3832bb);};}exports[_0x0fc0('0x5')]=function(_0x582b65){for(var _0x4b540a=0x0,_0x43e07f=events[_0x0fc0('0x6')];_0x4b540a<_0x43e07f;_0x4b540a++){var _0x42942d=events[_0x4b540a];var _0xe0939d=createListener(_0x0fc0('0x7')+_0x42942d,_0x582b65);ChatInternalMessageEvents['on'](_0x42942d,_0xe0939d);}}; \ No newline at end of file +var _0xacea=['update','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xacea,0x1ed));var _0xaace=function(_0x21e75a,_0x40dc8a){_0x21e75a=_0x21e75a-0x0;var _0x6972f8=_0xacea[_0x21e75a];return _0x6972f8;};'use strict';var ChatInternalMessageEvents=require(_0xaace('0x0'));var events=[_0xaace('0x1'),_0xaace('0x2'),_0xaace('0x3')];function createListener(_0x53a913,_0x22ac89){return function(_0x335bb4){_0x22ac89['emit'](_0x53a913,_0x335bb4);};}function removeListener(_0x376786,_0x92c34){return function(){ChatInternalMessageEvents[_0xaace('0x4')](_0x376786,_0x92c34);};}exports[_0xaace('0x5')]=function(_0x203fcf){for(var _0x30e7b0=0x0,_0x52a453=events[_0xaace('0x6')];_0x30e7b0<_0x52a453;_0x30e7b0++){var _0x4d6d51=events[_0x30e7b0];var _0xbd98e0=createListener(_0xaace('0x7')+_0x4d6d51,_0x203fcf);ChatInternalMessageEvents['on'](_0x4d6d51,_0xbd98e0);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index ef909c8..c956304 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 _0xfe8d=['/:id','show','post','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','getUsers'];(function(_0x2bd7ef,_0x279212){var _0x42e78a=function(_0x1369d4){while(--_0x1369d4){_0x2bd7ef['push'](_0x2bd7ef['shift']());}};_0x42e78a(++_0x279212);}(_0xfe8d,0x15b));var _0xdfe8=function(_0x3f98a7,_0x2230ae){_0x3f98a7=_0x3f98a7-0x0;var _0x190227=_0xfe8d[_0x3f98a7];return _0x190227;};'use strict';var multer=require(_0xdfe8('0x0'));var util=require(_0xdfe8('0x1'));var path=require('path');var timeout=require(_0xdfe8('0x2'));var express=require(_0xdfe8('0x3'));var router=express[_0xdfe8('0x4')]();var fs_extra=require(_0xdfe8('0x5'));var auth=require(_0xdfe8('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdfe8('0x7'));router[_0xdfe8('0x8')]('/',auth[_0xdfe8('0x9')](),controller['index']);router['get'](_0xdfe8('0xa'),auth[_0xdfe8('0x9')](),controller[_0xdfe8('0xb')]);router[_0xdfe8('0x8')](_0xdfe8('0xc'),auth[_0xdfe8('0x9')](),controller[_0xdfe8('0xd')]);router[_0xdfe8('0x8')](_0xdfe8('0xe'),auth[_0xdfe8('0x9')](),controller[_0xdfe8('0xf')]);router[_0xdfe8('0x10')]('/',auth[_0xdfe8('0x9')](),controller['create']);router['put'](_0xdfe8('0xe'),controller['update']);router[_0xdfe8('0x11')](_0xdfe8('0xe'),auth[_0xdfe8('0x9')](),controller['destroy']);module[_0xdfe8('0x12')]=router; \ No newline at end of file +var _0x0b59=['index','/describe','describe','/users','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get'];(function(_0x391127,_0x5cb2df){var _0x3c4c11=function(_0x350e7){while(--_0x350e7){_0x391127['push'](_0x391127['shift']());}};_0x3c4c11(++_0x5cb2df);}(_0x0b59,0xae));var _0x90b5=function(_0x6a3b0,_0x3ffffe){_0x6a3b0=_0x6a3b0-0x0;var _0x124558=_0x0b59[_0x6a3b0];return _0x124558;};'use strict';var multer=require(_0x90b5('0x0'));var util=require(_0x90b5('0x1'));var path=require(_0x90b5('0x2'));var timeout=require(_0x90b5('0x3'));var express=require(_0x90b5('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90b5('0x5'));var interaction=require(_0x90b5('0x6'));var config=require(_0x90b5('0x7'));var controller=require(_0x90b5('0x8'));router[_0x90b5('0x9')]('/',auth['isAuthenticated'](),controller[_0x90b5('0xa')]);router[_0x90b5('0x9')](_0x90b5('0xb'),auth['isAuthenticated'](),controller[_0x90b5('0xc')]);router[_0x90b5('0x9')](_0x90b5('0xd'),auth[_0x90b5('0xe')](),controller['getUsers']);router[_0x90b5('0x9')](_0x90b5('0xf'),auth[_0x90b5('0xe')](),controller[_0x90b5('0x10')]);router['post']('/',auth[_0x90b5('0xe')](),controller[_0x90b5('0x11')]);router[_0x90b5('0x12')](_0x90b5('0xf'),controller[_0x90b5('0x13')]);router[_0x90b5('0x14')]('/:id',auth[_0x90b5('0xe')](),controller[_0x90b5('0x15')]);module[_0x90b5('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 89096bb..ce2fe3f 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 _0x6f59=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x4a74e,_0x51c3e2){var _0x527e45=function(_0x204fd6){while(--_0x204fd6){_0x4a74e['push'](_0x4a74e['shift']());}};_0x527e45(++_0x51c3e2);}(_0x6f59,0x1be));var _0x96f5=function(_0x575d29,_0x45a14c){_0x575d29=_0x575d29-0x0;var _0x236d7b=_0x6f59[_0x575d29];return _0x236d7b;};'use strict';var Sequelize=require(_0x96f5('0x0'));module[_0x96f5('0x1')]={'body':{'type':Sequelize[_0x96f5('0x2')](_0x96f5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x96f5('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x96f5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x96f5('0x5')]('in',_0x96f5('0x6')),'defaultValue':_0x96f5('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x96f5('0x7')]},'providerName':{'type':Sequelize[_0x96f5('0x8')]},'providerResponse':{'type':Sequelize[_0x96f5('0x2')]}}; \ No newline at end of file +var _0x8580=['medium','ENUM','out','DATE','STRING','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8580,0x1c7));var _0x0858=function(_0x1ded08,_0x137e95){_0x1ded08=_0x1ded08-0x0;var _0x290eff=_0x8580[_0x1ded08];return _0x290eff;};'use strict';var Sequelize=require('sequelize');module[_0x0858('0x0')]={'body':{'type':Sequelize['TEXT'](_0x0858('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0858('0x2')]('in',_0x0858('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x0858('0x4')]},'providerName':{'type':Sequelize[_0x0858('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 961ae93..5e2b0e4 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 _0xfe9f=['UserId','user','get','ChatInteraction','ChatInteractionId','interaction','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','agent','fullname','internal','interface','format','channel','motionChannel','formData','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','sendStatus','name','send','index','map','ChatMessage','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','update','describe','accept','acceptMessage','reject'];(function(_0x2e2a99,_0x38d7dd){var _0x38a24f=function(_0x1ae082){while(--_0x1ae082){_0x2e2a99['push'](_0x2e2a99['shift']());}};_0x38a24f(++_0x38d7dd);}(_0xfe9f,0x1a6));var _0xffe9=function(_0x2756f9,_0x5519f5){_0x2756f9=_0x2756f9-0x0;var _0x2dad62=_0xfe9f[_0x2756f9];return _0x2dad62;};'use strict';var util=require('util');var _=require(_0xffe9('0x0'));var Redis=require(_0xffe9('0x1'));var interactionService=require(_0xffe9('0x2'));var qs=require(_0xffe9('0x3'));var logger=require(_0xffe9('0x4'))(_0xffe9('0x5'));var config=require(_0xffe9('0x6'));var db=require('../../mysqldb')['db'];config[_0xffe9('0x7')]=_[_0xffe9('0x8')](config[_0xffe9('0x7')],{'host':_0xffe9('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xffe9('0x7')]));require(_0xffe9('0xa'))[_0xffe9('0xb')](socket);var jayson=require(_0xffe9('0xc'));var client=jayson[_0xffe9('0xd')][_0xffe9('0xe')]({'port':0x232c});var client9002=jayson['client'][_0xffe9('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')('chat-interactions');function respondWithRpcPromise(_0x2fa821,_0x903c2e,_0x28c656,_0x19dce3){return new Promise(function(_0x5463bf,_0x52ed56){var _0xcad036=_0x19dce3||client;return _0xcad036[_0xffe9('0xf')](_0x2fa821,_0x28c656)[_0xffe9('0x10')](function(_0x1e18ef){logger[_0xffe9('0x11')](_0xffe9('0x12'),_0x903c2e,'request\x20sent');logger[_0xffe9('0x13')](_0xffe9('0x14'),_0x903c2e,'request\x20sent',JSON[_0xffe9('0x15')](_0x1e18ef));if(_0x1e18ef[_0xffe9('0x16')]){if(_0x1e18ef[_0xffe9('0x16')][_0xffe9('0x17')]===0x1f4){logger['error'](_0xffe9('0x12'),_0x903c2e,_0x1e18ef[_0xffe9('0x16')][_0xffe9('0x18')]);return _0x52ed56(_0x1e18ef['error']['message']);}logger[_0xffe9('0x16')]('ChatMessage,\x20%s,\x20%s',_0x903c2e,_0x1e18ef[_0xffe9('0x16')][_0xffe9('0x18')]);return _0x5463bf(_0x1e18ef[_0xffe9('0x16')][_0xffe9('0x18')]);}else{logger[_0xffe9('0x11')]('ChatMessage,\x20%s,\x20%s',_0x903c2e,_0xffe9('0x19'));_0x5463bf(_0x1e18ef[_0xffe9('0x1a')]['message']);}})[_0xffe9('0x1b')](function(_0x5e19cd){logger[_0xffe9('0x16')](_0xffe9('0x12'),_0x903c2e,_0x5e19cd);_0x52ed56(_0x5e19cd);});});}function respondWithResult(_0x4fbad9,_0x3a0c2d){_0x3a0c2d=_0x3a0c2d||0xc8;return function(_0x3433d6){if(_0x3433d6){return _0x4fbad9[_0xffe9('0x1c')](_0x3a0c2d)[_0xffe9('0x1d')](_0x3433d6);}};}function respondWithFilteredResult(_0x46dacc,_0x14bb0a){return function(_0x4d7b76){if(_0x4d7b76){var _0x308f96=typeof _0x14bb0a[_0xffe9('0x1e')]===_0xffe9('0x1f')&&typeof _0x14bb0a[_0xffe9('0x20')]==='undefined';var _0x35d086=_0x4d7b76[_0xffe9('0x21')];var _0x2d5004=_0x308f96?0x0:_0x14bb0a[_0xffe9('0x1e')];var _0x407f45=_0x308f96?_0x4d7b76[_0xffe9('0x21')]:_0x14bb0a[_0xffe9('0x1e')]+_0x14bb0a[_0xffe9('0x20')];var _0x480c06;if(_0x407f45>=_0x35d086){_0x407f45=_0x35d086;_0x480c06=0xc8;}else{_0x480c06=0xce;}_0x46dacc[_0xffe9('0x1c')](_0x480c06);return _0x46dacc[_0xffe9('0x22')](_0xffe9('0x23'),_0x2d5004+'-'+_0x407f45+'/'+_0x35d086)[_0xffe9('0x1d')](_0x4d7b76);}return null;};}function saveUpdates(_0x193077){return function(_0x2bd8e2){if(_0x2bd8e2){return _0x2bd8e2['update'](_0x193077)[_0xffe9('0x10')](function(_0x53f53b){return _0x53f53b;});}return null;};}function removeEntity(_0x133d8c){return function(_0x11ce63){if(_0x11ce63){return _0x11ce63[_0xffe9('0x24')]()[_0xffe9('0x10')](function(){_0x133d8c[_0xffe9('0x1c')](0xcc)[_0xffe9('0x25')]();});}};}function handleEntityNotFound(_0x5c3d76){return function(_0x384a54){if(!_0x384a54){_0x5c3d76[_0xffe9('0x26')](0x194);}return _0x384a54;};}function handleError(_0x5b482e,_0x2e28e6){_0x2e28e6=_0x2e28e6||0x1f4;return function(_0x58c39b){logger[_0xffe9('0x16')](_0x58c39b['stack']);if(_0x58c39b[_0xffe9('0x27')]){delete _0x58c39b[_0xffe9('0x27')];}_0x5b482e[_0xffe9('0x1c')](_0x2e28e6)[_0xffe9('0x28')](_0x58c39b);};}exports[_0xffe9('0x29')]=function(_0xea2802,_0x1e0397){var _0x329c27={},_0xe7b9f1={},_0x3a56fa={'count':0x0,'rows':[]};var _0x320afa=_[_0xffe9('0x2a')](db[_0xffe9('0x2b')]['rawAttributes'],function(_0x5616c4){return{'name':_0x5616c4[_0xffe9('0x2c')],'type':_0x5616c4[_0xffe9('0x2d')][_0xffe9('0x2e')]};});_0xe7b9f1[_0xffe9('0x2f')]=_['map'](_0x320afa,_0xffe9('0x27'));_0xe7b9f1['query']=_[_0xffe9('0x30')](_0xea2802[_0xffe9('0x31')]);_0xe7b9f1[_0xffe9('0x32')]=_[_0xffe9('0x33')](_0xe7b9f1[_0xffe9('0x2f')],_0xe7b9f1[_0xffe9('0x31')]);_0x329c27[_0xffe9('0x34')]=_['intersection'](_0xe7b9f1[_0xffe9('0x2f')],qs[_0xffe9('0x35')](_0xea2802[_0xffe9('0x31')]['fields']));_0x329c27[_0xffe9('0x34')]=_0x329c27[_0xffe9('0x34')][_0xffe9('0x36')]?_0x329c27[_0xffe9('0x34')]:_0xe7b9f1['model'];if(!_0xea2802[_0xffe9('0x31')][_0xffe9('0x37')]('nolimit')){_0x329c27['limit']=qs[_0xffe9('0x20')](_0xea2802['query'][_0xffe9('0x20')]);_0x329c27[_0xffe9('0x1e')]=qs[_0xffe9('0x1e')](_0xea2802[_0xffe9('0x31')][_0xffe9('0x1e')]);}_0x329c27[_0xffe9('0x38')]=qs[_0xffe9('0x39')](_0xea2802[_0xffe9('0x31')][_0xffe9('0x39')]);_0x329c27[_0xffe9('0x3a')]=qs[_0xffe9('0x32')](_[_0xffe9('0x3b')](_0xea2802[_0xffe9('0x31')],_0xe7b9f1[_0xffe9('0x32')]),_0x320afa);if(_0xea2802[_0xffe9('0x31')][_0xffe9('0x3c')]){_0x329c27[_0xffe9('0x3a')]=_['merge'](_0x329c27[_0xffe9('0x3a')],{'$or':_[_0xffe9('0x2a')](_0x320afa,function(_0x402aca){if(_0x402aca['type']!==_0xffe9('0x3d')){var _0x22412f={};_0x22412f[_0x402aca[_0xffe9('0x27')]]={'$like':'%'+_0xea2802['query']['filter']+'%'};return _0x22412f;}})});}_0x329c27=_['merge']({},_0x329c27,_0xea2802['options']);var _0x5af17c={'where':_0x329c27['where']};return db[_0xffe9('0x2b')][_0xffe9('0x21')](_0x5af17c)[_0xffe9('0x10')](function(_0x2c9374){_0x3a56fa['count']=_0x2c9374;if(_0xea2802[_0xffe9('0x31')][_0xffe9('0x3e')]){_0x329c27[_0xffe9('0x3f')]=[{'all':!![]}];}return db[_0xffe9('0x2b')][_0xffe9('0x40')](_0x329c27);})[_0xffe9('0x10')](function(_0x1d8c6e){_0x3a56fa[_0xffe9('0x41')]=_0x1d8c6e;return _0x3a56fa;})[_0xffe9('0x10')](respondWithFilteredResult(_0x1e0397,_0x329c27))[_0xffe9('0x1b')](handleError(_0x1e0397,null));};exports[_0xffe9('0x42')]=function(_0x379194,_0x2629e0){var _0x5d2c0f={'raw':!![],'where':{'id':_0x379194[_0xffe9('0x43')]['id']}},_0x45041a={};_0x45041a[_0xffe9('0x2f')]=_[_0xffe9('0x30')](db[_0xffe9('0x2b')][_0xffe9('0x44')]);_0x45041a[_0xffe9('0x31')]=_['keys'](_0x379194[_0xffe9('0x31')]);_0x45041a['filters']=_[_0xffe9('0x33')](_0x45041a[_0xffe9('0x2f')],_0x45041a[_0xffe9('0x31')]);_0x5d2c0f[_0xffe9('0x34')]=_['intersection'](_0x45041a[_0xffe9('0x2f')],qs['fields'](_0x379194['query'][_0xffe9('0x35')]));_0x5d2c0f['attributes']=_0x5d2c0f['attributes']['length']?_0x5d2c0f[_0xffe9('0x34')]:_0x45041a[_0xffe9('0x2f')];if(_0x379194[_0xffe9('0x31')][_0xffe9('0x3e')]){_0x5d2c0f[_0xffe9('0x3f')]=[{'all':!![]}];}_0x5d2c0f=_['merge']({},_0x5d2c0f,_0x379194[_0xffe9('0x45')]);return db[_0xffe9('0x2b')][_0xffe9('0x46')](_0x5d2c0f)[_0xffe9('0x10')](handleEntityNotFound(_0x2629e0,null))[_0xffe9('0x10')](respondWithResult(_0x2629e0,null))[_0xffe9('0x1b')](handleError(_0x2629e0,null));};exports[_0xffe9('0x47')]=function(_0x3fbf1f,_0x420099){return db[_0xffe9('0x2b')][_0xffe9('0x47')](_0x3fbf1f[_0xffe9('0x48')],{})[_0xffe9('0x10')](respondWithResult(_0x420099,0xc9))[_0xffe9('0x1b')](handleError(_0x420099,null));};exports[_0xffe9('0x49')]=function(_0x4a3303,_0x410f99){if(_0x4a3303[_0xffe9('0x48')]['id']){delete _0x4a3303[_0xffe9('0x48')]['id'];}return db[_0xffe9('0x2b')][_0xffe9('0x46')]({'where':{'id':_0x4a3303[_0xffe9('0x43')]['id']}})[_0xffe9('0x10')](handleEntityNotFound(_0x410f99,null))[_0xffe9('0x10')](saveUpdates(_0x4a3303[_0xffe9('0x48')],null))[_0xffe9('0x10')](respondWithResult(_0x410f99,null))['catch'](handleError(_0x410f99,null));};exports[_0xffe9('0x24')]=function(_0x20548a,_0xe1e51f){return db['ChatMessage']['find']({'where':{'id':_0x20548a[_0xffe9('0x43')]['id']}})['then'](handleEntityNotFound(_0xe1e51f,null))['then'](removeEntity(_0xe1e51f,null))['catch'](handleError(_0xe1e51f,null));};exports[_0xffe9('0x4a')]=function(_0x2a15ad,_0x49eecb){return db['ChatMessage']['describe']()[_0xffe9('0x10')](respondWithResult(_0x49eecb,null))[_0xffe9('0x1b')](handleError(_0x49eecb,null));};exports[_0xffe9('0x4b')]=function(_0x4ad57c,_0x534448){var _0x223926='chat';return interactionService[_0xffe9('0x4c')](_0x4ad57c,_0x223926)['then'](respondWithResult(_0x534448,null))['catch'](handleError(_0x534448,null));};exports[_0xffe9('0x4d')]=function(_0x58167e,_0x1a92ef){var _0x1cb4cb={'agent':{},'channel':'chat'};if(_0x58167e['body']['id']){delete _0x58167e[_0xffe9('0x48')]['id'];}_0x58167e[_0xffe9('0x48')][_0xffe9('0x4e')]=_0x58167e['body']['UserId']||_0x58167e[_0xffe9('0x4f')]['id'];_0x1cb4cb['agent']['id']=_0x58167e[_0xffe9('0x48')][_0xffe9('0x4e')];return db[_0xffe9('0x2b')][_0xffe9('0x46')]({'where':{'id':_0x58167e[_0xffe9('0x43')]['id'],'UserId':null}})[_0xffe9('0x10')](handleEntityNotFound(_0x1a92ef,null))[_0xffe9('0x10')](function(_0x3aae2c){if(_0x3aae2c){_0x1cb4cb[_0xffe9('0x18')]=_0x3aae2c[_0xffe9('0x50')]({'plain':!![]});return db[_0xffe9('0x51')]['find']({'where':{'id':_0x3aae2c[_0xffe9('0x52')]}});}return null;})[_0xffe9('0x10')](handleEntityNotFound(_0x1a92ef,null))['then'](function(_0x3c6a6b){if(_0x3c6a6b){_0x1cb4cb[_0xffe9('0x53')]=_0x3c6a6b['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x58167e[_0xffe9('0x4f')]['id'],_0x58167e[_0xffe9('0x4f')][_0xffe9('0x27')],_0x58167e[_0xffe9('0x4f')][_0xffe9('0x54')],_0x1cb4cb[_0xffe9('0x53')]['id'],_0x58167e[_0xffe9('0x48')]?JSON[_0xffe9('0x15')](_0x58167e[_0xffe9('0x48')]):_0xffe9('0x55'));return respondWithRpcPromise(_0xffe9('0x56'),'rejectMessage',_0x1cb4cb);}return null;})[_0xffe9('0x10')](function(_0x4ab3f7){var _0x19afc8=_0xffe9('0x57')+_0x4ab3f7['message'][_0xffe9('0x58')];return db['sequelize']['query'](_0x19afc8,{'type':db[_0xffe9('0x59')][_0xffe9('0x5a')]['SELECT'],'raw':!![]})[_0xffe9('0x10')](function(_0x346888){return _0x346888;});})['then'](function(_0x312ef7){if(_0x312ef7){_0x1cb4cb['message'][_0xffe9('0x5b')]=_0x312ef7[0x0];if(!_0x58167e[_0xffe9('0x48')]['UserId'])return;return db['User'][_0xffe9('0x46')]({'where':{'id':_0x58167e[_0xffe9('0x48')][_0xffe9('0x4e')],'role':_0xffe9('0x5c')},'attributes':['id',_0xffe9('0x27'),_0xffe9('0x5d'),'email',_0xffe9('0x5e')],'raw':!![]});}return null;})['then'](function(_0x3b609b){if(!_0x3b609b)return null;_0x1cb4cb[_0xffe9('0x18')][_0xffe9('0x5c')]=_0x3b609b;return _0x1cb4cb;})[_0xffe9('0x10')](function(_0x1501db){if(_0x1501db){_0x1501db[_0xffe9('0x18')][_0xffe9('0x5f')]=util[_0xffe9('0x60')]('SIP/%s',_0x58167e[_0xffe9('0x4f')][_0xffe9('0x27')]);_0x1501db[_0xffe9('0x18')][_0xffe9('0x61')]=_0x1cb4cb[_0xffe9('0x61')];_0x1501db[_0xffe9('0x18')][_0xffe9('0x62')]=_0x1cb4cb['channel'];_0x1501db[_0xffe9('0x18')]['event']=_0xffe9('0x4d');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_['merge'](_0x1cb4cb[_0xffe9('0x18')],JSON['parse'](_0x1cb4cb[_0xffe9('0x53')][_0xffe9('0x63')]))},client9002);return _0x1cb4cb;}return null;})[_0xffe9('0x10')](respondWithResult(_0x1a92ef,null))['catch'](handleError(_0x1a92ef,null));}; \ No newline at end of file +var _0x0e87=['../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','chat-interactions','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','undefined','count','limit','Content-Range','json','update','destroy','sendStatus','stack','name','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','includeAll','create','body','find','params','describe','chat','acceptMessage','reject','UserId','user','agent','get','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','internal','interface','format','SIP/%s','channel','motionChannel','EventManager','rejectmessage','interaction','util','lodash','../../components/interaction/service'];(function(_0x9709ce,_0x5765af){var _0x414c87=function(_0x51149b){while(--_0x51149b){_0x9709ce['push'](_0x9709ce['shift']());}};_0x414c87(++_0x5765af);}(_0x0e87,0x64));var _0x70e8=function(_0x1b72de,_0x525ddc){_0x1b72de=_0x1b72de-0x0;var _0x17618f=_0x0e87[_0x1b72de];return _0x17618f;};'use strict';var util=require(_0x70e8('0x0'));var _=require(_0x70e8('0x1'));var Redis=require('ioredis');var interactionService=require(_0x70e8('0x2'));var qs=require(_0x70e8('0x3'));var logger=require(_0x70e8('0x4'))(_0x70e8('0x5'));var config=require(_0x70e8('0x6'));var db=require(_0x70e8('0x7'))['db'];config[_0x70e8('0x8')]=_[_0x70e8('0x9')](config[_0x70e8('0x8')],{'host':_0x70e8('0xa'),'port':0x18eb});var socket=require(_0x70e8('0xb'))(new Redis(config['redis']));require(_0x70e8('0xc'))[_0x70e8('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0x70e8('0xe')][_0x70e8('0xf')]({'port':0x232c});var client9002=jayson[_0x70e8('0xe')][_0x70e8('0xf')]({'port':0x232a});var interaction_log=require(_0x70e8('0x4'))(_0x70e8('0x10'));function respondWithRpcPromise(_0x40b2f8,_0x64512f,_0x763b4e,_0x3c7ff0){return new Promise(function(_0x13f9df,_0xcb74ad){var _0x3f618d=_0x3c7ff0||client;return _0x3f618d[_0x70e8('0x11')](_0x40b2f8,_0x763b4e)[_0x70e8('0x12')](function(_0x3b6e81){logger[_0x70e8('0x13')](_0x70e8('0x14'),_0x64512f,_0x70e8('0x15'));logger[_0x70e8('0x16')](_0x70e8('0x17'),_0x64512f,'request\x20sent',JSON[_0x70e8('0x18')](_0x3b6e81));if(_0x3b6e81[_0x70e8('0x19')]){if(_0x3b6e81[_0x70e8('0x19')][_0x70e8('0x1a')]===0x1f4){logger[_0x70e8('0x19')](_0x70e8('0x14'),_0x64512f,_0x3b6e81[_0x70e8('0x19')]['message']);return _0xcb74ad(_0x3b6e81[_0x70e8('0x19')][_0x70e8('0x1b')]);}logger[_0x70e8('0x19')]('ChatMessage,\x20%s,\x20%s',_0x64512f,_0x3b6e81[_0x70e8('0x19')][_0x70e8('0x1b')]);return _0x13f9df(_0x3b6e81[_0x70e8('0x19')][_0x70e8('0x1b')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x64512f,_0x70e8('0x15'));_0x13f9df(_0x3b6e81[_0x70e8('0x1c')]['message']);}})[_0x70e8('0x1d')](function(_0x42eca9){logger[_0x70e8('0x19')](_0x70e8('0x14'),_0x64512f,_0x42eca9);_0xcb74ad(_0x42eca9);});});}function respondWithResult(_0x2d1e4b,_0x3a68b4){_0x3a68b4=_0x3a68b4||0xc8;return function(_0x458d22){if(_0x458d22){return _0x2d1e4b[_0x70e8('0x1e')](_0x3a68b4)['json'](_0x458d22);}};}function respondWithFilteredResult(_0x294f9b,_0x3a5d00){return function(_0x4cbc81){if(_0x4cbc81){var _0x241645=typeof _0x3a5d00[_0x70e8('0x1f')]==='undefined'&&typeof _0x3a5d00['limit']===_0x70e8('0x20');var _0x3bd1c5=_0x4cbc81['count'];var _0x37b862=_0x241645?0x0:_0x3a5d00[_0x70e8('0x1f')];var _0x9c664a=_0x241645?_0x4cbc81[_0x70e8('0x21')]:_0x3a5d00[_0x70e8('0x1f')]+_0x3a5d00[_0x70e8('0x22')];var _0x1882d5;if(_0x9c664a>=_0x3bd1c5){_0x9c664a=_0x3bd1c5;_0x1882d5=0xc8;}else{_0x1882d5=0xce;}_0x294f9b[_0x70e8('0x1e')](_0x1882d5);return _0x294f9b['set'](_0x70e8('0x23'),_0x37b862+'-'+_0x9c664a+'/'+_0x3bd1c5)[_0x70e8('0x24')](_0x4cbc81);}return null;};}function saveUpdates(_0x16fd20){return function(_0x128471){if(_0x128471){return _0x128471[_0x70e8('0x25')](_0x16fd20)['then'](function(_0x4550bd){return _0x4550bd;});}return null;};}function removeEntity(_0x7d5821){return function(_0x10091f){if(_0x10091f){return _0x10091f[_0x70e8('0x26')]()[_0x70e8('0x12')](function(){_0x7d5821[_0x70e8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e9d43){return function(_0x25dc34){if(!_0x25dc34){_0x3e9d43[_0x70e8('0x27')](0x194);}return _0x25dc34;};}function handleError(_0x53a543,_0x39905f){_0x39905f=_0x39905f||0x1f4;return function(_0x58eb84){logger['error'](_0x58eb84[_0x70e8('0x28')]);if(_0x58eb84[_0x70e8('0x29')]){delete _0x58eb84[_0x70e8('0x29')];}_0x53a543['status'](_0x39905f)['send'](_0x58eb84);};}exports['index']=function(_0x1cd4dc,_0x2eb92a){var _0x1ee6e2={},_0x11eba0={},_0x29a1be={'count':0x0,'rows':[]};var _0x3990ab=_['map'](db[_0x70e8('0x2a')][_0x70e8('0x2b')],function(_0x3f4f5b){return{'name':_0x3f4f5b[_0x70e8('0x2c')],'type':_0x3f4f5b[_0x70e8('0x2d')][_0x70e8('0x2e')]};});_0x11eba0[_0x70e8('0x2f')]=_['map'](_0x3990ab,_0x70e8('0x29'));_0x11eba0[_0x70e8('0x30')]=_[_0x70e8('0x31')](_0x1cd4dc[_0x70e8('0x30')]);_0x11eba0[_0x70e8('0x32')]=_[_0x70e8('0x33')](_0x11eba0['model'],_0x11eba0[_0x70e8('0x30')]);_0x1ee6e2[_0x70e8('0x34')]=_[_0x70e8('0x33')](_0x11eba0[_0x70e8('0x2f')],qs[_0x70e8('0x35')](_0x1cd4dc[_0x70e8('0x30')]['fields']));_0x1ee6e2[_0x70e8('0x34')]=_0x1ee6e2[_0x70e8('0x34')][_0x70e8('0x36')]?_0x1ee6e2[_0x70e8('0x34')]:_0x11eba0[_0x70e8('0x2f')];if(!_0x1cd4dc[_0x70e8('0x30')][_0x70e8('0x37')](_0x70e8('0x38'))){_0x1ee6e2[_0x70e8('0x22')]=qs[_0x70e8('0x22')](_0x1cd4dc['query'][_0x70e8('0x22')]);_0x1ee6e2['offset']=qs['offset'](_0x1cd4dc[_0x70e8('0x30')][_0x70e8('0x1f')]);}_0x1ee6e2[_0x70e8('0x39')]=qs[_0x70e8('0x3a')](_0x1cd4dc[_0x70e8('0x30')]['sort']);_0x1ee6e2[_0x70e8('0x3b')]=qs[_0x70e8('0x32')](_[_0x70e8('0x3c')](_0x1cd4dc[_0x70e8('0x30')],_0x11eba0[_0x70e8('0x32')]),_0x3990ab);if(_0x1cd4dc[_0x70e8('0x30')][_0x70e8('0x3d')]){_0x1ee6e2[_0x70e8('0x3b')]=_[_0x70e8('0x3e')](_0x1ee6e2['where'],{'$or':_[_0x70e8('0x3f')](_0x3990ab,function(_0xc72a61){if(_0xc72a61[_0x70e8('0x2d')]!==_0x70e8('0x40')){var _0x53e0a8={};_0x53e0a8[_0xc72a61[_0x70e8('0x29')]]={'$like':'%'+_0x1cd4dc[_0x70e8('0x30')][_0x70e8('0x3d')]+'%'};return _0x53e0a8;}})});}_0x1ee6e2=_['merge']({},_0x1ee6e2,_0x1cd4dc[_0x70e8('0x41')]);var _0x4c1956={'where':_0x1ee6e2[_0x70e8('0x3b')]};return db['ChatMessage'][_0x70e8('0x21')](_0x4c1956)[_0x70e8('0x12')](function(_0x210347){_0x29a1be['count']=_0x210347;if(_0x1cd4dc[_0x70e8('0x30')]['includeAll']){_0x1ee6e2[_0x70e8('0x42')]=[{'all':!![]}];}return db[_0x70e8('0x2a')]['findAll'](_0x1ee6e2);})[_0x70e8('0x12')](function(_0x293eb3){_0x29a1be[_0x70e8('0x43')]=_0x293eb3;return _0x29a1be;})[_0x70e8('0x12')](respondWithFilteredResult(_0x2eb92a,_0x1ee6e2))[_0x70e8('0x1d')](handleError(_0x2eb92a,null));};exports['show']=function(_0x2b1b11,_0x209e0c){var _0x205f48={'raw':!![],'where':{'id':_0x2b1b11['params']['id']}},_0x3f8093={};_0x3f8093['model']=_['keys'](db[_0x70e8('0x2a')][_0x70e8('0x2b')]);_0x3f8093[_0x70e8('0x30')]=_[_0x70e8('0x31')](_0x2b1b11[_0x70e8('0x30')]);_0x3f8093['filters']=_[_0x70e8('0x33')](_0x3f8093[_0x70e8('0x2f')],_0x3f8093[_0x70e8('0x30')]);_0x205f48[_0x70e8('0x34')]=_[_0x70e8('0x33')](_0x3f8093[_0x70e8('0x2f')],qs[_0x70e8('0x35')](_0x2b1b11['query'][_0x70e8('0x35')]));_0x205f48[_0x70e8('0x34')]=_0x205f48['attributes'][_0x70e8('0x36')]?_0x205f48[_0x70e8('0x34')]:_0x3f8093[_0x70e8('0x2f')];if(_0x2b1b11[_0x70e8('0x30')][_0x70e8('0x44')]){_0x205f48['include']=[{'all':!![]}];}_0x205f48=_[_0x70e8('0x3e')]({},_0x205f48,_0x2b1b11['options']);return db[_0x70e8('0x2a')]['find'](_0x205f48)[_0x70e8('0x12')](handleEntityNotFound(_0x209e0c,null))[_0x70e8('0x12')](respondWithResult(_0x209e0c,null))[_0x70e8('0x1d')](handleError(_0x209e0c,null));};exports[_0x70e8('0x45')]=function(_0x497fa6,_0xc56069){return db[_0x70e8('0x2a')][_0x70e8('0x45')](_0x497fa6[_0x70e8('0x46')],{})[_0x70e8('0x12')](respondWithResult(_0xc56069,0xc9))[_0x70e8('0x1d')](handleError(_0xc56069,null));};exports[_0x70e8('0x25')]=function(_0x17d1db,_0x3ac69b){if(_0x17d1db[_0x70e8('0x46')]['id']){delete _0x17d1db['body']['id'];}return db[_0x70e8('0x2a')][_0x70e8('0x47')]({'where':{'id':_0x17d1db[_0x70e8('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ac69b,null))[_0x70e8('0x12')](saveUpdates(_0x17d1db[_0x70e8('0x46')],null))[_0x70e8('0x12')](respondWithResult(_0x3ac69b,null))[_0x70e8('0x1d')](handleError(_0x3ac69b,null));};exports[_0x70e8('0x26')]=function(_0x4011a,_0x39bc54){return db[_0x70e8('0x2a')]['find']({'where':{'id':_0x4011a[_0x70e8('0x48')]['id']}})[_0x70e8('0x12')](handleEntityNotFound(_0x39bc54,null))[_0x70e8('0x12')](removeEntity(_0x39bc54,null))[_0x70e8('0x1d')](handleError(_0x39bc54,null));};exports['describe']=function(_0x51aa77,_0x55dc4a){return db[_0x70e8('0x2a')][_0x70e8('0x49')]()['then'](respondWithResult(_0x55dc4a,null))['catch'](handleError(_0x55dc4a,null));};exports['accept']=function(_0x28b77a,_0x3eb6dd){var _0x5c5f4a=_0x70e8('0x4a');return interactionService[_0x70e8('0x4b')](_0x28b77a,_0x5c5f4a)[_0x70e8('0x12')](respondWithResult(_0x3eb6dd,null))[_0x70e8('0x1d')](handleError(_0x3eb6dd,null));};exports[_0x70e8('0x4c')]=function(_0x503428,_0x57923d){var _0x2c83d2={'agent':{},'channel':_0x70e8('0x4a')};if(_0x503428[_0x70e8('0x46')]['id']){delete _0x503428[_0x70e8('0x46')]['id'];}_0x503428['body'][_0x70e8('0x4d')]=_0x503428[_0x70e8('0x46')][_0x70e8('0x4d')]||_0x503428[_0x70e8('0x4e')]['id'];_0x2c83d2[_0x70e8('0x4f')]['id']=_0x503428[_0x70e8('0x46')][_0x70e8('0x4d')];return db[_0x70e8('0x2a')]['find']({'where':{'id':_0x503428[_0x70e8('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x57923d,null))[_0x70e8('0x12')](function(_0x1b783d){if(_0x1b783d){_0x2c83d2[_0x70e8('0x1b')]=_0x1b783d[_0x70e8('0x50')]({'plain':!![]});return db[_0x70e8('0x51')][_0x70e8('0x47')]({'where':{'id':_0x1b783d[_0x70e8('0x52')]}});}return null;})[_0x70e8('0x12')](handleEntityNotFound(_0x57923d,null))[_0x70e8('0x12')](function(_0x357c85){if(_0x357c85){_0x2c83d2['interaction']=_0x357c85['get']({'plain':!![]});interaction_log[_0x70e8('0x13')](_0x70e8('0x53'),_0x503428['user']['id'],_0x503428[_0x70e8('0x4e')][_0x70e8('0x29')],_0x503428[_0x70e8('0x4e')]['role'],_0x2c83d2['interaction']['id'],_0x503428['body']?JSON['stringify'](_0x503428[_0x70e8('0x46')]):_0x70e8('0x54'));return respondWithRpcPromise(_0x70e8('0x55'),_0x70e8('0x56'),_0x2c83d2);}return null;})['then'](function(_0x38d478){var _0x18ce5f=_0x70e8('0x57')+_0x38d478[_0x70e8('0x1b')][_0x70e8('0x58')];return db[_0x70e8('0x59')][_0x70e8('0x30')](_0x18ce5f,{'type':db['Sequelize'][_0x70e8('0x5a')][_0x70e8('0x5b')],'raw':!![]})['then'](function(_0x1d52f4){return _0x1d52f4;});})[_0x70e8('0x12')](function(_0x16b862){if(_0x16b862){_0x2c83d2[_0x70e8('0x1b')][_0x70e8('0x5c')]=_0x16b862[0x0];if(!_0x503428[_0x70e8('0x46')][_0x70e8('0x4d')])return;return db['User']['find']({'where':{'id':_0x503428['body'][_0x70e8('0x4d')],'role':_0x70e8('0x4f')},'attributes':['id','name',_0x70e8('0x5d'),'email',_0x70e8('0x5e')],'raw':!![]});}return null;})[_0x70e8('0x12')](function(_0x4ba089){if(!_0x4ba089)return null;_0x2c83d2[_0x70e8('0x1b')][_0x70e8('0x4f')]=_0x4ba089;return _0x2c83d2;})[_0x70e8('0x12')](function(_0xbf2a9b){if(_0xbf2a9b){_0xbf2a9b['message'][_0x70e8('0x5f')]=util[_0x70e8('0x60')](_0x70e8('0x61'),_0x503428['user'][_0x70e8('0x29')]);_0xbf2a9b['message'][_0x70e8('0x62')]=_0x2c83d2['channel'];_0xbf2a9b['message'][_0x70e8('0x63')]=_0x2c83d2[_0x70e8('0x62')];_0xbf2a9b[_0x70e8('0x1b')]['event']=_0x70e8('0x4c');respondWithRpcPromise(_0x70e8('0x64'),'EventManager',{'event':_0x70e8('0x65'),'message':_[_0x70e8('0x3e')](_0x2c83d2[_0x70e8('0x1b')],JSON['parse'](_0x2c83d2[_0x70e8('0x66')]['formData']))},client9002);return _0x2c83d2;}return null;})[_0x70e8('0x12')](respondWithResult(_0x57923d,null))[_0x70e8('0x1d')](handleError(_0x57923d,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index a671353..7b0868a 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 _0xaf6f=['emit','hasOwnProperty','exports','ChatMessage','save','update'];(function(_0xfbe06e,_0x2fb7ab){var _0x24e5b6=function(_0x48569f){while(--_0x48569f){_0xfbe06e['push'](_0xfbe06e['shift']());}};_0x24e5b6(++_0x2fb7ab);}(_0xaf6f,0x12f));var _0xfaf6=function(_0x3fe9a5,_0x5d6fb7){_0x3fe9a5=_0x3fe9a5-0x0;var _0x61444e=_0xaf6f[_0x3fe9a5];return _0x61444e;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0xfaf6('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfaf6('0x1'),'afterUpdate':_0xfaf6('0x2'),'afterDestroy':'remove'};function emitEvent(_0x177ddb){return function(_0x3f6a74,_0x5be592,_0x278f8b){ChatMessageEvents[_0xfaf6('0x3')](_0x177ddb+':'+_0x3f6a74['id'],_0x3f6a74);ChatMessageEvents[_0xfaf6('0x3')](_0x177ddb,_0x3f6a74);_0x278f8b(null);};}for(var e in events){if(events[_0xfaf6('0x4')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xfaf6('0x5')]=ChatMessageEvents; \ No newline at end of file +var _0x07e3=['update','remove','emit','hasOwnProperty','hook','events','ChatMessage','setMaxListeners','save'];(function(_0x442ece,_0x1c5c60){var _0x303ff5=function(_0x5a94a3){while(--_0x5a94a3){_0x442ece['push'](_0x442ece['shift']());}};_0x303ff5(++_0x1c5c60);}(_0x07e3,0xd4));var _0x307e=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x07e3[_0xbc346f];return _0x9f9260;};'use strict';var EventEmitter=require(_0x307e('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x307e('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x307e('0x2')](0x0);var events={'afterCreate':_0x307e('0x3'),'afterUpdate':_0x307e('0x4'),'afterDestroy':_0x307e('0x5')};function emitEvent(_0x196f4b){return function(_0x52b6b0,_0x14a025,_0x3f22aa){ChatMessageEvents['emit'](_0x196f4b+':'+_0x52b6b0['id'],_0x52b6b0);ChatMessageEvents[_0x307e('0x6')](_0x196f4b,_0x52b6b0);_0x3f22aa(null);};}for(var e in events){if(events[_0x307e('0x7')](e)){var event=events[e];ChatMessage[_0x307e('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index d6c5055..e3b36fc 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 _0x73d8=['direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','lodash','util','api','bluebird','request-promise','path','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get'];(function(_0x1e7701,_0x13fd0f){var _0x3ab707=function(_0x3c5242){while(--_0x3c5242){_0x1e7701['push'](_0x1e7701['shift']());}};_0x3ab707(++_0x13fd0f);}(_0x73d8,0x109));var _0x873d=function(_0x2f5ff2,_0x5b7e4b){_0x2f5ff2=_0x2f5ff2-0x0;var _0x1d9564=_0x73d8[_0x2f5ff2];return _0x1d9564;};'use strict';var _=require(_0x873d('0x0'));var util=require(_0x873d('0x1'));var logger=require('../../config/logger')(_0x873d('0x2'));var moment=require('moment');var BPromise=require(_0x873d('0x3'));var rp=require(_0x873d('0x4'));var fs=require('fs');var path=require(_0x873d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x873d('0x6'));module[_0x873d('0x7')]=function(_0x460222,_0x14e988){return _0x460222[_0x873d('0x8')](_0x873d('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x873d('0xa'),'fields':[_0x873d('0xb')],'type':_0x873d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38d40f,_0x208068,_0x321257){var _0xb25f=_0x460222[_0x873d('0xd')];var _0x252092=_0x38d40f[_0x873d('0xe')]({'plain':!![]});if(_0x252092[_0x873d('0xf')][_0x873d('0x10')]()==='in'||_0x252092['direction'][_0x873d('0x10')]()===_0x873d('0x11')&&!_0x252092[_0x873d('0x12')]&&!_[_0x873d('0x13')](_0x252092[_0x873d('0x14')])){_0xb25f[_0x873d('0x15')][_0x873d('0x16')]({'where':{'id':_0x252092['ChatInteractionId']}})[_0x873d('0x17')](function(_0x57c11b){if(_0x57c11b){_0x57c11b[_0x873d('0x18')]({'lastMsgAt':_0x252092[_0x873d('0x19')],'lastMsgDirection':_0x252092[_0x873d('0xf')][_0x873d('0x10')]()});}})[_0x873d('0x1a')](function(_0x2ceb11){console[_0x873d('0x1b')](_0x2ceb11);});}_0x321257();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xad2c=['get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xad2c,0x13a));var _0xcad2=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xad2c[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xcad2('0x0'));var util=require(_0xcad2('0x1'));var logger=require(_0xcad2('0x2'))('api');var moment=require(_0xcad2('0x3'));var BPromise=require(_0xcad2('0x4'));var rp=require(_0xcad2('0x5'));var fs=require('fs');var path=require(_0xcad2('0x6'));var rimraf=require(_0xcad2('0x7'));var config=require('../../config/environment');var attributes=require(_0xcad2('0x8'));module[_0xcad2('0x9')]=function(_0x1203e0,_0x220af1){return _0x1203e0[_0xcad2('0xa')](_0xcad2('0xb'),attributes,{'tableName':_0xcad2('0xc'),'paranoid':![],'indexes':[{'name':_0xcad2('0xd'),'fields':['body'],'type':_0xcad2('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23d966,_0x3a2d16,_0x3e63ce){var _0x552ce9=_0x1203e0[_0xcad2('0xf')];var _0x48d76a=_0x23d966[_0xcad2('0x10')]({'plain':!![]});if(_0x48d76a[_0xcad2('0x11')][_0xcad2('0x12')]()==='in'||_0x48d76a[_0xcad2('0x11')][_0xcad2('0x12')]()===_0xcad2('0x13')&&!_0x48d76a[_0xcad2('0x14')]&&!_[_0xcad2('0x15')](_0x48d76a[_0xcad2('0x16')])){_0x552ce9[_0xcad2('0x17')][_0xcad2('0x18')]({'where':{'id':_0x48d76a[_0xcad2('0x19')]}})['then'](function(_0x1438aa){if(_0x1438aa){_0x1438aa[_0xcad2('0x1a')]({'lastMsgAt':_0x48d76a[_0xcad2('0x1b')],'lastMsgDirection':_0x48d76a[_0xcad2('0x11')][_0xcad2('0x12')]()});}})[_0xcad2('0x1c')](function(_0x46e7c2){console['error'](_0x46e7c2);});}_0x3e63ce();}},'charset':'utf8mb4','collate':_0xcad2('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index d26cd06..59b2b6a 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 _0xcf3b=['result','catch','ChatMessage','create','options','raw','CreateChatMessage','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcf3b,0x7f));var _0xbcf3=function(_0x93b175,_0x448d4c){_0x93b175=_0x93b175-0x0;var _0x5f2532=_0xcf3b[_0x93b175];return _0x5f2532;};'use strict';var _=require('lodash');var util=require(_0xbcf3('0x0'));var moment=require(_0xbcf3('0x1'));var BPromise=require(_0xbcf3('0x2'));var rs=require(_0xbcf3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcf3('0x4'))['db'];var utils=require(_0xbcf3('0x5'));var logger=require(_0xbcf3('0x6'))(_0xbcf3('0x7'));var config=require(_0xbcf3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbcf3('0x9')]['http']({'port':0x232a});config['redis']=_[_0xbcf3('0xa')](config[_0xbcf3('0xb')],{'host':_0xbcf3('0xc'),'port':0x18eb});var socket=require(_0xbcf3('0xd'))(new Redis(config[_0xbcf3('0xb')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5181bf,_0x33a0df,_0x4a4660){return new BPromise(function(_0x27de0f,_0x2a5526){return client['request'](_0x5181bf,_0x4a4660)[_0xbcf3('0xe')](function(_0x561fe7){logger[_0xbcf3('0xf')](_0xbcf3('0x10'),_0x33a0df,_0xbcf3('0x11'));logger[_0xbcf3('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x33a0df,'request\x20sent',JSON[_0xbcf3('0x13')](_0x561fe7));if(_0x561fe7['error']){if(_0x561fe7[_0xbcf3('0x14')][_0xbcf3('0x15')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x33a0df,_0x561fe7[_0xbcf3('0x14')][_0xbcf3('0x16')]);return _0x2a5526(_0x561fe7['error'][_0xbcf3('0x16')]);}logger[_0xbcf3('0x14')](_0xbcf3('0x10'),_0x33a0df,_0x561fe7[_0xbcf3('0x14')][_0xbcf3('0x16')]);return _0x27de0f(_0x561fe7[_0xbcf3('0x14')]['message']);}else{logger[_0xbcf3('0xf')]('ChatMessage,\x20%s,\x20%s',_0x33a0df,_0xbcf3('0x11'));_0x27de0f(_0x561fe7[_0xbcf3('0x17')][_0xbcf3('0x16')]);}})[_0xbcf3('0x18')](function(_0x355f0d){logger[_0xbcf3('0x14')](_0xbcf3('0x10'),_0x33a0df,_0x355f0d);_0x2a5526(_0x355f0d);});});}exports['CreateChatMessage']=function(_0x55f3f4){var _0x5093b3=this;return new Promise(function(_0xf5b359,_0x428e6e){return db[_0xbcf3('0x19')][_0xbcf3('0x1a')](_0x55f3f4['body'],{'raw':_0x55f3f4['options']?_0x55f3f4[_0xbcf3('0x1b')][_0xbcf3('0x1c')]===undefined?!![]:![]:!![]})[_0xbcf3('0xe')](function(_0x22c0c2){logger['info']('CreateChatMessage',_0x55f3f4);logger[_0xbcf3('0x12')]('CreateChatMessage',_0x55f3f4,JSON[_0xbcf3('0x13')](_0x22c0c2));_0xf5b359(_0x22c0c2);})['catch'](function(_0x49dcb9){logger[_0xbcf3('0x14')](_0xbcf3('0x1d'),_0x49dcb9['message'],_0x55f3f4);_0x428e6e(_0x5093b3[_0xbcf3('0x14')](0x1f4,_0x49dcb9[_0xbcf3('0x16')]));});});}; \ No newline at end of file +var _0x9127=['message','info','catch','CreateChatMessage','ChatMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x7b7181,_0x5f065e){var _0x3ea6ef=function(_0x2d6e06){while(--_0x2d6e06){_0x7b7181['push'](_0x7b7181['shift']());}};_0x3ea6ef(++_0x5f065e);}(_0x9127,0x180));var _0x7912=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x9127[_0x581af1];return _0x54c22e;};'use strict';var _=require(_0x7912('0x0'));var util=require(_0x7912('0x1'));var moment=require(_0x7912('0x2'));var BPromise=require(_0x7912('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7912('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7912('0x5'))(_0x7912('0x6'));var config=require(_0x7912('0x7'));var jayson=require(_0x7912('0x8'));var client=jayson[_0x7912('0x9')][_0x7912('0xa')]({'port':0x232a});config[_0x7912('0xb')]=_[_0x7912('0xc')](config['redis'],{'host':_0x7912('0xd'),'port':0x18eb});var socket=require(_0x7912('0xe'))(new Redis(config[_0x7912('0xb')]));require(_0x7912('0xf'))['register'](socket);function respondWithRpcPromise(_0x218dc9,_0x586ccb,_0x438339){return new BPromise(function(_0x9ddd99,_0x4d7522){return client[_0x7912('0x10')](_0x218dc9,_0x438339)[_0x7912('0x11')](function(_0x3b56aa){logger['info'](_0x7912('0x12'),_0x586ccb,_0x7912('0x13'));logger['debug'](_0x7912('0x14'),_0x586ccb,'request\x20sent',JSON[_0x7912('0x15')](_0x3b56aa));if(_0x3b56aa['error']){if(_0x3b56aa[_0x7912('0x16')][_0x7912('0x17')]===0x1f4){logger[_0x7912('0x16')](_0x7912('0x12'),_0x586ccb,_0x3b56aa['error'][_0x7912('0x18')]);return _0x4d7522(_0x3b56aa['error'][_0x7912('0x18')]);}logger[_0x7912('0x16')](_0x7912('0x12'),_0x586ccb,_0x3b56aa[_0x7912('0x16')][_0x7912('0x18')]);return _0x9ddd99(_0x3b56aa[_0x7912('0x16')]['message']);}else{logger[_0x7912('0x19')](_0x7912('0x12'),_0x586ccb,_0x7912('0x13'));_0x9ddd99(_0x3b56aa['result'][_0x7912('0x18')]);}})[_0x7912('0x1a')](function(_0x8173e6){logger[_0x7912('0x16')](_0x7912('0x12'),_0x586ccb,_0x8173e6);_0x4d7522(_0x8173e6);});});}exports[_0x7912('0x1b')]=function(_0x5e1b4e){var _0x15f148=this;return new Promise(function(_0x116390,_0x27f312){return db[_0x7912('0x1c')][_0x7912('0x1d')](_0x5e1b4e[_0x7912('0x1e')],{'raw':_0x5e1b4e[_0x7912('0x1f')]?_0x5e1b4e[_0x7912('0x1f')][_0x7912('0x20')]===undefined?!![]:![]:!![]})[_0x7912('0x11')](function(_0x3e3447){logger[_0x7912('0x19')](_0x7912('0x1b'),_0x5e1b4e);logger[_0x7912('0x21')](_0x7912('0x1b'),_0x5e1b4e,JSON['stringify'](_0x3e3447));_0x116390(_0x3e3447);})[_0x7912('0x1a')](function(_0x4410b4){logger[_0x7912('0x16')](_0x7912('0x1b'),_0x4410b4[_0x7912('0x18')],_0x5e1b4e);_0x27f312(_0x15f148[_0x7912('0x16')](0x1f4,_0x4410b4['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6bc4db1..abe1e35 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 _0x88d5=['remove','update','emit','removeListener','register','chatMessage:','./chatMessage.events','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x88d5,0x76));var _0x588d=function(_0x35ad07,_0x4b6cc4){_0x35ad07=_0x35ad07-0x0;var _0x5346ee=_0x88d5[_0x35ad07];return _0x5346ee;};'use strict';var ChatMessageEvents=require(_0x588d('0x0'));var events=[_0x588d('0x1'),_0x588d('0x2'),_0x588d('0x3')];function createListener(_0x315178,_0x5372b1){return function(_0xe46c98){_0x5372b1[_0x588d('0x4')](_0x315178,_0xe46c98);};}function removeListener(_0x504b52,_0x474e79){return function(){ChatMessageEvents[_0x588d('0x5')](_0x504b52,_0x474e79);};}exports[_0x588d('0x6')]=function(_0x1b193f){for(var _0xecfb11=0x0,_0x413748=events['length'];_0xecfb11<_0x413748;_0xecfb11++){var _0x57699a=events[_0xecfb11];var _0x41ddf3=createListener(_0x588d('0x7')+_0x57699a,_0x1b193f);ChatMessageEvents['on'](_0x57699a,_0x41ddf3);}}; \ No newline at end of file +var _0x5162=['chatMessage:','./chatMessage.events','emit','removeListener','register','length'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x5162,0x103));var _0x2516=function(_0x57f7ea,_0x54da6b){_0x57f7ea=_0x57f7ea-0x0;var _0x54a7e4=_0x5162[_0x57f7ea];return _0x54a7e4;};'use strict';var ChatMessageEvents=require(_0x2516('0x0'));var events=['save','remove','update'];function createListener(_0x4db25c,_0x41fd28){return function(_0x2aaef5){_0x41fd28[_0x2516('0x1')](_0x4db25c,_0x2aaef5);};}function removeListener(_0x2d0b53,_0x2e48b6){return function(){ChatMessageEvents[_0x2516('0x2')](_0x2d0b53,_0x2e48b6);};}exports[_0x2516('0x3')]=function(_0x5b71b5){for(var _0x48f411=0x0,_0x5beeb3=events[_0x2516('0x4')];_0x48f411<_0x5beeb3;_0x48f411++){var _0xba4b36=events[_0x48f411];var _0xa1557=createListener(_0x2516('0x5')+_0xba4b36,_0x5b71b5);ChatMessageEvents['on'](_0xba4b36,_0xa1557);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index e7f3884..0873fae 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 _0xa86d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','chatmessage:create','create','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path'];(function(_0x48f590,_0x4cd55b){var _0x1afde4=function(_0x2b19c3){while(--_0x2b19c3){_0x48f590['push'](_0x48f590['shift']());}};_0x1afde4(++_0x4cd55b);}(_0xa86d,0x8a));var _0xda86=function(_0x1d46de,_0x3dd47f){_0x1d46de=_0x1d46de-0x0;var _0x4516e5=_0xa86d[_0x1d46de];return _0x4516e5;};'use strict';var multer=require(_0xda86('0x0'));var util=require('util');var path=require(_0xda86('0x1'));var timeout=require(_0xda86('0x2'));var express=require(_0xda86('0x3'));var router=express[_0xda86('0x4')]();var fs_extra=require(_0xda86('0x5'));var auth=require(_0xda86('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xda86('0x7'));var controller=require(_0xda86('0x8'));router[_0xda86('0x9')]('/',auth[_0xda86('0xa')](),controller[_0xda86('0xb')]);router[_0xda86('0x9')](_0xda86('0xc'),auth[_0xda86('0xa')](),controller[_0xda86('0xd')]);router[_0xda86('0x9')]('/:id',auth[_0xda86('0xa')](),controller[_0xda86('0xe')]);router[_0xda86('0xf')]('/',auth[_0xda86('0xa')](),interaction[_0xda86('0x10')]('chat',_0xda86('0x11')),controller[_0xda86('0x12')]);router[_0xda86('0x13')](_0xda86('0x14'),controller['update']);router['put'](_0xda86('0x15'),auth['isAuthenticated'](),controller[_0xda86('0x16')]);router[_0xda86('0x13')](_0xda86('0x17'),auth['isAuthenticated'](),controller[_0xda86('0x18')]);router[_0xda86('0x19')](_0xda86('0x14'),auth[_0xda86('0xa')](),controller[_0xda86('0x1a')]);module[_0xda86('0x1b')]=router; \ No newline at end of file +var _0xb43a=['create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','/:id','post','tracked','chatmessage:create'];(function(_0x5b33ac,_0x359e75){var _0x304b3f=function(_0xf6f90d){while(--_0xf6f90d){_0x5b33ac['push'](_0x5b33ac['shift']());}};_0x304b3f(++_0x359e75);}(_0xb43a,0x199));var _0xab43=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xb43a[_0x44a64f];return _0x52024b;};'use strict';var multer=require('multer');var util=require(_0xab43('0x0'));var path=require(_0xab43('0x1'));var timeout=require(_0xab43('0x2'));var express=require(_0xab43('0x3'));var router=express[_0xab43('0x4')]();var fs_extra=require(_0xab43('0x5'));var auth=require(_0xab43('0x6'));var interaction=require(_0xab43('0x7'));var config=require(_0xab43('0x8'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0xab43('0x9')](),controller[_0xab43('0xa')]);router['get'](_0xab43('0xb'),auth[_0xab43('0x9')](),controller['describe']);router['get'](_0xab43('0xc'),auth[_0xab43('0x9')](),controller['show']);router[_0xab43('0xd')]('/',auth['isAuthenticated'](),interaction[_0xab43('0xe')]('chat',_0xab43('0xf')),controller[_0xab43('0x10')]);router[_0xab43('0x11')](_0xab43('0xc'),controller[_0xab43('0x12')]);router[_0xab43('0x11')](_0xab43('0x13'),auth[_0xab43('0x9')](),controller[_0xab43('0x14')]);router[_0xab43('0x11')](_0xab43('0x15'),auth['isAuthenticated'](),controller[_0xab43('0x16')]);router[_0xab43('0x17')](_0xab43('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xab43('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index eb4bb86..899d288 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 _0xadb5=['medium','TEXT','exports'];(function(_0x149e88,_0x264145){var _0x26a5a6=function(_0x489294){while(--_0x489294){_0x149e88['push'](_0x149e88['shift']());}};_0x26a5a6(++_0x264145);}(_0xadb5,0xad));var _0x5adb=function(_0x4f158e,_0x3910bd){_0x4f158e=_0x4f158e-0x0;var _0x52ad37=_0xadb5[_0x4f158e];return _0x52ad37;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x26ec0a,_0x3d532d){var _0x48a447=function(_0x4d6705){while(--_0x4d6705){_0x26ec0a['push'](_0x26ec0a['shift']());}};_0x48a447(++_0x3d532d);}(_0xb10b,0x12a));var _0xbb10=function(_0x503d00,_0x323df1){_0x503d00=_0x503d00-0x0;var _0x2263d8=_0xb10b[_0x503d00];return _0x2263d8;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 24dee62..96117e3 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(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x7a54,0x106));var _0x47a5=function(_0x48dfab,_0x539679){_0x48dfab=_0x48dfab-0x0;var _0x2fa30f=_0x7a54[_0x48dfab];return _0x2fa30f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x7a54,0x106));var _0x47a5=function(_0x5185b8,_0x4282ea){_0x5185b8=_0x5185b8-0x0;var _0x38edb2=_0x7a54[_0x5185b8];return _0x38edb2;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 38ef9b3..2708980 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 _0x9dbe=['save','update','remove','emit','events','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x1244c6,_0x4770d0){var _0x1e0a72=function(_0x61ba95){while(--_0x61ba95){_0x1244c6['push'](_0x1244c6['shift']());}};_0x1e0a72(++_0x4770d0);}(_0x9dbe,0x174));var _0xe9db=function(_0x465089,_0x823030){_0x465089=_0x465089-0x0;var _0x3c47ba=_0x9dbe[_0x465089];return _0x3c47ba;};'use strict';var EventEmitter=require(_0xe9db('0x0'));var ChatOfflineMessage=require(_0xe9db('0x1'))['db'][_0xe9db('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xe9db('0x3')](0x0);var events={'afterCreate':_0xe9db('0x4'),'afterUpdate':_0xe9db('0x5'),'afterDestroy':_0xe9db('0x6')};function emitEvent(_0x383073){return function(_0x1ff6a5,_0x117f8f,_0x383196){ChatOfflineMessageEvents[_0xe9db('0x7')](_0x383073+':'+_0x1ff6a5['id'],_0x1ff6a5);ChatOfflineMessageEvents[_0xe9db('0x7')](_0x383073,_0x1ff6a5);_0x383196(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xa009=['../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x18a7f3,_0x4cf3c5){var _0x1b070c=function(_0x1a664a){while(--_0x1a664a){_0x18a7f3['push'](_0x18a7f3['shift']());}};_0x1b070c(++_0x4cf3c5);}(_0xa009,0x13a));var _0x9a00=function(_0x4adc6d,_0x11275c){_0x4adc6d=_0x4adc6d-0x0;var _0x4d42e5=_0xa009[_0x4adc6d];return _0x4d42e5;};'use strict';var EventEmitter=require(_0x9a00('0x0'));var ChatOfflineMessage=require(_0x9a00('0x1'))['db'][_0x9a00('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9a00('0x3')](0x0);var events={'afterCreate':_0x9a00('0x4'),'afterUpdate':_0x9a00('0x5'),'afterDestroy':_0x9a00('0x6')};function emitEvent(_0x15730f){return function(_0xf578ba,_0x399968,_0x398e60){ChatOfflineMessageEvents[_0x9a00('0x7')](_0x15730f+':'+_0xf578ba['id'],_0xf578ba);ChatOfflineMessageEvents[_0x9a00('0x7')](_0x15730f,_0xf578ba);_0x398e60(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x9a00('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 48df32a..a70a58c 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 _0x8406=['chat_offline_messages','./chatOfflineMessage.attributes','exports','define'];(function(_0x19c14f,_0x262416){var _0x4bdba3=function(_0x3f18f4){while(--_0x3f18f4){_0x19c14f['push'](_0x19c14f['shift']());}};_0x4bdba3(++_0x262416);}(_0x8406,0x18d));var _0x6840=function(_0x1870ed,_0x44b070){_0x1870ed=_0x1870ed-0x0;var _0x495d32=_0x8406[_0x1870ed];return _0x495d32;};'use strict';var attributes=require(_0x6840('0x0'));module[_0x6840('0x1')]=function(_0x3c3022){return _0x3c3022[_0x6840('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x6840('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb35f=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4abd58,_0x523c62){var _0x3608a8=function(_0xa5878){while(--_0xa5878){_0x4abd58['push'](_0x4abd58['shift']());}};_0x3608a8(++_0x523c62);}(_0xb35f,0x131));var _0xfb35=function(_0x6cc07,_0x813f5d){_0x6cc07=_0x6cc07-0x0;var _0x5e745c=_0xb35f[_0x6cc07];return _0x5e745c;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x506702){return _0x506702[_0xfb35('0x0')](_0xfb35('0x1'),attributes,{'tableName':_0xfb35('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfb35('0x3'),'collate':_0xfb35('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index dc68984..4623b15 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 _0xcbd2=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x50f157,_0x280833){var _0x7e0178=function(_0x14eaf1){while(--_0x14eaf1){_0x50f157['push'](_0x50f157['shift']());}};_0x7e0178(++_0x280833);}(_0xcbd2,0xb9));var _0x2cbd=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0xcbd2[_0x45c48f];return _0xaf5037;};'use strict';var _=require(_0x2cbd('0x0'));var util=require(_0x2cbd('0x1'));var moment=require(_0x2cbd('0x2'));var BPromise=require(_0x2cbd('0x3'));var rs=require(_0x2cbd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2cbd('0x5'))['db'];var utils=require(_0x2cbd('0x6'));var logger=require(_0x2cbd('0x7'))(_0x2cbd('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2cbd('0x9')][_0x2cbd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2233f3,_0x27aa9f,_0x39dc17){return new BPromise(function(_0x4b35b0,_0x1dac7c){return client[_0x2cbd('0xb')](_0x2233f3,_0x39dc17)[_0x2cbd('0xc')](function(_0x2cfd1e){logger[_0x2cbd('0xd')](_0x2cbd('0xe'),_0x27aa9f,_0x2cbd('0xf'));logger[_0x2cbd('0x10')](_0x2cbd('0x11'),_0x27aa9f,_0x2cbd('0xf'),JSON['stringify'](_0x2cfd1e));if(_0x2cfd1e[_0x2cbd('0x12')]){if(_0x2cfd1e[_0x2cbd('0x12')][_0x2cbd('0x13')]===0x1f4){logger[_0x2cbd('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x27aa9f,_0x2cfd1e[_0x2cbd('0x12')][_0x2cbd('0x14')]);return _0x1dac7c(_0x2cfd1e[_0x2cbd('0x12')][_0x2cbd('0x14')]);}logger[_0x2cbd('0x12')](_0x2cbd('0xe'),_0x27aa9f,_0x2cfd1e['error']['message']);return _0x4b35b0(_0x2cfd1e['error']['message']);}else{logger[_0x2cbd('0xd')](_0x2cbd('0xe'),_0x27aa9f,_0x2cbd('0xf'));_0x4b35b0(_0x2cfd1e[_0x2cbd('0x15')]['message']);}})[_0x2cbd('0x16')](function(_0x5df532){logger[_0x2cbd('0x12')](_0x2cbd('0xe'),_0x27aa9f,_0x5df532);_0x1dac7c(_0x5df532);});});} \ No newline at end of file +var _0xc164=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5ac71e,_0x440c86){var _0x2aaa2b=function(_0x5f37e0){while(--_0x5f37e0){_0x5ac71e['push'](_0x5ac71e['shift']());}};_0x2aaa2b(++_0x440c86);}(_0xc164,0x18e));var _0x4c16=function(_0x1c5104,_0x3bb9cc){_0x1c5104=_0x1c5104-0x0;var _0x21e4b6=_0xc164[_0x1c5104];return _0x21e4b6;};'use strict';var _=require('lodash');var util=require(_0x4c16('0x0'));var moment=require(_0x4c16('0x1'));var BPromise=require(_0x4c16('0x2'));var rs=require(_0x4c16('0x3'));var fs=require('fs');var Redis=require(_0x4c16('0x4'));var db=require(_0x4c16('0x5'))['db'];var utils=require(_0x4c16('0x6'));var logger=require(_0x4c16('0x7'))('rpc');var config=require(_0x4c16('0x8'));var jayson=require(_0x4c16('0x9'));var client=jayson[_0x4c16('0xa')][_0x4c16('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10525f,_0x5e62a8,_0xa6488e){return new BPromise(function(_0x236aa7,_0x233f0a){return client[_0x4c16('0xc')](_0x10525f,_0xa6488e)['then'](function(_0x3ed462){logger[_0x4c16('0xd')](_0x4c16('0xe'),_0x5e62a8,_0x4c16('0xf'));logger[_0x4c16('0x10')](_0x4c16('0x11'),_0x5e62a8,_0x4c16('0xf'),JSON[_0x4c16('0x12')](_0x3ed462));if(_0x3ed462[_0x4c16('0x13')]){if(_0x3ed462['error']['code']===0x1f4){logger[_0x4c16('0x13')](_0x4c16('0xe'),_0x5e62a8,_0x3ed462['error'][_0x4c16('0x14')]);return _0x233f0a(_0x3ed462[_0x4c16('0x13')][_0x4c16('0x14')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x5e62a8,_0x3ed462[_0x4c16('0x13')][_0x4c16('0x14')]);return _0x236aa7(_0x3ed462[_0x4c16('0x13')][_0x4c16('0x14')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x5e62a8,_0x4c16('0xf'));_0x236aa7(_0x3ed462[_0x4c16('0x15')][_0x4c16('0x14')]);}})['catch'](function(_0x3aa010){logger['error'](_0x4c16('0xe'),_0x5e62a8,_0x3aa010);_0x233f0a(_0x3aa010);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 1cd2573..3bdf499 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 _0x8728=['../../components/auth/service','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x58ff61,_0x3f18cc){var _0x7eaddc=function(_0x40eb3c){while(--_0x40eb3c){_0x58ff61['push'](_0x58ff61['shift']());}};_0x7eaddc(++_0x3f18cc);}(_0x8728,0x12d));var _0x8872=function(_0x55b06f,_0xedbba2){_0x55b06f=_0x55b06f-0x0;var _0x5b2bcb=_0x8728[_0x55b06f];return _0x5b2bcb;};'use strict';var multer=require(_0x8872('0x0'));var util=require(_0x8872('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8872('0x2'));var router=express[_0x8872('0x3')]();var fs_extra=require(_0x8872('0x4'));var auth=require(_0x8872('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0x8872('0x6')]('/',auth[_0x8872('0x7')](),controller['index']);router[_0x8872('0x6')](_0x8872('0x8'),auth['isAuthenticated'](),controller[_0x8872('0x9')]);router[_0x8872('0x6')]('/:id',auth[_0x8872('0x7')](),controller[_0x8872('0xa')]);router[_0x8872('0xb')]('/',auth[_0x8872('0x7')](),controller[_0x8872('0xc')]);router[_0x8872('0xd')](_0x8872('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x8872('0xf')](_0x8872('0xe'),auth[_0x8872('0x7')](),controller[_0x8872('0x10')]);module[_0x8872('0x11')]=router; \ No newline at end of file +var _0x056e=['show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x4624d7,_0x2482e9){var _0x41c718=function(_0x5e099e){while(--_0x5e099e){_0x4624d7['push'](_0x4624d7['shift']());}};_0x41c718(++_0x2482e9);}(_0x056e,0x15a));var _0xe056=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0x056e[_0x39cf70];return _0x580424;};'use strict';var multer=require(_0xe056('0x0'));var util=require(_0xe056('0x1'));var path=require(_0xe056('0x2'));var timeout=require(_0xe056('0x3'));var express=require(_0xe056('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe056('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe056('0x6'));var controller=require(_0xe056('0x7'));router[_0xe056('0x8')]('/',auth['isAuthenticated'](),controller[_0xe056('0x9')]);router[_0xe056('0x8')](_0xe056('0xa'),auth[_0xe056('0xb')](),controller[_0xe056('0xc')]);router[_0xe056('0x8')](_0xe056('0xd'),auth[_0xe056('0xb')](),controller[_0xe056('0xe')]);router['post']('/',auth[_0xe056('0xb')](),controller[_0xe056('0xf')]);router[_0xe056('0x10')]('/:id',auth[_0xe056('0xb')](),controller[_0xe056('0x11')]);router[_0xe056('0x12')](_0xe056('0xd'),auth['isAuthenticated'](),controller[_0xe056('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 406aad2..93fe955 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 _0x3f90=['exports','STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0x182282,_0x4ba450){var _0x1362ab=function(_0x2b8f8d){while(--_0x2b8f8d){_0x182282['push'](_0x182282['shift']());}};_0x1362ab(++_0x4ba450);}(_0x3f90,0xd1));var _0x03f9=function(_0x543749,_0xcb3921){_0x543749=_0x543749-0x0;var _0x558041=_0x3f90[_0x543749];return _0x558041;};'use strict';var Sequelize=require(_0x03f9('0x0'));module[_0x03f9('0x1')]={'name':{'type':Sequelize[_0x03f9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x03f9('0x3')](_0x03f9('0x4'),_0x03f9('0x5')),'defaultValue':_0x03f9('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x03f9('0x6')]}}; \ No newline at end of file +var _0xfc31=['mouseOver','timeout','STRING','sequelize'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0xfc31,0x1e3));var _0x1fc3=function(_0x56b6b4,_0x4b81d0){_0x56b6b4=_0x56b6b4-0x0;var _0xe97eeb=_0xfc31[_0x56b6b4];return _0xe97eeb;};'use strict';var Sequelize=require(_0x1fc3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1fc3('0x1'),_0x1fc3('0x2')),'defaultValue':_0x1fc3('0x1')},'selector':{'type':Sequelize[_0x1fc3('0x3')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 0d28cd9..cf08a9c 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 _0xafdd=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','params','model','query','keys','intersection','attributes','fields','includeAll','include','merge','ChatProactiveAction','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x2fc673,_0x522af0){var _0x21d6e2=function(_0x38356e){while(--_0x38356e){_0x2fc673['push'](_0x2fc673['shift']());}};_0x21d6e2(++_0x522af0);}(_0xafdd,0x19a));var _0xdafd=function(_0x1ffa41,_0xc3996b){_0x1ffa41=_0x1ffa41-0x0;var _0x1f3a1a=_0xafdd[_0x1ffa41];return _0x1f3a1a;};'use strict';var emlformat=require(_0xdafd('0x0'));var rimraf=require(_0xdafd('0x1'));var zipdir=require(_0xdafd('0x2'));var jsonpatch=require(_0xdafd('0x3'));var rp=require(_0xdafd('0x4'));var moment=require(_0xdafd('0x5'));var BPromise=require(_0xdafd('0x6'));var Mustache=require(_0xdafd('0x7'));var util=require('util');var path=require(_0xdafd('0x8'));var sox=require(_0xdafd('0x9'));var csv=require(_0xdafd('0xa'));var ejs=require(_0xdafd('0xb'));var fs=require('fs');var fs_extra=require(_0xdafd('0xc'));var _=require(_0xdafd('0xd'));var squel=require(_0xdafd('0xe'));var crypto=require('crypto');var jsforce=require(_0xdafd('0xf'));var deskjs=require(_0xdafd('0x10'));var toCsv=require(_0xdafd('0xa'));var querystring=require('querystring');var Papa=require(_0xdafd('0x11'));var Redis=require(_0xdafd('0x12'));var authService=require(_0xdafd('0x13'));var qs=require(_0xdafd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdafd('0x15'));var logger=require(_0xdafd('0x16'))(_0xdafd('0x17'));var utils=require(_0xdafd('0x18'));var config=require(_0xdafd('0x19'));var licenseUtil=require(_0xdafd('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x166176,_0x594f47){_0x594f47=_0x594f47||0xcc;return function(_0x553508){if(_0x553508){return _0x166176[_0xdafd('0x1b')](_0x594f47);}return _0x166176[_0xdafd('0x1c')](_0x594f47)['end']();};}function respondWithResult(_0x43a716,_0x490382){_0x490382=_0x490382||0xc8;return function(_0x4b09da){if(_0x4b09da){return _0x43a716[_0xdafd('0x1c')](_0x490382)[_0xdafd('0x1d')](_0x4b09da);}};}function respondWithFilteredResult(_0x583b1d,_0x267bfc){return function(_0x186379){if(_0x186379){var _0x496515=typeof _0x267bfc[_0xdafd('0x1e')]===_0xdafd('0x1f')&&typeof _0x267bfc[_0xdafd('0x20')]==='undefined';var _0xb382ca=_0x186379[_0xdafd('0x21')];var _0x4fc3a4=_0x496515?0x0:_0x267bfc['offset'];var _0x2569b2=_0x496515?_0x186379['count']:_0x267bfc[_0xdafd('0x1e')]+_0x267bfc[_0xdafd('0x20')];var _0x1e64d3;if(_0x2569b2>=_0xb382ca){_0x2569b2=_0xb382ca;_0x1e64d3=0xc8;}else{_0x1e64d3=0xce;}_0x583b1d[_0xdafd('0x1c')](_0x1e64d3);return _0x583b1d[_0xdafd('0x22')](_0xdafd('0x23'),_0x4fc3a4+'-'+_0x2569b2+'/'+_0xb382ca)[_0xdafd('0x1d')](_0x186379);}return null;};}function patchUpdates(_0x42e0f9){return function(_0x8480a8){try{jsonpatch[_0xdafd('0x24')](_0x8480a8,_0x42e0f9,!![]);}catch(_0xee767e){return BPromise[_0xdafd('0x25')](_0xee767e);}return _0x8480a8[_0xdafd('0x26')]();};}function saveUpdates(_0xf4a521,_0x491d96){return function(_0x230495){if(_0x230495){return _0x230495['update'](_0xf4a521)[_0xdafd('0x27')](function(_0x5e96cc){return _0x5e96cc;});}return null;};}function removeEntity(_0x439bbf,_0x35ef78){return function(_0x7f10f6){if(_0x7f10f6){return _0x7f10f6[_0xdafd('0x28')]()[_0xdafd('0x27')](function(){_0x439bbf[_0xdafd('0x1c')](0xcc)[_0xdafd('0x29')]();});}};}function handleEntityNotFound(_0x30cba9,_0x3846dd){return function(_0x5cd11d){if(!_0x5cd11d){_0x30cba9[_0xdafd('0x1b')](0x194);}return _0x5cd11d;};}function handleError(_0x2ab575,_0x18554c){_0x18554c=_0x18554c||0x1f4;return function(_0x1feb5b){logger[_0xdafd('0x2a')](_0x1feb5b[_0xdafd('0x2b')]);if(_0x1feb5b[_0xdafd('0x2c')]){delete _0x1feb5b[_0xdafd('0x2c')];}_0x2ab575[_0xdafd('0x1c')](_0x18554c)[_0xdafd('0x2d')](_0x1feb5b);};}exports['show']=function(_0x243182,_0x14626b){var _0x13ab81={'raw':!![],'where':{'id':_0x243182[_0xdafd('0x2e')]['id']}},_0x249743={};_0x249743[_0xdafd('0x2f')]=_['keys'](db['ChatProactiveAction']['rawAttributes']);_0x249743[_0xdafd('0x30')]=_[_0xdafd('0x31')](_0x243182['query']);_0x249743['filters']=_[_0xdafd('0x32')](_0x249743[_0xdafd('0x2f')],_0x249743[_0xdafd('0x30')]);_0x13ab81[_0xdafd('0x33')]=_[_0xdafd('0x32')](_0x249743[_0xdafd('0x2f')],qs[_0xdafd('0x34')](_0x243182['query'][_0xdafd('0x34')]));_0x13ab81[_0xdafd('0x33')]=_0x13ab81[_0xdafd('0x33')]['length']?_0x13ab81[_0xdafd('0x33')]:_0x249743[_0xdafd('0x2f')];if(_0x243182['query'][_0xdafd('0x35')]){_0x13ab81[_0xdafd('0x36')]=[{'all':!![]}];}_0x13ab81=_[_0xdafd('0x37')]({},_0x13ab81,_0x243182['options']);return db[_0xdafd('0x38')][_0xdafd('0x39')](_0x13ab81)[_0xdafd('0x27')](handleEntityNotFound(_0x14626b,null))[_0xdafd('0x27')](respondWithResult(_0x14626b,null))[_0xdafd('0x3a')](handleError(_0x14626b,null));};exports[_0xdafd('0x3b')]=function(_0x3bda9b,_0x5dc9f2){return db[_0xdafd('0x38')][_0xdafd('0x3b')](_0x3bda9b[_0xdafd('0x3c')],{})[_0xdafd('0x27')](respondWithResult(_0x5dc9f2,0xc9))[_0xdafd('0x3a')](handleError(_0x5dc9f2,null));};exports['update']=function(_0x386cf6,_0x21d724){if(_0x386cf6['body']['id']){delete _0x386cf6[_0xdafd('0x3c')]['id'];}return db[_0xdafd('0x38')][_0xdafd('0x39')]({'where':{'id':_0x386cf6[_0xdafd('0x2e')]['id']}})[_0xdafd('0x27')](handleEntityNotFound(_0x21d724,null))[_0xdafd('0x27')](saveUpdates(_0x386cf6[_0xdafd('0x3c')],null))[_0xdafd('0x27')](respondWithResult(_0x21d724,null))[_0xdafd('0x3a')](handleError(_0x21d724,null));};exports[_0xdafd('0x28')]=function(_0x787d7c,_0x245163){return db[_0xdafd('0x38')][_0xdafd('0x39')]({'where':{'id':_0x787d7c[_0xdafd('0x2e')]['id']}})[_0xdafd('0x27')](handleEntityNotFound(_0x245163,null))[_0xdafd('0x27')](removeEntity(_0x245163,null))[_0xdafd('0x3a')](handleError(_0x245163,null));}; \ No newline at end of file +var _0x5243=['mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','name','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','catch','destroy','eml-format','fast-json-patch','request-promise'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x5243,0x71));var _0x3524=function(_0x36b0ca,_0x19b1ab){_0x36b0ca=_0x36b0ca-0x0;var _0x49b07c=_0x5243[_0x36b0ca];return _0x49b07c;};'use strict';var emlformat=require(_0x3524('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3524('0x1'));var rp=require(_0x3524('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3524('0x3'));var util=require(_0x3524('0x4'));var path=require('path');var sox=require(_0x3524('0x5'));var csv=require('to-csv');var ejs=require(_0x3524('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3524('0x7'));var squel=require(_0x3524('0x8'));var crypto=require(_0x3524('0x9'));var jsforce=require(_0x3524('0xa'));var deskjs=require(_0x3524('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3524('0xc'));var Redis=require(_0x3524('0xd'));var authService=require(_0x3524('0xe'));var qs=require(_0x3524('0xf'));var as=require(_0x3524('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3524('0x11'))(_0x3524('0x12'));var utils=require('../../config/utils');var config=require(_0x3524('0x13'));var licenseUtil=require(_0x3524('0x14'));var db=require(_0x3524('0x15'))['db'];function respondWithStatusCode(_0x5d5a60,_0x4f49da){_0x4f49da=_0x4f49da||0xcc;return function(_0x50c11f){if(_0x50c11f){return _0x5d5a60['sendStatus'](_0x4f49da);}return _0x5d5a60[_0x3524('0x16')](_0x4f49da)[_0x3524('0x17')]();};}function respondWithResult(_0x58cd29,_0x3aa2da){_0x3aa2da=_0x3aa2da||0xc8;return function(_0x253d92){if(_0x253d92){return _0x58cd29[_0x3524('0x16')](_0x3aa2da)[_0x3524('0x18')](_0x253d92);}};}function respondWithFilteredResult(_0xe5df67,_0x235cfd){return function(_0x34d9a0){if(_0x34d9a0){var _0x8440a4=typeof _0x235cfd[_0x3524('0x19')]==='undefined'&&typeof _0x235cfd[_0x3524('0x1a')]==='undefined';var _0x2eb681=_0x34d9a0[_0x3524('0x1b')];var _0x44ee2e=_0x8440a4?0x0:_0x235cfd[_0x3524('0x19')];var _0x1ca615=_0x8440a4?_0x34d9a0[_0x3524('0x1b')]:_0x235cfd['offset']+_0x235cfd['limit'];var _0x1acbd1;if(_0x1ca615>=_0x2eb681){_0x1ca615=_0x2eb681;_0x1acbd1=0xc8;}else{_0x1acbd1=0xce;}_0xe5df67['status'](_0x1acbd1);return _0xe5df67[_0x3524('0x1c')](_0x3524('0x1d'),_0x44ee2e+'-'+_0x1ca615+'/'+_0x2eb681)[_0x3524('0x18')](_0x34d9a0);}return null;};}function patchUpdates(_0xd285a3){return function(_0x1d25f8){try{jsonpatch[_0x3524('0x1e')](_0x1d25f8,_0xd285a3,!![]);}catch(_0x4f584a){return BPromise[_0x3524('0x1f')](_0x4f584a);}return _0x1d25f8[_0x3524('0x20')]();};}function saveUpdates(_0x1ab2c5,_0xf1b3b1){return function(_0x2d20c8){if(_0x2d20c8){return _0x2d20c8['update'](_0x1ab2c5)[_0x3524('0x21')](function(_0x52600c){return _0x52600c;});}return null;};}function removeEntity(_0x2eb72f,_0x26c20e){return function(_0x101e9a){if(_0x101e9a){return _0x101e9a['destroy']()[_0x3524('0x21')](function(){_0x2eb72f[_0x3524('0x16')](0xcc)[_0x3524('0x17')]();});}};}function handleEntityNotFound(_0x27bd6a,_0x4dfd49){return function(_0x4256ca){if(!_0x4256ca){_0x27bd6a[_0x3524('0x22')](0x194);}return _0x4256ca;};}function handleError(_0x1765a4,_0x5dc071){_0x5dc071=_0x5dc071||0x1f4;return function(_0x1d351e){logger[_0x3524('0x23')](_0x1d351e['stack']);if(_0x1d351e[_0x3524('0x24')]){delete _0x1d351e[_0x3524('0x24')];}_0x1765a4['status'](_0x5dc071)['send'](_0x1d351e);};}exports[_0x3524('0x25')]=function(_0x3fddc1,_0x225b26){var _0x651f11={'raw':!![],'where':{'id':_0x3fddc1[_0x3524('0x26')]['id']}},_0x5bf38e={};_0x5bf38e['model']=_[_0x3524('0x27')](db[_0x3524('0x28')][_0x3524('0x29')]);_0x5bf38e['query']=_['keys'](_0x3fddc1[_0x3524('0x2a')]);_0x5bf38e[_0x3524('0x2b')]=_['intersection'](_0x5bf38e[_0x3524('0x2c')],_0x5bf38e[_0x3524('0x2a')]);_0x651f11[_0x3524('0x2d')]=_[_0x3524('0x2e')](_0x5bf38e[_0x3524('0x2c')],qs['fields'](_0x3fddc1[_0x3524('0x2a')][_0x3524('0x2f')]));_0x651f11[_0x3524('0x2d')]=_0x651f11['attributes'][_0x3524('0x30')]?_0x651f11[_0x3524('0x2d')]:_0x5bf38e[_0x3524('0x2c')];if(_0x3fddc1[_0x3524('0x2a')][_0x3524('0x31')]){_0x651f11[_0x3524('0x32')]=[{'all':!![]}];}_0x651f11=_[_0x3524('0x33')]({},_0x651f11,_0x3fddc1[_0x3524('0x34')]);return db[_0x3524('0x28')][_0x3524('0x35')](_0x651f11)[_0x3524('0x21')](handleEntityNotFound(_0x225b26,null))['then'](respondWithResult(_0x225b26,null))['catch'](handleError(_0x225b26,null));};exports['create']=function(_0x197f78,_0x48b54b){return db[_0x3524('0x28')][_0x3524('0x36')](_0x197f78[_0x3524('0x37')],{})['then'](respondWithResult(_0x48b54b,0xc9))[_0x3524('0x38')](handleError(_0x48b54b,null));};exports['update']=function(_0x18ee71,_0xcc63d5){if(_0x18ee71[_0x3524('0x37')]['id']){delete _0x18ee71[_0x3524('0x37')]['id'];}return db[_0x3524('0x28')]['find']({'where':{'id':_0x18ee71[_0x3524('0x26')]['id']}})[_0x3524('0x21')](handleEntityNotFound(_0xcc63d5,null))[_0x3524('0x21')](saveUpdates(_0x18ee71[_0x3524('0x37')],null))['then'](respondWithResult(_0xcc63d5,null))[_0x3524('0x38')](handleError(_0xcc63d5,null));};exports[_0x3524('0x39')]=function(_0x449c51,_0x97b711){return db[_0x3524('0x28')]['find']({'where':{'id':_0x449c51['params']['id']}})[_0x3524('0x21')](handleEntityNotFound(_0x97b711,null))[_0x3524('0x21')](removeEntity(_0x97b711,null))[_0x3524('0x38')](handleError(_0x97b711,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 008ccd7..aa377f8 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 _0xdf81=['bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api'];(function(_0x433919,_0x4b106a){var _0x192c9f=function(_0x153f4a){while(--_0x153f4a){_0x433919['push'](_0x433919['shift']());}};_0x192c9f(++_0x4b106a);}(_0xdf81,0xcc));var _0x1df8=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xdf81[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0x1df8('0x0'));var util=require(_0x1df8('0x1'));var logger=require(_0x1df8('0x2'))(_0x1df8('0x3'));var moment=require('moment');var BPromise=require(_0x1df8('0x4'));var rp=require(_0x1df8('0x5'));var fs=require('fs');var path=require(_0x1df8('0x6'));var rimraf=require(_0x1df8('0x7'));var config=require('../../config/environment');var attributes=require(_0x1df8('0x8'));module[_0x1df8('0x9')]=function(_0x23971d,_0xc7a571){return _0x23971d[_0x1df8('0xa')](_0x1df8('0xb'),attributes,{'tableName':_0x1df8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c1d=['util','api','moment','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x5773ed,_0x2270ce){var _0x4a75d9=function(_0x31a9a3){while(--_0x31a9a3){_0x5773ed['push'](_0x5773ed['shift']());}};_0x4a75d9(++_0x2270ce);}(_0x5c1d,0x103));var _0xd5c1=function(_0x910cb0,_0x32746d){_0x910cb0=_0x910cb0-0x0;var _0x474d65=_0x5c1d[_0x910cb0];return _0x474d65;};'use strict';var _=require(_0xd5c1('0x0'));var util=require(_0xd5c1('0x1'));var logger=require('../../config/logger')(_0xd5c1('0x2'));var moment=require(_0xd5c1('0x3'));var BPromise=require(_0xd5c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd5c1('0x5'));var rimraf=require(_0xd5c1('0x6'));var config=require(_0xd5c1('0x7'));var attributes=require(_0xd5c1('0x8'));module[_0xd5c1('0x9')]=function(_0x4d7b76,_0x18ead7){return _0x4d7b76[_0xd5c1('0xa')](_0xd5c1('0xb'),attributes,{'tableName':_0xd5c1('0xc'),'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 f994b15..de572b0 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 _0xa818=['request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0xa818,0x64));var _0x8a81=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0xa818[_0x3daa8c];return _0x2b1bd7;};'use strict';var _=require('lodash');var util=require(_0x8a81('0x0'));var moment=require(_0x8a81('0x1'));var BPromise=require(_0x8a81('0x2'));var rs=require(_0x8a81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a81('0x4'))['db'];var utils=require(_0x8a81('0x5'));var logger=require(_0x8a81('0x6'))(_0x8a81('0x7'));var config=require(_0x8a81('0x8'));var jayson=require(_0x8a81('0x9'));var client=jayson['client'][_0x8a81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a0cd9,_0x15025d,_0x35eb10){return new BPromise(function(_0x1a364a,_0x5e65d5){return client[_0x8a81('0xb')](_0x2a0cd9,_0x35eb10)[_0x8a81('0xc')](function(_0x55be3a){logger[_0x8a81('0xd')](_0x8a81('0xe'),_0x15025d,_0x8a81('0xf'));logger[_0x8a81('0x10')](_0x8a81('0x11'),_0x15025d,_0x8a81('0xf'),JSON[_0x8a81('0x12')](_0x55be3a));if(_0x55be3a[_0x8a81('0x13')]){if(_0x55be3a[_0x8a81('0x13')]['code']===0x1f4){logger['error'](_0x8a81('0xe'),_0x15025d,_0x55be3a[_0x8a81('0x13')][_0x8a81('0x14')]);return _0x5e65d5(_0x55be3a[_0x8a81('0x13')][_0x8a81('0x14')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x15025d,_0x55be3a[_0x8a81('0x13')][_0x8a81('0x14')]);return _0x1a364a(_0x55be3a[_0x8a81('0x13')]['message']);}else{logger[_0x8a81('0xd')](_0x8a81('0xe'),_0x15025d,_0x8a81('0xf'));_0x1a364a(_0x55be3a[_0x8a81('0x15')]['message']);}})[_0x8a81('0x16')](function(_0x269f5c){logger[_0x8a81('0x13')](_0x8a81('0xe'),_0x15025d,_0x269f5c);_0x5e65d5(_0x269f5c);});});} \ No newline at end of file +var _0xd0ba=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd0ba,0x17c));var _0xad0b=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xd0ba[_0x2b5513];return _0x578fd2;};'use strict';var _=require('lodash');var util=require(_0xad0b('0x0'));var moment=require(_0xad0b('0x1'));var BPromise=require(_0xad0b('0x2'));var rs=require(_0xad0b('0x3'));var fs=require('fs');var Redis=require(_0xad0b('0x4'));var db=require(_0xad0b('0x5'))['db'];var utils=require(_0xad0b('0x6'));var logger=require(_0xad0b('0x7'))(_0xad0b('0x8'));var config=require('../../config/environment');var jayson=require(_0xad0b('0x9'));var client=jayson[_0xad0b('0xa')][_0xad0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x482525,_0x407d30,_0x10cf14){return new BPromise(function(_0x529785,_0x4981c3){return client['request'](_0x482525,_0x10cf14)['then'](function(_0x278f33){logger['info'](_0xad0b('0xc'),_0x407d30,_0xad0b('0xd'));logger['debug'](_0xad0b('0xe'),_0x407d30,_0xad0b('0xd'),JSON[_0xad0b('0xf')](_0x278f33));if(_0x278f33[_0xad0b('0x10')]){if(_0x278f33['error']['code']===0x1f4){logger[_0xad0b('0x10')](_0xad0b('0xc'),_0x407d30,_0x278f33[_0xad0b('0x10')][_0xad0b('0x11')]);return _0x4981c3(_0x278f33[_0xad0b('0x10')][_0xad0b('0x11')]);}logger[_0xad0b('0x10')](_0xad0b('0xc'),_0x407d30,_0x278f33[_0xad0b('0x10')][_0xad0b('0x11')]);return _0x529785(_0x278f33['error'][_0xad0b('0x11')]);}else{logger[_0xad0b('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x407d30,_0xad0b('0xd'));_0x529785(_0x278f33['result'][_0xad0b('0x11')]);}})[_0xad0b('0x13')](function(_0x4394be){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x407d30,_0x4394be);_0x4981c3(_0x4394be);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index ac5a1de..c65672c 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 _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(_0x1ead47,_0x47766a){var _0x8cbbbc=function(_0x2a20fb){while(--_0x2a20fb){_0x1ead47['push'](_0x1ead47['shift']());}};_0x8cbbbc(++_0x47766a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x35c718,_0x33a696){_0x35c718=_0x35c718-0x0;var _0x5c3099=_0x7fbe[_0x35c718];return _0x5c3099;};'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 +var _0x6f47=['show','post','create','put','/:id','update','destroy','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated'];(function(_0x2f56b5,_0x582964){var _0x13f229=function(_0x2e81fb){while(--_0x2e81fb){_0x2f56b5['push'](_0x2f56b5['shift']());}};_0x13f229(++_0x582964);}(_0x6f47,0xc7));var _0x76f4=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x6f47[_0xaa0309];return _0x5de7ce;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var fs_extra=require(_0x76f4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var controller=require(_0x76f4('0x6'));router[_0x76f4('0x7')]('/:id',auth[_0x76f4('0x8')](),controller[_0x76f4('0x9')]);router[_0x76f4('0xa')]('/',auth['isAuthenticated'](),controller[_0x76f4('0xb')]);router[_0x76f4('0xc')](_0x76f4('0xd'),auth[_0x76f4('0x8')](),controller[_0x76f4('0xe')]);router['delete']('/:id',auth[_0x76f4('0x8')](),controller[_0x76f4('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 4538dd9..9dfe46b 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 _0xfe38=['exports','STRING','name','ENUM','rrmemory','sequelize'];(function(_0x5d0430,_0x15cc32){var _0x4d964c=function(_0x392cbf){while(--_0x392cbf){_0x5d0430['push'](_0x5d0430['shift']());}};_0x4d964c(++_0x15cc32);}(_0xfe38,0x18b));var _0x8fe3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfe38[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x8fe3('0x0'));module[_0x8fe3('0x1')]={'name':{'type':Sequelize[_0x8fe3('0x2')],'unique':_0x8fe3('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8fe3('0x4')](_0x8fe3('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x23ac=['beepall','roundrobin','STRING','name','ENUM'];(function(_0x5e0d54,_0x493251){var _0x280def=function(_0x18bf09){while(--_0x18bf09){_0x5e0d54['push'](_0x5e0d54['shift']());}};_0x280def(++_0x493251);}(_0x23ac,0x11f));var _0xc23a=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0x23ac[_0x261e29];return _0x25ef43;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc23a('0x0')],'unique':_0xc23a('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc23a('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc23a('0x2')]('rrmemory',_0xc23a('0x3'),_0xc23a('0x4'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 14ef097..2ada005 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 _0x2f4a=['../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','ChatQueue','include','query','findAll','rows','catch','show','params','model','intersection','attributes','fields','length','includeAll','options','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','keys','filters','hasOwnProperty','nolimit','order','sort','ChatQueueId','filter','merge','UserChatQueue','User','findAndCountAll','agent','chatPause','updatedAt','format','SIP','createdAt','getTeams','findOne','pick','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','userChatQueue:save','isArray','getAgents','util','lodash','squel'];(function(_0xa0cb20,_0x1c18ef){var _0x2cc906=function(_0x4db98b){while(--_0x4db98b){_0xa0cb20['push'](_0xa0cb20['shift']());}};_0x2cc906(++_0x1c18ef);}(_0x2f4a,0x75));var _0xa2f4=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x2f4a[_0x513aa5];return _0x1a1a7c;};'use strict';var BPromise=require('bluebird');var util=require(_0xa2f4('0x0'));var _=require(_0xa2f4('0x1'));var squel=require(_0xa2f4('0x2'));var Redis=require('ioredis');var qs=require(_0xa2f4('0x3'));var logger=require(_0xa2f4('0x4'))(_0xa2f4('0x5'));var config=require(_0xa2f4('0x6'));var db=require(_0xa2f4('0x7'))['db'];config[_0xa2f4('0x8')]=_[_0xa2f4('0x9')](config['redis'],{'host':_0xa2f4('0xa'),'port':0x18eb});var socket=require(_0xa2f4('0xb'))(new Redis(config[_0xa2f4('0x8')]));require('./chatQueue.socket')[_0xa2f4('0xc')](socket);function respondWithStatusCode(_0x3d76cb,_0x210083){_0x210083=_0x210083||0xcc;return function(_0x596cb1){if(_0x596cb1){return _0x3d76cb[_0xa2f4('0xd')](_0x210083);}return _0x3d76cb[_0xa2f4('0xe')](_0x210083)[_0xa2f4('0xf')]();};}function respondWithResult(_0x58f4fd,_0x277fc0){_0x277fc0=_0x277fc0||0xc8;return function(_0x210e3a){if(_0x210e3a){return _0x58f4fd[_0xa2f4('0xe')](_0x277fc0)[_0xa2f4('0x10')](_0x210e3a);}};}function respondWithFilteredResult(_0x386050,_0x39b47a){return function(_0x55e812){if(_0x55e812){var _0x15b2b9=typeof _0x39b47a['offset']==='undefined'&&typeof _0x39b47a[_0xa2f4('0x11')]===_0xa2f4('0x12');var _0x12c0ca=_0x55e812[_0xa2f4('0x13')];var _0x9e8adc=_0x15b2b9?0x0:_0x39b47a[_0xa2f4('0x14')];var _0x2eaa36=_0x15b2b9?_0x55e812['count']:_0x39b47a[_0xa2f4('0x14')]+_0x39b47a[_0xa2f4('0x11')];var _0x11b64c;if(_0x2eaa36>=_0x12c0ca){_0x2eaa36=_0x12c0ca;_0x11b64c=0xc8;}else{_0x11b64c=0xce;}_0x386050['status'](_0x11b64c);return _0x386050['set'](_0xa2f4('0x15'),_0x9e8adc+'-'+_0x2eaa36+'/'+_0x12c0ca)[_0xa2f4('0x10')](_0x55e812);}return null;};}function saveUpdates(_0x13ee36){return function(_0xc305ed){if(_0xc305ed){return _0xc305ed[_0xa2f4('0x16')](_0x13ee36)[_0xa2f4('0x17')](function(_0x36bd06){return _0x36bd06;});}return null;};}function removeEntity(_0x1892fc){return function(_0x35cba5){if(_0x35cba5){return _0x35cba5[_0xa2f4('0x18')]()[_0xa2f4('0x17')](function(){var _0x554f6b=_0x35cba5[_0xa2f4('0x19')]({'plain':!![]});var _0x1d1ee2=_0xa2f4('0x1a');return db[_0xa2f4('0x1b')][_0xa2f4('0x18')]({'where':{'type':_0x1d1ee2,'resourceId':_0x554f6b['id']}})[_0xa2f4('0x17')](function(){return _0x35cba5;});})[_0xa2f4('0x17')](function(){_0x1892fc['status'](0xcc)[_0xa2f4('0xf')]();});}};}function handleEntityNotFound(_0x937460){return function(_0x435f71){if(!_0x435f71){_0x937460['sendStatus'](0x194);}return _0x435f71;};}function handleError(_0x44e0f4,_0x362b76){_0x362b76=_0x362b76||0x1f4;return function(_0x4ce83f){logger[_0xa2f4('0x1c')](_0x4ce83f['stack']);if(_0x4ce83f[_0xa2f4('0x1d')]){delete _0x4ce83f[_0xa2f4('0x1d')];}_0x44e0f4[_0xa2f4('0xe')](_0x362b76)[_0xa2f4('0x1e')](_0x4ce83f);};}exports[_0xa2f4('0x1f')]=function(_0x535add,_0x8d7e33){var _0x583258={};var _0x2293b7={'count':0x0,'rows':[]};var _0x56f4b2=_[_0xa2f4('0x20')](db['ChatQueue'][_0xa2f4('0x21')],function(_0x262c45){return{'name':_0x262c45[_0xa2f4('0x22')],'type':_0x262c45[_0xa2f4('0x23')][_0xa2f4('0x24')]};});_0x583258=qs[_0xa2f4('0x25')](_0x56f4b2,_0x535add);var _0x5da497={'where':_0x583258[_0xa2f4('0x26')]};return db[_0xa2f4('0x27')][_0xa2f4('0x13')](_0x5da497)[_0xa2f4('0x17')](function(_0x204fcd){_0x2293b7['count']=_0x204fcd;_0x583258['include']=qs[_0xa2f4('0x28')](_0x535add[_0xa2f4('0x29')]);return db[_0xa2f4('0x27')][_0xa2f4('0x2a')](_0x583258);})[_0xa2f4('0x17')](function(_0x27a4e8){_0x2293b7[_0xa2f4('0x2b')]=_0x27a4e8;return _0x2293b7;})['then'](respondWithFilteredResult(_0x8d7e33,_0x583258))[_0xa2f4('0x2c')](handleError(_0x8d7e33,null));};exports[_0xa2f4('0x2d')]=function(_0x148e03,_0xcdbed7){var _0x414f8a={'raw':!![],'where':{'id':_0x148e03[_0xa2f4('0x2e')]['id']}},_0x3c7b5e={};_0x3c7b5e[_0xa2f4('0x2f')]=_['keys'](db[_0xa2f4('0x27')]['rawAttributes']);_0x3c7b5e[_0xa2f4('0x29')]=_['keys'](_0x148e03['query']);_0x3c7b5e['filters']=_[_0xa2f4('0x30')](_0x3c7b5e[_0xa2f4('0x2f')],_0x3c7b5e['query']);_0x414f8a[_0xa2f4('0x31')]=_[_0xa2f4('0x30')](_0x3c7b5e[_0xa2f4('0x2f')],qs['fields'](_0x148e03[_0xa2f4('0x29')][_0xa2f4('0x32')]));_0x414f8a[_0xa2f4('0x31')]=_0x414f8a[_0xa2f4('0x31')][_0xa2f4('0x33')]?_0x414f8a[_0xa2f4('0x31')]:_0x3c7b5e[_0xa2f4('0x2f')];if(_0x148e03['query'][_0xa2f4('0x34')]){_0x414f8a[_0xa2f4('0x28')]=[{'all':!![]}];}_0x414f8a=_['merge']({},_0x414f8a,_0x148e03[_0xa2f4('0x35')]);return db[_0xa2f4('0x27')][_0xa2f4('0x36')](_0x414f8a)[_0xa2f4('0x17')](handleEntityNotFound(_0xcdbed7,null))['then'](respondWithResult(_0xcdbed7,null))[_0xa2f4('0x2c')](handleError(_0xcdbed7,null));};exports[_0xa2f4('0x37')]=function(_0x5025e1,_0x5d00e4){return db['ChatQueue']['create'](_0x5025e1[_0xa2f4('0x38')],{})['then'](function(_0xcd8457){var _0x4f6170=_0x5025e1[_0xa2f4('0x39')][_0xa2f4('0x19')]({'plain':!![]});if(!_0x4f6170)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f6170[_0xa2f4('0x3a')]===_0xa2f4('0x39')){var _0x2b838c=_0xcd8457['get']({'plain':!![]});var _0x57e76b='ChatQueues';return db['UserProfileSection'][_0xa2f4('0x36')]({'where':{'name':_0x57e76b,'userProfileId':_0x4f6170[_0xa2f4('0x3b')]},'raw':!![]})[_0xa2f4('0x17')](function(_0x27f4d9){if(_0x27f4d9&&_0x27f4d9[_0xa2f4('0x3c')]===0x0){return db[_0xa2f4('0x1b')]['create']({'name':_0x2b838c['name'],'resourceId':_0x2b838c['id'],'type':_0x27f4d9['name'],'sectionId':_0x27f4d9['id']},{})['then'](function(){return _0xcd8457;});}else{return _0xcd8457;}})['catch'](function(_0x16b52f){logger['error'](_0xa2f4('0x3d'),_0x16b52f);throw _0x16b52f;});}return _0xcd8457;})[_0xa2f4('0x17')](respondWithResult(_0x5d00e4,0xc9))[_0xa2f4('0x2c')](handleError(_0x5d00e4,null));};exports[_0xa2f4('0x16')]=function(_0x203044,_0x519ac0){if(_0x203044['body']['id']){delete _0x203044[_0xa2f4('0x38')]['id'];}return db[_0xa2f4('0x27')]['find']({'where':{'id':_0x203044['params']['id']}})[_0xa2f4('0x17')](handleEntityNotFound(_0x519ac0,null))['then'](saveUpdates(_0x203044[_0xa2f4('0x38')],null))[_0xa2f4('0x17')](respondWithResult(_0x519ac0,null))[_0xa2f4('0x2c')](handleError(_0x519ac0,null));};exports['destroy']=function(_0xdcb383,_0x7b6fd5){return db[_0xa2f4('0x27')]['find']({'where':{'id':_0xdcb383[_0xa2f4('0x2e')]['id']}})[_0xa2f4('0x17')](handleEntityNotFound(_0x7b6fd5,null))['then'](removeEntity(_0x7b6fd5,null))[_0xa2f4('0x2c')](handleError(_0x7b6fd5,null));};exports['describe']=function(_0x140c86,_0x414575){return db[_0xa2f4('0x27')][_0xa2f4('0x3e')]()['then'](respondWithResult(_0x414575,null))[_0xa2f4('0x2c')](handleError(_0x414575,null));};exports[_0xa2f4('0x3f')]=function(_0xafcd9b,_0x31aa38){var _0x1267f7={'raw':!![],'where':{}},_0x23cae8={},_0xd77187;return db[_0xa2f4('0x27')]['findOne']({'where':{'id':_0xafcd9b['params']['id']}})['then'](handleEntityNotFound(_0x31aa38,null))[_0xa2f4('0x17')](function(_0x2fb8f1){if(_0x2fb8f1){_0xd77187=_0x2fb8f1[_0xa2f4('0x19')]({'plain':!![]});_0x23cae8['model']=_[_0xa2f4('0x40')](db['UserChatQueue'][_0xa2f4('0x21')]);_0x23cae8[_0xa2f4('0x29')]=_['keys'](_0xafcd9b['query']);_0x23cae8[_0xa2f4('0x41')]=_[_0xa2f4('0x30')](_0x23cae8[_0xa2f4('0x2f')],_0x23cae8[_0xa2f4('0x29')]);_0x1267f7[_0xa2f4('0x31')]=_['intersection'](_0x23cae8[_0xa2f4('0x2f')],qs[_0xa2f4('0x32')](_0xafcd9b['query'][_0xa2f4('0x32')]));_0x1267f7['attributes']=_0x1267f7['attributes'][_0xa2f4('0x33')]?_0x1267f7[_0xa2f4('0x31')]:_0x23cae8[_0xa2f4('0x2f')];if(!_0xafcd9b[_0xa2f4('0x29')][_0xa2f4('0x42')](_0xa2f4('0x43'))){_0x1267f7[_0xa2f4('0x11')]=qs['limit'](_0xafcd9b[_0xa2f4('0x29')][_0xa2f4('0x11')]);_0x1267f7[_0xa2f4('0x14')]=qs[_0xa2f4('0x14')](_0xafcd9b[_0xa2f4('0x29')][_0xa2f4('0x14')]);}_0x1267f7[_0xa2f4('0x44')]=qs[_0xa2f4('0x45')](_0xafcd9b['query'][_0xa2f4('0x45')]);_0x1267f7['where']=qs[_0xa2f4('0x41')](_['pick'](_0xafcd9b['query'],_0x23cae8[_0xa2f4('0x41')]));_0x1267f7[_0xa2f4('0x26')][_0xa2f4('0x46')]=_0x2fb8f1['id'];if(_0xafcd9b[_0xa2f4('0x29')][_0xa2f4('0x47')]){_0x1267f7[_0xa2f4('0x26')]=_[_0xa2f4('0x48')](_0x1267f7[_0xa2f4('0x26')],{'$or':_[_0xa2f4('0x20')](_0x1267f7['attributes'],function(_0x54286b){var _0x1a04e1={};_0x1a04e1[_0x54286b]={'$like':'%'+_0xafcd9b[_0xa2f4('0x29')]['filter']+'%'};return _0x1a04e1;})});}_0x1267f7=_[_0xa2f4('0x48')]({},_0x1267f7,_0xafcd9b['options']);return db[_0xa2f4('0x49')][_0xa2f4('0x2a')](_0x1267f7);}})[_0xa2f4('0x17')](function(_0x5095fe){if(_0x5095fe){return db[_0xa2f4('0x4a')][_0xa2f4('0x4b')]({'where':{'id':_['map'](_0x5095fe,'UserId'),'role':_0xa2f4('0x4c')},'attributes':['id',_0xa2f4('0x1d'),_0xa2f4('0x4d'),_0xa2f4('0x4e'),'createdAt']});}})[_0xa2f4('0x17')](function(_0x2f8255){if(_0x2f8255){return{'count':_0x2f8255[_0xa2f4('0x13')],'rows':_[_0xa2f4('0x20')](_0x2f8255[_0xa2f4('0x2b')],function(_0x599044){return{'membername':_0x599044[_0xa2f4('0x1d')],'UserId':_0x599044['id'],'queue_name':_0xd77187['name'],'ChatQueueId':_0xd77187['id'],'interface':util[_0xa2f4('0x4f')]('%s/%s',_0xa2f4('0x50'),_0x599044[_0xa2f4('0x1d')]),'penalty':0x0,'paused':_0x599044['chatPause'],'createdAt':_0x599044[_0xa2f4('0x51')],'updatedAt':_0x599044[_0xa2f4('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x31aa38,_0x1267f7))[_0xa2f4('0x2c')](handleError(_0x31aa38,null));};exports[_0xa2f4('0x52')]=function(_0x5aa3e0,_0x145ec0){var _0x297fa8={};var _0x27b71a={};var _0x19cdb5;var _0x4e97f0;return db[_0xa2f4('0x27')][_0xa2f4('0x53')]({'where':{'id':_0x5aa3e0[_0xa2f4('0x2e')]['id']}})['then'](handleEntityNotFound(_0x145ec0,null))[_0xa2f4('0x17')](function(_0x144fb4){if(_0x144fb4){_0x19cdb5=_0x144fb4;_0x27b71a['model']=_['keys'](db['Team'][_0xa2f4('0x21')]);_0x27b71a[_0xa2f4('0x29')]=_['keys'](_0x5aa3e0[_0xa2f4('0x29')]);_0x27b71a[_0xa2f4('0x41')]=_[_0xa2f4('0x30')](_0x27b71a[_0xa2f4('0x2f')],_0x27b71a[_0xa2f4('0x29')]);_0x297fa8[_0xa2f4('0x31')]=_[_0xa2f4('0x30')](_0x27b71a[_0xa2f4('0x2f')],qs[_0xa2f4('0x32')](_0x5aa3e0['query']['fields']));_0x297fa8[_0xa2f4('0x31')]=_0x297fa8[_0xa2f4('0x31')][_0xa2f4('0x33')]?_0x297fa8[_0xa2f4('0x31')]:_0x27b71a[_0xa2f4('0x2f')];_0x297fa8[_0xa2f4('0x44')]=qs[_0xa2f4('0x45')](_0x5aa3e0['query'][_0xa2f4('0x45')]);_0x297fa8['where']=qs['filters'](_[_0xa2f4('0x54')](_0x5aa3e0[_0xa2f4('0x29')],_0x27b71a['filters']));if(_0x5aa3e0[_0xa2f4('0x29')][_0xa2f4('0x47')]){_0x297fa8['where']=_[_0xa2f4('0x48')](_0x297fa8['where'],{'$or':_['map'](_0x297fa8[_0xa2f4('0x31')],function(_0x4dc930){var _0x4dcce2={};_0x4dcce2[_0x4dc930]={'$like':'%'+_0x5aa3e0[_0xa2f4('0x29')][_0xa2f4('0x47')]+'%'};return _0x4dcce2;})});}_0x297fa8=_[_0xa2f4('0x48')]({},_0x297fa8,_0x5aa3e0[_0xa2f4('0x35')]);return _0x19cdb5[_0xa2f4('0x52')](_0x297fa8);}})[_0xa2f4('0x17')](function(_0x5b23ec){if(_0x5b23ec){_0x4e97f0=_0x5b23ec[_0xa2f4('0x33')];if(!_0x5aa3e0[_0xa2f4('0x29')][_0xa2f4('0x42')](_0xa2f4('0x43'))){_0x297fa8[_0xa2f4('0x11')]=qs['limit'](_0x5aa3e0[_0xa2f4('0x29')][_0xa2f4('0x11')]);_0x297fa8[_0xa2f4('0x14')]=qs[_0xa2f4('0x14')](_0x5aa3e0['query']['offset']);}return _0x19cdb5[_0xa2f4('0x52')](_0x297fa8);}})['then'](function(_0x523d62){if(_0x523d62){return _0x523d62?{'count':_0x4e97f0,'rows':_0x523d62}:null;}})['then'](respondWithResult(_0x145ec0,null))[_0xa2f4('0x2c')](handleError(_0x145ec0,null));};exports[_0xa2f4('0x55')]=function(_0x208a5b,_0x1c37c0){var _0x306e75=_0x208a5b['body'][_0xa2f4('0x56')];return db[_0xa2f4('0x57')][_0xa2f4('0x2a')]({'where':{'id':_0x306e75},'attributes':['id'],'include':[{'model':db[_0xa2f4('0x4a')],'as':_0xa2f4('0x58'),'attributes':['id',_0xa2f4('0x1d'),'online',_0xa2f4('0x59'),_0xa2f4('0x5a')],'raw':!![]}]})[_0xa2f4('0x17')](function(_0x5ee101){if(_0x5ee101){var _0x4222fb=_[_0xa2f4('0x5b')](_0x5ee101,function(_0x229aee){var _0x5b9999=_0x229aee[_0xa2f4('0x19')]({'plain':!![]});return _0x5b9999[_0xa2f4('0x58')];});return db['ChatQueue'][_0xa2f4('0x36')]({'where':{'id':_0x208a5b[_0xa2f4('0x2e')]['id']}})[_0xa2f4('0x17')](function(_0x57cb53){return db[_0xa2f4('0x5c')]['transaction'](function(_0x2b5106){return _0x57cb53[_0xa2f4('0x55')](_0x306e75,{'transaction':_0x2b5106})['then'](function(){return BPromise['each'](_0x4222fb,function(_0x1c4ac7){return db['UserChatQueue'][_0xa2f4('0x5d')]({'where':{'UserId':_0x1c4ac7['id'],'ChatQueueId':_0x208a5b[_0xa2f4('0x2e')]['id']},'transaction':_0x2b5106});});})[_0xa2f4('0x17')](function(){_0x4222fb[_0xa2f4('0x5e')](function(_0x58d784){socket[_0xa2f4('0x5f')]('userChatQueue:save',{'UserId':_0x58d784['id'],'ChatQueueId':_0x57cb53['id']});});});});});}})[_0xa2f4('0x17')](respondWithStatusCode(_0x1c37c0,null))[_0xa2f4('0x2c')](handleError(_0x1c37c0,null));};exports[_0xa2f4('0x60')]=function(_0x57494d,_0x2f913c){return db[_0xa2f4('0x57')][_0xa2f4('0x2a')]({'where':{'id':_0x57494d['query'][_0xa2f4('0x56')]},'attributes':['id'],'include':[{'model':db[_0xa2f4('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa2f4('0x17')](handleEntityNotFound(_0x2f913c,null))[_0xa2f4('0x17')](function(_0x26f5ec){var _0x1c6d5f=_[_0xa2f4('0x20')](_0x26f5ec,'id');var _0x47181e=[];var _0x210f99=[];var _0x193f11=squel['select']();_0x193f11[_0xa2f4('0x61')](_0xa2f4('0x62'))[_0xa2f4('0x63')](_0xa2f4('0x64'),'tq')['join'](_0xa2f4('0x65'),'ut',_0xa2f4('0x66'))[_0xa2f4('0x26')]('ChatQueueId\x20=\x20?',_0x57494d[_0xa2f4('0x2e')]['id']);for(var _0x539d28=0x0;_0x539d28<_0x26f5ec[_0xa2f4('0x33')];_0x539d28+=0x1){let _0x266b29=_0x26f5ec[_0x539d28];for(var _0x221db3=0x0;_0x221db3<_0x266b29['Agents'][_0xa2f4('0x33')];_0x221db3+=0x1){let _0x1772a1=_0x266b29['Agents'][_0x221db3];var _0x30e899=_0x193f11['clone']();_0x30e899[_0xa2f4('0x26')]('ut.UserId\x20=\x20?',_0x1772a1['id']);_0x210f99[_0xa2f4('0x67')](db['sequelize'][_0xa2f4('0x29')](_0x30e899[_0xa2f4('0x68')](),{'type':db[_0xa2f4('0x5c')]['QueryTypes'][_0xa2f4('0x69')]})[_0xa2f4('0x17')](function(_0x450ae5){if(_0x450ae5[_0xa2f4('0x33')]===0x1){return _0x1772a1['id'];}else{var _0x17b26f=_[_0xa2f4('0x6a')](_['map'](_0x450ae5,'TeamId'),function(_0x3ad792){return _[_0xa2f4('0x6b')](_0x1c6d5f,_0x3ad792);});if(_0x17b26f){return _0x1772a1['id'];}}}));}}return BPromise[_0xa2f4('0x6c')](_0x210f99)[_0xa2f4('0x17')](function(_0x5d0b69){_0x47181e=_(_0x47181e)[_0xa2f4('0x6d')](_0x5d0b69)[_0xa2f4('0x6e')]()[_0xa2f4('0x6f')]();return db['ChatQueue']['find']({'where':{'id':_0x57494d['params']['id']}})[_0xa2f4('0x17')](function(_0x40ef2b){return db[_0xa2f4('0x5c')]['transaction'](function(_0x41aec5){return _0x40ef2b[_0xa2f4('0x60')](_0x57494d[_0xa2f4('0x29')][_0xa2f4('0x56')],{'transaction':_0x41aec5})['then'](function(){if(!_[_0xa2f4('0x70')](_0x47181e)){return _0x40ef2b[_0xa2f4('0x71')](_0x47181e,{'transaction':_0x41aec5});}})[_0xa2f4('0x17')](function(){_0x47181e['forEach'](function(_0x3cb1e2){socket[_0xa2f4('0x5f')](_0xa2f4('0x72'),{'UserId':_0x3cb1e2,'ChatQueueId':_0x40ef2b['id']});});});});});});})[_0xa2f4('0x17')](respondWithStatusCode(_0x2f913c,null))['catch'](handleError(_0x2f913c,null));};exports[_0xa2f4('0x73')]=function(_0x5c42c6,_0x3ffa7a){return db['ChatQueue']['find']({'where':{'id':_0x5c42c6['params']['id']}})[_0xa2f4('0x17')](handleEntityNotFound(_0x3ffa7a,null))['then'](function(_0x259f14){if(_0x259f14){return _0x259f14['addAgents'](_0x5c42c6[_0xa2f4('0x38')][_0xa2f4('0x56')],_[_0xa2f4('0x74')](_0x5c42c6[_0xa2f4('0x38')],['ids','id'])||{})['spread'](function(_0x1727fe){for(var _0x417142=0x0;_0x417142<_0x5c42c6[_0xa2f4('0x38')]['ids'][_0xa2f4('0x33')];_0x417142+=0x1){socket[_0xa2f4('0x5f')](_0xa2f4('0x75'),{'UserId':Number(_0x5c42c6[_0xa2f4('0x38')][_0xa2f4('0x56')][_0x417142]),'ChatQueueId':Number(_0x5c42c6['params']['id'])});}return _0x1727fe;});}})[_0xa2f4('0x17')](respondWithResult(_0x3ffa7a,null))[_0xa2f4('0x2c')](handleError(_0x3ffa7a,null));};exports['removeAgents']=function(_0x273660,_0x5b9223){return db[_0xa2f4('0x27')][_0xa2f4('0x36')]({'where':{'id':_0x273660[_0xa2f4('0x2e')]['id']}})[_0xa2f4('0x17')](handleEntityNotFound(_0x5b9223,null))[_0xa2f4('0x17')](function(_0x1e83e0){if(_0x1e83e0){return _0x1e83e0['removeAgents'](_0x273660[_0xa2f4('0x29')][_0xa2f4('0x56')])[_0xa2f4('0x17')](function(){if(_[_0xa2f4('0x76')](_0x273660[_0xa2f4('0x29')]['ids'])){for(var _0x20ba23=0x0;_0x20ba23<_0x273660[_0xa2f4('0x29')][_0xa2f4('0x56')][_0xa2f4('0x33')];_0x20ba23+=0x1){socket[_0xa2f4('0x5f')](_0xa2f4('0x72'),{'UserId':Number(_0x273660['query'][_0xa2f4('0x56')][_0x20ba23]),'ChatQueueId':Number(_0x273660[_0xa2f4('0x2e')]['id'])});}}else{socket[_0xa2f4('0x5f')](_0xa2f4('0x72'),{'UserId':Number(_0x273660[_0xa2f4('0x29')]['ids']),'ChatQueueId':Number(_0x273660[_0xa2f4('0x2e')]['id'])});}});}})[_0xa2f4('0x17')](respondWithStatusCode(_0x5b9223,null))['catch'](handleError(_0x5b9223,null));};exports[_0xa2f4('0x77')]=function(_0x2b2971,_0x5ec331){var _0x871d2b={};var _0x1829b6={};var _0x76f82d;var _0x560d73;return db['ChatQueue'][_0xa2f4('0x53')]({'where':{'id':_0x2b2971['params']['id']}})[_0xa2f4('0x17')](handleEntityNotFound(_0x5ec331,null))['then'](function(_0x845768){if(_0x845768){_0x76f82d=_0x845768;_0x1829b6['model']=_[_0xa2f4('0x40')](db[_0xa2f4('0x4a')][_0xa2f4('0x21')]);_0x1829b6[_0xa2f4('0x29')]=_['keys'](_0x2b2971[_0xa2f4('0x29')]);_0x1829b6[_0xa2f4('0x41')]=_[_0xa2f4('0x30')](_0x1829b6['model'],_0x1829b6[_0xa2f4('0x29')]);_0x871d2b[_0xa2f4('0x31')]=_[_0xa2f4('0x30')](_0x1829b6['model'],qs[_0xa2f4('0x32')](_0x2b2971['query'][_0xa2f4('0x32')]));_0x871d2b['attributes']=_0x871d2b[_0xa2f4('0x31')]['length']?_0x871d2b['attributes']:_0x1829b6[_0xa2f4('0x2f')];_0x871d2b['order']=qs['sort'](_0x2b2971['query'][_0xa2f4('0x45')]);_0x871d2b[_0xa2f4('0x26')]=qs['filters'](_[_0xa2f4('0x54')](_0x2b2971[_0xa2f4('0x29')],_0x1829b6[_0xa2f4('0x41')]));if(_0x2b2971[_0xa2f4('0x29')][_0xa2f4('0x47')]){_0x871d2b[_0xa2f4('0x26')]=_['merge'](_0x871d2b[_0xa2f4('0x26')],{'$or':_[_0xa2f4('0x20')](_0x871d2b[_0xa2f4('0x31')],function(_0x4eb1c6){var _0x2b598d={};_0x2b598d[_0x4eb1c6]={'$like':'%'+_0x2b2971[_0xa2f4('0x29')][_0xa2f4('0x47')]+'%'};return _0x2b598d;})});}_0x871d2b=_[_0xa2f4('0x48')]({},_0x871d2b,_0x2b2971[_0xa2f4('0x35')]);return _0x76f82d['getAgents'](_0x871d2b);}})['then'](function(_0x528e8a){if(_0x528e8a){_0x560d73=_0x528e8a['length'];if(!_0x2b2971[_0xa2f4('0x29')][_0xa2f4('0x42')](_0xa2f4('0x43'))){_0x871d2b[_0xa2f4('0x11')]=qs[_0xa2f4('0x11')](_0x2b2971[_0xa2f4('0x29')]['limit']);_0x871d2b[_0xa2f4('0x14')]=qs['offset'](_0x2b2971[_0xa2f4('0x29')]['offset']);}return _0x76f82d['getAgents'](_0x871d2b);}})['then'](function(_0x353945){if(_0x353945){return _0x353945?{'count':_0x560d73,'rows':_0x353945}:null;}})[_0xa2f4('0x17')](respondWithResult(_0x5ec331,null))[_0xa2f4('0x2c')](handleError(_0x5ec331,null));}; \ No newline at end of file +var _0xf2d9=['select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','order','bluebird','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','update','then','get','ChatQueues','error','stack','name','index','map','ChatQueue','rawAttributes','type','key','getOptions','where','include','show','params','model','keys','query','filters','intersection','fields','attributes','length','merge','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','destroy','getMembers','UserChatQueue','hasOwnProperty','nolimit','sort','pick','ChatQueueId','filter','options','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','emit','userChatQueue:save','removeTeams'];(function(_0x13c1ac,_0x19325c){var _0x85cd90=function(_0x35861c){while(--_0x35861c){_0x13c1ac['push'](_0x13c1ac['shift']());}};_0x85cd90(++_0x19325c);}(_0xf2d9,0x17c));var _0x9f2d=function(_0x23d97c,_0x20d452){_0x23d97c=_0x23d97c-0x0;var _0x510fdd=_0xf2d9[_0x23d97c];return _0x510fdd;};'use strict';var BPromise=require(_0x9f2d('0x0'));var util=require(_0x9f2d('0x1'));var _=require('lodash');var squel=require(_0x9f2d('0x2'));var Redis=require(_0x9f2d('0x3'));var qs=require(_0x9f2d('0x4'));var logger=require('../../config/logger')(_0x9f2d('0x5'));var config=require(_0x9f2d('0x6'));var db=require(_0x9f2d('0x7'))['db'];config[_0x9f2d('0x8')]=_[_0x9f2d('0x9')](config[_0x9f2d('0x8')],{'host':_0x9f2d('0xa'),'port':0x18eb});var socket=require(_0x9f2d('0xb'))(new Redis(config[_0x9f2d('0x8')]));require(_0x9f2d('0xc'))[_0x9f2d('0xd')](socket);function respondWithStatusCode(_0x52ab0f,_0x216ae1){_0x216ae1=_0x216ae1||0xcc;return function(_0x26f244){if(_0x26f244){return _0x52ab0f[_0x9f2d('0xe')](_0x216ae1);}return _0x52ab0f[_0x9f2d('0xf')](_0x216ae1)[_0x9f2d('0x10')]();};}function respondWithResult(_0x312f6b,_0x451cfb){_0x451cfb=_0x451cfb||0xc8;return function(_0x32f752){if(_0x32f752){return _0x312f6b[_0x9f2d('0xf')](_0x451cfb)[_0x9f2d('0x11')](_0x32f752);}};}function respondWithFilteredResult(_0x5c2e8f,_0x3d3124){return function(_0x1a06e3){if(_0x1a06e3){var _0x15aa07=typeof _0x3d3124[_0x9f2d('0x12')]===_0x9f2d('0x13')&&typeof _0x3d3124['limit']===_0x9f2d('0x13');var _0x293bcc=_0x1a06e3[_0x9f2d('0x14')];var _0x4e1cb6=_0x15aa07?0x0:_0x3d3124['offset'];var _0x49bc3f=_0x15aa07?_0x1a06e3[_0x9f2d('0x14')]:_0x3d3124['offset']+_0x3d3124[_0x9f2d('0x15')];var _0x2dba24;if(_0x49bc3f>=_0x293bcc){_0x49bc3f=_0x293bcc;_0x2dba24=0xc8;}else{_0x2dba24=0xce;}_0x5c2e8f['status'](_0x2dba24);return _0x5c2e8f[_0x9f2d('0x16')]('Content-Range',_0x4e1cb6+'-'+_0x49bc3f+'/'+_0x293bcc)[_0x9f2d('0x11')](_0x1a06e3);}return null;};}function saveUpdates(_0x3375b2){return function(_0x5bd820){if(_0x5bd820){return _0x5bd820[_0x9f2d('0x17')](_0x3375b2)[_0x9f2d('0x18')](function(_0x56fc62){return _0x56fc62;});}return null;};}function removeEntity(_0x443419){return function(_0x4639b7){if(_0x4639b7){return _0x4639b7['destroy']()[_0x9f2d('0x18')](function(){var _0x4b09d3=_0x4639b7[_0x9f2d('0x19')]({'plain':!![]});var _0x48b647=_0x9f2d('0x1a');return db['UserProfileResource']['destroy']({'where':{'type':_0x48b647,'resourceId':_0x4b09d3['id']}})[_0x9f2d('0x18')](function(){return _0x4639b7;});})[_0x9f2d('0x18')](function(){_0x443419[_0x9f2d('0xf')](0xcc)[_0x9f2d('0x10')]();});}};}function handleEntityNotFound(_0x2c7008){return function(_0x22f715){if(!_0x22f715){_0x2c7008['sendStatus'](0x194);}return _0x22f715;};}function handleError(_0x419128,_0x205973){_0x205973=_0x205973||0x1f4;return function(_0x409fef){logger[_0x9f2d('0x1b')](_0x409fef[_0x9f2d('0x1c')]);if(_0x409fef['name']){delete _0x409fef[_0x9f2d('0x1d')];}_0x419128[_0x9f2d('0xf')](_0x205973)['send'](_0x409fef);};}exports[_0x9f2d('0x1e')]=function(_0x4be0d1,_0x109e85){var _0x1ccfb5={};var _0x510820={'count':0x0,'rows':[]};var _0x43a68f=_[_0x9f2d('0x1f')](db[_0x9f2d('0x20')][_0x9f2d('0x21')],function(_0x2d2736){return{'name':_0x2d2736['fieldName'],'type':_0x2d2736[_0x9f2d('0x22')][_0x9f2d('0x23')]};});_0x1ccfb5=qs[_0x9f2d('0x24')](_0x43a68f,_0x4be0d1);var _0x1d69bf={'where':_0x1ccfb5[_0x9f2d('0x25')]};return db[_0x9f2d('0x20')][_0x9f2d('0x14')](_0x1d69bf)[_0x9f2d('0x18')](function(_0x2d976c){_0x510820['count']=_0x2d976c;_0x1ccfb5[_0x9f2d('0x26')]=qs[_0x9f2d('0x26')](_0x4be0d1['query']);return db[_0x9f2d('0x20')]['findAll'](_0x1ccfb5);})[_0x9f2d('0x18')](function(_0x434193){_0x510820['rows']=_0x434193;return _0x510820;})[_0x9f2d('0x18')](respondWithFilteredResult(_0x109e85,_0x1ccfb5))['catch'](handleError(_0x109e85,null));};exports[_0x9f2d('0x27')]=function(_0x50da43,_0x3a3005){var _0x2323d4={'raw':!![],'where':{'id':_0x50da43[_0x9f2d('0x28')]['id']}},_0x38f17b={};_0x38f17b[_0x9f2d('0x29')]=_[_0x9f2d('0x2a')](db['ChatQueue']['rawAttributes']);_0x38f17b['query']=_[_0x9f2d('0x2a')](_0x50da43[_0x9f2d('0x2b')]);_0x38f17b[_0x9f2d('0x2c')]=_[_0x9f2d('0x2d')](_0x38f17b[_0x9f2d('0x29')],_0x38f17b[_0x9f2d('0x2b')]);_0x2323d4['attributes']=_[_0x9f2d('0x2d')](_0x38f17b[_0x9f2d('0x29')],qs['fields'](_0x50da43['query'][_0x9f2d('0x2e')]));_0x2323d4[_0x9f2d('0x2f')]=_0x2323d4[_0x9f2d('0x2f')][_0x9f2d('0x30')]?_0x2323d4[_0x9f2d('0x2f')]:_0x38f17b[_0x9f2d('0x29')];if(_0x50da43[_0x9f2d('0x2b')]['includeAll']){_0x2323d4[_0x9f2d('0x26')]=[{'all':!![]}];}_0x2323d4=_[_0x9f2d('0x31')]({},_0x2323d4,_0x50da43['options']);return db['ChatQueue'][_0x9f2d('0x32')](_0x2323d4)['then'](handleEntityNotFound(_0x3a3005,null))[_0x9f2d('0x18')](respondWithResult(_0x3a3005,null))[_0x9f2d('0x33')](handleError(_0x3a3005,null));};exports[_0x9f2d('0x34')]=function(_0x4683fd,_0x3db017){return db[_0x9f2d('0x20')][_0x9f2d('0x34')](_0x4683fd[_0x9f2d('0x35')],{})[_0x9f2d('0x18')](function(_0x2e65a8){var _0x28c1aa=_0x4683fd[_0x9f2d('0x36')]['get']({'plain':!![]});if(!_0x28c1aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28c1aa[_0x9f2d('0x37')]===_0x9f2d('0x36')){var _0x15888d=_0x2e65a8[_0x9f2d('0x19')]({'plain':!![]});var _0x1d20c7=_0x9f2d('0x1a');return db[_0x9f2d('0x38')]['find']({'where':{'name':_0x1d20c7,'userProfileId':_0x28c1aa[_0x9f2d('0x39')]},'raw':!![]})[_0x9f2d('0x18')](function(_0x5020b6){if(_0x5020b6&&_0x5020b6[_0x9f2d('0x3a')]===0x0){return db[_0x9f2d('0x3b')][_0x9f2d('0x34')]({'name':_0x15888d['name'],'resourceId':_0x15888d['id'],'type':_0x5020b6[_0x9f2d('0x1d')],'sectionId':_0x5020b6['id']},{})[_0x9f2d('0x18')](function(){return _0x2e65a8;});}else{return _0x2e65a8;}})['catch'](function(_0x2b8e20){logger[_0x9f2d('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b8e20);throw _0x2b8e20;});}return _0x2e65a8;})[_0x9f2d('0x18')](respondWithResult(_0x3db017,0xc9))[_0x9f2d('0x33')](handleError(_0x3db017,null));};exports['update']=function(_0x17f8f4,_0x23bea5){if(_0x17f8f4[_0x9f2d('0x35')]['id']){delete _0x17f8f4[_0x9f2d('0x35')]['id'];}return db[_0x9f2d('0x20')][_0x9f2d('0x32')]({'where':{'id':_0x17f8f4[_0x9f2d('0x28')]['id']}})[_0x9f2d('0x18')](handleEntityNotFound(_0x23bea5,null))[_0x9f2d('0x18')](saveUpdates(_0x17f8f4['body'],null))[_0x9f2d('0x18')](respondWithResult(_0x23bea5,null))['catch'](handleError(_0x23bea5,null));};exports[_0x9f2d('0x3c')]=function(_0x511ac0,_0x569331){return db[_0x9f2d('0x20')]['find']({'where':{'id':_0x511ac0['params']['id']}})[_0x9f2d('0x18')](handleEntityNotFound(_0x569331,null))[_0x9f2d('0x18')](removeEntity(_0x569331,null))[_0x9f2d('0x33')](handleError(_0x569331,null));};exports['describe']=function(_0xe90b0a,_0x1e3e24){return db[_0x9f2d('0x20')]['describe']()['then'](respondWithResult(_0x1e3e24,null))[_0x9f2d('0x33')](handleError(_0x1e3e24,null));};exports[_0x9f2d('0x3d')]=function(_0xb533bd,_0x5a3c52){var _0x3a2fa9={'raw':!![],'where':{}},_0x4adbff={},_0x3eb373;return db[_0x9f2d('0x20')]['findOne']({'where':{'id':_0xb533bd[_0x9f2d('0x28')]['id']}})[_0x9f2d('0x18')](handleEntityNotFound(_0x5a3c52,null))[_0x9f2d('0x18')](function(_0x274b95){if(_0x274b95){_0x3eb373=_0x274b95[_0x9f2d('0x19')]({'plain':!![]});_0x4adbff[_0x9f2d('0x29')]=_[_0x9f2d('0x2a')](db[_0x9f2d('0x3e')][_0x9f2d('0x21')]);_0x4adbff[_0x9f2d('0x2b')]=_[_0x9f2d('0x2a')](_0xb533bd['query']);_0x4adbff[_0x9f2d('0x2c')]=_[_0x9f2d('0x2d')](_0x4adbff[_0x9f2d('0x29')],_0x4adbff[_0x9f2d('0x2b')]);_0x3a2fa9[_0x9f2d('0x2f')]=_[_0x9f2d('0x2d')](_0x4adbff[_0x9f2d('0x29')],qs[_0x9f2d('0x2e')](_0xb533bd[_0x9f2d('0x2b')][_0x9f2d('0x2e')]));_0x3a2fa9[_0x9f2d('0x2f')]=_0x3a2fa9[_0x9f2d('0x2f')][_0x9f2d('0x30')]?_0x3a2fa9[_0x9f2d('0x2f')]:_0x4adbff[_0x9f2d('0x29')];if(!_0xb533bd[_0x9f2d('0x2b')][_0x9f2d('0x3f')](_0x9f2d('0x40'))){_0x3a2fa9[_0x9f2d('0x15')]=qs[_0x9f2d('0x15')](_0xb533bd[_0x9f2d('0x2b')][_0x9f2d('0x15')]);_0x3a2fa9[_0x9f2d('0x12')]=qs['offset'](_0xb533bd[_0x9f2d('0x2b')][_0x9f2d('0x12')]);}_0x3a2fa9['order']=qs[_0x9f2d('0x41')](_0xb533bd[_0x9f2d('0x2b')][_0x9f2d('0x41')]);_0x3a2fa9[_0x9f2d('0x25')]=qs[_0x9f2d('0x2c')](_[_0x9f2d('0x42')](_0xb533bd['query'],_0x4adbff['filters']));_0x3a2fa9[_0x9f2d('0x25')][_0x9f2d('0x43')]=_0x274b95['id'];if(_0xb533bd[_0x9f2d('0x2b')][_0x9f2d('0x44')]){_0x3a2fa9[_0x9f2d('0x25')]=_[_0x9f2d('0x31')](_0x3a2fa9['where'],{'$or':_[_0x9f2d('0x1f')](_0x3a2fa9[_0x9f2d('0x2f')],function(_0x44bf3e){var _0x4687e9={};_0x4687e9[_0x44bf3e]={'$like':'%'+_0xb533bd['query'][_0x9f2d('0x44')]+'%'};return _0x4687e9;})});}_0x3a2fa9=_['merge']({},_0x3a2fa9,_0xb533bd[_0x9f2d('0x45')]);return db[_0x9f2d('0x3e')][_0x9f2d('0x46')](_0x3a2fa9);}})[_0x9f2d('0x18')](function(_0x2afa03){if(_0x2afa03){return db[_0x9f2d('0x47')][_0x9f2d('0x48')]({'where':{'id':_[_0x9f2d('0x1f')](_0x2afa03,_0x9f2d('0x49')),'role':_0x9f2d('0x4a')},'attributes':['id','name',_0x9f2d('0x4b'),_0x9f2d('0x4c'),_0x9f2d('0x4d')]});}})[_0x9f2d('0x18')](function(_0x85814d){if(_0x85814d){return{'count':_0x85814d[_0x9f2d('0x14')],'rows':_[_0x9f2d('0x1f')](_0x85814d['rows'],function(_0x4c4dc7){return{'membername':_0x4c4dc7[_0x9f2d('0x1d')],'UserId':_0x4c4dc7['id'],'queue_name':_0x3eb373['name'],'ChatQueueId':_0x3eb373['id'],'interface':util[_0x9f2d('0x4e')](_0x9f2d('0x4f'),_0x9f2d('0x50'),_0x4c4dc7[_0x9f2d('0x1d')]),'penalty':0x0,'paused':_0x4c4dc7[_0x9f2d('0x4b')],'createdAt':_0x4c4dc7[_0x9f2d('0x4d')],'updatedAt':_0x4c4dc7[_0x9f2d('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9f2d('0x18')](respondWithFilteredResult(_0x5a3c52,_0x3a2fa9))['catch'](handleError(_0x5a3c52,null));};exports['getTeams']=function(_0x4a615b,_0x36bd8a){var _0x38e3b6={};var _0x369f78={};var _0x5b9d88;var _0x57cd22;return db['ChatQueue'][_0x9f2d('0x51')]({'where':{'id':_0x4a615b[_0x9f2d('0x28')]['id']}})['then'](handleEntityNotFound(_0x36bd8a,null))[_0x9f2d('0x18')](function(_0x4ad11c){if(_0x4ad11c){_0x5b9d88=_0x4ad11c;_0x369f78[_0x9f2d('0x29')]=_[_0x9f2d('0x2a')](db[_0x9f2d('0x52')]['rawAttributes']);_0x369f78['query']=_[_0x9f2d('0x2a')](_0x4a615b[_0x9f2d('0x2b')]);_0x369f78[_0x9f2d('0x2c')]=_[_0x9f2d('0x2d')](_0x369f78[_0x9f2d('0x29')],_0x369f78['query']);_0x38e3b6[_0x9f2d('0x2f')]=_[_0x9f2d('0x2d')](_0x369f78[_0x9f2d('0x29')],qs[_0x9f2d('0x2e')](_0x4a615b[_0x9f2d('0x2b')][_0x9f2d('0x2e')]));_0x38e3b6['attributes']=_0x38e3b6['attributes']['length']?_0x38e3b6[_0x9f2d('0x2f')]:_0x369f78['model'];_0x38e3b6['order']=qs[_0x9f2d('0x41')](_0x4a615b[_0x9f2d('0x2b')][_0x9f2d('0x41')]);_0x38e3b6[_0x9f2d('0x25')]=qs[_0x9f2d('0x2c')](_[_0x9f2d('0x42')](_0x4a615b['query'],_0x369f78[_0x9f2d('0x2c')]));if(_0x4a615b[_0x9f2d('0x2b')][_0x9f2d('0x44')]){_0x38e3b6[_0x9f2d('0x25')]=_[_0x9f2d('0x31')](_0x38e3b6[_0x9f2d('0x25')],{'$or':_['map'](_0x38e3b6[_0x9f2d('0x2f')],function(_0x26ceca){var _0x2e8e22={};_0x2e8e22[_0x26ceca]={'$like':'%'+_0x4a615b[_0x9f2d('0x2b')][_0x9f2d('0x44')]+'%'};return _0x2e8e22;})});}_0x38e3b6=_[_0x9f2d('0x31')]({},_0x38e3b6,_0x4a615b[_0x9f2d('0x45')]);return _0x5b9d88['getTeams'](_0x38e3b6);}})[_0x9f2d('0x18')](function(_0x3cae0e){if(_0x3cae0e){_0x57cd22=_0x3cae0e[_0x9f2d('0x30')];if(!_0x4a615b[_0x9f2d('0x2b')][_0x9f2d('0x3f')](_0x9f2d('0x40'))){_0x38e3b6['limit']=qs[_0x9f2d('0x15')](_0x4a615b[_0x9f2d('0x2b')][_0x9f2d('0x15')]);_0x38e3b6[_0x9f2d('0x12')]=qs[_0x9f2d('0x12')](_0x4a615b['query'][_0x9f2d('0x12')]);}return _0x5b9d88['getTeams'](_0x38e3b6);}})[_0x9f2d('0x18')](function(_0x3b39fa){if(_0x3b39fa){return _0x3b39fa?{'count':_0x57cd22,'rows':_0x3b39fa}:null;}})[_0x9f2d('0x18')](respondWithResult(_0x36bd8a,null))['catch'](handleError(_0x36bd8a,null));};exports[_0x9f2d('0x53')]=function(_0x1a99e2,_0x3f8195){var _0x274672=_0x1a99e2[_0x9f2d('0x35')][_0x9f2d('0x54')];return db[_0x9f2d('0x52')]['findAll']({'where':{'id':_0x274672},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9f2d('0x55'),'attributes':['id',_0x9f2d('0x1d'),_0x9f2d('0x56'),_0x9f2d('0x57'),'interface'],'raw':!![]}]})[_0x9f2d('0x18')](function(_0x328c98){if(_0x328c98){var _0x135930=_[_0x9f2d('0x58')](_0x328c98,function(_0x51de04){var _0x1fd719=_0x51de04[_0x9f2d('0x19')]({'plain':!![]});return _0x1fd719[_0x9f2d('0x55')];});return db[_0x9f2d('0x20')]['find']({'where':{'id':_0x1a99e2[_0x9f2d('0x28')]['id']}})[_0x9f2d('0x18')](function(_0x43c8d2){return db[_0x9f2d('0x59')][_0x9f2d('0x5a')](function(_0x38c3c3){return _0x43c8d2[_0x9f2d('0x53')](_0x274672,{'transaction':_0x38c3c3})[_0x9f2d('0x18')](function(){return BPromise[_0x9f2d('0x5b')](_0x135930,function(_0x30d0b1){return db[_0x9f2d('0x3e')]['findOrCreate']({'where':{'UserId':_0x30d0b1['id'],'ChatQueueId':_0x1a99e2[_0x9f2d('0x28')]['id']},'transaction':_0x38c3c3});});})[_0x9f2d('0x18')](function(){_0x135930[_0x9f2d('0x5c')](function(_0x117a52){socket[_0x9f2d('0x5d')](_0x9f2d('0x5e'),{'UserId':_0x117a52['id'],'ChatQueueId':_0x43c8d2['id']});});});});});}})['then'](respondWithStatusCode(_0x3f8195,null))[_0x9f2d('0x33')](handleError(_0x3f8195,null));};exports[_0x9f2d('0x5f')]=function(_0x587ee9,_0x3e654e){return db[_0x9f2d('0x52')][_0x9f2d('0x46')]({'where':{'id':_0x587ee9[_0x9f2d('0x2b')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9f2d('0x55'),'attributes':['id'],'raw':!![]}]})[_0x9f2d('0x18')](handleEntityNotFound(_0x3e654e,null))[_0x9f2d('0x18')](function(_0x1df143){var _0x1de1d5=_['map'](_0x1df143,'id');var _0x50449a=[];var _0x333870=[];var _0x325a38=squel[_0x9f2d('0x60')]();_0x325a38[_0x9f2d('0x61')](_0x9f2d('0x62'))['from'](_0x9f2d('0x63'),'tq')[_0x9f2d('0x64')](_0x9f2d('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x9f2d('0x66'),_0x587ee9['params']['id']);for(var _0xf7427a=0x0;_0xf7427a<_0x1df143[_0x9f2d('0x30')];_0xf7427a+=0x1){let _0x2ec18f=_0x1df143[_0xf7427a];for(var _0x2b6450=0x0;_0x2b6450<_0x2ec18f[_0x9f2d('0x55')][_0x9f2d('0x30')];_0x2b6450+=0x1){let _0x4f7875=_0x2ec18f[_0x9f2d('0x55')][_0x2b6450];var _0x552b3e=_0x325a38['clone']();_0x552b3e[_0x9f2d('0x25')](_0x9f2d('0x67'),_0x4f7875['id']);_0x333870['push'](db[_0x9f2d('0x59')][_0x9f2d('0x2b')](_0x552b3e[_0x9f2d('0x68')](),{'type':db['sequelize'][_0x9f2d('0x69')][_0x9f2d('0x6a')]})[_0x9f2d('0x18')](function(_0x52d9f1){if(_0x52d9f1[_0x9f2d('0x30')]===0x1){return _0x4f7875['id'];}else{var _0x10e333=_[_0x9f2d('0x6b')](_['map'](_0x52d9f1,_0x9f2d('0x6c')),function(_0xa2564f){return _['includes'](_0x1de1d5,_0xa2564f);});if(_0x10e333){return _0x4f7875['id'];}}}));}}return BPromise[_0x9f2d('0x6d')](_0x333870)[_0x9f2d('0x18')](function(_0x57cf5b){_0x50449a=_(_0x50449a)['union'](_0x57cf5b)[_0x9f2d('0x6e')]()['value']();return db[_0x9f2d('0x20')]['find']({'where':{'id':_0x587ee9[_0x9f2d('0x28')]['id']}})[_0x9f2d('0x18')](function(_0x425629){return db[_0x9f2d('0x59')][_0x9f2d('0x5a')](function(_0x1ef5e2){return _0x425629[_0x9f2d('0x5f')](_0x587ee9[_0x9f2d('0x2b')][_0x9f2d('0x54')],{'transaction':_0x1ef5e2})['then'](function(){if(!_['isEmpty'](_0x50449a)){return _0x425629[_0x9f2d('0x6f')](_0x50449a,{'transaction':_0x1ef5e2});}})[_0x9f2d('0x18')](function(){_0x50449a[_0x9f2d('0x5c')](function(_0x4f6aa5){socket[_0x9f2d('0x5d')](_0x9f2d('0x70'),{'UserId':_0x4f6aa5,'ChatQueueId':_0x425629['id']});});});});});});})['then'](respondWithStatusCode(_0x3e654e,null))[_0x9f2d('0x33')](handleError(_0x3e654e,null));};exports[_0x9f2d('0x71')]=function(_0x1116a7,_0x56a060){return db['ChatQueue'][_0x9f2d('0x32')]({'where':{'id':_0x1116a7[_0x9f2d('0x28')]['id']}})['then'](handleEntityNotFound(_0x56a060,null))[_0x9f2d('0x18')](function(_0x548926){if(_0x548926){return _0x548926[_0x9f2d('0x71')](_0x1116a7[_0x9f2d('0x35')][_0x9f2d('0x54')],_[_0x9f2d('0x72')](_0x1116a7[_0x9f2d('0x35')],[_0x9f2d('0x54'),'id'])||{})[_0x9f2d('0x73')](function(_0x250e60){for(var _0x2094bc=0x0;_0x2094bc<_0x1116a7[_0x9f2d('0x35')][_0x9f2d('0x54')][_0x9f2d('0x30')];_0x2094bc+=0x1){socket[_0x9f2d('0x5d')](_0x9f2d('0x5e'),{'UserId':Number(_0x1116a7[_0x9f2d('0x35')][_0x9f2d('0x54')][_0x2094bc]),'ChatQueueId':Number(_0x1116a7[_0x9f2d('0x28')]['id'])});}return _0x250e60;});}})[_0x9f2d('0x18')](respondWithResult(_0x56a060,null))[_0x9f2d('0x33')](handleError(_0x56a060,null));};exports[_0x9f2d('0x6f')]=function(_0x23a16b,_0xe53192){return db[_0x9f2d('0x20')]['find']({'where':{'id':_0x23a16b['params']['id']}})[_0x9f2d('0x18')](handleEntityNotFound(_0xe53192,null))[_0x9f2d('0x18')](function(_0x387f04){if(_0x387f04){return _0x387f04[_0x9f2d('0x6f')](_0x23a16b[_0x9f2d('0x2b')][_0x9f2d('0x54')])['then'](function(){if(_[_0x9f2d('0x74')](_0x23a16b['query'][_0x9f2d('0x54')])){for(var _0x2ae343=0x0;_0x2ae343<_0x23a16b[_0x9f2d('0x2b')]['ids']['length'];_0x2ae343+=0x1){socket['emit'](_0x9f2d('0x70'),{'UserId':Number(_0x23a16b[_0x9f2d('0x2b')][_0x9f2d('0x54')][_0x2ae343]),'ChatQueueId':Number(_0x23a16b['params']['id'])});}}else{socket[_0x9f2d('0x5d')](_0x9f2d('0x70'),{'UserId':Number(_0x23a16b[_0x9f2d('0x2b')]['ids']),'ChatQueueId':Number(_0x23a16b[_0x9f2d('0x28')]['id'])});}});}})[_0x9f2d('0x18')](respondWithStatusCode(_0xe53192,null))[_0x9f2d('0x33')](handleError(_0xe53192,null));};exports[_0x9f2d('0x75')]=function(_0x23df95,_0x20daa9){var _0x3e9498={};var _0x36a326={};var _0x352982;var _0x36f63a;return db[_0x9f2d('0x20')][_0x9f2d('0x51')]({'where':{'id':_0x23df95[_0x9f2d('0x28')]['id']}})[_0x9f2d('0x18')](handleEntityNotFound(_0x20daa9,null))[_0x9f2d('0x18')](function(_0x4a366d){if(_0x4a366d){_0x352982=_0x4a366d;_0x36a326[_0x9f2d('0x29')]=_[_0x9f2d('0x2a')](db['User'][_0x9f2d('0x21')]);_0x36a326['query']=_['keys'](_0x23df95[_0x9f2d('0x2b')]);_0x36a326[_0x9f2d('0x2c')]=_[_0x9f2d('0x2d')](_0x36a326[_0x9f2d('0x29')],_0x36a326['query']);_0x3e9498[_0x9f2d('0x2f')]=_[_0x9f2d('0x2d')](_0x36a326['model'],qs['fields'](_0x23df95[_0x9f2d('0x2b')][_0x9f2d('0x2e')]));_0x3e9498[_0x9f2d('0x2f')]=_0x3e9498[_0x9f2d('0x2f')]['length']?_0x3e9498[_0x9f2d('0x2f')]:_0x36a326[_0x9f2d('0x29')];_0x3e9498[_0x9f2d('0x76')]=qs[_0x9f2d('0x41')](_0x23df95[_0x9f2d('0x2b')][_0x9f2d('0x41')]);_0x3e9498[_0x9f2d('0x25')]=qs[_0x9f2d('0x2c')](_[_0x9f2d('0x42')](_0x23df95[_0x9f2d('0x2b')],_0x36a326[_0x9f2d('0x2c')]));if(_0x23df95[_0x9f2d('0x2b')][_0x9f2d('0x44')]){_0x3e9498[_0x9f2d('0x25')]=_[_0x9f2d('0x31')](_0x3e9498[_0x9f2d('0x25')],{'$or':_[_0x9f2d('0x1f')](_0x3e9498[_0x9f2d('0x2f')],function(_0x35f2e8){var _0x55a17c={};_0x55a17c[_0x35f2e8]={'$like':'%'+_0x23df95[_0x9f2d('0x2b')][_0x9f2d('0x44')]+'%'};return _0x55a17c;})});}_0x3e9498=_[_0x9f2d('0x31')]({},_0x3e9498,_0x23df95['options']);return _0x352982[_0x9f2d('0x75')](_0x3e9498);}})['then'](function(_0x667607){if(_0x667607){_0x36f63a=_0x667607[_0x9f2d('0x30')];if(!_0x23df95[_0x9f2d('0x2b')]['hasOwnProperty']('nolimit')){_0x3e9498[_0x9f2d('0x15')]=qs[_0x9f2d('0x15')](_0x23df95[_0x9f2d('0x2b')][_0x9f2d('0x15')]);_0x3e9498[_0x9f2d('0x12')]=qs[_0x9f2d('0x12')](_0x23df95[_0x9f2d('0x2b')][_0x9f2d('0x12')]);}return _0x352982[_0x9f2d('0x75')](_0x3e9498);}})[_0x9f2d('0x18')](function(_0xc3e31a){if(_0xc3e31a){return _0xc3e31a?{'count':_0x36f63a,'rows':_0xc3e31a}:null;}})[_0x9f2d('0x18')](respondWithResult(_0x20daa9,null))[_0x9f2d('0x33')](handleError(_0x20daa9,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 6c9c2bd..acf059c 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 _0x9959=['hasOwnProperty','hook','events','ChatQueue','save','remove','emit'];(function(_0x49d744,_0x56323a){var _0xeef931=function(_0x30c8bc){while(--_0x30c8bc){_0x49d744['push'](_0x49d744['shift']());}};_0xeef931(++_0x56323a);}(_0x9959,0x1c2));var _0x9995=function(_0x423aa2,_0x2f3be3){_0x423aa2=_0x423aa2-0x0;var _0x4953fa=_0x9959[_0x423aa2];return _0x4953fa;};'use strict';var EventEmitter=require(_0x9995('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x9995('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9995('0x2'),'afterUpdate':'update','afterDestroy':_0x9995('0x3')};function emitEvent(_0x34fadd){return function(_0x4aeb64,_0x20e0f7,_0x486730){ChatQueueEvents[_0x9995('0x4')](_0x34fadd+':'+_0x4aeb64['id'],_0x4aeb64);ChatQueueEvents[_0x9995('0x4')](_0x34fadd,_0x4aeb64);_0x486730(null);};}for(var e in events){if(events[_0x9995('0x5')](e)){var event=events[e];ChatQueue[_0x9995('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x279d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','remove'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x279d,0x1d8));var _0xd279=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x279d[_0x369151];return _0x4292d5;};'use strict';var EventEmitter=require(_0xd279('0x0'));var ChatQueue=require(_0xd279('0x1'))['db'][_0xd279('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd279('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd279('0x4')};function emitEvent(_0x44441d){return function(_0x47cfee,_0x15d034,_0x2a9e8c){ChatQueueEvents[_0xd279('0x5')](_0x44441d+':'+_0x47cfee['id'],_0x47cfee);ChatQueueEvents[_0xd279('0x5')](_0x44441d,_0x47cfee);_0x2a9e8c(null);};}for(var e in events){if(events[_0xd279('0x6')](e)){var event=events[e];ChatQueue[_0xd279('0x7')](e,emitEvent(event));}}module[_0xd279('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 ff9362a..47951f4 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 _0x3a21=['path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24c7f7,_0x2bb77a){var _0x25604f=function(_0x418d16){while(--_0x418d16){_0x24c7f7['push'](_0x24c7f7['shift']());}};_0x25604f(++_0x2bb77a);}(_0x3a21,0x112));var _0x13a2=function(_0x2dd514,_0x4dc961){_0x2dd514=_0x2dd514-0x0;var _0x185a5f=_0x3a21[_0x2dd514];return _0x185a5f;};'use strict';var _=require(_0x13a2('0x0'));var util=require('util');var logger=require(_0x13a2('0x1'))(_0x13a2('0x2'));var moment=require(_0x13a2('0x3'));var BPromise=require(_0x13a2('0x4'));var rp=require(_0x13a2('0x5'));var fs=require('fs');var path=require(_0x13a2('0x6'));var rimraf=require(_0x13a2('0x7'));var config=require(_0x13a2('0x8'));var attributes=require(_0x13a2('0x9'));module[_0x13a2('0xa')]=function(_0x4a5d9a,_0x2d4def){return _0x4a5d9a[_0x13a2('0xb')](_0x13a2('0xc'),attributes,{'tableName':_0x13a2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa787=['./chatQueue.attributes','exports','define','ChatQueue','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x167dc,_0x2e5bf3){var _0x30bbbb=function(_0x3384a5){while(--_0x3384a5){_0x167dc['push'](_0x167dc['shift']());}};_0x30bbbb(++_0x2e5bf3);}(_0xa787,0x19b));var _0x7a78=function(_0x3326f3,_0x27919d){_0x3326f3=_0x3326f3-0x0;var _0x3fc066=_0xa787[_0x3326f3];return _0x3fc066;};'use strict';var _=require('lodash');var util=require(_0x7a78('0x0'));var logger=require(_0x7a78('0x1'))('api');var moment=require(_0x7a78('0x2'));var BPromise=require(_0x7a78('0x3'));var rp=require(_0x7a78('0x4'));var fs=require('fs');var path=require(_0x7a78('0x5'));var rimraf=require(_0x7a78('0x6'));var config=require('../../config/environment');var attributes=require(_0x7a78('0x7'));module[_0x7a78('0x8')]=function(_0x3ac7c5,_0x10d563){return _0x3ac7c5[_0x7a78('0x9')](_0x7a78('0xa'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 23b07c5..7da80fa 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 _0xc1bd=['options','raw','where','limit','map','include','model','attributes','ShowChatQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetChatQueue','ChatQueue','findAll'];(function(_0x3e3f62,_0x2d53bb){var _0x1debd7=function(_0x5cc1d8){while(--_0x5cc1d8){_0x3e3f62['push'](_0x3e3f62['shift']());}};_0x1debd7(++_0x2d53bb);}(_0xc1bd,0xd2));var _0xdc1b=function(_0x24f387,_0x13d380){_0x24f387=_0x24f387-0x0;var _0x160b4c=_0xc1bd[_0x24f387];return _0x160b4c;};'use strict';var _=require('lodash');var util=require(_0xdc1b('0x0'));var moment=require(_0xdc1b('0x1'));var BPromise=require(_0xdc1b('0x2'));var rs=require(_0xdc1b('0x3'));var fs=require('fs');var Redis=require(_0xdc1b('0x4'));var db=require(_0xdc1b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc1b('0x6'))(_0xdc1b('0x7'));var config=require('../../config/environment');var jayson=require(_0xdc1b('0x8'));var client=jayson[_0xdc1b('0x9')][_0xdc1b('0xa')]({'port':0x232a});config['redis']=_[_0xdc1b('0xb')](config[_0xdc1b('0xc')],{'host':_0xdc1b('0xd'),'port':0x18eb});var socket=require(_0xdc1b('0xe'))(new Redis(config[_0xdc1b('0xc')]));require('./chatQueue.socket')[_0xdc1b('0xf')](socket);function respondWithRpcPromise(_0x371699,_0xfdd9e9,_0x3ff980){return new BPromise(function(_0x52d17c,_0x112d8b){return client['request'](_0x371699,_0x3ff980)[_0xdc1b('0x10')](function(_0x3ab1c2){logger[_0xdc1b('0x11')](_0xdc1b('0x12'),_0xfdd9e9,'request\x20sent');logger[_0xdc1b('0x13')](_0xdc1b('0x14'),_0xfdd9e9,_0xdc1b('0x15'),JSON[_0xdc1b('0x16')](_0x3ab1c2));if(_0x3ab1c2[_0xdc1b('0x17')]){if(_0x3ab1c2[_0xdc1b('0x17')]['code']===0x1f4){logger[_0xdc1b('0x17')](_0xdc1b('0x12'),_0xfdd9e9,_0x3ab1c2['error']['message']);return _0x112d8b(_0x3ab1c2[_0xdc1b('0x17')][_0xdc1b('0x18')]);}logger['error'](_0xdc1b('0x12'),_0xfdd9e9,_0x3ab1c2[_0xdc1b('0x17')][_0xdc1b('0x18')]);return _0x52d17c(_0x3ab1c2[_0xdc1b('0x17')][_0xdc1b('0x18')]);}else{logger[_0xdc1b('0x11')]('ChatQueue,\x20%s,\x20%s',_0xfdd9e9,_0xdc1b('0x15'));_0x52d17c(_0x3ab1c2[_0xdc1b('0x19')][_0xdc1b('0x18')]);}})[_0xdc1b('0x1a')](function(_0x54598c){logger[_0xdc1b('0x17')](_0xdc1b('0x12'),_0xfdd9e9,_0x54598c);_0x112d8b(_0x54598c);});});}exports[_0xdc1b('0x1b')]=function(_0x5a6c91){var _0x4d8d41=this;return new Promise(function(_0x5ad463,_0x4d71e2){return db[_0xdc1b('0x1c')][_0xdc1b('0x1d')]({'raw':_0x5a6c91[_0xdc1b('0x1e')]?_0x5a6c91['options'][_0xdc1b('0x1f')]===undefined?!![]:![]:!![],'where':_0x5a6c91[_0xdc1b('0x1e')]?_0x5a6c91['options'][_0xdc1b('0x20')]||null:null,'attributes':_0x5a6c91['options']?_0x5a6c91['options']['attributes']||null:null,'limit':_0x5a6c91[_0xdc1b('0x1e')]?_0x5a6c91[_0xdc1b('0x1e')][_0xdc1b('0x21')]||null:null,'include':_0x5a6c91[_0xdc1b('0x1e')]?_0x5a6c91[_0xdc1b('0x1e')]['include']?_[_0xdc1b('0x22')](_0x5a6c91[_0xdc1b('0x1e')][_0xdc1b('0x23')],function(_0x36ab40){return{'model':db[_0x36ab40[_0xdc1b('0x24')]],'as':_0x36ab40['as'],'attributes':_0x36ab40[_0xdc1b('0x25')],'include':_0x36ab40[_0xdc1b('0x23')]?_[_0xdc1b('0x22')](_0x36ab40['include'],function(_0x48728d){return{'model':db[_0x48728d[_0xdc1b('0x24')]],'as':_0x48728d['as'],'attributes':_0x48728d[_0xdc1b('0x25')],'include':_0x48728d[_0xdc1b('0x23')]?_[_0xdc1b('0x22')](_0x48728d[_0xdc1b('0x23')],function(_0x3163c2){return{'model':db[_0x3163c2[_0xdc1b('0x24')]],'as':_0x3163c2['as'],'attributes':_0x3163c2[_0xdc1b('0x25')]};}):[]};}):[]};}):[]:[]})[_0xdc1b('0x10')](function(_0x2e976f){logger[_0xdc1b('0x11')](_0xdc1b('0x1b'),_0x5a6c91);logger[_0xdc1b('0x13')](_0xdc1b('0x1b'),_0x5a6c91,JSON[_0xdc1b('0x16')](_0x2e976f));_0x5ad463(_0x2e976f);})[_0xdc1b('0x1a')](function(_0x4532d6){logger[_0xdc1b('0x17')]('GetChatQueue',_0x4532d6[_0xdc1b('0x18')],_0x5a6c91);_0x4d71e2(_0x4d8d41[_0xdc1b('0x17')](0x1f4,_0x4532d6[_0xdc1b('0x18')]));});});};exports[_0xdc1b('0x26')]=function(_0x21a498){var _0x22290f=this;return new Promise(function(_0x2efc3d,_0x2f6bb3){return db[_0xdc1b('0x1c')][_0xdc1b('0x27')]({'raw':_0x21a498[_0xdc1b('0x1e')]?_0x21a498[_0xdc1b('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x21a498[_0xdc1b('0x1e')]?_0x21a498[_0xdc1b('0x1e')]['where']||null:null,'attributes':_0x21a498[_0xdc1b('0x1e')]?_0x21a498[_0xdc1b('0x1e')][_0xdc1b('0x25')]||null:null,'include':_0x21a498[_0xdc1b('0x1e')]?_0x21a498['options']['include']?_[_0xdc1b('0x22')](_0x21a498[_0xdc1b('0x1e')][_0xdc1b('0x23')],function(_0x1a71af){return{'model':db[_0x1a71af['model']],'as':_0x1a71af['as'],'attributes':_0x1a71af[_0xdc1b('0x25')],'include':_0x1a71af[_0xdc1b('0x23')]?_[_0xdc1b('0x22')](_0x1a71af['include'],function(_0x10692d){return{'model':db[_0x10692d[_0xdc1b('0x24')]],'as':_0x10692d['as'],'attributes':_0x10692d[_0xdc1b('0x25')],'include':_0x10692d[_0xdc1b('0x23')]?_['map'](_0x10692d[_0xdc1b('0x23')],function(_0xe4ea08){return{'model':db[_0xe4ea08['model']],'as':_0xe4ea08['as'],'attributes':_0xe4ea08['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x575dd6){logger[_0xdc1b('0x11')]('ShowChatQueue',_0x21a498);logger[_0xdc1b('0x13')]('ShowChatQueue',_0x21a498,JSON[_0xdc1b('0x16')](_0x575dd6));_0x2efc3d(_0x575dd6);})['catch'](function(_0x29be93){logger[_0xdc1b('0x17')]('ShowChatQueue',_0x29be93[_0xdc1b('0x18')],_0x21a498);_0x2f6bb3(_0x22290f[_0xdc1b('0x17')](0x1f4,_0x29be93[_0xdc1b('0x18')]));});});}; \ No newline at end of file +var _0x0d74=['jayson/promise','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetChatQueue','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','ChatQueue','find','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x57f8af,_0x3a881a){var _0x1ef58a=function(_0x14c7b4){while(--_0x14c7b4){_0x57f8af['push'](_0x57f8af['shift']());}};_0x1ef58a(++_0x3a881a);}(_0x0d74,0x146));var _0x40d7=function(_0x119709,_0x43cc9d){_0x119709=_0x119709-0x0;var _0x24ef6a=_0x0d74[_0x119709];return _0x24ef6a;};'use strict';var _=require(_0x40d7('0x0'));var util=require(_0x40d7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x40d7('0x2'));var fs=require('fs');var Redis=require(_0x40d7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x40d7('0x4'))(_0x40d7('0x5'));var config=require(_0x40d7('0x6'));var jayson=require(_0x40d7('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x40d7('0x8')](config['redis'],{'host':_0x40d7('0x9'),'port':0x18eb});var socket=require(_0x40d7('0xa'))(new Redis(config['redis']));require(_0x40d7('0xb'))[_0x40d7('0xc')](socket);function respondWithRpcPromise(_0x354f80,_0x2bae78,_0xcb37e3){return new BPromise(function(_0x517d88,_0x5208be){return client[_0x40d7('0xd')](_0x354f80,_0xcb37e3)[_0x40d7('0xe')](function(_0x229937){logger[_0x40d7('0xf')](_0x40d7('0x10'),_0x2bae78,'request\x20sent');logger[_0x40d7('0x11')](_0x40d7('0x12'),_0x2bae78,_0x40d7('0x13'),JSON[_0x40d7('0x14')](_0x229937));if(_0x229937['error']){if(_0x229937[_0x40d7('0x15')][_0x40d7('0x16')]===0x1f4){logger[_0x40d7('0x15')](_0x40d7('0x10'),_0x2bae78,_0x229937[_0x40d7('0x15')][_0x40d7('0x17')]);return _0x5208be(_0x229937[_0x40d7('0x15')][_0x40d7('0x17')]);}logger[_0x40d7('0x15')]('ChatQueue,\x20%s,\x20%s',_0x2bae78,_0x229937['error']['message']);return _0x517d88(_0x229937[_0x40d7('0x15')][_0x40d7('0x17')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x2bae78,_0x40d7('0x13'));_0x517d88(_0x229937['result']['message']);}})[_0x40d7('0x18')](function(_0x22de5a){logger[_0x40d7('0x15')](_0x40d7('0x10'),_0x2bae78,_0x22de5a);_0x5208be(_0x22de5a);});});}exports[_0x40d7('0x19')]=function(_0x28bbc0){var _0x3d2afa=this;return new Promise(function(_0x3ec437,_0x5eb3c1){return db['ChatQueue']['findAll']({'raw':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0['options'][_0x40d7('0x1b')]===undefined?!![]:![]:!![],'where':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0[_0x40d7('0x1a')][_0x40d7('0x1c')]||null:null,'attributes':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0[_0x40d7('0x1a')][_0x40d7('0x1d')]||null:null,'limit':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0[_0x40d7('0x1a')][_0x40d7('0x1e')]||null:null,'include':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0['options'][_0x40d7('0x1f')]?_[_0x40d7('0x20')](_0x28bbc0[_0x40d7('0x1a')][_0x40d7('0x1f')],function(_0x528ab5){return{'model':db[_0x528ab5['model']],'as':_0x528ab5['as'],'attributes':_0x528ab5[_0x40d7('0x1d')],'include':_0x528ab5['include']?_['map'](_0x528ab5[_0x40d7('0x1f')],function(_0x1ef074){return{'model':db[_0x1ef074[_0x40d7('0x21')]],'as':_0x1ef074['as'],'attributes':_0x1ef074[_0x40d7('0x1d')],'include':_0x1ef074['include']?_['map'](_0x1ef074[_0x40d7('0x1f')],function(_0x2b5f11){return{'model':db[_0x2b5f11[_0x40d7('0x21')]],'as':_0x2b5f11['as'],'attributes':_0x2b5f11['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1102d3){logger[_0x40d7('0xf')]('GetChatQueue',_0x28bbc0);logger[_0x40d7('0x11')](_0x40d7('0x19'),_0x28bbc0,JSON[_0x40d7('0x14')](_0x1102d3));_0x3ec437(_0x1102d3);})[_0x40d7('0x18')](function(_0x555a3b){logger['error'](_0x40d7('0x19'),_0x555a3b[_0x40d7('0x17')],_0x28bbc0);_0x5eb3c1(_0x3d2afa[_0x40d7('0x15')](0x1f4,_0x555a3b[_0x40d7('0x17')]));});});};exports[_0x40d7('0x22')]=function(_0x4a2bc2){var _0x23e560=this;return new Promise(function(_0x5af456,_0x22edd1){return db[_0x40d7('0x23')][_0x40d7('0x24')]({'raw':_0x4a2bc2['options']?_0x4a2bc2[_0x40d7('0x1a')][_0x40d7('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a2bc2[_0x40d7('0x1a')]?_0x4a2bc2[_0x40d7('0x1a')][_0x40d7('0x1c')]||null:null,'attributes':_0x4a2bc2[_0x40d7('0x1a')]?_0x4a2bc2[_0x40d7('0x1a')]['attributes']||null:null,'include':_0x4a2bc2[_0x40d7('0x1a')]?_0x4a2bc2[_0x40d7('0x1a')][_0x40d7('0x1f')]?_[_0x40d7('0x20')](_0x4a2bc2[_0x40d7('0x1a')][_0x40d7('0x1f')],function(_0x1e6f08){return{'model':db[_0x1e6f08[_0x40d7('0x21')]],'as':_0x1e6f08['as'],'attributes':_0x1e6f08['attributes'],'include':_0x1e6f08['include']?_[_0x40d7('0x20')](_0x1e6f08[_0x40d7('0x1f')],function(_0x4902a1){return{'model':db[_0x4902a1['model']],'as':_0x4902a1['as'],'attributes':_0x4902a1['attributes'],'include':_0x4902a1[_0x40d7('0x1f')]?_['map'](_0x4902a1[_0x40d7('0x1f')],function(_0x56b17c){return{'model':db[_0x56b17c[_0x40d7('0x21')]],'as':_0x56b17c['as'],'attributes':_0x56b17c[_0x40d7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x40d7('0xe')](function(_0x2e4ccb){logger[_0x40d7('0xf')]('ShowChatQueue',_0x4a2bc2);logger[_0x40d7('0x11')](_0x40d7('0x22'),_0x4a2bc2,JSON[_0x40d7('0x14')](_0x2e4ccb));_0x5af456(_0x2e4ccb);})[_0x40d7('0x18')](function(_0x21a675){logger['error']('ShowChatQueue',_0x21a675['message'],_0x4a2bc2);_0x22edd1(_0x23e560[_0x40d7('0x15')](0x1f4,_0x21a675['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index a6b0729..122f429 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 _0x7a2c=['chatQueue:','./chatQueue.events','remove','update','emit','register'];(function(_0x1c1e8c,_0x51a59b){var _0x23a5df=function(_0x25bb87){while(--_0x25bb87){_0x1c1e8c['push'](_0x1c1e8c['shift']());}};_0x23a5df(++_0x51a59b);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x12ddfb,_0x5e7808){_0x12ddfb=_0x12ddfb-0x0;var _0x712d01=_0x7a2c[_0x12ddfb];return _0x712d01;};'use strict';var ChatQueueEvents=require(_0xc7a2('0x0'));var events=['save',_0xc7a2('0x1'),_0xc7a2('0x2')];function createListener(_0x409ec5,_0x26fb61){return function(_0x44d702){_0x26fb61[_0xc7a2('0x3')](_0x409ec5,_0x44d702);};}function removeListener(_0x3f2b0d,_0x34cd60){return function(){ChatQueueEvents['removeListener'](_0x3f2b0d,_0x34cd60);};}exports[_0xc7a2('0x4')]=function(_0x1ddbae){for(var _0x5f334e=0x0,_0x481430=events['length'];_0x5f334e<_0x481430;_0x5f334e++){var _0x1dd150=events[_0x5f334e];var _0x3de428=createListener(_0xc7a2('0x5')+_0x1dd150,_0x1ddbae);ChatQueueEvents['on'](_0x1dd150,_0x3de428);}}; \ No newline at end of file +var _0xcb99=['chatQueue:','./chatQueue.events','remove','emit','removeListener','length'];(function(_0x747115,_0x570320){var _0x1d8acf=function(_0x5f3087){while(--_0x5f3087){_0x747115['push'](_0x747115['shift']());}};_0x1d8acf(++_0x570320);}(_0xcb99,0x8b));var _0x9cb9=function(_0x1440d9,_0x4a2c7e){_0x1440d9=_0x1440d9-0x0;var _0x4a0cfb=_0xcb99[_0x1440d9];return _0x4a0cfb;};'use strict';var ChatQueueEvents=require(_0x9cb9('0x0'));var events=['save',_0x9cb9('0x1'),'update'];function createListener(_0x480364,_0x3a2f21){return function(_0x1308a8){_0x3a2f21[_0x9cb9('0x2')](_0x480364,_0x1308a8);};}function removeListener(_0x51f2ee,_0x167735){return function(){ChatQueueEvents[_0x9cb9('0x3')](_0x51f2ee,_0x167735);};}exports['register']=function(_0x214b72){for(var _0x509cfc=0x0,_0x2ed26a=events[_0x9cb9('0x4')];_0x509cfc<_0x2ed26a;_0x509cfc++){var _0x1bf9b7=events[_0x509cfc];var _0x1dd62f=createListener(_0x9cb9('0x5')+_0x1bf9b7,_0x214b72);ChatQueueEvents['on'](_0x1bf9b7,_0x1dd62f);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 7c09fe2..f86c2ce 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x52d8b9,_0xe54454){var _0x126b5b=function(_0x43d8c8){while(--_0x43d8c8){_0x52d8b9['push'](_0x52d8b9['shift']());}};_0x126b5b(++_0xe54454);}(_0x814b,0x1a2));var _0xb814=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x814b[_0x50aa2e];return _0x5e07f0;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x4af72f,_0xd67b2e){var _0x5a25e4=function(_0x3f7724){while(--_0x3f7724){_0x4af72f['push'](_0x4af72f['shift']());}};_0x5a25e4(++_0xd67b2e);}(_0x55ca,0x126));var _0xa55c=function(_0x57a9e5,_0x5009df){_0x57a9e5=_0x57a9e5-0x0;var _0x36d39e=_0x55ca[_0x57a9e5];return _0x36d39e;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index a4d6e8d..2971427 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 _0x5612=['moment','sequelize','exports','STRING','DATE'];(function(_0x53e82b,_0x1c3157){var _0x482bec=function(_0x2ded11){while(--_0x2ded11){_0x53e82b['push'](_0x53e82b['shift']());}};_0x482bec(++_0x1c3157);}(_0x5612,0x19a));var _0x2561=function(_0x976d1a,_0x1d45b3){_0x976d1a=_0x976d1a-0x0;var _0x4dc6b2=_0x5612[_0x976d1a];return _0x4dc6b2;};'use strict';var moment=require(_0x2561('0x0'));var Sequelize=require(_0x2561('0x1'));module[_0x2561('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2561('0x3')]},'joinAt':{'type':Sequelize[_0x2561('0x4')]},'leaveAt':{'type':Sequelize[_0x2561('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2561('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5a47=['moment','exports','STRING','DATE'];(function(_0x15961d,_0x13827d){var _0x2519ab=function(_0x24dd53){while(--_0x24dd53){_0x15961d['push'](_0x15961d['shift']());}};_0x2519ab(++_0x13827d);}(_0x5a47,0x12c));var _0x75a4=function(_0x12de66,_0x357deb){_0x12de66=_0x12de66-0x0;var _0x2465d7=_0x5a47[_0x12de66];return _0x2465d7;};'use strict';var moment=require(_0x75a4('0x0'));var Sequelize=require('sequelize');module[_0x75a4('0x1')]={'uniqueid':{'type':Sequelize[_0x75a4('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x75a4('0x3')]},'leaveAt':{'type':Sequelize[_0x75a4('0x3')]},'acceptAt':{'type':Sequelize[_0x75a4('0x3')]},'exitAt':{'type':Sequelize[_0x75a4('0x3')]},'reason':{'type':Sequelize[_0x75a4('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 5e84b03..e16bb3c 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 _0xdbb9=['map','ChatQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','then','destroy','stack','name','index'];(function(_0x372215,_0x4700f1){var _0x5ebeba=function(_0x28e54b){while(--_0x28e54b){_0x372215['push'](_0x372215['shift']());}};_0x5ebeba(++_0x4700f1);}(_0xdbb9,0xf9));var _0x9dbb=function(_0x416152,_0x2e5f33){_0x416152=_0x416152-0x0;var _0x10586d=_0xdbb9[_0x416152];return _0x10586d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9dbb('0x0'));var zipdir=require(_0x9dbb('0x1'));var jsonpatch=require(_0x9dbb('0x2'));var rp=require(_0x9dbb('0x3'));var moment=require('moment');var BPromise=require(_0x9dbb('0x4'));var Mustache=require(_0x9dbb('0x5'));var util=require(_0x9dbb('0x6'));var path=require(_0x9dbb('0x7'));var sox=require(_0x9dbb('0x8'));var csv=require(_0x9dbb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9dbb('0xa'));var crypto=require(_0x9dbb('0xb'));var jsforce=require(_0x9dbb('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9dbb('0xd'));var Papa=require(_0x9dbb('0xe'));var Redis=require(_0x9dbb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9dbb('0x10'));var as=require(_0x9dbb('0x11'));var hardwareService=require(_0x9dbb('0x12'));var logger=require(_0x9dbb('0x13'))('api');var utils=require(_0x9dbb('0x14'));var config=require(_0x9dbb('0x15'));var licenseUtil=require(_0x9dbb('0x16'));var db=require(_0x9dbb('0x17'))['db'];function respondWithStatusCode(_0x3fe0bd,_0x4468e8){_0x4468e8=_0x4468e8||0xcc;return function(_0x382cc6){if(_0x382cc6){return _0x3fe0bd[_0x9dbb('0x18')](_0x4468e8);}return _0x3fe0bd[_0x9dbb('0x19')](_0x4468e8)[_0x9dbb('0x1a')]();};}function respondWithResult(_0x293028,_0x2c36d3){_0x2c36d3=_0x2c36d3||0xc8;return function(_0x24b20b){if(_0x24b20b){return _0x293028[_0x9dbb('0x19')](_0x2c36d3)[_0x9dbb('0x1b')](_0x24b20b);}};}function respondWithFilteredResult(_0x464df5,_0x528110){return function(_0x1366b2){if(_0x1366b2){var _0x30add1=typeof _0x528110[_0x9dbb('0x1c')]===_0x9dbb('0x1d')&&typeof _0x528110[_0x9dbb('0x1e')]==='undefined';var _0x382d61=_0x1366b2[_0x9dbb('0x1f')];var _0x2383cf=_0x30add1?0x0:_0x528110[_0x9dbb('0x1c')];var _0x45c6f5=_0x30add1?_0x1366b2['count']:_0x528110[_0x9dbb('0x1c')]+_0x528110['limit'];var _0x3de435;if(_0x45c6f5>=_0x382d61){_0x45c6f5=_0x382d61;_0x3de435=0xc8;}else{_0x3de435=0xce;}_0x464df5['status'](_0x3de435);return _0x464df5[_0x9dbb('0x20')]('Content-Range',_0x2383cf+'-'+_0x45c6f5+'/'+_0x382d61)[_0x9dbb('0x1b')](_0x1366b2);}return null;};}function patchUpdates(_0x192eb5){return function(_0x188c75){try{jsonpatch['apply'](_0x188c75,_0x192eb5,!![]);}catch(_0x50e5e3){return BPromise['reject'](_0x50e5e3);}return _0x188c75[_0x9dbb('0x21')]();};}function saveUpdates(_0x35c136,_0x48bb65){return function(_0x4a07ef){if(_0x4a07ef){return _0x4a07ef['update'](_0x35c136)[_0x9dbb('0x22')](function(_0x245d12){return _0x245d12;});}return null;};}function removeEntity(_0x10c06a,_0x55e2ef){return function(_0x1f30ec){if(_0x1f30ec){return _0x1f30ec[_0x9dbb('0x23')]()[_0x9dbb('0x22')](function(){_0x10c06a[_0x9dbb('0x19')](0xcc)[_0x9dbb('0x1a')]();});}};}function handleEntityNotFound(_0x3e51ca,_0x668f7b){return function(_0x187486){if(!_0x187486){_0x3e51ca[_0x9dbb('0x18')](0x194);}return _0x187486;};}function handleError(_0x127742,_0x25614a){_0x25614a=_0x25614a||0x1f4;return function(_0x27a6f6){logger['error'](_0x27a6f6[_0x9dbb('0x24')]);if(_0x27a6f6['name']){delete _0x27a6f6[_0x9dbb('0x25')];}_0x127742[_0x9dbb('0x19')](_0x25614a)['send'](_0x27a6f6);};}exports[_0x9dbb('0x26')]=function(_0x4ebd57,_0x4b5ce1){var _0x589f63={},_0x25555c={},_0x3578b3={'count':0x0,'rows':[]};var _0x491324=_[_0x9dbb('0x27')](db[_0x9dbb('0x28')]['rawAttributes'],function(_0x71692a){return{'name':_0x71692a[_0x9dbb('0x29')],'type':_0x71692a[_0x9dbb('0x2a')]['key']};});_0x25555c[_0x9dbb('0x2b')]=_['map'](_0x491324,_0x9dbb('0x25'));_0x25555c[_0x9dbb('0x2c')]=_[_0x9dbb('0x2d')](_0x4ebd57[_0x9dbb('0x2c')]);_0x25555c[_0x9dbb('0x2e')]=_[_0x9dbb('0x2f')](_0x25555c[_0x9dbb('0x2b')],_0x25555c[_0x9dbb('0x2c')]);_0x589f63[_0x9dbb('0x30')]=_[_0x9dbb('0x2f')](_0x25555c[_0x9dbb('0x2b')],qs['fields'](_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x31')]));_0x589f63[_0x9dbb('0x30')]=_0x589f63[_0x9dbb('0x30')][_0x9dbb('0x32')]?_0x589f63[_0x9dbb('0x30')]:_0x25555c[_0x9dbb('0x2b')];if(!_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x33')](_0x9dbb('0x34'))){_0x589f63[_0x9dbb('0x1e')]=qs[_0x9dbb('0x1e')](_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x1e')]);_0x589f63[_0x9dbb('0x1c')]=qs[_0x9dbb('0x1c')](_0x4ebd57[_0x9dbb('0x2c')]['offset']);}_0x589f63[_0x9dbb('0x35')]=qs[_0x9dbb('0x36')](_0x4ebd57[_0x9dbb('0x2c')]['sort']);_0x589f63[_0x9dbb('0x37')]=qs[_0x9dbb('0x2e')](_[_0x9dbb('0x38')](_0x4ebd57[_0x9dbb('0x2c')],_0x25555c[_0x9dbb('0x2e')]),_0x491324);if(_0x4ebd57[_0x9dbb('0x2c')]['filter']){_0x589f63[_0x9dbb('0x37')]=_['merge'](_0x589f63[_0x9dbb('0x37')],{'$or':_[_0x9dbb('0x27')](_0x491324,function(_0xa3bc3){if(_0xa3bc3[_0x9dbb('0x2a')]!=='VIRTUAL'){var _0x1a5eeb={};_0x1a5eeb[_0xa3bc3['name']]={'$like':'%'+_0x4ebd57[_0x9dbb('0x2c')]['filter']+'%'};return _0x1a5eeb;}})});}_0x589f63=_[_0x9dbb('0x39')]({},_0x589f63,_0x4ebd57[_0x9dbb('0x3a')]);var _0x34524e={'where':_0x589f63[_0x9dbb('0x37')]};return db[_0x9dbb('0x28')]['count'](_0x34524e)[_0x9dbb('0x22')](function(_0x59eea1){_0x3578b3[_0x9dbb('0x1f')]=_0x59eea1;if(_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x3b')]){_0x589f63[_0x9dbb('0x3c')]=[{'all':!![]}];}return db[_0x9dbb('0x28')][_0x9dbb('0x3d')](_0x589f63);})[_0x9dbb('0x22')](function(_0x49e63f){_0x3578b3[_0x9dbb('0x3e')]=_0x49e63f;return _0x3578b3;})['then'](respondWithFilteredResult(_0x4b5ce1,_0x589f63))[_0x9dbb('0x3f')](handleError(_0x4b5ce1,null));};exports[_0x9dbb('0x40')]=function(_0x34c114,_0x104ec5){var _0x490833={'raw':!![],'where':{'id':_0x34c114['params']['id']}},_0x2f99ed={};_0x2f99ed[_0x9dbb('0x2b')]=_['keys'](db[_0x9dbb('0x28')][_0x9dbb('0x41')]);_0x2f99ed['query']=_['keys'](_0x34c114[_0x9dbb('0x2c')]);_0x2f99ed[_0x9dbb('0x2e')]=_[_0x9dbb('0x2f')](_0x2f99ed[_0x9dbb('0x2b')],_0x2f99ed[_0x9dbb('0x2c')]);_0x490833[_0x9dbb('0x30')]=_[_0x9dbb('0x2f')](_0x2f99ed[_0x9dbb('0x2b')],qs[_0x9dbb('0x31')](_0x34c114['query'][_0x9dbb('0x31')]));_0x490833['attributes']=_0x490833[_0x9dbb('0x30')][_0x9dbb('0x32')]?_0x490833[_0x9dbb('0x30')]:_0x2f99ed[_0x9dbb('0x2b')];if(_0x34c114['query'][_0x9dbb('0x3b')]){_0x490833['include']=[{'all':!![]}];}_0x490833=_['merge']({},_0x490833,_0x34c114[_0x9dbb('0x3a')]);return db[_0x9dbb('0x28')][_0x9dbb('0x42')](_0x490833)[_0x9dbb('0x22')](handleEntityNotFound(_0x104ec5,null))[_0x9dbb('0x22')](respondWithResult(_0x104ec5,null))[_0x9dbb('0x3f')](handleError(_0x104ec5,null));};exports['create']=function(_0x202235,_0x56d319){return db[_0x9dbb('0x28')][_0x9dbb('0x43')](_0x202235[_0x9dbb('0x44')],{})[_0x9dbb('0x22')](respondWithResult(_0x56d319,0xc9))[_0x9dbb('0x3f')](handleError(_0x56d319,null));};exports[_0x9dbb('0x45')]=function(_0x34304a,_0x31c532){if(_0x34304a['body']['id']){delete _0x34304a[_0x9dbb('0x44')]['id'];}return db['ChatQueueReport'][_0x9dbb('0x42')]({'where':{'id':_0x34304a[_0x9dbb('0x46')]['id']}})['then'](handleEntityNotFound(_0x31c532,null))[_0x9dbb('0x22')](saveUpdates(_0x34304a['body'],null))['then'](respondWithResult(_0x31c532,null))['catch'](handleError(_0x31c532,null));};exports[_0x9dbb('0x23')]=function(_0x3c19bb,_0x5c398b){return db[_0x9dbb('0x28')]['find']({'where':{'id':_0x3c19bb[_0x9dbb('0x46')]['id']}})[_0x9dbb('0x22')](handleEntityNotFound(_0x5c398b,null))[_0x9dbb('0x22')](removeEntity(_0x5c398b,null))[_0x9dbb('0x3f')](handleError(_0x5c398b,null));};exports[_0x9dbb('0x47')]=function(_0x6a6f55,_0x56ac9a){return db['ChatQueueReport'][_0x9dbb('0x47')]()[_0x9dbb('0x22')](respondWithResult(_0x56ac9a,null))['catch'](handleError(_0x56ac9a,null));}; \ No newline at end of file +var _0xcd0e=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','destroy','end','error','stack','name','index','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','then','includeAll','include','findAll','rows','params','length','options','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3ef5e5,_0x5bbc62){var _0x212d0a=function(_0x18d566){while(--_0x18d566){_0x3ef5e5['push'](_0x3ef5e5['shift']());}};_0x212d0a(++_0x5bbc62);}(_0xcd0e,0xe9));var _0xecd0=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xcd0e[_0x24259d];return _0x5a701;};'use strict';var emlformat=require(_0xecd0('0x0'));var rimraf=require(_0xecd0('0x1'));var zipdir=require(_0xecd0('0x2'));var jsonpatch=require(_0xecd0('0x3'));var rp=require(_0xecd0('0x4'));var moment=require(_0xecd0('0x5'));var BPromise=require(_0xecd0('0x6'));var Mustache=require(_0xecd0('0x7'));var util=require(_0xecd0('0x8'));var path=require(_0xecd0('0x9'));var sox=require(_0xecd0('0xa'));var csv=require(_0xecd0('0xb'));var ejs=require(_0xecd0('0xc'));var fs=require('fs');var fs_extra=require(_0xecd0('0xd'));var _=require(_0xecd0('0xe'));var squel=require(_0xecd0('0xf'));var crypto=require(_0xecd0('0x10'));var jsforce=require(_0xecd0('0x11'));var deskjs=require(_0xecd0('0x12'));var toCsv=require('to-csv');var querystring=require(_0xecd0('0x13'));var Papa=require(_0xecd0('0x14'));var Redis=require(_0xecd0('0x15'));var authService=require(_0xecd0('0x16'));var qs=require(_0xecd0('0x17'));var as=require(_0xecd0('0x18'));var hardwareService=require(_0xecd0('0x19'));var logger=require(_0xecd0('0x1a'))(_0xecd0('0x1b'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xecd0('0x1c'))['db'];function respondWithStatusCode(_0x33af86,_0x241974){_0x241974=_0x241974||0xcc;return function(_0x3bccd2){if(_0x3bccd2){return _0x33af86[_0xecd0('0x1d')](_0x241974);}return _0x33af86[_0xecd0('0x1e')](_0x241974)['end']();};}function respondWithResult(_0x595dd8,_0x35b69b){_0x35b69b=_0x35b69b||0xc8;return function(_0xe13b00){if(_0xe13b00){return _0x595dd8['status'](_0x35b69b)[_0xecd0('0x1f')](_0xe13b00);}};}function respondWithFilteredResult(_0x45184c,_0x4b96d8){return function(_0x51d3bd){if(_0x51d3bd){var _0x118746=typeof _0x4b96d8['offset']===_0xecd0('0x20')&&typeof _0x4b96d8[_0xecd0('0x21')]==='undefined';var _0x367c38=_0x51d3bd[_0xecd0('0x22')];var _0x291300=_0x118746?0x0:_0x4b96d8['offset'];var _0x1b0054=_0x118746?_0x51d3bd[_0xecd0('0x22')]:_0x4b96d8[_0xecd0('0x23')]+_0x4b96d8['limit'];var _0x22a703;if(_0x1b0054>=_0x367c38){_0x1b0054=_0x367c38;_0x22a703=0xc8;}else{_0x22a703=0xce;}_0x45184c[_0xecd0('0x1e')](_0x22a703);return _0x45184c['set'](_0xecd0('0x24'),_0x291300+'-'+_0x1b0054+'/'+_0x367c38)[_0xecd0('0x1f')](_0x51d3bd);}return null;};}function patchUpdates(_0x51ec16){return function(_0x409e0b){try{jsonpatch[_0xecd0('0x25')](_0x409e0b,_0x51ec16,!![]);}catch(_0x4a488c){return BPromise['reject'](_0x4a488c);}return _0x409e0b[_0xecd0('0x26')]();};}function saveUpdates(_0x48fb4c,_0x26ea52){return function(_0x5c0153){if(_0x5c0153){return _0x5c0153['update'](_0x48fb4c)['then'](function(_0x355846){return _0x355846;});}return null;};}function removeEntity(_0x5b0183,_0x25d9e9){return function(_0x4ce453){if(_0x4ce453){return _0x4ce453[_0xecd0('0x27')]()['then'](function(){_0x5b0183['status'](0xcc)[_0xecd0('0x28')]();});}};}function handleEntityNotFound(_0x4f00c9,_0x3625a4){return function(_0x918e){if(!_0x918e){_0x4f00c9[_0xecd0('0x1d')](0x194);}return _0x918e;};}function handleError(_0x133ecd,_0x3b2f14){_0x3b2f14=_0x3b2f14||0x1f4;return function(_0x482321){logger[_0xecd0('0x29')](_0x482321[_0xecd0('0x2a')]);if(_0x482321[_0xecd0('0x2b')]){delete _0x482321[_0xecd0('0x2b')];}_0x133ecd[_0xecd0('0x1e')](_0x3b2f14)['send'](_0x482321);};}exports[_0xecd0('0x2c')]=function(_0x4c0dcb,_0x4374a5){var _0x45fc62={},_0x2a99a2={},_0x22efb3={'count':0x0,'rows':[]};var _0x511ef2=_['map'](db[_0xecd0('0x2d')][_0xecd0('0x2e')],function(_0x1dbfdf){return{'name':_0x1dbfdf[_0xecd0('0x2f')],'type':_0x1dbfdf[_0xecd0('0x30')]['key']};});_0x2a99a2[_0xecd0('0x31')]=_['map'](_0x511ef2,_0xecd0('0x2b'));_0x2a99a2[_0xecd0('0x32')]=_[_0xecd0('0x33')](_0x4c0dcb[_0xecd0('0x32')]);_0x2a99a2['filters']=_[_0xecd0('0x34')](_0x2a99a2[_0xecd0('0x31')],_0x2a99a2[_0xecd0('0x32')]);_0x45fc62[_0xecd0('0x35')]=_[_0xecd0('0x34')](_0x2a99a2[_0xecd0('0x31')],qs[_0xecd0('0x36')](_0x4c0dcb['query'][_0xecd0('0x36')]));_0x45fc62[_0xecd0('0x35')]=_0x45fc62[_0xecd0('0x35')]['length']?_0x45fc62['attributes']:_0x2a99a2[_0xecd0('0x31')];if(!_0x4c0dcb[_0xecd0('0x32')][_0xecd0('0x37')](_0xecd0('0x38'))){_0x45fc62[_0xecd0('0x21')]=qs[_0xecd0('0x21')](_0x4c0dcb[_0xecd0('0x32')][_0xecd0('0x21')]);_0x45fc62[_0xecd0('0x23')]=qs['offset'](_0x4c0dcb['query'][_0xecd0('0x23')]);}_0x45fc62[_0xecd0('0x39')]=qs[_0xecd0('0x3a')](_0x4c0dcb['query'][_0xecd0('0x3a')]);_0x45fc62[_0xecd0('0x3b')]=qs[_0xecd0('0x3c')](_[_0xecd0('0x3d')](_0x4c0dcb[_0xecd0('0x32')],_0x2a99a2[_0xecd0('0x3c')]),_0x511ef2);if(_0x4c0dcb['query']['filter']){_0x45fc62[_0xecd0('0x3b')]=_[_0xecd0('0x3e')](_0x45fc62[_0xecd0('0x3b')],{'$or':_['map'](_0x511ef2,function(_0x58b2a0){if(_0x58b2a0[_0xecd0('0x30')]!==_0xecd0('0x3f')){var _0x30728d={};_0x30728d[_0x58b2a0[_0xecd0('0x2b')]]={'$like':'%'+_0x4c0dcb[_0xecd0('0x32')][_0xecd0('0x40')]+'%'};return _0x30728d;}})});}_0x45fc62=_['merge']({},_0x45fc62,_0x4c0dcb['options']);var _0xed68aa={'where':_0x45fc62[_0xecd0('0x3b')]};return db['ChatQueueReport'][_0xecd0('0x22')](_0xed68aa)[_0xecd0('0x41')](function(_0x3a4fb5){_0x22efb3['count']=_0x3a4fb5;if(_0x4c0dcb[_0xecd0('0x32')][_0xecd0('0x42')]){_0x45fc62[_0xecd0('0x43')]=[{'all':!![]}];}return db[_0xecd0('0x2d')][_0xecd0('0x44')](_0x45fc62);})[_0xecd0('0x41')](function(_0xfc1eee){_0x22efb3[_0xecd0('0x45')]=_0xfc1eee;return _0x22efb3;})[_0xecd0('0x41')](respondWithFilteredResult(_0x4374a5,_0x45fc62))['catch'](handleError(_0x4374a5,null));};exports['show']=function(_0x5cab5e,_0xaa5340){var _0x94e9dd={'raw':!![],'where':{'id':_0x5cab5e[_0xecd0('0x46')]['id']}},_0x3b08ca={};_0x3b08ca['model']=_['keys'](db[_0xecd0('0x2d')][_0xecd0('0x2e')]);_0x3b08ca[_0xecd0('0x32')]=_[_0xecd0('0x33')](_0x5cab5e[_0xecd0('0x32')]);_0x3b08ca['filters']=_['intersection'](_0x3b08ca['model'],_0x3b08ca[_0xecd0('0x32')]);_0x94e9dd['attributes']=_[_0xecd0('0x34')](_0x3b08ca[_0xecd0('0x31')],qs[_0xecd0('0x36')](_0x5cab5e['query'][_0xecd0('0x36')]));_0x94e9dd['attributes']=_0x94e9dd['attributes'][_0xecd0('0x47')]?_0x94e9dd[_0xecd0('0x35')]:_0x3b08ca[_0xecd0('0x31')];if(_0x5cab5e[_0xecd0('0x32')][_0xecd0('0x42')]){_0x94e9dd[_0xecd0('0x43')]=[{'all':!![]}];}_0x94e9dd=_[_0xecd0('0x3e')]({},_0x94e9dd,_0x5cab5e[_0xecd0('0x48')]);return db[_0xecd0('0x2d')]['find'](_0x94e9dd)[_0xecd0('0x41')](handleEntityNotFound(_0xaa5340,null))['then'](respondWithResult(_0xaa5340,null))[_0xecd0('0x49')](handleError(_0xaa5340,null));};exports[_0xecd0('0x4a')]=function(_0x496e2b,_0x563b3c){return db[_0xecd0('0x2d')][_0xecd0('0x4a')](_0x496e2b[_0xecd0('0x4b')],{})['then'](respondWithResult(_0x563b3c,0xc9))[_0xecd0('0x49')](handleError(_0x563b3c,null));};exports[_0xecd0('0x4c')]=function(_0x565829,_0x54de11){if(_0x565829[_0xecd0('0x4b')]['id']){delete _0x565829[_0xecd0('0x4b')]['id'];}return db[_0xecd0('0x2d')][_0xecd0('0x4d')]({'where':{'id':_0x565829[_0xecd0('0x46')]['id']}})[_0xecd0('0x41')](handleEntityNotFound(_0x54de11,null))[_0xecd0('0x41')](saveUpdates(_0x565829['body'],null))[_0xecd0('0x41')](respondWithResult(_0x54de11,null))[_0xecd0('0x49')](handleError(_0x54de11,null));};exports[_0xecd0('0x27')]=function(_0x1806cf,_0x3aef3e){return db['ChatQueueReport'][_0xecd0('0x4d')]({'where':{'id':_0x1806cf[_0xecd0('0x46')]['id']}})[_0xecd0('0x41')](handleEntityNotFound(_0x3aef3e,null))['then'](removeEntity(_0x3aef3e,null))[_0xecd0('0x49')](handleError(_0x3aef3e,null));};exports[_0xecd0('0x4e')]=function(_0x495b6d,_0x39cc8e){return db['ChatQueueReport'][_0xecd0('0x4e')]()[_0xecd0('0x41')](respondWithResult(_0x39cc8e,null))[_0xecd0('0x49')](handleError(_0x39cc8e,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 555deda..b34f1f0 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x5c2dfc,_0x17f2f7){var _0x3827b1=function(_0xc6524f){while(--_0xc6524f){_0x5c2dfc['push'](_0x5c2dfc['shift']());}};_0x3827b1(++_0x17f2f7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xb7e7[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5a6669,_0x417479){var _0x543d49=function(_0x1f72ad){while(--_0x1f72ad){_0x5a6669['push'](_0x5a6669['shift']());}};_0x543d49(++_0x417479);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 7ea2217..760eb31 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 _0xa68a=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','catch','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','moment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa68a,0x1ad));var _0xaa68=function(_0x567dcd,_0x2f6e5d){_0x567dcd=_0x567dcd-0x0;var _0x38879d=_0xa68a[_0x567dcd];return _0x38879d;};'use strict';var _=require(_0xaa68('0x0'));var util=require(_0xaa68('0x1'));var moment=require(_0xaa68('0x2'));var BPromise=require(_0xaa68('0x3'));var rs=require(_0xaa68('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa68('0x5'))['db'];var utils=require(_0xaa68('0x6'));var logger=require(_0xaa68('0x7'))(_0xaa68('0x8'));var config=require(_0xaa68('0x9'));var jayson=require(_0xaa68('0xa'));var client=jayson[_0xaa68('0xb')][_0xaa68('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x259b21,_0x5c2479,_0x3813a8){return new BPromise(function(_0x9f10f5,_0x20edd4){return client['request'](_0x259b21,_0x3813a8)[_0xaa68('0xd')](function(_0x20ceee){logger[_0xaa68('0xe')](_0xaa68('0xf'),_0x5c2479,_0xaa68('0x10'));logger['debug'](_0xaa68('0x11'),_0x5c2479,_0xaa68('0x10'),JSON[_0xaa68('0x12')](_0x20ceee));if(_0x20ceee[_0xaa68('0x13')]){if(_0x20ceee[_0xaa68('0x13')][_0xaa68('0x14')]===0x1f4){logger['error'](_0xaa68('0xf'),_0x5c2479,_0x20ceee[_0xaa68('0x13')][_0xaa68('0x15')]);return _0x20edd4(_0x20ceee[_0xaa68('0x13')][_0xaa68('0x15')]);}logger[_0xaa68('0x13')](_0xaa68('0xf'),_0x5c2479,_0x20ceee['error'][_0xaa68('0x15')]);return _0x9f10f5(_0x20ceee['error'][_0xaa68('0x15')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x5c2479,_0xaa68('0x10'));_0x9f10f5(_0x20ceee[_0xaa68('0x16')]['message']);}})['catch'](function(_0x3a1f81){logger[_0xaa68('0x13')](_0xaa68('0xf'),_0x5c2479,_0x3a1f81);_0x20edd4(_0x3a1f81);});});}exports[_0xaa68('0x17')]=function(_0xd79686){var _0x30c143=this;return new Promise(function(_0x2e45ad,_0x4af7e4){return db[_0xaa68('0x18')][_0xaa68('0x19')](_0xd79686[_0xaa68('0x1a')],{'raw':_0xd79686[_0xaa68('0x1b')]?_0xd79686[_0xaa68('0x1b')][_0xaa68('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1d748f){logger['info'](_0xaa68('0x17'),_0xd79686);logger[_0xaa68('0x1d')](_0xaa68('0x17'),_0xd79686,JSON[_0xaa68('0x12')](_0x1d748f));_0x2e45ad(_0x1d748f);})[_0xaa68('0x1e')](function(_0x43fb4){logger[_0xaa68('0x13')]('CreateChatQueueReport',_0x43fb4[_0xaa68('0x15')],_0xd79686);_0x4af7e4(_0x30c143[_0xaa68('0x13')](0x1f4,_0x43fb4[_0xaa68('0x15')]));});});};exports[_0xaa68('0x1f')]=function(_0x2d6d4c){var _0x583e00=this;return new Promise(function(_0x23298e,_0x5a50dd){return db['ChatQueueReport'][_0xaa68('0x20')](_0x2d6d4c[_0xaa68('0x1a')],{'raw':_0x2d6d4c[_0xaa68('0x1b')]?_0x2d6d4c[_0xaa68('0x1b')][_0xaa68('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d6d4c[_0xaa68('0x1b')]?_0x2d6d4c[_0xaa68('0x1b')][_0xaa68('0x21')]||null:null,'attributes':_0x2d6d4c['options']?_0x2d6d4c[_0xaa68('0x1b')][_0xaa68('0x22')]||null:null,'limit':_0x2d6d4c[_0xaa68('0x1b')]?_0x2d6d4c['options'][_0xaa68('0x23')]||null:null})[_0xaa68('0xd')](function(_0xddea5d){logger['info'](_0xaa68('0x1f'),_0x2d6d4c);logger[_0xaa68('0x1d')](_0xaa68('0x1f'),_0x2d6d4c,JSON[_0xaa68('0x12')](_0xddea5d));_0x23298e(_0xddea5d);})[_0xaa68('0x1e')](function(_0x5f0066){logger[_0xaa68('0x13')](_0xaa68('0x1f'),_0x5f0066[_0xaa68('0x15')],_0x2d6d4c);_0x5a50dd(_0x583e00[_0xaa68('0x13')](0x1f4,_0x5f0066[_0xaa68('0x15')]));});});}; \ No newline at end of file +var _0xbf5a=['message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','debug','raw','where','attributes','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x21f3c2,_0x406840){var _0xf1069d=function(_0x263ccd){while(--_0x263ccd){_0x21f3c2['push'](_0x21f3c2['shift']());}};_0xf1069d(++_0x406840);}(_0xbf5a,0x16c));var _0xabf5=function(_0x5e4f0e,_0x5a28b3){_0x5e4f0e=_0x5e4f0e-0x0;var _0x4f18a2=_0xbf5a[_0x5e4f0e];return _0x4f18a2;};'use strict';var _=require(_0xabf5('0x0'));var util=require('util');var moment=require(_0xabf5('0x1'));var BPromise=require(_0xabf5('0x2'));var rs=require(_0xabf5('0x3'));var fs=require('fs');var Redis=require(_0xabf5('0x4'));var db=require(_0xabf5('0x5'))['db'];var utils=require(_0xabf5('0x6'));var logger=require(_0xabf5('0x7'))(_0xabf5('0x8'));var config=require(_0xabf5('0x9'));var jayson=require(_0xabf5('0xa'));var client=jayson[_0xabf5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32f17d,_0x1dfe7f,_0x7152cd){return new BPromise(function(_0x12a821,_0x15f970){return client[_0xabf5('0xc')](_0x32f17d,_0x7152cd)[_0xabf5('0xd')](function(_0x56c6fd){logger[_0xabf5('0xe')](_0xabf5('0xf'),_0x1dfe7f,_0xabf5('0x10'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x1dfe7f,'request\x20sent',JSON[_0xabf5('0x11')](_0x56c6fd));if(_0x56c6fd[_0xabf5('0x12')]){if(_0x56c6fd[_0xabf5('0x12')][_0xabf5('0x13')]===0x1f4){logger['error'](_0xabf5('0xf'),_0x1dfe7f,_0x56c6fd['error']['message']);return _0x15f970(_0x56c6fd[_0xabf5('0x12')]['message']);}logger[_0xabf5('0x12')](_0xabf5('0xf'),_0x1dfe7f,_0x56c6fd[_0xabf5('0x12')]['message']);return _0x12a821(_0x56c6fd[_0xabf5('0x12')][_0xabf5('0x14')]);}else{logger[_0xabf5('0xe')](_0xabf5('0xf'),_0x1dfe7f,_0xabf5('0x10'));_0x12a821(_0x56c6fd[_0xabf5('0x15')][_0xabf5('0x14')]);}})[_0xabf5('0x16')](function(_0x2e8d4e){logger[_0xabf5('0x12')](_0xabf5('0xf'),_0x1dfe7f,_0x2e8d4e);_0x15f970(_0x2e8d4e);});});}exports[_0xabf5('0x17')]=function(_0x19c4be){var _0x9f72a6=this;return new Promise(function(_0x1c7214,_0x3e5c90){return db[_0xabf5('0x18')]['create'](_0x19c4be[_0xabf5('0x19')],{'raw':_0x19c4be[_0xabf5('0x1a')]?_0x19c4be[_0xabf5('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xabf5('0xd')](function(_0x24115a){logger[_0xabf5('0xe')](_0xabf5('0x17'),_0x19c4be);logger[_0xabf5('0x1b')](_0xabf5('0x17'),_0x19c4be,JSON['stringify'](_0x24115a));_0x1c7214(_0x24115a);})['catch'](function(_0x2bc8ad){logger[_0xabf5('0x12')](_0xabf5('0x17'),_0x2bc8ad[_0xabf5('0x14')],_0x19c4be);_0x3e5c90(_0x9f72a6[_0xabf5('0x12')](0x1f4,_0x2bc8ad[_0xabf5('0x14')]));});});};exports['UpdateChatQueueReport']=function(_0x2b17d8){var _0x4f2e9e=this;return new Promise(function(_0x34878d,_0x599816){return db[_0xabf5('0x18')]['update'](_0x2b17d8['body'],{'raw':_0x2b17d8[_0xabf5('0x1a')]?_0x2b17d8[_0xabf5('0x1a')][_0xabf5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b17d8['options']?_0x2b17d8[_0xabf5('0x1a')][_0xabf5('0x1d')]||null:null,'attributes':_0x2b17d8[_0xabf5('0x1a')]?_0x2b17d8['options'][_0xabf5('0x1e')]||null:null,'limit':_0x2b17d8['options']?_0x2b17d8[_0xabf5('0x1a')]['limit']||null:null})[_0xabf5('0xd')](function(_0x46c1ec){logger[_0xabf5('0xe')](_0xabf5('0x1f'),_0x2b17d8);logger[_0xabf5('0x1b')]('UpdateChatQueueReport',_0x2b17d8,JSON[_0xabf5('0x11')](_0x46c1ec));_0x34878d(_0x46c1ec);})[_0xabf5('0x16')](function(_0x18bf14){logger[_0xabf5('0x12')](_0xabf5('0x1f'),_0x18bf14['message'],_0x2b17d8);_0x599816(_0x4f2e9e['error'](0x1f4,_0x18bf14[_0xabf5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index e6174dd..d28e1a6 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 _0x4a83=['destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4a83,0xd3));var _0x34a8=function(_0x360296,_0xcd6f97){_0x360296=_0x360296-0x0;var _0x20b06d=_0x4a83[_0x360296];return _0x20b06d;};'use strict';var multer=require(_0x34a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x34a8('0x1'));var express=require(_0x34a8('0x2'));var router=express[_0x34a8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x34a8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x34a8('0x5'));var controller=require('./chatQueueReport.controller');router[_0x34a8('0x6')]('/',auth[_0x34a8('0x7')](),controller[_0x34a8('0x8')]);router[_0x34a8('0x6')](_0x34a8('0x9'),auth[_0x34a8('0x7')](),controller[_0x34a8('0xa')]);router[_0x34a8('0x6')](_0x34a8('0xb'),auth[_0x34a8('0x7')](),controller['show']);router[_0x34a8('0xc')]('/',auth[_0x34a8('0x7')](),controller[_0x34a8('0xd')]);router[_0x34a8('0xe')](_0x34a8('0xb'),auth[_0x34a8('0x7')](),controller[_0x34a8('0xf')]);router[_0x34a8('0x10')]('/:id',auth[_0x34a8('0x7')](),controller[_0x34a8('0x11')]);module[_0x34a8('0x12')]=router; \ No newline at end of file +var _0x6912=['../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3b22e9,_0x354406){var _0x230314=function(_0x29ae96){while(--_0x29ae96){_0x3b22e9['push'](_0x3b22e9['shift']());}};_0x230314(++_0x354406);}(_0x6912,0xa1));var _0x2691=function(_0x468467,_0x1dee78){_0x468467=_0x468467-0x0;var _0x488fc2=_0x6912[_0x468467];return _0x488fc2;};'use strict';var multer=require('multer');var util=require(_0x2691('0x0'));var path=require(_0x2691('0x1'));var timeout=require(_0x2691('0x2'));var express=require(_0x2691('0x3'));var router=express[_0x2691('0x4')]();var fs_extra=require(_0x2691('0x5'));var auth=require(_0x2691('0x6'));var interaction=require(_0x2691('0x7'));var config=require('../../config/environment');var controller=require(_0x2691('0x8'));router[_0x2691('0x9')]('/',auth[_0x2691('0xa')](),controller[_0x2691('0xb')]);router['get'](_0x2691('0xc'),auth[_0x2691('0xa')](),controller[_0x2691('0xd')]);router[_0x2691('0x9')](_0x2691('0xe'),auth['isAuthenticated'](),controller[_0x2691('0xf')]);router[_0x2691('0x10')]('/',auth[_0x2691('0xa')](),controller[_0x2691('0x11')]);router['put'](_0x2691('0xe'),auth[_0x2691('0xa')](),controller[_0x2691('0x12')]);router[_0x2691('0x13')](_0x2691('0xe'),auth[_0x2691('0xa')](),controller['destroy']);module[_0x2691('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 0d5cd1f..95ed28f 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x1ecae9,_0x3d5fb9){var _0x5518e1=function(_0x1fcef5){while(--_0x1fcef5){_0x1ecae9['push'](_0x1ecae9['shift']());}};_0x5518e1(++_0x3d5fb9);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x4617a5,_0x582345){var _0x2629f9=function(_0x56543c){while(--_0x56543c){_0x4617a5['push'](_0x4617a5['shift']());}};_0x2629f9(++_0x582345);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2bbba5,_0x24e84b){_0x2bbba5=_0x2bbba5-0x0;var _0x3c477c=_0xf4eb[_0x2bbba5];return _0x3c477c;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 4f2120d..81a2fa6 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 _0x3785=['fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','ChatTransferReport','rawAttributes'];(function(_0x51bc84,_0x519320){var _0x3a953e=function(_0x568464){while(--_0x568464){_0x51bc84['push'](_0x51bc84['shift']());}};_0x3a953e(++_0x519320);}(_0x3785,0x68));var _0x5378=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x3785[_0x3e112d];return _0x531c31;};'use strict';var emlformat=require(_0x5378('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5378('0x1'));var rp=require(_0x5378('0x2'));var moment=require(_0x5378('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5378('0x4'));var path=require(_0x5378('0x5'));var sox=require('sox');var csv=require(_0x5378('0x6'));var ejs=require(_0x5378('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5378('0x8'));var squel=require(_0x5378('0x9'));var crypto=require(_0x5378('0xa'));var jsforce=require(_0x5378('0xb'));var deskjs=require(_0x5378('0xc'));var toCsv=require(_0x5378('0x6'));var querystring=require(_0x5378('0xd'));var Papa=require('papaparse');var Redis=require(_0x5378('0xe'));var authService=require(_0x5378('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5378('0x10'));var hardwareService=require(_0x5378('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5378('0x12'));var config=require(_0x5378('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5378('0x14'))['db'];function respondWithStatusCode(_0x2f75e2,_0x313698){_0x313698=_0x313698||0xcc;return function(_0x552947){if(_0x552947){return _0x2f75e2[_0x5378('0x15')](_0x313698);}return _0x2f75e2[_0x5378('0x16')](_0x313698)[_0x5378('0x17')]();};}function respondWithResult(_0x232546,_0xdc60be){_0xdc60be=_0xdc60be||0xc8;return function(_0x276572){if(_0x276572){return _0x232546[_0x5378('0x16')](_0xdc60be)['json'](_0x276572);}};}function respondWithFilteredResult(_0x1fe46e,_0x49bceb){return function(_0x36a055){if(_0x36a055){var _0x4357a9=typeof _0x49bceb[_0x5378('0x18')]===_0x5378('0x19')&&typeof _0x49bceb['limit']===_0x5378('0x19');var _0x2f6719=_0x36a055[_0x5378('0x1a')];var _0x20acfd=_0x4357a9?0x0:_0x49bceb[_0x5378('0x18')];var _0x4bf39d=_0x4357a9?_0x36a055[_0x5378('0x1a')]:_0x49bceb['offset']+_0x49bceb[_0x5378('0x1b')];var _0x59b105;if(_0x4bf39d>=_0x2f6719){_0x4bf39d=_0x2f6719;_0x59b105=0xc8;}else{_0x59b105=0xce;}_0x1fe46e['status'](_0x59b105);return _0x1fe46e[_0x5378('0x1c')](_0x5378('0x1d'),_0x20acfd+'-'+_0x4bf39d+'/'+_0x2f6719)['json'](_0x36a055);}return null;};}function patchUpdates(_0xd0ce08){return function(_0x5b776a){try{jsonpatch[_0x5378('0x1e')](_0x5b776a,_0xd0ce08,!![]);}catch(_0x485a42){return BPromise[_0x5378('0x1f')](_0x485a42);}return _0x5b776a[_0x5378('0x20')]();};}function saveUpdates(_0x3dde7b,_0x4e22a9){return function(_0x425bbb){if(_0x425bbb){return _0x425bbb[_0x5378('0x21')](_0x3dde7b)['then'](function(_0x1c847d){return _0x1c847d;});}return null;};}function removeEntity(_0x120a64,_0x1eaa87){return function(_0x4682b0){if(_0x4682b0){return _0x4682b0[_0x5378('0x22')]()[_0x5378('0x23')](function(){_0x120a64[_0x5378('0x16')](0xcc)[_0x5378('0x17')]();});}};}function handleEntityNotFound(_0x46de2a,_0x576bc4){return function(_0x559c22){if(!_0x559c22){_0x46de2a[_0x5378('0x15')](0x194);}return _0x559c22;};}function handleError(_0x32df3e,_0x12b3f7){_0x12b3f7=_0x12b3f7||0x1f4;return function(_0xc34567){logger['error'](_0xc34567['stack']);if(_0xc34567[_0x5378('0x24')]){delete _0xc34567[_0x5378('0x24')];}_0x32df3e[_0x5378('0x16')](_0x12b3f7)[_0x5378('0x25')](_0xc34567);};}exports['index']=function(_0x53f98d,_0x3aa678){var _0x2df665={},_0x4b2b0d={},_0x585603={'count':0x0,'rows':[]};var _0x13529c=_['map'](db[_0x5378('0x26')][_0x5378('0x27')],function(_0x2dc627){return{'name':_0x2dc627[_0x5378('0x28')],'type':_0x2dc627[_0x5378('0x29')][_0x5378('0x2a')]};});_0x4b2b0d[_0x5378('0x2b')]=_[_0x5378('0x2c')](_0x13529c,_0x5378('0x24'));_0x4b2b0d[_0x5378('0x2d')]=_[_0x5378('0x2e')](_0x53f98d[_0x5378('0x2d')]);_0x4b2b0d[_0x5378('0x2f')]=_[_0x5378('0x30')](_0x4b2b0d[_0x5378('0x2b')],_0x4b2b0d[_0x5378('0x2d')]);_0x2df665['attributes']=_[_0x5378('0x30')](_0x4b2b0d['model'],qs['fields'](_0x53f98d[_0x5378('0x2d')][_0x5378('0x31')]));_0x2df665[_0x5378('0x32')]=_0x2df665[_0x5378('0x32')][_0x5378('0x33')]?_0x2df665['attributes']:_0x4b2b0d[_0x5378('0x2b')];if(!_0x53f98d['query'][_0x5378('0x34')](_0x5378('0x35'))){_0x2df665[_0x5378('0x1b')]=qs[_0x5378('0x1b')](_0x53f98d[_0x5378('0x2d')]['limit']);_0x2df665[_0x5378('0x18')]=qs[_0x5378('0x18')](_0x53f98d[_0x5378('0x2d')][_0x5378('0x18')]);}_0x2df665['order']=qs[_0x5378('0x36')](_0x53f98d[_0x5378('0x2d')][_0x5378('0x36')]);_0x2df665[_0x5378('0x37')]=qs[_0x5378('0x2f')](_[_0x5378('0x38')](_0x53f98d[_0x5378('0x2d')],_0x4b2b0d[_0x5378('0x2f')]),_0x13529c);if(_0x53f98d[_0x5378('0x2d')][_0x5378('0x39')]){_0x2df665[_0x5378('0x37')]=_['merge'](_0x2df665[_0x5378('0x37')],{'$or':_[_0x5378('0x2c')](_0x13529c,function(_0x231682){if(_0x231682['type']!==_0x5378('0x3a')){var _0x1b62bd={};_0x1b62bd[_0x231682[_0x5378('0x24')]]={'$like':'%'+_0x53f98d[_0x5378('0x2d')]['filter']+'%'};return _0x1b62bd;}})});}_0x2df665=_['merge']({},_0x2df665,_0x53f98d[_0x5378('0x3b')]);var _0x168e3e={'where':_0x2df665['where']};return db[_0x5378('0x26')][_0x5378('0x1a')](_0x168e3e)[_0x5378('0x23')](function(_0x1d1446){_0x585603['count']=_0x1d1446;if(_0x53f98d[_0x5378('0x2d')][_0x5378('0x3c')]){_0x2df665[_0x5378('0x3d')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x5378('0x3e')](_0x2df665);})[_0x5378('0x23')](function(_0x3207bc){_0x585603[_0x5378('0x3f')]=_0x3207bc;return _0x585603;})[_0x5378('0x23')](respondWithFilteredResult(_0x3aa678,_0x2df665))[_0x5378('0x40')](handleError(_0x3aa678,null));};exports[_0x5378('0x41')]=function(_0x302c3c,_0x53e2c0){var _0x15d210={'raw':!![],'where':{'id':_0x302c3c[_0x5378('0x42')]['id']}},_0x2faae6={};_0x2faae6[_0x5378('0x2b')]=_[_0x5378('0x2e')](db['ChatTransferReport']['rawAttributes']);_0x2faae6[_0x5378('0x2d')]=_['keys'](_0x302c3c[_0x5378('0x2d')]);_0x2faae6['filters']=_[_0x5378('0x30')](_0x2faae6[_0x5378('0x2b')],_0x2faae6[_0x5378('0x2d')]);_0x15d210[_0x5378('0x32')]=_[_0x5378('0x30')](_0x2faae6[_0x5378('0x2b')],qs[_0x5378('0x31')](_0x302c3c['query'][_0x5378('0x31')]));_0x15d210[_0x5378('0x32')]=_0x15d210['attributes'][_0x5378('0x33')]?_0x15d210[_0x5378('0x32')]:_0x2faae6[_0x5378('0x2b')];if(_0x302c3c['query']['includeAll']){_0x15d210['include']=[{'all':!![]}];}_0x15d210=_[_0x5378('0x43')]({},_0x15d210,_0x302c3c[_0x5378('0x3b')]);return db['ChatTransferReport'][_0x5378('0x44')](_0x15d210)['then'](handleEntityNotFound(_0x53e2c0,null))[_0x5378('0x23')](respondWithResult(_0x53e2c0,null))[_0x5378('0x40')](handleError(_0x53e2c0,null));};exports[_0x5378('0x45')]=function(_0x41b9f4,_0x135090){return db[_0x5378('0x26')]['create'](_0x41b9f4[_0x5378('0x46')],{})[_0x5378('0x23')](respondWithResult(_0x135090,0xc9))[_0x5378('0x40')](handleError(_0x135090,null));};exports[_0x5378('0x21')]=function(_0x47fe14,_0x343c08){if(_0x47fe14[_0x5378('0x46')]['id']){delete _0x47fe14[_0x5378('0x46')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x47fe14[_0x5378('0x42')]['id']}})[_0x5378('0x23')](handleEntityNotFound(_0x343c08,null))[_0x5378('0x23')](saveUpdates(_0x47fe14[_0x5378('0x46')],null))[_0x5378('0x23')](respondWithResult(_0x343c08,null))[_0x5378('0x40')](handleError(_0x343c08,null));};exports['destroy']=function(_0x247fe3,_0x1f26a6){return db['ChatTransferReport'][_0x5378('0x44')]({'where':{'id':_0x247fe3[_0x5378('0x42')]['id']}})[_0x5378('0x23')](handleEntityNotFound(_0x1f26a6,null))['then'](removeEntity(_0x1f26a6,null))['catch'](handleError(_0x1f26a6,null));};exports[_0x5378('0x47')]=function(_0x3a7961,_0x50aa0c){return db['ChatTransferReport'][_0x5378('0x47')]()[_0x5378('0x23')](respondWithResult(_0x50aa0c,null))[_0x5378('0x40')](handleError(_0x50aa0c,null));}; \ No newline at end of file +var _0xedf5=['sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','describe','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2328f3,_0x48d111){var _0x2fc749=function(_0x43f897){while(--_0x43f897){_0x2328f3['push'](_0x2328f3['shift']());}};_0x2fc749(++_0x48d111);}(_0xedf5,0x10e));var _0x5edf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xedf5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5edf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5edf('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5edf('0x2'));var Mustache=require(_0x5edf('0x3'));var util=require('util');var path=require(_0x5edf('0x4'));var sox=require('sox');var csv=require(_0x5edf('0x5'));var ejs=require(_0x5edf('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5edf('0x7'));var squel=require(_0x5edf('0x8'));var crypto=require(_0x5edf('0x9'));var jsforce=require(_0x5edf('0xa'));var deskjs=require(_0x5edf('0xb'));var toCsv=require(_0x5edf('0x5'));var querystring=require('querystring');var Papa=require(_0x5edf('0xc'));var Redis=require(_0x5edf('0xd'));var authService=require(_0x5edf('0xe'));var qs=require(_0x5edf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5edf('0x10'));var logger=require(_0x5edf('0x11'))('api');var utils=require(_0x5edf('0x12'));var config=require(_0x5edf('0x13'));var licenseUtil=require(_0x5edf('0x14'));var db=require(_0x5edf('0x15'))['db'];function respondWithStatusCode(_0x22682b,_0x5ad188){_0x5ad188=_0x5ad188||0xcc;return function(_0x462d4f){if(_0x462d4f){return _0x22682b[_0x5edf('0x16')](_0x5ad188);}return _0x22682b['status'](_0x5ad188)['end']();};}function respondWithResult(_0x218d11,_0x5f2016){_0x5f2016=_0x5f2016||0xc8;return function(_0x36aa39){if(_0x36aa39){return _0x218d11[_0x5edf('0x17')](_0x5f2016)[_0x5edf('0x18')](_0x36aa39);}};}function respondWithFilteredResult(_0x98ea8b,_0x1129c6){return function(_0x56feba){if(_0x56feba){var _0x4905fa=typeof _0x1129c6['offset']===_0x5edf('0x19')&&typeof _0x1129c6[_0x5edf('0x1a')]===_0x5edf('0x19');var _0x223ee1=_0x56feba[_0x5edf('0x1b')];var _0x5f12d2=_0x4905fa?0x0:_0x1129c6[_0x5edf('0x1c')];var _0x1839e1=_0x4905fa?_0x56feba[_0x5edf('0x1b')]:_0x1129c6[_0x5edf('0x1c')]+_0x1129c6[_0x5edf('0x1a')];var _0xc20065;if(_0x1839e1>=_0x223ee1){_0x1839e1=_0x223ee1;_0xc20065=0xc8;}else{_0xc20065=0xce;}_0x98ea8b[_0x5edf('0x17')](_0xc20065);return _0x98ea8b['set'](_0x5edf('0x1d'),_0x5f12d2+'-'+_0x1839e1+'/'+_0x223ee1)[_0x5edf('0x18')](_0x56feba);}return null;};}function patchUpdates(_0x44e74c){return function(_0xbaade0){try{jsonpatch[_0x5edf('0x1e')](_0xbaade0,_0x44e74c,!![]);}catch(_0x20dade){return BPromise['reject'](_0x20dade);}return _0xbaade0[_0x5edf('0x1f')]();};}function saveUpdates(_0x347a34,_0x1679dd){return function(_0x1dee83){if(_0x1dee83){return _0x1dee83[_0x5edf('0x20')](_0x347a34)[_0x5edf('0x21')](function(_0x1a7b77){return _0x1a7b77;});}return null;};}function removeEntity(_0x312cb2,_0x4d7d79){return function(_0xced655){if(_0xced655){return _0xced655[_0x5edf('0x22')]()[_0x5edf('0x21')](function(){_0x312cb2[_0x5edf('0x17')](0xcc)[_0x5edf('0x23')]();});}};}function handleEntityNotFound(_0x240ad0,_0x891a3d){return function(_0xe3c0a9){if(!_0xe3c0a9){_0x240ad0[_0x5edf('0x16')](0x194);}return _0xe3c0a9;};}function handleError(_0x1ec19f,_0x195f5b){_0x195f5b=_0x195f5b||0x1f4;return function(_0x180893){logger['error'](_0x180893[_0x5edf('0x24')]);if(_0x180893[_0x5edf('0x25')]){delete _0x180893['name'];}_0x1ec19f['status'](_0x195f5b)[_0x5edf('0x26')](_0x180893);};}exports[_0x5edf('0x27')]=function(_0x23ee4c,_0xe765e){var _0x38a368={},_0xbe4a47={},_0x48698f={'count':0x0,'rows':[]};var _0x23c9b6=_[_0x5edf('0x28')](db[_0x5edf('0x29')][_0x5edf('0x2a')],function(_0x4bbbcf){return{'name':_0x4bbbcf[_0x5edf('0x2b')],'type':_0x4bbbcf['type'][_0x5edf('0x2c')]};});_0xbe4a47['model']=_[_0x5edf('0x28')](_0x23c9b6,_0x5edf('0x25'));_0xbe4a47[_0x5edf('0x2d')]=_[_0x5edf('0x2e')](_0x23ee4c[_0x5edf('0x2d')]);_0xbe4a47[_0x5edf('0x2f')]=_['intersection'](_0xbe4a47['model'],_0xbe4a47[_0x5edf('0x2d')]);_0x38a368[_0x5edf('0x30')]=_[_0x5edf('0x31')](_0xbe4a47[_0x5edf('0x32')],qs[_0x5edf('0x33')](_0x23ee4c[_0x5edf('0x2d')]['fields']));_0x38a368[_0x5edf('0x30')]=_0x38a368['attributes'][_0x5edf('0x34')]?_0x38a368['attributes']:_0xbe4a47[_0x5edf('0x32')];if(!_0x23ee4c['query'][_0x5edf('0x35')](_0x5edf('0x36'))){_0x38a368[_0x5edf('0x1a')]=qs['limit'](_0x23ee4c[_0x5edf('0x2d')][_0x5edf('0x1a')]);_0x38a368['offset']=qs[_0x5edf('0x1c')](_0x23ee4c[_0x5edf('0x2d')][_0x5edf('0x1c')]);}_0x38a368[_0x5edf('0x37')]=qs[_0x5edf('0x38')](_0x23ee4c[_0x5edf('0x2d')][_0x5edf('0x38')]);_0x38a368[_0x5edf('0x39')]=qs[_0x5edf('0x2f')](_['pick'](_0x23ee4c[_0x5edf('0x2d')],_0xbe4a47[_0x5edf('0x2f')]),_0x23c9b6);if(_0x23ee4c[_0x5edf('0x2d')][_0x5edf('0x3a')]){_0x38a368[_0x5edf('0x39')]=_['merge'](_0x38a368['where'],{'$or':_[_0x5edf('0x28')](_0x23c9b6,function(_0x2e4b60){if(_0x2e4b60[_0x5edf('0x3b')]!==_0x5edf('0x3c')){var _0x199d67={};_0x199d67[_0x2e4b60[_0x5edf('0x25')]]={'$like':'%'+_0x23ee4c[_0x5edf('0x2d')]['filter']+'%'};return _0x199d67;}})});}_0x38a368=_['merge']({},_0x38a368,_0x23ee4c[_0x5edf('0x3d')]);var _0x1f747e={'where':_0x38a368['where']};return db['ChatTransferReport'][_0x5edf('0x1b')](_0x1f747e)['then'](function(_0x394b52){_0x48698f['count']=_0x394b52;if(_0x23ee4c[_0x5edf('0x2d')][_0x5edf('0x3e')]){_0x38a368[_0x5edf('0x3f')]=[{'all':!![]}];}return db[_0x5edf('0x29')]['findAll'](_0x38a368);})['then'](function(_0x25e0d7){_0x48698f[_0x5edf('0x40')]=_0x25e0d7;return _0x48698f;})[_0x5edf('0x21')](respondWithFilteredResult(_0xe765e,_0x38a368))[_0x5edf('0x41')](handleError(_0xe765e,null));};exports[_0x5edf('0x42')]=function(_0xa53fd4,_0x31226b){var _0x139e6b={'raw':!![],'where':{'id':_0xa53fd4[_0x5edf('0x43')]['id']}},_0x5ce3e0={};_0x5ce3e0[_0x5edf('0x32')]=_[_0x5edf('0x2e')](db[_0x5edf('0x29')][_0x5edf('0x2a')]);_0x5ce3e0['query']=_[_0x5edf('0x2e')](_0xa53fd4['query']);_0x5ce3e0[_0x5edf('0x2f')]=_[_0x5edf('0x31')](_0x5ce3e0[_0x5edf('0x32')],_0x5ce3e0['query']);_0x139e6b['attributes']=_[_0x5edf('0x31')](_0x5ce3e0[_0x5edf('0x32')],qs[_0x5edf('0x33')](_0xa53fd4[_0x5edf('0x2d')][_0x5edf('0x33')]));_0x139e6b[_0x5edf('0x30')]=_0x139e6b[_0x5edf('0x30')][_0x5edf('0x34')]?_0x139e6b[_0x5edf('0x30')]:_0x5ce3e0[_0x5edf('0x32')];if(_0xa53fd4[_0x5edf('0x2d')][_0x5edf('0x3e')]){_0x139e6b[_0x5edf('0x3f')]=[{'all':!![]}];}_0x139e6b=_[_0x5edf('0x44')]({},_0x139e6b,_0xa53fd4[_0x5edf('0x3d')]);return db['ChatTransferReport'][_0x5edf('0x45')](_0x139e6b)['then'](handleEntityNotFound(_0x31226b,null))['then'](respondWithResult(_0x31226b,null))[_0x5edf('0x41')](handleError(_0x31226b,null));};exports[_0x5edf('0x46')]=function(_0xa6a7b8,_0x1fb776){return db[_0x5edf('0x29')][_0x5edf('0x46')](_0xa6a7b8['body'],{})[_0x5edf('0x21')](respondWithResult(_0x1fb776,0xc9))[_0x5edf('0x41')](handleError(_0x1fb776,null));};exports[_0x5edf('0x20')]=function(_0x116dda,_0x2ce7b3){if(_0x116dda[_0x5edf('0x47')]['id']){delete _0x116dda[_0x5edf('0x47')]['id'];}return db[_0x5edf('0x29')][_0x5edf('0x45')]({'where':{'id':_0x116dda[_0x5edf('0x43')]['id']}})[_0x5edf('0x21')](handleEntityNotFound(_0x2ce7b3,null))[_0x5edf('0x21')](saveUpdates(_0x116dda['body'],null))[_0x5edf('0x21')](respondWithResult(_0x2ce7b3,null))[_0x5edf('0x41')](handleError(_0x2ce7b3,null));};exports[_0x5edf('0x22')]=function(_0x461525,_0x2308ca){return db[_0x5edf('0x29')][_0x5edf('0x45')]({'where':{'id':_0x461525[_0x5edf('0x43')]['id']}})[_0x5edf('0x21')](handleEntityNotFound(_0x2308ca,null))[_0x5edf('0x21')](removeEntity(_0x2308ca,null))[_0x5edf('0x41')](handleError(_0x2308ca,null));};exports['describe']=function(_0x52ad2e,_0x14b658){return db[_0x5edf('0x29')][_0x5edf('0x48')]()[_0x5edf('0x21')](respondWithResult(_0x14b658,null))[_0x5edf('0x41')](handleError(_0x14b658,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 0842a63..412953d 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 _0x96d0=['../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0x96d0,0xcd));var _0x096d=function(_0x26fdc8,_0x2f70c1){_0x26fdc8=_0x26fdc8-0x0;var _0x574ebd=_0x96d0[_0x26fdc8];return _0x574ebd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x096d('0x0'))(_0x096d('0x1'));var moment=require(_0x096d('0x2'));var BPromise=require(_0x096d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x096d('0x4'));var attributes=require(_0x096d('0x5'));module[_0x096d('0x6')]=function(_0x338b4e,_0x430794){return _0x338b4e[_0x096d('0x7')](_0x096d('0x8'),attributes,{'tableName':_0x096d('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x096d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36a5=['path','rimraf','../../config/environment','./chatTransferReport.attributes','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3732d4,_0x46447d){var _0x155edf=function(_0x546c7f){while(--_0x546c7f){_0x3732d4['push'](_0x3732d4['shift']());}};_0x155edf(++_0x46447d);}(_0x36a5,0x7d));var _0x536a=function(_0x4dd2aa,_0x5037a9){_0x4dd2aa=_0x4dd2aa-0x0;var _0x1b24ad=_0x36a5[_0x4dd2aa];return _0x1b24ad;};'use strict';var _=require(_0x536a('0x0'));var util=require(_0x536a('0x1'));var logger=require(_0x536a('0x2'))(_0x536a('0x3'));var moment=require(_0x536a('0x4'));var BPromise=require(_0x536a('0x5'));var rp=require(_0x536a('0x6'));var fs=require('fs');var path=require(_0x536a('0x7'));var rimraf=require(_0x536a('0x8'));var config=require(_0x536a('0x9'));var attributes=require(_0x536a('0xa'));module['exports']=function(_0x30d282,_0x35ae4b){return _0x30d282['define']('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x536a('0xb'),'fields':[_0x536a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 3f6a4ad..919f83a 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 _0xe23a=['util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','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'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe23a,0xaf));var _0xae23=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0xe23a[_0x2c0dc0];return _0x4c0990;};'use strict';var _=require(_0xae23('0x0'));var util=require(_0xae23('0x1'));var moment=require(_0xae23('0x2'));var BPromise=require(_0xae23('0x3'));var rs=require(_0xae23('0x4'));var fs=require('fs');var Redis=require(_0xae23('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xae23('0x6'));var config=require(_0xae23('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xae23('0x8')][_0xae23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e41d,_0x4c3794,_0x5b3b72){return new BPromise(function(_0xb6640c,_0x3e2bb1){return client[_0xae23('0xa')](_0x23e41d,_0x5b3b72)[_0xae23('0xb')](function(_0x2134be){logger[_0xae23('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x4c3794,_0xae23('0xd'));logger[_0xae23('0xe')](_0xae23('0xf'),_0x4c3794,_0xae23('0xd'),JSON[_0xae23('0x10')](_0x2134be));if(_0x2134be[_0xae23('0x11')]){if(_0x2134be['error'][_0xae23('0x12')]===0x1f4){logger[_0xae23('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x4c3794,_0x2134be[_0xae23('0x11')][_0xae23('0x13')]);return _0x3e2bb1(_0x2134be[_0xae23('0x11')]['message']);}logger[_0xae23('0x11')](_0xae23('0x14'),_0x4c3794,_0x2134be['error'][_0xae23('0x13')]);return _0xb6640c(_0x2134be[_0xae23('0x11')][_0xae23('0x13')]);}else{logger[_0xae23('0xc')](_0xae23('0x14'),_0x4c3794,'request\x20sent');_0xb6640c(_0x2134be['result']['message']);}})[_0xae23('0x15')](function(_0x38f8e1){logger[_0xae23('0x11')](_0xae23('0x14'),_0x4c3794,_0x38f8e1);_0x3e2bb1(_0x38f8e1);});});} \ No newline at end of file +var _0xd55f=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xd55f,0x149));var _0xfd55=function(_0x925a4f,_0x124a3f){_0x925a4f=_0x925a4f-0x0;var _0x50120a=_0xd55f[_0x925a4f];return _0x50120a;};'use strict';var _=require(_0xfd55('0x0'));var util=require(_0xfd55('0x1'));var moment=require(_0xfd55('0x2'));var BPromise=require(_0xfd55('0x3'));var rs=require(_0xfd55('0x4'));var fs=require('fs');var Redis=require(_0xfd55('0x5'));var db=require(_0xfd55('0x6'))['db'];var utils=require(_0xfd55('0x7'));var logger=require(_0xfd55('0x8'))(_0xfd55('0x9'));var config=require(_0xfd55('0xa'));var jayson=require(_0xfd55('0xb'));var client=jayson[_0xfd55('0xc')][_0xfd55('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x33a879,_0x1a727b,_0xfd4c1){return new BPromise(function(_0x2f5cc8,_0x2537db){return client['request'](_0x33a879,_0xfd4c1)['then'](function(_0x3c5e13){logger[_0xfd55('0xe')](_0xfd55('0xf'),_0x1a727b,_0xfd55('0x10'));logger[_0xfd55('0x11')](_0xfd55('0x12'),_0x1a727b,_0xfd55('0x10'),JSON[_0xfd55('0x13')](_0x3c5e13));if(_0x3c5e13[_0xfd55('0x14')]){if(_0x3c5e13[_0xfd55('0x14')][_0xfd55('0x15')]===0x1f4){logger[_0xfd55('0x14')](_0xfd55('0xf'),_0x1a727b,_0x3c5e13[_0xfd55('0x14')][_0xfd55('0x16')]);return _0x2537db(_0x3c5e13[_0xfd55('0x14')][_0xfd55('0x16')]);}logger[_0xfd55('0x14')](_0xfd55('0xf'),_0x1a727b,_0x3c5e13['error'][_0xfd55('0x16')]);return _0x2f5cc8(_0x3c5e13['error']['message']);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x1a727b,_0xfd55('0x10'));_0x2f5cc8(_0x3c5e13[_0xfd55('0x17')][_0xfd55('0x16')]);}})[_0xfd55('0x18')](function(_0x5ec6fa){logger[_0xfd55('0x14')](_0xfd55('0xf'),_0x1a727b,_0x5ec6fa);_0x2537db(_0x5ec6fa);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index f07bf1f..b8bf205 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 _0xa99c=['/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','isAuthenticated','describe','post'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xa99c,0x15a));var _0xca99=function(_0x368f76,_0x136ee8){_0x368f76=_0x368f76-0x0;var _0x86935e=_0xa99c[_0x368f76];return _0x86935e;};'use strict';var multer=require(_0xca99('0x0'));var util=require(_0xca99('0x1'));var path=require('path');var timeout=require(_0xca99('0x2'));var express=require(_0xca99('0x3'));var router=express[_0xca99('0x4')]();var fs_extra=require(_0xca99('0x5'));var auth=require(_0xca99('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xca99('0x7'));var controller=require(_0xca99('0x8'));router[_0xca99('0x9')]('/',auth['isAuthenticated'](),controller[_0xca99('0xa')]);router[_0xca99('0x9')](_0xca99('0xb'),auth[_0xca99('0xc')](),controller[_0xca99('0xd')]);router[_0xca99('0x9')]('/:id',auth[_0xca99('0xc')](),controller['show']);router[_0xca99('0xe')]('/',auth[_0xca99('0xc')](),controller['create']);router['put'](_0xca99('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xca99('0x10')](_0xca99('0xf'),auth[_0xca99('0xc')](),controller[_0xca99('0x11')]);module[_0xca99('0x12')]=router; \ No newline at end of file +var _0x41a0=['./chatTransferReport.controller','get','index','/describe','/:id','isAuthenticated','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x41a0,0x123));var _0x041a=function(_0x2efd9a,_0x2bd7d8){_0x2efd9a=_0x2efd9a-0x0;var _0x20c413=_0x41a0[_0x2efd9a];return _0x20c413;};'use strict';var multer=require('multer');var util=require(_0x041a('0x0'));var path=require(_0x041a('0x1'));var timeout=require(_0x041a('0x2'));var express=require(_0x041a('0x3'));var router=express[_0x041a('0x4')]();var fs_extra=require(_0x041a('0x5'));var auth=require(_0x041a('0x6'));var interaction=require(_0x041a('0x7'));var config=require(_0x041a('0x8'));var controller=require(_0x041a('0x9'));router[_0x041a('0xa')]('/',auth['isAuthenticated'](),controller[_0x041a('0xb')]);router['get'](_0x041a('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x041a('0xa')](_0x041a('0xd'),auth[_0x041a('0xe')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x041a('0xf')]);router[_0x041a('0x10')](_0x041a('0xd'),auth[_0x041a('0xe')](),controller[_0x041a('0x11')]);router[_0x041a('0x12')](_0x041a('0xd'),auth[_0x041a('0xe')](),controller['destroy']);module[_0x041a('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index f80dad1..5236685 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 _0x5617=['Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','TEXT','stringify','input','name','onlineForm','setDataValue','Comments','getDataValue','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5617,0x13d));var _0x7561=function(_0xa3400,_0x3a980a){_0xa3400=_0xa3400-0x0;var _0x33dba2=_0x5617[_0xa3400];return _0x33dba2;};'use strict';var Sequelize=require(_0x7561('0x0'));var rs=require(_0x7561('0x1'));module[_0x7561('0x2')]={'name':{'type':Sequelize[_0x7561('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x7561('0x3')],'allowNull':![],'unique':_0x7561('0x4')},'description':{'type':Sequelize[_0x7561('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x5')},'mapKeyOffline':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x7561('0x3')],'allowNull':![],'defaultValue':_0x7561('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x7561('0x3')],'allowNull':![],'defaultValue':_0x7561('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x7561('0x3')],'allowNull':![],'defaultValue':_0x7561('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x7561('0x3')],'allowNull':![],'defaultValue':_0x7561('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x7561('0x3')]},'animation':{'type':Sequelize[_0x7561('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x7561('0xa'),_0x7561('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0xc')},'start_chat_button':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0xe')},'header_offline':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0xf')},'download_transcript':{'type':Sequelize[_0x7561('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x7561('0x10')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x7561('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x7561('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x13')},'noteTitle':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x14')},'placeholderMessage':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x16')},'closingMessageButton':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0xe')},'skipMessageButton':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x17')},'conditionAgreement':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x18')},'ratingType':{'type':Sequelize[_0x7561('0x19')](_0x7561('0x1a'),_0x7561('0x1b')),'defaultValue':_0x7561('0x1a')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x7561('0x1c')],'defaultValue':function(){return JSON[_0x7561('0x1d')]({'items':[{'type':_0x7561('0x1e'),'variable':null,'config':{'placeholder':_0x7561('0x1f'),'type':'text','required':!![]},'props':{'title':_0x7561('0x1f'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x7561('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x7561('0x20'))?JSON['parse'](this['getDataValue'](_0x7561('0x20'))):{};},'set':function(_0x2b7061){return this[_0x7561('0x21')](_0x7561('0x20'),JSON[_0x7561('0x1d')](_0x2b7061));}},'offlineForm':{'type':Sequelize[_0x7561('0x1c')],'defaultValue':function(){return JSON[_0x7561('0x1d')]({'items':[{'type':_0x7561('0x1e'),'props':{'title':_0x7561('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x7561('0x5'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x7561('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x7561('0x23')](_0x7561('0x24'))?JSON[_0x7561('0x25')](this['getDataValue'](_0x7561('0x24'))):{};},'set':function(_0x476ff3){return this[_0x7561('0x21')](_0x7561('0x24'),JSON['stringify'](_0x476ff3));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7561('0x26')]();}},'autoclose':{'type':Sequelize[_0x7561('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x7561('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x27')},'waitingMessage':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x28')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x29')},'offlineMessageBody':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0x7561('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x2b')},'skipUnmanaged':{'type':Sequelize[_0x7561('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x7561('0x1c')]},'showAgentAvatar':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x7561('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7561('0x1c')],'defaultValue':function(){return _0x7561('0x2c');}},'notificationSound':{'type':Sequelize[_0x7561('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x7561('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7561('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x2d')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x7561('0x2e')},'messagesAlignment':{'type':Sequelize[_0x7561('0x3')],'defaultValue':_0x7561('0x2f')},'defaultTitle':{'type':Sequelize[_0x7561('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7561('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7561('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7561('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x7561('0x1c')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x7561('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![],'comment':_0x7561('0x32'),'set':function(_0x4d30ba){if(!_0x4d30ba)this[_0x7561('0x21')](_0x7561('0x33'),null);this[_0x7561('0x21')](_0x7561('0x34'),_0x4d30ba);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x7561('0x3')]},'vidaooTopic':{'type':Sequelize[_0x7561('0x3')],'allowNull':![],'defaultValue':_0x7561('0x35')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x7561('0x36');}},'vidaooMetadata':{'type':Sequelize[_0x7561('0x1c')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x7561('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x7561('0x1c')]}}; \ No newline at end of file +var _0x8a2f=['squared','We\x20are\x20here!','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','ENUM','star','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','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','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded'];(function(_0x40ff89,_0x22ea0c){var _0x462cab=function(_0x1a7edf){while(--_0x1a7edf){_0x40ff89['push'](_0x40ff89['shift']());}};_0x462cab(++_0x22ea0c);}(_0x8a2f,0xcf));var _0xf8a2=function(_0x3e49cb,_0x429d1f){_0x3e49cb=_0x3e49cb-0x0;var _0x270b16=_0x8a2f[_0x3e49cb];return _0x270b16;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf8a2('0x0'));module[_0xf8a2('0x1')]={'name':{'type':Sequelize[_0xf8a2('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xf8a2('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf8a2('0x2')],'allowNull':![],'defaultValue':_0xf8a2('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf8a2('0x2')],'allowNull':![],'defaultValue':_0xf8a2('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf8a2('0x2')],'allowNull':![],'defaultValue':_0xf8a2('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xf8a2('0x2')],'allowNull':![],'defaultValue':_0xf8a2('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf8a2('0x2')]},'animation':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xf8a2('0x8'),_0xf8a2('0x9')),'defaultValue':_0xf8a2('0x8')},'header_online':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0xa')},'start_chat_button':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0xb')},'header_offline':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0xc')},'download_transcript':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf8a2('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf8a2('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xf8a2('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x12')},'noteTitle':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x13')},'placeholderMessage':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x14')},'closingMessage':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x15')},'closingMessageButton':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0xb')},'skipMessageButton':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x16')},'conditionAgreement':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xf8a2('0x17')](_0xf8a2('0x18'),'thumb'),'defaultValue':_0xf8a2('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xf8a2('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf8a2('0xf')],'defaultValue':function(){return JSON[_0xf8a2('0x19')]({'items':[{'type':_0xf8a2('0x1a'),'variable':null,'config':{'placeholder':_0xf8a2('0x1b'),'type':_0xf8a2('0x1c'),'required':!![]},'props':{'title':_0xf8a2('0x1b'),'helpText':''}},{'type':_0xf8a2('0x1a'),'props':{'title':_0xf8a2('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf8a2('0x3'),'type':_0xf8a2('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf8a2('0x1d')](_0xf8a2('0x1e'))?JSON[_0xf8a2('0x1f')](this['getDataValue'](_0xf8a2('0x1e'))):{};},'set':function(_0x425af4){return this['setDataValue'](_0xf8a2('0x1e'),JSON[_0xf8a2('0x19')](_0x425af4));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xf8a2('0x1a'),'props':{'title':_0xf8a2('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf8a2('0x3'),'type':_0xf8a2('0x3')},'variable':null},{'type':_0xf8a2('0x20'),'config':{'placeholder':_0xf8a2('0x21')},'props':{'title':'Comments','helpText':_0xf8a2('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xf8a2('0x1d')](_0xf8a2('0x23'))?JSON[_0xf8a2('0x1f')](this[_0xf8a2('0x1d')](_0xf8a2('0x23'))):{};},'set':function(_0x2ffdf2){return this['setDataValue'](_0xf8a2('0x23'),JSON[_0xf8a2('0x19')](_0x2ffdf2));}},'token':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':function(){return rs[_0xf8a2('0x24')]();}},'autoclose':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf8a2('0x2')]},'forwardOffline':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf8a2('0x2')]},'waitingTitle':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x25')},'waitingMessage':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x26')},'offlineMessageSubject':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x28')},'skipUnmanaged':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x16')},'sendUnmanaged':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf8a2('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf8a2('0xf')],'defaultValue':function(){return _0xf8a2('0x29');}},'notificationSound':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf8a2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x2b')},'verticalAlignment':{'type':Sequelize[_0xf8a2('0xd')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x2c')},'messagesAlignment':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':_0xf8a2('0x2d')},'defaultTitle':{'type':Sequelize[_0xf8a2('0x2')]},'customerAvatar':{'type':Sequelize[_0xf8a2('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf8a2('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf8a2('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf8a2('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xf8a2('0x2e')},'systemAvatar':{'type':Sequelize[_0xf8a2('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf8a2('0xd')],'comment':_0xf8a2('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf8a2('0x30'),'set':function(_0x4e8d63){if(!_0x4e8d63)this[_0xf8a2('0x31')](_0xf8a2('0x32'),null);this[_0xf8a2('0x31')](_0xf8a2('0x33'),_0x4e8d63);}},'vidaooEscalation':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf8a2('0x34')},'vidaooNote':{'type':Sequelize[_0xf8a2('0x2')],'defaultValue':function(){return _0xf8a2('0x35');}},'vidaooMetadata':{'type':Sequelize[_0xf8a2('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf8a2('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf8a2('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index c0516ec..4c85bfa 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 _0x4c4e=['color_button','backgroundColor','hideWhenOffline','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','omit','getProactiveActions','ChatProactiveAction','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','removeAgents','isArray','emit','getAgents','mustache','path','ejs','fs-extra','querystring','html-to-text','ioredis','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','status','undefined','limit','count','offset','Content-Range','json','update','destroy','get','ChatWebsites','UserProfileResource','end','sendStatus','stack','name','send','user-agent-parser','setUA','user-agent','getResult','cf-connecting-ip','first','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','model','%s\x20%s\x20%s','vendor','type','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','intersection','body','split','forEach','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','testWildcardValidity','Pause','describe','addDisposition','Disposition','getDispositions','findOne','ChatWebsiteId','rows','removeDispositions','ids','addAnswer','CannedAnswer','nolimit','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','sitepic','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','resolve','ifTime','notify','chat','from','From\x20is\x20mandatory','isEmpty','customerIp','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','mapKey','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','ValidationError','no\x20available\x20attributes','difference','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','Tag','Tags','color','tag','findAll','getSnippet','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','origin','http://localhost:9000','address','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textButtonColor'];(function(_0x5201dc,_0x1824ac){var _0x1e3a33=function(_0xca6856){while(--_0xca6856){_0x5201dc['push'](_0x5201dc['shift']());}};_0x1e3a33(++_0x1824ac);}(_0x4c4e,0x152));var _0xe4c4=function(_0x4182ad,_0x80b112){_0x4182ad=_0x4182ad-0x0;var _0x3809d6=_0x4c4e[_0x4182ad];return _0x3809d6;};'use strict';var Mustache=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var ejs=require(_0xe4c4('0x2'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x3'));var _=require('lodash');var querystring=require(_0xe4c4('0x4'));var htmlToText=require(_0xe4c4('0x5'));var Redis=require(_0xe4c4('0x6'));var jayson=require('jayson/promise');var qs=require(_0xe4c4('0x7'));var logger=require('../../config/logger')(_0xe4c4('0x8'));var config=require(_0xe4c4('0x9'));var APIBadRequestError=require(_0xe4c4('0xa'))[_0xe4c4('0xb')];var APINotFoundError=require(_0xe4c4('0xa'))[_0xe4c4('0xc')];var APIOutOfIntervalError=require(_0xe4c4('0xa'))[_0xe4c4('0xd')];var APIHandleError=require('../../errors/api')['handleError'];var APIConflictError=require(_0xe4c4('0xa'))[_0xe4c4('0xe')];var wildcardUtils=require(_0xe4c4('0xf'));var URL=require(_0xe4c4('0x10'))[_0xe4c4('0x11')];var db=require(_0xe4c4('0x12'))['db'];config['redis']=_[_0xe4c4('0x13')](config[_0xe4c4('0x14')],{'host':_0xe4c4('0x15'),'port':0x18eb});var socket=require(_0xe4c4('0x16'))(new Redis(config['redis']));require(_0xe4c4('0x17'))[_0xe4c4('0x18')](socket);var client=jayson['client'][_0xe4c4('0x19')]({'port':0x232c});var client9002=jayson[_0xe4c4('0x1a')]['http']({'port':0x232a});var client9003=jayson[_0xe4c4('0x1a')][_0xe4c4('0x19')]({'port':0x232b});var client9001=jayson['client'][_0xe4c4('0x19')]({'port':0x2329});function respondWithRpcPromise(_0x465c9b,_0x26ea05,_0x40a36e,_0x19e59b){return new Promise(function(_0x882be2,_0x1f637e){var _0x1038cb=_0x19e59b||client;return _0x1038cb[_0xe4c4('0x1b')](_0x465c9b,_0x40a36e)[_0xe4c4('0x1c')](function(_0x23b7e6){logger[_0xe4c4('0x1d')](_0xe4c4('0x1e'),_0x26ea05,_0xe4c4('0x1f'));logger[_0xe4c4('0x20')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x26ea05,_0xe4c4('0x1f'),JSON[_0xe4c4('0x21')](_0x23b7e6));if(_0x23b7e6[_0xe4c4('0x22')]){if(_0x23b7e6[_0xe4c4('0x22')]['code']===0x1f4){logger[_0xe4c4('0x22')](_0xe4c4('0x1e'),_0x26ea05,_0x23b7e6[_0xe4c4('0x22')][_0xe4c4('0x23')]);return _0x1f637e(_0x23b7e6[_0xe4c4('0x22')][_0xe4c4('0x23')]);}logger[_0xe4c4('0x22')](_0xe4c4('0x1e'),_0x26ea05,_0x23b7e6[_0xe4c4('0x22')][_0xe4c4('0x23')]);return _0x882be2(_0x23b7e6[_0xe4c4('0x22')][_0xe4c4('0x23')]);}else{logger[_0xe4c4('0x1d')](_0xe4c4('0x1e'),_0x26ea05,_0xe4c4('0x1f'));_0x882be2(_0x23b7e6['result']['message']);}})[_0xe4c4('0x24')](function(_0x4dc8cc){logger[_0xe4c4('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x26ea05,_0x4dc8cc);_0x1f637e(_0x4dc8cc);});});}function respondWithStatusCode(_0x3adfcb,_0x5efc4c){_0x5efc4c=_0x5efc4c||0xcc;return function(_0x34d667){if(_0x34d667){return _0x3adfcb['sendStatus'](_0x5efc4c);}return _0x3adfcb[_0xe4c4('0x25')](_0x5efc4c)['end']();};}function respondWithResult(_0x5a2adb,_0x4cea1f){_0x4cea1f=_0x4cea1f||0xc8;return function(_0x5d66ab){if(_0x5d66ab){return _0x5a2adb[_0xe4c4('0x25')](_0x4cea1f)['json'](_0x5d66ab);}};}function respondWithFilteredResult(_0x5b5ea5,_0xe2c1b4){return function(_0x11deab){if(_0x11deab){var _0x4bb911=typeof _0xe2c1b4['offset']===_0xe4c4('0x26')&&typeof _0xe2c1b4[_0xe4c4('0x27')]==='undefined';var _0x158432=_0x11deab[_0xe4c4('0x28')];var _0x3f60fc=_0x4bb911?0x0:_0xe2c1b4['offset'];var _0x5d49fd=_0x4bb911?_0x11deab[_0xe4c4('0x28')]:_0xe2c1b4[_0xe4c4('0x29')]+_0xe2c1b4[_0xe4c4('0x27')];var _0x237dd6;if(_0x5d49fd>=_0x158432){_0x5d49fd=_0x158432;_0x237dd6=0xc8;}else{_0x237dd6=0xce;}_0x5b5ea5['status'](_0x237dd6);return _0x5b5ea5['set'](_0xe4c4('0x2a'),_0x3f60fc+'-'+_0x5d49fd+'/'+_0x158432)[_0xe4c4('0x2b')](_0x11deab);}return null;};}function saveUpdates(_0x5d0ba5){return function(_0x3e18e1){if(_0x3e18e1){return _0x3e18e1[_0xe4c4('0x2c')](_0x5d0ba5)[_0xe4c4('0x1c')](function(_0x59b5d1){return _0x59b5d1;});}return null;};}function removeEntity(_0x137f40){return function(_0x5976bc){if(_0x5976bc){return _0x5976bc[_0xe4c4('0x2d')]()[_0xe4c4('0x1c')](function(){var _0x3bb6cf=_0x5976bc[_0xe4c4('0x2e')]({'plain':!![]});var _0x2bd5c1=_0xe4c4('0x2f');return db[_0xe4c4('0x30')][_0xe4c4('0x2d')]({'where':{'type':_0x2bd5c1,'resourceId':_0x3bb6cf['id']}})[_0xe4c4('0x1c')](function(){return _0x5976bc;});})[_0xe4c4('0x1c')](function(){_0x137f40[_0xe4c4('0x25')](0xcc)[_0xe4c4('0x31')]();});}};}function handleEntityNotFound(_0x5cc2a8){return function(_0x21fce3){if(!_0x21fce3){_0x5cc2a8[_0xe4c4('0x32')](0x194);}return _0x21fce3;};}function handleError(_0x3d598a,_0x518018){_0x518018=_0x518018||0x1f4;return function(_0xac6cb4){logger[_0xe4c4('0x22')](_0xac6cb4[_0xe4c4('0x33')]);if(_0xac6cb4['name']){delete _0xac6cb4[_0xe4c4('0x34')];}_0x3d598a[_0xe4c4('0x25')](_0x518018)[_0xe4c4('0x35')](_0xac6cb4);};}function createInteractionObject(_0x1de955,_0x413ec9,_0x10f243,_0x2f8a21){var _0x44f4eb=require(_0xe4c4('0x36'));var _0x8b5bf3=new _0x44f4eb();var _0x5bb519=_0x8b5bf3[_0xe4c4('0x37')](_0x10f243[_0xe4c4('0x38')])[_0xe4c4('0x39')]();var _0x3c16a5=_0x413ec9['customerIp'];if(_0x10f243[_0xe4c4('0x3a')]){_0x3c16a5=_0x10f243[_0xe4c4('0x3a')];}else if(_0x10f243['x-forwarded-for']){_0x3c16a5=_[_0xe4c4('0x3b')](_0x10f243[_0xe4c4('0x3c')]['split'](','));}return{'ContactId':_0x2f8a21['id'],'ChatWebsiteId':_0x1de955,'from':(_0x2f8a21[_0xe4c4('0x3d')]||'')+'\x20'+(_0x2f8a21[_0xe4c4('0x3e')]||''),'customerIp':_0x3c16a5,'customerPort':_0x10f243[_0xe4c4('0x3f')]?_0x10f243[_0xe4c4('0x3f')]:null,'referer':_0x413ec9[_0xe4c4('0x40')],'browserName':_0x5bb519[_0xe4c4('0x41')][_0xe4c4('0x34')]&&_0x5bb519[_0xe4c4('0x41')][_0xe4c4('0x42')]?util[_0xe4c4('0x43')](_0xe4c4('0x44'),_0x5bb519[_0xe4c4('0x41')]['name'],_0x5bb519[_0xe4c4('0x41')][_0xe4c4('0x42')]):_0xe4c4('0x45'),'browserVersion':_0x5bb519[_0xe4c4('0x41')][_0xe4c4('0x42')]||_0xe4c4('0x45'),'osName':util['format'](_0xe4c4('0x44'),_0x5bb519['os']['name'],_0x5bb519['os'][_0xe4c4('0x42')]),'osVersion':_0x5bb519['os'][_0xe4c4('0x42')],'deviceModel':_0x5bb519[_0xe4c4('0x46')][_0xe4c4('0x47')]&&_0x5bb519[_0xe4c4('0x46')]['vendor']?util['format'](_0xe4c4('0x48'),_0x5bb519[_0xe4c4('0x46')][_0xe4c4('0x47')],_0x5bb519['device'][_0xe4c4('0x49')],_0x5bb519[_0xe4c4('0x46')][_0xe4c4('0x4a')]):null,'deviceVendor':_0x5bb519[_0xe4c4('0x46')]['vendor'],'deviceType':_0x5bb519[_0xe4c4('0x46')][_0xe4c4('0x4a')],'formData':JSON[_0xe4c4('0x21')](_0x413ec9)};}exports[_0xe4c4('0x4b')]=function(_0x6bf1ee,_0x1e459e){var _0x1eda5e={'include':[{'model':db['Pause'],'as':_0xe4c4('0x4c')}]},_0x176712={},_0x3ee4db={'count':0x0,'rows':[]};var _0x5d9b27=_[_0xe4c4('0x4d')](db[_0xe4c4('0x4e')][_0xe4c4('0x4f')],function(_0x15e595){return{'name':_0x15e595[_0xe4c4('0x50')],'type':_0x15e595[_0xe4c4('0x4a')][_0xe4c4('0x51')]};});_0x176712[_0xe4c4('0x47')]=_[_0xe4c4('0x4d')](_0x5d9b27,_0xe4c4('0x34'));_0x176712[_0xe4c4('0x52')]=_[_0xe4c4('0x53')](_0x6bf1ee[_0xe4c4('0x52')]);_0x176712[_0xe4c4('0x54')]=_['intersection'](_0x176712['model'],_0x176712[_0xe4c4('0x52')]);_0x1eda5e[_0xe4c4('0x55')]=_['intersection'](_0x176712[_0xe4c4('0x47')],qs[_0xe4c4('0x56')](_0x6bf1ee[_0xe4c4('0x52')][_0xe4c4('0x56')]));_0x1eda5e[_0xe4c4('0x55')]=_0x1eda5e['attributes'][_0xe4c4('0x57')]?_0x1eda5e[_0xe4c4('0x55')]:_0x176712['model'];if(!_0x6bf1ee[_0xe4c4('0x52')][_0xe4c4('0x58')]('nolimit')){_0x1eda5e[_0xe4c4('0x27')]=qs['limit'](_0x6bf1ee[_0xe4c4('0x52')][_0xe4c4('0x27')]);_0x1eda5e[_0xe4c4('0x29')]=qs[_0xe4c4('0x29')](_0x6bf1ee[_0xe4c4('0x52')]['offset']);}_0x1eda5e[_0xe4c4('0x59')]=qs[_0xe4c4('0x5a')](_0x6bf1ee[_0xe4c4('0x52')][_0xe4c4('0x5a')]);_0x1eda5e[_0xe4c4('0x5b')]=qs[_0xe4c4('0x54')](_[_0xe4c4('0x5c')](_0x6bf1ee[_0xe4c4('0x52')],_0x176712[_0xe4c4('0x54')]),_0x5d9b27);if(_0x6bf1ee[_0xe4c4('0x52')][_0xe4c4('0x5d')]){_0x1eda5e[_0xe4c4('0x5b')]=_[_0xe4c4('0x5e')](_0x1eda5e[_0xe4c4('0x5b')],{'$or':_[_0xe4c4('0x4d')](_0x5d9b27,function(_0x338cf5){if(_0x338cf5['type']!==_0xe4c4('0x5f')){var _0x4a2ae9={};_0x4a2ae9[_0x338cf5[_0xe4c4('0x34')]]={'$like':'%'+_0x6bf1ee['query'][_0xe4c4('0x5d')]+'%'};return _0x4a2ae9;}})});}_0x1eda5e=_[_0xe4c4('0x5e')]({},_0x1eda5e,_0x6bf1ee[_0xe4c4('0x60')]);var _0x512ca9={'where':_0x1eda5e[_0xe4c4('0x5b')]};return db['ChatWebsite'][_0xe4c4('0x28')](_0x512ca9)[_0xe4c4('0x1c')](function(_0x1cef48){_0x3ee4db['count']=_0x1cef48;if(_0x6bf1ee['query'][_0xe4c4('0x61')]){_0x1eda5e[_0xe4c4('0x62')]=[{'all':!![]}];}return db[_0xe4c4('0x4e')]['findAll'](_0x1eda5e);})[_0xe4c4('0x1c')](function(_0x5c45f8){_0x3ee4db['rows']=_0x5c45f8;return _0x3ee4db;})['then'](respondWithFilteredResult(_0x1e459e,_0x1eda5e))['catch'](handleError(_0x1e459e,null));};exports[_0xe4c4('0x63')]=function(_0x3a06da,_0x1d89ff){var _0x2ea066={'raw':![],'where':{'id':_0x3a06da[_0xe4c4('0x64')]['id']},'include':[{'model':db['Pause'],'as':_0xe4c4('0x4c')}]},_0x4456e8={};_0x4456e8[_0xe4c4('0x47')]=_[_0xe4c4('0x53')](db[_0xe4c4('0x4e')][_0xe4c4('0x4f')]);_0x4456e8[_0xe4c4('0x52')]=_['keys'](_0x3a06da['query']);_0x4456e8[_0xe4c4('0x54')]=_[_0xe4c4('0x65')](_0x4456e8[_0xe4c4('0x47')],_0x4456e8[_0xe4c4('0x52')]);_0x2ea066[_0xe4c4('0x55')]=_[_0xe4c4('0x65')](_0x4456e8[_0xe4c4('0x47')],qs[_0xe4c4('0x56')](_0x3a06da[_0xe4c4('0x52')]['fields']));_0x2ea066['attributes']=_0x2ea066[_0xe4c4('0x55')]['length']?_0x2ea066[_0xe4c4('0x55')]:_0x4456e8[_0xe4c4('0x47')];if(_0x3a06da[_0xe4c4('0x52')]['includeAll']){_0x2ea066[_0xe4c4('0x62')]=[{'all':!![]}];}_0x2ea066=_['merge']({},_0x2ea066,_0x3a06da[_0xe4c4('0x60')]);return db['ChatWebsite']['find'](_0x2ea066)[_0xe4c4('0x1c')](handleEntityNotFound(_0x1d89ff,null))[_0xe4c4('0x1c')](respondWithResult(_0x1d89ff,null))[_0xe4c4('0x24')](handleError(_0x1d89ff,null));};exports['create']=function(_0x57e38e,_0x4879f9){var _0x1f91f4=null;_0x57e38e[_0xe4c4('0x66')]['address'][_0xe4c4('0x67')](',')[_0xe4c4('0x68')](_0x11115a=>{if(_0x11115a['trim']()!==''&&!wildcardUtils['testWildcardValidity'](_0x11115a[_0xe4c4('0x69')]())){_0x1f91f4=new APIBadRequestError('\x22'+_0x11115a[_0xe4c4('0x69')]()+_0xe4c4('0x6a'));}});if(_0x1f91f4){return handleError(_0x4879f9,null)(_0x1f91f4);}return db[_0xe4c4('0x4e')][_0xe4c4('0x6b')](_0x57e38e[_0xe4c4('0x66')],{})['then'](function(_0x38dd83){var _0x1bddd5=_0x57e38e[_0xe4c4('0x6c')]['get']({'plain':!![]});if(!_0x1bddd5)throw new Error(_0xe4c4('0x6d'));if(_0x1bddd5[_0xe4c4('0x6e')]===_0xe4c4('0x6c')){var _0x57998c=_0x38dd83['get']({'plain':!![]});var _0x2043a8='ChatWebsites';return db['UserProfileSection'][_0xe4c4('0x6f')]({'where':{'name':_0x2043a8,'userProfileId':_0x1bddd5[_0xe4c4('0x70')]},'raw':!![]})[_0xe4c4('0x1c')](function(_0x49d80b){if(_0x49d80b&&_0x49d80b[_0xe4c4('0x71')]===0x0){return db[_0xe4c4('0x30')][_0xe4c4('0x6b')]({'name':_0x57998c[_0xe4c4('0x34')],'resourceId':_0x57998c['id'],'type':_0x49d80b['name'],'sectionId':_0x49d80b['id']},{})[_0xe4c4('0x1c')](function(){return _0x38dd83;});}else{return _0x38dd83;}})[_0xe4c4('0x24')](function(_0x4bb16e){logger['error'](_0xe4c4('0x72'),_0x4bb16e);throw _0x4bb16e;});}return _0x38dd83;})[_0xe4c4('0x1c')](respondWithResult(_0x4879f9,0xc9))[_0xe4c4('0x24')](handleError(_0x4879f9,null));};exports[_0xe4c4('0x2c')]=function(_0x54c386,_0x369ecc){var _0x25e84f=null;_0x54c386[_0xe4c4('0x66')]['address']['split'](',')[_0xe4c4('0x68')](_0x2be1d8=>{if(_0x2be1d8[_0xe4c4('0x69')]()!==''&&!wildcardUtils[_0xe4c4('0x73')](_0x2be1d8['trim']())){_0x25e84f=new APIBadRequestError('\x22'+_0x2be1d8['trim']()+_0xe4c4('0x6a'));}});if(_0x25e84f){return handleError(_0x369ecc,null)(_0x25e84f);}if(_0x54c386[_0xe4c4('0x66')]['id']){delete _0x54c386[_0xe4c4('0x66')]['id'];}return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'where':{'id':_0x54c386['params']['id']},'include':[{'model':db[_0xe4c4('0x74')],'as':'mandatoryDispositionPause'}]})[_0xe4c4('0x1c')](handleEntityNotFound(_0x369ecc,null))[_0xe4c4('0x1c')](saveUpdates(_0x54c386['body'],null))['then'](respondWithResult(_0x369ecc,null))[_0xe4c4('0x24')](handleError(_0x369ecc,null));};exports[_0xe4c4('0x2d')]=function(_0x250bb8,_0x1f880f){return db[_0xe4c4('0x4e')]['find']({'where':{'id':_0x250bb8['params']['id']}})['then'](handleEntityNotFound(_0x1f880f,null))[_0xe4c4('0x1c')](removeEntity(_0x1f880f,null))[_0xe4c4('0x24')](handleError(_0x1f880f,null));};exports['describe']=function(_0x203f11,_0x11faa3){return db[_0xe4c4('0x4e')][_0xe4c4('0x75')]()['then'](respondWithResult(_0x11faa3,null))['catch'](handleError(_0x11faa3,null));};exports[_0xe4c4('0x76')]=function(_0x32f019,_0x5ad3f5){if(_0x32f019[_0xe4c4('0x66')]['id']){delete _0x32f019[_0xe4c4('0x66')]['id'];}return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'where':{'id':_0x32f019['params']['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x5ad3f5,null))[_0xe4c4('0x1c')](function(_0x4e848c){if(_0x4e848c){_0x32f019[_0xe4c4('0x66')]['ChatWebsiteId']=_0x4e848c['id'];return db[_0xe4c4('0x77')][_0xe4c4('0x6b')](_0x32f019[_0xe4c4('0x66')]);}})[_0xe4c4('0x1c')](respondWithResult(_0x5ad3f5,null))['catch'](handleError(_0x5ad3f5,null));};exports[_0xe4c4('0x78')]=function(_0x209fa2,_0x4f3263){var _0x48e089={'raw':![],'where':{}};var _0x1cbf25={};var _0x3547d5={'count':0x0,'rows':[]};return db[_0xe4c4('0x4e')][_0xe4c4('0x79')]({'where':{'id':_0x209fa2[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x4f3263,null))[_0xe4c4('0x1c')](function(_0xa3f3b7){if(_0xa3f3b7){_0x1cbf25['model']=_['keys'](db[_0xe4c4('0x77')][_0xe4c4('0x4f')]);_0x1cbf25[_0xe4c4('0x52')]=_[_0xe4c4('0x53')](_0x209fa2[_0xe4c4('0x52')]);_0x1cbf25['filters']=_[_0xe4c4('0x65')](_0x1cbf25[_0xe4c4('0x47')],_0x1cbf25[_0xe4c4('0x52')]);_0x48e089[_0xe4c4('0x55')]=_[_0xe4c4('0x65')](_0x1cbf25[_0xe4c4('0x47')],qs[_0xe4c4('0x56')](_0x209fa2[_0xe4c4('0x52')][_0xe4c4('0x56')]));_0x48e089[_0xe4c4('0x55')]=_0x48e089[_0xe4c4('0x55')][_0xe4c4('0x57')]?_0x48e089[_0xe4c4('0x55')]:_0x1cbf25[_0xe4c4('0x47')];if(!_0x209fa2[_0xe4c4('0x52')][_0xe4c4('0x58')]('nolimit')){_0x48e089['limit']=qs[_0xe4c4('0x27')](_0x209fa2['query'][_0xe4c4('0x27')]);_0x48e089[_0xe4c4('0x29')]=qs[_0xe4c4('0x29')](_0x209fa2[_0xe4c4('0x52')][_0xe4c4('0x29')]);}_0x48e089[_0xe4c4('0x59')]=qs[_0xe4c4('0x5a')](_0x209fa2[_0xe4c4('0x52')][_0xe4c4('0x5a')]);_0x48e089[_0xe4c4('0x5b')]=qs[_0xe4c4('0x54')](_[_0xe4c4('0x5c')](_0x209fa2[_0xe4c4('0x52')],_0x1cbf25['filters']));_0x48e089[_0xe4c4('0x5b')][_0xe4c4('0x7a')]=_0xa3f3b7['id'];if(_0x209fa2[_0xe4c4('0x52')][_0xe4c4('0x5d')]){_0x48e089[_0xe4c4('0x5b')]=_['merge'](_0x48e089[_0xe4c4('0x5b')],{'$or':_[_0xe4c4('0x4d')](_0x48e089['attributes'],function(_0x143ed6){var _0x32d704={};_0x32d704[_0x143ed6]={'$like':'%'+_0x209fa2['query']['filter']+'%'};return _0x32d704;})});}_0x48e089=_['merge']({},_0x48e089,_0x209fa2[_0xe4c4('0x60')]);return db['Disposition'][_0xe4c4('0x28')]({'where':_0x48e089[_0xe4c4('0x5b')]})[_0xe4c4('0x1c')](function(_0x5dc059){_0x3547d5[_0xe4c4('0x28')]=_0x5dc059;if(_0x209fa2[_0xe4c4('0x52')][_0xe4c4('0x61')]){_0x48e089['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x48e089);})[_0xe4c4('0x1c')](function(_0x1cf5d1){_0x3547d5[_0xe4c4('0x7b')]=_0x1cf5d1;return _0x3547d5;});}})['then'](respondWithFilteredResult(_0x4f3263,_0x48e089))[_0xe4c4('0x24')](handleError(_0x4f3263,null));};exports[_0xe4c4('0x7c')]=function(_0x3abfbc,_0x16d2af){return db[_0xe4c4('0x4e')]['find']({'where':{'id':_0x3abfbc[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x16d2af,null))[_0xe4c4('0x1c')](function(_0x54a2ef){if(_0x54a2ef){return _0x54a2ef[_0xe4c4('0x7c')](_0x3abfbc[_0xe4c4('0x52')][_0xe4c4('0x7d')]);}})['then'](respondWithStatusCode(_0x16d2af,null))[_0xe4c4('0x24')](handleError(_0x16d2af,null));};exports[_0xe4c4('0x7e')]=function(_0x47d67d,_0x36c0e5){if(_0x47d67d[_0xe4c4('0x66')]['id']){delete _0x47d67d[_0xe4c4('0x66')]['id'];}return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'where':{'id':_0x47d67d[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x36c0e5,null))['then'](function(_0x54abc3){if(_0x54abc3){_0x47d67d[_0xe4c4('0x66')][_0xe4c4('0x7a')]=_0x54abc3['id'];return db[_0xe4c4('0x7f')][_0xe4c4('0x6b')](_0x47d67d[_0xe4c4('0x66')]);}})['then'](respondWithResult(_0x36c0e5,null))[_0xe4c4('0x24')](handleError(_0x36c0e5,null));};exports['getAnswers']=function(_0x133576,_0x44a173){var _0x3cfed6={'raw':![],'where':{}};var _0x582c12={};var _0x562aeb={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe4c4('0x79')]({'where':{'id':_0x133576[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x44a173,null))[_0xe4c4('0x1c')](function(_0x551d45){if(_0x551d45){_0x582c12[_0xe4c4('0x47')]=_[_0xe4c4('0x53')](db[_0xe4c4('0x7f')][_0xe4c4('0x4f')]);_0x582c12['query']=_[_0xe4c4('0x53')](_0x133576[_0xe4c4('0x52')]);_0x582c12['filters']=_['intersection'](_0x582c12['model'],_0x582c12[_0xe4c4('0x52')]);_0x3cfed6[_0xe4c4('0x55')]=_[_0xe4c4('0x65')](_0x582c12[_0xe4c4('0x47')],qs[_0xe4c4('0x56')](_0x133576[_0xe4c4('0x52')][_0xe4c4('0x56')]));_0x3cfed6[_0xe4c4('0x55')]=_0x3cfed6[_0xe4c4('0x55')][_0xe4c4('0x57')]?_0x3cfed6['attributes']:_0x582c12['model'];if(!_0x133576[_0xe4c4('0x52')][_0xe4c4('0x58')](_0xe4c4('0x80'))){_0x3cfed6['limit']=qs[_0xe4c4('0x27')](_0x133576[_0xe4c4('0x52')]['limit']);_0x3cfed6[_0xe4c4('0x29')]=qs['offset'](_0x133576[_0xe4c4('0x52')]['offset']);}_0x3cfed6[_0xe4c4('0x59')]=qs[_0xe4c4('0x5a')](_0x133576[_0xe4c4('0x52')][_0xe4c4('0x5a')]);_0x3cfed6[_0xe4c4('0x5b')]=qs['filters'](_['pick'](_0x133576[_0xe4c4('0x52')],_0x582c12['filters']));_0x3cfed6[_0xe4c4('0x5b')][_0xe4c4('0x7a')]=_0x551d45['id'];if(_0x133576[_0xe4c4('0x52')]['filter']){_0x3cfed6[_0xe4c4('0x5b')]=_['merge'](_0x3cfed6[_0xe4c4('0x5b')],{'$or':_['map'](_0x3cfed6['attributes'],function(_0x2fb74b){var _0x38aac8={};_0x38aac8[_0x2fb74b]={'$like':'%'+_0x133576[_0xe4c4('0x52')]['filter']+'%'};return _0x38aac8;})});}_0x3cfed6=_[_0xe4c4('0x5e')]({},_0x3cfed6,_0x133576[_0xe4c4('0x60')]);return db[_0xe4c4('0x7f')][_0xe4c4('0x28')]({'where':_0x3cfed6['where']})[_0xe4c4('0x1c')](function(_0x323dda){_0x562aeb[_0xe4c4('0x28')]=_0x323dda;if(_0x133576[_0xe4c4('0x52')]['includeAll']){_0x3cfed6['include']=[{'all':!![]}];}return db[_0xe4c4('0x7f')]['findAll'](_0x3cfed6);})[_0xe4c4('0x1c')](function(_0x4bde1c){_0x562aeb[_0xe4c4('0x7b')]=_0x4bde1c;return _0x562aeb;});}})[_0xe4c4('0x1c')](respondWithFilteredResult(_0x44a173,_0x3cfed6))['catch'](handleError(_0x44a173,null));};exports[_0xe4c4('0x81')]=function(_0x203bbf,_0x2072f2){return db[_0xe4c4('0x4e')]['find']({'where':{'id':_0x203bbf[_0xe4c4('0x64')]['id']}})['then'](handleEntityNotFound(_0x2072f2,null))['then'](function(_0x520297){if(_0x520297){return _0x520297['removeAnswers'](_0x203bbf[_0xe4c4('0x52')][_0xe4c4('0x7d')]);}})['then'](respondWithStatusCode(_0x2072f2,null))[_0xe4c4('0x24')](handleError(_0x2072f2,null));};exports[_0xe4c4('0x82')]=function(_0x2b7ebd,_0x311dda){_0x2b7ebd['body']['sitepic']=_0x2b7ebd[_0xe4c4('0x83')][_0xe4c4('0x84')];return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'where':{'id':_0x2b7ebd['params']['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x311dda,null))[_0xe4c4('0x1c')](saveUpdates(_0x2b7ebd[_0xe4c4('0x66')],null))['then'](respondWithResult(_0x311dda,null))[_0xe4c4('0x24')](handleError(_0x311dda,null));};exports[_0xe4c4('0x85')]=function(_0x435e7e,_0x34c5c9){_0x435e7e[_0xe4c4('0x66')][_0xe4c4('0x86')]=_0x435e7e[_0xe4c4('0x83')][_0xe4c4('0x84')];return db['ChatWebsite'][_0xe4c4('0x6f')]({'where':{'id':_0x435e7e[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x34c5c9,null))['then'](saveUpdates(_0x435e7e[_0xe4c4('0x66')],null))[_0xe4c4('0x1c')](respondWithResult(_0x34c5c9,null))['catch'](handleError(_0x34c5c9,null));};exports[_0xe4c4('0x87')]=function(_0x49535a,_0x5cf0b3){_0x49535a[_0xe4c4('0x66')][_0xe4c4('0x88')]=_0x49535a[_0xe4c4('0x83')]['filename'];return db[_0xe4c4('0x4e')]['find']({'where':{'id':_0x49535a[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x5cf0b3,null))[_0xe4c4('0x1c')](saveUpdates(_0x49535a[_0xe4c4('0x66')],null))[_0xe4c4('0x1c')](respondWithResult(_0x5cf0b3,null))[_0xe4c4('0x24')](handleError(_0x5cf0b3,null));};exports['addSystemAvatar']=function(_0x34baa7,_0x38226e){_0x34baa7[_0xe4c4('0x66')][_0xe4c4('0x89')]=_0x34baa7[_0xe4c4('0x83')][_0xe4c4('0x84')];return db['ChatWebsite'][_0xe4c4('0x6f')]({'where':{'id':_0x34baa7[_0xe4c4('0x64')]['id']}})['then'](handleEntityNotFound(_0x38226e,null))[_0xe4c4('0x1c')](saveUpdates(_0x34baa7[_0xe4c4('0x66')],null))['then'](respondWithResult(_0x38226e,null))[_0xe4c4('0x24')](handleError(_0x38226e,null));};exports[_0xe4c4('0x8a')]=function(_0x4ff9b8,_0x6d730e){var _0x2e0157=path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],'server/files/images/logos/default_logo.svg');var _0x270ad7={'where':{'id':_0x4ff9b8[_0xe4c4('0x64')]['id']},'attributes':['id',_0xe4c4('0x8d')],'raw':!![]};var _0x2d8891=![];return require(_0xe4c4('0x8e'))[_0xe4c4('0x8f')]()[_0xe4c4('0x1c')](function(_0x452db2){if(_0x452db2){_0x2d8891=_0x452db2[_0xe4c4('0x90')];}})['then'](function(){return db['ChatWebsite']['find'](_0x270ad7);})[_0xe4c4('0x1c')](handleEntityNotFound(_0x6d730e,null))[_0xe4c4('0x1c')](function(_0x1fba21){if(_0x1fba21){if(!_['isNil'](_0x1fba21[_0xe4c4('0x8d')])){if(fs[_0xe4c4('0x91')](path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],_0xe4c4('0x92'),_0x1fba21[_0xe4c4('0x8d')]))&&_0x2d8891){_0x2e0157=path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],_0xe4c4('0x92'),_0x1fba21['sitepic']);}}return _0x6d730e[_0xe4c4('0x93')](_0x2e0157);}})[_0xe4c4('0x24')](handleError(_0x6d730e,null));};exports[_0xe4c4('0x94')]=function(_0x408dab,_0x26d412){var _0x249246=path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],_0xe4c4('0x95'));var _0x3a5fde={'where':{'id':_0x408dab[_0xe4c4('0x64')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')](_0x3a5fde)['then'](handleEntityNotFound(_0x26d412,null))[_0xe4c4('0x1c')](function(_0x11e8bb){if(_0x11e8bb){if(!_[_0xe4c4('0x96')](_0x11e8bb[_0xe4c4('0x86')])){if(fs[_0xe4c4('0x91')](path['join'](config['root'],_0xe4c4('0x97'),_0x11e8bb[_0xe4c4('0x86')]))){_0x249246=path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],_0xe4c4('0x97'),_0x11e8bb['agentAvatar']);}}return _0x26d412['download'](_0x249246);}})[_0xe4c4('0x24')](handleError(_0x26d412,null));};exports[_0xe4c4('0x98')]=function(_0x1a8895,_0x1ab570){var _0x2d1d44=path[_0xe4c4('0x8b')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x5c2d8e={'where':{'id':_0x1a8895[_0xe4c4('0x64')]['id']},'attributes':['id','customerAvatar',_0xe4c4('0x99')],'raw':!![]};return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')](_0x5c2d8e)[_0xe4c4('0x1c')](handleEntityNotFound(_0x1ab570,null))[_0xe4c4('0x1c')](function(_0x3c703b){if(_0x3c703b){if(!_['isNil'](_0x3c703b['customerAvatar'])){if(fs[_0xe4c4('0x91')](path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],'server/files/images/avatars/',_0x3c703b[_0xe4c4('0x88')]))&&_0x3c703b[_0xe4c4('0x99')]){_0x2d1d44=path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],'server/files/images/avatars/',_0x3c703b[_0xe4c4('0x88')]);}}return _0x1ab570[_0xe4c4('0x93')](_0x2d1d44);}})[_0xe4c4('0x24')](handleError(_0x1ab570,null));};exports['getSystemAvatar']=function(_0xc40381,_0x4e3287){var _0x2d7441=path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],_0xe4c4('0x9a'));var _0x16b4aa={'where':{'id':_0xc40381[_0xe4c4('0x64')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')](_0x16b4aa)[_0xe4c4('0x1c')](handleEntityNotFound(_0x4e3287,null))[_0xe4c4('0x1c')](function(_0x5c6509){if(_0x5c6509){if(!_[_0xe4c4('0x96')](_0x5c6509['systemAvatar'])){if(fs['existsSync'](path[_0xe4c4('0x8b')](config['root'],'server/files/images/avatars/',_0x5c6509[_0xe4c4('0x89')]))){_0x2d7441=path[_0xe4c4('0x8b')](config['root'],_0xe4c4('0x97'),_0x5c6509[_0xe4c4('0x89')]);}}return _0x4e3287[_0xe4c4('0x93')](_0x2d7441);}})[_0xe4c4('0x24')](handleError(_0x4e3287,null));};function checkWebsiteInterval(_0x530b01){var _0x45a14f=_0x530b01['Interval'];if(!_0x45a14f){return Promise[_0xe4c4('0x9b')](_0x530b01);}var _0x503a34=_0x530b01['timezone']||undefined;return _0x45a14f[_0xe4c4('0x9c')](_0x503a34)['then'](function(_0x4a45bf){if(!_0x4a45bf){throw new APIOutOfIntervalError();}return _0x530b01;});}exports[_0xe4c4('0x9d')]=function(_0x451f30,_0x1f7c17){var _0xcc2474={'body':_0x451f30[_0xe4c4('0x66')],'channel':_0xe4c4('0x9e')};var _0x27e90b=[];var _0x5a1e7e=[];var _0x4833f7={};var _0x230de7=![];if(_0x451f30['body']['id']){delete _0x451f30[_0xe4c4('0x66')]['id'];}if(_[_0xe4c4('0x96')](_0x451f30[_0xe4c4('0x66')][_0xe4c4('0x9f')])){throw new APIBadRequestError(_0xe4c4('0xa0'));}if(_[_0xe4c4('0x96')](_0x451f30[_0xe4c4('0x66')]['mapKey'])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0xe4c4('0xa1')](_0x451f30['body']['body'])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x48bdf0=_0x451f30['body'][_0xe4c4('0xa2')]&&_0x451f30[_0xe4c4('0x66')][_0xe4c4('0x40')];return db[_0xe4c4('0xa3')][_0xe4c4('0x75')]()[_0xe4c4('0x1c')](function(_0xfee08a){if(!_0xfee08a){throw new Error(_0xe4c4('0xa4'));}_0x27e90b=Object['keys'](_0xfee08a)['filter'](function(_0x44ef17){return![_0xe4c4('0xa5'),_0xe4c4('0xa6')][_0xe4c4('0xa7')](_0x44ef17);});_0x5a1e7e=Object[_0xe4c4('0x53')](_0xfee08a)[_0xe4c4('0x5d')](function(_0x3ffe55){return![_0xe4c4('0xa5'),_0xe4c4('0xa6'),_0xe4c4('0xa8'),_0xe4c4('0xa9')][_0xe4c4('0xa7')](_0x3ffe55);});if(!_['includes'](_0x5a1e7e,_0x451f30['body']['mapKey'])){throw new APIBadRequestError(_0xe4c4('0xaa')+_0x5a1e7e[_0xe4c4('0x8b')](',\x20'));}_0x4833f7[_0x451f30[_0xe4c4('0x66')]['mapKey']]=_0x451f30['body'][_0xe4c4('0x9f')];})[_0xe4c4('0x1c')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x451f30[_0xe4c4('0x64')]['id']},'include':[{'model':db[_0xe4c4('0xab')],'as':_0xe4c4('0xac'),'include':[{'model':db[_0xe4c4('0xa3')],'as':_0xe4c4('0xad'),'where':_0x4833f7,'limit':0x1,'order':[['updatedAt',_0xe4c4('0xae')]]}]},{'model':db[_0xe4c4('0xaf')],'as':_0xe4c4('0xb0')},{'model':db[_0xe4c4('0xb1')],'as':_0xe4c4('0xb1'),'include':[{'model':db['Interval'],'as':_0xe4c4('0xb2'),'attributes':['id',_0xe4c4('0xb3')],'raw':!![]}]}]});})[_0xe4c4('0x1c')](function(_0x39992d){if(!_0x39992d){throw new APINotFoundError(util[_0xe4c4('0x43')](_0xe4c4('0xb4'),_0x451f30[_0xe4c4('0x64')]['id']));}if(_0x48bdf0){return checkWebsiteInterval(_0x39992d);}return _0x39992d;})[_0xe4c4('0x1c')](function(_0x4956f5){_0xcc2474[_0xe4c4('0xb5')]=_0x4956f5;_0xcc2474[_0xe4c4('0xb6')]=_[_0xe4c4('0xb7')](_0x4956f5[_0xe4c4('0xb0')],[_0xe4c4('0xb8')],[_0xe4c4('0xb9')]);if(_0xcc2474[_0xe4c4('0xb5')][_0xe4c4('0xb0')]){delete _0xcc2474[_0xe4c4('0xb5')][_0xe4c4('0xb0')];}_0xcc2474['list']=_0x4956f5[_0xe4c4('0xac')]||{'id':_0x4956f5[_0xe4c4('0xa9')]};if(_0xcc2474['list']&&_0xcc2474['list'][_0xe4c4('0xad')][_0xe4c4('0x57')]){return _0xcc2474['list']['Contacts'][0x0];}var _0xd99041=_[_0xe4c4('0x13')](_0x451f30['body'],{'firstName':_0x451f30[_0xe4c4('0x66')][_0xe4c4('0x9f')],'ListId':_0x4956f5[_0xe4c4('0xa9')]});_0xd99041[_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xba')]]=_0x451f30[_0xe4c4('0x66')][_0xe4c4('0x9f')];return db[_0xe4c4('0xa3')][_0xe4c4('0x6b')](_0xd99041,{'fields':_0x27e90b,'raw':!![]});})['then'](function(_0x2b660c){_0xcc2474[_0xe4c4('0xbb')]=_0x2b660c;var _0x57bfe4=createInteractionObject(_0x451f30[_0xe4c4('0x64')]['id'],_0x451f30[_0xe4c4('0x66')],_0x451f30[_0xe4c4('0xbc')],_0x2b660c);var _0x1e0825={'ChatWebsiteId':_0x451f30[_0xe4c4('0x64')]['id']};if(_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xbd')]){_0x1e0825[_0xe4c4('0xbd')]=_0x451f30['body']['threadId'];_0x1e0825[_0xe4c4('0xbe')]=![];return db[_0xe4c4('0xbf')]['find']({'where':_0x1e0825})['then'](function(_0x203918){var _0x2409a1=_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xa2')]&&_0x451f30[_0xe4c4('0x66')]['referer'];if(_0x203918){_0x230de7=!![];return _0x203918;}else if(!_0x2409a1&&_0x203918&&_0x203918[_0xe4c4('0xbe')]){throw new APIConflictError(_0xe4c4('0xc0'));}_0x57bfe4['threadId']=_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xbd')];_0x57bfe4['externalUrl']=_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xc1')];return db[_0xe4c4('0xbf')]['create'](_0x57bfe4);});}_0x1e0825[_0xe4c4('0xc2')]=_0x2b660c['id'];if(_0x451f30['body'][_0xe4c4('0xc3')]&&_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xc3')]['id']){_0x1e0825['id']=_0x451f30['body'][_0xe4c4('0xc3')]['id'];return db[_0xe4c4('0xbf')][_0xe4c4('0x6f')]({'where':_0x1e0825})[_0xe4c4('0x1c')](function(_0x18b728){var _0x4066a0=_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xa2')]&&_0x451f30[_0xe4c4('0x66')][_0xe4c4('0x40')];if(!_0x4066a0&&_0x18b728&&_0x18b728['closed']){throw new APIConflictError(_0xe4c4('0xc0'));}else if(_0x18b728){_0x230de7=!![];return _0x18b728;}else{return db[_0xe4c4('0xbf')][_0xe4c4('0x6b')](_0x57bfe4);}});}return db[_0xe4c4('0xbf')][_0xe4c4('0x6b')](_0x57bfe4);})[_0xe4c4('0x1c')](function(_0x3414f3){if(!_0x230de7){return _0x3414f3;}var _0x1966f6={'from':(_0xcc2474[_0xe4c4('0xbb')]['firstName']||'')+'\x20'+(_0xcc2474[_0xe4c4('0xbb')][_0xe4c4('0x3e')]||'')};if(_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xbd')]&&_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xc4')]&&_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xbd')]!=_0x451f30[_0xe4c4('0x66')][_0xe4c4('0xc4')]){_0x1966f6[_0xe4c4('0xbd')]=_0x451f30[_0xe4c4('0x66')]['messageId'];}return _0x3414f3['update'](_0x1966f6);})['then'](function(_0x3e1c4a){_0xcc2474[_0xe4c4('0xc3')]=_0x3e1c4a['get']({'plain':!![]});_0xcc2474['interaction']['created']=!_0x230de7;if(_0xcc2474[_0xe4c4('0xc3')]['created']){if(_0xcc2474[_0xe4c4('0xb5')][_0xe4c4('0xc5')]){_0xcc2474[_0xe4c4('0xb6')][_0xe4c4('0xc6')]({'id':0x0,'priority':_0xcc2474[_0xe4c4('0xb6')][_0xe4c4('0x57')]+0x1,'app':_0xe4c4('0xc7'),'appdata':_0xe4c4('0xc8'),'interval':_0xe4c4('0xc9')});}}return db[_0xe4c4('0xca')][_0xe4c4('0x6b')]({'body':_0x451f30[_0xe4c4('0x66')][_0xe4c4('0x66')],'ChatWebsiteId':_0x451f30[_0xe4c4('0x64')]['id'],'ChatInteractionId':_0x3e1c4a['id'],'direction':'in','ContactId':_0xcc2474[_0xe4c4('0xbb')]['id'],'AttachmentId':_0x451f30[_0xe4c4('0x66')]['AttachmentId']});})[_0xe4c4('0x1c')](function(_0x12333a){_0xcc2474['message']=_0x12333a;if(!_0xcc2474[_0xe4c4('0xc3')][_0xe4c4('0xcb')]){return;}return db[_0xe4c4('0xcc')][_0xe4c4('0x6f')]({'attributes':['id',_0xe4c4('0x34')],'where':{'id':_0xcc2474[_0xe4c4('0xc3')][_0xe4c4('0xcb')]}});})[_0xe4c4('0x1c')](function(_0x5ea042){if(_0x5ea042){_0xcc2474['applications'][_0xe4c4('0xcd')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5ea042['name']+','+(_0xcc2474[_0xe4c4('0xb5')][_0xe4c4('0xce')]||0xa),'interval':_0xe4c4('0xc9')});_0xcc2474[_0xe4c4('0xcf')]=!![];}if(!_0xcc2474[_0xe4c4('0xc3')]['queueId']){return;}return db['ChatQueue'][_0xe4c4('0x6f')]({'attributes':['id',_0xe4c4('0x34')],'where':{'id':_0xcc2474[_0xe4c4('0xc3')][_0xe4c4('0xd0')]}});})[_0xe4c4('0x1c')](function(_0x211371){if(_0x211371){_0xcc2474['applications'][_0xe4c4('0xcd')]({'id':0x0,'priority':0x1,'app':_0xe4c4('0xd1'),'appdata':_0x211371[_0xe4c4('0x34')]+','+(_0xcc2474[_0xe4c4('0xb5')][_0xe4c4('0xd2')]||0x12c),'interval':_0xe4c4('0xc9')});}return respondWithRpcPromise(_0xe4c4('0xd3'),_0xe4c4('0xd4'),_0xcc2474);})[_0xe4c4('0x1c')](function(_0xe396a6){respondWithRpcPromise(_0xe4c4('0xd5'),_0xe4c4('0xd5'),{'event':_0xe4c4('0x9d'),'message':_0xe396a6},client9002);return _0xe396a6;})[_0xe4c4('0x1c')](respondWithResult(_0x1f7c17,null))[_0xe4c4('0x24')](APIHandleError(_0x1f7c17));};exports[_0xe4c4('0xd6')]=function(_0x2aa16e,_0x3f6e8d){var _0x51cd04,_0x23e102,_0x18973e;var _0x3651ec=[];var _0x50371={};var _0x20de1b=_0x2aa16e[_0xe4c4('0xd7')]||[];var _0x5a34fe=[];var _0x29ac6c;return db[_0xe4c4('0xa3')][_0xe4c4('0x75')]()['then'](function(_0x4b1e34){if(!_0x4b1e34){throw new db['Sequelize'][(_0xe4c4('0xd8'))](_0xe4c4('0xd9'));}_0x3651ec=_[_0xe4c4('0xda')](_[_0xe4c4('0x53')](_0x4b1e34),[_0xe4c4('0xa5'),'updatedAt','CompanyId',_0xe4c4('0xa9')]);if(_0x2aa16e[_0xe4c4('0x66')]['id']){delete _0x2aa16e[_0xe4c4('0x66')]['id'];}if(_['isNil'](_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0x9f')])){throw _0x3f6e8d[_0xe4c4('0x25')](0x1f4)['send'](new db[(_0xe4c4('0xdb'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0xe4c4('0x96')](_0x2aa16e['body'][_0xe4c4('0x66')])||_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0x66')]===''){throw _0x3f6e8d['status'](0x1f4)[_0xe4c4('0x35')](new db[(_0xe4c4('0xdb'))][(_0xe4c4('0xd8'))](_0xe4c4('0xdc')));}if(_[_0xe4c4('0x96')](_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0xdd')])){throw _0x3f6e8d[_0xe4c4('0x25')](0x1f4)[_0xe4c4('0x35')](new db[(_0xe4c4('0xdb'))][(_0xe4c4('0xd8'))](_0xe4c4('0xde')+_0x3651ec));}if(!_['includes'](_0x3651ec,_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0xdd')])){throw _0x3f6e8d[_0xe4c4('0x25')](0x1f4)[_0xe4c4('0x35')](new db[(_0xe4c4('0xdb'))]['ValidationError'](_0xe4c4('0xdf')+_0x3651ec));}_0x50371[_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0xdd')]]=_0x2aa16e['body'][_0xe4c4('0x9f')];})[_0xe4c4('0x1c')](function(){return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'where':{'id':_0x2aa16e[_0xe4c4('0x64')]['id']},'include':[{'model':db[_0xe4c4('0xab')],'as':_0xe4c4('0xac')},{'model':db[_0xe4c4('0xe0')],'as':_0xe4c4('0xe0')}]});})['then'](handleEntityNotFound(_0x3f6e8d,null))[_0xe4c4('0x1c')](function(_0x21cc1a){if(_0x21cc1a&&_0x21cc1a[_0xe4c4('0xac')]){_0x23e102=_0x21cc1a;var _0x41c0dc=_[_0xe4c4('0x13')](_0x2aa16e[_0xe4c4('0x66')],{'firstName':_0x2aa16e['body'][_0xe4c4('0x9f')],'phone':_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0x9f')],'ListId':_0x21cc1a['ListId']});_0x41c0dc[_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0xdd')]]=_0x2aa16e[_0xe4c4('0x66')]['from'];return db['CmContact'][_0xe4c4('0xe1')]({'where':_0x50371,'defaults':_0x41c0dc});}})[_0xe4c4('0xe2')](function(_0x3e4571){if(_0x3e4571){_0x18973e=_0x3e4571;var _0x5ea70c=fs[_0xe4c4('0xe3')](path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],'server/files/templates/chatOfflineMessage.ejs'),_0xe4c4('0xe4'));var _0x23d5d5=ejs[_0xe4c4('0xe5')](_0x5ea70c,{'body':_[_0xe4c4('0xe6')](_0x2aa16e[_0xe4c4('0x66')][_0xe4c4('0x66')]),'bodyTitle':_0x23e102['offlineMessageBody']});return db[_0xe4c4('0xe7')][_0xe4c4('0x6b')]({'body':_0x23d5d5,'plainBody':htmlToText[_0xe4c4('0xe8')](_0x23d5d5),'ContactId':_0x3e4571['id'],'ChatWebsiteId':_0x23e102['id']});}})[_0xe4c4('0x1c')](function(_0x134833){_0x29ac6c=_0x134833;if(_0x20de1b[_0xe4c4('0x57')]){var _0x1dd21c=_0x20de1b[_0xe4c4('0x4d')](function(_0x3d8da1){return{'name':_0x3d8da1[_0xe4c4('0xe9')],'basename':_0x3d8da1['filename'],'type':_0x3d8da1[_0xe4c4('0xea')],'ChatOfflineMessageId':_0x134833['id']};});_0x5a34fe=_0x1dd21c['map'](_0x1ac10e=>{var _0x50cb2b={'filename':_0x1ac10e[_0xe4c4('0x34')],'path':path['join'](config['root'],_0xe4c4('0xeb'),_0xe4c4('0xd7'),_0xe4c4('0xec'),_0xe4c4('0xed'),_0x1ac10e[_0xe4c4('0xee')])};return _0x50cb2b;});if(!_0x23e102[_0xe4c4('0xef')]){return db[_0xe4c4('0xf0')][_0xe4c4('0xf1')](function(_0x5ed12d){return db[_0xe4c4('0xf2')][_0xe4c4('0xf3')](_0x1dd21c,{'transaction':_0x5ed12d});});}}})[_0xe4c4('0x1c')](function(){if(_0x29ac6c){_0x51cd04=_0x29ac6c;return db[_0xe4c4('0xe0')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xe4c4('0xf4')],'as':_0xe4c4('0xf5'),'raw':!![],'include':[{'model':db[_0xe4c4('0xf6')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xe4c4('0x1c')](function(_0x2a7374){if(_0x2a7374&&_0x2a7374['Smtp']&&_0x23e102[_0xe4c4('0xf7')]&&_0x23e102['forwardOfflineAddress']){var _0x2ebef7=_0x2a7374[_0xe4c4('0xf8')]();return respondWithRpcPromise('SendMail',_0xe4c4('0xf9'),{'account':_0x2ebef7,'message':{'from':util[_0xe4c4('0x43')](_0xe4c4('0xfa'),_0x2a7374[_0xe4c4('0x34')],_0x2a7374[_0xe4c4('0xfb')]||_0x2a7374[_0xe4c4('0xf5')][_0xe4c4('0x6c')]),'to':_0x23e102[_0xe4c4('0xfc')],'subject':_0x23e102[_0xe4c4('0xfd')],'html':_0x51cd04[_0xe4c4('0x66')],'attachments':_0x5a34fe}},client9003)[_0xe4c4('0x1c')](function(){return _0x51cd04;})[_0xe4c4('0x24')](function(_0x307198){logger[_0xe4c4('0x22')](_0x307198);});}})[_0xe4c4('0x1c')](function(){if(_0x23e102&&_0x23e102[_0xe4c4('0xef')]&&_0x23e102['MailAccountId']){var _0x555318=[];if(_0x20de1b[_0xe4c4('0x57')]){_0x555318=_0x20de1b[_0xe4c4('0x4d')](function(_0x4d7fea){return{'name':_0x4d7fea[_0xe4c4('0xe9')],'basename':_0x4d7fea['filename'],'type':_0x4d7fea[_0xe4c4('0xea')],'ChatOfflineMessageId':_0x29ac6c['id']};});}var _0x4f78a6;if(!_[_0xe4c4('0x96')](_0x23e102[_0xe4c4('0xfe')])){var _0x290c62=_[_0xe4c4('0x4d')](_0x2aa16e[_0xe4c4('0x66')],function(_0x1e88dc){return _0x1e88dc;});var _0x1caed0=_[_0xe4c4('0xff')](_0x290c62)[0x0];var _0x6fd02e=_[_0xe4c4('0x100')](_0x1caed0,function(_0x55cfe3){return _0x55cfe3;});_0x4f78a6=_0x6fd02e[0x1][_0x23e102[_0xe4c4('0xfe')]];}var _0x550c69={'from':_0x18973e[_0xe4c4('0xfb')],'firstName':_0x18973e[_0xe4c4('0x3d')],'lastName':_0x18973e[_0xe4c4('0x3e')],'mapKey':_0xe4c4('0xfb'),'message':{'from':_0x18973e[_0xe4c4('0xfb')],'to':_0x23e102[_0xe4c4('0xe0')][_0xe4c4('0xfb')],'cc':'','subject':_[_0xe4c4('0x96')](_0x4f78a6)?_0x23e102[_0xe4c4('0xfd')]:_0x4f78a6,'messageId':'','sentAt':new Date(),'attach':_0x555318[_0xe4c4('0x57')],'attachments':_0x555318,'originChannel':'Chat','ChatWebsiteId':_0x23e102['id'],'ChatOfflineMessageId':_0x51cd04['id'],'originTo':_0x23e102['MailAccount']['email']},'body':_0x51cd04[_0xe4c4('0x66')]};var _0x2391a1={'account':{'id':_0x23e102['MailAccountId']},'body':_0x550c69,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0xe4c4('0x101'),_0x2391a1,client9001)[_0xe4c4('0x1c')](function(){return _0x51cd04;})[_0xe4c4('0x24')](function(_0xda9160){logger[_0xe4c4('0x22')](_0xda9160);});}return;})[_0xe4c4('0x1c')](function(){if(_0x51cd04){return _0x51cd04;}})['then'](respondWithResult(_0x3f6e8d,null))[_0xe4c4('0x24')](function(){for(var _0x54b014 of _0x20de1b){var _0x340fd7=path[_0xe4c4('0x8b')](config['root'],_0xe4c4('0xeb'),_0xe4c4('0xd7'),_0xe4c4('0xec'),_0xe4c4('0xed'),_0x54b014[_0xe4c4('0x84')]);fs_extra[_0xe4c4('0x102')](_0x340fd7)[_0xe4c4('0x24')](function(_0x32cbd2){logger[_0xe4c4('0x22')](_0xe4c4('0x103'),_0x340fd7,_0x32cbd2);});}});};exports['addInteraction']=function(_0x536ff2,_0x2f71b7){return db['ChatInteraction']['find']({'where':{'id':_0x536ff2[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x2f71b7,null))[_0xe4c4('0x1c')](function(_0x3fcff1){if(_0x3fcff1){return _0x3fcff1[_0xe4c4('0x104')](_0x536ff2[_0xe4c4('0x66')][_0xe4c4('0x7d')],_['omit'](_0x536ff2[_0xe4c4('0x66')],[_0xe4c4('0x7d'),'id'])||{});}})['then'](respondWithResult(_0x2f71b7,null))[_0xe4c4('0x24')](handleError(_0x2f71b7,null));};exports[_0xe4c4('0x105')]=function(_0xf5aec6,_0x510361){var _0x16c203={'raw':![],'where':{}};var _0x289144={};var _0x112034={'count':0x0,'rows':[]};return db[_0xe4c4('0x4e')][_0xe4c4('0x79')]({'where':{'id':_0xf5aec6['params']['id']}})['then'](handleEntityNotFound(_0x510361,null))[_0xe4c4('0x1c')](function(_0x51b9a1){if(_0x51b9a1){_0x289144[_0xe4c4('0x47')]=_[_0xe4c4('0x53')](db[_0xe4c4('0xbf')]['rawAttributes']);_0x289144['query']=_[_0xe4c4('0x53')](_0xf5aec6[_0xe4c4('0x52')]);_0x289144['filters']=_[_0xe4c4('0x65')](_0x289144[_0xe4c4('0x47')],_0x289144[_0xe4c4('0x52')]);_0x16c203[_0xe4c4('0x55')]=_[_0xe4c4('0x65')](_0x289144[_0xe4c4('0x47')],qs[_0xe4c4('0x56')](_0xf5aec6[_0xe4c4('0x52')][_0xe4c4('0x56')]));_0x16c203[_0xe4c4('0x55')]=_0x16c203[_0xe4c4('0x55')]['length']?_0x16c203[_0xe4c4('0x55')]:_0x289144[_0xe4c4('0x47')];if(!_0xf5aec6['query']['hasOwnProperty'](_0xe4c4('0x80'))){_0x16c203['limit']=qs[_0xe4c4('0x27')](_0xf5aec6[_0xe4c4('0x52')]['limit']);_0x16c203[_0xe4c4('0x29')]=qs[_0xe4c4('0x29')](_0xf5aec6[_0xe4c4('0x52')][_0xe4c4('0x29')]);}_0x16c203['order']=qs[_0xe4c4('0x5a')](_0xf5aec6[_0xe4c4('0x52')][_0xe4c4('0x5a')]);_0x16c203[_0xe4c4('0x5b')]=qs[_0xe4c4('0x54')](_[_0xe4c4('0x5c')](_0xf5aec6['query'],_0x289144['filters']));_0x16c203['where'][_0xe4c4('0x7a')]=_0x51b9a1['id'];if(_0xf5aec6[_0xe4c4('0x52')][_0xe4c4('0x5d')]){_0x16c203['where']=_['merge'](_0x16c203['where'],{'$or':_[_0xe4c4('0x4d')](_0x16c203[_0xe4c4('0x55')],function(_0x33bf97){var _0x36eb7b={};_0x36eb7b[_0x33bf97]={'$like':'%'+_0xf5aec6[_0xe4c4('0x52')]['filter']+'%'};return _0x36eb7b;})});}_0x16c203=_[_0xe4c4('0x5e')]({},_0x16c203,_0xf5aec6[_0xe4c4('0x60')]);return db[_0xe4c4('0xbf')][_0xe4c4('0x28')]({'where':_0x16c203[_0xe4c4('0x5b')]})[_0xe4c4('0x1c')](function(_0x28fbe4){_0x112034[_0xe4c4('0x28')]=_0x28fbe4;if(_0xf5aec6[_0xe4c4('0x52')][_0xe4c4('0x61')]){_0x16c203[_0xe4c4('0x62')]=[{'model':db['CmContact'],'as':_0xe4c4('0x106'),'required':![]},{'model':db[_0xe4c4('0xcc')],'as':_0xe4c4('0x107'),'attributes':[_0xe4c4('0x34'),'fullname','internal'],'required':![]},{'model':db[_0xe4c4('0x108')],'as':_0xe4c4('0x109'),'attributes':['id','name',_0xe4c4('0x10a')],'where':_0xf5aec6['query']['tag']?{'id':_0xf5aec6[_0xe4c4('0x52')]['tag']}:undefined,'required':_0xf5aec6[_0xe4c4('0x52')][_0xe4c4('0x10b')]?!![]:![]}];}return db[_0xe4c4('0xbf')][_0xe4c4('0x10c')](_0x16c203);})['then'](function(_0x159193){_0x112034[_0xe4c4('0x7b')]=_0x159193;return _0x112034;});}})[_0xe4c4('0x1c')](respondWithFilteredResult(_0x510361,_0x16c203))[_0xe4c4('0x24')](handleError(_0x510361,null));};exports[_0xe4c4('0x10d')]=function(_0x4c5d8b,_0x152415){var _0x448614=0x0;var _0x2a117c=0x0;var _0x12a8bb=![];var _0x56c6e5;var _0x23e05d;return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'where':{'id':_0x4c5d8b[_0xe4c4('0x64')]['id']},'include':[{'model':db['Interval'],'as':_0xe4c4('0xb1'),'include':[{'model':db[_0xe4c4('0xb1')],'as':'Intervals','attributes':['id','interval']}]}]})['then'](handleEntityNotFound(_0x152415,null))[_0xe4c4('0x1c')](function(_0x2d4e9d){if(_0x2d4e9d){_0x56c6e5=_0x2d4e9d;return _0x2d4e9d['getProactiveActions']({'raw':!![]});}})[_0xe4c4('0x1c')](function(_0x20f141){if(_0x56c6e5){if(_0x20f141){_0x23e05d=_0x20f141;}}return require(_0xe4c4('0x8e'))['getLicense']();})[_0xe4c4('0x1c')](function(_0x11822e){if(_0x11822e){_0x2a117c=_0x11822e[_0xe4c4('0x10e')];_0x12a8bb=_0x11822e['custom'];}})[_0xe4c4('0x1c')](function(){return db[_0xe4c4('0xbf')][_0xe4c4('0x28')]({'where':{'closed':![]}});})[_0xe4c4('0x1c')](function(_0x3dfbde){_0x448614=_0x3dfbde;if(_0x2a117c&&_0x3dfbde>_0x2a117c){return db[_0xe4c4('0x10f')]['findOne']({'where':{'id':0x1}})[_0xe4c4('0x1c')](function(_0x337c98){if(_0x337c98){_0x337c98[_0xe4c4('0x110')](_0xe4c4('0x111'));}});}})[_0xe4c4('0x1c')](function(){var _0x2f0bba=_0x56c6e5['Interval'];var _0xbbf169=_0x56c6e5['timezone']||undefined;return _0x2f0bba?_0x2f0bba[_0xe4c4('0x9c')](_0xbbf169):!![];})[_0xe4c4('0x1c')](function(_0x24123b){var _0x20525b=fs[_0xe4c4('0xe3')](path[_0xe4c4('0x8b')](config[_0xe4c4('0x8c')],_0xe4c4('0x112')),_0xe4c4('0xe4'));var _0x317e9c='3.13.0';var _0x49a26c=![];var _0x356750,_0xa27893;if(_0x4c5d8b[_0xe4c4('0xbc')][_0xe4c4('0x40')]){_0x356750=new URL(_0x4c5d8b[_0xe4c4('0xbc')][_0xe4c4('0x40')])['origin'];}else if(_0x4c5d8b[_0xe4c4('0xbc')][_0xe4c4('0x113')]){_0x356750=new URL(_0x4c5d8b[_0xe4c4('0xbc')][_0xe4c4('0x113')])[_0xe4c4('0x113')];}else{_0x356750=_0xe4c4('0x114');}_0xa27893=typeof _0x56c6e5[_0xe4c4('0x115')][_0xe4c4('0x67')](',')['find'](function(_0x425371){return wildcardUtils[_0xe4c4('0x116')](_0x425371,_0x356750);})!==_0xe4c4('0x26');var _0x24a913={'chatVersion':_0x317e9c,'chatWebsiteAddressOrigin':_0xa27893?_0x356750:_0x56c6e5[_0xe4c4('0x115')],'remote':_0x56c6e5[_0xe4c4('0x117')],'query':querystring[_0xe4c4('0x21')](_[_0xe4c4('0x5e')](_0x56c6e5[_0xe4c4('0x2e')]({'plain':!![]}),{'customerIp':_0x4c5d8b[_0xe4c4('0xbc')]['x-forwarded-for']||_0x4c5d8b['headers'][_0xe4c4('0x118')]||_0x4c5d8b[_0xe4c4('0x119')][_0xe4c4('0x11a')]||_0x4c5d8b['ip'],'referer':_0x4c5d8b[_0xe4c4('0xbc')]['referer'],'openedInteractions':_0x448614,'maxInteractions':_0x2a117c,'virtual':_0x12a8bb[_0xe4c4('0x10e')],'online':_0x24123b,'custom':_0x12a8bb,'address':_0xa27893?_0x356750:null}))[_0xe4c4('0x11b')](/'/g,'\x5c\x27')};_0x152415['send'](ejs[_0xe4c4('0xe5')](Mustache['render'](_0x20525b,_0x24a913),{'proactiveActions':_0x23e05d,'alignment':_0x56c6e5[_0xe4c4('0x11c')],'verticalAlignment':_0x56c6e5[_0xe4c4('0x11d')],'div_color':_0x56c6e5[_0xe4c4('0x10a')],'labelText':_0x56c6e5[_0xe4c4('0x11e')],'text_color':_0x56c6e5['textColor'],'text_button_color':_0x56c6e5[_0xe4c4('0x11f')],'button_color':_0x56c6e5[_0xe4c4('0x120')],'background_color':_0x56c6e5[_0xe4c4('0x121')],'hideWhenOffline':_0x56c6e5[_0xe4c4('0x122')],'intervalId':_0x56c6e5['IntervalId'],'isDevelopment':_0x49a26c,'chatVersion':_0x317e9c}));})['catch'](handleError(_0x152415,null));};exports['addApplications']=function(_0x126005,_0xb96ce3){var _0x2ea9db=_0x126005[_0xe4c4('0x64')]['id'];var _0x5e7645=_0x126005[_0xe4c4('0x66')];var _0x4cbd84=0xc8;var _0x5b643f=null;return db[_0xe4c4('0xf0')][_0xe4c4('0xf1')]({'isolationLevel':db['sequelize'][_0xe4c4('0x123')][_0xe4c4('0x124')][_0xe4c4('0x125')]},function(_0x1d38b5){return db[_0xe4c4('0x4e')][_0xe4c4('0x79')]({'where':{'id':_0x2ea9db},'transaction':_0x1d38b5})[_0xe4c4('0x1c')](function(_0x208072){if(_0x208072){return db['ChatApplication'][_0xe4c4('0x2d')]({'where':{'ChatWebsiteId':_0x2ea9db},'transaction':_0x1d38b5})[_0xe4c4('0x1c')](function(){var _0x4755ae=_[_0xe4c4('0x4d')](_0x5e7645,function(_0xe41510){_0xe41510['ChatWebsiteId']=_0x2ea9db;return _0xe41510;});return db[_0xe4c4('0xaf')][_0xe4c4('0xf3')](_0x4755ae,{'transaction':_0x1d38b5});});}else{_0x4cbd84=0x194;_0x5b643f=[];}});})[_0xe4c4('0x1c')](function(){if(_0x4cbd84!==0x194){return db[_0xe4c4('0xaf')][_0xe4c4('0x126')]({'where':{'ChatWebsiteId':_0x2ea9db},'order':_0xe4c4('0xb8')})[_0xe4c4('0x1c')](function(_0x5eb819){_0x5b643f=_0x5eb819;});}})['catch'](function(_0x20fda7){_0x4cbd84=0x1f4;logger[_0xe4c4('0x22')](_0x20fda7[_0xe4c4('0x33')]);if(_0x20fda7[_0xe4c4('0x34')]){delete _0x20fda7[_0xe4c4('0x34')];}_0x5b643f=_0x20fda7;})[_0xe4c4('0x127')](function(){if(_0x5b643f===null){_0xb96ce3[_0xe4c4('0x32')](_0x4cbd84);}else{if(_0x4cbd84===0x1f4){_0xb96ce3[_0xe4c4('0x25')](_0x4cbd84)[_0xe4c4('0x35')](_0x5b643f);}else{_0xb96ce3[_0xe4c4('0x25')](_0x4cbd84)[_0xe4c4('0x2b')](_0x5b643f);}}});};exports[_0xe4c4('0x128')]=function(_0xa09e1a,_0x38b6e8){var _0x12b809={};var _0x3aff06={};var _0x4cf50f;var _0x494ed6;return db['ChatWebsite']['findOne']({'where':{'id':_0xa09e1a['params']['id']}})['then'](handleEntityNotFound(_0x38b6e8,null))[_0xe4c4('0x1c')](function(_0x2bda6e){if(_0x2bda6e){_0x4cf50f=_0x2bda6e;_0x3aff06[_0xe4c4('0x47')]=_['keys'](db[_0xe4c4('0xaf')][_0xe4c4('0x4f')]);_0x3aff06[_0xe4c4('0x52')]=_[_0xe4c4('0x53')](_0xa09e1a[_0xe4c4('0x52')]);_0x3aff06['filters']=_[_0xe4c4('0x65')](_0x3aff06[_0xe4c4('0x47')],_0x3aff06['query']);_0x12b809[_0xe4c4('0x55')]=_['intersection'](_0x3aff06['model'],qs[_0xe4c4('0x56')](_0xa09e1a[_0xe4c4('0x52')][_0xe4c4('0x56')]));_0x12b809['attributes']=_0x12b809['attributes'][_0xe4c4('0x57')]?_0x12b809['attributes']:_0x3aff06['model'];_0x12b809['order']=qs[_0xe4c4('0x5a')](_0xa09e1a['query']['sort']);_0x12b809[_0xe4c4('0x5b')]=qs[_0xe4c4('0x54')](_[_0xe4c4('0x5c')](_0xa09e1a[_0xe4c4('0x52')],_0x3aff06[_0xe4c4('0x54')]));if(_0xa09e1a['query'][_0xe4c4('0x5d')]){_0x12b809[_0xe4c4('0x5b')]=_[_0xe4c4('0x5e')](_0x12b809[_0xe4c4('0x5b')],{'$or':_[_0xe4c4('0x4d')](_0x12b809['attributes'],function(_0xd23315){var _0x31a65a={};_0x31a65a[_0xd23315]={'$like':'%'+_0xa09e1a[_0xe4c4('0x52')]['filter']+'%'};return _0x31a65a;})});}_0x12b809=_['merge']({},_0x12b809,_0xa09e1a[_0xe4c4('0x60')]);return _0x4cf50f[_0xe4c4('0x128')](_0x12b809);}})[_0xe4c4('0x1c')](function(_0x2f2a4b){if(_0x2f2a4b){_0x494ed6=_0x2f2a4b[_0xe4c4('0x57')];if(!_0xa09e1a['query'][_0xe4c4('0x58')](_0xe4c4('0x80'))){_0x12b809[_0xe4c4('0x27')]=qs['limit'](_0xa09e1a[_0xe4c4('0x52')][_0xe4c4('0x27')]);_0x12b809[_0xe4c4('0x29')]=qs[_0xe4c4('0x29')](_0xa09e1a['query'][_0xe4c4('0x29')]);}return _0x4cf50f[_0xe4c4('0x128')](_0x12b809);}})[_0xe4c4('0x1c')](function(_0xe5c907){if(_0xe5c907){return _0xe5c907?{'count':_0x494ed6,'rows':_0xe5c907}:null;}})[_0xe4c4('0x1c')](respondWithResult(_0x38b6e8,null))[_0xe4c4('0x24')](handleError(_0x38b6e8,null));};exports[_0xe4c4('0x129')]=function(_0x2cb743,_0x532964){return db[_0xe4c4('0x12a')][_0xe4c4('0x6f')]({'where':{'id':_0x2cb743['params']['id']}})['then'](handleEntityNotFound(_0x532964,null))['then'](function(_0x32a888){if(_0x32a888){return _0x32a888['addProactiveActions'](_0x2cb743[_0xe4c4('0x66')][_0xe4c4('0x7d')],_[_0xe4c4('0x12b')](_0x2cb743[_0xe4c4('0x66')],[_0xe4c4('0x7d'),'id'])||{});}})[_0xe4c4('0x1c')](respondWithResult(_0x532964,null))[_0xe4c4('0x24')](handleError(_0x532964,null));};exports[_0xe4c4('0x12c')]=function(_0x5ea4a1,_0x398b00){var _0x1227c={};var _0x3169dd={};var _0x2ec4b0;var _0x20a4a6;return db['ChatWebsite'][_0xe4c4('0x79')]({'where':{'id':_0x5ea4a1[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x398b00,null))[_0xe4c4('0x1c')](function(_0x5af309){if(_0x5af309){_0x2ec4b0=_0x5af309;_0x3169dd[_0xe4c4('0x47')]=_[_0xe4c4('0x53')](db[_0xe4c4('0x12d')]['rawAttributes']);_0x3169dd['query']=_[_0xe4c4('0x53')](_0x5ea4a1[_0xe4c4('0x52')]);_0x3169dd[_0xe4c4('0x54')]=_[_0xe4c4('0x65')](_0x3169dd[_0xe4c4('0x47')],_0x3169dd[_0xe4c4('0x52')]);_0x1227c[_0xe4c4('0x55')]=_[_0xe4c4('0x65')](_0x3169dd[_0xe4c4('0x47')],qs['fields'](_0x5ea4a1[_0xe4c4('0x52')]['fields']));_0x1227c[_0xe4c4('0x55')]=_0x1227c[_0xe4c4('0x55')][_0xe4c4('0x57')]?_0x1227c['attributes']:_0x3169dd[_0xe4c4('0x47')];_0x1227c['order']=qs['sort'](_0x5ea4a1['query'][_0xe4c4('0x5a')]);_0x1227c['where']=qs[_0xe4c4('0x54')](_[_0xe4c4('0x5c')](_0x5ea4a1[_0xe4c4('0x52')],_0x3169dd['filters']));if(_0x5ea4a1['query']['filter']){_0x1227c[_0xe4c4('0x5b')]=_['merge'](_0x1227c[_0xe4c4('0x5b')],{'$or':_[_0xe4c4('0x4d')](_0x1227c[_0xe4c4('0x55')],function(_0x318271){var _0x393e92={};_0x393e92[_0x318271]={'$like':'%'+_0x5ea4a1[_0xe4c4('0x52')]['filter']+'%'};return _0x393e92;})});}_0x1227c=_['merge']({},_0x1227c,_0x5ea4a1['options']);return _0x2ec4b0['getProactiveActions'](_0x1227c);}})[_0xe4c4('0x1c')](function(_0x157422){if(_0x157422){_0x20a4a6=_0x157422[_0xe4c4('0x57')];if(!_0x5ea4a1['query'][_0xe4c4('0x58')](_0xe4c4('0x80'))){_0x1227c[_0xe4c4('0x27')]=qs[_0xe4c4('0x27')](_0x5ea4a1[_0xe4c4('0x52')]['limit']);_0x1227c[_0xe4c4('0x29')]=qs['offset'](_0x5ea4a1[_0xe4c4('0x52')][_0xe4c4('0x29')]);}return _0x2ec4b0[_0xe4c4('0x12c')](_0x1227c);}})[_0xe4c4('0x1c')](function(_0x19985e){if(_0x19985e){return _0x19985e?{'count':_0x20a4a6,'rows':_0x19985e}:null;}})[_0xe4c4('0x1c')](respondWithResult(_0x398b00,null))[_0xe4c4('0x24')](handleError(_0x398b00,null));};exports['getFields']=function(_0x163d02,_0x214f2c){var _0x409b67=_0x163d02[_0xe4c4('0x52')]['online']===_0xe4c4('0x12e')?'offlineForm':_0xe4c4('0x12f');return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'attributes':['id',_0x409b67],'where':{'id':_0x163d02['params']['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x214f2c,null))['then'](function(_0x57c62a){if(_0x57c62a){var _0x5369cf=_0x57c62a[_0x409b67];var _0x37e72d=_0x5369cf&&_0x5369cf[_0xe4c4('0x130')]?_0x5369cf[_0xe4c4('0x130')]:[];_0x214f2c[_0xe4c4('0x35')]({'fromKey':_[_0xe4c4('0x96')](_0x5369cf[_0xe4c4('0x131')])?undefined:_0x5369cf[_0xe4c4('0x131')],'count':_0x37e72d[_0xe4c4('0x57')],'rows':_0x37e72d});}})[_0xe4c4('0x24')](handleError(_0x214f2c,null));};exports[_0xe4c4('0x132')]=function(_0x481af5,_0x6536c0){var _0x41b65a={'raw':![],'where':{}};var _0x3082={};var _0x10aaa={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe4c4('0x79')]({'where':{'id':_0x481af5[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x6536c0,null))[_0xe4c4('0x1c')](function(_0x4cfffa){if(_0x4cfffa){_0x3082[_0xe4c4('0x47')]=_['keys'](db['ChatOfflineMessage'][_0xe4c4('0x4f')]);_0x3082[_0xe4c4('0x52')]=_['keys'](_0x481af5[_0xe4c4('0x52')]);_0x3082[_0xe4c4('0x54')]=_[_0xe4c4('0x65')](_0x3082[_0xe4c4('0x47')],_0x3082[_0xe4c4('0x52')]);_0x41b65a[_0xe4c4('0x55')]=_[_0xe4c4('0x65')](_0x3082[_0xe4c4('0x47')],qs[_0xe4c4('0x56')](_0x481af5['query']['fields']));_0x41b65a['attributes']=_0x41b65a[_0xe4c4('0x55')][_0xe4c4('0x57')]?_0x41b65a[_0xe4c4('0x55')]:_0x3082[_0xe4c4('0x47')];if(!_0x481af5['query'][_0xe4c4('0x58')](_0xe4c4('0x80'))){_0x41b65a['limit']=qs[_0xe4c4('0x27')](_0x481af5[_0xe4c4('0x52')][_0xe4c4('0x27')]);_0x41b65a['offset']=qs[_0xe4c4('0x29')](_0x481af5[_0xe4c4('0x52')][_0xe4c4('0x29')]);}_0x41b65a[_0xe4c4('0x59')]=qs['sort'](_0x481af5[_0xe4c4('0x52')][_0xe4c4('0x5a')]);_0x41b65a[_0xe4c4('0x5b')]=qs[_0xe4c4('0x54')](_[_0xe4c4('0x5c')](_0x481af5[_0xe4c4('0x52')],_0x3082[_0xe4c4('0x54')]));_0x41b65a[_0xe4c4('0x5b')][_0xe4c4('0x7a')]=_0x4cfffa['id'];if(_0x481af5[_0xe4c4('0x52')][_0xe4c4('0x5d')]){_0x41b65a[_0xe4c4('0x5b')]=_['merge'](_0x41b65a[_0xe4c4('0x5b')],{'$or':_[_0xe4c4('0x4d')](_0x41b65a[_0xe4c4('0x55')],function(_0x41f839){var _0x4d79b2={};_0x4d79b2[_0x41f839]={'$like':'%'+_0x481af5[_0xe4c4('0x52')][_0xe4c4('0x5d')]+'%'};return _0x4d79b2;})});}_0x41b65a=_[_0xe4c4('0x5e')]({},_0x41b65a,_0x481af5[_0xe4c4('0x60')]);return db[_0xe4c4('0xe7')][_0xe4c4('0x28')]({'where':_0x41b65a[_0xe4c4('0x5b')]})[_0xe4c4('0x1c')](function(_0x153150){_0x10aaa[_0xe4c4('0x28')]=_0x153150;if(_0x481af5[_0xe4c4('0x52')][_0xe4c4('0x61')]){_0x41b65a[_0xe4c4('0x62')]=[{'all':!![]}];}else{_0x41b65a['include']=[{'model':db[_0xe4c4('0xa3')],'as':_0xe4c4('0x106'),'required':![]},{'model':db[_0xe4c4('0xf2')],'as':_0xe4c4('0x133'),'required':![]}];}return db[_0xe4c4('0xe7')][_0xe4c4('0x10c')](_0x41b65a);})[_0xe4c4('0x1c')](function(_0x35e938){_0x10aaa[_0xe4c4('0x7b')]=_0x35e938;return _0x10aaa;});}})[_0xe4c4('0x1c')](respondWithFilteredResult(_0x6536c0,_0x41b65a))[_0xe4c4('0x24')](handleError(_0x6536c0,null));};exports['addAgents']=function(_0x256ef6,_0x392ae0){return db[_0xe4c4('0x4e')][_0xe4c4('0x6f')]({'where':{'id':_0x256ef6['params']['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x392ae0,null))[_0xe4c4('0x1c')](function(_0x34167a){if(_0x34167a){return _0x34167a[_0xe4c4('0x134')](_0x256ef6[_0xe4c4('0x66')]['ids'],_['omit'](_0x256ef6['body'],[_0xe4c4('0x7d'),'id'])||{})[_0xe4c4('0xe2')](function(_0x1be484){for(var _0x307beb=0x0;_0x307beb<_0x256ef6['body'][_0xe4c4('0x7d')]['length'];_0x307beb+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x256ef6['body'][_0xe4c4('0x7d')][_0x307beb]),'ChatWebsiteId':Number(_0x256ef6[_0xe4c4('0x64')]['id'])});}return _0x1be484;});}})[_0xe4c4('0x1c')](respondWithResult(_0x392ae0,null))[_0xe4c4('0x24')](handleError(_0x392ae0,null));};exports[_0xe4c4('0x135')]=function(_0x443ddb,_0x701cee){return db['ChatWebsite'][_0xe4c4('0x6f')]({'where':{'id':_0x443ddb[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x701cee,null))[_0xe4c4('0x1c')](function(_0x592bdc){if(_0x592bdc){return _0x592bdc[_0xe4c4('0x135')](_0x443ddb[_0xe4c4('0x52')][_0xe4c4('0x7d')])['then'](function(){if(_[_0xe4c4('0x136')](_0x443ddb[_0xe4c4('0x52')][_0xe4c4('0x7d')])){for(var _0x2d0d03=0x0;_0x2d0d03<_0x443ddb['query']['ids'][_0xe4c4('0x57')];_0x2d0d03+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x443ddb['query']['ids'][_0x2d0d03]),'ChatWebsiteId':Number(_0x443ddb[_0xe4c4('0x64')]['id'])});}}else{socket[_0xe4c4('0x137')]('userChatWebsite:remove',{'UserId':Number(_0x443ddb[_0xe4c4('0x52')][_0xe4c4('0x7d')]),'ChatWebsiteId':Number(_0x443ddb['params']['id'])});}});}})[_0xe4c4('0x1c')](respondWithStatusCode(_0x701cee,null))[_0xe4c4('0x24')](handleError(_0x701cee,null));};exports[_0xe4c4('0x138')]=function(_0x7a58c6,_0x530584){var _0x2e66c1={};var _0x36660e={};var _0x560404;var _0x49af45;return db[_0xe4c4('0x4e')][_0xe4c4('0x79')]({'where':{'id':_0x7a58c6[_0xe4c4('0x64')]['id']}})[_0xe4c4('0x1c')](handleEntityNotFound(_0x530584,null))[_0xe4c4('0x1c')](function(_0x4fdbb3){if(_0x4fdbb3){_0x560404=_0x4fdbb3;_0x36660e[_0xe4c4('0x47')]=_[_0xe4c4('0x53')](db[_0xe4c4('0xcc')][_0xe4c4('0x4f')]);_0x36660e[_0xe4c4('0x52')]=_[_0xe4c4('0x53')](_0x7a58c6[_0xe4c4('0x52')]);_0x36660e['filters']=_['intersection'](_0x36660e[_0xe4c4('0x47')],_0x36660e[_0xe4c4('0x52')]);_0x2e66c1[_0xe4c4('0x55')]=_[_0xe4c4('0x65')](_0x36660e['model'],qs[_0xe4c4('0x56')](_0x7a58c6[_0xe4c4('0x52')][_0xe4c4('0x56')]));_0x2e66c1['attributes']=_0x2e66c1['attributes']['length']?_0x2e66c1[_0xe4c4('0x55')]:_0x36660e[_0xe4c4('0x47')];_0x2e66c1[_0xe4c4('0x59')]=qs[_0xe4c4('0x5a')](_0x7a58c6[_0xe4c4('0x52')][_0xe4c4('0x5a')]);_0x2e66c1[_0xe4c4('0x5b')]=qs[_0xe4c4('0x54')](_[_0xe4c4('0x5c')](_0x7a58c6['query'],_0x36660e[_0xe4c4('0x54')]));if(_0x7a58c6[_0xe4c4('0x52')][_0xe4c4('0x5d')]){_0x2e66c1[_0xe4c4('0x5b')]=_['merge'](_0x2e66c1['where'],{'$or':_['map'](_0x2e66c1[_0xe4c4('0x55')],function(_0x30c149){var _0x1ab071={};_0x1ab071[_0x30c149]={'$like':'%'+_0x7a58c6[_0xe4c4('0x52')][_0xe4c4('0x5d')]+'%'};return _0x1ab071;})});}_0x2e66c1=_[_0xe4c4('0x5e')]({},_0x2e66c1,_0x7a58c6['options']);return _0x560404[_0xe4c4('0x138')](_0x2e66c1);}})['then'](function(_0x5e01f9){if(_0x5e01f9){_0x49af45=_0x5e01f9[_0xe4c4('0x57')];if(!_0x7a58c6[_0xe4c4('0x52')][_0xe4c4('0x58')]('nolimit')){_0x2e66c1[_0xe4c4('0x27')]=qs[_0xe4c4('0x27')](_0x7a58c6[_0xe4c4('0x52')][_0xe4c4('0x27')]);_0x2e66c1[_0xe4c4('0x29')]=qs[_0xe4c4('0x29')](_0x7a58c6['query'][_0xe4c4('0x29')]);}return _0x560404[_0xe4c4('0x138')](_0x2e66c1);}})[_0xe4c4('0x1c')](function(_0x405627){if(_0x405627){return _0x405627?{'count':_0x49af45,'rows':_0x405627}:null;}})['then'](respondWithResult(_0x530584,null))['catch'](handleError(_0x530584,null));}; \ No newline at end of file +var _0x81bd=['autoclose','close','*,*,*,*','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','ValidationError','no\x20available\x20attributes','difference','CompanyId','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','files','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','Smtp','mimetype','subjectOffline','mapValues','offlineMessageSubject','Chat','MailAccountId','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','virtual','custom','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.13.0','headers','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','api','../../config/environment','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','localhost','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','destroy','UserProfileResource','name','send','user-agent-parser','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','model','device','vendor','%s\x20%s\x20%s','type','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','params','Pause','options','find','create','body','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findAll','rows','removeDispositions','ids','ChatWebsiteId','CannedAnswer','getAnswers','findOne','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','createdAt','includes','updatedAt','ListId','from','CmList','CmContact','Contacts','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','priority','asc','list','contact','threadId','closed','externalUrl','ContactId','interaction','ChatInteraction','Writing\x20on\x20closed\x20interaction','messageId','created'];(function(_0x503b03,_0x216a86){var _0x8a53d6=function(_0x85e932){while(--_0x85e932){_0x503b03['push'](_0x503b03['shift']());}};_0x8a53d6(++_0x216a86);}(_0x81bd,0x7c));var _0xd81b=function(_0x427502,_0x4e6214){_0x427502=_0x427502-0x0;var _0x1baeff=_0x81bd[_0x427502];return _0x1baeff;};'use strict';var Mustache=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var ejs=require(_0xd81b('0x3'));var fs=require('fs');var fs_extra=require(_0xd81b('0x4'));var _=require(_0xd81b('0x5'));var querystring=require(_0xd81b('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0xd81b('0x7'));var jayson=require(_0xd81b('0x8'));var qs=require(_0xd81b('0x9'));var logger=require('../../config/logger')(_0xd81b('0xa'));var config=require(_0xd81b('0xb'));var APIBadRequestError=require(_0xd81b('0xc'))['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0xd81b('0xd')];var APIOutOfIntervalError=require('../../errors/api')[_0xd81b('0xe')];var APIHandleError=require(_0xd81b('0xc'))[_0xd81b('0xf')];var APIConflictError=require(_0xd81b('0xc'))[_0xd81b('0x10')];var wildcardUtils=require(_0xd81b('0x11'));var URL=require(_0xd81b('0x12'))[_0xd81b('0x13')];var db=require(_0xd81b('0x14'))['db'];config[_0xd81b('0x15')]=_[_0xd81b('0x16')](config[_0xd81b('0x15')],{'host':_0xd81b('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd81b('0x15')]));require('./chatWebsite.socket')[_0xd81b('0x18')](socket);var client=jayson[_0xd81b('0x19')]['http']({'port':0x232c});var client9002=jayson[_0xd81b('0x19')]['http']({'port':0x232a});var client9003=jayson[_0xd81b('0x19')][_0xd81b('0x1a')]({'port':0x232b});var client9001=jayson[_0xd81b('0x19')][_0xd81b('0x1a')]({'port':0x2329});function respondWithRpcPromise(_0x128162,_0x552215,_0x1c620d,_0x27b7a0){return new Promise(function(_0x5c2863,_0x2abef4){var _0x26df61=_0x27b7a0||client;return _0x26df61[_0xd81b('0x1b')](_0x128162,_0x1c620d)[_0xd81b('0x1c')](function(_0x5f7db6){logger[_0xd81b('0x1d')](_0xd81b('0x1e'),_0x552215,_0xd81b('0x1f'));logger[_0xd81b('0x20')](_0xd81b('0x21'),_0x552215,_0xd81b('0x1f'),JSON[_0xd81b('0x22')](_0x5f7db6));if(_0x5f7db6[_0xd81b('0x23')]){if(_0x5f7db6[_0xd81b('0x23')][_0xd81b('0x24')]===0x1f4){logger[_0xd81b('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x552215,_0x5f7db6['error'][_0xd81b('0x25')]);return _0x2abef4(_0x5f7db6[_0xd81b('0x23')][_0xd81b('0x25')]);}logger['error'](_0xd81b('0x1e'),_0x552215,_0x5f7db6[_0xd81b('0x23')]['message']);return _0x5c2863(_0x5f7db6[_0xd81b('0x23')][_0xd81b('0x25')]);}else{logger[_0xd81b('0x1d')](_0xd81b('0x1e'),_0x552215,_0xd81b('0x1f'));_0x5c2863(_0x5f7db6[_0xd81b('0x26')][_0xd81b('0x25')]);}})[_0xd81b('0x27')](function(_0x341aec){logger[_0xd81b('0x23')](_0xd81b('0x1e'),_0x552215,_0x341aec);_0x2abef4(_0x341aec);});});}function respondWithStatusCode(_0x1bf351,_0x596389){_0x596389=_0x596389||0xcc;return function(_0x28768f){if(_0x28768f){return _0x1bf351[_0xd81b('0x28')](_0x596389);}return _0x1bf351[_0xd81b('0x29')](_0x596389)[_0xd81b('0x2a')]();};}function respondWithResult(_0x3266c2,_0x2d0d02){_0x2d0d02=_0x2d0d02||0xc8;return function(_0x3e28dd){if(_0x3e28dd){return _0x3266c2[_0xd81b('0x29')](_0x2d0d02)[_0xd81b('0x2b')](_0x3e28dd);}};}function respondWithFilteredResult(_0x483a3d,_0x469cc4){return function(_0x4e2eff){if(_0x4e2eff){var _0x5c8aee=typeof _0x469cc4[_0xd81b('0x2c')]===_0xd81b('0x2d')&&typeof _0x469cc4['limit']==='undefined';var _0x4093c8=_0x4e2eff[_0xd81b('0x2e')];var _0x1b1434=_0x5c8aee?0x0:_0x469cc4[_0xd81b('0x2c')];var _0x1a1572=_0x5c8aee?_0x4e2eff[_0xd81b('0x2e')]:_0x469cc4['offset']+_0x469cc4[_0xd81b('0x2f')];var _0x26f629;if(_0x1a1572>=_0x4093c8){_0x1a1572=_0x4093c8;_0x26f629=0xc8;}else{_0x26f629=0xce;}_0x483a3d['status'](_0x26f629);return _0x483a3d['set'](_0xd81b('0x30'),_0x1b1434+'-'+_0x1a1572+'/'+_0x4093c8)[_0xd81b('0x2b')](_0x4e2eff);}return null;};}function saveUpdates(_0x50472a){return function(_0x50ce25){if(_0x50ce25){return _0x50ce25['update'](_0x50472a)[_0xd81b('0x1c')](function(_0x3ead68){return _0x3ead68;});}return null;};}function removeEntity(_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x31')]()[_0xd81b('0x1c')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='ChatWebsites';return db[_0xd81b('0x32')][_0xd81b('0x31')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1c')](function(){return _0x1c4cf7;});})[_0xd81b('0x1c')](function(){_0x1d2f46[_0xd81b('0x29')](0xcc)[_0xd81b('0x2a')]();});}};}function handleEntityNotFound(_0x1c20d3){return function(_0x2d23b9){if(!_0x2d23b9){_0x1c20d3[_0xd81b('0x28')](0x194);}return _0x2d23b9;};}function handleError(_0xe88a33,_0x1be4e2){_0x1be4e2=_0x1be4e2||0x1f4;return function(_0x3c8371){logger[_0xd81b('0x23')](_0x3c8371['stack']);if(_0x3c8371['name']){delete _0x3c8371[_0xd81b('0x33')];}_0xe88a33[_0xd81b('0x29')](_0x1be4e2)[_0xd81b('0x34')](_0x3c8371);};}function createInteractionObject(_0x59c066,_0x362ebc,_0x37ba34,_0x5a236a){var _0x46f058=require(_0xd81b('0x35'));var _0x512e39=new _0x46f058();var _0xed5272=_0x512e39['setUA'](_0x37ba34[_0xd81b('0x36')])[_0xd81b('0x37')]();var _0x203365=_0x362ebc[_0xd81b('0x38')];if(_0x37ba34['cf-connecting-ip']){_0x203365=_0x37ba34[_0xd81b('0x39')];}else if(_0x37ba34[_0xd81b('0x3a')]){_0x203365=_[_0xd81b('0x3b')](_0x37ba34[_0xd81b('0x3a')][_0xd81b('0x3c')](','));}return{'ContactId':_0x5a236a['id'],'ChatWebsiteId':_0x59c066,'from':(_0x5a236a[_0xd81b('0x3d')]||'')+'\x20'+(_0x5a236a[_0xd81b('0x3e')]||''),'customerIp':_0x203365,'customerPort':_0x37ba34['x-real-port']?_0x37ba34[_0xd81b('0x3f')]:null,'referer':_0x362ebc[_0xd81b('0x40')],'browserName':_0xed5272[_0xd81b('0x41')]['name']&&_0xed5272[_0xd81b('0x41')][_0xd81b('0x42')]?util[_0xd81b('0x43')](_0xd81b('0x44'),_0xed5272[_0xd81b('0x41')]['name'],_0xed5272[_0xd81b('0x41')][_0xd81b('0x42')]):_0xd81b('0x45'),'browserVersion':_0xed5272[_0xd81b('0x41')][_0xd81b('0x42')]||_0xd81b('0x45'),'osName':util[_0xd81b('0x43')](_0xd81b('0x44'),_0xed5272['os'][_0xd81b('0x33')],_0xed5272['os'][_0xd81b('0x42')]),'osVersion':_0xed5272['os'][_0xd81b('0x42')],'deviceModel':_0xed5272['device'][_0xd81b('0x46')]&&_0xed5272[_0xd81b('0x47')][_0xd81b('0x48')]?util[_0xd81b('0x43')](_0xd81b('0x49'),_0xed5272[_0xd81b('0x47')][_0xd81b('0x46')],_0xed5272[_0xd81b('0x47')]['vendor'],_0xed5272['device'][_0xd81b('0x4a')]):null,'deviceVendor':_0xed5272[_0xd81b('0x47')][_0xd81b('0x48')],'deviceType':_0xed5272[_0xd81b('0x47')][_0xd81b('0x4a')],'formData':JSON[_0xd81b('0x22')](_0x362ebc)};}exports[_0xd81b('0x4b')]=function(_0x2e44f3,_0x2fa588){var _0xcfbbc2={'include':[{'model':db['Pause'],'as':_0xd81b('0x4c')}]},_0x41e2e6={},_0x38e436={'count':0x0,'rows':[]};var _0x2b61fc=_[_0xd81b('0x4d')](db[_0xd81b('0x4e')][_0xd81b('0x4f')],function(_0x410ef3){return{'name':_0x410ef3[_0xd81b('0x50')],'type':_0x410ef3[_0xd81b('0x4a')][_0xd81b('0x51')]};});_0x41e2e6['model']=_[_0xd81b('0x4d')](_0x2b61fc,_0xd81b('0x33'));_0x41e2e6[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x2e44f3['query']);_0x41e2e6[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x41e2e6[_0xd81b('0x46')],_0x41e2e6[_0xd81b('0x52')]);_0xcfbbc2[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x41e2e6[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x2e44f3[_0xd81b('0x52')]['fields']));_0xcfbbc2['attributes']=_0xcfbbc2[_0xd81b('0x56')][_0xd81b('0x58')]?_0xcfbbc2[_0xd81b('0x56')]:_0x41e2e6[_0xd81b('0x46')];if(!_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0xcfbbc2[_0xd81b('0x2f')]=qs['limit'](_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x2f')]);_0xcfbbc2[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x2e44f3[_0xd81b('0x52')]['offset']);}_0xcfbbc2[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x2e44f3['query'][_0xd81b('0x5c')]);_0xcfbbc2[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0x2e44f3[_0xd81b('0x52')],_0x41e2e6[_0xd81b('0x54')]),_0x2b61fc);if(_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x5f')]){_0xcfbbc2[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0xcfbbc2[_0xd81b('0x5d')],{'$or':_['map'](_0x2b61fc,function(_0x285e82){if(_0x285e82['type']!==_0xd81b('0x61')){var _0x7b438c={};_0x7b438c[_0x285e82[_0xd81b('0x33')]]={'$like':'%'+_0x2e44f3[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x7b438c;}})});}_0xcfbbc2=_[_0xd81b('0x60')]({},_0xcfbbc2,_0x2e44f3['options']);var _0x2d978d={'where':_0xcfbbc2[_0xd81b('0x5d')]};return db['ChatWebsite']['count'](_0x2d978d)[_0xd81b('0x1c')](function(_0x59e018){_0x38e436[_0xd81b('0x2e')]=_0x59e018;if(_0x2e44f3['query'][_0xd81b('0x62')]){_0xcfbbc2[_0xd81b('0x63')]=[{'all':!![]}];}return db[_0xd81b('0x4e')]['findAll'](_0xcfbbc2);})[_0xd81b('0x1c')](function(_0x10ed99){_0x38e436['rows']=_0x10ed99;return _0x38e436;})[_0xd81b('0x1c')](respondWithFilteredResult(_0x2fa588,_0xcfbbc2))[_0xd81b('0x27')](handleError(_0x2fa588,null));};exports['show']=function(_0x1ba5d6,_0x5e1cd7){var _0x3c9264={'raw':![],'where':{'id':_0x1ba5d6[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0x65')],'as':_0xd81b('0x4c')}]},_0x31553e={};_0x31553e[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0x4e')][_0xd81b('0x4f')]);_0x31553e[_0xd81b('0x52')]=_['keys'](_0x1ba5d6[_0xd81b('0x52')]);_0x31553e[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x31553e[_0xd81b('0x46')],_0x31553e[_0xd81b('0x52')]);_0x3c9264[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x31553e['model'],qs['fields'](_0x1ba5d6['query'][_0xd81b('0x57')]));_0x3c9264[_0xd81b('0x56')]=_0x3c9264[_0xd81b('0x56')][_0xd81b('0x58')]?_0x3c9264[_0xd81b('0x56')]:_0x31553e[_0xd81b('0x46')];if(_0x1ba5d6[_0xd81b('0x52')]['includeAll']){_0x3c9264[_0xd81b('0x63')]=[{'all':!![]}];}_0x3c9264=_[_0xd81b('0x60')]({},_0x3c9264,_0x1ba5d6[_0xd81b('0x66')]);return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x3c9264)[_0xd81b('0x1c')](handleEntityNotFound(_0x5e1cd7,null))[_0xd81b('0x1c')](respondWithResult(_0x5e1cd7,null))['catch'](handleError(_0x5e1cd7,null));};exports[_0xd81b('0x68')]=function(_0x15f003,_0x12b2a7){var _0x8cf25d=null;_0x15f003[_0xd81b('0x69')][_0xd81b('0x6a')][_0xd81b('0x3c')](',')[_0xd81b('0x6b')](_0x8fa8cd=>{if(_0x8fa8cd[_0xd81b('0x6c')]()!==''&&!wildcardUtils[_0xd81b('0x6d')](_0x8fa8cd[_0xd81b('0x6c')]())){_0x8cf25d=new APIBadRequestError('\x22'+_0x8fa8cd['trim']()+_0xd81b('0x6e'));}});if(_0x8cf25d){return handleError(_0x12b2a7,null)(_0x8cf25d);}return db['ChatWebsite'][_0xd81b('0x68')](_0x15f003[_0xd81b('0x69')],{})[_0xd81b('0x1c')](function(_0xc3c117){var _0xb94a69=_0x15f003[_0xd81b('0x6f')][_0xd81b('0x70')]({'plain':!![]});if(!_0xb94a69)throw new Error(_0xd81b('0x71'));if(_0xb94a69[_0xd81b('0x72')]===_0xd81b('0x6f')){var _0x5bcfd7=_0xc3c117[_0xd81b('0x70')]({'plain':!![]});var _0x344c32=_0xd81b('0x73');return db[_0xd81b('0x74')][_0xd81b('0x67')]({'where':{'name':_0x344c32,'userProfileId':_0xb94a69['userProfileId']},'raw':!![]})['then'](function(_0x3274d2){if(_0x3274d2&&_0x3274d2[_0xd81b('0x75')]===0x0){return db[_0xd81b('0x32')][_0xd81b('0x68')]({'name':_0x5bcfd7[_0xd81b('0x33')],'resourceId':_0x5bcfd7['id'],'type':_0x3274d2[_0xd81b('0x33')],'sectionId':_0x3274d2['id']},{})[_0xd81b('0x1c')](function(){return _0xc3c117;});}else{return _0xc3c117;}})['catch'](function(_0x2190df){logger[_0xd81b('0x23')](_0xd81b('0x76'),_0x2190df);throw _0x2190df;});}return _0xc3c117;})[_0xd81b('0x1c')](respondWithResult(_0x12b2a7,0xc9))[_0xd81b('0x27')](handleError(_0x12b2a7,null));};exports[_0xd81b('0x77')]=function(_0x1e0da3,_0x185f28){var _0x2315db=null;_0x1e0da3['body'][_0xd81b('0x6a')][_0xd81b('0x3c')](',')[_0xd81b('0x6b')](_0x9c30e7=>{if(_0x9c30e7[_0xd81b('0x6c')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x9c30e7[_0xd81b('0x6c')]())){_0x2315db=new APIBadRequestError('\x22'+_0x9c30e7[_0xd81b('0x6c')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x2315db){return handleError(_0x185f28,null)(_0x2315db);}if(_0x1e0da3[_0xd81b('0x69')]['id']){delete _0x1e0da3[_0xd81b('0x69')]['id'];}return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x1e0da3[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0x65')],'as':'mandatoryDispositionPause'}]})[_0xd81b('0x1c')](handleEntityNotFound(_0x185f28,null))[_0xd81b('0x1c')](saveUpdates(_0x1e0da3[_0xd81b('0x69')],null))['then'](respondWithResult(_0x185f28,null))['catch'](handleError(_0x185f28,null));};exports[_0xd81b('0x31')]=function(_0x950cc3,_0x36c694){return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x950cc3[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x36c694,null))[_0xd81b('0x1c')](removeEntity(_0x36c694,null))['catch'](handleError(_0x36c694,null));};exports['describe']=function(_0x42ae01,_0x256696){return db[_0xd81b('0x4e')][_0xd81b('0x78')]()['then'](respondWithResult(_0x256696,null))[_0xd81b('0x27')](handleError(_0x256696,null));};exports[_0xd81b('0x79')]=function(_0x4b8294,_0x46e36b){if(_0x4b8294['body']['id']){delete _0x4b8294[_0xd81b('0x69')]['id'];}return db[_0xd81b('0x4e')]['find']({'where':{'id':_0x4b8294[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x46e36b,null))[_0xd81b('0x1c')](function(_0x2490f1){if(_0x2490f1){_0x4b8294[_0xd81b('0x69')]['ChatWebsiteId']=_0x2490f1['id'];return db[_0xd81b('0x7a')][_0xd81b('0x68')](_0x4b8294[_0xd81b('0x69')]);}})[_0xd81b('0x1c')](respondWithResult(_0x46e36b,null))[_0xd81b('0x27')](handleError(_0x46e36b,null));};exports[_0xd81b('0x7b')]=function(_0x579052,_0x5c8ea0){var _0x31509d={'raw':![],'where':{}};var _0x3023d9={};var _0x97bd3e={'count':0x0,'rows':[]};return db[_0xd81b('0x4e')]['findOne']({'where':{'id':_0x579052[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x5c8ea0,null))[_0xd81b('0x1c')](function(_0x195f1c){if(_0x195f1c){_0x3023d9[_0xd81b('0x46')]=_['keys'](db[_0xd81b('0x7a')][_0xd81b('0x4f')]);_0x3023d9[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x579052[_0xd81b('0x52')]);_0x3023d9[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x3023d9['model'],_0x3023d9[_0xd81b('0x52')]);_0x31509d[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x3023d9[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x579052[_0xd81b('0x52')]['fields']));_0x31509d[_0xd81b('0x56')]=_0x31509d['attributes'][_0xd81b('0x58')]?_0x31509d[_0xd81b('0x56')]:_0x3023d9[_0xd81b('0x46')];if(!_0x579052['query'][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x31509d[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x579052[_0xd81b('0x52')][_0xd81b('0x2f')]);_0x31509d['offset']=qs[_0xd81b('0x2c')](_0x579052['query']['offset']);}_0x31509d[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x579052[_0xd81b('0x52')]['sort']);_0x31509d[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0x579052[_0xd81b('0x52')],_0x3023d9[_0xd81b('0x54')]));_0x31509d[_0xd81b('0x5d')]['ChatWebsiteId']=_0x195f1c['id'];if(_0x579052[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x31509d[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x31509d[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x31509d[_0xd81b('0x56')],function(_0x270d82){var _0x380951={};_0x380951[_0x270d82]={'$like':'%'+_0x579052[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x380951;})});}_0x31509d=_[_0xd81b('0x60')]({},_0x31509d,_0x579052[_0xd81b('0x66')]);return db[_0xd81b('0x7a')][_0xd81b('0x2e')]({'where':_0x31509d['where']})[_0xd81b('0x1c')](function(_0x47f90e){_0x97bd3e[_0xd81b('0x2e')]=_0x47f90e;if(_0x579052[_0xd81b('0x52')][_0xd81b('0x62')]){_0x31509d[_0xd81b('0x63')]=[{'all':!![]}];}return db[_0xd81b('0x7a')][_0xd81b('0x7c')](_0x31509d);})['then'](function(_0x3a41e6){_0x97bd3e[_0xd81b('0x7d')]=_0x3a41e6;return _0x97bd3e;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x5c8ea0,_0x31509d))[_0xd81b('0x27')](handleError(_0x5c8ea0,null));};exports[_0xd81b('0x7e')]=function(_0x6e4c25,_0x2481e9){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x6e4c25[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x2481e9,null))[_0xd81b('0x1c')](function(_0x5a02f7){if(_0x5a02f7){return _0x5a02f7[_0xd81b('0x7e')](_0x6e4c25[_0xd81b('0x52')][_0xd81b('0x7f')]);}})[_0xd81b('0x1c')](respondWithStatusCode(_0x2481e9,null))[_0xd81b('0x27')](handleError(_0x2481e9,null));};exports['addAnswer']=function(_0x421c2b,_0x1e61d8){if(_0x421c2b[_0xd81b('0x69')]['id']){delete _0x421c2b[_0xd81b('0x69')]['id'];}return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x421c2b['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x1e61d8,null))['then'](function(_0x4461f3){if(_0x4461f3){_0x421c2b[_0xd81b('0x69')][_0xd81b('0x80')]=_0x4461f3['id'];return db[_0xd81b('0x81')]['create'](_0x421c2b[_0xd81b('0x69')]);}})[_0xd81b('0x1c')](respondWithResult(_0x1e61d8,null))['catch'](handleError(_0x1e61d8,null));};exports[_0xd81b('0x82')]=function(_0x142d78,_0x2c1a0e){var _0x1c6291={'raw':![],'where':{}};var _0x2f9a9f={};var _0x4c8925={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd81b('0x83')]({'where':{'id':_0x142d78['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x2c1a0e,null))['then'](function(_0x509001){if(_0x509001){_0x2f9a9f[_0xd81b('0x46')]=_[_0xd81b('0x53')](db['CannedAnswer']['rawAttributes']);_0x2f9a9f[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x142d78['query']);_0x2f9a9f[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x2f9a9f[_0xd81b('0x46')],_0x2f9a9f[_0xd81b('0x52')]);_0x1c6291['attributes']=_[_0xd81b('0x55')](_0x2f9a9f[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x142d78['query']['fields']));_0x1c6291[_0xd81b('0x56')]=_0x1c6291[_0xd81b('0x56')][_0xd81b('0x58')]?_0x1c6291[_0xd81b('0x56')]:_0x2f9a9f[_0xd81b('0x46')];if(!_0x142d78['query']['hasOwnProperty'](_0xd81b('0x5a'))){_0x1c6291[_0xd81b('0x2f')]=qs['limit'](_0x142d78['query'][_0xd81b('0x2f')]);_0x1c6291[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x142d78[_0xd81b('0x52')][_0xd81b('0x2c')]);}_0x1c6291[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x142d78[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x1c6291[_0xd81b('0x5d')]=qs['filters'](_['pick'](_0x142d78[_0xd81b('0x52')],_0x2f9a9f[_0xd81b('0x54')]));_0x1c6291[_0xd81b('0x5d')][_0xd81b('0x80')]=_0x509001['id'];if(_0x142d78[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x1c6291[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x1c6291[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x1c6291[_0xd81b('0x56')],function(_0x32e484){var _0x30fb62={};_0x30fb62[_0x32e484]={'$like':'%'+_0x142d78[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x30fb62;})});}_0x1c6291=_['merge']({},_0x1c6291,_0x142d78[_0xd81b('0x66')]);return db[_0xd81b('0x81')][_0xd81b('0x2e')]({'where':_0x1c6291['where']})[_0xd81b('0x1c')](function(_0x3bd28c){_0x4c8925[_0xd81b('0x2e')]=_0x3bd28c;if(_0x142d78[_0xd81b('0x52')][_0xd81b('0x62')]){_0x1c6291['include']=[{'all':!![]}];}return db[_0xd81b('0x81')][_0xd81b('0x7c')](_0x1c6291);})[_0xd81b('0x1c')](function(_0x30fe56){_0x4c8925[_0xd81b('0x7d')]=_0x30fe56;return _0x4c8925;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x2c1a0e,_0x1c6291))[_0xd81b('0x27')](handleError(_0x2c1a0e,null));};exports[_0xd81b('0x84')]=function(_0x1c3ea4,_0x282e83){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x1c3ea4['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x282e83,null))[_0xd81b('0x1c')](function(_0x15d52d){if(_0x15d52d){return _0x15d52d['removeAnswers'](_0x1c3ea4[_0xd81b('0x52')][_0xd81b('0x7f')]);}})[_0xd81b('0x1c')](respondWithStatusCode(_0x282e83,null))[_0xd81b('0x27')](handleError(_0x282e83,null));};exports['addLogo']=function(_0x1e5f94,_0x4e037b){_0x1e5f94['body'][_0xd81b('0x85')]=_0x1e5f94[_0xd81b('0x86')][_0xd81b('0x87')];return db[_0xd81b('0x4e')]['find']({'where':{'id':_0x1e5f94['params']['id']}})['then'](handleEntityNotFound(_0x4e037b,null))[_0xd81b('0x1c')](saveUpdates(_0x1e5f94[_0xd81b('0x69')],null))[_0xd81b('0x1c')](respondWithResult(_0x4e037b,null))[_0xd81b('0x27')](handleError(_0x4e037b,null));};exports[_0xd81b('0x88')]=function(_0x36611b,_0x368fc6){_0x36611b[_0xd81b('0x69')][_0xd81b('0x89')]=_0x36611b[_0xd81b('0x86')][_0xd81b('0x87')];return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x36611b[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x368fc6,null))[_0xd81b('0x1c')](saveUpdates(_0x36611b[_0xd81b('0x69')],null))[_0xd81b('0x1c')](respondWithResult(_0x368fc6,null))[_0xd81b('0x27')](handleError(_0x368fc6,null));};exports[_0xd81b('0x8a')]=function(_0x4c6848,_0x1162c0){_0x4c6848[_0xd81b('0x69')][_0xd81b('0x8b')]=_0x4c6848[_0xd81b('0x86')][_0xd81b('0x87')];return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x4c6848[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x1162c0,null))[_0xd81b('0x1c')](saveUpdates(_0x4c6848[_0xd81b('0x69')],null))[_0xd81b('0x1c')](respondWithResult(_0x1162c0,null))[_0xd81b('0x27')](handleError(_0x1162c0,null));};exports[_0xd81b('0x8c')]=function(_0x11b49d,_0x22e808){_0x11b49d[_0xd81b('0x69')][_0xd81b('0x8d')]=_0x11b49d[_0xd81b('0x86')][_0xd81b('0x87')];return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x11b49d[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x22e808,null))[_0xd81b('0x1c')](saveUpdates(_0x11b49d['body'],null))[_0xd81b('0x1c')](respondWithResult(_0x22e808,null))[_0xd81b('0x27')](handleError(_0x22e808,null));};exports[_0xd81b('0x8e')]=function(_0x478b92,_0xf13081){var _0x3069d1=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/logos/default_logo.svg');var _0x2a6dcb={'where':{'id':_0x478b92[_0xd81b('0x64')]['id']},'attributes':['id',_0xd81b('0x85')],'raw':!![]};var _0xf2e1b5=![];return require(_0xd81b('0x91'))[_0xd81b('0x92')]()[_0xd81b('0x1c')](function(_0x55384e){if(_0x55384e){_0xf2e1b5=_0x55384e['custom'];}})[_0xd81b('0x1c')](function(){return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x2a6dcb);})['then'](handleEntityNotFound(_0xf13081,null))[_0xd81b('0x1c')](function(_0x5189b8){if(_0x5189b8){if(!_[_0xd81b('0x93')](_0x5189b8[_0xd81b('0x85')])){if(fs[_0xd81b('0x94')](path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x95'),_0x5189b8[_0xd81b('0x85')]))&&_0xf2e1b5){_0x3069d1=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/logos/',_0x5189b8[_0xd81b('0x85')]);}}return _0xf13081[_0xd81b('0x96')](_0x3069d1);}})[_0xd81b('0x27')](handleError(_0xf13081,null));};exports['getAvatar']=function(_0x4b2b45,_0x4d44d7){var _0x3c5ea6=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x97'));var _0x175d02={'where':{'id':_0x4b2b45[_0xd81b('0x64')]['id']},'attributes':['id',_0xd81b('0x89')],'raw':!![]};return db['ChatWebsite'][_0xd81b('0x67')](_0x175d02)[_0xd81b('0x1c')](handleEntityNotFound(_0x4d44d7,null))[_0xd81b('0x1c')](function(_0x361d5a){if(_0x361d5a){if(!_['isNil'](_0x361d5a[_0xd81b('0x89')])){if(fs['existsSync'](path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x98'),_0x361d5a['agentAvatar']))){_0x3c5ea6=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/avatars/',_0x361d5a[_0xd81b('0x89')]);}}return _0x4d44d7['download'](_0x3c5ea6);}})[_0xd81b('0x27')](handleError(_0x4d44d7,null));};exports[_0xd81b('0x99')]=function(_0x10449f,_0x539668){var _0x277379=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x9a'));var _0x1e2612={'where':{'id':_0x10449f[_0xd81b('0x64')]['id']},'attributes':['id','customerAvatar',_0xd81b('0x9b')],'raw':!![]};return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x1e2612)['then'](handleEntityNotFound(_0x539668,null))[_0xd81b('0x1c')](function(_0xc9bdfe){if(_0xc9bdfe){if(!_[_0xd81b('0x93')](_0xc9bdfe[_0xd81b('0x8b')])){if(fs[_0xd81b('0x94')](path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/avatars/',_0xc9bdfe['customerAvatar']))&&_0xc9bdfe['showCustomerAvatar']){_0x277379=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],'server/files/images/avatars/',_0xc9bdfe[_0xd81b('0x8b')]);}}return _0x539668['download'](_0x277379);}})['catch'](handleError(_0x539668,null));};exports[_0xd81b('0x9c')]=function(_0x397d26,_0x335713){var _0x1b18ef=path[_0xd81b('0x8f')](config[_0xd81b('0x90')],_0xd81b('0x9d'));var _0x13e25f={'where':{'id':_0x397d26[_0xd81b('0x64')]['id']},'attributes':['id',_0xd81b('0x8d')],'raw':!![]};return db[_0xd81b('0x4e')][_0xd81b('0x67')](_0x13e25f)[_0xd81b('0x1c')](handleEntityNotFound(_0x335713,null))[_0xd81b('0x1c')](function(_0x4283bd){if(_0x4283bd){if(!_['isNil'](_0x4283bd[_0xd81b('0x8d')])){if(fs[_0xd81b('0x94')](path['join'](config[_0xd81b('0x90')],'server/files/images/avatars/',_0x4283bd[_0xd81b('0x8d')]))){_0x1b18ef=path['join'](config[_0xd81b('0x90')],_0xd81b('0x98'),_0x4283bd[_0xd81b('0x8d')]);}}return _0x335713[_0xd81b('0x96')](_0x1b18ef);}})[_0xd81b('0x27')](handleError(_0x335713,null));};function checkWebsiteInterval(_0x2164d4){var _0x7e3d22=_0x2164d4[_0xd81b('0x9e')];if(!_0x7e3d22){return Promise[_0xd81b('0x9f')](_0x2164d4);}var _0x1b0156=_0x2164d4[_0xd81b('0xa0')]||undefined;return _0x7e3d22[_0xd81b('0xa1')](_0x1b0156)['then'](function(_0x8cda4b){if(!_0x8cda4b){throw new APIOutOfIntervalError();}return _0x2164d4;});}exports[_0xd81b('0xa2')]=function(_0x22dd20,_0x2ea321){var _0x305014={'body':_0x22dd20[_0xd81b('0x69')],'channel':_0xd81b('0xa3')};var _0x10382d=[];var _0x282942=[];var _0x24a88b={};var _0x48e6ba=![];if(_0x22dd20[_0xd81b('0x69')]['id']){delete _0x22dd20[_0xd81b('0x69')]['id'];}if(_['isNil'](_0x22dd20[_0xd81b('0x69')]['from'])){throw new APIBadRequestError(_0xd81b('0xa4'));}if(_[_0xd81b('0x93')](_0x22dd20['body'][_0xd81b('0xa5')])){throw new APIBadRequestError(_0xd81b('0xa6'));}if(_[_0xd81b('0xa7')](_0x22dd20[_0xd81b('0x69')]['body'])){throw new APIBadRequestError(_0xd81b('0xa8'));}var _0x3a248d=_0x22dd20[_0xd81b('0x69')][_0xd81b('0x38')]&&_0x22dd20[_0xd81b('0x69')][_0xd81b('0x40')];return db['CmContact'][_0xd81b('0x78')]()[_0xd81b('0x1c')](function(_0x14a219){if(!_0x14a219){throw new Error('No\x20available\x20attributes');}_0x10382d=Object['keys'](_0x14a219)[_0xd81b('0x5f')](function(_0x322771){return![_0xd81b('0xa9'),'updatedAt'][_0xd81b('0xaa')](_0x322771);});_0x282942=Object[_0xd81b('0x53')](_0x14a219)[_0xd81b('0x5f')](function(_0x4719f3){return![_0xd81b('0xa9'),_0xd81b('0xab'),'CompanyId',_0xd81b('0xac')][_0xd81b('0xaa')](_0x4719f3);});if(!_['includes'](_0x282942,_0x22dd20[_0xd81b('0x69')][_0xd81b('0xa5')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x282942[_0xd81b('0x8f')](',\x20'));}_0x24a88b[_0x22dd20[_0xd81b('0x69')][_0xd81b('0xa5')]]=_0x22dd20[_0xd81b('0x69')][_0xd81b('0xad')];})[_0xd81b('0x1c')](function(){return db[_0xd81b('0x4e')]['find']({'where':{'id':_0x22dd20[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0xae')],'as':'List','include':[{'model':db[_0xd81b('0xaf')],'as':_0xd81b('0xb0'),'where':_0x24a88b,'limit':0x1,'order':[['updatedAt',_0xd81b('0xb1')]]}]},{'model':db[_0xd81b('0xb2')],'as':_0xd81b('0xb3')},{'model':db[_0xd81b('0x9e')],'as':_0xd81b('0x9e'),'include':[{'model':db['Interval'],'as':_0xd81b('0xb4'),'attributes':['id',_0xd81b('0xb5')],'raw':!![]}]}]});})[_0xd81b('0x1c')](function(_0x9658e){if(!_0x9658e){throw new APINotFoundError(util[_0xd81b('0x43')](_0xd81b('0xb6'),_0x22dd20[_0xd81b('0x64')]['id']));}if(_0x3a248d){return checkWebsiteInterval(_0x9658e);}return _0x9658e;})[_0xd81b('0x1c')](function(_0x44d405){_0x305014[_0xd81b('0xb7')]=_0x44d405;_0x305014[_0xd81b('0xb8')]=_['orderBy'](_0x44d405['Applications'],[_0xd81b('0xb9')],[_0xd81b('0xba')]);if(_0x305014[_0xd81b('0xb7')]['Applications']){delete _0x305014[_0xd81b('0xb7')][_0xd81b('0xb3')];}_0x305014[_0xd81b('0xbb')]=_0x44d405['List']||{'id':_0x44d405[_0xd81b('0xac')]};if(_0x305014[_0xd81b('0xbb')]&&_0x305014['list'][_0xd81b('0xb0')][_0xd81b('0x58')]){return _0x305014[_0xd81b('0xbb')][_0xd81b('0xb0')][0x0];}var _0x8026d7=_[_0xd81b('0x16')](_0x22dd20[_0xd81b('0x69')],{'firstName':_0x22dd20['body'][_0xd81b('0xad')],'ListId':_0x44d405[_0xd81b('0xac')]});_0x8026d7[_0x22dd20['body'][_0xd81b('0xa5')]]=_0x22dd20['body'][_0xd81b('0xad')];return db[_0xd81b('0xaf')][_0xd81b('0x68')](_0x8026d7,{'fields':_0x10382d,'raw':!![]});})[_0xd81b('0x1c')](function(_0x3a6e15){_0x305014[_0xd81b('0xbc')]=_0x3a6e15;var _0x87b315=createInteractionObject(_0x22dd20['params']['id'],_0x22dd20[_0xd81b('0x69')],_0x22dd20['headers'],_0x3a6e15);var _0x48073b={'ChatWebsiteId':_0x22dd20[_0xd81b('0x64')]['id']};if(_0x22dd20['body'][_0xd81b('0xbd')]){_0x48073b[_0xd81b('0xbd')]=_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')];_0x48073b['closed']=![];return db['ChatInteraction'][_0xd81b('0x67')]({'where':_0x48073b})[_0xd81b('0x1c')](function(_0x50529b){var _0x2ec729=_0x22dd20[_0xd81b('0x69')][_0xd81b('0x38')]&&_0x22dd20['body'][_0xd81b('0x40')];if(_0x50529b){_0x48e6ba=!![];return _0x50529b;}else if(!_0x2ec729&&_0x50529b&&_0x50529b[_0xd81b('0xbe')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x87b315[_0xd81b('0xbd')]=_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')];_0x87b315[_0xd81b('0xbf')]=_0x22dd20[_0xd81b('0x69')]['externalUrl'];return db['ChatInteraction'][_0xd81b('0x68')](_0x87b315);});}_0x48073b[_0xd81b('0xc0')]=_0x3a6e15['id'];if(_0x22dd20[_0xd81b('0x69')][_0xd81b('0xc1')]&&_0x22dd20['body'][_0xd81b('0xc1')]['id']){_0x48073b['id']=_0x22dd20['body'][_0xd81b('0xc1')]['id'];return db[_0xd81b('0xc2')]['find']({'where':_0x48073b})[_0xd81b('0x1c')](function(_0x264d72){var _0x1d5dac=_0x22dd20['body'][_0xd81b('0x38')]&&_0x22dd20[_0xd81b('0x69')][_0xd81b('0x40')];if(!_0x1d5dac&&_0x264d72&&_0x264d72['closed']){throw new APIConflictError(_0xd81b('0xc3'));}else if(_0x264d72){_0x48e6ba=!![];return _0x264d72;}else{return db[_0xd81b('0xc2')][_0xd81b('0x68')](_0x87b315);}});}return db[_0xd81b('0xc2')][_0xd81b('0x68')](_0x87b315);})['then'](function(_0x5c3dce){if(!_0x48e6ba){return _0x5c3dce;}var _0x105735={'from':(_0x305014[_0xd81b('0xbc')][_0xd81b('0x3d')]||'')+'\x20'+(_0x305014[_0xd81b('0xbc')]['lastName']||'')};if(_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')]&&_0x22dd20[_0xd81b('0x69')]['messageId']&&_0x22dd20[_0xd81b('0x69')][_0xd81b('0xbd')]!=_0x22dd20[_0xd81b('0x69')]['messageId']){_0x105735['threadId']=_0x22dd20['body'][_0xd81b('0xc4')];}return _0x5c3dce['update'](_0x105735);})[_0xd81b('0x1c')](function(_0x3d7a57){_0x305014[_0xd81b('0xc1')]=_0x3d7a57['get']({'plain':!![]});_0x305014['interaction'][_0xd81b('0xc5')]=!_0x48e6ba;if(_0x305014['interaction'][_0xd81b('0xc5')]){if(_0x305014[_0xd81b('0xb7')][_0xd81b('0xc6')]){_0x305014[_0xd81b('0xb8')]['push']({'id':0x0,'priority':_0x305014[_0xd81b('0xb8')][_0xd81b('0x58')]+0x1,'app':_0xd81b('0xc7'),'appdata':'unmanaged','interval':_0xd81b('0xc8')});}}return db['ChatMessage'][_0xd81b('0x68')]({'body':_0x22dd20[_0xd81b('0x69')]['body'],'ChatWebsiteId':_0x22dd20[_0xd81b('0x64')]['id'],'ChatInteractionId':_0x3d7a57['id'],'direction':'in','ContactId':_0x305014[_0xd81b('0xbc')]['id'],'AttachmentId':_0x22dd20[_0xd81b('0x69')]['AttachmentId']});})['then'](function(_0x1c10da){_0x305014[_0xd81b('0x25')]=_0x1c10da;if(!_0x305014[_0xd81b('0xc1')][_0xd81b('0xc9')]){return;}return db[_0xd81b('0xca')][_0xd81b('0x67')]({'attributes':['id',_0xd81b('0x33')],'where':{'id':_0x305014['interaction']['UserId']}});})[_0xd81b('0x1c')](function(_0x10f27c){if(_0x10f27c){_0x305014[_0xd81b('0xb8')][_0xd81b('0xcb')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x10f27c[_0xd81b('0x33')]+','+(_0x305014[_0xd81b('0xb7')][_0xd81b('0xcc')]||0xa),'interval':_0xd81b('0xc8')});_0x305014[_0xd81b('0xcd')]=!![];}if(!_0x305014['interaction']['queueId']){return;}return db[_0xd81b('0xce')][_0xd81b('0x67')]({'attributes':['id',_0xd81b('0x33')],'where':{'id':_0x305014[_0xd81b('0xc1')][_0xd81b('0xcf')]}});})['then'](function(_0x49e5dd){if(_0x49e5dd){_0x305014[_0xd81b('0xb8')]['unshift']({'id':0x0,'priority':0x1,'app':_0xd81b('0xd0'),'appdata':_0x49e5dd[_0xd81b('0x33')]+','+(_0x305014[_0xd81b('0xb7')][_0xd81b('0xd1')]||0x12c),'interval':_0xd81b('0xc8')});}return respondWithRpcPromise(_0xd81b('0xd2'),_0xd81b('0xd3'),_0x305014);})[_0xd81b('0x1c')](function(_0x538cc2){respondWithRpcPromise(_0xd81b('0xd4'),_0xd81b('0xd4'),{'event':_0xd81b('0xa2'),'message':_0x538cc2},client9002);return _0x538cc2;})[_0xd81b('0x1c')](respondWithResult(_0x2ea321,null))[_0xd81b('0x27')](APIHandleError(_0x2ea321));};exports[_0xd81b('0xd5')]=function(_0x2f4b2b,_0x59779e){var _0x1e184c,_0x5d6b18,_0x19eef8;var _0x520762=[];var _0x36650d={};var _0x1c5923=_0x2f4b2b['files']||[];var _0x16865b=[];var _0x522616;return db[_0xd81b('0xaf')][_0xd81b('0x78')]()['then'](function(_0x98f92e){if(!_0x98f92e){throw new db['Sequelize'][(_0xd81b('0xd6'))](_0xd81b('0xd7'));}_0x520762=_[_0xd81b('0xd8')](_[_0xd81b('0x53')](_0x98f92e),[_0xd81b('0xa9'),_0xd81b('0xab'),_0xd81b('0xd9'),_0xd81b('0xac')]);if(_0x2f4b2b[_0xd81b('0x69')]['id']){delete _0x2f4b2b[_0xd81b('0x69')]['id'];}if(_[_0xd81b('0x93')](_0x2f4b2b[_0xd81b('0x69')]['from'])){throw _0x59779e[_0xd81b('0x29')](0x1f4)['send'](new db[(_0xd81b('0xda'))][(_0xd81b('0xd6'))](_0xd81b('0xdb')));}if(_[_0xd81b('0x93')](_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0x69')])||_0x2f4b2b[_0xd81b('0x69')]['body']===''){throw _0x59779e[_0xd81b('0x29')](0x1f4)['send'](new db[(_0xd81b('0xda'))]['ValidationError'](_0xd81b('0xdc')));}if(_['isNil'](_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0xdd')])){throw _0x59779e[_0xd81b('0x29')](0x1f4)[_0xd81b('0x34')](new db['Sequelize'][(_0xd81b('0xd6'))](_0xd81b('0xde')+_0x520762));}if(!_['includes'](_0x520762,_0x2f4b2b['body']['mapKeyOffline'])){throw _0x59779e[_0xd81b('0x29')](0x1f4)[_0xd81b('0x34')](new db[(_0xd81b('0xda'))][(_0xd81b('0xd6'))](_0xd81b('0xdf')+_0x520762));}_0x36650d[_0x2f4b2b[_0xd81b('0x69')]['mapKeyOffline']]=_0x2f4b2b['body'][_0xd81b('0xad')];})['then'](function(){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x2f4b2b[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0xae')],'as':_0xd81b('0xe0')},{'model':db[_0xd81b('0xe1')],'as':_0xd81b('0xe1')}]});})[_0xd81b('0x1c')](handleEntityNotFound(_0x59779e,null))[_0xd81b('0x1c')](function(_0x28cbe7){if(_0x28cbe7&&_0x28cbe7[_0xd81b('0xe0')]){_0x5d6b18=_0x28cbe7;var _0x30abaf=_[_0xd81b('0x16')](_0x2f4b2b[_0xd81b('0x69')],{'firstName':_0x2f4b2b['body'][_0xd81b('0xad')],'phone':_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0xad')],'ListId':_0x28cbe7[_0xd81b('0xac')]});_0x30abaf[_0x2f4b2b[_0xd81b('0x69')]['mapKeyOffline']]=_0x2f4b2b[_0xd81b('0x69')]['from'];return db['CmContact'][_0xd81b('0xe2')]({'where':_0x36650d,'defaults':_0x30abaf});}})['spread'](function(_0x126aaa){if(_0x126aaa){_0x19eef8=_0x126aaa;var _0x3e8623=fs[_0xd81b('0xe3')](path['join'](config[_0xd81b('0x90')],_0xd81b('0xe4')),_0xd81b('0xe5'));var _0x576d9d=ejs[_0xd81b('0xe6')](_0x3e8623,{'body':_[_0xd81b('0xe7')](_0x2f4b2b[_0xd81b('0x69')][_0xd81b('0x69')]),'bodyTitle':_0x5d6b18[_0xd81b('0xe8')]});return db[_0xd81b('0xe9')]['create']({'body':_0x576d9d,'plainBody':htmlToText[_0xd81b('0xea')](_0x576d9d),'ContactId':_0x126aaa['id'],'ChatWebsiteId':_0x5d6b18['id']});}})[_0xd81b('0x1c')](function(_0x3b6ed5){_0x522616=_0x3b6ed5;if(_0x1c5923[_0xd81b('0x58')]){var _0x11b997=_0x1c5923[_0xd81b('0x4d')](function(_0x3ec25d){return{'name':_0x3ec25d[_0xd81b('0xeb')],'basename':_0x3ec25d[_0xd81b('0x87')],'type':_0x3ec25d['mimetype'],'ChatOfflineMessageId':_0x3b6ed5['id']};});_0x16865b=_0x11b997[_0xd81b('0x4d')](_0x10a82f=>{var _0x255f26={'filename':_0x10a82f[_0xd81b('0x33')],'path':path['join'](config[_0xd81b('0x90')],_0xd81b('0xec'),_0xd81b('0xed'),'attachments',_0xd81b('0xee'),_0x10a82f[_0xd81b('0xef')])};return _0x255f26;});if(!_0x5d6b18[_0xd81b('0xf0')]){return db[_0xd81b('0xf1')][_0xd81b('0xf2')](function(_0x4f1d2b){return db[_0xd81b('0xf3')][_0xd81b('0xf4')](_0x11b997,{'transaction':_0x4f1d2b});});}}})[_0xd81b('0x1c')](function(){if(_0x522616){_0x1e184c=_0x522616;return db['MailAccount'][_0xd81b('0x83')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xd81b('0xf5')],'as':_0xd81b('0xf5'),'raw':!![]}]}]});}})['then'](function(_0x2e4523){if(_0x2e4523&&_0x2e4523['Smtp']&&_0x5d6b18[_0xd81b('0xf6')]&&_0x5d6b18[_0xd81b('0xf7')]){var _0x3a10ac=_0x2e4523[_0xd81b('0xf8')]();return respondWithRpcPromise('SendMail',_0xd81b('0xf9'),{'account':_0x3a10ac,'message':{'from':util[_0xd81b('0x43')](_0xd81b('0xfa'),_0x2e4523[_0xd81b('0x33')],_0x2e4523[_0xd81b('0xfb')]||_0x2e4523[_0xd81b('0xfc')]['user']),'to':_0x5d6b18[_0xd81b('0xf7')],'subject':_0x5d6b18['offlineMessageSubject'],'html':_0x1e184c['body'],'attachments':_0x16865b}},client9003)[_0xd81b('0x1c')](function(){return _0x1e184c;})[_0xd81b('0x27')](function(_0xb2d684){logger['error'](_0xb2d684);});}})[_0xd81b('0x1c')](function(){if(_0x5d6b18&&_0x5d6b18[_0xd81b('0xf0')]&&_0x5d6b18['MailAccountId']){var _0x50fbfd=[];if(_0x1c5923[_0xd81b('0x58')]){_0x50fbfd=_0x1c5923[_0xd81b('0x4d')](function(_0x44e2a8){return{'name':_0x44e2a8[_0xd81b('0xeb')],'basename':_0x44e2a8[_0xd81b('0x87')],'type':_0x44e2a8[_0xd81b('0xfd')],'ChatOfflineMessageId':_0x522616['id']};});}var _0x462925;if(!_[_0xd81b('0x93')](_0x5d6b18[_0xd81b('0xfe')])){var _0x41d12a=_[_0xd81b('0x4d')](_0x2f4b2b[_0xd81b('0x69')],function(_0x2f3170){return _0x2f3170;});var _0xfc4221=_['toPairsIn'](_0x41d12a)[0x0];var _0x25939f=_[_0xd81b('0xff')](_0xfc4221,function(_0x5a7cb8){return _0x5a7cb8;});_0x462925=_0x25939f[0x1][_0x5d6b18[_0xd81b('0xfe')]];}var _0x250cd7={'from':_0x19eef8[_0xd81b('0xfb')],'firstName':_0x19eef8[_0xd81b('0x3d')],'lastName':_0x19eef8['lastName'],'mapKey':_0xd81b('0xfb'),'message':{'from':_0x19eef8[_0xd81b('0xfb')],'to':_0x5d6b18[_0xd81b('0xe1')][_0xd81b('0xfb')],'cc':'','subject':_[_0xd81b('0x93')](_0x462925)?_0x5d6b18[_0xd81b('0x100')]:_0x462925,'messageId':'','sentAt':new Date(),'attach':_0x50fbfd['length'],'attachments':_0x50fbfd,'originChannel':_0xd81b('0x101'),'ChatWebsiteId':_0x5d6b18['id'],'ChatOfflineMessageId':_0x1e184c['id'],'originTo':_0x5d6b18[_0xd81b('0xe1')][_0xd81b('0xfb')]},'body':_0x1e184c[_0xd81b('0x69')]};var _0x35320d={'account':{'id':_0x5d6b18[_0xd81b('0x102')]},'body':_0x250cd7,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0xd81b('0x103'),_0x35320d,client9001)[_0xd81b('0x1c')](function(){return _0x1e184c;})[_0xd81b('0x27')](function(_0x3c329e){logger['error'](_0x3c329e);});}return;})[_0xd81b('0x1c')](function(){if(_0x1e184c){return _0x1e184c;}})[_0xd81b('0x1c')](respondWithResult(_0x59779e,null))[_0xd81b('0x27')](function(){for(var _0x468794 of _0x1c5923){var _0x1c3473=path['join'](config[_0xd81b('0x90')],'server',_0xd81b('0xed'),_0xd81b('0x104'),'offline-chat',_0x468794['filename']);fs_extra[_0xd81b('0x105')](_0x1c3473)['catch'](function(_0x5f1c6b){logger[_0xd81b('0x23')](_0xd81b('0x106'),_0x1c3473,_0x5f1c6b);});}});};exports[_0xd81b('0x107')]=function(_0x56195b,_0x584698){return db[_0xd81b('0xc2')][_0xd81b('0x67')]({'where':{'id':_0x56195b[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x584698,null))[_0xd81b('0x1c')](function(_0xae9cb8){if(_0xae9cb8){return _0xae9cb8['addInteraction'](_0x56195b['body'][_0xd81b('0x7f')],_[_0xd81b('0x108')](_0x56195b[_0xd81b('0x69')],['ids','id'])||{});}})[_0xd81b('0x1c')](respondWithResult(_0x584698,null))[_0xd81b('0x27')](handleError(_0x584698,null));};exports['getInteractions']=function(_0x22e159,_0x3d3ee1){var _0x31e7f7={'raw':![],'where':{}};var _0x4850d8={};var _0x51c975={'count':0x0,'rows':[]};return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0x22e159[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x3d3ee1,null))[_0xd81b('0x1c')](function(_0x525220){if(_0x525220){_0x4850d8[_0xd81b('0x46')]=_[_0xd81b('0x53')](db['ChatInteraction'][_0xd81b('0x4f')]);_0x4850d8[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0x22e159['query']);_0x4850d8[_0xd81b('0x54')]=_['intersection'](_0x4850d8[_0xd81b('0x46')],_0x4850d8['query']);_0x31e7f7[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x4850d8[_0xd81b('0x46')],qs[_0xd81b('0x57')](_0x22e159[_0xd81b('0x52')][_0xd81b('0x57')]));_0x31e7f7['attributes']=_0x31e7f7['attributes'][_0xd81b('0x58')]?_0x31e7f7[_0xd81b('0x56')]:_0x4850d8[_0xd81b('0x46')];if(!_0x22e159[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x31e7f7[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x22e159['query'][_0xd81b('0x2f')]);_0x31e7f7[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x22e159[_0xd81b('0x52')]['offset']);}_0x31e7f7[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x22e159[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x31e7f7['where']=qs[_0xd81b('0x54')](_['pick'](_0x22e159['query'],_0x4850d8[_0xd81b('0x54')]));_0x31e7f7[_0xd81b('0x5d')][_0xd81b('0x80')]=_0x525220['id'];if(_0x22e159[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x31e7f7[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x31e7f7['where'],{'$or':_[_0xd81b('0x4d')](_0x31e7f7[_0xd81b('0x56')],function(_0x16ef58){var _0x3b4240={};_0x3b4240[_0x16ef58]={'$like':'%'+_0x22e159['query'][_0xd81b('0x5f')]+'%'};return _0x3b4240;})});}_0x31e7f7=_[_0xd81b('0x60')]({},_0x31e7f7,_0x22e159['options']);return db[_0xd81b('0xc2')]['count']({'where':_0x31e7f7[_0xd81b('0x5d')]})['then'](function(_0x54062e){_0x51c975[_0xd81b('0x2e')]=_0x54062e;if(_0x22e159[_0xd81b('0x52')][_0xd81b('0x62')]){_0x31e7f7[_0xd81b('0x63')]=[{'model':db['CmContact'],'as':_0xd81b('0x109'),'required':![]},{'model':db['User'],'as':_0xd81b('0x10a'),'attributes':[_0xd81b('0x33'),_0xd81b('0x10b'),_0xd81b('0x10c')],'required':![]},{'model':db[_0xd81b('0x10d')],'as':_0xd81b('0x10e'),'attributes':['id',_0xd81b('0x33'),_0xd81b('0x10f')],'where':_0x22e159[_0xd81b('0x52')]['tag']?{'id':_0x22e159[_0xd81b('0x52')][_0xd81b('0x110')]}:undefined,'required':_0x22e159[_0xd81b('0x52')][_0xd81b('0x110')]?!![]:![]}];}return db[_0xd81b('0xc2')][_0xd81b('0x7c')](_0x31e7f7);})[_0xd81b('0x1c')](function(_0x23139c){_0x51c975[_0xd81b('0x7d')]=_0x23139c;return _0x51c975;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x3d3ee1,_0x31e7f7))['catch'](handleError(_0x3d3ee1,null));};exports[_0xd81b('0x111')]=function(_0x432b04,_0x2ff8f6){var _0x30a57a=0x0;var _0x25f776=0x0;var _0x1313da=![];var _0x115026;var _0x202316;return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x432b04[_0xd81b('0x64')]['id']},'include':[{'model':db[_0xd81b('0x9e')],'as':_0xd81b('0x9e'),'include':[{'model':db[_0xd81b('0x9e')],'as':_0xd81b('0xb4'),'attributes':['id',_0xd81b('0xb5')]}]}]})[_0xd81b('0x1c')](handleEntityNotFound(_0x2ff8f6,null))['then'](function(_0x16ccac){if(_0x16ccac){_0x115026=_0x16ccac;return _0x16ccac['getProactiveActions']({'raw':!![]});}})[_0xd81b('0x1c')](function(_0x1c3879){if(_0x115026){if(_0x1c3879){_0x202316=_0x1c3879;}}return require(_0xd81b('0x91'))[_0xd81b('0x92')]();})[_0xd81b('0x1c')](function(_0x4e6c6d){if(_0x4e6c6d){_0x25f776=_0x4e6c6d[_0xd81b('0x112')];_0x1313da=_0x4e6c6d[_0xd81b('0x113')];}})[_0xd81b('0x1c')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xd81b('0x1c')](function(_0x366808){_0x30a57a=_0x366808;if(_0x25f776&&_0x366808>_0x25f776){return db['License'][_0xd81b('0x83')]({'where':{'id':0x1}})[_0xd81b('0x1c')](function(_0x2ac7d3){if(_0x2ac7d3){_0x2ac7d3[_0xd81b('0x114')](_0xd81b('0x115'));}});}})[_0xd81b('0x1c')](function(){var _0x203fbe=_0x115026[_0xd81b('0x9e')];var _0xf1f6f2=_0x115026[_0xd81b('0xa0')]||undefined;return _0x203fbe?_0x203fbe[_0xd81b('0xa1')](_0xf1f6f2):!![];})[_0xd81b('0x1c')](function(_0xe0b626){var _0x5a187a=fs[_0xd81b('0xe3')](path['join'](config[_0xd81b('0x90')],_0xd81b('0x116')),_0xd81b('0xe5'));var _0x4cb573=_0xd81b('0x117');var _0x53d707=![];var _0x480fab,_0x1685e6;if(_0x432b04[_0xd81b('0x118')]['referer']){_0x480fab=new URL(_0x432b04['headers'][_0xd81b('0x40')])[_0xd81b('0x119')];}else if(_0x432b04[_0xd81b('0x118')][_0xd81b('0x119')]){_0x480fab=new URL(_0x432b04[_0xd81b('0x118')]['origin'])[_0xd81b('0x119')];}else{_0x480fab=_0xd81b('0x11a');}_0x1685e6=typeof _0x115026[_0xd81b('0x6a')][_0xd81b('0x3c')](',')['find'](function(_0x549d83){return wildcardUtils[_0xd81b('0x11b')](_0x549d83,_0x480fab);})!==_0xd81b('0x2d');var _0x39eb20={'chatVersion':_0x4cb573,'chatWebsiteAddressOrigin':_0x1685e6?_0x480fab:_0x115026[_0xd81b('0x6a')],'remote':_0x115026[_0xd81b('0x11c')],'query':querystring[_0xd81b('0x22')](_['merge'](_0x115026[_0xd81b('0x70')]({'plain':!![]}),{'customerIp':_0x432b04[_0xd81b('0x118')]['x-forwarded-for']||_0x432b04[_0xd81b('0x118')][_0xd81b('0x11d')]||_0x432b04[_0xd81b('0x11e')][_0xd81b('0x11f')]||_0x432b04['ip'],'referer':_0x432b04['headers'][_0xd81b('0x40')],'openedInteractions':_0x30a57a,'maxInteractions':_0x25f776,'virtual':_0x1313da[_0xd81b('0x112')],'online':_0xe0b626,'custom':_0x1313da,'address':_0x1685e6?_0x480fab:null}))[_0xd81b('0x120')](/'/g,'\x5c\x27')};_0x2ff8f6[_0xd81b('0x34')](ejs[_0xd81b('0xe6')](Mustache[_0xd81b('0xe6')](_0x5a187a,_0x39eb20),{'proactiveActions':_0x202316,'alignment':_0x115026[_0xd81b('0x121')],'verticalAlignment':_0x115026[_0xd81b('0x122')],'div_color':_0x115026[_0xd81b('0x10f')],'labelText':_0x115026[_0xd81b('0x123')],'text_color':_0x115026[_0xd81b('0x124')],'text_button_color':_0x115026['textButtonColor'],'button_color':_0x115026[_0xd81b('0x125')],'background_color':_0x115026[_0xd81b('0x126')],'hideWhenOffline':_0x115026[_0xd81b('0x127')],'intervalId':_0x115026[_0xd81b('0x128')],'isDevelopment':_0x53d707,'chatVersion':_0x4cb573}));})[_0xd81b('0x27')](handleError(_0x2ff8f6,null));};exports[_0xd81b('0x129')]=function(_0x2eefbd,_0x2883fe){var _0x34cf85=_0x2eefbd[_0xd81b('0x64')]['id'];var _0x4eae4a=_0x2eefbd[_0xd81b('0x69')];var _0x388752=0xc8;var _0x580b1f=null;return db[_0xd81b('0xf1')][_0xd81b('0xf2')]({'isolationLevel':db[_0xd81b('0xf1')][_0xd81b('0x12a')]['ISOLATION_LEVELS'][_0xd81b('0x12b')]},function(_0x33d580){return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0x34cf85},'transaction':_0x33d580})[_0xd81b('0x1c')](function(_0x386b39){if(_0x386b39){return db[_0xd81b('0xb2')][_0xd81b('0x31')]({'where':{'ChatWebsiteId':_0x34cf85},'transaction':_0x33d580})[_0xd81b('0x1c')](function(){var _0x3c839c=_[_0xd81b('0x4d')](_0x4eae4a,function(_0x9bbfea){_0x9bbfea[_0xd81b('0x80')]=_0x34cf85;return _0x9bbfea;});return db[_0xd81b('0xb2')][_0xd81b('0xf4')](_0x3c839c,{'transaction':_0x33d580});});}else{_0x388752=0x194;_0x580b1f=[];}});})['then'](function(){if(_0x388752!==0x194){return db[_0xd81b('0xb2')][_0xd81b('0x12c')]({'where':{'ChatWebsiteId':_0x34cf85},'order':_0xd81b('0xb9')})['then'](function(_0x5ae954){_0x580b1f=_0x5ae954;});}})[_0xd81b('0x27')](function(_0x5ab098){_0x388752=0x1f4;logger[_0xd81b('0x23')](_0x5ab098['stack']);if(_0x5ab098[_0xd81b('0x33')]){delete _0x5ab098[_0xd81b('0x33')];}_0x580b1f=_0x5ab098;})[_0xd81b('0x12d')](function(){if(_0x580b1f===null){_0x2883fe[_0xd81b('0x28')](_0x388752);}else{if(_0x388752===0x1f4){_0x2883fe['status'](_0x388752)['send'](_0x580b1f);}else{_0x2883fe[_0xd81b('0x29')](_0x388752)[_0xd81b('0x2b')](_0x580b1f);}}});};exports[_0xd81b('0x12e')]=function(_0x1e841d,_0x6121cf){var _0x15ce6c={};var _0x29e6d9={};var _0x57ef3b;var _0xf7cefc;return db['ChatWebsite']['findOne']({'where':{'id':_0x1e841d[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x6121cf,null))['then'](function(_0x28e08c){if(_0x28e08c){_0x57ef3b=_0x28e08c;_0x29e6d9[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0xb2')][_0xd81b('0x4f')]);_0x29e6d9[_0xd81b('0x52')]=_['keys'](_0x1e841d['query']);_0x29e6d9[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x29e6d9['model'],_0x29e6d9['query']);_0x15ce6c[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x29e6d9['model'],qs[_0xd81b('0x57')](_0x1e841d[_0xd81b('0x52')]['fields']));_0x15ce6c[_0xd81b('0x56')]=_0x15ce6c[_0xd81b('0x56')][_0xd81b('0x58')]?_0x15ce6c['attributes']:_0x29e6d9[_0xd81b('0x46')];_0x15ce6c[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x1e841d[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x15ce6c['where']=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0x1e841d[_0xd81b('0x52')],_0x29e6d9[_0xd81b('0x54')]));if(_0x1e841d[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x15ce6c[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x15ce6c[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x15ce6c['attributes'],function(_0x407136){var _0x3b5455={};_0x3b5455[_0x407136]={'$like':'%'+_0x1e841d[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x3b5455;})});}_0x15ce6c=_[_0xd81b('0x60')]({},_0x15ce6c,_0x1e841d[_0xd81b('0x66')]);return _0x57ef3b[_0xd81b('0x12e')](_0x15ce6c);}})['then'](function(_0x5b1898){if(_0x5b1898){_0xf7cefc=_0x5b1898[_0xd81b('0x58')];if(!_0x1e841d[_0xd81b('0x52')][_0xd81b('0x59')]('nolimit')){_0x15ce6c[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x1e841d[_0xd81b('0x52')][_0xd81b('0x2f')]);_0x15ce6c[_0xd81b('0x2c')]=qs['offset'](_0x1e841d[_0xd81b('0x52')][_0xd81b('0x2c')]);}return _0x57ef3b[_0xd81b('0x12e')](_0x15ce6c);}})[_0xd81b('0x1c')](function(_0x89764a){if(_0x89764a){return _0x89764a?{'count':_0xf7cefc,'rows':_0x89764a}:null;}})[_0xd81b('0x1c')](respondWithResult(_0x6121cf,null))[_0xd81b('0x27')](handleError(_0x6121cf,null));};exports['addProactiveActions']=function(_0x5a8445,_0x47a903){return db['chatProactiveAction']['find']({'where':{'id':_0x5a8445[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x47a903,null))[_0xd81b('0x1c')](function(_0x4d4feb){if(_0x4d4feb){return _0x4d4feb[_0xd81b('0x12f')](_0x5a8445['body'][_0xd81b('0x7f')],_[_0xd81b('0x108')](_0x5a8445[_0xd81b('0x69')],['ids','id'])||{});}})[_0xd81b('0x1c')](respondWithResult(_0x47a903,null))[_0xd81b('0x27')](handleError(_0x47a903,null));};exports[_0xd81b('0x130')]=function(_0xd09d12,_0x251bf4){var _0x3682e4={};var _0x49f9d1={};var _0x5c97b9;var _0x1e4634;return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0xd09d12[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x251bf4,null))[_0xd81b('0x1c')](function(_0x4e3323){if(_0x4e3323){_0x5c97b9=_0x4e3323;_0x49f9d1[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0x131')][_0xd81b('0x4f')]);_0x49f9d1['query']=_['keys'](_0xd09d12[_0xd81b('0x52')]);_0x49f9d1[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0x49f9d1[_0xd81b('0x46')],_0x49f9d1[_0xd81b('0x52')]);_0x3682e4[_0xd81b('0x56')]=_[_0xd81b('0x55')](_0x49f9d1['model'],qs[_0xd81b('0x57')](_0xd09d12['query']['fields']));_0x3682e4['attributes']=_0x3682e4[_0xd81b('0x56')][_0xd81b('0x58')]?_0x3682e4[_0xd81b('0x56')]:_0x49f9d1[_0xd81b('0x46')];_0x3682e4[_0xd81b('0x5b')]=qs['sort'](_0xd09d12[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x3682e4[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_['pick'](_0xd09d12['query'],_0x49f9d1[_0xd81b('0x54')]));if(_0xd09d12[_0xd81b('0x52')]['filter']){_0x3682e4[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x3682e4[_0xd81b('0x5d')],{'$or':_[_0xd81b('0x4d')](_0x3682e4[_0xd81b('0x56')],function(_0x111dd0){var _0x37301b={};_0x37301b[_0x111dd0]={'$like':'%'+_0xd09d12['query']['filter']+'%'};return _0x37301b;})});}_0x3682e4=_[_0xd81b('0x60')]({},_0x3682e4,_0xd09d12['options']);return _0x5c97b9[_0xd81b('0x130')](_0x3682e4);}})['then'](function(_0x222acd){if(_0x222acd){_0x1e4634=_0x222acd[_0xd81b('0x58')];if(!_0xd09d12[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x3682e4[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0xd09d12[_0xd81b('0x52')]['limit']);_0x3682e4[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0xd09d12[_0xd81b('0x52')][_0xd81b('0x2c')]);}return _0x5c97b9[_0xd81b('0x130')](_0x3682e4);}})['then'](function(_0x3c96d4){if(_0x3c96d4){return _0x3c96d4?{'count':_0x1e4634,'rows':_0x3c96d4}:null;}})['then'](respondWithResult(_0x251bf4,null))[_0xd81b('0x27')](handleError(_0x251bf4,null));};exports[_0xd81b('0x132')]=function(_0x4387a7,_0x24fc43){var _0x498cc0=_0x4387a7[_0xd81b('0x52')][_0xd81b('0x133')]===_0xd81b('0x134')?_0xd81b('0x135'):_0xd81b('0x136');return db[_0xd81b('0x4e')]['find']({'attributes':['id',_0x498cc0],'where':{'id':_0x4387a7[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x24fc43,null))[_0xd81b('0x1c')](function(_0x597c54){if(_0x597c54){var _0x4e792e=_0x597c54[_0x498cc0];var _0x58e782=_0x4e792e&&_0x4e792e[_0xd81b('0x137')]?_0x4e792e['items']:[];_0x24fc43[_0xd81b('0x34')]({'fromKey':_[_0xd81b('0x93')](_0x4e792e['fromKey'])?undefined:_0x4e792e[_0xd81b('0x138')],'count':_0x58e782[_0xd81b('0x58')],'rows':_0x58e782});}})[_0xd81b('0x27')](handleError(_0x24fc43,null));};exports['getOfflineMessages']=function(_0x5f10b0,_0x19ff30){var _0x398e61={'raw':![],'where':{}};var _0xcb2433={};var _0x32573b={'count':0x0,'rows':[]};return db[_0xd81b('0x4e')]['findOne']({'where':{'id':_0x5f10b0['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x19ff30,null))[_0xd81b('0x1c')](function(_0x1eea94){if(_0x1eea94){_0xcb2433[_0xd81b('0x46')]=_[_0xd81b('0x53')](db[_0xd81b('0xe9')]['rawAttributes']);_0xcb2433['query']=_[_0xd81b('0x53')](_0x5f10b0[_0xd81b('0x52')]);_0xcb2433[_0xd81b('0x54')]=_[_0xd81b('0x55')](_0xcb2433['model'],_0xcb2433[_0xd81b('0x52')]);_0x398e61['attributes']=_[_0xd81b('0x55')](_0xcb2433['model'],qs[_0xd81b('0x57')](_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x57')]));_0x398e61['attributes']=_0x398e61[_0xd81b('0x56')][_0xd81b('0x58')]?_0x398e61[_0xd81b('0x56')]:_0xcb2433[_0xd81b('0x46')];if(!_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x59')](_0xd81b('0x5a'))){_0x398e61[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x5f10b0['query'][_0xd81b('0x2f')]);_0x398e61[_0xd81b('0x2c')]=qs[_0xd81b('0x2c')](_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x2c')]);}_0x398e61[_0xd81b('0x5b')]=qs[_0xd81b('0x5c')](_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x398e61[_0xd81b('0x5d')]=qs['filters'](_[_0xd81b('0x5e')](_0x5f10b0[_0xd81b('0x52')],_0xcb2433[_0xd81b('0x54')]));_0x398e61[_0xd81b('0x5d')][_0xd81b('0x80')]=_0x1eea94['id'];if(_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x398e61[_0xd81b('0x5d')]=_[_0xd81b('0x60')](_0x398e61['where'],{'$or':_['map'](_0x398e61[_0xd81b('0x56')],function(_0x56f4c8){var _0xa5dd60={};_0xa5dd60[_0x56f4c8]={'$like':'%'+_0x5f10b0[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0xa5dd60;})});}_0x398e61=_[_0xd81b('0x60')]({},_0x398e61,_0x5f10b0[_0xd81b('0x66')]);return db[_0xd81b('0xe9')][_0xd81b('0x2e')]({'where':_0x398e61[_0xd81b('0x5d')]})['then'](function(_0x443a17){_0x32573b[_0xd81b('0x2e')]=_0x443a17;if(_0x5f10b0['query'][_0xd81b('0x62')]){_0x398e61[_0xd81b('0x63')]=[{'all':!![]}];}else{_0x398e61['include']=[{'model':db['CmContact'],'as':_0xd81b('0x109'),'required':![]},{'model':db[_0xd81b('0xf3')],'as':_0xd81b('0x139'),'required':![]}];}return db[_0xd81b('0xe9')][_0xd81b('0x7c')](_0x398e61);})[_0xd81b('0x1c')](function(_0x57da47){_0x32573b[_0xd81b('0x7d')]=_0x57da47;return _0x32573b;});}})[_0xd81b('0x1c')](respondWithFilteredResult(_0x19ff30,_0x398e61))['catch'](handleError(_0x19ff30,null));};exports[_0xd81b('0x13a')]=function(_0x207681,_0x212f03){return db[_0xd81b('0x4e')][_0xd81b('0x67')]({'where':{'id':_0x207681[_0xd81b('0x64')]['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x212f03,null))[_0xd81b('0x1c')](function(_0x3ea155){if(_0x3ea155){return _0x3ea155[_0xd81b('0x13a')](_0x207681['body'][_0xd81b('0x7f')],_[_0xd81b('0x108')](_0x207681[_0xd81b('0x69')],[_0xd81b('0x7f'),'id'])||{})[_0xd81b('0x13b')](function(_0x3b393b){for(var _0xd6d130=0x0;_0xd6d130<_0x207681['body'][_0xd81b('0x7f')][_0xd81b('0x58')];_0xd6d130+=0x1){socket[_0xd81b('0x13c')](_0xd81b('0x13d'),{'UserId':Number(_0x207681['body'][_0xd81b('0x7f')][_0xd6d130]),'ChatWebsiteId':Number(_0x207681[_0xd81b('0x64')]['id'])});}return _0x3b393b;});}})['then'](respondWithResult(_0x212f03,null))['catch'](handleError(_0x212f03,null));};exports[_0xd81b('0x13e')]=function(_0x44a9e1,_0x26d2c2){return db['ChatWebsite'][_0xd81b('0x67')]({'where':{'id':_0x44a9e1['params']['id']}})[_0xd81b('0x1c')](handleEntityNotFound(_0x26d2c2,null))[_0xd81b('0x1c')](function(_0x4c684a){if(_0x4c684a){return _0x4c684a[_0xd81b('0x13e')](_0x44a9e1['query'][_0xd81b('0x7f')])['then'](function(){if(_[_0xd81b('0x13f')](_0x44a9e1[_0xd81b('0x52')][_0xd81b('0x7f')])){for(var _0x56d986=0x0;_0x56d986<_0x44a9e1[_0xd81b('0x52')][_0xd81b('0x7f')][_0xd81b('0x58')];_0x56d986+=0x1){socket[_0xd81b('0x13c')](_0xd81b('0x140'),{'UserId':Number(_0x44a9e1[_0xd81b('0x52')][_0xd81b('0x7f')][_0x56d986]),'ChatWebsiteId':Number(_0x44a9e1['params']['id'])});}}else{socket[_0xd81b('0x13c')](_0xd81b('0x140'),{'UserId':Number(_0x44a9e1['query']['ids']),'ChatWebsiteId':Number(_0x44a9e1['params']['id'])});}});}})[_0xd81b('0x1c')](respondWithStatusCode(_0x26d2c2,null))[_0xd81b('0x27')](handleError(_0x26d2c2,null));};exports[_0xd81b('0x141')]=function(_0xb7102c,_0x2b1519){var _0x1c5a61={};var _0x4c1201={};var _0x1f76aa;var _0x36fa37;return db[_0xd81b('0x4e')][_0xd81b('0x83')]({'where':{'id':_0xb7102c[_0xd81b('0x64')]['id']}})['then'](handleEntityNotFound(_0x2b1519,null))[_0xd81b('0x1c')](function(_0x4fc360){if(_0x4fc360){_0x1f76aa=_0x4fc360;_0x4c1201[_0xd81b('0x46')]=_['keys'](db[_0xd81b('0xca')]['rawAttributes']);_0x4c1201[_0xd81b('0x52')]=_[_0xd81b('0x53')](_0xb7102c[_0xd81b('0x52')]);_0x4c1201['filters']=_[_0xd81b('0x55')](_0x4c1201[_0xd81b('0x46')],_0x4c1201[_0xd81b('0x52')]);_0x1c5a61['attributes']=_[_0xd81b('0x55')](_0x4c1201['model'],qs[_0xd81b('0x57')](_0xb7102c['query'][_0xd81b('0x57')]));_0x1c5a61[_0xd81b('0x56')]=_0x1c5a61[_0xd81b('0x56')][_0xd81b('0x58')]?_0x1c5a61[_0xd81b('0x56')]:_0x4c1201[_0xd81b('0x46')];_0x1c5a61['order']=qs[_0xd81b('0x5c')](_0xb7102c[_0xd81b('0x52')][_0xd81b('0x5c')]);_0x1c5a61[_0xd81b('0x5d')]=qs[_0xd81b('0x54')](_[_0xd81b('0x5e')](_0xb7102c[_0xd81b('0x52')],_0x4c1201[_0xd81b('0x54')]));if(_0xb7102c[_0xd81b('0x52')][_0xd81b('0x5f')]){_0x1c5a61['where']=_[_0xd81b('0x60')](_0x1c5a61['where'],{'$or':_[_0xd81b('0x4d')](_0x1c5a61['attributes'],function(_0x45bf7e){var _0x29464b={};_0x29464b[_0x45bf7e]={'$like':'%'+_0xb7102c[_0xd81b('0x52')][_0xd81b('0x5f')]+'%'};return _0x29464b;})});}_0x1c5a61=_[_0xd81b('0x60')]({},_0x1c5a61,_0xb7102c[_0xd81b('0x66')]);return _0x1f76aa[_0xd81b('0x141')](_0x1c5a61);}})['then'](function(_0xec700e){if(_0xec700e){_0x36fa37=_0xec700e[_0xd81b('0x58')];if(!_0xb7102c[_0xd81b('0x52')][_0xd81b('0x59')]('nolimit')){_0x1c5a61[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0xb7102c[_0xd81b('0x52')][_0xd81b('0x2f')]);_0x1c5a61['offset']=qs['offset'](_0xb7102c[_0xd81b('0x52')][_0xd81b('0x2c')]);}return _0x1f76aa[_0xd81b('0x141')](_0x1c5a61);}})[_0xd81b('0x1c')](function(_0x450634){if(_0x450634){return _0x450634?{'count':_0x36fa37,'rows':_0x450634}:null;}})[_0xd81b('0x1c')](respondWithResult(_0x2b1519,null))[_0xd81b('0x27')](handleError(_0x2b1519,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 1d3930f..69404f9 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 _0x861c=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x56d9b5,_0x1db06e){var _0x24829b=function(_0x19e839){while(--_0x19e839){_0x56d9b5['push'](_0x56d9b5['shift']());}};_0x24829b(++_0x1db06e);}(_0x861c,0xdb));var _0xc861=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x861c[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0xc861('0x0'));var ChatWebsite=require(_0xc861('0x1'))['db'][_0xc861('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc861('0x3')](0x0);var events={'afterCreate':_0xc861('0x4'),'afterUpdate':_0xc861('0x5'),'afterDestroy':_0xc861('0x6')};function emitEvent(_0x683b83){return function(_0x28ed01,_0xc70070,_0x2690f9){ChatWebsiteEvents[_0xc861('0x7')](_0x683b83+':'+_0x28ed01['id'],_0x28ed01);ChatWebsiteEvents['emit'](_0x683b83,_0x28ed01);_0x2690f9(null);};}for(var e in events){if(events[_0xc861('0x8')](e)){var event=events[e];ChatWebsite[_0xc861('0x9')](e,emitEvent(event));}}module[_0xc861('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0x4944=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x42d32d,_0xe5bac){var _0x2607b4=function(_0x2d8481){while(--_0x2d8481){_0x42d32d['push'](_0x42d32d['shift']());}};_0x2607b4(++_0xe5bac);}(_0x4944,0x6d));var _0x4494=function(_0x417d14,_0x59a971){_0x417d14=_0x417d14-0x0;var _0x5493cc=_0x4944[_0x417d14];return _0x5493cc;};'use strict';var EventEmitter=require(_0x4494('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x4494('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4494('0x2')](0x0);var events={'afterCreate':_0x4494('0x3'),'afterUpdate':_0x4494('0x4'),'afterDestroy':_0x4494('0x5')};function emitEvent(_0x5074d9){return function(_0x187098,_0x5c7492,_0x370748){ChatWebsiteEvents[_0x4494('0x6')](_0x5074d9+':'+_0x187098['id'],_0x187098);ChatWebsiteEvents[_0x4494('0x6')](_0x5074d9,_0x187098);_0x370748(null);};}for(var e in events){if(events[_0x4494('0x7')](e)){var event=events[e];ChatWebsite[_0x4494('0x8')](e,emitEvent(event));}}module[_0x4494('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 550b93c..436a58b 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 _0x895b=['exports','define','ChatWebsite','chat_websites','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x47bcbc,_0x4edd2a){var _0x29421a=function(_0x20e70f){while(--_0x20e70f){_0x47bcbc['push'](_0x47bcbc['shift']());}};_0x29421a(++_0x4edd2a);}(_0x895b,0x138));var _0xb895=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x895b[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xb895('0x0'));var util=require(_0xb895('0x1'));var logger=require('../../config/logger')(_0xb895('0x2'));var moment=require(_0xb895('0x3'));var BPromise=require('bluebird');var rp=require(_0xb895('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb895('0x5'));var config=require(_0xb895('0x6'));var attributes=require('./chatWebsite.attributes');module[_0xb895('0x7')]=function(_0x2af6d8,_0x1f18bd){return _0x2af6d8[_0xb895('0x8')](_0xb895('0x9'),attributes,{'tableName':_0xb895('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3a0=['chat_websites','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x4bdf64,_0x3022b2){var _0x9a1a19=function(_0x4e551b){while(--_0x4e551b){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x9a1a19(++_0x3022b2);}(_0xb3a0,0x1e1));var _0x0b3a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb3a0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0b3a('0x0'));var util=require(_0x0b3a('0x1'));var logger=require(_0x0b3a('0x2'))(_0x0b3a('0x3'));var moment=require(_0x0b3a('0x4'));var BPromise=require(_0x0b3a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b3a('0x6'));var rimraf=require('rimraf');var config=require(_0x0b3a('0x7'));var attributes=require(_0x0b3a('0x8'));module[_0x0b3a('0x9')]=function(_0x695955,_0x1592eb){return _0x695955[_0x0b3a('0xa')]('ChatWebsite',attributes,{'tableName':_0x0b3a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 83c9b4a..398001d 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 _0x9f4e=['request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x2c5505,_0x2a7c7a){var _0x331581=function(_0xeb7147){while(--_0xeb7147){_0x2c5505['push'](_0x2c5505['shift']());}};_0x331581(++_0x2a7c7a);}(_0x9f4e,0x1d1));var _0xe9f4=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x9f4e[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0xe9f4('0x0'));var util=require(_0xe9f4('0x1'));var moment=require(_0xe9f4('0x2'));var BPromise=require(_0xe9f4('0x3'));var rs=require(_0xe9f4('0x4'));var fs=require('fs');var Redis=require(_0xe9f4('0x5'));var db=require(_0xe9f4('0x6'))['db'];var utils=require(_0xe9f4('0x7'));var logger=require(_0xe9f4('0x8'))('rpc');var config=require(_0xe9f4('0x9'));var jayson=require(_0xe9f4('0xa'));var client=jayson[_0xe9f4('0xb')]['http']({'port':0x232a});config[_0xe9f4('0xc')]=_[_0xe9f4('0xd')](config[_0xe9f4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe9f4('0xe'))(new Redis(config[_0xe9f4('0xc')]));require(_0xe9f4('0xf'))[_0xe9f4('0x10')](socket);function respondWithRpcPromise(_0x402d8d,_0x322378,_0x16fb3f){return new BPromise(function(_0xf9140e,_0x28e29c){return client[_0xe9f4('0x11')](_0x402d8d,_0x16fb3f)[_0xe9f4('0x12')](function(_0xe8939f){logger[_0xe9f4('0x13')](_0xe9f4('0x14'),_0x322378,_0xe9f4('0x15'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x322378,'request\x20sent',JSON[_0xe9f4('0x16')](_0xe8939f));if(_0xe8939f[_0xe9f4('0x17')]){if(_0xe8939f[_0xe9f4('0x17')][_0xe9f4('0x18')]===0x1f4){logger[_0xe9f4('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x322378,_0xe8939f[_0xe9f4('0x17')]['message']);return _0x28e29c(_0xe8939f['error'][_0xe9f4('0x19')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x322378,_0xe8939f[_0xe9f4('0x17')]['message']);return _0xf9140e(_0xe8939f[_0xe9f4('0x17')]['message']);}else{logger[_0xe9f4('0x13')](_0xe9f4('0x14'),_0x322378,_0xe9f4('0x15'));_0xf9140e(_0xe8939f[_0xe9f4('0x1a')][_0xe9f4('0x19')]);}})['catch'](function(_0x1e3bb2){logger[_0xe9f4('0x17')](_0xe9f4('0x14'),_0x322378,_0x1e3bb2);_0x28e29c(_0x1e3bb2);});});} \ No newline at end of file +var _0xd5b5=['rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x17c8cc,_0x5e5647){var _0x3db4eb=function(_0x2082db){while(--_0x2082db){_0x17c8cc['push'](_0x17c8cc['shift']());}};_0x3db4eb(++_0x5e5647);}(_0xd5b5,0xec));var _0x5d5b=function(_0x1c7d08,_0x46c032){_0x1c7d08=_0x1c7d08-0x0;var _0x2c6fa2=_0xd5b5[_0x1c7d08];return _0x2c6fa2;};'use strict';var _=require(_0x5d5b('0x0'));var util=require(_0x5d5b('0x1'));var moment=require(_0x5d5b('0x2'));var BPromise=require(_0x5d5b('0x3'));var rs=require(_0x5d5b('0x4'));var fs=require('fs');var Redis=require(_0x5d5b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d5b('0x6'))(_0x5d5b('0x7'));var config=require(_0x5d5b('0x8'));var jayson=require(_0x5d5b('0x9'));var client=jayson[_0x5d5b('0xa')][_0x5d5b('0xb')]({'port':0x232a});config['redis']=_[_0x5d5b('0xc')](config[_0x5d5b('0xd')],{'host':_0x5d5b('0xe'),'port':0x18eb});var socket=require(_0x5d5b('0xf'))(new Redis(config[_0x5d5b('0xd')]));require(_0x5d5b('0x10'))[_0x5d5b('0x11')](socket);function respondWithRpcPromise(_0x93ca4a,_0x3b70ee,_0x2b149c){return new BPromise(function(_0x4af2c5,_0x578132){return client['request'](_0x93ca4a,_0x2b149c)['then'](function(_0x2aa97e){logger['info'](_0x5d5b('0x12'),_0x3b70ee,_0x5d5b('0x13'));logger[_0x5d5b('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3b70ee,'request\x20sent',JSON[_0x5d5b('0x15')](_0x2aa97e));if(_0x2aa97e[_0x5d5b('0x16')]){if(_0x2aa97e[_0x5d5b('0x16')][_0x5d5b('0x17')]===0x1f4){logger[_0x5d5b('0x16')](_0x5d5b('0x12'),_0x3b70ee,_0x2aa97e[_0x5d5b('0x16')][_0x5d5b('0x18')]);return _0x578132(_0x2aa97e[_0x5d5b('0x16')][_0x5d5b('0x18')]);}logger[_0x5d5b('0x16')](_0x5d5b('0x12'),_0x3b70ee,_0x2aa97e[_0x5d5b('0x16')]['message']);return _0x4af2c5(_0x2aa97e['error']['message']);}else{logger[_0x5d5b('0x19')](_0x5d5b('0x12'),_0x3b70ee,_0x5d5b('0x13'));_0x4af2c5(_0x2aa97e['result'][_0x5d5b('0x18')]);}})[_0x5d5b('0x1a')](function(_0x372a16){logger[_0x5d5b('0x16')](_0x5d5b('0x12'),_0x3b70ee,_0x372a16);_0x578132(_0x372a16);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 3808d92..8738969 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 _0x4777=['./chatWebsite.events','remove','update','emit','removeListener','register','length'];(function(_0x4023e2,_0xd2597d){var _0x347129=function(_0x4db2fc){while(--_0x4db2fc){_0x4023e2['push'](_0x4023e2['shift']());}};_0x347129(++_0xd2597d);}(_0x4777,0x15e));var _0x7477=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x4777[_0x31a576];return _0x30b1d3;};'use strict';var ChatWebsiteEvents=require(_0x7477('0x0'));var events=['save',_0x7477('0x1'),_0x7477('0x2')];function createListener(_0x75a8bb,_0x496a2d){return function(_0x543437){_0x496a2d[_0x7477('0x3')](_0x75a8bb,_0x543437);};}function removeListener(_0x53ac44,_0x5f1aa2){return function(){ChatWebsiteEvents[_0x7477('0x4')](_0x53ac44,_0x5f1aa2);};}exports[_0x7477('0x5')]=function(_0xec1a4e){for(var _0x1667e1=0x0,_0x2c979d=events[_0x7477('0x6')];_0x1667e1<_0x2c979d;_0x1667e1++){var _0x258e5b=events[_0x1667e1];var _0x5afc82=createListener('chatWebsite:'+_0x258e5b,_0xec1a4e);ChatWebsiteEvents['on'](_0x258e5b,_0x5afc82);}}; \ No newline at end of file +var _0xef7b=['remove','update','emit','removeListener','register','save'];(function(_0x4ca42c,_0x42bc1e){var _0x119e6f=function(_0x1b6822){while(--_0x1b6822){_0x4ca42c['push'](_0x4ca42c['shift']());}};_0x119e6f(++_0x42bc1e);}(_0xef7b,0xd7));var _0xbef7=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xef7b[_0x35b18a];return _0x4db1bd;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xbef7('0x0'),_0xbef7('0x1'),_0xbef7('0x2')];function createListener(_0x14aa04,_0x4ee82e){return function(_0x22fe3e){_0x4ee82e[_0xbef7('0x3')](_0x14aa04,_0x22fe3e);};}function removeListener(_0x40581f,_0x359cb6){return function(){ChatWebsiteEvents[_0xbef7('0x4')](_0x40581f,_0x359cb6);};}exports[_0xbef7('0x5')]=function(_0xed6ec7){for(var _0x50e382=0x0,_0x5c0b55=events['length'];_0x50e382<_0x5c0b55;_0x50e382++){var _0x52ad2b=events[_0x50e382];var _0x22a2b9=createListener('chatWebsite:'+_0x52ad2b,_0xed6ec7);ChatWebsiteEvents['on'](_0x52ad2b,_0x22a2b9);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index fcdef75..8797727 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['replace','localhost','test','trim','([\x5cw]+)','exports','url','URL'];(function(_0xcf4ad9,_0x3a0633){var _0x17e368=function(_0x3a6448){while(--_0x3a6448){_0xcf4ad9['push'](_0xcf4ad9['shift']());}};_0x17e368(++_0x3a0633);}(_0x524e,0x15e));var _0xe524=function(_0x4d874e,_0x453c11){_0x4d874e=_0x4d874e-0x0;var _0x280e26=_0x524e[_0x4d874e];return _0x280e26;};var escapeRegExp=require('../../../utils/misc')['escapeRegExp'];var URL=require(_0xe524('0x0'))[_0xe524('0x1')];function testWildcardValidity(_0xc5f6b5){var _0x29e619=!![];try{new URL(_0xc5f6b5[_0xe524('0x2')]('*',_0xe524('0x3')));}catch(_0xabd694){_0x29e619=![];}return _0x29e619&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xe524('0x4')](_0xc5f6b5);}function testWebsiteWithWildcard(_0x10d37a,_0x110cff){var _0x4f75d6;var _0xaaeaa9=escapeRegExp(_0x10d37a[_0xe524('0x5')]()[_0xe524('0x2')](/\/$/,''))['replace']('\x5c*',_0xe524('0x6'));try{new URL(_0x10d37a[_0xe524('0x2')]('\x5c*',_0xe524('0x3')));_0x4f75d6=new RegExp(_0xaaeaa9)[_0xe524('0x4')](_0x110cff);}catch(_0x991924){_0x4f75d6=![];}return _0x4f75d6;}module[_0xe524('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x9672=['trim','([\x5cw]+)','localhost','exports','../../../utils/misc','escapeRegExp','URL','replace','test'];(function(_0x261b8a,_0x553ec4){var _0x3455e8=function(_0xdf10d4){while(--_0xdf10d4){_0x261b8a['push'](_0x261b8a['shift']());}};_0x3455e8(++_0x553ec4);}(_0x9672,0xee));var _0x2967=function(_0x497652,_0x27a41b){_0x497652=_0x497652-0x0;var _0x171068=_0x9672[_0x497652];return _0x171068;};var escapeRegExp=require(_0x2967('0x0'))[_0x2967('0x1')];var URL=require('url')[_0x2967('0x2')];function testWildcardValidity(_0xcaaf25){var _0x1228b8=!![];try{new URL(_0xcaaf25[_0x2967('0x3')]('*','localhost'));}catch(_0x264152){_0x1228b8=![];}return _0x1228b8&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x2967('0x4')](_0xcaaf25);}function testWebsiteWithWildcard(_0x22257d,_0x51ddb1){var _0x4baad7;var _0x24424d=escapeRegExp(_0x22257d[_0x2967('0x5')]()[_0x2967('0x3')](/\/$/,''))[_0x2967('0x3')]('\x5c*',_0x2967('0x6'));try{new URL(_0x22257d[_0x2967('0x3')]('\x5c*',_0x2967('0x7')));_0x4baad7=new RegExp(_0x24424d)[_0x2967('0x4')](_0x51ddb1);}catch(_0x4aec0f){_0x4baad7=![];}return _0x4baad7;}module[_0x2967('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 01142f0..5e21108 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 _0xdeec=['format','%s-%s','originalname','single','diskStorage','root','server/files/images/avatars/','now','file','addCustomerAvatar','/:id/system_avatar','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','/:id/proactive_actions','addAgents','put','/:id','update','delete','destroy','removeAnswers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','isAuthenticated','get','describe','show','/:id/dispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','getInteractions','/:id/snippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','join'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0xdeec,0xf0));var _0xcdee=function(_0x1d3ff1,_0x56d009){_0x1d3ff1=_0x1d3ff1-0x0;var _0x5a0a4a=_0xdeec[_0x1d3ff1];return _0x5a0a4a;};'use strict';var multer=require('multer');var util=require(_0xcdee('0x0'));var path=require(_0xcdee('0x1'));var timeout=require(_0xcdee('0x2'));var express=require(_0xcdee('0x3'));var router=express[_0xcdee('0x4')]();var fs_extra=require(_0xcdee('0x5'));var auth=require(_0xcdee('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcdee('0x7'));var controller=require(_0xcdee('0x8'));router['get']('/',auth[_0xcdee('0x9')](),controller['index']);router[_0xcdee('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xcdee('0xb')]);router[_0xcdee('0xa')]('/:id',auth[_0xcdee('0x9')](),controller[_0xcdee('0xc')]);router[_0xcdee('0xa')](_0xcdee('0xd'),auth[_0xcdee('0x9')](),controller['getDispositions']);router[_0xcdee('0xa')](_0xcdee('0xe'),auth[_0xcdee('0x9')](),controller['getAnswers']);router[_0xcdee('0xa')](_0xcdee('0xf'),controller[_0xcdee('0x10')]);router[_0xcdee('0xa')](_0xcdee('0x11'),controller[_0xcdee('0x12')]);router[_0xcdee('0xa')](_0xcdee('0x13'),controller[_0xcdee('0x14')]);router[_0xcdee('0xa')]('/:id/system_avatar',controller[_0xcdee('0x15')]);router[_0xcdee('0xa')]('/:id/interactions',auth[_0xcdee('0x9')](),controller[_0xcdee('0x16')]);router['get'](_0xcdee('0x17'),controller['getSnippet']);router[_0xcdee('0xa')](_0xcdee('0x18'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x19')]);router['get']('/:id/proactive_actions',auth[_0xcdee('0x9')](),controller[_0xcdee('0x1a')]);router[_0xcdee('0xa')]('/:id/fields',controller[_0xcdee('0x1b')]);router[_0xcdee('0xa')](_0xcdee('0x1c'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x1d')]);router[_0xcdee('0xa')](_0xcdee('0x1e'),auth['isAuthenticated'](),controller[_0xcdee('0x1f')]);router['post']('/',auth[_0xcdee('0x9')](),controller[_0xcdee('0x20')]);router[_0xcdee('0x21')](_0xcdee('0xd'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x22')]);router[_0xcdee('0x21')](_0xcdee('0xe'),auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3f97b6,_0x3383e9,_0x398d96){_0x398d96(null,path[_0xcdee('0x23')](config['root'],'server/files/images/logos/'));},'filename':function(_0xaaceb0,_0x2d82fd,_0x4c5b82){_0x4c5b82(null,util[_0xcdee('0x24')](_0xcdee('0x25'),Date['now'](),_0x2d82fd[_0xcdee('0x26')]));}})});router['post']('/:id/logo',upload[_0xcdee('0x27')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xcdee('0x28')]({'destination':function(_0x2f28ab,_0x1d0440,_0x3e4b19){_0x3e4b19(null,path[_0xcdee('0x23')](config[_0xcdee('0x29')],_0xcdee('0x2a')));},'filename':function(_0x5e3d13,_0x2af17d,_0x4a8f85){_0x4a8f85(null,util[_0xcdee('0x24')](_0xcdee('0x25'),Date[_0xcdee('0x2b')](),_0x2af17d['originalname']));}})});router[_0xcdee('0x21')](_0xcdee('0x11'),upload[_0xcdee('0x27')]('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0xcdee('0x28')]({'destination':function(_0x40d96a,_0x142995,_0x40e42f){_0x40e42f(null,path[_0xcdee('0x23')](config[_0xcdee('0x29')],'server/files/images/avatars/'));},'filename':function(_0x2f07e8,_0x198f6f,_0x3d08b6){_0x3d08b6(null,util['format'](_0xcdee('0x25'),Date[_0xcdee('0x2b')](),_0x198f6f[_0xcdee('0x26')]));}})});router[_0xcdee('0x21')](_0xcdee('0x13'),upload[_0xcdee('0x27')](_0xcdee('0x2c')),controller[_0xcdee('0x2d')]);var upload=multer({'storage':multer[_0xcdee('0x28')]({'destination':function(_0x5379a2,_0x176c38,_0x4a1ad4){_0x4a1ad4(null,path['join'](config[_0xcdee('0x29')],_0xcdee('0x2a')));},'filename':function(_0x5182ee,_0x9d7e2a,_0x297adc){_0x297adc(null,util['format'](_0xcdee('0x25'),Date[_0xcdee('0x2b')](),_0x9d7e2a[_0xcdee('0x26')]));}})});router[_0xcdee('0x21')](_0xcdee('0x2e'),upload[_0xcdee('0x27')](_0xcdee('0x2c')),controller['addSystemAvatar']);router[_0xcdee('0x21')]('/:id/notify',controller[_0xcdee('0x2f')]);const offlineUploadMulter=multer({'storage':multer[_0xcdee('0x28')]({'destination':function(_0x305b88,_0x23016d,_0x468da8){const _0x2846fe=path[_0xcdee('0x23')](config[_0xcdee('0x29')],_0xcdee('0x30'),_0xcdee('0x31'),_0xcdee('0x32'));fs_extra[_0xcdee('0x33')](_0x2846fe,function(){_0x468da8(null,_0x2846fe);});},'filename':function(_0x20dac5,_0x52b7e8,_0x3013fc){const _0x38a095=_0x52b7e8[_0xcdee('0x26')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4afa52=path[_0xcdee('0x34')](_0x38a095);const _0x3dd7a3=Date[_0xcdee('0x2b')]()+'-'+_0x38a095[_0xcdee('0x35')](_0x4afa52,'')+_0x4afa52;_0x3013fc(null,_0x3dd7a3);}})});router[_0xcdee('0x21')](_0xcdee('0x36'),offlineUploadMulter[_0xcdee('0x37')](),controller[_0xcdee('0x38')]);router['post'](_0xcdee('0x39'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x3a')]);router[_0xcdee('0x21')](_0xcdee('0x18'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x3b')]);router['post'](_0xcdee('0x3c'),auth[_0xcdee('0x9')](),controller['addProactiveActions']);router[_0xcdee('0x21')](_0xcdee('0x1e'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x3d')]);router[_0xcdee('0x3e')](_0xcdee('0x3f'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x40')]);router[_0xcdee('0x41')](_0xcdee('0x3f'),auth[_0xcdee('0x9')](),controller[_0xcdee('0x42')]);router[_0xcdee('0x41')](_0xcdee('0xd'),auth[_0xcdee('0x9')](),controller['removeDispositions']);router[_0xcdee('0x41')]('/:id/canned_answers',auth[_0xcdee('0x9')](),controller[_0xcdee('0x43')]);router[_0xcdee('0x41')](_0xcdee('0x1e'),auth[_0xcdee('0x9')](),controller['removeAgents']);module[_0xcdee('0x44')]=router; \ No newline at end of file +var _0xad69=['isAuthenticated','index','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','diskStorage','/:id/avatar','file','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','any','offline','addInteraction','addApplications','/:id/proactive_actions','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get'];(function(_0x3d11be,_0x1b9a8c){var _0x4b657b=function(_0x4a96f2){while(--_0x4a96f2){_0x3d11be['push'](_0x3d11be['shift']());}};_0x4b657b(++_0x1b9a8c);}(_0xad69,0x184));var _0x9ad6=function(_0xf9414a,_0x5347ff){_0xf9414a=_0xf9414a-0x0;var _0x328e50=_0xad69[_0xf9414a];return _0x328e50;};'use strict';var multer=require(_0x9ad6('0x0'));var util=require(_0x9ad6('0x1'));var path=require(_0x9ad6('0x2'));var timeout=require(_0x9ad6('0x3'));var express=require('express');var router=express[_0x9ad6('0x4')]();var fs_extra=require(_0x9ad6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9ad6('0x6'));var controller=require('./chatWebsite.controller');router[_0x9ad6('0x7')]('/',auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x9')]);router[_0x9ad6('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9ad6('0x7')](_0x9ad6('0xa'),auth[_0x9ad6('0x8')](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9ad6('0xb')]);router['get'](_0x9ad6('0xc'),auth[_0x9ad6('0x8')](),controller[_0x9ad6('0xd')]);router[_0x9ad6('0x7')](_0x9ad6('0xe'),controller[_0x9ad6('0xf')]);router[_0x9ad6('0x7')]('/:id/avatar',controller[_0x9ad6('0x10')]);router[_0x9ad6('0x7')](_0x9ad6('0x11'),controller[_0x9ad6('0x12')]);router[_0x9ad6('0x7')](_0x9ad6('0x13'),controller[_0x9ad6('0x14')]);router['get'](_0x9ad6('0x15'),auth[_0x9ad6('0x8')](),controller['getInteractions']);router['get']('/:id/snippet',controller[_0x9ad6('0x16')]);router[_0x9ad6('0x7')](_0x9ad6('0x17'),auth['isAuthenticated'](),controller[_0x9ad6('0x18')]);router[_0x9ad6('0x7')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x9ad6('0x19')]);router[_0x9ad6('0x7')]('/:id/fields',controller[_0x9ad6('0x1a')]);router['get']('/:id/offline_messages',auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x1b')]);router[_0x9ad6('0x7')](_0x9ad6('0x1c'),auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x1d')]);router[_0x9ad6('0x1e')]('/',auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x1f')]);router[_0x9ad6('0x1e')](_0x9ad6('0x20'),auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x21')]);router[_0x9ad6('0x1e')](_0x9ad6('0xc'),auth[_0x9ad6('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36ef32,_0x2edcbc,_0x24e3ac){_0x24e3ac(null,path[_0x9ad6('0x22')](config[_0x9ad6('0x23')],_0x9ad6('0x24')));},'filename':function(_0x5db2f4,_0x5137a2,_0x5e9c65){_0x5e9c65(null,util[_0x9ad6('0x25')](_0x9ad6('0x26'),Date[_0x9ad6('0x27')](),_0x5137a2[_0x9ad6('0x28')]));}})});router[_0x9ad6('0x1e')](_0x9ad6('0xe'),upload[_0x9ad6('0x29')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x9ad6('0x2a')]({'destination':function(_0x18fb2c,_0x7d6df6,_0x4ccdf4){_0x4ccdf4(null,path[_0x9ad6('0x22')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x13a84,_0x11bed3,_0x2dc134){_0x2dc134(null,util['format'](_0x9ad6('0x26'),Date['now'](),_0x11bed3[_0x9ad6('0x28')]));}})});router['post'](_0x9ad6('0x2b'),upload['single'](_0x9ad6('0x2c')),controller[_0x9ad6('0x2d')]);var upload=multer({'storage':multer[_0x9ad6('0x2a')]({'destination':function(_0x44345a,_0x22671d,_0x5d4abd){_0x5d4abd(null,path[_0x9ad6('0x22')](config[_0x9ad6('0x23')],_0x9ad6('0x2e')));},'filename':function(_0x2a0dc5,_0x41704a,_0x218071){_0x218071(null,util[_0x9ad6('0x25')](_0x9ad6('0x26'),Date[_0x9ad6('0x27')](),_0x41704a[_0x9ad6('0x28')]));}})});router['post'](_0x9ad6('0x11'),upload[_0x9ad6('0x29')](_0x9ad6('0x2c')),controller[_0x9ad6('0x2f')]);var upload=multer({'storage':multer[_0x9ad6('0x2a')]({'destination':function(_0x1aa60b,_0x4ab015,_0x507b4a){_0x507b4a(null,path[_0x9ad6('0x22')](config[_0x9ad6('0x23')],_0x9ad6('0x2e')));},'filename':function(_0x209bb9,_0x33af08,_0x431eb4){_0x431eb4(null,util[_0x9ad6('0x25')](_0x9ad6('0x26'),Date[_0x9ad6('0x27')](),_0x33af08[_0x9ad6('0x28')]));}})});router[_0x9ad6('0x1e')](_0x9ad6('0x13'),upload[_0x9ad6('0x29')](_0x9ad6('0x2c')),controller[_0x9ad6('0x30')]);router[_0x9ad6('0x1e')](_0x9ad6('0x31'),controller[_0x9ad6('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0x9ad6('0x2a')]({'destination':function(_0x2af3cf,_0x3b77fa,_0x597661){const _0xf537ba=path[_0x9ad6('0x22')](config[_0x9ad6('0x23')],_0x9ad6('0x33'),'attachments',_0x9ad6('0x34'));fs_extra[_0x9ad6('0x35')](_0xf537ba,function(){_0x597661(null,_0xf537ba);});},'filename':function(_0x3acca5,_0x2917cd,_0x379f66){const _0x48b578=_0x2917cd[_0x9ad6('0x28')][_0x9ad6('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x42e6b3=path[_0x9ad6('0x37')](_0x48b578);const _0x55fb73=Date[_0x9ad6('0x27')]()+'-'+_0x48b578[_0x9ad6('0x36')](_0x42e6b3,'')+_0x42e6b3;_0x379f66(null,_0x55fb73);}})});router[_0x9ad6('0x1e')]('/:id/offline',offlineUploadMulter[_0x9ad6('0x38')](),controller[_0x9ad6('0x39')]);router['post'](_0x9ad6('0x15'),auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x3a')]);router['post'](_0x9ad6('0x17'),auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x3b')]);router['post'](_0x9ad6('0x3c'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x9ad6('0x1e')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x9ad6('0xa'),auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x3d')]);router[_0x9ad6('0x3e')](_0x9ad6('0xa'),auth[_0x9ad6('0x8')](),controller[_0x9ad6('0x3f')]);router[_0x9ad6('0x3e')](_0x9ad6('0x20'),auth['isAuthenticated'](),controller[_0x9ad6('0x40')]);router['delete'](_0x9ad6('0xc'),auth[_0x9ad6('0x8')](),controller['removeAnswers']);router[_0x9ad6('0x3e')](_0x9ad6('0x1c'),auth[_0x9ad6('0x8')](),controller['removeAgents']);module[_0x9ad6('0x41')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 85dd059..4e1b399 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 _0x8300=['app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','../components/auth/service','../config/environment','Router','env'];(function(_0x42515e,_0x8a595c){var _0x76ed34=function(_0x14aba4){while(--_0x14aba4){_0x42515e['push'](_0x42515e['shift']());}};_0x76ed34(++_0x8a595c);}(_0x8300,0x74));var _0x0830=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8300[_0x4a9fb1];return _0x348672;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0x0830('0x0'));var config=require(_0x0830('0x1'));var router=express[_0x0830('0x2')]();var isProduction=config[_0x0830('0x3')]==='production'||![];function clientSideLogs(_0x2e69c1,_0x6d48f7,_0x1728c1){var _0x44b231=_0x2e69c1[_0x0830('0x4')]['get'](_0x0830('0x5'));if(!_0x44b231){throw new Error(_0x0830('0x6'));}return beaverLogger[_0x0830('0x7')]({'uri':'/client-logs','logger':_0x44b231,'enableCors':!isProduction})(_0x2e69c1,_0x6d48f7,_0x1728c1);}router[_0x0830('0x8')](auth[_0x0830('0x9')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x8e60=['env','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','exports','express','../components/auth/service','../config/environment','Router'];(function(_0x1e097e,_0x23f56c){var _0x76d7d2=function(_0x52f510){while(--_0x52f510){_0x1e097e['push'](_0x1e097e['shift']());}};_0x76d7d2(++_0x23f56c);}(_0x8e60,0x15b));var _0x08e6=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0x8e60[_0x71e493];return _0x3d40ab;};var beaverLogger=require('beaver-logger/server');var express=require(_0x08e6('0x0'));var auth=require(_0x08e6('0x1'));var config=require(_0x08e6('0x2'));var router=express[_0x08e6('0x3')]();var isProduction=config[_0x08e6('0x4')]==='production'||![];function clientSideLogs(_0x51cbc0,_0x382671,_0x57a747){var _0xe77a74=_0x51cbc0[_0x08e6('0x5')][_0x08e6('0x6')](_0x08e6('0x7'));if(!_0xe77a74){throw new Error(_0x08e6('0x8'));}return beaverLogger[_0x08e6('0x9')]({'uri':_0x08e6('0xa'),'logger':_0xe77a74,'enableCors':!isProduction})(_0x51cbc0,_0x382671,_0x57a747);}router['use'](auth[_0x08e6('0xb')](),clientSideLogs);module[_0x08e6('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 692fa54..b90a52c 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 _0x512b=['Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','Outlook365'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x512b,0xeb));var _0xb512=function(_0x3a8a4b,_0x4828ce){_0x3a8a4b=_0x3a8a4b-0x0;var _0x66f046=_0x512b[_0x3a8a4b];return _0x66f046;};'use strict';var Sequelize=require(_0xb512('0x0'));module['exports']={'name':{'type':Sequelize[_0xb512('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb512('0x2')](_0xb512('0x3'),'Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xb512('0x4'),_0xb512('0x5'))},'data1':{'type':Sequelize[_0xb512('0x1')],'comment':_0xb512('0x6')},'data2':{'type':Sequelize[_0xb512('0x1')],'comment':_0xb512('0x7')},'data3':{'type':Sequelize[_0xb512('0x1')],'comment':_0xb512('0x8')},'data4':{'type':Sequelize[_0xb512('0x1')],'comment':_0xb512('0x9')},'data5':{'type':Sequelize[_0xb512('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xb512('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':_0xb512('0xb')}}; \ No newline at end of file +var _0xa635=['ENUM','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING'];(function(_0x5b2ade,_0x4c70ef){var _0x5f24dd=function(_0x57fce5){while(--_0x57fce5){_0x5b2ade['push'](_0x5b2ade['shift']());}};_0x5f24dd(++_0x4c70ef);}(_0xa635,0xcd));var _0x5a63=function(_0x214730,_0xbfcce4){_0x214730=_0x214730-0x0;var _0x82af15=_0xa635[_0x214730];return _0x82af15;};'use strict';var Sequelize=require(_0x5a63('0x0'));module[_0x5a63('0x1')]={'name':{'type':Sequelize[_0x5a63('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5a63('0x3')]('AmazonAWS',_0x5a63('0x4'),_0x5a63('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x5a63('0x3')](_0x5a63('0x6'),_0x5a63('0x7'))},'data1':{'type':Sequelize[_0x5a63('0x2')],'comment':_0x5a63('0x8')},'data2':{'type':Sequelize['STRING'],'comment':_0x5a63('0x9')},'data3':{'type':Sequelize[_0x5a63('0x2')],'comment':_0x5a63('0xa')},'data4':{'type':Sequelize[_0x5a63('0x2')],'comment':_0x5a63('0xb')},'data5':{'type':Sequelize[_0x5a63('0xc')],'comment':_0x5a63('0xd')},'data6':{'type':Sequelize[_0x5a63('0xc')],'comment':_0x5a63('0xe')},'data7':{'type':Sequelize[_0x5a63('0xc')],'comment':_0x5a63('0xf')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2cb026d..fd5526a 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 _0x8621=['Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','offset','undefined','limit','count','Content-Range','json','update','destroy','then','status','end','stack','name','slice','map','CloudProvider','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','options','includeAll','rows','service','MicrosoftAzure','data3','catch','show','params','decryptString','Name\x20parameter\x20not\x20specified','body','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','find','findOne','user','oauth2MicrosoftCallback','error','state','Invalid\x20state\x20parameter','parse','from','base64','isValidIdToken','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:error'];(function(_0x2c3739,_0x19b190){var _0x23196d=function(_0x26d937){while(--_0x26d937){_0x2c3739['push'](_0x2c3739['shift']());}};_0x23196d(++_0x19b190);}(_0x8621,0x1c2));var _0x1862=function(_0x4588d8,_0xbdb8d2){_0x4588d8=_0x4588d8-0x0;var _0x2c33dc=_0x8621[_0x4588d8];return _0x2c33dc;};'use strict';var _=require(_0x1862('0x0'));var Redis=require(_0x1862('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x1862('0x2'));var config=require(_0x1862('0x3'));var logger=require(_0x1862('0x4'))('api');var db=require(_0x1862('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x1862('0x6')]=_[_0x1862('0x7')](config[_0x1862('0x6')],{'host':_0x1862('0x8'),'port':0x18eb});var socket=require(_0x1862('0x9'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x27d068,_0x1f1cf6){_0x1f1cf6=_0x1f1cf6||0xcc;return function(_0x2da952){if(_0x2da952){return _0x27d068[_0x1862('0xa')](_0x1f1cf6);}return _0x27d068['status'](_0x1f1cf6)['end']();};}function respondWithResult(_0x182610,_0x275600){_0x275600=_0x275600||0xc8;return function(_0x563f5b){if(_0x563f5b){return _0x182610['status'](_0x275600)['json'](_0x563f5b);}};}function respondWithFilteredResult(_0x594e0f,_0x21beab){return function(_0x4ee74a){if(_0x4ee74a){var _0x2c2669=typeof _0x21beab[_0x1862('0xb')]===_0x1862('0xc')&&typeof _0x21beab[_0x1862('0xd')]===_0x1862('0xc');var _0x578f91=_0x4ee74a[_0x1862('0xe')];var _0x2e30e0=_0x2c2669?0x0:_0x21beab['offset'];var _0x363406=_0x2c2669?_0x4ee74a[_0x1862('0xe')]:_0x21beab[_0x1862('0xb')]+_0x21beab[_0x1862('0xd')];var _0x1250cc;if(_0x363406>=_0x578f91){_0x363406=_0x578f91;_0x1250cc=0xc8;}else{_0x1250cc=0xce;}_0x594e0f['status'](_0x1250cc);return _0x594e0f['set'](_0x1862('0xf'),_0x2e30e0+'-'+_0x363406+'/'+_0x578f91)[_0x1862('0x10')](_0x4ee74a);}return null;};}function saveUpdates(_0x4d6783){return function(_0x2c88d8){if(_0x2c88d8){return _0x2c88d8[_0x1862('0x11')](_0x4d6783)['then'](function(_0x1d7eb4){return _0x1d7eb4;});}return null;};}function removeEntity(_0x169112){return function(_0x432402){if(_0x432402){return _0x432402[_0x1862('0x12')]()[_0x1862('0x13')](function(){_0x169112[_0x1862('0x14')](0xcc)[_0x1862('0x15')]();});}};}function handleEntityNotFound(_0x29d629){return function(_0x1f1a7f){if(!_0x1f1a7f){_0x29d629[_0x1862('0xa')](0x194);}return _0x1f1a7f;};}function handleError(_0x4813ff,_0x3ab015){_0x3ab015=_0x3ab015||0x1f4;return function(_0x1a3098){logger['error'](_0x1a3098[_0x1862('0x16')]);if(_0x1a3098[_0x1862('0x17')]){delete _0x1a3098[_0x1862('0x17')];}_0x4813ff['status'](_0x3ab015)['send'](_0x1a3098);};}function maskClientSecret(_0x4d9d7a){return _['padEnd'](_0x4d9d7a[_0x1862('0x18')](0x0,0x3),0x14,'*');}exports['index']=function(_0x6b7fe8,_0x166949){var _0x4ba207={},_0x364d3f={},_0x5505be={'count':0x0,'rows':[]};var _0x10c478=_[_0x1862('0x19')](db[_0x1862('0x1a')][_0x1862('0x1b')],function(_0x2a8841){return{'name':_0x2a8841['fieldName'],'type':_0x2a8841[_0x1862('0x1c')][_0x1862('0x1d')]};});_0x364d3f[_0x1862('0x1e')]=_[_0x1862('0x19')](_0x10c478,_0x1862('0x17'));_0x364d3f['query']=_[_0x1862('0x1f')](_0x6b7fe8[_0x1862('0x20')]);_0x364d3f[_0x1862('0x21')]=_[_0x1862('0x22')](_0x364d3f['model'],_0x364d3f[_0x1862('0x20')]);_0x4ba207[_0x1862('0x23')]=_[_0x1862('0x22')](_0x364d3f[_0x1862('0x1e')],qs['fields'](_0x6b7fe8[_0x1862('0x20')][_0x1862('0x24')]));_0x4ba207['attributes']=_0x4ba207[_0x1862('0x23')][_0x1862('0x25')]?_0x4ba207[_0x1862('0x23')]:_0x364d3f[_0x1862('0x1e')];if(!_0x6b7fe8[_0x1862('0x20')]['hasOwnProperty'](_0x1862('0x26'))){_0x4ba207[_0x1862('0xd')]=qs[_0x1862('0xd')](_0x6b7fe8[_0x1862('0x20')][_0x1862('0xd')]);_0x4ba207[_0x1862('0xb')]=qs[_0x1862('0xb')](_0x6b7fe8['query'][_0x1862('0xb')]);}_0x4ba207[_0x1862('0x27')]=qs[_0x1862('0x28')](_0x6b7fe8[_0x1862('0x20')][_0x1862('0x28')]);_0x4ba207['where']=qs[_0x1862('0x21')](_[_0x1862('0x29')](_0x6b7fe8[_0x1862('0x20')],_0x364d3f[_0x1862('0x21')]),_0x10c478);if(_0x6b7fe8[_0x1862('0x20')][_0x1862('0x2a')]){_0x4ba207['where']=_['merge'](_0x4ba207[_0x1862('0x2b')],{'$or':_[_0x1862('0x19')](_0x10c478,function(_0x1873b0){if(_0x1873b0['type']!=='VIRTUAL'){var _0x5c9e3d={};_0x5c9e3d[_0x1873b0[_0x1862('0x17')]]={'$like':'%'+_0x6b7fe8['query']['filter']+'%'};return _0x5c9e3d;}})});}_0x4ba207=_['merge']({},_0x4ba207,_0x6b7fe8[_0x1862('0x2c')]);var _0x4fa1ba={'where':_0x4ba207['where']};return db[_0x1862('0x1a')][_0x1862('0xe')](_0x4fa1ba)[_0x1862('0x13')](function(_0x31a9e8){_0x5505be[_0x1862('0xe')]=_0x31a9e8;if(_0x6b7fe8[_0x1862('0x20')][_0x1862('0x2d')]){_0x4ba207['include']=[{'all':!![]}];}return db[_0x1862('0x1a')]['findAll'](_0x4ba207);})[_0x1862('0x13')](function(_0x42b402){_0x5505be[_0x1862('0x2e')]=_[_0x1862('0x19')](_0x42b402,function(_0xd8d37e){if(_0xd8d37e[_0x1862('0x2f')]===_0x1862('0x30')){var _0x4141fa=encryptor['decryptString'](_0xd8d37e[_0x1862('0x31')]);_0xd8d37e['data3']=maskClientSecret(_0x4141fa);}return _0xd8d37e;});return _0x5505be;})[_0x1862('0x13')](respondWithFilteredResult(_0x166949,_0x4ba207))[_0x1862('0x32')](handleError(_0x166949,null));};exports[_0x1862('0x33')]=function(_0x4520fd,_0x20e8ee){var _0x215feb={'raw':!![],'where':{'id':_0x4520fd[_0x1862('0x34')]['id']}},_0x2f79e3={};_0x2f79e3['model']=_['keys'](db[_0x1862('0x1a')]['rawAttributes']);_0x2f79e3['query']=_['keys'](_0x4520fd['query']);_0x2f79e3['filters']=_[_0x1862('0x22')](_0x2f79e3['model'],_0x2f79e3[_0x1862('0x20')]);_0x215feb[_0x1862('0x23')]=_[_0x1862('0x22')](_0x2f79e3[_0x1862('0x1e')],qs[_0x1862('0x24')](_0x4520fd[_0x1862('0x20')][_0x1862('0x24')]));_0x215feb[_0x1862('0x23')]=_0x215feb['attributes'][_0x1862('0x25')]?_0x215feb['attributes']:_0x2f79e3['model'];if(_0x4520fd[_0x1862('0x20')][_0x1862('0x2d')]){_0x215feb['include']=[{'all':!![]}];}_0x215feb=_['merge']({},_0x215feb,_0x4520fd[_0x1862('0x2c')]);return db[_0x1862('0x1a')]['find'](_0x215feb)['then'](handleEntityNotFound(_0x20e8ee,null))[_0x1862('0x13')](function(_0x364203){if(_0x364203['service']===_0x1862('0x30')){var _0x201845=encryptor[_0x1862('0x35')](_0x364203[_0x1862('0x31')]);_0x364203[_0x1862('0x31')]=maskClientSecret(_0x201845);}return _0x364203;})[_0x1862('0x13')](respondWithResult(_0x20e8ee,null))[_0x1862('0x32')](handleError(_0x20e8ee,null));};exports['create']=function(_0x5ceb5a,_0x27862f){if(!_0x5ceb5a['body']['name'])throw new Error(_0x1862('0x36'));if(!_0x5ceb5a[_0x1862('0x37')][_0x1862('0x2f')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x273650=db[_0x1862('0x1a')][_0x1862('0x1b')][_0x1862('0x2f')][_0x1862('0x38')];if(!_0x273650[_0x1862('0x39')](_0x5ceb5a['body'][_0x1862('0x2f')]))throw new Error(_0x1862('0x3a')+_0x273650[_0x1862('0x3b')](',\x20'));if(_0x5ceb5a[_0x1862('0x37')][_0x1862('0x2f')]==='MicrosoftAzure'&&_0x5ceb5a['body']['data3']){_0x5ceb5a['body'][_0x1862('0x31')]=encryptor[_0x1862('0x3c')](_0x5ceb5a[_0x1862('0x37')]['data3']);}return db[_0x1862('0x1a')][_0x1862('0x3d')](_0x5ceb5a[_0x1862('0x37')],{})[_0x1862('0x13')](respondWithResult(_0x27862f,0xc9))[_0x1862('0x32')](handleError(_0x27862f,null));};exports[_0x1862('0x11')]=function(_0x19328a,_0x2cca58){if(_0x19328a[_0x1862('0x37')]['id']){delete _0x19328a[_0x1862('0x37')]['id'];}return db[_0x1862('0x1a')][_0x1862('0x3e')]({'where':{'id':_0x19328a[_0x1862('0x34')]['id']}})[_0x1862('0x13')](handleEntityNotFound(_0x2cca58,null))[_0x1862('0x13')](function(_0xdeede){if(_0xdeede[_0x1862('0x2f')]===_0x1862('0x30')&&_0x19328a[_0x1862('0x37')]['data3']){_0x19328a['body'][_0x1862('0x31')]=encryptor[_0x1862('0x3c')](_0x19328a[_0x1862('0x37')][_0x1862('0x31')]);}return _0xdeede;})['then'](saveUpdates(_0x19328a['body'],null))[_0x1862('0x13')](respondWithResult(_0x2cca58,null))['catch'](handleError(_0x2cca58,null));};exports['destroy']=function(_0x2d87f1,_0x4c9eab){return db['CloudProvider'][_0x1862('0x3e')]({'where':{'id':_0x2d87f1[_0x1862('0x34')]['id']}})[_0x1862('0x13')](handleEntityNotFound(_0x4c9eab,null))[_0x1862('0x13')](removeEntity(_0x4c9eab,null))[_0x1862('0x32')](handleError(_0x4c9eab,null));};exports['oauth2MicrosoftAuthorize']=function(_0x39c051,_0x5b8d85){return db['CloudProvider'][_0x1862('0x3f')]({'where':{'id':_0x39c051[_0x1862('0x34')]['id']},'raw':!![]})['then'](function(_0x16c2c8){if(!_0x16c2c8)return _0x5b8d85[_0x1862('0xa')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x16c2c8,_0x39c051[_0x1862('0x40')]['id'])};})['then'](respondWithResult(_0x5b8d85,null))['catch'](handleError(_0x5b8d85,null));};exports[_0x1862('0x41')]=function(_0x346046,_0x55e15b){var _0x22c33c=_0x346046[_0x1862('0x37')];var _0x1792f1;var _0x1605b4;if(_0x22c33c[_0x1862('0x42')])throw _0x22c33c;redis['get'](_0x22c33c[_0x1862('0x43')])[_0x1862('0x13')](function(_0x2c1dbb){if(!_0x2c1dbb)throw new Error(_0x1862('0x44'));_0x1792f1=JSON[_0x1862('0x45')](_0x2c1dbb);var _0x4bc1e6=Buffer[_0x1862('0x46')](_0x22c33c[_0x1862('0x43')],_0x1862('0x47'))['toString']('ascii');_0x1605b4=JSON[_0x1862('0x45')](_0x4bc1e6);if(!oauth[_0x1862('0x48')](_0x22c33c['id_token'],_0x1792f1['oauth2Claims']))throw new Error(_0x1862('0x49'));redis[_0x1862('0x4a')](_0x22c33c[_0x1862('0x43')]);return oauth[_0x1862('0x4b')](_0x22c33c[_0x1862('0x4c')],_0x1792f1);})[_0x1862('0x13')](function(_0x53061d){_0x1792f1['data5']=_0x53061d[_0x1862('0x4d')];_0x1792f1[_0x1862('0x4e')]=_0x53061d[_0x1862('0x4f')];return db['CloudProvider'][_0x1862('0x11')]({'data5':_0x1792f1[_0x1862('0x50')],'data6':_0x1792f1['data6']},{'where':{'id':_0x1792f1['id']}});})[_0x1862('0x13')](function(){oauth[_0x1862('0x51')](_0x1792f1);socket[_0x1862('0x52')]('microsoftAuthorization:success',{'id':_0x1605b4['id']});return;})[_0x1862('0x13')](respondWithStatusCode(_0x55e15b,null))[_0x1862('0x32')](function(_0x52e56b){if(_0x1605b4){socket[_0x1862('0x52')](_0x1862('0x53'),{'id':_0x1605b4['id']});}if(!_0x1792f1){logger[_0x1862('0x42')](_0x1862('0x54'),_0x52e56b);return _0x55e15b[_0x1862('0x14')](0x1f4)[_0x1862('0x55')](_0x52e56b[_0x1862('0x56')]);}logger['error'](_0x1862('0x57'),_0x1792f1['id'],JSON[_0x1862('0x58')](_0x52e56b));});}; \ No newline at end of file +var _0xdc19=['code','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','ioredis','../../config/environment','api','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','padEnd','slice','map','CloudProvider','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','decryptString','data3','show','params','find','service','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','MicrosoftAzure','encryptString','create','catch','oauth2MicrosoftAuthorize','findOne','oauth2MicrosoftCallback','Invalid\x20state\x20parameter','state','base64','toString','parse','isValidIdToken','id_token','oauth2Claims','del'];(function(_0xe79efd,_0x20e812){var _0x104d81=function(_0x3745fe){while(--_0x3745fe){_0xe79efd['push'](_0xe79efd['shift']());}};_0x104d81(++_0x20e812);}(_0xdc19,0x66));var _0x9dc1=function(_0x1c3e07,_0x4d31a5){_0x1c3e07=_0x1c3e07-0x0;var _0x1defcb=_0xdc19[_0x1c3e07];return _0x1defcb;};'use strict';var _=require('lodash');var Redis=require(_0x9dc1('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require(_0x9dc1('0x1'));var logger=require('../../config/logger')(_0x9dc1('0x2'));var db=require(_0x9dc1('0x3'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x9dc1('0x4')]=_[_0x9dc1('0x5')](config[_0x9dc1('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x9dc1('0x6'))(new Redis(config['redis']));var redis=new Redis(config[_0x9dc1('0x4')]);function respondWithStatusCode(_0x513e44,_0x329be7){_0x329be7=_0x329be7||0xcc;return function(_0x2e305c){if(_0x2e305c){return _0x513e44[_0x9dc1('0x7')](_0x329be7);}return _0x513e44['status'](_0x329be7)[_0x9dc1('0x8')]();};}function respondWithResult(_0x783f46,_0x717af7){_0x717af7=_0x717af7||0xc8;return function(_0x4121a5){if(_0x4121a5){return _0x783f46[_0x9dc1('0x9')](_0x717af7)[_0x9dc1('0xa')](_0x4121a5);}};}function respondWithFilteredResult(_0x95435f,_0x4a996f){return function(_0x19fbe1){if(_0x19fbe1){var _0x68e996=typeof _0x4a996f[_0x9dc1('0xb')]===_0x9dc1('0xc')&&typeof _0x4a996f[_0x9dc1('0xd')]==='undefined';var _0x2813c4=_0x19fbe1[_0x9dc1('0xe')];var _0x138b56=_0x68e996?0x0:_0x4a996f[_0x9dc1('0xb')];var _0x1bce86=_0x68e996?_0x19fbe1[_0x9dc1('0xe')]:_0x4a996f[_0x9dc1('0xb')]+_0x4a996f[_0x9dc1('0xd')];var _0xaf5799;if(_0x1bce86>=_0x2813c4){_0x1bce86=_0x2813c4;_0xaf5799=0xc8;}else{_0xaf5799=0xce;}_0x95435f['status'](_0xaf5799);return _0x95435f['set'](_0x9dc1('0xf'),_0x138b56+'-'+_0x1bce86+'/'+_0x2813c4)[_0x9dc1('0xa')](_0x19fbe1);}return null;};}function saveUpdates(_0x254422){return function(_0x43548f){if(_0x43548f){return _0x43548f[_0x9dc1('0x10')](_0x254422)[_0x9dc1('0x11')](function(_0x5c5256){return _0x5c5256;});}return null;};}function removeEntity(_0x4c23e3){return function(_0x5bcc1c){if(_0x5bcc1c){return _0x5bcc1c[_0x9dc1('0x12')]()[_0x9dc1('0x11')](function(){_0x4c23e3['status'](0xcc)[_0x9dc1('0x8')]();});}};}function handleEntityNotFound(_0x1efcf3){return function(_0x4c1010){if(!_0x4c1010){_0x1efcf3['sendStatus'](0x194);}return _0x4c1010;};}function handleError(_0x454f6d,_0x3125b2){_0x3125b2=_0x3125b2||0x1f4;return function(_0x38d58c){logger[_0x9dc1('0x13')](_0x38d58c['stack']);if(_0x38d58c['name']){delete _0x38d58c['name'];}_0x454f6d[_0x9dc1('0x9')](_0x3125b2)['send'](_0x38d58c);};}function maskClientSecret(_0x12079a){return _[_0x9dc1('0x14')](_0x12079a[_0x9dc1('0x15')](0x0,0x3),0x14,'*');}exports['index']=function(_0x2698ae,_0x4f786b){var _0x381726={},_0x45dd23={},_0x5e8a9a={'count':0x0,'rows':[]};var _0x7846f9=_[_0x9dc1('0x16')](db[_0x9dc1('0x17')][_0x9dc1('0x18')],function(_0x4c84a1){return{'name':_0x4c84a1[_0x9dc1('0x19')],'type':_0x4c84a1[_0x9dc1('0x1a')][_0x9dc1('0x1b')]};});_0x45dd23[_0x9dc1('0x1c')]=_[_0x9dc1('0x16')](_0x7846f9,_0x9dc1('0x1d'));_0x45dd23['query']=_[_0x9dc1('0x1e')](_0x2698ae['query']);_0x45dd23[_0x9dc1('0x1f')]=_[_0x9dc1('0x20')](_0x45dd23['model'],_0x45dd23['query']);_0x381726[_0x9dc1('0x21')]=_['intersection'](_0x45dd23[_0x9dc1('0x1c')],qs[_0x9dc1('0x22')](_0x2698ae[_0x9dc1('0x23')][_0x9dc1('0x22')]));_0x381726[_0x9dc1('0x21')]=_0x381726[_0x9dc1('0x21')][_0x9dc1('0x24')]?_0x381726[_0x9dc1('0x21')]:_0x45dd23[_0x9dc1('0x1c')];if(!_0x2698ae[_0x9dc1('0x23')][_0x9dc1('0x25')]('nolimit')){_0x381726[_0x9dc1('0xd')]=qs[_0x9dc1('0xd')](_0x2698ae[_0x9dc1('0x23')]['limit']);_0x381726[_0x9dc1('0xb')]=qs['offset'](_0x2698ae[_0x9dc1('0x23')][_0x9dc1('0xb')]);}_0x381726['order']=qs[_0x9dc1('0x26')](_0x2698ae['query'][_0x9dc1('0x26')]);_0x381726[_0x9dc1('0x27')]=qs[_0x9dc1('0x1f')](_[_0x9dc1('0x28')](_0x2698ae['query'],_0x45dd23[_0x9dc1('0x1f')]),_0x7846f9);if(_0x2698ae[_0x9dc1('0x23')][_0x9dc1('0x29')]){_0x381726[_0x9dc1('0x27')]=_['merge'](_0x381726[_0x9dc1('0x27')],{'$or':_[_0x9dc1('0x16')](_0x7846f9,function(_0x542d49){if(_0x542d49[_0x9dc1('0x1a')]!==_0x9dc1('0x2a')){var _0x33034d={};_0x33034d[_0x542d49[_0x9dc1('0x1d')]]={'$like':'%'+_0x2698ae['query'][_0x9dc1('0x29')]+'%'};return _0x33034d;}})});}_0x381726=_[_0x9dc1('0x2b')]({},_0x381726,_0x2698ae[_0x9dc1('0x2c')]);var _0x4aa732={'where':_0x381726[_0x9dc1('0x27')]};return db[_0x9dc1('0x17')][_0x9dc1('0xe')](_0x4aa732)['then'](function(_0x4da673){_0x5e8a9a['count']=_0x4da673;if(_0x2698ae[_0x9dc1('0x23')][_0x9dc1('0x2d')]){_0x381726[_0x9dc1('0x2e')]=[{'all':!![]}];}return db['CloudProvider'][_0x9dc1('0x2f')](_0x381726);})[_0x9dc1('0x11')](function(_0x5e352e){_0x5e8a9a[_0x9dc1('0x30')]=_['map'](_0x5e352e,function(_0x53649a){if(_0x53649a['service']==='MicrosoftAzure'){var _0x4943ce=encryptor[_0x9dc1('0x31')](_0x53649a['data3']);_0x53649a[_0x9dc1('0x32')]=maskClientSecret(_0x4943ce);}return _0x53649a;});return _0x5e8a9a;})['then'](respondWithFilteredResult(_0x4f786b,_0x381726))['catch'](handleError(_0x4f786b,null));};exports[_0x9dc1('0x33')]=function(_0x57938f,_0x3fea27){var _0x37e230={'raw':!![],'where':{'id':_0x57938f[_0x9dc1('0x34')]['id']}},_0x207c4e={};_0x207c4e[_0x9dc1('0x1c')]=_[_0x9dc1('0x1e')](db[_0x9dc1('0x17')][_0x9dc1('0x18')]);_0x207c4e[_0x9dc1('0x23')]=_[_0x9dc1('0x1e')](_0x57938f[_0x9dc1('0x23')]);_0x207c4e[_0x9dc1('0x1f')]=_[_0x9dc1('0x20')](_0x207c4e[_0x9dc1('0x1c')],_0x207c4e[_0x9dc1('0x23')]);_0x37e230[_0x9dc1('0x21')]=_[_0x9dc1('0x20')](_0x207c4e[_0x9dc1('0x1c')],qs[_0x9dc1('0x22')](_0x57938f[_0x9dc1('0x23')][_0x9dc1('0x22')]));_0x37e230[_0x9dc1('0x21')]=_0x37e230[_0x9dc1('0x21')][_0x9dc1('0x24')]?_0x37e230[_0x9dc1('0x21')]:_0x207c4e[_0x9dc1('0x1c')];if(_0x57938f[_0x9dc1('0x23')]['includeAll']){_0x37e230[_0x9dc1('0x2e')]=[{'all':!![]}];}_0x37e230=_['merge']({},_0x37e230,_0x57938f[_0x9dc1('0x2c')]);return db[_0x9dc1('0x17')][_0x9dc1('0x35')](_0x37e230)[_0x9dc1('0x11')](handleEntityNotFound(_0x3fea27,null))[_0x9dc1('0x11')](function(_0x1ea11a){if(_0x1ea11a[_0x9dc1('0x36')]==='MicrosoftAzure'){var _0x587ced=encryptor[_0x9dc1('0x31')](_0x1ea11a[_0x9dc1('0x32')]);_0x1ea11a[_0x9dc1('0x32')]=maskClientSecret(_0x587ced);}return _0x1ea11a;})[_0x9dc1('0x11')](respondWithResult(_0x3fea27,null))['catch'](handleError(_0x3fea27,null));};exports['create']=function(_0x2794a9,_0x47143a){if(!_0x2794a9[_0x9dc1('0x37')]['name'])throw new Error(_0x9dc1('0x38'));if(!_0x2794a9[_0x9dc1('0x37')][_0x9dc1('0x36')])throw new Error(_0x9dc1('0x39'));var _0x2d7d3c=db[_0x9dc1('0x17')][_0x9dc1('0x18')]['service'][_0x9dc1('0x3a')];if(!_0x2d7d3c[_0x9dc1('0x3b')](_0x2794a9['body'][_0x9dc1('0x36')]))throw new Error(_0x9dc1('0x3c')+_0x2d7d3c[_0x9dc1('0x3d')](',\x20'));if(_0x2794a9[_0x9dc1('0x37')][_0x9dc1('0x36')]===_0x9dc1('0x3e')&&_0x2794a9['body'][_0x9dc1('0x32')]){_0x2794a9['body'][_0x9dc1('0x32')]=encryptor[_0x9dc1('0x3f')](_0x2794a9[_0x9dc1('0x37')][_0x9dc1('0x32')]);}return db[_0x9dc1('0x17')][_0x9dc1('0x40')](_0x2794a9[_0x9dc1('0x37')],{})[_0x9dc1('0x11')](respondWithResult(_0x47143a,0xc9))[_0x9dc1('0x41')](handleError(_0x47143a,null));};exports[_0x9dc1('0x10')]=function(_0x1431b6,_0x8cbfd9){if(_0x1431b6[_0x9dc1('0x37')]['id']){delete _0x1431b6[_0x9dc1('0x37')]['id'];}return db[_0x9dc1('0x17')][_0x9dc1('0x35')]({'where':{'id':_0x1431b6[_0x9dc1('0x34')]['id']}})['then'](handleEntityNotFound(_0x8cbfd9,null))[_0x9dc1('0x11')](function(_0x27bc02){if(_0x27bc02[_0x9dc1('0x36')]===_0x9dc1('0x3e')&&_0x1431b6['body'][_0x9dc1('0x32')]){_0x1431b6[_0x9dc1('0x37')][_0x9dc1('0x32')]=encryptor[_0x9dc1('0x3f')](_0x1431b6[_0x9dc1('0x37')][_0x9dc1('0x32')]);}return _0x27bc02;})[_0x9dc1('0x11')](saveUpdates(_0x1431b6[_0x9dc1('0x37')],null))[_0x9dc1('0x11')](respondWithResult(_0x8cbfd9,null))[_0x9dc1('0x41')](handleError(_0x8cbfd9,null));};exports[_0x9dc1('0x12')]=function(_0x4c6a79,_0x315959){return db[_0x9dc1('0x17')][_0x9dc1('0x35')]({'where':{'id':_0x4c6a79[_0x9dc1('0x34')]['id']}})['then'](handleEntityNotFound(_0x315959,null))['then'](removeEntity(_0x315959,null))[_0x9dc1('0x41')](handleError(_0x315959,null));};exports[_0x9dc1('0x42')]=function(_0x14ab53,_0x584ef){return db[_0x9dc1('0x17')][_0x9dc1('0x43')]({'where':{'id':_0x14ab53[_0x9dc1('0x34')]['id']},'raw':!![]})['then'](function(_0x3a4648){if(!_0x3a4648)return _0x584ef[_0x9dc1('0x7')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x3a4648,_0x14ab53['user']['id'])};})[_0x9dc1('0x11')](respondWithResult(_0x584ef,null))[_0x9dc1('0x41')](handleError(_0x584ef,null));};exports[_0x9dc1('0x44')]=function(_0x329b99,_0x2a33f0){var _0x1f7023=_0x329b99[_0x9dc1('0x37')];var _0x5e5f29;var _0x3215b2;if(_0x1f7023[_0x9dc1('0x13')])throw _0x1f7023;redis['get'](_0x1f7023['state'])['then'](function(_0x3b84db){if(!_0x3b84db)throw new Error(_0x9dc1('0x45'));_0x5e5f29=JSON['parse'](_0x3b84db);var _0x568455=Buffer['from'](_0x1f7023[_0x9dc1('0x46')],_0x9dc1('0x47'))[_0x9dc1('0x48')]('ascii');_0x3215b2=JSON[_0x9dc1('0x49')](_0x568455);if(!oauth[_0x9dc1('0x4a')](_0x1f7023[_0x9dc1('0x4b')],_0x5e5f29[_0x9dc1('0x4c')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x9dc1('0x4d')](_0x1f7023[_0x9dc1('0x46')]);return oauth['getOauth2MicrosoftAccessToken'](_0x1f7023[_0x9dc1('0x4e')],_0x5e5f29);})[_0x9dc1('0x11')](function(_0x2d7355){_0x5e5f29['data5']=_0x2d7355['access_token'];_0x5e5f29[_0x9dc1('0x4f')]=_0x2d7355[_0x9dc1('0x50')];return db[_0x9dc1('0x17')][_0x9dc1('0x10')]({'data5':_0x5e5f29[_0x9dc1('0x51')],'data6':_0x5e5f29[_0x9dc1('0x4f')]},{'where':{'id':_0x5e5f29['id']}});})[_0x9dc1('0x11')](function(){oauth[_0x9dc1('0x52')](_0x5e5f29);socket[_0x9dc1('0x53')](_0x9dc1('0x54'),{'id':_0x3215b2['id']});return;})[_0x9dc1('0x11')](respondWithStatusCode(_0x2a33f0,null))['catch'](function(_0x49eef4){if(_0x3215b2){socket['emit'](_0x9dc1('0x55'),{'id':_0x3215b2['id']});}if(!_0x5e5f29){logger[_0x9dc1('0x13')](_0x9dc1('0x56'),_0x49eef4);return _0x2a33f0[_0x9dc1('0x9')](0x1f4)[_0x9dc1('0x57')](_0x49eef4[_0x9dc1('0x58')]);}logger[_0x9dc1('0x13')](_0x9dc1('0x59'),_0x5e5f29['id'],JSON['stringify'](_0x49eef4));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 5012dc6..45cf1bd 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 _0x2c31=['../../config/logger','moment','bluebird','request-promise','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','lodash','util'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0x2c31,0x132));var _0x12c3=function(_0x4caeda,_0x427222){_0x4caeda=_0x4caeda-0x0;var _0x2ce18b=_0x2c31[_0x4caeda];return _0x2ce18b;};'use strict';var _=require(_0x12c3('0x0'));var util=require(_0x12c3('0x1'));var logger=require(_0x12c3('0x2'))('api');var moment=require(_0x12c3('0x3'));var BPromise=require(_0x12c3('0x4'));var rp=require(_0x12c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12c3('0x6'));var config=require('../../config/environment');var attributes=require(_0x12c3('0x7'));module[_0x12c3('0x8')]=function(_0x2a7b5c,_0x367d4f){return _0x2a7b5c[_0x12c3('0x9')](_0x12c3('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x298f=['../../config/environment','exports','define','CloudProvider','cloud_providers','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2e0cd1,_0x381dc8){var _0x5766b9=function(_0x36ac6d){while(--_0x36ac6d){_0x2e0cd1['push'](_0x2e0cd1['shift']());}};_0x5766b9(++_0x381dc8);}(_0x298f,0x1e6));var _0xf298=function(_0xf9298e,_0x1f89ff){_0xf9298e=_0xf9298e-0x0;var _0xb34965=_0x298f[_0xf9298e];return _0xb34965;};'use strict';var _=require(_0xf298('0x0'));var util=require(_0xf298('0x1'));var logger=require('../../config/logger')(_0xf298('0x2'));var moment=require(_0xf298('0x3'));var BPromise=require(_0xf298('0x4'));var rp=require(_0xf298('0x5'));var fs=require('fs');var path=require(_0xf298('0x6'));var rimraf=require(_0xf298('0x7'));var config=require(_0xf298('0x8'));var attributes=require('./cloudProvider.attributes');module[_0xf298('0x9')]=function(_0xaf090d,_0x3bb402){return _0xaf090d[_0xf298('0xa')](_0xf298('0xb'),attributes,{'tableName':_0xf298('0xc'),'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 e08dcec..d82105d 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 _0x12c0=['https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','push','data7','Outlook365','Dynamics365','replace','data2','id_token','from','stringify','toString','base64','data1','response_type','join','redirect_uri','data4','response_mode','form_post','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','set','aud','audience','isAfter','unix','exp','resolve','data3','findOne','then','refresh_token','decryptString','{TENANT_ID}','data5','access_token','update','data6','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','POST','intervals','bind','CloudProvider','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','moment','request-promise','../../config/environment','../../config/logger','api','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access'];(function(_0x136532,_0x5a6219){var _0x1c8a04=function(_0x3c07ae){while(--_0x3c07ae){_0x136532['push'](_0x136532['shift']());}};_0x1c8a04(++_0x5a6219);}(_0x12c0,0x172));var _0x012c=function(_0x578d9e,_0x17f9fb){_0x578d9e=_0x578d9e-0x0;var _0x717f26=_0x12c0[_0x578d9e];return _0x717f26;};'use strict';var _=require(_0x012c('0x0'));var crypto=require(_0x012c('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x012c('0x2'));var Redis=require('ioredis');var rp=require(_0x012c('0x3'));var util=require('util');var encryptor=require('../../components/encryptor');var config=require(_0x012c('0x4'));var logger=require(_0x012c('0x5'))(_0x012c('0x6'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0x012c('0x7')]=_[_0x012c('0x8')](config[_0x012c('0x7')],{'host':_0x012c('0x9'),'port':0x18eb});var redis=new Redis(config[_0x012c('0x7')]);var MICROSOFT_AUTH_URL=_0x012c('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x012c('0xb'),_0x012c('0xc'),_0x012c('0xd'),_0x012c('0xe'),_0x012c('0xf'),_0x012c('0x10'),_0x012c('0x11')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x012c('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x012c('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1fc134){var _0x133b76=_[_0x012c('0x14')](AZURE_AUTH_SCOPES[_0x1fc134[_0x012c('0x15')]]);if(_0x1fc134[_0x012c('0x15')]==='Dynamics365')_0x133b76[_0x012c('0x16')](_0x1fc134[_0x012c('0x17')]+'/.default');return _0x133b76['join']('\x20');}function getAccessTokenScope(_0x56ecf2){if(_0x56ecf2[_0x012c('0x15')]===_0x012c('0x18'))return _0x012c('0xf');if(_0x56ecf2[_0x012c('0x15')]===_0x012c('0x19'))return _0x56ecf2[_0x012c('0x17')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x52ed29,_0x1048e4){var _0x97584a=MICROSOFT_AUTH_URL[_0x012c('0x1a')]('{TENANT_ID}',_0x52ed29[_0x012c('0x1b')]);var _0x3f2a1e=['code',_0x012c('0x1c')];var _0xf6f329=Buffer[_0x012c('0x1d')](JSON[_0x012c('0x1e')]({'id':_0x1048e4}))[_0x012c('0x1f')](_0x012c('0x20'));var _0x393fcf=crypto['randomBytes'](0x10)[_0x012c('0x1f')]('hex');var _0x3f87a5=getAuthorizationScopes(_0x52ed29);var _0x2d3f9b=[{'key':'client_id','value':_0x52ed29[_0x012c('0x21')]},{'key':_0x012c('0x22'),'value':encodeURIComponent(_0x3f2a1e[_0x012c('0x23')]('\x20'))},{'key':_0x012c('0x24'),'value':_0x52ed29[_0x012c('0x25')]},{'key':_0x012c('0x26'),'value':_0x012c('0x27')},{'key':'scope','value':encodeURIComponent(_0x3f87a5)},{'key':_0x012c('0x28'),'value':_0xf6f329},{'key':_0x012c('0x29'),'value':_0x393fcf},{'key':_0x012c('0x2a'),'value':_0x012c('0x2b')}];var _0x1e8620=_0x97584a+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x2d3f9b,function(_0x300f2f){return _0x300f2f[_0x012c('0x2c')]+'='+_0x300f2f[_0x012c('0x2d')];})[_0x012c('0x23')]('&');_0x52ed29[_0x012c('0x2e')]={'issuer':_0x97584a[_0x012c('0x1a')](_0x012c('0x2f'),''),'audience':_0x52ed29['data1'],'state':_0xf6f329,'nonce':_0x393fcf};redis[_0x012c('0x30')](_0xf6f329,JSON[_0x012c('0x1e')](_0x52ed29));return _0x1e8620;}function isValidIdToken(_0x313eae,_0xcc0661){try{var _0x44d241=jwt['decode'](_0x313eae,{'complete':!![]});var _0x36dcde=_0x44d241['payload'];if(_0x36dcde['iss']!==_0xcc0661['issuer'])return![];if(_0x36dcde[_0x012c('0x31')]!==_0xcc0661[_0x012c('0x32')])return![];if(_0x36dcde[_0x012c('0x29')]!==_0xcc0661[_0x012c('0x29')])return![];if(moment()[_0x012c('0x33')](moment[_0x012c('0x34')](_0x36dcde[_0x012c('0x35')])))return![];return!![];}catch(_0x48fce8){throw _0x48fce8;}}function refreshOauth2MicrosoftAccessToken(_0x385b71){return Promise[_0x012c('0x36')]()['then'](function(){if(_0x385b71[_0x012c('0x37')])return _0x385b71;return db['CloudProvider'][_0x012c('0x38')]({'where':{'id':_0x385b71['id']},'raw':!![]});})[_0x012c('0x39')](function(_0x34b221){var _0x15e998={'grant_type':_0x012c('0x3a'),'refresh_token':_0x34b221['data6'],'scope':getAccessTokenScope(_0x34b221),'redirect_uri':_0x34b221['data4'],'client_id':_0x34b221[_0x012c('0x21')],'client_secret':encryptor[_0x012c('0x3b')](_0x34b221['data3'])};var _0x4da511={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x012c('0x3c'),_0x34b221[_0x012c('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x15e998,'json':!![]};return rp(_0x4da511);})[_0x012c('0x39')](function(_0xeda1c6){_0x385b71[_0x012c('0x3d')]=_0xeda1c6[_0x012c('0x3e')];_0x385b71['data6']=_0xeda1c6[_0x012c('0x3a')];return db['CloudProvider'][_0x012c('0x3f')]({'data5':_0x385b71[_0x012c('0x3d')],'data6':_0x385b71[_0x012c('0x40')]},{'where':{'id':_0x385b71['id']}});})[_0x012c('0x39')](function(){return _0x385b71;})[_0x012c('0x41')](function(_0x15a84c){logger[_0x012c('0x42')](_0x012c('0x43'),_0x385b71['id'],_0x15a84c);});}function getOauth2MicrosoftAccessToken(_0x572d6f,_0x3616c5){var _0x4136ea={'grant_type':'authorization_code','code':_0x572d6f,'scope':getAccessTokenScope(_0x3616c5),'redirect_uri':_0x3616c5['data4'],'client_id':_0x3616c5[_0x012c('0x21')],'client_secret':encryptor[_0x012c('0x3b')](_0x3616c5[_0x012c('0x37')])};var _0x4a3489={'method':_0x012c('0x44'),'uri':MICROSOFT_AUTH_URL[_0x012c('0x1a')](_0x012c('0x3c'),_0x3616c5['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4136ea,'json':!![]};return rp(_0x4a3489);}function startRefreshInterval(_0x1a140f){var _0x4f7101=schedule[_0x012c('0x45')];if(_0x4f7101[_0x1a140f['id']])clearInterval(_0x4f7101[_0x1a140f['id']]);_0x4f7101[_0x1a140f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x012c('0x46')](this,{'id':_0x1a140f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x012c('0x45')]=_0x4f7101;}function startAllRefreshIntervals(){return db[_0x012c('0x47')][_0x012c('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x012c('0x39')](function(_0x402007){var _0x168871=_0x402007[_0x012c('0x14')](function(_0x42f3b0){return refreshOauth2MicrosoftAccessToken(_0x42f3b0)[_0x012c('0x39')](function(_0x58bf2b){startRefreshInterval(_0x58bf2b);});});return Promise[_0x012c('0x49')](_0x168871);})[_0x012c('0x41')](function(_0x18cb06){var _0x56c7ee=_0x18cb06?util[_0x012c('0x4a')](_0x18cb06,{'showHidden':![],'depth':null}):'';logger[_0x012c('0x42')](_0x012c('0x4b'),_0x56c7ee);});}module[_0x012c('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x738b=['value','oauth2Claims','oauth2/','decode','payload','iss','aud','unix','exp','resolve','then','CloudProvider','data6','data1','decryptString','POST','replace','data5','access_token','refresh_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data3','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','type','Dynamics365','/.default','join','Outlook365','data7','{TENANT_ID}','data2','code','from','stringify','toString','base64','randomBytes','response_type','redirect_uri','data4','response_mode','state','nonce','prompt','login','map','key'];(function(_0x2278d4,_0x3ebf8e){var _0x25f2ee=function(_0x5a54a8){while(--_0x5a54a8){_0x2278d4['push'](_0x2278d4['shift']());}};_0x25f2ee(++_0x3ebf8e);}(_0x738b,0x192));var _0xb738=function(_0xacdaf2,_0x4ac4d5){_0xacdaf2=_0xacdaf2-0x0;var _0x6c4568=_0x738b[_0xacdaf2];return _0x6c4568;};'use strict';var _=require('lodash');var crypto=require(_0xb738('0x0'));var jwt=require(_0xb738('0x1'));var moment=require(_0xb738('0x2'));var Redis=require('ioredis');var rp=require(_0xb738('0x3'));var util=require(_0xb738('0x4'));var encryptor=require(_0xb738('0x5'));var config=require(_0xb738('0x6'));var logger=require('../../config/logger')(_0xb738('0x7'));var schedule=require(_0xb738('0x8'));var db=require('../../mysqldb')['db'];config[_0xb738('0x9')]=_['defaults'](config['redis'],{'host':_0xb738('0xa'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xb738('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0xb738('0xc'),_0xb738('0xd'),_0xb738('0xe'),'offline_access',_0xb738('0xf'),'https://outlook.office.com/POP.AccessAsUser.All',_0xb738('0x10')],'Dynamics365':[_0xb738('0xc'),_0xb738('0x11')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5928de){var _0x4f13ef=_['map'](AZURE_AUTH_SCOPES[_0x5928de[_0xb738('0x12')]]);if(_0x5928de[_0xb738('0x12')]===_0xb738('0x13'))_0x4f13ef['push'](_0x5928de['data7']+_0xb738('0x14'));return _0x4f13ef[_0xb738('0x15')]('\x20');}function getAccessTokenScope(_0xc54b5e){if(_0xc54b5e['type']===_0xb738('0x16'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0xc54b5e['type']===_0xb738('0x13'))return _0xc54b5e[_0xb738('0x17')]+_0xb738('0x14');}function generateMicrosoftAuthorizationUrl(_0x2fbf41,_0x206067){var _0x2e9c19=MICROSOFT_AUTH_URL['replace'](_0xb738('0x18'),_0x2fbf41[_0xb738('0x19')]);var _0x2cc462=[_0xb738('0x1a'),'id_token'];var _0x2cc5fd=Buffer[_0xb738('0x1b')](JSON[_0xb738('0x1c')]({'id':_0x206067}))[_0xb738('0x1d')](_0xb738('0x1e'));var _0x22074d=crypto[_0xb738('0x1f')](0x10)['toString']('hex');var _0x21dea1=getAuthorizationScopes(_0x2fbf41);var _0x496623=[{'key':'client_id','value':_0x2fbf41['data1']},{'key':_0xb738('0x20'),'value':encodeURIComponent(_0x2cc462[_0xb738('0x15')]('\x20'))},{'key':_0xb738('0x21'),'value':_0x2fbf41[_0xb738('0x22')]},{'key':_0xb738('0x23'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x21dea1)},{'key':_0xb738('0x24'),'value':_0x2cc5fd},{'key':_0xb738('0x25'),'value':_0x22074d},{'key':_0xb738('0x26'),'value':_0xb738('0x27')}];var _0x2cf99d=_0x2e9c19+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb738('0x28')](_0x496623,function(_0x2a5f29){return _0x2a5f29[_0xb738('0x29')]+'='+_0x2a5f29[_0xb738('0x2a')];})[_0xb738('0x15')]('&');_0x2fbf41[_0xb738('0x2b')]={'issuer':_0x2e9c19['replace'](_0xb738('0x2c'),''),'audience':_0x2fbf41['data1'],'state':_0x2cc5fd,'nonce':_0x22074d};redis['set'](_0x2cc5fd,JSON[_0xb738('0x1c')](_0x2fbf41));return _0x2cf99d;}function isValidIdToken(_0x8829f9,_0x34cf78){try{var _0x5357f9=jwt[_0xb738('0x2d')](_0x8829f9,{'complete':!![]});var _0x18fb02=_0x5357f9[_0xb738('0x2e')];if(_0x18fb02[_0xb738('0x2f')]!==_0x34cf78['issuer'])return![];if(_0x18fb02[_0xb738('0x30')]!==_0x34cf78['audience'])return![];if(_0x18fb02[_0xb738('0x25')]!==_0x34cf78[_0xb738('0x25')])return![];if(moment()['isAfter'](moment[_0xb738('0x31')](_0x18fb02[_0xb738('0x32')])))return![];return!![];}catch(_0x4f8df4){throw _0x4f8df4;}}function refreshOauth2MicrosoftAccessToken(_0x2607ad){return Promise[_0xb738('0x33')]()[_0xb738('0x34')](function(){if(_0x2607ad['data3'])return _0x2607ad;return db[_0xb738('0x35')]['findOne']({'where':{'id':_0x2607ad['id']},'raw':!![]});})['then'](function(_0x9e4214){var _0x1434ea={'grant_type':'refresh_token','refresh_token':_0x9e4214[_0xb738('0x36')],'scope':getAccessTokenScope(_0x9e4214),'redirect_uri':_0x9e4214['data4'],'client_id':_0x9e4214[_0xb738('0x37')],'client_secret':encryptor[_0xb738('0x38')](_0x9e4214['data3'])};var _0xca50cd={'method':_0xb738('0x39'),'uri':MICROSOFT_AUTH_URL[_0xb738('0x3a')](_0xb738('0x18'),_0x9e4214['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1434ea,'json':!![]};return rp(_0xca50cd);})[_0xb738('0x34')](function(_0x481a85){_0x2607ad[_0xb738('0x3b')]=_0x481a85[_0xb738('0x3c')];_0x2607ad['data6']=_0x481a85[_0xb738('0x3d')];return db[_0xb738('0x35')][_0xb738('0x3e')]({'data5':_0x2607ad[_0xb738('0x3b')],'data6':_0x2607ad[_0xb738('0x36')]},{'where':{'id':_0x2607ad['id']}});})[_0xb738('0x34')](function(){return _0x2607ad;})[_0xb738('0x3f')](function(_0x39989e){logger[_0xb738('0x40')](_0xb738('0x41'),_0x2607ad['id'],_0x39989e);});}function getOauth2MicrosoftAccessToken(_0x5d0adb,_0x4f1f8f){var _0xf21d29={'grant_type':_0xb738('0x42'),'code':_0x5d0adb,'scope':getAccessTokenScope(_0x4f1f8f),'redirect_uri':_0x4f1f8f[_0xb738('0x22')],'client_id':_0x4f1f8f[_0xb738('0x37')],'client_secret':encryptor[_0xb738('0x38')](_0x4f1f8f[_0xb738('0x43')])};var _0x5eb069={'method':_0xb738('0x39'),'uri':MICROSOFT_AUTH_URL[_0xb738('0x3a')]('{TENANT_ID}',_0x4f1f8f['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xf21d29,'json':!![]};return rp(_0x5eb069);}function startRefreshInterval(_0xa9d2bd){var _0x56b1d5=schedule[_0xb738('0x44')];if(_0x56b1d5[_0xa9d2bd['id']])clearInterval(_0x56b1d5[_0xa9d2bd['id']]);_0x56b1d5[_0xa9d2bd['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xb738('0x45')](this,{'id':_0xa9d2bd['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb738('0x44')]=_0x56b1d5;}function startAllRefreshIntervals(){return db[_0xb738('0x35')][_0xb738('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb738('0x34')](function(_0x5f732f){var _0x5627f3=_0x5f732f[_0xb738('0x28')](function(_0x59b7ab){return refreshOauth2MicrosoftAccessToken(_0x59b7ab)[_0xb738('0x34')](function(_0x55d067){startRefreshInterval(_0x55d067);});});return Promise[_0xb738('0x47')](_0x5627f3);})['catch'](function(_0x3b994c){var _0x2485f9=_0x3b994c?util[_0xb738('0x48')](_0x3b994c,{'showHidden':![],'depth':null}):'';logger[_0xb738('0x40')](_0xb738('0x49'),_0x2485f9);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index b5cdb0b..ca157bd 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 _0xa809=['error','message','info','result','catch','util','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x224ad4,_0x4db500){var _0x22a5d9=function(_0x233515){while(--_0x233515){_0x224ad4['push'](_0x224ad4['shift']());}};_0x22a5d9(++_0x4db500);}(_0xa809,0x1f3));var _0x9a80=function(_0x1d070d,_0x44b1dc){_0x1d070d=_0x1d070d-0x0;var _0x150d9f=_0xa809[_0x1d070d];return _0x150d9f;};'use strict';var _=require('lodash');var util=require(_0x9a80('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a80('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9a80('0x2'))(_0x9a80('0x3'));var config=require(_0x9a80('0x4'));var jayson=require(_0x9a80('0x5'));var client=jayson['client'][_0x9a80('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x504ba8,_0x17b704,_0x286ac5){return new BPromise(function(_0x4ea507,_0x1ef67a){return client[_0x9a80('0x7')](_0x504ba8,_0x286ac5)[_0x9a80('0x8')](function(_0x269ee2){logger['info'](_0x9a80('0x9'),_0x17b704,_0x9a80('0xa'));logger[_0x9a80('0xb')](_0x9a80('0xc'),_0x17b704,_0x9a80('0xa'),JSON[_0x9a80('0xd')](_0x269ee2));if(_0x269ee2[_0x9a80('0xe')]){if(_0x269ee2[_0x9a80('0xe')]['code']===0x1f4){logger[_0x9a80('0xe')](_0x9a80('0x9'),_0x17b704,_0x269ee2[_0x9a80('0xe')][_0x9a80('0xf')]);return _0x1ef67a(_0x269ee2[_0x9a80('0xe')][_0x9a80('0xf')]);}logger[_0x9a80('0xe')](_0x9a80('0x9'),_0x17b704,_0x269ee2['error'][_0x9a80('0xf')]);return _0x4ea507(_0x269ee2['error'][_0x9a80('0xf')]);}else{logger[_0x9a80('0x10')](_0x9a80('0x9'),_0x17b704,'request\x20sent');_0x4ea507(_0x269ee2[_0x9a80('0x11')][_0x9a80('0xf')]);}})[_0x9a80('0x12')](function(_0x12ecee){logger[_0x9a80('0xe')]('CloudProvider,\x20%s,\x20%s',_0x17b704,_0x12ecee);_0x1ef67a(_0x12ecee);});});} \ No newline at end of file +var _0x3d45=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','then','info','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x1174a4,_0x53e376){var _0x26e5e0=function(_0x26acc2){while(--_0x26acc2){_0x1174a4['push'](_0x1174a4['shift']());}};_0x26e5e0(++_0x53e376);}(_0x3d45,0x1d2));var _0x53d4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d45[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x53d4('0x0'));var util=require(_0x53d4('0x1'));var moment=require(_0x53d4('0x2'));var BPromise=require(_0x53d4('0x3'));var rs=require(_0x53d4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53d4('0x5'))['db'];var utils=require(_0x53d4('0x6'));var logger=require('../../config/logger')(_0x53d4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x235ee0,_0xbfffb2,_0x2c7029){return new BPromise(function(_0xdbf204,_0x39ff2a){return client['request'](_0x235ee0,_0x2c7029)[_0x53d4('0x8')](function(_0x20b209){logger[_0x53d4('0x9')]('CloudProvider,\x20%s,\x20%s',_0xbfffb2,_0x53d4('0xa'));logger['debug'](_0x53d4('0xb'),_0xbfffb2,_0x53d4('0xa'),JSON[_0x53d4('0xc')](_0x20b209));if(_0x20b209[_0x53d4('0xd')]){if(_0x20b209[_0x53d4('0xd')]['code']===0x1f4){logger[_0x53d4('0xd')](_0x53d4('0xe'),_0xbfffb2,_0x20b209[_0x53d4('0xd')]['message']);return _0x39ff2a(_0x20b209[_0x53d4('0xd')][_0x53d4('0xf')]);}logger['error'](_0x53d4('0xe'),_0xbfffb2,_0x20b209['error'][_0x53d4('0xf')]);return _0xdbf204(_0x20b209[_0x53d4('0xd')][_0x53d4('0xf')]);}else{logger['info'](_0x53d4('0xe'),_0xbfffb2,_0x53d4('0xa'));_0xdbf204(_0x20b209[_0x53d4('0x10')][_0x53d4('0xf')]);}})[_0x53d4('0x11')](function(_0x503259){logger[_0x53d4('0xd')](_0x53d4('0xe'),_0xbfffb2,_0x503259);_0x39ff2a(_0x503259);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index bcb5a44..a73932d 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(_0x56c70f,_0x4e4493){var _0x3812ed=function(_0x25460f){while(--_0x25460f){_0x56c70f['push'](_0x56c70f['shift']());}};_0x3812ed(++_0x4e4493);}(_0x1261,0x144));var _0x1126=function(_0x2dd976,_0x1b5dc4){_0x2dd976=_0x2dd976-0x0;var _0x2265fd=_0x1261[_0x2dd976];return _0x2265fd;};'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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x483102,_0x54e93d){var _0x5cc885=function(_0x54931c){while(--_0x54931c){_0x483102['push'](_0x483102['shift']());}};_0x5cc885(++_0x54e93d);}(_0x1261,0x144));var _0x1126=function(_0x35021f,_0x451349){_0x35021f=_0x35021f-0x0;var _0x1044e9=_0x1261[_0x35021f];return _0x1044e9;};'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 diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index c5304f1..8e0d596 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 _0x605c=['exports','STRING','name','sequelize'];(function(_0x3f0fa8,_0x5173be){var _0x51a920=function(_0x52f0f6){while(--_0x52f0f6){_0x3f0fa8['push'](_0x3f0fa8['shift']());}};_0x51a920(++_0x5173be);}(_0x605c,0x1db));var _0xc605=function(_0x1e0c05,_0x2f76dc){_0x1e0c05=_0x1e0c05-0x0;var _0x423b89=_0x605c[_0x1e0c05];return _0x423b89;};'use strict';var Sequelize=require(_0xc605('0x0'));module[_0xc605('0x1')]={'name':{'type':Sequelize[_0xc605('0x2')],'unique':_0xc605('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc605('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xc605('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xc605('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xc605('0x2')]},'postalCode':{'type':Sequelize[_0xc605('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xc605('0x2')]},'email':{'type':Sequelize[_0xc605('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xc605('0x2')]},'sCity':{'type':Sequelize[_0xc605('0x2')]},'sCountry':{'type':Sequelize[_0xc605('0x2')]},'description':{'type':Sequelize[_0xc605('0x2')]}}; \ No newline at end of file +var _0xb0ff=['STRING','exports'];(function(_0x408a76,_0x24dbb4){var _0x19f1bc=function(_0x58fa79){while(--_0x58fa79){_0x408a76['push'](_0x408a76['shift']());}};_0x19f1bc(++_0x24dbb4);}(_0xb0ff,0xb3));var _0xfb0f=function(_0x247cb3,_0x4e54f9){_0x247cb3=_0x247cb3-0x0;var _0x537741=_0xb0ff[_0x247cb3];return _0x537741;};'use strict';var Sequelize=require('sequelize');module[_0xfb0f('0x0')]={'name':{'type':Sequelize[_0xfb0f('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xfb0f('0x1')]},'companyId':{'type':Sequelize[_0xfb0f('0x1')]},'website':{'type':Sequelize[_0xfb0f('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xfb0f('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xfb0f('0x1')]},'postalCode':{'type':Sequelize[_0xfb0f('0x1')]},'city':{'type':Sequelize[_0xfb0f('0x1')]},'country':{'type':Sequelize[_0xfb0f('0x1')]},'email':{'type':Sequelize[_0xfb0f('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xfb0f('0x1')]},'sStreet':{'type':Sequelize[_0xfb0f('0x1')]},'sPostalCode':{'type':Sequelize[_0xfb0f('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xfb0f('0x1')]},'description':{'type':Sequelize[_0xfb0f('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index bfd6c1d..97c6d6d 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 _0xfe44=['limit','count','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','describe','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','offset','sort','pick','merge','where','options','include','CmCompany','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','user','role','Companies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','order','filter','map','getContacts','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined'];(function(_0x134832,_0x4ec0f2){var _0x603c62=function(_0x4ae9f1){while(--_0x4ae9f1){_0x134832['push'](_0x134832['shift']());}};_0x603c62(++_0x4ec0f2);}(_0xfe44,0xf0));var _0x4fe4=function(_0x2f263c,_0x19cf6d){_0x2f263c=_0x2f263c-0x0;var _0x203e23=_0xfe44[_0x2f263c];return _0x203e23;};'use strict';var emlformat=require(_0x4fe4('0x0'));var rimraf=require(_0x4fe4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4fe4('0x2'));var rp=require(_0x4fe4('0x3'));var moment=require(_0x4fe4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4fe4('0x5'));var util=require(_0x4fe4('0x6'));var path=require(_0x4fe4('0x7'));var sox=require(_0x4fe4('0x8'));var csv=require('to-csv');var ejs=require(_0x4fe4('0x9'));var fs=require('fs');var fs_extra=require(_0x4fe4('0xa'));var _=require(_0x4fe4('0xb'));var squel=require(_0x4fe4('0xc'));var crypto=require('crypto');var jsforce=require(_0x4fe4('0xd'));var deskjs=require(_0x4fe4('0xe'));var toCsv=require(_0x4fe4('0xf'));var querystring=require(_0x4fe4('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4fe4('0x11'));var qs=require(_0x4fe4('0x12'));var as=require(_0x4fe4('0x13'));var hardwareService=require(_0x4fe4('0x14'));var logger=require(_0x4fe4('0x15'))('api');var utils=require(_0x4fe4('0x16'));var config=require(_0x4fe4('0x17'));var licenseUtil=require(_0x4fe4('0x18'));var db=require(_0x4fe4('0x19'))['db'];function respondWithStatusCode(_0x2316e9,_0x739028){_0x739028=_0x739028||0xcc;return function(_0x50fe0f){if(_0x50fe0f){return _0x2316e9['sendStatus'](_0x739028);}return _0x2316e9[_0x4fe4('0x1a')](_0x739028)[_0x4fe4('0x1b')]();};}function respondWithResult(_0x3b6689,_0x1981be){_0x1981be=_0x1981be||0xc8;return function(_0x2598ac){if(_0x2598ac){return _0x3b6689[_0x4fe4('0x1a')](_0x1981be)[_0x4fe4('0x1c')](_0x2598ac);}};}function respondWithFilteredResult(_0x512cec,_0x317ff8){return function(_0x38b701){if(_0x38b701){var _0x322f50=typeof _0x317ff8['offset']===_0x4fe4('0x1d')&&typeof _0x317ff8[_0x4fe4('0x1e')]===_0x4fe4('0x1d');var _0x511c53=_0x38b701[_0x4fe4('0x1f')];var _0x345a1e=_0x322f50?0x0:_0x317ff8['offset'];var _0x18efb6=_0x322f50?_0x38b701['count']:_0x317ff8['offset']+_0x317ff8['limit'];var _0x5b9edf;if(_0x18efb6>=_0x511c53){_0x18efb6=_0x511c53;_0x5b9edf=0xc8;}else{_0x5b9edf=0xce;}_0x512cec[_0x4fe4('0x1a')](_0x5b9edf);return _0x512cec[_0x4fe4('0x20')](_0x4fe4('0x21'),_0x345a1e+'-'+_0x18efb6+'/'+_0x511c53)[_0x4fe4('0x1c')](_0x38b701);}return null;};}function patchUpdates(_0x52dc78){return function(_0x1bd1fd){try{jsonpatch[_0x4fe4('0x22')](_0x1bd1fd,_0x52dc78,!![]);}catch(_0x4b69e6){return BPromise['reject'](_0x4b69e6);}return _0x1bd1fd[_0x4fe4('0x23')]();};}function saveUpdates(_0x247a19,_0x17f100){return function(_0xd7b20d){if(_0xd7b20d){return _0xd7b20d[_0x4fe4('0x24')](_0x247a19)[_0x4fe4('0x25')](function(_0x4666ce){return _0x4666ce;});}return null;};}function removeEntity(_0x2db868,_0x9b3f82){return function(_0x256fcd){if(_0x256fcd){return _0x256fcd['destroy']()['then'](function(){var _0x2fc31f=_0x256fcd[_0x4fe4('0x26')]({'plain':!![]});var _0x352656='Companies';return db[_0x4fe4('0x27')][_0x4fe4('0x28')]({'where':{'type':_0x352656,'resourceId':_0x2fc31f['id']}})[_0x4fe4('0x25')](function(){return _0x256fcd;});})[_0x4fe4('0x25')](function(){_0x2db868['status'](0xcc)[_0x4fe4('0x1b')]();});}};}function handleEntityNotFound(_0x552f00,_0xd65cb0){return function(_0x3b34c2){if(!_0x3b34c2){_0x552f00[_0x4fe4('0x29')](0x194);}return _0x3b34c2;};}function handleError(_0x1880f6,_0xa52cc6){_0xa52cc6=_0xa52cc6||0x1f4;return function(_0x315e9c){logger[_0x4fe4('0x2a')](_0x315e9c[_0x4fe4('0x2b')]);if(_0x315e9c[_0x4fe4('0x2c')]){delete _0x315e9c['name'];}_0x1880f6[_0x4fe4('0x1a')](_0xa52cc6)[_0x4fe4('0x2d')](_0x315e9c);};}exports[_0x4fe4('0x2e')]=function(_0x4f95d1,_0x5cf1ab){var _0x40247d={},_0x2a30ce={},_0x519fc8={'count':0x0,'rows':[]};return db['CmCompany'][_0x4fe4('0x2f')]()[_0x4fe4('0x25')](function(_0x50c0d8){_0x2a30ce[_0x4fe4('0x30')]=_[_0x4fe4('0x31')](_0x50c0d8);_0x2a30ce[_0x4fe4('0x32')]=_[_0x4fe4('0x31')](_0x4f95d1[_0x4fe4('0x32')]);_0x2a30ce[_0x4fe4('0x33')]=_['intersection'](_0x2a30ce[_0x4fe4('0x30')],_0x2a30ce[_0x4fe4('0x32')]);_0x40247d[_0x4fe4('0x34')]=_[_0x4fe4('0x35')](_0x2a30ce['model'],qs[_0x4fe4('0x36')](_0x4f95d1[_0x4fe4('0x32')][_0x4fe4('0x36')]));_0x40247d[_0x4fe4('0x34')]=_0x40247d[_0x4fe4('0x34')]['length']?_0x40247d[_0x4fe4('0x34')]:_0x2a30ce[_0x4fe4('0x30')];if(!_0x4f95d1[_0x4fe4('0x32')][_0x4fe4('0x37')](_0x4fe4('0x38'))){_0x40247d['limit']=qs[_0x4fe4('0x1e')](_0x4f95d1[_0x4fe4('0x32')][_0x4fe4('0x1e')]);_0x40247d[_0x4fe4('0x39')]=qs['offset'](_0x4f95d1[_0x4fe4('0x32')]['offset']);}_0x40247d['order']=qs[_0x4fe4('0x3a')](_0x4f95d1[_0x4fe4('0x32')]['sort']);_0x40247d['where']=qs[_0x4fe4('0x33')](_[_0x4fe4('0x3b')](_0x4f95d1[_0x4fe4('0x32')],_0x2a30ce[_0x4fe4('0x33')]),_0x50c0d8);if(_0x4f95d1['query']['filter']){_0x40247d['where']=_[_0x4fe4('0x3c')](_0x40247d[_0x4fe4('0x3d')],{'$or':_['map'](_0x40247d[_0x4fe4('0x34')],function(_0x3c080d){var _0x2fe4c6={};_0x2fe4c6[_0x3c080d]={'$like':'%'+_0x4f95d1[_0x4fe4('0x32')]['filter']+'%'};return _0x2fe4c6;})});}_0x40247d=_[_0x4fe4('0x3c')]({},_0x40247d,_0x4f95d1[_0x4fe4('0x3e')]);var _0x5120da={'where':_0x40247d[_0x4fe4('0x3d')]};return db['CmCompany'][_0x4fe4('0x1f')](_0x5120da)['then'](function(_0x2ff17b){_0x519fc8[_0x4fe4('0x1f')]=_0x2ff17b;if(_0x4f95d1[_0x4fe4('0x32')]['includeAll']){_0x40247d[_0x4fe4('0x3f')]=[{'all':!![]}];}return db[_0x4fe4('0x40')][_0x4fe4('0x41')](_0x40247d);})[_0x4fe4('0x25')](function(_0x3ad85e){_0x519fc8[_0x4fe4('0x42')]=_0x3ad85e;return _0x519fc8;})[_0x4fe4('0x25')](respondWithFilteredResult(_0x5cf1ab,_0x40247d))[_0x4fe4('0x43')](handleError(_0x5cf1ab,null));})[_0x4fe4('0x43')](handleError(_0x5cf1ab,null));};exports[_0x4fe4('0x44')]=function(_0x39a04b,_0x346127){var _0x5ab324={'raw':![],'where':{'id':_0x39a04b[_0x4fe4('0x45')]['id']}},_0x1e9b0d={};_0x1e9b0d[_0x4fe4('0x30')]=_['keys'](db[_0x4fe4('0x40')][_0x4fe4('0x46')]);_0x1e9b0d[_0x4fe4('0x32')]=_[_0x4fe4('0x31')](_0x39a04b[_0x4fe4('0x32')]);_0x1e9b0d[_0x4fe4('0x33')]=_[_0x4fe4('0x35')](_0x1e9b0d[_0x4fe4('0x30')],_0x1e9b0d['query']);_0x5ab324['attributes']=_[_0x4fe4('0x35')](_0x1e9b0d[_0x4fe4('0x30')],qs[_0x4fe4('0x36')](_0x39a04b[_0x4fe4('0x32')]['fields']));_0x5ab324[_0x4fe4('0x34')]=_0x5ab324[_0x4fe4('0x34')][_0x4fe4('0x47')]?_0x5ab324['attributes']:_0x1e9b0d[_0x4fe4('0x30')];if(_0x39a04b[_0x4fe4('0x32')][_0x4fe4('0x48')]){_0x5ab324[_0x4fe4('0x3f')]=[{'all':!![]}];}_0x5ab324=_[_0x4fe4('0x3c')]({},_0x5ab324,_0x39a04b[_0x4fe4('0x3e')]);return db[_0x4fe4('0x40')][_0x4fe4('0x49')](_0x5ab324)[_0x4fe4('0x25')](handleEntityNotFound(_0x346127,null))['then'](respondWithResult(_0x346127,null))[_0x4fe4('0x43')](handleError(_0x346127,null));};exports[_0x4fe4('0x4a')]=function(_0x56783c,_0x35b6cd){return db[_0x4fe4('0x40')][_0x4fe4('0x4a')](_0x56783c[_0x4fe4('0x4b')],{})[_0x4fe4('0x25')](function(_0x545202){var _0x57ad3e=_0x56783c[_0x4fe4('0x4c')][_0x4fe4('0x26')]({'plain':!![]});if(!_0x57ad3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57ad3e[_0x4fe4('0x4d')]===_0x4fe4('0x4c')){var _0x1441c7=_0x545202[_0x4fe4('0x26')]({'plain':!![]});var _0x4c6c86=_0x4fe4('0x4e');return db[_0x4fe4('0x4f')][_0x4fe4('0x49')]({'where':{'name':_0x4c6c86,'userProfileId':_0x57ad3e[_0x4fe4('0x50')]},'raw':!![]})[_0x4fe4('0x25')](function(_0x5124c1){if(_0x5124c1&&_0x5124c1['autoAssociation']===0x0){return db[_0x4fe4('0x27')]['create']({'name':_0x1441c7['name'],'resourceId':_0x1441c7['id'],'type':_0x5124c1[_0x4fe4('0x2c')],'sectionId':_0x5124c1['id']},{})[_0x4fe4('0x25')](function(){return _0x545202;});}else{return _0x545202;}})[_0x4fe4('0x43')](function(_0x4c5385){logger[_0x4fe4('0x2a')](_0x4fe4('0x51'),_0x4c5385);throw _0x4c5385;});}return _0x545202;})[_0x4fe4('0x25')](respondWithResult(_0x35b6cd,0xc9))['catch'](handleError(_0x35b6cd,null));};exports[_0x4fe4('0x24')]=function(_0xe968f9,_0x11b20e){if(_0xe968f9[_0x4fe4('0x4b')]['id']){delete _0xe968f9[_0x4fe4('0x4b')]['id'];}return db[_0x4fe4('0x40')][_0x4fe4('0x49')]({'where':{'id':_0xe968f9[_0x4fe4('0x45')]['id']}})['then'](handleEntityNotFound(_0x11b20e,null))['then'](saveUpdates(_0xe968f9['body'],null))[_0x4fe4('0x25')](respondWithResult(_0x11b20e,null))[_0x4fe4('0x43')](handleError(_0x11b20e,null));};exports[_0x4fe4('0x28')]=function(_0x42ad1e,_0x4ef8cb){return db[_0x4fe4('0x40')]['find']({'where':{'id':_0x42ad1e[_0x4fe4('0x45')]['id']}})[_0x4fe4('0x25')](handleEntityNotFound(_0x4ef8cb,null))[_0x4fe4('0x25')](removeEntity(_0x4ef8cb,null))[_0x4fe4('0x43')](handleError(_0x4ef8cb,null));};exports[_0x4fe4('0x2f')]=function(_0x1a4472,_0x523871){return db[_0x4fe4('0x40')][_0x4fe4('0x2f')]()[_0x4fe4('0x25')](respondWithResult(_0x523871,null))[_0x4fe4('0x43')](handleError(_0x523871,null));};exports[_0x4fe4('0x52')]=function(_0x7d21cf,_0x37111e,_0x36e091){return db[_0x4fe4('0x53')][_0x4fe4('0x49')]({'where':{'id':_0x7d21cf[_0x4fe4('0x45')]['id']}})[_0x4fe4('0x25')](handleEntityNotFound(_0x37111e,null))[_0x4fe4('0x25')](function(_0x1fc911){if(_0x1fc911){return _0x1fc911[_0x4fe4('0x52')](_0x7d21cf[_0x4fe4('0x4b')][_0x4fe4('0x54')],_[_0x4fe4('0x55')](_0x7d21cf[_0x4fe4('0x4b')],[_0x4fe4('0x54'),'id'])||{});}})['then'](respondWithResult(_0x37111e,null))[_0x4fe4('0x43')](handleError(_0x37111e,null));};exports['getContacts']=function(_0x24cfe3,_0x41ebe1,_0x1a5895){var _0x28ab1c={};var _0x25a2d0={};var _0x4b42a4;var _0x36eef8;return db[_0x4fe4('0x40')]['findOne']({'where':{'id':_0x24cfe3[_0x4fe4('0x45')]['id']}})[_0x4fe4('0x25')](handleEntityNotFound(_0x41ebe1,null))['then'](function(_0x2cbba1){if(_0x2cbba1){_0x4b42a4=_0x2cbba1;_0x25a2d0[_0x4fe4('0x30')]=_['keys'](db[_0x4fe4('0x53')][_0x4fe4('0x46')]);_0x25a2d0[_0x4fe4('0x32')]=_['keys'](_0x24cfe3[_0x4fe4('0x32')]);_0x25a2d0[_0x4fe4('0x33')]=_[_0x4fe4('0x35')](_0x25a2d0[_0x4fe4('0x30')],_0x25a2d0[_0x4fe4('0x32')]);_0x28ab1c[_0x4fe4('0x34')]=_[_0x4fe4('0x35')](_0x25a2d0[_0x4fe4('0x30')],qs[_0x4fe4('0x36')](_0x24cfe3[_0x4fe4('0x32')][_0x4fe4('0x36')]));_0x28ab1c['attributes']=_0x28ab1c[_0x4fe4('0x34')][_0x4fe4('0x47')]?_0x28ab1c[_0x4fe4('0x34')]:_0x25a2d0['model'];_0x28ab1c[_0x4fe4('0x56')]=qs[_0x4fe4('0x3a')](_0x24cfe3[_0x4fe4('0x32')][_0x4fe4('0x3a')]);_0x28ab1c['where']=qs[_0x4fe4('0x33')](_[_0x4fe4('0x3b')](_0x24cfe3['query'],_0x25a2d0[_0x4fe4('0x33')]));if(_0x24cfe3[_0x4fe4('0x32')][_0x4fe4('0x57')]){_0x28ab1c['where']=_['merge'](_0x28ab1c[_0x4fe4('0x3d')],{'$or':_[_0x4fe4('0x58')](_0x28ab1c['attributes'],function(_0x45c47b){var _0x20e538={};_0x20e538[_0x45c47b]={'$like':'%'+_0x24cfe3[_0x4fe4('0x32')][_0x4fe4('0x57')]+'%'};return _0x20e538;})});}_0x28ab1c=_['merge']({},_0x28ab1c,_0x24cfe3[_0x4fe4('0x3e')]);return _0x4b42a4[_0x4fe4('0x59')](_0x28ab1c);}})['then'](function(_0x10ceb3){if(_0x10ceb3){_0x36eef8=_0x10ceb3[_0x4fe4('0x47')];if(!_0x24cfe3[_0x4fe4('0x32')][_0x4fe4('0x37')](_0x4fe4('0x38'))){_0x28ab1c[_0x4fe4('0x1e')]=qs['limit'](_0x24cfe3[_0x4fe4('0x32')][_0x4fe4('0x1e')]);_0x28ab1c[_0x4fe4('0x39')]=qs[_0x4fe4('0x39')](_0x24cfe3['query'][_0x4fe4('0x39')]);}return _0x4b42a4[_0x4fe4('0x59')](_0x28ab1c);}})[_0x4fe4('0x25')](function(_0x4590d5){if(_0x4590d5){return _0x4590d5?{'count':_0x36eef8,'rows':_0x4590d5}:null;}})[_0x4fe4('0x25')](respondWithResult(_0x41ebe1,null))[_0x4fe4('0x43')](handleError(_0x41ebe1,null));}; \ No newline at end of file +var _0xf500=['destroy','then','Companies','stack','name','send','index','CmCompany','describe','query','keys','filters','intersection','attributes','fields','length','model','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addContacts','CmContact','ids','getContacts','findOne','order','pick','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x5859d6,_0x197158){var _0x1ed613=function(_0xbd2c4a){while(--_0xbd2c4a){_0x5859d6['push'](_0x5859d6['shift']());}};_0x1ed613(++_0x197158);}(_0xf500,0x13d));var _0x0f50=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf500[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require(_0x0f50('0x0'));var rimraf=require(_0x0f50('0x1'));var zipdir=require(_0x0f50('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f50('0x3'));var moment=require(_0x0f50('0x4'));var BPromise=require(_0x0f50('0x5'));var Mustache=require(_0x0f50('0x6'));var util=require(_0x0f50('0x7'));var path=require('path');var sox=require(_0x0f50('0x8'));var csv=require(_0x0f50('0x9'));var ejs=require(_0x0f50('0xa'));var fs=require('fs');var fs_extra=require(_0x0f50('0xb'));var _=require(_0x0f50('0xc'));var squel=require(_0x0f50('0xd'));var crypto=require(_0x0f50('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0f50('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0f50('0x10'));var Papa=require(_0x0f50('0x11'));var Redis=require(_0x0f50('0x12'));var authService=require(_0x0f50('0x13'));var qs=require(_0x0f50('0x14'));var as=require(_0x0f50('0x15'));var hardwareService=require(_0x0f50('0x16'));var logger=require(_0x0f50('0x17'))(_0x0f50('0x18'));var utils=require(_0x0f50('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x0f50('0x1a'));var db=require(_0x0f50('0x1b'))['db'];function respondWithStatusCode(_0x175570,_0x8e50c1){_0x8e50c1=_0x8e50c1||0xcc;return function(_0x58a475){if(_0x58a475){return _0x175570[_0x0f50('0x1c')](_0x8e50c1);}return _0x175570['status'](_0x8e50c1)['end']();};}function respondWithResult(_0x2d8c41,_0x8b0086){_0x8b0086=_0x8b0086||0xc8;return function(_0x4af2e8){if(_0x4af2e8){return _0x2d8c41[_0x0f50('0x1d')](_0x8b0086)[_0x0f50('0x1e')](_0x4af2e8);}};}function respondWithFilteredResult(_0x8234c3,_0x14e86c){return function(_0x30cd88){if(_0x30cd88){var _0x3a9217=typeof _0x14e86c[_0x0f50('0x1f')]===_0x0f50('0x20')&&typeof _0x14e86c['limit']===_0x0f50('0x20');var _0x2ca9f8=_0x30cd88[_0x0f50('0x21')];var _0x2a6eee=_0x3a9217?0x0:_0x14e86c[_0x0f50('0x1f')];var _0x5dd404=_0x3a9217?_0x30cd88['count']:_0x14e86c[_0x0f50('0x1f')]+_0x14e86c[_0x0f50('0x22')];var _0x469cfd;if(_0x5dd404>=_0x2ca9f8){_0x5dd404=_0x2ca9f8;_0x469cfd=0xc8;}else{_0x469cfd=0xce;}_0x8234c3[_0x0f50('0x1d')](_0x469cfd);return _0x8234c3[_0x0f50('0x23')](_0x0f50('0x24'),_0x2a6eee+'-'+_0x5dd404+'/'+_0x2ca9f8)[_0x0f50('0x1e')](_0x30cd88);}return null;};}function patchUpdates(_0x3fb152){return function(_0x126623){try{jsonpatch[_0x0f50('0x25')](_0x126623,_0x3fb152,!![]);}catch(_0x22cdee){return BPromise[_0x0f50('0x26')](_0x22cdee);}return _0x126623['save']();};}function saveUpdates(_0x2d547a,_0x1a48bb){return function(_0x5c4a77){if(_0x5c4a77){return _0x5c4a77['update'](_0x2d547a)['then'](function(_0x5be168){return _0x5be168;});}return null;};}function removeEntity(_0x1816dc,_0x167f55){return function(_0x3ccec7){if(_0x3ccec7){return _0x3ccec7[_0x0f50('0x27')]()[_0x0f50('0x28')](function(){var _0x2efcb4=_0x3ccec7['get']({'plain':!![]});var _0x4f8938=_0x0f50('0x29');return db['UserProfileResource'][_0x0f50('0x27')]({'where':{'type':_0x4f8938,'resourceId':_0x2efcb4['id']}})[_0x0f50('0x28')](function(){return _0x3ccec7;});})[_0x0f50('0x28')](function(){_0x1816dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54f79e,_0x4a077f){return function(_0x33908f){if(!_0x33908f){_0x54f79e['sendStatus'](0x194);}return _0x33908f;};}function handleError(_0xaebc4a,_0x1a58d8){_0x1a58d8=_0x1a58d8||0x1f4;return function(_0x4df84e){logger['error'](_0x4df84e[_0x0f50('0x2a')]);if(_0x4df84e[_0x0f50('0x2b')]){delete _0x4df84e[_0x0f50('0x2b')];}_0xaebc4a['status'](_0x1a58d8)[_0x0f50('0x2c')](_0x4df84e);};}exports[_0x0f50('0x2d')]=function(_0x822598,_0x557df6){var _0x5a6433={},_0x3376ba={},_0x595300={'count':0x0,'rows':[]};return db[_0x0f50('0x2e')][_0x0f50('0x2f')]()['then'](function(_0x4219a2){_0x3376ba['model']=_['keys'](_0x4219a2);_0x3376ba[_0x0f50('0x30')]=_[_0x0f50('0x31')](_0x822598[_0x0f50('0x30')]);_0x3376ba[_0x0f50('0x32')]=_[_0x0f50('0x33')](_0x3376ba['model'],_0x3376ba[_0x0f50('0x30')]);_0x5a6433[_0x0f50('0x34')]=_[_0x0f50('0x33')](_0x3376ba['model'],qs[_0x0f50('0x35')](_0x822598[_0x0f50('0x30')][_0x0f50('0x35')]));_0x5a6433[_0x0f50('0x34')]=_0x5a6433['attributes'][_0x0f50('0x36')]?_0x5a6433['attributes']:_0x3376ba[_0x0f50('0x37')];if(!_0x822598[_0x0f50('0x30')]['hasOwnProperty'](_0x0f50('0x38'))){_0x5a6433[_0x0f50('0x22')]=qs[_0x0f50('0x22')](_0x822598[_0x0f50('0x30')][_0x0f50('0x22')]);_0x5a6433['offset']=qs['offset'](_0x822598[_0x0f50('0x30')][_0x0f50('0x1f')]);}_0x5a6433['order']=qs['sort'](_0x822598[_0x0f50('0x30')][_0x0f50('0x39')]);_0x5a6433[_0x0f50('0x3a')]=qs['filters'](_['pick'](_0x822598['query'],_0x3376ba['filters']),_0x4219a2);if(_0x822598[_0x0f50('0x30')][_0x0f50('0x3b')]){_0x5a6433[_0x0f50('0x3a')]=_[_0x0f50('0x3c')](_0x5a6433[_0x0f50('0x3a')],{'$or':_['map'](_0x5a6433[_0x0f50('0x34')],function(_0x55b867){var _0x37940b={};_0x37940b[_0x55b867]={'$like':'%'+_0x822598[_0x0f50('0x30')][_0x0f50('0x3b')]+'%'};return _0x37940b;})});}_0x5a6433=_[_0x0f50('0x3c')]({},_0x5a6433,_0x822598[_0x0f50('0x3d')]);var _0x44c7c6={'where':_0x5a6433['where']};return db[_0x0f50('0x2e')][_0x0f50('0x21')](_0x44c7c6)[_0x0f50('0x28')](function(_0x3f1bf2){_0x595300[_0x0f50('0x21')]=_0x3f1bf2;if(_0x822598[_0x0f50('0x30')][_0x0f50('0x3e')]){_0x5a6433[_0x0f50('0x3f')]=[{'all':!![]}];}return db[_0x0f50('0x2e')][_0x0f50('0x40')](_0x5a6433);})['then'](function(_0x4f3c3b){_0x595300['rows']=_0x4f3c3b;return _0x595300;})['then'](respondWithFilteredResult(_0x557df6,_0x5a6433))[_0x0f50('0x41')](handleError(_0x557df6,null));})[_0x0f50('0x41')](handleError(_0x557df6,null));};exports['show']=function(_0x1d17a9,_0x355b05){var _0x1700a0={'raw':![],'where':{'id':_0x1d17a9[_0x0f50('0x42')]['id']}},_0x49240c={};_0x49240c[_0x0f50('0x37')]=_['keys'](db[_0x0f50('0x2e')][_0x0f50('0x43')]);_0x49240c[_0x0f50('0x30')]=_[_0x0f50('0x31')](_0x1d17a9[_0x0f50('0x30')]);_0x49240c[_0x0f50('0x32')]=_[_0x0f50('0x33')](_0x49240c[_0x0f50('0x37')],_0x49240c[_0x0f50('0x30')]);_0x1700a0[_0x0f50('0x34')]=_['intersection'](_0x49240c[_0x0f50('0x37')],qs[_0x0f50('0x35')](_0x1d17a9['query']['fields']));_0x1700a0[_0x0f50('0x34')]=_0x1700a0[_0x0f50('0x34')][_0x0f50('0x36')]?_0x1700a0[_0x0f50('0x34')]:_0x49240c['model'];if(_0x1d17a9[_0x0f50('0x30')][_0x0f50('0x3e')]){_0x1700a0[_0x0f50('0x3f')]=[{'all':!![]}];}_0x1700a0=_[_0x0f50('0x3c')]({},_0x1700a0,_0x1d17a9[_0x0f50('0x3d')]);return db['CmCompany'][_0x0f50('0x44')](_0x1700a0)['then'](handleEntityNotFound(_0x355b05,null))['then'](respondWithResult(_0x355b05,null))['catch'](handleError(_0x355b05,null));};exports['create']=function(_0x598094,_0x255154){return db[_0x0f50('0x2e')][_0x0f50('0x45')](_0x598094['body'],{})[_0x0f50('0x28')](function(_0x38e937){var _0x5b272d=_0x598094[_0x0f50('0x46')][_0x0f50('0x47')]({'plain':!![]});if(!_0x5b272d)throw new Error(_0x0f50('0x48'));if(_0x5b272d[_0x0f50('0x49')]===_0x0f50('0x46')){var _0x5a2954=_0x38e937[_0x0f50('0x47')]({'plain':!![]});var _0x215c4c='Companies';return db[_0x0f50('0x4a')][_0x0f50('0x44')]({'where':{'name':_0x215c4c,'userProfileId':_0x5b272d[_0x0f50('0x4b')]},'raw':!![]})[_0x0f50('0x28')](function(_0x58ec2d){if(_0x58ec2d&&_0x58ec2d[_0x0f50('0x4c')]===0x0){return db[_0x0f50('0x4d')]['create']({'name':_0x5a2954[_0x0f50('0x2b')],'resourceId':_0x5a2954['id'],'type':_0x58ec2d['name'],'sectionId':_0x58ec2d['id']},{})[_0x0f50('0x28')](function(){return _0x38e937;});}else{return _0x38e937;}})[_0x0f50('0x41')](function(_0x1bdeec){logger['error'](_0x0f50('0x4e'),_0x1bdeec);throw _0x1bdeec;});}return _0x38e937;})['then'](respondWithResult(_0x255154,0xc9))[_0x0f50('0x41')](handleError(_0x255154,null));};exports[_0x0f50('0x4f')]=function(_0x41c138,_0xc32bc7){if(_0x41c138[_0x0f50('0x50')]['id']){delete _0x41c138['body']['id'];}return db[_0x0f50('0x2e')][_0x0f50('0x44')]({'where':{'id':_0x41c138[_0x0f50('0x42')]['id']}})[_0x0f50('0x28')](handleEntityNotFound(_0xc32bc7,null))[_0x0f50('0x28')](saveUpdates(_0x41c138['body'],null))[_0x0f50('0x28')](respondWithResult(_0xc32bc7,null))[_0x0f50('0x41')](handleError(_0xc32bc7,null));};exports['destroy']=function(_0x698c44,_0x2b98bf){return db[_0x0f50('0x2e')]['find']({'where':{'id':_0x698c44[_0x0f50('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b98bf,null))[_0x0f50('0x28')](removeEntity(_0x2b98bf,null))[_0x0f50('0x41')](handleError(_0x2b98bf,null));};exports[_0x0f50('0x2f')]=function(_0x3ce213,_0x1f3f77){return db[_0x0f50('0x2e')][_0x0f50('0x2f')]()[_0x0f50('0x28')](respondWithResult(_0x1f3f77,null))[_0x0f50('0x41')](handleError(_0x1f3f77,null));};exports[_0x0f50('0x51')]=function(_0x3a4d5b,_0x4eb5f4,_0x12df09){return db[_0x0f50('0x52')]['find']({'where':{'id':_0x3a4d5b[_0x0f50('0x42')]['id']}})[_0x0f50('0x28')](handleEntityNotFound(_0x4eb5f4,null))[_0x0f50('0x28')](function(_0x21b78d){if(_0x21b78d){return _0x21b78d[_0x0f50('0x51')](_0x3a4d5b[_0x0f50('0x50')][_0x0f50('0x53')],_['omit'](_0x3a4d5b[_0x0f50('0x50')],[_0x0f50('0x53'),'id'])||{});}})[_0x0f50('0x28')](respondWithResult(_0x4eb5f4,null))[_0x0f50('0x41')](handleError(_0x4eb5f4,null));};exports[_0x0f50('0x54')]=function(_0x5919db,_0x2cffb4,_0x321657){var _0x12f456={};var _0x4d7b3d={};var _0x391509;var _0x1b8c9c;return db['CmCompany'][_0x0f50('0x55')]({'where':{'id':_0x5919db[_0x0f50('0x42')]['id']}})[_0x0f50('0x28')](handleEntityNotFound(_0x2cffb4,null))[_0x0f50('0x28')](function(_0x4fd8a3){if(_0x4fd8a3){_0x391509=_0x4fd8a3;_0x4d7b3d['model']=_[_0x0f50('0x31')](db[_0x0f50('0x52')][_0x0f50('0x43')]);_0x4d7b3d['query']=_['keys'](_0x5919db[_0x0f50('0x30')]);_0x4d7b3d[_0x0f50('0x32')]=_[_0x0f50('0x33')](_0x4d7b3d[_0x0f50('0x37')],_0x4d7b3d[_0x0f50('0x30')]);_0x12f456[_0x0f50('0x34')]=_[_0x0f50('0x33')](_0x4d7b3d[_0x0f50('0x37')],qs[_0x0f50('0x35')](_0x5919db['query'][_0x0f50('0x35')]));_0x12f456[_0x0f50('0x34')]=_0x12f456['attributes'][_0x0f50('0x36')]?_0x12f456['attributes']:_0x4d7b3d['model'];_0x12f456[_0x0f50('0x56')]=qs[_0x0f50('0x39')](_0x5919db[_0x0f50('0x30')]['sort']);_0x12f456['where']=qs[_0x0f50('0x32')](_[_0x0f50('0x57')](_0x5919db[_0x0f50('0x30')],_0x4d7b3d[_0x0f50('0x32')]));if(_0x5919db[_0x0f50('0x30')][_0x0f50('0x3b')]){_0x12f456[_0x0f50('0x3a')]=_['merge'](_0x12f456[_0x0f50('0x3a')],{'$or':_['map'](_0x12f456[_0x0f50('0x34')],function(_0x77ef3d){var _0x530621={};_0x530621[_0x77ef3d]={'$like':'%'+_0x5919db[_0x0f50('0x30')][_0x0f50('0x3b')]+'%'};return _0x530621;})});}_0x12f456=_[_0x0f50('0x3c')]({},_0x12f456,_0x5919db[_0x0f50('0x3d')]);return _0x391509[_0x0f50('0x54')](_0x12f456);}})[_0x0f50('0x28')](function(_0xd0f206){if(_0xd0f206){_0x1b8c9c=_0xd0f206[_0x0f50('0x36')];if(!_0x5919db[_0x0f50('0x30')][_0x0f50('0x58')](_0x0f50('0x38'))){_0x12f456[_0x0f50('0x22')]=qs[_0x0f50('0x22')](_0x5919db[_0x0f50('0x30')][_0x0f50('0x22')]);_0x12f456[_0x0f50('0x1f')]=qs[_0x0f50('0x1f')](_0x5919db[_0x0f50('0x30')]['offset']);}return _0x391509[_0x0f50('0x54')](_0x12f456);}})[_0x0f50('0x28')](function(_0x5f2b30){if(_0x5f2b30){return _0x5f2b30?{'count':_0x1b8c9c,'rows':_0x5f2b30}:null;}})[_0x0f50('0x28')](respondWithResult(_0x2cffb4,null))[_0x0f50('0x41')](handleError(_0x2cffb4,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index de3596a..f69c0a6 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 _0x1591=['exports','define','cm_companies','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x238b73,_0x5df76f){var _0x5966d9=function(_0x57802d){while(--_0x57802d){_0x238b73['push'](_0x238b73['shift']());}};_0x5966d9(++_0x5df76f);}(_0x1591,0x162));var _0x1159=function(_0x3958fe,_0x3c6605){_0x3958fe=_0x3958fe-0x0;var _0x1f27d6=_0x1591[_0x3958fe];return _0x1f27d6;};'use strict';var _=require(_0x1159('0x0'));var util=require(_0x1159('0x1'));var logger=require(_0x1159('0x2'))(_0x1159('0x3'));var moment=require('moment');var BPromise=require(_0x1159('0x4'));var rp=require(_0x1159('0x5'));var fs=require('fs');var path=require(_0x1159('0x6'));var rimraf=require(_0x1159('0x7'));var config=require(_0x1159('0x8'));var attributes=require(_0x1159('0x9'));module[_0x1159('0xa')]=function(_0x217a06,_0x3e672a){return _0x217a06[_0x1159('0xb')]('CmCompany',attributes,{'tableName':_0x1159('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x169d=['api','request-promise','path','./cmCompany.attributes','define','cm_companies','lodash','util','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x169d,0x153));var _0xd169=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x169d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd169('0x0'));var util=require(_0xd169('0x1'));var logger=require(_0xd169('0x2'))(_0xd169('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd169('0x4'));var fs=require('fs');var path=require(_0xd169('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd169('0x6'));module['exports']=function(_0x4893e1,_0x2ff32f){return _0x4893e1[_0xd169('0x7')]('CmCompany',attributes,{'tableName':_0xd169('0x8'),'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 4571a3d..f4c4b93 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 _0xc8bd=['CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x21e8a3,_0x1e2514){var _0x1c14da=function(_0xfda92f){while(--_0xfda92f){_0x21e8a3['push'](_0x21e8a3['shift']());}};_0x1c14da(++_0x1e2514);}(_0xc8bd,0xa8));var _0xdc8b=function(_0x386247,_0x5dcfa9){_0x386247=_0x386247-0x0;var _0x3abf65=_0xc8bd[_0x386247];return _0x3abf65;};'use strict';var _=require('lodash');var util=require(_0xdc8b('0x0'));var moment=require('moment');var BPromise=require(_0xdc8b('0x1'));var rs=require(_0xdc8b('0x2'));var fs=require('fs');var Redis=require(_0xdc8b('0x3'));var db=require(_0xdc8b('0x4'))['db'];var utils=require(_0xdc8b('0x5'));var logger=require('../../config/logger')(_0xdc8b('0x6'));var config=require(_0xdc8b('0x7'));var jayson=require(_0xdc8b('0x8'));var client=jayson[_0xdc8b('0x9')][_0xdc8b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x274666,_0x3d10c9,_0x260369){return new BPromise(function(_0xc4d2e2,_0x43be17){return client[_0xdc8b('0xb')](_0x274666,_0x260369)[_0xdc8b('0xc')](function(_0x4426e0){logger['info'](_0xdc8b('0xd'),_0x3d10c9,_0xdc8b('0xe'));logger[_0xdc8b('0xf')](_0xdc8b('0x10'),_0x3d10c9,_0xdc8b('0xe'),JSON[_0xdc8b('0x11')](_0x4426e0));if(_0x4426e0[_0xdc8b('0x12')]){if(_0x4426e0[_0xdc8b('0x12')][_0xdc8b('0x13')]===0x1f4){logger[_0xdc8b('0x12')]('CmCompany,\x20%s,\x20%s',_0x3d10c9,_0x4426e0[_0xdc8b('0x12')][_0xdc8b('0x14')]);return _0x43be17(_0x4426e0['error']['message']);}logger[_0xdc8b('0x12')](_0xdc8b('0xd'),_0x3d10c9,_0x4426e0[_0xdc8b('0x12')][_0xdc8b('0x14')]);return _0xc4d2e2(_0x4426e0[_0xdc8b('0x12')]['message']);}else{logger[_0xdc8b('0x15')](_0xdc8b('0xd'),_0x3d10c9,'request\x20sent');_0xc4d2e2(_0x4426e0['result'][_0xdc8b('0x14')]);}})[_0xdc8b('0x16')](function(_0x3e1563){logger[_0xdc8b('0x12')](_0xdc8b('0xd'),_0x3d10c9,_0x3e1563);_0x43be17(_0x3e1563);});});} \ No newline at end of file +var _0x8a7c=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','then','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x8a7c,0x1b5));var _0xc8a7=function(_0x279a1a,_0x238309){_0x279a1a=_0x279a1a-0x0;var _0x185456=_0x8a7c[_0x279a1a];return _0x185456;};'use strict';var _=require('lodash');var util=require(_0xc8a7('0x0'));var moment=require(_0xc8a7('0x1'));var BPromise=require(_0xc8a7('0x2'));var rs=require(_0xc8a7('0x3'));var fs=require('fs');var Redis=require(_0xc8a7('0x4'));var db=require(_0xc8a7('0x5'))['db'];var utils=require(_0xc8a7('0x6'));var logger=require('../../config/logger')(_0xc8a7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc8a7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4eb3ef,_0x25bcf8,_0x4780a1){return new BPromise(function(_0x27bcf8,_0x1e6f2b){return client['request'](_0x4eb3ef,_0x4780a1)[_0xc8a7('0x9')](function(_0x4f426d){logger[_0xc8a7('0xa')](_0xc8a7('0xb'),_0x25bcf8,'request\x20sent');logger['debug'](_0xc8a7('0xc'),_0x25bcf8,_0xc8a7('0xd'),JSON[_0xc8a7('0xe')](_0x4f426d));if(_0x4f426d[_0xc8a7('0xf')]){if(_0x4f426d[_0xc8a7('0xf')][_0xc8a7('0x10')]===0x1f4){logger[_0xc8a7('0xf')]('CmCompany,\x20%s,\x20%s',_0x25bcf8,_0x4f426d['error'][_0xc8a7('0x11')]);return _0x1e6f2b(_0x4f426d[_0xc8a7('0xf')]['message']);}logger['error'](_0xc8a7('0xb'),_0x25bcf8,_0x4f426d['error'][_0xc8a7('0x11')]);return _0x27bcf8(_0x4f426d[_0xc8a7('0xf')]['message']);}else{logger[_0xc8a7('0xa')](_0xc8a7('0xb'),_0x25bcf8,_0xc8a7('0xd'));_0x27bcf8(_0x4f426d[_0xc8a7('0x12')][_0xc8a7('0x11')]);}})[_0xc8a7('0x13')](function(_0xe51850){logger[_0xc8a7('0xf')](_0xc8a7('0xb'),_0x25bcf8,_0xe51850);_0x1e6f2b(_0xe51850);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 3e169c9..c72a704 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 _0xfd6d=['../../components/auth/service','../../components/interaction/service','./cmCompany.controller','index','/describe','isAuthenticated','get','/:id','show','getContacts','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1a209f,_0x1b35e6){var _0x376b56=function(_0x5ed729){while(--_0x5ed729){_0x1a209f['push'](_0x1a209f['shift']());}};_0x376b56(++_0x1b35e6);}(_0xfd6d,0xb9));var _0xdfd6=function(_0x295729,_0xce308){_0x295729=_0x295729-0x0;var _0x4da443=_0xfd6d[_0x295729];return _0x4da443;};'use strict';var multer=require(_0xdfd6('0x0'));var util=require(_0xdfd6('0x1'));var path=require(_0xdfd6('0x2'));var timeout=require(_0xdfd6('0x3'));var express=require(_0xdfd6('0x4'));var router=express[_0xdfd6('0x5')]();var fs_extra=require(_0xdfd6('0x6'));var auth=require(_0xdfd6('0x7'));var interaction=require(_0xdfd6('0x8'));var config=require('../../config/environment');var controller=require(_0xdfd6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xdfd6('0xa')]);router['get'](_0xdfd6('0xb'),auth[_0xdfd6('0xc')](),controller['describe']);router[_0xdfd6('0xd')](_0xdfd6('0xe'),auth[_0xdfd6('0xc')](),controller[_0xdfd6('0xf')]);router[_0xdfd6('0xd')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xdfd6('0x10')]);router[_0xdfd6('0x11')]('/',auth['isAuthenticated'](),controller[_0xdfd6('0x12')]);router[_0xdfd6('0x11')]('/:id/contacts',auth[_0xdfd6('0xc')](),controller['addContacts']);router[_0xdfd6('0x13')](_0xdfd6('0xe'),auth[_0xdfd6('0xc')](),controller[_0xdfd6('0x14')]);router[_0xdfd6('0x15')]('/:id',auth[_0xdfd6('0xc')](),controller[_0xdfd6('0x16')]);module[_0xdfd6('0x17')]=router; \ No newline at end of file +var _0x1486=['index','/describe','describe','/:id','show','post','create','/:id/contacts','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x4f3484,_0x2a0968){var _0x612a71=function(_0x9099fd){while(--_0x9099fd){_0x4f3484['push'](_0x4f3484['shift']());}};_0x612a71(++_0x2a0968);}(_0x1486,0x160));var _0x6148=function(_0x28e757,_0x28d435){_0x28e757=_0x28e757-0x0;var _0x604fde=_0x1486[_0x28e757];return _0x604fde;};'use strict';var multer=require(_0x6148('0x0'));var util=require(_0x6148('0x1'));var path=require('path');var timeout=require(_0x6148('0x2'));var express=require(_0x6148('0x3'));var router=express['Router']();var fs_extra=require(_0x6148('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6148('0x5'));var controller=require('./cmCompany.controller');router[_0x6148('0x6')]('/',auth[_0x6148('0x7')](),controller[_0x6148('0x8')]);router[_0x6148('0x6')](_0x6148('0x9'),auth[_0x6148('0x7')](),controller[_0x6148('0xa')]);router[_0x6148('0x6')](_0x6148('0xb'),auth['isAuthenticated'](),controller[_0x6148('0xc')]);router[_0x6148('0x6')]('/:id/contacts',auth[_0x6148('0x7')](),controller['getContacts']);router[_0x6148('0xd')]('/',auth[_0x6148('0x7')](),controller[_0x6148('0xe')]);router['post'](_0x6148('0xf'),auth[_0x6148('0x7')](),controller['addContacts']);router['put'](_0x6148('0xb'),auth[_0x6148('0x7')](),controller[_0x6148('0x10')]);router[_0x6148('0x11')](_0x6148('0xb'),auth[_0x6148('0x7')](),controller[_0x6148('0x12')]);module[_0x6148('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index aed5633..0debdf6 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 _0xba1e=['lodash','sequelize','exports','STRING','INTEGER','UNSIGNED','DATE'];(function(_0x5d07e1,_0x418799){var _0x21617f=function(_0x3e8068){while(--_0x3e8068){_0x5d07e1['push'](_0x5d07e1['shift']());}};_0x21617f(++_0x418799);}(_0xba1e,0x12d));var _0xeba1=function(_0x5d1b11,_0x48c8c6){_0x5d1b11=_0x5d1b11-0x0;var _0x1ad2b5=_0xba1e[_0x5d1b11];return _0x1ad2b5;};'use strict';var _=require(_0xeba1('0x0'));var Sequelize=require(_0xeba1('0x1'));module[_0xeba1('0x2')]={'firstName':{'type':Sequelize[_0xeba1('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xeba1('0x3')]},'street':{'type':Sequelize[_0xeba1('0x3')]},'postalCode':{'type':Sequelize[_0xeba1('0x3')]},'city':{'type':Sequelize[_0xeba1('0x3')]},'country':{'type':Sequelize[_0xeba1('0x3')]},'dateOfBirth':{'type':Sequelize[_0xeba1('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xeba1('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xeba1('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xeba1('0x3')]},'fb_data':{'type':Sequelize[_0xeba1('0x3')]},'twitter':{'type':Sequelize[_0xeba1('0x3')]},'skype':{'type':Sequelize[_0xeba1('0x3')]},'teams':{'type':Sequelize[_0xeba1('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xeba1('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xeba1('0x3')]},'priority':{'type':Sequelize[_0xeba1('0x4')](0x2)[_0xeba1('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xeba1('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xeba1('0x3')]},'utcOffset':{'type':Sequelize[_0xeba1('0x4')]}}; \ No newline at end of file +var _0x22a7=['sequelize','exports','STRING','TEXT','INTEGER','DATE','NOW'];(function(_0x1fdd8e,_0x29c639){var _0x5122ea=function(_0x4230da){while(--_0x4230da){_0x1fdd8e['push'](_0x1fdd8e['shift']());}};_0x5122ea(++_0x29c639);}(_0x22a7,0x16c));var _0x722a=function(_0x418473,_0x2f4ef1){_0x418473=_0x418473-0x0;var _0x3e85d4=_0x22a7[_0x418473];return _0x3e85d4;};'use strict';var _=require('lodash');var Sequelize=require(_0x722a('0x0'));module[_0x722a('0x1')]={'firstName':{'type':Sequelize[_0x722a('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x722a('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x722a('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x722a('0x2')]},'dateOfBirth':{'type':Sequelize[_0x722a('0x2')]},'description':{'type':Sequelize[_0x722a('0x3')]},'phone':{'type':Sequelize[_0x722a('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x722a('0x2')]},'email':{'type':Sequelize[_0x722a('0x2')]},'url':{'type':Sequelize[_0x722a('0x2')]},'facebook':{'type':Sequelize[_0x722a('0x2')]},'fb_data':{'type':Sequelize[_0x722a('0x2')]},'twitter':{'type':Sequelize[_0x722a('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x722a('0x2')]},'line':{'type':Sequelize[_0x722a('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x722a('0x2')]},'UserId':{'type':Sequelize[_0x722a('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x722a('0x2')]},'priority':{'type':Sequelize[_0x722a('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x722a('0x5')],'defaultValue':Sequelize[_0x722a('0x6')]},'dialTimezone':{'type':Sequelize[_0x722a('0x2')]},'utcOffset':{'type':Sequelize[_0x722a('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 75ebd89..7038f5d 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 _0xcd9b=['contact\x20phone\x20exists','CmHopper','item','PHONE','sequelize','literal','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','hopperId','getHoppers','pick','ContactId','includeAll','include','nolimit','rows','getJscriptySessions','uploadCsv','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','server/files/tmp','file','0777','child_process','fork','../../components/import/cm/csv','binding_keys','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','User','agent','No\x20ListId\x20specified','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','binding','getJourney','sms','openchannel','fax','voice','resolve','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','source','destination','starttime','duration','note','createdAt','userDisposition','userThirdDisposition','UserId','fullname','DESC','startCase','chat','Website','closed','secondDisposition','thirdDisposition','Account','key','Owner','Tags','browserName','customerIp','deviceModel','ratingMessage','ratingType','ratingValue','mail','substatus','externalUrl','threadId','Interaction','findAndCountAll','reverse','slice','moment','bluebird','util','path','lodash','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','count','limit','set','Content-Range','then','destroy','end','sendStatus','error','name','index','describe','getOptions','findAll','query','user','catch','CmContact','params','tags','keys','length','startsWith','cf_','columnName','displayName','CmCustomField','alias','custom','type','info','forEach','hasOwnProperty','merge','body','from','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','where','$or','push','ListId','findOrCreate','contact','find','Tag','tag','ItemType','Phones.OrderBy','$and','map','cf_%d','omit','pickBy','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','values','phone','getTags','rawAttributes','filters','intersection','model','attributes','fields','order','sort','filter','options','setTags','findOne','setAdditionalPhones','all','ContactItemType','item_types','items','ItemTypeId','description','OrderBy'];(function(_0x4a8491,_0x5dd897){var _0x3c05b3=function(_0x2a7e6e){while(--_0x2a7e6e){_0x4a8491['push'](_0x4a8491['shift']());}};_0x3c05b3(++_0x5dd897);}(_0xcd9b,0x6c));var _0xbcd9=function(_0x21241e,_0x118d5f){_0x21241e=_0x21241e-0x0;var _0x225c31=_0xcd9b[_0x21241e];return _0x225c31;};'use strict';var moment=require(_0xbcd9('0x0'));var BPromise=require(_0xbcd9('0x1'));var util=require(_0xbcd9('0x2'));var path=require(_0xbcd9('0x3'));var fs=require('fs');var _=require(_0xbcd9('0x4'));var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xbcd9('0x5'));var contacts=require(_0xbcd9('0x6'));var qs=require(_0xbcd9('0x7'));var logger=require('../../config/logger')(_0xbcd9('0x8'));var config=require('../../config/environment');var shared=require(_0xbcd9('0x9'));var db=require(_0xbcd9('0xa'))['db'];config[_0xbcd9('0xb')]=_[_0xbcd9('0xc')](config[_0xbcd9('0xb')],{'host':_0xbcd9('0xd'),'port':0x18eb});var socket=require(_0xbcd9('0xe'))(new Redis(config['redis']));require(_0xbcd9('0xf'))['register'](socket);function respondWithResult(_0x34de97,_0x1b2d5a){_0x1b2d5a=_0x1b2d5a||0xc8;return function(_0x2bd25e){if(_0x2bd25e){return _0x34de97[_0xbcd9('0x10')](_0x1b2d5a)[_0xbcd9('0x11')](_0x2bd25e);}};}function respondWithFilteredResult(_0x5e827e,_0x5b7ac5){return function(_0x18c330){if(_0x18c330){var _0x33dec3=typeof _0x5b7ac5[_0xbcd9('0x12')]==='undefined'&&typeof _0x5b7ac5['limit']===_0xbcd9('0x13');var _0x4c80a3=_0x18c330['count'];var _0x326b65=_0x33dec3?0x0:_0x5b7ac5['offset'];var _0x41a7e5=_0x33dec3?_0x18c330[_0xbcd9('0x14')]:_0x5b7ac5[_0xbcd9('0x12')]+_0x5b7ac5[_0xbcd9('0x15')];var _0x32e0ef;if(_0x41a7e5>=_0x4c80a3){_0x41a7e5=_0x4c80a3;_0x32e0ef=0xc8;}else{_0x32e0ef=0xce;}_0x5e827e['status'](_0x32e0ef);return _0x5e827e[_0xbcd9('0x16')](_0xbcd9('0x17'),_0x326b65+'-'+_0x41a7e5+'/'+_0x4c80a3)['json'](_0x18c330);}return null;};}function saveUpdates(_0x234395){return function(_0x1c4ca1){if(_0x1c4ca1){return _0x1c4ca1['update'](_0x234395)[_0xbcd9('0x18')](function(_0x27a227){return _0x27a227;});}return null;};}function removeEntity(_0x425dcc){return function(_0x23b9ba){if(_0x23b9ba){return _0x23b9ba[_0xbcd9('0x19')]()['then'](function(){_0x425dcc['status'](0xcc)[_0xbcd9('0x1a')]();});}};}function handleEntityNotFound(_0xb93db8){return function(_0x5be3b0){if(!_0x5be3b0){_0xb93db8[_0xbcd9('0x1b')](0x194);}return _0x5be3b0;};}function handleError(_0x3511c5,_0x4adfbf){_0x4adfbf=_0x4adfbf||0x1f4;return function(_0x2f8b55){logger[_0xbcd9('0x1c')](_0x2f8b55['stack']);if(_0x2f8b55[_0xbcd9('0x1d')]){delete _0x2f8b55[_0xbcd9('0x1d')];}_0x3511c5['status'](_0x4adfbf)['send'](_0x2f8b55);};}exports[_0xbcd9('0x1e')]=function(_0x1de82a,_0xbb551c){var _0x3c0a9e={};return contacts[_0xbcd9('0x1f')]()[_0xbcd9('0x18')](function(_0x328aff){_0x3c0a9e=qs[_0xbcd9('0x20')](_0x328aff,_0x1de82a);return contacts[_0xbcd9('0x21')](_0x1de82a[_0xbcd9('0x22')],_0x1de82a[_0xbcd9('0x23')],_0x3c0a9e,_0x328aff);})[_0xbcd9('0x18')](respondWithFilteredResult(_0xbb551c,_0x3c0a9e))[_0xbcd9('0x24')](handleError(_0xbb551c,null));};exports[_0xbcd9('0x19')]=function(_0x3e74ec,_0x58ad47){return db[_0xbcd9('0x25')]['find']({'where':{'id':_0x3e74ec[_0xbcd9('0x26')]['id']}})['then'](handleEntityNotFound(_0x58ad47,null))[_0xbcd9('0x18')](removeEntity(_0x58ad47,null))[_0xbcd9('0x24')](handleError(_0x58ad47,null));};exports[_0xbcd9('0x1f')]=function(_0x3c8da7,_0x2b3ca3){return db['CmContact'][_0xbcd9('0x1f')]()[_0xbcd9('0x18')](function(_0x1bc150){delete _0x1bc150[_0xbcd9('0x27')];for(var _0x52c065=0x0;_0x52c0650x0){return new Promise(function(_0x578785){var _0x361f78=[];for(var _0x329bd9=0x0;_0x329bd9<_0x53a0ab[_0xbcd9('0x29')];_0x329bd9++){_0x361f78[_0xbcd9('0x62')](insertAdditionalPhones(_0x53a0ab[_0x329bd9][_0xbcd9('0x65')],_0x53a0ab[_0x329bd9][_0xbcd9('0x5e')]));}Promise['all'](_0x361f78)[_0xbcd9('0x18')](function(){_0x578785(0x1);});})['then'](function(){return{'success':_0x51e189,'failure':_0x9fcbba,'duplicates':_0x121959};});}else{return{'success':_0x51e189,'failure':_0x9fcbba,'duplicates':_0x121959};}}})['then'](respondWithResult(_0x496b3b,0xc9))[_0xbcd9('0x24')](handleError(_0x496b3b,null));};exports['show']=function(_0x1738b3,_0x272230){var _0x1394f5;return db['CmContact'][_0xbcd9('0x1f')]()[_0xbcd9('0x18')](function(_0x4781ae){return db[_0xbcd9('0x25')][_0xbcd9('0x66')]({'where':{'id':_0x1738b3['params']['id']},'include':[{'model':db[_0xbcd9('0x67')],'as':'Tags','attributes':['id','name','color'],'required':_0x1738b3[_0xbcd9('0x22')][_0xbcd9('0x68')]?!![]:![]},{'model':db[_0xbcd9('0x4c')],'as':'Phones','where':{'CmContactId':_0x1738b3[_0xbcd9('0x26')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xbcd9('0x69')}]}],'order':[db['sequelize']['literal'](_0xbcd9('0x6a'))],'attributes':_[_0xbcd9('0x28')](_0x4781ae)});})[_0xbcd9('0x18')](function(_0x220031){if(!_[_0xbcd9('0x5a')](_0x220031)){_0x1394f5=_0x220031[_0xbcd9('0x38')]({'plain':!![]});var _0x58ca9a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x220031&&_0x220031['ListId']){if(_0x220031['ListId']){_0x58ca9a[_0xbcd9('0x60')][_0xbcd9('0x6b')]['push']({'ListId':{'$ne':_0x220031['ListId']}});}}return db[_0xbcd9('0x2e')][_0xbcd9('0x21')](_0x58ca9a);}})[_0xbcd9('0x18')](function(_0x575eb4){if(!_['isNil'](_0x575eb4)){return _['omit'](_0x1394f5,_[_0xbcd9('0x6c')](_0x575eb4,function(_0x3f50f8){return util['format'](_0xbcd9('0x6d'),_0x3f50f8['id']);}));}})[_0xbcd9('0x18')](handleEntityNotFound(_0x272230,null))[_0xbcd9('0x18')](respondWithResult(_0x272230,null))['catch'](handleError(_0x272230,null));};exports['update']=function(_0x4ad3e3,_0x22a723){var _0x4d8d34;if(_0x4ad3e3['body']['id']){delete _0x4ad3e3[_0xbcd9('0x36')]['id'];}if(!_[_0xbcd9('0x5a')](_0x4ad3e3['body'][_0xbcd9('0x5b')])){var _0x2c2403=_0x4ad3e3[_0xbcd9('0x36')][_0xbcd9('0x5b')];if(!_[_0xbcd9('0x5a')](shared[_0xbcd9('0x5c')][_0x2c2403]))_0x4ad3e3[_0xbcd9('0x36')]['utcOffset']=shared['timezones'][_0x2c2403]['utcOffset'];}return db[_0xbcd9('0x25')][_0xbcd9('0x66')]({'where':{'id':_0x4ad3e3[_0xbcd9('0x26')]['id']}})[_0xbcd9('0x18')](handleEntityNotFound(_0x22a723,null))[_0xbcd9('0x18')](saveUpdates(_0x4ad3e3[_0xbcd9('0x36')],null))[_0xbcd9('0x18')](function(_0x15654e){_0x4d8d34=_0x15654e;var _0x129279={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x15654e&&_0x15654e[_0xbcd9('0x63')]){if(_0x15654e['ListId']){_0x129279[_0xbcd9('0x60')][_0xbcd9('0x6b')]['push']({'ListId':{'$ne':_0x15654e[_0xbcd9('0x63')]}});}}return db[_0xbcd9('0x2e')]['findAll'](_0x129279);})[_0xbcd9('0x18')](function(_0xe20d15){if(_0xe20d15){return _[_0xbcd9('0x6e')](_[_0xbcd9('0x6f')](_0x4ad3e3[_0xbcd9('0x36')],function(_0x4cd36d,_0xbc88d5){return _[_0xbcd9('0x2a')](_0xbc88d5,_0xbcd9('0x2b'));}),_[_0xbcd9('0x6c')](_0xe20d15,function(_0x3744fa){return util['format'](_0xbcd9('0x6d'),_0x3744fa['id']);}));}})['then'](function(_0x1b9617){if(_0x1b9617&&!_[_0xbcd9('0x70')](_0x1b9617)){var _0xbe5459=squel['update']()[_0xbcd9('0x71')](_0xbcd9('0x72'))[_0xbcd9('0x73')](_0x1b9617)[_0xbcd9('0x60')](_0xbcd9('0x74'),_0x4ad3e3[_0xbcd9('0x26')]['id'])[_0xbcd9('0x75')]();return db['sequelize'][_0xbcd9('0x22')](_0xbe5459[_0xbcd9('0x76')],{'replacements':_0xbe5459[_0xbcd9('0x77')]});}})[_0xbcd9('0x18')](function(){if(_0x4ad3e3['body'][_0xbcd9('0x78')]&&_0x4d8d34){return db['CmHopper'][_0xbcd9('0x41')]({'phone':_0x4ad3e3['body'][_0xbcd9('0x78')],'OrderBy':0x0},{'where':{'ContactId':_0x4d8d34['id']}});}})[_0xbcd9('0x18')](function(){return _0x4d8d34;})['then'](respondWithResult(_0x22a723,null))[_0xbcd9('0x24')](handleError(_0x22a723,null));};exports[_0xbcd9('0x79')]=function(_0x12a57d,_0x41aeeb){var _0x38bef2={};var _0x28fc17={};var _0x17a4e6;var _0x6fdb6d;return db[_0xbcd9('0x25')]['findOne']({'where':{'id':_0x12a57d['params']['id']}})[_0xbcd9('0x18')](handleEntityNotFound(_0x41aeeb,null))[_0xbcd9('0x18')](function(_0x4b9049){if(_0x4b9049){_0x17a4e6=_0x4b9049;_0x28fc17['model']=_['keys'](db['Tag'][_0xbcd9('0x7a')]);_0x28fc17[_0xbcd9('0x22')]=_[_0xbcd9('0x28')](_0x12a57d['query']);_0x28fc17[_0xbcd9('0x7b')]=_[_0xbcd9('0x7c')](_0x28fc17[_0xbcd9('0x7d')],_0x28fc17[_0xbcd9('0x22')]);_0x38bef2[_0xbcd9('0x7e')]=_[_0xbcd9('0x7c')](_0x28fc17[_0xbcd9('0x7d')],qs[_0xbcd9('0x7f')](_0x12a57d['query']['fields']));_0x38bef2[_0xbcd9('0x7e')]=_0x38bef2[_0xbcd9('0x7e')][_0xbcd9('0x29')]?_0x38bef2[_0xbcd9('0x7e')]:_0x28fc17[_0xbcd9('0x7d')];_0x38bef2[_0xbcd9('0x80')]=qs[_0xbcd9('0x81')](_0x12a57d['query'][_0xbcd9('0x81')]);_0x38bef2[_0xbcd9('0x60')]=qs[_0xbcd9('0x7b')](_['pick'](_0x12a57d[_0xbcd9('0x22')],_0x28fc17[_0xbcd9('0x7b')]));if(_0x12a57d[_0xbcd9('0x22')][_0xbcd9('0x82')]){_0x38bef2['where']=_[_0xbcd9('0x35')](_0x38bef2[_0xbcd9('0x60')],{'$or':_['map'](_0x38bef2[_0xbcd9('0x7e')],function(_0x4994af){var _0x2c0105={};_0x2c0105[_0x4994af]={'$like':'%'+_0x12a57d['query'][_0xbcd9('0x82')]+'%'};return _0x2c0105;})});}_0x38bef2=_[_0xbcd9('0x35')]({},_0x38bef2,_0x12a57d[_0xbcd9('0x83')]);return _0x17a4e6[_0xbcd9('0x79')](_0x38bef2);}})['then'](function(_0x2be1b5){if(_0x2be1b5){_0x6fdb6d=_0x2be1b5['length'];if(!_0x12a57d[_0xbcd9('0x22')]['hasOwnProperty']('nolimit')){_0x38bef2[_0xbcd9('0x15')]=qs[_0xbcd9('0x15')](_0x12a57d[_0xbcd9('0x22')][_0xbcd9('0x15')]);_0x38bef2['offset']=qs[_0xbcd9('0x12')](_0x12a57d['query']['offset']);}return _0x17a4e6[_0xbcd9('0x79')](_0x38bef2);}})[_0xbcd9('0x18')](function(_0x4eb0d7){if(_0x4eb0d7){return _0x4eb0d7?{'count':_0x6fdb6d,'rows':_0x4eb0d7}:null;}})[_0xbcd9('0x18')](respondWithResult(_0x41aeeb,null))[_0xbcd9('0x24')](handleError(_0x41aeeb,null));};exports[_0xbcd9('0x84')]=function(_0x1eadf9,_0x300cf2){if(_0x1eadf9[_0xbcd9('0x36')]['id']){delete _0x1eadf9[_0xbcd9('0x36')]['id'];}return db[_0xbcd9('0x25')][_0xbcd9('0x85')]({'where':{'id':_0x1eadf9[_0xbcd9('0x26')]['id']}})['then'](handleEntityNotFound(_0x300cf2,null))['then'](function(_0x15e04a){if(_0x15e04a){return _0x15e04a['setTags'](_0x1eadf9[_0xbcd9('0x36')]['ids']||[]);}return null;})['then'](respondWithResult(_0x300cf2,null))[_0xbcd9('0x24')](handleError(_0x300cf2,null));};exports[_0xbcd9('0x86')]=function(_0x493e29,_0x42fb87){var _0x2c242d=[];_0x2c242d[_0xbcd9('0x62')](addAdditionalPhones(_0x493e29[_0xbcd9('0x36')]));Promise[_0xbcd9('0x87')](_0x2c242d)[_0xbcd9('0x18')](function(){_0x2c242d=[];_0x2c242d[_0xbcd9('0x62')](deleteCmHopperPhones(_0x493e29[_0xbcd9('0x36')]['id']));_0x2c242d[_0xbcd9('0x62')](addCmHopperPhones(_0x493e29[_0xbcd9('0x36')]['id']));Promise['all'](_0x2c242d)[_0xbcd9('0x18')](function(){return[0x1];})[_0xbcd9('0x18')](respondWithResult(_0x42fb87,null));});};function addAdditionalPhones(_0x3d3a3b){var _0x337f94;return new Promise(function(_0x1fc584){return db['CmContactHasItem'][_0xbcd9('0x19')]({'where':{'CmContactId':_0x3d3a3b['id']}})[_0xbcd9('0x18')](function(){db[_0xbcd9('0x88')]['findAll']({'raw':!![],'attributes':['id','OrderBy']})[_0xbcd9('0x18')](function(_0x20db31){var _0x12438d=[];for(var _0x4b6a66=0x0;_0x4b6a66<_0x3d3a3b['items'][_0xbcd9('0x29')];_0x4b6a66++){var _0x3e115d=_0x3d3a3b[_0xbcd9('0x89')]?_[_0xbcd9('0x5a')](_0x3d3a3b[_0xbcd9('0x89')][_0x4b6a66])?'':_0x3d3a3b[_0xbcd9('0x89')][_0x4b6a66]:_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66][_0xbcd9('0x8b')]?_0x3d3a3b['items'][_0x4b6a66][_0xbcd9('0x8b')]:'';var _0xdda2cc=_[_0xbcd9('0x5a')](_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66][_0xbcd9('0x8c')])?'':_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66]['description'];var _0xc1fb14=_0x3e115d+':'+_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66]['phone']+'§'+_0xdda2cc;if(_[_0xbcd9('0x5a')](_0x337f94))_0x337f94=_0xc1fb14;else _0x337f94+=';'+_0xc1fb14;var _0x205a2f=null;var _0x13aa25=null;if(_0x3d3a3b[_0xbcd9('0x89')]){if(!_[_0xbcd9('0x5a')](_0x3d3a3b[_0xbcd9('0x89')][_0x4b6a66])){_0x13aa25=_[_0xbcd9('0x66')](_0x20db31,function(_0x3b5f6c){return _0x3b5f6c['id']===_0x3d3a3b[_0xbcd9('0x89')][_0x4b6a66];});if(!_[_0xbcd9('0x5a')](_0x13aa25)){_0x205a2f=_0x13aa25[_0xbcd9('0x8d')];}}}else{if(!_['isNil'](_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66])){_0x13aa25=_[_0xbcd9('0x66')](_0x20db31,function(_0x48d71b){return _0x48d71b['id']===_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66][_0xbcd9('0x8b')];});if(!_[_0xbcd9('0x5a')](_0x13aa25)){_0x205a2f=_0x4b6a66;}}}if(_[_0xbcd9('0x5a')](_0x205a2f)){_0x205a2f=0x64;}_0x12438d[_0xbcd9('0x62')](addAdditionalPhone(_0x3d3a3b['id'],_0x3d3a3b['items'][_0x4b6a66]['phone'],_0x3d3a3b['item_types']?_['isNil'](_0x3d3a3b['item_types'][_0x4b6a66])?null:_0x3d3a3b[_0xbcd9('0x89')][_0x4b6a66]:_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66][_0xbcd9('0x8b')]?_0x3d3a3b[_0xbcd9('0x8a')][_0x4b6a66][_0xbcd9('0x8b')]:null,_0x205a2f,_0xdda2cc));}Promise[_0xbcd9('0x87')](_0x12438d)[_0xbcd9('0x18')](function(){db[_0xbcd9('0x25')][_0xbcd9('0x41')]({'AdditionalPhones':_0x337f94},{'where':{'id':_0x3d3a3b['id']}})[_0xbcd9('0x18')](function(){_0x1fc584(0x1);});});});});});}function addAdditionalPhone(_0x4ea992,_0x2c85a7,_0x10640b,_0x241dd0,_0x5f5bbb){return db[_0xbcd9('0x4c')][_0xbcd9('0x66')]({'where':{'CmContactId':_0x4ea992,'item':_0x2c85a7}})[_0xbcd9('0x18')](function(_0x30243e){if(_0x30243e)logger[_0xbcd9('0x32')](_0xbcd9('0x8e'),_0x30243e);else{db[_0xbcd9('0x4c')]['create']({'CmContactId':_0x4ea992,'item':_0x2c85a7,'ItemTypeId':_0x10640b,'OrderBy':_0x241dd0,'ItemClass':'PHONE','description':_0x5f5bbb});}});}function deleteCmHopperPhones(_0x4c5cee){return new Promise(function(_0x2a87cb){return db['CmHopper'][_0xbcd9('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4c5cee}})['then'](function(_0xb52500){db['CmHopperAdditionalPhone'][_0xbcd9('0x19')]({'where':{'CmHopperId':{'$in':_['map'](_0xb52500,'id')}}});})[_0xbcd9('0x18')](function(){_0x2a87cb(0x1);});});}function addCmHopperPhones(_0x2ce382){return new Promise(function(_0x4fb0b7){return db[_0xbcd9('0x8f')][_0xbcd9('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2ce382}})[_0xbcd9('0x18')](function(_0x2f3416){var _0x5a853c=[];_[_0xbcd9('0x6c')](_0x2f3416,function(_0x5901c9){_0x5a853c[_0xbcd9('0x62')](createCmHopperPhone(_0x2ce382,_0x5901c9['id']));});Promise['all'](_0x5a853c)[_0xbcd9('0x18')](function(){_0x4fb0b7(0x1);});});});}function createCmHopperPhone(_0x57a5ff,_0x160762){return new Promise(function(_0x346356){db[_0xbcd9('0x4c')][_0xbcd9('0x21')]({'raw':!![],'attributes':[_0xbcd9('0x90'),_0xbcd9('0x8d')],'where':{'CmContactId':_0x57a5ff,'ItemClass':_0xbcd9('0x91')},'include':[{'model':db[_0xbcd9('0x88')],'attributes':[_0xbcd9('0x8d')],'as':_0xbcd9('0x69')}],'order':[_0xbcd9('0x8d'),db[_0xbcd9('0x92')][_0xbcd9('0x93')]('`ItemType`.OrderBy')]})[_0xbcd9('0x18')](function(_0x2a3d25){var _0xea4e47=0x1;var _0x3737d2=_['map'](_0x2a3d25,function(_0x1d9b33){_0x1d9b33[_0xbcd9('0x94')]=_0x160762;_0x1d9b33['phone']=_0x1d9b33[_0xbcd9('0x90')];_0x1d9b33['OrderBy']=_0xea4e47;delete _0x1d9b33[_0xbcd9('0x95')];_0xea4e47=_0xea4e47+0x1;return _0x1d9b33;});return db[_0xbcd9('0x96')]['bulkCreate'](_0x3737d2,{});})['then'](function(){_0x346356(0x1);});});}function insertAdditionalPhones(_0x5a01f7,_0x503898){return new Promise(function(_0x57c0e7){var _0x4c9a87=[];for(var _0x1e1836=0x0;_0x1e1836<_0x503898['length'];_0x1e1836++){var _0x4d5c14=_0x503898[_0x1e1836];_0x4c9a87[_0xbcd9('0x62')](parseContactItemType(_0x4d5c14));}Promise['all'](_0x4c9a87)[_0xbcd9('0x18')](function(){var _0x2c80ec={'id':_0x5a01f7['id'],'items':_0x503898};return addAdditionalPhones(_0x2c80ec)['then'](function(){return addCmHopperPhones(_0x5a01f7['id']);});})[_0xbcd9('0x18')](function(){_0x57c0e7(_0x5a01f7);});});}function parseContactItemType(_0x764f69){return new Promise(function(_0x2f139b){if(_0x764f69[_0xbcd9('0x34')]('ItemTypeId')){_0x2f139b(_0x764f69);}else{return db[_0xbcd9('0x88')][_0xbcd9('0x66')]({'where':{'name':_0x764f69[_0xbcd9('0x69')]}})['then'](function(_0x5be25c){if(_[_0xbcd9('0x5a')](_0x5be25c))_0x764f69[_0xbcd9('0x8b')]=null;else _0x764f69['ItemTypeId']=_0x5be25c['id'];_0x2f139b(_0x764f69);});}});}exports[_0xbcd9('0x97')]=function(_0x1129c5,_0x510751){return db[_0xbcd9('0x4c')][_0xbcd9('0x21')]({'raw':!![],'where':{'CmContactId':_0x1129c5[_0xbcd9('0x26')]['id'],'ItemClass':_0xbcd9('0x91')},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[[_0xbcd9('0x8d')],[db[_0xbcd9('0x92')][_0xbcd9('0x93')]('`ItemType`.OrderBy')]]})[_0xbcd9('0x18')](function(_0x380cc2){return _0x380cc2;})['then'](respondWithResult(_0x510751,null))['catch'](handleError(_0x510751,null));};exports[_0xbcd9('0x98')]=function(_0xc8c27,_0x547b7b){return db[_0xbcd9('0x4c')][_0xbcd9('0x21')]({'raw':!![],'where':{'CmContactId':_0xc8c27[_0xbcd9('0x36')][_0xbcd9('0x99')]}})[_0xbcd9('0x18')](function(_0x43fbfb){var _0x3ce31d=_[_0xbcd9('0x6c')](_0x43fbfb,function(_0x27b807){_0x27b807[_0xbcd9('0x9a')]=_0xc8c27['body'][_0xbcd9('0x9b')];return _0x27b807;});return db['CmContactHasItem']['bulkCreate'](_0x3ce31d,{});})['then'](function(){return addCmHopperPhones(_0xc8c27['body'][_0xbcd9('0x9b')]);})[_0xbcd9('0x18')](function(){return['ok'];})[_0xbcd9('0x18')](respondWithResult(_0x547b7b,null))[_0xbcd9('0x24')](handleError(_0x547b7b,null));};exports['rescheduleAdditionalPhones']=function(_0x4deb46,_0xe32498){var _0x54e0b5=[];_0x54e0b5[_0xbcd9('0x62')](createCmHopperPhone(_0x4deb46['body']['id'],_0x4deb46[_0xbcd9('0x36')][_0xbcd9('0x9c')]));Promise['all'](_0x54e0b5)['then'](function(){return[0x1];})[_0xbcd9('0x18')](respondWithResult(_0xe32498,null));};exports[_0xbcd9('0x9d')]=function(_0x196108,_0x12719b){var _0xc970c4={'raw':![],'where':{}};var _0x398991={};var _0x297bbe={'count':0x0,'rows':[]};return db[_0xbcd9('0x25')][_0xbcd9('0x85')]({'where':{'id':_0x196108['params']['id']}})['then'](handleEntityNotFound(_0x12719b,null))[_0xbcd9('0x18')](function(_0x4b4fbf){if(_0x4b4fbf){_0x398991[_0xbcd9('0x7d')]=_[_0xbcd9('0x28')](db[_0xbcd9('0x8f')][_0xbcd9('0x7a')]);_0x398991['query']=_[_0xbcd9('0x28')](_0x196108[_0xbcd9('0x22')]);_0x398991['filters']=_[_0xbcd9('0x7c')](_0x398991[_0xbcd9('0x7d')],_0x398991[_0xbcd9('0x22')]);_0xc970c4[_0xbcd9('0x7e')]=_[_0xbcd9('0x7c')](_0x398991[_0xbcd9('0x7d')],qs[_0xbcd9('0x7f')](_0x196108[_0xbcd9('0x22')][_0xbcd9('0x7f')]));_0xc970c4[_0xbcd9('0x7e')]=_0xc970c4[_0xbcd9('0x7e')][_0xbcd9('0x29')]?_0xc970c4[_0xbcd9('0x7e')]:_0x398991[_0xbcd9('0x7d')];if(!_0x196108['query'][_0xbcd9('0x34')]('nolimit')){_0xc970c4[_0xbcd9('0x15')]=qs[_0xbcd9('0x15')](_0x196108['query'][_0xbcd9('0x15')]);_0xc970c4['offset']=qs[_0xbcd9('0x12')](_0x196108[_0xbcd9('0x22')][_0xbcd9('0x12')]);}_0xc970c4[_0xbcd9('0x80')]=qs[_0xbcd9('0x81')](_0x196108[_0xbcd9('0x22')]['sort']);_0xc970c4[_0xbcd9('0x60')]=qs[_0xbcd9('0x7b')](_[_0xbcd9('0x9e')](_0x196108[_0xbcd9('0x22')],_0x398991['filters']));_0xc970c4[_0xbcd9('0x60')][_0xbcd9('0x9f')]=_0x4b4fbf['id'];if(_0x196108[_0xbcd9('0x22')]['filter']){_0xc970c4['where']=_[_0xbcd9('0x35')](_0xc970c4[_0xbcd9('0x60')],{'$or':_[_0xbcd9('0x6c')](_0xc970c4[_0xbcd9('0x7e')],function(_0x15c533){var _0x1b53d5={};_0x1b53d5[_0x15c533]={'$like':'%'+_0x196108[_0xbcd9('0x22')]['filter']+'%'};return _0x1b53d5;})});}_0xc970c4=_['merge']({},_0xc970c4,_0x196108[_0xbcd9('0x83')]);return db[_0xbcd9('0x8f')]['count']({'where':_0xc970c4['where']})['then'](function(_0x8c0fbc){_0x297bbe[_0xbcd9('0x14')]=_0x8c0fbc;if(_0x196108['query'][_0xbcd9('0xa0')]){_0xc970c4[_0xbcd9('0xa1')]=[{'all':!![]}];}return db[_0xbcd9('0x8f')]['findAll'](_0xc970c4);})[_0xbcd9('0x18')](function(_0x149614){_0x297bbe['rows']=_0x149614;return _0x297bbe;});}})[_0xbcd9('0x18')](respondWithFilteredResult(_0x12719b,_0xc970c4))['catch'](handleError(_0x12719b,null));};exports['getHopperHistories']=function(_0x555ffe,_0x34493b){var _0x854027={'raw':!![],'where':{}};var _0x830a0f={};var _0x42284f={'count':0x0,'rows':[]};return db[_0xbcd9('0x25')][_0xbcd9('0x85')]({'where':{'id':_0x555ffe[_0xbcd9('0x26')]['id']}})['then'](handleEntityNotFound(_0x34493b,null))[_0xbcd9('0x18')](function(_0x2f35fc){if(_0x2f35fc){_0x830a0f[_0xbcd9('0x7d')]=_['keys'](db[_0xbcd9('0x4e')][_0xbcd9('0x7a')]);_0x830a0f[_0xbcd9('0x22')]=_[_0xbcd9('0x28')](_0x555ffe['query']);_0x830a0f[_0xbcd9('0x7b')]=_['intersection'](_0x830a0f[_0xbcd9('0x7d')],_0x830a0f[_0xbcd9('0x22')]);_0x854027[_0xbcd9('0x7e')]=_[_0xbcd9('0x7c')](_0x830a0f[_0xbcd9('0x7d')],qs[_0xbcd9('0x7f')](_0x555ffe[_0xbcd9('0x22')][_0xbcd9('0x7f')]));_0x854027[_0xbcd9('0x7e')]=_0x854027['attributes']['length']?_0x854027['attributes']:_0x830a0f['model'];if(!_0x555ffe[_0xbcd9('0x22')]['hasOwnProperty'](_0xbcd9('0xa2'))){_0x854027[_0xbcd9('0x15')]=qs[_0xbcd9('0x15')](_0x555ffe[_0xbcd9('0x22')][_0xbcd9('0x15')]);_0x854027['offset']=qs[_0xbcd9('0x12')](_0x555ffe[_0xbcd9('0x22')][_0xbcd9('0x12')]);}_0x854027['order']=qs['sort'](_0x555ffe[_0xbcd9('0x22')]['sort']);_0x854027['where']=qs[_0xbcd9('0x7b')](_[_0xbcd9('0x9e')](_0x555ffe['query'],_0x830a0f[_0xbcd9('0x7b')]));_0x854027[_0xbcd9('0x60')][_0xbcd9('0x9f')]=_0x2f35fc['id'];if(_0x555ffe[_0xbcd9('0x22')]['filter']){_0x854027[_0xbcd9('0x60')]=_[_0xbcd9('0x35')](_0x854027[_0xbcd9('0x60')],{'$or':_[_0xbcd9('0x6c')](_0x854027[_0xbcd9('0x7e')],function(_0x4cc4dc){var _0x479c55={};_0x479c55[_0x4cc4dc]={'$like':'%'+_0x555ffe[_0xbcd9('0x22')]['filter']+'%'};return _0x479c55;})});}_0x854027=_[_0xbcd9('0x35')]({},_0x854027,_0x555ffe[_0xbcd9('0x83')]);return db[_0xbcd9('0x4e')][_0xbcd9('0x14')]({'where':_0x854027[_0xbcd9('0x60')]})[_0xbcd9('0x18')](function(_0x123b76){_0x42284f[_0xbcd9('0x14')]=_0x123b76;if(_0x555ffe[_0xbcd9('0x22')][_0xbcd9('0xa0')]){_0x854027[_0xbcd9('0xa1')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xbcd9('0x21')](_0x854027);})[_0xbcd9('0x18')](function(_0x208a67){_0x42284f[_0xbcd9('0xa3')]=_0x208a67;return _0x42284f;});}})[_0xbcd9('0x18')](respondWithFilteredResult(_0x34493b,_0x854027))[_0xbcd9('0x24')](handleError(_0x34493b,null));};exports['getHopperFinals']=function(_0x653263,_0x29361b){var _0x547e0c={'raw':!![],'where':{}};var _0x5012cf={};var _0x3fe75c={'count':0x0,'rows':[]};return db[_0xbcd9('0x25')]['findOne']({'where':{'id':_0x653263[_0xbcd9('0x26')]['id']}})[_0xbcd9('0x18')](handleEntityNotFound(_0x29361b,null))[_0xbcd9('0x18')](function(_0x1e488f){if(_0x1e488f){_0x5012cf[_0xbcd9('0x7d')]=_[_0xbcd9('0x28')](db[_0xbcd9('0x4d')][_0xbcd9('0x7a')]);_0x5012cf[_0xbcd9('0x22')]=_[_0xbcd9('0x28')](_0x653263['query']);_0x5012cf[_0xbcd9('0x7b')]=_[_0xbcd9('0x7c')](_0x5012cf[_0xbcd9('0x7d')],_0x5012cf['query']);_0x547e0c['attributes']=_[_0xbcd9('0x7c')](_0x5012cf['model'],qs[_0xbcd9('0x7f')](_0x653263[_0xbcd9('0x22')]['fields']));_0x547e0c[_0xbcd9('0x7e')]=_0x547e0c[_0xbcd9('0x7e')][_0xbcd9('0x29')]?_0x547e0c[_0xbcd9('0x7e')]:_0x5012cf[_0xbcd9('0x7d')];if(!_0x653263[_0xbcd9('0x22')][_0xbcd9('0x34')]('nolimit')){_0x547e0c[_0xbcd9('0x15')]=qs[_0xbcd9('0x15')](_0x653263['query'][_0xbcd9('0x15')]);_0x547e0c['offset']=qs[_0xbcd9('0x12')](_0x653263[_0xbcd9('0x22')]['offset']);}_0x547e0c[_0xbcd9('0x80')]=qs['sort'](_0x653263[_0xbcd9('0x22')][_0xbcd9('0x81')]);_0x547e0c['where']=qs[_0xbcd9('0x7b')](_[_0xbcd9('0x9e')](_0x653263[_0xbcd9('0x22')],_0x5012cf[_0xbcd9('0x7b')]));_0x547e0c['where'][_0xbcd9('0x9f')]=_0x1e488f['id'];if(_0x653263[_0xbcd9('0x22')][_0xbcd9('0x82')]){_0x547e0c['where']=_['merge'](_0x547e0c[_0xbcd9('0x60')],{'$or':_[_0xbcd9('0x6c')](_0x547e0c[_0xbcd9('0x7e')],function(_0xaf7a82){var _0x57cdeb={};_0x57cdeb[_0xaf7a82]={'$like':'%'+_0x653263[_0xbcd9('0x22')][_0xbcd9('0x82')]+'%'};return _0x57cdeb;})});}_0x547e0c=_[_0xbcd9('0x35')]({},_0x547e0c,_0x653263[_0xbcd9('0x83')]);return db['CmHopperFinal'][_0xbcd9('0x14')]({'where':_0x547e0c['where']})[_0xbcd9('0x18')](function(_0x818f3d){_0x3fe75c[_0xbcd9('0x14')]=_0x818f3d;if(_0x653263[_0xbcd9('0x22')][_0xbcd9('0xa0')]){_0x547e0c[_0xbcd9('0xa1')]=[{'all':!![]}];}return db[_0xbcd9('0x4d')][_0xbcd9('0x21')](_0x547e0c);})['then'](function(_0x46ae5b){_0x3fe75c[_0xbcd9('0xa3')]=_0x46ae5b;return _0x3fe75c;});}})[_0xbcd9('0x18')](respondWithFilteredResult(_0x29361b,_0x547e0c))['catch'](handleError(_0x29361b,null));};exports[_0xbcd9('0xa4')]=function(_0x4bc7b2,_0x39aa6e){var _0x142c03={'raw':!![],'where':{}};var _0x3ee803={};var _0x5e67a2={'count':0x0,'rows':[]};return db[_0xbcd9('0x25')][_0xbcd9('0x85')]({'where':{'id':_0x4bc7b2[_0xbcd9('0x26')]['id']}})['then'](handleEntityNotFound(_0x39aa6e,null))[_0xbcd9('0x18')](function(_0x449342){if(_0x449342){_0x3ee803['model']=_[_0xbcd9('0x28')](db[_0xbcd9('0x56')]['rawAttributes']);_0x3ee803[_0xbcd9('0x22')]=_['keys'](_0x4bc7b2['query']);_0x3ee803[_0xbcd9('0x7b')]=_[_0xbcd9('0x7c')](_0x3ee803[_0xbcd9('0x7d')],_0x3ee803[_0xbcd9('0x22')]);_0x142c03['attributes']=_[_0xbcd9('0x7c')](_0x3ee803[_0xbcd9('0x7d')],qs[_0xbcd9('0x7f')](_0x4bc7b2[_0xbcd9('0x22')]['fields']));_0x142c03[_0xbcd9('0x7e')]=_0x142c03[_0xbcd9('0x7e')][_0xbcd9('0x29')]?_0x142c03[_0xbcd9('0x7e')]:_0x3ee803[_0xbcd9('0x7d')];if(!_0x4bc7b2[_0xbcd9('0x22')]['hasOwnProperty'](_0xbcd9('0xa2'))){_0x142c03[_0xbcd9('0x15')]=qs['limit'](_0x4bc7b2[_0xbcd9('0x22')][_0xbcd9('0x15')]);_0x142c03['offset']=qs['offset'](_0x4bc7b2[_0xbcd9('0x22')]['offset']);}_0x142c03['order']=qs[_0xbcd9('0x81')](_0x4bc7b2[_0xbcd9('0x22')][_0xbcd9('0x81')]);_0x142c03[_0xbcd9('0x60')]=qs[_0xbcd9('0x7b')](_[_0xbcd9('0x9e')](_0x4bc7b2['query'],_0x3ee803[_0xbcd9('0x7b')]));_0x142c03['where'][_0xbcd9('0x9f')]=_0x449342['id'];if(_0x4bc7b2[_0xbcd9('0x22')][_0xbcd9('0x82')]){_0x142c03['where']=_[_0xbcd9('0x35')](_0x142c03['where'],{'$or':_[_0xbcd9('0x6c')](_0x142c03[_0xbcd9('0x7e')],function(_0x467cac){var _0x18d4be={};_0x18d4be[_0x467cac]={'$like':'%'+_0x4bc7b2[_0xbcd9('0x22')][_0xbcd9('0x82')]+'%'};return _0x18d4be;})});}_0x142c03=_[_0xbcd9('0x35')]({},_0x142c03,_0x4bc7b2['options']);return db['JscriptySessionReport'][_0xbcd9('0x14')]({'where':_0x142c03[_0xbcd9('0x60')]})['then'](function(_0x2cd3ae){_0x5e67a2[_0xbcd9('0x14')]=_0x2cd3ae;if(_0x4bc7b2[_0xbcd9('0x22')]['includeAll']){_0x142c03[_0xbcd9('0xa1')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xbcd9('0x21')](_0x142c03);})[_0xbcd9('0x18')](function(_0x3cacb9){_0x5e67a2[_0xbcd9('0xa3')]=_0x3cacb9;return _0x5e67a2;});}})[_0xbcd9('0x18')](respondWithFilteredResult(_0x39aa6e,_0x142c03))[_0xbcd9('0x24')](handleError(_0x39aa6e,null));};exports[_0xbcd9('0xa5')]=function(_0x58926c,_0x12bf99){try{if(!_0x58926c['body'][_0xbcd9('0x63')]){throw new Error('No\x20ListId\x20specified');}if(!_0x58926c['body']['binding_keys']){throw new Error(_0xbcd9('0xa6'));}if(!_0x58926c[_0xbcd9('0x36')][_0xbcd9('0xa7')]){throw new Error(_0xbcd9('0xa8'));}if(!_0x58926c['body'][_0xbcd9('0xa9')]){throw new Error(_0xbcd9('0xaa'));}var _0x2e1717=_0x58926c[_0xbcd9('0x36')]['binding_keys'][_0xbcd9('0xab')](',');var _0x1f6f72=_0x58926c['body'][_0xbcd9('0xa7')]['split'](',');if(!_0x2e1717[_0xbcd9('0x29')]||!_0x1f6f72[_0xbcd9('0x29')]||_0x2e1717[_0xbcd9('0x29')]!==_0x1f6f72[_0xbcd9('0x29')]){throw new Error(_0xbcd9('0xac'));}_0x58926c[_0xbcd9('0x36')][_0xbcd9('0x7f')]=_[_0xbcd9('0xad')](_0x2e1717,_0x1f6f72);if(!_0x58926c[_0xbcd9('0x36')][_0xbcd9('0x7f')][_0xbcd9('0x78')]){throw new Error(_0xbcd9('0xae'));}if(!_0x58926c[_0xbcd9('0x36')][_0xbcd9('0x7f')][_0xbcd9('0xaf')]){throw new Error(_0xbcd9('0xb0'));}var _0x54b927=path[_0xbcd9('0x3a')](config[_0xbcd9('0xb1')],_0xbcd9('0xb2'),_0x58926c[_0xbcd9('0xb3')]['filename']);fs['chmodSync'](_0x54b927,parseInt(_0xbcd9('0xb4'),0x8));var _0x5473da=require(_0xbcd9('0xb5'))[_0xbcd9('0xb6')](path[_0xbcd9('0x3a')](__dirname,_0xbcd9('0xb7')),[_0x54b927,_0x58926c[_0xbcd9('0x36')][_0xbcd9('0xb8')],_0x58926c[_0xbcd9('0x36')][_0xbcd9('0xa7')],_0x58926c[_0xbcd9('0x36')]['ListId'],_0x58926c[_0xbcd9('0x36')][_0xbcd9('0xb9')],_0x58926c[_0xbcd9('0x36')][_0xbcd9('0x5f')],_0x58926c[_0xbcd9('0x36')][_0xbcd9('0xa9')]]);return _0x12bf99[_0xbcd9('0x10')](0xc8)[_0xbcd9('0x11')]({'message':_0xbcd9('0xba'),'pid':_0x5473da[_0xbcd9('0xbb')]});}catch(_0x259efe){return _0x12bf99[_0xbcd9('0x10')](0x1f4)['send'](_0x259efe);}};exports[_0xbcd9('0xbc')]=function(_0x4ed03a,_0x266371){var _0x4a4304=fs[_0xbcd9('0xbd')](_0x4ed03a[_0xbcd9('0xb3')][_0xbcd9('0x3')]);Papa[_0xbcd9('0xbe')](_0x4a4304,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3cc6c3){return _0x266371[_0xbcd9('0x10')](0xc8)[_0xbcd9('0x11')]({'file':_0x4ed03a['file'],'fields':_0x3cc6c3[_0xbcd9('0xbf')]['fields']});}});};exports[_0xbcd9('0xc0')]=function(_0x240e0c,_0x44246){return db[_0xbcd9('0xc1')][_0xbcd9('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbcd9('0xc2')}})[_0xbcd9('0x18')](function(_0x3eda32){var _0x5ecb4a=![];if(!_0x240e0c[_0xbcd9('0x36')][_0xbcd9('0x63')]){throw new Error(_0xbcd9('0xc3'));}if(!_0x240e0c[_0xbcd9('0x36')]['binding'][_0xbcd9('0x78')]){throw new Error(_0xbcd9('0xae'));}if(!_0x240e0c[_0xbcd9('0x36')]['binding'][_0xbcd9('0xaf')]){throw new Error(_0xbcd9('0xb0'));}if(!_0x240e0c['body'][_0xbcd9('0xa9')]){throw new Error(_0xbcd9('0xaa'));}var _0x5cf637=require(_0xbcd9('0xb5'))[_0xbcd9('0xb6')](path[_0xbcd9('0x3a')](__dirname,_0xbcd9('0xc4')),[_0x240e0c[_0xbcd9('0x26')]['id'],JSON[_0xbcd9('0xc5')](_0x240e0c['body']),JSON[_0xbcd9('0xc5')](_0x3eda32)]);_0x5cf637['on']('message',function(){_0x5ecb4a=!![];return _0x44246[_0xbcd9('0x10')](0xc8)['json']({'message':_0xbcd9('0xc6'),'pid':_0x5cf637[_0xbcd9('0xbb')]});});_0x5cf637['on']('exit',function(_0x2f01d9){if(_0x2f01d9&&!_0x5ecb4a){return _0x44246[_0xbcd9('0x10')](0x1f4)[_0xbcd9('0x11')]({'message':_0xbcd9('0xc7'),'pid':_0x5cf637['pid']});}});})[_0xbcd9('0x24')](handleError(_0x44246,null));};exports[_0xbcd9('0xc8')]=function(_0x1474ba,_0x2b4832){return db[_0xbcd9('0xc1')][_0xbcd9('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbcd9('0xc2')}})[_0xbcd9('0x18')](function(_0x21eed6){var _0x2d24a5=![];if(!_0x1474ba[_0xbcd9('0x36')][_0xbcd9('0x63')]){throw new Error(_0xbcd9('0xc3'));}if(!_0x1474ba[_0xbcd9('0x36')][_0xbcd9('0xc9')][_0xbcd9('0x78')]){throw new Error(_0xbcd9('0xae'));}if(!_0x1474ba[_0xbcd9('0x36')]['binding']['firstName']){throw new Error(_0xbcd9('0xb0'));}if(!_0x1474ba['body']['socket_timestamp']){throw new Error(_0xbcd9('0xaa'));}var _0x24b9ac=require('child_process')['fork'](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x1474ba[_0xbcd9('0x26')]['id'],JSON[_0xbcd9('0xc5')](_0x1474ba[_0xbcd9('0x36')]),JSON[_0xbcd9('0xc5')](_0x21eed6)]);_0x24b9ac['on']('message',function(){_0x2d24a5=!![];return _0x2b4832['status'](0xc8)['json']({'message':_0xbcd9('0xc6'),'pid':_0x24b9ac[_0xbcd9('0xbb')]});});_0x24b9ac['on']('exit',function(_0x2016ab){if(_0x2016ab&&!_0x2d24a5){return _0x2b4832[_0xbcd9('0x10')](0x1f4)['json']({'message':_0xbcd9('0xc7'),'pid':_0x24b9ac[_0xbcd9('0xbb')]});}});})['catch'](handleError(_0x2b4832,null));};exports[_0xbcd9('0xca')]=function(_0xef4b69,_0x582055){var _0x365b67=['mail','chat',_0xbcd9('0xcb'),_0xbcd9('0xcc'),_0xbcd9('0xcd'),'whatsapp',_0xbcd9('0xce')];var _0x218cab={'offset':0x0,'order':qs[_0xbcd9('0x81')]('-createdAt')},_0x56f91a={'count':0x0,'rows':[]};Promise[_0xbcd9('0xcf')]()[_0xbcd9('0x18')](function(){if(_0xef4b69[_0xbcd9('0x22')]['channel']){if(!_['includes'](_0x365b67,_0xef4b69[_0xbcd9('0x22')][_0xbcd9('0xd0')][_0xbcd9('0xd1')]())){throw new Error(_0xbcd9('0xd2'));}_0x365b67=[_0xef4b69[_0xbcd9('0x22')][_0xbcd9('0xd0')][_0xbcd9('0xd1')]()];}if(_0xef4b69[_0xbcd9('0x22')][_0xbcd9('0xd3')]){try{var _0x53c67e=JSON[_0xbcd9('0xbe')](_0xef4b69['query'][_0xbcd9('0xd3')]);if(!moment(_0x53c67e[_0xbcd9('0x37')])[_0xbcd9('0xd4')]()){throw new Error(_0xbcd9('0xd5'));}if(!moment(_0x53c67e['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x178ec5){throw new Error(_0xbcd9('0xd6'));}}if(!_0xef4b69[_0xbcd9('0x22')][_0xbcd9('0x34')]('nolimit')){_0x218cab[_0xbcd9('0x15')]=qs[_0xbcd9('0x15')](_0xef4b69[_0xbcd9('0x22')][_0xbcd9('0x15')]||0xa);_0x218cab[_0xbcd9('0x12')]=qs[_0xbcd9('0x12')](_0xef4b69[_0xbcd9('0x22')][_0xbcd9('0x12')]);}var _0x4ae996=_0x365b67[_0xbcd9('0x6c')](function(_0x4dbf63){if(_0x4dbf63===_0xbcd9('0xce')){var _0x56f921={'attributes':['id','uniqueid','type',_0xbcd9('0xd7'),_0xbcd9('0xd8'),'callerid',_0xbcd9('0xd9'),'endtime',_0xbcd9('0xda'),_0xbcd9('0xdb'),_0xbcd9('0xdc'),_0xbcd9('0xdd'),'userSecondDisposition',_0xbcd9('0xde'),_0xbcd9('0xdf')],'where':{'ContactId':_0xef4b69['params']['id']},'include':[{'model':db[_0xbcd9('0xc1')],'as':_0xbcd9('0xc1'),'attributes':['id',_0xbcd9('0x1d'),_0xbcd9('0xe0'),_0xbcd9('0x2f')]}],'order':[[_0xbcd9('0xdc'),_0xbcd9('0xe1')]]};if(_0xef4b69[_0xbcd9('0x22')]['range']){_0x56f921[_0xbcd9('0x60')]['createdAt']={'$gte':_0x53c67e[_0xbcd9('0x37')],'$lte':_0x53c67e['to']};}return db[_0xbcd9('0x50')]['findAndCountAll'](_0x56f921)[_0xbcd9('0x18')](function(_0x20c984){_0x56f91a[_0xbcd9('0x14')]+=_0x20c984[_0xbcd9('0x14')];return _[_0xbcd9('0x6c')](_0x20c984['rows'],function(_0xa8794d){var _0x3a44fd=_0xa8794d[_0xbcd9('0x38')]({'plain':!![]});_0x3a44fd[_0xbcd9('0xd0')]=_0x4dbf63;if(_0x3a44fd[_0xbcd9('0xc1')]){_0x3a44fd['User']={'id':_0x3a44fd[_0xbcd9('0xc1')]['id'],'name':_0x3a44fd[_0xbcd9('0xc1')][_0xbcd9('0x1d')],'fullname':_0x3a44fd[_0xbcd9('0xc1')][_0xbcd9('0xe0')],'alias':_0x3a44fd['User'][_0xbcd9('0x2f')]};}return _0x3a44fd;});});}else{var _0x36742a=_[_0xbcd9('0xe2')](_0x4dbf63)+(_0x4dbf63===_0xbcd9('0xe3')?_0xbcd9('0xe4'):'Account');var _0x30394f={'attributes':['id',_0xbcd9('0xe5'),'closedAt',_0xbcd9('0xdc'),_0xbcd9('0xdb'),'disposition',_0xbcd9('0xe6'),_0xbcd9('0xe7'),_0xbcd9('0xdf'),_0x36742a+'Id'],'where':{'ContactId':_0xef4b69[_0xbcd9('0x26')]['id']},'include':[{'model':db[_0x36742a],'as':_0xbcd9('0xe8'),'attributes':['id','name',_0xbcd9('0xe9')]},{'model':db[_0xbcd9('0xc1')],'as':_0xbcd9('0xea'),'attributes':['id',_0xbcd9('0x1d'),'fullname']},{'model':db['Tag'],'as':_0xbcd9('0xeb'),'attributes':['id',_0xbcd9('0x1d'),'color'],'through':{'attributes':[]}}],'order':[[_0xbcd9('0xdc'),_0xbcd9('0xe1')]]};if(_0xef4b69['query'][_0xbcd9('0xd3')]){_0x30394f[_0xbcd9('0x60')][_0xbcd9('0xdc')]={'$gte':_0x53c67e[_0xbcd9('0x37')],'$lte':_0x53c67e['to']};}switch(_0x4dbf63){case _0xbcd9('0xe3'):_0x30394f[_0xbcd9('0x7e')][_0xbcd9('0x62')](_0xbcd9('0xec'),_0xbcd9('0xed'),'customerPort',_0xbcd9('0xee'),'osName',_0xbcd9('0xef'),_0xbcd9('0xf0'),_0xbcd9('0xf1'),'referer');break;case _0xbcd9('0xf2'):_0x30394f[_0xbcd9('0x7e')][_0xbcd9('0x62')]('subject',_0xbcd9('0xf3'));break;case'openchannel':_0x30394f[_0xbcd9('0x7e')]['push'](_0xbcd9('0xf4'),_0xbcd9('0xf5'));break;}return db[_[_0xbcd9('0xe2')](_0x4dbf63)+_0xbcd9('0xf6')][_0xbcd9('0xf7')](_0x30394f)[_0xbcd9('0x18')](function(_0x217141){_0x56f91a[_0xbcd9('0x14')]+=_0x217141[_0xbcd9('0x14')];return _[_0xbcd9('0x6c')](_0x217141[_0xbcd9('0xa3')],function(_0x2bf626){var _0x47ca15=_0x2bf626[_0xbcd9('0x38')]({'plain':!![]});_0x47ca15['channel']=_0x4dbf63;if(_0x47ca15['Owner']){_0x47ca15['Owner']={'id':_0x47ca15['Owner']['id'],'name':_0x47ca15[_0xbcd9('0xea')][_0xbcd9('0x1d')],'fullname':_0x47ca15['Owner'][_0xbcd9('0xe0')]};}return _0x47ca15;});});}});return Promise[_0xbcd9('0x87')](_0x4ae996);})['then'](function(_0x3c6bc5){return _(_0x3c6bc5)['flatten']()['sortBy']('createdAt')[_0xbcd9('0xf8')]()['value']();})[_0xbcd9('0x18')](function(_0x533bad){_0x56f91a[_0xbcd9('0xa3')]=_0x218cab[_0xbcd9('0x15')]?_0x533bad[_0xbcd9('0xf9')](_0x218cab[_0xbcd9('0x12')],_0x218cab['offset']+_0x218cab[_0xbcd9('0x15')]):_0x533bad;return _0x56f91a;})[_0xbcd9('0x18')](respondWithFilteredResult(_0x582055,_0x218cab))['catch'](handleError(_0x582055,null));}; \ No newline at end of file +var _0xe9ee=['moment','util','path','lodash','squel','papaparse','ioredis','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','index','describe','findAll','query','user','catch','CmContact','find','params','tags','length','startsWith','displayName','CmCustomField','columnName','alias','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','ChatInteraction','ChatMessage','MailInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','create','isNil','dialTimezone','timezones','utcOffset','keys','additionalPhones','bulkCreate','each','duplicates','$or','push','where','findOrCreate','contact','all','Tag','color','Phones','ContactItemType','ItemType','sequelize','Phones.OrderBy','ListId','omit','map','format','cf_%d','pickBy','cf_','setFields','id\x20=\x20?','toParam','text','getTags','findOne','model','rawAttributes','intersection','attributes','fields','order','sort','filters','pick','filter','options','setTags','setAdditionalPhones','items','item_types','ItemTypeId','description','phone','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','literal','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','nolimit','ContactId','includeAll','include','rows','getHopperHistories','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_values','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','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','binding_keys','CompanyId','File\x20uploaded\x20correctly!','pid','send','createReadStream','parse','meta','import','User','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','fax','whatsapp','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','VoiceCallReport','findAndCountAll','startCase','Website','closed','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','deviceModel','osName','ratingMessage','ratingType','referer','subject','substatus','openchannel','externalUrl','threadId','Interaction','flatten','sortBy','reverse','value','slice'];(function(_0x261ae4,_0x3f10de){var _0x1790e0=function(_0x3ea9e4){while(--_0x3ea9e4){_0x261ae4['push'](_0x261ae4['shift']());}};_0x1790e0(++_0x3f10de);}(_0xe9ee,0x1f0));var _0xee9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9ee[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xee9e('0x0'));var BPromise=require('bluebird');var util=require(_0xee9e('0x1'));var path=require(_0xee9e('0x2'));var fs=require('fs');var _=require(_0xee9e('0x3'));var squel=require(_0xee9e('0x4'));var Papa=require(_0xee9e('0x5'));var Redis=require(_0xee9e('0x6'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require(_0xee9e('0x7'))('api');var config=require(_0xee9e('0x8'));var shared=require(_0xee9e('0x9'));var db=require(_0xee9e('0xa'))['db'];config[_0xee9e('0xb')]=_[_0xee9e('0xc')](config[_0xee9e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xee9e('0xd'))(new Redis(config[_0xee9e('0xb')]));require(_0xee9e('0xe'))[_0xee9e('0xf')](socket);function respondWithResult(_0x503e9c,_0x5adebd){_0x5adebd=_0x5adebd||0xc8;return function(_0x2bb2e2){if(_0x2bb2e2){return _0x503e9c[_0xee9e('0x10')](_0x5adebd)[_0xee9e('0x11')](_0x2bb2e2);}};}function respondWithFilteredResult(_0x5aaf02,_0x559f94){return function(_0xd36ea0){if(_0xd36ea0){var _0x8ae8e0=typeof _0x559f94[_0xee9e('0x12')]===_0xee9e('0x13')&&typeof _0x559f94['limit']==='undefined';var _0x13b887=_0xd36ea0[_0xee9e('0x14')];var _0x572a3a=_0x8ae8e0?0x0:_0x559f94[_0xee9e('0x12')];var _0xee1eed=_0x8ae8e0?_0xd36ea0[_0xee9e('0x14')]:_0x559f94[_0xee9e('0x12')]+_0x559f94[_0xee9e('0x15')];var _0x269084;if(_0xee1eed>=_0x13b887){_0xee1eed=_0x13b887;_0x269084=0xc8;}else{_0x269084=0xce;}_0x5aaf02['status'](_0x269084);return _0x5aaf02[_0xee9e('0x16')](_0xee9e('0x17'),_0x572a3a+'-'+_0xee1eed+'/'+_0x13b887)[_0xee9e('0x11')](_0xd36ea0);}return null;};}function saveUpdates(_0x339cf8){return function(_0x1a4c8b){if(_0x1a4c8b){return _0x1a4c8b[_0xee9e('0x18')](_0x339cf8)[_0xee9e('0x19')](function(_0x123cf9){return _0x123cf9;});}return null;};}function removeEntity(_0x5508b5){return function(_0x59c96b){if(_0x59c96b){return _0x59c96b[_0xee9e('0x1a')]()[_0xee9e('0x19')](function(){_0x5508b5[_0xee9e('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e71f3){return function(_0x19aece){if(!_0x19aece){_0x2e71f3[_0xee9e('0x1b')](0x194);}return _0x19aece;};}function handleError(_0x2752cc,_0x40bbfa){_0x40bbfa=_0x40bbfa||0x1f4;return function(_0x4b43e2){logger[_0xee9e('0x1c')](_0x4b43e2[_0xee9e('0x1d')]);if(_0x4b43e2[_0xee9e('0x1e')]){delete _0x4b43e2['name'];}_0x2752cc[_0xee9e('0x10')](_0x40bbfa)['send'](_0x4b43e2);};}exports[_0xee9e('0x1f')]=function(_0x356a2c,_0x3613b){var _0x5f1366={};return contacts[_0xee9e('0x20')]()['then'](function(_0x3d7bed){_0x5f1366=qs['getOptions'](_0x3d7bed,_0x356a2c);return contacts[_0xee9e('0x21')](_0x356a2c[_0xee9e('0x22')],_0x356a2c[_0xee9e('0x23')],_0x5f1366,_0x3d7bed);})[_0xee9e('0x19')](respondWithFilteredResult(_0x3613b,_0x5f1366))[_0xee9e('0x24')](handleError(_0x3613b,null));};exports[_0xee9e('0x1a')]=function(_0x282ec5,_0x425162){return db[_0xee9e('0x25')][_0xee9e('0x26')]({'where':{'id':_0x282ec5[_0xee9e('0x27')]['id']}})[_0xee9e('0x19')](handleEntityNotFound(_0x425162,null))[_0xee9e('0x19')](removeEntity(_0x425162,null))['catch'](handleError(_0x425162,null));};exports[_0xee9e('0x20')]=function(_0x476049,_0x573878){return db[_0xee9e('0x25')]['describe']()['then'](function(_0x43f9c5){delete _0x43f9c5[_0xee9e('0x28')];for(var _0x342596=0x0;_0x3425960x0){return new Promise(function(_0x4ffbb6){var _0x2e7fc4=[];for(var _0x425e09=0x0;_0x425e09<_0x4d9bd6[_0xee9e('0x29')];_0x425e09++){_0x2e7fc4[_0xee9e('0x59')](insertAdditionalPhones(_0x4d9bd6[_0x425e09][_0xee9e('0x5c')],_0x4d9bd6[_0x425e09][_0xee9e('0x54')]));}Promise[_0xee9e('0x5d')](_0x2e7fc4)[_0xee9e('0x19')](function(){_0x4ffbb6(0x1);});})[_0xee9e('0x19')](function(){return{'success':_0x22522e,'failure':_0x343cc8,'duplicates':_0x43463c};});}else{return{'success':_0x22522e,'failure':_0x343cc8,'duplicates':_0x43463c};}}})[_0xee9e('0x19')](respondWithResult(_0x8755bd,0xc9))['catch'](handleError(_0x8755bd,null));};exports['show']=function(_0x57e39c,_0x4011ac){var _0x5bd0ab;return db[_0xee9e('0x25')][_0xee9e('0x20')]()[_0xee9e('0x19')](function(_0x203a3d){return db[_0xee9e('0x25')]['find']({'where':{'id':_0x57e39c[_0xee9e('0x27')]['id']},'include':[{'model':db[_0xee9e('0x5e')],'as':'Tags','attributes':['id',_0xee9e('0x1e'),_0xee9e('0x5f')],'required':_0x57e39c['query']['tag']?!![]:![]},{'model':db[_0xee9e('0x45')],'as':_0xee9e('0x60'),'where':{'CmContactId':_0x57e39c[_0xee9e('0x27')]['id']},'required':![],'include':[{'model':db[_0xee9e('0x61')],'as':_0xee9e('0x62')}]}],'order':[db[_0xee9e('0x63')]['literal'](_0xee9e('0x64'))],'attributes':_[_0xee9e('0x53')](_0x203a3d)});})[_0xee9e('0x19')](function(_0x8eb3a6){if(!_['isNil'](_0x8eb3a6)){_0x5bd0ab=_0x8eb3a6['get']({'plain':!![]});var _0x48b55e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x8eb3a6&&_0x8eb3a6[_0xee9e('0x65')]){if(_0x8eb3a6['ListId']){_0x48b55e['where']['$and']['push']({'ListId':{'$ne':_0x8eb3a6['ListId']}});}}return db['CmCustomField'][_0xee9e('0x21')](_0x48b55e);}})[_0xee9e('0x19')](function(_0x7dee1b){if(!_[_0xee9e('0x4f')](_0x7dee1b)){return _[_0xee9e('0x66')](_0x5bd0ab,_[_0xee9e('0x67')](_0x7dee1b,function(_0x4ece96){return util[_0xee9e('0x68')](_0xee9e('0x69'),_0x4ece96['id']);}));}})['then'](handleEntityNotFound(_0x4011ac,null))[_0xee9e('0x19')](respondWithResult(_0x4011ac,null))['catch'](handleError(_0x4011ac,null));};exports[_0xee9e('0x18')]=function(_0x5cd76f,_0x44914b){var _0x5c0531;if(_0x5cd76f[_0xee9e('0x36')]['id']){delete _0x5cd76f['body']['id'];}if(!_[_0xee9e('0x4f')](_0x5cd76f['body'][_0xee9e('0x50')])){var _0xd26ef4=_0x5cd76f['body'][_0xee9e('0x50')];if(!_['isNil'](shared[_0xee9e('0x51')][_0xd26ef4]))_0x5cd76f[_0xee9e('0x36')]['utcOffset']=shared[_0xee9e('0x51')][_0xd26ef4][_0xee9e('0x52')];}return db[_0xee9e('0x25')][_0xee9e('0x26')]({'where':{'id':_0x5cd76f[_0xee9e('0x27')]['id']}})['then'](handleEntityNotFound(_0x44914b,null))[_0xee9e('0x19')](saveUpdates(_0x5cd76f[_0xee9e('0x36')],null))['then'](function(_0x1832f9){_0x5c0531=_0x1832f9;var _0x1330a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1832f9&&_0x1832f9[_0xee9e('0x65')]){if(_0x1832f9['ListId']){_0x1330a5[_0xee9e('0x5a')]['$and'][_0xee9e('0x59')]({'ListId':{'$ne':_0x1832f9['ListId']}});}}return db['CmCustomField'][_0xee9e('0x21')](_0x1330a5);})[_0xee9e('0x19')](function(_0x22e9f7){if(_0x22e9f7){return _[_0xee9e('0x66')](_[_0xee9e('0x6a')](_0x5cd76f[_0xee9e('0x36')],function(_0x5ccaed,_0x3cf85e){return _[_0xee9e('0x2a')](_0x3cf85e,_0xee9e('0x6b'));}),_[_0xee9e('0x67')](_0x22e9f7,function(_0x140d54){return util[_0xee9e('0x68')](_0xee9e('0x69'),_0x140d54['id']);}));}})['then'](function(_0x89a42){if(_0x89a42&&!_['isEmpty'](_0x89a42)){var _0x39f263=squel[_0xee9e('0x18')]()['table']('cm_contacts')[_0xee9e('0x6c')](_0x89a42)[_0xee9e('0x5a')](_0xee9e('0x6d'),_0x5cd76f[_0xee9e('0x27')]['id'])[_0xee9e('0x6e')]();return db[_0xee9e('0x63')][_0xee9e('0x22')](_0x39f263[_0xee9e('0x6f')],{'replacements':_0x39f263['values']});}})[_0xee9e('0x19')](function(){if(_0x5cd76f[_0xee9e('0x36')]['phone']&&_0x5c0531){return db[_0xee9e('0x3d')][_0xee9e('0x18')]({'phone':_0x5cd76f[_0xee9e('0x36')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x5c0531['id']}});}})[_0xee9e('0x19')](function(){return _0x5c0531;})[_0xee9e('0x19')](respondWithResult(_0x44914b,null))['catch'](handleError(_0x44914b,null));};exports[_0xee9e('0x70')]=function(_0x119a64,_0x3e7235){var _0x513b7a={};var _0x25baba={};var _0x2dcf12;var _0x5840d6;return db['CmContact'][_0xee9e('0x71')]({'where':{'id':_0x119a64[_0xee9e('0x27')]['id']}})['then'](handleEntityNotFound(_0x3e7235,null))['then'](function(_0x324a26){if(_0x324a26){_0x2dcf12=_0x324a26;_0x25baba[_0xee9e('0x72')]=_[_0xee9e('0x53')](db[_0xee9e('0x5e')][_0xee9e('0x73')]);_0x25baba['query']=_[_0xee9e('0x53')](_0x119a64[_0xee9e('0x22')]);_0x25baba['filters']=_[_0xee9e('0x74')](_0x25baba[_0xee9e('0x72')],_0x25baba[_0xee9e('0x22')]);_0x513b7a[_0xee9e('0x75')]=_['intersection'](_0x25baba[_0xee9e('0x72')],qs[_0xee9e('0x76')](_0x119a64[_0xee9e('0x22')][_0xee9e('0x76')]));_0x513b7a[_0xee9e('0x75')]=_0x513b7a[_0xee9e('0x75')]['length']?_0x513b7a[_0xee9e('0x75')]:_0x25baba[_0xee9e('0x72')];_0x513b7a[_0xee9e('0x77')]=qs[_0xee9e('0x78')](_0x119a64[_0xee9e('0x22')][_0xee9e('0x78')]);_0x513b7a[_0xee9e('0x5a')]=qs[_0xee9e('0x79')](_[_0xee9e('0x7a')](_0x119a64[_0xee9e('0x22')],_0x25baba['filters']));if(_0x119a64[_0xee9e('0x22')][_0xee9e('0x7b')]){_0x513b7a[_0xee9e('0x5a')]=_[_0xee9e('0x35')](_0x513b7a['where'],{'$or':_[_0xee9e('0x67')](_0x513b7a[_0xee9e('0x75')],function(_0xeff65a){var _0x15c4de={};_0x15c4de[_0xeff65a]={'$like':'%'+_0x119a64[_0xee9e('0x22')][_0xee9e('0x7b')]+'%'};return _0x15c4de;})});}_0x513b7a=_[_0xee9e('0x35')]({},_0x513b7a,_0x119a64[_0xee9e('0x7c')]);return _0x2dcf12[_0xee9e('0x70')](_0x513b7a);}})[_0xee9e('0x19')](function(_0x31f58c){if(_0x31f58c){_0x5840d6=_0x31f58c[_0xee9e('0x29')];if(!_0x119a64[_0xee9e('0x22')][_0xee9e('0x34')]('nolimit')){_0x513b7a[_0xee9e('0x15')]=qs['limit'](_0x119a64['query'][_0xee9e('0x15')]);_0x513b7a[_0xee9e('0x12')]=qs[_0xee9e('0x12')](_0x119a64[_0xee9e('0x22')]['offset']);}return _0x2dcf12[_0xee9e('0x70')](_0x513b7a);}})[_0xee9e('0x19')](function(_0x304f6a){if(_0x304f6a){return _0x304f6a?{'count':_0x5840d6,'rows':_0x304f6a}:null;}})[_0xee9e('0x19')](respondWithResult(_0x3e7235,null))[_0xee9e('0x24')](handleError(_0x3e7235,null));};exports[_0xee9e('0x7d')]=function(_0xb73292,_0x3075d5){if(_0xb73292[_0xee9e('0x36')]['id']){delete _0xb73292[_0xee9e('0x36')]['id'];}return db[_0xee9e('0x25')]['findOne']({'where':{'id':_0xb73292[_0xee9e('0x27')]['id']}})['then'](handleEntityNotFound(_0x3075d5,null))[_0xee9e('0x19')](function(_0x2baefc){if(_0x2baefc){return _0x2baefc[_0xee9e('0x7d')](_0xb73292[_0xee9e('0x36')]['ids']||[]);}return null;})[_0xee9e('0x19')](respondWithResult(_0x3075d5,null))['catch'](handleError(_0x3075d5,null));};exports[_0xee9e('0x7e')]=function(_0x229a61,_0x217d3a){var _0x383793=[];_0x383793['push'](addAdditionalPhones(_0x229a61[_0xee9e('0x36')]));Promise[_0xee9e('0x5d')](_0x383793)[_0xee9e('0x19')](function(){_0x383793=[];_0x383793['push'](deleteCmHopperPhones(_0x229a61[_0xee9e('0x36')]['id']));_0x383793[_0xee9e('0x59')](addCmHopperPhones(_0x229a61[_0xee9e('0x36')]['id']));Promise[_0xee9e('0x5d')](_0x383793)['then'](function(){return[0x1];})[_0xee9e('0x19')](respondWithResult(_0x217d3a,null));});};function addAdditionalPhones(_0x99be1f){var _0x3c5e66;return new Promise(function(_0x15c43a){return db[_0xee9e('0x45')][_0xee9e('0x1a')]({'where':{'CmContactId':_0x99be1f['id']}})['then'](function(){db['ContactItemType']['findAll']({'raw':!![],'attributes':['id','OrderBy']})[_0xee9e('0x19')](function(_0x3dceb7){var _0x391490=[];for(var _0x29d4bd=0x0;_0x29d4bd<_0x99be1f[_0xee9e('0x7f')][_0xee9e('0x29')];_0x29d4bd++){var _0x3f4ec8=_0x99be1f[_0xee9e('0x80')]?_['isNil'](_0x99be1f[_0xee9e('0x80')][_0x29d4bd])?'':_0x99be1f[_0xee9e('0x80')][_0x29d4bd]:_0x99be1f[_0xee9e('0x7f')][_0x29d4bd][_0xee9e('0x81')]?_0x99be1f['items'][_0x29d4bd][_0xee9e('0x81')]:'';var _0xff0a96=_[_0xee9e('0x4f')](_0x99be1f[_0xee9e('0x7f')][_0x29d4bd]['description'])?'':_0x99be1f[_0xee9e('0x7f')][_0x29d4bd][_0xee9e('0x82')];var _0xa66d7b=_0x3f4ec8+':'+_0x99be1f[_0xee9e('0x7f')][_0x29d4bd]['phone']+'§'+_0xff0a96;if(_[_0xee9e('0x4f')](_0x3c5e66))_0x3c5e66=_0xa66d7b;else _0x3c5e66+=';'+_0xa66d7b;var _0x244f0e=null;var _0xba304e=null;if(_0x99be1f[_0xee9e('0x80')]){if(!_[_0xee9e('0x4f')](_0x99be1f[_0xee9e('0x80')][_0x29d4bd])){_0xba304e=_['find'](_0x3dceb7,function(_0x245d7e){return _0x245d7e['id']===_0x99be1f[_0xee9e('0x80')][_0x29d4bd];});if(!_[_0xee9e('0x4f')](_0xba304e)){_0x244f0e=_0xba304e['OrderBy'];}}}else{if(!_['isNil'](_0x99be1f[_0xee9e('0x7f')][_0x29d4bd])){_0xba304e=_['find'](_0x3dceb7,function(_0x551bfa){return _0x551bfa['id']===_0x99be1f[_0xee9e('0x7f')][_0x29d4bd]['ItemTypeId'];});if(!_['isNil'](_0xba304e)){_0x244f0e=_0x29d4bd;}}}if(_[_0xee9e('0x4f')](_0x244f0e)){_0x244f0e=0x64;}_0x391490['push'](addAdditionalPhone(_0x99be1f['id'],_0x99be1f[_0xee9e('0x7f')][_0x29d4bd][_0xee9e('0x83')],_0x99be1f[_0xee9e('0x80')]?_[_0xee9e('0x4f')](_0x99be1f[_0xee9e('0x80')][_0x29d4bd])?null:_0x99be1f[_0xee9e('0x80')][_0x29d4bd]:_0x99be1f['items'][_0x29d4bd][_0xee9e('0x81')]?_0x99be1f[_0xee9e('0x7f')][_0x29d4bd][_0xee9e('0x81')]:null,_0x244f0e,_0xff0a96));}Promise['all'](_0x391490)[_0xee9e('0x19')](function(){db[_0xee9e('0x25')][_0xee9e('0x18')]({'AdditionalPhones':_0x3c5e66},{'where':{'id':_0x99be1f['id']}})[_0xee9e('0x19')](function(){_0x15c43a(0x1);});});});});});}function addAdditionalPhone(_0x530e56,_0x381e56,_0x3650a6,_0x88d480,_0x2959f7){return db[_0xee9e('0x45')]['find']({'where':{'CmContactId':_0x530e56,'item':_0x381e56}})[_0xee9e('0x19')](function(_0x521677){if(_0x521677)logger[_0xee9e('0x31')](_0xee9e('0x84'),_0x521677);else{db[_0xee9e('0x45')][_0xee9e('0x4e')]({'CmContactId':_0x530e56,'item':_0x381e56,'ItemTypeId':_0x3650a6,'OrderBy':_0x88d480,'ItemClass':_0xee9e('0x85'),'description':_0x2959f7});}});}function deleteCmHopperPhones(_0x2f7c32){return new Promise(function(_0x580f60){return db[_0xee9e('0x3d')][_0xee9e('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2f7c32}})[_0xee9e('0x19')](function(_0x102689){db[_0xee9e('0x86')][_0xee9e('0x1a')]({'where':{'CmHopperId':{'$in':_['map'](_0x102689,'id')}}});})[_0xee9e('0x19')](function(){_0x580f60(0x1);});});}function addCmHopperPhones(_0x5cdc04){return new Promise(function(_0x13beda){return db[_0xee9e('0x3d')][_0xee9e('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5cdc04}})[_0xee9e('0x19')](function(_0x200384){var _0x5e37c2=[];_[_0xee9e('0x67')](_0x200384,function(_0x2e6154){_0x5e37c2[_0xee9e('0x59')](createCmHopperPhone(_0x5cdc04,_0x2e6154['id']));});Promise[_0xee9e('0x5d')](_0x5e37c2)[_0xee9e('0x19')](function(){_0x13beda(0x1);});});});}function createCmHopperPhone(_0x5a6f37,_0x46285f){return new Promise(function(_0x13228b){db['CmContactHasItem'][_0xee9e('0x21')]({'raw':!![],'attributes':[_0xee9e('0x87'),_0xee9e('0x88')],'where':{'CmContactId':_0x5a6f37,'ItemClass':_0xee9e('0x85')},'include':[{'model':db[_0xee9e('0x61')],'attributes':[_0xee9e('0x88')],'as':_0xee9e('0x62')}],'order':[_0xee9e('0x88'),db['sequelize']['literal']('`ItemType`.OrderBy')]})[_0xee9e('0x19')](function(_0x19e7f8){var _0x85df58=0x1;var _0x3ad9f2=_[_0xee9e('0x67')](_0x19e7f8,function(_0x2d4c2f){_0x2d4c2f[_0xee9e('0x89')]=_0x46285f;_0x2d4c2f['phone']=_0x2d4c2f[_0xee9e('0x87')];_0x2d4c2f['OrderBy']=_0x85df58;delete _0x2d4c2f[_0xee9e('0x8a')];_0x85df58=_0x85df58+0x1;return _0x2d4c2f;});return db['CmHopperAdditionalPhone']['bulkCreate'](_0x3ad9f2,{});})['then'](function(){_0x13228b(0x1);});});}function insertAdditionalPhones(_0x244e0c,_0x57d996){return new Promise(function(_0x3450f0){var _0x365b80=[];for(var _0x59efb4=0x0;_0x59efb4<_0x57d996[_0xee9e('0x29')];_0x59efb4++){var _0x3d98bd=_0x57d996[_0x59efb4];_0x365b80['push'](parseContactItemType(_0x3d98bd));}Promise[_0xee9e('0x5d')](_0x365b80)[_0xee9e('0x19')](function(){var _0x81e074={'id':_0x244e0c['id'],'items':_0x57d996};return addAdditionalPhones(_0x81e074)[_0xee9e('0x19')](function(){return addCmHopperPhones(_0x244e0c['id']);});})['then'](function(){_0x3450f0(_0x244e0c);});});}function parseContactItemType(_0x35dc6c){return new Promise(function(_0x13f64d){if(_0x35dc6c[_0xee9e('0x34')](_0xee9e('0x81'))){_0x13f64d(_0x35dc6c);}else{return db['ContactItemType'][_0xee9e('0x26')]({'where':{'name':_0x35dc6c['ItemType']}})['then'](function(_0x471b66){if(_[_0xee9e('0x4f')](_0x471b66))_0x35dc6c['ItemTypeId']=null;else _0x35dc6c[_0xee9e('0x81')]=_0x471b66['id'];_0x13f64d(_0x35dc6c);});}});}exports[_0xee9e('0x8b')]=function(_0x392ea2,_0x1595fc){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x392ea2[_0xee9e('0x27')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xee9e('0x61')],'as':_0xee9e('0x62')}],'order':[[_0xee9e('0x88')],[db[_0xee9e('0x63')][_0xee9e('0x8c')](_0xee9e('0x8d'))]]})[_0xee9e('0x19')](function(_0x50541e){return _0x50541e;})['then'](respondWithResult(_0x1595fc,null))[_0xee9e('0x24')](handleError(_0x1595fc,null));};exports[_0xee9e('0x8e')]=function(_0x253086,_0x48c97f){return db[_0xee9e('0x45')][_0xee9e('0x21')]({'raw':!![],'where':{'CmContactId':_0x253086[_0xee9e('0x36')][_0xee9e('0x8f')]}})[_0xee9e('0x19')](function(_0x511071){var _0x465870=_['map'](_0x511071,function(_0x5d6763){_0x5d6763[_0xee9e('0x90')]=_0x253086[_0xee9e('0x36')][_0xee9e('0x91')];return _0x5d6763;});return db[_0xee9e('0x45')][_0xee9e('0x55')](_0x465870,{});})[_0xee9e('0x19')](function(){return addCmHopperPhones(_0x253086[_0xee9e('0x36')][_0xee9e('0x91')]);})[_0xee9e('0x19')](function(){return['ok'];})['then'](respondWithResult(_0x48c97f,null))['catch'](handleError(_0x48c97f,null));};exports[_0xee9e('0x92')]=function(_0x38dfe3,_0x415d8d){var _0x37b609=[];_0x37b609[_0xee9e('0x59')](createCmHopperPhone(_0x38dfe3[_0xee9e('0x36')]['id'],_0x38dfe3[_0xee9e('0x36')]['hopperId']));Promise[_0xee9e('0x5d')](_0x37b609)[_0xee9e('0x19')](function(){return[0x1];})[_0xee9e('0x19')](respondWithResult(_0x415d8d,null));};exports[_0xee9e('0x93')]=function(_0x5f0ad7,_0x4995a6){var _0x24e2ef={'raw':![],'where':{}};var _0x297bef={};var _0x8aa5d4={'count':0x0,'rows':[]};return db['CmContact'][_0xee9e('0x71')]({'where':{'id':_0x5f0ad7['params']['id']}})[_0xee9e('0x19')](handleEntityNotFound(_0x4995a6,null))[_0xee9e('0x19')](function(_0x24278d){if(_0x24278d){_0x297bef[_0xee9e('0x72')]=_[_0xee9e('0x53')](db['CmHopper']['rawAttributes']);_0x297bef['query']=_[_0xee9e('0x53')](_0x5f0ad7[_0xee9e('0x22')]);_0x297bef[_0xee9e('0x79')]=_[_0xee9e('0x74')](_0x297bef[_0xee9e('0x72')],_0x297bef['query']);_0x24e2ef[_0xee9e('0x75')]=_['intersection'](_0x297bef['model'],qs['fields'](_0x5f0ad7['query'][_0xee9e('0x76')]));_0x24e2ef[_0xee9e('0x75')]=_0x24e2ef[_0xee9e('0x75')][_0xee9e('0x29')]?_0x24e2ef[_0xee9e('0x75')]:_0x297bef[_0xee9e('0x72')];if(!_0x5f0ad7['query'][_0xee9e('0x34')](_0xee9e('0x94'))){_0x24e2ef[_0xee9e('0x15')]=qs[_0xee9e('0x15')](_0x5f0ad7[_0xee9e('0x22')][_0xee9e('0x15')]);_0x24e2ef['offset']=qs[_0xee9e('0x12')](_0x5f0ad7[_0xee9e('0x22')]['offset']);}_0x24e2ef[_0xee9e('0x77')]=qs[_0xee9e('0x78')](_0x5f0ad7['query']['sort']);_0x24e2ef[_0xee9e('0x5a')]=qs[_0xee9e('0x79')](_[_0xee9e('0x7a')](_0x5f0ad7[_0xee9e('0x22')],_0x297bef[_0xee9e('0x79')]));_0x24e2ef[_0xee9e('0x5a')][_0xee9e('0x95')]=_0x24278d['id'];if(_0x5f0ad7[_0xee9e('0x22')][_0xee9e('0x7b')]){_0x24e2ef['where']=_[_0xee9e('0x35')](_0x24e2ef['where'],{'$or':_[_0xee9e('0x67')](_0x24e2ef['attributes'],function(_0x5b5333){var _0x498f00={};_0x498f00[_0x5b5333]={'$like':'%'+_0x5f0ad7['query'][_0xee9e('0x7b')]+'%'};return _0x498f00;})});}_0x24e2ef=_[_0xee9e('0x35')]({},_0x24e2ef,_0x5f0ad7[_0xee9e('0x7c')]);return db['CmHopper']['count']({'where':_0x24e2ef['where']})[_0xee9e('0x19')](function(_0x51c3af){_0x8aa5d4[_0xee9e('0x14')]=_0x51c3af;if(_0x5f0ad7[_0xee9e('0x22')][_0xee9e('0x96')]){_0x24e2ef[_0xee9e('0x97')]=[{'all':!![]}];}return db[_0xee9e('0x3d')][_0xee9e('0x21')](_0x24e2ef);})[_0xee9e('0x19')](function(_0x1b33df){_0x8aa5d4[_0xee9e('0x98')]=_0x1b33df;return _0x8aa5d4;});}})['then'](respondWithFilteredResult(_0x4995a6,_0x24e2ef))[_0xee9e('0x24')](handleError(_0x4995a6,null));};exports[_0xee9e('0x99')]=function(_0x3aa0d1,_0x2c3f95){var _0x234724={'raw':!![],'where':{}};var _0x422b71={};var _0x18347d={'count':0x0,'rows':[]};return db['CmContact'][_0xee9e('0x71')]({'where':{'id':_0x3aa0d1[_0xee9e('0x27')]['id']}})[_0xee9e('0x19')](handleEntityNotFound(_0x2c3f95,null))[_0xee9e('0x19')](function(_0x229709){if(_0x229709){_0x422b71[_0xee9e('0x72')]=_[_0xee9e('0x53')](db['CmHopperHistory'][_0xee9e('0x73')]);_0x422b71[_0xee9e('0x22')]=_['keys'](_0x3aa0d1[_0xee9e('0x22')]);_0x422b71[_0xee9e('0x79')]=_[_0xee9e('0x74')](_0x422b71['model'],_0x422b71['query']);_0x234724[_0xee9e('0x75')]=_['intersection'](_0x422b71[_0xee9e('0x72')],qs['fields'](_0x3aa0d1[_0xee9e('0x22')][_0xee9e('0x76')]));_0x234724['attributes']=_0x234724[_0xee9e('0x75')][_0xee9e('0x29')]?_0x234724[_0xee9e('0x75')]:_0x422b71[_0xee9e('0x72')];if(!_0x3aa0d1[_0xee9e('0x22')]['hasOwnProperty']('nolimit')){_0x234724[_0xee9e('0x15')]=qs['limit'](_0x3aa0d1['query'][_0xee9e('0x15')]);_0x234724['offset']=qs[_0xee9e('0x12')](_0x3aa0d1[_0xee9e('0x22')][_0xee9e('0x12')]);}_0x234724[_0xee9e('0x77')]=qs[_0xee9e('0x78')](_0x3aa0d1['query']['sort']);_0x234724[_0xee9e('0x5a')]=qs[_0xee9e('0x79')](_[_0xee9e('0x7a')](_0x3aa0d1[_0xee9e('0x22')],_0x422b71[_0xee9e('0x79')]));_0x234724['where']['ContactId']=_0x229709['id'];if(_0x3aa0d1[_0xee9e('0x22')][_0xee9e('0x7b')]){_0x234724['where']=_[_0xee9e('0x35')](_0x234724['where'],{'$or':_[_0xee9e('0x67')](_0x234724[_0xee9e('0x75')],function(_0x430445){var _0x551b78={};_0x551b78[_0x430445]={'$like':'%'+_0x3aa0d1[_0xee9e('0x22')][_0xee9e('0x7b')]+'%'};return _0x551b78;})});}_0x234724=_['merge']({},_0x234724,_0x3aa0d1['options']);return db[_0xee9e('0x47')][_0xee9e('0x14')]({'where':_0x234724[_0xee9e('0x5a')]})[_0xee9e('0x19')](function(_0x44ea18){_0x18347d['count']=_0x44ea18;if(_0x3aa0d1[_0xee9e('0x22')][_0xee9e('0x96')]){_0x234724['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xee9e('0x21')](_0x234724);})[_0xee9e('0x19')](function(_0x8127e4){_0x18347d['rows']=_0x8127e4;return _0x18347d;});}})[_0xee9e('0x19')](respondWithFilteredResult(_0x2c3f95,_0x234724))['catch'](handleError(_0x2c3f95,null));};exports[_0xee9e('0x9a')]=function(_0x4c91f7,_0x23559b){var _0x55b39f={'raw':!![],'where':{}};var _0x33ba3f={};var _0x38b90f={'count':0x0,'rows':[]};return db[_0xee9e('0x25')][_0xee9e('0x71')]({'where':{'id':_0x4c91f7[_0xee9e('0x27')]['id']}})['then'](handleEntityNotFound(_0x23559b,null))[_0xee9e('0x19')](function(_0x89d3b5){if(_0x89d3b5){_0x33ba3f[_0xee9e('0x72')]=_[_0xee9e('0x53')](db['CmHopperFinal'][_0xee9e('0x73')]);_0x33ba3f[_0xee9e('0x22')]=_[_0xee9e('0x53')](_0x4c91f7[_0xee9e('0x22')]);_0x33ba3f[_0xee9e('0x79')]=_[_0xee9e('0x74')](_0x33ba3f[_0xee9e('0x72')],_0x33ba3f[_0xee9e('0x22')]);_0x55b39f[_0xee9e('0x75')]=_[_0xee9e('0x74')](_0x33ba3f[_0xee9e('0x72')],qs[_0xee9e('0x76')](_0x4c91f7['query'][_0xee9e('0x76')]));_0x55b39f[_0xee9e('0x75')]=_0x55b39f[_0xee9e('0x75')]['length']?_0x55b39f['attributes']:_0x33ba3f[_0xee9e('0x72')];if(!_0x4c91f7[_0xee9e('0x22')][_0xee9e('0x34')]('nolimit')){_0x55b39f['limit']=qs[_0xee9e('0x15')](_0x4c91f7[_0xee9e('0x22')][_0xee9e('0x15')]);_0x55b39f['offset']=qs['offset'](_0x4c91f7[_0xee9e('0x22')][_0xee9e('0x12')]);}_0x55b39f[_0xee9e('0x77')]=qs['sort'](_0x4c91f7[_0xee9e('0x22')][_0xee9e('0x78')]);_0x55b39f['where']=qs['filters'](_[_0xee9e('0x7a')](_0x4c91f7[_0xee9e('0x22')],_0x33ba3f['filters']));_0x55b39f[_0xee9e('0x5a')][_0xee9e('0x95')]=_0x89d3b5['id'];if(_0x4c91f7['query']['filter']){_0x55b39f[_0xee9e('0x5a')]=_[_0xee9e('0x35')](_0x55b39f[_0xee9e('0x5a')],{'$or':_[_0xee9e('0x67')](_0x55b39f[_0xee9e('0x75')],function(_0x263809){var _0xa35635={};_0xa35635[_0x263809]={'$like':'%'+_0x4c91f7['query'][_0xee9e('0x7b')]+'%'};return _0xa35635;})});}_0x55b39f=_[_0xee9e('0x35')]({},_0x55b39f,_0x4c91f7[_0xee9e('0x7c')]);return db[_0xee9e('0x46')]['count']({'where':_0x55b39f['where']})['then'](function(_0x2519b3){_0x38b90f[_0xee9e('0x14')]=_0x2519b3;if(_0x4c91f7[_0xee9e('0x22')][_0xee9e('0x96')]){_0x55b39f[_0xee9e('0x97')]=[{'all':!![]}];}return db[_0xee9e('0x46')]['findAll'](_0x55b39f);})[_0xee9e('0x19')](function(_0x49624d){_0x38b90f['rows']=_0x49624d;return _0x38b90f;});}})[_0xee9e('0x19')](respondWithFilteredResult(_0x23559b,_0x55b39f))[_0xee9e('0x24')](handleError(_0x23559b,null));};exports['getJscriptySessions']=function(_0x384f81,_0x3103f4){var _0xdb8686={'raw':!![],'where':{}};var _0x5277c9={};var _0x16d211={'count':0x0,'rows':[]};return db[_0xee9e('0x25')][_0xee9e('0x71')]({'where':{'id':_0x384f81[_0xee9e('0x27')]['id']}})['then'](handleEntityNotFound(_0x3103f4,null))[_0xee9e('0x19')](function(_0x11820a){if(_0x11820a){_0x5277c9[_0xee9e('0x72')]=_['keys'](db[_0xee9e('0x4c')]['rawAttributes']);_0x5277c9[_0xee9e('0x22')]=_[_0xee9e('0x53')](_0x384f81[_0xee9e('0x22')]);_0x5277c9[_0xee9e('0x79')]=_['intersection'](_0x5277c9[_0xee9e('0x72')],_0x5277c9[_0xee9e('0x22')]);_0xdb8686[_0xee9e('0x75')]=_[_0xee9e('0x74')](_0x5277c9[_0xee9e('0x72')],qs[_0xee9e('0x76')](_0x384f81[_0xee9e('0x22')]['fields']));_0xdb8686[_0xee9e('0x75')]=_0xdb8686[_0xee9e('0x75')]['length']?_0xdb8686[_0xee9e('0x75')]:_0x5277c9[_0xee9e('0x72')];if(!_0x384f81[_0xee9e('0x22')][_0xee9e('0x34')]('nolimit')){_0xdb8686['limit']=qs[_0xee9e('0x15')](_0x384f81[_0xee9e('0x22')]['limit']);_0xdb8686[_0xee9e('0x12')]=qs[_0xee9e('0x12')](_0x384f81['query'][_0xee9e('0x12')]);}_0xdb8686['order']=qs[_0xee9e('0x78')](_0x384f81[_0xee9e('0x22')][_0xee9e('0x78')]);_0xdb8686[_0xee9e('0x5a')]=qs[_0xee9e('0x79')](_[_0xee9e('0x7a')](_0x384f81[_0xee9e('0x22')],_0x5277c9['filters']));_0xdb8686['where']['ContactId']=_0x11820a['id'];if(_0x384f81['query'][_0xee9e('0x7b')]){_0xdb8686[_0xee9e('0x5a')]=_[_0xee9e('0x35')](_0xdb8686[_0xee9e('0x5a')],{'$or':_[_0xee9e('0x67')](_0xdb8686[_0xee9e('0x75')],function(_0x128214){var _0x4b8538={};_0x4b8538[_0x128214]={'$like':'%'+_0x384f81['query']['filter']+'%'};return _0x4b8538;})});}_0xdb8686=_[_0xee9e('0x35')]({},_0xdb8686,_0x384f81[_0xee9e('0x7c')]);return db[_0xee9e('0x4c')]['count']({'where':_0xdb8686[_0xee9e('0x5a')]})['then'](function(_0x2b3b2c){_0x16d211['count']=_0x2b3b2c;if(_0x384f81[_0xee9e('0x22')][_0xee9e('0x96')]){_0xdb8686[_0xee9e('0x97')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xee9e('0x21')](_0xdb8686);})[_0xee9e('0x19')](function(_0x652b68){_0x16d211[_0xee9e('0x98')]=_0x652b68;return _0x16d211;});}})[_0xee9e('0x19')](respondWithFilteredResult(_0x3103f4,_0xdb8686))['catch'](handleError(_0x3103f4,null));};exports[_0xee9e('0x9b')]=function(_0x509c94,_0x19d893){try{if(!_0x509c94[_0xee9e('0x36')][_0xee9e('0x65')]){throw new Error(_0xee9e('0x9c'));}if(!_0x509c94[_0xee9e('0x36')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x509c94[_0xee9e('0x36')][_0xee9e('0x9d')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x509c94[_0xee9e('0x36')][_0xee9e('0x9e')]){throw new Error(_0xee9e('0x9f'));}var _0x322ef2=_0x509c94['body']['binding_keys'][_0xee9e('0xa0')](',');var _0x435136=_0x509c94['body'][_0xee9e('0x9d')][_0xee9e('0xa0')](',');if(!_0x322ef2[_0xee9e('0x29')]||!_0x435136[_0xee9e('0x29')]||_0x322ef2['length']!==_0x435136[_0xee9e('0x29')]){throw new Error(_0xee9e('0xa1'));}_0x509c94['body']['fields']=_[_0xee9e('0xa2')](_0x322ef2,_0x435136);if(!_0x509c94[_0xee9e('0x36')][_0xee9e('0x76')]['phone']){throw new Error(_0xee9e('0xa3'));}if(!_0x509c94[_0xee9e('0x36')][_0xee9e('0x76')][_0xee9e('0xa4')]){throw new Error(_0xee9e('0xa5'));}var _0x162c96=path[_0xee9e('0x3b')](config[_0xee9e('0xa6')],_0xee9e('0xa7'),_0x509c94[_0xee9e('0xa8')][_0xee9e('0xa9')]);fs[_0xee9e('0xaa')](_0x162c96,parseInt(_0xee9e('0xab'),0x8));var _0x14e46a=require(_0xee9e('0xac'))[_0xee9e('0xad')](path[_0xee9e('0x3b')](__dirname,_0xee9e('0xae')),[_0x162c96,_0x509c94['body'][_0xee9e('0xaf')],_0x509c94['body']['binding_values'],_0x509c94['body']['ListId'],_0x509c94[_0xee9e('0x36')][_0xee9e('0xb0')],_0x509c94['body'][_0xee9e('0x57')],_0x509c94[_0xee9e('0x36')][_0xee9e('0x9e')]]);return _0x19d893[_0xee9e('0x10')](0xc8)[_0xee9e('0x11')]({'message':_0xee9e('0xb1'),'pid':_0x14e46a[_0xee9e('0xb2')]});}catch(_0x34d514){return _0x19d893['status'](0x1f4)[_0xee9e('0xb3')](_0x34d514);}};exports['upload']=function(_0x1f3dfd,_0x519532){var _0x4b6920=fs[_0xee9e('0xb4')](_0x1f3dfd[_0xee9e('0xa8')][_0xee9e('0x2')]);Papa[_0xee9e('0xb5')](_0x4b6920,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x57126b){return _0x519532['status'](0xc8)[_0xee9e('0x11')]({'file':_0x1f3dfd['file'],'fields':_0x57126b[_0xee9e('0xb6')]['fields']});}});};exports[_0xee9e('0xb7')]=function(_0x35a2ba,_0x4654b7){return db[_0xee9e('0xb8')][_0xee9e('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xee9e('0xb9')}})[_0xee9e('0x19')](function(_0xbc0817){var _0x4bd41f=![];if(!_0x35a2ba[_0xee9e('0x36')][_0xee9e('0x65')]){throw new Error('No\x20ListId\x20specified');}if(!_0x35a2ba[_0xee9e('0x36')][_0xee9e('0xba')][_0xee9e('0x83')]){throw new Error(_0xee9e('0xa3'));}if(!_0x35a2ba[_0xee9e('0x36')][_0xee9e('0xba')]['firstName']){throw new Error(_0xee9e('0xa5'));}if(!_0x35a2ba[_0xee9e('0x36')][_0xee9e('0x9e')]){throw new Error(_0xee9e('0x9f'));}var _0x3a15a6=require(_0xee9e('0xac'))[_0xee9e('0xad')](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x35a2ba[_0xee9e('0x27')]['id'],JSON['stringify'](_0x35a2ba[_0xee9e('0x36')]),JSON[_0xee9e('0xbb')](_0xbc0817)]);_0x3a15a6['on'](_0xee9e('0xbc'),function(){_0x4bd41f=!![];return _0x4654b7['status'](0xc8)['json']({'message':_0xee9e('0xbd'),'pid':_0x3a15a6[_0xee9e('0xb2')]});});_0x3a15a6['on'](_0xee9e('0xbe'),function(_0x173f6f){if(_0x173f6f&&!_0x4bd41f){return _0x4654b7[_0xee9e('0x10')](0x1f4)[_0xee9e('0x11')]({'message':_0xee9e('0xbf'),'pid':_0x3a15a6[_0xee9e('0xb2')]});}});})[_0xee9e('0x24')](handleError(_0x4654b7,null));};exports['importUpdates']=function(_0x5741b4,_0x6c45b4){return db[_0xee9e('0xb8')][_0xee9e('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xee9e('0xb9')}})[_0xee9e('0x19')](function(_0xaf442f){var _0x1e4952=![];if(!_0x5741b4[_0xee9e('0x36')][_0xee9e('0x65')]){throw new Error(_0xee9e('0x9c'));}if(!_0x5741b4[_0xee9e('0x36')][_0xee9e('0xba')]['phone']){throw new Error(_0xee9e('0xa3'));}if(!_0x5741b4[_0xee9e('0x36')]['binding'][_0xee9e('0xa4')]){throw new Error(_0xee9e('0xa5'));}if(!_0x5741b4[_0xee9e('0x36')][_0xee9e('0x9e')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x496992=require(_0xee9e('0xac'))[_0xee9e('0xad')](path[_0xee9e('0x3b')](__dirname,_0xee9e('0xc0')),[_0x5741b4[_0xee9e('0x27')]['id'],JSON[_0xee9e('0xbb')](_0x5741b4['body']),JSON[_0xee9e('0xbb')](_0xaf442f)]);_0x496992['on'](_0xee9e('0xbc'),function(){_0x1e4952=!![];return _0x6c45b4[_0xee9e('0x10')](0xc8)['json']({'message':_0xee9e('0xbd'),'pid':_0x496992[_0xee9e('0xb2')]});});_0x496992['on'](_0xee9e('0xbe'),function(_0x503d0d){if(_0x503d0d&&!_0x1e4952){return _0x6c45b4['status'](0x1f4)[_0xee9e('0x11')]({'message':_0xee9e('0xbf'),'pid':_0x496992[_0xee9e('0xb2')]});}});})[_0xee9e('0x24')](handleError(_0x6c45b4,null));};exports[_0xee9e('0xc1')]=function(_0x3f907b,_0x1b8cbe){var _0x3c7242=[_0xee9e('0xc2'),_0xee9e('0xc3'),_0xee9e('0xc4'),'openchannel',_0xee9e('0xc5'),_0xee9e('0xc6'),'voice'];var _0x3c5a68={'offset':0x0,'order':qs[_0xee9e('0x78')](_0xee9e('0xc7'))},_0xe26c32={'count':0x0,'rows':[]};Promise['resolve']()[_0xee9e('0x19')](function(){if(_0x3f907b[_0xee9e('0x22')][_0xee9e('0xc8')]){if(!_[_0xee9e('0xc9')](_0x3c7242,_0x3f907b[_0xee9e('0x22')][_0xee9e('0xc8')][_0xee9e('0xca')]())){throw new Error(_0xee9e('0xcb'));}_0x3c7242=[_0x3f907b[_0xee9e('0x22')][_0xee9e('0xc8')]['toLowerCase']()];}if(_0x3f907b['query']['range']){try{var _0x5a0adc=JSON[_0xee9e('0xb5')](_0x3f907b[_0xee9e('0x22')][_0xee9e('0xcc')]);if(!moment(_0x5a0adc[_0xee9e('0x37')])[_0xee9e('0xcd')]()){throw new Error(_0xee9e('0xce'));}if(!moment(_0x5a0adc['to'])[_0xee9e('0xcd')]()){throw new Error(_0xee9e('0xcf'));}}catch(_0x590651){throw new Error(_0xee9e('0xd0'));}}if(!_0x3f907b['query'][_0xee9e('0x34')](_0xee9e('0x94'))){_0x3c5a68[_0xee9e('0x15')]=qs[_0xee9e('0x15')](_0x3f907b[_0xee9e('0x22')][_0xee9e('0x15')]||0xa);_0x3c5a68[_0xee9e('0x12')]=qs[_0xee9e('0x12')](_0x3f907b['query'][_0xee9e('0x12')]);}var _0x3dc346=_0x3c7242[_0xee9e('0x67')](function(_0x27cbab){if(_0x27cbab===_0xee9e('0xd1')){var _0x4d9817={'attributes':['id',_0xee9e('0xd2'),_0xee9e('0x2f'),_0xee9e('0xd3'),_0xee9e('0xd4'),'callerid','starttime','endtime','duration',_0xee9e('0xd5'),_0xee9e('0xd6'),_0xee9e('0xd7'),_0xee9e('0xd8'),_0xee9e('0xd9'),_0xee9e('0xda')],'where':{'ContactId':_0x3f907b[_0xee9e('0x27')]['id']},'include':[{'model':db[_0xee9e('0xb8')],'as':_0xee9e('0xb8'),'attributes':['id',_0xee9e('0x1e'),_0xee9e('0xdb'),_0xee9e('0x2e')]}],'order':[[_0xee9e('0xd6'),_0xee9e('0xdc')]]};if(_0x3f907b['query'][_0xee9e('0xcc')]){_0x4d9817['where'][_0xee9e('0xd6')]={'$gte':_0x5a0adc[_0xee9e('0x37')],'$lte':_0x5a0adc['to']};}return db[_0xee9e('0xdd')][_0xee9e('0xde')](_0x4d9817)['then'](function(_0x320649){_0xe26c32[_0xee9e('0x14')]+=_0x320649[_0xee9e('0x14')];return _[_0xee9e('0x67')](_0x320649[_0xee9e('0x98')],function(_0x2c537d){var _0x4eb53b=_0x2c537d[_0xee9e('0x38')]({'plain':!![]});_0x4eb53b[_0xee9e('0xc8')]=_0x27cbab;if(_0x4eb53b[_0xee9e('0xb8')]){_0x4eb53b[_0xee9e('0xb8')]={'id':_0x4eb53b[_0xee9e('0xb8')]['id'],'name':_0x4eb53b['User'][_0xee9e('0x1e')],'fullname':_0x4eb53b[_0xee9e('0xb8')][_0xee9e('0xdb')],'alias':_0x4eb53b['User'][_0xee9e('0x2e')]};}return _0x4eb53b;});});}else{var _0x30f1ec=_[_0xee9e('0xdf')](_0x27cbab)+(_0x27cbab===_0xee9e('0xc3')?_0xee9e('0xe0'):'Account');var _0x356d31={'attributes':['id',_0xee9e('0xe1'),'closedAt',_0xee9e('0xd6'),_0xee9e('0xd5'),_0xee9e('0xe2'),_0xee9e('0xe3'),_0xee9e('0xe4'),_0xee9e('0xda'),_0x30f1ec+'Id'],'where':{'ContactId':_0x3f907b[_0xee9e('0x27')]['id']},'include':[{'model':db[_0x30f1ec],'as':'Account','attributes':['id',_0xee9e('0x1e'),'key']},{'model':db[_0xee9e('0xb8')],'as':_0xee9e('0xe5'),'attributes':['id',_0xee9e('0x1e'),_0xee9e('0xdb')]},{'model':db[_0xee9e('0x5e')],'as':'Tags','attributes':['id',_0xee9e('0x1e'),_0xee9e('0x5f')],'through':{'attributes':[]}}],'order':[[_0xee9e('0xd6'),_0xee9e('0xdc')]]};if(_0x3f907b['query']['range']){_0x356d31['where'][_0xee9e('0xd6')]={'$gte':_0x5a0adc[_0xee9e('0x37')],'$lte':_0x5a0adc['to']};}switch(_0x27cbab){case _0xee9e('0xc3'):_0x356d31[_0xee9e('0x75')][_0xee9e('0x59')](_0xee9e('0xe6'),_0xee9e('0xe7'),'customerPort',_0xee9e('0xe8'),_0xee9e('0xe9'),_0xee9e('0xea'),_0xee9e('0xeb'),'ratingValue',_0xee9e('0xec'));break;case'mail':_0x356d31[_0xee9e('0x75')][_0xee9e('0x59')](_0xee9e('0xed'),_0xee9e('0xee'));break;case _0xee9e('0xef'):_0x356d31['attributes'][_0xee9e('0x59')](_0xee9e('0xf0'),_0xee9e('0xf1'));break;}return db[_[_0xee9e('0xdf')](_0x27cbab)+_0xee9e('0xf2')][_0xee9e('0xde')](_0x356d31)[_0xee9e('0x19')](function(_0x3b23b6){_0xe26c32[_0xee9e('0x14')]+=_0x3b23b6[_0xee9e('0x14')];return _[_0xee9e('0x67')](_0x3b23b6[_0xee9e('0x98')],function(_0x4eea7a){var _0x2ac1=_0x4eea7a[_0xee9e('0x38')]({'plain':!![]});_0x2ac1['channel']=_0x27cbab;if(_0x2ac1[_0xee9e('0xe5')]){_0x2ac1['Owner']={'id':_0x2ac1[_0xee9e('0xe5')]['id'],'name':_0x2ac1[_0xee9e('0xe5')][_0xee9e('0x1e')],'fullname':_0x2ac1[_0xee9e('0xe5')][_0xee9e('0xdb')]};}return _0x2ac1;});});}});return Promise[_0xee9e('0x5d')](_0x3dc346);})[_0xee9e('0x19')](function(_0x45f098){return _(_0x45f098)[_0xee9e('0xf3')]()[_0xee9e('0xf4')](_0xee9e('0xd6'))[_0xee9e('0xf5')]()[_0xee9e('0xf6')]();})['then'](function(_0x51d855){_0xe26c32[_0xee9e('0x98')]=_0x3c5a68['limit']?_0x51d855[_0xee9e('0xf7')](_0x3c5a68[_0xee9e('0x12')],_0x3c5a68[_0xee9e('0x12')]+_0x3c5a68[_0xee9e('0x15')]):_0x51d855;return _0xe26c32;})['then'](respondWithFilteredResult(_0x1b8cbe,_0x3c5a68))['catch'](handleError(_0x1b8cbe,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 270e792..740fd4a 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 _0x975f=['exports','events','CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4859bc,_0x11cbcb){var _0x5e20a8=function(_0x1e7766){while(--_0x1e7766){_0x4859bc['push'](_0x4859bc['shift']());}};_0x5e20a8(++_0x11cbcb);}(_0x975f,0x191));var _0xf975=function(_0x35b7d4,_0x5a5c43){_0x35b7d4=_0x35b7d4-0x0;var _0x4e8cee=_0x975f[_0x35b7d4];return _0x4e8cee;};'use strict';var EventEmitter=require(_0xf975('0x0'));var CmContact=require('../../mysqldb')['db'][_0xf975('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xf975('0x2')](0x0);var events={'afterCreate':_0xf975('0x3'),'afterUpdate':_0xf975('0x4'),'afterDestroy':_0xf975('0x5')};function emitEvent(_0x3791a1){return function(_0x521979,_0x9b38d1,_0x3fdb26){CmContactEvents['emit'](_0x3791a1+':'+_0x521979['id'],_0x521979);CmContactEvents[_0xf975('0x6')](_0x3791a1,_0x521979);_0x3fdb26(null);};}for(var e in events){if(events[_0xf975('0x7')](e)){var event=events[e];CmContact[_0xf975('0x8')](e,emitEvent(event));}}module[_0xf975('0x9')]=CmContactEvents; \ No newline at end of file +var _0x499a=['exports','events','../../mysqldb','CmContact','update','remove','emit','hasOwnProperty','hook'];(function(_0x549505,_0x4749b3){var _0x37787e=function(_0x15da0e){while(--_0x15da0e){_0x549505['push'](_0x549505['shift']());}};_0x37787e(++_0x4749b3);}(_0x499a,0xc7));var _0xa499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x499a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa499('0x0'));var CmContact=require(_0xa499('0x1'))['db'][_0xa499('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa499('0x3'),'afterDestroy':_0xa499('0x4')};function emitEvent(_0x41fc19){return function(_0x5cf486,_0x414563,_0x53ad6e){CmContactEvents[_0xa499('0x5')](_0x41fc19+':'+_0x5cf486['id'],_0x5cf486);CmContactEvents[_0xa499('0x5')](_0x41fc19,_0x5cf486);_0x53ad6e(null);};}for(var e in events){if(events[_0xa499('0x6')](e)){var event=events[e];CmContact[_0xa499('0x7')](e,emitEvent(event));}}module[_0xa499('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 3c134b3..a287551 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 _0x02c4=['utf8mb4','utf8mb4_unicode_ci','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','error','message','models','get','length','destroy','ContactId','push','info','inspect','util','../../config/logger','api','moment','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','resolve','findOne','isNil','utcOffset','minutes','format','phone','priority','callbackUniqueid','assign','CmHopper','then','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','dialCheckDuplicateType','always','outbound','CmList','Lists','ListId','all','map','findAll','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','mobile','fax','email'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x02c4,0x153));var _0x402c=function(_0xf77783,_0x1c93f4){_0xf77783=_0xf77783-0x0;var _0x1fc9cf=_0x02c4[_0xf77783];return _0x1fc9cf;};'use strict';var _=require('lodash');var util=require(_0x402c('0x0'));var logger=require(_0x402c('0x1'))(_0x402c('0x2'));var moment=require(_0x402c('0x3'));var shared=require('../../config/environment/shared');var attributes=require(_0x402c('0x4'));function getTimezoneCallbackAt(_0x3d96b9,_0x5d7cdc,_0x18b42c,_0x8a4463){var _0x1b68d3=_0x8a4463?_0x402c('0x5'):_0x402c('0x6');var _0x4f9dd1=_0x18b42c[_0x402c('0x7')]?_0x18b42c[_0x402c('0x7')]:moment()['format'](_0x402c('0x8'));if(_['isNil'](_0x18b42c[_0x402c('0x9')])){return Promise[_0x402c('0xa')](_0x4f9dd1);}return _0x3d96b9[_0x1b68d3][_0x402c('0xb')]({'where':{'id':_0x5d7cdc}})['then'](function(_0x461aaa){if(_[_0x402c('0xc')](_0x461aaa)||_[_0x402c('0xc')](_0x461aaa[_0x402c('0x9')])){return Promise[_0x402c('0xa')](_0x4f9dd1);}var _0x447926=shared['timezones'];var _0xd4e815=_0x447926[_0x461aaa[_0x402c('0x9')]];var _0x513773=_0x447926[_0x18b42c['dialTimezone']];if(_[_0x402c('0xc')](_0xd4e815)&&_[_0x402c('0xc')](_0x513773)){return Promise[_0x402c('0xa')](_0x4f9dd1);}var _0x8cc716=_0xd4e815[_0x402c('0xd')]-_0x513773[_0x402c('0xd')];var _0x5e4c18=_0x18b42c[_0x402c('0x7')]?_0x18b42c[_0x402c('0x7')]:moment();_0x4f9dd1=moment(_0x5e4c18)['add'](_0x8cc716,_0x402c('0xe'))[_0x402c('0xf')](_0x402c('0x8'));return Promise['resolve'](_0x4f9dd1);});}function getNewHopperPayload(_0x486084){return{'phone':_0x486084[_0x402c('0x10')],'ContactId':_0x486084['id'],'ListId':_0x486084['ListId'],'scheduledat':_0x486084['scheduledat']?_0x486084[_0x402c('0x7')]:moment()[_0x402c('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x486084[_0x402c('0x11')]?_0x486084[_0x402c('0x11')]:0x2,'callback':_0x486084[_0x402c('0x12')]?!![]:![],'callbackuniqueid':_0x486084['callbackUniqueid']?_0x486084[_0x402c('0x12')]:undefined,'callbackat':_0x486084[_0x402c('0x12')]?moment()[_0x402c('0xf')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x257697,_0x33277e,_0xe33e8e,_0x1a2d9a){var _0x4b5fce={'phone':_0xe33e8e[_0x402c('0x10')]};var _0x440e0a={'calleridnum':_0xe33e8e[_0x402c('0x10')]};if(_0x1a2d9a){Object[_0x402c('0x13')](_0x4b5fce,{'CampaignId':_0x33277e['id']});Object['assign'](_0x440e0a,{'CampaignId':_0x33277e['id']});}else{Object[_0x402c('0x13')](_0x4b5fce,{'VoiceQueueId':_0x33277e['id']});Object['assign'](_0x440e0a,{'VoiceQueueId':_0x33277e['id']});}return _0x257697[_0x402c('0x14')][_0x402c('0xb')]({'where':_0x4b5fce})[_0x402c('0x15')](function(_0x129bec){if(_0x129bec){throw new Error(_0x402c('0x16')+_0xe33e8e[_0x402c('0x10')]+_0x402c('0x17')+_0x33277e['id']);}return _0x257697[_0x402c('0x18')][_0x402c('0xb')]({'where':_0x440e0a});})[_0x402c('0x15')](function(_0x29e98d){if(_0x29e98d){throw new Error(_0x402c('0x19')+_0xe33e8e[_0x402c('0x10')]+_0x402c('0x17')+_0x33277e['id']);}var _0x122b09=getNewHopperPayload(_0xe33e8e);if(_0x1a2d9a){_0x122b09[_0x402c('0x1a')]=_0x33277e['id'];}else{_0x122b09[_0x402c('0x1b')]=_0x33277e['id'];}return _0x257697['CmHopper'][_0x402c('0x1c')](_0x122b09);});}function handleOnlyIfOpenCheckDuplicate(_0x2c3e30,_0x124f84,_0x2e7cf3,_0x47349d){var _0xbcbd91={'phone':_0x2e7cf3[_0x402c('0x10')]};if(_0x47349d){Object['assign'](_0xbcbd91,{'CampaignId':_0x124f84['id']});}else{Object['assign'](_0xbcbd91,{'VoiceQueueId':_0x124f84['id']});}return _0x2c3e30['CmHopper'][_0x402c('0xb')]({'where':_0xbcbd91})[_0x402c('0x15')](function(_0x28fc64){if(_0x28fc64){throw new Error(_0x402c('0x1d')+_0x2e7cf3[_0x402c('0x10')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x124f84['id']);}var _0x367864=getNewHopperPayload(_0x2e7cf3);if(_0x47349d){_0x367864[_0x402c('0x1a')]=_0x124f84['id'];}else{_0x367864['VoiceQueueId']=_0x124f84['id'];}return _0x2c3e30['CmHopper'][_0x402c('0x1c')](_0x367864);});}function handleNeverCheckDuplicate(_0x416ca8,_0x11fbcb,_0x1786af){var _0x4175e2=getNewHopperPayload(_0x1786af);_0x4175e2['VoiceQueueId']=_0x11fbcb['id'];return _0x416ca8[_0x402c('0x14')][_0x402c('0x1c')](_0x4175e2);}function handleCheckDuplicate(_0x3bf3f6,_0x88d34e,_0x61ddad,_0x8dc7c7){return getTimezoneCallbackAt(_0x3bf3f6,_0x88d34e,_0x61ddad,_0x8dc7c7)[_0x402c('0x15')](function(_0x19b851){_0x61ddad[_0x402c('0x7')]=_0x19b851;switch(_0x88d34e[_0x402c('0x1e')]){case _0x402c('0x1f'):return handleAlwaysCheckDuplicate(_0x3bf3f6,_0x88d34e,_0x61ddad,_0x8dc7c7);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x3bf3f6,_0x88d34e,_0x61ddad,_0x8dc7c7);default:return handleNeverCheckDuplicate(_0x3bf3f6,_0x88d34e,_0x61ddad);}});}function createHopperForVoiceQueues(_0x447900,_0x236158){return _0x447900[_0x402c('0x6')]['findAll']({'where':{'type':_0x402c('0x20')},'attributes':['id',_0x402c('0x1e'),_0x402c('0x9')],'include':[{'model':_0x447900[_0x402c('0x21')],'as':_0x402c('0x22'),'where':{'id':_0x236158[_0x402c('0x23')]}}],'raw':!![]})[_0x402c('0x15')](function(_0x19bb25){var _0xa46fdd=_0x19bb25['map'](function(_0x1c8390){return handleCheckDuplicate(_0x447900,_0x1c8390,_0x236158,![]);});return Promise[_0x402c('0x24')](_0xa46fdd);});}function createHopperForCampaigns(_0x31993d,_0x2cb863){return _0x31993d['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType',_0x402c('0x9')],'include':[{'model':_0x31993d[_0x402c('0x21')],'as':_0x402c('0x22'),'where':{'id':_0x2cb863[_0x402c('0x23')]}}],'raw':!![]})[_0x402c('0x15')](function(_0x56faee){var _0xee0cdf=_0x56faee[_0x402c('0x25')](function(_0x5ee5c2){return handleCheckDuplicate(_0x31993d,_0x5ee5c2,_0x2cb863,!![]);});return Promise['all'](_0xee0cdf);});}function createHopperBlackForVoiceQueues(_0x3831ca,_0x18fe10){return _0x3831ca[_0x402c('0x6')][_0x402c('0x26')]({'where':{'type':_0x402c('0x20')},'attributes':['id'],'include':[{'model':_0x3831ca[_0x402c('0x21')],'as':_0x402c('0x27'),'where':{'id':_0x18fe10[_0x402c('0x23')]}}],'raw':!![]})[_0x402c('0x15')](function(_0x39a806){var _0x531f77=_0x39a806[_0x402c('0x25')](function(_0x584dbd){return _0x3831ca[_0x402c('0x28')][_0x402c('0x1c')]({'phone':_0x18fe10[_0x402c('0x10')],'ContactId':_0x18fe10['id'],'ListId':_0x18fe10[_0x402c('0x23')],'VoiceQueueId':_0x584dbd['id']});});return Promise[_0x402c('0x24')](_0x531f77);});}function createHopperBlackForCampaigns(_0x2f8184,_0x57488d){return _0x2f8184['Campaign'][_0x402c('0x26')]({'attributes':['id'],'include':[{'model':_0x2f8184['CmList'],'as':_0x402c('0x27'),'where':{'id':_0x57488d[_0x402c('0x23')]}}],'raw':!![]})[_0x402c('0x15')](function(_0x1161d2){var _0x58af4d=_0x1161d2[_0x402c('0x25')](function(_0x284051){return _0x2f8184[_0x402c('0x28')]['create']({'phone':_0x57488d['phone'],'ContactId':_0x57488d['id'],'ListId':_0x57488d[_0x402c('0x23')],'CampaignId':_0x284051['id']});});return Promise[_0x402c('0x24')](_0x58af4d);});}module[_0x402c('0x29')]=function(_0x45f7db){return _0x45f7db[_0x402c('0x2a')](_0x402c('0x2b'),attributes,{'tableName':_0x402c('0x2c'),'paranoid':!![],'indexes':[{'name':_0x402c('0x10'),'fields':[_0x402c('0x10')]},{'name':_0x402c('0x2d'),'fields':[_0x402c('0x2e'),_0x402c('0x2f'),'phone',_0x402c('0x30'),_0x402c('0x31'),_0x402c('0x32')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x402c('0x33'),'collate':_0x402c('0x34'),'hooks':{'afterCreate':function(_0x86d164,_0x2d8e90,_0x6b3e87){var _0x24607b=_0x45f7db['models'];var _0x3d2edb=_0x86d164['get']({'plain':!![]});if(!_0x3d2edb[_0x402c('0x23')]){logger['error'](_0x402c('0x35')+_0x3d2edb['id']);return _0x6b3e87();}if(!_0x3d2edb[_0x402c('0x10')]){return _0x6b3e87();}return createHopperForVoiceQueues(_0x24607b,_0x3d2edb)[_0x402c('0x15')](function(){return createHopperBlackForVoiceQueues(_0x24607b,_0x3d2edb);})[_0x402c('0x15')](function(){return createHopperForCampaigns(_0x24607b,_0x3d2edb);})[_0x402c('0x15')](function(){return createHopperBlackForCampaigns(_0x24607b,_0x3d2edb);})[_0x402c('0x15')](function(){return _0x6b3e87();})[_0x402c('0x36')](function(_0x156028){logger[_0x402c('0x37')]('[cmContact][afterCreate]',_0x156028[_0x402c('0x38')]);_0x6b3e87();});},'afterDestroy':function(_0x35697d,_0x303ab4,_0x2ac058){var _0x1022f2=_0x45f7db[_0x402c('0x39')];var _0x5e54ae=_0x35697d[_0x402c('0x3a')]({'plain':!![]});return _0x1022f2[_0x402c('0x14')][_0x402c('0x26')]({'raw':!![],'where':{'ListId':_0x5e54ae['ListId'],'ContactId':_0x5e54ae['id']}})[_0x402c('0x15')](function(_0x2f7a93){if(!_['isEmpty'](_0x2f7a93)){var _0x4fe4f5=[];for(var _0x4d9575=0x0;_0x4d9575<_0x2f7a93[_0x402c('0x3b')];_0x4d9575+=0x1){var _0x2352d3=_0x1022f2[_0x402c('0x14')][_0x402c('0x3c')]({'where':{'ListId':_0x2f7a93[_0x4d9575][_0x402c('0x23')],'ContactId':_0x2f7a93[_0x4d9575][_0x402c('0x3d')],'VoiceQueueId':_0x2f7a93[_0x4d9575][_0x402c('0x1b')],'CampaignId':_0x2f7a93[_0x4d9575][_0x402c('0x1a')]}});_0x4fe4f5[_0x402c('0x3e')](_0x2352d3);}return Promise['all'](_0x4fe4f5);}})[_0x402c('0x15')](function(_0x6c5753){logger[_0x402c('0x3f')]('[CmContact][afterDestroy][Succesfull]',util[_0x402c('0x40')](_0x6c5753,{'showHidden':![],'depth':null}));_0x2ac058();})[_0x402c('0x36')](function(_0x23df0){logger['error']('[CmContact][afterDestroy][Error]',util[_0x402c('0x40')](_0x23df0,{'showHidden':![],'depth':null}));_0x2ac058(_0x23df0);});}}});}; \ No newline at end of file +var _0x5ec2=['./cmContact.attributes','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','findOne','then','timezones','dialTimezone','resolve','utcOffset','add','minutes','phone','priority','callbackUniqueid','assign','CmHopper','\x20in\x20Campaign\x20with\x20id\x20','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','dialCheckDuplicateType','onlyIfOpen','findAll','CmList','Lists','map','all','Campaign','ListId','outbound','CmHopperBlack','BlackLists','exports','define','CmContact','cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','isEmpty','destroy','ContactId','push','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment'];(function(_0x5c029a,_0x1b9150){var _0x5048b4=function(_0xb3abdb){while(--_0xb3abdb){_0x5c029a['push'](_0x5c029a['shift']());}};_0x5048b4(++_0x1b9150);}(_0x5ec2,0x13c));var _0x25ec=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0x5ec2[_0x28e74e];return _0xb45ac1;};'use strict';var _=require(_0x25ec('0x0'));var util=require(_0x25ec('0x1'));var logger=require(_0x25ec('0x2'))('api');var moment=require(_0x25ec('0x3'));var shared=require('../../config/environment/shared');var attributes=require(_0x25ec('0x4'));function getTimezoneCallbackAt(_0x5be5bf,_0x5260da,_0xa6633d,_0x2f7a4c){var _0xd1eec6=_0x2f7a4c?'Campaign':_0x25ec('0x5');var _0x548693=_0xa6633d[_0x25ec('0x6')]?_0xa6633d[_0x25ec('0x6')]:moment()[_0x25ec('0x7')](_0x25ec('0x8'));if(_[_0x25ec('0x9')](_0xa6633d['dialTimezone'])){return Promise['resolve'](_0x548693);}return _0x5be5bf[_0xd1eec6][_0x25ec('0xa')]({'where':{'id':_0x5260da}})[_0x25ec('0xb')](function(_0x5183ad){if(_['isNil'](_0x5183ad)||_[_0x25ec('0x9')](_0x5183ad['dialTimezone'])){return Promise['resolve'](_0x548693);}var _0x31ebe9=shared[_0x25ec('0xc')];var _0x381cf3=_0x31ebe9[_0x5183ad['dialTimezone']];var _0x9e595d=_0x31ebe9[_0xa6633d[_0x25ec('0xd')]];if(_['isNil'](_0x381cf3)&&_[_0x25ec('0x9')](_0x9e595d)){return Promise[_0x25ec('0xe')](_0x548693);}var _0x1ceae0=_0x381cf3[_0x25ec('0xf')]-_0x9e595d[_0x25ec('0xf')];var _0x51727f=_0xa6633d[_0x25ec('0x6')]?_0xa6633d['scheduledat']:moment();_0x548693=moment(_0x51727f)[_0x25ec('0x10')](_0x1ceae0,_0x25ec('0x11'))['format'](_0x25ec('0x8'));return Promise[_0x25ec('0xe')](_0x548693);});}function getNewHopperPayload(_0x12f9f9){return{'phone':_0x12f9f9[_0x25ec('0x12')],'ContactId':_0x12f9f9['id'],'ListId':_0x12f9f9['ListId'],'scheduledat':_0x12f9f9['scheduledat']?_0x12f9f9[_0x25ec('0x6')]:moment()[_0x25ec('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x12f9f9[_0x25ec('0x13')]?_0x12f9f9[_0x25ec('0x13')]:0x2,'callback':_0x12f9f9[_0x25ec('0x14')]?!![]:![],'callbackuniqueid':_0x12f9f9[_0x25ec('0x14')]?_0x12f9f9[_0x25ec('0x14')]:undefined,'callbackat':_0x12f9f9['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x43d072,_0x3021e5,_0x54fc6c,_0x393c93){var _0x51bf6d={'phone':_0x54fc6c[_0x25ec('0x12')]};var _0x352246={'calleridnum':_0x54fc6c[_0x25ec('0x12')]};if(_0x393c93){Object[_0x25ec('0x15')](_0x51bf6d,{'CampaignId':_0x3021e5['id']});Object[_0x25ec('0x15')](_0x352246,{'CampaignId':_0x3021e5['id']});}else{Object[_0x25ec('0x15')](_0x51bf6d,{'VoiceQueueId':_0x3021e5['id']});Object['assign'](_0x352246,{'VoiceQueueId':_0x3021e5['id']});}return _0x43d072[_0x25ec('0x16')][_0x25ec('0xa')]({'where':_0x51bf6d})[_0x25ec('0xb')](function(_0xc88ef8){if(_0xc88ef8){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x54fc6c['phone']+_0x25ec('0x17')+_0x3021e5['id']);}return _0x43d072['CmHopperFinal']['findOne']({'where':_0x352246});})[_0x25ec('0xb')](function(_0x318304){if(_0x318304){throw new Error(_0x25ec('0x18')+_0x54fc6c['phone']+_0x25ec('0x17')+_0x3021e5['id']);}var _0x20fb3d=getNewHopperPayload(_0x54fc6c);if(_0x393c93){_0x20fb3d[_0x25ec('0x19')]=_0x3021e5['id'];}else{_0x20fb3d[_0x25ec('0x1a')]=_0x3021e5['id'];}return _0x43d072[_0x25ec('0x16')]['create'](_0x20fb3d);});}function handleOnlyIfOpenCheckDuplicate(_0x26b47f,_0x49ce70,_0x5b0a8a,_0x482e92){var _0x1c3b66={'phone':_0x5b0a8a[_0x25ec('0x12')]};if(_0x482e92){Object[_0x25ec('0x15')](_0x1c3b66,{'CampaignId':_0x49ce70['id']});}else{Object['assign'](_0x1c3b66,{'VoiceQueueId':_0x49ce70['id']});}return _0x26b47f[_0x25ec('0x16')][_0x25ec('0xa')]({'where':_0x1c3b66})[_0x25ec('0xb')](function(_0x1d7c8a){if(_0x1d7c8a){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x5b0a8a[_0x25ec('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x49ce70['id']);}var _0x3b93fe=getNewHopperPayload(_0x5b0a8a);if(_0x482e92){_0x3b93fe['CampaignId']=_0x49ce70['id'];}else{_0x3b93fe['VoiceQueueId']=_0x49ce70['id'];}return _0x26b47f[_0x25ec('0x16')][_0x25ec('0x1b')](_0x3b93fe);});}function handleNeverCheckDuplicate(_0x547540,_0x5c03e5,_0x230104){var _0x503cd4=getNewHopperPayload(_0x230104);_0x503cd4['VoiceQueueId']=_0x5c03e5['id'];return _0x547540['CmHopper'][_0x25ec('0x1b')](_0x503cd4);}function handleCheckDuplicate(_0x1c95a7,_0x390adf,_0x104d10,_0x531f7a){return getTimezoneCallbackAt(_0x1c95a7,_0x390adf,_0x104d10,_0x531f7a)['then'](function(_0x514600){_0x104d10[_0x25ec('0x6')]=_0x514600;switch(_0x390adf[_0x25ec('0x1c')]){case'always':return handleAlwaysCheckDuplicate(_0x1c95a7,_0x390adf,_0x104d10,_0x531f7a);case _0x25ec('0x1d'):return handleOnlyIfOpenCheckDuplicate(_0x1c95a7,_0x390adf,_0x104d10,_0x531f7a);default:return handleNeverCheckDuplicate(_0x1c95a7,_0x390adf,_0x104d10);}});}function createHopperForVoiceQueues(_0x49edee,_0x397228){return _0x49edee['VoiceQueue'][_0x25ec('0x1e')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType',_0x25ec('0xd')],'include':[{'model':_0x49edee[_0x25ec('0x1f')],'as':_0x25ec('0x20'),'where':{'id':_0x397228['ListId']}}],'raw':!![]})[_0x25ec('0xb')](function(_0x548224){var _0x3a4be5=_0x548224[_0x25ec('0x21')](function(_0x31ce35){return handleCheckDuplicate(_0x49edee,_0x31ce35,_0x397228,![]);});return Promise[_0x25ec('0x22')](_0x3a4be5);});}function createHopperForCampaigns(_0x5ef762,_0x403c66){return _0x5ef762[_0x25ec('0x23')][_0x25ec('0x1e')]({'attributes':['id',_0x25ec('0x1c'),_0x25ec('0xd')],'include':[{'model':_0x5ef762[_0x25ec('0x1f')],'as':_0x25ec('0x20'),'where':{'id':_0x403c66[_0x25ec('0x24')]}}],'raw':!![]})[_0x25ec('0xb')](function(_0x140f24){var _0x3f8e9c=_0x140f24[_0x25ec('0x21')](function(_0x22a397){return handleCheckDuplicate(_0x5ef762,_0x22a397,_0x403c66,!![]);});return Promise[_0x25ec('0x22')](_0x3f8e9c);});}function createHopperBlackForVoiceQueues(_0x255979,_0x1aa2a8){return _0x255979['VoiceQueue']['findAll']({'where':{'type':_0x25ec('0x25')},'attributes':['id'],'include':[{'model':_0x255979['CmList'],'as':'BlackLists','where':{'id':_0x1aa2a8[_0x25ec('0x24')]}}],'raw':!![]})[_0x25ec('0xb')](function(_0x43408c){var _0x4c488d=_0x43408c[_0x25ec('0x21')](function(_0x4a0297){return _0x255979[_0x25ec('0x26')][_0x25ec('0x1b')]({'phone':_0x1aa2a8['phone'],'ContactId':_0x1aa2a8['id'],'ListId':_0x1aa2a8['ListId'],'VoiceQueueId':_0x4a0297['id']});});return Promise[_0x25ec('0x22')](_0x4c488d);});}function createHopperBlackForCampaigns(_0xda6b07,_0x3f0a54){return _0xda6b07[_0x25ec('0x23')]['findAll']({'attributes':['id'],'include':[{'model':_0xda6b07[_0x25ec('0x1f')],'as':_0x25ec('0x27'),'where':{'id':_0x3f0a54[_0x25ec('0x24')]}}],'raw':!![]})[_0x25ec('0xb')](function(_0x4774a){var _0x15ac52=_0x4774a['map'](function(_0xbf14f5){return _0xda6b07[_0x25ec('0x26')][_0x25ec('0x1b')]({'phone':_0x3f0a54[_0x25ec('0x12')],'ContactId':_0x3f0a54['id'],'ListId':_0x3f0a54[_0x25ec('0x24')],'CampaignId':_0xbf14f5['id']});});return Promise[_0x25ec('0x22')](_0x15ac52);});}module[_0x25ec('0x28')]=function(_0x46e470){return _0x46e470[_0x25ec('0x29')](_0x25ec('0x2a'),attributes,{'tableName':_0x25ec('0x2b'),'paranoid':!![],'indexes':[{'name':_0x25ec('0x12'),'fields':['phone']},{'name':'fti_cm_contacts','fields':[_0x25ec('0x2c'),'lastName',_0x25ec('0x12'),_0x25ec('0x2d'),_0x25ec('0x2e'),_0x25ec('0x2f')],'type':_0x25ec('0x30')}],'timestamps':!![],'charset':_0x25ec('0x31'),'collate':_0x25ec('0x32'),'hooks':{'afterCreate':function(_0x11e3f8,_0xacb77f,_0x4be31b){var _0x18262b=_0x46e470[_0x25ec('0x33')];var _0x4f996f=_0x11e3f8[_0x25ec('0x34')]({'plain':!![]});if(!_0x4f996f[_0x25ec('0x24')]){logger[_0x25ec('0x35')](_0x25ec('0x36')+_0x4f996f['id']);return _0x4be31b();}if(!_0x4f996f[_0x25ec('0x12')]){return _0x4be31b();}return createHopperForVoiceQueues(_0x18262b,_0x4f996f)[_0x25ec('0xb')](function(){return createHopperBlackForVoiceQueues(_0x18262b,_0x4f996f);})['then'](function(){return createHopperForCampaigns(_0x18262b,_0x4f996f);})[_0x25ec('0xb')](function(){return createHopperBlackForCampaigns(_0x18262b,_0x4f996f);})['then'](function(){return _0x4be31b();})[_0x25ec('0x37')](function(_0x2b4cc4){logger['error'](_0x25ec('0x38'),_0x2b4cc4[_0x25ec('0x39')]);_0x4be31b();});},'afterDestroy':function(_0x41b840,_0x47c8ba,_0x5f4086){var _0x407372=_0x46e470['models'];var _0x14919b=_0x41b840['get']({'plain':!![]});return _0x407372[_0x25ec('0x16')][_0x25ec('0x1e')]({'raw':!![],'where':{'ListId':_0x14919b[_0x25ec('0x24')],'ContactId':_0x14919b['id']}})[_0x25ec('0xb')](function(_0x3fac64){if(!_[_0x25ec('0x3a')](_0x3fac64)){var _0x58cf29=[];for(var _0x118fd0=0x0;_0x118fd0<_0x3fac64['length'];_0x118fd0+=0x1){var _0x25db0e=_0x407372['CmHopper'][_0x25ec('0x3b')]({'where':{'ListId':_0x3fac64[_0x118fd0][_0x25ec('0x24')],'ContactId':_0x3fac64[_0x118fd0][_0x25ec('0x3c')],'VoiceQueueId':_0x3fac64[_0x118fd0][_0x25ec('0x1a')],'CampaignId':_0x3fac64[_0x118fd0][_0x25ec('0x19')]}});_0x58cf29[_0x25ec('0x3d')](_0x25db0e);}return Promise[_0x25ec('0x22')](_0x58cf29);}})['then'](function(_0x1260a3){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0x25ec('0x3e')](_0x1260a3,{'showHidden':![],'depth':null}));_0x5f4086();})['catch'](function(_0x5da54f){logger[_0x25ec('0x35')](_0x25ec('0x3f'),util[_0x25ec('0x3e')](_0x5da54f,{'showHidden':![],'depth':null}));_0x5f4086(_0x5da54f);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index fe5435b..27120e7 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2c16cf,_0x3d2ebf){var _0x255094=function(_0x19e05f){while(--_0x19e05f){_0x2c16cf['push'](_0x2c16cf['shift']());}};_0x255094(++_0x3d2ebf);}(_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['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 fe3ab9b..d0dd7d1 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 _0xb2b3=['INTEGER','STRING','PHONE','sequelize','exports'];(function(_0x5554ad,_0x415364){var _0x1405f2=function(_0x32c8a1){while(--_0x32c8a1){_0x5554ad['push'](_0x5554ad['shift']());}};_0x1405f2(++_0x415364);}(_0xb2b3,0x71));var _0x3b2b=function(_0x10f5ec,_0x2e7a97){_0x10f5ec=_0x10f5ec-0x0;var _0x49cc9d=_0xb2b3[_0x10f5ec];return _0x49cc9d;};'use strict';var Sequelize=require(_0x3b2b('0x0'));module[_0x3b2b('0x1')]={'CmContactId':{'type':Sequelize[_0x3b2b('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x3b2b('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x3b2b('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x3b2b('0x3')],'defaultValue':_0x3b2b('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x3b2b('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x1bca=['PHONE','STRING','exports','INTEGER'];(function(_0x11c577,_0x3de68b){var _0x369617=function(_0x13f187){while(--_0x13f187){_0x11c577['push'](_0x11c577['shift']());}};_0x369617(++_0x3de68b);}(_0x1bca,0xb6));var _0xa1bc=function(_0x52b05a,_0x1607be){_0x52b05a=_0x52b05a-0x0;var _0x21b3cb=_0x1bca[_0x52b05a];return _0x21b3cb;};'use strict';var Sequelize=require('sequelize');module[_0xa1bc('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa1bc('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xa1bc('0x2')},'OrderBy':{'type':Sequelize[_0xa1bc('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xa1bc('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 bae46f5..b688738 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 _0xad25=['includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','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','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','update','then','get','UserProfileResource','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','CmContactHasItem','rows','show','params'];(function(_0x154fda,_0x35676d){var _0x53c355=function(_0x4bd6df){while(--_0x4bd6df){_0x154fda['push'](_0x154fda['shift']());}};_0x53c355(++_0x35676d);}(_0xad25,0x161));var _0x5ad2=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xad25[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0x5ad2('0x0'));var rimraf=require(_0x5ad2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ad2('0x2'));var rp=require(_0x5ad2('0x3'));var moment=require(_0x5ad2('0x4'));var BPromise=require(_0x5ad2('0x5'));var Mustache=require(_0x5ad2('0x6'));var util=require(_0x5ad2('0x7'));var path=require(_0x5ad2('0x8'));var sox=require(_0x5ad2('0x9'));var csv=require(_0x5ad2('0xa'));var ejs=require(_0x5ad2('0xb'));var fs=require('fs');var fs_extra=require(_0x5ad2('0xc'));var _=require(_0x5ad2('0xd'));var squel=require(_0x5ad2('0xe'));var crypto=require(_0x5ad2('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5ad2('0xa'));var querystring=require(_0x5ad2('0x10'));var Papa=require(_0x5ad2('0x11'));var Redis=require(_0x5ad2('0x12'));var authService=require(_0x5ad2('0x13'));var qs=require(_0x5ad2('0x14'));var as=require(_0x5ad2('0x15'));var hardwareService=require(_0x5ad2('0x16'));var logger=require('../../config/logger')(_0x5ad2('0x17'));var utils=require(_0x5ad2('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12ea78,_0x1943c0){_0x1943c0=_0x1943c0||0xcc;return function(_0x587600){if(_0x587600){return _0x12ea78[_0x5ad2('0x19')](_0x1943c0);}return _0x12ea78[_0x5ad2('0x1a')](_0x1943c0)['end']();};}function respondWithResult(_0x3a2c98,_0x3bb439){_0x3bb439=_0x3bb439||0xc8;return function(_0x53c11a){if(_0x53c11a){return _0x3a2c98[_0x5ad2('0x1a')](_0x3bb439)['json'](_0x53c11a);}};}function respondWithFilteredResult(_0x229ea7,_0x16cfde){return function(_0x3e8189){if(_0x3e8189){var _0x355a7e=typeof _0x16cfde[_0x5ad2('0x1b')]==='undefined'&&typeof _0x16cfde[_0x5ad2('0x1c')]==='undefined';var _0x1bc735=_0x3e8189[_0x5ad2('0x1d')];var _0x2beefa=_0x355a7e?0x0:_0x16cfde[_0x5ad2('0x1b')];var _0x1ed24e=_0x355a7e?_0x3e8189['count']:_0x16cfde[_0x5ad2('0x1b')]+_0x16cfde[_0x5ad2('0x1c')];var _0x21e8f1;if(_0x1ed24e>=_0x1bc735){_0x1ed24e=_0x1bc735;_0x21e8f1=0xc8;}else{_0x21e8f1=0xce;}_0x229ea7[_0x5ad2('0x1a')](_0x21e8f1);return _0x229ea7[_0x5ad2('0x1e')](_0x5ad2('0x1f'),_0x2beefa+'-'+_0x1ed24e+'/'+_0x1bc735)[_0x5ad2('0x20')](_0x3e8189);}return null;};}function patchUpdates(_0x1ed06b){return function(_0x14f3b4){try{jsonpatch[_0x5ad2('0x21')](_0x14f3b4,_0x1ed06b,!![]);}catch(_0x29de51){return BPromise[_0x5ad2('0x22')](_0x29de51);}return _0x14f3b4['save']();};}function saveUpdates(_0x36e9c0,_0x5243e7){return function(_0x61415d){if(_0x61415d){return _0x61415d[_0x5ad2('0x23')](_0x36e9c0)[_0x5ad2('0x24')](function(_0x44dab3){return _0x44dab3;});}return null;};}function removeEntity(_0x5daece,_0x4b7f88){return function(_0x47632d){if(_0x47632d){return _0x47632d['destroy']()['then'](function(){var _0x50a20c=_0x47632d[_0x5ad2('0x25')]({'plain':!![]});var _0x8419d6='CmContactHasItems';return db[_0x5ad2('0x26')][_0x5ad2('0x27')]({'where':{'type':_0x8419d6,'resourceId':_0x50a20c['id']}})[_0x5ad2('0x24')](function(){return _0x47632d;});})['then'](function(){_0x5daece[_0x5ad2('0x1a')](0xcc)[_0x5ad2('0x28')]();});}};}function handleEntityNotFound(_0x3b0450,_0x21f238){return function(_0x5d9742){if(!_0x5d9742){_0x3b0450['sendStatus'](0x194);}return _0x5d9742;};}function handleError(_0x194984,_0x211a36){_0x211a36=_0x211a36||0x1f4;return function(_0x1d35f9){logger[_0x5ad2('0x29')](_0x1d35f9['stack']);if(_0x1d35f9[_0x5ad2('0x2a')]){delete _0x1d35f9[_0x5ad2('0x2a')];}_0x194984[_0x5ad2('0x1a')](_0x211a36)[_0x5ad2('0x2b')](_0x1d35f9);};}exports['index']=function(_0x4335a6,_0x533721){var _0x25ce4b={},_0x11d7c3={},_0x21ca7c={'count':0x0,'rows':[]};var _0x12978f=_[_0x5ad2('0x2c')](db['CmContactHasItem'][_0x5ad2('0x2d')],function(_0x22e71d){return{'name':_0x22e71d[_0x5ad2('0x2e')],'type':_0x22e71d[_0x5ad2('0x2f')][_0x5ad2('0x30')]};});_0x11d7c3[_0x5ad2('0x31')]=_[_0x5ad2('0x2c')](_0x12978f,_0x5ad2('0x2a'));_0x11d7c3[_0x5ad2('0x32')]=_[_0x5ad2('0x33')](_0x4335a6[_0x5ad2('0x32')]);_0x11d7c3['filters']=_[_0x5ad2('0x34')](_0x11d7c3['model'],_0x11d7c3[_0x5ad2('0x32')]);_0x25ce4b['attributes']=_[_0x5ad2('0x34')](_0x11d7c3['model'],qs[_0x5ad2('0x35')](_0x4335a6['query'][_0x5ad2('0x35')]));_0x25ce4b[_0x5ad2('0x36')]=_0x25ce4b[_0x5ad2('0x36')][_0x5ad2('0x37')]?_0x25ce4b[_0x5ad2('0x36')]:_0x11d7c3[_0x5ad2('0x31')];if(!_0x4335a6['query'][_0x5ad2('0x38')](_0x5ad2('0x39'))){_0x25ce4b['limit']=qs['limit'](_0x4335a6['query'][_0x5ad2('0x1c')]);_0x25ce4b[_0x5ad2('0x1b')]=qs[_0x5ad2('0x1b')](_0x4335a6[_0x5ad2('0x32')][_0x5ad2('0x1b')]);}_0x25ce4b[_0x5ad2('0x3a')]=qs[_0x5ad2('0x3b')](_0x4335a6['query'][_0x5ad2('0x3b')]);_0x25ce4b[_0x5ad2('0x3c')]=qs[_0x5ad2('0x3d')](_[_0x5ad2('0x3e')](_0x4335a6[_0x5ad2('0x32')],_0x11d7c3[_0x5ad2('0x3d')]),_0x12978f);if(_0x4335a6['query'][_0x5ad2('0x3f')]){_0x25ce4b[_0x5ad2('0x3c')]=_[_0x5ad2('0x40')](_0x25ce4b[_0x5ad2('0x3c')],{'$or':_[_0x5ad2('0x2c')](_0x12978f,function(_0x36e010){if(_0x36e010[_0x5ad2('0x2f')]!==_0x5ad2('0x41')){var _0x1f0dc6={};_0x1f0dc6[_0x36e010[_0x5ad2('0x2a')]]={'$like':'%'+_0x4335a6[_0x5ad2('0x32')]['filter']+'%'};return _0x1f0dc6;}})});}_0x25ce4b=_[_0x5ad2('0x40')]({},_0x25ce4b,_0x4335a6[_0x5ad2('0x42')]);var _0x16c8a7={'where':_0x25ce4b['where']};return db['CmContactHasItem'][_0x5ad2('0x1d')](_0x16c8a7)[_0x5ad2('0x24')](function(_0x5b0aa8){_0x21ca7c['count']=_0x5b0aa8;if(_0x4335a6[_0x5ad2('0x32')]['includeAll']){_0x25ce4b[_0x5ad2('0x43')]=[{'all':!![]}];}return db[_0x5ad2('0x44')]['findAll'](_0x25ce4b);})['then'](function(_0x4f6bbb){_0x21ca7c[_0x5ad2('0x45')]=_0x4f6bbb;return _0x21ca7c;})[_0x5ad2('0x24')](respondWithFilteredResult(_0x533721,_0x25ce4b))['catch'](handleError(_0x533721,null));};exports[_0x5ad2('0x46')]=function(_0x5212df,_0x21d505){var _0x546afd={'raw':!![],'where':{'id':_0x5212df[_0x5ad2('0x47')]['id']}},_0x2706ad={};_0x2706ad[_0x5ad2('0x31')]=_['keys'](db[_0x5ad2('0x44')][_0x5ad2('0x2d')]);_0x2706ad['query']=_[_0x5ad2('0x33')](_0x5212df[_0x5ad2('0x32')]);_0x2706ad[_0x5ad2('0x3d')]=_[_0x5ad2('0x34')](_0x2706ad[_0x5ad2('0x31')],_0x2706ad[_0x5ad2('0x32')]);_0x546afd['attributes']=_[_0x5ad2('0x34')](_0x2706ad[_0x5ad2('0x31')],qs['fields'](_0x5212df[_0x5ad2('0x32')][_0x5ad2('0x35')]));_0x546afd[_0x5ad2('0x36')]=_0x546afd[_0x5ad2('0x36')][_0x5ad2('0x37')]?_0x546afd[_0x5ad2('0x36')]:_0x2706ad[_0x5ad2('0x31')];if(_0x5212df[_0x5ad2('0x32')][_0x5ad2('0x48')]){_0x546afd[_0x5ad2('0x43')]=[{'all':!![]}];}_0x546afd=_['merge']({},_0x546afd,_0x5212df[_0x5ad2('0x42')]);return db[_0x5ad2('0x44')][_0x5ad2('0x49')](_0x546afd)['then'](handleEntityNotFound(_0x21d505,null))['then'](respondWithResult(_0x21d505,null))[_0x5ad2('0x4a')](handleError(_0x21d505,null));};exports[_0x5ad2('0x4b')]=function(_0x282bbf,_0x165e53){return db['CmContactHasItem']['create'](_0x282bbf[_0x5ad2('0x4c')],{})['then'](function(_0x2dac4c){var _0x2b7d9d=_0x282bbf[_0x5ad2('0x4d')][_0x5ad2('0x25')]({'plain':!![]});if(!_0x2b7d9d)throw new Error(_0x5ad2('0x4e'));if(_0x2b7d9d[_0x5ad2('0x4f')]==='user'){var _0x3a6706=_0x2dac4c[_0x5ad2('0x25')]({'plain':!![]});var _0xa462d3=_0x5ad2('0x50');return db[_0x5ad2('0x51')][_0x5ad2('0x49')]({'where':{'name':_0xa462d3,'userProfileId':_0x2b7d9d[_0x5ad2('0x52')]},'raw':!![]})[_0x5ad2('0x24')](function(_0x248104){if(_0x248104&&_0x248104[_0x5ad2('0x53')]===0x0){return db[_0x5ad2('0x26')][_0x5ad2('0x4b')]({'name':_0x3a6706['name'],'resourceId':_0x3a6706['id'],'type':_0x248104[_0x5ad2('0x2a')],'sectionId':_0x248104['id']},{})[_0x5ad2('0x24')](function(){return _0x2dac4c;});}else{return _0x2dac4c;}})['catch'](function(_0x1140f6){logger[_0x5ad2('0x29')](_0x5ad2('0x54'),_0x1140f6);throw _0x1140f6;});}return _0x2dac4c;})['then'](respondWithResult(_0x165e53,0xc9))['catch'](handleError(_0x165e53,null));};exports[_0x5ad2('0x23')]=function(_0x25cee7,_0x598315){if(_0x25cee7[_0x5ad2('0x4c')]['id']){delete _0x25cee7[_0x5ad2('0x4c')]['id'];}return db[_0x5ad2('0x44')][_0x5ad2('0x49')]({'where':{'id':_0x25cee7[_0x5ad2('0x47')]['id']}})[_0x5ad2('0x24')](handleEntityNotFound(_0x598315,null))[_0x5ad2('0x24')](saveUpdates(_0x25cee7[_0x5ad2('0x4c')],null))[_0x5ad2('0x24')](respondWithResult(_0x598315,null))[_0x5ad2('0x4a')](handleError(_0x598315,null));};exports[_0x5ad2('0x27')]=function(_0x55a55c,_0x302cc4){return db[_0x5ad2('0x44')][_0x5ad2('0x49')]({'where':{'id':_0x55a55c[_0x5ad2('0x47')]['id']}})[_0x5ad2('0x24')](handleEntityNotFound(_0x302cc4,null))[_0x5ad2('0x24')](removeEntity(_0x302cc4,null))[_0x5ad2('0x4a')](handleError(_0x302cc4,null));}; \ No newline at end of file +var _0x9e12=['hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','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/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','end','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x9e12,0x116));var _0x29e1=function(_0x5b9fc7,_0x1c2f66){_0x5b9fc7=_0x5b9fc7-0x0;var _0x38751a=_0x9e12[_0x5b9fc7];return _0x38751a;};'use strict';var emlformat=require(_0x29e1('0x0'));var rimraf=require(_0x29e1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29e1('0x2'));var rp=require(_0x29e1('0x3'));var moment=require(_0x29e1('0x4'));var BPromise=require(_0x29e1('0x5'));var Mustache=require(_0x29e1('0x6'));var util=require(_0x29e1('0x7'));var path=require(_0x29e1('0x8'));var sox=require('sox');var csv=require(_0x29e1('0x9'));var ejs=require(_0x29e1('0xa'));var fs=require('fs');var fs_extra=require(_0x29e1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x29e1('0xc'));var jsforce=require(_0x29e1('0xd'));var deskjs=require(_0x29e1('0xe'));var toCsv=require(_0x29e1('0x9'));var querystring=require('querystring');var Papa=require(_0x29e1('0xf'));var Redis=require(_0x29e1('0x10'));var authService=require(_0x29e1('0x11'));var qs=require(_0x29e1('0x12'));var as=require(_0x29e1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x29e1('0x14'))('api');var utils=require(_0x29e1('0x15'));var config=require(_0x29e1('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e40da,_0xc5045c){_0xc5045c=_0xc5045c||0xcc;return function(_0x16bd13){if(_0x16bd13){return _0x4e40da[_0x29e1('0x17')](_0xc5045c);}return _0x4e40da[_0x29e1('0x18')](_0xc5045c)['end']();};}function respondWithResult(_0x3ce462,_0x5ed5df){_0x5ed5df=_0x5ed5df||0xc8;return function(_0x2d41c9){if(_0x2d41c9){return _0x3ce462[_0x29e1('0x18')](_0x5ed5df)[_0x29e1('0x19')](_0x2d41c9);}};}function respondWithFilteredResult(_0x179083,_0x11ebe3){return function(_0x317f70){if(_0x317f70){var _0x3aef86=typeof _0x11ebe3[_0x29e1('0x1a')]===_0x29e1('0x1b')&&typeof _0x11ebe3['limit']===_0x29e1('0x1b');var _0x1e6086=_0x317f70[_0x29e1('0x1c')];var _0x46b696=_0x3aef86?0x0:_0x11ebe3[_0x29e1('0x1a')];var _0x8fb71d=_0x3aef86?_0x317f70[_0x29e1('0x1c')]:_0x11ebe3[_0x29e1('0x1a')]+_0x11ebe3['limit'];var _0x1163c2;if(_0x8fb71d>=_0x1e6086){_0x8fb71d=_0x1e6086;_0x1163c2=0xc8;}else{_0x1163c2=0xce;}_0x179083[_0x29e1('0x18')](_0x1163c2);return _0x179083[_0x29e1('0x1d')](_0x29e1('0x1e'),_0x46b696+'-'+_0x8fb71d+'/'+_0x1e6086)[_0x29e1('0x19')](_0x317f70);}return null;};}function patchUpdates(_0x385a06){return function(_0x254f4f){try{jsonpatch[_0x29e1('0x1f')](_0x254f4f,_0x385a06,!![]);}catch(_0x35ad7e){return BPromise[_0x29e1('0x20')](_0x35ad7e);}return _0x254f4f[_0x29e1('0x21')]();};}function saveUpdates(_0x39c541,_0x4115db){return function(_0x47fa99){if(_0x47fa99){return _0x47fa99[_0x29e1('0x22')](_0x39c541)['then'](function(_0x1bc02e){return _0x1bc02e;});}return null;};}function removeEntity(_0x3c06d4,_0x31880b){return function(_0x202e03){if(_0x202e03){return _0x202e03[_0x29e1('0x23')]()[_0x29e1('0x24')](function(){var _0x3f310f=_0x202e03[_0x29e1('0x25')]({'plain':!![]});var _0x25b3e3='CmContactHasItems';return db['UserProfileResource'][_0x29e1('0x23')]({'where':{'type':_0x25b3e3,'resourceId':_0x3f310f['id']}})[_0x29e1('0x24')](function(){return _0x202e03;});})[_0x29e1('0x24')](function(){_0x3c06d4['status'](0xcc)[_0x29e1('0x26')]();});}};}function handleEntityNotFound(_0x3c9279,_0x5ee628){return function(_0x5d03b6){if(!_0x5d03b6){_0x3c9279[_0x29e1('0x17')](0x194);}return _0x5d03b6;};}function handleError(_0x527e05,_0xee331){_0xee331=_0xee331||0x1f4;return function(_0x5dd0c5){logger['error'](_0x5dd0c5[_0x29e1('0x27')]);if(_0x5dd0c5[_0x29e1('0x28')]){delete _0x5dd0c5['name'];}_0x527e05[_0x29e1('0x18')](_0xee331)[_0x29e1('0x29')](_0x5dd0c5);};}exports['index']=function(_0xeabe37,_0x37669f){var _0x37d4f4={},_0x107dad={},_0x3da886={'count':0x0,'rows':[]};var _0x26f973=_[_0x29e1('0x2a')](db[_0x29e1('0x2b')][_0x29e1('0x2c')],function(_0x416809){return{'name':_0x416809[_0x29e1('0x2d')],'type':_0x416809[_0x29e1('0x2e')]['key']};});_0x107dad[_0x29e1('0x2f')]=_['map'](_0x26f973,_0x29e1('0x28'));_0x107dad[_0x29e1('0x30')]=_[_0x29e1('0x31')](_0xeabe37[_0x29e1('0x30')]);_0x107dad[_0x29e1('0x32')]=_['intersection'](_0x107dad[_0x29e1('0x2f')],_0x107dad['query']);_0x37d4f4[_0x29e1('0x33')]=_['intersection'](_0x107dad[_0x29e1('0x2f')],qs[_0x29e1('0x34')](_0xeabe37[_0x29e1('0x30')]['fields']));_0x37d4f4[_0x29e1('0x33')]=_0x37d4f4[_0x29e1('0x33')][_0x29e1('0x35')]?_0x37d4f4[_0x29e1('0x33')]:_0x107dad[_0x29e1('0x2f')];if(!_0xeabe37['query'][_0x29e1('0x36')](_0x29e1('0x37'))){_0x37d4f4['limit']=qs[_0x29e1('0x38')](_0xeabe37[_0x29e1('0x30')][_0x29e1('0x38')]);_0x37d4f4['offset']=qs[_0x29e1('0x1a')](_0xeabe37[_0x29e1('0x30')][_0x29e1('0x1a')]);}_0x37d4f4['order']=qs[_0x29e1('0x39')](_0xeabe37[_0x29e1('0x30')]['sort']);_0x37d4f4[_0x29e1('0x3a')]=qs[_0x29e1('0x32')](_['pick'](_0xeabe37[_0x29e1('0x30')],_0x107dad[_0x29e1('0x32')]),_0x26f973);if(_0xeabe37[_0x29e1('0x30')][_0x29e1('0x3b')]){_0x37d4f4[_0x29e1('0x3a')]=_['merge'](_0x37d4f4[_0x29e1('0x3a')],{'$or':_[_0x29e1('0x2a')](_0x26f973,function(_0x29d1ef){if(_0x29d1ef[_0x29e1('0x2e')]!==_0x29e1('0x3c')){var _0x5043f6={};_0x5043f6[_0x29d1ef[_0x29e1('0x28')]]={'$like':'%'+_0xeabe37[_0x29e1('0x30')][_0x29e1('0x3b')]+'%'};return _0x5043f6;}})});}_0x37d4f4=_[_0x29e1('0x3d')]({},_0x37d4f4,_0xeabe37[_0x29e1('0x3e')]);var _0x359e0b={'where':_0x37d4f4['where']};return db[_0x29e1('0x2b')][_0x29e1('0x1c')](_0x359e0b)[_0x29e1('0x24')](function(_0x194428){_0x3da886[_0x29e1('0x1c')]=_0x194428;if(_0xeabe37[_0x29e1('0x30')][_0x29e1('0x3f')]){_0x37d4f4[_0x29e1('0x40')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x29e1('0x41')](_0x37d4f4);})[_0x29e1('0x24')](function(_0xf586e2){_0x3da886[_0x29e1('0x42')]=_0xf586e2;return _0x3da886;})['then'](respondWithFilteredResult(_0x37669f,_0x37d4f4))[_0x29e1('0x43')](handleError(_0x37669f,null));};exports[_0x29e1('0x44')]=function(_0xc2df0f,_0x500223){var _0x412abf={'raw':!![],'where':{'id':_0xc2df0f[_0x29e1('0x45')]['id']}},_0x58be17={};_0x58be17[_0x29e1('0x2f')]=_['keys'](db['CmContactHasItem'][_0x29e1('0x2c')]);_0x58be17['query']=_[_0x29e1('0x31')](_0xc2df0f[_0x29e1('0x30')]);_0x58be17[_0x29e1('0x32')]=_[_0x29e1('0x46')](_0x58be17['model'],_0x58be17[_0x29e1('0x30')]);_0x412abf[_0x29e1('0x33')]=_[_0x29e1('0x46')](_0x58be17[_0x29e1('0x2f')],qs[_0x29e1('0x34')](_0xc2df0f['query'][_0x29e1('0x34')]));_0x412abf['attributes']=_0x412abf[_0x29e1('0x33')][_0x29e1('0x35')]?_0x412abf[_0x29e1('0x33')]:_0x58be17[_0x29e1('0x2f')];if(_0xc2df0f[_0x29e1('0x30')][_0x29e1('0x3f')]){_0x412abf[_0x29e1('0x40')]=[{'all':!![]}];}_0x412abf=_[_0x29e1('0x3d')]({},_0x412abf,_0xc2df0f[_0x29e1('0x3e')]);return db[_0x29e1('0x2b')][_0x29e1('0x47')](_0x412abf)[_0x29e1('0x24')](handleEntityNotFound(_0x500223,null))[_0x29e1('0x24')](respondWithResult(_0x500223,null))[_0x29e1('0x43')](handleError(_0x500223,null));};exports[_0x29e1('0x48')]=function(_0x12c021,_0x448de2){return db[_0x29e1('0x2b')][_0x29e1('0x48')](_0x12c021[_0x29e1('0x49')],{})[_0x29e1('0x24')](function(_0x18f9d3){var _0x5c6ab3=_0x12c021[_0x29e1('0x4a')][_0x29e1('0x25')]({'plain':!![]});if(!_0x5c6ab3)throw new Error(_0x29e1('0x4b'));if(_0x5c6ab3[_0x29e1('0x4c')]===_0x29e1('0x4a')){var _0x1ef58c=_0x18f9d3[_0x29e1('0x25')]({'plain':!![]});var _0x5076b2='CmContactHasItems';return db[_0x29e1('0x4d')][_0x29e1('0x47')]({'where':{'name':_0x5076b2,'userProfileId':_0x5c6ab3[_0x29e1('0x4e')]},'raw':!![]})[_0x29e1('0x24')](function(_0x577fd7){if(_0x577fd7&&_0x577fd7[_0x29e1('0x4f')]===0x0){return db[_0x29e1('0x50')][_0x29e1('0x48')]({'name':_0x1ef58c['name'],'resourceId':_0x1ef58c['id'],'type':_0x577fd7['name'],'sectionId':_0x577fd7['id']},{})[_0x29e1('0x24')](function(){return _0x18f9d3;});}else{return _0x18f9d3;}})[_0x29e1('0x43')](function(_0x26576c){logger[_0x29e1('0x51')](_0x29e1('0x52'),_0x26576c);throw _0x26576c;});}return _0x18f9d3;})[_0x29e1('0x24')](respondWithResult(_0x448de2,0xc9))[_0x29e1('0x43')](handleError(_0x448de2,null));};exports[_0x29e1('0x22')]=function(_0x3d07ad,_0x9bd05e){if(_0x3d07ad[_0x29e1('0x49')]['id']){delete _0x3d07ad[_0x29e1('0x49')]['id'];}return db[_0x29e1('0x2b')][_0x29e1('0x47')]({'where':{'id':_0x3d07ad[_0x29e1('0x45')]['id']}})[_0x29e1('0x24')](handleEntityNotFound(_0x9bd05e,null))[_0x29e1('0x24')](saveUpdates(_0x3d07ad['body'],null))[_0x29e1('0x24')](respondWithResult(_0x9bd05e,null))[_0x29e1('0x43')](handleError(_0x9bd05e,null));};exports['destroy']=function(_0x415ede,_0x43d364){return db[_0x29e1('0x2b')][_0x29e1('0x47')]({'where':{'id':_0x415ede[_0x29e1('0x45')]['id']}})[_0x29e1('0x24')](handleEntityNotFound(_0x43d364,null))[_0x29e1('0x24')](removeEntity(_0x43d364,null))[_0x29e1('0x43')](handleError(_0x43d364,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index eb8e59d..5765551 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 _0x69b0=['lodash','../../config/logger','api','moment','path','rimraf','./cmContactHasItem.attributes','cm_contact_has_items'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x69b0,0x170));var _0x069b=function(_0x57f100,_0xa53aca){_0x57f100=_0x57f100-0x0;var _0x4cac01=_0x69b0[_0x57f100];return _0x4cac01;};'use strict';var _=require(_0x069b('0x0'));var util=require('util');var logger=require(_0x069b('0x1'))(_0x069b('0x2'));var moment=require(_0x069b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x069b('0x4'));var rimraf=require(_0x069b('0x5'));var config=require('../../config/environment');var attributes=require(_0x069b('0x6'));module['exports']=function(_0x5daba8,_0x32d943){return _0x5daba8['define']('CmContactHasItem',attributes,{'tableName':_0x069b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24fd=['moment','bluebird','path','rimraf','../../config/environment','exports','define','CmContactHasItem','lodash','api'];(function(_0x18a3bd,_0x516c4d){var _0x19d11d=function(_0x560cea){while(--_0x560cea){_0x18a3bd['push'](_0x18a3bd['shift']());}};_0x19d11d(++_0x516c4d);}(_0x24fd,0xb2));var _0xd24f=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x24fd[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0xd24f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd24f('0x1'));var moment=require(_0xd24f('0x2'));var BPromise=require(_0xd24f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd24f('0x4'));var rimraf=require(_0xd24f('0x5'));var config=require(_0xd24f('0x6'));var attributes=require('./cmContactHasItem.attributes');module[_0xd24f('0x7')]=function(_0x42487f,_0x1f1356){return _0x42487f[_0xd24f('0x8')](_0xd24f('0x9'),attributes,{'tableName':'cm_contact_has_items','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 04d27e2..ed60954 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 _0x5e38=['CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmContactHasItem,\x20%s,\x20%s','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug'];(function(_0x491f42,_0x550f4c){var _0x318eb2=function(_0x5ac70f){while(--_0x5ac70f){_0x491f42['push'](_0x491f42['shift']());}};_0x318eb2(++_0x550f4c);}(_0x5e38,0x6b));var _0x85e3=function(_0x12e365,_0x2d4aa0){_0x12e365=_0x12e365-0x0;var _0x36d6d6=_0x5e38[_0x12e365];return _0x36d6d6;};'use strict';var _=require(_0x85e3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x85e3('0x1'));var fs=require('fs');var Redis=require(_0x85e3('0x2'));var db=require(_0x85e3('0x3'))['db'];var utils=require(_0x85e3('0x4'));var logger=require(_0x85e3('0x5'))(_0x85e3('0x6'));var config=require(_0x85e3('0x7'));var jayson=require(_0x85e3('0x8'));var client=jayson[_0x85e3('0x9')][_0x85e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1749b1,_0x43cd31,_0x1180e5){return new BPromise(function(_0x111f14,_0x48654c){return client['request'](_0x1749b1,_0x1180e5)['then'](function(_0x33cc0a){logger[_0x85e3('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x43cd31,'request\x20sent');logger[_0x85e3('0xc')](_0x85e3('0xd'),_0x43cd31,_0x85e3('0xe'),JSON['stringify'](_0x33cc0a));if(_0x33cc0a[_0x85e3('0xf')]){if(_0x33cc0a[_0x85e3('0xf')][_0x85e3('0x10')]===0x1f4){logger[_0x85e3('0xf')](_0x85e3('0x11'),_0x43cd31,_0x33cc0a[_0x85e3('0xf')]['message']);return _0x48654c(_0x33cc0a[_0x85e3('0xf')]['message']);}logger[_0x85e3('0xf')](_0x85e3('0x11'),_0x43cd31,_0x33cc0a[_0x85e3('0xf')][_0x85e3('0x12')]);return _0x111f14(_0x33cc0a[_0x85e3('0xf')][_0x85e3('0x12')]);}else{logger[_0x85e3('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x43cd31,_0x85e3('0xe'));_0x111f14(_0x33cc0a[_0x85e3('0x13')]['message']);}})['catch'](function(_0x5ede2c){logger[_0x85e3('0xf')](_0x85e3('0x11'),_0x43cd31,_0x5ede2c);_0x48654c(_0x5ede2c);});});} \ No newline at end of file +var _0xdac3=['jayson/promise','client','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdac3,0x1ad));var _0x3dac=function(_0xa71f02,_0x5c9690){_0xa71f02=_0xa71f02-0x0;var _0x19798a=_0xdac3[_0xa71f02];return _0x19798a;};'use strict';var _=require(_0x3dac('0x0'));var util=require(_0x3dac('0x1'));var moment=require(_0x3dac('0x2'));var BPromise=require(_0x3dac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3dac('0x5'))(_0x3dac('0x6'));var config=require(_0x3dac('0x7'));var jayson=require(_0x3dac('0x8'));var client=jayson[_0x3dac('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x195bd7,_0x51abb4,_0x3e8742){return new BPromise(function(_0x3c2283,_0x59f00d){return client[_0x3dac('0xa')](_0x195bd7,_0x3e8742)[_0x3dac('0xb')](function(_0x1cff4d){logger[_0x3dac('0xc')](_0x3dac('0xd'),_0x51abb4,_0x3dac('0xe'));logger[_0x3dac('0xf')](_0x3dac('0x10'),_0x51abb4,_0x3dac('0xe'),JSON[_0x3dac('0x11')](_0x1cff4d));if(_0x1cff4d['error']){if(_0x1cff4d[_0x3dac('0x12')][_0x3dac('0x13')]===0x1f4){logger[_0x3dac('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x51abb4,_0x1cff4d[_0x3dac('0x12')][_0x3dac('0x14')]);return _0x59f00d(_0x1cff4d[_0x3dac('0x12')]['message']);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x51abb4,_0x1cff4d[_0x3dac('0x12')][_0x3dac('0x14')]);return _0x3c2283(_0x1cff4d[_0x3dac('0x12')][_0x3dac('0x14')]);}else{logger[_0x3dac('0xc')](_0x3dac('0xd'),_0x51abb4,_0x3dac('0xe'));_0x3c2283(_0x1cff4d[_0x3dac('0x15')]['message']);}})[_0x3dac('0x16')](function(_0x559ebb){logger[_0x3dac('0x12')](_0x3dac('0xd'),_0x51abb4,_0x559ebb);_0x59f00d(_0x559ebb);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 2f7f7b9..e6deae7 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 _0x5837=['destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x112fe3,_0x16b642){var _0x1ec903=function(_0x1539eb){while(--_0x1539eb){_0x112fe3['push'](_0x112fe3['shift']());}};_0x1ec903(++_0x16b642);}(_0x5837,0x16a));var _0x7583=function(_0x377217,_0x26b013){_0x377217=_0x377217-0x0;var _0x26258d=_0x5837[_0x377217];return _0x26258d;};'use strict';var multer=require('multer');var util=require(_0x7583('0x0'));var path=require(_0x7583('0x1'));var timeout=require(_0x7583('0x2'));var express=require('express');var router=express[_0x7583('0x3')]();var fs_extra=require(_0x7583('0x4'));var auth=require(_0x7583('0x5'));var interaction=require(_0x7583('0x6'));var config=require('../../config/environment');var controller=require(_0x7583('0x7'));router['get']('/',auth[_0x7583('0x8')](),controller[_0x7583('0x9')]);router[_0x7583('0xa')](_0x7583('0xb'),auth[_0x7583('0x8')](),controller[_0x7583('0xc')]);router[_0x7583('0xd')]('/',auth['isAuthenticated'](),controller[_0x7583('0xe')]);router[_0x7583('0xf')]('/:id',auth[_0x7583('0x8')](),controller[_0x7583('0x10')]);router[_0x7583('0x11')](_0x7583('0xb'),auth[_0x7583('0x8')](),controller[_0x7583('0x12')]);module['exports']=router; \ No newline at end of file +var _0x317b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra'];(function(_0x148a63,_0x3c1877){var _0x4694fa=function(_0x1a6875){while(--_0x1a6875){_0x148a63['push'](_0x148a63['shift']());}};_0x4694fa(++_0x3c1877);}(_0x317b,0x1c7));var _0xb317=function(_0x22f451,_0x4a5cb2){_0x22f451=_0x22f451-0x0;var _0x1d7bb2=_0x317b[_0x22f451];return _0x1d7bb2;};'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('0xe')]('/',auth['isAuthenticated'](),controller[_0xb317('0xf')]);router[_0xb317('0x10')](_0xb317('0xc'),auth[_0xb317('0xa')](),controller[_0xb317('0x11')]);router[_0xb317('0x12')]('/:id',auth[_0xb317('0xa')](),controller[_0xb317('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index fdc7c26..4cc01fc 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 _0x4c72=['name','STRING','TEXT','long','parse','values','stringify','BOOLEAN','ENUM','voice','exports','getDataValue','setDataValue','alias'];(function(_0x3ccc2b,_0x42df9d){var _0x27723e=function(_0x39b3e1){while(--_0x39b3e1){_0x3ccc2b['push'](_0x3ccc2b['shift']());}};_0x27723e(++_0x42df9d);}(_0x4c72,0x7a));var _0x24c7=function(_0x2303d5,_0x58022f){_0x2303d5=_0x2303d5-0x0;var _0x706c85=_0x4c72[_0x2303d5];return _0x706c85;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x24c7('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x19d95e){return this[_0x24c7('0x1')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x15d984){this[_0x24c7('0x2')](_0x24c7('0x3'),_0x15d984?_0x15d984:this[_0x24c7('0x1')](_0x24c7('0x4')));}},'type':{'type':Sequelize[_0x24c7('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x24c7('0x6')](_0x24c7('0x7')),'get':function(){if(this[_0x24c7('0x1')]('type')==='select'){return JSON[_0x24c7('0x8')](this['getDataValue'](_0x24c7('0x9')));}else{return this[_0x24c7('0x1')]('values');}},'set':function(_0x360993){if(Array['isArray'](_0x360993)){this[_0x24c7('0x2')](_0x24c7('0x9'),JSON[_0x24c7('0xa')](_0x360993));}else{this[_0x24c7('0x2')](_0x24c7('0x9'),_0x360993);}}},'required':{'type':Sequelize[_0x24c7('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x24c7('0xc')](_0x24c7('0xd'))}}; \ No newline at end of file +var _0x2b76=['setDataValue','name','long','type','select','parse','getDataValue','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','alias','STRING'];(function(_0x35095d,_0xaebfd8){var _0xbe62d8=function(_0x3a8c3e){while(--_0x3a8c3e){_0x35095d['push'](_0x35095d['shift']());}};_0xbe62d8(++_0xaebfd8);}(_0x2b76,0xcb));var _0x62b7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2b76[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x62b7('0x0'));var _=require(_0x62b7('0x1'));module[_0x62b7('0x2')]={'name':{'type':Sequelize[_0x62b7('0x3')],'get':function(_0x13baa5){return this['getDataValue'](_0x62b7('0x4'));}},'alias':{'type':Sequelize[_0x62b7('0x5')],'allowNull':![],'set':function(_0x15c3df){this[_0x62b7('0x6')](_0x62b7('0x4'),_0x15c3df?_0x15c3df:this['getDataValue'](_0x62b7('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x62b7('0x8')),'get':function(){if(this['getDataValue'](_0x62b7('0x9'))===_0x62b7('0xa')){return JSON[_0x62b7('0xb')](this[_0x62b7('0xc')](_0x62b7('0xd')));}else{return this[_0x62b7('0xc')](_0x62b7('0xd'));}},'set':function(_0x36937a){if(Array[_0x62b7('0xe')](_0x36937a)){this[_0x62b7('0x6')](_0x62b7('0xd'),JSON[_0x62b7('0xf')](_0x36937a));}else{this['setDataValue'](_0x62b7('0xd'),_0x36937a);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x62b7('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x62b7('0x11')](_0x62b7('0x12'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 1c86db6..b0e14cb 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 _0x1d42=['fieldName','type','query','filters','intersection','model','attributes','length','nolimit','order','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','keys','fields','find','update','body','destroy','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','cm_contacts','format','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../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','save','then','error','stack','name','index','map','CmCustomField','rawAttributes'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0x1d42,0x11f));var _0x21d4=function(_0x22074d,_0x33df85){_0x22074d=_0x22074d-0x0;var _0x3a24ce=_0x1d42[_0x22074d];return _0x3a24ce;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x21d4('0x0'));var jsonpatch=require(_0x21d4('0x1'));var rp=require(_0x21d4('0x2'));var moment=require('moment');var BPromise=require(_0x21d4('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x21d4('0x4'));var csv=require(_0x21d4('0x5'));var ejs=require(_0x21d4('0x6'));var fs=require('fs');var fs_extra=require(_0x21d4('0x7'));var _=require(_0x21d4('0x8'));var squel=require(_0x21d4('0x9'));var crypto=require(_0x21d4('0xa'));var jsforce=require(_0x21d4('0xb'));var deskjs=require(_0x21d4('0xc'));var toCsv=require(_0x21d4('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x21d4('0xd'));var authService=require(_0x21d4('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21d4('0xf'));var logger=require(_0x21d4('0x10'))(_0x21d4('0x11'));var utils=require(_0x21d4('0x12'));var config=require(_0x21d4('0x13'));var licenseUtil=require(_0x21d4('0x14'));var db=require(_0x21d4('0x15'))['db'];function respondWithStatusCode(_0x48d5d8,_0x1fce36){_0x1fce36=_0x1fce36||0xcc;return function(_0x743893){if(_0x743893){return _0x48d5d8[_0x21d4('0x16')](_0x1fce36);}return _0x48d5d8[_0x21d4('0x17')](_0x1fce36)[_0x21d4('0x18')]();};}function respondWithResult(_0x3d23d3,_0x4c39a1){_0x4c39a1=_0x4c39a1||0xc8;return function(_0x2e2967){if(_0x2e2967){return _0x3d23d3[_0x21d4('0x17')](_0x4c39a1)[_0x21d4('0x19')](_0x2e2967);}};}function respondWithFilteredResult(_0x3ee338,_0x2785bb){return function(_0xcb673){if(_0xcb673){var _0x475626=typeof _0x2785bb[_0x21d4('0x1a')]===_0x21d4('0x1b')&&typeof _0x2785bb[_0x21d4('0x1c')]===_0x21d4('0x1b');var _0x1b46a4=_0xcb673['count'];var _0x42cce5=_0x475626?0x0:_0x2785bb[_0x21d4('0x1a')];var _0x5002c9=_0x475626?_0xcb673['count']:_0x2785bb[_0x21d4('0x1a')]+_0x2785bb[_0x21d4('0x1c')];var _0x335fba;if(_0x5002c9>=_0x1b46a4){_0x5002c9=_0x1b46a4;_0x335fba=0xc8;}else{_0x335fba=0xce;}_0x3ee338[_0x21d4('0x17')](_0x335fba);return _0x3ee338[_0x21d4('0x1d')](_0x21d4('0x1e'),_0x42cce5+'-'+_0x5002c9+'/'+_0x1b46a4)[_0x21d4('0x19')](_0xcb673);}return null;};}function patchUpdates(_0x59dcae){return function(_0x4701ef){try{jsonpatch[_0x21d4('0x1f')](_0x4701ef,_0x59dcae,!![]);}catch(_0x18f661){return BPromise['reject'](_0x18f661);}return _0x4701ef[_0x21d4('0x20')]();};}function saveUpdates(_0x109862,_0x43e7fa){return function(_0x5e817b){if(_0x5e817b){return _0x5e817b['update'](_0x109862)[_0x21d4('0x21')](function(_0x2dacf1){return _0x2dacf1;});}return null;};}function removeEntity(_0x27b10f,_0x1ca4d1){return function(_0xdbbaec){if(_0xdbbaec){return _0xdbbaec['destroy']()[_0x21d4('0x21')](function(){_0x27b10f[_0x21d4('0x17')](0xcc)[_0x21d4('0x18')]();});}};}function handleEntityNotFound(_0x921fee,_0x5bcf13){return function(_0x3e7a8f){if(!_0x3e7a8f){_0x921fee['sendStatus'](0x194);}return _0x3e7a8f;};}function handleError(_0x5b7f95,_0x193241){_0x193241=_0x193241||0x1f4;return function(_0x25455c){logger[_0x21d4('0x22')](_0x25455c[_0x21d4('0x23')]);if(_0x25455c['name']){delete _0x25455c[_0x21d4('0x24')];}_0x5b7f95[_0x21d4('0x17')](_0x193241)['send'](_0x25455c);};}exports[_0x21d4('0x25')]=function(_0x47c64c,_0x468b23){var _0x28e0ed={},_0x1b7bbb={},_0x46bee5={'count':0x0,'rows':[]};var _0x66c780=_[_0x21d4('0x26')](db[_0x21d4('0x27')][_0x21d4('0x28')],function(_0x220476){return{'name':_0x220476[_0x21d4('0x29')],'type':_0x220476[_0x21d4('0x2a')]['key']};});_0x1b7bbb['model']=_['differenceBy'](_[_0x21d4('0x26')](_0x66c780,_0x21d4('0x24')),['name']);_0x1b7bbb[_0x21d4('0x2b')]=_['keys'](_0x47c64c[_0x21d4('0x2b')]);_0x1b7bbb[_0x21d4('0x2c')]=_[_0x21d4('0x2d')](_0x1b7bbb[_0x21d4('0x2e')],_0x1b7bbb['query']);_0x28e0ed[_0x21d4('0x2f')]=_[_0x21d4('0x2d')](_0x1b7bbb[_0x21d4('0x2e')],qs['fields'](_0x47c64c[_0x21d4('0x2b')]['fields']));_0x28e0ed[_0x21d4('0x2f')]=_0x28e0ed[_0x21d4('0x2f')][_0x21d4('0x30')]?_0x28e0ed['attributes']:_0x1b7bbb[_0x21d4('0x2e')];if(!_0x47c64c['query']['hasOwnProperty'](_0x21d4('0x31'))){_0x28e0ed[_0x21d4('0x1c')]=qs[_0x21d4('0x1c')](_0x47c64c['query'][_0x21d4('0x1c')]);_0x28e0ed[_0x21d4('0x1a')]=qs[_0x21d4('0x1a')](_0x47c64c['query']['offset']);}_0x28e0ed[_0x21d4('0x32')]=qs['sort'](_0x47c64c[_0x21d4('0x2b')]['sort']);_0x28e0ed['where']=qs[_0x21d4('0x2c')](_[_0x21d4('0x33')](_0x47c64c[_0x21d4('0x2b')],_0x1b7bbb[_0x21d4('0x2c')]),_0x66c780);if(_0x47c64c['query'][_0x21d4('0x34')]){_0x28e0ed[_0x21d4('0x35')]=_['merge'](_0x28e0ed[_0x21d4('0x35')],{'$or':_['map'](_0x66c780,function(_0x154b8b){if(_0x154b8b['type']!==_0x21d4('0x36')){var _0x425eee={};_0x425eee[_0x154b8b['name']]={'$like':'%'+_0x47c64c[_0x21d4('0x2b')][_0x21d4('0x34')]+'%'};return _0x425eee;}})});}_0x28e0ed=_[_0x21d4('0x37')]({},_0x28e0ed,_0x47c64c[_0x21d4('0x38')]);var _0x5a8bba={'where':_0x28e0ed['where']};return db[_0x21d4('0x27')][_0x21d4('0x39')](_0x5a8bba)[_0x21d4('0x21')](function(_0x3cc87d){_0x46bee5[_0x21d4('0x39')]=_0x3cc87d;if(_0x47c64c[_0x21d4('0x2b')][_0x21d4('0x3a')]){_0x28e0ed[_0x21d4('0x3b')]=[{'all':!![]}];}return db[_0x21d4('0x27')][_0x21d4('0x3c')](_0x28e0ed);})[_0x21d4('0x21')](function(_0x16fffa){_0x46bee5[_0x21d4('0x3d')]=_0x16fffa;return _0x46bee5;})[_0x21d4('0x21')](respondWithFilteredResult(_0x468b23,_0x28e0ed))[_0x21d4('0x3e')](handleError(_0x468b23,null));};exports['show']=function(_0xcbe9c1,_0x11ad8c){var _0x347585={'raw':!![],'where':{'id':_0xcbe9c1[_0x21d4('0x3f')]['id']}},_0x36ef86={};_0x36ef86[_0x21d4('0x2e')]=_[_0x21d4('0x40')](db[_0x21d4('0x27')]['rawAttributes']);_0x36ef86['query']=_[_0x21d4('0x40')](_0xcbe9c1['query']);_0x36ef86[_0x21d4('0x2c')]=_[_0x21d4('0x2d')](_0x36ef86[_0x21d4('0x2e')],_0x36ef86['query']);_0x347585[_0x21d4('0x2f')]=_['intersection'](_0x36ef86['model'],qs[_0x21d4('0x41')](_0xcbe9c1['query'][_0x21d4('0x41')]));_0x347585['attributes']=_0x347585[_0x21d4('0x2f')][_0x21d4('0x30')]?_0x347585[_0x21d4('0x2f')]:_0x36ef86['model'];if(_0xcbe9c1[_0x21d4('0x2b')][_0x21d4('0x3a')]){_0x347585[_0x21d4('0x3b')]=[{'all':!![]}];}_0x347585=_[_0x21d4('0x37')]({},_0x347585,_0xcbe9c1[_0x21d4('0x38')]);return db[_0x21d4('0x27')][_0x21d4('0x42')](_0x347585)[_0x21d4('0x21')](handleEntityNotFound(_0x11ad8c,null))[_0x21d4('0x21')](respondWithResult(_0x11ad8c,null))[_0x21d4('0x3e')](handleError(_0x11ad8c,null));};exports[_0x21d4('0x43')]=function(_0x35003a,_0x23b7b1){if(_0x35003a['body']['id']){delete _0x35003a[_0x21d4('0x44')]['id'];}return db[_0x21d4('0x27')]['find']({'where':{'id':_0x35003a[_0x21d4('0x3f')]['id']}})[_0x21d4('0x21')](handleEntityNotFound(_0x23b7b1,null))['then'](saveUpdates(_0x35003a['body'],null))[_0x21d4('0x21')](respondWithResult(_0x23b7b1,null))['catch'](handleError(_0x23b7b1,null));};exports[_0x21d4('0x45')]=function(_0x3544c8,_0x12c8fb){return db[_0x21d4('0x27')][_0x21d4('0x42')]({'where':{'id':_0x3544c8[_0x21d4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x12c8fb,null))[_0x21d4('0x21')](removeEntity(_0x12c8fb,null))['catch'](handleError(_0x12c8fb,null));};exports[_0x21d4('0x46')]=function(_0x42032e,_0x18af8f){var _0xae25a5;return db[_0x21d4('0x47')][_0x21d4('0x48')](function(_0x425a33){return db['CmCustomField'][_0x21d4('0x46')](_0x42032e[_0x21d4('0x44')],{'transaction':_0x425a33})[_0x21d4('0x21')](function(_0xb419c1){_0xae25a5=_0xb419c1;var _0x24ca37={'type':db[_0x21d4('0x49')][_0x21d4('0x4a')],'transaction':_0x425a33};switch(_0x42032e[_0x21d4('0x44')][_0x21d4('0x2a')]){case'text':_0x24ca37['type']=db[_0x21d4('0x49')][_0x21d4('0x4a')];break;case _0x21d4('0x4b'):_0x24ca37[_0x21d4('0x2a')]=db[_0x21d4('0x49')][_0x21d4('0x4c')];break;case _0x21d4('0x4d'):_0x24ca37['type']=db['Sequelize'][_0x21d4('0x4e')];_0x24ca37[_0x21d4('0x4f')]=![];break;default:}return db[_0x21d4('0x47')]['queryInterface']['addColumn'](_0x21d4('0x50'),util[_0x21d4('0x51')]('cf_%d',_0xae25a5['id']),_0x24ca37);})[_0x21d4('0x21')](function(){return _0xae25a5;});})[_0x21d4('0x21')](respondWithResult(_0x18af8f,0xc9))['catch'](handleError(_0x18af8f,null));}; \ No newline at end of file +var _0x681a=['name','send','index','map','CmCustomField','fieldName','differenceBy','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','filters','pick','where','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','create','sequelize','transaction','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','error','stack'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x681a,0x1e3));var _0xa681=function(_0x3af6d3,_0xd6ff2e){_0x3af6d3=_0x3af6d3-0x0;var _0xf0c5a8=_0x681a[_0x3af6d3];return _0xf0c5a8;};'use strict';var emlformat=require(_0xa681('0x0'));var rimraf=require(_0xa681('0x1'));var zipdir=require(_0xa681('0x2'));var jsonpatch=require(_0xa681('0x3'));var rp=require(_0xa681('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa681('0x5'));var util=require(_0xa681('0x6'));var path=require(_0xa681('0x7'));var sox=require(_0xa681('0x8'));var csv=require(_0xa681('0x9'));var ejs=require(_0xa681('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa681('0xb'));var squel=require(_0xa681('0xc'));var crypto=require(_0xa681('0xd'));var jsforce=require(_0xa681('0xe'));var deskjs=require(_0xa681('0xf'));var toCsv=require(_0xa681('0x9'));var querystring=require(_0xa681('0x10'));var Papa=require(_0xa681('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa681('0x12'));var as=require(_0xa681('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa681('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa681('0x15'));var db=require(_0xa681('0x16'))['db'];function respondWithStatusCode(_0x519972,_0x368b51){_0x368b51=_0x368b51||0xcc;return function(_0x28274c){if(_0x28274c){return _0x519972[_0xa681('0x17')](_0x368b51);}return _0x519972[_0xa681('0x18')](_0x368b51)[_0xa681('0x19')]();};}function respondWithResult(_0x1888b4,_0x3be0c6){_0x3be0c6=_0x3be0c6||0xc8;return function(_0x206cc7){if(_0x206cc7){return _0x1888b4[_0xa681('0x18')](_0x3be0c6)[_0xa681('0x1a')](_0x206cc7);}};}function respondWithFilteredResult(_0x261985,_0x446d9c){return function(_0x123c7){if(_0x123c7){var _0x214b92=typeof _0x446d9c[_0xa681('0x1b')]==='undefined'&&typeof _0x446d9c[_0xa681('0x1c')]===_0xa681('0x1d');var _0x1afa87=_0x123c7[_0xa681('0x1e')];var _0x3eee0f=_0x214b92?0x0:_0x446d9c[_0xa681('0x1b')];var _0x161682=_0x214b92?_0x123c7[_0xa681('0x1e')]:_0x446d9c[_0xa681('0x1b')]+_0x446d9c[_0xa681('0x1c')];var _0x386aa2;if(_0x161682>=_0x1afa87){_0x161682=_0x1afa87;_0x386aa2=0xc8;}else{_0x386aa2=0xce;}_0x261985[_0xa681('0x18')](_0x386aa2);return _0x261985[_0xa681('0x1f')](_0xa681('0x20'),_0x3eee0f+'-'+_0x161682+'/'+_0x1afa87)[_0xa681('0x1a')](_0x123c7);}return null;};}function patchUpdates(_0x5106ac){return function(_0x1f012f){try{jsonpatch[_0xa681('0x21')](_0x1f012f,_0x5106ac,!![]);}catch(_0x3755ce){return BPromise[_0xa681('0x22')](_0x3755ce);}return _0x1f012f[_0xa681('0x23')]();};}function saveUpdates(_0x45231b,_0x5443dd){return function(_0x489c2e){if(_0x489c2e){return _0x489c2e['update'](_0x45231b)[_0xa681('0x24')](function(_0x4a4d92){return _0x4a4d92;});}return null;};}function removeEntity(_0x5e2150,_0x385403){return function(_0x586858){if(_0x586858){return _0x586858['destroy']()[_0xa681('0x24')](function(){_0x5e2150[_0xa681('0x18')](0xcc)[_0xa681('0x19')]();});}};}function handleEntityNotFound(_0x57bce6,_0x13fc3b){return function(_0x5127e5){if(!_0x5127e5){_0x57bce6[_0xa681('0x17')](0x194);}return _0x5127e5;};}function handleError(_0x2d9e05,_0x173925){_0x173925=_0x173925||0x1f4;return function(_0x517b89){logger[_0xa681('0x25')](_0x517b89[_0xa681('0x26')]);if(_0x517b89[_0xa681('0x27')]){delete _0x517b89[_0xa681('0x27')];}_0x2d9e05[_0xa681('0x18')](_0x173925)[_0xa681('0x28')](_0x517b89);};}exports[_0xa681('0x29')]=function(_0x3e7833,_0xa11894){var _0x379433={},_0x48424f={},_0x6e4622={'count':0x0,'rows':[]};var _0x57dd56=_[_0xa681('0x2a')](db[_0xa681('0x2b')]['rawAttributes'],function(_0xbebdb6){return{'name':_0xbebdb6[_0xa681('0x2c')],'type':_0xbebdb6['type']['key']};});_0x48424f['model']=_[_0xa681('0x2d')](_[_0xa681('0x2a')](_0x57dd56,_0xa681('0x27')),['name']);_0x48424f['query']=_[_0xa681('0x2e')](_0x3e7833[_0xa681('0x2f')]);_0x48424f['filters']=_[_0xa681('0x30')](_0x48424f[_0xa681('0x31')],_0x48424f['query']);_0x379433[_0xa681('0x32')]=_[_0xa681('0x30')](_0x48424f['model'],qs[_0xa681('0x33')](_0x3e7833[_0xa681('0x2f')]['fields']));_0x379433[_0xa681('0x32')]=_0x379433[_0xa681('0x32')][_0xa681('0x34')]?_0x379433[_0xa681('0x32')]:_0x48424f[_0xa681('0x31')];if(!_0x3e7833[_0xa681('0x2f')][_0xa681('0x35')]('nolimit')){_0x379433[_0xa681('0x1c')]=qs[_0xa681('0x1c')](_0x3e7833[_0xa681('0x2f')]['limit']);_0x379433['offset']=qs[_0xa681('0x1b')](_0x3e7833[_0xa681('0x2f')]['offset']);}_0x379433['order']=qs['sort'](_0x3e7833[_0xa681('0x2f')][_0xa681('0x36')]);_0x379433['where']=qs[_0xa681('0x37')](_[_0xa681('0x38')](_0x3e7833[_0xa681('0x2f')],_0x48424f[_0xa681('0x37')]),_0x57dd56);if(_0x3e7833[_0xa681('0x2f')]['filter']){_0x379433[_0xa681('0x39')]=_[_0xa681('0x3a')](_0x379433[_0xa681('0x39')],{'$or':_[_0xa681('0x2a')](_0x57dd56,function(_0x90f419){if(_0x90f419[_0xa681('0x3b')]!=='VIRTUAL'){var _0x5094c2={};_0x5094c2[_0x90f419['name']]={'$like':'%'+_0x3e7833['query'][_0xa681('0x3c')]+'%'};return _0x5094c2;}})});}_0x379433=_[_0xa681('0x3a')]({},_0x379433,_0x3e7833[_0xa681('0x3d')]);var _0x116c64={'where':_0x379433[_0xa681('0x39')]};return db[_0xa681('0x2b')][_0xa681('0x1e')](_0x116c64)[_0xa681('0x24')](function(_0x307a2e){_0x6e4622[_0xa681('0x1e')]=_0x307a2e;if(_0x3e7833[_0xa681('0x2f')][_0xa681('0x3e')]){_0x379433[_0xa681('0x3f')]=[{'all':!![]}];}return db[_0xa681('0x2b')][_0xa681('0x40')](_0x379433);})[_0xa681('0x24')](function(_0x334de1){_0x6e4622[_0xa681('0x41')]=_0x334de1;return _0x6e4622;})['then'](respondWithFilteredResult(_0xa11894,_0x379433))[_0xa681('0x42')](handleError(_0xa11894,null));};exports[_0xa681('0x43')]=function(_0x4f81a6,_0x287345){var _0x579712={'raw':!![],'where':{'id':_0x4f81a6[_0xa681('0x44')]['id']}},_0x297bc6={};_0x297bc6['model']=_[_0xa681('0x2e')](db[_0xa681('0x2b')]['rawAttributes']);_0x297bc6[_0xa681('0x2f')]=_['keys'](_0x4f81a6['query']);_0x297bc6[_0xa681('0x37')]=_[_0xa681('0x30')](_0x297bc6[_0xa681('0x31')],_0x297bc6[_0xa681('0x2f')]);_0x579712[_0xa681('0x32')]=_['intersection'](_0x297bc6[_0xa681('0x31')],qs[_0xa681('0x33')](_0x4f81a6['query']['fields']));_0x579712[_0xa681('0x32')]=_0x579712[_0xa681('0x32')][_0xa681('0x34')]?_0x579712[_0xa681('0x32')]:_0x297bc6[_0xa681('0x31')];if(_0x4f81a6['query'][_0xa681('0x3e')]){_0x579712[_0xa681('0x3f')]=[{'all':!![]}];}_0x579712=_[_0xa681('0x3a')]({},_0x579712,_0x4f81a6[_0xa681('0x3d')]);return db[_0xa681('0x2b')][_0xa681('0x45')](_0x579712)[_0xa681('0x24')](handleEntityNotFound(_0x287345,null))[_0xa681('0x24')](respondWithResult(_0x287345,null))[_0xa681('0x42')](handleError(_0x287345,null));};exports['update']=function(_0x444a8f,_0x750582){if(_0x444a8f['body']['id']){delete _0x444a8f[_0xa681('0x46')]['id'];}return db[_0xa681('0x2b')]['find']({'where':{'id':_0x444a8f[_0xa681('0x44')]['id']}})[_0xa681('0x24')](handleEntityNotFound(_0x750582,null))[_0xa681('0x24')](saveUpdates(_0x444a8f[_0xa681('0x46')],null))[_0xa681('0x24')](respondWithResult(_0x750582,null))[_0xa681('0x42')](handleError(_0x750582,null));};exports[_0xa681('0x47')]=function(_0x2265be,_0x3523e7){return db[_0xa681('0x2b')][_0xa681('0x45')]({'where':{'id':_0x2265be[_0xa681('0x44')]['id']}})[_0xa681('0x24')](handleEntityNotFound(_0x3523e7,null))[_0xa681('0x24')](removeEntity(_0x3523e7,null))[_0xa681('0x42')](handleError(_0x3523e7,null));};exports[_0xa681('0x48')]=function(_0x4f10e5,_0x2d72e3){var _0x4f2259;return db[_0xa681('0x49')][_0xa681('0x4a')](function(_0x8134c8){return db['CmCustomField']['create'](_0x4f10e5[_0xa681('0x46')],{'transaction':_0x8134c8})[_0xa681('0x24')](function(_0x2c8766){_0x4f2259=_0x2c8766;var _0x11c403={'type':db[_0xa681('0x4b')][_0xa681('0x4c')],'transaction':_0x8134c8};switch(_0x4f10e5[_0xa681('0x46')][_0xa681('0x3b')]){case _0xa681('0x4d'):_0x11c403[_0xa681('0x3b')]=db[_0xa681('0x4b')][_0xa681('0x4c')];break;case _0xa681('0x4e'):_0x11c403[_0xa681('0x3b')]=db['Sequelize']['INTEGER'];break;case _0xa681('0x4f'):_0x11c403[_0xa681('0x3b')]=db['Sequelize'][_0xa681('0x50')];_0x11c403[_0xa681('0x51')]=![];break;default:}return db[_0xa681('0x49')][_0xa681('0x52')][_0xa681('0x53')](_0xa681('0x54'),util[_0xa681('0x55')](_0xa681('0x56'),_0x4f2259['id']),_0x11c403);})[_0xa681('0x24')](function(){return _0x4f2259;});})[_0xa681('0x24')](respondWithResult(_0x2d72e3,0xc9))[_0xa681('0x42')](handleError(_0x2d72e3,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 63e8f22..017326f 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 _0x5a76=['rimraf','../../config/environment','./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x55e0f9,_0x467637){var _0x41d3ca=function(_0x159017){while(--_0x159017){_0x55e0f9['push'](_0x55e0f9['shift']());}};_0x41d3ca(++_0x467637);}(_0x5a76,0x96));var _0x65a7=function(_0xba29e8,_0x30af74){_0xba29e8=_0xba29e8-0x0;var _0x561406=_0x5a76[_0xba29e8];return _0x561406;};'use strict';var _=require(_0x65a7('0x0'));var util=require(_0x65a7('0x1'));var logger=require(_0x65a7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x65a7('0x3'));var rp=require(_0x65a7('0x4'));var fs=require('fs');var path=require(_0x65a7('0x5'));var rimraf=require(_0x65a7('0x6'));var config=require(_0x65a7('0x7'));var attributes=require(_0x65a7('0x8'));module[_0x65a7('0x9')]=function(_0x252930,_0x2683a6){return _0x252930[_0x65a7('0xa')]('CmCustomField',attributes,{'tableName':_0x65a7('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09c8=['request-promise','path','rimraf','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5d3ed2,_0x1503be){var _0x1cf0ae=function(_0x37683d){while(--_0x37683d){_0x5d3ed2['push'](_0x5d3ed2['shift']());}};_0x1cf0ae(++_0x1503be);}(_0x09c8,0xf1));var _0x809c=function(_0x1801e6,_0x3814c2){_0x1801e6=_0x1801e6-0x0;var _0x465eaa=_0x09c8[_0x1801e6];return _0x465eaa;};'use strict';var _=require(_0x809c('0x0'));var util=require(_0x809c('0x1'));var logger=require(_0x809c('0x2'))(_0x809c('0x3'));var moment=require(_0x809c('0x4'));var BPromise=require(_0x809c('0x5'));var rp=require(_0x809c('0x6'));var fs=require('fs');var path=require(_0x809c('0x7'));var rimraf=require(_0x809c('0x8'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0x809c('0x9')]=function(_0x2f0415,_0x1bda3f){return _0x2f0415[_0x809c('0xa')](_0x809c('0xb'),attributes,{'tableName':_0x809c('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index ea956fb..ca37afd 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 _0x5f06=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x135c3b,_0x2024c2){var _0x2b67d6=function(_0x43e38a){while(--_0x43e38a){_0x135c3b['push'](_0x135c3b['shift']());}};_0x2b67d6(++_0x2024c2);}(_0x5f06,0x17a));var _0x65f0=function(_0x3aa5f3,_0x9ae1d8){_0x3aa5f3=_0x3aa5f3-0x0;var _0x434feb=_0x5f06[_0x3aa5f3];return _0x434feb;};'use strict';var _=require(_0x65f0('0x0'));var util=require(_0x65f0('0x1'));var moment=require(_0x65f0('0x2'));var BPromise=require(_0x65f0('0x3'));var rs=require(_0x65f0('0x4'));var fs=require('fs');var Redis=require(_0x65f0('0x5'));var db=require(_0x65f0('0x6'))['db'];var utils=require(_0x65f0('0x7'));var logger=require('../../config/logger')(_0x65f0('0x8'));var config=require(_0x65f0('0x9'));var jayson=require(_0x65f0('0xa'));var client=jayson[_0x65f0('0xb')][_0x65f0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49b617,_0x450347,_0x3bd1a1){return new BPromise(function(_0xf31d00,_0x5b2485){return client[_0x65f0('0xd')](_0x49b617,_0x3bd1a1)['then'](function(_0x114fa4){logger[_0x65f0('0xe')](_0x65f0('0xf'),_0x450347,_0x65f0('0x10'));logger[_0x65f0('0x11')](_0x65f0('0x12'),_0x450347,_0x65f0('0x10'),JSON['stringify'](_0x114fa4));if(_0x114fa4[_0x65f0('0x13')]){if(_0x114fa4[_0x65f0('0x13')][_0x65f0('0x14')]===0x1f4){logger[_0x65f0('0x13')]('CmCustomField,\x20%s,\x20%s',_0x450347,_0x114fa4[_0x65f0('0x13')][_0x65f0('0x15')]);return _0x5b2485(_0x114fa4[_0x65f0('0x13')]['message']);}logger[_0x65f0('0x13')](_0x65f0('0xf'),_0x450347,_0x114fa4[_0x65f0('0x13')][_0x65f0('0x15')]);return _0xf31d00(_0x114fa4[_0x65f0('0x13')][_0x65f0('0x15')]);}else{logger[_0x65f0('0xe')]('CmCustomField,\x20%s,\x20%s',_0x450347,_0x65f0('0x10'));_0xf31d00(_0x114fa4[_0x65f0('0x16')][_0x65f0('0x15')]);}})[_0x65f0('0x17')](function(_0x211090){logger[_0x65f0('0x13')](_0x65f0('0xf'),_0x450347,_0x211090);_0x5b2485(_0x211090);});});} \ No newline at end of file +var _0xc482=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x32e939,_0x4d93b5){var _0x236a4b=function(_0x46ebb1){while(--_0x46ebb1){_0x32e939['push'](_0x32e939['shift']());}};_0x236a4b(++_0x4d93b5);}(_0xc482,0xb8));var _0x2c48=function(_0xd44856,_0x1c31af){_0xd44856=_0xd44856-0x0;var _0x48b861=_0xc482[_0xd44856];return _0x48b861;};'use strict';var _=require(_0x2c48('0x0'));var util=require(_0x2c48('0x1'));var moment=require(_0x2c48('0x2'));var BPromise=require(_0x2c48('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c48('0x4'));var db=require(_0x2c48('0x5'))['db'];var utils=require(_0x2c48('0x6'));var logger=require(_0x2c48('0x7'))(_0x2c48('0x8'));var config=require(_0x2c48('0x9'));var jayson=require(_0x2c48('0xa'));var client=jayson[_0x2c48('0xb')][_0x2c48('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1be02b,_0x2eb70a,_0x16bd26){return new BPromise(function(_0x10a86e,_0x822b17){return client[_0x2c48('0xd')](_0x1be02b,_0x16bd26)[_0x2c48('0xe')](function(_0x4e8581){logger[_0x2c48('0xf')]('CmCustomField,\x20%s,\x20%s',_0x2eb70a,'request\x20sent');logger[_0x2c48('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x2eb70a,_0x2c48('0x11'),JSON['stringify'](_0x4e8581));if(_0x4e8581[_0x2c48('0x12')]){if(_0x4e8581[_0x2c48('0x12')][_0x2c48('0x13')]===0x1f4){logger[_0x2c48('0x12')](_0x2c48('0x14'),_0x2eb70a,_0x4e8581[_0x2c48('0x12')]['message']);return _0x822b17(_0x4e8581[_0x2c48('0x12')][_0x2c48('0x15')]);}logger[_0x2c48('0x12')](_0x2c48('0x14'),_0x2eb70a,_0x4e8581[_0x2c48('0x12')]['message']);return _0x10a86e(_0x4e8581['error'][_0x2c48('0x15')]);}else{logger[_0x2c48('0xf')](_0x2c48('0x14'),_0x2eb70a,'request\x20sent');_0x10a86e(_0x4e8581[_0x2c48('0x16')]['message']);}})[_0x2c48('0x17')](function(_0x255fa6){logger[_0x2c48('0x12')](_0x2c48('0x14'),_0x2eb70a,_0x255fa6);_0x822b17(_0x255fa6);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d0ea9c5..a01dd43 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 _0x83e3=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4e13b4,_0x142ae4){var _0x5bd42f=function(_0xdf11d4){while(--_0xdf11d4){_0x4e13b4['push'](_0x4e13b4['shift']());}};_0x5bd42f(++_0x142ae4);}(_0x83e3,0xc1));var _0x383e=function(_0x472917,_0x34d079){_0x472917=_0x472917-0x0;var _0x2fffae=_0x83e3[_0x472917];return _0x2fffae;};'use strict';var multer=require(_0x383e('0x0'));var util=require(_0x383e('0x1'));var path=require(_0x383e('0x2'));var timeout=require(_0x383e('0x3'));var express=require(_0x383e('0x4'));var router=express[_0x383e('0x5')]();var fs_extra=require(_0x383e('0x6'));var auth=require(_0x383e('0x7'));var interaction=require(_0x383e('0x8'));var config=require(_0x383e('0x9'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0x383e('0xa')](),controller[_0x383e('0xb')]);router[_0x383e('0xc')](_0x383e('0xd'),auth['isAuthenticated'](),controller[_0x383e('0xe')]);router[_0x383e('0xf')]('/',auth[_0x383e('0xa')](),controller['create']);router[_0x383e('0x10')](_0x383e('0xd'),auth[_0x383e('0xa')](),controller[_0x383e('0x11')]);router[_0x383e('0x12')](_0x383e('0xd'),auth[_0x383e('0xa')](),controller[_0x383e('0x13')]);module['exports']=router; \ No newline at end of file +var _0x975f=['../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2b7857,_0x490ea0){var _0x5013cd=function(_0x2a28ba){while(--_0x2a28ba){_0x2b7857['push'](_0x2b7857['shift']());}};_0x5013cd(++_0x490ea0);}(_0x975f,0x191));var _0xf975=function(_0x57966a,_0x477964){_0x57966a=_0x57966a-0x0;var _0x191765=_0x975f[_0x57966a];return _0x191765;};'use strict';var multer=require(_0xf975('0x0'));var util=require('util');var path=require(_0xf975('0x1'));var timeout=require(_0xf975('0x2'));var express=require(_0xf975('0x3'));var router=express[_0xf975('0x4')]();var fs_extra=require(_0xf975('0x5'));var auth=require(_0xf975('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf975('0x7'));var controller=require(_0xf975('0x8'));router['get']('/',auth[_0xf975('0x9')](),controller[_0xf975('0xa')]);router[_0xf975('0xb')](_0xf975('0xc'),auth[_0xf975('0x9')](),controller[_0xf975('0xd')]);router['post']('/',auth[_0xf975('0x9')](),controller['create']);router[_0xf975('0xe')]('/:id',auth[_0xf975('0x9')](),controller[_0xf975('0xf')]);router['delete'](_0xf975('0xc'),auth[_0xf975('0x9')](),controller[_0xf975('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 5373bb7..6cb3c81 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 _0x410c=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE','format'];(function(_0x4089fd,_0x421e8b){var _0x37e76e=function(_0x53d3af){while(--_0x53d3af){_0x4089fd['push'](_0x4089fd['shift']());}};_0x37e76e(++_0x421e8b);}(_0x410c,0xe0));var _0xc410=function(_0x5f2324,_0x1f8e32){_0x5f2324=_0x5f2324-0x0;var _0x326b8f=_0x410c[_0x5f2324];return _0x326b8f;};'use strict';var moment=require(_0xc410('0x0'));var Sequelize=require(_0xc410('0x1'));module['exports']={'phone':{'type':Sequelize[_0xc410('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xc410('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc410('0x4')],'defaultValue':moment()[_0xc410('0x5')](_0xc410('0x6'))},'countbusyretry':{'type':Sequelize[_0xc410('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc410('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc410('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xc410('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xc410('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xc410('0x9')},'ListId':{'type':Sequelize[_0xc410('0x7')],'unique':_0xc410('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xc410('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xc410('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc410('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc410('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc410('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xc410('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc410('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x5007=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x5007,0x8b));var _0x7500=function(_0x121184,_0x4b6d59){_0x121184=_0x121184-0x0;var _0x22fe02=_0x5007[_0x121184];return _0x22fe02;};'use strict';var moment=require(_0x7500('0x0'));var Sequelize=require(_0x7500('0x1'));module[_0x7500('0x2')]={'phone':{'type':Sequelize[_0x7500('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x7500('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7500('0x5')],'defaultValue':moment()[_0x7500('0x6')](_0x7500('0x7'))},'countbusyretry':{'type':Sequelize[_0x7500('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7500('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7500('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7500('0x5')]},'priority':{'type':Sequelize[_0x7500('0x8')](0x2)[_0x7500('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7500('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7500('0x8')],'unique':_0x7500('0xa')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x7500('0xa')},'UserId':{'type':Sequelize[_0x7500('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x7500('0x8')],'unique':_0x7500('0xa')},'CampaignId':{'type':Sequelize[_0x7500('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x7500('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7500('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7500('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7500('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7500('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x7500('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7500('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x7500('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index f462936..6abb6ba 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 _0x4873=['VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','UserId','user','deletedat','format','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','CmHopperFinal','end','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','UPDATE','Contact','Company','CmList','Queue','getPreviewRecall','transaction','scheduledat','LOCK','CmCompany','dialActive','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','api','status','json','offset','undefined','limit','count','Content-Range','update','then','sendStatus','error','stack','name','send','index','CmHopper','fieldName','type','key','model','map','query','keys','filters','intersection','concat','$gt','$gte','$lt','$lte','$eq','$not','$notBetween','$in','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','destroy'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x4873,0x1df));var _0x3487=function(_0x4d5bd1,_0x2c32f4){_0x4d5bd1=_0x4d5bd1-0x0;var _0x467750=_0x4873[_0x4d5bd1];return _0x467750;};'use strict';var moment=require(_0x3487('0x0'));var _=require(_0x3487('0x1'));var qs=require(_0x3487('0x2'));var logger=require('../../config/logger')(_0x3487('0x3'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x24ca51,_0xbc64e7){_0xbc64e7=_0xbc64e7||0xc8;return function(_0x54ff70){if(_0x54ff70){return _0x24ca51[_0x3487('0x4')](_0xbc64e7)[_0x3487('0x5')](_0x54ff70);}};}function respondWithFilteredResult(_0xbe12a4,_0x2611dc){return function(_0x193589){if(_0x193589){var _0x4a2407=typeof _0x2611dc[_0x3487('0x6')]===_0x3487('0x7')&&typeof _0x2611dc[_0x3487('0x8')]===_0x3487('0x7');var _0x17b90c=_0x193589['count'];var _0x365727=_0x4a2407?0x0:_0x2611dc['offset'];var _0x1a5a7a=_0x4a2407?_0x193589[_0x3487('0x9')]:_0x2611dc['offset']+_0x2611dc['limit'];var _0x43a64c;if(_0x1a5a7a>=_0x17b90c){_0x1a5a7a=_0x17b90c;_0x43a64c=0xc8;}else{_0x43a64c=0xce;}_0xbe12a4[_0x3487('0x4')](_0x43a64c);return _0xbe12a4['set'](_0x3487('0xa'),_0x365727+'-'+_0x1a5a7a+'/'+_0x17b90c)['json'](_0x193589);}return null;};}function saveUpdates(_0x557d64,_0x395774){return function(_0x1be2e0){if(_0x1be2e0){return _0x1be2e0[_0x3487('0xb')](_0x557d64)[_0x3487('0xc')](function(_0x8d7a3c){return _0x8d7a3c;});}return null;};}function handleEntityNotFound(_0x1e468b,_0x4fbd63){return function(_0x23ce3b){if(!_0x23ce3b){_0x1e468b[_0x3487('0xd')](0x194);}return _0x23ce3b;};}function handleError(_0x1b2b2b,_0x4f79f0){_0x4f79f0=_0x4f79f0||0x1f4;return function(_0x156e80){logger[_0x3487('0xe')](_0x156e80[_0x3487('0xf')]);if(_0x156e80[_0x3487('0x10')]){delete _0x156e80[_0x3487('0x10')];}_0x1b2b2b[_0x3487('0x4')](_0x4f79f0)[_0x3487('0x11')](_0x156e80);};}exports[_0x3487('0x12')]=function(_0x320894,_0x2fa630){var _0x3576ca={},_0x41795b={},_0xd56d94={'count':0x0,'rows':[]};var _0x382e33=_['map'](db[_0x3487('0x13')]['rawAttributes'],function(_0x2fd2e8){return{'name':_0x2fd2e8[_0x3487('0x14')],'type':_0x2fd2e8[_0x3487('0x15')][_0x3487('0x16')]};});_0x41795b[_0x3487('0x17')]=_[_0x3487('0x18')](_0x382e33,'name');_0x41795b[_0x3487('0x19')]=_[_0x3487('0x1a')](_0x320894[_0x3487('0x19')]);_0x41795b[_0x3487('0x1b')]=_[_0x3487('0x1c')](_0x41795b[_0x3487('0x17')],_0x41795b['query']);_0x41795b[_0x3487('0x1b')]=_[_0x3487('0x1d')](_0x41795b[_0x3487('0x1b')],['$and','$or',_0x3487('0x1e'),_0x3487('0x1f'),_0x3487('0x20'),_0x3487('0x21'),'$ne',_0x3487('0x22'),_0x3487('0x23'),'$between',_0x3487('0x24'),_0x3487('0x25'),'$notIn','$like',_0x3487('0x26'),_0x3487('0x27'),_0x3487('0x28'),_0x3487('0x29'),_0x3487('0x2a'),_0x3487('0x2b'),_0x3487('0x2c'),_0x3487('0x2d')]);_0x3576ca[_0x3487('0x2e')]=_[_0x3487('0x1c')](_0x41795b[_0x3487('0x17')],qs['fields'](_0x320894['query'][_0x3487('0x2f')]));_0x3576ca[_0x3487('0x2e')]=_0x3576ca['attributes'][_0x3487('0x30')]?_0x3576ca[_0x3487('0x2e')]:_0x41795b['model'];if(!_0x320894['query'][_0x3487('0x31')](_0x3487('0x32'))){_0x3576ca[_0x3487('0x8')]=qs['limit'](_0x320894[_0x3487('0x19')]['limit']);_0x3576ca['offset']=qs['offset'](_0x320894[_0x3487('0x19')][_0x3487('0x6')]);}_0x3576ca['order']=qs['sort'](_0x320894[_0x3487('0x19')]['sort']);_0x3576ca['where']=qs[_0x3487('0x1b')](_[_0x3487('0x33')](_0x320894[_0x3487('0x19')],_0x41795b['filters']),_0x382e33);if(_0x320894[_0x3487('0x19')][_0x3487('0x34')]){_0x3576ca[_0x3487('0x35')]=_[_0x3487('0x36')](_0x3576ca['where'],{'$or':_[_0x3487('0x18')](_0x382e33,function(_0x159e41){if(_0x159e41['type']!==_0x3487('0x37')){var _0x325a3a={};_0x325a3a[_0x159e41[_0x3487('0x10')]]={'$like':'%'+_0x320894[_0x3487('0x19')][_0x3487('0x34')]+'%'};return _0x325a3a;}})});}_0x3576ca=_[_0x3487('0x36')]({},_0x3576ca,_0x320894[_0x3487('0x38')]);var _0x299172={'where':_0x3576ca[_0x3487('0x35')]};return db['CmHopper'][_0x3487('0x9')](_0x299172)[_0x3487('0xc')](function(_0x49e6af){_0xd56d94['count']=_0x49e6af;if(_0x320894[_0x3487('0x19')][_0x3487('0x39')]){_0x3576ca[_0x3487('0x3a')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3576ca);})['then'](function(_0x35e4ea){_0xd56d94[_0x3487('0x3b')]=_0x35e4ea;return _0xd56d94;})['then'](respondWithFilteredResult(_0x2fa630,_0x3576ca))[_0x3487('0x3c')](handleError(_0x2fa630,null));};exports[_0x3487('0x3d')]=function(_0x36a3c7,_0x331185){var _0x106393={'raw':!![],'where':{'id':_0x36a3c7[_0x3487('0x3e')]['id']}},_0xdf2a9e={};_0xdf2a9e[_0x3487('0x17')]=_[_0x3487('0x1a')](db['CmHopper'][_0x3487('0x3f')]);_0xdf2a9e[_0x3487('0x19')]=_['keys'](_0x36a3c7['query']);_0xdf2a9e[_0x3487('0x1b')]=_['intersection'](_0xdf2a9e['model'],_0xdf2a9e[_0x3487('0x19')]);_0x106393['attributes']=_['intersection'](_0xdf2a9e[_0x3487('0x17')],qs[_0x3487('0x2f')](_0x36a3c7['query']['fields']));_0x106393[_0x3487('0x2e')]=_0x106393[_0x3487('0x2e')]['length']?_0x106393[_0x3487('0x2e')]:_0xdf2a9e[_0x3487('0x17')];if(_0x36a3c7['query'][_0x3487('0x39')]){_0x106393[_0x3487('0x3a')]=[{'all':!![]}];}_0x106393=_[_0x3487('0x36')]({},_0x106393,_0x36a3c7['options']);return db[_0x3487('0x13')][_0x3487('0x40')](_0x106393)[_0x3487('0xc')](handleEntityNotFound(_0x331185,null))[_0x3487('0xc')](respondWithResult(_0x331185,null))[_0x3487('0x3c')](handleError(_0x331185,null));};exports[_0x3487('0x41')]=function(_0x25f049,_0x125550){return db['CmHopper'][_0x3487('0x41')](_0x25f049[_0x3487('0x42')],{})[_0x3487('0xc')](respondWithResult(_0x125550,0xc9))[_0x3487('0x3c')](handleError(_0x125550,null));};exports[_0x3487('0xb')]=function(_0x31e766,_0x324ebb){if(_0x31e766[_0x3487('0x42')]['id']){delete _0x31e766['body']['id'];}return db['CmHopper'][_0x3487('0x40')]({'where':{'id':_0x31e766[_0x3487('0x3e')]['id']}})[_0x3487('0xc')](handleEntityNotFound(_0x324ebb,null))[_0x3487('0xc')](saveUpdates(_0x31e766['body'],null))['then'](respondWithResult(_0x324ebb,null))[_0x3487('0x3c')](handleError(_0x324ebb,null));};exports[_0x3487('0x43')]=function(_0x3fe91f,_0x21a40e){return db[_0x3487('0x13')][_0x3487('0x43')]()[_0x3487('0xc')](respondWithResult(_0x21a40e,null))[_0x3487('0x3c')](handleError(_0x21a40e,null));};exports['destroy']=function(_0x585a44,_0x320351){var _0x6865a5;var _0x58e50c=_0x585a44[_0x3487('0x3e')]['id'];return db['CmHopper']['find']({'where':{'id':_0x585a44[_0x3487('0x3e')]['id']}})[_0x3487('0xc')](handleEntityNotFound(_0x320351,null))['then'](function(_0x8591e5){if(_0x8591e5){return _0x8591e5[_0x3487('0x44')]()[_0x3487('0xc')](function(_0x4ab5f8){return _0x4ab5f8;});}})[_0x3487('0xc')](function(_0x56b3fa){_0x6865a5=_0x56b3fa;if(_0x56b3fa){if(_0x56b3fa[_0x3487('0x45')]||_0x56b3fa[_0x3487('0x46')]){return db[_0x56b3fa['VoiceQueueId']?_0x3487('0x47'):_0x3487('0x48')][_0x3487('0x40')]({'where':{'id':_0x56b3fa[_0x3487('0x45')]?_0x56b3fa[_0x3487('0x45')]:_0x56b3fa[_0x3487('0x46')]},'attributes':['id',_0x3487('0x10')],'raw':!![]});}}})['then'](function(_0x212002){var _0x414695={};if(_0x212002){_['merge'](_0x414695,_[_0x3487('0x49')](_0x6865a5[_0x3487('0x4a')],[_0x3487('0x4b'),_0x3487('0x4c'),'id']));_0x414695[_0x3487('0x4d')]=0x15;_0x414695[_0x3487('0x4e')]=_0x3487('0x4f');_0x414695[_0x3487('0x50')]=_0x212002[_0x3487('0x10')];_0x414695[_0x3487('0x51')]=_0x585a44['user'][_0x3487('0x10')];_0x414695[_0x3487('0x52')]=_0x585a44[_0x3487('0x53')]['id'];_0x414695[_0x3487('0x4f')]=!![];_0x414695[_0x3487('0x54')]=moment()[_0x3487('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x414695[_0x3487('0x56')]=_0x6865a5[_0x3487('0x57')];_0x414695['campaigntype']=_0x6865a5['VoiceQueueId']?_0x3487('0x58'):_0x3487('0x59');return db[_0x3487('0x5a')][_0x3487('0x40')]({'where':{'id':_0x414695[_0x3487('0x5b')]},'attributes':[_0x3487('0x5c'),'lastName']})['then'](function(_0x417250){if(!_[_0x3487('0x5d')](_0x320351)&&!_['isNil'](_0x417250[_0x3487('0x5c')])){_0x414695[_0x3487('0x5e')]=_0x417250[_0x3487('0x5c')];if(!_['isNil'](_0x417250[_0x3487('0x5f')])){_0x414695[_0x3487('0x5e')]+='\x20'+_0x417250['lastName'];}}})['finally'](function(){return db[_0x3487('0x60')][_0x3487('0x41')](_0x414695);});}})[_0x3487('0xc')](function(_0x1e9b34){return db['CmHopperAdditionalPhone'][_0x3487('0x44')]({'where':{'CmHopperId':_0x58e50c}});})[_0x3487('0xc')](function(){return _0x320351[_0x3487('0x4')](0xcc)[_0x3487('0x61')]();})['catch'](handleError(_0x320351,null));};exports['getPreview']=function(_0x11f008,_0x5b3a71){var _0x347a8c=[];return db[_0x3487('0x5a')][_0x3487('0x43')]()[_0x3487('0xc')](function(_0xc985b6){_0x347a8c=_[_0x3487('0x1a')](_0xc985b6);return _0x11f008[_0x3487('0x53')][_0x3487('0x62')]({'where':{'type':_0x3487('0x63'),'dialActive':!![],'dialMethod':_0x3487('0x64')},'attributes':['id',_0x3487('0x65'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x3487('0xc')](function(_0x1dbff1){if(_0x1dbff1&&_0x1dbff1['length']){return db[_0x3487('0x66')]['transaction'](function(_0x55f6c1){var _0x2e724d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3487('0x55')](_0x3487('0x67'))},'VoiceQueueId':{'$in':_[_0x3487('0x18')](_0x1dbff1,'id')},'$or':[{'UserId':null},{'UserId':_0x11f008[_0x3487('0x53')]['id']}]};var _0x2dcfd2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1dbff1)[_0x3487('0x34')](['dialPreviewAutoRecallMe',0x0])[_0x3487('0x18')]('id')[_0x3487('0x68')]()},'$or':[{'UserId':null},{'UserId':_0x11f008[_0x3487('0x53')]['id']}]};var _0x347616={'$or':[_0x2e724d,_0x2dcfd2]};var _0x1612e5=[];if(_0x11f008[_0x3487('0x42')][_0x3487('0x69')]&&_0x11f008[_0x3487('0x42')][_0x3487('0x69')]===_0x3487('0x6a')){if(!_['isEmpty'](_0x11f008['body'][_0x3487('0x6b')])){_0x347616['id']={'$in':_0x11f008['body'][_0x3487('0x6b')]};}_0x1612e5=[[_0x3487('0x6c'),_0x3487('0x6d')],[_0x3487('0x6e'),_0x1dbff1[0x0]['dialOrderByScheduledAt']===_0x3487('0x6d')?_0x3487('0x6f'):_0x3487('0x6d')],db[_0x3487('0x66')][_0x3487('0x70')](_0x3487('0x71')),['id','DESC']];}else{if(!_[_0x3487('0x72')](_0x11f008[_0x3487('0x42')]['hopperIds'])){_0x347616['id']={'$notIn':_0x11f008[_0x3487('0x42')][_0x3487('0x6b')]};}_0x1612e5=[[_0x3487('0x6c'),_0x3487('0x6f')],[_0x3487('0x6e'),_0x1dbff1[0x0][_0x3487('0x65')]],db[_0x3487('0x66')][_0x3487('0x70')](_0x3487('0x73')),['id',_0x3487('0x6d')]];}return db['CmHopper'][_0x3487('0x74')]({'attributes':['id','scheduledat','phone',_0x3487('0x75')],'where':_0x347616,'order':_0x1612e5,'transaction':_0x55f6c1,'lock':_0x55f6c1['LOCK'][_0x3487('0x76')],'include':[{'model':db[_0x3487('0x5a')],'as':_0x3487('0x77'),'attributes':_0x347a8c,'include':[{'model':db['CmCompany'],'as':_0x3487('0x78'),'attributes':['id',_0x3487('0x10')]}]},{'model':db[_0x3487('0x79')],'as':'List','attributes':['id',_0x3487('0x10')]},{'model':db[_0x3487('0x47')],'as':_0x3487('0x7a'),'attributes':['id','name','dialActive']}]})[_0x3487('0xc')](function(_0xd2e056){if(_0xd2e056){return _0xd2e056[_0x3487('0xb')]({'UserId':_0x11f008[_0x3487('0x53')]['id']},{'transaction':_0x55f6c1});}});});}})[_0x3487('0xc')](handleEntityNotFound(_0x5b3a71,null))[_0x3487('0xc')](respondWithResult(_0x5b3a71,null))[_0x3487('0x3c')](handleError(_0x5b3a71,null));};exports[_0x3487('0x7b')]=function(_0x2544fd,_0xd482a,_0x43631d){var _0x15e31c=[];var _0x226b97=_0x2544fd[_0x3487('0x3e')]['id'];var _0x7d80f=_0x2544fd[_0x3487('0x53')]['id'];return db[_0x3487('0x5a')][_0x3487('0x43')]()[_0x3487('0xc')](function(_0x50af7b){_0x15e31c=_[_0x3487('0x1a')](_0x50af7b);return db[_0x3487('0x66')][_0x3487('0x7c')](function(_0x9bbb2e){const _0x23cba6={'id':_0x226b97};return db['CmHopper']['findOne']({'attributes':['id',_0x3487('0x7d'),_0x3487('0x75')],'where':_0x23cba6,'transaction':_0x9bbb2e,'lock':_0x9bbb2e[_0x3487('0x7e')][_0x3487('0x76')],'include':[{'model':db[_0x3487('0x5a')],'as':_0x3487('0x77'),'attributes':_0x15e31c,'include':[{'model':db[_0x3487('0x7f')],'as':'Company','attributes':['id',_0x3487('0x10')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x3487('0x10')]},{'model':db[_0x3487('0x47')],'as':_0x3487('0x7a'),'attributes':['id',_0x3487('0x10'),_0x3487('0x80')]}]})[_0x3487('0xc')](function(_0x3f9321){if(_0x3f9321){return _0x3f9321[_0x3487('0xb')]({'UserId':_0x7d80f},{'transaction':_0x9bbb2e});}});});})[_0x3487('0xc')](handleEntityNotFound(_0xd482a,null))[_0x3487('0xc')](respondWithResult(_0xd482a,null))[_0x3487('0x3c')](handleError(_0xd482a,null));};exports[_0x3487('0x81')]=function(_0xd45305,_0x11d40c){return _0xd45305[_0x3487('0x53')]['getVoiceQueues']({'where':{'type':_0x3487('0x63'),'dialActive':!![],'dialMethod':_0x3487('0x64')},'attributes':['id'],'raw':!![]})[_0x3487('0xc')](function(_0x37ede7){if(_0x37ede7&&_0x37ede7['length']){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3487('0x55')](_0x3487('0x67'))},'VoiceQueueId':{'$in':_[_0x3487('0x18')](_0x37ede7,'id')},'$or':[{'UserId':null},{'UserId':_0xd45305[_0x3487('0x53')]['id']}]}});}return 0x0;})[_0x3487('0xc')](function(_0x4dead7){if(!_[_0x3487('0x5d')](_0x4dead7)&&_['isNumber'](_0x4dead7)){return _0x11d40c[_0x3487('0x4')](0xc8)[_0x3487('0x5')]({'contacts':_0x4dead7});}else{logger[_0x3487('0xe')](_0x3487('0x82'),_0x3487('0x81'),0x194,_0x3487('0x83'));_0x11d40c[_0x3487('0xd')](0x194);}})['catch'](handleError(_0x11d40c,null));};exports[_0x3487('0x84')]=function(_0x459292,_0xc5346){var _0xc6e8ff=shared[_0x3487('0x85')];var _0xff0526=[];_[_0x3487('0x18')](_0xc6e8ff,function(_0xcb5c41){_0xff0526[_0x3487('0x86')]({'id':_0xcb5c41[_0x3487('0x10')],'name':_0xcb5c41[_0x3487('0x10')],'utcOffset':_0xcb5c41[_0x3487('0x87')]});});return _0xc5346['status'](0xc8)['json']({'tz':_0xff0526});};exports[_0x3487('0x88')]=function(_0x3188e9,_0xcfb667){var _0x3abde2=shared[_0x3487('0x85')];var _0x5759bc={};if(!_['isNil'](_0x3abde2[_0x3188e9[_0x3487('0x42')]['id']]))_0x5759bc=_0x3abde2[_0x3188e9['body']['id']];return _0xcfb667[_0x3487('0x4')](0xc8)[_0x3487('0x5')](_0x5759bc);}; \ No newline at end of file +var _0x8d0a=['$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','map','VIRTUAL','filter','options','CmHopper','count','then','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','Queue','dialActive','LOCK','CmList','List','getOpenContacts','outbound','isNumber','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','set','Content-Range','json','update','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','keys','query','filters','intersection','$and','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains'];(function(_0x46d8b2,_0x3829c4){var _0x1a351f=function(_0x279ce5){while(--_0x279ce5){_0x46d8b2['push'](_0x46d8b2['shift']());}};_0x1a351f(++_0x3829c4);}(_0x8d0a,0x65));var _0xa8d0=function(_0x3b3750,_0x28f3b8){_0x3b3750=_0x3b3750-0x0;var _0x1b9e8b=_0x8d0a[_0x3b3750];return _0x1b9e8b;};'use strict';var moment=require(_0xa8d0('0x0'));var _=require('lodash');var qs=require(_0xa8d0('0x1'));var logger=require(_0xa8d0('0x2'))(_0xa8d0('0x3'));var shared=require(_0xa8d0('0x4'));var db=require(_0xa8d0('0x5'))['db'];function respondWithResult(_0x477190,_0x528287){_0x528287=_0x528287||0xc8;return function(_0x202833){if(_0x202833){return _0x477190[_0xa8d0('0x6')](_0x528287)['json'](_0x202833);}};}function respondWithFilteredResult(_0x1cac4f,_0x212aaf){return function(_0x1f95a7){if(_0x1f95a7){var _0x1f8b78=typeof _0x212aaf[_0xa8d0('0x7')]==='undefined'&&typeof _0x212aaf['limit']===_0xa8d0('0x8');var _0x823481=_0x1f95a7['count'];var _0x5362af=_0x1f8b78?0x0:_0x212aaf['offset'];var _0x296b54=_0x1f8b78?_0x1f95a7['count']:_0x212aaf[_0xa8d0('0x7')]+_0x212aaf[_0xa8d0('0x9')];var _0x44541e;if(_0x296b54>=_0x823481){_0x296b54=_0x823481;_0x44541e=0xc8;}else{_0x44541e=0xce;}_0x1cac4f[_0xa8d0('0x6')](_0x44541e);return _0x1cac4f[_0xa8d0('0xa')](_0xa8d0('0xb'),_0x5362af+'-'+_0x296b54+'/'+_0x823481)[_0xa8d0('0xc')](_0x1f95a7);}return null;};}function saveUpdates(_0x3bf335,_0x329583){return function(_0x1bfcb6){if(_0x1bfcb6){return _0x1bfcb6[_0xa8d0('0xd')](_0x3bf335)['then'](function(_0x757540){return _0x757540;});}return null;};}function handleEntityNotFound(_0x478f66,_0x5a9193){return function(_0x32ea3e){if(!_0x32ea3e){_0x478f66[_0xa8d0('0xe')](0x194);}return _0x32ea3e;};}function handleError(_0x523ec0,_0x31da9f){_0x31da9f=_0x31da9f||0x1f4;return function(_0x459e9d){logger[_0xa8d0('0xf')](_0x459e9d[_0xa8d0('0x10')]);if(_0x459e9d[_0xa8d0('0x11')]){delete _0x459e9d[_0xa8d0('0x11')];}_0x523ec0['status'](_0x31da9f)[_0xa8d0('0x12')](_0x459e9d);};}exports[_0xa8d0('0x13')]=function(_0x5cf619,_0x2f0b00){var _0x1e325a={},_0x53d168={},_0x32b11a={'count':0x0,'rows':[]};var _0xf9267d=_['map'](db['CmHopper'][_0xa8d0('0x14')],function(_0x25ed8d){return{'name':_0x25ed8d['fieldName'],'type':_0x25ed8d[_0xa8d0('0x15')][_0xa8d0('0x16')]};});_0x53d168[_0xa8d0('0x17')]=_['map'](_0xf9267d,_0xa8d0('0x11'));_0x53d168['query']=_[_0xa8d0('0x18')](_0x5cf619[_0xa8d0('0x19')]);_0x53d168[_0xa8d0('0x1a')]=_[_0xa8d0('0x1b')](_0x53d168[_0xa8d0('0x17')],_0x53d168[_0xa8d0('0x19')]);_0x53d168[_0xa8d0('0x1a')]=_['concat'](_0x53d168['filters'],[_0xa8d0('0x1c'),'$or',_0xa8d0('0x1d'),_0xa8d0('0x1e'),_0xa8d0('0x1f'),_0xa8d0('0x20'),_0xa8d0('0x21'),'$eq',_0xa8d0('0x22'),_0xa8d0('0x23'),_0xa8d0('0x24'),_0xa8d0('0x25'),_0xa8d0('0x26'),_0xa8d0('0x27'),_0xa8d0('0x28'),_0xa8d0('0x29'),'$notILike',_0xa8d0('0x27'),_0xa8d0('0x2a'),_0xa8d0('0x2b'),_0xa8d0('0x2c'),_0xa8d0('0x2d')]);_0x1e325a[_0xa8d0('0x2e')]=_['intersection'](_0x53d168[_0xa8d0('0x17')],qs[_0xa8d0('0x2f')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x2f')]));_0x1e325a['attributes']=_0x1e325a[_0xa8d0('0x2e')][_0xa8d0('0x30')]?_0x1e325a['attributes']:_0x53d168['model'];if(!_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x31')](_0xa8d0('0x32'))){_0x1e325a[_0xa8d0('0x9')]=qs[_0xa8d0('0x9')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x9')]);_0x1e325a[_0xa8d0('0x7')]=qs[_0xa8d0('0x7')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x7')]);}_0x1e325a[_0xa8d0('0x33')]=qs['sort'](_0x5cf619['query'][_0xa8d0('0x34')]);_0x1e325a['where']=qs[_0xa8d0('0x1a')](_[_0xa8d0('0x35')](_0x5cf619[_0xa8d0('0x19')],_0x53d168[_0xa8d0('0x1a')]),_0xf9267d);if(_0x5cf619[_0xa8d0('0x19')]['filter']){_0x1e325a['where']=_[_0xa8d0('0x36')](_0x1e325a[_0xa8d0('0x37')],{'$or':_[_0xa8d0('0x38')](_0xf9267d,function(_0x1352ed){if(_0x1352ed[_0xa8d0('0x15')]!==_0xa8d0('0x39')){var _0x5b2d5e={};_0x5b2d5e[_0x1352ed[_0xa8d0('0x11')]]={'$like':'%'+_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x3a')]+'%'};return _0x5b2d5e;}})});}_0x1e325a=_['merge']({},_0x1e325a,_0x5cf619[_0xa8d0('0x3b')]);var _0x4ac500={'where':_0x1e325a[_0xa8d0('0x37')]};return db[_0xa8d0('0x3c')][_0xa8d0('0x3d')](_0x4ac500)[_0xa8d0('0x3e')](function(_0x27515e){_0x32b11a['count']=_0x27515e;if(_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x3f')]){_0x1e325a[_0xa8d0('0x40')]=[{'all':!![]}];}return db[_0xa8d0('0x3c')][_0xa8d0('0x41')](_0x1e325a);})[_0xa8d0('0x3e')](function(_0x5dea4a){_0x32b11a[_0xa8d0('0x42')]=_0x5dea4a;return _0x32b11a;})[_0xa8d0('0x3e')](respondWithFilteredResult(_0x2f0b00,_0x1e325a))[_0xa8d0('0x43')](handleError(_0x2f0b00,null));};exports[_0xa8d0('0x44')]=function(_0xeba90c,_0x2f5186){var _0x1c1e05={'raw':!![],'where':{'id':_0xeba90c['params']['id']}},_0x10dc8b={};_0x10dc8b[_0xa8d0('0x17')]=_['keys'](db[_0xa8d0('0x3c')][_0xa8d0('0x14')]);_0x10dc8b[_0xa8d0('0x19')]=_[_0xa8d0('0x18')](_0xeba90c[_0xa8d0('0x19')]);_0x10dc8b[_0xa8d0('0x1a')]=_[_0xa8d0('0x1b')](_0x10dc8b[_0xa8d0('0x17')],_0x10dc8b[_0xa8d0('0x19')]);_0x1c1e05[_0xa8d0('0x2e')]=_[_0xa8d0('0x1b')](_0x10dc8b[_0xa8d0('0x17')],qs['fields'](_0xeba90c[_0xa8d0('0x19')][_0xa8d0('0x2f')]));_0x1c1e05[_0xa8d0('0x2e')]=_0x1c1e05[_0xa8d0('0x2e')][_0xa8d0('0x30')]?_0x1c1e05[_0xa8d0('0x2e')]:_0x10dc8b['model'];if(_0xeba90c[_0xa8d0('0x19')][_0xa8d0('0x3f')]){_0x1c1e05[_0xa8d0('0x40')]=[{'all':!![]}];}_0x1c1e05=_[_0xa8d0('0x36')]({},_0x1c1e05,_0xeba90c[_0xa8d0('0x3b')]);return db[_0xa8d0('0x3c')][_0xa8d0('0x45')](_0x1c1e05)[_0xa8d0('0x3e')](handleEntityNotFound(_0x2f5186,null))['then'](respondWithResult(_0x2f5186,null))[_0xa8d0('0x43')](handleError(_0x2f5186,null));};exports['create']=function(_0x3f6760,_0x1ae68b){return db[_0xa8d0('0x3c')][_0xa8d0('0x46')](_0x3f6760['body'],{})[_0xa8d0('0x3e')](respondWithResult(_0x1ae68b,0xc9))[_0xa8d0('0x43')](handleError(_0x1ae68b,null));};exports['update']=function(_0x22be14,_0x4b0d20){if(_0x22be14[_0xa8d0('0x47')]['id']){delete _0x22be14['body']['id'];}return db['CmHopper'][_0xa8d0('0x45')]({'where':{'id':_0x22be14[_0xa8d0('0x48')]['id']}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x4b0d20,null))[_0xa8d0('0x3e')](saveUpdates(_0x22be14['body'],null))[_0xa8d0('0x3e')](respondWithResult(_0x4b0d20,null))[_0xa8d0('0x43')](handleError(_0x4b0d20,null));};exports[_0xa8d0('0x49')]=function(_0x352adc,_0x2258d1){return db['CmHopper'][_0xa8d0('0x49')]()['then'](respondWithResult(_0x2258d1,null))[_0xa8d0('0x43')](handleError(_0x2258d1,null));};exports[_0xa8d0('0x4a')]=function(_0x3dd3ae,_0x5a2aef){var _0x900fd0;var _0x149d65=_0x3dd3ae[_0xa8d0('0x48')]['id'];return db[_0xa8d0('0x3c')][_0xa8d0('0x45')]({'where':{'id':_0x3dd3ae['params']['id']}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x5a2aef,null))[_0xa8d0('0x3e')](function(_0x5329d3){if(_0x5329d3){return _0x5329d3[_0xa8d0('0x4a')]()[_0xa8d0('0x3e')](function(_0x20b617){return _0x20b617;});}})[_0xa8d0('0x3e')](function(_0x2eeed7){_0x900fd0=_0x2eeed7;if(_0x2eeed7){if(_0x2eeed7[_0xa8d0('0x4b')]||_0x2eeed7[_0xa8d0('0x4c')]){return db[_0x2eeed7['VoiceQueueId']?_0xa8d0('0x4d'):'Campaign']['find']({'where':{'id':_0x2eeed7[_0xa8d0('0x4b')]?_0x2eeed7[_0xa8d0('0x4b')]:_0x2eeed7['CampaignId']},'attributes':['id',_0xa8d0('0x11')],'raw':!![]});}}})[_0xa8d0('0x3e')](function(_0x238a3f){var _0x5bc28c={};if(_0x238a3f){_[_0xa8d0('0x36')](_0x5bc28c,_['omit'](_0x900fd0[_0xa8d0('0x4e')],[_0xa8d0('0x4f'),_0xa8d0('0x50'),'id']));_0x5bc28c[_0xa8d0('0x51')]=0x15;_0x5bc28c[_0xa8d0('0x52')]=_0xa8d0('0x53');_0x5bc28c['campaign']=_0x238a3f[_0xa8d0('0x11')];_0x5bc28c[_0xa8d0('0x54')]=_0x3dd3ae[_0xa8d0('0x55')]['name'];_0x5bc28c[_0xa8d0('0x56')]=_0x3dd3ae[_0xa8d0('0x55')]['id'];_0x5bc28c[_0xa8d0('0x53')]=!![];_0x5bc28c[_0xa8d0('0x57')]=moment()[_0xa8d0('0x58')](_0xa8d0('0x59'));_0x5bc28c[_0xa8d0('0x5a')]=_0x900fd0[_0xa8d0('0x5b')];_0x5bc28c[_0xa8d0('0x5c')]=_0x900fd0[_0xa8d0('0x4b')]?_0xa8d0('0x5d'):_0xa8d0('0x5e');return db[_0xa8d0('0x5f')]['find']({'where':{'id':_0x5bc28c[_0xa8d0('0x60')]},'attributes':['firstName',_0xa8d0('0x61')]})['then'](function(_0x575301){if(!_[_0xa8d0('0x62')](_0x5a2aef)&&!_[_0xa8d0('0x62')](_0x575301[_0xa8d0('0x63')])){_0x5bc28c['calleridname']=_0x575301['firstName'];if(!_[_0xa8d0('0x62')](_0x575301[_0xa8d0('0x61')])){_0x5bc28c[_0xa8d0('0x64')]+='\x20'+_0x575301['lastName'];}}})[_0xa8d0('0x65')](function(){return db[_0xa8d0('0x66')][_0xa8d0('0x46')](_0x5bc28c);});}})[_0xa8d0('0x3e')](function(_0x20d3fe){return db[_0xa8d0('0x67')]['destroy']({'where':{'CmHopperId':_0x149d65}});})[_0xa8d0('0x3e')](function(){return _0x5a2aef[_0xa8d0('0x6')](0xcc)[_0xa8d0('0x68')]();})[_0xa8d0('0x43')](handleError(_0x5a2aef,null));};exports[_0xa8d0('0x69')]=function(_0x191df2,_0x3504ac){var _0x3a54a9=[];return db[_0xa8d0('0x5f')][_0xa8d0('0x49')]()['then'](function(_0x2e2237){_0x3a54a9=_[_0xa8d0('0x18')](_0x2e2237);return _0x191df2['user'][_0xa8d0('0x6a')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xa8d0('0x6b')},'attributes':['id',_0xa8d0('0x6c'),_0xa8d0('0x6d')],'raw':!![]});})[_0xa8d0('0x3e')](function(_0x59e607){if(_0x59e607&&_0x59e607['length']){return db[_0xa8d0('0x6e')][_0xa8d0('0x6f')](function(_0x41ebd3){var _0x4820d0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa8d0('0x58')](_0xa8d0('0x59'))},'VoiceQueueId':{'$in':_[_0xa8d0('0x38')](_0x59e607,'id')},'$or':[{'UserId':null},{'UserId':_0x191df2[_0xa8d0('0x55')]['id']}]};var _0x203b29={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x59e607)['filter']([_0xa8d0('0x6d'),0x0])[_0xa8d0('0x38')]('id')[_0xa8d0('0x70')]()},'$or':[{'UserId':null},{'UserId':_0x191df2[_0xa8d0('0x55')]['id']}]};var _0x5a2817={'$or':[_0x4820d0,_0x203b29]};var _0x682412=[];if(_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x71')]&&_0x191df2[_0xa8d0('0x47')]['direction']===_0xa8d0('0x72')){if(!_[_0xa8d0('0x73')](_0x191df2[_0xa8d0('0x47')]['hopperIds'])){_0x5a2817['id']={'$in':_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x74')]};}_0x682412=[[_0xa8d0('0x75'),_0xa8d0('0x76')],[_0xa8d0('0x77'),_0x59e607[0x0]['dialOrderByScheduledAt']===_0xa8d0('0x76')?_0xa8d0('0x78'):'ASC'],db[_0xa8d0('0x6e')][_0xa8d0('0x79')](_0xa8d0('0x7a')),['id',_0xa8d0('0x78')]];}else{if(!_[_0xa8d0('0x73')](_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x74')])){_0x5a2817['id']={'$notIn':_0x191df2['body'][_0xa8d0('0x74')]};}_0x682412=[[_0xa8d0('0x75'),_0xa8d0('0x78')],[_0xa8d0('0x77'),_0x59e607[0x0][_0xa8d0('0x6c')]],db[_0xa8d0('0x6e')][_0xa8d0('0x79')](_0xa8d0('0x7b')),['id','ASC']];}return db[_0xa8d0('0x3c')][_0xa8d0('0x7c')]({'attributes':['id',_0xa8d0('0x7d'),_0xa8d0('0x5b'),_0xa8d0('0x7e')],'where':_0x5a2817,'order':_0x682412,'transaction':_0x41ebd3,'lock':_0x41ebd3['LOCK'][_0xa8d0('0x7f')],'include':[{'model':db[_0xa8d0('0x5f')],'as':_0xa8d0('0x80'),'attributes':_0x3a54a9,'include':[{'model':db[_0xa8d0('0x81')],'as':_0xa8d0('0x82'),'attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xa8d0('0x11')]},{'model':db[_0xa8d0('0x4d')],'as':_0xa8d0('0x83'),'attributes':['id','name',_0xa8d0('0x84')]}]})[_0xa8d0('0x3e')](function(_0x4e373c){if(_0x4e373c){return _0x4e373c[_0xa8d0('0xd')]({'UserId':_0x191df2[_0xa8d0('0x55')]['id']},{'transaction':_0x41ebd3});}});});}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x3504ac,null))['then'](respondWithResult(_0x3504ac,null))['catch'](handleError(_0x3504ac,null));};exports['getPreviewRecall']=function(_0x2e50c5,_0x5ea683,_0x1effc3){var _0x29d2c1=[];var _0x185a62=_0x2e50c5[_0xa8d0('0x48')]['id'];var _0x5c8ce5=_0x2e50c5[_0xa8d0('0x55')]['id'];return db[_0xa8d0('0x5f')][_0xa8d0('0x49')]()['then'](function(_0x37cba8){_0x29d2c1=_[_0xa8d0('0x18')](_0x37cba8);return db[_0xa8d0('0x6e')][_0xa8d0('0x6f')](function(_0x348529){const _0x4509c6={'id':_0x185a62};return db[_0xa8d0('0x3c')][_0xa8d0('0x7c')]({'attributes':['id',_0xa8d0('0x7d'),'recallme'],'where':_0x4509c6,'transaction':_0x348529,'lock':_0x348529[_0xa8d0('0x85')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xa8d0('0x80'),'attributes':_0x29d2c1,'include':[{'model':db[_0xa8d0('0x81')],'as':'Company','attributes':['id','name']}]},{'model':db[_0xa8d0('0x86')],'as':_0xa8d0('0x87'),'attributes':['id',_0xa8d0('0x11')]},{'model':db[_0xa8d0('0x4d')],'as':_0xa8d0('0x83'),'attributes':['id','name','dialActive']}]})[_0xa8d0('0x3e')](function(_0x12ad99){if(_0x12ad99){return _0x12ad99['update']({'UserId':_0x5c8ce5},{'transaction':_0x348529});}});});})[_0xa8d0('0x3e')](handleEntityNotFound(_0x5ea683,null))['then'](respondWithResult(_0x5ea683,null))[_0xa8d0('0x43')](handleError(_0x5ea683,null));};exports[_0xa8d0('0x88')]=function(_0x975558,_0x4dad88){return _0x975558['user']['getVoiceQueues']({'where':{'type':_0xa8d0('0x89'),'dialActive':!![],'dialMethod':_0xa8d0('0x6b')},'attributes':['id'],'raw':!![]})[_0xa8d0('0x3e')](function(_0x1815c8){if(_0x1815c8&&_0x1815c8[_0xa8d0('0x30')]){return db[_0xa8d0('0x3c')][_0xa8d0('0x3d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa8d0('0x59'))},'VoiceQueueId':{'$in':_['map'](_0x1815c8,'id')},'$or':[{'UserId':null},{'UserId':_0x975558[_0xa8d0('0x55')]['id']}]}});}return 0x0;})[_0xa8d0('0x3e')](function(_0x379286){if(!_[_0xa8d0('0x62')](_0x379286)&&_[_0xa8d0('0x8a')](_0x379286)){return _0x4dad88[_0xa8d0('0x6')](0xc8)['json']({'contacts':_0x379286});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0xa8d0('0x88'),0x194,_0xa8d0('0x8b'));_0x4dad88[_0xa8d0('0xe')](0x194);}})[_0xa8d0('0x43')](handleError(_0x4dad88,null));};exports[_0xa8d0('0x8c')]=function(_0x2e439b,_0xfcdf8c){var _0x543521=shared['timezones'];var _0x458af1=[];_[_0xa8d0('0x38')](_0x543521,function(_0x4eb658){_0x458af1[_0xa8d0('0x8d')]({'id':_0x4eb658['name'],'name':_0x4eb658['name'],'utcOffset':_0x4eb658[_0xa8d0('0x8e')]});});return _0xfcdf8c[_0xa8d0('0x6')](0xc8)[_0xa8d0('0xc')]({'tz':_0x458af1});};exports[_0xa8d0('0x8f')]=function(_0x1d8197,_0x2be1ad){var _0x76609=shared[_0xa8d0('0x90')];var _0x4fc9fe={};if(!_[_0xa8d0('0x62')](_0x76609[_0x1d8197['body']['id']]))_0x4fc9fe=_0x76609[_0x1d8197[_0xa8d0('0x47')]['id']];return _0x2be1ad[_0xa8d0('0x6')](0xc8)[_0xa8d0('0xc')](_0x4fc9fe);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index bc11e93..c8fe4b6 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 _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger'];(function(_0x4b1012,_0x1415eb){var _0x23d715=function(_0x25f330){while(--_0x25f330){_0x4b1012['push'](_0x4b1012['shift']());}};_0x23d715(++_0x1415eb);}(_0x2a07,0x74));var _0x72a0=function(_0xe2b8fc,_0x3ec76a){_0xe2b8fc=_0xe2b8fc-0x0;var _0x1bfefb=_0x2a07[_0xe2b8fc];return _0x1bfefb;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xe')]},{'name':_0x72a0('0xf'),'fields':[_0x72a0('0xf')]},{'name':_0x72a0('0x10'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['request-promise','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x276c51,_0x471517){var _0x2bf9a4=function(_0x349daf){while(--_0x349daf){_0x276c51['push'](_0x276c51['shift']());}};_0x2bf9a4(++_0x471517);}(_0x5496,0x175));var _0x6549=function(_0x4aa10e,_0x3e6e74){_0x4aa10e=_0x4aa10e-0x0;var _0x55c70f=_0x5496[_0x4aa10e];return _0x55c70f;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('CmHopper',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xb')]},{'name':'phone','fields':[_0x6549('0xc')]},{'name':_0x6549('0xd'),'fields':[_0x6549('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index b8fcb31..e52b9fe 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 _0x9cbb=['active','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','Contact','keys','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','lodash','util','moment','bluebird','../../mysqldb','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','then','info','GetCmHopper','debug','stringify','catch','error','message','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','LOCK','User','Agent','name','voicePause','length','UserId','push','includes','update','all','dataValues'];(function(_0x2cc9e7,_0x45296b){var _0x4dda3d=function(_0x1df912){while(--_0x1df912){_0x2cc9e7['push'](_0x2cc9e7['shift']());}};_0x4dda3d(++_0x45296b);}(_0x9cbb,0x103));var _0xb9cb=function(_0x7a377e,_0x3b2067){_0x7a377e=_0x7a377e-0x0;var _0x4308c7=_0x9cbb[_0x7a377e];return _0x4308c7;};'use strict';var _=require(_0xb9cb('0x0'));var util=require(_0xb9cb('0x1'));var moment=require(_0xb9cb('0x2'));var BPromise=require(_0xb9cb('0x3'));var db=require(_0xb9cb('0x4'))['db'];var logger=require('../../config/logger')('rpc');exports['GetCmHopper']=function(_0x14d0d){var _0xc5c49d=this;return new Promise(function(_0x53da30,_0x53bc5a){return db[_0xb9cb('0x5')][_0xb9cb('0x6')]({'raw':_0x14d0d[_0xb9cb('0x7')]?_0x14d0d[_0xb9cb('0x7')][_0xb9cb('0x8')]===undefined?!![]:![]:!![],'where':_0x14d0d[_0xb9cb('0x7')]?_0x14d0d['options'][_0xb9cb('0x9')]||null:null,'attributes':_0x14d0d[_0xb9cb('0x7')]?_0x14d0d[_0xb9cb('0x7')][_0xb9cb('0xa')]||null:null,'limit':_0x14d0d[_0xb9cb('0x7')]?_0x14d0d[_0xb9cb('0x7')][_0xb9cb('0xb')]||null:null,'include':_0x14d0d[_0xb9cb('0x7')]?_0x14d0d[_0xb9cb('0x7')][_0xb9cb('0xc')]?_['map'](_0x14d0d[_0xb9cb('0x7')][_0xb9cb('0xc')],function(_0x158d78){return{'model':db[_0x158d78[_0xb9cb('0xd')]],'as':_0x158d78['as'],'attributes':_0x158d78[_0xb9cb('0xa')],'include':_0x158d78[_0xb9cb('0xc')]?_[_0xb9cb('0xe')](_0x158d78[_0xb9cb('0xc')],function(_0xd130f1){return{'model':db[_0xd130f1['model']],'as':_0xd130f1['as'],'attributes':_0xd130f1[_0xb9cb('0xa')],'include':_0xd130f1[_0xb9cb('0xc')]?_['map'](_0xd130f1[_0xb9cb('0xc')],function(_0x23d496){return{'model':db[_0x23d496[_0xb9cb('0xd')]],'as':_0x23d496['as'],'attributes':_0x23d496[_0xb9cb('0xa')]};}):[]};}):[]};}):[]:[]})[_0xb9cb('0xf')](function(_0x41c806){logger[_0xb9cb('0x10')](_0xb9cb('0x11'),_0x14d0d);logger[_0xb9cb('0x12')](_0xb9cb('0x11'),_0x14d0d,JSON[_0xb9cb('0x13')](_0x41c806));_0x53da30(_0x41c806);})[_0xb9cb('0x14')](function(_0x45fcc0){logger[_0xb9cb('0x15')](_0xb9cb('0x11'),_0x45fcc0[_0xb9cb('0x16')],_0x14d0d);_0x53bc5a(_0xc5c49d[_0xb9cb('0x15')](0x1f4,_0x45fcc0[_0xb9cb('0x16')]));});});};exports[_0xb9cb('0x17')]=function(_0x22a60a){var _0x7cb20e=this;return new Promise(function(_0x3b4642,_0x54f351){return db['CmHopper'][_0xb9cb('0x18')]({'raw':_0x22a60a[_0xb9cb('0x7')]?_0x22a60a['options']['raw']===undefined?!![]:![]:!![],'where':_0x22a60a[_0xb9cb('0x7')]?_0x22a60a[_0xb9cb('0x7')][_0xb9cb('0x9')]||null:null,'attributes':_0x22a60a[_0xb9cb('0x7')]?_0x22a60a[_0xb9cb('0x7')]['attributes']||null:null,'include':_0x22a60a[_0xb9cb('0x7')]?_0x22a60a[_0xb9cb('0x7')]['include']?_['map'](_0x22a60a[_0xb9cb('0x7')]['include'],function(_0x1530bf){return{'model':db[_0x1530bf['model']],'as':_0x1530bf['as'],'attributes':_0x1530bf[_0xb9cb('0xa')],'include':_0x1530bf[_0xb9cb('0xc')]?_[_0xb9cb('0xe')](_0x1530bf[_0xb9cb('0xc')],function(_0xc21508){return{'model':db[_0xc21508[_0xb9cb('0xd')]],'as':_0xc21508['as'],'attributes':_0xc21508['attributes'],'include':_0xc21508[_0xb9cb('0xc')]?_[_0xb9cb('0xe')](_0xc21508[_0xb9cb('0xc')],function(_0x5cb09d){return{'model':db[_0x5cb09d['model']],'as':_0x5cb09d['as'],'attributes':_0x5cb09d[_0xb9cb('0xa')]};}):[]};}):[]};}):[]:[]})[_0xb9cb('0xf')](function(_0x5bba0e){logger[_0xb9cb('0x10')](_0xb9cb('0x17'),_0x22a60a);logger[_0xb9cb('0x12')]('ShowCmHopper',_0x22a60a,JSON[_0xb9cb('0x13')](_0x5bba0e));_0x3b4642(_0x5bba0e);})[_0xb9cb('0x14')](function(_0x544864){logger[_0xb9cb('0x15')](_0xb9cb('0x17'),_0x544864[_0xb9cb('0x16')],_0x22a60a);_0x54f351(_0x7cb20e[_0xb9cb('0x15')](0x1f4,_0x544864[_0xb9cb('0x16')]));});});};exports[_0xb9cb('0x19')]=function(_0x415366){var _0x48101e=this;return new Promise(function(_0x1467e9,_0x4f3301){return db[_0xb9cb('0x5')][_0xb9cb('0x1a')](_0x415366['body'],{'raw':_0x415366[_0xb9cb('0x7')]?_0x415366[_0xb9cb('0x7')][_0xb9cb('0x8')]===undefined?!![]:![]:!![]})[_0xb9cb('0xf')](function(_0x31cd86){logger['info'](_0xb9cb('0x19'),_0x415366);logger[_0xb9cb('0x12')](_0xb9cb('0x19'),_0x415366,JSON[_0xb9cb('0x13')](_0x31cd86));_0x1467e9(_0x31cd86);})[_0xb9cb('0x14')](function(_0x3e0c4b){logger[_0xb9cb('0x15')](_0xb9cb('0x19'),_0x3e0c4b['message'],_0x415366);_0x4f3301(_0x48101e[_0xb9cb('0x15')](0x1f4,_0x3e0c4b[_0xb9cb('0x16')]));});});};exports['UpdateCmHopper']=function(_0x3bf3c8){var _0x4dc6a7=this;return new Promise(function(_0x2949cd,_0x4fa891){return db[_0xb9cb('0x5')]['update'](_0x3bf3c8[_0xb9cb('0x1b')],{'raw':_0x3bf3c8[_0xb9cb('0x7')]?_0x3bf3c8[_0xb9cb('0x7')][_0xb9cb('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bf3c8[_0xb9cb('0x7')]?_0x3bf3c8[_0xb9cb('0x7')][_0xb9cb('0x9')]||null:null,'attributes':_0x3bf3c8[_0xb9cb('0x7')]?_0x3bf3c8['options']['attributes']||null:null,'limit':_0x3bf3c8[_0xb9cb('0x7')]?_0x3bf3c8[_0xb9cb('0x7')][_0xb9cb('0xb')]||null:null})[_0xb9cb('0xf')](function(_0x4ae581){logger[_0xb9cb('0x10')](_0xb9cb('0x1c'),_0x3bf3c8);logger[_0xb9cb('0x10')](_0xb9cb('0x1d'),JSON['stringify'](_0x3bf3c8[_0xb9cb('0x7')][_0xb9cb('0x9')]),_0x3bf3c8[_0xb9cb('0x1b')]['active']);logger[_0xb9cb('0x12')](_0xb9cb('0x1c'),_0x3bf3c8,JSON[_0xb9cb('0x13')](_0x4ae581));_0x2949cd(_0x4ae581);})[_0xb9cb('0x14')](function(_0x1c73ca){logger[_0xb9cb('0x15')]('UpdateCmHopper',_0x1c73ca[_0xb9cb('0x16')],_0x3bf3c8);_0x4fa891(_0x4dc6a7[_0xb9cb('0x15')](0x1f4,_0x1c73ca[_0xb9cb('0x16')]));});});};exports[_0xb9cb('0x1e')]=function(_0x518e6b){var _0x2a30f4=this;return new Promise(function(_0x3c9cd8,_0xf8f88){return db['CmHopper'][_0xb9cb('0x1f')]({'where':_0x518e6b[_0xb9cb('0x7')]?_0x518e6b['options'][_0xb9cb('0x9')]||null:null})['then'](function(_0x572e69){logger['info'](_0xb9cb('0x1e'),_0x518e6b);logger['debug']('DestroyCmHopper',_0x518e6b,JSON[_0xb9cb('0x13')](_0x572e69));_0x3c9cd8(_0x572e69);})[_0xb9cb('0x14')](function(_0x3acb39){logger[_0xb9cb('0x15')](_0xb9cb('0x1e'),_0x3acb39['message'],_0x518e6b);_0xf8f88(_0x2a30f4[_0xb9cb('0x15')](0x1f4,_0x3acb39[_0xb9cb('0x16')]));});});};exports[_0xb9cb('0x20')]=function(_0x209c63){var _0x470b6a=this;return new Promise(function(_0x244a4e,_0x245d2a){return db[_0xb9cb('0x21')][_0xb9cb('0x22')]()[_0xb9cb('0xf')](function(_0x1c7c67){return db[_0xb9cb('0x23')][_0xb9cb('0x24')](function(_0x4221fd){return db['CmHopper'][_0xb9cb('0x6')]({'where':_0x209c63[_0xb9cb('0x7')]?_0x209c63[_0xb9cb('0x7')][_0xb9cb('0x9')]||null:null,'attributes':_0x209c63[_0xb9cb('0x7')]?_0x209c63[_0xb9cb('0x7')][_0xb9cb('0xa')]||null:null,'limit':_0x209c63[_0xb9cb('0x7')]?_0x209c63[_0xb9cb('0x7')][_0xb9cb('0xb')]||null:null,'order':_0x209c63[_0xb9cb('0x7')]?_0x209c63[_0xb9cb('0x7')]['order']||null:null,'transaction':_0x4221fd,'lock':_0x4221fd[_0xb9cb('0x25')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_['keys'](_0x1c7c67)},{'model':db[_0xb9cb('0x26')],'as':_0xb9cb('0x27'),'attributes':['id',_0xb9cb('0x28'),_0xb9cb('0x29')]}]})[_0xb9cb('0xf')](function(_0x587b8a){var _0x12d0fc=[];var _0x3a57f1=[];for(var _0x481b66=0x0;_0x481b66<_0x587b8a[_0xb9cb('0x2a')];_0x481b66+=0x1){var _0x5ee668=_0x587b8a[_0x481b66][_0xb9cb('0x2b')];if(_0x5ee668===null){_0x12d0fc[_0xb9cb('0x2c')](_0x587b8a[_0x481b66]['update'](_0x209c63[_0xb9cb('0x1b')],{'transaction':_0x4221fd}));}else if(!_0x3a57f1[_0xb9cb('0x2d')](_0x5ee668)){_0x3a57f1[_0xb9cb('0x2c')](_0x5ee668);_0x12d0fc[_0xb9cb('0x2c')](_0x587b8a[_0x481b66][_0xb9cb('0x2e')](_0x209c63[_0xb9cb('0x1b')],{'transaction':_0x4221fd}));}}return BPromise[_0xb9cb('0x2f')](_0x12d0fc);});})[_0xb9cb('0xf')](function(_0x1f12bf){logger[_0xb9cb('0x10')](_0xb9cb('0x20'),_0x209c63);if(_0x1f12bf[_0xb9cb('0x2a')]>0x0){logger[_0xb9cb('0x10')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x1f12bf[0x0][_0xb9cb('0x30')]['id'],_0x1f12bf[0x0][_0xb9cb('0x30')]['ContactId'],_0x1f12bf[0x0][_0xb9cb('0x30')][_0xb9cb('0x31')]);}logger[_0xb9cb('0x12')](_0xb9cb('0x20'),_0x209c63,JSON['stringify'](_0x1f12bf));_0x244a4e(_0x1f12bf);})[_0xb9cb('0x14')](function(_0x13be5){logger[_0xb9cb('0x15')](_0xb9cb('0x20'),_0x13be5[_0xb9cb('0x16')],_0x209c63);_0x245d2a(_0x470b6a[_0xb9cb('0x15')](0x1f4,_0x13be5[_0xb9cb('0x16')]));});});});};exports[_0xb9cb('0x32')]=function(_0x152a58){var _0x78cd15=this;return new Promise(function(_0x3e60a3,_0x59227f){return db['sequelize'][_0xb9cb('0x24')](function(_0x5b9002){return db[_0xb9cb('0x33')][_0xb9cb('0x1a')](_0x152a58['body'],{'raw':_0x152a58[_0xb9cb('0x7')]?_0x152a58['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x5b9002})[_0xb9cb('0xf')](function(){logger[_0xb9cb('0x10')](_0xb9cb('0x34'),JSON[_0xb9cb('0x13')](_0x152a58[_0xb9cb('0x7')][_0xb9cb('0x9')]),_0x152a58[_0xb9cb('0x7')][_0xb9cb('0x9')][_0xb9cb('0x31')]);return db[_0xb9cb('0x5')][_0xb9cb('0x1f')]({'where':_0x152a58['options']?_0x152a58[_0xb9cb('0x7')]['where']||null:null,'transaction':_0x5b9002});});})[_0xb9cb('0xf')](function(_0x4b6589){logger[_0xb9cb('0x10')](_0xb9cb('0x32'),_0x152a58);logger[_0xb9cb('0x12')](_0xb9cb('0x32'),_0x152a58,JSON[_0xb9cb('0x13')](_0x4b6589));_0x3e60a3(_0x4b6589);})[_0xb9cb('0x14')](function(_0x295954){logger['error']('MoveContactManagedDialer',_0x295954[_0xb9cb('0x16')],_0x152a58);_0x59227f(_0x78cd15[_0xb9cb('0x15')](0x1f4,_0x295954[_0xb9cb('0x16')]));});});};exports[_0xb9cb('0x35')]=function(_0x1a14cb){var _0x2778a8=this;return new Promise(function(_0x3c32be,_0x1d921d){return db['CmHopper'][_0xb9cb('0x6')]({'raw':_0x1a14cb[_0xb9cb('0x7')]?_0x1a14cb[_0xb9cb('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x1a14cb[_0xb9cb('0x7')]?_0x1a14cb[_0xb9cb('0x7')]['where']||null:null,'attributes':[[db[_0xb9cb('0x23')]['fn'](_0xb9cb('0x36'),db[_0xb9cb('0x23')]['fn']('IF',db[_0xb9cb('0x23')][_0xb9cb('0x37')](_0xb9cb('0x38')+util['format']('\x22%s\x22',moment()[_0xb9cb('0x39')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0xb9cb('0x3a')]]})[_0xb9cb('0xf')](function(_0x58b291){logger[_0xb9cb('0x10')]('CountReScheduled',_0x1a14cb);logger[_0xb9cb('0x12')](_0xb9cb('0x35'),_0x1a14cb,JSON[_0xb9cb('0x13')](_0x58b291));_0x3c32be(_0x58b291);})['catch'](function(_0x35a160){logger['error'](_0xb9cb('0x35'),_0x35a160['message'],_0x1a14cb);_0x1d921d(_0x2778a8[_0xb9cb('0x15')](0x1f4,_0x35a160[_0xb9cb('0x16')]));});});};exports[_0xb9cb('0x3b')]=function(_0x599840){var _0x98f044=this;return new Promise(function(_0x28144c,_0x4de841){return db[_0xb9cb('0x21')][_0xb9cb('0x22')]()[_0xb9cb('0xf')](function(){return db[_0xb9cb('0x23')][_0xb9cb('0x24')](function(_0x5ec850){return db[_0xb9cb('0x5')][_0xb9cb('0x6')]({'where':_0x599840['options']?_0x599840[_0xb9cb('0x7')][_0xb9cb('0x9')]||null:null,'attributes':_0x599840[_0xb9cb('0x7')]?_0x599840[_0xb9cb('0x7')][_0xb9cb('0xa')]||null:null,'limit':0x1,'order':_0x599840['options']?_0x599840[_0xb9cb('0x7')]['order']||null:null,'group':db['CmHopper'][_0xb9cb('0x2b')],'transaction':_0x5ec850,'lock':_0x5ec850[_0xb9cb('0x25')]['UPDATE'],'include':_0x599840[_0xb9cb('0x7')]?_0x599840[_0xb9cb('0x7')][_0xb9cb('0xc')]?_[_0xb9cb('0xe')](_0x599840['options'][_0xb9cb('0xc')],function(_0x44647e){return{'model':db[_0x44647e[_0xb9cb('0xd')]],'as':_0x44647e['as'],'attributes':_0x44647e[_0xb9cb('0xa')],'include':_0x44647e['include']?_[_0xb9cb('0xe')](_0x44647e[_0xb9cb('0xc')],function(_0x216635){return{'model':db[_0x216635[_0xb9cb('0xd')]],'as':_0x216635['as'],'attributes':_0x216635[_0xb9cb('0xa')],'include':_0x216635[_0xb9cb('0xc')]?_[_0xb9cb('0xe')](_0x216635[_0xb9cb('0xc')],function(_0x9b4c38){return{'model':db[_0x9b4c38[_0xb9cb('0xd')]],'as':_0x9b4c38['as'],'attributes':_0x9b4c38['attributes']};}):[]};}):[]};}):[]:[]})[_0xb9cb('0xf')](function(_0x552e4c){var _0x57e0fd=[];for(var _0x37e738=0x0;_0x37e738<_0x552e4c[_0xb9cb('0x2a')];_0x37e738+=0x1){_0x57e0fd[_0xb9cb('0x2c')](_0x552e4c[_0x37e738][_0xb9cb('0x2e')](_0x599840[_0xb9cb('0x1b')],{'transaction':_0x5ec850}));}return BPromise[_0xb9cb('0x2f')](_0x57e0fd);});})[_0xb9cb('0xf')](function(_0x4781e7){logger[_0xb9cb('0x10')](_0xb9cb('0x3b'),_0x599840);logger[_0xb9cb('0x12')](_0xb9cb('0x3b'),_0x599840,JSON[_0xb9cb('0x13')](_0x4781e7));_0x28144c(_0x4781e7);})['catch'](function(_0x142593){logger[_0xb9cb('0x15')]('GetContactRecallMe',_0x142593[_0xb9cb('0x16')],_0x599840);_0x4de841(_0x98f044['error'](0x1f4,_0x142593['message']));});});});};exports[_0xb9cb('0x3c')]=function(_0x391260){var _0x5bc47b=this;return new Promise(function(_0x2de7de,_0x9986a4){db[_0xb9cb('0x21')][_0xb9cb('0x22')]()['then'](function(_0x2c3564){return db['CmHopper'][_0xb9cb('0x6')]({'raw':_0x391260[_0xb9cb('0x7')]?_0x391260[_0xb9cb('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x391260[_0xb9cb('0x7')]?_0x391260[_0xb9cb('0x7')][_0xb9cb('0x9')]||null:null,'attributes':_0x391260[_0xb9cb('0x7')]?_0x391260['options'][_0xb9cb('0xa')]||null:null,'limit':_0x391260[_0xb9cb('0x7')]?_0x391260['options'][_0xb9cb('0xb')]||null:null,'include':_0x391260[_0xb9cb('0x7')]?_0x391260[_0xb9cb('0x7')][_0xb9cb('0xc')]?_[_0xb9cb('0xe')](_0x391260[_0xb9cb('0x7')]['include'],function(_0x4201f1){return{'model':db[_0x4201f1[_0xb9cb('0xd')]],'as':_0x4201f1['as'],'attributes':_0x4201f1['as']===_0xb9cb('0x3d')?_[_0xb9cb('0x3e')](_0x2c3564):_0x4201f1[_0xb9cb('0xa')],'include':_0x4201f1[_0xb9cb('0xc')]?_['map'](_0x4201f1[_0xb9cb('0xc')],function(_0x39d0e8){return{'model':db[_0x39d0e8[_0xb9cb('0xd')]],'as':_0x39d0e8['as'],'attributes':_0x39d0e8['attributes'],'include':_0x39d0e8[_0xb9cb('0xc')]?_[_0xb9cb('0xe')](_0x39d0e8[_0xb9cb('0xc')],function(_0x44d41f){return{'model':db[_0x44d41f[_0xb9cb('0xd')]],'as':_0x44d41f['as'],'attributes':_0x44d41f[_0xb9cb('0xa')]};}):[]};}):[]};}):[]:[]})[_0xb9cb('0xf')](function(_0x4fd06){logger[_0xb9cb('0x10')]('GetCmHopper',_0x391260);logger[_0xb9cb('0x12')](_0xb9cb('0x11'),_0x391260,JSON['stringify'](_0x4fd06));_0x2de7de(_0x4fd06);})['catch'](function(_0x5f144d){logger[_0xb9cb('0x15')](_0xb9cb('0x11'),_0x5f144d[_0xb9cb('0x16')],_0x391260);_0x9986a4(_0x5bc47b[_0xb9cb('0x15')](0x1f4,_0x5f144d[_0xb9cb('0x16')]));});});});};exports[_0xb9cb('0x3f')]=function(_0xe06e35){var _0x5d8474=this;return new Promise(function(_0x338122,_0x580275){return db['CmContact'][_0xb9cb('0x40')]({'raw':!![],'where':{'phone':_0xe06e35[_0xb9cb('0x7')][_0xb9cb('0x9')][_0xb9cb('0x41')]},'attributes':['id',_0xb9cb('0x42')],'order':[['id','DESC']]})[_0xb9cb('0xf')](function(_0xbcbc6b){logger[_0xb9cb('0x10')](_0xb9cb('0x43'),_0xe06e35);logger['debug'](_0xb9cb('0x43'),_0xe06e35,JSON['stringify'](_0xbcbc6b));_0x338122(_0xbcbc6b);})[_0xb9cb('0x14')](function(_0x3c695f){logger[_0xb9cb('0x15')](_0xb9cb('0x43'),_0x3c695f[_0xb9cb('0x16')],_0xe06e35);_0x580275(_0x5d8474[_0xb9cb('0x15')](0x1f4,_0x3c695f[_0xb9cb('0x16')]));});});};exports[_0xb9cb('0x44')]=function(_0x171b1e){var _0x855def=this;return new Promise(function(_0x1e5ca8,_0x457ac7){return db[_0xb9cb('0x23')][_0xb9cb('0x24')](function(_0x148cd7){var _0x2af781=_0x171b1e[_0xb9cb('0x7')]&&_0x171b1e[_0xb9cb('0x7')][_0xb9cb('0x9')]?_0x171b1e[_0xb9cb('0x7')][_0xb9cb('0x9')]:{};return db['CmHopper']['update'](_0x171b1e[_0xb9cb('0x1b')],{'where':_0x2af781,'transaction':_0x148cd7})[_0xb9cb('0xf')](function(_0x427590){logger[_0xb9cb('0x10')](_0xb9cb('0x44'),_0x171b1e);logger[_0xb9cb('0x12')](_0xb9cb('0x44'),_0x171b1e,JSON[_0xb9cb('0x13')](_0x427590));_0x1e5ca8(_0x427590);})[_0xb9cb('0x14')](function(_0x282011){logger[_0xb9cb('0x15')](_0xb9cb('0x44'),_0x282011[_0xb9cb('0x16')],_0x171b1e);_0x457ac7(_0x855def[_0xb9cb('0x15')](0x1f4,_0x282011[_0xb9cb('0x16')]));});});});};exports[_0xb9cb('0x45')]=function(_0x40092c){var _0x52a90d=this;var _0x5d1c82=_0x40092c[_0xb9cb('0x1b')]['where']['voiceQueueIds'];var _0x5e0257=_0x40092c['body'][_0xb9cb('0x9')][_0xb9cb('0x46')];var _0x561e19=_0x40092c[_0xb9cb('0x1b')][_0xb9cb('0x9')][_0xb9cb('0x47')];return new Promise(function(_0x3388d2,_0xae24a1){return db[_0xb9cb('0x5')][_0xb9cb('0x6')]({'where':{'voiceQueueId':{'$in':_0x5d1c82},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xb9cb('0x23')][_0xb9cb('0x37')](_0xb9cb('0x48')+_0x5e0257+_0xb9cb('0x49')),'$gt':db[_0xb9cb('0x23')][_0xb9cb('0x37')](_0xb9cb('0x4a'))}},'UserId':{'$in':_0x561e19}},'include':[{'model':db[_0xb9cb('0x21')],'as':'Contact'},{'model':db['User'],'as':_0xb9cb('0x27'),'attributes':['id',_0xb9cb('0x28'),_0xb9cb('0x29')]},{'model':db[_0xb9cb('0x4b')],'as':_0xb9cb('0x4c')}]})[_0xb9cb('0xf')](function(_0x2f4207){if(_0x2f4207[_0xb9cb('0x2a')]>0x0){return db[_0xb9cb('0x23')][_0xb9cb('0x24')](function(_0x34dd56){return db[_0xb9cb('0x5')]['update']({'recallmeNotifiedDate':db[_0xb9cb('0x23')][_0xb9cb('0x37')](_0xb9cb('0x4a'))},{'where':{'id':{'$in':_[_0xb9cb('0xe')](_0x2f4207,'id')}},'transaction':_0x34dd56})[_0xb9cb('0xf')](function(){_0x3388d2(_0x2f4207);})[_0xb9cb('0x14')](function(_0x2857e7){logger[_0xb9cb('0x15')](_0xb9cb('0x45'),_0x2857e7['message'],_0x40092c);_0xae24a1(_0x52a90d[_0xb9cb('0x15')](0x1f4,_0x2857e7['message']));});})['catch'](function(_0x50007c){logger[_0xb9cb('0x15')](_0xb9cb('0x45'),_0x50007c[_0xb9cb('0x16')],_0x40092c);_0xae24a1(_0x52a90d[_0xb9cb('0x15')](0x1f4,_0x50007c[_0xb9cb('0x16')]));});}else{_0x3388d2(_0x2f4207);}});});}; \ No newline at end of file +var _0x4cdc=['../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','limit','include','map','model','attributes','then','debug','stringify','catch','error','message','find','raw','where','info','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','keys','User','Agent','name','voicePause','length','push','update','includes','all','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]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','UserId','UPDATE','GetCmHopperPreview','Contact','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','CmList','List','lodash','util'];(function(_0x348eea,_0x3b1098){var _0x516b89=function(_0x173846){while(--_0x173846){_0x348eea['push'](_0x348eea['shift']());}};_0x516b89(++_0x3b1098);}(_0x4cdc,0x13a));var _0xc4cd=function(_0x362daa,_0x44dfd8){_0x362daa=_0x362daa-0x0;var _0x517271=_0x4cdc[_0x362daa];return _0x517271;};'use strict';var _=require(_0xc4cd('0x0'));var util=require(_0xc4cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var db=require(_0xc4cd('0x2'))['db'];var logger=require(_0xc4cd('0x3'))('rpc');exports[_0xc4cd('0x4')]=function(_0x4e80e3){var _0x3fe472=this;return new Promise(function(_0x3bca24,_0xa1c2fa){return db[_0xc4cd('0x5')][_0xc4cd('0x6')]({'raw':_0x4e80e3[_0xc4cd('0x7')]?_0x4e80e3[_0xc4cd('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x4e80e3[_0xc4cd('0x7')]?_0x4e80e3[_0xc4cd('0x7')]['where']||null:null,'attributes':_0x4e80e3[_0xc4cd('0x7')]?_0x4e80e3[_0xc4cd('0x7')]['attributes']||null:null,'limit':_0x4e80e3[_0xc4cd('0x7')]?_0x4e80e3[_0xc4cd('0x7')][_0xc4cd('0x8')]||null:null,'include':_0x4e80e3[_0xc4cd('0x7')]?_0x4e80e3['options'][_0xc4cd('0x9')]?_[_0xc4cd('0xa')](_0x4e80e3['options'][_0xc4cd('0x9')],function(_0x2599f1){return{'model':db[_0x2599f1[_0xc4cd('0xb')]],'as':_0x2599f1['as'],'attributes':_0x2599f1[_0xc4cd('0xc')],'include':_0x2599f1['include']?_[_0xc4cd('0xa')](_0x2599f1[_0xc4cd('0x9')],function(_0x1590ce){return{'model':db[_0x1590ce[_0xc4cd('0xb')]],'as':_0x1590ce['as'],'attributes':_0x1590ce[_0xc4cd('0xc')],'include':_0x1590ce[_0xc4cd('0x9')]?_['map'](_0x1590ce[_0xc4cd('0x9')],function(_0x43116c){return{'model':db[_0x43116c[_0xc4cd('0xb')]],'as':_0x43116c['as'],'attributes':_0x43116c[_0xc4cd('0xc')]};}):[]};}):[]};}):[]:[]})[_0xc4cd('0xd')](function(_0x50637d){logger['info'](_0xc4cd('0x4'),_0x4e80e3);logger[_0xc4cd('0xe')](_0xc4cd('0x4'),_0x4e80e3,JSON[_0xc4cd('0xf')](_0x50637d));_0x3bca24(_0x50637d);})[_0xc4cd('0x10')](function(_0xe20e3d){logger[_0xc4cd('0x11')]('GetCmHopper',_0xe20e3d[_0xc4cd('0x12')],_0x4e80e3);_0xa1c2fa(_0x3fe472['error'](0x1f4,_0xe20e3d[_0xc4cd('0x12')]));});});};exports['ShowCmHopper']=function(_0x4c806c){var _0x26d589=this;return new Promise(function(_0x25ce9b,_0x5e9e4d){return db['CmHopper'][_0xc4cd('0x13')]({'raw':_0x4c806c[_0xc4cd('0x7')]?_0x4c806c[_0xc4cd('0x7')][_0xc4cd('0x14')]===undefined?!![]:![]:!![],'where':_0x4c806c[_0xc4cd('0x7')]?_0x4c806c[_0xc4cd('0x7')][_0xc4cd('0x15')]||null:null,'attributes':_0x4c806c[_0xc4cd('0x7')]?_0x4c806c['options'][_0xc4cd('0xc')]||null:null,'include':_0x4c806c['options']?_0x4c806c[_0xc4cd('0x7')][_0xc4cd('0x9')]?_[_0xc4cd('0xa')](_0x4c806c[_0xc4cd('0x7')][_0xc4cd('0x9')],function(_0x5d5aeb){return{'model':db[_0x5d5aeb['model']],'as':_0x5d5aeb['as'],'attributes':_0x5d5aeb[_0xc4cd('0xc')],'include':_0x5d5aeb['include']?_[_0xc4cd('0xa')](_0x5d5aeb[_0xc4cd('0x9')],function(_0x4420e2){return{'model':db[_0x4420e2[_0xc4cd('0xb')]],'as':_0x4420e2['as'],'attributes':_0x4420e2[_0xc4cd('0xc')],'include':_0x4420e2[_0xc4cd('0x9')]?_['map'](_0x4420e2[_0xc4cd('0x9')],function(_0x1323b4){return{'model':db[_0x1323b4[_0xc4cd('0xb')]],'as':_0x1323b4['as'],'attributes':_0x1323b4[_0xc4cd('0xc')]};}):[]};}):[]};}):[]:[]})[_0xc4cd('0xd')](function(_0x5bc3d7){logger[_0xc4cd('0x16')](_0xc4cd('0x17'),_0x4c806c);logger[_0xc4cd('0xe')](_0xc4cd('0x17'),_0x4c806c,JSON[_0xc4cd('0xf')](_0x5bc3d7));_0x25ce9b(_0x5bc3d7);})[_0xc4cd('0x10')](function(_0x591aa5){logger['error']('ShowCmHopper',_0x591aa5[_0xc4cd('0x12')],_0x4c806c);_0x5e9e4d(_0x26d589['error'](0x1f4,_0x591aa5[_0xc4cd('0x12')]));});});};exports[_0xc4cd('0x18')]=function(_0x4ffcbf){var _0x31377b=this;return new Promise(function(_0x419ac0,_0x374d59){return db['CmHopper'][_0xc4cd('0x19')](_0x4ffcbf[_0xc4cd('0x1a')],{'raw':_0x4ffcbf[_0xc4cd('0x7')]?_0x4ffcbf[_0xc4cd('0x7')][_0xc4cd('0x14')]===undefined?!![]:![]:!![]})[_0xc4cd('0xd')](function(_0x359cbf){logger[_0xc4cd('0x16')](_0xc4cd('0x18'),_0x4ffcbf);logger[_0xc4cd('0xe')]('CreateCmHopper',_0x4ffcbf,JSON[_0xc4cd('0xf')](_0x359cbf));_0x419ac0(_0x359cbf);})[_0xc4cd('0x10')](function(_0x2e46ad){logger[_0xc4cd('0x11')](_0xc4cd('0x18'),_0x2e46ad[_0xc4cd('0x12')],_0x4ffcbf);_0x374d59(_0x31377b[_0xc4cd('0x11')](0x1f4,_0x2e46ad[_0xc4cd('0x12')]));});});};exports[_0xc4cd('0x1b')]=function(_0x3ad09b){var _0x31269e=this;return new Promise(function(_0x9b8d54,_0x3dec21){return db[_0xc4cd('0x5')]['update'](_0x3ad09b[_0xc4cd('0x1a')],{'raw':_0x3ad09b[_0xc4cd('0x7')]?_0x3ad09b[_0xc4cd('0x7')][_0xc4cd('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ad09b[_0xc4cd('0x7')]?_0x3ad09b[_0xc4cd('0x7')]['where']||null:null,'attributes':_0x3ad09b[_0xc4cd('0x7')]?_0x3ad09b[_0xc4cd('0x7')][_0xc4cd('0xc')]||null:null,'limit':_0x3ad09b['options']?_0x3ad09b[_0xc4cd('0x7')]['limit']||null:null})[_0xc4cd('0xd')](function(_0x14c86e){logger[_0xc4cd('0x16')](_0xc4cd('0x1b'),_0x3ad09b);logger[_0xc4cd('0x16')](_0xc4cd('0x1c'),JSON[_0xc4cd('0xf')](_0x3ad09b[_0xc4cd('0x7')]['where']),_0x3ad09b['body'][_0xc4cd('0x1d')]);logger['debug']('UpdateCmHopper',_0x3ad09b,JSON[_0xc4cd('0xf')](_0x14c86e));_0x9b8d54(_0x14c86e);})[_0xc4cd('0x10')](function(_0x46424b){logger[_0xc4cd('0x11')](_0xc4cd('0x1b'),_0x46424b[_0xc4cd('0x12')],_0x3ad09b);_0x3dec21(_0x31269e[_0xc4cd('0x11')](0x1f4,_0x46424b[_0xc4cd('0x12')]));});});};exports[_0xc4cd('0x1e')]=function(_0xc49a97){var _0x19ace6=this;return new Promise(function(_0x195401,_0x1f7a29){return db[_0xc4cd('0x5')][_0xc4cd('0x1f')]({'where':_0xc49a97['options']?_0xc49a97[_0xc4cd('0x7')][_0xc4cd('0x15')]||null:null})['then'](function(_0x255f35){logger[_0xc4cd('0x16')](_0xc4cd('0x1e'),_0xc49a97);logger[_0xc4cd('0xe')](_0xc4cd('0x1e'),_0xc49a97,JSON[_0xc4cd('0xf')](_0x255f35));_0x195401(_0x255f35);})[_0xc4cd('0x10')](function(_0xda9e9){logger[_0xc4cd('0x11')]('DestroyCmHopper',_0xda9e9['message'],_0xc49a97);_0x1f7a29(_0x19ace6[_0xc4cd('0x11')](0x1f4,_0xda9e9[_0xc4cd('0x12')]));});});};exports[_0xc4cd('0x20')]=function(_0x2065ae){var _0xc6d778=this;return new Promise(function(_0x53932a,_0xdffc00){return db[_0xc4cd('0x21')][_0xc4cd('0x22')]()[_0xc4cd('0xd')](function(_0x3a77fc){return db[_0xc4cd('0x23')][_0xc4cd('0x24')](function(_0x4041ea){return db[_0xc4cd('0x5')][_0xc4cd('0x6')]({'where':_0x2065ae[_0xc4cd('0x7')]?_0x2065ae[_0xc4cd('0x7')][_0xc4cd('0x15')]||null:null,'attributes':_0x2065ae[_0xc4cd('0x7')]?_0x2065ae[_0xc4cd('0x7')][_0xc4cd('0xc')]||null:null,'limit':_0x2065ae[_0xc4cd('0x7')]?_0x2065ae[_0xc4cd('0x7')][_0xc4cd('0x8')]||null:null,'order':_0x2065ae['options']?_0x2065ae['options'][_0xc4cd('0x25')]||null:null,'transaction':_0x4041ea,'lock':_0x4041ea[_0xc4cd('0x26')]['UPDATE'],'include':[{'model':db[_0xc4cd('0x21')],'as':'Contact','attributes':_[_0xc4cd('0x27')](_0x3a77fc)},{'model':db[_0xc4cd('0x28')],'as':_0xc4cd('0x29'),'attributes':['id',_0xc4cd('0x2a'),_0xc4cd('0x2b')]}]})[_0xc4cd('0xd')](function(_0x5ce798){var _0x54717c=[];var _0x1eb5e5=[];for(var _0x5fe9a3=0x0;_0x5fe9a3<_0x5ce798[_0xc4cd('0x2c')];_0x5fe9a3+=0x1){var _0x273a9a=_0x5ce798[_0x5fe9a3]['UserId'];if(_0x273a9a===null){_0x54717c[_0xc4cd('0x2d')](_0x5ce798[_0x5fe9a3][_0xc4cd('0x2e')](_0x2065ae[_0xc4cd('0x1a')],{'transaction':_0x4041ea}));}else if(!_0x1eb5e5[_0xc4cd('0x2f')](_0x273a9a)){_0x1eb5e5[_0xc4cd('0x2d')](_0x273a9a);_0x54717c['push'](_0x5ce798[_0x5fe9a3]['update'](_0x2065ae[_0xc4cd('0x1a')],{'transaction':_0x4041ea}));}}return BPromise[_0xc4cd('0x30')](_0x54717c);});})[_0xc4cd('0xd')](function(_0x1d32c3){logger['info'](_0xc4cd('0x20'),_0x2065ae);if(_0x1d32c3[_0xc4cd('0x2c')]>0x0){logger[_0xc4cd('0x16')](_0xc4cd('0x31'),_0x1d32c3[0x0]['dataValues']['id'],_0x1d32c3[0x0][_0xc4cd('0x32')][_0xc4cd('0x33')],_0x1d32c3[0x0][_0xc4cd('0x32')][_0xc4cd('0x1d')]);}logger[_0xc4cd('0xe')](_0xc4cd('0x20'),_0x2065ae,JSON[_0xc4cd('0xf')](_0x1d32c3));_0x53932a(_0x1d32c3);})[_0xc4cd('0x10')](function(_0x3aece4){logger[_0xc4cd('0x11')](_0xc4cd('0x20'),_0x3aece4[_0xc4cd('0x12')],_0x2065ae);_0xdffc00(_0xc6d778[_0xc4cd('0x11')](0x1f4,_0x3aece4[_0xc4cd('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x411c64){var _0x5b39a9=this;return new Promise(function(_0x46bc67,_0x2e3ebe){return db[_0xc4cd('0x23')][_0xc4cd('0x24')](function(_0x63c40e){return db[_0xc4cd('0x34')]['create'](_0x411c64[_0xc4cd('0x1a')],{'raw':_0x411c64[_0xc4cd('0x7')]?_0x411c64[_0xc4cd('0x7')][_0xc4cd('0x14')]===undefined?!![]:![]:!![],'transaction':_0x63c40e})[_0xc4cd('0xd')](function(){logger[_0xc4cd('0x16')](_0xc4cd('0x35'),JSON[_0xc4cd('0xf')](_0x411c64[_0xc4cd('0x7')][_0xc4cd('0x15')]),_0x411c64[_0xc4cd('0x7')][_0xc4cd('0x15')]['active']);return db['CmHopper'][_0xc4cd('0x1f')]({'where':_0x411c64[_0xc4cd('0x7')]?_0x411c64[_0xc4cd('0x7')][_0xc4cd('0x15')]||null:null,'transaction':_0x63c40e});});})[_0xc4cd('0xd')](function(_0x26fd4b){logger[_0xc4cd('0x16')]('MoveContactManagedDialer',_0x411c64);logger[_0xc4cd('0xe')]('MoveContactManagedDialer',_0x411c64,JSON[_0xc4cd('0xf')](_0x26fd4b));_0x46bc67(_0x26fd4b);})[_0xc4cd('0x10')](function(_0x2f18fa){logger[_0xc4cd('0x11')](_0xc4cd('0x36'),_0x2f18fa[_0xc4cd('0x12')],_0x411c64);_0x2e3ebe(_0x5b39a9[_0xc4cd('0x11')](0x1f4,_0x2f18fa[_0xc4cd('0x12')]));});});};exports[_0xc4cd('0x37')]=function(_0x5e6d18){var _0x53c275=this;return new Promise(function(_0x56804e,_0x17bdcc){return db['CmHopper'][_0xc4cd('0x6')]({'raw':_0x5e6d18[_0xc4cd('0x7')]?_0x5e6d18[_0xc4cd('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x5e6d18[_0xc4cd('0x7')]?_0x5e6d18[_0xc4cd('0x7')]['where']||null:null,'attributes':[[db[_0xc4cd('0x23')]['fn'](_0xc4cd('0x38'),db[_0xc4cd('0x23')]['fn']('IF',db[_0xc4cd('0x23')][_0xc4cd('0x39')](_0xc4cd('0x3a')+util['format'](_0xc4cd('0x3b'),moment()[_0xc4cd('0x3c')](_0xc4cd('0x3d')))+_0xc4cd('0x3e')))),'contactsRescheduled']]})[_0xc4cd('0xd')](function(_0x2a9f62){logger[_0xc4cd('0x16')](_0xc4cd('0x37'),_0x5e6d18);logger[_0xc4cd('0xe')]('CountReScheduled',_0x5e6d18,JSON['stringify'](_0x2a9f62));_0x56804e(_0x2a9f62);})[_0xc4cd('0x10')](function(_0x44b5ea){logger[_0xc4cd('0x11')]('CountReScheduled',_0x44b5ea['message'],_0x5e6d18);_0x17bdcc(_0x53c275['error'](0x1f4,_0x44b5ea[_0xc4cd('0x12')]));});});};exports[_0xc4cd('0x3f')]=function(_0x3d16d7){var _0x1f93b8=this;return new Promise(function(_0x12374c,_0xe69b6f){return db[_0xc4cd('0x21')][_0xc4cd('0x22')]()[_0xc4cd('0xd')](function(){return db['sequelize'][_0xc4cd('0x24')](function(_0x5c085a){return db['CmHopper'][_0xc4cd('0x6')]({'where':_0x3d16d7[_0xc4cd('0x7')]?_0x3d16d7['options'][_0xc4cd('0x15')]||null:null,'attributes':_0x3d16d7[_0xc4cd('0x7')]?_0x3d16d7['options']['attributes']||null:null,'limit':0x1,'order':_0x3d16d7[_0xc4cd('0x7')]?_0x3d16d7[_0xc4cd('0x7')][_0xc4cd('0x25')]||null:null,'group':db[_0xc4cd('0x5')][_0xc4cd('0x40')],'transaction':_0x5c085a,'lock':_0x5c085a[_0xc4cd('0x26')][_0xc4cd('0x41')],'include':_0x3d16d7[_0xc4cd('0x7')]?_0x3d16d7['options'][_0xc4cd('0x9')]?_[_0xc4cd('0xa')](_0x3d16d7[_0xc4cd('0x7')][_0xc4cd('0x9')],function(_0x32bdde){return{'model':db[_0x32bdde[_0xc4cd('0xb')]],'as':_0x32bdde['as'],'attributes':_0x32bdde['attributes'],'include':_0x32bdde['include']?_[_0xc4cd('0xa')](_0x32bdde['include'],function(_0x3be04b){return{'model':db[_0x3be04b[_0xc4cd('0xb')]],'as':_0x3be04b['as'],'attributes':_0x3be04b[_0xc4cd('0xc')],'include':_0x3be04b[_0xc4cd('0x9')]?_['map'](_0x3be04b[_0xc4cd('0x9')],function(_0x2dd2ae){return{'model':db[_0x2dd2ae['model']],'as':_0x2dd2ae['as'],'attributes':_0x2dd2ae[_0xc4cd('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b7a56){var _0x5163c6=[];for(var _0x4de20c=0x0;_0x4de20c<_0x1b7a56['length'];_0x4de20c+=0x1){_0x5163c6[_0xc4cd('0x2d')](_0x1b7a56[_0x4de20c][_0xc4cd('0x2e')](_0x3d16d7[_0xc4cd('0x1a')],{'transaction':_0x5c085a}));}return BPromise[_0xc4cd('0x30')](_0x5163c6);});})[_0xc4cd('0xd')](function(_0x8fd39e){logger[_0xc4cd('0x16')](_0xc4cd('0x3f'),_0x3d16d7);logger[_0xc4cd('0xe')](_0xc4cd('0x3f'),_0x3d16d7,JSON[_0xc4cd('0xf')](_0x8fd39e));_0x12374c(_0x8fd39e);})[_0xc4cd('0x10')](function(_0x1274b0){logger[_0xc4cd('0x11')](_0xc4cd('0x3f'),_0x1274b0[_0xc4cd('0x12')],_0x3d16d7);_0xe69b6f(_0x1f93b8[_0xc4cd('0x11')](0x1f4,_0x1274b0[_0xc4cd('0x12')]));});});});};exports[_0xc4cd('0x42')]=function(_0x52838f){var _0x4db59d=this;return new Promise(function(_0xb2e8fc,_0x3da491){db['CmContact'][_0xc4cd('0x22')]()[_0xc4cd('0xd')](function(_0x5cddfd){return db[_0xc4cd('0x5')]['findAll']({'raw':_0x52838f[_0xc4cd('0x7')]?_0x52838f[_0xc4cd('0x7')][_0xc4cd('0x14')]===undefined?!![]:![]:!![],'where':_0x52838f[_0xc4cd('0x7')]?_0x52838f['options'][_0xc4cd('0x15')]||null:null,'attributes':_0x52838f[_0xc4cd('0x7')]?_0x52838f[_0xc4cd('0x7')][_0xc4cd('0xc')]||null:null,'limit':_0x52838f[_0xc4cd('0x7')]?_0x52838f[_0xc4cd('0x7')][_0xc4cd('0x8')]||null:null,'include':_0x52838f[_0xc4cd('0x7')]?_0x52838f[_0xc4cd('0x7')]['include']?_[_0xc4cd('0xa')](_0x52838f[_0xc4cd('0x7')][_0xc4cd('0x9')],function(_0x28e20d){return{'model':db[_0x28e20d[_0xc4cd('0xb')]],'as':_0x28e20d['as'],'attributes':_0x28e20d['as']===_0xc4cd('0x43')?_[_0xc4cd('0x27')](_0x5cddfd):_0x28e20d[_0xc4cd('0xc')],'include':_0x28e20d[_0xc4cd('0x9')]?_[_0xc4cd('0xa')](_0x28e20d['include'],function(_0x53c19d){return{'model':db[_0x53c19d[_0xc4cd('0xb')]],'as':_0x53c19d['as'],'attributes':_0x53c19d[_0xc4cd('0xc')],'include':_0x53c19d['include']?_[_0xc4cd('0xa')](_0x53c19d['include'],function(_0x27604c){return{'model':db[_0x27604c['model']],'as':_0x27604c['as'],'attributes':_0x27604c[_0xc4cd('0xc')]};}):[]};}):[]};}):[]:[]})[_0xc4cd('0xd')](function(_0x5c1ca9){logger[_0xc4cd('0x16')]('GetCmHopper',_0x52838f);logger[_0xc4cd('0xe')](_0xc4cd('0x4'),_0x52838f,JSON[_0xc4cd('0xf')](_0x5c1ca9));_0xb2e8fc(_0x5c1ca9);})[_0xc4cd('0x10')](function(_0x5cae5f){logger[_0xc4cd('0x11')](_0xc4cd('0x4'),_0x5cae5f['message'],_0x52838f);_0x3da491(_0x4db59d[_0xc4cd('0x11')](0x1f4,_0x5cae5f[_0xc4cd('0x12')]));});});});};exports['GetContactByPhone']=function(_0x280f3f){var _0x43600f=this;return new Promise(function(_0x4b1129,_0x194fce){return db[_0xc4cd('0x21')][_0xc4cd('0x44')]({'raw':!![],'where':{'phone':_0x280f3f[_0xc4cd('0x7')][_0xc4cd('0x15')][_0xc4cd('0x45')]},'attributes':['id','dialTimezone'],'order':[['id',_0xc4cd('0x46')]]})['then'](function(_0x3b5a9e){logger[_0xc4cd('0x16')]('getContactByPhone',_0x280f3f);logger[_0xc4cd('0xe')](_0xc4cd('0x47'),_0x280f3f,JSON[_0xc4cd('0xf')](_0x3b5a9e));_0x4b1129(_0x3b5a9e);})[_0xc4cd('0x10')](function(_0x327d15){logger[_0xc4cd('0x11')](_0xc4cd('0x47'),_0x327d15[_0xc4cd('0x12')],_0x280f3f);_0x194fce(_0x43600f[_0xc4cd('0x11')](0x1f4,_0x327d15[_0xc4cd('0x12')]));});});};exports['ResetActiveCalls']=function(_0xe6816d){var _0x30024b=this;return new Promise(function(_0x4c7d59,_0x2a57cb){return db[_0xc4cd('0x23')][_0xc4cd('0x24')](function(_0xbc9195){var _0x48079e=_0xe6816d[_0xc4cd('0x7')]&&_0xe6816d[_0xc4cd('0x7')]['where']?_0xe6816d[_0xc4cd('0x7')][_0xc4cd('0x15')]:{};return db[_0xc4cd('0x5')][_0xc4cd('0x2e')](_0xe6816d[_0xc4cd('0x1a')],{'where':_0x48079e,'transaction':_0xbc9195})['then'](function(_0x20cc91){logger[_0xc4cd('0x16')](_0xc4cd('0x48'),_0xe6816d);logger[_0xc4cd('0xe')]('ResetActiveCalls',_0xe6816d,JSON[_0xc4cd('0xf')](_0x20cc91));_0x4c7d59(_0x20cc91);})[_0xc4cd('0x10')](function(_0x223ae6){logger[_0xc4cd('0x11')](_0xc4cd('0x48'),_0x223ae6[_0xc4cd('0x12')],_0xe6816d);_0x2a57cb(_0x30024b[_0xc4cd('0x11')](0x1f4,_0x223ae6[_0xc4cd('0x12')]));});});});};exports[_0xc4cd('0x49')]=function(_0x2d6a5e){var _0x2c1253=this;var _0x3b0bc8=_0x2d6a5e[_0xc4cd('0x1a')][_0xc4cd('0x15')][_0xc4cd('0x4a')];var _0x2a8d9d=_0x2d6a5e[_0xc4cd('0x1a')][_0xc4cd('0x15')]['interval'];var _0x3f8497=_0x2d6a5e['body'][_0xc4cd('0x15')][_0xc4cd('0x4b')];return new Promise(function(_0x39814c,_0x298b8a){return db[_0xc4cd('0x5')]['findAll']({'where':{'voiceQueueId':{'$in':_0x3b0bc8},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0xc4cd('0x4c')+_0x2a8d9d+'\x20MINUTE'),'$gt':db[_0xc4cd('0x23')][_0xc4cd('0x39')]('NOW()')}},'UserId':{'$in':_0x3f8497}},'include':[{'model':db['CmContact'],'as':_0xc4cd('0x43')},{'model':db['User'],'as':_0xc4cd('0x29'),'attributes':['id','name',_0xc4cd('0x2b')]},{'model':db[_0xc4cd('0x4d')],'as':_0xc4cd('0x4e')}]})[_0xc4cd('0xd')](function(_0x232d21){if(_0x232d21[_0xc4cd('0x2c')]>0x0){return db['sequelize']['transaction'](function(_0x32f5df){return db[_0xc4cd('0x5')][_0xc4cd('0x2e')]({'recallmeNotifiedDate':db[_0xc4cd('0x23')][_0xc4cd('0x39')]('NOW()')},{'where':{'id':{'$in':_[_0xc4cd('0xa')](_0x232d21,'id')}},'transaction':_0x32f5df})[_0xc4cd('0xd')](function(){_0x39814c(_0x232d21);})[_0xc4cd('0x10')](function(_0x20b9a0){logger[_0xc4cd('0x11')](_0xc4cd('0x49'),_0x20b9a0['message'],_0x2d6a5e);_0x298b8a(_0x2c1253[_0xc4cd('0x11')](0x1f4,_0x20b9a0[_0xc4cd('0x12')]));});})['catch'](function(_0x42c308){logger[_0xc4cd('0x11')](_0xc4cd('0x49'),_0x42c308['message'],_0x2d6a5e);_0x298b8a(_0x2c1253[_0xc4cd('0x11')](0x1f4,_0x42c308[_0xc4cd('0x12')]));});}else{_0x39814c(_0x232d21);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index ac1a5b9..ebb9510 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 _0x9ef0=['express','Router','../../components/auth/service','get','/describe','describe','/opencontacts','isAuthenticated','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','/timezone','getTimezone','put','update','delete','destroy','exports'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x9ef0,0x14a));var _0x09ef=function(_0x1901ab,_0x53801c){_0x1901ab=_0x1901ab-0x0;var _0xfb38dc=_0x9ef0[_0x1901ab];return _0xfb38dc;};'use strict';var express=require(_0x09ef('0x0'));var router=express[_0x09ef('0x1')]();var auth=require(_0x09ef('0x2'));var controller=require('./cmHopper.controller');router[_0x09ef('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09ef('0x3')](_0x09ef('0x4'),auth['isAuthenticated'](),controller[_0x09ef('0x5')]);router[_0x09ef('0x3')](_0x09ef('0x6'),auth[_0x09ef('0x7')](),controller['getOpenContacts']);router[_0x09ef('0x3')](_0x09ef('0x8'),auth[_0x09ef('0x7')](),controller[_0x09ef('0x9')]);router[_0x09ef('0x3')](_0x09ef('0xa'),auth['isAuthenticated'](),controller[_0x09ef('0xb')]);router[_0x09ef('0x3')](_0x09ef('0xc'),auth[_0x09ef('0x7')](),controller[_0x09ef('0xd')]);router[_0x09ef('0xe')]('/',auth[_0x09ef('0x7')](),controller['create']);router['post']('/preview',auth['isAuthenticated'](),controller['getPreview']);router['post'](_0x09ef('0xf'),auth[_0x09ef('0x7')](),controller[_0x09ef('0x10')]);router[_0x09ef('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x09ef('0x12')]);router[_0x09ef('0x13')](_0x09ef('0xa'),auth['isAuthenticated'](),controller[_0x09ef('0x14')]);module[_0x09ef('0x15')]=router; \ No newline at end of file +var _0x46ed=['destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','post','create','/preview','getPreview','/timezone','getTimezone','put','update','delete'];(function(_0x27b5a5,_0x18d015){var _0x3fc160=function(_0x3a5436){while(--_0x3a5436){_0x27b5a5['push'](_0x27b5a5['shift']());}};_0x3fc160(++_0x18d015);}(_0x46ed,0xca));var _0xd46e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x46ed[_0x5d6456];return _0x4d66c1;};'use strict';var express=require(_0xd46e('0x0'));var router=express[_0xd46e('0x1')]();var auth=require(_0xd46e('0x2'));var controller=require(_0xd46e('0x3'));router[_0xd46e('0x4')]('/',auth[_0xd46e('0x5')](),controller[_0xd46e('0x6')]);router['get'](_0xd46e('0x7'),auth[_0xd46e('0x5')](),controller['describe']);router[_0xd46e('0x4')](_0xd46e('0x8'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0xd46e('0x4')](_0xd46e('0x9'),auth[_0xd46e('0x5')](),controller[_0xd46e('0xa')]);router[_0xd46e('0x4')](_0xd46e('0xb'),auth[_0xd46e('0x5')](),controller[_0xd46e('0xc')]);router[_0xd46e('0x4')](_0xd46e('0xd'),auth[_0xd46e('0x5')](),controller['getPreviewRecall']);router[_0xd46e('0xe')]('/',auth[_0xd46e('0x5')](),controller[_0xd46e('0xf')]);router[_0xd46e('0xe')](_0xd46e('0x10'),auth['isAuthenticated'](),controller[_0xd46e('0x11')]);router['post'](_0xd46e('0x12'),auth[_0xd46e('0x5')](),controller[_0xd46e('0x13')]);router[_0xd46e('0x14')]('/:id',auth[_0xd46e('0x5')](),controller[_0xd46e('0x15')]);router[_0xd46e('0x16')](_0xd46e('0xb'),auth['isAuthenticated'](),controller[_0xd46e('0x17')]);module[_0xd46e('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 720032a..7f55f0c 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 _0x55d6=['INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x13bf8e,_0x4f4621){var _0xe3bbd5=function(_0x5463c6){while(--_0x5463c6){_0x13bf8e['push'](_0x13bf8e['shift']());}};_0xe3bbd5(++_0x4f4621);}(_0x55d6,0x15c));var _0x655d=function(_0x11db5a,_0x22b33){_0x11db5a=_0x11db5a-0x0;var _0xf872f3=_0x55d6[_0x11db5a];return _0xf872f3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0x655d('0x0')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x655d('0x1')],'defaultValue':moment()[_0x655d('0x2')](_0x655d('0x3'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x655d('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x655d('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x655d('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x655d('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x655d('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb471=['format','sequelize','exports','INTEGER','DATE'];(function(_0x2e485b,_0x4f5d19){var _0x1ded8e=function(_0x552a1d){while(--_0x552a1d){_0x2e485b['push'](_0x2e485b['shift']());}};_0x1ded8e(++_0x4f5d19);}(_0xb471,0x8d));var _0x1b47=function(_0x53ce04,_0x4f1765){_0x53ce04=_0x53ce04-0x0;var _0xe959b0=_0xb471[_0x53ce04];return _0xe959b0;};'use strict';var moment=require('moment');var Sequelize=require(_0x1b47('0x0'));module[_0x1b47('0x1')]={'CmHopperId':{'type':Sequelize[_0x1b47('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x1b47('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x1b47('0x3')],'defaultValue':moment()[_0x1b47('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x1b47('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1b47('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x1b47('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1b47('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1b47('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1b47('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index cadaf42..e6e02ec 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 _0xfa12=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','reject','save','update','destroy','then','get','UserProfileResource','error','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x49afd5,_0x4593cd){var _0x5d0d91=function(_0x2e5011){while(--_0x2e5011){_0x49afd5['push'](_0x49afd5['shift']());}};_0x5d0d91(++_0x4593cd);}(_0xfa12,0x1c4));var _0x2fa1=function(_0x1d2414,_0x23164a){_0x1d2414=_0x1d2414-0x0;var _0x5e01c6=_0xfa12[_0x1d2414];return _0x5e01c6;};'use strict';var emlformat=require(_0x2fa1('0x0'));var rimraf=require(_0x2fa1('0x1'));var zipdir=require(_0x2fa1('0x2'));var jsonpatch=require(_0x2fa1('0x3'));var rp=require(_0x2fa1('0x4'));var moment=require(_0x2fa1('0x5'));var BPromise=require(_0x2fa1('0x6'));var Mustache=require(_0x2fa1('0x7'));var util=require(_0x2fa1('0x8'));var path=require(_0x2fa1('0x9'));var sox=require(_0x2fa1('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fa1('0xb'));var _=require(_0x2fa1('0xc'));var squel=require('squel');var crypto=require(_0x2fa1('0xd'));var jsforce=require(_0x2fa1('0xe'));var deskjs=require(_0x2fa1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2fa1('0x10'));var Papa=require(_0x2fa1('0x11'));var Redis=require(_0x2fa1('0x12'));var authService=require(_0x2fa1('0x13'));var qs=require(_0x2fa1('0x14'));var as=require(_0x2fa1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2fa1('0x16'))(_0x2fa1('0x17'));var utils=require(_0x2fa1('0x18'));var config=require(_0x2fa1('0x19'));var licenseUtil=require(_0x2fa1('0x1a'));var db=require(_0x2fa1('0x1b'))['db'];function respondWithStatusCode(_0x20f3e5,_0x1ef2c7){_0x1ef2c7=_0x1ef2c7||0xcc;return function(_0x3c98c2){if(_0x3c98c2){return _0x20f3e5[_0x2fa1('0x1c')](_0x1ef2c7);}return _0x20f3e5[_0x2fa1('0x1d')](_0x1ef2c7)[_0x2fa1('0x1e')]();};}function respondWithResult(_0xb30633,_0x35bfb5){_0x35bfb5=_0x35bfb5||0xc8;return function(_0x4bcef1){if(_0x4bcef1){return _0xb30633['status'](_0x35bfb5)[_0x2fa1('0x1f')](_0x4bcef1);}};}function respondWithFilteredResult(_0x212563,_0x128894){return function(_0x2e1788){if(_0x2e1788){var _0x58a387=typeof _0x128894[_0x2fa1('0x20')]==='undefined'&&typeof _0x128894[_0x2fa1('0x21')]===_0x2fa1('0x22');var _0x51632f=_0x2e1788['count'];var _0x3415f7=_0x58a387?0x0:_0x128894[_0x2fa1('0x20')];var _0x2a36cd=_0x58a387?_0x2e1788[_0x2fa1('0x23')]:_0x128894[_0x2fa1('0x20')]+_0x128894['limit'];var _0x393f23;if(_0x2a36cd>=_0x51632f){_0x2a36cd=_0x51632f;_0x393f23=0xc8;}else{_0x393f23=0xce;}_0x212563['status'](_0x393f23);return _0x212563['set']('Content-Range',_0x3415f7+'-'+_0x2a36cd+'/'+_0x51632f)['json'](_0x2e1788);}return null;};}function patchUpdates(_0x56f69c){return function(_0x2ba281){try{jsonpatch['apply'](_0x2ba281,_0x56f69c,!![]);}catch(_0x1cc3f4){return BPromise[_0x2fa1('0x24')](_0x1cc3f4);}return _0x2ba281[_0x2fa1('0x25')]();};}function saveUpdates(_0x373e4d,_0xae8b6b){return function(_0x314bf5){if(_0x314bf5){return _0x314bf5[_0x2fa1('0x26')](_0x373e4d)['then'](function(_0x59c9e0){return _0x59c9e0;});}return null;};}function removeEntity(_0x27cbee,_0x58a52e){return function(_0x2120ac){if(_0x2120ac){return _0x2120ac[_0x2fa1('0x27')]()[_0x2fa1('0x28')](function(){var _0x3aef36=_0x2120ac[_0x2fa1('0x29')]({'plain':!![]});var _0x3f79c0='CmHopperAdditionalPhones';return db[_0x2fa1('0x2a')][_0x2fa1('0x27')]({'where':{'type':_0x3f79c0,'resourceId':_0x3aef36['id']}})[_0x2fa1('0x28')](function(){return _0x2120ac;});})[_0x2fa1('0x28')](function(){_0x27cbee[_0x2fa1('0x1d')](0xcc)[_0x2fa1('0x1e')]();});}};}function handleEntityNotFound(_0x440b7b,_0x218bd4){return function(_0x3c676f){if(!_0x3c676f){_0x440b7b['sendStatus'](0x194);}return _0x3c676f;};}function handleError(_0x3e75b2,_0x206a7b){_0x206a7b=_0x206a7b||0x1f4;return function(_0xb0409e){logger[_0x2fa1('0x2b')](_0xb0409e['stack']);if(_0xb0409e[_0x2fa1('0x2c')]){delete _0xb0409e[_0x2fa1('0x2c')];}_0x3e75b2['status'](_0x206a7b)[_0x2fa1('0x2d')](_0xb0409e);};}exports['index']=function(_0x590db6,_0x2f082a){var _0x1fd279={},_0x478c57={},_0x2b7409={'count':0x0,'rows':[]};var _0x9eca2d=_[_0x2fa1('0x2e')](db[_0x2fa1('0x2f')][_0x2fa1('0x30')],function(_0x29f79e){return{'name':_0x29f79e[_0x2fa1('0x31')],'type':_0x29f79e[_0x2fa1('0x32')][_0x2fa1('0x33')]};});_0x478c57['model']=_[_0x2fa1('0x2e')](_0x9eca2d,_0x2fa1('0x2c'));_0x478c57[_0x2fa1('0x34')]=_[_0x2fa1('0x35')](_0x590db6['query']);_0x478c57[_0x2fa1('0x36')]=_[_0x2fa1('0x37')](_0x478c57[_0x2fa1('0x38')],_0x478c57[_0x2fa1('0x34')]);_0x1fd279[_0x2fa1('0x39')]=_['intersection'](_0x478c57[_0x2fa1('0x38')],qs[_0x2fa1('0x3a')](_0x590db6[_0x2fa1('0x34')]['fields']));_0x1fd279[_0x2fa1('0x39')]=_0x1fd279['attributes'][_0x2fa1('0x3b')]?_0x1fd279[_0x2fa1('0x39')]:_0x478c57[_0x2fa1('0x38')];if(!_0x590db6[_0x2fa1('0x34')][_0x2fa1('0x3c')](_0x2fa1('0x3d'))){_0x1fd279[_0x2fa1('0x21')]=qs[_0x2fa1('0x21')](_0x590db6[_0x2fa1('0x34')][_0x2fa1('0x21')]);_0x1fd279[_0x2fa1('0x20')]=qs[_0x2fa1('0x20')](_0x590db6['query'][_0x2fa1('0x20')]);}_0x1fd279['order']=qs[_0x2fa1('0x3e')](_0x590db6[_0x2fa1('0x34')][_0x2fa1('0x3e')]);_0x1fd279[_0x2fa1('0x3f')]=qs[_0x2fa1('0x36')](_[_0x2fa1('0x40')](_0x590db6[_0x2fa1('0x34')],_0x478c57[_0x2fa1('0x36')]),_0x9eca2d);if(_0x590db6[_0x2fa1('0x34')][_0x2fa1('0x41')]){_0x1fd279[_0x2fa1('0x3f')]=_['merge'](_0x1fd279[_0x2fa1('0x3f')],{'$or':_[_0x2fa1('0x2e')](_0x9eca2d,function(_0x214859){if(_0x214859['type']!==_0x2fa1('0x42')){var _0x251bb7={};_0x251bb7[_0x214859['name']]={'$like':'%'+_0x590db6['query'][_0x2fa1('0x41')]+'%'};return _0x251bb7;}})});}_0x1fd279=_[_0x2fa1('0x43')]({},_0x1fd279,_0x590db6[_0x2fa1('0x44')]);var _0x15d463={'where':_0x1fd279[_0x2fa1('0x3f')]};return db[_0x2fa1('0x2f')][_0x2fa1('0x23')](_0x15d463)['then'](function(_0xd5048){_0x2b7409[_0x2fa1('0x23')]=_0xd5048;if(_0x590db6[_0x2fa1('0x34')]['includeAll']){_0x1fd279[_0x2fa1('0x45')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x2fa1('0x46')](_0x1fd279);})[_0x2fa1('0x28')](function(_0x1db711){_0x2b7409['rows']=_0x1db711;return _0x2b7409;})[_0x2fa1('0x28')](respondWithFilteredResult(_0x2f082a,_0x1fd279))['catch'](handleError(_0x2f082a,null));};exports[_0x2fa1('0x47')]=function(_0x5cf907,_0x11ed15){var _0x512046={'raw':!![],'where':{'id':_0x5cf907[_0x2fa1('0x48')]['id']}},_0x515eb9={};_0x515eb9['model']=_[_0x2fa1('0x35')](db['CmHopperAdditionalPhone']['rawAttributes']);_0x515eb9['query']=_[_0x2fa1('0x35')](_0x5cf907[_0x2fa1('0x34')]);_0x515eb9[_0x2fa1('0x36')]=_[_0x2fa1('0x37')](_0x515eb9[_0x2fa1('0x38')],_0x515eb9[_0x2fa1('0x34')]);_0x512046['attributes']=_[_0x2fa1('0x37')](_0x515eb9[_0x2fa1('0x38')],qs['fields'](_0x5cf907[_0x2fa1('0x34')][_0x2fa1('0x3a')]));_0x512046[_0x2fa1('0x39')]=_0x512046['attributes'][_0x2fa1('0x3b')]?_0x512046[_0x2fa1('0x39')]:_0x515eb9[_0x2fa1('0x38')];if(_0x5cf907[_0x2fa1('0x34')][_0x2fa1('0x49')]){_0x512046['include']=[{'all':!![]}];}_0x512046=_[_0x2fa1('0x43')]({},_0x512046,_0x5cf907[_0x2fa1('0x44')]);return db[_0x2fa1('0x2f')][_0x2fa1('0x4a')](_0x512046)['then'](handleEntityNotFound(_0x11ed15,null))[_0x2fa1('0x28')](respondWithResult(_0x11ed15,null))[_0x2fa1('0x4b')](handleError(_0x11ed15,null));};exports['create']=function(_0x3c39c8,_0x7bfbea){return db[_0x2fa1('0x2f')][_0x2fa1('0x4c')](_0x3c39c8[_0x2fa1('0x4d')],{})['then'](function(_0x5bcc4a){var _0x1405d5=_0x3c39c8[_0x2fa1('0x4e')]['get']({'plain':!![]});if(!_0x1405d5)throw new Error(_0x2fa1('0x4f'));if(_0x1405d5[_0x2fa1('0x50')]==='user'){var _0x145251=_0x5bcc4a[_0x2fa1('0x29')]({'plain':!![]});var _0x2d4a50=_0x2fa1('0x51');return db[_0x2fa1('0x52')][_0x2fa1('0x4a')]({'where':{'name':_0x2d4a50,'userProfileId':_0x1405d5[_0x2fa1('0x53')]},'raw':!![]})[_0x2fa1('0x28')](function(_0x418c3c){if(_0x418c3c&&_0x418c3c[_0x2fa1('0x54')]===0x0){return db[_0x2fa1('0x2a')]['create']({'name':_0x145251['name'],'resourceId':_0x145251['id'],'type':_0x418c3c[_0x2fa1('0x2c')],'sectionId':_0x418c3c['id']},{})[_0x2fa1('0x28')](function(){return _0x5bcc4a;});}else{return _0x5bcc4a;}})[_0x2fa1('0x4b')](function(_0x43ff24){logger[_0x2fa1('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43ff24);throw _0x43ff24;});}return _0x5bcc4a;})[_0x2fa1('0x28')](respondWithResult(_0x7bfbea,0xc9))[_0x2fa1('0x4b')](handleError(_0x7bfbea,null));};exports[_0x2fa1('0x26')]=function(_0x26fc44,_0xc9b4cd){if(_0x26fc44[_0x2fa1('0x4d')]['id']){delete _0x26fc44[_0x2fa1('0x4d')]['id'];}return db[_0x2fa1('0x2f')][_0x2fa1('0x4a')]({'where':{'id':_0x26fc44[_0x2fa1('0x48')]['id']}})[_0x2fa1('0x28')](handleEntityNotFound(_0xc9b4cd,null))[_0x2fa1('0x28')](saveUpdates(_0x26fc44[_0x2fa1('0x4d')],null))[_0x2fa1('0x28')](respondWithResult(_0xc9b4cd,null))['catch'](handleError(_0xc9b4cd,null));};exports['destroy']=function(_0x2d1ffc,_0xb0192d){return db['CmHopperAdditionalPhone'][_0x2fa1('0x4a')]({'where':{'id':_0x2d1ffc[_0x2fa1('0x48')]['id']}})[_0x2fa1('0x28')](handleEntityNotFound(_0xb0192d,null))[_0x2fa1('0x28')](removeEntity(_0xb0192d,null))['catch'](handleError(_0xb0192d,null));}; \ No newline at end of file +var _0x7281=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','includeAll','CmHopperAdditionalPhone','findAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','get','end'];(function(_0x620575,_0x5517b8){var _0x4a9d19=function(_0x1aa74a){while(--_0x1aa74a){_0x620575['push'](_0x620575['shift']());}};_0x4a9d19(++_0x5517b8);}(_0x7281,0x81));var _0x1728=function(_0x471723,_0x2f478c){_0x471723=_0x471723-0x0;var _0x5f3e76=_0x7281[_0x471723];return _0x5f3e76;};'use strict';var emlformat=require(_0x1728('0x0'));var rimraf=require(_0x1728('0x1'));var zipdir=require(_0x1728('0x2'));var jsonpatch=require(_0x1728('0x3'));var rp=require('request-promise');var moment=require(_0x1728('0x4'));var BPromise=require(_0x1728('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1728('0x6'));var csv=require(_0x1728('0x7'));var ejs=require(_0x1728('0x8'));var fs=require('fs');var fs_extra=require(_0x1728('0x9'));var _=require(_0x1728('0xa'));var squel=require(_0x1728('0xb'));var crypto=require(_0x1728('0xc'));var jsforce=require(_0x1728('0xd'));var deskjs=require(_0x1728('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1728('0xf'));var Papa=require('papaparse');var Redis=require(_0x1728('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1728('0x11'));var as=require(_0x1728('0x12'));var hardwareService=require(_0x1728('0x13'));var logger=require(_0x1728('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1728('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1728('0x16'))['db'];function respondWithStatusCode(_0x512aec,_0x4eacc5){_0x4eacc5=_0x4eacc5||0xcc;return function(_0xae71c6){if(_0xae71c6){return _0x512aec[_0x1728('0x17')](_0x4eacc5);}return _0x512aec[_0x1728('0x18')](_0x4eacc5)['end']();};}function respondWithResult(_0x5ccc11,_0x4c1166){_0x4c1166=_0x4c1166||0xc8;return function(_0x115be1){if(_0x115be1){return _0x5ccc11[_0x1728('0x18')](_0x4c1166)['json'](_0x115be1);}};}function respondWithFilteredResult(_0x379150,_0x2fe4e3){return function(_0x1c5019){if(_0x1c5019){var _0x265321=typeof _0x2fe4e3[_0x1728('0x19')]===_0x1728('0x1a')&&typeof _0x2fe4e3[_0x1728('0x1b')]==='undefined';var _0x45bced=_0x1c5019[_0x1728('0x1c')];var _0x56ac52=_0x265321?0x0:_0x2fe4e3[_0x1728('0x19')];var _0x527c03=_0x265321?_0x1c5019['count']:_0x2fe4e3['offset']+_0x2fe4e3[_0x1728('0x1b')];var _0x522154;if(_0x527c03>=_0x45bced){_0x527c03=_0x45bced;_0x522154=0xc8;}else{_0x522154=0xce;}_0x379150[_0x1728('0x18')](_0x522154);return _0x379150['set'](_0x1728('0x1d'),_0x56ac52+'-'+_0x527c03+'/'+_0x45bced)[_0x1728('0x1e')](_0x1c5019);}return null;};}function patchUpdates(_0x2f0ec8){return function(_0x3f5855){try{jsonpatch[_0x1728('0x1f')](_0x3f5855,_0x2f0ec8,!![]);}catch(_0x4dc3ab){return BPromise[_0x1728('0x20')](_0x4dc3ab);}return _0x3f5855[_0x1728('0x21')]();};}function saveUpdates(_0x37f21e,_0x4e283b){return function(_0x3224fb){if(_0x3224fb){return _0x3224fb[_0x1728('0x22')](_0x37f21e)['then'](function(_0x2c97d8){return _0x2c97d8;});}return null;};}function removeEntity(_0x2ab92e,_0x1fe8d7){return function(_0x310433){if(_0x310433){return _0x310433[_0x1728('0x23')]()[_0x1728('0x24')](function(){var _0x579ec3=_0x310433[_0x1728('0x25')]({'plain':!![]});var _0x273474='CmHopperAdditionalPhones';return db['UserProfileResource'][_0x1728('0x23')]({'where':{'type':_0x273474,'resourceId':_0x579ec3['id']}})[_0x1728('0x24')](function(){return _0x310433;});})[_0x1728('0x24')](function(){_0x2ab92e['status'](0xcc)[_0x1728('0x26')]();});}};}function handleEntityNotFound(_0x2fc3b5,_0x478e07){return function(_0x3ca338){if(!_0x3ca338){_0x2fc3b5[_0x1728('0x17')](0x194);}return _0x3ca338;};}function handleError(_0x5d6f30,_0x4c808d){_0x4c808d=_0x4c808d||0x1f4;return function(_0x18a788){logger[_0x1728('0x27')](_0x18a788[_0x1728('0x28')]);if(_0x18a788[_0x1728('0x29')]){delete _0x18a788[_0x1728('0x29')];}_0x5d6f30['status'](_0x4c808d)[_0x1728('0x2a')](_0x18a788);};}exports[_0x1728('0x2b')]=function(_0x4ceb19,_0x709d8){var _0x41f54d={},_0x2b18b1={},_0x4a0586={'count':0x0,'rows':[]};var _0xf11a91=_[_0x1728('0x2c')](db['CmHopperAdditionalPhone'][_0x1728('0x2d')],function(_0x2022bf){return{'name':_0x2022bf[_0x1728('0x2e')],'type':_0x2022bf[_0x1728('0x2f')][_0x1728('0x30')]};});_0x2b18b1[_0x1728('0x31')]=_['map'](_0xf11a91,'name');_0x2b18b1[_0x1728('0x32')]=_[_0x1728('0x33')](_0x4ceb19[_0x1728('0x32')]);_0x2b18b1[_0x1728('0x34')]=_[_0x1728('0x35')](_0x2b18b1['model'],_0x2b18b1['query']);_0x41f54d[_0x1728('0x36')]=_[_0x1728('0x35')](_0x2b18b1[_0x1728('0x31')],qs[_0x1728('0x37')](_0x4ceb19[_0x1728('0x32')][_0x1728('0x37')]));_0x41f54d[_0x1728('0x36')]=_0x41f54d[_0x1728('0x36')][_0x1728('0x38')]?_0x41f54d[_0x1728('0x36')]:_0x2b18b1['model'];if(!_0x4ceb19[_0x1728('0x32')]['hasOwnProperty'](_0x1728('0x39'))){_0x41f54d[_0x1728('0x1b')]=qs[_0x1728('0x1b')](_0x4ceb19[_0x1728('0x32')][_0x1728('0x1b')]);_0x41f54d[_0x1728('0x19')]=qs[_0x1728('0x19')](_0x4ceb19[_0x1728('0x32')]['offset']);}_0x41f54d[_0x1728('0x3a')]=qs[_0x1728('0x3b')](_0x4ceb19[_0x1728('0x32')][_0x1728('0x3b')]);_0x41f54d[_0x1728('0x3c')]=qs[_0x1728('0x34')](_[_0x1728('0x3d')](_0x4ceb19[_0x1728('0x32')],_0x2b18b1[_0x1728('0x34')]),_0xf11a91);if(_0x4ceb19[_0x1728('0x32')]['filter']){_0x41f54d[_0x1728('0x3c')]=_[_0x1728('0x3e')](_0x41f54d[_0x1728('0x3c')],{'$or':_['map'](_0xf11a91,function(_0x502f53){if(_0x502f53[_0x1728('0x2f')]!=='VIRTUAL'){var _0x186276={};_0x186276[_0x502f53[_0x1728('0x29')]]={'$like':'%'+_0x4ceb19[_0x1728('0x32')][_0x1728('0x3f')]+'%'};return _0x186276;}})});}_0x41f54d=_[_0x1728('0x3e')]({},_0x41f54d,_0x4ceb19['options']);var _0x4b9980={'where':_0x41f54d['where']};return db['CmHopperAdditionalPhone']['count'](_0x4b9980)[_0x1728('0x24')](function(_0x4f2292){_0x4a0586[_0x1728('0x1c')]=_0x4f2292;if(_0x4ceb19[_0x1728('0x32')][_0x1728('0x40')]){_0x41f54d['include']=[{'all':!![]}];}return db[_0x1728('0x41')][_0x1728('0x42')](_0x41f54d);})['then'](function(_0x3028a4){_0x4a0586[_0x1728('0x43')]=_0x3028a4;return _0x4a0586;})[_0x1728('0x24')](respondWithFilteredResult(_0x709d8,_0x41f54d))[_0x1728('0x44')](handleError(_0x709d8,null));};exports[_0x1728('0x45')]=function(_0x2c1a80,_0x2d1149){var _0x137321={'raw':!![],'where':{'id':_0x2c1a80[_0x1728('0x46')]['id']}},_0xb1acc5={};_0xb1acc5[_0x1728('0x31')]=_['keys'](db[_0x1728('0x41')][_0x1728('0x2d')]);_0xb1acc5[_0x1728('0x32')]=_[_0x1728('0x33')](_0x2c1a80[_0x1728('0x32')]);_0xb1acc5[_0x1728('0x34')]=_[_0x1728('0x35')](_0xb1acc5[_0x1728('0x31')],_0xb1acc5[_0x1728('0x32')]);_0x137321[_0x1728('0x36')]=_[_0x1728('0x35')](_0xb1acc5[_0x1728('0x31')],qs[_0x1728('0x37')](_0x2c1a80['query'][_0x1728('0x37')]));_0x137321['attributes']=_0x137321[_0x1728('0x36')][_0x1728('0x38')]?_0x137321[_0x1728('0x36')]:_0xb1acc5['model'];if(_0x2c1a80[_0x1728('0x32')]['includeAll']){_0x137321[_0x1728('0x47')]=[{'all':!![]}];}_0x137321=_[_0x1728('0x3e')]({},_0x137321,_0x2c1a80['options']);return db[_0x1728('0x41')]['find'](_0x137321)[_0x1728('0x24')](handleEntityNotFound(_0x2d1149,null))[_0x1728('0x24')](respondWithResult(_0x2d1149,null))[_0x1728('0x44')](handleError(_0x2d1149,null));};exports[_0x1728('0x48')]=function(_0x255b8a,_0x3a4429){return db[_0x1728('0x41')][_0x1728('0x48')](_0x255b8a[_0x1728('0x49')],{})[_0x1728('0x24')](function(_0x3b1ea7){var _0x43c3aa=_0x255b8a[_0x1728('0x4a')][_0x1728('0x25')]({'plain':!![]});if(!_0x43c3aa)throw new Error(_0x1728('0x4b'));if(_0x43c3aa[_0x1728('0x4c')]===_0x1728('0x4a')){var _0xe7a47f=_0x3b1ea7[_0x1728('0x25')]({'plain':!![]});var _0xa3a4a6=_0x1728('0x4d');return db[_0x1728('0x4e')]['find']({'where':{'name':_0xa3a4a6,'userProfileId':_0x43c3aa[_0x1728('0x4f')]},'raw':!![]})['then'](function(_0x589d57){if(_0x589d57&&_0x589d57[_0x1728('0x50')]===0x0){return db[_0x1728('0x51')]['create']({'name':_0xe7a47f['name'],'resourceId':_0xe7a47f['id'],'type':_0x589d57[_0x1728('0x29')],'sectionId':_0x589d57['id']},{})[_0x1728('0x24')](function(){return _0x3b1ea7;});}else{return _0x3b1ea7;}})['catch'](function(_0x3b2bcd){logger[_0x1728('0x27')](_0x1728('0x52'),_0x3b2bcd);throw _0x3b2bcd;});}return _0x3b1ea7;})[_0x1728('0x24')](respondWithResult(_0x3a4429,0xc9))[_0x1728('0x44')](handleError(_0x3a4429,null));};exports[_0x1728('0x22')]=function(_0x513e55,_0x554210){if(_0x513e55[_0x1728('0x49')]['id']){delete _0x513e55[_0x1728('0x49')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x513e55['params']['id']}})[_0x1728('0x24')](handleEntityNotFound(_0x554210,null))['then'](saveUpdates(_0x513e55[_0x1728('0x49')],null))['then'](respondWithResult(_0x554210,null))[_0x1728('0x44')](handleError(_0x554210,null));};exports[_0x1728('0x23')]=function(_0x126762,_0x3403f0){return db[_0x1728('0x41')][_0x1728('0x53')]({'where':{'id':_0x126762[_0x1728('0x46')]['id']}})[_0x1728('0x24')](handleEntityNotFound(_0x3403f0,null))['then'](removeEntity(_0x3403f0,null))[_0x1728('0x44')](handleError(_0x3403f0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 0213c68..b5dda39 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 _0x6c18=['CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x7bc5e8,_0x116927){var _0x374b1b=function(_0x4c33bc){while(--_0x4c33bc){_0x7bc5e8['push'](_0x7bc5e8['shift']());}};_0x374b1b(++_0x116927);}(_0x6c18,0x195));var _0x86c1=function(_0x2514db,_0x209fa3){_0x2514db=_0x2514db-0x0;var _0x56436e=_0x6c18[_0x2514db];return _0x56436e;};'use strict';var _=require(_0x86c1('0x0'));var util=require(_0x86c1('0x1'));var logger=require(_0x86c1('0x2'))(_0x86c1('0x3'));var moment=require(_0x86c1('0x4'));var BPromise=require(_0x86c1('0x5'));var rp=require(_0x86c1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86c1('0x7'));var config=require(_0x86c1('0x8'));var attributes=require(_0x86c1('0x9'));module[_0x86c1('0xa')]=function(_0xdae7,_0x1cf2dc){return _0xdae7['define'](_0x86c1('0xb'),attributes,{'tableName':_0x86c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe66d=['./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6ef703,_0x2695d9){var _0x4a13a3=function(_0x3f14aa){while(--_0x3f14aa){_0x6ef703['push'](_0x6ef703['shift']());}};_0x4a13a3(++_0x2695d9);}(_0xe66d,0xfb));var _0xde66=function(_0x4fa622,_0x4e2fe9){_0x4fa622=_0x4fa622-0x0;var _0xc754da=_0xe66d[_0x4fa622];return _0xc754da;};'use strict';var _=require(_0xde66('0x0'));var util=require(_0xde66('0x1'));var logger=require('../../config/logger')(_0xde66('0x2'));var moment=require(_0xde66('0x3'));var BPromise=require(_0xde66('0x4'));var rp=require(_0xde66('0x5'));var fs=require('fs');var path=require(_0xde66('0x6'));var rimraf=require(_0xde66('0x7'));var config=require(_0xde66('0x8'));var attributes=require(_0xde66('0x9'));module[_0xde66('0xa')]=function(_0x4a5d0e,_0xbf1165){return _0x4a5d0e['define'](_0xde66('0xb'),attributes,{'tableName':_0xde66('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 90de2d8..e05d234 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 _0x69f4=['then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','findOne','countdropretry','SwapAdditionalPhones','CmHopper','ContactId','duration','isNil','scheduledat','minutes','add','phone','createdAt','updatedAt','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2e73b5,_0x26ed09){var _0x244dc6=function(_0x2f9186){while(--_0x2f9186){_0x2e73b5['push'](_0x2e73b5['shift']());}};_0x244dc6(++_0x26ed09);}(_0x69f4,0xa1));var _0x469f=function(_0x5a8a4d,_0x299752){_0x5a8a4d=_0x5a8a4d-0x0;var _0x4c69c5=_0x69f4[_0x5a8a4d];return _0x4c69c5;};'use strict';var _=require(_0x469f('0x0'));var util=require('util');var moment=require(_0x469f('0x1'));var BPromise=require('bluebird');var rs=require(_0x469f('0x2'));var fs=require('fs');var Redis=require(_0x469f('0x3'));var db=require(_0x469f('0x4'))['db'];var utils=require(_0x469f('0x5'));var logger=require(_0x469f('0x6'))(_0x469f('0x7'));var config=require(_0x469f('0x8'));var jayson=require(_0x469f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51e68c,_0x16ac65,_0x205c96){return new BPromise(function(_0x3f12d8,_0xf2f1bc){return client['request'](_0x51e68c,_0x205c96)[_0x469f('0xa')](function(_0xf4b5b0){logger['info'](_0x469f('0xb'),_0x16ac65,_0x469f('0xc'));logger[_0x469f('0xd')](_0x469f('0xe'),_0x16ac65,_0x469f('0xc'),JSON[_0x469f('0xf')](_0xf4b5b0));if(_0xf4b5b0[_0x469f('0x10')]){if(_0xf4b5b0[_0x469f('0x10')][_0x469f('0x11')]===0x1f4){logger[_0x469f('0x10')](_0x469f('0xb'),_0x16ac65,_0xf4b5b0[_0x469f('0x10')][_0x469f('0x12')]);return _0xf2f1bc(_0xf4b5b0['error'][_0x469f('0x12')]);}logger[_0x469f('0x10')](_0x469f('0xb'),_0x16ac65,_0xf4b5b0[_0x469f('0x10')][_0x469f('0x12')]);return _0x3f12d8(_0xf4b5b0[_0x469f('0x10')][_0x469f('0x12')]);}else{logger[_0x469f('0x13')](_0x469f('0xb'),_0x16ac65,_0x469f('0xc'));_0x3f12d8(_0xf4b5b0[_0x469f('0x14')]['message']);}})[_0x469f('0x15')](function(_0xd169d0){logger[_0x469f('0x10')](_0x469f('0xb'),_0x16ac65,_0xd169d0);_0xf2f1bc(_0xd169d0);});});}exports[_0x469f('0x16')]=function(_0xd1fe6c){var _0x58f2e5=this;return new Promise(function(_0x4725ce,_0x21056c){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0xd1fe6c['body']['ContactId'],'ListId':_0xd1fe6c[_0x469f('0x17')][_0x469f('0x18')],'VoiceQueueId':_0xd1fe6c['body']['VoiceQueueId']===undefined?null:_0xd1fe6c[_0x469f('0x17')][_0x469f('0x19')],'CampaignId':_0xd1fe6c[_0x469f('0x17')][_0x469f('0x1a')]===undefined?null:_0xd1fe6c[_0x469f('0x17')]['CampaignId']}})[_0x469f('0xa')](function(_0x5aad5b){if(_0x5aad5b!=null){return db[_0x469f('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5aad5b['id'],'OrderBy':{'$gt':_0x5aad5b['OrderBy']}},'order':[[_0x469f('0x1c'),_0x469f('0x1d')]]})['then'](function(_0x31122a){var _0x515322=0x0;if(_0x31122a){if(_0x31122a[_0x469f('0x1e')]+_0x31122a[_0x469f('0x1f')]+_0x31122a[_0x469f('0x20')]+_0x31122a[_0x469f('0x21')]+_0x31122a['countdropretry']+_0x31122a[_0x469f('0x22')]+_0x31122a[_0x469f('0x23')]+_0x31122a[_0x469f('0x24')]<_0xd1fe6c[_0x469f('0x25')][_0x469f('0x26')])_0x515322=0x1;_0x4725ce({'additional':_0x515322});}else{return db[_0x469f('0x1b')][_0x469f('0x27')]({'raw':!![],'where':{'CmHopperId':_0x5aad5b['id']},'order':[[_0x469f('0x1c'),_0x469f('0x1d')]]})['then'](function(_0x4c3a92){var _0x453ea0=0x0;if(_0x4c3a92){if(_0x4c3a92['countbusyretry']+_0x4c3a92[_0x469f('0x1f')]+_0x4c3a92['countnoanswerretry']+_0x4c3a92['countnosuchnumberretry']+_0x4c3a92[_0x469f('0x28')]+_0x4c3a92[_0x469f('0x22')]+_0x4c3a92[_0x469f('0x23')]+_0x4c3a92[_0x469f('0x24')]<_0xd1fe6c[_0x469f('0x25')]['dialGlobalMaxRetry'])_0x453ea0=0x1;_0x4725ce({'additional':_0x453ea0});}else{_0x4725ce({'additional':0x0});}})[_0x469f('0x15')](function(_0x2eb27b){logger[_0x469f('0x10')](_0x469f('0x16'),_0x2eb27b[_0x469f('0x12')]);_0x21056c(_0x58f2e5[_0x469f('0x10')](0x1f4,_0x2eb27b[_0x469f('0x12')]));});}})[_0x469f('0x15')](function(_0x410861){logger[_0x469f('0x10')]('VerifyAdditionalPhones',_0x410861[_0x469f('0x12')]);_0x21056c(_0x58f2e5[_0x469f('0x10')](0x1f4,_0x410861[_0x469f('0x12')]));});}else _0x4725ce({'additional':0x0});});});};exports[_0x469f('0x29')]=function(_0x3ef793){var _0x34c7c7=this;return new Promise(function(_0x35d65,_0xf4abd9){return db[_0x469f('0x2a')][_0x469f('0x27')]({'raw':!![],'where':{'ContactId':_0x3ef793[_0x469f('0x17')][_0x469f('0x2b')],'ListId':_0x3ef793[_0x469f('0x17')][_0x469f('0x18')],'VoiceQueueId':_0x3ef793[_0x469f('0x17')][_0x469f('0x19')]===undefined?null:_0x3ef793[_0x469f('0x17')][_0x469f('0x19')],'CampaignId':_0x3ef793[_0x469f('0x17')][_0x469f('0x1a')]===undefined?null:_0x3ef793['body'][_0x469f('0x1a')]}})[_0x469f('0xa')](function(_0x464bd0){if(_0x464bd0!=null){return db['CmHopperAdditionalPhone'][_0x469f('0x27')]({'raw':!![],'where':{'CmHopperId':_0x464bd0['id'],'OrderBy':{'$gte':_0x464bd0[_0x469f('0x1c')]}},'order':[[_0x469f('0x1c'),_0x469f('0x1d')]]})[_0x469f('0xa')](function(_0x31a2f4){if(_0x31a2f4)return activateAdditionalPhone(_0x464bd0,_0x3ef793[_0x469f('0x17')],_0x31a2f4,_0x3ef793[_0x469f('0x2c')],_0x3ef793['waitTime'])[_0x469f('0xa')](function(_0x196c42){_0x35d65(_0x196c42);});else{return db[_0x469f('0x1b')][_0x469f('0x27')]({'raw':!![],'where':{'CmHopperId':_0x464bd0['id']},'order':[['OrderBy',_0x469f('0x1d')]]})[_0x469f('0xa')](function(_0xd83c24){if(_0xd83c24)return activateAdditionalPhone(_0x464bd0,_0x3ef793[_0x469f('0x17')],_0xd83c24,_0x3ef793[_0x469f('0x2c')],_0x3ef793['waitTime'])[_0x469f('0xa')](function(_0x1a368d){_0x35d65(_0x1a368d);});else{_0x35d65({'id':_0x464bd0['id'],'phone':''});}})['catch'](function(_0x541401){logger[_0x469f('0x10')]('VerifyAdditionalPhones',_0x541401[_0x469f('0x12')]);_0xf4abd9(_0x34c7c7[_0x469f('0x10')](0x1f4,_0x541401['message']));});}})[_0x469f('0x15')](function(_0x1c121b){logger[_0x469f('0x10')](_0x469f('0x16'),_0x1c121b[_0x469f('0x12')]);_0xf4abd9(_0x34c7c7[_0x469f('0x10')](0x1f4,_0x1c121b['message']));});}else _0x35d65(0x1);});});};function activateAdditionalPhone(_0x11d85b,_0x12f3da,_0x125bb0,_0x48a735,_0x3742a5){return new Promise(function(_0x5373f0,_0x1f1531){var _0x4b8243;if(_[_0x469f('0x2d')](_0x125bb0['scheduledat'])){_0x125bb0[_0x469f('0x2e')]=moment();}if(moment()>moment(_0x125bb0['scheduledat'])){_0x4b8243=moment()['add'](_0x3742a5||0x3,_0x469f('0x2f'));}else{if(_0x125bb0['OrderBy']==0x0){_0x4b8243=moment(_0x125bb0[_0x469f('0x2e')]);}else{_0x4b8243=moment()[_0x469f('0x30')](_0x3742a5||0x3,_0x469f('0x2f'));}}if(_[_0x469f('0x2d')](_0x4b8243)){_0x4b8243=moment()[_0x469f('0x30')](_0x3742a5||0x3,_0x469f('0x2f'));}var _0x55a252={'phone':_0x11d85b[_0x469f('0x31')],'active':0x0,'OrderBy':_[_0x469f('0x2d')](_0x11d85b[_0x469f('0x1c')])?0x0:_0x11d85b[_0x469f('0x1c')],'scheduledat':moment()[_0x469f('0x30')](_0x48a735||0x1,_0x469f('0x2f')),'countbusyretry':_0x12f3da[_0x469f('0x1e')],'countcongestionretry':_0x12f3da[_0x469f('0x1f')],'countnoanswerretry':_0x12f3da[_0x469f('0x20')],'countnosuchnumberretry':_0x12f3da['countnosuchnumberretry'],'countdropretry':_0x12f3da['countdropretry'],'countabandonedretry':_0x12f3da[_0x469f('0x22')],'countmachineretry':_0x12f3da['countmachineretry'],'countagentrejectretry':_0x12f3da[_0x469f('0x24')],'createdAt':_0x12f3da[_0x469f('0x32')],'updatedAt':_0x12f3da[_0x469f('0x33')]};var _0x5be6c1={'CmHopperId':_0x11d85b['id'],'phone':_0x125bb0[_0x469f('0x31')],'active':0x0,'OrderBy':_[_0x469f('0x2d')](_0x125bb0['OrderBy'])?0x0:_0x125bb0[_0x469f('0x1c')],'scheduledat':_0x4b8243,'countbusyretry':_0x125bb0['countbusyretry'],'countcongestionretry':_0x125bb0[_0x469f('0x1f')],'countnoanswerretry':_0x125bb0[_0x469f('0x20')],'countnosuchnumberretry':_0x125bb0[_0x469f('0x21')],'countdropretry':_0x125bb0[_0x469f('0x28')],'countabandonedretry':_0x125bb0['countabandonedretry'],'countmachineretry':_0x125bb0['countmachineretry'],'countagentrejectretry':_0x125bb0[_0x469f('0x24')],'createdAt':_0x125bb0['createdAt'],'updatedAt':_0x125bb0['updatedAt']};return db['sequelize'][_0x469f('0x34')](function(_0x349cee){return db[_0x469f('0x1b')][_0x469f('0x35')](_0x55a252,{'where':{'id':_0x125bb0['id']}},{'transaction':_0x349cee})[_0x469f('0xa')](function(){return db['CmHopper'][_0x469f('0x35')](_0x5be6c1,{'where':{'id':_0x11d85b['id']}},{'transaction':_0x349cee});});})[_0x469f('0xa')](function(_0x2830b3){_0x5373f0({'id':_0x11d85b['id'],'phone':_0x125bb0[_0x469f('0x31')]});})['catch'](function(_0x4d67c5){logger['error'](_0x469f('0x36'),_0x4d67c5['message']);_0x1f1531({'error':_0x4d67c5['message']});});});}exports[_0x469f('0x37')]=function(_0x405c14){var _0x4e8289=this;return new Promise(function(_0x37aa27,_0x424708){return db[_0x469f('0x2a')][_0x469f('0x35')](_0x405c14[_0x469f('0x17')][_0x469f('0x38')],{'where':{'id':_0x405c14['body']['id']}})[_0x469f('0xa')](function(_0xbb4e1c){_0x37aa27(_0xbb4e1c);})[_0x469f('0x15')](function(_0x1d3da0){logger[_0x469f('0x10')](_0x469f('0x37'),_0x1d3da0[_0x469f('0x12')]);_0x424708(_0x4e8289[_0x469f('0x10')](0x1f4,_0x1d3da0[_0x469f('0x12')]));});});}; \ No newline at end of file +var _0x2b44=['CampaignId','CmHopperAdditionalPhone','findOne','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','catch','SwapAdditionalPhones','CmHopper','VoiceQueueId','OrderBy','duration','waitTime','isNil','scheduledat','add','minutes','phone','countmachineretry','createdAt','updatedAt','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','VerifyAdditionalPhones','body','ContactId','ListId'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0x2b44,0x14c));var _0x42b4=function(_0x3c9858,_0x59c7ce){_0x3c9858=_0x3c9858-0x0;var _0xd03af0=_0x2b44[_0x3c9858];return _0xd03af0;};'use strict';var _=require(_0x42b4('0x0'));var util=require(_0x42b4('0x1'));var moment=require(_0x42b4('0x2'));var BPromise=require(_0x42b4('0x3'));var rs=require(_0x42b4('0x4'));var fs=require('fs');var Redis=require(_0x42b4('0x5'));var db=require(_0x42b4('0x6'))['db'];var utils=require(_0x42b4('0x7'));var logger=require(_0x42b4('0x8'))(_0x42b4('0x9'));var config=require(_0x42b4('0xa'));var jayson=require(_0x42b4('0xb'));var client=jayson['client'][_0x42b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xfc0874,_0x295144,_0x1a5a28){return new BPromise(function(_0x1bbe46,_0x402fcb){return client[_0x42b4('0xd')](_0xfc0874,_0x1a5a28)[_0x42b4('0xe')](function(_0x1ff90c){logger[_0x42b4('0xf')](_0x42b4('0x10'),_0x295144,'request\x20sent');logger[_0x42b4('0x11')](_0x42b4('0x12'),_0x295144,'request\x20sent',JSON[_0x42b4('0x13')](_0x1ff90c));if(_0x1ff90c[_0x42b4('0x14')]){if(_0x1ff90c['error']['code']===0x1f4){logger[_0x42b4('0x14')](_0x42b4('0x10'),_0x295144,_0x1ff90c[_0x42b4('0x14')][_0x42b4('0x15')]);return _0x402fcb(_0x1ff90c['error']['message']);}logger[_0x42b4('0x14')](_0x42b4('0x10'),_0x295144,_0x1ff90c[_0x42b4('0x14')][_0x42b4('0x15')]);return _0x1bbe46(_0x1ff90c[_0x42b4('0x14')][_0x42b4('0x15')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x295144,_0x42b4('0x16'));_0x1bbe46(_0x1ff90c[_0x42b4('0x17')][_0x42b4('0x15')]);}})['catch'](function(_0x3c8c74){logger[_0x42b4('0x14')](_0x42b4('0x10'),_0x295144,_0x3c8c74);_0x402fcb(_0x3c8c74);});});}exports[_0x42b4('0x18')]=function(_0x40b931){var _0x21d628=this;return new Promise(function(_0x1fd3ad,_0x123668){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x40b931[_0x42b4('0x19')][_0x42b4('0x1a')],'ListId':_0x40b931['body'][_0x42b4('0x1b')],'VoiceQueueId':_0x40b931['body']['VoiceQueueId']===undefined?null:_0x40b931[_0x42b4('0x19')]['VoiceQueueId'],'CampaignId':_0x40b931['body'][_0x42b4('0x1c')]===undefined?null:_0x40b931[_0x42b4('0x19')][_0x42b4('0x1c')]}})[_0x42b4('0xe')](function(_0x17ca6f){if(_0x17ca6f!=null){return db[_0x42b4('0x1d')][_0x42b4('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x17ca6f['id'],'OrderBy':{'$gt':_0x17ca6f['OrderBy']}},'order':[['OrderBy',_0x42b4('0x1f')]]})[_0x42b4('0xe')](function(_0xba40a5){var _0x5b8e92=0x0;if(_0xba40a5){if(_0xba40a5[_0x42b4('0x20')]+_0xba40a5[_0x42b4('0x21')]+_0xba40a5[_0x42b4('0x22')]+_0xba40a5[_0x42b4('0x23')]+_0xba40a5[_0x42b4('0x24')]+_0xba40a5[_0x42b4('0x25')]+_0xba40a5['countmachineretry']+_0xba40a5[_0x42b4('0x26')]<_0x40b931[_0x42b4('0x27')]['dialGlobalMaxRetry'])_0x5b8e92=0x1;_0x1fd3ad({'additional':_0x5b8e92});}else{return db[_0x42b4('0x1d')][_0x42b4('0x1e')]({'raw':!![],'where':{'CmHopperId':_0x17ca6f['id']},'order':[['OrderBy',_0x42b4('0x1f')]]})['then'](function(_0x26f2be){var _0x167541=0x0;if(_0x26f2be){if(_0x26f2be[_0x42b4('0x20')]+_0x26f2be[_0x42b4('0x21')]+_0x26f2be[_0x42b4('0x22')]+_0x26f2be[_0x42b4('0x23')]+_0x26f2be[_0x42b4('0x24')]+_0x26f2be['countabandonedretry']+_0x26f2be['countmachineretry']+_0x26f2be[_0x42b4('0x26')]<_0x40b931[_0x42b4('0x27')][_0x42b4('0x28')])_0x167541=0x1;_0x1fd3ad({'additional':_0x167541});}else{_0x1fd3ad({'additional':0x0});}})['catch'](function(_0x1635be){logger[_0x42b4('0x14')](_0x42b4('0x18'),_0x1635be[_0x42b4('0x15')]);_0x123668(_0x21d628[_0x42b4('0x14')](0x1f4,_0x1635be['message']));});}})[_0x42b4('0x29')](function(_0xf3e5dc){logger[_0x42b4('0x14')](_0x42b4('0x18'),_0xf3e5dc[_0x42b4('0x15')]);_0x123668(_0x21d628[_0x42b4('0x14')](0x1f4,_0xf3e5dc[_0x42b4('0x15')]));});}else _0x1fd3ad({'additional':0x0});});});};exports[_0x42b4('0x2a')]=function(_0x32fa09){var _0x25008f=this;return new Promise(function(_0x2da55d,_0x23f1c1){return db[_0x42b4('0x2b')][_0x42b4('0x1e')]({'raw':!![],'where':{'ContactId':_0x32fa09[_0x42b4('0x19')][_0x42b4('0x1a')],'ListId':_0x32fa09['body']['ListId'],'VoiceQueueId':_0x32fa09[_0x42b4('0x19')]['VoiceQueueId']===undefined?null:_0x32fa09[_0x42b4('0x19')][_0x42b4('0x2c')],'CampaignId':_0x32fa09[_0x42b4('0x19')][_0x42b4('0x1c')]===undefined?null:_0x32fa09['body']['CampaignId']}})['then'](function(_0xce9113){if(_0xce9113!=null){return db[_0x42b4('0x1d')][_0x42b4('0x1e')]({'raw':!![],'where':{'CmHopperId':_0xce9113['id'],'OrderBy':{'$gte':_0xce9113['OrderBy']}},'order':[[_0x42b4('0x2d'),_0x42b4('0x1f')]]})[_0x42b4('0xe')](function(_0x157846){if(_0x157846)return activateAdditionalPhone(_0xce9113,_0x32fa09['body'],_0x157846,_0x32fa09[_0x42b4('0x2e')],_0x32fa09[_0x42b4('0x2f')])[_0x42b4('0xe')](function(_0xd333d6){_0x2da55d(_0xd333d6);});else{return db['CmHopperAdditionalPhone'][_0x42b4('0x1e')]({'raw':!![],'where':{'CmHopperId':_0xce9113['id']},'order':[['OrderBy',_0x42b4('0x1f')]]})[_0x42b4('0xe')](function(_0x4bca64){if(_0x4bca64)return activateAdditionalPhone(_0xce9113,_0x32fa09[_0x42b4('0x19')],_0x4bca64,_0x32fa09[_0x42b4('0x2e')],_0x32fa09[_0x42b4('0x2f')])[_0x42b4('0xe')](function(_0x2671c0){_0x2da55d(_0x2671c0);});else{_0x2da55d({'id':_0xce9113['id'],'phone':''});}})[_0x42b4('0x29')](function(_0x85659d){logger[_0x42b4('0x14')]('VerifyAdditionalPhones',_0x85659d[_0x42b4('0x15')]);_0x23f1c1(_0x25008f['error'](0x1f4,_0x85659d[_0x42b4('0x15')]));});}})['catch'](function(_0x5388e4){logger[_0x42b4('0x14')](_0x42b4('0x18'),_0x5388e4[_0x42b4('0x15')]);_0x23f1c1(_0x25008f[_0x42b4('0x14')](0x1f4,_0x5388e4[_0x42b4('0x15')]));});}else _0x2da55d(0x1);});});};function activateAdditionalPhone(_0x5116fd,_0x140735,_0x2fddea,_0x20fb25,_0x60c403){return new Promise(function(_0x3e2b31,_0x3968f3){var _0x12b25c;if(_[_0x42b4('0x30')](_0x2fddea['scheduledat'])){_0x2fddea['scheduledat']=moment();}if(moment()>moment(_0x2fddea[_0x42b4('0x31')])){_0x12b25c=moment()[_0x42b4('0x32')](_0x60c403||0x3,_0x42b4('0x33'));}else{if(_0x2fddea[_0x42b4('0x2d')]==0x0){_0x12b25c=moment(_0x2fddea[_0x42b4('0x31')]);}else{_0x12b25c=moment()[_0x42b4('0x32')](_0x60c403||0x3,_0x42b4('0x33'));}}if(_[_0x42b4('0x30')](_0x12b25c)){_0x12b25c=moment()[_0x42b4('0x32')](_0x60c403||0x3,_0x42b4('0x33'));}var _0x1819de={'phone':_0x5116fd[_0x42b4('0x34')],'active':0x0,'OrderBy':_[_0x42b4('0x30')](_0x5116fd[_0x42b4('0x2d')])?0x0:_0x5116fd['OrderBy'],'scheduledat':moment()[_0x42b4('0x32')](_0x20fb25||0x1,_0x42b4('0x33')),'countbusyretry':_0x140735['countbusyretry'],'countcongestionretry':_0x140735[_0x42b4('0x21')],'countnoanswerretry':_0x140735['countnoanswerretry'],'countnosuchnumberretry':_0x140735['countnosuchnumberretry'],'countdropretry':_0x140735['countdropretry'],'countabandonedretry':_0x140735[_0x42b4('0x25')],'countmachineretry':_0x140735[_0x42b4('0x35')],'countagentrejectretry':_0x140735[_0x42b4('0x26')],'createdAt':_0x140735[_0x42b4('0x36')],'updatedAt':_0x140735[_0x42b4('0x37')]};var _0x45f095={'CmHopperId':_0x5116fd['id'],'phone':_0x2fddea[_0x42b4('0x34')],'active':0x0,'OrderBy':_[_0x42b4('0x30')](_0x2fddea[_0x42b4('0x2d')])?0x0:_0x2fddea[_0x42b4('0x2d')],'scheduledat':_0x12b25c,'countbusyretry':_0x2fddea[_0x42b4('0x20')],'countcongestionretry':_0x2fddea['countcongestionretry'],'countnoanswerretry':_0x2fddea[_0x42b4('0x22')],'countnosuchnumberretry':_0x2fddea['countnosuchnumberretry'],'countdropretry':_0x2fddea[_0x42b4('0x24')],'countabandonedretry':_0x2fddea[_0x42b4('0x25')],'countmachineretry':_0x2fddea[_0x42b4('0x35')],'countagentrejectretry':_0x2fddea[_0x42b4('0x26')],'createdAt':_0x2fddea[_0x42b4('0x36')],'updatedAt':_0x2fddea['updatedAt']};return db['sequelize']['transaction'](function(_0x58b3ef){return db[_0x42b4('0x1d')][_0x42b4('0x38')](_0x1819de,{'where':{'id':_0x2fddea['id']}},{'transaction':_0x58b3ef})[_0x42b4('0xe')](function(){return db[_0x42b4('0x2b')][_0x42b4('0x38')](_0x45f095,{'where':{'id':_0x5116fd['id']}},{'transaction':_0x58b3ef});});})['then'](function(_0x240621){_0x3e2b31({'id':_0x5116fd['id'],'phone':_0x2fddea[_0x42b4('0x34')]});})[_0x42b4('0x29')](function(_0x35adcd){logger[_0x42b4('0x14')](_0x42b4('0x39'),_0x35adcd[_0x42b4('0x15')]);_0x3968f3({'error':_0x35adcd['message']});});});}exports[_0x42b4('0x3a')]=function(_0x30e570){var _0x353be4=this;return new Promise(function(_0x211160,_0x47dd11){return db[_0x42b4('0x2b')]['update'](_0x30e570[_0x42b4('0x19')][_0x42b4('0x3b')],{'where':{'id':_0x30e570['body']['id']}})[_0x42b4('0xe')](function(_0x5adb91){_0x211160(_0x5adb91);})['catch'](function(_0xa423d6){logger['error'](_0x42b4('0x3a'),_0xa423d6[_0x42b4('0x15')]);_0x47dd11(_0x353be4[_0x42b4('0x14')](0x1f4,_0xa423d6[_0x42b4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 63bf4df..f47581d 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 _0xe924=['../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3d9557,_0x5d09d2){var _0x359ff8=function(_0x784fa){while(--_0x784fa){_0x3d9557['push'](_0x3d9557['shift']());}};_0x359ff8(++_0x5d09d2);}(_0xe924,0x141));var _0x4e92=function(_0x315b7f,_0x2d1dc9){_0x315b7f=_0x315b7f-0x0;var _0x3fe840=_0xe924[_0x315b7f];return _0x3fe840;};'use strict';var multer=require(_0x4e92('0x0'));var util=require(_0x4e92('0x1'));var path=require(_0x4e92('0x2'));var timeout=require(_0x4e92('0x3'));var express=require(_0x4e92('0x4'));var router=express[_0x4e92('0x5')]();var fs_extra=require(_0x4e92('0x6'));var auth=require(_0x4e92('0x7'));var interaction=require(_0x4e92('0x8'));var config=require(_0x4e92('0x9'));var controller=require(_0x4e92('0xa'));router['get']('/',auth[_0x4e92('0xb')](),controller['index']);router[_0x4e92('0xc')](_0x4e92('0xd'),auth[_0x4e92('0xb')](),controller[_0x4e92('0xe')]);router[_0x4e92('0xf')]('/',auth[_0x4e92('0xb')](),controller[_0x4e92('0x10')]);router[_0x4e92('0x11')](_0x4e92('0xd'),auth[_0x4e92('0xb')](),controller[_0x4e92('0x12')]);router[_0x4e92('0x13')]('/:id',auth[_0x4e92('0xb')](),controller[_0x4e92('0x14')]);module[_0x4e92('0x15')]=router; \ No newline at end of file +var _0xcd6a=['index','get','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x18c1ed,_0xe47487){var _0x466a25=function(_0x238824){while(--_0x238824){_0x18c1ed['push'](_0x18c1ed['shift']());}};_0x466a25(++_0xe47487);}(_0xcd6a,0xbe));var _0xacd6=function(_0x6312d,_0x51dc45){_0x6312d=_0x6312d-0x0;var _0x194f61=_0xcd6a[_0x6312d];return _0x194f61;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xacd6('0x0'));var timeout=require(_0xacd6('0x1'));var express=require(_0xacd6('0x2'));var router=express[_0xacd6('0x3')]();var fs_extra=require(_0xacd6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xacd6('0x5'));var config=require(_0xacd6('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth[_0xacd6('0x7')](),controller[_0xacd6('0x8')]);router[_0xacd6('0x9')](_0xacd6('0xa'),auth[_0xacd6('0x7')](),controller[_0xacd6('0xb')]);router[_0xacd6('0xc')]('/',auth['isAuthenticated'](),controller[_0xacd6('0xd')]);router[_0xacd6('0xe')]('/:id',auth[_0xacd6('0x7')](),controller[_0xacd6('0xf')]);router[_0xacd6('0x10')](_0xacd6('0xa'),auth['isAuthenticated'](),controller[_0xacd6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c56ebf6..83a6320 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 _0x04f1=['INTEGER','moment','sequelize','exports','contactListQueue'];(function(_0x121dbb,_0x12b350){var _0x53ce97=function(_0x4586cc){while(--_0x4586cc){_0x121dbb['push'](_0x121dbb['shift']());}};_0x53ce97(++_0x12b350);}(_0x04f1,0x92));var _0x104f=function(_0x2af009,_0x5432ee){_0x2af009=_0x2af009-0x0;var _0x46d15f=_0x04f1[_0x2af009];return _0x46d15f;};'use strict';var moment=require(_0x104f('0x0'));var Sequelize=require(_0x104f('0x1'));module[_0x104f('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x104f('0x3')},'ListId':{'type':Sequelize[_0x104f('0x4')],'unique':_0x104f('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x5419=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x3b5712,_0x4a05ba){var _0xd5f8c=function(_0x2db82a){while(--_0x2db82a){_0x3b5712['push'](_0x3b5712['shift']());}};_0xd5f8c(++_0x4a05ba);}(_0x5419,0x175));var _0x9541=function(_0xbf52f3,_0x2b2bb2){_0xbf52f3=_0xbf52f3-0x0;var _0x25edcc=_0x5419[_0xbf52f3];return _0x25edcc;};'use strict';var moment=require(_0x9541('0x0'));var Sequelize=require(_0x9541('0x1'));module[_0x9541('0x2')]={'phone':{'type':Sequelize[_0x9541('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9541('0x4')],'unique':_0x9541('0x5')},'ListId':{'type':Sequelize[_0x9541('0x4')],'unique':_0x9541('0x5')},'VoiceQueueId':{'type':Sequelize[_0x9541('0x4')],'unique':_0x9541('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 7a5ddbc..3a16498 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 _0x5c36=['name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','find','catch','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c36,0x1d1));var _0x65c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c36[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x65c3('0x0'));var jsonpatch=require(_0x65c3('0x1'));var rp=require(_0x65c3('0x2'));var moment=require(_0x65c3('0x3'));var BPromise=require(_0x65c3('0x4'));var Mustache=require('mustache');var util=require(_0x65c3('0x5'));var path=require(_0x65c3('0x6'));var sox=require(_0x65c3('0x7'));var csv=require(_0x65c3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x65c3('0x9'));var squel=require(_0x65c3('0xa'));var crypto=require(_0x65c3('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x65c3('0x8'));var querystring=require(_0x65c3('0xc'));var Papa=require(_0x65c3('0xd'));var Redis=require(_0x65c3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x65c3('0xf'));var as=require(_0x65c3('0x10'));var hardwareService=require(_0x65c3('0x11'));var logger=require(_0x65c3('0x12'))(_0x65c3('0x13'));var utils=require(_0x65c3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x65c3('0x15'));var db=require(_0x65c3('0x16'))['db'];function respondWithStatusCode(_0x349b03,_0x5afc37){_0x5afc37=_0x5afc37||0xcc;return function(_0x2f54ef){if(_0x2f54ef){return _0x349b03[_0x65c3('0x17')](_0x5afc37);}return _0x349b03[_0x65c3('0x18')](_0x5afc37)['end']();};}function respondWithResult(_0x223e29,_0x146db5){_0x146db5=_0x146db5||0xc8;return function(_0x2b2381){if(_0x2b2381){return _0x223e29['status'](_0x146db5)['json'](_0x2b2381);}};}function respondWithFilteredResult(_0x4712cf,_0x36fbf6){return function(_0x12be12){if(_0x12be12){var _0x4c9a7b=typeof _0x36fbf6[_0x65c3('0x19')]===_0x65c3('0x1a')&&typeof _0x36fbf6[_0x65c3('0x1b')]===_0x65c3('0x1a');var _0x5efdea=_0x12be12[_0x65c3('0x1c')];var _0x2a7bc1=_0x4c9a7b?0x0:_0x36fbf6[_0x65c3('0x19')];var _0x266847=_0x4c9a7b?_0x12be12['count']:_0x36fbf6['offset']+_0x36fbf6[_0x65c3('0x1b')];var _0x31670e;if(_0x266847>=_0x5efdea){_0x266847=_0x5efdea;_0x31670e=0xc8;}else{_0x31670e=0xce;}_0x4712cf[_0x65c3('0x18')](_0x31670e);return _0x4712cf[_0x65c3('0x1d')](_0x65c3('0x1e'),_0x2a7bc1+'-'+_0x266847+'/'+_0x5efdea)[_0x65c3('0x1f')](_0x12be12);}return null;};}function patchUpdates(_0x582bac){return function(_0x1ff354){try{jsonpatch[_0x65c3('0x20')](_0x1ff354,_0x582bac,!![]);}catch(_0x4ac1b4){return BPromise[_0x65c3('0x21')](_0x4ac1b4);}return _0x1ff354['save']();};}function saveUpdates(_0x2a256d,_0x5fd38){return function(_0x41f969){if(_0x41f969){return _0x41f969[_0x65c3('0x22')](_0x2a256d)[_0x65c3('0x23')](function(_0x191ce2){return _0x191ce2;});}return null;};}function removeEntity(_0x233fe1,_0x3488a1){return function(_0x578bb3){if(_0x578bb3){return _0x578bb3[_0x65c3('0x24')]()[_0x65c3('0x23')](function(){_0x233fe1[_0x65c3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x264647,_0x2ac060){return function(_0x3d7b49){if(!_0x3d7b49){_0x264647[_0x65c3('0x17')](0x194);}return _0x3d7b49;};}function handleError(_0x2cedc9,_0x396ca5){_0x396ca5=_0x396ca5||0x1f4;return function(_0x1c191e){logger[_0x65c3('0x25')](_0x1c191e[_0x65c3('0x26')]);if(_0x1c191e[_0x65c3('0x27')]){delete _0x1c191e[_0x65c3('0x27')];}_0x2cedc9[_0x65c3('0x18')](_0x396ca5)[_0x65c3('0x28')](_0x1c191e);};}exports[_0x65c3('0x29')]=function(_0x12efa7,_0x55e38c){var _0x5e97bc={},_0x3c5571={},_0x18945a={'count':0x0,'rows':[]};var _0xb04283=_[_0x65c3('0x2a')](db[_0x65c3('0x2b')][_0x65c3('0x2c')],function(_0x32f340){return{'name':_0x32f340[_0x65c3('0x2d')],'type':_0x32f340[_0x65c3('0x2e')][_0x65c3('0x2f')]};});_0x3c5571['model']=_['map'](_0xb04283,'name');_0x3c5571[_0x65c3('0x30')]=_[_0x65c3('0x31')](_0x12efa7['query']);_0x3c5571[_0x65c3('0x32')]=_[_0x65c3('0x33')](_0x3c5571[_0x65c3('0x34')],_0x3c5571['query']);_0x5e97bc[_0x65c3('0x35')]=_[_0x65c3('0x33')](_0x3c5571[_0x65c3('0x34')],qs['fields'](_0x12efa7[_0x65c3('0x30')][_0x65c3('0x36')]));_0x5e97bc[_0x65c3('0x35')]=_0x5e97bc[_0x65c3('0x35')][_0x65c3('0x37')]?_0x5e97bc[_0x65c3('0x35')]:_0x3c5571['model'];if(!_0x12efa7[_0x65c3('0x30')][_0x65c3('0x38')](_0x65c3('0x39'))){_0x5e97bc[_0x65c3('0x1b')]=qs[_0x65c3('0x1b')](_0x12efa7['query'][_0x65c3('0x1b')]);_0x5e97bc[_0x65c3('0x19')]=qs[_0x65c3('0x19')](_0x12efa7[_0x65c3('0x30')][_0x65c3('0x19')]);}_0x5e97bc['order']=qs['sort'](_0x12efa7[_0x65c3('0x30')][_0x65c3('0x3a')]);_0x5e97bc[_0x65c3('0x3b')]=qs[_0x65c3('0x32')](_[_0x65c3('0x3c')](_0x12efa7[_0x65c3('0x30')],_0x3c5571[_0x65c3('0x32')]),_0xb04283);if(_0x12efa7[_0x65c3('0x30')][_0x65c3('0x3d')]){_0x5e97bc[_0x65c3('0x3b')]=_[_0x65c3('0x3e')](_0x5e97bc['where'],{'$or':_['map'](_0xb04283,function(_0x4bf8b1){if(_0x4bf8b1['type']!==_0x65c3('0x3f')){var _0x5f1d04={};_0x5f1d04[_0x4bf8b1[_0x65c3('0x27')]]={'$like':'%'+_0x12efa7[_0x65c3('0x30')][_0x65c3('0x3d')]+'%'};return _0x5f1d04;}})});}_0x5e97bc=_[_0x65c3('0x3e')]({},_0x5e97bc,_0x12efa7[_0x65c3('0x40')]);var _0x2d8a1d={'where':_0x5e97bc[_0x65c3('0x3b')]};return db[_0x65c3('0x2b')][_0x65c3('0x1c')](_0x2d8a1d)['then'](function(_0x1877ae){_0x18945a[_0x65c3('0x1c')]=_0x1877ae;if(_0x12efa7['query'][_0x65c3('0x41')]){_0x5e97bc['include']=[{'all':!![]}];}return db[_0x65c3('0x2b')][_0x65c3('0x42')](_0x5e97bc);})[_0x65c3('0x23')](function(_0x5beb38){_0x18945a[_0x65c3('0x43')]=_0x5beb38;return _0x18945a;})[_0x65c3('0x23')](respondWithFilteredResult(_0x55e38c,_0x5e97bc))['catch'](handleError(_0x55e38c,null));};exports['show']=function(_0x4c7d1e,_0x4ebadb){var _0x22c0a6={'raw':!![],'where':{'id':_0x4c7d1e[_0x65c3('0x44')]['id']}},_0x3237ed={};_0x3237ed['model']=_['keys'](db[_0x65c3('0x2b')][_0x65c3('0x2c')]);_0x3237ed['query']=_[_0x65c3('0x31')](_0x4c7d1e[_0x65c3('0x30')]);_0x3237ed['filters']=_[_0x65c3('0x33')](_0x3237ed['model'],_0x3237ed[_0x65c3('0x30')]);_0x22c0a6['attributes']=_[_0x65c3('0x33')](_0x3237ed['model'],qs['fields'](_0x4c7d1e[_0x65c3('0x30')]['fields']));_0x22c0a6[_0x65c3('0x35')]=_0x22c0a6[_0x65c3('0x35')][_0x65c3('0x37')]?_0x22c0a6['attributes']:_0x3237ed[_0x65c3('0x34')];if(_0x4c7d1e[_0x65c3('0x30')][_0x65c3('0x41')]){_0x22c0a6['include']=[{'all':!![]}];}_0x22c0a6=_[_0x65c3('0x3e')]({},_0x22c0a6,_0x4c7d1e[_0x65c3('0x40')]);return db[_0x65c3('0x2b')][_0x65c3('0x45')](_0x22c0a6)[_0x65c3('0x23')](handleEntityNotFound(_0x4ebadb,null))[_0x65c3('0x23')](respondWithResult(_0x4ebadb,null))[_0x65c3('0x46')](handleError(_0x4ebadb,null));};exports['update']=function(_0x406d89,_0x6d9307){if(_0x406d89['body']['id']){delete _0x406d89['body']['id'];}return db[_0x65c3('0x2b')][_0x65c3('0x45')]({'where':{'id':_0x406d89[_0x65c3('0x44')]['id']}})[_0x65c3('0x23')](handleEntityNotFound(_0x6d9307,null))[_0x65c3('0x23')](saveUpdates(_0x406d89['body'],null))[_0x65c3('0x23')](respondWithResult(_0x6d9307,null))[_0x65c3('0x46')](handleError(_0x6d9307,null));};exports['destroy']=function(_0x1685cd,_0x50a16f){return db[_0x65c3('0x2b')][_0x65c3('0x45')]({'where':{'id':_0x1685cd[_0x65c3('0x44')]['id']}})[_0x65c3('0x23')](handleEntityNotFound(_0x50a16f,null))[_0x65c3('0x23')](removeEntity(_0x50a16f,null))[_0x65c3('0x46')](handleError(_0x50a16f,null));};exports[_0x65c3('0x47')]=function(_0x2dbccf,_0x30a8ba){return db[_0x65c3('0x2b')]['describe']()[_0x65c3('0x23')](respondWithResult(_0x30a8ba,null))[_0x65c3('0x46')](handleError(_0x30a8ba,null));}; \ No newline at end of file +var _0xefe6=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','end','error','stack','name','send','index','rawAttributes','key','model','map','query','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','CmHopperBlack','findAll','rows','catch','show','params','keys','includeAll','include','find','update','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','papaparse'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xefe6,0x14c));var _0x6efe=function(_0x3c06d1,_0x193d6e){_0x3c06d1=_0x3c06d1-0x0;var _0x5ee2be=_0xefe6[_0x3c06d1];return _0x5ee2be;};'use strict';var emlformat=require(_0x6efe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6efe('0x1'));var jsonpatch=require(_0x6efe('0x2'));var rp=require(_0x6efe('0x3'));var moment=require(_0x6efe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6efe('0x5'));var util=require(_0x6efe('0x6'));var path=require(_0x6efe('0x7'));var sox=require('sox');var csv=require(_0x6efe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6efe('0x9'));var _=require(_0x6efe('0xa'));var squel=require('squel');var crypto=require(_0x6efe('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6efe('0x8'));var querystring=require('querystring');var Papa=require(_0x6efe('0xc'));var Redis=require(_0x6efe('0xd'));var authService=require(_0x6efe('0xe'));var qs=require(_0x6efe('0xf'));var as=require(_0x6efe('0x10'));var hardwareService=require(_0x6efe('0x11'));var logger=require(_0x6efe('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6efe('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6efe('0x14'))['db'];function respondWithStatusCode(_0x5ab125,_0x1742f4){_0x1742f4=_0x1742f4||0xcc;return function(_0x24353c){if(_0x24353c){return _0x5ab125[_0x6efe('0x15')](_0x1742f4);}return _0x5ab125[_0x6efe('0x16')](_0x1742f4)['end']();};}function respondWithResult(_0x385a59,_0x24022f){_0x24022f=_0x24022f||0xc8;return function(_0x28fb8c){if(_0x28fb8c){return _0x385a59['status'](_0x24022f)['json'](_0x28fb8c);}};}function respondWithFilteredResult(_0x34df04,_0x3a32b8){return function(_0x54e8fa){if(_0x54e8fa){var _0x4497f4=typeof _0x3a32b8[_0x6efe('0x17')]===_0x6efe('0x18')&&typeof _0x3a32b8[_0x6efe('0x19')]==='undefined';var _0x18f4d5=_0x54e8fa[_0x6efe('0x1a')];var _0x3d8e8f=_0x4497f4?0x0:_0x3a32b8[_0x6efe('0x17')];var _0x473dd8=_0x4497f4?_0x54e8fa[_0x6efe('0x1a')]:_0x3a32b8[_0x6efe('0x17')]+_0x3a32b8['limit'];var _0x3afe78;if(_0x473dd8>=_0x18f4d5){_0x473dd8=_0x18f4d5;_0x3afe78=0xc8;}else{_0x3afe78=0xce;}_0x34df04[_0x6efe('0x16')](_0x3afe78);return _0x34df04[_0x6efe('0x1b')]('Content-Range',_0x3d8e8f+'-'+_0x473dd8+'/'+_0x18f4d5)[_0x6efe('0x1c')](_0x54e8fa);}return null;};}function patchUpdates(_0x4634e3){return function(_0x157343){try{jsonpatch[_0x6efe('0x1d')](_0x157343,_0x4634e3,!![]);}catch(_0x4423cb){return BPromise[_0x6efe('0x1e')](_0x4423cb);}return _0x157343[_0x6efe('0x1f')]();};}function saveUpdates(_0x17e205,_0x4b50bb){return function(_0x3c76b6){if(_0x3c76b6){return _0x3c76b6['update'](_0x17e205)[_0x6efe('0x20')](function(_0x195401){return _0x195401;});}return null;};}function removeEntity(_0x4a4f53,_0x159879){return function(_0x4ce461){if(_0x4ce461){return _0x4ce461[_0x6efe('0x21')]()[_0x6efe('0x20')](function(){_0x4a4f53['status'](0xcc)[_0x6efe('0x22')]();});}};}function handleEntityNotFound(_0x184ede,_0xceb3c8){return function(_0x38745f){if(!_0x38745f){_0x184ede[_0x6efe('0x15')](0x194);}return _0x38745f;};}function handleError(_0x17ae02,_0x5becdf){_0x5becdf=_0x5becdf||0x1f4;return function(_0xe04891){logger[_0x6efe('0x23')](_0xe04891[_0x6efe('0x24')]);if(_0xe04891[_0x6efe('0x25')]){delete _0xe04891[_0x6efe('0x25')];}_0x17ae02[_0x6efe('0x16')](_0x5becdf)[_0x6efe('0x26')](_0xe04891);};}exports[_0x6efe('0x27')]=function(_0x206ada,_0x50c3d7){var _0x250ef4={},_0x1c1316={},_0x7a439b={'count':0x0,'rows':[]};var _0x54b49b=_['map'](db['CmHopperBlack'][_0x6efe('0x28')],function(_0x1109a6){return{'name':_0x1109a6['fieldName'],'type':_0x1109a6['type'][_0x6efe('0x29')]};});_0x1c1316[_0x6efe('0x2a')]=_[_0x6efe('0x2b')](_0x54b49b,_0x6efe('0x25'));_0x1c1316[_0x6efe('0x2c')]=_['keys'](_0x206ada[_0x6efe('0x2c')]);_0x1c1316['filters']=_[_0x6efe('0x2d')](_0x1c1316[_0x6efe('0x2a')],_0x1c1316[_0x6efe('0x2c')]);_0x250ef4[_0x6efe('0x2e')]=_[_0x6efe('0x2d')](_0x1c1316['model'],qs[_0x6efe('0x2f')](_0x206ada['query'][_0x6efe('0x2f')]));_0x250ef4[_0x6efe('0x2e')]=_0x250ef4[_0x6efe('0x2e')][_0x6efe('0x30')]?_0x250ef4[_0x6efe('0x2e')]:_0x1c1316['model'];if(!_0x206ada[_0x6efe('0x2c')]['hasOwnProperty'](_0x6efe('0x31'))){_0x250ef4[_0x6efe('0x19')]=qs[_0x6efe('0x19')](_0x206ada['query']['limit']);_0x250ef4[_0x6efe('0x17')]=qs[_0x6efe('0x17')](_0x206ada[_0x6efe('0x2c')]['offset']);}_0x250ef4['order']=qs[_0x6efe('0x32')](_0x206ada[_0x6efe('0x2c')][_0x6efe('0x32')]);_0x250ef4['where']=qs[_0x6efe('0x33')](_[_0x6efe('0x34')](_0x206ada[_0x6efe('0x2c')],_0x1c1316[_0x6efe('0x33')]),_0x54b49b);if(_0x206ada[_0x6efe('0x2c')][_0x6efe('0x35')]){_0x250ef4[_0x6efe('0x36')]=_['merge'](_0x250ef4[_0x6efe('0x36')],{'$or':_[_0x6efe('0x2b')](_0x54b49b,function(_0x169042){if(_0x169042['type']!==_0x6efe('0x37')){var _0x3eb3ec={};_0x3eb3ec[_0x169042['name']]={'$like':'%'+_0x206ada[_0x6efe('0x2c')]['filter']+'%'};return _0x3eb3ec;}})});}_0x250ef4=_[_0x6efe('0x38')]({},_0x250ef4,_0x206ada['options']);var _0x46bf6b={'where':_0x250ef4['where']};return db[_0x6efe('0x39')]['count'](_0x46bf6b)[_0x6efe('0x20')](function(_0x5e01d6){_0x7a439b['count']=_0x5e01d6;if(_0x206ada[_0x6efe('0x2c')]['includeAll']){_0x250ef4['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x6efe('0x3a')](_0x250ef4);})[_0x6efe('0x20')](function(_0x69785b){_0x7a439b[_0x6efe('0x3b')]=_0x69785b;return _0x7a439b;})['then'](respondWithFilteredResult(_0x50c3d7,_0x250ef4))[_0x6efe('0x3c')](handleError(_0x50c3d7,null));};exports[_0x6efe('0x3d')]=function(_0x2d2007,_0x259f53){var _0x51baea={'raw':!![],'where':{'id':_0x2d2007[_0x6efe('0x3e')]['id']}},_0x42d42c={};_0x42d42c[_0x6efe('0x2a')]=_[_0x6efe('0x3f')](db[_0x6efe('0x39')]['rawAttributes']);_0x42d42c[_0x6efe('0x2c')]=_['keys'](_0x2d2007[_0x6efe('0x2c')]);_0x42d42c[_0x6efe('0x33')]=_[_0x6efe('0x2d')](_0x42d42c[_0x6efe('0x2a')],_0x42d42c[_0x6efe('0x2c')]);_0x51baea[_0x6efe('0x2e')]=_[_0x6efe('0x2d')](_0x42d42c[_0x6efe('0x2a')],qs['fields'](_0x2d2007[_0x6efe('0x2c')][_0x6efe('0x2f')]));_0x51baea[_0x6efe('0x2e')]=_0x51baea[_0x6efe('0x2e')][_0x6efe('0x30')]?_0x51baea[_0x6efe('0x2e')]:_0x42d42c[_0x6efe('0x2a')];if(_0x2d2007[_0x6efe('0x2c')][_0x6efe('0x40')]){_0x51baea[_0x6efe('0x41')]=[{'all':!![]}];}_0x51baea=_[_0x6efe('0x38')]({},_0x51baea,_0x2d2007['options']);return db[_0x6efe('0x39')][_0x6efe('0x42')](_0x51baea)['then'](handleEntityNotFound(_0x259f53,null))[_0x6efe('0x20')](respondWithResult(_0x259f53,null))[_0x6efe('0x3c')](handleError(_0x259f53,null));};exports[_0x6efe('0x43')]=function(_0x1e07a3,_0x2d0180){if(_0x1e07a3['body']['id']){delete _0x1e07a3[_0x6efe('0x44')]['id'];}return db['CmHopperBlack'][_0x6efe('0x42')]({'where':{'id':_0x1e07a3['params']['id']}})[_0x6efe('0x20')](handleEntityNotFound(_0x2d0180,null))['then'](saveUpdates(_0x1e07a3[_0x6efe('0x44')],null))[_0x6efe('0x20')](respondWithResult(_0x2d0180,null))[_0x6efe('0x3c')](handleError(_0x2d0180,null));};exports['destroy']=function(_0x2b27f2,_0x2f3fe4){return db[_0x6efe('0x39')]['find']({'where':{'id':_0x2b27f2[_0x6efe('0x3e')]['id']}})[_0x6efe('0x20')](handleEntityNotFound(_0x2f3fe4,null))[_0x6efe('0x20')](removeEntity(_0x2f3fe4,null))[_0x6efe('0x3c')](handleError(_0x2f3fe4,null));};exports['describe']=function(_0x33d5d7,_0x2b10d0){return db[_0x6efe('0x39')]['describe']()[_0x6efe('0x20')](respondWithResult(_0x2b10d0,null))['catch'](handleError(_0x2b10d0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 96c332a..7a9c86b 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 _0xc1e0=['exports','define','CmHopperBlack','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x20cde4,_0x11d490){var _0x591fa3=function(_0x27b956){while(--_0x27b956){_0x20cde4['push'](_0x20cde4['shift']());}};_0x591fa3(++_0x11d490);}(_0xc1e0,0xd4));var _0x0c1e=function(_0x4b8b74,_0x1e5dc3){_0x4b8b74=_0x4b8b74-0x0;var _0x12e5b0=_0xc1e0[_0x4b8b74];return _0x12e5b0;};'use strict';var _=require('lodash');var util=require(_0x0c1e('0x0'));var logger=require(_0x0c1e('0x1'))(_0x0c1e('0x2'));var moment=require(_0x0c1e('0x3'));var BPromise=require(_0x0c1e('0x4'));var rp=require(_0x0c1e('0x5'));var fs=require('fs');var path=require(_0x0c1e('0x6'));var rimraf=require(_0x0c1e('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x0c1e('0x8')]=function(_0x2c63ed,_0x158032){return _0x2c63ed[_0x0c1e('0x9')](_0x0c1e('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5202=['./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x116c04,_0x4963da){var _0x9e011d=function(_0x143880){while(--_0x143880){_0x116c04['push'](_0x116c04['shift']());}};_0x9e011d(++_0x4963da);}(_0x5202,0x138));var _0x2520=function(_0x2ffff9,_0x12c0a9){_0x2ffff9=_0x2ffff9-0x0;var _0xffcecc=_0x5202[_0x2ffff9];return _0xffcecc;};'use strict';var _=require(_0x2520('0x0'));var util=require(_0x2520('0x1'));var logger=require(_0x2520('0x2'))(_0x2520('0x3'));var moment=require(_0x2520('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2520('0x5'));var config=require(_0x2520('0x6'));var attributes=require(_0x2520('0x7'));module[_0x2520('0x8')]=function(_0x1f94e3,_0x5a4c65){return _0x1f94e3[_0x2520('0x9')]('CmHopperBlack',attributes,{'tableName':_0x2520('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index b7a0c1f..22c8773 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 _0x178f=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCmHopperBlack','findAll','options','raw','attributes','include','map','model','update','body','limit','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','where','lodash','util','moment','bluebird'];(function(_0x2048b2,_0xd4ea20){var _0x241e52=function(_0x5e071b){while(--_0x5e071b){_0x2048b2['push'](_0x2048b2['shift']());}};_0x241e52(++_0xd4ea20);}(_0x178f,0x182));var _0xf178=function(_0x4ed912,_0x9b2b92){_0x4ed912=_0x4ed912-0x0;var _0x379b20=_0x178f[_0x4ed912];return _0x379b20;};'use strict';var _=require(_0xf178('0x0'));var util=require(_0xf178('0x1'));var moment=require(_0xf178('0x2'));var BPromise=require(_0xf178('0x3'));var rs=require(_0xf178('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf178('0x5'))['db'];var utils=require(_0xf178('0x6'));var logger=require(_0xf178('0x7'))(_0xf178('0x8'));var config=require(_0xf178('0x9'));var jayson=require(_0xf178('0xa'));var client=jayson[_0xf178('0xb')][_0xf178('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23fcb1,_0x12ffdf,_0x130fe0){return new BPromise(function(_0x133ab2,_0x1ada51){return client[_0xf178('0xd')](_0x23fcb1,_0x130fe0)[_0xf178('0xe')](function(_0x4a837a){logger[_0xf178('0xf')](_0xf178('0x10'),_0x12ffdf,_0xf178('0x11'));logger[_0xf178('0x12')](_0xf178('0x13'),_0x12ffdf,_0xf178('0x11'),JSON[_0xf178('0x14')](_0x4a837a));if(_0x4a837a[_0xf178('0x15')]){if(_0x4a837a[_0xf178('0x15')]['code']===0x1f4){logger[_0xf178('0x15')](_0xf178('0x10'),_0x12ffdf,_0x4a837a[_0xf178('0x15')][_0xf178('0x16')]);return _0x1ada51(_0x4a837a[_0xf178('0x15')][_0xf178('0x16')]);}logger[_0xf178('0x15')]('CmHopperBlack,\x20%s,\x20%s',_0x12ffdf,_0x4a837a[_0xf178('0x15')][_0xf178('0x16')]);return _0x133ab2(_0x4a837a[_0xf178('0x15')][_0xf178('0x16')]);}else{logger[_0xf178('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x12ffdf,'request\x20sent');_0x133ab2(_0x4a837a['result'][_0xf178('0x16')]);}})[_0xf178('0x17')](function(_0x2728f9){logger[_0xf178('0x15')](_0xf178('0x10'),_0x12ffdf,_0x2728f9);_0x1ada51(_0x2728f9);});});}exports[_0xf178('0x18')]=function(_0x519dd9){var _0x3e7807=this;return new Promise(function(_0x12fb39,_0xd68eb1){return db['CmHopperBlack'][_0xf178('0x19')]({'raw':_0x519dd9[_0xf178('0x1a')]?_0x519dd9[_0xf178('0x1a')][_0xf178('0x1b')]===undefined?!![]:![]:!![],'where':_0x519dd9[_0xf178('0x1a')]?_0x519dd9[_0xf178('0x1a')]['where']||null:null,'attributes':_0x519dd9[_0xf178('0x1a')]?_0x519dd9[_0xf178('0x1a')][_0xf178('0x1c')]||null:null,'limit':_0x519dd9[_0xf178('0x1a')]?_0x519dd9[_0xf178('0x1a')]['limit']||null:null,'include':_0x519dd9[_0xf178('0x1a')]?_0x519dd9[_0xf178('0x1a')][_0xf178('0x1d')]?_[_0xf178('0x1e')](_0x519dd9[_0xf178('0x1a')][_0xf178('0x1d')],function(_0x1cb11c){return{'model':db[_0x1cb11c[_0xf178('0x1f')]],'as':_0x1cb11c['as'],'attributes':_0x1cb11c[_0xf178('0x1c')],'include':_0x1cb11c['include']?_[_0xf178('0x1e')](_0x1cb11c[_0xf178('0x1d')],function(_0x57b141){return{'model':db[_0x57b141[_0xf178('0x1f')]],'as':_0x57b141['as'],'attributes':_0x57b141[_0xf178('0x1c')],'include':_0x57b141[_0xf178('0x1d')]?_[_0xf178('0x1e')](_0x57b141['include'],function(_0x3dc1fe){return{'model':db[_0x3dc1fe[_0xf178('0x1f')]],'as':_0x3dc1fe['as'],'attributes':_0x3dc1fe[_0xf178('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf178('0xe')](function(_0x2cbaee){logger[_0xf178('0xf')](_0xf178('0x18'),_0x519dd9);logger[_0xf178('0x12')](_0xf178('0x18'),_0x519dd9,JSON[_0xf178('0x14')](_0x2cbaee));_0x12fb39(_0x2cbaee);})['catch'](function(_0x3a0b00){logger[_0xf178('0x15')](_0xf178('0x18'),_0x3a0b00['message'],_0x519dd9);_0xd68eb1(_0x3e7807['error'](0x1f4,_0x3a0b00[_0xf178('0x16')]));});});};exports['UpdateCmHopperBlack']=function(_0x243f4f){var _0x42429c=this;return new Promise(function(_0x55b509,_0x5bfcd9){return db['CmHopperBlack'][_0xf178('0x20')](_0x243f4f[_0xf178('0x21')],{'raw':_0x243f4f[_0xf178('0x1a')]?_0x243f4f[_0xf178('0x1a')][_0xf178('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x243f4f[_0xf178('0x1a')]?_0x243f4f['options']['where']||null:null,'attributes':_0x243f4f[_0xf178('0x1a')]?_0x243f4f[_0xf178('0x1a')][_0xf178('0x1c')]||null:null,'limit':_0x243f4f['options']?_0x243f4f[_0xf178('0x1a')][_0xf178('0x22')]||null:null})['then'](function(_0x655285){logger['info'](_0xf178('0x23'),_0x243f4f);logger['debug']('UpdateCmHopperBlack',_0x243f4f,JSON[_0xf178('0x14')](_0x655285));_0x55b509(_0x655285);})[_0xf178('0x17')](function(_0x5a457c){logger[_0xf178('0x15')](_0xf178('0x23'),_0x5a457c[_0xf178('0x16')],_0x243f4f);_0x5bfcd9(_0x42429c['error'](0x1f4,_0x5a457c[_0xf178('0x16')]));});});};exports[_0xf178('0x24')]=function(_0x5025c5){var _0x165522=this;return new Promise(function(_0x1a503e,_0x4d67d8){return db['CmHopperBlack'][_0xf178('0x25')]({'where':_0x5025c5[_0xf178('0x1a')]?_0x5025c5[_0xf178('0x1a')][_0xf178('0x26')]||null:null})['then'](function(_0x116ca6){logger[_0xf178('0xf')](_0xf178('0x24'),_0x5025c5);logger[_0xf178('0x12')](_0xf178('0x24'),_0x5025c5,JSON[_0xf178('0x14')](_0x116ca6));_0x1a503e(_0x116ca6);})[_0xf178('0x17')](function(_0x1e14fd){logger[_0xf178('0x15')]('DestroyCmHopperBlack',_0x1e14fd[_0xf178('0x16')],_0x5025c5);_0x4d67d8(_0x165522[_0xf178('0x15')](0x1f4,_0x1e14fd[_0xf178('0x16')]));});});}; \ No newline at end of file +var _0x0d19=['include','map','model','GetCmHopperBlack','catch','UpdateCmHopperBlack','update','CmHopperBlack','destroy','DestroyCmHopperBlack','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll','options','raw','where','attributes','limit'];(function(_0x1b8be8,_0x10eb30){var _0x1e818b=function(_0x37ba64){while(--_0x37ba64){_0x1b8be8['push'](_0x1b8be8['shift']());}};_0x1e818b(++_0x10eb30);}(_0x0d19,0xc8));var _0x90d1=function(_0x2b7f56,_0x41bc7d){_0x2b7f56=_0x2b7f56-0x0;var _0x36896d=_0x0d19[_0x2b7f56];return _0x36896d;};'use strict';var _=require(_0x90d1('0x0'));var util=require(_0x90d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x90d1('0x2'));var fs=require('fs');var Redis=require(_0x90d1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x90d1('0x4'))(_0x90d1('0x5'));var config=require(_0x90d1('0x6'));var jayson=require(_0x90d1('0x7'));var client=jayson[_0x90d1('0x8')][_0x90d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e9796,_0x458104,_0x4a4ae8){return new BPromise(function(_0x5b15ad,_0x38ec98){return client[_0x90d1('0xa')](_0x2e9796,_0x4a4ae8)[_0x90d1('0xb')](function(_0x27e7fe){logger['info'](_0x90d1('0xc'),_0x458104,_0x90d1('0xd'));logger[_0x90d1('0xe')](_0x90d1('0xf'),_0x458104,'request\x20sent',JSON[_0x90d1('0x10')](_0x27e7fe));if(_0x27e7fe[_0x90d1('0x11')]){if(_0x27e7fe['error'][_0x90d1('0x12')]===0x1f4){logger[_0x90d1('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x458104,_0x27e7fe[_0x90d1('0x11')][_0x90d1('0x13')]);return _0x38ec98(_0x27e7fe[_0x90d1('0x11')][_0x90d1('0x13')]);}logger['error'](_0x90d1('0xc'),_0x458104,_0x27e7fe[_0x90d1('0x11')][_0x90d1('0x13')]);return _0x5b15ad(_0x27e7fe[_0x90d1('0x11')][_0x90d1('0x13')]);}else{logger[_0x90d1('0x14')](_0x90d1('0xc'),_0x458104,'request\x20sent');_0x5b15ad(_0x27e7fe[_0x90d1('0x15')][_0x90d1('0x13')]);}})['catch'](function(_0x1ed5bf){logger[_0x90d1('0x11')](_0x90d1('0xc'),_0x458104,_0x1ed5bf);_0x38ec98(_0x1ed5bf);});});}exports['GetCmHopperBlack']=function(_0x28ade1){var _0x29d03f=this;return new Promise(function(_0x3f671b,_0x23d006){return db['CmHopperBlack'][_0x90d1('0x16')]({'raw':_0x28ade1[_0x90d1('0x17')]?_0x28ade1[_0x90d1('0x17')][_0x90d1('0x18')]===undefined?!![]:![]:!![],'where':_0x28ade1[_0x90d1('0x17')]?_0x28ade1[_0x90d1('0x17')][_0x90d1('0x19')]||null:null,'attributes':_0x28ade1[_0x90d1('0x17')]?_0x28ade1[_0x90d1('0x17')][_0x90d1('0x1a')]||null:null,'limit':_0x28ade1[_0x90d1('0x17')]?_0x28ade1['options'][_0x90d1('0x1b')]||null:null,'include':_0x28ade1[_0x90d1('0x17')]?_0x28ade1[_0x90d1('0x17')][_0x90d1('0x1c')]?_[_0x90d1('0x1d')](_0x28ade1[_0x90d1('0x17')][_0x90d1('0x1c')],function(_0x6fef4){return{'model':db[_0x6fef4[_0x90d1('0x1e')]],'as':_0x6fef4['as'],'attributes':_0x6fef4['attributes'],'include':_0x6fef4[_0x90d1('0x1c')]?_[_0x90d1('0x1d')](_0x6fef4[_0x90d1('0x1c')],function(_0xc29843){return{'model':db[_0xc29843[_0x90d1('0x1e')]],'as':_0xc29843['as'],'attributes':_0xc29843[_0x90d1('0x1a')],'include':_0xc29843['include']?_['map'](_0xc29843[_0x90d1('0x1c')],function(_0x1cf267){return{'model':db[_0x1cf267['model']],'as':_0x1cf267['as'],'attributes':_0x1cf267['attributes']};}):[]};}):[]};}):[]:[]})[_0x90d1('0xb')](function(_0x48b40d){logger[_0x90d1('0x14')](_0x90d1('0x1f'),_0x28ade1);logger['debug'](_0x90d1('0x1f'),_0x28ade1,JSON[_0x90d1('0x10')](_0x48b40d));_0x3f671b(_0x48b40d);})[_0x90d1('0x20')](function(_0x28ba1f){logger[_0x90d1('0x11')](_0x90d1('0x1f'),_0x28ba1f[_0x90d1('0x13')],_0x28ade1);_0x23d006(_0x29d03f[_0x90d1('0x11')](0x1f4,_0x28ba1f[_0x90d1('0x13')]));});});};exports[_0x90d1('0x21')]=function(_0x5f4412){var _0x1813f1=this;return new Promise(function(_0x7c002b,_0x5e9728){return db['CmHopperBlack'][_0x90d1('0x22')](_0x5f4412['body'],{'raw':_0x5f4412[_0x90d1('0x17')]?_0x5f4412[_0x90d1('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f4412['options']?_0x5f4412[_0x90d1('0x17')]['where']||null:null,'attributes':_0x5f4412['options']?_0x5f4412['options']['attributes']||null:null,'limit':_0x5f4412[_0x90d1('0x17')]?_0x5f4412['options']['limit']||null:null})[_0x90d1('0xb')](function(_0x2e648e){logger[_0x90d1('0x14')]('UpdateCmHopperBlack',_0x5f4412);logger['debug']('UpdateCmHopperBlack',_0x5f4412,JSON['stringify'](_0x2e648e));_0x7c002b(_0x2e648e);})['catch'](function(_0x190506){logger['error'](_0x90d1('0x21'),_0x190506[_0x90d1('0x13')],_0x5f4412);_0x5e9728(_0x1813f1[_0x90d1('0x11')](0x1f4,_0x190506[_0x90d1('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x57f799){var _0x229d00=this;return new Promise(function(_0x5c372f,_0x550593){return db[_0x90d1('0x23')][_0x90d1('0x24')]({'where':_0x57f799['options']?_0x57f799['options'][_0x90d1('0x19')]||null:null})[_0x90d1('0xb')](function(_0x1a56e2){logger[_0x90d1('0x14')](_0x90d1('0x25'),_0x57f799);logger[_0x90d1('0xe')](_0x90d1('0x25'),_0x57f799,JSON[_0x90d1('0x10')](_0x1a56e2));_0x5c372f(_0x1a56e2);})[_0x90d1('0x20')](function(_0x53b4be){logger[_0x90d1('0x11')]('DestroyCmHopperBlack',_0x53b4be[_0x90d1('0x13')],_0x57f799);_0x550593(_0x229d00[_0x90d1('0x11')](0x1f4,_0x53b4be[_0x90d1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 1b8e8a4..e8efaba 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 _0xa46e=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','/:id','update','destroy','multer','util'];(function(_0xcdf752,_0x51b609){var _0x21448e=function(_0xa516b4){while(--_0xa516b4){_0xcdf752['push'](_0xcdf752['shift']());}};_0x21448e(++_0x51b609);}(_0xa46e,0x8a));var _0xea46=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xa46e[_0x2b5513];return _0x578fd2;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require(_0xea46('0x3'));var router=express[_0xea46('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea46('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xea46('0x7')]('/',auth['isAuthenticated'](),controller[_0xea46('0x8')]);router[_0xea46('0x7')]('/describe',auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0x7')](_0xea46('0xb'),auth[_0xea46('0x9')](),controller['show']);router['put']('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xc')]);router['delete'](_0xea46('0xb'),auth[_0xea46('0x9')](),controller[_0xea46('0xd')]);module['exports']=router; \ No newline at end of file +var _0xe2fe=['/describe','describe','/:id','put','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')](_0xee2f('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 940643a..1068353 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 _0xb994=['setDataValue','followuptime','BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xb994,0x16e));var _0x4b99=function(_0x36bb53,_0x3174ff){_0x36bb53=_0x36bb53-0x0;var _0x2ca6e6=_0xb994[_0x36bb53];return _0x2ca6e6;};'use strict';var Sequelize=require(_0x4b99('0x0'));var moment=require(_0x4b99('0x1'));module[_0x4b99('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x4b99('0x3')]},'scheduledat':{'type':Sequelize[_0x4b99('0x4')]},'countbusyretry':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x4b99('0x3')]},'originatecalleridname':{'type':Sequelize[_0x4b99('0x3')]},'calleridnum':{'type':Sequelize[_0x4b99('0x3')]},'calleridname':{'type':Sequelize[_0x4b99('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x4b99('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x4b99('0x4')]},'endtime':{'type':Sequelize[_0x4b99('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4b99('0x3')]},'campaign':{'type':Sequelize[_0x4b99('0x3')]},'campaigntype':{'type':Sequelize[_0x4b99('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x4b99('0x3')]},'disposition':{'type':Sequelize[_0x4b99('0x3')]},'secondDisposition':{'type':Sequelize[_0x4b99('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4b99('0x3')]},'dispositionat':{'type':Sequelize[_0x4b99('0x4')],'set':function(_0x2d5034){var _0x5b1ac2=this[_0x4b99('0x6')](_0x4b99('0x7'));if(_0x5b1ac2&&_0x2d5034){this[_0x4b99('0x8')](_0x4b99('0x9'),moment(_0x2d5034)['diff'](moment(_0x5b1ac2),'seconds'));}}},'amd':{'type':Sequelize[_0x4b99('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4b99('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x4b99('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x4b99('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x4b99('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4b99('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x4b99('0x4')]},'recallme':{'type':Sequelize[_0x4b99('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4b99('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdb62=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','seconds','BOOLEAN','moment'];(function(_0x2f1b7c,_0x452cc2){var _0x1414c5=function(_0x2d3caf){while(--_0x2d3caf){_0x2f1b7c['push'](_0x2f1b7c['shift']());}};_0x1414c5(++_0x452cc2);}(_0xdb62,0x196));var _0x2db6=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0xdb62[_0x5c6244];return _0x5800ce;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2db6('0x0'));module[_0x2db6('0x1')]={'state':{'type':Sequelize[_0x2db6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x2db6('0x3')]},'scheduledat':{'type':Sequelize[_0x2db6('0x4')]},'countbusyretry':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x2db6('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x2db6('0x4')]},'responsetime':{'type':Sequelize[_0x2db6('0x4')]},'answertime':{'type':Sequelize[_0x2db6('0x4')]},'droptime':{'type':Sequelize[_0x2db6('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2db6('0x3')]},'campaign':{'type':Sequelize[_0x2db6('0x3')]},'campaigntype':{'type':Sequelize[_0x2db6('0x3')]},'membername':{'type':Sequelize[_0x2db6('0x3')]},'reason':{'type':Sequelize[_0x2db6('0x3')]},'disposition':{'type':Sequelize[_0x2db6('0x3')]},'secondDisposition':{'type':Sequelize[_0x2db6('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2db6('0x3')]},'dispositionat':{'type':Sequelize[_0x2db6('0x4')],'set':function(_0x2fa7dc){var _0x55e617=this[_0x2db6('0x5')](_0x2db6('0x6'));if(_0x55e617&&_0x2fa7dc){this[_0x2db6('0x7')](_0x2db6('0x8'),moment(_0x2fa7dc)['diff'](moment(_0x55e617),_0x2db6('0x9')));}}},'amd':{'type':Sequelize[_0x2db6('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2db6('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2db6('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2db6('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x2db6('0x4')]},'callback':{'type':Sequelize[_0x2db6('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2db6('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2db6('0x4')]},'deleted':{'type':Sequelize[_0x2db6('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2db6('0x4')]},'recallme':{'type':Sequelize[_0x2db6('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2db6('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index e7551fb..ff3ad21 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 _0x6d38=['calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','filters','intersection','describe','catch','body','uniqueid','find','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','Campaign','cm_hopper','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state'];(function(_0x105d2c,_0x901fb4){var _0x3df304=function(_0xc9ac4d){while(--_0xc9ac4d){_0x105d2c['push'](_0x105d2c['shift']());}};_0x3df304(++_0x901fb4);}(_0x6d38,0x1ef));var _0x86d3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6d38[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['CmHopperFinal'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':!![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')]()['then'](respondWithResult(_0xd20863,null))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x3226b5,_0x14fa58){if(_0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')]){delete _0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')];}return db[_0x86d3('0x26')][_0x86d3('0x43')]({'where':{'uniqueid':_0x3226b5[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x14fa58,null))['then'](saveUpdates(_0x3226b5[_0x86d3('0x41')],null))[_0x86d3('0x20')](respondWithResult(_0x14fa58,null))['catch'](handleError(_0x14fa58,null));};exports[_0x86d3('0x45')]=function(_0x23a6ee,_0x197047,_0x2e9af5){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'VoiceQueueId':_0x23a6ee['params']['id']},'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x48')))),_0x86d3('0x49')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x4b')))),_0x86d3('0x4c')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal'](_0x86d3('0x4d')))),'busyContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x208,\x201,\x20null'))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x86d3('0x4f')))),'dropContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x197047,null))[_0x86d3('0x20')](respondWithResult(_0x197047,null))['catch'](handleError(_0x197047,null));};exports[_0x86d3('0x53')]=function(_0x416428,_0x15cdd0,_0x29bdee){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'CampaignId':_0x416428[_0x86d3('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x86d3('0x49')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4d')))),_0x86d3('0x54')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x55')))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x86d3('0x56')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x57')))),_0x86d3('0x58')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x15cdd0,null))[_0x86d3('0x20')](respondWithResult(_0x15cdd0,null))[_0x86d3('0x40')](handleError(_0x15cdd0,null));};exports[_0x86d3('0x59')]=function(_0x308fed,_0x1c966a,_0x379799){return db['VoiceQueue'][_0x86d3('0x43')]({'where':{'id':_0x308fed[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x1c966a,null))[_0x86d3('0x20')](function(_0x46e356){var _0x47f72e;if(_0x46e356){_0x47f72e=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')]('cm_hopper')[_0x86d3('0x5c')]([_0x86d3('0x5d'),_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x61'),_0x86d3('0x62'),_0x86d3('0x63')],squel[_0x86d3('0x64')]()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),'scheduledAt')[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))[_0x86d3('0x65')]('ANY_VALUE(ListId)',_0x86d3('0x60'))[_0x86d3('0x65')](_0x86d3('0x69'),_0x86d3('0x61'))['field']('NOW()',_0x86d3('0x62'))['field'](_0x86d3('0x67'),'updatedAt')['from'](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())['where'](_0x86d3('0x6d'),_0x308fed[_0x86d3('0x41')]['state'][_0x86d3('0x6c')]())[_0x86d3('0x32')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x86d3('0x32')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x86d3('0x64')]()['field']('phone')[_0x86d3('0x6e')]('cm_hopper')[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()[_0x86d3('0x65')]('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')][_0x86d3('0x2b')](_0x47f72e);}return[];})['then'](respondWithResult(_0x1c966a,null))[_0x86d3('0x40')](handleError(_0x1c966a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xca2e0,_0x596b1d,_0x5a22ca){return db[_0x86d3('0x72')][_0x86d3('0x43')]({'where':{'id':_0xca2e0['params']['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x596b1d,null))[_0x86d3('0x20')](function(_0x879a8b){var _0x1c1384;if(_0x879a8b){_0x1c1384=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')](_0x86d3('0x73'))['fromQuery'](['phone',_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x74'),_0x86d3('0x62'),_0x86d3('0x63')],squel['select']()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x5e'))[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))['field'](_0x86d3('0x75'),_0x86d3('0x60'))['field']('ANY_VALUE(CampaignId)',_0x86d3('0x74'))[_0x86d3('0x65')](_0x86d3('0x67'),'createdAt')[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x63'))[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x6d'),_0xca2e0[_0x86d3('0x41')][_0x86d3('0x77')]['toString']())[_0x86d3('0x32')](_0x86d3('0x78'))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field'](_0x86d3('0x5d'))[_0x86d3('0x6e')](_0x86d3('0x73'))[_0x86d3('0x32')](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field']('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')]['query'](_0x1c1384);}return[];})['then'](respondWithResult(_0x596b1d,null))['catch'](handleError(_0x596b1d,null));};exports['checkContactHopper']=function(_0xad83bf,_0x2514c1,_0x28a509){return db[_0x86d3('0x79')][_0x86d3('0x7a')]({'where':{'VoiceQueueId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x61')],'CampaignId':_0xad83bf['body'][_0x86d3('0x74')],'ContactId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x5f')]}})[_0x86d3('0x20')](handleEntityNotFound(_0x2514c1,null))['then'](function(_0xe239b5){if(_0xe239b5){return _0xe239b5;}return null;})['then'](respondWithResult(_0x2514c1,null))[_0x86d3('0x40')](handleError(_0x2514c1,null));}; \ No newline at end of file +var _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0x5d17,0x114));var _0x75d1=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0x5d17[_0x2af160];return _0x439d67;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index babb012..39d1342 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 _0x56ca=['exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','./cmHopperFinal.attributes'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0x56ca,0x164));var _0xa56c=function(_0x15f3b3,_0x45b4bf){_0x15f3b3=_0x15f3b3-0x0;var _0x346fa8=_0x56ca[_0x15f3b3];return _0x346fa8;};'use strict';var _=require(_0xa56c('0x0'));var util=require(_0xa56c('0x1'));var logger=require(_0xa56c('0x2'))(_0xa56c('0x3'));var moment=require(_0xa56c('0x4'));var BPromise=require('bluebird');var rp=require(_0xa56c('0x5'));var fs=require('fs');var path=require(_0xa56c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa56c('0x7'));module[_0xa56c('0x8')]=function(_0x36c0c2,_0x25acbe){return _0x36c0c2[_0xa56c('0x9')](_0xa56c('0xa'),attributes,{'tableName':_0xa56c('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xa56c('0xc')]},{'name':'uniqueid','fields':[_0xa56c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c02=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x1fbada,_0xe9e33c){var _0x38f519=function(_0x6c4d5c){while(--_0x6c4d5c){_0x1fbada['push'](_0x1fbada['shift']());}};_0x38f519(++_0xe9e33c);}(_0x3c02,0x75));var _0x23c0=function(_0x215902,_0x5e57a1){_0x215902=_0x215902-0x0;var _0x12f7fe=_0x3c02[_0x215902];return _0x12f7fe;};'use strict';var _=require('lodash');var util=require(_0x23c0('0x0'));var logger=require(_0x23c0('0x1'))('api');var moment=require(_0x23c0('0x2'));var BPromise=require('bluebird');var rp=require(_0x23c0('0x3'));var fs=require('fs');var path=require(_0x23c0('0x4'));var rimraf=require(_0x23c0('0x5'));var config=require(_0x23c0('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x23c0('0x7')]=function(_0x208422,_0x4af0f3){return _0x208422[_0x23c0('0x8')](_0x23c0('0x9'),attributes,{'tableName':_0x23c0('0xa'),'paranoid':![],'indexes':[{'name':_0x23c0('0xb'),'fields':[_0x23c0('0xb')]},{'name':_0x23c0('0xc'),'fields':[_0x23c0('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 2aeb7f3..31c4ea6 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2988bb,_0x4e4c36){var _0xc0046b=function(_0x48db26){while(--_0x48db26){_0x2988bb['push'](_0x2988bb['shift']());}};_0xc0046b(++_0x4e4c36);}(_0x7a54,0x106));var _0x47a5=function(_0x22b440,_0x51d358){_0x22b440=_0x22b440-0x0;var _0x1fd4fb=_0x7a54[_0x22b440];return _0x1fd4fb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3bb775,_0x8ff869){var _0x3ece0c=function(_0x1f395f){while(--_0x1f395f){_0x3bb775['push'](_0x3bb775['shift']());}};_0x3ece0c(++_0x8ff869);}(_0x7a54,0x106));var _0x47a5=function(_0x38e2d8,_0xba513b){_0x38e2d8=_0x38e2d8-0x0;var _0x110d4d=_0x7a54[_0x38e2d8];return _0x110d4d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 72ae035..28047b1 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 _0x63d6=['show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1894fb,_0x221595){var _0x5ae526=function(_0x1bed91){while(--_0x1bed91){_0x1894fb['push'](_0x1894fb['shift']());}};_0x5ae526(++_0x221595);}(_0x63d6,0xae));var _0x663d=function(_0x51ca88,_0xba668){_0x51ca88=_0x51ca88-0x0;var _0x4bfd03=_0x63d6[_0x51ca88];return _0x4bfd03;};'use strict';var multer=require(_0x663d('0x0'));var util=require(_0x663d('0x1'));var path=require(_0x663d('0x2'));var timeout=require(_0x663d('0x3'));var express=require(_0x663d('0x4'));var router=express['Router']();var fs_extra=require(_0x663d('0x5'));var auth=require(_0x663d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x663d('0x7'));var controller=require(_0x663d('0x8'));router[_0x663d('0x9')]('/',auth[_0x663d('0xa')](),controller[_0x663d('0xb')]);router[_0x663d('0x9')](_0x663d('0xc'),auth['isAuthenticated'](),controller[_0x663d('0xd')]);router[_0x663d('0x9')](_0x663d('0xe'),auth[_0x663d('0xa')](),controller[_0x663d('0xf')]);router[_0x663d('0x9')](_0x663d('0x10'),auth[_0x663d('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x663d('0x11'),auth['isAuthenticated'](),controller[_0x663d('0x12')]);router[_0x663d('0x13')](_0x663d('0x14'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x663d('0x13')](_0x663d('0x15'),auth[_0x663d('0xa')](),controller[_0x663d('0x16')]);router[_0x663d('0x13')](_0x663d('0x17'),auth[_0x663d('0xa')](),controller[_0x663d('0x18')]);router[_0x663d('0x19')](_0x663d('0xe'),auth[_0x663d('0xa')](),controller[_0x663d('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xbd8e=['post','moveContactsIvrCampaignHopperFinal','put','update','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal'];(function(_0x444439,_0x250eaa){var _0xc5397e=function(_0x49f6ea){while(--_0x49f6ea){_0x444439['push'](_0x444439['shift']());}};_0xc5397e(++_0x250eaa);}(_0xbd8e,0x1b5));var _0xebd8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbd8e[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xebd8('0x0'));var util=require(_0xebd8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xebd8('0x2'));var router=express['Router']();var fs_extra=require(_0xebd8('0x3'));var auth=require(_0xebd8('0x4'));var interaction=require(_0xebd8('0x5'));var config=require(_0xebd8('0x6'));var controller=require(_0xebd8('0x7'));router['get']('/',auth[_0xebd8('0x8')](),controller[_0xebd8('0x9')]);router[_0xebd8('0xa')](_0xebd8('0xb'),auth[_0xebd8('0x8')](),controller['describe']);router[_0xebd8('0xa')](_0xebd8('0xc'),auth[_0xebd8('0x8')](),controller[_0xebd8('0xd')]);router['get']('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0xebd8('0xe')]);router[_0xebd8('0xa')](_0xebd8('0xf'),auth[_0xebd8('0x8')](),controller[_0xebd8('0x10')]);router['post'](_0xebd8('0x11'),auth['isAuthenticated'](),controller[_0xebd8('0x12')]);router[_0xebd8('0x13')]('/voice/campaign/moveContacts/:id',auth[_0xebd8('0x8')](),controller[_0xebd8('0x14')]);router[_0xebd8('0x13')]('/checkContactHopper',auth[_0xebd8('0x8')](),controller['checkContactHopper']);router[_0xebd8('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xebd8('0x16')]);module[_0xebd8('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 aea408d..4fe4696 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 _0x0966=['BOOLEAN','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x568764,_0x2cd535){var _0x2245a4=function(_0x554be0){while(--_0x554be0){_0x568764['push'](_0x568764['shift']());}};_0x2245a4(++_0x2cd535);}(_0x0966,0x9d));var _0x6096=function(_0x33156b,_0x42aaef){_0x33156b=_0x33156b-0x0;var _0x14ea8a=_0x0966[_0x33156b];return _0x14ea8a;};'use strict';var Sequelize=require(_0x6096('0x0'));module[_0x6096('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x6096('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6096('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x6096('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6096('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6096('0x4')]},'responsetime':{'type':Sequelize[_0x6096('0x4')]},'answertime':{'type':Sequelize[_0x6096('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6096('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6096('0x2')]},'campaign':{'type':Sequelize[_0x6096('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x6096('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6096('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6096('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x6096('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6096('0x4')]},'edited':{'type':Sequelize[_0x6096('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6096('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6096('0x2')]}}; \ No newline at end of file +var _0x72f6=['exports','INTEGER','DATE','STRING','BOOLEAN','sequelize'];(function(_0x68e023,_0xd94365){var _0x26e8fd=function(_0x529245){while(--_0x529245){_0x68e023['push'](_0x68e023['shift']());}};_0x26e8fd(++_0xd94365);}(_0x72f6,0x1a9));var _0x672f=function(_0x595afb,_0x3ef3ea){_0x595afb=_0x595afb-0x0;var _0xd535a=_0x72f6[_0x595afb];return _0xd535a;};'use strict';var Sequelize=require(_0x672f('0x0'));module[_0x672f('0x1')]={'state':{'type':Sequelize[_0x672f('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x672f('0x3')]},'countbusyretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x672f('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x672f('0x4')]},'originatecalleridname':{'type':Sequelize[_0x672f('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x672f('0x4')]},'starttime':{'type':Sequelize[_0x672f('0x3')]},'responsetime':{'type':Sequelize[_0x672f('0x3')]},'answertime':{'type':Sequelize[_0x672f('0x3')]},'droptime':{'type':Sequelize[_0x672f('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x672f('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x672f('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x672f('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x672f('0x3')]},'recallme':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x672f('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 4174902..a5b8e02 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 _0x41a5=['sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','CmHopperHistory','then','findAll','params','keys','includeAll','include','find','create','body','catch','describe','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/environment','../../config/license/util','../../mysqldb'];(function(_0x85b8b0,_0x4acd53){var _0x4675e4=function(_0x452a8f){while(--_0x452a8f){_0x85b8b0['push'](_0x85b8b0['shift']());}};_0x4675e4(++_0x4acd53);}(_0x41a5,0x1c4));var _0x541a=function(_0x886b04,_0x4598b3){_0x886b04=_0x886b04-0x0;var _0x18e6c2=_0x41a5[_0x886b04];return _0x18e6c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x541a('0x0'));var zipdir=require(_0x541a('0x1'));var jsonpatch=require(_0x541a('0x2'));var rp=require(_0x541a('0x3'));var moment=require(_0x541a('0x4'));var BPromise=require(_0x541a('0x5'));var Mustache=require(_0x541a('0x6'));var util=require('util');var path=require(_0x541a('0x7'));var sox=require(_0x541a('0x8'));var csv=require(_0x541a('0x9'));var ejs=require(_0x541a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x541a('0xb'));var squel=require(_0x541a('0xc'));var crypto=require(_0x541a('0xd'));var jsforce=require(_0x541a('0xe'));var deskjs=require(_0x541a('0xf'));var toCsv=require(_0x541a('0x9'));var querystring=require(_0x541a('0x10'));var Papa=require(_0x541a('0x11'));var Redis=require(_0x541a('0x12'));var authService=require(_0x541a('0x13'));var qs=require(_0x541a('0x14'));var as=require(_0x541a('0x15'));var hardwareService=require(_0x541a('0x16'));var logger=require(_0x541a('0x17'))(_0x541a('0x18'));var utils=require('../../config/utils');var config=require(_0x541a('0x19'));var licenseUtil=require(_0x541a('0x1a'));var db=require(_0x541a('0x1b'))['db'];function respondWithStatusCode(_0xde04bd,_0x4b41e4){_0x4b41e4=_0x4b41e4||0xcc;return function(_0x2fc620){if(_0x2fc620){return _0xde04bd[_0x541a('0x1c')](_0x4b41e4);}return _0xde04bd[_0x541a('0x1d')](_0x4b41e4)['end']();};}function respondWithResult(_0x4a6aae,_0x277c1c){_0x277c1c=_0x277c1c||0xc8;return function(_0x133fbd){if(_0x133fbd){return _0x4a6aae[_0x541a('0x1d')](_0x277c1c)[_0x541a('0x1e')](_0x133fbd);}};}function respondWithFilteredResult(_0x9f1736,_0xf8a482){return function(_0x3d53f6){if(_0x3d53f6){var _0x5e97c5=typeof _0xf8a482[_0x541a('0x1f')]===_0x541a('0x20')&&typeof _0xf8a482['limit']==='undefined';var _0x5aaf44=_0x3d53f6[_0x541a('0x21')];var _0x41c0af=_0x5e97c5?0x0:_0xf8a482[_0x541a('0x1f')];var _0x230320=_0x5e97c5?_0x3d53f6['count']:_0xf8a482[_0x541a('0x1f')]+_0xf8a482[_0x541a('0x22')];var _0x56af4b;if(_0x230320>=_0x5aaf44){_0x230320=_0x5aaf44;_0x56af4b=0xc8;}else{_0x56af4b=0xce;}_0x9f1736[_0x541a('0x1d')](_0x56af4b);return _0x9f1736[_0x541a('0x23')](_0x541a('0x24'),_0x41c0af+'-'+_0x230320+'/'+_0x5aaf44)[_0x541a('0x1e')](_0x3d53f6);}return null;};}function patchUpdates(_0x3d7c54){return function(_0x441533){try{jsonpatch[_0x541a('0x25')](_0x441533,_0x3d7c54,!![]);}catch(_0x2b21ed){return BPromise[_0x541a('0x26')](_0x2b21ed);}return _0x441533[_0x541a('0x27')]();};}function saveUpdates(_0x1880e4,_0x31e16b){return function(_0x3d821b){if(_0x3d821b){return _0x3d821b[_0x541a('0x28')](_0x1880e4)['then'](function(_0x3839dd){return _0x3839dd;});}return null;};}function removeEntity(_0x5ad3f2,_0x52ff47){return function(_0x2c48e4){if(_0x2c48e4){return _0x2c48e4[_0x541a('0x29')]()['then'](function(){_0x5ad3f2['status'](0xcc)[_0x541a('0x2a')]();});}};}function handleEntityNotFound(_0x331790,_0xf35646){return function(_0x47aec8){if(!_0x47aec8){_0x331790['sendStatus'](0x194);}return _0x47aec8;};}function handleError(_0x468720,_0x4be253){_0x4be253=_0x4be253||0x1f4;return function(_0x5d2b18){logger[_0x541a('0x2b')](_0x5d2b18[_0x541a('0x2c')]);if(_0x5d2b18[_0x541a('0x2d')]){delete _0x5d2b18['name'];}_0x468720[_0x541a('0x1d')](_0x4be253)[_0x541a('0x2e')](_0x5d2b18);};}exports[_0x541a('0x2f')]=function(_0x5f4aa0,_0x3aa3f0){var _0x59281b={},_0x3ca187={},_0xb9bb73={'count':0x0,'rows':[]};var _0xde6759=_[_0x541a('0x30')](db['CmHopperHistory'][_0x541a('0x31')],function(_0x4462fe){return{'name':_0x4462fe['fieldName'],'type':_0x4462fe[_0x541a('0x32')][_0x541a('0x33')]};});_0x3ca187[_0x541a('0x34')]=_[_0x541a('0x30')](_0xde6759,_0x541a('0x2d'));_0x3ca187[_0x541a('0x35')]=_['keys'](_0x5f4aa0['query']);_0x3ca187[_0x541a('0x36')]=_[_0x541a('0x37')](_0x3ca187[_0x541a('0x34')],_0x3ca187[_0x541a('0x35')]);_0x59281b[_0x541a('0x38')]=_[_0x541a('0x37')](_0x3ca187['model'],qs[_0x541a('0x39')](_0x5f4aa0[_0x541a('0x35')][_0x541a('0x39')]));_0x59281b[_0x541a('0x38')]=_0x59281b['attributes'][_0x541a('0x3a')]?_0x59281b[_0x541a('0x38')]:_0x3ca187[_0x541a('0x34')];if(!_0x5f4aa0[_0x541a('0x35')]['hasOwnProperty'](_0x541a('0x3b'))){_0x59281b[_0x541a('0x22')]=qs['limit'](_0x5f4aa0[_0x541a('0x35')]['limit']);_0x59281b[_0x541a('0x1f')]=qs[_0x541a('0x1f')](_0x5f4aa0[_0x541a('0x35')][_0x541a('0x1f')]);}_0x59281b[_0x541a('0x3c')]=qs[_0x541a('0x3d')](_0x5f4aa0[_0x541a('0x35')]['sort']);_0x59281b[_0x541a('0x3e')]=qs[_0x541a('0x36')](_[_0x541a('0x3f')](_0x5f4aa0['query'],_0x3ca187[_0x541a('0x36')]),_0xde6759);if(_0x5f4aa0[_0x541a('0x35')][_0x541a('0x40')]){_0x59281b[_0x541a('0x3e')]=_[_0x541a('0x41')](_0x59281b['where'],{'$or':_[_0x541a('0x30')](_0xde6759,function(_0x268c7f){if(_0x268c7f['type']!==_0x541a('0x42')){var _0x13aa2b={};_0x13aa2b[_0x268c7f['name']]={'$like':'%'+_0x5f4aa0[_0x541a('0x35')][_0x541a('0x40')]+'%'};return _0x13aa2b;}})});}_0x59281b=_[_0x541a('0x41')]({},_0x59281b,_0x5f4aa0['options']);var _0x5411f4={'where':_0x59281b[_0x541a('0x3e')]};return db[_0x541a('0x43')]['count'](_0x5411f4)[_0x541a('0x44')](function(_0x29f754){_0xb9bb73['count']=_0x29f754;if(_0x5f4aa0[_0x541a('0x35')]['includeAll']){_0x59281b['include']=[{'all':!![]}];}return db[_0x541a('0x43')][_0x541a('0x45')](_0x59281b);})[_0x541a('0x44')](function(_0x261a16){_0xb9bb73['rows']=_0x261a16;return _0xb9bb73;})[_0x541a('0x44')](respondWithFilteredResult(_0x3aa3f0,_0x59281b))['catch'](handleError(_0x3aa3f0,null));};exports['show']=function(_0x16c881,_0x371ce4){var _0x5a0a21={'raw':!![],'where':{'id':_0x16c881[_0x541a('0x46')]['id']}},_0x59e474={};_0x59e474[_0x541a('0x34')]=_[_0x541a('0x47')](db[_0x541a('0x43')]['rawAttributes']);_0x59e474[_0x541a('0x35')]=_[_0x541a('0x47')](_0x16c881[_0x541a('0x35')]);_0x59e474[_0x541a('0x36')]=_[_0x541a('0x37')](_0x59e474[_0x541a('0x34')],_0x59e474[_0x541a('0x35')]);_0x5a0a21['attributes']=_[_0x541a('0x37')](_0x59e474[_0x541a('0x34')],qs[_0x541a('0x39')](_0x16c881['query'][_0x541a('0x39')]));_0x5a0a21[_0x541a('0x38')]=_0x5a0a21[_0x541a('0x38')][_0x541a('0x3a')]?_0x5a0a21[_0x541a('0x38')]:_0x59e474[_0x541a('0x34')];if(_0x16c881[_0x541a('0x35')][_0x541a('0x48')]){_0x5a0a21[_0x541a('0x49')]=[{'all':!![]}];}_0x5a0a21=_[_0x541a('0x41')]({},_0x5a0a21,_0x16c881['options']);return db[_0x541a('0x43')][_0x541a('0x4a')](_0x5a0a21)[_0x541a('0x44')](handleEntityNotFound(_0x371ce4,null))[_0x541a('0x44')](respondWithResult(_0x371ce4,null))['catch'](handleError(_0x371ce4,null));};exports[_0x541a('0x4b')]=function(_0x38d46b,_0x1b4a55){return db[_0x541a('0x43')]['create'](_0x38d46b[_0x541a('0x4c')],{})[_0x541a('0x44')](respondWithResult(_0x1b4a55,0xc9))[_0x541a('0x4d')](handleError(_0x1b4a55,null));};exports[_0x541a('0x4e')]=function(_0x1cff5b,_0x18d732){return db[_0x541a('0x43')][_0x541a('0x4e')]()[_0x541a('0x44')](respondWithResult(_0x18d732,null))['catch'](handleError(_0x18d732,null));};exports[_0x541a('0x28')]=function(_0x4a9a5b,_0x1540c0){if(_0x4a9a5b['body'][_0x541a('0x4f')]){delete _0x4a9a5b[_0x541a('0x4c')][_0x541a('0x4f')];}return db['CmHopperHistory'][_0x541a('0x4a')]({'where':{'uniqueid':_0x4a9a5b[_0x541a('0x46')]['id']}})[_0x541a('0x44')](handleEntityNotFound(_0x1540c0,null))[_0x541a('0x44')](saveUpdates(_0x4a9a5b[_0x541a('0x4c')],null))['then'](respondWithResult(_0x1540c0,null))[_0x541a('0x4d')](handleError(_0x1540c0,null));}; \ No newline at end of file +var _0xb600=['rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','CmHopperHistory','includeAll','findAll','rows','catch','show','params','length','include','find','create','describe','body','uniqueid'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xb600,0x163));var _0x0b60=function(_0x60b4b5,_0x4b9f3c){_0x60b4b5=_0x60b4b5-0x0;var _0x5ce041=_0xb600[_0x60b4b5];return _0x5ce041;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b60('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b60('0x1'));var rp=require('request-promise');var moment=require(_0x0b60('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0b60('0x3'));var util=require(_0x0b60('0x4'));var path=require(_0x0b60('0x5'));var sox=require(_0x0b60('0x6'));var csv=require(_0x0b60('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b60('0x8'));var squel=require(_0x0b60('0x9'));var crypto=require(_0x0b60('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0b60('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b60('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0b60('0xd'));var as=require(_0x0b60('0xe'));var hardwareService=require(_0x0b60('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0b60('0x10'));var licenseUtil=require(_0x0b60('0x11'));var db=require(_0x0b60('0x12'))['db'];function respondWithStatusCode(_0x317c0a,_0x502c69){_0x502c69=_0x502c69||0xcc;return function(_0x544969){if(_0x544969){return _0x317c0a['sendStatus'](_0x502c69);}return _0x317c0a[_0x0b60('0x13')](_0x502c69)[_0x0b60('0x14')]();};}function respondWithResult(_0x58b759,_0xb64fff){_0xb64fff=_0xb64fff||0xc8;return function(_0x575e2e){if(_0x575e2e){return _0x58b759['status'](_0xb64fff)[_0x0b60('0x15')](_0x575e2e);}};}function respondWithFilteredResult(_0x26850c,_0x56eb5e){return function(_0x14cb20){if(_0x14cb20){var _0x13eb7b=typeof _0x56eb5e['offset']===_0x0b60('0x16')&&typeof _0x56eb5e[_0x0b60('0x17')]===_0x0b60('0x16');var _0x1d342a=_0x14cb20[_0x0b60('0x18')];var _0x38c6e5=_0x13eb7b?0x0:_0x56eb5e[_0x0b60('0x19')];var _0x4cf841=_0x13eb7b?_0x14cb20[_0x0b60('0x18')]:_0x56eb5e[_0x0b60('0x19')]+_0x56eb5e['limit'];var _0x5a84ff;if(_0x4cf841>=_0x1d342a){_0x4cf841=_0x1d342a;_0x5a84ff=0xc8;}else{_0x5a84ff=0xce;}_0x26850c[_0x0b60('0x13')](_0x5a84ff);return _0x26850c[_0x0b60('0x1a')](_0x0b60('0x1b'),_0x38c6e5+'-'+_0x4cf841+'/'+_0x1d342a)[_0x0b60('0x15')](_0x14cb20);}return null;};}function patchUpdates(_0x4b029b){return function(_0x4cb00a){try{jsonpatch['apply'](_0x4cb00a,_0x4b029b,!![]);}catch(_0x425556){return BPromise[_0x0b60('0x1c')](_0x425556);}return _0x4cb00a[_0x0b60('0x1d')]();};}function saveUpdates(_0x1d8897,_0x89b228){return function(_0x26eb14){if(_0x26eb14){return _0x26eb14[_0x0b60('0x1e')](_0x1d8897)[_0x0b60('0x1f')](function(_0x2a8f96){return _0x2a8f96;});}return null;};}function removeEntity(_0x4804a3,_0x447699){return function(_0x30d33c){if(_0x30d33c){return _0x30d33c['destroy']()[_0x0b60('0x1f')](function(){_0x4804a3[_0x0b60('0x13')](0xcc)[_0x0b60('0x14')]();});}};}function handleEntityNotFound(_0x5cb1ee,_0x3e9704){return function(_0x47efe5){if(!_0x47efe5){_0x5cb1ee['sendStatus'](0x194);}return _0x47efe5;};}function handleError(_0x48761a,_0x463435){_0x463435=_0x463435||0x1f4;return function(_0x43e983){logger[_0x0b60('0x20')](_0x43e983[_0x0b60('0x21')]);if(_0x43e983[_0x0b60('0x22')]){delete _0x43e983['name'];}_0x48761a['status'](_0x463435)['send'](_0x43e983);};}exports[_0x0b60('0x23')]=function(_0x42d626,_0x387aab){var _0x48f0f4={},_0x4bf5d6={},_0x28909d={'count':0x0,'rows':[]};var _0x5b2e65=_[_0x0b60('0x24')](db['CmHopperHistory'][_0x0b60('0x25')],function(_0x3d28e9){return{'name':_0x3d28e9[_0x0b60('0x26')],'type':_0x3d28e9[_0x0b60('0x27')][_0x0b60('0x28')]};});_0x4bf5d6[_0x0b60('0x29')]=_['map'](_0x5b2e65,_0x0b60('0x22'));_0x4bf5d6[_0x0b60('0x2a')]=_[_0x0b60('0x2b')](_0x42d626[_0x0b60('0x2a')]);_0x4bf5d6[_0x0b60('0x2c')]=_[_0x0b60('0x2d')](_0x4bf5d6[_0x0b60('0x29')],_0x4bf5d6['query']);_0x48f0f4[_0x0b60('0x2e')]=_[_0x0b60('0x2d')](_0x4bf5d6[_0x0b60('0x29')],qs[_0x0b60('0x2f')](_0x42d626[_0x0b60('0x2a')][_0x0b60('0x2f')]));_0x48f0f4['attributes']=_0x48f0f4['attributes']['length']?_0x48f0f4['attributes']:_0x4bf5d6[_0x0b60('0x29')];if(!_0x42d626['query'][_0x0b60('0x30')](_0x0b60('0x31'))){_0x48f0f4[_0x0b60('0x17')]=qs[_0x0b60('0x17')](_0x42d626['query'][_0x0b60('0x17')]);_0x48f0f4[_0x0b60('0x19')]=qs[_0x0b60('0x19')](_0x42d626[_0x0b60('0x2a')]['offset']);}_0x48f0f4['order']=qs[_0x0b60('0x32')](_0x42d626[_0x0b60('0x2a')][_0x0b60('0x32')]);_0x48f0f4['where']=qs[_0x0b60('0x2c')](_[_0x0b60('0x33')](_0x42d626['query'],_0x4bf5d6[_0x0b60('0x2c')]),_0x5b2e65);if(_0x42d626['query'][_0x0b60('0x34')]){_0x48f0f4[_0x0b60('0x35')]=_[_0x0b60('0x36')](_0x48f0f4[_0x0b60('0x35')],{'$or':_[_0x0b60('0x24')](_0x5b2e65,function(_0x208b4c){if(_0x208b4c[_0x0b60('0x27')]!==_0x0b60('0x37')){var _0x123d95={};_0x123d95[_0x208b4c[_0x0b60('0x22')]]={'$like':'%'+_0x42d626['query'][_0x0b60('0x34')]+'%'};return _0x123d95;}})});}_0x48f0f4=_[_0x0b60('0x36')]({},_0x48f0f4,_0x42d626[_0x0b60('0x38')]);var _0x3237d3={'where':_0x48f0f4[_0x0b60('0x35')]};return db[_0x0b60('0x39')][_0x0b60('0x18')](_0x3237d3)['then'](function(_0x27c102){_0x28909d['count']=_0x27c102;if(_0x42d626[_0x0b60('0x2a')][_0x0b60('0x3a')]){_0x48f0f4['include']=[{'all':!![]}];}return db[_0x0b60('0x39')][_0x0b60('0x3b')](_0x48f0f4);})[_0x0b60('0x1f')](function(_0x2960f8){_0x28909d[_0x0b60('0x3c')]=_0x2960f8;return _0x28909d;})['then'](respondWithFilteredResult(_0x387aab,_0x48f0f4))[_0x0b60('0x3d')](handleError(_0x387aab,null));};exports[_0x0b60('0x3e')]=function(_0x159012,_0x41a4c1){var _0x2ca641={'raw':!![],'where':{'id':_0x159012[_0x0b60('0x3f')]['id']}},_0x6dd1b2={};_0x6dd1b2[_0x0b60('0x29')]=_[_0x0b60('0x2b')](db[_0x0b60('0x39')][_0x0b60('0x25')]);_0x6dd1b2[_0x0b60('0x2a')]=_['keys'](_0x159012[_0x0b60('0x2a')]);_0x6dd1b2[_0x0b60('0x2c')]=_[_0x0b60('0x2d')](_0x6dd1b2[_0x0b60('0x29')],_0x6dd1b2[_0x0b60('0x2a')]);_0x2ca641[_0x0b60('0x2e')]=_['intersection'](_0x6dd1b2[_0x0b60('0x29')],qs[_0x0b60('0x2f')](_0x159012[_0x0b60('0x2a')][_0x0b60('0x2f')]));_0x2ca641['attributes']=_0x2ca641[_0x0b60('0x2e')][_0x0b60('0x40')]?_0x2ca641[_0x0b60('0x2e')]:_0x6dd1b2['model'];if(_0x159012[_0x0b60('0x2a')][_0x0b60('0x3a')]){_0x2ca641[_0x0b60('0x41')]=[{'all':!![]}];}_0x2ca641=_[_0x0b60('0x36')]({},_0x2ca641,_0x159012[_0x0b60('0x38')]);return db['CmHopperHistory'][_0x0b60('0x42')](_0x2ca641)[_0x0b60('0x1f')](handleEntityNotFound(_0x41a4c1,null))[_0x0b60('0x1f')](respondWithResult(_0x41a4c1,null))[_0x0b60('0x3d')](handleError(_0x41a4c1,null));};exports[_0x0b60('0x43')]=function(_0x3095c1,_0x4ce5ac){return db[_0x0b60('0x39')][_0x0b60('0x43')](_0x3095c1['body'],{})[_0x0b60('0x1f')](respondWithResult(_0x4ce5ac,0xc9))[_0x0b60('0x3d')](handleError(_0x4ce5ac,null));};exports[_0x0b60('0x44')]=function(_0x44717e,_0x4098ef){return db[_0x0b60('0x39')]['describe']()[_0x0b60('0x1f')](respondWithResult(_0x4098ef,null))[_0x0b60('0x3d')](handleError(_0x4098ef,null));};exports[_0x0b60('0x1e')]=function(_0x4794ca,_0x5223af){if(_0x4794ca[_0x0b60('0x45')][_0x0b60('0x46')]){delete _0x4794ca[_0x0b60('0x45')][_0x0b60('0x46')];}return db[_0x0b60('0x39')][_0x0b60('0x42')]({'where':{'uniqueid':_0x4794ca[_0x0b60('0x3f')]['id']}})[_0x0b60('0x1f')](handleEntityNotFound(_0x5223af,null))[_0x0b60('0x1f')](saveUpdates(_0x4794ca[_0x0b60('0x45')],null))[_0x0b60('0x1f')](respondWithResult(_0x5223af,null))['catch'](handleError(_0x5223af,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index bc7bfb4..a023553 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 _0x23db=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0x56773f,_0x7551bd){var _0x596e73=function(_0x15d824){while(--_0x15d824){_0x56773f['push'](_0x56773f['shift']());}};_0x596e73(++_0x7551bd);}(_0x23db,0x141));var _0xb23d=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x23db[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xb23d('0x0'));var util=require(_0xb23d('0x1'));var logger=require(_0xb23d('0x2'))(_0xb23d('0x3'));var moment=require(_0xb23d('0x4'));var BPromise=require(_0xb23d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb23d('0x6'));var config=require(_0xb23d('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0xb23d('0x8')]=function(_0x3a2ba6,_0x105811){return _0x3a2ba6[_0xb23d('0x9')](_0xb23d('0xa'),attributes,{'tableName':_0xb23d('0xb'),'paranoid':![],'indexes':[{'name':_0xb23d('0xc'),'fields':[_0xb23d('0xc')]},{'name':_0xb23d('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa817=['bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x488f80,_0x5d2b86){var _0xf7510d=function(_0x5cf346){while(--_0x5cf346){_0x488f80['push'](_0x488f80['shift']());}};_0xf7510d(++_0x5d2b86);}(_0xa817,0x7b));var _0x7a81=function(_0x2dc6e9,_0xfc0451){_0x2dc6e9=_0x2dc6e9-0x0;var _0x51003d=_0xa817[_0x2dc6e9];return _0x51003d;};'use strict';var _=require(_0x7a81('0x0'));var util=require(_0x7a81('0x1'));var logger=require(_0x7a81('0x2'))(_0x7a81('0x3'));var moment=require(_0x7a81('0x4'));var BPromise=require(_0x7a81('0x5'));var rp=require(_0x7a81('0x6'));var fs=require('fs');var path=require(_0x7a81('0x7'));var rimraf=require(_0x7a81('0x8'));var config=require('../../config/environment');var attributes=require(_0x7a81('0x9'));module[_0x7a81('0xa')]=function(_0x5bf69b,_0x2249d1){return _0x5bf69b[_0x7a81('0xb')](_0x7a81('0xc'),attributes,{'tableName':_0x7a81('0xd'),'paranoid':![],'indexes':[{'name':_0x7a81('0xe'),'fields':[_0x7a81('0xe')]},{'name':'uniqueid','fields':[_0x7a81('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 2d30200..f32f369 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 _0xde2c=['code','message','info','result','catch','CmHopperHistory','create','body','options','raw','stringify','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error'];(function(_0x16d130,_0x313337){var _0x3467a6=function(_0x3ebd6c){while(--_0x3ebd6c){_0x16d130['push'](_0x16d130['shift']());}};_0x3467a6(++_0x313337);}(_0xde2c,0x7f));var _0xcde2=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0xde2c[_0x4849f6];return _0x1a3dcd;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var moment=require(_0xcde2('0x2'));var BPromise=require(_0xcde2('0x3'));var rs=require(_0xcde2('0x4'));var fs=require('fs');var Redis=require(_0xcde2('0x5'));var db=require(_0xcde2('0x6'))['db'];var utils=require(_0xcde2('0x7'));var logger=require('../../config/logger')(_0xcde2('0x8'));var config=require(_0xcde2('0x9'));var jayson=require(_0xcde2('0xa'));var client=jayson[_0xcde2('0xb')][_0xcde2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53c558,_0x2b27ef,_0x385e83){return new BPromise(function(_0x9c7036,_0x544235){return client['request'](_0x53c558,_0x385e83)[_0xcde2('0xd')](function(_0x1c8b3c){logger['info'](_0xcde2('0xe'),_0x2b27ef,_0xcde2('0xf'));logger[_0xcde2('0x10')](_0xcde2('0x11'),_0x2b27ef,'request\x20sent',JSON['stringify'](_0x1c8b3c));if(_0x1c8b3c[_0xcde2('0x12')]){if(_0x1c8b3c[_0xcde2('0x12')][_0xcde2('0x13')]===0x1f4){logger[_0xcde2('0x12')](_0xcde2('0xe'),_0x2b27ef,_0x1c8b3c[_0xcde2('0x12')]['message']);return _0x544235(_0x1c8b3c[_0xcde2('0x12')]['message']);}logger[_0xcde2('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x2b27ef,_0x1c8b3c['error'][_0xcde2('0x14')]);return _0x9c7036(_0x1c8b3c[_0xcde2('0x12')][_0xcde2('0x14')]);}else{logger[_0xcde2('0x15')](_0xcde2('0xe'),_0x2b27ef,'request\x20sent');_0x9c7036(_0x1c8b3c[_0xcde2('0x16')]['message']);}})[_0xcde2('0x17')](function(_0x198840){logger[_0xcde2('0x12')](_0xcde2('0xe'),_0x2b27ef,_0x198840);_0x544235(_0x198840);});});}exports['CreateCmHopperHistory']=function(_0x4fd5aa){var _0x4fe586=this;return new Promise(function(_0x2b4468,_0x582e84){return db[_0xcde2('0x18')][_0xcde2('0x19')](_0x4fd5aa[_0xcde2('0x1a')],{'raw':_0x4fd5aa['options']?_0x4fd5aa[_0xcde2('0x1b')][_0xcde2('0x1c')]===undefined?!![]:![]:!![]})[_0xcde2('0xd')](function(_0x3c1d7e){logger[_0xcde2('0x15')]('CreateCmHopperHistory',_0x4fd5aa);logger['debug']('CreateCmHopperHistory',_0x4fd5aa,JSON[_0xcde2('0x1d')](_0x3c1d7e));_0x2b4468(_0x3c1d7e);})[_0xcde2('0x17')](function(_0x2c9562){logger[_0xcde2('0x12')](_0xcde2('0x1e'),_0x2c9562['message'],_0x4fd5aa);_0x582e84(_0x4fe586[_0xcde2('0x12')](0x1f4,_0x2c9562['message']));});});};exports[_0xcde2('0x1f')]=function(_0xb2123c){var _0x26d18e=this;return new Promise(function(_0x48b598,_0x593aa4){return db[_0xcde2('0x18')][_0xcde2('0x20')]({'raw':_0xb2123c[_0xcde2('0x1b')]?_0xb2123c[_0xcde2('0x1b')][_0xcde2('0x1c')]===undefined?!![]:![]:!![],'where':_0xb2123c['options']?_0xb2123c[_0xcde2('0x1b')][_0xcde2('0x21')]||null:null,'attributes':[[db[_0xcde2('0x22')]['fn']('COUNT',db[_0xcde2('0x22')][_0xcde2('0x23')]('id')),_0xcde2('0x24')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')]('`state`\x20=\x204,\x201,\x20null'))),_0xcde2('0x27')],[db['sequelize']['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')]['literal'](_0xcde2('0x28')))),_0xcde2('0x29')],[db['sequelize']['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')](_0xcde2('0x2a')))),_0xcde2('0x2b')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x2c'),db['sequelize']['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')](_0xcde2('0x2d')))),_0xcde2('0x2e')],[db['sequelize']['fn'](_0xcde2('0x2c'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xcde2('0x2f')]]})[_0xcde2('0xd')](function(_0x29e3e0){logger[_0xcde2('0x15')]('AvgHandleTime',_0xb2123c);logger[_0xcde2('0x10')](_0xcde2('0x1f'),_0xb2123c,JSON[_0xcde2('0x1d')](_0x29e3e0));_0x48b598(_0x29e3e0);})[_0xcde2('0x17')](function(_0x1646a6){logger['error'](_0xcde2('0x1f'),_0x1646a6[_0xcde2('0x14')],_0xb2123c);_0x593aa4(_0x26d18e[_0xcde2('0x12')](0x1f4,_0x1646a6[_0xcde2('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x542246){var _0x1fc8a6=this;return new Promise(function(_0x360247,_0x40e1e2){return db[_0xcde2('0x18')][_0xcde2('0x20')]({'raw':_0x542246[_0xcde2('0x1b')]?_0x542246[_0xcde2('0x1b')][_0xcde2('0x1c')]===undefined?!![]:![]:!![],'where':_0x542246[_0xcde2('0x1b')]?_0x542246['options'][_0xcde2('0x21')]||null:null,'attributes':[[_0xcde2('0x30'),_0xcde2('0x31')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db['sequelize']['fn']('IF',db['sequelize'][_0xcde2('0x26')](_0xcde2('0x32')))),_0xcde2('0x33')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xcde2('0x34')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')](_0xcde2('0x35')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0xcde2('0x25'),db['sequelize']['fn']('IF',db[_0xcde2('0x22')]['literal'](_0xcde2('0x36')))),_0xcde2('0x37')],[db[_0xcde2('0x22')]['fn']('COUNT',db[_0xcde2('0x22')]['fn']('IF',db['sequelize'][_0xcde2('0x26')](_0xcde2('0x38')))),_0xcde2('0x39')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db['sequelize']['literal'](_0xcde2('0x3a')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0xcde2('0x25'),db['sequelize']['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xcde2('0x3b')],[db['sequelize']['fn']('COUNT',db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')]['literal'](_0xcde2('0x3c')))),'outboundUnknownCallsDay'],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')]('`state`\x20=\x2013,\x201,\x20null'))),_0xcde2('0x3d')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db['sequelize']['literal'](_0xcde2('0x3e')))),'outboundOriginateFailureCallsDay'],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')](_0xcde2('0x3f')))),'outboundRejectCallsDay'],[db[_0xcde2('0x22')]['fn']('COUNT',db[_0xcde2('0x22')]['fn']('IF',db['sequelize'][_0xcde2('0x26')](_0xcde2('0x40')))),_0xcde2('0x41')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db['sequelize'][_0xcde2('0x26')]('`state`\x20=\x2020,\x201,\x20null'))),_0xcde2('0x42')],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')]['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')](_0xcde2('0x43')))),_0xcde2('0x44')]],'group':[_0xcde2('0x30')]})[_0xcde2('0xd')](function(_0x3c5a17){logger[_0xcde2('0x15')]('GetVoiceQueueHopperHistory',_0x542246);logger['debug']('GetVoiceQueueHopperHistory',_0x542246,JSON[_0xcde2('0x1d')](_0x3c5a17));_0x360247(_0x3c5a17);})['catch'](function(_0x1751dd){logger[_0xcde2('0x12')](_0xcde2('0x45'),_0x1751dd['message'],_0x542246);_0x40e1e2(_0x1fc8a6[_0xcde2('0x12')](0x1f4,_0x1751dd['message']));});});};exports[_0xcde2('0x46')]=function(_0x5585a9){var _0x1085d2=this;return new Promise(function(_0x10d6ab,_0x50d2bf){return db[_0xcde2('0x18')]['findAll']({'raw':_0x5585a9['options']?_0x5585a9[_0xcde2('0x1b')][_0xcde2('0x1c')]===undefined?!![]:![]:!![],'where':_0x5585a9[_0xcde2('0x1b')]?_0x5585a9[_0xcde2('0x1b')][_0xcde2('0x21')]||null:null,'attributes':[[_0xcde2('0x30'),'name'],[db[_0xcde2('0x22')]['fn'](_0xcde2('0x25'),db[_0xcde2('0x22')][_0xcde2('0x23')]('id')),_0xcde2('0x47')],[db[_0xcde2('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcde2('0x22')][_0xcde2('0x26')](_0xcde2('0x35')))),_0xcde2('0x48')]],'group':['campaign']})[_0xcde2('0xd')](function(_0x345210){logger[_0xcde2('0x15')](_0xcde2('0x46'),_0x5585a9);logger[_0xcde2('0x10')](_0xcde2('0x46'),_0x5585a9,JSON['stringify'](_0x345210));_0x10d6ab(_0x345210);})[_0xcde2('0x17')](function(_0x3b9e2d){logger['error'](_0xcde2('0x46'),_0x3b9e2d[_0xcde2('0x14')],_0x5585a9);_0x50d2bf(_0x1085d2[_0xcde2('0x12')](0x1f4,_0x3b9e2d[_0xcde2('0x14')]));});});}; \ No newline at end of file +var _0xcc73=['predictiveIntervalAvgTalktime','then','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','raw','stringify','AvgHandleTime','findAll','options','sequelize','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime'];(function(_0x46c638,_0x1193ad){var _0x24e55a=function(_0x4c129d){while(--_0x4c129d){_0x46c638['push'](_0x46c638['shift']());}};_0x24e55a(++_0x1193ad);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xcc73[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x3cc7('0x0'));var moment=require(_0x3cc7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3cc7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3cc7('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x3cc7('0x4'));var jayson=require(_0x3cc7('0x5'));var client=jayson[_0x3cc7('0x6')][_0x3cc7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x127590,_0x5604df,_0x416c48){return new BPromise(function(_0x37c184,_0x3f2dd7){return client[_0x3cc7('0x8')](_0x127590,_0x416c48)['then'](function(_0x2ff7ba){logger[_0x3cc7('0x9')](_0x3cc7('0xa'),_0x5604df,_0x3cc7('0xb'));logger[_0x3cc7('0xc')](_0x3cc7('0xd'),_0x5604df,_0x3cc7('0xb'),JSON['stringify'](_0x2ff7ba));if(_0x2ff7ba['error']){if(_0x2ff7ba[_0x3cc7('0xe')]['code']===0x1f4){logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);return _0x3f2dd7(_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);}logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);return _0x37c184(_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);}else{logger[_0x3cc7('0x9')](_0x3cc7('0xa'),_0x5604df,_0x3cc7('0xb'));_0x37c184(_0x2ff7ba[_0x3cc7('0x10')][_0x3cc7('0xf')]);}})[_0x3cc7('0x11')](function(_0x386a31){logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x386a31);_0x3f2dd7(_0x386a31);});});}exports[_0x3cc7('0x12')]=function(_0x2a4ddf){var _0xff4317=this;return new Promise(function(_0x118aa0,_0x2f196a){return db[_0x3cc7('0x13')][_0x3cc7('0x14')](_0x2a4ddf[_0x3cc7('0x15')],{'raw':_0x2a4ddf['options']?_0x2a4ddf['options'][_0x3cc7('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x41c9fb){logger[_0x3cc7('0x9')](_0x3cc7('0x12'),_0x2a4ddf);logger['debug']('CreateCmHopperHistory',_0x2a4ddf,JSON[_0x3cc7('0x17')](_0x41c9fb));_0x118aa0(_0x41c9fb);})[_0x3cc7('0x11')](function(_0x4d5b7f){logger[_0x3cc7('0xe')](_0x3cc7('0x12'),_0x4d5b7f['message'],_0x2a4ddf);_0x2f196a(_0xff4317[_0x3cc7('0xe')](0x1f4,_0x4d5b7f['message']));});});};exports[_0x3cc7('0x18')]=function(_0x50a8fb){var _0x1cfcee=this;return new Promise(function(_0x3b1fe6,_0x8f8709){return db[_0x3cc7('0x13')][_0x3cc7('0x19')]({'raw':_0x50a8fb[_0x3cc7('0x1a')]?_0x50a8fb['options'][_0x3cc7('0x16')]===undefined?!![]:![]:!![],'where':_0x50a8fb[_0x3cc7('0x1a')]?_0x50a8fb[_0x3cc7('0x1a')]['where']||null:null,'attributes':[[db[_0x3cc7('0x1b')]['fn']('COUNT',db['sequelize']['col']('id')),_0x3cc7('0x1c')],[db[_0x3cc7('0x1b')]['fn']('COUNT',db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x1e')))),_0x3cc7('0x1f')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x21')))),_0x3cc7('0x22')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db['sequelize'][_0x3cc7('0x1d')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0x3cc7('0x23'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x24')))),_0x3cc7('0x25')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x23'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x3cc7('0x26')]]})[_0x3cc7('0x27')](function(_0xba3c9a){logger['info']('AvgHandleTime',_0x50a8fb);logger[_0x3cc7('0xc')](_0x3cc7('0x18'),_0x50a8fb,JSON['stringify'](_0xba3c9a));_0x3b1fe6(_0xba3c9a);})[_0x3cc7('0x11')](function(_0x4b89af){logger[_0x3cc7('0xe')](_0x3cc7('0x18'),_0x4b89af['message'],_0x50a8fb);_0x8f8709(_0x1cfcee[_0x3cc7('0xe')](0x1f4,_0x4b89af[_0x3cc7('0xf')]));});});};exports[_0x3cc7('0x28')]=function(_0x17576b){var _0x428ad2=this;return new Promise(function(_0x1638c7,_0x5771c2){return db[_0x3cc7('0x13')][_0x3cc7('0x19')]({'raw':_0x17576b['options']?_0x17576b[_0x3cc7('0x1a')][_0x3cc7('0x16')]===undefined?!![]:![]:!![],'where':_0x17576b['options']?_0x17576b[_0x3cc7('0x1a')]['where']||null:null,'attributes':[[_0x3cc7('0x29'),_0x3cc7('0x2a')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x2b')))),_0x3cc7('0x2c')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db['sequelize'][_0x3cc7('0x1d')](_0x3cc7('0x2d')))),_0x3cc7('0x2e')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x1e')))),_0x3cc7('0x2f')],[db['sequelize']['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x30')))),_0x3cc7('0x31')],[db[_0x3cc7('0x1b')]['fn']('COUNT',db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x32')))),_0x3cc7('0x33')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db['sequelize'][_0x3cc7('0x1d')](_0x3cc7('0x34')))),'outboundDropCallsDayTimeout'],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x35')))),_0x3cc7('0x36')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x37')))),_0x3cc7('0x38')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db['sequelize']['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x39')))),_0x3cc7('0x3a')],[db['sequelize']['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db['sequelize'][_0x3cc7('0x1d')](_0x3cc7('0x3b')))),_0x3cc7('0x3c')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db['sequelize']['fn']('IF',db[_0x3cc7('0x1b')]['literal'](_0x3cc7('0x3d')))),_0x3cc7('0x3e')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db['sequelize'][_0x3cc7('0x1d')](_0x3cc7('0x3f')))),_0x3cc7('0x40')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db['sequelize']['fn']('IF',db[_0x3cc7('0x1b')][_0x3cc7('0x1d')](_0x3cc7('0x41')))),'outboundRejectCallsDay'],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db[_0x3cc7('0x1b')]['literal'](_0x3cc7('0x42')))),_0x3cc7('0x43')]],'group':[_0x3cc7('0x29')]})[_0x3cc7('0x27')](function(_0x326f92){logger[_0x3cc7('0x9')](_0x3cc7('0x28'),_0x17576b);logger[_0x3cc7('0xc')]('GetVoiceQueueHopperHistory',_0x17576b,JSON['stringify'](_0x326f92));_0x1638c7(_0x326f92);})['catch'](function(_0x15033f){logger['error'](_0x3cc7('0x28'),_0x15033f[_0x3cc7('0xf')],_0x17576b);_0x5771c2(_0x428ad2[_0x3cc7('0xe')](0x1f4,_0x15033f[_0x3cc7('0xf')]));});});};exports[_0x3cc7('0x44')]=function(_0x245ca0){var _0x21a7d0=this;return new Promise(function(_0x49bfa8,_0x1c7348){return db['CmHopperHistory']['findAll']({'raw':_0x245ca0[_0x3cc7('0x1a')]?_0x245ca0[_0x3cc7('0x1a')][_0x3cc7('0x16')]===undefined?!![]:![]:!![],'where':_0x245ca0['options']?_0x245ca0[_0x3cc7('0x1a')]['where']||null:null,'attributes':[['campaign',_0x3cc7('0x2a')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['col']('id')),_0x3cc7('0x45')],[db[_0x3cc7('0x1b')]['fn'](_0x3cc7('0x20'),db[_0x3cc7('0x1b')]['fn']('IF',db['sequelize'][_0x3cc7('0x1d')](_0x3cc7('0x1e')))),_0x3cc7('0x46')]],'group':[_0x3cc7('0x29')]})[_0x3cc7('0x27')](function(_0x2570ae){logger['info']('GetCampaignHopperHistory',_0x245ca0);logger[_0x3cc7('0xc')]('GetCampaignHopperHistory',_0x245ca0,JSON['stringify'](_0x2570ae));_0x49bfa8(_0x2570ae);})[_0x3cc7('0x11')](function(_0x30c69f){logger[_0x3cc7('0xe')](_0x3cc7('0x44'),_0x30c69f[_0x3cc7('0xf')],_0x245ca0);_0x1c7348(_0x21a7d0[_0x3cc7('0xe')](0x1f4,_0x30c69f[_0x3cc7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 046cc44..34ea395 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 _0xd677=['./cmHopperHistory.controller','get','isAuthenticated','index','describe','/:id','show','create','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd677,0xac));var _0x7d67=function(_0x2aead8,_0x13bd4a){_0x2aead8=_0x2aead8-0x0;var _0x291f35=_0xd677[_0x2aead8];return _0x291f35;};'use strict';var multer=require(_0x7d67('0x0'));var util=require(_0x7d67('0x1'));var path=require('path');var timeout=require(_0x7d67('0x2'));var express=require(_0x7d67('0x3'));var router=express[_0x7d67('0x4')]();var fs_extra=require(_0x7d67('0x5'));var auth=require(_0x7d67('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7d67('0x7'));var controller=require(_0x7d67('0x8'));router[_0x7d67('0x9')]('/',auth[_0x7d67('0xa')](),controller[_0x7d67('0xb')]);router[_0x7d67('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x7d67('0xc')]);router[_0x7d67('0x9')](_0x7d67('0xd'),auth[_0x7d67('0xa')](),controller[_0x7d67('0xe')]);router['post']('/',auth[_0x7d67('0xa')](),controller[_0x7d67('0xf')]);router['put'](_0x7d67('0xd'),auth[_0x7d67('0xa')](),controller[_0x7d67('0x10')]);module[_0x7d67('0x11')]=router; \ No newline at end of file +var _0x7aea=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5a3c30,_0x48f0db){var _0x93318e=function(_0xf4bd1a){while(--_0xf4bd1a){_0x5a3c30['push'](_0x5a3c30['shift']());}};_0x93318e(++_0x48f0db);}(_0x7aea,0x1f2));var _0xa7ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7aea[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa7ae('0x0'));var util=require(_0xa7ae('0x1'));var path=require(_0xa7ae('0x2'));var timeout=require(_0xa7ae('0x3'));var express=require(_0xa7ae('0x4'));var router=express[_0xa7ae('0x5')]();var fs_extra=require(_0xa7ae('0x6'));var auth=require(_0xa7ae('0x7'));var interaction=require(_0xa7ae('0x8'));var config=require(_0xa7ae('0x9'));var controller=require(_0xa7ae('0xa'));router[_0xa7ae('0xb')]('/',auth['isAuthenticated'](),controller[_0xa7ae('0xc')]);router[_0xa7ae('0xb')](_0xa7ae('0xd'),auth[_0xa7ae('0xe')](),controller[_0xa7ae('0xf')]);router['get'](_0xa7ae('0x10'),auth[_0xa7ae('0xe')](),controller[_0xa7ae('0x11')]);router[_0xa7ae('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa7ae('0x13')](_0xa7ae('0x10'),auth[_0xa7ae('0xe')](),controller['update']);module[_0xa7ae('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 4ad2841..448b827 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 _0x1de4=['sequelize','exports','STRING','name'];(function(_0x4ec846,_0x2adf8d){var _0x59a9f5=function(_0x15043a){while(--_0x15043a){_0x4ec846['push'](_0x4ec846['shift']());}};_0x59a9f5(++_0x2adf8d);}(_0x1de4,0x94));var _0x41de=function(_0x2c0b5c,_0x2de2b0){_0x2c0b5c=_0x2c0b5c-0x0;var _0x331c54=_0x1de4[_0x2c0b5c];return _0x331c54;};'use strict';var Sequelize=require(_0x41de('0x0'));module[_0x41de('0x1')]={'name':{'type':Sequelize[_0x41de('0x2')],'unique':_0x41de('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x41de('0x2')]}}; \ No newline at end of file +var _0x6f72=['exports','STRING','name'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6f72,0xae));var _0x26f7=function(_0x2e87aa,_0x553dcb){_0x2e87aa=_0x2e87aa-0x0;var _0x4b25=_0x6f72[_0x2e87aa];return _0x4b25;};'use strict';var Sequelize=require('sequelize');module[_0x26f7('0x0')]={'name':{'type':Sequelize[_0x26f7('0x1')],'unique':_0x26f7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x26f7('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index b54d555..fda4702 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 _0x1814=['redis','localhost','socket.io-emitter','./cmList.socket','register','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','get','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','CmList','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','ListId','getDispositions','findOne','hasOwnProperty','nolimit','Disposition','removeDispositions','ids','addContacts','CmContact','tags','join','each','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','description','CmContactId\x20=\x20c.id','description_additionalPhone_','push','toString','isEmpty','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','sequelize','transaction','TEXT','Sequelize','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','userCmList:save','removeAgents','isArray','userCmList:remove','User','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults'];(function(_0x55f6c6,_0xf65f12){var _0x46ed6c=function(_0x106ca5){while(--_0x106ca5){_0x55f6c6['push'](_0x55f6c6['shift']());}};_0x46ed6c(++_0xf65f12);}(_0x1814,0x139));var _0x4181=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1814[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4181('0x0'));var rimraf=require(_0x4181('0x1'));var zipdir=require(_0x4181('0x2'));var jsonpatch=require(_0x4181('0x3'));var rp=require(_0x4181('0x4'));var moment=require(_0x4181('0x5'));var BPromise=require(_0x4181('0x6'));var Mustache=require(_0x4181('0x7'));var util=require(_0x4181('0x8'));var path=require(_0x4181('0x9'));var sox=require(_0x4181('0xa'));var csv=require(_0x4181('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4181('0xc'));var _=require(_0x4181('0xd'));var squel=require('squel');var crypto=require(_0x4181('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4181('0xb'));var querystring=require(_0x4181('0xf'));var Papa=require('papaparse');var Redis=require(_0x4181('0x10'));var authService=require(_0x4181('0x11'));var qs=require(_0x4181('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4181('0x13'));var logger=require(_0x4181('0x14'))(_0x4181('0x15'));var utils=require(_0x4181('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4181('0x17'))['db'];var csv_results;config['redis']=_[_0x4181('0x18')](config[_0x4181('0x19')],{'host':_0x4181('0x1a'),'port':0x18eb});var socket=require(_0x4181('0x1b'))(new Redis(config[_0x4181('0x19')]));require(_0x4181('0x1c'))[_0x4181('0x1d')](socket);function respondWithStatusCode(_0x87d49d,_0x2b5370){_0x2b5370=_0x2b5370||0xcc;return function(_0x3450a2){if(_0x3450a2){return _0x87d49d['sendStatus'](_0x2b5370);}return _0x87d49d[_0x4181('0x1e')](_0x2b5370)[_0x4181('0x1f')]();};}function respondWithResult(_0x33da65,_0x1d6874){_0x1d6874=_0x1d6874||0xc8;return function(_0x34b2d5){if(_0x34b2d5){return _0x33da65['status'](_0x1d6874)[_0x4181('0x20')](_0x34b2d5);}};}function respondWithFilteredResult(_0x2c2c5b,_0x3b2c95){return function(_0x53b2b8){if(_0x53b2b8){var _0x20ee4f=typeof _0x3b2c95[_0x4181('0x21')]==='undefined'&&typeof _0x3b2c95[_0x4181('0x22')]===_0x4181('0x23');var _0x42b34f=_0x53b2b8['count'];var _0x5916cd=_0x20ee4f?0x0:_0x3b2c95[_0x4181('0x21')];var _0x230d74=_0x20ee4f?_0x53b2b8[_0x4181('0x24')]:_0x3b2c95['offset']+_0x3b2c95[_0x4181('0x22')];var _0x333719;if(_0x230d74>=_0x42b34f){_0x230d74=_0x42b34f;_0x333719=0xc8;}else{_0x333719=0xce;}_0x2c2c5b[_0x4181('0x1e')](_0x333719);return _0x2c2c5b[_0x4181('0x25')]('Content-Range',_0x5916cd+'-'+_0x230d74+'/'+_0x42b34f)[_0x4181('0x20')](_0x53b2b8);}return null;};}function patchUpdates(_0x5c2b47){return function(_0x356688){try{jsonpatch[_0x4181('0x26')](_0x356688,_0x5c2b47,!![]);}catch(_0x6d4f44){return BPromise[_0x4181('0x27')](_0x6d4f44);}return _0x356688['save']();};}function saveUpdates(_0x19ed5a,_0x1d18b3){return function(_0x1f6fea){if(_0x1f6fea){return _0x1f6fea[_0x4181('0x28')](_0x19ed5a)[_0x4181('0x29')](function(_0x157450){return _0x157450;});}return null;};}function removeEntity(_0x1d8bdd,_0x4e83dc){return function(_0x4c8e90){if(_0x4c8e90){return _0x4c8e90[_0x4181('0x2a')]()[_0x4181('0x29')](function(){var _0x4a9610=_0x4c8e90[_0x4181('0x2b')]({'plain':!![]});var _0x3f29f8=_0x4181('0x2c');return db[_0x4181('0x2d')][_0x4181('0x2a')]({'where':{'type':_0x3f29f8,'resourceId':_0x4a9610['id']}})['then'](function(){return _0x4c8e90;});})['then'](function(){_0x1d8bdd[_0x4181('0x1e')](0xcc)[_0x4181('0x1f')]();});}};}function handleEntityNotFound(_0x332dc9,_0x30c62e){return function(_0x100deb){if(!_0x100deb){_0x332dc9[_0x4181('0x2e')](0x194);}return _0x100deb;};}function handleError(_0x50b5d4,_0x360f71){_0x360f71=_0x360f71||0x1f4;return function(_0x5bfd0b){logger[_0x4181('0x2f')](_0x5bfd0b[_0x4181('0x30')]);if(_0x5bfd0b[_0x4181('0x31')]){delete _0x5bfd0b['name'];}_0x50b5d4['status'](_0x360f71)[_0x4181('0x32')](_0x5bfd0b);};}exports[_0x4181('0x33')]=function(_0xb935f0,_0x2a407f){var _0x44e07c={},_0x5aa375={},_0x426f2a={'count':0x0,'rows':[]};var _0x4bb5f0=_['map'](db[_0x4181('0x34')][_0x4181('0x35')],function(_0x4251bf){return{'name':_0x4251bf[_0x4181('0x36')],'type':_0x4251bf[_0x4181('0x37')][_0x4181('0x38')]};});_0x5aa375[_0x4181('0x39')]=_[_0x4181('0x3a')](_0x4bb5f0,_0x4181('0x31'));_0x5aa375[_0x4181('0x3b')]=_[_0x4181('0x3c')](_0xb935f0['query']);_0x5aa375[_0x4181('0x3d')]=_[_0x4181('0x3e')](_0x5aa375[_0x4181('0x39')],_0x5aa375[_0x4181('0x3b')]);_0x44e07c[_0x4181('0x3f')]=_[_0x4181('0x3e')](_0x5aa375[_0x4181('0x39')],qs[_0x4181('0x40')](_0xb935f0[_0x4181('0x3b')][_0x4181('0x40')]));_0x44e07c[_0x4181('0x3f')]=_0x44e07c[_0x4181('0x3f')][_0x4181('0x41')]?_0x44e07c[_0x4181('0x3f')]:_0x5aa375[_0x4181('0x39')];if(!_0xb935f0['query']['hasOwnProperty']('nolimit')){_0x44e07c[_0x4181('0x22')]=qs[_0x4181('0x22')](_0xb935f0[_0x4181('0x3b')][_0x4181('0x22')]);_0x44e07c['offset']=qs[_0x4181('0x21')](_0xb935f0['query']['offset']);}_0x44e07c[_0x4181('0x42')]=qs[_0x4181('0x43')](_0xb935f0[_0x4181('0x3b')]['sort']);_0x44e07c[_0x4181('0x44')]=qs[_0x4181('0x3d')](_[_0x4181('0x45')](_0xb935f0[_0x4181('0x3b')],_0x5aa375[_0x4181('0x3d')]),_0x4bb5f0);if(_0xb935f0[_0x4181('0x3b')][_0x4181('0x46')]){_0x44e07c['where']=_[_0x4181('0x47')](_0x44e07c[_0x4181('0x44')],{'$or':_[_0x4181('0x3a')](_0x4bb5f0,function(_0x1f9b68){if(_0x1f9b68['type']!==_0x4181('0x48')){var _0x3561ae={};_0x3561ae[_0x1f9b68[_0x4181('0x31')]]={'$like':'%'+_0xb935f0[_0x4181('0x3b')][_0x4181('0x46')]+'%'};return _0x3561ae;}})});}_0x44e07c=_[_0x4181('0x47')]({},_0x44e07c,_0xb935f0[_0x4181('0x49')]);var _0x3454b5={'where':_0x44e07c['where']};return db[_0x4181('0x34')][_0x4181('0x24')](_0x3454b5)[_0x4181('0x29')](function(_0x17548a){_0x426f2a[_0x4181('0x24')]=_0x17548a;if(_0xb935f0[_0x4181('0x3b')][_0x4181('0x4a')]){_0x44e07c[_0x4181('0x4b')]=[{'all':!![]}];}return db['CmList'][_0x4181('0x4c')](_0x44e07c);})[_0x4181('0x29')](function(_0x58bb14){_0x426f2a[_0x4181('0x4d')]=_0x58bb14;return _0x426f2a;})[_0x4181('0x29')](respondWithFilteredResult(_0x2a407f,_0x44e07c))[_0x4181('0x4e')](handleError(_0x2a407f,null));};exports[_0x4181('0x4f')]=function(_0x7129c0,_0x1f371e){var _0x2df8d7={'raw':![],'where':{'id':_0x7129c0['params']['id']}},_0x357cd1={};_0x357cd1['model']=_['keys'](db[_0x4181('0x34')][_0x4181('0x35')]);_0x357cd1[_0x4181('0x3b')]=_['keys'](_0x7129c0[_0x4181('0x3b')]);_0x357cd1[_0x4181('0x3d')]=_[_0x4181('0x3e')](_0x357cd1[_0x4181('0x39')],_0x357cd1[_0x4181('0x3b')]);_0x2df8d7[_0x4181('0x3f')]=_[_0x4181('0x3e')](_0x357cd1[_0x4181('0x39')],qs['fields'](_0x7129c0[_0x4181('0x3b')][_0x4181('0x40')]));_0x2df8d7[_0x4181('0x3f')]=_0x2df8d7[_0x4181('0x3f')][_0x4181('0x41')]?_0x2df8d7[_0x4181('0x3f')]:_0x357cd1[_0x4181('0x39')];if(_0x7129c0['query'][_0x4181('0x4a')]){_0x2df8d7[_0x4181('0x4b')]=[{'all':!![]}];}_0x2df8d7=_[_0x4181('0x47')]({},_0x2df8d7,_0x7129c0[_0x4181('0x49')]);return db[_0x4181('0x34')][_0x4181('0x50')](_0x2df8d7)['then'](handleEntityNotFound(_0x1f371e,null))[_0x4181('0x29')](respondWithResult(_0x1f371e,null))[_0x4181('0x4e')](handleError(_0x1f371e,null));};exports[_0x4181('0x51')]=function(_0x133262,_0x3bec8c){return db['CmList']['create'](_0x133262[_0x4181('0x52')],{})[_0x4181('0x29')](function(_0x39d096){var _0x49cf04=_0x133262[_0x4181('0x53')][_0x4181('0x2b')]({'plain':!![]});if(!_0x49cf04)throw new Error(_0x4181('0x54'));if(_0x49cf04[_0x4181('0x55')]===_0x4181('0x53')){var _0x54e8d9=_0x39d096[_0x4181('0x2b')]({'plain':!![]});var _0x19188b='Lists';return db[_0x4181('0x56')][_0x4181('0x50')]({'where':{'name':_0x19188b,'userProfileId':_0x49cf04[_0x4181('0x57')]},'raw':!![]})[_0x4181('0x29')](function(_0x594417){if(_0x594417&&_0x594417[_0x4181('0x58')]===0x0){return db[_0x4181('0x2d')]['create']({'name':_0x54e8d9[_0x4181('0x31')],'resourceId':_0x54e8d9['id'],'type':_0x594417[_0x4181('0x31')],'sectionId':_0x594417['id']},{})[_0x4181('0x29')](function(){return _0x39d096;});}else{return _0x39d096;}})[_0x4181('0x4e')](function(_0x17c80c){logger['error'](_0x4181('0x59'),_0x17c80c);throw _0x17c80c;});}return _0x39d096;})[_0x4181('0x29')](respondWithResult(_0x3bec8c,0xc9))[_0x4181('0x4e')](handleError(_0x3bec8c,null));};exports['update']=function(_0x4c5656,_0x23f1b5){if(_0x4c5656['body']['id']){delete _0x4c5656['body']['id'];}return db[_0x4181('0x34')][_0x4181('0x50')]({'where':{'id':_0x4c5656[_0x4181('0x5a')]['id']}})['then'](handleEntityNotFound(_0x23f1b5,null))[_0x4181('0x29')](saveUpdates(_0x4c5656[_0x4181('0x52')],null))[_0x4181('0x29')](respondWithResult(_0x23f1b5,null))[_0x4181('0x4e')](handleError(_0x23f1b5,null));};exports[_0x4181('0x2a')]=function(_0x4119ef,_0x416ab9){return db[_0x4181('0x34')]['find']({'where':{'id':_0x4119ef[_0x4181('0x5a')]['id']}})[_0x4181('0x29')](handleEntityNotFound(_0x416ab9,null))[_0x4181('0x29')](removeEntity(_0x416ab9,null))[_0x4181('0x4e')](handleError(_0x416ab9,null));};exports[_0x4181('0x5b')]=function(_0x45f96d,_0x4465a9){return db[_0x4181('0x34')]['describe']()[_0x4181('0x29')](respondWithResult(_0x4465a9,null))['catch'](handleError(_0x4465a9,null));};exports['addDisposition']=function(_0x2709a0,_0x97bd11,_0x3ce45e){if(_0x2709a0[_0x4181('0x52')]['id']){delete _0x2709a0[_0x4181('0x52')]['id'];}return db['CmList'][_0x4181('0x50')]({'where':{'id':_0x2709a0[_0x4181('0x5a')]['id']}})[_0x4181('0x29')](handleEntityNotFound(_0x97bd11,null))[_0x4181('0x29')](function(_0x3687ea){if(_0x3687ea){_0x2709a0[_0x4181('0x52')][_0x4181('0x5c')]=_0x3687ea['id'];return db['Disposition'][_0x4181('0x51')](_0x2709a0[_0x4181('0x52')]);}})['then'](respondWithResult(_0x97bd11,null))['catch'](handleError(_0x97bd11,null));};exports[_0x4181('0x5d')]=function(_0x8e6e63,_0x4eb102,_0x7ac12c){var _0x37a594={'raw':![],'where':{}};var _0x4d5e9c={};var _0x41f4c5={'count':0x0,'rows':[]};return db[_0x4181('0x34')][_0x4181('0x5e')]({'where':{'id':_0x8e6e63[_0x4181('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4eb102,null))[_0x4181('0x29')](function(_0xb8e1e5){if(_0xb8e1e5){_0x4d5e9c[_0x4181('0x39')]=_[_0x4181('0x3c')](db['Disposition'][_0x4181('0x35')]);_0x4d5e9c[_0x4181('0x3b')]=_[_0x4181('0x3c')](_0x8e6e63[_0x4181('0x3b')]);_0x4d5e9c[_0x4181('0x3d')]=_[_0x4181('0x3e')](_0x4d5e9c[_0x4181('0x39')],_0x4d5e9c[_0x4181('0x3b')]);_0x37a594[_0x4181('0x3f')]=_[_0x4181('0x3e')](_0x4d5e9c[_0x4181('0x39')],qs['fields'](_0x8e6e63[_0x4181('0x3b')][_0x4181('0x40')]));_0x37a594[_0x4181('0x3f')]=_0x37a594[_0x4181('0x3f')][_0x4181('0x41')]?_0x37a594[_0x4181('0x3f')]:_0x4d5e9c[_0x4181('0x39')];if(!_0x8e6e63[_0x4181('0x3b')][_0x4181('0x5f')](_0x4181('0x60'))){_0x37a594['limit']=qs[_0x4181('0x22')](_0x8e6e63[_0x4181('0x3b')]['limit']);_0x37a594[_0x4181('0x21')]=qs[_0x4181('0x21')](_0x8e6e63[_0x4181('0x3b')][_0x4181('0x21')]);}_0x37a594[_0x4181('0x42')]=qs['sort'](_0x8e6e63[_0x4181('0x3b')][_0x4181('0x43')]);_0x37a594['where']=qs[_0x4181('0x3d')](_[_0x4181('0x45')](_0x8e6e63[_0x4181('0x3b')],_0x4d5e9c[_0x4181('0x3d')]));_0x37a594[_0x4181('0x44')][_0x4181('0x5c')]=_0xb8e1e5['id'];if(_0x8e6e63['query'][_0x4181('0x46')]){_0x37a594[_0x4181('0x44')]=_[_0x4181('0x47')](_0x37a594[_0x4181('0x44')],{'$or':_[_0x4181('0x3a')](_0x37a594['attributes'],function(_0x76dbc9){var _0x149fdf={};_0x149fdf[_0x76dbc9]={'$like':'%'+_0x8e6e63[_0x4181('0x3b')][_0x4181('0x46')]+'%'};return _0x149fdf;})});}_0x37a594=_[_0x4181('0x47')]({},_0x37a594,_0x8e6e63[_0x4181('0x49')]);return db[_0x4181('0x61')]['count']({'where':_0x37a594['where']})[_0x4181('0x29')](function(_0x203fd9){_0x41f4c5['count']=_0x203fd9;if(_0x8e6e63[_0x4181('0x3b')][_0x4181('0x4a')]){_0x37a594[_0x4181('0x4b')]=[{'all':!![]}];}return db[_0x4181('0x61')]['findAll'](_0x37a594);})['then'](function(_0x3efaf5){_0x41f4c5[_0x4181('0x4d')]=_0x3efaf5;return _0x41f4c5;});}})[_0x4181('0x29')](respondWithFilteredResult(_0x4eb102,_0x37a594))[_0x4181('0x4e')](handleError(_0x4eb102,null));};exports['removeDispositions']=function(_0x372885,_0x4ed780,_0x4ec329){return db['CmList'][_0x4181('0x50')]({'where':{'id':_0x372885[_0x4181('0x5a')]['id']}})[_0x4181('0x29')](handleEntityNotFound(_0x4ed780,null))[_0x4181('0x29')](function(_0x31d6b4){if(_0x31d6b4){return _0x31d6b4[_0x4181('0x62')](_0x372885[_0x4181('0x3b')][_0x4181('0x63')]);}})[_0x4181('0x29')](respondWithStatusCode(_0x4ed780,null))[_0x4181('0x4e')](handleError(_0x4ed780,null));};exports[_0x4181('0x64')]=function(_0x3d21ce,_0x22afc5,_0x119f02){return db[_0x4181('0x34')]['find']({'where':{'id':_0x3d21ce[_0x4181('0x5a')]['id']}})[_0x4181('0x29')](handleEntityNotFound(_0x22afc5,null))[_0x4181('0x29')](function(_0x489e33){if(_0x489e33){var _0x4067ab=[];var _0x151c7e={'success':[],'errors':[]};return db[_0x4181('0x65')][_0x4181('0x5b')]()['then'](function(_0x537653){if(_0x3d21ce['body'][_0x4181('0x66')]&&_['isArray'](_0x3d21ce['body'][_0x4181('0x66')])){if(_0x3d21ce[_0x4181('0x52')][_0x4181('0x66')][_0x4181('0x41')]){_0x3d21ce['body'][_0x4181('0x66')]=_0x3d21ce[_0x4181('0x52')][_0x4181('0x66')][_0x4181('0x67')](';')+';';}else{_0x3d21ce['body'][_0x4181('0x66')]=null;}}else{_0x3d21ce[_0x4181('0x52')][_0x4181('0x66')]=null;}if(_0x3d21ce[_0x4181('0x52')]&&_['isArray'](_0x3d21ce[_0x4181('0x52')])){for(var _0x4ca343=0x0;_0x4ca343<_0x3d21ce[_0x4181('0x52')][_0x4181('0x41')];_0x4ca343+=0x1){_0x3d21ce[_0x4181('0x52')][_0x4ca343]['ListId']=_0x3d21ce[_0x4181('0x5a')]['id'];_0x4067ab['push'](_0x3d21ce[_0x4181('0x52')][_0x4ca343]);}return BPromise[_0x4181('0x68')](_0x4067ab,function(_0x49cfcf){return db[_0x4181('0x65')]['create'](_['omit'](_0x49cfcf,['ids','id'])||{},{'fields':_[_0x4181('0x3c')](_0x537653),'raw':!![]})[_0x4181('0x29')](function(_0x461668){_0x151c7e[_0x4181('0x69')]['push'](_0x461668[_0x4181('0x6a')]);})['catch'](function(_0x102357){_0x151c7e['errors']['push']({'data':_0x49cfcf,'error':_0x102357[_0x4181('0x6b')]});});})['then'](function(_0xdd08a){return _0x151c7e;})['catch'](function(_0x182e24){return _0x182e24;});}else{_0x22afc5[_0x4181('0x1e')](0x190)['json']({'message':_0x4181('0x6c')});}});}})['then'](respondWithResult(_0x22afc5,null))['catch'](handleError(_0x22afc5,null));};exports[_0x4181('0x6d')]=function(_0xf91dc8,_0xed0fcd,_0x5ae1b7){var _0x36c307;return db[_0x4181('0x34')][_0x4181('0x50')]({'where':{'id':_0xf91dc8[_0x4181('0x5a')]['id']},'include':[{'model':db[_0x4181('0x6e')],'as':_0x4181('0x6f')}]})[_0x4181('0x29')](handleEntityNotFound(_0xed0fcd,null))[_0x4181('0x29')](function(_0x1ccfe8){if(_0x1ccfe8){_0x36c307=_0x1ccfe8;return db[_0x4181('0x65')][_0x4181('0x35')];}})[_0x4181('0x29')](function(_0x495f6d){if(_0x495f6d){var _0x1cbf8a={};var _0x4fb74b={};_0x4fb74b[_0x4181('0x39')]=_[_0x4181('0x70')](_[_0x4181('0x3c')](_0x495f6d),_[_0x4181('0x3a')](_0x36c307[_0x4181('0x6f')],function(_0x588d0c){return util['format'](_0x4181('0x71'),_0x588d0c['id']);}));_0x4fb74b[_0x4181('0x3b')]=_[_0x4181('0x3c')](_0xf91dc8[_0x4181('0x3b')]);_0x4fb74b[_0x4181('0x3d')]=_[_0x4181('0x3e')](_0x4fb74b[_0x4181('0x39')],_0x4fb74b[_0x4181('0x3b')]);_0x1cbf8a['attributes']=_[_0x4181('0x3e')](_0x4fb74b[_0x4181('0x39')],qs['fields'](_0xf91dc8[_0x4181('0x3b')][_0x4181('0x40')]));_0x1cbf8a[_0x4181('0x3f')]=_0x1cbf8a['attributes']['length']?_0x1cbf8a[_0x4181('0x3f')]:_0x4fb74b[_0x4181('0x39')];if(!_0xf91dc8[_0x4181('0x3b')]['hasOwnProperty']('nolimit')){_0x1cbf8a[_0x4181('0x22')]=qs[_0x4181('0x22')](_0xf91dc8['query']['limit']);_0x1cbf8a[_0x4181('0x21')]=qs['offset'](_0xf91dc8[_0x4181('0x3b')][_0x4181('0x21')]);}_0x1cbf8a[_0x4181('0x42')]=qs[_0x4181('0x43')](_0xf91dc8[_0x4181('0x3b')]['sort']);_0x1cbf8a['where']=qs[_0x4181('0x3d')](_[_0x4181('0x45')](_0xf91dc8[_0x4181('0x3b')],_0x4fb74b[_0x4181('0x3d')]));_0x1cbf8a[_0x4181('0x72')]=!![];if(_0xf91dc8[_0x4181('0x3b')][_0x4181('0x46')]){_0x1cbf8a['where']=_['merge'](_0x1cbf8a[_0x4181('0x44')],{'$or':_['map'](_0x1cbf8a['attributes'],function(_0x2453af){var _0x304b79={};_0x304b79[_0x2453af]={'$like':'%'+_0xf91dc8[_0x4181('0x3b')][_0x4181('0x46')]+'%'};return _0x304b79;})});}_0x1cbf8a=_[_0x4181('0x47')]({},_0x1cbf8a,_0xf91dc8[_0x4181('0x49')]);return _0x36c307[_0x4181('0x6d')](_0x1cbf8a);}})[_0x4181('0x29')](respondWithResult(_0xed0fcd,null))['catch'](handleError(_0xed0fcd,null));};exports[_0x4181('0x73')]=function(_0x5db80c,_0x36eba6,_0x574a7f){var _0x1c2d07;var _0x5effb3;var _0x177a82;var _0x487046=_0x5db80c[_0x4181('0x5a')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0x4181('0x31')],'raw':!![],'order':[_0x4181('0x74')]})['then'](function(_0x484650){_0x1c2d07=_0x484650;var _0x1376c1=_[_0x4181('0x3c')](db['CmContact'][_0x4181('0x35')]);return db[_0x4181('0x6e')][_0x4181('0x4c')]({'raw':!![],'attributes':['id',_0x4181('0x75')]})[_0x4181('0x29')](function(_0x4167db){_0x5effb3=_0x4167db;var _0x4d4a0e=squel[_0x4181('0x76')]()['fields'](_0x1376c1)[_0x4181('0x77')](_0x4181('0x78'),'c')['where'](_0x4181('0x79'),_0x487046)[_0x4181('0x44')](_0x4181('0x7a'))[_0x4181('0x7b')]();for(var _0x17828e=0x0;_0x17828e<_0x5effb3[_0x4181('0x41')];_0x17828e++){_0x4d4a0e[_0x4181('0x7c')](_0x4181('0x7d')+_0x5effb3[_0x17828e]['id'],'customField_'+_0x5effb3[_0x17828e][_0x4181('0x75')]);}for(var _0x17828e=0x0;_0x17828e<_0x1c2d07[_0x4181('0x41')];_0x17828e++){_0x4d4a0e[_0x4181('0x7c')](squel[_0x4181('0x76')]()['field'](_0x4181('0x7e'))[_0x4181('0x77')](_0x4181('0x7f'))[_0x4181('0x44')](_0x4181('0x80'),_0x1c2d07[_0x17828e]['id'])[_0x4181('0x44')]('CmContactId\x20=\x20c.id'),'additionalPhone_'+_0x1c2d07[_0x17828e][_0x4181('0x31')]);_0x4d4a0e['field'](squel[_0x4181('0x76')]()[_0x4181('0x7c')](_0x4181('0x81'))[_0x4181('0x77')](_0x4181('0x7f'))['where'](_0x4181('0x80'),_0x1c2d07[_0x17828e]['id'])[_0x4181('0x44')](_0x4181('0x82')),_0x4181('0x83')+_0x1c2d07[_0x17828e][_0x4181('0x31')]);}var _0x876a76=[];_0x876a76[_0x4181('0x84')](_0x4d4a0e['toString']());BPromise['each'](_0x876a76,handleQuery)['then'](function(_0x1eaac6){handleQuery(_0x4d4a0e[_0x4181('0x85')]());var _0x30751f=csv_results[0x0];if(!_[_0x4181('0x86')](_0x30751f)){var _0x25e498=toCsv(_0x30751f);var _0xbdc758=Date['now']();fs[_0x4181('0x87')](util[_0x4181('0x88')](_0x4181('0x89'),_0x487046,_0xbdc758),_0x25e498);_0x36eba6[_0x4181('0x8a')](_0x4181('0x8b'),_0x4181('0x8c')+util['format']('list_%d_%s.csv',_0x487046,_0xbdc758));_0x36eba6[_0x4181('0x8a')](_0x4181('0x8d'),_0x4181('0x8e'));return _0x36eba6['download'](util[_0x4181('0x88')](_0x4181('0x89'),_0x487046,_0xbdc758));}else{return _0x36eba6[_0x4181('0x2e')](0xcc);}});});});};exports[_0x4181('0x8f')]=function(_0x70db5f,_0x5e4302,_0x13f9c6){var _0x1097de;delete _0x70db5f[_0x4181('0x52')]['id'];return db[_0x4181('0x34')][_0x4181('0x5e')]({'where':{'id':_0x70db5f[_0x4181('0x5a')]['id']}})[_0x4181('0x29')](handleEntityNotFound(_0x5e4302,null))[_0x4181('0x29')](function(_0x417d6e){if(_0x417d6e){return db[_0x4181('0x90')][_0x4181('0x91')](function(_0x3e416d){return db[_0x4181('0x6e')]['create'](_0x70db5f[_0x4181('0x52')],{'transaction':_0x3e416d})[_0x4181('0x29')](function(_0xf6b03c){_0x1097de=_0xf6b03c;return _0x417d6e['addCustomFields'](_0xf6b03c,{'transaction':_0x3e416d});})['then'](function(){var _0x195da4={'type':db['Sequelize'][_0x4181('0x92')],'transaction':_0x3e416d};switch(_0x70db5f[_0x4181('0x52')][_0x4181('0x37')]){case'text':_0x195da4[_0x4181('0x37')]=db[_0x4181('0x93')]['TEXT'];break;case _0x4181('0x94'):_0x195da4[_0x4181('0x37')]=db['Sequelize'][_0x4181('0x95')];break;case'switch':_0x195da4[_0x4181('0x37')]=db[_0x4181('0x93')][_0x4181('0x96')];_0x195da4[_0x4181('0x97')]=![];break;default:}return db[_0x4181('0x90')][_0x4181('0x98')][_0x4181('0x99')](_0x4181('0x78'),util[_0x4181('0x88')](_0x4181('0x9a'),_0x1097de['id']),_0x195da4);})[_0x4181('0x29')](function(){return _0x1097de;});});}})[_0x4181('0x29')](respondWithResult(_0x5e4302,null))[_0x4181('0x4e')](handleError(_0x5e4302,null));};exports[_0x4181('0x9b')]=function(_0x4e59df,_0x360163,_0x2b1b31){var _0xd926df={};var _0x21ce40={};var _0x219842;var _0x4ab1bf;return db[_0x4181('0x34')]['findOne']({'where':{'id':_0x4e59df[_0x4181('0x5a')]['id']}})['then'](handleEntityNotFound(_0x360163,null))[_0x4181('0x29')](function(_0x54a8ee){if(_0x54a8ee){_0x219842=_0x54a8ee;_0x21ce40[_0x4181('0x39')]=_[_0x4181('0x3c')](db[_0x4181('0x6e')][_0x4181('0x35')]);_0x21ce40[_0x4181('0x3b')]=_[_0x4181('0x3c')](_0x4e59df[_0x4181('0x3b')]);_0x21ce40['filters']=_[_0x4181('0x3e')](_0x21ce40[_0x4181('0x39')],_0x21ce40['query']);_0xd926df['attributes']=_[_0x4181('0x3e')](_0x21ce40['model'],qs[_0x4181('0x40')](_0x4e59df[_0x4181('0x3b')][_0x4181('0x40')]));_0xd926df[_0x4181('0x3f')]=_0xd926df['attributes']['length']?_0xd926df[_0x4181('0x3f')]:_0x21ce40['model'];_0xd926df['order']=qs['sort'](_0x4e59df[_0x4181('0x3b')][_0x4181('0x43')]);_0xd926df[_0x4181('0x44')]=qs['filters'](_[_0x4181('0x45')](_0x4e59df['query'],_0x21ce40[_0x4181('0x3d')]));_0xd926df['where']=_[_0x4181('0x47')](_0xd926df[_0x4181('0x44')],{'$or':[{'ListId':_0x54a8ee['id']},{'ListId':null}]});if(_0x4e59df[_0x4181('0x3b')][_0x4181('0x46')]){_0xd926df[_0x4181('0x44')]=_[_0x4181('0x47')](_0xd926df[_0x4181('0x44')],{'$or':_[_0x4181('0x3a')](_0xd926df['attributes'],function(_0x56390a){var _0x3b7c8e={};_0x3b7c8e[_0x56390a]={'$like':'%'+_0x4e59df[_0x4181('0x3b')][_0x4181('0x46')]+'%'};return _0x3b7c8e;})});}_0xd926df=_[_0x4181('0x47')]({},_0xd926df,_0x4e59df['options']);return db[_0x4181('0x6e')][_0x4181('0x9c')](_0xd926df);}})[_0x4181('0x29')](respondWithResult(_0x360163,null))[_0x4181('0x4e')](handleError(_0x360163,null));};exports[_0x4181('0x9d')]=function(_0x257469,_0xbb4ff){return db['CmCustomField']['findAndCountAll']({'where':{'ListId':null}})['then'](handleEntityNotFound(_0xbb4ff,null))[_0x4181('0x29')](function(_0x275d82){return _0x275d82;})[_0x4181('0x29')](respondWithResult(_0xbb4ff,null))[_0x4181('0x4e')](handleError(_0xbb4ff,null));};exports[_0x4181('0x9e')]=function(_0x8a71d6,_0x4163a1,_0x4a720c){return db[_0x4181('0x34')][_0x4181('0x50')]({'where':{'id':_0x8a71d6['params']['id']}})[_0x4181('0x29')](handleEntityNotFound(_0x4163a1,null))[_0x4181('0x29')](function(_0xe49bf2){if(_0xe49bf2){return _0xe49bf2['addAgents'](_0x8a71d6[_0x4181('0x52')][_0x4181('0x63')],_[_0x4181('0x9f')](_0x8a71d6[_0x4181('0x52')],[_0x4181('0x63'),'id'])||{})[_0x4181('0xa0')](function(_0x2fbfb4){for(var _0x26c7c8=0x0;_0x26c7c8<_0x8a71d6[_0x4181('0x52')][_0x4181('0x63')][_0x4181('0x41')];_0x26c7c8+=0x1){socket[_0x4181('0xa1')](_0x4181('0xa2'),{'UserId':Number(_0x8a71d6[_0x4181('0x52')][_0x4181('0x63')][_0x26c7c8]),'CmListId':Number(_0x8a71d6[_0x4181('0x5a')]['id'])});}return _0x2fbfb4;});}})['then'](respondWithResult(_0x4163a1,null))[_0x4181('0x4e')](handleError(_0x4163a1,null));};exports[_0x4181('0xa3')]=function(_0x1e383d,_0xf2fc65,_0x22aba5){return db['CmList'][_0x4181('0x50')]({'where':{'id':_0x1e383d['params']['id']}})['then'](handleEntityNotFound(_0xf2fc65,null))[_0x4181('0x29')](function(_0x39817d){if(_0x39817d){return _0x39817d[_0x4181('0xa3')](_0x1e383d[_0x4181('0x3b')][_0x4181('0x63')])['then'](function(){if(_[_0x4181('0xa4')](_0x1e383d[_0x4181('0x3b')][_0x4181('0x63')])){for(var _0x8d432f=0x0;_0x8d432f<_0x1e383d[_0x4181('0x3b')][_0x4181('0x63')][_0x4181('0x41')];_0x8d432f+=0x1){socket[_0x4181('0xa1')](_0x4181('0xa5'),{'UserId':Number(_0x1e383d[_0x4181('0x3b')]['ids'][_0x8d432f]),'CmListId':Number(_0x1e383d['params']['id'])});}}else{socket[_0x4181('0xa1')](_0x4181('0xa5'),{'UserId':Number(_0x1e383d[_0x4181('0x3b')][_0x4181('0x63')]),'CmListId':Number(_0x1e383d[_0x4181('0x5a')]['id'])});}});}})[_0x4181('0x29')](respondWithStatusCode(_0xf2fc65,null))[_0x4181('0x4e')](handleError(_0xf2fc65,null));};exports['getAgents']=function(_0x134d84,_0x3b5538,_0x2d5080){var _0x552cc8={};var _0x563fa1={};var _0xea8d8a;var _0x2519fd;return db[_0x4181('0x34')][_0x4181('0x5e')]({'where':{'id':_0x134d84[_0x4181('0x5a')]['id']}})[_0x4181('0x29')](handleEntityNotFound(_0x3b5538,null))['then'](function(_0x1e0c14){if(_0x1e0c14){_0xea8d8a=_0x1e0c14;_0x563fa1['model']=_[_0x4181('0x3c')](db[_0x4181('0xa6')][_0x4181('0x35')]);_0x563fa1['query']=_[_0x4181('0x3c')](_0x134d84['query']);_0x563fa1[_0x4181('0x3d')]=_[_0x4181('0x3e')](_0x563fa1[_0x4181('0x39')],_0x563fa1['query']);_0x552cc8[_0x4181('0x3f')]=_[_0x4181('0x3e')](_0x563fa1['model'],qs[_0x4181('0x40')](_0x134d84[_0x4181('0x3b')]['fields']));_0x552cc8['attributes']=_0x552cc8[_0x4181('0x3f')]['length']?_0x552cc8[_0x4181('0x3f')]:_0x563fa1[_0x4181('0x39')];_0x552cc8['order']=qs[_0x4181('0x43')](_0x134d84[_0x4181('0x3b')][_0x4181('0x43')]);_0x552cc8['where']=qs['filters'](_['pick'](_0x134d84['query'],_0x563fa1[_0x4181('0x3d')]));if(_0x134d84[_0x4181('0x3b')][_0x4181('0x46')]){_0x552cc8[_0x4181('0x44')]=_['merge'](_0x552cc8[_0x4181('0x44')],{'$or':_['map'](_0x552cc8['attributes'],function(_0x380301){var _0x4d63de={};_0x4d63de[_0x380301]={'$like':'%'+_0x134d84[_0x4181('0x3b')][_0x4181('0x46')]+'%'};return _0x4d63de;})});}_0x552cc8=_[_0x4181('0x47')]({},_0x552cc8,_0x134d84[_0x4181('0x49')]);return _0xea8d8a['getAgents'](_0x552cc8);}})[_0x4181('0x29')](function(_0x125a6e){if(_0x125a6e){_0x2519fd=_0x125a6e[_0x4181('0x41')];if(!_0x134d84[_0x4181('0x3b')][_0x4181('0x5f')](_0x4181('0x60'))){_0x552cc8[_0x4181('0x22')]=qs[_0x4181('0x22')](_0x134d84['query']['limit']);_0x552cc8[_0x4181('0x21')]=qs[_0x4181('0x21')](_0x134d84[_0x4181('0x3b')]['offset']);}return _0xea8d8a[_0x4181('0xa7')](_0x552cc8);}})[_0x4181('0x29')](function(_0x229736){if(_0x229736){return _0x229736?{'count':_0x2519fd,'rows':_0x229736}:null;}})[_0x4181('0x29')](respondWithResult(_0x3b5538,null))[_0x4181('0x4e')](handleError(_0x3b5538,null));};function handleQuery(_0x5367f6){logger[_0x4181('0xa8')](_0x5367f6);return db[_0x4181('0x90')][_0x4181('0x3b')](_0x5367f6)['spread'](function(_0x5aee82){csv_results[_0x4181('0x84')](_0x5aee82);})['catch'](function(_0x2a436a){logger[_0x4181('0x2f')](_0x2a436a[_0x4181('0x6b')]);});} \ No newline at end of file +var _0x8a85=['Content-disposition','attachment;\x20filename=','format','list_%d_%s.csv','Content-type','download','/tmp/list_%d_%s.csv','sequelize','addCustomFields','TEXT','type','text','Sequelize','INTEGER','switch','BOOLEAN','queryInterface','addColumn','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','message','rimraf','fast-json-patch','moment','mustache','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','CmList','rawAttributes','fieldName','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','findOne','ListId','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','omit','success','push','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','each','isEmpty','now','setHeader'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x8a85,0xc0));var _0x58a8=function(_0x287fae,_0x4b2676){_0x287fae=_0x287fae-0x0;var _0x469da0=_0x8a85[_0x287fae];return _0x469da0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x58a8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58a8('0x1'));var rp=require('request-promise');var moment=require(_0x58a8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x58a8('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x58a8('0x4'));var ejs=require(_0x58a8('0x5'));var fs=require('fs');var fs_extra=require(_0x58a8('0x6'));var _=require('lodash');var squel=require(_0x58a8('0x7'));var crypto=require('crypto');var jsforce=require(_0x58a8('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x58a8('0x4'));var querystring=require(_0x58a8('0x9'));var Papa=require(_0x58a8('0xa'));var Redis=require(_0x58a8('0xb'));var authService=require(_0x58a8('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x58a8('0xd'));var logger=require('../../config/logger')(_0x58a8('0xe'));var utils=require(_0x58a8('0xf'));var config=require(_0x58a8('0x10'));var licenseUtil=require(_0x58a8('0x11'));var db=require(_0x58a8('0x12'))['db'];var csv_results;config[_0x58a8('0x13')]=_[_0x58a8('0x14')](config[_0x58a8('0x13')],{'host':_0x58a8('0x15'),'port':0x18eb});var socket=require(_0x58a8('0x16'))(new Redis(config[_0x58a8('0x13')]));require(_0x58a8('0x17'))[_0x58a8('0x18')](socket);function respondWithStatusCode(_0x25d176,_0x4d48dc){_0x4d48dc=_0x4d48dc||0xcc;return function(_0x548d7e){if(_0x548d7e){return _0x25d176[_0x58a8('0x19')](_0x4d48dc);}return _0x25d176[_0x58a8('0x1a')](_0x4d48dc)[_0x58a8('0x1b')]();};}function respondWithResult(_0x136bc2,_0x1a796c){_0x1a796c=_0x1a796c||0xc8;return function(_0x22b786){if(_0x22b786){return _0x136bc2[_0x58a8('0x1a')](_0x1a796c)[_0x58a8('0x1c')](_0x22b786);}};}function respondWithFilteredResult(_0x25160e,_0x336397){return function(_0x29d9e5){if(_0x29d9e5){var _0x38b41d=typeof _0x336397[_0x58a8('0x1d')]===_0x58a8('0x1e')&&typeof _0x336397['limit']===_0x58a8('0x1e');var _0xc53867=_0x29d9e5[_0x58a8('0x1f')];var _0x1804b4=_0x38b41d?0x0:_0x336397['offset'];var _0x384e38=_0x38b41d?_0x29d9e5['count']:_0x336397[_0x58a8('0x1d')]+_0x336397[_0x58a8('0x20')];var _0x32dde6;if(_0x384e38>=_0xc53867){_0x384e38=_0xc53867;_0x32dde6=0xc8;}else{_0x32dde6=0xce;}_0x25160e[_0x58a8('0x1a')](_0x32dde6);return _0x25160e[_0x58a8('0x21')](_0x58a8('0x22'),_0x1804b4+'-'+_0x384e38+'/'+_0xc53867)['json'](_0x29d9e5);}return null;};}function patchUpdates(_0x25d596){return function(_0x245398){try{jsonpatch[_0x58a8('0x23')](_0x245398,_0x25d596,!![]);}catch(_0x357c18){return BPromise[_0x58a8('0x24')](_0x357c18);}return _0x245398['save']();};}function saveUpdates(_0x418fa5,_0x3cab49){return function(_0x439d8a){if(_0x439d8a){return _0x439d8a[_0x58a8('0x25')](_0x418fa5)[_0x58a8('0x26')](function(_0x3b3431){return _0x3b3431;});}return null;};}function removeEntity(_0x265e0d,_0x27b0ea){return function(_0x5302cd){if(_0x5302cd){return _0x5302cd[_0x58a8('0x27')]()[_0x58a8('0x26')](function(){var _0x5a962b=_0x5302cd[_0x58a8('0x28')]({'plain':!![]});var _0x546c87=_0x58a8('0x29');return db[_0x58a8('0x2a')][_0x58a8('0x27')]({'where':{'type':_0x546c87,'resourceId':_0x5a962b['id']}})[_0x58a8('0x26')](function(){return _0x5302cd;});})[_0x58a8('0x26')](function(){_0x265e0d['status'](0xcc)[_0x58a8('0x1b')]();});}};}function handleEntityNotFound(_0x45051e,_0x568fa2){return function(_0x2d202b){if(!_0x2d202b){_0x45051e[_0x58a8('0x19')](0x194);}return _0x2d202b;};}function handleError(_0x29ce75,_0x82a458){_0x82a458=_0x82a458||0x1f4;return function(_0x3d72bd){logger[_0x58a8('0x2b')](_0x3d72bd[_0x58a8('0x2c')]);if(_0x3d72bd['name']){delete _0x3d72bd[_0x58a8('0x2d')];}_0x29ce75['status'](_0x82a458)[_0x58a8('0x2e')](_0x3d72bd);};}exports[_0x58a8('0x2f')]=function(_0x5a06e6,_0x149361){var _0x2b40eb={},_0x848e71={},_0x33ad5a={'count':0x0,'rows':[]};var _0x379423=_['map'](db[_0x58a8('0x30')][_0x58a8('0x31')],function(_0x4f3f2e){return{'name':_0x4f3f2e[_0x58a8('0x32')],'type':_0x4f3f2e['type']['key']};});_0x848e71[_0x58a8('0x33')]=_[_0x58a8('0x34')](_0x379423,_0x58a8('0x2d'));_0x848e71['query']=_['keys'](_0x5a06e6[_0x58a8('0x35')]);_0x848e71[_0x58a8('0x36')]=_['intersection'](_0x848e71[_0x58a8('0x33')],_0x848e71[_0x58a8('0x35')]);_0x2b40eb['attributes']=_[_0x58a8('0x37')](_0x848e71[_0x58a8('0x33')],qs[_0x58a8('0x38')](_0x5a06e6[_0x58a8('0x35')][_0x58a8('0x38')]));_0x2b40eb[_0x58a8('0x39')]=_0x2b40eb['attributes'][_0x58a8('0x3a')]?_0x2b40eb['attributes']:_0x848e71[_0x58a8('0x33')];if(!_0x5a06e6['query'][_0x58a8('0x3b')](_0x58a8('0x3c'))){_0x2b40eb[_0x58a8('0x20')]=qs[_0x58a8('0x20')](_0x5a06e6[_0x58a8('0x35')][_0x58a8('0x20')]);_0x2b40eb[_0x58a8('0x1d')]=qs['offset'](_0x5a06e6[_0x58a8('0x35')]['offset']);}_0x2b40eb[_0x58a8('0x3d')]=qs[_0x58a8('0x3e')](_0x5a06e6[_0x58a8('0x35')][_0x58a8('0x3e')]);_0x2b40eb['where']=qs[_0x58a8('0x36')](_[_0x58a8('0x3f')](_0x5a06e6[_0x58a8('0x35')],_0x848e71[_0x58a8('0x36')]),_0x379423);if(_0x5a06e6[_0x58a8('0x35')][_0x58a8('0x40')]){_0x2b40eb[_0x58a8('0x41')]=_[_0x58a8('0x42')](_0x2b40eb[_0x58a8('0x41')],{'$or':_[_0x58a8('0x34')](_0x379423,function(_0xf60888){if(_0xf60888['type']!==_0x58a8('0x43')){var _0x4e26c2={};_0x4e26c2[_0xf60888[_0x58a8('0x2d')]]={'$like':'%'+_0x5a06e6[_0x58a8('0x35')]['filter']+'%'};return _0x4e26c2;}})});}_0x2b40eb=_[_0x58a8('0x42')]({},_0x2b40eb,_0x5a06e6['options']);var _0x634f98={'where':_0x2b40eb['where']};return db[_0x58a8('0x30')][_0x58a8('0x1f')](_0x634f98)[_0x58a8('0x26')](function(_0x12feac){_0x33ad5a[_0x58a8('0x1f')]=_0x12feac;if(_0x5a06e6[_0x58a8('0x35')][_0x58a8('0x44')]){_0x2b40eb[_0x58a8('0x45')]=[{'all':!![]}];}return db[_0x58a8('0x30')][_0x58a8('0x46')](_0x2b40eb);})[_0x58a8('0x26')](function(_0x5a54b4){_0x33ad5a[_0x58a8('0x47')]=_0x5a54b4;return _0x33ad5a;})['then'](respondWithFilteredResult(_0x149361,_0x2b40eb))[_0x58a8('0x48')](handleError(_0x149361,null));};exports[_0x58a8('0x49')]=function(_0x22ef34,_0x16b35c){var _0x5c1ec8={'raw':![],'where':{'id':_0x22ef34[_0x58a8('0x4a')]['id']}},_0x2dd926={};_0x2dd926[_0x58a8('0x33')]=_[_0x58a8('0x4b')](db[_0x58a8('0x30')][_0x58a8('0x31')]);_0x2dd926[_0x58a8('0x35')]=_[_0x58a8('0x4b')](_0x22ef34[_0x58a8('0x35')]);_0x2dd926[_0x58a8('0x36')]=_[_0x58a8('0x37')](_0x2dd926[_0x58a8('0x33')],_0x2dd926[_0x58a8('0x35')]);_0x5c1ec8[_0x58a8('0x39')]=_[_0x58a8('0x37')](_0x2dd926[_0x58a8('0x33')],qs[_0x58a8('0x38')](_0x22ef34[_0x58a8('0x35')][_0x58a8('0x38')]));_0x5c1ec8[_0x58a8('0x39')]=_0x5c1ec8[_0x58a8('0x39')][_0x58a8('0x3a')]?_0x5c1ec8[_0x58a8('0x39')]:_0x2dd926[_0x58a8('0x33')];if(_0x22ef34[_0x58a8('0x35')][_0x58a8('0x44')]){_0x5c1ec8[_0x58a8('0x45')]=[{'all':!![]}];}_0x5c1ec8=_[_0x58a8('0x42')]({},_0x5c1ec8,_0x22ef34[_0x58a8('0x4c')]);return db[_0x58a8('0x30')][_0x58a8('0x4d')](_0x5c1ec8)[_0x58a8('0x26')](handleEntityNotFound(_0x16b35c,null))[_0x58a8('0x26')](respondWithResult(_0x16b35c,null))[_0x58a8('0x48')](handleError(_0x16b35c,null));};exports[_0x58a8('0x4e')]=function(_0xb151c3,_0x31d843){return db['CmList']['create'](_0xb151c3['body'],{})[_0x58a8('0x26')](function(_0x5f4224){var _0x41662c=_0xb151c3[_0x58a8('0x4f')][_0x58a8('0x28')]({'plain':!![]});if(!_0x41662c)throw new Error(_0x58a8('0x50'));if(_0x41662c[_0x58a8('0x51')]===_0x58a8('0x4f')){var _0x265498=_0x5f4224[_0x58a8('0x28')]({'plain':!![]});var _0x541381=_0x58a8('0x29');return db['UserProfileSection'][_0x58a8('0x4d')]({'where':{'name':_0x541381,'userProfileId':_0x41662c[_0x58a8('0x52')]},'raw':!![]})[_0x58a8('0x26')](function(_0x46e9ee){if(_0x46e9ee&&_0x46e9ee[_0x58a8('0x53')]===0x0){return db[_0x58a8('0x2a')][_0x58a8('0x4e')]({'name':_0x265498['name'],'resourceId':_0x265498['id'],'type':_0x46e9ee[_0x58a8('0x2d')],'sectionId':_0x46e9ee['id']},{})['then'](function(){return _0x5f4224;});}else{return _0x5f4224;}})['catch'](function(_0x42705e){logger[_0x58a8('0x2b')](_0x58a8('0x54'),_0x42705e);throw _0x42705e;});}return _0x5f4224;})[_0x58a8('0x26')](respondWithResult(_0x31d843,0xc9))[_0x58a8('0x48')](handleError(_0x31d843,null));};exports[_0x58a8('0x25')]=function(_0x1eb978,_0x477dc9){if(_0x1eb978[_0x58a8('0x55')]['id']){delete _0x1eb978[_0x58a8('0x55')]['id'];}return db[_0x58a8('0x30')][_0x58a8('0x4d')]({'where':{'id':_0x1eb978[_0x58a8('0x4a')]['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x477dc9,null))['then'](saveUpdates(_0x1eb978['body'],null))['then'](respondWithResult(_0x477dc9,null))[_0x58a8('0x48')](handleError(_0x477dc9,null));};exports[_0x58a8('0x27')]=function(_0x528bb2,_0x17e78c){return db[_0x58a8('0x30')][_0x58a8('0x4d')]({'where':{'id':_0x528bb2[_0x58a8('0x4a')]['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x17e78c,null))['then'](removeEntity(_0x17e78c,null))['catch'](handleError(_0x17e78c,null));};exports[_0x58a8('0x56')]=function(_0x2c62fe,_0x1852f4){return db['CmList'][_0x58a8('0x56')]()[_0x58a8('0x26')](respondWithResult(_0x1852f4,null))[_0x58a8('0x48')](handleError(_0x1852f4,null));};exports[_0x58a8('0x57')]=function(_0x3e9961,_0xfc2f14,_0x27afd4){if(_0x3e9961[_0x58a8('0x55')]['id']){delete _0x3e9961[_0x58a8('0x55')]['id'];}return db[_0x58a8('0x30')][_0x58a8('0x4d')]({'where':{'id':_0x3e9961['params']['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0xfc2f14,null))[_0x58a8('0x26')](function(_0x11363e){if(_0x11363e){_0x3e9961[_0x58a8('0x55')]['ListId']=_0x11363e['id'];return db[_0x58a8('0x58')][_0x58a8('0x4e')](_0x3e9961[_0x58a8('0x55')]);}})['then'](respondWithResult(_0xfc2f14,null))['catch'](handleError(_0xfc2f14,null));};exports[_0x58a8('0x59')]=function(_0x3d7cde,_0x3fb2a6,_0x2b96eb){var _0x179a74={'raw':![],'where':{}};var _0x508f9c={};var _0xa8a254={'count':0x0,'rows':[]};return db[_0x58a8('0x30')][_0x58a8('0x5a')]({'where':{'id':_0x3d7cde['params']['id']}})['then'](handleEntityNotFound(_0x3fb2a6,null))[_0x58a8('0x26')](function(_0x4bf2c2){if(_0x4bf2c2){_0x508f9c[_0x58a8('0x33')]=_['keys'](db[_0x58a8('0x58')][_0x58a8('0x31')]);_0x508f9c[_0x58a8('0x35')]=_[_0x58a8('0x4b')](_0x3d7cde['query']);_0x508f9c[_0x58a8('0x36')]=_[_0x58a8('0x37')](_0x508f9c[_0x58a8('0x33')],_0x508f9c[_0x58a8('0x35')]);_0x179a74[_0x58a8('0x39')]=_[_0x58a8('0x37')](_0x508f9c[_0x58a8('0x33')],qs['fields'](_0x3d7cde[_0x58a8('0x35')]['fields']));_0x179a74[_0x58a8('0x39')]=_0x179a74[_0x58a8('0x39')]['length']?_0x179a74[_0x58a8('0x39')]:_0x508f9c[_0x58a8('0x33')];if(!_0x3d7cde[_0x58a8('0x35')][_0x58a8('0x3b')](_0x58a8('0x3c'))){_0x179a74[_0x58a8('0x20')]=qs[_0x58a8('0x20')](_0x3d7cde[_0x58a8('0x35')]['limit']);_0x179a74['offset']=qs['offset'](_0x3d7cde[_0x58a8('0x35')][_0x58a8('0x1d')]);}_0x179a74[_0x58a8('0x3d')]=qs[_0x58a8('0x3e')](_0x3d7cde[_0x58a8('0x35')][_0x58a8('0x3e')]);_0x179a74[_0x58a8('0x41')]=qs[_0x58a8('0x36')](_['pick'](_0x3d7cde[_0x58a8('0x35')],_0x508f9c['filters']));_0x179a74[_0x58a8('0x41')][_0x58a8('0x5b')]=_0x4bf2c2['id'];if(_0x3d7cde[_0x58a8('0x35')][_0x58a8('0x40')]){_0x179a74[_0x58a8('0x41')]=_[_0x58a8('0x42')](_0x179a74[_0x58a8('0x41')],{'$or':_[_0x58a8('0x34')](_0x179a74[_0x58a8('0x39')],function(_0x30b53f){var _0x3d7a59={};_0x3d7a59[_0x30b53f]={'$like':'%'+_0x3d7cde[_0x58a8('0x35')]['filter']+'%'};return _0x3d7a59;})});}_0x179a74=_['merge']({},_0x179a74,_0x3d7cde[_0x58a8('0x4c')]);return db[_0x58a8('0x58')][_0x58a8('0x1f')]({'where':_0x179a74[_0x58a8('0x41')]})[_0x58a8('0x26')](function(_0x29e527){_0xa8a254[_0x58a8('0x1f')]=_0x29e527;if(_0x3d7cde[_0x58a8('0x35')][_0x58a8('0x44')]){_0x179a74[_0x58a8('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x58a8('0x46')](_0x179a74);})[_0x58a8('0x26')](function(_0x544bfe){_0xa8a254[_0x58a8('0x47')]=_0x544bfe;return _0xa8a254;});}})[_0x58a8('0x26')](respondWithFilteredResult(_0x3fb2a6,_0x179a74))[_0x58a8('0x48')](handleError(_0x3fb2a6,null));};exports['removeDispositions']=function(_0xd6aa78,_0x11e10f,_0x5e9e76){return db['CmList'][_0x58a8('0x4d')]({'where':{'id':_0xd6aa78['params']['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x11e10f,null))[_0x58a8('0x26')](function(_0x51b80f){if(_0x51b80f){return _0x51b80f[_0x58a8('0x5c')](_0xd6aa78[_0x58a8('0x35')][_0x58a8('0x5d')]);}})[_0x58a8('0x26')](respondWithStatusCode(_0x11e10f,null))[_0x58a8('0x48')](handleError(_0x11e10f,null));};exports[_0x58a8('0x5e')]=function(_0x74d794,_0x39467e,_0xb1b536){return db['CmList'][_0x58a8('0x4d')]({'where':{'id':_0x74d794[_0x58a8('0x4a')]['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x39467e,null))[_0x58a8('0x26')](function(_0x475fce){if(_0x475fce){var _0x5979b0=[];var _0x4a5664={'success':[],'errors':[]};return db[_0x58a8('0x5f')][_0x58a8('0x56')]()['then'](function(_0x3b10a0){if(_0x74d794[_0x58a8('0x55')][_0x58a8('0x60')]&&_[_0x58a8('0x61')](_0x74d794[_0x58a8('0x55')][_0x58a8('0x60')])){if(_0x74d794[_0x58a8('0x55')][_0x58a8('0x60')][_0x58a8('0x3a')]){_0x74d794[_0x58a8('0x55')]['tags']=_0x74d794['body'][_0x58a8('0x60')][_0x58a8('0x62')](';')+';';}else{_0x74d794[_0x58a8('0x55')]['tags']=null;}}else{_0x74d794['body'][_0x58a8('0x60')]=null;}if(_0x74d794[_0x58a8('0x55')]&&_[_0x58a8('0x61')](_0x74d794[_0x58a8('0x55')])){for(var _0x3982a7=0x0;_0x3982a7<_0x74d794['body']['length'];_0x3982a7+=0x1){_0x74d794[_0x58a8('0x55')][_0x3982a7][_0x58a8('0x5b')]=_0x74d794[_0x58a8('0x4a')]['id'];_0x5979b0['push'](_0x74d794['body'][_0x3982a7]);}return BPromise['each'](_0x5979b0,function(_0x5c78f3){return db[_0x58a8('0x5f')][_0x58a8('0x4e')](_[_0x58a8('0x63')](_0x5c78f3,[_0x58a8('0x5d'),'id'])||{},{'fields':_[_0x58a8('0x4b')](_0x3b10a0),'raw':!![]})[_0x58a8('0x26')](function(_0x257843){_0x4a5664[_0x58a8('0x64')][_0x58a8('0x65')](_0x257843['dataValues']);})[_0x58a8('0x48')](function(_0x5e9fbb){_0x4a5664[_0x58a8('0x66')][_0x58a8('0x65')]({'data':_0x5c78f3,'error':_0x5e9fbb['message']});});})[_0x58a8('0x26')](function(_0x210af5){return _0x4a5664;})[_0x58a8('0x48')](function(_0x54c8e0){return _0x54c8e0;});}else{_0x39467e[_0x58a8('0x1a')](0x190)[_0x58a8('0x1c')]({'message':_0x58a8('0x67')});}});}})['then'](respondWithResult(_0x39467e,null))[_0x58a8('0x48')](handleError(_0x39467e,null));};exports[_0x58a8('0x68')]=function(_0x3fe5be,_0x1e6a87,_0x9423f6){var _0x4f6bce;return db[_0x58a8('0x30')][_0x58a8('0x4d')]({'where':{'id':_0x3fe5be[_0x58a8('0x4a')]['id']},'include':[{'model':db[_0x58a8('0x69')],'as':_0x58a8('0x6a')}]})['then'](handleEntityNotFound(_0x1e6a87,null))[_0x58a8('0x26')](function(_0x463e67){if(_0x463e67){_0x4f6bce=_0x463e67;return db[_0x58a8('0x5f')][_0x58a8('0x31')];}})[_0x58a8('0x26')](function(_0x58aac7){if(_0x58aac7){var _0x1be6e0={};var _0x2888bd={};_0x2888bd[_0x58a8('0x33')]=_[_0x58a8('0x6b')](_['keys'](_0x58aac7),_[_0x58a8('0x34')](_0x4f6bce[_0x58a8('0x6a')],function(_0x3d18ec){return util['format'](_0x58a8('0x6c'),_0x3d18ec['id']);}));_0x2888bd[_0x58a8('0x35')]=_[_0x58a8('0x4b')](_0x3fe5be['query']);_0x2888bd['filters']=_[_0x58a8('0x37')](_0x2888bd['model'],_0x2888bd[_0x58a8('0x35')]);_0x1be6e0[_0x58a8('0x39')]=_[_0x58a8('0x37')](_0x2888bd['model'],qs[_0x58a8('0x38')](_0x3fe5be[_0x58a8('0x35')]['fields']));_0x1be6e0[_0x58a8('0x39')]=_0x1be6e0[_0x58a8('0x39')][_0x58a8('0x3a')]?_0x1be6e0[_0x58a8('0x39')]:_0x2888bd[_0x58a8('0x33')];if(!_0x3fe5be['query'][_0x58a8('0x3b')](_0x58a8('0x3c'))){_0x1be6e0[_0x58a8('0x20')]=qs[_0x58a8('0x20')](_0x3fe5be[_0x58a8('0x35')][_0x58a8('0x20')]);_0x1be6e0[_0x58a8('0x1d')]=qs[_0x58a8('0x1d')](_0x3fe5be['query'][_0x58a8('0x1d')]);}_0x1be6e0['order']=qs[_0x58a8('0x3e')](_0x3fe5be[_0x58a8('0x35')][_0x58a8('0x3e')]);_0x1be6e0[_0x58a8('0x41')]=qs[_0x58a8('0x36')](_[_0x58a8('0x3f')](_0x3fe5be[_0x58a8('0x35')],_0x2888bd['filters']));_0x1be6e0[_0x58a8('0x6d')]=!![];if(_0x3fe5be[_0x58a8('0x35')][_0x58a8('0x40')]){_0x1be6e0['where']=_[_0x58a8('0x42')](_0x1be6e0['where'],{'$or':_[_0x58a8('0x34')](_0x1be6e0[_0x58a8('0x39')],function(_0x2dd6ea){var _0x196375={};_0x196375[_0x2dd6ea]={'$like':'%'+_0x3fe5be[_0x58a8('0x35')][_0x58a8('0x40')]+'%'};return _0x196375;})});}_0x1be6e0=_[_0x58a8('0x42')]({},_0x1be6e0,_0x3fe5be[_0x58a8('0x4c')]);return _0x4f6bce['getContacts'](_0x1be6e0);}})[_0x58a8('0x26')](respondWithResult(_0x1e6a87,null))[_0x58a8('0x48')](handleError(_0x1e6a87,null));};exports[_0x58a8('0x6e')]=function(_0x10a6d9,_0x1d7c32,_0x1637b0){var _0x5609f9;var _0x2b9817;var _0x4aaca3;var _0x7df0=_0x10a6d9[_0x58a8('0x4a')]['id'];csv_results=[];return db['ContactItemType'][_0x58a8('0x46')]({'attributes':['id',_0x58a8('0x2d')],'raw':!![],'order':[_0x58a8('0x6f')]})[_0x58a8('0x26')](function(_0xd90520){_0x5609f9=_0xd90520;var _0x587e2=_[_0x58a8('0x4b')](db['CmContact'][_0x58a8('0x31')]);return db[_0x58a8('0x69')][_0x58a8('0x46')]({'raw':!![],'attributes':['id',_0x58a8('0x70')]})[_0x58a8('0x26')](function(_0x4dc88f){_0x2b9817=_0x4dc88f;var _0x41a5bc=squel[_0x58a8('0x71')]()[_0x58a8('0x38')](_0x587e2)[_0x58a8('0x72')](_0x58a8('0x73'),'c')[_0x58a8('0x41')](_0x58a8('0x74'),_0x7df0)['where'](_0x58a8('0x75'))[_0x58a8('0x76')]();for(var _0x479089=0x0;_0x479089<_0x2b9817[_0x58a8('0x3a')];_0x479089++){_0x41a5bc[_0x58a8('0x77')](_0x58a8('0x78')+_0x2b9817[_0x479089]['id'],_0x58a8('0x79')+_0x2b9817[_0x479089][_0x58a8('0x70')]);}for(var _0x479089=0x0;_0x479089<_0x5609f9[_0x58a8('0x3a')];_0x479089++){_0x41a5bc['field'](squel['select']()[_0x58a8('0x77')]('item')[_0x58a8('0x72')]('cm_contact_has_items')[_0x58a8('0x41')](_0x58a8('0x7a'),_0x5609f9[_0x479089]['id'])['where'](_0x58a8('0x7b')),_0x58a8('0x7c')+_0x5609f9[_0x479089][_0x58a8('0x2d')]);_0x41a5bc[_0x58a8('0x77')](squel[_0x58a8('0x71')]()[_0x58a8('0x77')](_0x58a8('0x7d'))['from']('cm_contact_has_items')['where']('ItemTypeId\x20=\x20?',_0x5609f9[_0x479089]['id'])[_0x58a8('0x41')]('CmContactId\x20=\x20c.id'),_0x58a8('0x7e')+_0x5609f9[_0x479089][_0x58a8('0x2d')]);}var _0x23cd6d=[];_0x23cd6d[_0x58a8('0x65')](_0x41a5bc[_0x58a8('0x7f')]());BPromise[_0x58a8('0x80')](_0x23cd6d,handleQuery)[_0x58a8('0x26')](function(_0x3d6e1f){handleQuery(_0x41a5bc['toString']());var _0x2da963=csv_results[0x0];if(!_[_0x58a8('0x81')](_0x2da963)){var _0xe43d5=toCsv(_0x2da963);var _0x2b6885=Date[_0x58a8('0x82')]();fs['writeFileSync'](util['format']('/tmp/list_%d_%s.csv',_0x7df0,_0x2b6885),_0xe43d5);_0x1d7c32[_0x58a8('0x83')](_0x58a8('0x84'),_0x58a8('0x85')+util[_0x58a8('0x86')](_0x58a8('0x87'),_0x7df0,_0x2b6885));_0x1d7c32[_0x58a8('0x83')](_0x58a8('0x88'),'text/csv');return _0x1d7c32[_0x58a8('0x89')](util[_0x58a8('0x86')](_0x58a8('0x8a'),_0x7df0,_0x2b6885));}else{return _0x1d7c32['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x310e8f,_0x1dd1c3,_0x459eae){var _0x4dce0f;delete _0x310e8f['body']['id'];return db['CmList']['findOne']({'where':{'id':_0x310e8f[_0x58a8('0x4a')]['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x1dd1c3,null))[_0x58a8('0x26')](function(_0x3d9d66){if(_0x3d9d66){return db[_0x58a8('0x8b')]['transaction'](function(_0x35f523){return db[_0x58a8('0x69')][_0x58a8('0x4e')](_0x310e8f[_0x58a8('0x55')],{'transaction':_0x35f523})['then'](function(_0x2729f7){_0x4dce0f=_0x2729f7;return _0x3d9d66[_0x58a8('0x8c')](_0x2729f7,{'transaction':_0x35f523});})[_0x58a8('0x26')](function(){var _0x2137c8={'type':db['Sequelize'][_0x58a8('0x8d')],'transaction':_0x35f523};switch(_0x310e8f[_0x58a8('0x55')][_0x58a8('0x8e')]){case _0x58a8('0x8f'):_0x2137c8[_0x58a8('0x8e')]=db[_0x58a8('0x90')][_0x58a8('0x8d')];break;case'number':_0x2137c8[_0x58a8('0x8e')]=db['Sequelize'][_0x58a8('0x91')];break;case _0x58a8('0x92'):_0x2137c8[_0x58a8('0x8e')]=db[_0x58a8('0x90')][_0x58a8('0x93')];_0x2137c8['defaultValue']=![];break;default:}return db[_0x58a8('0x8b')][_0x58a8('0x94')][_0x58a8('0x95')]('cm_contacts',util[_0x58a8('0x86')]('cf_%s',_0x4dce0f['id']),_0x2137c8);})[_0x58a8('0x26')](function(){return _0x4dce0f;});});}})[_0x58a8('0x26')](respondWithResult(_0x1dd1c3,null))['catch'](handleError(_0x1dd1c3,null));};exports[_0x58a8('0x96')]=function(_0x2ae6e4,_0x176703,_0x18d3f8){var _0x320900={};var _0x3b9c50={};var _0x5890d8;var _0x5d8bcc;return db['CmList']['findOne']({'where':{'id':_0x2ae6e4[_0x58a8('0x4a')]['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x176703,null))[_0x58a8('0x26')](function(_0x74ef44){if(_0x74ef44){_0x5890d8=_0x74ef44;_0x3b9c50['model']=_['keys'](db['CmCustomField'][_0x58a8('0x31')]);_0x3b9c50[_0x58a8('0x35')]=_[_0x58a8('0x4b')](_0x2ae6e4['query']);_0x3b9c50[_0x58a8('0x36')]=_[_0x58a8('0x37')](_0x3b9c50['model'],_0x3b9c50[_0x58a8('0x35')]);_0x320900[_0x58a8('0x39')]=_[_0x58a8('0x37')](_0x3b9c50[_0x58a8('0x33')],qs['fields'](_0x2ae6e4[_0x58a8('0x35')][_0x58a8('0x38')]));_0x320900[_0x58a8('0x39')]=_0x320900[_0x58a8('0x39')]['length']?_0x320900[_0x58a8('0x39')]:_0x3b9c50[_0x58a8('0x33')];_0x320900[_0x58a8('0x3d')]=qs[_0x58a8('0x3e')](_0x2ae6e4['query'][_0x58a8('0x3e')]);_0x320900['where']=qs[_0x58a8('0x36')](_['pick'](_0x2ae6e4[_0x58a8('0x35')],_0x3b9c50[_0x58a8('0x36')]));_0x320900[_0x58a8('0x41')]=_[_0x58a8('0x42')](_0x320900['where'],{'$or':[{'ListId':_0x74ef44['id']},{'ListId':null}]});if(_0x2ae6e4[_0x58a8('0x35')][_0x58a8('0x40')]){_0x320900[_0x58a8('0x41')]=_[_0x58a8('0x42')](_0x320900[_0x58a8('0x41')],{'$or':_[_0x58a8('0x34')](_0x320900[_0x58a8('0x39')],function(_0x276539){var _0xc7eab4={};_0xc7eab4[_0x276539]={'$like':'%'+_0x2ae6e4[_0x58a8('0x35')][_0x58a8('0x40')]+'%'};return _0xc7eab4;})});}_0x320900=_[_0x58a8('0x42')]({},_0x320900,_0x2ae6e4[_0x58a8('0x4c')]);return db[_0x58a8('0x69')][_0x58a8('0x97')](_0x320900);}})[_0x58a8('0x26')](respondWithResult(_0x176703,null))[_0x58a8('0x48')](handleError(_0x176703,null));};exports['getGlobalCustomFields']=function(_0x281617,_0x40ef51){return db['CmCustomField'][_0x58a8('0x97')]({'where':{'ListId':null}})[_0x58a8('0x26')](handleEntityNotFound(_0x40ef51,null))['then'](function(_0xa248b6){return _0xa248b6;})[_0x58a8('0x26')](respondWithResult(_0x40ef51,null))[_0x58a8('0x48')](handleError(_0x40ef51,null));};exports[_0x58a8('0x98')]=function(_0x1ba579,_0x50fb2e,_0x28d1d3){return db[_0x58a8('0x30')][_0x58a8('0x4d')]({'where':{'id':_0x1ba579['params']['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x50fb2e,null))[_0x58a8('0x26')](function(_0x21b69b){if(_0x21b69b){return _0x21b69b['addAgents'](_0x1ba579[_0x58a8('0x55')][_0x58a8('0x5d')],_[_0x58a8('0x63')](_0x1ba579['body'],[_0x58a8('0x5d'),'id'])||{})[_0x58a8('0x99')](function(_0x540f27){for(var _0x4fe234=0x0;_0x4fe234<_0x1ba579[_0x58a8('0x55')][_0x58a8('0x5d')]['length'];_0x4fe234+=0x1){socket[_0x58a8('0x9a')](_0x58a8('0x9b'),{'UserId':Number(_0x1ba579[_0x58a8('0x55')]['ids'][_0x4fe234]),'CmListId':Number(_0x1ba579[_0x58a8('0x4a')]['id'])});}return _0x540f27;});}})['then'](respondWithResult(_0x50fb2e,null))[_0x58a8('0x48')](handleError(_0x50fb2e,null));};exports[_0x58a8('0x9c')]=function(_0x159229,_0x564c29,_0xa30ca4){return db['CmList'][_0x58a8('0x4d')]({'where':{'id':_0x159229['params']['id']}})['then'](handleEntityNotFound(_0x564c29,null))[_0x58a8('0x26')](function(_0x37a8d9){if(_0x37a8d9){return _0x37a8d9[_0x58a8('0x9c')](_0x159229[_0x58a8('0x35')][_0x58a8('0x5d')])[_0x58a8('0x26')](function(){if(_['isArray'](_0x159229[_0x58a8('0x35')][_0x58a8('0x5d')])){for(var _0x6d5dd9=0x0;_0x6d5dd9<_0x159229[_0x58a8('0x35')][_0x58a8('0x5d')][_0x58a8('0x3a')];_0x6d5dd9+=0x1){socket['emit'](_0x58a8('0x9d'),{'UserId':Number(_0x159229['query'][_0x58a8('0x5d')][_0x6d5dd9]),'CmListId':Number(_0x159229[_0x58a8('0x4a')]['id'])});}}else{socket[_0x58a8('0x9a')](_0x58a8('0x9d'),{'UserId':Number(_0x159229[_0x58a8('0x35')][_0x58a8('0x5d')]),'CmListId':Number(_0x159229[_0x58a8('0x4a')]['id'])});}});}})[_0x58a8('0x26')](respondWithStatusCode(_0x564c29,null))[_0x58a8('0x48')](handleError(_0x564c29,null));};exports[_0x58a8('0x9e')]=function(_0x16abf3,_0x25dd51,_0x4e04c6){var _0xec3bb2={};var _0x5a4233={};var _0xac0e19;var _0x39b9fe;return db['CmList'][_0x58a8('0x5a')]({'where':{'id':_0x16abf3[_0x58a8('0x4a')]['id']}})[_0x58a8('0x26')](handleEntityNotFound(_0x25dd51,null))[_0x58a8('0x26')](function(_0xde83c0){if(_0xde83c0){_0xac0e19=_0xde83c0;_0x5a4233[_0x58a8('0x33')]=_[_0x58a8('0x4b')](db[_0x58a8('0x9f')][_0x58a8('0x31')]);_0x5a4233[_0x58a8('0x35')]=_[_0x58a8('0x4b')](_0x16abf3['query']);_0x5a4233['filters']=_[_0x58a8('0x37')](_0x5a4233[_0x58a8('0x33')],_0x5a4233[_0x58a8('0x35')]);_0xec3bb2[_0x58a8('0x39')]=_[_0x58a8('0x37')](_0x5a4233[_0x58a8('0x33')],qs[_0x58a8('0x38')](_0x16abf3[_0x58a8('0x35')][_0x58a8('0x38')]));_0xec3bb2[_0x58a8('0x39')]=_0xec3bb2[_0x58a8('0x39')][_0x58a8('0x3a')]?_0xec3bb2[_0x58a8('0x39')]:_0x5a4233[_0x58a8('0x33')];_0xec3bb2['order']=qs[_0x58a8('0x3e')](_0x16abf3[_0x58a8('0x35')][_0x58a8('0x3e')]);_0xec3bb2[_0x58a8('0x41')]=qs['filters'](_[_0x58a8('0x3f')](_0x16abf3[_0x58a8('0x35')],_0x5a4233[_0x58a8('0x36')]));if(_0x16abf3[_0x58a8('0x35')][_0x58a8('0x40')]){_0xec3bb2[_0x58a8('0x41')]=_[_0x58a8('0x42')](_0xec3bb2[_0x58a8('0x41')],{'$or':_[_0x58a8('0x34')](_0xec3bb2[_0x58a8('0x39')],function(_0x18f2d0){var _0x1aec29={};_0x1aec29[_0x18f2d0]={'$like':'%'+_0x16abf3[_0x58a8('0x35')][_0x58a8('0x40')]+'%'};return _0x1aec29;})});}_0xec3bb2=_[_0x58a8('0x42')]({},_0xec3bb2,_0x16abf3[_0x58a8('0x4c')]);return _0xac0e19[_0x58a8('0x9e')](_0xec3bb2);}})[_0x58a8('0x26')](function(_0xb2520c){if(_0xb2520c){_0x39b9fe=_0xb2520c['length'];if(!_0x16abf3[_0x58a8('0x35')][_0x58a8('0x3b')]('nolimit')){_0xec3bb2[_0x58a8('0x20')]=qs[_0x58a8('0x20')](_0x16abf3[_0x58a8('0x35')]['limit']);_0xec3bb2[_0x58a8('0x1d')]=qs[_0x58a8('0x1d')](_0x16abf3['query'][_0x58a8('0x1d')]);}return _0xac0e19['getAgents'](_0xec3bb2);}})['then'](function(_0x3fc19d){if(_0x3fc19d){return _0x3fc19d?{'count':_0x39b9fe,'rows':_0x3fc19d}:null;}})['then'](respondWithResult(_0x25dd51,null))[_0x58a8('0x48')](handleError(_0x25dd51,null));};function handleQuery(_0x90db4b){logger[_0x58a8('0xa0')](_0x90db4b);return db[_0x58a8('0x8b')]['query'](_0x90db4b)['spread'](function(_0xbd55dd){csv_results[_0x58a8('0x65')](_0xbd55dd);})[_0x58a8('0x48')](function(_0x161781){logger[_0x58a8('0x2b')](_0x161781[_0x58a8('0xa1')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 8b5a5d4..f5de30b 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x4a4a08,_0x53088f){_0x4a4a08=_0x4a4a08-0x0;var _0x119551=_0xe14b[_0x4a4a08];return _0x119551;};'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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe14b,0x93));var _0xbe14=function(_0xa54b4a,_0x4f4480){_0xa54b4a=_0xa54b4a-0x0;var _0x4f48b0=_0xe14b[_0xa54b4a];return _0x4f48b0;};'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 diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 3cc3cff..73f50b1 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 _0xac4a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmList.attributes','define','cm_lists'];(function(_0x26ac67,_0x1f77bf){var _0x2d7f2e=function(_0x5b3768){while(--_0x5b3768){_0x26ac67['push'](_0x26ac67['shift']());}};_0x2d7f2e(++_0x1f77bf);}(_0xac4a,0x13f));var _0xaac4=function(_0xedaa6d,_0x110cea){_0xedaa6d=_0xedaa6d-0x0;var _0x5326fa=_0xac4a[_0xedaa6d];return _0x5326fa;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('CmList',attributes,{'tableName':_0xaac4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb821=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','../../config/logger','bluebird'];(function(_0x11995f,_0xded9a9){var _0x1e550a=function(_0x1bd645){while(--_0x1bd645){_0x11995f['push'](_0x11995f['shift']());}};_0x1e550a(++_0xded9a9);}(_0xb821,0xa7));var _0x1b82=function(_0x40abf4,_0x52f2c8){_0x40abf4=_0x40abf4-0x0;var _0x3c27cb=_0xb821[_0x40abf4];return _0x3c27cb;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'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 c8f5adc..f0da601 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 _0x4481=['http','redis','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x17e3c4,_0x821010){var _0x2211b9=function(_0x33ab42){while(--_0x33ab42){_0x17e3c4['push'](_0x17e3c4['shift']());}};_0x2211b9(++_0x821010);}(_0x4481,0x17d));var _0x1448=function(_0x26b4c4,_0x3822ca){_0x26b4c4=_0x26b4c4-0x0;var _0x2d22c7=_0x4481[_0x26b4c4];return _0x2d22c7;};'use strict';var _=require(_0x1448('0x0'));var util=require(_0x1448('0x1'));var moment=require(_0x1448('0x2'));var BPromise=require('bluebird');var rs=require(_0x1448('0x3'));var fs=require('fs');var Redis=require(_0x1448('0x4'));var db=require(_0x1448('0x5'))['db'];var utils=require(_0x1448('0x6'));var logger=require(_0x1448('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1448('0x8'));var client=jayson['client'][_0x1448('0x9')]({'port':0x232a});config[_0x1448('0xa')]=_['defaults'](config[_0x1448('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1448('0xb'))(new Redis(config[_0x1448('0xa')]));require(_0x1448('0xc'))[_0x1448('0xd')](socket);function respondWithRpcPromise(_0x56d3d2,_0x57eb1c,_0x4d2729){return new BPromise(function(_0x48f1b4,_0x356ae7){return client[_0x1448('0xe')](_0x56d3d2,_0x4d2729)[_0x1448('0xf')](function(_0x4f87a0){logger[_0x1448('0x10')](_0x1448('0x11'),_0x57eb1c,_0x1448('0x12'));logger[_0x1448('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x57eb1c,_0x1448('0x12'),JSON[_0x1448('0x14')](_0x4f87a0));if(_0x4f87a0[_0x1448('0x15')]){if(_0x4f87a0['error'][_0x1448('0x16')]===0x1f4){logger[_0x1448('0x15')](_0x1448('0x11'),_0x57eb1c,_0x4f87a0[_0x1448('0x15')][_0x1448('0x17')]);return _0x356ae7(_0x4f87a0[_0x1448('0x15')]['message']);}logger[_0x1448('0x15')](_0x1448('0x11'),_0x57eb1c,_0x4f87a0['error'][_0x1448('0x17')]);return _0x48f1b4(_0x4f87a0[_0x1448('0x15')][_0x1448('0x17')]);}else{logger['info'](_0x1448('0x11'),_0x57eb1c,_0x1448('0x12'));_0x48f1b4(_0x4f87a0[_0x1448('0x18')][_0x1448('0x17')]);}})[_0x1448('0x19')](function(_0x31ddbc){logger['error'](_0x1448('0x11'),_0x57eb1c,_0x31ddbc);_0x356ae7(_0x31ddbc);});});} \ No newline at end of file +var _0xae3e=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3346db,_0x58c6bf){var _0x3230d0=function(_0x4519e0){while(--_0x4519e0){_0x3346db['push'](_0x3346db['shift']());}};_0x3230d0(++_0x58c6bf);}(_0xae3e,0x71));var _0xeae3=function(_0x2f40b0,_0x40122e){_0x2f40b0=_0x2f40b0-0x0;var _0x5bc71b=_0xae3e[_0x2f40b0];return _0x5bc71b;};'use strict';var _=require(_0xeae3('0x0'));var util=require(_0xeae3('0x1'));var moment=require(_0xeae3('0x2'));var BPromise=require(_0xeae3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeae3('0x4'))['db'];var utils=require(_0xeae3('0x5'));var logger=require(_0xeae3('0x6'))(_0xeae3('0x7'));var config=require('../../config/environment');var jayson=require(_0xeae3('0x8'));var client=jayson[_0xeae3('0x9')][_0xeae3('0xa')]({'port':0x232a});config[_0xeae3('0xb')]=_[_0xeae3('0xc')](config[_0xeae3('0xb')],{'host':_0xeae3('0xd'),'port':0x18eb});var socket=require(_0xeae3('0xe'))(new Redis(config[_0xeae3('0xb')]));require('./cmList.socket')[_0xeae3('0xf')](socket);function respondWithRpcPromise(_0x651c2b,_0x14575c,_0x255bc0){return new BPromise(function(_0x9d87a0,_0x2dafb4){return client[_0xeae3('0x10')](_0x651c2b,_0x255bc0)['then'](function(_0x39e4d5){logger[_0xeae3('0x11')](_0xeae3('0x12'),_0x14575c,_0xeae3('0x13'));logger[_0xeae3('0x14')](_0xeae3('0x15'),_0x14575c,_0xeae3('0x13'),JSON[_0xeae3('0x16')](_0x39e4d5));if(_0x39e4d5['error']){if(_0x39e4d5[_0xeae3('0x17')][_0xeae3('0x18')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x14575c,_0x39e4d5[_0xeae3('0x17')][_0xeae3('0x19')]);return _0x2dafb4(_0x39e4d5[_0xeae3('0x17')][_0xeae3('0x19')]);}logger[_0xeae3('0x17')]('CmList,\x20%s,\x20%s',_0x14575c,_0x39e4d5['error'][_0xeae3('0x19')]);return _0x9d87a0(_0x39e4d5[_0xeae3('0x17')][_0xeae3('0x19')]);}else{logger[_0xeae3('0x11')]('CmList,\x20%s,\x20%s',_0x14575c,_0xeae3('0x13'));_0x9d87a0(_0x39e4d5[_0xeae3('0x1a')][_0xeae3('0x19')]);}})[_0xeae3('0x1b')](function(_0x46e7a5){logger[_0xeae3('0x17')](_0xeae3('0x12'),_0x14575c,_0x46e7a5);_0x2dafb4(_0x46e7a5);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 27e683e..f39529c 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 _0x5e9a=['removeListener','length','./cmList.events','save','remove','update','emit'];(function(_0x2abff3,_0x5c0302){var _0x5c5dc7=function(_0x451902){while(--_0x451902){_0x2abff3['push'](_0x2abff3['shift']());}};_0x5c5dc7(++_0x5c0302);}(_0x5e9a,0x160));var _0xa5e9=function(_0x2a5e24,_0x3dbc35){_0x2a5e24=_0x2a5e24-0x0;var _0x2b46b6=_0x5e9a[_0x2a5e24];return _0x2b46b6;};'use strict';var CmListEvents=require(_0xa5e9('0x0'));var events=[_0xa5e9('0x1'),_0xa5e9('0x2'),_0xa5e9('0x3')];function createListener(_0x52ba10,_0x57dc89){return function(_0xf69a09){_0x57dc89[_0xa5e9('0x4')](_0x52ba10,_0xf69a09);};}function removeListener(_0xf7a614,_0x53ebc9){return function(){CmListEvents[_0xa5e9('0x5')](_0xf7a614,_0x53ebc9);};}exports['register']=function(_0x55ec0b){for(var _0x126d09=0x0,_0x251e1c=events[_0xa5e9('0x6')];_0x126d09<_0x251e1c;_0x126d09++){var _0x4ed83e=events[_0x126d09];var _0x4b9613=createListener('cmList:'+_0x4ed83e,_0x55ec0b);CmListEvents['on'](_0x4ed83e,_0x4b9613);}}; \ No newline at end of file +var _0x889c=['register','length','cmList:','./cmList.events','remove','update','emit','removeListener'];(function(_0x37858e,_0x59edc1){var _0x1ae8c2=function(_0x10951b){while(--_0x10951b){_0x37858e['push'](_0x37858e['shift']());}};_0x1ae8c2(++_0x59edc1);}(_0x889c,0x1cb));var _0xc889=function(_0xcf9be0,_0x2ed5b2){_0xcf9be0=_0xcf9be0-0x0;var _0x12a945=_0x889c[_0xcf9be0];return _0x12a945;};'use strict';var CmListEvents=require(_0xc889('0x0'));var events=['save',_0xc889('0x1'),_0xc889('0x2')];function createListener(_0x566521,_0x26743b){return function(_0x5b5cdc){_0x26743b[_0xc889('0x3')](_0x566521,_0x5b5cdc);};}function removeListener(_0x2a84ca,_0x3f65c8){return function(){CmListEvents[_0xc889('0x4')](_0x2a84ca,_0x3f65c8);};}exports[_0xc889('0x5')]=function(_0x50376d){for(var _0x5dac40=0x0,_0x4367b8=events[_0xc889('0x6')];_0x5dac40<_0x4367b8;_0x5dac40++){var _0x22b22e=events[_0x5dac40];var _0xca1fd2=createListener(_0xc889('0x7')+_0x22b22e,_0x50376d);CmListEvents['on'](_0x22b22e,_0xca1fd2);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 3673654..9a3523a 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 _0xc16b=['getContacts','getContactsCsv','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','addContacts','/:id/fields','addCustomField','update','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions'];(function(_0x596a66,_0x2c3471){var _0x37343d=function(_0x4f76ce){while(--_0x4f76ce){_0x596a66['push'](_0x596a66['shift']());}};_0x37343d(++_0x2c3471);}(_0xc16b,0x76));var _0xbc16=function(_0x261860,_0x5405da){_0x261860=_0x261860-0x0;var _0x1e6d76=_0xc16b[_0x261860];return _0x1e6d76;};'use strict';var multer=require(_0xbc16('0x0'));var util=require(_0xbc16('0x1'));var path=require(_0xbc16('0x2'));var timeout=require(_0xbc16('0x3'));var express=require(_0xbc16('0x4'));var router=express[_0xbc16('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbc16('0x6'));var controller=require(_0xbc16('0x7'));router[_0xbc16('0x8')]('/',auth[_0xbc16('0x9')](),controller[_0xbc16('0xa')]);router[_0xbc16('0x8')]('/describe',auth[_0xbc16('0x9')](),controller[_0xbc16('0xb')]);router[_0xbc16('0x8')](_0xbc16('0xc'),auth['isAuthenticated'](),controller[_0xbc16('0xd')]);router[_0xbc16('0x8')](_0xbc16('0xe'),auth['isAuthenticated'](),controller[_0xbc16('0xf')]);router[_0xbc16('0x8')](_0xbc16('0x10'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x11')]);router[_0xbc16('0x8')]('/:id/contacts',auth[_0xbc16('0x9')](),controller[_0xbc16('0x12')]);router['get']('/:id/contacts/csv',auth[_0xbc16('0x9')](),controller[_0xbc16('0x13')]);router['get']('/:id/fields',auth[_0xbc16('0x9')](),controller['getCustomFields']);router[_0xbc16('0x8')](_0xbc16('0x14'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x15')]);router[_0xbc16('0x16')]('/',auth[_0xbc16('0x9')](),controller[_0xbc16('0x17')]);router['post'](_0xbc16('0x10'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x18')]);router[_0xbc16('0x16')](_0xbc16('0x19'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x1a')]);router[_0xbc16('0x16')](_0xbc16('0x1b'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x1c')]);router[_0xbc16('0x16')]('/:id/users',auth[_0xbc16('0x9')](),controller['addAgents']);router['put'](_0xbc16('0xe'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x1d')]);router[_0xbc16('0x1e')](_0xbc16('0xe'),auth[_0xbc16('0x9')](),controller['destroy']);router[_0xbc16('0x1e')](_0xbc16('0x10'),auth['isAuthenticated'](),controller[_0xbc16('0x1f')]);router['delete'](_0xbc16('0x14'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x20')]);module[_0xbc16('0x21')]=router; \ No newline at end of file +var _0xf7fd=['addDisposition','/:id/contacts','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','post','create'];(function(_0x51b19b,_0x5015d2){var _0x1a3cd6=function(_0x495134){while(--_0x495134){_0x51b19b['push'](_0x51b19b['shift']());}};_0x1a3cd6(++_0x5015d2);}(_0xf7fd,0x14c));var _0xdf7f=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xf7fd[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0xdf7f('0x0'));var util=require(_0xdf7f('0x1'));var path=require(_0xdf7f('0x2'));var timeout=require(_0xdf7f('0x3'));var express=require('express');var router=express[_0xdf7f('0x4')]();var fs_extra=require(_0xdf7f('0x5'));var auth=require(_0xdf7f('0x6'));var interaction=require(_0xdf7f('0x7'));var config=require(_0xdf7f('0x8'));var controller=require('./cmList.controller');router[_0xdf7f('0x9')]('/',auth['isAuthenticated'](),controller[_0xdf7f('0xa')]);router[_0xdf7f('0x9')](_0xdf7f('0xb'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0xd')]);router[_0xdf7f('0x9')](_0xdf7f('0xe'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0xf')]);router[_0xdf7f('0x9')](_0xdf7f('0x10'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x11')]);router['get'](_0xdf7f('0x12'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x13')]);router[_0xdf7f('0x9')]('/:id/contacts',auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x14')]);router[_0xdf7f('0x9')](_0xdf7f('0x15'),auth['isAuthenticated'](),controller[_0xdf7f('0x16')]);router[_0xdf7f('0x9')](_0xdf7f('0x17'),auth['isAuthenticated'](),controller['getCustomFields']);router['get'](_0xdf7f('0x18'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x19')]);router[_0xdf7f('0x1a')]('/',auth['isAuthenticated'](),controller[_0xdf7f('0x1b')]);router[_0xdf7f('0x1a')](_0xdf7f('0x12'),auth['isAuthenticated'](),controller[_0xdf7f('0x1c')]);router['post'](_0xdf7f('0x1d'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x1e')]);router['post']('/:id/fields',auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x1f')]);router[_0xdf7f('0x1a')](_0xdf7f('0x18'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x20')]);router[_0xdf7f('0x21')]('/:id',auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x22')]);router[_0xdf7f('0x23')](_0xdf7f('0x10'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x24')]);router[_0xdf7f('0x23')](_0xdf7f('0x12'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x25')]);router[_0xdf7f('0x23')](_0xdf7f('0x18'),auth[_0xdf7f('0xc')](),controller[_0xdf7f('0x26')]);module[_0xdf7f('0x27')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index be01518..5f42c0a 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 _0x50f0=['exports','getDataValue','field','STRING'];(function(_0x38d399,_0x2263b4){var _0x2e275b=function(_0x44a59e){while(--_0x44a59e){_0x38d399['push'](_0x38d399['shift']());}};_0x2e275b(++_0x2263b4);}(_0x50f0,0xb0));var _0x050f=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0x50f0[_0x11f5ff];return _0x46eefb;};'use strict';var Sequelize=require('sequelize');module[_0x050f('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x342f69){return this[_0x050f('0x1')](_0x050f('0x2'));}},'field':{'type':Sequelize[_0x050f('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x050f('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x050f('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xbd37=['VIRTUAL','getDataValue','field','STRING'];(function(_0x44b8ec,_0xedf9a){var _0x27b80f=function(_0x426b86){while(--_0x426b86){_0x44b8ec['push'](_0x44b8ec['shift']());}};_0x27b80f(++_0xedf9a);}(_0xbd37,0x1b0));var _0x7bd3=function(_0x2b368d,_0x429cd4){_0x2b368d=_0x2b368d-0x0;var _0x3309e8=_0xbd37[_0x2b368d];return _0x3309e8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7bd3('0x0')],'get':function(_0x2058de){return this[_0x7bd3('0x1')](_0x7bd3('0x2'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x7bd3('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x7bd3('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 1b7a2cd..77f354e 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(_0x27151,_0x1e7605){var _0x3bdd70=function(_0x3a8657){while(--_0x3a8657){_0x27151['push'](_0x27151['shift']());}};_0x3bdd70(++_0x1e7605);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x282ef5,_0x372c25){var _0x753794=function(_0x84d70e){while(--_0x84d70e){_0x282ef5['push'](_0x282ef5['shift']());}};_0x753794(++_0x372c25);}(_0x7a54,0x106));var _0x47a5=function(_0x2941ba,_0x1800c9){_0x2941ba=_0x2941ba-0x0;var _0x4c0a6e=_0x7a54[_0x2941ba];return _0x4c0a6e;};'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 3fb9ae3..1841a78 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 _0x0860=['moment','bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','../../config/logger','api'];(function(_0xc0c22,_0x468c5d){var _0xeb2318=function(_0x2fcdfd){while(--_0x2fcdfd){_0xc0c22['push'](_0xc0c22['shift']());}};_0xeb2318(++_0x468c5d);}(_0x0860,0xc4));var _0x0086=function(_0x4277ac,_0x2e758e){_0x4277ac=_0x4277ac-0x0;var _0x131cef=_0x0860[_0x4277ac];return _0x131cef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0086('0x0'))(_0x0086('0x1'));var moment=require(_0x0086('0x2'));var BPromise=require(_0x0086('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0086('0x4'));var rimraf=require(_0x0086('0x5'));var config=require(_0x0086('0x6'));var attributes=require(_0x0086('0x7'));module[_0x0086('0x8')]=function(_0x4fd1f9,_0x153b7b){return _0x4fd1f9[_0x0086('0x9')](_0x0086('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c28=['../../config/environment','exports','define','tools_conditions','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1bb49c,_0x510210){var _0x45db79=function(_0x3dc94c){while(--_0x3dc94c){_0x1bb49c['push'](_0x1bb49c['shift']());}};_0x45db79(++_0x510210);}(_0x7c28,0x190));var _0x87c2=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x7c28[_0x166742];return _0xb7814a;};'use strict';var _=require('lodash');var util=require(_0x87c2('0x0'));var logger=require(_0x87c2('0x1'))(_0x87c2('0x2'));var moment=require(_0x87c2('0x3'));var BPromise=require(_0x87c2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87c2('0x5'));var rimraf=require(_0x87c2('0x6'));var config=require(_0x87c2('0x7'));var attributes=require('./condition.attributes');module[_0x87c2('0x8')]=function(_0x3f985a,_0x3db9ee){return _0x3f985a[_0x87c2('0x9')]('Condition',attributes,{'tableName':_0x87c2('0xa'),'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 dad0242..9447286 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 _0xc737=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','Condition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc737,0x196));var _0x7c73=function(_0x3a9887,_0x124705){_0x3a9887=_0x3a9887-0x0;var _0x31174d=_0xc737[_0x3a9887];return _0x31174d;};'use strict';var _=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c73('0x2'));var db=require(_0x7c73('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c73('0x4'))(_0x7c73('0x5'));var config=require(_0x7c73('0x6'));var jayson=require(_0x7c73('0x7'));var client=jayson[_0x7c73('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45a94d,_0x15ba3a,_0xca8752){return new BPromise(function(_0xf178e1,_0x3a9b53){return client['request'](_0x45a94d,_0xca8752)['then'](function(_0x2d2002){logger['info'](_0x7c73('0x9'),_0x15ba3a,_0x7c73('0xa'));logger[_0x7c73('0xb')](_0x7c73('0xc'),_0x15ba3a,_0x7c73('0xa'),JSON[_0x7c73('0xd')](_0x2d2002));if(_0x2d2002[_0x7c73('0xe')]){if(_0x2d2002['error'][_0x7c73('0xf')]===0x1f4){logger[_0x7c73('0xe')](_0x7c73('0x9'),_0x15ba3a,_0x2d2002[_0x7c73('0xe')]['message']);return _0x3a9b53(_0x2d2002[_0x7c73('0xe')][_0x7c73('0x10')]);}logger['error'](_0x7c73('0x9'),_0x15ba3a,_0x2d2002['error'][_0x7c73('0x10')]);return _0xf178e1(_0x2d2002['error'][_0x7c73('0x10')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x15ba3a,'request\x20sent');_0xf178e1(_0x2d2002[_0x7c73('0x11')]['message']);}})[_0x7c73('0x12')](function(_0x369297){logger[_0x7c73('0xe')]('Condition,\x20%s,\x20%s',_0x15ba3a,_0x369297);_0x3a9b53(_0x369297);});});} \ No newline at end of file +var _0x5fa4=['info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x59b48b,_0x584733){var _0x4c3f79=function(_0x3f2e94){while(--_0x3f2e94){_0x59b48b['push'](_0x59b48b['shift']());}};_0x4c3f79(++_0x584733);}(_0x5fa4,0x83));var _0x45fa=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5fa4[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x45fa('0x0'));var util=require(_0x45fa('0x1'));var moment=require(_0x45fa('0x2'));var BPromise=require(_0x45fa('0x3'));var rs=require(_0x45fa('0x4'));var fs=require('fs');var Redis=require(_0x45fa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x45fa('0x6'));var logger=require('../../config/logger')(_0x45fa('0x7'));var config=require(_0x45fa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x45fa('0x9')][_0x45fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b7e86,_0x4ec268,_0x481b4b){return new BPromise(function(_0x2bb127,_0x2a7a97){return client[_0x45fa('0xb')](_0x5b7e86,_0x481b4b)[_0x45fa('0xc')](function(_0x35df52){logger[_0x45fa('0xd')](_0x45fa('0xe'),_0x4ec268,_0x45fa('0xf'));logger[_0x45fa('0x10')](_0x45fa('0x11'),_0x4ec268,_0x45fa('0xf'),JSON[_0x45fa('0x12')](_0x35df52));if(_0x35df52['error']){if(_0x35df52[_0x45fa('0x13')][_0x45fa('0x14')]===0x1f4){logger[_0x45fa('0x13')](_0x45fa('0xe'),_0x4ec268,_0x35df52[_0x45fa('0x13')][_0x45fa('0x15')]);return _0x2a7a97(_0x35df52[_0x45fa('0x13')][_0x45fa('0x15')]);}logger[_0x45fa('0x13')]('Condition,\x20%s,\x20%s',_0x4ec268,_0x35df52['error']['message']);return _0x2bb127(_0x35df52['error']['message']);}else{logger[_0x45fa('0xd')](_0x45fa('0xe'),_0x4ec268,_0x45fa('0xf'));_0x2bb127(_0x35df52[_0x45fa('0x16')][_0x45fa('0x15')]);}})[_0x45fa('0x17')](function(_0x2ee2c4){logger[_0x45fa('0x13')](_0x45fa('0xe'),_0x4ec268,_0x2ee2c4);_0x2a7a97(_0x2ee2c4);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index e963cb4..4b89b7c 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 _0x4212=['../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x4212,0xdb));var _0x2421=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x4212[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x2421('0x0'));var util=require('util');var path=require(_0x2421('0x1'));var timeout=require(_0x2421('0x2'));var express=require('express');var router=express[_0x2421('0x3')]();var fs_extra=require(_0x2421('0x4'));var auth=require(_0x2421('0x5'));var interaction=require(_0x2421('0x6'));var config=require('../../config/environment');var controller=require(_0x2421('0x7'));router[_0x2421('0x8')](_0x2421('0x9'),auth[_0x2421('0xa')](),controller[_0x2421('0xb')]);router[_0x2421('0xc')](_0x2421('0x9'),auth[_0x2421('0xa')](),controller[_0x2421('0xd')]);module[_0x2421('0xe')]=router; \ No newline at end of file +var _0x2eeb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','delete','isAuthenticated','multer','util','connect-timeout','express'];(function(_0x1ff1d7,_0x4d8540){var _0x523750=function(_0x320dde){while(--_0x320dde){_0x1ff1d7['push'](_0x1ff1d7['shift']());}};_0x523750(++_0x4d8540);}(_0x2eeb,0x80));var _0xb2ee=function(_0x459919,_0x427e1b){_0x459919=_0x459919-0x0;var _0x1953f4=_0x2eeb[_0x459919];return _0x1953f4;};'use strict';var multer=require(_0xb2ee('0x0'));var util=require(_0xb2ee('0x1'));var path=require('path');var timeout=require(_0xb2ee('0x2'));var express=require(_0xb2ee('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb2ee('0x4'));var interaction=require(_0xb2ee('0x5'));var config=require(_0xb2ee('0x6'));var controller=require(_0xb2ee('0x7'));router[_0xb2ee('0x8')](_0xb2ee('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xb2ee('0xa')](_0xb2ee('0x9'),auth[_0xb2ee('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 1b17320..8371ab5 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 _0x7bc8=['name','exports','STRING'];(function(_0x2ed502,_0x3b7fab){var _0x191886=function(_0x446add){while(--_0x446add){_0x2ed502['push'](_0x2ed502['shift']());}};_0x191886(++_0x3b7fab);}(_0x7bc8,0x15a));var _0x87bc=function(_0xeb5ef8,_0x1963d8){_0xeb5ef8=_0xeb5ef8-0x0;var _0x2b186f=_0x7bc8[_0xeb5ef8];return _0x2b186f;};'use strict';var Sequelize=require('sequelize');module[_0x87bc('0x0')]={'name':{'type':Sequelize[_0x87bc('0x1')],'allowNull':![],'unique':_0x87bc('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x87bc('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xd358=['INTEGER','exports','STRING','name'];(function(_0x1e7569,_0x15bd26){var _0x4a24d4=function(_0x576813){while(--_0x576813){_0x1e7569['push'](_0x1e7569['shift']());}};_0x4a24d4(++_0x15bd26);}(_0xd358,0x1b5));var _0x8d35=function(_0xa003d1,_0xfffc7b){_0xa003d1=_0xa003d1-0x0;var _0x1b39dd=_0xd358[_0xa003d1];return _0x1b39dd;};'use strict';var Sequelize=require('sequelize');module[_0x8d35('0x0')]={'name':{'type':Sequelize[_0x8d35('0x1')],'allowNull':![],'unique':_0x8d35('0x2')},'OrderBy':{'type':Sequelize[_0x8d35('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8d35('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 4cc7960..2ad1759 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 _0x4137=['userProfileId','autoAssociation','find','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','get','end','sendStatus','stack','name','send','index','map','ContactItemType','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','length','query','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x25207d,_0x5cce53){var _0x547923=function(_0x12d6a4){while(--_0x12d6a4){_0x25207d['push'](_0x25207d['shift']());}};_0x547923(++_0x5cce53);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){var _0x1d97fd=_0x2fc0f4[_0x7413('0x26')]({'plain':!![]});var _0x1d455b='ContactItemTypes';return db['UserProfileResource'][_0x7413('0x24')]({'where':{'type':_0x1d455b,'resourceId':_0x1d97fd['id']}})['then'](function(){return _0x2fc0f4;});})[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x27')]();});}};}function handleEntityNotFound(_0x4c2e90,_0x35e0fd){return function(_0x896552){if(!_0x896552){_0x4c2e90[_0x7413('0x28')](0x194);}return _0x896552;};}function handleError(_0x4843fd,_0x19970c){_0x19970c=_0x19970c||0x1f4;return function(_0x2e521f){logger['error'](_0x2e521f[_0x7413('0x29')]);if(_0x2e521f['name']){delete _0x2e521f[_0x7413('0x2a')];}_0x4843fd[_0x7413('0x1a')](_0x19970c)[_0x7413('0x2b')](_0x2e521f);};}exports[_0x7413('0x2c')]=function(_0x25fa52,_0x2004ea){var _0x5bb3ea={},_0x1ffb6f={},_0x17c342={'count':0x0,'rows':[]};var _0x39db32=_[_0x7413('0x2d')](db[_0x7413('0x2e')][_0x7413('0x2f')],function(_0x185cfe){return{'name':_0x185cfe['fieldName'],'type':_0x185cfe[_0x7413('0x30')][_0x7413('0x31')]};});_0x1ffb6f[_0x7413('0x32')]=_[_0x7413('0x2d')](_0x39db32,_0x7413('0x2a'));_0x1ffb6f['query']=_[_0x7413('0x33')](_0x25fa52['query']);_0x1ffb6f[_0x7413('0x34')]=_[_0x7413('0x35')](_0x1ffb6f[_0x7413('0x32')],_0x1ffb6f['query']);_0x5bb3ea[_0x7413('0x36')]=_['intersection'](_0x1ffb6f[_0x7413('0x32')],qs[_0x7413('0x37')](_0x25fa52['query']['fields']));_0x5bb3ea[_0x7413('0x36')]=_0x5bb3ea[_0x7413('0x36')][_0x7413('0x38')]?_0x5bb3ea['attributes']:_0x1ffb6f['model'];if(!_0x25fa52[_0x7413('0x39')]['hasOwnProperty']('nolimit')){_0x5bb3ea[_0x7413('0x1d')]=qs['limit'](_0x25fa52[_0x7413('0x39')][_0x7413('0x1d')]);_0x5bb3ea[_0x7413('0x1c')]=qs[_0x7413('0x1c')](_0x25fa52[_0x7413('0x39')]['offset']);}_0x5bb3ea[_0x7413('0x3a')]=qs[_0x7413('0x3b')](_0x25fa52[_0x7413('0x39')][_0x7413('0x3b')]);_0x5bb3ea[_0x7413('0x3c')]=qs[_0x7413('0x34')](_[_0x7413('0x3d')](_0x25fa52[_0x7413('0x39')],_0x1ffb6f[_0x7413('0x34')]),_0x39db32);if(_0x25fa52[_0x7413('0x39')][_0x7413('0x3e')]){_0x5bb3ea[_0x7413('0x3c')]=_['merge'](_0x5bb3ea[_0x7413('0x3c')],{'$or':_['map'](_0x39db32,function(_0x56cb6f){if(_0x56cb6f['type']!=='VIRTUAL'){var _0x5c86ad={};_0x5c86ad[_0x56cb6f[_0x7413('0x2a')]]={'$like':'%'+_0x25fa52['query']['filter']+'%'};return _0x5c86ad;}})});}_0x5bb3ea=_[_0x7413('0x3f')]({},_0x5bb3ea,_0x25fa52['options']);var _0x4c6746={'where':_0x5bb3ea[_0x7413('0x3c')]};return db[_0x7413('0x2e')][_0x7413('0x1e')](_0x4c6746)[_0x7413('0x25')](function(_0x8049c0){_0x17c342['count']=_0x8049c0;if(_0x25fa52[_0x7413('0x39')]['includeAll']){_0x5bb3ea[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2e')][_0x7413('0x41')](_0x5bb3ea);})[_0x7413('0x25')](function(_0x3f7da2){_0x17c342[_0x7413('0x42')]=_0x3f7da2;return _0x17c342;})[_0x7413('0x25')](respondWithFilteredResult(_0x2004ea,_0x5bb3ea))[_0x7413('0x43')](handleError(_0x2004ea,null));};exports[_0x7413('0x44')]=function(_0x1dd908,_0x38cd61){var _0x1e8bbd={'raw':!![],'where':{'id':_0x1dd908['params']['id']}},_0x3fbec4={};_0x3fbec4[_0x7413('0x32')]=_[_0x7413('0x33')](db[_0x7413('0x2e')][_0x7413('0x2f')]);_0x3fbec4[_0x7413('0x39')]=_[_0x7413('0x33')](_0x1dd908[_0x7413('0x39')]);_0x3fbec4[_0x7413('0x34')]=_[_0x7413('0x35')](_0x3fbec4[_0x7413('0x32')],_0x3fbec4[_0x7413('0x39')]);_0x1e8bbd['attributes']=_[_0x7413('0x35')](_0x3fbec4['model'],qs[_0x7413('0x37')](_0x1dd908[_0x7413('0x39')][_0x7413('0x37')]));_0x1e8bbd[_0x7413('0x36')]=_0x1e8bbd[_0x7413('0x36')][_0x7413('0x38')]?_0x1e8bbd[_0x7413('0x36')]:_0x3fbec4[_0x7413('0x32')];if(_0x1dd908[_0x7413('0x39')][_0x7413('0x45')]){_0x1e8bbd['include']=[{'all':!![]}];}_0x1e8bbd=_['merge']({},_0x1e8bbd,_0x1dd908[_0x7413('0x46')]);return db['ContactItemType']['find'](_0x1e8bbd)[_0x7413('0x25')](handleEntityNotFound(_0x38cd61,null))[_0x7413('0x25')](respondWithResult(_0x38cd61,null))['catch'](handleError(_0x38cd61,null));};exports[_0x7413('0x47')]=function(_0x586d25,_0x562bae){return db[_0x7413('0x2e')]['create'](_0x586d25[_0x7413('0x48')],{})[_0x7413('0x25')](function(_0x1a7338){var _0x5fe361=_0x586d25[_0x7413('0x49')][_0x7413('0x26')]({'plain':!![]});if(!_0x5fe361)throw new Error(_0x7413('0x4a'));if(_0x5fe361[_0x7413('0x4b')]===_0x7413('0x49')){var _0x2031e3=_0x1a7338['get']({'plain':!![]});var _0x369891='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x369891,'userProfileId':_0x5fe361[_0x7413('0x4c')]},'raw':!![]})[_0x7413('0x25')](function(_0x453510){if(_0x453510&&_0x453510[_0x7413('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x2031e3[_0x7413('0x2a')],'resourceId':_0x2031e3['id'],'type':_0x453510['name'],'sectionId':_0x453510['id']},{})[_0x7413('0x25')](function(){return _0x1a7338;});}else{return _0x1a7338;}})['catch'](function(_0x4f8353){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f8353);throw _0x4f8353;});}return _0x1a7338;})['then'](respondWithResult(_0x562bae,0xc9))[_0x7413('0x43')](handleError(_0x562bae,null));};exports[_0x7413('0x23')]=function(_0x229573,_0x2ffec6){if(_0x229573[_0x7413('0x48')]['id']){delete _0x229573['body']['id'];}return db[_0x7413('0x2e')][_0x7413('0x4e')]({'where':{'id':_0x229573[_0x7413('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2ffec6,null))[_0x7413('0x25')](saveUpdates(_0x229573['body'],null))['then'](respondWithResult(_0x2ffec6,null))[_0x7413('0x43')](handleError(_0x2ffec6,null));};exports[_0x7413('0x24')]=function(_0x1939a8,_0x287365){return db[_0x7413('0x2e')][_0x7413('0x4e')]({'where':{'id':_0x1939a8['params']['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x287365,null))['then'](db[_0x7413('0x50')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1939a8[_0x7413('0x4f')]['id']}}))['then'](removeEntity(_0x287365,null))[_0x7413('0x43')](handleError(_0x287365,null));}; \ No newline at end of file +var _0x1a85=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','ContactItemTypes','UserProfileResource','destroy','end','error','stack','name','index','ContactItemType','rawAttributes','type','model','map','query','keys','filters','attributes','fields','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','intersection','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','body','CmContactHasItem','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x298dd7,_0x579273){var _0x995c4a=function(_0xccbb73){while(--_0xccbb73){_0x298dd7['push'](_0x298dd7['shift']());}};_0x995c4a(++_0x579273);}(_0x1a85,0x178));var _0x51a8=function(_0x843880,_0x1516d1){_0x843880=_0x843880-0x0;var _0x49943f=_0x1a85[_0x843880];return _0x49943f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];function respondWithStatusCode(_0x38a1d2,_0x1827e6){_0x1827e6=_0x1827e6||0xcc;return function(_0x43c042){if(_0x43c042){return _0x38a1d2[_0x51a8('0x17')](_0x1827e6);}return _0x38a1d2[_0x51a8('0x18')](_0x1827e6)['end']();};}function respondWithResult(_0x461f5c,_0x7a4c36){_0x7a4c36=_0x7a4c36||0xc8;return function(_0xaec066){if(_0xaec066){return _0x461f5c['status'](_0x7a4c36)[_0x51a8('0x19')](_0xaec066);}};}function respondWithFilteredResult(_0x547d40,_0x10584b){return function(_0x2b8d37){if(_0x2b8d37){var _0x39cd45=typeof _0x10584b[_0x51a8('0x1a')]===_0x51a8('0x1b')&&typeof _0x10584b[_0x51a8('0x1c')]===_0x51a8('0x1b');var _0x516abc=_0x2b8d37[_0x51a8('0x1d')];var _0x45a433=_0x39cd45?0x0:_0x10584b[_0x51a8('0x1a')];var _0x23539e=_0x39cd45?_0x2b8d37[_0x51a8('0x1d')]:_0x10584b[_0x51a8('0x1a')]+_0x10584b['limit'];var _0x1df8c2;if(_0x23539e>=_0x516abc){_0x23539e=_0x516abc;_0x1df8c2=0xc8;}else{_0x1df8c2=0xce;}_0x547d40[_0x51a8('0x18')](_0x1df8c2);return _0x547d40[_0x51a8('0x1e')](_0x51a8('0x1f'),_0x45a433+'-'+_0x23539e+'/'+_0x516abc)[_0x51a8('0x19')](_0x2b8d37);}return null;};}function patchUpdates(_0x3bc044){return function(_0x28aea0){try{jsonpatch[_0x51a8('0x20')](_0x28aea0,_0x3bc044,!![]);}catch(_0x5ac1c0){return BPromise[_0x51a8('0x21')](_0x5ac1c0);}return _0x28aea0['save']();};}function saveUpdates(_0xfe0ddb,_0x12c029){return function(_0x8bda40){if(_0x8bda40){return _0x8bda40[_0x51a8('0x22')](_0xfe0ddb)['then'](function(_0xae3588){return _0xae3588;});}return null;};}function removeEntity(_0x4b9cdd,_0x47f063){return function(_0x23d26a){if(_0x23d26a){return _0x23d26a['destroy']()[_0x51a8('0x23')](function(){var _0x78d3d6=_0x23d26a[_0x51a8('0x24')]({'plain':!![]});var _0x18e2f3=_0x51a8('0x25');return db[_0x51a8('0x26')][_0x51a8('0x27')]({'where':{'type':_0x18e2f3,'resourceId':_0x78d3d6['id']}})[_0x51a8('0x23')](function(){return _0x23d26a;});})['then'](function(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x28')]();});}};}function handleEntityNotFound(_0xca5746,_0x3da187){return function(_0x1c150d){if(!_0x1c150d){_0xca5746[_0x51a8('0x17')](0x194);}return _0x1c150d;};}function handleError(_0x1a886f,_0x2742f5){_0x2742f5=_0x2742f5||0x1f4;return function(_0xec08ae){logger[_0x51a8('0x29')](_0xec08ae[_0x51a8('0x2a')]);if(_0xec08ae[_0x51a8('0x2b')]){delete _0xec08ae['name'];}_0x1a886f[_0x51a8('0x18')](_0x2742f5)['send'](_0xec08ae);};}exports[_0x51a8('0x2c')]=function(_0x3bc19a,_0x143f46){var _0x41df56={},_0x2136b4={},_0x4ea271={'count':0x0,'rows':[]};var _0x10c19b=_['map'](db[_0x51a8('0x2d')][_0x51a8('0x2e')],function(_0x253a59){return{'name':_0x253a59['fieldName'],'type':_0x253a59[_0x51a8('0x2f')]['key']};});_0x2136b4[_0x51a8('0x30')]=_[_0x51a8('0x31')](_0x10c19b,_0x51a8('0x2b'));_0x2136b4[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x3bc19a['query']);_0x2136b4[_0x51a8('0x34')]=_['intersection'](_0x2136b4[_0x51a8('0x30')],_0x2136b4[_0x51a8('0x32')]);_0x41df56[_0x51a8('0x35')]=_['intersection'](_0x2136b4[_0x51a8('0x30')],qs[_0x51a8('0x36')](_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x36')]));_0x41df56[_0x51a8('0x35')]=_0x41df56['attributes']['length']?_0x41df56['attributes']:_0x2136b4[_0x51a8('0x30')];if(!_0x3bc19a[_0x51a8('0x32')]['hasOwnProperty'](_0x51a8('0x37'))){_0x41df56['limit']=qs[_0x51a8('0x1c')](_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x1c')]);_0x41df56[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0x3bc19a[_0x51a8('0x32')]['offset']);}_0x41df56['order']=qs[_0x51a8('0x38')](_0x3bc19a['query']['sort']);_0x41df56['where']=qs[_0x51a8('0x34')](_[_0x51a8('0x39')](_0x3bc19a[_0x51a8('0x32')],_0x2136b4['filters']),_0x10c19b);if(_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3a')]){_0x41df56[_0x51a8('0x3b')]=_[_0x51a8('0x3c')](_0x41df56['where'],{'$or':_[_0x51a8('0x31')](_0x10c19b,function(_0xe6a86a){if(_0xe6a86a[_0x51a8('0x2f')]!=='VIRTUAL'){var _0xb96200={};_0xb96200[_0xe6a86a['name']]={'$like':'%'+_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3a')]+'%'};return _0xb96200;}})});}_0x41df56=_[_0x51a8('0x3c')]({},_0x41df56,_0x3bc19a[_0x51a8('0x3d')]);var _0x5c44a9={'where':_0x41df56[_0x51a8('0x3b')]};return db[_0x51a8('0x2d')][_0x51a8('0x1d')](_0x5c44a9)[_0x51a8('0x23')](function(_0xa33fc){_0x4ea271[_0x51a8('0x1d')]=_0xa33fc;if(_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3e')]){_0x41df56[_0x51a8('0x3f')]=[{'all':!![]}];}return db['ContactItemType'][_0x51a8('0x40')](_0x41df56);})[_0x51a8('0x23')](function(_0x4c7c67){_0x4ea271['rows']=_0x4c7c67;return _0x4ea271;})[_0x51a8('0x23')](respondWithFilteredResult(_0x143f46,_0x41df56))[_0x51a8('0x41')](handleError(_0x143f46,null));};exports[_0x51a8('0x42')]=function(_0x27b8e5,_0x311574){var _0x157a51={'raw':!![],'where':{'id':_0x27b8e5[_0x51a8('0x43')]['id']}},_0x28f5b3={};_0x28f5b3[_0x51a8('0x30')]=_[_0x51a8('0x33')](db['ContactItemType'][_0x51a8('0x2e')]);_0x28f5b3[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x27b8e5[_0x51a8('0x32')]);_0x28f5b3[_0x51a8('0x34')]=_[_0x51a8('0x44')](_0x28f5b3['model'],_0x28f5b3[_0x51a8('0x32')]);_0x157a51['attributes']=_[_0x51a8('0x44')](_0x28f5b3[_0x51a8('0x30')],qs[_0x51a8('0x36')](_0x27b8e5[_0x51a8('0x32')][_0x51a8('0x36')]));_0x157a51['attributes']=_0x157a51['attributes'][_0x51a8('0x45')]?_0x157a51[_0x51a8('0x35')]:_0x28f5b3[_0x51a8('0x30')];if(_0x27b8e5[_0x51a8('0x32')][_0x51a8('0x3e')]){_0x157a51['include']=[{'all':!![]}];}_0x157a51=_['merge']({},_0x157a51,_0x27b8e5[_0x51a8('0x3d')]);return db[_0x51a8('0x2d')][_0x51a8('0x46')](_0x157a51)[_0x51a8('0x23')](handleEntityNotFound(_0x311574,null))[_0x51a8('0x23')](respondWithResult(_0x311574,null))[_0x51a8('0x41')](handleError(_0x311574,null));};exports[_0x51a8('0x47')]=function(_0x1103a3,_0x301578){return db['ContactItemType']['create'](_0x1103a3['body'],{})[_0x51a8('0x23')](function(_0x279cb1){var _0x103897=_0x1103a3['user'][_0x51a8('0x24')]({'plain':!![]});if(!_0x103897)throw new Error(_0x51a8('0x48'));if(_0x103897['role']===_0x51a8('0x49')){var _0x4fb93c=_0x279cb1['get']({'plain':!![]});var _0xbf828b=_0x51a8('0x25');return db[_0x51a8('0x4a')]['find']({'where':{'name':_0xbf828b,'userProfileId':_0x103897['userProfileId']},'raw':!![]})[_0x51a8('0x23')](function(_0x5b0398){if(_0x5b0398&&_0x5b0398[_0x51a8('0x4b')]===0x0){return db[_0x51a8('0x26')][_0x51a8('0x47')]({'name':_0x4fb93c[_0x51a8('0x2b')],'resourceId':_0x4fb93c['id'],'type':_0x5b0398[_0x51a8('0x2b')],'sectionId':_0x5b0398['id']},{})[_0x51a8('0x23')](function(){return _0x279cb1;});}else{return _0x279cb1;}})[_0x51a8('0x41')](function(_0x406a87){logger[_0x51a8('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x406a87);throw _0x406a87;});}return _0x279cb1;})[_0x51a8('0x23')](respondWithResult(_0x301578,0xc9))[_0x51a8('0x41')](handleError(_0x301578,null));};exports[_0x51a8('0x22')]=function(_0xd3c4,_0x533cfa){if(_0xd3c4[_0x51a8('0x4c')]['id']){delete _0xd3c4['body']['id'];}return db[_0x51a8('0x2d')][_0x51a8('0x46')]({'where':{'id':_0xd3c4['params']['id']}})['then'](handleEntityNotFound(_0x533cfa,null))[_0x51a8('0x23')](saveUpdates(_0xd3c4[_0x51a8('0x4c')],null))[_0x51a8('0x23')](respondWithResult(_0x533cfa,null))[_0x51a8('0x41')](handleError(_0x533cfa,null));};exports[_0x51a8('0x27')]=function(_0x52f60f,_0x43b79a){return db[_0x51a8('0x2d')][_0x51a8('0x46')]({'where':{'id':_0x52f60f[_0x51a8('0x43')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x43b79a,null))['then'](db[_0x51a8('0x4d')][_0x51a8('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x52f60f[_0x51a8('0x43')]['id']}}))[_0x51a8('0x23')](removeEntity(_0x43b79a,null))[_0x51a8('0x41')](handleError(_0x43b79a,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 44a4f17..ea6e837 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 _0x8acf=['path','rimraf','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','lodash','../../config/logger','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8acf,0xe3));var _0xf8ac=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x8acf[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xf8ac('0x0'));var util=require('util');var logger=require(_0xf8ac('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf8ac('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8ac('0x3'));var rimraf=require(_0xf8ac('0x4'));var config=require(_0xf8ac('0x5'));var attributes=require(_0xf8ac('0x6'));module[_0xf8ac('0x7')]=function(_0x492d44,_0x430ebd){return _0x492d44['define'](_0xf8ac('0x8'),attributes,{'tableName':_0xf8ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccd2=['define','ContactItemType','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports'];(function(_0x4fdf43,_0x445e7e){var _0x2f0508=function(_0x517c3b){while(--_0x517c3b){_0x4fdf43['push'](_0x4fdf43['shift']());}};_0x2f0508(++_0x445e7e);}(_0xccd2,0x1e2));var _0x2ccd=function(_0x1cb2bc,_0x1e7e11){_0x1cb2bc=_0x1cb2bc-0x0;var _0x44891c=_0xccd2[_0x1cb2bc];return _0x44891c;};'use strict';var _=require(_0x2ccd('0x0'));var util=require('util');var logger=require(_0x2ccd('0x1'))(_0x2ccd('0x2'));var moment=require(_0x2ccd('0x3'));var BPromise=require('bluebird');var rp=require(_0x2ccd('0x4'));var fs=require('fs');var path=require(_0x2ccd('0x5'));var rimraf=require(_0x2ccd('0x6'));var config=require(_0x2ccd('0x7'));var attributes=require(_0x2ccd('0x8'));module[_0x2ccd('0x9')]=function(_0x537737,_0x2c5843){return _0x537737[_0x2ccd('0xa')](_0x2ccd('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 e8438b8..0229fc7 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 _0xfb4f=['jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x115e0e,_0x1f8e56){var _0x2534c2=function(_0x2a2f06){while(--_0x2a2f06){_0x115e0e['push'](_0x115e0e['shift']());}};_0x2534c2(++_0x1f8e56);}(_0xfb4f,0x8c));var _0xffb4=function(_0x4d203f,_0x4b4464){_0x4d203f=_0x4d203f-0x0;var _0x44bce4=_0xfb4f[_0x4d203f];return _0x44bce4;};'use strict';var _=require(_0xffb4('0x0'));var util=require(_0xffb4('0x1'));var moment=require(_0xffb4('0x2'));var BPromise=require(_0xffb4('0x3'));var rs=require(_0xffb4('0x4'));var fs=require('fs');var Redis=require(_0xffb4('0x5'));var db=require(_0xffb4('0x6'))['db'];var utils=require(_0xffb4('0x7'));var logger=require('../../config/logger')(_0xffb4('0x8'));var config=require(_0xffb4('0x9'));var jayson=require(_0xffb4('0xa'));var client=jayson[_0xffb4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a3204,_0x39d528,_0x49fb9a){return new BPromise(function(_0x36ac5d,_0x39ee6d){return client[_0xffb4('0xc')](_0x2a3204,_0x49fb9a)[_0xffb4('0xd')](function(_0xaee03d){logger[_0xffb4('0xe')](_0xffb4('0xf'),_0x39d528,'request\x20sent');logger[_0xffb4('0x10')](_0xffb4('0x11'),_0x39d528,_0xffb4('0x12'),JSON[_0xffb4('0x13')](_0xaee03d));if(_0xaee03d[_0xffb4('0x14')]){if(_0xaee03d[_0xffb4('0x14')][_0xffb4('0x15')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x39d528,_0xaee03d[_0xffb4('0x14')][_0xffb4('0x16')]);return _0x39ee6d(_0xaee03d[_0xffb4('0x14')][_0xffb4('0x16')]);}logger[_0xffb4('0x14')](_0xffb4('0xf'),_0x39d528,_0xaee03d[_0xffb4('0x14')]['message']);return _0x36ac5d(_0xaee03d[_0xffb4('0x14')][_0xffb4('0x16')]);}else{logger['info'](_0xffb4('0xf'),_0x39d528,_0xffb4('0x12'));_0x36ac5d(_0xaee03d[_0xffb4('0x17')][_0xffb4('0x16')]);}})[_0xffb4('0x18')](function(_0x862bd5){logger[_0xffb4('0x14')](_0xffb4('0xf'),_0x39d528,_0x862bd5);_0x39ee6d(_0x862bd5);});});} \ No newline at end of file +var _0x9215=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','ContactItemType,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird'];(function(_0x32023d,_0x281593){var _0xb4a7b4=function(_0x206ffc){while(--_0x206ffc){_0x32023d['push'](_0x32023d['shift']());}};_0xb4a7b4(++_0x281593);}(_0x9215,0x13f));var _0x5921=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x9215[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x5921('0x0'));var util=require(_0x5921('0x1'));var moment=require(_0x5921('0x2'));var BPromise=require(_0x5921('0x3'));var rs=require(_0x5921('0x4'));var fs=require('fs');var Redis=require(_0x5921('0x5'));var db=require(_0x5921('0x6'))['db'];var utils=require(_0x5921('0x7'));var logger=require(_0x5921('0x8'))('rpc');var config=require(_0x5921('0x9'));var jayson=require(_0x5921('0xa'));var client=jayson[_0x5921('0xb')][_0x5921('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43a3f2,_0x5bba43,_0x55d649){return new BPromise(function(_0x2a6ef2,_0x21f477){return client['request'](_0x43a3f2,_0x55d649)['then'](function(_0x46346d){logger['info'](_0x5921('0xd'),_0x5bba43,'request\x20sent');logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x5bba43,'request\x20sent',JSON[_0x5921('0xe')](_0x46346d));if(_0x46346d['error']){if(_0x46346d[_0x5921('0xf')]['code']===0x1f4){logger[_0x5921('0xf')](_0x5921('0xd'),_0x5bba43,_0x46346d[_0x5921('0xf')]['message']);return _0x21f477(_0x46346d['error'][_0x5921('0x10')]);}logger[_0x5921('0xf')](_0x5921('0xd'),_0x5bba43,_0x46346d[_0x5921('0xf')][_0x5921('0x10')]);return _0x2a6ef2(_0x46346d[_0x5921('0xf')][_0x5921('0x10')]);}else{logger[_0x5921('0x11')]('ContactItemType,\x20%s,\x20%s',_0x5bba43,'request\x20sent');_0x2a6ef2(_0x46346d['result']['message']);}})[_0x5921('0x12')](function(_0x22d669){logger[_0x5921('0xf')](_0x5921('0xd'),_0x5bba43,_0x22d669);_0x21f477(_0x22d669);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 1fb0c78..f2f9960 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 _0xf31b=['update','destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x177a3e,_0xdf7e48){var _0x53dc44=function(_0x192252){while(--_0x192252){_0x177a3e['push'](_0x177a3e['shift']());}};_0x53dc44(++_0xdf7e48);}(_0xf31b,0x93));var _0xbf31=function(_0x429f49,_0x3d1a9f){_0x429f49=_0x429f49-0x0;var _0x31bc38=_0xf31b[_0x429f49];return _0x31bc38;};'use strict';var multer=require('multer');var util=require(_0xbf31('0x0'));var path=require('path');var timeout=require(_0xbf31('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbf31('0x2'));var auth=require(_0xbf31('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbf31('0x4'));var controller=require(_0xbf31('0x5'));router[_0xbf31('0x6')]('/',auth[_0xbf31('0x7')](),controller['index']);router[_0xbf31('0x6')](_0xbf31('0x8'),auth[_0xbf31('0x7')](),controller[_0xbf31('0x9')]);router[_0xbf31('0xa')]('/',auth[_0xbf31('0x7')](),controller[_0xbf31('0xb')]);router[_0xbf31('0xc')](_0xbf31('0x8'),auth['isAuthenticated'](),controller[_0xbf31('0xd')]);router['delete'](_0xbf31('0x8'),auth[_0xbf31('0x7')](),controller[_0xbf31('0xe')]);module[_0xbf31('0xf')]=router; \ No newline at end of file +var _0x3614=['post','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','get','/:id','show'];(function(_0x2de0d5,_0x410b81){var _0x5a05df=function(_0x42866a){while(--_0x42866a){_0x2de0d5['push'](_0x2de0d5['shift']());}};_0x5a05df(++_0x410b81);}(_0x3614,0x8a));var _0x4361=function(_0x5479af,_0x2d23c7){_0x5479af=_0x5479af-0x0;var _0x21f670=_0x3614[_0x5479af];return _0x21f670;};'use strict';var multer=require(_0x4361('0x0'));var util=require('util');var path=require(_0x4361('0x1'));var timeout=require(_0x4361('0x2'));var express=require(_0x4361('0x3'));var router=express[_0x4361('0x4')]();var fs_extra=require(_0x4361('0x5'));var auth=require(_0x4361('0x6'));var interaction=require(_0x4361('0x7'));var config=require(_0x4361('0x8'));var controller=require(_0x4361('0x9'));router['get']('/',auth[_0x4361('0xa')](),controller['index']);router[_0x4361('0xb')](_0x4361('0xc'),auth[_0x4361('0xa')](),controller[_0x4361('0xd')]);router[_0x4361('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4361('0xf')]);router[_0x4361('0x10')](_0x4361('0xc'),auth['isAuthenticated'](),controller[_0x4361('0x11')]);module[_0x4361('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 bb6ee12..3b93565 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(_0x51d186,_0x1ad18a){var _0x46a739=function(_0x13bba7){while(--_0x13bba7){_0x51d186['push'](_0x51d186['shift']());}};_0x46a739(++_0x1ad18a);}(_0xb10b,0x12a));var _0xbb10=function(_0x25f39c,_0x4f231a){_0x25f39c=_0x25f39c-0x0;var _0x19bb4a=_0xb10b[_0x25f39c];return _0x19bb4a;};'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 _0xbaf0=['name','exports','STRING'];(function(_0x1ca890,_0x21d0d3){var _0x3f8e01=function(_0x4ff2e2){while(--_0x4ff2e2){_0x1ca890['push'](_0x1ca890['shift']());}};_0x3f8e01(++_0x21d0d3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 22c7eb0..b934b0d 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 _0x2846=['stack','name','index','map','Dashboard','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','fields','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','body','update','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','findOne','getItems','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','then','get','UserProfileResource','destroy','error'];(function(_0x3a3c3d,_0x3b8542){var _0xf3142f=function(_0x479bb0){while(--_0x479bb0){_0x3a3c3d['push'](_0x3a3c3d['shift']());}};_0xf3142f(++_0x3b8542);}(_0x2846,0xd9));var _0x6284=function(_0x32819e,_0x1641bc){_0x32819e=_0x32819e-0x0;var _0x35bc86=_0x2846[_0x32819e];return _0x35bc86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6284('0x0'));var zipdir=require(_0x6284('0x1'));var jsonpatch=require(_0x6284('0x2'));var rp=require(_0x6284('0x3'));var moment=require('moment');var BPromise=require(_0x6284('0x4'));var Mustache=require(_0x6284('0x5'));var util=require('util');var path=require(_0x6284('0x6'));var sox=require(_0x6284('0x7'));var csv=require(_0x6284('0x8'));var ejs=require(_0x6284('0x9'));var fs=require('fs');var fs_extra=require(_0x6284('0xa'));var _=require(_0x6284('0xb'));var squel=require(_0x6284('0xc'));var crypto=require('crypto');var jsforce=require(_0x6284('0xd'));var deskjs=require(_0x6284('0xe'));var toCsv=require(_0x6284('0x8'));var querystring=require(_0x6284('0xf'));var Papa=require(_0x6284('0x10'));var Redis=require(_0x6284('0x11'));var authService=require(_0x6284('0x12'));var qs=require(_0x6284('0x13'));var as=require(_0x6284('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6284('0x15'))(_0x6284('0x16'));var utils=require(_0x6284('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6284('0x18'))['db'];config[_0x6284('0x19')]=_[_0x6284('0x1a')](config['redis'],{'host':_0x6284('0x1b'),'port':0x18eb});var socket=require(_0x6284('0x1c'))(new Redis(config[_0x6284('0x19')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x3b9206,_0x1fb90b){_0x1fb90b=_0x1fb90b||0xcc;return function(_0x20d9e1){if(_0x20d9e1){return _0x3b9206[_0x6284('0x1d')](_0x1fb90b);}return _0x3b9206[_0x6284('0x1e')](_0x1fb90b)[_0x6284('0x1f')]();};}function respondWithResult(_0x503f13,_0x1f1b8a){_0x1f1b8a=_0x1f1b8a||0xc8;return function(_0x319824){if(_0x319824){return _0x503f13[_0x6284('0x1e')](_0x1f1b8a)[_0x6284('0x20')](_0x319824);}};}function respondWithFilteredResult(_0x5ec90e,_0x3c1ea5){return function(_0x35e3a5){if(_0x35e3a5){var _0x4fb823=typeof _0x3c1ea5[_0x6284('0x21')]===_0x6284('0x22')&&typeof _0x3c1ea5['limit']===_0x6284('0x22');var _0x4559a4=_0x35e3a5[_0x6284('0x23')];var _0x2e8718=_0x4fb823?0x0:_0x3c1ea5[_0x6284('0x21')];var _0x60b073=_0x4fb823?_0x35e3a5[_0x6284('0x23')]:_0x3c1ea5['offset']+_0x3c1ea5[_0x6284('0x24')];var _0x5a1dce;if(_0x60b073>=_0x4559a4){_0x60b073=_0x4559a4;_0x5a1dce=0xc8;}else{_0x5a1dce=0xce;}_0x5ec90e[_0x6284('0x1e')](_0x5a1dce);return _0x5ec90e['set']('Content-Range',_0x2e8718+'-'+_0x60b073+'/'+_0x4559a4)[_0x6284('0x20')](_0x35e3a5);}return null;};}function patchUpdates(_0x5414d2){return function(_0x15bbe5){try{jsonpatch[_0x6284('0x25')](_0x15bbe5,_0x5414d2,!![]);}catch(_0xa3cb59){return BPromise[_0x6284('0x26')](_0xa3cb59);}return _0x15bbe5[_0x6284('0x27')]();};}function saveUpdates(_0x23ddba,_0x22e1d8){return function(_0x476bd9){if(_0x476bd9){return _0x476bd9['update'](_0x23ddba)[_0x6284('0x28')](function(_0x423163){return _0x423163;});}return null;};}function removeEntity(_0x273508,_0x880b31){return function(_0x27cb3c){if(_0x27cb3c){return _0x27cb3c['destroy']()[_0x6284('0x28')](function(){var _0xa87b11=_0x27cb3c[_0x6284('0x29')]({'plain':!![]});var _0x520aff='CustomDashboards';return db[_0x6284('0x2a')][_0x6284('0x2b')]({'where':{'type':_0x520aff,'resourceId':_0xa87b11['id']}})[_0x6284('0x28')](function(){return _0x27cb3c;});})[_0x6284('0x28')](function(){_0x273508[_0x6284('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ccb4,_0x1cf61b){return function(_0x576020){if(!_0x576020){_0x13ccb4[_0x6284('0x1d')](0x194);}return _0x576020;};}function handleError(_0x201bb3,_0x29b5d4){_0x29b5d4=_0x29b5d4||0x1f4;return function(_0x472fcd){logger[_0x6284('0x2c')](_0x472fcd[_0x6284('0x2d')]);if(_0x472fcd[_0x6284('0x2e')]){delete _0x472fcd['name'];}_0x201bb3[_0x6284('0x1e')](_0x29b5d4)['send'](_0x472fcd);};}exports[_0x6284('0x2f')]=function(_0x3b420d,_0x3fb7bf){var _0x27b01f={},_0x7e1fa0={},_0x42969d={'count':0x0,'rows':[]};var _0x39c359=_[_0x6284('0x30')](db[_0x6284('0x31')][_0x6284('0x32')],function(_0x3e75d4){return{'name':_0x3e75d4[_0x6284('0x33')],'type':_0x3e75d4['type'][_0x6284('0x34')]};});_0x7e1fa0[_0x6284('0x35')]=_['map'](_0x39c359,_0x6284('0x2e'));_0x7e1fa0[_0x6284('0x36')]=_[_0x6284('0x37')](_0x3b420d[_0x6284('0x36')]);_0x7e1fa0[_0x6284('0x38')]=_['intersection'](_0x7e1fa0[_0x6284('0x35')],_0x7e1fa0[_0x6284('0x36')]);_0x27b01f[_0x6284('0x39')]=_[_0x6284('0x3a')](_0x7e1fa0[_0x6284('0x35')],qs['fields'](_0x3b420d[_0x6284('0x36')]['fields']));_0x27b01f[_0x6284('0x39')]=_0x27b01f[_0x6284('0x39')]['length']?_0x27b01f[_0x6284('0x39')]:_0x7e1fa0[_0x6284('0x35')];if(!_0x3b420d[_0x6284('0x36')]['hasOwnProperty'](_0x6284('0x3b'))){_0x27b01f['limit']=qs['limit'](_0x3b420d[_0x6284('0x36')][_0x6284('0x24')]);_0x27b01f[_0x6284('0x21')]=qs[_0x6284('0x21')](_0x3b420d[_0x6284('0x36')][_0x6284('0x21')]);}_0x27b01f[_0x6284('0x3c')]=qs[_0x6284('0x3d')](_0x3b420d[_0x6284('0x36')][_0x6284('0x3d')]);_0x27b01f[_0x6284('0x3e')]=qs[_0x6284('0x38')](_[_0x6284('0x3f')](_0x3b420d[_0x6284('0x36')],_0x7e1fa0[_0x6284('0x38')]),_0x39c359);if(_0x3b420d['query'][_0x6284('0x40')]){_0x27b01f[_0x6284('0x3e')]=_[_0x6284('0x41')](_0x27b01f[_0x6284('0x3e')],{'$or':_[_0x6284('0x30')](_0x39c359,function(_0x51439d){if(_0x51439d[_0x6284('0x42')]!==_0x6284('0x43')){var _0x107bb1={};_0x107bb1[_0x51439d[_0x6284('0x2e')]]={'$like':'%'+_0x3b420d['query']['filter']+'%'};return _0x107bb1;}})});}_0x27b01f=_['merge']({},_0x27b01f,_0x3b420d[_0x6284('0x44')]);var _0x218065={'where':_0x27b01f[_0x6284('0x3e')]};return db[_0x6284('0x31')][_0x6284('0x23')](_0x218065)[_0x6284('0x28')](function(_0x37668d){_0x42969d[_0x6284('0x23')]=_0x37668d;if(_0x3b420d[_0x6284('0x36')][_0x6284('0x45')]){_0x27b01f[_0x6284('0x46')]=[{'all':!![]}];}return db[_0x6284('0x31')][_0x6284('0x47')](_0x27b01f);})[_0x6284('0x28')](function(_0x20b1ea){_0x42969d['rows']=_0x20b1ea;return _0x42969d;})[_0x6284('0x28')](respondWithFilteredResult(_0x3fb7bf,_0x27b01f))[_0x6284('0x48')](handleError(_0x3fb7bf,null));};exports[_0x6284('0x49')]=function(_0x3057fb,_0x55f1b9){var _0x2ba7b3={'raw':![],'where':{'id':_0x3057fb['params']['id']}},_0x3fa19b={};_0x3fa19b[_0x6284('0x35')]=_[_0x6284('0x37')](db[_0x6284('0x31')]['rawAttributes']);_0x3fa19b['query']=_[_0x6284('0x37')](_0x3057fb[_0x6284('0x36')]);_0x3fa19b[_0x6284('0x38')]=_[_0x6284('0x3a')](_0x3fa19b[_0x6284('0x35')],_0x3fa19b[_0x6284('0x36')]);_0x2ba7b3['attributes']=_[_0x6284('0x3a')](_0x3fa19b['model'],qs[_0x6284('0x4a')](_0x3057fb[_0x6284('0x36')][_0x6284('0x4a')]));_0x2ba7b3[_0x6284('0x39')]=_0x2ba7b3['attributes'][_0x6284('0x4b')]?_0x2ba7b3[_0x6284('0x39')]:_0x3fa19b['model'];if(_0x3057fb['query'][_0x6284('0x45')]){_0x2ba7b3['include']=[{'all':!![]}];}_0x2ba7b3=_[_0x6284('0x41')]({},_0x2ba7b3,_0x3057fb[_0x6284('0x44')]);return db[_0x6284('0x31')][_0x6284('0x4c')](_0x2ba7b3)[_0x6284('0x28')](handleEntityNotFound(_0x55f1b9,null))[_0x6284('0x28')](respondWithResult(_0x55f1b9,null))[_0x6284('0x48')](handleError(_0x55f1b9,null));};exports['create']=function(_0x2bc18a,_0x3c0d34){return db[_0x6284('0x31')][_0x6284('0x4d')](_0x2bc18a['body'],{})[_0x6284('0x28')](function(_0x154f6c){var _0x23e311=_0x2bc18a[_0x6284('0x4e')][_0x6284('0x29')]({'plain':!![]});if(!_0x23e311)throw new Error(_0x6284('0x4f'));if(_0x23e311['role']===_0x6284('0x4e')){var _0x35c267=_0x154f6c['get']({'plain':!![]});var _0x22f0d5=_0x6284('0x50');return db[_0x6284('0x51')][_0x6284('0x4c')]({'where':{'name':_0x22f0d5,'userProfileId':_0x23e311[_0x6284('0x52')]},'raw':!![]})[_0x6284('0x28')](function(_0x17aa90){if(_0x17aa90&&_0x17aa90[_0x6284('0x53')]===0x0){return db['UserProfileResource'][_0x6284('0x4d')]({'name':_0x35c267['name'],'resourceId':_0x35c267['id'],'type':_0x17aa90[_0x6284('0x2e')],'sectionId':_0x17aa90['id']},{})[_0x6284('0x28')](function(){return _0x154f6c;});}else{return _0x154f6c;}})[_0x6284('0x48')](function(_0x2ba392){logger[_0x6284('0x2c')](_0x6284('0x54'),_0x2ba392);throw _0x2ba392;});}return _0x154f6c;})['then'](respondWithResult(_0x3c0d34,0xc9))[_0x6284('0x48')](handleError(_0x3c0d34,null));};exports[_0x6284('0x55')]=function(_0x38b96c,_0x17ace8){var _0x4327bb={'where':{'id':_0x38b96c[_0x6284('0x56')]['id']}},_0x393215={};_0x393215[_0x6284('0x35')]=_[_0x6284('0x37')](db[_0x6284('0x31')][_0x6284('0x32')]);_0x4327bb[_0x6284('0x39')]=_[_0x6284('0x3a')](_0x393215[_0x6284('0x35')],qs[_0x6284('0x4a')](_0x38b96c['query'][_0x6284('0x4a')]));_0x4327bb['attributes']=_0x4327bb['attributes'][_0x6284('0x4b')]?_0x4327bb[_0x6284('0x39')]:_0x393215[_0x6284('0x35')];if(_0x38b96c[_0x6284('0x36')][_0x6284('0x45')]){_0x4327bb['include']=[{'all':!![]}];}_0x4327bb=_[_0x6284('0x41')]({},_0x4327bb,_0x38b96c[_0x6284('0x44')]);return db['Dashboard'][_0x6284('0x4c')](_0x4327bb)[_0x6284('0x28')](handleEntityNotFound(_0x17ace8,null))[_0x6284('0x28')](function(_0x39f566){if(_0x39f566){var _0x1b8c4d=_0x39f566[_0x6284('0x29')]({'plain':!![]});_0x1b8c4d=qs[_0x6284('0x57')](_0x1b8c4d,['id',_0x6284('0x58'),_0x6284('0x59')]);_0x38b96c[_0x6284('0x5a')]=_['omit'](_0x38b96c[_0x6284('0x5a')],['id',_0x6284('0x58'),'updatedAt']);return db[_0x6284('0x31')][_0x6284('0x4d')](_[_0x6284('0x41')](_0x1b8c4d,_0x38b96c[_0x6284('0x5a')]),{'include':_0x38b96c['query'][_0x6284('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x77f47b){var _0x262aef=_0x38b96c[_0x6284('0x4e')][_0x6284('0x29')]({'plain':!![]});if(!_0x262aef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x262aef['role']===_0x6284('0x4e')){var _0x161daa=_0x77f47b[_0x6284('0x29')]({'plain':!![]});var _0x1ab4cc=_0x6284('0x50');return db[_0x6284('0x51')][_0x6284('0x4c')]({'where':{'name':_0x1ab4cc,'userProfileId':_0x262aef['userProfileId']},'raw':!![]})[_0x6284('0x28')](function(_0x28213c){if(_0x28213c&&_0x28213c[_0x6284('0x53')]===0x0){return db[_0x6284('0x2a')][_0x6284('0x4d')]({'name':_0x161daa[_0x6284('0x2e')],'resourceId':_0x161daa['id'],'type':_0x28213c[_0x6284('0x2e')],'sectionId':_0x28213c['id']},{})[_0x6284('0x28')](function(){return _0x77f47b;});}else{return _0x77f47b;}})['catch'](function(_0xc2b83c){logger['error'](_0x6284('0x54'),_0xc2b83c);throw _0xc2b83c;});}return _0x77f47b;});}})['then'](respondWithResult(_0x17ace8,0xc9))['catch'](handleError(_0x17ace8,null));};exports[_0x6284('0x5b')]=function(_0x2cda39,_0x4e62db){if(_0x2cda39[_0x6284('0x5a')]['id']){delete _0x2cda39[_0x6284('0x5a')]['id'];}return db[_0x6284('0x31')]['find']({'where':{'id':_0x2cda39[_0x6284('0x56')]['id']}})[_0x6284('0x28')](handleEntityNotFound(_0x4e62db,null))[_0x6284('0x28')](saveUpdates(_0x2cda39[_0x6284('0x5a')],null))[_0x6284('0x28')](respondWithResult(_0x4e62db,null))[_0x6284('0x48')](handleError(_0x4e62db,null));};exports[_0x6284('0x2b')]=function(_0x47efc7,_0x58c338){return db[_0x6284('0x31')][_0x6284('0x4c')]({'where':{'id':_0x47efc7[_0x6284('0x56')]['id']}})['then'](handleEntityNotFound(_0x58c338,null))[_0x6284('0x28')](removeEntity(_0x58c338,null))[_0x6284('0x48')](handleError(_0x58c338,null));};function widgetAttributes(_0xf32129){try{switch(_0xf32129['type']){case _0x6284('0x5c'):return[{'name':_0x6284('0x5d'),'value':_0xf32129[_0x6284('0x5d')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x0]?_0xf32129['attrs'][0x0]['value']:undefined)||_0x6284('0x5f')}];case _0x6284('0x60'):return[{'name':_0x6284('0x61'),'value':_0xf32129['attrPath']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x0]?_0xf32129['attrs'][0x0][_0x6284('0x62')]:undefined)||''}];case _0x6284('0x63'):return[{'name':_0x6284('0x64'),'value':_0xf32129['attrHourFormat']||(_0xf32129['attrs']&&_0xf32129['attrs'][0x0]?_0xf32129[_0x6284('0x5e')][0x0]['value']:undefined)||_0x6284('0x65')},{'name':'attrTimezone','value':_0xf32129[_0x6284('0x66')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x1]?_0xf32129[_0x6284('0x5e')][0x1][_0x6284('0x62')]:undefined)||_0x6284('0x67')},{'name':'attrFontSize','value':_0xf32129[_0x6284('0x68')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x2]?_0xf32129[_0x6284('0x5e')][0x2][_0x6284('0x62')]:undefined)||0xc}];case _0x6284('0x69'):return[{'name':_0x6284('0x6a'),'value':_0xf32129[_0x6284('0x6a')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x0]?_0xf32129[_0x6284('0x5e')][0x0][_0x6284('0x62')]:undefined)||_0x6284('0x6b')},{'name':_0x6284('0x6c'),'value':_0xf32129[_0x6284('0x6c')]||(_0xf32129['attrs']&&_0xf32129['attrs'][0x1]?_0xf32129[_0x6284('0x5e')][0x1][_0x6284('0x62')]:undefined)||[]},{'name':'attrFontSize','value':_0xf32129[_0x6284('0x68')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x2]?_0xf32129[_0x6284('0x5e')][0x2][_0x6284('0x62')]:undefined)||0x14},{'name':_0x6284('0x6d'),'value':_0xf32129['attrChannel']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x3]?_0xf32129[_0x6284('0x5e')][0x3]['value']:undefined)||_0x6284('0x6e')},{'name':_0x6284('0x6f'),'value':_0xf32129[_0x6284('0x6f')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x4]?_0xf32129['attrs'][0x4][_0x6284('0x62')]:undefined)||''},{'name':_0x6284('0x70'),'value':_0xf32129[_0x6284('0x70')]||(_0xf32129['attrs']&&_0xf32129[_0x6284('0x5e')][0x5]?_0xf32129['attrs'][0x5][_0x6284('0x62')]:undefined)||''},{'name':_0x6284('0x71'),'value':_0xf32129[_0x6284('0x71')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x6]?_0xf32129[_0x6284('0x5e')][0x6][_0x6284('0x62')]:undefined)||''},{'name':_0x6284('0x72'),'value':_0xf32129[_0x6284('0x72')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x7]?_0xf32129['attrs'][0x7][_0x6284('0x62')]:undefined)||''},{'name':_0x6284('0x73'),'value':_0xf32129['attrWhatsappAccounts']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x8]?_0xf32129[_0x6284('0x5e')][0x8][_0x6284('0x62')]:undefined)||''},{'name':'attrChatWebsites','value':_0xf32129[_0x6284('0x74')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x9]?_0xf32129[_0x6284('0x5e')][0x9]['value']:undefined)||''}];case _0x6284('0x75'):case _0x6284('0x76'):return[{'name':_0x6284('0x77'),'value':_0xf32129[_0x6284('0x77')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x0]?_0xf32129[_0x6284('0x5e')][0x0]['value']:undefined)||_0x6284('0x6b')},{'name':_0x6284('0x78'),'value':_0xf32129[_0x6284('0x78')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x1]?_0xf32129[_0x6284('0x5e')][0x1][_0x6284('0x62')]:undefined)||null},{'name':_0x6284('0x79'),'value':_0xf32129[_0x6284('0x79')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x2]?_0xf32129[_0x6284('0x5e')][0x2][_0x6284('0x62')]:undefined)||null},{'name':_0x6284('0x6c'),'value':_0xf32129[_0x6284('0x6c')]||(_0xf32129['attrs']&&_0xf32129[_0x6284('0x5e')][0x3]?_0xf32129[_0x6284('0x5e')][0x3]['value']:undefined)||[]},{'name':_0x6284('0x6d'),'value':_0xf32129['attrChannel']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x4]?_0xf32129[_0x6284('0x5e')][0x4][_0x6284('0x62')]:undefined)||_0x6284('0x6e')},{'name':_0x6284('0x6f'),'value':_0xf32129['attrEmailAccounts']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x5]?_0xf32129[_0x6284('0x5e')][0x5][_0x6284('0x62')]:undefined)||''},{'name':_0x6284('0x70'),'value':_0xf32129[_0x6284('0x70')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x6]?_0xf32129[_0x6284('0x5e')][0x6]['value']:undefined)||''},{'name':_0x6284('0x71'),'value':_0xf32129[_0x6284('0x71')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x7]?_0xf32129['attrs'][0x7][_0x6284('0x62')]:undefined)||''},{'name':_0x6284('0x72'),'value':_0xf32129['attrOpenchannelAccounts']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x8]?_0xf32129['attrs'][0x8][_0x6284('0x62')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xf32129['attrWhatsappAccounts']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x9]?_0xf32129['attrs'][0x9]['value']:undefined)||''},{'name':_0x6284('0x74'),'value':_0xf32129[_0x6284('0x74')]||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0xa]?_0xf32129['attrs'][0xa][_0x6284('0x62')]:undefined)||''}];case _0x6284('0x7a'):return[{'name':_0x6284('0x7b'),'type':_0xf32129['reportType']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129[_0x6284('0x5e')][0x0]?_0xf32129[_0x6284('0x5e')][0x0]['type']:undefined)||null,'value':_0xf32129['attrReport']||(_0xf32129[_0x6284('0x5e')]&&_0xf32129['attrs'][0x0]?_0xf32129[_0x6284('0x5e')][0x0][_0x6284('0x62')]:undefined)||null},{'name':'attrRefresh','value':_0xf32129[_0x6284('0x7c')]||(_0xf32129['attrs']&&_0xf32129[_0x6284('0x5e')][0x1]?_0xf32129['attrs'][0x1][_0x6284('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x39e186){logger['error'](_0x6284('0x7d'),JSON[_0x6284('0x7e')](_0x39e186));return[];}}exports[_0x6284('0x7f')]=function(_0x23caaa,_0x532799,_0x189ca8){if(_0x23caaa[_0x6284('0x5a')]['id']){delete _0x23caaa[_0x6284('0x5a')]['id'];}return db[_0x6284('0x31')][_0x6284('0x4c')]({'where':{'id':_0x23caaa[_0x6284('0x56')]['id']}})['then'](handleEntityNotFound(_0x532799,null))[_0x6284('0x28')](function(_0x236cf0){if(_0x236cf0){_0x23caaa['body'][_0x6284('0x80')]=_0x236cf0['id'];_0x23caaa['body']['attrs']=widgetAttributes(_0x23caaa[_0x6284('0x5a')]);return db['DashboardItem'][_0x6284('0x4d')](_0x23caaa[_0x6284('0x5a')]);}})[_0x6284('0x28')](respondWithResult(_0x532799,null))['catch'](handleError(_0x532799,null));};exports['getItems']=function(_0x2f79fd,_0x5ab088,_0xdf9b2c){var _0x5855f4={};var _0x328717={};var _0x5e1d7a;var _0x37e3bf;return db[_0x6284('0x31')][_0x6284('0x81')]({'where':{'id':_0x2f79fd[_0x6284('0x56')]['id']}})[_0x6284('0x28')](handleEntityNotFound(_0x5ab088,null))['then'](function(_0x5da259){if(_0x5da259){_0x5e1d7a=_0x5da259;_0x328717[_0x6284('0x35')]=_['keys'](db['DashboardItem']['rawAttributes']);_0x328717['query']=_[_0x6284('0x37')](_0x2f79fd['query']);_0x328717['filters']=_[_0x6284('0x3a')](_0x328717[_0x6284('0x35')],_0x328717[_0x6284('0x36')]);_0x5855f4['attributes']=_[_0x6284('0x3a')](_0x328717[_0x6284('0x35')],qs[_0x6284('0x4a')](_0x2f79fd[_0x6284('0x36')][_0x6284('0x4a')]));_0x5855f4[_0x6284('0x39')]=_0x5855f4[_0x6284('0x39')][_0x6284('0x4b')]?_0x5855f4[_0x6284('0x39')]:_0x328717[_0x6284('0x35')];_0x5855f4['order']=qs[_0x6284('0x3d')](_0x2f79fd[_0x6284('0x36')][_0x6284('0x3d')]);_0x5855f4['where']=qs['filters'](_[_0x6284('0x3f')](_0x2f79fd[_0x6284('0x36')],_0x328717[_0x6284('0x38')]));if(_0x2f79fd[_0x6284('0x36')][_0x6284('0x40')]){_0x5855f4[_0x6284('0x3e')]=_[_0x6284('0x41')](_0x5855f4[_0x6284('0x3e')],{'$or':_[_0x6284('0x30')](_0x5855f4[_0x6284('0x39')],function(_0x231c98){var _0x5102b0={};_0x5102b0[_0x231c98]={'$like':'%'+_0x2f79fd['query'][_0x6284('0x40')]+'%'};return _0x5102b0;})});}_0x5855f4=_[_0x6284('0x41')]({},_0x5855f4,_0x2f79fd[_0x6284('0x44')]);return _0x5e1d7a['getItems'](_0x5855f4);}})['then'](function(_0x4eca24){if(_0x4eca24){_0x37e3bf=_0x4eca24['length'];if(!_0x2f79fd['query']['hasOwnProperty'](_0x6284('0x3b'))){_0x5855f4[_0x6284('0x24')]=qs[_0x6284('0x24')](_0x2f79fd[_0x6284('0x36')][_0x6284('0x24')]);_0x5855f4['offset']=qs[_0x6284('0x21')](_0x2f79fd[_0x6284('0x36')][_0x6284('0x21')]);}return _0x5e1d7a[_0x6284('0x82')](_0x5855f4);}})[_0x6284('0x28')](function(_0x181639){if(_0x181639){return _0x181639?{'count':_0x37e3bf,'rows':_0x181639}:null;}})[_0x6284('0x28')](respondWithResult(_0x5ab088,null))[_0x6284('0x48')](handleError(_0x5ab088,null));}; \ No newline at end of file +var _0x2c2d=['attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','sort','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','name','send','map','Dashboard','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','userProfileId','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','total'];(function(_0x34f0d7,_0x3a8f44){var _0x32fa12=function(_0x5cd4d0){while(--_0x5cd4d0){_0x34f0d7['push'](_0x34f0d7['shift']());}};_0x32fa12(++_0x3a8f44);}(_0x2c2d,0x96));var _0xd2c2=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x2c2d[_0x20589d];return _0x422de9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd2c2('0x0'));var zipdir=require(_0xd2c2('0x1'));var jsonpatch=require(_0xd2c2('0x2'));var rp=require(_0xd2c2('0x3'));var moment=require(_0xd2c2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd2c2('0x5'));var util=require(_0xd2c2('0x6'));var path=require('path');var sox=require(_0xd2c2('0x7'));var csv=require(_0xd2c2('0x8'));var ejs=require(_0xd2c2('0x9'));var fs=require('fs');var fs_extra=require(_0xd2c2('0xa'));var _=require(_0xd2c2('0xb'));var squel=require(_0xd2c2('0xc'));var crypto=require('crypto');var jsforce=require(_0xd2c2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd2c2('0xe'));var Papa=require(_0xd2c2('0xf'));var Redis=require('ioredis');var authService=require(_0xd2c2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd2c2('0x11'));var logger=require(_0xd2c2('0x12'))(_0xd2c2('0x13'));var utils=require(_0xd2c2('0x14'));var config=require(_0xd2c2('0x15'));var licenseUtil=require(_0xd2c2('0x16'));var db=require(_0xd2c2('0x17'))['db'];config[_0xd2c2('0x18')]=_[_0xd2c2('0x19')](config[_0xd2c2('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd2c2('0x1a'))(new Redis(config[_0xd2c2('0x18')]));require(_0xd2c2('0x1b'))['register'](socket);function respondWithStatusCode(_0x37f093,_0x1a006c){_0x1a006c=_0x1a006c||0xcc;return function(_0x5a3105){if(_0x5a3105){return _0x37f093[_0xd2c2('0x1c')](_0x1a006c);}return _0x37f093[_0xd2c2('0x1d')](_0x1a006c)[_0xd2c2('0x1e')]();};}function respondWithResult(_0x487f00,_0x4513b6){_0x4513b6=_0x4513b6||0xc8;return function(_0xa88ad7){if(_0xa88ad7){return _0x487f00['status'](_0x4513b6)[_0xd2c2('0x1f')](_0xa88ad7);}};}function respondWithFilteredResult(_0x551bcc,_0x3f4365){return function(_0x4eb810){if(_0x4eb810){var _0x395b7b=typeof _0x3f4365['offset']===_0xd2c2('0x20')&&typeof _0x3f4365[_0xd2c2('0x21')]===_0xd2c2('0x20');var _0x12f0a9=_0x4eb810[_0xd2c2('0x22')];var _0x5e260a=_0x395b7b?0x0:_0x3f4365[_0xd2c2('0x23')];var _0x3cf0ff=_0x395b7b?_0x4eb810[_0xd2c2('0x22')]:_0x3f4365[_0xd2c2('0x23')]+_0x3f4365[_0xd2c2('0x21')];var _0xf4963f;if(_0x3cf0ff>=_0x12f0a9){_0x3cf0ff=_0x12f0a9;_0xf4963f=0xc8;}else{_0xf4963f=0xce;}_0x551bcc[_0xd2c2('0x1d')](_0xf4963f);return _0x551bcc[_0xd2c2('0x24')]('Content-Range',_0x5e260a+'-'+_0x3cf0ff+'/'+_0x12f0a9)[_0xd2c2('0x1f')](_0x4eb810);}return null;};}function patchUpdates(_0x32dd81){return function(_0xd56a9a){try{jsonpatch['apply'](_0xd56a9a,_0x32dd81,!![]);}catch(_0x115cd5){return BPromise[_0xd2c2('0x25')](_0x115cd5);}return _0xd56a9a[_0xd2c2('0x26')]();};}function saveUpdates(_0x2bf921,_0x872894){return function(_0xb6b33a){if(_0xb6b33a){return _0xb6b33a['update'](_0x2bf921)[_0xd2c2('0x27')](function(_0x3681f0){return _0x3681f0;});}return null;};}function removeEntity(_0x56f2b2,_0x456684){return function(_0x406922){if(_0x406922){return _0x406922[_0xd2c2('0x28')]()['then'](function(){var _0x433691=_0x406922[_0xd2c2('0x29')]({'plain':!![]});var _0x286c96=_0xd2c2('0x2a');return db[_0xd2c2('0x2b')]['destroy']({'where':{'type':_0x286c96,'resourceId':_0x433691['id']}})[_0xd2c2('0x27')](function(){return _0x406922;});})[_0xd2c2('0x27')](function(){_0x56f2b2[_0xd2c2('0x1d')](0xcc)[_0xd2c2('0x1e')]();});}};}function handleEntityNotFound(_0xbb9437,_0x18cadb){return function(_0x179bb4){if(!_0x179bb4){_0xbb9437[_0xd2c2('0x1c')](0x194);}return _0x179bb4;};}function handleError(_0x3b0ac0,_0x50f5f1){_0x50f5f1=_0x50f5f1||0x1f4;return function(_0x420bce){logger['error'](_0x420bce['stack']);if(_0x420bce[_0xd2c2('0x2c')]){delete _0x420bce[_0xd2c2('0x2c')];}_0x3b0ac0[_0xd2c2('0x1d')](_0x50f5f1)[_0xd2c2('0x2d')](_0x420bce);};}exports['index']=function(_0x83e724,_0x159f54){var _0x517420={},_0x191881={},_0x1064eb={'count':0x0,'rows':[]};var _0x509ac4=_[_0xd2c2('0x2e')](db[_0xd2c2('0x2f')][_0xd2c2('0x30')],function(_0x12a931){return{'name':_0x12a931[_0xd2c2('0x31')],'type':_0x12a931['type'][_0xd2c2('0x32')]};});_0x191881[_0xd2c2('0x33')]=_[_0xd2c2('0x2e')](_0x509ac4,_0xd2c2('0x2c'));_0x191881[_0xd2c2('0x34')]=_[_0xd2c2('0x35')](_0x83e724[_0xd2c2('0x34')]);_0x191881[_0xd2c2('0x36')]=_[_0xd2c2('0x37')](_0x191881[_0xd2c2('0x33')],_0x191881[_0xd2c2('0x34')]);_0x517420[_0xd2c2('0x38')]=_[_0xd2c2('0x37')](_0x191881[_0xd2c2('0x33')],qs[_0xd2c2('0x39')](_0x83e724[_0xd2c2('0x34')]['fields']));_0x517420[_0xd2c2('0x38')]=_0x517420['attributes'][_0xd2c2('0x3a')]?_0x517420[_0xd2c2('0x38')]:_0x191881[_0xd2c2('0x33')];if(!_0x83e724[_0xd2c2('0x34')][_0xd2c2('0x3b')](_0xd2c2('0x3c'))){_0x517420['limit']=qs[_0xd2c2('0x21')](_0x83e724[_0xd2c2('0x34')][_0xd2c2('0x21')]);_0x517420[_0xd2c2('0x23')]=qs['offset'](_0x83e724[_0xd2c2('0x34')][_0xd2c2('0x23')]);}_0x517420[_0xd2c2('0x3d')]=qs['sort'](_0x83e724[_0xd2c2('0x34')]['sort']);_0x517420[_0xd2c2('0x3e')]=qs[_0xd2c2('0x36')](_[_0xd2c2('0x3f')](_0x83e724['query'],_0x191881[_0xd2c2('0x36')]),_0x509ac4);if(_0x83e724[_0xd2c2('0x34')][_0xd2c2('0x40')]){_0x517420[_0xd2c2('0x3e')]=_['merge'](_0x517420['where'],{'$or':_['map'](_0x509ac4,function(_0x5a8c0e){if(_0x5a8c0e[_0xd2c2('0x41')]!==_0xd2c2('0x42')){var _0x1b98c6={};_0x1b98c6[_0x5a8c0e['name']]={'$like':'%'+_0x83e724[_0xd2c2('0x34')][_0xd2c2('0x40')]+'%'};return _0x1b98c6;}})});}_0x517420=_[_0xd2c2('0x43')]({},_0x517420,_0x83e724[_0xd2c2('0x44')]);var _0x35f566={'where':_0x517420[_0xd2c2('0x3e')]};return db['Dashboard'][_0xd2c2('0x22')](_0x35f566)[_0xd2c2('0x27')](function(_0x87837b){_0x1064eb[_0xd2c2('0x22')]=_0x87837b;if(_0x83e724[_0xd2c2('0x34')][_0xd2c2('0x45')]){_0x517420[_0xd2c2('0x46')]=[{'all':!![]}];}return db[_0xd2c2('0x2f')][_0xd2c2('0x47')](_0x517420);})[_0xd2c2('0x27')](function(_0x28563e){_0x1064eb[_0xd2c2('0x48')]=_0x28563e;return _0x1064eb;})[_0xd2c2('0x27')](respondWithFilteredResult(_0x159f54,_0x517420))['catch'](handleError(_0x159f54,null));};exports[_0xd2c2('0x49')]=function(_0x51740b,_0x5dc1fb){var _0x394f0a={'raw':![],'where':{'id':_0x51740b[_0xd2c2('0x4a')]['id']}},_0x2e41fa={};_0x2e41fa[_0xd2c2('0x33')]=_['keys'](db[_0xd2c2('0x2f')][_0xd2c2('0x30')]);_0x2e41fa[_0xd2c2('0x34')]=_['keys'](_0x51740b[_0xd2c2('0x34')]);_0x2e41fa[_0xd2c2('0x36')]=_[_0xd2c2('0x37')](_0x2e41fa[_0xd2c2('0x33')],_0x2e41fa[_0xd2c2('0x34')]);_0x394f0a['attributes']=_[_0xd2c2('0x37')](_0x2e41fa[_0xd2c2('0x33')],qs['fields'](_0x51740b[_0xd2c2('0x34')]['fields']));_0x394f0a[_0xd2c2('0x38')]=_0x394f0a[_0xd2c2('0x38')][_0xd2c2('0x3a')]?_0x394f0a[_0xd2c2('0x38')]:_0x2e41fa['model'];if(_0x51740b[_0xd2c2('0x34')][_0xd2c2('0x45')]){_0x394f0a['include']=[{'all':!![]}];}_0x394f0a=_['merge']({},_0x394f0a,_0x51740b['options']);return db[_0xd2c2('0x2f')][_0xd2c2('0x4b')](_0x394f0a)['then'](handleEntityNotFound(_0x5dc1fb,null))[_0xd2c2('0x27')](respondWithResult(_0x5dc1fb,null))[_0xd2c2('0x4c')](handleError(_0x5dc1fb,null));};exports[_0xd2c2('0x4d')]=function(_0x5d4e83,_0x18d1c3){return db[_0xd2c2('0x2f')][_0xd2c2('0x4d')](_0x5d4e83[_0xd2c2('0x4e')],{})[_0xd2c2('0x27')](function(_0x205434){var _0x5b641d=_0x5d4e83['user']['get']({'plain':!![]});if(!_0x5b641d)throw new Error(_0xd2c2('0x4f'));if(_0x5b641d['role']===_0xd2c2('0x50')){var _0x5f3589=_0x205434['get']({'plain':!![]});var _0x309952='CustomDashboards';return db[_0xd2c2('0x51')][_0xd2c2('0x4b')]({'where':{'name':_0x309952,'userProfileId':_0x5b641d['userProfileId']},'raw':!![]})[_0xd2c2('0x27')](function(_0x2f9324){if(_0x2f9324&&_0x2f9324[_0xd2c2('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x5f3589[_0xd2c2('0x2c')],'resourceId':_0x5f3589['id'],'type':_0x2f9324['name'],'sectionId':_0x2f9324['id']},{})[_0xd2c2('0x27')](function(){return _0x205434;});}else{return _0x205434;}})[_0xd2c2('0x4c')](function(_0x1099ed){logger[_0xd2c2('0x53')](_0xd2c2('0x54'),_0x1099ed);throw _0x1099ed;});}return _0x205434;})['then'](respondWithResult(_0x18d1c3,0xc9))['catch'](handleError(_0x18d1c3,null));};exports[_0xd2c2('0x55')]=function(_0x14590c,_0x3058e3){var _0x568e05={'where':{'id':_0x14590c[_0xd2c2('0x4a')]['id']}},_0x5e74a7={};_0x5e74a7[_0xd2c2('0x33')]=_['keys'](db[_0xd2c2('0x2f')][_0xd2c2('0x30')]);_0x568e05['attributes']=_['intersection'](_0x5e74a7['model'],qs['fields'](_0x14590c[_0xd2c2('0x34')][_0xd2c2('0x39')]));_0x568e05[_0xd2c2('0x38')]=_0x568e05[_0xd2c2('0x38')][_0xd2c2('0x3a')]?_0x568e05[_0xd2c2('0x38')]:_0x5e74a7[_0xd2c2('0x33')];if(_0x14590c['query']['includeAll']){_0x568e05[_0xd2c2('0x46')]=[{'all':!![]}];}_0x568e05=_[_0xd2c2('0x43')]({},_0x568e05,_0x14590c[_0xd2c2('0x44')]);return db[_0xd2c2('0x2f')][_0xd2c2('0x4b')](_0x568e05)['then'](handleEntityNotFound(_0x3058e3,null))[_0xd2c2('0x27')](function(_0x1bda85){if(_0x1bda85){var _0x28441b=_0x1bda85[_0xd2c2('0x29')]({'plain':!![]});_0x28441b=qs[_0xd2c2('0x56')](_0x28441b,['id',_0xd2c2('0x57'),'updatedAt']);_0x14590c[_0xd2c2('0x4e')]=_[_0xd2c2('0x56')](_0x14590c[_0xd2c2('0x4e')],['id',_0xd2c2('0x57'),_0xd2c2('0x58')]);return db[_0xd2c2('0x2f')]['create'](_['merge'](_0x28441b,_0x14590c[_0xd2c2('0x4e')]),{'include':_0x14590c[_0xd2c2('0x34')][_0xd2c2('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x1b79a5){var _0x49a4fa=_0x14590c[_0xd2c2('0x50')][_0xd2c2('0x29')]({'plain':!![]});if(!_0x49a4fa)throw new Error(_0xd2c2('0x4f'));if(_0x49a4fa[_0xd2c2('0x59')]===_0xd2c2('0x50')){var _0x2ee21c=_0x1b79a5[_0xd2c2('0x29')]({'plain':!![]});var _0x3a95ef=_0xd2c2('0x2a');return db[_0xd2c2('0x51')][_0xd2c2('0x4b')]({'where':{'name':_0x3a95ef,'userProfileId':_0x49a4fa[_0xd2c2('0x5a')]},'raw':!![]})['then'](function(_0x4f689e){if(_0x4f689e&&_0x4f689e[_0xd2c2('0x52')]===0x0){return db[_0xd2c2('0x2b')][_0xd2c2('0x4d')]({'name':_0x2ee21c[_0xd2c2('0x2c')],'resourceId':_0x2ee21c['id'],'type':_0x4f689e['name'],'sectionId':_0x4f689e['id']},{})[_0xd2c2('0x27')](function(){return _0x1b79a5;});}else{return _0x1b79a5;}})[_0xd2c2('0x4c')](function(_0x47d9e9){logger[_0xd2c2('0x53')](_0xd2c2('0x54'),_0x47d9e9);throw _0x47d9e9;});}return _0x1b79a5;});}})[_0xd2c2('0x27')](respondWithResult(_0x3058e3,0xc9))[_0xd2c2('0x4c')](handleError(_0x3058e3,null));};exports['update']=function(_0x56e072,_0x4cd297){if(_0x56e072[_0xd2c2('0x4e')]['id']){delete _0x56e072[_0xd2c2('0x4e')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x56e072[_0xd2c2('0x4a')]['id']}})[_0xd2c2('0x27')](handleEntityNotFound(_0x4cd297,null))['then'](saveUpdates(_0x56e072['body'],null))[_0xd2c2('0x27')](respondWithResult(_0x4cd297,null))['catch'](handleError(_0x4cd297,null));};exports[_0xd2c2('0x28')]=function(_0x10a387,_0x34c461){return db[_0xd2c2('0x2f')]['find']({'where':{'id':_0x10a387[_0xd2c2('0x4a')]['id']}})[_0xd2c2('0x27')](handleEntityNotFound(_0x34c461,null))[_0xd2c2('0x27')](removeEntity(_0x34c461,null))[_0xd2c2('0x4c')](handleError(_0x34c461,null));};function widgetAttributes(_0x110517){try{switch(_0x110517[_0xd2c2('0x41')]){case _0xd2c2('0x5b'):return[{'name':_0xd2c2('0x5c'),'value':_0x110517[_0xd2c2('0x5c')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x0]?_0x110517[_0xd2c2('0x5d')][0x0][_0xd2c2('0x5e')]:undefined)||_0xd2c2('0x5f')}];case _0xd2c2('0x60'):return[{'name':_0xd2c2('0x61'),'value':_0x110517[_0xd2c2('0x61')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x0]?_0x110517[_0xd2c2('0x5d')][0x0][_0xd2c2('0x5e')]:undefined)||''}];case _0xd2c2('0x62'):return[{'name':_0xd2c2('0x63'),'value':_0x110517[_0xd2c2('0x63')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x0]?_0x110517[_0xd2c2('0x5d')][0x0][_0xd2c2('0x5e')]:undefined)||_0xd2c2('0x64')},{'name':'attrTimezone','value':_0x110517['attrTimezone']||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x1]?_0x110517['attrs'][0x1][_0xd2c2('0x5e')]:undefined)||_0xd2c2('0x65')},{'name':_0xd2c2('0x66'),'value':_0x110517[_0xd2c2('0x66')]||(_0x110517['attrs']&&_0x110517[_0xd2c2('0x5d')][0x2]?_0x110517['attrs'][0x2][_0xd2c2('0x5e')]:undefined)||0xc}];case _0xd2c2('0x67'):return[{'name':_0xd2c2('0x68'),'value':_0x110517[_0xd2c2('0x68')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x0]?_0x110517['attrs'][0x0][_0xd2c2('0x5e')]:undefined)||_0xd2c2('0x69')},{'name':_0xd2c2('0x6a'),'value':_0x110517[_0xd2c2('0x6a')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x1]?_0x110517[_0xd2c2('0x5d')][0x1][_0xd2c2('0x5e')]:undefined)||[]},{'name':_0xd2c2('0x66'),'value':_0x110517[_0xd2c2('0x66')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x2]?_0x110517[_0xd2c2('0x5d')][0x2]['value']:undefined)||0x14},{'name':_0xd2c2('0x6b'),'value':_0x110517[_0xd2c2('0x6b')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x3]?_0x110517[_0xd2c2('0x5d')][0x3][_0xd2c2('0x5e')]:undefined)||_0xd2c2('0x6c')},{'name':_0xd2c2('0x6d'),'value':_0x110517[_0xd2c2('0x6d')]||(_0x110517['attrs']&&_0x110517[_0xd2c2('0x5d')][0x4]?_0x110517[_0xd2c2('0x5d')][0x4][_0xd2c2('0x5e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x110517[_0xd2c2('0x6e')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x5]?_0x110517['attrs'][0x5][_0xd2c2('0x5e')]:undefined)||''},{'name':_0xd2c2('0x6f'),'value':_0x110517[_0xd2c2('0x6f')]||(_0x110517['attrs']&&_0x110517[_0xd2c2('0x5d')][0x6]?_0x110517[_0xd2c2('0x5d')][0x6][_0xd2c2('0x5e')]:undefined)||''},{'name':_0xd2c2('0x70'),'value':_0x110517[_0xd2c2('0x70')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x7]?_0x110517[_0xd2c2('0x5d')][0x7][_0xd2c2('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x110517['attrWhatsappAccounts']||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x8]?_0x110517['attrs'][0x8][_0xd2c2('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x110517[_0xd2c2('0x71')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x9]?_0x110517[_0xd2c2('0x5d')][0x9][_0xd2c2('0x5e')]:undefined)||''}];case _0xd2c2('0x72'):case _0xd2c2('0x73'):return[{'name':_0xd2c2('0x74'),'value':_0x110517['attrSerie1']||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x0]?_0x110517['attrs'][0x0][_0xd2c2('0x5e')]:undefined)||_0xd2c2('0x69')},{'name':_0xd2c2('0x75'),'value':_0x110517[_0xd2c2('0x75')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x1]?_0x110517[_0xd2c2('0x5d')][0x1]['value']:undefined)||null},{'name':_0xd2c2('0x76'),'value':_0x110517[_0xd2c2('0x76')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x2]?_0x110517[_0xd2c2('0x5d')][0x2][_0xd2c2('0x5e')]:undefined)||null},{'name':_0xd2c2('0x6a'),'value':_0x110517['attrVoiceQueues']||(_0x110517['attrs']&&_0x110517[_0xd2c2('0x5d')][0x3]?_0x110517[_0xd2c2('0x5d')][0x3][_0xd2c2('0x5e')]:undefined)||[]},{'name':_0xd2c2('0x6b'),'value':_0x110517[_0xd2c2('0x6b')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x4]?_0x110517[_0xd2c2('0x5d')][0x4][_0xd2c2('0x5e')]:undefined)||_0xd2c2('0x6c')},{'name':'attrEmailAccounts','value':_0x110517[_0xd2c2('0x6d')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x5]?_0x110517[_0xd2c2('0x5d')][0x5][_0xd2c2('0x5e')]:undefined)||''},{'name':_0xd2c2('0x6e'),'value':_0x110517[_0xd2c2('0x6e')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x6]?_0x110517[_0xd2c2('0x5d')][0x6][_0xd2c2('0x5e')]:undefined)||''},{'name':_0xd2c2('0x6f'),'value':_0x110517[_0xd2c2('0x6f')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x7]?_0x110517['attrs'][0x7][_0xd2c2('0x5e')]:undefined)||''},{'name':_0xd2c2('0x70'),'value':_0x110517[_0xd2c2('0x70')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x8]?_0x110517['attrs'][0x8][_0xd2c2('0x5e')]:undefined)||''},{'name':_0xd2c2('0x77'),'value':_0x110517[_0xd2c2('0x77')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x9]?_0x110517[_0xd2c2('0x5d')][0x9][_0xd2c2('0x5e')]:undefined)||''},{'name':_0xd2c2('0x71'),'value':_0x110517[_0xd2c2('0x71')]||(_0x110517['attrs']&&_0x110517[_0xd2c2('0x5d')][0xa]?_0x110517[_0xd2c2('0x5d')][0xa][_0xd2c2('0x5e')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x110517['reportType']||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x0]?_0x110517[_0xd2c2('0x5d')][0x0][_0xd2c2('0x41')]:undefined)||null,'value':_0x110517['attrReport']||(_0x110517[_0xd2c2('0x5d')]&&_0x110517[_0xd2c2('0x5d')][0x0]?_0x110517[_0xd2c2('0x5d')][0x0][_0xd2c2('0x5e')]:undefined)||null},{'name':_0xd2c2('0x78'),'value':_0x110517[_0xd2c2('0x78')]||(_0x110517[_0xd2c2('0x5d')]&&_0x110517['attrs'][0x1]?_0x110517[_0xd2c2('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x367bd8){logger['error'](_0xd2c2('0x79'),JSON[_0xd2c2('0x7a')](_0x367bd8));return[];}}exports[_0xd2c2('0x7b')]=function(_0x33661c,_0x2a3569,_0x2f10ea){if(_0x33661c['body']['id']){delete _0x33661c['body']['id'];}return db[_0xd2c2('0x2f')][_0xd2c2('0x4b')]({'where':{'id':_0x33661c[_0xd2c2('0x4a')]['id']}})[_0xd2c2('0x27')](handleEntityNotFound(_0x2a3569,null))['then'](function(_0x526492){if(_0x526492){_0x33661c[_0xd2c2('0x4e')]['DashboardId']=_0x526492['id'];_0x33661c[_0xd2c2('0x4e')]['attrs']=widgetAttributes(_0x33661c['body']);return db[_0xd2c2('0x7c')][_0xd2c2('0x4d')](_0x33661c['body']);}})[_0xd2c2('0x27')](respondWithResult(_0x2a3569,null))[_0xd2c2('0x4c')](handleError(_0x2a3569,null));};exports[_0xd2c2('0x7d')]=function(_0x59b659,_0x170e87,_0x4b3ce1){var _0xe3041f={};var _0x1f6f7d={};var _0x6d0179;var _0x3967d1;return db['Dashboard'][_0xd2c2('0x7e')]({'where':{'id':_0x59b659[_0xd2c2('0x4a')]['id']}})[_0xd2c2('0x27')](handleEntityNotFound(_0x170e87,null))['then'](function(_0x517aa4){if(_0x517aa4){_0x6d0179=_0x517aa4;_0x1f6f7d[_0xd2c2('0x33')]=_[_0xd2c2('0x35')](db[_0xd2c2('0x7c')][_0xd2c2('0x30')]);_0x1f6f7d[_0xd2c2('0x34')]=_[_0xd2c2('0x35')](_0x59b659['query']);_0x1f6f7d[_0xd2c2('0x36')]=_[_0xd2c2('0x37')](_0x1f6f7d[_0xd2c2('0x33')],_0x1f6f7d[_0xd2c2('0x34')]);_0xe3041f[_0xd2c2('0x38')]=_[_0xd2c2('0x37')](_0x1f6f7d[_0xd2c2('0x33')],qs[_0xd2c2('0x39')](_0x59b659[_0xd2c2('0x34')][_0xd2c2('0x39')]));_0xe3041f[_0xd2c2('0x38')]=_0xe3041f['attributes'][_0xd2c2('0x3a')]?_0xe3041f[_0xd2c2('0x38')]:_0x1f6f7d[_0xd2c2('0x33')];_0xe3041f[_0xd2c2('0x3d')]=qs[_0xd2c2('0x7f')](_0x59b659[_0xd2c2('0x34')][_0xd2c2('0x7f')]);_0xe3041f[_0xd2c2('0x3e')]=qs[_0xd2c2('0x36')](_['pick'](_0x59b659['query'],_0x1f6f7d[_0xd2c2('0x36')]));if(_0x59b659['query'][_0xd2c2('0x40')]){_0xe3041f[_0xd2c2('0x3e')]=_[_0xd2c2('0x43')](_0xe3041f[_0xd2c2('0x3e')],{'$or':_['map'](_0xe3041f[_0xd2c2('0x38')],function(_0x51a377){var _0x3fad1d={};_0x3fad1d[_0x51a377]={'$like':'%'+_0x59b659[_0xd2c2('0x34')]['filter']+'%'};return _0x3fad1d;})});}_0xe3041f=_['merge']({},_0xe3041f,_0x59b659['options']);return _0x6d0179[_0xd2c2('0x7d')](_0xe3041f);}})['then'](function(_0x6bf5d8){if(_0x6bf5d8){_0x3967d1=_0x6bf5d8[_0xd2c2('0x3a')];if(!_0x59b659[_0xd2c2('0x34')]['hasOwnProperty']('nolimit')){_0xe3041f[_0xd2c2('0x21')]=qs[_0xd2c2('0x21')](_0x59b659[_0xd2c2('0x34')][_0xd2c2('0x21')]);_0xe3041f['offset']=qs[_0xd2c2('0x23')](_0x59b659[_0xd2c2('0x34')][_0xd2c2('0x23')]);}return _0x6d0179[_0xd2c2('0x7d')](_0xe3041f);}})[_0xd2c2('0x27')](function(_0x1a28f5){if(_0x1a28f5){return _0x1a28f5?{'count':_0x3967d1,'rows':_0x1a28f5}:null;}})[_0xd2c2('0x27')](respondWithResult(_0x170e87,null))['catch'](handleError(_0x170e87,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 4452082..98761ae 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 _0x433f=['remove','emit','hasOwnProperty','hook','../../mysqldb','Dashboard','update'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x433f,0x1b6));var _0xf433=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x433f[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xf433('0x0'))['db'][_0xf433('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf433('0x2'),'afterDestroy':_0xf433('0x3')};function emitEvent(_0x3ee98f){return function(_0x134ad6,_0x5a46a5,_0x76d90){DashboardEvents[_0xf433('0x4')](_0x3ee98f+':'+_0x134ad6['id'],_0x134ad6);DashboardEvents['emit'](_0x3ee98f,_0x134ad6);_0x76d90(null);};}for(var e in events){if(events[_0xf433('0x5')](e)){var event=events[e];Dashboard[_0xf433('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xffc8=['../../mysqldb','Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffc8,0xd1));var _0x8ffc=function(_0x466d67,_0x20602b){_0x466d67=_0x466d67-0x0;var _0x2445ac=_0xffc8[_0x466d67];return _0x2445ac;};'use strict';var EventEmitter=require(_0x8ffc('0x0'));var Dashboard=require(_0x8ffc('0x1'))['db'][_0x8ffc('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8ffc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8ffc('0x4'),'afterDestroy':_0x8ffc('0x5')};function emitEvent(_0x5c3de0){return function(_0x24c8d5,_0x46d2a1,_0x132a4e){DashboardEvents[_0x8ffc('0x6')](_0x5c3de0+':'+_0x24c8d5['id'],_0x24c8d5);DashboardEvents[_0x8ffc('0x6')](_0x5c3de0,_0x24c8d5);_0x132a4e(null);};}for(var e in events){if(events[_0x8ffc('0x7')](e)){var event=events[e];Dashboard[_0x8ffc('0x8')](e,emitEvent(event));}}module[_0x8ffc('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 010a028..1b6d2f8 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 _0x6a92=['./dashboard.attributes','exports','dashboards','lodash','util','../../config/logger','api','moment'];(function(_0x3c1638,_0x4f26f1){var _0xd27ae2=function(_0x563394){while(--_0x563394){_0x3c1638['push'](_0x3c1638['shift']());}};_0xd27ae2(++_0x4f26f1);}(_0x6a92,0x14b));var _0x26a9=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x6a92[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x26a9('0x0'));var util=require(_0x26a9('0x1'));var logger=require(_0x26a9('0x2'))(_0x26a9('0x3'));var moment=require(_0x26a9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x26a9('0x5'));module[_0x26a9('0x6')]=function(_0x566daa,_0x4e4e3a){return _0x566daa['define']('Dashboard',attributes,{'tableName':_0x26a9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3079=['util','moment','request-promise','path','rimraf','define','Dashboard','dashboards','lodash'];(function(_0x4c4a89,_0xd32d3c){var _0x4d2a9c=function(_0x1de911){while(--_0x1de911){_0x4c4a89['push'](_0x4c4a89['shift']());}};_0x4d2a9c(++_0xd32d3c);}(_0x3079,0xaa));var _0x9307=function(_0x5a0d6c,_0x180ba4){_0x5a0d6c=_0x5a0d6c-0x0;var _0x1b9fc1=_0x3079[_0x5a0d6c];return _0x1b9fc1;};'use strict';var _=require(_0x9307('0x0'));var util=require(_0x9307('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9307('0x2'));var BPromise=require('bluebird');var rp=require(_0x9307('0x3'));var fs=require('fs');var path=require(_0x9307('0x4'));var rimraf=require(_0x9307('0x5'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module['exports']=function(_0x3fbfef,_0x3f8f2a){return _0x3fbfef[_0x9307('0x6')](_0x9307('0x7'),attributes,{'tableName':_0x9307('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index ecbd863..e3c0017 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 _0x8425=['info','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1ca40c,_0x582eaf){var _0x50b2a3=function(_0xb6eb65){while(--_0xb6eb65){_0x1ca40c['push'](_0x1ca40c['shift']());}};_0x50b2a3(++_0x582eaf);}(_0x8425,0x15f));var _0x5842=function(_0x2fb0cb,_0x82a283){_0x2fb0cb=_0x2fb0cb-0x0;var _0x493ba0=_0x8425[_0x2fb0cb];return _0x493ba0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5842('0x0'));var rs=require(_0x5842('0x1'));var fs=require('fs');var Redis=require(_0x5842('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5842('0x3'));var logger=require(_0x5842('0x4'))(_0x5842('0x5'));var config=require(_0x5842('0x6'));var jayson=require(_0x5842('0x7'));var client=jayson[_0x5842('0x8')][_0x5842('0x9')]({'port':0x232a});config['redis']=_[_0x5842('0xa')](config[_0x5842('0xb')],{'host':_0x5842('0xc'),'port':0x18eb});var socket=require(_0x5842('0xd'))(new Redis(config[_0x5842('0xb')]));require(_0x5842('0xe'))[_0x5842('0xf')](socket);function respondWithRpcPromise(_0x40448f,_0x16cbf0,_0xc53592){return new BPromise(function(_0x552f9e,_0x31f0df){return client[_0x5842('0x10')](_0x40448f,_0xc53592)[_0x5842('0x11')](function(_0x2d7c32){logger['info'](_0x5842('0x12'),_0x16cbf0,_0x5842('0x13'));logger[_0x5842('0x14')](_0x5842('0x15'),_0x16cbf0,'request\x20sent',JSON[_0x5842('0x16')](_0x2d7c32));if(_0x2d7c32[_0x5842('0x17')]){if(_0x2d7c32[_0x5842('0x17')][_0x5842('0x18')]===0x1f4){logger['error'](_0x5842('0x12'),_0x16cbf0,_0x2d7c32['error'][_0x5842('0x19')]);return _0x31f0df(_0x2d7c32[_0x5842('0x17')][_0x5842('0x19')]);}logger['error'](_0x5842('0x12'),_0x16cbf0,_0x2d7c32['error'][_0x5842('0x19')]);return _0x552f9e(_0x2d7c32[_0x5842('0x17')][_0x5842('0x19')]);}else{logger[_0x5842('0x1a')](_0x5842('0x12'),_0x16cbf0,_0x5842('0x13'));_0x552f9e(_0x2d7c32[_0x5842('0x1b')][_0x5842('0x19')]);}})[_0x5842('0x1c')](function(_0x20d047){logger[_0x5842('0x17')](_0x5842('0x12'),_0x16cbf0,_0x20d047);_0x31f0df(_0x20d047);});});} \ No newline at end of file +var _0xa590=['Dashboard,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','socket.io-emitter','./dashboard.socket','request','then','info','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1e89bc,_0x59e87b){var _0x51f588=function(_0x22fd8b){while(--_0x22fd8b){_0x1e89bc['push'](_0x1e89bc['shift']());}};_0x51f588(++_0x59e87b);}(_0xa590,0x17a));var _0x0a59=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa590[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x0a59('0x0'));var util=require(_0x0a59('0x1'));var moment=require(_0x0a59('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a59('0x3'));var fs=require('fs');var Redis=require(_0x0a59('0x4'));var db=require(_0x0a59('0x5'))['db'];var utils=require(_0x0a59('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0a59('0x7'));var client=jayson[_0x0a59('0x8')][_0x0a59('0x9')]({'port':0x232a});config[_0x0a59('0xa')]=_['defaults'](config[_0x0a59('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a59('0xb'))(new Redis(config['redis']));require(_0x0a59('0xc'))['register'](socket);function respondWithRpcPromise(_0xf321ff,_0x5eb322,_0x3852da){return new BPromise(function(_0x5d99b6,_0x571841){return client[_0x0a59('0xd')](_0xf321ff,_0x3852da)[_0x0a59('0xe')](function(_0x3e5a75){logger[_0x0a59('0xf')]('Dashboard,\x20%s,\x20%s',_0x5eb322,'request\x20sent');logger[_0x0a59('0x10')](_0x0a59('0x11'),_0x5eb322,_0x0a59('0x12'),JSON[_0x0a59('0x13')](_0x3e5a75));if(_0x3e5a75[_0x0a59('0x14')]){if(_0x3e5a75[_0x0a59('0x14')][_0x0a59('0x15')]===0x1f4){logger['error'](_0x0a59('0x16'),_0x5eb322,_0x3e5a75[_0x0a59('0x14')][_0x0a59('0x17')]);return _0x571841(_0x3e5a75[_0x0a59('0x14')][_0x0a59('0x17')]);}logger[_0x0a59('0x14')]('Dashboard,\x20%s,\x20%s',_0x5eb322,_0x3e5a75[_0x0a59('0x14')]['message']);return _0x5d99b6(_0x3e5a75[_0x0a59('0x14')]['message']);}else{logger[_0x0a59('0xf')]('Dashboard,\x20%s,\x20%s',_0x5eb322,_0x0a59('0x12'));_0x5d99b6(_0x3e5a75[_0x0a59('0x18')]['message']);}})['catch'](function(_0xb3eaed){logger['error'](_0x0a59('0x16'),_0x5eb322,_0xb3eaed);_0x571841(_0xb3eaed);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index e81e404..0b58f96 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 _0x5eb5=['update','emit','removeListener','register','length','dashboard:','./dashboard.events','save','remove'];(function(_0x7dd78a,_0x4f845f){var _0x5a4d3f=function(_0x48edea){while(--_0x48edea){_0x7dd78a['push'](_0x7dd78a['shift']());}};_0x5a4d3f(++_0x4f845f);}(_0x5eb5,0x16e));var _0x55eb=function(_0x2603da,_0x2ae113){_0x2603da=_0x2603da-0x0;var _0x3861a6=_0x5eb5[_0x2603da];return _0x3861a6;};'use strict';var DashboardEvents=require(_0x55eb('0x0'));var events=[_0x55eb('0x1'),_0x55eb('0x2'),_0x55eb('0x3')];function createListener(_0x218fa6,_0x5d85b2){return function(_0x18573d){_0x5d85b2[_0x55eb('0x4')](_0x218fa6,_0x18573d);};}function removeListener(_0x80dd0,_0x3c21a9){return function(){DashboardEvents[_0x55eb('0x5')](_0x80dd0,_0x3c21a9);};}exports[_0x55eb('0x6')]=function(_0x3e19c9){for(var _0x196d45=0x0,_0x49a121=events[_0x55eb('0x7')];_0x196d45<_0x49a121;_0x196d45++){var _0x68e95a=events[_0x196d45];var _0x3cfbc8=createListener(_0x55eb('0x8')+_0x68e95a,_0x3e19c9);DashboardEvents['on'](_0x68e95a,_0x3cfbc8);}}; \ No newline at end of file +var _0xbf7f=['removeListener','register','length','dashboard:','./dashboard.events','update','emit'];(function(_0xcfd89f,_0x106e8f){var _0x59acd4=function(_0x2e187c){while(--_0x2e187c){_0xcfd89f['push'](_0xcfd89f['shift']());}};_0x59acd4(++_0x106e8f);}(_0xbf7f,0x17e));var _0xfbf7=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xbf7f[_0x55f8b4];return _0x2475f9;};'use strict';var DashboardEvents=require(_0xfbf7('0x0'));var events=['save','remove',_0xfbf7('0x1')];function createListener(_0x4eaf10,_0x789bea){return function(_0x113c07){_0x789bea[_0xfbf7('0x2')](_0x4eaf10,_0x113c07);};}function removeListener(_0x581b3e,_0x21b9f5){return function(){DashboardEvents[_0xfbf7('0x3')](_0x581b3e,_0x21b9f5);};}exports[_0xfbf7('0x4')]=function(_0x297bd3){for(var _0x396050=0x0,_0x5ccde7=events[_0xfbf7('0x5')];_0x396050<_0x5ccde7;_0x396050++){var _0x20af6b=events[_0x396050];var _0x5f511e=createListener(_0xfbf7('0x6')+_0x20af6b,_0x297bd3);DashboardEvents['on'](_0x20af6b,_0x5f511e);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index b618b8a..58e5362 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 _0xa8ba=['destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','/:id/items','getItems','post','create','clone','addItem','put','update','/:id'];(function(_0x105534,_0x117104){var _0x18a262=function(_0x443d54){while(--_0x443d54){_0x105534['push'](_0x105534['shift']());}};_0x18a262(++_0x117104);}(_0xa8ba,0x6b));var _0xaa8b=function(_0x46a711,_0x2bdf60){_0x46a711=_0x46a711-0x0;var _0xac6e72=_0xa8ba[_0x46a711];return _0xac6e72;};'use strict';var multer=require(_0xaa8b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa8b('0x1'));var express=require(_0xaa8b('0x2'));var router=express[_0xaa8b('0x3')]();var fs_extra=require(_0xaa8b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaa8b('0x5'));var config=require('../../config/environment');var controller=require(_0xaa8b('0x6'));router[_0xaa8b('0x7')]('/',auth[_0xaa8b('0x8')](),controller[_0xaa8b('0x9')]);router[_0xaa8b('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xaa8b('0x7')](_0xaa8b('0xa'),auth[_0xaa8b('0x8')](),controller[_0xaa8b('0xb')]);router[_0xaa8b('0xc')]('/',auth[_0xaa8b('0x8')](),controller[_0xaa8b('0xd')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0xaa8b('0xe')]);router[_0xaa8b('0xc')](_0xaa8b('0xa'),auth[_0xaa8b('0x8')](),controller[_0xaa8b('0xf')]);router[_0xaa8b('0x10')]('/:id',auth[_0xaa8b('0x8')](),controller[_0xaa8b('0x11')]);router['delete'](_0xaa8b('0x12'),auth[_0xaa8b('0x8')](),controller[_0xaa8b('0x13')]);module[_0xaa8b('0x14')]=router; \ No newline at end of file +var _0x875a=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','show','/:id/items','isAuthenticated','getItems','post','create','/:id/clone','clone','addItem','/:id','update','delete','destroy'];(function(_0x12c00d,_0x14f812){var _0x1b2ade=function(_0x1a4f1d){while(--_0x1a4f1d){_0x12c00d['push'](_0x12c00d['shift']());}};_0x1b2ade(++_0x14f812);}(_0x875a,0x187));var _0xa875=function(_0xc5c8ec,_0x3f9bc4){_0xc5c8ec=_0xc5c8ec-0x0;var _0x3d57b8=_0x875a[_0xc5c8ec];return _0x3d57b8;};'use strict';var multer=require(_0xa875('0x0'));var util=require(_0xa875('0x1'));var path=require('path');var timeout=require(_0xa875('0x2'));var express=require(_0xa875('0x3'));var router=express[_0xa875('0x4')]();var fs_extra=require(_0xa875('0x5'));var auth=require(_0xa875('0x6'));var interaction=require(_0xa875('0x7'));var config=require(_0xa875('0x8'));var controller=require(_0xa875('0x9'));router[_0xa875('0xa')]('/',auth['isAuthenticated'](),controller[_0xa875('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa875('0xc')]);router[_0xa875('0xa')](_0xa875('0xd'),auth[_0xa875('0xe')](),controller[_0xa875('0xf')]);router[_0xa875('0x10')]('/',auth['isAuthenticated'](),controller[_0xa875('0x11')]);router[_0xa875('0x10')](_0xa875('0x12'),auth[_0xa875('0xe')](),controller[_0xa875('0x13')]);router[_0xa875('0x10')]('/:id/items',auth['isAuthenticated'](),controller[_0xa875('0x14')]);router['put'](_0xa875('0x15'),auth[_0xa875('0xe')](),controller[_0xa875('0x16')]);router[_0xa875('0x17')](_0xa875('0x15'),auth[_0xa875('0xe')](),controller[_0xa875('0x18')]);module[_0xa875('0x19')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index d602b69..8a0597a 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 _0x6f47=['#ffffff','squel','lodash','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x2a8b1d,_0x1057e8){var _0x3d9ee9=function(_0x386cd2){while(--_0x386cd2){_0x2a8b1d['push'](_0x2a8b1d['shift']());}};_0x3d9ee9(++_0x1057e8);}(_0x6f47,0xc7));var _0x76f4=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x6f47[_0xf71120];return _0xbe2fd3;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));module['exports']={'title':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x76f4('0x3')]('long'),'get':function(){try{return JSON[_0x76f4('0x4')](this[_0x76f4('0x5')](_0x76f4('0x6')));}catch(_0x2523ba){return[];}},'set':function(_0x5754ca){try{this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')](_0x5754ca));}catch(_0x497f99){this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![],'defaultValue':_0x76f4('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x76f4('0x2')]},'titleFontSize':{'type':Sequelize[_0x76f4('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x2ef3=['parse','attrs','stringify','setDataValue','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','long'];(function(_0x41cef5,_0x31b170){var _0x18ee19=function(_0x15dbc3){while(--_0x15dbc3){_0x41cef5['push'](_0x41cef5['shift']());}};_0x18ee19(++_0x31b170);}(_0x2ef3,0xba));var _0x32ef=function(_0x13d042,_0x2a350b){_0x13d042=_0x13d042-0x0;var _0x357a06=_0x2ef3[_0x13d042];return _0x357a06;};'use strict';var Sequelize=require(_0x32ef('0x0'));var squel=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));module[_0x32ef('0x3')]={'title':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x32ef('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x32ef('0x5')),'get':function(){try{return JSON[_0x32ef('0x6')](this['getDataValue'](_0x32ef('0x7')));}catch(_0x37dd1d){return[];}},'set':function(_0x4c8104){try{this['setDataValue'](_0x32ef('0x7'),JSON[_0x32ef('0x8')](_0x4c8104));}catch(_0x367c39){this[_0x32ef('0x9')](_0x32ef('0x7'),JSON[_0x32ef('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x32ef('0xa')]},'col':{'type':Sequelize[_0x32ef('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![],'defaultValue':_0x32ef('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x32ef('0x4')]},'titleFontSize':{'type':Sequelize[_0x32ef('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 e4c28e8..ce4f8cc 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 _0xf1c6=['send','params','model','DashboardItem','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','then','catch','type','iframe','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','redis','./dashboardItem.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name'];(function(_0x35b914,_0x42351e){var _0x1d8bfb=function(_0x3b36a5){while(--_0x3b36a5){_0x35b914['push'](_0x35b914['shift']());}};_0x1d8bfb(++_0x42351e);}(_0xf1c6,0x145));var _0x6f1c=function(_0x1f47b1,_0x97a4d2){_0x1f47b1=_0x1f47b1-0x0;var _0x69e436=_0xf1c6[_0x1f47b1];return _0x69e436;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f1c('0x0'));var jsonpatch=require(_0x6f1c('0x1'));var rp=require(_0x6f1c('0x2'));var moment=require(_0x6f1c('0x3'));var BPromise=require(_0x6f1c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f1c('0x5'));var sox=require('sox');var csv=require(_0x6f1c('0x6'));var ejs=require(_0x6f1c('0x7'));var fs=require('fs');var fs_extra=require(_0x6f1c('0x8'));var _=require('lodash');var squel=require(_0x6f1c('0x9'));var crypto=require('crypto');var jsforce=require(_0x6f1c('0xa'));var deskjs=require(_0x6f1c('0xb'));var toCsv=require(_0x6f1c('0x6'));var querystring=require('querystring');var Papa=require(_0x6f1c('0xc'));var Redis=require('ioredis');var authService=require(_0x6f1c('0xd'));var qs=require(_0x6f1c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f1c('0xf'));var logger=require(_0x6f1c('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6f1c('0x11'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f1c('0x12')]));require(_0x6f1c('0x13'))[_0x6f1c('0x14')](socket);function respondWithStatusCode(_0x5549d1,_0x82203a){_0x82203a=_0x82203a||0xcc;return function(_0x238c62){if(_0x238c62){return _0x5549d1[_0x6f1c('0x15')](_0x82203a);}return _0x5549d1['status'](_0x82203a)[_0x6f1c('0x16')]();};}function respondWithResult(_0x210abb,_0x5515fa){_0x5515fa=_0x5515fa||0xc8;return function(_0x28fc5f){if(_0x28fc5f){return _0x210abb[_0x6f1c('0x17')](_0x5515fa)[_0x6f1c('0x18')](_0x28fc5f);}};}function respondWithFilteredResult(_0x6e2d39,_0x3c3e21){return function(_0x16d2bb){if(_0x16d2bb){var _0x491151=typeof _0x3c3e21[_0x6f1c('0x19')]===_0x6f1c('0x1a')&&typeof _0x3c3e21[_0x6f1c('0x1b')]===_0x6f1c('0x1a');var _0x20c2bb=_0x16d2bb[_0x6f1c('0x1c')];var _0x4dbb3f=_0x491151?0x0:_0x3c3e21['offset'];var _0x58c2d8=_0x491151?_0x16d2bb[_0x6f1c('0x1c')]:_0x3c3e21['offset']+_0x3c3e21[_0x6f1c('0x1b')];var _0x4f6637;if(_0x58c2d8>=_0x20c2bb){_0x58c2d8=_0x20c2bb;_0x4f6637=0xc8;}else{_0x4f6637=0xce;}_0x6e2d39[_0x6f1c('0x17')](_0x4f6637);return _0x6e2d39[_0x6f1c('0x1d')](_0x6f1c('0x1e'),_0x4dbb3f+'-'+_0x58c2d8+'/'+_0x20c2bb)[_0x6f1c('0x18')](_0x16d2bb);}return null;};}function patchUpdates(_0x2ed8f1){return function(_0x3a082c){try{jsonpatch[_0x6f1c('0x1f')](_0x3a082c,_0x2ed8f1,!![]);}catch(_0x35934b){return BPromise[_0x6f1c('0x20')](_0x35934b);}return _0x3a082c[_0x6f1c('0x21')]();};}function saveUpdates(_0x130bae,_0x2da230){return function(_0x388416){if(_0x388416){return _0x388416[_0x6f1c('0x22')](_0x130bae)['then'](function(_0x2a3b6a){return _0x2a3b6a;});}return null;};}function removeEntity(_0x2b29af,_0x4a8fc1){return function(_0x3c0dd1){if(_0x3c0dd1){return _0x3c0dd1[_0x6f1c('0x23')]()['then'](function(){_0x2b29af['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x500e36,_0x16fe5a){return function(_0x1ac9f5){if(!_0x1ac9f5){_0x500e36[_0x6f1c('0x15')](0x194);}return _0x1ac9f5;};}function handleError(_0x30267d,_0x29b952){_0x29b952=_0x29b952||0x1f4;return function(_0x66cb25){logger[_0x6f1c('0x24')](_0x66cb25[_0x6f1c('0x25')]);if(_0x66cb25[_0x6f1c('0x26')]){delete _0x66cb25[_0x6f1c('0x26')];}_0x30267d[_0x6f1c('0x17')](_0x29b952)[_0x6f1c('0x27')](_0x66cb25);};}exports['show']=function(_0x528e40,_0x1f783a){var _0x4084af={'raw':![],'where':{'id':_0x528e40[_0x6f1c('0x28')]['id']}},_0x383802={};_0x383802[_0x6f1c('0x29')]=_['keys'](db[_0x6f1c('0x2a')]['rawAttributes']);_0x383802[_0x6f1c('0x2b')]=_['keys'](_0x528e40[_0x6f1c('0x2b')]);_0x383802[_0x6f1c('0x2c')]=_[_0x6f1c('0x2d')](_0x383802[_0x6f1c('0x29')],_0x383802[_0x6f1c('0x2b')]);_0x4084af[_0x6f1c('0x2e')]=_[_0x6f1c('0x2d')](_0x383802[_0x6f1c('0x29')],qs[_0x6f1c('0x2f')](_0x528e40[_0x6f1c('0x2b')]['fields']));_0x4084af[_0x6f1c('0x2e')]=_0x4084af[_0x6f1c('0x2e')][_0x6f1c('0x30')]?_0x4084af[_0x6f1c('0x2e')]:_0x383802[_0x6f1c('0x29')];if(_0x528e40[_0x6f1c('0x2b')][_0x6f1c('0x31')]){_0x4084af[_0x6f1c('0x32')]=[{'all':!![]}];}_0x4084af=_[_0x6f1c('0x33')]({},_0x4084af,_0x528e40['options']);return db['DashboardItem'][_0x6f1c('0x34')](_0x4084af)[_0x6f1c('0x35')](handleEntityNotFound(_0x1f783a,null))[_0x6f1c('0x35')](respondWithResult(_0x1f783a,null))[_0x6f1c('0x36')](handleError(_0x1f783a,null));};exports[_0x6f1c('0x23')]=function(_0x84fa1c,_0x19d62b){return db[_0x6f1c('0x2a')][_0x6f1c('0x34')]({'where':{'id':_0x84fa1c[_0x6f1c('0x28')]['id']}})[_0x6f1c('0x35')](handleEntityNotFound(_0x19d62b,null))[_0x6f1c('0x35')](removeEntity(_0x19d62b,null))[_0x6f1c('0x36')](handleError(_0x19d62b,null));};function widgetAttributes(_0x38d241){try{switch(_0x38d241[_0x6f1c('0x37')]){case _0x6f1c('0x38'):return[{'name':'attrUrl','value':_0x38d241['attrUrl']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x3b')}];case _0x6f1c('0x3c'):return[{'name':_0x6f1c('0x3d'),'value':_0x38d241[_0x6f1c('0x3d')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||''}];case _0x6f1c('0x3e'):return[{'name':_0x6f1c('0x3f'),'value':_0x38d241['attrHourFormat']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x40')},{'name':_0x6f1c('0x41'),'value':_0x38d241[_0x6f1c('0x41')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x42')},{'name':_0x6f1c('0x43'),'value':_0x38d241[_0x6f1c('0x43')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x2]?_0x38d241[_0x6f1c('0x39')][0x2]['value']:undefined)||0xc}];case _0x6f1c('0x44'):return[{'name':_0x6f1c('0x45'),'value':_0x38d241[_0x6f1c('0x45')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||'total'},{'name':_0x6f1c('0x46'),'value':_0x38d241['attrVoiceQueues']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||[]},{'name':_0x6f1c('0x43'),'value':_0x38d241['attrFontSize']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x2]?_0x38d241['attrs'][0x2][_0x6f1c('0x3a')]:undefined)||0x14},{'name':_0x6f1c('0x47'),'value':_0x38d241[_0x6f1c('0x47')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x3]?_0x38d241[_0x6f1c('0x39')][0x3][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x48')},{'name':_0x6f1c('0x49'),'value':_0x38d241[_0x6f1c('0x49')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x4]?_0x38d241['attrs'][0x4][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4a'),'value':_0x38d241[_0x6f1c('0x4a')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x5]?_0x38d241[_0x6f1c('0x39')][0x5][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x38d241[_0x6f1c('0x4b')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x6]?_0x38d241[_0x6f1c('0x39')][0x6][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4c'),'value':_0x38d241[_0x6f1c('0x4c')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x7]?_0x38d241[_0x6f1c('0x39')][0x7][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x38d241[_0x6f1c('0x4d')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x8]?_0x38d241['attrs'][0x8]['value']:undefined)||''},{'name':_0x6f1c('0x4e'),'value':_0x38d241['attrChatWebsites']||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x9]?_0x38d241[_0x6f1c('0x39')][0x9]['value']:undefined)||''}];case _0x6f1c('0x4f'):case _0x6f1c('0x50'):return[{'name':_0x6f1c('0x51'),'value':_0x38d241['attrSerie1']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241['attrs'][0x0][_0x6f1c('0x3a')]:undefined)||'total'},{'name':_0x6f1c('0x52'),'value':_0x38d241[_0x6f1c('0x52')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||null},{'name':'attrSerie3','value':_0x38d241['attrSerie3']||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x2]?_0x38d241[_0x6f1c('0x39')][0x2]['value']:undefined)||null},{'name':_0x6f1c('0x46'),'value':_0x38d241['attrVoiceQueues']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x3]?_0x38d241[_0x6f1c('0x39')][0x3][_0x6f1c('0x3a')]:undefined)||[]},{'name':_0x6f1c('0x47'),'value':_0x38d241[_0x6f1c('0x47')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x4]?_0x38d241[_0x6f1c('0x39')][0x4][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x48')},{'name':_0x6f1c('0x49'),'value':_0x38d241[_0x6f1c('0x49')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x5]?_0x38d241['attrs'][0x5][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x38d241[_0x6f1c('0x4a')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x6]?_0x38d241[_0x6f1c('0x39')][0x6][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x38d241['attrSmsAccounts']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x7]?_0x38d241[_0x6f1c('0x39')][0x7][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4c'),'value':_0x38d241[_0x6f1c('0x4c')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x8]?_0x38d241[_0x6f1c('0x39')][0x8][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x38d241[_0x6f1c('0x4d')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x9]?_0x38d241['attrs'][0x9][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4e'),'value':_0x38d241['attrChatWebsites']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0xa]?_0x38d241[_0x6f1c('0x39')][0xa][_0x6f1c('0x3a')]:undefined)||''}];case _0x6f1c('0x53'):return[{'name':_0x6f1c('0x54'),'type':_0x38d241[_0x6f1c('0x55')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0]['type']:undefined)||null,'value':_0x38d241[_0x6f1c('0x54')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0]['value']:undefined)||null},{'name':_0x6f1c('0x56'),'value':_0x38d241[_0x6f1c('0x56')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x5a69ec){logger[_0x6f1c('0x24')](_0x6f1c('0x57'),JSON[_0x6f1c('0x58')](_0x5a69ec));return[];}}exports[_0x6f1c('0x59')]=function(_0x51ae01,_0xad0e0f){if(_0x51ae01[_0x6f1c('0x5a')]){_0x51ae01[_0x6f1c('0x5a')]['attrs']=widgetAttributes(_0x51ae01[_0x6f1c('0x5a')]);}return db[_0x6f1c('0x2a')]['create'](_0x51ae01[_0x6f1c('0x5a')],{})[_0x6f1c('0x35')](respondWithResult(_0xad0e0f,0xc9))[_0x6f1c('0x36')](handleError(_0xad0e0f,null));};exports[_0x6f1c('0x22')]=function(_0xc3e7c0,_0x4bd3e3){if(_0xc3e7c0['body']['id']){delete _0xc3e7c0[_0x6f1c('0x5a')]['id'];}_0xc3e7c0['body']['attrs']=widgetAttributes(_0xc3e7c0[_0x6f1c('0x5a')]);return db['DashboardItem'][_0x6f1c('0x34')]({'where':{'id':_0xc3e7c0[_0x6f1c('0x28')]['id']}})[_0x6f1c('0x35')](handleEntityNotFound(_0x4bd3e3,null))[_0x6f1c('0x35')](saveUpdates(_0xc3e7c0[_0x6f1c('0x5a')],null))[_0x6f1c('0x35')](respondWithResult(_0x4bd3e3,null))[_0x6f1c('0x36')](handleError(_0x4bd3e3,null));}; \ No newline at end of file +var _0x3bd7=['attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','error','widgetAttributes:\x20%s','body','create','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','send','params','model','keys','DashboardItem','query','filters','intersection','attributes','fields','includeAll','include','options','find','catch','iframe'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x3bd7,0x199));var _0x73bd=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0x3bd7[_0x34d346];return _0x122d76;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x73bd('0x0'));var jsonpatch=require(_0x73bd('0x1'));var rp=require(_0x73bd('0x2'));var moment=require('moment');var BPromise=require(_0x73bd('0x3'));var Mustache=require(_0x73bd('0x4'));var util=require(_0x73bd('0x5'));var path=require('path');var sox=require(_0x73bd('0x6'));var csv=require('to-csv');var ejs=require(_0x73bd('0x7'));var fs=require('fs');var fs_extra=require(_0x73bd('0x8'));var _=require('lodash');var squel=require(_0x73bd('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x73bd('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x73bd('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x73bd('0xc'));var as=require(_0x73bd('0xd'));var hardwareService=require(_0x73bd('0xe'));var logger=require(_0x73bd('0xf'))(_0x73bd('0x10'));var utils=require(_0x73bd('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x73bd('0x12'));var db=require(_0x73bd('0x13'))['db'];config[_0x73bd('0x14')]=_[_0x73bd('0x15')](config[_0x73bd('0x14')],{'host':_0x73bd('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73bd('0x14')]));require('./dashboardItem.socket')[_0x73bd('0x17')](socket);function respondWithStatusCode(_0x3eab86,_0x125ad1){_0x125ad1=_0x125ad1||0xcc;return function(_0x3d8ef6){if(_0x3d8ef6){return _0x3eab86[_0x73bd('0x18')](_0x125ad1);}return _0x3eab86['status'](_0x125ad1)[_0x73bd('0x19')]();};}function respondWithResult(_0xfdf66,_0x1c5366){_0x1c5366=_0x1c5366||0xc8;return function(_0x3e5933){if(_0x3e5933){return _0xfdf66[_0x73bd('0x1a')](_0x1c5366)[_0x73bd('0x1b')](_0x3e5933);}};}function respondWithFilteredResult(_0x10e371,_0x464aa1){return function(_0x21787b){if(_0x21787b){var _0x482009=typeof _0x464aa1[_0x73bd('0x1c')]===_0x73bd('0x1d')&&typeof _0x464aa1[_0x73bd('0x1e')]===_0x73bd('0x1d');var _0x1cb0e3=_0x21787b[_0x73bd('0x1f')];var _0x397c60=_0x482009?0x0:_0x464aa1[_0x73bd('0x1c')];var _0x444c5f=_0x482009?_0x21787b['count']:_0x464aa1[_0x73bd('0x1c')]+_0x464aa1[_0x73bd('0x1e')];var _0x292f8c;if(_0x444c5f>=_0x1cb0e3){_0x444c5f=_0x1cb0e3;_0x292f8c=0xc8;}else{_0x292f8c=0xce;}_0x10e371['status'](_0x292f8c);return _0x10e371['set']('Content-Range',_0x397c60+'-'+_0x444c5f+'/'+_0x1cb0e3)[_0x73bd('0x1b')](_0x21787b);}return null;};}function patchUpdates(_0x269e84){return function(_0x56c076){try{jsonpatch[_0x73bd('0x20')](_0x56c076,_0x269e84,!![]);}catch(_0x22574c){return BPromise[_0x73bd('0x21')](_0x22574c);}return _0x56c076[_0x73bd('0x22')]();};}function saveUpdates(_0x1e22c5,_0x7ae0a4){return function(_0x2bcd5f){if(_0x2bcd5f){return _0x2bcd5f[_0x73bd('0x23')](_0x1e22c5)[_0x73bd('0x24')](function(_0x2dd70b){return _0x2dd70b;});}return null;};}function removeEntity(_0x36f7e0,_0x840215){return function(_0x12934b){if(_0x12934b){return _0x12934b[_0x73bd('0x25')]()[_0x73bd('0x24')](function(){_0x36f7e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x191727,_0x1903a5){return function(_0x5ebf3c){if(!_0x5ebf3c){_0x191727[_0x73bd('0x18')](0x194);}return _0x5ebf3c;};}function handleError(_0x330ee3,_0x193fe1){_0x193fe1=_0x193fe1||0x1f4;return function(_0x5ada8d){logger['error'](_0x5ada8d[_0x73bd('0x26')]);if(_0x5ada8d[_0x73bd('0x27')]){delete _0x5ada8d[_0x73bd('0x27')];}_0x330ee3['status'](_0x193fe1)[_0x73bd('0x28')](_0x5ada8d);};}exports['show']=function(_0x17a64f,_0x2701da){var _0x5d914c={'raw':![],'where':{'id':_0x17a64f[_0x73bd('0x29')]['id']}},_0x4c47d4={};_0x4c47d4[_0x73bd('0x2a')]=_[_0x73bd('0x2b')](db[_0x73bd('0x2c')]['rawAttributes']);_0x4c47d4[_0x73bd('0x2d')]=_['keys'](_0x17a64f[_0x73bd('0x2d')]);_0x4c47d4[_0x73bd('0x2e')]=_[_0x73bd('0x2f')](_0x4c47d4[_0x73bd('0x2a')],_0x4c47d4['query']);_0x5d914c[_0x73bd('0x30')]=_[_0x73bd('0x2f')](_0x4c47d4[_0x73bd('0x2a')],qs[_0x73bd('0x31')](_0x17a64f[_0x73bd('0x2d')][_0x73bd('0x31')]));_0x5d914c[_0x73bd('0x30')]=_0x5d914c[_0x73bd('0x30')]['length']?_0x5d914c[_0x73bd('0x30')]:_0x4c47d4[_0x73bd('0x2a')];if(_0x17a64f['query'][_0x73bd('0x32')]){_0x5d914c[_0x73bd('0x33')]=[{'all':!![]}];}_0x5d914c=_['merge']({},_0x5d914c,_0x17a64f[_0x73bd('0x34')]);return db['DashboardItem'][_0x73bd('0x35')](_0x5d914c)['then'](handleEntityNotFound(_0x2701da,null))[_0x73bd('0x24')](respondWithResult(_0x2701da,null))[_0x73bd('0x36')](handleError(_0x2701da,null));};exports[_0x73bd('0x25')]=function(_0x1acfb0,_0x5db723){return db[_0x73bd('0x2c')][_0x73bd('0x35')]({'where':{'id':_0x1acfb0['params']['id']}})[_0x73bd('0x24')](handleEntityNotFound(_0x5db723,null))[_0x73bd('0x24')](removeEntity(_0x5db723,null))['catch'](handleError(_0x5db723,null));};function widgetAttributes(_0x17041d){try{switch(_0x17041d['type']){case _0x73bd('0x37'):return[{'name':_0x73bd('0x38'),'value':_0x17041d[_0x73bd('0x38')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x0]?_0x17041d['attrs'][0x0][_0x73bd('0x3a')]:undefined)||_0x73bd('0x3b')}];case _0x73bd('0x3c'):return[{'name':'attrPath','value':_0x17041d[_0x73bd('0x3d')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x0]?_0x17041d[_0x73bd('0x39')][0x0][_0x73bd('0x3a')]:undefined)||''}];case _0x73bd('0x3e'):return[{'name':_0x73bd('0x3f'),'value':_0x17041d[_0x73bd('0x3f')]||(_0x17041d['attrs']&&_0x17041d[_0x73bd('0x39')][0x0]?_0x17041d[_0x73bd('0x39')][0x0][_0x73bd('0x3a')]:undefined)||_0x73bd('0x40')},{'name':_0x73bd('0x41'),'value':_0x17041d[_0x73bd('0x41')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d['attrs'][0x1]?_0x17041d[_0x73bd('0x39')][0x1][_0x73bd('0x3a')]:undefined)||_0x73bd('0x42')},{'name':_0x73bd('0x43'),'value':_0x17041d['attrFontSize']||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x2]?_0x17041d[_0x73bd('0x39')][0x2][_0x73bd('0x3a')]:undefined)||0xc}];case _0x73bd('0x44'):return[{'name':'attrMetric','value':_0x17041d[_0x73bd('0x45')]||(_0x17041d['attrs']&&_0x17041d[_0x73bd('0x39')][0x0]?_0x17041d['attrs'][0x0][_0x73bd('0x3a')]:undefined)||_0x73bd('0x46')},{'name':'attrVoiceQueues','value':_0x17041d[_0x73bd('0x47')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x1]?_0x17041d[_0x73bd('0x39')][0x1][_0x73bd('0x3a')]:undefined)||[]},{'name':'attrFontSize','value':_0x17041d[_0x73bd('0x43')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x2]?_0x17041d[_0x73bd('0x39')][0x2][_0x73bd('0x3a')]:undefined)||0x14},{'name':_0x73bd('0x48'),'value':_0x17041d[_0x73bd('0x48')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d['attrs'][0x3]?_0x17041d['attrs'][0x3][_0x73bd('0x3a')]:undefined)||_0x73bd('0x49')},{'name':_0x73bd('0x4a'),'value':_0x17041d['attrEmailAccounts']||(_0x17041d[_0x73bd('0x39')]&&_0x17041d['attrs'][0x4]?_0x17041d[_0x73bd('0x39')][0x4][_0x73bd('0x3a')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x17041d['attrFaxAccounts']||(_0x17041d['attrs']&&_0x17041d[_0x73bd('0x39')][0x5]?_0x17041d['attrs'][0x5][_0x73bd('0x3a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x17041d[_0x73bd('0x4b')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x6]?_0x17041d[_0x73bd('0x39')][0x6]['value']:undefined)||''},{'name':_0x73bd('0x4c'),'value':_0x17041d[_0x73bd('0x4c')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x7]?_0x17041d[_0x73bd('0x39')][0x7][_0x73bd('0x3a')]:undefined)||''},{'name':_0x73bd('0x4d'),'value':_0x17041d[_0x73bd('0x4d')]||(_0x17041d['attrs']&&_0x17041d[_0x73bd('0x39')][0x8]?_0x17041d[_0x73bd('0x39')][0x8]['value']:undefined)||''},{'name':_0x73bd('0x4e'),'value':_0x17041d[_0x73bd('0x4e')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d['attrs'][0x9]?_0x17041d[_0x73bd('0x39')][0x9][_0x73bd('0x3a')]:undefined)||''}];case _0x73bd('0x4f'):case _0x73bd('0x50'):return[{'name':_0x73bd('0x51'),'value':_0x17041d['attrSerie1']||(_0x17041d['attrs']&&_0x17041d['attrs'][0x0]?_0x17041d['attrs'][0x0][_0x73bd('0x3a')]:undefined)||_0x73bd('0x46')},{'name':_0x73bd('0x52'),'value':_0x17041d[_0x73bd('0x52')]||(_0x17041d['attrs']&&_0x17041d['attrs'][0x1]?_0x17041d['attrs'][0x1][_0x73bd('0x3a')]:undefined)||null},{'name':'attrSerie3','value':_0x17041d[_0x73bd('0x53')]||(_0x17041d['attrs']&&_0x17041d['attrs'][0x2]?_0x17041d['attrs'][0x2][_0x73bd('0x3a')]:undefined)||null},{'name':_0x73bd('0x47'),'value':_0x17041d[_0x73bd('0x47')]||(_0x17041d['attrs']&&_0x17041d['attrs'][0x3]?_0x17041d[_0x73bd('0x39')][0x3][_0x73bd('0x3a')]:undefined)||[]},{'name':_0x73bd('0x48'),'value':_0x17041d['attrChannel']||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x4]?_0x17041d[_0x73bd('0x39')][0x4][_0x73bd('0x3a')]:undefined)||_0x73bd('0x49')},{'name':_0x73bd('0x4a'),'value':_0x17041d[_0x73bd('0x4a')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x5]?_0x17041d[_0x73bd('0x39')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x17041d['attrFaxAccounts']||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x6]?_0x17041d['attrs'][0x6][_0x73bd('0x3a')]:undefined)||''},{'name':_0x73bd('0x4b'),'value':_0x17041d[_0x73bd('0x4b')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d['attrs'][0x7]?_0x17041d[_0x73bd('0x39')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x17041d[_0x73bd('0x4c')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d['attrs'][0x8]?_0x17041d[_0x73bd('0x39')][0x8][_0x73bd('0x3a')]:undefined)||''},{'name':_0x73bd('0x4d'),'value':_0x17041d[_0x73bd('0x4d')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d['attrs'][0x9]?_0x17041d[_0x73bd('0x39')][0x9][_0x73bd('0x3a')]:undefined)||''},{'name':_0x73bd('0x4e'),'value':_0x17041d[_0x73bd('0x4e')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0xa]?_0x17041d[_0x73bd('0x39')][0xa][_0x73bd('0x3a')]:undefined)||''}];case _0x73bd('0x54'):return[{'name':_0x73bd('0x55'),'type':_0x17041d[_0x73bd('0x56')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x0]?_0x17041d['attrs'][0x0][_0x73bd('0x57')]:undefined)||null,'value':_0x17041d[_0x73bd('0x55')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x0]?_0x17041d[_0x73bd('0x39')][0x0][_0x73bd('0x3a')]:undefined)||null},{'name':_0x73bd('0x58'),'value':_0x17041d[_0x73bd('0x58')]||(_0x17041d[_0x73bd('0x39')]&&_0x17041d[_0x73bd('0x39')][0x1]?_0x17041d[_0x73bd('0x39')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x8a9134){logger[_0x73bd('0x59')](_0x73bd('0x5a'),JSON['stringify'](_0x8a9134));return[];}}exports['create']=function(_0x5ba0c8,_0x26d045){if(_0x5ba0c8[_0x73bd('0x5b')]){_0x5ba0c8[_0x73bd('0x5b')][_0x73bd('0x39')]=widgetAttributes(_0x5ba0c8[_0x73bd('0x5b')]);}return db[_0x73bd('0x2c')][_0x73bd('0x5c')](_0x5ba0c8['body'],{})[_0x73bd('0x24')](respondWithResult(_0x26d045,0xc9))[_0x73bd('0x36')](handleError(_0x26d045,null));};exports['update']=function(_0xabeb51,_0x471673){if(_0xabeb51[_0x73bd('0x5b')]['id']){delete _0xabeb51[_0x73bd('0x5b')]['id'];}_0xabeb51[_0x73bd('0x5b')]['attrs']=widgetAttributes(_0xabeb51[_0x73bd('0x5b')]);return db[_0x73bd('0x2c')]['find']({'where':{'id':_0xabeb51[_0x73bd('0x29')]['id']}})[_0x73bd('0x24')](handleEntityNotFound(_0x471673,null))[_0x73bd('0x24')](saveUpdates(_0xabeb51['body'],null))['then'](respondWithResult(_0x471673,null))[_0x73bd('0x36')](handleError(_0x471673,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a224556..0741e8e 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 _0xc767=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x1bc38d,_0x41da7b){var _0x3acf8d=function(_0x5b65ad){while(--_0x5b65ad){_0x1bc38d['push'](_0x1bc38d['shift']());}};_0x3acf8d(++_0x41da7b);}(_0xc767,0x108));var _0x7c76=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0xc767[_0x319e2e];return _0x302524;};'use strict';var EventEmitter=require(_0x7c76('0x0'));var DashboardItem=require(_0x7c76('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7c76('0x2'),'afterUpdate':_0x7c76('0x3'),'afterDestroy':_0x7c76('0x4')};function emitEvent(_0x32a03c){return function(_0x4d208b,_0x1f4472,_0x1207e3){DashboardItemEvents[_0x7c76('0x5')](_0x32a03c+':'+_0x4d208b['id'],_0x4d208b);DashboardItemEvents[_0x7c76('0x5')](_0x32a03c,_0x4d208b);_0x1207e3(null);};}for(var e in events){if(events[_0x7c76('0x6')](e)){var event=events[e];DashboardItem[_0x7c76('0x7')](e,emitEvent(event));}}module[_0x7c76('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x1403=['hasOwnProperty','hook','exports','events','DashboardItem','setMaxListeners','remove','emit'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x1403,0xcb));var _0x3140=function(_0x5a5a32,_0x1b26e1){_0x5a5a32=_0x5a5a32-0x0;var _0x27499f=_0x1403[_0x5a5a32];return _0x27499f;};'use strict';var EventEmitter=require(_0x3140('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x3140('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x3140('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3140('0x3')};function emitEvent(_0x3062a1){return function(_0x1f6b9f,_0x2ca751,_0x4e17ad){DashboardItemEvents[_0x3140('0x4')](_0x3062a1+':'+_0x1f6b9f['id'],_0x1f6b9f);DashboardItemEvents[_0x3140('0x4')](_0x3062a1,_0x1f6b9f);_0x4e17ad(null);};}for(var e in events){if(events[_0x3140('0x5')](e)){var event=events[e];DashboardItem[_0x3140('0x6')](e,emitEvent(event));}}module[_0x3140('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index f3a6bb9..71a7cf5 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 _0x1f93=['exports','define','DashboardItem','dashboard_items','util','../../config/logger','api','bluebird','request-promise','rimraf','./dashboardItem.attributes'];(function(_0x849663,_0x19ca3b){var _0x7e62ae=function(_0x85d121){while(--_0x85d121){_0x849663['push'](_0x849663['shift']());}};_0x7e62ae(++_0x19ca3b);}(_0x1f93,0x19b));var _0x31f9=function(_0x314239,_0x423341){_0x314239=_0x314239-0x0;var _0x2f77ca=_0x1f93[_0x314239];return _0x2f77ca;};'use strict';var _=require('lodash');var util=require(_0x31f9('0x0'));var logger=require(_0x31f9('0x1'))(_0x31f9('0x2'));var moment=require('moment');var BPromise=require(_0x31f9('0x3'));var rp=require(_0x31f9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31f9('0x5'));var config=require('../../config/environment');var attributes=require(_0x31f9('0x6'));module[_0x31f9('0x7')]=function(_0x584af2,_0x5f309c){return _0x584af2[_0x31f9('0x8')](_0x31f9('0x9'),attributes,{'tableName':_0x31f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6e6=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','dashboard_items','lodash','../../config/logger','bluebird'];(function(_0x25f686,_0x199629){var _0x54ad10=function(_0x1f9083){while(--_0x1f9083){_0x25f686['push'](_0x25f686['shift']());}};_0x54ad10(++_0x199629);}(_0xa6e6,0x183));var _0x6a6e=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xa6e6[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0x6a6e('0x0'));var util=require('util');var logger=require(_0x6a6e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6a6e('0x2'));var rp=require(_0x6a6e('0x3'));var fs=require('fs');var path=require(_0x6a6e('0x4'));var rimraf=require(_0x6a6e('0x5'));var config=require(_0x6a6e('0x6'));var attributes=require(_0x6a6e('0x7'));module['exports']=function(_0xfc4153,_0x86f68c){return _0xfc4153[_0x6a6e('0x8')]('DashboardItem',attributes,{'tableName':_0x6a6e('0x9'),'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 9b59ecf..671b04b 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 _0x5675=['defaults','socket.io-emitter','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis'];(function(_0x24cd30,_0x13d408){var _0x357f1f=function(_0x5e9818){while(--_0x5e9818){_0x24cd30['push'](_0x24cd30['shift']());}};_0x357f1f(++_0x13d408);}(_0x5675,0xa4));var _0x5567=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x5675[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0x5567('0x0'));var util=require(_0x5567('0x1'));var moment=require(_0x5567('0x2'));var BPromise=require(_0x5567('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5567('0x4'));var db=require(_0x5567('0x5'))['db'];var utils=require(_0x5567('0x6'));var logger=require(_0x5567('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5567('0x8'));var client=jayson['client'][_0x5567('0x9')]({'port':0x232a});config[_0x5567('0xa')]=_[_0x5567('0xb')](config[_0x5567('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5567('0xc'))(new Redis(config[_0x5567('0xa')]));require(_0x5567('0xd'))[_0x5567('0xe')](socket);function respondWithRpcPromise(_0x61cd44,_0x31469b,_0x267a49){return new BPromise(function(_0x38c84f,_0x2164c5){return client[_0x5567('0xf')](_0x61cd44,_0x267a49)['then'](function(_0x29d92d){logger['info'](_0x5567('0x10'),_0x31469b,_0x5567('0x11'));logger[_0x5567('0x12')](_0x5567('0x13'),_0x31469b,'request\x20sent',JSON[_0x5567('0x14')](_0x29d92d));if(_0x29d92d[_0x5567('0x15')]){if(_0x29d92d[_0x5567('0x15')][_0x5567('0x16')]===0x1f4){logger[_0x5567('0x15')]('DashboardItem,\x20%s,\x20%s',_0x31469b,_0x29d92d[_0x5567('0x15')][_0x5567('0x17')]);return _0x2164c5(_0x29d92d[_0x5567('0x15')][_0x5567('0x17')]);}logger[_0x5567('0x15')]('DashboardItem,\x20%s,\x20%s',_0x31469b,_0x29d92d['error'][_0x5567('0x17')]);return _0x38c84f(_0x29d92d[_0x5567('0x15')][_0x5567('0x17')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x31469b,_0x5567('0x11'));_0x38c84f(_0x29d92d[_0x5567('0x18')][_0x5567('0x17')]);}})['catch'](function(_0x152dd8){logger[_0x5567('0x15')](_0x5567('0x10'),_0x31469b,_0x152dd8);_0x2164c5(_0x152dd8);});});} \ No newline at end of file +var _0x81aa=['localhost','socket.io-emitter','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults','redis'];(function(_0x21ac57,_0x24e91b){var _0x57cdf5=function(_0x3c16d2){while(--_0x3c16d2){_0x21ac57['push'](_0x21ac57['shift']());}};_0x57cdf5(++_0x24e91b);}(_0x81aa,0x173));var _0xa81a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x81aa[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xa81a('0x0'));var util=require(_0xa81a('0x1'));var moment=require(_0xa81a('0x2'));var BPromise=require(_0xa81a('0x3'));var rs=require(_0xa81a('0x4'));var fs=require('fs');var Redis=require(_0xa81a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa81a('0x6'))(_0xa81a('0x7'));var config=require(_0xa81a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa81a('0x9')][_0xa81a('0xa')]({'port':0x232a});config['redis']=_[_0xa81a('0xb')](config[_0xa81a('0xc')],{'host':_0xa81a('0xd'),'port':0x18eb});var socket=require(_0xa81a('0xe'))(new Redis(config[_0xa81a('0xc')]));require('./dashboardItem.socket')[_0xa81a('0xf')](socket);function respondWithRpcPromise(_0x2c9a8a,_0x1d3b50,_0x2cf55f){return new BPromise(function(_0x580cd4,_0xee37d1){return client['request'](_0x2c9a8a,_0x2cf55f)[_0xa81a('0x10')](function(_0x5b0df5){logger[_0xa81a('0x11')](_0xa81a('0x12'),_0x1d3b50,_0xa81a('0x13'));logger['debug'](_0xa81a('0x14'),_0x1d3b50,_0xa81a('0x13'),JSON['stringify'](_0x5b0df5));if(_0x5b0df5[_0xa81a('0x15')]){if(_0x5b0df5[_0xa81a('0x15')]['code']===0x1f4){logger[_0xa81a('0x15')](_0xa81a('0x12'),_0x1d3b50,_0x5b0df5[_0xa81a('0x15')][_0xa81a('0x16')]);return _0xee37d1(_0x5b0df5[_0xa81a('0x15')][_0xa81a('0x16')]);}logger[_0xa81a('0x15')]('DashboardItem,\x20%s,\x20%s',_0x1d3b50,_0x5b0df5['error'][_0xa81a('0x16')]);return _0x580cd4(_0x5b0df5[_0xa81a('0x15')][_0xa81a('0x16')]);}else{logger['info'](_0xa81a('0x12'),_0x1d3b50,_0xa81a('0x13'));_0x580cd4(_0x5b0df5[_0xa81a('0x17')][_0xa81a('0x16')]);}})['catch'](function(_0x5cc312){logger[_0xa81a('0x15')](_0xa81a('0x12'),_0x1d3b50,_0x5cc312);_0xee37d1(_0x5cc312);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 4f09039..cf98ec6 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 _0x209a=['update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x108deb,_0x141434){var _0x5826ab=function(_0x4a5dcd){while(--_0x4a5dcd){_0x108deb['push'](_0x108deb['shift']());}};_0x5826ab(++_0x141434);}(_0x209a,0xba));var _0xa209=function(_0x87a5a3,_0x43a3f5){_0x87a5a3=_0x87a5a3-0x0;var _0x498feb=_0x209a[_0x87a5a3];return _0x498feb;};'use strict';var DashboardItemEvents=require(_0xa209('0x0'));var events=[_0xa209('0x1'),_0xa209('0x2'),_0xa209('0x3')];function createListener(_0x1d26ba,_0x16d39b){return function(_0x5ab220){_0x16d39b[_0xa209('0x4')](_0x1d26ba,_0x5ab220);};}function removeListener(_0x3e28df,_0x4a9f5a){return function(){DashboardItemEvents[_0xa209('0x5')](_0x3e28df,_0x4a9f5a);};}exports[_0xa209('0x6')]=function(_0x5e9cab){for(var _0x147c51=0x0,_0x256f78=events[_0xa209('0x7')];_0x147c51<_0x256f78;_0x147c51++){var _0x439039=events[_0x147c51];var _0x4df966=createListener(_0xa209('0x8')+_0x439039,_0x5e9cab);DashboardItemEvents['on'](_0x439039,_0x4df966);}}; \ No newline at end of file +var _0x2d19=['register','length','save','remove','removeListener'];(function(_0x189478,_0x20412c){var _0x24d237=function(_0x339305){while(--_0x339305){_0x189478['push'](_0x189478['shift']());}};_0x24d237(++_0x20412c);}(_0x2d19,0x15b));var _0x92d1=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0x2d19[_0xb66df];return _0x42a702;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x92d1('0x0'),_0x92d1('0x1'),'update'];function createListener(_0x4daade,_0x2ff89f){return function(_0x5383c5){_0x2ff89f['emit'](_0x4daade,_0x5383c5);};}function removeListener(_0x46f210,_0x335b4f){return function(){DashboardItemEvents[_0x92d1('0x2')](_0x46f210,_0x335b4f);};}exports[_0x92d1('0x3')]=function(_0x297a17){for(var _0x1b9fa3=0x0,_0x1639c8=events[_0x92d1('0x4')];_0x1b9fa3<_0x1639c8;_0x1b9fa3++){var _0x4ae41c=events[_0x1b9fa3];var _0xefa1ad=createListener('dashboardItem:'+_0x4ae41c,_0x297a17);DashboardItemEvents['on'](_0x4ae41c,_0xefa1ad);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 40667ee..3038a39 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 _0xcd7b=['get','/:id','isAuthenticated','show','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./dashboardItem.controller'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xcd7b,0x116));var _0xbcd7=function(_0x57e869,_0x18a92d){_0x57e869=_0x57e869-0x0;var _0x4524db=_0xcd7b[_0x57e869];return _0x4524db;};'use strict';var multer=require(_0xbcd7('0x0'));var util=require('util');var path=require(_0xbcd7('0x1'));var timeout=require(_0xbcd7('0x2'));var express=require(_0xbcd7('0x3'));var router=express['Router']();var fs_extra=require(_0xbcd7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbcd7('0x5'));var controller=require(_0xbcd7('0x6'));router[_0xbcd7('0x7')](_0xbcd7('0x8'),auth[_0xbcd7('0x9')](),controller[_0xbcd7('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbcd7('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbcd7('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbcd7('0xd')]);module[_0xbcd7('0xe')]=router; \ No newline at end of file +var _0x9631=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','create','put','update','destroy','util'];(function(_0x463b91,_0x53490e){var _0x3803a1=function(_0x37ef87){while(--_0x37ef87){_0x463b91['push'](_0x463b91['shift']());}};_0x3803a1(++_0x53490e);}(_0x9631,0xaf));var _0x1963=function(_0x25c57f,_0x30ca62){_0x25c57f=_0x25c57f-0x0;var _0x1e77d2=_0x9631[_0x25c57f];return _0x1e77d2;};'use strict';var multer=require('multer');var util=require(_0x1963('0x0'));var path=require(_0x1963('0x1'));var timeout=require('connect-timeout');var express=require(_0x1963('0x2'));var router=express[_0x1963('0x3')]();var fs_extra=require(_0x1963('0x4'));var auth=require(_0x1963('0x5'));var interaction=require(_0x1963('0x6'));var config=require(_0x1963('0x7'));var controller=require(_0x1963('0x8'));router['get'](_0x1963('0x9'),auth[_0x1963('0xa')](),controller[_0x1963('0xb')]);router['post']('/',auth[_0x1963('0xa')](),controller[_0x1963('0xc')]);router[_0x1963('0xd')](_0x1963('0x9'),auth[_0x1963('0xa')](),controller[_0x1963('0xe')]);router['delete'](_0x1963('0x9'),auth['isAuthenticated'](),controller[_0x1963('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 04d8e4a..db441d2 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 _0x3418=['first','second','third','sequelize','STRING','ENUM'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x3418,0xbd));var _0x8341=function(_0xcc23d9,_0xdf1edb){_0xcc23d9=_0xcc23d9-0x0;var _0x54d3c3=_0x3418[_0xcc23d9];return _0x54d3c3;};'use strict';var Sequelize=require(_0x8341('0x0'));module['exports']={'name':{'type':Sequelize[_0x8341('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x8341('0x2')](_0x8341('0x3'),_0x8341('0x4'),_0x8341('0x5')),'allowNull':![],'defaultValue':_0x8341('0x3')},'description':{'type':Sequelize[_0x8341('0x1')]}}; \ No newline at end of file +var _0x05f8=['second','third','first','STRING'];(function(_0x10dc07,_0x2501ab){var _0x476f2b=function(_0x50a82c){while(--_0x50a82c){_0x10dc07['push'](_0x10dc07['shift']());}};_0x476f2b(++_0x2501ab);}(_0x05f8,0x197));var _0x805f=function(_0x266360,_0x3565e0){_0x266360=_0x266360-0x0;var _0x3a7105=_0x05f8[_0x266360];return _0x3a7105;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x805f('0x0')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0x805f('0x1'),_0x805f('0x2')),'allowNull':![],'defaultValue':_0x805f('0x3')},'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 023db19..c3b60be 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 _0x5692=['undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x5692,0x14a));var _0x2569=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5692[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x2569('0x0'));var rimraf=require(_0x2569('0x1'));var zipdir=require(_0x2569('0x2'));var jsonpatch=require(_0x2569('0x3'));var rp=require('request-promise');var moment=require(_0x2569('0x4'));var BPromise=require(_0x2569('0x5'));var Mustache=require(_0x2569('0x6'));var util=require(_0x2569('0x7'));var path=require(_0x2569('0x8'));var sox=require(_0x2569('0x9'));var csv=require('to-csv');var ejs=require(_0x2569('0xa'));var fs=require('fs');var fs_extra=require(_0x2569('0xb'));var _=require(_0x2569('0xc'));var squel=require(_0x2569('0xd'));var crypto=require(_0x2569('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2569('0xf'));var toCsv=require(_0x2569('0x10'));var querystring=require('querystring');var Papa=require(_0x2569('0x11'));var Redis=require(_0x2569('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2569('0x13'));var as=require(_0x2569('0x14'));var hardwareService=require(_0x2569('0x15'));var logger=require(_0x2569('0x16'))(_0x2569('0x17'));var utils=require(_0x2569('0x18'));var config=require(_0x2569('0x19'));var licenseUtil=require(_0x2569('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15ca33,_0xf4d960){_0xf4d960=_0xf4d960||0xcc;return function(_0x2327bc){if(_0x2327bc){return _0x15ca33[_0x2569('0x1b')](_0xf4d960);}return _0x15ca33['status'](_0xf4d960)['end']();};}function respondWithResult(_0x295de2,_0x3f03f9){_0x3f03f9=_0x3f03f9||0xc8;return function(_0x140756){if(_0x140756){return _0x295de2[_0x2569('0x1c')](_0x3f03f9)[_0x2569('0x1d')](_0x140756);}};}function respondWithFilteredResult(_0xc4b87e,_0x3f6806){return function(_0x47f097){if(_0x47f097){var _0x110076=typeof _0x3f6806['offset']===_0x2569('0x1e')&&typeof _0x3f6806[_0x2569('0x1f')]==='undefined';var _0x1decc4=_0x47f097[_0x2569('0x20')];var _0x169783=_0x110076?0x0:_0x3f6806[_0x2569('0x21')];var _0x31a1f1=_0x110076?_0x47f097['count']:_0x3f6806['offset']+_0x3f6806[_0x2569('0x1f')];var _0x5b5623;if(_0x31a1f1>=_0x1decc4){_0x31a1f1=_0x1decc4;_0x5b5623=0xc8;}else{_0x5b5623=0xce;}_0xc4b87e['status'](_0x5b5623);return _0xc4b87e[_0x2569('0x22')](_0x2569('0x23'),_0x169783+'-'+_0x31a1f1+'/'+_0x1decc4)[_0x2569('0x1d')](_0x47f097);}return null;};}function patchUpdates(_0x5621dc){return function(_0x3caab4){try{jsonpatch['apply'](_0x3caab4,_0x5621dc,!![]);}catch(_0x569e79){return BPromise[_0x2569('0x24')](_0x569e79);}return _0x3caab4[_0x2569('0x25')]();};}function saveUpdates(_0x354f93,_0x376385){return function(_0x218f40){if(_0x218f40){return _0x218f40[_0x2569('0x26')](_0x354f93)[_0x2569('0x27')](function(_0x386960){return _0x386960;});}return null;};}function removeEntity(_0x15c662,_0x163efe){return function(_0x534b05){if(_0x534b05){return _0x534b05[_0x2569('0x28')]()['then'](function(){var _0x253025=_0x534b05[_0x2569('0x29')]({'plain':!![]});var _0x18ca8d=_0x2569('0x2a');return db[_0x2569('0x2b')][_0x2569('0x28')]({'where':{'type':_0x18ca8d,'resourceId':_0x253025['id']}})['then'](function(){return _0x534b05;});})[_0x2569('0x27')](function(){_0x15c662['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1935a3,_0xdfe96b){return function(_0x18ebbe){if(!_0x18ebbe){_0x1935a3[_0x2569('0x1b')](0x194);}return _0x18ebbe;};}function handleError(_0x533baf,_0xa31edc){_0xa31edc=_0xa31edc||0x1f4;return function(_0x40fab0){logger[_0x2569('0x2c')](_0x40fab0[_0x2569('0x2d')]);if(_0x40fab0[_0x2569('0x2e')]){delete _0x40fab0[_0x2569('0x2e')];}_0x533baf[_0x2569('0x1c')](_0xa31edc)[_0x2569('0x2f')](_0x40fab0);};}exports[_0x2569('0x30')]=function(_0x26f297,_0x373828){var _0x6ae88b={},_0x3d5b60={},_0x105741={'count':0x0,'rows':[]};var _0x412110=_[_0x2569('0x31')](db[_0x2569('0x32')][_0x2569('0x33')],function(_0x5b4a66){return{'name':_0x5b4a66[_0x2569('0x34')],'type':_0x5b4a66[_0x2569('0x35')][_0x2569('0x36')]};});_0x3d5b60[_0x2569('0x37')]=_[_0x2569('0x31')](_0x412110,_0x2569('0x2e'));_0x3d5b60[_0x2569('0x38')]=_['keys'](_0x26f297[_0x2569('0x38')]);_0x3d5b60[_0x2569('0x39')]=_[_0x2569('0x3a')](_0x3d5b60[_0x2569('0x37')],_0x3d5b60[_0x2569('0x38')]);_0x6ae88b[_0x2569('0x3b')]=_[_0x2569('0x3a')](_0x3d5b60[_0x2569('0x37')],qs[_0x2569('0x3c')](_0x26f297['query']['fields']));_0x6ae88b[_0x2569('0x3b')]=_0x6ae88b[_0x2569('0x3b')][_0x2569('0x3d')]?_0x6ae88b['attributes']:_0x3d5b60[_0x2569('0x37')];if(!_0x26f297[_0x2569('0x38')][_0x2569('0x3e')](_0x2569('0x3f'))){_0x6ae88b['limit']=qs['limit'](_0x26f297[_0x2569('0x38')][_0x2569('0x1f')]);_0x6ae88b[_0x2569('0x21')]=qs['offset'](_0x26f297[_0x2569('0x38')][_0x2569('0x21')]);}_0x6ae88b[_0x2569('0x40')]=qs[_0x2569('0x41')](_0x26f297[_0x2569('0x38')][_0x2569('0x41')]);_0x6ae88b[_0x2569('0x42')]=qs[_0x2569('0x39')](_[_0x2569('0x43')](_0x26f297[_0x2569('0x38')],_0x3d5b60['filters']),_0x412110);if(_0x26f297[_0x2569('0x38')][_0x2569('0x44')]){_0x6ae88b['where']=_[_0x2569('0x45')](_0x6ae88b[_0x2569('0x42')],{'$or':_[_0x2569('0x31')](_0x412110,function(_0x152f71){if(_0x152f71[_0x2569('0x35')]!==_0x2569('0x46')){var _0x465b53={};_0x465b53[_0x152f71[_0x2569('0x2e')]]={'$like':'%'+_0x26f297[_0x2569('0x38')][_0x2569('0x44')]+'%'};return _0x465b53;}})});}_0x6ae88b=_[_0x2569('0x45')]({},_0x6ae88b,_0x26f297[_0x2569('0x47')]);var _0x3050da={'where':_0x6ae88b[_0x2569('0x42')]};return db[_0x2569('0x32')][_0x2569('0x20')](_0x3050da)[_0x2569('0x27')](function(_0x5a8031){_0x105741[_0x2569('0x20')]=_0x5a8031;if(_0x26f297[_0x2569('0x38')][_0x2569('0x48')]){_0x6ae88b[_0x2569('0x49')]=[{'all':!![]}];}return db[_0x2569('0x32')][_0x2569('0x4a')](_0x6ae88b);})[_0x2569('0x27')](function(_0x3b07d0){_0x105741[_0x2569('0x4b')]=_0x3b07d0;return _0x105741;})[_0x2569('0x27')](respondWithFilteredResult(_0x373828,_0x6ae88b))[_0x2569('0x4c')](handleError(_0x373828,null));};exports[_0x2569('0x4d')]=function(_0x763798,_0x50953a){var _0x37df1d={'raw':!![],'where':{'id':_0x763798[_0x2569('0x4e')]['id']}},_0x588f5d={};_0x588f5d[_0x2569('0x37')]=_[_0x2569('0x4f')](db[_0x2569('0x32')][_0x2569('0x33')]);_0x588f5d[_0x2569('0x38')]=_['keys'](_0x763798['query']);_0x588f5d[_0x2569('0x39')]=_[_0x2569('0x3a')](_0x588f5d[_0x2569('0x37')],_0x588f5d[_0x2569('0x38')]);_0x37df1d[_0x2569('0x3b')]=_[_0x2569('0x3a')](_0x588f5d[_0x2569('0x37')],qs[_0x2569('0x3c')](_0x763798[_0x2569('0x38')]['fields']));_0x37df1d[_0x2569('0x3b')]=_0x37df1d[_0x2569('0x3b')][_0x2569('0x3d')]?_0x37df1d[_0x2569('0x3b')]:_0x588f5d['model'];if(_0x763798[_0x2569('0x38')][_0x2569('0x48')]){_0x37df1d['include']=[{'all':!![]}];}_0x37df1d=_[_0x2569('0x45')]({},_0x37df1d,_0x763798[_0x2569('0x47')]);return db[_0x2569('0x32')]['find'](_0x37df1d)['then'](handleEntityNotFound(_0x50953a,null))[_0x2569('0x27')](respondWithResult(_0x50953a,null))['catch'](handleError(_0x50953a,null));};exports[_0x2569('0x50')]=function(_0xb045a0,_0x4fa9e0){return db[_0x2569('0x32')][_0x2569('0x50')](_0xb045a0[_0x2569('0x51')],{})[_0x2569('0x27')](function(_0x15918c){var _0x2da8d4=_0xb045a0[_0x2569('0x52')][_0x2569('0x29')]({'plain':!![]});if(!_0x2da8d4)throw new Error(_0x2569('0x53'));if(_0x2da8d4[_0x2569('0x54')]===_0x2569('0x52')){var _0x3f3fc6=_0x15918c['get']({'plain':!![]});var _0x51d862='Dispositions';return db[_0x2569('0x55')]['find']({'where':{'name':_0x51d862,'userProfileId':_0x2da8d4[_0x2569('0x56')]},'raw':!![]})[_0x2569('0x27')](function(_0x2d828d){if(_0x2d828d&&_0x2d828d[_0x2569('0x57')]===0x0){return db['UserProfileResource'][_0x2569('0x50')]({'name':_0x3f3fc6[_0x2569('0x2e')],'resourceId':_0x3f3fc6['id'],'type':_0x2d828d[_0x2569('0x2e')],'sectionId':_0x2d828d['id']},{})[_0x2569('0x27')](function(){return _0x15918c;});}else{return _0x15918c;}})[_0x2569('0x4c')](function(_0x31d978){logger[_0x2569('0x2c')](_0x2569('0x58'),_0x31d978);throw _0x31d978;});}return _0x15918c;})['then'](respondWithResult(_0x4fa9e0,0xc9))[_0x2569('0x4c')](handleError(_0x4fa9e0,null));};exports['update']=function(_0x138996,_0x1e8fe8){if(_0x138996[_0x2569('0x51')]['id']){delete _0x138996['body']['id'];}return db[_0x2569('0x32')][_0x2569('0x59')]({'where':{'id':_0x138996[_0x2569('0x4e')]['id']}})[_0x2569('0x27')](handleEntityNotFound(_0x1e8fe8,null))[_0x2569('0x27')](saveUpdates(_0x138996['body'],null))[_0x2569('0x27')](respondWithResult(_0x1e8fe8,null))[_0x2569('0x4c')](handleError(_0x1e8fe8,null));};exports['destroy']=function(_0x24244c,_0x56fcf6){return db['Disposition']['find']({'where':{'id':_0x24244c['params']['id']}})[_0x2569('0x27')](handleEntityNotFound(_0x56fcf6,null))[_0x2569('0x27')](removeEntity(_0x56fcf6,null))['catch'](handleError(_0x56fcf6,null));}; \ No newline at end of file +var _0x3649=['index','map','Disposition','rawAttributes','fieldName','type','key','model','name','keys','query','intersection','fields','attributes','length','nolimit','offset','order','sort','where','filters','pick','VIRTUAL','merge','options','include','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','Dispositions','UserProfileResource','destroy','end','sendStatus','error','stack'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x3649,0x1d1));var _0x9364=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x3649[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0x9364('0x0'));var rimraf=require(_0x9364('0x1'));var zipdir=require(_0x9364('0x2'));var jsonpatch=require(_0x9364('0x3'));var rp=require(_0x9364('0x4'));var moment=require(_0x9364('0x5'));var BPromise=require(_0x9364('0x6'));var Mustache=require(_0x9364('0x7'));var util=require(_0x9364('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9364('0x9'));var fs=require('fs');var fs_extra=require(_0x9364('0xa'));var _=require(_0x9364('0xb'));var squel=require('squel');var crypto=require(_0x9364('0xc'));var jsforce=require(_0x9364('0xd'));var deskjs=require(_0x9364('0xe'));var toCsv=require(_0x9364('0xf'));var querystring=require('querystring');var Papa=require(_0x9364('0x10'));var Redis=require(_0x9364('0x11'));var authService=require(_0x9364('0x12'));var qs=require(_0x9364('0x13'));var as=require(_0x9364('0x14'));var hardwareService=require(_0x9364('0x15'));var logger=require(_0x9364('0x16'))('api');var utils=require(_0x9364('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9364('0x18'));var db=require(_0x9364('0x19'))['db'];function respondWithStatusCode(_0x207b89,_0x58e03b){_0x58e03b=_0x58e03b||0xcc;return function(_0x566981){if(_0x566981){return _0x207b89['sendStatus'](_0x58e03b);}return _0x207b89[_0x9364('0x1a')](_0x58e03b)['end']();};}function respondWithResult(_0x4d3716,_0x2bafbb){_0x2bafbb=_0x2bafbb||0xc8;return function(_0x8c011){if(_0x8c011){return _0x4d3716[_0x9364('0x1a')](_0x2bafbb)[_0x9364('0x1b')](_0x8c011);}};}function respondWithFilteredResult(_0x59ac48,_0x515815){return function(_0x5ad5c0){if(_0x5ad5c0){var _0x559a52=typeof _0x515815['offset']===_0x9364('0x1c')&&typeof _0x515815[_0x9364('0x1d')]===_0x9364('0x1c');var _0x37c43e=_0x5ad5c0[_0x9364('0x1e')];var _0x587c39=_0x559a52?0x0:_0x515815['offset'];var _0x1a5222=_0x559a52?_0x5ad5c0[_0x9364('0x1e')]:_0x515815['offset']+_0x515815['limit'];var _0x384f01;if(_0x1a5222>=_0x37c43e){_0x1a5222=_0x37c43e;_0x384f01=0xc8;}else{_0x384f01=0xce;}_0x59ac48['status'](_0x384f01);return _0x59ac48[_0x9364('0x1f')](_0x9364('0x20'),_0x587c39+'-'+_0x1a5222+'/'+_0x37c43e)[_0x9364('0x1b')](_0x5ad5c0);}return null;};}function patchUpdates(_0x202201){return function(_0x437a99){try{jsonpatch[_0x9364('0x21')](_0x437a99,_0x202201,!![]);}catch(_0x305aeb){return BPromise[_0x9364('0x22')](_0x305aeb);}return _0x437a99[_0x9364('0x23')]();};}function saveUpdates(_0x1e49b8,_0x3de31a){return function(_0x331b72){if(_0x331b72){return _0x331b72['update'](_0x1e49b8)[_0x9364('0x24')](function(_0x73deb3){return _0x73deb3;});}return null;};}function removeEntity(_0x1dc21d,_0x3c7a4a){return function(_0xd0df40){if(_0xd0df40){return _0xd0df40['destroy']()[_0x9364('0x24')](function(){var _0x30ec36=_0xd0df40[_0x9364('0x25')]({'plain':!![]});var _0x595db9=_0x9364('0x26');return db[_0x9364('0x27')][_0x9364('0x28')]({'where':{'type':_0x595db9,'resourceId':_0x30ec36['id']}})[_0x9364('0x24')](function(){return _0xd0df40;});})['then'](function(){_0x1dc21d[_0x9364('0x1a')](0xcc)[_0x9364('0x29')]();});}};}function handleEntityNotFound(_0x44d7e9,_0x3cfe90){return function(_0x506db5){if(!_0x506db5){_0x44d7e9[_0x9364('0x2a')](0x194);}return _0x506db5;};}function handleError(_0x5277e6,_0x7d3707){_0x7d3707=_0x7d3707||0x1f4;return function(_0x1d9788){logger[_0x9364('0x2b')](_0x1d9788[_0x9364('0x2c')]);if(_0x1d9788['name']){delete _0x1d9788['name'];}_0x5277e6[_0x9364('0x1a')](_0x7d3707)['send'](_0x1d9788);};}exports[_0x9364('0x2d')]=function(_0x4e967b,_0x1dca39){var _0x25fd1b={},_0x50cd12={},_0xd297d6={'count':0x0,'rows':[]};var _0xed8ee=_[_0x9364('0x2e')](db[_0x9364('0x2f')][_0x9364('0x30')],function(_0x54d1c7){return{'name':_0x54d1c7[_0x9364('0x31')],'type':_0x54d1c7[_0x9364('0x32')][_0x9364('0x33')]};});_0x50cd12[_0x9364('0x34')]=_[_0x9364('0x2e')](_0xed8ee,_0x9364('0x35'));_0x50cd12['query']=_[_0x9364('0x36')](_0x4e967b[_0x9364('0x37')]);_0x50cd12['filters']=_[_0x9364('0x38')](_0x50cd12['model'],_0x50cd12['query']);_0x25fd1b['attributes']=_[_0x9364('0x38')](_0x50cd12['model'],qs[_0x9364('0x39')](_0x4e967b[_0x9364('0x37')][_0x9364('0x39')]));_0x25fd1b[_0x9364('0x3a')]=_0x25fd1b[_0x9364('0x3a')][_0x9364('0x3b')]?_0x25fd1b[_0x9364('0x3a')]:_0x50cd12[_0x9364('0x34')];if(!_0x4e967b[_0x9364('0x37')]['hasOwnProperty'](_0x9364('0x3c'))){_0x25fd1b[_0x9364('0x1d')]=qs['limit'](_0x4e967b['query'][_0x9364('0x1d')]);_0x25fd1b[_0x9364('0x3d')]=qs[_0x9364('0x3d')](_0x4e967b[_0x9364('0x37')][_0x9364('0x3d')]);}_0x25fd1b[_0x9364('0x3e')]=qs[_0x9364('0x3f')](_0x4e967b[_0x9364('0x37')]['sort']);_0x25fd1b[_0x9364('0x40')]=qs[_0x9364('0x41')](_[_0x9364('0x42')](_0x4e967b[_0x9364('0x37')],_0x50cd12[_0x9364('0x41')]),_0xed8ee);if(_0x4e967b[_0x9364('0x37')]['filter']){_0x25fd1b[_0x9364('0x40')]=_['merge'](_0x25fd1b[_0x9364('0x40')],{'$or':_[_0x9364('0x2e')](_0xed8ee,function(_0x32d296){if(_0x32d296['type']!==_0x9364('0x43')){var _0x54796b={};_0x54796b[_0x32d296[_0x9364('0x35')]]={'$like':'%'+_0x4e967b['query']['filter']+'%'};return _0x54796b;}})});}_0x25fd1b=_[_0x9364('0x44')]({},_0x25fd1b,_0x4e967b[_0x9364('0x45')]);var _0xa0919d={'where':_0x25fd1b[_0x9364('0x40')]};return db[_0x9364('0x2f')][_0x9364('0x1e')](_0xa0919d)[_0x9364('0x24')](function(_0x3cc912){_0xd297d6['count']=_0x3cc912;if(_0x4e967b[_0x9364('0x37')]['includeAll']){_0x25fd1b[_0x9364('0x46')]=[{'all':!![]}];}return db[_0x9364('0x2f')]['findAll'](_0x25fd1b);})['then'](function(_0x1bbafb){_0xd297d6[_0x9364('0x47')]=_0x1bbafb;return _0xd297d6;})['then'](respondWithFilteredResult(_0x1dca39,_0x25fd1b))[_0x9364('0x48')](handleError(_0x1dca39,null));};exports['show']=function(_0xe81d20,_0x4d308b){var _0x4acc65={'raw':!![],'where':{'id':_0xe81d20['params']['id']}},_0x226fd0={};_0x226fd0['model']=_[_0x9364('0x36')](db[_0x9364('0x2f')]['rawAttributes']);_0x226fd0[_0x9364('0x37')]=_[_0x9364('0x36')](_0xe81d20['query']);_0x226fd0['filters']=_[_0x9364('0x38')](_0x226fd0[_0x9364('0x34')],_0x226fd0[_0x9364('0x37')]);_0x4acc65[_0x9364('0x3a')]=_[_0x9364('0x38')](_0x226fd0[_0x9364('0x34')],qs[_0x9364('0x39')](_0xe81d20[_0x9364('0x37')][_0x9364('0x39')]));_0x4acc65[_0x9364('0x3a')]=_0x4acc65['attributes'][_0x9364('0x3b')]?_0x4acc65['attributes']:_0x226fd0['model'];if(_0xe81d20['query'][_0x9364('0x49')]){_0x4acc65[_0x9364('0x46')]=[{'all':!![]}];}_0x4acc65=_[_0x9364('0x44')]({},_0x4acc65,_0xe81d20[_0x9364('0x45')]);return db[_0x9364('0x2f')][_0x9364('0x4a')](_0x4acc65)[_0x9364('0x24')](handleEntityNotFound(_0x4d308b,null))[_0x9364('0x24')](respondWithResult(_0x4d308b,null))[_0x9364('0x48')](handleError(_0x4d308b,null));};exports[_0x9364('0x4b')]=function(_0x563603,_0x417538){return db[_0x9364('0x2f')][_0x9364('0x4b')](_0x563603[_0x9364('0x4c')],{})[_0x9364('0x24')](function(_0x11060d){var _0x2cc65b=_0x563603[_0x9364('0x4d')][_0x9364('0x25')]({'plain':!![]});if(!_0x2cc65b)throw new Error(_0x9364('0x4e'));if(_0x2cc65b[_0x9364('0x4f')]===_0x9364('0x4d')){var _0x3bd8e6=_0x11060d[_0x9364('0x25')]({'plain':!![]});var _0x595949=_0x9364('0x26');return db[_0x9364('0x50')][_0x9364('0x4a')]({'where':{'name':_0x595949,'userProfileId':_0x2cc65b[_0x9364('0x51')]},'raw':!![]})['then'](function(_0x34cba4){if(_0x34cba4&&_0x34cba4[_0x9364('0x52')]===0x0){return db['UserProfileResource'][_0x9364('0x4b')]({'name':_0x3bd8e6[_0x9364('0x35')],'resourceId':_0x3bd8e6['id'],'type':_0x34cba4['name'],'sectionId':_0x34cba4['id']},{})[_0x9364('0x24')](function(){return _0x11060d;});}else{return _0x11060d;}})[_0x9364('0x48')](function(_0x44f064){logger['error'](_0x9364('0x53'),_0x44f064);throw _0x44f064;});}return _0x11060d;})[_0x9364('0x24')](respondWithResult(_0x417538,0xc9))[_0x9364('0x48')](handleError(_0x417538,null));};exports['update']=function(_0x2ae3fd,_0x1fddda){if(_0x2ae3fd['body']['id']){delete _0x2ae3fd[_0x9364('0x4c')]['id'];}return db[_0x9364('0x2f')][_0x9364('0x4a')]({'where':{'id':_0x2ae3fd[_0x9364('0x54')]['id']}})[_0x9364('0x24')](handleEntityNotFound(_0x1fddda,null))[_0x9364('0x24')](saveUpdates(_0x2ae3fd[_0x9364('0x4c')],null))[_0x9364('0x24')](respondWithResult(_0x1fddda,null))['catch'](handleError(_0x1fddda,null));};exports['destroy']=function(_0xca29e7,_0x1d2d87){return db['Disposition'][_0x9364('0x4a')]({'where':{'id':_0xca29e7[_0x9364('0x54')]['id']}})[_0x9364('0x24')](handleEntityNotFound(_0x1d2d87,null))[_0x9364('0x24')](removeEntity(_0x1d2d87,null))[_0x9364('0x48')](handleError(_0x1d2d87,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index afb53e1..e468ea4 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 _0x157b=['name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','moment','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x157b,0x121));var _0xb157=function(_0x2f64e8,_0x4ec85b){_0x2f64e8=_0x2f64e8-0x0;var _0x11613b=_0x157b[_0x2f64e8];return _0x11613b;};'use strict';var _=require(_0xb157('0x0'));var util=require(_0xb157('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb157('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb157('0x3'));var rimraf=require(_0xb157('0x4'));var config=require(_0xb157('0x5'));var attributes=require(_0xb157('0x6'));module[_0xb157('0x7')]=function(_0xfcd6f9,_0x46d9a9){return _0xfcd6f9[_0xb157('0x8')](_0xb157('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xb157('0xa'),_0xb157('0xb')]},{'unique':!![],'name':_0xb157('0xc'),'fields':[_0xb157('0xa'),_0xb157('0xd')]},{'unique':!![],'name':_0xb157('0xe'),'fields':[_0xb157('0xa'),'MailAccountId']},{'unique':!![],'name':_0xb157('0xf'),'fields':[_0xb157('0xa'),_0xb157('0x10')]},{'unique':!![],'name':_0xb157('0x11'),'fields':['name',_0xb157('0x12')]},{'unique':!![],'name':_0xb157('0x13'),'fields':[_0xb157('0xa'),_0xb157('0x14')]},{'unique':!![],'name':_0xb157('0x15'),'fields':[_0xb157('0xa'),_0xb157('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd01=['name_fax','OpenchannelAccountId','name_whatsapp','lodash','api','bluebird','request-promise','rimraf','../../config/environment','exports','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','MailAccountId','SmsAccountId'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdd01,0x159));var _0x1dd0=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xdd01[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x1dd0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1dd0('0x1'));var moment=require('moment');var BPromise=require(_0x1dd0('0x2'));var rp=require(_0x1dd0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1dd0('0x4'));var config=require(_0x1dd0('0x5'));var attributes=require('./disposition.attributes');module[_0x1dd0('0x6')]=function(_0x1a57d3,_0x2664aa){return _0x1a57d3['define'](_0x1dd0('0x7'),attributes,{'tableName':_0x1dd0('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x1dd0('0x9'),_0x1dd0('0xa')]},{'unique':!![],'name':_0x1dd0('0xb'),'fields':['name',_0x1dd0('0xc')]},{'unique':!![],'name':'name_mail','fields':['name',_0x1dd0('0xd')]},{'unique':!![],'name':'name_sms','fields':[_0x1dd0('0x9'),_0x1dd0('0xe')]},{'unique':!![],'name':_0x1dd0('0xf'),'fields':['name','FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x1dd0('0x9'),_0x1dd0('0x10')]},{'unique':!![],'name':_0x1dd0('0x11'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 86a00b7..abd5ff1 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(_0x1de4df,_0x279ba1){var _0xcc77d2=function(_0x4bb909){while(--_0x4bb909){_0x1de4df['push'](_0x1de4df['shift']());}};_0xcc77d2(++_0x279ba1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x4b9270,_0x5ec53b){var _0x2fd58f=function(_0x159059){while(--_0x159059){_0x4b9270['push'](_0x4b9270['shift']());}};_0x2fd58f(++_0x5ec53b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 4e30fc0..9a316cd 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 _0x006c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x390c7c,_0xfb7732){var _0x459479=function(_0x34b420){while(--_0x34b420){_0x390c7c['push'](_0x390c7c['shift']());}};_0x459479(++_0xfb7732);}(_0x006c,0x9d));var _0xc006=function(_0x181063,_0x38b543){_0x181063=_0x181063-0x0;var _0x248efa=_0x006c[_0x181063];return _0x248efa;};'use strict';var multer=require(_0xc006('0x0'));var util=require(_0xc006('0x1'));var path=require(_0xc006('0x2'));var timeout=require('connect-timeout');var express=require(_0xc006('0x3'));var router=express[_0xc006('0x4')]();var fs_extra=require(_0xc006('0x5'));var auth=require(_0xc006('0x6'));var interaction=require(_0xc006('0x7'));var config=require(_0xc006('0x8'));var controller=require(_0xc006('0x9'));router[_0xc006('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc006('0xa')](_0xc006('0xb'),auth[_0xc006('0xc')](),controller[_0xc006('0xd')]);router[_0xc006('0xe')]('/',auth[_0xc006('0xc')](),controller[_0xc006('0xf')]);router[_0xc006('0x10')](_0xc006('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc006('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc006('0x12')]);module[_0xc006('0x13')]=router; \ No newline at end of file +var _0x4a9b=['get','isAuthenticated','index','show','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4489f2,_0x1f9128){var _0x5cc527=function(_0x44201f){while(--_0x44201f){_0x4489f2['push'](_0x4489f2['shift']());}};_0x5cc527(++_0x1f9128);}(_0x4a9b,0x1f0));var _0xb4a9=function(_0x325348,_0x26b555){_0x325348=_0x325348-0x0;var _0x3391a8=_0x4a9b[_0x325348];return _0x3391a8;};'use strict';var multer=require(_0xb4a9('0x0'));var util=require('util');var path=require(_0xb4a9('0x1'));var timeout=require(_0xb4a9('0x2'));var express=require(_0xb4a9('0x3'));var router=express[_0xb4a9('0x4')]();var fs_extra=require(_0xb4a9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb4a9('0x6'));var config=require(_0xb4a9('0x7'));var controller=require('./disposition.controller');router[_0xb4a9('0x8')]('/',auth[_0xb4a9('0x9')](),controller[_0xb4a9('0xa')]);router[_0xb4a9('0x8')]('/:id',auth[_0xb4a9('0x9')](),controller[_0xb4a9('0xb')]);router['post']('/',auth[_0xb4a9('0x9')](),controller[_0xb4a9('0xc')]);router[_0xb4a9('0xd')](_0xb4a9('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xb4a9('0xf')]('/:id',auth[_0xb4a9('0x9')](),controller[_0xb4a9('0x10')]);module[_0xb4a9('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index d4d4d53..7136e41 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 _0x7bd0=['STRING','ENUM','yes','localstationid','2400','4800','7200','9600','14400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x7bd0,0x111));var _0x07bd=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x7bd0[_0x47fd36];return _0x21a0fc;};'use strict';var Sequelize=require(_0x07bd('0x0'));module[_0x07bd('0x1')]={'name':{'type':Sequelize[_0x07bd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x07bd('0x2')]},'ecm':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0x4'),'no'),'defaultValue':_0x07bd('0x4')},'headerinfo':{'type':Sequelize[_0x07bd('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x07bd('0x2')],'unique':_0x07bd('0x5')},'minrate':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0x6'),_0x07bd('0x7'),_0x07bd('0x8'),_0x07bd('0x9'),'12000',_0x07bd('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0x6'),_0x07bd('0x7'),'7200',_0x07bd('0x9'),_0x07bd('0xb'),_0x07bd('0xa')),'defaultValue':_0x07bd('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x07bd('0xc')},'gateway':{'type':Sequelize[_0x07bd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x07bd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x07bd('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0xe'),_0x07bd('0xf'),_0x07bd('0x10'),'KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x07bd('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x07bd('0x11')],'defaultValue':function(){return _0x07bd('0x12');}},'notificationSound':{'type':Sequelize[_0x07bd('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x07bd('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x07bd('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x07bd('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x07bd('0x13')],'defaultValue':![],'comment':_0x07bd('0x15'),'set':function(_0x4929d6){if(!_0x4929d6)this[_0x07bd('0x16')](_0x07bd('0x17'),null);this['setDataValue'](_0x07bd('0x18'),_0x4929d6);}}}; \ No newline at end of file +var _0xc6ac=['ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','14400','7200','INTEGER','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x170837,_0x4eec82){var _0x4a89d8=function(_0x2f470e){while(--_0x2f470e){_0x170837['push'](_0x170837['shift']());}};_0x4a89d8(++_0x4eec82);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x1d759c,_0x1cb0cd){_0x1d759c=_0x1d759c-0x0;var _0x44f7f1=_0xc6ac[_0x1d759c];return _0x44f7f1;};'use strict';var Sequelize=require(_0xcc6a('0x0'));module[_0xcc6a('0x1')]={'name':{'type':Sequelize[_0xcc6a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcc6a('0x2')]},'ecm':{'type':Sequelize[_0xcc6a('0x3')](_0xcc6a('0x4'),'no'),'defaultValue':_0xcc6a('0x4')},'headerinfo':{'type':Sequelize[_0xcc6a('0x2')],'defaultValue':_0xcc6a('0x5')},'localstationid':{'type':Sequelize[_0xcc6a('0x2')],'unique':_0xcc6a('0x6')},'minrate':{'type':Sequelize[_0xcc6a('0x3')](_0xcc6a('0x7'),_0xcc6a('0x8'),'7200',_0xcc6a('0x9'),_0xcc6a('0xa'),_0xcc6a('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xcc6a('0x3')](_0xcc6a('0x7'),_0xcc6a('0x8'),_0xcc6a('0xc'),_0xcc6a('0x9'),'12000',_0xcc6a('0xb')),'defaultValue':_0xcc6a('0xb')},'modem':{'type':Sequelize[_0xcc6a('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xcc6a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xcc6a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xcc6a('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0xcc6a('0xe'),_0xcc6a('0xf'),_0xcc6a('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xcc6a('0x11')],'defaultValue':function(){return _0xcc6a('0x12');}},'notificationSound':{'type':Sequelize[_0xcc6a('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcc6a('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcc6a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xcc6a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcc6a('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcc6a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xcc6a('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xcc6a('0x13')],'defaultValue':![],'comment':_0xcc6a('0x15'),'set':function(_0x3e63d9){if(!_0x3e63d9)this[_0xcc6a('0x16')](_0xcc6a('0x17'),null);this[_0xcc6a('0x16')](_0xcc6a('0x18'),_0x3e63d9);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 02ad9ab..d03ee55 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 _0x0e1e=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','destroy','get','FaxAccounts','UserProfileResource','end','name','send','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','rows','catch','show','params','Pause','keys','merge','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','describe','addDisposition','getDispositions','findOne','FaxAccountId','Disposition','findAll','ids','CannedAnswer','options','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','FaxApplication','findAndCountAll','stack','finally','getApplications','context','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','priority','appdata','push','Answer','Set','ecm','faxdetect','maxrate','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','update','tech','TrunkId','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x2c9fd2,_0x13c630){var _0xe7c289=function(_0x189f46){while(--_0x189f46){_0x2c9fd2['push'](_0x2c9fd2['shift']());}};_0xe7c289(++_0x13c630);}(_0x0e1e,0x188));var _0xe0e1=function(_0xde8ec8,_0x10f814){_0xde8ec8=_0xde8ec8-0x0;var _0x3dfb65=_0x0e1e[_0xde8ec8];return _0x3dfb65;};'use strict';var emlformat=require(_0xe0e1('0x0'));var rimraf=require(_0xe0e1('0x1'));var zipdir=require(_0xe0e1('0x2'));var jsonpatch=require(_0xe0e1('0x3'));var rp=require(_0xe0e1('0x4'));var moment=require('moment');var BPromise=require(_0xe0e1('0x5'));var Mustache=require(_0xe0e1('0x6'));var util=require(_0xe0e1('0x7'));var path=require('path');var sox=require(_0xe0e1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0e1('0x9'));var _=require(_0xe0e1('0xa'));var squel=require(_0xe0e1('0xb'));var crypto=require(_0xe0e1('0xc'));var jsforce=require(_0xe0e1('0xd'));var deskjs=require(_0xe0e1('0xe'));var toCsv=require(_0xe0e1('0xf'));var querystring=require(_0xe0e1('0x10'));var Papa=require(_0xe0e1('0x11'));var Redis=require(_0xe0e1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe0e1('0x13'));var as=require(_0xe0e1('0x14'));var hardwareService=require(_0xe0e1('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xe0e1('0x16'));var config=require(_0xe0e1('0x17'));var licenseUtil=require(_0xe0e1('0x18'));var db=require('../../mysqldb')['db'];config[_0xe0e1('0x19')]=_[_0xe0e1('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe0e1('0x19')]));require(_0xe0e1('0x1b'))[_0xe0e1('0x1c')](socket);var jayson=require(_0xe0e1('0x1d'));var client=jayson[_0xe0e1('0x1e')][_0xe0e1('0x1f')]({'port':0x232c});var client9002=jayson[_0xe0e1('0x1e')][_0xe0e1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x664745,_0x206352,_0x4c5d59,_0x1b3875){return new BPromise(function(_0x105e7b,_0x1c08e1){var _0x4f6697=_0x1b3875||client;return _0x4f6697[_0xe0e1('0x20')](_0x664745,_0x4c5d59)[_0xe0e1('0x21')](function(_0x1e549b){logger[_0xe0e1('0x22')](_0xe0e1('0x23'),_0x206352,_0xe0e1('0x24'));logger[_0xe0e1('0x25')](_0xe0e1('0x26'),_0x206352,'request\x20sent',JSON[_0xe0e1('0x27')](_0x1e549b));if(_0x1e549b['error']){if(_0x1e549b[_0xe0e1('0x28')][_0xe0e1('0x29')]===0x1f4){logger[_0xe0e1('0x28')]('FaxAccount,\x20%s,\x20%s',_0x206352,_0x1e549b[_0xe0e1('0x28')][_0xe0e1('0x2a')]);return _0x1c08e1(_0x1e549b[_0xe0e1('0x28')]['message']);}logger['error'](_0xe0e1('0x23'),_0x206352,_0x1e549b[_0xe0e1('0x28')]['message']);return _0x105e7b(_0x1e549b[_0xe0e1('0x28')][_0xe0e1('0x2a')]);}else{logger[_0xe0e1('0x22')](_0xe0e1('0x23'),_0x206352,'request\x20sent');_0x105e7b(_0x1e549b[_0xe0e1('0x2b')][_0xe0e1('0x2a')]);}})['catch'](function(_0x5dd8e9){logger[_0xe0e1('0x28')](_0xe0e1('0x23'),_0x206352,_0x5dd8e9);_0x1c08e1(_0x5dd8e9);});});}function respondWithStatusCode(_0x100acf,_0x1a708a){_0x1a708a=_0x1a708a||0xcc;return function(_0x30674c){if(_0x30674c){return _0x100acf[_0xe0e1('0x2c')](_0x1a708a);}return _0x100acf['status'](_0x1a708a)['end']();};}function respondWithResult(_0x19a935,_0x3837ff){_0x3837ff=_0x3837ff||0xc8;return function(_0x3244f7){if(_0x3244f7){return _0x19a935[_0xe0e1('0x2d')](_0x3837ff)['json'](_0x3244f7);}};}function respondWithFilteredResult(_0x1a45b3,_0xbe275){return function(_0x4af028){if(_0x4af028){var _0x478b73=typeof _0xbe275[_0xe0e1('0x2e')]===_0xe0e1('0x2f')&&typeof _0xbe275[_0xe0e1('0x30')]===_0xe0e1('0x2f');var _0x1faa20=_0x4af028[_0xe0e1('0x31')];var _0x542cfa=_0x478b73?0x0:_0xbe275[_0xe0e1('0x2e')];var _0x2b31be=_0x478b73?_0x4af028['count']:_0xbe275[_0xe0e1('0x2e')]+_0xbe275[_0xe0e1('0x30')];var _0x317768;if(_0x2b31be>=_0x1faa20){_0x2b31be=_0x1faa20;_0x317768=0xc8;}else{_0x317768=0xce;}_0x1a45b3[_0xe0e1('0x2d')](_0x317768);return _0x1a45b3[_0xe0e1('0x32')]('Content-Range',_0x542cfa+'-'+_0x2b31be+'/'+_0x1faa20)[_0xe0e1('0x33')](_0x4af028);}return null;};}function patchUpdates(_0x3fca9f){return function(_0x123f31){try{jsonpatch[_0xe0e1('0x34')](_0x123f31,_0x3fca9f,!![]);}catch(_0x1dba6a){return BPromise[_0xe0e1('0x35')](_0x1dba6a);}return _0x123f31[_0xe0e1('0x36')]();};}function saveUpdates(_0x4c0efe,_0x3bf7e9){return function(_0x30fe4e){if(_0x30fe4e){return _0x30fe4e['update'](_0x4c0efe)['then'](function(_0x6559fa){return _0x6559fa;});}return null;};}function removeEntity(_0x423bed,_0x34b76e){return function(_0x2f35d7){if(_0x2f35d7){return _0x2f35d7[_0xe0e1('0x37')]()[_0xe0e1('0x21')](function(){var _0x55c238=_0x2f35d7[_0xe0e1('0x38')]({'plain':!![]});var _0x46602a=_0xe0e1('0x39');return db[_0xe0e1('0x3a')][_0xe0e1('0x37')]({'where':{'type':_0x46602a,'resourceId':_0x55c238['id']}})['then'](function(){return _0x2f35d7;});})['then'](function(){_0x423bed['status'](0xcc)[_0xe0e1('0x3b')]();});}};}function handleEntityNotFound(_0x1d6b40,_0x32ae9c){return function(_0x5d6444){if(!_0x5d6444){_0x1d6b40[_0xe0e1('0x2c')](0x194);}return _0x5d6444;};}function handleError(_0x5bd6fd,_0x40d5a7){_0x40d5a7=_0x40d5a7||0x1f4;return function(_0x45d333){logger[_0xe0e1('0x28')](_0x45d333['stack']);if(_0x45d333['name']){delete _0x45d333[_0xe0e1('0x3c')];}_0x5bd6fd['status'](_0x40d5a7)[_0xe0e1('0x3d')](_0x45d333);};}exports['index']=function(_0x11540f,_0x30462d){var _0x4369f6={'include':[{'model':db['Pause'],'as':_0xe0e1('0x3e')}]},_0x10c7b3={},_0x37fd28={'count':0x0,'rows':[]};var _0x38cb61=_[_0xe0e1('0x3f')](db[_0xe0e1('0x40')][_0xe0e1('0x41')],function(_0x35799f){return{'name':_0x35799f[_0xe0e1('0x42')],'type':_0x35799f[_0xe0e1('0x43')][_0xe0e1('0x44')]};});_0x10c7b3['model']=_[_0xe0e1('0x3f')](_0x38cb61,_0xe0e1('0x3c'));_0x10c7b3[_0xe0e1('0x45')]=_['keys'](_0x11540f['query']);_0x10c7b3['filters']=_[_0xe0e1('0x46')](_0x10c7b3[_0xe0e1('0x47')],_0x10c7b3[_0xe0e1('0x45')]);_0x4369f6[_0xe0e1('0x48')]=_[_0xe0e1('0x46')](_0x10c7b3[_0xe0e1('0x47')],qs[_0xe0e1('0x49')](_0x11540f[_0xe0e1('0x45')][_0xe0e1('0x49')]));_0x4369f6[_0xe0e1('0x48')]=_0x4369f6[_0xe0e1('0x48')][_0xe0e1('0x4a')]?_0x4369f6[_0xe0e1('0x48')]:_0x10c7b3[_0xe0e1('0x47')];if(!_0x11540f[_0xe0e1('0x45')][_0xe0e1('0x4b')](_0xe0e1('0x4c'))){_0x4369f6[_0xe0e1('0x30')]=qs[_0xe0e1('0x30')](_0x11540f[_0xe0e1('0x45')][_0xe0e1('0x30')]);_0x4369f6[_0xe0e1('0x2e')]=qs[_0xe0e1('0x2e')](_0x11540f['query'][_0xe0e1('0x2e')]);}_0x4369f6[_0xe0e1('0x4d')]=qs[_0xe0e1('0x4e')](_0x11540f[_0xe0e1('0x45')]['sort']);_0x4369f6[_0xe0e1('0x4f')]=qs[_0xe0e1('0x50')](_[_0xe0e1('0x51')](_0x11540f[_0xe0e1('0x45')],_0x10c7b3[_0xe0e1('0x50')]),_0x38cb61);if(_0x11540f[_0xe0e1('0x45')][_0xe0e1('0x52')]){_0x4369f6[_0xe0e1('0x4f')]=_['merge'](_0x4369f6[_0xe0e1('0x4f')],{'$or':_[_0xe0e1('0x3f')](_0x38cb61,function(_0x4b3eb5){if(_0x4b3eb5[_0xe0e1('0x43')]!==_0xe0e1('0x53')){var _0x51d369={};_0x51d369[_0x4b3eb5[_0xe0e1('0x3c')]]={'$like':'%'+_0x11540f[_0xe0e1('0x45')][_0xe0e1('0x52')]+'%'};return _0x51d369;}})});}_0x4369f6=_['merge']({},_0x4369f6,_0x11540f['options']);var _0x5505f9={'where':_0x4369f6[_0xe0e1('0x4f')]};return db[_0xe0e1('0x40')][_0xe0e1('0x31')](_0x5505f9)[_0xe0e1('0x21')](function(_0x56775f){_0x37fd28[_0xe0e1('0x31')]=_0x56775f;if(_0x11540f[_0xe0e1('0x45')][_0xe0e1('0x54')]){_0x4369f6[_0xe0e1('0x55')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x4369f6);})[_0xe0e1('0x21')](function(_0x31984e){_0x37fd28[_0xe0e1('0x56')]=_0x31984e;return _0x37fd28;})[_0xe0e1('0x21')](respondWithFilteredResult(_0x30462d,_0x4369f6))[_0xe0e1('0x57')](handleError(_0x30462d,null));};exports[_0xe0e1('0x58')]=function(_0x7c4662,_0x585a40){var _0xa74292={'raw':![],'where':{'id':_0x7c4662[_0xe0e1('0x59')]['id']},'include':[{'model':db[_0xe0e1('0x5a')],'as':_0xe0e1('0x3e')}]},_0x421953={};_0x421953[_0xe0e1('0x47')]=_[_0xe0e1('0x5b')](db[_0xe0e1('0x40')][_0xe0e1('0x41')]);_0x421953['query']=_[_0xe0e1('0x5b')](_0x7c4662[_0xe0e1('0x45')]);_0x421953[_0xe0e1('0x50')]=_['intersection'](_0x421953[_0xe0e1('0x47')],_0x421953[_0xe0e1('0x45')]);_0xa74292['attributes']=_[_0xe0e1('0x46')](_0x421953['model'],qs['fields'](_0x7c4662['query'][_0xe0e1('0x49')]));_0xa74292[_0xe0e1('0x48')]=_0xa74292[_0xe0e1('0x48')][_0xe0e1('0x4a')]?_0xa74292[_0xe0e1('0x48')]:_0x421953['model'];if(_0x7c4662[_0xe0e1('0x45')][_0xe0e1('0x54')]){_0xa74292[_0xe0e1('0x55')]=[{'all':!![]}];}_0xa74292=_[_0xe0e1('0x5c')]({},_0xa74292,_0x7c4662['options']);return db[_0xe0e1('0x40')][_0xe0e1('0x5d')](_0xa74292)[_0xe0e1('0x21')](handleEntityNotFound(_0x585a40,null))[_0xe0e1('0x21')](respondWithResult(_0x585a40,null))[_0xe0e1('0x57')](handleError(_0x585a40,null));};exports[_0xe0e1('0x5e')]=function(_0x20038d,_0x595aba){return db[_0xe0e1('0x40')][_0xe0e1('0x5e')](_0x20038d['body'],{})[_0xe0e1('0x21')](function(_0x5cff1a){var _0x244872=_0x20038d[_0xe0e1('0x5f')][_0xe0e1('0x38')]({'plain':!![]});if(!_0x244872)throw new Error(_0xe0e1('0x60'));if(_0x244872[_0xe0e1('0x61')]===_0xe0e1('0x5f')){var _0x17975e=_0x5cff1a[_0xe0e1('0x38')]({'plain':!![]});var _0x20415e=_0xe0e1('0x39');return db[_0xe0e1('0x62')][_0xe0e1('0x5d')]({'where':{'name':_0x20415e,'userProfileId':_0x244872[_0xe0e1('0x63')]},'raw':!![]})[_0xe0e1('0x21')](function(_0x17ce79){if(_0x17ce79&&_0x17ce79[_0xe0e1('0x64')]===0x0){return db[_0xe0e1('0x3a')]['create']({'name':_0x17975e[_0xe0e1('0x3c')],'resourceId':_0x17975e['id'],'type':_0x17ce79[_0xe0e1('0x3c')],'sectionId':_0x17ce79['id']},{})[_0xe0e1('0x21')](function(){return _0x5cff1a;});}else{return _0x5cff1a;}})[_0xe0e1('0x57')](function(_0x4244d9){logger[_0xe0e1('0x28')](_0xe0e1('0x65'),_0x4244d9);throw _0x4244d9;});}return _0x5cff1a;})[_0xe0e1('0x21')](respondWithResult(_0x595aba,0xc9))[_0xe0e1('0x57')](handleError(_0x595aba,null));};exports['update']=function(_0x38e884,_0x3cc773){if(_0x38e884['body']['id']){delete _0x38e884[_0xe0e1('0x66')]['id'];}return db[_0xe0e1('0x40')][_0xe0e1('0x5d')]({'where':{'id':_0x38e884['params']['id']},'include':[{'model':db[_0xe0e1('0x5a')],'as':'mandatoryDispositionPause'}]})[_0xe0e1('0x21')](handleEntityNotFound(_0x3cc773,null))['then'](saveUpdates(_0x38e884['body'],null))[_0xe0e1('0x21')](respondWithResult(_0x3cc773,null))[_0xe0e1('0x57')](handleError(_0x3cc773,null));};exports['destroy']=function(_0x4be2d6,_0x2c6770){return db['FaxAccount'][_0xe0e1('0x5d')]({'where':{'id':_0x4be2d6[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x2c6770,null))[_0xe0e1('0x21')](removeEntity(_0x2c6770,null))[_0xe0e1('0x57')](handleError(_0x2c6770,null));};exports[_0xe0e1('0x67')]=function(_0x268353,_0x38db01){return db[_0xe0e1('0x40')][_0xe0e1('0x67')]()[_0xe0e1('0x21')](respondWithResult(_0x38db01,null))[_0xe0e1('0x57')](handleError(_0x38db01,null));};exports[_0xe0e1('0x68')]=function(_0x1a881e,_0x6d88a7,_0x583070){if(_0x1a881e[_0xe0e1('0x66')]['id']){delete _0x1a881e[_0xe0e1('0x66')]['id'];}return db[_0xe0e1('0x40')]['find']({'where':{'id':_0x1a881e[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x6d88a7,null))[_0xe0e1('0x21')](function(_0x18fa67){if(_0x18fa67){_0x1a881e[_0xe0e1('0x66')]['FaxAccountId']=_0x18fa67['id'];return db['Disposition'][_0xe0e1('0x5e')](_0x1a881e[_0xe0e1('0x66')]);}})[_0xe0e1('0x21')](respondWithResult(_0x6d88a7,null))[_0xe0e1('0x57')](handleError(_0x6d88a7,null));};exports[_0xe0e1('0x69')]=function(_0x62454c,_0x338d81,_0x3f23a4){var _0x35bd87={'raw':![],'where':{}};var _0x55d45d={};var _0xb87fb2={'count':0x0,'rows':[]};return db[_0xe0e1('0x40')][_0xe0e1('0x6a')]({'where':{'id':_0x62454c[_0xe0e1('0x59')]['id']}})['then'](handleEntityNotFound(_0x338d81,null))[_0xe0e1('0x21')](function(_0x4033d5){if(_0x4033d5){_0x55d45d[_0xe0e1('0x47')]=_[_0xe0e1('0x5b')](db['Disposition'][_0xe0e1('0x41')]);_0x55d45d[_0xe0e1('0x45')]=_['keys'](_0x62454c['query']);_0x55d45d[_0xe0e1('0x50')]=_[_0xe0e1('0x46')](_0x55d45d[_0xe0e1('0x47')],_0x55d45d[_0xe0e1('0x45')]);_0x35bd87['attributes']=_[_0xe0e1('0x46')](_0x55d45d[_0xe0e1('0x47')],qs[_0xe0e1('0x49')](_0x62454c[_0xe0e1('0x45')][_0xe0e1('0x49')]));_0x35bd87['attributes']=_0x35bd87[_0xe0e1('0x48')][_0xe0e1('0x4a')]?_0x35bd87[_0xe0e1('0x48')]:_0x55d45d['model'];if(!_0x62454c['query'][_0xe0e1('0x4b')](_0xe0e1('0x4c'))){_0x35bd87[_0xe0e1('0x30')]=qs[_0xe0e1('0x30')](_0x62454c[_0xe0e1('0x45')][_0xe0e1('0x30')]);_0x35bd87[_0xe0e1('0x2e')]=qs[_0xe0e1('0x2e')](_0x62454c[_0xe0e1('0x45')][_0xe0e1('0x2e')]);}_0x35bd87[_0xe0e1('0x4d')]=qs[_0xe0e1('0x4e')](_0x62454c['query'][_0xe0e1('0x4e')]);_0x35bd87[_0xe0e1('0x4f')]=qs[_0xe0e1('0x50')](_[_0xe0e1('0x51')](_0x62454c['query'],_0x55d45d['filters']));_0x35bd87[_0xe0e1('0x4f')][_0xe0e1('0x6b')]=_0x4033d5['id'];if(_0x62454c[_0xe0e1('0x45')][_0xe0e1('0x52')]){_0x35bd87['where']=_[_0xe0e1('0x5c')](_0x35bd87[_0xe0e1('0x4f')],{'$or':_[_0xe0e1('0x3f')](_0x35bd87[_0xe0e1('0x48')],function(_0x431073){var _0x1ed547={};_0x1ed547[_0x431073]={'$like':'%'+_0x62454c[_0xe0e1('0x45')][_0xe0e1('0x52')]+'%'};return _0x1ed547;})});}_0x35bd87=_[_0xe0e1('0x5c')]({},_0x35bd87,_0x62454c['options']);return db[_0xe0e1('0x6c')][_0xe0e1('0x31')]({'where':_0x35bd87[_0xe0e1('0x4f')]})['then'](function(_0x4c54f7){_0xb87fb2['count']=_0x4c54f7;if(_0x62454c[_0xe0e1('0x45')][_0xe0e1('0x54')]){_0x35bd87['include']=[{'all':!![]}];}return db['Disposition'][_0xe0e1('0x6d')](_0x35bd87);})['then'](function(_0x2772a9){_0xb87fb2[_0xe0e1('0x56')]=_0x2772a9;return _0xb87fb2;});}})['then'](respondWithFilteredResult(_0x338d81,_0x35bd87))[_0xe0e1('0x57')](handleError(_0x338d81,null));};exports['removeDispositions']=function(_0x2098d3,_0x7c180d,_0x6f7773){return db[_0xe0e1('0x40')][_0xe0e1('0x5d')]({'where':{'id':_0x2098d3[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x7c180d,null))[_0xe0e1('0x21')](function(_0x1b8faa){if(_0x1b8faa){return _0x1b8faa['removeDispositions'](_0x2098d3[_0xe0e1('0x45')][_0xe0e1('0x6e')]);}})[_0xe0e1('0x21')](respondWithStatusCode(_0x7c180d,null))[_0xe0e1('0x57')](handleError(_0x7c180d,null));};exports['addAnswer']=function(_0x47abda,_0x501abc,_0x508dab){if(_0x47abda[_0xe0e1('0x66')]['id']){delete _0x47abda['body']['id'];}return db[_0xe0e1('0x40')][_0xe0e1('0x5d')]({'where':{'id':_0x47abda[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x501abc,null))[_0xe0e1('0x21')](function(_0x1efb8b){if(_0x1efb8b){_0x47abda[_0xe0e1('0x66')][_0xe0e1('0x6b')]=_0x1efb8b['id'];return db[_0xe0e1('0x6f')][_0xe0e1('0x5e')](_0x47abda[_0xe0e1('0x66')]);}})[_0xe0e1('0x21')](respondWithResult(_0x501abc,null))[_0xe0e1('0x57')](handleError(_0x501abc,null));};exports['getAnswers']=function(_0x30aa76,_0x4c0ac6,_0x8e4b05){var _0x15e3d0={'raw':![],'where':{}};var _0x2d6df4={};var _0x30ea77={'count':0x0,'rows':[]};return db[_0xe0e1('0x40')][_0xe0e1('0x6a')]({'where':{'id':_0x30aa76[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x4c0ac6,null))[_0xe0e1('0x21')](function(_0x27a2a7){if(_0x27a2a7){_0x2d6df4[_0xe0e1('0x47')]=_['keys'](db[_0xe0e1('0x6f')]['rawAttributes']);_0x2d6df4[_0xe0e1('0x45')]=_[_0xe0e1('0x5b')](_0x30aa76[_0xe0e1('0x45')]);_0x2d6df4[_0xe0e1('0x50')]=_[_0xe0e1('0x46')](_0x2d6df4['model'],_0x2d6df4['query']);_0x15e3d0[_0xe0e1('0x48')]=_[_0xe0e1('0x46')](_0x2d6df4[_0xe0e1('0x47')],qs['fields'](_0x30aa76[_0xe0e1('0x45')][_0xe0e1('0x49')]));_0x15e3d0[_0xe0e1('0x48')]=_0x15e3d0[_0xe0e1('0x48')]['length']?_0x15e3d0[_0xe0e1('0x48')]:_0x2d6df4[_0xe0e1('0x47')];if(!_0x30aa76['query']['hasOwnProperty'](_0xe0e1('0x4c'))){_0x15e3d0[_0xe0e1('0x30')]=qs[_0xe0e1('0x30')](_0x30aa76[_0xe0e1('0x45')][_0xe0e1('0x30')]);_0x15e3d0[_0xe0e1('0x2e')]=qs['offset'](_0x30aa76['query'][_0xe0e1('0x2e')]);}_0x15e3d0[_0xe0e1('0x4d')]=qs[_0xe0e1('0x4e')](_0x30aa76[_0xe0e1('0x45')][_0xe0e1('0x4e')]);_0x15e3d0[_0xe0e1('0x4f')]=qs[_0xe0e1('0x50')](_[_0xe0e1('0x51')](_0x30aa76[_0xe0e1('0x45')],_0x2d6df4[_0xe0e1('0x50')]));_0x15e3d0[_0xe0e1('0x4f')]['FaxAccountId']=_0x27a2a7['id'];if(_0x30aa76['query']['filter']){_0x15e3d0[_0xe0e1('0x4f')]=_[_0xe0e1('0x5c')](_0x15e3d0[_0xe0e1('0x4f')],{'$or':_['map'](_0x15e3d0['attributes'],function(_0x2f77a8){var _0x3977e9={};_0x3977e9[_0x2f77a8]={'$like':'%'+_0x30aa76[_0xe0e1('0x45')][_0xe0e1('0x52')]+'%'};return _0x3977e9;})});}_0x15e3d0=_[_0xe0e1('0x5c')]({},_0x15e3d0,_0x30aa76[_0xe0e1('0x70')]);return db[_0xe0e1('0x6f')][_0xe0e1('0x31')]({'where':_0x15e3d0['where']})['then'](function(_0x294c57){_0x30ea77[_0xe0e1('0x31')]=_0x294c57;if(_0x30aa76['query'][_0xe0e1('0x54')]){_0x15e3d0['include']=[{'all':!![]}];}return db[_0xe0e1('0x6f')][_0xe0e1('0x6d')](_0x15e3d0);})[_0xe0e1('0x21')](function(_0x35d94f){_0x30ea77[_0xe0e1('0x56')]=_0x35d94f;return _0x30ea77;});}})[_0xe0e1('0x21')](respondWithFilteredResult(_0x4c0ac6,_0x15e3d0))[_0xe0e1('0x57')](handleError(_0x4c0ac6,null));};exports[_0xe0e1('0x71')]=function(_0xb901f,_0x43ac35,_0xce586f){return db[_0xe0e1('0x40')][_0xe0e1('0x5d')]({'where':{'id':_0xb901f[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x43ac35,null))['then'](function(_0x11bc85){if(_0x11bc85){return _0x11bc85[_0xe0e1('0x71')](_0xb901f['query'][_0xe0e1('0x6e')]);}})[_0xe0e1('0x21')](respondWithStatusCode(_0x43ac35,null))[_0xe0e1('0x57')](handleError(_0x43ac35,null));};exports[_0xe0e1('0x72')]=function(_0x49d3e5,_0x428703,_0x26fec1){return db[_0xe0e1('0x73')]['find']({'where':{'id':_0x49d3e5[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x428703,null))[_0xe0e1('0x21')](function(_0x30e5eb){if(_0x30e5eb){return _0x30e5eb[_0xe0e1('0x72')](_0x49d3e5[_0xe0e1('0x66')]['ids'],_[_0xe0e1('0x74')](_0x49d3e5[_0xe0e1('0x66')],[_0xe0e1('0x6e'),'id'])||{});}})[_0xe0e1('0x21')](respondWithResult(_0x428703,null))[_0xe0e1('0x57')](handleError(_0x428703,null));};exports[_0xe0e1('0x75')]=function(_0xde9bbe,_0x2390c2,_0x8dc15d){var _0x39b9c4={'raw':![],'where':{}};var _0x39ad34={};var _0x1dc139={'count':0x0,'rows':[]};return db[_0xe0e1('0x40')][_0xe0e1('0x6a')]({'where':{'id':_0xde9bbe[_0xe0e1('0x59')]['id']}})['then'](handleEntityNotFound(_0x2390c2,null))[_0xe0e1('0x21')](function(_0x977ca0){if(_0x977ca0){_0x39ad34['model']=_[_0xe0e1('0x5b')](db[_0xe0e1('0x73')][_0xe0e1('0x41')]);_0x39ad34[_0xe0e1('0x45')]=_[_0xe0e1('0x5b')](_0xde9bbe[_0xe0e1('0x45')]);_0x39ad34[_0xe0e1('0x50')]=_['intersection'](_0x39ad34['model'],_0x39ad34[_0xe0e1('0x45')]);_0x39b9c4['attributes']=_[_0xe0e1('0x46')](_0x39ad34['model'],qs[_0xe0e1('0x49')](_0xde9bbe[_0xe0e1('0x45')][_0xe0e1('0x49')]));_0x39b9c4[_0xe0e1('0x48')]=_0x39b9c4[_0xe0e1('0x48')]['length']?_0x39b9c4[_0xe0e1('0x48')]:_0x39ad34['model'];if(!_0xde9bbe['query']['hasOwnProperty'](_0xe0e1('0x4c'))){_0x39b9c4[_0xe0e1('0x30')]=qs[_0xe0e1('0x30')](_0xde9bbe['query']['limit']);_0x39b9c4[_0xe0e1('0x2e')]=qs[_0xe0e1('0x2e')](_0xde9bbe[_0xe0e1('0x45')][_0xe0e1('0x2e')]);}_0x39b9c4['order']=qs[_0xe0e1('0x4e')](_0xde9bbe[_0xe0e1('0x45')]['sort']);_0x39b9c4[_0xe0e1('0x4f')]=qs[_0xe0e1('0x50')](_[_0xe0e1('0x51')](_0xde9bbe[_0xe0e1('0x45')],_0x39ad34[_0xe0e1('0x50')]));_0x39b9c4[_0xe0e1('0x4f')][_0xe0e1('0x6b')]=_0x977ca0['id'];if(_0xde9bbe[_0xe0e1('0x45')][_0xe0e1('0x52')]){_0x39b9c4[_0xe0e1('0x4f')]=_[_0xe0e1('0x5c')](_0x39b9c4[_0xe0e1('0x4f')],{'$or':_['map'](_0x39b9c4[_0xe0e1('0x48')],function(_0x2f1435){var _0x9375ce={};_0x9375ce[_0x2f1435]={'$like':'%'+_0xde9bbe[_0xe0e1('0x45')][_0xe0e1('0x52')]+'%'};return _0x9375ce;})});}_0x39b9c4=_[_0xe0e1('0x5c')]({},_0x39b9c4,_0xde9bbe[_0xe0e1('0x70')]);return db[_0xe0e1('0x73')][_0xe0e1('0x31')]({'where':_0x39b9c4[_0xe0e1('0x4f')]})[_0xe0e1('0x21')](function(_0x5ac8c7){_0x1dc139[_0xe0e1('0x31')]=_0x5ac8c7;if(_0xde9bbe[_0xe0e1('0x45')]['includeAll']){_0x39b9c4[_0xe0e1('0x55')]=[{'model':db[_0xe0e1('0x76')],'as':_0xe0e1('0x77'),'required':![]},{'model':db[_0xe0e1('0x78')],'as':_0xe0e1('0x79'),'attributes':[_0xe0e1('0x3c'),_0xe0e1('0x7a'),_0xe0e1('0x7b')],'required':![]},{'model':db['Tag'],'as':_0xe0e1('0x7c'),'attributes':['id',_0xe0e1('0x3c'),_0xe0e1('0x7d')],'where':_0xde9bbe['query'][_0xe0e1('0x7e')]?{'id':_0xde9bbe['query']['tag']}:undefined,'required':_0xde9bbe[_0xe0e1('0x45')][_0xe0e1('0x7e')]?!![]:![]}];}return db['FaxInteraction'][_0xe0e1('0x6d')](_0x39b9c4);})['then'](function(_0x10da8e){_0x1dc139['rows']=_0x10da8e;return _0x1dc139;});}})[_0xe0e1('0x21')](respondWithFilteredResult(_0x2390c2,_0x39b9c4))['catch'](handleError(_0x2390c2,null));};exports[_0xe0e1('0x7f')]=function(_0x494ba0,_0x1c9338){var _0x50391a=_0x494ba0['params']['id'];var _0x4155f4=_0x494ba0[_0xe0e1('0x66')];var _0x358d1b=0xc8;var _0x2809c6=null;return db[_0xe0e1('0x80')][_0xe0e1('0x81')]({'isolationLevel':db[_0xe0e1('0x80')][_0xe0e1('0x82')]['ISOLATION_LEVELS'][_0xe0e1('0x83')]},function(_0x4ae8a8){return db[_0xe0e1('0x40')]['findOne']({'where':{'id':_0x50391a},'transaction':_0x4ae8a8})[_0xe0e1('0x21')](function(_0x8fb03){if(_0x8fb03){return db['FaxApplication'][_0xe0e1('0x37')]({'where':{'FaxAccountId':_0x50391a},'transaction':_0x4ae8a8})[_0xe0e1('0x21')](function(){var _0x4044fc=_[_0xe0e1('0x3f')](_0x4155f4,function(_0x1f6b32){_0x1f6b32[_0xe0e1('0x6b')]=_0x50391a;return _0x1f6b32;});return db['FaxApplication']['bulkCreate'](_0x4044fc,{'transaction':_0x4ae8a8});});}else{_0x358d1b=0x194;_0x2809c6=[];}});})[_0xe0e1('0x21')](function(){if(_0x358d1b!==0x194){return db[_0xe0e1('0x84')][_0xe0e1('0x85')]({'where':{'FaxAccountId':_0x50391a},'order':'priority'})[_0xe0e1('0x21')](function(_0x53a206){_0x2809c6=_0x53a206;});}})[_0xe0e1('0x57')](function(_0x53d9f7){_0x358d1b=0x1f4;logger[_0xe0e1('0x28')](_0x53d9f7[_0xe0e1('0x86')]);if(_0x53d9f7[_0xe0e1('0x3c')]){delete _0x53d9f7[_0xe0e1('0x3c')];}_0x2809c6=_0x53d9f7;})[_0xe0e1('0x87')](function(){if(_0x2809c6===null){_0x1c9338[_0xe0e1('0x2c')](_0x358d1b);}else{if(_0x358d1b===0x1f4){_0x1c9338[_0xe0e1('0x2d')](_0x358d1b)['send'](_0x2809c6);}else{_0x1c9338[_0xe0e1('0x2d')](_0x358d1b)[_0xe0e1('0x33')](_0x2809c6);}}});};exports[_0xe0e1('0x88')]=function(_0x4fa5ba,_0x3a510f,_0x47e56a){var _0x150b43={};var _0x51f7f0={};var _0x4ac1e8;var _0x3882f9;return db[_0xe0e1('0x40')]['findOne']({'where':{'id':_0x4fa5ba[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x3a510f,null))[_0xe0e1('0x21')](function(_0x3008e5){if(_0x3008e5){_0x4ac1e8=_0x3008e5;_0x51f7f0[_0xe0e1('0x47')]=_[_0xe0e1('0x5b')](db['FaxApplication']['rawAttributes']);_0x51f7f0[_0xe0e1('0x45')]=_[_0xe0e1('0x5b')](_0x4fa5ba[_0xe0e1('0x45')]);_0x51f7f0[_0xe0e1('0x50')]=_[_0xe0e1('0x46')](_0x51f7f0[_0xe0e1('0x47')],_0x51f7f0['query']);_0x150b43[_0xe0e1('0x48')]=_[_0xe0e1('0x46')](_0x51f7f0[_0xe0e1('0x47')],qs['fields'](_0x4fa5ba[_0xe0e1('0x45')][_0xe0e1('0x49')]));_0x150b43['attributes']=_0x150b43[_0xe0e1('0x48')][_0xe0e1('0x4a')]?_0x150b43[_0xe0e1('0x48')]:_0x51f7f0['model'];_0x150b43['order']=qs['sort'](_0x4fa5ba[_0xe0e1('0x45')][_0xe0e1('0x4e')]);_0x150b43[_0xe0e1('0x4f')]=qs[_0xe0e1('0x50')](_[_0xe0e1('0x51')](_0x4fa5ba[_0xe0e1('0x45')],_0x51f7f0[_0xe0e1('0x50')]));if(_0x4fa5ba[_0xe0e1('0x45')][_0xe0e1('0x52')]){_0x150b43[_0xe0e1('0x4f')]=_[_0xe0e1('0x5c')](_0x150b43[_0xe0e1('0x4f')],{'$or':_['map'](_0x150b43[_0xe0e1('0x48')],function(_0x22db59){var _0x41e693={};_0x41e693[_0x22db59]={'$like':'%'+_0x4fa5ba[_0xe0e1('0x45')][_0xe0e1('0x52')]+'%'};return _0x41e693;})});}_0x150b43=_[_0xe0e1('0x5c')]({},_0x150b43,_0x4fa5ba[_0xe0e1('0x70')]);return _0x4ac1e8[_0xe0e1('0x88')](_0x150b43);}})[_0xe0e1('0x21')](function(_0x10ab5e){if(_0x10ab5e){_0x3882f9=_0x10ab5e[_0xe0e1('0x4a')];if(!_0x4fa5ba[_0xe0e1('0x45')][_0xe0e1('0x4b')](_0xe0e1('0x4c'))){_0x150b43[_0xe0e1('0x30')]=qs[_0xe0e1('0x30')](_0x4fa5ba[_0xe0e1('0x45')][_0xe0e1('0x30')]);_0x150b43[_0xe0e1('0x2e')]=qs[_0xe0e1('0x2e')](_0x4fa5ba[_0xe0e1('0x45')][_0xe0e1('0x2e')]);}return _0x4ac1e8[_0xe0e1('0x88')](_0x150b43);}})[_0xe0e1('0x21')](function(_0x58c709){if(_0x58c709){return _0x58c709?{'count':_0x3882f9,'rows':_0x58c709}:null;}})[_0xe0e1('0x21')](respondWithResult(_0x3a510f,null))[_0xe0e1('0x57')](handleError(_0x3a510f,null));};function Extension(_0x1d8667,_0x255878,_0x2a0099,_0x262934){this[_0xe0e1('0x89')]=_0xe0e1('0x8a');this[_0xe0e1('0x8b')]=_0x1d8667[_0xe0e1('0x8c')];this[_0xe0e1('0x8d')]=_0x262934;this[_0xe0e1('0x43')]='system';this[_0xe0e1('0x8e')]=_0xe0e1('0x8f');this[_0xe0e1('0x6b')]=_0x1d8667['id'];this[_0xe0e1('0x90')]=_0x255878;this[_0xe0e1('0x91')]=_0x2a0099;}function createExtensionsReciveFax(_0x42ceb8){var _0x5b0607=0x1;var _0x1113f6=[];_0x1113f6[_0xe0e1('0x92')](new Extension(_0x42ceb8,_0x5b0607,'',_0xe0e1('0x93')));_0x5b0607+=0x1;_0x1113f6[_0xe0e1('0x92')](new Extension(_0x42ceb8,_0x5b0607,'CDR(type)=inbound-fax',_0xe0e1('0x94')));_0x5b0607+=0x1;for(var _0x42b963 in _0x42ceb8){if(_0x42ceb8['hasOwnProperty'](_0x42b963)&&(_0x42b963===_0xe0e1('0x95')||_0x42b963===_0xe0e1('0x8c')||_0x42b963==='gateway'||_0x42b963===_0xe0e1('0x96')||_0x42b963==='headerinfo'||_0x42b963===_0xe0e1('0x97')||_0x42b963===_0xe0e1('0x98')||_0x42b963===_0xe0e1('0x99')||_0x42b963===_0xe0e1('0x9a'))){_0x1113f6[_0xe0e1('0x92')](new Extension(_0x42ceb8,_0x5b0607,'FAXOPT('+_0x42b963+')='+_0x42ceb8[_0x42b963],_0xe0e1('0x94')));_0x5b0607+=0x1;}}_0x1113f6['push'](new Extension(_0x42ceb8,_0x5b0607,'6',_0xe0e1('0x9b')));_0x5b0607+=0x1;_0x1113f6[_0xe0e1('0x92')](new Extension(_0x42ceb8,_0x5b0607,_0xe0e1('0x9c'),_0xe0e1('0x9d')));_0x5b0607=0x0;return _0x1113f6;}exports[_0xe0e1('0x9e')]=function(_0x4177e6,_0x1c6b40,_0x43db3e){var _0x5e4054;return db['sequelize'][_0xe0e1('0x81')](function(_0x1c13bc){return db[_0xe0e1('0x40')][_0xe0e1('0x5e')](_0x4177e6['body'],{'transaction':_0x1c13bc})[_0xe0e1('0x21')](function(_0x50de81){_0x5e4054=_0x50de81[_0xe0e1('0x38')]({'plain':!![]});return db[_0xe0e1('0x9f')][_0xe0e1('0xa0')](createExtensionsReciveFax(_0x5e4054),{'transaction':_0x1c13bc});});})['then'](function(){return _0x5e4054;})[_0xe0e1('0x21')](respondWithResult(_0x1c6b40,null))[_0xe0e1('0x57')](handleError(_0x1c6b40,null));};exports[_0xe0e1('0xa1')]=function(_0x2dc7df,_0x15acbf,_0x3968d7){var _0x1da08d;return db[_0xe0e1('0x80')]['transaction'](function(_0x17e5a2){return db[_0xe0e1('0x40')][_0xe0e1('0xa2')](_0x2dc7df[_0xe0e1('0x66')],{'where':{'id':_0x2dc7df[_0xe0e1('0x66')]['id']},'transaction':_0x17e5a2})[_0xe0e1('0x21')](function(_0xc90737){return db[_0xe0e1('0x9f')][_0xe0e1('0x37')]({'where':{'FaxAccountId':_0x2dc7df[_0xe0e1('0x66')]['id']},'transaction':_0x17e5a2})[_0xe0e1('0x21')](function(_0x522af0){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x2dc7df['body'],[_0xe0e1('0xa3'),_0xe0e1('0x44'),'createdAt','updatedAt',_0xe0e1('0xa4'),_0xe0e1('0xa5')])),{'transaction':_0x17e5a2});});});})[_0xe0e1('0x21')](function(){return db[_0xe0e1('0x40')]['findById'](_0x2dc7df[_0xe0e1('0x66')]['id']);})['then'](respondWithResult(_0x15acbf,null))[_0xe0e1('0x57')](handleError(_0x15acbf,null));};exports['getMessages']=function(_0x23326d,_0x13ce31,_0x246ce6){var _0xcf890b={'raw':!![],'where':{}};var _0x3fb36b={};var _0x45cc06={'count':0x0,'rows':[]};return db[_0xe0e1('0x40')]['findOne']({'where':{'id':_0x23326d['params']['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x13ce31,null))[_0xe0e1('0x21')](function(_0x204045){if(_0x204045){_0x3fb36b['model']=_['keys'](db[_0xe0e1('0xa6')]['rawAttributes']);_0x3fb36b['query']=_[_0xe0e1('0x5b')](_0x23326d['query']);_0x3fb36b[_0xe0e1('0x50')]=_[_0xe0e1('0x46')](_0x3fb36b[_0xe0e1('0x47')],_0x3fb36b[_0xe0e1('0x45')]);_0xcf890b['attributes']=_['intersection'](_0x3fb36b['model'],qs['fields'](_0x23326d[_0xe0e1('0x45')][_0xe0e1('0x49')]));_0xcf890b[_0xe0e1('0x48')]=_0xcf890b['attributes'][_0xe0e1('0x4a')]?_0xcf890b[_0xe0e1('0x48')]:_0x3fb36b[_0xe0e1('0x47')];if(!_0x23326d['query'][_0xe0e1('0x4b')]('nolimit')){_0xcf890b[_0xe0e1('0x30')]=qs['limit'](_0x23326d['query']['limit']);_0xcf890b['offset']=qs['offset'](_0x23326d[_0xe0e1('0x45')][_0xe0e1('0x2e')]);}_0xcf890b['order']=qs['sort'](_0x23326d['query'][_0xe0e1('0x4e')]);_0xcf890b[_0xe0e1('0x4f')]=qs[_0xe0e1('0x50')](_['pick'](_0x23326d[_0xe0e1('0x45')],_0x3fb36b[_0xe0e1('0x50')]));_0xcf890b[_0xe0e1('0x4f')]['FaxAccountId']=_0x204045['id'];if(_0x23326d[_0xe0e1('0x45')][_0xe0e1('0x52')]){_0xcf890b[_0xe0e1('0x4f')]=_[_0xe0e1('0x5c')](_0xcf890b['where'],{'$or':_[_0xe0e1('0x3f')](_0xcf890b['attributes'],function(_0x22c204){var _0x2045e0={};_0x2045e0[_0x22c204]={'$like':'%'+_0x23326d[_0xe0e1('0x45')][_0xe0e1('0x52')]+'%'};return _0x2045e0;})});}if(_0x23326d[_0xe0e1('0x45')][_0xe0e1('0xa7')]){var _0x3f8e96=_0x23326d[_0xe0e1('0x45')][_0xe0e1('0xa7')][_0xe0e1('0xa8')](',');var _0x4edde8={};_0x4edde8[_0x3f8e96[0x0]]={'$gte':moment(_0x3f8e96[0x1])[_0xe0e1('0xa9')](_0xe0e1('0xaa'))};_0xcf890b[_0xe0e1('0x4f')]=_[_0xe0e1('0x5c')](_0xcf890b[_0xe0e1('0x4f')],_0x4edde8);}_0xcf890b=_[_0xe0e1('0x5c')]({},_0xcf890b,_0x23326d['options']);return db[_0xe0e1('0xa6')][_0xe0e1('0x31')]({'where':_0xcf890b[_0xe0e1('0x4f')]})[_0xe0e1('0x21')](function(_0x307dcf){_0x45cc06[_0xe0e1('0x31')]=_0x307dcf;if(_0x23326d[_0xe0e1('0x45')][_0xe0e1('0x54')]){_0xcf890b[_0xe0e1('0x55')]=[{'all':!![]}];}return db['FaxMessage'][_0xe0e1('0x6d')](_0xcf890b);})[_0xe0e1('0x21')](function(_0xc6ea5d){_0x45cc06[_0xe0e1('0x56')]=_0xc6ea5d;return _0x45cc06;});}})[_0xe0e1('0x21')](respondWithFilteredResult(_0x13ce31,_0xcf890b))[_0xe0e1('0x57')](handleError(_0x13ce31,null));};exports[_0xe0e1('0x3d')]=function(_0x196034,_0x1875e6,_0x40e275){var _0x1bce9e,_0x2334cf={},_0x2a67f7;if(_0x196034['body']['to']){_0x2a67f7=_0x196034['body']['to'][0x0];}return db[_0xe0e1('0x40')][_0xe0e1('0x5d')]({'where':{'id':_0x196034['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xe0e1('0x76')],'as':_0xe0e1('0xab'),'where':{'fax':_0x2a67f7},'limit':0x1,'order':[[_0xe0e1('0xac'),_0xe0e1('0xad')]]}]}]})[_0xe0e1('0x21')](handleEntityNotFound(_0x1875e6,null))['then'](function(_0x3371bb){_0x1bce9e=_0x3371bb;if(_0x196034['body'][_0xe0e1('0xae')]&&_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][_0xe0e1('0x4a')]){for(var _0x2cbbd5=0x0;_0x2cbbd5<_0x196034[_0xe0e1('0x66')]['attachments'][_0xe0e1('0x4a')];_0x2cbbd5+=0x1){_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][_0x2cbbd5]={'filename':_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][_0x2cbbd5][_0xe0e1('0x3c')],'id':_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][_0x2cbbd5]['id'],'path':path[_0xe0e1('0xaf')](config[_0xe0e1('0xb0')],_0xe0e1('0xb1'),_0x196034[_0xe0e1('0x66')]['attachments'][_0x2cbbd5][_0xe0e1('0xb2')])};}}return respondWithRpcPromise(_0xe0e1('0xb3'),'CheckAfterSend',{'FaxAccountId':_[_0xe0e1('0xb4')](_0x196034[_0xe0e1('0x59')]['id'])?undefined:_0x196034[_0xe0e1('0x59')]['id'],'path':_[_0xe0e1('0xb4')](_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][0x0][_0xe0e1('0xb5')])?undefined:_0x196034['body']['attachments'][0x0][_0xe0e1('0xb5')],'fax':_[_0xe0e1('0xb4')](_0x196034[_0xe0e1('0x66')]['to'][0x0])?undefined:_0x196034[_0xe0e1('0x66')]['to'][0x0]},client9002);})[_0xe0e1('0x21')](function(){if(_0x1bce9e){if(_[_0xe0e1('0xb4')](_0x196034[_0xe0e1('0x66')][_0xe0e1('0xb6')])){_0x196034[_0xe0e1('0x66')][_0xe0e1('0xb6')]=util[_0xe0e1('0xa9')](_0xe0e1('0xb7'),_0x1bce9e['name'],_0x1bce9e[_0xe0e1('0xb8')]);}if(_0x1bce9e['List']){if(_0x1bce9e[_0xe0e1('0xb9')][_0xe0e1('0xab')][_0xe0e1('0x4a')]){return _0x1bce9e[_0xe0e1('0xb9')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0xe0e1('0x1a')](_0x196034['body'],{'firstName':_0x196034[_0xe0e1('0x66')]['to'][0x0],'phone':_0x196034[_0xe0e1('0x66')]['to'][0x0],'fax':_0x196034[_0xe0e1('0x66')]['to'][0x0],'ListId':_0x1bce9e[_0xe0e1('0xa5')]}));}}else{throw new Error(_0xe0e1('0xba'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xe0e1('0x21')](function(_0x41dd29){if(_0x41dd29){return db[_0xe0e1('0x73')][_0xe0e1('0x5d')]({'where':{'ContactId':_0x41dd29['id'],'closed':![],'FaxAccountId':_0x1bce9e['id']}})[_0xe0e1('0x21')](function(_0x54edb3){if(_0x54edb3){return[_0x54edb3,![]];}return db[_0xe0e1('0x73')][_0xe0e1('0x5e')]({'UserId':_0x196034['user']['id'],'ContactId':_0x41dd29['id'],'FaxAccountId':_0x1bce9e['id'],'fax':_0x196034[_0xe0e1('0x66')]['to'][0x0],'firstMsgDirection':_0xe0e1('0xbb'),'Messages':[_[_0xe0e1('0x5c')](_0x196034[_0xe0e1('0x66')],{'read':![],'body':_0x196034[_0xe0e1('0x66')]['attachments'][0x0]['filename'],'FaxAccountId':_0x1bce9e['id'],'UserId':_0x196034['user']['id'],'ContactId':_0x41dd29['id'],'AttachmentId':_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][0x0]['id']})]},{'include':[{'model':db[_0xe0e1('0xa6')],'as':_0xe0e1('0xbc')}]})['then'](function(_0x22efab){return[_0x22efab,!![]];});});}else{throw new Error(_0xe0e1('0xbd'));}})[_0xe0e1('0xbe')](function(_0xf85ede,_0x49f01c){if(_0x49f01c){return _0xf85ede;}return db[_0xe0e1('0xa6')][_0xe0e1('0x5e')]({'direction':_0xe0e1('0xbb'),'read':![],'body':_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][0x0][_0xe0e1('0xbf')],'FaxAccountId':_0x1bce9e['id'],'FaxInteractionId':_0xf85ede['id'],'UserId':_0x196034[_0xe0e1('0x5f')]['id'],'ContactId':_0xf85ede[_0xe0e1('0xc0')],'AttachmentId':_0x196034[_0xe0e1('0x66')]['attachments'][0x0]['id']})['then'](function(_0x27729f){_0xf85ede['dataValues'][_0xe0e1('0xbc')]=[];_0xf85ede['dataValues']['Messages']['push'](_0x27729f[_0xe0e1('0xc1')]);return _0xf85ede;});})[_0xe0e1('0x21')](function(_0xc1b43){respondWithRpcPromise(_0xe0e1('0xc2'),_0xe0e1('0xc2'),{'FaxAccountId':_[_0xe0e1('0xb4')](_0x196034[_0xe0e1('0x59')]['id'])?undefined:_0x196034[_0xe0e1('0x59')]['id'],'path':_[_0xe0e1('0xb4')](_0x196034[_0xe0e1('0x66')][_0xe0e1('0xae')][0x0][_0xe0e1('0xb5')])?undefined:_0x196034['body'][_0xe0e1('0xae')][0x0][_0xe0e1('0xb5')],'fax':_['isNil'](_0x196034['body']['to'][0x0])?undefined:_0x196034['body']['to'][0x0],'AttachmentId':_0x196034[_0xe0e1('0x66')]['attachments'][0x0]['id']},client9002)['then'](function(_0xb48ff0){logger[_0xe0e1('0x22')](_0xe0e1('0xc3'),_0xb48ff0);})[_0xe0e1('0x57')](function(_0x549be3){logger[_0xe0e1('0x22')](_0xe0e1('0xc3'),_0x549be3);});return _0xc1b43;})[_0xe0e1('0x21')](respondWithResult(_0x1875e6,null))['catch'](handleError(_0x1875e6,null));};exports['addAgents']=function(_0x3a65ca,_0x44025d,_0x559150){return db[_0xe0e1('0x40')][_0xe0e1('0x5d')]({'where':{'id':_0x3a65ca[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x44025d,null))[_0xe0e1('0x21')](function(_0x5af875){if(_0x5af875){return _0x5af875[_0xe0e1('0xc4')](_0x3a65ca[_0xe0e1('0x66')][_0xe0e1('0x6e')],_[_0xe0e1('0x74')](_0x3a65ca[_0xe0e1('0x66')],[_0xe0e1('0x6e'),'id'])||{})['spread'](function(_0xd549d2){for(var _0x4e3514=0x0;_0x4e3514<_0x3a65ca[_0xe0e1('0x66')][_0xe0e1('0x6e')]['length'];_0x4e3514+=0x1){socket[_0xe0e1('0xc5')](_0xe0e1('0xc6'),{'UserId':Number(_0x3a65ca[_0xe0e1('0x66')][_0xe0e1('0x6e')][_0x4e3514]),'FaxAccountId':Number(_0x3a65ca['params']['id'])});}return _0xd549d2;});}})[_0xe0e1('0x21')](respondWithResult(_0x44025d,null))[_0xe0e1('0x57')](handleError(_0x44025d,null));};exports[_0xe0e1('0xc7')]=function(_0x584bb0,_0x5667b8,_0x16bdf7){return db[_0xe0e1('0x40')][_0xe0e1('0x5d')]({'where':{'id':_0x584bb0['params']['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x5667b8,null))['then'](function(_0x561ea0){if(_0x561ea0){return _0x561ea0[_0xe0e1('0xc7')](_0x584bb0[_0xe0e1('0x45')]['ids'])['then'](function(){if(_[_0xe0e1('0xc8')](_0x584bb0[_0xe0e1('0x45')][_0xe0e1('0x6e')])){for(var _0x346751=0x0;_0x346751<_0x584bb0[_0xe0e1('0x45')][_0xe0e1('0x6e')][_0xe0e1('0x4a')];_0x346751+=0x1){socket[_0xe0e1('0xc5')]('userFaxAccount:remove',{'UserId':Number(_0x584bb0[_0xe0e1('0x45')][_0xe0e1('0x6e')][_0x346751]),'FaxAccountId':Number(_0x584bb0[_0xe0e1('0x59')]['id'])});}}else{socket[_0xe0e1('0xc5')](_0xe0e1('0xc9'),{'UserId':Number(_0x584bb0[_0xe0e1('0x45')]['ids']),'FaxAccountId':Number(_0x584bb0['params']['id'])});}});}})[_0xe0e1('0x21')](respondWithStatusCode(_0x5667b8,null))[_0xe0e1('0x57')](handleError(_0x5667b8,null));};exports[_0xe0e1('0xca')]=function(_0x1a1526,_0x160d8d,_0x180fe9){var _0x691a1f={};var _0x4cd28e={};var _0x48b864;var _0x29d553;return db[_0xe0e1('0x40')][_0xe0e1('0x6a')]({'where':{'id':_0x1a1526[_0xe0e1('0x59')]['id']}})[_0xe0e1('0x21')](handleEntityNotFound(_0x160d8d,null))['then'](function(_0x111554){if(_0x111554){_0x48b864=_0x111554;_0x4cd28e['model']=_[_0xe0e1('0x5b')](db['User']['rawAttributes']);_0x4cd28e[_0xe0e1('0x45')]=_['keys'](_0x1a1526['query']);_0x4cd28e['filters']=_[_0xe0e1('0x46')](_0x4cd28e[_0xe0e1('0x47')],_0x4cd28e['query']);_0x691a1f[_0xe0e1('0x48')]=_['intersection'](_0x4cd28e[_0xe0e1('0x47')],qs['fields'](_0x1a1526[_0xe0e1('0x45')][_0xe0e1('0x49')]));_0x691a1f[_0xe0e1('0x48')]=_0x691a1f[_0xe0e1('0x48')][_0xe0e1('0x4a')]?_0x691a1f[_0xe0e1('0x48')]:_0x4cd28e[_0xe0e1('0x47')];_0x691a1f['order']=qs[_0xe0e1('0x4e')](_0x1a1526[_0xe0e1('0x45')][_0xe0e1('0x4e')]);_0x691a1f[_0xe0e1('0x4f')]=qs[_0xe0e1('0x50')](_[_0xe0e1('0x51')](_0x1a1526[_0xe0e1('0x45')],_0x4cd28e['filters']));if(_0x1a1526[_0xe0e1('0x45')][_0xe0e1('0x52')]){_0x691a1f[_0xe0e1('0x4f')]=_[_0xe0e1('0x5c')](_0x691a1f[_0xe0e1('0x4f')],{'$or':_['map'](_0x691a1f[_0xe0e1('0x48')],function(_0x3542b1){var _0x441dc0={};_0x441dc0[_0x3542b1]={'$like':'%'+_0x1a1526[_0xe0e1('0x45')]['filter']+'%'};return _0x441dc0;})});}_0x691a1f=_[_0xe0e1('0x5c')]({},_0x691a1f,_0x1a1526[_0xe0e1('0x70')]);return _0x48b864[_0xe0e1('0xca')](_0x691a1f);}})[_0xe0e1('0x21')](function(_0x541bcf){if(_0x541bcf){_0x29d553=_0x541bcf['length'];if(!_0x1a1526[_0xe0e1('0x45')][_0xe0e1('0x4b')]('nolimit')){_0x691a1f[_0xe0e1('0x30')]=qs[_0xe0e1('0x30')](_0x1a1526[_0xe0e1('0x45')][_0xe0e1('0x30')]);_0x691a1f['offset']=qs[_0xe0e1('0x2e')](_0x1a1526['query']['offset']);}return _0x48b864['getAgents'](_0x691a1f);}})[_0xe0e1('0x21')](function(_0x2ff1f8){if(_0x2ff1f8){return _0x2ff1f8?{'count':_0x29d553,'rows':_0x2ff1f8}:null;}})['then'](respondWithResult(_0x160d8d,null))[_0xe0e1('0x57')](handleError(_0x160d8d,null));}; \ No newline at end of file +var _0x943f=['params','mandatoryDispositionPause','fields','merge','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','appdata','Answer','push','CDR(type)=inbound-fax','Set','gateway','faxdetect','maxrate','minrate','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','CmContact','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../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','client','http','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','show'];(function(_0xa0cf3,_0x261d3f){var _0x5f4018=function(_0x4acfaa){while(--_0x4acfaa){_0xa0cf3['push'](_0xa0cf3['shift']());}};_0x5f4018(++_0x261d3f);}(_0x943f,0x13a));var _0xf943=function(_0x3a6568,_0xd3df53){_0x3a6568=_0x3a6568-0x0;var _0x12b620=_0x943f[_0x3a6568];return _0x12b620;};'use strict';var emlformat=require(_0xf943('0x0'));var rimraf=require(_0xf943('0x1'));var zipdir=require(_0xf943('0x2'));var jsonpatch=require(_0xf943('0x3'));var rp=require('request-promise');var moment=require(_0xf943('0x4'));var BPromise=require(_0xf943('0x5'));var Mustache=require('mustache');var util=require(_0xf943('0x6'));var path=require(_0xf943('0x7'));var sox=require(_0xf943('0x8'));var csv=require(_0xf943('0x9'));var ejs=require(_0xf943('0xa'));var fs=require('fs');var fs_extra=require(_0xf943('0xb'));var _=require('lodash');var squel=require(_0xf943('0xc'));var crypto=require(_0xf943('0xd'));var jsforce=require(_0xf943('0xe'));var deskjs=require(_0xf943('0xf'));var toCsv=require(_0xf943('0x9'));var querystring=require(_0xf943('0x10'));var Papa=require('papaparse');var Redis=require(_0xf943('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf943('0x12'));var as=require(_0xf943('0x13'));var hardwareService=require(_0xf943('0x14'));var logger=require(_0xf943('0x15'))('api');var utils=require(_0xf943('0x16'));var config=require(_0xf943('0x17'));var licenseUtil=require(_0xf943('0x18'));var db=require(_0xf943('0x19'))['db'];config[_0xf943('0x1a')]=_[_0xf943('0x1b')](config[_0xf943('0x1a')],{'host':_0xf943('0x1c'),'port':0x18eb});var socket=require(_0xf943('0x1d'))(new Redis(config[_0xf943('0x1a')]));require(_0xf943('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xf943('0x1f')][_0xf943('0x20')]({'port':0x232c});var client9002=jayson[_0xf943('0x1f')][_0xf943('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x137c00,_0x1c0c3b,_0x4032d6,_0x320f4f){return new BPromise(function(_0x5df8fe,_0x3457ab){var _0x1f93ba=_0x320f4f||client;return _0x1f93ba[_0xf943('0x21')](_0x137c00,_0x4032d6)[_0xf943('0x22')](function(_0x29eabb){logger['info']('FaxAccount,\x20%s,\x20%s',_0x1c0c3b,_0xf943('0x23'));logger[_0xf943('0x24')](_0xf943('0x25'),_0x1c0c3b,_0xf943('0x23'),JSON[_0xf943('0x26')](_0x29eabb));if(_0x29eabb['error']){if(_0x29eabb['error']['code']===0x1f4){logger[_0xf943('0x27')](_0xf943('0x28'),_0x1c0c3b,_0x29eabb[_0xf943('0x27')][_0xf943('0x29')]);return _0x3457ab(_0x29eabb[_0xf943('0x27')]['message']);}logger[_0xf943('0x27')](_0xf943('0x28'),_0x1c0c3b,_0x29eabb[_0xf943('0x27')][_0xf943('0x29')]);return _0x5df8fe(_0x29eabb['error'][_0xf943('0x29')]);}else{logger['info'](_0xf943('0x28'),_0x1c0c3b,_0xf943('0x23'));_0x5df8fe(_0x29eabb[_0xf943('0x2a')][_0xf943('0x29')]);}})[_0xf943('0x2b')](function(_0x7609b7){logger[_0xf943('0x27')](_0xf943('0x28'),_0x1c0c3b,_0x7609b7);_0x3457ab(_0x7609b7);});});}function respondWithStatusCode(_0x5486fc,_0x4368a4){_0x4368a4=_0x4368a4||0xcc;return function(_0x5bec47){if(_0x5bec47){return _0x5486fc[_0xf943('0x2c')](_0x4368a4);}return _0x5486fc['status'](_0x4368a4)[_0xf943('0x2d')]();};}function respondWithResult(_0x143744,_0x2871f7){_0x2871f7=_0x2871f7||0xc8;return function(_0x50b319){if(_0x50b319){return _0x143744[_0xf943('0x2e')](_0x2871f7)['json'](_0x50b319);}};}function respondWithFilteredResult(_0x2fbd4d,_0x72bce0){return function(_0x3b975c){if(_0x3b975c){var _0x16ef31=typeof _0x72bce0[_0xf943('0x2f')]===_0xf943('0x30')&&typeof _0x72bce0[_0xf943('0x31')]===_0xf943('0x30');var _0x27d410=_0x3b975c[_0xf943('0x32')];var _0x2c5ac5=_0x16ef31?0x0:_0x72bce0[_0xf943('0x2f')];var _0x4a4f8e=_0x16ef31?_0x3b975c[_0xf943('0x32')]:_0x72bce0['offset']+_0x72bce0[_0xf943('0x31')];var _0x5757f2;if(_0x4a4f8e>=_0x27d410){_0x4a4f8e=_0x27d410;_0x5757f2=0xc8;}else{_0x5757f2=0xce;}_0x2fbd4d[_0xf943('0x2e')](_0x5757f2);return _0x2fbd4d[_0xf943('0x33')]('Content-Range',_0x2c5ac5+'-'+_0x4a4f8e+'/'+_0x27d410)[_0xf943('0x34')](_0x3b975c);}return null;};}function patchUpdates(_0x6dd4fc){return function(_0x96965b){try{jsonpatch[_0xf943('0x35')](_0x96965b,_0x6dd4fc,!![]);}catch(_0x42618f){return BPromise[_0xf943('0x36')](_0x42618f);}return _0x96965b[_0xf943('0x37')]();};}function saveUpdates(_0x16efdb,_0x4aaa9e){return function(_0x5c4e38){if(_0x5c4e38){return _0x5c4e38[_0xf943('0x38')](_0x16efdb)[_0xf943('0x22')](function(_0x59ce95){return _0x59ce95;});}return null;};}function removeEntity(_0x2e5633,_0x29b377){return function(_0x488233){if(_0x488233){return _0x488233['destroy']()[_0xf943('0x22')](function(){var _0x7ad71b=_0x488233[_0xf943('0x39')]({'plain':!![]});var _0x15edf0=_0xf943('0x3a');return db[_0xf943('0x3b')][_0xf943('0x3c')]({'where':{'type':_0x15edf0,'resourceId':_0x7ad71b['id']}})[_0xf943('0x22')](function(){return _0x488233;});})['then'](function(){_0x2e5633[_0xf943('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa6fa04,_0x4d1307){return function(_0x38a4dc){if(!_0x38a4dc){_0xa6fa04[_0xf943('0x2c')](0x194);}return _0x38a4dc;};}function handleError(_0x3eda57,_0x2fb56d){_0x2fb56d=_0x2fb56d||0x1f4;return function(_0x55797b){logger[_0xf943('0x27')](_0x55797b[_0xf943('0x3d')]);if(_0x55797b[_0xf943('0x3e')]){delete _0x55797b[_0xf943('0x3e')];}_0x3eda57[_0xf943('0x2e')](_0x2fb56d)['send'](_0x55797b);};}exports[_0xf943('0x3f')]=function(_0x5040a5,_0x3ce258){var _0x403a5b={'include':[{'model':db[_0xf943('0x40')],'as':'mandatoryDispositionPause'}]},_0x3cbcb9={},_0x590b59={'count':0x0,'rows':[]};var _0x53ff4a=_[_0xf943('0x41')](db[_0xf943('0x42')][_0xf943('0x43')],function(_0x5a31f4){return{'name':_0x5a31f4[_0xf943('0x44')],'type':_0x5a31f4[_0xf943('0x45')][_0xf943('0x46')]};});_0x3cbcb9[_0xf943('0x47')]=_[_0xf943('0x41')](_0x53ff4a,'name');_0x3cbcb9[_0xf943('0x48')]=_[_0xf943('0x49')](_0x5040a5['query']);_0x3cbcb9[_0xf943('0x4a')]=_['intersection'](_0x3cbcb9[_0xf943('0x47')],_0x3cbcb9[_0xf943('0x48')]);_0x403a5b[_0xf943('0x4b')]=_[_0xf943('0x4c')](_0x3cbcb9[_0xf943('0x47')],qs['fields'](_0x5040a5[_0xf943('0x48')]['fields']));_0x403a5b[_0xf943('0x4b')]=_0x403a5b[_0xf943('0x4b')][_0xf943('0x4d')]?_0x403a5b['attributes']:_0x3cbcb9[_0xf943('0x47')];if(!_0x5040a5[_0xf943('0x48')][_0xf943('0x4e')](_0xf943('0x4f'))){_0x403a5b[_0xf943('0x31')]=qs[_0xf943('0x31')](_0x5040a5['query']['limit']);_0x403a5b['offset']=qs['offset'](_0x5040a5[_0xf943('0x48')]['offset']);}_0x403a5b[_0xf943('0x50')]=qs[_0xf943('0x51')](_0x5040a5[_0xf943('0x48')][_0xf943('0x51')]);_0x403a5b[_0xf943('0x52')]=qs[_0xf943('0x4a')](_['pick'](_0x5040a5[_0xf943('0x48')],_0x3cbcb9['filters']),_0x53ff4a);if(_0x5040a5[_0xf943('0x48')][_0xf943('0x53')]){_0x403a5b[_0xf943('0x52')]=_['merge'](_0x403a5b['where'],{'$or':_[_0xf943('0x41')](_0x53ff4a,function(_0x368bbc){if(_0x368bbc['type']!==_0xf943('0x54')){var _0x243267={};_0x243267[_0x368bbc['name']]={'$like':'%'+_0x5040a5['query']['filter']+'%'};return _0x243267;}})});}_0x403a5b=_['merge']({},_0x403a5b,_0x5040a5[_0xf943('0x55')]);var _0x359261={'where':_0x403a5b[_0xf943('0x52')]};return db[_0xf943('0x42')][_0xf943('0x32')](_0x359261)[_0xf943('0x22')](function(_0x5b6bb8){_0x590b59[_0xf943('0x32')]=_0x5b6bb8;if(_0x5040a5[_0xf943('0x48')][_0xf943('0x56')]){_0x403a5b[_0xf943('0x57')]=[{'all':!![]}];}return db['FaxAccount'][_0xf943('0x58')](_0x403a5b);})[_0xf943('0x22')](function(_0x4133b0){_0x590b59['rows']=_0x4133b0;return _0x590b59;})['then'](respondWithFilteredResult(_0x3ce258,_0x403a5b))[_0xf943('0x2b')](handleError(_0x3ce258,null));};exports[_0xf943('0x59')]=function(_0x530060,_0x3c3c7b){var _0x595fae={'raw':![],'where':{'id':_0x530060[_0xf943('0x5a')]['id']},'include':[{'model':db[_0xf943('0x40')],'as':_0xf943('0x5b')}]},_0x4879e2={};_0x4879e2['model']=_[_0xf943('0x49')](db['FaxAccount'][_0xf943('0x43')]);_0x4879e2[_0xf943('0x48')]=_[_0xf943('0x49')](_0x530060[_0xf943('0x48')]);_0x4879e2[_0xf943('0x4a')]=_['intersection'](_0x4879e2[_0xf943('0x47')],_0x4879e2[_0xf943('0x48')]);_0x595fae['attributes']=_[_0xf943('0x4c')](_0x4879e2[_0xf943('0x47')],qs['fields'](_0x530060[_0xf943('0x48')][_0xf943('0x5c')]));_0x595fae[_0xf943('0x4b')]=_0x595fae['attributes'][_0xf943('0x4d')]?_0x595fae['attributes']:_0x4879e2['model'];if(_0x530060['query'][_0xf943('0x56')]){_0x595fae['include']=[{'all':!![]}];}_0x595fae=_[_0xf943('0x5d')]({},_0x595fae,_0x530060[_0xf943('0x55')]);return db[_0xf943('0x42')]['find'](_0x595fae)['then'](handleEntityNotFound(_0x3c3c7b,null))[_0xf943('0x22')](respondWithResult(_0x3c3c7b,null))['catch'](handleError(_0x3c3c7b,null));};exports['create']=function(_0x27c140,_0x11004a){return db['FaxAccount']['create'](_0x27c140['body'],{})[_0xf943('0x22')](function(_0x357b12){var _0x27b782=_0x27c140[_0xf943('0x5e')][_0xf943('0x39')]({'plain':!![]});if(!_0x27b782)throw new Error(_0xf943('0x5f'));if(_0x27b782[_0xf943('0x60')]===_0xf943('0x5e')){var _0x3788f7=_0x357b12[_0xf943('0x39')]({'plain':!![]});var _0x3bd53f=_0xf943('0x3a');return db['UserProfileSection'][_0xf943('0x61')]({'where':{'name':_0x3bd53f,'userProfileId':_0x27b782[_0xf943('0x62')]},'raw':!![]})[_0xf943('0x22')](function(_0x2b9d08){if(_0x2b9d08&&_0x2b9d08[_0xf943('0x63')]===0x0){return db[_0xf943('0x3b')][_0xf943('0x64')]({'name':_0x3788f7['name'],'resourceId':_0x3788f7['id'],'type':_0x2b9d08[_0xf943('0x3e')],'sectionId':_0x2b9d08['id']},{})[_0xf943('0x22')](function(){return _0x357b12;});}else{return _0x357b12;}})[_0xf943('0x2b')](function(_0x2459f9){logger[_0xf943('0x27')](_0xf943('0x65'),_0x2459f9);throw _0x2459f9;});}return _0x357b12;})[_0xf943('0x22')](respondWithResult(_0x11004a,0xc9))[_0xf943('0x2b')](handleError(_0x11004a,null));};exports['update']=function(_0x1bae77,_0x361dc3){if(_0x1bae77[_0xf943('0x66')]['id']){delete _0x1bae77[_0xf943('0x66')]['id'];}return db[_0xf943('0x42')][_0xf943('0x61')]({'where':{'id':_0x1bae77[_0xf943('0x5a')]['id']},'include':[{'model':db[_0xf943('0x40')],'as':_0xf943('0x5b')}]})[_0xf943('0x22')](handleEntityNotFound(_0x361dc3,null))[_0xf943('0x22')](saveUpdates(_0x1bae77[_0xf943('0x66')],null))[_0xf943('0x22')](respondWithResult(_0x361dc3,null))[_0xf943('0x2b')](handleError(_0x361dc3,null));};exports[_0xf943('0x3c')]=function(_0x12694c,_0x257864){return db[_0xf943('0x42')]['find']({'where':{'id':_0x12694c['params']['id']}})['then'](handleEntityNotFound(_0x257864,null))['then'](removeEntity(_0x257864,null))[_0xf943('0x2b')](handleError(_0x257864,null));};exports[_0xf943('0x67')]=function(_0x1329d9,_0x5a8cb2){return db[_0xf943('0x42')][_0xf943('0x67')]()[_0xf943('0x22')](respondWithResult(_0x5a8cb2,null))[_0xf943('0x2b')](handleError(_0x5a8cb2,null));};exports[_0xf943('0x68')]=function(_0x35a4ae,_0x1554e8,_0x16ae16){if(_0x35a4ae['body']['id']){delete _0x35a4ae[_0xf943('0x66')]['id'];}return db[_0xf943('0x42')][_0xf943('0x61')]({'where':{'id':_0x35a4ae[_0xf943('0x5a')]['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x1554e8,null))[_0xf943('0x22')](function(_0x570d64){if(_0x570d64){_0x35a4ae[_0xf943('0x66')][_0xf943('0x69')]=_0x570d64['id'];return db[_0xf943('0x6a')][_0xf943('0x64')](_0x35a4ae[_0xf943('0x66')]);}})[_0xf943('0x22')](respondWithResult(_0x1554e8,null))[_0xf943('0x2b')](handleError(_0x1554e8,null));};exports[_0xf943('0x6b')]=function(_0x292794,_0x5a8e5a,_0x3ae63a){var _0x2cdc50={'raw':![],'where':{}};var _0x3add9b={};var _0x4ba58b={'count':0x0,'rows':[]};return db[_0xf943('0x42')][_0xf943('0x6c')]({'where':{'id':_0x292794[_0xf943('0x5a')]['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x5a8e5a,null))['then'](function(_0x4b92f4){if(_0x4b92f4){_0x3add9b[_0xf943('0x47')]=_[_0xf943('0x49')](db[_0xf943('0x6a')][_0xf943('0x43')]);_0x3add9b[_0xf943('0x48')]=_[_0xf943('0x49')](_0x292794[_0xf943('0x48')]);_0x3add9b[_0xf943('0x4a')]=_[_0xf943('0x4c')](_0x3add9b[_0xf943('0x47')],_0x3add9b['query']);_0x2cdc50['attributes']=_[_0xf943('0x4c')](_0x3add9b[_0xf943('0x47')],qs[_0xf943('0x5c')](_0x292794[_0xf943('0x48')][_0xf943('0x5c')]));_0x2cdc50[_0xf943('0x4b')]=_0x2cdc50['attributes'][_0xf943('0x4d')]?_0x2cdc50['attributes']:_0x3add9b[_0xf943('0x47')];if(!_0x292794[_0xf943('0x48')][_0xf943('0x4e')](_0xf943('0x4f'))){_0x2cdc50[_0xf943('0x31')]=qs[_0xf943('0x31')](_0x292794[_0xf943('0x48')][_0xf943('0x31')]);_0x2cdc50[_0xf943('0x2f')]=qs[_0xf943('0x2f')](_0x292794[_0xf943('0x48')]['offset']);}_0x2cdc50[_0xf943('0x50')]=qs['sort'](_0x292794[_0xf943('0x48')][_0xf943('0x51')]);_0x2cdc50[_0xf943('0x52')]=qs[_0xf943('0x4a')](_[_0xf943('0x6d')](_0x292794['query'],_0x3add9b['filters']));_0x2cdc50[_0xf943('0x52')][_0xf943('0x69')]=_0x4b92f4['id'];if(_0x292794[_0xf943('0x48')][_0xf943('0x53')]){_0x2cdc50['where']=_[_0xf943('0x5d')](_0x2cdc50['where'],{'$or':_['map'](_0x2cdc50[_0xf943('0x4b')],function(_0x3be152){var _0x866749={};_0x866749[_0x3be152]={'$like':'%'+_0x292794['query'][_0xf943('0x53')]+'%'};return _0x866749;})});}_0x2cdc50=_[_0xf943('0x5d')]({},_0x2cdc50,_0x292794[_0xf943('0x55')]);return db[_0xf943('0x6a')][_0xf943('0x32')]({'where':_0x2cdc50[_0xf943('0x52')]})['then'](function(_0x417758){_0x4ba58b['count']=_0x417758;if(_0x292794[_0xf943('0x48')][_0xf943('0x56')]){_0x2cdc50[_0xf943('0x57')]=[{'all':!![]}];}return db[_0xf943('0x6a')][_0xf943('0x58')](_0x2cdc50);})[_0xf943('0x22')](function(_0x9e41c2){_0x4ba58b[_0xf943('0x6e')]=_0x9e41c2;return _0x4ba58b;});}})[_0xf943('0x22')](respondWithFilteredResult(_0x5a8e5a,_0x2cdc50))['catch'](handleError(_0x5a8e5a,null));};exports[_0xf943('0x6f')]=function(_0x163de7,_0x157cad,_0x32668d){return db['FaxAccount'][_0xf943('0x61')]({'where':{'id':_0x163de7['params']['id']}})['then'](handleEntityNotFound(_0x157cad,null))[_0xf943('0x22')](function(_0x555948){if(_0x555948){return _0x555948[_0xf943('0x6f')](_0x163de7[_0xf943('0x48')][_0xf943('0x70')]);}})[_0xf943('0x22')](respondWithStatusCode(_0x157cad,null))[_0xf943('0x2b')](handleError(_0x157cad,null));};exports[_0xf943('0x71')]=function(_0x395eba,_0x3ce548,_0x33c420){if(_0x395eba[_0xf943('0x66')]['id']){delete _0x395eba[_0xf943('0x66')]['id'];}return db[_0xf943('0x42')]['find']({'where':{'id':_0x395eba[_0xf943('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3ce548,null))['then'](function(_0x4c086a){if(_0x4c086a){_0x395eba[_0xf943('0x66')]['FaxAccountId']=_0x4c086a['id'];return db[_0xf943('0x72')][_0xf943('0x64')](_0x395eba[_0xf943('0x66')]);}})[_0xf943('0x22')](respondWithResult(_0x3ce548,null))[_0xf943('0x2b')](handleError(_0x3ce548,null));};exports['getAnswers']=function(_0x7a105,_0x425998,_0x3ff448){var _0x11fafe={'raw':![],'where':{}};var _0x9baee4={};var _0x5a8da4={'count':0x0,'rows':[]};return db[_0xf943('0x42')][_0xf943('0x6c')]({'where':{'id':_0x7a105['params']['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x425998,null))[_0xf943('0x22')](function(_0x50162d){if(_0x50162d){_0x9baee4[_0xf943('0x47')]=_['keys'](db['CannedAnswer'][_0xf943('0x43')]);_0x9baee4['query']=_[_0xf943('0x49')](_0x7a105['query']);_0x9baee4[_0xf943('0x4a')]=_['intersection'](_0x9baee4['model'],_0x9baee4[_0xf943('0x48')]);_0x11fafe['attributes']=_[_0xf943('0x4c')](_0x9baee4[_0xf943('0x47')],qs[_0xf943('0x5c')](_0x7a105[_0xf943('0x48')][_0xf943('0x5c')]));_0x11fafe[_0xf943('0x4b')]=_0x11fafe[_0xf943('0x4b')][_0xf943('0x4d')]?_0x11fafe[_0xf943('0x4b')]:_0x9baee4[_0xf943('0x47')];if(!_0x7a105[_0xf943('0x48')]['hasOwnProperty'](_0xf943('0x4f'))){_0x11fafe['limit']=qs[_0xf943('0x31')](_0x7a105['query']['limit']);_0x11fafe[_0xf943('0x2f')]=qs[_0xf943('0x2f')](_0x7a105[_0xf943('0x48')][_0xf943('0x2f')]);}_0x11fafe[_0xf943('0x50')]=qs[_0xf943('0x51')](_0x7a105[_0xf943('0x48')][_0xf943('0x51')]);_0x11fafe['where']=qs['filters'](_[_0xf943('0x6d')](_0x7a105[_0xf943('0x48')],_0x9baee4['filters']));_0x11fafe['where'][_0xf943('0x69')]=_0x50162d['id'];if(_0x7a105['query'][_0xf943('0x53')]){_0x11fafe[_0xf943('0x52')]=_['merge'](_0x11fafe[_0xf943('0x52')],{'$or':_[_0xf943('0x41')](_0x11fafe[_0xf943('0x4b')],function(_0x53350c){var _0x246873={};_0x246873[_0x53350c]={'$like':'%'+_0x7a105[_0xf943('0x48')]['filter']+'%'};return _0x246873;})});}_0x11fafe=_['merge']({},_0x11fafe,_0x7a105['options']);return db['CannedAnswer']['count']({'where':_0x11fafe[_0xf943('0x52')]})[_0xf943('0x22')](function(_0x1fa866){_0x5a8da4['count']=_0x1fa866;if(_0x7a105[_0xf943('0x48')][_0xf943('0x56')]){_0x11fafe[_0xf943('0x57')]=[{'all':!![]}];}return db[_0xf943('0x72')][_0xf943('0x58')](_0x11fafe);})[_0xf943('0x22')](function(_0x45a7db){_0x5a8da4[_0xf943('0x6e')]=_0x45a7db;return _0x5a8da4;});}})[_0xf943('0x22')](respondWithFilteredResult(_0x425998,_0x11fafe))['catch'](handleError(_0x425998,null));};exports['removeAnswers']=function(_0x582d21,_0x495403,_0x1effeb){return db[_0xf943('0x42')]['find']({'where':{'id':_0x582d21[_0xf943('0x5a')]['id']}})['then'](handleEntityNotFound(_0x495403,null))['then'](function(_0x59cb78){if(_0x59cb78){return _0x59cb78['removeAnswers'](_0x582d21[_0xf943('0x48')][_0xf943('0x70')]);}})[_0xf943('0x22')](respondWithStatusCode(_0x495403,null))['catch'](handleError(_0x495403,null));};exports[_0xf943('0x73')]=function(_0x27b83a,_0x5c1e0a,_0x5924bb){return db[_0xf943('0x74')][_0xf943('0x61')]({'where':{'id':_0x27b83a['params']['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x5c1e0a,null))[_0xf943('0x22')](function(_0x221bf0){if(_0x221bf0){return _0x221bf0['addInteraction'](_0x27b83a[_0xf943('0x66')][_0xf943('0x70')],_[_0xf943('0x75')](_0x27b83a[_0xf943('0x66')],['ids','id'])||{});}})[_0xf943('0x22')](respondWithResult(_0x5c1e0a,null))[_0xf943('0x2b')](handleError(_0x5c1e0a,null));};exports[_0xf943('0x76')]=function(_0x50521c,_0x58687c,_0x3445e0){var _0x268d50={'raw':![],'where':{}};var _0x448d74={};var _0x12cf5f={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x50521c['params']['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x58687c,null))[_0xf943('0x22')](function(_0x2f692d){if(_0x2f692d){_0x448d74[_0xf943('0x47')]=_[_0xf943('0x49')](db[_0xf943('0x74')][_0xf943('0x43')]);_0x448d74['query']=_[_0xf943('0x49')](_0x50521c['query']);_0x448d74['filters']=_[_0xf943('0x4c')](_0x448d74[_0xf943('0x47')],_0x448d74['query']);_0x268d50[_0xf943('0x4b')]=_[_0xf943('0x4c')](_0x448d74['model'],qs[_0xf943('0x5c')](_0x50521c[_0xf943('0x48')][_0xf943('0x5c')]));_0x268d50[_0xf943('0x4b')]=_0x268d50[_0xf943('0x4b')]['length']?_0x268d50[_0xf943('0x4b')]:_0x448d74[_0xf943('0x47')];if(!_0x50521c[_0xf943('0x48')][_0xf943('0x4e')](_0xf943('0x4f'))){_0x268d50[_0xf943('0x31')]=qs[_0xf943('0x31')](_0x50521c[_0xf943('0x48')][_0xf943('0x31')]);_0x268d50[_0xf943('0x2f')]=qs[_0xf943('0x2f')](_0x50521c['query'][_0xf943('0x2f')]);}_0x268d50[_0xf943('0x50')]=qs[_0xf943('0x51')](_0x50521c[_0xf943('0x48')]['sort']);_0x268d50[_0xf943('0x52')]=qs[_0xf943('0x4a')](_['pick'](_0x50521c[_0xf943('0x48')],_0x448d74[_0xf943('0x4a')]));_0x268d50[_0xf943('0x52')][_0xf943('0x69')]=_0x2f692d['id'];if(_0x50521c[_0xf943('0x48')][_0xf943('0x53')]){_0x268d50['where']=_[_0xf943('0x5d')](_0x268d50['where'],{'$or':_[_0xf943('0x41')](_0x268d50[_0xf943('0x4b')],function(_0x3b341a){var _0x315a53={};_0x315a53[_0x3b341a]={'$like':'%'+_0x50521c['query'][_0xf943('0x53')]+'%'};return _0x315a53;})});}_0x268d50=_['merge']({},_0x268d50,_0x50521c['options']);return db['FaxInteraction']['count']({'where':_0x268d50['where']})[_0xf943('0x22')](function(_0x22e8a2){_0x12cf5f[_0xf943('0x32')]=_0x22e8a2;if(_0x50521c[_0xf943('0x48')][_0xf943('0x56')]){_0x268d50[_0xf943('0x57')]=[{'model':db['CmContact'],'as':_0xf943('0x77'),'required':![]},{'model':db[_0xf943('0x78')],'as':_0xf943('0x79'),'attributes':[_0xf943('0x3e'),_0xf943('0x7a'),_0xf943('0x7b')],'required':![]},{'model':db['Tag'],'as':_0xf943('0x7c'),'attributes':['id',_0xf943('0x3e'),_0xf943('0x7d')],'where':_0x50521c[_0xf943('0x48')][_0xf943('0x7e')]?{'id':_0x50521c['query']['tag']}:undefined,'required':_0x50521c[_0xf943('0x48')][_0xf943('0x7e')]?!![]:![]}];}return db[_0xf943('0x74')]['findAll'](_0x268d50);})['then'](function(_0x188ab4){_0x12cf5f['rows']=_0x188ab4;return _0x12cf5f;});}})[_0xf943('0x22')](respondWithFilteredResult(_0x58687c,_0x268d50))[_0xf943('0x2b')](handleError(_0x58687c,null));};exports[_0xf943('0x7f')]=function(_0x507fcc,_0x2421d9){var _0x14529b=_0x507fcc[_0xf943('0x5a')]['id'];var _0x1cc5bf=_0x507fcc['body'];var _0x4b23a7=0xc8;var _0x242bf0=null;return db[_0xf943('0x80')][_0xf943('0x81')]({'isolationLevel':db[_0xf943('0x80')][_0xf943('0x82')][_0xf943('0x83')][_0xf943('0x84')]},function(_0xe37f2e){return db[_0xf943('0x42')]['findOne']({'where':{'id':_0x14529b},'transaction':_0xe37f2e})[_0xf943('0x22')](function(_0x568b51){if(_0x568b51){return db[_0xf943('0x85')][_0xf943('0x3c')]({'where':{'FaxAccountId':_0x14529b},'transaction':_0xe37f2e})[_0xf943('0x22')](function(){var _0x57366e=_[_0xf943('0x41')](_0x1cc5bf,function(_0x21f93a){_0x21f93a['FaxAccountId']=_0x14529b;return _0x21f93a;});return db[_0xf943('0x85')][_0xf943('0x86')](_0x57366e,{'transaction':_0xe37f2e});});}else{_0x4b23a7=0x194;_0x242bf0=[];}});})[_0xf943('0x22')](function(){if(_0x4b23a7!==0x194){return db[_0xf943('0x85')]['findAndCountAll']({'where':{'FaxAccountId':_0x14529b},'order':_0xf943('0x87')})[_0xf943('0x22')](function(_0x544185){_0x242bf0=_0x544185;});}})[_0xf943('0x2b')](function(_0x1875e1){_0x4b23a7=0x1f4;logger[_0xf943('0x27')](_0x1875e1[_0xf943('0x3d')]);if(_0x1875e1[_0xf943('0x3e')]){delete _0x1875e1[_0xf943('0x3e')];}_0x242bf0=_0x1875e1;})['finally'](function(){if(_0x242bf0===null){_0x2421d9[_0xf943('0x2c')](_0x4b23a7);}else{if(_0x4b23a7===0x1f4){_0x2421d9['status'](_0x4b23a7)['send'](_0x242bf0);}else{_0x2421d9[_0xf943('0x2e')](_0x4b23a7)[_0xf943('0x34')](_0x242bf0);}}});};exports[_0xf943('0x88')]=function(_0x1c3d38,_0x5e6121,_0x2bb701){var _0x388d35={};var _0x3ce750={};var _0x29c382;var _0x388326;return db[_0xf943('0x42')][_0xf943('0x6c')]({'where':{'id':_0x1c3d38[_0xf943('0x5a')]['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x5e6121,null))[_0xf943('0x22')](function(_0x4ab68b){if(_0x4ab68b){_0x29c382=_0x4ab68b;_0x3ce750[_0xf943('0x47')]=_[_0xf943('0x49')](db[_0xf943('0x85')]['rawAttributes']);_0x3ce750[_0xf943('0x48')]=_[_0xf943('0x49')](_0x1c3d38[_0xf943('0x48')]);_0x3ce750[_0xf943('0x4a')]=_[_0xf943('0x4c')](_0x3ce750[_0xf943('0x47')],_0x3ce750[_0xf943('0x48')]);_0x388d35[_0xf943('0x4b')]=_[_0xf943('0x4c')](_0x3ce750['model'],qs[_0xf943('0x5c')](_0x1c3d38['query'][_0xf943('0x5c')]));_0x388d35[_0xf943('0x4b')]=_0x388d35[_0xf943('0x4b')][_0xf943('0x4d')]?_0x388d35[_0xf943('0x4b')]:_0x3ce750[_0xf943('0x47')];_0x388d35[_0xf943('0x50')]=qs[_0xf943('0x51')](_0x1c3d38[_0xf943('0x48')]['sort']);_0x388d35[_0xf943('0x52')]=qs[_0xf943('0x4a')](_['pick'](_0x1c3d38['query'],_0x3ce750[_0xf943('0x4a')]));if(_0x1c3d38[_0xf943('0x48')][_0xf943('0x53')]){_0x388d35[_0xf943('0x52')]=_['merge'](_0x388d35[_0xf943('0x52')],{'$or':_[_0xf943('0x41')](_0x388d35[_0xf943('0x4b')],function(_0x229b34){var _0xb48e44={};_0xb48e44[_0x229b34]={'$like':'%'+_0x1c3d38[_0xf943('0x48')]['filter']+'%'};return _0xb48e44;})});}_0x388d35=_[_0xf943('0x5d')]({},_0x388d35,_0x1c3d38['options']);return _0x29c382[_0xf943('0x88')](_0x388d35);}})[_0xf943('0x22')](function(_0x297651){if(_0x297651){_0x388326=_0x297651[_0xf943('0x4d')];if(!_0x1c3d38['query'][_0xf943('0x4e')]('nolimit')){_0x388d35[_0xf943('0x31')]=qs[_0xf943('0x31')](_0x1c3d38[_0xf943('0x48')]['limit']);_0x388d35[_0xf943('0x2f')]=qs[_0xf943('0x2f')](_0x1c3d38[_0xf943('0x48')][_0xf943('0x2f')]);}return _0x29c382[_0xf943('0x88')](_0x388d35);}})[_0xf943('0x22')](function(_0x1a996a){if(_0x1a996a){return _0x1a996a?{'count':_0x388326,'rows':_0x1a996a}:null;}})[_0xf943('0x22')](respondWithResult(_0x5e6121,null))[_0xf943('0x2b')](handleError(_0x5e6121,null));};function Extension(_0x2fcfbc,_0x32b6b4,_0x27b694,_0x4ea53d){this[_0xf943('0x89')]=_0xf943('0x8a');this[_0xf943('0x8b')]=_0x2fcfbc[_0xf943('0x8c')];this[_0xf943('0x8d')]=_0x4ea53d;this['type']=_0xf943('0x8e');this[_0xf943('0x8f')]='Fax\x20Extension';this[_0xf943('0x69')]=_0x2fcfbc['id'];this[_0xf943('0x87')]=_0x32b6b4;this[_0xf943('0x90')]=_0x27b694;}function createExtensionsReciveFax(_0x4852a5){var _0x278b03=0x1;var _0x4aba83=[];_0x4aba83['push'](new Extension(_0x4852a5,_0x278b03,'',_0xf943('0x91')));_0x278b03+=0x1;_0x4aba83[_0xf943('0x92')](new Extension(_0x4852a5,_0x278b03,_0xf943('0x93'),_0xf943('0x94')));_0x278b03+=0x1;for(var _0x4c47cc in _0x4852a5){if(_0x4852a5[_0xf943('0x4e')](_0x4c47cc)&&(_0x4c47cc==='ecm'||_0x4c47cc===_0xf943('0x8c')||_0x4c47cc===_0xf943('0x95')||_0x4c47cc===_0xf943('0x96')||_0x4c47cc==='headerinfo'||_0x4c47cc===_0xf943('0x97')||_0x4c47cc===_0xf943('0x98')||_0x4c47cc==='modem'||_0x4c47cc==='t38timeout')){_0x4aba83['push'](new Extension(_0x4852a5,_0x278b03,_0xf943('0x99')+_0x4c47cc+')='+_0x4852a5[_0x4c47cc],'Set'));_0x278b03+=0x1;}}_0x4aba83[_0xf943('0x92')](new Extension(_0x4852a5,_0x278b03,'6','Wait'));_0x278b03+=0x1;_0x4aba83[_0xf943('0x92')](new Extension(_0x4852a5,_0x278b03,_0xf943('0x9a'),_0xf943('0x9b')));_0x278b03=0x0;return _0x4aba83;}exports[_0xf943('0x9c')]=function(_0x19ec5b,_0x25277f,_0xb1b04d){var _0x1e5397;return db[_0xf943('0x80')][_0xf943('0x81')](function(_0x12621f){return db['FaxAccount'][_0xf943('0x64')](_0x19ec5b[_0xf943('0x66')],{'transaction':_0x12621f})[_0xf943('0x22')](function(_0x6392d5){_0x1e5397=_0x6392d5[_0xf943('0x39')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x1e5397),{'transaction':_0x12621f});});})[_0xf943('0x22')](function(){return _0x1e5397;})[_0xf943('0x22')](respondWithResult(_0x25277f,null))[_0xf943('0x2b')](handleError(_0x25277f,null));};exports[_0xf943('0x9d')]=function(_0x52851d,_0x37508a,_0x4750d8){var _0x4ff37e;return db[_0xf943('0x80')][_0xf943('0x81')](function(_0x133904){return db[_0xf943('0x42')]['update'](_0x52851d[_0xf943('0x66')],{'where':{'id':_0x52851d['body']['id']},'transaction':_0x133904})[_0xf943('0x22')](function(_0x26028c){return db[_0xf943('0x9e')][_0xf943('0x3c')]({'where':{'FaxAccountId':_0x52851d[_0xf943('0x66')]['id']},'transaction':_0x133904})[_0xf943('0x22')](function(_0x1d3b43){return db['VoiceExtension'][_0xf943('0x86')](createExtensionsReciveFax(_[_0xf943('0x75')](_0x52851d[_0xf943('0x66')],[_0xf943('0x9f'),_0xf943('0x46'),_0xf943('0xa0'),_0xf943('0xa1'),'TrunkId',_0xf943('0xa2')])),{'transaction':_0x133904});});});})[_0xf943('0x22')](function(){return db[_0xf943('0x42')][_0xf943('0xa3')](_0x52851d[_0xf943('0x66')]['id']);})[_0xf943('0x22')](respondWithResult(_0x37508a,null))['catch'](handleError(_0x37508a,null));};exports[_0xf943('0xa4')]=function(_0x41a297,_0x58e9a8,_0xf9750c){var _0x12fe86={'raw':!![],'where':{}};var _0x35f307={};var _0x457b1e={'count':0x0,'rows':[]};return db[_0xf943('0x42')]['findOne']({'where':{'id':_0x41a297[_0xf943('0x5a')]['id']}})['then'](handleEntityNotFound(_0x58e9a8,null))[_0xf943('0x22')](function(_0x2c9960){if(_0x2c9960){_0x35f307['model']=_[_0xf943('0x49')](db[_0xf943('0xa5')][_0xf943('0x43')]);_0x35f307[_0xf943('0x48')]=_['keys'](_0x41a297[_0xf943('0x48')]);_0x35f307[_0xf943('0x4a')]=_[_0xf943('0x4c')](_0x35f307[_0xf943('0x47')],_0x35f307[_0xf943('0x48')]);_0x12fe86[_0xf943('0x4b')]=_[_0xf943('0x4c')](_0x35f307['model'],qs[_0xf943('0x5c')](_0x41a297['query']['fields']));_0x12fe86['attributes']=_0x12fe86['attributes'][_0xf943('0x4d')]?_0x12fe86[_0xf943('0x4b')]:_0x35f307[_0xf943('0x47')];if(!_0x41a297[_0xf943('0x48')][_0xf943('0x4e')](_0xf943('0x4f'))){_0x12fe86[_0xf943('0x31')]=qs[_0xf943('0x31')](_0x41a297['query']['limit']);_0x12fe86[_0xf943('0x2f')]=qs['offset'](_0x41a297[_0xf943('0x48')][_0xf943('0x2f')]);}_0x12fe86['order']=qs[_0xf943('0x51')](_0x41a297[_0xf943('0x48')][_0xf943('0x51')]);_0x12fe86['where']=qs[_0xf943('0x4a')](_['pick'](_0x41a297[_0xf943('0x48')],_0x35f307[_0xf943('0x4a')]));_0x12fe86['where']['FaxAccountId']=_0x2c9960['id'];if(_0x41a297['query'][_0xf943('0x53')]){_0x12fe86[_0xf943('0x52')]=_[_0xf943('0x5d')](_0x12fe86[_0xf943('0x52')],{'$or':_[_0xf943('0x41')](_0x12fe86[_0xf943('0x4b')],function(_0x19c518){var _0x37b4af={};_0x37b4af[_0x19c518]={'$like':'%'+_0x41a297['query'][_0xf943('0x53')]+'%'};return _0x37b4af;})});}if(_0x41a297[_0xf943('0x48')]['$gte']){var _0x3e14d7=_0x41a297[_0xf943('0x48')]['$gte'][_0xf943('0xa6')](',');var _0x1963e7={};_0x1963e7[_0x3e14d7[0x0]]={'$gte':moment(_0x3e14d7[0x1])[_0xf943('0xa7')](_0xf943('0xa8'))};_0x12fe86['where']=_[_0xf943('0x5d')](_0x12fe86[_0xf943('0x52')],_0x1963e7);}_0x12fe86=_[_0xf943('0x5d')]({},_0x12fe86,_0x41a297[_0xf943('0x55')]);return db[_0xf943('0xa5')][_0xf943('0x32')]({'where':_0x12fe86[_0xf943('0x52')]})[_0xf943('0x22')](function(_0x14414e){_0x457b1e[_0xf943('0x32')]=_0x14414e;if(_0x41a297['query'][_0xf943('0x56')]){_0x12fe86[_0xf943('0x57')]=[{'all':!![]}];}return db[_0xf943('0xa5')][_0xf943('0x58')](_0x12fe86);})[_0xf943('0x22')](function(_0x50a754){_0x457b1e[_0xf943('0x6e')]=_0x50a754;return _0x457b1e;});}})[_0xf943('0x22')](respondWithFilteredResult(_0x58e9a8,_0x12fe86))[_0xf943('0x2b')](handleError(_0x58e9a8,null));};exports[_0xf943('0xa9')]=function(_0x3ff8b7,_0x3a8e9b,_0x3142d6){var _0x1c4822,_0x46bd9d={},_0x2eee04;if(_0x3ff8b7[_0xf943('0x66')]['to']){_0x2eee04=_0x3ff8b7['body']['to'][0x0];}return db['FaxAccount'][_0xf943('0x61')]({'where':{'id':_0x3ff8b7['params']['id']},'include':[{'model':db[_0xf943('0xaa')],'as':_0xf943('0xab'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x2eee04},'limit':0x1,'order':[['updatedAt',_0xf943('0xac')]]}]}]})[_0xf943('0x22')](handleEntityNotFound(_0x3a8e9b,null))['then'](function(_0x241bcb){_0x1c4822=_0x241bcb;if(_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')]&&_0x3ff8b7[_0xf943('0x66')]['attachments'][_0xf943('0x4d')]){for(var _0x551d0e=0x0;_0x551d0e<_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')]['length'];_0x551d0e+=0x1){_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')][_0x551d0e]={'filename':_0x3ff8b7['body'][_0xf943('0xad')][_0x551d0e]['name'],'id':_0x3ff8b7['body'][_0xf943('0xad')][_0x551d0e]['id'],'path':path[_0xf943('0xae')](config[_0xf943('0xaf')],_0xf943('0xb0'),_0x3ff8b7[_0xf943('0x66')]['attachments'][_0x551d0e][_0xf943('0xb1')])};}}return respondWithRpcPromise(_0xf943('0xb2'),_0xf943('0xb2'),{'FaxAccountId':_[_0xf943('0xb3')](_0x3ff8b7[_0xf943('0x5a')]['id'])?undefined:_0x3ff8b7['params']['id'],'path':_[_0xf943('0xb3')](_0x3ff8b7['body'][_0xf943('0xad')][0x0][_0xf943('0x7')])?undefined:_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')][0x0]['path'],'fax':_[_0xf943('0xb3')](_0x3ff8b7[_0xf943('0x66')]['to'][0x0])?undefined:_0x3ff8b7[_0xf943('0x66')]['to'][0x0]},client9002);})[_0xf943('0x22')](function(){if(_0x1c4822){if(_[_0xf943('0xb3')](_0x3ff8b7['body'][_0xf943('0xb4')])){_0x3ff8b7[_0xf943('0x66')]['from']=util[_0xf943('0xa7')](_0xf943('0xb5'),_0x1c4822['name'],_0x1c4822[_0xf943('0xb6')]);}if(_0x1c4822[_0xf943('0xab')]){if(_0x1c4822['List'][_0xf943('0xb7')][_0xf943('0x4d')]){return _0x1c4822['List'][_0xf943('0xb7')][0x0];}else{return db[_0xf943('0xb8')]['create'](_['defaults'](_0x3ff8b7[_0xf943('0x66')],{'firstName':_0x3ff8b7[_0xf943('0x66')]['to'][0x0],'phone':_0x3ff8b7[_0xf943('0x66')]['to'][0x0],'fax':_0x3ff8b7['body']['to'][0x0],'ListId':_0x1c4822[_0xf943('0xa2')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xf943('0xb9'));}})[_0xf943('0x22')](function(_0x5da753){if(_0x5da753){return db[_0xf943('0x74')]['find']({'where':{'ContactId':_0x5da753['id'],'closed':![],'FaxAccountId':_0x1c4822['id']}})['then'](function(_0x43d297){if(_0x43d297){return[_0x43d297,![]];}return db[_0xf943('0x74')][_0xf943('0x64')]({'UserId':_0x3ff8b7[_0xf943('0x5e')]['id'],'ContactId':_0x5da753['id'],'FaxAccountId':_0x1c4822['id'],'fax':_0x3ff8b7[_0xf943('0x66')]['to'][0x0],'firstMsgDirection':_0xf943('0xba'),'Messages':[_[_0xf943('0x5d')](_0x3ff8b7[_0xf943('0x66')],{'read':![],'body':_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')][0x0][_0xf943('0xbb')],'FaxAccountId':_0x1c4822['id'],'UserId':_0x3ff8b7[_0xf943('0x5e')]['id'],'ContactId':_0x5da753['id'],'AttachmentId':_0x3ff8b7['body'][_0xf943('0xad')][0x0]['id']})]},{'include':[{'model':db[_0xf943('0xa5')],'as':'Messages'}]})[_0xf943('0x22')](function(_0x1692ef){return[_0x1692ef,!![]];});});}else{throw new Error(_0xf943('0xbc'));}})[_0xf943('0xbd')](function(_0x2664db,_0x574386){if(_0x574386){return _0x2664db;}return db[_0xf943('0xa5')][_0xf943('0x64')]({'direction':_0xf943('0xba'),'read':![],'body':_0x3ff8b7[_0xf943('0x66')]['attachments'][0x0][_0xf943('0xbb')],'FaxAccountId':_0x1c4822['id'],'FaxInteractionId':_0x2664db['id'],'UserId':_0x3ff8b7[_0xf943('0x5e')]['id'],'ContactId':_0x2664db[_0xf943('0xbe')],'AttachmentId':_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')][0x0]['id']})[_0xf943('0x22')](function(_0x7402dd){_0x2664db[_0xf943('0xbf')]['Messages']=[];_0x2664db[_0xf943('0xbf')][_0xf943('0xc0')]['push'](_0x7402dd['dataValues']);return _0x2664db;});})[_0xf943('0x22')](function(_0x48b707){respondWithRpcPromise(_0xf943('0xc1'),_0xf943('0xc1'),{'FaxAccountId':_[_0xf943('0xb3')](_0x3ff8b7[_0xf943('0x5a')]['id'])?undefined:_0x3ff8b7[_0xf943('0x5a')]['id'],'path':_[_0xf943('0xb3')](_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')][0x0]['path'])?undefined:_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')][0x0][_0xf943('0x7')],'fax':_[_0xf943('0xb3')](_0x3ff8b7[_0xf943('0x66')]['to'][0x0])?undefined:_0x3ff8b7['body']['to'][0x0],'AttachmentId':_0x3ff8b7[_0xf943('0x66')][_0xf943('0xad')][0x0]['id']},client9002)['then'](function(_0x267f16){logger['info'](_0xf943('0xc2'),_0x267f16);})[_0xf943('0x2b')](function(_0x46de8d){logger['info'](_0xf943('0xc2'),_0x46de8d);});return _0x48b707;})[_0xf943('0x22')](respondWithResult(_0x3a8e9b,null))[_0xf943('0x2b')](handleError(_0x3a8e9b,null));};exports[_0xf943('0xc3')]=function(_0xfa548a,_0x88025a,_0xcebcb2){return db[_0xf943('0x42')][_0xf943('0x61')]({'where':{'id':_0xfa548a[_0xf943('0x5a')]['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x88025a,null))[_0xf943('0x22')](function(_0x2c3a81){if(_0x2c3a81){return _0x2c3a81[_0xf943('0xc3')](_0xfa548a[_0xf943('0x66')][_0xf943('0x70')],_[_0xf943('0x75')](_0xfa548a['body'],[_0xf943('0x70'),'id'])||{})[_0xf943('0xbd')](function(_0x5d8283){for(var _0x1bc3bd=0x0;_0x1bc3bd<_0xfa548a[_0xf943('0x66')][_0xf943('0x70')][_0xf943('0x4d')];_0x1bc3bd+=0x1){socket[_0xf943('0xc4')](_0xf943('0xc5'),{'UserId':Number(_0xfa548a[_0xf943('0x66')][_0xf943('0x70')][_0x1bc3bd]),'FaxAccountId':Number(_0xfa548a[_0xf943('0x5a')]['id'])});}return _0x5d8283;});}})['then'](respondWithResult(_0x88025a,null))[_0xf943('0x2b')](handleError(_0x88025a,null));};exports[_0xf943('0xc6')]=function(_0x4760d3,_0x36313f,_0x43e88e){return db[_0xf943('0x42')][_0xf943('0x61')]({'where':{'id':_0x4760d3['params']['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x36313f,null))[_0xf943('0x22')](function(_0x31765f){if(_0x31765f){return _0x31765f['removeAgents'](_0x4760d3[_0xf943('0x48')][_0xf943('0x70')])[_0xf943('0x22')](function(){if(_[_0xf943('0xc7')](_0x4760d3['query'][_0xf943('0x70')])){for(var _0x87ce9b=0x0;_0x87ce9b<_0x4760d3[_0xf943('0x48')]['ids']['length'];_0x87ce9b+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x4760d3[_0xf943('0x48')][_0xf943('0x70')][_0x87ce9b]),'FaxAccountId':Number(_0x4760d3['params']['id'])});}}else{socket[_0xf943('0xc4')](_0xf943('0xc8'),{'UserId':Number(_0x4760d3[_0xf943('0x48')][_0xf943('0x70')]),'FaxAccountId':Number(_0x4760d3['params']['id'])});}});}})['then'](respondWithStatusCode(_0x36313f,null))['catch'](handleError(_0x36313f,null));};exports[_0xf943('0xc9')]=function(_0x201a88,_0x2c3eef,_0x1f253f){var _0x5b7076={};var _0x2e0196={};var _0x186322;var _0x2beb06;return db[_0xf943('0x42')][_0xf943('0x6c')]({'where':{'id':_0x201a88['params']['id']}})[_0xf943('0x22')](handleEntityNotFound(_0x2c3eef,null))[_0xf943('0x22')](function(_0x3b04ea){if(_0x3b04ea){_0x186322=_0x3b04ea;_0x2e0196['model']=_[_0xf943('0x49')](db[_0xf943('0x78')][_0xf943('0x43')]);_0x2e0196[_0xf943('0x48')]=_[_0xf943('0x49')](_0x201a88[_0xf943('0x48')]);_0x2e0196[_0xf943('0x4a')]=_['intersection'](_0x2e0196['model'],_0x2e0196[_0xf943('0x48')]);_0x5b7076['attributes']=_[_0xf943('0x4c')](_0x2e0196[_0xf943('0x47')],qs[_0xf943('0x5c')](_0x201a88[_0xf943('0x48')]['fields']));_0x5b7076[_0xf943('0x4b')]=_0x5b7076[_0xf943('0x4b')][_0xf943('0x4d')]?_0x5b7076[_0xf943('0x4b')]:_0x2e0196['model'];_0x5b7076[_0xf943('0x50')]=qs['sort'](_0x201a88[_0xf943('0x48')]['sort']);_0x5b7076[_0xf943('0x52')]=qs[_0xf943('0x4a')](_[_0xf943('0x6d')](_0x201a88[_0xf943('0x48')],_0x2e0196[_0xf943('0x4a')]));if(_0x201a88[_0xf943('0x48')][_0xf943('0x53')]){_0x5b7076[_0xf943('0x52')]=_['merge'](_0x5b7076[_0xf943('0x52')],{'$or':_[_0xf943('0x41')](_0x5b7076[_0xf943('0x4b')],function(_0x4236f6){var _0x127d75={};_0x127d75[_0x4236f6]={'$like':'%'+_0x201a88[_0xf943('0x48')][_0xf943('0x53')]+'%'};return _0x127d75;})});}_0x5b7076=_[_0xf943('0x5d')]({},_0x5b7076,_0x201a88['options']);return _0x186322[_0xf943('0xc9')](_0x5b7076);}})[_0xf943('0x22')](function(_0x15396d){if(_0x15396d){_0x2beb06=_0x15396d[_0xf943('0x4d')];if(!_0x201a88['query']['hasOwnProperty'](_0xf943('0x4f'))){_0x5b7076[_0xf943('0x31')]=qs[_0xf943('0x31')](_0x201a88[_0xf943('0x48')][_0xf943('0x31')]);_0x5b7076[_0xf943('0x2f')]=qs[_0xf943('0x2f')](_0x201a88[_0xf943('0x48')]['offset']);}return _0x186322[_0xf943('0xc9')](_0x5b7076);}})['then'](function(_0x3a336b){if(_0x3a336b){return _0x3a336b?{'count':_0x2beb06,'rows':_0x3a336b}:null;}})['then'](respondWithResult(_0x2c3eef,null))[_0xf943('0x2b')](handleError(_0x2c3eef,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 67ba962..ea39b14 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 _0x2bd1=['exports','events','../../mysqldb','setMaxListeners','save','emit','hook'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0x2bd1,0x143));var _0x12bd=function(_0x402df3,_0x204128){_0x402df3=_0x402df3-0x0;var _0x35edcc=_0x2bd1[_0x402df3];return _0x35edcc;};'use strict';var EventEmitter=require(_0x12bd('0x0'));var FaxAccount=require(_0x12bd('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x12bd('0x2')](0x0);var events={'afterCreate':_0x12bd('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4f7899){return function(_0x17d6b8,_0x35f648,_0x86091e){FaxAccountEvents[_0x12bd('0x4')](_0x4f7899+':'+_0x17d6b8['id'],_0x17d6b8);FaxAccountEvents[_0x12bd('0x4')](_0x4f7899,_0x17d6b8);_0x86091e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x12bd('0x5')](e,emitEvent(event));}}module[_0x12bd('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0x82d6=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xc0a3d0,_0x2eb826){var _0x1c6710=function(_0x426d8a){while(--_0x426d8a){_0xc0a3d0['push'](_0xc0a3d0['shift']());}};_0x1c6710(++_0x2eb826);}(_0x82d6,0x9e));var _0x682d=function(_0x119dbc,_0x4b3654){_0x119dbc=_0x119dbc-0x0;var _0x47df85=_0x82d6[_0x119dbc];return _0x47df85;};'use strict';var EventEmitter=require(_0x682d('0x0'));var FaxAccount=require(_0x682d('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x682d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x682d('0x3')};function emitEvent(_0x385360){return function(_0x311d33,_0x258448,_0xd61910){FaxAccountEvents[_0x682d('0x4')](_0x385360+':'+_0x311d33['id'],_0x311d33);FaxAccountEvents[_0x682d('0x4')](_0x385360,_0x311d33);_0xd61910(null);};}for(var e in events){if(events[_0x682d('0x5')](e)){var event=events[e];FaxAccount[_0x682d('0x6')](e,emitEvent(event));}}module[_0x682d('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 22bad1e..bbe8868 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 _0xe8f0=['bluebird','path','rimraf','../../config/environment','./faxAccount.attributes','define','fax_accounts','lodash','util','../../config/logger'];(function(_0x59f569,_0x2158dc){var _0x4f54db=function(_0x5879f0){while(--_0x5879f0){_0x59f569['push'](_0x59f569['shift']());}};_0x4f54db(++_0x2158dc);}(_0xe8f0,0x179));var _0x0e8f=function(_0x4c7736,_0x126d06){_0x4c7736=_0x4c7736-0x0;var _0x38cabe=_0xe8f0[_0x4c7736];return _0x38cabe;};'use strict';var _=require(_0x0e8f('0x0'));var util=require(_0x0e8f('0x1'));var logger=require(_0x0e8f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0e8f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e8f('0x4'));var rimraf=require(_0x0e8f('0x5'));var config=require(_0x0e8f('0x6'));var attributes=require(_0x0e8f('0x7'));module['exports']=function(_0x384af6,_0x39c590){return _0x384af6[_0x0e8f('0x8')]('FaxAccount',attributes,{'tableName':_0x0e8f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba97=['moment','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api'];(function(_0x52c363,_0x1efeca){var _0x59fd6a=function(_0x2af4bf){while(--_0x2af4bf){_0x52c363['push'](_0x52c363['shift']());}};_0x59fd6a(++_0x1efeca);}(_0xba97,0x1f4));var _0x7ba9=function(_0x2230fa,_0x3f73a5){_0x2230fa=_0x2230fa-0x0;var _0x361a67=_0xba97[_0x2230fa];return _0x361a67;};'use strict';var _=require(_0x7ba9('0x0'));var util=require(_0x7ba9('0x1'));var logger=require(_0x7ba9('0x2'))(_0x7ba9('0x3'));var moment=require(_0x7ba9('0x4'));var BPromise=require('bluebird');var rp=require(_0x7ba9('0x5'));var fs=require('fs');var path=require(_0x7ba9('0x6'));var rimraf=require(_0x7ba9('0x7'));var config=require(_0x7ba9('0x8'));var attributes=require(_0x7ba9('0x9'));module[_0x7ba9('0xa')]=function(_0x2f6c41,_0x2fcd35){return _0x2f6c41[_0x7ba9('0xb')](_0x7ba9('0xc'),attributes,{'tableName':_0x7ba9('0xd'),'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 2564d35..79b7fec 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 _0xbcdc=['./faxAccount.socket','register','request','then','info','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','raw','options','where','attributes','limit','include','model','map','debug','NotifyFaxAccount','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','body','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','Contacts','DESC','Applications','get','account','applications','list','orderBy','priority','asc','length','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','queueId','queue','waitForTheAssignedQueue','Start','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2f5aca,_0x49c809){var _0xf7b3d7=function(_0x3ef5de){while(--_0x3ef5de){_0x2f5aca['push'](_0x2f5aca['shift']());}};_0xf7b3d7(++_0x49c809);}(_0xbcdc,0xaa));var _0xcbcd=function(_0x3f541a,_0x315b8c){_0x3f541a=_0x3f541a-0x0;var _0xefb673=_0xbcdc[_0x3f541a];return _0xefb673;};'use strict';var _=require('lodash');var util=require(_0xcbcd('0x0'));var moment=require(_0xcbcd('0x1'));var BPromise=require(_0xcbcd('0x2'));var rs=require(_0xcbcd('0x3'));var fs=require('fs');var Redis=require(_0xcbcd('0x4'));var db=require(_0xcbcd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbcd('0x6'))(_0xcbcd('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbcd('0x8'));var client=jayson[_0xcbcd('0x9')][_0xcbcd('0xa')]({'port':0x232c});config[_0xcbcd('0xb')]=_[_0xcbcd('0xc')](config[_0xcbcd('0xb')],{'host':_0xcbcd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcbcd('0xe'))[_0xcbcd('0xf')](socket);function respondWithRpcPromise(_0x27abdc,_0xb17385,_0x22127d){return new BPromise(function(_0x546b80,_0x16e3ed){return client[_0xcbcd('0x10')](_0x27abdc,_0x22127d)[_0xcbcd('0x11')](function(_0x2d9b93){logger[_0xcbcd('0x12')]('FaxAccount,\x20%s,\x20%s',_0xb17385,_0xcbcd('0x13'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0xb17385,_0xcbcd('0x13'),JSON[_0xcbcd('0x14')](_0x2d9b93));if(_0x2d9b93[_0xcbcd('0x15')]){if(_0x2d9b93['error'][_0xcbcd('0x16')]===0x1f4){logger[_0xcbcd('0x15')](_0xcbcd('0x17'),_0xb17385,_0x2d9b93[_0xcbcd('0x15')][_0xcbcd('0x18')]);return _0x16e3ed(_0x2d9b93['error']['message']);}logger[_0xcbcd('0x15')](_0xcbcd('0x17'),_0xb17385,_0x2d9b93[_0xcbcd('0x15')]['message']);return _0x546b80(_0x2d9b93['error'][_0xcbcd('0x18')]);}else{logger[_0xcbcd('0x12')]('FaxAccount,\x20%s,\x20%s',_0xb17385,_0xcbcd('0x13'));_0x546b80(_0x2d9b93[_0xcbcd('0x19')][_0xcbcd('0x18')]);}})[_0xcbcd('0x1a')](function(_0x280ed6){logger[_0xcbcd('0x15')]('FaxAccount,\x20%s,\x20%s',_0xb17385,_0x280ed6);_0x16e3ed(_0x280ed6);});});}exports[_0xcbcd('0x1b')]=function(_0x350e72){var _0x301271=this;return new Promise(function(_0x471f77,_0x37c52c){return db[_0xcbcd('0x1c')][_0xcbcd('0x1d')]({'raw':_0x350e72['options']?_0x350e72['options'][_0xcbcd('0x1e')]===undefined?!![]:![]:!![],'where':_0x350e72[_0xcbcd('0x1f')]?_0x350e72[_0xcbcd('0x1f')][_0xcbcd('0x20')]||null:null,'attributes':_0x350e72['options']?_0x350e72['options'][_0xcbcd('0x21')]||null:null,'limit':_0x350e72[_0xcbcd('0x1f')]?_0x350e72['options'][_0xcbcd('0x22')]||null:null,'include':_0x350e72['options']?_0x350e72['options'][_0xcbcd('0x23')]?_['map'](_0x350e72[_0xcbcd('0x1f')]['include'],function(_0x58e007){return{'model':db[_0x58e007[_0xcbcd('0x24')]],'as':_0x58e007['as'],'attributes':_0x58e007[_0xcbcd('0x21')],'include':_0x58e007[_0xcbcd('0x23')]?_[_0xcbcd('0x25')](_0x58e007['include'],function(_0x3f8a65){return{'model':db[_0x3f8a65[_0xcbcd('0x24')]],'as':_0x3f8a65['as'],'attributes':_0x3f8a65['attributes'],'include':_0x3f8a65[_0xcbcd('0x23')]?_['map'](_0x3f8a65['include'],function(_0x15188d){return{'model':db[_0x15188d[_0xcbcd('0x24')]],'as':_0x15188d['as'],'attributes':_0x15188d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b9ac1){logger['info'](_0xcbcd('0x1b'),_0x350e72);logger[_0xcbcd('0x26')](_0xcbcd('0x1b'),_0x350e72,JSON['stringify'](_0x5b9ac1));_0x471f77(_0x5b9ac1);})[_0xcbcd('0x1a')](function(_0x17319a){logger[_0xcbcd('0x15')](_0xcbcd('0x1b'),_0x17319a[_0xcbcd('0x18')],_0x350e72);_0x37c52c(_0x301271[_0xcbcd('0x15')](0x1f4,_0x17319a['message']));});});};exports[_0xcbcd('0x27')]=function(_0x53c613,_0x27280a,_0x455ad3){var _0x347cb3=this;return new Promise(function(_0x1b8bd7,_0x9d1d55){var _0x3a191a={'body':_0x53c613['body'],'channel':_0xcbcd('0x28')};var _0x4077cc=[];var _0x3ae062=[];var _0x3e2b07={};return db[_0xcbcd('0x29')]['describe']()['then'](function(_0xfcc0d6){if(!_0xfcc0d6){throw new db[(_0xcbcd('0x2a'))][(_0xcbcd('0x2b'))](_0xcbcd('0x2c'));}_0x4077cc=_[_0xcbcd('0x2d')](_[_0xcbcd('0x2e')](_0xfcc0d6),[_0xcbcd('0x2f'),_0xcbcd('0x30')]);_0x3ae062=_[_0xcbcd('0x2d')](_[_0xcbcd('0x2e')](_0xfcc0d6),[_0xcbcd('0x2f'),_0xcbcd('0x30'),_0xcbcd('0x31'),'ListId']);if(_0x53c613[_0xcbcd('0x32')]['id']){delete _0x53c613['body']['id'];}if(_['isNil'](_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x33')])){throw new db['Sequelize']['ValidationError'](_0xcbcd('0x34'));}if(_['isNil'](_0x53c613['body'][_0xcbcd('0x32')])||_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x32')]===''){throw new db[(_0xcbcd('0x2a'))][(_0xcbcd('0x2b'))](_0xcbcd('0x35'));}if(_[_0xcbcd('0x36')](_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x37')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3ae062);}if(!_[_0xcbcd('0x38')](_0x3ae062,_0x53c613[_0xcbcd('0x32')]['mapKey'])){throw new db[(_0xcbcd('0x2a'))][(_0xcbcd('0x2b'))](_0xcbcd('0x39')+_0x3ae062);}_0x3e2b07[_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x37')]]=_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x33')];})[_0xcbcd('0x11')](function(){return db[_0xcbcd('0x1c')][_0xcbcd('0x3a')]({'where':{'id':_0x53c613['account']['id']},'include':[{'model':db['CmList'],'as':_0xcbcd('0x3b'),'include':[{'model':db[_0xcbcd('0x29')],'as':_0xcbcd('0x3c'),'where':_0x3e2b07,'limit':0x1,'order':[[_0xcbcd('0x30'),_0xcbcd('0x3d')]]}]},{'model':db['FaxApplication'],'as':_0xcbcd('0x3e')}]});})[_0xcbcd('0x11')](function(_0x168a53){if(_0x168a53&&_0x168a53['List']){var _0x7da3f4=_0x168a53[_0xcbcd('0x3f')]({'plain':!![]});_0x3a191a[_0xcbcd('0x40')]=_0x7da3f4;_0x3a191a[_0xcbcd('0x41')]=_0x7da3f4[_0xcbcd('0x3e')];_0x3a191a[_0xcbcd('0x42')]=_0x7da3f4[_0xcbcd('0x3b')];_0x3a191a[_0xcbcd('0x41')]=_[_0xcbcd('0x43')](_0x3a191a[_0xcbcd('0x41')],[_0xcbcd('0x44')],[_0xcbcd('0x45')]);if(_0x3a191a[_0xcbcd('0x40')]['Applications']){delete _0x3a191a[_0xcbcd('0x40')][_0xcbcd('0x3e')];}if(_0x3a191a[_0xcbcd('0x40')]['List']&&_0x3a191a[_0xcbcd('0x40')][_0xcbcd('0x3b')]['Contacts'][_0xcbcd('0x46')]){return _0x3a191a[_0xcbcd('0x40')][_0xcbcd('0x3b')][_0xcbcd('0x3c')][0x0];}var _0x3f9a66=_[_0xcbcd('0xc')](_0x53c613[_0xcbcd('0x32')],{'firstName':_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x33')],'ListId':_0x7da3f4['ListId']});_0x3f9a66[_0x53c613[_0xcbcd('0x32')]['mapKey']]=_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x33')];return db[_0xcbcd('0x29')][_0xcbcd('0x47')](_0x3f9a66,{'fields':_0x4077cc,'raw':!![]});}})[_0xcbcd('0x11')](function(_0x200c92){_0x3a191a['contact']=_0x200c92;if(_0x200c92){var _0x360766={'ContactId':_0x200c92['id'],'FaxAccountId':_0x53c613[_0xcbcd('0x40')]['id'],'fax':_0x200c92[_0xcbcd('0x28')]};return db[_0xcbcd('0x48')][_0xcbcd('0x3a')]({'where':{'ContactId':_0x200c92['id'],'closed':![],'FaxAccountId':_0x53c613[_0xcbcd('0x40')]['id']}})['then'](function(_0x1c9876){if(_0x1c9876){return[_0x1c9876,![]];}return db[_0xcbcd('0x48')][_0xcbcd('0x47')](_0x360766)[_0xcbcd('0x11')](function(_0x5c361f){return[_0x5c361f,!![]];});});}else{throw new Error(_0xcbcd('0x49'));}})[_0xcbcd('0x4a')](function(_0x22ac16,_0x24833d){var _0x257470=_0x22ac16[_0xcbcd('0x3f')]({'plain':!![]});if(_0x24833d){if(_0x3a191a[_0xcbcd('0x40')][_0xcbcd('0x4b')]){_0x3a191a[_0xcbcd('0x41')][_0xcbcd('0x4c')]({'id':0x0,'priority':_0x3a191a[_0xcbcd('0x41')]['length']+0x1,'app':'close','appdata':_0xcbcd('0x4d'),'interval':_0xcbcd('0x4e')});}_0x257470['created']=!![];}else{_0x257470['created']=![];}_0x3a191a[_0xcbcd('0x4f')]=_0x257470;return db[_0xcbcd('0x50')]['create']({'body':_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x32')],'FaxAccountId':_0x53c613['account']['id'],'FaxInteractionId':_0x22ac16['id'],'direction':'in','ContactId':_0x22ac16[_0xcbcd('0x51')],'AttachmentId':_0x53c613[_0xcbcd('0x32')][_0xcbcd('0x52')]});})[_0xcbcd('0x11')](function(_0x26b099){_0x3a191a['message']=_0x26b099;if(!_0x3a191a[_0xcbcd('0x4f')][_0xcbcd('0x53')])return;return db[_0xcbcd('0x54')][_0xcbcd('0x3a')]({'attributes':['id',_0xcbcd('0x55')],'where':{'id':_0x3a191a['interaction'][_0xcbcd('0x53')]}});})[_0xcbcd('0x11')](function(_0x3f43c6){if(_0x3f43c6){_0x3a191a['applications'][_0xcbcd('0x56')]({'id':0x0,'priority':0x0,'app':_0xcbcd('0x57'),'appdata':_0x3f43c6['name']+','+(_0x3a191a['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x3a191a[_0xcbcd('0x4f')][_0xcbcd('0x58')])return;return db['FaxQueue'][_0xcbcd('0x3a')]({'attributes':['id',_0xcbcd('0x55')],'where':{'id':_0x3a191a[_0xcbcd('0x4f')][_0xcbcd('0x58')]}});})[_0xcbcd('0x11')](function(_0x465b33){if(_0x465b33){_0x3a191a[_0xcbcd('0x41')][_0xcbcd('0x56')]({'id':0x0,'priority':0x1,'app':_0xcbcd('0x59'),'appdata':_0x465b33[_0xcbcd('0x55')]+','+(_0x3a191a[_0xcbcd('0x40')][_0xcbcd('0x5a')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcbcd('0x5b'),'startRouting',_0x3a191a);})[_0xcbcd('0x11')](function(_0xfcbb8d){_0x1b8bd7(_0xfcbb8d);})[_0xcbcd('0x1a')](function(_0x1b4494){_0x9d1d55(_0x347cb3['error'](0x1f4,_0x1b4494['message']));});});}; \ No newline at end of file +var _0x7e5a=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxAccount.socket','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFaxAccount','findAll','options','where','attributes','limit','map','include','model','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','ListId','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','FaxAccount','find','CmList','List','Contacts','FaxApplication','get','account','applications','Applications','orderBy','priority','asc','length','create','contact','FaxInteraction','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','waitForTheAssignedQueue','Start','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4f66f9,_0x2a1ba1){var _0x46b73d=function(_0x25fb51){while(--_0x25fb51){_0x4f66f9['push'](_0x4f66f9['shift']());}};_0x46b73d(++_0x2a1ba1);}(_0x7e5a,0xac));var _0xa7e5=function(_0x12a688,_0x41b876){_0x12a688=_0x12a688-0x0;var _0x286669=_0x7e5a[_0x12a688];return _0x286669;};'use strict';var _=require(_0xa7e5('0x0'));var util=require(_0xa7e5('0x1'));var moment=require(_0xa7e5('0x2'));var BPromise=require(_0xa7e5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7e5('0x4'));var db=require(_0xa7e5('0x5'))['db'];var utils=require(_0xa7e5('0x6'));var logger=require(_0xa7e5('0x7'))(_0xa7e5('0x8'));var config=require(_0xa7e5('0x9'));var jayson=require(_0xa7e5('0xa'));var client=jayson[_0xa7e5('0xb')][_0xa7e5('0xc')]({'port':0x232c});config[_0xa7e5('0xd')]=_[_0xa7e5('0xe')](config[_0xa7e5('0xd')],{'host':_0xa7e5('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa7e5('0xd')]));require(_0xa7e5('0x10'))['register'](socket);function respondWithRpcPromise(_0x487c49,_0x2f7aad,_0xe40492){return new BPromise(function(_0x39083d,_0x581362){return client['request'](_0x487c49,_0xe40492)[_0xa7e5('0x11')](function(_0x1aa1b5){logger[_0xa7e5('0x12')](_0xa7e5('0x13'),_0x2f7aad,_0xa7e5('0x14'));logger[_0xa7e5('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2f7aad,_0xa7e5('0x14'),JSON[_0xa7e5('0x16')](_0x1aa1b5));if(_0x1aa1b5[_0xa7e5('0x17')]){if(_0x1aa1b5[_0xa7e5('0x17')][_0xa7e5('0x18')]===0x1f4){logger['error'](_0xa7e5('0x13'),_0x2f7aad,_0x1aa1b5[_0xa7e5('0x17')][_0xa7e5('0x19')]);return _0x581362(_0x1aa1b5['error'][_0xa7e5('0x19')]);}logger[_0xa7e5('0x17')](_0xa7e5('0x13'),_0x2f7aad,_0x1aa1b5[_0xa7e5('0x17')][_0xa7e5('0x19')]);return _0x39083d(_0x1aa1b5[_0xa7e5('0x17')][_0xa7e5('0x19')]);}else{logger[_0xa7e5('0x12')](_0xa7e5('0x13'),_0x2f7aad,'request\x20sent');_0x39083d(_0x1aa1b5['result'][_0xa7e5('0x19')]);}})[_0xa7e5('0x1a')](function(_0x1ff9ee){logger[_0xa7e5('0x17')](_0xa7e5('0x13'),_0x2f7aad,_0x1ff9ee);_0x581362(_0x1ff9ee);});});}exports[_0xa7e5('0x1b')]=function(_0x28cbdb){var _0x3a45b0=this;return new Promise(function(_0x2059c5,_0x2a59e3){return db['FaxAccount'][_0xa7e5('0x1c')]({'raw':_0x28cbdb[_0xa7e5('0x1d')]?_0x28cbdb['options']['raw']===undefined?!![]:![]:!![],'where':_0x28cbdb[_0xa7e5('0x1d')]?_0x28cbdb[_0xa7e5('0x1d')][_0xa7e5('0x1e')]||null:null,'attributes':_0x28cbdb['options']?_0x28cbdb['options'][_0xa7e5('0x1f')]||null:null,'limit':_0x28cbdb[_0xa7e5('0x1d')]?_0x28cbdb[_0xa7e5('0x1d')][_0xa7e5('0x20')]||null:null,'include':_0x28cbdb['options']?_0x28cbdb[_0xa7e5('0x1d')]['include']?_[_0xa7e5('0x21')](_0x28cbdb[_0xa7e5('0x1d')][_0xa7e5('0x22')],function(_0x29d591){return{'model':db[_0x29d591[_0xa7e5('0x23')]],'as':_0x29d591['as'],'attributes':_0x29d591['attributes'],'include':_0x29d591[_0xa7e5('0x22')]?_['map'](_0x29d591[_0xa7e5('0x22')],function(_0x273dee){return{'model':db[_0x273dee[_0xa7e5('0x23')]],'as':_0x273dee['as'],'attributes':_0x273dee[_0xa7e5('0x1f')],'include':_0x273dee['include']?_[_0xa7e5('0x21')](_0x273dee['include'],function(_0x360cc6){return{'model':db[_0x360cc6[_0xa7e5('0x23')]],'as':_0x360cc6['as'],'attributes':_0x360cc6['attributes']};}):[]};}):[]};}):[]:[]})[_0xa7e5('0x11')](function(_0x3aaa68){logger[_0xa7e5('0x12')](_0xa7e5('0x1b'),_0x28cbdb);logger[_0xa7e5('0x15')](_0xa7e5('0x1b'),_0x28cbdb,JSON[_0xa7e5('0x16')](_0x3aaa68));_0x2059c5(_0x3aaa68);})[_0xa7e5('0x1a')](function(_0xa800e7){logger[_0xa7e5('0x17')](_0xa7e5('0x1b'),_0xa800e7[_0xa7e5('0x19')],_0x28cbdb);_0x2a59e3(_0x3a45b0['error'](0x1f4,_0xa800e7[_0xa7e5('0x19')]));});});};exports[_0xa7e5('0x24')]=function(_0x12dcf0,_0x33f5d3,_0x4929a1){var _0x296ebf=this;return new Promise(function(_0xb82497,_0x336896){var _0x9cfdcd={'body':_0x12dcf0[_0xa7e5('0x25')],'channel':'fax'};var _0x171233=[];var _0x1aa415=[];var _0x19a4f2={};return db[_0xa7e5('0x26')][_0xa7e5('0x27')]()[_0xa7e5('0x11')](function(_0x301036){if(!_0x301036){throw new db[(_0xa7e5('0x28'))][(_0xa7e5('0x29'))](_0xa7e5('0x2a'));}_0x171233=_[_0xa7e5('0x2b')](_[_0xa7e5('0x2c')](_0x301036),['createdAt',_0xa7e5('0x2d')]);_0x1aa415=_['difference'](_['keys'](_0x301036),[_0xa7e5('0x2e'),_0xa7e5('0x2d'),_0xa7e5('0x2f'),_0xa7e5('0x30')]);if(_0x12dcf0['body']['id']){delete _0x12dcf0[_0xa7e5('0x25')]['id'];}if(_['isNil'](_0x12dcf0[_0xa7e5('0x25')]['from'])){throw new db['Sequelize'][(_0xa7e5('0x29'))]('from\x20is\x20mandatory');}if(_[_0xa7e5('0x31')](_0x12dcf0['body'][_0xa7e5('0x25')])||_0x12dcf0['body'][_0xa7e5('0x25')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa7e5('0x31')](_0x12dcf0[_0xa7e5('0x25')][_0xa7e5('0x32')])){throw new db[(_0xa7e5('0x28'))][(_0xa7e5('0x29'))](_0xa7e5('0x33')+_0x1aa415);}if(!_[_0xa7e5('0x34')](_0x1aa415,_0x12dcf0[_0xa7e5('0x25')][_0xa7e5('0x32')])){throw new db['Sequelize'][(_0xa7e5('0x29'))](_0xa7e5('0x35')+_0x1aa415);}_0x19a4f2[_0x12dcf0['body'][_0xa7e5('0x32')]]=_0x12dcf0[_0xa7e5('0x25')][_0xa7e5('0x36')];})[_0xa7e5('0x11')](function(){return db[_0xa7e5('0x37')][_0xa7e5('0x38')]({'where':{'id':_0x12dcf0['account']['id']},'include':[{'model':db[_0xa7e5('0x39')],'as':_0xa7e5('0x3a'),'include':[{'model':db[_0xa7e5('0x26')],'as':_0xa7e5('0x3b'),'where':_0x19a4f2,'limit':0x1,'order':[[_0xa7e5('0x2d'),'DESC']]}]},{'model':db[_0xa7e5('0x3c')],'as':'Applications'}]});})['then'](function(_0x251ca3){if(_0x251ca3&&_0x251ca3[_0xa7e5('0x3a')]){var _0x24ca45=_0x251ca3[_0xa7e5('0x3d')]({'plain':!![]});_0x9cfdcd[_0xa7e5('0x3e')]=_0x24ca45;_0x9cfdcd[_0xa7e5('0x3f')]=_0x24ca45[_0xa7e5('0x40')];_0x9cfdcd['list']=_0x24ca45[_0xa7e5('0x3a')];_0x9cfdcd[_0xa7e5('0x3f')]=_[_0xa7e5('0x41')](_0x9cfdcd['applications'],[_0xa7e5('0x42')],[_0xa7e5('0x43')]);if(_0x9cfdcd[_0xa7e5('0x3e')][_0xa7e5('0x40')]){delete _0x9cfdcd['account'][_0xa7e5('0x40')];}if(_0x9cfdcd[_0xa7e5('0x3e')][_0xa7e5('0x3a')]&&_0x9cfdcd['account'][_0xa7e5('0x3a')][_0xa7e5('0x3b')][_0xa7e5('0x44')]){return _0x9cfdcd[_0xa7e5('0x3e')]['List'][_0xa7e5('0x3b')][0x0];}var _0x4425ec=_[_0xa7e5('0xe')](_0x12dcf0[_0xa7e5('0x25')],{'firstName':_0x12dcf0[_0xa7e5('0x25')][_0xa7e5('0x36')],'ListId':_0x24ca45['ListId']});_0x4425ec[_0x12dcf0['body'][_0xa7e5('0x32')]]=_0x12dcf0[_0xa7e5('0x25')][_0xa7e5('0x36')];return db[_0xa7e5('0x26')][_0xa7e5('0x45')](_0x4425ec,{'fields':_0x171233,'raw':!![]});}})[_0xa7e5('0x11')](function(_0x20c765){_0x9cfdcd[_0xa7e5('0x46')]=_0x20c765;if(_0x20c765){var _0x2c9913={'ContactId':_0x20c765['id'],'FaxAccountId':_0x12dcf0[_0xa7e5('0x3e')]['id'],'fax':_0x20c765['fax']};return db[_0xa7e5('0x47')][_0xa7e5('0x38')]({'where':{'ContactId':_0x20c765['id'],'closed':![],'FaxAccountId':_0x12dcf0[_0xa7e5('0x3e')]['id']}})[_0xa7e5('0x11')](function(_0x29e488){if(_0x29e488){return[_0x29e488,![]];}return db[_0xa7e5('0x47')][_0xa7e5('0x45')](_0x2c9913)[_0xa7e5('0x11')](function(_0x4149bd){return[_0x4149bd,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xa7e5('0x48')](function(_0x1d9363,_0x367369){var _0x525678=_0x1d9363[_0xa7e5('0x3d')]({'plain':!![]});if(_0x367369){if(_0x9cfdcd['account'][_0xa7e5('0x49')]){_0x9cfdcd[_0xa7e5('0x3f')]['push']({'id':0x0,'priority':_0x9cfdcd['applications'][_0xa7e5('0x44')]+0x1,'app':_0xa7e5('0x4a'),'appdata':_0xa7e5('0x4b'),'interval':_0xa7e5('0x4c')});}_0x525678['created']=!![];}else{_0x525678[_0xa7e5('0x4d')]=![];}_0x9cfdcd[_0xa7e5('0x4e')]=_0x525678;return db[_0xa7e5('0x4f')][_0xa7e5('0x45')]({'body':_0x12dcf0[_0xa7e5('0x25')][_0xa7e5('0x25')],'FaxAccountId':_0x12dcf0[_0xa7e5('0x3e')]['id'],'FaxInteractionId':_0x1d9363['id'],'direction':'in','ContactId':_0x1d9363['ContactId'],'AttachmentId':_0x12dcf0['body'][_0xa7e5('0x50')]});})['then'](function(_0x544c5f){_0x9cfdcd[_0xa7e5('0x19')]=_0x544c5f;if(!_0x9cfdcd[_0xa7e5('0x4e')][_0xa7e5('0x51')])return;return db[_0xa7e5('0x52')][_0xa7e5('0x38')]({'attributes':['id',_0xa7e5('0x53')],'where':{'id':_0x9cfdcd[_0xa7e5('0x4e')][_0xa7e5('0x51')]}});})[_0xa7e5('0x11')](function(_0x3ee9fb){if(_0x3ee9fb){_0x9cfdcd[_0xa7e5('0x3f')][_0xa7e5('0x54')]({'id':0x0,'priority':0x0,'app':_0xa7e5('0x55'),'appdata':_0x3ee9fb['name']+','+(_0x9cfdcd[_0xa7e5('0x3e')][_0xa7e5('0x56')]||0xa),'interval':'*,*,*,*'});}if(!_0x9cfdcd[_0xa7e5('0x4e')][_0xa7e5('0x57')])return;return db['FaxQueue']['find']({'attributes':['id',_0xa7e5('0x53')],'where':{'id':_0x9cfdcd[_0xa7e5('0x4e')][_0xa7e5('0x57')]}});})[_0xa7e5('0x11')](function(_0x1decbf){if(_0x1decbf){_0x9cfdcd[_0xa7e5('0x3f')][_0xa7e5('0x54')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1decbf[_0xa7e5('0x53')]+','+(_0x9cfdcd[_0xa7e5('0x3e')][_0xa7e5('0x58')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa7e5('0x59'),'startRouting',_0x9cfdcd);})[_0xa7e5('0x11')](function(_0x1d080c){_0xb82497(_0x1d080c);})[_0xa7e5('0x1a')](function(_0x4f29d7){_0x336896(_0x296ebf[_0xa7e5('0x17')](0x1f4,_0x4f29d7[_0xa7e5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index b13954f..1052046 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 _0xee77=['faxAccount:','save','update','register'];(function(_0x2564ba,_0x493d30){var _0x138cd0=function(_0x167841){while(--_0x167841){_0x2564ba['push'](_0x2564ba['shift']());}};_0x138cd0(++_0x493d30);}(_0xee77,0xf5));var _0x7ee7=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xee77[_0x47e7cb];return _0x2a8874;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x7ee7('0x0'),'remove',_0x7ee7('0x1')];function createListener(_0x196e6f,_0x4e3c6d){return function(_0x1c2941){_0x4e3c6d['emit'](_0x196e6f,_0x1c2941);};}function removeListener(_0x51f9d9,_0x141eb3){return function(){FaxAccountEvents['removeListener'](_0x51f9d9,_0x141eb3);};}exports[_0x7ee7('0x2')]=function(_0x36ec10){for(var _0xe80e8d=0x0,_0x4c08d1=events['length'];_0xe80e8d<_0x4c08d1;_0xe80e8d++){var _0x10b7d2=events[_0xe80e8d];var _0x258157=createListener(_0x7ee7('0x3')+_0x10b7d2,_0x36ec10);FaxAccountEvents['on'](_0x10b7d2,_0x258157);}}; \ No newline at end of file +var _0xe5f2=['removeListener','register','./faxAccount.events','save','remove','update','emit'];(function(_0x477bcf,_0x36dbe0){var _0x21f54b=function(_0x51b109){while(--_0x51b109){_0x477bcf['push'](_0x477bcf['shift']());}};_0x21f54b(++_0x36dbe0);}(_0xe5f2,0x12f));var _0x2e5f=function(_0x33d3b1,_0x399036){_0x33d3b1=_0x33d3b1-0x0;var _0x433c6f=_0xe5f2[_0x33d3b1];return _0x433c6f;};'use strict';var FaxAccountEvents=require(_0x2e5f('0x0'));var events=[_0x2e5f('0x1'),_0x2e5f('0x2'),_0x2e5f('0x3')];function createListener(_0x5837d3,_0x486c00){return function(_0x2c21e7){_0x486c00[_0x2e5f('0x4')](_0x5837d3,_0x2c21e7);};}function removeListener(_0x1496d2,_0x96be2f){return function(){FaxAccountEvents[_0x2e5f('0x5')](_0x1496d2,_0x96be2f);};}exports[_0x2e5f('0x6')]=function(_0x5ed401){for(var _0x1bf637=0x0,_0x159d5f=events['length'];_0x1bf637<_0x159d5f;_0x1bf637++){var _0x1f29b0=events[_0x1bf637];var _0x36f25e=createListener('faxAccount:'+_0x1f29b0,_0x5ed401);FaxAccountEvents['on'](_0x1f29b0,_0x36f25e);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index f514a4a..4023800 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 _0xa0fc=['update','delete','destroy','removeAnswers','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','/describe','isAuthenticated','describe','get','/:id','show','/:id/dispositions','getDispositions','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put'];(function(_0x768eb6,_0x4b216a){var _0xb8f02=function(_0x438353){while(--_0x438353){_0x768eb6['push'](_0x768eb6['shift']());}};_0xb8f02(++_0x4b216a);}(_0xa0fc,0xb1));var _0xca0f=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa0fc[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0xca0f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xca0f('0x1'));var express=require(_0xca0f('0x2'));var router=express[_0xca0f('0x3')]();var fs_extra=require(_0xca0f('0x4'));var auth=require(_0xca0f('0x5'));var interaction=require(_0xca0f('0x6'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xca0f('0x7')]);router['get'](_0xca0f('0x8'),auth[_0xca0f('0x9')](),controller[_0xca0f('0xa')]);router[_0xca0f('0xb')](_0xca0f('0xc'),auth['isAuthenticated'](),controller[_0xca0f('0xd')]);router[_0xca0f('0xb')](_0xca0f('0xe'),auth[_0xca0f('0x9')](),controller[_0xca0f('0xf')]);router[_0xca0f('0xb')]('/:id/canned_answers',auth[_0xca0f('0x9')](),controller['getAnswers']);router[_0xca0f('0xb')](_0xca0f('0x10'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x11')]);router[_0xca0f('0xb')](_0xca0f('0x12'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x13')]);router[_0xca0f('0xb')](_0xca0f('0x14'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x15')]);router['get'](_0xca0f('0x16'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x17')]);router[_0xca0f('0x18')]('/',auth[_0xca0f('0x9')](),controller[_0xca0f('0x19')]);router[_0xca0f('0x18')](_0xca0f('0xe'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x1a')]);router[_0xca0f('0x18')](_0xca0f('0x1b'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x1c')]);router[_0xca0f('0x18')](_0xca0f('0x10'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x1d')]);router[_0xca0f('0x18')](_0xca0f('0x12'),auth['isAuthenticated'](),controller[_0xca0f('0x1e')]);router['post'](_0xca0f('0x1f'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x20')]);router[_0xca0f('0x18')](_0xca0f('0x21'),auth[_0xca0f('0x9')](),controller['updateAccountApplications']);router[_0xca0f('0x18')](_0xca0f('0x22'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x23')]);router['post'](_0xca0f('0x16'),auth['isAuthenticated'](),controller[_0xca0f('0x24')]);router[_0xca0f('0x25')](_0xca0f('0xc'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x26')]);router[_0xca0f('0x27')](_0xca0f('0xc'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x28')]);router[_0xca0f('0x27')](_0xca0f('0xe'),auth[_0xca0f('0x9')](),controller['removeDispositions']);router[_0xca0f('0x27')](_0xca0f('0x1b'),auth[_0xca0f('0x9')](),controller[_0xca0f('0x29')]);router['delete'](_0xca0f('0x16'),auth[_0xca0f('0x9')](),controller['removeAgents']);module[_0xca0f('0x2a')]=router; \ No newline at end of file +var _0xe7d0=['/:id/interactions','/:id/applications','/:id/messages','/:id/users','getAgents','post','create','addApplications','/addaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','/:id','destroy','removeAnswers','removeAgents','exports','util','path','express','Router','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x5015c6,_0x402a93){var _0x34d689=function(_0x162e6d){while(--_0x162e6d){_0x5015c6['push'](_0x5015c6['shift']());}};_0x34d689(++_0x402a93);}(_0xe7d0,0x118));var _0x0e7d=function(_0x5817f8,_0x27c8d3){_0x5817f8=_0x5817f8-0x0;var _0x253f18=_0xe7d0[_0x5817f8];return _0x253f18;};'use strict';var multer=require('multer');var util=require(_0x0e7d('0x0'));var path=require(_0x0e7d('0x1'));var timeout=require('connect-timeout');var express=require(_0x0e7d('0x2'));var router=express[_0x0e7d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0e7d('0x4'));var controller=require(_0x0e7d('0x5'));router[_0x0e7d('0x6')]('/',auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x8')]);router['get'](_0x0e7d('0x9'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0xa')]);router[_0x0e7d('0x6')]('/:id',auth[_0x0e7d('0x7')](),controller[_0x0e7d('0xb')]);router[_0x0e7d('0x6')](_0x0e7d('0xc'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0xd')]);router[_0x0e7d('0x6')](_0x0e7d('0xe'),auth['isAuthenticated'](),controller[_0x0e7d('0xf')]);router['get'](_0x0e7d('0x10'),auth[_0x0e7d('0x7')](),controller['getInteractions']);router[_0x0e7d('0x6')](_0x0e7d('0x11'),auth[_0x0e7d('0x7')](),controller['getApplications']);router[_0x0e7d('0x6')](_0x0e7d('0x12'),auth[_0x0e7d('0x7')](),controller['getMessages']);router[_0x0e7d('0x6')](_0x0e7d('0x13'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x14')]);router[_0x0e7d('0x15')]('/',auth['isAuthenticated'](),controller[_0x0e7d('0x16')]);router['post'](_0x0e7d('0xc'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x0e7d('0x15')](_0x0e7d('0xe'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0x0e7d('0x10'),auth[_0x0e7d('0x7')](),controller['addInteraction']);router[_0x0e7d('0x15')](_0x0e7d('0x11'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x17')]);router[_0x0e7d('0x15')](_0x0e7d('0x18'),auth[_0x0e7d('0x7')](),controller['addAccountApplications']);router[_0x0e7d('0x15')]('/updateaccountapplications',auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x19')]);router['post'](_0x0e7d('0x1a'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x1b')]);router['post'](_0x0e7d('0x13'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x1c')]);router[_0x0e7d('0x1d')]('/:id',auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x1e')]);router[_0x0e7d('0x1f')](_0x0e7d('0x20'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x21')]);router[_0x0e7d('0x1f')](_0x0e7d('0xc'),auth[_0x0e7d('0x7')](),controller['removeDispositions']);router['delete'](_0x0e7d('0xe'),auth[_0x0e7d('0x7')](),controller[_0x0e7d('0x22')]);router[_0x0e7d('0x1f')](_0x0e7d('0x13'),auth['isAuthenticated'](),controller[_0x0e7d('0x23')]);module[_0x0e7d('0x24')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index b4e0491..f90c70f 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 _0xa2f9=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5d4d30,_0x1b0c09){var _0x2606c4=function(_0x97432d){while(--_0x97432d){_0x5d4d30['push'](_0x5d4d30['shift']());}};_0x2606c4(++_0x1b0c09);}(_0xa2f9,0x195));var _0x9a2f=function(_0x2304ce,_0x5e2bb0){_0x2304ce=_0x2304ce-0x0;var _0x503964=_0xa2f9[_0x2304ce];return _0x503964;};'use strict';var Sequelize=require(_0x9a2f('0x0'));module[_0x9a2f('0x1')]={'priority':{'type':Sequelize[_0x9a2f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9a2f('0x3')],'allowNull':![],'defaultValue':_0x9a2f('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9a2f('0x3')]},'interval':{'type':Sequelize[_0x9a2f('0x3')],'defaultValue':_0x9a2f('0x5')}}; \ No newline at end of file +var _0x36db=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0xf26c80,_0x41e71a){var _0x238f0c=function(_0xe280ac){while(--_0xe280ac){_0xf26c80['push'](_0xf26c80['shift']());}};_0x238f0c(++_0x41e71a);}(_0x36db,0x151));var _0xb36d=function(_0x486be5,_0x443cb9){_0x486be5=_0x486be5-0x0;var _0x5ebcbe=_0x36db[_0x486be5];return _0x5ebcbe;};'use strict';var Sequelize=require(_0xb36d('0x0'));module[_0xb36d('0x1')]={'priority':{'type':Sequelize[_0xb36d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb36d('0x3')],'allowNull':![],'defaultValue':_0xb36d('0x4')},'appdata':{'type':Sequelize[_0xb36d('0x5')]()},'description':{'type':Sequelize[_0xb36d('0x3')]},'interval':{'type':Sequelize[_0xb36d('0x3')],'defaultValue':_0xb36d('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index cb68180..8df47b7 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 _0x98b8=['sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x5a89ea,_0x436388){var _0x21193d=function(_0x1a9118){while(--_0x1a9118){_0x5a89ea['push'](_0x5a89ea['shift']());}};_0x21193d(++_0x436388);}(_0x98b8,0x11a));var _0x898b=function(_0x39ce7f,_0x449ab4){_0x39ce7f=_0x39ce7f-0x0;var _0x22a931=_0x98b8[_0x39ce7f];return _0x22a931;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x898b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x898b('0x1'));var BPromise=require(_0x898b('0x2'));var Mustache=require(_0x898b('0x3'));var util=require(_0x898b('0x4'));var path=require(_0x898b('0x5'));var sox=require(_0x898b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x898b('0x7'));var _=require('lodash');var squel=require(_0x898b('0x8'));var crypto=require('crypto');var jsforce=require(_0x898b('0x9'));var deskjs=require(_0x898b('0xa'));var toCsv=require(_0x898b('0xb'));var querystring=require(_0x898b('0xc'));var Papa=require(_0x898b('0xd'));var Redis=require('ioredis');var authService=require(_0x898b('0xe'));var qs=require(_0x898b('0xf'));var as=require(_0x898b('0x10'));var hardwareService=require(_0x898b('0x11'));var logger=require('../../config/logger')(_0x898b('0x12'));var utils=require(_0x898b('0x13'));var config=require(_0x898b('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a23ed,_0x5f6f49){_0x5f6f49=_0x5f6f49||0xcc;return function(_0x56265a){if(_0x56265a){return _0x1a23ed[_0x898b('0x15')](_0x5f6f49);}return _0x1a23ed[_0x898b('0x16')](_0x5f6f49)['end']();};}function respondWithResult(_0x2d3615,_0x1dea52){_0x1dea52=_0x1dea52||0xc8;return function(_0x1ef095){if(_0x1ef095){return _0x2d3615[_0x898b('0x16')](_0x1dea52)[_0x898b('0x17')](_0x1ef095);}};}function respondWithFilteredResult(_0x4e87f1,_0x10a548){return function(_0x15b749){if(_0x15b749){var _0x3642ae=typeof _0x10a548[_0x898b('0x18')]===_0x898b('0x19')&&typeof _0x10a548[_0x898b('0x1a')]===_0x898b('0x19');var _0x25c867=_0x15b749['count'];var _0x3a8245=_0x3642ae?0x0:_0x10a548[_0x898b('0x18')];var _0x4a50f6=_0x3642ae?_0x15b749[_0x898b('0x1b')]:_0x10a548[_0x898b('0x18')]+_0x10a548[_0x898b('0x1a')];var _0x5724e5;if(_0x4a50f6>=_0x25c867){_0x4a50f6=_0x25c867;_0x5724e5=0xc8;}else{_0x5724e5=0xce;}_0x4e87f1[_0x898b('0x16')](_0x5724e5);return _0x4e87f1['set'](_0x898b('0x1c'),_0x3a8245+'-'+_0x4a50f6+'/'+_0x25c867)[_0x898b('0x17')](_0x15b749);}return null;};}function patchUpdates(_0x1a4a18){return function(_0x51e387){try{jsonpatch[_0x898b('0x1d')](_0x51e387,_0x1a4a18,!![]);}catch(_0x9a13b4){return BPromise[_0x898b('0x1e')](_0x9a13b4);}return _0x51e387[_0x898b('0x1f')]();};}function saveUpdates(_0x52cc7e,_0x4a4569){return function(_0x1e79c6){if(_0x1e79c6){return _0x1e79c6[_0x898b('0x20')](_0x52cc7e)[_0x898b('0x21')](function(_0x24acfc){return _0x24acfc;});}return null;};}function removeEntity(_0x868b90,_0x531895){return function(_0x19541b){if(_0x19541b){return _0x19541b[_0x898b('0x22')]()[_0x898b('0x21')](function(){_0x868b90[_0x898b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe50df0,_0x4e1fb2){return function(_0x32a0fe){if(!_0x32a0fe){_0xe50df0[_0x898b('0x15')](0x194);}return _0x32a0fe;};}function handleError(_0x14b81d,_0xc43509){_0xc43509=_0xc43509||0x1f4;return function(_0x910834){logger[_0x898b('0x23')](_0x910834[_0x898b('0x24')]);if(_0x910834[_0x898b('0x25')]){delete _0x910834[_0x898b('0x25')];}_0x14b81d[_0x898b('0x16')](_0xc43509)[_0x898b('0x26')](_0x910834);};}exports[_0x898b('0x27')]=function(_0x1cc9aa,_0x2ed054){var _0x3b4648={},_0x2a5178={},_0x7a2f6b={'count':0x0,'rows':[]};var _0x9c8aa7=_[_0x898b('0x28')](db[_0x898b('0x29')][_0x898b('0x2a')],function(_0x472374){return{'name':_0x472374[_0x898b('0x2b')],'type':_0x472374[_0x898b('0x2c')][_0x898b('0x2d')]};});_0x2a5178[_0x898b('0x2e')]=_[_0x898b('0x28')](_0x9c8aa7,'name');_0x2a5178[_0x898b('0x2f')]=_[_0x898b('0x30')](_0x1cc9aa[_0x898b('0x2f')]);_0x2a5178[_0x898b('0x31')]=_[_0x898b('0x32')](_0x2a5178[_0x898b('0x2e')],_0x2a5178[_0x898b('0x2f')]);_0x3b4648[_0x898b('0x33')]=_[_0x898b('0x32')](_0x2a5178['model'],qs[_0x898b('0x34')](_0x1cc9aa[_0x898b('0x2f')]['fields']));_0x3b4648['attributes']=_0x3b4648['attributes'][_0x898b('0x35')]?_0x3b4648[_0x898b('0x33')]:_0x2a5178[_0x898b('0x2e')];if(!_0x1cc9aa['query'][_0x898b('0x36')](_0x898b('0x37'))){_0x3b4648[_0x898b('0x1a')]=qs[_0x898b('0x1a')](_0x1cc9aa['query'][_0x898b('0x1a')]);_0x3b4648[_0x898b('0x18')]=qs['offset'](_0x1cc9aa[_0x898b('0x2f')][_0x898b('0x18')]);}_0x3b4648[_0x898b('0x38')]=qs[_0x898b('0x39')](_0x1cc9aa['query'][_0x898b('0x39')]);_0x3b4648['where']=qs[_0x898b('0x31')](_['pick'](_0x1cc9aa[_0x898b('0x2f')],_0x2a5178[_0x898b('0x31')]),_0x9c8aa7);if(_0x1cc9aa[_0x898b('0x2f')]['filter']){_0x3b4648[_0x898b('0x3a')]=_[_0x898b('0x3b')](_0x3b4648[_0x898b('0x3a')],{'$or':_[_0x898b('0x28')](_0x9c8aa7,function(_0x13a266){if(_0x13a266['type']!=='VIRTUAL'){var _0x517312={};_0x517312[_0x13a266[_0x898b('0x25')]]={'$like':'%'+_0x1cc9aa['query'][_0x898b('0x3c')]+'%'};return _0x517312;}})});}_0x3b4648=_[_0x898b('0x3b')]({},_0x3b4648,_0x1cc9aa[_0x898b('0x3d')]);var _0x4fa6ad={'where':_0x3b4648[_0x898b('0x3a')]};return db[_0x898b('0x29')]['count'](_0x4fa6ad)['then'](function(_0x125405){_0x7a2f6b[_0x898b('0x1b')]=_0x125405;if(_0x1cc9aa['query'][_0x898b('0x3e')]){_0x3b4648[_0x898b('0x3f')]=[{'all':!![]}];}return db['FaxApplication'][_0x898b('0x40')](_0x3b4648);})['then'](function(_0x19b26f){_0x7a2f6b[_0x898b('0x41')]=_0x19b26f;return _0x7a2f6b;})[_0x898b('0x21')](respondWithFilteredResult(_0x2ed054,_0x3b4648))[_0x898b('0x42')](handleError(_0x2ed054,null));};exports[_0x898b('0x43')]=function(_0x446feb,_0x114e74){var _0x49f62a={'raw':!![],'where':{'id':_0x446feb[_0x898b('0x44')]['id']}},_0x18e1d4={};_0x18e1d4[_0x898b('0x2e')]=_[_0x898b('0x30')](db[_0x898b('0x29')][_0x898b('0x2a')]);_0x18e1d4[_0x898b('0x2f')]=_[_0x898b('0x30')](_0x446feb[_0x898b('0x2f')]);_0x18e1d4[_0x898b('0x31')]=_[_0x898b('0x32')](_0x18e1d4['model'],_0x18e1d4[_0x898b('0x2f')]);_0x49f62a[_0x898b('0x33')]=_[_0x898b('0x32')](_0x18e1d4[_0x898b('0x2e')],qs[_0x898b('0x34')](_0x446feb['query'][_0x898b('0x34')]));_0x49f62a[_0x898b('0x33')]=_0x49f62a[_0x898b('0x33')][_0x898b('0x35')]?_0x49f62a[_0x898b('0x33')]:_0x18e1d4['model'];if(_0x446feb[_0x898b('0x2f')][_0x898b('0x3e')]){_0x49f62a[_0x898b('0x3f')]=[{'all':!![]}];}_0x49f62a=_[_0x898b('0x3b')]({},_0x49f62a,_0x446feb[_0x898b('0x3d')]);return db[_0x898b('0x29')][_0x898b('0x45')](_0x49f62a)[_0x898b('0x21')](handleEntityNotFound(_0x114e74,null))['then'](respondWithResult(_0x114e74,null))[_0x898b('0x42')](handleError(_0x114e74,null));};exports['create']=function(_0x280c88,_0x1f6dac){return db[_0x898b('0x29')][_0x898b('0x46')](_0x280c88[_0x898b('0x47')],{})[_0x898b('0x21')](respondWithResult(_0x1f6dac,0xc9))[_0x898b('0x42')](handleError(_0x1f6dac,null));};exports[_0x898b('0x20')]=function(_0x4bfa33,_0x115f7e){if(_0x4bfa33[_0x898b('0x47')]['id']){delete _0x4bfa33[_0x898b('0x47')]['id'];}return db[_0x898b('0x29')][_0x898b('0x45')]({'where':{'id':_0x4bfa33[_0x898b('0x44')]['id']}})[_0x898b('0x21')](handleEntityNotFound(_0x115f7e,null))[_0x898b('0x21')](saveUpdates(_0x4bfa33['body'],null))[_0x898b('0x21')](respondWithResult(_0x115f7e,null))[_0x898b('0x42')](handleError(_0x115f7e,null));};exports[_0x898b('0x22')]=function(_0x2b7a71,_0x1ed65e){return db[_0x898b('0x29')][_0x898b('0x45')]({'where':{'id':_0x2b7a71[_0x898b('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ed65e,null))['then'](removeEntity(_0x1ed65e,null))[_0x898b('0x42')](handleError(_0x1ed65e,null));}; \ No newline at end of file +var _0x770f=['zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','FaxApplication','rawAttributes','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','catch','show','include','options','find','create','body','params','eml-format'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0x770f,0xe0));var _0xf770=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0x770f[_0x49a57c];return _0x4e0316;};'use strict';var emlformat=require(_0xf770('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf770('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf770('0x2'));var moment=require(_0xf770('0x3'));var BPromise=require(_0xf770('0x4'));var Mustache=require(_0xf770('0x5'));var util=require(_0xf770('0x6'));var path=require(_0xf770('0x7'));var sox=require(_0xf770('0x8'));var csv=require(_0xf770('0x9'));var ejs=require(_0xf770('0xa'));var fs=require('fs');var fs_extra=require(_0xf770('0xb'));var _=require('lodash');var squel=require(_0xf770('0xc'));var crypto=require(_0xf770('0xd'));var jsforce=require(_0xf770('0xe'));var deskjs=require(_0xf770('0xf'));var toCsv=require(_0xf770('0x9'));var querystring=require(_0xf770('0x10'));var Papa=require(_0xf770('0x11'));var Redis=require(_0xf770('0x12'));var authService=require(_0xf770('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf770('0x14'));var hardwareService=require(_0xf770('0x15'));var logger=require(_0xf770('0x16'))('api');var utils=require(_0xf770('0x17'));var config=require(_0xf770('0x18'));var licenseUtil=require(_0xf770('0x19'));var db=require(_0xf770('0x1a'))['db'];function respondWithStatusCode(_0x28ed01,_0x151c48){_0x151c48=_0x151c48||0xcc;return function(_0x5a76bc){if(_0x5a76bc){return _0x28ed01[_0xf770('0x1b')](_0x151c48);}return _0x28ed01[_0xf770('0x1c')](_0x151c48)[_0xf770('0x1d')]();};}function respondWithResult(_0xd7148e,_0x269880){_0x269880=_0x269880||0xc8;return function(_0x446498){if(_0x446498){return _0xd7148e[_0xf770('0x1c')](_0x269880)['json'](_0x446498);}};}function respondWithFilteredResult(_0x23d008,_0x12c4d6){return function(_0x3c1a0e){if(_0x3c1a0e){var _0x4d5302=typeof _0x12c4d6[_0xf770('0x1e')]===_0xf770('0x1f')&&typeof _0x12c4d6['limit']==='undefined';var _0x4dfdcd=_0x3c1a0e[_0xf770('0x20')];var _0x22abdd=_0x4d5302?0x0:_0x12c4d6['offset'];var _0x2bc62c=_0x4d5302?_0x3c1a0e[_0xf770('0x20')]:_0x12c4d6[_0xf770('0x1e')]+_0x12c4d6[_0xf770('0x21')];var _0x38b53b;if(_0x2bc62c>=_0x4dfdcd){_0x2bc62c=_0x4dfdcd;_0x38b53b=0xc8;}else{_0x38b53b=0xce;}_0x23d008[_0xf770('0x1c')](_0x38b53b);return _0x23d008[_0xf770('0x22')](_0xf770('0x23'),_0x22abdd+'-'+_0x2bc62c+'/'+_0x4dfdcd)[_0xf770('0x24')](_0x3c1a0e);}return null;};}function patchUpdates(_0x5a60bf){return function(_0x265c61){try{jsonpatch[_0xf770('0x25')](_0x265c61,_0x5a60bf,!![]);}catch(_0x2973dd){return BPromise[_0xf770('0x26')](_0x2973dd);}return _0x265c61[_0xf770('0x27')]();};}function saveUpdates(_0xd9b7c4,_0x55ab39){return function(_0x3ff01d){if(_0x3ff01d){return _0x3ff01d[_0xf770('0x28')](_0xd9b7c4)[_0xf770('0x29')](function(_0x103fea){return _0x103fea;});}return null;};}function removeEntity(_0x2c141c,_0x3f7ae9){return function(_0x4cac41){if(_0x4cac41){return _0x4cac41[_0xf770('0x2a')]()['then'](function(){_0x2c141c[_0xf770('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50695a,_0x19ceb3){return function(_0x1f56f6){if(!_0x1f56f6){_0x50695a[_0xf770('0x1b')](0x194);}return _0x1f56f6;};}function handleError(_0x1d225,_0x2fdf38){_0x2fdf38=_0x2fdf38||0x1f4;return function(_0x3929a5){logger[_0xf770('0x2b')](_0x3929a5[_0xf770('0x2c')]);if(_0x3929a5[_0xf770('0x2d')]){delete _0x3929a5[_0xf770('0x2d')];}_0x1d225[_0xf770('0x1c')](_0x2fdf38)['send'](_0x3929a5);};}exports[_0xf770('0x2e')]=function(_0x1dc449,_0x8cf592){var _0x23bb46={},_0x2a0d59={},_0x19a188={'count':0x0,'rows':[]};var _0xb183b3=_['map'](db[_0xf770('0x2f')][_0xf770('0x30')],function(_0x5b977a){return{'name':_0x5b977a['fieldName'],'type':_0x5b977a[_0xf770('0x31')]['key']};});_0x2a0d59['model']=_['map'](_0xb183b3,_0xf770('0x2d'));_0x2a0d59[_0xf770('0x32')]=_[_0xf770('0x33')](_0x1dc449[_0xf770('0x32')]);_0x2a0d59['filters']=_[_0xf770('0x34')](_0x2a0d59['model'],_0x2a0d59[_0xf770('0x32')]);_0x23bb46[_0xf770('0x35')]=_[_0xf770('0x34')](_0x2a0d59[_0xf770('0x36')],qs[_0xf770('0x37')](_0x1dc449[_0xf770('0x32')][_0xf770('0x37')]));_0x23bb46[_0xf770('0x35')]=_0x23bb46[_0xf770('0x35')][_0xf770('0x38')]?_0x23bb46[_0xf770('0x35')]:_0x2a0d59[_0xf770('0x36')];if(!_0x1dc449[_0xf770('0x32')][_0xf770('0x39')]('nolimit')){_0x23bb46[_0xf770('0x21')]=qs[_0xf770('0x21')](_0x1dc449['query']['limit']);_0x23bb46['offset']=qs[_0xf770('0x1e')](_0x1dc449[_0xf770('0x32')][_0xf770('0x1e')]);}_0x23bb46[_0xf770('0x3a')]=qs[_0xf770('0x3b')](_0x1dc449[_0xf770('0x32')]['sort']);_0x23bb46[_0xf770('0x3c')]=qs[_0xf770('0x3d')](_['pick'](_0x1dc449['query'],_0x2a0d59[_0xf770('0x3d')]),_0xb183b3);if(_0x1dc449[_0xf770('0x32')][_0xf770('0x3e')]){_0x23bb46[_0xf770('0x3c')]=_[_0xf770('0x3f')](_0x23bb46[_0xf770('0x3c')],{'$or':_['map'](_0xb183b3,function(_0x54c6b1){if(_0x54c6b1[_0xf770('0x31')]!==_0xf770('0x40')){var _0x1b0374={};_0x1b0374[_0x54c6b1[_0xf770('0x2d')]]={'$like':'%'+_0x1dc449[_0xf770('0x32')][_0xf770('0x3e')]+'%'};return _0x1b0374;}})});}_0x23bb46=_[_0xf770('0x3f')]({},_0x23bb46,_0x1dc449['options']);var _0x79c314={'where':_0x23bb46['where']};return db[_0xf770('0x2f')][_0xf770('0x20')](_0x79c314)[_0xf770('0x29')](function(_0x492237){_0x19a188['count']=_0x492237;if(_0x1dc449[_0xf770('0x32')][_0xf770('0x41')]){_0x23bb46['include']=[{'all':!![]}];}return db[_0xf770('0x2f')][_0xf770('0x42')](_0x23bb46);})['then'](function(_0x280753){_0x19a188['rows']=_0x280753;return _0x19a188;})[_0xf770('0x29')](respondWithFilteredResult(_0x8cf592,_0x23bb46))[_0xf770('0x43')](handleError(_0x8cf592,null));};exports[_0xf770('0x44')]=function(_0x18188d,_0x60f4fc){var _0x4189e5={'raw':!![],'where':{'id':_0x18188d['params']['id']}},_0x41c855={};_0x41c855['model']=_['keys'](db[_0xf770('0x2f')][_0xf770('0x30')]);_0x41c855['query']=_['keys'](_0x18188d['query']);_0x41c855[_0xf770('0x3d')]=_['intersection'](_0x41c855[_0xf770('0x36')],_0x41c855[_0xf770('0x32')]);_0x4189e5[_0xf770('0x35')]=_['intersection'](_0x41c855['model'],qs['fields'](_0x18188d[_0xf770('0x32')][_0xf770('0x37')]));_0x4189e5[_0xf770('0x35')]=_0x4189e5[_0xf770('0x35')]['length']?_0x4189e5[_0xf770('0x35')]:_0x41c855['model'];if(_0x18188d['query']['includeAll']){_0x4189e5[_0xf770('0x45')]=[{'all':!![]}];}_0x4189e5=_['merge']({},_0x4189e5,_0x18188d[_0xf770('0x46')]);return db[_0xf770('0x2f')][_0xf770('0x47')](_0x4189e5)['then'](handleEntityNotFound(_0x60f4fc,null))[_0xf770('0x29')](respondWithResult(_0x60f4fc,null))['catch'](handleError(_0x60f4fc,null));};exports[_0xf770('0x48')]=function(_0x250f75,_0x43fc1a){return db['FaxApplication'][_0xf770('0x48')](_0x250f75[_0xf770('0x49')],{})['then'](respondWithResult(_0x43fc1a,0xc9))[_0xf770('0x43')](handleError(_0x43fc1a,null));};exports[_0xf770('0x28')]=function(_0x5e7bc8,_0x3ae77e){if(_0x5e7bc8[_0xf770('0x49')]['id']){delete _0x5e7bc8[_0xf770('0x49')]['id'];}return db[_0xf770('0x2f')][_0xf770('0x47')]({'where':{'id':_0x5e7bc8['params']['id']}})[_0xf770('0x29')](handleEntityNotFound(_0x3ae77e,null))[_0xf770('0x29')](saveUpdates(_0x5e7bc8[_0xf770('0x49')],null))[_0xf770('0x29')](respondWithResult(_0x3ae77e,null))[_0xf770('0x43')](handleError(_0x3ae77e,null));};exports[_0xf770('0x2a')]=function(_0xf577f3,_0x4b7772){return db[_0xf770('0x2f')][_0xf770('0x47')]({'where':{'id':_0xf577f3[_0xf770('0x4a')]['id']}})[_0xf770('0x29')](handleEntityNotFound(_0x4b7772,null))[_0xf770('0x29')](removeEntity(_0x4b7772,null))[_0xf770('0x43')](handleError(_0x4b7772,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 6f76a62..81cc1e8 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 _0xf868=['rimraf','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x30ac91,_0x166518){var _0x5a55f7=function(_0x2095a4){while(--_0x2095a4){_0x30ac91['push'](_0x30ac91['shift']());}};_0x5a55f7(++_0x166518);}(_0xf868,0x187));var _0x8f86=function(_0x421e20,_0x1f4579){_0x421e20=_0x421e20-0x0;var _0xfd5262=_0xf868[_0x421e20];return _0xfd5262;};'use strict';var _=require('lodash');var util=require(_0x8f86('0x0'));var logger=require(_0x8f86('0x1'))(_0x8f86('0x2'));var moment=require(_0x8f86('0x3'));var BPromise=require(_0x8f86('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8f86('0x5'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x8f86('0x6')]=function(_0x2c6314,_0x54d005){return _0x2c6314[_0x8f86('0x7')](_0x8f86('0x8'),attributes,{'tableName':_0x8f86('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8f86('0xa'),'collate':_0x8f86('0xb')});}; \ No newline at end of file +var _0x1d23=['api','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports','fax_applications','utf8mb4_unicode_ci','lodash'];(function(_0x214120,_0x9b45d4){var _0x1767ba=function(_0x4cedb7){while(--_0x4cedb7){_0x214120['push'](_0x214120['shift']());}};_0x1767ba(++_0x9b45d4);}(_0x1d23,0x95));var _0x31d2=function(_0x25446b,_0x5d05aa){_0x25446b=_0x25446b-0x0;var _0x11409e=_0x1d23[_0x25446b];return _0x11409e;};'use strict';var _=require(_0x31d2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x31d2('0x1'));var moment=require('moment');var BPromise=require(_0x31d2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31d2('0x3'));var rimraf=require(_0x31d2('0x4'));var config=require(_0x31d2('0x5'));var attributes=require(_0x31d2('0x6'));module[_0x31d2('0x7')]=function(_0x4acadd,_0x40e8ce){return _0x4acadd['define']('FaxApplication',attributes,{'tableName':_0x31d2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x31d2('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index d291be6..b1a1da2 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 _0x8342=['UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','request\x20sent','stringify','code','error','FaxApplication,\x20%s,\x20%s','message','catch'];(function(_0x36376b,_0x4b81a8){var _0x307e43=function(_0x1d2918){while(--_0x1d2918){_0x36376b['push'](_0x36376b['shift']());}};_0x307e43(++_0x4b81a8);}(_0x8342,0x121));var _0x2834=function(_0x564d53,_0x31ac8a){_0x564d53=_0x564d53-0x0;var _0x1ba891=_0x8342[_0x564d53];return _0x1ba891;};'use strict';var _=require(_0x2834('0x0'));var util=require(_0x2834('0x1'));var moment=require(_0x2834('0x2'));var BPromise=require(_0x2834('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2834('0x4'));var db=require(_0x2834('0x5'))['db'];var utils=require(_0x2834('0x6'));var logger=require(_0x2834('0x7'))('rpc');var config=require(_0x2834('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2834('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28901a,_0x2e2c39,_0x42824e){return new BPromise(function(_0x4e488a,_0x52d3a7){return client['request'](_0x28901a,_0x42824e)[_0x2834('0xa')](function(_0x383c0d){logger[_0x2834('0xb')]('FaxApplication,\x20%s,\x20%s',_0x2e2c39,_0x2834('0xc'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2e2c39,'request\x20sent',JSON[_0x2834('0xd')](_0x383c0d));if(_0x383c0d['error']){if(_0x383c0d['error'][_0x2834('0xe')]===0x1f4){logger[_0x2834('0xf')](_0x2834('0x10'),_0x2e2c39,_0x383c0d[_0x2834('0xf')][_0x2834('0x11')]);return _0x52d3a7(_0x383c0d[_0x2834('0xf')][_0x2834('0x11')]);}logger[_0x2834('0xf')](_0x2834('0x10'),_0x2e2c39,_0x383c0d[_0x2834('0xf')][_0x2834('0x11')]);return _0x4e488a(_0x383c0d['error'][_0x2834('0x11')]);}else{logger[_0x2834('0xb')](_0x2834('0x10'),_0x2e2c39,_0x2834('0xc'));_0x4e488a(_0x383c0d['result'][_0x2834('0x11')]);}})[_0x2834('0x12')](function(_0x17dd52){logger[_0x2834('0xf')]('FaxApplication,\x20%s,\x20%s',_0x2e2c39,_0x17dd52);_0x52d3a7(_0x17dd52);});});}exports[_0x2834('0x13')]=function(_0x31f39c){var _0x5246b9=this;return new Promise(function(_0x9df21a,_0x236c4e){return db[_0x2834('0x14')][_0x2834('0x15')](_0x31f39c['body'],{'raw':_0x31f39c[_0x2834('0x16')]?_0x31f39c[_0x2834('0x16')][_0x2834('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31f39c['options']?_0x31f39c['options'][_0x2834('0x18')]||null:null,'attributes':_0x31f39c[_0x2834('0x16')]?_0x31f39c['options'][_0x2834('0x19')]||null:null,'limit':_0x31f39c[_0x2834('0x16')]?_0x31f39c[_0x2834('0x16')][_0x2834('0x1a')]||null:null})[_0x2834('0xa')](function(_0x5e8bef){logger[_0x2834('0xb')](_0x2834('0x13'),_0x31f39c);logger[_0x2834('0x1b')](_0x2834('0x13'),_0x31f39c,JSON['stringify'](_0x5e8bef));_0x9df21a(_0x5e8bef);})[_0x2834('0x12')](function(_0x2dca11){logger[_0x2834('0xf')](_0x2834('0x13'),_0x2dca11['message'],_0x31f39c);_0x236c4e(_0x5246b9[_0x2834('0xf')](0x1f4,_0x2dca11['message']));});});}; \ No newline at end of file +var _0x750c=['info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','limit','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x750c,0x1d2));var _0xc750=function(_0x45556c,_0x5daf3a){_0x45556c=_0x45556c-0x0;var _0xf0172f=_0x750c[_0x45556c];return _0xf0172f;};'use strict';var _=require('lodash');var util=require(_0xc750('0x0'));var moment=require(_0xc750('0x1'));var BPromise=require(_0xc750('0x2'));var rs=require(_0xc750('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc750('0x4'));var logger=require(_0xc750('0x5'))(_0xc750('0x6'));var config=require(_0xc750('0x7'));var jayson=require(_0xc750('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32ed9b,_0x21c08c,_0x520939){return new BPromise(function(_0x4d9e37,_0x589cef){return client['request'](_0x32ed9b,_0x520939)[_0xc750('0x9')](function(_0x4e6ba0){logger[_0xc750('0xa')](_0xc750('0xb'),_0x21c08c,'request\x20sent');logger[_0xc750('0xc')](_0xc750('0xd'),_0x21c08c,'request\x20sent',JSON[_0xc750('0xe')](_0x4e6ba0));if(_0x4e6ba0['error']){if(_0x4e6ba0[_0xc750('0xf')]['code']===0x1f4){logger[_0xc750('0xf')](_0xc750('0xb'),_0x21c08c,_0x4e6ba0[_0xc750('0xf')][_0xc750('0x10')]);return _0x589cef(_0x4e6ba0['error'][_0xc750('0x10')]);}logger[_0xc750('0xf')]('FaxApplication,\x20%s,\x20%s',_0x21c08c,_0x4e6ba0[_0xc750('0xf')][_0xc750('0x10')]);return _0x4d9e37(_0x4e6ba0[_0xc750('0xf')][_0xc750('0x10')]);}else{logger[_0xc750('0xa')](_0xc750('0xb'),_0x21c08c,_0xc750('0x11'));_0x4d9e37(_0x4e6ba0[_0xc750('0x12')][_0xc750('0x10')]);}})[_0xc750('0x13')](function(_0x190dc8){logger[_0xc750('0xf')](_0xc750('0xb'),_0x21c08c,_0x190dc8);_0x589cef(_0x190dc8);});});}exports[_0xc750('0x14')]=function(_0xb4bb68){var _0x44fbf7=this;return new Promise(function(_0x58666c,_0x5e0152){return db[_0xc750('0x15')]['update'](_0xb4bb68[_0xc750('0x16')],{'raw':_0xb4bb68[_0xc750('0x17')]?_0xb4bb68[_0xc750('0x17')][_0xc750('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb4bb68[_0xc750('0x17')]?_0xb4bb68[_0xc750('0x17')][_0xc750('0x19')]||null:null,'attributes':_0xb4bb68['options']?_0xb4bb68[_0xc750('0x17')][_0xc750('0x1a')]||null:null,'limit':_0xb4bb68[_0xc750('0x17')]?_0xb4bb68[_0xc750('0x17')][_0xc750('0x1b')]||null:null})[_0xc750('0x9')](function(_0x1c7c89){logger[_0xc750('0xa')](_0xc750('0x14'),_0xb4bb68);logger['debug'](_0xc750('0x14'),_0xb4bb68,JSON[_0xc750('0xe')](_0x1c7c89));_0x58666c(_0x1c7c89);})[_0xc750('0x13')](function(_0x402793){logger[_0xc750('0xf')](_0xc750('0x14'),_0x402793['message'],_0xb4bb68);_0x5e0152(_0x44fbf7[_0xc750('0xf')](0x1f4,_0x402793[_0xc750('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index e496819..2b3e96f 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 _0x13f6=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','post','create','put','update'];(function(_0x5e7137,_0x11418a){var _0x4ba22c=function(_0xe68361){while(--_0xe68361){_0x5e7137['push'](_0x5e7137['shift']());}};_0x4ba22c(++_0x11418a);}(_0x13f6,0x124));var _0x613f=function(_0xaaab26,_0x462a42){_0xaaab26=_0xaaab26-0x0;var _0x4a4172=_0x13f6[_0xaaab26];return _0x4a4172;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x613f('0xa')]('/',auth[_0x613f('0x8')](),controller[_0x613f('0xb')]);router[_0x613f('0xc')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xd')]);router[_0x613f('0xe')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xf')]);module[_0x613f('0x10')]=router; \ No newline at end of file +var _0xb688=['show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xb688,0xcf));var _0x8b68=function(_0xd12b6f,_0x54a063){_0xd12b6f=_0xd12b6f-0x0;var _0x3337b0=_0xb688[_0xd12b6f];return _0x3337b0;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0xe')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x10')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x12')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 06dc7b0..53abf1e 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 _0x5f66=['INTEGER','exports','DATE','STRING','out'];(function(_0xfdda64,_0xc80f3){var _0x1d9c30=function(_0xfd77fd){while(--_0xfd77fd){_0xfdda64['push'](_0xfdda64['shift']());}};_0x1d9c30(++_0xc80f3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x65f6('0x1')]},'disposition':{'type':Sequelize[_0x65f6('0x2')]},'secondDisposition':{'type':Sequelize[_0x65f6('0x2')]},'thirdDisposition':{'type':Sequelize[_0x65f6('0x2')]},'note':{'type':Sequelize[_0x65f6('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x65f6('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x65f6('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x65f6('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x65f6('0x4')]}}; \ No newline at end of file +var _0x4888=['exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x467e39,_0x54a12e){var _0x3d4c8e=function(_0x517c1f){while(--_0x517c1f){_0x467e39['push'](_0x467e39['shift']());}};_0x3d4c8e(++_0x54a12e);}(_0x4888,0x198));var _0x8488=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0x4888[_0x377a6e];return _0x37f751;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'closed':{'type':Sequelize[_0x8488('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8488('0x2')]},'disposition':{'type':Sequelize[_0x8488('0x3')]},'secondDisposition':{'type':Sequelize[_0x8488('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8488('0x3')]},'note':{'type':Sequelize[_0x8488('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x8488('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8488('0x4')]('in',_0x8488('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8488('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8488('0x4')]('in',_0x8488('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index fc2c077..cc2111c 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 _0x5932=['$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','get','mkdirSync','basename','existsSync','pipe','createWriteStream','resolve','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','then','error','name','send','index','map','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','query','params','model','keys','filters','intersection','attributes','fields','length','include','merge','options','find','catch','create','body','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','FaxInteractionId','filter'];(function(_0x112e8c,_0x543f31){var _0x572aa3=function(_0x19b1f4){while(--_0x19b1f4){_0x112e8c['push'](_0x112e8c['shift']());}};_0x572aa3(++_0x543f31);}(_0x5932,0x8f));var _0x2593=function(_0x1c0d1d,_0x382783){_0x1c0d1d=_0x1c0d1d-0x0;var _0x44b6b8=_0x5932[_0x1c0d1d];return _0x44b6b8;};'use strict';var rimraf=require(_0x2593('0x0'));var zipdir=require(_0x2593('0x1'));var moment=require(_0x2593('0x2'));var BPromise=require(_0x2593('0x3'));var util=require(_0x2593('0x4'));var path=require(_0x2593('0x5'));var fs=require('fs');var _=require(_0x2593('0x6'));var Redis=require(_0x2593('0x7'));var interaction=require(_0x2593('0x8'));var qs=require(_0x2593('0x9'));var logger=require(_0x2593('0xa'))(_0x2593('0xb'));var config=require('../../config/environment');var db=require(_0x2593('0xc'))['db'];config[_0x2593('0xd')]=_[_0x2593('0xe')](config[_0x2593('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x2593('0xf'))(new Redis(config['redis']));require(_0x2593('0x10'))[_0x2593('0x11')](socket);function respondWithStatusCode(_0x83a36a,_0x1c8a09){_0x1c8a09=_0x1c8a09||0xcc;return function(_0x5252e9){if(_0x5252e9){return _0x83a36a[_0x2593('0x12')](_0x1c8a09);}return _0x83a36a[_0x2593('0x13')](_0x1c8a09)[_0x2593('0x14')]();};}function respondWithResult(_0x5c764d,_0x55e04a){_0x55e04a=_0x55e04a||0xc8;return function(_0xdcecb7){if(_0xdcecb7){return _0x5c764d['status'](_0x55e04a)[_0x2593('0x15')](_0xdcecb7);}};}function respondWithFilteredResult(_0x39c34a,_0x472082){return function(_0x1efaaf){if(_0x1efaaf){var _0x40fa95=typeof _0x472082[_0x2593('0x16')]===_0x2593('0x17')&&typeof _0x472082[_0x2593('0x18')]===_0x2593('0x17');var _0x4270f5=_0x1efaaf[_0x2593('0x19')];var _0x37b4f4=_0x40fa95?0x0:_0x472082[_0x2593('0x16')];var _0x2edc58=_0x40fa95?_0x1efaaf[_0x2593('0x19')]:_0x472082['offset']+_0x472082[_0x2593('0x18')];var _0x37fcaf;if(_0x2edc58>=_0x4270f5){_0x2edc58=_0x4270f5;_0x37fcaf=0xc8;}else{_0x37fcaf=0xce;}_0x39c34a['status'](_0x37fcaf);return _0x39c34a['set'](_0x2593('0x1a'),_0x37b4f4+'-'+_0x2edc58+'/'+_0x4270f5)[_0x2593('0x15')](_0x1efaaf);}return null;};}function saveUpdates(_0x350e63){return function(_0x4c9cc1){if(_0x4c9cc1){return _0x4c9cc1[_0x2593('0x1b')](_0x350e63)['then'](function(_0x3d293f){return _0x3d293f;});}return null;};}function removeEntity(_0xb15a3d){return function(_0x37011e){if(_0x37011e){return _0x37011e[_0x2593('0x1c')]()[_0x2593('0x1d')](function(){_0xb15a3d['status'](0xcc)[_0x2593('0x14')]();});}};}function handleEntityNotFound(_0xc6802f){return function(_0x53a6ae){if(!_0x53a6ae){_0xc6802f[_0x2593('0x12')](0x194);}return _0x53a6ae;};}function handleError(_0x43bbac,_0x56425e){_0x56425e=_0x56425e||0x1f4;return function(_0x3b0b7f){logger[_0x2593('0x1e')](_0x3b0b7f['stack']);if(_0x3b0b7f[_0x2593('0x1f')]){delete _0x3b0b7f[_0x2593('0x1f')];}_0x43bbac[_0x2593('0x13')](_0x56425e)[_0x2593('0x20')](_0x3b0b7f);};}exports[_0x2593('0x21')]=function(_0xf3931,_0x5bf05b){var _0x411415={};var _0x84d4f2=_[_0x2593('0x22')](db[_0x2593('0x23')][_0x2593('0x24')],function(_0x5150cc){return{'name':_0x5150cc[_0x2593('0x25')],'type':_0x5150cc['type'][_0x2593('0x26')]};});_0x411415=qs[_0x2593('0x27')](_0x84d4f2,_0xf3931);return interaction[_0x2593('0x28')]('fax',_0xf3931[_0x2593('0x29')],_0xf3931['user'],_0x411415,_0x84d4f2)[_0x2593('0x1d')](respondWithFilteredResult(_0x5bf05b,_0x411415))['catch'](handleError(_0x5bf05b,null));};exports['show']=function(_0x4df7c2,_0x293bc0){var _0xbc37dd={'raw':![],'where':{'id':_0x4df7c2[_0x2593('0x2a')]['id']}},_0x42a498={};_0x42a498[_0x2593('0x2b')]=_[_0x2593('0x2c')](db[_0x2593('0x23')][_0x2593('0x24')]);_0x42a498[_0x2593('0x29')]=_[_0x2593('0x2c')](_0x4df7c2['query']);_0x42a498[_0x2593('0x2d')]=_[_0x2593('0x2e')](_0x42a498[_0x2593('0x2b')],_0x42a498['query']);_0xbc37dd[_0x2593('0x2f')]=_[_0x2593('0x2e')](_0x42a498[_0x2593('0x2b')],qs[_0x2593('0x30')](_0x4df7c2[_0x2593('0x29')]['fields']));_0xbc37dd['attributes']=_0xbc37dd[_0x2593('0x2f')][_0x2593('0x31')]?_0xbc37dd[_0x2593('0x2f')]:_0x42a498[_0x2593('0x2b')];if(_0x4df7c2['query']['includeAll']){_0xbc37dd[_0x2593('0x32')]=[{'all':!![]}];}_0xbc37dd=_[_0x2593('0x33')]({},_0xbc37dd,_0x4df7c2[_0x2593('0x34')]);return db['FaxInteraction'][_0x2593('0x35')](_0xbc37dd)[_0x2593('0x1d')](handleEntityNotFound(_0x293bc0,null))['then'](respondWithResult(_0x293bc0,null))[_0x2593('0x36')](handleError(_0x293bc0,null));};exports[_0x2593('0x37')]=function(_0x99ce57,_0x490207){return db[_0x2593('0x23')][_0x2593('0x37')](_0x99ce57[_0x2593('0x38')],{})[_0x2593('0x1d')](respondWithResult(_0x490207,0xc9))[_0x2593('0x36')](handleError(_0x490207,null));};exports[_0x2593('0x1b')]=function(_0x1ab9b4,_0x206aed){if(_0x1ab9b4['body']['id']){delete _0x1ab9b4[_0x2593('0x38')]['id'];}return db[_0x2593('0x23')]['find']({'where':{'id':_0x1ab9b4['params']['id']}})[_0x2593('0x1d')](handleEntityNotFound(_0x206aed,null))['then'](saveUpdates(_0x1ab9b4[_0x2593('0x38')],null))[_0x2593('0x1d')](respondWithResult(_0x206aed,null))[_0x2593('0x36')](handleError(_0x206aed,null));};exports[_0x2593('0x1c')]=function(_0x48c564,_0x30ffea){return db[_0x2593('0x23')][_0x2593('0x35')]({'where':{'id':_0x48c564[_0x2593('0x2a')]['id']}})[_0x2593('0x1d')](handleEntityNotFound(_0x30ffea,null))[_0x2593('0x1d')](removeEntity(_0x30ffea,null))[_0x2593('0x36')](handleError(_0x30ffea,null));};exports[_0x2593('0x39')]=function(_0x15e46b,_0x1ea477){return db[_0x2593('0x23')][_0x2593('0x39')]()['then'](respondWithResult(_0x1ea477,null))[_0x2593('0x36')](handleError(_0x1ea477,null));};exports[_0x2593('0x3a')]=function(_0x335ddc,_0x276918){return db[_0x2593('0x3b')][_0x2593('0x35')]({'where':{'id':_0x335ddc[_0x2593('0x2a')]['id']}})['then'](handleEntityNotFound(_0x276918,null))[_0x2593('0x1d')](function(_0x44a506){if(_0x44a506){return _0x44a506[_0x2593('0x3a')](_0x335ddc[_0x2593('0x38')]['ids'],_[_0x2593('0x3c')](_0x335ddc[_0x2593('0x38')],[_0x2593('0x3d'),'id'])||{});}})[_0x2593('0x1d')](respondWithResult(_0x276918,null))[_0x2593('0x36')](handleError(_0x276918,null));};exports[_0x2593('0x3e')]=function(_0x48f1f2,_0x350794){var _0x2f6704={'raw':![],'where':{}};var _0x5e0914={};var _0x7cad26={'count':0x0,'rows':[]};return db[_0x2593('0x23')][_0x2593('0x3f')]({'where':{'id':_0x48f1f2[_0x2593('0x2a')]['id']}})['then'](handleEntityNotFound(_0x350794,null))[_0x2593('0x1d')](function(_0x12be0d){if(_0x12be0d){_0x5e0914[_0x2593('0x2b')]=_['keys'](db[_0x2593('0x3b')][_0x2593('0x24')]);_0x5e0914[_0x2593('0x29')]=_[_0x2593('0x2c')](_0x48f1f2[_0x2593('0x29')]);_0x5e0914[_0x2593('0x2d')]=_[_0x2593('0x2e')](_0x5e0914[_0x2593('0x2b')],_0x5e0914[_0x2593('0x29')]);_0x2f6704['attributes']=_[_0x2593('0x2e')](_0x5e0914[_0x2593('0x2b')],qs[_0x2593('0x30')](_0x48f1f2['query']['fields']));_0x2f6704[_0x2593('0x2f')]=_0x2f6704['attributes'][_0x2593('0x31')]?_0x2f6704['attributes']:_0x5e0914[_0x2593('0x2b')];if(!_0x48f1f2['query'][_0x2593('0x40')](_0x2593('0x41'))){_0x2f6704['limit']=qs[_0x2593('0x18')](_0x48f1f2[_0x2593('0x29')][_0x2593('0x18')]);_0x2f6704[_0x2593('0x16')]=qs[_0x2593('0x16')](_0x48f1f2[_0x2593('0x29')]['offset']);}_0x2f6704[_0x2593('0x42')]=qs[_0x2593('0x43')](_0x48f1f2[_0x2593('0x29')][_0x2593('0x43')]);_0x2f6704[_0x2593('0x44')]=qs[_0x2593('0x2d')](_['pick'](_0x48f1f2[_0x2593('0x29')],_0x5e0914[_0x2593('0x2d')]));_0x2f6704[_0x2593('0x44')][_0x2593('0x45')]=_0x12be0d['id'];if(_0x48f1f2['query'][_0x2593('0x46')]){_0x2f6704[_0x2593('0x44')]=_[_0x2593('0x33')](_0x2f6704['where'],{'$or':_[_0x2593('0x22')](_0x2f6704['attributes'],function(_0x266304){var _0x226014={};_0x226014[_0x266304]={'$like':'%'+_0x48f1f2['query'][_0x2593('0x46')]+'%'};return _0x226014;})});}if(_0x48f1f2[_0x2593('0x29')][_0x2593('0x47')]){var _0x1fe7f8=_0x48f1f2[_0x2593('0x29')][_0x2593('0x47')][_0x2593('0x48')](',');var _0x39267d={};_0x39267d[_0x1fe7f8[0x0]]={'$gte':moment(_0x1fe7f8[0x1])[_0x2593('0x49')](_0x2593('0x4a'))};_0x2f6704[_0x2593('0x44')]=_[_0x2593('0x33')](_0x2f6704[_0x2593('0x44')],_0x39267d);}_0x2f6704=_[_0x2593('0x33')]({},_0x2f6704,_0x48f1f2[_0x2593('0x34')]);return db[_0x2593('0x3b')][_0x2593('0x19')]({'where':_0x2f6704[_0x2593('0x44')]})[_0x2593('0x1d')](function(_0xd2f023){_0x7cad26[_0x2593('0x19')]=_0xd2f023;if(_0x48f1f2['query'][_0x2593('0x4b')]){_0x2f6704[_0x2593('0x32')]=[{'all':!![]}];}return db['FaxMessage'][_0x2593('0x28')](_0x2f6704);})[_0x2593('0x1d')](function(_0x3b536a){_0x7cad26[_0x2593('0x4c')]=_0x3b536a;return _0x7cad26;});}})[_0x2593('0x1d')](respondWithFilteredResult(_0x350794,_0x2f6704))[_0x2593('0x36')](handleError(_0x350794,null));};exports[_0x2593('0x4d')]=function(_0x4783bd,_0x1b1520){return db[_0x2593('0x23')][_0x2593('0x35')]({'where':{'id':_0x4783bd[_0x2593('0x2a')]['id']}})[_0x2593('0x1d')](handleEntityNotFound(_0x1b1520,null))[_0x2593('0x1d')](function(_0x22ae77){if(_0x22ae77){return _0x22ae77[_0x2593('0x4e')](_0x4783bd[_0x2593('0x38')][_0x2593('0x3d')],_['omit'](_0x4783bd[_0x2593('0x38')],[_0x2593('0x3d'),'id'])||{})[_0x2593('0x4f')](function(){return db[_0x2593('0x50')]['findAll']({'attributes':['id',_0x2593('0x1f'),_0x2593('0x51')],'where':{'id':_0x4783bd[_0x2593('0x38')]['ids']}});})[_0x2593('0x1d')](function(_0x31d0c6){socket[_0x2593('0x52')]('faxInteractionTags:save',{'id':Number(_0x4783bd[_0x2593('0x2a')]['id']),'tags':_0x31d0c6||[]});return{'id':Number(_0x4783bd[_0x2593('0x2a')]['id']),'tags':_0x31d0c6||[]};});}})['then'](respondWithResult(_0x1b1520,null))['catch'](handleError(_0x1b1520,null));};exports['removeTags']=function(_0x47975d,_0x38ba41){return db[_0x2593('0x23')][_0x2593('0x35')]({'where':{'id':_0x47975d[_0x2593('0x2a')]['id']}})[_0x2593('0x1d')](handleEntityNotFound(_0x38ba41,null))['then'](function(_0x429144){if(_0x429144){return _0x429144[_0x2593('0x53')](_0x47975d[_0x2593('0x29')]['ids']);}})[_0x2593('0x1d')](respondWithStatusCode(_0x38ba41,null))[_0x2593('0x36')](handleError(_0x38ba41,null));};exports[_0x2593('0x54')]=function(_0x169b3a,_0x2cd926){var _0x27b7db=moment()[_0x2593('0x55')]()[_0x2593('0x56')]();var _0x390857=path[_0x2593('0x57')](config[_0x2593('0x58')],_0x2593('0x59'),_0x2593('0x5a'),_0x2593('0x5b'));var _0x1d6003=path[_0x2593('0x57')](config[_0x2593('0x58')],_0x2593('0x59'),_0x2593('0x5a'),_0x2593('0x5c'));var _0x57a29a=path[_0x2593('0x57')](_0x390857,_0x27b7db);var _0x1d9685=util['format'](_0x2593('0x5d'),_0x169b3a['params']['id'],_0x27b7db);var _0x4c1f0a=path['join'](_0x390857,_0x1d9685);var _0x1a2d2a=[];_0x1a2d2a[_0x2593('0x5e')]({'model':db[_0x2593('0x5f')],'as':_0x2593('0x5f'),'raw':!![]});var _0x1f1549=[{'model':db[_0x2593('0x3b')],'as':'Messages','attributes':['id',_0x2593('0x38'),_0x2593('0x60')],'include':_0x1a2d2a}];return db[_0x2593('0x23')][_0x2593('0x35')]({'where':{'id':_0x169b3a[_0x2593('0x2a')]['id']},'include':_0x1f1549})[_0x2593('0x1d')](handleEntityNotFound(_0x2cd926,null))['then'](function(_0xc6913e){if(_0xc6913e&&_0xc6913e[_0x2593('0x61')]){var _0x39e620=_0xc6913e[_0x2593('0x62')]({'plain':!![]});fs[_0x2593('0x63')](_0x57a29a);for(var _0x213cce=0x0;_0x213cce<_0x39e620[_0x2593('0x61')]['length'];_0x213cce++){var _0x43e906=_0x39e620[_0x2593('0x61')][_0x213cce][_0x2593('0x5f')];if(_0x43e906){var _0x295d2b=path['join'](_0x1d6003,_0x43e906[_0x2593('0x64')]);if(fs[_0x2593('0x65')](_0x295d2b)){fs['createReadStream'](_0x295d2b)[_0x2593('0x66')](fs[_0x2593('0x67')](path['join'](_0x57a29a,_0x43e906['basename'])));}}}return BPromise[_0x2593('0x68')]()[_0x2593('0x1d')](function(){return new BPromise(function(_0x285374,_0x3fb341){zipdir(_0x57a29a,{'saveTo':_0x4c1f0a},function(_0x150038,_0x590f76){if(_0x150038)return _0x3fb341(_0x150038);return _0x285374(_0x590f76);});})[_0x2593('0x1d')](function(){return new BPromise(function(_0x1d0d58,_0x507984){rimraf(_0x57a29a,function(_0x1a6096){if(_0x1a6096)_0x507984(_0x1a6096);return _0x1d0d58();});});})[_0x2593('0x1d')](function(){return _0x2cd926['download'](_0x4c1f0a,_0x1d9685,function(_0x4aa612){if(_0x4aa612){console[_0x2593('0x69')]('err',_0x4aa612);}else{fs[_0x2593('0x6a')](_0x4c1f0a);}});});});}else{return _0x2cd926[_0x2593('0x12')](0xc8);}})[_0x2593('0x36')](handleError(_0x2cd926,null));}; \ No newline at end of file +var _0x3800=['basename','createReadStream','pipe','err','unlinkSync','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','filters','intersection','attributes','length','includeAll','include','options','find','then','create','body','describe','addMessage','FaxMessage','ids','getMessages','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','color','emit','faxInteractionTags:save','download','toString','join','root','server','files','tmp','transcript-%d-%s.zip','Messages','createdAt','get','mkdirSync','Attachment'];(function(_0x13aa1d,_0x5bedda){var _0x1b5192=function(_0x4c8e0e){while(--_0x4c8e0e){_0x13aa1d['push'](_0x13aa1d['shift']());}};_0x1b5192(++_0x5bedda);}(_0x3800,0x68));var _0x0380=function(_0x410ab6,_0x59a55e){_0x410ab6=_0x410ab6-0x0;var _0x51fb41=_0x3800[_0x410ab6];return _0x51fb41;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x0380('0x0'));var BPromise=require(_0x0380('0x1'));var util=require(_0x0380('0x2'));var path=require(_0x0380('0x3'));var fs=require('fs');var _=require(_0x0380('0x4'));var Redis=require(_0x0380('0x5'));var interaction=require(_0x0380('0x6'));var qs=require(_0x0380('0x7'));var logger=require('../../config/logger')(_0x0380('0x8'));var config=require(_0x0380('0x9'));var db=require('../../mysqldb')['db'];config[_0x0380('0xa')]=_[_0x0380('0xb')](config[_0x0380('0xa')],{'host':_0x0380('0xc'),'port':0x18eb});var socket=require(_0x0380('0xd'))(new Redis(config[_0x0380('0xa')]));require(_0x0380('0xe'))[_0x0380('0xf')](socket);function respondWithStatusCode(_0x59df8a,_0x3d03cd){_0x3d03cd=_0x3d03cd||0xcc;return function(_0xd33dfe){if(_0xd33dfe){return _0x59df8a['sendStatus'](_0x3d03cd);}return _0x59df8a[_0x0380('0x10')](_0x3d03cd)['end']();};}function respondWithResult(_0x3b83ad,_0x4b5d0d){_0x4b5d0d=_0x4b5d0d||0xc8;return function(_0x4d1a7c){if(_0x4d1a7c){return _0x3b83ad['status'](_0x4b5d0d)[_0x0380('0x11')](_0x4d1a7c);}};}function respondWithFilteredResult(_0x23cdfa,_0x9e5b69){return function(_0x28b1cf){if(_0x28b1cf){var _0x1bfcd8=typeof _0x9e5b69[_0x0380('0x12')]===_0x0380('0x13')&&typeof _0x9e5b69[_0x0380('0x14')]===_0x0380('0x13');var _0x3995fe=_0x28b1cf['count'];var _0x3afd9d=_0x1bfcd8?0x0:_0x9e5b69[_0x0380('0x12')];var _0x1c6588=_0x1bfcd8?_0x28b1cf[_0x0380('0x15')]:_0x9e5b69[_0x0380('0x12')]+_0x9e5b69['limit'];var _0x295a9f;if(_0x1c6588>=_0x3995fe){_0x1c6588=_0x3995fe;_0x295a9f=0xc8;}else{_0x295a9f=0xce;}_0x23cdfa['status'](_0x295a9f);return _0x23cdfa[_0x0380('0x16')](_0x0380('0x17'),_0x3afd9d+'-'+_0x1c6588+'/'+_0x3995fe)[_0x0380('0x11')](_0x28b1cf);}return null;};}function saveUpdates(_0x5be2a8){return function(_0x20501b){if(_0x20501b){return _0x20501b[_0x0380('0x18')](_0x5be2a8)['then'](function(_0x48d13a){return _0x48d13a;});}return null;};}function removeEntity(_0xf2acae){return function(_0x42ab26){if(_0x42ab26){return _0x42ab26[_0x0380('0x19')]()['then'](function(){_0xf2acae[_0x0380('0x10')](0xcc)[_0x0380('0x1a')]();});}};}function handleEntityNotFound(_0x15d748){return function(_0xe37421){if(!_0xe37421){_0x15d748[_0x0380('0x1b')](0x194);}return _0xe37421;};}function handleError(_0x1992a5,_0x1f0550){_0x1f0550=_0x1f0550||0x1f4;return function(_0x4e8186){logger['error'](_0x4e8186[_0x0380('0x1c')]);if(_0x4e8186[_0x0380('0x1d')]){delete _0x4e8186[_0x0380('0x1d')];}_0x1992a5[_0x0380('0x10')](_0x1f0550)['send'](_0x4e8186);};}exports['index']=function(_0xbdec3f,_0x4b4bb9){var _0x4d299f={};var _0x44a3e0=_['map'](db[_0x0380('0x1e')][_0x0380('0x1f')],function(_0xa335c5){return{'name':_0xa335c5[_0x0380('0x20')],'type':_0xa335c5['type'][_0x0380('0x21')]};});_0x4d299f=qs[_0x0380('0x22')](_0x44a3e0,_0xbdec3f);return interaction[_0x0380('0x23')](_0x0380('0x24'),_0xbdec3f[_0x0380('0x25')],_0xbdec3f[_0x0380('0x26')],_0x4d299f,_0x44a3e0)['then'](respondWithFilteredResult(_0x4b4bb9,_0x4d299f))[_0x0380('0x27')](handleError(_0x4b4bb9,null));};exports[_0x0380('0x28')]=function(_0x1eca5a,_0x1019ac){var _0x3fe7f3={'raw':![],'where':{'id':_0x1eca5a[_0x0380('0x29')]['id']}},_0x5dcb85={};_0x5dcb85[_0x0380('0x2a')]=_[_0x0380('0x2b')](db[_0x0380('0x1e')]['rawAttributes']);_0x5dcb85[_0x0380('0x25')]=_['keys'](_0x1eca5a[_0x0380('0x25')]);_0x5dcb85[_0x0380('0x2c')]=_[_0x0380('0x2d')](_0x5dcb85['model'],_0x5dcb85[_0x0380('0x25')]);_0x3fe7f3[_0x0380('0x2e')]=_[_0x0380('0x2d')](_0x5dcb85[_0x0380('0x2a')],qs['fields'](_0x1eca5a[_0x0380('0x25')]['fields']));_0x3fe7f3[_0x0380('0x2e')]=_0x3fe7f3['attributes'][_0x0380('0x2f')]?_0x3fe7f3[_0x0380('0x2e')]:_0x5dcb85[_0x0380('0x2a')];if(_0x1eca5a[_0x0380('0x25')][_0x0380('0x30')]){_0x3fe7f3[_0x0380('0x31')]=[{'all':!![]}];}_0x3fe7f3=_['merge']({},_0x3fe7f3,_0x1eca5a[_0x0380('0x32')]);return db[_0x0380('0x1e')][_0x0380('0x33')](_0x3fe7f3)[_0x0380('0x34')](handleEntityNotFound(_0x1019ac,null))[_0x0380('0x34')](respondWithResult(_0x1019ac,null))[_0x0380('0x27')](handleError(_0x1019ac,null));};exports[_0x0380('0x35')]=function(_0x2bc633,_0x5731e9){return db[_0x0380('0x1e')][_0x0380('0x35')](_0x2bc633['body'],{})[_0x0380('0x34')](respondWithResult(_0x5731e9,0xc9))['catch'](handleError(_0x5731e9,null));};exports[_0x0380('0x18')]=function(_0x2303db,_0x3a89b8){if(_0x2303db[_0x0380('0x36')]['id']){delete _0x2303db[_0x0380('0x36')]['id'];}return db['FaxInteraction'][_0x0380('0x33')]({'where':{'id':_0x2303db[_0x0380('0x29')]['id']}})[_0x0380('0x34')](handleEntityNotFound(_0x3a89b8,null))[_0x0380('0x34')](saveUpdates(_0x2303db[_0x0380('0x36')],null))[_0x0380('0x34')](respondWithResult(_0x3a89b8,null))[_0x0380('0x27')](handleError(_0x3a89b8,null));};exports[_0x0380('0x19')]=function(_0x32198f,_0x4ce53f){return db[_0x0380('0x1e')][_0x0380('0x33')]({'where':{'id':_0x32198f[_0x0380('0x29')]['id']}})[_0x0380('0x34')](handleEntityNotFound(_0x4ce53f,null))[_0x0380('0x34')](removeEntity(_0x4ce53f,null))[_0x0380('0x27')](handleError(_0x4ce53f,null));};exports[_0x0380('0x37')]=function(_0x13c274,_0x34e1e2){return db[_0x0380('0x1e')]['describe']()['then'](respondWithResult(_0x34e1e2,null))[_0x0380('0x27')](handleError(_0x34e1e2,null));};exports[_0x0380('0x38')]=function(_0x56d8c7,_0x5e284d){return db[_0x0380('0x39')][_0x0380('0x33')]({'where':{'id':_0x56d8c7[_0x0380('0x29')]['id']}})[_0x0380('0x34')](handleEntityNotFound(_0x5e284d,null))[_0x0380('0x34')](function(_0x3add7c){if(_0x3add7c){return _0x3add7c[_0x0380('0x38')](_0x56d8c7[_0x0380('0x36')]['ids'],_['omit'](_0x56d8c7[_0x0380('0x36')],[_0x0380('0x3a'),'id'])||{});}})[_0x0380('0x34')](respondWithResult(_0x5e284d,null))[_0x0380('0x27')](handleError(_0x5e284d,null));};exports[_0x0380('0x3b')]=function(_0xa603d7,_0x5951c3){var _0x1e5e93={'raw':![],'where':{}};var _0x1436b9={};var _0x354794={'count':0x0,'rows':[]};return db[_0x0380('0x1e')]['findOne']({'where':{'id':_0xa603d7[_0x0380('0x29')]['id']}})[_0x0380('0x34')](handleEntityNotFound(_0x5951c3,null))[_0x0380('0x34')](function(_0x1597fd){if(_0x1597fd){_0x1436b9[_0x0380('0x2a')]=_[_0x0380('0x2b')](db[_0x0380('0x39')][_0x0380('0x1f')]);_0x1436b9['query']=_[_0x0380('0x2b')](_0xa603d7[_0x0380('0x25')]);_0x1436b9[_0x0380('0x2c')]=_[_0x0380('0x2d')](_0x1436b9[_0x0380('0x2a')],_0x1436b9[_0x0380('0x25')]);_0x1e5e93[_0x0380('0x2e')]=_[_0x0380('0x2d')](_0x1436b9['model'],qs[_0x0380('0x3c')](_0xa603d7[_0x0380('0x25')]['fields']));_0x1e5e93[_0x0380('0x2e')]=_0x1e5e93[_0x0380('0x2e')][_0x0380('0x2f')]?_0x1e5e93['attributes']:_0x1436b9[_0x0380('0x2a')];if(!_0xa603d7[_0x0380('0x25')][_0x0380('0x3d')](_0x0380('0x3e'))){_0x1e5e93['limit']=qs[_0x0380('0x14')](_0xa603d7[_0x0380('0x25')]['limit']);_0x1e5e93[_0x0380('0x12')]=qs[_0x0380('0x12')](_0xa603d7[_0x0380('0x25')]['offset']);}_0x1e5e93[_0x0380('0x3f')]=qs[_0x0380('0x40')](_0xa603d7[_0x0380('0x25')]['sort']);_0x1e5e93[_0x0380('0x41')]=qs[_0x0380('0x2c')](_[_0x0380('0x42')](_0xa603d7[_0x0380('0x25')],_0x1436b9[_0x0380('0x2c')]));_0x1e5e93['where']['FaxInteractionId']=_0x1597fd['id'];if(_0xa603d7[_0x0380('0x25')][_0x0380('0x43')]){_0x1e5e93[_0x0380('0x41')]=_[_0x0380('0x44')](_0x1e5e93[_0x0380('0x41')],{'$or':_['map'](_0x1e5e93[_0x0380('0x2e')],function(_0xfa308a){var _0x33a535={};_0x33a535[_0xfa308a]={'$like':'%'+_0xa603d7[_0x0380('0x25')]['filter']+'%'};return _0x33a535;})});}if(_0xa603d7[_0x0380('0x25')][_0x0380('0x45')]){var _0x5cc7b3=_0xa603d7['query'][_0x0380('0x45')][_0x0380('0x46')](',');var _0xfd5da7={};_0xfd5da7[_0x5cc7b3[0x0]]={'$gte':moment(_0x5cc7b3[0x1])[_0x0380('0x47')](_0x0380('0x48'))};_0x1e5e93[_0x0380('0x41')]=_[_0x0380('0x44')](_0x1e5e93[_0x0380('0x41')],_0xfd5da7);}_0x1e5e93=_['merge']({},_0x1e5e93,_0xa603d7['options']);return db['FaxMessage']['count']({'where':_0x1e5e93[_0x0380('0x41')]})[_0x0380('0x34')](function(_0xf75ddb){_0x354794[_0x0380('0x15')]=_0xf75ddb;if(_0xa603d7[_0x0380('0x25')][_0x0380('0x30')]){_0x1e5e93[_0x0380('0x31')]=[{'all':!![]}];}return db[_0x0380('0x39')][_0x0380('0x23')](_0x1e5e93);})[_0x0380('0x34')](function(_0x1a2f6f){_0x354794[_0x0380('0x49')]=_0x1a2f6f;return _0x354794;});}})[_0x0380('0x34')](respondWithFilteredResult(_0x5951c3,_0x1e5e93))[_0x0380('0x27')](handleError(_0x5951c3,null));};exports[_0x0380('0x4a')]=function(_0x4a66fd,_0x237775){return db[_0x0380('0x1e')]['find']({'where':{'id':_0x4a66fd[_0x0380('0x29')]['id']}})['then'](handleEntityNotFound(_0x237775,null))[_0x0380('0x34')](function(_0x585fe4){if(_0x585fe4){return _0x585fe4[_0x0380('0x4b')](_0x4a66fd[_0x0380('0x36')][_0x0380('0x3a')],_[_0x0380('0x4c')](_0x4a66fd[_0x0380('0x36')],['ids','id'])||{})[_0x0380('0x4d')](function(){return db['Tag'][_0x0380('0x23')]({'attributes':['id','name',_0x0380('0x4e')],'where':{'id':_0x4a66fd['body'][_0x0380('0x3a')]}});})[_0x0380('0x34')](function(_0x486c34){socket[_0x0380('0x4f')](_0x0380('0x50'),{'id':Number(_0x4a66fd[_0x0380('0x29')]['id']),'tags':_0x486c34||[]});return{'id':Number(_0x4a66fd[_0x0380('0x29')]['id']),'tags':_0x486c34||[]};});}})[_0x0380('0x34')](respondWithResult(_0x237775,null))[_0x0380('0x27')](handleError(_0x237775,null));};exports['removeTags']=function(_0x18fa8a,_0x305c0f){return db['FaxInteraction'][_0x0380('0x33')]({'where':{'id':_0x18fa8a[_0x0380('0x29')]['id']}})[_0x0380('0x34')](handleEntityNotFound(_0x305c0f,null))['then'](function(_0x4768d1){if(_0x4768d1){return _0x4768d1['removeTags'](_0x18fa8a['query'][_0x0380('0x3a')]);}})[_0x0380('0x34')](respondWithStatusCode(_0x305c0f,null))[_0x0380('0x27')](handleError(_0x305c0f,null));};exports[_0x0380('0x51')]=function(_0x3eb8c4,_0x37aec0){var _0x46d7a1=moment()['unix']()[_0x0380('0x52')]();var _0x38e24b=path[_0x0380('0x53')](config[_0x0380('0x54')],_0x0380('0x55'),_0x0380('0x56'),_0x0380('0x57'));var _0x3eadbc=path[_0x0380('0x53')](config['root'],'server',_0x0380('0x56'),'attachments');var _0x480432=path[_0x0380('0x53')](_0x38e24b,_0x46d7a1);var _0x3dbf9c=util[_0x0380('0x47')](_0x0380('0x58'),_0x3eb8c4[_0x0380('0x29')]['id'],_0x46d7a1);var _0x4bc543=path['join'](_0x38e24b,_0x3dbf9c);var _0x12c187=[];_0x12c187['push']({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x197f02=[{'model':db['FaxMessage'],'as':_0x0380('0x59'),'attributes':['id',_0x0380('0x36'),_0x0380('0x5a')],'include':_0x12c187}];return db[_0x0380('0x1e')][_0x0380('0x33')]({'where':{'id':_0x3eb8c4['params']['id']},'include':_0x197f02})[_0x0380('0x34')](handleEntityNotFound(_0x37aec0,null))[_0x0380('0x34')](function(_0x344f87){if(_0x344f87&&_0x344f87[_0x0380('0x59')]){var _0x1f28d0=_0x344f87[_0x0380('0x5b')]({'plain':!![]});fs[_0x0380('0x5c')](_0x480432);for(var _0x1df5ef=0x0;_0x1df5ef<_0x1f28d0[_0x0380('0x59')][_0x0380('0x2f')];_0x1df5ef++){var _0x5c7ee8=_0x1f28d0['Messages'][_0x1df5ef][_0x0380('0x5d')];if(_0x5c7ee8){var _0x17e6d8=path[_0x0380('0x53')](_0x3eadbc,_0x5c7ee8[_0x0380('0x5e')]);if(fs['existsSync'](_0x17e6d8)){fs[_0x0380('0x5f')](_0x17e6d8)[_0x0380('0x60')](fs['createWriteStream'](path[_0x0380('0x53')](_0x480432,_0x5c7ee8[_0x0380('0x5e')])));}}}return BPromise['resolve']()[_0x0380('0x34')](function(){return new BPromise(function(_0x558032,_0x168410){zipdir(_0x480432,{'saveTo':_0x4bc543},function(_0x40e217,_0x2324ca){if(_0x40e217)return _0x168410(_0x40e217);return _0x558032(_0x2324ca);});})[_0x0380('0x34')](function(){return new BPromise(function(_0x5ebea1,_0x41dfba){rimraf(_0x480432,function(_0x344275){if(_0x344275)_0x41dfba(_0x344275);return _0x5ebea1();});});})[_0x0380('0x34')](function(){return _0x37aec0[_0x0380('0x51')](_0x4bc543,_0x3dbf9c,function(_0x4a718c){if(_0x4a718c){console['log'](_0x0380('0x61'),_0x4a718c);}else{fs[_0x0380('0x62')](_0x4bc543);}});});});}else{return _0x37aec0[_0x0380('0x1b')](0xc8);}})[_0x0380('0x27')](handleError(_0x37aec0,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index f4fd58b..7db8c5e 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 _0x761a=['remove','getUsers','setDataValue','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save','update'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x761a,0x1ca));var _0xa761=function(_0x9817e7,_0x1d8098){_0x9817e7=_0x9817e7-0x0;var _0x56eccb=_0x761a[_0x9817e7];return _0x56eccb;};'use strict';var EventEmitter=require(_0xa761('0x0'));var FaxInteraction=require(_0xa761('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xa761('0x1'))['db'][_0xa761('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xa761('0x3')](0x0);var events={'afterCreate':_0xa761('0x4'),'afterUpdate':_0xa761('0x5'),'afterDestroy':_0xa761('0x6')};function emitEvent(_0x3ff756){return function(_0x1291e1,_0x2635e3,_0x4b7acc){_0x1291e1[_0xa761('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x56d33f){_0x1291e1[_0xa761('0x8')]('Users',_0x56d33f[_0xa761('0x9')](function(_0x241515){return{'id':_0x241515['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x1291e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x134dd0){_0x1291e1['setDataValue'](_0xa761('0xa'),_0x134dd0[_0xa761('0xb')]);FaxInteractionEvents[_0xa761('0xc')](_0x3ff756+':'+_0x1291e1['id'],_0x1291e1);FaxInteractionEvents[_0xa761('0xc')](_0x3ff756,_0x1291e1);_0x4b7acc(null);})[_0xa761('0xd')](_0x4b7acc(null));};}for(var e in events){if(events[_0xa761('0xe')](e)){var event=events[e];FaxInteraction[_0xa761('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x97bd=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update','setDataValue','Users','findAll','then'];(function(_0xb983be,_0x2f9e72){var _0x4c3e9c=function(_0x456dd3){while(--_0x456dd3){_0xb983be['push'](_0xb983be['shift']());}};_0x4c3e9c(++_0x2f9e72);}(_0x97bd,0x186));var _0xd97b=function(_0x4242f6,_0x11f78b){_0x4242f6=_0x4242f6-0x0;var _0x3ec78b=_0x97bd[_0x4242f6];return _0x3ec78b;};'use strict';var EventEmitter=require(_0xd97b('0x0'));var FaxInteraction=require(_0xd97b('0x1'))['db'][_0xd97b('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xd97b('0x3')](0x0);var events={'afterCreate':_0xd97b('0x4'),'afterUpdate':_0xd97b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1abb36){return function(_0x2924f6,_0x436858,_0x270dab){_0x2924f6['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x10264f){_0x2924f6[_0xd97b('0x6')](_0xd97b('0x7'),_0x10264f['map'](function(_0x251267){return{'id':_0x251267['id']};}));return FaxMessage[_0xd97b('0x8')]({'where':{'FaxInteractionId':_0x2924f6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd97b('0x9')](function(_0x330feb){_0x2924f6[_0xd97b('0x6')]('unreadMessages',_0x330feb[_0xd97b('0xa')]);FaxInteractionEvents[_0xd97b('0xb')](_0x1abb36+':'+_0x2924f6['id'],_0x2924f6);FaxInteractionEvents[_0xd97b('0xb')](_0x1abb36,_0x2924f6);_0x270dab(null);})[_0xd97b('0xc')](_0x270dab(null));};}for(var e in events){if(events[_0xd97b('0xd')](e)){var event=events[e];FaxInteraction[_0xd97b('0xe')](e,emitEvent(event));}}module[_0xd97b('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 366c1a9..2a6a0c8 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 _0xd09b=['FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x59605e,_0xb51758){var _0x56807d=function(_0x5b6bcb){while(--_0x5b6bcb){_0x59605e['push'](_0x59605e['shift']());}};_0x56807d(++_0xb51758);}(_0xd09b,0x1da));var _0xbd09=function(_0x955d2e,_0x373a5b){_0x955d2e=_0x955d2e-0x0;var _0x3296bf=_0xd09b[_0x955d2e];return _0x3296bf;};'use strict';var _=require(_0xbd09('0x0'));var util=require(_0xbd09('0x1'));var logger=require(_0xbd09('0x2'))(_0xbd09('0x3'));var moment=require(_0xbd09('0x4'));var BPromise=require('bluebird');var rp=require(_0xbd09('0x5'));var fs=require('fs');var path=require(_0xbd09('0x6'));var rimraf=require(_0xbd09('0x7'));var config=require(_0xbd09('0x8'));var attributes=require(_0xbd09('0x9'));module[_0xbd09('0xa')]=function(_0x8c82ff,_0x180e27){return _0x8c82ff[_0xbd09('0xb')](_0xbd09('0xc'),attributes,{'tableName':_0xbd09('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1fe4d8,_0xe2400d,_0x2e9d78){if(_0x1fe4d8[_0xbd09('0xe')](_0xbd09('0xf'))){_0x1fe4d8[_0xbd09('0x10')]=moment()['format'](_0xbd09('0x11'));}_0x2e9d78(null,_0x1fe4d8);}}});}; \ No newline at end of file +var _0x0298=['bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x52b85b,_0x3ca7c3){var _0x3a651d=function(_0x1600e7){while(--_0x1600e7){_0x52b85b['push'](_0x52b85b['shift']());}};_0x3a651d(++_0x3ca7c3);}(_0x0298,0x1bb));var _0x8029=function(_0x26dda0,_0x5b58ab){_0x26dda0=_0x26dda0-0x0;var _0x41089c=_0x0298[_0x26dda0];return _0x41089c;};'use strict';var _=require(_0x8029('0x0'));var util=require(_0x8029('0x1'));var logger=require(_0x8029('0x2'))(_0x8029('0x3'));var moment=require(_0x8029('0x4'));var BPromise=require(_0x8029('0x5'));var rp=require(_0x8029('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8029('0x7'));var config=require(_0x8029('0x8'));var attributes=require(_0x8029('0x9'));module[_0x8029('0xa')]=function(_0x4aad74,_0x280ee6){return _0x4aad74[_0x8029('0xb')](_0x8029('0xc'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15bcfb,_0x2c06f0,_0xf2a880){if(_0x15bcfb[_0x8029('0xd')]('closed')){_0x15bcfb['closedAt']=moment()[_0x8029('0xe')](_0x8029('0xf'));}_0xf2a880(null,_0x15bcfb);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 2f3cf41..6f9068e 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 _0x8523=['info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request'];(function(_0x342696,_0x146f50){var _0x15b8e4=function(_0x591e2a){while(--_0x591e2a){_0x342696['push'](_0x342696['shift']());}};_0x15b8e4(++_0x146f50);}(_0x8523,0x139));var _0x3852=function(_0x453c9f,_0x563800){_0x453c9f=_0x453c9f-0x0;var _0x3b22d3=_0x8523[_0x453c9f];return _0x3b22d3;};'use strict';var _=require('lodash');var util=require(_0x3852('0x0'));var moment=require('moment');var BPromise=require(_0x3852('0x1'));var rs=require(_0x3852('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3852('0x3'))['db'];var utils=require(_0x3852('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3852('0x5'));var jayson=require(_0x3852('0x6'));var client=jayson[_0x3852('0x7')]['http']({'port':0x232a});config[_0x3852('0x8')]=_[_0x3852('0x9')](config[_0x3852('0x8')],{'host':_0x3852('0xa'),'port':0x18eb});var socket=require(_0x3852('0xb'))(new Redis(config['redis']));require(_0x3852('0xc'))[_0x3852('0xd')](socket);function respondWithRpcPromise(_0xb7eb6f,_0x4f52d2,_0x37e641){return new BPromise(function(_0x5cd596,_0x4c8ace){return client[_0x3852('0xe')](_0xb7eb6f,_0x37e641)['then'](function(_0x49249c){logger[_0x3852('0xf')](_0x3852('0x10'),_0x4f52d2,_0x3852('0x11'));logger[_0x3852('0x12')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4f52d2,_0x3852('0x11'),JSON[_0x3852('0x13')](_0x49249c));if(_0x49249c[_0x3852('0x14')]){if(_0x49249c['error'][_0x3852('0x15')]===0x1f4){logger[_0x3852('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x4f52d2,_0x49249c[_0x3852('0x14')][_0x3852('0x16')]);return _0x4c8ace(_0x49249c['error'][_0x3852('0x16')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x4f52d2,_0x49249c['error'][_0x3852('0x16')]);return _0x5cd596(_0x49249c[_0x3852('0x14')]['message']);}else{logger[_0x3852('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x4f52d2,'request\x20sent');_0x5cd596(_0x49249c['result']['message']);}})[_0x3852('0x17')](function(_0x8b5d91){logger[_0x3852('0x14')](_0x3852('0x10'),_0x4f52d2,_0x8b5d91);_0x4c8ace(_0x8b5d91);});});}exports[_0x3852('0x18')]=function(_0x5d6b37){var _0x2beca3=this;return new Promise(function(_0x4b7c35,_0x332d82){return db[_0x3852('0x19')][_0x3852('0x1a')](_0x5d6b37[_0x3852('0x1b')],{'raw':_0x5d6b37[_0x3852('0x1c')]?_0x5d6b37['options'][_0x3852('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d6b37[_0x3852('0x1c')]?_0x5d6b37['options'][_0x3852('0x1e')]||null:null,'attributes':_0x5d6b37[_0x3852('0x1c')]?_0x5d6b37[_0x3852('0x1c')][_0x3852('0x1f')]||null:null,'limit':_0x5d6b37[_0x3852('0x1c')]?_0x5d6b37[_0x3852('0x1c')][_0x3852('0x20')]||null:null})[_0x3852('0x21')](function(_0xd039e9){logger[_0x3852('0xf')]('UpdateFaxInteraction',_0x5d6b37);logger[_0x3852('0x12')](_0x3852('0x18'),_0x5d6b37,JSON[_0x3852('0x13')](_0xd039e9));_0x4b7c35(_0xd039e9);})[_0x3852('0x17')](function(_0x32b756){logger[_0x3852('0x14')](_0x3852('0x18'),_0x32b756[_0x3852('0x16')],_0x5d6b37);_0x332d82(_0x2beca3[_0x3852('0x14')](0x1f4,_0x32b756['message']));});});};exports[_0x3852('0x22')]=function(_0x24c3a1){return new Promise(function(_0x100e5b,_0x17149c){return db[_0x3852('0x19')][_0x3852('0x23')]({'where':_0x24c3a1[_0x3852('0x1c')]?_0x24c3a1[_0x3852('0x1c')][_0x3852('0x1e')]||null:null})[_0x3852('0x21')](function(_0x5f571c){if(_0x5f571c){return _0x5f571c[_0x3852('0x24')](_0x24c3a1[_0x3852('0x1b')][_0x3852('0x25')],_[_0x3852('0x26')](_0x24c3a1[_0x3852('0x1b')],[_0x3852('0x25'),'id'])||{});}})[_0x3852('0x27')](function(_0x1fdef0){logger[_0x3852('0xf')]('AddTags',_0x24c3a1);logger[_0x3852('0x12')](_0x3852('0x28'),_0x24c3a1,JSON[_0x3852('0x13')](_0x1fdef0));_0x100e5b(_0x1fdef0);})[_0x3852('0x17')](function(_0x334a39){logger[_0x3852('0x14')](_0x3852('0x28'),_0x334a39[_0x3852('0x16')],_0x24c3a1);_0x17149c(_this['error'](0x1f4,_0x334a39['message']));});});}; \ No newline at end of file +var _0xa051=['defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','FaxInteraction,\x20%s,\x20%s','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','limit','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x2f5478,_0x2d3fb3){var _0x2974d4=function(_0x2d6678){while(--_0x2d6678){_0x2f5478['push'](_0x2f5478['shift']());}};_0x2974d4(++_0x2d3fb3);}(_0xa051,0xfc));var _0x1a05=function(_0x24fe78,_0x302e7f){_0x24fe78=_0x24fe78-0x0;var _0x355365=_0xa051[_0x24fe78];return _0x355365;};'use strict';var _=require(_0x1a05('0x0'));var util=require(_0x1a05('0x1'));var moment=require('moment');var BPromise=require(_0x1a05('0x2'));var rs=require(_0x1a05('0x3'));var fs=require('fs');var Redis=require(_0x1a05('0x4'));var db=require(_0x1a05('0x5'))['db'];var utils=require(_0x1a05('0x6'));var logger=require(_0x1a05('0x7'))(_0x1a05('0x8'));var config=require(_0x1a05('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1a05('0xa')]['http']({'port':0x232a});config[_0x1a05('0xb')]=_[_0x1a05('0xc')](config[_0x1a05('0xb')],{'host':_0x1a05('0xd'),'port':0x18eb});var socket=require(_0x1a05('0xe'))(new Redis(config[_0x1a05('0xb')]));require(_0x1a05('0xf'))[_0x1a05('0x10')](socket);function respondWithRpcPromise(_0x3cb48e,_0x2eed13,_0x10af0d){return new BPromise(function(_0x5c868b,_0x47927e){return client[_0x1a05('0x11')](_0x3cb48e,_0x10af0d)[_0x1a05('0x12')](function(_0x1eb248){logger[_0x1a05('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x2eed13,'request\x20sent');logger[_0x1a05('0x14')](_0x1a05('0x15'),_0x2eed13,_0x1a05('0x16'),JSON['stringify'](_0x1eb248));if(_0x1eb248['error']){if(_0x1eb248[_0x1a05('0x17')][_0x1a05('0x18')]===0x1f4){logger[_0x1a05('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x2eed13,_0x1eb248[_0x1a05('0x17')][_0x1a05('0x19')]);return _0x47927e(_0x1eb248[_0x1a05('0x17')][_0x1a05('0x19')]);}logger[_0x1a05('0x17')](_0x1a05('0x1a'),_0x2eed13,_0x1eb248[_0x1a05('0x17')][_0x1a05('0x19')]);return _0x5c868b(_0x1eb248[_0x1a05('0x17')][_0x1a05('0x19')]);}else{logger[_0x1a05('0x13')](_0x1a05('0x1a'),_0x2eed13,_0x1a05('0x16'));_0x5c868b(_0x1eb248[_0x1a05('0x1b')][_0x1a05('0x19')]);}})[_0x1a05('0x1c')](function(_0x422ca2){logger['error'](_0x1a05('0x1a'),_0x2eed13,_0x422ca2);_0x47927e(_0x422ca2);});});}exports[_0x1a05('0x1d')]=function(_0x100074){var _0x5b9e12=this;return new Promise(function(_0x51c1ad,_0x1e853c){return db[_0x1a05('0x1e')][_0x1a05('0x1f')](_0x100074[_0x1a05('0x20')],{'raw':_0x100074['options']?_0x100074[_0x1a05('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x100074['options']?_0x100074[_0x1a05('0x21')][_0x1a05('0x22')]||null:null,'attributes':_0x100074[_0x1a05('0x21')]?_0x100074[_0x1a05('0x21')]['attributes']||null:null,'limit':_0x100074['options']?_0x100074[_0x1a05('0x21')][_0x1a05('0x23')]||null:null})['then'](function(_0x3a16dc){logger['info'](_0x1a05('0x1d'),_0x100074);logger[_0x1a05('0x14')]('UpdateFaxInteraction',_0x100074,JSON[_0x1a05('0x24')](_0x3a16dc));_0x51c1ad(_0x3a16dc);})[_0x1a05('0x1c')](function(_0x3f29b4){logger[_0x1a05('0x17')](_0x1a05('0x1d'),_0x3f29b4[_0x1a05('0x19')],_0x100074);_0x1e853c(_0x5b9e12[_0x1a05('0x17')](0x1f4,_0x3f29b4[_0x1a05('0x19')]));});});};exports[_0x1a05('0x25')]=function(_0x519e2e){return new Promise(function(_0xc419e2,_0x571486){return db[_0x1a05('0x1e')][_0x1a05('0x26')]({'where':_0x519e2e['options']?_0x519e2e['options'][_0x1a05('0x22')]||null:null})[_0x1a05('0x12')](function(_0x3b7328){if(_0x3b7328){return _0x3b7328[_0x1a05('0x27')](_0x519e2e['body'][_0x1a05('0x28')],_[_0x1a05('0x29')](_0x519e2e[_0x1a05('0x20')],[_0x1a05('0x28'),'id'])||{});}})[_0x1a05('0x2a')](function(_0x1bfb8f){logger[_0x1a05('0x13')](_0x1a05('0x2b'),_0x519e2e);logger[_0x1a05('0x14')]('AddTags',_0x519e2e,JSON[_0x1a05('0x24')](_0x1bfb8f));_0xc419e2(_0x1bfb8f);})['catch'](function(_0x42fd2f){logger[_0x1a05('0x17')](_0x1a05('0x2b'),_0x42fd2f[_0x1a05('0x19')],_0x519e2e);_0x571486(_this[_0x1a05('0x17')](0x1f4,_0x42fd2f[_0x1a05('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 0af7ad6..54acb0f 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 _0xcfa7=['faxInteraction:','./faxInteraction.events','remove','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcfa7,0x1b3));var _0x7cfa=function(_0xf9f597,_0x980181){_0xf9f597=_0xf9f597-0x0;var _0x447f0a=_0xcfa7[_0xf9f597];return _0x447f0a;};'use strict';var FaxInteractionEvents=require(_0x7cfa('0x0'));var events=['save',_0x7cfa('0x1'),'update'];function createListener(_0x1d2e45,_0x12c7a2){return function(_0x1f4b90){_0x12c7a2[_0x7cfa('0x2')](_0x1d2e45,_0x1f4b90);};}function removeListener(_0x429006,_0x26cb4e){return function(){FaxInteractionEvents[_0x7cfa('0x3')](_0x429006,_0x26cb4e);};}exports[_0x7cfa('0x4')]=function(_0x347d1a){for(var _0x2d26b6=0x0,_0x54ba8c=events[_0x7cfa('0x5')];_0x2d26b6<_0x54ba8c;_0x2d26b6++){var _0x4ec15e=events[_0x2d26b6];var _0x3035b2=createListener(_0x7cfa('0x6')+_0x4ec15e,_0x347d1a);FaxInteractionEvents['on'](_0x4ec15e,_0x3035b2);}}; \ No newline at end of file +var _0xc32a=['remove','update','register','length','faxInteraction:','./faxInteraction.events'];(function(_0xda863e,_0x4d7562){var _0x30acff=function(_0x4b5ea4){while(--_0x4b5ea4){_0xda863e['push'](_0xda863e['shift']());}};_0x30acff(++_0x4d7562);}(_0xc32a,0x65));var _0xac32=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0xc32a[_0x525af9];return _0x129fbf;};'use strict';var FaxInteractionEvents=require(_0xac32('0x0'));var events=['save',_0xac32('0x1'),_0xac32('0x2')];function createListener(_0x330e26,_0x2711a3){return function(_0x508bea){_0x2711a3['emit'](_0x330e26,_0x508bea);};}function removeListener(_0x37f7dd,_0x254999){return function(){FaxInteractionEvents['removeListener'](_0x37f7dd,_0x254999);};}exports[_0xac32('0x3')]=function(_0x5bb2a8){for(var _0x25d749=0x0,_0x163a6b=events[_0xac32('0x4')];_0x25d749<_0x163a6b;_0x25d749++){var _0x25f46d=events[_0x25d749];var _0x445abd=createListener(_0xac32('0x5')+_0x25f46d,_0x5bb2a8);FaxInteractionEvents['on'](_0x25f46d,_0x445abd);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 468eac3..b40550c 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 _0x3a4d=['post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','removeTags','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','describe','isAuthenticated','show','/:id/messages','getMessages'];(function(_0x53ddb3,_0x5ee378){var _0x8d40fb=function(_0xca3010){while(--_0xca3010){_0x53ddb3['push'](_0x53ddb3['shift']());}};_0x8d40fb(++_0x5ee378);}(_0x3a4d,0x1e8));var _0xd3a4=function(_0x59c765,_0x1b14cb){_0x59c765=_0x59c765-0x0;var _0x731b6d=_0x3a4d[_0x59c765];return _0x731b6d;};'use strict';var multer=require(_0xd3a4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd3a4('0x1'));var express=require(_0xd3a4('0x2'));var router=express[_0xd3a4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd3a4('0x4'));var interaction=require(_0xd3a4('0x5'));var config=require(_0xd3a4('0x6'));var controller=require(_0xd3a4('0x7'));router[_0xd3a4('0x8')]('/',auth['isAuthenticated'](),controller[_0xd3a4('0x9')]);router['get'](_0xd3a4('0xa'),auth['isAuthenticated'](),controller[_0xd3a4('0xb')]);router[_0xd3a4('0x8')]('/:id',auth[_0xd3a4('0xc')](),controller[_0xd3a4('0xd')]);router[_0xd3a4('0x8')](_0xd3a4('0xe'),auth['isAuthenticated'](),controller[_0xd3a4('0xf')]);router['get']('/:id/download',auth[_0xd3a4('0xc')](),controller['download']);router[_0xd3a4('0x10')]('/',auth[_0xd3a4('0xc')](),controller[_0xd3a4('0x11')]);router['post'](_0xd3a4('0xe'),auth[_0xd3a4('0xc')](),controller[_0xd3a4('0x12')]);router['post'](_0xd3a4('0x13'),auth[_0xd3a4('0xc')](),interaction[_0xd3a4('0x14')](_0xd3a4('0x15'),_0xd3a4('0x16')),controller[_0xd3a4('0x17')]);router[_0xd3a4('0x18')](_0xd3a4('0x19'),auth[_0xd3a4('0xc')](),interaction[_0xd3a4('0x14')]('fax',_0xd3a4('0x1a')),controller['update']);router['delete'](_0xd3a4('0x19'),auth[_0xd3a4('0xc')](),interaction[_0xd3a4('0x14')](_0xd3a4('0x15'),'faxinteraction:destroy'),controller['destroy']);router['delete'](_0xd3a4('0x13'),auth[_0xd3a4('0xc')](),controller[_0xd3a4('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x06ca=['/:id/messages','getMessages','post','addMessage','tracked','faxinteraction:addtags','put','/:id','fax','update','delete','/:id/tags','multer','util','express','Router','fs-extra','../../components/auth/service','./faxInteraction.controller','get','isAuthenticated','describe','show'];(function(_0x5d4f0d,_0x524902){var _0x1fd99a=function(_0x5f0493){while(--_0x5f0493){_0x5d4f0d['push'](_0x5d4f0d['shift']());}};_0x1fd99a(++_0x524902);}(_0x06ca,0xad));var _0xa06c=function(_0x4201ee,_0x521fc2){_0x4201ee=_0x4201ee-0x0;var _0x525154=_0x06ca[_0x4201ee];return _0x525154;};'use strict';var multer=require(_0xa06c('0x0'));var util=require(_0xa06c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa06c('0x2'));var router=express[_0xa06c('0x3')]();var fs_extra=require(_0xa06c('0x4'));var auth=require(_0xa06c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa06c('0x6'));router[_0xa06c('0x7')]('/',auth[_0xa06c('0x8')](),controller['index']);router[_0xa06c('0x7')]('/describe',auth[_0xa06c('0x8')](),controller[_0xa06c('0x9')]);router[_0xa06c('0x7')]('/:id',auth[_0xa06c('0x8')](),controller[_0xa06c('0xa')]);router[_0xa06c('0x7')](_0xa06c('0xb'),auth[_0xa06c('0x8')](),controller[_0xa06c('0xc')]);router[_0xa06c('0x7')]('/:id/download',auth[_0xa06c('0x8')](),controller['download']);router[_0xa06c('0xd')]('/',auth[_0xa06c('0x8')](),controller['create']);router[_0xa06c('0xd')](_0xa06c('0xb'),auth[_0xa06c('0x8')](),controller[_0xa06c('0xe')]);router[_0xa06c('0xd')]('/:id/tags',auth[_0xa06c('0x8')](),interaction[_0xa06c('0xf')]('fax',_0xa06c('0x10')),controller['addTags']);router[_0xa06c('0x11')](_0xa06c('0x12'),auth[_0xa06c('0x8')](),interaction[_0xa06c('0xf')](_0xa06c('0x13'),'faxinteraction:update'),controller[_0xa06c('0x14')]);router[_0xa06c('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0xa06c('0xf')](_0xa06c('0x13'),'faxinteraction:destroy'),controller['destroy']);router['delete'](_0xa06c('0x16'),auth[_0xa06c('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index b97dbed..a55ebc6 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 _0x615a=['TEXT','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x388bfa,_0x1f518c){var _0x11d6a6=function(_0x40b0b3){while(--_0x40b0b3){_0x388bfa['push'](_0x388bfa['shift']());}};_0x11d6a6(++_0x1f518c);}(_0x615a,0x119));var _0xa615=function(_0x3fd27c,_0x291768){_0x3fd27c=_0x3fd27c-0x0;var _0x35f210=_0x615a[_0x3fd27c];return _0x35f210;};'use strict';var Sequelize=require(_0xa615('0x0'));module['exports']={'body':{'type':Sequelize[_0xa615('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa615('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa615('0x3')]('in',_0xa615('0x4')),'defaultValue':_0xa615('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xa615('0x5')]}}; \ No newline at end of file +var _0x61a5=['out','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x195ce8,_0x5bf2df){var _0x3446df=function(_0x1eab6b){while(--_0x1eab6b){_0x195ce8['push'](_0x195ce8['shift']());}};_0x3446df(++_0x5bf2df);}(_0x61a5,0xf0));var _0x561a=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0x61a5[_0x3a2118];return _0x1d181d;};'use strict';var Sequelize=require(_0x561a('0x0'));module['exports']={'body':{'type':Sequelize[_0x561a('0x1')](_0x561a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x561a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x561a('0x4')]('in',_0x561a('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x561a('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x561a('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 1f46cda..4e66172 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 _0xbb2d=['message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','sendStatus','stack','name','send','map','FaxMessage','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','body','describe','accept','sms','fax','acceptMessage','reject','UserId','agent','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','interface','SIP/%s','channel','EventManager','rejectmessage','create','CmContact','findOne','isNil','AttachmentId','SendFax','format','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','Attachment','basename','util','path','lodash','../../components/interaction/service','../../config/logger','api','../../mysqldb','redis','./faxMessage.socket','register','jayson/promise','client','http','fax-interactions','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xbb2d,0x14d));var _0xdbb2=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0xbb2d[_0x47a40b];return _0x19610c;};'use strict';var util=require(_0xdbb2('0x0'));var path=require(_0xdbb2('0x1'));var _=require(_0xdbb2('0x2'));var Redis=require('ioredis');var interactionService=require(_0xdbb2('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xdbb2('0x4'))(_0xdbb2('0x5'));var config=require('../../config/environment');var db=require(_0xdbb2('0x6'))['db'];config['redis']=_['defaults'](config[_0xdbb2('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdbb2('0x7')]));require(_0xdbb2('0x8'))[_0xdbb2('0x9')](socket);var jayson=require(_0xdbb2('0xa'));var client=jayson[_0xdbb2('0xb')][_0xdbb2('0xc')]({'port':0x232c});var client9002=jayson['client'][_0xdbb2('0xc')]({'port':0x232a});var interaction_log=require(_0xdbb2('0x4'))(_0xdbb2('0xd'));function respondWithRpcPromise(_0x6efa8f,_0x24b7ed,_0x473f38,_0x364ad8){return new Promise(function(_0x1c0286,_0x340a14){var _0x5cbb18=_0x364ad8||client;return _0x5cbb18['request'](_0x6efa8f,_0x473f38)[_0xdbb2('0xe')](function(_0xb0e45f){logger[_0xdbb2('0xf')](_0xdbb2('0x10'),_0x24b7ed,_0xdbb2('0x11'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x24b7ed,_0xdbb2('0x11'),JSON[_0xdbb2('0x12')](_0xb0e45f));if(_0xb0e45f[_0xdbb2('0x13')]){if(_0xb0e45f[_0xdbb2('0x13')][_0xdbb2('0x14')]===0x1f4){logger[_0xdbb2('0x13')](_0xdbb2('0x10'),_0x24b7ed,_0xb0e45f[_0xdbb2('0x13')][_0xdbb2('0x15')]);return _0x340a14(_0xb0e45f[_0xdbb2('0x13')][_0xdbb2('0x15')]);}logger[_0xdbb2('0x13')](_0xdbb2('0x10'),_0x24b7ed,_0xb0e45f[_0xdbb2('0x13')]['message']);return _0x1c0286(_0xb0e45f[_0xdbb2('0x13')]['message']);}else{logger[_0xdbb2('0xf')](_0xdbb2('0x10'),_0x24b7ed,_0xdbb2('0x11'));_0x1c0286(_0xb0e45f[_0xdbb2('0x16')][_0xdbb2('0x15')]);}})['catch'](function(_0x51614d){logger[_0xdbb2('0x13')](_0xdbb2('0x10'),_0x24b7ed,_0x51614d);_0x340a14(_0x51614d);});});}function respondWithResult(_0xce76ff,_0x58c4ae){_0x58c4ae=_0x58c4ae||0xc8;return function(_0xcdac2d){if(_0xcdac2d){return _0xce76ff[_0xdbb2('0x17')](_0x58c4ae)[_0xdbb2('0x18')](_0xcdac2d);}};}function respondWithFilteredResult(_0x1bbf4a,_0x1bd048){return function(_0x43901b){if(_0x43901b){var _0xe39a20=typeof _0x1bd048[_0xdbb2('0x19')]===_0xdbb2('0x1a')&&typeof _0x1bd048[_0xdbb2('0x1b')]===_0xdbb2('0x1a');var _0x4d4585=_0x43901b[_0xdbb2('0x1c')];var _0x1080ce=_0xe39a20?0x0:_0x1bd048[_0xdbb2('0x19')];var _0xe49039=_0xe39a20?_0x43901b[_0xdbb2('0x1c')]:_0x1bd048[_0xdbb2('0x19')]+_0x1bd048['limit'];var _0x19030b;if(_0xe49039>=_0x4d4585){_0xe49039=_0x4d4585;_0x19030b=0xc8;}else{_0x19030b=0xce;}_0x1bbf4a[_0xdbb2('0x17')](_0x19030b);return _0x1bbf4a[_0xdbb2('0x1d')](_0xdbb2('0x1e'),_0x1080ce+'-'+_0xe49039+'/'+_0x4d4585)['json'](_0x43901b);}return null;};}function saveUpdates(_0x3f5871){return function(_0x34f0f7){if(_0x34f0f7){return _0x34f0f7[_0xdbb2('0x1f')](_0x3f5871)[_0xdbb2('0xe')](function(_0x1e5ee4){return _0x1e5ee4;});}return null;};}function removeEntity(_0x280a85){return function(_0x19beca){if(_0x19beca){return _0x19beca[_0xdbb2('0x20')]()['then'](function(){_0x280a85[_0xdbb2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ed2b9){return function(_0x29d652){if(!_0x29d652){_0x3ed2b9[_0xdbb2('0x21')](0x194);}return _0x29d652;};}function handleError(_0xc561f4,_0x1f2e43){_0x1f2e43=_0x1f2e43||0x1f4;return function(_0x468605){logger[_0xdbb2('0x13')](_0x468605[_0xdbb2('0x22')]);if(_0x468605['name']){delete _0x468605[_0xdbb2('0x23')];}_0xc561f4['status'](_0x1f2e43)[_0xdbb2('0x24')](_0x468605);};}exports['index']=function(_0x59adc3,_0x1e1415){var _0x488a53={},_0x1f7fdc={},_0x3a3a82={'count':0x0,'rows':[]};var _0x329e0f=_[_0xdbb2('0x25')](db[_0xdbb2('0x26')][_0xdbb2('0x27')],function(_0x489b4e){return{'name':_0x489b4e[_0xdbb2('0x28')],'type':_0x489b4e[_0xdbb2('0x29')][_0xdbb2('0x2a')]};});_0x1f7fdc[_0xdbb2('0x2b')]=_[_0xdbb2('0x25')](_0x329e0f,_0xdbb2('0x23'));_0x1f7fdc['query']=_['keys'](_0x59adc3['query']);_0x1f7fdc[_0xdbb2('0x2c')]=_[_0xdbb2('0x2d')](_0x1f7fdc[_0xdbb2('0x2b')],_0x1f7fdc['query']);_0x488a53[_0xdbb2('0x2e')]=_[_0xdbb2('0x2d')](_0x1f7fdc[_0xdbb2('0x2b')],qs[_0xdbb2('0x2f')](_0x59adc3[_0xdbb2('0x30')][_0xdbb2('0x2f')]));_0x488a53[_0xdbb2('0x2e')]=_0x488a53[_0xdbb2('0x2e')][_0xdbb2('0x31')]?_0x488a53['attributes']:_0x1f7fdc['model'];if(!_0x59adc3['query'][_0xdbb2('0x32')](_0xdbb2('0x33'))){_0x488a53[_0xdbb2('0x1b')]=qs[_0xdbb2('0x1b')](_0x59adc3['query'][_0xdbb2('0x1b')]);_0x488a53[_0xdbb2('0x19')]=qs[_0xdbb2('0x19')](_0x59adc3[_0xdbb2('0x30')][_0xdbb2('0x19')]);}_0x488a53[_0xdbb2('0x34')]=qs[_0xdbb2('0x35')](_0x59adc3['query'][_0xdbb2('0x35')]);_0x488a53[_0xdbb2('0x36')]=qs[_0xdbb2('0x2c')](_[_0xdbb2('0x37')](_0x59adc3['query'],_0x1f7fdc[_0xdbb2('0x2c')]),_0x329e0f);if(_0x59adc3[_0xdbb2('0x30')][_0xdbb2('0x38')]){_0x488a53[_0xdbb2('0x36')]=_['merge'](_0x488a53['where'],{'$or':_[_0xdbb2('0x25')](_0x329e0f,function(_0x318678){if(_0x318678[_0xdbb2('0x29')]!==_0xdbb2('0x39')){var _0x183776={};_0x183776[_0x318678[_0xdbb2('0x23')]]={'$like':'%'+_0x59adc3[_0xdbb2('0x30')]['filter']+'%'};return _0x183776;}})});}_0x488a53=_[_0xdbb2('0x3a')]({},_0x488a53,_0x59adc3['options']);var _0x36801c={'where':_0x488a53[_0xdbb2('0x36')]};return db[_0xdbb2('0x26')]['count'](_0x36801c)[_0xdbb2('0xe')](function(_0x252d44){_0x3a3a82[_0xdbb2('0x1c')]=_0x252d44;if(_0x59adc3['query'][_0xdbb2('0x3b')]){_0x488a53[_0xdbb2('0x3c')]=[{'all':!![]}];}return db['FaxMessage'][_0xdbb2('0x3d')](_0x488a53);})[_0xdbb2('0xe')](function(_0x33d023){_0x3a3a82[_0xdbb2('0x3e')]=_0x33d023;return _0x3a3a82;})[_0xdbb2('0xe')](respondWithFilteredResult(_0x1e1415,_0x488a53))[_0xdbb2('0x3f')](handleError(_0x1e1415,null));};exports[_0xdbb2('0x40')]=function(_0x20b8fc,_0x22cb34){var _0x3224d6={'raw':!![],'where':{'id':_0x20b8fc[_0xdbb2('0x41')]['id']}},_0x44e344={};_0x44e344[_0xdbb2('0x2b')]=_[_0xdbb2('0x42')](db['FaxMessage']['rawAttributes']);_0x44e344[_0xdbb2('0x30')]=_[_0xdbb2('0x42')](_0x20b8fc[_0xdbb2('0x30')]);_0x44e344[_0xdbb2('0x2c')]=_[_0xdbb2('0x2d')](_0x44e344['model'],_0x44e344[_0xdbb2('0x30')]);_0x3224d6[_0xdbb2('0x2e')]=_['intersection'](_0x44e344['model'],qs[_0xdbb2('0x2f')](_0x20b8fc[_0xdbb2('0x30')]['fields']));_0x3224d6[_0xdbb2('0x2e')]=_0x3224d6[_0xdbb2('0x2e')]['length']?_0x3224d6[_0xdbb2('0x2e')]:_0x44e344[_0xdbb2('0x2b')];if(_0x20b8fc[_0xdbb2('0x30')]['includeAll']){_0x3224d6[_0xdbb2('0x3c')]=[{'all':!![]}];}_0x3224d6=_['merge']({},_0x3224d6,_0x20b8fc[_0xdbb2('0x43')]);return db[_0xdbb2('0x26')][_0xdbb2('0x44')](_0x3224d6)[_0xdbb2('0xe')](handleEntityNotFound(_0x22cb34,null))[_0xdbb2('0xe')](respondWithResult(_0x22cb34,null))['catch'](handleError(_0x22cb34,null));};exports[_0xdbb2('0x1f')]=function(_0x5f18d5,_0x90b89e){if(_0x5f18d5[_0xdbb2('0x45')]['id']){delete _0x5f18d5[_0xdbb2('0x45')]['id'];}return db[_0xdbb2('0x26')][_0xdbb2('0x44')]({'where':{'id':_0x5f18d5['params']['id']}})[_0xdbb2('0xe')](handleEntityNotFound(_0x90b89e,null))[_0xdbb2('0xe')](saveUpdates(_0x5f18d5['body'],null))[_0xdbb2('0xe')](respondWithResult(_0x90b89e,null))[_0xdbb2('0x3f')](handleError(_0x90b89e,null));};exports[_0xdbb2('0x20')]=function(_0x405b80,_0x330b66){return db['FaxMessage'][_0xdbb2('0x44')]({'where':{'id':_0x405b80[_0xdbb2('0x41')]['id']}})[_0xdbb2('0xe')](handleEntityNotFound(_0x330b66,null))[_0xdbb2('0xe')](removeEntity(_0x330b66,null))[_0xdbb2('0x3f')](handleError(_0x330b66,null));};exports['describe']=function(_0x4bac8e,_0x48b030){return db[_0xdbb2('0x26')][_0xdbb2('0x46')]()[_0xdbb2('0xe')](respondWithResult(_0x48b030,null))[_0xdbb2('0x3f')](handleError(_0x48b030,null));};exports[_0xdbb2('0x47')]=function(_0x10d1cf,_0x7001a9){var _0x53e710=_0xdbb2('0x48');return interactionService['acceptMessage'](_0x10d1cf,_0x53e710)['then'](respondWithResult(_0x7001a9,null))[_0xdbb2('0x3f')](handleError(_0x7001a9,null));};exports['accept']=function(_0x4669ff,_0x35a871){var _0xd7014=_0xdbb2('0x49');return interactionService[_0xdbb2('0x4a')](_0x4669ff,_0xd7014)[_0xdbb2('0xe')](respondWithResult(_0x35a871,null))[_0xdbb2('0x3f')](handleError(_0x35a871,null));};exports[_0xdbb2('0x4b')]=function(_0x2b0763,_0x2810a9){var _0x4b1936={'agent':{},'channel':'fax'};if(_0x2b0763[_0xdbb2('0x45')]['id']){delete _0x2b0763[_0xdbb2('0x45')]['id'];}_0x2b0763[_0xdbb2('0x45')][_0xdbb2('0x4c')]=_0x2b0763[_0xdbb2('0x45')][_0xdbb2('0x4c')]||_0x2b0763['user']['id'];_0x4b1936[_0xdbb2('0x4d')]['id']=_0x2b0763[_0xdbb2('0x45')][_0xdbb2('0x4c')];return db[_0xdbb2('0x26')][_0xdbb2('0x44')]({'where':{'id':_0x2b0763[_0xdbb2('0x41')]['id'],'UserId':null}})[_0xdbb2('0xe')](handleEntityNotFound(_0x2810a9,null))[_0xdbb2('0xe')](function(_0x20e8c8){if(_0x20e8c8){_0x4b1936['message']=_0x20e8c8[_0xdbb2('0x4e')]({'plain':!![]});return db[_0xdbb2('0x4f')][_0xdbb2('0x44')]({'where':{'id':_0x20e8c8[_0xdbb2('0x50')]}});}return null;})['then'](handleEntityNotFound(_0x2810a9,null))[_0xdbb2('0xe')](function(_0x4decc6){if(_0x4decc6){_0x4b1936[_0xdbb2('0x51')]=_0x4decc6['get']({'plain':!![]});interaction_log[_0xdbb2('0xf')](_0xdbb2('0x52'),_0x2b0763[_0xdbb2('0x53')]['id'],_0x2b0763[_0xdbb2('0x53')][_0xdbb2('0x23')],_0x2b0763[_0xdbb2('0x53')][_0xdbb2('0x54')],_0x4b1936[_0xdbb2('0x51')]['id'],_0x2b0763['body']?JSON['stringify'](_0x2b0763[_0xdbb2('0x45')]):_0xdbb2('0x55'));return respondWithRpcPromise(_0xdbb2('0x56'),_0xdbb2('0x57'),_0x4b1936);}return null;})[_0xdbb2('0xe')](function(_0x2771b1){var _0x192df8=_0xdbb2('0x58')+_0x2771b1[_0xdbb2('0x15')][_0xdbb2('0x59')];return db[_0xdbb2('0x5a')][_0xdbb2('0x30')](_0x192df8,{'type':db[_0xdbb2('0x5b')][_0xdbb2('0x5c')][_0xdbb2('0x5d')],'raw':!![]})['then'](function(_0x4f1e7c){return _0x4f1e7c;});})[_0xdbb2('0xe')](function(_0x4b758f){if(_0x4b758f){_0x4b1936['message']['contact']=_0x4b758f[0x0];if(!_0x2b0763['body'][_0xdbb2('0x4c')])return;return db[_0xdbb2('0x5e')][_0xdbb2('0x44')]({'where':{'id':_0x2b0763[_0xdbb2('0x45')]['UserId'],'role':'agent'},'attributes':['id',_0xdbb2('0x23'),_0xdbb2('0x5f'),'email',_0xdbb2('0x60')],'raw':!![]});}return null;})[_0xdbb2('0xe')](function(_0x210c6d){if(!_0x210c6d)return null;_0x4b1936['message'][_0xdbb2('0x4d')]=_0x210c6d;return _0x4b1936;})[_0xdbb2('0xe')](function(_0x34fb91){if(_0x34fb91){_0x34fb91[_0xdbb2('0x15')][_0xdbb2('0x61')]=util['format'](_0xdbb2('0x62'),_0x2b0763['user'][_0xdbb2('0x23')]);_0x34fb91[_0xdbb2('0x15')][_0xdbb2('0x63')]=_0x4b1936['channel'];_0x34fb91['message']['motionChannel']=_0x4b1936['channel'];_0x34fb91[_0xdbb2('0x15')]['event']='reject';respondWithRpcPromise(_0xdbb2('0x64'),_0xdbb2('0x64'),{'event':_0xdbb2('0x65'),'message':_0x34fb91['message']},client9002);return _0x4b1936;}return null;})[_0xdbb2('0xe')](respondWithResult(_0x2810a9,null))[_0xdbb2('0x3f')](handleError(_0x2810a9,null));};exports[_0xdbb2('0x66')]=function(_0x2e0fe7,_0x48d5af){var _0x3cbb08;return db[_0xdbb2('0x26')]['create'](_0x2e0fe7['body'],{})['then'](function(_0x15be68){_0x3cbb08=_0x15be68;return db[_0xdbb2('0x67')][_0xdbb2('0x68')]({'where':{'id':_0x3cbb08['ContactId']}});})[_0xdbb2('0xe')](function(_0x211e77){if(_[_0xdbb2('0x69')](_0x211e77)){return;}else{_0x3cbb08[_0xdbb2('0x49')]=_0x211e77[_0xdbb2('0x49')];return db['Attachment'][_0xdbb2('0x68')]({'where':{'id':_0x3cbb08[_0xdbb2('0x6a')]}});}})[_0xdbb2('0xe')](function(_0x14a028){return respondWithRpcPromise(_0xdbb2('0x6b'),_0xdbb2('0x6b'),{'FaxAccountId':_[_0xdbb2('0x69')](_0x2e0fe7['body'])?undefined:_0x2e0fe7[_0xdbb2('0x45')]['FaxAccountId'],'path':_[_0xdbb2('0x69')](_0x14a028)?undefined:util[_0xdbb2('0x6c')](_0xdbb2('0x6d'),_0x14a028['basename']),'fax':_[_0xdbb2('0x69')](_0x3cbb08[_0xdbb2('0x49')])?undefined:_0x3cbb08[_0xdbb2('0x49')],'AttachmentId':_0x3cbb08['AttachmentId']},client9002);})[_0xdbb2('0xe')](respondWithResult(_0x48d5af,0xc9))['catch'](handleError(_0x48d5af,null));};exports[_0xdbb2('0x6e')]=function(_0x1abcf2,_0x2a42d2){var _0x2cf3bc=path[_0xdbb2('0x6f')](config[_0xdbb2('0x70')],_0xdbb2('0x71'),_0xdbb2('0x72'),_0xdbb2('0x73'));return db[_0xdbb2('0x26')][_0xdbb2('0x44')]({'where':{'id':_0x1abcf2[_0xdbb2('0x41')]['id']},'include':[{'model':db['Attachment'],'as':_0xdbb2('0x74')}]})[_0xdbb2('0xe')](handleEntityNotFound(_0x2a42d2,null))[_0xdbb2('0xe')](function(_0x2e4e51){if(_0x2e4e51){return _0x2a42d2[_0xdbb2('0x6e')](path['join'](_0x2cf3bc,_0x2e4e51['Attachment'][_0xdbb2('0x75')]));}})['catch'](handleError(_0x2a42d2,null));}; \ No newline at end of file +var _0x0bfd=['FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','name','send','index','map','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FaxMessage','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','body','describe','accept','sms','acceptMessage','fax','UserId','user','agent','FaxInteraction','FaxInteractionId','interaction','get','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','format','SIP/%s','channel','motionChannel','event','reject','EventManager','rejectmessage','create','CmContact','findOne','ContactId','isNil','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','attachments','Attachment','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','fax-interactions','request','then','info','request\x20sent','debug'];(function(_0x1a03e8,_0x388ffc){var _0x37fbfc=function(_0x1fb7ae){while(--_0x1fb7ae){_0x1a03e8['push'](_0x1a03e8['shift']());}};_0x37fbfc(++_0x388ffc);}(_0x0bfd,0xdf));var _0xd0bf=function(_0x4a79b8,_0x23163f){_0x4a79b8=_0x4a79b8-0x0;var _0xc03275=_0x0bfd[_0x4a79b8];return _0xc03275;};'use strict';var util=require('util');var path=require(_0xd0bf('0x0'));var _=require(_0xd0bf('0x1'));var Redis=require(_0xd0bf('0x2'));var interactionService=require(_0xd0bf('0x3'));var qs=require(_0xd0bf('0x4'));var logger=require(_0xd0bf('0x5'))('api');var config=require('../../config/environment');var db=require(_0xd0bf('0x6'))['db'];config[_0xd0bf('0x7')]=_[_0xd0bf('0x8')](config[_0xd0bf('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xd0bf('0x9'))(new Redis(config[_0xd0bf('0x7')]));require(_0xd0bf('0xa'))[_0xd0bf('0xb')](socket);var jayson=require(_0xd0bf('0xc'));var client=jayson[_0xd0bf('0xd')][_0xd0bf('0xe')]({'port':0x232c});var client9002=jayson[_0xd0bf('0xd')][_0xd0bf('0xe')]({'port':0x232a});var interaction_log=require(_0xd0bf('0x5'))(_0xd0bf('0xf'));function respondWithRpcPromise(_0x17fa41,_0x22aff4,_0x57584c,_0xf3b2e1){return new Promise(function(_0x346ab6,_0x541b08){var _0x2b85a4=_0xf3b2e1||client;return _0x2b85a4[_0xd0bf('0x10')](_0x17fa41,_0x57584c)[_0xd0bf('0x11')](function(_0x32dcbc){logger[_0xd0bf('0x12')]('FaxMessage,\x20%s,\x20%s',_0x22aff4,_0xd0bf('0x13'));logger[_0xd0bf('0x14')](_0xd0bf('0x15'),_0x22aff4,_0xd0bf('0x13'),JSON[_0xd0bf('0x16')](_0x32dcbc));if(_0x32dcbc[_0xd0bf('0x17')]){if(_0x32dcbc[_0xd0bf('0x17')][_0xd0bf('0x18')]===0x1f4){logger[_0xd0bf('0x17')](_0xd0bf('0x19'),_0x22aff4,_0x32dcbc['error'][_0xd0bf('0x1a')]);return _0x541b08(_0x32dcbc[_0xd0bf('0x17')][_0xd0bf('0x1a')]);}logger['error'](_0xd0bf('0x19'),_0x22aff4,_0x32dcbc[_0xd0bf('0x17')]['message']);return _0x346ab6(_0x32dcbc['error'][_0xd0bf('0x1a')]);}else{logger[_0xd0bf('0x12')](_0xd0bf('0x19'),_0x22aff4,_0xd0bf('0x13'));_0x346ab6(_0x32dcbc[_0xd0bf('0x1b')][_0xd0bf('0x1a')]);}})['catch'](function(_0x5dd4cc){logger['error'](_0xd0bf('0x19'),_0x22aff4,_0x5dd4cc);_0x541b08(_0x5dd4cc);});});}function respondWithResult(_0x292a15,_0x599d41){_0x599d41=_0x599d41||0xc8;return function(_0x17587e){if(_0x17587e){return _0x292a15[_0xd0bf('0x1c')](_0x599d41)[_0xd0bf('0x1d')](_0x17587e);}};}function respondWithFilteredResult(_0x5e4dc7,_0xa0303f){return function(_0x569ebb){if(_0x569ebb){var _0x5c73c5=typeof _0xa0303f[_0xd0bf('0x1e')]===_0xd0bf('0x1f')&&typeof _0xa0303f[_0xd0bf('0x20')]===_0xd0bf('0x1f');var _0x2b7758=_0x569ebb[_0xd0bf('0x21')];var _0xf74867=_0x5c73c5?0x0:_0xa0303f[_0xd0bf('0x1e')];var _0xb2aba1=_0x5c73c5?_0x569ebb['count']:_0xa0303f['offset']+_0xa0303f['limit'];var _0x16a232;if(_0xb2aba1>=_0x2b7758){_0xb2aba1=_0x2b7758;_0x16a232=0xc8;}else{_0x16a232=0xce;}_0x5e4dc7['status'](_0x16a232);return _0x5e4dc7[_0xd0bf('0x22')](_0xd0bf('0x23'),_0xf74867+'-'+_0xb2aba1+'/'+_0x2b7758)[_0xd0bf('0x1d')](_0x569ebb);}return null;};}function saveUpdates(_0x5518f3){return function(_0x497016){if(_0x497016){return _0x497016[_0xd0bf('0x24')](_0x5518f3)[_0xd0bf('0x11')](function(_0x47117a){return _0x47117a;});}return null;};}function removeEntity(_0x32d2dd){return function(_0x168383){if(_0x168383){return _0x168383[_0xd0bf('0x25')]()[_0xd0bf('0x11')](function(){_0x32d2dd[_0xd0bf('0x1c')](0xcc)[_0xd0bf('0x26')]();});}};}function handleEntityNotFound(_0x415957){return function(_0x26b505){if(!_0x26b505){_0x415957[_0xd0bf('0x27')](0x194);}return _0x26b505;};}function handleError(_0x24a18b,_0x3d7c29){_0x3d7c29=_0x3d7c29||0x1f4;return function(_0x592f6d){logger[_0xd0bf('0x17')](_0x592f6d['stack']);if(_0x592f6d[_0xd0bf('0x28')]){delete _0x592f6d['name'];}_0x24a18b[_0xd0bf('0x1c')](_0x3d7c29)[_0xd0bf('0x29')](_0x592f6d);};}exports[_0xd0bf('0x2a')]=function(_0x304956,_0x510d72){var _0x323da8={},_0x56ee62={},_0x29d3b8={'count':0x0,'rows':[]};var _0x138929=_[_0xd0bf('0x2b')](db['FaxMessage']['rawAttributes'],function(_0x805ce9){return{'name':_0x805ce9[_0xd0bf('0x2c')],'type':_0x805ce9[_0xd0bf('0x2d')]['key']};});_0x56ee62[_0xd0bf('0x2e')]=_[_0xd0bf('0x2b')](_0x138929,_0xd0bf('0x28'));_0x56ee62[_0xd0bf('0x2f')]=_[_0xd0bf('0x30')](_0x304956[_0xd0bf('0x2f')]);_0x56ee62[_0xd0bf('0x31')]=_['intersection'](_0x56ee62[_0xd0bf('0x2e')],_0x56ee62[_0xd0bf('0x2f')]);_0x323da8[_0xd0bf('0x32')]=_[_0xd0bf('0x33')](_0x56ee62['model'],qs[_0xd0bf('0x34')](_0x304956[_0xd0bf('0x2f')][_0xd0bf('0x34')]));_0x323da8[_0xd0bf('0x32')]=_0x323da8['attributes'][_0xd0bf('0x35')]?_0x323da8['attributes']:_0x56ee62[_0xd0bf('0x2e')];if(!_0x304956[_0xd0bf('0x2f')][_0xd0bf('0x36')](_0xd0bf('0x37'))){_0x323da8[_0xd0bf('0x20')]=qs[_0xd0bf('0x20')](_0x304956[_0xd0bf('0x2f')]['limit']);_0x323da8['offset']=qs['offset'](_0x304956['query'][_0xd0bf('0x1e')]);}_0x323da8[_0xd0bf('0x38')]=qs[_0xd0bf('0x39')](_0x304956[_0xd0bf('0x2f')][_0xd0bf('0x39')]);_0x323da8[_0xd0bf('0x3a')]=qs[_0xd0bf('0x31')](_[_0xd0bf('0x3b')](_0x304956['query'],_0x56ee62[_0xd0bf('0x31')]),_0x138929);if(_0x304956[_0xd0bf('0x2f')][_0xd0bf('0x3c')]){_0x323da8[_0xd0bf('0x3a')]=_[_0xd0bf('0x3d')](_0x323da8[_0xd0bf('0x3a')],{'$or':_[_0xd0bf('0x2b')](_0x138929,function(_0x1c8872){if(_0x1c8872[_0xd0bf('0x2d')]!=='VIRTUAL'){var _0x1860bd={};_0x1860bd[_0x1c8872['name']]={'$like':'%'+_0x304956[_0xd0bf('0x2f')]['filter']+'%'};return _0x1860bd;}})});}_0x323da8=_['merge']({},_0x323da8,_0x304956[_0xd0bf('0x3e')]);var _0x3d5b6f={'where':_0x323da8['where']};return db[_0xd0bf('0x3f')]['count'](_0x3d5b6f)['then'](function(_0x585de5){_0x29d3b8['count']=_0x585de5;if(_0x304956[_0xd0bf('0x2f')]['includeAll']){_0x323da8[_0xd0bf('0x40')]=[{'all':!![]}];}return db[_0xd0bf('0x3f')][_0xd0bf('0x41')](_0x323da8);})['then'](function(_0x27cf32){_0x29d3b8[_0xd0bf('0x42')]=_0x27cf32;return _0x29d3b8;})[_0xd0bf('0x11')](respondWithFilteredResult(_0x510d72,_0x323da8))[_0xd0bf('0x43')](handleError(_0x510d72,null));};exports[_0xd0bf('0x44')]=function(_0x30b3ef,_0x594936){var _0x4ead62={'raw':!![],'where':{'id':_0x30b3ef[_0xd0bf('0x45')]['id']}},_0x33a81e={};_0x33a81e[_0xd0bf('0x2e')]=_[_0xd0bf('0x30')](db['FaxMessage'][_0xd0bf('0x46')]);_0x33a81e[_0xd0bf('0x2f')]=_[_0xd0bf('0x30')](_0x30b3ef[_0xd0bf('0x2f')]);_0x33a81e[_0xd0bf('0x31')]=_[_0xd0bf('0x33')](_0x33a81e[_0xd0bf('0x2e')],_0x33a81e[_0xd0bf('0x2f')]);_0x4ead62[_0xd0bf('0x32')]=_[_0xd0bf('0x33')](_0x33a81e[_0xd0bf('0x2e')],qs['fields'](_0x30b3ef[_0xd0bf('0x2f')][_0xd0bf('0x34')]));_0x4ead62[_0xd0bf('0x32')]=_0x4ead62[_0xd0bf('0x32')][_0xd0bf('0x35')]?_0x4ead62['attributes']:_0x33a81e[_0xd0bf('0x2e')];if(_0x30b3ef[_0xd0bf('0x2f')][_0xd0bf('0x47')]){_0x4ead62[_0xd0bf('0x40')]=[{'all':!![]}];}_0x4ead62=_['merge']({},_0x4ead62,_0x30b3ef[_0xd0bf('0x3e')]);return db['FaxMessage'][_0xd0bf('0x48')](_0x4ead62)[_0xd0bf('0x11')](handleEntityNotFound(_0x594936,null))['then'](respondWithResult(_0x594936,null))[_0xd0bf('0x43')](handleError(_0x594936,null));};exports[_0xd0bf('0x24')]=function(_0x47aa2f,_0x21c4cd){if(_0x47aa2f[_0xd0bf('0x49')]['id']){delete _0x47aa2f[_0xd0bf('0x49')]['id'];}return db[_0xd0bf('0x3f')][_0xd0bf('0x48')]({'where':{'id':_0x47aa2f[_0xd0bf('0x45')]['id']}})[_0xd0bf('0x11')](handleEntityNotFound(_0x21c4cd,null))[_0xd0bf('0x11')](saveUpdates(_0x47aa2f[_0xd0bf('0x49')],null))[_0xd0bf('0x11')](respondWithResult(_0x21c4cd,null))[_0xd0bf('0x43')](handleError(_0x21c4cd,null));};exports['destroy']=function(_0x35456,_0x5f041a){return db[_0xd0bf('0x3f')]['find']({'where':{'id':_0x35456[_0xd0bf('0x45')]['id']}})[_0xd0bf('0x11')](handleEntityNotFound(_0x5f041a,null))[_0xd0bf('0x11')](removeEntity(_0x5f041a,null))[_0xd0bf('0x43')](handleError(_0x5f041a,null));};exports[_0xd0bf('0x4a')]=function(_0x2565f9,_0x345dfa){return db[_0xd0bf('0x3f')][_0xd0bf('0x4a')]()[_0xd0bf('0x11')](respondWithResult(_0x345dfa,null))['catch'](handleError(_0x345dfa,null));};exports[_0xd0bf('0x4b')]=function(_0x10cc3a,_0x5464f9){var _0x134548=_0xd0bf('0x4c');return interactionService[_0xd0bf('0x4d')](_0x10cc3a,_0x134548)['then'](respondWithResult(_0x5464f9,null))['catch'](handleError(_0x5464f9,null));};exports[_0xd0bf('0x4b')]=function(_0x55ad64,_0x5180dc){var _0x1ced4d='fax';return interactionService[_0xd0bf('0x4d')](_0x55ad64,_0x1ced4d)[_0xd0bf('0x11')](respondWithResult(_0x5180dc,null))[_0xd0bf('0x43')](handleError(_0x5180dc,null));};exports['reject']=function(_0xa7c049,_0x28be7e){var _0x1f7be5={'agent':{},'channel':_0xd0bf('0x4e')};if(_0xa7c049[_0xd0bf('0x49')]['id']){delete _0xa7c049['body']['id'];}_0xa7c049['body'][_0xd0bf('0x4f')]=_0xa7c049['body'][_0xd0bf('0x4f')]||_0xa7c049[_0xd0bf('0x50')]['id'];_0x1f7be5[_0xd0bf('0x51')]['id']=_0xa7c049[_0xd0bf('0x49')][_0xd0bf('0x4f')];return db[_0xd0bf('0x3f')][_0xd0bf('0x48')]({'where':{'id':_0xa7c049['params']['id'],'UserId':null}})[_0xd0bf('0x11')](handleEntityNotFound(_0x28be7e,null))[_0xd0bf('0x11')](function(_0x4554c2){if(_0x4554c2){_0x1f7be5['message']=_0x4554c2['get']({'plain':!![]});return db[_0xd0bf('0x52')]['find']({'where':{'id':_0x4554c2[_0xd0bf('0x53')]}});}return null;})[_0xd0bf('0x11')](handleEntityNotFound(_0x28be7e,null))[_0xd0bf('0x11')](function(_0x3b14f5){if(_0x3b14f5){_0x1f7be5[_0xd0bf('0x54')]=_0x3b14f5[_0xd0bf('0x55')]({'plain':!![]});interaction_log[_0xd0bf('0x12')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa7c049[_0xd0bf('0x50')]['id'],_0xa7c049[_0xd0bf('0x50')][_0xd0bf('0x28')],_0xa7c049[_0xd0bf('0x50')][_0xd0bf('0x56')],_0x1f7be5[_0xd0bf('0x54')]['id'],_0xa7c049['body']?JSON[_0xd0bf('0x16')](_0xa7c049[_0xd0bf('0x49')]):_0xd0bf('0x57'));return respondWithRpcPromise(_0xd0bf('0x58'),_0xd0bf('0x59'),_0x1f7be5);}return null;})[_0xd0bf('0x11')](function(_0x3ee873){var _0x538ef4=_0xd0bf('0x5a')+_0x3ee873[_0xd0bf('0x1a')]['ContactId'];return db[_0xd0bf('0x5b')][_0xd0bf('0x2f')](_0x538ef4,{'type':db['Sequelize'][_0xd0bf('0x5c')][_0xd0bf('0x5d')],'raw':!![]})[_0xd0bf('0x11')](function(_0x325e38){return _0x325e38;});})[_0xd0bf('0x11')](function(_0x28f9d4){if(_0x28f9d4){_0x1f7be5['message'][_0xd0bf('0x5e')]=_0x28f9d4[0x0];if(!_0xa7c049[_0xd0bf('0x49')]['UserId'])return;return db[_0xd0bf('0x5f')][_0xd0bf('0x48')]({'where':{'id':_0xa7c049['body'][_0xd0bf('0x4f')],'role':'agent'},'attributes':['id',_0xd0bf('0x28'),_0xd0bf('0x60'),_0xd0bf('0x61'),_0xd0bf('0x62')],'raw':!![]});}return null;})[_0xd0bf('0x11')](function(_0x216f3e){if(!_0x216f3e)return null;_0x1f7be5[_0xd0bf('0x1a')][_0xd0bf('0x51')]=_0x216f3e;return _0x1f7be5;})[_0xd0bf('0x11')](function(_0xfbf728){if(_0xfbf728){_0xfbf728['message']['interface']=util[_0xd0bf('0x63')](_0xd0bf('0x64'),_0xa7c049[_0xd0bf('0x50')][_0xd0bf('0x28')]);_0xfbf728[_0xd0bf('0x1a')][_0xd0bf('0x65')]=_0x1f7be5[_0xd0bf('0x65')];_0xfbf728[_0xd0bf('0x1a')][_0xd0bf('0x66')]=_0x1f7be5[_0xd0bf('0x65')];_0xfbf728[_0xd0bf('0x1a')][_0xd0bf('0x67')]=_0xd0bf('0x68');respondWithRpcPromise('EventManager',_0xd0bf('0x69'),{'event':_0xd0bf('0x6a'),'message':_0xfbf728[_0xd0bf('0x1a')]},client9002);return _0x1f7be5;}return null;})[_0xd0bf('0x11')](respondWithResult(_0x28be7e,null))[_0xd0bf('0x43')](handleError(_0x28be7e,null));};exports['create']=function(_0x1d0f0b,_0x55e6e4){var _0x5378d3;return db[_0xd0bf('0x3f')][_0xd0bf('0x6b')](_0x1d0f0b[_0xd0bf('0x49')],{})[_0xd0bf('0x11')](function(_0x215f0a){_0x5378d3=_0x215f0a;return db[_0xd0bf('0x6c')][_0xd0bf('0x6d')]({'where':{'id':_0x5378d3[_0xd0bf('0x6e')]}});})[_0xd0bf('0x11')](function(_0x54c733){if(_[_0xd0bf('0x6f')](_0x54c733)){return;}else{_0x5378d3['fax']=_0x54c733['fax'];return db['Attachment'][_0xd0bf('0x6d')]({'where':{'id':_0x5378d3[_0xd0bf('0x70')]}});}})[_0xd0bf('0x11')](function(_0x215058){return respondWithRpcPromise(_0xd0bf('0x71'),_0xd0bf('0x71'),{'FaxAccountId':_['isNil'](_0x1d0f0b[_0xd0bf('0x49')])?undefined:_0x1d0f0b[_0xd0bf('0x49')]['FaxAccountId'],'path':_[_0xd0bf('0x6f')](_0x215058)?undefined:util[_0xd0bf('0x63')](_0xd0bf('0x72'),_0x215058[_0xd0bf('0x73')]),'fax':_[_0xd0bf('0x6f')](_0x5378d3[_0xd0bf('0x4e')])?undefined:_0x5378d3[_0xd0bf('0x4e')],'AttachmentId':_0x5378d3[_0xd0bf('0x70')]},client9002);})[_0xd0bf('0x11')](respondWithResult(_0x55e6e4,0xc9))[_0xd0bf('0x43')](handleError(_0x55e6e4,null));};exports[_0xd0bf('0x74')]=function(_0xf9a9de,_0xc2fd93){var _0x791350=path[_0xd0bf('0x75')](config[_0xd0bf('0x76')],_0xd0bf('0x77'),'files',_0xd0bf('0x78'));return db[_0xd0bf('0x3f')][_0xd0bf('0x48')]({'where':{'id':_0xf9a9de[_0xd0bf('0x45')]['id']},'include':[{'model':db['Attachment'],'as':_0xd0bf('0x79')}]})[_0xd0bf('0x11')](handleEntityNotFound(_0xc2fd93,null))[_0xd0bf('0x11')](function(_0x5beb1d){if(_0x5beb1d){return _0xc2fd93[_0xd0bf('0x74')](path[_0xd0bf('0x75')](_0x791350,_0x5beb1d['Attachment'][_0xd0bf('0x73')]));}})['catch'](handleError(_0xc2fd93,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ef7a504..e43a422 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 _0xc7bd=['hook','../../mysqldb','FaxMessage','save','remove','emit','hasOwnProperty'];(function(_0x364704,_0x314352){var _0x177693=function(_0x3fad61){while(--_0x3fad61){_0x364704['push'](_0x364704['shift']());}};_0x177693(++_0x314352);}(_0xc7bd,0x86));var _0xdc7b=function(_0x54d866,_0xf9a5a){_0x54d866=_0x54d866-0x0;var _0x337c33=_0xc7bd[_0x54d866];return _0x337c33;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xdc7b('0x0'))['db'][_0xdc7b('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdc7b('0x2'),'afterUpdate':'update','afterDestroy':_0xdc7b('0x3')};function emitEvent(_0x541301){return function(_0x5a8db9,_0x2d3095,_0x4050dc){FaxMessageEvents[_0xdc7b('0x4')](_0x541301+':'+_0x5a8db9['id'],_0x5a8db9);FaxMessageEvents[_0xdc7b('0x4')](_0x541301,_0x5a8db9);_0x4050dc(null);};}for(var e in events){if(events[_0xdc7b('0x5')](e)){var event=events[e];FaxMessage[_0xdc7b('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xb94c=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x32c189,_0x3ffb8e){var _0x526217=function(_0xca7609){while(--_0xca7609){_0x32c189['push'](_0x32c189['shift']());}};_0x526217(++_0x3ffb8e);}(_0xb94c,0x176));var _0xcb94=function(_0x9391df,_0x101e81){_0x9391df=_0x9391df-0x0;var _0xf8d381=_0xb94c[_0x9391df];return _0xf8d381;};'use strict';var EventEmitter=require(_0xcb94('0x0'));var FaxMessage=require(_0xcb94('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xcb94('0x2')](0x0);var events={'afterCreate':_0xcb94('0x3'),'afterUpdate':'update','afterDestroy':_0xcb94('0x4')};function emitEvent(_0x544687){return function(_0x16e652,_0xbbe00c,_0x2cf8a9){FaxMessageEvents[_0xcb94('0x5')](_0x544687+':'+_0x16e652['id'],_0x16e652);FaxMessageEvents[_0xcb94('0x5')](_0x544687,_0x16e652);_0x2cf8a9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xcb94('0x6')](e,emitEvent(event));}}module[_0xcb94('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 c69c64a..7887fca 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 _0x9d1e=['./faxMessage.attributes','exports','define','FaxMessage','fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','UserId','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x1ffbd6,_0x45a3d6){var _0x2d0531=function(_0x542f48){while(--_0x542f48){_0x1ffbd6['push'](_0x1ffbd6['shift']());}};_0x2d0531(++_0x45a3d6);}(_0x9d1e,0x64));var _0xe9d1=function(_0x356bc8,_0x348c79){_0x356bc8=_0x356bc8-0x0;var _0x24722b=_0x9d1e[_0x356bc8];return _0x24722b;};'use strict';var _=require(_0xe9d1('0x0'));var util=require(_0xe9d1('0x1'));var logger=require(_0xe9d1('0x2'))(_0xe9d1('0x3'));var moment=require(_0xe9d1('0x4'));var BPromise=require('bluebird');var rp=require(_0xe9d1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9d1('0x6'));var config=require(_0xe9d1('0x7'));var attributes=require(_0xe9d1('0x8'));module[_0xe9d1('0x9')]=function(_0x2fc532,_0x49c95f){return _0x2fc532[_0xe9d1('0xa')](_0xe9d1('0xb'),attributes,{'tableName':_0xe9d1('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xe9d1('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39c316,_0x3c49a3,_0x32d76d){var _0x40dd85=_0x2fc532[_0xe9d1('0xe')];var _0x1d3356=_0x39c316[_0xe9d1('0xf')]({'plain':!![]});if(_0x1d3356[_0xe9d1('0x10')][_0xe9d1('0x11')]()==='in'||_0x1d3356[_0xe9d1('0x10')]['toLowerCase']()===_0xe9d1('0x12')&&!_0x1d3356['secret']&&!_['isNil'](_0x1d3356[_0xe9d1('0x13')])){_0x40dd85['FaxInteraction'][_0xe9d1('0x14')]({'where':{'id':_0x1d3356[_0xe9d1('0x15')]}})[_0xe9d1('0x16')](function(_0x3f8e34){if(_0x3f8e34){_0x3f8e34[_0xe9d1('0x17')]({'lastMsgAt':_0x1d3356[_0xe9d1('0x18')],'lastMsgDirection':_0x1d3356[_0xe9d1('0x10')][_0xe9d1('0x11')]()});}})['catch'](function(_0x4c670a){console[_0xe9d1('0x19')](_0x4c670a);});}_0x32d76d();}},'charset':_0xe9d1('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc4d9=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','toLowerCase','FaxInteraction','FaxInteractionId','update','direction','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x50589f,_0x22f34d){var _0x56504e=function(_0x3eaa14){while(--_0x3eaa14){_0x50589f['push'](_0x50589f['shift']());}};_0x56504e(++_0x22f34d);}(_0xc4d9,0xfa));var _0x9c4d=function(_0x2d3652,_0xc2b0df){_0x2d3652=_0x2d3652-0x0;var _0x37a4de=_0xc4d9[_0x2d3652];return _0x37a4de;};'use strict';var _=require(_0x9c4d('0x0'));var util=require(_0x9c4d('0x1'));var logger=require(_0x9c4d('0x2'))(_0x9c4d('0x3'));var moment=require(_0x9c4d('0x4'));var BPromise=require(_0x9c4d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c4d('0x6'));var rimraf=require(_0x9c4d('0x7'));var config=require('../../config/environment');var attributes=require(_0x9c4d('0x8'));module[_0x9c4d('0x9')]=function(_0x192598,_0x232d46){return _0x192598['define'](_0x9c4d('0xa'),attributes,{'tableName':_0x9c4d('0xb'),'paranoid':![],'indexes':[{'name':_0x9c4d('0xc'),'fields':['body'],'type':_0x9c4d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x33c4a2,_0x3133b0,_0x3efbf6){var _0x18188b=_0x192598[_0x9c4d('0xe')];var _0x1b4569=_0x33c4a2[_0x9c4d('0xf')]({'plain':!![]});if(_0x1b4569['direction'][_0x9c4d('0x10')]()==='in'||_0x1b4569['direction'][_0x9c4d('0x10')]()==='out'&&!_0x1b4569['secret']&&!_['isNil'](_0x1b4569['UserId'])){_0x18188b[_0x9c4d('0x11')]['findOne']({'where':{'id':_0x1b4569[_0x9c4d('0x12')]}})['then'](function(_0x3c4a5d){if(_0x3c4a5d){_0x3c4a5d[_0x9c4d('0x13')]({'lastMsgAt':_0x1b4569['createdAt'],'lastMsgDirection':_0x1b4569[_0x9c4d('0x14')][_0x9c4d('0x10')]()});}})[_0x9c4d('0x15')](function(_0x4c6783){console[_0x9c4d('0x16')](_0x4c6783);});}_0x3efbf6();}},'charset':_0x9c4d('0x17'),'collate':_0x9c4d('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 3e79118..f8795d6 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 _0xf3cd=['redis','defaults','socket.io-emitter','register','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','body','options','raw','UpdateFaxMessage','FaxMessage','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x216286,_0x527c9b){var _0x593472=function(_0x46b115){while(--_0x46b115){_0x216286['push'](_0x216286['shift']());}};_0x593472(++_0x527c9b);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3cb530,_0x170e8c){_0x3cb530=_0x3cb530-0x0;var _0x4168ea=_0xf3cd[_0x3cb530];return _0x4168ea;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});config[_0xdf3c('0xc')]=_[_0xdf3c('0xd')](config[_0xdf3c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf3c('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xdf3c('0xf')](socket);function respondWithRpcPromise(_0x981616,_0x5ef936,_0x1dba4c){return new BPromise(function(_0x205f33,_0x2d420c){return client[_0xdf3c('0x10')](_0x981616,_0x1dba4c)[_0xdf3c('0x11')](function(_0x1c456b){logger[_0xdf3c('0x12')](_0xdf3c('0x13'),_0x5ef936,'request\x20sent');logger[_0xdf3c('0x14')](_0xdf3c('0x15'),_0x5ef936,_0xdf3c('0x16'),JSON[_0xdf3c('0x17')](_0x1c456b));if(_0x1c456b['error']){if(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x19')]===0x1f4){logger[_0xdf3c('0x18')]('FaxMessage,\x20%s,\x20%s',_0x5ef936,_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);return _0x2d420c(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);}logger[_0xdf3c('0x18')](_0xdf3c('0x13'),_0x5ef936,_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);return _0x205f33(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);}else{logger['info'](_0xdf3c('0x13'),_0x5ef936,_0xdf3c('0x16'));_0x205f33(_0x1c456b[_0xdf3c('0x1b')][_0xdf3c('0x1a')]);}})[_0xdf3c('0x1c')](function(_0x113b56){logger[_0xdf3c('0x18')](_0xdf3c('0x13'),_0x5ef936,_0x113b56);_0x2d420c(_0x113b56);});});}exports[_0xdf3c('0x1d')]=function(_0x18fb5f){var _0x267488=this;return new Promise(function(_0x3d14cc,_0x25487c){return db['FaxMessage']['create'](_0x18fb5f[_0xdf3c('0x1e')],{'raw':_0x18fb5f['options']?_0x18fb5f[_0xdf3c('0x1f')][_0xdf3c('0x20')]===undefined?!![]:![]:!![]})[_0xdf3c('0x11')](function(_0x38b319){logger[_0xdf3c('0x12')](_0xdf3c('0x1d'),_0x18fb5f);logger['debug'](_0xdf3c('0x1d'),_0x18fb5f,JSON[_0xdf3c('0x17')](_0x38b319));_0x3d14cc(_0x38b319);})[_0xdf3c('0x1c')](function(_0x24754a){logger[_0xdf3c('0x18')](_0xdf3c('0x1d'),_0x24754a[_0xdf3c('0x1a')],_0x18fb5f);_0x25487c(_0x267488[_0xdf3c('0x18')](0x1f4,_0x24754a[_0xdf3c('0x1a')]));});});};exports[_0xdf3c('0x21')]=function(_0x4c076c){var _0xd284d7=this;return new Promise(function(_0x153daa,_0x4b57a4){return db[_0xdf3c('0x22')]['update'](_0x4c076c['body'],{'raw':_0x4c076c['options']?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c076c['options']?_0x4c076c['options'][_0xdf3c('0x23')]||null:null,'attributes':_0x4c076c[_0xdf3c('0x1f')]?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x24')]||null:null,'limit':_0x4c076c['options']?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x25')]||null:null})['then'](function(_0x51e0a4){logger[_0xdf3c('0x12')](_0xdf3c('0x21'),_0x4c076c);logger[_0xdf3c('0x14')]('UpdateFaxMessage',_0x4c076c,JSON[_0xdf3c('0x17')](_0x51e0a4));_0x153daa(_0x51e0a4);})[_0xdf3c('0x1c')](function(_0x21e7b8){logger[_0xdf3c('0x18')]('UpdateFaxMessage',_0x21e7b8[_0xdf3c('0x1a')],_0x4c076c);_0x4b57a4(_0xd284d7[_0xdf3c('0x18')](0x1f4,_0x21e7b8['message']));});});}; \ No newline at end of file +var _0xac9d=['then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxMessage','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request'];(function(_0x2068b9,_0x458ce8){var _0x1c8173=function(_0x83b817){while(--_0x83b817){_0x2068b9['push'](_0x2068b9['shift']());}};_0x1c8173(++_0x458ce8);}(_0xac9d,0x14d));var _0xdac9=function(_0x4f840d,_0x5d6218){_0x4f840d=_0x4f840d-0x0;var _0x315f81=_0xac9d[_0x4f840d];return _0x315f81;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});}exports['CreateFaxMessage']=function(_0x520369){var _0x4029fc=this;return new Promise(function(_0x20ece3,_0x2b9d91){return db[_0xdac9('0x1d')]['create'](_0x520369[_0xdac9('0x1e')],{'raw':_0x520369[_0xdac9('0x1f')]?_0x520369[_0xdac9('0x1f')][_0xdac9('0x20')]===undefined?!![]:![]:!![]})[_0xdac9('0x12')](function(_0x42317c){logger[_0xdac9('0x13')](_0xdac9('0x21'),_0x520369);logger[_0xdac9('0x15')](_0xdac9('0x21'),_0x520369,JSON['stringify'](_0x42317c));_0x20ece3(_0x42317c);})[_0xdac9('0x1c')](function(_0x11f4fd){logger[_0xdac9('0x18')](_0xdac9('0x21'),_0x11f4fd['message'],_0x520369);_0x2b9d91(_0x4029fc[_0xdac9('0x18')](0x1f4,_0x11f4fd['message']));});});};exports[_0xdac9('0x22')]=function(_0x2fce71){var _0x566d8c=this;return new Promise(function(_0x433be9,_0x5105f1){return db[_0xdac9('0x1d')][_0xdac9('0x23')](_0x2fce71[_0xdac9('0x1e')],{'raw':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')]['where']||null:null,'attributes':_0x2fce71['options']?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x24')]||null:null,'limit':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x25')]||null:null})[_0xdac9('0x12')](function(_0xed99f9){logger[_0xdac9('0x13')](_0xdac9('0x22'),_0x2fce71);logger[_0xdac9('0x15')](_0xdac9('0x22'),_0x2fce71,JSON[_0xdac9('0x26')](_0xed99f9));_0x433be9(_0xed99f9);})[_0xdac9('0x1c')](function(_0x336fd5){logger[_0xdac9('0x18')](_0xdac9('0x22'),_0x336fd5[_0xdac9('0x1a')],_0x2fce71);_0x5105f1(_0x566d8c[_0xdac9('0x18')](0x1f4,_0x336fd5[_0xdac9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index a84a83d..0df0db8 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 _0x862d=['emit','register','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x1a550a,_0x1c44fb){var _0x507d39=function(_0x16b65f){while(--_0x16b65f){_0x1a550a['push'](_0x1a550a['shift']());}};_0x507d39(++_0x1c44fb);}(_0x862d,0x18c));var _0xd862=function(_0x4530fc,_0x2fe936){_0x4530fc=_0x4530fc-0x0;var _0x35c896=_0x862d[_0x4530fc];return _0x35c896;};'use strict';var FaxMessageEvents=require(_0xd862('0x0'));var events=[_0xd862('0x1'),_0xd862('0x2'),_0xd862('0x3')];function createListener(_0x53a61a,_0xe562a0){return function(_0x15119e){_0xe562a0[_0xd862('0x4')](_0x53a61a,_0x15119e);};}function removeListener(_0x3b5cfe,_0x39446b){return function(){FaxMessageEvents['removeListener'](_0x3b5cfe,_0x39446b);};}exports[_0xd862('0x5')]=function(_0x3f6a29){for(var _0x1b613d=0x0,_0xa27839=events[_0xd862('0x6')];_0x1b613d<_0xa27839;_0x1b613d++){var _0x6b643b=events[_0x1b613d];var _0x28bf78=createListener(_0xd862('0x7')+_0x6b643b,_0x3f6a29);FaxMessageEvents['on'](_0x6b643b,_0x28bf78);}}; \ No newline at end of file +var _0x1ac1=['./faxMessage.events','save','remove','emit','removeListener','register','length','faxMessage:'];(function(_0x49f2ac,_0x1bd259){var _0x490f9a=function(_0x159f8d){while(--_0x159f8d){_0x49f2ac['push'](_0x49f2ac['shift']());}};_0x490f9a(++_0x1bd259);}(_0x1ac1,0x118));var _0x11ac=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0x1ac1[_0x58381c];return _0x1a7440;};'use strict';var FaxMessageEvents=require(_0x11ac('0x0'));var events=[_0x11ac('0x1'),_0x11ac('0x2'),'update'];function createListener(_0x4680e1,_0x2e4bcb){return function(_0x30e371){_0x2e4bcb[_0x11ac('0x3')](_0x4680e1,_0x30e371);};}function removeListener(_0x436156,_0x6a589e){return function(){FaxMessageEvents[_0x11ac('0x4')](_0x436156,_0x6a589e);};}exports[_0x11ac('0x5')]=function(_0x164e27){for(var _0x2c519a=0x0,_0x29c465=events[_0x11ac('0x6')];_0x2c519a<_0x29c465;_0x2c519a++){var _0x1ed679=events[_0x2c519a];var _0x117a49=createListener(_0x11ac('0x7')+_0x1ed679,_0x164e27);FaxMessageEvents['on'](_0x1ed679,_0x117a49);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index dc4e6ff..7710801 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee5b=['update','/:id/accept','accept','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id'];(function(_0x452f6e,_0x9bb466){var _0x14154c=function(_0x520cf5){while(--_0x520cf5){_0x452f6e['push'](_0x452f6e['shift']());}};_0x14154c(++_0x9bb466);}(_0xee5b,0x1f4));var _0xbee5=function(_0xb58866,_0x97375c){_0xb58866=_0xb58866-0x0;var _0x746f5d=_0xee5b[_0xb58866];return _0x746f5d;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0x7')](_0xbee5('0xb'),auth['isAuthenticated'](),controller[_0xbee5('0xc')]);router[_0xbee5('0xd')]('/',auth[_0xbee5('0x8')](),interaction[_0xbee5('0xe')](_0xbee5('0xf'),_0xbee5('0x10')),controller[_0xbee5('0x11')]);router[_0xbee5('0x12')](_0xbee5('0x13'),auth['isAuthenticated'](),controller[_0xbee5('0x14')]);router['put'](_0xbee5('0x15'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x16')]);router['put']('/:id/reject',auth[_0xbee5('0x8')](),controller['reject']);router[_0xbee5('0x17')]('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0x18')]);module[_0xbee5('0x19')]=router; \ No newline at end of file +var _0xb821=['path','Router','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','put','update','/:id/accept','reject','exports','util'];(function(_0x2cac01,_0x2e8b3d){var _0x2257b7=function(_0x4b386c){while(--_0x4b386c){_0x2cac01['push'](_0x2cac01['shift']());}};_0x2257b7(++_0x2e8b3d);}(_0xb821,0xa7));var _0x1b82=function(_0x4c48ec,_0x1b1db6){_0x4c48ec=_0x4c48ec-0x0;var _0x1415e6=_0xb821[_0x4c48ec];return _0x1415e6;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var controller=require(_0x1b82('0x5'));router[_0x1b82('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x6')](_0x1b82('0x8'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x6')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xc')]);router['get'](_0x1b82('0xd'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0xf')]('/',auth[_0x1b82('0x9')](),interaction[_0x1b82('0x10')](_0x1b82('0x11'),_0x1b82('0x12')),controller['create']);router[_0x1b82('0x13')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0x14')]);router['put'](_0x1b82('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0x1b82('0x13')]('/:id/reject',auth[_0x1b82('0x9')](),controller[_0x1b82('0x16')]);router['delete'](_0x1b82('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1b82('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index d40aba2..fec6f38 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 _0x8411=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x2767af,_0x57e921){var _0x1f7c84=function(_0x946955){while(--_0x946955){_0x2767af['push'](_0x2767af['shift']());}};_0x1f7c84(++_0x57e921);}(_0x8411,0x168));var _0x1841=function(_0x5132fa,_0x2893f4){_0x5132fa=_0x5132fa-0x0;var _0x5cf339=_0x8411[_0x5132fa];return _0x5cf339;};'use strict';var Sequelize=require(_0x1841('0x0'));module[_0x1841('0x1')]={'name':{'type':Sequelize[_0x1841('0x2')],'unique':_0x1841('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1841('0x2')]},'timeout':{'type':Sequelize[_0x1841('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1841('0x5')](_0x1841('0x6'),_0x1841('0x7'),_0x1841('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x1841('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaa55=['rrmemory','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaa55,0x9c));var _0x5aa5=function(_0x47094d,_0x1a9906){_0x47094d=_0x47094d-0x0;var _0x351450=_0xaa55[_0x47094d];return _0x351450;};'use strict';var Sequelize=require(_0x5aa5('0x0'));module[_0x5aa5('0x1')]={'name':{'type':Sequelize[_0x5aa5('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5aa5('0x2')]},'timeout':{'type':Sequelize[_0x5aa5('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5aa5('0x4')](_0x5aa5('0x5'),'beepall',_0x5aa5('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x5aa5('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index ff7ee22..144f84e 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 _0xc359=['userFaxQueue:remove','addAgents','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../mysqldb','defaults','./faxQueue.socket','register','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','update','then','destroy','FaxQueues','UserProfileResource','error','name','send','index','FaxQueue','rawAttributes','type','getOptions','where','include','query','findAll','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','body','params','describe','getMembers','findOne','UserFaxQueue','intersection','nolimit','order','sort','pick','filter','merge','map','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','isEmpty','removeAgents'];(function(_0x3ebc84,_0x28f3e1){var _0x2a16bd=function(_0x2d28eb){while(--_0x2d28eb){_0x3ebc84['push'](_0x3ebc84['shift']());}};_0x2a16bd(++_0x28f3e1);}(_0xc359,0x1d9));var _0x9c35=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xc359[_0x30cd7e];return _0x462a02;};'use strict';var BPromise=require('bluebird');var util=require(_0x9c35('0x0'));var _=require('lodash');var squel=require(_0x9c35('0x1'));var Redis=require(_0x9c35('0x2'));var qs=require(_0x9c35('0x3'));var logger=require('../../config/logger')(_0x9c35('0x4'));var config=require('../../config/environment');var db=require(_0x9c35('0x5'))['db'];config['redis']=_[_0x9c35('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9c35('0x7'))[_0x9c35('0x8')](socket);function respondWithStatusCode(_0x1ab745,_0x301e66){_0x301e66=_0x301e66||0xcc;return function(_0x2b2821){if(_0x2b2821){return _0x1ab745[_0x9c35('0x9')](_0x301e66);}return _0x1ab745['status'](_0x301e66)[_0x9c35('0xa')]();};}function respondWithResult(_0x467add,_0x500420){_0x500420=_0x500420||0xc8;return function(_0x4e3834){if(_0x4e3834){return _0x467add['status'](_0x500420)[_0x9c35('0xb')](_0x4e3834);}};}function respondWithFilteredResult(_0x4d012f,_0x179d10){return function(_0x20d3c7){if(_0x20d3c7){var _0x5883a8=typeof _0x179d10['offset']===_0x9c35('0xc')&&typeof _0x179d10[_0x9c35('0xd')]===_0x9c35('0xc');var _0x11c209=_0x20d3c7[_0x9c35('0xe')];var _0x4cc2ca=_0x5883a8?0x0:_0x179d10[_0x9c35('0xf')];var _0x4470df=_0x5883a8?_0x20d3c7[_0x9c35('0xe')]:_0x179d10[_0x9c35('0xf')]+_0x179d10[_0x9c35('0xd')];var _0x308392;if(_0x4470df>=_0x11c209){_0x4470df=_0x11c209;_0x308392=0xc8;}else{_0x308392=0xce;}_0x4d012f[_0x9c35('0x10')](_0x308392);return _0x4d012f[_0x9c35('0x11')](_0x9c35('0x12'),_0x4cc2ca+'-'+_0x4470df+'/'+_0x11c209)[_0x9c35('0xb')](_0x20d3c7);}return null;};}function saveUpdates(_0x387dd7){return function(_0x2e8ec1){if(_0x2e8ec1){return _0x2e8ec1[_0x9c35('0x13')](_0x387dd7)[_0x9c35('0x14')](function(_0x26db4b){return _0x26db4b;});}return null;};}function removeEntity(_0x4cbeb6){return function(_0x1d0227){if(_0x1d0227){return _0x1d0227[_0x9c35('0x15')]()[_0x9c35('0x14')](function(){var _0x24f1d9=_0x1d0227['get']({'plain':!![]});var _0x142091=_0x9c35('0x16');return db[_0x9c35('0x17')][_0x9c35('0x15')]({'where':{'type':_0x142091,'resourceId':_0x24f1d9['id']}})[_0x9c35('0x14')](function(){return _0x1d0227;});})['then'](function(){_0x4cbeb6[_0x9c35('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41aee8){return function(_0x421979){if(!_0x421979){_0x41aee8[_0x9c35('0x9')](0x194);}return _0x421979;};}function handleError(_0x8ffae5,_0x3d2193){_0x3d2193=_0x3d2193||0x1f4;return function(_0x8240f5){logger[_0x9c35('0x18')](_0x8240f5['stack']);if(_0x8240f5['name']){delete _0x8240f5[_0x9c35('0x19')];}_0x8ffae5[_0x9c35('0x10')](_0x3d2193)[_0x9c35('0x1a')](_0x8240f5);};}exports[_0x9c35('0x1b')]=function(_0x50a509,_0x233364){var _0x578e00={};var _0x223d9e={'count':0x0,'rows':[]};var _0x4bf0ea=_['map'](db[_0x9c35('0x1c')][_0x9c35('0x1d')],function(_0x2cba78){return{'name':_0x2cba78['fieldName'],'type':_0x2cba78[_0x9c35('0x1e')]['key']};});_0x578e00=qs[_0x9c35('0x1f')](_0x4bf0ea,_0x50a509);var _0x2a0954={'where':_0x578e00[_0x9c35('0x20')]};return db[_0x9c35('0x1c')][_0x9c35('0xe')](_0x2a0954)['then'](function(_0x4593e3){_0x223d9e[_0x9c35('0xe')]=_0x4593e3;_0x578e00['include']=qs[_0x9c35('0x21')](_0x50a509[_0x9c35('0x22')]);return db[_0x9c35('0x1c')][_0x9c35('0x23')](_0x578e00);})[_0x9c35('0x14')](function(_0x4cb625){_0x223d9e[_0x9c35('0x24')]=_0x4cb625;return _0x223d9e;})[_0x9c35('0x14')](respondWithFilteredResult(_0x233364,_0x578e00))[_0x9c35('0x25')](handleError(_0x233364,null));};exports[_0x9c35('0x26')]=function(_0x315981,_0x2b5341){var _0x5b28c5={'raw':!![],'where':{'id':_0x315981['params']['id']}},_0x40a3c3={};_0x40a3c3[_0x9c35('0x27')]=_[_0x9c35('0x28')](db[_0x9c35('0x1c')][_0x9c35('0x1d')]);_0x40a3c3[_0x9c35('0x22')]=_['keys'](_0x315981[_0x9c35('0x22')]);_0x40a3c3[_0x9c35('0x29')]=_['intersection'](_0x40a3c3['model'],_0x40a3c3[_0x9c35('0x22')]);_0x5b28c5['attributes']=_['intersection'](_0x40a3c3['model'],qs[_0x9c35('0x2a')](_0x315981[_0x9c35('0x22')][_0x9c35('0x2a')]));_0x5b28c5[_0x9c35('0x2b')]=_0x5b28c5[_0x9c35('0x2b')][_0x9c35('0x2c')]?_0x5b28c5['attributes']:_0x40a3c3[_0x9c35('0x27')];if(_0x315981[_0x9c35('0x22')][_0x9c35('0x2d')]){_0x5b28c5[_0x9c35('0x21')]=[{'all':!![]}];}_0x5b28c5=_['merge']({},_0x5b28c5,_0x315981[_0x9c35('0x2e')]);return db[_0x9c35('0x1c')][_0x9c35('0x2f')](_0x5b28c5)[_0x9c35('0x14')](handleEntityNotFound(_0x2b5341,null))[_0x9c35('0x14')](respondWithResult(_0x2b5341,null))[_0x9c35('0x25')](handleError(_0x2b5341,null));};exports[_0x9c35('0x30')]=function(_0x5628e7,_0x535edd){return db['FaxQueue'][_0x9c35('0x30')](_0x5628e7['body'],{})[_0x9c35('0x14')](function(_0x49a11c){var _0x49aadb=_0x5628e7[_0x9c35('0x31')][_0x9c35('0x32')]({'plain':!![]});if(!_0x49aadb)throw new Error(_0x9c35('0x33'));if(_0x49aadb[_0x9c35('0x34')]===_0x9c35('0x31')){var _0x17bace=_0x49a11c[_0x9c35('0x32')]({'plain':!![]});var _0x4a2002=_0x9c35('0x16');return db['UserProfileSection'][_0x9c35('0x2f')]({'where':{'name':_0x4a2002,'userProfileId':_0x49aadb['userProfileId']},'raw':!![]})['then'](function(_0x4fc454){if(_0x4fc454&&_0x4fc454['autoAssociation']===0x0){return db[_0x9c35('0x17')][_0x9c35('0x30')]({'name':_0x17bace[_0x9c35('0x19')],'resourceId':_0x17bace['id'],'type':_0x4fc454[_0x9c35('0x19')],'sectionId':_0x4fc454['id']},{})['then'](function(){return _0x49a11c;});}else{return _0x49a11c;}})[_0x9c35('0x25')](function(_0xff952f){logger[_0x9c35('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xff952f);throw _0xff952f;});}return _0x49a11c;})[_0x9c35('0x14')](respondWithResult(_0x535edd,0xc9))[_0x9c35('0x25')](handleError(_0x535edd,null));};exports[_0x9c35('0x13')]=function(_0x3ac8e9,_0x4269b0){if(_0x3ac8e9[_0x9c35('0x35')]['id']){delete _0x3ac8e9[_0x9c35('0x35')]['id'];}return db[_0x9c35('0x1c')][_0x9c35('0x2f')]({'where':{'id':_0x3ac8e9[_0x9c35('0x36')]['id']}})[_0x9c35('0x14')](handleEntityNotFound(_0x4269b0,null))['then'](saveUpdates(_0x3ac8e9[_0x9c35('0x35')],null))[_0x9c35('0x14')](respondWithResult(_0x4269b0,null))[_0x9c35('0x25')](handleError(_0x4269b0,null));};exports[_0x9c35('0x15')]=function(_0xffa2d9,_0xb7fa00){return db[_0x9c35('0x1c')][_0x9c35('0x2f')]({'where':{'id':_0xffa2d9[_0x9c35('0x36')]['id']}})[_0x9c35('0x14')](handleEntityNotFound(_0xb7fa00,null))[_0x9c35('0x14')](removeEntity(_0xb7fa00,null))[_0x9c35('0x25')](handleError(_0xb7fa00,null));};exports[_0x9c35('0x37')]=function(_0x1e7640,_0x2f2362){return db[_0x9c35('0x1c')][_0x9c35('0x37')]()[_0x9c35('0x14')](respondWithResult(_0x2f2362,null))[_0x9c35('0x25')](handleError(_0x2f2362,null));};exports[_0x9c35('0x38')]=function(_0x4571f9,_0x258d0a){var _0x5ca172={'raw':!![],'where':{}},_0x23afc2={},_0x58a2c2;return db[_0x9c35('0x1c')][_0x9c35('0x39')]({'where':{'id':_0x4571f9[_0x9c35('0x36')]['id']}})['then'](handleEntityNotFound(_0x258d0a,null))[_0x9c35('0x14')](function(_0x1d24ae){if(_0x1d24ae){_0x58a2c2=_0x1d24ae[_0x9c35('0x32')]({'plain':!![]});_0x23afc2['model']=_[_0x9c35('0x28')](db[_0x9c35('0x3a')]['rawAttributes']);_0x23afc2[_0x9c35('0x22')]=_['keys'](_0x4571f9[_0x9c35('0x22')]);_0x23afc2[_0x9c35('0x29')]=_[_0x9c35('0x3b')](_0x23afc2[_0x9c35('0x27')],_0x23afc2[_0x9c35('0x22')]);_0x5ca172[_0x9c35('0x2b')]=_[_0x9c35('0x3b')](_0x23afc2[_0x9c35('0x27')],qs[_0x9c35('0x2a')](_0x4571f9['query'][_0x9c35('0x2a')]));_0x5ca172[_0x9c35('0x2b')]=_0x5ca172[_0x9c35('0x2b')]['length']?_0x5ca172['attributes']:_0x23afc2[_0x9c35('0x27')];if(!_0x4571f9[_0x9c35('0x22')]['hasOwnProperty'](_0x9c35('0x3c'))){_0x5ca172[_0x9c35('0xd')]=qs[_0x9c35('0xd')](_0x4571f9[_0x9c35('0x22')][_0x9c35('0xd')]);_0x5ca172[_0x9c35('0xf')]=qs['offset'](_0x4571f9[_0x9c35('0x22')]['offset']);}_0x5ca172[_0x9c35('0x3d')]=qs[_0x9c35('0x3e')](_0x4571f9[_0x9c35('0x22')]['sort']);_0x5ca172[_0x9c35('0x20')]=qs[_0x9c35('0x29')](_[_0x9c35('0x3f')](_0x4571f9[_0x9c35('0x22')],_0x23afc2[_0x9c35('0x29')]));_0x5ca172[_0x9c35('0x20')]['FaxQueueId']=_0x1d24ae['id'];if(_0x4571f9['query'][_0x9c35('0x40')]){_0x5ca172[_0x9c35('0x20')]=_[_0x9c35('0x41')](_0x5ca172['where'],{'$or':_[_0x9c35('0x42')](_0x5ca172[_0x9c35('0x2b')],function(_0x433379){var _0x3f8768={};_0x3f8768[_0x433379]={'$like':'%'+_0x4571f9[_0x9c35('0x22')][_0x9c35('0x40')]+'%'};return _0x3f8768;})});}_0x5ca172=_[_0x9c35('0x41')]({},_0x5ca172,_0x4571f9['options']);return db['UserFaxQueue'][_0x9c35('0x23')](_0x5ca172);}})[_0x9c35('0x14')](function(_0x590844){if(_0x590844){return db[_0x9c35('0x43')][_0x9c35('0x44')]({'where':{'id':_[_0x9c35('0x42')](_0x590844,_0x9c35('0x45')),'role':_0x9c35('0x46')},'attributes':['id',_0x9c35('0x19'),_0x9c35('0x47'),_0x9c35('0x48'),_0x9c35('0x49')]});}})[_0x9c35('0x14')](function(_0x3a168c){if(_0x3a168c){return{'count':_0x3a168c[_0x9c35('0xe')],'rows':_[_0x9c35('0x42')](_0x3a168c[_0x9c35('0x24')],function(_0x1effb){return{'membername':_0x1effb[_0x9c35('0x19')],'UserId':_0x1effb['id'],'queue_name':_0x58a2c2[_0x9c35('0x19')],'FaxQueueId':_0x58a2c2['id'],'interface':util[_0x9c35('0x4a')](_0x9c35('0x4b'),_0x9c35('0x4c'),_0x1effb[_0x9c35('0x19')]),'penalty':0x0,'paused':_0x1effb[_0x9c35('0x47')],'createdAt':_0x1effb[_0x9c35('0x49')],'updatedAt':_0x1effb[_0x9c35('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9c35('0x14')](respondWithFilteredResult(_0x258d0a,_0x5ca172))[_0x9c35('0x25')](handleError(_0x258d0a,null));};exports[_0x9c35('0x4d')]=function(_0x55804e,_0x2f3086){var _0x21d903={};var _0x1bf387={};var _0x59a221;var _0x3903bd;return db['FaxQueue'][_0x9c35('0x39')]({'where':{'id':_0x55804e[_0x9c35('0x36')]['id']}})[_0x9c35('0x14')](handleEntityNotFound(_0x2f3086,null))[_0x9c35('0x14')](function(_0x20f8c8){if(_0x20f8c8){_0x59a221=_0x20f8c8;_0x1bf387[_0x9c35('0x27')]=_['keys'](db[_0x9c35('0x4e')][_0x9c35('0x1d')]);_0x1bf387[_0x9c35('0x22')]=_[_0x9c35('0x28')](_0x55804e['query']);_0x1bf387[_0x9c35('0x29')]=_[_0x9c35('0x3b')](_0x1bf387['model'],_0x1bf387['query']);_0x21d903[_0x9c35('0x2b')]=_[_0x9c35('0x3b')](_0x1bf387[_0x9c35('0x27')],qs[_0x9c35('0x2a')](_0x55804e[_0x9c35('0x22')][_0x9c35('0x2a')]));_0x21d903[_0x9c35('0x2b')]=_0x21d903[_0x9c35('0x2b')]['length']?_0x21d903[_0x9c35('0x2b')]:_0x1bf387['model'];_0x21d903[_0x9c35('0x3d')]=qs[_0x9c35('0x3e')](_0x55804e[_0x9c35('0x22')]['sort']);_0x21d903[_0x9c35('0x20')]=qs[_0x9c35('0x29')](_['pick'](_0x55804e[_0x9c35('0x22')],_0x1bf387[_0x9c35('0x29')]));if(_0x55804e[_0x9c35('0x22')]['filter']){_0x21d903[_0x9c35('0x20')]=_[_0x9c35('0x41')](_0x21d903[_0x9c35('0x20')],{'$or':_['map'](_0x21d903[_0x9c35('0x2b')],function(_0x313fb6){var _0x370aef={};_0x370aef[_0x313fb6]={'$like':'%'+_0x55804e[_0x9c35('0x22')]['filter']+'%'};return _0x370aef;})});}_0x21d903=_[_0x9c35('0x41')]({},_0x21d903,_0x55804e[_0x9c35('0x2e')]);return _0x59a221[_0x9c35('0x4d')](_0x21d903);}})[_0x9c35('0x14')](function(_0x1ab635){if(_0x1ab635){_0x3903bd=_0x1ab635[_0x9c35('0x2c')];if(!_0x55804e[_0x9c35('0x22')][_0x9c35('0x4f')](_0x9c35('0x3c'))){_0x21d903['limit']=qs[_0x9c35('0xd')](_0x55804e[_0x9c35('0x22')][_0x9c35('0xd')]);_0x21d903[_0x9c35('0xf')]=qs['offset'](_0x55804e['query'][_0x9c35('0xf')]);}return _0x59a221[_0x9c35('0x4d')](_0x21d903);}})['then'](function(_0x46c171){if(_0x46c171){return _0x46c171?{'count':_0x3903bd,'rows':_0x46c171}:null;}})[_0x9c35('0x14')](respondWithResult(_0x2f3086,null))[_0x9c35('0x25')](handleError(_0x2f3086,null));};exports[_0x9c35('0x50')]=function(_0x392ace,_0x4e6395){var _0x103871=_0x392ace['body'][_0x9c35('0x51')];return db[_0x9c35('0x4e')][_0x9c35('0x23')]({'where':{'id':_0x103871},'attributes':['id'],'include':[{'model':db[_0x9c35('0x43')],'as':_0x9c35('0x52'),'attributes':['id',_0x9c35('0x19'),_0x9c35('0x53'),'voicePause',_0x9c35('0x54')],'raw':!![]}]})[_0x9c35('0x14')](function(_0x23ac9a){if(_0x23ac9a){var _0x3efc42=_[_0x9c35('0x55')](_0x23ac9a,function(_0x3be13f){var _0x550567=_0x3be13f['get']({'plain':!![]});return _0x550567['Agents'];});return db[_0x9c35('0x1c')][_0x9c35('0x2f')]({'where':{'id':_0x392ace[_0x9c35('0x36')]['id']}})[_0x9c35('0x14')](function(_0x3688f1){return db[_0x9c35('0x56')][_0x9c35('0x57')](function(_0x3df12c){return _0x3688f1['addTeams'](_0x103871,{'transaction':_0x3df12c})[_0x9c35('0x14')](function(){return BPromise[_0x9c35('0x58')](_0x3efc42,function(_0x92aa4c){return db[_0x9c35('0x3a')][_0x9c35('0x59')]({'where':{'UserId':_0x92aa4c['id'],'FaxQueueId':_0x392ace['params']['id']},'transaction':_0x3df12c});});})['then'](function(){_0x3efc42[_0x9c35('0x5a')](function(_0x23f44a){socket[_0x9c35('0x5b')](_0x9c35('0x5c'),{'UserId':_0x23f44a['id'],'FaxQueueId':_0x3688f1['id']});});});});});}})[_0x9c35('0x14')](respondWithStatusCode(_0x4e6395,null))[_0x9c35('0x25')](handleError(_0x4e6395,null));};exports[_0x9c35('0x5d')]=function(_0x538cf0,_0x1c5201){return db[_0x9c35('0x4e')][_0x9c35('0x23')]({'where':{'id':_0x538cf0[_0x9c35('0x22')][_0x9c35('0x51')]},'attributes':['id'],'include':[{'model':db[_0x9c35('0x43')],'as':_0x9c35('0x52'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1c5201,null))['then'](function(_0xa222ad){var _0x1499db=_[_0x9c35('0x42')](_0xa222ad,'id');var _0x4a9cb1=[];var _0x54c879=[];var _0x342436=squel[_0x9c35('0x5e')]();_0x342436[_0x9c35('0x5f')](_0x9c35('0x60'))['from'](_0x9c35('0x61'),'tq')['join'](_0x9c35('0x62'),'ut',_0x9c35('0x63'))['where'](_0x9c35('0x64'),_0x538cf0[_0x9c35('0x36')]['id']);for(var _0x4111d0=0x0;_0x4111d0<_0xa222ad[_0x9c35('0x2c')];_0x4111d0+=0x1){let _0x299a9e=_0xa222ad[_0x4111d0];for(var _0x57030f=0x0;_0x57030f<_0x299a9e[_0x9c35('0x52')][_0x9c35('0x2c')];_0x57030f+=0x1){let _0x23d80f=_0x299a9e[_0x9c35('0x52')][_0x57030f];var _0xf1dbb9=_0x342436[_0x9c35('0x65')]();_0xf1dbb9[_0x9c35('0x20')](_0x9c35('0x66'),_0x23d80f['id']);_0x54c879[_0x9c35('0x67')](db[_0x9c35('0x56')][_0x9c35('0x22')](_0xf1dbb9[_0x9c35('0x68')](),{'type':db[_0x9c35('0x56')][_0x9c35('0x69')][_0x9c35('0x6a')]})['then'](function(_0x439677){if(_0x439677[_0x9c35('0x2c')]===0x1){return _0x23d80f['id'];}else{var _0x4e86dd=_[_0x9c35('0x6b')](_[_0x9c35('0x42')](_0x439677,_0x9c35('0x6c')),function(_0x2f8a96){return _[_0x9c35('0x6d')](_0x1499db,_0x2f8a96);});if(_0x4e86dd){return _0x23d80f['id'];}}}));}}return BPromise['all'](_0x54c879)[_0x9c35('0x14')](function(_0x3c54e8){_0x4a9cb1=_(_0x4a9cb1)['union'](_0x3c54e8)['compact']()['value']();return db[_0x9c35('0x1c')][_0x9c35('0x2f')]({'where':{'id':_0x538cf0['params']['id']}})[_0x9c35('0x14')](function(_0x2a9449){return db[_0x9c35('0x56')]['transaction'](function(_0x32b861){return _0x2a9449[_0x9c35('0x5d')](_0x538cf0[_0x9c35('0x22')]['ids'],{'transaction':_0x32b861})[_0x9c35('0x14')](function(){if(!_[_0x9c35('0x6e')](_0x4a9cb1)){return _0x2a9449[_0x9c35('0x6f')](_0x4a9cb1,{'transaction':_0x32b861});}})['then'](function(){_0x4a9cb1[_0x9c35('0x5a')](function(_0x3a222d){socket[_0x9c35('0x5b')](_0x9c35('0x70'),{'UserId':_0x3a222d,'FaxQueueId':_0x2a9449['id']});});});});});});})[_0x9c35('0x14')](respondWithStatusCode(_0x1c5201,null))['catch'](handleError(_0x1c5201,null));};exports[_0x9c35('0x71')]=function(_0x48c11d,_0x31ad01){return db[_0x9c35('0x1c')][_0x9c35('0x2f')]({'where':{'id':_0x48c11d[_0x9c35('0x36')]['id']}})['then'](handleEntityNotFound(_0x31ad01,null))['then'](function(_0x191094){if(_0x191094){return _0x191094[_0x9c35('0x71')](_0x48c11d[_0x9c35('0x35')][_0x9c35('0x51')],_['omit'](_0x48c11d[_0x9c35('0x35')],[_0x9c35('0x51'),'id'])||{})[_0x9c35('0x72')](function(_0x5ae212){for(var _0x3fb812=0x0;_0x3fb812<_0x48c11d[_0x9c35('0x35')][_0x9c35('0x51')][_0x9c35('0x2c')];_0x3fb812+=0x1){socket[_0x9c35('0x5b')](_0x9c35('0x5c'),{'UserId':Number(_0x48c11d[_0x9c35('0x35')]['ids'][_0x3fb812]),'FaxQueueId':Number(_0x48c11d[_0x9c35('0x36')]['id'])});}return _0x5ae212;});}})[_0x9c35('0x14')](respondWithResult(_0x31ad01,null))[_0x9c35('0x25')](handleError(_0x31ad01,null));};exports[_0x9c35('0x6f')]=function(_0x31f0ad,_0x21b7ba){return db[_0x9c35('0x1c')][_0x9c35('0x2f')]({'where':{'id':_0x31f0ad[_0x9c35('0x36')]['id']}})['then'](handleEntityNotFound(_0x21b7ba,null))[_0x9c35('0x14')](function(_0x4631ea){if(_0x4631ea){return _0x4631ea[_0x9c35('0x6f')](_0x31f0ad[_0x9c35('0x22')][_0x9c35('0x51')])[_0x9c35('0x14')](function(){if(_[_0x9c35('0x73')](_0x31f0ad[_0x9c35('0x22')][_0x9c35('0x51')])){for(var _0x290fc1=0x0;_0x290fc1<_0x31f0ad[_0x9c35('0x22')][_0x9c35('0x51')][_0x9c35('0x2c')];_0x290fc1+=0x1){socket[_0x9c35('0x5b')](_0x9c35('0x70'),{'UserId':Number(_0x31f0ad[_0x9c35('0x22')][_0x9c35('0x51')][_0x290fc1]),'FaxQueueId':Number(_0x31f0ad[_0x9c35('0x36')]['id'])});}}else{socket[_0x9c35('0x5b')](_0x9c35('0x70'),{'UserId':Number(_0x31f0ad[_0x9c35('0x22')][_0x9c35('0x51')]),'FaxQueueId':Number(_0x31f0ad[_0x9c35('0x36')]['id'])});}});}})[_0x9c35('0x14')](respondWithStatusCode(_0x21b7ba,null))[_0x9c35('0x25')](handleError(_0x21b7ba,null));};exports[_0x9c35('0x74')]=function(_0x5775e0,_0x6e456a){var _0x3de11c={};var _0x39630e={};var _0x39847a;var _0x16c704;return db['FaxQueue'][_0x9c35('0x39')]({'where':{'id':_0x5775e0[_0x9c35('0x36')]['id']}})[_0x9c35('0x14')](handleEntityNotFound(_0x6e456a,null))['then'](function(_0x3fa2e3){if(_0x3fa2e3){_0x39847a=_0x3fa2e3;_0x39630e[_0x9c35('0x27')]=_['keys'](db[_0x9c35('0x43')][_0x9c35('0x1d')]);_0x39630e['query']=_[_0x9c35('0x28')](_0x5775e0[_0x9c35('0x22')]);_0x39630e['filters']=_[_0x9c35('0x3b')](_0x39630e[_0x9c35('0x27')],_0x39630e['query']);_0x3de11c[_0x9c35('0x2b')]=_[_0x9c35('0x3b')](_0x39630e[_0x9c35('0x27')],qs[_0x9c35('0x2a')](_0x5775e0[_0x9c35('0x22')]['fields']));_0x3de11c['attributes']=_0x3de11c[_0x9c35('0x2b')]['length']?_0x3de11c['attributes']:_0x39630e['model'];_0x3de11c['order']=qs['sort'](_0x5775e0[_0x9c35('0x22')][_0x9c35('0x3e')]);_0x3de11c[_0x9c35('0x20')]=qs[_0x9c35('0x29')](_[_0x9c35('0x3f')](_0x5775e0[_0x9c35('0x22')],_0x39630e['filters']));if(_0x5775e0[_0x9c35('0x22')][_0x9c35('0x40')]){_0x3de11c[_0x9c35('0x20')]=_[_0x9c35('0x41')](_0x3de11c[_0x9c35('0x20')],{'$or':_[_0x9c35('0x42')](_0x3de11c['attributes'],function(_0x2250f9){var _0x35bc1a={};_0x35bc1a[_0x2250f9]={'$like':'%'+_0x5775e0[_0x9c35('0x22')][_0x9c35('0x40')]+'%'};return _0x35bc1a;})});}_0x3de11c=_[_0x9c35('0x41')]({},_0x3de11c,_0x5775e0[_0x9c35('0x2e')]);return _0x39847a[_0x9c35('0x74')](_0x3de11c);}})[_0x9c35('0x14')](function(_0xa2e3b6){if(_0xa2e3b6){_0x16c704=_0xa2e3b6[_0x9c35('0x2c')];if(!_0x5775e0[_0x9c35('0x22')][_0x9c35('0x4f')]('nolimit')){_0x3de11c[_0x9c35('0xd')]=qs[_0x9c35('0xd')](_0x5775e0[_0x9c35('0x22')]['limit']);_0x3de11c[_0x9c35('0xf')]=qs[_0x9c35('0xf')](_0x5775e0['query']['offset']);}return _0x39847a[_0x9c35('0x74')](_0x3de11c);}})[_0x9c35('0x14')](function(_0x4a881b){if(_0x4a881b){return _0x4a881b?{'count':_0x16c704,'rows':_0x4a881b}:null;}})[_0x9c35('0x14')](respondWithResult(_0x6e456a,null))[_0x9c35('0x25')](handleError(_0x6e456a,null));}; \ No newline at end of file +var _0x68b3=['FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','filters','model','intersection','fields','attributes','includeAll','merge','options','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','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','pick','User','UserId','agent','updatedAt','createdAt','%s/%s','SIP','faxPause','Team','filter','getTeams','length','ids','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','emit','userFaxQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','all','union','compact','isEmpty','addAgents','omit','spread','removeAgents','isArray','userFaxQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','error','name','send','index','map'];(function(_0x3058d5,_0x1b1a08){var _0x4f16f5=function(_0x3f8870){while(--_0x3f8870){_0x3058d5['push'](_0x3058d5['shift']());}};_0x4f16f5(++_0x1b1a08);}(_0x68b3,0x1d8));var _0x368b=function(_0x48a13e,_0x725b7d){_0x48a13e=_0x48a13e-0x0;var _0x5e620b=_0x68b3[_0x48a13e];return _0x5e620b;};'use strict';var BPromise=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var _=require(_0x368b('0x2'));var squel=require(_0x368b('0x3'));var Redis=require(_0x368b('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x368b('0x5'))(_0x368b('0x6'));var config=require(_0x368b('0x7'));var db=require(_0x368b('0x8'))['db'];config['redis']=_[_0x368b('0x9')](config[_0x368b('0xa')],{'host':_0x368b('0xb'),'port':0x18eb});var socket=require(_0x368b('0xc'))(new Redis(config[_0x368b('0xa')]));require(_0x368b('0xd'))[_0x368b('0xe')](socket);function respondWithStatusCode(_0x142d05,_0x23622f){_0x23622f=_0x23622f||0xcc;return function(_0x1f64d8){if(_0x1f64d8){return _0x142d05[_0x368b('0xf')](_0x23622f);}return _0x142d05['status'](_0x23622f)[_0x368b('0x10')]();};}function respondWithResult(_0xdbd344,_0x34a110){_0x34a110=_0x34a110||0xc8;return function(_0x51d513){if(_0x51d513){return _0xdbd344[_0x368b('0x11')](_0x34a110)[_0x368b('0x12')](_0x51d513);}};}function respondWithFilteredResult(_0x253e4b,_0x5924a6){return function(_0x41fbfd){if(_0x41fbfd){var _0x847dcb=typeof _0x5924a6['offset']===_0x368b('0x13')&&typeof _0x5924a6[_0x368b('0x14')]===_0x368b('0x13');var _0x4015fe=_0x41fbfd[_0x368b('0x15')];var _0x4fffe5=_0x847dcb?0x0:_0x5924a6[_0x368b('0x16')];var _0x40faa0=_0x847dcb?_0x41fbfd['count']:_0x5924a6[_0x368b('0x16')]+_0x5924a6[_0x368b('0x14')];var _0x30c245;if(_0x40faa0>=_0x4015fe){_0x40faa0=_0x4015fe;_0x30c245=0xc8;}else{_0x30c245=0xce;}_0x253e4b['status'](_0x30c245);return _0x253e4b[_0x368b('0x17')](_0x368b('0x18'),_0x4fffe5+'-'+_0x40faa0+'/'+_0x4015fe)[_0x368b('0x12')](_0x41fbfd);}return null;};}function saveUpdates(_0x4d6d9d){return function(_0x102407){if(_0x102407){return _0x102407[_0x368b('0x19')](_0x4d6d9d)[_0x368b('0x1a')](function(_0x540f57){return _0x540f57;});}return null;};}function removeEntity(_0x5d543e){return function(_0x3e2e9f){if(_0x3e2e9f){return _0x3e2e9f[_0x368b('0x1b')]()[_0x368b('0x1a')](function(){var _0x1e632a=_0x3e2e9f[_0x368b('0x1c')]({'plain':!![]});var _0x4b8fb7=_0x368b('0x1d');return db[_0x368b('0x1e')][_0x368b('0x1b')]({'where':{'type':_0x4b8fb7,'resourceId':_0x1e632a['id']}})[_0x368b('0x1a')](function(){return _0x3e2e9f;});})[_0x368b('0x1a')](function(){_0x5d543e[_0x368b('0x11')](0xcc)[_0x368b('0x10')]();});}};}function handleEntityNotFound(_0x1d8066){return function(_0x508e48){if(!_0x508e48){_0x1d8066[_0x368b('0xf')](0x194);}return _0x508e48;};}function handleError(_0x2f08d9,_0x18869a){_0x18869a=_0x18869a||0x1f4;return function(_0xc0f7af){logger[_0x368b('0x1f')](_0xc0f7af['stack']);if(_0xc0f7af[_0x368b('0x20')]){delete _0xc0f7af[_0x368b('0x20')];}_0x2f08d9[_0x368b('0x11')](_0x18869a)[_0x368b('0x21')](_0xc0f7af);};}exports[_0x368b('0x22')]=function(_0x85515f,_0x430e16){var _0x11ea2d={};var _0x3123c1={'count':0x0,'rows':[]};var _0x3f7f89=_[_0x368b('0x23')](db[_0x368b('0x24')][_0x368b('0x25')],function(_0x376e61){return{'name':_0x376e61[_0x368b('0x26')],'type':_0x376e61[_0x368b('0x27')][_0x368b('0x28')]};});_0x11ea2d=qs[_0x368b('0x29')](_0x3f7f89,_0x85515f);var _0x39ef94={'where':_0x11ea2d[_0x368b('0x2a')]};return db[_0x368b('0x24')][_0x368b('0x15')](_0x39ef94)[_0x368b('0x1a')](function(_0x3c80b5){_0x3123c1['count']=_0x3c80b5;_0x11ea2d['include']=qs[_0x368b('0x2b')](_0x85515f[_0x368b('0x2c')]);return db[_0x368b('0x24')][_0x368b('0x2d')](_0x11ea2d);})['then'](function(_0x12ae59){_0x3123c1[_0x368b('0x2e')]=_0x12ae59;return _0x3123c1;})[_0x368b('0x1a')](respondWithFilteredResult(_0x430e16,_0x11ea2d))[_0x368b('0x2f')](handleError(_0x430e16,null));};exports[_0x368b('0x30')]=function(_0x4d8410,_0x22ada9){var _0x424fab={'raw':!![],'where':{'id':_0x4d8410[_0x368b('0x31')]['id']}},_0x239536={};_0x239536['model']=_['keys'](db['FaxQueue'][_0x368b('0x25')]);_0x239536[_0x368b('0x2c')]=_[_0x368b('0x32')](_0x4d8410[_0x368b('0x2c')]);_0x239536[_0x368b('0x33')]=_['intersection'](_0x239536[_0x368b('0x34')],_0x239536[_0x368b('0x2c')]);_0x424fab['attributes']=_[_0x368b('0x35')](_0x239536[_0x368b('0x34')],qs['fields'](_0x4d8410[_0x368b('0x2c')][_0x368b('0x36')]));_0x424fab['attributes']=_0x424fab[_0x368b('0x37')]['length']?_0x424fab['attributes']:_0x239536['model'];if(_0x4d8410[_0x368b('0x2c')][_0x368b('0x38')]){_0x424fab[_0x368b('0x2b')]=[{'all':!![]}];}_0x424fab=_[_0x368b('0x39')]({},_0x424fab,_0x4d8410[_0x368b('0x3a')]);return db[_0x368b('0x24')][_0x368b('0x3b')](_0x424fab)[_0x368b('0x1a')](handleEntityNotFound(_0x22ada9,null))[_0x368b('0x1a')](respondWithResult(_0x22ada9,null))[_0x368b('0x2f')](handleError(_0x22ada9,null));};exports['create']=function(_0x204c52,_0x1f60ea){return db['FaxQueue'][_0x368b('0x3c')](_0x204c52[_0x368b('0x3d')],{})[_0x368b('0x1a')](function(_0x231d84){var _0x248b2b=_0x204c52['user'][_0x368b('0x1c')]({'plain':!![]});if(!_0x248b2b)throw new Error(_0x368b('0x3e'));if(_0x248b2b[_0x368b('0x3f')]===_0x368b('0x40')){var _0x4e44d0=_0x231d84['get']({'plain':!![]});var _0x7ba60d=_0x368b('0x1d');return db[_0x368b('0x41')][_0x368b('0x3b')]({'where':{'name':_0x7ba60d,'userProfileId':_0x248b2b[_0x368b('0x42')]},'raw':!![]})[_0x368b('0x1a')](function(_0x1d990c){if(_0x1d990c&&_0x1d990c[_0x368b('0x43')]===0x0){return db[_0x368b('0x1e')][_0x368b('0x3c')]({'name':_0x4e44d0['name'],'resourceId':_0x4e44d0['id'],'type':_0x1d990c[_0x368b('0x20')],'sectionId':_0x1d990c['id']},{})[_0x368b('0x1a')](function(){return _0x231d84;});}else{return _0x231d84;}})['catch'](function(_0x25e713){logger[_0x368b('0x1f')](_0x368b('0x44'),_0x25e713);throw _0x25e713;});}return _0x231d84;})[_0x368b('0x1a')](respondWithResult(_0x1f60ea,0xc9))['catch'](handleError(_0x1f60ea,null));};exports[_0x368b('0x19')]=function(_0x151711,_0x4a0275){if(_0x151711[_0x368b('0x3d')]['id']){delete _0x151711[_0x368b('0x3d')]['id'];}return db[_0x368b('0x24')]['find']({'where':{'id':_0x151711[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x4a0275,null))[_0x368b('0x1a')](saveUpdates(_0x151711['body'],null))['then'](respondWithResult(_0x4a0275,null))[_0x368b('0x2f')](handleError(_0x4a0275,null));};exports[_0x368b('0x1b')]=function(_0x568ee5,_0x2bb15a){return db[_0x368b('0x24')][_0x368b('0x3b')]({'where':{'id':_0x568ee5[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x2bb15a,null))[_0x368b('0x1a')](removeEntity(_0x2bb15a,null))[_0x368b('0x2f')](handleError(_0x2bb15a,null));};exports[_0x368b('0x45')]=function(_0x5db559,_0x33914c){return db[_0x368b('0x24')][_0x368b('0x45')]()[_0x368b('0x1a')](respondWithResult(_0x33914c,null))['catch'](handleError(_0x33914c,null));};exports[_0x368b('0x46')]=function(_0x1fff8e,_0xe79f4c){var _0xf95817={'raw':!![],'where':{}},_0x2d59fe={},_0x5a827e;return db['FaxQueue'][_0x368b('0x47')]({'where':{'id':_0x1fff8e[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0xe79f4c,null))['then'](function(_0x378510){if(_0x378510){_0x5a827e=_0x378510[_0x368b('0x1c')]({'plain':!![]});_0x2d59fe[_0x368b('0x34')]=_[_0x368b('0x32')](db[_0x368b('0x48')][_0x368b('0x25')]);_0x2d59fe[_0x368b('0x2c')]=_[_0x368b('0x32')](_0x1fff8e[_0x368b('0x2c')]);_0x2d59fe[_0x368b('0x33')]=_['intersection'](_0x2d59fe[_0x368b('0x34')],_0x2d59fe['query']);_0xf95817[_0x368b('0x37')]=_['intersection'](_0x2d59fe[_0x368b('0x34')],qs['fields'](_0x1fff8e[_0x368b('0x2c')][_0x368b('0x36')]));_0xf95817[_0x368b('0x37')]=_0xf95817[_0x368b('0x37')]['length']?_0xf95817[_0x368b('0x37')]:_0x2d59fe[_0x368b('0x34')];if(!_0x1fff8e[_0x368b('0x2c')][_0x368b('0x49')](_0x368b('0x4a'))){_0xf95817[_0x368b('0x14')]=qs[_0x368b('0x14')](_0x1fff8e[_0x368b('0x2c')][_0x368b('0x14')]);_0xf95817['offset']=qs[_0x368b('0x16')](_0x1fff8e[_0x368b('0x2c')][_0x368b('0x16')]);}_0xf95817[_0x368b('0x4b')]=qs[_0x368b('0x4c')](_0x1fff8e['query'][_0x368b('0x4c')]);_0xf95817[_0x368b('0x2a')]=qs[_0x368b('0x33')](_[_0x368b('0x4d')](_0x1fff8e[_0x368b('0x2c')],_0x2d59fe[_0x368b('0x33')]));_0xf95817[_0x368b('0x2a')]['FaxQueueId']=_0x378510['id'];if(_0x1fff8e['query']['filter']){_0xf95817['where']=_[_0x368b('0x39')](_0xf95817['where'],{'$or':_[_0x368b('0x23')](_0xf95817[_0x368b('0x37')],function(_0x509dd4){var _0x5711ee={};_0x5711ee[_0x509dd4]={'$like':'%'+_0x1fff8e[_0x368b('0x2c')]['filter']+'%'};return _0x5711ee;})});}_0xf95817=_[_0x368b('0x39')]({},_0xf95817,_0x1fff8e[_0x368b('0x3a')]);return db['UserFaxQueue'][_0x368b('0x2d')](_0xf95817);}})[_0x368b('0x1a')](function(_0x58eb4a){if(_0x58eb4a){return db[_0x368b('0x4e')]['findAndCountAll']({'where':{'id':_[_0x368b('0x23')](_0x58eb4a,_0x368b('0x4f')),'role':_0x368b('0x50')},'attributes':['id',_0x368b('0x20'),'faxPause',_0x368b('0x51'),_0x368b('0x52')]});}})[_0x368b('0x1a')](function(_0x14974e){if(_0x14974e){return{'count':_0x14974e['count'],'rows':_[_0x368b('0x23')](_0x14974e['rows'],function(_0xa320cc){return{'membername':_0xa320cc[_0x368b('0x20')],'UserId':_0xa320cc['id'],'queue_name':_0x5a827e['name'],'FaxQueueId':_0x5a827e['id'],'interface':util['format'](_0x368b('0x53'),_0x368b('0x54'),_0xa320cc[_0x368b('0x20')]),'penalty':0x0,'paused':_0xa320cc[_0x368b('0x55')],'createdAt':_0xa320cc[_0x368b('0x52')],'updatedAt':_0xa320cc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x368b('0x1a')](respondWithFilteredResult(_0xe79f4c,_0xf95817))[_0x368b('0x2f')](handleError(_0xe79f4c,null));};exports['getTeams']=function(_0x2e5827,_0x19d5cc){var _0x472507={};var _0x302b06={};var _0x5ef40c;var _0x3d66fe;return db[_0x368b('0x24')][_0x368b('0x47')]({'where':{'id':_0x2e5827[_0x368b('0x31')]['id']}})['then'](handleEntityNotFound(_0x19d5cc,null))['then'](function(_0x5c8438){if(_0x5c8438){_0x5ef40c=_0x5c8438;_0x302b06['model']=_[_0x368b('0x32')](db[_0x368b('0x56')]['rawAttributes']);_0x302b06['query']=_['keys'](_0x2e5827['query']);_0x302b06['filters']=_[_0x368b('0x35')](_0x302b06[_0x368b('0x34')],_0x302b06[_0x368b('0x2c')]);_0x472507['attributes']=_[_0x368b('0x35')](_0x302b06['model'],qs['fields'](_0x2e5827[_0x368b('0x2c')][_0x368b('0x36')]));_0x472507[_0x368b('0x37')]=_0x472507[_0x368b('0x37')]['length']?_0x472507[_0x368b('0x37')]:_0x302b06[_0x368b('0x34')];_0x472507[_0x368b('0x4b')]=qs['sort'](_0x2e5827[_0x368b('0x2c')][_0x368b('0x4c')]);_0x472507['where']=qs[_0x368b('0x33')](_[_0x368b('0x4d')](_0x2e5827['query'],_0x302b06[_0x368b('0x33')]));if(_0x2e5827['query'][_0x368b('0x57')]){_0x472507[_0x368b('0x2a')]=_['merge'](_0x472507[_0x368b('0x2a')],{'$or':_[_0x368b('0x23')](_0x472507[_0x368b('0x37')],function(_0x46d394){var _0x281023={};_0x281023[_0x46d394]={'$like':'%'+_0x2e5827['query'][_0x368b('0x57')]+'%'};return _0x281023;})});}_0x472507=_[_0x368b('0x39')]({},_0x472507,_0x2e5827[_0x368b('0x3a')]);return _0x5ef40c[_0x368b('0x58')](_0x472507);}})[_0x368b('0x1a')](function(_0x1c9cce){if(_0x1c9cce){_0x3d66fe=_0x1c9cce[_0x368b('0x59')];if(!_0x2e5827[_0x368b('0x2c')]['hasOwnProperty'](_0x368b('0x4a'))){_0x472507[_0x368b('0x14')]=qs['limit'](_0x2e5827[_0x368b('0x2c')][_0x368b('0x14')]);_0x472507[_0x368b('0x16')]=qs['offset'](_0x2e5827['query'][_0x368b('0x16')]);}return _0x5ef40c[_0x368b('0x58')](_0x472507);}})[_0x368b('0x1a')](function(_0xb7cef7){if(_0xb7cef7){return _0xb7cef7?{'count':_0x3d66fe,'rows':_0xb7cef7}:null;}})['then'](respondWithResult(_0x19d5cc,null))[_0x368b('0x2f')](handleError(_0x19d5cc,null));};exports['addTeams']=function(_0x19d3b4,_0x2af914){var _0x3eb462=_0x19d3b4['body'][_0x368b('0x5a')];return db[_0x368b('0x56')][_0x368b('0x2d')]({'where':{'id':_0x3eb462},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x368b('0x5b'),_0x368b('0x5c'),_0x368b('0x5d')],'raw':!![]}]})[_0x368b('0x1a')](function(_0x321112){if(_0x321112){var _0x5c338d=_[_0x368b('0x5e')](_0x321112,function(_0x3abf65){var _0x49e2fc=_0x3abf65[_0x368b('0x1c')]({'plain':!![]});return _0x49e2fc['Agents'];});return db['FaxQueue'][_0x368b('0x3b')]({'where':{'id':_0x19d3b4[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](function(_0x21bfb3){return db[_0x368b('0x5f')][_0x368b('0x60')](function(_0x4921b0){return _0x21bfb3[_0x368b('0x61')](_0x3eb462,{'transaction':_0x4921b0})[_0x368b('0x1a')](function(){return BPromise[_0x368b('0x62')](_0x5c338d,function(_0x5d4179){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x5d4179['id'],'FaxQueueId':_0x19d3b4['params']['id']},'transaction':_0x4921b0});});})[_0x368b('0x1a')](function(){_0x5c338d['forEach'](function(_0x5ab241){socket[_0x368b('0x63')](_0x368b('0x64'),{'UserId':_0x5ab241['id'],'FaxQueueId':_0x21bfb3['id']});});});});});}})[_0x368b('0x1a')](respondWithStatusCode(_0x2af914,null))[_0x368b('0x2f')](handleError(_0x2af914,null));};exports[_0x368b('0x65')]=function(_0xbfdde2,_0x67794e){return db[_0x368b('0x56')]['findAll']({'where':{'id':_0xbfdde2[_0x368b('0x2c')][_0x368b('0x5a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x368b('0x66'),'attributes':['id'],'raw':!![]}]})[_0x368b('0x1a')](handleEntityNotFound(_0x67794e,null))[_0x368b('0x1a')](function(_0xb49743){var _0x152962=_[_0x368b('0x23')](_0xb49743,'id');var _0x1ac79c=[];var _0x41e848=[];var _0x26013b=squel[_0x368b('0x67')]();_0x26013b[_0x368b('0x68')](_0x368b('0x69'))[_0x368b('0x6a')](_0x368b('0x6b'),'tq')['join']('user_has_teams','ut',_0x368b('0x6c'))[_0x368b('0x2a')](_0x368b('0x6d'),_0xbfdde2['params']['id']);for(var _0x208cbb=0x0;_0x208cbb<_0xb49743[_0x368b('0x59')];_0x208cbb+=0x1){let _0x2350b5=_0xb49743[_0x208cbb];for(var _0x480af7=0x0;_0x480af7<_0x2350b5[_0x368b('0x66')][_0x368b('0x59')];_0x480af7+=0x1){let _0x5053b3=_0x2350b5[_0x368b('0x66')][_0x480af7];var _0x318be2=_0x26013b[_0x368b('0x6e')]();_0x318be2['where']('ut.UserId\x20=\x20?',_0x5053b3['id']);_0x41e848[_0x368b('0x6f')](db['sequelize'][_0x368b('0x2c')](_0x318be2[_0x368b('0x70')](),{'type':db[_0x368b('0x5f')][_0x368b('0x71')]['SELECT']})[_0x368b('0x1a')](function(_0x1a35c9){if(_0x1a35c9[_0x368b('0x59')]===0x1){return _0x5053b3['id'];}else{var _0x54c95a=_[_0x368b('0x72')](_[_0x368b('0x23')](_0x1a35c9,_0x368b('0x73')),function(_0x252bbd){return _['includes'](_0x152962,_0x252bbd);});if(_0x54c95a){return _0x5053b3['id'];}}}));}}return BPromise[_0x368b('0x74')](_0x41e848)['then'](function(_0x1740a6){_0x1ac79c=_(_0x1ac79c)[_0x368b('0x75')](_0x1740a6)[_0x368b('0x76')]()['value']();return db['FaxQueue']['find']({'where':{'id':_0xbfdde2['params']['id']}})[_0x368b('0x1a')](function(_0x3146a9){return db['sequelize']['transaction'](function(_0x1bde0a){return _0x3146a9['removeTeams'](_0xbfdde2[_0x368b('0x2c')][_0x368b('0x5a')],{'transaction':_0x1bde0a})['then'](function(){if(!_[_0x368b('0x77')](_0x1ac79c)){return _0x3146a9['removeAgents'](_0x1ac79c,{'transaction':_0x1bde0a});}})[_0x368b('0x1a')](function(){_0x1ac79c['forEach'](function(_0x1dd4a7){socket[_0x368b('0x63')]('userFaxQueue:remove',{'UserId':_0x1dd4a7,'FaxQueueId':_0x3146a9['id']});});});});});});})[_0x368b('0x1a')](respondWithStatusCode(_0x67794e,null))['catch'](handleError(_0x67794e,null));};exports[_0x368b('0x78')]=function(_0x2798e1,_0x51c695){return db['FaxQueue'][_0x368b('0x3b')]({'where':{'id':_0x2798e1['params']['id']}})['then'](handleEntityNotFound(_0x51c695,null))[_0x368b('0x1a')](function(_0x54c442){if(_0x54c442){return _0x54c442['addAgents'](_0x2798e1['body']['ids'],_[_0x368b('0x79')](_0x2798e1['body'],[_0x368b('0x5a'),'id'])||{})[_0x368b('0x7a')](function(_0x4861d9){for(var _0x302d6d=0x0;_0x302d6d<_0x2798e1[_0x368b('0x3d')]['ids'][_0x368b('0x59')];_0x302d6d+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x2798e1[_0x368b('0x3d')][_0x368b('0x5a')][_0x302d6d]),'FaxQueueId':Number(_0x2798e1['params']['id'])});}return _0x4861d9;});}})[_0x368b('0x1a')](respondWithResult(_0x51c695,null))['catch'](handleError(_0x51c695,null));};exports['removeAgents']=function(_0x379dc9,_0x4d7151){return db[_0x368b('0x24')]['find']({'where':{'id':_0x379dc9['params']['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x4d7151,null))['then'](function(_0x30235b){if(_0x30235b){return _0x30235b[_0x368b('0x7b')](_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')])[_0x368b('0x1a')](function(){if(_[_0x368b('0x7c')](_0x379dc9['query'][_0x368b('0x5a')])){for(var _0x11ed4b=0x0;_0x11ed4b<_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')][_0x368b('0x59')];_0x11ed4b+=0x1){socket['emit'](_0x368b('0x7d'),{'UserId':Number(_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')][_0x11ed4b]),'FaxQueueId':Number(_0x379dc9[_0x368b('0x31')]['id'])});}}else{socket[_0x368b('0x63')](_0x368b('0x7d'),{'UserId':Number(_0x379dc9[_0x368b('0x2c')][_0x368b('0x5a')]),'FaxQueueId':Number(_0x379dc9[_0x368b('0x31')]['id'])});}});}})[_0x368b('0x1a')](respondWithStatusCode(_0x4d7151,null))[_0x368b('0x2f')](handleError(_0x4d7151,null));};exports[_0x368b('0x7e')]=function(_0x14f666,_0x509092){var _0x4136e6={};var _0x42d423={};var _0x142868;var _0x179c33;return db[_0x368b('0x24')][_0x368b('0x47')]({'where':{'id':_0x14f666[_0x368b('0x31')]['id']}})[_0x368b('0x1a')](handleEntityNotFound(_0x509092,null))[_0x368b('0x1a')](function(_0x30e6c3){if(_0x30e6c3){_0x142868=_0x30e6c3;_0x42d423[_0x368b('0x34')]=_[_0x368b('0x32')](db[_0x368b('0x4e')]['rawAttributes']);_0x42d423[_0x368b('0x2c')]=_[_0x368b('0x32')](_0x14f666['query']);_0x42d423['filters']=_['intersection'](_0x42d423[_0x368b('0x34')],_0x42d423['query']);_0x4136e6['attributes']=_[_0x368b('0x35')](_0x42d423[_0x368b('0x34')],qs[_0x368b('0x36')](_0x14f666[_0x368b('0x2c')]['fields']));_0x4136e6[_0x368b('0x37')]=_0x4136e6[_0x368b('0x37')][_0x368b('0x59')]?_0x4136e6[_0x368b('0x37')]:_0x42d423[_0x368b('0x34')];_0x4136e6[_0x368b('0x4b')]=qs['sort'](_0x14f666[_0x368b('0x2c')][_0x368b('0x4c')]);_0x4136e6[_0x368b('0x2a')]=qs[_0x368b('0x33')](_[_0x368b('0x4d')](_0x14f666['query'],_0x42d423[_0x368b('0x33')]));if(_0x14f666['query'][_0x368b('0x57')]){_0x4136e6['where']=_[_0x368b('0x39')](_0x4136e6['where'],{'$or':_[_0x368b('0x23')](_0x4136e6['attributes'],function(_0x381226){var _0x145cf5={};_0x145cf5[_0x381226]={'$like':'%'+_0x14f666['query'][_0x368b('0x57')]+'%'};return _0x145cf5;})});}_0x4136e6=_[_0x368b('0x39')]({},_0x4136e6,_0x14f666[_0x368b('0x3a')]);return _0x142868[_0x368b('0x7e')](_0x4136e6);}})[_0x368b('0x1a')](function(_0x3273ae){if(_0x3273ae){_0x179c33=_0x3273ae[_0x368b('0x59')];if(!_0x14f666[_0x368b('0x2c')][_0x368b('0x49')](_0x368b('0x4a'))){_0x4136e6[_0x368b('0x14')]=qs[_0x368b('0x14')](_0x14f666[_0x368b('0x2c')]['limit']);_0x4136e6[_0x368b('0x16')]=qs['offset'](_0x14f666[_0x368b('0x2c')]['offset']);}return _0x142868[_0x368b('0x7e')](_0x4136e6);}})[_0x368b('0x1a')](function(_0x37ecf7){if(_0x37ecf7){return _0x37ecf7?{'count':_0x179c33,'rows':_0x37ecf7}:null;}})['then'](respondWithResult(_0x509092,null))[_0x368b('0x2f')](handleError(_0x509092,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index d0081d1..96f0910 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 _0x504a=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update'];(function(_0x11fcec,_0x2e9b56){var _0x29a9ee=function(_0x11a0c8){while(--_0x11a0c8){_0x11fcec['push'](_0x11fcec['shift']());}};_0x29a9ee(++_0x2e9b56);}(_0x504a,0x15a));var _0xa504=function(_0x470534,_0x8973a5){_0x470534=_0x470534-0x0;var _0x3e78c6=_0x504a[_0x470534];return _0x3e78c6;};'use strict';var EventEmitter=require(_0xa504('0x0'));var FaxQueue=require(_0xa504('0x1'))['db'][_0xa504('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa504('0x3')](0x0);var events={'afterCreate':_0xa504('0x4'),'afterUpdate':_0xa504('0x5'),'afterDestroy':_0xa504('0x6')};function emitEvent(_0x4a126c){return function(_0x241e69,_0x21e48f,_0x41e6fe){FaxQueueEvents[_0xa504('0x7')](_0x4a126c+':'+_0x241e69['id'],_0x241e69);FaxQueueEvents[_0xa504('0x7')](_0x4a126c,_0x241e69);_0x41e6fe(null);};}for(var e in events){if(events[_0xa504('0x8')](e)){var event=events[e];FaxQueue[_0xa504('0x9')](e,emitEvent(event));}}module[_0xa504('0xa')]=FaxQueueEvents; \ No newline at end of file +var _0xbf4a=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x476137,_0x1ccb32){var _0x5acaf8=function(_0x32ff8d){while(--_0x32ff8d){_0x476137['push'](_0x476137['shift']());}};_0x5acaf8(++_0x1ccb32);}(_0xbf4a,0x1e1));var _0xabf4=function(_0x2fb0de,_0x1da740){_0x2fb0de=_0x2fb0de-0x0;var _0x4e01d2=_0xbf4a[_0x2fb0de];return _0x4e01d2;};'use strict';var EventEmitter=require(_0xabf4('0x0'));var FaxQueue=require(_0xabf4('0x1'))['db'][_0xabf4('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xabf4('0x3')](0x0);var events={'afterCreate':_0xabf4('0x4'),'afterUpdate':_0xabf4('0x5'),'afterDestroy':_0xabf4('0x6')};function emitEvent(_0x31d1b7){return function(_0x452176,_0x209fd2,_0x72acfd){FaxQueueEvents[_0xabf4('0x7')](_0x31d1b7+':'+_0x452176['id'],_0x452176);FaxQueueEvents[_0xabf4('0x7')](_0x31d1b7,_0x452176);_0x72acfd(null);};}for(var e in events){if(events[_0xabf4('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xabf4('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 1f93fbe..a6a1241 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 _0xc52f=['moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api'];(function(_0x195961,_0x364284){var _0x5a2e12=function(_0x36ea9f){while(--_0x36ea9f){_0x195961['push'](_0x195961['shift']());}};_0x5a2e12(++_0x364284);}(_0xc52f,0x100));var _0xfc52=function(_0x263d83,_0x29e843){_0x263d83=_0x263d83-0x0;var _0x39bc83=_0xc52f[_0x263d83];return _0x39bc83;};'use strict';var _=require(_0xfc52('0x0'));var util=require(_0xfc52('0x1'));var logger=require(_0xfc52('0x2'))(_0xfc52('0x3'));var moment=require(_0xfc52('0x4'));var BPromise=require(_0xfc52('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc52('0x6'));var rimraf=require(_0xfc52('0x7'));var config=require(_0xfc52('0x8'));var attributes=require(_0xfc52('0x9'));module['exports']=function(_0x31b08c,_0x330ed3){return _0x31b08c[_0xfc52('0xa')](_0xfc52('0xb'),attributes,{'tableName':_0xfc52('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b0e=['path','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','../../config/logger','moment','request-promise'];(function(_0x3d27ba,_0x2671a3){var _0xf01885=function(_0x311f5c){while(--_0x311f5c){_0x3d27ba['push'](_0x3d27ba['shift']());}};_0xf01885(++_0x2671a3);}(_0x9b0e,0xe2));var _0xe9b0=function(_0x26ea4f,_0x1b644a){_0x26ea4f=_0x26ea4f-0x0;var _0x38a160=_0x9b0e[_0x26ea4f];return _0x38a160;};'use strict';var _=require(_0xe9b0('0x0'));var util=require('util');var logger=require(_0xe9b0('0x1'))('api');var moment=require(_0xe9b0('0x2'));var BPromise=require('bluebird');var rp=require(_0xe9b0('0x3'));var fs=require('fs');var path=require(_0xe9b0('0x4'));var rimraf=require('rimraf');var config=require(_0xe9b0('0x5'));var attributes=require(_0xe9b0('0x6'));module['exports']=function(_0x3b89d7,_0x23782f){return _0x3b89d7[_0xe9b0('0x7')](_0xe9b0('0x8'),attributes,{'tableName':_0xe9b0('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 a58ac93..c202b54 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 _0x4279=['limit','include','model','attributes','map','debug','ShowFaxQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./faxQueue.socket','request','then','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where'];(function(_0x18d50f,_0x124aff){var _0x8ce385=function(_0x321962){while(--_0x321962){_0x18d50f['push'](_0x18d50f['shift']());}};_0x8ce385(++_0x124aff);}(_0x4279,0xf8));var _0x9427=function(_0xcef398,_0x250d15){_0xcef398=_0xcef398-0x0;var _0x49d661=_0x4279[_0xcef398];return _0x49d661;};'use strict';var _=require(_0x9427('0x0'));var util=require(_0x9427('0x1'));var moment=require('moment');var BPromise=require(_0x9427('0x2'));var rs=require(_0x9427('0x3'));var fs=require('fs');var Redis=require(_0x9427('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9427('0x5'));var logger=require(_0x9427('0x6'))(_0x9427('0x7'));var config=require('../../config/environment');var jayson=require(_0x9427('0x8'));var client=jayson[_0x9427('0x9')]['http']({'port':0x232a});config[_0x9427('0xa')]=_['defaults'](config['redis'],{'host':_0x9427('0xb'),'port':0x18eb});var socket=require(_0x9427('0xc'))(new Redis(config['redis']));require(_0x9427('0xd'))['register'](socket);function respondWithRpcPromise(_0x5f1d10,_0x8a75ca,_0x2e35d7){return new BPromise(function(_0x48f8a1,_0x1f32d1){return client[_0x9427('0xe')](_0x5f1d10,_0x2e35d7)[_0x9427('0xf')](function(_0x28124e){logger['info'](_0x9427('0x10'),_0x8a75ca,'request\x20sent');logger['debug'](_0x9427('0x11'),_0x8a75ca,_0x9427('0x12'),JSON[_0x9427('0x13')](_0x28124e));if(_0x28124e[_0x9427('0x14')]){if(_0x28124e[_0x9427('0x14')][_0x9427('0x15')]===0x1f4){logger[_0x9427('0x14')](_0x9427('0x10'),_0x8a75ca,_0x28124e[_0x9427('0x14')]['message']);return _0x1f32d1(_0x28124e[_0x9427('0x14')][_0x9427('0x16')]);}logger[_0x9427('0x14')](_0x9427('0x10'),_0x8a75ca,_0x28124e[_0x9427('0x14')][_0x9427('0x16')]);return _0x48f8a1(_0x28124e['error'][_0x9427('0x16')]);}else{logger[_0x9427('0x17')]('FaxQueue,\x20%s,\x20%s',_0x8a75ca,_0x9427('0x12'));_0x48f8a1(_0x28124e[_0x9427('0x18')][_0x9427('0x16')]);}})[_0x9427('0x19')](function(_0x5121b6){logger[_0x9427('0x14')](_0x9427('0x10'),_0x8a75ca,_0x5121b6);_0x1f32d1(_0x5121b6);});});}exports[_0x9427('0x1a')]=function(_0x357a46){var _0x584730=this;return new Promise(function(_0x3622e1,_0x4d4682){return db[_0x9427('0x1b')][_0x9427('0x1c')]({'raw':_0x357a46[_0x9427('0x1d')]?_0x357a46['options'][_0x9427('0x1e')]===undefined?!![]:![]:!![],'where':_0x357a46[_0x9427('0x1d')]?_0x357a46['options'][_0x9427('0x1f')]||null:null,'attributes':_0x357a46[_0x9427('0x1d')]?_0x357a46[_0x9427('0x1d')]['attributes']||null:null,'limit':_0x357a46['options']?_0x357a46[_0x9427('0x1d')][_0x9427('0x20')]||null:null,'include':_0x357a46['options']?_0x357a46[_0x9427('0x1d')][_0x9427('0x21')]?_['map'](_0x357a46[_0x9427('0x1d')][_0x9427('0x21')],function(_0xa0a71f){return{'model':db[_0xa0a71f[_0x9427('0x22')]],'as':_0xa0a71f['as'],'attributes':_0xa0a71f[_0x9427('0x23')],'include':_0xa0a71f[_0x9427('0x21')]?_['map'](_0xa0a71f[_0x9427('0x21')],function(_0x1505a5){return{'model':db[_0x1505a5[_0x9427('0x22')]],'as':_0x1505a5['as'],'attributes':_0x1505a5[_0x9427('0x23')],'include':_0x1505a5[_0x9427('0x21')]?_[_0x9427('0x24')](_0x1505a5[_0x9427('0x21')],function(_0x3bc1ff){return{'model':db[_0x3bc1ff['model']],'as':_0x3bc1ff['as'],'attributes':_0x3bc1ff[_0x9427('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc63374){logger[_0x9427('0x17')]('GetFaxQueue',_0x357a46);logger[_0x9427('0x25')](_0x9427('0x1a'),_0x357a46,JSON[_0x9427('0x13')](_0xc63374));_0x3622e1(_0xc63374);})['catch'](function(_0x5e3db2){logger[_0x9427('0x14')]('GetFaxQueue',_0x5e3db2['message'],_0x357a46);_0x4d4682(_0x584730[_0x9427('0x14')](0x1f4,_0x5e3db2[_0x9427('0x16')]));});});};exports[_0x9427('0x26')]=function(_0x3d3239){var _0x419913=this;return new Promise(function(_0x27a912,_0x12ec62){return db[_0x9427('0x1b')][_0x9427('0x27')]({'raw':_0x3d3239[_0x9427('0x1d')]?_0x3d3239['options'][_0x9427('0x1e')]===undefined?!![]:![]:!![],'where':_0x3d3239[_0x9427('0x1d')]?_0x3d3239[_0x9427('0x1d')]['where']||null:null,'attributes':_0x3d3239['options']?_0x3d3239['options']['attributes']||null:null,'include':_0x3d3239[_0x9427('0x1d')]?_0x3d3239['options']['include']?_[_0x9427('0x24')](_0x3d3239['options'][_0x9427('0x21')],function(_0x1771cb){return{'model':db[_0x1771cb['model']],'as':_0x1771cb['as'],'attributes':_0x1771cb['attributes'],'include':_0x1771cb[_0x9427('0x21')]?_[_0x9427('0x24')](_0x1771cb[_0x9427('0x21')],function(_0x5dfd6e){return{'model':db[_0x5dfd6e[_0x9427('0x22')]],'as':_0x5dfd6e['as'],'attributes':_0x5dfd6e[_0x9427('0x23')],'include':_0x5dfd6e[_0x9427('0x21')]?_[_0x9427('0x24')](_0x5dfd6e[_0x9427('0x21')],function(_0x33a6a3){return{'model':db[_0x33a6a3[_0x9427('0x22')]],'as':_0x33a6a3['as'],'attributes':_0x33a6a3[_0x9427('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9427('0xf')](function(_0x5d10dd){logger[_0x9427('0x17')]('ShowFaxQueue',_0x3d3239);logger[_0x9427('0x25')](_0x9427('0x26'),_0x3d3239,JSON[_0x9427('0x13')](_0x5d10dd));_0x27a912(_0x5d10dd);})[_0x9427('0x19')](function(_0x577673){logger[_0x9427('0x14')](_0x9427('0x26'),_0x577673[_0x9427('0x16')],_0x3d3239);_0x12ec62(_0x419913['error'](0x1f4,_0x577673[_0x9427('0x16')]));});});}; \ No newline at end of file +var _0x8da2=['then','debug','stringify','ShowFaxQueue','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','FaxQueue,\x20%s,\x20%s','error','message','info','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x59c233,_0xe0627e){var _0x26e0ef=function(_0x553d84){while(--_0x553d84){_0x59c233['push'](_0x59c233['shift']());}};_0x26e0ef(++_0xe0627e);}(_0x8da2,0x124));var _0x28da=function(_0x33353a,_0x2954a0){_0x33353a=_0x33353a-0x0;var _0x197d91=_0x8da2[_0x33353a];return _0x197d91;};'use strict';var _=require(_0x28da('0x0'));var util=require(_0x28da('0x1'));var moment=require(_0x28da('0x2'));var BPromise=require(_0x28da('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x28da('0x5'));var logger=require(_0x28da('0x6'))(_0x28da('0x7'));var config=require(_0x28da('0x8'));var jayson=require(_0x28da('0x9'));var client=jayson[_0x28da('0xa')][_0x28da('0xb')]({'port':0x232a});config[_0x28da('0xc')]=_['defaults'](config[_0x28da('0xc')],{'host':_0x28da('0xd'),'port':0x18eb});var socket=require(_0x28da('0xe'))(new Redis(config[_0x28da('0xc')]));require('./faxQueue.socket')[_0x28da('0xf')](socket);function respondWithRpcPromise(_0x1337ff,_0x209613,_0x346efa){return new BPromise(function(_0x24925c,_0x2064d8){return client['request'](_0x1337ff,_0x346efa)['then'](function(_0x224b11){logger['info'](_0x28da('0x10'),_0x209613,'request\x20sent');logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x209613,'request\x20sent',JSON['stringify'](_0x224b11));if(_0x224b11['error']){if(_0x224b11[_0x28da('0x11')]['code']===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x209613,_0x224b11[_0x28da('0x11')][_0x28da('0x12')]);return _0x2064d8(_0x224b11[_0x28da('0x11')][_0x28da('0x12')]);}logger[_0x28da('0x11')](_0x28da('0x10'),_0x209613,_0x224b11[_0x28da('0x11')][_0x28da('0x12')]);return _0x24925c(_0x224b11[_0x28da('0x11')][_0x28da('0x12')]);}else{logger[_0x28da('0x13')](_0x28da('0x10'),_0x209613,'request\x20sent');_0x24925c(_0x224b11['result'][_0x28da('0x12')]);}})[_0x28da('0x14')](function(_0x32fc51){logger[_0x28da('0x11')](_0x28da('0x10'),_0x209613,_0x32fc51);_0x2064d8(_0x32fc51);});});}exports[_0x28da('0x15')]=function(_0x18cbc2){var _0x206ec9=this;return new Promise(function(_0x27788a,_0x376dfb){return db[_0x28da('0x16')][_0x28da('0x17')]({'raw':_0x18cbc2[_0x28da('0x18')]?_0x18cbc2['options'][_0x28da('0x19')]===undefined?!![]:![]:!![],'where':_0x18cbc2[_0x28da('0x18')]?_0x18cbc2['options'][_0x28da('0x1a')]||null:null,'attributes':_0x18cbc2[_0x28da('0x18')]?_0x18cbc2[_0x28da('0x18')][_0x28da('0x1b')]||null:null,'limit':_0x18cbc2[_0x28da('0x18')]?_0x18cbc2['options'][_0x28da('0x1c')]||null:null,'include':_0x18cbc2['options']?_0x18cbc2[_0x28da('0x18')][_0x28da('0x1d')]?_[_0x28da('0x1e')](_0x18cbc2[_0x28da('0x18')][_0x28da('0x1d')],function(_0x59b623){return{'model':db[_0x59b623[_0x28da('0x1f')]],'as':_0x59b623['as'],'attributes':_0x59b623[_0x28da('0x1b')],'include':_0x59b623[_0x28da('0x1d')]?_[_0x28da('0x1e')](_0x59b623['include'],function(_0x488042){return{'model':db[_0x488042[_0x28da('0x1f')]],'as':_0x488042['as'],'attributes':_0x488042['attributes'],'include':_0x488042['include']?_[_0x28da('0x1e')](_0x488042[_0x28da('0x1d')],function(_0xcf6a8d){return{'model':db[_0xcf6a8d[_0x28da('0x1f')]],'as':_0xcf6a8d['as'],'attributes':_0xcf6a8d['attributes']};}):[]};}):[]};}):[]:[]})[_0x28da('0x20')](function(_0xbba610){logger[_0x28da('0x13')](_0x28da('0x15'),_0x18cbc2);logger[_0x28da('0x21')]('GetFaxQueue',_0x18cbc2,JSON[_0x28da('0x22')](_0xbba610));_0x27788a(_0xbba610);})[_0x28da('0x14')](function(_0x5f152a){logger['error']('GetFaxQueue',_0x5f152a[_0x28da('0x12')],_0x18cbc2);_0x376dfb(_0x206ec9['error'](0x1f4,_0x5f152a['message']));});});};exports[_0x28da('0x23')]=function(_0x5d18d8){var _0x5cf1e7=this;return new Promise(function(_0x523778,_0x31b6ee){return db[_0x28da('0x16')]['find']({'raw':_0x5d18d8['options']?_0x5d18d8[_0x28da('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5d18d8[_0x28da('0x18')]?_0x5d18d8[_0x28da('0x18')][_0x28da('0x1a')]||null:null,'attributes':_0x5d18d8[_0x28da('0x18')]?_0x5d18d8[_0x28da('0x18')][_0x28da('0x1b')]||null:null,'include':_0x5d18d8[_0x28da('0x18')]?_0x5d18d8[_0x28da('0x18')][_0x28da('0x1d')]?_[_0x28da('0x1e')](_0x5d18d8['options'][_0x28da('0x1d')],function(_0xadc13a){return{'model':db[_0xadc13a[_0x28da('0x1f')]],'as':_0xadc13a['as'],'attributes':_0xadc13a[_0x28da('0x1b')],'include':_0xadc13a[_0x28da('0x1d')]?_[_0x28da('0x1e')](_0xadc13a['include'],function(_0x15e17c){return{'model':db[_0x15e17c[_0x28da('0x1f')]],'as':_0x15e17c['as'],'attributes':_0x15e17c[_0x28da('0x1b')],'include':_0x15e17c['include']?_[_0x28da('0x1e')](_0x15e17c[_0x28da('0x1d')],function(_0x467aa0){return{'model':db[_0x467aa0[_0x28da('0x1f')]],'as':_0x467aa0['as'],'attributes':_0x467aa0[_0x28da('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x28da('0x20')](function(_0x2bcafe){logger[_0x28da('0x13')]('ShowFaxQueue',_0x5d18d8);logger['debug']('ShowFaxQueue',_0x5d18d8,JSON[_0x28da('0x22')](_0x2bcafe));_0x523778(_0x2bcafe);})['catch'](function(_0x39456b){logger[_0x28da('0x11')](_0x28da('0x23'),_0x39456b[_0x28da('0x12')],_0x5d18d8);_0x31b6ee(_0x5cf1e7['error'](0x1f4,_0x39456b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index a9e29bd..0670082 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 _0xce39=['register','length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x131a70,_0x5f53b2){var _0x212967=function(_0x2a43ac){while(--_0x2a43ac){_0x131a70['push'](_0x131a70['shift']());}};_0x212967(++_0x5f53b2);}(_0xce39,0x198));var _0x9ce3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xce39[_0x2641f9];return _0x585741;};'use strict';var FaxQueueEvents=require(_0x9ce3('0x0'));var events=[_0x9ce3('0x1'),_0x9ce3('0x2'),_0x9ce3('0x3')];function createListener(_0x488007,_0x3ffa32){return function(_0x30bf80){_0x3ffa32[_0x9ce3('0x4')](_0x488007,_0x30bf80);};}function removeListener(_0x4e2ca9,_0x461957){return function(){FaxQueueEvents[_0x9ce3('0x5')](_0x4e2ca9,_0x461957);};}exports[_0x9ce3('0x6')]=function(_0x85b79a){for(var _0x14e1b1=0x0,_0x350ba2=events[_0x9ce3('0x7')];_0x14e1b1<_0x350ba2;_0x14e1b1++){var _0x4eb633=events[_0x14e1b1];var _0x1db553=createListener(_0x9ce3('0x8')+_0x4eb633,_0x85b79a);FaxQueueEvents['on'](_0x4eb633,_0x1db553);}}; \ No newline at end of file +var _0xf015=['remove','emit','removeListener','register','length'];(function(_0x137947,_0x15a8e1){var _0x13a8ad=function(_0x1847e2){while(--_0x1847e2){_0x137947['push'](_0x137947['shift']());}};_0x13a8ad(++_0x15a8e1);}(_0xf015,0x13b));var _0x5f01=function(_0x59ee91,_0x1d51cb){_0x59ee91=_0x59ee91-0x0;var _0x198497=_0xf015[_0x59ee91];return _0x198497;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x5f01('0x0'),'update'];function createListener(_0x4ee3fd,_0x36cf4c){return function(_0x484077){_0x36cf4c[_0x5f01('0x1')](_0x4ee3fd,_0x484077);};}function removeListener(_0x524009,_0x33fd75){return function(){FaxQueueEvents[_0x5f01('0x2')](_0x524009,_0x33fd75);};}exports[_0x5f01('0x3')]=function(_0x454de5){for(var _0x122dd0=0x0,_0x5bc7a3=events[_0x5f01('0x4')];_0x122dd0<_0x5bc7a3;_0x122dd0++){var _0x3d35da=events[_0x122dd0];var _0xb5cfef=createListener('faxQueue:'+_0x3d35da,_0x454de5);FaxQueueEvents['on'](_0x3d35da,_0xb5cfef);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 72a3dd4..871c1d0 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 _0x6455=['getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','destroy','removeTeams','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6455,0x97));var _0x5645=function(_0x31f4e2,_0x174cdb){_0x31f4e2=_0x31f4e2-0x0;var _0x1c96e6=_0x6455[_0x31f4e2];return _0x1c96e6;};'use strict';var multer=require(_0x5645('0x0'));var util=require('util');var path=require(_0x5645('0x1'));var timeout=require(_0x5645('0x2'));var express=require(_0x5645('0x3'));var router=express[_0x5645('0x4')]();var fs_extra=require(_0x5645('0x5'));var auth=require(_0x5645('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5645('0x7'));var controller=require(_0x5645('0x8'));router[_0x5645('0x9')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0xb')]);router[_0x5645('0x9')](_0x5645('0xc'),auth[_0x5645('0xa')](),controller['describe']);router['get'](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0xe')]);router[_0x5645('0x9')](_0x5645('0xf'),auth[_0x5645('0xa')](),controller['getMembers']);router[_0x5645('0x9')](_0x5645('0x10'),auth[_0x5645('0xa')](),controller[_0x5645('0x11')]);router['get'](_0x5645('0x12'),auth['isAuthenticated'](),controller[_0x5645('0x13')]);router[_0x5645('0x14')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0x15')]);router[_0x5645('0x14')](_0x5645('0x10'),auth[_0x5645('0xa')](),controller[_0x5645('0x16')]);router['post'](_0x5645('0x12'),auth[_0x5645('0xa')](),controller[_0x5645('0x17')]);router['put']('/:id',auth[_0x5645('0xa')](),controller[_0x5645('0x18')]);router['delete'](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0x19')]);router['delete'](_0x5645('0x10'),auth[_0x5645('0xa')](),controller[_0x5645('0x1a')]);router[_0x5645('0x1b')]('/:id/users',auth[_0x5645('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x583c=['util','path','connect-timeout','Router','fs-extra','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','/:id','delete','removeTeams','removeAgents','exports','multer'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0x583c,0x12b));var _0xc583=function(_0xcfeff4,_0x3f2e19){_0xcfeff4=_0xcfeff4-0x0;var _0xb2fadc=_0x583c[_0xcfeff4];return _0xb2fadc;};'use strict';var multer=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var path=require(_0xc583('0x2'));var timeout=require(_0xc583('0x3'));var express=require('express');var router=express[_0xc583('0x4')]();var fs_extra=require(_0xc583('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc583('0x6'));var controller=require(_0xc583('0x7'));router['get']('/',auth[_0xc583('0x8')](),controller[_0xc583('0x9')]);router[_0xc583('0xa')](_0xc583('0xb'),auth['isAuthenticated'](),controller[_0xc583('0xc')]);router[_0xc583('0xa')]('/:id',auth[_0xc583('0x8')](),controller[_0xc583('0xd')]);router[_0xc583('0xa')](_0xc583('0xe'),auth[_0xc583('0x8')](),controller['getMembers']);router[_0xc583('0xa')](_0xc583('0xf'),auth['isAuthenticated'](),controller[_0xc583('0x10')]);router[_0xc583('0xa')]('/:id/users',auth[_0xc583('0x8')](),controller[_0xc583('0x11')]);router[_0xc583('0x12')]('/',auth[_0xc583('0x8')](),controller[_0xc583('0x13')]);router[_0xc583('0x12')](_0xc583('0xf'),auth[_0xc583('0x8')](),controller[_0xc583('0x14')]);router['post'](_0xc583('0x15'),auth['isAuthenticated'](),controller[_0xc583('0x16')]);router[_0xc583('0x17')]('/:id',auth[_0xc583('0x8')](),controller[_0xc583('0x18')]);router['delete'](_0xc583('0x19'),auth[_0xc583('0x8')](),controller['destroy']);router[_0xc583('0x1a')](_0xc583('0xf'),auth[_0xc583('0x8')](),controller[_0xc583('0x1b')]);router['delete'](_0xc583('0x15'),auth['isAuthenticated'](),controller[_0xc583('0x1c')]);module[_0xc583('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index d88b5dd..19cd4f6 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 _0x6007=['exports','STRING','DATE','moment','sequelize'];(function(_0x1e5fc4,_0x36c444){var _0x48c8b9=function(_0x220223){while(--_0x220223){_0x1e5fc4['push'](_0x1e5fc4['shift']());}};_0x48c8b9(++_0x36c444);}(_0x6007,0x8f));var _0x7600=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x6007[_0x4bb66f];return _0xf2772f;};'use strict';var moment=require(_0x7600('0x0'));var Sequelize=require(_0x7600('0x1'));module[_0x7600('0x2')]={'uniqueid':{'type':Sequelize[_0x7600('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7600('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7600('0x4')]},'acceptAt':{'type':Sequelize[_0x7600('0x4')]},'exitAt':{'type':Sequelize[_0x7600('0x4')]},'reason':{'type':Sequelize[_0x7600('0x3')]}}; \ No newline at end of file +var _0xd38f=['STRING','DATE','sequelize'];(function(_0x1ffe13,_0x166985){var _0x464066=function(_0x3cc6cf){while(--_0x3cc6cf){_0x1ffe13['push'](_0x1ffe13['shift']());}};_0x464066(++_0x166985);}(_0xd38f,0x164));var _0xfd38=function(_0x467e6c,_0x3f597c){_0x467e6c=_0x467e6c-0x0;var _0xc9408a=_0xd38f[_0x467e6c];return _0xc9408a;};'use strict';var moment=require('moment');var Sequelize=require(_0xfd38('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xfd38('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xfd38('0x1')]},'joinAt':{'type':Sequelize[_0xfd38('0x2')]},'leaveAt':{'type':Sequelize[_0xfd38('0x2')]},'acceptAt':{'type':Sequelize[_0xfd38('0x2')]},'exitAt':{'type':Sequelize[_0xfd38('0x2')]},'reason':{'type':Sequelize[_0xfd38('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index f1cfbf2..c823b5b 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 _0xfc03=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxQueueReport','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','keys','rawAttributes','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x71223b,_0x4c186b){var _0x16279b=function(_0x120f94){while(--_0x120f94){_0x71223b['push'](_0x71223b['shift']());}};_0x16279b(++_0x4c186b);}(_0xfc03,0x16f));var _0x3fc0=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xfc03[_0x47fd36];return _0x21a0fc;};'use strict';var emlformat=require(_0x3fc0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fc0('0x1'));var jsonpatch=require(_0x3fc0('0x2'));var rp=require('request-promise');var moment=require(_0x3fc0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fc0('0x4'));var util=require(_0x3fc0('0x5'));var path=require(_0x3fc0('0x6'));var sox=require(_0x3fc0('0x7'));var csv=require(_0x3fc0('0x8'));var ejs=require(_0x3fc0('0x9'));var fs=require('fs');var fs_extra=require(_0x3fc0('0xa'));var _=require(_0x3fc0('0xb'));var squel=require('squel');var crypto=require(_0x3fc0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3fc0('0xd'));var toCsv=require(_0x3fc0('0x8'));var querystring=require(_0x3fc0('0xe'));var Papa=require(_0x3fc0('0xf'));var Redis=require('ioredis');var authService=require(_0x3fc0('0x10'));var qs=require(_0x3fc0('0x11'));var as=require(_0x3fc0('0x12'));var hardwareService=require(_0x3fc0('0x13'));var logger=require(_0x3fc0('0x14'))('api');var utils=require(_0x3fc0('0x15'));var config=require(_0x3fc0('0x16'));var licenseUtil=require(_0x3fc0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1011b7,_0x582e22){_0x582e22=_0x582e22||0xcc;return function(_0x3a4cc0){if(_0x3a4cc0){return _0x1011b7[_0x3fc0('0x18')](_0x582e22);}return _0x1011b7['status'](_0x582e22)[_0x3fc0('0x19')]();};}function respondWithResult(_0x422926,_0x392c46){_0x392c46=_0x392c46||0xc8;return function(_0x4eb69a){if(_0x4eb69a){return _0x422926[_0x3fc0('0x1a')](_0x392c46)[_0x3fc0('0x1b')](_0x4eb69a);}};}function respondWithFilteredResult(_0x367ce1,_0x27619a){return function(_0x562ecc){if(_0x562ecc){var _0x277dbf=typeof _0x27619a[_0x3fc0('0x1c')]===_0x3fc0('0x1d')&&typeof _0x27619a['limit']===_0x3fc0('0x1d');var _0x491446=_0x562ecc[_0x3fc0('0x1e')];var _0x3c5026=_0x277dbf?0x0:_0x27619a['offset'];var _0x3bb388=_0x277dbf?_0x562ecc[_0x3fc0('0x1e')]:_0x27619a[_0x3fc0('0x1c')]+_0x27619a[_0x3fc0('0x1f')];var _0x1bd575;if(_0x3bb388>=_0x491446){_0x3bb388=_0x491446;_0x1bd575=0xc8;}else{_0x1bd575=0xce;}_0x367ce1[_0x3fc0('0x1a')](_0x1bd575);return _0x367ce1[_0x3fc0('0x20')](_0x3fc0('0x21'),_0x3c5026+'-'+_0x3bb388+'/'+_0x491446)[_0x3fc0('0x1b')](_0x562ecc);}return null;};}function patchUpdates(_0x5c859e){return function(_0xf13744){try{jsonpatch[_0x3fc0('0x22')](_0xf13744,_0x5c859e,!![]);}catch(_0x34ffa7){return BPromise[_0x3fc0('0x23')](_0x34ffa7);}return _0xf13744[_0x3fc0('0x24')]();};}function saveUpdates(_0x448293,_0x47c770){return function(_0x477674){if(_0x477674){return _0x477674[_0x3fc0('0x25')](_0x448293)[_0x3fc0('0x26')](function(_0x28fc65){return _0x28fc65;});}return null;};}function removeEntity(_0x46c213,_0x303dd2){return function(_0x2f423e){if(_0x2f423e){return _0x2f423e[_0x3fc0('0x27')]()[_0x3fc0('0x26')](function(){_0x46c213[_0x3fc0('0x1a')](0xcc)[_0x3fc0('0x19')]();});}};}function handleEntityNotFound(_0x1abe10,_0x784765){return function(_0xba1a23){if(!_0xba1a23){_0x1abe10[_0x3fc0('0x18')](0x194);}return _0xba1a23;};}function handleError(_0xbec5b5,_0x4f5111){_0x4f5111=_0x4f5111||0x1f4;return function(_0x365c8e){logger[_0x3fc0('0x28')](_0x365c8e[_0x3fc0('0x29')]);if(_0x365c8e[_0x3fc0('0x2a')]){delete _0x365c8e['name'];}_0xbec5b5[_0x3fc0('0x1a')](_0x4f5111)[_0x3fc0('0x2b')](_0x365c8e);};}exports[_0x3fc0('0x2c')]=function(_0x2645b4,_0x559fcc){var _0x1e4d99={},_0x1a2261={},_0x1960a4={'count':0x0,'rows':[]};var _0xac736c=_[_0x3fc0('0x2d')](db[_0x3fc0('0x2e')]['rawAttributes'],function(_0xd9ecae){return{'name':_0xd9ecae[_0x3fc0('0x2f')],'type':_0xd9ecae[_0x3fc0('0x30')][_0x3fc0('0x31')]};});_0x1a2261[_0x3fc0('0x32')]=_[_0x3fc0('0x2d')](_0xac736c,_0x3fc0('0x2a'));_0x1a2261[_0x3fc0('0x33')]=_['keys'](_0x2645b4['query']);_0x1a2261[_0x3fc0('0x34')]=_['intersection'](_0x1a2261[_0x3fc0('0x32')],_0x1a2261[_0x3fc0('0x33')]);_0x1e4d99[_0x3fc0('0x35')]=_[_0x3fc0('0x36')](_0x1a2261[_0x3fc0('0x32')],qs['fields'](_0x2645b4['query'][_0x3fc0('0x37')]));_0x1e4d99[_0x3fc0('0x35')]=_0x1e4d99[_0x3fc0('0x35')][_0x3fc0('0x38')]?_0x1e4d99[_0x3fc0('0x35')]:_0x1a2261['model'];if(!_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x39')](_0x3fc0('0x3a'))){_0x1e4d99['limit']=qs[_0x3fc0('0x1f')](_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x1f')]);_0x1e4d99[_0x3fc0('0x1c')]=qs['offset'](_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x1c')]);}_0x1e4d99['order']=qs[_0x3fc0('0x3b')](_0x2645b4['query'][_0x3fc0('0x3b')]);_0x1e4d99[_0x3fc0('0x3c')]=qs[_0x3fc0('0x34')](_[_0x3fc0('0x3d')](_0x2645b4[_0x3fc0('0x33')],_0x1a2261[_0x3fc0('0x34')]),_0xac736c);if(_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x3e')]){_0x1e4d99[_0x3fc0('0x3c')]=_[_0x3fc0('0x3f')](_0x1e4d99[_0x3fc0('0x3c')],{'$or':_['map'](_0xac736c,function(_0x6bbe04){if(_0x6bbe04[_0x3fc0('0x30')]!==_0x3fc0('0x40')){var _0x28b4d5={};_0x28b4d5[_0x6bbe04[_0x3fc0('0x2a')]]={'$like':'%'+_0x2645b4[_0x3fc0('0x33')]['filter']+'%'};return _0x28b4d5;}})});}_0x1e4d99=_['merge']({},_0x1e4d99,_0x2645b4[_0x3fc0('0x41')]);var _0x3386d2={'where':_0x1e4d99[_0x3fc0('0x3c')]};return db[_0x3fc0('0x2e')][_0x3fc0('0x1e')](_0x3386d2)['then'](function(_0x53b45e){_0x1960a4['count']=_0x53b45e;if(_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x42')]){_0x1e4d99[_0x3fc0('0x43')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x1e4d99);})[_0x3fc0('0x26')](function(_0x239dc5){_0x1960a4[_0x3fc0('0x44')]=_0x239dc5;return _0x1960a4;})[_0x3fc0('0x26')](respondWithFilteredResult(_0x559fcc,_0x1e4d99))['catch'](handleError(_0x559fcc,null));};exports['show']=function(_0x17510a,_0x2a45dc){var _0x547670={'raw':!![],'where':{'id':_0x17510a['params']['id']}},_0x32768f={};_0x32768f[_0x3fc0('0x32')]=_[_0x3fc0('0x45')](db[_0x3fc0('0x2e')][_0x3fc0('0x46')]);_0x32768f[_0x3fc0('0x33')]=_[_0x3fc0('0x45')](_0x17510a[_0x3fc0('0x33')]);_0x32768f[_0x3fc0('0x34')]=_['intersection'](_0x32768f[_0x3fc0('0x32')],_0x32768f['query']);_0x547670[_0x3fc0('0x35')]=_[_0x3fc0('0x36')](_0x32768f[_0x3fc0('0x32')],qs[_0x3fc0('0x37')](_0x17510a[_0x3fc0('0x33')]['fields']));_0x547670[_0x3fc0('0x35')]=_0x547670[_0x3fc0('0x35')][_0x3fc0('0x38')]?_0x547670[_0x3fc0('0x35')]:_0x32768f['model'];if(_0x17510a[_0x3fc0('0x33')]['includeAll']){_0x547670[_0x3fc0('0x43')]=[{'all':!![]}];}_0x547670=_[_0x3fc0('0x3f')]({},_0x547670,_0x17510a[_0x3fc0('0x41')]);return db[_0x3fc0('0x2e')][_0x3fc0('0x47')](_0x547670)['then'](handleEntityNotFound(_0x2a45dc,null))[_0x3fc0('0x26')](respondWithResult(_0x2a45dc,null))[_0x3fc0('0x48')](handleError(_0x2a45dc,null));};exports[_0x3fc0('0x49')]=function(_0x4c4aed,_0x3df404){return db[_0x3fc0('0x2e')]['create'](_0x4c4aed[_0x3fc0('0x4a')],{})[_0x3fc0('0x26')](respondWithResult(_0x3df404,0xc9))[_0x3fc0('0x48')](handleError(_0x3df404,null));};exports['update']=function(_0x5e5c73,_0x3a35ac){if(_0x5e5c73[_0x3fc0('0x4a')]['id']){delete _0x5e5c73[_0x3fc0('0x4a')]['id'];}return db['FaxQueueReport'][_0x3fc0('0x47')]({'where':{'id':_0x5e5c73['params']['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0x3a35ac,null))['then'](saveUpdates(_0x5e5c73['body'],null))['then'](respondWithResult(_0x3a35ac,null))[_0x3fc0('0x48')](handleError(_0x3a35ac,null));};exports[_0x3fc0('0x27')]=function(_0x141b4c,_0x3730f5){return db[_0x3fc0('0x2e')][_0x3fc0('0x47')]({'where':{'id':_0x141b4c['params']['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0x3730f5,null))[_0x3fc0('0x26')](removeEntity(_0x3730f5,null))['catch'](handleError(_0x3730f5,null));};exports['describe']=function(_0x74ae6a,_0x12f93a){return db[_0x3fc0('0x2e')][_0x3fc0('0x4b')]()[_0x3fc0('0x26')](respondWithResult(_0x12f93a,null))[_0x3fc0('0x48')](handleError(_0x12f93a,null));}; \ No newline at end of file +var _0x04d0=['to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','rows','params','keys','include','catch','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0xf9b6b5,_0x2f2372){var _0x167d45=function(_0x14043e){while(--_0x14043e){_0xf9b6b5['push'](_0xf9b6b5['shift']());}};_0x167d45(++_0x2f2372);}(_0x04d0,0x10a));var _0x004d=function(_0x21fee6,_0x32d597){_0x21fee6=_0x21fee6-0x0;var _0x294269=_0x04d0[_0x21fee6];return _0x294269;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x004d('0x0'));var jsonpatch=require(_0x004d('0x1'));var rp=require(_0x004d('0x2'));var moment=require(_0x004d('0x3'));var BPromise=require(_0x004d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x004d('0x5'));var sox=require('sox');var csv=require(_0x004d('0x6'));var ejs=require(_0x004d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x004d('0x8'));var squel=require(_0x004d('0x9'));var crypto=require('crypto');var jsforce=require(_0x004d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x004d('0x6'));var querystring=require(_0x004d('0xb'));var Papa=require(_0x004d('0xc'));var Redis=require('ioredis');var authService=require(_0x004d('0xd'));var qs=require(_0x004d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x004d('0xf'));var logger=require('../../config/logger')(_0x004d('0x10'));var utils=require(_0x004d('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x004d('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d2651,_0x46c972){_0x46c972=_0x46c972||0xcc;return function(_0x3ec7fb){if(_0x3ec7fb){return _0x1d2651[_0x004d('0x13')](_0x46c972);}return _0x1d2651[_0x004d('0x14')](_0x46c972)[_0x004d('0x15')]();};}function respondWithResult(_0x1af576,_0x32e867){_0x32e867=_0x32e867||0xc8;return function(_0x4f4785){if(_0x4f4785){return _0x1af576[_0x004d('0x14')](_0x32e867)[_0x004d('0x16')](_0x4f4785);}};}function respondWithFilteredResult(_0x22d22d,_0x1822f5){return function(_0x43f5fb){if(_0x43f5fb){var _0x402969=typeof _0x1822f5[_0x004d('0x17')]===_0x004d('0x18')&&typeof _0x1822f5['limit']===_0x004d('0x18');var _0x1f3482=_0x43f5fb[_0x004d('0x19')];var _0x4b3912=_0x402969?0x0:_0x1822f5[_0x004d('0x17')];var _0x583196=_0x402969?_0x43f5fb[_0x004d('0x19')]:_0x1822f5[_0x004d('0x17')]+_0x1822f5[_0x004d('0x1a')];var _0x66dd7f;if(_0x583196>=_0x1f3482){_0x583196=_0x1f3482;_0x66dd7f=0xc8;}else{_0x66dd7f=0xce;}_0x22d22d['status'](_0x66dd7f);return _0x22d22d[_0x004d('0x1b')](_0x004d('0x1c'),_0x4b3912+'-'+_0x583196+'/'+_0x1f3482)['json'](_0x43f5fb);}return null;};}function patchUpdates(_0x31ac5c){return function(_0x158339){try{jsonpatch[_0x004d('0x1d')](_0x158339,_0x31ac5c,!![]);}catch(_0x3abed3){return BPromise['reject'](_0x3abed3);}return _0x158339[_0x004d('0x1e')]();};}function saveUpdates(_0x39a02e,_0x2da052){return function(_0xb9eda8){if(_0xb9eda8){return _0xb9eda8[_0x004d('0x1f')](_0x39a02e)[_0x004d('0x20')](function(_0x21bbda){return _0x21bbda;});}return null;};}function removeEntity(_0x2150b9,_0x31a6fb){return function(_0x1cfdaa){if(_0x1cfdaa){return _0x1cfdaa[_0x004d('0x21')]()[_0x004d('0x20')](function(){_0x2150b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1263d8,_0xb07ff9){return function(_0x4a4fe1){if(!_0x4a4fe1){_0x1263d8[_0x004d('0x13')](0x194);}return _0x4a4fe1;};}function handleError(_0x1152e6,_0x61e5bc){_0x61e5bc=_0x61e5bc||0x1f4;return function(_0xd13fff){logger[_0x004d('0x22')](_0xd13fff[_0x004d('0x23')]);if(_0xd13fff[_0x004d('0x24')]){delete _0xd13fff['name'];}_0x1152e6[_0x004d('0x14')](_0x61e5bc)['send'](_0xd13fff);};}exports['index']=function(_0x2e7763,_0x38518d){var _0xe17b2d={},_0x1e13b1={},_0x58015b={'count':0x0,'rows':[]};var _0xe53b05=_[_0x004d('0x25')](db[_0x004d('0x26')][_0x004d('0x27')],function(_0xe5b960){return{'name':_0xe5b960[_0x004d('0x28')],'type':_0xe5b960['type'][_0x004d('0x29')]};});_0x1e13b1[_0x004d('0x2a')]=_[_0x004d('0x25')](_0xe53b05,_0x004d('0x24'));_0x1e13b1['query']=_['keys'](_0x2e7763[_0x004d('0x2b')]);_0x1e13b1['filters']=_[_0x004d('0x2c')](_0x1e13b1[_0x004d('0x2a')],_0x1e13b1[_0x004d('0x2b')]);_0xe17b2d[_0x004d('0x2d')]=_[_0x004d('0x2c')](_0x1e13b1[_0x004d('0x2a')],qs[_0x004d('0x2e')](_0x2e7763[_0x004d('0x2b')][_0x004d('0x2e')]));_0xe17b2d[_0x004d('0x2d')]=_0xe17b2d['attributes'][_0x004d('0x2f')]?_0xe17b2d[_0x004d('0x2d')]:_0x1e13b1[_0x004d('0x2a')];if(!_0x2e7763[_0x004d('0x2b')]['hasOwnProperty'](_0x004d('0x30'))){_0xe17b2d[_0x004d('0x1a')]=qs['limit'](_0x2e7763[_0x004d('0x2b')][_0x004d('0x1a')]);_0xe17b2d[_0x004d('0x17')]=qs[_0x004d('0x17')](_0x2e7763[_0x004d('0x2b')]['offset']);}_0xe17b2d[_0x004d('0x31')]=qs[_0x004d('0x32')](_0x2e7763[_0x004d('0x2b')][_0x004d('0x32')]);_0xe17b2d[_0x004d('0x33')]=qs[_0x004d('0x34')](_[_0x004d('0x35')](_0x2e7763[_0x004d('0x2b')],_0x1e13b1['filters']),_0xe53b05);if(_0x2e7763[_0x004d('0x2b')]['filter']){_0xe17b2d[_0x004d('0x33')]=_[_0x004d('0x36')](_0xe17b2d[_0x004d('0x33')],{'$or':_['map'](_0xe53b05,function(_0x5ab98c){if(_0x5ab98c[_0x004d('0x37')]!==_0x004d('0x38')){var _0x48be35={};_0x48be35[_0x5ab98c[_0x004d('0x24')]]={'$like':'%'+_0x2e7763['query'][_0x004d('0x39')]+'%'};return _0x48be35;}})});}_0xe17b2d=_[_0x004d('0x36')]({},_0xe17b2d,_0x2e7763[_0x004d('0x3a')]);var _0x4d2e6a={'where':_0xe17b2d[_0x004d('0x33')]};return db['FaxQueueReport']['count'](_0x4d2e6a)['then'](function(_0x3d9291){_0x58015b['count']=_0x3d9291;if(_0x2e7763['query'][_0x004d('0x3b')]){_0xe17b2d['include']=[{'all':!![]}];}return db[_0x004d('0x26')]['findAll'](_0xe17b2d);})['then'](function(_0x283a58){_0x58015b[_0x004d('0x3c')]=_0x283a58;return _0x58015b;})[_0x004d('0x20')](respondWithFilteredResult(_0x38518d,_0xe17b2d))['catch'](handleError(_0x38518d,null));};exports['show']=function(_0x2d08cd,_0x197377){var _0x162f23={'raw':!![],'where':{'id':_0x2d08cd[_0x004d('0x3d')]['id']}},_0xaa1d11={};_0xaa1d11[_0x004d('0x2a')]=_[_0x004d('0x3e')](db[_0x004d('0x26')][_0x004d('0x27')]);_0xaa1d11[_0x004d('0x2b')]=_['keys'](_0x2d08cd[_0x004d('0x2b')]);_0xaa1d11[_0x004d('0x34')]=_[_0x004d('0x2c')](_0xaa1d11[_0x004d('0x2a')],_0xaa1d11[_0x004d('0x2b')]);_0x162f23[_0x004d('0x2d')]=_['intersection'](_0xaa1d11[_0x004d('0x2a')],qs[_0x004d('0x2e')](_0x2d08cd[_0x004d('0x2b')][_0x004d('0x2e')]));_0x162f23[_0x004d('0x2d')]=_0x162f23['attributes'][_0x004d('0x2f')]?_0x162f23[_0x004d('0x2d')]:_0xaa1d11[_0x004d('0x2a')];if(_0x2d08cd['query'][_0x004d('0x3b')]){_0x162f23[_0x004d('0x3f')]=[{'all':!![]}];}_0x162f23=_[_0x004d('0x36')]({},_0x162f23,_0x2d08cd[_0x004d('0x3a')]);return db['FaxQueueReport']['find'](_0x162f23)[_0x004d('0x20')](handleEntityNotFound(_0x197377,null))[_0x004d('0x20')](respondWithResult(_0x197377,null))[_0x004d('0x40')](handleError(_0x197377,null));};exports[_0x004d('0x41')]=function(_0x5d5c39,_0x28a957){return db[_0x004d('0x26')][_0x004d('0x41')](_0x5d5c39[_0x004d('0x42')],{})['then'](respondWithResult(_0x28a957,0xc9))['catch'](handleError(_0x28a957,null));};exports[_0x004d('0x1f')]=function(_0x21fc27,_0x4cb5fa){if(_0x21fc27['body']['id']){delete _0x21fc27[_0x004d('0x42')]['id'];}return db[_0x004d('0x26')]['find']({'where':{'id':_0x21fc27['params']['id']}})['then'](handleEntityNotFound(_0x4cb5fa,null))[_0x004d('0x20')](saveUpdates(_0x21fc27['body'],null))[_0x004d('0x20')](respondWithResult(_0x4cb5fa,null))[_0x004d('0x40')](handleError(_0x4cb5fa,null));};exports['destroy']=function(_0x12bbcd,_0x5f3c6f){return db[_0x004d('0x26')]['find']({'where':{'id':_0x12bbcd[_0x004d('0x3d')]['id']}})[_0x004d('0x20')](handleEntityNotFound(_0x5f3c6f,null))[_0x004d('0x20')](removeEntity(_0x5f3c6f,null))['catch'](handleError(_0x5f3c6f,null));};exports['describe']=function(_0x11ebbe,_0x3458a1){return db['FaxQueueReport'][_0x004d('0x43')]()['then'](respondWithResult(_0x3458a1,null))[_0x004d('0x40')](handleError(_0x3458a1,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 9f19454..3f3e0ca 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2fbde9,_0x77f73b){_0x2fbde9=_0x2fbde9-0x0;var _0x25d7db=_0x1cb9[_0x2fbde9];return _0x25d7db;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x5a136b,_0x5dad29){var _0x131ec9=function(_0x506ff3){while(--_0x506ff3){_0x5a136b['push'](_0x5a136b['shift']());}};_0x131ec9(++_0x5dad29);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xc7b656,_0x3983fc){_0xc7b656=_0xc7b656-0x0;var _0x45479e=_0x7fbe[_0xc7b656];return _0x45479e;};'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 diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 51c11a4..2748e94 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 _0x3bb3=['update','where','attributes','limit','UpdateFaxQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','catch'];(function(_0x407238,_0x4074ce){var _0x10924a=function(_0x43d758){while(--_0x43d758){_0x407238['push'](_0x407238['shift']());}};_0x10924a(++_0x4074ce);}(_0x3bb3,0x1d3));var _0x33bb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3bb3[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x33bb('0x0'));var util=require(_0x33bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x33bb('0x2'));var fs=require('fs');var Redis=require(_0x33bb('0x3'));var db=require(_0x33bb('0x4'))['db'];var utils=require(_0x33bb('0x5'));var logger=require(_0x33bb('0x6'))(_0x33bb('0x7'));var config=require(_0x33bb('0x8'));var jayson=require(_0x33bb('0x9'));var client=jayson[_0x33bb('0xa')][_0x33bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x694858,_0x9185b6,_0x1a2e68){return new BPromise(function(_0x579a0f,_0x43dcb9){return client[_0x33bb('0xc')](_0x694858,_0x1a2e68)[_0x33bb('0xd')](function(_0x1deb23){logger[_0x33bb('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x9185b6,'request\x20sent');logger[_0x33bb('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x9185b6,_0x33bb('0x10'),JSON[_0x33bb('0x11')](_0x1deb23));if(_0x1deb23[_0x33bb('0x12')]){if(_0x1deb23[_0x33bb('0x12')]['code']===0x1f4){logger[_0x33bb('0x12')](_0x33bb('0x13'),_0x9185b6,_0x1deb23['error'][_0x33bb('0x14')]);return _0x43dcb9(_0x1deb23['error'][_0x33bb('0x14')]);}logger['error'](_0x33bb('0x13'),_0x9185b6,_0x1deb23['error'][_0x33bb('0x14')]);return _0x579a0f(_0x1deb23[_0x33bb('0x12')][_0x33bb('0x14')]);}else{logger[_0x33bb('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x9185b6,_0x33bb('0x10'));_0x579a0f(_0x1deb23[_0x33bb('0x15')]['message']);}})['catch'](function(_0x58ae50){logger[_0x33bb('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x9185b6,_0x58ae50);_0x43dcb9(_0x58ae50);});});}exports[_0x33bb('0x16')]=function(_0x581afd){var _0x3ca289=this;return new Promise(function(_0x87002a,_0xc7e5f0){return db[_0x33bb('0x17')][_0x33bb('0x18')](_0x581afd[_0x33bb('0x19')],{'raw':_0x581afd[_0x33bb('0x1a')]?_0x581afd[_0x33bb('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x33bb('0xd')](function(_0x56fd52){logger[_0x33bb('0xe')](_0x33bb('0x16'),_0x581afd);logger[_0x33bb('0xf')](_0x33bb('0x16'),_0x581afd,JSON[_0x33bb('0x11')](_0x56fd52));_0x87002a(_0x56fd52);})[_0x33bb('0x1b')](function(_0x34473f){logger[_0x33bb('0x12')](_0x33bb('0x16'),_0x34473f[_0x33bb('0x14')],_0x581afd);_0xc7e5f0(_0x3ca289[_0x33bb('0x12')](0x1f4,_0x34473f[_0x33bb('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x4daed5){var _0x39dcf9=this;return new Promise(function(_0x4e0d83,_0x2aa2eb){return db[_0x33bb('0x17')][_0x33bb('0x1c')](_0x4daed5['body'],{'raw':_0x4daed5[_0x33bb('0x1a')]?_0x4daed5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4daed5[_0x33bb('0x1a')]?_0x4daed5['options'][_0x33bb('0x1d')]||null:null,'attributes':_0x4daed5[_0x33bb('0x1a')]?_0x4daed5[_0x33bb('0x1a')][_0x33bb('0x1e')]||null:null,'limit':_0x4daed5['options']?_0x4daed5[_0x33bb('0x1a')][_0x33bb('0x1f')]||null:null})[_0x33bb('0xd')](function(_0x24243f){logger['info'](_0x33bb('0x20'),_0x4daed5);logger[_0x33bb('0xf')](_0x33bb('0x20'),_0x4daed5,JSON[_0x33bb('0x11')](_0x24243f));_0x4e0d83(_0x24243f);})[_0x33bb('0x1b')](function(_0x32b982){logger[_0x33bb('0x12')](_0x33bb('0x20'),_0x32b982['message'],_0x4daed5);_0x2aa2eb(_0x39dcf9[_0x33bb('0x12')](0x1f4,_0x32b982[_0x33bb('0x14')]));});});}; \ No newline at end of file +var _0x2444=['FaxQueueReport,\x20%s,\x20%s','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','then','catch','update','raw','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2ccb92,_0x49f640){var _0x112398=function(_0x1d9dc0){while(--_0x1d9dc0){_0x2ccb92['push'](_0x2ccb92['shift']());}};_0x112398(++_0x49f640);}(_0x2444,0x7e));var _0x4244=function(_0x4e4e87,_0x380d4f){_0x4e4e87=_0x4e4e87-0x0;var _0x419912=_0x2444[_0x4e4e87];return _0x419912;};'use strict';var _=require(_0x4244('0x0'));var util=require(_0x4244('0x1'));var moment=require(_0x4244('0x2'));var BPromise=require(_0x4244('0x3'));var rs=require(_0x4244('0x4'));var fs=require('fs');var Redis=require(_0x4244('0x5'));var db=require(_0x4244('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4244('0x7'))(_0x4244('0x8'));var config=require(_0x4244('0x9'));var jayson=require(_0x4244('0xa'));var client=jayson[_0x4244('0xb')][_0x4244('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x549303,_0x56ef51,_0x1615fc){return new BPromise(function(_0x33628d,_0x283339){return client[_0x4244('0xd')](_0x549303,_0x1615fc)['then'](function(_0x1342c4){logger[_0x4244('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x56ef51,_0x4244('0xf'));logger[_0x4244('0x10')](_0x4244('0x11'),_0x56ef51,'request\x20sent',JSON[_0x4244('0x12')](_0x1342c4));if(_0x1342c4[_0x4244('0x13')]){if(_0x1342c4['error'][_0x4244('0x14')]===0x1f4){logger[_0x4244('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x56ef51,_0x1342c4['error']['message']);return _0x283339(_0x1342c4[_0x4244('0x13')][_0x4244('0x15')]);}logger['error'](_0x4244('0x16'),_0x56ef51,_0x1342c4[_0x4244('0x13')][_0x4244('0x15')]);return _0x33628d(_0x1342c4[_0x4244('0x13')][_0x4244('0x15')]);}else{logger['info'](_0x4244('0x16'),_0x56ef51,_0x4244('0xf'));_0x33628d(_0x1342c4[_0x4244('0x17')]['message']);}})['catch'](function(_0x517cc7){logger[_0x4244('0x13')](_0x4244('0x16'),_0x56ef51,_0x517cc7);_0x283339(_0x517cc7);});});}exports[_0x4244('0x18')]=function(_0x409a16){var _0x35851b=this;return new Promise(function(_0x250ce0,_0x5653e2){return db[_0x4244('0x19')][_0x4244('0x1a')](_0x409a16[_0x4244('0x1b')],{'raw':_0x409a16[_0x4244('0x1c')]?_0x409a16[_0x4244('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x4244('0x1d')](function(_0x5e16d4){logger[_0x4244('0xe')](_0x4244('0x18'),_0x409a16);logger[_0x4244('0x10')](_0x4244('0x18'),_0x409a16,JSON[_0x4244('0x12')](_0x5e16d4));_0x250ce0(_0x5e16d4);})[_0x4244('0x1e')](function(_0x466a02){logger[_0x4244('0x13')](_0x4244('0x18'),_0x466a02['message'],_0x409a16);_0x5653e2(_0x35851b[_0x4244('0x13')](0x1f4,_0x466a02[_0x4244('0x15')]));});});};exports['UpdateFaxQueueReport']=function(_0x17f389){var _0x13911c=this;return new Promise(function(_0x392073,_0x215778){return db['FaxQueueReport'][_0x4244('0x1f')](_0x17f389[_0x4244('0x1b')],{'raw':_0x17f389[_0x4244('0x1c')]?_0x17f389[_0x4244('0x1c')][_0x4244('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17f389[_0x4244('0x1c')]?_0x17f389[_0x4244('0x1c')][_0x4244('0x21')]||null:null,'attributes':_0x17f389[_0x4244('0x1c')]?_0x17f389['options'][_0x4244('0x22')]||null:null,'limit':_0x17f389[_0x4244('0x1c')]?_0x17f389[_0x4244('0x1c')][_0x4244('0x23')]||null:null})['then'](function(_0x4a20f6){logger['info']('UpdateFaxQueueReport',_0x17f389);logger[_0x4244('0x10')](_0x4244('0x24'),_0x17f389,JSON['stringify'](_0x4a20f6));_0x392073(_0x4a20f6);})[_0x4244('0x1e')](function(_0x2c01ff){logger['error'](_0x4244('0x24'),_0x2c01ff[_0x4244('0x15')],_0x17f389);_0x215778(_0x13911c['error'](0x1f4,_0x2c01ff[_0x4244('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 4840747..b6a914f 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 _0x393c=['/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0xf858e,_0x51b0f1){var _0x5344d8=function(_0x5219d6){while(--_0x5219d6){_0xf858e['push'](_0xf858e['shift']());}};_0x5344d8(++_0x51b0f1);}(_0x393c,0x92));var _0xc393=function(_0x35ca61,_0x470a82){_0x35ca61=_0x35ca61-0x0;var _0x492487=_0x393c[_0x35ca61];return _0x492487;};'use strict';var multer=require(_0xc393('0x0'));var util=require(_0xc393('0x1'));var path=require(_0xc393('0x2'));var timeout=require(_0xc393('0x3'));var express=require(_0xc393('0x4'));var router=express['Router']();var fs_extra=require(_0xc393('0x5'));var auth=require(_0xc393('0x6'));var interaction=require(_0xc393('0x7'));var config=require(_0xc393('0x8'));var controller=require('./faxQueueReport.controller');router[_0xc393('0x9')]('/',auth[_0xc393('0xa')](),controller[_0xc393('0xb')]);router[_0xc393('0x9')](_0xc393('0xc'),auth[_0xc393('0xa')](),controller[_0xc393('0xd')]);router[_0xc393('0x9')](_0xc393('0xe'),auth['isAuthenticated'](),controller[_0xc393('0xf')]);router[_0xc393('0x10')]('/',auth[_0xc393('0xa')](),controller[_0xc393('0x11')]);router['put'](_0xc393('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xc393('0x12')](_0xc393('0xe'),auth['isAuthenticated'](),controller[_0xc393('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4f23=['show','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5275b8,_0x51e5dd){var _0x568a9b=function(_0x583a71){while(--_0x583a71){_0x5275b8['push'](_0x5275b8['shift']());}};_0x568a9b(++_0x51e5dd);}(_0x4f23,0x16f));var _0x34f2=function(_0x5e0847,_0x4b3627){_0x5e0847=_0x5e0847-0x0;var _0x2cbf29=_0x4f23[_0x5e0847];return _0x2cbf29;};'use strict';var multer=require('multer');var util=require(_0x34f2('0x0'));var path=require(_0x34f2('0x1'));var timeout=require(_0x34f2('0x2'));var express=require(_0x34f2('0x3'));var router=express['Router']();var fs_extra=require(_0x34f2('0x4'));var auth=require(_0x34f2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x34f2('0x6'));var controller=require(_0x34f2('0x7'));router[_0x34f2('0x8')]('/',auth[_0x34f2('0x9')](),controller[_0x34f2('0xa')]);router[_0x34f2('0x8')](_0x34f2('0xb'),auth['isAuthenticated'](),controller[_0x34f2('0xc')]);router['get']('/:id',auth[_0x34f2('0x9')](),controller[_0x34f2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x34f2('0xe')](_0x34f2('0xf'),auth[_0x34f2('0x9')](),controller[_0x34f2('0x10')]);router[_0x34f2('0x11')]('/:id',auth[_0x34f2('0x9')](),controller[_0x34f2('0x12')]);module[_0x34f2('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 111b03f..3faa25d 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x37e59e,_0x37573d){var _0x328ec4=function(_0x2fac83){while(--_0x2fac83){_0x37e59e['push'](_0x37e59e['shift']());}};_0x328ec4(++_0x37573d);}(_0x70e0,0x17b));var _0x070e=function(_0x58ebf2,_0x82034){_0x58ebf2=_0x58ebf2-0x0;var _0x3022e6=_0x70e0[_0x58ebf2];return _0x3022e6;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x149d89,_0x23defe){var _0x352be6=function(_0x2255eb){while(--_0x2255eb){_0x149d89['push'](_0x149d89['shift']());}};_0x352be6(++_0x23defe);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0xf3cd[_0x29dda1];return _0x21b0ef;};'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 ffd63cf..87118cb 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 _0x2e66=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x4be116,_0x44e2df){var _0x216c01=function(_0x428012){while(--_0x428012){_0x4be116['push'](_0x4be116['shift']());}};_0x216c01(++_0x44e2df);}(_0x2e66,0x1b3));var _0x62e6=function(_0x692a8f,_0x4938bc){_0x692a8f=_0x692a8f-0x0;var _0x1362c1=_0x2e66[_0x692a8f];return _0x1362c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62e6('0x0'));var zipdir=require(_0x62e6('0x1'));var jsonpatch=require(_0x62e6('0x2'));var rp=require(_0x62e6('0x3'));var moment=require(_0x62e6('0x4'));var BPromise=require(_0x62e6('0x5'));var Mustache=require('mustache');var util=require(_0x62e6('0x6'));var path=require(_0x62e6('0x7'));var sox=require(_0x62e6('0x8'));var csv=require('to-csv');var ejs=require(_0x62e6('0x9'));var fs=require('fs');var fs_extra=require(_0x62e6('0xa'));var _=require(_0x62e6('0xb'));var squel=require(_0x62e6('0xc'));var crypto=require(_0x62e6('0xd'));var jsforce=require(_0x62e6('0xe'));var deskjs=require(_0x62e6('0xf'));var toCsv=require(_0x62e6('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x62e6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x62e6('0x12'));var as=require(_0x62e6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x62e6('0x14'))(_0x62e6('0x15'));var utils=require(_0x62e6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x62e6('0x17'));var db=require(_0x62e6('0x18'))['db'];function respondWithStatusCode(_0x40a815,_0x5a4e25){_0x5a4e25=_0x5a4e25||0xcc;return function(_0x1f76d9){if(_0x1f76d9){return _0x40a815[_0x62e6('0x19')](_0x5a4e25);}return _0x40a815[_0x62e6('0x1a')](_0x5a4e25)[_0x62e6('0x1b')]();};}function respondWithResult(_0x284c26,_0x26317e){_0x26317e=_0x26317e||0xc8;return function(_0x5250cd){if(_0x5250cd){return _0x284c26['status'](_0x26317e)[_0x62e6('0x1c')](_0x5250cd);}};}function respondWithFilteredResult(_0x4dd578,_0x39ec65){return function(_0x21fcd2){if(_0x21fcd2){var _0x1bebde=typeof _0x39ec65[_0x62e6('0x1d')]===_0x62e6('0x1e')&&typeof _0x39ec65[_0x62e6('0x1f')]===_0x62e6('0x1e');var _0x53c7ac=_0x21fcd2[_0x62e6('0x20')];var _0x10aa48=_0x1bebde?0x0:_0x39ec65['offset'];var _0x1e409e=_0x1bebde?_0x21fcd2['count']:_0x39ec65[_0x62e6('0x1d')]+_0x39ec65[_0x62e6('0x1f')];var _0x2eaec2;if(_0x1e409e>=_0x53c7ac){_0x1e409e=_0x53c7ac;_0x2eaec2=0xc8;}else{_0x2eaec2=0xce;}_0x4dd578[_0x62e6('0x1a')](_0x2eaec2);return _0x4dd578['set'](_0x62e6('0x21'),_0x10aa48+'-'+_0x1e409e+'/'+_0x53c7ac)['json'](_0x21fcd2);}return null;};}function patchUpdates(_0x10473e){return function(_0x1cd556){try{jsonpatch['apply'](_0x1cd556,_0x10473e,!![]);}catch(_0x286333){return BPromise[_0x62e6('0x22')](_0x286333);}return _0x1cd556['save']();};}function saveUpdates(_0x1011ba,_0x3c933b){return function(_0x5d0f9b){if(_0x5d0f9b){return _0x5d0f9b[_0x62e6('0x23')](_0x1011ba)[_0x62e6('0x24')](function(_0x5dfc1a){return _0x5dfc1a;});}return null;};}function removeEntity(_0x4cfdfb,_0x4c5541){return function(_0xd0ceb0){if(_0xd0ceb0){return _0xd0ceb0[_0x62e6('0x25')]()[_0x62e6('0x24')](function(){_0x4cfdfb[_0x62e6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59c491,_0x1d5432){return function(_0x187335){if(!_0x187335){_0x59c491[_0x62e6('0x19')](0x194);}return _0x187335;};}function handleError(_0x53f948,_0x3a9759){_0x3a9759=_0x3a9759||0x1f4;return function(_0x411281){logger[_0x62e6('0x26')](_0x411281[_0x62e6('0x27')]);if(_0x411281[_0x62e6('0x28')]){delete _0x411281[_0x62e6('0x28')];}_0x53f948[_0x62e6('0x1a')](_0x3a9759)[_0x62e6('0x29')](_0x411281);};}exports[_0x62e6('0x2a')]=function(_0x3603dc,_0x1f6a6a){var _0x10320f={},_0x196da9={},_0x5ac996={'count':0x0,'rows':[]};var _0x371931=_[_0x62e6('0x2b')](db[_0x62e6('0x2c')][_0x62e6('0x2d')],function(_0x70d5a){return{'name':_0x70d5a[_0x62e6('0x2e')],'type':_0x70d5a[_0x62e6('0x2f')][_0x62e6('0x30')]};});_0x196da9[_0x62e6('0x31')]=_[_0x62e6('0x2b')](_0x371931,_0x62e6('0x28'));_0x196da9['query']=_[_0x62e6('0x32')](_0x3603dc[_0x62e6('0x33')]);_0x196da9[_0x62e6('0x34')]=_[_0x62e6('0x35')](_0x196da9[_0x62e6('0x31')],_0x196da9[_0x62e6('0x33')]);_0x10320f['attributes']=_[_0x62e6('0x35')](_0x196da9[_0x62e6('0x31')],qs[_0x62e6('0x36')](_0x3603dc[_0x62e6('0x33')][_0x62e6('0x36')]));_0x10320f['attributes']=_0x10320f[_0x62e6('0x37')][_0x62e6('0x38')]?_0x10320f[_0x62e6('0x37')]:_0x196da9[_0x62e6('0x31')];if(!_0x3603dc[_0x62e6('0x33')][_0x62e6('0x39')](_0x62e6('0x3a'))){_0x10320f['limit']=qs[_0x62e6('0x1f')](_0x3603dc[_0x62e6('0x33')][_0x62e6('0x1f')]);_0x10320f[_0x62e6('0x1d')]=qs[_0x62e6('0x1d')](_0x3603dc[_0x62e6('0x33')][_0x62e6('0x1d')]);}_0x10320f[_0x62e6('0x3b')]=qs['sort'](_0x3603dc[_0x62e6('0x33')]['sort']);_0x10320f[_0x62e6('0x3c')]=qs[_0x62e6('0x34')](_[_0x62e6('0x3d')](_0x3603dc[_0x62e6('0x33')],_0x196da9[_0x62e6('0x34')]),_0x371931);if(_0x3603dc['query']['filter']){_0x10320f[_0x62e6('0x3c')]=_['merge'](_0x10320f[_0x62e6('0x3c')],{'$or':_[_0x62e6('0x2b')](_0x371931,function(_0x57d97f){if(_0x57d97f[_0x62e6('0x2f')]!==_0x62e6('0x3e')){var _0x51f35f={};_0x51f35f[_0x57d97f[_0x62e6('0x28')]]={'$like':'%'+_0x3603dc['query'][_0x62e6('0x3f')]+'%'};return _0x51f35f;}})});}_0x10320f=_[_0x62e6('0x40')]({},_0x10320f,_0x3603dc[_0x62e6('0x41')]);var _0x11a515={'where':_0x10320f[_0x62e6('0x3c')]};return db[_0x62e6('0x2c')][_0x62e6('0x20')](_0x11a515)[_0x62e6('0x24')](function(_0x2f08ae){_0x5ac996[_0x62e6('0x20')]=_0x2f08ae;if(_0x3603dc[_0x62e6('0x33')][_0x62e6('0x42')]){_0x10320f['include']=[{'all':!![]}];}return db[_0x62e6('0x2c')][_0x62e6('0x43')](_0x10320f);})['then'](function(_0x67c012){_0x5ac996['rows']=_0x67c012;return _0x5ac996;})[_0x62e6('0x24')](respondWithFilteredResult(_0x1f6a6a,_0x10320f))[_0x62e6('0x44')](handleError(_0x1f6a6a,null));};exports[_0x62e6('0x45')]=function(_0x48eb55,_0x389787){var _0x28ab23={'raw':!![],'where':{'id':_0x48eb55[_0x62e6('0x46')]['id']}},_0x2d0a4c={};_0x2d0a4c[_0x62e6('0x31')]=_['keys'](db[_0x62e6('0x2c')][_0x62e6('0x2d')]);_0x2d0a4c[_0x62e6('0x33')]=_[_0x62e6('0x32')](_0x48eb55[_0x62e6('0x33')]);_0x2d0a4c[_0x62e6('0x34')]=_[_0x62e6('0x35')](_0x2d0a4c['model'],_0x2d0a4c[_0x62e6('0x33')]);_0x28ab23['attributes']=_['intersection'](_0x2d0a4c[_0x62e6('0x31')],qs['fields'](_0x48eb55[_0x62e6('0x33')][_0x62e6('0x36')]));_0x28ab23[_0x62e6('0x37')]=_0x28ab23[_0x62e6('0x37')][_0x62e6('0x38')]?_0x28ab23[_0x62e6('0x37')]:_0x2d0a4c[_0x62e6('0x31')];if(_0x48eb55[_0x62e6('0x33')]['includeAll']){_0x28ab23[_0x62e6('0x47')]=[{'all':!![]}];}_0x28ab23=_[_0x62e6('0x40')]({},_0x28ab23,_0x48eb55[_0x62e6('0x41')]);return db[_0x62e6('0x2c')][_0x62e6('0x48')](_0x28ab23)[_0x62e6('0x24')](handleEntityNotFound(_0x389787,null))[_0x62e6('0x24')](respondWithResult(_0x389787,null))[_0x62e6('0x44')](handleError(_0x389787,null));};exports[_0x62e6('0x49')]=function(_0x4d14bc,_0x4b216a){return db[_0x62e6('0x2c')][_0x62e6('0x49')](_0x4d14bc[_0x62e6('0x4a')],{})['then'](respondWithResult(_0x4b216a,0xc9))['catch'](handleError(_0x4b216a,null));};exports[_0x62e6('0x23')]=function(_0x141417,_0x290ca8){if(_0x141417[_0x62e6('0x4a')]['id']){delete _0x141417[_0x62e6('0x4a')]['id'];}return db[_0x62e6('0x2c')][_0x62e6('0x48')]({'where':{'id':_0x141417[_0x62e6('0x46')]['id']}})[_0x62e6('0x24')](handleEntityNotFound(_0x290ca8,null))[_0x62e6('0x24')](saveUpdates(_0x141417[_0x62e6('0x4a')],null))[_0x62e6('0x24')](respondWithResult(_0x290ca8,null))['catch'](handleError(_0x290ca8,null));};exports[_0x62e6('0x25')]=function(_0x344d8e,_0x45964c){return db[_0x62e6('0x2c')][_0x62e6('0x48')]({'where':{'id':_0x344d8e[_0x62e6('0x46')]['id']}})[_0x62e6('0x24')](handleEntityNotFound(_0x45964c,null))[_0x62e6('0x24')](removeEntity(_0x45964c,null))['catch'](handleError(_0x45964c,null));};exports[_0x62e6('0x4b')]=function(_0x5be15d,_0x5e07d1){return db[_0x62e6('0x2c')]['describe']()[_0x62e6('0x24')](respondWithResult(_0x5e07d1,null))[_0x62e6('0x44')](handleError(_0x5e07d1,null));}; \ No newline at end of file +var _0xfe30=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FaxTransferReport','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0xbc8da3,_0x4449dc){var _0x4c490e=function(_0x48f628){while(--_0x48f628){_0xbc8da3['push'](_0xbc8da3['shift']());}};_0x4c490e(++_0x4449dc);}(_0xfe30,0xf6));var _0x0fe3=function(_0x5b6a86,_0x59489c){_0x5b6a86=_0x5b6a86-0x0;var _0x425888=_0xfe30[_0x5b6a86];return _0x425888;};'use strict';var emlformat=require(_0x0fe3('0x0'));var rimraf=require(_0x0fe3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fe3('0x2'));var rp=require(_0x0fe3('0x3'));var moment=require(_0x0fe3('0x4'));var BPromise=require(_0x0fe3('0x5'));var Mustache=require(_0x0fe3('0x6'));var util=require(_0x0fe3('0x7'));var path=require(_0x0fe3('0x8'));var sox=require(_0x0fe3('0x9'));var csv=require(_0x0fe3('0xa'));var ejs=require(_0x0fe3('0xb'));var fs=require('fs');var fs_extra=require(_0x0fe3('0xc'));var _=require(_0x0fe3('0xd'));var squel=require(_0x0fe3('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0fe3('0xf'));var toCsv=require(_0x0fe3('0xa'));var querystring=require('querystring');var Papa=require(_0x0fe3('0x10'));var Redis=require(_0x0fe3('0x11'));var authService=require(_0x0fe3('0x12'));var qs=require(_0x0fe3('0x13'));var as=require(_0x0fe3('0x14'));var hardwareService=require(_0x0fe3('0x15'));var logger=require(_0x0fe3('0x16'))(_0x0fe3('0x17'));var utils=require('../../config/utils');var config=require(_0x0fe3('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48e033,_0x46ee08){_0x46ee08=_0x46ee08||0xcc;return function(_0x102321){if(_0x102321){return _0x48e033[_0x0fe3('0x19')](_0x46ee08);}return _0x48e033[_0x0fe3('0x1a')](_0x46ee08)[_0x0fe3('0x1b')]();};}function respondWithResult(_0x4d1257,_0x312c6e){_0x312c6e=_0x312c6e||0xc8;return function(_0x58fbc8){if(_0x58fbc8){return _0x4d1257[_0x0fe3('0x1a')](_0x312c6e)[_0x0fe3('0x1c')](_0x58fbc8);}};}function respondWithFilteredResult(_0x291945,_0x2d815f){return function(_0x24fbd1){if(_0x24fbd1){var _0x5e09fa=typeof _0x2d815f[_0x0fe3('0x1d')]===_0x0fe3('0x1e')&&typeof _0x2d815f[_0x0fe3('0x1f')]===_0x0fe3('0x1e');var _0x2708bf=_0x24fbd1[_0x0fe3('0x20')];var _0x18bac2=_0x5e09fa?0x0:_0x2d815f[_0x0fe3('0x1d')];var _0x4d5942=_0x5e09fa?_0x24fbd1[_0x0fe3('0x20')]:_0x2d815f['offset']+_0x2d815f[_0x0fe3('0x1f')];var _0x475959;if(_0x4d5942>=_0x2708bf){_0x4d5942=_0x2708bf;_0x475959=0xc8;}else{_0x475959=0xce;}_0x291945[_0x0fe3('0x1a')](_0x475959);return _0x291945[_0x0fe3('0x21')]('Content-Range',_0x18bac2+'-'+_0x4d5942+'/'+_0x2708bf)[_0x0fe3('0x1c')](_0x24fbd1);}return null;};}function patchUpdates(_0xc3509d){return function(_0x5c9e38){try{jsonpatch[_0x0fe3('0x22')](_0x5c9e38,_0xc3509d,!![]);}catch(_0x414b11){return BPromise[_0x0fe3('0x23')](_0x414b11);}return _0x5c9e38[_0x0fe3('0x24')]();};}function saveUpdates(_0x3a8612,_0x202f57){return function(_0x18338e){if(_0x18338e){return _0x18338e[_0x0fe3('0x25')](_0x3a8612)['then'](function(_0x2d5613){return _0x2d5613;});}return null;};}function removeEntity(_0x2d9e80,_0x53778c){return function(_0x45c1a6){if(_0x45c1a6){return _0x45c1a6[_0x0fe3('0x26')]()[_0x0fe3('0x27')](function(){_0x2d9e80[_0x0fe3('0x1a')](0xcc)[_0x0fe3('0x1b')]();});}};}function handleEntityNotFound(_0x5167fa,_0x2b6f1d){return function(_0x5c6a7b){if(!_0x5c6a7b){_0x5167fa[_0x0fe3('0x19')](0x194);}return _0x5c6a7b;};}function handleError(_0x313862,_0x20f83d){_0x20f83d=_0x20f83d||0x1f4;return function(_0x461493){logger[_0x0fe3('0x28')](_0x461493[_0x0fe3('0x29')]);if(_0x461493[_0x0fe3('0x2a')]){delete _0x461493[_0x0fe3('0x2a')];}_0x313862['status'](_0x20f83d)[_0x0fe3('0x2b')](_0x461493);};}exports[_0x0fe3('0x2c')]=function(_0x5811dc,_0x59890f){var _0x4c758d={},_0x4f9b83={},_0x3bf63f={'count':0x0,'rows':[]};var _0x2f6c21=_[_0x0fe3('0x2d')](db[_0x0fe3('0x2e')]['rawAttributes'],function(_0x512035){return{'name':_0x512035[_0x0fe3('0x2f')],'type':_0x512035[_0x0fe3('0x30')][_0x0fe3('0x31')]};});_0x4f9b83['model']=_['map'](_0x2f6c21,'name');_0x4f9b83[_0x0fe3('0x32')]=_['keys'](_0x5811dc[_0x0fe3('0x32')]);_0x4f9b83[_0x0fe3('0x33')]=_[_0x0fe3('0x34')](_0x4f9b83['model'],_0x4f9b83[_0x0fe3('0x32')]);_0x4c758d['attributes']=_[_0x0fe3('0x34')](_0x4f9b83[_0x0fe3('0x35')],qs[_0x0fe3('0x36')](_0x5811dc[_0x0fe3('0x32')][_0x0fe3('0x36')]));_0x4c758d[_0x0fe3('0x37')]=_0x4c758d[_0x0fe3('0x37')][_0x0fe3('0x38')]?_0x4c758d[_0x0fe3('0x37')]:_0x4f9b83['model'];if(!_0x5811dc[_0x0fe3('0x32')][_0x0fe3('0x39')](_0x0fe3('0x3a'))){_0x4c758d[_0x0fe3('0x1f')]=qs[_0x0fe3('0x1f')](_0x5811dc[_0x0fe3('0x32')]['limit']);_0x4c758d[_0x0fe3('0x1d')]=qs[_0x0fe3('0x1d')](_0x5811dc[_0x0fe3('0x32')]['offset']);}_0x4c758d['order']=qs[_0x0fe3('0x3b')](_0x5811dc[_0x0fe3('0x32')]['sort']);_0x4c758d[_0x0fe3('0x3c')]=qs[_0x0fe3('0x33')](_[_0x0fe3('0x3d')](_0x5811dc[_0x0fe3('0x32')],_0x4f9b83[_0x0fe3('0x33')]),_0x2f6c21);if(_0x5811dc[_0x0fe3('0x32')][_0x0fe3('0x3e')]){_0x4c758d[_0x0fe3('0x3c')]=_[_0x0fe3('0x3f')](_0x4c758d[_0x0fe3('0x3c')],{'$or':_[_0x0fe3('0x2d')](_0x2f6c21,function(_0x4dd52a){if(_0x4dd52a['type']!==_0x0fe3('0x40')){var _0x166d32={};_0x166d32[_0x4dd52a['name']]={'$like':'%'+_0x5811dc[_0x0fe3('0x32')]['filter']+'%'};return _0x166d32;}})});}_0x4c758d=_[_0x0fe3('0x3f')]({},_0x4c758d,_0x5811dc[_0x0fe3('0x41')]);var _0x5d7377={'where':_0x4c758d[_0x0fe3('0x3c')]};return db['FaxTransferReport'][_0x0fe3('0x20')](_0x5d7377)['then'](function(_0xe96663){_0x3bf63f[_0x0fe3('0x20')]=_0xe96663;if(_0x5811dc['query'][_0x0fe3('0x42')]){_0x4c758d['include']=[{'all':!![]}];}return db[_0x0fe3('0x2e')][_0x0fe3('0x43')](_0x4c758d);})[_0x0fe3('0x27')](function(_0x26b8df){_0x3bf63f[_0x0fe3('0x44')]=_0x26b8df;return _0x3bf63f;})[_0x0fe3('0x27')](respondWithFilteredResult(_0x59890f,_0x4c758d))[_0x0fe3('0x45')](handleError(_0x59890f,null));};exports['show']=function(_0x575943,_0x34a17f){var _0x15edd6={'raw':!![],'where':{'id':_0x575943[_0x0fe3('0x46')]['id']}},_0x4f86a0={};_0x4f86a0[_0x0fe3('0x35')]=_['keys'](db[_0x0fe3('0x2e')]['rawAttributes']);_0x4f86a0[_0x0fe3('0x32')]=_['keys'](_0x575943[_0x0fe3('0x32')]);_0x4f86a0[_0x0fe3('0x33')]=_[_0x0fe3('0x34')](_0x4f86a0[_0x0fe3('0x35')],_0x4f86a0[_0x0fe3('0x32')]);_0x15edd6['attributes']=_[_0x0fe3('0x34')](_0x4f86a0[_0x0fe3('0x35')],qs[_0x0fe3('0x36')](_0x575943['query'][_0x0fe3('0x36')]));_0x15edd6[_0x0fe3('0x37')]=_0x15edd6[_0x0fe3('0x37')]['length']?_0x15edd6[_0x0fe3('0x37')]:_0x4f86a0[_0x0fe3('0x35')];if(_0x575943[_0x0fe3('0x32')][_0x0fe3('0x42')]){_0x15edd6[_0x0fe3('0x47')]=[{'all':!![]}];}_0x15edd6=_['merge']({},_0x15edd6,_0x575943[_0x0fe3('0x41')]);return db[_0x0fe3('0x2e')][_0x0fe3('0x48')](_0x15edd6)[_0x0fe3('0x27')](handleEntityNotFound(_0x34a17f,null))[_0x0fe3('0x27')](respondWithResult(_0x34a17f,null))[_0x0fe3('0x45')](handleError(_0x34a17f,null));};exports[_0x0fe3('0x49')]=function(_0xa9f679,_0x173cc2){return db[_0x0fe3('0x2e')][_0x0fe3('0x49')](_0xa9f679['body'],{})[_0x0fe3('0x27')](respondWithResult(_0x173cc2,0xc9))[_0x0fe3('0x45')](handleError(_0x173cc2,null));};exports[_0x0fe3('0x25')]=function(_0x4f113b,_0x2021e0){if(_0x4f113b[_0x0fe3('0x4a')]['id']){delete _0x4f113b[_0x0fe3('0x4a')]['id'];}return db[_0x0fe3('0x2e')][_0x0fe3('0x48')]({'where':{'id':_0x4f113b['params']['id']}})[_0x0fe3('0x27')](handleEntityNotFound(_0x2021e0,null))[_0x0fe3('0x27')](saveUpdates(_0x4f113b[_0x0fe3('0x4a')],null))[_0x0fe3('0x27')](respondWithResult(_0x2021e0,null))[_0x0fe3('0x45')](handleError(_0x2021e0,null));};exports[_0x0fe3('0x26')]=function(_0x50afbe,_0x28ab13){return db[_0x0fe3('0x2e')][_0x0fe3('0x48')]({'where':{'id':_0x50afbe[_0x0fe3('0x46')]['id']}})[_0x0fe3('0x27')](handleEntityNotFound(_0x28ab13,null))['then'](removeEntity(_0x28ab13,null))[_0x0fe3('0x45')](handleError(_0x28ab13,null));};exports[_0x0fe3('0x4b')]=function(_0x59d9b5,_0x4186d8){return db[_0x0fe3('0x2e')][_0x0fe3('0x4b')]()['then'](respondWithResult(_0x4186d8,null))[_0x0fe3('0x45')](handleError(_0x4186d8,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 601bb5c..2056be0 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 _0xb515=['../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x12fe32,_0x1d5358){var _0x1701f5=function(_0x236080){while(--_0x236080){_0x12fe32['push'](_0x12fe32['shift']());}};_0x1701f5(++_0x1d5358);}(_0xb515,0x1b8));var _0x5b51=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0xb515[_0x5471ec];return _0x121d4c;};'use strict';var _=require(_0x5b51('0x0'));var util=require('util');var logger=require(_0x5b51('0x1'))(_0x5b51('0x2'));var moment=require(_0x5b51('0x3'));var BPromise=require(_0x5b51('0x4'));var rp=require(_0x5b51('0x5'));var fs=require('fs');var path=require(_0x5b51('0x6'));var rimraf=require(_0x5b51('0x7'));var config=require(_0x5b51('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0x5b51('0x9')]=function(_0xf9e3ac,_0x3ef482){return _0xf9e3ac[_0x5b51('0xa')](_0x5b51('0xb'),attributes,{'tableName':_0x5b51('0xc'),'paranoid':![],'indexes':[{'name':_0x5b51('0xd'),'fields':[_0x5b51('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde1e=['../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x40d2ec,_0x4c3149){var _0x14055a=function(_0x1d223b){while(--_0x1d223b){_0x40d2ec['push'](_0x40d2ec['shift']());}};_0x14055a(++_0x4c3149);}(_0xde1e,0x9d));var _0xede1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xde1e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xede1('0x0'));var util=require(_0xede1('0x1'));var logger=require(_0xede1('0x2'))(_0xede1('0x3'));var moment=require(_0xede1('0x4'));var BPromise=require(_0xede1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xede1('0x6'));var rimraf=require(_0xede1('0x7'));var config=require(_0xede1('0x8'));var attributes=require(_0xede1('0x9'));module[_0xede1('0xa')]=function(_0x3b760f,_0x4e9527){return _0x3b760f[_0xede1('0xb')](_0xede1('0xc'),attributes,{'tableName':_0xede1('0xd'),'paranoid':![],'indexes':[{'name':_0xede1('0xe'),'fields':[_0xede1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index d37914d..953c379 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 _0x6b3a=['request','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x38857f,_0x3f5184){var _0x5595e4=function(_0xc06dcd){while(--_0xc06dcd){_0x38857f['push'](_0x38857f['shift']());}};_0x5595e4(++_0x3f5184);}(_0x6b3a,0x11b));var _0xa6b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b3a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa6b3('0x0'));var util=require(_0xa6b3('0x1'));var moment=require(_0xa6b3('0x2'));var BPromise=require(_0xa6b3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa6b3('0x5'));var logger=require('../../config/logger')(_0xa6b3('0x6'));var config=require(_0xa6b3('0x7'));var jayson=require(_0xa6b3('0x8'));var client=jayson[_0xa6b3('0x9')][_0xa6b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e1f70,_0x2ca6f2,_0x450b25){return new BPromise(function(_0x275425,_0x2b8718){return client[_0xa6b3('0xb')](_0x4e1f70,_0x450b25)[_0xa6b3('0xc')](function(_0x58a183){logger[_0xa6b3('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x2ca6f2,_0xa6b3('0xe'));logger['debug'](_0xa6b3('0xf'),_0x2ca6f2,_0xa6b3('0xe'),JSON['stringify'](_0x58a183));if(_0x58a183[_0xa6b3('0x10')]){if(_0x58a183[_0xa6b3('0x10')][_0xa6b3('0x11')]===0x1f4){logger[_0xa6b3('0x10')](_0xa6b3('0x12'),_0x2ca6f2,_0x58a183['error'][_0xa6b3('0x13')]);return _0x2b8718(_0x58a183[_0xa6b3('0x10')]['message']);}logger['error'](_0xa6b3('0x12'),_0x2ca6f2,_0x58a183['error'][_0xa6b3('0x13')]);return _0x275425(_0x58a183[_0xa6b3('0x10')][_0xa6b3('0x13')]);}else{logger[_0xa6b3('0xd')](_0xa6b3('0x12'),_0x2ca6f2,_0xa6b3('0xe'));_0x275425(_0x58a183[_0xa6b3('0x14')][_0xa6b3('0x13')]);}})['catch'](function(_0x496212){logger['error'](_0xa6b3('0x12'),_0x2ca6f2,_0x496212);_0x2b8718(_0x496212);});});} \ No newline at end of file +var _0x92a6=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x1f31ce,_0x266e41){var _0x44de8e=function(_0x19543d){while(--_0x19543d){_0x1f31ce['push'](_0x1f31ce['shift']());}};_0x44de8e(++_0x266e41);}(_0x92a6,0x93));var _0x692a=function(_0x4cf57a,_0x145d47){_0x4cf57a=_0x4cf57a-0x0;var _0x27e457=_0x92a6[_0x4cf57a];return _0x27e457;};'use strict';var _=require('lodash');var util=require(_0x692a('0x0'));var moment=require('moment');var BPromise=require(_0x692a('0x1'));var rs=require(_0x692a('0x2'));var fs=require('fs');var Redis=require(_0x692a('0x3'));var db=require(_0x692a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x692a('0x5'))(_0x692a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x692a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15c450,_0x2d28e1,_0x1e044a){return new BPromise(function(_0x4ef572,_0x68beca){return client['request'](_0x15c450,_0x1e044a)[_0x692a('0x8')](function(_0x265d8d){logger['info'](_0x692a('0x9'),_0x2d28e1,_0x692a('0xa'));logger[_0x692a('0xb')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x2d28e1,_0x692a('0xa'),JSON['stringify'](_0x265d8d));if(_0x265d8d[_0x692a('0xc')]){if(_0x265d8d[_0x692a('0xc')]['code']===0x1f4){logger['error'](_0x692a('0x9'),_0x2d28e1,_0x265d8d[_0x692a('0xc')][_0x692a('0xd')]);return _0x68beca(_0x265d8d[_0x692a('0xc')][_0x692a('0xd')]);}logger[_0x692a('0xc')](_0x692a('0x9'),_0x2d28e1,_0x265d8d[_0x692a('0xc')][_0x692a('0xd')]);return _0x4ef572(_0x265d8d['error']['message']);}else{logger['info'](_0x692a('0x9'),_0x2d28e1,_0x692a('0xa'));_0x4ef572(_0x265d8d[_0x692a('0xe')][_0x692a('0xd')]);}})[_0x692a('0xf')](function(_0x55264a){logger[_0x692a('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x2d28e1,_0x55264a);_0x68beca(_0x55264a);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index d487fb4..243ca87 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 _0xb500=['express','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0xb500,0x76));var _0x0b50=function(_0x288b07,_0x2281a1){_0x288b07=_0x288b07-0x0;var _0x121f3a=_0xb500[_0x288b07];return _0x121f3a;};'use strict';var multer=require(_0x0b50('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0b50('0x1'));var express=require(_0x0b50('0x2'));var router=express['Router']();var fs_extra=require(_0x0b50('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0b50('0x4'));var config=require(_0x0b50('0x5'));var controller=require('./faxTransferReport.controller');router[_0x0b50('0x6')]('/',auth['isAuthenticated'](),controller[_0x0b50('0x7')]);router[_0x0b50('0x6')](_0x0b50('0x8'),auth[_0x0b50('0x9')](),controller[_0x0b50('0xa')]);router[_0x0b50('0x6')](_0x0b50('0xb'),auth[_0x0b50('0x9')](),controller[_0x0b50('0xc')]);router[_0x0b50('0xd')]('/',auth[_0x0b50('0x9')](),controller[_0x0b50('0xe')]);router[_0x0b50('0xf')](_0x0b50('0xb'),auth['isAuthenticated'](),controller[_0x0b50('0x10')]);router[_0x0b50('0x11')](_0x0b50('0xb'),auth[_0x0b50('0x9')](),controller[_0x0b50('0x12')]);module[_0x0b50('0x13')]=router; \ No newline at end of file +var _0x1799=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','show','create','put','/:id','multer','util','path','connect-timeout'];(function(_0x28c870,_0x1bf349){var _0x5e4de6=function(_0x418068){while(--_0x418068){_0x28c870['push'](_0x28c870['shift']());}};_0x5e4de6(++_0x1bf349);}(_0x1799,0x172));var _0x9179=function(_0x2559bf,_0x182f9a){_0x2559bf=_0x2559bf-0x0;var _0x5808ee=_0x1799[_0x2559bf];return _0x5808ee;};'use strict';var multer=require(_0x9179('0x0'));var util=require(_0x9179('0x1'));var path=require(_0x9179('0x2'));var timeout=require(_0x9179('0x3'));var express=require('express');var router=express[_0x9179('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9179('0x5'));var interaction=require(_0x9179('0x6'));var config=require(_0x9179('0x7'));var controller=require(_0x9179('0x8'));router[_0x9179('0x9')]('/',auth[_0x9179('0xa')](),controller[_0x9179('0xb')]);router[_0x9179('0x9')](_0x9179('0xc'),auth[_0x9179('0xa')](),controller['describe']);router[_0x9179('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9179('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9179('0xe')]);router[_0x9179('0xf')](_0x9179('0x10'),auth[_0x9179('0xa')](),controller['update']);router['delete'](_0x9179('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index e0a64ef..0d670f0 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 _0x7a1f=['destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create'];(function(_0x4afd9e,_0x3b532f){var _0x1cdcdd=function(_0x290589){while(--_0x290589){_0x4afd9e['push'](_0x4afd9e['shift']());}};_0x1cdcdd(++_0x3b532f);}(_0x7a1f,0x134));var _0xf7a1=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0x7a1f[_0x23ec06];return _0x2831d4;};'use strict';var multer=require(_0xf7a1('0x0'));var util=require(_0xf7a1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf7a1('0x2'));var router=express['Router']();var fs_extra=require(_0xf7a1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf7a1('0x4'));var config=require('../../config/environment');var controller=require(_0xf7a1('0x5'));router[_0xf7a1('0x6')]('/',auth[_0xf7a1('0x7')](),controller[_0xf7a1('0x8')]);router[_0xf7a1('0x6')](_0xf7a1('0x9'),auth['isAuthenticated'](),controller[_0xf7a1('0xa')]);router[_0xf7a1('0x6')](_0xf7a1('0xb'),auth[_0xf7a1('0x7')](),controller[_0xf7a1('0xc')]);router[_0xf7a1('0x6')](_0xf7a1('0xd'),auth[_0xf7a1('0x7')](),controller['getFields']);router[_0xf7a1('0xe')]('/',auth['isAuthenticated'](),controller[_0xf7a1('0xf')]);router['post'](_0xf7a1('0xb'),auth[_0xf7a1('0x7')](),controller['addConfiguration']);router['put'](_0xf7a1('0x9'),auth[_0xf7a1('0x7')](),controller['update']);router['delete'](_0xf7a1('0x9'),auth['isAuthenticated'](),controller[_0xf7a1('0x10')]);module[_0xf7a1('0x11')]=router; \ No newline at end of file +var _0x0f3e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x26fc81,_0x57fc19){var _0x9feece=function(_0x4344c3){while(--_0x4344c3){_0x26fc81['push'](_0x26fc81['shift']());}};_0x9feece(++_0x57fc19);}(_0x0f3e,0x1c9));var _0xe0f3=function(_0x5aa3a2,_0x3da0b4){_0x5aa3a2=_0x5aa3a2-0x0;var _0x3cde12=_0x0f3e[_0x5aa3a2];return _0x3cde12;};'use strict';var multer=require(_0xe0f3('0x0'));var util=require(_0xe0f3('0x1'));var path=require('path');var timeout=require(_0xe0f3('0x2'));var express=require('express');var router=express[_0xe0f3('0x3')]();var fs_extra=require(_0xe0f3('0x4'));var auth=require(_0xe0f3('0x5'));var interaction=require(_0xe0f3('0x6'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0xe0f3('0x7')]('/',auth[_0xe0f3('0x8')](),controller[_0xe0f3('0x9')]);router['get'](_0xe0f3('0xa'),auth[_0xe0f3('0x8')](),controller[_0xe0f3('0xb')]);router['get'](_0xe0f3('0xc'),auth[_0xe0f3('0x8')](),controller[_0xe0f3('0xd')]);router[_0xe0f3('0x7')](_0xe0f3('0xe'),auth[_0xe0f3('0x8')](),controller[_0xe0f3('0xf')]);router[_0xe0f3('0x10')]('/',auth['isAuthenticated'](),controller[_0xe0f3('0x11')]);router[_0xe0f3('0x10')](_0xe0f3('0xc'),auth[_0xe0f3('0x8')](),controller[_0xe0f3('0x12')]);router[_0xe0f3('0x13')]('/:id',auth[_0xe0f3('0x8')](),controller[_0xe0f3('0x14')]);router[_0xe0f3('0x15')](_0xe0f3('0xa'),auth['isAuthenticated'](),controller[_0xe0f3('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 2e04c0e..450be99 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 _0xc849=['STRING','ENUM','basic','integrationTab','newTab','exports'];(function(_0x3568c9,_0x543a4d){var _0x400db1=function(_0x3720a5){while(--_0x3720a5){_0x3568c9['push'](_0x3568c9['shift']());}};_0x400db1(++_0x543a4d);}(_0xc849,0x14f));var _0x9c84=function(_0x2a8854,_0x2f8e2a){_0x2a8854=_0x2a8854-0x0;var _0x594643=_0xc849[_0x2a8854];return _0x594643;};'use strict';var Sequelize=require('sequelize');module[_0x9c84('0x0')]={'name':{'type':Sequelize[_0x9c84('0x1')]},'description':{'type':Sequelize[_0x9c84('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9c84('0x1')]},'authType':{'type':Sequelize[_0x9c84('0x2')](_0x9c84('0x3')),'defaultValue':_0x9c84('0x3')},'password':{'type':Sequelize[_0x9c84('0x1')]},'consumerKey':{'type':Sequelize[_0x9c84('0x1')]},'consumerSecret':{'type':Sequelize[_0x9c84('0x1')]},'token':{'type':Sequelize[_0x9c84('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x9c84('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9c84('0x2')](_0x9c84('0x4'),_0x9c84('0x5')),'defaultValue':_0x9c84('0x4')}}; \ No newline at end of file +var _0x99cd=['ENUM','basic','integrationTab','STRING'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0x99cd,0x147));var _0xd99c=function(_0x54b2b0,_0x55f332){_0x54b2b0=_0x54b2b0-0x0;var _0x1a0d6b=_0x99cd[_0x54b2b0];return _0x1a0d6b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd99c('0x0')]},'description':{'type':Sequelize[_0xd99c('0x0')]},'username':{'type':Sequelize[_0xd99c('0x0')]},'remoteUri':{'type':Sequelize[_0xd99c('0x0')]},'authType':{'type':Sequelize[_0xd99c('0x1')](_0xd99c('0x2')),'defaultValue':_0xd99c('0x2')},'password':{'type':Sequelize[_0xd99c('0x0')]},'consumerKey':{'type':Sequelize[_0xd99c('0x0')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xd99c('0x0')]},'serverUrl':{'type':Sequelize[_0xd99c('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xd99c('0x1')](_0xd99c('0x3'),'newTab'),'defaultValue':_0xd99c('0x3')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index c34af19..bc6bc22 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 _0xe31e=['count','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','DeskField','priority','remoteUri','username','consumerKey','consumerSecret','tokenSecret','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','format','Basic\x20%s','password','toString','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit'];(function(_0xf60f58,_0x15c66b){var _0x299698=function(_0x1497ce){while(--_0x1497ce){_0xf60f58['push'](_0xf60f58['shift']());}};_0x299698(++_0x15c66b);}(_0xe31e,0x12b));var _0xee31=function(_0x42e773,_0x561aa9){_0x42e773=_0x42e773-0x0;var _0x1e9496=_0xe31e[_0x42e773];return _0x1e9496;};'use strict';var emlformat=require(_0xee31('0x0'));var rimraf=require(_0xee31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee31('0x2'));var rp=require(_0xee31('0x3'));var moment=require('moment');var BPromise=require(_0xee31('0x4'));var Mustache=require(_0xee31('0x5'));var util=require(_0xee31('0x6'));var path=require(_0xee31('0x7'));var sox=require(_0xee31('0x8'));var csv=require(_0xee31('0x9'));var ejs=require(_0xee31('0xa'));var fs=require('fs');var fs_extra=require(_0xee31('0xb'));var _=require(_0xee31('0xc'));var squel=require(_0xee31('0xd'));var crypto=require(_0xee31('0xe'));var jsforce=require(_0xee31('0xf'));var deskjs=require(_0xee31('0x10'));var toCsv=require('to-csv');var querystring=require(_0xee31('0x11'));var Papa=require(_0xee31('0x12'));var Redis=require(_0xee31('0x13'));var authService=require(_0xee31('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee31('0x15'));var logger=require(_0xee31('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xee31('0x17'));var db=require(_0xee31('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x20c37e,_0x5dc18c){_0x5dc18c=_0x5dc18c||0xcc;return function(_0x38228e){if(_0x38228e){return _0x20c37e['sendStatus'](_0x5dc18c);}return _0x20c37e['status'](_0x5dc18c)[_0xee31('0x19')]();};}function respondWithResult(_0x794029,_0xf07ab7){_0xf07ab7=_0xf07ab7||0xc8;return function(_0x8139b8){if(_0x8139b8){return _0x794029[_0xee31('0x1a')](_0xf07ab7)[_0xee31('0x1b')](_0x8139b8);}};}function respondWithFilteredResult(_0x5eec0b,_0x5f413b){return function(_0x2ad57e){if(_0x2ad57e){var _0x488fd3=typeof _0x5f413b[_0xee31('0x1c')]===_0xee31('0x1d')&&typeof _0x5f413b[_0xee31('0x1e')]===_0xee31('0x1d');var _0x177484=_0x2ad57e[_0xee31('0x1f')];var _0x51e25f=_0x488fd3?0x0:_0x5f413b[_0xee31('0x1c')];var _0x169089=_0x488fd3?_0x2ad57e[_0xee31('0x1f')]:_0x5f413b[_0xee31('0x1c')]+_0x5f413b[_0xee31('0x1e')];var _0xd21912;if(_0x169089>=_0x177484){_0x169089=_0x177484;_0xd21912=0xc8;}else{_0xd21912=0xce;}_0x5eec0b[_0xee31('0x1a')](_0xd21912);return _0x5eec0b['set'](_0xee31('0x20'),_0x51e25f+'-'+_0x169089+'/'+_0x177484)[_0xee31('0x1b')](_0x2ad57e);}return null;};}function patchUpdates(_0x803147){return function(_0x1f147f){try{jsonpatch[_0xee31('0x21')](_0x1f147f,_0x803147,!![]);}catch(_0x162c54){return BPromise[_0xee31('0x22')](_0x162c54);}return _0x1f147f[_0xee31('0x23')]();};}function saveUpdates(_0x41a699,_0x4306ac){return function(_0x18277b){if(_0x18277b){return _0x18277b['update'](_0x41a699)[_0xee31('0x24')](function(_0x1f9eba){return _0x1f9eba;});}return null;};}function removeEntity(_0x3c715b,_0x2925f6){return function(_0x334873){if(_0x334873){return _0x334873[_0xee31('0x25')]()[_0xee31('0x24')](function(){_0x3c715b['status'](0xcc)[_0xee31('0x19')]();});}};}function handleEntityNotFound(_0x28a7e0,_0x372efd){return function(_0x3ba9a2){if(!_0x3ba9a2){_0x28a7e0[_0xee31('0x26')](0x194);}return _0x3ba9a2;};}function handleError(_0x26fed2,_0xffffc4){_0xffffc4=_0xffffc4||0x1f4;return function(_0x11ec46){logger['error'](_0x11ec46[_0xee31('0x27')]);if(_0x11ec46[_0xee31('0x28')]){delete _0x11ec46[_0xee31('0x28')];}_0x26fed2[_0xee31('0x1a')](_0xffffc4)[_0xee31('0x29')](_0x11ec46);};}exports[_0xee31('0x2a')]=function(_0x248aff,_0x229642){var _0x300ad2={},_0x15b758={},_0x25902a={'count':0x0,'rows':[]};var _0x537bea=_['map'](db[_0xee31('0x2b')][_0xee31('0x2c')],function(_0x5251a2){return{'name':_0x5251a2[_0xee31('0x2d')],'type':_0x5251a2[_0xee31('0x2e')]['key']};});_0x15b758[_0xee31('0x2f')]=_[_0xee31('0x30')](_0x537bea,_0xee31('0x28'));_0x15b758[_0xee31('0x31')]=_[_0xee31('0x32')](_0x248aff['query']);_0x15b758['filters']=_[_0xee31('0x33')](_0x15b758[_0xee31('0x2f')],_0x15b758[_0xee31('0x31')]);_0x300ad2[_0xee31('0x34')]=_[_0xee31('0x33')](_0x15b758['model'],qs[_0xee31('0x35')](_0x248aff[_0xee31('0x31')][_0xee31('0x35')]));_0x300ad2[_0xee31('0x34')]=_0x300ad2[_0xee31('0x34')][_0xee31('0x36')]?_0x300ad2[_0xee31('0x34')]:_0x15b758[_0xee31('0x2f')];if(!_0x248aff[_0xee31('0x31')]['hasOwnProperty'](_0xee31('0x37'))){_0x300ad2[_0xee31('0x1e')]=qs[_0xee31('0x1e')](_0x248aff[_0xee31('0x31')][_0xee31('0x1e')]);_0x300ad2[_0xee31('0x1c')]=qs[_0xee31('0x1c')](_0x248aff['query'][_0xee31('0x1c')]);}_0x300ad2['order']=qs[_0xee31('0x38')](_0x248aff[_0xee31('0x31')][_0xee31('0x38')]);_0x300ad2[_0xee31('0x39')]=qs[_0xee31('0x3a')](_[_0xee31('0x3b')](_0x248aff[_0xee31('0x31')],_0x15b758['filters']),_0x537bea);if(_0x248aff[_0xee31('0x31')][_0xee31('0x3c')]){_0x300ad2['where']=_['merge'](_0x300ad2[_0xee31('0x39')],{'$or':_[_0xee31('0x30')](_0x537bea,function(_0x1a06fc){if(_0x1a06fc[_0xee31('0x2e')]!=='VIRTUAL'){var _0x8f96b7={};_0x8f96b7[_0x1a06fc[_0xee31('0x28')]]={'$like':'%'+_0x248aff[_0xee31('0x31')][_0xee31('0x3c')]+'%'};return _0x8f96b7;}})});}_0x300ad2=_[_0xee31('0x3d')]({},_0x300ad2,_0x248aff[_0xee31('0x3e')]);var _0x596db2={'where':_0x300ad2[_0xee31('0x39')]};return db[_0xee31('0x2b')][_0xee31('0x1f')](_0x596db2)[_0xee31('0x24')](function(_0x5613eb){_0x25902a[_0xee31('0x1f')]=_0x5613eb;if(_0x248aff[_0xee31('0x31')][_0xee31('0x3f')]){_0x300ad2[_0xee31('0x40')]=[{'all':!![]}];}return db[_0xee31('0x2b')][_0xee31('0x41')](_0x300ad2);})['then'](function(_0x533a22){_0x25902a[_0xee31('0x42')]=_0x533a22;return _0x25902a;})[_0xee31('0x24')](respondWithFilteredResult(_0x229642,_0x300ad2))[_0xee31('0x43')](handleError(_0x229642,null));};exports[_0xee31('0x44')]=function(_0x41811d,_0x8421d0){var _0x3bd118={'raw':![],'where':{'id':_0x41811d[_0xee31('0x45')]['id']}},_0x16d008={};_0x16d008[_0xee31('0x2f')]=_['keys'](db['DeskAccount'][_0xee31('0x2c')]);_0x16d008[_0xee31('0x31')]=_[_0xee31('0x32')](_0x41811d[_0xee31('0x31')]);_0x16d008[_0xee31('0x3a')]=_[_0xee31('0x33')](_0x16d008['model'],_0x16d008[_0xee31('0x31')]);_0x3bd118[_0xee31('0x34')]=_[_0xee31('0x33')](_0x16d008['model'],qs[_0xee31('0x35')](_0x41811d[_0xee31('0x31')][_0xee31('0x35')]));_0x3bd118[_0xee31('0x34')]=_0x3bd118[_0xee31('0x34')][_0xee31('0x36')]?_0x3bd118[_0xee31('0x34')]:_0x16d008[_0xee31('0x2f')];if(_0x41811d[_0xee31('0x31')][_0xee31('0x3f')]){_0x3bd118[_0xee31('0x40')]=[{'all':!![]}];}_0x3bd118=_[_0xee31('0x3d')]({},_0x3bd118,_0x41811d[_0xee31('0x3e')]);return db['DeskAccount'][_0xee31('0x46')](_0x3bd118)[_0xee31('0x24')](handleEntityNotFound(_0x8421d0,null))[_0xee31('0x24')](respondWithResult(_0x8421d0,null))[_0xee31('0x43')](handleError(_0x8421d0,null));};exports[_0xee31('0x47')]=function(_0x4bd44a,_0x3d3895){return db[_0xee31('0x2b')][_0xee31('0x47')](_0x4bd44a[_0xee31('0x48')],{})[_0xee31('0x24')](respondWithResult(_0x3d3895,0xc9))['catch'](handleError(_0x3d3895,null));};exports['update']=function(_0x23d958,_0x133077){if(_0x23d958[_0xee31('0x48')]['id']){delete _0x23d958[_0xee31('0x48')]['id'];}return db[_0xee31('0x2b')][_0xee31('0x46')]({'where':{'id':_0x23d958[_0xee31('0x45')]['id']}})[_0xee31('0x24')](handleEntityNotFound(_0x133077,null))[_0xee31('0x24')](saveUpdates(_0x23d958[_0xee31('0x48')],null))[_0xee31('0x24')](respondWithResult(_0x133077,null))['catch'](handleError(_0x133077,null));};exports[_0xee31('0x25')]=function(_0x43e05d,_0x16b54e){return db[_0xee31('0x2b')][_0xee31('0x46')]({'where':{'id':_0x43e05d[_0xee31('0x45')]['id']}})['then'](handleEntityNotFound(_0x16b54e,null))['then'](removeEntity(_0x16b54e,null))[_0xee31('0x43')](handleError(_0x16b54e,null));};exports[_0xee31('0x49')]=function(_0x19e1f2,_0xf5eb9d,_0x40c6ed){var _0x2a5fb5={};var _0x33246f={};var _0x2b0b7d;var _0x4bf4d6;return db[_0xee31('0x2b')][_0xee31('0x4a')]({'where':{'id':_0x19e1f2['params']['id']}})[_0xee31('0x24')](handleEntityNotFound(_0xf5eb9d,null))[_0xee31('0x24')](function(_0x20f44e){if(_0x20f44e){_0x2b0b7d=_0x20f44e;_0x33246f[_0xee31('0x2f')]=_[_0xee31('0x32')](db[_0xee31('0x4b')][_0xee31('0x2c')]);_0x33246f[_0xee31('0x31')]=_[_0xee31('0x32')](_0x19e1f2[_0xee31('0x31')]);_0x33246f[_0xee31('0x3a')]=_[_0xee31('0x33')](_0x33246f[_0xee31('0x2f')],_0x33246f[_0xee31('0x31')]);_0x2a5fb5['attributes']=_[_0xee31('0x33')](_0x33246f[_0xee31('0x2f')],qs[_0xee31('0x35')](_0x19e1f2['query']['fields']));_0x2a5fb5['attributes']=_0x2a5fb5[_0xee31('0x34')]['length']?_0x2a5fb5[_0xee31('0x34')]:_0x33246f['model'];_0x2a5fb5['order']=qs['sort'](_0x19e1f2[_0xee31('0x31')][_0xee31('0x38')]);_0x2a5fb5[_0xee31('0x39')]=qs[_0xee31('0x3a')](_['pick'](_0x19e1f2[_0xee31('0x31')],_0x33246f[_0xee31('0x3a')]));if(_0x19e1f2[_0xee31('0x31')][_0xee31('0x3c')]){_0x2a5fb5['where']=_[_0xee31('0x3d')](_0x2a5fb5[_0xee31('0x39')],{'$or':_[_0xee31('0x30')](_0x2a5fb5[_0xee31('0x34')],function(_0x5dc34b){var _0x115a51={};_0x115a51[_0x5dc34b]={'$like':'%'+_0x19e1f2[_0xee31('0x31')][_0xee31('0x3c')]+'%'};return _0x115a51;})});}_0x2a5fb5=_['merge']({},_0x2a5fb5,_0x19e1f2[_0xee31('0x3e')]);return _0x2b0b7d[_0xee31('0x49')](_0x2a5fb5);}})[_0xee31('0x24')](function(_0x4c4e4d){if(_0x4c4e4d){_0x4bf4d6=_0x4c4e4d[_0xee31('0x36')];if(!_0x19e1f2[_0xee31('0x31')]['hasOwnProperty'](_0xee31('0x37'))){_0x2a5fb5[_0xee31('0x1e')]=qs[_0xee31('0x1e')](_0x19e1f2[_0xee31('0x31')]['limit']);_0x2a5fb5['offset']=qs['offset'](_0x19e1f2[_0xee31('0x31')][_0xee31('0x1c')]);}return _0x2b0b7d[_0xee31('0x49')](_0x2a5fb5);}})[_0xee31('0x24')](function(_0x5a61a1){if(_0x5a61a1){return _0x5a61a1?{'count':_0x4bf4d6,'rows':_0x5a61a1}:null;}})[_0xee31('0x24')](respondWithResult(_0xf5eb9d,null))[_0xee31('0x43')](handleError(_0xf5eb9d,null));};exports[_0xee31('0x4c')]=function(_0x1fbaf9,_0x57307d,_0x3d5633){if(_0x1fbaf9[_0xee31('0x48')]['id']){delete _0x1fbaf9[_0xee31('0x48')]['id'];}return db['DeskAccount'][_0xee31('0x4a')]({'where':{'id':_0x1fbaf9[_0xee31('0x45')]['id']}})[_0xee31('0x24')](handleEntityNotFound(_0x57307d,null))[_0xee31('0x24')](function(_0x58c26f){if(_0x58c26f){_0x1fbaf9[_0xee31('0x48')][_0xee31('0x4d')]=_0x58c26f['id'];_0x1fbaf9[_0xee31('0x48')][_0xee31('0x4e')]=integrations[_0xee31('0x4f')](_0x1fbaf9['body']['channel'],_0x1fbaf9[_0xee31('0x48')][_0xee31('0x2e')]);_0x1fbaf9[_0xee31('0x48')][_0xee31('0x50')]=integrations[_0xee31('0x51')](_0x1fbaf9['body']['channel'],_0x1fbaf9[_0xee31('0x48')][_0xee31('0x2e')]);return db[_0xee31('0x4b')][_0xee31('0x47')](_0x1fbaf9[_0xee31('0x48')],{'include':[{'model':db[_0xee31('0x52')],'as':'Subjects'},{'model':db[_0xee31('0x52')],'as':_0xee31('0x50')}]});}return null;})[_0xee31('0x24')](respondWithResult(_0x57307d,null))['catch'](handleError(_0x57307d,null));};exports['getFields']=function(_0x3dced3,_0x24853b,_0x3a2d51){var _0x4e51d0=[{'name':_0xee31('0x53'),'label':_0xee31('0x53'),'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 _0x326573='';return db['DeskAccount']['findOne']({'where':{'id':_0x3dced3['params']['id']},'attributes':['id',_0xee31('0x54'),'authType',_0xee31('0x55'),'password',_0xee31('0x56'),_0xee31('0x57'),'token',_0xee31('0x58')]})[_0xee31('0x24')](handleEntityNotFound(_0x24853b,null))[_0xee31('0x24')](function(_0x97da8f){if(_0x97da8f){_0x326573=_0x97da8f[_0xee31('0x54')];var _0x4b33f2=_0x326573['slice'](-0x1);if(_0x4b33f2==='/'){_0x326573=_0x326573[_0xee31('0x59')](0x0,_0x326573[_0xee31('0x5a')](_0x4b33f2));}var _0x32d563={'method':_0xee31('0x5b'),'uri':util['format'](_0xee31('0x5c'),_0x326573),'headers':{'Content-Type':_0xee31('0x5d'),'Accept':'application/json'},'json':!![]};if(_0x97da8f['authType']===_0xee31('0x5e')){_0x32d563[_0xee31('0x5f')][_0xee31('0x60')]=util[_0xee31('0x61')](_0xee31('0x62'),new Buffer(util[_0xee31('0x61')]('%s:%s',_0x97da8f[_0xee31('0x55')],_0x97da8f[_0xee31('0x63')]))[_0xee31('0x64')]('base64'));}return rp(_0x32d563)['then'](function(_0x5bc880){return _0x4e51d0['concat'](_[_0xee31('0x30')](_0x5bc880['_embedded'][_0xee31('0x65')],function(_0x54846d){return{'id':_0x54846d['name'],'name':_0x54846d[_0xee31('0x28')],'type':_0x54846d[_0xee31('0x2e')],'active':_0x54846d[_0xee31('0x66')],'label':_0x54846d[_0xee31('0x67')],'custom':!![]};}));});}})[_0xee31('0x24')](function(_0x2c3291){return{'count':_0x2c3291[_0xee31('0x36')],'rows':_0x2c3291};})[_0xee31('0x24')](respondWithResult(_0x24853b,null))[_0xee31('0x43')](function(_0x2bd014){var _0x102dcb=_0x3dced3[_0xee31('0x31')][_0xee31('0x68')]?0x1f4:_0x2bd014[_0xee31('0x69')]||0x1f4;logger['error'](_0xee31('0x6a'),_0xee31('0x6b'),_0x102dcb,JSON[_0xee31('0x6c')](_0x2bd014));delete _0x2bd014[_0xee31('0x28')];if(_0x102dcb===0x191){_0x102dcb=0x190;}_0x24853b[_0xee31('0x1a')](_0x102dcb)[_0xee31('0x29')](_0x3dced3[_0xee31('0x31')][_0xee31('0x68')]?{'message':_0xee31('0x6d'),'statusCode':_0x2bd014[_0xee31('0x69')]}:_0x2bd014);});}; \ No newline at end of file +var _0xca94=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','DeskAccount','findAll','catch','show','params','find','create','body','findOne','rawAttributes','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','priority','remoteUri','username','password','consumerKey','consumerSecret','tokenSecret','slice','lastIndexOf','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','base64','concat','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status'];(function(_0x1f34d3,_0x3e2bb7){var _0x42313a=function(_0x582bf8){while(--_0x582bf8){_0x1f34d3['push'](_0x1f34d3['shift']());}};_0x42313a(++_0x3e2bb7);}(_0xca94,0x1a7));var _0x4ca9=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xca94[_0x2cf2e9];return _0xd3670d;};'use strict';var emlformat=require(_0x4ca9('0x0'));var rimraf=require(_0x4ca9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4ca9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ca9('0x3'));var util=require('util');var path=require('path');var sox=require(_0x4ca9('0x4'));var csv=require(_0x4ca9('0x5'));var ejs=require(_0x4ca9('0x6'));var fs=require('fs');var fs_extra=require(_0x4ca9('0x7'));var _=require(_0x4ca9('0x8'));var squel=require(_0x4ca9('0x9'));var crypto=require(_0x4ca9('0xa'));var jsforce=require(_0x4ca9('0xb'));var deskjs=require(_0x4ca9('0xc'));var toCsv=require(_0x4ca9('0x5'));var querystring=require(_0x4ca9('0xd'));var Papa=require(_0x4ca9('0xe'));var Redis=require(_0x4ca9('0xf'));var authService=require(_0x4ca9('0x10'));var qs=require(_0x4ca9('0x11'));var as=require(_0x4ca9('0x12'));var hardwareService=require(_0x4ca9('0x13'));var logger=require(_0x4ca9('0x14'))(_0x4ca9('0x15'));var utils=require('../../config/utils');var config=require(_0x4ca9('0x16'));var licenseUtil=require(_0x4ca9('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x43bb2b,_0x52f827){_0x52f827=_0x52f827||0xcc;return function(_0x7bdec3){if(_0x7bdec3){return _0x43bb2b['sendStatus'](_0x52f827);}return _0x43bb2b[_0x4ca9('0x18')](_0x52f827)[_0x4ca9('0x19')]();};}function respondWithResult(_0xd215cd,_0x162732){_0x162732=_0x162732||0xc8;return function(_0x36f58a){if(_0x36f58a){return _0xd215cd[_0x4ca9('0x18')](_0x162732)[_0x4ca9('0x1a')](_0x36f58a);}};}function respondWithFilteredResult(_0xc2444d,_0x24b2e1){return function(_0x5eb80a){if(_0x5eb80a){var _0x37aade=typeof _0x24b2e1[_0x4ca9('0x1b')]===_0x4ca9('0x1c')&&typeof _0x24b2e1[_0x4ca9('0x1d')]===_0x4ca9('0x1c');var _0x18eb65=_0x5eb80a[_0x4ca9('0x1e')];var _0x2d8c1d=_0x37aade?0x0:_0x24b2e1[_0x4ca9('0x1b')];var _0x4701cc=_0x37aade?_0x5eb80a['count']:_0x24b2e1[_0x4ca9('0x1b')]+_0x24b2e1['limit'];var _0x2f495c;if(_0x4701cc>=_0x18eb65){_0x4701cc=_0x18eb65;_0x2f495c=0xc8;}else{_0x2f495c=0xce;}_0xc2444d[_0x4ca9('0x18')](_0x2f495c);return _0xc2444d[_0x4ca9('0x1f')](_0x4ca9('0x20'),_0x2d8c1d+'-'+_0x4701cc+'/'+_0x18eb65)[_0x4ca9('0x1a')](_0x5eb80a);}return null;};}function patchUpdates(_0x4e0df3){return function(_0x406a82){try{jsonpatch[_0x4ca9('0x21')](_0x406a82,_0x4e0df3,!![]);}catch(_0x39b839){return BPromise[_0x4ca9('0x22')](_0x39b839);}return _0x406a82[_0x4ca9('0x23')]();};}function saveUpdates(_0x579b36,_0x2537e4){return function(_0x51bbde){if(_0x51bbde){return _0x51bbde[_0x4ca9('0x24')](_0x579b36)[_0x4ca9('0x25')](function(_0x98498b){return _0x98498b;});}return null;};}function removeEntity(_0x1bdfb7,_0x1148bf){return function(_0x33438e){if(_0x33438e){return _0x33438e[_0x4ca9('0x26')]()[_0x4ca9('0x25')](function(){_0x1bdfb7[_0x4ca9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39ee50,_0x2024fb){return function(_0x4bfff2){if(!_0x4bfff2){_0x39ee50[_0x4ca9('0x27')](0x194);}return _0x4bfff2;};}function handleError(_0x2313bb,_0x1fd426){_0x1fd426=_0x1fd426||0x1f4;return function(_0x5b73b0){logger[_0x4ca9('0x28')](_0x5b73b0[_0x4ca9('0x29')]);if(_0x5b73b0['name']){delete _0x5b73b0[_0x4ca9('0x2a')];}_0x2313bb[_0x4ca9('0x18')](_0x1fd426)[_0x4ca9('0x2b')](_0x5b73b0);};}exports[_0x4ca9('0x2c')]=function(_0x11deb7,_0x3551b3){var _0x26653f={},_0x556a0b={},_0x18aff0={'count':0x0,'rows':[]};var _0x328e3c=_[_0x4ca9('0x2d')](db['DeskAccount']['rawAttributes'],function(_0x3aa77a){return{'name':_0x3aa77a['fieldName'],'type':_0x3aa77a[_0x4ca9('0x2e')][_0x4ca9('0x2f')]};});_0x556a0b['model']=_[_0x4ca9('0x2d')](_0x328e3c,_0x4ca9('0x2a'));_0x556a0b['query']=_[_0x4ca9('0x30')](_0x11deb7[_0x4ca9('0x31')]);_0x556a0b[_0x4ca9('0x32')]=_['intersection'](_0x556a0b[_0x4ca9('0x33')],_0x556a0b[_0x4ca9('0x31')]);_0x26653f[_0x4ca9('0x34')]=_[_0x4ca9('0x35')](_0x556a0b[_0x4ca9('0x33')],qs['fields'](_0x11deb7[_0x4ca9('0x31')][_0x4ca9('0x36')]));_0x26653f['attributes']=_0x26653f['attributes'][_0x4ca9('0x37')]?_0x26653f['attributes']:_0x556a0b[_0x4ca9('0x33')];if(!_0x11deb7['query'][_0x4ca9('0x38')](_0x4ca9('0x39'))){_0x26653f['limit']=qs['limit'](_0x11deb7['query']['limit']);_0x26653f[_0x4ca9('0x1b')]=qs[_0x4ca9('0x1b')](_0x11deb7['query']['offset']);}_0x26653f[_0x4ca9('0x3a')]=qs['sort'](_0x11deb7[_0x4ca9('0x31')][_0x4ca9('0x3b')]);_0x26653f['where']=qs[_0x4ca9('0x32')](_[_0x4ca9('0x3c')](_0x11deb7[_0x4ca9('0x31')],_0x556a0b['filters']),_0x328e3c);if(_0x11deb7[_0x4ca9('0x31')][_0x4ca9('0x3d')]){_0x26653f[_0x4ca9('0x3e')]=_[_0x4ca9('0x3f')](_0x26653f['where'],{'$or':_[_0x4ca9('0x2d')](_0x328e3c,function(_0x485da5){if(_0x485da5[_0x4ca9('0x2e')]!=='VIRTUAL'){var _0x49a3c7={};_0x49a3c7[_0x485da5[_0x4ca9('0x2a')]]={'$like':'%'+_0x11deb7[_0x4ca9('0x31')][_0x4ca9('0x3d')]+'%'};return _0x49a3c7;}})});}_0x26653f=_['merge']({},_0x26653f,_0x11deb7[_0x4ca9('0x40')]);var _0x2d74a9={'where':_0x26653f[_0x4ca9('0x3e')]};return db[_0x4ca9('0x41')][_0x4ca9('0x1e')](_0x2d74a9)[_0x4ca9('0x25')](function(_0x45d9ea){_0x18aff0[_0x4ca9('0x1e')]=_0x45d9ea;if(_0x11deb7['query']['includeAll']){_0x26653f['include']=[{'all':!![]}];}return db['DeskAccount'][_0x4ca9('0x42')](_0x26653f);})[_0x4ca9('0x25')](function(_0x5c893d){_0x18aff0['rows']=_0x5c893d;return _0x18aff0;})['then'](respondWithFilteredResult(_0x3551b3,_0x26653f))[_0x4ca9('0x43')](handleError(_0x3551b3,null));};exports[_0x4ca9('0x44')]=function(_0x351c19,_0x59ff93){var _0x2d69bf={'raw':![],'where':{'id':_0x351c19[_0x4ca9('0x45')]['id']}},_0xd41410={};_0xd41410[_0x4ca9('0x33')]=_[_0x4ca9('0x30')](db[_0x4ca9('0x41')]['rawAttributes']);_0xd41410['query']=_[_0x4ca9('0x30')](_0x351c19[_0x4ca9('0x31')]);_0xd41410[_0x4ca9('0x32')]=_[_0x4ca9('0x35')](_0xd41410[_0x4ca9('0x33')],_0xd41410[_0x4ca9('0x31')]);_0x2d69bf[_0x4ca9('0x34')]=_[_0x4ca9('0x35')](_0xd41410[_0x4ca9('0x33')],qs['fields'](_0x351c19[_0x4ca9('0x31')]['fields']));_0x2d69bf[_0x4ca9('0x34')]=_0x2d69bf[_0x4ca9('0x34')][_0x4ca9('0x37')]?_0x2d69bf[_0x4ca9('0x34')]:_0xd41410[_0x4ca9('0x33')];if(_0x351c19['query']['includeAll']){_0x2d69bf['include']=[{'all':!![]}];}_0x2d69bf=_[_0x4ca9('0x3f')]({},_0x2d69bf,_0x351c19[_0x4ca9('0x40')]);return db['DeskAccount'][_0x4ca9('0x46')](_0x2d69bf)[_0x4ca9('0x25')](handleEntityNotFound(_0x59ff93,null))[_0x4ca9('0x25')](respondWithResult(_0x59ff93,null))['catch'](handleError(_0x59ff93,null));};exports[_0x4ca9('0x47')]=function(_0x913a89,_0x7cc3e3){return db[_0x4ca9('0x41')][_0x4ca9('0x47')](_0x913a89[_0x4ca9('0x48')],{})[_0x4ca9('0x25')](respondWithResult(_0x7cc3e3,0xc9))['catch'](handleError(_0x7cc3e3,null));};exports[_0x4ca9('0x24')]=function(_0x11a971,_0x4619c2){if(_0x11a971['body']['id']){delete _0x11a971['body']['id'];}return db[_0x4ca9('0x41')]['find']({'where':{'id':_0x11a971[_0x4ca9('0x45')]['id']}})[_0x4ca9('0x25')](handleEntityNotFound(_0x4619c2,null))[_0x4ca9('0x25')](saveUpdates(_0x11a971[_0x4ca9('0x48')],null))[_0x4ca9('0x25')](respondWithResult(_0x4619c2,null))[_0x4ca9('0x43')](handleError(_0x4619c2,null));};exports[_0x4ca9('0x26')]=function(_0x376e05,_0x2cabfe){return db['DeskAccount'][_0x4ca9('0x46')]({'where':{'id':_0x376e05[_0x4ca9('0x45')]['id']}})[_0x4ca9('0x25')](handleEntityNotFound(_0x2cabfe,null))['then'](removeEntity(_0x2cabfe,null))[_0x4ca9('0x43')](handleError(_0x2cabfe,null));};exports['getConfigurations']=function(_0x371af0,_0x15ee5c,_0x11aae5){var _0x4127bb={};var _0x1e9bf1={};var _0x17b992;var _0x58745c;return db['DeskAccount'][_0x4ca9('0x49')]({'where':{'id':_0x371af0[_0x4ca9('0x45')]['id']}})['then'](handleEntityNotFound(_0x15ee5c,null))[_0x4ca9('0x25')](function(_0x53cc7f){if(_0x53cc7f){_0x17b992=_0x53cc7f;_0x1e9bf1[_0x4ca9('0x33')]=_['keys'](db['DeskConfiguration'][_0x4ca9('0x4a')]);_0x1e9bf1['query']=_[_0x4ca9('0x30')](_0x371af0['query']);_0x1e9bf1['filters']=_[_0x4ca9('0x35')](_0x1e9bf1[_0x4ca9('0x33')],_0x1e9bf1[_0x4ca9('0x31')]);_0x4127bb[_0x4ca9('0x34')]=_[_0x4ca9('0x35')](_0x1e9bf1[_0x4ca9('0x33')],qs[_0x4ca9('0x36')](_0x371af0[_0x4ca9('0x31')][_0x4ca9('0x36')]));_0x4127bb[_0x4ca9('0x34')]=_0x4127bb[_0x4ca9('0x34')]['length']?_0x4127bb['attributes']:_0x1e9bf1[_0x4ca9('0x33')];_0x4127bb[_0x4ca9('0x3a')]=qs[_0x4ca9('0x3b')](_0x371af0[_0x4ca9('0x31')]['sort']);_0x4127bb[_0x4ca9('0x3e')]=qs[_0x4ca9('0x32')](_['pick'](_0x371af0[_0x4ca9('0x31')],_0x1e9bf1[_0x4ca9('0x32')]));if(_0x371af0['query'][_0x4ca9('0x3d')]){_0x4127bb[_0x4ca9('0x3e')]=_['merge'](_0x4127bb[_0x4ca9('0x3e')],{'$or':_[_0x4ca9('0x2d')](_0x4127bb[_0x4ca9('0x34')],function(_0x43f783){var _0x29f24d={};_0x29f24d[_0x43f783]={'$like':'%'+_0x371af0[_0x4ca9('0x31')][_0x4ca9('0x3d')]+'%'};return _0x29f24d;})});}_0x4127bb=_[_0x4ca9('0x3f')]({},_0x4127bb,_0x371af0[_0x4ca9('0x40')]);return _0x17b992[_0x4ca9('0x4b')](_0x4127bb);}})[_0x4ca9('0x25')](function(_0x29e375){if(_0x29e375){_0x58745c=_0x29e375['length'];if(!_0x371af0[_0x4ca9('0x31')][_0x4ca9('0x38')]('nolimit')){_0x4127bb[_0x4ca9('0x1d')]=qs[_0x4ca9('0x1d')](_0x371af0[_0x4ca9('0x31')][_0x4ca9('0x1d')]);_0x4127bb[_0x4ca9('0x1b')]=qs[_0x4ca9('0x1b')](_0x371af0[_0x4ca9('0x31')]['offset']);}return _0x17b992[_0x4ca9('0x4b')](_0x4127bb);}})[_0x4ca9('0x25')](function(_0x3d8e12){if(_0x3d8e12){return _0x3d8e12?{'count':_0x58745c,'rows':_0x3d8e12}:null;}})[_0x4ca9('0x25')](respondWithResult(_0x15ee5c,null))[_0x4ca9('0x43')](handleError(_0x15ee5c,null));};exports[_0x4ca9('0x4c')]=function(_0x2e900f,_0x4303e7,_0x2e0d36){if(_0x2e900f[_0x4ca9('0x48')]['id']){delete _0x2e900f[_0x4ca9('0x48')]['id'];}return db[_0x4ca9('0x41')]['findOne']({'where':{'id':_0x2e900f[_0x4ca9('0x45')]['id']}})[_0x4ca9('0x25')](handleEntityNotFound(_0x4303e7,null))[_0x4ca9('0x25')](function(_0xfa873e){if(_0xfa873e){_0x2e900f['body'][_0x4ca9('0x4d')]=_0xfa873e['id'];_0x2e900f[_0x4ca9('0x48')][_0x4ca9('0x4e')]=integrations[_0x4ca9('0x4f')](_0x2e900f[_0x4ca9('0x48')][_0x4ca9('0x50')],_0x2e900f[_0x4ca9('0x48')]['type']);_0x2e900f[_0x4ca9('0x48')][_0x4ca9('0x51')]=integrations[_0x4ca9('0x52')](_0x2e900f[_0x4ca9('0x48')]['channel'],_0x2e900f['body'][_0x4ca9('0x2e')]);return db[_0x4ca9('0x53')][_0x4ca9('0x47')](_0x2e900f['body'],{'include':[{'model':db[_0x4ca9('0x54')],'as':_0x4ca9('0x4e')},{'model':db['DeskField'],'as':_0x4ca9('0x51')}]});}return null;})[_0x4ca9('0x25')](respondWithResult(_0x4303e7,null))[_0x4ca9('0x43')](handleError(_0x4303e7,null));};exports['getFields']=function(_0x5b607f,_0x1c5b09,_0x25de46){var _0x417946=[{'name':'priority','label':_0x4ca9('0x55'),'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 _0x580911='';return db['DeskAccount'][_0x4ca9('0x49')]({'where':{'id':_0x5b607f[_0x4ca9('0x45')]['id']},'attributes':['id',_0x4ca9('0x56'),'authType',_0x4ca9('0x57'),_0x4ca9('0x58'),_0x4ca9('0x59'),_0x4ca9('0x5a'),'token',_0x4ca9('0x5b')]})[_0x4ca9('0x25')](handleEntityNotFound(_0x1c5b09,null))[_0x4ca9('0x25')](function(_0x1d9ab7){if(_0x1d9ab7){_0x580911=_0x1d9ab7[_0x4ca9('0x56')];var _0xc442ef=_0x580911[_0x4ca9('0x5c')](-0x1);if(_0xc442ef==='/'){_0x580911=_0x580911['substring'](0x0,_0x580911[_0x4ca9('0x5d')](_0xc442ef));}var _0x35a2ae={'method':_0x4ca9('0x5e'),'uri':util[_0x4ca9('0x5f')]('%s/custom_fields',_0x580911),'headers':{'Content-Type':_0x4ca9('0x60'),'Accept':_0x4ca9('0x60')},'json':!![]};if(_0x1d9ab7['authType']===_0x4ca9('0x61')){_0x35a2ae[_0x4ca9('0x62')][_0x4ca9('0x63')]=util['format'](_0x4ca9('0x64'),new Buffer(util[_0x4ca9('0x5f')]('%s:%s',_0x1d9ab7['username'],_0x1d9ab7[_0x4ca9('0x58')]))['toString'](_0x4ca9('0x65')));}return rp(_0x35a2ae)[_0x4ca9('0x25')](function(_0x528d96){return _0x417946[_0x4ca9('0x66')](_[_0x4ca9('0x2d')](_0x528d96[_0x4ca9('0x67')]['entries'],function(_0x54d9ee){return{'id':_0x54d9ee[_0x4ca9('0x2a')],'name':_0x54d9ee['name'],'type':_0x54d9ee[_0x4ca9('0x2e')],'active':_0x54d9ee[_0x4ca9('0x68')],'label':_0x54d9ee[_0x4ca9('0x69')],'custom':!![]};}));});}})[_0x4ca9('0x25')](function(_0x5a498d){return{'count':_0x5a498d[_0x4ca9('0x37')],'rows':_0x5a498d};})[_0x4ca9('0x25')](respondWithResult(_0x1c5b09,null))[_0x4ca9('0x43')](function(_0x104dca){var _0x1fbd30=_0x5b607f[_0x4ca9('0x31')][_0x4ca9('0x6a')]?0x1f4:_0x104dca[_0x4ca9('0x6b')]||0x1f4;logger[_0x4ca9('0x28')](_0x4ca9('0x6c'),_0x4ca9('0x6d'),_0x1fbd30,JSON[_0x4ca9('0x6e')](_0x104dca));delete _0x104dca[_0x4ca9('0x2a')];if(_0x1fbd30===0x191){_0x1fbd30=0x190;}_0x1c5b09[_0x4ca9('0x18')](_0x1fbd30)[_0x4ca9('0x2b')](_0x5b607f[_0x4ca9('0x31')][_0x4ca9('0x6a')]?{'message':_0x4ca9('0x6f'),'statusCode':_0x104dca[_0x4ca9('0x6b')]}:_0x104dca);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3b9e9a6..3bc76e3 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 _0xaf84=['request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','util','../../config/logger','api','bluebird'];(function(_0xf25599,_0x4e23cf){var _0x3249ba=function(_0x398c16){while(--_0x398c16){_0xf25599['push'](_0xf25599['shift']());}};_0x3249ba(++_0x4e23cf);}(_0xaf84,0x68));var _0x4af8=function(_0x1c6551,_0x3fbc2e){_0x1c6551=_0x1c6551-0x0;var _0x3f7434=_0xaf84[_0x1c6551];return _0x3f7434;};'use strict';var _=require('lodash');var util=require(_0x4af8('0x0'));var logger=require(_0x4af8('0x1'))(_0x4af8('0x2'));var moment=require('moment');var BPromise=require(_0x4af8('0x3'));var rp=require(_0x4af8('0x4'));var fs=require('fs');var path=require(_0x4af8('0x5'));var rimraf=require(_0x4af8('0x6'));var config=require('../../config/environment');var attributes=require(_0x4af8('0x7'));var integrations=require(_0x4af8('0x8'));module['exports']=function(_0x5a96a1,_0xf39536){return _0x5a96a1['define']('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd70=['path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0xbd70,0x111));var _0x0bd7=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xbd70[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x0bd7('0x0'));var util=require(_0x0bd7('0x1'));var logger=require(_0x0bd7('0x2'))(_0x0bd7('0x3'));var moment=require(_0x0bd7('0x4'));var BPromise=require(_0x0bd7('0x5'));var rp=require(_0x0bd7('0x6'));var fs=require('fs');var path=require(_0x0bd7('0x7'));var rimraf=require('rimraf');var config=require(_0x0bd7('0x8'));var attributes=require(_0x0bd7('0x9'));var integrations=require(_0x0bd7('0xa'));module[_0x0bd7('0xb')]=function(_0x1ac76d,_0x1145b3){return _0x1ac76d[_0x0bd7('0xc')](_0x0bd7('0xd'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index dcee814..e6045c8 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 _0xcde6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','include','map','model','GetDeskAccount','debug','find','then','ShowDeskAccount','lodash','util'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xcde6,0x1da));var _0x6cde=function(_0x35b1e5,_0x386163){_0x35b1e5=_0x35b1e5-0x0;var _0x1c5ce4=_0xcde6[_0x35b1e5];return _0x1c5ce4;};'use strict';var _=require(_0x6cde('0x0'));var util=require(_0x6cde('0x1'));var moment=require(_0x6cde('0x2'));var BPromise=require(_0x6cde('0x3'));var rs=require(_0x6cde('0x4'));var fs=require('fs');var Redis=require(_0x6cde('0x5'));var db=require(_0x6cde('0x6'))['db'];var utils=require(_0x6cde('0x7'));var logger=require(_0x6cde('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6cde('0x9'));var client=jayson[_0x6cde('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f0adf,_0x4cc5c2,_0x18260b){return new BPromise(function(_0x29771f,_0x1716f2){return client['request'](_0x4f0adf,_0x18260b)['then'](function(_0x809632){logger[_0x6cde('0xb')](_0x6cde('0xc'),_0x4cc5c2,_0x6cde('0xd'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x4cc5c2,_0x6cde('0xd'),JSON[_0x6cde('0xe')](_0x809632));if(_0x809632['error']){if(_0x809632['error'][_0x6cde('0xf')]===0x1f4){logger[_0x6cde('0x10')](_0x6cde('0xc'),_0x4cc5c2,_0x809632[_0x6cde('0x10')][_0x6cde('0x11')]);return _0x1716f2(_0x809632[_0x6cde('0x10')][_0x6cde('0x11')]);}logger[_0x6cde('0x10')](_0x6cde('0xc'),_0x4cc5c2,_0x809632[_0x6cde('0x10')][_0x6cde('0x11')]);return _0x29771f(_0x809632[_0x6cde('0x10')][_0x6cde('0x11')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x4cc5c2,_0x6cde('0xd'));_0x29771f(_0x809632[_0x6cde('0x12')][_0x6cde('0x11')]);}})[_0x6cde('0x13')](function(_0x2fcda5){logger[_0x6cde('0x10')](_0x6cde('0xc'),_0x4cc5c2,_0x2fcda5);_0x1716f2(_0x2fcda5);});});}exports['GetDeskAccount']=function(_0x467e52){var _0xb6a88e=this;return new Promise(function(_0x28762f,_0x5a8b97){return db[_0x6cde('0x14')][_0x6cde('0x15')]({'raw':_0x467e52[_0x6cde('0x16')]?_0x467e52[_0x6cde('0x16')][_0x6cde('0x17')]===undefined?!![]:![]:!![],'where':_0x467e52['options']?_0x467e52['options'][_0x6cde('0x18')]||null:null,'attributes':_0x467e52[_0x6cde('0x16')]?_0x467e52[_0x6cde('0x16')][_0x6cde('0x19')]||null:null,'limit':_0x467e52[_0x6cde('0x16')]?_0x467e52[_0x6cde('0x16')]['limit']||null:null,'include':_0x467e52[_0x6cde('0x16')]?_0x467e52['options'][_0x6cde('0x1a')]?_[_0x6cde('0x1b')](_0x467e52['options']['include'],function(_0x534e6a){return{'model':db[_0x534e6a[_0x6cde('0x1c')]],'as':_0x534e6a['as'],'attributes':_0x534e6a[_0x6cde('0x19')],'include':_0x534e6a['include']?_['map'](_0x534e6a['include'],function(_0x581fed){return{'model':db[_0x581fed[_0x6cde('0x1c')]],'as':_0x581fed['as'],'attributes':_0x581fed[_0x6cde('0x19')],'include':_0x581fed['include']?_[_0x6cde('0x1b')](_0x581fed[_0x6cde('0x1a')],function(_0x419570){return{'model':db[_0x419570[_0x6cde('0x1c')]],'as':_0x419570['as'],'attributes':_0x419570[_0x6cde('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18e71f){logger[_0x6cde('0xb')](_0x6cde('0x1d'),_0x467e52);logger[_0x6cde('0x1e')](_0x6cde('0x1d'),_0x467e52,JSON[_0x6cde('0xe')](_0x18e71f));_0x28762f(_0x18e71f);})[_0x6cde('0x13')](function(_0x84b923){logger[_0x6cde('0x10')](_0x6cde('0x1d'),_0x84b923[_0x6cde('0x11')],_0x467e52);_0x5a8b97(_0xb6a88e[_0x6cde('0x10')](0x1f4,_0x84b923[_0x6cde('0x11')]));});});};exports['ShowDeskAccount']=function(_0x44c539){var _0x12bad6=this;return new Promise(function(_0x2e1ae6,_0x4245fc){return db['DeskAccount'][_0x6cde('0x1f')]({'raw':_0x44c539[_0x6cde('0x16')]?_0x44c539[_0x6cde('0x16')][_0x6cde('0x17')]===undefined?!![]:![]:!![],'where':_0x44c539[_0x6cde('0x16')]?_0x44c539[_0x6cde('0x16')][_0x6cde('0x18')]||null:null,'attributes':_0x44c539['options']?_0x44c539[_0x6cde('0x16')][_0x6cde('0x19')]||null:null,'include':_0x44c539[_0x6cde('0x16')]?_0x44c539[_0x6cde('0x16')][_0x6cde('0x1a')]?_['map'](_0x44c539[_0x6cde('0x16')]['include'],function(_0x1a8226){return{'model':db[_0x1a8226[_0x6cde('0x1c')]],'as':_0x1a8226['as'],'attributes':_0x1a8226[_0x6cde('0x19')],'include':_0x1a8226[_0x6cde('0x1a')]?_['map'](_0x1a8226[_0x6cde('0x1a')],function(_0x3af6cb){return{'model':db[_0x3af6cb[_0x6cde('0x1c')]],'as':_0x3af6cb['as'],'attributes':_0x3af6cb[_0x6cde('0x19')],'include':_0x3af6cb[_0x6cde('0x1a')]?_[_0x6cde('0x1b')](_0x3af6cb[_0x6cde('0x1a')],function(_0xa847ef){return{'model':db[_0xa847ef['model']],'as':_0xa847ef['as'],'attributes':_0xa847ef[_0x6cde('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6cde('0x20')](function(_0x1b588f){logger[_0x6cde('0xb')]('ShowDeskAccount',_0x44c539);logger[_0x6cde('0x1e')](_0x6cde('0x21'),_0x44c539,JSON[_0x6cde('0xe')](_0x1b588f));_0x2e1ae6(_0x1b588f);})[_0x6cde('0x13')](function(_0x4e08c9){logger[_0x6cde('0x10')](_0x6cde('0x21'),_0x4e08c9[_0x6cde('0x11')],_0x44c539);_0x4245fc(_0x12bad6[_0x6cde('0x10')](0x1f4,_0x4e08c9[_0x6cde('0x11')]));});});}; \ No newline at end of file +var _0x1f04=['limit','map','model','include','find','ShowDeskAccount','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes'];(function(_0x23b980,_0x57697f){var _0x475354=function(_0x3ee3fb){while(--_0x3ee3fb){_0x23b980['push'](_0x23b980['shift']());}};_0x475354(++_0x57697f);}(_0x1f04,0x171));var _0x41f0=function(_0x211e15,_0x395d76){_0x211e15=_0x211e15-0x0;var _0x563752=_0x1f04[_0x211e15];return _0x563752;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x41f0('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41f0('0x1'));var db=require(_0x41f0('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x41f0('0x3'))(_0x41f0('0x4'));var config=require(_0x41f0('0x5'));var jayson=require(_0x41f0('0x6'));var client=jayson[_0x41f0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc0f168,_0x37dc8e,_0x514b92){return new BPromise(function(_0x3f8bcc,_0x517a28){return client['request'](_0xc0f168,_0x514b92)[_0x41f0('0x8')](function(_0x57af0c){logger['info'](_0x41f0('0x9'),_0x37dc8e,_0x41f0('0xa'));logger[_0x41f0('0xb')](_0x41f0('0xc'),_0x37dc8e,_0x41f0('0xa'),JSON[_0x41f0('0xd')](_0x57af0c));if(_0x57af0c[_0x41f0('0xe')]){if(_0x57af0c[_0x41f0('0xe')][_0x41f0('0xf')]===0x1f4){logger[_0x41f0('0xe')](_0x41f0('0x9'),_0x37dc8e,_0x57af0c['error']['message']);return _0x517a28(_0x57af0c['error'][_0x41f0('0x10')]);}logger[_0x41f0('0xe')](_0x41f0('0x9'),_0x37dc8e,_0x57af0c[_0x41f0('0xe')]['message']);return _0x3f8bcc(_0x57af0c[_0x41f0('0xe')][_0x41f0('0x10')]);}else{logger[_0x41f0('0x11')](_0x41f0('0x9'),_0x37dc8e,'request\x20sent');_0x3f8bcc(_0x57af0c[_0x41f0('0x12')][_0x41f0('0x10')]);}})[_0x41f0('0x13')](function(_0x176582){logger[_0x41f0('0xe')]('DeskAccount,\x20%s,\x20%s',_0x37dc8e,_0x176582);_0x517a28(_0x176582);});});}exports[_0x41f0('0x14')]=function(_0x111f13){var _0x334778=this;return new Promise(function(_0xf35551,_0x29e118){return db[_0x41f0('0x15')][_0x41f0('0x16')]({'raw':_0x111f13[_0x41f0('0x17')]?_0x111f13[_0x41f0('0x17')][_0x41f0('0x18')]===undefined?!![]:![]:!![],'where':_0x111f13['options']?_0x111f13[_0x41f0('0x17')][_0x41f0('0x19')]||null:null,'attributes':_0x111f13[_0x41f0('0x17')]?_0x111f13[_0x41f0('0x17')][_0x41f0('0x1a')]||null:null,'limit':_0x111f13[_0x41f0('0x17')]?_0x111f13[_0x41f0('0x17')][_0x41f0('0x1b')]||null:null,'include':_0x111f13[_0x41f0('0x17')]?_0x111f13[_0x41f0('0x17')]['include']?_[_0x41f0('0x1c')](_0x111f13[_0x41f0('0x17')]['include'],function(_0xbe2ef8){return{'model':db[_0xbe2ef8[_0x41f0('0x1d')]],'as':_0xbe2ef8['as'],'attributes':_0xbe2ef8['attributes'],'include':_0xbe2ef8[_0x41f0('0x1e')]?_[_0x41f0('0x1c')](_0xbe2ef8[_0x41f0('0x1e')],function(_0x5be92e){return{'model':db[_0x5be92e['model']],'as':_0x5be92e['as'],'attributes':_0x5be92e[_0x41f0('0x1a')],'include':_0x5be92e[_0x41f0('0x1e')]?_['map'](_0x5be92e[_0x41f0('0x1e')],function(_0x1242b9){return{'model':db[_0x1242b9[_0x41f0('0x1d')]],'as':_0x1242b9['as'],'attributes':_0x1242b9[_0x41f0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x41f0('0x8')](function(_0x195490){logger[_0x41f0('0x11')](_0x41f0('0x14'),_0x111f13);logger[_0x41f0('0xb')](_0x41f0('0x14'),_0x111f13,JSON[_0x41f0('0xd')](_0x195490));_0xf35551(_0x195490);})[_0x41f0('0x13')](function(_0x1fbc5a){logger[_0x41f0('0xe')](_0x41f0('0x14'),_0x1fbc5a[_0x41f0('0x10')],_0x111f13);_0x29e118(_0x334778[_0x41f0('0xe')](0x1f4,_0x1fbc5a[_0x41f0('0x10')]));});});};exports['ShowDeskAccount']=function(_0x5cb3e3){var _0x4ec93e=this;return new Promise(function(_0x5c61ec,_0xcea0a7){return db[_0x41f0('0x15')][_0x41f0('0x1f')]({'raw':_0x5cb3e3[_0x41f0('0x17')]?_0x5cb3e3[_0x41f0('0x17')][_0x41f0('0x18')]===undefined?!![]:![]:!![],'where':_0x5cb3e3[_0x41f0('0x17')]?_0x5cb3e3['options']['where']||null:null,'attributes':_0x5cb3e3[_0x41f0('0x17')]?_0x5cb3e3[_0x41f0('0x17')][_0x41f0('0x1a')]||null:null,'include':_0x5cb3e3[_0x41f0('0x17')]?_0x5cb3e3['options']['include']?_[_0x41f0('0x1c')](_0x5cb3e3[_0x41f0('0x17')][_0x41f0('0x1e')],function(_0x3a854c){return{'model':db[_0x3a854c[_0x41f0('0x1d')]],'as':_0x3a854c['as'],'attributes':_0x3a854c[_0x41f0('0x1a')],'include':_0x3a854c['include']?_[_0x41f0('0x1c')](_0x3a854c[_0x41f0('0x1e')],function(_0xe49746){return{'model':db[_0xe49746['model']],'as':_0xe49746['as'],'attributes':_0xe49746[_0x41f0('0x1a')],'include':_0xe49746['include']?_['map'](_0xe49746[_0x41f0('0x1e')],function(_0xb8c3f2){return{'model':db[_0xb8c3f2[_0x41f0('0x1d')]],'as':_0xb8c3f2['as'],'attributes':_0xb8c3f2[_0x41f0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a6fed){logger[_0x41f0('0x11')](_0x41f0('0x20'),_0x5cb3e3);logger[_0x41f0('0xb')](_0x41f0('0x20'),_0x5cb3e3,JSON[_0x41f0('0xd')](_0x1a6fed));_0x5c61ec(_0x1a6fed);})[_0x41f0('0x13')](function(_0x373e14){logger['error'](_0x41f0('0x20'),_0x373e14[_0x41f0('0x10')],_0x5cb3e3);_0xcea0a7(_0x4ec93e[_0x41f0('0xe')](0x1f4,_0x373e14[_0x41f0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 12db915..85555ef 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x5ec849,_0x423036){var _0x54d580=function(_0x798c5a){while(--_0x798c5a){_0x5ec849['push'](_0x5ec849['shift']());}};_0x54d580(++_0x423036);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1c08cf,_0x24547f){var _0x5acfda=function(_0x5163ae){while(--_0x5163ae){_0x1c08cf['push'](_0x1c08cf['shift']());}};_0x5acfda(++_0x24547f);}(_0x008c,0x188));var _0xc008=function(_0x6aa32f,_0x3820f7){_0x6aa32f=_0x6aa32f-0x0;var _0x52bfee=_0x008c[_0x6aa32f];return _0x52bfee;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 63afcff..c1a4d0d 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 _0xae4e=['STRING','exports'];(function(_0x415aba,_0x35def2){var _0x2ecf62=function(_0x3a43fe){while(--_0x3a43fe){_0x415aba['push'](_0x415aba['shift']());}};_0x2ecf62(++_0x35def2);}(_0xae4e,0x11d));var _0xeae4=function(_0x19ec23,_0x25e81b){_0x19ec23=_0x19ec23-0x0;var _0x2e8c05=_0xae4e[_0x19ec23];return _0x2e8c05;};'use strict';var Sequelize=require('sequelize');module[_0xeae4('0x0')]={'name':{'type':Sequelize[_0xeae4('0x1')]},'description':{'type':Sequelize[_0xeae4('0x1')]}}; \ No newline at end of file +var _0xe89f=['sequelize','STRING'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xe89f,0x12e));var _0xfe89=function(_0x49a250,_0x2d1236){_0x49a250=_0x49a250-0x0;var _0x1199b8=_0xe89f[_0x49a250];return _0x1199b8;};'use strict';var Sequelize=require(_0xfe89('0x0'));module['exports']={'name':{'type':Sequelize[_0xfe89('0x1')]},'description':{'type':Sequelize[_0xfe89('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index bff8bdd..efab5e0 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 _0x024b=['end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','DeskConfiguration','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','DeskField','pick','hasOwnProperty','getSubjects','getDescriptions','findOne','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x024b,0xe4));var _0xb024=function(_0x438e4d,_0x529810){_0x438e4d=_0x438e4d-0x0;var _0x4e6283=_0x024b[_0x438e4d];return _0x4e6283;};'use strict';var emlformat=require(_0xb024('0x0'));var rimraf=require(_0xb024('0x1'));var zipdir=require(_0xb024('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb024('0x3'));var moment=require(_0xb024('0x4'));var BPromise=require(_0xb024('0x5'));var Mustache=require(_0xb024('0x6'));var util=require('util');var path=require(_0xb024('0x7'));var sox=require(_0xb024('0x8'));var csv=require('to-csv');var ejs=require(_0xb024('0x9'));var fs=require('fs');var fs_extra=require(_0xb024('0xa'));var _=require('lodash');var squel=require(_0xb024('0xb'));var crypto=require(_0xb024('0xc'));var jsforce=require(_0xb024('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb024('0xe'));var querystring=require(_0xb024('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb024('0x10'));var qs=require(_0xb024('0x11'));var as=require(_0xb024('0x12'));var hardwareService=require(_0xb024('0x13'));var logger=require('../../config/logger')(_0xb024('0x14'));var utils=require(_0xb024('0x15'));var config=require(_0xb024('0x16'));var licenseUtil=require(_0xb024('0x17'));var db=require(_0xb024('0x18'))['db'];function respondWithStatusCode(_0x529041,_0x2b9ef4){_0x2b9ef4=_0x2b9ef4||0xcc;return function(_0x123070){if(_0x123070){return _0x529041[_0xb024('0x19')](_0x2b9ef4);}return _0x529041[_0xb024('0x1a')](_0x2b9ef4)[_0xb024('0x1b')]();};}function respondWithResult(_0x43bf77,_0x33070b){_0x33070b=_0x33070b||0xc8;return function(_0x110f66){if(_0x110f66){return _0x43bf77[_0xb024('0x1a')](_0x33070b)[_0xb024('0x1c')](_0x110f66);}};}function respondWithFilteredResult(_0x52db23,_0x3db89c){return function(_0x5daa42){if(_0x5daa42){var _0x30c351=typeof _0x3db89c[_0xb024('0x1d')]===_0xb024('0x1e')&&typeof _0x3db89c[_0xb024('0x1f')]===_0xb024('0x1e');var _0x409586=_0x5daa42[_0xb024('0x20')];var _0x4b0a97=_0x30c351?0x0:_0x3db89c['offset'];var _0x359b5b=_0x30c351?_0x5daa42[_0xb024('0x20')]:_0x3db89c[_0xb024('0x1d')]+_0x3db89c[_0xb024('0x1f')];var _0x135987;if(_0x359b5b>=_0x409586){_0x359b5b=_0x409586;_0x135987=0xc8;}else{_0x135987=0xce;}_0x52db23[_0xb024('0x1a')](_0x135987);return _0x52db23[_0xb024('0x21')](_0xb024('0x22'),_0x4b0a97+'-'+_0x359b5b+'/'+_0x409586)[_0xb024('0x1c')](_0x5daa42);}return null;};}function patchUpdates(_0x1f2848){return function(_0x5e4b74){try{jsonpatch[_0xb024('0x23')](_0x5e4b74,_0x1f2848,!![]);}catch(_0x24a737){return BPromise['reject'](_0x24a737);}return _0x5e4b74[_0xb024('0x24')]();};}function saveUpdates(_0x13718f,_0x5e3986){return function(_0x109171){if(_0x109171){return _0x109171[_0xb024('0x25')](_0x13718f)[_0xb024('0x26')](function(_0x53468a){return _0x53468a;});}return null;};}function removeEntity(_0x231bd5,_0x59772e){return function(_0x3258f1){if(_0x3258f1){return _0x3258f1[_0xb024('0x27')]()[_0xb024('0x26')](function(){_0x231bd5[_0xb024('0x1a')](0xcc)[_0xb024('0x1b')]();});}};}function handleEntityNotFound(_0x16a617,_0x3b3c52){return function(_0x43ecd5){if(!_0x43ecd5){_0x16a617[_0xb024('0x19')](0x194);}return _0x43ecd5;};}function handleError(_0x284e40,_0x70f44a){_0x70f44a=_0x70f44a||0x1f4;return function(_0x93a922){logger['error'](_0x93a922[_0xb024('0x28')]);if(_0x93a922[_0xb024('0x29')]){delete _0x93a922[_0xb024('0x29')];}_0x284e40[_0xb024('0x1a')](_0x70f44a)[_0xb024('0x2a')](_0x93a922);};}exports['index']=function(_0x1360b8,_0x20a85b){var _0x183057={},_0xae9625={},_0x560e71={'count':0x0,'rows':[]};var _0x554c5d=_[_0xb024('0x2b')](db[_0xb024('0x2c')][_0xb024('0x2d')],function(_0x2325cc){return{'name':_0x2325cc['fieldName'],'type':_0x2325cc[_0xb024('0x2e')][_0xb024('0x2f')]};});_0xae9625['model']=_['map'](_0x554c5d,_0xb024('0x29'));_0xae9625[_0xb024('0x30')]=_[_0xb024('0x31')](_0x1360b8[_0xb024('0x30')]);_0xae9625['filters']=_[_0xb024('0x32')](_0xae9625[_0xb024('0x33')],_0xae9625[_0xb024('0x30')]);_0x183057[_0xb024('0x34')]=_[_0xb024('0x32')](_0xae9625[_0xb024('0x33')],qs[_0xb024('0x35')](_0x1360b8[_0xb024('0x30')][_0xb024('0x35')]));_0x183057[_0xb024('0x34')]=_0x183057[_0xb024('0x34')][_0xb024('0x36')]?_0x183057['attributes']:_0xae9625['model'];if(!_0x1360b8[_0xb024('0x30')]['hasOwnProperty'](_0xb024('0x37'))){_0x183057['limit']=qs[_0xb024('0x1f')](_0x1360b8[_0xb024('0x30')][_0xb024('0x1f')]);_0x183057['offset']=qs[_0xb024('0x1d')](_0x1360b8['query'][_0xb024('0x1d')]);}_0x183057[_0xb024('0x38')]=qs[_0xb024('0x39')](_0x1360b8['query']['sort']);_0x183057[_0xb024('0x3a')]=qs[_0xb024('0x3b')](_['pick'](_0x1360b8[_0xb024('0x30')],_0xae9625['filters']),_0x554c5d);if(_0x1360b8[_0xb024('0x30')]['filter']){_0x183057['where']=_['merge'](_0x183057[_0xb024('0x3a')],{'$or':_[_0xb024('0x2b')](_0x554c5d,function(_0x556bd2){if(_0x556bd2[_0xb024('0x2e')]!==_0xb024('0x3c')){var _0x5e6b1a={};_0x5e6b1a[_0x556bd2[_0xb024('0x29')]]={'$like':'%'+_0x1360b8[_0xb024('0x30')][_0xb024('0x3d')]+'%'};return _0x5e6b1a;}})});}_0x183057=_[_0xb024('0x3e')]({},_0x183057,_0x1360b8[_0xb024('0x3f')]);var _0x3ba692={'where':_0x183057['where']};return db['DeskConfiguration'][_0xb024('0x20')](_0x3ba692)[_0xb024('0x26')](function(_0x2a3bbe){_0x560e71[_0xb024('0x20')]=_0x2a3bbe;if(_0x1360b8[_0xb024('0x30')][_0xb024('0x40')]){_0x183057[_0xb024('0x41')]=[{'all':!![]}];}return db[_0xb024('0x2c')][_0xb024('0x42')](_0x183057);})[_0xb024('0x26')](function(_0x473d8e){_0x560e71[_0xb024('0x43')]=_0x473d8e;return _0x560e71;})[_0xb024('0x26')](respondWithFilteredResult(_0x20a85b,_0x183057))[_0xb024('0x44')](handleError(_0x20a85b,null));};exports[_0xb024('0x45')]=function(_0x1128c3,_0x333b64){var _0x4ef52b={'raw':![],'where':{'id':_0x1128c3[_0xb024('0x46')]['id']}},_0x2899c0={};_0x2899c0[_0xb024('0x33')]=_[_0xb024('0x31')](db[_0xb024('0x2c')][_0xb024('0x2d')]);_0x2899c0[_0xb024('0x30')]=_['keys'](_0x1128c3[_0xb024('0x30')]);_0x2899c0['filters']=_[_0xb024('0x32')](_0x2899c0[_0xb024('0x33')],_0x2899c0[_0xb024('0x30')]);_0x4ef52b[_0xb024('0x34')]=_[_0xb024('0x32')](_0x2899c0['model'],qs[_0xb024('0x35')](_0x1128c3['query'][_0xb024('0x35')]));_0x4ef52b[_0xb024('0x34')]=_0x4ef52b[_0xb024('0x34')][_0xb024('0x36')]?_0x4ef52b[_0xb024('0x34')]:_0x2899c0[_0xb024('0x33')];if(_0x1128c3[_0xb024('0x30')][_0xb024('0x40')]){_0x4ef52b[_0xb024('0x41')]=[{'all':!![]}];}_0x4ef52b=_[_0xb024('0x3e')]({},_0x4ef52b,_0x1128c3['options']);return db['DeskConfiguration']['find'](_0x4ef52b)[_0xb024('0x26')](handleEntityNotFound(_0x333b64,null))[_0xb024('0x26')](respondWithResult(_0x333b64,null))[_0xb024('0x44')](handleError(_0x333b64,null));};exports[_0xb024('0x47')]=function(_0x3c00aa,_0x321a32){return db[_0xb024('0x2c')][_0xb024('0x47')](_0x3c00aa['body'],{})[_0xb024('0x26')](respondWithResult(_0x321a32,0xc9))[_0xb024('0x44')](handleError(_0x321a32,null));};exports['update']=function(_0x19e9d4,_0x1a0217){if(_0x19e9d4['body']['id']){delete _0x19e9d4[_0xb024('0x48')]['id'];}return db[_0xb024('0x2c')][_0xb024('0x49')]({'where':{'id':_0x19e9d4['params']['id']}})[_0xb024('0x26')](handleEntityNotFound(_0x1a0217,null))[_0xb024('0x26')](saveUpdates(_0x19e9d4[_0xb024('0x48')],null))[_0xb024('0x26')](respondWithResult(_0x1a0217,null))[_0xb024('0x44')](handleError(_0x1a0217,null));};exports[_0xb024('0x27')]=function(_0x260a32,_0x2c310e){return db[_0xb024('0x2c')][_0xb024('0x49')]({'where':{'id':_0x260a32[_0xb024('0x46')]['id']}})[_0xb024('0x26')](handleEntityNotFound(_0x2c310e,null))[_0xb024('0x26')](removeEntity(_0x2c310e,null))['catch'](handleError(_0x2c310e,null));};exports[_0xb024('0x4a')]=function(_0x5cf334,_0xa19c82,_0xcea318){var _0x596279={};var _0x2c18a5={};var _0x39c31b;var _0x8a4e98;return db[_0xb024('0x2c')]['findOne']({'where':{'id':_0x5cf334[_0xb024('0x46')]['id']}})[_0xb024('0x26')](handleEntityNotFound(_0xa19c82,null))[_0xb024('0x26')](function(_0x5dbaff){if(_0x5dbaff){_0x39c31b=_0x5dbaff;_0x2c18a5[_0xb024('0x33')]=_[_0xb024('0x31')](db[_0xb024('0x4b')][_0xb024('0x2d')]);_0x2c18a5[_0xb024('0x30')]=_[_0xb024('0x31')](_0x5cf334[_0xb024('0x30')]);_0x2c18a5[_0xb024('0x3b')]=_[_0xb024('0x32')](_0x2c18a5[_0xb024('0x33')],_0x2c18a5[_0xb024('0x30')]);_0x596279['attributes']=_['intersection'](_0x2c18a5[_0xb024('0x33')],qs['fields'](_0x5cf334[_0xb024('0x30')][_0xb024('0x35')]));_0x596279[_0xb024('0x34')]=_0x596279[_0xb024('0x34')][_0xb024('0x36')]?_0x596279[_0xb024('0x34')]:_0x2c18a5[_0xb024('0x33')];_0x596279[_0xb024('0x38')]=qs[_0xb024('0x39')](_0x5cf334[_0xb024('0x30')][_0xb024('0x39')]);_0x596279[_0xb024('0x3a')]=qs['filters'](_[_0xb024('0x4c')](_0x5cf334[_0xb024('0x30')],_0x2c18a5['filters']));if(_0x5cf334[_0xb024('0x30')][_0xb024('0x3d')]){_0x596279[_0xb024('0x3a')]=_[_0xb024('0x3e')](_0x596279[_0xb024('0x3a')],{'$or':_[_0xb024('0x2b')](_0x596279['attributes'],function(_0xa81692){var _0xa49511={};_0xa49511[_0xa81692]={'$like':'%'+_0x5cf334[_0xb024('0x30')]['filter']+'%'};return _0xa49511;})});}_0x596279=_[_0xb024('0x3e')]({},_0x596279,_0x5cf334[_0xb024('0x3f')]);return _0x39c31b[_0xb024('0x4a')](_0x596279);}})['then'](function(_0x598e3b){if(_0x598e3b){_0x8a4e98=_0x598e3b[_0xb024('0x36')];if(!_0x5cf334[_0xb024('0x30')][_0xb024('0x4d')](_0xb024('0x37'))){_0x596279[_0xb024('0x1f')]=qs[_0xb024('0x1f')](_0x5cf334[_0xb024('0x30')][_0xb024('0x1f')]);_0x596279[_0xb024('0x1d')]=qs['offset'](_0x5cf334['query'][_0xb024('0x1d')]);}return _0x39c31b[_0xb024('0x4a')](_0x596279);}})['then'](function(_0xdab7f5){if(_0xdab7f5){return _0xdab7f5?{'count':_0x8a4e98,'rows':_0xdab7f5}:null;}})['then'](respondWithResult(_0xa19c82,null))[_0xb024('0x44')](handleError(_0xa19c82,null));};exports['getSubjects']=function(_0x31a187,_0x13ea4c,_0x196a13){var _0x54bc1e={};var _0x1317d8={};var _0x8eb804;var _0x1dfb92;return db['DeskConfiguration']['findOne']({'where':{'id':_0x31a187['params']['id']}})[_0xb024('0x26')](handleEntityNotFound(_0x13ea4c,null))[_0xb024('0x26')](function(_0x19a6c8){if(_0x19a6c8){_0x8eb804=_0x19a6c8;_0x1317d8[_0xb024('0x33')]=_[_0xb024('0x31')](db[_0xb024('0x4b')][_0xb024('0x2d')]);_0x1317d8[_0xb024('0x30')]=_[_0xb024('0x31')](_0x31a187[_0xb024('0x30')]);_0x1317d8['filters']=_['intersection'](_0x1317d8[_0xb024('0x33')],_0x1317d8['query']);_0x54bc1e[_0xb024('0x34')]=_[_0xb024('0x32')](_0x1317d8[_0xb024('0x33')],qs[_0xb024('0x35')](_0x31a187[_0xb024('0x30')]['fields']));_0x54bc1e['attributes']=_0x54bc1e[_0xb024('0x34')][_0xb024('0x36')]?_0x54bc1e[_0xb024('0x34')]:_0x1317d8['model'];_0x54bc1e[_0xb024('0x38')]=qs[_0xb024('0x39')](_0x31a187[_0xb024('0x30')][_0xb024('0x39')]);_0x54bc1e['where']=qs[_0xb024('0x3b')](_[_0xb024('0x4c')](_0x31a187[_0xb024('0x30')],_0x1317d8[_0xb024('0x3b')]));if(_0x31a187['query']['filter']){_0x54bc1e[_0xb024('0x3a')]=_[_0xb024('0x3e')](_0x54bc1e['where'],{'$or':_['map'](_0x54bc1e[_0xb024('0x34')],function(_0x36384e){var _0x1ae130={};_0x1ae130[_0x36384e]={'$like':'%'+_0x31a187[_0xb024('0x30')][_0xb024('0x3d')]+'%'};return _0x1ae130;})});}_0x54bc1e=_['merge']({},_0x54bc1e,_0x31a187['options']);return _0x8eb804[_0xb024('0x4e')](_0x54bc1e);}})['then'](function(_0x431dc0){if(_0x431dc0){_0x1dfb92=_0x431dc0[_0xb024('0x36')];if(!_0x31a187['query'][_0xb024('0x4d')](_0xb024('0x37'))){_0x54bc1e[_0xb024('0x1f')]=qs[_0xb024('0x1f')](_0x31a187['query'][_0xb024('0x1f')]);_0x54bc1e[_0xb024('0x1d')]=qs['offset'](_0x31a187[_0xb024('0x30')][_0xb024('0x1d')]);}return _0x8eb804[_0xb024('0x4e')](_0x54bc1e);}})[_0xb024('0x26')](function(_0x8b305f){if(_0x8b305f){return _0x8b305f?{'count':_0x1dfb92,'rows':_0x8b305f}:null;}})[_0xb024('0x26')](respondWithResult(_0x13ea4c,null))[_0xb024('0x44')](handleError(_0x13ea4c,null));};exports[_0xb024('0x4f')]=function(_0x423b15,_0x266e6b,_0x1ec781){var _0x305fe6={};var _0x53d08e={};var _0x511726;var _0x53e1f4;return db[_0xb024('0x2c')][_0xb024('0x50')]({'where':{'id':_0x423b15['params']['id']}})[_0xb024('0x26')](handleEntityNotFound(_0x266e6b,null))['then'](function(_0xebe022){if(_0xebe022){_0x511726=_0xebe022;_0x53d08e[_0xb024('0x33')]=_['keys'](db['DeskField'][_0xb024('0x2d')]);_0x53d08e['query']=_[_0xb024('0x31')](_0x423b15[_0xb024('0x30')]);_0x53d08e['filters']=_[_0xb024('0x32')](_0x53d08e[_0xb024('0x33')],_0x53d08e[_0xb024('0x30')]);_0x305fe6[_0xb024('0x34')]=_[_0xb024('0x32')](_0x53d08e[_0xb024('0x33')],qs[_0xb024('0x35')](_0x423b15[_0xb024('0x30')]['fields']));_0x305fe6['attributes']=_0x305fe6[_0xb024('0x34')][_0xb024('0x36')]?_0x305fe6['attributes']:_0x53d08e[_0xb024('0x33')];_0x305fe6[_0xb024('0x38')]=qs[_0xb024('0x39')](_0x423b15[_0xb024('0x30')][_0xb024('0x39')]);_0x305fe6[_0xb024('0x3a')]=qs[_0xb024('0x3b')](_[_0xb024('0x4c')](_0x423b15[_0xb024('0x30')],_0x53d08e[_0xb024('0x3b')]));if(_0x423b15[_0xb024('0x30')]['filter']){_0x305fe6[_0xb024('0x3a')]=_[_0xb024('0x3e')](_0x305fe6[_0xb024('0x3a')],{'$or':_[_0xb024('0x2b')](_0x305fe6[_0xb024('0x34')],function(_0x2e2d7d){var _0x26a54c={};_0x26a54c[_0x2e2d7d]={'$like':'%'+_0x423b15['query'][_0xb024('0x3d')]+'%'};return _0x26a54c;})});}_0x305fe6=_[_0xb024('0x3e')]({},_0x305fe6,_0x423b15['options']);return _0x511726[_0xb024('0x4f')](_0x305fe6);}})['then'](function(_0x1dc53d){if(_0x1dc53d){_0x53e1f4=_0x1dc53d[_0xb024('0x36')];if(!_0x423b15[_0xb024('0x30')][_0xb024('0x4d')](_0xb024('0x37'))){_0x305fe6[_0xb024('0x1f')]=qs[_0xb024('0x1f')](_0x423b15[_0xb024('0x30')][_0xb024('0x1f')]);_0x305fe6[_0xb024('0x1d')]=qs[_0xb024('0x1d')](_0x423b15[_0xb024('0x30')][_0xb024('0x1d')]);}return _0x511726['getDescriptions'](_0x305fe6);}})[_0xb024('0x26')](function(_0x54df4e){if(_0x54df4e){return _0x54df4e?{'count':_0x53e1f4,'rows':_0x54df4e}:null;}})['then'](respondWithResult(_0x266e6b,null))['catch'](handleError(_0x266e6b,null));};exports['getTags']=function(_0xd5868a,_0x2202b8,_0x59ee8b){var _0x1947c6={};var _0x5de8f1={};var _0x2b82bf;var _0x384d60;return db[_0xb024('0x2c')]['findOne']({'where':{'id':_0xd5868a[_0xb024('0x46')]['id']}})['then'](handleEntityNotFound(_0x2202b8,null))[_0xb024('0x26')](function(_0x4e6608){if(_0x4e6608){_0x2b82bf=_0x4e6608;_0x5de8f1['model']=_[_0xb024('0x31')](db[_0xb024('0x51')][_0xb024('0x2d')]);_0x5de8f1[_0xb024('0x30')]=_['keys'](_0xd5868a[_0xb024('0x30')]);_0x5de8f1[_0xb024('0x3b')]=_[_0xb024('0x32')](_0x5de8f1[_0xb024('0x33')],_0x5de8f1[_0xb024('0x30')]);_0x1947c6['attributes']=_[_0xb024('0x32')](_0x5de8f1[_0xb024('0x33')],qs[_0xb024('0x35')](_0xd5868a[_0xb024('0x30')][_0xb024('0x35')]));_0x1947c6[_0xb024('0x34')]=_0x1947c6[_0xb024('0x34')][_0xb024('0x36')]?_0x1947c6[_0xb024('0x34')]:_0x5de8f1[_0xb024('0x33')];_0x1947c6['order']=qs[_0xb024('0x39')](_0xd5868a[_0xb024('0x30')]['sort']);_0x1947c6[_0xb024('0x3a')]=qs[_0xb024('0x3b')](_[_0xb024('0x4c')](_0xd5868a[_0xb024('0x30')],_0x5de8f1[_0xb024('0x3b')]));if(_0xd5868a['query'][_0xb024('0x3d')]){_0x1947c6[_0xb024('0x3a')]=_[_0xb024('0x3e')](_0x1947c6[_0xb024('0x3a')],{'$or':_['map'](_0x1947c6[_0xb024('0x34')],function(_0x5943bb){var _0x4cbc81={};_0x4cbc81[_0x5943bb]={'$like':'%'+_0xd5868a['query'][_0xb024('0x3d')]+'%'};return _0x4cbc81;})});}_0x1947c6=_[_0xb024('0x3e')]({},_0x1947c6,_0xd5868a[_0xb024('0x3f')]);return _0x2b82bf[_0xb024('0x52')](_0x1947c6);}})['then'](function(_0x1a4ce9){if(_0x1a4ce9){_0x384d60=_0x1a4ce9[_0xb024('0x36')];if(!_0xd5868a[_0xb024('0x30')][_0xb024('0x4d')](_0xb024('0x37'))){_0x1947c6[_0xb024('0x1f')]=qs[_0xb024('0x1f')](_0xd5868a['query'][_0xb024('0x1f')]);_0x1947c6[_0xb024('0x1d')]=qs['offset'](_0xd5868a[_0xb024('0x30')][_0xb024('0x1d')]);}return _0x2b82bf[_0xb024('0x52')](_0x1947c6);}})[_0xb024('0x26')](function(_0x16a03d){if(_0x16a03d){return _0x16a03d?{'count':_0x384d60,'rows':_0x16a03d}:null;}})['then'](respondWithResult(_0x2202b8,null))[_0xb024('0x44')](handleError(_0x2202b8,null));};exports[_0xb024('0x53')]=function(_0x31470b,_0x506464,_0x5ccce5){if(_0x31470b[_0xb024('0x48')]['id']){delete _0x31470b['body']['id'];}return db['DeskConfiguration'][_0xb024('0x50')]({'where':{'id':_0x31470b[_0xb024('0x46')]['id']}})[_0xb024('0x26')](handleEntityNotFound(_0x506464,null))[_0xb024('0x26')](function(_0xf6f9c3){if(_0xf6f9c3){return _0xf6f9c3['setTags'](_0x31470b[_0xb024('0x48')][_0xb024('0x54')]||[]);}return null;})['then'](respondWithResult(_0x506464,null))['catch'](handleError(_0x506464,null));}; \ No newline at end of file +var _0x7b26=['where','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','findOne','DeskField','getFields','length','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','DeskConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7b26,0xc2));var _0x67b2=function(_0x4d544a,_0x3aa5cd){_0x4d544a=_0x4d544a-0x0;var _0x21b3f6=_0x7b26[_0x4d544a];return _0x21b3f6;};'use strict';var emlformat=require(_0x67b2('0x0'));var rimraf=require(_0x67b2('0x1'));var zipdir=require(_0x67b2('0x2'));var jsonpatch=require(_0x67b2('0x3'));var rp=require('request-promise');var moment=require(_0x67b2('0x4'));var BPromise=require(_0x67b2('0x5'));var Mustache=require(_0x67b2('0x6'));var util=require(_0x67b2('0x7'));var path=require(_0x67b2('0x8'));var sox=require('sox');var csv=require(_0x67b2('0x9'));var ejs=require(_0x67b2('0xa'));var fs=require('fs');var fs_extra=require(_0x67b2('0xb'));var _=require(_0x67b2('0xc'));var squel=require(_0x67b2('0xd'));var crypto=require('crypto');var jsforce=require(_0x67b2('0xe'));var deskjs=require(_0x67b2('0xf'));var toCsv=require(_0x67b2('0x9'));var querystring=require(_0x67b2('0x10'));var Papa=require(_0x67b2('0x11'));var Redis=require(_0x67b2('0x12'));var authService=require(_0x67b2('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x67b2('0x14'));var utils=require(_0x67b2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x67b2('0x16'));var db=require(_0x67b2('0x17'))['db'];function respondWithStatusCode(_0x492ff6,_0x47cba2){_0x47cba2=_0x47cba2||0xcc;return function(_0x3f1b10){if(_0x3f1b10){return _0x492ff6['sendStatus'](_0x47cba2);}return _0x492ff6[_0x67b2('0x18')](_0x47cba2)[_0x67b2('0x19')]();};}function respondWithResult(_0x2f541e,_0x332553){_0x332553=_0x332553||0xc8;return function(_0x251f0c){if(_0x251f0c){return _0x2f541e['status'](_0x332553)[_0x67b2('0x1a')](_0x251f0c);}};}function respondWithFilteredResult(_0x532e58,_0x3cf7c6){return function(_0x3f8eb2){if(_0x3f8eb2){var _0x133394=typeof _0x3cf7c6[_0x67b2('0x1b')]===_0x67b2('0x1c')&&typeof _0x3cf7c6['limit']===_0x67b2('0x1c');var _0x4ec476=_0x3f8eb2[_0x67b2('0x1d')];var _0x4896aa=_0x133394?0x0:_0x3cf7c6[_0x67b2('0x1b')];var _0x50e983=_0x133394?_0x3f8eb2[_0x67b2('0x1d')]:_0x3cf7c6[_0x67b2('0x1b')]+_0x3cf7c6[_0x67b2('0x1e')];var _0x8bfefb;if(_0x50e983>=_0x4ec476){_0x50e983=_0x4ec476;_0x8bfefb=0xc8;}else{_0x8bfefb=0xce;}_0x532e58[_0x67b2('0x18')](_0x8bfefb);return _0x532e58[_0x67b2('0x1f')](_0x67b2('0x20'),_0x4896aa+'-'+_0x50e983+'/'+_0x4ec476)[_0x67b2('0x1a')](_0x3f8eb2);}return null;};}function patchUpdates(_0x226a84){return function(_0x4382ec){try{jsonpatch[_0x67b2('0x21')](_0x4382ec,_0x226a84,!![]);}catch(_0x49d9a2){return BPromise[_0x67b2('0x22')](_0x49d9a2);}return _0x4382ec[_0x67b2('0x23')]();};}function saveUpdates(_0x1e5307,_0x3cb818){return function(_0x1beeef){if(_0x1beeef){return _0x1beeef[_0x67b2('0x24')](_0x1e5307)[_0x67b2('0x25')](function(_0x959f9f){return _0x959f9f;});}return null;};}function removeEntity(_0x3b4fcd,_0x5038d3){return function(_0x430009){if(_0x430009){return _0x430009[_0x67b2('0x26')]()[_0x67b2('0x25')](function(){_0x3b4fcd[_0x67b2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55dfa6,_0x17415c){return function(_0x4f851c){if(!_0x4f851c){_0x55dfa6[_0x67b2('0x27')](0x194);}return _0x4f851c;};}function handleError(_0x5f5c4f,_0x3d4bd0){_0x3d4bd0=_0x3d4bd0||0x1f4;return function(_0xb4021c){logger[_0x67b2('0x28')](_0xb4021c[_0x67b2('0x29')]);if(_0xb4021c[_0x67b2('0x2a')]){delete _0xb4021c[_0x67b2('0x2a')];}_0x5f5c4f[_0x67b2('0x18')](_0x3d4bd0)['send'](_0xb4021c);};}exports[_0x67b2('0x2b')]=function(_0x23aed3,_0x5c2c65){var _0x84dc7c={},_0x612e6e={},_0x59284e={'count':0x0,'rows':[]};var _0x2cb673=_['map'](db[_0x67b2('0x2c')][_0x67b2('0x2d')],function(_0x183cf2){return{'name':_0x183cf2[_0x67b2('0x2e')],'type':_0x183cf2[_0x67b2('0x2f')][_0x67b2('0x30')]};});_0x612e6e['model']=_[_0x67b2('0x31')](_0x2cb673,'name');_0x612e6e[_0x67b2('0x32')]=_[_0x67b2('0x33')](_0x23aed3[_0x67b2('0x32')]);_0x612e6e[_0x67b2('0x34')]=_[_0x67b2('0x35')](_0x612e6e['model'],_0x612e6e['query']);_0x84dc7c[_0x67b2('0x36')]=_[_0x67b2('0x35')](_0x612e6e[_0x67b2('0x37')],qs[_0x67b2('0x38')](_0x23aed3[_0x67b2('0x32')][_0x67b2('0x38')]));_0x84dc7c[_0x67b2('0x36')]=_0x84dc7c['attributes']['length']?_0x84dc7c[_0x67b2('0x36')]:_0x612e6e[_0x67b2('0x37')];if(!_0x23aed3['query'][_0x67b2('0x39')](_0x67b2('0x3a'))){_0x84dc7c[_0x67b2('0x1e')]=qs[_0x67b2('0x1e')](_0x23aed3['query'][_0x67b2('0x1e')]);_0x84dc7c['offset']=qs['offset'](_0x23aed3['query'][_0x67b2('0x1b')]);}_0x84dc7c[_0x67b2('0x3b')]=qs[_0x67b2('0x3c')](_0x23aed3['query'][_0x67b2('0x3c')]);_0x84dc7c['where']=qs[_0x67b2('0x34')](_[_0x67b2('0x3d')](_0x23aed3[_0x67b2('0x32')],_0x612e6e[_0x67b2('0x34')]),_0x2cb673);if(_0x23aed3[_0x67b2('0x32')][_0x67b2('0x3e')]){_0x84dc7c['where']=_[_0x67b2('0x3f')](_0x84dc7c[_0x67b2('0x40')],{'$or':_[_0x67b2('0x31')](_0x2cb673,function(_0x2f6ddd){if(_0x2f6ddd[_0x67b2('0x2f')]!==_0x67b2('0x41')){var _0x3fdfcc={};_0x3fdfcc[_0x2f6ddd[_0x67b2('0x2a')]]={'$like':'%'+_0x23aed3[_0x67b2('0x32')]['filter']+'%'};return _0x3fdfcc;}})});}_0x84dc7c=_[_0x67b2('0x3f')]({},_0x84dc7c,_0x23aed3[_0x67b2('0x42')]);var _0x467fc4={'where':_0x84dc7c[_0x67b2('0x40')]};return db[_0x67b2('0x2c')]['count'](_0x467fc4)[_0x67b2('0x25')](function(_0x560fd3){_0x59284e[_0x67b2('0x1d')]=_0x560fd3;if(_0x23aed3[_0x67b2('0x32')][_0x67b2('0x43')]){_0x84dc7c['include']=[{'all':!![]}];}return db[_0x67b2('0x2c')]['findAll'](_0x84dc7c);})['then'](function(_0x11a9fa){_0x59284e[_0x67b2('0x44')]=_0x11a9fa;return _0x59284e;})['then'](respondWithFilteredResult(_0x5c2c65,_0x84dc7c))[_0x67b2('0x45')](handleError(_0x5c2c65,null));};exports[_0x67b2('0x46')]=function(_0x2d32c3,_0x369e94){var _0x47d8c8={'raw':![],'where':{'id':_0x2d32c3[_0x67b2('0x47')]['id']}},_0x38d229={};_0x38d229[_0x67b2('0x37')]=_[_0x67b2('0x33')](db[_0x67b2('0x2c')][_0x67b2('0x2d')]);_0x38d229[_0x67b2('0x32')]=_[_0x67b2('0x33')](_0x2d32c3[_0x67b2('0x32')]);_0x38d229['filters']=_['intersection'](_0x38d229[_0x67b2('0x37')],_0x38d229[_0x67b2('0x32')]);_0x47d8c8[_0x67b2('0x36')]=_[_0x67b2('0x35')](_0x38d229[_0x67b2('0x37')],qs[_0x67b2('0x38')](_0x2d32c3[_0x67b2('0x32')][_0x67b2('0x38')]));_0x47d8c8[_0x67b2('0x36')]=_0x47d8c8['attributes']['length']?_0x47d8c8[_0x67b2('0x36')]:_0x38d229['model'];if(_0x2d32c3[_0x67b2('0x32')][_0x67b2('0x43')]){_0x47d8c8[_0x67b2('0x48')]=[{'all':!![]}];}_0x47d8c8=_['merge']({},_0x47d8c8,_0x2d32c3[_0x67b2('0x42')]);return db[_0x67b2('0x2c')][_0x67b2('0x49')](_0x47d8c8)[_0x67b2('0x25')](handleEntityNotFound(_0x369e94,null))[_0x67b2('0x25')](respondWithResult(_0x369e94,null))[_0x67b2('0x45')](handleError(_0x369e94,null));};exports[_0x67b2('0x4a')]=function(_0x43e679,_0x55473f){return db['DeskConfiguration'][_0x67b2('0x4a')](_0x43e679[_0x67b2('0x4b')],{})[_0x67b2('0x25')](respondWithResult(_0x55473f,0xc9))['catch'](handleError(_0x55473f,null));};exports[_0x67b2('0x24')]=function(_0x49385e,_0x578234){if(_0x49385e['body']['id']){delete _0x49385e[_0x67b2('0x4b')]['id'];}return db[_0x67b2('0x2c')][_0x67b2('0x49')]({'where':{'id':_0x49385e[_0x67b2('0x47')]['id']}})[_0x67b2('0x25')](handleEntityNotFound(_0x578234,null))[_0x67b2('0x25')](saveUpdates(_0x49385e['body'],null))[_0x67b2('0x25')](respondWithResult(_0x578234,null))[_0x67b2('0x45')](handleError(_0x578234,null));};exports[_0x67b2('0x26')]=function(_0x3e969b,_0x54cd15){return db[_0x67b2('0x2c')][_0x67b2('0x49')]({'where':{'id':_0x3e969b['params']['id']}})[_0x67b2('0x25')](handleEntityNotFound(_0x54cd15,null))[_0x67b2('0x25')](removeEntity(_0x54cd15,null))[_0x67b2('0x45')](handleError(_0x54cd15,null));};exports['getFields']=function(_0x532095,_0x19039d,_0x254803){var _0x55dbc7={};var _0x3374fa={};var _0x35b47c;var _0x119cc3;return db[_0x67b2('0x2c')][_0x67b2('0x4c')]({'where':{'id':_0x532095['params']['id']}})[_0x67b2('0x25')](handleEntityNotFound(_0x19039d,null))[_0x67b2('0x25')](function(_0x34c412){if(_0x34c412){_0x35b47c=_0x34c412;_0x3374fa[_0x67b2('0x37')]=_[_0x67b2('0x33')](db[_0x67b2('0x4d')]['rawAttributes']);_0x3374fa[_0x67b2('0x32')]=_[_0x67b2('0x33')](_0x532095[_0x67b2('0x32')]);_0x3374fa['filters']=_[_0x67b2('0x35')](_0x3374fa['model'],_0x3374fa[_0x67b2('0x32')]);_0x55dbc7['attributes']=_[_0x67b2('0x35')](_0x3374fa[_0x67b2('0x37')],qs[_0x67b2('0x38')](_0x532095['query'][_0x67b2('0x38')]));_0x55dbc7[_0x67b2('0x36')]=_0x55dbc7[_0x67b2('0x36')]['length']?_0x55dbc7[_0x67b2('0x36')]:_0x3374fa[_0x67b2('0x37')];_0x55dbc7['order']=qs[_0x67b2('0x3c')](_0x532095['query'][_0x67b2('0x3c')]);_0x55dbc7[_0x67b2('0x40')]=qs['filters'](_['pick'](_0x532095[_0x67b2('0x32')],_0x3374fa[_0x67b2('0x34')]));if(_0x532095[_0x67b2('0x32')][_0x67b2('0x3e')]){_0x55dbc7['where']=_[_0x67b2('0x3f')](_0x55dbc7['where'],{'$or':_[_0x67b2('0x31')](_0x55dbc7[_0x67b2('0x36')],function(_0x53b42f){var _0x4371da={};_0x4371da[_0x53b42f]={'$like':'%'+_0x532095[_0x67b2('0x32')][_0x67b2('0x3e')]+'%'};return _0x4371da;})});}_0x55dbc7=_[_0x67b2('0x3f')]({},_0x55dbc7,_0x532095[_0x67b2('0x42')]);return _0x35b47c[_0x67b2('0x4e')](_0x55dbc7);}})[_0x67b2('0x25')](function(_0x111b56){if(_0x111b56){_0x119cc3=_0x111b56[_0x67b2('0x4f')];if(!_0x532095[_0x67b2('0x32')][_0x67b2('0x39')]('nolimit')){_0x55dbc7['limit']=qs[_0x67b2('0x1e')](_0x532095['query']['limit']);_0x55dbc7[_0x67b2('0x1b')]=qs[_0x67b2('0x1b')](_0x532095[_0x67b2('0x32')][_0x67b2('0x1b')]);}return _0x35b47c['getFields'](_0x55dbc7);}})['then'](function(_0x4cd00a){if(_0x4cd00a){return _0x4cd00a?{'count':_0x119cc3,'rows':_0x4cd00a}:null;}})[_0x67b2('0x25')](respondWithResult(_0x19039d,null))[_0x67b2('0x45')](handleError(_0x19039d,null));};exports[_0x67b2('0x50')]=function(_0x4afd70,_0x4f9c25,_0x373f11){var _0x4cd340={};var _0x336e39={};var _0xc7bcf0;var _0x87b708;return db['DeskConfiguration'][_0x67b2('0x4c')]({'where':{'id':_0x4afd70['params']['id']}})[_0x67b2('0x25')](handleEntityNotFound(_0x4f9c25,null))['then'](function(_0x8ada4d){if(_0x8ada4d){_0xc7bcf0=_0x8ada4d;_0x336e39['model']=_[_0x67b2('0x33')](db['DeskField'][_0x67b2('0x2d')]);_0x336e39[_0x67b2('0x32')]=_[_0x67b2('0x33')](_0x4afd70[_0x67b2('0x32')]);_0x336e39[_0x67b2('0x34')]=_[_0x67b2('0x35')](_0x336e39[_0x67b2('0x37')],_0x336e39[_0x67b2('0x32')]);_0x4cd340[_0x67b2('0x36')]=_[_0x67b2('0x35')](_0x336e39['model'],qs[_0x67b2('0x38')](_0x4afd70[_0x67b2('0x32')][_0x67b2('0x38')]));_0x4cd340[_0x67b2('0x36')]=_0x4cd340[_0x67b2('0x36')][_0x67b2('0x4f')]?_0x4cd340[_0x67b2('0x36')]:_0x336e39['model'];_0x4cd340[_0x67b2('0x3b')]=qs[_0x67b2('0x3c')](_0x4afd70[_0x67b2('0x32')]['sort']);_0x4cd340['where']=qs['filters'](_[_0x67b2('0x3d')](_0x4afd70[_0x67b2('0x32')],_0x336e39[_0x67b2('0x34')]));if(_0x4afd70[_0x67b2('0x32')][_0x67b2('0x3e')]){_0x4cd340['where']=_[_0x67b2('0x3f')](_0x4cd340['where'],{'$or':_[_0x67b2('0x31')](_0x4cd340[_0x67b2('0x36')],function(_0x5c10ba){var _0x4a3a59={};_0x4a3a59[_0x5c10ba]={'$like':'%'+_0x4afd70[_0x67b2('0x32')][_0x67b2('0x3e')]+'%'};return _0x4a3a59;})});}_0x4cd340=_[_0x67b2('0x3f')]({},_0x4cd340,_0x4afd70[_0x67b2('0x42')]);return _0xc7bcf0['getSubjects'](_0x4cd340);}})['then'](function(_0x33efaf){if(_0x33efaf){_0x87b708=_0x33efaf[_0x67b2('0x4f')];if(!_0x4afd70[_0x67b2('0x32')][_0x67b2('0x39')](_0x67b2('0x3a'))){_0x4cd340[_0x67b2('0x1e')]=qs[_0x67b2('0x1e')](_0x4afd70[_0x67b2('0x32')]['limit']);_0x4cd340['offset']=qs[_0x67b2('0x1b')](_0x4afd70[_0x67b2('0x32')][_0x67b2('0x1b')]);}return _0xc7bcf0[_0x67b2('0x50')](_0x4cd340);}})[_0x67b2('0x25')](function(_0x739f3d){if(_0x739f3d){return _0x739f3d?{'count':_0x87b708,'rows':_0x739f3d}:null;}})[_0x67b2('0x25')](respondWithResult(_0x4f9c25,null))[_0x67b2('0x45')](handleError(_0x4f9c25,null));};exports[_0x67b2('0x51')]=function(_0x1db0e3,_0x310c9c,_0x30725b){var _0x3449b9={};var _0x43013f={};var _0x3d3058;var _0xd7aa7a;return db['DeskConfiguration'][_0x67b2('0x4c')]({'where':{'id':_0x1db0e3[_0x67b2('0x47')]['id']}})['then'](handleEntityNotFound(_0x310c9c,null))[_0x67b2('0x25')](function(_0x4c3bb7){if(_0x4c3bb7){_0x3d3058=_0x4c3bb7;_0x43013f[_0x67b2('0x37')]=_['keys'](db[_0x67b2('0x4d')][_0x67b2('0x2d')]);_0x43013f[_0x67b2('0x32')]=_[_0x67b2('0x33')](_0x1db0e3['query']);_0x43013f[_0x67b2('0x34')]=_[_0x67b2('0x35')](_0x43013f[_0x67b2('0x37')],_0x43013f[_0x67b2('0x32')]);_0x3449b9[_0x67b2('0x36')]=_[_0x67b2('0x35')](_0x43013f[_0x67b2('0x37')],qs['fields'](_0x1db0e3[_0x67b2('0x32')]['fields']));_0x3449b9[_0x67b2('0x36')]=_0x3449b9[_0x67b2('0x36')][_0x67b2('0x4f')]?_0x3449b9['attributes']:_0x43013f['model'];_0x3449b9[_0x67b2('0x3b')]=qs['sort'](_0x1db0e3[_0x67b2('0x32')][_0x67b2('0x3c')]);_0x3449b9[_0x67b2('0x40')]=qs[_0x67b2('0x34')](_[_0x67b2('0x3d')](_0x1db0e3[_0x67b2('0x32')],_0x43013f[_0x67b2('0x34')]));if(_0x1db0e3['query'][_0x67b2('0x3e')]){_0x3449b9[_0x67b2('0x40')]=_[_0x67b2('0x3f')](_0x3449b9[_0x67b2('0x40')],{'$or':_[_0x67b2('0x31')](_0x3449b9[_0x67b2('0x36')],function(_0x5e3f52){var _0x10d886={};_0x10d886[_0x5e3f52]={'$like':'%'+_0x1db0e3[_0x67b2('0x32')][_0x67b2('0x3e')]+'%'};return _0x10d886;})});}_0x3449b9=_[_0x67b2('0x3f')]({},_0x3449b9,_0x1db0e3[_0x67b2('0x42')]);return _0x3d3058['getDescriptions'](_0x3449b9);}})['then'](function(_0x3d755e){if(_0x3d755e){_0xd7aa7a=_0x3d755e['length'];if(!_0x1db0e3[_0x67b2('0x32')]['hasOwnProperty']('nolimit')){_0x3449b9[_0x67b2('0x1e')]=qs['limit'](_0x1db0e3[_0x67b2('0x32')][_0x67b2('0x1e')]);_0x3449b9[_0x67b2('0x1b')]=qs[_0x67b2('0x1b')](_0x1db0e3[_0x67b2('0x32')][_0x67b2('0x1b')]);}return _0x3d3058[_0x67b2('0x51')](_0x3449b9);}})['then'](function(_0x10fddb){if(_0x10fddb){return _0x10fddb?{'count':_0xd7aa7a,'rows':_0x10fddb}:null;}})[_0x67b2('0x25')](respondWithResult(_0x310c9c,null))[_0x67b2('0x45')](handleError(_0x310c9c,null));};exports['getTags']=function(_0x3e3ac2,_0x576869,_0x418a10){var _0x2726e7={};var _0x202ba0={};var _0x216f77;var _0x46f627;return db[_0x67b2('0x2c')]['findOne']({'where':{'id':_0x3e3ac2['params']['id']}})[_0x67b2('0x25')](handleEntityNotFound(_0x576869,null))[_0x67b2('0x25')](function(_0x1b5b75){if(_0x1b5b75){_0x216f77=_0x1b5b75;_0x202ba0[_0x67b2('0x37')]=_[_0x67b2('0x33')](db[_0x67b2('0x52')][_0x67b2('0x2d')]);_0x202ba0[_0x67b2('0x32')]=_[_0x67b2('0x33')](_0x3e3ac2[_0x67b2('0x32')]);_0x202ba0[_0x67b2('0x34')]=_[_0x67b2('0x35')](_0x202ba0['model'],_0x202ba0['query']);_0x2726e7[_0x67b2('0x36')]=_['intersection'](_0x202ba0[_0x67b2('0x37')],qs[_0x67b2('0x38')](_0x3e3ac2[_0x67b2('0x32')][_0x67b2('0x38')]));_0x2726e7[_0x67b2('0x36')]=_0x2726e7[_0x67b2('0x36')][_0x67b2('0x4f')]?_0x2726e7[_0x67b2('0x36')]:_0x202ba0[_0x67b2('0x37')];_0x2726e7[_0x67b2('0x3b')]=qs[_0x67b2('0x3c')](_0x3e3ac2['query'][_0x67b2('0x3c')]);_0x2726e7['where']=qs[_0x67b2('0x34')](_['pick'](_0x3e3ac2[_0x67b2('0x32')],_0x202ba0[_0x67b2('0x34')]));if(_0x3e3ac2[_0x67b2('0x32')][_0x67b2('0x3e')]){_0x2726e7[_0x67b2('0x40')]=_[_0x67b2('0x3f')](_0x2726e7['where'],{'$or':_[_0x67b2('0x31')](_0x2726e7[_0x67b2('0x36')],function(_0x584302){var _0x4e6303={};_0x4e6303[_0x584302]={'$like':'%'+_0x3e3ac2['query']['filter']+'%'};return _0x4e6303;})});}_0x2726e7=_[_0x67b2('0x3f')]({},_0x2726e7,_0x3e3ac2[_0x67b2('0x42')]);return _0x216f77[_0x67b2('0x53')](_0x2726e7);}})[_0x67b2('0x25')](function(_0x3e606d){if(_0x3e606d){_0x46f627=_0x3e606d['length'];if(!_0x3e3ac2['query'][_0x67b2('0x39')]('nolimit')){_0x2726e7[_0x67b2('0x1e')]=qs[_0x67b2('0x1e')](_0x3e3ac2[_0x67b2('0x32')][_0x67b2('0x1e')]);_0x2726e7['offset']=qs[_0x67b2('0x1b')](_0x3e3ac2[_0x67b2('0x32')][_0x67b2('0x1b')]);}return _0x216f77[_0x67b2('0x53')](_0x2726e7);}})[_0x67b2('0x25')](function(_0x2a189f){if(_0x2a189f){return _0x2a189f?{'count':_0x46f627,'rows':_0x2a189f}:null;}})['then'](respondWithResult(_0x576869,null))[_0x67b2('0x45')](handleError(_0x576869,null));};exports[_0x67b2('0x54')]=function(_0x316281,_0x51c690,_0x47b906){if(_0x316281[_0x67b2('0x4b')]['id']){delete _0x316281['body']['id'];}return db[_0x67b2('0x2c')][_0x67b2('0x4c')]({'where':{'id':_0x316281[_0x67b2('0x47')]['id']}})[_0x67b2('0x25')](handleEntityNotFound(_0x51c690,null))[_0x67b2('0x25')](function(_0x4ae78a){if(_0x4ae78a){return _0x4ae78a[_0x67b2('0x54')](_0x316281['body'][_0x67b2('0x55')]||[]);}return null;})[_0x67b2('0x25')](respondWithResult(_0x51c690,null))[_0x67b2('0x45')](handleError(_0x51c690,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 885c717..bba1b7a 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 _0x5e24=['define','int_desk_configurations','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5e24,0xb2));var _0x45e2=function(_0x1906f4,_0x530f6a){_0x1906f4=_0x1906f4-0x0;var _0x58e1de=_0x5e24[_0x1906f4];return _0x58e1de;};'use strict';var _=require('lodash');var util=require(_0x45e2('0x0'));var logger=require('../../config/logger')(_0x45e2('0x1'));var moment=require('moment');var BPromise=require(_0x45e2('0x2'));var rp=require(_0x45e2('0x3'));var fs=require('fs');var path=require(_0x45e2('0x4'));var rimraf=require(_0x45e2('0x5'));var config=require(_0x45e2('0x6'));var attributes=require(_0x45e2('0x7'));module[_0x45e2('0x8')]=function(_0x2bb7a9,_0x422f9e){return _0x2bb7a9[_0x45e2('0x9')]('DeskConfiguration',attributes,{'tableName':_0x45e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc400=['int_desk_configurations','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration'];(function(_0x40cacf,_0x10ad06){var _0x436437=function(_0x32ae0a){while(--_0x32ae0a){_0x40cacf['push'](_0x40cacf['shift']());}};_0x436437(++_0x10ad06);}(_0xc400,0x105));var _0x0c40=function(_0x128aa0,_0x3e5df8){_0x128aa0=_0x128aa0-0x0;var _0x197ddc=_0xc400[_0x128aa0];return _0x197ddc;};'use strict';var _=require(_0x0c40('0x0'));var util=require('util');var logger=require(_0x0c40('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0c40('0x2'));var rp=require(_0x0c40('0x3'));var fs=require('fs');var path=require(_0x0c40('0x4'));var rimraf=require(_0x0c40('0x5'));var config=require(_0x0c40('0x6'));var attributes=require(_0x0c40('0x7'));module['exports']=function(_0x3497eb,_0x5d898a){return _0x3497eb['define'](_0x0c40('0x8'),attributes,{'tableName':_0x0c40('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index b4be556..8d8e6f5 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 _0xe1e8=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','result'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0xe1e8,0x1cb));var _0x8e1e=function(_0x265c85,_0x27d83d){_0x265c85=_0x265c85-0x0;var _0x445ac2=_0xe1e8[_0x265c85];return _0x445ac2;};'use strict';var _=require(_0x8e1e('0x0'));var util=require('util');var moment=require(_0x8e1e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e1e('0x2'));var db=require(_0x8e1e('0x3'))['db'];var utils=require(_0x8e1e('0x4'));var logger=require(_0x8e1e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8e1e('0x6'));var client=jayson[_0x8e1e('0x7')][_0x8e1e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1861ce,_0x4eb2b7,_0x21ee75){return new BPromise(function(_0xe8a658,_0x3a1ead){return client['request'](_0x1861ce,_0x21ee75)['then'](function(_0x4007f3){logger[_0x8e1e('0x9')]('DeskConfiguration,\x20%s,\x20%s',_0x4eb2b7,_0x8e1e('0xa'));logger['debug'](_0x8e1e('0xb'),_0x4eb2b7,_0x8e1e('0xa'),JSON[_0x8e1e('0xc')](_0x4007f3));if(_0x4007f3[_0x8e1e('0xd')]){if(_0x4007f3[_0x8e1e('0xd')]['code']===0x1f4){logger[_0x8e1e('0xd')](_0x8e1e('0xe'),_0x4eb2b7,_0x4007f3[_0x8e1e('0xd')]['message']);return _0x3a1ead(_0x4007f3[_0x8e1e('0xd')][_0x8e1e('0xf')]);}logger[_0x8e1e('0xd')](_0x8e1e('0xe'),_0x4eb2b7,_0x4007f3['error']['message']);return _0xe8a658(_0x4007f3['error'][_0x8e1e('0xf')]);}else{logger[_0x8e1e('0x9')](_0x8e1e('0xe'),_0x4eb2b7,_0x8e1e('0xa'));_0xe8a658(_0x4007f3[_0x8e1e('0x10')]['message']);}})['catch'](function(_0x2d2dc2){logger[_0x8e1e('0xd')](_0x8e1e('0xe'),_0x4eb2b7,_0x2d2dc2);_0x3a1ead(_0x2d2dc2);});});} \ No newline at end of file +var _0x969e=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','then'];(function(_0xc6b104,_0x1d805a){var _0x1c6fce=function(_0x1bfb3f){while(--_0x1bfb3f){_0xc6b104['push'](_0xc6b104['shift']());}};_0x1c6fce(++_0x1d805a);}(_0x969e,0x136));var _0xe969=function(_0x439109,_0x368911){_0x439109=_0x439109-0x0;var _0x68e6c3=_0x969e[_0x439109];return _0x68e6c3;};'use strict';var _=require(_0xe969('0x0'));var util=require(_0xe969('0x1'));var moment=require('moment');var BPromise=require(_0xe969('0x2'));var rs=require(_0xe969('0x3'));var fs=require('fs');var Redis=require(_0xe969('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe969('0x5'));var config=require(_0xe969('0x6'));var jayson=require(_0xe969('0x7'));var client=jayson[_0xe969('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x340384,_0x18f8af,_0x2118e2){return new BPromise(function(_0x56b962,_0x4084aa){return client['request'](_0x340384,_0x2118e2)[_0xe969('0x9')](function(_0x2d37e0){logger['info'](_0xe969('0xa'),_0x18f8af,_0xe969('0xb'));logger[_0xe969('0xc')](_0xe969('0xd'),_0x18f8af,_0xe969('0xb'),JSON['stringify'](_0x2d37e0));if(_0x2d37e0[_0xe969('0xe')]){if(_0x2d37e0[_0xe969('0xe')][_0xe969('0xf')]===0x1f4){logger[_0xe969('0xe')](_0xe969('0xa'),_0x18f8af,_0x2d37e0[_0xe969('0xe')]['message']);return _0x4084aa(_0x2d37e0[_0xe969('0xe')]['message']);}logger['error'](_0xe969('0xa'),_0x18f8af,_0x2d37e0[_0xe969('0xe')][_0xe969('0x10')]);return _0x56b962(_0x2d37e0[_0xe969('0xe')]['message']);}else{logger[_0xe969('0x11')](_0xe969('0xa'),_0x18f8af,_0xe969('0xb'));_0x56b962(_0x2d37e0[_0xe969('0x12')][_0xe969('0x10')]);}})[_0xe969('0x13')](function(_0x4c3756){logger['error'](_0xe969('0xa'),_0x18f8af,_0x4c3756);_0x4084aa(_0x4c3756);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 041aeea..ec82244 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 _0xf524=['post','create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated'];(function(_0x304ae0,_0x4e6cbc){var _0x28a93c=function(_0x389350){while(--_0x389350){_0x304ae0['push'](_0x304ae0['shift']());}};_0x28a93c(++_0x4e6cbc);}(_0xf524,0x16b));var _0x4f52=function(_0x4b62db,_0x1b18d3){_0x4b62db=_0x4b62db-0x0;var _0x2935a0=_0xf524[_0x4b62db];return _0x2935a0;};'use strict';var multer=require('multer');var util=require(_0x4f52('0x0'));var path=require(_0x4f52('0x1'));var timeout=require(_0x4f52('0x2'));var express=require('express');var router=express[_0x4f52('0x3')]();var fs_extra=require(_0x4f52('0x4'));var auth=require(_0x4f52('0x5'));var interaction=require(_0x4f52('0x6'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4f52('0x7')]);router[_0x4f52('0x8')](_0x4f52('0x9'),auth[_0x4f52('0xa')](),controller['show']);router[_0x4f52('0xb')]('/',auth[_0x4f52('0xa')](),controller[_0x4f52('0xc')]);router[_0x4f52('0xd')]('/:id',auth[_0x4f52('0xa')](),controller[_0x4f52('0xe')]);router['delete'](_0x4f52('0x9'),auth[_0x4f52('0xa')](),controller[_0x4f52('0xf')]);module[_0x4f52('0x10')]=router; \ No newline at end of file +var _0x5eda=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5eda,0x1af));var _0xa5ed=function(_0x5eebd8,_0x5e6bdb){_0x5eebd8=_0x5eebd8-0x0;var _0x22d502=_0x5eda[_0x5eebd8];return _0x22d502;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa5ed('0x0'));var timeout=require(_0xa5ed('0x1'));var express=require(_0xa5ed('0x2'));var router=express[_0xa5ed('0x3')]();var fs_extra=require(_0xa5ed('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa5ed('0x5'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0xa5ed('0x6')]('/',auth[_0xa5ed('0x7')](),controller[_0xa5ed('0x8')]);router['get'](_0xa5ed('0x9'),auth[_0xa5ed('0x7')](),controller[_0xa5ed('0xa')]);router['post']('/',auth[_0xa5ed('0x7')](),controller['create']);router[_0xa5ed('0xb')](_0xa5ed('0x9'),auth[_0xa5ed('0x7')](),controller[_0xa5ed('0xc')]);router[_0xa5ed('0xd')](_0xa5ed('0x9'),auth[_0xa5ed('0x7')](),controller['destroy']);module[_0xa5ed('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 5fe2c9e..e3acdda 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 _0xd34b=['variable','BOOLEAN','sequelize','string','customVariable','picklist','STRING','ENUM'];(function(_0x3fc017,_0x288faf){var _0x542e8c=function(_0x42438c){while(--_0x42438c){_0x3fc017['push'](_0x3fc017['shift']());}};_0x542e8c(++_0x288faf);}(_0xd34b,0x142));var _0xbd34=function(_0x2993ee,_0x3d6444){_0x2993ee=_0x2993ee-0x0;var _0xcb14c1=_0xd34b[_0x2993ee];return _0xcb14c1;};'use strict';var Sequelize=require(_0xbd34('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xbd34('0x1'),'variable',_0xbd34('0x2'),'keyValue',_0xbd34('0x3')),'defaultValue':_0xbd34('0x1')},'content':{'type':Sequelize[_0xbd34('0x4')]},'key':{'type':Sequelize[_0xbd34('0x4')]},'keyType':{'type':Sequelize[_0xbd34('0x5')](_0xbd34('0x1'),_0xbd34('0x6'),_0xbd34('0x2'))},'keyContent':{'type':Sequelize[_0xbd34('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbd34('0x4')]},'customField':{'type':Sequelize[_0xbd34('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd34('0x4')]}}; \ No newline at end of file +var _0x60fd=['customVariable','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x17eec6,_0x54a955){var _0x1e4d32=function(_0x3d2e36){while(--_0x3d2e36){_0x17eec6['push'](_0x17eec6['shift']());}};_0x1e4d32(++_0x54a955);}(_0x60fd,0x1b5));var _0xd60f=function(_0x1017a9,_0x1e2565){_0x1017a9=_0x1017a9-0x0;var _0x57d735=_0x60fd[_0x1017a9];return _0x57d735;};'use strict';var Sequelize=require(_0xd60f('0x0'));module[_0xd60f('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd60f('0x2'),'variable',_0xd60f('0x3'),'keyValue',_0xd60f('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd60f('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd60f('0x6')](_0xd60f('0x2'),'variable',_0xd60f('0x3'))},'keyContent':{'type':Sequelize[_0xd60f('0x5')]},'idField':{'type':Sequelize[_0xd60f('0x5')]},'nameField':{'type':Sequelize[_0xd60f('0x5')]},'customField':{'type':Sequelize[_0xd60f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd60f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index fb83ce3..b8a9dcf 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 _0x1228=['end','json','undefined','count','limit','reject','save','update','then','destroy','error','stack','name','send','index','DeskField','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','offset','sort','pick','filter','where','merge','type','options','includeAll','rows','catch','params','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1228,0x12f));var _0x8122=function(_0x62ae03,_0xe5a1d2){_0x62ae03=_0x62ae03-0x0;var _0x335278=_0x1228[_0x62ae03];return _0x335278;};'use strict';var emlformat=require(_0x8122('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8122('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8122('0x2'));var moment=require(_0x8122('0x3'));var BPromise=require(_0x8122('0x4'));var Mustache=require('mustache');var util=require(_0x8122('0x5'));var path=require(_0x8122('0x6'));var sox=require('sox');var csv=require(_0x8122('0x7'));var ejs=require(_0x8122('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8122('0x9'));var squel=require(_0x8122('0xa'));var crypto=require('crypto');var jsforce=require(_0x8122('0xb'));var deskjs=require(_0x8122('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8122('0xd'));var Papa=require(_0x8122('0xe'));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(_0x8122('0xf'));var logger=require('../../config/logger')(_0x8122('0x10'));var utils=require(_0x8122('0x11'));var config=require(_0x8122('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8122('0x13'))['db'];function respondWithStatusCode(_0x565f6e,_0x162ed4){_0x162ed4=_0x162ed4||0xcc;return function(_0x1ca828){if(_0x1ca828){return _0x565f6e[_0x8122('0x14')](_0x162ed4);}return _0x565f6e[_0x8122('0x15')](_0x162ed4)[_0x8122('0x16')]();};}function respondWithResult(_0x266feb,_0x1fa431){_0x1fa431=_0x1fa431||0xc8;return function(_0x1be8e2){if(_0x1be8e2){return _0x266feb[_0x8122('0x15')](_0x1fa431)[_0x8122('0x17')](_0x1be8e2);}};}function respondWithFilteredResult(_0xfa15a2,_0x6baf37){return function(_0x559256){if(_0x559256){var _0x3ed5d1=typeof _0x6baf37['offset']===_0x8122('0x18')&&typeof _0x6baf37['limit']===_0x8122('0x18');var _0x2acf8f=_0x559256[_0x8122('0x19')];var _0x4bfb9e=_0x3ed5d1?0x0:_0x6baf37['offset'];var _0x4f7277=_0x3ed5d1?_0x559256['count']:_0x6baf37['offset']+_0x6baf37[_0x8122('0x1a')];var _0x2511e9;if(_0x4f7277>=_0x2acf8f){_0x4f7277=_0x2acf8f;_0x2511e9=0xc8;}else{_0x2511e9=0xce;}_0xfa15a2[_0x8122('0x15')](_0x2511e9);return _0xfa15a2['set']('Content-Range',_0x4bfb9e+'-'+_0x4f7277+'/'+_0x2acf8f)[_0x8122('0x17')](_0x559256);}return null;};}function patchUpdates(_0x174321){return function(_0x68761a){try{jsonpatch['apply'](_0x68761a,_0x174321,!![]);}catch(_0x15e635){return BPromise[_0x8122('0x1b')](_0x15e635);}return _0x68761a[_0x8122('0x1c')]();};}function saveUpdates(_0x988c0c,_0x3c6226){return function(_0x130e1b){if(_0x130e1b){return _0x130e1b[_0x8122('0x1d')](_0x988c0c)[_0x8122('0x1e')](function(_0x4fc6af){return _0x4fc6af;});}return null;};}function removeEntity(_0x34c185,_0x5cfa77){return function(_0x732946){if(_0x732946){return _0x732946[_0x8122('0x1f')]()[_0x8122('0x1e')](function(){_0x34c185[_0x8122('0x15')](0xcc)[_0x8122('0x16')]();});}};}function handleEntityNotFound(_0x240a6d,_0x40e945){return function(_0x2708a5){if(!_0x2708a5){_0x240a6d[_0x8122('0x14')](0x194);}return _0x2708a5;};}function handleError(_0x4e67ab,_0x1258d7){_0x1258d7=_0x1258d7||0x1f4;return function(_0xa79602){logger[_0x8122('0x20')](_0xa79602[_0x8122('0x21')]);if(_0xa79602[_0x8122('0x22')]){delete _0xa79602[_0x8122('0x22')];}_0x4e67ab[_0x8122('0x15')](_0x1258d7)[_0x8122('0x23')](_0xa79602);};}exports[_0x8122('0x24')]=function(_0x4610b1,_0x4c70f4){var _0x49531a={},_0x2a0b63={},_0x264ccf={'count':0x0,'rows':[]};var _0x5263ca=_['map'](db[_0x8122('0x25')][_0x8122('0x26')],function(_0x367ada){return{'name':_0x367ada['fieldName'],'type':_0x367ada['type'][_0x8122('0x27')]};});_0x2a0b63[_0x8122('0x28')]=_[_0x8122('0x29')](_0x5263ca,_0x8122('0x22'));_0x2a0b63[_0x8122('0x2a')]=_[_0x8122('0x2b')](_0x4610b1[_0x8122('0x2a')]);_0x2a0b63[_0x8122('0x2c')]=_[_0x8122('0x2d')](_0x2a0b63[_0x8122('0x28')],_0x2a0b63['query']);_0x49531a[_0x8122('0x2e')]=_[_0x8122('0x2d')](_0x2a0b63[_0x8122('0x28')],qs[_0x8122('0x2f')](_0x4610b1[_0x8122('0x2a')][_0x8122('0x2f')]));_0x49531a[_0x8122('0x2e')]=_0x49531a[_0x8122('0x2e')]['length']?_0x49531a['attributes']:_0x2a0b63[_0x8122('0x28')];if(!_0x4610b1['query']['hasOwnProperty'](_0x8122('0x30'))){_0x49531a['limit']=qs['limit'](_0x4610b1[_0x8122('0x2a')][_0x8122('0x1a')]);_0x49531a['offset']=qs[_0x8122('0x31')](_0x4610b1['query'][_0x8122('0x31')]);}_0x49531a['order']=qs[_0x8122('0x32')](_0x4610b1[_0x8122('0x2a')]['sort']);_0x49531a['where']=qs['filters'](_[_0x8122('0x33')](_0x4610b1[_0x8122('0x2a')],_0x2a0b63['filters']),_0x5263ca);if(_0x4610b1[_0x8122('0x2a')][_0x8122('0x34')]){_0x49531a[_0x8122('0x35')]=_[_0x8122('0x36')](_0x49531a['where'],{'$or':_[_0x8122('0x29')](_0x5263ca,function(_0x1a1510){if(_0x1a1510[_0x8122('0x37')]!=='VIRTUAL'){var _0x3805ec={};_0x3805ec[_0x1a1510['name']]={'$like':'%'+_0x4610b1[_0x8122('0x2a')]['filter']+'%'};return _0x3805ec;}})});}_0x49531a=_[_0x8122('0x36')]({},_0x49531a,_0x4610b1[_0x8122('0x38')]);var _0x1e6c01={'where':_0x49531a[_0x8122('0x35')]};return db['DeskField'][_0x8122('0x19')](_0x1e6c01)[_0x8122('0x1e')](function(_0x565829){_0x264ccf[_0x8122('0x19')]=_0x565829;if(_0x4610b1[_0x8122('0x2a')][_0x8122('0x39')]){_0x49531a['include']=[{'all':!![]}];}return db[_0x8122('0x25')]['findAll'](_0x49531a);})[_0x8122('0x1e')](function(_0x3258e8){_0x264ccf[_0x8122('0x3a')]=_0x3258e8;return _0x264ccf;})[_0x8122('0x1e')](respondWithFilteredResult(_0x4c70f4,_0x49531a))[_0x8122('0x3b')](handleError(_0x4c70f4,null));};exports['show']=function(_0xbad19,_0x16ab8c){var _0x5bceb1={'raw':!![],'where':{'id':_0xbad19[_0x8122('0x3c')]['id']}},_0x3dbd77={};_0x3dbd77[_0x8122('0x28')]=_[_0x8122('0x2b')](db[_0x8122('0x25')][_0x8122('0x26')]);_0x3dbd77[_0x8122('0x2a')]=_['keys'](_0xbad19[_0x8122('0x2a')]);_0x3dbd77[_0x8122('0x2c')]=_[_0x8122('0x2d')](_0x3dbd77['model'],_0x3dbd77[_0x8122('0x2a')]);_0x5bceb1[_0x8122('0x2e')]=_[_0x8122('0x2d')](_0x3dbd77['model'],qs['fields'](_0xbad19[_0x8122('0x2a')]['fields']));_0x5bceb1['attributes']=_0x5bceb1[_0x8122('0x2e')][_0x8122('0x3d')]?_0x5bceb1[_0x8122('0x2e')]:_0x3dbd77['model'];if(_0xbad19[_0x8122('0x2a')][_0x8122('0x39')]){_0x5bceb1['include']=[{'all':!![]}];}_0x5bceb1=_[_0x8122('0x36')]({},_0x5bceb1,_0xbad19[_0x8122('0x38')]);return db[_0x8122('0x25')][_0x8122('0x3e')](_0x5bceb1)['then'](handleEntityNotFound(_0x16ab8c,null))[_0x8122('0x1e')](respondWithResult(_0x16ab8c,null))['catch'](handleError(_0x16ab8c,null));};exports[_0x8122('0x3f')]=function(_0x21860f,_0x5e6093){return db[_0x8122('0x25')][_0x8122('0x3f')](_0x21860f['body'],{})[_0x8122('0x1e')](respondWithResult(_0x5e6093,0xc9))[_0x8122('0x3b')](handleError(_0x5e6093,null));};exports[_0x8122('0x1d')]=function(_0x8c7e4f,_0x1d9ccf){if(_0x8c7e4f[_0x8122('0x40')]['id']){delete _0x8c7e4f[_0x8122('0x40')]['id'];}return db['DeskField'][_0x8122('0x3e')]({'where':{'id':_0x8c7e4f[_0x8122('0x3c')]['id']}})[_0x8122('0x1e')](handleEntityNotFound(_0x1d9ccf,null))[_0x8122('0x1e')](saveUpdates(_0x8c7e4f['body'],null))[_0x8122('0x1e')](respondWithResult(_0x1d9ccf,null))[_0x8122('0x3b')](handleError(_0x1d9ccf,null));};exports[_0x8122('0x1f')]=function(_0x4bac94,_0x3618cb){return db[_0x8122('0x25')][_0x8122('0x3e')]({'where':{'id':_0x4bac94[_0x8122('0x3c')]['id']}})[_0x8122('0x1e')](handleEntityNotFound(_0x3618cb,null))['then'](removeEntity(_0x3618cb,null))[_0x8122('0x3b')](handleError(_0x3618cb,null));}; \ No newline at end of file +var _0x01d9=['map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index'];(function(_0x308e50,_0x165743){var _0x5cb05d=function(_0x4e28a5){while(--_0x4e28a5){_0x308e50['push'](_0x308e50['shift']());}};_0x5cb05d(++_0x165743);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':!![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['DeskField'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['DeskField'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e28cc75..a403c4c 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 _0x99b3=['moment','bluebird','request-promise','rimraf','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','FieldId','util','api'];(function(_0x53c96,_0x1e1e11){var _0x3a22d2=function(_0x24613b){while(--_0x24613b){_0x53c96['push'](_0x53c96['shift']());}};_0x3a22d2(++_0x1e1e11);}(_0x99b3,0x6a));var _0x399b=function(_0x3acccc,_0x3a7a65){_0x3acccc=_0x3acccc-0x0;var _0x1649fe=_0x99b3[_0x3acccc];return _0x1649fe;};'use strict';var _=require('lodash');var util=require(_0x399b('0x0'));var logger=require('../../config/logger')(_0x399b('0x1'));var moment=require(_0x399b('0x2'));var BPromise=require(_0x399b('0x3'));var rp=require(_0x399b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x399b('0x5'));var config=require('../../config/environment');var attributes=require(_0x399b('0x6'));module[_0x399b('0x7')]=function(_0x41a199,_0x5384fc){return _0x41a199[_0x399b('0x8')]('DeskField',attributes,{'tableName':_0x399b('0x9'),'paranoid':![],'indexes':[{'name':_0x399b('0xa'),'fields':['idField',_0x399b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa934=['path','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','idField','FieldId','util','../../config/logger','moment','request-promise'];(function(_0x13eec6,_0x170127){var _0x585c24=function(_0x3052df){while(--_0x3052df){_0x13eec6['push'](_0x13eec6['shift']());}};_0x585c24(++_0x170127);}(_0xa934,0x14e));var _0x4a93=function(_0x2b9408,_0x5ec12e){_0x2b9408=_0x2b9408-0x0;var _0x2bd05e=_0xa934[_0x2b9408];return _0x2bd05e;};'use strict';var _=require('lodash');var util=require(_0x4a93('0x0'));var logger=require(_0x4a93('0x1'))('api');var moment=require(_0x4a93('0x2'));var BPromise=require('bluebird');var rp=require(_0x4a93('0x3'));var fs=require('fs');var path=require(_0x4a93('0x4'));var rimraf=require(_0x4a93('0x5'));var config=require('../../config/environment');var attributes=require(_0x4a93('0x6'));module[_0x4a93('0x7')]=function(_0x2875a7,_0x4f71e7){return _0x2875a7[_0x4a93('0x8')](_0x4a93('0x9'),attributes,{'tableName':_0x4a93('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x4a93('0xb'),_0x4a93('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 fc3ee3f..e336b0a 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 _0xa18d=['then','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x409dfa,_0x3a16a5){var _0x36ec21=function(_0x4d00d4){while(--_0x4d00d4){_0x409dfa['push'](_0x409dfa['shift']());}};_0x36ec21(++_0x3a16a5);}(_0xa18d,0x13c));var _0xda18=function(_0x3f7b88,_0x3c3e4d){_0x3f7b88=_0x3f7b88-0x0;var _0x102008=_0xa18d[_0x3f7b88];return _0x102008;};'use strict';var _=require(_0xda18('0x0'));var util=require(_0xda18('0x1'));var moment=require(_0xda18('0x2'));var BPromise=require(_0xda18('0x3'));var rs=require(_0xda18('0x4'));var fs=require('fs');var Redis=require(_0xda18('0x5'));var db=require(_0xda18('0x6'))['db'];var utils=require(_0xda18('0x7'));var logger=require(_0xda18('0x8'))(_0xda18('0x9'));var config=require(_0xda18('0xa'));var jayson=require(_0xda18('0xb'));var client=jayson[_0xda18('0xc')][_0xda18('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4651c0,_0x8439e6,_0x43e445){return new BPromise(function(_0x4ec1b8,_0xb09885){return client['request'](_0x4651c0,_0x43e445)[_0xda18('0xe')](function(_0x227382){logger['info'](_0xda18('0xf'),_0x8439e6,'request\x20sent');logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x8439e6,_0xda18('0x10'),JSON[_0xda18('0x11')](_0x227382));if(_0x227382[_0xda18('0x12')]){if(_0x227382[_0xda18('0x12')][_0xda18('0x13')]===0x1f4){logger[_0xda18('0x12')](_0xda18('0xf'),_0x8439e6,_0x227382[_0xda18('0x12')][_0xda18('0x14')]);return _0xb09885(_0x227382['error'][_0xda18('0x14')]);}logger[_0xda18('0x12')](_0xda18('0xf'),_0x8439e6,_0x227382[_0xda18('0x12')][_0xda18('0x14')]);return _0x4ec1b8(_0x227382[_0xda18('0x12')]['message']);}else{logger['info'](_0xda18('0xf'),_0x8439e6,'request\x20sent');_0x4ec1b8(_0x227382[_0xda18('0x15')][_0xda18('0x14')]);}})['catch'](function(_0x25302d){logger['error'](_0xda18('0xf'),_0x8439e6,_0x25302d);_0xb09885(_0x25302d);});});} \ No newline at end of file +var _0x3297=['request','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x3297,0x1ea));var _0x7329=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x3297[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x7329('0x0'));var util=require('util');var moment=require(_0x7329('0x1'));var BPromise=require(_0x7329('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7329('0x3'))['db'];var utils=require(_0x7329('0x4'));var logger=require(_0x7329('0x5'))(_0x7329('0x6'));var config=require('../../config/environment');var jayson=require(_0x7329('0x7'));var client=jayson[_0x7329('0x8')][_0x7329('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xeb66e3,_0x54b16c,_0x2ebad5){return new BPromise(function(_0x29573b,_0x35717a){return client[_0x7329('0xa')](_0xeb66e3,_0x2ebad5)['then'](function(_0x360c54){logger[_0x7329('0xb')](_0x7329('0xc'),_0x54b16c,_0x7329('0xd'));logger['debug'](_0x7329('0xe'),_0x54b16c,_0x7329('0xd'),JSON[_0x7329('0xf')](_0x360c54));if(_0x360c54['error']){if(_0x360c54['error'][_0x7329('0x10')]===0x1f4){logger[_0x7329('0x11')]('DeskField,\x20%s,\x20%s',_0x54b16c,_0x360c54[_0x7329('0x11')][_0x7329('0x12')]);return _0x35717a(_0x360c54[_0x7329('0x11')][_0x7329('0x12')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x54b16c,_0x360c54['error'][_0x7329('0x12')]);return _0x29573b(_0x360c54[_0x7329('0x11')][_0x7329('0x12')]);}else{logger[_0x7329('0xb')]('DeskField,\x20%s,\x20%s',_0x54b16c,_0x7329('0xd'));_0x29573b(_0x360c54['result'][_0x7329('0x12')]);}})[_0x7329('0x13')](function(_0x32f53d){logger[_0x7329('0x11')](_0x7329('0xc'),_0x54b16c,_0x32f53d);_0x35717a(_0x32f53d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 5192bb7..91bfe0d 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 _0x34da=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0x34da,0x113));var _0xa34d=function(_0x1cfa90,_0x59603a){_0x1cfa90=_0x1cfa90-0x0;var _0x12b21f=_0x34da[_0x1cfa90];return _0x12b21f;};'use strict';var multer=require(_0xa34d('0x0'));var util=require(_0xa34d('0x1'));var path=require(_0xa34d('0x2'));var timeout=require(_0xa34d('0x3'));var express=require('express');var router=express[_0xa34d('0x4')]();var fs_extra=require(_0xa34d('0x5'));var auth=require(_0xa34d('0x6'));var interaction=require(_0xa34d('0x7'));var config=require('../../config/environment');var controller=require(_0xa34d('0x8'));router[_0xa34d('0x9')]('/',auth['isAuthenticated'](),controller[_0xa34d('0xa')]);router[_0xa34d('0x9')](_0xa34d('0xb'),auth[_0xa34d('0xc')](),controller[_0xa34d('0xd')]);router['get'](_0xa34d('0xe'),auth[_0xa34d('0xc')](),controller[_0xa34d('0xf')]);router[_0xa34d('0x9')](_0xa34d('0x10'),auth['isAuthenticated'](),controller[_0xa34d('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa34d('0x12')]);router[_0xa34d('0x13')](_0xa34d('0xe'),auth[_0xa34d('0xc')](),controller[_0xa34d('0x14')]);router[_0xa34d('0x15')]('/:id',auth[_0xa34d('0xc')](),controller[_0xa34d('0x16')]);router[_0xa34d('0x17')]('/:id',auth[_0xa34d('0xc')](),controller[_0xa34d('0x18')]);module[_0xa34d('0x19')]=router; \ No newline at end of file +var _0x1724=['../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','create','post','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x42cdf6,_0x2e53cc){var _0x1ee011=function(_0x1cff47){while(--_0x1cff47){_0x42cdf6['push'](_0x42cdf6['shift']());}};_0x1ee011(++_0x2e53cc);}(_0x1724,0x1f1));var _0x4172=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1724[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x4172('0x0'));var util=require('util');var path=require(_0x4172('0x1'));var timeout=require(_0x4172('0x2'));var express=require(_0x4172('0x3'));var router=express[_0x4172('0x4')]();var fs_extra=require(_0x4172('0x5'));var auth=require(_0x4172('0x6'));var interaction=require(_0x4172('0x7'));var config=require(_0x4172('0x8'));var controller=require(_0x4172('0x9'));router[_0x4172('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4172('0xa')]('/:id',auth[_0x4172('0xb')](),controller[_0x4172('0xc')]);router[_0x4172('0xa')](_0x4172('0xd'),auth[_0x4172('0xb')](),controller[_0x4172('0xe')]);router[_0x4172('0xa')]('/:id/fields',auth[_0x4172('0xb')](),controller[_0x4172('0xf')]);router['post']('/',auth[_0x4172('0xb')](),controller[_0x4172('0x10')]);router[_0x4172('0x11')](_0x4172('0xd'),auth[_0x4172('0xb')](),controller['addConfiguration']);router[_0x4172('0x12')]('/:id',auth[_0x4172('0xb')](),controller[_0x4172('0x13')]);router[_0x4172('0x14')](_0x4172('0x15'),auth[_0x4172('0xb')](),controller[_0x4172('0x16')]);module[_0x4172('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 45134f5..edcaa67 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 _0x0c23=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0c23,0x13e));var _0x30c2=function(_0x40a2b1,_0x36a0a0){_0x40a2b1=_0x40a2b1-0x0;var _0x5f520c=_0x0c23[_0x40a2b1];return _0x5f520c;};'use strict';var Sequelize=require(_0x30c2('0x0'));module[_0x30c2('0x1')]={'name':{'type':Sequelize[_0x30c2('0x2')]},'username':{'type':Sequelize[_0x30c2('0x2')]},'password':{'type':Sequelize[_0x30c2('0x2')]},'remoteUri':{'type':Sequelize[_0x30c2('0x2')]},'tenantId':{'type':Sequelize[_0x30c2('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x30c2('0x2')]},'serverUrl':{'type':Sequelize[_0x30c2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x30c2('0x2')]},'modernAuthentication':{'type':Sequelize[_0x30c2('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1d7e=['STRING','BOOLEAN','exports'];(function(_0x532b81,_0x4ff5dc){var _0x5daaa0=function(_0x52721d){while(--_0x52721d){_0x532b81['push'](_0x532b81['shift']());}};_0x5daaa0(++_0x4ff5dc);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x1d7e[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require('sequelize');module[_0xe1d7('0x0')]={'name':{'type':Sequelize[_0xe1d7('0x1')]},'username':{'type':Sequelize[_0xe1d7('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe1d7('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xe1d7('0x1')]},'clientSecret':{'type':Sequelize[_0xe1d7('0x1')]},'serverUrl':{'type':Sequelize[_0xe1d7('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe1d7('0x1')]},'modernAuthentication':{'type':Sequelize[_0xe1d7('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index bf773dc..2791d70 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 _0x1605=['modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','overriddencreatedon','owneridname','owneridyominame','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','push','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','count','limit','set','json','update','then','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname'];(function(_0x89ad43,_0xd4b71d){var _0x5bcacc=function(_0x365613){while(--_0x365613){_0x89ad43['push'](_0x89ad43['shift']());}};_0x5bcacc(++_0xd4b71d);}(_0x1605,0x1d4));var _0x5160=function(_0x590688,_0x3652cd){_0x590688=_0x590688-0x0;var _0x1680ec=_0x1605[_0x590688];return _0x1680ec;};'use strict';var rp=require('request-promise');var util=require(_0x5160('0x0'));var _=require(_0x5160('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x5160('0x2'))(_0x5160('0x3'));var db=require(_0x5160('0x4'))['db'];var integrations=require(_0x5160('0x5'));function respondWithResult(_0x3bbba1,_0x379d87){_0x379d87=_0x379d87||0xc8;return function(_0xd2e91b){if(_0xd2e91b){return _0x3bbba1[_0x5160('0x6')](_0x379d87)['json'](_0xd2e91b);}};}function respondWithFilteredResult(_0x5d4441,_0x515b23){return function(_0x231992){if(_0x231992){var _0x2df04a=typeof _0x515b23[_0x5160('0x7')]===_0x5160('0x8')&&typeof _0x515b23['limit']==='undefined';var _0xd720b=_0x231992[_0x5160('0x9')];var _0x49b48c=_0x2df04a?0x0:_0x515b23[_0x5160('0x7')];var _0xe449=_0x2df04a?_0x231992[_0x5160('0x9')]:_0x515b23['offset']+_0x515b23[_0x5160('0xa')];var _0x1bc655;if(_0xe449>=_0xd720b){_0xe449=_0xd720b;_0x1bc655=0xc8;}else{_0x1bc655=0xce;}_0x5d4441[_0x5160('0x6')](_0x1bc655);return _0x5d4441[_0x5160('0xb')]('Content-Range',_0x49b48c+'-'+_0xe449+'/'+_0xd720b)[_0x5160('0xc')](_0x231992);}return null;};}function saveUpdates(_0x2374d5){return function(_0x5c3b01){if(_0x5c3b01){return _0x5c3b01[_0x5160('0xd')](_0x2374d5)[_0x5160('0xe')](function(_0x38e932){return _0x38e932;});}return null;};}function removeEntity(_0x321fb4){return function(_0x6f7cb8){if(_0x6f7cb8){return _0x6f7cb8[_0x5160('0xf')]()[_0x5160('0xe')](function(){_0x321fb4[_0x5160('0x6')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe0717a){return function(_0x30680e){if(!_0x30680e){_0xe0717a[_0x5160('0x10')](0x194);}return _0x30680e;};}function handleError(_0x54d973,_0xd66d0c){_0xd66d0c=_0xd66d0c||0x1f4;return function(_0x477458){logger[_0x5160('0x11')](_0x477458[_0x5160('0x12')]);if(_0x477458['name']){delete _0x477458[_0x5160('0x13')];}_0x54d973[_0x5160('0x6')](_0xd66d0c)[_0x5160('0x14')](_0x477458);};}exports[_0x5160('0x15')]=function(_0x483bef,_0x4307d9){var _0x2e3314={},_0x1fe1f={},_0x5003a3={'count':0x0,'rows':[]};var _0x541195=_[_0x5160('0x16')](db[_0x5160('0x17')][_0x5160('0x18')],function(_0x4f5ee3){return{'name':_0x4f5ee3[_0x5160('0x19')],'type':_0x4f5ee3[_0x5160('0x1a')][_0x5160('0x1b')]};});_0x1fe1f[_0x5160('0x1c')]=_[_0x5160('0x16')](_0x541195,_0x5160('0x13'));_0x1fe1f[_0x5160('0x1d')]=_['keys'](_0x483bef[_0x5160('0x1d')]);_0x1fe1f['filters']=_['intersection'](_0x1fe1f['model'],_0x1fe1f[_0x5160('0x1d')]);_0x2e3314[_0x5160('0x1e')]=_[_0x5160('0x1f')](_0x1fe1f['model'],qs[_0x5160('0x20')](_0x483bef[_0x5160('0x1d')][_0x5160('0x20')]));_0x2e3314[_0x5160('0x1e')]=_0x2e3314['attributes'][_0x5160('0x21')]?_0x2e3314[_0x5160('0x1e')]:_0x1fe1f[_0x5160('0x1c')];if(!_0x483bef['query'][_0x5160('0x22')](_0x5160('0x23'))){_0x2e3314['limit']=qs[_0x5160('0xa')](_0x483bef[_0x5160('0x1d')][_0x5160('0xa')]);_0x2e3314[_0x5160('0x7')]=qs[_0x5160('0x7')](_0x483bef['query']['offset']);}_0x2e3314['order']=qs['sort'](_0x483bef[_0x5160('0x1d')][_0x5160('0x24')]);_0x2e3314['where']=qs[_0x5160('0x25')](_[_0x5160('0x26')](_0x483bef[_0x5160('0x1d')],_0x1fe1f[_0x5160('0x25')]),_0x541195);if(_0x483bef['query']['filter']){_0x2e3314[_0x5160('0x27')]=_[_0x5160('0x28')](_0x2e3314[_0x5160('0x27')],{'$or':_[_0x5160('0x16')](_0x541195,function(_0x2a7382){if(_0x2a7382[_0x5160('0x1a')]!==_0x5160('0x29')){var _0x11142d={};_0x11142d[_0x2a7382['name']]={'$like':'%'+_0x483bef[_0x5160('0x1d')][_0x5160('0x2a')]+'%'};return _0x11142d;}})});}_0x2e3314=_[_0x5160('0x28')]({},_0x2e3314,_0x483bef[_0x5160('0x2b')]);var _0x2a7498={'where':_0x2e3314[_0x5160('0x27')]};return db['Dynamics365Account'][_0x5160('0x9')](_0x2a7498)[_0x5160('0xe')](function(_0x58a4ef){_0x5003a3[_0x5160('0x9')]=_0x58a4ef;if(_0x483bef[_0x5160('0x1d')][_0x5160('0x2c')]){_0x2e3314[_0x5160('0x2d')]=[{'all':!![]}];}return db[_0x5160('0x17')][_0x5160('0x2e')](_0x2e3314);})[_0x5160('0xe')](function(_0x4e95f6){_0x5003a3[_0x5160('0x2f')]=_0x4e95f6;return _0x5003a3;})[_0x5160('0xe')](respondWithFilteredResult(_0x4307d9,_0x2e3314))[_0x5160('0x30')](handleError(_0x4307d9,null));};exports[_0x5160('0x31')]=function(_0x5a26f9,_0x55cad5){var _0x494bb3={'raw':![],'where':{'id':_0x5a26f9[_0x5160('0x32')]['id']}},_0x2376e4={};_0x2376e4['model']=_[_0x5160('0x33')](db[_0x5160('0x17')][_0x5160('0x18')]);_0x2376e4[_0x5160('0x1d')]=_[_0x5160('0x33')](_0x5a26f9[_0x5160('0x1d')]);_0x2376e4[_0x5160('0x25')]=_[_0x5160('0x1f')](_0x2376e4[_0x5160('0x1c')],_0x2376e4['query']);_0x494bb3['attributes']=_[_0x5160('0x1f')](_0x2376e4[_0x5160('0x1c')],qs[_0x5160('0x20')](_0x5a26f9[_0x5160('0x1d')][_0x5160('0x20')]));_0x494bb3['attributes']=_0x494bb3[_0x5160('0x1e')]['length']?_0x494bb3[_0x5160('0x1e')]:_0x2376e4[_0x5160('0x1c')];if(_0x5a26f9[_0x5160('0x1d')][_0x5160('0x2c')]){_0x494bb3['include']=[{'all':!![]}];}_0x494bb3=_[_0x5160('0x28')]({},_0x494bb3,_0x5a26f9[_0x5160('0x2b')]);return db[_0x5160('0x17')][_0x5160('0x34')](_0x494bb3)[_0x5160('0xe')](handleEntityNotFound(_0x55cad5,null))[_0x5160('0xe')](respondWithResult(_0x55cad5,null))['catch'](handleError(_0x55cad5,null));};exports[_0x5160('0x35')]=function(_0x134760,_0x392b71){return db[_0x5160('0x17')]['create'](_0x134760['body'],{})[_0x5160('0xe')](respondWithResult(_0x392b71,0xc9))[_0x5160('0x30')](handleError(_0x392b71,null));};exports[_0x5160('0xd')]=function(_0x1b179a,_0x412406){if(_0x1b179a[_0x5160('0x36')]['id']){delete _0x1b179a[_0x5160('0x36')]['id'];}return db[_0x5160('0x17')][_0x5160('0x34')]({'where':{'id':_0x1b179a[_0x5160('0x32')]['id']}})[_0x5160('0xe')](handleEntityNotFound(_0x412406,null))[_0x5160('0xe')](saveUpdates(_0x1b179a[_0x5160('0x36')],null))['then'](respondWithResult(_0x412406,null))['catch'](handleError(_0x412406,null));};exports['destroy']=function(_0x33094e,_0x273535){return db[_0x5160('0x17')][_0x5160('0x34')]({'where':{'id':_0x33094e[_0x5160('0x32')]['id']}})[_0x5160('0xe')](handleEntityNotFound(_0x273535,null))[_0x5160('0xe')](removeEntity(_0x273535,null))['catch'](handleError(_0x273535,null));};exports[_0x5160('0x37')]=function(_0x2fe533,_0x53e312){var _0x28cf9f={};var _0x2aa39a={};var _0x376bba;var _0x236e23;return db['Dynamics365Account'][_0x5160('0x38')]({'where':{'id':_0x2fe533['params']['id']}})[_0x5160('0xe')](handleEntityNotFound(_0x53e312,null))[_0x5160('0xe')](function(_0x50e5dd){if(_0x50e5dd){_0x376bba=_0x50e5dd;_0x2aa39a['model']=_[_0x5160('0x33')](db[_0x5160('0x39')]['rawAttributes']);_0x2aa39a['query']=_[_0x5160('0x33')](_0x2fe533[_0x5160('0x1d')]);_0x2aa39a[_0x5160('0x25')]=_['intersection'](_0x2aa39a[_0x5160('0x1c')],_0x2aa39a['query']);_0x28cf9f[_0x5160('0x1e')]=_[_0x5160('0x1f')](_0x2aa39a[_0x5160('0x1c')],qs['fields'](_0x2fe533[_0x5160('0x1d')][_0x5160('0x20')]));_0x28cf9f[_0x5160('0x1e')]=_0x28cf9f['attributes']['length']?_0x28cf9f[_0x5160('0x1e')]:_0x2aa39a[_0x5160('0x1c')];_0x28cf9f[_0x5160('0x3a')]=qs[_0x5160('0x24')](_0x2fe533['query'][_0x5160('0x24')]);_0x28cf9f[_0x5160('0x27')]=qs[_0x5160('0x25')](_[_0x5160('0x26')](_0x2fe533[_0x5160('0x1d')],_0x2aa39a[_0x5160('0x25')]));if(_0x2fe533[_0x5160('0x1d')]['filter']){_0x28cf9f[_0x5160('0x27')]=_[_0x5160('0x28')](_0x28cf9f[_0x5160('0x27')],{'$or':_[_0x5160('0x16')](_0x28cf9f['attributes'],function(_0x3330d4){var _0x49d68e={};_0x49d68e[_0x3330d4]={'$like':'%'+_0x2fe533[_0x5160('0x1d')][_0x5160('0x2a')]+'%'};return _0x49d68e;})});}_0x28cf9f=_[_0x5160('0x28')]({},_0x28cf9f,_0x2fe533[_0x5160('0x2b')]);return _0x376bba['getConfigurations'](_0x28cf9f);}})[_0x5160('0xe')](function(_0x6f9a9c){if(_0x6f9a9c){_0x236e23=_0x6f9a9c[_0x5160('0x21')];if(!_0x2fe533[_0x5160('0x1d')][_0x5160('0x22')]('nolimit')){_0x28cf9f['limit']=qs['limit'](_0x2fe533[_0x5160('0x1d')]['limit']);_0x28cf9f[_0x5160('0x7')]=qs['offset'](_0x2fe533[_0x5160('0x1d')][_0x5160('0x7')]);}return _0x376bba[_0x5160('0x37')](_0x28cf9f);}})[_0x5160('0xe')](function(_0x1a06d2){if(_0x1a06d2){return _0x1a06d2?{'count':_0x236e23,'rows':_0x1a06d2}:null;}})['then'](respondWithResult(_0x53e312,null))['catch'](handleError(_0x53e312,null));};exports[_0x5160('0x3b')]=function(_0x518b80,_0x5f548e){if(_0x518b80[_0x5160('0x36')]['id']){delete _0x518b80['body']['id'];}return db[_0x5160('0x17')][_0x5160('0x38')]({'where':{'id':_0x518b80[_0x5160('0x32')]['id']}})[_0x5160('0xe')](handleEntityNotFound(_0x5f548e,null))['then'](function(_0x2a369d){if(_0x2a369d){_0x518b80[_0x5160('0x36')][_0x5160('0x3c')]=_0x2a369d['id'];_0x518b80[_0x5160('0x36')][_0x5160('0x3d')]=integrations[_0x5160('0x3e')](_0x518b80['body'][_0x5160('0x3f')],_0x518b80['body'][_0x5160('0x1a')]);_0x518b80[_0x5160('0x36')]['Descriptions']=integrations[_0x5160('0x40')](_0x518b80[_0x5160('0x36')][_0x5160('0x3f')],_0x518b80[_0x5160('0x36')][_0x5160('0x1a')]);return db['Dynamics365Configuration'][_0x5160('0x35')](_0x518b80[_0x5160('0x36')],{'include':[{'model':db[_0x5160('0x41')],'as':_0x5160('0x3d')},{'model':db['Dynamics365Field'],'as':_0x5160('0x42')}]});}return null;})[_0x5160('0xe')](respondWithResult(_0x5f548e,null))[_0x5160('0x30')](handleError(_0x5f548e,null));};function sanitizeRemoteUri(_0xe3338){var _0x184bfb=_0xe3338[_0x5160('0x43')](-0x1);if(_0x184bfb==='/')return _0xe3338[_0x5160('0x44')](0x0,_0xe3338[_0x5160('0x45')](_0x184bfb));return _0xe3338;}function getWebApiUrl(_0x2d6547){return util['format']('%s/api/data/v9.0/',_0x2d6547);}exports[_0x5160('0x46')]=function(_0x147dfb,_0x470893){var _0x495245=_0x147dfb[_0x5160('0x1d')]['ticketType'];var _0x211d5a=_0x495245===_0x5160('0x47')?_0x5160('0x48'):_0x5160('0x49');var _0x4acbe0='';var _0xbb55c7='';var _0xa9bff6='';var _0x397e3d='';var _0x361c06='';var _0x288b09='';var _0x4463eb='';var _0x59b88f='';var _0x23c2a3=[_0x5160('0x4a'),_0x5160('0x4b'),_0x5160('0x4c'),_0x5160('0x4d'),_0x5160('0x4e'),_0x5160('0x4f'),_0x5160('0x50'),_0x5160('0x51'),_0x5160('0x52'),'phonecall_activity_parties'];var _0xeb18c4=[_0x5160('0x53'),'accountidyominame',_0x5160('0x54'),_0x5160('0x55'),_0x5160('0x56'),'contactidyominame',_0x5160('0x57'),_0x5160('0x58'),_0x5160('0x59'),_0x5160('0x5a'),'createdbyname',_0x5160('0x5b'),'createdon',_0x5160('0x5c'),_0x5160('0x5d'),_0x5160('0x5e'),_0x5160('0x5f'),'customeridyominame','emailaddress',_0x5160('0x60'),_0x5160('0x61'),_0x5160('0x62'),_0x5160('0x63'),_0x5160('0x64'),_0x5160('0x65'),_0x5160('0x66'),_0x5160('0x67'),_0x5160('0x68'),_0x5160('0x69'),_0x5160('0x6a'),_0x5160('0x6b'),_0x5160('0x6c'),_0x5160('0x6d'),_0x5160('0x6e'),_0x5160('0x6f'),'modifiedon',_0x5160('0x70'),_0x5160('0x71'),_0x5160('0x72'),_0x5160('0x73'),'numberofchildincidents','onholdtime',_0x5160('0x74'),_0x5160('0x75'),'owneridtype',_0x5160('0x76'),'parentcaseidname','primarycontactidname',_0x5160('0x77'),'prioritycodename',_0x5160('0x78'),_0x5160('0x79'),_0x5160('0x7a'),_0x5160('0x7b'),_0x5160('0x7c'),'responsiblecontactidname','responsiblecontactidyominame',_0x5160('0x7d'),_0x5160('0x7e'),_0x5160('0x7f'),_0x5160('0x80'),_0x5160('0x81'),_0x5160('0x82'),_0x5160('0x83'),'ticketnumber','timezoneruleversionnumber','transactioncurrencyidname',_0x5160('0x84'),_0x5160('0x85'),_0x5160('0x86')];var _0x7d7974=_0x23c2a3[_0x5160('0x87')](_0xeb18c4);return db[_0x5160('0x17')][_0x5160('0x38')]({'where':{'id':_0x147dfb[_0x5160('0x32')]['id']},'attributes':['id',_0x5160('0x88'),'password',_0x5160('0x89'),_0x5160('0x8a'),_0x5160('0x8b'),_0x5160('0x8c'),_0x5160('0x8d')],'include':[{'model':db[_0x5160('0x8e')],'as':_0x5160('0x8e'),'attributes':['id',_0x5160('0x8f'),_0x5160('0x90')]}]})[_0x5160('0xe')](handleEntityNotFound(_0x470893,null))[_0x5160('0xe')](function(_0x5b5896){if(_0x5b5896){if(_0x5b5896[_0x5160('0x8d')]){_0x5b5896[_0x5160('0x91')]=_0x5b5896[_0x5160('0x8e')][_0x5160('0x8f')];_0x59b88f=sanitizeRemoteUri(_0x5b5896['CloudProvider']['data7']);_0x4463eb=getWebApiUrl(_0x59b88f);return _0x5b5896;}_0x59b88f=sanitizeRemoteUri(_0x5b5896[_0x5160('0x89')]);_0x4463eb=getWebApiUrl(_0x59b88f);var _0x247fdf={'method':_0x5160('0x92'),'uri':_0x5160('0x93')+_0x5b5896[_0x5160('0x8a')]+_0x5160('0x94'),'form':{'client_id':_0x5b5896[_0x5160('0x8b')],'resource':_0x59b88f,'username':_0x5b5896[_0x5160('0x88')],'password':_0x5b5896[_0x5160('0x95')],'grant_type':_0x5160('0x95'),'client_secret':_0x5b5896[_0x5160('0x8c')]},'json':!![]};return rp(_0x247fdf);}})['then'](function(_0x5d60df){_0x288b09=_0x5d60df[_0x5160('0x91')];var _0x3dd41c={'method':_0x5160('0x96'),'uri':encodeURI(_0x4463eb+_0x5160('0x97')+_0x211d5a+'\x27'),'headers':{'Authorization':_0x5160('0x98')+_0x288b09,'If-None-Match':null,'OData-Version':_0x5160('0x99')},'json':!![]};return rp(_0x3dd41c);})[_0x5160('0xe')](function(_0x412a76){var _0x35f5dd=_0x412a76[_0x5160('0x9a')][0x0];var _0x23bd7e=_0x35f5dd[_0x5160('0x9b')];var _0x398506={'method':'GET','uri':_0x4463eb+_0x5160('0x9c')+_0x23bd7e+_0x5160('0x9d'),'headers':{'Authorization':_0x5160('0x98')+_0x288b09,'If-None-Match':null,'OData-Version':_0x5160('0x99')},'json':!![]};return rp(_0x398506);})['then'](function(_0x1c5bce){_0x4acbe0=_0x1c5bce;_0xbb55c7=_0x4acbe0[_0x5160('0x9e')];_0xbb55c7=_['remove'](_0xbb55c7,function(_0x4aee52){return!_0x7d7974['includes'](_0x4aee52[_0x5160('0x9f')]);});var _0x3b64ca=[];var _0x4576b7=[];_0xbb55c7[_0x5160('0xa0')](function(_0x359386){if(_0x359386[_0x5160('0xa1')]){var _0x7d4dfa=_0x359386[_0x5160('0xa1')]['substring'](_0x359386[_0x5160('0xa1')][_0x5160('0x45')]('.')+0x1);if(_0x7d4dfa===_0x5160('0xa2')){_0x3b64ca['push'](getSelectList(_0x4463eb,_0x495245,_0x4576b7,_0x4acbe0[_0x5160('0x9b')],_0x359386[_0x5160('0x9b')],_0x288b09));}}});return Promise[_0x5160('0xa3')](_0x3b64ca);})[_0x5160('0xe')](function(_0x168b18){_0xa9bff6=_0x168b18[0x0];var _0x4e715d=[];var _0x112221=[];_0xbb55c7[_0x5160('0xa0')](function(_0xe729c5){if(!_[_0x5160('0xa4')](_0xe729c5[_0x5160('0xa1')])){var _0x398fe9=_0xe729c5[_0x5160('0xa1')]['substring'](_0xe729c5['@odata.type'][_0x5160('0x45')]('.')+0x1);if(_0x398fe9===_0x5160('0xa5')){_0x4e715d['push'](getBooleanList(_0x4463eb,_0x495245,_0x112221,_0x4acbe0['MetadataId'],_0xe729c5['MetadataId'],_0x288b09));}}});return Promise[_0x5160('0xa3')](_0x4e715d);})[_0x5160('0xe')](function(_0x5f28f5){_0x397e3d=_0x5f28f5[0x0];var _0x410c91=[];var _0x159c8e=[];_0xbb55c7[_0x5160('0xa0')](function(_0x5ee5e3){if(_0x5ee5e3[_0x5160('0xa1')]){var _0x58995d=_0x5ee5e3[_0x5160('0xa1')]['substring'](_0x5ee5e3[_0x5160('0xa1')][_0x5160('0x45')]('.')+0x1);if(_0x58995d===_0x5160('0xa6')||_0x58995d===_0x5160('0xa7')||_0x58995d===_0x5160('0xa8')||_0x58995d===_0x5160('0xa9')||_0x58995d===_0x5160('0xaa')||_0x58995d===_0x5160('0xab')||_0x58995d===_0x5160('0xac')||_0x58995d==='EntityNameAttributeMetadata'||_0x58995d===_0x5160('0xad')||_0x58995d===_0x5160('0xae')){_0x410c91['push'](getInputList(_0x4463eb,_0x495245,_0x58995d,_0x159c8e,_0x4acbe0['MetadataId'],_0x5ee5e3['MetadataId'],_0x288b09));}}});return Promise[_0x5160('0xa3')](_0x410c91);})['then'](function(_0x2f0ad8){_0x361c06=_0x2f0ad8[0x0];var _0x20c033=_0xa9bff6[_0x5160('0x87')](_0x397e3d)[_0x5160('0x87')](_0x361c06);var _0x3eeff8={'count':_0x20c033[_0x5160('0x21')],'rows':_0x20c033};return _0x3eeff8;})[_0x5160('0xe')](respondWithResult(_0x470893,null))[_0x5160('0x30')](function(_0x279792){var _0x5c23e6=_0x147dfb[_0x5160('0x1d')]['test']?0x1f4:_0x279792[_0x5160('0xaf')]||0x1f4;logger[_0x5160('0x11')](_0x279792[_0x5160('0x12')]);delete _0x279792[_0x5160('0x13')];if(_0x5c23e6===0x191){_0x5c23e6=0x190;}_0x470893[_0x5160('0x6')](_0x5c23e6)[_0x5160('0x14')](_0x147dfb[_0x5160('0x1d')]['test']?{'message':_0x5160('0xb0'),'statusCode':_0x279792[_0x5160('0xaf')]}:_0x279792);});};function getSelectList(_0x55ffc9,_0x3aacf7,_0x2e87ba,_0x2bfa2d,_0x283baa,_0x2b7da3){var _0x3287e9={'method':'GET','uri':_0x55ffc9+_0x5160('0x9c')+_0x2bfa2d+_0x5160('0xb1')+_0x283baa+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x5160('0xb2'),'headers':{'Authorization':_0x5160('0x98')+_0x2b7da3,'If-None-Match':null,'OData-Version':_0x5160('0x99')},'json':!![]};return rp(_0x3287e9)[_0x5160('0xe')](function(_0xe887e7){var _0x5bc0af=[];var _0x3202ed=_0xe887e7[_0x5160('0xb3')][_0x5160('0xb4')];_0x3202ed[_0x5160('0xa0')](function(_0x549f8b){_0x5bc0af[_0x5160('0xb5')]({'name':_0x549f8b[_0x5160('0xb6')][_0x5160('0xb7')][_0x5160('0xb6')],'value':String(_0x549f8b[_0x5160('0xb8')])});});var _0x4b44e8={'id':_0x3aacf7+'_'+_0xe887e7[_0x5160('0x9f')],'name':_0xe887e7[_0x5160('0xb9')][_0x5160('0xb7')]['Label'],'custom':![],'options':_0x5bc0af};_0x2e87ba[_0x5160('0xb5')](_0x4b44e8);return _0x2e87ba;});}function getBooleanList(_0x20c698,_0x567061,_0x57e536,_0x4def9f,_0x5d3b1b,_0x476b03){var _0x3ce03d={'method':'GET','uri':_0x20c698+_0x5160('0x9c')+_0x4def9f+_0x5160('0xb1')+_0x5d3b1b+_0x5160('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x476b03,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3ce03d)['then'](function(_0x55d607){var _0x3030e7=[];_0x3030e7['push']({'name':_0x55d607['OptionSet'][_0x5160('0xbb')]['Label'][_0x5160('0xb7')][_0x5160('0xb6')],'value':_0x5160('0xbc')},{'name':_0x55d607['OptionSet']['FalseOption'][_0x5160('0xb6')][_0x5160('0xb7')][_0x5160('0xb6')],'value':_0x5160('0xbd')});var _0xcce8f7={'id':_0x567061+'_'+_0x55d607['LogicalName'],'name':_0x55d607[_0x5160('0xb9')][_0x5160('0xb7')][_0x5160('0xb6')],'custom':![],'options':_0x3030e7};_0x57e536[_0x5160('0xb5')](_0xcce8f7);return _0x57e536;});}function getInputList(_0x232896,_0x2a710d,_0x109a15,_0x18bcc9,_0x31fdd1,_0x4dc81e,_0x5d8be8){var _0x3f7c8c={'method':_0x5160('0x96'),'uri':_0x232896+_0x5160('0x9c')+_0x31fdd1+_0x5160('0xb1')+_0x4dc81e+_0x5160('0xbe')+_0x109a15+_0x5160('0xbf'),'headers':{'Authorization':_0x5160('0x98')+_0x5d8be8,'If-None-Match':null,'OData-Version':_0x5160('0x99')},'json':!![]};return rp(_0x3f7c8c)['then'](function(_0x3f4fea){var _0x281a8b={'id':_0x2a710d+'_'+_0x3f4fea[_0x5160('0x9f')],'name':_0x3f4fea['DisplayName'][_0x5160('0xb7')]?_0x3f4fea['DisplayName'][_0x5160('0xb7')][_0x5160('0xb6')]:_0x3f4fea[_0x5160('0x9f')],'custom':![],'options':[]};_0x18bcc9[_0x5160('0xb5')](_0x281a8b);return _0x18bcc9;});} \ No newline at end of file +var _0x969e=['channel','Dynamics365Field','Subjects','slice','substring','lastIndexOf','getFields','incident','Incident','PhoneCall','title','description','ownerid','subject','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','remoteUri','tenantId','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','clientId','password','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','Wrong\x20credentials','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','status','json','undefined','offset','count','set','Content-Range','update','destroy','then','end','sendStatus','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','catch','fields','include','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','order','pick','addConfiguration','Descriptions','getDescriptions'];(function(_0x1e6f37,_0x776ad5){var _0x22b28d=function(_0x36ab1a){while(--_0x36ab1a){_0x1e6f37['push'](_0x1e6f37['shift']());}};_0x22b28d(++_0x776ad5);}(_0x969e,0x136));var _0xe969=function(_0x60632e,_0x25361c){_0x60632e=_0x60632e-0x0;var _0x1a8511=_0x969e[_0x60632e];return _0x1a8511;};'use strict';var rp=require(_0xe969('0x0'));var util=require(_0xe969('0x1'));var _=require('lodash');var qs=require(_0xe969('0x2'));var logger=require(_0xe969('0x3'))(_0xe969('0x4'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x57dc89,_0x4235bf){_0x4235bf=_0x4235bf||0xc8;return function(_0x1aa327){if(_0x1aa327){return _0x57dc89[_0xe969('0x5')](_0x4235bf)[_0xe969('0x6')](_0x1aa327);}};}function respondWithFilteredResult(_0x5d564d,_0x340384){return function(_0x18f8af){if(_0x18f8af){var _0x2118e2=typeof _0x340384['offset']===_0xe969('0x7')&&typeof _0x340384['limit']===_0xe969('0x7');var _0x2d37e0=_0x18f8af['count'];var _0x431f1c=_0x2118e2?0x0:_0x340384[_0xe969('0x8')];var _0x32d427=_0x2118e2?_0x18f8af[_0xe969('0x9')]:_0x340384[_0xe969('0x8')]+_0x340384['limit'];var _0x80b852;if(_0x32d427>=_0x2d37e0){_0x32d427=_0x2d37e0;_0x80b852=0xc8;}else{_0x80b852=0xce;}_0x5d564d[_0xe969('0x5')](_0x80b852);return _0x5d564d[_0xe969('0xa')](_0xe969('0xb'),_0x431f1c+'-'+_0x32d427+'/'+_0x2d37e0)[_0xe969('0x6')](_0x18f8af);}return null;};}function saveUpdates(_0xb40ed5){return function(_0x517fe7){if(_0x517fe7){return _0x517fe7[_0xe969('0xc')](_0xb40ed5)['then'](function(_0x503133){return _0x503133;});}return null;};}function removeEntity(_0x2e80cc){return function(_0x13b375){if(_0x13b375){return _0x13b375[_0xe969('0xd')]()[_0xe969('0xe')](function(){_0x2e80cc['status'](0xcc)[_0xe969('0xf')]();});}};}function handleEntityNotFound(_0x68065b){return function(_0x38aa1a){if(!_0x38aa1a){_0x68065b[_0xe969('0x10')](0x194);}return _0x38aa1a;};}function handleError(_0x4651e0,_0x251206){_0x251206=_0x251206||0x1f4;return function(_0x4c3756){logger['error'](_0x4c3756[_0xe969('0x11')]);if(_0x4c3756[_0xe969('0x12')]){delete _0x4c3756[_0xe969('0x12')];}_0x4651e0[_0xe969('0x5')](_0x251206)[_0xe969('0x13')](_0x4c3756);};}exports[_0xe969('0x14')]=function(_0x5aa68c,_0x5cea40){var _0x138283={},_0x1fa173={},_0x295b44={'count':0x0,'rows':[]};var _0x5dd070=_[_0xe969('0x15')](db[_0xe969('0x16')][_0xe969('0x17')],function(_0x5c7afe){return{'name':_0x5c7afe[_0xe969('0x18')],'type':_0x5c7afe['type']['key']};});_0x1fa173[_0xe969('0x19')]=_[_0xe969('0x15')](_0x5dd070,_0xe969('0x12'));_0x1fa173[_0xe969('0x1a')]=_[_0xe969('0x1b')](_0x5aa68c[_0xe969('0x1a')]);_0x1fa173[_0xe969('0x1c')]=_[_0xe969('0x1d')](_0x1fa173[_0xe969('0x19')],_0x1fa173[_0xe969('0x1a')]);_0x138283[_0xe969('0x1e')]=_[_0xe969('0x1d')](_0x1fa173[_0xe969('0x19')],qs['fields'](_0x5aa68c['query']['fields']));_0x138283[_0xe969('0x1e')]=_0x138283[_0xe969('0x1e')][_0xe969('0x1f')]?_0x138283[_0xe969('0x1e')]:_0x1fa173[_0xe969('0x19')];if(!_0x5aa68c[_0xe969('0x1a')][_0xe969('0x20')](_0xe969('0x21'))){_0x138283['limit']=qs[_0xe969('0x22')](_0x5aa68c[_0xe969('0x1a')][_0xe969('0x22')]);_0x138283[_0xe969('0x8')]=qs[_0xe969('0x8')](_0x5aa68c[_0xe969('0x1a')]['offset']);}_0x138283['order']=qs[_0xe969('0x23')](_0x5aa68c[_0xe969('0x1a')][_0xe969('0x23')]);_0x138283[_0xe969('0x24')]=qs[_0xe969('0x1c')](_['pick'](_0x5aa68c['query'],_0x1fa173[_0xe969('0x1c')]),_0x5dd070);if(_0x5aa68c[_0xe969('0x1a')][_0xe969('0x25')]){_0x138283[_0xe969('0x24')]=_[_0xe969('0x26')](_0x138283[_0xe969('0x24')],{'$or':_[_0xe969('0x15')](_0x5dd070,function(_0x4b0af3){if(_0x4b0af3[_0xe969('0x27')]!==_0xe969('0x28')){var _0x1c65d6={};_0x1c65d6[_0x4b0af3[_0xe969('0x12')]]={'$like':'%'+_0x5aa68c['query'][_0xe969('0x25')]+'%'};return _0x1c65d6;}})});}_0x138283=_[_0xe969('0x26')]({},_0x138283,_0x5aa68c[_0xe969('0x29')]);var _0x51caa0={'where':_0x138283['where']};return db[_0xe969('0x16')][_0xe969('0x9')](_0x51caa0)[_0xe969('0xe')](function(_0x19145d){_0x295b44[_0xe969('0x9')]=_0x19145d;if(_0x5aa68c['query'][_0xe969('0x2a')]){_0x138283['include']=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x138283);})[_0xe969('0xe')](function(_0x4cd0e7){_0x295b44['rows']=_0x4cd0e7;return _0x295b44;})[_0xe969('0xe')](respondWithFilteredResult(_0x5cea40,_0x138283))[_0xe969('0x2b')](handleError(_0x5cea40,null));};exports['show']=function(_0x5b7137,_0x100950){var _0x4ad4fc={'raw':![],'where':{'id':_0x5b7137['params']['id']}},_0x32b21c={};_0x32b21c[_0xe969('0x19')]=_[_0xe969('0x1b')](db[_0xe969('0x16')][_0xe969('0x17')]);_0x32b21c[_0xe969('0x1a')]=_['keys'](_0x5b7137[_0xe969('0x1a')]);_0x32b21c['filters']=_[_0xe969('0x1d')](_0x32b21c[_0xe969('0x19')],_0x32b21c['query']);_0x4ad4fc['attributes']=_[_0xe969('0x1d')](_0x32b21c['model'],qs[_0xe969('0x2c')](_0x5b7137[_0xe969('0x1a')]['fields']));_0x4ad4fc[_0xe969('0x1e')]=_0x4ad4fc[_0xe969('0x1e')][_0xe969('0x1f')]?_0x4ad4fc[_0xe969('0x1e')]:_0x32b21c[_0xe969('0x19')];if(_0x5b7137[_0xe969('0x1a')][_0xe969('0x2a')]){_0x4ad4fc[_0xe969('0x2d')]=[{'all':!![]}];}_0x4ad4fc=_[_0xe969('0x26')]({},_0x4ad4fc,_0x5b7137[_0xe969('0x29')]);return db[_0xe969('0x16')][_0xe969('0x2e')](_0x4ad4fc)['then'](handleEntityNotFound(_0x100950,null))[_0xe969('0xe')](respondWithResult(_0x100950,null))[_0xe969('0x2b')](handleError(_0x100950,null));};exports[_0xe969('0x2f')]=function(_0x63a0d1,_0x280888){return db[_0xe969('0x16')][_0xe969('0x2f')](_0x63a0d1[_0xe969('0x30')],{})[_0xe969('0xe')](respondWithResult(_0x280888,0xc9))[_0xe969('0x2b')](handleError(_0x280888,null));};exports[_0xe969('0xc')]=function(_0x509425,_0x37a86a){if(_0x509425['body']['id']){delete _0x509425['body']['id'];}return db[_0xe969('0x16')][_0xe969('0x2e')]({'where':{'id':_0x509425[_0xe969('0x31')]['id']}})[_0xe969('0xe')](handleEntityNotFound(_0x37a86a,null))[_0xe969('0xe')](saveUpdates(_0x509425[_0xe969('0x30')],null))['then'](respondWithResult(_0x37a86a,null))[_0xe969('0x2b')](handleError(_0x37a86a,null));};exports[_0xe969('0xd')]=function(_0x5b7f93,_0x3f1a76){return db['Dynamics365Account'][_0xe969('0x2e')]({'where':{'id':_0x5b7f93[_0xe969('0x31')]['id']}})[_0xe969('0xe')](handleEntityNotFound(_0x3f1a76,null))[_0xe969('0xe')](removeEntity(_0x3f1a76,null))['catch'](handleError(_0x3f1a76,null));};exports[_0xe969('0x32')]=function(_0x30636e,_0x5517f5){var _0x546624={};var _0x26fc43={};var _0x362d2a;var _0x297f49;return db[_0xe969('0x16')][_0xe969('0x33')]({'where':{'id':_0x30636e[_0xe969('0x31')]['id']}})[_0xe969('0xe')](handleEntityNotFound(_0x5517f5,null))['then'](function(_0x1f3239){if(_0x1f3239){_0x362d2a=_0x1f3239;_0x26fc43[_0xe969('0x19')]=_['keys'](db[_0xe969('0x34')][_0xe969('0x17')]);_0x26fc43['query']=_[_0xe969('0x1b')](_0x30636e[_0xe969('0x1a')]);_0x26fc43[_0xe969('0x1c')]=_[_0xe969('0x1d')](_0x26fc43['model'],_0x26fc43[_0xe969('0x1a')]);_0x546624[_0xe969('0x1e')]=_[_0xe969('0x1d')](_0x26fc43[_0xe969('0x19')],qs[_0xe969('0x2c')](_0x30636e[_0xe969('0x1a')]['fields']));_0x546624[_0xe969('0x1e')]=_0x546624[_0xe969('0x1e')][_0xe969('0x1f')]?_0x546624[_0xe969('0x1e')]:_0x26fc43[_0xe969('0x19')];_0x546624[_0xe969('0x35')]=qs[_0xe969('0x23')](_0x30636e[_0xe969('0x1a')][_0xe969('0x23')]);_0x546624['where']=qs[_0xe969('0x1c')](_[_0xe969('0x36')](_0x30636e['query'],_0x26fc43[_0xe969('0x1c')]));if(_0x30636e['query']['filter']){_0x546624[_0xe969('0x24')]=_['merge'](_0x546624[_0xe969('0x24')],{'$or':_[_0xe969('0x15')](_0x546624['attributes'],function(_0x1de5e0){var _0x596a48={};_0x596a48[_0x1de5e0]={'$like':'%'+_0x30636e[_0xe969('0x1a')][_0xe969('0x25')]+'%'};return _0x596a48;})});}_0x546624=_[_0xe969('0x26')]({},_0x546624,_0x30636e[_0xe969('0x29')]);return _0x362d2a[_0xe969('0x32')](_0x546624);}})['then'](function(_0x172e0e){if(_0x172e0e){_0x297f49=_0x172e0e['length'];if(!_0x30636e[_0xe969('0x1a')][_0xe969('0x20')](_0xe969('0x21'))){_0x546624[_0xe969('0x22')]=qs[_0xe969('0x22')](_0x30636e['query']['limit']);_0x546624[_0xe969('0x8')]=qs[_0xe969('0x8')](_0x30636e['query'][_0xe969('0x8')]);}return _0x362d2a['getConfigurations'](_0x546624);}})['then'](function(_0x37c69b){if(_0x37c69b){return _0x37c69b?{'count':_0x297f49,'rows':_0x37c69b}:null;}})[_0xe969('0xe')](respondWithResult(_0x5517f5,null))[_0xe969('0x2b')](handleError(_0x5517f5,null));};exports[_0xe969('0x37')]=function(_0x1ba42e,_0x85352){if(_0x1ba42e[_0xe969('0x30')]['id']){delete _0x1ba42e[_0xe969('0x30')]['id'];}return db[_0xe969('0x16')][_0xe969('0x33')]({'where':{'id':_0x1ba42e['params']['id']}})[_0xe969('0xe')](handleEntityNotFound(_0x85352,null))[_0xe969('0xe')](function(_0x449d22){if(_0x449d22){_0x1ba42e['body']['AccountId']=_0x449d22['id'];_0x1ba42e[_0xe969('0x30')]['Subjects']=integrations['getSubjects'](_0x1ba42e[_0xe969('0x30')]['channel'],_0x1ba42e[_0xe969('0x30')][_0xe969('0x27')]);_0x1ba42e[_0xe969('0x30')][_0xe969('0x38')]=integrations[_0xe969('0x39')](_0x1ba42e[_0xe969('0x30')][_0xe969('0x3a')],_0x1ba42e[_0xe969('0x30')][_0xe969('0x27')]);return db[_0xe969('0x34')][_0xe969('0x2f')](_0x1ba42e[_0xe969('0x30')],{'include':[{'model':db[_0xe969('0x3b')],'as':_0xe969('0x3c')},{'model':db['Dynamics365Field'],'as':_0xe969('0x38')}]});}return null;})[_0xe969('0xe')](respondWithResult(_0x85352,null))[_0xe969('0x2b')](handleError(_0x85352,null));};function sanitizeRemoteUri(_0x1b80b7){var _0x295261=_0x1b80b7[_0xe969('0x3d')](-0x1);if(_0x295261==='/')return _0x1b80b7[_0xe969('0x3e')](0x0,_0x1b80b7[_0xe969('0x3f')](_0x295261));return _0x1b80b7;}function getWebApiUrl(_0x5183de){return util['format']('%s/api/data/v9.0/',_0x5183de);}exports[_0xe969('0x40')]=function(_0x493592,_0x4cae31){var _0x5a44d9=_0x493592[_0xe969('0x1a')]['ticketType'];var _0x3c62de=_0x5a44d9===_0xe969('0x41')?_0xe969('0x42'):_0xe969('0x43');var _0x369749='';var _0x3e1dfa='';var _0x13ffa4='';var _0x19db3e='';var _0xf5086='';var _0x40cba5='';var _0x5b8857='';var _0x12a227='';var _0x33dd4c=[_0xe969('0x44'),_0xe969('0x45'),'customerid',_0xe969('0x46'),'caseorigincode',_0xe969('0x47'),'phonenumber','regardingobjectid',_0xe969('0x48'),_0xe969('0x49')];var _0x3bee64=[_0xe969('0x4a'),'accountidyominame',_0xe969('0x4b'),_0xe969('0x4c'),'contactidname',_0xe969('0x4d'),_0xe969('0x4e'),_0xe969('0x4f'),_0xe969('0x50'),_0xe969('0x51'),_0xe969('0x52'),_0xe969('0x53'),_0xe969('0x54'),_0xe969('0x55'),_0xe969('0x56'),'customeridname',_0xe969('0x57'),_0xe969('0x58'),_0xe969('0x59'),'entitlementidname',_0xe969('0x5a'),_0xe969('0x5b'),_0xe969('0x5c'),'exchangerate',_0xe969('0x5d'),'followupby',_0xe969('0x5e'),_0xe969('0x5f'),_0xe969('0x60'),_0xe969('0x61'),_0xe969('0x62'),_0xe969('0x63'),_0xe969('0x64'),_0xe969('0x65'),_0xe969('0x66'),'modifiedon','modifiedonbehalfbyname',_0xe969('0x67'),_0xe969('0x68'),_0xe969('0x69'),'numberofchildincidents',_0xe969('0x6a'),'overriddencreatedon',_0xe969('0x6b'),_0xe969('0x6c'),_0xe969('0x6d'),'parentcaseidname',_0xe969('0x6e'),_0xe969('0x6f'),_0xe969('0x70'),'productidname',_0xe969('0x71'),_0xe969('0x72'),_0xe969('0x73'),_0xe969('0x74'),_0xe969('0x75'),_0xe969('0x76'),_0xe969('0x77'),_0xe969('0x78'),_0xe969('0x79'),'socialprofileidname',_0xe969('0x7a'),_0xe969('0x7b'),_0xe969('0x7c'),_0xe969('0x7d'),_0xe969('0x7e'),'transactioncurrencyidname',_0xe969('0x7f'),_0xe969('0x80'),_0xe969('0x81')];var _0x1e99e2=_0x33dd4c[_0xe969('0x82')](_0x3bee64);return db[_0xe969('0x16')][_0xe969('0x33')]({'where':{'id':_0x493592[_0xe969('0x31')]['id']},'attributes':['id','username','password',_0xe969('0x83'),_0xe969('0x84'),'clientId','clientSecret',_0xe969('0x85')],'include':[{'model':db[_0xe969('0x86')],'as':_0xe969('0x86'),'attributes':['id',_0xe969('0x87'),_0xe969('0x88')]}]})[_0xe969('0xe')](handleEntityNotFound(_0x4cae31,null))[_0xe969('0xe')](function(_0x24d95f){if(_0x24d95f){if(_0x24d95f['modernAuthentication']){_0x24d95f[_0xe969('0x89')]=_0x24d95f['CloudProvider'][_0xe969('0x87')];_0x12a227=sanitizeRemoteUri(_0x24d95f['CloudProvider']['data7']);_0x5b8857=getWebApiUrl(_0x12a227);return _0x24d95f;}_0x12a227=sanitizeRemoteUri(_0x24d95f[_0xe969('0x83')]);_0x5b8857=getWebApiUrl(_0x12a227);var _0x161873={'method':_0xe969('0x8a'),'uri':_0xe969('0x8b')+_0x24d95f['tenantId']+'/oauth2/token','form':{'client_id':_0x24d95f[_0xe969('0x8c')],'resource':_0x12a227,'username':_0x24d95f['username'],'password':_0x24d95f[_0xe969('0x8d')],'grant_type':'password','client_secret':_0x24d95f[_0xe969('0x8e')]},'json':!![]};return rp(_0x161873);}})[_0xe969('0xe')](function(_0x3a4917){_0x40cba5=_0x3a4917['access_token'];var _0x1d1890={'method':_0xe969('0x8f'),'uri':encodeURI(_0x5b8857+_0xe969('0x90')+_0x3c62de+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x40cba5,'If-None-Match':null,'OData-Version':_0xe969('0x91')},'json':!![]};return rp(_0x1d1890);})[_0xe969('0xe')](function(_0x19c141){var _0x2be289=_0x19c141[_0xe969('0x92')][0x0];var _0x1dc5ff=_0x2be289[_0xe969('0x93')];var _0x516636={'method':'GET','uri':_0x5b8857+_0xe969('0x94')+_0x1dc5ff+_0xe969('0x95'),'headers':{'Authorization':_0xe969('0x96')+_0x40cba5,'If-None-Match':null,'OData-Version':_0xe969('0x91')},'json':!![]};return rp(_0x516636);})[_0xe969('0xe')](function(_0x28969f){_0x369749=_0x28969f;_0x3e1dfa=_0x369749[_0xe969('0x97')];_0x3e1dfa=_[_0xe969('0x98')](_0x3e1dfa,function(_0x31a976){return!_0x1e99e2['includes'](_0x31a976[_0xe969('0x99')]);});var _0x3c7880=[];var _0xac20d4=[];_0x3e1dfa[_0xe969('0x9a')](function(_0x55c6a1){if(_0x55c6a1[_0xe969('0x9b')]){var _0x2b0d98=_0x55c6a1[_0xe969('0x9b')][_0xe969('0x3e')](_0x55c6a1[_0xe969('0x9b')][_0xe969('0x3f')]('.')+0x1);if(_0x2b0d98===_0xe969('0x9c')){_0x3c7880[_0xe969('0x9d')](getSelectList(_0x5b8857,_0x5a44d9,_0xac20d4,_0x369749[_0xe969('0x93')],_0x55c6a1[_0xe969('0x93')],_0x40cba5));}}});return Promise['all'](_0x3c7880);})[_0xe969('0xe')](function(_0x1a799a){_0x13ffa4=_0x1a799a[0x0];var _0x5f57f2=[];var _0x16ee70=[];_0x3e1dfa['forEach'](function(_0x2d1c92){if(!_[_0xe969('0x9e')](_0x2d1c92[_0xe969('0x9b')])){var _0x19a7bc=_0x2d1c92['@odata.type']['substring'](_0x2d1c92[_0xe969('0x9b')][_0xe969('0x3f')]('.')+0x1);if(_0x19a7bc==='BooleanAttributeMetadata'){_0x5f57f2[_0xe969('0x9d')](getBooleanList(_0x5b8857,_0x5a44d9,_0x16ee70,_0x369749[_0xe969('0x93')],_0x2d1c92[_0xe969('0x93')],_0x40cba5));}}});return Promise[_0xe969('0x9f')](_0x5f57f2);})['then'](function(_0x132b27){_0x19db3e=_0x132b27[0x0];var _0x41a23c=[];var _0x2d4c18=[];_0x3e1dfa[_0xe969('0x9a')](function(_0x192d80){if(_0x192d80['@odata.type']){var _0x4ff59d=_0x192d80['@odata.type']['substring'](_0x192d80[_0xe969('0x9b')][_0xe969('0x3f')]('.')+0x1);if(_0x4ff59d===_0xe969('0xa0')||_0x4ff59d===_0xe969('0xa1')||_0x4ff59d===_0xe969('0xa2')||_0x4ff59d==='IntegerAttributeMetadata'||_0x4ff59d===_0xe969('0xa3')||_0x4ff59d===_0xe969('0xa4')||_0x4ff59d===_0xe969('0xa5')||_0x4ff59d==='EntityNameAttributeMetadata'||_0x4ff59d==='StateAttributeMetadata'||_0x4ff59d===_0xe969('0xa6')){_0x41a23c[_0xe969('0x9d')](getInputList(_0x5b8857,_0x5a44d9,_0x4ff59d,_0x2d4c18,_0x369749[_0xe969('0x93')],_0x192d80[_0xe969('0x93')],_0x40cba5));}}});return Promise['all'](_0x41a23c);})[_0xe969('0xe')](function(_0x192e8a){_0xf5086=_0x192e8a[0x0];var _0x41c642=_0x13ffa4[_0xe969('0x82')](_0x19db3e)[_0xe969('0x82')](_0xf5086);var _0x10124a={'count':_0x41c642[_0xe969('0x1f')],'rows':_0x41c642};return _0x10124a;})[_0xe969('0xe')](respondWithResult(_0x4cae31,null))[_0xe969('0x2b')](function(_0x45c26e){var _0x48d5dc=_0x493592[_0xe969('0x1a')][_0xe969('0xa7')]?0x1f4:_0x45c26e[_0xe969('0xa8')]||0x1f4;logger[_0xe969('0xa9')](_0x45c26e[_0xe969('0x11')]);delete _0x45c26e['name'];if(_0x48d5dc===0x191){_0x48d5dc=0x190;}_0x4cae31['status'](_0x48d5dc)['send'](_0x493592['query']['test']?{'message':_0xe969('0xaa'),'statusCode':_0x45c26e[_0xe969('0xa8')]}:_0x45c26e);});};function getSelectList(_0x58bdc4,_0x2c937b,_0x3f4edf,_0x5e7abf,_0x5a2b25,_0xd32e56){var _0xf1f34b={'method':_0xe969('0x8f'),'uri':_0x58bdc4+_0xe969('0x94')+_0x5e7abf+')/Attributes('+_0x5a2b25+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xe969('0xab'),'headers':{'Authorization':_0xe969('0x96')+_0xd32e56,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xf1f34b)[_0xe969('0xe')](function(_0x527b25){var _0x580085=[];var _0x54aec9=_0x527b25[_0xe969('0xac')]['Options'];_0x54aec9[_0xe969('0x9a')](function(_0x2e0a38){_0x580085['push']({'name':_0x2e0a38[_0xe969('0xad')][_0xe969('0xae')]['Label'],'value':String(_0x2e0a38[_0xe969('0xaf')])});});var _0x39a4c4={'id':_0x2c937b+'_'+_0x527b25[_0xe969('0x99')],'name':_0x527b25[_0xe969('0xb0')]['UserLocalizedLabel'][_0xe969('0xad')],'custom':![],'options':_0x580085};_0x3f4edf[_0xe969('0x9d')](_0x39a4c4);return _0x3f4edf;});}function getBooleanList(_0x2f1121,_0x50a046,_0x112bcf,_0x5ef54f,_0x5230b5,_0x22f4dc){var _0x4588b8={'method':_0xe969('0x8f'),'uri':_0x2f1121+_0xe969('0x94')+_0x5ef54f+')/Attributes('+_0x5230b5+_0xe969('0xb1'),'headers':{'Authorization':_0xe969('0x96')+_0x22f4dc,'If-None-Match':null,'OData-Version':_0xe969('0x91')},'json':!![]};return rp(_0x4588b8)[_0xe969('0xe')](function(_0x18ac84){var _0xd83e18=[];_0xd83e18['push']({'name':_0x18ac84[_0xe969('0xac')][_0xe969('0xb2')][_0xe969('0xad')]['UserLocalizedLabel']['Label'],'value':_0xe969('0xb3')},{'name':_0x18ac84[_0xe969('0xac')][_0xe969('0xb4')][_0xe969('0xad')][_0xe969('0xae')][_0xe969('0xad')],'value':_0xe969('0xb5')});var _0x62d15c={'id':_0x50a046+'_'+_0x18ac84['LogicalName'],'name':_0x18ac84[_0xe969('0xb0')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0xd83e18};_0x112bcf['push'](_0x62d15c);return _0x112bcf;});}function getInputList(_0x7f08de,_0x32329e,_0x19c17c,_0xd81647,_0x237310,_0x447b35,_0x8b4402){var _0x2a9956={'method':_0xe969('0x8f'),'uri':_0x7f08de+_0xe969('0x94')+_0x237310+')/Attributes('+_0x447b35+_0xe969('0xb6')+_0x19c17c+_0xe969('0xb7'),'headers':{'Authorization':_0xe969('0x96')+_0x8b4402,'If-None-Match':null,'OData-Version':_0xe969('0x91')},'json':!![]};return rp(_0x2a9956)[_0xe969('0xe')](function(_0x2c1a9f){var _0x4f3e02={'id':_0x32329e+'_'+_0x2c1a9f['LogicalName'],'name':_0x2c1a9f[_0xe969('0xb0')][_0xe969('0xae')]?_0x2c1a9f[_0xe969('0xb0')][_0xe969('0xae')][_0xe969('0xad')]:_0x2c1a9f[_0xe969('0x99')],'custom':![],'options':[]};_0xd81647[_0xe969('0x9d')](_0x4f3e02);return _0xd81647;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 6002165..ca6e337 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x81c30d,_0x59e7f6){var _0x5428da=function(_0x422d09){while(--_0x422d09){_0x81c30d['push'](_0x81c30d['shift']());}};_0x5428da(++_0x59e7f6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb7e7[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x1b91c7,_0x539acd){var _0xbbe014=function(_0x57ff15){while(--_0x57ff15){_0x1b91c7['push'](_0x1b91c7['shift']());}};_0xbbe014(++_0x539acd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 5fae763..b68dde2 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 _0x95fe=['request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch','Dynamics365Account','findAll','options','include','map','model','attributes','GetDynamics365Account','stringify','ShowDynamics365Account','find','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0x95fe,0x149));var _0xe95f=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0x95fe[_0x6ca7f4];return _0x494fa6;};'use strict';var _=require(_0xe95f('0x0'));var util=require(_0xe95f('0x1'));var moment=require('moment');var BPromise=require(_0xe95f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe95f('0x3'));var db=require(_0xe95f('0x4'))['db'];var utils=require(_0xe95f('0x5'));var logger=require(_0xe95f('0x6'))('rpc');var config=require(_0xe95f('0x7'));var jayson=require(_0xe95f('0x8'));var client=jayson[_0xe95f('0x9')][_0xe95f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29b7f9,_0x2a5008,_0x3ba616){return new BPromise(function(_0x365e24,_0x3fda14){return client[_0xe95f('0xb')](_0x29b7f9,_0x3ba616)[_0xe95f('0xc')](function(_0x4a7083){logger[_0xe95f('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x2a5008,_0xe95f('0xe'));logger[_0xe95f('0xf')](_0xe95f('0x10'),_0x2a5008,_0xe95f('0xe'),JSON['stringify'](_0x4a7083));if(_0x4a7083[_0xe95f('0x11')]){if(_0x4a7083[_0xe95f('0x11')]['code']===0x1f4){logger[_0xe95f('0x11')](_0xe95f('0x12'),_0x2a5008,_0x4a7083[_0xe95f('0x11')][_0xe95f('0x13')]);return _0x3fda14(_0x4a7083['error'][_0xe95f('0x13')]);}logger[_0xe95f('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x2a5008,_0x4a7083['error'][_0xe95f('0x13')]);return _0x365e24(_0x4a7083[_0xe95f('0x11')][_0xe95f('0x13')]);}else{logger[_0xe95f('0xd')](_0xe95f('0x12'),_0x2a5008,'request\x20sent');_0x365e24(_0x4a7083[_0xe95f('0x14')][_0xe95f('0x13')]);}})[_0xe95f('0x15')](function(_0x401983){logger['error'](_0xe95f('0x12'),_0x2a5008,_0x401983);_0x3fda14(_0x401983);});});}exports['GetDynamics365Account']=function(_0x37babe){var _0xccc09b=this;return new Promise(function(_0x36d72c,_0x5237fe){return db[_0xe95f('0x16')][_0xe95f('0x17')]({'raw':_0x37babe['options']?_0x37babe[_0xe95f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x37babe[_0xe95f('0x18')]?_0x37babe[_0xe95f('0x18')]['where']||null:null,'attributes':_0x37babe[_0xe95f('0x18')]?_0x37babe[_0xe95f('0x18')]['attributes']||null:null,'limit':_0x37babe[_0xe95f('0x18')]?_0x37babe['options']['limit']||null:null,'include':_0x37babe[_0xe95f('0x18')]?_0x37babe['options'][_0xe95f('0x19')]?_[_0xe95f('0x1a')](_0x37babe['options'][_0xe95f('0x19')],function(_0x5f3876){return{'model':db[_0x5f3876[_0xe95f('0x1b')]],'as':_0x5f3876['as'],'attributes':_0x5f3876['attributes'],'include':_0x5f3876['include']?_[_0xe95f('0x1a')](_0x5f3876[_0xe95f('0x19')],function(_0x17de3d){return{'model':db[_0x17de3d[_0xe95f('0x1b')]],'as':_0x17de3d['as'],'attributes':_0x17de3d['attributes'],'include':_0x17de3d['include']?_[_0xe95f('0x1a')](_0x17de3d['include'],function(_0x320eb5){return{'model':db[_0x320eb5[_0xe95f('0x1b')]],'as':_0x320eb5['as'],'attributes':_0x320eb5[_0xe95f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe95f('0xc')](function(_0x5909b0){logger[_0xe95f('0xd')]('GetDynamics365Account',_0x37babe);logger[_0xe95f('0xf')](_0xe95f('0x1d'),_0x37babe,JSON[_0xe95f('0x1e')](_0x5909b0));_0x36d72c(_0x5909b0);})['catch'](function(_0x51974f){logger[_0xe95f('0x11')]('GetDynamics365Account',_0x51974f[_0xe95f('0x13')],_0x37babe);_0x5237fe(_0xccc09b[_0xe95f('0x11')](0x1f4,_0x51974f[_0xe95f('0x13')]));});});};exports[_0xe95f('0x1f')]=function(_0x36f7eb){var _0x3d7f0a=this;return new Promise(function(_0x15ef33,_0x58ea72){return db[_0xe95f('0x16')][_0xe95f('0x20')]({'raw':_0x36f7eb[_0xe95f('0x18')]?_0x36f7eb[_0xe95f('0x18')][_0xe95f('0x21')]===undefined?!![]:![]:!![],'where':_0x36f7eb[_0xe95f('0x18')]?_0x36f7eb[_0xe95f('0x18')]['where']||null:null,'attributes':_0x36f7eb[_0xe95f('0x18')]?_0x36f7eb['options']['attributes']||null:null,'include':_0x36f7eb[_0xe95f('0x18')]?_0x36f7eb[_0xe95f('0x18')][_0xe95f('0x19')]?_[_0xe95f('0x1a')](_0x36f7eb[_0xe95f('0x18')][_0xe95f('0x19')],function(_0xd05224){return{'model':db[_0xd05224[_0xe95f('0x1b')]],'as':_0xd05224['as'],'attributes':_0xd05224[_0xe95f('0x1c')],'include':_0xd05224[_0xe95f('0x19')]?_['map'](_0xd05224[_0xe95f('0x19')],function(_0x4a9c49){return{'model':db[_0x4a9c49[_0xe95f('0x1b')]],'as':_0x4a9c49['as'],'attributes':_0x4a9c49['attributes'],'include':_0x4a9c49[_0xe95f('0x19')]?_['map'](_0x4a9c49['include'],function(_0x5d3b20){return{'model':db[_0x5d3b20[_0xe95f('0x1b')]],'as':_0x5d3b20['as'],'attributes':_0x5d3b20[_0xe95f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe95f('0xc')](function(_0x46c624){logger[_0xe95f('0xd')]('ShowDynamics365Account',_0x36f7eb);logger[_0xe95f('0xf')]('ShowDynamics365Account',_0x36f7eb,JSON['stringify'](_0x46c624));_0x15ef33(_0x46c624);})[_0xe95f('0x15')](function(_0x4e352a){logger['error']('ShowDynamics365Account',_0x4e352a[_0xe95f('0x13')],_0x36f7eb);_0x58ea72(_0x3d7f0a[_0xe95f('0x11')](0x1f4,_0x4e352a[_0xe95f('0x13')]));});});}; \ No newline at end of file +var _0x91f1=['Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowDynamics365Account','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetDynamics365Account'];(function(_0x38fb8b,_0x70dd0a){var _0x1ec681=function(_0x58f130){while(--_0x58f130){_0x38fb8b['push'](_0x38fb8b['shift']());}};_0x1ec681(++_0x70dd0a);}(_0x91f1,0x9d));var _0x191f=function(_0x350813,_0x8c6e93){_0x350813=_0x350813-0x0;var _0xa86385=_0x91f1[_0x350813];return _0xa86385;};'use strict';var _=require(_0x191f('0x0'));var util=require(_0x191f('0x1'));var moment=require(_0x191f('0x2'));var BPromise=require(_0x191f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x191f('0x4'));var db=require(_0x191f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x191f('0x6'))('rpc');var config=require(_0x191f('0x7'));var jayson=require(_0x191f('0x8'));var client=jayson['client'][_0x191f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36d3df,_0x2d4887,_0x346a88){return new BPromise(function(_0x2ceca0,_0x26720d){return client[_0x191f('0xa')](_0x36d3df,_0x346a88)[_0x191f('0xb')](function(_0x527632){logger[_0x191f('0xc')](_0x191f('0xd'),_0x2d4887,_0x191f('0xe'));logger[_0x191f('0xf')](_0x191f('0x10'),_0x2d4887,'request\x20sent',JSON['stringify'](_0x527632));if(_0x527632['error']){if(_0x527632['error'][_0x191f('0x11')]===0x1f4){logger[_0x191f('0x12')](_0x191f('0xd'),_0x2d4887,_0x527632[_0x191f('0x12')]['message']);return _0x26720d(_0x527632[_0x191f('0x12')][_0x191f('0x13')]);}logger['error'](_0x191f('0xd'),_0x2d4887,_0x527632['error'][_0x191f('0x13')]);return _0x2ceca0(_0x527632[_0x191f('0x12')][_0x191f('0x13')]);}else{logger['info'](_0x191f('0xd'),_0x2d4887,_0x191f('0xe'));_0x2ceca0(_0x527632[_0x191f('0x14')][_0x191f('0x13')]);}})[_0x191f('0x15')](function(_0x1d7878){logger[_0x191f('0x12')](_0x191f('0xd'),_0x2d4887,_0x1d7878);_0x26720d(_0x1d7878);});});}exports[_0x191f('0x16')]=function(_0x438a1b){var _0x262741=this;return new Promise(function(_0x4240b9,_0x2126c8){return db[_0x191f('0x17')][_0x191f('0x18')]({'raw':_0x438a1b[_0x191f('0x19')]?_0x438a1b[_0x191f('0x19')][_0x191f('0x1a')]===undefined?!![]:![]:!![],'where':_0x438a1b['options']?_0x438a1b[_0x191f('0x19')][_0x191f('0x1b')]||null:null,'attributes':_0x438a1b[_0x191f('0x19')]?_0x438a1b[_0x191f('0x19')][_0x191f('0x1c')]||null:null,'limit':_0x438a1b['options']?_0x438a1b[_0x191f('0x19')][_0x191f('0x1d')]||null:null,'include':_0x438a1b['options']?_0x438a1b['options'][_0x191f('0x1e')]?_[_0x191f('0x1f')](_0x438a1b[_0x191f('0x19')]['include'],function(_0x5a962d){return{'model':db[_0x5a962d[_0x191f('0x20')]],'as':_0x5a962d['as'],'attributes':_0x5a962d[_0x191f('0x1c')],'include':_0x5a962d[_0x191f('0x1e')]?_[_0x191f('0x1f')](_0x5a962d[_0x191f('0x1e')],function(_0x46aa53){return{'model':db[_0x46aa53['model']],'as':_0x46aa53['as'],'attributes':_0x46aa53[_0x191f('0x1c')],'include':_0x46aa53[_0x191f('0x1e')]?_[_0x191f('0x1f')](_0x46aa53[_0x191f('0x1e')],function(_0x185e6f){return{'model':db[_0x185e6f['model']],'as':_0x185e6f['as'],'attributes':_0x185e6f[_0x191f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x191f('0xb')](function(_0x41b4a3){logger[_0x191f('0xc')](_0x191f('0x16'),_0x438a1b);logger['debug']('GetDynamics365Account',_0x438a1b,JSON[_0x191f('0x21')](_0x41b4a3));_0x4240b9(_0x41b4a3);})[_0x191f('0x15')](function(_0x17e95b){logger[_0x191f('0x12')](_0x191f('0x16'),_0x17e95b['message'],_0x438a1b);_0x2126c8(_0x262741[_0x191f('0x12')](0x1f4,_0x17e95b[_0x191f('0x13')]));});});};exports['ShowDynamics365Account']=function(_0xfc56fd){var _0x3774e8=this;return new Promise(function(_0x73ce0b,_0x3b8e24){return db['Dynamics365Account'][_0x191f('0x22')]({'raw':_0xfc56fd[_0x191f('0x19')]?_0xfc56fd[_0x191f('0x19')][_0x191f('0x1a')]===undefined?!![]:![]:!![],'where':_0xfc56fd[_0x191f('0x19')]?_0xfc56fd['options']['where']||null:null,'attributes':_0xfc56fd[_0x191f('0x19')]?_0xfc56fd[_0x191f('0x19')][_0x191f('0x1c')]||null:null,'include':_0xfc56fd['options']?_0xfc56fd[_0x191f('0x19')]['include']?_['map'](_0xfc56fd[_0x191f('0x19')][_0x191f('0x1e')],function(_0x25f9ed){return{'model':db[_0x25f9ed[_0x191f('0x20')]],'as':_0x25f9ed['as'],'attributes':_0x25f9ed['attributes'],'include':_0x25f9ed[_0x191f('0x1e')]?_[_0x191f('0x1f')](_0x25f9ed[_0x191f('0x1e')],function(_0x3462f8){return{'model':db[_0x3462f8[_0x191f('0x20')]],'as':_0x3462f8['as'],'attributes':_0x3462f8[_0x191f('0x1c')],'include':_0x3462f8[_0x191f('0x1e')]?_['map'](_0x3462f8[_0x191f('0x1e')],function(_0xc29d96){return{'model':db[_0xc29d96['model']],'as':_0xc29d96['as'],'attributes':_0xc29d96[_0x191f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x191f('0xb')](function(_0x3a98ee){logger[_0x191f('0xc')](_0x191f('0x23'),_0xfc56fd);logger[_0x191f('0xf')](_0x191f('0x23'),_0xfc56fd,JSON[_0x191f('0x21')](_0x3a98ee));_0x73ce0b(_0x3a98ee);})[_0x191f('0x15')](function(_0x206cd6){logger['error']('ShowDynamics365Account',_0x206cd6[_0x191f('0x13')],_0xfc56fd);_0x3b8e24(_0x3774e8['error'](0x1f4,_0x206cd6[_0x191f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 885ece9..d7a4dc6 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 _0x0c8d=['destroy','exports','util','path','connect-timeout','express','Router','./intDynamics365Configuration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','update','/:id'];(function(_0x545ddc,_0x2a253a){var _0x20661a=function(_0x3f1704){while(--_0x3f1704){_0x545ddc['push'](_0x545ddc['shift']());}};_0x20661a(++_0x2a253a);}(_0x0c8d,0x79));var _0xd0c8=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x0c8d[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require('multer');var util=require(_0xd0c8('0x0'));var path=require(_0xd0c8('0x1'));var timeout=require(_0xd0c8('0x2'));var express=require(_0xd0c8('0x3'));var router=express[_0xd0c8('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(_0xd0c8('0x5'));router[_0xd0c8('0x6')]('/',auth[_0xd0c8('0x7')](),controller['index']);router[_0xd0c8('0x6')]('/:id',auth[_0xd0c8('0x7')](),controller[_0xd0c8('0x8')]);router[_0xd0c8('0x6')](_0xd0c8('0x9'),auth[_0xd0c8('0x7')](),controller['getFields']);router[_0xd0c8('0x6')](_0xd0c8('0xa'),auth[_0xd0c8('0x7')](),controller[_0xd0c8('0xb')]);router['get']('/:id/descriptions',auth[_0xd0c8('0x7')](),controller[_0xd0c8('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xd0c8('0x7')](),controller[_0xd0c8('0xd')]);router['delete'](_0xd0c8('0xe'),auth[_0xd0c8('0x7')](),controller[_0xd0c8('0xf')]);module[_0xd0c8('0x10')]=router; \ No newline at end of file +var _0x50d1=['/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x2ba67d,_0x342b60){var _0x3b34d3=function(_0x4a404c){while(--_0x4a404c){_0x2ba67d['push'](_0x2ba67d['shift']());}};_0x3b34d3(++_0x342b60);}(_0x50d1,0xf3));var _0x150d=function(_0xdda9e2,_0xc4426b){_0xdda9e2=_0xdda9e2-0x0;var _0x51a688=_0x50d1[_0xdda9e2];return _0x51a688;};'use strict';var multer=require('multer');var util=require(_0x150d('0x0'));var path=require(_0x150d('0x1'));var timeout=require(_0x150d('0x2'));var express=require('express');var router=express[_0x150d('0x3')]();var fs_extra=require(_0x150d('0x4'));var auth=require(_0x150d('0x5'));var interaction=require(_0x150d('0x6'));var config=require(_0x150d('0x7'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x150d('0x8')](),controller[_0x150d('0x9')]);router[_0x150d('0xa')](_0x150d('0xb'),auth[_0x150d('0x8')](),controller[_0x150d('0xc')]);router[_0x150d('0xa')](_0x150d('0xd'),auth[_0x150d('0x8')](),controller[_0x150d('0xe')]);router['get'](_0x150d('0xf'),auth['isAuthenticated'](),controller[_0x150d('0x10')]);router[_0x150d('0xa')](_0x150d('0x11'),auth[_0x150d('0x8')](),controller[_0x150d('0x12')]);router[_0x150d('0x13')]('/',auth['isAuthenticated'](),controller[_0x150d('0x14')]);router[_0x150d('0x15')](_0x150d('0xb'),auth[_0x150d('0x8')](),controller[_0x150d('0x16')]);router[_0x150d('0x17')]('/:id',auth[_0x150d('0x8')](),controller[_0x150d('0x18')]);module[_0x150d('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index eb70110..58733a2 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 _0x7fae=['incident','phonecall','nothing','contact','sequelize','exports','STRING','ENUM'];(function(_0x294aa8,_0x438870){var _0x2f014c=function(_0x476584){while(--_0x476584){_0x294aa8['push'](_0x294aa8['shift']());}};_0x2f014c(++_0x438870);}(_0x7fae,0x8c));var _0xe7fa=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7fae[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xe7fa('0x0'));module[_0xe7fa('0x1')]={'name':{'type':Sequelize[_0xe7fa('0x2')]},'description':{'type':Sequelize[_0xe7fa('0x2')]},'ticketType':{'type':Sequelize[_0xe7fa('0x3')](_0xe7fa('0x4'),_0xe7fa('0x5')),'defaultValue':_0xe7fa('0x4')},'moduleCreate':{'type':Sequelize[_0xe7fa('0x3')]('contact',_0xe7fa('0x6')),'defaultValue':_0xe7fa('0x7'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xe7fa('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x8655=['ENUM','phonecall','incident','contact','nothing','sequelize','exports','STRING'];(function(_0xca8f32,_0xe6ba73){var _0x4c23f8=function(_0x469c16){while(--_0x469c16){_0xca8f32['push'](_0xca8f32['shift']());}};_0x4c23f8(++_0xe6ba73);}(_0x8655,0xf5));var _0x5865=function(_0x1b975e,_0x290b08){_0x1b975e=_0x1b975e-0x0;var _0x5ae183=_0x8655[_0x1b975e];return _0x5ae183;};'use strict';var Sequelize=require(_0x5865('0x0'));module[_0x5865('0x1')]={'name':{'type':Sequelize[_0x5865('0x2')]},'description':{'type':Sequelize[_0x5865('0x2')]},'ticketType':{'type':Sequelize[_0x5865('0x3')]('incident',_0x5865('0x4')),'defaultValue':_0x5865('0x5')},'moduleCreate':{'type':Sequelize[_0x5865('0x3')](_0x5865('0x6'),_0x5865('0x7')),'defaultValue':_0x5865('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x5865('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 108effc..d49baa5 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 _0x4e83=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','status','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','map','Dynamics365Configuration','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','rawAttributes','intersection','length','include','options','create','body','params','find','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','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','../../config/license/hardware'];(function(_0xa18b1b,_0x58b8df){var _0x4ba39c=function(_0x1df47c){while(--_0x1df47c){_0xa18b1b['push'](_0xa18b1b['shift']());}};_0x4ba39c(++_0x58b8df);}(_0x4e83,0x1d5));var _0x34e8=function(_0x241207,_0x39a50c){_0x241207=_0x241207-0x0;var _0x26f4ce=_0x4e83[_0x241207];return _0x26f4ce;};'use strict';var emlformat=require(_0x34e8('0x0'));var rimraf=require(_0x34e8('0x1'));var zipdir=require(_0x34e8('0x2'));var jsonpatch=require(_0x34e8('0x3'));var rp=require(_0x34e8('0x4'));var moment=require(_0x34e8('0x5'));var BPromise=require(_0x34e8('0x6'));var Mustache=require(_0x34e8('0x7'));var util=require(_0x34e8('0x8'));var path=require(_0x34e8('0x9'));var sox=require(_0x34e8('0xa'));var csv=require(_0x34e8('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x34e8('0xc'));var _=require(_0x34e8('0xd'));var squel=require(_0x34e8('0xe'));var crypto=require(_0x34e8('0xf'));var jsforce=require(_0x34e8('0x10'));var deskjs=require(_0x34e8('0x11'));var toCsv=require(_0x34e8('0xb'));var querystring=require('querystring');var Papa=require(_0x34e8('0x12'));var Redis=require(_0x34e8('0x13'));var authService=require(_0x34e8('0x14'));var qs=require(_0x34e8('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34e8('0x16'));var logger=require(_0x34e8('0x17'))(_0x34e8('0x18'));var utils=require(_0x34e8('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x34e8('0x1a'));var db=require(_0x34e8('0x1b'))['db'];function respondWithStatusCode(_0x5edc61,_0x15d1a2){_0x15d1a2=_0x15d1a2||0xcc;return function(_0x3c73ee){if(_0x3c73ee){return _0x5edc61[_0x34e8('0x1c')](_0x15d1a2);}return _0x5edc61['status'](_0x15d1a2)['end']();};}function respondWithResult(_0x821c02,_0xa3ced9){_0xa3ced9=_0xa3ced9||0xc8;return function(_0x512d92){if(_0x512d92){return _0x821c02['status'](_0xa3ced9)[_0x34e8('0x1d')](_0x512d92);}};}function respondWithFilteredResult(_0x55bea4,_0x114b0f){return function(_0x573862){if(_0x573862){var _0xa824bf=typeof _0x114b0f[_0x34e8('0x1e')]===_0x34e8('0x1f')&&typeof _0x114b0f['limit']===_0x34e8('0x1f');var _0x4669fc=_0x573862[_0x34e8('0x20')];var _0x4924c1=_0xa824bf?0x0:_0x114b0f[_0x34e8('0x1e')];var _0x384f24=_0xa824bf?_0x573862[_0x34e8('0x20')]:_0x114b0f[_0x34e8('0x1e')]+_0x114b0f['limit'];var _0x5f0196;if(_0x384f24>=_0x4669fc){_0x384f24=_0x4669fc;_0x5f0196=0xc8;}else{_0x5f0196=0xce;}_0x55bea4[_0x34e8('0x21')](_0x5f0196);return _0x55bea4[_0x34e8('0x22')](_0x34e8('0x23'),_0x4924c1+'-'+_0x384f24+'/'+_0x4669fc)[_0x34e8('0x1d')](_0x573862);}return null;};}function patchUpdates(_0x1bca23){return function(_0x43f7b0){try{jsonpatch['apply'](_0x43f7b0,_0x1bca23,!![]);}catch(_0x608618){return BPromise[_0x34e8('0x24')](_0x608618);}return _0x43f7b0['save']();};}function saveUpdates(_0x760c90,_0x347987){return function(_0x3c2a25){if(_0x3c2a25){return _0x3c2a25[_0x34e8('0x25')](_0x760c90)[_0x34e8('0x26')](function(_0x2c29c1){return _0x2c29c1;});}return null;};}function removeEntity(_0x5e8b79,_0x2cfe57){return function(_0x3ae923){if(_0x3ae923){return _0x3ae923[_0x34e8('0x27')]()['then'](function(){_0x5e8b79[_0x34e8('0x21')](0xcc)[_0x34e8('0x28')]();});}};}function handleEntityNotFound(_0x2f05ea,_0x502133){return function(_0x11e687){if(!_0x11e687){_0x2f05ea[_0x34e8('0x1c')](0x194);}return _0x11e687;};}function handleError(_0x148767,_0x3c4eb6){_0x3c4eb6=_0x3c4eb6||0x1f4;return function(_0x4c78d1){logger[_0x34e8('0x29')](_0x4c78d1[_0x34e8('0x2a')]);if(_0x4c78d1['name']){delete _0x4c78d1[_0x34e8('0x2b')];}_0x148767[_0x34e8('0x21')](_0x3c4eb6)[_0x34e8('0x2c')](_0x4c78d1);};}exports['index']=function(_0x267a15,_0x120ed0){var _0x57fdc3={},_0x536b07={},_0x52f44f={'count':0x0,'rows':[]};var _0x16938c=_[_0x34e8('0x2d')](db[_0x34e8('0x2e')]['rawAttributes'],function(_0xa3e0b8){return{'name':_0xa3e0b8['fieldName'],'type':_0xa3e0b8[_0x34e8('0x2f')][_0x34e8('0x30')]};});_0x536b07[_0x34e8('0x31')]=_[_0x34e8('0x2d')](_0x16938c,_0x34e8('0x2b'));_0x536b07[_0x34e8('0x32')]=_[_0x34e8('0x33')](_0x267a15['query']);_0x536b07[_0x34e8('0x34')]=_['intersection'](_0x536b07[_0x34e8('0x31')],_0x536b07[_0x34e8('0x32')]);_0x57fdc3[_0x34e8('0x35')]=_['intersection'](_0x536b07[_0x34e8('0x31')],qs['fields'](_0x267a15[_0x34e8('0x32')][_0x34e8('0x36')]));_0x57fdc3['attributes']=_0x57fdc3['attributes']['length']?_0x57fdc3[_0x34e8('0x35')]:_0x536b07[_0x34e8('0x31')];if(!_0x267a15[_0x34e8('0x32')][_0x34e8('0x37')](_0x34e8('0x38'))){_0x57fdc3[_0x34e8('0x39')]=qs[_0x34e8('0x39')](_0x267a15[_0x34e8('0x32')][_0x34e8('0x39')]);_0x57fdc3['offset']=qs[_0x34e8('0x1e')](_0x267a15[_0x34e8('0x32')][_0x34e8('0x1e')]);}_0x57fdc3[_0x34e8('0x3a')]=qs['sort'](_0x267a15[_0x34e8('0x32')][_0x34e8('0x3b')]);_0x57fdc3[_0x34e8('0x3c')]=qs['filters'](_['pick'](_0x267a15[_0x34e8('0x32')],_0x536b07['filters']),_0x16938c);if(_0x267a15[_0x34e8('0x32')][_0x34e8('0x3d')]){_0x57fdc3[_0x34e8('0x3c')]=_[_0x34e8('0x3e')](_0x57fdc3['where'],{'$or':_['map'](_0x16938c,function(_0xbf3ea0){if(_0xbf3ea0[_0x34e8('0x2f')]!=='VIRTUAL'){var _0x54900d={};_0x54900d[_0xbf3ea0[_0x34e8('0x2b')]]={'$like':'%'+_0x267a15['query'][_0x34e8('0x3d')]+'%'};return _0x54900d;}})});}_0x57fdc3=_[_0x34e8('0x3e')]({},_0x57fdc3,_0x267a15['options']);var _0x4af663={'where':_0x57fdc3[_0x34e8('0x3c')]};return db[_0x34e8('0x2e')][_0x34e8('0x20')](_0x4af663)['then'](function(_0x3ebbb0){_0x52f44f[_0x34e8('0x20')]=_0x3ebbb0;if(_0x267a15[_0x34e8('0x32')][_0x34e8('0x3f')]){_0x57fdc3['include']=[{'all':!![]}];}return db[_0x34e8('0x2e')][_0x34e8('0x40')](_0x57fdc3);})['then'](function(_0x52df94){_0x52f44f[_0x34e8('0x41')]=_0x52df94;return _0x52f44f;})[_0x34e8('0x26')](respondWithFilteredResult(_0x120ed0,_0x57fdc3))[_0x34e8('0x42')](handleError(_0x120ed0,null));};exports['show']=function(_0xca091c,_0x56c373){var _0x323794={'raw':![],'where':{'id':_0xca091c['params']['id']}},_0x4f5b16={};_0x4f5b16[_0x34e8('0x31')]=_[_0x34e8('0x33')](db[_0x34e8('0x2e')][_0x34e8('0x43')]);_0x4f5b16[_0x34e8('0x32')]=_[_0x34e8('0x33')](_0xca091c[_0x34e8('0x32')]);_0x4f5b16[_0x34e8('0x34')]=_[_0x34e8('0x44')](_0x4f5b16[_0x34e8('0x31')],_0x4f5b16[_0x34e8('0x32')]);_0x323794[_0x34e8('0x35')]=_[_0x34e8('0x44')](_0x4f5b16['model'],qs[_0x34e8('0x36')](_0xca091c[_0x34e8('0x32')]['fields']));_0x323794[_0x34e8('0x35')]=_0x323794['attributes'][_0x34e8('0x45')]?_0x323794[_0x34e8('0x35')]:_0x4f5b16[_0x34e8('0x31')];if(_0xca091c[_0x34e8('0x32')][_0x34e8('0x3f')]){_0x323794[_0x34e8('0x46')]=[{'all':!![]}];}_0x323794=_[_0x34e8('0x3e')]({},_0x323794,_0xca091c[_0x34e8('0x47')]);return db[_0x34e8('0x2e')]['find'](_0x323794)[_0x34e8('0x26')](handleEntityNotFound(_0x56c373,null))['then'](respondWithResult(_0x56c373,null))[_0x34e8('0x42')](handleError(_0x56c373,null));};exports[_0x34e8('0x48')]=function(_0x205097,_0x1a703e){return db[_0x34e8('0x2e')][_0x34e8('0x48')](_0x205097[_0x34e8('0x49')],{})[_0x34e8('0x26')](respondWithResult(_0x1a703e,0xc9))[_0x34e8('0x42')](handleError(_0x1a703e,null));};exports[_0x34e8('0x25')]=function(_0x53ad7e,_0x503ec8){if(_0x53ad7e[_0x34e8('0x49')]['id']){delete _0x53ad7e['body']['id'];}return db[_0x34e8('0x2e')]['find']({'where':{'id':_0x53ad7e[_0x34e8('0x4a')]['id']}})[_0x34e8('0x26')](handleEntityNotFound(_0x503ec8,null))[_0x34e8('0x26')](saveUpdates(_0x53ad7e[_0x34e8('0x49')],null))[_0x34e8('0x26')](respondWithResult(_0x503ec8,null))[_0x34e8('0x42')](handleError(_0x503ec8,null));};exports[_0x34e8('0x27')]=function(_0x36b035,_0x2f7174){return db[_0x34e8('0x2e')][_0x34e8('0x4b')]({'where':{'id':_0x36b035[_0x34e8('0x4a')]['id']}})[_0x34e8('0x26')](handleEntityNotFound(_0x2f7174,null))[_0x34e8('0x26')](removeEntity(_0x2f7174,null))['catch'](handleError(_0x2f7174,null));};exports[_0x34e8('0x4c')]=function(_0xe8ff86,_0x43850a,_0x5d9b57){var _0x46f95b={};var _0x963669={};var _0x596d16;var _0x26360d;return db[_0x34e8('0x2e')][_0x34e8('0x4d')]({'where':{'id':_0xe8ff86['params']['id']}})[_0x34e8('0x26')](handleEntityNotFound(_0x43850a,null))['then'](function(_0x4799db){if(_0x4799db){_0x596d16=_0x4799db;_0x963669[_0x34e8('0x31')]=_[_0x34e8('0x33')](db[_0x34e8('0x4e')][_0x34e8('0x43')]);_0x963669[_0x34e8('0x32')]=_[_0x34e8('0x33')](_0xe8ff86[_0x34e8('0x32')]);_0x963669[_0x34e8('0x34')]=_[_0x34e8('0x44')](_0x963669[_0x34e8('0x31')],_0x963669[_0x34e8('0x32')]);_0x46f95b[_0x34e8('0x35')]=_[_0x34e8('0x44')](_0x963669[_0x34e8('0x31')],qs[_0x34e8('0x36')](_0xe8ff86['query'][_0x34e8('0x36')]));_0x46f95b[_0x34e8('0x35')]=_0x46f95b['attributes'][_0x34e8('0x45')]?_0x46f95b[_0x34e8('0x35')]:_0x963669[_0x34e8('0x31')];_0x46f95b['order']=qs['sort'](_0xe8ff86[_0x34e8('0x32')]['sort']);_0x46f95b['where']=qs[_0x34e8('0x34')](_[_0x34e8('0x4f')](_0xe8ff86[_0x34e8('0x32')],_0x963669[_0x34e8('0x34')]));if(_0xe8ff86[_0x34e8('0x32')][_0x34e8('0x3d')]){_0x46f95b['where']=_[_0x34e8('0x3e')](_0x46f95b[_0x34e8('0x3c')],{'$or':_['map'](_0x46f95b[_0x34e8('0x35')],function(_0x2ebcca){var _0x18f0e3={};_0x18f0e3[_0x2ebcca]={'$like':'%'+_0xe8ff86[_0x34e8('0x32')]['filter']+'%'};return _0x18f0e3;})});}_0x46f95b=_[_0x34e8('0x3e')]({},_0x46f95b,_0xe8ff86[_0x34e8('0x47')]);return _0x596d16[_0x34e8('0x4c')](_0x46f95b);}})[_0x34e8('0x26')](function(_0x226445){if(_0x226445){_0x26360d=_0x226445[_0x34e8('0x45')];if(!_0xe8ff86[_0x34e8('0x32')][_0x34e8('0x37')](_0x34e8('0x38'))){_0x46f95b['limit']=qs['limit'](_0xe8ff86[_0x34e8('0x32')][_0x34e8('0x39')]);_0x46f95b['offset']=qs[_0x34e8('0x1e')](_0xe8ff86[_0x34e8('0x32')][_0x34e8('0x1e')]);}return _0x596d16['getFields'](_0x46f95b);}})[_0x34e8('0x26')](function(_0x5a604c){if(_0x5a604c){return _0x5a604c?{'count':_0x26360d,'rows':_0x5a604c}:null;}})[_0x34e8('0x26')](respondWithResult(_0x43850a,null))[_0x34e8('0x42')](handleError(_0x43850a,null));};exports[_0x34e8('0x50')]=function(_0x3da198,_0x50f61b,_0x47cde7){var _0xd5460={};var _0x40bbe2={};var _0x5242ec;var _0x1f1ab6;return db[_0x34e8('0x2e')][_0x34e8('0x4d')]({'where':{'id':_0x3da198['params']['id']}})['then'](handleEntityNotFound(_0x50f61b,null))['then'](function(_0x5a6e9c){if(_0x5a6e9c){_0x5242ec=_0x5a6e9c;_0x40bbe2[_0x34e8('0x31')]=_[_0x34e8('0x33')](db['Dynamics365Field'][_0x34e8('0x43')]);_0x40bbe2['query']=_['keys'](_0x3da198[_0x34e8('0x32')]);_0x40bbe2[_0x34e8('0x34')]=_[_0x34e8('0x44')](_0x40bbe2[_0x34e8('0x31')],_0x40bbe2[_0x34e8('0x32')]);_0xd5460[_0x34e8('0x35')]=_[_0x34e8('0x44')](_0x40bbe2[_0x34e8('0x31')],qs[_0x34e8('0x36')](_0x3da198['query'][_0x34e8('0x36')]));_0xd5460[_0x34e8('0x35')]=_0xd5460[_0x34e8('0x35')]['length']?_0xd5460[_0x34e8('0x35')]:_0x40bbe2['model'];_0xd5460[_0x34e8('0x3a')]=qs[_0x34e8('0x3b')](_0x3da198['query'][_0x34e8('0x3b')]);_0xd5460[_0x34e8('0x3c')]=qs[_0x34e8('0x34')](_[_0x34e8('0x4f')](_0x3da198[_0x34e8('0x32')],_0x40bbe2[_0x34e8('0x34')]));if(_0x3da198[_0x34e8('0x32')][_0x34e8('0x3d')]){_0xd5460[_0x34e8('0x3c')]=_[_0x34e8('0x3e')](_0xd5460[_0x34e8('0x3c')],{'$or':_[_0x34e8('0x2d')](_0xd5460[_0x34e8('0x35')],function(_0x20390a){var _0x33e8e3={};_0x33e8e3[_0x20390a]={'$like':'%'+_0x3da198['query'][_0x34e8('0x3d')]+'%'};return _0x33e8e3;})});}_0xd5460=_[_0x34e8('0x3e')]({},_0xd5460,_0x3da198[_0x34e8('0x47')]);return _0x5242ec[_0x34e8('0x50')](_0xd5460);}})['then'](function(_0x2e18f1){if(_0x2e18f1){_0x1f1ab6=_0x2e18f1[_0x34e8('0x45')];if(!_0x3da198[_0x34e8('0x32')][_0x34e8('0x37')](_0x34e8('0x38'))){_0xd5460[_0x34e8('0x39')]=qs['limit'](_0x3da198[_0x34e8('0x32')]['limit']);_0xd5460[_0x34e8('0x1e')]=qs[_0x34e8('0x1e')](_0x3da198[_0x34e8('0x32')]['offset']);}return _0x5242ec[_0x34e8('0x50')](_0xd5460);}})[_0x34e8('0x26')](function(_0x4a549d){if(_0x4a549d){return _0x4a549d?{'count':_0x1f1ab6,'rows':_0x4a549d}:null;}})[_0x34e8('0x26')](respondWithResult(_0x50f61b,null))[_0x34e8('0x42')](handleError(_0x50f61b,null));};exports[_0x34e8('0x51')]=function(_0x27d3fd,_0x64177f,_0x27c1d6){var _0x5bfe82={};var _0xcdbeeb={};var _0x195506;var _0x451647;return db[_0x34e8('0x2e')][_0x34e8('0x4d')]({'where':{'id':_0x27d3fd[_0x34e8('0x4a')]['id']}})[_0x34e8('0x26')](handleEntityNotFound(_0x64177f,null))[_0x34e8('0x26')](function(_0xbaf3e3){if(_0xbaf3e3){_0x195506=_0xbaf3e3;_0xcdbeeb['model']=_[_0x34e8('0x33')](db[_0x34e8('0x4e')][_0x34e8('0x43')]);_0xcdbeeb[_0x34e8('0x32')]=_[_0x34e8('0x33')](_0x27d3fd['query']);_0xcdbeeb[_0x34e8('0x34')]=_[_0x34e8('0x44')](_0xcdbeeb[_0x34e8('0x31')],_0xcdbeeb[_0x34e8('0x32')]);_0x5bfe82[_0x34e8('0x35')]=_[_0x34e8('0x44')](_0xcdbeeb[_0x34e8('0x31')],qs['fields'](_0x27d3fd[_0x34e8('0x32')]['fields']));_0x5bfe82['attributes']=_0x5bfe82['attributes']['length']?_0x5bfe82[_0x34e8('0x35')]:_0xcdbeeb['model'];_0x5bfe82[_0x34e8('0x3a')]=qs[_0x34e8('0x3b')](_0x27d3fd[_0x34e8('0x32')]['sort']);_0x5bfe82[_0x34e8('0x3c')]=qs[_0x34e8('0x34')](_[_0x34e8('0x4f')](_0x27d3fd[_0x34e8('0x32')],_0xcdbeeb[_0x34e8('0x34')]));if(_0x27d3fd['query']['filter']){_0x5bfe82[_0x34e8('0x3c')]=_['merge'](_0x5bfe82[_0x34e8('0x3c')],{'$or':_['map'](_0x5bfe82[_0x34e8('0x35')],function(_0x251579){var _0x1306f2={};_0x1306f2[_0x251579]={'$like':'%'+_0x27d3fd[_0x34e8('0x32')][_0x34e8('0x3d')]+'%'};return _0x1306f2;})});}_0x5bfe82=_[_0x34e8('0x3e')]({},_0x5bfe82,_0x27d3fd['options']);return _0x195506[_0x34e8('0x51')](_0x5bfe82);}})[_0x34e8('0x26')](function(_0x2264d1){if(_0x2264d1){_0x451647=_0x2264d1[_0x34e8('0x45')];if(!_0x27d3fd[_0x34e8('0x32')]['hasOwnProperty'](_0x34e8('0x38'))){_0x5bfe82['limit']=qs[_0x34e8('0x39')](_0x27d3fd[_0x34e8('0x32')][_0x34e8('0x39')]);_0x5bfe82[_0x34e8('0x1e')]=qs[_0x34e8('0x1e')](_0x27d3fd[_0x34e8('0x32')][_0x34e8('0x1e')]);}return _0x195506[_0x34e8('0x51')](_0x5bfe82);}})[_0x34e8('0x26')](function(_0x2b466d){if(_0x2b466d){return _0x2b466d?{'count':_0x451647,'rows':_0x2b466d}:null;}})[_0x34e8('0x26')](respondWithResult(_0x64177f,null))['catch'](handleError(_0x64177f,null));}; \ No newline at end of file +var _0xd0c2=['key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','VIRTUAL','merge','options','Dynamics365Configuration','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','findOne','Dynamics365Field','sort','hasOwnProperty','getFields','getSubjects','rawAttributes','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','then','destroy','error','name','index','map','fieldName','type'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xd0c2,0x1c4));var _0x2d0c=function(_0x5e761b,_0x355e38){_0x5e761b=_0x5e761b-0x0;var _0x98502c=_0xd0c2[_0x5e761b];return _0x98502c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d0c('0x0'));var zipdir=require(_0x2d0c('0x1'));var jsonpatch=require(_0x2d0c('0x2'));var rp=require(_0x2d0c('0x3'));var moment=require('moment');var BPromise=require(_0x2d0c('0x4'));var Mustache=require(_0x2d0c('0x5'));var util=require(_0x2d0c('0x6'));var path=require(_0x2d0c('0x7'));var sox=require(_0x2d0c('0x8'));var csv=require(_0x2d0c('0x9'));var ejs=require(_0x2d0c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d0c('0xb'));var squel=require(_0x2d0c('0xc'));var crypto=require(_0x2d0c('0xd'));var jsforce=require(_0x2d0c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2d0c('0x9'));var querystring=require(_0x2d0c('0xf'));var Papa=require(_0x2d0c('0x10'));var Redis=require(_0x2d0c('0x11'));var authService=require(_0x2d0c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2d0c('0x13'));var hardwareService=require(_0x2d0c('0x14'));var logger=require(_0x2d0c('0x15'))(_0x2d0c('0x16'));var utils=require(_0x2d0c('0x17'));var config=require(_0x2d0c('0x18'));var licenseUtil=require(_0x2d0c('0x19'));var db=require(_0x2d0c('0x1a'))['db'];function respondWithStatusCode(_0x4eee42,_0x4d135f){_0x4d135f=_0x4d135f||0xcc;return function(_0x2b668a){if(_0x2b668a){return _0x4eee42[_0x2d0c('0x1b')](_0x4d135f);}return _0x4eee42['status'](_0x4d135f)[_0x2d0c('0x1c')]();};}function respondWithResult(_0x15f78c,_0x21b475){_0x21b475=_0x21b475||0xc8;return function(_0x3135fb){if(_0x3135fb){return _0x15f78c['status'](_0x21b475)[_0x2d0c('0x1d')](_0x3135fb);}};}function respondWithFilteredResult(_0x578c22,_0x23494b){return function(_0x161205){if(_0x161205){var _0x368972=typeof _0x23494b[_0x2d0c('0x1e')]===_0x2d0c('0x1f')&&typeof _0x23494b['limit']===_0x2d0c('0x1f');var _0xf403df=_0x161205['count'];var _0x962e70=_0x368972?0x0:_0x23494b['offset'];var _0x163ead=_0x368972?_0x161205[_0x2d0c('0x20')]:_0x23494b['offset']+_0x23494b[_0x2d0c('0x21')];var _0x148430;if(_0x163ead>=_0xf403df){_0x163ead=_0xf403df;_0x148430=0xc8;}else{_0x148430=0xce;}_0x578c22[_0x2d0c('0x22')](_0x148430);return _0x578c22[_0x2d0c('0x23')](_0x2d0c('0x24'),_0x962e70+'-'+_0x163ead+'/'+_0xf403df)[_0x2d0c('0x1d')](_0x161205);}return null;};}function patchUpdates(_0x38966f){return function(_0x120cf4){try{jsonpatch[_0x2d0c('0x25')](_0x120cf4,_0x38966f,!![]);}catch(_0x5cb9e2){return BPromise['reject'](_0x5cb9e2);}return _0x120cf4['save']();};}function saveUpdates(_0x19bd20,_0x2839ad){return function(_0x299f35){if(_0x299f35){return _0x299f35['update'](_0x19bd20)[_0x2d0c('0x26')](function(_0x569ae4){return _0x569ae4;});}return null;};}function removeEntity(_0x4b6e4a,_0x270155){return function(_0x21014a){if(_0x21014a){return _0x21014a[_0x2d0c('0x27')]()[_0x2d0c('0x26')](function(){_0x4b6e4a[_0x2d0c('0x22')](0xcc)[_0x2d0c('0x1c')]();});}};}function handleEntityNotFound(_0x443322,_0x528eb6){return function(_0x4c988d){if(!_0x4c988d){_0x443322['sendStatus'](0x194);}return _0x4c988d;};}function handleError(_0x76adf6,_0x17ef9f){_0x17ef9f=_0x17ef9f||0x1f4;return function(_0x3376d1){logger[_0x2d0c('0x28')](_0x3376d1['stack']);if(_0x3376d1['name']){delete _0x3376d1[_0x2d0c('0x29')];}_0x76adf6[_0x2d0c('0x22')](_0x17ef9f)['send'](_0x3376d1);};}exports[_0x2d0c('0x2a')]=function(_0x4b8957,_0xcf1d7c){var _0xb0a585={},_0x3abc3f={},_0x28faa7={'count':0x0,'rows':[]};var _0x29c58d=_[_0x2d0c('0x2b')](db['Dynamics365Configuration']['rawAttributes'],function(_0x1a13bd){return{'name':_0x1a13bd[_0x2d0c('0x2c')],'type':_0x1a13bd[_0x2d0c('0x2d')][_0x2d0c('0x2e')]};});_0x3abc3f[_0x2d0c('0x2f')]=_[_0x2d0c('0x2b')](_0x29c58d,_0x2d0c('0x29'));_0x3abc3f['query']=_[_0x2d0c('0x30')](_0x4b8957[_0x2d0c('0x31')]);_0x3abc3f[_0x2d0c('0x32')]=_[_0x2d0c('0x33')](_0x3abc3f[_0x2d0c('0x2f')],_0x3abc3f['query']);_0xb0a585[_0x2d0c('0x34')]=_['intersection'](_0x3abc3f[_0x2d0c('0x2f')],qs[_0x2d0c('0x35')](_0x4b8957[_0x2d0c('0x31')][_0x2d0c('0x35')]));_0xb0a585['attributes']=_0xb0a585[_0x2d0c('0x34')][_0x2d0c('0x36')]?_0xb0a585[_0x2d0c('0x34')]:_0x3abc3f[_0x2d0c('0x2f')];if(!_0x4b8957[_0x2d0c('0x31')]['hasOwnProperty'](_0x2d0c('0x37'))){_0xb0a585[_0x2d0c('0x21')]=qs[_0x2d0c('0x21')](_0x4b8957[_0x2d0c('0x31')][_0x2d0c('0x21')]);_0xb0a585[_0x2d0c('0x1e')]=qs[_0x2d0c('0x1e')](_0x4b8957[_0x2d0c('0x31')][_0x2d0c('0x1e')]);}_0xb0a585[_0x2d0c('0x38')]=qs['sort'](_0x4b8957[_0x2d0c('0x31')]['sort']);_0xb0a585['where']=qs[_0x2d0c('0x32')](_[_0x2d0c('0x39')](_0x4b8957[_0x2d0c('0x31')],_0x3abc3f[_0x2d0c('0x32')]),_0x29c58d);if(_0x4b8957[_0x2d0c('0x31')][_0x2d0c('0x3a')]){_0xb0a585[_0x2d0c('0x3b')]=_['merge'](_0xb0a585[_0x2d0c('0x3b')],{'$or':_['map'](_0x29c58d,function(_0x2fb1cf){if(_0x2fb1cf['type']!==_0x2d0c('0x3c')){var _0x7abc2={};_0x7abc2[_0x2fb1cf[_0x2d0c('0x29')]]={'$like':'%'+_0x4b8957[_0x2d0c('0x31')]['filter']+'%'};return _0x7abc2;}})});}_0xb0a585=_[_0x2d0c('0x3d')]({},_0xb0a585,_0x4b8957[_0x2d0c('0x3e')]);var _0x39d6f5={'where':_0xb0a585[_0x2d0c('0x3b')]};return db[_0x2d0c('0x3f')][_0x2d0c('0x20')](_0x39d6f5)[_0x2d0c('0x26')](function(_0x2ad5cd){_0x28faa7[_0x2d0c('0x20')]=_0x2ad5cd;if(_0x4b8957[_0x2d0c('0x31')][_0x2d0c('0x40')]){_0xb0a585[_0x2d0c('0x41')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x2d0c('0x42')](_0xb0a585);})[_0x2d0c('0x26')](function(_0x445dfb){_0x28faa7[_0x2d0c('0x43')]=_0x445dfb;return _0x28faa7;})[_0x2d0c('0x26')](respondWithFilteredResult(_0xcf1d7c,_0xb0a585))[_0x2d0c('0x44')](handleError(_0xcf1d7c,null));};exports[_0x2d0c('0x45')]=function(_0x193230,_0x3bfa94){var _0x44ed2e={'raw':![],'where':{'id':_0x193230[_0x2d0c('0x46')]['id']}},_0x3a359a={};_0x3a359a[_0x2d0c('0x2f')]=_[_0x2d0c('0x30')](db[_0x2d0c('0x3f')]['rawAttributes']);_0x3a359a[_0x2d0c('0x31')]=_[_0x2d0c('0x30')](_0x193230[_0x2d0c('0x31')]);_0x3a359a[_0x2d0c('0x32')]=_['intersection'](_0x3a359a[_0x2d0c('0x2f')],_0x3a359a[_0x2d0c('0x31')]);_0x44ed2e[_0x2d0c('0x34')]=_[_0x2d0c('0x33')](_0x3a359a['model'],qs[_0x2d0c('0x35')](_0x193230[_0x2d0c('0x31')][_0x2d0c('0x35')]));_0x44ed2e[_0x2d0c('0x34')]=_0x44ed2e[_0x2d0c('0x34')][_0x2d0c('0x36')]?_0x44ed2e[_0x2d0c('0x34')]:_0x3a359a['model'];if(_0x193230['query']['includeAll']){_0x44ed2e[_0x2d0c('0x41')]=[{'all':!![]}];}_0x44ed2e=_[_0x2d0c('0x3d')]({},_0x44ed2e,_0x193230[_0x2d0c('0x3e')]);return db[_0x2d0c('0x3f')]['find'](_0x44ed2e)[_0x2d0c('0x26')](handleEntityNotFound(_0x3bfa94,null))[_0x2d0c('0x26')](respondWithResult(_0x3bfa94,null))['catch'](handleError(_0x3bfa94,null));};exports[_0x2d0c('0x47')]=function(_0x4012ca,_0x826e60){return db['Dynamics365Configuration'][_0x2d0c('0x47')](_0x4012ca[_0x2d0c('0x48')],{})['then'](respondWithResult(_0x826e60,0xc9))[_0x2d0c('0x44')](handleError(_0x826e60,null));};exports[_0x2d0c('0x49')]=function(_0x4fc65c,_0x14eb5f){if(_0x4fc65c['body']['id']){delete _0x4fc65c[_0x2d0c('0x48')]['id'];}return db['Dynamics365Configuration'][_0x2d0c('0x4a')]({'where':{'id':_0x4fc65c[_0x2d0c('0x46')]['id']}})['then'](handleEntityNotFound(_0x14eb5f,null))[_0x2d0c('0x26')](saveUpdates(_0x4fc65c[_0x2d0c('0x48')],null))['then'](respondWithResult(_0x14eb5f,null))[_0x2d0c('0x44')](handleError(_0x14eb5f,null));};exports[_0x2d0c('0x27')]=function(_0x258cf6,_0x501234){return db['Dynamics365Configuration'][_0x2d0c('0x4a')]({'where':{'id':_0x258cf6[_0x2d0c('0x46')]['id']}})['then'](handleEntityNotFound(_0x501234,null))[_0x2d0c('0x26')](removeEntity(_0x501234,null))[_0x2d0c('0x44')](handleError(_0x501234,null));};exports['getFields']=function(_0x534702,_0x144d8c,_0x180fbf){var _0x37c403={};var _0x2aac20={};var _0x1fbf8e;var _0x4e52e5;return db['Dynamics365Configuration'][_0x2d0c('0x4b')]({'where':{'id':_0x534702[_0x2d0c('0x46')]['id']}})[_0x2d0c('0x26')](handleEntityNotFound(_0x144d8c,null))[_0x2d0c('0x26')](function(_0x342fb5){if(_0x342fb5){_0x1fbf8e=_0x342fb5;_0x2aac20[_0x2d0c('0x2f')]=_[_0x2d0c('0x30')](db[_0x2d0c('0x4c')]['rawAttributes']);_0x2aac20['query']=_[_0x2d0c('0x30')](_0x534702[_0x2d0c('0x31')]);_0x2aac20[_0x2d0c('0x32')]=_['intersection'](_0x2aac20[_0x2d0c('0x2f')],_0x2aac20[_0x2d0c('0x31')]);_0x37c403[_0x2d0c('0x34')]=_[_0x2d0c('0x33')](_0x2aac20[_0x2d0c('0x2f')],qs['fields'](_0x534702[_0x2d0c('0x31')][_0x2d0c('0x35')]));_0x37c403[_0x2d0c('0x34')]=_0x37c403['attributes'][_0x2d0c('0x36')]?_0x37c403[_0x2d0c('0x34')]:_0x2aac20[_0x2d0c('0x2f')];_0x37c403['order']=qs[_0x2d0c('0x4d')](_0x534702[_0x2d0c('0x31')][_0x2d0c('0x4d')]);_0x37c403['where']=qs[_0x2d0c('0x32')](_['pick'](_0x534702[_0x2d0c('0x31')],_0x2aac20[_0x2d0c('0x32')]));if(_0x534702[_0x2d0c('0x31')]['filter']){_0x37c403[_0x2d0c('0x3b')]=_[_0x2d0c('0x3d')](_0x37c403[_0x2d0c('0x3b')],{'$or':_[_0x2d0c('0x2b')](_0x37c403[_0x2d0c('0x34')],function(_0x4cd5c4){var _0x2804ed={};_0x2804ed[_0x4cd5c4]={'$like':'%'+_0x534702[_0x2d0c('0x31')]['filter']+'%'};return _0x2804ed;})});}_0x37c403=_[_0x2d0c('0x3d')]({},_0x37c403,_0x534702[_0x2d0c('0x3e')]);return _0x1fbf8e['getFields'](_0x37c403);}})[_0x2d0c('0x26')](function(_0x306a5e){if(_0x306a5e){_0x4e52e5=_0x306a5e['length'];if(!_0x534702[_0x2d0c('0x31')][_0x2d0c('0x4e')]('nolimit')){_0x37c403[_0x2d0c('0x21')]=qs[_0x2d0c('0x21')](_0x534702['query'][_0x2d0c('0x21')]);_0x37c403['offset']=qs['offset'](_0x534702[_0x2d0c('0x31')]['offset']);}return _0x1fbf8e[_0x2d0c('0x4f')](_0x37c403);}})[_0x2d0c('0x26')](function(_0x18cacd){if(_0x18cacd){return _0x18cacd?{'count':_0x4e52e5,'rows':_0x18cacd}:null;}})['then'](respondWithResult(_0x144d8c,null))[_0x2d0c('0x44')](handleError(_0x144d8c,null));};exports[_0x2d0c('0x50')]=function(_0x496dd6,_0x2335cd,_0x406040){var _0x38aa00={};var _0x3f4a39={};var _0x15663f;var _0x41a964;return db[_0x2d0c('0x3f')]['findOne']({'where':{'id':_0x496dd6[_0x2d0c('0x46')]['id']}})['then'](handleEntityNotFound(_0x2335cd,null))['then'](function(_0xbaf027){if(_0xbaf027){_0x15663f=_0xbaf027;_0x3f4a39[_0x2d0c('0x2f')]=_['keys'](db[_0x2d0c('0x4c')][_0x2d0c('0x51')]);_0x3f4a39[_0x2d0c('0x31')]=_[_0x2d0c('0x30')](_0x496dd6['query']);_0x3f4a39[_0x2d0c('0x32')]=_[_0x2d0c('0x33')](_0x3f4a39['model'],_0x3f4a39[_0x2d0c('0x31')]);_0x38aa00[_0x2d0c('0x34')]=_[_0x2d0c('0x33')](_0x3f4a39[_0x2d0c('0x2f')],qs[_0x2d0c('0x35')](_0x496dd6[_0x2d0c('0x31')][_0x2d0c('0x35')]));_0x38aa00['attributes']=_0x38aa00[_0x2d0c('0x34')]['length']?_0x38aa00[_0x2d0c('0x34')]:_0x3f4a39['model'];_0x38aa00[_0x2d0c('0x38')]=qs[_0x2d0c('0x4d')](_0x496dd6['query'][_0x2d0c('0x4d')]);_0x38aa00['where']=qs['filters'](_['pick'](_0x496dd6[_0x2d0c('0x31')],_0x3f4a39[_0x2d0c('0x32')]));if(_0x496dd6[_0x2d0c('0x31')][_0x2d0c('0x3a')]){_0x38aa00[_0x2d0c('0x3b')]=_['merge'](_0x38aa00['where'],{'$or':_[_0x2d0c('0x2b')](_0x38aa00[_0x2d0c('0x34')],function(_0x46c8fa){var _0x50e75c={};_0x50e75c[_0x46c8fa]={'$like':'%'+_0x496dd6[_0x2d0c('0x31')][_0x2d0c('0x3a')]+'%'};return _0x50e75c;})});}_0x38aa00=_['merge']({},_0x38aa00,_0x496dd6[_0x2d0c('0x3e')]);return _0x15663f['getSubjects'](_0x38aa00);}})[_0x2d0c('0x26')](function(_0x2ce966){if(_0x2ce966){_0x41a964=_0x2ce966[_0x2d0c('0x36')];if(!_0x496dd6[_0x2d0c('0x31')][_0x2d0c('0x4e')](_0x2d0c('0x37'))){_0x38aa00['limit']=qs[_0x2d0c('0x21')](_0x496dd6[_0x2d0c('0x31')][_0x2d0c('0x21')]);_0x38aa00[_0x2d0c('0x1e')]=qs['offset'](_0x496dd6[_0x2d0c('0x31')][_0x2d0c('0x1e')]);}return _0x15663f[_0x2d0c('0x50')](_0x38aa00);}})['then'](function(_0x2fa1f8){if(_0x2fa1f8){return _0x2fa1f8?{'count':_0x41a964,'rows':_0x2fa1f8}:null;}})['then'](respondWithResult(_0x2335cd,null))[_0x2d0c('0x44')](handleError(_0x2335cd,null));};exports[_0x2d0c('0x52')]=function(_0x5854fd,_0x177142,_0x33be3a){var _0x25bb6e={};var _0x58311f={};var _0x566fc5;var _0x27b093;return db[_0x2d0c('0x3f')][_0x2d0c('0x4b')]({'where':{'id':_0x5854fd[_0x2d0c('0x46')]['id']}})[_0x2d0c('0x26')](handleEntityNotFound(_0x177142,null))[_0x2d0c('0x26')](function(_0xb27af3){if(_0xb27af3){_0x566fc5=_0xb27af3;_0x58311f[_0x2d0c('0x2f')]=_[_0x2d0c('0x30')](db['Dynamics365Field'][_0x2d0c('0x51')]);_0x58311f[_0x2d0c('0x31')]=_[_0x2d0c('0x30')](_0x5854fd[_0x2d0c('0x31')]);_0x58311f['filters']=_[_0x2d0c('0x33')](_0x58311f[_0x2d0c('0x2f')],_0x58311f[_0x2d0c('0x31')]);_0x25bb6e[_0x2d0c('0x34')]=_[_0x2d0c('0x33')](_0x58311f[_0x2d0c('0x2f')],qs[_0x2d0c('0x35')](_0x5854fd[_0x2d0c('0x31')][_0x2d0c('0x35')]));_0x25bb6e[_0x2d0c('0x34')]=_0x25bb6e[_0x2d0c('0x34')][_0x2d0c('0x36')]?_0x25bb6e[_0x2d0c('0x34')]:_0x58311f[_0x2d0c('0x2f')];_0x25bb6e[_0x2d0c('0x38')]=qs['sort'](_0x5854fd[_0x2d0c('0x31')][_0x2d0c('0x4d')]);_0x25bb6e['where']=qs[_0x2d0c('0x32')](_[_0x2d0c('0x39')](_0x5854fd[_0x2d0c('0x31')],_0x58311f[_0x2d0c('0x32')]));if(_0x5854fd['query'][_0x2d0c('0x3a')]){_0x25bb6e[_0x2d0c('0x3b')]=_['merge'](_0x25bb6e['where'],{'$or':_[_0x2d0c('0x2b')](_0x25bb6e[_0x2d0c('0x34')],function(_0x294852){var _0x17bd98={};_0x17bd98[_0x294852]={'$like':'%'+_0x5854fd['query'][_0x2d0c('0x3a')]+'%'};return _0x17bd98;})});}_0x25bb6e=_[_0x2d0c('0x3d')]({},_0x25bb6e,_0x5854fd['options']);return _0x566fc5[_0x2d0c('0x52')](_0x25bb6e);}})['then'](function(_0x93d2ab){if(_0x93d2ab){_0x27b093=_0x93d2ab[_0x2d0c('0x36')];if(!_0x5854fd[_0x2d0c('0x31')]['hasOwnProperty'](_0x2d0c('0x37'))){_0x25bb6e[_0x2d0c('0x21')]=qs[_0x2d0c('0x21')](_0x5854fd[_0x2d0c('0x31')][_0x2d0c('0x21')]);_0x25bb6e[_0x2d0c('0x1e')]=qs['offset'](_0x5854fd['query']['offset']);}return _0x566fc5[_0x2d0c('0x52')](_0x25bb6e);}})['then'](function(_0x17d6ee){if(_0x17d6ee){return _0x17d6ee?{'count':_0x27b093,'rows':_0x17d6ee}:null;}})['then'](respondWithResult(_0x177142,null))[_0x2d0c('0x44')](handleError(_0x177142,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index acce6bf..e7ce46f 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 _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x1ed464,_0x47ef91){var _0x37875e=function(_0x1e399a){while(--_0x1e399a){_0x1ed464['push'](_0x1ed464['shift']());}};_0x37875e(++_0x47ef91);}(_0xaa88,0x137));var _0x8aa8=function(_0x3f465d,_0xbd2037){_0x3f465d=_0x3f465d-0x0;var _0x121ad1=_0xaa88[_0x3f465d];return _0x121ad1;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x37a669,_0x3a0430){var _0x323c24=function(_0x561635){while(--_0x561635){_0x37a669['push'](_0x37a669['shift']());}};_0x323c24(++_0x3a0430);}(_0x00bb,0x1d8));var _0xb00b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x00bb[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('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 2110ecf..5b83c06 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 _0x6da2=['rpc','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x6da2,0x187));var _0x26da=function(_0x411b75,_0x4de4ca){_0x411b75=_0x411b75-0x0;var _0x5a9239=_0x6da2[_0x411b75];return _0x5a9239;};'use strict';var _=require(_0x26da('0x0'));var util=require(_0x26da('0x1'));var moment=require(_0x26da('0x2'));var BPromise=require(_0x26da('0x3'));var rs=require(_0x26da('0x4'));var fs=require('fs');var Redis=require(_0x26da('0x5'));var db=require(_0x26da('0x6'))['db'];var utils=require(_0x26da('0x7'));var logger=require(_0x26da('0x8'))(_0x26da('0x9'));var config=require('../../config/environment');var jayson=require(_0x26da('0xa'));var client=jayson[_0x26da('0xb')][_0x26da('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x251c25,_0x1305c5,_0x1e92a8){return new BPromise(function(_0x3496c3,_0x33eb3b){return client[_0x26da('0xd')](_0x251c25,_0x1e92a8)[_0x26da('0xe')](function(_0x7ee538){logger[_0x26da('0xf')](_0x26da('0x10'),_0x1305c5,'request\x20sent');logger[_0x26da('0x11')](_0x26da('0x12'),_0x1305c5,_0x26da('0x13'),JSON[_0x26da('0x14')](_0x7ee538));if(_0x7ee538[_0x26da('0x15')]){if(_0x7ee538[_0x26da('0x15')][_0x26da('0x16')]===0x1f4){logger[_0x26da('0x15')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1305c5,_0x7ee538[_0x26da('0x15')]['message']);return _0x33eb3b(_0x7ee538[_0x26da('0x15')]['message']);}logger[_0x26da('0x15')](_0x26da('0x10'),_0x1305c5,_0x7ee538[_0x26da('0x15')][_0x26da('0x17')]);return _0x3496c3(_0x7ee538[_0x26da('0x15')][_0x26da('0x17')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x1305c5,_0x26da('0x13'));_0x3496c3(_0x7ee538['result'][_0x26da('0x17')]);}})[_0x26da('0x18')](function(_0x5b9cf1){logger[_0x26da('0x15')](_0x26da('0x10'),_0x1305c5,_0x5b9cf1);_0x33eb3b(_0x5b9cf1);});});} \ No newline at end of file +var _0x1397=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x20a791,_0x49718f){var _0xe0f198=function(_0x26e103){while(--_0x26e103){_0x20a791['push'](_0x20a791['shift']());}};_0xe0f198(++_0x49718f);}(_0x1397,0x1e2));var _0x7139=function(_0x5ccdd0,_0x23a0ba){_0x5ccdd0=_0x5ccdd0-0x0;var _0x4788ea=_0x1397[_0x5ccdd0];return _0x4788ea;};'use strict';var _=require('lodash');var util=require(_0x7139('0x0'));var moment=require(_0x7139('0x1'));var BPromise=require(_0x7139('0x2'));var rs=require(_0x7139('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7139('0x4'))['db'];var utils=require(_0x7139('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7139('0x6'));var jayson=require(_0x7139('0x7'));var client=jayson[_0x7139('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a5fb8,_0x25a474,_0x124992){return new BPromise(function(_0x2ff928,_0x44eadf){return client[_0x7139('0x9')](_0x1a5fb8,_0x124992)[_0x7139('0xa')](function(_0x9ef7d9){logger[_0x7139('0xb')](_0x7139('0xc'),_0x25a474,_0x7139('0xd'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x25a474,'request\x20sent',JSON[_0x7139('0xe')](_0x9ef7d9));if(_0x9ef7d9[_0x7139('0xf')]){if(_0x9ef7d9['error'][_0x7139('0x10')]===0x1f4){logger[_0x7139('0xf')](_0x7139('0xc'),_0x25a474,_0x9ef7d9[_0x7139('0xf')][_0x7139('0x11')]);return _0x44eadf(_0x9ef7d9['error'][_0x7139('0x11')]);}logger[_0x7139('0xf')](_0x7139('0xc'),_0x25a474,_0x9ef7d9['error'][_0x7139('0x11')]);return _0x2ff928(_0x9ef7d9[_0x7139('0xf')]['message']);}else{logger[_0x7139('0xb')](_0x7139('0xc'),_0x25a474,_0x7139('0xd'));_0x2ff928(_0x9ef7d9[_0x7139('0x12')][_0x7139('0x11')]);}})['catch'](function(_0x33422b){logger[_0x7139('0xf')](_0x7139('0xc'),_0x25a474,_0x33422b);_0x44eadf(_0x33422b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 8e35904..0784905 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 _0xf236=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xf236,0x1dd));var _0x6f23=function(_0x2abaae,_0x29fd8b){_0x2abaae=_0x2abaae-0x0;var _0x5b5745=_0xf236[_0x2abaae];return _0x5b5745;};'use strict';var multer=require(_0x6f23('0x0'));var util=require('util');var path=require(_0x6f23('0x1'));var timeout=require(_0x6f23('0x2'));var express=require(_0x6f23('0x3'));var router=express[_0x6f23('0x4')]();var fs_extra=require(_0x6f23('0x5'));var auth=require(_0x6f23('0x6'));var interaction=require(_0x6f23('0x7'));var config=require(_0x6f23('0x8'));var controller=require(_0x6f23('0x9'));router[_0x6f23('0xa')]('/',auth[_0x6f23('0xb')](),controller[_0x6f23('0xc')]);router[_0x6f23('0xa')](_0x6f23('0xd'),auth[_0x6f23('0xb')](),controller['show']);router[_0x6f23('0xe')]('/',auth[_0x6f23('0xb')](),controller[_0x6f23('0xf')]);router[_0x6f23('0x10')]('/:id',auth[_0x6f23('0xb')](),controller[_0x6f23('0x11')]);router[_0x6f23('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6f23('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc7ca=['show','post','create','put','update','delete','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xc7ca,0x1ec));var _0xac7c=function(_0x4470d2,_0x38cff8){_0x4470d2=_0x4470d2-0x0;var _0x5b06c9=_0xc7ca[_0x4470d2];return _0x5b06c9;};'use strict';var multer=require(_0xac7c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xac7c('0x1'));var express=require(_0xac7c('0x2'));var router=express['Router']();var fs_extra=require(_0xac7c('0x3'));var auth=require(_0xac7c('0x4'));var interaction=require(_0xac7c('0x5'));var config=require(_0xac7c('0x6'));var controller=require(_0xac7c('0x7'));router[_0xac7c('0x8')]('/',auth[_0xac7c('0x9')](),controller[_0xac7c('0xa')]);router[_0xac7c('0x8')](_0xac7c('0xb'),auth[_0xac7c('0x9')](),controller[_0xac7c('0xc')]);router[_0xac7c('0xd')]('/',auth[_0xac7c('0x9')](),controller[_0xac7c('0xe')]);router[_0xac7c('0xf')](_0xac7c('0xb'),auth[_0xac7c('0x9')](),controller[_0xac7c('0x10')]);router[_0xac7c('0x11')]('/:id',auth[_0xac7c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 92a2339..ed01b04 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 _0x6356=['customVariable','keyValue','picklist','string','STRING','ENUM','variable','BOOLEAN','sequelize'];(function(_0x27638d,_0x4094db){var _0x35da35=function(_0x538095){while(--_0x538095){_0x27638d['push'](_0x27638d['shift']());}};_0x35da35(++_0x4094db);}(_0x6356,0x131));var _0x6635=function(_0x30e8a1,_0x55fa82){_0x30e8a1=_0x30e8a1-0x0;var _0x37c6f1=_0x6356[_0x30e8a1];return _0x37c6f1;};'use strict';var Sequelize=require(_0x6635('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x6635('0x1'),_0x6635('0x2'),_0x6635('0x3')),'defaultValue':_0x6635('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6635('0x5')]},'keyType':{'type':Sequelize[_0x6635('0x6')](_0x6635('0x4'),_0x6635('0x7'),_0x6635('0x1'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6635('0x5')]},'nameField':{'type':Sequelize[_0x6635('0x5')]},'customField':{'type':Sequelize[_0x6635('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9903=['keyValue','STRING','customVariable','BOOLEAN','exports','ENUM','string','variable'];(function(_0x19d509,_0x3be46f){var _0x3379d5=function(_0x111dd5){while(--_0x111dd5){_0x19d509['push'](_0x19d509['shift']());}};_0x3379d5(++_0x3be46f);}(_0x9903,0x174));var _0x3990=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9903[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x3990('0x0')]={'type':{'type':Sequelize[_0x3990('0x1')](_0x3990('0x2'),_0x3990('0x3'),'customVariable',_0x3990('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x3990('0x5')]},'key':{'type':Sequelize[_0x3990('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x3990('0x2'),'variable',_0x3990('0x6'))},'keyContent':{'type':Sequelize[_0x3990('0x5')]},'idField':{'type':Sequelize[_0x3990('0x5')]},'nameField':{'type':Sequelize[_0x3990('0x5')]},'customField':{'type':Sequelize[_0x3990('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3990('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 1b6627c..f5d88d3 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 _0x0479=['error','name','send','index','map','Dynamics365Field','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','filter','merge','options','includeAll','rows','catch','params','rawAttributes','keys','include','find','create','body','update','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/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0479,0x10d));var _0x9047=function(_0x45cfb5,_0x3b6fb6){_0x45cfb5=_0x45cfb5-0x0;var _0x20cff1=_0x0479[_0x45cfb5];return _0x20cff1;};'use strict';var emlformat=require(_0x9047('0x0'));var rimraf=require(_0x9047('0x1'));var zipdir=require(_0x9047('0x2'));var jsonpatch=require(_0x9047('0x3'));var rp=require(_0x9047('0x4'));var moment=require(_0x9047('0x5'));var BPromise=require(_0x9047('0x6'));var Mustache=require(_0x9047('0x7'));var util=require(_0x9047('0x8'));var path=require(_0x9047('0x9'));var sox=require(_0x9047('0xa'));var csv=require(_0x9047('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9047('0xc'));var _=require(_0x9047('0xd'));var squel=require(_0x9047('0xe'));var crypto=require(_0x9047('0xf'));var jsforce=require(_0x9047('0x10'));var deskjs=require(_0x9047('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9047('0x12'));var Papa=require(_0x9047('0x13'));var Redis=require(_0x9047('0x14'));var authService=require(_0x9047('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x9047('0x16'));var hardwareService=require(_0x9047('0x17'));var logger=require(_0x9047('0x18'))('api');var utils=require(_0x9047('0x19'));var config=require(_0x9047('0x1a'));var licenseUtil=require(_0x9047('0x1b'));var db=require(_0x9047('0x1c'))['db'];function respondWithStatusCode(_0x3e54bc,_0x1fb488){_0x1fb488=_0x1fb488||0xcc;return function(_0x3caee2){if(_0x3caee2){return _0x3e54bc[_0x9047('0x1d')](_0x1fb488);}return _0x3e54bc[_0x9047('0x1e')](_0x1fb488)[_0x9047('0x1f')]();};}function respondWithResult(_0x2635e4,_0x18c5d8){_0x18c5d8=_0x18c5d8||0xc8;return function(_0x56d9cb){if(_0x56d9cb){return _0x2635e4[_0x9047('0x1e')](_0x18c5d8)[_0x9047('0x20')](_0x56d9cb);}};}function respondWithFilteredResult(_0x92f935,_0x1be8c3){return function(_0x48b2d2){if(_0x48b2d2){var _0x3452ba=typeof _0x1be8c3[_0x9047('0x21')]===_0x9047('0x22')&&typeof _0x1be8c3['limit']===_0x9047('0x22');var _0x590b86=_0x48b2d2['count'];var _0x6df18b=_0x3452ba?0x0:_0x1be8c3[_0x9047('0x21')];var _0x377b61=_0x3452ba?_0x48b2d2[_0x9047('0x23')]:_0x1be8c3[_0x9047('0x21')]+_0x1be8c3[_0x9047('0x24')];var _0x263cf2;if(_0x377b61>=_0x590b86){_0x377b61=_0x590b86;_0x263cf2=0xc8;}else{_0x263cf2=0xce;}_0x92f935[_0x9047('0x1e')](_0x263cf2);return _0x92f935[_0x9047('0x25')]('Content-Range',_0x6df18b+'-'+_0x377b61+'/'+_0x590b86)[_0x9047('0x20')](_0x48b2d2);}return null;};}function patchUpdates(_0x2e4de9){return function(_0x3f3a2a){try{jsonpatch[_0x9047('0x26')](_0x3f3a2a,_0x2e4de9,!![]);}catch(_0x37cac5){return BPromise[_0x9047('0x27')](_0x37cac5);}return _0x3f3a2a[_0x9047('0x28')]();};}function saveUpdates(_0x598899,_0x15d3f3){return function(_0x300cf1){if(_0x300cf1){return _0x300cf1['update'](_0x598899)[_0x9047('0x29')](function(_0x567146){return _0x567146;});}return null;};}function removeEntity(_0x54d330,_0x555373){return function(_0x1930aa){if(_0x1930aa){return _0x1930aa[_0x9047('0x2a')]()['then'](function(){_0x54d330[_0x9047('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31abfb,_0x201cbf){return function(_0x4120c9){if(!_0x4120c9){_0x31abfb['sendStatus'](0x194);}return _0x4120c9;};}function handleError(_0x418d0a,_0x2852b5){_0x2852b5=_0x2852b5||0x1f4;return function(_0x122e12){logger[_0x9047('0x2b')](_0x122e12['stack']);if(_0x122e12[_0x9047('0x2c')]){delete _0x122e12['name'];}_0x418d0a[_0x9047('0x1e')](_0x2852b5)[_0x9047('0x2d')](_0x122e12);};}exports[_0x9047('0x2e')]=function(_0x1cb1d3,_0x568c94){var _0x126df8={},_0x348098={},_0x1cd99a={'count':0x0,'rows':[]};var _0x11e72f=_[_0x9047('0x2f')](db[_0x9047('0x30')]['rawAttributes'],function(_0x477a90){return{'name':_0x477a90[_0x9047('0x31')],'type':_0x477a90[_0x9047('0x32')][_0x9047('0x33')]};});_0x348098[_0x9047('0x34')]=_[_0x9047('0x2f')](_0x11e72f,_0x9047('0x2c'));_0x348098['query']=_['keys'](_0x1cb1d3[_0x9047('0x35')]);_0x348098['filters']=_[_0x9047('0x36')](_0x348098[_0x9047('0x34')],_0x348098[_0x9047('0x35')]);_0x126df8[_0x9047('0x37')]=_[_0x9047('0x36')](_0x348098['model'],qs['fields'](_0x1cb1d3[_0x9047('0x35')][_0x9047('0x38')]));_0x126df8[_0x9047('0x37')]=_0x126df8['attributes'][_0x9047('0x39')]?_0x126df8[_0x9047('0x37')]:_0x348098[_0x9047('0x34')];if(!_0x1cb1d3[_0x9047('0x35')][_0x9047('0x3a')](_0x9047('0x3b'))){_0x126df8[_0x9047('0x24')]=qs[_0x9047('0x24')](_0x1cb1d3[_0x9047('0x35')][_0x9047('0x24')]);_0x126df8[_0x9047('0x21')]=qs[_0x9047('0x21')](_0x1cb1d3[_0x9047('0x35')]['offset']);}_0x126df8['order']=qs[_0x9047('0x3c')](_0x1cb1d3[_0x9047('0x35')][_0x9047('0x3c')]);_0x126df8['where']=qs[_0x9047('0x3d')](_[_0x9047('0x3e')](_0x1cb1d3[_0x9047('0x35')],_0x348098[_0x9047('0x3d')]),_0x11e72f);if(_0x1cb1d3[_0x9047('0x35')]['filter']){_0x126df8[_0x9047('0x3f')]=_['merge'](_0x126df8[_0x9047('0x3f')],{'$or':_[_0x9047('0x2f')](_0x11e72f,function(_0x137ffa){if(_0x137ffa[_0x9047('0x32')]!=='VIRTUAL'){var _0x49ba37={};_0x49ba37[_0x137ffa[_0x9047('0x2c')]]={'$like':'%'+_0x1cb1d3[_0x9047('0x35')][_0x9047('0x40')]+'%'};return _0x49ba37;}})});}_0x126df8=_[_0x9047('0x41')]({},_0x126df8,_0x1cb1d3[_0x9047('0x42')]);var _0x34a1c4={'where':_0x126df8[_0x9047('0x3f')]};return db['Dynamics365Field']['count'](_0x34a1c4)[_0x9047('0x29')](function(_0x2fc864){_0x1cd99a[_0x9047('0x23')]=_0x2fc864;if(_0x1cb1d3[_0x9047('0x35')][_0x9047('0x43')]){_0x126df8['include']=[{'all':!![]}];}return db[_0x9047('0x30')]['findAll'](_0x126df8);})['then'](function(_0x3912bd){_0x1cd99a[_0x9047('0x44')]=_0x3912bd;return _0x1cd99a;})[_0x9047('0x29')](respondWithFilteredResult(_0x568c94,_0x126df8))[_0x9047('0x45')](handleError(_0x568c94,null));};exports['show']=function(_0x5839f0,_0x1b75c5){var _0x30cc11={'raw':!![],'where':{'id':_0x5839f0[_0x9047('0x46')]['id']}},_0x59a121={};_0x59a121[_0x9047('0x34')]=_['keys'](db[_0x9047('0x30')][_0x9047('0x47')]);_0x59a121[_0x9047('0x35')]=_[_0x9047('0x48')](_0x5839f0[_0x9047('0x35')]);_0x59a121[_0x9047('0x3d')]=_['intersection'](_0x59a121['model'],_0x59a121['query']);_0x30cc11[_0x9047('0x37')]=_[_0x9047('0x36')](_0x59a121[_0x9047('0x34')],qs['fields'](_0x5839f0[_0x9047('0x35')][_0x9047('0x38')]));_0x30cc11['attributes']=_0x30cc11[_0x9047('0x37')]['length']?_0x30cc11['attributes']:_0x59a121['model'];if(_0x5839f0[_0x9047('0x35')]['includeAll']){_0x30cc11[_0x9047('0x49')]=[{'all':!![]}];}_0x30cc11=_[_0x9047('0x41')]({},_0x30cc11,_0x5839f0['options']);return db[_0x9047('0x30')][_0x9047('0x4a')](_0x30cc11)[_0x9047('0x29')](handleEntityNotFound(_0x1b75c5,null))['then'](respondWithResult(_0x1b75c5,null))[_0x9047('0x45')](handleError(_0x1b75c5,null));};exports[_0x9047('0x4b')]=function(_0x19c522,_0x49bcca){return db[_0x9047('0x30')][_0x9047('0x4b')](_0x19c522[_0x9047('0x4c')],{})['then'](respondWithResult(_0x49bcca,0xc9))['catch'](handleError(_0x49bcca,null));};exports[_0x9047('0x4d')]=function(_0x3b9cce,_0x380444){if(_0x3b9cce[_0x9047('0x4c')]['id']){delete _0x3b9cce[_0x9047('0x4c')]['id'];}return db['Dynamics365Field'][_0x9047('0x4a')]({'where':{'id':_0x3b9cce[_0x9047('0x46')]['id']}})['then'](handleEntityNotFound(_0x380444,null))[_0x9047('0x29')](saveUpdates(_0x3b9cce['body'],null))[_0x9047('0x29')](respondWithResult(_0x380444,null))[_0x9047('0x45')](handleError(_0x380444,null));};exports[_0x9047('0x2a')]=function(_0x3e5ff0,_0x1e5547){return db['Dynamics365Field']['find']({'where':{'id':_0x3e5ff0[_0x9047('0x46')]['id']}})[_0x9047('0x29')](handleEntityNotFound(_0x1e5547,null))[_0x9047('0x29')](removeEntity(_0x1e5547,null))['catch'](handleError(_0x1e5547,null));}; \ No newline at end of file +var _0x08f4=['fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','find','create','body','catch','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection'];(function(_0x1dd8ab,_0x3747ad){var _0x5852f7=function(_0x4ca04e){while(--_0x4ca04e){_0x1dd8ab['push'](_0x1dd8ab['shift']());}};_0x5852f7(++_0x3747ad);}(_0x08f4,0x187));var _0x408f=function(_0xf69fc9,_0x2a4b7d){_0xf69fc9=_0xf69fc9-0x0;var _0x588691=_0x08f4[_0xf69fc9];return _0x588691;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x408f('0x0'));var zipdir=require(_0x408f('0x1'));var jsonpatch=require(_0x408f('0x2'));var rp=require(_0x408f('0x3'));var moment=require(_0x408f('0x4'));var BPromise=require(_0x408f('0x5'));var Mustache=require(_0x408f('0x6'));var util=require(_0x408f('0x7'));var path=require(_0x408f('0x8'));var sox=require('sox');var csv=require(_0x408f('0x9'));var ejs=require(_0x408f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x408f('0xb'));var crypto=require(_0x408f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x408f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x408f('0xe'));var Papa=require('papaparse');var Redis=require(_0x408f('0xf'));var authService=require(_0x408f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x408f('0x11'));var hardwareService=require(_0x408f('0x12'));var logger=require(_0x408f('0x13'))(_0x408f('0x14'));var utils=require('../../config/utils');var config=require(_0x408f('0x15'));var licenseUtil=require(_0x408f('0x16'));var db=require(_0x408f('0x17'))['db'];function respondWithStatusCode(_0x1019e1,_0x2cd389){_0x2cd389=_0x2cd389||0xcc;return function(_0x34ab12){if(_0x34ab12){return _0x1019e1[_0x408f('0x18')](_0x2cd389);}return _0x1019e1[_0x408f('0x19')](_0x2cd389)[_0x408f('0x1a')]();};}function respondWithResult(_0x22f298,_0xc85a00){_0xc85a00=_0xc85a00||0xc8;return function(_0xa8749b){if(_0xa8749b){return _0x22f298[_0x408f('0x19')](_0xc85a00)[_0x408f('0x1b')](_0xa8749b);}};}function respondWithFilteredResult(_0x227fd7,_0x5f241f){return function(_0x3d6386){if(_0x3d6386){var _0x18b8c7=typeof _0x5f241f[_0x408f('0x1c')]===_0x408f('0x1d')&&typeof _0x5f241f[_0x408f('0x1e')]===_0x408f('0x1d');var _0x51843f=_0x3d6386[_0x408f('0x1f')];var _0x130896=_0x18b8c7?0x0:_0x5f241f['offset'];var _0x48cb30=_0x18b8c7?_0x3d6386['count']:_0x5f241f[_0x408f('0x1c')]+_0x5f241f[_0x408f('0x1e')];var _0x195619;if(_0x48cb30>=_0x51843f){_0x48cb30=_0x51843f;_0x195619=0xc8;}else{_0x195619=0xce;}_0x227fd7['status'](_0x195619);return _0x227fd7[_0x408f('0x20')](_0x408f('0x21'),_0x130896+'-'+_0x48cb30+'/'+_0x51843f)[_0x408f('0x1b')](_0x3d6386);}return null;};}function patchUpdates(_0x35081c){return function(_0x50953a){try{jsonpatch[_0x408f('0x22')](_0x50953a,_0x35081c,!![]);}catch(_0x845a45){return BPromise[_0x408f('0x23')](_0x845a45);}return _0x50953a['save']();};}function saveUpdates(_0x301e4c,_0x4b4cca){return function(_0x3933f1){if(_0x3933f1){return _0x3933f1[_0x408f('0x24')](_0x301e4c)[_0x408f('0x25')](function(_0xa7a61){return _0xa7a61;});}return null;};}function removeEntity(_0x331bb4,_0x217ea5){return function(_0x294145){if(_0x294145){return _0x294145['destroy']()[_0x408f('0x25')](function(){_0x331bb4[_0x408f('0x19')](0xcc)[_0x408f('0x1a')]();});}};}function handleEntityNotFound(_0x43437f,_0x46cd8e){return function(_0x2ff130){if(!_0x2ff130){_0x43437f[_0x408f('0x18')](0x194);}return _0x2ff130;};}function handleError(_0x2b0ef7,_0x11b947){_0x11b947=_0x11b947||0x1f4;return function(_0x25cf6f){logger[_0x408f('0x26')](_0x25cf6f[_0x408f('0x27')]);if(_0x25cf6f[_0x408f('0x28')]){delete _0x25cf6f['name'];}_0x2b0ef7[_0x408f('0x19')](_0x11b947)['send'](_0x25cf6f);};}exports[_0x408f('0x29')]=function(_0x4c1da4,_0x4c9e94){var _0x49d3b5={},_0x249598={},_0x35521a={'count':0x0,'rows':[]};var _0x2d2374=_[_0x408f('0x2a')](db[_0x408f('0x2b')][_0x408f('0x2c')],function(_0x5bf5a4){return{'name':_0x5bf5a4[_0x408f('0x2d')],'type':_0x5bf5a4[_0x408f('0x2e')][_0x408f('0x2f')]};});_0x249598[_0x408f('0x30')]=_[_0x408f('0x2a')](_0x2d2374,_0x408f('0x28'));_0x249598['query']=_[_0x408f('0x31')](_0x4c1da4[_0x408f('0x32')]);_0x249598[_0x408f('0x33')]=_['intersection'](_0x249598[_0x408f('0x30')],_0x249598[_0x408f('0x32')]);_0x49d3b5['attributes']=_[_0x408f('0x34')](_0x249598[_0x408f('0x30')],qs[_0x408f('0x35')](_0x4c1da4['query'][_0x408f('0x35')]));_0x49d3b5[_0x408f('0x36')]=_0x49d3b5[_0x408f('0x36')][_0x408f('0x37')]?_0x49d3b5[_0x408f('0x36')]:_0x249598[_0x408f('0x30')];if(!_0x4c1da4['query'][_0x408f('0x38')]('nolimit')){_0x49d3b5[_0x408f('0x1e')]=qs[_0x408f('0x1e')](_0x4c1da4[_0x408f('0x32')]['limit']);_0x49d3b5[_0x408f('0x1c')]=qs['offset'](_0x4c1da4[_0x408f('0x32')][_0x408f('0x1c')]);}_0x49d3b5[_0x408f('0x39')]=qs[_0x408f('0x3a')](_0x4c1da4['query']['sort']);_0x49d3b5[_0x408f('0x3b')]=qs[_0x408f('0x33')](_[_0x408f('0x3c')](_0x4c1da4[_0x408f('0x32')],_0x249598[_0x408f('0x33')]),_0x2d2374);if(_0x4c1da4[_0x408f('0x32')]['filter']){_0x49d3b5[_0x408f('0x3b')]=_[_0x408f('0x3d')](_0x49d3b5[_0x408f('0x3b')],{'$or':_[_0x408f('0x2a')](_0x2d2374,function(_0x145b8c){if(_0x145b8c[_0x408f('0x2e')]!==_0x408f('0x3e')){var _0x514c8d={};_0x514c8d[_0x145b8c[_0x408f('0x28')]]={'$like':'%'+_0x4c1da4[_0x408f('0x32')][_0x408f('0x3f')]+'%'};return _0x514c8d;}})});}_0x49d3b5=_['merge']({},_0x49d3b5,_0x4c1da4[_0x408f('0x40')]);var _0x37c1a1={'where':_0x49d3b5[_0x408f('0x3b')]};return db['Dynamics365Field'][_0x408f('0x1f')](_0x37c1a1)[_0x408f('0x25')](function(_0x29c7cc){_0x35521a[_0x408f('0x1f')]=_0x29c7cc;if(_0x4c1da4[_0x408f('0x32')][_0x408f('0x41')]){_0x49d3b5[_0x408f('0x42')]=[{'all':!![]}];}return db[_0x408f('0x2b')][_0x408f('0x43')](_0x49d3b5);})[_0x408f('0x25')](function(_0x387dcf){_0x35521a[_0x408f('0x44')]=_0x387dcf;return _0x35521a;})[_0x408f('0x25')](respondWithFilteredResult(_0x4c9e94,_0x49d3b5))['catch'](handleError(_0x4c9e94,null));};exports['show']=function(_0x59ec74,_0x1f37b0){var _0x166c68={'raw':!![],'where':{'id':_0x59ec74['params']['id']}},_0x3ee9ac={};_0x3ee9ac['model']=_['keys'](db['Dynamics365Field'][_0x408f('0x2c')]);_0x3ee9ac['query']=_[_0x408f('0x31')](_0x59ec74[_0x408f('0x32')]);_0x3ee9ac['filters']=_[_0x408f('0x34')](_0x3ee9ac['model'],_0x3ee9ac[_0x408f('0x32')]);_0x166c68[_0x408f('0x36')]=_[_0x408f('0x34')](_0x3ee9ac[_0x408f('0x30')],qs[_0x408f('0x35')](_0x59ec74[_0x408f('0x32')]['fields']));_0x166c68[_0x408f('0x36')]=_0x166c68[_0x408f('0x36')]['length']?_0x166c68['attributes']:_0x3ee9ac[_0x408f('0x30')];if(_0x59ec74[_0x408f('0x32')][_0x408f('0x41')]){_0x166c68[_0x408f('0x42')]=[{'all':!![]}];}_0x166c68=_[_0x408f('0x3d')]({},_0x166c68,_0x59ec74['options']);return db['Dynamics365Field'][_0x408f('0x45')](_0x166c68)[_0x408f('0x25')](handleEntityNotFound(_0x1f37b0,null))[_0x408f('0x25')](respondWithResult(_0x1f37b0,null))['catch'](handleError(_0x1f37b0,null));};exports[_0x408f('0x46')]=function(_0x37751f,_0xac9265){return db[_0x408f('0x2b')][_0x408f('0x46')](_0x37751f[_0x408f('0x47')],{})[_0x408f('0x25')](respondWithResult(_0xac9265,0xc9))[_0x408f('0x48')](handleError(_0xac9265,null));};exports['update']=function(_0xd180a1,_0x26e41b){if(_0xd180a1['body']['id']){delete _0xd180a1[_0x408f('0x47')]['id'];}return db[_0x408f('0x2b')][_0x408f('0x45')]({'where':{'id':_0xd180a1[_0x408f('0x49')]['id']}})[_0x408f('0x25')](handleEntityNotFound(_0x26e41b,null))['then'](saveUpdates(_0xd180a1['body'],null))[_0x408f('0x25')](respondWithResult(_0x26e41b,null))[_0x408f('0x48')](handleError(_0x26e41b,null));};exports['destroy']=function(_0x2c6ea8,_0x10ef9a){return db[_0x408f('0x2b')][_0x408f('0x45')]({'where':{'id':_0x2c6ea8['params']['id']}})[_0x408f('0x25')](handleEntityNotFound(_0x10ef9a,null))[_0x408f('0x25')](removeEntity(_0x10ef9a,null))[_0x408f('0x48')](handleError(_0x10ef9a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index f88e59b..4ac0e85 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 _0x4f88=['path','rimraf','exports','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','../../config/logger','bluebird','request-promise'];(function(_0x356bb1,_0x5060b8){var _0x2b6de8=function(_0x4e51d8){while(--_0x4e51d8){_0x356bb1['push'](_0x356bb1['shift']());}};_0x2b6de8(++_0x5060b8);}(_0x4f88,0x17d));var _0x84f8=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0x4f88[_0x43b487];return _0x2f707a;};'use strict';var _=require('lodash');var util=require(_0x84f8('0x0'));var logger=require(_0x84f8('0x1'))('api');var moment=require('moment');var BPromise=require(_0x84f8('0x2'));var rp=require(_0x84f8('0x3'));var fs=require('fs');var path=require(_0x84f8('0x4'));var rimraf=require(_0x84f8('0x5'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x84f8('0x6')]=function(_0x4f9413,_0x108b5a){return _0x4f9413['define']('Dynamics365Field',attributes,{'tableName':_0x84f8('0x7'),'paranoid':![],'indexes':[{'name':_0x84f8('0x8'),'fields':[_0x84f8('0x9'),_0x84f8('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8275=['idField','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','dynamics365_unique_index'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x8275,0x15d));var _0x5827=function(_0x10a2ae,_0x17a308){_0x10a2ae=_0x10a2ae-0x0;var _0x428ee7=_0x8275[_0x10a2ae];return _0x428ee7;};'use strict';var _=require(_0x5827('0x0'));var util=require('util');var logger=require(_0x5827('0x1'))(_0x5827('0x2'));var moment=require('moment');var BPromise=require(_0x5827('0x3'));var rp=require(_0x5827('0x4'));var fs=require('fs');var path=require(_0x5827('0x5'));var rimraf=require('rimraf');var config=require(_0x5827('0x6'));var attributes=require(_0x5827('0x7'));module[_0x5827('0x8')]=function(_0x294b90,_0x5727cc){return _0x294b90['define'](_0x5827('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x5827('0xa'),'fields':[_0x5827('0xb'),'FieldId'],'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 29f3dd2..c420c55 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 _0x0f15=['Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','debug'];(function(_0x3e7a28,_0x4d8f04){var _0x281a03=function(_0x3b70c2){while(--_0x3b70c2){_0x3e7a28['push'](_0x3e7a28['shift']());}};_0x281a03(++_0x4d8f04);}(_0x0f15,0xde));var _0x50f1=function(_0x436b6e,_0x30ccab){_0x436b6e=_0x436b6e-0x0;var _0x3fe68d=_0x0f15[_0x436b6e];return _0x3fe68d;};'use strict';var _=require(_0x50f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x50f1('0x1'));var rs=require(_0x50f1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x50f1('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x50f1('0x4'));var config=require(_0x50f1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x50f1('0x6')][_0x50f1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x124fd5,_0x8aa72a,_0x3bae91){return new BPromise(function(_0x3d97e2,_0x2604f3){return client['request'](_0x124fd5,_0x3bae91)[_0x50f1('0x8')](function(_0x3771c6){logger[_0x50f1('0x9')](_0x50f1('0xa'),_0x8aa72a,'request\x20sent');logger[_0x50f1('0xb')](_0x50f1('0xc'),_0x8aa72a,_0x50f1('0xd'),JSON['stringify'](_0x3771c6));if(_0x3771c6['error']){if(_0x3771c6[_0x50f1('0xe')][_0x50f1('0xf')]===0x1f4){logger[_0x50f1('0xe')](_0x50f1('0xa'),_0x8aa72a,_0x3771c6[_0x50f1('0xe')]['message']);return _0x2604f3(_0x3771c6['error'][_0x50f1('0x10')]);}logger[_0x50f1('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x8aa72a,_0x3771c6[_0x50f1('0xe')][_0x50f1('0x10')]);return _0x3d97e2(_0x3771c6[_0x50f1('0xe')][_0x50f1('0x10')]);}else{logger[_0x50f1('0x9')]('Dynamics365Field,\x20%s,\x20%s',_0x8aa72a,_0x50f1('0xd'));_0x3d97e2(_0x3771c6['result'][_0x50f1('0x10')]);}})[_0x50f1('0x11')](function(_0x2e5c66){logger[_0x50f1('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x8aa72a,_0x2e5c66);_0x2604f3(_0x2e5c66);});});} \ No newline at end of file +var _0x1cfa=['then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x15cf93,_0x5b1029){var _0x2afb0a=function(_0x5413ed){while(--_0x5413ed){_0x15cf93['push'](_0x15cf93['shift']());}};_0x2afb0a(++_0x5b1029);}(_0x1cfa,0xfb));var _0xa1cf=function(_0x3b1a32,_0x5d92b4){_0x3b1a32=_0x3b1a32-0x0;var _0x24f36a=_0x1cfa[_0x3b1a32];return _0x24f36a;};'use strict';var _=require(_0xa1cf('0x0'));var util=require(_0xa1cf('0x1'));var moment=require(_0xa1cf('0x2'));var BPromise=require(_0xa1cf('0x3'));var rs=require(_0xa1cf('0x4'));var fs=require('fs');var Redis=require(_0xa1cf('0x5'));var db=require(_0xa1cf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1cf('0x7'))(_0xa1cf('0x8'));var config=require(_0xa1cf('0x9'));var jayson=require(_0xa1cf('0xa'));var client=jayson['client'][_0xa1cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48f220,_0x3ad9a1,_0x2eb686){return new BPromise(function(_0x25b1b2,_0x54eb62){return client[_0xa1cf('0xc')](_0x48f220,_0x2eb686)[_0xa1cf('0xd')](function(_0x3c17ed){logger[_0xa1cf('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x3ad9a1,_0xa1cf('0xf'));logger[_0xa1cf('0x10')](_0xa1cf('0x11'),_0x3ad9a1,_0xa1cf('0xf'),JSON[_0xa1cf('0x12')](_0x3c17ed));if(_0x3c17ed[_0xa1cf('0x13')]){if(_0x3c17ed['error'][_0xa1cf('0x14')]===0x1f4){logger[_0xa1cf('0x13')](_0xa1cf('0x15'),_0x3ad9a1,_0x3c17ed['error'][_0xa1cf('0x16')]);return _0x54eb62(_0x3c17ed[_0xa1cf('0x13')][_0xa1cf('0x16')]);}logger[_0xa1cf('0x13')](_0xa1cf('0x15'),_0x3ad9a1,_0x3c17ed['error'][_0xa1cf('0x16')]);return _0x25b1b2(_0x3c17ed[_0xa1cf('0x13')][_0xa1cf('0x16')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x3ad9a1,'request\x20sent');_0x25b1b2(_0x3c17ed['result']['message']);}})[_0xa1cf('0x17')](function(_0x4c81d5){logger['error'](_0xa1cf('0x15'),_0x3ad9a1,_0x4c81d5);_0x54eb62(_0x4c81d5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index be60645..ff7e852 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 _0x1a75=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id/configurations','getConfigurations','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2f71a0,_0x29f6b4){var _0x25a4cd=function(_0x10abe6){while(--_0x10abe6){_0x2f71a0['push'](_0x2f71a0['shift']());}};_0x25a4cd(++_0x29f6b4);}(_0x1a75,0x86));var _0x51a7=function(_0x380f5d,_0x334b34){_0x380f5d=_0x380f5d-0x0;var _0x217df1=_0x1a75[_0x380f5d];return _0x217df1;};'use strict';var multer=require(_0x51a7('0x0'));var util=require(_0x51a7('0x1'));var path=require(_0x51a7('0x2'));var timeout=require(_0x51a7('0x3'));var express=require(_0x51a7('0x4'));var router=express[_0x51a7('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x51a7('0x6'));var config=require(_0x51a7('0x7'));var controller=require(_0x51a7('0x8'));router[_0x51a7('0x9')]('/',auth[_0x51a7('0xa')](),controller['index']);router[_0x51a7('0x9')]('/:id',auth[_0x51a7('0xa')](),controller['show']);router['get'](_0x51a7('0xb'),auth[_0x51a7('0xa')](),controller[_0x51a7('0xc')]);router[_0x51a7('0x9')]('/:id/fields',auth[_0x51a7('0xa')](),controller['getFields']);router[_0x51a7('0xd')]('/',auth['isAuthenticated'](),controller[_0x51a7('0xe')]);router[_0x51a7('0xd')](_0x51a7('0xb'),auth[_0x51a7('0xa')](),controller['addConfiguration']);router[_0x51a7('0xf')](_0x51a7('0x10'),auth[_0x51a7('0xa')](),controller[_0x51a7('0x11')]);router['delete'](_0x51a7('0x10'),auth[_0x51a7('0xa')](),controller[_0x51a7('0x12')]);module[_0x51a7('0x13')]=router; \ No newline at end of file +var _0x9c3e=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated'];(function(_0x378a49,_0x44ce2d){var _0x11615f=function(_0x4e8c61){while(--_0x4e8c61){_0x378a49['push'](_0x378a49['shift']());}};_0x11615f(++_0x44ce2d);}(_0x9c3e,0x6c));var _0xe9c3=function(_0x22c226,_0xe47ec7){_0x22c226=_0x22c226-0x0;var _0x48e1aa=_0x9c3e[_0x22c226];return _0x48e1aa;};'use strict';var multer=require(_0xe9c3('0x0'));var util=require(_0xe9c3('0x1'));var path=require(_0xe9c3('0x2'));var timeout=require(_0xe9c3('0x3'));var express=require(_0xe9c3('0x4'));var router=express[_0xe9c3('0x5')]();var fs_extra=require(_0xe9c3('0x6'));var auth=require(_0xe9c3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe9c3('0x8'));var controller=require(_0xe9c3('0x9'));router[_0xe9c3('0xa')]('/',auth[_0xe9c3('0xb')](),controller[_0xe9c3('0xc')]);router[_0xe9c3('0xa')](_0xe9c3('0xd'),auth['isAuthenticated'](),controller[_0xe9c3('0xe')]);router[_0xe9c3('0xa')](_0xe9c3('0xf'),auth[_0xe9c3('0xb')](),controller[_0xe9c3('0x10')]);router['get'](_0xe9c3('0x11'),auth['isAuthenticated'](),controller[_0xe9c3('0x12')]);router[_0xe9c3('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xe9c3('0x14')]);router[_0xe9c3('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xe9c3('0x16')]);router[_0xe9c3('0x17')](_0xe9c3('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 6638acc..c8f2e6f 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 _0x6a95=['exports','STRING','username','sequelize'];(function(_0x1f6e71,_0x19360b){var _0x2271aa=function(_0x2f0431){while(--_0x2f0431){_0x1f6e71['push'](_0x1f6e71['shift']());}};_0x2271aa(++_0x19360b);}(_0x6a95,0x1db));var _0x56a9=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x6a95[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize[_0x56a9('0x2')]},'description':{'type':Sequelize[_0x56a9('0x2')]},'username':{'type':Sequelize[_0x56a9('0x2')],'unique':_0x56a9('0x3')},'apiKey':{'type':Sequelize[_0x56a9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xaebd=['remoteUri','sequelize','STRING','username'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x433c79,_0x21331c){_0x433c79=_0x433c79-0x0;var _0xc781d2=_0xaebd[_0x433c79];return _0xc781d2;};'use strict';var Sequelize=require(_0xdaeb('0x0'));module['exports']={'name':{'type':Sequelize[_0xdaeb('0x1')]},'description':{'type':Sequelize[_0xdaeb('0x1')]},'username':{'type':Sequelize[_0xdaeb('0x1')],'unique':_0xdaeb('0x2')},'apiKey':{'type':Sequelize[_0xdaeb('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xdaeb('0x3')},'serverUrl':{'type':Sequelize[_0xdaeb('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index fb858cc..e440a9d 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 _0x292b=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','update','find','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','requester','subject','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis'];(function(_0x5d7293,_0x695842){var _0x2f0755=function(_0x5b1a69){while(--_0x5b1a69){_0x5d7293['push'](_0x5d7293['shift']());}};_0x2f0755(++_0x695842);}(_0x292b,0x64));var _0xb292=function(_0x49bfb8,_0x5b6e2b){_0x49bfb8=_0x49bfb8-0x0;var _0x1be0b7=_0x292b[_0x49bfb8];return _0x1be0b7;};'use strict';var emlformat=require(_0xb292('0x0'));var rimraf=require(_0xb292('0x1'));var zipdir=require(_0xb292('0x2'));var jsonpatch=require(_0xb292('0x3'));var rp=require(_0xb292('0x4'));var moment=require(_0xb292('0x5'));var BPromise=require(_0xb292('0x6'));var Mustache=require(_0xb292('0x7'));var util=require(_0xb292('0x8'));var path=require(_0xb292('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb292('0xa'));var _=require(_0xb292('0xb'));var squel=require(_0xb292('0xc'));var crypto=require('crypto');var jsforce=require(_0xb292('0xd'));var deskjs=require(_0xb292('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb292('0xf'));var Redis=require(_0xb292('0x10'));var authService=require(_0xb292('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb292('0x12'));var hardwareService=require(_0xb292('0x13'));var logger=require(_0xb292('0x14'))(_0xb292('0x15'));var utils=require('../../config/utils');var config=require(_0xb292('0x16'));var licenseUtil=require(_0xb292('0x17'));var db=require(_0xb292('0x18'))['db'];var integrations=require(_0xb292('0x19'));function respondWithStatusCode(_0x5dbdf4,_0x22bdce){_0x22bdce=_0x22bdce||0xcc;return function(_0x2dae35){if(_0x2dae35){return _0x5dbdf4['sendStatus'](_0x22bdce);}return _0x5dbdf4['status'](_0x22bdce)['end']();};}function respondWithResult(_0x104e5f,_0x223a1d){_0x223a1d=_0x223a1d||0xc8;return function(_0x417aad){if(_0x417aad){return _0x104e5f[_0xb292('0x1a')](_0x223a1d)[_0xb292('0x1b')](_0x417aad);}};}function respondWithFilteredResult(_0x1677bf,_0x18b43c){return function(_0x5c1c01){if(_0x5c1c01){var _0x439891=typeof _0x18b43c[_0xb292('0x1c')]===_0xb292('0x1d')&&typeof _0x18b43c[_0xb292('0x1e')]===_0xb292('0x1d');var _0xf32a5c=_0x5c1c01['count'];var _0x2fa2e4=_0x439891?0x0:_0x18b43c[_0xb292('0x1c')];var _0x2fc03d=_0x439891?_0x5c1c01[_0xb292('0x1f')]:_0x18b43c[_0xb292('0x1c')]+_0x18b43c[_0xb292('0x1e')];var _0x19e1a0;if(_0x2fc03d>=_0xf32a5c){_0x2fc03d=_0xf32a5c;_0x19e1a0=0xc8;}else{_0x19e1a0=0xce;}_0x1677bf['status'](_0x19e1a0);return _0x1677bf[_0xb292('0x20')](_0xb292('0x21'),_0x2fa2e4+'-'+_0x2fc03d+'/'+_0xf32a5c)[_0xb292('0x1b')](_0x5c1c01);}return null;};}function patchUpdates(_0x5ee1b8){return function(_0xd1fa7a){try{jsonpatch[_0xb292('0x22')](_0xd1fa7a,_0x5ee1b8,!![]);}catch(_0x51a216){return BPromise[_0xb292('0x23')](_0x51a216);}return _0xd1fa7a['save']();};}function saveUpdates(_0x41c21c,_0x55b728){return function(_0x1e1f10){if(_0x1e1f10){return _0x1e1f10['update'](_0x41c21c)[_0xb292('0x24')](function(_0x5e9ccf){return _0x5e9ccf;});}return null;};}function removeEntity(_0x44735d,_0x1de6e5){return function(_0x3b9e90){if(_0x3b9e90){return _0x3b9e90[_0xb292('0x25')]()[_0xb292('0x24')](function(){_0x44735d[_0xb292('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53d64e,_0x5537ee){return function(_0x5cbda6){if(!_0x5cbda6){_0x53d64e[_0xb292('0x26')](0x194);}return _0x5cbda6;};}function handleError(_0x1d1f4c,_0x1ecd86){_0x1ecd86=_0x1ecd86||0x1f4;return function(_0x52ecd4){logger['error'](_0x52ecd4[_0xb292('0x27')]);if(_0x52ecd4[_0xb292('0x28')]){delete _0x52ecd4['name'];}_0x1d1f4c['status'](_0x1ecd86)[_0xb292('0x29')](_0x52ecd4);};}exports[_0xb292('0x2a')]=function(_0x3c8005,_0x5bd3af){var _0x2fc66d={},_0x5e5a29={},_0x2c231e={'count':0x0,'rows':[]};var _0x186532=_[_0xb292('0x2b')](db[_0xb292('0x2c')][_0xb292('0x2d')],function(_0xb7ab72){return{'name':_0xb7ab72[_0xb292('0x2e')],'type':_0xb7ab72['type'][_0xb292('0x2f')]};});_0x5e5a29[_0xb292('0x30')]=_[_0xb292('0x2b')](_0x186532,_0xb292('0x28'));_0x5e5a29['query']=_[_0xb292('0x31')](_0x3c8005[_0xb292('0x32')]);_0x5e5a29[_0xb292('0x33')]=_[_0xb292('0x34')](_0x5e5a29[_0xb292('0x30')],_0x5e5a29[_0xb292('0x32')]);_0x2fc66d[_0xb292('0x35')]=_[_0xb292('0x34')](_0x5e5a29[_0xb292('0x30')],qs[_0xb292('0x36')](_0x3c8005[_0xb292('0x32')]['fields']));_0x2fc66d[_0xb292('0x35')]=_0x2fc66d[_0xb292('0x35')][_0xb292('0x37')]?_0x2fc66d[_0xb292('0x35')]:_0x5e5a29['model'];if(!_0x3c8005['query'][_0xb292('0x38')](_0xb292('0x39'))){_0x2fc66d[_0xb292('0x1e')]=qs[_0xb292('0x1e')](_0x3c8005['query']['limit']);_0x2fc66d[_0xb292('0x1c')]=qs[_0xb292('0x1c')](_0x3c8005[_0xb292('0x32')][_0xb292('0x1c')]);}_0x2fc66d[_0xb292('0x3a')]=qs['sort'](_0x3c8005[_0xb292('0x32')][_0xb292('0x3b')]);_0x2fc66d[_0xb292('0x3c')]=qs[_0xb292('0x33')](_[_0xb292('0x3d')](_0x3c8005[_0xb292('0x32')],_0x5e5a29[_0xb292('0x33')]),_0x186532);if(_0x3c8005[_0xb292('0x32')][_0xb292('0x3e')]){_0x2fc66d[_0xb292('0x3c')]=_[_0xb292('0x3f')](_0x2fc66d[_0xb292('0x3c')],{'$or':_[_0xb292('0x2b')](_0x186532,function(_0x500e16){if(_0x500e16[_0xb292('0x40')]!==_0xb292('0x41')){var _0x3e231b={};_0x3e231b[_0x500e16[_0xb292('0x28')]]={'$like':'%'+_0x3c8005[_0xb292('0x32')]['filter']+'%'};return _0x3e231b;}})});}_0x2fc66d=_[_0xb292('0x3f')]({},_0x2fc66d,_0x3c8005['options']);var _0x248bfb={'where':_0x2fc66d[_0xb292('0x3c')]};return db['FreshdeskAccount'][_0xb292('0x1f')](_0x248bfb)[_0xb292('0x24')](function(_0x5b1f98){_0x2c231e[_0xb292('0x1f')]=_0x5b1f98;if(_0x3c8005[_0xb292('0x32')]['includeAll']){_0x2fc66d[_0xb292('0x42')]=[{'all':!![]}];}return db[_0xb292('0x2c')][_0xb292('0x43')](_0x2fc66d);})[_0xb292('0x24')](function(_0x27a455){_0x2c231e[_0xb292('0x44')]=_0x27a455;return _0x2c231e;})['then'](respondWithFilteredResult(_0x5bd3af,_0x2fc66d))[_0xb292('0x45')](handleError(_0x5bd3af,null));};exports[_0xb292('0x46')]=function(_0x4d9ccd,_0x2534f1){var _0x3308e0={'raw':![],'where':{'id':_0x4d9ccd[_0xb292('0x47')]['id']}},_0x5cbed4={};_0x5cbed4[_0xb292('0x30')]=_[_0xb292('0x31')](db[_0xb292('0x2c')][_0xb292('0x2d')]);_0x5cbed4[_0xb292('0x32')]=_['keys'](_0x4d9ccd[_0xb292('0x32')]);_0x5cbed4[_0xb292('0x33')]=_[_0xb292('0x34')](_0x5cbed4[_0xb292('0x30')],_0x5cbed4[_0xb292('0x32')]);_0x3308e0['attributes']=_[_0xb292('0x34')](_0x5cbed4[_0xb292('0x30')],qs[_0xb292('0x36')](_0x4d9ccd['query'][_0xb292('0x36')]));_0x3308e0[_0xb292('0x35')]=_0x3308e0[_0xb292('0x35')][_0xb292('0x37')]?_0x3308e0[_0xb292('0x35')]:_0x5cbed4[_0xb292('0x30')];if(_0x4d9ccd[_0xb292('0x32')][_0xb292('0x48')]){_0x3308e0[_0xb292('0x42')]=[{'all':!![]}];}_0x3308e0=_[_0xb292('0x3f')]({},_0x3308e0,_0x4d9ccd[_0xb292('0x49')]);return db[_0xb292('0x2c')]['find'](_0x3308e0)['then'](handleEntityNotFound(_0x2534f1,null))[_0xb292('0x24')](respondWithResult(_0x2534f1,null))[_0xb292('0x45')](handleError(_0x2534f1,null));};exports['create']=function(_0x12c1cf,_0x13da99){return db[_0xb292('0x2c')][_0xb292('0x4a')](_0x12c1cf[_0xb292('0x4b')],{})[_0xb292('0x24')](respondWithResult(_0x13da99,0xc9))[_0xb292('0x45')](handleError(_0x13da99,null));};exports[_0xb292('0x4c')]=function(_0x2e92f6,_0x35aaae){if(_0x2e92f6[_0xb292('0x4b')]['id']){delete _0x2e92f6['body']['id'];}return db[_0xb292('0x2c')]['find']({'where':{'id':_0x2e92f6['params']['id']}})[_0xb292('0x24')](handleEntityNotFound(_0x35aaae,null))[_0xb292('0x24')](saveUpdates(_0x2e92f6['body'],null))['then'](respondWithResult(_0x35aaae,null))[_0xb292('0x45')](handleError(_0x35aaae,null));};exports['destroy']=function(_0x2d494c,_0x351cd8){return db['FreshdeskAccount'][_0xb292('0x4d')]({'where':{'id':_0x2d494c[_0xb292('0x47')]['id']}})[_0xb292('0x24')](handleEntityNotFound(_0x351cd8,null))['then'](removeEntity(_0x351cd8,null))[_0xb292('0x45')](handleError(_0x351cd8,null));};exports[_0xb292('0x4e')]=function(_0xb5c34,_0x3ed8f1,_0x2da3fc){var _0x37c820={};var _0x2ce5a1={};var _0x16613b;var _0x39b4a4;return db[_0xb292('0x2c')]['findOne']({'where':{'id':_0xb5c34[_0xb292('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ed8f1,null))[_0xb292('0x24')](function(_0x36fd26){if(_0x36fd26){_0x16613b=_0x36fd26;_0x2ce5a1['model']=_[_0xb292('0x31')](db[_0xb292('0x4f')][_0xb292('0x2d')]);_0x2ce5a1[_0xb292('0x32')]=_[_0xb292('0x31')](_0xb5c34[_0xb292('0x32')]);_0x2ce5a1[_0xb292('0x33')]=_[_0xb292('0x34')](_0x2ce5a1[_0xb292('0x30')],_0x2ce5a1[_0xb292('0x32')]);_0x37c820[_0xb292('0x35')]=_['intersection'](_0x2ce5a1[_0xb292('0x30')],qs[_0xb292('0x36')](_0xb5c34[_0xb292('0x32')][_0xb292('0x36')]));_0x37c820[_0xb292('0x35')]=_0x37c820[_0xb292('0x35')][_0xb292('0x37')]?_0x37c820[_0xb292('0x35')]:_0x2ce5a1[_0xb292('0x30')];_0x37c820[_0xb292('0x3a')]=qs[_0xb292('0x3b')](_0xb5c34[_0xb292('0x32')][_0xb292('0x3b')]);_0x37c820[_0xb292('0x3c')]=qs['filters'](_[_0xb292('0x3d')](_0xb5c34[_0xb292('0x32')],_0x2ce5a1[_0xb292('0x33')]));if(_0xb5c34[_0xb292('0x32')][_0xb292('0x3e')]){_0x37c820[_0xb292('0x3c')]=_[_0xb292('0x3f')](_0x37c820['where'],{'$or':_[_0xb292('0x2b')](_0x37c820[_0xb292('0x35')],function(_0x53940c){var _0x2a0e41={};_0x2a0e41[_0x53940c]={'$like':'%'+_0xb5c34[_0xb292('0x32')]['filter']+'%'};return _0x2a0e41;})});}_0x37c820=_[_0xb292('0x3f')]({},_0x37c820,_0xb5c34['options']);return _0x16613b[_0xb292('0x4e')](_0x37c820);}})['then'](function(_0x1ad750){if(_0x1ad750){_0x39b4a4=_0x1ad750[_0xb292('0x37')];if(!_0xb5c34[_0xb292('0x32')][_0xb292('0x38')](_0xb292('0x39'))){_0x37c820['limit']=qs[_0xb292('0x1e')](_0xb5c34[_0xb292('0x32')][_0xb292('0x1e')]);_0x37c820['offset']=qs[_0xb292('0x1c')](_0xb5c34['query']['offset']);}return _0x16613b['getConfigurations'](_0x37c820);}})['then'](function(_0x553e36){if(_0x553e36){return _0x553e36?{'count':_0x39b4a4,'rows':_0x553e36}:null;}})[_0xb292('0x24')](respondWithResult(_0x3ed8f1,null))[_0xb292('0x45')](handleError(_0x3ed8f1,null));};exports[_0xb292('0x50')]=function(_0x1a53c5,_0x557f93,_0x50b44c){if(_0x1a53c5[_0xb292('0x4b')]['id']){delete _0x1a53c5[_0xb292('0x4b')]['id'];}return db[_0xb292('0x2c')][_0xb292('0x51')]({'where':{'id':_0x1a53c5[_0xb292('0x47')]['id']}})[_0xb292('0x24')](handleEntityNotFound(_0x557f93,null))[_0xb292('0x24')](function(_0x345b88){if(_0x345b88){_0x1a53c5[_0xb292('0x4b')][_0xb292('0x52')]=_0x345b88['id'];_0x1a53c5['body']['Subjects']=integrations[_0xb292('0x53')](_0x1a53c5[_0xb292('0x4b')]['channel'],_0x1a53c5[_0xb292('0x4b')][_0xb292('0x40')]);_0x1a53c5['body'][_0xb292('0x54')]=integrations[_0xb292('0x55')](_0x1a53c5[_0xb292('0x4b')]['channel'],_0x1a53c5[_0xb292('0x4b')][_0xb292('0x40')]);return db[_0xb292('0x4f')][_0xb292('0x4a')](_0x1a53c5['body'],{'include':[{'model':db[_0xb292('0x56')],'as':'Subjects'},{'model':db[_0xb292('0x56')],'as':'Descriptions'}]});}return null;})[_0xb292('0x24')](respondWithResult(_0x557f93,null))[_0xb292('0x45')](handleError(_0x557f93,null));};exports['getFields']=function(_0x435f57,_0x5c15d0,_0x3804e0){var _0x261d49='';return db[_0xb292('0x2c')][_0xb292('0x51')]({'where':{'id':_0x435f57[_0xb292('0x47')]['id']},'attributes':['id',_0xb292('0x57'),_0xb292('0x58')]})[_0xb292('0x24')](handleEntityNotFound(_0x5c15d0,null))[_0xb292('0x24')](function(_0x216a2c){if(_0x216a2c){_0x261d49=_0x216a2c[_0xb292('0x57')];var _0x5b48f3=_0x261d49['slice'](-0x1);if(_0x5b48f3==='/'){_0x261d49=_0x261d49['substring'](0x0,_0x261d49[_0xb292('0x59')](_0x5b48f3));}return rp({'method':_0xb292('0x5a'),'uri':util['format'](_0xb292('0x5b'),_0x261d49,_0xb292('0x5c')),'headers':{'Authorization':util[_0xb292('0x5d')](_0xb292('0x5e'),new Buffer(util[_0xb292('0x5d')](_0xb292('0x5f'),_0x216a2c[_0xb292('0x58')]))[_0xb292('0x60')]('base64'))},'json':!![]});}})['then'](function(_0x3e5e8f){if(_0x3e5e8f){var _0x339c04=[_0xb292('0x61'),_0xb292('0x62'),'agent',_0xb292('0x63'),_0xb292('0x1a'),_0xb292('0x64'),_0xb292('0x65'),_0xb292('0x66'),_0xb292('0x67'),_0xb292('0x65'),'company'];_[_0xb292('0x68')](_0x3e5e8f,function(_0x8e341){return _0x339c04[_0xb292('0x69')](_0x8e341['name'])||!_0x8e341[_0xb292('0x6a')]&&_0x8e341[_0xb292('0x40')]!==_0xb292('0x6b')&&_0x8e341[_0xb292('0x40')]!==_0xb292('0x6c');});return{'count':_0x3e5e8f[_0xb292('0x37')],'rows':_[_0xb292('0x2b')](_0x3e5e8f,function(_0x284a00){return{'id':_0x284a00[_0xb292('0x28')],'name':_0x284a00['label'],'custom':!_0x284a00[_0xb292('0x6a')],'options':_0x284a00[_0xb292('0x6d')]?_[_0xb292('0x2b')](_0x284a00[_0xb292('0x6d')],function(_0x56553b){return{'name':_[_0xb292('0x6e')](_0x56553b),'value':_0x56553b};}):[]};})};}})[_0xb292('0x24')](respondWithResult(_0x5c15d0,null))['catch'](function(_0x29b930){var _0x532f8d=_0x435f57[_0xb292('0x32')][_0xb292('0x6f')]?0x1f4:_0x29b930[_0xb292('0x70')]||0x1f4;logger[_0xb292('0x71')](_0xb292('0x72'),'getFields',_0x532f8d,JSON[_0xb292('0x73')](_0x29b930));delete _0x29b930[_0xb292('0x28')];if(_0x532f8d===0x191){_0x532f8d=0x190;}_0x5c15d0[_0xb292('0x1a')](_0x532f8d)['send'](_0x435f57[_0xb292('0x32')][_0xb292('0x6f')]?{'message':_0xb292('0x74'),'statusCode':_0x29b930[_0xb292('0x70')]}:_0x29b930);});}; \ No newline at end of file +var _0x0efe=['find','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','remoteUri','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','apiKey','toString','base64','requester','agent','priority','group','source','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','send','index','FreshdeskAccount','rawAttributes','type','key','map','name','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include'];(function(_0x408bb6,_0x51ec4a){var _0x830d87=function(_0x2a0ccd){while(--_0x2a0ccd){_0x408bb6['push'](_0x408bb6['shift']());}};_0x830d87(++_0x51ec4a);}(_0x0efe,0x110));var _0xe0ef=function(_0x53aa7d,_0x597ba8){_0x53aa7d=_0x53aa7d-0x0;var _0x3217d3=_0x0efe[_0x53aa7d];return _0x3217d3;};'use strict';var emlformat=require(_0xe0ef('0x0'));var rimraf=require(_0xe0ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0ef('0x2'));var rp=require(_0xe0ef('0x3'));var moment=require(_0xe0ef('0x4'));var BPromise=require(_0xe0ef('0x5'));var Mustache=require(_0xe0ef('0x6'));var util=require(_0xe0ef('0x7'));var path=require(_0xe0ef('0x8'));var sox=require(_0xe0ef('0x9'));var csv=require(_0xe0ef('0xa'));var ejs=require(_0xe0ef('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe0ef('0xc'));var crypto=require(_0xe0ef('0xd'));var jsforce=require(_0xe0ef('0xe'));var deskjs=require(_0xe0ef('0xf'));var toCsv=require(_0xe0ef('0xa'));var querystring=require(_0xe0ef('0x10'));var Papa=require(_0xe0ef('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe0ef('0x12'));var as=require(_0xe0ef('0x13'));var hardwareService=require(_0xe0ef('0x14'));var logger=require('../../config/logger')(_0xe0ef('0x15'));var utils=require(_0xe0ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe0ef('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe0ef('0x18'));function respondWithStatusCode(_0x90c232,_0x3cce82){_0x3cce82=_0x3cce82||0xcc;return function(_0x4fbb4d){if(_0x4fbb4d){return _0x90c232['sendStatus'](_0x3cce82);}return _0x90c232[_0xe0ef('0x19')](_0x3cce82)[_0xe0ef('0x1a')]();};}function respondWithResult(_0x1afbbc,_0x1fbfd0){_0x1fbfd0=_0x1fbfd0||0xc8;return function(_0x3576ba){if(_0x3576ba){return _0x1afbbc[_0xe0ef('0x19')](_0x1fbfd0)[_0xe0ef('0x1b')](_0x3576ba);}};}function respondWithFilteredResult(_0x1177d2,_0x5d845d){return function(_0x401f4a){if(_0x401f4a){var _0x134b4e=typeof _0x5d845d[_0xe0ef('0x1c')]===_0xe0ef('0x1d')&&typeof _0x5d845d[_0xe0ef('0x1e')]==='undefined';var _0x183d67=_0x401f4a[_0xe0ef('0x1f')];var _0x1d6ff4=_0x134b4e?0x0:_0x5d845d[_0xe0ef('0x1c')];var _0x2a2f6f=_0x134b4e?_0x401f4a[_0xe0ef('0x1f')]:_0x5d845d[_0xe0ef('0x1c')]+_0x5d845d[_0xe0ef('0x1e')];var _0x3e507c;if(_0x2a2f6f>=_0x183d67){_0x2a2f6f=_0x183d67;_0x3e507c=0xc8;}else{_0x3e507c=0xce;}_0x1177d2[_0xe0ef('0x19')](_0x3e507c);return _0x1177d2[_0xe0ef('0x20')](_0xe0ef('0x21'),_0x1d6ff4+'-'+_0x2a2f6f+'/'+_0x183d67)[_0xe0ef('0x1b')](_0x401f4a);}return null;};}function patchUpdates(_0x50c044){return function(_0x3d8b86){try{jsonpatch[_0xe0ef('0x22')](_0x3d8b86,_0x50c044,!![]);}catch(_0x457d67){return BPromise[_0xe0ef('0x23')](_0x457d67);}return _0x3d8b86['save']();};}function saveUpdates(_0x140f42,_0x115cb3){return function(_0x169667){if(_0x169667){return _0x169667[_0xe0ef('0x24')](_0x140f42)[_0xe0ef('0x25')](function(_0x1c8270){return _0x1c8270;});}return null;};}function removeEntity(_0x255b55,_0x59b64c){return function(_0x375ed7){if(_0x375ed7){return _0x375ed7[_0xe0ef('0x26')]()['then'](function(){_0x255b55[_0xe0ef('0x19')](0xcc)[_0xe0ef('0x1a')]();});}};}function handleEntityNotFound(_0x5bc53a,_0x576082){return function(_0x521a14){if(!_0x521a14){_0x5bc53a[_0xe0ef('0x27')](0x194);}return _0x521a14;};}function handleError(_0x4ee2c1,_0x3f4e80){_0x3f4e80=_0x3f4e80||0x1f4;return function(_0x1b40f5){logger[_0xe0ef('0x28')](_0x1b40f5['stack']);if(_0x1b40f5['name']){delete _0x1b40f5['name'];}_0x4ee2c1[_0xe0ef('0x19')](_0x3f4e80)[_0xe0ef('0x29')](_0x1b40f5);};}exports[_0xe0ef('0x2a')]=function(_0x31e576,_0x2d1674){var _0x2b0d3c={},_0x567460={},_0x568da7={'count':0x0,'rows':[]};var _0x3e5abd=_['map'](db[_0xe0ef('0x2b')][_0xe0ef('0x2c')],function(_0x51feca){return{'name':_0x51feca['fieldName'],'type':_0x51feca[_0xe0ef('0x2d')][_0xe0ef('0x2e')]};});_0x567460['model']=_[_0xe0ef('0x2f')](_0x3e5abd,_0xe0ef('0x30'));_0x567460[_0xe0ef('0x31')]=_['keys'](_0x31e576['query']);_0x567460['filters']=_[_0xe0ef('0x32')](_0x567460['model'],_0x567460[_0xe0ef('0x31')]);_0x2b0d3c[_0xe0ef('0x33')]=_['intersection'](_0x567460[_0xe0ef('0x34')],qs[_0xe0ef('0x35')](_0x31e576['query'][_0xe0ef('0x35')]));_0x2b0d3c[_0xe0ef('0x33')]=_0x2b0d3c[_0xe0ef('0x33')][_0xe0ef('0x36')]?_0x2b0d3c['attributes']:_0x567460[_0xe0ef('0x34')];if(!_0x31e576[_0xe0ef('0x31')][_0xe0ef('0x37')](_0xe0ef('0x38'))){_0x2b0d3c['limit']=qs[_0xe0ef('0x1e')](_0x31e576[_0xe0ef('0x31')][_0xe0ef('0x1e')]);_0x2b0d3c[_0xe0ef('0x1c')]=qs[_0xe0ef('0x1c')](_0x31e576[_0xe0ef('0x31')][_0xe0ef('0x1c')]);}_0x2b0d3c[_0xe0ef('0x39')]=qs[_0xe0ef('0x3a')](_0x31e576['query'][_0xe0ef('0x3a')]);_0x2b0d3c[_0xe0ef('0x3b')]=qs[_0xe0ef('0x3c')](_[_0xe0ef('0x3d')](_0x31e576[_0xe0ef('0x31')],_0x567460[_0xe0ef('0x3c')]),_0x3e5abd);if(_0x31e576[_0xe0ef('0x31')][_0xe0ef('0x3e')]){_0x2b0d3c[_0xe0ef('0x3b')]=_[_0xe0ef('0x3f')](_0x2b0d3c[_0xe0ef('0x3b')],{'$or':_[_0xe0ef('0x2f')](_0x3e5abd,function(_0x38243e){if(_0x38243e['type']!=='VIRTUAL'){var _0x1cde8f={};_0x1cde8f[_0x38243e[_0xe0ef('0x30')]]={'$like':'%'+_0x31e576[_0xe0ef('0x31')][_0xe0ef('0x3e')]+'%'};return _0x1cde8f;}})});}_0x2b0d3c=_['merge']({},_0x2b0d3c,_0x31e576[_0xe0ef('0x40')]);var _0x398e41={'where':_0x2b0d3c['where']};return db[_0xe0ef('0x2b')]['count'](_0x398e41)['then'](function(_0x1c0f3f){_0x568da7[_0xe0ef('0x1f')]=_0x1c0f3f;if(_0x31e576[_0xe0ef('0x31')][_0xe0ef('0x41')]){_0x2b0d3c['include']=[{'all':!![]}];}return db[_0xe0ef('0x2b')][_0xe0ef('0x42')](_0x2b0d3c);})['then'](function(_0x454c93){_0x568da7[_0xe0ef('0x43')]=_0x454c93;return _0x568da7;})[_0xe0ef('0x25')](respondWithFilteredResult(_0x2d1674,_0x2b0d3c))[_0xe0ef('0x44')](handleError(_0x2d1674,null));};exports[_0xe0ef('0x45')]=function(_0x1876b6,_0x1eecda){var _0xb25bc={'raw':![],'where':{'id':_0x1876b6[_0xe0ef('0x46')]['id']}},_0x39755b={};_0x39755b['model']=_[_0xe0ef('0x47')](db['FreshdeskAccount'][_0xe0ef('0x2c')]);_0x39755b['query']=_[_0xe0ef('0x47')](_0x1876b6[_0xe0ef('0x31')]);_0x39755b[_0xe0ef('0x3c')]=_['intersection'](_0x39755b['model'],_0x39755b[_0xe0ef('0x31')]);_0xb25bc['attributes']=_[_0xe0ef('0x32')](_0x39755b['model'],qs[_0xe0ef('0x35')](_0x1876b6[_0xe0ef('0x31')][_0xe0ef('0x35')]));_0xb25bc[_0xe0ef('0x33')]=_0xb25bc[_0xe0ef('0x33')][_0xe0ef('0x36')]?_0xb25bc[_0xe0ef('0x33')]:_0x39755b['model'];if(_0x1876b6[_0xe0ef('0x31')][_0xe0ef('0x41')]){_0xb25bc[_0xe0ef('0x48')]=[{'all':!![]}];}_0xb25bc=_['merge']({},_0xb25bc,_0x1876b6[_0xe0ef('0x40')]);return db[_0xe0ef('0x2b')][_0xe0ef('0x49')](_0xb25bc)['then'](handleEntityNotFound(_0x1eecda,null))[_0xe0ef('0x25')](respondWithResult(_0x1eecda,null))[_0xe0ef('0x44')](handleError(_0x1eecda,null));};exports[_0xe0ef('0x4a')]=function(_0x469173,_0x49b71b){return db[_0xe0ef('0x2b')][_0xe0ef('0x4a')](_0x469173[_0xe0ef('0x4b')],{})[_0xe0ef('0x25')](respondWithResult(_0x49b71b,0xc9))['catch'](handleError(_0x49b71b,null));};exports[_0xe0ef('0x24')]=function(_0xb8e656,_0xd11dbb){if(_0xb8e656[_0xe0ef('0x4b')]['id']){delete _0xb8e656[_0xe0ef('0x4b')]['id'];}return db[_0xe0ef('0x2b')][_0xe0ef('0x49')]({'where':{'id':_0xb8e656[_0xe0ef('0x46')]['id']}})[_0xe0ef('0x25')](handleEntityNotFound(_0xd11dbb,null))[_0xe0ef('0x25')](saveUpdates(_0xb8e656[_0xe0ef('0x4b')],null))[_0xe0ef('0x25')](respondWithResult(_0xd11dbb,null))[_0xe0ef('0x44')](handleError(_0xd11dbb,null));};exports[_0xe0ef('0x26')]=function(_0x13135d,_0x5e0bb9){return db['FreshdeskAccount'][_0xe0ef('0x49')]({'where':{'id':_0x13135d[_0xe0ef('0x46')]['id']}})[_0xe0ef('0x25')](handleEntityNotFound(_0x5e0bb9,null))[_0xe0ef('0x25')](removeEntity(_0x5e0bb9,null))[_0xe0ef('0x44')](handleError(_0x5e0bb9,null));};exports[_0xe0ef('0x4c')]=function(_0x4bf78f,_0x4772b7,_0x2807bd){var _0x2f9251={};var _0x690b34={};var _0x1a7b5d;var _0x53fcdb;return db[_0xe0ef('0x2b')]['findOne']({'where':{'id':_0x4bf78f[_0xe0ef('0x46')]['id']}})[_0xe0ef('0x25')](handleEntityNotFound(_0x4772b7,null))[_0xe0ef('0x25')](function(_0x577b62){if(_0x577b62){_0x1a7b5d=_0x577b62;_0x690b34['model']=_[_0xe0ef('0x47')](db[_0xe0ef('0x4d')][_0xe0ef('0x2c')]);_0x690b34[_0xe0ef('0x31')]=_[_0xe0ef('0x47')](_0x4bf78f[_0xe0ef('0x31')]);_0x690b34['filters']=_[_0xe0ef('0x32')](_0x690b34[_0xe0ef('0x34')],_0x690b34[_0xe0ef('0x31')]);_0x2f9251['attributes']=_[_0xe0ef('0x32')](_0x690b34['model'],qs[_0xe0ef('0x35')](_0x4bf78f[_0xe0ef('0x31')][_0xe0ef('0x35')]));_0x2f9251[_0xe0ef('0x33')]=_0x2f9251['attributes']['length']?_0x2f9251[_0xe0ef('0x33')]:_0x690b34[_0xe0ef('0x34')];_0x2f9251[_0xe0ef('0x39')]=qs[_0xe0ef('0x3a')](_0x4bf78f[_0xe0ef('0x31')][_0xe0ef('0x3a')]);_0x2f9251[_0xe0ef('0x3b')]=qs[_0xe0ef('0x3c')](_['pick'](_0x4bf78f[_0xe0ef('0x31')],_0x690b34[_0xe0ef('0x3c')]));if(_0x4bf78f[_0xe0ef('0x31')][_0xe0ef('0x3e')]){_0x2f9251[_0xe0ef('0x3b')]=_[_0xe0ef('0x3f')](_0x2f9251['where'],{'$or':_[_0xe0ef('0x2f')](_0x2f9251[_0xe0ef('0x33')],function(_0x5e596a){var _0x539498={};_0x539498[_0x5e596a]={'$like':'%'+_0x4bf78f[_0xe0ef('0x31')]['filter']+'%'};return _0x539498;})});}_0x2f9251=_[_0xe0ef('0x3f')]({},_0x2f9251,_0x4bf78f[_0xe0ef('0x40')]);return _0x1a7b5d[_0xe0ef('0x4c')](_0x2f9251);}})[_0xe0ef('0x25')](function(_0x52b06c){if(_0x52b06c){_0x53fcdb=_0x52b06c[_0xe0ef('0x36')];if(!_0x4bf78f[_0xe0ef('0x31')][_0xe0ef('0x37')](_0xe0ef('0x38'))){_0x2f9251[_0xe0ef('0x1e')]=qs[_0xe0ef('0x1e')](_0x4bf78f[_0xe0ef('0x31')][_0xe0ef('0x1e')]);_0x2f9251['offset']=qs['offset'](_0x4bf78f[_0xe0ef('0x31')][_0xe0ef('0x1c')]);}return _0x1a7b5d['getConfigurations'](_0x2f9251);}})[_0xe0ef('0x25')](function(_0x4d63d0){if(_0x4d63d0){return _0x4d63d0?{'count':_0x53fcdb,'rows':_0x4d63d0}:null;}})[_0xe0ef('0x25')](respondWithResult(_0x4772b7,null))['catch'](handleError(_0x4772b7,null));};exports[_0xe0ef('0x4e')]=function(_0x45373d,_0x1b2ebe,_0x24a31d){if(_0x45373d[_0xe0ef('0x4b')]['id']){delete _0x45373d[_0xe0ef('0x4b')]['id'];}return db[_0xe0ef('0x2b')][_0xe0ef('0x4f')]({'where':{'id':_0x45373d[_0xe0ef('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b2ebe,null))[_0xe0ef('0x25')](function(_0x8ab738){if(_0x8ab738){_0x45373d[_0xe0ef('0x4b')][_0xe0ef('0x50')]=_0x8ab738['id'];_0x45373d[_0xe0ef('0x4b')]['Subjects']=integrations[_0xe0ef('0x51')](_0x45373d['body'][_0xe0ef('0x52')],_0x45373d[_0xe0ef('0x4b')][_0xe0ef('0x2d')]);_0x45373d[_0xe0ef('0x4b')][_0xe0ef('0x53')]=integrations[_0xe0ef('0x54')](_0x45373d['body'][_0xe0ef('0x52')],_0x45373d['body']['type']);return db[_0xe0ef('0x4d')][_0xe0ef('0x4a')](_0x45373d[_0xe0ef('0x4b')],{'include':[{'model':db[_0xe0ef('0x55')],'as':_0xe0ef('0x56')},{'model':db[_0xe0ef('0x55')],'as':_0xe0ef('0x53')}]});}return null;})[_0xe0ef('0x25')](respondWithResult(_0x1b2ebe,null))[_0xe0ef('0x44')](handleError(_0x1b2ebe,null));};exports['getFields']=function(_0x3c8204,_0xbf1138,_0x355c5b){var _0x2e7a0e='';return db[_0xe0ef('0x2b')][_0xe0ef('0x4f')]({'where':{'id':_0x3c8204[_0xe0ef('0x46')]['id']},'attributes':['id','remoteUri','apiKey']})[_0xe0ef('0x25')](handleEntityNotFound(_0xbf1138,null))[_0xe0ef('0x25')](function(_0x2479b0){if(_0x2479b0){_0x2e7a0e=_0x2479b0[_0xe0ef('0x57')];var _0x5ccf3d=_0x2e7a0e['slice'](-0x1);if(_0x5ccf3d==='/'){_0x2e7a0e=_0x2e7a0e[_0xe0ef('0x58')](0x0,_0x2e7a0e[_0xe0ef('0x59')](_0x5ccf3d));}return rp({'method':'GET','uri':util[_0xe0ef('0x5a')](_0xe0ef('0x5b'),_0x2e7a0e,_0xe0ef('0x5c')),'headers':{'Authorization':util[_0xe0ef('0x5a')](_0xe0ef('0x5d'),new Buffer(util[_0xe0ef('0x5a')]('%s:X',_0x2479b0[_0xe0ef('0x5e')]))[_0xe0ef('0x5f')](_0xe0ef('0x60')))},'json':!![]});}})[_0xe0ef('0x25')](function(_0x4fe4e2){if(_0x4fe4e2){var _0x5e54db=[_0xe0ef('0x61'),'subject',_0xe0ef('0x62'),'description',_0xe0ef('0x19'),_0xe0ef('0x63'),_0xe0ef('0x64'),_0xe0ef('0x65'),'ticket_type',_0xe0ef('0x64'),_0xe0ef('0x66')];_[_0xe0ef('0x67')](_0x4fe4e2,function(_0x53bfbf){return _0x5e54db[_0xe0ef('0x68')](_0x53bfbf[_0xe0ef('0x30')])||!_0x53bfbf[_0xe0ef('0x69')]&&_0x53bfbf[_0xe0ef('0x2d')]!==_0xe0ef('0x6a')&&_0x53bfbf[_0xe0ef('0x2d')]!==_0xe0ef('0x6b');});return{'count':_0x4fe4e2[_0xe0ef('0x36')],'rows':_['map'](_0x4fe4e2,function(_0x328f91){return{'id':_0x328f91[_0xe0ef('0x30')],'name':_0x328f91['label'],'custom':!_0x328f91[_0xe0ef('0x69')],'options':_0x328f91[_0xe0ef('0x6c')]?_['map'](_0x328f91['choices'],function(_0x5a0e39){return{'name':_[_0xe0ef('0x6d')](_0x5a0e39),'value':_0x5a0e39};}):[]};})};}})[_0xe0ef('0x25')](respondWithResult(_0xbf1138,null))[_0xe0ef('0x44')](function(_0x515f4f){var _0x3578e7=_0x3c8204[_0xe0ef('0x31')][_0xe0ef('0x6e')]?0x1f4:_0x515f4f[_0xe0ef('0x6f')]||0x1f4;logger[_0xe0ef('0x28')](_0xe0ef('0x70'),_0xe0ef('0x71'),_0x3578e7,JSON['stringify'](_0x515f4f));delete _0x515f4f[_0xe0ef('0x30')];if(_0x3578e7===0x191){_0x3578e7=0x190;}_0xbf1138[_0xe0ef('0x19')](_0x3578e7)[_0xe0ef('0x29')](_0x3c8204[_0xe0ef('0x31')][_0xe0ef('0x6e')]?{'message':_0xe0ef('0x72'),'statusCode':_0x515f4f['statusCode']}:_0x515f4f);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index efe87be..eb21044 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 _0x4a81=['../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x3b0265,_0x54c4b6){var _0x4d6215=function(_0x431a45){while(--_0x431a45){_0x3b0265['push'](_0x3b0265['shift']());}};_0x4d6215(++_0x54c4b6);}(_0x4a81,0x1c0));var _0x14a8=function(_0x571827,_0x3ee620){_0x571827=_0x571827-0x0;var _0x5d56ed=_0x4a81[_0x571827];return _0x5d56ed;};'use strict';var _=require(_0x14a8('0x0'));var util=require(_0x14a8('0x1'));var logger=require(_0x14a8('0x2'))(_0x14a8('0x3'));var moment=require(_0x14a8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x14a8('0x5'));var rimraf=require(_0x14a8('0x6'));var config=require(_0x14a8('0x7'));var attributes=require(_0x14a8('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x14a8('0x9')]=function(_0x1e4fde,_0x3c5a2e){return _0x1e4fde[_0x14a8('0xa')](_0x14a8('0xb'),attributes,{'tableName':_0x14a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fbe=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0x8fbe,0x1db));var _0xe8fb=function(_0x97d399,_0x218d12){_0x97d399=_0x97d399-0x0;var _0x46d733=_0x8fbe[_0x97d399];return _0x46d733;};'use strict';var _=require('lodash');var util=require(_0xe8fb('0x0'));var logger=require(_0xe8fb('0x1'))(_0xe8fb('0x2'));var moment=require(_0xe8fb('0x3'));var BPromise=require(_0xe8fb('0x4'));var rp=require(_0xe8fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe8fb('0x6'));var attributes=require(_0xe8fb('0x7'));var integrations=require(_0xe8fb('0x8'));module[_0xe8fb('0x9')]=function(_0x1a51e1,_0x2e73c9){return _0x1a51e1[_0xe8fb('0xa')](_0xe8fb('0xb'),attributes,{'tableName':_0xe8fb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index d4a6616..adc8e3a 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 _0xb2a7=['raw','include','map','model','attributes','ShowFreshdeskAccount','FreshdeskAccount','where','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options'];(function(_0x51c52b,_0x147712){var _0x581ce3=function(_0x2e61a0){while(--_0x2e61a0){_0x51c52b['push'](_0x51c52b['shift']());}};_0x581ce3(++_0x147712);}(_0xb2a7,0xe8));var _0x7b2a=function(_0xdca351,_0x367d1a){_0xdca351=_0xdca351-0x0;var _0x20da96=_0xb2a7[_0xdca351];return _0x20da96;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7b2a('0x0'));var BPromise=require(_0x7b2a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b2a('0x2'));var db=require(_0x7b2a('0x3'))['db'];var utils=require(_0x7b2a('0x4'));var logger=require(_0x7b2a('0x5'))('rpc');var config=require(_0x7b2a('0x6'));var jayson=require(_0x7b2a('0x7'));var client=jayson[_0x7b2a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2de1ad,_0x4490e2,_0x458f3a){return new BPromise(function(_0x4be2b9,_0x2e3fa8){return client[_0x7b2a('0x9')](_0x2de1ad,_0x458f3a)[_0x7b2a('0xa')](function(_0x164d01){logger[_0x7b2a('0xb')](_0x7b2a('0xc'),_0x4490e2,_0x7b2a('0xd'));logger[_0x7b2a('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x4490e2,_0x7b2a('0xd'),JSON[_0x7b2a('0xf')](_0x164d01));if(_0x164d01[_0x7b2a('0x10')]){if(_0x164d01[_0x7b2a('0x10')][_0x7b2a('0x11')]===0x1f4){logger[_0x7b2a('0x10')](_0x7b2a('0xc'),_0x4490e2,_0x164d01[_0x7b2a('0x10')]['message']);return _0x2e3fa8(_0x164d01[_0x7b2a('0x10')]['message']);}logger[_0x7b2a('0x10')](_0x7b2a('0xc'),_0x4490e2,_0x164d01[_0x7b2a('0x10')]['message']);return _0x4be2b9(_0x164d01[_0x7b2a('0x10')][_0x7b2a('0x12')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x4490e2,_0x7b2a('0xd'));_0x4be2b9(_0x164d01[_0x7b2a('0x13')]['message']);}})[_0x7b2a('0x14')](function(_0x50604e){logger[_0x7b2a('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x4490e2,_0x50604e);_0x2e3fa8(_0x50604e);});});}exports[_0x7b2a('0x15')]=function(_0x5b30ae){var _0xb83a6a=this;return new Promise(function(_0xf697f8,_0x2575b2){return db['FreshdeskAccount'][_0x7b2a('0x16')]({'raw':_0x5b30ae['options']?_0x5b30ae[_0x7b2a('0x17')][_0x7b2a('0x18')]===undefined?!![]:![]:!![],'where':_0x5b30ae[_0x7b2a('0x17')]?_0x5b30ae[_0x7b2a('0x17')]['where']||null:null,'attributes':_0x5b30ae[_0x7b2a('0x17')]?_0x5b30ae['options']['attributes']||null:null,'limit':_0x5b30ae['options']?_0x5b30ae['options']['limit']||null:null,'include':_0x5b30ae[_0x7b2a('0x17')]?_0x5b30ae[_0x7b2a('0x17')][_0x7b2a('0x19')]?_[_0x7b2a('0x1a')](_0x5b30ae[_0x7b2a('0x17')][_0x7b2a('0x19')],function(_0x3e1d6f){return{'model':db[_0x3e1d6f[_0x7b2a('0x1b')]],'as':_0x3e1d6f['as'],'attributes':_0x3e1d6f[_0x7b2a('0x1c')],'include':_0x3e1d6f[_0x7b2a('0x19')]?_['map'](_0x3e1d6f[_0x7b2a('0x19')],function(_0x33a091){return{'model':db[_0x33a091[_0x7b2a('0x1b')]],'as':_0x33a091['as'],'attributes':_0x33a091['attributes'],'include':_0x33a091[_0x7b2a('0x19')]?_[_0x7b2a('0x1a')](_0x33a091[_0x7b2a('0x19')],function(_0xb956c){return{'model':db[_0xb956c[_0x7b2a('0x1b')]],'as':_0xb956c['as'],'attributes':_0xb956c['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b2a('0xa')](function(_0x49cbf8){logger['info'](_0x7b2a('0x15'),_0x5b30ae);logger[_0x7b2a('0xe')]('GetFreshdeskAccount',_0x5b30ae,JSON[_0x7b2a('0xf')](_0x49cbf8));_0xf697f8(_0x49cbf8);})['catch'](function(_0x2e47ce){logger[_0x7b2a('0x10')](_0x7b2a('0x15'),_0x2e47ce['message'],_0x5b30ae);_0x2575b2(_0xb83a6a[_0x7b2a('0x10')](0x1f4,_0x2e47ce['message']));});});};exports[_0x7b2a('0x1d')]=function(_0x422aab){var _0x262a22=this;return new Promise(function(_0x28d22a,_0x58c652){return db[_0x7b2a('0x1e')]['find']({'raw':_0x422aab[_0x7b2a('0x17')]?_0x422aab[_0x7b2a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x422aab[_0x7b2a('0x17')]?_0x422aab[_0x7b2a('0x17')][_0x7b2a('0x1f')]||null:null,'attributes':_0x422aab[_0x7b2a('0x17')]?_0x422aab[_0x7b2a('0x17')]['attributes']||null:null,'include':_0x422aab['options']?_0x422aab['options'][_0x7b2a('0x19')]?_[_0x7b2a('0x1a')](_0x422aab[_0x7b2a('0x17')]['include'],function(_0x37f860){return{'model':db[_0x37f860[_0x7b2a('0x1b')]],'as':_0x37f860['as'],'attributes':_0x37f860['attributes'],'include':_0x37f860['include']?_['map'](_0x37f860[_0x7b2a('0x19')],function(_0x3b023e){return{'model':db[_0x3b023e[_0x7b2a('0x1b')]],'as':_0x3b023e['as'],'attributes':_0x3b023e[_0x7b2a('0x1c')],'include':_0x3b023e[_0x7b2a('0x19')]?_['map'](_0x3b023e[_0x7b2a('0x19')],function(_0x5b1f72){return{'model':db[_0x5b1f72[_0x7b2a('0x1b')]],'as':_0x5b1f72['as'],'attributes':_0x5b1f72['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b2a('0xa')](function(_0x1d9de9){logger[_0x7b2a('0xb')]('ShowFreshdeskAccount',_0x422aab);logger['debug'](_0x7b2a('0x1d'),_0x422aab,JSON['stringify'](_0x1d9de9));_0x28d22a(_0x1d9de9);})[_0x7b2a('0x14')](function(_0x1b274d){logger[_0x7b2a('0x10')]('ShowFreshdeskAccount',_0x1b274d[_0x7b2a('0x12')],_0x422aab);_0x58c652(_0x262a22[_0x7b2a('0x10')](0x1f4,_0x1b274d[_0x7b2a('0x12')]));});});}; \ No newline at end of file +var _0xc6d7=['map','include','model','attributes','then','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','http','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','findAll','options','raw','where','limit'];(function(_0x511577,_0x2ec0cf){var _0x1b9201=function(_0x334aac){while(--_0x334aac){_0x511577['push'](_0x511577['shift']());}};_0x1b9201(++_0x2ec0cf);}(_0xc6d7,0x174));var _0x7c6d=function(_0x2def5e,_0x55e435){_0x2def5e=_0x2def5e-0x0;var _0x592d35=_0xc6d7[_0x2def5e];return _0x592d35;};'use strict';var _=require(_0x7c6d('0x0'));var util=require('util');var moment=require(_0x7c6d('0x1'));var BPromise=require(_0x7c6d('0x2'));var rs=require(_0x7c6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c6d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7c6d('0x5'));var config=require(_0x7c6d('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7c6d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x30a90c,_0xbe91a9,_0x44277d){return new BPromise(function(_0x2b8ea2,_0x107d2c){return client['request'](_0x30a90c,_0x44277d)['then'](function(_0x252daa){logger['info'](_0x7c6d('0x8'),_0xbe91a9,_0x7c6d('0x9'));logger[_0x7c6d('0xa')](_0x7c6d('0xb'),_0xbe91a9,'request\x20sent',JSON[_0x7c6d('0xc')](_0x252daa));if(_0x252daa['error']){if(_0x252daa['error'][_0x7c6d('0xd')]===0x1f4){logger[_0x7c6d('0xe')](_0x7c6d('0x8'),_0xbe91a9,_0x252daa['error']['message']);return _0x107d2c(_0x252daa[_0x7c6d('0xe')][_0x7c6d('0xf')]);}logger['error'](_0x7c6d('0x8'),_0xbe91a9,_0x252daa[_0x7c6d('0xe')][_0x7c6d('0xf')]);return _0x2b8ea2(_0x252daa[_0x7c6d('0xe')][_0x7c6d('0xf')]);}else{logger[_0x7c6d('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0xbe91a9,_0x7c6d('0x9'));_0x2b8ea2(_0x252daa[_0x7c6d('0x11')][_0x7c6d('0xf')]);}})[_0x7c6d('0x12')](function(_0x2bd9d3){logger['error'](_0x7c6d('0x8'),_0xbe91a9,_0x2bd9d3);_0x107d2c(_0x2bd9d3);});});}exports['GetFreshdeskAccount']=function(_0x855d7a){var _0x3c9951=this;return new Promise(function(_0x5990c7,_0x48a606){return db['FreshdeskAccount'][_0x7c6d('0x13')]({'raw':_0x855d7a['options']?_0x855d7a[_0x7c6d('0x14')][_0x7c6d('0x15')]===undefined?!![]:![]:!![],'where':_0x855d7a[_0x7c6d('0x14')]?_0x855d7a[_0x7c6d('0x14')][_0x7c6d('0x16')]||null:null,'attributes':_0x855d7a[_0x7c6d('0x14')]?_0x855d7a['options']['attributes']||null:null,'limit':_0x855d7a[_0x7c6d('0x14')]?_0x855d7a[_0x7c6d('0x14')][_0x7c6d('0x17')]||null:null,'include':_0x855d7a[_0x7c6d('0x14')]?_0x855d7a[_0x7c6d('0x14')]['include']?_[_0x7c6d('0x18')](_0x855d7a['options'][_0x7c6d('0x19')],function(_0x4c0f46){return{'model':db[_0x4c0f46[_0x7c6d('0x1a')]],'as':_0x4c0f46['as'],'attributes':_0x4c0f46['attributes'],'include':_0x4c0f46[_0x7c6d('0x19')]?_[_0x7c6d('0x18')](_0x4c0f46['include'],function(_0x40b7b1){return{'model':db[_0x40b7b1['model']],'as':_0x40b7b1['as'],'attributes':_0x40b7b1[_0x7c6d('0x1b')],'include':_0x40b7b1[_0x7c6d('0x19')]?_['map'](_0x40b7b1[_0x7c6d('0x19')],function(_0x494f8){return{'model':db[_0x494f8['model']],'as':_0x494f8['as'],'attributes':_0x494f8['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c6d('0x1c')](function(_0x1506c3){logger[_0x7c6d('0x10')](_0x7c6d('0x1d'),_0x855d7a);logger[_0x7c6d('0xa')](_0x7c6d('0x1d'),_0x855d7a,JSON[_0x7c6d('0xc')](_0x1506c3));_0x5990c7(_0x1506c3);})[_0x7c6d('0x12')](function(_0x3801a5){logger[_0x7c6d('0xe')](_0x7c6d('0x1d'),_0x3801a5['message'],_0x855d7a);_0x48a606(_0x3c9951[_0x7c6d('0xe')](0x1f4,_0x3801a5['message']));});});};exports[_0x7c6d('0x1e')]=function(_0x18feb7){var _0x5ea41f=this;return new Promise(function(_0x175b65,_0x58302d){return db[_0x7c6d('0x1f')][_0x7c6d('0x20')]({'raw':_0x18feb7['options']?_0x18feb7['options'][_0x7c6d('0x15')]===undefined?!![]:![]:!![],'where':_0x18feb7['options']?_0x18feb7[_0x7c6d('0x14')][_0x7c6d('0x16')]||null:null,'attributes':_0x18feb7[_0x7c6d('0x14')]?_0x18feb7[_0x7c6d('0x14')][_0x7c6d('0x1b')]||null:null,'include':_0x18feb7[_0x7c6d('0x14')]?_0x18feb7[_0x7c6d('0x14')][_0x7c6d('0x19')]?_[_0x7c6d('0x18')](_0x18feb7[_0x7c6d('0x14')][_0x7c6d('0x19')],function(_0x2e4c86){return{'model':db[_0x2e4c86[_0x7c6d('0x1a')]],'as':_0x2e4c86['as'],'attributes':_0x2e4c86['attributes'],'include':_0x2e4c86['include']?_['map'](_0x2e4c86['include'],function(_0x56a3a6){return{'model':db[_0x56a3a6[_0x7c6d('0x1a')]],'as':_0x56a3a6['as'],'attributes':_0x56a3a6[_0x7c6d('0x1b')],'include':_0x56a3a6[_0x7c6d('0x19')]?_[_0x7c6d('0x18')](_0x56a3a6[_0x7c6d('0x19')],function(_0x1e0104){return{'model':db[_0x1e0104[_0x7c6d('0x1a')]],'as':_0x1e0104['as'],'attributes':_0x1e0104[_0x7c6d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7c6d('0x1c')](function(_0x28c93a){logger['info'](_0x7c6d('0x1e'),_0x18feb7);logger[_0x7c6d('0xa')](_0x7c6d('0x1e'),_0x18feb7,JSON['stringify'](_0x28c93a));_0x175b65(_0x28c93a);})[_0x7c6d('0x12')](function(_0x14f3bd){logger[_0x7c6d('0xe')](_0x7c6d('0x1e'),_0x14f3bd[_0x7c6d('0xf')],_0x18feb7);_0x58302d(_0x5ea41f[_0x7c6d('0xe')](0x1f4,_0x14f3bd['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 381f4d3..269d618 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 _0xcaa8=['getFields','getDescriptions','/:id/tags','getTags','post','create','setTags','/:id','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x5b8a3b,_0x5f1e06){var _0x586e61=function(_0x2da91f){while(--_0x2da91f){_0x5b8a3b['push'](_0x5b8a3b['shift']());}};_0x586e61(++_0x5f1e06);}(_0xcaa8,0x1d3));var _0x8caa=function(_0x31ca46,_0x1aaabd){_0x31ca46=_0x31ca46-0x0;var _0x46d55d=_0xcaa8[_0x31ca46];return _0x46d55d;};'use strict';var multer=require('multer');var util=require(_0x8caa('0x0'));var path=require(_0x8caa('0x1'));var timeout=require('connect-timeout');var express=require(_0x8caa('0x2'));var router=express[_0x8caa('0x3')]();var fs_extra=require(_0x8caa('0x4'));var auth=require(_0x8caa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8caa('0x6'));var controller=require(_0x8caa('0x7'));router[_0x8caa('0x8')]('/',auth[_0x8caa('0x9')](),controller[_0x8caa('0xa')]);router[_0x8caa('0x8')]('/:id',auth[_0x8caa('0x9')](),controller[_0x8caa('0xb')]);router['get'](_0x8caa('0xc'),auth[_0x8caa('0x9')](),controller[_0x8caa('0xd')]);router['get']('/:id/subjects',auth[_0x8caa('0x9')](),controller['getSubjects']);router[_0x8caa('0x8')]('/:id/descriptions',auth[_0x8caa('0x9')](),controller[_0x8caa('0xe')]);router[_0x8caa('0x8')](_0x8caa('0xf'),auth[_0x8caa('0x9')](),controller[_0x8caa('0x10')]);router[_0x8caa('0x11')]('/',auth['isAuthenticated'](),controller[_0x8caa('0x12')]);router[_0x8caa('0x11')](_0x8caa('0xf'),auth[_0x8caa('0x9')](),controller[_0x8caa('0x13')]);router['put'](_0x8caa('0x14'),auth['isAuthenticated'](),controller[_0x8caa('0x15')]);router[_0x8caa('0x16')](_0x8caa('0x14'),auth[_0x8caa('0x9')](),controller[_0x8caa('0x17')]);module['exports']=router; \ No newline at end of file +var _0x79bc=['/:id/descriptions','/:id/tags','create','post','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x79bc,0xa0));var _0xc79b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x79bc[_0x40a045];return _0x1a687c;};'use strict';var multer=require('multer');var util=require(_0xc79b('0x0'));var path=require('path');var timeout=require(_0xc79b('0x1'));var express=require(_0xc79b('0x2'));var router=express[_0xc79b('0x3')]();var fs_extra=require(_0xc79b('0x4'));var auth=require(_0xc79b('0x5'));var interaction=require(_0xc79b('0x6'));var config=require(_0xc79b('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0xc79b('0x8')](),controller[_0xc79b('0x9')]);router[_0xc79b('0xa')](_0xc79b('0xb'),auth[_0xc79b('0x8')](),controller[_0xc79b('0xc')]);router[_0xc79b('0xa')](_0xc79b('0xd'),auth[_0xc79b('0x8')](),controller[_0xc79b('0xe')]);router['get'](_0xc79b('0xf'),auth[_0xc79b('0x8')](),controller['getSubjects']);router[_0xc79b('0xa')](_0xc79b('0x10'),auth[_0xc79b('0x8')](),controller['getDescriptions']);router['get'](_0xc79b('0x11'),auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth[_0xc79b('0x8')](),controller[_0xc79b('0x12')]);router[_0xc79b('0x13')]('/:id/tags',auth[_0xc79b('0x8')](),controller['setTags']);router['put'](_0xc79b('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc79b('0x14')](_0xc79b('0xb'),auth[_0xc79b('0x8')](),controller[_0xc79b('0x15')]);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 a7e1434..ebab6ca 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 _0x8559=['sequelize','exports','STRING'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x8559,0x1b6));var _0x9855=function(_0x44c477,_0x3a0a07){_0x44c477=_0x44c477-0x0;var _0x5dba37=_0x8559[_0x44c477];return _0x5dba37;};'use strict';var Sequelize=require(_0x9855('0x0'));module[_0x9855('0x1')]={'name':{'type':Sequelize[_0x9855('0x2')]},'description':{'type':Sequelize[_0x9855('0x2')]}}; \ No newline at end of file +var _0x976e=['STRING'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x976e,0x1da));var _0xe976=function(_0x5da2d1,_0x4bd038){_0x5da2d1=_0x5da2d1-0x0;var _0x19654c=_0x976e[_0x5da2d1];return _0x19654c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe976('0x0')]},'description':{'type':Sequelize[_0xe976('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index abc68b6..008a3f5 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 _0x8324=['create','catch','body','params','destroy','getFields','findOne','FreshdeskField','rawAttributes','getSubjects','getDescriptions','getTags','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','stack','name','send','index','map','FreshdeskConfiguration','fieldName','key','keys','query','fields','length','attributes','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','find'];(function(_0xcb9f7,_0x5efe92){var _0x558f76=function(_0x1fba04){while(--_0x1fba04){_0xcb9f7['push'](_0xcb9f7['shift']());}};_0x558f76(++_0x5efe92);}(_0x8324,0x14a));var _0x4832=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0x8324[_0x4bcf38];return _0x4a89be;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4832('0x0'));var jsonpatch=require(_0x4832('0x1'));var rp=require(_0x4832('0x2'));var moment=require(_0x4832('0x3'));var BPromise=require(_0x4832('0x4'));var Mustache=require('mustache');var util=require(_0x4832('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4832('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4832('0x7'));var squel=require(_0x4832('0x8'));var crypto=require(_0x4832('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4832('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4832('0xb'));var Redis=require(_0x4832('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4832('0xd'));var hardwareService=require(_0x4832('0xe'));var logger=require(_0x4832('0xf'))(_0x4832('0x10'));var utils=require(_0x4832('0x11'));var config=require(_0x4832('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x4832('0x13'))['db'];function respondWithStatusCode(_0x1e544b,_0x2b3e7d){_0x2b3e7d=_0x2b3e7d||0xcc;return function(_0x34aa5a){if(_0x34aa5a){return _0x1e544b[_0x4832('0x14')](_0x2b3e7d);}return _0x1e544b[_0x4832('0x15')](_0x2b3e7d)[_0x4832('0x16')]();};}function respondWithResult(_0x58386b,_0x59bd03){_0x59bd03=_0x59bd03||0xc8;return function(_0xe7ef1e){if(_0xe7ef1e){return _0x58386b[_0x4832('0x15')](_0x59bd03)[_0x4832('0x17')](_0xe7ef1e);}};}function respondWithFilteredResult(_0x4f1a92,_0x4e8add){return function(_0x311a69){if(_0x311a69){var _0x3c08d2=typeof _0x4e8add[_0x4832('0x18')]===_0x4832('0x19')&&typeof _0x4e8add[_0x4832('0x1a')]===_0x4832('0x19');var _0x580ed7=_0x311a69[_0x4832('0x1b')];var _0x10bc16=_0x3c08d2?0x0:_0x4e8add[_0x4832('0x18')];var _0x18f060=_0x3c08d2?_0x311a69[_0x4832('0x1b')]:_0x4e8add[_0x4832('0x18')]+_0x4e8add[_0x4832('0x1a')];var _0x9f7c38;if(_0x18f060>=_0x580ed7){_0x18f060=_0x580ed7;_0x9f7c38=0xc8;}else{_0x9f7c38=0xce;}_0x4f1a92['status'](_0x9f7c38);return _0x4f1a92[_0x4832('0x1c')](_0x4832('0x1d'),_0x10bc16+'-'+_0x18f060+'/'+_0x580ed7)[_0x4832('0x17')](_0x311a69);}return null;};}function patchUpdates(_0x15cf94){return function(_0x2f3fee){try{jsonpatch[_0x4832('0x1e')](_0x2f3fee,_0x15cf94,!![]);}catch(_0xb7a933){return BPromise['reject'](_0xb7a933);}return _0x2f3fee['save']();};}function saveUpdates(_0x38ae7b,_0x556109){return function(_0x142b1c){if(_0x142b1c){return _0x142b1c['update'](_0x38ae7b)[_0x4832('0x1f')](function(_0x3f3e7a){return _0x3f3e7a;});}return null;};}function removeEntity(_0x4992fc,_0x807485){return function(_0x1d416b){if(_0x1d416b){return _0x1d416b['destroy']()['then'](function(){_0x4992fc[_0x4832('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf8b838,_0x5dfafe){return function(_0xd9fb85){if(!_0xd9fb85){_0xf8b838['sendStatus'](0x194);}return _0xd9fb85;};}function handleError(_0x491950,_0x3d10d9){_0x3d10d9=_0x3d10d9||0x1f4;return function(_0x442047){logger['error'](_0x442047[_0x4832('0x20')]);if(_0x442047['name']){delete _0x442047[_0x4832('0x21')];}_0x491950[_0x4832('0x15')](_0x3d10d9)[_0x4832('0x22')](_0x442047);};}exports[_0x4832('0x23')]=function(_0x57917b,_0x35e157){var _0x64a6b4={},_0x2fc9bb={},_0x2ace7d={'count':0x0,'rows':[]};var _0x5a428e=_[_0x4832('0x24')](db[_0x4832('0x25')]['rawAttributes'],function(_0x5265f6){return{'name':_0x5265f6[_0x4832('0x26')],'type':_0x5265f6['type'][_0x4832('0x27')]};});_0x2fc9bb['model']=_[_0x4832('0x24')](_0x5a428e,_0x4832('0x21'));_0x2fc9bb['query']=_[_0x4832('0x28')](_0x57917b[_0x4832('0x29')]);_0x2fc9bb['filters']=_['intersection'](_0x2fc9bb['model'],_0x2fc9bb[_0x4832('0x29')]);_0x64a6b4['attributes']=_['intersection'](_0x2fc9bb['model'],qs['fields'](_0x57917b[_0x4832('0x29')][_0x4832('0x2a')]));_0x64a6b4['attributes']=_0x64a6b4['attributes'][_0x4832('0x2b')]?_0x64a6b4[_0x4832('0x2c')]:_0x2fc9bb[_0x4832('0x2d')];if(!_0x57917b[_0x4832('0x29')][_0x4832('0x2e')](_0x4832('0x2f'))){_0x64a6b4[_0x4832('0x1a')]=qs[_0x4832('0x1a')](_0x57917b[_0x4832('0x29')][_0x4832('0x1a')]);_0x64a6b4['offset']=qs['offset'](_0x57917b['query']['offset']);}_0x64a6b4[_0x4832('0x30')]=qs[_0x4832('0x31')](_0x57917b[_0x4832('0x29')]['sort']);_0x64a6b4[_0x4832('0x32')]=qs[_0x4832('0x33')](_[_0x4832('0x34')](_0x57917b['query'],_0x2fc9bb['filters']),_0x5a428e);if(_0x57917b[_0x4832('0x29')][_0x4832('0x35')]){_0x64a6b4[_0x4832('0x32')]=_[_0x4832('0x36')](_0x64a6b4['where'],{'$or':_[_0x4832('0x24')](_0x5a428e,function(_0x5be9d2){if(_0x5be9d2[_0x4832('0x37')]!==_0x4832('0x38')){var _0x52e23e={};_0x52e23e[_0x5be9d2[_0x4832('0x21')]]={'$like':'%'+_0x57917b[_0x4832('0x29')]['filter']+'%'};return _0x52e23e;}})});}_0x64a6b4=_[_0x4832('0x36')]({},_0x64a6b4,_0x57917b[_0x4832('0x39')]);var _0x2deda3={'where':_0x64a6b4[_0x4832('0x32')]};return db['FreshdeskConfiguration'][_0x4832('0x1b')](_0x2deda3)[_0x4832('0x1f')](function(_0x48f088){_0x2ace7d['count']=_0x48f088;if(_0x57917b[_0x4832('0x29')][_0x4832('0x3a')]){_0x64a6b4[_0x4832('0x3b')]=[{'all':!![]}];}return db[_0x4832('0x25')][_0x4832('0x3c')](_0x64a6b4);})[_0x4832('0x1f')](function(_0x347d3a){_0x2ace7d[_0x4832('0x3d')]=_0x347d3a;return _0x2ace7d;})[_0x4832('0x1f')](respondWithFilteredResult(_0x35e157,_0x64a6b4))['catch'](handleError(_0x35e157,null));};exports[_0x4832('0x3e')]=function(_0x24b82b,_0x5b9097){var _0x14bef4={'raw':![],'where':{'id':_0x24b82b['params']['id']}},_0x39f0d4={};_0x39f0d4['model']=_['keys'](db[_0x4832('0x25')]['rawAttributes']);_0x39f0d4[_0x4832('0x29')]=_[_0x4832('0x28')](_0x24b82b[_0x4832('0x29')]);_0x39f0d4[_0x4832('0x33')]=_[_0x4832('0x3f')](_0x39f0d4['model'],_0x39f0d4['query']);_0x14bef4[_0x4832('0x2c')]=_[_0x4832('0x3f')](_0x39f0d4[_0x4832('0x2d')],qs[_0x4832('0x2a')](_0x24b82b[_0x4832('0x29')][_0x4832('0x2a')]));_0x14bef4[_0x4832('0x2c')]=_0x14bef4[_0x4832('0x2c')][_0x4832('0x2b')]?_0x14bef4[_0x4832('0x2c')]:_0x39f0d4[_0x4832('0x2d')];if(_0x24b82b['query'][_0x4832('0x3a')]){_0x14bef4[_0x4832('0x3b')]=[{'all':!![]}];}_0x14bef4=_[_0x4832('0x36')]({},_0x14bef4,_0x24b82b['options']);return db['FreshdeskConfiguration'][_0x4832('0x40')](_0x14bef4)[_0x4832('0x1f')](handleEntityNotFound(_0x5b9097,null))[_0x4832('0x1f')](respondWithResult(_0x5b9097,null))['catch'](handleError(_0x5b9097,null));};exports[_0x4832('0x41')]=function(_0x35cb32,_0xdc055e){return db['FreshdeskConfiguration'][_0x4832('0x41')](_0x35cb32['body'],{})[_0x4832('0x1f')](respondWithResult(_0xdc055e,0xc9))[_0x4832('0x42')](handleError(_0xdc055e,null));};exports['update']=function(_0xba3151,_0x5201df){if(_0xba3151[_0x4832('0x43')]['id']){delete _0xba3151[_0x4832('0x43')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0xba3151[_0x4832('0x44')]['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0x5201df,null))[_0x4832('0x1f')](saveUpdates(_0xba3151[_0x4832('0x43')],null))[_0x4832('0x1f')](respondWithResult(_0x5201df,null))[_0x4832('0x42')](handleError(_0x5201df,null));};exports[_0x4832('0x45')]=function(_0x30775a,_0x4fdba1){return db[_0x4832('0x25')][_0x4832('0x40')]({'where':{'id':_0x30775a['params']['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0x4fdba1,null))[_0x4832('0x1f')](removeEntity(_0x4fdba1,null))['catch'](handleError(_0x4fdba1,null));};exports[_0x4832('0x46')]=function(_0x537640,_0x4ac477,_0x32b337){var _0x270456={};var _0x459777={};var _0x3dc28d;var _0x145e56;return db[_0x4832('0x25')][_0x4832('0x47')]({'where':{'id':_0x537640[_0x4832('0x44')]['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0x4ac477,null))[_0x4832('0x1f')](function(_0x3dcbaf){if(_0x3dcbaf){_0x3dc28d=_0x3dcbaf;_0x459777[_0x4832('0x2d')]=_['keys'](db[_0x4832('0x48')][_0x4832('0x49')]);_0x459777[_0x4832('0x29')]=_[_0x4832('0x28')](_0x537640[_0x4832('0x29')]);_0x459777[_0x4832('0x33')]=_[_0x4832('0x3f')](_0x459777['model'],_0x459777[_0x4832('0x29')]);_0x270456[_0x4832('0x2c')]=_[_0x4832('0x3f')](_0x459777[_0x4832('0x2d')],qs[_0x4832('0x2a')](_0x537640['query'][_0x4832('0x2a')]));_0x270456[_0x4832('0x2c')]=_0x270456['attributes'][_0x4832('0x2b')]?_0x270456[_0x4832('0x2c')]:_0x459777[_0x4832('0x2d')];_0x270456['order']=qs[_0x4832('0x31')](_0x537640[_0x4832('0x29')][_0x4832('0x31')]);_0x270456[_0x4832('0x32')]=qs[_0x4832('0x33')](_[_0x4832('0x34')](_0x537640['query'],_0x459777['filters']));if(_0x537640[_0x4832('0x29')][_0x4832('0x35')]){_0x270456['where']=_[_0x4832('0x36')](_0x270456[_0x4832('0x32')],{'$or':_[_0x4832('0x24')](_0x270456[_0x4832('0x2c')],function(_0x766a00){var _0x49c7a5={};_0x49c7a5[_0x766a00]={'$like':'%'+_0x537640['query']['filter']+'%'};return _0x49c7a5;})});}_0x270456=_[_0x4832('0x36')]({},_0x270456,_0x537640[_0x4832('0x39')]);return _0x3dc28d['getFields'](_0x270456);}})[_0x4832('0x1f')](function(_0x582272){if(_0x582272){_0x145e56=_0x582272[_0x4832('0x2b')];if(!_0x537640[_0x4832('0x29')][_0x4832('0x2e')]('nolimit')){_0x270456['limit']=qs[_0x4832('0x1a')](_0x537640['query'][_0x4832('0x1a')]);_0x270456[_0x4832('0x18')]=qs['offset'](_0x537640[_0x4832('0x29')][_0x4832('0x18')]);}return _0x3dc28d[_0x4832('0x46')](_0x270456);}})[_0x4832('0x1f')](function(_0x2a0772){if(_0x2a0772){return _0x2a0772?{'count':_0x145e56,'rows':_0x2a0772}:null;}})['then'](respondWithResult(_0x4ac477,null))[_0x4832('0x42')](handleError(_0x4ac477,null));};exports['getSubjects']=function(_0x3790bf,_0x4d7752,_0x5654c3){var _0x5cc28e={};var _0x1f7a9f={};var _0x445141;var _0x439d89;return db[_0x4832('0x25')][_0x4832('0x47')]({'where':{'id':_0x3790bf[_0x4832('0x44')]['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0x4d7752,null))[_0x4832('0x1f')](function(_0x322ea4){if(_0x322ea4){_0x445141=_0x322ea4;_0x1f7a9f[_0x4832('0x2d')]=_[_0x4832('0x28')](db[_0x4832('0x48')][_0x4832('0x49')]);_0x1f7a9f[_0x4832('0x29')]=_[_0x4832('0x28')](_0x3790bf[_0x4832('0x29')]);_0x1f7a9f['filters']=_[_0x4832('0x3f')](_0x1f7a9f['model'],_0x1f7a9f['query']);_0x5cc28e[_0x4832('0x2c')]=_[_0x4832('0x3f')](_0x1f7a9f[_0x4832('0x2d')],qs['fields'](_0x3790bf['query'][_0x4832('0x2a')]));_0x5cc28e['attributes']=_0x5cc28e[_0x4832('0x2c')][_0x4832('0x2b')]?_0x5cc28e['attributes']:_0x1f7a9f[_0x4832('0x2d')];_0x5cc28e['order']=qs[_0x4832('0x31')](_0x3790bf[_0x4832('0x29')]['sort']);_0x5cc28e[_0x4832('0x32')]=qs[_0x4832('0x33')](_['pick'](_0x3790bf[_0x4832('0x29')],_0x1f7a9f[_0x4832('0x33')]));if(_0x3790bf['query'][_0x4832('0x35')]){_0x5cc28e['where']=_[_0x4832('0x36')](_0x5cc28e['where'],{'$or':_[_0x4832('0x24')](_0x5cc28e[_0x4832('0x2c')],function(_0x1bccb3){var _0x56b7d8={};_0x56b7d8[_0x1bccb3]={'$like':'%'+_0x3790bf[_0x4832('0x29')][_0x4832('0x35')]+'%'};return _0x56b7d8;})});}_0x5cc28e=_[_0x4832('0x36')]({},_0x5cc28e,_0x3790bf[_0x4832('0x39')]);return _0x445141[_0x4832('0x4a')](_0x5cc28e);}})[_0x4832('0x1f')](function(_0x3868e2){if(_0x3868e2){_0x439d89=_0x3868e2[_0x4832('0x2b')];if(!_0x3790bf[_0x4832('0x29')][_0x4832('0x2e')](_0x4832('0x2f'))){_0x5cc28e['limit']=qs[_0x4832('0x1a')](_0x3790bf[_0x4832('0x29')]['limit']);_0x5cc28e['offset']=qs[_0x4832('0x18')](_0x3790bf[_0x4832('0x29')][_0x4832('0x18')]);}return _0x445141[_0x4832('0x4a')](_0x5cc28e);}})[_0x4832('0x1f')](function(_0x59797a){if(_0x59797a){return _0x59797a?{'count':_0x439d89,'rows':_0x59797a}:null;}})[_0x4832('0x1f')](respondWithResult(_0x4d7752,null))[_0x4832('0x42')](handleError(_0x4d7752,null));};exports['getDescriptions']=function(_0x5c6a0f,_0x40b7f4,_0x1c6e36){var _0x3b925f={};var _0xbc9e30={};var _0x5b48cd;var _0x1f6c63;return db['FreshdeskConfiguration'][_0x4832('0x47')]({'where':{'id':_0x5c6a0f[_0x4832('0x44')]['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0x40b7f4,null))[_0x4832('0x1f')](function(_0x544c77){if(_0x544c77){_0x5b48cd=_0x544c77;_0xbc9e30[_0x4832('0x2d')]=_[_0x4832('0x28')](db[_0x4832('0x48')][_0x4832('0x49')]);_0xbc9e30[_0x4832('0x29')]=_[_0x4832('0x28')](_0x5c6a0f[_0x4832('0x29')]);_0xbc9e30['filters']=_[_0x4832('0x3f')](_0xbc9e30['model'],_0xbc9e30['query']);_0x3b925f['attributes']=_[_0x4832('0x3f')](_0xbc9e30[_0x4832('0x2d')],qs[_0x4832('0x2a')](_0x5c6a0f[_0x4832('0x29')]['fields']));_0x3b925f[_0x4832('0x2c')]=_0x3b925f[_0x4832('0x2c')][_0x4832('0x2b')]?_0x3b925f[_0x4832('0x2c')]:_0xbc9e30[_0x4832('0x2d')];_0x3b925f[_0x4832('0x30')]=qs[_0x4832('0x31')](_0x5c6a0f[_0x4832('0x29')][_0x4832('0x31')]);_0x3b925f[_0x4832('0x32')]=qs[_0x4832('0x33')](_[_0x4832('0x34')](_0x5c6a0f[_0x4832('0x29')],_0xbc9e30[_0x4832('0x33')]));if(_0x5c6a0f['query'][_0x4832('0x35')]){_0x3b925f[_0x4832('0x32')]=_['merge'](_0x3b925f['where'],{'$or':_[_0x4832('0x24')](_0x3b925f[_0x4832('0x2c')],function(_0x2a1b3b){var _0x20b443={};_0x20b443[_0x2a1b3b]={'$like':'%'+_0x5c6a0f[_0x4832('0x29')][_0x4832('0x35')]+'%'};return _0x20b443;})});}_0x3b925f=_[_0x4832('0x36')]({},_0x3b925f,_0x5c6a0f[_0x4832('0x39')]);return _0x5b48cd[_0x4832('0x4b')](_0x3b925f);}})[_0x4832('0x1f')](function(_0x22ec63){if(_0x22ec63){_0x1f6c63=_0x22ec63[_0x4832('0x2b')];if(!_0x5c6a0f[_0x4832('0x29')]['hasOwnProperty'](_0x4832('0x2f'))){_0x3b925f[_0x4832('0x1a')]=qs[_0x4832('0x1a')](_0x5c6a0f[_0x4832('0x29')][_0x4832('0x1a')]);_0x3b925f[_0x4832('0x18')]=qs[_0x4832('0x18')](_0x5c6a0f['query'][_0x4832('0x18')]);}return _0x5b48cd[_0x4832('0x4b')](_0x3b925f);}})[_0x4832('0x1f')](function(_0x4f2384){if(_0x4f2384){return _0x4f2384?{'count':_0x1f6c63,'rows':_0x4f2384}:null;}})[_0x4832('0x1f')](respondWithResult(_0x40b7f4,null))[_0x4832('0x42')](handleError(_0x40b7f4,null));};exports[_0x4832('0x4c')]=function(_0x28c7b0,_0x361583,_0x3a78a8){var _0x17d6b1={};var _0x63cf54={};var _0x3c8f15;var _0x2b277c;return db[_0x4832('0x25')]['findOne']({'where':{'id':_0x28c7b0['params']['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0x361583,null))['then'](function(_0x62926a){if(_0x62926a){_0x3c8f15=_0x62926a;_0x63cf54[_0x4832('0x2d')]=_['keys'](db['Tag'][_0x4832('0x49')]);_0x63cf54[_0x4832('0x29')]=_[_0x4832('0x28')](_0x28c7b0[_0x4832('0x29')]);_0x63cf54['filters']=_['intersection'](_0x63cf54['model'],_0x63cf54[_0x4832('0x29')]);_0x17d6b1[_0x4832('0x2c')]=_[_0x4832('0x3f')](_0x63cf54['model'],qs['fields'](_0x28c7b0['query']['fields']));_0x17d6b1['attributes']=_0x17d6b1['attributes'][_0x4832('0x2b')]?_0x17d6b1[_0x4832('0x2c')]:_0x63cf54['model'];_0x17d6b1[_0x4832('0x30')]=qs[_0x4832('0x31')](_0x28c7b0[_0x4832('0x29')]['sort']);_0x17d6b1[_0x4832('0x32')]=qs[_0x4832('0x33')](_['pick'](_0x28c7b0[_0x4832('0x29')],_0x63cf54[_0x4832('0x33')]));if(_0x28c7b0[_0x4832('0x29')][_0x4832('0x35')]){_0x17d6b1[_0x4832('0x32')]=_[_0x4832('0x36')](_0x17d6b1['where'],{'$or':_[_0x4832('0x24')](_0x17d6b1[_0x4832('0x2c')],function(_0x399ab8){var _0x74b543={};_0x74b543[_0x399ab8]={'$like':'%'+_0x28c7b0[_0x4832('0x29')][_0x4832('0x35')]+'%'};return _0x74b543;})});}_0x17d6b1=_[_0x4832('0x36')]({},_0x17d6b1,_0x28c7b0[_0x4832('0x39')]);return _0x3c8f15[_0x4832('0x4c')](_0x17d6b1);}})[_0x4832('0x1f')](function(_0x658cb8){if(_0x658cb8){_0x2b277c=_0x658cb8['length'];if(!_0x28c7b0['query']['hasOwnProperty'](_0x4832('0x2f'))){_0x17d6b1[_0x4832('0x1a')]=qs['limit'](_0x28c7b0[_0x4832('0x29')][_0x4832('0x1a')]);_0x17d6b1[_0x4832('0x18')]=qs['offset'](_0x28c7b0['query']['offset']);}return _0x3c8f15[_0x4832('0x4c')](_0x17d6b1);}})[_0x4832('0x1f')](function(_0x2e5c1f){if(_0x2e5c1f){return _0x2e5c1f?{'count':_0x2b277c,'rows':_0x2e5c1f}:null;}})[_0x4832('0x1f')](respondWithResult(_0x361583,null))[_0x4832('0x42')](handleError(_0x361583,null));};exports[_0x4832('0x4d')]=function(_0x157efe,_0x2e36c0,_0xf1f29a){if(_0x157efe['body']['id']){delete _0x157efe['body']['id'];}return db[_0x4832('0x25')][_0x4832('0x47')]({'where':{'id':_0x157efe['params']['id']}})[_0x4832('0x1f')](handleEntityNotFound(_0x2e36c0,null))[_0x4832('0x1f')](function(_0x68f55b){if(_0x68f55b){return _0x68f55b[_0x4832('0x4d')](_0x157efe[_0x4832('0x43')][_0x4832('0x4e')]||[]);}return null;})[_0x4832('0x1f')](respondWithResult(_0x2e36c0,null))[_0x4832('0x42')](handleError(_0x2e36c0,null));}; \ No newline at end of file +var _0xc5c8=['reject','save','update','then','sendStatus','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','destroy','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','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','status','end','json','offset','undefined','limit'];(function(_0x3fe2ef,_0x211196){var _0x1fa60b=function(_0x55602e){while(--_0x55602e){_0x3fe2ef['push'](_0x3fe2ef['shift']());}};_0x1fa60b(++_0x211196);}(_0xc5c8,0x134));var _0x8c5c=function(_0x4841db,_0x32a27b){_0x4841db=_0x4841db-0x0;var _0x5183be=_0xc5c8[_0x4841db];return _0x5183be;};'use strict';var emlformat=require(_0x8c5c('0x0'));var rimraf=require(_0x8c5c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c5c('0x2'));var rp=require(_0x8c5c('0x3'));var moment=require(_0x8c5c('0x4'));var BPromise=require(_0x8c5c('0x5'));var Mustache=require(_0x8c5c('0x6'));var util=require(_0x8c5c('0x7'));var path=require(_0x8c5c('0x8'));var sox=require(_0x8c5c('0x9'));var csv=require('to-csv');var ejs=require(_0x8c5c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8c5c('0xb'));var crypto=require(_0x8c5c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8c5c('0xd'));var toCsv=require(_0x8c5c('0xe'));var querystring=require(_0x8c5c('0xf'));var Papa=require(_0x8c5c('0x10'));var Redis=require(_0x8c5c('0x11'));var authService=require(_0x8c5c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8c5c('0x13'));var hardwareService=require(_0x8c5c('0x14'));var logger=require('../../config/logger')(_0x8c5c('0x15'));var utils=require(_0x8c5c('0x16'));var config=require(_0x8c5c('0x17'));var licenseUtil=require(_0x8c5c('0x18'));var db=require(_0x8c5c('0x19'))['db'];function respondWithStatusCode(_0x3dfb07,_0x2b0dd9){_0x2b0dd9=_0x2b0dd9||0xcc;return function(_0x22ce6d){if(_0x22ce6d){return _0x3dfb07['sendStatus'](_0x2b0dd9);}return _0x3dfb07[_0x8c5c('0x1a')](_0x2b0dd9)[_0x8c5c('0x1b')]();};}function respondWithResult(_0x287471,_0x14375d){_0x14375d=_0x14375d||0xc8;return function(_0x179656){if(_0x179656){return _0x287471['status'](_0x14375d)[_0x8c5c('0x1c')](_0x179656);}};}function respondWithFilteredResult(_0x36ae47,_0x40028f){return function(_0x620ca7){if(_0x620ca7){var _0x5827ef=typeof _0x40028f[_0x8c5c('0x1d')]===_0x8c5c('0x1e')&&typeof _0x40028f['limit']===_0x8c5c('0x1e');var _0x2e7734=_0x620ca7['count'];var _0x3a8d0c=_0x5827ef?0x0:_0x40028f[_0x8c5c('0x1d')];var _0x64488=_0x5827ef?_0x620ca7['count']:_0x40028f[_0x8c5c('0x1d')]+_0x40028f[_0x8c5c('0x1f')];var _0x279fc5;if(_0x64488>=_0x2e7734){_0x64488=_0x2e7734;_0x279fc5=0xc8;}else{_0x279fc5=0xce;}_0x36ae47['status'](_0x279fc5);return _0x36ae47['set']('Content-Range',_0x3a8d0c+'-'+_0x64488+'/'+_0x2e7734)[_0x8c5c('0x1c')](_0x620ca7);}return null;};}function patchUpdates(_0x269699){return function(_0x5c906a){try{jsonpatch['apply'](_0x5c906a,_0x269699,!![]);}catch(_0x27d5d2){return BPromise[_0x8c5c('0x20')](_0x27d5d2);}return _0x5c906a[_0x8c5c('0x21')]();};}function saveUpdates(_0x265322,_0x33886){return function(_0x4081fd){if(_0x4081fd){return _0x4081fd[_0x8c5c('0x22')](_0x265322)[_0x8c5c('0x23')](function(_0x8f297f){return _0x8f297f;});}return null;};}function removeEntity(_0x4f0bec,_0x491e5b){return function(_0x23937e){if(_0x23937e){return _0x23937e['destroy']()[_0x8c5c('0x23')](function(){_0x4f0bec[_0x8c5c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1167ce,_0x350396){return function(_0x4834c2){if(!_0x4834c2){_0x1167ce[_0x8c5c('0x24')](0x194);}return _0x4834c2;};}function handleError(_0x53345a,_0x4f1190){_0x4f1190=_0x4f1190||0x1f4;return function(_0x43331a){logger[_0x8c5c('0x25')](_0x43331a[_0x8c5c('0x26')]);if(_0x43331a[_0x8c5c('0x27')]){delete _0x43331a[_0x8c5c('0x27')];}_0x53345a['status'](_0x4f1190)[_0x8c5c('0x28')](_0x43331a);};}exports['index']=function(_0x320d6f,_0x49dbb7){var _0x1faf14={},_0x8a27e8={},_0xe940aa={'count':0x0,'rows':[]};var _0x4632d2=_[_0x8c5c('0x29')](db[_0x8c5c('0x2a')][_0x8c5c('0x2b')],function(_0x392317){return{'name':_0x392317['fieldName'],'type':_0x392317[_0x8c5c('0x2c')][_0x8c5c('0x2d')]};});_0x8a27e8['model']=_[_0x8c5c('0x29')](_0x4632d2,'name');_0x8a27e8[_0x8c5c('0x2e')]=_[_0x8c5c('0x2f')](_0x320d6f[_0x8c5c('0x2e')]);_0x8a27e8[_0x8c5c('0x30')]=_[_0x8c5c('0x31')](_0x8a27e8[_0x8c5c('0x32')],_0x8a27e8[_0x8c5c('0x2e')]);_0x1faf14['attributes']=_[_0x8c5c('0x31')](_0x8a27e8[_0x8c5c('0x32')],qs[_0x8c5c('0x33')](_0x320d6f[_0x8c5c('0x2e')][_0x8c5c('0x33')]));_0x1faf14[_0x8c5c('0x34')]=_0x1faf14[_0x8c5c('0x34')]['length']?_0x1faf14['attributes']:_0x8a27e8[_0x8c5c('0x32')];if(!_0x320d6f['query'][_0x8c5c('0x35')]('nolimit')){_0x1faf14[_0x8c5c('0x1f')]=qs[_0x8c5c('0x1f')](_0x320d6f[_0x8c5c('0x2e')][_0x8c5c('0x1f')]);_0x1faf14[_0x8c5c('0x1d')]=qs[_0x8c5c('0x1d')](_0x320d6f[_0x8c5c('0x2e')][_0x8c5c('0x1d')]);}_0x1faf14[_0x8c5c('0x36')]=qs['sort'](_0x320d6f[_0x8c5c('0x2e')][_0x8c5c('0x37')]);_0x1faf14[_0x8c5c('0x38')]=qs['filters'](_[_0x8c5c('0x39')](_0x320d6f[_0x8c5c('0x2e')],_0x8a27e8[_0x8c5c('0x30')]),_0x4632d2);if(_0x320d6f[_0x8c5c('0x2e')]['filter']){_0x1faf14[_0x8c5c('0x38')]=_[_0x8c5c('0x3a')](_0x1faf14[_0x8c5c('0x38')],{'$or':_[_0x8c5c('0x29')](_0x4632d2,function(_0x42f89a){if(_0x42f89a[_0x8c5c('0x2c')]!==_0x8c5c('0x3b')){var _0x5be020={};_0x5be020[_0x42f89a['name']]={'$like':'%'+_0x320d6f[_0x8c5c('0x2e')][_0x8c5c('0x3c')]+'%'};return _0x5be020;}})});}_0x1faf14=_[_0x8c5c('0x3a')]({},_0x1faf14,_0x320d6f[_0x8c5c('0x3d')]);var _0x595e01={'where':_0x1faf14[_0x8c5c('0x38')]};return db[_0x8c5c('0x2a')][_0x8c5c('0x3e')](_0x595e01)['then'](function(_0x1f2383){_0xe940aa[_0x8c5c('0x3e')]=_0x1f2383;if(_0x320d6f['query']['includeAll']){_0x1faf14[_0x8c5c('0x3f')]=[{'all':!![]}];}return db[_0x8c5c('0x2a')][_0x8c5c('0x40')](_0x1faf14);})[_0x8c5c('0x23')](function(_0x567e19){_0xe940aa[_0x8c5c('0x41')]=_0x567e19;return _0xe940aa;})[_0x8c5c('0x23')](respondWithFilteredResult(_0x49dbb7,_0x1faf14))['catch'](handleError(_0x49dbb7,null));};exports[_0x8c5c('0x42')]=function(_0x18e86e,_0x560c4d){var _0x349235={'raw':![],'where':{'id':_0x18e86e[_0x8c5c('0x43')]['id']}},_0x3470ec={};_0x3470ec[_0x8c5c('0x32')]=_['keys'](db[_0x8c5c('0x2a')][_0x8c5c('0x2b')]);_0x3470ec['query']=_[_0x8c5c('0x2f')](_0x18e86e[_0x8c5c('0x2e')]);_0x3470ec[_0x8c5c('0x30')]=_[_0x8c5c('0x31')](_0x3470ec[_0x8c5c('0x32')],_0x3470ec[_0x8c5c('0x2e')]);_0x349235['attributes']=_[_0x8c5c('0x31')](_0x3470ec[_0x8c5c('0x32')],qs[_0x8c5c('0x33')](_0x18e86e[_0x8c5c('0x2e')]['fields']));_0x349235[_0x8c5c('0x34')]=_0x349235[_0x8c5c('0x34')][_0x8c5c('0x44')]?_0x349235[_0x8c5c('0x34')]:_0x3470ec['model'];if(_0x18e86e[_0x8c5c('0x2e')][_0x8c5c('0x45')]){_0x349235[_0x8c5c('0x3f')]=[{'all':!![]}];}_0x349235=_[_0x8c5c('0x3a')]({},_0x349235,_0x18e86e[_0x8c5c('0x3d')]);return db[_0x8c5c('0x2a')][_0x8c5c('0x46')](_0x349235)[_0x8c5c('0x23')](handleEntityNotFound(_0x560c4d,null))[_0x8c5c('0x23')](respondWithResult(_0x560c4d,null))[_0x8c5c('0x47')](handleError(_0x560c4d,null));};exports[_0x8c5c('0x48')]=function(_0x2b3973,_0x3bea73){return db[_0x8c5c('0x2a')][_0x8c5c('0x48')](_0x2b3973['body'],{})[_0x8c5c('0x23')](respondWithResult(_0x3bea73,0xc9))[_0x8c5c('0x47')](handleError(_0x3bea73,null));};exports[_0x8c5c('0x22')]=function(_0x4bbc78,_0x44a6d7){if(_0x4bbc78[_0x8c5c('0x49')]['id']){delete _0x4bbc78[_0x8c5c('0x49')]['id'];}return db[_0x8c5c('0x2a')]['find']({'where':{'id':_0x4bbc78[_0x8c5c('0x43')]['id']}})[_0x8c5c('0x23')](handleEntityNotFound(_0x44a6d7,null))[_0x8c5c('0x23')](saveUpdates(_0x4bbc78[_0x8c5c('0x49')],null))['then'](respondWithResult(_0x44a6d7,null))['catch'](handleError(_0x44a6d7,null));};exports[_0x8c5c('0x4a')]=function(_0x1f4d6b,_0xb46152){return db[_0x8c5c('0x2a')]['find']({'where':{'id':_0x1f4d6b[_0x8c5c('0x43')]['id']}})[_0x8c5c('0x23')](handleEntityNotFound(_0xb46152,null))[_0x8c5c('0x23')](removeEntity(_0xb46152,null))[_0x8c5c('0x47')](handleError(_0xb46152,null));};exports[_0x8c5c('0x4b')]=function(_0x5c17d0,_0x5f29f9,_0x4be38a){var _0x5643c7={};var _0x56b9f5={};var _0x738f65;var _0x1f1716;return db['FreshdeskConfiguration'][_0x8c5c('0x4c')]({'where':{'id':_0x5c17d0[_0x8c5c('0x43')]['id']}})[_0x8c5c('0x23')](handleEntityNotFound(_0x5f29f9,null))[_0x8c5c('0x23')](function(_0xd497ff){if(_0xd497ff){_0x738f65=_0xd497ff;_0x56b9f5[_0x8c5c('0x32')]=_['keys'](db[_0x8c5c('0x4d')][_0x8c5c('0x2b')]);_0x56b9f5[_0x8c5c('0x2e')]=_[_0x8c5c('0x2f')](_0x5c17d0[_0x8c5c('0x2e')]);_0x56b9f5[_0x8c5c('0x30')]=_['intersection'](_0x56b9f5[_0x8c5c('0x32')],_0x56b9f5[_0x8c5c('0x2e')]);_0x5643c7[_0x8c5c('0x34')]=_[_0x8c5c('0x31')](_0x56b9f5[_0x8c5c('0x32')],qs[_0x8c5c('0x33')](_0x5c17d0['query'][_0x8c5c('0x33')]));_0x5643c7[_0x8c5c('0x34')]=_0x5643c7[_0x8c5c('0x34')][_0x8c5c('0x44')]?_0x5643c7['attributes']:_0x56b9f5[_0x8c5c('0x32')];_0x5643c7[_0x8c5c('0x36')]=qs[_0x8c5c('0x37')](_0x5c17d0['query']['sort']);_0x5643c7[_0x8c5c('0x38')]=qs[_0x8c5c('0x30')](_[_0x8c5c('0x39')](_0x5c17d0['query'],_0x56b9f5[_0x8c5c('0x30')]));if(_0x5c17d0[_0x8c5c('0x2e')][_0x8c5c('0x3c')]){_0x5643c7[_0x8c5c('0x38')]=_[_0x8c5c('0x3a')](_0x5643c7['where'],{'$or':_[_0x8c5c('0x29')](_0x5643c7[_0x8c5c('0x34')],function(_0x3aa1f5){var _0x8f0a24={};_0x8f0a24[_0x3aa1f5]={'$like':'%'+_0x5c17d0[_0x8c5c('0x2e')][_0x8c5c('0x3c')]+'%'};return _0x8f0a24;})});}_0x5643c7=_['merge']({},_0x5643c7,_0x5c17d0[_0x8c5c('0x3d')]);return _0x738f65[_0x8c5c('0x4b')](_0x5643c7);}})[_0x8c5c('0x23')](function(_0x3525f9){if(_0x3525f9){_0x1f1716=_0x3525f9[_0x8c5c('0x44')];if(!_0x5c17d0['query']['hasOwnProperty'](_0x8c5c('0x4e'))){_0x5643c7[_0x8c5c('0x1f')]=qs['limit'](_0x5c17d0[_0x8c5c('0x2e')][_0x8c5c('0x1f')]);_0x5643c7['offset']=qs[_0x8c5c('0x1d')](_0x5c17d0['query'][_0x8c5c('0x1d')]);}return _0x738f65[_0x8c5c('0x4b')](_0x5643c7);}})[_0x8c5c('0x23')](function(_0x386392){if(_0x386392){return _0x386392?{'count':_0x1f1716,'rows':_0x386392}:null;}})[_0x8c5c('0x23')](respondWithResult(_0x5f29f9,null))[_0x8c5c('0x47')](handleError(_0x5f29f9,null));};exports[_0x8c5c('0x4f')]=function(_0x24c417,_0x2eadaf,_0x501a8c){var _0x4a84a9={};var _0x308ac3={};var _0x42c1d6;var _0x374d20;return db[_0x8c5c('0x2a')]['findOne']({'where':{'id':_0x24c417[_0x8c5c('0x43')]['id']}})[_0x8c5c('0x23')](handleEntityNotFound(_0x2eadaf,null))[_0x8c5c('0x23')](function(_0x3e3722){if(_0x3e3722){_0x42c1d6=_0x3e3722;_0x308ac3[_0x8c5c('0x32')]=_[_0x8c5c('0x2f')](db[_0x8c5c('0x4d')]['rawAttributes']);_0x308ac3['query']=_['keys'](_0x24c417[_0x8c5c('0x2e')]);_0x308ac3[_0x8c5c('0x30')]=_[_0x8c5c('0x31')](_0x308ac3[_0x8c5c('0x32')],_0x308ac3[_0x8c5c('0x2e')]);_0x4a84a9['attributes']=_[_0x8c5c('0x31')](_0x308ac3[_0x8c5c('0x32')],qs[_0x8c5c('0x33')](_0x24c417['query']['fields']));_0x4a84a9[_0x8c5c('0x34')]=_0x4a84a9[_0x8c5c('0x34')][_0x8c5c('0x44')]?_0x4a84a9[_0x8c5c('0x34')]:_0x308ac3['model'];_0x4a84a9[_0x8c5c('0x36')]=qs[_0x8c5c('0x37')](_0x24c417[_0x8c5c('0x2e')][_0x8c5c('0x37')]);_0x4a84a9[_0x8c5c('0x38')]=qs[_0x8c5c('0x30')](_[_0x8c5c('0x39')](_0x24c417[_0x8c5c('0x2e')],_0x308ac3[_0x8c5c('0x30')]));if(_0x24c417[_0x8c5c('0x2e')]['filter']){_0x4a84a9[_0x8c5c('0x38')]=_[_0x8c5c('0x3a')](_0x4a84a9[_0x8c5c('0x38')],{'$or':_[_0x8c5c('0x29')](_0x4a84a9['attributes'],function(_0xa9175f){var _0x21b510={};_0x21b510[_0xa9175f]={'$like':'%'+_0x24c417[_0x8c5c('0x2e')]['filter']+'%'};return _0x21b510;})});}_0x4a84a9=_['merge']({},_0x4a84a9,_0x24c417['options']);return _0x42c1d6['getSubjects'](_0x4a84a9);}})[_0x8c5c('0x23')](function(_0x15a83d){if(_0x15a83d){_0x374d20=_0x15a83d[_0x8c5c('0x44')];if(!_0x24c417[_0x8c5c('0x2e')]['hasOwnProperty'](_0x8c5c('0x4e'))){_0x4a84a9[_0x8c5c('0x1f')]=qs['limit'](_0x24c417[_0x8c5c('0x2e')][_0x8c5c('0x1f')]);_0x4a84a9[_0x8c5c('0x1d')]=qs[_0x8c5c('0x1d')](_0x24c417[_0x8c5c('0x2e')][_0x8c5c('0x1d')]);}return _0x42c1d6[_0x8c5c('0x4f')](_0x4a84a9);}})['then'](function(_0x280547){if(_0x280547){return _0x280547?{'count':_0x374d20,'rows':_0x280547}:null;}})['then'](respondWithResult(_0x2eadaf,null))[_0x8c5c('0x47')](handleError(_0x2eadaf,null));};exports['getDescriptions']=function(_0x31e9a1,_0x3e6b1b,_0x12e723){var _0x3c8b0d={};var _0x557958={};var _0x379e84;var _0x583b70;return db[_0x8c5c('0x2a')]['findOne']({'where':{'id':_0x31e9a1[_0x8c5c('0x43')]['id']}})['then'](handleEntityNotFound(_0x3e6b1b,null))[_0x8c5c('0x23')](function(_0x245223){if(_0x245223){_0x379e84=_0x245223;_0x557958[_0x8c5c('0x32')]=_[_0x8c5c('0x2f')](db[_0x8c5c('0x4d')][_0x8c5c('0x2b')]);_0x557958['query']=_['keys'](_0x31e9a1['query']);_0x557958[_0x8c5c('0x30')]=_[_0x8c5c('0x31')](_0x557958[_0x8c5c('0x32')],_0x557958['query']);_0x3c8b0d[_0x8c5c('0x34')]=_[_0x8c5c('0x31')](_0x557958[_0x8c5c('0x32')],qs['fields'](_0x31e9a1[_0x8c5c('0x2e')][_0x8c5c('0x33')]));_0x3c8b0d[_0x8c5c('0x34')]=_0x3c8b0d[_0x8c5c('0x34')][_0x8c5c('0x44')]?_0x3c8b0d[_0x8c5c('0x34')]:_0x557958[_0x8c5c('0x32')];_0x3c8b0d[_0x8c5c('0x36')]=qs['sort'](_0x31e9a1[_0x8c5c('0x2e')][_0x8c5c('0x37')]);_0x3c8b0d['where']=qs[_0x8c5c('0x30')](_[_0x8c5c('0x39')](_0x31e9a1[_0x8c5c('0x2e')],_0x557958[_0x8c5c('0x30')]));if(_0x31e9a1[_0x8c5c('0x2e')][_0x8c5c('0x3c')]){_0x3c8b0d[_0x8c5c('0x38')]=_[_0x8c5c('0x3a')](_0x3c8b0d['where'],{'$or':_[_0x8c5c('0x29')](_0x3c8b0d[_0x8c5c('0x34')],function(_0x58a96a){var _0x39375c={};_0x39375c[_0x58a96a]={'$like':'%'+_0x31e9a1[_0x8c5c('0x2e')][_0x8c5c('0x3c')]+'%'};return _0x39375c;})});}_0x3c8b0d=_['merge']({},_0x3c8b0d,_0x31e9a1[_0x8c5c('0x3d')]);return _0x379e84[_0x8c5c('0x50')](_0x3c8b0d);}})['then'](function(_0x54843b){if(_0x54843b){_0x583b70=_0x54843b[_0x8c5c('0x44')];if(!_0x31e9a1[_0x8c5c('0x2e')]['hasOwnProperty'](_0x8c5c('0x4e'))){_0x3c8b0d[_0x8c5c('0x1f')]=qs[_0x8c5c('0x1f')](_0x31e9a1[_0x8c5c('0x2e')][_0x8c5c('0x1f')]);_0x3c8b0d['offset']=qs['offset'](_0x31e9a1['query'][_0x8c5c('0x1d')]);}return _0x379e84[_0x8c5c('0x50')](_0x3c8b0d);}})[_0x8c5c('0x23')](function(_0x19ad39){if(_0x19ad39){return _0x19ad39?{'count':_0x583b70,'rows':_0x19ad39}:null;}})['then'](respondWithResult(_0x3e6b1b,null))[_0x8c5c('0x47')](handleError(_0x3e6b1b,null));};exports[_0x8c5c('0x51')]=function(_0x5c4413,_0x241755,_0x172386){var _0x478a19={};var _0x62395a={};var _0xf533b8;var _0x290555;return db[_0x8c5c('0x2a')]['findOne']({'where':{'id':_0x5c4413[_0x8c5c('0x43')]['id']}})[_0x8c5c('0x23')](handleEntityNotFound(_0x241755,null))[_0x8c5c('0x23')](function(_0x446541){if(_0x446541){_0xf533b8=_0x446541;_0x62395a['model']=_[_0x8c5c('0x2f')](db[_0x8c5c('0x52')][_0x8c5c('0x2b')]);_0x62395a['query']=_[_0x8c5c('0x2f')](_0x5c4413[_0x8c5c('0x2e')]);_0x62395a[_0x8c5c('0x30')]=_['intersection'](_0x62395a[_0x8c5c('0x32')],_0x62395a[_0x8c5c('0x2e')]);_0x478a19[_0x8c5c('0x34')]=_[_0x8c5c('0x31')](_0x62395a[_0x8c5c('0x32')],qs['fields'](_0x5c4413[_0x8c5c('0x2e')]['fields']));_0x478a19[_0x8c5c('0x34')]=_0x478a19['attributes'][_0x8c5c('0x44')]?_0x478a19[_0x8c5c('0x34')]:_0x62395a[_0x8c5c('0x32')];_0x478a19[_0x8c5c('0x36')]=qs[_0x8c5c('0x37')](_0x5c4413[_0x8c5c('0x2e')][_0x8c5c('0x37')]);_0x478a19[_0x8c5c('0x38')]=qs['filters'](_[_0x8c5c('0x39')](_0x5c4413[_0x8c5c('0x2e')],_0x62395a[_0x8c5c('0x30')]));if(_0x5c4413[_0x8c5c('0x2e')]['filter']){_0x478a19['where']=_[_0x8c5c('0x3a')](_0x478a19[_0x8c5c('0x38')],{'$or':_[_0x8c5c('0x29')](_0x478a19[_0x8c5c('0x34')],function(_0x2e1015){var _0x1a6d82={};_0x1a6d82[_0x2e1015]={'$like':'%'+_0x5c4413[_0x8c5c('0x2e')][_0x8c5c('0x3c')]+'%'};return _0x1a6d82;})});}_0x478a19=_['merge']({},_0x478a19,_0x5c4413[_0x8c5c('0x3d')]);return _0xf533b8[_0x8c5c('0x51')](_0x478a19);}})['then'](function(_0x48694f){if(_0x48694f){_0x290555=_0x48694f['length'];if(!_0x5c4413[_0x8c5c('0x2e')][_0x8c5c('0x35')](_0x8c5c('0x4e'))){_0x478a19[_0x8c5c('0x1f')]=qs[_0x8c5c('0x1f')](_0x5c4413[_0x8c5c('0x2e')][_0x8c5c('0x1f')]);_0x478a19[_0x8c5c('0x1d')]=qs[_0x8c5c('0x1d')](_0x5c4413['query'][_0x8c5c('0x1d')]);}return _0xf533b8['getTags'](_0x478a19);}})[_0x8c5c('0x23')](function(_0x187c1){if(_0x187c1){return _0x187c1?{'count':_0x290555,'rows':_0x187c1}:null;}})['then'](respondWithResult(_0x241755,null))[_0x8c5c('0x47')](handleError(_0x241755,null));};exports[_0x8c5c('0x53')]=function(_0x3b7f7d,_0x3af460,_0x4d63f5){if(_0x3b7f7d[_0x8c5c('0x49')]['id']){delete _0x3b7f7d[_0x8c5c('0x49')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3b7f7d['params']['id']}})[_0x8c5c('0x23')](handleEntityNotFound(_0x3af460,null))[_0x8c5c('0x23')](function(_0x208b0c){if(_0x208b0c){return _0x208b0c[_0x8c5c('0x53')](_0x3b7f7d['body'][_0x8c5c('0x54')]||[]);}return null;})['then'](respondWithResult(_0x3af460,null))[_0x8c5c('0x47')](handleError(_0x3af460,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 0e0601e..e43e04a 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 _0x2321=['int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration'];(function(_0x306583,_0x26b8ee){var _0x7edb07=function(_0x3afa9e){while(--_0x3afa9e){_0x306583['push'](_0x306583['shift']());}};_0x7edb07(++_0x26b8ee);}(_0x2321,0xe8));var _0x1232=function(_0x3dee92,_0x55e1eb){_0x3dee92=_0x3dee92-0x0;var _0x44d36e=_0x2321[_0x3dee92];return _0x44d36e;};'use strict';var _=require(_0x1232('0x0'));var util=require('util');var logger=require(_0x1232('0x1'))(_0x1232('0x2'));var moment=require(_0x1232('0x3'));var BPromise=require(_0x1232('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1232('0x5'));var rimraf=require('rimraf');var config=require(_0x1232('0x6'));var attributes=require(_0x1232('0x7'));module['exports']=function(_0x318332,_0x32d7af){return _0x318332[_0x1232('0x8')](_0x1232('0x9'),attributes,{'tableName':_0x1232('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa367=['request-promise','path','rimraf','../../config/environment','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x3951ab,_0xa5f502){var _0x2b19f7=function(_0x505727){while(--_0x505727){_0x3951ab['push'](_0x3951ab['shift']());}};_0x2b19f7(++_0xa5f502);}(_0xa367,0x19d));var _0x7a36=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa367[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x7a36('0x0'));var util=require(_0x7a36('0x1'));var logger=require(_0x7a36('0x2'))(_0x7a36('0x3'));var moment=require('moment');var BPromise=require(_0x7a36('0x4'));var rp=require(_0x7a36('0x5'));var fs=require('fs');var path=require(_0x7a36('0x6'));var rimraf=require(_0x7a36('0x7'));var config=require(_0x7a36('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x4e5bc4,_0xd355e8){return _0x4e5bc4['define'](_0x7a36('0x9'),attributes,{'tableName':_0x7a36('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 980a602..e8218e3 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 _0xb135=['info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x35c8fe,_0x20b291){var _0x131090=function(_0x292cff){while(--_0x292cff){_0x35c8fe['push'](_0x35c8fe['shift']());}};_0x131090(++_0x20b291);}(_0xb135,0xd2));var _0x5b13=function(_0x346781,_0x478d47){_0x346781=_0x346781-0x0;var _0x3b40d0=_0xb135[_0x346781];return _0x3b40d0;};'use strict';var _=require(_0x5b13('0x0'));var util=require(_0x5b13('0x1'));var moment=require(_0x5b13('0x2'));var BPromise=require(_0x5b13('0x3'));var rs=require(_0x5b13('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b13('0x5'));var logger=require('../../config/logger')(_0x5b13('0x6'));var config=require('../../config/environment');var jayson=require(_0x5b13('0x7'));var client=jayson[_0x5b13('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x174b17,_0x4bbdf3,_0x5e6410){return new BPromise(function(_0x243a74,_0x1b1338){return client[_0x5b13('0x9')](_0x174b17,_0x5e6410)['then'](function(_0x61e65e){logger[_0x5b13('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4bbdf3,_0x5b13('0xb'));logger[_0x5b13('0xc')](_0x5b13('0xd'),_0x4bbdf3,_0x5b13('0xb'),JSON[_0x5b13('0xe')](_0x61e65e));if(_0x61e65e['error']){if(_0x61e65e[_0x5b13('0xf')][_0x5b13('0x10')]===0x1f4){logger['error'](_0x5b13('0x11'),_0x4bbdf3,_0x61e65e[_0x5b13('0xf')]['message']);return _0x1b1338(_0x61e65e[_0x5b13('0xf')]['message']);}logger[_0x5b13('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4bbdf3,_0x61e65e[_0x5b13('0xf')][_0x5b13('0x12')]);return _0x243a74(_0x61e65e[_0x5b13('0xf')][_0x5b13('0x12')]);}else{logger['info'](_0x5b13('0x11'),_0x4bbdf3,_0x5b13('0xb'));_0x243a74(_0x61e65e['result'][_0x5b13('0x12')]);}})[_0x5b13('0x13')](function(_0x4f53fc){logger[_0x5b13('0xf')](_0x5b13('0x11'),_0x4bbdf3,_0x4f53fc);_0x1b1338(_0x4f53fc);});});} \ No newline at end of file +var _0xc569=['result','catch','FreshdeskConfiguration,\x20%s,\x20%s','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x2b34d8,_0x312d3b){var _0x21e488=function(_0x24acfa){while(--_0x24acfa){_0x2b34d8['push'](_0x2b34d8['shift']());}};_0x21e488(++_0x312d3b);}(_0xc569,0x19b));var _0x9c56=function(_0x5d6448,_0x55e965){_0x5d6448=_0x5d6448-0x0;var _0x3d0fb5=_0xc569[_0x5d6448];return _0x3d0fb5;};'use strict';var _=require(_0x9c56('0x0'));var util=require(_0x9c56('0x1'));var moment=require('moment');var BPromise=require(_0x9c56('0x2'));var rs=require(_0x9c56('0x3'));var fs=require('fs');var Redis=require(_0x9c56('0x4'));var db=require(_0x9c56('0x5'))['db'];var utils=require(_0x9c56('0x6'));var logger=require(_0x9c56('0x7'))(_0x9c56('0x8'));var config=require(_0x9c56('0x9'));var jayson=require(_0x9c56('0xa'));var client=jayson[_0x9c56('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x454af2,_0x323cb4,_0x5e7a16){return new BPromise(function(_0x2b0736,_0x3bafbb){return client[_0x9c56('0xc')](_0x454af2,_0x5e7a16)[_0x9c56('0xd')](function(_0x12656f){logger[_0x9c56('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x323cb4,_0x9c56('0xf'));logger[_0x9c56('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x323cb4,'request\x20sent',JSON[_0x9c56('0x11')](_0x12656f));if(_0x12656f[_0x9c56('0x12')]){if(_0x12656f[_0x9c56('0x12')][_0x9c56('0x13')]===0x1f4){logger[_0x9c56('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x323cb4,_0x12656f['error'][_0x9c56('0x14')]);return _0x3bafbb(_0x12656f[_0x9c56('0x12')][_0x9c56('0x14')]);}logger[_0x9c56('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x323cb4,_0x12656f['error'][_0x9c56('0x14')]);return _0x2b0736(_0x12656f[_0x9c56('0x12')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x323cb4,_0x9c56('0xf'));_0x2b0736(_0x12656f[_0x9c56('0x15')][_0x9c56('0x14')]);}})[_0x9c56('0x16')](function(_0x587dd1){logger[_0x9c56('0x12')](_0x9c56('0x17'),_0x323cb4,_0x587dd1);_0x3bafbb(_0x587dd1);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 595fc1e..29540a9 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 _0x4a8f=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0xd5f5f,_0x4e33b5){var _0x1aad2a=function(_0x69c53a){while(--_0x69c53a){_0xd5f5f['push'](_0xd5f5f['shift']());}};_0x1aad2a(++_0x4e33b5);}(_0x4a8f,0x158));var _0xf4a8=function(_0x3fe393,_0x234a3a){_0x3fe393=_0x3fe393-0x0;var _0x534d14=_0x4a8f[_0x3fe393];return _0x534d14;};'use strict';var multer=require('multer');var util=require(_0xf4a8('0x0'));var path=require(_0xf4a8('0x1'));var timeout=require(_0xf4a8('0x2'));var express=require(_0xf4a8('0x3'));var router=express['Router']();var fs_extra=require(_0xf4a8('0x4'));var auth=require(_0xf4a8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf4a8('0x6'));var controller=require(_0xf4a8('0x7'));router[_0xf4a8('0x8')]('/',auth[_0xf4a8('0x9')](),controller[_0xf4a8('0xa')]);router[_0xf4a8('0x8')]('/:id',auth[_0xf4a8('0x9')](),controller[_0xf4a8('0xb')]);router[_0xf4a8('0xc')]('/',auth[_0xf4a8('0x9')](),controller[_0xf4a8('0xd')]);router[_0xf4a8('0xe')](_0xf4a8('0xf'),auth['isAuthenticated'](),controller[_0xf4a8('0x10')]);router[_0xf4a8('0x11')]('/:id',auth[_0xf4a8('0x9')](),controller[_0xf4a8('0x12')]);module[_0xf4a8('0x13')]=router; \ No newline at end of file +var _0x1d77=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id','show'];(function(_0x1a16f4,_0x433a8f){var _0x3ebad0=function(_0x1db8b4){while(--_0x1db8b4){_0x1a16f4['push'](_0x1a16f4['shift']());}};_0x3ebad0(++_0x433a8f);}(_0x1d77,0x183));var _0x71d7=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x1d77[_0x3e8cae];return _0x45c4d6;};'use strict';var multer=require(_0x71d7('0x0'));var util=require(_0x71d7('0x1'));var path=require('path');var timeout=require(_0x71d7('0x2'));var express=require(_0x71d7('0x3'));var router=express[_0x71d7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x71d7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x71d7('0x6'));var controller=require(_0x71d7('0x7'));router['get']('/',auth[_0x71d7('0x8')](),controller[_0x71d7('0x9')]);router[_0x71d7('0xa')](_0x71d7('0xb'),auth[_0x71d7('0x8')](),controller[_0x71d7('0xc')]);router[_0x71d7('0xd')]('/',auth['isAuthenticated'](),controller[_0x71d7('0xe')]);router[_0x71d7('0xf')](_0x71d7('0xb'),auth[_0x71d7('0x8')](),controller[_0x71d7('0x10')]);router[_0x71d7('0x11')](_0x71d7('0xb'),auth[_0x71d7('0x8')](),controller[_0x71d7('0x12')]);module[_0x71d7('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 c1c8f79..5c6ef8f 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 _0x0d8a=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x3b9583,_0x148150){var _0x35c329=function(_0x43121e){while(--_0x43121e){_0x3b9583['push'](_0x3b9583['shift']());}};_0x35c329(++_0x148150);}(_0x0d8a,0x17f));var _0xa0d8=function(_0x17088c,_0x653302){_0x17088c=_0x17088c-0x0;var _0x5b36ee=_0x0d8a[_0x17088c];return _0x5b36ee;};'use strict';var Sequelize=require(_0xa0d8('0x0'));module[_0xa0d8('0x1')]={'type':{'type':Sequelize[_0xa0d8('0x2')]('string',_0xa0d8('0x3'),_0xa0d8('0x4'),_0xa0d8('0x5'),_0xa0d8('0x6')),'defaultValue':_0xa0d8('0x7')},'content':{'type':Sequelize[_0xa0d8('0x8')]},'key':{'type':Sequelize[_0xa0d8('0x8')]},'keyType':{'type':Sequelize[_0xa0d8('0x2')](_0xa0d8('0x7'),_0xa0d8('0x3'),_0xa0d8('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa0d8('0x8')]},'nameField':{'type':Sequelize[_0xa0d8('0x8')]},'customField':{'type':Sequelize[_0xa0d8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xae7f=['customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x3a6e4b,_0x118cd9){var _0x36572d=function(_0x2a53cf){while(--_0x2a53cf){_0x3a6e4b['push'](_0x3a6e4b['shift']());}};_0x36572d(++_0x118cd9);}(_0xae7f,0x124));var _0xfae7=function(_0x302670,_0x483f29){_0x302670=_0x302670-0x0;var _0x15bbb0=_0xae7f[_0x302670];return _0x15bbb0;};'use strict';var Sequelize=require(_0xfae7('0x0'));module[_0xfae7('0x1')]={'type':{'type':Sequelize[_0xfae7('0x2')](_0xfae7('0x3'),_0xfae7('0x4'),_0xfae7('0x5'),_0xfae7('0x6'),_0xfae7('0x7')),'defaultValue':_0xfae7('0x3')},'content':{'type':Sequelize[_0xfae7('0x8')]},'key':{'type':Sequelize[_0xfae7('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xfae7('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xfae7('0x8')]},'idField':{'type':Sequelize[_0xfae7('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfae7('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 53b2d29..1d4db7a 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 _0x422f=['update','destroy','then','error','stack','name','map','FreshdeskField','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','type','VIRTUAL','findAll','rows','show','params','rawAttributes','length','includeAll','include','merge','options','find','body','catch','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x422f,0x1c7));var _0xf422=function(_0x4ade92,_0x4d333f){_0x4ade92=_0x4ade92-0x0;var _0x58eff3=_0x422f[_0x4ade92];return _0x58eff3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf422('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf422('0x1'));var rp=require(_0xf422('0x2'));var moment=require('moment');var BPromise=require(_0xf422('0x3'));var Mustache=require(_0xf422('0x4'));var util=require(_0xf422('0x5'));var path=require(_0xf422('0x6'));var sox=require(_0xf422('0x7'));var csv=require(_0xf422('0x8'));var ejs=require(_0xf422('0x9'));var fs=require('fs');var fs_extra=require(_0xf422('0xa'));var _=require(_0xf422('0xb'));var squel=require('squel');var crypto=require(_0xf422('0xc'));var jsforce=require(_0xf422('0xd'));var deskjs=require(_0xf422('0xe'));var toCsv=require(_0xf422('0x8'));var querystring=require(_0xf422('0xf'));var Papa=require('papaparse');var Redis=require(_0xf422('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf422('0x11'));var hardwareService=require(_0xf422('0x12'));var logger=require(_0xf422('0x13'))(_0xf422('0x14'));var utils=require(_0xf422('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf422('0x16'));var db=require(_0xf422('0x17'))['db'];function respondWithStatusCode(_0x4d56d1,_0x133a6a){_0x133a6a=_0x133a6a||0xcc;return function(_0x8aa9cc){if(_0x8aa9cc){return _0x4d56d1[_0xf422('0x18')](_0x133a6a);}return _0x4d56d1[_0xf422('0x19')](_0x133a6a)[_0xf422('0x1a')]();};}function respondWithResult(_0x28a6a8,_0x223b21){_0x223b21=_0x223b21||0xc8;return function(_0x272430){if(_0x272430){return _0x28a6a8[_0xf422('0x19')](_0x223b21)['json'](_0x272430);}};}function respondWithFilteredResult(_0x54bb9c,_0x52f96b){return function(_0x1c81e1){if(_0x1c81e1){var _0x30b70a=typeof _0x52f96b[_0xf422('0x1b')]===_0xf422('0x1c')&&typeof _0x52f96b['limit']===_0xf422('0x1c');var _0x264964=_0x1c81e1[_0xf422('0x1d')];var _0x2ae133=_0x30b70a?0x0:_0x52f96b[_0xf422('0x1b')];var _0x29b0b1=_0x30b70a?_0x1c81e1['count']:_0x52f96b['offset']+_0x52f96b[_0xf422('0x1e')];var _0x4b657;if(_0x29b0b1>=_0x264964){_0x29b0b1=_0x264964;_0x4b657=0xc8;}else{_0x4b657=0xce;}_0x54bb9c[_0xf422('0x19')](_0x4b657);return _0x54bb9c['set'](_0xf422('0x1f'),_0x2ae133+'-'+_0x29b0b1+'/'+_0x264964)['json'](_0x1c81e1);}return null;};}function patchUpdates(_0x22afe7){return function(_0x15833b){try{jsonpatch[_0xf422('0x20')](_0x15833b,_0x22afe7,!![]);}catch(_0x4d6717){return BPromise[_0xf422('0x21')](_0x4d6717);}return _0x15833b[_0xf422('0x22')]();};}function saveUpdates(_0x511529,_0x4b80a0){return function(_0x268575){if(_0x268575){return _0x268575[_0xf422('0x23')](_0x511529)['then'](function(_0x25b6a5){return _0x25b6a5;});}return null;};}function removeEntity(_0x570ea2,_0x3b21a5){return function(_0x32ceee){if(_0x32ceee){return _0x32ceee[_0xf422('0x24')]()[_0xf422('0x25')](function(){_0x570ea2[_0xf422('0x19')](0xcc)[_0xf422('0x1a')]();});}};}function handleEntityNotFound(_0xd8d70f,_0x11d10b){return function(_0x5dcab4){if(!_0x5dcab4){_0xd8d70f[_0xf422('0x18')](0x194);}return _0x5dcab4;};}function handleError(_0x59d03d,_0x2f0f9f){_0x2f0f9f=_0x2f0f9f||0x1f4;return function(_0x7d36e7){logger[_0xf422('0x26')](_0x7d36e7[_0xf422('0x27')]);if(_0x7d36e7[_0xf422('0x28')]){delete _0x7d36e7[_0xf422('0x28')];}_0x59d03d[_0xf422('0x19')](_0x2f0f9f)['send'](_0x7d36e7);};}exports['index']=function(_0x35d1fa,_0x10d51b){var _0x266fb8={},_0x33ef63={},_0xefb99e={'count':0x0,'rows':[]};var _0x48e0c7=_[_0xf422('0x29')](db[_0xf422('0x2a')]['rawAttributes'],function(_0x5f0186){return{'name':_0x5f0186[_0xf422('0x2b')],'type':_0x5f0186['type']['key']};});_0x33ef63[_0xf422('0x2c')]=_[_0xf422('0x29')](_0x48e0c7,'name');_0x33ef63[_0xf422('0x2d')]=_[_0xf422('0x2e')](_0x35d1fa[_0xf422('0x2d')]);_0x33ef63[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x33ef63['model'],_0x33ef63[_0xf422('0x2d')]);_0x266fb8['attributes']=_[_0xf422('0x30')](_0x33ef63[_0xf422('0x2c')],qs[_0xf422('0x31')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x31')]));_0x266fb8[_0xf422('0x32')]=_0x266fb8[_0xf422('0x32')]['length']?_0x266fb8['attributes']:_0x33ef63[_0xf422('0x2c')];if(!_0x35d1fa[_0xf422('0x2d')]['hasOwnProperty'](_0xf422('0x33'))){_0x266fb8[_0xf422('0x1e')]=qs[_0xf422('0x1e')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1e')]);_0x266fb8[_0xf422('0x1b')]=qs[_0xf422('0x1b')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x1b')]);}_0x266fb8[_0xf422('0x34')]=qs[_0xf422('0x35')](_0x35d1fa[_0xf422('0x2d')][_0xf422('0x35')]);_0x266fb8[_0xf422('0x36')]=qs['filters'](_['pick'](_0x35d1fa['query'],_0x33ef63[_0xf422('0x2f')]),_0x48e0c7);if(_0x35d1fa[_0xf422('0x2d')]['filter']){_0x266fb8[_0xf422('0x36')]=_['merge'](_0x266fb8[_0xf422('0x36')],{'$or':_[_0xf422('0x29')](_0x48e0c7,function(_0x55ac68){if(_0x55ac68[_0xf422('0x37')]!==_0xf422('0x38')){var _0x174f6f={};_0x174f6f[_0x55ac68['name']]={'$like':'%'+_0x35d1fa[_0xf422('0x2d')]['filter']+'%'};return _0x174f6f;}})});}_0x266fb8=_['merge']({},_0x266fb8,_0x35d1fa['options']);var _0x112bce={'where':_0x266fb8[_0xf422('0x36')]};return db[_0xf422('0x2a')][_0xf422('0x1d')](_0x112bce)[_0xf422('0x25')](function(_0x2f82a0){_0xefb99e[_0xf422('0x1d')]=_0x2f82a0;if(_0x35d1fa[_0xf422('0x2d')]['includeAll']){_0x266fb8['include']=[{'all':!![]}];}return db[_0xf422('0x2a')][_0xf422('0x39')](_0x266fb8);})[_0xf422('0x25')](function(_0xb3955){_0xefb99e[_0xf422('0x3a')]=_0xb3955;return _0xefb99e;})[_0xf422('0x25')](respondWithFilteredResult(_0x10d51b,_0x266fb8))['catch'](handleError(_0x10d51b,null));};exports[_0xf422('0x3b')]=function(_0x4f453a,_0x17c1f2){var _0x391e3c={'raw':!![],'where':{'id':_0x4f453a[_0xf422('0x3c')]['id']}},_0x564041={};_0x564041[_0xf422('0x2c')]=_[_0xf422('0x2e')](db[_0xf422('0x2a')][_0xf422('0x3d')]);_0x564041['query']=_[_0xf422('0x2e')](_0x4f453a[_0xf422('0x2d')]);_0x564041[_0xf422('0x2f')]=_[_0xf422('0x30')](_0x564041[_0xf422('0x2c')],_0x564041['query']);_0x391e3c[_0xf422('0x32')]=_[_0xf422('0x30')](_0x564041['model'],qs[_0xf422('0x31')](_0x4f453a['query'][_0xf422('0x31')]));_0x391e3c[_0xf422('0x32')]=_0x391e3c[_0xf422('0x32')][_0xf422('0x3e')]?_0x391e3c[_0xf422('0x32')]:_0x564041[_0xf422('0x2c')];if(_0x4f453a[_0xf422('0x2d')][_0xf422('0x3f')]){_0x391e3c[_0xf422('0x40')]=[{'all':!![]}];}_0x391e3c=_[_0xf422('0x41')]({},_0x391e3c,_0x4f453a[_0xf422('0x42')]);return db[_0xf422('0x2a')][_0xf422('0x43')](_0x391e3c)[_0xf422('0x25')](handleEntityNotFound(_0x17c1f2,null))[_0xf422('0x25')](respondWithResult(_0x17c1f2,null))['catch'](handleError(_0x17c1f2,null));};exports['create']=function(_0x3c59dd,_0x2c2ce9){return db[_0xf422('0x2a')]['create'](_0x3c59dd[_0xf422('0x44')],{})[_0xf422('0x25')](respondWithResult(_0x2c2ce9,0xc9))[_0xf422('0x45')](handleError(_0x2c2ce9,null));};exports[_0xf422('0x23')]=function(_0x1f3a30,_0x259e24){if(_0x1f3a30[_0xf422('0x44')]['id']){delete _0x1f3a30['body']['id'];}return db[_0xf422('0x2a')]['find']({'where':{'id':_0x1f3a30[_0xf422('0x3c')]['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x259e24,null))['then'](saveUpdates(_0x1f3a30[_0xf422('0x44')],null))[_0xf422('0x25')](respondWithResult(_0x259e24,null))[_0xf422('0x45')](handleError(_0x259e24,null));};exports[_0xf422('0x24')]=function(_0x2df71a,_0x5c3cb8){return db['FreshdeskField'][_0xf422('0x43')]({'where':{'id':_0x2df71a['params']['id']}})[_0xf422('0x25')](handleEntityNotFound(_0x5c3cb8,null))[_0xf422('0x25')](removeEntity(_0x5c3cb8,null))[_0xf422('0x45')](handleError(_0x5c3cb8,null));}; \ No newline at end of file +var _0xaaa2=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField','type','key'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xaaa2,0xac));var _0x2aaa=function(_0x854c84,_0x3edd0e){_0x854c84=_0x854c84-0x0;var _0xad7eab=_0xaaa2[_0x854c84];return _0xad7eab;};'use strict';var emlformat=require(_0x2aaa('0x0'));var rimraf=require(_0x2aaa('0x1'));var zipdir=require(_0x2aaa('0x2'));var jsonpatch=require(_0x2aaa('0x3'));var rp=require(_0x2aaa('0x4'));var moment=require(_0x2aaa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2aaa('0x6'));var util=require('util');var path=require(_0x2aaa('0x7'));var sox=require(_0x2aaa('0x8'));var csv=require(_0x2aaa('0x9'));var ejs=require(_0x2aaa('0xa'));var fs=require('fs');var fs_extra=require(_0x2aaa('0xb'));var _=require(_0x2aaa('0xc'));var squel=require('squel');var crypto=require(_0x2aaa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2aaa('0x9'));var querystring=require('querystring');var Papa=require(_0x2aaa('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2aaa('0xf'));var as=require(_0x2aaa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2aaa('0x11'))(_0x2aaa('0x12'));var utils=require(_0x2aaa('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2aaa('0x14'));var db=require(_0x2aaa('0x15'))['db'];function respondWithStatusCode(_0x8a5be3,_0x2b51f0){_0x2b51f0=_0x2b51f0||0xcc;return function(_0xd38d6d){if(_0xd38d6d){return _0x8a5be3[_0x2aaa('0x16')](_0x2b51f0);}return _0x8a5be3[_0x2aaa('0x17')](_0x2b51f0)[_0x2aaa('0x18')]();};}function respondWithResult(_0x32dfbf,_0xe22151){_0xe22151=_0xe22151||0xc8;return function(_0x314366){if(_0x314366){return _0x32dfbf[_0x2aaa('0x17')](_0xe22151)['json'](_0x314366);}};}function respondWithFilteredResult(_0x166321,_0x4df56b){return function(_0x35fbc1){if(_0x35fbc1){var _0x1a5573=typeof _0x4df56b['offset']==='undefined'&&typeof _0x4df56b['limit']===_0x2aaa('0x19');var _0x1dc0ba=_0x35fbc1[_0x2aaa('0x1a')];var _0x3b94bf=_0x1a5573?0x0:_0x4df56b[_0x2aaa('0x1b')];var _0xdaa445=_0x1a5573?_0x35fbc1[_0x2aaa('0x1a')]:_0x4df56b['offset']+_0x4df56b[_0x2aaa('0x1c')];var _0x30951c;if(_0xdaa445>=_0x1dc0ba){_0xdaa445=_0x1dc0ba;_0x30951c=0xc8;}else{_0x30951c=0xce;}_0x166321['status'](_0x30951c);return _0x166321[_0x2aaa('0x1d')]('Content-Range',_0x3b94bf+'-'+_0xdaa445+'/'+_0x1dc0ba)['json'](_0x35fbc1);}return null;};}function patchUpdates(_0x1ec32e){return function(_0x5052eb){try{jsonpatch[_0x2aaa('0x1e')](_0x5052eb,_0x1ec32e,!![]);}catch(_0x3e7649){return BPromise[_0x2aaa('0x1f')](_0x3e7649);}return _0x5052eb[_0x2aaa('0x20')]();};}function saveUpdates(_0x2c255f,_0x24da1e){return function(_0x4f581f){if(_0x4f581f){return _0x4f581f[_0x2aaa('0x21')](_0x2c255f)[_0x2aaa('0x22')](function(_0x4836b2){return _0x4836b2;});}return null;};}function removeEntity(_0x4d35aa,_0x19153e){return function(_0x4d7151){if(_0x4d7151){return _0x4d7151[_0x2aaa('0x23')]()[_0x2aaa('0x22')](function(){_0x4d35aa['status'](0xcc)[_0x2aaa('0x18')]();});}};}function handleEntityNotFound(_0x3b99d8,_0x4e1c0f){return function(_0x2ab888){if(!_0x2ab888){_0x3b99d8[_0x2aaa('0x16')](0x194);}return _0x2ab888;};}function handleError(_0x41253c,_0x5371cd){_0x5371cd=_0x5371cd||0x1f4;return function(_0x1f626b){logger[_0x2aaa('0x24')](_0x1f626b['stack']);if(_0x1f626b['name']){delete _0x1f626b[_0x2aaa('0x25')];}_0x41253c[_0x2aaa('0x17')](_0x5371cd)[_0x2aaa('0x26')](_0x1f626b);};}exports[_0x2aaa('0x27')]=function(_0x3a6a63,_0x292297){var _0x2f8305={},_0x166dc0={},_0x12cd47={'count':0x0,'rows':[]};var _0x19472b=_[_0x2aaa('0x28')](db[_0x2aaa('0x29')]['rawAttributes'],function(_0x101b6e){return{'name':_0x101b6e['fieldName'],'type':_0x101b6e[_0x2aaa('0x2a')][_0x2aaa('0x2b')]};});_0x166dc0[_0x2aaa('0x2c')]=_[_0x2aaa('0x28')](_0x19472b,_0x2aaa('0x25'));_0x166dc0[_0x2aaa('0x2d')]=_[_0x2aaa('0x2e')](_0x3a6a63[_0x2aaa('0x2d')]);_0x166dc0[_0x2aaa('0x2f')]=_[_0x2aaa('0x30')](_0x166dc0['model'],_0x166dc0['query']);_0x2f8305['attributes']=_['intersection'](_0x166dc0['model'],qs[_0x2aaa('0x31')](_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x31')]));_0x2f8305[_0x2aaa('0x32')]=_0x2f8305[_0x2aaa('0x32')][_0x2aaa('0x33')]?_0x2f8305[_0x2aaa('0x32')]:_0x166dc0[_0x2aaa('0x2c')];if(!_0x3a6a63['query'][_0x2aaa('0x34')](_0x2aaa('0x35'))){_0x2f8305['limit']=qs[_0x2aaa('0x1c')](_0x3a6a63[_0x2aaa('0x2d')]['limit']);_0x2f8305[_0x2aaa('0x1b')]=qs[_0x2aaa('0x1b')](_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x1b')]);}_0x2f8305[_0x2aaa('0x36')]=qs[_0x2aaa('0x37')](_0x3a6a63[_0x2aaa('0x2d')]['sort']);_0x2f8305['where']=qs[_0x2aaa('0x2f')](_['pick'](_0x3a6a63[_0x2aaa('0x2d')],_0x166dc0[_0x2aaa('0x2f')]),_0x19472b);if(_0x3a6a63['query'][_0x2aaa('0x38')]){_0x2f8305[_0x2aaa('0x39')]=_[_0x2aaa('0x3a')](_0x2f8305['where'],{'$or':_[_0x2aaa('0x28')](_0x19472b,function(_0x337ae8){if(_0x337ae8[_0x2aaa('0x2a')]!==_0x2aaa('0x3b')){var _0x5023d2={};_0x5023d2[_0x337ae8[_0x2aaa('0x25')]]={'$like':'%'+_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x38')]+'%'};return _0x5023d2;}})});}_0x2f8305=_[_0x2aaa('0x3a')]({},_0x2f8305,_0x3a6a63[_0x2aaa('0x3c')]);var _0x362060={'where':_0x2f8305[_0x2aaa('0x39')]};return db[_0x2aaa('0x29')][_0x2aaa('0x1a')](_0x362060)[_0x2aaa('0x22')](function(_0x127f7e){_0x12cd47[_0x2aaa('0x1a')]=_0x127f7e;if(_0x3a6a63[_0x2aaa('0x2d')]['includeAll']){_0x2f8305[_0x2aaa('0x3d')]=[{'all':!![]}];}return db[_0x2aaa('0x29')][_0x2aaa('0x3e')](_0x2f8305);})['then'](function(_0x17042f){_0x12cd47[_0x2aaa('0x3f')]=_0x17042f;return _0x12cd47;})[_0x2aaa('0x22')](respondWithFilteredResult(_0x292297,_0x2f8305))['catch'](handleError(_0x292297,null));};exports[_0x2aaa('0x40')]=function(_0x1bb225,_0x25b932){var _0x4ad537={'raw':!![],'where':{'id':_0x1bb225[_0x2aaa('0x41')]['id']}},_0x57554e={};_0x57554e[_0x2aaa('0x2c')]=_[_0x2aaa('0x2e')](db['FreshdeskField'][_0x2aaa('0x42')]);_0x57554e[_0x2aaa('0x2d')]=_[_0x2aaa('0x2e')](_0x1bb225[_0x2aaa('0x2d')]);_0x57554e[_0x2aaa('0x2f')]=_[_0x2aaa('0x30')](_0x57554e[_0x2aaa('0x2c')],_0x57554e[_0x2aaa('0x2d')]);_0x4ad537['attributes']=_['intersection'](_0x57554e[_0x2aaa('0x2c')],qs['fields'](_0x1bb225[_0x2aaa('0x2d')]['fields']));_0x4ad537['attributes']=_0x4ad537['attributes'][_0x2aaa('0x33')]?_0x4ad537[_0x2aaa('0x32')]:_0x57554e['model'];if(_0x1bb225[_0x2aaa('0x2d')][_0x2aaa('0x43')]){_0x4ad537['include']=[{'all':!![]}];}_0x4ad537=_[_0x2aaa('0x3a')]({},_0x4ad537,_0x1bb225['options']);return db[_0x2aaa('0x29')][_0x2aaa('0x44')](_0x4ad537)['then'](handleEntityNotFound(_0x25b932,null))[_0x2aaa('0x22')](respondWithResult(_0x25b932,null))[_0x2aaa('0x45')](handleError(_0x25b932,null));};exports[_0x2aaa('0x46')]=function(_0x367a63,_0x745414){return db['FreshdeskField']['create'](_0x367a63['body'],{})[_0x2aaa('0x22')](respondWithResult(_0x745414,0xc9))[_0x2aaa('0x45')](handleError(_0x745414,null));};exports[_0x2aaa('0x21')]=function(_0x393073,_0x23290d){if(_0x393073[_0x2aaa('0x47')]['id']){delete _0x393073[_0x2aaa('0x47')]['id'];}return db[_0x2aaa('0x29')][_0x2aaa('0x44')]({'where':{'id':_0x393073['params']['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x23290d,null))[_0x2aaa('0x22')](saveUpdates(_0x393073[_0x2aaa('0x47')],null))[_0x2aaa('0x22')](respondWithResult(_0x23290d,null))['catch'](handleError(_0x23290d,null));};exports[_0x2aaa('0x23')]=function(_0xe935c3,_0x3906f8){return db['FreshdeskField']['find']({'where':{'id':_0xe935c3[_0x2aaa('0x41')]['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x3906f8,null))[_0x2aaa('0x22')](removeEntity(_0x3906f8,null))[_0x2aaa('0x45')](handleError(_0x3906f8,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index a8e5928..f45aa6d 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 _0xf25a=['moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util','../../config/logger'];(function(_0x12cb7c,_0x4ce42b){var _0x325f77=function(_0x111e12){while(--_0x111e12){_0x12cb7c['push'](_0x12cb7c['shift']());}};_0x325f77(++_0x4ce42b);}(_0xf25a,0x195));var _0xaf25=function(_0x5ef955,_0x194047){_0x5ef955=_0x5ef955-0x0;var _0x5f2be1=_0xf25a[_0x5ef955];return _0x5f2be1;};'use strict';var _=require(_0xaf25('0x0'));var util=require(_0xaf25('0x1'));var logger=require(_0xaf25('0x2'))('api');var moment=require(_0xaf25('0x3'));var BPromise=require(_0xaf25('0x4'));var rp=require(_0xaf25('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf25('0x6'));var config=require(_0xaf25('0x7'));var attributes=require(_0xaf25('0x8'));module['exports']=function(_0x49281b,_0x30eaae){return _0x49281b['define']('FreshdeskField',attributes,{'tableName':_0xaf25('0x9'),'paranoid':![],'indexes':[{'name':_0xaf25('0xa'),'fields':[_0xaf25('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5636=['define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x1e5a1c,_0x4c0a7a){var _0x3b3a43=function(_0x48cbbc){while(--_0x48cbbc){_0x1e5a1c['push'](_0x1e5a1c['shift']());}};_0x3b3a43(++_0x4c0a7a);}(_0x5636,0x102));var _0x6563=function(_0x480019,_0x44f1cf){_0x480019=_0x480019-0x0;var _0x44405d=_0x5636[_0x480019];return _0x44405d;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6563('0x2'));var rp=require(_0x6563('0x3'));var fs=require('fs');var path=require(_0x6563('0x4'));var rimraf=require('rimraf');var config=require(_0x6563('0x5'));var attributes=require(_0x6563('0x6'));module[_0x6563('0x7')]=function(_0x39792f,_0x29f687){return _0x39792f[_0x6563('0x8')](_0x6563('0x9'),attributes,{'tableName':_0x6563('0xa'),'paranoid':![],'indexes':[{'name':_0x6563('0xb'),'fields':[_0x6563('0xc'),_0x6563('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 452ebb7..588d71b 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 _0xdc3e=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdc3e,0xf2));var _0xedc3=function(_0x21d4aa,_0x4e0dd5){_0x21d4aa=_0x21d4aa-0x0;var _0x4d1b8e=_0xdc3e[_0x21d4aa];return _0x4d1b8e;};'use strict';var _=require('lodash');var util=require(_0xedc3('0x0'));var moment=require(_0xedc3('0x1'));var BPromise=require(_0xedc3('0x2'));var rs=require(_0xedc3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedc3('0x4'))['db'];var utils=require(_0xedc3('0x5'));var logger=require('../../config/logger')(_0xedc3('0x6'));var config=require(_0xedc3('0x7'));var jayson=require(_0xedc3('0x8'));var client=jayson[_0xedc3('0x9')][_0xedc3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43fc5d,_0x5a7e7f,_0x1968b2){return new BPromise(function(_0x217604,_0x35406d){return client[_0xedc3('0xb')](_0x43fc5d,_0x1968b2)[_0xedc3('0xc')](function(_0x203312){logger['info'](_0xedc3('0xd'),_0x5a7e7f,_0xedc3('0xe'));logger[_0xedc3('0xf')](_0xedc3('0x10'),_0x5a7e7f,'request\x20sent',JSON[_0xedc3('0x11')](_0x203312));if(_0x203312[_0xedc3('0x12')]){if(_0x203312[_0xedc3('0x12')][_0xedc3('0x13')]===0x1f4){logger[_0xedc3('0x12')](_0xedc3('0xd'),_0x5a7e7f,_0x203312[_0xedc3('0x12')]['message']);return _0x35406d(_0x203312[_0xedc3('0x12')][_0xedc3('0x14')]);}logger['error'](_0xedc3('0xd'),_0x5a7e7f,_0x203312[_0xedc3('0x12')][_0xedc3('0x14')]);return _0x217604(_0x203312['error'][_0xedc3('0x14')]);}else{logger['info'](_0xedc3('0xd'),_0x5a7e7f,_0xedc3('0xe'));_0x217604(_0x203312['result'][_0xedc3('0x14')]);}})[_0xedc3('0x15')](function(_0xd8d545){logger[_0xedc3('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x5a7e7f,_0xd8d545);_0x35406d(_0xd8d545);});});} \ No newline at end of file +var _0x5e33=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2ea0e2,_0x24ec0f){var _0x2a27c6=function(_0xfd22bc){while(--_0xfd22bc){_0x2ea0e2['push'](_0x2ea0e2['shift']());}};_0x2a27c6(++_0x24ec0f);}(_0x5e33,0x85));var _0x35e3=function(_0x26b3bc,_0x34d1bc){_0x26b3bc=_0x26b3bc-0x0;var _0x4ca5a1=_0x5e33[_0x26b3bc];return _0x4ca5a1;};'use strict';var _=require('lodash');var util=require(_0x35e3('0x0'));var moment=require('moment');var BPromise=require(_0x35e3('0x1'));var rs=require(_0x35e3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35e3('0x3'))['db'];var utils=require(_0x35e3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x35e3('0x5'));var jayson=require(_0x35e3('0x6'));var client=jayson[_0x35e3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c946e,_0x56e3ea,_0x5c9949){return new BPromise(function(_0x45cd6e,_0x4cccfe){return client[_0x35e3('0x8')](_0x1c946e,_0x5c9949)['then'](function(_0x21825b){logger[_0x35e3('0x9')]('FreshdeskField,\x20%s,\x20%s',_0x56e3ea,_0x35e3('0xa'));logger[_0x35e3('0xb')](_0x35e3('0xc'),_0x56e3ea,_0x35e3('0xa'),JSON[_0x35e3('0xd')](_0x21825b));if(_0x21825b['error']){if(_0x21825b[_0x35e3('0xe')][_0x35e3('0xf')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x56e3ea,_0x21825b['error'][_0x35e3('0x10')]);return _0x4cccfe(_0x21825b[_0x35e3('0xe')][_0x35e3('0x10')]);}logger[_0x35e3('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x56e3ea,_0x21825b[_0x35e3('0xe')][_0x35e3('0x10')]);return _0x45cd6e(_0x21825b[_0x35e3('0xe')]['message']);}else{logger[_0x35e3('0x9')]('FreshdeskField,\x20%s,\x20%s',_0x56e3ea,_0x35e3('0xa'));_0x45cd6e(_0x21825b[_0x35e3('0x11')][_0x35e3('0x10')]);}})[_0x35e3('0x12')](function(_0x2dbdfc){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x56e3ea,_0x2dbdfc);_0x4cccfe(_0x2dbdfc);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index c6878f0..4a01e5d 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 _0x4ded=['./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc3071f,_0x566221){var _0xbc8f61=function(_0x13cd10){while(--_0x13cd10){_0xc3071f['push'](_0xc3071f['shift']());}};_0xbc8f61(++_0x566221);}(_0x4ded,0x116));var _0xd4de=function(_0x3bbff0,_0x253a66){_0x3bbff0=_0x3bbff0-0x0;var _0x101ab5=_0x4ded[_0x3bbff0];return _0x101ab5;};'use strict';var multer=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var path=require(_0xd4de('0x2'));var timeout=require(_0xd4de('0x3'));var express=require(_0xd4de('0x4'));var router=express[_0xd4de('0x5')]();var fs_extra=require(_0xd4de('0x6'));var auth=require(_0xd4de('0x7'));var interaction=require(_0xd4de('0x8'));var config=require(_0xd4de('0x9'));var controller=require(_0xd4de('0xa'));router[_0xd4de('0xb')]('/',auth['isAuthenticated'](),controller[_0xd4de('0xc')]);router[_0xd4de('0xb')](_0xd4de('0xd'),auth[_0xd4de('0xe')](),controller[_0xd4de('0xf')]);router[_0xd4de('0xb')]('/:id/configurations',auth[_0xd4de('0xe')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0xd4de('0xe')](),controller[_0xd4de('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd4de('0x11')]('/:id/configurations',auth[_0xd4de('0xe')](),controller[_0xd4de('0x12')]);router[_0xd4de('0x13')](_0xd4de('0xd'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x14')]);router[_0xd4de('0x15')](_0xd4de('0xd'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x16')]);module[_0xd4de('0x17')]=router; \ No newline at end of file +var _0xf45e=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','destroy'];(function(_0x4a4b47,_0xce9c6e){var _0x5f2f2b=function(_0x4caaaa){while(--_0x4caaaa){_0x4a4b47['push'](_0x4a4b47['shift']());}};_0x5f2f2b(++_0xce9c6e);}(_0xf45e,0x115));var _0xef45=function(_0x38f879,_0xea1f1c){_0x38f879=_0x38f879-0x0;var _0x2faa08=_0xf45e[_0x38f879];return _0x2faa08;};'use strict';var multer=require(_0xef45('0x0'));var util=require('util');var path=require(_0xef45('0x1'));var timeout=require('connect-timeout');var express=require(_0xef45('0x2'));var router=express[_0xef45('0x3')]();var fs_extra=require(_0xef45('0x4'));var auth=require(_0xef45('0x5'));var interaction=require(_0xef45('0x6'));var config=require(_0xef45('0x7'));var controller=require(_0xef45('0x8'));router[_0xef45('0x9')]('/',auth[_0xef45('0xa')](),controller[_0xef45('0xb')]);router[_0xef45('0x9')](_0xef45('0xc'),auth[_0xef45('0xa')](),controller[_0xef45('0xd')]);router[_0xef45('0x9')](_0xef45('0xe'),auth[_0xef45('0xa')](),controller[_0xef45('0xf')]);router[_0xef45('0x9')]('/:id/fields',auth[_0xef45('0xa')](),controller[_0xef45('0x10')]);router[_0xef45('0x11')]('/',auth[_0xef45('0xa')](),controller[_0xef45('0x12')]);router[_0xef45('0x11')]('/:id/configurations',auth[_0xef45('0xa')](),controller[_0xef45('0x13')]);router[_0xef45('0x14')](_0xef45('0xc'),auth[_0xef45('0xa')](),controller['update']);router['delete'](_0xef45('0xc'),auth['isAuthenticated'](),controller[_0xef45('0x15')]);module[_0xef45('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 68ed697..ee96ea4 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 _0x1893=['STRING','username','remoteUri'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x1893,0xa2));var _0x3189=function(_0x293e7a,_0x1792a2){_0x293e7a=_0x293e7a-0x0;var _0xb78342=_0x1893[_0x293e7a];return _0xb78342;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3189('0x0')]},'description':{'type':Sequelize[_0x3189('0x0')]},'username':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x1')},'apiKey':{'type':Sequelize[_0x3189('0x0')]},'remoteUri':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x955f=['exports','STRING','sequelize'];(function(_0x2b017e,_0xb71d01){var _0x3d5665=function(_0x46e8a0){while(--_0x46e8a0){_0x2b017e['push'](_0x2b017e['shift']());}};_0x3d5665(++_0xb71d01);}(_0x955f,0x1eb));var _0xf955=function(_0x2ce307,_0x3e9b0f){_0x2ce307=_0x2ce307-0x0;var _0x47a112=_0x955f[_0x2ce307];return _0x47a112;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'name':{'type':Sequelize[_0xf955('0x2')]},'description':{'type':Sequelize[_0xf955('0x2')]},'username':{'type':Sequelize[_0xf955('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xf955('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xf955('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 561cd12..3db0260 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 _0x24d6=['VIRTUAL','includeAll','include','findAll','rows','params','rawAttributes','keys','length','options','find','create','update','body','destroy','getConfigurations','findOne','nolimit','catch','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','GET','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','error','name','send','map','FreshsalesAccount','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type'];(function(_0x48f3f5,_0x2a82f1){var _0x2b4746=function(_0x3f7067){while(--_0x3f7067){_0x48f3f5['push'](_0x48f3f5['shift']());}};_0x2b4746(++_0x2a82f1);}(_0x24d6,0x8c));var _0x624d=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0x24d6[_0x1ca4c3];return _0x4426a6;};'use strict';var emlformat=require(_0x624d('0x0'));var rimraf=require(_0x624d('0x1'));var zipdir=require(_0x624d('0x2'));var jsonpatch=require(_0x624d('0x3'));var rp=require(_0x624d('0x4'));var moment=require(_0x624d('0x5'));var BPromise=require(_0x624d('0x6'));var Mustache=require('mustache');var util=require(_0x624d('0x7'));var path=require(_0x624d('0x8'));var sox=require(_0x624d('0x9'));var csv=require(_0x624d('0xa'));var ejs=require(_0x624d('0xb'));var fs=require('fs');var fs_extra=require(_0x624d('0xc'));var _=require('lodash');var squel=require(_0x624d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x624d('0xe'));var Papa=require(_0x624d('0xf'));var Redis=require(_0x624d('0x10'));var authService=require(_0x624d('0x11'));var qs=require(_0x624d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x624d('0x13'));var logger=require(_0x624d('0x14'))(_0x624d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x57bbac,_0x217946){_0x217946=_0x217946||0xcc;return function(_0x25b5c7){if(_0x25b5c7){return _0x57bbac[_0x624d('0x16')](_0x217946);}return _0x57bbac[_0x624d('0x17')](_0x217946)[_0x624d('0x18')]();};}function respondWithResult(_0x3a2bab,_0x1321db){_0x1321db=_0x1321db||0xc8;return function(_0x5c7e3b){if(_0x5c7e3b){return _0x3a2bab[_0x624d('0x17')](_0x1321db)[_0x624d('0x19')](_0x5c7e3b);}};}function respondWithFilteredResult(_0x5f5038,_0xd6f58e){return function(_0x2b6f88){if(_0x2b6f88){var _0x2af958=typeof _0xd6f58e[_0x624d('0x1a')]===_0x624d('0x1b')&&typeof _0xd6f58e[_0x624d('0x1c')]==='undefined';var _0x15b455=_0x2b6f88['count'];var _0x5845e1=_0x2af958?0x0:_0xd6f58e[_0x624d('0x1a')];var _0x8cff49=_0x2af958?_0x2b6f88[_0x624d('0x1d')]:_0xd6f58e[_0x624d('0x1a')]+_0xd6f58e[_0x624d('0x1c')];var _0x51aeb9;if(_0x8cff49>=_0x15b455){_0x8cff49=_0x15b455;_0x51aeb9=0xc8;}else{_0x51aeb9=0xce;}_0x5f5038[_0x624d('0x17')](_0x51aeb9);return _0x5f5038['set'](_0x624d('0x1e'),_0x5845e1+'-'+_0x8cff49+'/'+_0x15b455)[_0x624d('0x19')](_0x2b6f88);}return null;};}function patchUpdates(_0x2e006a){return function(_0x5b5ffe){try{jsonpatch[_0x624d('0x1f')](_0x5b5ffe,_0x2e006a,!![]);}catch(_0x2ce59d){return BPromise[_0x624d('0x20')](_0x2ce59d);}return _0x5b5ffe[_0x624d('0x21')]();};}function saveUpdates(_0x43a4bc,_0x16cc70){return function(_0x16af7a){if(_0x16af7a){return _0x16af7a['update'](_0x43a4bc)[_0x624d('0x22')](function(_0x4f4358){return _0x4f4358;});}return null;};}function removeEntity(_0xad8110,_0x3a6130){return function(_0x53deed){if(_0x53deed){return _0x53deed['destroy']()[_0x624d('0x22')](function(){_0xad8110[_0x624d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x86d992,_0x527461){return function(_0x5f5b21){if(!_0x5f5b21){_0x86d992['sendStatus'](0x194);}return _0x5f5b21;};}function handleError(_0x181c04,_0x7d4268){_0x7d4268=_0x7d4268||0x1f4;return function(_0x4ae956){logger[_0x624d('0x23')](_0x4ae956['stack']);if(_0x4ae956[_0x624d('0x24')]){delete _0x4ae956['name'];}_0x181c04[_0x624d('0x17')](_0x7d4268)[_0x624d('0x25')](_0x4ae956);};}exports['index']=function(_0x23daaf,_0x1fe2a1){var _0x106577={},_0x3982d4={},_0x2232ea={'count':0x0,'rows':[]};var _0x43f6ba=_[_0x624d('0x26')](db[_0x624d('0x27')]['rawAttributes'],function(_0xc32876){return{'name':_0xc32876[_0x624d('0x28')],'type':_0xc32876['type'][_0x624d('0x29')]};});_0x3982d4[_0x624d('0x2a')]=_[_0x624d('0x26')](_0x43f6ba,_0x624d('0x24'));_0x3982d4[_0x624d('0x2b')]=_['keys'](_0x23daaf['query']);_0x3982d4['filters']=_[_0x624d('0x2c')](_0x3982d4[_0x624d('0x2a')],_0x3982d4['query']);_0x106577[_0x624d('0x2d')]=_[_0x624d('0x2c')](_0x3982d4[_0x624d('0x2a')],qs[_0x624d('0x2e')](_0x23daaf[_0x624d('0x2b')][_0x624d('0x2e')]));_0x106577['attributes']=_0x106577[_0x624d('0x2d')]['length']?_0x106577['attributes']:_0x3982d4[_0x624d('0x2a')];if(!_0x23daaf[_0x624d('0x2b')][_0x624d('0x2f')]('nolimit')){_0x106577[_0x624d('0x1c')]=qs[_0x624d('0x1c')](_0x23daaf[_0x624d('0x2b')][_0x624d('0x1c')]);_0x106577[_0x624d('0x1a')]=qs[_0x624d('0x1a')](_0x23daaf[_0x624d('0x2b')][_0x624d('0x1a')]);}_0x106577[_0x624d('0x30')]=qs[_0x624d('0x31')](_0x23daaf[_0x624d('0x2b')][_0x624d('0x31')]);_0x106577[_0x624d('0x32')]=qs[_0x624d('0x33')](_[_0x624d('0x34')](_0x23daaf['query'],_0x3982d4[_0x624d('0x33')]),_0x43f6ba);if(_0x23daaf[_0x624d('0x2b')][_0x624d('0x35')]){_0x106577[_0x624d('0x32')]=_[_0x624d('0x36')](_0x106577['where'],{'$or':_[_0x624d('0x26')](_0x43f6ba,function(_0x54d44d){if(_0x54d44d[_0x624d('0x37')]!==_0x624d('0x38')){var _0x563308={};_0x563308[_0x54d44d[_0x624d('0x24')]]={'$like':'%'+_0x23daaf[_0x624d('0x2b')]['filter']+'%'};return _0x563308;}})});}_0x106577=_[_0x624d('0x36')]({},_0x106577,_0x23daaf['options']);var _0x5c9019={'where':_0x106577[_0x624d('0x32')]};return db[_0x624d('0x27')][_0x624d('0x1d')](_0x5c9019)[_0x624d('0x22')](function(_0x5bb24c){_0x2232ea[_0x624d('0x1d')]=_0x5bb24c;if(_0x23daaf[_0x624d('0x2b')][_0x624d('0x39')]){_0x106577[_0x624d('0x3a')]=[{'all':!![]}];}return db[_0x624d('0x27')][_0x624d('0x3b')](_0x106577);})[_0x624d('0x22')](function(_0x2e1bff){_0x2232ea[_0x624d('0x3c')]=_0x2e1bff;return _0x2232ea;})[_0x624d('0x22')](respondWithFilteredResult(_0x1fe2a1,_0x106577))['catch'](handleError(_0x1fe2a1,null));};exports['show']=function(_0xea6f2c,_0x4dc638){var _0x4c23df={'raw':![],'where':{'id':_0xea6f2c[_0x624d('0x3d')]['id']}},_0x4891c9={};_0x4891c9[_0x624d('0x2a')]=_['keys'](db['FreshsalesAccount'][_0x624d('0x3e')]);_0x4891c9[_0x624d('0x2b')]=_[_0x624d('0x3f')](_0xea6f2c[_0x624d('0x2b')]);_0x4891c9['filters']=_[_0x624d('0x2c')](_0x4891c9[_0x624d('0x2a')],_0x4891c9['query']);_0x4c23df[_0x624d('0x2d')]=_[_0x624d('0x2c')](_0x4891c9[_0x624d('0x2a')],qs[_0x624d('0x2e')](_0xea6f2c['query'][_0x624d('0x2e')]));_0x4c23df[_0x624d('0x2d')]=_0x4c23df['attributes'][_0x624d('0x40')]?_0x4c23df[_0x624d('0x2d')]:_0x4891c9[_0x624d('0x2a')];if(_0xea6f2c['query'][_0x624d('0x39')]){_0x4c23df[_0x624d('0x3a')]=[{'all':!![]}];}_0x4c23df=_[_0x624d('0x36')]({},_0x4c23df,_0xea6f2c[_0x624d('0x41')]);return db['FreshsalesAccount'][_0x624d('0x42')](_0x4c23df)['then'](handleEntityNotFound(_0x4dc638,null))[_0x624d('0x22')](respondWithResult(_0x4dc638,null))['catch'](handleError(_0x4dc638,null));};exports[_0x624d('0x43')]=function(_0x4501ca,_0x2f153e){return db[_0x624d('0x27')][_0x624d('0x43')](_0x4501ca['body'],{})[_0x624d('0x22')](respondWithResult(_0x2f153e,0xc9))['catch'](handleError(_0x2f153e,null));};exports[_0x624d('0x44')]=function(_0x1e97f4,_0x3fc8b1){if(_0x1e97f4[_0x624d('0x45')]['id']){delete _0x1e97f4[_0x624d('0x45')]['id'];}return db[_0x624d('0x27')][_0x624d('0x42')]({'where':{'id':_0x1e97f4[_0x624d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3fc8b1,null))['then'](saveUpdates(_0x1e97f4[_0x624d('0x45')],null))[_0x624d('0x22')](respondWithResult(_0x3fc8b1,null))['catch'](handleError(_0x3fc8b1,null));};exports[_0x624d('0x46')]=function(_0x5459d5,_0x1099df){return db[_0x624d('0x27')][_0x624d('0x42')]({'where':{'id':_0x5459d5[_0x624d('0x3d')]['id']}})[_0x624d('0x22')](handleEntityNotFound(_0x1099df,null))[_0x624d('0x22')](removeEntity(_0x1099df,null))['catch'](handleError(_0x1099df,null));};exports[_0x624d('0x47')]=function(_0x53dee5,_0x283462,_0xd0e712){var _0x3e00f8={};var _0x56fbf5={};var _0x4b4c3a;var _0x36f47a;return db['FreshsalesAccount'][_0x624d('0x48')]({'where':{'id':_0x53dee5[_0x624d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x283462,null))['then'](function(_0x5a6df8){if(_0x5a6df8){_0x4b4c3a=_0x5a6df8;_0x56fbf5[_0x624d('0x2a')]=_[_0x624d('0x3f')](db['FreshsalesConfiguration'][_0x624d('0x3e')]);_0x56fbf5[_0x624d('0x2b')]=_[_0x624d('0x3f')](_0x53dee5[_0x624d('0x2b')]);_0x56fbf5[_0x624d('0x33')]=_['intersection'](_0x56fbf5[_0x624d('0x2a')],_0x56fbf5['query']);_0x3e00f8[_0x624d('0x2d')]=_[_0x624d('0x2c')](_0x56fbf5[_0x624d('0x2a')],qs[_0x624d('0x2e')](_0x53dee5['query']['fields']));_0x3e00f8[_0x624d('0x2d')]=_0x3e00f8[_0x624d('0x2d')][_0x624d('0x40')]?_0x3e00f8['attributes']:_0x56fbf5['model'];_0x3e00f8[_0x624d('0x30')]=qs[_0x624d('0x31')](_0x53dee5['query'][_0x624d('0x31')]);_0x3e00f8['where']=qs[_0x624d('0x33')](_[_0x624d('0x34')](_0x53dee5['query'],_0x56fbf5['filters']));if(_0x53dee5[_0x624d('0x2b')][_0x624d('0x35')]){_0x3e00f8[_0x624d('0x32')]=_['merge'](_0x3e00f8[_0x624d('0x32')],{'$or':_[_0x624d('0x26')](_0x3e00f8[_0x624d('0x2d')],function(_0x53d102){var _0x32a996={};_0x32a996[_0x53d102]={'$like':'%'+_0x53dee5[_0x624d('0x2b')]['filter']+'%'};return _0x32a996;})});}_0x3e00f8=_['merge']({},_0x3e00f8,_0x53dee5[_0x624d('0x41')]);return _0x4b4c3a[_0x624d('0x47')](_0x3e00f8);}})[_0x624d('0x22')](function(_0x16da3e){if(_0x16da3e){_0x36f47a=_0x16da3e[_0x624d('0x40')];if(!_0x53dee5[_0x624d('0x2b')]['hasOwnProperty'](_0x624d('0x49'))){_0x3e00f8['limit']=qs[_0x624d('0x1c')](_0x53dee5[_0x624d('0x2b')][_0x624d('0x1c')]);_0x3e00f8[_0x624d('0x1a')]=qs['offset'](_0x53dee5[_0x624d('0x2b')][_0x624d('0x1a')]);}return _0x4b4c3a[_0x624d('0x47')](_0x3e00f8);}})['then'](function(_0x128c3b){if(_0x128c3b){return _0x128c3b?{'count':_0x36f47a,'rows':_0x128c3b}:null;}})[_0x624d('0x22')](respondWithResult(_0x283462,null))[_0x624d('0x4a')](handleError(_0x283462,null));};exports['addConfiguration']=function(_0x31885e,_0x426e95,_0x50f5d8){if(_0x31885e[_0x624d('0x45')]['id']){delete _0x31885e[_0x624d('0x45')]['id'];}return db[_0x624d('0x27')][_0x624d('0x48')]({'where':{'id':_0x31885e[_0x624d('0x3d')]['id']}})[_0x624d('0x22')](handleEntityNotFound(_0x426e95,null))[_0x624d('0x22')](function(_0x4dcad3){if(_0x4dcad3){_0x31885e[_0x624d('0x45')][_0x624d('0x4b')]=_0x4dcad3['id'];_0x31885e[_0x624d('0x45')][_0x624d('0x4c')]=integrations[_0x624d('0x4d')](_0x31885e[_0x624d('0x45')][_0x624d('0x4e')],_0x31885e[_0x624d('0x45')][_0x624d('0x37')]);_0x31885e['body'][_0x624d('0x4f')]=integrations[_0x624d('0x50')](_0x31885e[_0x624d('0x45')][_0x624d('0x4e')],_0x31885e[_0x624d('0x45')][_0x624d('0x37')]);return db[_0x624d('0x51')][_0x624d('0x43')](_0x31885e['body'],{'include':[{'model':db[_0x624d('0x52')],'as':_0x624d('0x4c')},{'model':db[_0x624d('0x52')],'as':_0x624d('0x4f')}]});}return null;})['then'](respondWithResult(_0x426e95,null))[_0x624d('0x4a')](handleError(_0x426e95,null));};exports[_0x624d('0x53')]=function(_0x275cbf,_0x2c51cc,_0x5eb2de){var _0x538bf6='';var _0x12333b='';return db[_0x624d('0x27')]['findOne']({'where':{'id':_0x275cbf[_0x624d('0x3d')]['id']},'attributes':['id',_0x624d('0x54'),'remoteUri',_0x624d('0x55')]})['then'](handleEntityNotFound(_0x2c51cc,null))['then'](function(_0x54b9bb){if(_0x54b9bb){_0x12333b=_0x54b9bb[_0x624d('0x54')];_0x538bf6=_0x54b9bb[_0x624d('0x56')];var _0x5e6acc=_0x54b9bb['remoteUri'][_0x624d('0x57')](-0x1);if(_0x5e6acc==='/'){_0x538bf6=_0x538bf6[_0x624d('0x58')](0x0,_0x538bf6['lastIndexOf'](_0x5e6acc));}return rp({'method':_0x624d('0x59'),'uri':util['format'](_0x624d('0x5a'),_0x538bf6,'/api/selector/owners'),'headers':{'Authorization':_0x624d('0x5b')+_0x54b9bb['apiKey']},'json':!![]});}})[_0x624d('0x22')](function(_0x422ce4){if(_0x422ce4){var _0x4c3d12=_0x422ce4[_0x624d('0x5c')];var _0x14d145=![];var _0x4345a9=null;for(_0x4345a9=0x0;_0x4345a9<_0x4c3d12[_0x624d('0x40')];_0x4345a9++){if(_0x4c3d12[_0x4345a9][_0x624d('0x5d')]===_0x12333b){_0x14d145=!![];}}if(_0x14d145){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x624d('0x5e')});}}})[_0x624d('0x22')](respondWithResult(_0x2c51cc,null))[_0x624d('0x4a')](function(_0x3c7c3a){var _0x3a440c=_0x275cbf[_0x624d('0x2b')][_0x624d('0x5f')]?0x1f4:_0x3c7c3a[_0x624d('0x60')]||0x1f4;logger[_0x624d('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x624d('0x53'),_0x3a440c,JSON[_0x624d('0x61')](_0x3c7c3a));delete _0x3c7c3a[_0x624d('0x24')];if(_0x3a440c===0x191){_0x3a440c=0x190;}_0x2c51cc[_0x624d('0x17')](_0x3a440c)[_0x624d('0x25')](_0x275cbf[_0x624d('0x2b')][_0x624d('0x5f')]?{'message':'Wrong\x20credentials','statusCode':_0x3c7c3a[_0x624d('0x60')]}:_0x3c7c3a);});}; \ No newline at end of file +var _0xec3a=['lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','status','offset','undefined','limit','count','set','json','apply','save','then','end','error','stack','name','index','map','FreshsalesAccount','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','catch','params','length','find','create','body','update','destroy','getConfigurations','findOne','FreshsalesConfiguration','rawAttributes','order','nolimit','addConfiguration','AccountId','channel','getDescriptions','FreshsalesField','Subjects','Descriptions','getFields','username','remoteUri','apiKey','substring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xec3a,0x1ec));var _0xaec3=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xec3a[_0x2aa0e7];return _0x1472c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaec3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaec3('0x1'));var rp=require(_0xaec3('0x2'));var moment=require(_0xaec3('0x3'));var BPromise=require(_0xaec3('0x4'));var Mustache=require(_0xaec3('0x5'));var util=require(_0xaec3('0x6'));var path=require('path');var sox=require(_0xaec3('0x7'));var csv=require(_0xaec3('0x8'));var ejs=require(_0xaec3('0x9'));var fs=require('fs');var fs_extra=require(_0xaec3('0xa'));var _=require(_0xaec3('0xb'));var squel=require('squel');var crypto=require(_0xaec3('0xc'));var jsforce=require(_0xaec3('0xd'));var deskjs=require(_0xaec3('0xe'));var toCsv=require(_0xaec3('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaec3('0xf'));var authService=require(_0xaec3('0x10'));var qs=require(_0xaec3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaec3('0x12'));var logger=require('../../config/logger')(_0xaec3('0x13'));var utils=require(_0xaec3('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b95ec,_0x26401a){_0x26401a=_0x26401a||0xcc;return function(_0x409ea4){if(_0x409ea4){return _0x5b95ec['sendStatus'](_0x26401a);}return _0x5b95ec[_0xaec3('0x15')](_0x26401a)['end']();};}function respondWithResult(_0x1f5d67,_0x3a7ec4){_0x3a7ec4=_0x3a7ec4||0xc8;return function(_0x5dc285){if(_0x5dc285){return _0x1f5d67[_0xaec3('0x15')](_0x3a7ec4)['json'](_0x5dc285);}};}function respondWithFilteredResult(_0x540713,_0x3299c4){return function(_0x2c752a){if(_0x2c752a){var _0x5a33e3=typeof _0x3299c4[_0xaec3('0x16')]===_0xaec3('0x17')&&typeof _0x3299c4[_0xaec3('0x18')]==='undefined';var _0x2b6461=_0x2c752a['count'];var _0x167f12=_0x5a33e3?0x0:_0x3299c4[_0xaec3('0x16')];var _0x309d7b=_0x5a33e3?_0x2c752a[_0xaec3('0x19')]:_0x3299c4[_0xaec3('0x16')]+_0x3299c4[_0xaec3('0x18')];var _0x2cadc8;if(_0x309d7b>=_0x2b6461){_0x309d7b=_0x2b6461;_0x2cadc8=0xc8;}else{_0x2cadc8=0xce;}_0x540713['status'](_0x2cadc8);return _0x540713[_0xaec3('0x1a')]('Content-Range',_0x167f12+'-'+_0x309d7b+'/'+_0x2b6461)[_0xaec3('0x1b')](_0x2c752a);}return null;};}function patchUpdates(_0x205861){return function(_0x22c708){try{jsonpatch[_0xaec3('0x1c')](_0x22c708,_0x205861,!![]);}catch(_0x2cdea8){return BPromise['reject'](_0x2cdea8);}return _0x22c708[_0xaec3('0x1d')]();};}function saveUpdates(_0x1e8ad2,_0x24ee25){return function(_0xf8174a){if(_0xf8174a){return _0xf8174a['update'](_0x1e8ad2)[_0xaec3('0x1e')](function(_0xeab123){return _0xeab123;});}return null;};}function removeEntity(_0x404da4,_0x3af4a3){return function(_0x247f62){if(_0x247f62){return _0x247f62['destroy']()[_0xaec3('0x1e')](function(){_0x404da4['status'](0xcc)[_0xaec3('0x1f')]();});}};}function handleEntityNotFound(_0x2ecb93,_0x2e7584){return function(_0x50b7ca){if(!_0x50b7ca){_0x2ecb93['sendStatus'](0x194);}return _0x50b7ca;};}function handleError(_0x34a562,_0x591d99){_0x591d99=_0x591d99||0x1f4;return function(_0x24aff0){logger[_0xaec3('0x20')](_0x24aff0[_0xaec3('0x21')]);if(_0x24aff0[_0xaec3('0x22')]){delete _0x24aff0[_0xaec3('0x22')];}_0x34a562[_0xaec3('0x15')](_0x591d99)['send'](_0x24aff0);};}exports[_0xaec3('0x23')]=function(_0x352bd6,_0x456807){var _0xc86a36={},_0x22ecdb={},_0x1ac08f={'count':0x0,'rows':[]};var _0x18d937=_[_0xaec3('0x24')](db[_0xaec3('0x25')]['rawAttributes'],function(_0x3620ad){return{'name':_0x3620ad[_0xaec3('0x26')],'type':_0x3620ad['type'][_0xaec3('0x27')]};});_0x22ecdb[_0xaec3('0x28')]=_[_0xaec3('0x24')](_0x18d937,_0xaec3('0x22'));_0x22ecdb[_0xaec3('0x29')]=_[_0xaec3('0x2a')](_0x352bd6['query']);_0x22ecdb[_0xaec3('0x2b')]=_['intersection'](_0x22ecdb['model'],_0x22ecdb[_0xaec3('0x29')]);_0xc86a36['attributes']=_[_0xaec3('0x2c')](_0x22ecdb[_0xaec3('0x28')],qs[_0xaec3('0x2d')](_0x352bd6[_0xaec3('0x29')]['fields']));_0xc86a36[_0xaec3('0x2e')]=_0xc86a36[_0xaec3('0x2e')]['length']?_0xc86a36[_0xaec3('0x2e')]:_0x22ecdb[_0xaec3('0x28')];if(!_0x352bd6[_0xaec3('0x29')][_0xaec3('0x2f')]('nolimit')){_0xc86a36['limit']=qs[_0xaec3('0x18')](_0x352bd6[_0xaec3('0x29')][_0xaec3('0x18')]);_0xc86a36[_0xaec3('0x16')]=qs[_0xaec3('0x16')](_0x352bd6['query'][_0xaec3('0x16')]);}_0xc86a36['order']=qs[_0xaec3('0x30')](_0x352bd6[_0xaec3('0x29')][_0xaec3('0x30')]);_0xc86a36[_0xaec3('0x31')]=qs[_0xaec3('0x2b')](_[_0xaec3('0x32')](_0x352bd6[_0xaec3('0x29')],_0x22ecdb['filters']),_0x18d937);if(_0x352bd6['query'][_0xaec3('0x33')]){_0xc86a36[_0xaec3('0x31')]=_['merge'](_0xc86a36[_0xaec3('0x31')],{'$or':_['map'](_0x18d937,function(_0x5c3b76){if(_0x5c3b76[_0xaec3('0x34')]!==_0xaec3('0x35')){var _0x4355e6={};_0x4355e6[_0x5c3b76['name']]={'$like':'%'+_0x352bd6[_0xaec3('0x29')]['filter']+'%'};return _0x4355e6;}})});}_0xc86a36=_[_0xaec3('0x36')]({},_0xc86a36,_0x352bd6[_0xaec3('0x37')]);var _0x3bf1ab={'where':_0xc86a36[_0xaec3('0x31')]};return db[_0xaec3('0x25')][_0xaec3('0x19')](_0x3bf1ab)[_0xaec3('0x1e')](function(_0x274ba6){_0x1ac08f['count']=_0x274ba6;if(_0x352bd6[_0xaec3('0x29')][_0xaec3('0x38')]){_0xc86a36[_0xaec3('0x39')]=[{'all':!![]}];}return db[_0xaec3('0x25')]['findAll'](_0xc86a36);})[_0xaec3('0x1e')](function(_0xef5946){_0x1ac08f['rows']=_0xef5946;return _0x1ac08f;})[_0xaec3('0x1e')](respondWithFilteredResult(_0x456807,_0xc86a36))[_0xaec3('0x3a')](handleError(_0x456807,null));};exports['show']=function(_0x152654,_0x36162e){var _0x3022fd={'raw':![],'where':{'id':_0x152654[_0xaec3('0x3b')]['id']}},_0x10fba6={};_0x10fba6[_0xaec3('0x28')]=_['keys'](db[_0xaec3('0x25')]['rawAttributes']);_0x10fba6[_0xaec3('0x29')]=_[_0xaec3('0x2a')](_0x152654[_0xaec3('0x29')]);_0x10fba6[_0xaec3('0x2b')]=_[_0xaec3('0x2c')](_0x10fba6[_0xaec3('0x28')],_0x10fba6['query']);_0x3022fd[_0xaec3('0x2e')]=_['intersection'](_0x10fba6[_0xaec3('0x28')],qs[_0xaec3('0x2d')](_0x152654[_0xaec3('0x29')][_0xaec3('0x2d')]));_0x3022fd[_0xaec3('0x2e')]=_0x3022fd[_0xaec3('0x2e')][_0xaec3('0x3c')]?_0x3022fd[_0xaec3('0x2e')]:_0x10fba6['model'];if(_0x152654[_0xaec3('0x29')][_0xaec3('0x38')]){_0x3022fd[_0xaec3('0x39')]=[{'all':!![]}];}_0x3022fd=_[_0xaec3('0x36')]({},_0x3022fd,_0x152654[_0xaec3('0x37')]);return db[_0xaec3('0x25')][_0xaec3('0x3d')](_0x3022fd)[_0xaec3('0x1e')](handleEntityNotFound(_0x36162e,null))[_0xaec3('0x1e')](respondWithResult(_0x36162e,null))[_0xaec3('0x3a')](handleError(_0x36162e,null));};exports[_0xaec3('0x3e')]=function(_0x1d9f26,_0x24d0f8){return db[_0xaec3('0x25')][_0xaec3('0x3e')](_0x1d9f26[_0xaec3('0x3f')],{})[_0xaec3('0x1e')](respondWithResult(_0x24d0f8,0xc9))[_0xaec3('0x3a')](handleError(_0x24d0f8,null));};exports[_0xaec3('0x40')]=function(_0x3e5bb2,_0x1aa91e){if(_0x3e5bb2[_0xaec3('0x3f')]['id']){delete _0x3e5bb2[_0xaec3('0x3f')]['id'];}return db[_0xaec3('0x25')][_0xaec3('0x3d')]({'where':{'id':_0x3e5bb2[_0xaec3('0x3b')]['id']}})[_0xaec3('0x1e')](handleEntityNotFound(_0x1aa91e,null))[_0xaec3('0x1e')](saveUpdates(_0x3e5bb2['body'],null))['then'](respondWithResult(_0x1aa91e,null))['catch'](handleError(_0x1aa91e,null));};exports[_0xaec3('0x41')]=function(_0x17584d,_0x1aca90){return db[_0xaec3('0x25')][_0xaec3('0x3d')]({'where':{'id':_0x17584d['params']['id']}})['then'](handleEntityNotFound(_0x1aca90,null))['then'](removeEntity(_0x1aca90,null))[_0xaec3('0x3a')](handleError(_0x1aca90,null));};exports[_0xaec3('0x42')]=function(_0x57f72c,_0x566747,_0x56e128){var _0x267526={};var _0x6cbe0f={};var _0xb783fb;var _0x432d17;return db[_0xaec3('0x25')][_0xaec3('0x43')]({'where':{'id':_0x57f72c['params']['id']}})[_0xaec3('0x1e')](handleEntityNotFound(_0x566747,null))[_0xaec3('0x1e')](function(_0x1c966b){if(_0x1c966b){_0xb783fb=_0x1c966b;_0x6cbe0f[_0xaec3('0x28')]=_[_0xaec3('0x2a')](db[_0xaec3('0x44')][_0xaec3('0x45')]);_0x6cbe0f[_0xaec3('0x29')]=_[_0xaec3('0x2a')](_0x57f72c[_0xaec3('0x29')]);_0x6cbe0f['filters']=_[_0xaec3('0x2c')](_0x6cbe0f[_0xaec3('0x28')],_0x6cbe0f[_0xaec3('0x29')]);_0x267526[_0xaec3('0x2e')]=_[_0xaec3('0x2c')](_0x6cbe0f[_0xaec3('0x28')],qs['fields'](_0x57f72c[_0xaec3('0x29')][_0xaec3('0x2d')]));_0x267526[_0xaec3('0x2e')]=_0x267526[_0xaec3('0x2e')][_0xaec3('0x3c')]?_0x267526[_0xaec3('0x2e')]:_0x6cbe0f[_0xaec3('0x28')];_0x267526[_0xaec3('0x46')]=qs[_0xaec3('0x30')](_0x57f72c[_0xaec3('0x29')]['sort']);_0x267526[_0xaec3('0x31')]=qs[_0xaec3('0x2b')](_['pick'](_0x57f72c['query'],_0x6cbe0f[_0xaec3('0x2b')]));if(_0x57f72c[_0xaec3('0x29')][_0xaec3('0x33')]){_0x267526[_0xaec3('0x31')]=_[_0xaec3('0x36')](_0x267526[_0xaec3('0x31')],{'$or':_['map'](_0x267526[_0xaec3('0x2e')],function(_0x21b2e8){var _0x5d003d={};_0x5d003d[_0x21b2e8]={'$like':'%'+_0x57f72c['query'][_0xaec3('0x33')]+'%'};return _0x5d003d;})});}_0x267526=_[_0xaec3('0x36')]({},_0x267526,_0x57f72c['options']);return _0xb783fb[_0xaec3('0x42')](_0x267526);}})[_0xaec3('0x1e')](function(_0x1679fc){if(_0x1679fc){_0x432d17=_0x1679fc['length'];if(!_0x57f72c['query']['hasOwnProperty'](_0xaec3('0x47'))){_0x267526[_0xaec3('0x18')]=qs[_0xaec3('0x18')](_0x57f72c['query'][_0xaec3('0x18')]);_0x267526[_0xaec3('0x16')]=qs[_0xaec3('0x16')](_0x57f72c['query']['offset']);}return _0xb783fb[_0xaec3('0x42')](_0x267526);}})[_0xaec3('0x1e')](function(_0x10571e){if(_0x10571e){return _0x10571e?{'count':_0x432d17,'rows':_0x10571e}:null;}})[_0xaec3('0x1e')](respondWithResult(_0x566747,null))[_0xaec3('0x3a')](handleError(_0x566747,null));};exports[_0xaec3('0x48')]=function(_0x1e561a,_0xfb6a57,_0x57750f){if(_0x1e561a[_0xaec3('0x3f')]['id']){delete _0x1e561a['body']['id'];}return db['FreshsalesAccount'][_0xaec3('0x43')]({'where':{'id':_0x1e561a['params']['id']}})['then'](handleEntityNotFound(_0xfb6a57,null))['then'](function(_0x3c8bed){if(_0x3c8bed){_0x1e561a[_0xaec3('0x3f')][_0xaec3('0x49')]=_0x3c8bed['id'];_0x1e561a[_0xaec3('0x3f')]['Subjects']=integrations['getSubjects'](_0x1e561a[_0xaec3('0x3f')][_0xaec3('0x4a')],_0x1e561a[_0xaec3('0x3f')][_0xaec3('0x34')]);_0x1e561a[_0xaec3('0x3f')]['Descriptions']=integrations[_0xaec3('0x4b')](_0x1e561a[_0xaec3('0x3f')][_0xaec3('0x4a')],_0x1e561a[_0xaec3('0x3f')][_0xaec3('0x34')]);return db[_0xaec3('0x44')][_0xaec3('0x3e')](_0x1e561a['body'],{'include':[{'model':db[_0xaec3('0x4c')],'as':_0xaec3('0x4d')},{'model':db[_0xaec3('0x4c')],'as':_0xaec3('0x4e')}]});}return null;})[_0xaec3('0x1e')](respondWithResult(_0xfb6a57,null))[_0xaec3('0x3a')](handleError(_0xfb6a57,null));};exports[_0xaec3('0x4f')]=function(_0x2e5602,_0x10a119,_0x24cc6e){var _0x20ccff='';var _0x40fd73='';return db[_0xaec3('0x25')][_0xaec3('0x43')]({'where':{'id':_0x2e5602['params']['id']},'attributes':['id',_0xaec3('0x50'),_0xaec3('0x51'),_0xaec3('0x52')]})[_0xaec3('0x1e')](handleEntityNotFound(_0x10a119,null))[_0xaec3('0x1e')](function(_0x5a57fb){if(_0x5a57fb){_0x40fd73=_0x5a57fb[_0xaec3('0x50')];_0x20ccff=_0x5a57fb['remoteUri'];var _0x248bd6=_0x5a57fb[_0xaec3('0x51')]['slice'](-0x1);if(_0x248bd6==='/'){_0x20ccff=_0x20ccff[_0xaec3('0x53')](0x0,_0x20ccff[_0xaec3('0x54')](_0x248bd6));}return rp({'method':_0xaec3('0x55'),'uri':util[_0xaec3('0x56')](_0xaec3('0x57'),_0x20ccff,_0xaec3('0x58')),'headers':{'Authorization':_0xaec3('0x59')+_0x5a57fb[_0xaec3('0x52')]},'json':!![]});}})['then'](function(_0x201082){if(_0x201082){var _0x30e218=_0x201082['users'];var _0x6e55f3=![];var _0x262522=null;for(_0x262522=0x0;_0x262522<_0x30e218[_0xaec3('0x3c')];_0x262522++){if(_0x30e218[_0x262522][_0xaec3('0x5a')]===_0x40fd73){_0x6e55f3=!![];}}if(_0x6e55f3){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xaec3('0x1e')](respondWithResult(_0x10a119,null))['catch'](function(_0x5e87c8){var _0x3dfe7a=_0x2e5602['query'][_0xaec3('0x5b')]?0x1f4:_0x5e87c8[_0xaec3('0x5c')]||0x1f4;logger['error'](_0xaec3('0x5d'),_0xaec3('0x4f'),_0x3dfe7a,JSON[_0xaec3('0x5e')](_0x5e87c8));delete _0x5e87c8['name'];if(_0x3dfe7a===0x191){_0x3dfe7a=0x190;}_0x10a119[_0xaec3('0x15')](_0x3dfe7a)[_0xaec3('0x5f')](_0x2e5602['query'][_0xaec3('0x5b')]?{'message':'Wrong\x20credentials','statusCode':_0x5e87c8[_0xaec3('0x5c')]}:_0x5e87c8);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 4d7f3e4..a56c1a2 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 _0x01d9=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x50caca,_0x212602){var _0x1abd60=function(_0x1d71aa){while(--_0x1d71aa){_0x50caca['push'](_0x50caca['shift']());}};_0x1abd60(++_0x212602);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));var integrations=require(_0x901d('0xa'));module['exports']=function(_0x1e5d7d,_0x6c9ac8){return _0x1e5d7d[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','exports','int_freshsales_accounts'];(function(_0x82def4,_0x4ac110){var _0x4117fc=function(_0x1b398b){while(--_0x1b398b){_0x82def4['push'](_0x82def4['shift']());}};_0x4117fc(++_0x4ac110);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x74745d,_0x177606){_0x74745d=_0x74745d-0x0;var _0x174ab3=_0xfdbd[_0x74745d];return _0x174ab3;};'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']('FreshsalesAccount',attributes,{'tableName':_0xdfdb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 1acf9e1..cced0e2 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 _0xc4aa=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowFreshsalesAccount','lodash','util','moment'];(function(_0x161020,_0x467abe){var _0x360356=function(_0x56a2ec){while(--_0x56a2ec){_0x161020['push'](_0x161020['shift']());}};_0x360356(++_0x467abe);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'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')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')]({'raw':_0x28e304[_0xac4a('0x18')]?_0x28e304['options'][_0xac4a('0x19')]===undefined?!![]:![]:!![],'where':_0x28e304[_0xac4a('0x18')]?_0x28e304[_0xac4a('0x18')][_0xac4a('0x1a')]||null:null,'attributes':_0x28e304[_0xac4a('0x18')]?_0x28e304[_0xac4a('0x18')][_0xac4a('0x1b')]||null:null,'limit':_0x28e304[_0xac4a('0x18')]?_0x28e304['options'][_0xac4a('0x1c')]||null:null,'include':_0x28e304[_0xac4a('0x18')]?_0x28e304['options'][_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x28e304[_0xac4a('0x18')][_0xac4a('0x1d')],function(_0x4d2d6c){return{'model':db[_0x4d2d6c[_0xac4a('0x1f')]],'as':_0x4d2d6c['as'],'attributes':_0x4d2d6c[_0xac4a('0x1b')],'include':_0x4d2d6c[_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x4d2d6c[_0xac4a('0x1d')],function(_0x2b0dc2){return{'model':db[_0x2b0dc2[_0xac4a('0x1f')]],'as':_0x2b0dc2['as'],'attributes':_0x2b0dc2[_0xac4a('0x1b')],'include':_0x2b0dc2[_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x2b0dc2[_0xac4a('0x1d')],function(_0x215a31){return{'model':db[_0x215a31[_0xac4a('0x1f')]],'as':_0x215a31['as'],'attributes':_0x215a31[_0xac4a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xac4a('0xc')](function(_0x20202c){logger['info'](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON[_0xac4a('0x20')](_0x20202c));_0x546c5d(_0x20202c);})[_0xac4a('0x14')](function(_0x4a5a9e){logger['error'](_0xac4a('0x15'),_0x4a5a9e[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x4a5a9e['message']));});});};exports['ShowFreshsalesAccount']=function(_0x355755){var _0x2896bc=this;return new Promise(function(_0x228629,_0x432066){return db[_0xac4a('0x16')]['find']({'raw':_0x355755[_0xac4a('0x18')]?_0x355755['options'][_0xac4a('0x19')]===undefined?!![]:![]:!![],'where':_0x355755['options']?_0x355755[_0xac4a('0x18')][_0xac4a('0x1a')]||null:null,'attributes':_0x355755[_0xac4a('0x18')]?_0x355755[_0xac4a('0x18')][_0xac4a('0x1b')]||null:null,'include':_0x355755[_0xac4a('0x18')]?_0x355755[_0xac4a('0x18')][_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x355755[_0xac4a('0x18')][_0xac4a('0x1d')],function(_0x1634df){return{'model':db[_0x1634df[_0xac4a('0x1f')]],'as':_0x1634df['as'],'attributes':_0x1634df[_0xac4a('0x1b')],'include':_0x1634df['include']?_[_0xac4a('0x1e')](_0x1634df[_0xac4a('0x1d')],function(_0x5a4e2b){return{'model':db[_0x5a4e2b[_0xac4a('0x1f')]],'as':_0x5a4e2b['as'],'attributes':_0x5a4e2b[_0xac4a('0x1b')],'include':_0x5a4e2b['include']?_['map'](_0x5a4e2b[_0xac4a('0x1d')],function(_0x1ba096){return{'model':db[_0x1ba096[_0xac4a('0x1f')]],'as':_0x1ba096['as'],'attributes':_0x1ba096[_0xac4a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x453d02){logger[_0xac4a('0x13')]('ShowFreshsalesAccount',_0x355755);logger[_0xac4a('0xf')](_0xac4a('0x21'),_0x355755,JSON[_0xac4a('0x20')](_0x453d02));_0x228629(_0x453d02);})['catch'](function(_0x121328){logger[_0xac4a('0x10')](_0xac4a('0x21'),_0x121328['message'],_0x355755);_0x432066(_0x2896bc[_0xac4a('0x10')](0x1f4,_0x121328[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x81c6=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','limit','include','map','model','attributes','ShowFreshsalesAccount','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x3fd49f,_0x2986e5){var _0x1aae93=function(_0x456ea4){while(--_0x456ea4){_0x3fd49f['push'](_0x3fd49f['shift']());}};_0x1aae93(++_0x2986e5);}(_0x81c6,0x1d5));var _0x681c=function(_0x15cae3,_0x458cb9){_0x15cae3=_0x15cae3-0x0;var _0x20596f=_0x81c6[_0x15cae3];return _0x20596f;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45331,_0xdc57a5,_0x5624d7){return new BPromise(function(_0x5b5f22,_0x1750e2){return client[_0x681c('0x8')](_0x45331,_0x5624d7)[_0x681c('0x9')](function(_0x5de78e){logger['info'](_0x681c('0xa'),_0xdc57a5,'request\x20sent');logger[_0x681c('0xb')](_0x681c('0xc'),_0xdc57a5,_0x681c('0xd'),JSON[_0x681c('0xe')](_0x5de78e));if(_0x5de78e['error']){if(_0x5de78e['error'][_0x681c('0xf')]===0x1f4){logger[_0x681c('0x10')](_0x681c('0xa'),_0xdc57a5,_0x5de78e['error'][_0x681c('0x11')]);return _0x1750e2(_0x5de78e['error'][_0x681c('0x11')]);}logger['error'](_0x681c('0xa'),_0xdc57a5,_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);return _0x5b5f22(_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);}else{logger[_0x681c('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0xdc57a5,_0x681c('0xd'));_0x5b5f22(_0x5de78e[_0x681c('0x13')][_0x681c('0x11')]);}})[_0x681c('0x14')](function(_0x2fce11){logger[_0x681c('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0xdc57a5,_0x2fce11);_0x1750e2(_0x2fce11);});});}exports[_0x681c('0x15')]=function(_0x42f506){var _0x4a9192=this;return new Promise(function(_0x42304f,_0x5b03fd){return db[_0x681c('0x16')][_0x681c('0x17')]({'raw':_0x42f506['options']?_0x42f506[_0x681c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')]['attributes']||null:null,'limit':_0x42f506['options']?_0x42f506['options'][_0x681c('0x1a')]||null:null,'include':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x42f506[_0x681c('0x18')][_0x681c('0x1b')],function(_0x3d0297){return{'model':db[_0x3d0297[_0x681c('0x1d')]],'as':_0x3d0297['as'],'attributes':_0x3d0297[_0x681c('0x1e')],'include':_0x3d0297[_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x3d0297[_0x681c('0x1b')],function(_0x218410){return{'model':db[_0x218410[_0x681c('0x1d')]],'as':_0x218410['as'],'attributes':_0x218410[_0x681c('0x1e')],'include':_0x218410['include']?_[_0x681c('0x1c')](_0x218410['include'],function(_0x5f8d64){return{'model':db[_0x5f8d64['model']],'as':_0x5f8d64['as'],'attributes':_0x5f8d64['attributes']};}):[]};}):[]};}):[]:[]})[_0x681c('0x9')](function(_0x17ea7c){logger[_0x681c('0x12')](_0x681c('0x15'),_0x42f506);logger['debug'](_0x681c('0x15'),_0x42f506,JSON[_0x681c('0xe')](_0x17ea7c));_0x42304f(_0x17ea7c);})[_0x681c('0x14')](function(_0x936fce){logger[_0x681c('0x10')](_0x681c('0x15'),_0x936fce[_0x681c('0x11')],_0x42f506);_0x5b03fd(_0x4a9192['error'](0x1f4,_0x936fce[_0x681c('0x11')]));});});};exports[_0x681c('0x1f')]=function(_0x2e783d){var _0x4af6aa=this;return new Promise(function(_0x385b14,_0x2179cd){return db[_0x681c('0x16')]['find']({'raw':_0x2e783d[_0x681c('0x18')]?_0x2e783d['options']['raw']===undefined?!![]:![]:!![],'where':_0x2e783d[_0x681c('0x18')]?_0x2e783d[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x2e783d['options']?_0x2e783d[_0x681c('0x18')]['attributes']||null:null,'include':_0x2e783d[_0x681c('0x18')]?_0x2e783d['options']['include']?_['map'](_0x2e783d[_0x681c('0x18')][_0x681c('0x1b')],function(_0x5a349a){return{'model':db[_0x5a349a[_0x681c('0x1d')]],'as':_0x5a349a['as'],'attributes':_0x5a349a['attributes'],'include':_0x5a349a['include']?_[_0x681c('0x1c')](_0x5a349a['include'],function(_0x35991d){return{'model':db[_0x35991d[_0x681c('0x1d')]],'as':_0x35991d['as'],'attributes':_0x35991d[_0x681c('0x1e')],'include':_0x35991d['include']?_['map'](_0x35991d[_0x681c('0x1b')],function(_0x4545ff){return{'model':db[_0x4545ff['model']],'as':_0x4545ff['as'],'attributes':_0x4545ff[_0x681c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x681c('0x9')](function(_0x302dab){logger['info'](_0x681c('0x1f'),_0x2e783d);logger[_0x681c('0xb')]('ShowFreshsalesAccount',_0x2e783d,JSON[_0x681c('0xe')](_0x302dab));_0x385b14(_0x302dab);})[_0x681c('0x14')](function(_0x83953c){logger[_0x681c('0x10')](_0x681c('0x1f'),_0x83953c['message'],_0x2e783d);_0x2179cd(_0x4af6aa['error'](0x1f4,_0x83953c[_0x681c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 0e1f353..5d8b55f 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 _0xa704=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put','destroy','exports'];(function(_0x50fdc5,_0x1797f0){var _0x4b0c78=function(_0xedf9f6){while(--_0xedf9f6){_0x50fdc5['push'](_0x50fdc5['shift']());}};_0x4b0c78(++_0x1797f0);}(_0xa704,0x177));var _0x4a70=function(_0x51356c,_0x501f0c){_0x51356c=_0x51356c-0x0;var _0x2ebe29=_0xa704[_0x51356c];return _0x2ebe29;};'use strict';var multer=require(_0x4a70('0x0'));var util=require(_0x4a70('0x1'));var path=require(_0x4a70('0x2'));var timeout=require(_0x4a70('0x3'));var express=require(_0x4a70('0x4'));var router=express[_0x4a70('0x5')]();var fs_extra=require(_0x4a70('0x6'));var auth=require(_0x4a70('0x7'));var interaction=require(_0x4a70('0x8'));var config=require(_0x4a70('0x9'));var controller=require(_0x4a70('0xa'));router[_0x4a70('0xb')]('/',auth[_0x4a70('0xc')](),controller[_0x4a70('0xd')]);router[_0x4a70('0xb')](_0x4a70('0xe'),auth['isAuthenticated'](),controller[_0x4a70('0xf')]);router[_0x4a70('0xb')]('/:id/subjects',auth[_0x4a70('0xc')](),controller[_0x4a70('0x10')]);router['get']('/:id/descriptions',auth[_0x4a70('0xc')](),controller[_0x4a70('0x11')]);router[_0x4a70('0xb')](_0x4a70('0x12'),auth[_0x4a70('0xc')](),controller[_0x4a70('0x13')]);router[_0x4a70('0x14')]('/',auth['isAuthenticated'](),controller[_0x4a70('0x15')]);router[_0x4a70('0x16')](_0x4a70('0xe'),auth[_0x4a70('0xc')](),controller['update']);router['delete'](_0x4a70('0xe'),auth['isAuthenticated'](),controller[_0x4a70('0x17')]);module[_0x4a70('0x18')]=router; \ No newline at end of file +var _0x72df=['show','getSubjects','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id'];(function(_0x579099,_0x227462){var _0x32effb=function(_0x14d0d9){while(--_0x14d0d9){_0x579099['push'](_0x579099['shift']());}};_0x32effb(++_0x227462);}(_0x72df,0x170));var _0xf72d=function(_0x5c2aeb,_0x4198f2){_0x5c2aeb=_0x5c2aeb-0x0;var _0x184716=_0x72df[_0x5c2aeb];return _0x184716;};'use strict';var multer=require(_0xf72d('0x0'));var util=require(_0xf72d('0x1'));var path=require('path');var timeout=require(_0xf72d('0x2'));var express=require(_0xf72d('0x3'));var router=express[_0xf72d('0x4')]();var fs_extra=require(_0xf72d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf72d('0x6'));var controller=require(_0xf72d('0x7'));router['get']('/',auth[_0xf72d('0x8')](),controller[_0xf72d('0x9')]);router[_0xf72d('0xa')](_0xf72d('0xb'),auth[_0xf72d('0x8')](),controller[_0xf72d('0xc')]);router['get']('/:id/subjects',auth[_0xf72d('0x8')](),controller[_0xf72d('0xd')]);router[_0xf72d('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xf72d('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xf72d('0xe')]('/',auth[_0xf72d('0x8')](),controller[_0xf72d('0xf')]);router[_0xf72d('0x10')](_0xf72d('0xb'),auth[_0xf72d('0x8')](),controller[_0xf72d('0x11')]);router[_0xf72d('0x12')](_0xf72d('0xb'),auth[_0xf72d('0x8')](),controller['destroy']);module[_0xf72d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index a2b6c8e..a1cba4f 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 _0x41bb=['STRING','exports'];(function(_0x2291cb,_0x3d2b79){var _0x53b5d2=function(_0x300c99){while(--_0x300c99){_0x2291cb['push'](_0x2291cb['shift']());}};_0x53b5d2(++_0x3d2b79);}(_0x41bb,0x1bd));var _0xb41b=function(_0x385b10,_0x4fcb6e){_0x385b10=_0x385b10-0x0;var _0x7164dd=_0x41bb[_0x385b10];return _0x7164dd;};'use strict';var Sequelize=require('sequelize');module[_0xb41b('0x0')]={'name':{'type':Sequelize[_0xb41b('0x1')]},'description':{'type':Sequelize[_0xb41b('0x1')]}}; \ No newline at end of file +var _0x3bc3=['STRING'];(function(_0x22bc06,_0x27f48a){var _0x2e4b8b=function(_0x37307d){while(--_0x37307d){_0x22bc06['push'](_0x22bc06['shift']());}};_0x2e4b8b(++_0x27f48a);}(_0x3bc3,0x15f));var _0x33bc=function(_0x228876,_0x2873f8){_0x228876=_0x228876-0x0;var _0x35a696=_0x3bc3[_0x228876];return _0x35a696;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x33bc('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index ce6a465..6f2bf7d 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 _0xbbb1=['then','end','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','create','body','find','destroy','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x33c797,_0x430c30){var _0x514ff7=function(_0x17920c){while(--_0x17920c){_0x33c797['push'](_0x33c797['shift']());}};_0x514ff7(++_0x430c30);}(_0xbbb1,0x11e));var _0x1bbb=function(_0x5210ac,_0xcb3f25){_0x5210ac=_0x5210ac-0x0;var _0x499f03=_0xbbb1[_0x5210ac];return _0x499f03;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1bbb('0x0'));var zipdir=require(_0x1bbb('0x1'));var jsonpatch=require(_0x1bbb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1bbb('0x3'));var Mustache=require(_0x1bbb('0x4'));var util=require(_0x1bbb('0x5'));var path=require(_0x1bbb('0x6'));var sox=require(_0x1bbb('0x7'));var csv=require(_0x1bbb('0x8'));var ejs=require(_0x1bbb('0x9'));var fs=require('fs');var fs_extra=require(_0x1bbb('0xa'));var _=require(_0x1bbb('0xb'));var squel=require('squel');var crypto=require(_0x1bbb('0xc'));var jsforce=require(_0x1bbb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1bbb('0x8'));var querystring=require(_0x1bbb('0xe'));var Papa=require(_0x1bbb('0xf'));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(_0x1bbb('0x10'));var logger=require('../../config/logger')(_0x1bbb('0x11'));var utils=require('../../config/utils');var config=require(_0x1bbb('0x12'));var licenseUtil=require(_0x1bbb('0x13'));var db=require(_0x1bbb('0x14'))['db'];function respondWithStatusCode(_0x2681e0,_0xa43249){_0xa43249=_0xa43249||0xcc;return function(_0x30d8dc){if(_0x30d8dc){return _0x2681e0[_0x1bbb('0x15')](_0xa43249);}return _0x2681e0[_0x1bbb('0x16')](_0xa43249)['end']();};}function respondWithResult(_0x528523,_0x40abc0){_0x40abc0=_0x40abc0||0xc8;return function(_0x4c63af){if(_0x4c63af){return _0x528523[_0x1bbb('0x16')](_0x40abc0)[_0x1bbb('0x17')](_0x4c63af);}};}function respondWithFilteredResult(_0x4d5d41,_0x394ae0){return function(_0x1ba155){if(_0x1ba155){var _0x5887df=typeof _0x394ae0[_0x1bbb('0x18')]==='undefined'&&typeof _0x394ae0['limit']===_0x1bbb('0x19');var _0x2555c1=_0x1ba155[_0x1bbb('0x1a')];var _0x49bff6=_0x5887df?0x0:_0x394ae0[_0x1bbb('0x18')];var _0x34be1c=_0x5887df?_0x1ba155[_0x1bbb('0x1a')]:_0x394ae0[_0x1bbb('0x18')]+_0x394ae0[_0x1bbb('0x1b')];var _0x43f1c8;if(_0x34be1c>=_0x2555c1){_0x34be1c=_0x2555c1;_0x43f1c8=0xc8;}else{_0x43f1c8=0xce;}_0x4d5d41[_0x1bbb('0x16')](_0x43f1c8);return _0x4d5d41[_0x1bbb('0x1c')](_0x1bbb('0x1d'),_0x49bff6+'-'+_0x34be1c+'/'+_0x2555c1)[_0x1bbb('0x17')](_0x1ba155);}return null;};}function patchUpdates(_0xa59533){return function(_0x40273b){try{jsonpatch[_0x1bbb('0x1e')](_0x40273b,_0xa59533,!![]);}catch(_0x124f06){return BPromise[_0x1bbb('0x1f')](_0x124f06);}return _0x40273b[_0x1bbb('0x20')]();};}function saveUpdates(_0x2b2b35,_0x29a905){return function(_0x2edbda){if(_0x2edbda){return _0x2edbda[_0x1bbb('0x21')](_0x2b2b35)[_0x1bbb('0x22')](function(_0x3a6a93){return _0x3a6a93;});}return null;};}function removeEntity(_0xdd3570,_0x513bd3){return function(_0x1c34e0){if(_0x1c34e0){return _0x1c34e0['destroy']()['then'](function(){_0xdd3570[_0x1bbb('0x16')](0xcc)[_0x1bbb('0x23')]();});}};}function handleEntityNotFound(_0x30e2b9,_0x3887e2){return function(_0xae56b2){if(!_0xae56b2){_0x30e2b9[_0x1bbb('0x15')](0x194);}return _0xae56b2;};}function handleError(_0x41eded,_0x45daaa){_0x45daaa=_0x45daaa||0x1f4;return function(_0x112907){logger[_0x1bbb('0x24')](_0x112907[_0x1bbb('0x25')]);if(_0x112907[_0x1bbb('0x26')]){delete _0x112907[_0x1bbb('0x26')];}_0x41eded[_0x1bbb('0x16')](_0x45daaa)[_0x1bbb('0x27')](_0x112907);};}exports[_0x1bbb('0x28')]=function(_0x34ca73,_0x467c7a){var _0x134245={},_0x596677={},_0x564180={'count':0x0,'rows':[]};var _0x524fba=_[_0x1bbb('0x29')](db[_0x1bbb('0x2a')][_0x1bbb('0x2b')],function(_0x3911fc){return{'name':_0x3911fc[_0x1bbb('0x2c')],'type':_0x3911fc[_0x1bbb('0x2d')][_0x1bbb('0x2e')]};});_0x596677['model']=_['map'](_0x524fba,'name');_0x596677[_0x1bbb('0x2f')]=_['keys'](_0x34ca73[_0x1bbb('0x2f')]);_0x596677[_0x1bbb('0x30')]=_['intersection'](_0x596677[_0x1bbb('0x31')],_0x596677[_0x1bbb('0x2f')]);_0x134245[_0x1bbb('0x32')]=_[_0x1bbb('0x33')](_0x596677['model'],qs['fields'](_0x34ca73[_0x1bbb('0x2f')][_0x1bbb('0x34')]));_0x134245[_0x1bbb('0x32')]=_0x134245['attributes'][_0x1bbb('0x35')]?_0x134245[_0x1bbb('0x32')]:_0x596677[_0x1bbb('0x31')];if(!_0x34ca73['query'][_0x1bbb('0x36')](_0x1bbb('0x37'))){_0x134245[_0x1bbb('0x1b')]=qs[_0x1bbb('0x1b')](_0x34ca73[_0x1bbb('0x2f')][_0x1bbb('0x1b')]);_0x134245[_0x1bbb('0x18')]=qs['offset'](_0x34ca73['query'][_0x1bbb('0x18')]);}_0x134245[_0x1bbb('0x38')]=qs['sort'](_0x34ca73[_0x1bbb('0x2f')][_0x1bbb('0x39')]);_0x134245[_0x1bbb('0x3a')]=qs[_0x1bbb('0x30')](_[_0x1bbb('0x3b')](_0x34ca73[_0x1bbb('0x2f')],_0x596677[_0x1bbb('0x30')]),_0x524fba);if(_0x34ca73['query'][_0x1bbb('0x3c')]){_0x134245[_0x1bbb('0x3a')]=_[_0x1bbb('0x3d')](_0x134245[_0x1bbb('0x3a')],{'$or':_[_0x1bbb('0x29')](_0x524fba,function(_0x469b0f){if(_0x469b0f['type']!==_0x1bbb('0x3e')){var _0x86fd18={};_0x86fd18[_0x469b0f['name']]={'$like':'%'+_0x34ca73[_0x1bbb('0x2f')][_0x1bbb('0x3c')]+'%'};return _0x86fd18;}})});}_0x134245=_[_0x1bbb('0x3d')]({},_0x134245,_0x34ca73[_0x1bbb('0x3f')]);var _0x1d42e4={'where':_0x134245['where']};return db[_0x1bbb('0x2a')]['count'](_0x1d42e4)[_0x1bbb('0x22')](function(_0x110722){_0x564180[_0x1bbb('0x1a')]=_0x110722;if(_0x34ca73[_0x1bbb('0x2f')][_0x1bbb('0x40')]){_0x134245['include']=[{'all':!![]}];}return db[_0x1bbb('0x2a')][_0x1bbb('0x41')](_0x134245);})[_0x1bbb('0x22')](function(_0x5e7869){_0x564180['rows']=_0x5e7869;return _0x564180;})[_0x1bbb('0x22')](respondWithFilteredResult(_0x467c7a,_0x134245))[_0x1bbb('0x42')](handleError(_0x467c7a,null));};exports[_0x1bbb('0x43')]=function(_0x4252d0,_0x345cef){var _0x29b1d8={'raw':![],'where':{'id':_0x4252d0[_0x1bbb('0x44')]['id']}},_0xa6f49d={};_0xa6f49d[_0x1bbb('0x31')]=_[_0x1bbb('0x45')](db[_0x1bbb('0x2a')][_0x1bbb('0x2b')]);_0xa6f49d[_0x1bbb('0x2f')]=_[_0x1bbb('0x45')](_0x4252d0[_0x1bbb('0x2f')]);_0xa6f49d['filters']=_[_0x1bbb('0x33')](_0xa6f49d[_0x1bbb('0x31')],_0xa6f49d['query']);_0x29b1d8['attributes']=_[_0x1bbb('0x33')](_0xa6f49d[_0x1bbb('0x31')],qs[_0x1bbb('0x34')](_0x4252d0[_0x1bbb('0x2f')][_0x1bbb('0x34')]));_0x29b1d8[_0x1bbb('0x32')]=_0x29b1d8[_0x1bbb('0x32')]['length']?_0x29b1d8['attributes']:_0xa6f49d['model'];if(_0x4252d0[_0x1bbb('0x2f')]['includeAll']){_0x29b1d8[_0x1bbb('0x46')]=[{'all':!![]}];}_0x29b1d8=_[_0x1bbb('0x3d')]({},_0x29b1d8,_0x4252d0['options']);return db['FreshsalesConfiguration']['find'](_0x29b1d8)[_0x1bbb('0x22')](handleEntityNotFound(_0x345cef,null))[_0x1bbb('0x22')](respondWithResult(_0x345cef,null))[_0x1bbb('0x42')](handleError(_0x345cef,null));};exports[_0x1bbb('0x47')]=function(_0x59dbae,_0x2b7613){return db[_0x1bbb('0x2a')]['create'](_0x59dbae['body'],{})[_0x1bbb('0x22')](respondWithResult(_0x2b7613,0xc9))[_0x1bbb('0x42')](handleError(_0x2b7613,null));};exports[_0x1bbb('0x21')]=function(_0x413df6,_0x51195c){if(_0x413df6[_0x1bbb('0x48')]['id']){delete _0x413df6[_0x1bbb('0x48')]['id'];}return db[_0x1bbb('0x2a')][_0x1bbb('0x49')]({'where':{'id':_0x413df6[_0x1bbb('0x44')]['id']}})[_0x1bbb('0x22')](handleEntityNotFound(_0x51195c,null))[_0x1bbb('0x22')](saveUpdates(_0x413df6[_0x1bbb('0x48')],null))[_0x1bbb('0x22')](respondWithResult(_0x51195c,null))['catch'](handleError(_0x51195c,null));};exports[_0x1bbb('0x4a')]=function(_0x259883,_0xf927ab){return db[_0x1bbb('0x2a')][_0x1bbb('0x49')]({'where':{'id':_0x259883['params']['id']}})[_0x1bbb('0x22')](handleEntityNotFound(_0xf927ab,null))[_0x1bbb('0x22')](removeEntity(_0xf927ab,null))[_0x1bbb('0x42')](handleError(_0xf927ab,null));};exports[_0x1bbb('0x4b')]=function(_0x4ccd31,_0x1748f0,_0x8e65e7){var _0x18680d={};var _0x25eefa={};var _0x5f2ddd;var _0x379f8a;return db[_0x1bbb('0x2a')][_0x1bbb('0x4c')]({'where':{'id':_0x4ccd31[_0x1bbb('0x44')]['id']}})[_0x1bbb('0x22')](handleEntityNotFound(_0x1748f0,null))[_0x1bbb('0x22')](function(_0x505e20){if(_0x505e20){_0x5f2ddd=_0x505e20;_0x25eefa[_0x1bbb('0x31')]=_[_0x1bbb('0x45')](db[_0x1bbb('0x4d')][_0x1bbb('0x2b')]);_0x25eefa[_0x1bbb('0x2f')]=_[_0x1bbb('0x45')](_0x4ccd31[_0x1bbb('0x2f')]);_0x25eefa[_0x1bbb('0x30')]=_[_0x1bbb('0x33')](_0x25eefa[_0x1bbb('0x31')],_0x25eefa[_0x1bbb('0x2f')]);_0x18680d[_0x1bbb('0x32')]=_[_0x1bbb('0x33')](_0x25eefa[_0x1bbb('0x31')],qs[_0x1bbb('0x34')](_0x4ccd31['query']['fields']));_0x18680d[_0x1bbb('0x32')]=_0x18680d[_0x1bbb('0x32')][_0x1bbb('0x35')]?_0x18680d[_0x1bbb('0x32')]:_0x25eefa[_0x1bbb('0x31')];_0x18680d[_0x1bbb('0x38')]=qs[_0x1bbb('0x39')](_0x4ccd31[_0x1bbb('0x2f')][_0x1bbb('0x39')]);_0x18680d[_0x1bbb('0x3a')]=qs[_0x1bbb('0x30')](_[_0x1bbb('0x3b')](_0x4ccd31[_0x1bbb('0x2f')],_0x25eefa[_0x1bbb('0x30')]));if(_0x4ccd31[_0x1bbb('0x2f')][_0x1bbb('0x3c')]){_0x18680d['where']=_[_0x1bbb('0x3d')](_0x18680d['where'],{'$or':_[_0x1bbb('0x29')](_0x18680d['attributes'],function(_0x1ef2b6){var _0x4f2078={};_0x4f2078[_0x1ef2b6]={'$like':'%'+_0x4ccd31[_0x1bbb('0x2f')][_0x1bbb('0x3c')]+'%'};return _0x4f2078;})});}_0x18680d=_[_0x1bbb('0x3d')]({},_0x18680d,_0x4ccd31[_0x1bbb('0x3f')]);return _0x5f2ddd[_0x1bbb('0x4b')](_0x18680d);}})['then'](function(_0x5e8598){if(_0x5e8598){_0x379f8a=_0x5e8598['length'];if(!_0x4ccd31['query'][_0x1bbb('0x36')](_0x1bbb('0x37'))){_0x18680d['limit']=qs[_0x1bbb('0x1b')](_0x4ccd31[_0x1bbb('0x2f')]['limit']);_0x18680d[_0x1bbb('0x18')]=qs[_0x1bbb('0x18')](_0x4ccd31['query'][_0x1bbb('0x18')]);}return _0x5f2ddd['getSubjects'](_0x18680d);}})[_0x1bbb('0x22')](function(_0x5bb058){if(_0x5bb058){return _0x5bb058?{'count':_0x379f8a,'rows':_0x5bb058}:null;}})['then'](respondWithResult(_0x1748f0,null))[_0x1bbb('0x42')](handleError(_0x1748f0,null));};exports['getDescriptions']=function(_0x5a3e73,_0x11b2cb,_0x345068){var _0x42139c={};var _0xdc7a10={};var _0x48b72c;var _0x4680d3;return db[_0x1bbb('0x2a')][_0x1bbb('0x4c')]({'where':{'id':_0x5a3e73['params']['id']}})[_0x1bbb('0x22')](handleEntityNotFound(_0x11b2cb,null))[_0x1bbb('0x22')](function(_0x4393d8){if(_0x4393d8){_0x48b72c=_0x4393d8;_0xdc7a10[_0x1bbb('0x31')]=_['keys'](db[_0x1bbb('0x4d')][_0x1bbb('0x2b')]);_0xdc7a10[_0x1bbb('0x2f')]=_['keys'](_0x5a3e73[_0x1bbb('0x2f')]);_0xdc7a10[_0x1bbb('0x30')]=_['intersection'](_0xdc7a10[_0x1bbb('0x31')],_0xdc7a10[_0x1bbb('0x2f')]);_0x42139c[_0x1bbb('0x32')]=_['intersection'](_0xdc7a10[_0x1bbb('0x31')],qs[_0x1bbb('0x34')](_0x5a3e73['query'][_0x1bbb('0x34')]));_0x42139c[_0x1bbb('0x32')]=_0x42139c[_0x1bbb('0x32')]['length']?_0x42139c[_0x1bbb('0x32')]:_0xdc7a10[_0x1bbb('0x31')];_0x42139c[_0x1bbb('0x38')]=qs[_0x1bbb('0x39')](_0x5a3e73[_0x1bbb('0x2f')][_0x1bbb('0x39')]);_0x42139c[_0x1bbb('0x3a')]=qs[_0x1bbb('0x30')](_[_0x1bbb('0x3b')](_0x5a3e73[_0x1bbb('0x2f')],_0xdc7a10[_0x1bbb('0x30')]));if(_0x5a3e73[_0x1bbb('0x2f')][_0x1bbb('0x3c')]){_0x42139c[_0x1bbb('0x3a')]=_['merge'](_0x42139c[_0x1bbb('0x3a')],{'$or':_[_0x1bbb('0x29')](_0x42139c[_0x1bbb('0x32')],function(_0x40540c){var _0x2f096c={};_0x2f096c[_0x40540c]={'$like':'%'+_0x5a3e73['query']['filter']+'%'};return _0x2f096c;})});}_0x42139c=_[_0x1bbb('0x3d')]({},_0x42139c,_0x5a3e73[_0x1bbb('0x3f')]);return _0x48b72c[_0x1bbb('0x4e')](_0x42139c);}})[_0x1bbb('0x22')](function(_0x17f745){if(_0x17f745){_0x4680d3=_0x17f745[_0x1bbb('0x35')];if(!_0x5a3e73['query'][_0x1bbb('0x36')](_0x1bbb('0x37'))){_0x42139c['limit']=qs[_0x1bbb('0x1b')](_0x5a3e73[_0x1bbb('0x2f')]['limit']);_0x42139c['offset']=qs['offset'](_0x5a3e73[_0x1bbb('0x2f')][_0x1bbb('0x18')]);}return _0x48b72c['getDescriptions'](_0x42139c);}})[_0x1bbb('0x22')](function(_0x2d9dba){if(_0x2d9dba){return _0x2d9dba?{'count':_0x4680d3,'rows':_0x2d9dba}:null;}})['then'](respondWithResult(_0x11b2cb,null))[_0x1bbb('0x42')](handleError(_0x11b2cb,null));};exports[_0x1bbb('0x4f')]=function(_0x2dc97e,_0x5461f5,_0x3a025e){var _0xf4e656={};var _0x34413b={};var _0x108911;var _0x57f69e;return db[_0x1bbb('0x2a')][_0x1bbb('0x4c')]({'where':{'id':_0x2dc97e[_0x1bbb('0x44')]['id']}})[_0x1bbb('0x22')](handleEntityNotFound(_0x5461f5,null))[_0x1bbb('0x22')](function(_0x25c9b4){if(_0x25c9b4){_0x108911=_0x25c9b4;_0x34413b[_0x1bbb('0x31')]=_[_0x1bbb('0x45')](db['FreshsalesField'][_0x1bbb('0x2b')]);_0x34413b[_0x1bbb('0x2f')]=_[_0x1bbb('0x45')](_0x2dc97e[_0x1bbb('0x2f')]);_0x34413b['filters']=_[_0x1bbb('0x33')](_0x34413b[_0x1bbb('0x31')],_0x34413b[_0x1bbb('0x2f')]);_0xf4e656[_0x1bbb('0x32')]=_['intersection'](_0x34413b['model'],qs['fields'](_0x2dc97e[_0x1bbb('0x2f')]['fields']));_0xf4e656[_0x1bbb('0x32')]=_0xf4e656[_0x1bbb('0x32')][_0x1bbb('0x35')]?_0xf4e656[_0x1bbb('0x32')]:_0x34413b['model'];_0xf4e656[_0x1bbb('0x38')]=qs[_0x1bbb('0x39')](_0x2dc97e['query'][_0x1bbb('0x39')]);_0xf4e656['where']=qs[_0x1bbb('0x30')](_[_0x1bbb('0x3b')](_0x2dc97e[_0x1bbb('0x2f')],_0x34413b['filters']));if(_0x2dc97e[_0x1bbb('0x2f')][_0x1bbb('0x3c')]){_0xf4e656[_0x1bbb('0x3a')]=_[_0x1bbb('0x3d')](_0xf4e656[_0x1bbb('0x3a')],{'$or':_[_0x1bbb('0x29')](_0xf4e656[_0x1bbb('0x32')],function(_0x1b46f7){var _0x345015={};_0x345015[_0x1b46f7]={'$like':'%'+_0x2dc97e[_0x1bbb('0x2f')][_0x1bbb('0x3c')]+'%'};return _0x345015;})});}_0xf4e656=_[_0x1bbb('0x3d')]({},_0xf4e656,_0x2dc97e['options']);return _0x108911[_0x1bbb('0x4f')](_0xf4e656);}})[_0x1bbb('0x22')](function(_0x3c6380){if(_0x3c6380){_0x57f69e=_0x3c6380[_0x1bbb('0x35')];if(!_0x2dc97e[_0x1bbb('0x2f')][_0x1bbb('0x36')](_0x1bbb('0x37'))){_0xf4e656[_0x1bbb('0x1b')]=qs[_0x1bbb('0x1b')](_0x2dc97e['query'][_0x1bbb('0x1b')]);_0xf4e656['offset']=qs[_0x1bbb('0x18')](_0x2dc97e[_0x1bbb('0x2f')][_0x1bbb('0x18')]);}return _0x108911[_0x1bbb('0x4f')](_0xf4e656);}})[_0x1bbb('0x22')](function(_0x33b5e5){if(_0x33b5e5){return _0x33b5e5?{'count':_0x57f69e,'rows':_0x33b5e5}:null;}})[_0x1bbb('0x22')](respondWithResult(_0x5461f5,null))[_0x1bbb('0x42')](handleError(_0x5461f5,null));}; \ No newline at end of file +var _0xda41=['order','sort','where','filter','merge','includeAll','include','rows','catch','show','options','find','create','body','update','params','getSubjects','findOne','FreshsalesField','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x14db15,_0x5110b2){var _0x5e550c=function(_0x2c1333){while(--_0x2c1333){_0x14db15['push'](_0x14db15['shift']());}};_0x5e550c(++_0x5110b2);}(_0xda41,0x1af));var _0x1da4=function(_0x5efda1,_0x171f5c){_0x5efda1=_0x5efda1-0x0;var _0x503665=_0xda41[_0x5efda1];return _0x503665;};'use strict';var emlformat=require(_0x1da4('0x0'));var rimraf=require(_0x1da4('0x1'));var zipdir=require(_0x1da4('0x2'));var jsonpatch=require(_0x1da4('0x3'));var rp=require('request-promise');var moment=require(_0x1da4('0x4'));var BPromise=require(_0x1da4('0x5'));var Mustache=require(_0x1da4('0x6'));var util=require(_0x1da4('0x7'));var path=require(_0x1da4('0x8'));var sox=require('sox');var csv=require(_0x1da4('0x9'));var ejs=require(_0x1da4('0xa'));var fs=require('fs');var fs_extra=require(_0x1da4('0xb'));var _=require('lodash');var squel=require(_0x1da4('0xc'));var crypto=require(_0x1da4('0xd'));var jsforce=require(_0x1da4('0xe'));var deskjs=require(_0x1da4('0xf'));var toCsv=require(_0x1da4('0x9'));var querystring=require(_0x1da4('0x10'));var Papa=require(_0x1da4('0x11'));var Redis=require(_0x1da4('0x12'));var authService=require(_0x1da4('0x13'));var qs=require(_0x1da4('0x14'));var as=require(_0x1da4('0x15'));var hardwareService=require(_0x1da4('0x16'));var logger=require(_0x1da4('0x17'))(_0x1da4('0x18'));var utils=require(_0x1da4('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1da4('0x1a'));var db=require(_0x1da4('0x1b'))['db'];function respondWithStatusCode(_0x53dd55,_0x351a23){_0x351a23=_0x351a23||0xcc;return function(_0x2291a4){if(_0x2291a4){return _0x53dd55[_0x1da4('0x1c')](_0x351a23);}return _0x53dd55['status'](_0x351a23)['end']();};}function respondWithResult(_0x48f629,_0x40ce60){_0x40ce60=_0x40ce60||0xc8;return function(_0x128e89){if(_0x128e89){return _0x48f629[_0x1da4('0x1d')](_0x40ce60)[_0x1da4('0x1e')](_0x128e89);}};}function respondWithFilteredResult(_0x4a1b0c,_0x44636f){return function(_0x1846af){if(_0x1846af){var _0x1c6747=typeof _0x44636f[_0x1da4('0x1f')]===_0x1da4('0x20')&&typeof _0x44636f[_0x1da4('0x21')]===_0x1da4('0x20');var _0xbef3df=_0x1846af[_0x1da4('0x22')];var _0x1dd440=_0x1c6747?0x0:_0x44636f[_0x1da4('0x1f')];var _0x559c5a=_0x1c6747?_0x1846af[_0x1da4('0x22')]:_0x44636f[_0x1da4('0x1f')]+_0x44636f[_0x1da4('0x21')];var _0x2b4c0d;if(_0x559c5a>=_0xbef3df){_0x559c5a=_0xbef3df;_0x2b4c0d=0xc8;}else{_0x2b4c0d=0xce;}_0x4a1b0c['status'](_0x2b4c0d);return _0x4a1b0c['set'](_0x1da4('0x23'),_0x1dd440+'-'+_0x559c5a+'/'+_0xbef3df)[_0x1da4('0x1e')](_0x1846af);}return null;};}function patchUpdates(_0x2bfe34){return function(_0x3c0d0f){try{jsonpatch[_0x1da4('0x24')](_0x3c0d0f,_0x2bfe34,!![]);}catch(_0x21d725){return BPromise['reject'](_0x21d725);}return _0x3c0d0f[_0x1da4('0x25')]();};}function saveUpdates(_0x5f1582,_0x1b0c59){return function(_0x4be5be){if(_0x4be5be){return _0x4be5be['update'](_0x5f1582)[_0x1da4('0x26')](function(_0xdf4418){return _0xdf4418;});}return null;};}function removeEntity(_0x437985,_0x3977d2){return function(_0x5a85cf){if(_0x5a85cf){return _0x5a85cf[_0x1da4('0x27')]()[_0x1da4('0x26')](function(){_0x437985[_0x1da4('0x1d')](0xcc)[_0x1da4('0x28')]();});}};}function handleEntityNotFound(_0x41dac5,_0x45e419){return function(_0xfd2f8d){if(!_0xfd2f8d){_0x41dac5['sendStatus'](0x194);}return _0xfd2f8d;};}function handleError(_0x32d9f7,_0x2f7e94){_0x2f7e94=_0x2f7e94||0x1f4;return function(_0x4e96d5){logger[_0x1da4('0x29')](_0x4e96d5[_0x1da4('0x2a')]);if(_0x4e96d5[_0x1da4('0x2b')]){delete _0x4e96d5[_0x1da4('0x2b')];}_0x32d9f7['status'](_0x2f7e94)[_0x1da4('0x2c')](_0x4e96d5);};}exports[_0x1da4('0x2d')]=function(_0x3a4814,_0x21364e){var _0x1db400={},_0x4442d9={},_0x1dc50b={'count':0x0,'rows':[]};var _0xd8f105=_[_0x1da4('0x2e')](db[_0x1da4('0x2f')][_0x1da4('0x30')],function(_0x39687f){return{'name':_0x39687f['fieldName'],'type':_0x39687f[_0x1da4('0x31')][_0x1da4('0x32')]};});_0x4442d9[_0x1da4('0x33')]=_['map'](_0xd8f105,_0x1da4('0x2b'));_0x4442d9[_0x1da4('0x34')]=_[_0x1da4('0x35')](_0x3a4814[_0x1da4('0x34')]);_0x4442d9[_0x1da4('0x36')]=_[_0x1da4('0x37')](_0x4442d9[_0x1da4('0x33')],_0x4442d9['query']);_0x1db400[_0x1da4('0x38')]=_[_0x1da4('0x37')](_0x4442d9['model'],qs[_0x1da4('0x39')](_0x3a4814[_0x1da4('0x34')][_0x1da4('0x39')]));_0x1db400[_0x1da4('0x38')]=_0x1db400[_0x1da4('0x38')][_0x1da4('0x3a')]?_0x1db400[_0x1da4('0x38')]:_0x4442d9['model'];if(!_0x3a4814[_0x1da4('0x34')][_0x1da4('0x3b')](_0x1da4('0x3c'))){_0x1db400[_0x1da4('0x21')]=qs[_0x1da4('0x21')](_0x3a4814[_0x1da4('0x34')][_0x1da4('0x21')]);_0x1db400[_0x1da4('0x1f')]=qs[_0x1da4('0x1f')](_0x3a4814[_0x1da4('0x34')][_0x1da4('0x1f')]);}_0x1db400[_0x1da4('0x3d')]=qs[_0x1da4('0x3e')](_0x3a4814[_0x1da4('0x34')][_0x1da4('0x3e')]);_0x1db400[_0x1da4('0x3f')]=qs[_0x1da4('0x36')](_['pick'](_0x3a4814[_0x1da4('0x34')],_0x4442d9[_0x1da4('0x36')]),_0xd8f105);if(_0x3a4814[_0x1da4('0x34')][_0x1da4('0x40')]){_0x1db400[_0x1da4('0x3f')]=_[_0x1da4('0x41')](_0x1db400[_0x1da4('0x3f')],{'$or':_[_0x1da4('0x2e')](_0xd8f105,function(_0x1bd9e6){if(_0x1bd9e6[_0x1da4('0x31')]!=='VIRTUAL'){var _0xb57f76={};_0xb57f76[_0x1bd9e6[_0x1da4('0x2b')]]={'$like':'%'+_0x3a4814[_0x1da4('0x34')][_0x1da4('0x40')]+'%'};return _0xb57f76;}})});}_0x1db400=_[_0x1da4('0x41')]({},_0x1db400,_0x3a4814['options']);var _0x2f0f02={'where':_0x1db400[_0x1da4('0x3f')]};return db[_0x1da4('0x2f')][_0x1da4('0x22')](_0x2f0f02)[_0x1da4('0x26')](function(_0x361365){_0x1dc50b[_0x1da4('0x22')]=_0x361365;if(_0x3a4814[_0x1da4('0x34')][_0x1da4('0x42')]){_0x1db400[_0x1da4('0x43')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x1db400);})[_0x1da4('0x26')](function(_0x20a61e){_0x1dc50b[_0x1da4('0x44')]=_0x20a61e;return _0x1dc50b;})['then'](respondWithFilteredResult(_0x21364e,_0x1db400))[_0x1da4('0x45')](handleError(_0x21364e,null));};exports[_0x1da4('0x46')]=function(_0xd1a038,_0x3bec7a){var _0x4c5f9c={'raw':![],'where':{'id':_0xd1a038['params']['id']}},_0x2ce02f={};_0x2ce02f[_0x1da4('0x33')]=_[_0x1da4('0x35')](db[_0x1da4('0x2f')][_0x1da4('0x30')]);_0x2ce02f[_0x1da4('0x34')]=_[_0x1da4('0x35')](_0xd1a038[_0x1da4('0x34')]);_0x2ce02f[_0x1da4('0x36')]=_[_0x1da4('0x37')](_0x2ce02f[_0x1da4('0x33')],_0x2ce02f[_0x1da4('0x34')]);_0x4c5f9c['attributes']=_[_0x1da4('0x37')](_0x2ce02f['model'],qs[_0x1da4('0x39')](_0xd1a038[_0x1da4('0x34')][_0x1da4('0x39')]));_0x4c5f9c[_0x1da4('0x38')]=_0x4c5f9c[_0x1da4('0x38')]['length']?_0x4c5f9c['attributes']:_0x2ce02f[_0x1da4('0x33')];if(_0xd1a038[_0x1da4('0x34')][_0x1da4('0x42')]){_0x4c5f9c[_0x1da4('0x43')]=[{'all':!![]}];}_0x4c5f9c=_[_0x1da4('0x41')]({},_0x4c5f9c,_0xd1a038[_0x1da4('0x47')]);return db['FreshsalesConfiguration'][_0x1da4('0x48')](_0x4c5f9c)[_0x1da4('0x26')](handleEntityNotFound(_0x3bec7a,null))[_0x1da4('0x26')](respondWithResult(_0x3bec7a,null))['catch'](handleError(_0x3bec7a,null));};exports[_0x1da4('0x49')]=function(_0x507162,_0x570c1f){return db[_0x1da4('0x2f')]['create'](_0x507162[_0x1da4('0x4a')],{})['then'](respondWithResult(_0x570c1f,0xc9))[_0x1da4('0x45')](handleError(_0x570c1f,null));};exports[_0x1da4('0x4b')]=function(_0x329681,_0x1ea9c8){if(_0x329681[_0x1da4('0x4a')]['id']){delete _0x329681[_0x1da4('0x4a')]['id'];}return db[_0x1da4('0x2f')][_0x1da4('0x48')]({'where':{'id':_0x329681[_0x1da4('0x4c')]['id']}})[_0x1da4('0x26')](handleEntityNotFound(_0x1ea9c8,null))[_0x1da4('0x26')](saveUpdates(_0x329681['body'],null))[_0x1da4('0x26')](respondWithResult(_0x1ea9c8,null))[_0x1da4('0x45')](handleError(_0x1ea9c8,null));};exports['destroy']=function(_0x485d2b,_0x5e4eb5){return db[_0x1da4('0x2f')]['find']({'where':{'id':_0x485d2b[_0x1da4('0x4c')]['id']}})[_0x1da4('0x26')](handleEntityNotFound(_0x5e4eb5,null))[_0x1da4('0x26')](removeEntity(_0x5e4eb5,null))[_0x1da4('0x45')](handleError(_0x5e4eb5,null));};exports[_0x1da4('0x4d')]=function(_0x13290e,_0x18d190,_0x489095){var _0x3d7013={};var _0x1dcd22={};var _0x5a028b;var _0x3ff41e;return db[_0x1da4('0x2f')][_0x1da4('0x4e')]({'where':{'id':_0x13290e[_0x1da4('0x4c')]['id']}})[_0x1da4('0x26')](handleEntityNotFound(_0x18d190,null))[_0x1da4('0x26')](function(_0x3e801){if(_0x3e801){_0x5a028b=_0x3e801;_0x1dcd22[_0x1da4('0x33')]=_[_0x1da4('0x35')](db[_0x1da4('0x4f')][_0x1da4('0x30')]);_0x1dcd22[_0x1da4('0x34')]=_[_0x1da4('0x35')](_0x13290e[_0x1da4('0x34')]);_0x1dcd22[_0x1da4('0x36')]=_[_0x1da4('0x37')](_0x1dcd22[_0x1da4('0x33')],_0x1dcd22[_0x1da4('0x34')]);_0x3d7013['attributes']=_[_0x1da4('0x37')](_0x1dcd22[_0x1da4('0x33')],qs[_0x1da4('0x39')](_0x13290e['query']['fields']));_0x3d7013[_0x1da4('0x38')]=_0x3d7013[_0x1da4('0x38')][_0x1da4('0x3a')]?_0x3d7013[_0x1da4('0x38')]:_0x1dcd22[_0x1da4('0x33')];_0x3d7013['order']=qs[_0x1da4('0x3e')](_0x13290e[_0x1da4('0x34')]['sort']);_0x3d7013[_0x1da4('0x3f')]=qs[_0x1da4('0x36')](_[_0x1da4('0x50')](_0x13290e['query'],_0x1dcd22[_0x1da4('0x36')]));if(_0x13290e[_0x1da4('0x34')][_0x1da4('0x40')]){_0x3d7013['where']=_['merge'](_0x3d7013[_0x1da4('0x3f')],{'$or':_[_0x1da4('0x2e')](_0x3d7013['attributes'],function(_0x3695ad){var _0x5f1532={};_0x5f1532[_0x3695ad]={'$like':'%'+_0x13290e[_0x1da4('0x34')]['filter']+'%'};return _0x5f1532;})});}_0x3d7013=_[_0x1da4('0x41')]({},_0x3d7013,_0x13290e[_0x1da4('0x47')]);return _0x5a028b[_0x1da4('0x4d')](_0x3d7013);}})[_0x1da4('0x26')](function(_0x300f9){if(_0x300f9){_0x3ff41e=_0x300f9[_0x1da4('0x3a')];if(!_0x13290e[_0x1da4('0x34')][_0x1da4('0x3b')](_0x1da4('0x3c'))){_0x3d7013[_0x1da4('0x21')]=qs[_0x1da4('0x21')](_0x13290e[_0x1da4('0x34')]['limit']);_0x3d7013['offset']=qs[_0x1da4('0x1f')](_0x13290e[_0x1da4('0x34')][_0x1da4('0x1f')]);}return _0x5a028b['getSubjects'](_0x3d7013);}})['then'](function(_0x5f5525){if(_0x5f5525){return _0x5f5525?{'count':_0x3ff41e,'rows':_0x5f5525}:null;}})[_0x1da4('0x26')](respondWithResult(_0x18d190,null))['catch'](handleError(_0x18d190,null));};exports[_0x1da4('0x51')]=function(_0x4f79c6,_0x46d494,_0x11ba32){var _0xb7d641={};var _0x51d21c={};var _0x39e5e7;var _0x4e4898;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x4f79c6[_0x1da4('0x4c')]['id']}})[_0x1da4('0x26')](handleEntityNotFound(_0x46d494,null))[_0x1da4('0x26')](function(_0x1cd515){if(_0x1cd515){_0x39e5e7=_0x1cd515;_0x51d21c[_0x1da4('0x33')]=_[_0x1da4('0x35')](db['FreshsalesField'][_0x1da4('0x30')]);_0x51d21c[_0x1da4('0x34')]=_['keys'](_0x4f79c6[_0x1da4('0x34')]);_0x51d21c['filters']=_[_0x1da4('0x37')](_0x51d21c[_0x1da4('0x33')],_0x51d21c[_0x1da4('0x34')]);_0xb7d641['attributes']=_['intersection'](_0x51d21c['model'],qs[_0x1da4('0x39')](_0x4f79c6['query'][_0x1da4('0x39')]));_0xb7d641[_0x1da4('0x38')]=_0xb7d641[_0x1da4('0x38')]['length']?_0xb7d641[_0x1da4('0x38')]:_0x51d21c[_0x1da4('0x33')];_0xb7d641[_0x1da4('0x3d')]=qs[_0x1da4('0x3e')](_0x4f79c6[_0x1da4('0x34')]['sort']);_0xb7d641[_0x1da4('0x3f')]=qs['filters'](_[_0x1da4('0x50')](_0x4f79c6[_0x1da4('0x34')],_0x51d21c[_0x1da4('0x36')]));if(_0x4f79c6['query']['filter']){_0xb7d641[_0x1da4('0x3f')]=_[_0x1da4('0x41')](_0xb7d641['where'],{'$or':_[_0x1da4('0x2e')](_0xb7d641[_0x1da4('0x38')],function(_0x392690){var _0x174775={};_0x174775[_0x392690]={'$like':'%'+_0x4f79c6['query'][_0x1da4('0x40')]+'%'};return _0x174775;})});}_0xb7d641=_[_0x1da4('0x41')]({},_0xb7d641,_0x4f79c6[_0x1da4('0x47')]);return _0x39e5e7[_0x1da4('0x51')](_0xb7d641);}})['then'](function(_0x4ee487){if(_0x4ee487){_0x4e4898=_0x4ee487[_0x1da4('0x3a')];if(!_0x4f79c6[_0x1da4('0x34')][_0x1da4('0x3b')](_0x1da4('0x3c'))){_0xb7d641[_0x1da4('0x21')]=qs['limit'](_0x4f79c6[_0x1da4('0x34')][_0x1da4('0x21')]);_0xb7d641[_0x1da4('0x1f')]=qs[_0x1da4('0x1f')](_0x4f79c6['query'][_0x1da4('0x1f')]);}return _0x39e5e7[_0x1da4('0x51')](_0xb7d641);}})[_0x1da4('0x26')](function(_0x211a28){if(_0x211a28){return _0x211a28?{'count':_0x4e4898,'rows':_0x211a28}:null;}})[_0x1da4('0x26')](respondWithResult(_0x46d494,null))[_0x1da4('0x45')](handleError(_0x46d494,null));};exports['getFields']=function(_0x2a7302,_0x3822b3,_0x3447e7){var _0x6585fc={};var _0x19e2a4={};var _0x204e0e;var _0x443a01;return db['FreshsalesConfiguration'][_0x1da4('0x4e')]({'where':{'id':_0x2a7302[_0x1da4('0x4c')]['id']}})[_0x1da4('0x26')](handleEntityNotFound(_0x3822b3,null))[_0x1da4('0x26')](function(_0x30b5c5){if(_0x30b5c5){_0x204e0e=_0x30b5c5;_0x19e2a4[_0x1da4('0x33')]=_[_0x1da4('0x35')](db[_0x1da4('0x4f')]['rawAttributes']);_0x19e2a4[_0x1da4('0x34')]=_[_0x1da4('0x35')](_0x2a7302[_0x1da4('0x34')]);_0x19e2a4[_0x1da4('0x36')]=_[_0x1da4('0x37')](_0x19e2a4[_0x1da4('0x33')],_0x19e2a4[_0x1da4('0x34')]);_0x6585fc['attributes']=_[_0x1da4('0x37')](_0x19e2a4['model'],qs[_0x1da4('0x39')](_0x2a7302[_0x1da4('0x34')][_0x1da4('0x39')]));_0x6585fc[_0x1da4('0x38')]=_0x6585fc['attributes']['length']?_0x6585fc[_0x1da4('0x38')]:_0x19e2a4[_0x1da4('0x33')];_0x6585fc['order']=qs[_0x1da4('0x3e')](_0x2a7302[_0x1da4('0x34')][_0x1da4('0x3e')]);_0x6585fc['where']=qs[_0x1da4('0x36')](_[_0x1da4('0x50')](_0x2a7302[_0x1da4('0x34')],_0x19e2a4[_0x1da4('0x36')]));if(_0x2a7302[_0x1da4('0x34')][_0x1da4('0x40')]){_0x6585fc[_0x1da4('0x3f')]=_['merge'](_0x6585fc['where'],{'$or':_[_0x1da4('0x2e')](_0x6585fc[_0x1da4('0x38')],function(_0x214fb2){var _0x3dd983={};_0x3dd983[_0x214fb2]={'$like':'%'+_0x2a7302['query']['filter']+'%'};return _0x3dd983;})});}_0x6585fc=_[_0x1da4('0x41')]({},_0x6585fc,_0x2a7302[_0x1da4('0x47')]);return _0x204e0e['getFields'](_0x6585fc);}})['then'](function(_0x18d466){if(_0x18d466){_0x443a01=_0x18d466['length'];if(!_0x2a7302[_0x1da4('0x34')][_0x1da4('0x3b')](_0x1da4('0x3c'))){_0x6585fc[_0x1da4('0x21')]=qs[_0x1da4('0x21')](_0x2a7302['query'][_0x1da4('0x21')]);_0x6585fc[_0x1da4('0x1f')]=qs[_0x1da4('0x1f')](_0x2a7302[_0x1da4('0x34')][_0x1da4('0x1f')]);}return _0x204e0e['getFields'](_0x6585fc);}})[_0x1da4('0x26')](function(_0x2e9285){if(_0x2e9285){return _0x2e9285?{'count':_0x443a01,'rows':_0x2e9285}:null;}})['then'](respondWithResult(_0x3822b3,null))[_0x1da4('0x45')](handleError(_0x3822b3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 81b3ffb..9f17c1b 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 _0xfb3c=['../../config/logger','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x5b3ec1,_0x4986d4){var _0x195e76=function(_0x23980a){while(--_0x23980a){_0x5b3ec1['push'](_0x5b3ec1['shift']());}};_0x195e76(++_0x4986d4);}(_0xfb3c,0x14a));var _0xcfb3=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xfb3c[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcfb3('0x0'))('api');var moment=require('moment');var BPromise=require(_0xcfb3('0x1'));var rp=require(_0xcfb3('0x2'));var fs=require('fs');var path=require(_0xcfb3('0x3'));var rimraf=require(_0xcfb3('0x4'));var config=require('../../config/environment');var attributes=require(_0xcfb3('0x5'));module[_0xcfb3('0x6')]=function(_0x4f1e1f,_0x4760a2){return _0x4f1e1f[_0xcfb3('0x7')](_0xcfb3('0x8'),attributes,{'tableName':_0xcfb3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x943e=['request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x158aef,_0x1286d8){var _0x5951b5=function(_0x38ec01){while(--_0x38ec01){_0x158aef['push'](_0x158aef['shift']());}};_0x5951b5(++_0x1286d8);}(_0x943e,0x1e9));var _0xe943=function(_0x171e46,_0xc36ce0){_0x171e46=_0x171e46-0x0;var _0x18fe9d=_0x943e[_0x171e46];return _0x18fe9d;};'use strict';var _=require(_0xe943('0x0'));var util=require(_0xe943('0x1'));var logger=require(_0xe943('0x2'))(_0xe943('0x3'));var moment=require(_0xe943('0x4'));var BPromise=require(_0xe943('0x5'));var rp=require(_0xe943('0x6'));var fs=require('fs');var path=require(_0xe943('0x7'));var rimraf=require(_0xe943('0x8'));var config=require(_0xe943('0x9'));var attributes=require(_0xe943('0xa'));module[_0xe943('0xb')]=function(_0x44d435,_0x2eb4b7){return _0x44d435[_0xe943('0xc')](_0xe943('0xd'),attributes,{'tableName':_0xe943('0xe'),'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 f724f73..94675aa 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 _0x2184=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x57a2a6,_0x3d21b2){var _0x74724a=function(_0x5918cc){while(--_0x5918cc){_0x57a2a6['push'](_0x57a2a6['shift']());}};_0x74724a(++_0x3d21b2);}(_0x2184,0x17e));var _0x4218=function(_0x223ef6,_0x2a1939){_0x223ef6=_0x223ef6-0x0;var _0x3ef20d=_0x2184[_0x223ef6];return _0x3ef20d;};'use strict';var _=require(_0x4218('0x0'));var util=require(_0x4218('0x1'));var moment=require(_0x4218('0x2'));var BPromise=require('bluebird');var rs=require(_0x4218('0x3'));var fs=require('fs');var Redis=require(_0x4218('0x4'));var db=require(_0x4218('0x5'))['db'];var utils=require(_0x4218('0x6'));var logger=require(_0x4218('0x7'))(_0x4218('0x8'));var config=require(_0x4218('0x9'));var jayson=require(_0x4218('0xa'));var client=jayson[_0x4218('0xb')][_0x4218('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x893dff,_0x5c9482,_0x114ff7){return new BPromise(function(_0x47b222,_0x422016){return client['request'](_0x893dff,_0x114ff7)[_0x4218('0xd')](function(_0x3f6b31){logger[_0x4218('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5c9482,_0x4218('0xf'));logger['debug'](_0x4218('0x10'),_0x5c9482,_0x4218('0xf'),JSON[_0x4218('0x11')](_0x3f6b31));if(_0x3f6b31[_0x4218('0x12')]){if(_0x3f6b31[_0x4218('0x12')][_0x4218('0x13')]===0x1f4){logger['error'](_0x4218('0x14'),_0x5c9482,_0x3f6b31[_0x4218('0x12')]['message']);return _0x422016(_0x3f6b31['error'][_0x4218('0x15')]);}logger[_0x4218('0x12')](_0x4218('0x14'),_0x5c9482,_0x3f6b31[_0x4218('0x12')][_0x4218('0x15')]);return _0x47b222(_0x3f6b31[_0x4218('0x12')][_0x4218('0x15')]);}else{logger[_0x4218('0xe')](_0x4218('0x14'),_0x5c9482,'request\x20sent');_0x47b222(_0x3f6b31[_0x4218('0x16')]['message']);}})[_0x4218('0x17')](function(_0x264c07){logger[_0x4218('0x12')](_0x4218('0x14'),_0x5c9482,_0x264c07);_0x422016(_0x264c07);});});} \ No newline at end of file +var _0x828a=['error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x58e4a4,_0xfc0742){var _0x580654=function(_0x1238be){while(--_0x1238be){_0x58e4a4['push'](_0x58e4a4['shift']());}};_0x580654(++_0xfc0742);}(_0x828a,0x1be));var _0xa828=function(_0x54f8dd,_0x426c3c){_0x54f8dd=_0x54f8dd-0x0;var _0xfb25c6=_0x828a[_0x54f8dd];return _0xfb25c6;};'use strict';var _=require(_0xa828('0x0'));var util=require(_0xa828('0x1'));var moment=require(_0xa828('0x2'));var BPromise=require('bluebird');var rs=require(_0xa828('0x3'));var fs=require('fs');var Redis=require(_0xa828('0x4'));var db=require(_0xa828('0x5'))['db'];var utils=require(_0xa828('0x6'));var logger=require(_0xa828('0x7'))(_0xa828('0x8'));var config=require('../../config/environment');var jayson=require(_0xa828('0x9'));var client=jayson['client'][_0xa828('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eef9c,_0x3aa670,_0x42f26c){return new BPromise(function(_0x546e18,_0x3f48eb){return client['request'](_0x4eef9c,_0x42f26c)[_0xa828('0xb')](function(_0x173fbb){logger['info'](_0xa828('0xc'),_0x3aa670,_0xa828('0xd'));logger[_0xa828('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x3aa670,_0xa828('0xd'),JSON[_0xa828('0xf')](_0x173fbb));if(_0x173fbb[_0xa828('0x10')]){if(_0x173fbb[_0xa828('0x10')][_0xa828('0x11')]===0x1f4){logger[_0xa828('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3aa670,_0x173fbb[_0xa828('0x10')][_0xa828('0x12')]);return _0x3f48eb(_0x173fbb['error'][_0xa828('0x12')]);}logger[_0xa828('0x10')](_0xa828('0xc'),_0x3aa670,_0x173fbb[_0xa828('0x10')][_0xa828('0x12')]);return _0x546e18(_0x173fbb['error'][_0xa828('0x12')]);}else{logger[_0xa828('0x13')](_0xa828('0xc'),_0x3aa670,'request\x20sent');_0x546e18(_0x173fbb['result']['message']);}})[_0xa828('0x14')](function(_0x3d7506){logger[_0xa828('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3aa670,_0x3d7506);_0x3f48eb(_0x3d7506);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 82acb17..95ccd19 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 _0x6364=['isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6364,0x8f));var _0x4636=function(_0x263ec6,_0x4033cb){_0x263ec6=_0x263ec6-0x0;var _0x4a4461=_0x6364[_0x263ec6];return _0x4a4461;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4636('0x0'));var timeout=require(_0x4636('0x1'));var express=require(_0x4636('0x2'));var router=express[_0x4636('0x3')]();var fs_extra=require(_0x4636('0x4'));var auth=require(_0x4636('0x5'));var interaction=require(_0x4636('0x6'));var config=require(_0x4636('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x4636('0x8')]('/',auth[_0x4636('0x9')](),controller[_0x4636('0xa')]);router[_0x4636('0x8')](_0x4636('0xb'),auth['isAuthenticated'](),controller[_0x4636('0xc')]);router[_0x4636('0xd')]('/',auth[_0x4636('0x9')](),controller[_0x4636('0xe')]);router['put'](_0x4636('0xb'),auth[_0x4636('0x9')](),controller[_0x4636('0xf')]);router[_0x4636('0x10')](_0x4636('0xb'),auth['isAuthenticated'](),controller[_0x4636('0x11')]);module[_0x4636('0x12')]=router; \ No newline at end of file +var _0x6308=['put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post'];(function(_0x31c246,_0x18aa37){var _0x37c12d=function(_0x419f16){while(--_0x419f16){_0x31c246['push'](_0x31c246['shift']());}};_0x37c12d(++_0x18aa37);}(_0x6308,0x1f2));var _0x8630=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x6308[_0x4a7631];return _0x1a5a6f;};'use strict';var multer=require(_0x8630('0x0'));var util=require('util');var path=require(_0x8630('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8630('0x2')]();var fs_extra=require(_0x8630('0x3'));var auth=require(_0x8630('0x4'));var interaction=require(_0x8630('0x5'));var config=require(_0x8630('0x6'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x8630('0x7')](),controller['index']);router[_0x8630('0x8')](_0x8630('0x9'),auth[_0x8630('0x7')](),controller[_0x8630('0xa')]);router[_0x8630('0xb')]('/',auth[_0x8630('0x7')](),controller['create']);router[_0x8630('0xc')]('/:id',auth[_0x8630('0x7')](),controller[_0x8630('0xd')]);router[_0x8630('0xe')]('/:id',auth[_0x8630('0x7')](),controller[_0x8630('0xf')]);module[_0x8630('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 65124c2..a894c4b 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 _0xb6dc=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x7303c,_0x2d7803){var _0x367cc7=function(_0x333990){while(--_0x333990){_0x7303c['push'](_0x7303c['shift']());}};_0x367cc7(++_0x2d7803);}(_0xb6dc,0xd8));var _0xcb6d=function(_0x2664c0,_0xe32904){_0x2664c0=_0x2664c0-0x0;var _0x37814f=_0xb6dc[_0x2664c0];return _0x37814f;};'use strict';var Sequelize=require(_0xcb6d('0x0'));module[_0xcb6d('0x1')]={'type':{'type':Sequelize[_0xcb6d('0x2')](_0xcb6d('0x3'),'variable',_0xcb6d('0x4'),_0xcb6d('0x5'),_0xcb6d('0x6')),'defaultValue':_0xcb6d('0x3')},'content':{'type':Sequelize[_0xcb6d('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xcb6d('0x3'),'variable',_0xcb6d('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xcb6d('0x7')]},'customField':{'type':Sequelize[_0xcb6d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcb6d('0x7')]}}; \ No newline at end of file +var _0x2711=['customVariable','picklist','string','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x27b059,_0x275671){var _0x982b2a=function(_0x1e7d71){while(--_0x1e7d71){_0x27b059['push'](_0x27b059['shift']());}};_0x982b2a(++_0x275671);}(_0x2711,0x1ad));var _0x1271=function(_0x4a3456,_0x1afb7e){_0x4a3456=_0x4a3456-0x0;var _0x4f43d9=_0x2711[_0x4a3456];return _0x4f43d9;};'use strict';var Sequelize=require(_0x1271('0x0'));module[_0x1271('0x1')]={'type':{'type':Sequelize[_0x1271('0x2')]('string','variable',_0x1271('0x3'),'keyValue',_0x1271('0x4')),'defaultValue':_0x1271('0x5')},'content':{'type':Sequelize[_0x1271('0x6')]},'key':{'type':Sequelize[_0x1271('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x1271('0x5'),_0x1271('0x7'),_0x1271('0x3'))},'keyContent':{'type':Sequelize[_0x1271('0x6')]},'idField':{'type':Sequelize[_0x1271('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1271('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index e9a9f7e..c67fcdf 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 _0xe579=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','reject','save','update','then','error','stack','send','index','map','rawAttributes','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','FreshsalesField','rows','catch','show','params','include','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xec1289,_0x4fa82b){var _0x3e223c=function(_0x9752ec){while(--_0x9752ec){_0xec1289['push'](_0xec1289['shift']());}};_0x3e223c(++_0x4fa82b);}(_0xe579,0x87));var _0x9e57=function(_0x12c420,_0xb66261){_0x12c420=_0x12c420-0x0;var _0x179acc=_0xe579[_0x12c420];return _0x179acc;};'use strict';var emlformat=require(_0x9e57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e57('0x1'));var jsonpatch=require(_0x9e57('0x2'));var rp=require(_0x9e57('0x3'));var moment=require(_0x9e57('0x4'));var BPromise=require(_0x9e57('0x5'));var Mustache=require(_0x9e57('0x6'));var util=require(_0x9e57('0x7'));var path=require('path');var sox=require(_0x9e57('0x8'));var csv=require(_0x9e57('0x9'));var ejs=require(_0x9e57('0xa'));var fs=require('fs');var fs_extra=require(_0x9e57('0xb'));var _=require(_0x9e57('0xc'));var squel=require('squel');var crypto=require(_0x9e57('0xd'));var jsforce=require(_0x9e57('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9e57('0x9'));var querystring=require(_0x9e57('0xf'));var Papa=require(_0x9e57('0x10'));var Redis=require(_0x9e57('0x11'));var authService=require(_0x9e57('0x12'));var qs=require(_0x9e57('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e57('0x14'));var logger=require(_0x9e57('0x15'))('api');var utils=require(_0x9e57('0x16'));var config=require(_0x9e57('0x17'));var licenseUtil=require(_0x9e57('0x18'));var db=require(_0x9e57('0x19'))['db'];function respondWithStatusCode(_0x566e60,_0x32a3c5){_0x32a3c5=_0x32a3c5||0xcc;return function(_0x29437f){if(_0x29437f){return _0x566e60[_0x9e57('0x1a')](_0x32a3c5);}return _0x566e60[_0x9e57('0x1b')](_0x32a3c5)[_0x9e57('0x1c')]();};}function respondWithResult(_0x187dbd,_0x22377a){_0x22377a=_0x22377a||0xc8;return function(_0x1154fa){if(_0x1154fa){return _0x187dbd[_0x9e57('0x1b')](_0x22377a)[_0x9e57('0x1d')](_0x1154fa);}};}function respondWithFilteredResult(_0x5cc35b,_0x57a9b7){return function(_0x3aa399){if(_0x3aa399){var _0x400fe8=typeof _0x57a9b7['offset']==='undefined'&&typeof _0x57a9b7['limit']===_0x9e57('0x1e');var _0x3602bc=_0x3aa399['count'];var _0x1a3dbf=_0x400fe8?0x0:_0x57a9b7[_0x9e57('0x1f')];var _0x11fd22=_0x400fe8?_0x3aa399['count']:_0x57a9b7[_0x9e57('0x1f')]+_0x57a9b7[_0x9e57('0x20')];var _0x272803;if(_0x11fd22>=_0x3602bc){_0x11fd22=_0x3602bc;_0x272803=0xc8;}else{_0x272803=0xce;}_0x5cc35b['status'](_0x272803);return _0x5cc35b[_0x9e57('0x21')](_0x9e57('0x22'),_0x1a3dbf+'-'+_0x11fd22+'/'+_0x3602bc)[_0x9e57('0x1d')](_0x3aa399);}return null;};}function patchUpdates(_0x17785d){return function(_0x47ba32){try{jsonpatch['apply'](_0x47ba32,_0x17785d,!![]);}catch(_0x51c5c3){return BPromise[_0x9e57('0x23')](_0x51c5c3);}return _0x47ba32[_0x9e57('0x24')]();};}function saveUpdates(_0x40262e,_0x1f01e4){return function(_0x31ef76){if(_0x31ef76){return _0x31ef76[_0x9e57('0x25')](_0x40262e)[_0x9e57('0x26')](function(_0x20911b){return _0x20911b;});}return null;};}function removeEntity(_0x22c08c,_0x13904a){return function(_0x3ad165){if(_0x3ad165){return _0x3ad165['destroy']()[_0x9e57('0x26')](function(){_0x22c08c[_0x9e57('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28cf4a,_0x1d1491){return function(_0x5943ad){if(!_0x5943ad){_0x28cf4a['sendStatus'](0x194);}return _0x5943ad;};}function handleError(_0x3c3757,_0x409b9a){_0x409b9a=_0x409b9a||0x1f4;return function(_0x2ac99d){logger[_0x9e57('0x27')](_0x2ac99d[_0x9e57('0x28')]);if(_0x2ac99d['name']){delete _0x2ac99d['name'];}_0x3c3757[_0x9e57('0x1b')](_0x409b9a)[_0x9e57('0x29')](_0x2ac99d);};}exports[_0x9e57('0x2a')]=function(_0x1c493e,_0x229cb5){var _0x19ec35={},_0x1f280a={},_0x509c01={'count':0x0,'rows':[]};var _0x57fa4d=_[_0x9e57('0x2b')](db['FreshsalesField'][_0x9e57('0x2c')],function(_0x526699){return{'name':_0x526699['fieldName'],'type':_0x526699[_0x9e57('0x2d')]['key']};});_0x1f280a['model']=_[_0x9e57('0x2b')](_0x57fa4d,_0x9e57('0x2e'));_0x1f280a[_0x9e57('0x2f')]=_[_0x9e57('0x30')](_0x1c493e[_0x9e57('0x2f')]);_0x1f280a[_0x9e57('0x31')]=_[_0x9e57('0x32')](_0x1f280a[_0x9e57('0x33')],_0x1f280a[_0x9e57('0x2f')]);_0x19ec35[_0x9e57('0x34')]=_[_0x9e57('0x32')](_0x1f280a['model'],qs[_0x9e57('0x35')](_0x1c493e['query'][_0x9e57('0x35')]));_0x19ec35['attributes']=_0x19ec35[_0x9e57('0x34')][_0x9e57('0x36')]?_0x19ec35['attributes']:_0x1f280a['model'];if(!_0x1c493e[_0x9e57('0x2f')][_0x9e57('0x37')](_0x9e57('0x38'))){_0x19ec35[_0x9e57('0x20')]=qs[_0x9e57('0x20')](_0x1c493e[_0x9e57('0x2f')][_0x9e57('0x20')]);_0x19ec35[_0x9e57('0x1f')]=qs[_0x9e57('0x1f')](_0x1c493e[_0x9e57('0x2f')][_0x9e57('0x1f')]);}_0x19ec35[_0x9e57('0x39')]=qs[_0x9e57('0x3a')](_0x1c493e[_0x9e57('0x2f')]['sort']);_0x19ec35['where']=qs[_0x9e57('0x31')](_[_0x9e57('0x3b')](_0x1c493e[_0x9e57('0x2f')],_0x1f280a['filters']),_0x57fa4d);if(_0x1c493e[_0x9e57('0x2f')]['filter']){_0x19ec35[_0x9e57('0x3c')]=_[_0x9e57('0x3d')](_0x19ec35['where'],{'$or':_[_0x9e57('0x2b')](_0x57fa4d,function(_0x519b6e){if(_0x519b6e[_0x9e57('0x2d')]!==_0x9e57('0x3e')){var _0x2f4cd6={};_0x2f4cd6[_0x519b6e[_0x9e57('0x2e')]]={'$like':'%'+_0x1c493e['query'][_0x9e57('0x3f')]+'%'};return _0x2f4cd6;}})});}_0x19ec35=_[_0x9e57('0x3d')]({},_0x19ec35,_0x1c493e[_0x9e57('0x40')]);var _0x5bf799={'where':_0x19ec35[_0x9e57('0x3c')]};return db['FreshsalesField'][_0x9e57('0x41')](_0x5bf799)[_0x9e57('0x26')](function(_0x5305ec){_0x509c01[_0x9e57('0x41')]=_0x5305ec;if(_0x1c493e[_0x9e57('0x2f')][_0x9e57('0x42')]){_0x19ec35['include']=[{'all':!![]}];}return db[_0x9e57('0x43')]['findAll'](_0x19ec35);})[_0x9e57('0x26')](function(_0x246482){_0x509c01[_0x9e57('0x44')]=_0x246482;return _0x509c01;})[_0x9e57('0x26')](respondWithFilteredResult(_0x229cb5,_0x19ec35))[_0x9e57('0x45')](handleError(_0x229cb5,null));};exports[_0x9e57('0x46')]=function(_0xa85d6d,_0x21da42){var _0x14279e={'raw':!![],'where':{'id':_0xa85d6d[_0x9e57('0x47')]['id']}},_0x36e808={};_0x36e808[_0x9e57('0x33')]=_[_0x9e57('0x30')](db[_0x9e57('0x43')][_0x9e57('0x2c')]);_0x36e808[_0x9e57('0x2f')]=_[_0x9e57('0x30')](_0xa85d6d['query']);_0x36e808['filters']=_['intersection'](_0x36e808[_0x9e57('0x33')],_0x36e808['query']);_0x14279e[_0x9e57('0x34')]=_['intersection'](_0x36e808['model'],qs['fields'](_0xa85d6d['query']['fields']));_0x14279e['attributes']=_0x14279e[_0x9e57('0x34')][_0x9e57('0x36')]?_0x14279e[_0x9e57('0x34')]:_0x36e808[_0x9e57('0x33')];if(_0xa85d6d[_0x9e57('0x2f')]['includeAll']){_0x14279e[_0x9e57('0x48')]=[{'all':!![]}];}_0x14279e=_[_0x9e57('0x3d')]({},_0x14279e,_0xa85d6d[_0x9e57('0x40')]);return db[_0x9e57('0x43')][_0x9e57('0x49')](_0x14279e)['then'](handleEntityNotFound(_0x21da42,null))[_0x9e57('0x26')](respondWithResult(_0x21da42,null))[_0x9e57('0x45')](handleError(_0x21da42,null));};exports[_0x9e57('0x4a')]=function(_0x104960,_0x55d127){return db[_0x9e57('0x43')][_0x9e57('0x4a')](_0x104960['body'],{})[_0x9e57('0x26')](respondWithResult(_0x55d127,0xc9))[_0x9e57('0x45')](handleError(_0x55d127,null));};exports[_0x9e57('0x25')]=function(_0x543a95,_0x5ecdce){if(_0x543a95[_0x9e57('0x4b')]['id']){delete _0x543a95[_0x9e57('0x4b')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x543a95[_0x9e57('0x47')]['id']}})[_0x9e57('0x26')](handleEntityNotFound(_0x5ecdce,null))[_0x9e57('0x26')](saveUpdates(_0x543a95[_0x9e57('0x4b')],null))[_0x9e57('0x26')](respondWithResult(_0x5ecdce,null))['catch'](handleError(_0x5ecdce,null));};exports[_0x9e57('0x4c')]=function(_0x85d3b7,_0x1f8450){return db[_0x9e57('0x43')][_0x9e57('0x49')]({'where':{'id':_0x85d3b7[_0x9e57('0x47')]['id']}})[_0x9e57('0x26')](handleEntityNotFound(_0x1f8450,null))[_0x9e57('0x26')](removeEntity(_0x1f8450,null))['catch'](handleError(_0x1f8450,null));}; \ No newline at end of file +var _0xcfce=['filter','merge','VIRTUAL','FreshsalesField','includeAll','include','catch','show','params','rawAttributes','options','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','../../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','then','destroy','end','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick'];(function(_0xb5eeda,_0x1a12ce){var _0x191d16=function(_0x2b2327){while(--_0x2b2327){_0xb5eeda['push'](_0xb5eeda['shift']());}};_0x191d16(++_0x1a12ce);}(_0xcfce,0x1c4));var _0xecfc=function(_0x22b95b,_0x2c695e){_0x22b95b=_0x22b95b-0x0;var _0x32728b=_0xcfce[_0x22b95b];return _0x32728b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xecfc('0x0'));var zipdir=require(_0xecfc('0x1'));var jsonpatch=require(_0xecfc('0x2'));var rp=require(_0xecfc('0x3'));var moment=require(_0xecfc('0x4'));var BPromise=require(_0xecfc('0x5'));var Mustache=require(_0xecfc('0x6'));var util=require(_0xecfc('0x7'));var path=require('path');var sox=require(_0xecfc('0x8'));var csv=require(_0xecfc('0x9'));var ejs=require(_0xecfc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xecfc('0xb'));var crypto=require(_0xecfc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xecfc('0xd'));var toCsv=require(_0xecfc('0x9'));var querystring=require(_0xecfc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xecfc('0xf'));var as=require(_0xecfc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xecfc('0x11'))(_0xecfc('0x12'));var utils=require(_0xecfc('0x13'));var config=require(_0xecfc('0x14'));var licenseUtil=require(_0xecfc('0x15'));var db=require(_0xecfc('0x16'))['db'];function respondWithStatusCode(_0x21e0bf,_0x1f0d38){_0x1f0d38=_0x1f0d38||0xcc;return function(_0xf53947){if(_0xf53947){return _0x21e0bf[_0xecfc('0x17')](_0x1f0d38);}return _0x21e0bf['status'](_0x1f0d38)['end']();};}function respondWithResult(_0x21165a,_0x10de79){_0x10de79=_0x10de79||0xc8;return function(_0xf20b7e){if(_0xf20b7e){return _0x21165a[_0xecfc('0x18')](_0x10de79)[_0xecfc('0x19')](_0xf20b7e);}};}function respondWithFilteredResult(_0x43fba,_0x31ed7f){return function(_0x401928){if(_0x401928){var _0x49fff4=typeof _0x31ed7f[_0xecfc('0x1a')]===_0xecfc('0x1b')&&typeof _0x31ed7f[_0xecfc('0x1c')]===_0xecfc('0x1b');var _0x1b367a=_0x401928[_0xecfc('0x1d')];var _0x593468=_0x49fff4?0x0:_0x31ed7f['offset'];var _0x457b52=_0x49fff4?_0x401928[_0xecfc('0x1d')]:_0x31ed7f[_0xecfc('0x1a')]+_0x31ed7f[_0xecfc('0x1c')];var _0x4fd5c7;if(_0x457b52>=_0x1b367a){_0x457b52=_0x1b367a;_0x4fd5c7=0xc8;}else{_0x4fd5c7=0xce;}_0x43fba[_0xecfc('0x18')](_0x4fd5c7);return _0x43fba[_0xecfc('0x1e')](_0xecfc('0x1f'),_0x593468+'-'+_0x457b52+'/'+_0x1b367a)[_0xecfc('0x19')](_0x401928);}return null;};}function patchUpdates(_0x196577){return function(_0x526c38){try{jsonpatch[_0xecfc('0x20')](_0x526c38,_0x196577,!![]);}catch(_0x4bc4f6){return BPromise[_0xecfc('0x21')](_0x4bc4f6);}return _0x526c38[_0xecfc('0x22')]();};}function saveUpdates(_0x123f8a,_0x5e2d4e){return function(_0xe12034){if(_0xe12034){return _0xe12034[_0xecfc('0x23')](_0x123f8a)[_0xecfc('0x24')](function(_0xb4d868){return _0xb4d868;});}return null;};}function removeEntity(_0x163123,_0x223b82){return function(_0x42b1e7){if(_0x42b1e7){return _0x42b1e7[_0xecfc('0x25')]()[_0xecfc('0x24')](function(){_0x163123[_0xecfc('0x18')](0xcc)[_0xecfc('0x26')]();});}};}function handleEntityNotFound(_0x4ba0f1,_0x2191fc){return function(_0x29909b){if(!_0x29909b){_0x4ba0f1[_0xecfc('0x17')](0x194);}return _0x29909b;};}function handleError(_0x307541,_0x30c4ad){_0x30c4ad=_0x30c4ad||0x1f4;return function(_0x23119c){logger['error'](_0x23119c[_0xecfc('0x27')]);if(_0x23119c[_0xecfc('0x28')]){delete _0x23119c[_0xecfc('0x28')];}_0x307541[_0xecfc('0x18')](_0x30c4ad)[_0xecfc('0x29')](_0x23119c);};}exports[_0xecfc('0x2a')]=function(_0x45b28a,_0x38ed92){var _0x3e1253={},_0x517a0f={},_0x456557={'count':0x0,'rows':[]};var _0x164c36=_[_0xecfc('0x2b')](db['FreshsalesField']['rawAttributes'],function(_0x5b8112){return{'name':_0x5b8112[_0xecfc('0x2c')],'type':_0x5b8112[_0xecfc('0x2d')][_0xecfc('0x2e')]};});_0x517a0f['model']=_[_0xecfc('0x2b')](_0x164c36,_0xecfc('0x28'));_0x517a0f[_0xecfc('0x2f')]=_[_0xecfc('0x30')](_0x45b28a[_0xecfc('0x2f')]);_0x517a0f[_0xecfc('0x31')]=_[_0xecfc('0x32')](_0x517a0f[_0xecfc('0x33')],_0x517a0f[_0xecfc('0x2f')]);_0x3e1253[_0xecfc('0x34')]=_[_0xecfc('0x32')](_0x517a0f['model'],qs['fields'](_0x45b28a[_0xecfc('0x2f')][_0xecfc('0x35')]));_0x3e1253[_0xecfc('0x34')]=_0x3e1253[_0xecfc('0x34')][_0xecfc('0x36')]?_0x3e1253[_0xecfc('0x34')]:_0x517a0f[_0xecfc('0x33')];if(!_0x45b28a[_0xecfc('0x2f')]['hasOwnProperty']('nolimit')){_0x3e1253[_0xecfc('0x1c')]=qs[_0xecfc('0x1c')](_0x45b28a['query'][_0xecfc('0x1c')]);_0x3e1253[_0xecfc('0x1a')]=qs['offset'](_0x45b28a[_0xecfc('0x2f')][_0xecfc('0x1a')]);}_0x3e1253[_0xecfc('0x37')]=qs[_0xecfc('0x38')](_0x45b28a[_0xecfc('0x2f')][_0xecfc('0x38')]);_0x3e1253[_0xecfc('0x39')]=qs[_0xecfc('0x31')](_[_0xecfc('0x3a')](_0x45b28a[_0xecfc('0x2f')],_0x517a0f[_0xecfc('0x31')]),_0x164c36);if(_0x45b28a[_0xecfc('0x2f')][_0xecfc('0x3b')]){_0x3e1253['where']=_[_0xecfc('0x3c')](_0x3e1253[_0xecfc('0x39')],{'$or':_[_0xecfc('0x2b')](_0x164c36,function(_0x214bc3){if(_0x214bc3[_0xecfc('0x2d')]!==_0xecfc('0x3d')){var _0x24ab2a={};_0x24ab2a[_0x214bc3[_0xecfc('0x28')]]={'$like':'%'+_0x45b28a['query'][_0xecfc('0x3b')]+'%'};return _0x24ab2a;}})});}_0x3e1253=_[_0xecfc('0x3c')]({},_0x3e1253,_0x45b28a['options']);var _0x3e7daa={'where':_0x3e1253[_0xecfc('0x39')]};return db[_0xecfc('0x3e')][_0xecfc('0x1d')](_0x3e7daa)[_0xecfc('0x24')](function(_0x5f4554){_0x456557[_0xecfc('0x1d')]=_0x5f4554;if(_0x45b28a[_0xecfc('0x2f')][_0xecfc('0x3f')]){_0x3e1253[_0xecfc('0x40')]=[{'all':!![]}];}return db[_0xecfc('0x3e')]['findAll'](_0x3e1253);})[_0xecfc('0x24')](function(_0x1578b2){_0x456557['rows']=_0x1578b2;return _0x456557;})[_0xecfc('0x24')](respondWithFilteredResult(_0x38ed92,_0x3e1253))[_0xecfc('0x41')](handleError(_0x38ed92,null));};exports[_0xecfc('0x42')]=function(_0x260f1e,_0x38d62e){var _0xcb5d04={'raw':!![],'where':{'id':_0x260f1e[_0xecfc('0x43')]['id']}},_0x232957={};_0x232957[_0xecfc('0x33')]=_['keys'](db[_0xecfc('0x3e')][_0xecfc('0x44')]);_0x232957[_0xecfc('0x2f')]=_['keys'](_0x260f1e[_0xecfc('0x2f')]);_0x232957['filters']=_[_0xecfc('0x32')](_0x232957['model'],_0x232957[_0xecfc('0x2f')]);_0xcb5d04[_0xecfc('0x34')]=_[_0xecfc('0x32')](_0x232957[_0xecfc('0x33')],qs[_0xecfc('0x35')](_0x260f1e['query'][_0xecfc('0x35')]));_0xcb5d04['attributes']=_0xcb5d04[_0xecfc('0x34')][_0xecfc('0x36')]?_0xcb5d04[_0xecfc('0x34')]:_0x232957[_0xecfc('0x33')];if(_0x260f1e[_0xecfc('0x2f')][_0xecfc('0x3f')]){_0xcb5d04[_0xecfc('0x40')]=[{'all':!![]}];}_0xcb5d04=_[_0xecfc('0x3c')]({},_0xcb5d04,_0x260f1e[_0xecfc('0x45')]);return db[_0xecfc('0x3e')]['find'](_0xcb5d04)['then'](handleEntityNotFound(_0x38d62e,null))[_0xecfc('0x24')](respondWithResult(_0x38d62e,null))[_0xecfc('0x41')](handleError(_0x38d62e,null));};exports[_0xecfc('0x46')]=function(_0x5ebe4d,_0x71cb18){return db[_0xecfc('0x3e')][_0xecfc('0x46')](_0x5ebe4d[_0xecfc('0x47')],{})[_0xecfc('0x24')](respondWithResult(_0x71cb18,0xc9))[_0xecfc('0x41')](handleError(_0x71cb18,null));};exports[_0xecfc('0x23')]=function(_0x384067,_0x1b3fb7){if(_0x384067[_0xecfc('0x47')]['id']){delete _0x384067['body']['id'];}return db['FreshsalesField'][_0xecfc('0x48')]({'where':{'id':_0x384067[_0xecfc('0x43')]['id']}})[_0xecfc('0x24')](handleEntityNotFound(_0x1b3fb7,null))[_0xecfc('0x24')](saveUpdates(_0x384067['body'],null))[_0xecfc('0x24')](respondWithResult(_0x1b3fb7,null))[_0xecfc('0x41')](handleError(_0x1b3fb7,null));};exports[_0xecfc('0x25')]=function(_0x25e1b9,_0x41e344){return db[_0xecfc('0x3e')]['find']({'where':{'id':_0x25e1b9['params']['id']}})[_0xecfc('0x24')](handleEntityNotFound(_0x41e344,null))[_0xecfc('0x24')](removeEntity(_0x41e344,null))[_0xecfc('0x41')](handleError(_0x41e344,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 4de21c9..067581c 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 _0xdfb1=['api','bluebird','request-promise','path','rimraf','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x568496,_0x565afd){var _0x26c5c1=function(_0x4d251e){while(--_0x4d251e){_0x568496['push'](_0x568496['shift']());}};_0x26c5c1(++_0x565afd);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x27d589,_0x41dd04){_0x27d589=_0x27d589-0x0;var _0x38cc29=_0xdfb1[_0x27d589];return _0x38cc29;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var logger=require(_0x1dfb('0x2'))(_0x1dfb('0x3'));var moment=require('moment');var BPromise=require(_0x1dfb('0x4'));var rp=require(_0x1dfb('0x5'));var fs=require('fs');var path=require(_0x1dfb('0x6'));var rimraf=require(_0x1dfb('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x31f0ff,_0x36bf77){return _0x31f0ff[_0x1dfb('0x8')]('FreshsalesField',attributes,{'tableName':_0x1dfb('0x9'),'paranoid':![],'indexes':[{'name':_0x1dfb('0xa'),'fields':[_0x1dfb('0xb'),_0x1dfb('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac35=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','freshsales_unique_index','idField'];(function(_0x3c17d5,_0x122680){var _0x303871=function(_0x5a5b77){while(--_0x5a5b77){_0x3c17d5['push'](_0x3c17d5['shift']());}};_0x303871(++_0x122680);}(_0xac35,0x141));var _0x5ac3=function(_0x50ac81,_0x12fdd3){_0x50ac81=_0x50ac81-0x0;var _0x3cccdd=_0xac35[_0x50ac81];return _0x3cccdd;};'use strict';var _=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var logger=require(_0x5ac3('0x2'))(_0x5ac3('0x3'));var moment=require(_0x5ac3('0x4'));var BPromise=require(_0x5ac3('0x5'));var rp=require(_0x5ac3('0x6'));var fs=require('fs');var path=require(_0x5ac3('0x7'));var rimraf=require(_0x5ac3('0x8'));var config=require(_0x5ac3('0x9'));var attributes=require(_0x5ac3('0xa'));module[_0x5ac3('0xb')]=function(_0x33a8f2,_0x13d4fb){return _0x33a8f2['define'](_0x5ac3('0xc'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x5ac3('0xd'),'fields':[_0x5ac3('0xe'),_0x5ac3('0xf')],'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 f8d781e..2284eb8 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 _0xeda8=['debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent'];(function(_0x3a1ff0,_0x778ffd){var _0x3f7f9e=function(_0x47715c){while(--_0x47715c){_0x3a1ff0['push'](_0x3a1ff0['shift']());}};_0x3f7f9e(++_0x778ffd);}(_0xeda8,0x104));var _0x8eda=function(_0x5696f3,_0x4a9618){_0x5696f3=_0x5696f3-0x0;var _0x5774e8=_0xeda8[_0x5696f3];return _0x5774e8;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32abe8,_0x4e2ebb,_0x28b721){return new BPromise(function(_0x1b6a1d,_0x5aa93d){return client[_0x8eda('0xd')](_0x32abe8,_0x28b721)['then'](function(_0x4f7893){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x8eda('0xe'));logger[_0x8eda('0xf')](_0x8eda('0x10'),_0x4e2ebb,'request\x20sent',JSON[_0x8eda('0x11')](_0x4f7893));if(_0x4f7893['error']){if(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x13')]===0x1f4){logger[_0x8eda('0x12')](_0x8eda('0x14'),_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x5aa93d(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x1b6a1d(_0x4f7893['error'][_0x8eda('0x15')]);}else{logger[_0x8eda('0x16')](_0x8eda('0x14'),_0x4e2ebb,'request\x20sent');_0x1b6a1d(_0x4f7893[_0x8eda('0x17')]['message']);}})[_0x8eda('0x18')](function(_0x553382){logger[_0x8eda('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x553382);_0x5aa93d(_0x553382);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x2b0a86,_0x2ecebd){var _0x955940=function(_0x1988f8){while(--_0x1988f8){_0x2b0a86['push'](_0x2b0a86['shift']());}};_0x955940(++_0x2ecebd);}(_0x687b,0x14a));var _0xb687=function(_0x3fb166,_0x4eb985){_0x3fb166=_0x3fb166-0x0;var _0x5e91be=_0x687b[_0x3fb166];return _0x5e91be;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index fda3f03..cda582a 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(_0x58e06d,_0x4a141e){var _0x3b475b=function(_0x515c77){while(--_0x515c77){_0x58e06d['push'](_0x58e06d['shift']());}};_0x3b475b(++_0x4a141e);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x44e69d,_0x458cbf){var _0x3fe73c=function(_0x4cbfab){while(--_0x4cbfab){_0x44e69d['push'](_0x44e69d['shift']());}};_0x3fe73c(++_0x458cbf);}(_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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 8d7aabf..b70cf9d 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 _0x80e6=['newTab','exports','STRING','username','ENUM','integrationTab'];(function(_0x16d8db,_0x6a1999){var _0x51ca48=function(_0x412e25){while(--_0x412e25){_0x16d8db['push'](_0x16d8db['shift']());}};_0x51ca48(++_0x6a1999);}(_0x80e6,0x1e7));var _0x680e=function(_0x20dd99,_0x5516d3){_0x20dd99=_0x20dd99-0x0;var _0x41548d=_0x80e6[_0x20dd99];return _0x41548d;};'use strict';var Sequelize=require('sequelize');module[_0x680e('0x0')]={'name':{'type':Sequelize[_0x680e('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x680e('0x1')],'unique':_0x680e('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x680e('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x680e('0x1')]},'securityToken':{'type':Sequelize[_0x680e('0x1')]},'serverUrl':{'type':Sequelize[_0x680e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x680e('0x3')](_0x680e('0x4'),_0x680e('0x5')),'defaultValue':_0x680e('0x4')}}; \ No newline at end of file +var _0x63a6=['exports','STRING','username','newTab','integrationTab'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x63a6,0x1c7));var _0x663a=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x63a6[_0x186376];return _0x2dbdd9;};'use strict';var Sequelize=require('sequelize');module[_0x663a('0x0')]={'name':{'type':Sequelize[_0x663a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x663a('0x1')],'unique':_0x663a('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x663a('0x1')]},'clientId':{'type':Sequelize[_0x663a('0x1')]},'clientSecret':{'type':Sequelize[_0x663a('0x1')]},'securityToken':{'type':Sequelize[_0x663a('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x663a('0x3')),'defaultValue':_0x663a('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 174fded..68901e1 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 _0xe3c7=['intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','SalesforceConfiguration','sort','nolimit','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','securityToken','lastIndexOf','Connection','clientSecret','login','username','password','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','picklist','boolean','email','textarea','includes','label','picklistValues','value','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x22f164,_0xaa4f80){var _0x51ab95=function(_0x190b68){while(--_0x190b68){_0x22f164['push'](_0x22f164['shift']());}};_0x51ab95(++_0xaa4f80);}(_0xe3c7,0xc0));var _0x7e3c=function(_0x434467,_0x2c6a75){_0x434467=_0x434467-0x0;var _0x5248ba=_0xe3c7[_0x434467];return _0x5248ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e3c('0x0'));var zipdir=require(_0x7e3c('0x1'));var jsonpatch=require(_0x7e3c('0x2'));var rp=require(_0x7e3c('0x3'));var moment=require(_0x7e3c('0x4'));var BPromise=require(_0x7e3c('0x5'));var Mustache=require('mustache');var util=require(_0x7e3c('0x6'));var path=require(_0x7e3c('0x7'));var sox=require(_0x7e3c('0x8'));var csv=require(_0x7e3c('0x9'));var ejs=require(_0x7e3c('0xa'));var fs=require('fs');var fs_extra=require(_0x7e3c('0xb'));var _=require(_0x7e3c('0xc'));var squel=require(_0x7e3c('0xd'));var crypto=require(_0x7e3c('0xe'));var jsforce=require(_0x7e3c('0xf'));var deskjs=require(_0x7e3c('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7e3c('0x11'));var authService=require(_0x7e3c('0x12'));var qs=require(_0x7e3c('0x13'));var as=require(_0x7e3c('0x14'));var hardwareService=require(_0x7e3c('0x15'));var logger=require(_0x7e3c('0x16'))(_0x7e3c('0x17'));var utils=require('../../config/utils');var config=require(_0x7e3c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7e3c('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x18738f,_0x515656){_0x515656=_0x515656||0xcc;return function(_0x1026bc){if(_0x1026bc){return _0x18738f['sendStatus'](_0x515656);}return _0x18738f[_0x7e3c('0x1a')](_0x515656)[_0x7e3c('0x1b')]();};}function respondWithResult(_0x31fa1f,_0x3e5e18){_0x3e5e18=_0x3e5e18||0xc8;return function(_0x5e9a46){if(_0x5e9a46){return _0x31fa1f[_0x7e3c('0x1a')](_0x3e5e18)['json'](_0x5e9a46);}};}function respondWithFilteredResult(_0x50ff16,_0x2972fe){return function(_0x456c1b){if(_0x456c1b){var _0x45c4c1=typeof _0x2972fe[_0x7e3c('0x1c')]===_0x7e3c('0x1d')&&typeof _0x2972fe[_0x7e3c('0x1e')]===_0x7e3c('0x1d');var _0x2ccfc2=_0x456c1b[_0x7e3c('0x1f')];var _0x38f198=_0x45c4c1?0x0:_0x2972fe[_0x7e3c('0x1c')];var _0x2cdb2b=_0x45c4c1?_0x456c1b[_0x7e3c('0x1f')]:_0x2972fe[_0x7e3c('0x1c')]+_0x2972fe[_0x7e3c('0x1e')];var _0x35cc83;if(_0x2cdb2b>=_0x2ccfc2){_0x2cdb2b=_0x2ccfc2;_0x35cc83=0xc8;}else{_0x35cc83=0xce;}_0x50ff16[_0x7e3c('0x1a')](_0x35cc83);return _0x50ff16['set'](_0x7e3c('0x20'),_0x38f198+'-'+_0x2cdb2b+'/'+_0x2ccfc2)['json'](_0x456c1b);}return null;};}function patchUpdates(_0x3d473b){return function(_0x499e0f){try{jsonpatch['apply'](_0x499e0f,_0x3d473b,!![]);}catch(_0x4874d2){return BPromise['reject'](_0x4874d2);}return _0x499e0f[_0x7e3c('0x21')]();};}function saveUpdates(_0x30f5d3,_0x50f82d){return function(_0x3bc37b){if(_0x3bc37b){return _0x3bc37b[_0x7e3c('0x22')](_0x30f5d3)[_0x7e3c('0x23')](function(_0x2c1dc2){return _0x2c1dc2;});}return null;};}function removeEntity(_0x1d062f,_0x44b00c){return function(_0x5dd714){if(_0x5dd714){return _0x5dd714[_0x7e3c('0x24')]()[_0x7e3c('0x23')](function(){_0x1d062f[_0x7e3c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12222f,_0x5e616b){return function(_0xce6de7){if(!_0xce6de7){_0x12222f[_0x7e3c('0x25')](0x194);}return _0xce6de7;};}function handleError(_0x1e918a,_0x21ea0c){_0x21ea0c=_0x21ea0c||0x1f4;return function(_0x14ac37){logger[_0x7e3c('0x26')](_0x14ac37[_0x7e3c('0x27')]);if(_0x14ac37[_0x7e3c('0x28')]){delete _0x14ac37['name'];}_0x1e918a[_0x7e3c('0x1a')](_0x21ea0c)['send'](_0x14ac37);};}exports['index']=function(_0x2e69fc,_0x4877e0){var _0x5dd691={},_0x33926f={},_0x51adac={'count':0x0,'rows':[]};var _0x43e05c=_[_0x7e3c('0x29')](db[_0x7e3c('0x2a')][_0x7e3c('0x2b')],function(_0x378f9f){return{'name':_0x378f9f[_0x7e3c('0x2c')],'type':_0x378f9f[_0x7e3c('0x2d')]['key']};});_0x33926f[_0x7e3c('0x2e')]=_[_0x7e3c('0x29')](_0x43e05c,'name');_0x33926f[_0x7e3c('0x2f')]=_[_0x7e3c('0x30')](_0x2e69fc['query']);_0x33926f[_0x7e3c('0x31')]=_[_0x7e3c('0x32')](_0x33926f[_0x7e3c('0x2e')],_0x33926f['query']);_0x5dd691[_0x7e3c('0x33')]=_['intersection'](_0x33926f[_0x7e3c('0x2e')],qs[_0x7e3c('0x34')](_0x2e69fc[_0x7e3c('0x2f')][_0x7e3c('0x34')]));_0x5dd691['attributes']=_0x5dd691['attributes'][_0x7e3c('0x35')]?_0x5dd691[_0x7e3c('0x33')]:_0x33926f[_0x7e3c('0x2e')];if(!_0x2e69fc[_0x7e3c('0x2f')][_0x7e3c('0x36')]('nolimit')){_0x5dd691[_0x7e3c('0x1e')]=qs[_0x7e3c('0x1e')](_0x2e69fc['query']['limit']);_0x5dd691[_0x7e3c('0x1c')]=qs[_0x7e3c('0x1c')](_0x2e69fc[_0x7e3c('0x2f')][_0x7e3c('0x1c')]);}_0x5dd691[_0x7e3c('0x37')]=qs['sort'](_0x2e69fc[_0x7e3c('0x2f')]['sort']);_0x5dd691[_0x7e3c('0x38')]=qs[_0x7e3c('0x31')](_[_0x7e3c('0x39')](_0x2e69fc[_0x7e3c('0x2f')],_0x33926f[_0x7e3c('0x31')]),_0x43e05c);if(_0x2e69fc[_0x7e3c('0x2f')][_0x7e3c('0x3a')]){_0x5dd691[_0x7e3c('0x38')]=_[_0x7e3c('0x3b')](_0x5dd691[_0x7e3c('0x38')],{'$or':_[_0x7e3c('0x29')](_0x43e05c,function(_0x1c3f34){if(_0x1c3f34['type']!==_0x7e3c('0x3c')){var _0xf039a={};_0xf039a[_0x1c3f34[_0x7e3c('0x28')]]={'$like':'%'+_0x2e69fc[_0x7e3c('0x2f')][_0x7e3c('0x3a')]+'%'};return _0xf039a;}})});}_0x5dd691=_[_0x7e3c('0x3b')]({},_0x5dd691,_0x2e69fc[_0x7e3c('0x3d')]);var _0x15ec95={'where':_0x5dd691['where']};return db[_0x7e3c('0x2a')][_0x7e3c('0x1f')](_0x15ec95)[_0x7e3c('0x23')](function(_0x11a131){_0x51adac['count']=_0x11a131;if(_0x2e69fc[_0x7e3c('0x2f')][_0x7e3c('0x3e')]){_0x5dd691[_0x7e3c('0x3f')]=[{'all':!![]}];}return db[_0x7e3c('0x2a')]['findAll'](_0x5dd691);})[_0x7e3c('0x23')](function(_0x4e4cb5){_0x51adac[_0x7e3c('0x40')]=_0x4e4cb5;return _0x51adac;})['then'](respondWithFilteredResult(_0x4877e0,_0x5dd691))[_0x7e3c('0x41')](handleError(_0x4877e0,null));};exports[_0x7e3c('0x42')]=function(_0x15777d,_0x57a843){var _0x2bf405={'raw':![],'where':{'id':_0x15777d[_0x7e3c('0x43')]['id']}},_0x1b09ed={};_0x1b09ed['model']=_[_0x7e3c('0x30')](db['SalesforceAccount'][_0x7e3c('0x2b')]);_0x1b09ed['query']=_[_0x7e3c('0x30')](_0x15777d['query']);_0x1b09ed[_0x7e3c('0x31')]=_['intersection'](_0x1b09ed[_0x7e3c('0x2e')],_0x1b09ed[_0x7e3c('0x2f')]);_0x2bf405[_0x7e3c('0x33')]=_[_0x7e3c('0x32')](_0x1b09ed[_0x7e3c('0x2e')],qs[_0x7e3c('0x34')](_0x15777d[_0x7e3c('0x2f')][_0x7e3c('0x34')]));_0x2bf405[_0x7e3c('0x33')]=_0x2bf405[_0x7e3c('0x33')][_0x7e3c('0x35')]?_0x2bf405[_0x7e3c('0x33')]:_0x1b09ed['model'];if(_0x15777d[_0x7e3c('0x2f')][_0x7e3c('0x3e')]){_0x2bf405[_0x7e3c('0x3f')]=[{'all':!![]}];}_0x2bf405=_[_0x7e3c('0x3b')]({},_0x2bf405,_0x15777d[_0x7e3c('0x3d')]);return db[_0x7e3c('0x2a')]['find'](_0x2bf405)[_0x7e3c('0x23')](handleEntityNotFound(_0x57a843,null))[_0x7e3c('0x23')](respondWithResult(_0x57a843,null))[_0x7e3c('0x41')](handleError(_0x57a843,null));};exports[_0x7e3c('0x44')]=function(_0x5801d2,_0x1bea6a){return db[_0x7e3c('0x2a')]['create'](_0x5801d2['body'],{})['then'](respondWithResult(_0x1bea6a,0xc9))[_0x7e3c('0x41')](handleError(_0x1bea6a,null));};exports['update']=function(_0xc428ea,_0x10a978){if(_0xc428ea[_0x7e3c('0x45')]['id']){delete _0xc428ea[_0x7e3c('0x45')]['id'];}return db[_0x7e3c('0x2a')]['find']({'where':{'id':_0xc428ea['params']['id']}})['then'](handleEntityNotFound(_0x10a978,null))[_0x7e3c('0x23')](saveUpdates(_0xc428ea['body'],null))[_0x7e3c('0x23')](respondWithResult(_0x10a978,null))[_0x7e3c('0x41')](handleError(_0x10a978,null));};exports['destroy']=function(_0x3216bb,_0x24d5f9){return db[_0x7e3c('0x2a')][_0x7e3c('0x46')]({'where':{'id':_0x3216bb[_0x7e3c('0x43')]['id']}})[_0x7e3c('0x23')](handleEntityNotFound(_0x24d5f9,null))['then'](removeEntity(_0x24d5f9,null))[_0x7e3c('0x41')](handleError(_0x24d5f9,null));};exports['getConfigurations']=function(_0x39c67f,_0x2b6114,_0xc461ad){var _0x59fb98={};var _0x35da5c={};var _0x2d5b47;var _0x58fc06;return db[_0x7e3c('0x2a')]['findOne']({'where':{'id':_0x39c67f[_0x7e3c('0x43')]['id']}})['then'](handleEntityNotFound(_0x2b6114,null))['then'](function(_0x3dbfe3){if(_0x3dbfe3){_0x2d5b47=_0x3dbfe3;_0x35da5c[_0x7e3c('0x2e')]=_[_0x7e3c('0x30')](db[_0x7e3c('0x47')][_0x7e3c('0x2b')]);_0x35da5c['query']=_[_0x7e3c('0x30')](_0x39c67f['query']);_0x35da5c[_0x7e3c('0x31')]=_[_0x7e3c('0x32')](_0x35da5c[_0x7e3c('0x2e')],_0x35da5c[_0x7e3c('0x2f')]);_0x59fb98[_0x7e3c('0x33')]=_[_0x7e3c('0x32')](_0x35da5c[_0x7e3c('0x2e')],qs['fields'](_0x39c67f[_0x7e3c('0x2f')]['fields']));_0x59fb98['attributes']=_0x59fb98[_0x7e3c('0x33')][_0x7e3c('0x35')]?_0x59fb98[_0x7e3c('0x33')]:_0x35da5c['model'];_0x59fb98[_0x7e3c('0x37')]=qs[_0x7e3c('0x48')](_0x39c67f[_0x7e3c('0x2f')][_0x7e3c('0x48')]);_0x59fb98['where']=qs[_0x7e3c('0x31')](_[_0x7e3c('0x39')](_0x39c67f[_0x7e3c('0x2f')],_0x35da5c[_0x7e3c('0x31')]));if(_0x39c67f[_0x7e3c('0x2f')][_0x7e3c('0x3a')]){_0x59fb98[_0x7e3c('0x38')]=_[_0x7e3c('0x3b')](_0x59fb98['where'],{'$or':_[_0x7e3c('0x29')](_0x59fb98[_0x7e3c('0x33')],function(_0x1b71c6){var _0x223dde={};_0x223dde[_0x1b71c6]={'$like':'%'+_0x39c67f[_0x7e3c('0x2f')]['filter']+'%'};return _0x223dde;})});}_0x59fb98=_[_0x7e3c('0x3b')]({},_0x59fb98,_0x39c67f[_0x7e3c('0x3d')]);return _0x2d5b47['getConfigurations'](_0x59fb98);}})[_0x7e3c('0x23')](function(_0x2f9892){if(_0x2f9892){_0x58fc06=_0x2f9892['length'];if(!_0x39c67f[_0x7e3c('0x2f')]['hasOwnProperty'](_0x7e3c('0x49'))){_0x59fb98['limit']=qs[_0x7e3c('0x1e')](_0x39c67f[_0x7e3c('0x2f')][_0x7e3c('0x1e')]);_0x59fb98[_0x7e3c('0x1c')]=qs[_0x7e3c('0x1c')](_0x39c67f['query'][_0x7e3c('0x1c')]);}return _0x2d5b47[_0x7e3c('0x4a')](_0x59fb98);}})[_0x7e3c('0x23')](function(_0xcaded5){if(_0xcaded5){return _0xcaded5?{'count':_0x58fc06,'rows':_0xcaded5}:null;}})[_0x7e3c('0x23')](respondWithResult(_0x2b6114,null))[_0x7e3c('0x41')](handleError(_0x2b6114,null));};exports[_0x7e3c('0x4b')]=function(_0x4370ee,_0x2c5a83,_0x4042c8){if(_0x4370ee[_0x7e3c('0x45')]['id']){delete _0x4370ee[_0x7e3c('0x45')]['id'];}return db['SalesforceAccount'][_0x7e3c('0x4c')]({'where':{'id':_0x4370ee[_0x7e3c('0x43')]['id']}})[_0x7e3c('0x23')](handleEntityNotFound(_0x2c5a83,null))[_0x7e3c('0x23')](function(_0x537d48){if(_0x537d48){_0x4370ee['body'][_0x7e3c('0x4d')]=_0x537d48['id'];_0x4370ee[_0x7e3c('0x45')][_0x7e3c('0x4e')]=integrations[_0x7e3c('0x4f')](_0x4370ee[_0x7e3c('0x45')][_0x7e3c('0x50')],_0x4370ee[_0x7e3c('0x45')][_0x7e3c('0x2d')]);_0x4370ee['body'][_0x7e3c('0x51')]=integrations[_0x7e3c('0x52')](_0x4370ee[_0x7e3c('0x45')][_0x7e3c('0x50')],_0x4370ee['body'][_0x7e3c('0x2d')]);return db[_0x7e3c('0x47')][_0x7e3c('0x44')](_0x4370ee[_0x7e3c('0x45')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x7e3c('0x53')],'as':_0x7e3c('0x51')}]});}return null;})[_0x7e3c('0x23')](respondWithResult(_0x2c5a83,null))[_0x7e3c('0x41')](handleError(_0x2c5a83,null));};exports[_0x7e3c('0x54')]=function(_0x4afc99,_0x392ea1,_0x1046ae){var _0x7ead4e;var _0x14a780='';var _0x110675=_0x7e3c('0x55');return db[_0x7e3c('0x2a')][_0x7e3c('0x4c')]({'where':{'id':_0x4afc99[_0x7e3c('0x43')]['id']},'attributes':['id',_0x7e3c('0x56'),_0x7e3c('0x57'),'clientSecret','username','password',_0x7e3c('0x58')]})[_0x7e3c('0x23')](handleEntityNotFound(_0x392ea1,null))[_0x7e3c('0x23')](function(_0x1a4714){if(_0x1a4714){_0x14a780=_0x1a4714['remoteUri'];var _0x4c2dd2=_0x14a780['slice'](-0x1);if(_0x4c2dd2==='/'){_0x14a780=_0x14a780['substring'](0x0,_0x14a780[_0x7e3c('0x59')](_0x4c2dd2));}_0x7ead4e=new jsforce[(_0x7e3c('0x5a'))]({'oauth2':{'loginUrl':_0x14a780,'clientId':_0x1a4714[_0x7e3c('0x57')],'clientSecret':_0x1a4714[_0x7e3c('0x5b')]}});return _0x7ead4e[_0x7e3c('0x5c')](_0x1a4714[_0x7e3c('0x5d')],_0x1a4714[_0x7e3c('0x5e')][_0x7e3c('0x5f')](_0x1a4714[_0x7e3c('0x58')]));}})['then'](function(_0x386b64){if(_0x386b64){if(!_[_0x7e3c('0x60')](_0x4afc99[_0x7e3c('0x2f')][_0x7e3c('0x61')])){_0x110675=_0x4afc99[_0x7e3c('0x2f')]['ticketType'];}return _0x7ead4e[_0x7e3c('0x62')](_0x110675)[_0x7e3c('0x63')]();}})[_0x7e3c('0x23')](function(_0x330339){var _0x1f0a74=[_0x7e3c('0x64'),'ActivityDate',_0x7e3c('0x65'),_0x7e3c('0x66'),_0x7e3c('0x67'),_0x7e3c('0x68')];var _0x46e6b5=['string','int',_0x7e3c('0x69'),_0x7e3c('0x6a'),_0x7e3c('0x6b'),_0x7e3c('0x6c'),'phone'];if(_0x330339){_['remove'](_0x330339['fields'],function(_0x117468){return _0x1f0a74[_0x7e3c('0x6d')](_0x117468['name'])||!_0x46e6b5[_0x7e3c('0x6d')](_0x117468[_0x7e3c('0x2d')]);});return{'count':_0x330339[_0x7e3c('0x34')][_0x7e3c('0x35')],'rows':_[_0x7e3c('0x29')](_0x330339[_0x7e3c('0x34')],function(_0x48025c){return{'id':_0x48025c['name'],'name':_0x48025c[_0x7e3c('0x6e')],'custom':_0x48025c['custom'],'options':_0x48025c['picklistValues']['length']>0x0?_[_0x7e3c('0x29')](_0x48025c[_0x7e3c('0x6f')],function(_0x35c02a){return{'name':_0x35c02a[_0x7e3c('0x6e')],'value':_0x35c02a[_0x7e3c('0x70')]};}):_0x48025c[_0x7e3c('0x2d')]==_0x7e3c('0x6a')?[{'name':'True','value':_0x7e3c('0x71')},{'name':_0x7e3c('0x72'),'value':_0x7e3c('0x73')}]:[]};})};}})[_0x7e3c('0x23')](respondWithResult(_0x392ea1,null))[_0x7e3c('0x41')](function(_0x17d9ee){var _0x116fa4=_0x4afc99[_0x7e3c('0x2f')]['test']?0x1f4:_0x17d9ee[_0x7e3c('0x74')]||0x1f4;logger[_0x7e3c('0x26')](_0x7e3c('0x75'),_0x7e3c('0x54'),_0x116fa4,JSON[_0x7e3c('0x76')](_0x17d9ee));delete _0x17d9ee['name'];if(_0x116fa4===0x191){_0x116fa4=0x190;}_0x392ea1[_0x7e3c('0x1a')](_0x116fa4)['send'](_0x4afc99[_0x7e3c('0x2f')][_0x7e3c('0x77')]?{'message':_0x7e3c('0x78'),'statusCode':_0x17d9ee[_0x7e3c('0x74')]}:_0x17d9ee);});}; \ No newline at end of file +var _0xa14c=['body','getConfigurations','SalesforceConfiguration','order','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','substring','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','int','boolean','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','stack','name','index','map','SalesforceAccount','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','include','rows','show','params','rawAttributes','length','includeAll','options','find','catch','create'];(function(_0x3c72a1,_0x445c80){var _0xe72556=function(_0x52a0c1){while(--_0x52a0c1){_0x3c72a1['push'](_0x3c72a1['shift']());}};_0xe72556(++_0x445c80);}(_0xa14c,0xae));var _0xca14=function(_0x3fc097,_0x22d7a2){_0x3fc097=_0x3fc097-0x0;var _0x13e81a=_0xa14c[_0x3fc097];return _0x13e81a;};'use strict';var emlformat=require(_0xca14('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca14('0x1'));var jsonpatch=require(_0xca14('0x2'));var rp=require(_0xca14('0x3'));var moment=require(_0xca14('0x4'));var BPromise=require(_0xca14('0x5'));var Mustache=require(_0xca14('0x6'));var util=require('util');var path=require(_0xca14('0x7'));var sox=require(_0xca14('0x8'));var csv=require(_0xca14('0x9'));var ejs=require(_0xca14('0xa'));var fs=require('fs');var fs_extra=require(_0xca14('0xb'));var _=require(_0xca14('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xca14('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xca14('0x9'));var querystring=require(_0xca14('0xe'));var Papa=require(_0xca14('0xf'));var Redis=require('ioredis');var authService=require(_0xca14('0x10'));var qs=require(_0xca14('0x11'));var as=require(_0xca14('0x12'));var hardwareService=require(_0xca14('0x13'));var logger=require(_0xca14('0x14'))(_0xca14('0x15'));var utils=require(_0xca14('0x16'));var config=require(_0xca14('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xca14('0x18'))['db'];var integrations=require(_0xca14('0x19'));function respondWithStatusCode(_0x58fc77,_0x1b7b05){_0x1b7b05=_0x1b7b05||0xcc;return function(_0x55b5fc){if(_0x55b5fc){return _0x58fc77[_0xca14('0x1a')](_0x1b7b05);}return _0x58fc77[_0xca14('0x1b')](_0x1b7b05)[_0xca14('0x1c')]();};}function respondWithResult(_0x1e63c7,_0x4e006e){_0x4e006e=_0x4e006e||0xc8;return function(_0x1fdf7f){if(_0x1fdf7f){return _0x1e63c7['status'](_0x4e006e)[_0xca14('0x1d')](_0x1fdf7f);}};}function respondWithFilteredResult(_0x8f1b1f,_0x386e24){return function(_0x205e63){if(_0x205e63){var _0x89d8b3=typeof _0x386e24[_0xca14('0x1e')]===_0xca14('0x1f')&&typeof _0x386e24[_0xca14('0x20')]===_0xca14('0x1f');var _0x3a5411=_0x205e63[_0xca14('0x21')];var _0x73e831=_0x89d8b3?0x0:_0x386e24[_0xca14('0x1e')];var _0x26458b=_0x89d8b3?_0x205e63[_0xca14('0x21')]:_0x386e24[_0xca14('0x1e')]+_0x386e24[_0xca14('0x20')];var _0x27aabe;if(_0x26458b>=_0x3a5411){_0x26458b=_0x3a5411;_0x27aabe=0xc8;}else{_0x27aabe=0xce;}_0x8f1b1f[_0xca14('0x1b')](_0x27aabe);return _0x8f1b1f[_0xca14('0x22')](_0xca14('0x23'),_0x73e831+'-'+_0x26458b+'/'+_0x3a5411)[_0xca14('0x1d')](_0x205e63);}return null;};}function patchUpdates(_0x96dadf){return function(_0x55dcf1){try{jsonpatch['apply'](_0x55dcf1,_0x96dadf,!![]);}catch(_0x292a08){return BPromise['reject'](_0x292a08);}return _0x55dcf1[_0xca14('0x24')]();};}function saveUpdates(_0x16aba9,_0x11886b){return function(_0x2a6893){if(_0x2a6893){return _0x2a6893[_0xca14('0x25')](_0x16aba9)[_0xca14('0x26')](function(_0x5e7e42){return _0x5e7e42;});}return null;};}function removeEntity(_0x3d7520,_0x176943){return function(_0x352ea6){if(_0x352ea6){return _0x352ea6[_0xca14('0x27')]()['then'](function(){_0x3d7520[_0xca14('0x1b')](0xcc)[_0xca14('0x1c')]();});}};}function handleEntityNotFound(_0x2702aa,_0x1e095a){return function(_0x25b612){if(!_0x25b612){_0x2702aa['sendStatus'](0x194);}return _0x25b612;};}function handleError(_0x1651d1,_0x1cfd9a){_0x1cfd9a=_0x1cfd9a||0x1f4;return function(_0x1c5dfa){logger['error'](_0x1c5dfa[_0xca14('0x28')]);if(_0x1c5dfa[_0xca14('0x29')]){delete _0x1c5dfa[_0xca14('0x29')];}_0x1651d1[_0xca14('0x1b')](_0x1cfd9a)['send'](_0x1c5dfa);};}exports[_0xca14('0x2a')]=function(_0x28b3c1,_0x2a075d){var _0x52bf2d={},_0x4e7e4b={},_0x5a919c={'count':0x0,'rows':[]};var _0x397476=_[_0xca14('0x2b')](db[_0xca14('0x2c')]['rawAttributes'],function(_0x163fdb){return{'name':_0x163fdb['fieldName'],'type':_0x163fdb[_0xca14('0x2d')]['key']};});_0x4e7e4b[_0xca14('0x2e')]=_[_0xca14('0x2b')](_0x397476,_0xca14('0x29'));_0x4e7e4b[_0xca14('0x2f')]=_[_0xca14('0x30')](_0x28b3c1['query']);_0x4e7e4b[_0xca14('0x31')]=_[_0xca14('0x32')](_0x4e7e4b[_0xca14('0x2e')],_0x4e7e4b['query']);_0x52bf2d[_0xca14('0x33')]=_[_0xca14('0x32')](_0x4e7e4b[_0xca14('0x2e')],qs[_0xca14('0x34')](_0x28b3c1[_0xca14('0x2f')][_0xca14('0x34')]));_0x52bf2d[_0xca14('0x33')]=_0x52bf2d[_0xca14('0x33')]['length']?_0x52bf2d[_0xca14('0x33')]:_0x4e7e4b[_0xca14('0x2e')];if(!_0x28b3c1['query'][_0xca14('0x35')](_0xca14('0x36'))){_0x52bf2d[_0xca14('0x20')]=qs[_0xca14('0x20')](_0x28b3c1[_0xca14('0x2f')][_0xca14('0x20')]);_0x52bf2d[_0xca14('0x1e')]=qs[_0xca14('0x1e')](_0x28b3c1[_0xca14('0x2f')][_0xca14('0x1e')]);}_0x52bf2d['order']=qs[_0xca14('0x37')](_0x28b3c1['query']['sort']);_0x52bf2d['where']=qs[_0xca14('0x31')](_[_0xca14('0x38')](_0x28b3c1[_0xca14('0x2f')],_0x4e7e4b[_0xca14('0x31')]),_0x397476);if(_0x28b3c1['query'][_0xca14('0x39')]){_0x52bf2d[_0xca14('0x3a')]=_[_0xca14('0x3b')](_0x52bf2d[_0xca14('0x3a')],{'$or':_[_0xca14('0x2b')](_0x397476,function(_0x2ca917){if(_0x2ca917[_0xca14('0x2d')]!==_0xca14('0x3c')){var _0x3a6f5c={};_0x3a6f5c[_0x2ca917[_0xca14('0x29')]]={'$like':'%'+_0x28b3c1['query'][_0xca14('0x39')]+'%'};return _0x3a6f5c;}})});}_0x52bf2d=_[_0xca14('0x3b')]({},_0x52bf2d,_0x28b3c1['options']);var _0x53357d={'where':_0x52bf2d[_0xca14('0x3a')]};return db['SalesforceAccount']['count'](_0x53357d)[_0xca14('0x26')](function(_0x2c0c97){_0x5a919c[_0xca14('0x21')]=_0x2c0c97;if(_0x28b3c1['query']['includeAll']){_0x52bf2d[_0xca14('0x3d')]=[{'all':!![]}];}return db[_0xca14('0x2c')]['findAll'](_0x52bf2d);})[_0xca14('0x26')](function(_0x519a5b){_0x5a919c[_0xca14('0x3e')]=_0x519a5b;return _0x5a919c;})[_0xca14('0x26')](respondWithFilteredResult(_0x2a075d,_0x52bf2d))['catch'](handleError(_0x2a075d,null));};exports[_0xca14('0x3f')]=function(_0x2b5304,_0x3d7605){var _0x46e1b6={'raw':![],'where':{'id':_0x2b5304[_0xca14('0x40')]['id']}},_0x48af29={};_0x48af29[_0xca14('0x2e')]=_[_0xca14('0x30')](db['SalesforceAccount'][_0xca14('0x41')]);_0x48af29['query']=_[_0xca14('0x30')](_0x2b5304[_0xca14('0x2f')]);_0x48af29[_0xca14('0x31')]=_[_0xca14('0x32')](_0x48af29[_0xca14('0x2e')],_0x48af29[_0xca14('0x2f')]);_0x46e1b6[_0xca14('0x33')]=_[_0xca14('0x32')](_0x48af29[_0xca14('0x2e')],qs[_0xca14('0x34')](_0x2b5304[_0xca14('0x2f')][_0xca14('0x34')]));_0x46e1b6[_0xca14('0x33')]=_0x46e1b6[_0xca14('0x33')][_0xca14('0x42')]?_0x46e1b6['attributes']:_0x48af29[_0xca14('0x2e')];if(_0x2b5304['query'][_0xca14('0x43')]){_0x46e1b6[_0xca14('0x3d')]=[{'all':!![]}];}_0x46e1b6=_['merge']({},_0x46e1b6,_0x2b5304[_0xca14('0x44')]);return db[_0xca14('0x2c')][_0xca14('0x45')](_0x46e1b6)[_0xca14('0x26')](handleEntityNotFound(_0x3d7605,null))[_0xca14('0x26')](respondWithResult(_0x3d7605,null))[_0xca14('0x46')](handleError(_0x3d7605,null));};exports['create']=function(_0x1101b8,_0x6a5bb4){return db[_0xca14('0x2c')][_0xca14('0x47')](_0x1101b8[_0xca14('0x48')],{})[_0xca14('0x26')](respondWithResult(_0x6a5bb4,0xc9))[_0xca14('0x46')](handleError(_0x6a5bb4,null));};exports[_0xca14('0x25')]=function(_0x1d1aff,_0x281010){if(_0x1d1aff[_0xca14('0x48')]['id']){delete _0x1d1aff[_0xca14('0x48')]['id'];}return db[_0xca14('0x2c')][_0xca14('0x45')]({'where':{'id':_0x1d1aff[_0xca14('0x40')]['id']}})[_0xca14('0x26')](handleEntityNotFound(_0x281010,null))[_0xca14('0x26')](saveUpdates(_0x1d1aff['body'],null))[_0xca14('0x26')](respondWithResult(_0x281010,null))[_0xca14('0x46')](handleError(_0x281010,null));};exports[_0xca14('0x27')]=function(_0x17d9d7,_0x5db264){return db['SalesforceAccount'][_0xca14('0x45')]({'where':{'id':_0x17d9d7[_0xca14('0x40')]['id']}})[_0xca14('0x26')](handleEntityNotFound(_0x5db264,null))[_0xca14('0x26')](removeEntity(_0x5db264,null))[_0xca14('0x46')](handleError(_0x5db264,null));};exports[_0xca14('0x49')]=function(_0xecda0e,_0x25637c,_0x45cac7){var _0x37cb1a={};var _0x29e7d0={};var _0x5d2de5;var _0x1ebe39;return db['SalesforceAccount']['findOne']({'where':{'id':_0xecda0e[_0xca14('0x40')]['id']}})['then'](handleEntityNotFound(_0x25637c,null))[_0xca14('0x26')](function(_0x52fe23){if(_0x52fe23){_0x5d2de5=_0x52fe23;_0x29e7d0['model']=_[_0xca14('0x30')](db[_0xca14('0x4a')][_0xca14('0x41')]);_0x29e7d0[_0xca14('0x2f')]=_[_0xca14('0x30')](_0xecda0e['query']);_0x29e7d0[_0xca14('0x31')]=_[_0xca14('0x32')](_0x29e7d0['model'],_0x29e7d0['query']);_0x37cb1a[_0xca14('0x33')]=_[_0xca14('0x32')](_0x29e7d0[_0xca14('0x2e')],qs[_0xca14('0x34')](_0xecda0e[_0xca14('0x2f')][_0xca14('0x34')]));_0x37cb1a[_0xca14('0x33')]=_0x37cb1a[_0xca14('0x33')][_0xca14('0x42')]?_0x37cb1a[_0xca14('0x33')]:_0x29e7d0[_0xca14('0x2e')];_0x37cb1a[_0xca14('0x4b')]=qs[_0xca14('0x37')](_0xecda0e['query'][_0xca14('0x37')]);_0x37cb1a[_0xca14('0x3a')]=qs['filters'](_['pick'](_0xecda0e['query'],_0x29e7d0[_0xca14('0x31')]));if(_0xecda0e['query'][_0xca14('0x39')]){_0x37cb1a['where']=_['merge'](_0x37cb1a['where'],{'$or':_['map'](_0x37cb1a[_0xca14('0x33')],function(_0x51a95b){var _0x56b638={};_0x56b638[_0x51a95b]={'$like':'%'+_0xecda0e[_0xca14('0x2f')][_0xca14('0x39')]+'%'};return _0x56b638;})});}_0x37cb1a=_[_0xca14('0x3b')]({},_0x37cb1a,_0xecda0e[_0xca14('0x44')]);return _0x5d2de5[_0xca14('0x49')](_0x37cb1a);}})[_0xca14('0x26')](function(_0x1c0280){if(_0x1c0280){_0x1ebe39=_0x1c0280[_0xca14('0x42')];if(!_0xecda0e[_0xca14('0x2f')][_0xca14('0x35')](_0xca14('0x36'))){_0x37cb1a[_0xca14('0x20')]=qs[_0xca14('0x20')](_0xecda0e[_0xca14('0x2f')][_0xca14('0x20')]);_0x37cb1a[_0xca14('0x1e')]=qs[_0xca14('0x1e')](_0xecda0e[_0xca14('0x2f')][_0xca14('0x1e')]);}return _0x5d2de5[_0xca14('0x49')](_0x37cb1a);}})[_0xca14('0x26')](function(_0x33a685){if(_0x33a685){return _0x33a685?{'count':_0x1ebe39,'rows':_0x33a685}:null;}})[_0xca14('0x26')](respondWithResult(_0x25637c,null))[_0xca14('0x46')](handleError(_0x25637c,null));};exports['addConfiguration']=function(_0xf9f8b4,_0x1c4eea,_0x4b38e7){if(_0xf9f8b4[_0xca14('0x48')]['id']){delete _0xf9f8b4[_0xca14('0x48')]['id'];}return db[_0xca14('0x2c')][_0xca14('0x4c')]({'where':{'id':_0xf9f8b4[_0xca14('0x40')]['id']}})[_0xca14('0x26')](handleEntityNotFound(_0x1c4eea,null))[_0xca14('0x26')](function(_0x190f70){if(_0x190f70){_0xf9f8b4[_0xca14('0x48')][_0xca14('0x4d')]=_0x190f70['id'];_0xf9f8b4[_0xca14('0x48')]['Subjects']=integrations[_0xca14('0x4e')](_0xf9f8b4[_0xca14('0x48')][_0xca14('0x4f')],_0xf9f8b4[_0xca14('0x48')][_0xca14('0x2d')]);_0xf9f8b4['body'][_0xca14('0x50')]=integrations[_0xca14('0x51')](_0xf9f8b4[_0xca14('0x48')][_0xca14('0x4f')],_0xf9f8b4['body'][_0xca14('0x2d')]);return db['SalesforceConfiguration'][_0xca14('0x47')](_0xf9f8b4['body'],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0xca14('0x52')],'as':_0xca14('0x50')}]});}return null;})[_0xca14('0x26')](respondWithResult(_0x1c4eea,null))[_0xca14('0x46')](handleError(_0x1c4eea,null));};exports[_0xca14('0x53')]=function(_0x34e892,_0x130396,_0x29d41a){var _0x14890b;var _0x3f448d='';var _0x507592=_0xca14('0x54');return db[_0xca14('0x2c')][_0xca14('0x4c')]({'where':{'id':_0x34e892[_0xca14('0x40')]['id']},'attributes':['id',_0xca14('0x55'),'clientId',_0xca14('0x56'),_0xca14('0x57'),_0xca14('0x58'),_0xca14('0x59')]})[_0xca14('0x26')](handleEntityNotFound(_0x130396,null))[_0xca14('0x26')](function(_0x29dde9){if(_0x29dde9){_0x3f448d=_0x29dde9[_0xca14('0x55')];var _0x3b756c=_0x3f448d['slice'](-0x1);if(_0x3b756c==='/'){_0x3f448d=_0x3f448d[_0xca14('0x5a')](0x0,_0x3f448d['lastIndexOf'](_0x3b756c));}_0x14890b=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3f448d,'clientId':_0x29dde9['clientId'],'clientSecret':_0x29dde9[_0xca14('0x56')]}});return _0x14890b[_0xca14('0x5b')](_0x29dde9[_0xca14('0x57')],_0x29dde9[_0xca14('0x58')][_0xca14('0x5c')](_0x29dde9['securityToken']));}})['then'](function(_0x5b7a4e){if(_0x5b7a4e){if(!_[_0xca14('0x5d')](_0x34e892[_0xca14('0x2f')][_0xca14('0x5e')])){_0x507592=_0x34e892[_0xca14('0x2f')]['ticketType'];}return _0x14890b[_0xca14('0x5f')](_0x507592)[_0xca14('0x60')]();}})[_0xca14('0x26')](function(_0x59157b){var _0x42082e=[_0xca14('0x61'),_0xca14('0x62'),_0xca14('0x63'),'IsRecurrence',_0xca14('0x64'),_0xca14('0x65')];var _0x345700=[_0xca14('0x66'),_0xca14('0x67'),'picklist',_0xca14('0x68'),'email','textarea',_0xca14('0x69')];if(_0x59157b){_[_0xca14('0x6a')](_0x59157b[_0xca14('0x34')],function(_0x115809){return _0x42082e[_0xca14('0x6b')](_0x115809[_0xca14('0x29')])||!_0x345700[_0xca14('0x6b')](_0x115809[_0xca14('0x2d')]);});return{'count':_0x59157b[_0xca14('0x34')][_0xca14('0x42')],'rows':_[_0xca14('0x2b')](_0x59157b[_0xca14('0x34')],function(_0x273085){return{'id':_0x273085[_0xca14('0x29')],'name':_0x273085[_0xca14('0x6c')],'custom':_0x273085[_0xca14('0x6d')],'options':_0x273085['picklistValues'][_0xca14('0x42')]>0x0?_[_0xca14('0x2b')](_0x273085[_0xca14('0x6e')],function(_0xbba19f){return{'name':_0xbba19f['label'],'value':_0xbba19f[_0xca14('0x6f')]};}):_0x273085[_0xca14('0x2d')]==_0xca14('0x68')?[{'name':_0xca14('0x70'),'value':_0xca14('0x71')},{'name':_0xca14('0x72'),'value':_0xca14('0x73')}]:[]};})};}})[_0xca14('0x26')](respondWithResult(_0x130396,null))[_0xca14('0x46')](function(_0x2751b5){var _0x1c59b6=_0x34e892[_0xca14('0x2f')][_0xca14('0x74')]?0x1f4:_0x2751b5[_0xca14('0x75')]||0x1f4;logger[_0xca14('0x76')](_0xca14('0x77'),_0xca14('0x53'),_0x1c59b6,JSON[_0xca14('0x78')](_0x2751b5));delete _0x2751b5[_0xca14('0x29')];if(_0x1c59b6===0x191){_0x1c59b6=0x190;}_0x130396[_0xca14('0x1b')](_0x1c59b6)[_0xca14('0x79')](_0x34e892['query'][_0xca14('0x74')]?{'message':_0xca14('0x7a'),'statusCode':_0x2751b5[_0xca14('0x75')]}:_0x2751b5);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 8cadb44..f0d9996 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 _0x1166=['request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','lodash','../../config/logger','api','moment','bluebird'];(function(_0x9abce9,_0x5203e1){var _0x4ae261=function(_0x4b079b){while(--_0x4b079b){_0x9abce9['push'](_0x9abce9['shift']());}};_0x4ae261(++_0x5203e1);}(_0x1166,0x1a8));var _0x6116=function(_0x4726bf,_0x5ceade){_0x4726bf=_0x4726bf-0x0;var _0x2bc946=_0x1166[_0x4726bf];return _0x2bc946;};'use strict';var _=require(_0x6116('0x0'));var util=require('util');var logger=require(_0x6116('0x1'))(_0x6116('0x2'));var moment=require(_0x6116('0x3'));var BPromise=require(_0x6116('0x4'));var rp=require(_0x6116('0x5'));var fs=require('fs');var path=require(_0x6116('0x6'));var rimraf=require(_0x6116('0x7'));var config=require(_0x6116('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x6116('0x9'));module['exports']=function(_0x215549,_0x4aa737){return _0x215549[_0x6116('0xa')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','util','api','bluebird'];(function(_0x449941,_0x5b7094){var _0x316d93=function(_0x537431){while(--_0x537431){_0x449941['push'](_0x449941['shift']());}};_0x316d93(++_0x5b7094);}(_0x9bde,0xe1));var _0xe9bd=function(_0x551047,_0x583496){_0x551047=_0x551047-0x0;var _0x119ecb=_0x9bde[_0x551047];return _0x119ecb;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));var integrations=require(_0xe9bd('0x8'));module['exports']=function(_0x4763e9,_0x5f18fe){return _0x4763e9[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'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 dc0122b..e92d998 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 _0x4efd=['where','attributes','limit','include','map','model','then','info','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x4efd,0x14e));var _0xd4ef=function(_0x3902c1,_0x1c9eb2){_0x3902c1=_0x3902c1-0x0;var _0x1266cc=_0x4efd[_0x3902c1];return _0x1266cc;};'use strict';var _=require(_0xd4ef('0x0'));var util=require(_0xd4ef('0x1'));var moment=require(_0xd4ef('0x2'));var BPromise=require(_0xd4ef('0x3'));var rs=require(_0xd4ef('0x4'));var fs=require('fs');var Redis=require(_0xd4ef('0x5'));var db=require(_0xd4ef('0x6'))['db'];var utils=require(_0xd4ef('0x7'));var logger=require(_0xd4ef('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd4ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a21e7,_0x3cf1a6,_0x18f8bf){return new BPromise(function(_0x5a7b42,_0x10d0f3){return client[_0xd4ef('0xa')](_0x2a21e7,_0x18f8bf)['then'](function(_0x2aa103){logger['info'](_0xd4ef('0xb'),_0x3cf1a6,_0xd4ef('0xc'));logger[_0xd4ef('0xd')](_0xd4ef('0xe'),_0x3cf1a6,_0xd4ef('0xc'),JSON[_0xd4ef('0xf')](_0x2aa103));if(_0x2aa103[_0xd4ef('0x10')]){if(_0x2aa103[_0xd4ef('0x10')][_0xd4ef('0x11')]===0x1f4){logger[_0xd4ef('0x10')](_0xd4ef('0xb'),_0x3cf1a6,_0x2aa103[_0xd4ef('0x10')]['message']);return _0x10d0f3(_0x2aa103[_0xd4ef('0x10')][_0xd4ef('0x12')]);}logger['error'](_0xd4ef('0xb'),_0x3cf1a6,_0x2aa103[_0xd4ef('0x10')][_0xd4ef('0x12')]);return _0x5a7b42(_0x2aa103[_0xd4ef('0x10')]['message']);}else{logger['info'](_0xd4ef('0xb'),_0x3cf1a6,_0xd4ef('0xc'));_0x5a7b42(_0x2aa103[_0xd4ef('0x13')][_0xd4ef('0x12')]);}})[_0xd4ef('0x14')](function(_0x84d51f){logger[_0xd4ef('0x10')](_0xd4ef('0xb'),_0x3cf1a6,_0x84d51f);_0x10d0f3(_0x84d51f);});});}exports[_0xd4ef('0x15')]=function(_0x2de671){var _0x14b0c7=this;return new Promise(function(_0x300535,_0x414e2b){return db[_0xd4ef('0x16')][_0xd4ef('0x17')]({'raw':_0x2de671['options']?_0x2de671[_0xd4ef('0x18')][_0xd4ef('0x19')]===undefined?!![]:![]:!![],'where':_0x2de671[_0xd4ef('0x18')]?_0x2de671['options'][_0xd4ef('0x1a')]||null:null,'attributes':_0x2de671[_0xd4ef('0x18')]?_0x2de671['options'][_0xd4ef('0x1b')]||null:null,'limit':_0x2de671[_0xd4ef('0x18')]?_0x2de671[_0xd4ef('0x18')][_0xd4ef('0x1c')]||null:null,'include':_0x2de671[_0xd4ef('0x18')]?_0x2de671[_0xd4ef('0x18')][_0xd4ef('0x1d')]?_[_0xd4ef('0x1e')](_0x2de671[_0xd4ef('0x18')]['include'],function(_0x1d8354){return{'model':db[_0x1d8354[_0xd4ef('0x1f')]],'as':_0x1d8354['as'],'attributes':_0x1d8354[_0xd4ef('0x1b')],'include':_0x1d8354[_0xd4ef('0x1d')]?_[_0xd4ef('0x1e')](_0x1d8354['include'],function(_0x513e11){return{'model':db[_0x513e11[_0xd4ef('0x1f')]],'as':_0x513e11['as'],'attributes':_0x513e11[_0xd4ef('0x1b')],'include':_0x513e11[_0xd4ef('0x1d')]?_[_0xd4ef('0x1e')](_0x513e11[_0xd4ef('0x1d')],function(_0x29734f){return{'model':db[_0x29734f[_0xd4ef('0x1f')]],'as':_0x29734f['as'],'attributes':_0x29734f[_0xd4ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd4ef('0x20')](function(_0x5aa5e8){logger[_0xd4ef('0x21')](_0xd4ef('0x15'),_0x2de671);logger[_0xd4ef('0xd')]('GetSalesforceAccount',_0x2de671,JSON[_0xd4ef('0xf')](_0x5aa5e8));_0x300535(_0x5aa5e8);})[_0xd4ef('0x14')](function(_0x2f01df){logger[_0xd4ef('0x10')](_0xd4ef('0x15'),_0x2f01df['message'],_0x2de671);_0x414e2b(_0x14b0c7[_0xd4ef('0x10')](0x1f4,_0x2f01df[_0xd4ef('0x12')]));});});};exports[_0xd4ef('0x22')]=function(_0x153bfc){var _0x95ba64=this;return new Promise(function(_0x330e1e,_0x47e144){return db[_0xd4ef('0x16')][_0xd4ef('0x23')]({'raw':_0x153bfc[_0xd4ef('0x18')]?_0x153bfc[_0xd4ef('0x18')][_0xd4ef('0x19')]===undefined?!![]:![]:!![],'where':_0x153bfc['options']?_0x153bfc[_0xd4ef('0x18')][_0xd4ef('0x1a')]||null:null,'attributes':_0x153bfc[_0xd4ef('0x18')]?_0x153bfc[_0xd4ef('0x18')][_0xd4ef('0x1b')]||null:null,'include':_0x153bfc['options']?_0x153bfc[_0xd4ef('0x18')][_0xd4ef('0x1d')]?_['map'](_0x153bfc[_0xd4ef('0x18')][_0xd4ef('0x1d')],function(_0x209d6f){return{'model':db[_0x209d6f[_0xd4ef('0x1f')]],'as':_0x209d6f['as'],'attributes':_0x209d6f[_0xd4ef('0x1b')],'include':_0x209d6f['include']?_[_0xd4ef('0x1e')](_0x209d6f[_0xd4ef('0x1d')],function(_0x200f99){return{'model':db[_0x200f99[_0xd4ef('0x1f')]],'as':_0x200f99['as'],'attributes':_0x200f99[_0xd4ef('0x1b')],'include':_0x200f99[_0xd4ef('0x1d')]?_[_0xd4ef('0x1e')](_0x200f99[_0xd4ef('0x1d')],function(_0x4b7b1d){return{'model':db[_0x4b7b1d[_0xd4ef('0x1f')]],'as':_0x4b7b1d['as'],'attributes':_0x4b7b1d[_0xd4ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd4ef('0x20')](function(_0x1db79d){logger[_0xd4ef('0x21')](_0xd4ef('0x22'),_0x153bfc);logger[_0xd4ef('0xd')](_0xd4ef('0x22'),_0x153bfc,JSON[_0xd4ef('0xf')](_0x1db79d));_0x330e1e(_0x1db79d);})[_0xd4ef('0x14')](function(_0x3eb393){logger['error'](_0xd4ef('0x22'),_0x3eb393['message'],_0x153bfc);_0x47e144(_0x95ba64[_0xd4ef('0x10')](0x1f4,_0x3eb393[_0xd4ef('0x12')]));});});}; \ No newline at end of file +var _0xef0d=['SalesforceAccount','find','where','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSalesforceAccount','options','raw','attributes','include','map','model','catch','ShowSalesforceAccount'];(function(_0x182979,_0x3c2030){var _0x249fff=function(_0x782d52){while(--_0x782d52){_0x182979['push'](_0x182979['shift']());}};_0x249fff(++_0x3c2030);}(_0xef0d,0xdc));var _0xdef0=function(_0x555363,_0x4a7cca){_0x555363=_0x555363-0x0;var _0x23c402=_0xef0d[_0x555363];return _0x23c402;};'use strict';var _=require(_0xdef0('0x0'));var util=require('util');var moment=require(_0xdef0('0x1'));var BPromise=require(_0xdef0('0x2'));var rs=require(_0xdef0('0x3'));var fs=require('fs');var Redis=require(_0xdef0('0x4'));var db=require(_0xdef0('0x5'))['db'];var utils=require(_0xdef0('0x6'));var logger=require(_0xdef0('0x7'))(_0xdef0('0x8'));var config=require(_0xdef0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdef0('0xa')][_0xdef0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b4c00,_0x246435,_0x8227dd){return new BPromise(function(_0x2ff6e5,_0x26b271){return client[_0xdef0('0xc')](_0x2b4c00,_0x8227dd)['then'](function(_0x10b1bf){logger[_0xdef0('0xd')](_0xdef0('0xe'),_0x246435,_0xdef0('0xf'));logger[_0xdef0('0x10')](_0xdef0('0x11'),_0x246435,'request\x20sent',JSON[_0xdef0('0x12')](_0x10b1bf));if(_0x10b1bf[_0xdef0('0x13')]){if(_0x10b1bf['error'][_0xdef0('0x14')]===0x1f4){logger[_0xdef0('0x13')](_0xdef0('0xe'),_0x246435,_0x10b1bf['error'][_0xdef0('0x15')]);return _0x26b271(_0x10b1bf[_0xdef0('0x13')][_0xdef0('0x15')]);}logger[_0xdef0('0x13')](_0xdef0('0xe'),_0x246435,_0x10b1bf[_0xdef0('0x13')][_0xdef0('0x15')]);return _0x2ff6e5(_0x10b1bf['error'][_0xdef0('0x15')]);}else{logger[_0xdef0('0xd')](_0xdef0('0xe'),_0x246435,_0xdef0('0xf'));_0x2ff6e5(_0x10b1bf[_0xdef0('0x16')]['message']);}})['catch'](function(_0x1a2ce3){logger['error'](_0xdef0('0xe'),_0x246435,_0x1a2ce3);_0x26b271(_0x1a2ce3);});});}exports[_0xdef0('0x17')]=function(_0x254a8c){var _0x1ea829=this;return new Promise(function(_0x5961fa,_0x31faf7){return db['SalesforceAccount']['findAll']({'raw':_0x254a8c[_0xdef0('0x18')]?_0x254a8c[_0xdef0('0x18')][_0xdef0('0x19')]===undefined?!![]:![]:!![],'where':_0x254a8c[_0xdef0('0x18')]?_0x254a8c['options']['where']||null:null,'attributes':_0x254a8c[_0xdef0('0x18')]?_0x254a8c[_0xdef0('0x18')][_0xdef0('0x1a')]||null:null,'limit':_0x254a8c[_0xdef0('0x18')]?_0x254a8c[_0xdef0('0x18')]['limit']||null:null,'include':_0x254a8c['options']?_0x254a8c[_0xdef0('0x18')][_0xdef0('0x1b')]?_[_0xdef0('0x1c')](_0x254a8c['options'][_0xdef0('0x1b')],function(_0x4bde65){return{'model':db[_0x4bde65[_0xdef0('0x1d')]],'as':_0x4bde65['as'],'attributes':_0x4bde65[_0xdef0('0x1a')],'include':_0x4bde65['include']?_[_0xdef0('0x1c')](_0x4bde65[_0xdef0('0x1b')],function(_0x3be142){return{'model':db[_0x3be142['model']],'as':_0x3be142['as'],'attributes':_0x3be142[_0xdef0('0x1a')],'include':_0x3be142['include']?_[_0xdef0('0x1c')](_0x3be142[_0xdef0('0x1b')],function(_0xbea465){return{'model':db[_0xbea465[_0xdef0('0x1d')]],'as':_0xbea465['as'],'attributes':_0xbea465[_0xdef0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x521a79){logger[_0xdef0('0xd')]('GetSalesforceAccount',_0x254a8c);logger[_0xdef0('0x10')](_0xdef0('0x17'),_0x254a8c,JSON[_0xdef0('0x12')](_0x521a79));_0x5961fa(_0x521a79);})[_0xdef0('0x1e')](function(_0x19bf8b){logger[_0xdef0('0x13')](_0xdef0('0x17'),_0x19bf8b[_0xdef0('0x15')],_0x254a8c);_0x31faf7(_0x1ea829[_0xdef0('0x13')](0x1f4,_0x19bf8b[_0xdef0('0x15')]));});});};exports[_0xdef0('0x1f')]=function(_0x21c7b6){var _0x496bdd=this;return new Promise(function(_0x41a3b2,_0x1cd2b6){return db[_0xdef0('0x20')][_0xdef0('0x21')]({'raw':_0x21c7b6[_0xdef0('0x18')]?_0x21c7b6[_0xdef0('0x18')][_0xdef0('0x19')]===undefined?!![]:![]:!![],'where':_0x21c7b6[_0xdef0('0x18')]?_0x21c7b6[_0xdef0('0x18')][_0xdef0('0x22')]||null:null,'attributes':_0x21c7b6[_0xdef0('0x18')]?_0x21c7b6[_0xdef0('0x18')]['attributes']||null:null,'include':_0x21c7b6[_0xdef0('0x18')]?_0x21c7b6[_0xdef0('0x18')][_0xdef0('0x1b')]?_['map'](_0x21c7b6[_0xdef0('0x18')]['include'],function(_0x319c1d){return{'model':db[_0x319c1d[_0xdef0('0x1d')]],'as':_0x319c1d['as'],'attributes':_0x319c1d[_0xdef0('0x1a')],'include':_0x319c1d[_0xdef0('0x1b')]?_[_0xdef0('0x1c')](_0x319c1d[_0xdef0('0x1b')],function(_0x7fd792){return{'model':db[_0x7fd792[_0xdef0('0x1d')]],'as':_0x7fd792['as'],'attributes':_0x7fd792[_0xdef0('0x1a')],'include':_0x7fd792['include']?_['map'](_0x7fd792['include'],function(_0x2ee65a){return{'model':db[_0x2ee65a[_0xdef0('0x1d')]],'as':_0x2ee65a['as'],'attributes':_0x2ee65a['attributes']};}):[]};}):[]};}):[]:[]})[_0xdef0('0x23')](function(_0x3824aa){logger[_0xdef0('0xd')](_0xdef0('0x1f'),_0x21c7b6);logger[_0xdef0('0x10')]('ShowSalesforceAccount',_0x21c7b6,JSON['stringify'](_0x3824aa));_0x41a3b2(_0x3824aa);})[_0xdef0('0x1e')](function(_0xcf025e){logger['error']('ShowSalesforceAccount',_0xcf025e[_0xdef0('0x15')],_0x21c7b6);_0x1cd2b6(_0x496bdd['error'](0x1f4,_0xcf025e[_0xdef0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 710b229..92c4f1b 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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1808f9,_0x322e07){var _0x2ffc89=function(_0x2f44f8){while(--_0x2f44f8){_0x1808f9['push'](_0x1808f9['shift']());}};_0x2ffc89(++_0x322e07);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5d5661,_0x2e0f25){_0x5d5661=_0x5d5661-0x0;var _0x1efa1e=_0x5f2f[_0x5d5661];return _0x1efa1e;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x405219,_0xa5be00){var _0x7da1a9=function(_0x40e852){while(--_0x40e852){_0x405219['push'](_0x405219['shift']());}};_0x7da1a9(++_0xa5be00);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index bdd000c..02c7056 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 _0x3ccb=['account','contact_lead','nothing','lead','sequelize','exports','STRING','ENUM','Task','contact','account_contact_lead'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3ccb,0x190));var _0xb3cc=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0x3ccb[_0x28d225];return _0x1f79e1;};'use strict';var Sequelize=require(_0xb3cc('0x0'));module[_0xb3cc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb3cc('0x2')]},'ticketType':{'type':Sequelize[_0xb3cc('0x3')](_0xb3cc('0x4'),'Case'),'defaultValue':_0xb3cc('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xb3cc('0x5'),'lead',_0xb3cc('0x6'),_0xb3cc('0x7')),'defaultValue':_0xb3cc('0x8')},'moduleCreate':{'type':Sequelize[_0xb3cc('0x3')](_0xb3cc('0x9'),_0xb3cc('0x5'),_0xb3cc('0xa'),_0xb3cc('0x7')),'defaultValue':_0xb3cc('0xa')},'leadId':{'type':Sequelize[_0xb3cc('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xb3cc('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xb3cc('0x2')]}}; \ No newline at end of file +var _0x5f60=['Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing','exports','STRING'];(function(_0x2bdb06,_0x294973){var _0x36058=function(_0x14f151){while(--_0x14f151){_0x2bdb06['push'](_0x2bdb06['shift']());}};_0x36058(++_0x294973);}(_0x5f60,0x134));var _0x05f6=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0x5f60[_0x13187a];return _0x65b85f;};'use strict';var Sequelize=require('sequelize');module[_0x05f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x05f6('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x05f6('0x2'),_0x05f6('0x3')),'defaultValue':_0x05f6('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x05f6('0x4'),_0x05f6('0x5'),_0x05f6('0x6'),_0x05f6('0x7'),_0x05f6('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x05f6('0x9'),_0x05f6('0x5'),_0x05f6('0x6'),_0x05f6('0x8')),'defaultValue':_0x05f6('0x6')},'leadId':{'type':Sequelize[_0x05f6('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x05f6('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 8768068..bb8fd0c 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 _0xae6b=['nolimit','sort','where','pick','merge','filter','options','includeAll','include','SalesforceConfiguration','rows','catch','show','create','body','find','params','getFields','findOne','length','order','getSubjects','getDescriptions','SalesforceField','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x172c4b,_0x526e08){var _0x4aca79=function(_0x42210c){while(--_0x42210c){_0x172c4b['push'](_0x172c4b['shift']());}};_0x4aca79(++_0x526e08);}(_0xae6b,0x158));var _0xbae6=function(_0x4a3570,_0x169197){_0x4a3570=_0x4a3570-0x0;var _0x235ca8=_0xae6b[_0x4a3570];return _0x235ca8;};'use strict';var emlformat=require(_0xbae6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbae6('0x1'));var jsonpatch=require(_0xbae6('0x2'));var rp=require(_0xbae6('0x3'));var moment=require(_0xbae6('0x4'));var BPromise=require(_0xbae6('0x5'));var Mustache=require(_0xbae6('0x6'));var util=require(_0xbae6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xbae6('0x8'));var ejs=require(_0xbae6('0x9'));var fs=require('fs');var fs_extra=require(_0xbae6('0xa'));var _=require(_0xbae6('0xb'));var squel=require(_0xbae6('0xc'));var crypto=require('crypto');var jsforce=require(_0xbae6('0xd'));var deskjs=require(_0xbae6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbae6('0xf'));var Papa=require(_0xbae6('0x10'));var Redis=require(_0xbae6('0x11'));var authService=require(_0xbae6('0x12'));var qs=require(_0xbae6('0x13'));var as=require(_0xbae6('0x14'));var hardwareService=require(_0xbae6('0x15'));var logger=require(_0xbae6('0x16'))(_0xbae6('0x17'));var utils=require('../../config/utils');var config=require(_0xbae6('0x18'));var licenseUtil=require(_0xbae6('0x19'));var db=require(_0xbae6('0x1a'))['db'];function respondWithStatusCode(_0x3a871d,_0x56a8a0){_0x56a8a0=_0x56a8a0||0xcc;return function(_0x3d97e8){if(_0x3d97e8){return _0x3a871d[_0xbae6('0x1b')](_0x56a8a0);}return _0x3a871d[_0xbae6('0x1c')](_0x56a8a0)[_0xbae6('0x1d')]();};}function respondWithResult(_0x37c472,_0x3d22d3){_0x3d22d3=_0x3d22d3||0xc8;return function(_0xc44bc1){if(_0xc44bc1){return _0x37c472[_0xbae6('0x1c')](_0x3d22d3)['json'](_0xc44bc1);}};}function respondWithFilteredResult(_0x11fa5e,_0x469e0b){return function(_0x45774b){if(_0x45774b){var _0x702e1a=typeof _0x469e0b[_0xbae6('0x1e')]===_0xbae6('0x1f')&&typeof _0x469e0b[_0xbae6('0x20')]===_0xbae6('0x1f');var _0x1b6898=_0x45774b[_0xbae6('0x21')];var _0x3cfcee=_0x702e1a?0x0:_0x469e0b['offset'];var _0x4f3270=_0x702e1a?_0x45774b[_0xbae6('0x21')]:_0x469e0b[_0xbae6('0x1e')]+_0x469e0b[_0xbae6('0x20')];var _0x57b4bd;if(_0x4f3270>=_0x1b6898){_0x4f3270=_0x1b6898;_0x57b4bd=0xc8;}else{_0x57b4bd=0xce;}_0x11fa5e[_0xbae6('0x1c')](_0x57b4bd);return _0x11fa5e[_0xbae6('0x22')](_0xbae6('0x23'),_0x3cfcee+'-'+_0x4f3270+'/'+_0x1b6898)[_0xbae6('0x24')](_0x45774b);}return null;};}function patchUpdates(_0x4bdf9e){return function(_0x5263af){try{jsonpatch['apply'](_0x5263af,_0x4bdf9e,!![]);}catch(_0x237858){return BPromise[_0xbae6('0x25')](_0x237858);}return _0x5263af['save']();};}function saveUpdates(_0xeb81be,_0x1375f1){return function(_0x38942b){if(_0x38942b){return _0x38942b[_0xbae6('0x26')](_0xeb81be)[_0xbae6('0x27')](function(_0x48be3f){return _0x48be3f;});}return null;};}function removeEntity(_0xdf2757,_0x4b4040){return function(_0x3617ca){if(_0x3617ca){return _0x3617ca[_0xbae6('0x28')]()[_0xbae6('0x27')](function(){_0xdf2757[_0xbae6('0x1c')](0xcc)[_0xbae6('0x1d')]();});}};}function handleEntityNotFound(_0x2437f7,_0x4fcabc){return function(_0x464980){if(!_0x464980){_0x2437f7[_0xbae6('0x1b')](0x194);}return _0x464980;};}function handleError(_0xd17d2b,_0x72fde2){_0x72fde2=_0x72fde2||0x1f4;return function(_0x5a5258){logger[_0xbae6('0x29')](_0x5a5258['stack']);if(_0x5a5258[_0xbae6('0x2a')]){delete _0x5a5258['name'];}_0xd17d2b['status'](_0x72fde2)[_0xbae6('0x2b')](_0x5a5258);};}exports['index']=function(_0x51cace,_0xb023c4){var _0x15929d={},_0x549417={},_0x587a93={'count':0x0,'rows':[]};var _0x4fa2d3=_[_0xbae6('0x2c')](db['SalesforceConfiguration'][_0xbae6('0x2d')],function(_0xfa7ace){return{'name':_0xfa7ace[_0xbae6('0x2e')],'type':_0xfa7ace[_0xbae6('0x2f')]['key']};});_0x549417['model']=_['map'](_0x4fa2d3,_0xbae6('0x2a'));_0x549417[_0xbae6('0x30')]=_[_0xbae6('0x31')](_0x51cace[_0xbae6('0x30')]);_0x549417[_0xbae6('0x32')]=_[_0xbae6('0x33')](_0x549417[_0xbae6('0x34')],_0x549417['query']);_0x15929d[_0xbae6('0x35')]=_[_0xbae6('0x33')](_0x549417[_0xbae6('0x34')],qs['fields'](_0x51cace[_0xbae6('0x30')][_0xbae6('0x36')]));_0x15929d[_0xbae6('0x35')]=_0x15929d['attributes']['length']?_0x15929d['attributes']:_0x549417[_0xbae6('0x34')];if(!_0x51cace['query'][_0xbae6('0x37')](_0xbae6('0x38'))){_0x15929d['limit']=qs['limit'](_0x51cace[_0xbae6('0x30')]['limit']);_0x15929d['offset']=qs[_0xbae6('0x1e')](_0x51cace[_0xbae6('0x30')][_0xbae6('0x1e')]);}_0x15929d['order']=qs['sort'](_0x51cace[_0xbae6('0x30')][_0xbae6('0x39')]);_0x15929d[_0xbae6('0x3a')]=qs['filters'](_[_0xbae6('0x3b')](_0x51cace['query'],_0x549417[_0xbae6('0x32')]),_0x4fa2d3);if(_0x51cace['query']['filter']){_0x15929d['where']=_[_0xbae6('0x3c')](_0x15929d[_0xbae6('0x3a')],{'$or':_[_0xbae6('0x2c')](_0x4fa2d3,function(_0x40d2f7){if(_0x40d2f7[_0xbae6('0x2f')]!=='VIRTUAL'){var _0x5244c4={};_0x5244c4[_0x40d2f7['name']]={'$like':'%'+_0x51cace['query'][_0xbae6('0x3d')]+'%'};return _0x5244c4;}})});}_0x15929d=_[_0xbae6('0x3c')]({},_0x15929d,_0x51cace[_0xbae6('0x3e')]);var _0x3fdca9={'where':_0x15929d[_0xbae6('0x3a')]};return db['SalesforceConfiguration'][_0xbae6('0x21')](_0x3fdca9)[_0xbae6('0x27')](function(_0x5dccad){_0x587a93[_0xbae6('0x21')]=_0x5dccad;if(_0x51cace[_0xbae6('0x30')][_0xbae6('0x3f')]){_0x15929d[_0xbae6('0x40')]=[{'all':!![]}];}return db[_0xbae6('0x41')]['findAll'](_0x15929d);})[_0xbae6('0x27')](function(_0x1c2569){_0x587a93[_0xbae6('0x42')]=_0x1c2569;return _0x587a93;})[_0xbae6('0x27')](respondWithFilteredResult(_0xb023c4,_0x15929d))[_0xbae6('0x43')](handleError(_0xb023c4,null));};exports[_0xbae6('0x44')]=function(_0x5b88b6,_0x59b560){var _0x36f0f8={'raw':![],'where':{'id':_0x5b88b6['params']['id']}},_0xdc08b={};_0xdc08b[_0xbae6('0x34')]=_['keys'](db[_0xbae6('0x41')][_0xbae6('0x2d')]);_0xdc08b[_0xbae6('0x30')]=_['keys'](_0x5b88b6['query']);_0xdc08b[_0xbae6('0x32')]=_[_0xbae6('0x33')](_0xdc08b[_0xbae6('0x34')],_0xdc08b[_0xbae6('0x30')]);_0x36f0f8['attributes']=_['intersection'](_0xdc08b[_0xbae6('0x34')],qs['fields'](_0x5b88b6['query'][_0xbae6('0x36')]));_0x36f0f8['attributes']=_0x36f0f8[_0xbae6('0x35')]['length']?_0x36f0f8['attributes']:_0xdc08b[_0xbae6('0x34')];if(_0x5b88b6['query'][_0xbae6('0x3f')]){_0x36f0f8[_0xbae6('0x40')]=[{'all':!![]}];}_0x36f0f8=_[_0xbae6('0x3c')]({},_0x36f0f8,_0x5b88b6[_0xbae6('0x3e')]);return db[_0xbae6('0x41')]['find'](_0x36f0f8)[_0xbae6('0x27')](handleEntityNotFound(_0x59b560,null))[_0xbae6('0x27')](respondWithResult(_0x59b560,null))[_0xbae6('0x43')](handleError(_0x59b560,null));};exports[_0xbae6('0x45')]=function(_0x639a3f,_0x5c31d8){return db[_0xbae6('0x41')][_0xbae6('0x45')](_0x639a3f[_0xbae6('0x46')],{})[_0xbae6('0x27')](respondWithResult(_0x5c31d8,0xc9))['catch'](handleError(_0x5c31d8,null));};exports[_0xbae6('0x26')]=function(_0x4b857b,_0x192339){if(_0x4b857b[_0xbae6('0x46')]['id']){delete _0x4b857b[_0xbae6('0x46')]['id'];}return db['SalesforceConfiguration'][_0xbae6('0x47')]({'where':{'id':_0x4b857b[_0xbae6('0x48')]['id']}})[_0xbae6('0x27')](handleEntityNotFound(_0x192339,null))[_0xbae6('0x27')](saveUpdates(_0x4b857b[_0xbae6('0x46')],null))[_0xbae6('0x27')](respondWithResult(_0x192339,null))[_0xbae6('0x43')](handleError(_0x192339,null));};exports[_0xbae6('0x28')]=function(_0x48c548,_0xddecce){return db[_0xbae6('0x41')][_0xbae6('0x47')]({'where':{'id':_0x48c548[_0xbae6('0x48')]['id']}})['then'](handleEntityNotFound(_0xddecce,null))[_0xbae6('0x27')](removeEntity(_0xddecce,null))[_0xbae6('0x43')](handleError(_0xddecce,null));};exports[_0xbae6('0x49')]=function(_0x1adaf9,_0x4d86ab,_0x3fb2dc){var _0x25e64d={};var _0xdd58c6={};var _0x19b0b0;var _0x266d36;return db[_0xbae6('0x41')][_0xbae6('0x4a')]({'where':{'id':_0x1adaf9[_0xbae6('0x48')]['id']}})[_0xbae6('0x27')](handleEntityNotFound(_0x4d86ab,null))[_0xbae6('0x27')](function(_0x3ff742){if(_0x3ff742){_0x19b0b0=_0x3ff742;_0xdd58c6[_0xbae6('0x34')]=_[_0xbae6('0x31')](db['SalesforceField']['rawAttributes']);_0xdd58c6['query']=_[_0xbae6('0x31')](_0x1adaf9['query']);_0xdd58c6[_0xbae6('0x32')]=_[_0xbae6('0x33')](_0xdd58c6[_0xbae6('0x34')],_0xdd58c6[_0xbae6('0x30')]);_0x25e64d[_0xbae6('0x35')]=_[_0xbae6('0x33')](_0xdd58c6[_0xbae6('0x34')],qs[_0xbae6('0x36')](_0x1adaf9['query'][_0xbae6('0x36')]));_0x25e64d[_0xbae6('0x35')]=_0x25e64d[_0xbae6('0x35')][_0xbae6('0x4b')]?_0x25e64d[_0xbae6('0x35')]:_0xdd58c6['model'];_0x25e64d[_0xbae6('0x4c')]=qs[_0xbae6('0x39')](_0x1adaf9[_0xbae6('0x30')][_0xbae6('0x39')]);_0x25e64d['where']=qs['filters'](_[_0xbae6('0x3b')](_0x1adaf9[_0xbae6('0x30')],_0xdd58c6[_0xbae6('0x32')]));if(_0x1adaf9[_0xbae6('0x30')][_0xbae6('0x3d')]){_0x25e64d[_0xbae6('0x3a')]=_[_0xbae6('0x3c')](_0x25e64d[_0xbae6('0x3a')],{'$or':_[_0xbae6('0x2c')](_0x25e64d['attributes'],function(_0x260f66){var _0x21be2e={};_0x21be2e[_0x260f66]={'$like':'%'+_0x1adaf9['query']['filter']+'%'};return _0x21be2e;})});}_0x25e64d=_['merge']({},_0x25e64d,_0x1adaf9[_0xbae6('0x3e')]);return _0x19b0b0[_0xbae6('0x49')](_0x25e64d);}})['then'](function(_0x2c4fc6){if(_0x2c4fc6){_0x266d36=_0x2c4fc6[_0xbae6('0x4b')];if(!_0x1adaf9[_0xbae6('0x30')][_0xbae6('0x37')](_0xbae6('0x38'))){_0x25e64d[_0xbae6('0x20')]=qs[_0xbae6('0x20')](_0x1adaf9[_0xbae6('0x30')]['limit']);_0x25e64d[_0xbae6('0x1e')]=qs[_0xbae6('0x1e')](_0x1adaf9['query'][_0xbae6('0x1e')]);}return _0x19b0b0[_0xbae6('0x49')](_0x25e64d);}})[_0xbae6('0x27')](function(_0x9e42d9){if(_0x9e42d9){return _0x9e42d9?{'count':_0x266d36,'rows':_0x9e42d9}:null;}})['then'](respondWithResult(_0x4d86ab,null))['catch'](handleError(_0x4d86ab,null));};exports['getSubjects']=function(_0x2c720b,_0x10188e,_0x5c9f0a){var _0x22d2de={};var _0x1c3fe7={};var _0x253294;var _0x1e77ae;return db[_0xbae6('0x41')][_0xbae6('0x4a')]({'where':{'id':_0x2c720b[_0xbae6('0x48')]['id']}})[_0xbae6('0x27')](handleEntityNotFound(_0x10188e,null))[_0xbae6('0x27')](function(_0x3867ce){if(_0x3867ce){_0x253294=_0x3867ce;_0x1c3fe7[_0xbae6('0x34')]=_[_0xbae6('0x31')](db['SalesforceField'][_0xbae6('0x2d')]);_0x1c3fe7[_0xbae6('0x30')]=_[_0xbae6('0x31')](_0x2c720b[_0xbae6('0x30')]);_0x1c3fe7['filters']=_[_0xbae6('0x33')](_0x1c3fe7[_0xbae6('0x34')],_0x1c3fe7[_0xbae6('0x30')]);_0x22d2de[_0xbae6('0x35')]=_[_0xbae6('0x33')](_0x1c3fe7[_0xbae6('0x34')],qs['fields'](_0x2c720b['query'][_0xbae6('0x36')]));_0x22d2de[_0xbae6('0x35')]=_0x22d2de[_0xbae6('0x35')][_0xbae6('0x4b')]?_0x22d2de[_0xbae6('0x35')]:_0x1c3fe7[_0xbae6('0x34')];_0x22d2de[_0xbae6('0x4c')]=qs[_0xbae6('0x39')](_0x2c720b['query']['sort']);_0x22d2de['where']=qs[_0xbae6('0x32')](_[_0xbae6('0x3b')](_0x2c720b[_0xbae6('0x30')],_0x1c3fe7[_0xbae6('0x32')]));if(_0x2c720b[_0xbae6('0x30')][_0xbae6('0x3d')]){_0x22d2de[_0xbae6('0x3a')]=_['merge'](_0x22d2de[_0xbae6('0x3a')],{'$or':_['map'](_0x22d2de[_0xbae6('0x35')],function(_0xd25350){var _0x96bc0={};_0x96bc0[_0xd25350]={'$like':'%'+_0x2c720b[_0xbae6('0x30')]['filter']+'%'};return _0x96bc0;})});}_0x22d2de=_[_0xbae6('0x3c')]({},_0x22d2de,_0x2c720b[_0xbae6('0x3e')]);return _0x253294[_0xbae6('0x4d')](_0x22d2de);}})[_0xbae6('0x27')](function(_0x57d1ba){if(_0x57d1ba){_0x1e77ae=_0x57d1ba[_0xbae6('0x4b')];if(!_0x2c720b[_0xbae6('0x30')][_0xbae6('0x37')]('nolimit')){_0x22d2de[_0xbae6('0x20')]=qs[_0xbae6('0x20')](_0x2c720b['query'][_0xbae6('0x20')]);_0x22d2de[_0xbae6('0x1e')]=qs[_0xbae6('0x1e')](_0x2c720b['query'][_0xbae6('0x1e')]);}return _0x253294[_0xbae6('0x4d')](_0x22d2de);}})[_0xbae6('0x27')](function(_0x2dfc9a){if(_0x2dfc9a){return _0x2dfc9a?{'count':_0x1e77ae,'rows':_0x2dfc9a}:null;}})[_0xbae6('0x27')](respondWithResult(_0x10188e,null))[_0xbae6('0x43')](handleError(_0x10188e,null));};exports[_0xbae6('0x4e')]=function(_0x5cbfb9,_0x2c4add,_0x4a90ac){var _0x8e8a81={};var _0x140ae0={};var _0x3060b2;var _0x2934b7;return db[_0xbae6('0x41')][_0xbae6('0x4a')]({'where':{'id':_0x5cbfb9[_0xbae6('0x48')]['id']}})['then'](handleEntityNotFound(_0x2c4add,null))[_0xbae6('0x27')](function(_0x3d43ca){if(_0x3d43ca){_0x3060b2=_0x3d43ca;_0x140ae0[_0xbae6('0x34')]=_[_0xbae6('0x31')](db[_0xbae6('0x4f')]['rawAttributes']);_0x140ae0[_0xbae6('0x30')]=_[_0xbae6('0x31')](_0x5cbfb9[_0xbae6('0x30')]);_0x140ae0[_0xbae6('0x32')]=_['intersection'](_0x140ae0[_0xbae6('0x34')],_0x140ae0[_0xbae6('0x30')]);_0x8e8a81[_0xbae6('0x35')]=_[_0xbae6('0x33')](_0x140ae0[_0xbae6('0x34')],qs[_0xbae6('0x36')](_0x5cbfb9[_0xbae6('0x30')][_0xbae6('0x36')]));_0x8e8a81[_0xbae6('0x35')]=_0x8e8a81[_0xbae6('0x35')][_0xbae6('0x4b')]?_0x8e8a81['attributes']:_0x140ae0['model'];_0x8e8a81[_0xbae6('0x4c')]=qs[_0xbae6('0x39')](_0x5cbfb9[_0xbae6('0x30')][_0xbae6('0x39')]);_0x8e8a81[_0xbae6('0x3a')]=qs[_0xbae6('0x32')](_[_0xbae6('0x3b')](_0x5cbfb9[_0xbae6('0x30')],_0x140ae0['filters']));if(_0x5cbfb9['query'][_0xbae6('0x3d')]){_0x8e8a81['where']=_['merge'](_0x8e8a81['where'],{'$or':_['map'](_0x8e8a81['attributes'],function(_0x410b90){var _0x5c4dbf={};_0x5c4dbf[_0x410b90]={'$like':'%'+_0x5cbfb9[_0xbae6('0x30')][_0xbae6('0x3d')]+'%'};return _0x5c4dbf;})});}_0x8e8a81=_[_0xbae6('0x3c')]({},_0x8e8a81,_0x5cbfb9[_0xbae6('0x3e')]);return _0x3060b2[_0xbae6('0x4e')](_0x8e8a81);}})[_0xbae6('0x27')](function(_0x332642){if(_0x332642){_0x2934b7=_0x332642[_0xbae6('0x4b')];if(!_0x5cbfb9[_0xbae6('0x30')]['hasOwnProperty'](_0xbae6('0x38'))){_0x8e8a81[_0xbae6('0x20')]=qs['limit'](_0x5cbfb9[_0xbae6('0x30')][_0xbae6('0x20')]);_0x8e8a81[_0xbae6('0x1e')]=qs[_0xbae6('0x1e')](_0x5cbfb9['query'][_0xbae6('0x1e')]);}return _0x3060b2[_0xbae6('0x4e')](_0x8e8a81);}})[_0xbae6('0x27')](function(_0x1fb10a){if(_0x1fb10a){return _0x1fb10a?{'count':_0x2934b7,'rows':_0x1fb10a}:null;}})[_0xbae6('0x27')](respondWithResult(_0x2c4add,null))[_0xbae6('0x43')](handleError(_0x2c4add,null));}; \ No newline at end of file +var _0x4d54=['keys','length','options','create','body','find','getFields','SalesforceField','sort','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','SalesforceConfiguration','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4d54,0xf5));var _0x44d5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4d54[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x44d5('0x0'));var rimraf=require(_0x44d5('0x1'));var zipdir=require(_0x44d5('0x2'));var jsonpatch=require(_0x44d5('0x3'));var rp=require(_0x44d5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44d5('0x5'));var util=require(_0x44d5('0x6'));var path=require('path');var sox=require(_0x44d5('0x7'));var csv=require(_0x44d5('0x8'));var ejs=require(_0x44d5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x44d5('0xa'));var squel=require(_0x44d5('0xb'));var crypto=require(_0x44d5('0xc'));var jsforce=require(_0x44d5('0xd'));var deskjs=require(_0x44d5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x44d5('0xf'));var Papa=require('papaparse');var Redis=require(_0x44d5('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x44d5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x44d5('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x44d5('0x13'));var licenseUtil=require(_0x44d5('0x14'));var db=require(_0x44d5('0x15'))['db'];function respondWithStatusCode(_0x495885,_0xfd193f){_0xfd193f=_0xfd193f||0xcc;return function(_0x176757){if(_0x176757){return _0x495885[_0x44d5('0x16')](_0xfd193f);}return _0x495885[_0x44d5('0x17')](_0xfd193f)[_0x44d5('0x18')]();};}function respondWithResult(_0xe2dc93,_0x1f8137){_0x1f8137=_0x1f8137||0xc8;return function(_0x52c43a){if(_0x52c43a){return _0xe2dc93['status'](_0x1f8137)[_0x44d5('0x19')](_0x52c43a);}};}function respondWithFilteredResult(_0x4fc84b,_0x20f791){return function(_0x1ce08a){if(_0x1ce08a){var _0x4b8758=typeof _0x20f791[_0x44d5('0x1a')]==='undefined'&&typeof _0x20f791[_0x44d5('0x1b')]===_0x44d5('0x1c');var _0x318f42=_0x1ce08a[_0x44d5('0x1d')];var _0x5a8ba7=_0x4b8758?0x0:_0x20f791['offset'];var _0x43eeb0=_0x4b8758?_0x1ce08a['count']:_0x20f791[_0x44d5('0x1a')]+_0x20f791['limit'];var _0x560c19;if(_0x43eeb0>=_0x318f42){_0x43eeb0=_0x318f42;_0x560c19=0xc8;}else{_0x560c19=0xce;}_0x4fc84b[_0x44d5('0x17')](_0x560c19);return _0x4fc84b[_0x44d5('0x1e')](_0x44d5('0x1f'),_0x5a8ba7+'-'+_0x43eeb0+'/'+_0x318f42)[_0x44d5('0x19')](_0x1ce08a);}return null;};}function patchUpdates(_0x523211){return function(_0x45b8f1){try{jsonpatch[_0x44d5('0x20')](_0x45b8f1,_0x523211,!![]);}catch(_0x4d23d4){return BPromise[_0x44d5('0x21')](_0x4d23d4);}return _0x45b8f1[_0x44d5('0x22')]();};}function saveUpdates(_0x5cd9d6,_0x1b5dd2){return function(_0x342a56){if(_0x342a56){return _0x342a56[_0x44d5('0x23')](_0x5cd9d6)[_0x44d5('0x24')](function(_0x2ba278){return _0x2ba278;});}return null;};}function removeEntity(_0x3e2cf2,_0x3d9d4e){return function(_0x1bef29){if(_0x1bef29){return _0x1bef29[_0x44d5('0x25')]()[_0x44d5('0x24')](function(){_0x3e2cf2[_0x44d5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5046d2,_0x53b5ce){return function(_0x151171){if(!_0x151171){_0x5046d2['sendStatus'](0x194);}return _0x151171;};}function handleError(_0x3597bc,_0x5c3de9){_0x5c3de9=_0x5c3de9||0x1f4;return function(_0x2a2e6c){logger[_0x44d5('0x26')](_0x2a2e6c[_0x44d5('0x27')]);if(_0x2a2e6c['name']){delete _0x2a2e6c[_0x44d5('0x28')];}_0x3597bc[_0x44d5('0x17')](_0x5c3de9)['send'](_0x2a2e6c);};}exports['index']=function(_0x1ca2d1,_0x545ac4){var _0x188432={},_0x178573={},_0x2a73db={'count':0x0,'rows':[]};var _0x3d4a82=_[_0x44d5('0x29')](db[_0x44d5('0x2a')][_0x44d5('0x2b')],function(_0x338fa7){return{'name':_0x338fa7[_0x44d5('0x2c')],'type':_0x338fa7['type'][_0x44d5('0x2d')]};});_0x178573['model']=_['map'](_0x3d4a82,'name');_0x178573[_0x44d5('0x2e')]=_['keys'](_0x1ca2d1[_0x44d5('0x2e')]);_0x178573[_0x44d5('0x2f')]=_['intersection'](_0x178573[_0x44d5('0x30')],_0x178573[_0x44d5('0x2e')]);_0x188432[_0x44d5('0x31')]=_[_0x44d5('0x32')](_0x178573[_0x44d5('0x30')],qs[_0x44d5('0x33')](_0x1ca2d1[_0x44d5('0x2e')]['fields']));_0x188432[_0x44d5('0x31')]=_0x188432[_0x44d5('0x31')]['length']?_0x188432[_0x44d5('0x31')]:_0x178573[_0x44d5('0x30')];if(!_0x1ca2d1[_0x44d5('0x2e')][_0x44d5('0x34')](_0x44d5('0x35'))){_0x188432['limit']=qs['limit'](_0x1ca2d1[_0x44d5('0x2e')]['limit']);_0x188432[_0x44d5('0x1a')]=qs['offset'](_0x1ca2d1[_0x44d5('0x2e')][_0x44d5('0x1a')]);}_0x188432[_0x44d5('0x36')]=qs['sort'](_0x1ca2d1[_0x44d5('0x2e')]['sort']);_0x188432[_0x44d5('0x37')]=qs['filters'](_[_0x44d5('0x38')](_0x1ca2d1[_0x44d5('0x2e')],_0x178573[_0x44d5('0x2f')]),_0x3d4a82);if(_0x1ca2d1['query'][_0x44d5('0x39')]){_0x188432[_0x44d5('0x37')]=_[_0x44d5('0x3a')](_0x188432[_0x44d5('0x37')],{'$or':_[_0x44d5('0x29')](_0x3d4a82,function(_0x36f1d9){if(_0x36f1d9[_0x44d5('0x3b')]!==_0x44d5('0x3c')){var _0x18c9b7={};_0x18c9b7[_0x36f1d9[_0x44d5('0x28')]]={'$like':'%'+_0x1ca2d1['query']['filter']+'%'};return _0x18c9b7;}})});}_0x188432=_[_0x44d5('0x3a')]({},_0x188432,_0x1ca2d1['options']);var _0x48a3c9={'where':_0x188432[_0x44d5('0x37')]};return db[_0x44d5('0x2a')][_0x44d5('0x1d')](_0x48a3c9)['then'](function(_0x4b65dd){_0x2a73db[_0x44d5('0x1d')]=_0x4b65dd;if(_0x1ca2d1[_0x44d5('0x2e')][_0x44d5('0x3d')]){_0x188432[_0x44d5('0x3e')]=[{'all':!![]}];}return db[_0x44d5('0x2a')][_0x44d5('0x3f')](_0x188432);})[_0x44d5('0x24')](function(_0x5ea92f){_0x2a73db[_0x44d5('0x40')]=_0x5ea92f;return _0x2a73db;})['then'](respondWithFilteredResult(_0x545ac4,_0x188432))[_0x44d5('0x41')](handleError(_0x545ac4,null));};exports['show']=function(_0xf485d0,_0x2b4f93){var _0xb47cb0={'raw':![],'where':{'id':_0xf485d0[_0x44d5('0x42')]['id']}},_0x5f2451={};_0x5f2451[_0x44d5('0x30')]=_[_0x44d5('0x43')](db[_0x44d5('0x2a')][_0x44d5('0x2b')]);_0x5f2451['query']=_[_0x44d5('0x43')](_0xf485d0['query']);_0x5f2451[_0x44d5('0x2f')]=_[_0x44d5('0x32')](_0x5f2451[_0x44d5('0x30')],_0x5f2451['query']);_0xb47cb0[_0x44d5('0x31')]=_[_0x44d5('0x32')](_0x5f2451[_0x44d5('0x30')],qs[_0x44d5('0x33')](_0xf485d0[_0x44d5('0x2e')][_0x44d5('0x33')]));_0xb47cb0[_0x44d5('0x31')]=_0xb47cb0['attributes'][_0x44d5('0x44')]?_0xb47cb0[_0x44d5('0x31')]:_0x5f2451[_0x44d5('0x30')];if(_0xf485d0[_0x44d5('0x2e')]['includeAll']){_0xb47cb0['include']=[{'all':!![]}];}_0xb47cb0=_[_0x44d5('0x3a')]({},_0xb47cb0,_0xf485d0[_0x44d5('0x45')]);return db[_0x44d5('0x2a')]['find'](_0xb47cb0)[_0x44d5('0x24')](handleEntityNotFound(_0x2b4f93,null))[_0x44d5('0x24')](respondWithResult(_0x2b4f93,null))[_0x44d5('0x41')](handleError(_0x2b4f93,null));};exports[_0x44d5('0x46')]=function(_0x22493f,_0x3e4af6){return db[_0x44d5('0x2a')]['create'](_0x22493f[_0x44d5('0x47')],{})[_0x44d5('0x24')](respondWithResult(_0x3e4af6,0xc9))['catch'](handleError(_0x3e4af6,null));};exports[_0x44d5('0x23')]=function(_0x375722,_0x8bcfc6){if(_0x375722[_0x44d5('0x47')]['id']){delete _0x375722[_0x44d5('0x47')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x375722[_0x44d5('0x42')]['id']}})[_0x44d5('0x24')](handleEntityNotFound(_0x8bcfc6,null))[_0x44d5('0x24')](saveUpdates(_0x375722[_0x44d5('0x47')],null))[_0x44d5('0x24')](respondWithResult(_0x8bcfc6,null))[_0x44d5('0x41')](handleError(_0x8bcfc6,null));};exports['destroy']=function(_0x4239c1,_0x20a5fc){return db['SalesforceConfiguration'][_0x44d5('0x48')]({'where':{'id':_0x4239c1['params']['id']}})[_0x44d5('0x24')](handleEntityNotFound(_0x20a5fc,null))[_0x44d5('0x24')](removeEntity(_0x20a5fc,null))['catch'](handleError(_0x20a5fc,null));};exports[_0x44d5('0x49')]=function(_0x5f3eb6,_0x483687,_0x42e3ed){var _0x56365b={};var _0x413d9e={};var _0x5579e8;var _0x27fde9;return db[_0x44d5('0x2a')]['findOne']({'where':{'id':_0x5f3eb6[_0x44d5('0x42')]['id']}})[_0x44d5('0x24')](handleEntityNotFound(_0x483687,null))[_0x44d5('0x24')](function(_0x14c53d){if(_0x14c53d){_0x5579e8=_0x14c53d;_0x413d9e[_0x44d5('0x30')]=_['keys'](db[_0x44d5('0x4a')][_0x44d5('0x2b')]);_0x413d9e['query']=_[_0x44d5('0x43')](_0x5f3eb6[_0x44d5('0x2e')]);_0x413d9e[_0x44d5('0x2f')]=_[_0x44d5('0x32')](_0x413d9e[_0x44d5('0x30')],_0x413d9e[_0x44d5('0x2e')]);_0x56365b[_0x44d5('0x31')]=_['intersection'](_0x413d9e[_0x44d5('0x30')],qs[_0x44d5('0x33')](_0x5f3eb6[_0x44d5('0x2e')][_0x44d5('0x33')]));_0x56365b[_0x44d5('0x31')]=_0x56365b[_0x44d5('0x31')][_0x44d5('0x44')]?_0x56365b['attributes']:_0x413d9e['model'];_0x56365b[_0x44d5('0x36')]=qs[_0x44d5('0x4b')](_0x5f3eb6[_0x44d5('0x2e')][_0x44d5('0x4b')]);_0x56365b[_0x44d5('0x37')]=qs[_0x44d5('0x2f')](_[_0x44d5('0x38')](_0x5f3eb6[_0x44d5('0x2e')],_0x413d9e[_0x44d5('0x2f')]));if(_0x5f3eb6[_0x44d5('0x2e')][_0x44d5('0x39')]){_0x56365b[_0x44d5('0x37')]=_[_0x44d5('0x3a')](_0x56365b[_0x44d5('0x37')],{'$or':_[_0x44d5('0x29')](_0x56365b['attributes'],function(_0x76c5be){var _0x4a9528={};_0x4a9528[_0x76c5be]={'$like':'%'+_0x5f3eb6[_0x44d5('0x2e')]['filter']+'%'};return _0x4a9528;})});}_0x56365b=_[_0x44d5('0x3a')]({},_0x56365b,_0x5f3eb6[_0x44d5('0x45')]);return _0x5579e8[_0x44d5('0x49')](_0x56365b);}})[_0x44d5('0x24')](function(_0x25613f){if(_0x25613f){_0x27fde9=_0x25613f[_0x44d5('0x44')];if(!_0x5f3eb6[_0x44d5('0x2e')][_0x44d5('0x34')](_0x44d5('0x35'))){_0x56365b[_0x44d5('0x1b')]=qs['limit'](_0x5f3eb6['query'][_0x44d5('0x1b')]);_0x56365b[_0x44d5('0x1a')]=qs[_0x44d5('0x1a')](_0x5f3eb6[_0x44d5('0x2e')][_0x44d5('0x1a')]);}return _0x5579e8[_0x44d5('0x49')](_0x56365b);}})[_0x44d5('0x24')](function(_0x357cbf){if(_0x357cbf){return _0x357cbf?{'count':_0x27fde9,'rows':_0x357cbf}:null;}})[_0x44d5('0x24')](respondWithResult(_0x483687,null))[_0x44d5('0x41')](handleError(_0x483687,null));};exports[_0x44d5('0x4c')]=function(_0x180990,_0x474a28,_0x5aeccc){var _0x5c5c94={};var _0x5e09d1={};var _0x33b52e;var _0x4fc4c0;return db[_0x44d5('0x2a')]['findOne']({'where':{'id':_0x180990['params']['id']}})[_0x44d5('0x24')](handleEntityNotFound(_0x474a28,null))[_0x44d5('0x24')](function(_0x16e28f){if(_0x16e28f){_0x33b52e=_0x16e28f;_0x5e09d1[_0x44d5('0x30')]=_['keys'](db['SalesforceField'][_0x44d5('0x2b')]);_0x5e09d1[_0x44d5('0x2e')]=_['keys'](_0x180990[_0x44d5('0x2e')]);_0x5e09d1[_0x44d5('0x2f')]=_[_0x44d5('0x32')](_0x5e09d1[_0x44d5('0x30')],_0x5e09d1[_0x44d5('0x2e')]);_0x5c5c94['attributes']=_[_0x44d5('0x32')](_0x5e09d1[_0x44d5('0x30')],qs[_0x44d5('0x33')](_0x180990[_0x44d5('0x2e')][_0x44d5('0x33')]));_0x5c5c94[_0x44d5('0x31')]=_0x5c5c94['attributes']['length']?_0x5c5c94[_0x44d5('0x31')]:_0x5e09d1[_0x44d5('0x30')];_0x5c5c94[_0x44d5('0x36')]=qs[_0x44d5('0x4b')](_0x180990[_0x44d5('0x2e')][_0x44d5('0x4b')]);_0x5c5c94[_0x44d5('0x37')]=qs[_0x44d5('0x2f')](_[_0x44d5('0x38')](_0x180990['query'],_0x5e09d1[_0x44d5('0x2f')]));if(_0x180990['query'][_0x44d5('0x39')]){_0x5c5c94[_0x44d5('0x37')]=_['merge'](_0x5c5c94[_0x44d5('0x37')],{'$or':_['map'](_0x5c5c94[_0x44d5('0x31')],function(_0x3d7e25){var _0x323aba={};_0x323aba[_0x3d7e25]={'$like':'%'+_0x180990[_0x44d5('0x2e')][_0x44d5('0x39')]+'%'};return _0x323aba;})});}_0x5c5c94=_[_0x44d5('0x3a')]({},_0x5c5c94,_0x180990[_0x44d5('0x45')]);return _0x33b52e[_0x44d5('0x4c')](_0x5c5c94);}})[_0x44d5('0x24')](function(_0x1d6bb0){if(_0x1d6bb0){_0x4fc4c0=_0x1d6bb0[_0x44d5('0x44')];if(!_0x180990[_0x44d5('0x2e')][_0x44d5('0x34')](_0x44d5('0x35'))){_0x5c5c94[_0x44d5('0x1b')]=qs[_0x44d5('0x1b')](_0x180990[_0x44d5('0x2e')]['limit']);_0x5c5c94[_0x44d5('0x1a')]=qs[_0x44d5('0x1a')](_0x180990[_0x44d5('0x2e')]['offset']);}return _0x33b52e[_0x44d5('0x4c')](_0x5c5c94);}})[_0x44d5('0x24')](function(_0x1ea782){if(_0x1ea782){return _0x1ea782?{'count':_0x4fc4c0,'rows':_0x1ea782}:null;}})[_0x44d5('0x24')](respondWithResult(_0x474a28,null))[_0x44d5('0x41')](handleError(_0x474a28,null));};exports[_0x44d5('0x4d')]=function(_0x4a9244,_0x7d72cb,_0x44c616){var _0x444312={};var _0x2927da={};var _0x4e4e86;var _0x1d055d;return db[_0x44d5('0x2a')]['findOne']({'where':{'id':_0x4a9244[_0x44d5('0x42')]['id']}})[_0x44d5('0x24')](handleEntityNotFound(_0x7d72cb,null))['then'](function(_0x599972){if(_0x599972){_0x4e4e86=_0x599972;_0x2927da[_0x44d5('0x30')]=_[_0x44d5('0x43')](db[_0x44d5('0x4a')][_0x44d5('0x2b')]);_0x2927da[_0x44d5('0x2e')]=_['keys'](_0x4a9244[_0x44d5('0x2e')]);_0x2927da[_0x44d5('0x2f')]=_[_0x44d5('0x32')](_0x2927da[_0x44d5('0x30')],_0x2927da['query']);_0x444312[_0x44d5('0x31')]=_[_0x44d5('0x32')](_0x2927da['model'],qs[_0x44d5('0x33')](_0x4a9244[_0x44d5('0x2e')][_0x44d5('0x33')]));_0x444312[_0x44d5('0x31')]=_0x444312[_0x44d5('0x31')][_0x44d5('0x44')]?_0x444312[_0x44d5('0x31')]:_0x2927da[_0x44d5('0x30')];_0x444312[_0x44d5('0x36')]=qs[_0x44d5('0x4b')](_0x4a9244['query']['sort']);_0x444312[_0x44d5('0x37')]=qs[_0x44d5('0x2f')](_[_0x44d5('0x38')](_0x4a9244[_0x44d5('0x2e')],_0x2927da['filters']));if(_0x4a9244[_0x44d5('0x2e')][_0x44d5('0x39')]){_0x444312['where']=_[_0x44d5('0x3a')](_0x444312[_0x44d5('0x37')],{'$or':_[_0x44d5('0x29')](_0x444312[_0x44d5('0x31')],function(_0x325d7c){var _0x2e32b5={};_0x2e32b5[_0x325d7c]={'$like':'%'+_0x4a9244[_0x44d5('0x2e')][_0x44d5('0x39')]+'%'};return _0x2e32b5;})});}_0x444312=_[_0x44d5('0x3a')]({},_0x444312,_0x4a9244[_0x44d5('0x45')]);return _0x4e4e86[_0x44d5('0x4d')](_0x444312);}})[_0x44d5('0x24')](function(_0x5a6d63){if(_0x5a6d63){_0x1d055d=_0x5a6d63['length'];if(!_0x4a9244[_0x44d5('0x2e')][_0x44d5('0x34')](_0x44d5('0x35'))){_0x444312[_0x44d5('0x1b')]=qs['limit'](_0x4a9244[_0x44d5('0x2e')][_0x44d5('0x1b')]);_0x444312[_0x44d5('0x1a')]=qs[_0x44d5('0x1a')](_0x4a9244[_0x44d5('0x2e')][_0x44d5('0x1a')]);}return _0x4e4e86[_0x44d5('0x4d')](_0x444312);}})['then'](function(_0x178b3a){if(_0x178b3a){return _0x178b3a?{'count':_0x1d055d,'rows':_0x178b3a}:null;}})[_0x44d5('0x24')](respondWithResult(_0x7d72cb,null))[_0x44d5('0x41')](handleError(_0x7d72cb,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 11f8771..002ea7d 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 _0xb410=['./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x33007f,_0x4b38d2){var _0x10d38c=function(_0x497992){while(--_0x497992){_0x33007f['push'](_0x33007f['shift']());}};_0x10d38c(++_0x4b38d2);}(_0xb410,0x148));var _0x0b41=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0xb410[_0x44268d];return _0x4be92d;};'use strict';var _=require('lodash');var util=require(_0x0b41('0x0'));var logger=require(_0x0b41('0x1'))(_0x0b41('0x2'));var moment=require(_0x0b41('0x3'));var BPromise=require(_0x0b41('0x4'));var rp=require(_0x0b41('0x5'));var fs=require('fs');var path=require(_0x0b41('0x6'));var rimraf=require(_0x0b41('0x7'));var config=require('../../config/environment');var attributes=require(_0x0b41('0x8'));module[_0x0b41('0x9')]=function(_0x5b2d01,_0x30157f){return _0x5b2d01['define'](_0x0b41('0xa'),attributes,{'tableName':_0x0b41('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02df=['request-promise','rimraf','./intSalesforceConfiguration.attributes','define','lodash','moment'];(function(_0x49b8ab,_0x3a24a4){var _0x23998b=function(_0x36cc80){while(--_0x36cc80){_0x49b8ab['push'](_0x49b8ab['shift']());}};_0x23998b(++_0x3a24a4);}(_0x02df,0x112));var _0xf02d=function(_0x571e16,_0x313f07){_0x571e16=_0x571e16-0x0;var _0x84cef5=_0x02df[_0x571e16];return _0x84cef5;};'use strict';var _=require(_0xf02d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf02d('0x1'));var BPromise=require('bluebird');var rp=require(_0xf02d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf02d('0x3'));var config=require('../../config/environment');var attributes=require(_0xf02d('0x4'));module['exports']=function(_0x3a2915,_0x5e899d){return _0x3a2915[_0xf02d('0x5')]('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 a755654..23e6b02 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 _0x3abf=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x179c7e,_0x3c62ed){var _0xb2dcbb=function(_0x3829ff){while(--_0x3829ff){_0x179c7e['push'](_0x179c7e['shift']());}};_0xb2dcbb(++_0x3c62ed);}(_0x3abf,0x80));var _0xf3ab=function(_0x5d4a85,_0x1089f1){_0x5d4a85=_0x5d4a85-0x0;var _0x46544d=_0x3abf[_0x5d4a85];return _0x46544d;};'use strict';var _=require(_0xf3ab('0x0'));var util=require(_0xf3ab('0x1'));var moment=require(_0xf3ab('0x2'));var BPromise=require(_0xf3ab('0x3'));var rs=require(_0xf3ab('0x4'));var fs=require('fs');var Redis=require(_0xf3ab('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf3ab('0x6'));var logger=require(_0xf3ab('0x7'))(_0xf3ab('0x8'));var config=require('../../config/environment');var jayson=require(_0xf3ab('0x9'));var client=jayson[_0xf3ab('0xa')][_0xf3ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fd736,_0x40d6e4,_0x479d74){return new BPromise(function(_0x2b51d9,_0x5c1c6d){return client[_0xf3ab('0xc')](_0x2fd736,_0x479d74)[_0xf3ab('0xd')](function(_0x5f2e65){logger[_0xf3ab('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x40d6e4,_0xf3ab('0xf'));logger['debug'](_0xf3ab('0x10'),_0x40d6e4,'request\x20sent',JSON['stringify'](_0x5f2e65));if(_0x5f2e65[_0xf3ab('0x11')]){if(_0x5f2e65[_0xf3ab('0x11')][_0xf3ab('0x12')]===0x1f4){logger[_0xf3ab('0x11')](_0xf3ab('0x13'),_0x40d6e4,_0x5f2e65['error']['message']);return _0x5c1c6d(_0x5f2e65['error'][_0xf3ab('0x14')]);}logger['error'](_0xf3ab('0x13'),_0x40d6e4,_0x5f2e65[_0xf3ab('0x11')][_0xf3ab('0x14')]);return _0x2b51d9(_0x5f2e65[_0xf3ab('0x11')]['message']);}else{logger['info'](_0xf3ab('0x13'),_0x40d6e4,_0xf3ab('0xf'));_0x2b51d9(_0x5f2e65[_0xf3ab('0x15')][_0xf3ab('0x14')]);}})['catch'](function(_0x526f3e){logger[_0xf3ab('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x40d6e4,_0x526f3e);_0x5c1c6d(_0x526f3e);});});} \ No newline at end of file +var _0xa61d=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0xe59e1,_0x1a9346){var _0x18fa79=function(_0x2b3a04){while(--_0x2b3a04){_0xe59e1['push'](_0xe59e1['shift']());}};_0x18fa79(++_0x1a9346);}(_0xa61d,0x9b));var _0xda61=function(_0x265cf6,_0x26f1d8){_0x265cf6=_0x265cf6-0x0;var _0x3f2737=_0xa61d[_0x265cf6];return _0x3f2737;};'use strict';var _=require(_0xda61('0x0'));var util=require(_0xda61('0x1'));var moment=require(_0xda61('0x2'));var BPromise=require(_0xda61('0x3'));var rs=require(_0xda61('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda61('0x5'))['db'];var utils=require(_0xda61('0x6'));var logger=require(_0xda61('0x7'))(_0xda61('0x8'));var config=require('../../config/environment');var jayson=require(_0xda61('0x9'));var client=jayson[_0xda61('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fe529,_0x5b8a23,_0x3283c6){return new BPromise(function(_0x4a2599,_0x40ca83){return client[_0xda61('0xb')](_0x4fe529,_0x3283c6)[_0xda61('0xc')](function(_0x4e62f2){logger[_0xda61('0xd')](_0xda61('0xe'),_0x5b8a23,_0xda61('0xf'));logger[_0xda61('0x10')](_0xda61('0x11'),_0x5b8a23,_0xda61('0xf'),JSON[_0xda61('0x12')](_0x4e62f2));if(_0x4e62f2[_0xda61('0x13')]){if(_0x4e62f2[_0xda61('0x13')]['code']===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x5b8a23,_0x4e62f2[_0xda61('0x13')][_0xda61('0x14')]);return _0x40ca83(_0x4e62f2[_0xda61('0x13')][_0xda61('0x14')]);}logger[_0xda61('0x13')](_0xda61('0xe'),_0x5b8a23,_0x4e62f2[_0xda61('0x13')]['message']);return _0x4a2599(_0x4e62f2[_0xda61('0x13')]['message']);}else{logger[_0xda61('0xd')](_0xda61('0xe'),_0x5b8a23,_0xda61('0xf'));_0x4a2599(_0x4e62f2[_0xda61('0x15')][_0xda61('0x14')]);}})[_0xda61('0x16')](function(_0x4836be){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x5b8a23,_0x4836be);_0x40ca83(_0x4836be);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index c799cf0..bc5ab80 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 _0x723b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x47bf5d,_0x3abfaa){var _0x2a0c52=function(_0x4af8d1){while(--_0x4af8d1){_0x47bf5d['push'](_0x47bf5d['shift']());}};_0x2a0c52(++_0x3abfaa);}(_0x723b,0x1c9));var _0xb723=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x723b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xb723('0x0'));var util=require('util');var path=require(_0xb723('0x1'));var timeout=require(_0xb723('0x2'));var express=require(_0xb723('0x3'));var router=express[_0xb723('0x4')]();var fs_extra=require(_0xb723('0x5'));var auth=require(_0xb723('0x6'));var interaction=require(_0xb723('0x7'));var config=require(_0xb723('0x8'));var controller=require(_0xb723('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb723('0xa')](_0xb723('0xb'),auth['isAuthenticated'](),controller[_0xb723('0xc')]);router[_0xb723('0xd')]('/',auth[_0xb723('0xe')](),controller[_0xb723('0xf')]);router[_0xb723('0x10')](_0xb723('0xb'),auth[_0xb723('0xe')](),controller['update']);router[_0xb723('0x11')](_0xb723('0xb'),auth['isAuthenticated'](),controller[_0xb723('0x12')]);module[_0xb723('0x13')]=router; \ No newline at end of file +var _0x2228=['get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0x5b841c,_0x2114b8){var _0x1c2c5c=function(_0x4ae38c){while(--_0x4ae38c){_0x5b841c['push'](_0x5b841c['shift']());}};_0x1c2c5c(++_0x2114b8);}(_0x2228,0x136));var _0x8222=function(_0x424515,_0x45464b){_0x424515=_0x424515-0x0;var _0x164c98=_0x2228[_0x424515];return _0x164c98;};'use strict';var multer=require(_0x8222('0x0'));var util=require(_0x8222('0x1'));var path=require(_0x8222('0x2'));var timeout=require('connect-timeout');var express=require(_0x8222('0x3'));var router=express[_0x8222('0x4')]();var fs_extra=require(_0x8222('0x5'));var auth=require(_0x8222('0x6'));var interaction=require(_0x8222('0x7'));var config=require(_0x8222('0x8'));var controller=require(_0x8222('0x9'));router[_0x8222('0xa')]('/',auth[_0x8222('0xb')](),controller['index']);router[_0x8222('0xa')](_0x8222('0xc'),auth['isAuthenticated'](),controller[_0x8222('0xd')]);router[_0x8222('0xe')]('/',auth[_0x8222('0xb')](),controller['create']);router[_0x8222('0xf')](_0x8222('0xc'),auth[_0x8222('0xb')](),controller[_0x8222('0x10')]);router[_0x8222('0x11')](_0x8222('0xc'),auth['isAuthenticated'](),controller[_0x8222('0x12')]);module[_0x8222('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 7cbc6fd..b229f29 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 _0xc373=['exports','ENUM','variable','customVariable','picklist','STRING','string'];(function(_0x344bad,_0x70be29){var _0x13be12=function(_0x21ad26){while(--_0x21ad26){_0x344bad['push'](_0x344bad['shift']());}};_0x13be12(++_0x70be29);}(_0xc373,0x70));var _0x3c37=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0xc373[_0x26b5ff];return _0x58603e;};'use strict';var Sequelize=require('sequelize');module[_0x3c37('0x0')]={'type':{'type':Sequelize[_0x3c37('0x1')]('string',_0x3c37('0x2'),_0x3c37('0x3'),'keyValue',_0x3c37('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3c37('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3c37('0x1')](_0x3c37('0x6'),_0x3c37('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3c37('0x5')]},'variableName':{'type':Sequelize[_0x3c37('0x5')]}}; \ No newline at end of file +var _0x4cb8=['customVariable','ENUM','variable','keyValue','string','STRING'];(function(_0x3072b9,_0x42b978){var _0x192782=function(_0x424c7f){while(--_0x424c7f){_0x3072b9['push'](_0x3072b9['shift']());}};_0x192782(++_0x42b978);}(_0x4cb8,0x103));var _0x84cb=function(_0x346a7d,_0x5976cf){_0x346a7d=_0x346a7d-0x0;var _0x11f527=_0x4cb8[_0x346a7d];return _0x11f527;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x84cb('0x0')]('string',_0x84cb('0x1'),'customVariable',_0x84cb('0x2'),'picklist'),'defaultValue':_0x84cb('0x3')},'content':{'type':Sequelize[_0x84cb('0x4')]},'key':{'type':Sequelize[_0x84cb('0x4')]},'keyType':{'type':Sequelize[_0x84cb('0x0')](_0x84cb('0x3'),'variable',_0x84cb('0x5'))},'keyContent':{'type':Sequelize[_0x84cb('0x4')]},'idField':{'type':Sequelize[_0x84cb('0x4')]},'variableName':{'type':Sequelize[_0x84cb('0x4')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 72f9ab3..edc9e34 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 _0xf207=['attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','options','SalesforceField','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','index','map','rawAttributes','fieldName','type','model','keys','query'];(function(_0x2a0fc6,_0xf8faa9){var _0x533956=function(_0x857ce4){while(--_0x857ce4){_0x2a0fc6['push'](_0x2a0fc6['shift']());}};_0x533956(++_0xf8faa9);}(_0xf207,0x18b));var _0x7f20=function(_0x1f3c56,_0x598757){_0x1f3c56=_0x1f3c56-0x0;var _0x569524=_0xf207[_0x1f3c56];return _0x569524;};'use strict';var emlformat=require(_0x7f20('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7f20('0x1'));var jsonpatch=require(_0x7f20('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7f20('0x3'));var Mustache=require(_0x7f20('0x4'));var util=require(_0x7f20('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f20('0x6'));var _=require(_0x7f20('0x7'));var squel=require(_0x7f20('0x8'));var crypto=require(_0x7f20('0x9'));var jsforce=require(_0x7f20('0xa'));var deskjs=require(_0x7f20('0xb'));var toCsv=require(_0x7f20('0xc'));var querystring=require(_0x7f20('0xd'));var Papa=require(_0x7f20('0xe'));var Redis=require(_0x7f20('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7f20('0x10'));var as=require(_0x7f20('0x11'));var hardwareService=require(_0x7f20('0x12'));var logger=require(_0x7f20('0x13'))(_0x7f20('0x14'));var utils=require(_0x7f20('0x15'));var config=require(_0x7f20('0x16'));var licenseUtil=require(_0x7f20('0x17'));var db=require(_0x7f20('0x18'))['db'];function respondWithStatusCode(_0x20df4b,_0x4f42ca){_0x4f42ca=_0x4f42ca||0xcc;return function(_0x2ceeb1){if(_0x2ceeb1){return _0x20df4b[_0x7f20('0x19')](_0x4f42ca);}return _0x20df4b[_0x7f20('0x1a')](_0x4f42ca)['end']();};}function respondWithResult(_0x22c93b,_0x202ffe){_0x202ffe=_0x202ffe||0xc8;return function(_0x3c5746){if(_0x3c5746){return _0x22c93b['status'](_0x202ffe)[_0x7f20('0x1b')](_0x3c5746);}};}function respondWithFilteredResult(_0x168cd4,_0x238d6a){return function(_0x312bec){if(_0x312bec){var _0x366b68=typeof _0x238d6a[_0x7f20('0x1c')]===_0x7f20('0x1d')&&typeof _0x238d6a['limit']===_0x7f20('0x1d');var _0x47ef1d=_0x312bec[_0x7f20('0x1e')];var _0x57b1f7=_0x366b68?0x0:_0x238d6a[_0x7f20('0x1c')];var _0x47fa31=_0x366b68?_0x312bec[_0x7f20('0x1e')]:_0x238d6a[_0x7f20('0x1c')]+_0x238d6a['limit'];var _0x1bfc84;if(_0x47fa31>=_0x47ef1d){_0x47fa31=_0x47ef1d;_0x1bfc84=0xc8;}else{_0x1bfc84=0xce;}_0x168cd4[_0x7f20('0x1a')](_0x1bfc84);return _0x168cd4['set'](_0x7f20('0x1f'),_0x57b1f7+'-'+_0x47fa31+'/'+_0x47ef1d)[_0x7f20('0x1b')](_0x312bec);}return null;};}function patchUpdates(_0x9534d){return function(_0x222330){try{jsonpatch[_0x7f20('0x20')](_0x222330,_0x9534d,!![]);}catch(_0x57bc69){return BPromise[_0x7f20('0x21')](_0x57bc69);}return _0x222330[_0x7f20('0x22')]();};}function saveUpdates(_0x51c038,_0x4c5bb5){return function(_0x55cbfa){if(_0x55cbfa){return _0x55cbfa[_0x7f20('0x23')](_0x51c038)['then'](function(_0x105794){return _0x105794;});}return null;};}function removeEntity(_0x1e7a0b,_0x4ca665){return function(_0x5266b8){if(_0x5266b8){return _0x5266b8[_0x7f20('0x24')]()[_0x7f20('0x25')](function(){_0x1e7a0b[_0x7f20('0x1a')](0xcc)[_0x7f20('0x26')]();});}};}function handleEntityNotFound(_0x3d3fbf,_0x32c2fa){return function(_0x172bc9){if(!_0x172bc9){_0x3d3fbf['sendStatus'](0x194);}return _0x172bc9;};}function handleError(_0x52980d,_0x4755b9){_0x4755b9=_0x4755b9||0x1f4;return function(_0x30f33b){logger[_0x7f20('0x27')](_0x30f33b[_0x7f20('0x28')]);if(_0x30f33b['name']){delete _0x30f33b['name'];}_0x52980d['status'](_0x4755b9)['send'](_0x30f33b);};}exports[_0x7f20('0x29')]=function(_0x36b764,_0x7e2a6d){var _0x3c10b4={},_0x5911f9={},_0x175eff={'count':0x0,'rows':[]};var _0x178629=_[_0x7f20('0x2a')](db['SalesforceField'][_0x7f20('0x2b')],function(_0x56b460){return{'name':_0x56b460[_0x7f20('0x2c')],'type':_0x56b460[_0x7f20('0x2d')]['key']};});_0x5911f9[_0x7f20('0x2e')]=_[_0x7f20('0x2a')](_0x178629,'name');_0x5911f9['query']=_[_0x7f20('0x2f')](_0x36b764[_0x7f20('0x30')]);_0x5911f9['filters']=_['intersection'](_0x5911f9[_0x7f20('0x2e')],_0x5911f9['query']);_0x3c10b4[_0x7f20('0x31')]=_[_0x7f20('0x32')](_0x5911f9[_0x7f20('0x2e')],qs[_0x7f20('0x33')](_0x36b764[_0x7f20('0x30')]['fields']));_0x3c10b4[_0x7f20('0x31')]=_0x3c10b4['attributes']['length']?_0x3c10b4[_0x7f20('0x31')]:_0x5911f9['model'];if(!_0x36b764[_0x7f20('0x30')][_0x7f20('0x34')](_0x7f20('0x35'))){_0x3c10b4['limit']=qs['limit'](_0x36b764[_0x7f20('0x30')][_0x7f20('0x36')]);_0x3c10b4[_0x7f20('0x1c')]=qs[_0x7f20('0x1c')](_0x36b764[_0x7f20('0x30')][_0x7f20('0x1c')]);}_0x3c10b4['order']=qs[_0x7f20('0x37')](_0x36b764['query'][_0x7f20('0x37')]);_0x3c10b4[_0x7f20('0x38')]=qs[_0x7f20('0x39')](_[_0x7f20('0x3a')](_0x36b764['query'],_0x5911f9['filters']),_0x178629);if(_0x36b764[_0x7f20('0x30')][_0x7f20('0x3b')]){_0x3c10b4['where']=_[_0x7f20('0x3c')](_0x3c10b4[_0x7f20('0x38')],{'$or':_[_0x7f20('0x2a')](_0x178629,function(_0x303e4b){if(_0x303e4b['type']!=='VIRTUAL'){var _0x2217da={};_0x2217da[_0x303e4b['name']]={'$like':'%'+_0x36b764[_0x7f20('0x30')]['filter']+'%'};return _0x2217da;}})});}_0x3c10b4=_[_0x7f20('0x3c')]({},_0x3c10b4,_0x36b764[_0x7f20('0x3d')]);var _0x597099={'where':_0x3c10b4['where']};return db[_0x7f20('0x3e')][_0x7f20('0x1e')](_0x597099)[_0x7f20('0x25')](function(_0x4d9bbd){_0x175eff['count']=_0x4d9bbd;if(_0x36b764[_0x7f20('0x30')][_0x7f20('0x3f')]){_0x3c10b4[_0x7f20('0x40')]=[{'all':!![]}];}return db[_0x7f20('0x3e')][_0x7f20('0x41')](_0x3c10b4);})[_0x7f20('0x25')](function(_0x14e218){_0x175eff[_0x7f20('0x42')]=_0x14e218;return _0x175eff;})['then'](respondWithFilteredResult(_0x7e2a6d,_0x3c10b4))['catch'](handleError(_0x7e2a6d,null));};exports[_0x7f20('0x43')]=function(_0x1e0934,_0x3e3b7e){var _0x274985={'raw':!![],'where':{'id':_0x1e0934['params']['id']}},_0x47f379={};_0x47f379[_0x7f20('0x2e')]=_[_0x7f20('0x2f')](db[_0x7f20('0x3e')]['rawAttributes']);_0x47f379[_0x7f20('0x30')]=_[_0x7f20('0x2f')](_0x1e0934[_0x7f20('0x30')]);_0x47f379[_0x7f20('0x39')]=_[_0x7f20('0x32')](_0x47f379[_0x7f20('0x2e')],_0x47f379[_0x7f20('0x30')]);_0x274985[_0x7f20('0x31')]=_['intersection'](_0x47f379[_0x7f20('0x2e')],qs[_0x7f20('0x33')](_0x1e0934[_0x7f20('0x30')][_0x7f20('0x33')]));_0x274985['attributes']=_0x274985[_0x7f20('0x31')][_0x7f20('0x44')]?_0x274985[_0x7f20('0x31')]:_0x47f379['model'];if(_0x1e0934[_0x7f20('0x30')][_0x7f20('0x3f')]){_0x274985[_0x7f20('0x40')]=[{'all':!![]}];}_0x274985=_[_0x7f20('0x3c')]({},_0x274985,_0x1e0934[_0x7f20('0x3d')]);return db[_0x7f20('0x3e')][_0x7f20('0x45')](_0x274985)[_0x7f20('0x25')](handleEntityNotFound(_0x3e3b7e,null))[_0x7f20('0x25')](respondWithResult(_0x3e3b7e,null))[_0x7f20('0x46')](handleError(_0x3e3b7e,null));};exports[_0x7f20('0x47')]=function(_0x543e4f,_0x28a037){return db[_0x7f20('0x3e')]['create'](_0x543e4f[_0x7f20('0x48')],{})[_0x7f20('0x25')](respondWithResult(_0x28a037,0xc9))[_0x7f20('0x46')](handleError(_0x28a037,null));};exports[_0x7f20('0x23')]=function(_0x145e4a,_0x433a8f){if(_0x145e4a[_0x7f20('0x48')]['id']){delete _0x145e4a[_0x7f20('0x48')]['id'];}return db[_0x7f20('0x3e')][_0x7f20('0x45')]({'where':{'id':_0x145e4a[_0x7f20('0x49')]['id']}})['then'](handleEntityNotFound(_0x433a8f,null))[_0x7f20('0x25')](saveUpdates(_0x145e4a[_0x7f20('0x48')],null))[_0x7f20('0x25')](respondWithResult(_0x433a8f,null))[_0x7f20('0x46')](handleError(_0x433a8f,null));};exports[_0x7f20('0x24')]=function(_0x5a1dba,_0x4ffeac){return db['SalesforceField'][_0x7f20('0x45')]({'where':{'id':_0x5a1dba[_0x7f20('0x49')]['id']}})[_0x7f20('0x25')](handleEntityNotFound(_0x4ffeac,null))['then'](removeEntity(_0x4ffeac,null))[_0x7f20('0x46')](handleError(_0x4ffeac,null));}; \ No newline at end of file +var _0xe4e6=['merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','intersection','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','error','name','send','index','SalesforceField','rawAttributes','type','model','map','keys','query','filters','attributes','hasOwnProperty','nolimit','sort','where','filter'];(function(_0x1ac039,_0xfd648){var _0x52e541=function(_0x43e963){while(--_0x43e963){_0x1ac039['push'](_0x1ac039['shift']());}};_0x52e541(++_0xfd648);}(_0xe4e6,0xa6));var _0x6e4e=function(_0x1667ad,_0x1e803d){_0x1667ad=_0x1667ad-0x0;var _0x27eafa=_0xe4e6[_0x1667ad];return _0x27eafa;};'use strict';var emlformat=require(_0x6e4e('0x0'));var rimraf=require(_0x6e4e('0x1'));var zipdir=require(_0x6e4e('0x2'));var jsonpatch=require(_0x6e4e('0x3'));var rp=require(_0x6e4e('0x4'));var moment=require(_0x6e4e('0x5'));var BPromise=require(_0x6e4e('0x6'));var Mustache=require('mustache');var util=require(_0x6e4e('0x7'));var path=require('path');var sox=require(_0x6e4e('0x8'));var csv=require('to-csv');var ejs=require(_0x6e4e('0x9'));var fs=require('fs');var fs_extra=require(_0x6e4e('0xa'));var _=require('lodash');var squel=require(_0x6e4e('0xb'));var crypto=require('crypto');var jsforce=require(_0x6e4e('0xc'));var deskjs=require(_0x6e4e('0xd'));var toCsv=require(_0x6e4e('0xe'));var querystring=require(_0x6e4e('0xf'));var Papa=require('papaparse');var Redis=require(_0x6e4e('0x10'));var authService=require(_0x6e4e('0x11'));var qs=require(_0x6e4e('0x12'));var as=require(_0x6e4e('0x13'));var hardwareService=require(_0x6e4e('0x14'));var logger=require(_0x6e4e('0x15'))(_0x6e4e('0x16'));var utils=require(_0x6e4e('0x17'));var config=require(_0x6e4e('0x18'));var licenseUtil=require(_0x6e4e('0x19'));var db=require(_0x6e4e('0x1a'))['db'];function respondWithStatusCode(_0x56de56,_0x1ca47b){_0x1ca47b=_0x1ca47b||0xcc;return function(_0x3b829a){if(_0x3b829a){return _0x56de56[_0x6e4e('0x1b')](_0x1ca47b);}return _0x56de56[_0x6e4e('0x1c')](_0x1ca47b)[_0x6e4e('0x1d')]();};}function respondWithResult(_0x1eb463,_0x48b766){_0x48b766=_0x48b766||0xc8;return function(_0x26ee17){if(_0x26ee17){return _0x1eb463[_0x6e4e('0x1c')](_0x48b766)[_0x6e4e('0x1e')](_0x26ee17);}};}function respondWithFilteredResult(_0x47a2a5,_0x438d59){return function(_0x599bad){if(_0x599bad){var _0x41fc25=typeof _0x438d59[_0x6e4e('0x1f')]===_0x6e4e('0x20')&&typeof _0x438d59[_0x6e4e('0x21')]===_0x6e4e('0x20');var _0x38090b=_0x599bad[_0x6e4e('0x22')];var _0x3abcd7=_0x41fc25?0x0:_0x438d59[_0x6e4e('0x1f')];var _0x1c9d59=_0x41fc25?_0x599bad[_0x6e4e('0x22')]:_0x438d59[_0x6e4e('0x1f')]+_0x438d59[_0x6e4e('0x21')];var _0x26068a;if(_0x1c9d59>=_0x38090b){_0x1c9d59=_0x38090b;_0x26068a=0xc8;}else{_0x26068a=0xce;}_0x47a2a5[_0x6e4e('0x1c')](_0x26068a);return _0x47a2a5[_0x6e4e('0x23')](_0x6e4e('0x24'),_0x3abcd7+'-'+_0x1c9d59+'/'+_0x38090b)['json'](_0x599bad);}return null;};}function patchUpdates(_0x537291){return function(_0x3437e0){try{jsonpatch[_0x6e4e('0x25')](_0x3437e0,_0x537291,!![]);}catch(_0x4bba2a){return BPromise['reject'](_0x4bba2a);}return _0x3437e0[_0x6e4e('0x26')]();};}function saveUpdates(_0x17298e,_0x1a74c6){return function(_0x326397){if(_0x326397){return _0x326397[_0x6e4e('0x27')](_0x17298e)['then'](function(_0x3ac7b9){return _0x3ac7b9;});}return null;};}function removeEntity(_0x44413c,_0xc13497){return function(_0x2069a5){if(_0x2069a5){return _0x2069a5[_0x6e4e('0x28')]()['then'](function(){_0x44413c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1970e7,_0x45ec8f){return function(_0x151c38){if(!_0x151c38){_0x1970e7['sendStatus'](0x194);}return _0x151c38;};}function handleError(_0x4d486d,_0x5e1e97){_0x5e1e97=_0x5e1e97||0x1f4;return function(_0x554800){logger[_0x6e4e('0x29')](_0x554800['stack']);if(_0x554800[_0x6e4e('0x2a')]){delete _0x554800['name'];}_0x4d486d[_0x6e4e('0x1c')](_0x5e1e97)[_0x6e4e('0x2b')](_0x554800);};}exports[_0x6e4e('0x2c')]=function(_0x27178c,_0x3e369e){var _0x3bd5c3={},_0x428551={},_0x51e17a={'count':0x0,'rows':[]};var _0x47d4c7=_['map'](db[_0x6e4e('0x2d')][_0x6e4e('0x2e')],function(_0x221996){return{'name':_0x221996['fieldName'],'type':_0x221996[_0x6e4e('0x2f')]['key']};});_0x428551[_0x6e4e('0x30')]=_[_0x6e4e('0x31')](_0x47d4c7,_0x6e4e('0x2a'));_0x428551['query']=_[_0x6e4e('0x32')](_0x27178c[_0x6e4e('0x33')]);_0x428551[_0x6e4e('0x34')]=_['intersection'](_0x428551[_0x6e4e('0x30')],_0x428551['query']);_0x3bd5c3['attributes']=_['intersection'](_0x428551[_0x6e4e('0x30')],qs['fields'](_0x27178c[_0x6e4e('0x33')]['fields']));_0x3bd5c3[_0x6e4e('0x35')]=_0x3bd5c3[_0x6e4e('0x35')]['length']?_0x3bd5c3[_0x6e4e('0x35')]:_0x428551['model'];if(!_0x27178c['query'][_0x6e4e('0x36')](_0x6e4e('0x37'))){_0x3bd5c3[_0x6e4e('0x21')]=qs[_0x6e4e('0x21')](_0x27178c['query'][_0x6e4e('0x21')]);_0x3bd5c3[_0x6e4e('0x1f')]=qs[_0x6e4e('0x1f')](_0x27178c[_0x6e4e('0x33')][_0x6e4e('0x1f')]);}_0x3bd5c3['order']=qs[_0x6e4e('0x38')](_0x27178c[_0x6e4e('0x33')][_0x6e4e('0x38')]);_0x3bd5c3[_0x6e4e('0x39')]=qs[_0x6e4e('0x34')](_['pick'](_0x27178c[_0x6e4e('0x33')],_0x428551[_0x6e4e('0x34')]),_0x47d4c7);if(_0x27178c[_0x6e4e('0x33')][_0x6e4e('0x3a')]){_0x3bd5c3[_0x6e4e('0x39')]=_[_0x6e4e('0x3b')](_0x3bd5c3[_0x6e4e('0x39')],{'$or':_[_0x6e4e('0x31')](_0x47d4c7,function(_0x5cdcb1){if(_0x5cdcb1[_0x6e4e('0x2f')]!==_0x6e4e('0x3c')){var _0x217c81={};_0x217c81[_0x5cdcb1[_0x6e4e('0x2a')]]={'$like':'%'+_0x27178c[_0x6e4e('0x33')]['filter']+'%'};return _0x217c81;}})});}_0x3bd5c3=_[_0x6e4e('0x3b')]({},_0x3bd5c3,_0x27178c[_0x6e4e('0x3d')]);var _0x3cfc0c={'where':_0x3bd5c3['where']};return db['SalesforceField'][_0x6e4e('0x22')](_0x3cfc0c)[_0x6e4e('0x3e')](function(_0xe48c6e){_0x51e17a[_0x6e4e('0x22')]=_0xe48c6e;if(_0x27178c[_0x6e4e('0x33')][_0x6e4e('0x3f')]){_0x3bd5c3[_0x6e4e('0x40')]=[{'all':!![]}];}return db[_0x6e4e('0x2d')][_0x6e4e('0x41')](_0x3bd5c3);})['then'](function(_0x153e77){_0x51e17a[_0x6e4e('0x42')]=_0x153e77;return _0x51e17a;})['then'](respondWithFilteredResult(_0x3e369e,_0x3bd5c3))[_0x6e4e('0x43')](handleError(_0x3e369e,null));};exports[_0x6e4e('0x44')]=function(_0x5bcec9,_0xd955d7){var _0x389f60={'raw':!![],'where':{'id':_0x5bcec9[_0x6e4e('0x45')]['id']}},_0x4b9ff0={};_0x4b9ff0[_0x6e4e('0x30')]=_[_0x6e4e('0x32')](db[_0x6e4e('0x2d')][_0x6e4e('0x2e')]);_0x4b9ff0[_0x6e4e('0x33')]=_[_0x6e4e('0x32')](_0x5bcec9[_0x6e4e('0x33')]);_0x4b9ff0['filters']=_[_0x6e4e('0x46')](_0x4b9ff0[_0x6e4e('0x30')],_0x4b9ff0[_0x6e4e('0x33')]);_0x389f60[_0x6e4e('0x35')]=_[_0x6e4e('0x46')](_0x4b9ff0[_0x6e4e('0x30')],qs[_0x6e4e('0x47')](_0x5bcec9['query'][_0x6e4e('0x47')]));_0x389f60[_0x6e4e('0x35')]=_0x389f60['attributes']['length']?_0x389f60[_0x6e4e('0x35')]:_0x4b9ff0[_0x6e4e('0x30')];if(_0x5bcec9[_0x6e4e('0x33')][_0x6e4e('0x3f')]){_0x389f60['include']=[{'all':!![]}];}_0x389f60=_[_0x6e4e('0x3b')]({},_0x389f60,_0x5bcec9[_0x6e4e('0x3d')]);return db[_0x6e4e('0x2d')][_0x6e4e('0x48')](_0x389f60)['then'](handleEntityNotFound(_0xd955d7,null))[_0x6e4e('0x3e')](respondWithResult(_0xd955d7,null))[_0x6e4e('0x43')](handleError(_0xd955d7,null));};exports[_0x6e4e('0x49')]=function(_0x37cb58,_0x42dc4d){return db['SalesforceField'][_0x6e4e('0x49')](_0x37cb58['body'],{})[_0x6e4e('0x3e')](respondWithResult(_0x42dc4d,0xc9))['catch'](handleError(_0x42dc4d,null));};exports[_0x6e4e('0x27')]=function(_0x5beb81,_0x45f650){if(_0x5beb81[_0x6e4e('0x4a')]['id']){delete _0x5beb81[_0x6e4e('0x4a')]['id'];}return db[_0x6e4e('0x2d')][_0x6e4e('0x48')]({'where':{'id':_0x5beb81[_0x6e4e('0x45')]['id']}})[_0x6e4e('0x3e')](handleEntityNotFound(_0x45f650,null))[_0x6e4e('0x3e')](saveUpdates(_0x5beb81[_0x6e4e('0x4a')],null))[_0x6e4e('0x3e')](respondWithResult(_0x45f650,null))[_0x6e4e('0x43')](handleError(_0x45f650,null));};exports[_0x6e4e('0x28')]=function(_0x4dc704,_0x1ee0a1){return db[_0x6e4e('0x2d')][_0x6e4e('0x48')]({'where':{'id':_0x4dc704['params']['id']}})[_0x6e4e('0x3e')](handleEntityNotFound(_0x1ee0a1,null))[_0x6e4e('0x3e')](removeEntity(_0x1ee0a1,null))[_0x6e4e('0x43')](handleError(_0x1ee0a1,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index e2bdeb4..db8eee2 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 _0x5b9f=['exports','define','SalesforceField','int_salesforce_fields','lodash','util','api','bluebird','request-promise','rimraf','./intSalesforceField.attributes'];(function(_0x4d886a,_0x1980d3){var _0x3fa895=function(_0x3731f8){while(--_0x3731f8){_0x4d886a['push'](_0x4d886a['shift']());}};_0x3fa895(++_0x1980d3);}(_0x5b9f,0x138));var _0xf5b9=function(_0x403905,_0x10afdd){_0x403905=_0x403905-0x0;var _0x31f3c3=_0x5b9f[_0x403905];return _0x31f3c3;};'use strict';var _=require(_0xf5b9('0x0'));var util=require(_0xf5b9('0x1'));var logger=require('../../config/logger')(_0xf5b9('0x2'));var moment=require('moment');var BPromise=require(_0xf5b9('0x3'));var rp=require(_0xf5b9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf5b9('0x5'));var config=require('../../config/environment');var attributes=require(_0xf5b9('0x6'));module[_0xf5b9('0x7')]=function(_0x452b9f,_0x5eeae3){return _0x452b9f[_0xf5b9('0x8')](_0xf5b9('0x9'),attributes,{'tableName':_0xf5b9('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d34=['moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x290334,_0xfdc527){var _0x22e33=function(_0x519bac){while(--_0x519bac){_0x290334['push'](_0x290334['shift']());}};_0x22e33(++_0xfdc527);}(_0x6d34,0x15a));var _0x46d3=function(_0x7aa661,_0x3c423a){_0x7aa661=_0x7aa661-0x0;var _0x1350bd=_0x6d34[_0x7aa661];return _0x1350bd;};'use strict';var _=require(_0x46d3('0x0'));var util=require(_0x46d3('0x1'));var logger=require(_0x46d3('0x2'))(_0x46d3('0x3'));var moment=require(_0x46d3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x46d3('0x5'));var rimraf=require(_0x46d3('0x6'));var config=require(_0x46d3('0x7'));var attributes=require(_0x46d3('0x8'));module[_0x46d3('0x9')]=function(_0x132374,_0x2fd6e7){return _0x132374[_0x46d3('0xa')](_0x46d3('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x46d3('0xc'),'fields':[_0x46d3('0xd'),'FieldId'],'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 2c2baad..7716012 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 _0x3c59=['SalesforceField,\x20%s,\x20%s','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x1e09d3,_0x36247c){var _0x11efb9=function(_0x53e456){while(--_0x53e456){_0x1e09d3['push'](_0x1e09d3['shift']());}};_0x11efb9(++_0x36247c);}(_0x3c59,0xb1));var _0x93c5=function(_0x383493,_0x173752){_0x383493=_0x383493-0x0;var _0x38aebc=_0x3c59[_0x383493];return _0x38aebc;};'use strict';var _=require(_0x93c5('0x0'));var util=require(_0x93c5('0x1'));var moment=require(_0x93c5('0x2'));var BPromise=require(_0x93c5('0x3'));var rs=require(_0x93c5('0x4'));var fs=require('fs');var Redis=require(_0x93c5('0x5'));var db=require(_0x93c5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x93c5('0x7'))(_0x93c5('0x8'));var config=require('../../config/environment');var jayson=require(_0x93c5('0x9'));var client=jayson[_0x93c5('0xa')][_0x93c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29c8cf,_0x5ba630,_0x2e8029){return new BPromise(function(_0x3a0ffc,_0x520808){return client[_0x93c5('0xc')](_0x29c8cf,_0x2e8029)[_0x93c5('0xd')](function(_0x44f7ad){logger[_0x93c5('0xe')](_0x93c5('0xf'),_0x5ba630,'request\x20sent');logger['debug'](_0x93c5('0x10'),_0x5ba630,_0x93c5('0x11'),JSON[_0x93c5('0x12')](_0x44f7ad));if(_0x44f7ad[_0x93c5('0x13')]){if(_0x44f7ad['error'][_0x93c5('0x14')]===0x1f4){logger['error'](_0x93c5('0xf'),_0x5ba630,_0x44f7ad[_0x93c5('0x13')]['message']);return _0x520808(_0x44f7ad[_0x93c5('0x13')][_0x93c5('0x15')]);}logger[_0x93c5('0x13')]('SalesforceField,\x20%s,\x20%s',_0x5ba630,_0x44f7ad[_0x93c5('0x13')][_0x93c5('0x15')]);return _0x3a0ffc(_0x44f7ad[_0x93c5('0x13')][_0x93c5('0x15')]);}else{logger[_0x93c5('0xe')](_0x93c5('0xf'),_0x5ba630,'request\x20sent');_0x3a0ffc(_0x44f7ad[_0x93c5('0x16')][_0x93c5('0x15')]);}})[_0x93c5('0x17')](function(_0x3aea33){logger[_0x93c5('0x13')]('SalesforceField,\x20%s,\x20%s',_0x5ba630,_0x3aea33);_0x520808(_0x3aea33);});});} \ No newline at end of file +var _0xcdf4=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x337e2b,_0x222806){var _0x31a150=function(_0x5ac4dd){while(--_0x5ac4dd){_0x337e2b['push'](_0x337e2b['shift']());}};_0x31a150(++_0x222806);}(_0xcdf4,0x1cf));var _0x4cdf=function(_0x4844ba,_0x73b99d){_0x4844ba=_0x4844ba-0x0;var _0x529a9f=_0xcdf4[_0x4844ba];return _0x529a9f;};'use strict';var _=require(_0x4cdf('0x0'));var util=require('util');var moment=require(_0x4cdf('0x1'));var BPromise=require(_0x4cdf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cdf('0x3'));var db=require(_0x4cdf('0x4'))['db'];var utils=require(_0x4cdf('0x5'));var logger=require('../../config/logger')(_0x4cdf('0x6'));var config=require('../../config/environment');var jayson=require(_0x4cdf('0x7'));var client=jayson[_0x4cdf('0x8')][_0x4cdf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33ac6c,_0x2ca8b9,_0x1c0661){return new BPromise(function(_0x341aec,_0xce24d1){return client[_0x4cdf('0xa')](_0x33ac6c,_0x1c0661)['then'](function(_0x57e4af){logger[_0x4cdf('0xb')](_0x4cdf('0xc'),_0x2ca8b9,_0x4cdf('0xd'));logger[_0x4cdf('0xe')](_0x4cdf('0xf'),_0x2ca8b9,'request\x20sent',JSON[_0x4cdf('0x10')](_0x57e4af));if(_0x57e4af[_0x4cdf('0x11')]){if(_0x57e4af[_0x4cdf('0x11')][_0x4cdf('0x12')]===0x1f4){logger[_0x4cdf('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2ca8b9,_0x57e4af[_0x4cdf('0x11')][_0x4cdf('0x13')]);return _0xce24d1(_0x57e4af[_0x4cdf('0x11')]['message']);}logger[_0x4cdf('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2ca8b9,_0x57e4af[_0x4cdf('0x11')]['message']);return _0x341aec(_0x57e4af[_0x4cdf('0x11')]['message']);}else{logger[_0x4cdf('0xb')](_0x4cdf('0xc'),_0x2ca8b9,_0x4cdf('0xd'));_0x341aec(_0x57e4af[_0x4cdf('0x14')][_0x4cdf('0x13')]);}})[_0x4cdf('0x15')](function(_0x46e6bd){logger[_0x4cdf('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2ca8b9,_0x46e6bd);_0xce24d1(_0x46e6bd);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 421d94d..cebd5e9 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 _0xf296=['exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','create','addConfiguration','/:id','update','delete','destroy'];(function(_0x35ae6c,_0x4183e9){var _0x49fffb=function(_0x5ecfa2){while(--_0x5ecfa2){_0x35ae6c['push'](_0x35ae6c['shift']());}};_0x49fffb(++_0x4183e9);}(_0xf296,0x94));var _0x6f29=function(_0x476bcd,_0x2f6582){_0x476bcd=_0x476bcd-0x0;var _0x47b60f=_0xf296[_0x476bcd];return _0x47b60f;};'use strict';var multer=require(_0x6f29('0x0'));var util=require(_0x6f29('0x1'));var path=require('path');var timeout=require(_0x6f29('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6f29('0x3'));var auth=require(_0x6f29('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6f29('0x5'));var controller=require(_0x6f29('0x6'));router[_0x6f29('0x7')]('/',auth['isAuthenticated'](),controller[_0x6f29('0x8')]);router[_0x6f29('0x7')]('/:id',auth[_0x6f29('0x9')](),controller[_0x6f29('0xa')]);router[_0x6f29('0x7')](_0x6f29('0xb'),auth[_0x6f29('0x9')](),controller[_0x6f29('0xc')]);router[_0x6f29('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x6f29('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6f29('0xe')]);router['post'](_0x6f29('0xb'),auth[_0x6f29('0x9')](),controller[_0x6f29('0xf')]);router['put'](_0x6f29('0x10'),auth[_0x6f29('0x9')](),controller[_0x6f29('0x11')]);router[_0x6f29('0x12')](_0x6f29('0x10'),auth['isAuthenticated'](),controller[_0x6f29('0x13')]);module[_0x6f29('0x14')]=router; \ No newline at end of file +var _0xacc5=['/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations'];(function(_0x3d70e9,_0x272b11){var _0x208dc9=function(_0x37e614){while(--_0x37e614){_0x3d70e9['push'](_0x3d70e9['shift']());}};_0x208dc9(++_0x272b11);}(_0xacc5,0x104));var _0x5acc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xacc5[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x5acc('0x0'));var util=require(_0x5acc('0x1'));var path=require(_0x5acc('0x2'));var timeout=require(_0x5acc('0x3'));var express=require('express');var router=express[_0x5acc('0x4')]();var fs_extra=require(_0x5acc('0x5'));var auth=require(_0x5acc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x5acc('0x7')](),controller['index']);router[_0x5acc('0x8')](_0x5acc('0x9'),auth['isAuthenticated'](),controller[_0x5acc('0xa')]);router['get'](_0x5acc('0xb'),auth['isAuthenticated'](),controller[_0x5acc('0xc')]);router[_0x5acc('0x8')](_0x5acc('0xd'),auth[_0x5acc('0x7')](),controller[_0x5acc('0xe')]);router[_0x5acc('0xf')]('/',auth[_0x5acc('0x7')](),controller[_0x5acc('0x10')]);router[_0x5acc('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x5acc('0x11')]);router[_0x5acc('0x12')](_0x5acc('0x9'),auth['isAuthenticated'](),controller[_0x5acc('0x13')]);router[_0x5acc('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 52e5fd2..2c47591 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 _0x1d7d=['sequelize','exports','STRING'];(function(_0x57b44b,_0xb7dfc8){var _0x1736c1=function(_0x43b8b3){while(--_0x43b8b3){_0x57b44b['push'](_0x57b44b['shift']());}};_0x1736c1(++_0xb7dfc8);}(_0x1d7d,0x105));var _0xd1d7=function(_0x32c102,_0x2f33b7){_0x32c102=_0x32c102-0x0;var _0x5943c0=_0x1d7d[_0x32c102];return _0x5943c0;};'use strict';var Sequelize=require(_0xd1d7('0x0'));module[_0xd1d7('0x1')]={'name':{'type':Sequelize[_0xd1d7('0x2')]},'description':{'type':Sequelize[_0xd1d7('0x2')]},'username':{'type':Sequelize[_0xd1d7('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xd1d7('0x2')]},'email':{'type':Sequelize[_0xd1d7('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd1d7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xda41=['remoteUri','sequelize','exports','STRING'];(function(_0x2a8762,_0x1acc08){var _0x1d4181=function(_0x3902ed){while(--_0x3902ed){_0x2a8762['push'](_0x2a8762['shift']());}};_0x1d4181(++_0x1acc08);}(_0xda41,0x191));var _0x1da4=function(_0x5da82e,_0x2cf875){_0x5da82e=_0x5da82e-0x0;var _0x49a714=_0xda41[_0x5da82e];return _0x49a714;};'use strict';var Sequelize=require(_0x1da4('0x0'));module[_0x1da4('0x1')]={'name':{'type':Sequelize[_0x1da4('0x2')]},'description':{'type':Sequelize[_0x1da4('0x2')]},'username':{'type':Sequelize[_0x1da4('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x1da4('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1da4('0x2')],'unique':_0x1da4('0x3')},'serverUrl':{'type':Sequelize[_0x1da4('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 d51af45..c068318 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 _0xb2d2=['additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','statusCode','error','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','type','VIRTUAL','options','ServicenowAccount','includeAll','include','findAll','catch','params','find','create','body','update','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','channel','ServicenowField','hold_reason','knowledge','close_code','notify','incident_state','category','made_sla','watch_list','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','approval_set','subcategory','work_notes','short_description','correlation_display','assignment_group','business_stc'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb2d2,0x1a8));var _0x2b2d=function(_0x3127f3,_0xb0df5c){_0x3127f3=_0x3127f3-0x0;var _0x1b846d=_0xb2d2[_0x3127f3];return _0x1b846d;};'use strict';var emlformat=require(_0x2b2d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b2d('0x1'));var rp=require(_0x2b2d('0x2'));var moment=require(_0x2b2d('0x3'));var BPromise=require(_0x2b2d('0x4'));var Mustache=require(_0x2b2d('0x5'));var util=require('util');var path=require(_0x2b2d('0x6'));var sox=require(_0x2b2d('0x7'));var csv=require('to-csv');var ejs=require(_0x2b2d('0x8'));var fs=require('fs');var fs_extra=require(_0x2b2d('0x9'));var _=require(_0x2b2d('0xa'));var squel=require(_0x2b2d('0xb'));var crypto=require(_0x2b2d('0xc'));var jsforce=require(_0x2b2d('0xd'));var deskjs=require(_0x2b2d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2b2d('0xf'));var Papa=require(_0x2b2d('0x10'));var Redis=require(_0x2b2d('0x11'));var authService=require(_0x2b2d('0x12'));var qs=require(_0x2b2d('0x13'));var as=require(_0x2b2d('0x14'));var hardwareService=require(_0x2b2d('0x15'));var logger=require('../../config/logger')(_0x2b2d('0x16'));var utils=require(_0x2b2d('0x17'));var config=require(_0x2b2d('0x18'));var licenseUtil=require(_0x2b2d('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2b2d('0x1a'));function respondWithStatusCode(_0x1e3344,_0x1e3f2c){_0x1e3f2c=_0x1e3f2c||0xcc;return function(_0x5312b5){if(_0x5312b5){return _0x1e3344[_0x2b2d('0x1b')](_0x1e3f2c);}return _0x1e3344['status'](_0x1e3f2c)[_0x2b2d('0x1c')]();};}function respondWithResult(_0x2577e6,_0x16f430){_0x16f430=_0x16f430||0xc8;return function(_0x536c97){if(_0x536c97){return _0x2577e6[_0x2b2d('0x1d')](_0x16f430)[_0x2b2d('0x1e')](_0x536c97);}};}function respondWithFilteredResult(_0x3d0fd9,_0x1faea8){return function(_0x4599af){if(_0x4599af){var _0x3cf7ce=typeof _0x1faea8[_0x2b2d('0x1f')]===_0x2b2d('0x20')&&typeof _0x1faea8['limit']==='undefined';var _0xa30ce3=_0x4599af[_0x2b2d('0x21')];var _0x502096=_0x3cf7ce?0x0:_0x1faea8[_0x2b2d('0x1f')];var _0x5c6068=_0x3cf7ce?_0x4599af['count']:_0x1faea8['offset']+_0x1faea8['limit'];var _0x1310d8;if(_0x5c6068>=_0xa30ce3){_0x5c6068=_0xa30ce3;_0x1310d8=0xc8;}else{_0x1310d8=0xce;}_0x3d0fd9['status'](_0x1310d8);return _0x3d0fd9[_0x2b2d('0x22')](_0x2b2d('0x23'),_0x502096+'-'+_0x5c6068+'/'+_0xa30ce3)[_0x2b2d('0x1e')](_0x4599af);}return null;};}function patchUpdates(_0x427667){return function(_0x40962b){try{jsonpatch[_0x2b2d('0x24')](_0x40962b,_0x427667,!![]);}catch(_0x3e0b96){return BPromise[_0x2b2d('0x25')](_0x3e0b96);}return _0x40962b['save']();};}function saveUpdates(_0x2dd39d,_0x2574fe){return function(_0x34b06f){if(_0x34b06f){return _0x34b06f['update'](_0x2dd39d)[_0x2b2d('0x26')](function(_0xe12845){return _0xe12845;});}return null;};}function removeEntity(_0x38bbe2,_0x5ca57d){return function(_0x5992fb){if(_0x5992fb){return _0x5992fb[_0x2b2d('0x27')]()['then'](function(){_0x38bbe2[_0x2b2d('0x1d')](0xcc)[_0x2b2d('0x1c')]();});}};}function handleEntityNotFound(_0x54823b,_0xf9eb6d){return function(_0x8b63ce){if(!_0x8b63ce){_0x54823b['sendStatus'](0x194);}return _0x8b63ce;};}function handleError(_0x1b2103,_0x318e4c){_0x318e4c=_0x318e4c||0x1f4;return function(_0x2b76b2){logger['error'](_0x2b76b2[_0x2b2d('0x28')]);if(_0x2b76b2['name']){delete _0x2b76b2[_0x2b2d('0x29')];}_0x1b2103[_0x2b2d('0x1d')](_0x318e4c)[_0x2b2d('0x2a')](_0x2b76b2);};}exports[_0x2b2d('0x2b')]=function(_0x39ebb3,_0x203cbc){var _0x2d282e={},_0x55ffbe={},_0x300c5b={'count':0x0,'rows':[]};var _0x24b303=_[_0x2b2d('0x2c')](db['ServicenowAccount'][_0x2b2d('0x2d')],function(_0x5107c1){return{'name':_0x5107c1[_0x2b2d('0x2e')],'type':_0x5107c1['type'][_0x2b2d('0x2f')]};});_0x55ffbe[_0x2b2d('0x30')]=_['map'](_0x24b303,_0x2b2d('0x29'));_0x55ffbe[_0x2b2d('0x31')]=_[_0x2b2d('0x32')](_0x39ebb3[_0x2b2d('0x31')]);_0x55ffbe[_0x2b2d('0x33')]=_['intersection'](_0x55ffbe['model'],_0x55ffbe[_0x2b2d('0x31')]);_0x2d282e[_0x2b2d('0x34')]=_[_0x2b2d('0x35')](_0x55ffbe[_0x2b2d('0x30')],qs['fields'](_0x39ebb3[_0x2b2d('0x31')][_0x2b2d('0x36')]));_0x2d282e[_0x2b2d('0x34')]=_0x2d282e[_0x2b2d('0x34')][_0x2b2d('0x37')]?_0x2d282e[_0x2b2d('0x34')]:_0x55ffbe[_0x2b2d('0x30')];if(!_0x39ebb3[_0x2b2d('0x31')][_0x2b2d('0x38')](_0x2b2d('0x39'))){_0x2d282e['limit']=qs[_0x2b2d('0x3a')](_0x39ebb3[_0x2b2d('0x31')][_0x2b2d('0x3a')]);_0x2d282e[_0x2b2d('0x1f')]=qs[_0x2b2d('0x1f')](_0x39ebb3[_0x2b2d('0x31')][_0x2b2d('0x1f')]);}_0x2d282e[_0x2b2d('0x3b')]=qs[_0x2b2d('0x3c')](_0x39ebb3[_0x2b2d('0x31')]['sort']);_0x2d282e['where']=qs['filters'](_['pick'](_0x39ebb3[_0x2b2d('0x31')],_0x55ffbe[_0x2b2d('0x33')]),_0x24b303);if(_0x39ebb3['query'][_0x2b2d('0x3d')]){_0x2d282e[_0x2b2d('0x3e')]=_[_0x2b2d('0x3f')](_0x2d282e[_0x2b2d('0x3e')],{'$or':_[_0x2b2d('0x2c')](_0x24b303,function(_0xab9581){if(_0xab9581[_0x2b2d('0x40')]!==_0x2b2d('0x41')){var _0x33f077={};_0x33f077[_0xab9581[_0x2b2d('0x29')]]={'$like':'%'+_0x39ebb3[_0x2b2d('0x31')]['filter']+'%'};return _0x33f077;}})});}_0x2d282e=_[_0x2b2d('0x3f')]({},_0x2d282e,_0x39ebb3[_0x2b2d('0x42')]);var _0xcdde59={'where':_0x2d282e[_0x2b2d('0x3e')]};return db[_0x2b2d('0x43')][_0x2b2d('0x21')](_0xcdde59)[_0x2b2d('0x26')](function(_0x250105){_0x300c5b[_0x2b2d('0x21')]=_0x250105;if(_0x39ebb3['query'][_0x2b2d('0x44')]){_0x2d282e[_0x2b2d('0x45')]=[{'all':!![]}];}return db[_0x2b2d('0x43')][_0x2b2d('0x46')](_0x2d282e);})[_0x2b2d('0x26')](function(_0xf7c5ab){_0x300c5b['rows']=_0xf7c5ab;return _0x300c5b;})['then'](respondWithFilteredResult(_0x203cbc,_0x2d282e))[_0x2b2d('0x47')](handleError(_0x203cbc,null));};exports['show']=function(_0x3a89ac,_0x4f9cd5){var _0x504b1a={'raw':![],'where':{'id':_0x3a89ac[_0x2b2d('0x48')]['id']}},_0x5de36a={};_0x5de36a['model']=_[_0x2b2d('0x32')](db[_0x2b2d('0x43')][_0x2b2d('0x2d')]);_0x5de36a[_0x2b2d('0x31')]=_['keys'](_0x3a89ac[_0x2b2d('0x31')]);_0x5de36a[_0x2b2d('0x33')]=_[_0x2b2d('0x35')](_0x5de36a[_0x2b2d('0x30')],_0x5de36a[_0x2b2d('0x31')]);_0x504b1a[_0x2b2d('0x34')]=_[_0x2b2d('0x35')](_0x5de36a[_0x2b2d('0x30')],qs[_0x2b2d('0x36')](_0x3a89ac[_0x2b2d('0x31')][_0x2b2d('0x36')]));_0x504b1a['attributes']=_0x504b1a[_0x2b2d('0x34')]['length']?_0x504b1a[_0x2b2d('0x34')]:_0x5de36a[_0x2b2d('0x30')];if(_0x3a89ac[_0x2b2d('0x31')]['includeAll']){_0x504b1a[_0x2b2d('0x45')]=[{'all':!![]}];}_0x504b1a=_[_0x2b2d('0x3f')]({},_0x504b1a,_0x3a89ac[_0x2b2d('0x42')]);return db[_0x2b2d('0x43')][_0x2b2d('0x49')](_0x504b1a)[_0x2b2d('0x26')](handleEntityNotFound(_0x4f9cd5,null))[_0x2b2d('0x26')](respondWithResult(_0x4f9cd5,null))['catch'](handleError(_0x4f9cd5,null));};exports['create']=function(_0x490f0e,_0x214329){return db['ServicenowAccount'][_0x2b2d('0x4a')](_0x490f0e[_0x2b2d('0x4b')],{})[_0x2b2d('0x26')](respondWithResult(_0x214329,0xc9))[_0x2b2d('0x47')](handleError(_0x214329,null));};exports[_0x2b2d('0x4c')]=function(_0x6e37d7,_0x5fd23){if(_0x6e37d7['body']['id']){delete _0x6e37d7[_0x2b2d('0x4b')]['id'];}return db[_0x2b2d('0x43')][_0x2b2d('0x49')]({'where':{'id':_0x6e37d7[_0x2b2d('0x48')]['id']}})['then'](handleEntityNotFound(_0x5fd23,null))[_0x2b2d('0x26')](saveUpdates(_0x6e37d7[_0x2b2d('0x4b')],null))[_0x2b2d('0x26')](respondWithResult(_0x5fd23,null))['catch'](handleError(_0x5fd23,null));};exports[_0x2b2d('0x27')]=function(_0x3f8fb7,_0xe27ae0){return db[_0x2b2d('0x43')][_0x2b2d('0x49')]({'where':{'id':_0x3f8fb7[_0x2b2d('0x48')]['id']}})[_0x2b2d('0x26')](handleEntityNotFound(_0xe27ae0,null))[_0x2b2d('0x26')](removeEntity(_0xe27ae0,null))[_0x2b2d('0x47')](handleError(_0xe27ae0,null));};exports[_0x2b2d('0x4d')]=function(_0x55ef58,_0x249b09,_0x2f53df){var _0x433c6d={};var _0x5d43f7={};var _0x8abc8a;var _0x2b17a2;return db[_0x2b2d('0x43')][_0x2b2d('0x4e')]({'where':{'id':_0x55ef58[_0x2b2d('0x48')]['id']}})[_0x2b2d('0x26')](handleEntityNotFound(_0x249b09,null))[_0x2b2d('0x26')](function(_0x337496){if(_0x337496){_0x8abc8a=_0x337496;_0x5d43f7[_0x2b2d('0x30')]=_[_0x2b2d('0x32')](db[_0x2b2d('0x4f')][_0x2b2d('0x2d')]);_0x5d43f7[_0x2b2d('0x31')]=_[_0x2b2d('0x32')](_0x55ef58[_0x2b2d('0x31')]);_0x5d43f7['filters']=_[_0x2b2d('0x35')](_0x5d43f7['model'],_0x5d43f7['query']);_0x433c6d['attributes']=_[_0x2b2d('0x35')](_0x5d43f7[_0x2b2d('0x30')],qs[_0x2b2d('0x36')](_0x55ef58[_0x2b2d('0x31')][_0x2b2d('0x36')]));_0x433c6d[_0x2b2d('0x34')]=_0x433c6d[_0x2b2d('0x34')]['length']?_0x433c6d['attributes']:_0x5d43f7[_0x2b2d('0x30')];_0x433c6d['order']=qs[_0x2b2d('0x3c')](_0x55ef58[_0x2b2d('0x31')][_0x2b2d('0x3c')]);_0x433c6d[_0x2b2d('0x3e')]=qs[_0x2b2d('0x33')](_['pick'](_0x55ef58[_0x2b2d('0x31')],_0x5d43f7[_0x2b2d('0x33')]));if(_0x55ef58[_0x2b2d('0x31')][_0x2b2d('0x3d')]){_0x433c6d[_0x2b2d('0x3e')]=_[_0x2b2d('0x3f')](_0x433c6d[_0x2b2d('0x3e')],{'$or':_[_0x2b2d('0x2c')](_0x433c6d[_0x2b2d('0x34')],function(_0x5d8dc7){var _0x44170c={};_0x44170c[_0x5d8dc7]={'$like':'%'+_0x55ef58[_0x2b2d('0x31')][_0x2b2d('0x3d')]+'%'};return _0x44170c;})});}_0x433c6d=_[_0x2b2d('0x3f')]({},_0x433c6d,_0x55ef58[_0x2b2d('0x42')]);return _0x8abc8a[_0x2b2d('0x4d')](_0x433c6d);}})[_0x2b2d('0x26')](function(_0x1827b2){if(_0x1827b2){_0x2b17a2=_0x1827b2[_0x2b2d('0x37')];if(!_0x55ef58[_0x2b2d('0x31')]['hasOwnProperty'](_0x2b2d('0x39'))){_0x433c6d[_0x2b2d('0x3a')]=qs[_0x2b2d('0x3a')](_0x55ef58[_0x2b2d('0x31')][_0x2b2d('0x3a')]);_0x433c6d[_0x2b2d('0x1f')]=qs[_0x2b2d('0x1f')](_0x55ef58[_0x2b2d('0x31')][_0x2b2d('0x1f')]);}return _0x8abc8a[_0x2b2d('0x4d')](_0x433c6d);}})[_0x2b2d('0x26')](function(_0x50e4c){if(_0x50e4c){return _0x50e4c?{'count':_0x2b17a2,'rows':_0x50e4c}:null;}})[_0x2b2d('0x26')](respondWithResult(_0x249b09,null))[_0x2b2d('0x47')](handleError(_0x249b09,null));};exports[_0x2b2d('0x50')]=function(_0xe3e64f,_0x2e28c4,_0x1f10ac){if(_0xe3e64f['body']['id']){delete _0xe3e64f[_0x2b2d('0x4b')]['id'];}return db[_0x2b2d('0x43')][_0x2b2d('0x4e')]({'where':{'id':_0xe3e64f[_0x2b2d('0x48')]['id']}})[_0x2b2d('0x26')](handleEntityNotFound(_0x2e28c4,null))[_0x2b2d('0x26')](function(_0x235fb6){if(_0x235fb6){_0xe3e64f[_0x2b2d('0x4b')]['AccountId']=_0x235fb6['id'];_0xe3e64f[_0x2b2d('0x4b')][_0x2b2d('0x51')]=integrations[_0x2b2d('0x52')](_0xe3e64f[_0x2b2d('0x4b')]['channel'],_0xe3e64f['body'][_0x2b2d('0x40')]);_0xe3e64f['body'][_0x2b2d('0x53')]=integrations['getDescriptions'](_0xe3e64f[_0x2b2d('0x4b')][_0x2b2d('0x54')],_0xe3e64f[_0x2b2d('0x4b')][_0x2b2d('0x40')]);return db['ServicenowConfiguration'][_0x2b2d('0x4a')](_0xe3e64f[_0x2b2d('0x4b')],{'include':[{'model':db[_0x2b2d('0x55')],'as':_0x2b2d('0x51')},{'model':db[_0x2b2d('0x55')],'as':'Descriptions'}]});}return null;})[_0x2b2d('0x26')](respondWithResult(_0x2e28c4,null))[_0x2b2d('0x47')](handleError(_0x2e28c4,null));};exports['getFields']=function(_0x268846,_0xfa6836,_0x210b6b){var _0x1dc887=['made_sla',_0x2b2d('0x56'),_0x2b2d('0x57'),'subcategory',_0x2b2d('0x58'),_0x2b2d('0x59'),_0x2b2d('0x5a'),'severity',_0x2b2d('0x5b')];var _0x24c5dc=['parent',_0x2b2d('0x5c'),'caused_by',_0x2b2d('0x5d'),'upon_reject',_0x2b2d('0x5e'),_0x2b2d('0x5f'),'hold_reason',_0x2b2d('0x60'),_0x2b2d('0x61'),'resolved_by',_0x2b2d('0x62'),'opened_by',_0x2b2d('0x63'),_0x2b2d('0x64'),_0x2b2d('0x65'),_0x2b2d('0x66'),_0x2b2d('0x67'),_0x2b2d('0x57'),_0x2b2d('0x3b'),_0x2b2d('0x68'),_0x2b2d('0x69'),_0x2b2d('0x6a'),'delivery_plan',_0x2b2d('0x6b'),_0x2b2d('0x6c'),'work_notes_list',_0x2b2d('0x6d'),'priority',_0x2b2d('0x6e'),_0x2b2d('0x6f'),_0x2b2d('0x70'),_0x2b2d('0x71'),_0x2b2d('0x72'),_0x2b2d('0x73'),'group_list',_0x2b2d('0x74'),_0x2b2d('0x75'),'resolved_at','caller_id',_0x2b2d('0x76'),_0x2b2d('0x77'),_0x2b2d('0x78'),_0x2b2d('0x79'),_0x2b2d('0x58'),_0x2b2d('0x7a'),'delivery_task','work_start',_0x2b2d('0x7b'),_0x2b2d('0x7c'),_0x2b2d('0x7d'),_0x2b2d('0x7e'),'calendar_duration','notify',_0x2b2d('0x7f'),_0x2b2d('0x80'),_0x2b2d('0x81'),_0x2b2d('0x82'),_0x2b2d('0x83'),_0x2b2d('0x84'),'contact_type',_0x2b2d('0x85'),_0x2b2d('0x5a'),_0x2b2d('0x86'),_0x2b2d('0x87'),_0x2b2d('0x88'),'reassignment_count',_0x2b2d('0x89'),_0x2b2d('0x8a'),'severity',_0x2b2d('0x8b'),_0x2b2d('0x8c'),_0x2b2d('0x8d'),_0x2b2d('0x8e'),'due_date','sys_mod_count','reopen_count',_0x2b2d('0x8f'),_0x2b2d('0x90'),_0x2b2d('0x91'),_0x2b2d('0x92'),_0x2b2d('0x93'),'category'];var _0x4015af='';var _0x27c1b5='';var _0x34e2e7=[];var _0x21ef2a='';var _0x1fcefe='';var _0x1a567b=[];var _0x2b358d='';var _0x57c6d7='';var _0x20a140={};var _0x50475e='';return db[_0x2b2d('0x43')]['findOne']({'where':{'id':_0x268846[_0x2b2d('0x48')]['id']},'attributes':['id',_0x2b2d('0x94'),_0x2b2d('0x95'),_0x2b2d('0x96'),_0x2b2d('0x97'),_0x2b2d('0x98')]})[_0x2b2d('0x26')](handleEntityNotFound(_0xfa6836,null))[_0x2b2d('0x26')](function(_0x926da5){if(_0x926da5){_0x50475e=_0x926da5[_0x2b2d('0x97')];var _0x5de318=_0x50475e[_0x2b2d('0x99')](-0x1);if(_0x5de318==='/'){_0x50475e=_0x50475e[_0x2b2d('0x9a')](0x0,_0x50475e['lastIndexOf'](_0x5de318));}_0x57c6d7=util[_0x2b2d('0x9b')](_0x2b2d('0x9c'),_0x50475e);_0x2b358d=util[_0x2b2d('0x9b')](_0x2b2d('0x9d'),_0x50475e);_0x20a140={'user':_0x926da5[_0x2b2d('0x94')],'pass':_0x926da5[_0x2b2d('0x95')]};var _0x4ae0b2={'method':_0x2b2d('0x9e'),'uri':_0x57c6d7+_0x2b2d('0x9f'),'auth':_0x20a140,'json':!![]};return rp(_0x4ae0b2);}})['then'](function(_0x42efef){if(_0x42efef[_0x2b2d('0xa0')][_0x2b2d('0x37')]>0x0){_0x4015af=_0x42efef[_0x2b2d('0xa0')];}console[_0x2b2d('0xa1')](_0x2b2d('0xa2'),_0x4015af);_0x1a567b=[];_0x27c1b5=Object['assign']([],_0x4015af);_[_0x2b2d('0xa3')](_0x27c1b5,function(_0x3a1e28){return!_0x1dc887[_0x2b2d('0xa4')](_0x3a1e28[_0x2b2d('0x29')]);});_0x27c1b5[_0x2b2d('0xa5')](function(_0x31ca4f){var _0x1722f5=createFieldObject(_0x2b358d,_0x20a140,_0x31ca4f[_0x2b2d('0xa6')],_0x31ca4f[_0x2b2d('0x29')],_0x31ca4f[_0x2b2d('0xa7')],![]);_0x1a567b[_0x2b2d('0xa8')](_0x1722f5);});return Promise[_0x2b2d('0xa9')](_0x1a567b);})[_0x2b2d('0x26')](function(_0x10045d){_0x34e2e7=_0x10045d;_0x21ef2a=Object[_0x2b2d('0xaa')]([],_0x4015af);console[_0x2b2d('0xa1')](_0x2b2d('0xab'),_0x4015af);_[_0x2b2d('0xa3')](_0x21ef2a,function(_0x173354){return _0x24c5dc[_0x2b2d('0xa4')](_0x173354[_0x2b2d('0x29')]);});console[_0x2b2d('0xa1')](_0x2b2d('0xac'),_0x21ef2a);_0x1a567b=[];_0x21ef2a[_0x2b2d('0xa5')](function(_0x581881){var _0x4ea70e=createFieldObject(_0x2b358d,_0x20a140,_0x581881['internalType'],_0x581881[_0x2b2d('0x29')],_0x581881[_0x2b2d('0xa7')],!![]);_0x1a567b[_0x2b2d('0xa8')](_0x4ea70e);});return Promise[_0x2b2d('0xa9')](_0x1a567b);})[_0x2b2d('0x26')](function(_0xfbd5a1){_0x1fcefe=_0xfbd5a1;var _0x4eb486=_0x34e2e7['concat'](_0x1fcefe);return{'count':_0x4eb486[_0x2b2d('0x37')],'rows':_0x4eb486};})['then'](respondWithResult(_0xfa6836,null))['catch'](function(_0xca4c15){console[_0x2b2d('0xa1')](_0x2b2d('0xad')+_0xca4c15);var _0x4da266=_0x268846[_0x2b2d('0x31')][_0x2b2d('0xae')]?0x1f4:_0xca4c15[_0x2b2d('0xaf')]||0x1f4;logger[_0x2b2d('0xb0')](_0xca4c15[_0x2b2d('0x28')]);delete _0xca4c15['name'];if(_0x4da266===0x191){_0x4da266=0x190;}_0xfa6836['status'](_0x4da266)[_0x2b2d('0x2a')](_0x268846['query'][_0x2b2d('0xae')]?{'message':'Wrong\x20credentials','statusCode':_0xca4c15[_0x2b2d('0xaf')]}:_0xca4c15);});};function createFieldObject(_0x3388a2,_0x5686df,_0x1b5a56,_0x542bfe,_0x348f6f,_0x54c365){return new Promise(function(_0x1e669a,_0x25ee7d){var _0x2e30f5={'id':_0x542bfe,'name':_0x348f6f,'custom':_0x54c365};if(_0x1b5a56==='boolean'){_0x2e30f5[_0x2b2d('0x42')]=[{'name':_0x2b2d('0xb1'),'value':_0x2b2d('0xb2')},{'name':'False','value':_0x2b2d('0xb3')}];_0x1e669a(_0x2e30f5);}else{var _0x4ffdd0={'method':'GET','uri':_0x3388a2+_0x2b2d('0xb4')+_0x542bfe,'auth':_0x5686df,'json':!![]};return rp(_0x4ffdd0)[_0x2b2d('0x26')](function(_0x39d1cf){var _0x132e99=[];if(_0x39d1cf[_0x2b2d('0xa0')]['length']>0x0){_0x39d1cf[_0x2b2d('0xa0')][_0x2b2d('0xa5')](function(_0x5be85b){if(_0x5be85b[_0x2b2d('0xb5')]==='false'){var _0x337df1={'name':_0x5be85b['label'],'value':_0x5be85b[_0x2b2d('0xb6')]};_0x132e99['push'](_0x337df1);}});}_0x2e30f5[_0x2b2d('0x42')]=_0x132e99;if(_0x2e30f5[_0x2b2d('0x42')][_0x2b2d('0x37')]>0x0){_0x1e669a(_0x2e30f5);}else{if(_0x54c365==![]){_0x1e669a();}else{_0x1e669a(_0x2e30f5);}}});}});} \ No newline at end of file +var _0x9991=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','reject','save','destroy','then','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','find','ServicenowConfiguration','sort','pick','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','knowledge','close_code','notify','incident_state','severity','category','caused_by','upon_reject','sys_updated_on','child_incidents','hold_reason','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','caller_id','approval_set','subcategory','short_description','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','password','email','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','username','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','internalType','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','label','concat','ServiceNow\x20error:\x20','test','statusCode','error','stack','boolean','True','true','false','zip-dir','fast-json-patch','request-promise'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x9991,0xb2));var _0x1999=function(_0x1e2c40,_0x1a71eb){_0x1e2c40=_0x1e2c40-0x0;var _0x39dd69=_0x9991[_0x1e2c40];return _0x39dd69;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1999('0x0'));var jsonpatch=require(_0x1999('0x1'));var rp=require(_0x1999('0x2'));var moment=require('moment');var BPromise=require(_0x1999('0x3'));var Mustache=require(_0x1999('0x4'));var util=require(_0x1999('0x5'));var path=require(_0x1999('0x6'));var sox=require(_0x1999('0x7'));var csv=require(_0x1999('0x8'));var ejs=require(_0x1999('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1999('0xa'));var squel=require('squel');var crypto=require(_0x1999('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1999('0xc'));var toCsv=require(_0x1999('0x8'));var querystring=require(_0x1999('0xd'));var Papa=require('papaparse');var Redis=require(_0x1999('0xe'));var authService=require(_0x1999('0xf'));var qs=require(_0x1999('0x10'));var as=require(_0x1999('0x11'));var hardwareService=require(_0x1999('0x12'));var logger=require('../../config/logger')(_0x1999('0x13'));var utils=require('../../config/utils');var config=require(_0x1999('0x14'));var licenseUtil=require(_0x1999('0x15'));var db=require(_0x1999('0x16'))['db'];var integrations=require(_0x1999('0x17'));function respondWithStatusCode(_0x2199c8,_0x445a9e){_0x445a9e=_0x445a9e||0xcc;return function(_0x9157da){if(_0x9157da){return _0x2199c8[_0x1999('0x18')](_0x445a9e);}return _0x2199c8[_0x1999('0x19')](_0x445a9e)[_0x1999('0x1a')]();};}function respondWithResult(_0xa500b7,_0x20a702){_0x20a702=_0x20a702||0xc8;return function(_0x12803a){if(_0x12803a){return _0xa500b7[_0x1999('0x19')](_0x20a702)[_0x1999('0x1b')](_0x12803a);}};}function respondWithFilteredResult(_0x58f9b1,_0x49e712){return function(_0x69cee2){if(_0x69cee2){var _0x25c9d4=typeof _0x49e712[_0x1999('0x1c')]===_0x1999('0x1d')&&typeof _0x49e712['limit']===_0x1999('0x1d');var _0x1561f0=_0x69cee2[_0x1999('0x1e')];var _0x2e9df2=_0x25c9d4?0x0:_0x49e712[_0x1999('0x1c')];var _0x557871=_0x25c9d4?_0x69cee2[_0x1999('0x1e')]:_0x49e712['offset']+_0x49e712['limit'];var _0x57123f;if(_0x557871>=_0x1561f0){_0x557871=_0x1561f0;_0x57123f=0xc8;}else{_0x57123f=0xce;}_0x58f9b1[_0x1999('0x19')](_0x57123f);return _0x58f9b1[_0x1999('0x1f')]('Content-Range',_0x2e9df2+'-'+_0x557871+'/'+_0x1561f0)[_0x1999('0x1b')](_0x69cee2);}return null;};}function patchUpdates(_0x13bae2){return function(_0x4ae1f7){try{jsonpatch['apply'](_0x4ae1f7,_0x13bae2,!![]);}catch(_0x38db8f){return BPromise[_0x1999('0x20')](_0x38db8f);}return _0x4ae1f7[_0x1999('0x21')]();};}function saveUpdates(_0x32dfa6,_0x57adc8){return function(_0x2c8275){if(_0x2c8275){return _0x2c8275['update'](_0x32dfa6)['then'](function(_0x12890d){return _0x12890d;});}return null;};}function removeEntity(_0x1c4d0d,_0x33000a){return function(_0x3bb849){if(_0x3bb849){return _0x3bb849[_0x1999('0x22')]()[_0x1999('0x23')](function(){_0x1c4d0d['status'](0xcc)[_0x1999('0x1a')]();});}};}function handleEntityNotFound(_0x1a4f3f,_0x18f409){return function(_0x5f08e8){if(!_0x5f08e8){_0x1a4f3f['sendStatus'](0x194);}return _0x5f08e8;};}function handleError(_0x3b5dd4,_0xe8b1ef){_0xe8b1ef=_0xe8b1ef||0x1f4;return function(_0x30d3c9){logger['error'](_0x30d3c9['stack']);if(_0x30d3c9[_0x1999('0x24')]){delete _0x30d3c9[_0x1999('0x24')];}_0x3b5dd4[_0x1999('0x19')](_0xe8b1ef)[_0x1999('0x25')](_0x30d3c9);};}exports[_0x1999('0x26')]=function(_0x4ba1d7,_0x55b259){var _0x2e5e56={},_0x5f183f={},_0x231b4b={'count':0x0,'rows':[]};var _0x43a1ba=_[_0x1999('0x27')](db[_0x1999('0x28')][_0x1999('0x29')],function(_0x22bf87){return{'name':_0x22bf87[_0x1999('0x2a')],'type':_0x22bf87[_0x1999('0x2b')][_0x1999('0x2c')]};});_0x5f183f['model']=_[_0x1999('0x27')](_0x43a1ba,_0x1999('0x24'));_0x5f183f['query']=_[_0x1999('0x2d')](_0x4ba1d7[_0x1999('0x2e')]);_0x5f183f[_0x1999('0x2f')]=_[_0x1999('0x30')](_0x5f183f[_0x1999('0x31')],_0x5f183f[_0x1999('0x2e')]);_0x2e5e56[_0x1999('0x32')]=_['intersection'](_0x5f183f[_0x1999('0x31')],qs['fields'](_0x4ba1d7[_0x1999('0x2e')][_0x1999('0x33')]));_0x2e5e56[_0x1999('0x32')]=_0x2e5e56['attributes'][_0x1999('0x34')]?_0x2e5e56['attributes']:_0x5f183f[_0x1999('0x31')];if(!_0x4ba1d7[_0x1999('0x2e')][_0x1999('0x35')](_0x1999('0x36'))){_0x2e5e56['limit']=qs[_0x1999('0x37')](_0x4ba1d7[_0x1999('0x2e')][_0x1999('0x37')]);_0x2e5e56[_0x1999('0x1c')]=qs[_0x1999('0x1c')](_0x4ba1d7[_0x1999('0x2e')][_0x1999('0x1c')]);}_0x2e5e56[_0x1999('0x38')]=qs['sort'](_0x4ba1d7['query']['sort']);_0x2e5e56[_0x1999('0x39')]=qs[_0x1999('0x2f')](_['pick'](_0x4ba1d7[_0x1999('0x2e')],_0x5f183f[_0x1999('0x2f')]),_0x43a1ba);if(_0x4ba1d7[_0x1999('0x2e')][_0x1999('0x3a')]){_0x2e5e56['where']=_[_0x1999('0x3b')](_0x2e5e56[_0x1999('0x39')],{'$or':_[_0x1999('0x27')](_0x43a1ba,function(_0x592bc6){if(_0x592bc6['type']!=='VIRTUAL'){var _0x2ab3ec={};_0x2ab3ec[_0x592bc6['name']]={'$like':'%'+_0x4ba1d7[_0x1999('0x2e')]['filter']+'%'};return _0x2ab3ec;}})});}_0x2e5e56=_[_0x1999('0x3b')]({},_0x2e5e56,_0x4ba1d7[_0x1999('0x3c')]);var _0x17ebad={'where':_0x2e5e56[_0x1999('0x39')]};return db[_0x1999('0x28')]['count'](_0x17ebad)['then'](function(_0x491c03){_0x231b4b[_0x1999('0x1e')]=_0x491c03;if(_0x4ba1d7['query'][_0x1999('0x3d')]){_0x2e5e56[_0x1999('0x3e')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x2e5e56);})[_0x1999('0x23')](function(_0x5757f2){_0x231b4b[_0x1999('0x3f')]=_0x5757f2;return _0x231b4b;})[_0x1999('0x23')](respondWithFilteredResult(_0x55b259,_0x2e5e56))[_0x1999('0x40')](handleError(_0x55b259,null));};exports[_0x1999('0x41')]=function(_0x370d6c,_0x3fb84a){var _0x3eb11c={'raw':![],'where':{'id':_0x370d6c[_0x1999('0x42')]['id']}},_0x2cb6d9={};_0x2cb6d9[_0x1999('0x31')]=_['keys'](db[_0x1999('0x28')][_0x1999('0x29')]);_0x2cb6d9[_0x1999('0x2e')]=_[_0x1999('0x2d')](_0x370d6c[_0x1999('0x2e')]);_0x2cb6d9[_0x1999('0x2f')]=_['intersection'](_0x2cb6d9[_0x1999('0x31')],_0x2cb6d9['query']);_0x3eb11c['attributes']=_[_0x1999('0x30')](_0x2cb6d9['model'],qs[_0x1999('0x33')](_0x370d6c[_0x1999('0x2e')][_0x1999('0x33')]));_0x3eb11c[_0x1999('0x32')]=_0x3eb11c[_0x1999('0x32')][_0x1999('0x34')]?_0x3eb11c[_0x1999('0x32')]:_0x2cb6d9[_0x1999('0x31')];if(_0x370d6c[_0x1999('0x2e')][_0x1999('0x3d')]){_0x3eb11c[_0x1999('0x3e')]=[{'all':!![]}];}_0x3eb11c=_[_0x1999('0x3b')]({},_0x3eb11c,_0x370d6c[_0x1999('0x3c')]);return db['ServicenowAccount']['find'](_0x3eb11c)[_0x1999('0x23')](handleEntityNotFound(_0x3fb84a,null))[_0x1999('0x23')](respondWithResult(_0x3fb84a,null))[_0x1999('0x40')](handleError(_0x3fb84a,null));};exports['create']=function(_0x5f3eb7,_0x539e2e){return db[_0x1999('0x28')][_0x1999('0x43')](_0x5f3eb7[_0x1999('0x44')],{})['then'](respondWithResult(_0x539e2e,0xc9))[_0x1999('0x40')](handleError(_0x539e2e,null));};exports['update']=function(_0x5e8dcf,_0x2a541b){if(_0x5e8dcf[_0x1999('0x44')]['id']){delete _0x5e8dcf[_0x1999('0x44')]['id'];}return db[_0x1999('0x28')][_0x1999('0x45')]({'where':{'id':_0x5e8dcf['params']['id']}})[_0x1999('0x23')](handleEntityNotFound(_0x2a541b,null))[_0x1999('0x23')](saveUpdates(_0x5e8dcf['body'],null))[_0x1999('0x23')](respondWithResult(_0x2a541b,null))[_0x1999('0x40')](handleError(_0x2a541b,null));};exports[_0x1999('0x22')]=function(_0x4873b7,_0x58dd21){return db[_0x1999('0x28')][_0x1999('0x45')]({'where':{'id':_0x4873b7['params']['id']}})[_0x1999('0x23')](handleEntityNotFound(_0x58dd21,null))['then'](removeEntity(_0x58dd21,null))[_0x1999('0x40')](handleError(_0x58dd21,null));};exports['getConfigurations']=function(_0x4e63c9,_0x6415ef,_0x827312){var _0x5d6d64={};var _0x5f1031={};var _0x5bb0c6;var _0x11820b;return db[_0x1999('0x28')]['findOne']({'where':{'id':_0x4e63c9[_0x1999('0x42')]['id']}})['then'](handleEntityNotFound(_0x6415ef,null))[_0x1999('0x23')](function(_0x15fe16){if(_0x15fe16){_0x5bb0c6=_0x15fe16;_0x5f1031[_0x1999('0x31')]=_['keys'](db[_0x1999('0x46')]['rawAttributes']);_0x5f1031['query']=_[_0x1999('0x2d')](_0x4e63c9['query']);_0x5f1031[_0x1999('0x2f')]=_[_0x1999('0x30')](_0x5f1031[_0x1999('0x31')],_0x5f1031[_0x1999('0x2e')]);_0x5d6d64[_0x1999('0x32')]=_[_0x1999('0x30')](_0x5f1031[_0x1999('0x31')],qs['fields'](_0x4e63c9[_0x1999('0x2e')][_0x1999('0x33')]));_0x5d6d64[_0x1999('0x32')]=_0x5d6d64['attributes']['length']?_0x5d6d64[_0x1999('0x32')]:_0x5f1031['model'];_0x5d6d64[_0x1999('0x38')]=qs[_0x1999('0x47')](_0x4e63c9['query'][_0x1999('0x47')]);_0x5d6d64[_0x1999('0x39')]=qs['filters'](_[_0x1999('0x48')](_0x4e63c9[_0x1999('0x2e')],_0x5f1031[_0x1999('0x2f')]));if(_0x4e63c9[_0x1999('0x2e')][_0x1999('0x3a')]){_0x5d6d64[_0x1999('0x39')]=_[_0x1999('0x3b')](_0x5d6d64[_0x1999('0x39')],{'$or':_[_0x1999('0x27')](_0x5d6d64[_0x1999('0x32')],function(_0x445193){var _0x3516de={};_0x3516de[_0x445193]={'$like':'%'+_0x4e63c9[_0x1999('0x2e')][_0x1999('0x3a')]+'%'};return _0x3516de;})});}_0x5d6d64=_['merge']({},_0x5d6d64,_0x4e63c9[_0x1999('0x3c')]);return _0x5bb0c6[_0x1999('0x49')](_0x5d6d64);}})[_0x1999('0x23')](function(_0x572a2d){if(_0x572a2d){_0x11820b=_0x572a2d[_0x1999('0x34')];if(!_0x4e63c9[_0x1999('0x2e')][_0x1999('0x35')]('nolimit')){_0x5d6d64[_0x1999('0x37')]=qs[_0x1999('0x37')](_0x4e63c9[_0x1999('0x2e')]['limit']);_0x5d6d64[_0x1999('0x1c')]=qs[_0x1999('0x1c')](_0x4e63c9[_0x1999('0x2e')][_0x1999('0x1c')]);}return _0x5bb0c6['getConfigurations'](_0x5d6d64);}})[_0x1999('0x23')](function(_0x3dbcd8){if(_0x3dbcd8){return _0x3dbcd8?{'count':_0x11820b,'rows':_0x3dbcd8}:null;}})['then'](respondWithResult(_0x6415ef,null))[_0x1999('0x40')](handleError(_0x6415ef,null));};exports[_0x1999('0x4a')]=function(_0x52d68f,_0x34a7ec,_0x41b791){if(_0x52d68f[_0x1999('0x44')]['id']){delete _0x52d68f[_0x1999('0x44')]['id'];}return db[_0x1999('0x28')][_0x1999('0x4b')]({'where':{'id':_0x52d68f[_0x1999('0x42')]['id']}})[_0x1999('0x23')](handleEntityNotFound(_0x34a7ec,null))[_0x1999('0x23')](function(_0x4e2897){if(_0x4e2897){_0x52d68f[_0x1999('0x44')][_0x1999('0x4c')]=_0x4e2897['id'];_0x52d68f['body'][_0x1999('0x4d')]=integrations[_0x1999('0x4e')](_0x52d68f[_0x1999('0x44')]['channel'],_0x52d68f[_0x1999('0x44')][_0x1999('0x2b')]);_0x52d68f['body'][_0x1999('0x4f')]=integrations[_0x1999('0x50')](_0x52d68f[_0x1999('0x44')]['channel'],_0x52d68f[_0x1999('0x44')][_0x1999('0x2b')]);return db[_0x1999('0x46')][_0x1999('0x43')](_0x52d68f[_0x1999('0x44')],{'include':[{'model':db[_0x1999('0x51')],'as':_0x1999('0x4d')},{'model':db['ServicenowField'],'as':_0x1999('0x4f')}]});}return null;})[_0x1999('0x23')](respondWithResult(_0x34a7ec,null))[_0x1999('0x40')](handleError(_0x34a7ec,null));};exports[_0x1999('0x52')]=function(_0x1fb2fd,_0x184446,_0x235fd9){var _0x2a422e=[_0x1999('0x53'),'hold_reason',_0x1999('0x54'),'subcategory',_0x1999('0x55'),_0x1999('0x56'),_0x1999('0x57'),_0x1999('0x58'),_0x1999('0x59')];var _0x16ea35=['parent',_0x1999('0x53'),_0x1999('0x5a'),'watch_list',_0x1999('0x5b'),_0x1999('0x5c'),_0x1999('0x5d'),_0x1999('0x5e'),'approval_history',_0x1999('0x5f'),'resolved_by',_0x1999('0x60'),_0x1999('0x61'),_0x1999('0x62'),_0x1999('0x63'),_0x1999('0x64'),_0x1999('0x65'),_0x1999('0x66'),_0x1999('0x54'),_0x1999('0x38'),'calendar_stc',_0x1999('0x67'),_0x1999('0x68'),_0x1999('0x69'),'impact',_0x1999('0x6a'),'work_notes_list',_0x1999('0x6b'),_0x1999('0x6c'),_0x1999('0x6d'),_0x1999('0x6e'),_0x1999('0x6f'),_0x1999('0x70'),_0x1999('0x71'),_0x1999('0x72'),_0x1999('0x73'),'work_end',_0x1999('0x74'),'resolved_at',_0x1999('0x75'),_0x1999('0x76'),_0x1999('0x77'),'work_notes',_0x1999('0x78'),_0x1999('0x55'),'correlation_display',_0x1999('0x79'),'work_start',_0x1999('0x7a'),_0x1999('0x7b'),_0x1999('0x7c'),_0x1999('0x7d'),_0x1999('0x7e'),_0x1999('0x56'),'sys_class_name',_0x1999('0x7f'),_0x1999('0x80'),_0x1999('0x81'),_0x1999('0x82'),_0x1999('0x83'),_0x1999('0x84'),_0x1999('0x85'),'incident_state',_0x1999('0x86'),_0x1999('0x87'),_0x1999('0x88'),_0x1999('0x89'),_0x1999('0x8a'),'assigned_to',_0x1999('0x58'),_0x1999('0x8b'),_0x1999('0x8c'),_0x1999('0x8d'),_0x1999('0x8e'),_0x1999('0x8f'),_0x1999('0x90'),_0x1999('0x91'),'sys_tags',_0x1999('0x92'),_0x1999('0x93'),_0x1999('0x94'),_0x1999('0x95'),'category'];var _0x516ede='';var _0x357eb3='';var _0x54f7b1=[];var _0x413aa8='';var _0x3e4ef9='';var _0x268326=[];var _0x45a0c4='';var _0x5eac26='';var _0x3a636a={};var _0x41ff60='';return db[_0x1999('0x28')][_0x1999('0x4b')]({'where':{'id':_0x1fb2fd[_0x1999('0x42')]['id']},'attributes':['id','username',_0x1999('0x96'),_0x1999('0x97'),_0x1999('0x98'),'serverUrl']})['then'](handleEntityNotFound(_0x184446,null))[_0x1999('0x23')](function(_0x5404ac){if(_0x5404ac){_0x41ff60=_0x5404ac[_0x1999('0x98')];var _0x109292=_0x41ff60[_0x1999('0x99')](-0x1);if(_0x109292==='/'){_0x41ff60=_0x41ff60['substring'](0x0,_0x41ff60[_0x1999('0x9a')](_0x109292));}_0x5eac26=util[_0x1999('0x9b')](_0x1999('0x9c'),_0x41ff60);_0x45a0c4=util[_0x1999('0x9b')]('%s/api/now/table/',_0x41ff60);_0x3a636a={'user':_0x5404ac[_0x1999('0x9d')],'pass':_0x5404ac[_0x1999('0x96')]};var _0x575b08={'method':_0x1999('0x9e'),'uri':_0x5eac26+_0x1999('0x9f'),'auth':_0x3a636a,'json':!![]};return rp(_0x575b08);}})[_0x1999('0x23')](function(_0x5d4292){if(_0x5d4292[_0x1999('0xa0')][_0x1999('0x34')]>0x0){_0x516ede=_0x5d4292[_0x1999('0xa0')];}console[_0x1999('0xa1')]('incident\x20table\x20objects',_0x516ede);_0x268326=[];_0x357eb3=Object[_0x1999('0xa2')]([],_0x516ede);_[_0x1999('0xa3')](_0x357eb3,function(_0x9c131){return!_0x2a422e[_0x1999('0xa4')](_0x9c131[_0x1999('0x24')]);});_0x357eb3['forEach'](function(_0x54a6c5){var _0x88f66=createFieldObject(_0x45a0c4,_0x3a636a,_0x54a6c5[_0x1999('0xa5')],_0x54a6c5[_0x1999('0x24')],_0x54a6c5['label'],![]);_0x268326[_0x1999('0xa6')](_0x88f66);});return Promise[_0x1999('0xa7')](_0x268326);})[_0x1999('0x23')](function(_0x25ab1f){_0x54f7b1=_0x25ab1f;_0x413aa8=Object[_0x1999('0xa2')]([],_0x516ede);console[_0x1999('0xa1')]('TCL:\x20_object',_0x516ede);_['remove'](_0x413aa8,function(_0xc19807){return _0x16ea35[_0x1999('0xa4')](_0xc19807['name']);});console[_0x1999('0xa1')](_0x1999('0xa8'),_0x413aa8);_0x268326=[];_0x413aa8[_0x1999('0xa9')](function(_0x384fed){var _0x383c38=createFieldObject(_0x45a0c4,_0x3a636a,_0x384fed[_0x1999('0xa5')],_0x384fed[_0x1999('0x24')],_0x384fed[_0x1999('0xaa')],!![]);_0x268326[_0x1999('0xa6')](_0x383c38);});return Promise[_0x1999('0xa7')](_0x268326);})[_0x1999('0x23')](function(_0x5a3433){_0x3e4ef9=_0x5a3433;var _0x357165=_0x54f7b1[_0x1999('0xab')](_0x3e4ef9);return{'count':_0x357165['length'],'rows':_0x357165};})['then'](respondWithResult(_0x184446,null))[_0x1999('0x40')](function(_0x4caa1f){console[_0x1999('0xa1')](_0x1999('0xac')+_0x4caa1f);var _0x317de3=_0x1fb2fd['query'][_0x1999('0xad')]?0x1f4:_0x4caa1f[_0x1999('0xae')]||0x1f4;logger[_0x1999('0xaf')](_0x4caa1f[_0x1999('0xb0')]);delete _0x4caa1f[_0x1999('0x24')];if(_0x317de3===0x191){_0x317de3=0x190;}_0x184446['status'](_0x317de3)[_0x1999('0x25')](_0x1fb2fd[_0x1999('0x2e')][_0x1999('0xad')]?{'message':'Wrong\x20credentials','statusCode':_0x4caa1f['statusCode']}:_0x4caa1f);});};function createFieldObject(_0x24bf5b,_0x4b11c1,_0x257395,_0x278c52,_0x3f507e,_0x466851){return new Promise(function(_0x5ab2c1,_0x4ab33b){var _0x3e0da9={'id':_0x278c52,'name':_0x3f507e,'custom':_0x466851};if(_0x257395===_0x1999('0xb1')){_0x3e0da9[_0x1999('0x3c')]=[{'name':_0x1999('0xb2'),'value':_0x1999('0xb3')},{'name':'False','value':_0x1999('0xb4')}];_0x5ab2c1(_0x3e0da9);}else{var _0x925a23={'method':_0x1999('0x9e'),'uri':_0x24bf5b+'sys_choice?sysparm_query=name=incident^element='+_0x278c52,'auth':_0x4b11c1,'json':!![]};return rp(_0x925a23)[_0x1999('0x23')](function(_0x46fb12){var _0x4b9af1=[];if(_0x46fb12[_0x1999('0xa0')][_0x1999('0x34')]>0x0){_0x46fb12['result'][_0x1999('0xa9')](function(_0x1f20fc){if(_0x1f20fc['inactive']===_0x1999('0xb4')){var _0x17ac1a={'name':_0x1f20fc[_0x1999('0xaa')],'value':_0x1f20fc['value']};_0x4b9af1[_0x1999('0xa6')](_0x17ac1a);}});}_0x3e0da9[_0x1999('0x3c')]=_0x4b9af1;if(_0x3e0da9['options'][_0x1999('0x34')]>0x0){_0x5ab2c1(_0x3e0da9);}else{if(_0x466851==![]){_0x5ab2c1();}else{_0x5ab2c1(_0x3e0da9);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 66d70da..474b6ea 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 _0x31f0=['./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x20c2af,_0x3ff4dc){var _0x389a53=function(_0x344cb2){while(--_0x344cb2){_0x20c2af['push'](_0x20c2af['shift']());}};_0x389a53(++_0x3ff4dc);}(_0x31f0,0xb7));var _0x031f=function(_0x50d06f,_0x12e149){_0x50d06f=_0x50d06f-0x0;var _0x35e119=_0x31f0[_0x50d06f];return _0x35e119;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x56328c,_0x3dc98e){return _0x56328c['define'](_0x031f('0x8'),attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f8a=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x3f8a[_0x1a89a1];return _0x3d5b46;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));var integrations=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return _0x1f160a[_0xa3f8('0xc')](_0xa3f8('0xd'),attributes,{'tableName':_0xa3f8('0xe'),'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 686201e..639ceb1 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 _0xc965=['attributes','GetServicenowAccount','debug','find','ShowServicenowAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ServicenowAccount','findAll','options','raw','where','limit','map','include','model'];(function(_0x43dc66,_0x1fe159){var _0x30807f=function(_0x249bb1){while(--_0x249bb1){_0x43dc66['push'](_0x43dc66['shift']());}};_0x30807f(++_0x1fe159);}(_0xc965,0x68));var _0x5c96=function(_0x5e2b34,_0x58385c){_0x5e2b34=_0x5e2b34-0x0;var _0x4859f9=_0xc965[_0x5e2b34];return _0x4859f9;};'use strict';var _=require(_0x5c96('0x0'));var util=require(_0x5c96('0x1'));var moment=require(_0x5c96('0x2'));var BPromise=require(_0x5c96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c96('0x4'));var db=require(_0x5c96('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5c96('0x6'));var client=jayson[_0x5c96('0x7')][_0x5c96('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fa554,_0x5f3c63,_0x2c5f08){return new BPromise(function(_0x144d26,_0x489a25){return client['request'](_0x2fa554,_0x2c5f08)[_0x5c96('0x9')](function(_0x15b93c){logger[_0x5c96('0xa')](_0x5c96('0xb'),_0x5f3c63,_0x5c96('0xc'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5f3c63,'request\x20sent',JSON[_0x5c96('0xd')](_0x15b93c));if(_0x15b93c[_0x5c96('0xe')]){if(_0x15b93c[_0x5c96('0xe')][_0x5c96('0xf')]===0x1f4){logger[_0x5c96('0xe')](_0x5c96('0xb'),_0x5f3c63,_0x15b93c[_0x5c96('0xe')][_0x5c96('0x10')]);return _0x489a25(_0x15b93c[_0x5c96('0xe')]['message']);}logger['error'](_0x5c96('0xb'),_0x5f3c63,_0x15b93c[_0x5c96('0xe')][_0x5c96('0x10')]);return _0x144d26(_0x15b93c[_0x5c96('0xe')]['message']);}else{logger[_0x5c96('0xa')](_0x5c96('0xb'),_0x5f3c63,_0x5c96('0xc'));_0x144d26(_0x15b93c[_0x5c96('0x11')]['message']);}})[_0x5c96('0x12')](function(_0x34e2df){logger[_0x5c96('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x5f3c63,_0x34e2df);_0x489a25(_0x34e2df);});});}exports['GetServicenowAccount']=function(_0x3672db){var _0x9206d8=this;return new Promise(function(_0x5d991a,_0x569baa){return db[_0x5c96('0x13')][_0x5c96('0x14')]({'raw':_0x3672db[_0x5c96('0x15')]?_0x3672db['options'][_0x5c96('0x16')]===undefined?!![]:![]:!![],'where':_0x3672db[_0x5c96('0x15')]?_0x3672db['options'][_0x5c96('0x17')]||null:null,'attributes':_0x3672db['options']?_0x3672db[_0x5c96('0x15')]['attributes']||null:null,'limit':_0x3672db[_0x5c96('0x15')]?_0x3672db[_0x5c96('0x15')][_0x5c96('0x18')]||null:null,'include':_0x3672db[_0x5c96('0x15')]?_0x3672db[_0x5c96('0x15')]['include']?_[_0x5c96('0x19')](_0x3672db[_0x5c96('0x15')][_0x5c96('0x1a')],function(_0x1c7f92){return{'model':db[_0x1c7f92[_0x5c96('0x1b')]],'as':_0x1c7f92['as'],'attributes':_0x1c7f92[_0x5c96('0x1c')],'include':_0x1c7f92[_0x5c96('0x1a')]?_[_0x5c96('0x19')](_0x1c7f92[_0x5c96('0x1a')],function(_0x1ab0eb){return{'model':db[_0x1ab0eb[_0x5c96('0x1b')]],'as':_0x1ab0eb['as'],'attributes':_0x1ab0eb[_0x5c96('0x1c')],'include':_0x1ab0eb[_0x5c96('0x1a')]?_['map'](_0x1ab0eb[_0x5c96('0x1a')],function(_0x3091c7){return{'model':db[_0x3091c7[_0x5c96('0x1b')]],'as':_0x3091c7['as'],'attributes':_0x3091c7[_0x5c96('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5c96('0x9')](function(_0x1aebed){logger[_0x5c96('0xa')](_0x5c96('0x1d'),_0x3672db);logger[_0x5c96('0x1e')](_0x5c96('0x1d'),_0x3672db,JSON['stringify'](_0x1aebed));_0x5d991a(_0x1aebed);})[_0x5c96('0x12')](function(_0x18f68e){logger[_0x5c96('0xe')](_0x5c96('0x1d'),_0x18f68e['message'],_0x3672db);_0x569baa(_0x9206d8[_0x5c96('0xe')](0x1f4,_0x18f68e[_0x5c96('0x10')]));});});};exports['ShowServicenowAccount']=function(_0x5e678f){var _0x5b12b7=this;return new Promise(function(_0x428eac,_0x4a7c50){return db[_0x5c96('0x13')][_0x5c96('0x1f')]({'raw':_0x5e678f[_0x5c96('0x15')]?_0x5e678f[_0x5c96('0x15')][_0x5c96('0x16')]===undefined?!![]:![]:!![],'where':_0x5e678f[_0x5c96('0x15')]?_0x5e678f['options'][_0x5c96('0x17')]||null:null,'attributes':_0x5e678f[_0x5c96('0x15')]?_0x5e678f[_0x5c96('0x15')]['attributes']||null:null,'include':_0x5e678f['options']?_0x5e678f['options'][_0x5c96('0x1a')]?_['map'](_0x5e678f[_0x5c96('0x15')][_0x5c96('0x1a')],function(_0x3b8017){return{'model':db[_0x3b8017[_0x5c96('0x1b')]],'as':_0x3b8017['as'],'attributes':_0x3b8017['attributes'],'include':_0x3b8017[_0x5c96('0x1a')]?_[_0x5c96('0x19')](_0x3b8017[_0x5c96('0x1a')],function(_0x36b889){return{'model':db[_0x36b889[_0x5c96('0x1b')]],'as':_0x36b889['as'],'attributes':_0x36b889[_0x5c96('0x1c')],'include':_0x36b889[_0x5c96('0x1a')]?_[_0x5c96('0x19')](_0x36b889[_0x5c96('0x1a')],function(_0x475d1c){return{'model':db[_0x475d1c[_0x5c96('0x1b')]],'as':_0x475d1c['as'],'attributes':_0x475d1c[_0x5c96('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5c96('0x9')](function(_0x537abb){logger['info'](_0x5c96('0x20'),_0x5e678f);logger[_0x5c96('0x1e')](_0x5c96('0x20'),_0x5e678f,JSON['stringify'](_0x537abb));_0x428eac(_0x537abb);})[_0x5c96('0x12')](function(_0x144b94){logger[_0x5c96('0xe')](_0x5c96('0x20'),_0x144b94['message'],_0x5e678f);_0x4a7c50(_0x5b12b7[_0x5c96('0xe')](0x1f4,_0x144b94[_0x5c96('0x10')]));});});}; \ No newline at end of file +var _0x4a02=['moment','bluebird','randomstring','../../mysqldb','rpc','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetServicenowAccount','findAll','options','raw','where','limit','include','attributes','map','model','ShowServicenowAccount','ServicenowAccount','catch','lodash','util'];(function(_0x131d9a,_0x13d47f){var _0x3ab1db=function(_0x1ca1c8){while(--_0x1ca1c8){_0x131d9a['push'](_0x131d9a['shift']());}};_0x3ab1db(++_0x13d47f);}(_0x4a02,0x1cc));var _0x24a0=function(_0x460491,_0x6a9730){_0x460491=_0x460491-0x0;var _0x2d3ce9=_0x4a02[_0x460491];return _0x2d3ce9;};'use strict';var _=require(_0x24a0('0x0'));var util=require(_0x24a0('0x1'));var moment=require(_0x24a0('0x2'));var BPromise=require(_0x24a0('0x3'));var rs=require(_0x24a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x24a0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x24a0('0x7')][_0x24a0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19b442,_0x2d636d,_0x4e81b4){return new BPromise(function(_0x2bd82a,_0x2cd520){return client[_0x24a0('0x9')](_0x19b442,_0x4e81b4)[_0x24a0('0xa')](function(_0x536b6e){logger[_0x24a0('0xb')](_0x24a0('0xc'),_0x2d636d,_0x24a0('0xd'));logger[_0x24a0('0xe')](_0x24a0('0xf'),_0x2d636d,_0x24a0('0xd'),JSON[_0x24a0('0x10')](_0x536b6e));if(_0x536b6e[_0x24a0('0x11')]){if(_0x536b6e[_0x24a0('0x11')]['code']===0x1f4){logger[_0x24a0('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x2d636d,_0x536b6e[_0x24a0('0x11')][_0x24a0('0x12')]);return _0x2cd520(_0x536b6e['error']['message']);}logger[_0x24a0('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x2d636d,_0x536b6e[_0x24a0('0x11')]['message']);return _0x2bd82a(_0x536b6e['error'][_0x24a0('0x12')]);}else{logger[_0x24a0('0xb')](_0x24a0('0xc'),_0x2d636d,_0x24a0('0xd'));_0x2bd82a(_0x536b6e[_0x24a0('0x13')][_0x24a0('0x12')]);}})['catch'](function(_0x354ffa){logger[_0x24a0('0x11')](_0x24a0('0xc'),_0x2d636d,_0x354ffa);_0x2cd520(_0x354ffa);});});}exports[_0x24a0('0x14')]=function(_0x1a44d2){var _0x350860=this;return new Promise(function(_0x290aae,_0x1dae42){return db['ServicenowAccount'][_0x24a0('0x15')]({'raw':_0x1a44d2[_0x24a0('0x16')]?_0x1a44d2[_0x24a0('0x16')][_0x24a0('0x17')]===undefined?!![]:![]:!![],'where':_0x1a44d2[_0x24a0('0x16')]?_0x1a44d2[_0x24a0('0x16')][_0x24a0('0x18')]||null:null,'attributes':_0x1a44d2[_0x24a0('0x16')]?_0x1a44d2[_0x24a0('0x16')]['attributes']||null:null,'limit':_0x1a44d2[_0x24a0('0x16')]?_0x1a44d2[_0x24a0('0x16')][_0x24a0('0x19')]||null:null,'include':_0x1a44d2[_0x24a0('0x16')]?_0x1a44d2['options'][_0x24a0('0x1a')]?_['map'](_0x1a44d2['options'][_0x24a0('0x1a')],function(_0x4fc78a){return{'model':db[_0x4fc78a['model']],'as':_0x4fc78a['as'],'attributes':_0x4fc78a[_0x24a0('0x1b')],'include':_0x4fc78a[_0x24a0('0x1a')]?_[_0x24a0('0x1c')](_0x4fc78a[_0x24a0('0x1a')],function(_0x2eaf21){return{'model':db[_0x2eaf21[_0x24a0('0x1d')]],'as':_0x2eaf21['as'],'attributes':_0x2eaf21[_0x24a0('0x1b')],'include':_0x2eaf21[_0x24a0('0x1a')]?_[_0x24a0('0x1c')](_0x2eaf21[_0x24a0('0x1a')],function(_0x2f14d4){return{'model':db[_0x2f14d4[_0x24a0('0x1d')]],'as':_0x2f14d4['as'],'attributes':_0x2f14d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x24a0('0xa')](function(_0x4346fe){logger[_0x24a0('0xb')](_0x24a0('0x14'),_0x1a44d2);logger['debug'](_0x24a0('0x14'),_0x1a44d2,JSON['stringify'](_0x4346fe));_0x290aae(_0x4346fe);})['catch'](function(_0x462af2){logger[_0x24a0('0x11')](_0x24a0('0x14'),_0x462af2[_0x24a0('0x12')],_0x1a44d2);_0x1dae42(_0x350860['error'](0x1f4,_0x462af2[_0x24a0('0x12')]));});});};exports[_0x24a0('0x1e')]=function(_0x1aae7f){var _0x28dc30=this;return new Promise(function(_0x15da41,_0x32007e){return db[_0x24a0('0x1f')]['find']({'raw':_0x1aae7f['options']?_0x1aae7f[_0x24a0('0x16')][_0x24a0('0x17')]===undefined?!![]:![]:!![],'where':_0x1aae7f[_0x24a0('0x16')]?_0x1aae7f['options'][_0x24a0('0x18')]||null:null,'attributes':_0x1aae7f['options']?_0x1aae7f[_0x24a0('0x16')][_0x24a0('0x1b')]||null:null,'include':_0x1aae7f[_0x24a0('0x16')]?_0x1aae7f[_0x24a0('0x16')][_0x24a0('0x1a')]?_[_0x24a0('0x1c')](_0x1aae7f[_0x24a0('0x16')]['include'],function(_0x565b3e){return{'model':db[_0x565b3e['model']],'as':_0x565b3e['as'],'attributes':_0x565b3e[_0x24a0('0x1b')],'include':_0x565b3e[_0x24a0('0x1a')]?_[_0x24a0('0x1c')](_0x565b3e[_0x24a0('0x1a')],function(_0x2f4fa4){return{'model':db[_0x2f4fa4[_0x24a0('0x1d')]],'as':_0x2f4fa4['as'],'attributes':_0x2f4fa4[_0x24a0('0x1b')],'include':_0x2f4fa4[_0x24a0('0x1a')]?_[_0x24a0('0x1c')](_0x2f4fa4[_0x24a0('0x1a')],function(_0x27f686){return{'model':db[_0x27f686[_0x24a0('0x1d')]],'as':_0x27f686['as'],'attributes':_0x27f686['attributes']};}):[]};}):[]};}):[]:[]})[_0x24a0('0xa')](function(_0x24c00d){logger[_0x24a0('0xb')]('ShowServicenowAccount',_0x1aae7f);logger['debug']('ShowServicenowAccount',_0x1aae7f,JSON[_0x24a0('0x10')](_0x24c00d));_0x15da41(_0x24c00d);})[_0x24a0('0x20')](function(_0x44b378){logger[_0x24a0('0x11')](_0x24a0('0x1e'),_0x44b378['message'],_0x1aae7f);_0x32007e(_0x28dc30['error'](0x1f4,_0x44b378[_0x24a0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 20c965a..26e512e 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 _0xc813=['multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','update','delete','destroy','exports'];(function(_0x17045c,_0x470ebe){var _0x844ac5=function(_0x1ce250){while(--_0x1ce250){_0x17045c['push'](_0x17045c['shift']());}};_0x844ac5(++_0x470ebe);}(_0xc813,0x8a));var _0x3c81=function(_0x5bb710,_0x2f29f4){_0x5bb710=_0x5bb710-0x0;var _0x40ed91=_0xc813[_0x5bb710];return _0x40ed91;};'use strict';var multer=require(_0x3c81('0x0'));var util=require('util');var path=require(_0x3c81('0x1'));var timeout=require(_0x3c81('0x2'));var express=require(_0x3c81('0x3'));var router=express['Router']();var fs_extra=require(_0x3c81('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3c81('0x5'));var config=require(_0x3c81('0x6'));var controller=require(_0x3c81('0x7'));router[_0x3c81('0x8')]('/',auth['isAuthenticated'](),controller[_0x3c81('0x9')]);router[_0x3c81('0x8')](_0x3c81('0xa'),auth[_0x3c81('0xb')](),controller[_0x3c81('0xc')]);router['get'](_0x3c81('0xd'),auth['isAuthenticated'](),controller[_0x3c81('0xe')]);router[_0x3c81('0x8')](_0x3c81('0xf'),auth['isAuthenticated'](),controller[_0x3c81('0x10')]);router[_0x3c81('0x8')](_0x3c81('0x11'),auth[_0x3c81('0xb')](),controller[_0x3c81('0x12')]);router['post']('/',auth[_0x3c81('0xb')](),controller['create']);router['put']('/:id',auth[_0x3c81('0xb')](),controller[_0x3c81('0x13')]);router[_0x3c81('0x14')]('/:id',auth[_0x3c81('0xb')](),controller[_0x3c81('0x15')]);module[_0x3c81('0x16')]=router; \ No newline at end of file +var _0x9a48=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x6f5598,_0xabeb74){var _0x1e1325=function(_0x1da246){while(--_0x1da246){_0x6f5598['push'](_0x6f5598['shift']());}};_0x1e1325(++_0xabeb74);}(_0x9a48,0x1ca));var _0x89a4=function(_0xb8d9cf,_0x455825){_0xb8d9cf=_0xb8d9cf-0x0;var _0x5a2d3b=_0x9a48[_0xb8d9cf];return _0x5a2d3b;};'use strict';var multer=require(_0x89a4('0x0'));var util=require(_0x89a4('0x1'));var path=require('path');var timeout=require(_0x89a4('0x2'));var express=require(_0x89a4('0x3'));var router=express[_0x89a4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x89a4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x89a4('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x89a4('0x7')]('/',auth[_0x89a4('0x8')](),controller['index']);router['get'](_0x89a4('0x9'),auth[_0x89a4('0x8')](),controller[_0x89a4('0xa')]);router['get'](_0x89a4('0xb'),auth[_0x89a4('0x8')](),controller['getFields']);router[_0x89a4('0x7')](_0x89a4('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x89a4('0x7')](_0x89a4('0xd'),auth[_0x89a4('0x8')](),controller[_0x89a4('0xe')]);router[_0x89a4('0xf')]('/',auth[_0x89a4('0x8')](),controller[_0x89a4('0x10')]);router[_0x89a4('0x11')](_0x89a4('0x9'),auth[_0x89a4('0x8')](),controller[_0x89a4('0x12')]);router[_0x89a4('0x13')](_0x89a4('0x9'),auth['isAuthenticated'](),controller[_0x89a4('0x14')]);module[_0x89a4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 9d8bc04..d7f252c 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 _0xbf2a=['exports','STRING','sequelize'];(function(_0x48dbcd,_0x536c97){var _0x3ec7f3=function(_0x15b94a){while(--_0x15b94a){_0x48dbcd['push'](_0x48dbcd['shift']());}};_0x3ec7f3(++_0x536c97);}(_0xbf2a,0x134));var _0xabf2=function(_0x9ace37,_0x4d1159){_0x9ace37=_0x9ace37-0x0;var _0x23ecc0=_0xbf2a[_0x9ace37];return _0x23ecc0;};'use strict';var Sequelize=require(_0xabf2('0x0'));module[_0xabf2('0x1')]={'name':{'type':Sequelize[_0xabf2('0x2')]},'description':{'type':Sequelize[_0xabf2('0x2')]}}; \ No newline at end of file +var _0x0be0=['STRING'];(function(_0x4f01a9,_0x4a0d3a){var _0x5f5ade=function(_0xbd7ca6){while(--_0xbd7ca6){_0x4f01a9['push'](_0x4f01a9['shift']());}};_0x5f5ade(++_0x4a0d3a);}(_0x0be0,0x19c));var _0x00be=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x0be0[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x00be('0x0')]},'description':{'type':Sequelize[_0x00be('0x0')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 9ca128a..41c33b6 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 _0xc70f=['stack','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','pick','merge','where','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','body','find','destroy','getFields','findOne','ServicenowField','order','sort','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','reject','then','error'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0xc70f,0x112));var _0xfc70=function(_0x51d30a,_0x157328){_0x51d30a=_0x51d30a-0x0;var _0x43b92f=_0xc70f[_0x51d30a];return _0x43b92f;};'use strict';var emlformat=require(_0xfc70('0x0'));var rimraf=require(_0xfc70('0x1'));var zipdir=require(_0xfc70('0x2'));var jsonpatch=require(_0xfc70('0x3'));var rp=require('request-promise');var moment=require(_0xfc70('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfc70('0x5'));var util=require(_0xfc70('0x6'));var path=require(_0xfc70('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc70('0x8'));var squel=require('squel');var crypto=require(_0xfc70('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xfc70('0xa'));var toCsv=require(_0xfc70('0xb'));var querystring=require('querystring');var Papa=require(_0xfc70('0xc'));var Redis=require(_0xfc70('0xd'));var authService=require(_0xfc70('0xe'));var qs=require(_0xfc70('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc70('0x10'));var logger=require(_0xfc70('0x11'))(_0xfc70('0x12'));var utils=require(_0xfc70('0x13'));var config=require(_0xfc70('0x14'));var licenseUtil=require(_0xfc70('0x15'));var db=require(_0xfc70('0x16'))['db'];function respondWithStatusCode(_0x51cc27,_0x3cb11c){_0x3cb11c=_0x3cb11c||0xcc;return function(_0x5bac34){if(_0x5bac34){return _0x51cc27[_0xfc70('0x17')](_0x3cb11c);}return _0x51cc27[_0xfc70('0x18')](_0x3cb11c)[_0xfc70('0x19')]();};}function respondWithResult(_0x246766,_0x81149b){_0x81149b=_0x81149b||0xc8;return function(_0x501be5){if(_0x501be5){return _0x246766[_0xfc70('0x18')](_0x81149b)[_0xfc70('0x1a')](_0x501be5);}};}function respondWithFilteredResult(_0x19a79e,_0x12c646){return function(_0x409868){if(_0x409868){var _0x120be0=typeof _0x12c646[_0xfc70('0x1b')]===_0xfc70('0x1c')&&typeof _0x12c646['limit']===_0xfc70('0x1c');var _0x375ef4=_0x409868[_0xfc70('0x1d')];var _0x1a191f=_0x120be0?0x0:_0x12c646['offset'];var _0x5259f0=_0x120be0?_0x409868[_0xfc70('0x1d')]:_0x12c646['offset']+_0x12c646['limit'];var _0x58d108;if(_0x5259f0>=_0x375ef4){_0x5259f0=_0x375ef4;_0x58d108=0xc8;}else{_0x58d108=0xce;}_0x19a79e[_0xfc70('0x18')](_0x58d108);return _0x19a79e[_0xfc70('0x1e')]('Content-Range',_0x1a191f+'-'+_0x5259f0+'/'+_0x375ef4)[_0xfc70('0x1a')](_0x409868);}return null;};}function patchUpdates(_0x3e04ba){return function(_0x5037d3){try{jsonpatch['apply'](_0x5037d3,_0x3e04ba,!![]);}catch(_0x527588){return BPromise[_0xfc70('0x1f')](_0x527588);}return _0x5037d3['save']();};}function saveUpdates(_0x348f0b,_0x3ff0ef){return function(_0x5aa4a9){if(_0x5aa4a9){return _0x5aa4a9['update'](_0x348f0b)[_0xfc70('0x20')](function(_0x40ef26){return _0x40ef26;});}return null;};}function removeEntity(_0x394f4b,_0x19acfd){return function(_0x301abd){if(_0x301abd){return _0x301abd['destroy']()[_0xfc70('0x20')](function(){_0x394f4b[_0xfc70('0x18')](0xcc)[_0xfc70('0x19')]();});}};}function handleEntityNotFound(_0x3895ac,_0x856b5b){return function(_0x4dbfa9){if(!_0x4dbfa9){_0x3895ac['sendStatus'](0x194);}return _0x4dbfa9;};}function handleError(_0x10d13e,_0xff9665){_0xff9665=_0xff9665||0x1f4;return function(_0x9e7199){logger[_0xfc70('0x21')](_0x9e7199[_0xfc70('0x22')]);if(_0x9e7199['name']){delete _0x9e7199['name'];}_0x10d13e['status'](_0xff9665)[_0xfc70('0x23')](_0x9e7199);};}exports[_0xfc70('0x24')]=function(_0x59b651,_0x8036ad){var _0x15e13c={},_0x3ffe50={},_0x9eb82c={'count':0x0,'rows':[]};var _0xe48afc=_[_0xfc70('0x25')](db[_0xfc70('0x26')][_0xfc70('0x27')],function(_0x34627b){return{'name':_0x34627b[_0xfc70('0x28')],'type':_0x34627b[_0xfc70('0x29')][_0xfc70('0x2a')]};});_0x3ffe50[_0xfc70('0x2b')]=_[_0xfc70('0x25')](_0xe48afc,_0xfc70('0x2c'));_0x3ffe50['query']=_[_0xfc70('0x2d')](_0x59b651['query']);_0x3ffe50[_0xfc70('0x2e')]=_[_0xfc70('0x2f')](_0x3ffe50[_0xfc70('0x2b')],_0x3ffe50[_0xfc70('0x30')]);_0x15e13c[_0xfc70('0x31')]=_[_0xfc70('0x2f')](_0x3ffe50[_0xfc70('0x2b')],qs[_0xfc70('0x32')](_0x59b651[_0xfc70('0x30')][_0xfc70('0x32')]));_0x15e13c[_0xfc70('0x31')]=_0x15e13c[_0xfc70('0x31')][_0xfc70('0x33')]?_0x15e13c[_0xfc70('0x31')]:_0x3ffe50[_0xfc70('0x2b')];if(!_0x59b651[_0xfc70('0x30')][_0xfc70('0x34')](_0xfc70('0x35'))){_0x15e13c[_0xfc70('0x36')]=qs['limit'](_0x59b651[_0xfc70('0x30')][_0xfc70('0x36')]);_0x15e13c[_0xfc70('0x1b')]=qs[_0xfc70('0x1b')](_0x59b651['query'][_0xfc70('0x1b')]);}_0x15e13c['order']=qs['sort'](_0x59b651[_0xfc70('0x30')]['sort']);_0x15e13c['where']=qs[_0xfc70('0x2e')](_[_0xfc70('0x37')](_0x59b651[_0xfc70('0x30')],_0x3ffe50[_0xfc70('0x2e')]),_0xe48afc);if(_0x59b651[_0xfc70('0x30')]['filter']){_0x15e13c['where']=_[_0xfc70('0x38')](_0x15e13c[_0xfc70('0x39')],{'$or':_[_0xfc70('0x25')](_0xe48afc,function(_0x388544){if(_0x388544[_0xfc70('0x29')]!==_0xfc70('0x3a')){var _0xbfa17e={};_0xbfa17e[_0x388544[_0xfc70('0x2c')]]={'$like':'%'+_0x59b651['query'][_0xfc70('0x3b')]+'%'};return _0xbfa17e;}})});}_0x15e13c=_[_0xfc70('0x38')]({},_0x15e13c,_0x59b651['options']);var _0x50c9d2={'where':_0x15e13c[_0xfc70('0x39')]};return db[_0xfc70('0x26')][_0xfc70('0x1d')](_0x50c9d2)[_0xfc70('0x20')](function(_0x4101c3){_0x9eb82c['count']=_0x4101c3;if(_0x59b651[_0xfc70('0x30')][_0xfc70('0x3c')]){_0x15e13c[_0xfc70('0x3d')]=[{'all':!![]}];}return db[_0xfc70('0x26')]['findAll'](_0x15e13c);})[_0xfc70('0x20')](function(_0x42a4d5){_0x9eb82c[_0xfc70('0x3e')]=_0x42a4d5;return _0x9eb82c;})['then'](respondWithFilteredResult(_0x8036ad,_0x15e13c))[_0xfc70('0x3f')](handleError(_0x8036ad,null));};exports[_0xfc70('0x40')]=function(_0x3089cc,_0x419439){var _0x4505df={'raw':![],'where':{'id':_0x3089cc[_0xfc70('0x41')]['id']}},_0x5e84fd={};_0x5e84fd[_0xfc70('0x2b')]=_['keys'](db[_0xfc70('0x26')][_0xfc70('0x27')]);_0x5e84fd[_0xfc70('0x30')]=_[_0xfc70('0x2d')](_0x3089cc['query']);_0x5e84fd[_0xfc70('0x2e')]=_[_0xfc70('0x2f')](_0x5e84fd['model'],_0x5e84fd[_0xfc70('0x30')]);_0x4505df[_0xfc70('0x31')]=_['intersection'](_0x5e84fd[_0xfc70('0x2b')],qs['fields'](_0x3089cc['query']['fields']));_0x4505df[_0xfc70('0x31')]=_0x4505df[_0xfc70('0x31')][_0xfc70('0x33')]?_0x4505df[_0xfc70('0x31')]:_0x5e84fd['model'];if(_0x3089cc[_0xfc70('0x30')][_0xfc70('0x3c')]){_0x4505df[_0xfc70('0x3d')]=[{'all':!![]}];}_0x4505df=_['merge']({},_0x4505df,_0x3089cc[_0xfc70('0x42')]);return db[_0xfc70('0x26')]['find'](_0x4505df)[_0xfc70('0x20')](handleEntityNotFound(_0x419439,null))[_0xfc70('0x20')](respondWithResult(_0x419439,null))[_0xfc70('0x3f')](handleError(_0x419439,null));};exports['create']=function(_0x1e0688,_0x4318b9){return db[_0xfc70('0x26')]['create'](_0x1e0688[_0xfc70('0x43')],{})['then'](respondWithResult(_0x4318b9,0xc9))['catch'](handleError(_0x4318b9,null));};exports['update']=function(_0x47c8ba,_0x42d78c){if(_0x47c8ba[_0xfc70('0x43')]['id']){delete _0x47c8ba[_0xfc70('0x43')]['id'];}return db[_0xfc70('0x26')][_0xfc70('0x44')]({'where':{'id':_0x47c8ba[_0xfc70('0x41')]['id']}})[_0xfc70('0x20')](handleEntityNotFound(_0x42d78c,null))['then'](saveUpdates(_0x47c8ba['body'],null))[_0xfc70('0x20')](respondWithResult(_0x42d78c,null))[_0xfc70('0x3f')](handleError(_0x42d78c,null));};exports[_0xfc70('0x45')]=function(_0x376cae,_0x3fd682){return db['ServicenowConfiguration']['find']({'where':{'id':_0x376cae['params']['id']}})[_0xfc70('0x20')](handleEntityNotFound(_0x3fd682,null))[_0xfc70('0x20')](removeEntity(_0x3fd682,null))[_0xfc70('0x3f')](handleError(_0x3fd682,null));};exports[_0xfc70('0x46')]=function(_0xda6b,_0x455da0,_0xca2ef){var _0x1e9ec7={};var _0x244734={};var _0x8c517a;var _0x2a018f;return db[_0xfc70('0x26')][_0xfc70('0x47')]({'where':{'id':_0xda6b[_0xfc70('0x41')]['id']}})[_0xfc70('0x20')](handleEntityNotFound(_0x455da0,null))[_0xfc70('0x20')](function(_0x4c5eea){if(_0x4c5eea){_0x8c517a=_0x4c5eea;_0x244734['model']=_[_0xfc70('0x2d')](db[_0xfc70('0x48')][_0xfc70('0x27')]);_0x244734[_0xfc70('0x30')]=_[_0xfc70('0x2d')](_0xda6b['query']);_0x244734['filters']=_[_0xfc70('0x2f')](_0x244734[_0xfc70('0x2b')],_0x244734[_0xfc70('0x30')]);_0x1e9ec7['attributes']=_[_0xfc70('0x2f')](_0x244734[_0xfc70('0x2b')],qs[_0xfc70('0x32')](_0xda6b[_0xfc70('0x30')][_0xfc70('0x32')]));_0x1e9ec7[_0xfc70('0x31')]=_0x1e9ec7[_0xfc70('0x31')][_0xfc70('0x33')]?_0x1e9ec7[_0xfc70('0x31')]:_0x244734['model'];_0x1e9ec7[_0xfc70('0x49')]=qs['sort'](_0xda6b[_0xfc70('0x30')][_0xfc70('0x4a')]);_0x1e9ec7['where']=qs[_0xfc70('0x2e')](_[_0xfc70('0x37')](_0xda6b[_0xfc70('0x30')],_0x244734[_0xfc70('0x2e')]));if(_0xda6b[_0xfc70('0x30')][_0xfc70('0x3b')]){_0x1e9ec7[_0xfc70('0x39')]=_[_0xfc70('0x38')](_0x1e9ec7[_0xfc70('0x39')],{'$or':_[_0xfc70('0x25')](_0x1e9ec7[_0xfc70('0x31')],function(_0x598cec){var _0xafcee8={};_0xafcee8[_0x598cec]={'$like':'%'+_0xda6b['query'][_0xfc70('0x3b')]+'%'};return _0xafcee8;})});}_0x1e9ec7=_[_0xfc70('0x38')]({},_0x1e9ec7,_0xda6b['options']);return _0x8c517a[_0xfc70('0x46')](_0x1e9ec7);}})[_0xfc70('0x20')](function(_0x639bdd){if(_0x639bdd){_0x2a018f=_0x639bdd[_0xfc70('0x33')];if(!_0xda6b[_0xfc70('0x30')][_0xfc70('0x34')](_0xfc70('0x35'))){_0x1e9ec7[_0xfc70('0x36')]=qs[_0xfc70('0x36')](_0xda6b[_0xfc70('0x30')][_0xfc70('0x36')]);_0x1e9ec7['offset']=qs[_0xfc70('0x1b')](_0xda6b[_0xfc70('0x30')][_0xfc70('0x1b')]);}return _0x8c517a['getFields'](_0x1e9ec7);}})['then'](function(_0x3bd9de){if(_0x3bd9de){return _0x3bd9de?{'count':_0x2a018f,'rows':_0x3bd9de}:null;}})[_0xfc70('0x20')](respondWithResult(_0x455da0,null))[_0xfc70('0x3f')](handleError(_0x455da0,null));};exports['getSubjects']=function(_0x787af9,_0xd78160,_0x337ede){var _0x131ee3={};var _0x367d53={};var _0x468a45;var _0x3649f2;return db[_0xfc70('0x26')][_0xfc70('0x47')]({'where':{'id':_0x787af9[_0xfc70('0x41')]['id']}})[_0xfc70('0x20')](handleEntityNotFound(_0xd78160,null))[_0xfc70('0x20')](function(_0x511e79){if(_0x511e79){_0x468a45=_0x511e79;_0x367d53['model']=_[_0xfc70('0x2d')](db[_0xfc70('0x48')][_0xfc70('0x27')]);_0x367d53[_0xfc70('0x30')]=_[_0xfc70('0x2d')](_0x787af9[_0xfc70('0x30')]);_0x367d53['filters']=_[_0xfc70('0x2f')](_0x367d53['model'],_0x367d53[_0xfc70('0x30')]);_0x131ee3[_0xfc70('0x31')]=_['intersection'](_0x367d53[_0xfc70('0x2b')],qs['fields'](_0x787af9[_0xfc70('0x30')][_0xfc70('0x32')]));_0x131ee3[_0xfc70('0x31')]=_0x131ee3[_0xfc70('0x31')][_0xfc70('0x33')]?_0x131ee3[_0xfc70('0x31')]:_0x367d53[_0xfc70('0x2b')];_0x131ee3['order']=qs[_0xfc70('0x4a')](_0x787af9[_0xfc70('0x30')][_0xfc70('0x4a')]);_0x131ee3[_0xfc70('0x39')]=qs['filters'](_[_0xfc70('0x37')](_0x787af9[_0xfc70('0x30')],_0x367d53['filters']));if(_0x787af9[_0xfc70('0x30')][_0xfc70('0x3b')]){_0x131ee3[_0xfc70('0x39')]=_[_0xfc70('0x38')](_0x131ee3[_0xfc70('0x39')],{'$or':_[_0xfc70('0x25')](_0x131ee3[_0xfc70('0x31')],function(_0x4ce6c0){var _0x87f3a5={};_0x87f3a5[_0x4ce6c0]={'$like':'%'+_0x787af9[_0xfc70('0x30')][_0xfc70('0x3b')]+'%'};return _0x87f3a5;})});}_0x131ee3=_['merge']({},_0x131ee3,_0x787af9[_0xfc70('0x42')]);return _0x468a45[_0xfc70('0x4b')](_0x131ee3);}})[_0xfc70('0x20')](function(_0x4054b3){if(_0x4054b3){_0x3649f2=_0x4054b3[_0xfc70('0x33')];if(!_0x787af9[_0xfc70('0x30')][_0xfc70('0x34')](_0xfc70('0x35'))){_0x131ee3[_0xfc70('0x36')]=qs[_0xfc70('0x36')](_0x787af9[_0xfc70('0x30')]['limit']);_0x131ee3[_0xfc70('0x1b')]=qs['offset'](_0x787af9[_0xfc70('0x30')][_0xfc70('0x1b')]);}return _0x468a45[_0xfc70('0x4b')](_0x131ee3);}})[_0xfc70('0x20')](function(_0x6a9f36){if(_0x6a9f36){return _0x6a9f36?{'count':_0x3649f2,'rows':_0x6a9f36}:null;}})[_0xfc70('0x20')](respondWithResult(_0xd78160,null))[_0xfc70('0x3f')](handleError(_0xd78160,null));};exports['getDescriptions']=function(_0x5938db,_0x1d5515,_0x2592fb){var _0x26251e={};var _0x461b37={};var _0x14326f;var _0x5ba4d;return db[_0xfc70('0x26')][_0xfc70('0x47')]({'where':{'id':_0x5938db[_0xfc70('0x41')]['id']}})[_0xfc70('0x20')](handleEntityNotFound(_0x1d5515,null))[_0xfc70('0x20')](function(_0x186bac){if(_0x186bac){_0x14326f=_0x186bac;_0x461b37[_0xfc70('0x2b')]=_[_0xfc70('0x2d')](db['ServicenowField'][_0xfc70('0x27')]);_0x461b37['query']=_[_0xfc70('0x2d')](_0x5938db['query']);_0x461b37[_0xfc70('0x2e')]=_['intersection'](_0x461b37[_0xfc70('0x2b')],_0x461b37[_0xfc70('0x30')]);_0x26251e[_0xfc70('0x31')]=_[_0xfc70('0x2f')](_0x461b37['model'],qs[_0xfc70('0x32')](_0x5938db[_0xfc70('0x30')][_0xfc70('0x32')]));_0x26251e[_0xfc70('0x31')]=_0x26251e[_0xfc70('0x31')]['length']?_0x26251e[_0xfc70('0x31')]:_0x461b37['model'];_0x26251e[_0xfc70('0x49')]=qs[_0xfc70('0x4a')](_0x5938db[_0xfc70('0x30')][_0xfc70('0x4a')]);_0x26251e[_0xfc70('0x39')]=qs[_0xfc70('0x2e')](_[_0xfc70('0x37')](_0x5938db[_0xfc70('0x30')],_0x461b37['filters']));if(_0x5938db[_0xfc70('0x30')][_0xfc70('0x3b')]){_0x26251e[_0xfc70('0x39')]=_[_0xfc70('0x38')](_0x26251e[_0xfc70('0x39')],{'$or':_[_0xfc70('0x25')](_0x26251e[_0xfc70('0x31')],function(_0x195dc5){var _0x3307be={};_0x3307be[_0x195dc5]={'$like':'%'+_0x5938db[_0xfc70('0x30')][_0xfc70('0x3b')]+'%'};return _0x3307be;})});}_0x26251e=_[_0xfc70('0x38')]({},_0x26251e,_0x5938db[_0xfc70('0x42')]);return _0x14326f['getDescriptions'](_0x26251e);}})[_0xfc70('0x20')](function(_0x300e3b){if(_0x300e3b){_0x5ba4d=_0x300e3b[_0xfc70('0x33')];if(!_0x5938db[_0xfc70('0x30')][_0xfc70('0x34')](_0xfc70('0x35'))){_0x26251e['limit']=qs[_0xfc70('0x36')](_0x5938db[_0xfc70('0x30')]['limit']);_0x26251e['offset']=qs[_0xfc70('0x1b')](_0x5938db['query'][_0xfc70('0x1b')]);}return _0x14326f[_0xfc70('0x4c')](_0x26251e);}})['then'](function(_0x154202){if(_0x154202){return _0x154202?{'count':_0x5ba4d,'rows':_0x154202}:null;}})[_0xfc70('0x20')](respondWithResult(_0x1d5515,null))[_0xfc70('0x3f')](handleError(_0x1d5515,null));}; \ No newline at end of file +var _0x1596=['order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','getFields','findOne','getSubjects','ServicenowField','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','undefined','count','limit','set','json','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x1596,0x1e7));var _0x6159=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1596[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x6159('0x0'));var rimraf=require(_0x6159('0x1'));var zipdir=require(_0x6159('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6159('0x3'));var BPromise=require(_0x6159('0x4'));var Mustache=require('mustache');var util=require(_0x6159('0x5'));var path=require(_0x6159('0x6'));var sox=require(_0x6159('0x7'));var csv=require(_0x6159('0x8'));var ejs=require(_0x6159('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6159('0xa'));var squel=require('squel');var crypto=require(_0x6159('0xb'));var jsforce=require(_0x6159('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6159('0x8'));var querystring=require('querystring');var Papa=require(_0x6159('0xd'));var Redis=require('ioredis');var authService=require(_0x6159('0xe'));var qs=require(_0x6159('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6159('0x10'))(_0x6159('0x11'));var utils=require(_0x6159('0x12'));var config=require(_0x6159('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a4a47,_0x4dc188){_0x4dc188=_0x4dc188||0xcc;return function(_0x56595c){if(_0x56595c){return _0x5a4a47['sendStatus'](_0x4dc188);}return _0x5a4a47[_0x6159('0x14')](_0x4dc188)[_0x6159('0x15')]();};}function respondWithResult(_0x4844d9,_0x234cb6){_0x234cb6=_0x234cb6||0xc8;return function(_0x22ea9b){if(_0x22ea9b){return _0x4844d9[_0x6159('0x14')](_0x234cb6)['json'](_0x22ea9b);}};}function respondWithFilteredResult(_0x4ea7a9,_0x2c13e5){return function(_0x2fc24b){if(_0x2fc24b){var _0x2e9817=typeof _0x2c13e5[_0x6159('0x16')]===_0x6159('0x17')&&typeof _0x2c13e5['limit']===_0x6159('0x17');var _0x215973=_0x2fc24b['count'];var _0x2cfdc0=_0x2e9817?0x0:_0x2c13e5['offset'];var _0x3d3a42=_0x2e9817?_0x2fc24b[_0x6159('0x18')]:_0x2c13e5[_0x6159('0x16')]+_0x2c13e5[_0x6159('0x19')];var _0x54cd96;if(_0x3d3a42>=_0x215973){_0x3d3a42=_0x215973;_0x54cd96=0xc8;}else{_0x54cd96=0xce;}_0x4ea7a9[_0x6159('0x14')](_0x54cd96);return _0x4ea7a9[_0x6159('0x1a')]('Content-Range',_0x2cfdc0+'-'+_0x3d3a42+'/'+_0x215973)[_0x6159('0x1b')](_0x2fc24b);}return null;};}function patchUpdates(_0x5728a0){return function(_0x193684){try{jsonpatch['apply'](_0x193684,_0x5728a0,!![]);}catch(_0x6fe539){return BPromise[_0x6159('0x1c')](_0x6fe539);}return _0x193684[_0x6159('0x1d')]();};}function saveUpdates(_0xa1d343,_0x592aef){return function(_0x36fe8f){if(_0x36fe8f){return _0x36fe8f[_0x6159('0x1e')](_0xa1d343)[_0x6159('0x1f')](function(_0x2af684){return _0x2af684;});}return null;};}function removeEntity(_0x5355a9,_0x4b60f2){return function(_0x2cc030){if(_0x2cc030){return _0x2cc030[_0x6159('0x20')]()[_0x6159('0x1f')](function(){_0x5355a9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e22a9,_0xffae56){return function(_0x534ba2){if(!_0x534ba2){_0x5e22a9[_0x6159('0x21')](0x194);}return _0x534ba2;};}function handleError(_0x57f1c8,_0x390cdc){_0x390cdc=_0x390cdc||0x1f4;return function(_0x24a2a2){logger[_0x6159('0x22')](_0x24a2a2[_0x6159('0x23')]);if(_0x24a2a2[_0x6159('0x24')]){delete _0x24a2a2[_0x6159('0x24')];}_0x57f1c8[_0x6159('0x14')](_0x390cdc)['send'](_0x24a2a2);};}exports[_0x6159('0x25')]=function(_0x4f6f37,_0x3dc54b){var _0x192805={},_0x531d49={},_0x46e42c={'count':0x0,'rows':[]};var _0x176089=_[_0x6159('0x26')](db[_0x6159('0x27')][_0x6159('0x28')],function(_0xca93d9){return{'name':_0xca93d9[_0x6159('0x29')],'type':_0xca93d9[_0x6159('0x2a')][_0x6159('0x2b')]};});_0x531d49['model']=_[_0x6159('0x26')](_0x176089,_0x6159('0x24'));_0x531d49[_0x6159('0x2c')]=_['keys'](_0x4f6f37['query']);_0x531d49[_0x6159('0x2d')]=_[_0x6159('0x2e')](_0x531d49[_0x6159('0x2f')],_0x531d49['query']);_0x192805[_0x6159('0x30')]=_[_0x6159('0x2e')](_0x531d49[_0x6159('0x2f')],qs[_0x6159('0x31')](_0x4f6f37[_0x6159('0x2c')][_0x6159('0x31')]));_0x192805['attributes']=_0x192805[_0x6159('0x30')][_0x6159('0x32')]?_0x192805[_0x6159('0x30')]:_0x531d49[_0x6159('0x2f')];if(!_0x4f6f37[_0x6159('0x2c')]['hasOwnProperty'](_0x6159('0x33'))){_0x192805[_0x6159('0x19')]=qs[_0x6159('0x19')](_0x4f6f37['query'][_0x6159('0x19')]);_0x192805[_0x6159('0x16')]=qs[_0x6159('0x16')](_0x4f6f37[_0x6159('0x2c')][_0x6159('0x16')]);}_0x192805[_0x6159('0x34')]=qs[_0x6159('0x35')](_0x4f6f37['query']['sort']);_0x192805[_0x6159('0x36')]=qs[_0x6159('0x2d')](_[_0x6159('0x37')](_0x4f6f37[_0x6159('0x2c')],_0x531d49[_0x6159('0x2d')]),_0x176089);if(_0x4f6f37[_0x6159('0x2c')][_0x6159('0x38')]){_0x192805[_0x6159('0x36')]=_[_0x6159('0x39')](_0x192805['where'],{'$or':_[_0x6159('0x26')](_0x176089,function(_0xcafc32){if(_0xcafc32[_0x6159('0x2a')]!==_0x6159('0x3a')){var _0x3891d4={};_0x3891d4[_0xcafc32['name']]={'$like':'%'+_0x4f6f37['query']['filter']+'%'};return _0x3891d4;}})});}_0x192805=_[_0x6159('0x39')]({},_0x192805,_0x4f6f37['options']);var _0x3b54c5={'where':_0x192805[_0x6159('0x36')]};return db[_0x6159('0x27')][_0x6159('0x18')](_0x3b54c5)[_0x6159('0x1f')](function(_0xc492e2){_0x46e42c[_0x6159('0x18')]=_0xc492e2;if(_0x4f6f37[_0x6159('0x2c')][_0x6159('0x3b')]){_0x192805[_0x6159('0x3c')]=[{'all':!![]}];}return db[_0x6159('0x27')][_0x6159('0x3d')](_0x192805);})[_0x6159('0x1f')](function(_0x139bb3){_0x46e42c[_0x6159('0x3e')]=_0x139bb3;return _0x46e42c;})[_0x6159('0x1f')](respondWithFilteredResult(_0x3dc54b,_0x192805))[_0x6159('0x3f')](handleError(_0x3dc54b,null));};exports[_0x6159('0x40')]=function(_0x3a7791,_0x5e0a10){var _0x148ab5={'raw':![],'where':{'id':_0x3a7791[_0x6159('0x41')]['id']}},_0x386bb9={};_0x386bb9['model']=_['keys'](db[_0x6159('0x27')]['rawAttributes']);_0x386bb9['query']=_[_0x6159('0x42')](_0x3a7791['query']);_0x386bb9['filters']=_[_0x6159('0x2e')](_0x386bb9[_0x6159('0x2f')],_0x386bb9[_0x6159('0x2c')]);_0x148ab5[_0x6159('0x30')]=_[_0x6159('0x2e')](_0x386bb9[_0x6159('0x2f')],qs[_0x6159('0x31')](_0x3a7791['query'][_0x6159('0x31')]));_0x148ab5[_0x6159('0x30')]=_0x148ab5[_0x6159('0x30')][_0x6159('0x32')]?_0x148ab5[_0x6159('0x30')]:_0x386bb9[_0x6159('0x2f')];if(_0x3a7791['query'][_0x6159('0x3b')]){_0x148ab5['include']=[{'all':!![]}];}_0x148ab5=_[_0x6159('0x39')]({},_0x148ab5,_0x3a7791[_0x6159('0x43')]);return db[_0x6159('0x27')][_0x6159('0x44')](_0x148ab5)['then'](handleEntityNotFound(_0x5e0a10,null))[_0x6159('0x1f')](respondWithResult(_0x5e0a10,null))[_0x6159('0x3f')](handleError(_0x5e0a10,null));};exports[_0x6159('0x45')]=function(_0x16ef32,_0x231664){return db[_0x6159('0x27')]['create'](_0x16ef32[_0x6159('0x46')],{})[_0x6159('0x1f')](respondWithResult(_0x231664,0xc9))[_0x6159('0x3f')](handleError(_0x231664,null));};exports[_0x6159('0x1e')]=function(_0x350901,_0x583260){if(_0x350901[_0x6159('0x46')]['id']){delete _0x350901['body']['id'];}return db['ServicenowConfiguration'][_0x6159('0x44')]({'where':{'id':_0x350901[_0x6159('0x41')]['id']}})[_0x6159('0x1f')](handleEntityNotFound(_0x583260,null))[_0x6159('0x1f')](saveUpdates(_0x350901[_0x6159('0x46')],null))[_0x6159('0x1f')](respondWithResult(_0x583260,null))[_0x6159('0x3f')](handleError(_0x583260,null));};exports['destroy']=function(_0xac72bf,_0x3e4000){return db['ServicenowConfiguration'][_0x6159('0x44')]({'where':{'id':_0xac72bf[_0x6159('0x41')]['id']}})[_0x6159('0x1f')](handleEntityNotFound(_0x3e4000,null))['then'](removeEntity(_0x3e4000,null))[_0x6159('0x3f')](handleError(_0x3e4000,null));};exports[_0x6159('0x47')]=function(_0x24fb8d,_0x3d944a,_0x4123a5){var _0x3478e0={};var _0x5e3e2b={};var _0x48c91b;var _0x29ebe7;return db['ServicenowConfiguration'][_0x6159('0x48')]({'where':{'id':_0x24fb8d[_0x6159('0x41')]['id']}})[_0x6159('0x1f')](handleEntityNotFound(_0x3d944a,null))[_0x6159('0x1f')](function(_0x151aa8){if(_0x151aa8){_0x48c91b=_0x151aa8;_0x5e3e2b[_0x6159('0x2f')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x5e3e2b[_0x6159('0x2c')]=_['keys'](_0x24fb8d[_0x6159('0x2c')]);_0x5e3e2b['filters']=_[_0x6159('0x2e')](_0x5e3e2b[_0x6159('0x2f')],_0x5e3e2b[_0x6159('0x2c')]);_0x3478e0['attributes']=_[_0x6159('0x2e')](_0x5e3e2b[_0x6159('0x2f')],qs[_0x6159('0x31')](_0x24fb8d[_0x6159('0x2c')][_0x6159('0x31')]));_0x3478e0[_0x6159('0x30')]=_0x3478e0[_0x6159('0x30')]['length']?_0x3478e0[_0x6159('0x30')]:_0x5e3e2b[_0x6159('0x2f')];_0x3478e0[_0x6159('0x34')]=qs['sort'](_0x24fb8d['query'][_0x6159('0x35')]);_0x3478e0[_0x6159('0x36')]=qs[_0x6159('0x2d')](_[_0x6159('0x37')](_0x24fb8d[_0x6159('0x2c')],_0x5e3e2b[_0x6159('0x2d')]));if(_0x24fb8d['query'][_0x6159('0x38')]){_0x3478e0[_0x6159('0x36')]=_[_0x6159('0x39')](_0x3478e0[_0x6159('0x36')],{'$or':_['map'](_0x3478e0[_0x6159('0x30')],function(_0x40da0a){var _0xa34777={};_0xa34777[_0x40da0a]={'$like':'%'+_0x24fb8d[_0x6159('0x2c')][_0x6159('0x38')]+'%'};return _0xa34777;})});}_0x3478e0=_['merge']({},_0x3478e0,_0x24fb8d[_0x6159('0x43')]);return _0x48c91b[_0x6159('0x47')](_0x3478e0);}})['then'](function(_0x283c92){if(_0x283c92){_0x29ebe7=_0x283c92[_0x6159('0x32')];if(!_0x24fb8d['query']['hasOwnProperty'](_0x6159('0x33'))){_0x3478e0[_0x6159('0x19')]=qs['limit'](_0x24fb8d[_0x6159('0x2c')][_0x6159('0x19')]);_0x3478e0['offset']=qs[_0x6159('0x16')](_0x24fb8d['query']['offset']);}return _0x48c91b[_0x6159('0x47')](_0x3478e0);}})[_0x6159('0x1f')](function(_0x292f70){if(_0x292f70){return _0x292f70?{'count':_0x29ebe7,'rows':_0x292f70}:null;}})['then'](respondWithResult(_0x3d944a,null))[_0x6159('0x3f')](handleError(_0x3d944a,null));};exports[_0x6159('0x49')]=function(_0x19ab64,_0x21cd19,_0x2d7785){var _0x25848b={};var _0x223087={};var _0x30b9f6;var _0x239c0a;return db[_0x6159('0x27')]['findOne']({'where':{'id':_0x19ab64['params']['id']}})[_0x6159('0x1f')](handleEntityNotFound(_0x21cd19,null))[_0x6159('0x1f')](function(_0x351c2f){if(_0x351c2f){_0x30b9f6=_0x351c2f;_0x223087[_0x6159('0x2f')]=_[_0x6159('0x42')](db[_0x6159('0x4a')][_0x6159('0x28')]);_0x223087[_0x6159('0x2c')]=_[_0x6159('0x42')](_0x19ab64[_0x6159('0x2c')]);_0x223087[_0x6159('0x2d')]=_[_0x6159('0x2e')](_0x223087[_0x6159('0x2f')],_0x223087[_0x6159('0x2c')]);_0x25848b[_0x6159('0x30')]=_[_0x6159('0x2e')](_0x223087[_0x6159('0x2f')],qs['fields'](_0x19ab64['query'][_0x6159('0x31')]));_0x25848b[_0x6159('0x30')]=_0x25848b[_0x6159('0x30')][_0x6159('0x32')]?_0x25848b['attributes']:_0x223087[_0x6159('0x2f')];_0x25848b['order']=qs[_0x6159('0x35')](_0x19ab64[_0x6159('0x2c')][_0x6159('0x35')]);_0x25848b['where']=qs['filters'](_[_0x6159('0x37')](_0x19ab64[_0x6159('0x2c')],_0x223087['filters']));if(_0x19ab64[_0x6159('0x2c')][_0x6159('0x38')]){_0x25848b[_0x6159('0x36')]=_[_0x6159('0x39')](_0x25848b[_0x6159('0x36')],{'$or':_[_0x6159('0x26')](_0x25848b['attributes'],function(_0x4ae4ec){var _0x5745a6={};_0x5745a6[_0x4ae4ec]={'$like':'%'+_0x19ab64['query'][_0x6159('0x38')]+'%'};return _0x5745a6;})});}_0x25848b=_[_0x6159('0x39')]({},_0x25848b,_0x19ab64[_0x6159('0x43')]);return _0x30b9f6[_0x6159('0x49')](_0x25848b);}})['then'](function(_0x4814c4){if(_0x4814c4){_0x239c0a=_0x4814c4[_0x6159('0x32')];if(!_0x19ab64[_0x6159('0x2c')]['hasOwnProperty'](_0x6159('0x33'))){_0x25848b[_0x6159('0x19')]=qs['limit'](_0x19ab64['query']['limit']);_0x25848b[_0x6159('0x16')]=qs['offset'](_0x19ab64[_0x6159('0x2c')][_0x6159('0x16')]);}return _0x30b9f6['getSubjects'](_0x25848b);}})[_0x6159('0x1f')](function(_0x333000){if(_0x333000){return _0x333000?{'count':_0x239c0a,'rows':_0x333000}:null;}})['then'](respondWithResult(_0x21cd19,null))[_0x6159('0x3f')](handleError(_0x21cd19,null));};exports[_0x6159('0x4b')]=function(_0x221178,_0x4248ee,_0x132a24){var _0x1264bb={};var _0x8be27d={};var _0x213b27;var _0x43cfb1;return db[_0x6159('0x27')]['findOne']({'where':{'id':_0x221178[_0x6159('0x41')]['id']}})[_0x6159('0x1f')](handleEntityNotFound(_0x4248ee,null))[_0x6159('0x1f')](function(_0x329db2){if(_0x329db2){_0x213b27=_0x329db2;_0x8be27d[_0x6159('0x2f')]=_['keys'](db[_0x6159('0x4a')]['rawAttributes']);_0x8be27d[_0x6159('0x2c')]=_[_0x6159('0x42')](_0x221178[_0x6159('0x2c')]);_0x8be27d[_0x6159('0x2d')]=_['intersection'](_0x8be27d[_0x6159('0x2f')],_0x8be27d[_0x6159('0x2c')]);_0x1264bb[_0x6159('0x30')]=_['intersection'](_0x8be27d[_0x6159('0x2f')],qs['fields'](_0x221178[_0x6159('0x2c')][_0x6159('0x31')]));_0x1264bb[_0x6159('0x30')]=_0x1264bb[_0x6159('0x30')][_0x6159('0x32')]?_0x1264bb[_0x6159('0x30')]:_0x8be27d[_0x6159('0x2f')];_0x1264bb[_0x6159('0x34')]=qs[_0x6159('0x35')](_0x221178[_0x6159('0x2c')][_0x6159('0x35')]);_0x1264bb[_0x6159('0x36')]=qs['filters'](_[_0x6159('0x37')](_0x221178['query'],_0x8be27d[_0x6159('0x2d')]));if(_0x221178[_0x6159('0x2c')]['filter']){_0x1264bb[_0x6159('0x36')]=_['merge'](_0x1264bb[_0x6159('0x36')],{'$or':_[_0x6159('0x26')](_0x1264bb[_0x6159('0x30')],function(_0x2c9dae){var _0x5635e9={};_0x5635e9[_0x2c9dae]={'$like':'%'+_0x221178['query'][_0x6159('0x38')]+'%'};return _0x5635e9;})});}_0x1264bb=_['merge']({},_0x1264bb,_0x221178[_0x6159('0x43')]);return _0x213b27['getDescriptions'](_0x1264bb);}})[_0x6159('0x1f')](function(_0x9256af){if(_0x9256af){_0x43cfb1=_0x9256af[_0x6159('0x32')];if(!_0x221178[_0x6159('0x2c')][_0x6159('0x4c')]('nolimit')){_0x1264bb[_0x6159('0x19')]=qs['limit'](_0x221178[_0x6159('0x2c')][_0x6159('0x19')]);_0x1264bb[_0x6159('0x16')]=qs['offset'](_0x221178[_0x6159('0x2c')][_0x6159('0x16')]);}return _0x213b27[_0x6159('0x4b')](_0x1264bb);}})[_0x6159('0x1f')](function(_0x59e42b){if(_0x59e42b){return _0x59e42b?{'count':_0x43cfb1,'rows':_0x59e42b}:null;}})['then'](respondWithResult(_0x4248ee,null))[_0x6159('0x3f')](handleError(_0x4248ee,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 4ce64ef..c3edae9 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 _0x9147=['./intServicenowConfiguration.attributes','define','int_servicenow_configurations','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x510132,_0x19645a){var _0x27edf7=function(_0x3a4ce8){while(--_0x3a4ce8){_0x510132['push'](_0x510132['shift']());}};_0x27edf7(++_0x19645a);}(_0x9147,0x7b));var _0x7914=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x9147[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x7914('0x0'));var util=require(_0x7914('0x1'));var logger=require('../../config/logger')(_0x7914('0x2'));var moment=require('moment');var BPromise=require(_0x7914('0x3'));var rp=require(_0x7914('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7914('0x5'));var config=require(_0x7914('0x6'));var attributes=require(_0x7914('0x7'));module['exports']=function(_0x34c372,_0x4dd321){return _0x34c372[_0x7914('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0x7914('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3611=['../../config/environment','exports','define','int_servicenow_configurations','lodash','api','request-promise','path','rimraf'];(function(_0x95a2c1,_0x1bd27f){var _0x7c5338=function(_0x274a65){while(--_0x274a65){_0x95a2c1['push'](_0x95a2c1['shift']());}};_0x7c5338(++_0x1bd27f);}(_0x3611,0x136));var _0x1361=function(_0x3af514,_0x24242c){_0x3af514=_0x3af514-0x0;var _0x5ee9e0=_0x3611[_0x3af514];return _0x5ee9e0;};'use strict';var _=require(_0x1361('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1361('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1361('0x2'));var fs=require('fs');var path=require(_0x1361('0x3'));var rimraf=require(_0x1361('0x4'));var config=require(_0x1361('0x5'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x1361('0x6')]=function(_0x304832,_0x5aa5dc){return _0x304832[_0x1361('0x7')]('ServicenowConfiguration',attributes,{'tableName':_0x1361('0x8'),'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 ac8e9d7..fe41b60 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 _0x99d6=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0x99d6,0x193));var _0x699d=function(_0x2de020,_0x252df0){_0x2de020=_0x2de020-0x0;var _0x182b7c=_0x99d6[_0x2de020];return _0x182b7c;};'use strict';var _=require(_0x699d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x699d('0x1'));var fs=require('fs');var Redis=require(_0x699d('0x2'));var db=require(_0x699d('0x3'))['db'];var utils=require(_0x699d('0x4'));var logger=require(_0x699d('0x5'))(_0x699d('0x6'));var config=require(_0x699d('0x7'));var jayson=require(_0x699d('0x8'));var client=jayson[_0x699d('0x9')][_0x699d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xee5e8,_0x2a0387,_0x4f6d7f){return new BPromise(function(_0x5765b7,_0x17751e){return client[_0x699d('0xb')](_0xee5e8,_0x4f6d7f)['then'](function(_0x100389){logger[_0x699d('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2a0387,_0x699d('0xd'));logger[_0x699d('0xe')](_0x699d('0xf'),_0x2a0387,_0x699d('0xd'),JSON[_0x699d('0x10')](_0x100389));if(_0x100389[_0x699d('0x11')]){if(_0x100389[_0x699d('0x11')]['code']===0x1f4){logger[_0x699d('0x11')](_0x699d('0x12'),_0x2a0387,_0x100389[_0x699d('0x11')][_0x699d('0x13')]);return _0x17751e(_0x100389['error'][_0x699d('0x13')]);}logger['error'](_0x699d('0x12'),_0x2a0387,_0x100389[_0x699d('0x11')]['message']);return _0x5765b7(_0x100389[_0x699d('0x11')][_0x699d('0x13')]);}else{logger[_0x699d('0xc')](_0x699d('0x12'),_0x2a0387,_0x699d('0xd'));_0x5765b7(_0x100389[_0x699d('0x14')][_0x699d('0x13')]);}})[_0x699d('0x15')](function(_0x560e02){logger[_0x699d('0x11')](_0x699d('0x12'),_0x2a0387,_0x560e02);_0x17751e(_0x560e02);});});} \ No newline at end of file +var _0xc0a4=['stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0xc0a4,0xc6));var _0x4c0a=function(_0x3621f7,_0x4c2185){_0x3621f7=_0x3621f7-0x0;var _0x426a17=_0xc0a4[_0x3621f7];return _0x426a17;};'use strict';var _=require(_0x4c0a('0x0'));var util=require(_0x4c0a('0x1'));var moment=require('moment');var BPromise=require(_0x4c0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c0a('0x3'));var db=require(_0x4c0a('0x4'))['db'];var utils=require(_0x4c0a('0x5'));var logger=require(_0x4c0a('0x6'))(_0x4c0a('0x7'));var config=require(_0x4c0a('0x8'));var jayson=require(_0x4c0a('0x9'));var client=jayson[_0x4c0a('0xa')][_0x4c0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1515ef,_0x53e005,_0x33fc7d){return new BPromise(function(_0x45b174,_0x50aa90){return client[_0x4c0a('0xc')](_0x1515ef,_0x33fc7d)[_0x4c0a('0xd')](function(_0x493120){logger[_0x4c0a('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x53e005,_0x4c0a('0xf'));logger[_0x4c0a('0x10')](_0x4c0a('0x11'),_0x53e005,_0x4c0a('0xf'),JSON[_0x4c0a('0x12')](_0x493120));if(_0x493120[_0x4c0a('0x13')]){if(_0x493120[_0x4c0a('0x13')]['code']===0x1f4){logger[_0x4c0a('0x13')](_0x4c0a('0x14'),_0x53e005,_0x493120['error'][_0x4c0a('0x15')]);return _0x50aa90(_0x493120['error']['message']);}logger['error'](_0x4c0a('0x14'),_0x53e005,_0x493120[_0x4c0a('0x13')][_0x4c0a('0x15')]);return _0x45b174(_0x493120[_0x4c0a('0x13')]['message']);}else{logger[_0x4c0a('0xe')](_0x4c0a('0x14'),_0x53e005,'request\x20sent');_0x45b174(_0x493120[_0x4c0a('0x16')]['message']);}})[_0x4c0a('0x17')](function(_0x60e374){logger['error'](_0x4c0a('0x14'),_0x53e005,_0x60e374);_0x50aa90(_0x60e374);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 1d251e2..074d33a 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 _0x342c=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy'];(function(_0x5d07cb,_0x2b313d){var _0x3d5b7d=function(_0x51a961){while(--_0x51a961){_0x5d07cb['push'](_0x5d07cb['shift']());}};_0x3d5b7d(++_0x2b313d);}(_0x342c,0xac));var _0xc342=function(_0x223452,_0x49e85f){_0x223452=_0x223452-0x0;var _0x786481=_0x342c[_0x223452];return _0x786481;};'use strict';var multer=require(_0xc342('0x0'));var util=require(_0xc342('0x1'));var path=require(_0xc342('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc342('0x3')]();var fs_extra=require(_0xc342('0x4'));var auth=require(_0xc342('0x5'));var interaction=require(_0xc342('0x6'));var config=require(_0xc342('0x7'));var controller=require(_0xc342('0x8'));router[_0xc342('0x9')]('/',auth[_0xc342('0xa')](),controller[_0xc342('0xb')]);router[_0xc342('0x9')](_0xc342('0xc'),auth[_0xc342('0xa')](),controller[_0xc342('0xd')]);router['post']('/',auth[_0xc342('0xa')](),controller[_0xc342('0xe')]);router[_0xc342('0xf')](_0xc342('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xc342('0x10')](_0xc342('0xc'),auth[_0xc342('0xa')](),controller[_0xc342('0x11')]);module[_0xc342('0x12')]=router; \ No newline at end of file +var _0x28e1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','update','delete','destroy','multer','util'];(function(_0x2bae02,_0x29d62b){var _0x5b4f8b=function(_0x20cbf7){while(--_0x20cbf7){_0x2bae02['push'](_0x2bae02['shift']());}};_0x5b4f8b(++_0x29d62b);}(_0x28e1,0xc2));var _0x128e=function(_0x276a71,_0x1d9d52){_0x276a71=_0x276a71-0x0;var _0x205159=_0x28e1[_0x276a71];return _0x205159;};'use strict';var multer=require(_0x128e('0x0'));var util=require(_0x128e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x128e('0x2'));var auth=require(_0x128e('0x3'));var interaction=require(_0x128e('0x4'));var config=require(_0x128e('0x5'));var controller=require('./intServicenowField.controller');router[_0x128e('0x6')]('/',auth[_0x128e('0x7')](),controller['index']);router[_0x128e('0x6')](_0x128e('0x8'),auth[_0x128e('0x7')](),controller[_0x128e('0x9')]);router[_0x128e('0xa')]('/',auth[_0x128e('0x7')](),controller['create']);router['put'](_0x128e('0x8'),auth[_0x128e('0x7')](),controller[_0x128e('0xb')]);router[_0x128e('0xc')](_0x128e('0x8'),auth[_0x128e('0x7')](),controller[_0x128e('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index d2dc527..1b23c71 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 _0x309e=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','ENUM','string'];(function(_0x580ed4,_0x2d979c){var _0x12a1ef=function(_0x5c210d){while(--_0x5c210d){_0x580ed4['push'](_0x580ed4['shift']());}};_0x12a1ef(++_0x2d979c);}(_0x309e,0x9f));var _0xe309=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x309e[_0x543084];return _0x306a57;};'use strict';var Sequelize=require(_0xe309('0x0'));module['exports']={'type':{'type':Sequelize[_0xe309('0x1')](_0xe309('0x2'),'variable',_0xe309('0x3'),_0xe309('0x4'),_0xe309('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe309('0x6')]},'key':{'type':Sequelize[_0xe309('0x6')]},'keyType':{'type':Sequelize[_0xe309('0x1')]('string',_0xe309('0x7'),_0xe309('0x3'))},'keyContent':{'type':Sequelize[_0xe309('0x6')]},'idField':{'type':Sequelize[_0xe309('0x6')]},'nameField':{'type':Sequelize[_0xe309('0x6')]},'customField':{'type':Sequelize[_0xe309('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe309('0x6')]}}; \ No newline at end of file +var _0x8891=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','sequelize'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x8891,0x194));var _0x1889=function(_0x35640f,_0x3351bb){_0x35640f=_0x35640f-0x0;var _0x508de1=_0x8891[_0x35640f];return _0x508de1;};'use strict';var Sequelize=require(_0x1889('0x0'));module[_0x1889('0x1')]={'type':{'type':Sequelize[_0x1889('0x2')]('string',_0x1889('0x3'),_0x1889('0x4'),_0x1889('0x5'),_0x1889('0x6')),'defaultValue':_0x1889('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1889('0x8')]},'keyType':{'type':Sequelize[_0x1889('0x2')](_0x1889('0x7'),_0x1889('0x3'),_0x1889('0x4'))},'keyContent':{'type':Sequelize[_0x1889('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1889('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 510cfd6..bc14cec 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 _0xaa30=['index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','where','pick','VIRTUAL','filter','merge','options','includeAll','include','ServicenowField','rows','create','body','find','params','catch','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','send'];(function(_0x33699c,_0x222459){var _0x228c15=function(_0x4664d8){while(--_0x4664d8){_0x33699c['push'](_0x33699c['shift']());}};_0x228c15(++_0x222459);}(_0xaa30,0x1c1));var _0x0aa3=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xaa30[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0x0aa3('0x0'));var rimraf=require(_0x0aa3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0aa3('0x2'));var moment=require(_0x0aa3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0aa3('0x4'));var util=require(_0x0aa3('0x5'));var path=require(_0x0aa3('0x6'));var sox=require(_0x0aa3('0x7'));var csv=require(_0x0aa3('0x8'));var ejs=require(_0x0aa3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0aa3('0xa'));var squel=require(_0x0aa3('0xb'));var crypto=require(_0x0aa3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0aa3('0xd'));var toCsv=require(_0x0aa3('0x8'));var querystring=require(_0x0aa3('0xe'));var Papa=require(_0x0aa3('0xf'));var Redis=require(_0x0aa3('0x10'));var authService=require(_0x0aa3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0aa3('0x12'));var logger=require(_0x0aa3('0x13'))(_0x0aa3('0x14'));var utils=require(_0x0aa3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0aa3('0x16'));var db=require(_0x0aa3('0x17'))['db'];function respondWithStatusCode(_0xcfc941,_0x18d7ec){_0x18d7ec=_0x18d7ec||0xcc;return function(_0x249792){if(_0x249792){return _0xcfc941[_0x0aa3('0x18')](_0x18d7ec);}return _0xcfc941[_0x0aa3('0x19')](_0x18d7ec)[_0x0aa3('0x1a')]();};}function respondWithResult(_0x52f307,_0x56b005){_0x56b005=_0x56b005||0xc8;return function(_0x5425c6){if(_0x5425c6){return _0x52f307['status'](_0x56b005)[_0x0aa3('0x1b')](_0x5425c6);}};}function respondWithFilteredResult(_0x51e45b,_0x59a901){return function(_0x39b673){if(_0x39b673){var _0x307513=typeof _0x59a901[_0x0aa3('0x1c')]===_0x0aa3('0x1d')&&typeof _0x59a901[_0x0aa3('0x1e')]===_0x0aa3('0x1d');var _0x8beeff=_0x39b673[_0x0aa3('0x1f')];var _0x3f6efd=_0x307513?0x0:_0x59a901[_0x0aa3('0x1c')];var _0x16c7e2=_0x307513?_0x39b673['count']:_0x59a901[_0x0aa3('0x1c')]+_0x59a901[_0x0aa3('0x1e')];var _0x1c20ab;if(_0x16c7e2>=_0x8beeff){_0x16c7e2=_0x8beeff;_0x1c20ab=0xc8;}else{_0x1c20ab=0xce;}_0x51e45b['status'](_0x1c20ab);return _0x51e45b['set'](_0x0aa3('0x20'),_0x3f6efd+'-'+_0x16c7e2+'/'+_0x8beeff)[_0x0aa3('0x1b')](_0x39b673);}return null;};}function patchUpdates(_0x3d0bec){return function(_0x5d36b5){try{jsonpatch[_0x0aa3('0x21')](_0x5d36b5,_0x3d0bec,!![]);}catch(_0x293e7b){return BPromise[_0x0aa3('0x22')](_0x293e7b);}return _0x5d36b5[_0x0aa3('0x23')]();};}function saveUpdates(_0x21124e,_0x26d7c4){return function(_0x11786b){if(_0x11786b){return _0x11786b[_0x0aa3('0x24')](_0x21124e)[_0x0aa3('0x25')](function(_0x3b0af7){return _0x3b0af7;});}return null;};}function removeEntity(_0x41f804,_0x43c427){return function(_0x216624){if(_0x216624){return _0x216624[_0x0aa3('0x26')]()[_0x0aa3('0x25')](function(){_0x41f804[_0x0aa3('0x19')](0xcc)[_0x0aa3('0x1a')]();});}};}function handleEntityNotFound(_0x3e525e,_0x4eef3a){return function(_0x20cea9){if(!_0x20cea9){_0x3e525e[_0x0aa3('0x18')](0x194);}return _0x20cea9;};}function handleError(_0x32df39,_0x4e1ece){_0x4e1ece=_0x4e1ece||0x1f4;return function(_0xdb92b2){logger['error'](_0xdb92b2['stack']);if(_0xdb92b2['name']){delete _0xdb92b2[_0x0aa3('0x27')];}_0x32df39[_0x0aa3('0x19')](_0x4e1ece)[_0x0aa3('0x28')](_0xdb92b2);};}exports[_0x0aa3('0x29')]=function(_0x251e31,_0x4b2589){var _0x5bf5b6={},_0xb4b24f={},_0x519d1b={'count':0x0,'rows':[]};var _0x188e0b=_[_0x0aa3('0x2a')](db['ServicenowField'][_0x0aa3('0x2b')],function(_0x3a073e){return{'name':_0x3a073e[_0x0aa3('0x2c')],'type':_0x3a073e['type'][_0x0aa3('0x2d')]};});_0xb4b24f[_0x0aa3('0x2e')]=_[_0x0aa3('0x2a')](_0x188e0b,_0x0aa3('0x27'));_0xb4b24f[_0x0aa3('0x2f')]=_[_0x0aa3('0x30')](_0x251e31[_0x0aa3('0x2f')]);_0xb4b24f[_0x0aa3('0x31')]=_[_0x0aa3('0x32')](_0xb4b24f['model'],_0xb4b24f[_0x0aa3('0x2f')]);_0x5bf5b6['attributes']=_[_0x0aa3('0x32')](_0xb4b24f[_0x0aa3('0x2e')],qs[_0x0aa3('0x33')](_0x251e31[_0x0aa3('0x2f')][_0x0aa3('0x33')]));_0x5bf5b6['attributes']=_0x5bf5b6[_0x0aa3('0x34')][_0x0aa3('0x35')]?_0x5bf5b6[_0x0aa3('0x34')]:_0xb4b24f[_0x0aa3('0x2e')];if(!_0x251e31['query']['hasOwnProperty'](_0x0aa3('0x36'))){_0x5bf5b6[_0x0aa3('0x1e')]=qs[_0x0aa3('0x1e')](_0x251e31[_0x0aa3('0x2f')][_0x0aa3('0x1e')]);_0x5bf5b6[_0x0aa3('0x1c')]=qs[_0x0aa3('0x1c')](_0x251e31[_0x0aa3('0x2f')]['offset']);}_0x5bf5b6['order']=qs['sort'](_0x251e31[_0x0aa3('0x2f')]['sort']);_0x5bf5b6[_0x0aa3('0x37')]=qs[_0x0aa3('0x31')](_[_0x0aa3('0x38')](_0x251e31[_0x0aa3('0x2f')],_0xb4b24f['filters']),_0x188e0b);if(_0x251e31['query']['filter']){_0x5bf5b6[_0x0aa3('0x37')]=_['merge'](_0x5bf5b6[_0x0aa3('0x37')],{'$or':_[_0x0aa3('0x2a')](_0x188e0b,function(_0xdde9a1){if(_0xdde9a1['type']!==_0x0aa3('0x39')){var _0x3d59c3={};_0x3d59c3[_0xdde9a1[_0x0aa3('0x27')]]={'$like':'%'+_0x251e31['query'][_0x0aa3('0x3a')]+'%'};return _0x3d59c3;}})});}_0x5bf5b6=_[_0x0aa3('0x3b')]({},_0x5bf5b6,_0x251e31[_0x0aa3('0x3c')]);var _0x49ab7b={'where':_0x5bf5b6[_0x0aa3('0x37')]};return db['ServicenowField'][_0x0aa3('0x1f')](_0x49ab7b)['then'](function(_0x2255a5){_0x519d1b[_0x0aa3('0x1f')]=_0x2255a5;if(_0x251e31[_0x0aa3('0x2f')][_0x0aa3('0x3d')]){_0x5bf5b6[_0x0aa3('0x3e')]=[{'all':!![]}];}return db[_0x0aa3('0x3f')]['findAll'](_0x5bf5b6);})['then'](function(_0x366c70){_0x519d1b[_0x0aa3('0x40')]=_0x366c70;return _0x519d1b;})[_0x0aa3('0x25')](respondWithFilteredResult(_0x4b2589,_0x5bf5b6))['catch'](handleError(_0x4b2589,null));};exports['show']=function(_0x2859b9,_0x3a675e){var _0x22d323={'raw':!![],'where':{'id':_0x2859b9['params']['id']}},_0x2313af={};_0x2313af[_0x0aa3('0x2e')]=_[_0x0aa3('0x30')](db[_0x0aa3('0x3f')]['rawAttributes']);_0x2313af['query']=_[_0x0aa3('0x30')](_0x2859b9[_0x0aa3('0x2f')]);_0x2313af[_0x0aa3('0x31')]=_[_0x0aa3('0x32')](_0x2313af[_0x0aa3('0x2e')],_0x2313af[_0x0aa3('0x2f')]);_0x22d323[_0x0aa3('0x34')]=_[_0x0aa3('0x32')](_0x2313af[_0x0aa3('0x2e')],qs[_0x0aa3('0x33')](_0x2859b9[_0x0aa3('0x2f')][_0x0aa3('0x33')]));_0x22d323[_0x0aa3('0x34')]=_0x22d323[_0x0aa3('0x34')][_0x0aa3('0x35')]?_0x22d323[_0x0aa3('0x34')]:_0x2313af[_0x0aa3('0x2e')];if(_0x2859b9[_0x0aa3('0x2f')]['includeAll']){_0x22d323[_0x0aa3('0x3e')]=[{'all':!![]}];}_0x22d323=_[_0x0aa3('0x3b')]({},_0x22d323,_0x2859b9[_0x0aa3('0x3c')]);return db[_0x0aa3('0x3f')]['find'](_0x22d323)[_0x0aa3('0x25')](handleEntityNotFound(_0x3a675e,null))[_0x0aa3('0x25')](respondWithResult(_0x3a675e,null))['catch'](handleError(_0x3a675e,null));};exports[_0x0aa3('0x41')]=function(_0x5a15ac,_0xb7b0e8){return db[_0x0aa3('0x3f')]['create'](_0x5a15ac[_0x0aa3('0x42')],{})['then'](respondWithResult(_0xb7b0e8,0xc9))['catch'](handleError(_0xb7b0e8,null));};exports[_0x0aa3('0x24')]=function(_0x27c3a0,_0xa45d51){if(_0x27c3a0[_0x0aa3('0x42')]['id']){delete _0x27c3a0[_0x0aa3('0x42')]['id'];}return db[_0x0aa3('0x3f')][_0x0aa3('0x43')]({'where':{'id':_0x27c3a0[_0x0aa3('0x44')]['id']}})['then'](handleEntityNotFound(_0xa45d51,null))[_0x0aa3('0x25')](saveUpdates(_0x27c3a0[_0x0aa3('0x42')],null))[_0x0aa3('0x25')](respondWithResult(_0xa45d51,null))[_0x0aa3('0x45')](handleError(_0xa45d51,null));};exports[_0x0aa3('0x26')]=function(_0x11e89e,_0x290d7f){return db[_0x0aa3('0x3f')][_0x0aa3('0x43')]({'where':{'id':_0x11e89e[_0x0aa3('0x44')]['id']}})['then'](handleEntityNotFound(_0x290d7f,null))[_0x0aa3('0x25')](removeEntity(_0x290d7f,null))[_0x0aa3('0x45')](handleError(_0x290d7f,null));}; \ No newline at end of file +var _0xb322=['count','set','reject','save','update','destroy','name','send','ServicenowField','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','then','rows','show','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x588dcc,_0xc8e736){var _0x2a825c=function(_0x335d1d){while(--_0x335d1d){_0x588dcc['push'](_0x588dcc['shift']());}};_0x2a825c(++_0xc8e736);}(_0xb322,0xba));var _0x2b32=function(_0x3f3a55,_0x4ecf1c){_0x3f3a55=_0x3f3a55-0x0;var _0x101dd7=_0xb322[_0x3f3a55];return _0x101dd7;};'use strict';var emlformat=require(_0x2b32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b32('0x1'));var jsonpatch=require(_0x2b32('0x2'));var rp=require(_0x2b32('0x3'));var moment=require(_0x2b32('0x4'));var BPromise=require(_0x2b32('0x5'));var Mustache=require(_0x2b32('0x6'));var util=require(_0x2b32('0x7'));var path=require(_0x2b32('0x8'));var sox=require(_0x2b32('0x9'));var csv=require(_0x2b32('0xa'));var ejs=require(_0x2b32('0xb'));var fs=require('fs');var fs_extra=require(_0x2b32('0xc'));var _=require('lodash');var squel=require(_0x2b32('0xd'));var crypto=require('crypto');var jsforce=require(_0x2b32('0xe'));var deskjs=require(_0x2b32('0xf'));var toCsv=require(_0x2b32('0xa'));var querystring=require(_0x2b32('0x10'));var Papa=require(_0x2b32('0x11'));var Redis=require(_0x2b32('0x12'));var authService=require(_0x2b32('0x13'));var qs=require(_0x2b32('0x14'));var as=require(_0x2b32('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b32('0x16'))(_0x2b32('0x17'));var utils=require(_0x2b32('0x18'));var config=require(_0x2b32('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b32('0x1a'))['db'];function respondWithStatusCode(_0xd1586,_0x28cd7){_0x28cd7=_0x28cd7||0xcc;return function(_0x4c5d27){if(_0x4c5d27){return _0xd1586['sendStatus'](_0x28cd7);}return _0xd1586[_0x2b32('0x1b')](_0x28cd7)[_0x2b32('0x1c')]();};}function respondWithResult(_0x27918f,_0x2d0f47){_0x2d0f47=_0x2d0f47||0xc8;return function(_0x2fac1d){if(_0x2fac1d){return _0x27918f['status'](_0x2d0f47)[_0x2b32('0x1d')](_0x2fac1d);}};}function respondWithFilteredResult(_0x10f29d,_0x47acb7){return function(_0x3d3754){if(_0x3d3754){var _0x4f12cb=typeof _0x47acb7[_0x2b32('0x1e')]===_0x2b32('0x1f')&&typeof _0x47acb7[_0x2b32('0x20')]===_0x2b32('0x1f');var _0x21749a=_0x3d3754[_0x2b32('0x21')];var _0x1990cf=_0x4f12cb?0x0:_0x47acb7['offset'];var _0x2c366f=_0x4f12cb?_0x3d3754[_0x2b32('0x21')]:_0x47acb7[_0x2b32('0x1e')]+_0x47acb7[_0x2b32('0x20')];var _0x2429d4;if(_0x2c366f>=_0x21749a){_0x2c366f=_0x21749a;_0x2429d4=0xc8;}else{_0x2429d4=0xce;}_0x10f29d[_0x2b32('0x1b')](_0x2429d4);return _0x10f29d[_0x2b32('0x22')]('Content-Range',_0x1990cf+'-'+_0x2c366f+'/'+_0x21749a)[_0x2b32('0x1d')](_0x3d3754);}return null;};}function patchUpdates(_0x1086d0){return function(_0x1ae54f){try{jsonpatch['apply'](_0x1ae54f,_0x1086d0,!![]);}catch(_0x79abb5){return BPromise[_0x2b32('0x23')](_0x79abb5);}return _0x1ae54f[_0x2b32('0x24')]();};}function saveUpdates(_0x2a61f6,_0x536b08){return function(_0x136779){if(_0x136779){return _0x136779[_0x2b32('0x25')](_0x2a61f6)['then'](function(_0x5961a1){return _0x5961a1;});}return null;};}function removeEntity(_0x2f46ba,_0x19ab46){return function(_0x10b0d3){if(_0x10b0d3){return _0x10b0d3[_0x2b32('0x26')]()['then'](function(){_0x2f46ba['status'](0xcc)[_0x2b32('0x1c')]();});}};}function handleEntityNotFound(_0x59fda0,_0x123c70){return function(_0x50c111){if(!_0x50c111){_0x59fda0['sendStatus'](0x194);}return _0x50c111;};}function handleError(_0xa7328a,_0x170184){_0x170184=_0x170184||0x1f4;return function(_0x4c0d1d){logger['error'](_0x4c0d1d['stack']);if(_0x4c0d1d[_0x2b32('0x27')]){delete _0x4c0d1d[_0x2b32('0x27')];}_0xa7328a['status'](_0x170184)[_0x2b32('0x28')](_0x4c0d1d);};}exports['index']=function(_0x761b21,_0x470658){var _0x3fecaa={},_0x3461c1={},_0x3bc296={'count':0x0,'rows':[]};var _0x1d7f2a=_['map'](db[_0x2b32('0x29')][_0x2b32('0x2a')],function(_0x4d74f5){return{'name':_0x4d74f5['fieldName'],'type':_0x4d74f5['type']['key']};});_0x3461c1[_0x2b32('0x2b')]=_['map'](_0x1d7f2a,_0x2b32('0x27'));_0x3461c1[_0x2b32('0x2c')]=_[_0x2b32('0x2d')](_0x761b21['query']);_0x3461c1[_0x2b32('0x2e')]=_[_0x2b32('0x2f')](_0x3461c1[_0x2b32('0x2b')],_0x3461c1[_0x2b32('0x2c')]);_0x3fecaa['attributes']=_[_0x2b32('0x2f')](_0x3461c1[_0x2b32('0x2b')],qs[_0x2b32('0x30')](_0x761b21[_0x2b32('0x2c')][_0x2b32('0x30')]));_0x3fecaa[_0x2b32('0x31')]=_0x3fecaa[_0x2b32('0x31')][_0x2b32('0x32')]?_0x3fecaa['attributes']:_0x3461c1[_0x2b32('0x2b')];if(!_0x761b21[_0x2b32('0x2c')][_0x2b32('0x33')](_0x2b32('0x34'))){_0x3fecaa[_0x2b32('0x20')]=qs[_0x2b32('0x20')](_0x761b21[_0x2b32('0x2c')]['limit']);_0x3fecaa[_0x2b32('0x1e')]=qs['offset'](_0x761b21['query'][_0x2b32('0x1e')]);}_0x3fecaa[_0x2b32('0x35')]=qs[_0x2b32('0x36')](_0x761b21[_0x2b32('0x2c')][_0x2b32('0x36')]);_0x3fecaa[_0x2b32('0x37')]=qs[_0x2b32('0x2e')](_[_0x2b32('0x38')](_0x761b21[_0x2b32('0x2c')],_0x3461c1[_0x2b32('0x2e')]),_0x1d7f2a);if(_0x761b21[_0x2b32('0x2c')][_0x2b32('0x39')]){_0x3fecaa[_0x2b32('0x37')]=_['merge'](_0x3fecaa['where'],{'$or':_[_0x2b32('0x3a')](_0x1d7f2a,function(_0x4e1475){if(_0x4e1475[_0x2b32('0x3b')]!==_0x2b32('0x3c')){var _0x75d338={};_0x75d338[_0x4e1475[_0x2b32('0x27')]]={'$like':'%'+_0x761b21['query'][_0x2b32('0x39')]+'%'};return _0x75d338;}})});}_0x3fecaa=_[_0x2b32('0x3d')]({},_0x3fecaa,_0x761b21[_0x2b32('0x3e')]);var _0x306fac={'where':_0x3fecaa['where']};return db[_0x2b32('0x29')][_0x2b32('0x21')](_0x306fac)['then'](function(_0x23a1ec){_0x3bc296[_0x2b32('0x21')]=_0x23a1ec;if(_0x761b21['query'][_0x2b32('0x3f')]){_0x3fecaa[_0x2b32('0x40')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x3fecaa);})[_0x2b32('0x41')](function(_0x289b89){_0x3bc296[_0x2b32('0x42')]=_0x289b89;return _0x3bc296;})[_0x2b32('0x41')](respondWithFilteredResult(_0x470658,_0x3fecaa))['catch'](handleError(_0x470658,null));};exports[_0x2b32('0x43')]=function(_0x1cd045,_0x187279){var _0x3182d9={'raw':!![],'where':{'id':_0x1cd045['params']['id']}},_0x3269a9={};_0x3269a9[_0x2b32('0x2b')]=_['keys'](db['ServicenowField'][_0x2b32('0x2a')]);_0x3269a9[_0x2b32('0x2c')]=_[_0x2b32('0x2d')](_0x1cd045['query']);_0x3269a9[_0x2b32('0x2e')]=_[_0x2b32('0x2f')](_0x3269a9[_0x2b32('0x2b')],_0x3269a9[_0x2b32('0x2c')]);_0x3182d9['attributes']=_[_0x2b32('0x2f')](_0x3269a9['model'],qs[_0x2b32('0x30')](_0x1cd045[_0x2b32('0x2c')][_0x2b32('0x30')]));_0x3182d9[_0x2b32('0x31')]=_0x3182d9[_0x2b32('0x31')][_0x2b32('0x32')]?_0x3182d9['attributes']:_0x3269a9['model'];if(_0x1cd045[_0x2b32('0x2c')][_0x2b32('0x3f')]){_0x3182d9[_0x2b32('0x40')]=[{'all':!![]}];}_0x3182d9=_[_0x2b32('0x3d')]({},_0x3182d9,_0x1cd045[_0x2b32('0x3e')]);return db[_0x2b32('0x29')][_0x2b32('0x44')](_0x3182d9)[_0x2b32('0x41')](handleEntityNotFound(_0x187279,null))['then'](respondWithResult(_0x187279,null))[_0x2b32('0x45')](handleError(_0x187279,null));};exports['create']=function(_0x14223f,_0x35a877){return db[_0x2b32('0x29')][_0x2b32('0x46')](_0x14223f['body'],{})['then'](respondWithResult(_0x35a877,0xc9))['catch'](handleError(_0x35a877,null));};exports[_0x2b32('0x25')]=function(_0x3f73f8,_0x382acb){if(_0x3f73f8[_0x2b32('0x47')]['id']){delete _0x3f73f8[_0x2b32('0x47')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x3f73f8[_0x2b32('0x48')]['id']}})[_0x2b32('0x41')](handleEntityNotFound(_0x382acb,null))[_0x2b32('0x41')](saveUpdates(_0x3f73f8[_0x2b32('0x47')],null))[_0x2b32('0x41')](respondWithResult(_0x382acb,null))[_0x2b32('0x45')](handleError(_0x382acb,null));};exports[_0x2b32('0x26')]=function(_0x544fe9,_0x45abaf){return db['ServicenowField'][_0x2b32('0x44')]({'where':{'id':_0x544fe9[_0x2b32('0x48')]['id']}})['then'](handleEntityNotFound(_0x45abaf,null))[_0x2b32('0x41')](removeEntity(_0x45abaf,null))[_0x2b32('0x45')](handleError(_0x45abaf,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 690f296..c71c1ec 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 _0x38cd=['servicenow_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x334927,_0x5da3fa){var _0x251a9b=function(_0x54bf00){while(--_0x54bf00){_0x334927['push'](_0x334927['shift']());}};_0x251a9b(++_0x5da3fa);}(_0x38cd,0xc2));var _0xd38c=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0x38cd[_0x4bb581];return _0x316bf5;};'use strict';var _=require(_0xd38c('0x0'));var util=require(_0xd38c('0x1'));var logger=require(_0xd38c('0x2'))(_0xd38c('0x3'));var moment=require(_0xd38c('0x4'));var BPromise=require(_0xd38c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd38c('0x6'));var rimraf=require(_0xd38c('0x7'));var config=require(_0xd38c('0x8'));var attributes=require(_0xd38c('0x9'));module[_0xd38c('0xa')]=function(_0x42a045,_0x26ee69){return _0x42a045[_0xd38c('0xb')](_0xd38c('0xc'),attributes,{'tableName':_0xd38c('0xd'),'paranoid':![],'indexes':[{'name':_0xd38c('0xe'),'fields':[_0xd38c('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7602=['servicenow_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x13c714,_0x234884){var _0x5604c0=function(_0x234cdf){while(--_0x234cdf){_0x13c714['push'](_0x13c714['shift']());}};_0x5604c0(++_0x234884);}(_0x7602,0x8e));var _0x2760=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x7602[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x2760('0x0'));var util=require(_0x2760('0x1'));var logger=require(_0x2760('0x2'))('api');var moment=require(_0x2760('0x3'));var BPromise=require(_0x2760('0x4'));var rp=require(_0x2760('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2760('0x6'));var config=require(_0x2760('0x7'));var attributes=require(_0x2760('0x8'));module[_0x2760('0x9')]=function(_0x5988b0,_0x52ac27){return _0x5988b0[_0x2760('0xa')](_0x2760('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x2760('0xc'),'fields':[_0x2760('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 02fbd06..763d1e6 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 _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x3f56c5,_0x28e46d){var _0x1a0590=function(_0x166e2e){while(--_0x166e2e){_0x3f56c5['push'](_0x3f56c5['shift']());}};_0x1a0590(++_0x28e46d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0xf521c5,_0x286757){var _0x4b2928=function(_0x1ffc19){while(--_0x1ffc19){_0xf521c5['push'](_0xf521c5['shift']());}};_0x4b2928(++_0x286757);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xb7e7[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 6a63c52..10f9e70 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(_0x4c3932,_0xbd80e5){var _0x226628=function(_0x3ada7e){while(--_0x3ada7e){_0x4c3932['push'](_0x4c3932['shift']());}};_0x226628(++_0xbd80e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4252d8,_0x53e5f1){var _0xf1747a=function(_0x20a87c){while(--_0x20a87c){_0x4252d8['push'](_0x4252d8['shift']());}};_0xf1747a(++_0x53e5f1);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 8e0a068..138d40b 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(_0x9a6460,_0x5a3da6){var _0x4df3ee=function(_0x381759){while(--_0x381759){_0x9a6460['push'](_0x9a6460['shift']());}};_0x4df3ee(++_0x5a3da6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0xb48b3e,_0x3b295f){var _0x2b19f8=function(_0xbeacbe){while(--_0xbeacbe){_0xb48b3e['push'](_0xb48b3e['shift']());}};_0x2b19f8(++_0x3b295f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 7ef192f..3623dc3 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 _0x8eea=['get_module_fields','Calls','values','label','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','request-promise','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/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','save','update','then','destroy','error','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','SugarcrmConfiguration','length','pick','addConfiguration','AccountId','Subjects','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','duration_minutes','parent_id','parent_type','direction','findOne','password','remoteUri','slice','substring','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST'];(function(_0xeee152,_0xb9532){var _0x4e7d73=function(_0x28664a){while(--_0x28664a){_0xeee152['push'](_0xeee152['shift']());}};_0x4e7d73(++_0xb9532);}(_0x8eea,0x7e));var _0xa8ee=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0x8eea[_0x1ebeea];return _0x576465;};'use strict';var emlformat=require(_0xa8ee('0x0'));var rimraf=require(_0xa8ee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa8ee('0x2'));var moment=require('moment');var BPromise=require(_0xa8ee('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa8ee('0x4'));var sox=require(_0xa8ee('0x5'));var csv=require(_0xa8ee('0x6'));var ejs=require(_0xa8ee('0x7'));var fs=require('fs');var fs_extra=require(_0xa8ee('0x8'));var _=require(_0xa8ee('0x9'));var squel=require(_0xa8ee('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa8ee('0xb'));var toCsv=require(_0xa8ee('0x6'));var querystring=require('querystring');var Papa=require(_0xa8ee('0xc'));var Redis=require(_0xa8ee('0xd'));var authService=require(_0xa8ee('0xe'));var qs=require(_0xa8ee('0xf'));var as=require(_0xa8ee('0x10'));var hardwareService=require(_0xa8ee('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xa8ee('0x12'));var config=require(_0xa8ee('0x13'));var licenseUtil=require(_0xa8ee('0x14'));var db=require(_0xa8ee('0x15'))['db'];var integrations=require(_0xa8ee('0x16'));function respondWithStatusCode(_0x162031,_0xf918c){_0xf918c=_0xf918c||0xcc;return function(_0x33dc5d){if(_0x33dc5d){return _0x162031[_0xa8ee('0x17')](_0xf918c);}return _0x162031[_0xa8ee('0x18')](_0xf918c)[_0xa8ee('0x19')]();};}function respondWithResult(_0x1d65a8,_0xb6be63){_0xb6be63=_0xb6be63||0xc8;return function(_0x331967){if(_0x331967){return _0x1d65a8['status'](_0xb6be63)['json'](_0x331967);}};}function respondWithFilteredResult(_0x319ad8,_0x1666d3){return function(_0x2b4299){if(_0x2b4299){var _0x417125=typeof _0x1666d3[_0xa8ee('0x1a')]===_0xa8ee('0x1b')&&typeof _0x1666d3[_0xa8ee('0x1c')]==='undefined';var _0x4a456e=_0x2b4299[_0xa8ee('0x1d')];var _0x1e8641=_0x417125?0x0:_0x1666d3[_0xa8ee('0x1a')];var _0x396ca4=_0x417125?_0x2b4299[_0xa8ee('0x1d')]:_0x1666d3['offset']+_0x1666d3[_0xa8ee('0x1c')];var _0xba214a;if(_0x396ca4>=_0x4a456e){_0x396ca4=_0x4a456e;_0xba214a=0xc8;}else{_0xba214a=0xce;}_0x319ad8[_0xa8ee('0x18')](_0xba214a);return _0x319ad8[_0xa8ee('0x1e')]('Content-Range',_0x1e8641+'-'+_0x396ca4+'/'+_0x4a456e)[_0xa8ee('0x1f')](_0x2b4299);}return null;};}function patchUpdates(_0x2322e9){return function(_0x1e7133){try{jsonpatch['apply'](_0x1e7133,_0x2322e9,!![]);}catch(_0x30d08a){return BPromise['reject'](_0x30d08a);}return _0x1e7133[_0xa8ee('0x20')]();};}function saveUpdates(_0x58b5a0,_0x5169ce){return function(_0x49e26a){if(_0x49e26a){return _0x49e26a[_0xa8ee('0x21')](_0x58b5a0)[_0xa8ee('0x22')](function(_0x2a9912){return _0x2a9912;});}return null;};}function removeEntity(_0x22b6f7,_0x16e065){return function(_0x5d4882){if(_0x5d4882){return _0x5d4882[_0xa8ee('0x23')]()['then'](function(){_0x22b6f7[_0xa8ee('0x18')](0xcc)[_0xa8ee('0x19')]();});}};}function handleEntityNotFound(_0x7038fc,_0xcbd89b){return function(_0x5e275d){if(!_0x5e275d){_0x7038fc[_0xa8ee('0x17')](0x194);}return _0x5e275d;};}function handleError(_0x103fc6,_0x2e3a44){_0x2e3a44=_0x2e3a44||0x1f4;return function(_0x1d10bd){logger[_0xa8ee('0x24')](_0x1d10bd['stack']);if(_0x1d10bd[_0xa8ee('0x25')]){delete _0x1d10bd[_0xa8ee('0x25')];}_0x103fc6[_0xa8ee('0x18')](_0x2e3a44)[_0xa8ee('0x26')](_0x1d10bd);};}exports[_0xa8ee('0x27')]=function(_0x558b4a,_0x2d4570){var _0x4e3ace={},_0x91d49a={},_0x11a52f={'count':0x0,'rows':[]};var _0x572c76=_[_0xa8ee('0x28')](db[_0xa8ee('0x29')][_0xa8ee('0x2a')],function(_0x409195){return{'name':_0x409195[_0xa8ee('0x2b')],'type':_0x409195[_0xa8ee('0x2c')]['key']};});_0x91d49a[_0xa8ee('0x2d')]=_[_0xa8ee('0x28')](_0x572c76,_0xa8ee('0x25'));_0x91d49a['query']=_[_0xa8ee('0x2e')](_0x558b4a[_0xa8ee('0x2f')]);_0x91d49a[_0xa8ee('0x30')]=_[_0xa8ee('0x31')](_0x91d49a[_0xa8ee('0x2d')],_0x91d49a[_0xa8ee('0x2f')]);_0x4e3ace[_0xa8ee('0x32')]=_['intersection'](_0x91d49a[_0xa8ee('0x2d')],qs['fields'](_0x558b4a['query'][_0xa8ee('0x33')]));_0x4e3ace[_0xa8ee('0x32')]=_0x4e3ace[_0xa8ee('0x32')]['length']?_0x4e3ace['attributes']:_0x91d49a['model'];if(!_0x558b4a[_0xa8ee('0x2f')][_0xa8ee('0x34')](_0xa8ee('0x35'))){_0x4e3ace[_0xa8ee('0x1c')]=qs[_0xa8ee('0x1c')](_0x558b4a[_0xa8ee('0x2f')][_0xa8ee('0x1c')]);_0x4e3ace[_0xa8ee('0x1a')]=qs[_0xa8ee('0x1a')](_0x558b4a[_0xa8ee('0x2f')]['offset']);}_0x4e3ace[_0xa8ee('0x36')]=qs[_0xa8ee('0x37')](_0x558b4a[_0xa8ee('0x2f')]['sort']);_0x4e3ace[_0xa8ee('0x38')]=qs[_0xa8ee('0x30')](_['pick'](_0x558b4a['query'],_0x91d49a[_0xa8ee('0x30')]),_0x572c76);if(_0x558b4a[_0xa8ee('0x2f')]['filter']){_0x4e3ace[_0xa8ee('0x38')]=_['merge'](_0x4e3ace['where'],{'$or':_['map'](_0x572c76,function(_0x4b7cd7){if(_0x4b7cd7[_0xa8ee('0x2c')]!==_0xa8ee('0x39')){var _0xa279d1={};_0xa279d1[_0x4b7cd7[_0xa8ee('0x25')]]={'$like':'%'+_0x558b4a[_0xa8ee('0x2f')][_0xa8ee('0x3a')]+'%'};return _0xa279d1;}})});}_0x4e3ace=_[_0xa8ee('0x3b')]({},_0x4e3ace,_0x558b4a[_0xa8ee('0x3c')]);var _0x27c139={'where':_0x4e3ace[_0xa8ee('0x38')]};return db[_0xa8ee('0x29')][_0xa8ee('0x1d')](_0x27c139)[_0xa8ee('0x22')](function(_0x147bbc){_0x11a52f[_0xa8ee('0x1d')]=_0x147bbc;if(_0x558b4a['query'][_0xa8ee('0x3d')]){_0x4e3ace[_0xa8ee('0x3e')]=[{'all':!![]}];}return db[_0xa8ee('0x29')][_0xa8ee('0x3f')](_0x4e3ace);})[_0xa8ee('0x22')](function(_0x558ffe){_0x11a52f[_0xa8ee('0x40')]=_0x558ffe;return _0x11a52f;})['then'](respondWithFilteredResult(_0x2d4570,_0x4e3ace))[_0xa8ee('0x41')](handleError(_0x2d4570,null));};exports[_0xa8ee('0x42')]=function(_0x4f34ec,_0x1160ee){var _0x10c011={'raw':![],'where':{'id':_0x4f34ec['params']['id']}},_0x2dcc4b={};_0x2dcc4b['model']=_['keys'](db['SugarcrmAccount'][_0xa8ee('0x2a')]);_0x2dcc4b[_0xa8ee('0x2f')]=_[_0xa8ee('0x2e')](_0x4f34ec[_0xa8ee('0x2f')]);_0x2dcc4b[_0xa8ee('0x30')]=_[_0xa8ee('0x31')](_0x2dcc4b[_0xa8ee('0x2d')],_0x2dcc4b[_0xa8ee('0x2f')]);_0x10c011[_0xa8ee('0x32')]=_['intersection'](_0x2dcc4b[_0xa8ee('0x2d')],qs[_0xa8ee('0x33')](_0x4f34ec[_0xa8ee('0x2f')][_0xa8ee('0x33')]));_0x10c011[_0xa8ee('0x32')]=_0x10c011[_0xa8ee('0x32')]['length']?_0x10c011['attributes']:_0x2dcc4b['model'];if(_0x4f34ec['query'][_0xa8ee('0x3d')]){_0x10c011[_0xa8ee('0x3e')]=[{'all':!![]}];}_0x10c011=_['merge']({},_0x10c011,_0x4f34ec[_0xa8ee('0x3c')]);return db[_0xa8ee('0x29')][_0xa8ee('0x43')](_0x10c011)[_0xa8ee('0x22')](handleEntityNotFound(_0x1160ee,null))[_0xa8ee('0x22')](respondWithResult(_0x1160ee,null))[_0xa8ee('0x41')](handleError(_0x1160ee,null));};exports['create']=function(_0x2d753c,_0xf03ff8){return db[_0xa8ee('0x29')][_0xa8ee('0x44')](_0x2d753c[_0xa8ee('0x45')],{})[_0xa8ee('0x22')](respondWithResult(_0xf03ff8,0xc9))[_0xa8ee('0x41')](handleError(_0xf03ff8,null));};exports[_0xa8ee('0x21')]=function(_0xcb019c,_0x16d76c){if(_0xcb019c[_0xa8ee('0x45')]['id']){delete _0xcb019c['body']['id'];}return db[_0xa8ee('0x29')]['find']({'where':{'id':_0xcb019c['params']['id']}})[_0xa8ee('0x22')](handleEntityNotFound(_0x16d76c,null))[_0xa8ee('0x22')](saveUpdates(_0xcb019c[_0xa8ee('0x45')],null))['then'](respondWithResult(_0x16d76c,null))[_0xa8ee('0x41')](handleError(_0x16d76c,null));};exports[_0xa8ee('0x23')]=function(_0x1a73de,_0x560d35){return db[_0xa8ee('0x29')]['find']({'where':{'id':_0x1a73de[_0xa8ee('0x46')]['id']}})[_0xa8ee('0x22')](handleEntityNotFound(_0x560d35,null))[_0xa8ee('0x22')](removeEntity(_0x560d35,null))['catch'](handleError(_0x560d35,null));};exports[_0xa8ee('0x47')]=function(_0xee6f1,_0x95af68,_0x478b41){var _0x468ab3={};var _0x2d1d18={};var _0x53db07;var _0xb70776;return db[_0xa8ee('0x29')]['findOne']({'where':{'id':_0xee6f1[_0xa8ee('0x46')]['id']}})[_0xa8ee('0x22')](handleEntityNotFound(_0x95af68,null))['then'](function(_0x2294de){if(_0x2294de){_0x53db07=_0x2294de;_0x2d1d18[_0xa8ee('0x2d')]=_[_0xa8ee('0x2e')](db[_0xa8ee('0x48')][_0xa8ee('0x2a')]);_0x2d1d18[_0xa8ee('0x2f')]=_[_0xa8ee('0x2e')](_0xee6f1[_0xa8ee('0x2f')]);_0x2d1d18[_0xa8ee('0x30')]=_[_0xa8ee('0x31')](_0x2d1d18[_0xa8ee('0x2d')],_0x2d1d18[_0xa8ee('0x2f')]);_0x468ab3[_0xa8ee('0x32')]=_[_0xa8ee('0x31')](_0x2d1d18[_0xa8ee('0x2d')],qs[_0xa8ee('0x33')](_0xee6f1[_0xa8ee('0x2f')][_0xa8ee('0x33')]));_0x468ab3[_0xa8ee('0x32')]=_0x468ab3['attributes'][_0xa8ee('0x49')]?_0x468ab3[_0xa8ee('0x32')]:_0x2d1d18[_0xa8ee('0x2d')];_0x468ab3[_0xa8ee('0x36')]=qs['sort'](_0xee6f1[_0xa8ee('0x2f')]['sort']);_0x468ab3[_0xa8ee('0x38')]=qs[_0xa8ee('0x30')](_[_0xa8ee('0x4a')](_0xee6f1[_0xa8ee('0x2f')],_0x2d1d18[_0xa8ee('0x30')]));if(_0xee6f1[_0xa8ee('0x2f')][_0xa8ee('0x3a')]){_0x468ab3[_0xa8ee('0x38')]=_[_0xa8ee('0x3b')](_0x468ab3[_0xa8ee('0x38')],{'$or':_[_0xa8ee('0x28')](_0x468ab3['attributes'],function(_0x4df11c){var _0x4835ae={};_0x4835ae[_0x4df11c]={'$like':'%'+_0xee6f1[_0xa8ee('0x2f')][_0xa8ee('0x3a')]+'%'};return _0x4835ae;})});}_0x468ab3=_['merge']({},_0x468ab3,_0xee6f1[_0xa8ee('0x3c')]);return _0x53db07['getConfigurations'](_0x468ab3);}})[_0xa8ee('0x22')](function(_0x67156a){if(_0x67156a){_0xb70776=_0x67156a['length'];if(!_0xee6f1['query'][_0xa8ee('0x34')](_0xa8ee('0x35'))){_0x468ab3['limit']=qs[_0xa8ee('0x1c')](_0xee6f1['query']['limit']);_0x468ab3[_0xa8ee('0x1a')]=qs[_0xa8ee('0x1a')](_0xee6f1[_0xa8ee('0x2f')][_0xa8ee('0x1a')]);}return _0x53db07[_0xa8ee('0x47')](_0x468ab3);}})[_0xa8ee('0x22')](function(_0x33008b){if(_0x33008b){return _0x33008b?{'count':_0xb70776,'rows':_0x33008b}:null;}})[_0xa8ee('0x22')](respondWithResult(_0x95af68,null))['catch'](handleError(_0x95af68,null));};exports[_0xa8ee('0x4b')]=function(_0x18272c,_0x37cf78,_0x49468c){if(_0x18272c[_0xa8ee('0x45')]['id']){delete _0x18272c[_0xa8ee('0x45')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x18272c[_0xa8ee('0x46')]['id']}})[_0xa8ee('0x22')](handleEntityNotFound(_0x37cf78,null))[_0xa8ee('0x22')](function(_0x2686e4){if(_0x2686e4){_0x18272c[_0xa8ee('0x45')][_0xa8ee('0x4c')]=_0x2686e4['id'];_0x18272c[_0xa8ee('0x45')][_0xa8ee('0x4d')]=integrations['getSubjects'](_0x18272c['body']['channel'],_0x18272c['body'][_0xa8ee('0x2c')]);_0x18272c[_0xa8ee('0x45')]['Descriptions']=integrations[_0xa8ee('0x4e')](_0x18272c['body']['channel'],_0x18272c[_0xa8ee('0x45')][_0xa8ee('0x2c')]);return db[_0xa8ee('0x48')][_0xa8ee('0x44')](_0x18272c[_0xa8ee('0x45')],{'include':[{'model':db[_0xa8ee('0x4f')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0xa8ee('0x50')}]});}return null;})[_0xa8ee('0x22')](respondWithResult(_0x37cf78,null))[_0xa8ee('0x41')](handleError(_0x37cf78,null));};exports[_0xa8ee('0x51')]=function(_0x1c230e,_0x5bf63d,_0x1bd1ea){var _0x57df6a='';var _0x2a131a=['id',_0xa8ee('0x25'),_0xa8ee('0x52'),_0xa8ee('0x53'),_0xa8ee('0x54'),'date_start','duration_hours',_0xa8ee('0x55'),_0xa8ee('0x56'),_0xa8ee('0x57'),'parent_name',_0xa8ee('0x58')];return db['SugarcrmAccount'][_0xa8ee('0x59')]({'where':{'id':_0x1c230e[_0xa8ee('0x46')]['id']},'attributes':['id','username',_0xa8ee('0x5a'),_0xa8ee('0x5b')]})['then'](handleEntityNotFound(_0x5bf63d,null))[_0xa8ee('0x22')](function(_0x385cd1){if(_0x385cd1){_0x57df6a=_0x385cd1['remoteUri'];var _0xbbc638=_0x57df6a[_0xa8ee('0x5c')](-0x1);if(_0xbbc638==='/'){_0x57df6a=_0x57df6a[_0xa8ee('0x5d')](0x0,_0x57df6a['lastIndexOf'](_0xbbc638));}return rp({'method':'POST','uri':util[_0xa8ee('0x5e')](_0xa8ee('0x5f'),_0x57df6a,_0xa8ee('0x60')),'json':!![],'form':{'method':_0xa8ee('0x61'),'input_type':_0xa8ee('0x62'),'response_type':_0xa8ee('0x62'),'rest_data':JSON[_0xa8ee('0x63')]({'user_auth':{'user_name':_0x385cd1[_0xa8ee('0x64')],'password':_0x385cd1['password'],'encryption':_0xa8ee('0x65')},'application':_0xa8ee('0x66')})}});}})[_0xa8ee('0x22')](function(_0x4009ef){if(_0x4009ef&&_0x4009ef[_0xa8ee('0x25')]!==_0xa8ee('0x67')&&_0x4009ef[_0xa8ee('0x25')]!==_0xa8ee('0x68')){return rp({'method':_0xa8ee('0x69'),'uri':util['format']('%s%s',_0x57df6a,_0xa8ee('0x60')),'json':!![],'form':{'method':_0xa8ee('0x6a'),'input_type':_0xa8ee('0x62'),'response_type':_0xa8ee('0x62'),'rest_data':JSON['stringify']({'session':_0x4009ef['id'],'module_name':_0xa8ee('0x6b')})}})[_0xa8ee('0x22')](function(_0x277299){if(_0x277299){var _0x405d1a=_[_0xa8ee('0x6c')](_0x277299['module_fields']);_['remove'](_0x405d1a,function(_0x42d765){return _0x2a131a['includes'](_0x42d765[_0xa8ee('0x25')]);});return{'count':_0x405d1a['length'],'rows':_[_0xa8ee('0x28')](_0x405d1a,function(_0x1cb1c8){return{'id':_0x1cb1c8[_0xa8ee('0x25')],'name':_0x1cb1c8[_0xa8ee('0x6d')],'custom':_[_0xa8ee('0x6e')](_0x1cb1c8['name'],'_c')?!![]:![],'options':_0x1cb1c8['options']?_[_0xa8ee('0x28')](_[_0xa8ee('0x6c')](_0x1cb1c8[_0xa8ee('0x3c')]),function(_0x3ff0e4){return{'name':_0x3ff0e4[_0xa8ee('0x6f')],'value':_0x3ff0e4[_0xa8ee('0x25')]};}):[]};})};}})[_0xa8ee('0x22')](respondWithResult(_0x5bf63d,null))[_0xa8ee('0x41')](function(_0x289304){var _0x37e18b=_0x1c230e[_0xa8ee('0x2f')][_0xa8ee('0x70')]?0x1f4:_0x289304['statusCode']||0x1f4;logger['error'](_0xa8ee('0x71'),_0xa8ee('0x51'),_0x37e18b,JSON[_0xa8ee('0x63')](_0x289304));delete _0x289304[_0xa8ee('0x25')];if(_0x37e18b===0x191){_0x37e18b=0x190;}_0x5bf63d[_0xa8ee('0x18')](_0x37e18b)[_0xa8ee('0x26')](_0x1c230e[_0xa8ee('0x2f')][_0xa8ee('0x70')]?{'message':_0xa8ee('0x72'),'statusCode':_0x289304[_0xa8ee('0x73')]}:_0x289304);});}else{var _0xfce930=0x1f4;_0x5bf63d[_0xa8ee('0x18')](_0xfce930)[_0xa8ee('0x26')]({'message':_0xa8ee('0x72'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x619d=['set','Content-Range','apply','reject','save','update','then','error','stack','name','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','map','VIRTUAL','merge','options','SugarcrmAccount','includeAll','include','catch','show','params','length','find','create','body','destroy','getConfigurations','findOne','AccountId','getSubjects','channel','Descriptions','SugarcrmConfiguration','SugarcrmField','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','label','endsWith','getFields,\x20%s,\x20%s,\x20%s','getFields','send','test','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset'];(function(_0x48e6ec,_0x5bb7f4){var _0x62289c=function(_0x8a4e56){while(--_0x8a4e56){_0x48e6ec['push'](_0x48e6ec['shift']());}};_0x62289c(++_0x5bb7f4);}(_0x619d,0x13d));var _0xd619=function(_0x13bf9c,_0x3ca949){_0x13bf9c=_0x13bf9c-0x0;var _0x1c52e2=_0x619d[_0x13bf9c];return _0x1c52e2;};'use strict';var emlformat=require(_0xd619('0x0'));var rimraf=require(_0xd619('0x1'));var zipdir=require(_0xd619('0x2'));var jsonpatch=require(_0xd619('0x3'));var rp=require(_0xd619('0x4'));var moment=require(_0xd619('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd619('0x6'));var path=require(_0xd619('0x7'));var sox=require(_0xd619('0x8'));var csv=require(_0xd619('0x9'));var ejs=require(_0xd619('0xa'));var fs=require('fs');var fs_extra=require(_0xd619('0xb'));var _=require(_0xd619('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd619('0xd'));var deskjs=require(_0xd619('0xe'));var toCsv=require(_0xd619('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd619('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd619('0x10'));var hardwareService=require(_0xd619('0x11'));var logger=require('../../config/logger')(_0xd619('0x12'));var utils=require('../../config/utils');var config=require(_0xd619('0x13'));var licenseUtil=require(_0xd619('0x14'));var db=require(_0xd619('0x15'))['db'];var integrations=require(_0xd619('0x16'));function respondWithStatusCode(_0x525f59,_0x33d6fa){_0x33d6fa=_0x33d6fa||0xcc;return function(_0x1c39ac){if(_0x1c39ac){return _0x525f59[_0xd619('0x17')](_0x33d6fa);}return _0x525f59['status'](_0x33d6fa)[_0xd619('0x18')]();};}function respondWithResult(_0xfa3eb5,_0x54a667){_0x54a667=_0x54a667||0xc8;return function(_0x783387){if(_0x783387){return _0xfa3eb5[_0xd619('0x19')](_0x54a667)[_0xd619('0x1a')](_0x783387);}};}function respondWithFilteredResult(_0x3d44d1,_0x2d8788){return function(_0x3fde37){if(_0x3fde37){var _0x110fd1=typeof _0x2d8788['offset']===_0xd619('0x1b')&&typeof _0x2d8788[_0xd619('0x1c')]===_0xd619('0x1b');var _0x38ed74=_0x3fde37[_0xd619('0x1d')];var _0x3bcd94=_0x110fd1?0x0:_0x2d8788[_0xd619('0x1e')];var _0x595fff=_0x110fd1?_0x3fde37['count']:_0x2d8788[_0xd619('0x1e')]+_0x2d8788[_0xd619('0x1c')];var _0x114b2a;if(_0x595fff>=_0x38ed74){_0x595fff=_0x38ed74;_0x114b2a=0xc8;}else{_0x114b2a=0xce;}_0x3d44d1[_0xd619('0x19')](_0x114b2a);return _0x3d44d1[_0xd619('0x1f')](_0xd619('0x20'),_0x3bcd94+'-'+_0x595fff+'/'+_0x38ed74)[_0xd619('0x1a')](_0x3fde37);}return null;};}function patchUpdates(_0x325a7e){return function(_0x462187){try{jsonpatch[_0xd619('0x21')](_0x462187,_0x325a7e,!![]);}catch(_0x17e74d){return BPromise[_0xd619('0x22')](_0x17e74d);}return _0x462187[_0xd619('0x23')]();};}function saveUpdates(_0x1a3198,_0x89dfb0){return function(_0x254b65){if(_0x254b65){return _0x254b65[_0xd619('0x24')](_0x1a3198)[_0xd619('0x25')](function(_0x18acaf){return _0x18acaf;});}return null;};}function removeEntity(_0x197d8c,_0x46c6cf){return function(_0x26ef36){if(_0x26ef36){return _0x26ef36['destroy']()[_0xd619('0x25')](function(){_0x197d8c[_0xd619('0x19')](0xcc)[_0xd619('0x18')]();});}};}function handleEntityNotFound(_0x214531,_0x2b0d6e){return function(_0x59298a){if(!_0x59298a){_0x214531[_0xd619('0x17')](0x194);}return _0x59298a;};}function handleError(_0x16aae5,_0x3d471d){_0x3d471d=_0x3d471d||0x1f4;return function(_0x4947ca){logger[_0xd619('0x26')](_0x4947ca[_0xd619('0x27')]);if(_0x4947ca[_0xd619('0x28')]){delete _0x4947ca[_0xd619('0x28')];}_0x16aae5[_0xd619('0x19')](_0x3d471d)['send'](_0x4947ca);};}exports['index']=function(_0x25b1ad,_0x2ac0ce){var _0x25b095={},_0x339e01={},_0x16fde1={'count':0x0,'rows':[]};var _0x570576=_['map'](db['SugarcrmAccount'][_0xd619('0x29')],function(_0x145c97){return{'name':_0x145c97[_0xd619('0x2a')],'type':_0x145c97[_0xd619('0x2b')]['key']};});_0x339e01[_0xd619('0x2c')]=_['map'](_0x570576,_0xd619('0x28'));_0x339e01['query']=_[_0xd619('0x2d')](_0x25b1ad[_0xd619('0x2e')]);_0x339e01[_0xd619('0x2f')]=_[_0xd619('0x30')](_0x339e01[_0xd619('0x2c')],_0x339e01[_0xd619('0x2e')]);_0x25b095['attributes']=_[_0xd619('0x30')](_0x339e01[_0xd619('0x2c')],qs[_0xd619('0x31')](_0x25b1ad[_0xd619('0x2e')]['fields']));_0x25b095[_0xd619('0x32')]=_0x25b095['attributes']['length']?_0x25b095[_0xd619('0x32')]:_0x339e01[_0xd619('0x2c')];if(!_0x25b1ad[_0xd619('0x2e')][_0xd619('0x33')](_0xd619('0x34'))){_0x25b095[_0xd619('0x1c')]=qs[_0xd619('0x1c')](_0x25b1ad[_0xd619('0x2e')][_0xd619('0x1c')]);_0x25b095[_0xd619('0x1e')]=qs[_0xd619('0x1e')](_0x25b1ad[_0xd619('0x2e')]['offset']);}_0x25b095['order']=qs[_0xd619('0x35')](_0x25b1ad[_0xd619('0x2e')][_0xd619('0x35')]);_0x25b095['where']=qs[_0xd619('0x2f')](_[_0xd619('0x36')](_0x25b1ad[_0xd619('0x2e')],_0x339e01['filters']),_0x570576);if(_0x25b1ad[_0xd619('0x2e')][_0xd619('0x37')]){_0x25b095[_0xd619('0x38')]=_['merge'](_0x25b095[_0xd619('0x38')],{'$or':_[_0xd619('0x39')](_0x570576,function(_0x32896f){if(_0x32896f[_0xd619('0x2b')]!==_0xd619('0x3a')){var _0x927ad3={};_0x927ad3[_0x32896f[_0xd619('0x28')]]={'$like':'%'+_0x25b1ad[_0xd619('0x2e')][_0xd619('0x37')]+'%'};return _0x927ad3;}})});}_0x25b095=_[_0xd619('0x3b')]({},_0x25b095,_0x25b1ad[_0xd619('0x3c')]);var _0x1fffc6={'where':_0x25b095[_0xd619('0x38')]};return db[_0xd619('0x3d')][_0xd619('0x1d')](_0x1fffc6)['then'](function(_0x555136){_0x16fde1[_0xd619('0x1d')]=_0x555136;if(_0x25b1ad[_0xd619('0x2e')][_0xd619('0x3e')]){_0x25b095[_0xd619('0x3f')]=[{'all':!![]}];}return db[_0xd619('0x3d')]['findAll'](_0x25b095);})['then'](function(_0x450a6f){_0x16fde1['rows']=_0x450a6f;return _0x16fde1;})[_0xd619('0x25')](respondWithFilteredResult(_0x2ac0ce,_0x25b095))[_0xd619('0x40')](handleError(_0x2ac0ce,null));};exports[_0xd619('0x41')]=function(_0x26e7a3,_0x75a850){var _0x2b0cc2={'raw':![],'where':{'id':_0x26e7a3[_0xd619('0x42')]['id']}},_0x73d3f1={};_0x73d3f1[_0xd619('0x2c')]=_['keys'](db[_0xd619('0x3d')]['rawAttributes']);_0x73d3f1['query']=_[_0xd619('0x2d')](_0x26e7a3[_0xd619('0x2e')]);_0x73d3f1[_0xd619('0x2f')]=_[_0xd619('0x30')](_0x73d3f1[_0xd619('0x2c')],_0x73d3f1[_0xd619('0x2e')]);_0x2b0cc2[_0xd619('0x32')]=_['intersection'](_0x73d3f1[_0xd619('0x2c')],qs[_0xd619('0x31')](_0x26e7a3[_0xd619('0x2e')][_0xd619('0x31')]));_0x2b0cc2[_0xd619('0x32')]=_0x2b0cc2[_0xd619('0x32')][_0xd619('0x43')]?_0x2b0cc2[_0xd619('0x32')]:_0x73d3f1['model'];if(_0x26e7a3[_0xd619('0x2e')][_0xd619('0x3e')]){_0x2b0cc2[_0xd619('0x3f')]=[{'all':!![]}];}_0x2b0cc2=_[_0xd619('0x3b')]({},_0x2b0cc2,_0x26e7a3['options']);return db[_0xd619('0x3d')][_0xd619('0x44')](_0x2b0cc2)[_0xd619('0x25')](handleEntityNotFound(_0x75a850,null))[_0xd619('0x25')](respondWithResult(_0x75a850,null))[_0xd619('0x40')](handleError(_0x75a850,null));};exports[_0xd619('0x45')]=function(_0xed0793,_0x593713){return db[_0xd619('0x3d')][_0xd619('0x45')](_0xed0793[_0xd619('0x46')],{})[_0xd619('0x25')](respondWithResult(_0x593713,0xc9))[_0xd619('0x40')](handleError(_0x593713,null));};exports[_0xd619('0x24')]=function(_0x531dd2,_0xb8250c){if(_0x531dd2[_0xd619('0x46')]['id']){delete _0x531dd2[_0xd619('0x46')]['id'];}return db[_0xd619('0x3d')][_0xd619('0x44')]({'where':{'id':_0x531dd2['params']['id']}})[_0xd619('0x25')](handleEntityNotFound(_0xb8250c,null))[_0xd619('0x25')](saveUpdates(_0x531dd2['body'],null))[_0xd619('0x25')](respondWithResult(_0xb8250c,null))[_0xd619('0x40')](handleError(_0xb8250c,null));};exports[_0xd619('0x47')]=function(_0x52d920,_0x13eae2){return db[_0xd619('0x3d')][_0xd619('0x44')]({'where':{'id':_0x52d920[_0xd619('0x42')]['id']}})[_0xd619('0x25')](handleEntityNotFound(_0x13eae2,null))[_0xd619('0x25')](removeEntity(_0x13eae2,null))[_0xd619('0x40')](handleError(_0x13eae2,null));};exports[_0xd619('0x48')]=function(_0x5ca106,_0x44cfc3,_0x285e24){var _0x528cf2={};var _0x343fc9={};var _0x226c3c;var _0x590023;return db[_0xd619('0x3d')][_0xd619('0x49')]({'where':{'id':_0x5ca106[_0xd619('0x42')]['id']}})[_0xd619('0x25')](handleEntityNotFound(_0x44cfc3,null))[_0xd619('0x25')](function(_0x15494c){if(_0x15494c){_0x226c3c=_0x15494c;_0x343fc9['model']=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0x343fc9[_0xd619('0x2e')]=_[_0xd619('0x2d')](_0x5ca106[_0xd619('0x2e')]);_0x343fc9[_0xd619('0x2f')]=_[_0xd619('0x30')](_0x343fc9[_0xd619('0x2c')],_0x343fc9[_0xd619('0x2e')]);_0x528cf2[_0xd619('0x32')]=_[_0xd619('0x30')](_0x343fc9[_0xd619('0x2c')],qs[_0xd619('0x31')](_0x5ca106[_0xd619('0x2e')][_0xd619('0x31')]));_0x528cf2[_0xd619('0x32')]=_0x528cf2[_0xd619('0x32')][_0xd619('0x43')]?_0x528cf2[_0xd619('0x32')]:_0x343fc9[_0xd619('0x2c')];_0x528cf2['order']=qs[_0xd619('0x35')](_0x5ca106[_0xd619('0x2e')]['sort']);_0x528cf2[_0xd619('0x38')]=qs[_0xd619('0x2f')](_['pick'](_0x5ca106['query'],_0x343fc9[_0xd619('0x2f')]));if(_0x5ca106[_0xd619('0x2e')]['filter']){_0x528cf2[_0xd619('0x38')]=_[_0xd619('0x3b')](_0x528cf2[_0xd619('0x38')],{'$or':_[_0xd619('0x39')](_0x528cf2[_0xd619('0x32')],function(_0x5c07ad){var _0x356fc6={};_0x356fc6[_0x5c07ad]={'$like':'%'+_0x5ca106['query'][_0xd619('0x37')]+'%'};return _0x356fc6;})});}_0x528cf2=_[_0xd619('0x3b')]({},_0x528cf2,_0x5ca106['options']);return _0x226c3c[_0xd619('0x48')](_0x528cf2);}})[_0xd619('0x25')](function(_0x360914){if(_0x360914){_0x590023=_0x360914[_0xd619('0x43')];if(!_0x5ca106[_0xd619('0x2e')][_0xd619('0x33')](_0xd619('0x34'))){_0x528cf2['limit']=qs[_0xd619('0x1c')](_0x5ca106[_0xd619('0x2e')][_0xd619('0x1c')]);_0x528cf2[_0xd619('0x1e')]=qs[_0xd619('0x1e')](_0x5ca106['query']['offset']);}return _0x226c3c['getConfigurations'](_0x528cf2);}})[_0xd619('0x25')](function(_0x16d610){if(_0x16d610){return _0x16d610?{'count':_0x590023,'rows':_0x16d610}:null;}})[_0xd619('0x25')](respondWithResult(_0x44cfc3,null))[_0xd619('0x40')](handleError(_0x44cfc3,null));};exports['addConfiguration']=function(_0x417bd8,_0x200e7e,_0x42262f){if(_0x417bd8[_0xd619('0x46')]['id']){delete _0x417bd8[_0xd619('0x46')]['id'];}return db[_0xd619('0x3d')]['findOne']({'where':{'id':_0x417bd8['params']['id']}})[_0xd619('0x25')](handleEntityNotFound(_0x200e7e,null))[_0xd619('0x25')](function(_0x37dac0){if(_0x37dac0){_0x417bd8['body'][_0xd619('0x4a')]=_0x37dac0['id'];_0x417bd8[_0xd619('0x46')]['Subjects']=integrations[_0xd619('0x4b')](_0x417bd8[_0xd619('0x46')][_0xd619('0x4c')],_0x417bd8[_0xd619('0x46')][_0xd619('0x2b')]);_0x417bd8[_0xd619('0x46')][_0xd619('0x4d')]=integrations['getDescriptions'](_0x417bd8['body'][_0xd619('0x4c')],_0x417bd8['body'][_0xd619('0x2b')]);return db[_0xd619('0x4e')][_0xd619('0x45')](_0x417bd8['body'],{'include':[{'model':db[_0xd619('0x4f')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0xd619('0x25')](respondWithResult(_0x200e7e,null))[_0xd619('0x40')](handleError(_0x200e7e,null));};exports['getFields']=function(_0x558e80,_0x1fe9b3,_0x5a9799){var _0x5f8367='';var _0x7aae0=['id',_0xd619('0x28'),_0xd619('0x50'),'created_by',_0xd619('0x51'),_0xd619('0x52'),_0xd619('0x53'),_0xd619('0x54'),_0xd619('0x55'),_0xd619('0x56'),_0xd619('0x57'),_0xd619('0x58')];return db['SugarcrmAccount'][_0xd619('0x49')]({'where':{'id':_0x558e80['params']['id']},'attributes':['id','username',_0xd619('0x59'),_0xd619('0x5a')]})[_0xd619('0x25')](handleEntityNotFound(_0x1fe9b3,null))[_0xd619('0x25')](function(_0x3a5b6f){if(_0x3a5b6f){_0x5f8367=_0x3a5b6f[_0xd619('0x5a')];var _0x11ba92=_0x5f8367[_0xd619('0x5b')](-0x1);if(_0x11ba92==='/'){_0x5f8367=_0x5f8367[_0xd619('0x5c')](0x0,_0x5f8367['lastIndexOf'](_0x11ba92));}return rp({'method':_0xd619('0x5d'),'uri':util[_0xd619('0x5e')](_0xd619('0x5f'),_0x5f8367,_0xd619('0x60')),'json':!![],'form':{'method':_0xd619('0x61'),'input_type':_0xd619('0x62'),'response_type':'JSON','rest_data':JSON[_0xd619('0x63')]({'user_auth':{'user_name':_0x3a5b6f[_0xd619('0x64')],'password':_0x3a5b6f['password'],'encryption':_0xd619('0x65')},'application':_0xd619('0x66')})}});}})['then'](function(_0x5aed35){if(_0x5aed35&&_0x5aed35[_0xd619('0x28')]!==_0xd619('0x67')&&_0x5aed35[_0xd619('0x28')]!==_0xd619('0x68')){return rp({'method':_0xd619('0x5d'),'uri':util[_0xd619('0x5e')]('%s%s',_0x5f8367,_0xd619('0x60')),'json':!![],'form':{'method':_0xd619('0x69'),'input_type':_0xd619('0x62'),'response_type':_0xd619('0x62'),'rest_data':JSON[_0xd619('0x63')]({'session':_0x5aed35['id'],'module_name':_0xd619('0x6a')})}})[_0xd619('0x25')](function(_0x188da2){if(_0x188da2){var _0x316a1f=_[_0xd619('0x6b')](_0x188da2[_0xd619('0x6c')]);_['remove'](_0x316a1f,function(_0x56377a){return _0x7aae0['includes'](_0x56377a[_0xd619('0x28')]);});return{'count':_0x316a1f['length'],'rows':_[_0xd619('0x39')](_0x316a1f,function(_0x376be8){return{'id':_0x376be8[_0xd619('0x28')],'name':_0x376be8[_0xd619('0x6d')],'custom':_[_0xd619('0x6e')](_0x376be8['name'],'_c')?!![]:![],'options':_0x376be8[_0xd619('0x3c')]?_[_0xd619('0x39')](_[_0xd619('0x6b')](_0x376be8[_0xd619('0x3c')]),function(_0x4ff5ec){return{'name':_0x4ff5ec['value'],'value':_0x4ff5ec[_0xd619('0x28')]};}):[]};})};}})[_0xd619('0x25')](respondWithResult(_0x1fe9b3,null))[_0xd619('0x40')](function(_0x15aab4){var _0x1a73a4=_0x558e80[_0xd619('0x2e')]['test']?0x1f4:_0x15aab4['statusCode']||0x1f4;logger[_0xd619('0x26')](_0xd619('0x6f'),_0xd619('0x70'),_0x1a73a4,JSON[_0xd619('0x63')](_0x15aab4));delete _0x15aab4['name'];if(_0x1a73a4===0x191){_0x1a73a4=0x190;}_0x1fe9b3[_0xd619('0x19')](_0x1a73a4)[_0xd619('0x71')](_0x558e80[_0xd619('0x2e')][_0xd619('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x15aab4[_0xd619('0x73')]}:_0x15aab4);});}else{var _0x377abe=0x1f4;_0x1fe9b3[_0xd619('0x19')](_0x377abe)[_0xd619('0x71')]({'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 cfa0a0d..b224d43 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 _0xbfeb=['define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x35a62d,_0x2fc11c){var _0x37b401=function(_0x195195){while(--_0x195195){_0x35a62d['push'](_0x35a62d['shift']());}};_0x37b401(++_0x2fc11c);}(_0xbfeb,0x1c3));var _0xbbfe=function(_0x55ded6,_0xb21985){_0x55ded6=_0x55ded6-0x0;var _0x357f3d=_0xbfeb[_0x55ded6];return _0x357f3d;};'use strict';var _=require('lodash');var util=require(_0xbbfe('0x0'));var logger=require(_0xbbfe('0x1'))(_0xbbfe('0x2'));var moment=require(_0xbbfe('0x3'));var BPromise=require('bluebird');var rp=require(_0xbbfe('0x4'));var fs=require('fs');var path=require(_0xbbfe('0x5'));var rimraf=require(_0xbbfe('0x6'));var config=require(_0xbbfe('0x7'));var attributes=require(_0xbbfe('0x8'));var integrations=require(_0xbbfe('0x9'));module[_0xbbfe('0xa')]=function(_0x18db08,_0x32600e){return _0x18db08[_0xbbfe('0xb')](_0xbbfe('0xc'),attributes,{'tableName':_0xbbfe('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bcf=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','api','bluebird','request-promise'];(function(_0x5ca965,_0x494dba){var _0x2361b6=function(_0x29f6ba){while(--_0x29f6ba){_0x5ca965['push'](_0x5ca965['shift']());}};_0x2361b6(++_0x494dba);}(_0x4bcf,0x177));var _0xf4bc=function(_0xf38ca5,_0x31986f){_0xf38ca5=_0xf38ca5-0x0;var _0x2c07c7=_0x4bcf[_0xf38ca5];return _0x2c07c7;};'use strict';var _=require(_0xf4bc('0x0'));var util=require(_0xf4bc('0x1'));var logger=require('../../config/logger')(_0xf4bc('0x2'));var moment=require('moment');var BPromise=require(_0xf4bc('0x3'));var rp=require(_0xf4bc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf4bc('0x5'));var integrations=require(_0xf4bc('0x6'));module[_0xf4bc('0x7')]=function(_0x220411,_0x2f871f){return _0x220411[_0xf4bc('0x8')]('SugarcrmAccount',attributes,{'tableName':_0xf4bc('0x9'),'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 1a28658..d7dd37c 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 _0xf912=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSugarcrmAccount','findAll','options','raw','attributes','map','include','model','ShowSugarcrmAccount','SugarcrmAccount','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3ba603,_0x58cb58){var _0x1afc1a=function(_0x2b6b9a){while(--_0x2b6b9a){_0x3ba603['push'](_0x3ba603['shift']());}};_0x1afc1a(++_0x58cb58);}(_0xf912,0x112));var _0x2f91=function(_0x4f7449,_0x407356){_0x4f7449=_0x4f7449-0x0;var _0x21e3cb=_0xf912[_0x4f7449];return _0x21e3cb;};'use strict';var _=require(_0x2f91('0x0'));var util=require(_0x2f91('0x1'));var moment=require(_0x2f91('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f91('0x3'));var fs=require('fs');var Redis=require(_0x2f91('0x4'));var db=require(_0x2f91('0x5'))['db'];var utils=require(_0x2f91('0x6'));var logger=require(_0x2f91('0x7'))(_0x2f91('0x8'));var config=require(_0x2f91('0x9'));var jayson=require(_0x2f91('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11795d,_0x3bb3e4,_0x17257d){return new BPromise(function(_0x1d9a90,_0x552466){return client[_0x2f91('0xb')](_0x11795d,_0x17257d)[_0x2f91('0xc')](function(_0x780aaa){logger[_0x2f91('0xd')](_0x2f91('0xe'),_0x3bb3e4,_0x2f91('0xf'));logger[_0x2f91('0x10')](_0x2f91('0x11'),_0x3bb3e4,_0x2f91('0xf'),JSON[_0x2f91('0x12')](_0x780aaa));if(_0x780aaa[_0x2f91('0x13')]){if(_0x780aaa[_0x2f91('0x13')][_0x2f91('0x14')]===0x1f4){logger[_0x2f91('0x13')](_0x2f91('0xe'),_0x3bb3e4,_0x780aaa[_0x2f91('0x13')][_0x2f91('0x15')]);return _0x552466(_0x780aaa['error'][_0x2f91('0x15')]);}logger[_0x2f91('0x13')](_0x2f91('0xe'),_0x3bb3e4,_0x780aaa['error']['message']);return _0x1d9a90(_0x780aaa[_0x2f91('0x13')][_0x2f91('0x15')]);}else{logger['info'](_0x2f91('0xe'),_0x3bb3e4,_0x2f91('0xf'));_0x1d9a90(_0x780aaa['result'][_0x2f91('0x15')]);}})[_0x2f91('0x16')](function(_0x1633a3){logger[_0x2f91('0x13')](_0x2f91('0xe'),_0x3bb3e4,_0x1633a3);_0x552466(_0x1633a3);});});}exports[_0x2f91('0x17')]=function(_0x3a2b7c){var _0x2cdfd3=this;return new Promise(function(_0x465cc0,_0x579511){return db['SugarcrmAccount'][_0x2f91('0x18')]({'raw':_0x3a2b7c[_0x2f91('0x19')]?_0x3a2b7c[_0x2f91('0x19')][_0x2f91('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a2b7c['options']?_0x3a2b7c['options']['where']||null:null,'attributes':_0x3a2b7c[_0x2f91('0x19')]?_0x3a2b7c[_0x2f91('0x19')][_0x2f91('0x1b')]||null:null,'limit':_0x3a2b7c[_0x2f91('0x19')]?_0x3a2b7c['options']['limit']||null:null,'include':_0x3a2b7c[_0x2f91('0x19')]?_0x3a2b7c['options']['include']?_[_0x2f91('0x1c')](_0x3a2b7c['options'][_0x2f91('0x1d')],function(_0x3b9bf1){return{'model':db[_0x3b9bf1['model']],'as':_0x3b9bf1['as'],'attributes':_0x3b9bf1[_0x2f91('0x1b')],'include':_0x3b9bf1[_0x2f91('0x1d')]?_[_0x2f91('0x1c')](_0x3b9bf1['include'],function(_0x1f48c3){return{'model':db[_0x1f48c3['model']],'as':_0x1f48c3['as'],'attributes':_0x1f48c3['attributes'],'include':_0x1f48c3[_0x2f91('0x1d')]?_['map'](_0x1f48c3['include'],function(_0x511412){return{'model':db[_0x511412[_0x2f91('0x1e')]],'as':_0x511412['as'],'attributes':_0x511412[_0x2f91('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2f91('0xc')](function(_0x5ac1e7){logger[_0x2f91('0xd')](_0x2f91('0x17'),_0x3a2b7c);logger['debug'](_0x2f91('0x17'),_0x3a2b7c,JSON[_0x2f91('0x12')](_0x5ac1e7));_0x465cc0(_0x5ac1e7);})[_0x2f91('0x16')](function(_0x15fce7){logger[_0x2f91('0x13')]('GetSugarcrmAccount',_0x15fce7[_0x2f91('0x15')],_0x3a2b7c);_0x579511(_0x2cdfd3[_0x2f91('0x13')](0x1f4,_0x15fce7[_0x2f91('0x15')]));});});};exports[_0x2f91('0x1f')]=function(_0x15859d){var _0x51e2b4=this;return new Promise(function(_0x3b837b,_0x1bc6da){return db[_0x2f91('0x20')][_0x2f91('0x21')]({'raw':_0x15859d['options']?_0x15859d['options']['raw']===undefined?!![]:![]:!![],'where':_0x15859d['options']?_0x15859d['options'][_0x2f91('0x22')]||null:null,'attributes':_0x15859d[_0x2f91('0x19')]?_0x15859d[_0x2f91('0x19')][_0x2f91('0x1b')]||null:null,'include':_0x15859d[_0x2f91('0x19')]?_0x15859d[_0x2f91('0x19')]['include']?_[_0x2f91('0x1c')](_0x15859d[_0x2f91('0x19')][_0x2f91('0x1d')],function(_0x3735f7){return{'model':db[_0x3735f7[_0x2f91('0x1e')]],'as':_0x3735f7['as'],'attributes':_0x3735f7['attributes'],'include':_0x3735f7[_0x2f91('0x1d')]?_[_0x2f91('0x1c')](_0x3735f7[_0x2f91('0x1d')],function(_0x1e4c91){return{'model':db[_0x1e4c91[_0x2f91('0x1e')]],'as':_0x1e4c91['as'],'attributes':_0x1e4c91[_0x2f91('0x1b')],'include':_0x1e4c91[_0x2f91('0x1d')]?_[_0x2f91('0x1c')](_0x1e4c91[_0x2f91('0x1d')],function(_0x500722){return{'model':db[_0x500722[_0x2f91('0x1e')]],'as':_0x500722['as'],'attributes':_0x500722[_0x2f91('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2f91('0xc')](function(_0x5cc2e6){logger[_0x2f91('0xd')](_0x2f91('0x1f'),_0x15859d);logger['debug'](_0x2f91('0x1f'),_0x15859d,JSON[_0x2f91('0x12')](_0x5cc2e6));_0x3b837b(_0x5cc2e6);})[_0x2f91('0x16')](function(_0x23eb30){logger[_0x2f91('0x13')](_0x2f91('0x1f'),_0x23eb30['message'],_0x15859d);_0x1bc6da(_0x51e2b4[_0x2f91('0x13')](0x1f4,_0x23eb30[_0x2f91('0x15')]));});});}; \ No newline at end of file +var _0x51f7=['info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowSugarcrmAccount','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x51f7,0x180));var _0x751f=function(_0x2638d0,_0x52f653){_0x2638d0=_0x2638d0-0x0;var _0x411a60=_0x51f7[_0x2638d0];return _0x411a60;};'use strict';var _=require(_0x751f('0x0'));var util=require(_0x751f('0x1'));var moment=require(_0x751f('0x2'));var BPromise=require(_0x751f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x751f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x751f('0x5'))(_0x751f('0x6'));var config=require(_0x751f('0x7'));var jayson=require(_0x751f('0x8'));var client=jayson[_0x751f('0x9')][_0x751f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11b52a,_0x4acf0b,_0x475a97){return new BPromise(function(_0x53bd1f,_0x486db1){return client[_0x751f('0xb')](_0x11b52a,_0x475a97)['then'](function(_0x16af49){logger[_0x751f('0xc')](_0x751f('0xd'),_0x4acf0b,_0x751f('0xe'));logger[_0x751f('0xf')](_0x751f('0x10'),_0x4acf0b,_0x751f('0xe'),JSON[_0x751f('0x11')](_0x16af49));if(_0x16af49[_0x751f('0x12')]){if(_0x16af49[_0x751f('0x12')][_0x751f('0x13')]===0x1f4){logger[_0x751f('0x12')](_0x751f('0xd'),_0x4acf0b,_0x16af49[_0x751f('0x12')]['message']);return _0x486db1(_0x16af49[_0x751f('0x12')][_0x751f('0x14')]);}logger[_0x751f('0x12')](_0x751f('0xd'),_0x4acf0b,_0x16af49[_0x751f('0x12')][_0x751f('0x14')]);return _0x53bd1f(_0x16af49[_0x751f('0x12')][_0x751f('0x14')]);}else{logger[_0x751f('0xc')](_0x751f('0xd'),_0x4acf0b,_0x751f('0xe'));_0x53bd1f(_0x16af49[_0x751f('0x15')][_0x751f('0x14')]);}})[_0x751f('0x16')](function(_0x55ee10){logger[_0x751f('0x12')](_0x751f('0xd'),_0x4acf0b,_0x55ee10);_0x486db1(_0x55ee10);});});}exports[_0x751f('0x17')]=function(_0x173167){var _0x5d27c7=this;return new Promise(function(_0x15348d,_0x3fa842){return db[_0x751f('0x18')][_0x751f('0x19')]({'raw':_0x173167[_0x751f('0x1a')]?_0x173167[_0x751f('0x1a')][_0x751f('0x1b')]===undefined?!![]:![]:!![],'where':_0x173167['options']?_0x173167[_0x751f('0x1a')][_0x751f('0x1c')]||null:null,'attributes':_0x173167['options']?_0x173167['options'][_0x751f('0x1d')]||null:null,'limit':_0x173167[_0x751f('0x1a')]?_0x173167[_0x751f('0x1a')][_0x751f('0x1e')]||null:null,'include':_0x173167['options']?_0x173167['options']['include']?_[_0x751f('0x1f')](_0x173167[_0x751f('0x1a')][_0x751f('0x20')],function(_0x331f88){return{'model':db[_0x331f88['model']],'as':_0x331f88['as'],'attributes':_0x331f88[_0x751f('0x1d')],'include':_0x331f88[_0x751f('0x20')]?_[_0x751f('0x1f')](_0x331f88[_0x751f('0x20')],function(_0x523915){return{'model':db[_0x523915[_0x751f('0x21')]],'as':_0x523915['as'],'attributes':_0x523915[_0x751f('0x1d')],'include':_0x523915[_0x751f('0x20')]?_['map'](_0x523915['include'],function(_0x2ecc9f){return{'model':db[_0x2ecc9f[_0x751f('0x21')]],'as':_0x2ecc9f['as'],'attributes':_0x2ecc9f[_0x751f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x751f('0x22')](function(_0x4c78a0){logger[_0x751f('0xc')]('GetSugarcrmAccount',_0x173167);logger[_0x751f('0xf')](_0x751f('0x17'),_0x173167,JSON['stringify'](_0x4c78a0));_0x15348d(_0x4c78a0);})[_0x751f('0x16')](function(_0x1b62eb){logger[_0x751f('0x12')](_0x751f('0x17'),_0x1b62eb['message'],_0x173167);_0x3fa842(_0x5d27c7[_0x751f('0x12')](0x1f4,_0x1b62eb[_0x751f('0x14')]));});});};exports[_0x751f('0x23')]=function(_0x2ae972){var _0x587c2b=this;return new Promise(function(_0x37979c,_0x267711){return db['SugarcrmAccount']['find']({'raw':_0x2ae972[_0x751f('0x1a')]?_0x2ae972[_0x751f('0x1a')][_0x751f('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ae972[_0x751f('0x1a')]?_0x2ae972[_0x751f('0x1a')][_0x751f('0x1c')]||null:null,'attributes':_0x2ae972[_0x751f('0x1a')]?_0x2ae972[_0x751f('0x1a')][_0x751f('0x1d')]||null:null,'include':_0x2ae972[_0x751f('0x1a')]?_0x2ae972[_0x751f('0x1a')][_0x751f('0x20')]?_[_0x751f('0x1f')](_0x2ae972[_0x751f('0x1a')]['include'],function(_0x58b928){return{'model':db[_0x58b928[_0x751f('0x21')]],'as':_0x58b928['as'],'attributes':_0x58b928[_0x751f('0x1d')],'include':_0x58b928[_0x751f('0x20')]?_[_0x751f('0x1f')](_0x58b928[_0x751f('0x20')],function(_0x589aac){return{'model':db[_0x589aac[_0x751f('0x21')]],'as':_0x589aac['as'],'attributes':_0x589aac[_0x751f('0x1d')],'include':_0x589aac[_0x751f('0x20')]?_[_0x751f('0x1f')](_0x589aac[_0x751f('0x20')],function(_0x398c08){return{'model':db[_0x398c08['model']],'as':_0x398c08['as'],'attributes':_0x398c08[_0x751f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x427bae){logger[_0x751f('0xc')](_0x751f('0x23'),_0x2ae972);logger[_0x751f('0xf')]('ShowSugarcrmAccount',_0x2ae972,JSON[_0x751f('0x11')](_0x427bae));_0x37979c(_0x427bae);})[_0x751f('0x16')](function(_0x403b19){logger[_0x751f('0x12')](_0x751f('0x23'),_0x403b19[_0x751f('0x14')],_0x2ae972);_0x267711(_0x587c2b['error'](0x1f4,_0x403b19['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index d4a9580..9d4a224 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 _0x8b26=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','multer','util','path','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8b26,0x1f3));var _0x68b2=function(_0x355c42,_0x9e37fb){_0x355c42=_0x355c42-0x0;var _0x5795f6=_0x8b26[_0x355c42];return _0x5795f6;};'use strict';var multer=require(_0x68b2('0x0'));var util=require(_0x68b2('0x1'));var path=require(_0x68b2('0x2'));var timeout=require('connect-timeout');var express=require(_0x68b2('0x3'));var router=express[_0x68b2('0x4')]();var fs_extra=require(_0x68b2('0x5'));var auth=require(_0x68b2('0x6'));var interaction=require(_0x68b2('0x7'));var config=require(_0x68b2('0x8'));var controller=require(_0x68b2('0x9'));router[_0x68b2('0xa')]('/',auth[_0x68b2('0xb')](),controller[_0x68b2('0xc')]);router['get'](_0x68b2('0xd'),auth[_0x68b2('0xb')](),controller[_0x68b2('0xe')]);router[_0x68b2('0xa')]('/:id/fields',auth[_0x68b2('0xb')](),controller['getFields']);router['get'](_0x68b2('0xf'),auth[_0x68b2('0xb')](),controller[_0x68b2('0x10')]);router['get'](_0x68b2('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x68b2('0x12')]('/',auth[_0x68b2('0xb')](),controller[_0x68b2('0x13')]);router[_0x68b2('0x14')](_0x68b2('0xd'),auth[_0x68b2('0xb')](),controller[_0x68b2('0x15')]);router[_0x68b2('0x16')](_0x68b2('0xd'),auth[_0x68b2('0xb')](),controller[_0x68b2('0x17')]);module['exports']=router; \ No newline at end of file +var _0xc2a1=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer'];(function(_0xc05ec0,_0x451305){var _0x14d077=function(_0x490ff0){while(--_0x490ff0){_0xc05ec0['push'](_0xc05ec0['shift']());}};_0x14d077(++_0x451305);}(_0xc2a1,0x176));var _0x1c2a=function(_0x173f79,_0x3b2224){_0x173f79=_0x173f79-0x0;var _0x59ce8c=_0xc2a1[_0x173f79];return _0x59ce8c;};'use strict';var multer=require(_0x1c2a('0x0'));var util=require(_0x1c2a('0x1'));var path=require(_0x1c2a('0x2'));var timeout=require(_0x1c2a('0x3'));var express=require(_0x1c2a('0x4'));var router=express[_0x1c2a('0x5')]();var fs_extra=require(_0x1c2a('0x6'));var auth=require(_0x1c2a('0x7'));var interaction=require(_0x1c2a('0x8'));var config=require(_0x1c2a('0x9'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x1c2a('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1c2a('0xa')](_0x1c2a('0xb'),auth[_0x1c2a('0xc')](),controller[_0x1c2a('0xd')]);router[_0x1c2a('0xa')]('/:id/fields',auth[_0x1c2a('0xc')](),controller[_0x1c2a('0xe')]);router[_0x1c2a('0xa')]('/:id/subjects',auth[_0x1c2a('0xc')](),controller[_0x1c2a('0xf')]);router[_0x1c2a('0xa')](_0x1c2a('0x10'),auth['isAuthenticated'](),controller[_0x1c2a('0x11')]);router[_0x1c2a('0x12')]('/',auth[_0x1c2a('0xc')](),controller[_0x1c2a('0x13')]);router[_0x1c2a('0x14')](_0x1c2a('0xb'),auth[_0x1c2a('0xc')](),controller[_0x1c2a('0x15')]);router[_0x1c2a('0x16')]('/:id',auth[_0x1c2a('0xc')](),controller[_0x1c2a('0x17')]);module[_0x1c2a('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c2a5334..cc3ab90 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 _0x4014=['exports','STRING','sequelize'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0x4014,0x9e));var _0x4401=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x4014[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require(_0x4401('0x0'));module[_0x4401('0x1')]={'name':{'type':Sequelize[_0x4401('0x2')]},'description':{'type':Sequelize[_0x4401('0x2')]}}; \ No newline at end of file +var _0x54a3=['exports','STRING','sequelize'];(function(_0x4717c3,_0x34306b){var _0x27312a=function(_0x26c447){while(--_0x26c447){_0x4717c3['push'](_0x4717c3['shift']());}};_0x27312a(++_0x34306b);}(_0x54a3,0xd7));var _0x354a=function(_0x2a4b52,_0x443be8){_0x2a4b52=_0x2a4b52-0x0;var _0x2fd21b=_0x54a3[_0x2a4b52];return _0x2fd21b;};'use strict';var Sequelize=require(_0x354a('0x0'));module[_0x354a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x354a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 95399cd..18bb1cb 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 _0x039f=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end','error','stack','name','send','index','map','SugarcrmConfiguration','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','find','body','update','getFields','findOne','SugarcrmField','sort','pick','nolimit','getSubjects','rawAttributes','getDescriptions','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware'];(function(_0x4fa4b1,_0x5849b8){var _0x3dfede=function(_0x377cf6){while(--_0x377cf6){_0x4fa4b1['push'](_0x4fa4b1['shift']());}};_0x3dfede(++_0x5849b8);}(_0x039f,0xd3));var _0xf039=function(_0x2c7b86,_0x59ef3c){_0x2c7b86=_0x2c7b86-0x0;var _0x256735=_0x039f[_0x2c7b86];return _0x256735;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf039('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf039('0x1'));var rp=require('request-promise');var moment=require(_0xf039('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf039('0x3'));var path=require(_0xf039('0x4'));var sox=require(_0xf039('0x5'));var csv=require(_0xf039('0x6'));var ejs=require(_0xf039('0x7'));var fs=require('fs');var fs_extra=require(_0xf039('0x8'));var _=require(_0xf039('0x9'));var squel=require(_0xf039('0xa'));var crypto=require(_0xf039('0xb'));var jsforce=require(_0xf039('0xc'));var deskjs=require(_0xf039('0xd'));var toCsv=require(_0xf039('0x6'));var querystring=require(_0xf039('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf039('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf039('0x10'));var logger=require(_0xf039('0x11'))('api');var utils=require(_0xf039('0x12'));var config=require(_0xf039('0x13'));var licenseUtil=require(_0xf039('0x14'));var db=require(_0xf039('0x15'))['db'];function respondWithStatusCode(_0x4f7bb7,_0x5596d0){_0x5596d0=_0x5596d0||0xcc;return function(_0x42bf75){if(_0x42bf75){return _0x4f7bb7[_0xf039('0x16')](_0x5596d0);}return _0x4f7bb7[_0xf039('0x17')](_0x5596d0)['end']();};}function respondWithResult(_0x2d8822,_0x59eba5){_0x59eba5=_0x59eba5||0xc8;return function(_0x4e82c8){if(_0x4e82c8){return _0x2d8822[_0xf039('0x17')](_0x59eba5)[_0xf039('0x18')](_0x4e82c8);}};}function respondWithFilteredResult(_0x173773,_0x145a5b){return function(_0x58dcc1){if(_0x58dcc1){var _0x1c61fb=typeof _0x145a5b[_0xf039('0x19')]==='undefined'&&typeof _0x145a5b[_0xf039('0x1a')]===_0xf039('0x1b');var _0x22b397=_0x58dcc1[_0xf039('0x1c')];var _0x26e270=_0x1c61fb?0x0:_0x145a5b['offset'];var _0x238241=_0x1c61fb?_0x58dcc1['count']:_0x145a5b[_0xf039('0x19')]+_0x145a5b[_0xf039('0x1a')];var _0x103f26;if(_0x238241>=_0x22b397){_0x238241=_0x22b397;_0x103f26=0xc8;}else{_0x103f26=0xce;}_0x173773['status'](_0x103f26);return _0x173773[_0xf039('0x1d')](_0xf039('0x1e'),_0x26e270+'-'+_0x238241+'/'+_0x22b397)[_0xf039('0x18')](_0x58dcc1);}return null;};}function patchUpdates(_0x1cee06){return function(_0x35876c){try{jsonpatch['apply'](_0x35876c,_0x1cee06,!![]);}catch(_0x1ee65e){return BPromise['reject'](_0x1ee65e);}return _0x35876c['save']();};}function saveUpdates(_0x1ca994,_0x2e8594){return function(_0x5c1993){if(_0x5c1993){return _0x5c1993['update'](_0x1ca994)[_0xf039('0x1f')](function(_0x4b3b65){return _0x4b3b65;});}return null;};}function removeEntity(_0x5b6b68,_0x143de4){return function(_0x141f9f){if(_0x141f9f){return _0x141f9f[_0xf039('0x20')]()[_0xf039('0x1f')](function(){_0x5b6b68[_0xf039('0x17')](0xcc)[_0xf039('0x21')]();});}};}function handleEntityNotFound(_0x459c3d,_0x1aacd9){return function(_0x1b1546){if(!_0x1b1546){_0x459c3d[_0xf039('0x16')](0x194);}return _0x1b1546;};}function handleError(_0x4813e2,_0x1e3581){_0x1e3581=_0x1e3581||0x1f4;return function(_0x50354b){logger[_0xf039('0x22')](_0x50354b[_0xf039('0x23')]);if(_0x50354b['name']){delete _0x50354b[_0xf039('0x24')];}_0x4813e2[_0xf039('0x17')](_0x1e3581)[_0xf039('0x25')](_0x50354b);};}exports[_0xf039('0x26')]=function(_0x20daf7,_0x4e78b9){var _0xf55c33={},_0x226a07={},_0x563b0f={'count':0x0,'rows':[]};var _0x34993d=_[_0xf039('0x27')](db[_0xf039('0x28')]['rawAttributes'],function(_0x4872c5){return{'name':_0x4872c5[_0xf039('0x29')],'type':_0x4872c5[_0xf039('0x2a')][_0xf039('0x2b')]};});_0x226a07[_0xf039('0x2c')]=_[_0xf039('0x27')](_0x34993d,'name');_0x226a07[_0xf039('0x2d')]=_['keys'](_0x20daf7[_0xf039('0x2d')]);_0x226a07['filters']=_[_0xf039('0x2e')](_0x226a07[_0xf039('0x2c')],_0x226a07[_0xf039('0x2d')]);_0xf55c33[_0xf039('0x2f')]=_[_0xf039('0x2e')](_0x226a07[_0xf039('0x2c')],qs['fields'](_0x20daf7[_0xf039('0x2d')][_0xf039('0x30')]));_0xf55c33[_0xf039('0x2f')]=_0xf55c33[_0xf039('0x2f')][_0xf039('0x31')]?_0xf55c33[_0xf039('0x2f')]:_0x226a07[_0xf039('0x2c')];if(!_0x20daf7[_0xf039('0x2d')][_0xf039('0x32')]('nolimit')){_0xf55c33['limit']=qs[_0xf039('0x1a')](_0x20daf7[_0xf039('0x2d')][_0xf039('0x1a')]);_0xf55c33[_0xf039('0x19')]=qs['offset'](_0x20daf7[_0xf039('0x2d')][_0xf039('0x19')]);}_0xf55c33[_0xf039('0x33')]=qs['sort'](_0x20daf7['query']['sort']);_0xf55c33[_0xf039('0x34')]=qs['filters'](_['pick'](_0x20daf7['query'],_0x226a07[_0xf039('0x35')]),_0x34993d);if(_0x20daf7[_0xf039('0x2d')][_0xf039('0x36')]){_0xf55c33[_0xf039('0x34')]=_[_0xf039('0x37')](_0xf55c33['where'],{'$or':_[_0xf039('0x27')](_0x34993d,function(_0x496bf1){if(_0x496bf1[_0xf039('0x2a')]!==_0xf039('0x38')){var _0x1b6fb5={};_0x1b6fb5[_0x496bf1[_0xf039('0x24')]]={'$like':'%'+_0x20daf7[_0xf039('0x2d')][_0xf039('0x36')]+'%'};return _0x1b6fb5;}})});}_0xf55c33=_[_0xf039('0x37')]({},_0xf55c33,_0x20daf7[_0xf039('0x39')]);var _0x35ccbd={'where':_0xf55c33[_0xf039('0x34')]};return db['SugarcrmConfiguration'][_0xf039('0x1c')](_0x35ccbd)['then'](function(_0x27bda1){_0x563b0f[_0xf039('0x1c')]=_0x27bda1;if(_0x20daf7[_0xf039('0x2d')]['includeAll']){_0xf55c33[_0xf039('0x3a')]=[{'all':!![]}];}return db[_0xf039('0x28')]['findAll'](_0xf55c33);})[_0xf039('0x1f')](function(_0x3fd6e4){_0x563b0f[_0xf039('0x3b')]=_0x3fd6e4;return _0x563b0f;})[_0xf039('0x1f')](respondWithFilteredResult(_0x4e78b9,_0xf55c33))[_0xf039('0x3c')](handleError(_0x4e78b9,null));};exports[_0xf039('0x3d')]=function(_0x159dd0,_0x4d73ff){var _0x4f627c={'raw':![],'where':{'id':_0x159dd0[_0xf039('0x3e')]['id']}},_0x6fb23b={};_0x6fb23b['model']=_[_0xf039('0x3f')](db[_0xf039('0x28')]['rawAttributes']);_0x6fb23b['query']=_[_0xf039('0x3f')](_0x159dd0['query']);_0x6fb23b[_0xf039('0x35')]=_[_0xf039('0x2e')](_0x6fb23b[_0xf039('0x2c')],_0x6fb23b[_0xf039('0x2d')]);_0x4f627c[_0xf039('0x2f')]=_[_0xf039('0x2e')](_0x6fb23b['model'],qs['fields'](_0x159dd0[_0xf039('0x2d')][_0xf039('0x30')]));_0x4f627c[_0xf039('0x2f')]=_0x4f627c[_0xf039('0x2f')][_0xf039('0x31')]?_0x4f627c[_0xf039('0x2f')]:_0x6fb23b[_0xf039('0x2c')];if(_0x159dd0[_0xf039('0x2d')]['includeAll']){_0x4f627c[_0xf039('0x3a')]=[{'all':!![]}];}_0x4f627c=_[_0xf039('0x37')]({},_0x4f627c,_0x159dd0[_0xf039('0x39')]);return db[_0xf039('0x28')][_0xf039('0x40')](_0x4f627c)['then'](handleEntityNotFound(_0x4d73ff,null))['then'](respondWithResult(_0x4d73ff,null))['catch'](handleError(_0x4d73ff,null));};exports['create']=function(_0x296550,_0x9260d7){return db[_0xf039('0x28')]['create'](_0x296550[_0xf039('0x41')],{})[_0xf039('0x1f')](respondWithResult(_0x9260d7,0xc9))[_0xf039('0x3c')](handleError(_0x9260d7,null));};exports[_0xf039('0x42')]=function(_0x23dc4f,_0x2a2268){if(_0x23dc4f['body']['id']){delete _0x23dc4f[_0xf039('0x41')]['id'];}return db[_0xf039('0x28')][_0xf039('0x40')]({'where':{'id':_0x23dc4f['params']['id']}})[_0xf039('0x1f')](handleEntityNotFound(_0x2a2268,null))[_0xf039('0x1f')](saveUpdates(_0x23dc4f[_0xf039('0x41')],null))['then'](respondWithResult(_0x2a2268,null))[_0xf039('0x3c')](handleError(_0x2a2268,null));};exports['destroy']=function(_0x2dfb31,_0x327fce){return db[_0xf039('0x28')]['find']({'where':{'id':_0x2dfb31[_0xf039('0x3e')]['id']}})['then'](handleEntityNotFound(_0x327fce,null))['then'](removeEntity(_0x327fce,null))[_0xf039('0x3c')](handleError(_0x327fce,null));};exports[_0xf039('0x43')]=function(_0x40170a,_0x993003,_0x5a4179){var _0x44d546={};var _0x5a62fd={};var _0x508262;var _0x294f8f;return db['SugarcrmConfiguration'][_0xf039('0x44')]({'where':{'id':_0x40170a[_0xf039('0x3e')]['id']}})['then'](handleEntityNotFound(_0x993003,null))[_0xf039('0x1f')](function(_0x4ff823){if(_0x4ff823){_0x508262=_0x4ff823;_0x5a62fd['model']=_[_0xf039('0x3f')](db[_0xf039('0x45')]['rawAttributes']);_0x5a62fd[_0xf039('0x2d')]=_[_0xf039('0x3f')](_0x40170a[_0xf039('0x2d')]);_0x5a62fd['filters']=_[_0xf039('0x2e')](_0x5a62fd[_0xf039('0x2c')],_0x5a62fd['query']);_0x44d546[_0xf039('0x2f')]=_[_0xf039('0x2e')](_0x5a62fd[_0xf039('0x2c')],qs[_0xf039('0x30')](_0x40170a[_0xf039('0x2d')][_0xf039('0x30')]));_0x44d546[_0xf039('0x2f')]=_0x44d546[_0xf039('0x2f')][_0xf039('0x31')]?_0x44d546[_0xf039('0x2f')]:_0x5a62fd['model'];_0x44d546[_0xf039('0x33')]=qs[_0xf039('0x46')](_0x40170a[_0xf039('0x2d')][_0xf039('0x46')]);_0x44d546['where']=qs['filters'](_[_0xf039('0x47')](_0x40170a[_0xf039('0x2d')],_0x5a62fd[_0xf039('0x35')]));if(_0x40170a[_0xf039('0x2d')][_0xf039('0x36')]){_0x44d546[_0xf039('0x34')]=_['merge'](_0x44d546['where'],{'$or':_[_0xf039('0x27')](_0x44d546[_0xf039('0x2f')],function(_0x2bf03a){var _0x1640c8={};_0x1640c8[_0x2bf03a]={'$like':'%'+_0x40170a['query'][_0xf039('0x36')]+'%'};return _0x1640c8;})});}_0x44d546=_[_0xf039('0x37')]({},_0x44d546,_0x40170a[_0xf039('0x39')]);return _0x508262[_0xf039('0x43')](_0x44d546);}})[_0xf039('0x1f')](function(_0xdc5599){if(_0xdc5599){_0x294f8f=_0xdc5599[_0xf039('0x31')];if(!_0x40170a[_0xf039('0x2d')]['hasOwnProperty'](_0xf039('0x48'))){_0x44d546[_0xf039('0x1a')]=qs[_0xf039('0x1a')](_0x40170a[_0xf039('0x2d')][_0xf039('0x1a')]);_0x44d546[_0xf039('0x19')]=qs[_0xf039('0x19')](_0x40170a[_0xf039('0x2d')]['offset']);}return _0x508262[_0xf039('0x43')](_0x44d546);}})[_0xf039('0x1f')](function(_0x2ffce3){if(_0x2ffce3){return _0x2ffce3?{'count':_0x294f8f,'rows':_0x2ffce3}:null;}})[_0xf039('0x1f')](respondWithResult(_0x993003,null))['catch'](handleError(_0x993003,null));};exports[_0xf039('0x49')]=function(_0xdf0a38,_0x51e513,_0x490feb){var _0x2db9ec={};var _0x1633df={};var _0x37c265;var _0x55e525;return db['SugarcrmConfiguration'][_0xf039('0x44')]({'where':{'id':_0xdf0a38[_0xf039('0x3e')]['id']}})[_0xf039('0x1f')](handleEntityNotFound(_0x51e513,null))[_0xf039('0x1f')](function(_0x48eb75){if(_0x48eb75){_0x37c265=_0x48eb75;_0x1633df[_0xf039('0x2c')]=_['keys'](db[_0xf039('0x45')][_0xf039('0x4a')]);_0x1633df[_0xf039('0x2d')]=_[_0xf039('0x3f')](_0xdf0a38['query']);_0x1633df[_0xf039('0x35')]=_[_0xf039('0x2e')](_0x1633df[_0xf039('0x2c')],_0x1633df[_0xf039('0x2d')]);_0x2db9ec['attributes']=_[_0xf039('0x2e')](_0x1633df['model'],qs[_0xf039('0x30')](_0xdf0a38[_0xf039('0x2d')]['fields']));_0x2db9ec['attributes']=_0x2db9ec['attributes'][_0xf039('0x31')]?_0x2db9ec[_0xf039('0x2f')]:_0x1633df[_0xf039('0x2c')];_0x2db9ec[_0xf039('0x33')]=qs['sort'](_0xdf0a38[_0xf039('0x2d')][_0xf039('0x46')]);_0x2db9ec[_0xf039('0x34')]=qs['filters'](_[_0xf039('0x47')](_0xdf0a38[_0xf039('0x2d')],_0x1633df[_0xf039('0x35')]));if(_0xdf0a38[_0xf039('0x2d')]['filter']){_0x2db9ec[_0xf039('0x34')]=_[_0xf039('0x37')](_0x2db9ec[_0xf039('0x34')],{'$or':_[_0xf039('0x27')](_0x2db9ec['attributes'],function(_0x4d98d4){var _0x542401={};_0x542401[_0x4d98d4]={'$like':'%'+_0xdf0a38[_0xf039('0x2d')][_0xf039('0x36')]+'%'};return _0x542401;})});}_0x2db9ec=_['merge']({},_0x2db9ec,_0xdf0a38['options']);return _0x37c265[_0xf039('0x49')](_0x2db9ec);}})[_0xf039('0x1f')](function(_0xe879d4){if(_0xe879d4){_0x55e525=_0xe879d4['length'];if(!_0xdf0a38[_0xf039('0x2d')][_0xf039('0x32')]('nolimit')){_0x2db9ec[_0xf039('0x1a')]=qs[_0xf039('0x1a')](_0xdf0a38[_0xf039('0x2d')][_0xf039('0x1a')]);_0x2db9ec['offset']=qs[_0xf039('0x19')](_0xdf0a38[_0xf039('0x2d')][_0xf039('0x19')]);}return _0x37c265[_0xf039('0x49')](_0x2db9ec);}})[_0xf039('0x1f')](function(_0x2f1555){if(_0x2f1555){return _0x2f1555?{'count':_0x55e525,'rows':_0x2f1555}:null;}})[_0xf039('0x1f')](respondWithResult(_0x51e513,null))[_0xf039('0x3c')](handleError(_0x51e513,null));};exports[_0xf039('0x4b')]=function(_0x2cc60b,_0x2def9a,_0x37076f){var _0x236fc0={};var _0x20bd01={};var _0x5e5349;var _0x586895;return db[_0xf039('0x28')][_0xf039('0x44')]({'where':{'id':_0x2cc60b[_0xf039('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2def9a,null))['then'](function(_0x13b985){if(_0x13b985){_0x5e5349=_0x13b985;_0x20bd01[_0xf039('0x2c')]=_['keys'](db[_0xf039('0x45')][_0xf039('0x4a')]);_0x20bd01[_0xf039('0x2d')]=_[_0xf039('0x3f')](_0x2cc60b[_0xf039('0x2d')]);_0x20bd01[_0xf039('0x35')]=_[_0xf039('0x2e')](_0x20bd01[_0xf039('0x2c')],_0x20bd01[_0xf039('0x2d')]);_0x236fc0[_0xf039('0x2f')]=_[_0xf039('0x2e')](_0x20bd01['model'],qs[_0xf039('0x30')](_0x2cc60b[_0xf039('0x2d')][_0xf039('0x30')]));_0x236fc0['attributes']=_0x236fc0[_0xf039('0x2f')][_0xf039('0x31')]?_0x236fc0[_0xf039('0x2f')]:_0x20bd01['model'];_0x236fc0[_0xf039('0x33')]=qs[_0xf039('0x46')](_0x2cc60b[_0xf039('0x2d')][_0xf039('0x46')]);_0x236fc0[_0xf039('0x34')]=qs[_0xf039('0x35')](_[_0xf039('0x47')](_0x2cc60b[_0xf039('0x2d')],_0x20bd01['filters']));if(_0x2cc60b[_0xf039('0x2d')][_0xf039('0x36')]){_0x236fc0['where']=_[_0xf039('0x37')](_0x236fc0['where'],{'$or':_[_0xf039('0x27')](_0x236fc0[_0xf039('0x2f')],function(_0x2b6b7a){var _0x1a2790={};_0x1a2790[_0x2b6b7a]={'$like':'%'+_0x2cc60b[_0xf039('0x2d')][_0xf039('0x36')]+'%'};return _0x1a2790;})});}_0x236fc0=_['merge']({},_0x236fc0,_0x2cc60b[_0xf039('0x39')]);return _0x5e5349[_0xf039('0x4b')](_0x236fc0);}})['then'](function(_0x43dde8){if(_0x43dde8){_0x586895=_0x43dde8[_0xf039('0x31')];if(!_0x2cc60b[_0xf039('0x2d')][_0xf039('0x32')]('nolimit')){_0x236fc0[_0xf039('0x1a')]=qs['limit'](_0x2cc60b[_0xf039('0x2d')][_0xf039('0x1a')]);_0x236fc0[_0xf039('0x19')]=qs[_0xf039('0x19')](_0x2cc60b['query'][_0xf039('0x19')]);}return _0x5e5349['getDescriptions'](_0x236fc0);}})['then'](function(_0x1a0c1e){if(_0x1a0c1e){return _0x1a0c1e?{'count':_0x586895,'rows':_0x1a0c1e}:null;}})[_0xf039('0x1f')](respondWithResult(_0x2def9a,null))['catch'](handleError(_0x2def9a,null));}; \ No newline at end of file +var _0x6039=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','send','index','map','SugarcrmConfiguration','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','name','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','nolimit','getSubjects','SugarcrmField','pick','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','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','api','../../config/utils','../../config/environment'];(function(_0x3ab687,_0x2f3a18){var _0x512596=function(_0x981ef2){while(--_0x981ef2){_0x3ab687['push'](_0x3ab687['shift']());}};_0x512596(++_0x2f3a18);}(_0x6039,0x8c));var _0x9603=function(_0xf1ce3b,_0x4b1c98){_0xf1ce3b=_0xf1ce3b-0x0;var _0x2403f0=_0x6039[_0xf1ce3b];return _0x2403f0;};'use strict';var emlformat=require(_0x9603('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9603('0x1'));var jsonpatch=require(_0x9603('0x2'));var rp=require('request-promise');var moment=require(_0x9603('0x3'));var BPromise=require(_0x9603('0x4'));var Mustache=require(_0x9603('0x5'));var util=require(_0x9603('0x6'));var path=require(_0x9603('0x7'));var sox=require(_0x9603('0x8'));var csv=require(_0x9603('0x9'));var ejs=require(_0x9603('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9603('0xb'));var squel=require(_0x9603('0xc'));var crypto=require(_0x9603('0xd'));var jsforce=require(_0x9603('0xe'));var deskjs=require(_0x9603('0xf'));var toCsv=require(_0x9603('0x9'));var querystring=require(_0x9603('0x10'));var Papa=require(_0x9603('0x11'));var Redis=require(_0x9603('0x12'));var authService=require(_0x9603('0x13'));var qs=require(_0x9603('0x14'));var as=require(_0x9603('0x15'));var hardwareService=require(_0x9603('0x16'));var logger=require('../../config/logger')(_0x9603('0x17'));var utils=require(_0x9603('0x18'));var config=require(_0x9603('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9603('0x1a'))['db'];function respondWithStatusCode(_0x179c01,_0x1d2a84){_0x1d2a84=_0x1d2a84||0xcc;return function(_0x855e5c){if(_0x855e5c){return _0x179c01[_0x9603('0x1b')](_0x1d2a84);}return _0x179c01['status'](_0x1d2a84)['end']();};}function respondWithResult(_0x5d44a5,_0x1edaa1){_0x1edaa1=_0x1edaa1||0xc8;return function(_0x184996){if(_0x184996){return _0x5d44a5[_0x9603('0x1c')](_0x1edaa1)[_0x9603('0x1d')](_0x184996);}};}function respondWithFilteredResult(_0x13ba5a,_0x1aa78a){return function(_0x2efc92){if(_0x2efc92){var _0x384004=typeof _0x1aa78a[_0x9603('0x1e')]===_0x9603('0x1f')&&typeof _0x1aa78a[_0x9603('0x20')]==='undefined';var _0x4ad44b=_0x2efc92[_0x9603('0x21')];var _0x3fc604=_0x384004?0x0:_0x1aa78a['offset'];var _0x4e9450=_0x384004?_0x2efc92['count']:_0x1aa78a[_0x9603('0x1e')]+_0x1aa78a[_0x9603('0x20')];var _0x4a879e;if(_0x4e9450>=_0x4ad44b){_0x4e9450=_0x4ad44b;_0x4a879e=0xc8;}else{_0x4a879e=0xce;}_0x13ba5a[_0x9603('0x1c')](_0x4a879e);return _0x13ba5a[_0x9603('0x22')]('Content-Range',_0x3fc604+'-'+_0x4e9450+'/'+_0x4ad44b)['json'](_0x2efc92);}return null;};}function patchUpdates(_0x3e2a2c){return function(_0x393d25){try{jsonpatch[_0x9603('0x23')](_0x393d25,_0x3e2a2c,!![]);}catch(_0x3d6393){return BPromise[_0x9603('0x24')](_0x3d6393);}return _0x393d25[_0x9603('0x25')]();};}function saveUpdates(_0x2fa367,_0x11e6ce){return function(_0x3562af){if(_0x3562af){return _0x3562af[_0x9603('0x26')](_0x2fa367)[_0x9603('0x27')](function(_0x23c3f2){return _0x23c3f2;});}return null;};}function removeEntity(_0x209c07,_0x59a338){return function(_0x2368e5){if(_0x2368e5){return _0x2368e5[_0x9603('0x28')]()[_0x9603('0x27')](function(){_0x209c07[_0x9603('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e5c97,_0x220568){return function(_0x23ad11){if(!_0x23ad11){_0x1e5c97[_0x9603('0x1b')](0x194);}return _0x23ad11;};}function handleError(_0x1d3ca0,_0x11c4ed){_0x11c4ed=_0x11c4ed||0x1f4;return function(_0x5405f3){logger['error'](_0x5405f3[_0x9603('0x29')]);if(_0x5405f3['name']){delete _0x5405f3['name'];}_0x1d3ca0[_0x9603('0x1c')](_0x11c4ed)[_0x9603('0x2a')](_0x5405f3);};}exports[_0x9603('0x2b')]=function(_0x122b41,_0x105014){var _0x27fa76={},_0x331b04={},_0x3c9b3b={'count':0x0,'rows':[]};var _0x10f054=_[_0x9603('0x2c')](db[_0x9603('0x2d')]['rawAttributes'],function(_0x2c83e8){return{'name':_0x2c83e8[_0x9603('0x2e')],'type':_0x2c83e8['type'][_0x9603('0x2f')]};});_0x331b04['model']=_[_0x9603('0x2c')](_0x10f054,'name');_0x331b04[_0x9603('0x30')]=_[_0x9603('0x31')](_0x122b41[_0x9603('0x30')]);_0x331b04[_0x9603('0x32')]=_[_0x9603('0x33')](_0x331b04['model'],_0x331b04['query']);_0x27fa76[_0x9603('0x34')]=_['intersection'](_0x331b04[_0x9603('0x35')],qs[_0x9603('0x36')](_0x122b41[_0x9603('0x30')]['fields']));_0x27fa76[_0x9603('0x34')]=_0x27fa76[_0x9603('0x34')][_0x9603('0x37')]?_0x27fa76['attributes']:_0x331b04[_0x9603('0x35')];if(!_0x122b41[_0x9603('0x30')][_0x9603('0x38')]('nolimit')){_0x27fa76[_0x9603('0x20')]=qs['limit'](_0x122b41[_0x9603('0x30')][_0x9603('0x20')]);_0x27fa76[_0x9603('0x1e')]=qs[_0x9603('0x1e')](_0x122b41[_0x9603('0x30')][_0x9603('0x1e')]);}_0x27fa76[_0x9603('0x39')]=qs[_0x9603('0x3a')](_0x122b41[_0x9603('0x30')][_0x9603('0x3a')]);_0x27fa76[_0x9603('0x3b')]=qs[_0x9603('0x32')](_['pick'](_0x122b41[_0x9603('0x30')],_0x331b04[_0x9603('0x32')]),_0x10f054);if(_0x122b41[_0x9603('0x30')][_0x9603('0x3c')]){_0x27fa76[_0x9603('0x3b')]=_[_0x9603('0x3d')](_0x27fa76['where'],{'$or':_[_0x9603('0x2c')](_0x10f054,function(_0x4b7524){if(_0x4b7524[_0x9603('0x3e')]!==_0x9603('0x3f')){var _0x536c05={};_0x536c05[_0x4b7524[_0x9603('0x40')]]={'$like':'%'+_0x122b41[_0x9603('0x30')]['filter']+'%'};return _0x536c05;}})});}_0x27fa76=_[_0x9603('0x3d')]({},_0x27fa76,_0x122b41[_0x9603('0x41')]);var _0x1525c6={'where':_0x27fa76['where']};return db[_0x9603('0x2d')][_0x9603('0x21')](_0x1525c6)[_0x9603('0x27')](function(_0x13275d){_0x3c9b3b[_0x9603('0x21')]=_0x13275d;if(_0x122b41[_0x9603('0x30')][_0x9603('0x42')]){_0x27fa76[_0x9603('0x43')]=[{'all':!![]}];}return db[_0x9603('0x2d')]['findAll'](_0x27fa76);})['then'](function(_0x29fec8){_0x3c9b3b[_0x9603('0x44')]=_0x29fec8;return _0x3c9b3b;})['then'](respondWithFilteredResult(_0x105014,_0x27fa76))[_0x9603('0x45')](handleError(_0x105014,null));};exports[_0x9603('0x46')]=function(_0x4d3767,_0x255290){var _0x48bf95={'raw':![],'where':{'id':_0x4d3767[_0x9603('0x47')]['id']}},_0x5b96b8={};_0x5b96b8[_0x9603('0x35')]=_[_0x9603('0x31')](db[_0x9603('0x2d')][_0x9603('0x48')]);_0x5b96b8[_0x9603('0x30')]=_[_0x9603('0x31')](_0x4d3767[_0x9603('0x30')]);_0x5b96b8['filters']=_[_0x9603('0x33')](_0x5b96b8['model'],_0x5b96b8['query']);_0x48bf95[_0x9603('0x34')]=_[_0x9603('0x33')](_0x5b96b8[_0x9603('0x35')],qs[_0x9603('0x36')](_0x4d3767[_0x9603('0x30')][_0x9603('0x36')]));_0x48bf95['attributes']=_0x48bf95[_0x9603('0x34')][_0x9603('0x37')]?_0x48bf95[_0x9603('0x34')]:_0x5b96b8['model'];if(_0x4d3767['query'][_0x9603('0x42')]){_0x48bf95[_0x9603('0x43')]=[{'all':!![]}];}_0x48bf95=_[_0x9603('0x3d')]({},_0x48bf95,_0x4d3767[_0x9603('0x41')]);return db[_0x9603('0x2d')][_0x9603('0x49')](_0x48bf95)[_0x9603('0x27')](handleEntityNotFound(_0x255290,null))[_0x9603('0x27')](respondWithResult(_0x255290,null))[_0x9603('0x45')](handleError(_0x255290,null));};exports[_0x9603('0x4a')]=function(_0x2a793b,_0x32f9b1){return db[_0x9603('0x2d')]['create'](_0x2a793b['body'],{})['then'](respondWithResult(_0x32f9b1,0xc9))[_0x9603('0x45')](handleError(_0x32f9b1,null));};exports[_0x9603('0x26')]=function(_0x3d4a47,_0xcbeb26){if(_0x3d4a47[_0x9603('0x4b')]['id']){delete _0x3d4a47[_0x9603('0x4b')]['id'];}return db[_0x9603('0x2d')]['find']({'where':{'id':_0x3d4a47[_0x9603('0x47')]['id']}})[_0x9603('0x27')](handleEntityNotFound(_0xcbeb26,null))[_0x9603('0x27')](saveUpdates(_0x3d4a47[_0x9603('0x4b')],null))[_0x9603('0x27')](respondWithResult(_0xcbeb26,null))['catch'](handleError(_0xcbeb26,null));};exports[_0x9603('0x28')]=function(_0x551eae,_0x272c50){return db[_0x9603('0x2d')][_0x9603('0x49')]({'where':{'id':_0x551eae[_0x9603('0x47')]['id']}})[_0x9603('0x27')](handleEntityNotFound(_0x272c50,null))['then'](removeEntity(_0x272c50,null))[_0x9603('0x45')](handleError(_0x272c50,null));};exports[_0x9603('0x4c')]=function(_0x4b139b,_0x3cfcf9,_0x2552a0){var _0x4ec65b={};var _0x484211={};var _0xb29285;var _0x59e47f;return db['SugarcrmConfiguration'][_0x9603('0x4d')]({'where':{'id':_0x4b139b[_0x9603('0x47')]['id']}})['then'](handleEntityNotFound(_0x3cfcf9,null))[_0x9603('0x27')](function(_0x10a6cb){if(_0x10a6cb){_0xb29285=_0x10a6cb;_0x484211[_0x9603('0x35')]=_['keys'](db['SugarcrmField'][_0x9603('0x48')]);_0x484211[_0x9603('0x30')]=_[_0x9603('0x31')](_0x4b139b[_0x9603('0x30')]);_0x484211['filters']=_[_0x9603('0x33')](_0x484211[_0x9603('0x35')],_0x484211[_0x9603('0x30')]);_0x4ec65b['attributes']=_['intersection'](_0x484211['model'],qs[_0x9603('0x36')](_0x4b139b[_0x9603('0x30')]['fields']));_0x4ec65b['attributes']=_0x4ec65b[_0x9603('0x34')][_0x9603('0x37')]?_0x4ec65b[_0x9603('0x34')]:_0x484211[_0x9603('0x35')];_0x4ec65b[_0x9603('0x39')]=qs['sort'](_0x4b139b[_0x9603('0x30')][_0x9603('0x3a')]);_0x4ec65b['where']=qs[_0x9603('0x32')](_['pick'](_0x4b139b[_0x9603('0x30')],_0x484211[_0x9603('0x32')]));if(_0x4b139b['query'][_0x9603('0x3c')]){_0x4ec65b['where']=_[_0x9603('0x3d')](_0x4ec65b[_0x9603('0x3b')],{'$or':_[_0x9603('0x2c')](_0x4ec65b[_0x9603('0x34')],function(_0x7ab9d1){var _0x3d87ad={};_0x3d87ad[_0x7ab9d1]={'$like':'%'+_0x4b139b[_0x9603('0x30')]['filter']+'%'};return _0x3d87ad;})});}_0x4ec65b=_[_0x9603('0x3d')]({},_0x4ec65b,_0x4b139b[_0x9603('0x41')]);return _0xb29285['getFields'](_0x4ec65b);}})[_0x9603('0x27')](function(_0x49c916){if(_0x49c916){_0x59e47f=_0x49c916[_0x9603('0x37')];if(!_0x4b139b[_0x9603('0x30')][_0x9603('0x38')](_0x9603('0x4e'))){_0x4ec65b[_0x9603('0x20')]=qs[_0x9603('0x20')](_0x4b139b[_0x9603('0x30')]['limit']);_0x4ec65b[_0x9603('0x1e')]=qs['offset'](_0x4b139b[_0x9603('0x30')][_0x9603('0x1e')]);}return _0xb29285['getFields'](_0x4ec65b);}})[_0x9603('0x27')](function(_0x1cd3ca){if(_0x1cd3ca){return _0x1cd3ca?{'count':_0x59e47f,'rows':_0x1cd3ca}:null;}})[_0x9603('0x27')](respondWithResult(_0x3cfcf9,null))[_0x9603('0x45')](handleError(_0x3cfcf9,null));};exports[_0x9603('0x4f')]=function(_0x5adc3f,_0x45d9e5,_0x6b9d14){var _0x1a025b={};var _0x8911d5={};var _0x14a648;var _0x38d556;return db[_0x9603('0x2d')][_0x9603('0x4d')]({'where':{'id':_0x5adc3f[_0x9603('0x47')]['id']}})[_0x9603('0x27')](handleEntityNotFound(_0x45d9e5,null))[_0x9603('0x27')](function(_0x1133fd){if(_0x1133fd){_0x14a648=_0x1133fd;_0x8911d5[_0x9603('0x35')]=_[_0x9603('0x31')](db[_0x9603('0x50')][_0x9603('0x48')]);_0x8911d5[_0x9603('0x30')]=_[_0x9603('0x31')](_0x5adc3f[_0x9603('0x30')]);_0x8911d5[_0x9603('0x32')]=_[_0x9603('0x33')](_0x8911d5['model'],_0x8911d5['query']);_0x1a025b[_0x9603('0x34')]=_[_0x9603('0x33')](_0x8911d5[_0x9603('0x35')],qs['fields'](_0x5adc3f[_0x9603('0x30')][_0x9603('0x36')]));_0x1a025b['attributes']=_0x1a025b[_0x9603('0x34')][_0x9603('0x37')]?_0x1a025b[_0x9603('0x34')]:_0x8911d5[_0x9603('0x35')];_0x1a025b[_0x9603('0x39')]=qs[_0x9603('0x3a')](_0x5adc3f[_0x9603('0x30')][_0x9603('0x3a')]);_0x1a025b[_0x9603('0x3b')]=qs[_0x9603('0x32')](_[_0x9603('0x51')](_0x5adc3f['query'],_0x8911d5[_0x9603('0x32')]));if(_0x5adc3f[_0x9603('0x30')][_0x9603('0x3c')]){_0x1a025b[_0x9603('0x3b')]=_[_0x9603('0x3d')](_0x1a025b[_0x9603('0x3b')],{'$or':_[_0x9603('0x2c')](_0x1a025b['attributes'],function(_0x5f3911){var _0x289ecd={};_0x289ecd[_0x5f3911]={'$like':'%'+_0x5adc3f[_0x9603('0x30')][_0x9603('0x3c')]+'%'};return _0x289ecd;})});}_0x1a025b=_[_0x9603('0x3d')]({},_0x1a025b,_0x5adc3f[_0x9603('0x41')]);return _0x14a648[_0x9603('0x4f')](_0x1a025b);}})[_0x9603('0x27')](function(_0xdfca9d){if(_0xdfca9d){_0x38d556=_0xdfca9d[_0x9603('0x37')];if(!_0x5adc3f[_0x9603('0x30')][_0x9603('0x38')]('nolimit')){_0x1a025b['limit']=qs[_0x9603('0x20')](_0x5adc3f[_0x9603('0x30')][_0x9603('0x20')]);_0x1a025b['offset']=qs[_0x9603('0x1e')](_0x5adc3f['query'][_0x9603('0x1e')]);}return _0x14a648[_0x9603('0x4f')](_0x1a025b);}})[_0x9603('0x27')](function(_0x4163aa){if(_0x4163aa){return _0x4163aa?{'count':_0x38d556,'rows':_0x4163aa}:null;}})['then'](respondWithResult(_0x45d9e5,null))[_0x9603('0x45')](handleError(_0x45d9e5,null));};exports[_0x9603('0x52')]=function(_0x360f51,_0xb0f9d3,_0x173199){var _0x5bee57={};var _0x4f4945={};var _0x4a5208;var _0x560c8e;return db[_0x9603('0x2d')]['findOne']({'where':{'id':_0x360f51[_0x9603('0x47')]['id']}})[_0x9603('0x27')](handleEntityNotFound(_0xb0f9d3,null))[_0x9603('0x27')](function(_0x4c7a57){if(_0x4c7a57){_0x4a5208=_0x4c7a57;_0x4f4945[_0x9603('0x35')]=_[_0x9603('0x31')](db['SugarcrmField'][_0x9603('0x48')]);_0x4f4945[_0x9603('0x30')]=_['keys'](_0x360f51[_0x9603('0x30')]);_0x4f4945[_0x9603('0x32')]=_[_0x9603('0x33')](_0x4f4945[_0x9603('0x35')],_0x4f4945[_0x9603('0x30')]);_0x5bee57[_0x9603('0x34')]=_[_0x9603('0x33')](_0x4f4945[_0x9603('0x35')],qs['fields'](_0x360f51[_0x9603('0x30')][_0x9603('0x36')]));_0x5bee57[_0x9603('0x34')]=_0x5bee57['attributes'][_0x9603('0x37')]?_0x5bee57['attributes']:_0x4f4945[_0x9603('0x35')];_0x5bee57['order']=qs['sort'](_0x360f51[_0x9603('0x30')][_0x9603('0x3a')]);_0x5bee57[_0x9603('0x3b')]=qs[_0x9603('0x32')](_[_0x9603('0x51')](_0x360f51[_0x9603('0x30')],_0x4f4945[_0x9603('0x32')]));if(_0x360f51['query'][_0x9603('0x3c')]){_0x5bee57['where']=_[_0x9603('0x3d')](_0x5bee57['where'],{'$or':_[_0x9603('0x2c')](_0x5bee57['attributes'],function(_0x6d5b18){var _0x204267={};_0x204267[_0x6d5b18]={'$like':'%'+_0x360f51['query']['filter']+'%'};return _0x204267;})});}_0x5bee57=_['merge']({},_0x5bee57,_0x360f51[_0x9603('0x41')]);return _0x4a5208[_0x9603('0x52')](_0x5bee57);}})['then'](function(_0x24da1c){if(_0x24da1c){_0x560c8e=_0x24da1c[_0x9603('0x37')];if(!_0x360f51[_0x9603('0x30')]['hasOwnProperty'](_0x9603('0x4e'))){_0x5bee57[_0x9603('0x20')]=qs[_0x9603('0x20')](_0x360f51[_0x9603('0x30')][_0x9603('0x20')]);_0x5bee57['offset']=qs[_0x9603('0x1e')](_0x360f51[_0x9603('0x30')][_0x9603('0x1e')]);}return _0x4a5208['getDescriptions'](_0x5bee57);}})[_0x9603('0x27')](function(_0x38b0b6){if(_0x38b0b6){return _0x38b0b6?{'count':_0x560c8e,'rows':_0x38b0b6}:null;}})[_0x9603('0x27')](respondWithResult(_0xb0f9d3,null))[_0x9603('0x45')](handleError(_0xb0f9d3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 405c38b..1703b5a 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 _0x9ab5=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','../../config/logger','api','moment'];(function(_0x25521b,_0xa0697b){var _0x1f7487=function(_0x5c1b5c){while(--_0x5c1b5c){_0x25521b['push'](_0x25521b['shift']());}};_0x1f7487(++_0xa0697b);}(_0x9ab5,0x11a));var _0x59ab=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9ab5[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x59ab('0x0'));var util=require('util');var logger=require(_0x59ab('0x1'))(_0x59ab('0x2'));var moment=require(_0x59ab('0x3'));var BPromise=require(_0x59ab('0x4'));var rp=require(_0x59ab('0x5'));var fs=require('fs');var path=require(_0x59ab('0x6'));var rimraf=require(_0x59ab('0x7'));var config=require(_0x59ab('0x8'));var attributes=require(_0x59ab('0x9'));module[_0x59ab('0xa')]=function(_0x5c059c,_0x325678){return _0x5c059c[_0x59ab('0xb')](_0x59ab('0xc'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0653=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x0653,0x197));var _0x3065=function(_0x3b21d9,_0x4dcedb){_0x3b21d9=_0x3b21d9-0x0;var _0x284c79=_0x0653[_0x3b21d9];return _0x284c79;};'use strict';var _=require(_0x3065('0x0'));var util=require(_0x3065('0x1'));var logger=require(_0x3065('0x2'))(_0x3065('0x3'));var moment=require(_0x3065('0x4'));var BPromise=require(_0x3065('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3065('0x6'));var config=require(_0x3065('0x7'));var attributes=require(_0x3065('0x8'));module['exports']=function(_0x171e95,_0x431d78){return _0x171e95[_0x3065('0x9')](_0x3065('0xa'),attributes,{'tableName':_0x3065('0xb'),'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 c037b5d..e19a542 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 _0xa71e=['util','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','lodash'];(function(_0x1964e4,_0x2c3506){var _0x344590=function(_0x2a8133){while(--_0x2a8133){_0x1964e4['push'](_0x1964e4['shift']());}};_0x344590(++_0x2c3506);}(_0xa71e,0x14f));var _0xea71=function(_0x3ec333,_0x26bcbe){_0x3ec333=_0x3ec333-0x0;var _0x15ccb8=_0xa71e[_0x3ec333];return _0x15ccb8;};'use strict';var _=require(_0xea71('0x0'));var util=require(_0xea71('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea71('0x2'))['db'];var utils=require(_0xea71('0x3'));var logger=require(_0xea71('0x4'))(_0xea71('0x5'));var config=require('../../config/environment');var jayson=require(_0xea71('0x6'));var client=jayson[_0xea71('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32384c,_0x39e8fb,_0x3e50f1){return new BPromise(function(_0x2820a4,_0x13f1e0){return client['request'](_0x32384c,_0x3e50f1)['then'](function(_0xf8223e){logger[_0xea71('0x8')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x39e8fb,_0xea71('0x9'));logger['debug'](_0xea71('0xa'),_0x39e8fb,_0xea71('0x9'),JSON[_0xea71('0xb')](_0xf8223e));if(_0xf8223e[_0xea71('0xc')]){if(_0xf8223e[_0xea71('0xc')]['code']===0x1f4){logger['error'](_0xea71('0xd'),_0x39e8fb,_0xf8223e[_0xea71('0xc')][_0xea71('0xe')]);return _0x13f1e0(_0xf8223e[_0xea71('0xc')]['message']);}logger['error'](_0xea71('0xd'),_0x39e8fb,_0xf8223e[_0xea71('0xc')][_0xea71('0xe')]);return _0x2820a4(_0xf8223e[_0xea71('0xc')][_0xea71('0xe')]);}else{logger['info'](_0xea71('0xd'),_0x39e8fb,_0xea71('0x9'));_0x2820a4(_0xf8223e[_0xea71('0xf')][_0xea71('0xe')]);}})['catch'](function(_0x41e491){logger['error'](_0xea71('0xd'),_0x39e8fb,_0x41e491);_0x13f1e0(_0x41e491);});});} \ No newline at end of file +var _0xbeb5=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x16e5a2,_0xd6d0df){var _0x41b8d9=function(_0x4f8f2d){while(--_0x4f8f2d){_0x16e5a2['push'](_0x16e5a2['shift']());}};_0x41b8d9(++_0xd6d0df);}(_0xbeb5,0x161));var _0x5beb=function(_0x34bb0b,_0x4f62a3){_0x34bb0b=_0x34bb0b-0x0;var _0x366c92=_0xbeb5[_0x34bb0b];return _0x366c92;};'use strict';var _=require(_0x5beb('0x0'));var util=require(_0x5beb('0x1'));var moment=require('moment');var BPromise=require(_0x5beb('0x2'));var rs=require(_0x5beb('0x3'));var fs=require('fs');var Redis=require(_0x5beb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5beb('0x5'));var logger=require(_0x5beb('0x6'))(_0x5beb('0x7'));var config=require(_0x5beb('0x8'));var jayson=require(_0x5beb('0x9'));var client=jayson[_0x5beb('0xa')][_0x5beb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa9df1f,_0x13cebd,_0x3f8c77){return new BPromise(function(_0x5cd4e2,_0x3e521c){return client[_0x5beb('0xc')](_0xa9df1f,_0x3f8c77)['then'](function(_0x2fc357){logger[_0x5beb('0xd')](_0x5beb('0xe'),_0x13cebd,'request\x20sent');logger[_0x5beb('0xf')](_0x5beb('0x10'),_0x13cebd,_0x5beb('0x11'),JSON[_0x5beb('0x12')](_0x2fc357));if(_0x2fc357[_0x5beb('0x13')]){if(_0x2fc357['error'][_0x5beb('0x14')]===0x1f4){logger[_0x5beb('0x13')](_0x5beb('0xe'),_0x13cebd,_0x2fc357['error'][_0x5beb('0x15')]);return _0x3e521c(_0x2fc357[_0x5beb('0x13')][_0x5beb('0x15')]);}logger[_0x5beb('0x13')](_0x5beb('0xe'),_0x13cebd,_0x2fc357[_0x5beb('0x13')][_0x5beb('0x15')]);return _0x5cd4e2(_0x2fc357[_0x5beb('0x13')]['message']);}else{logger['info'](_0x5beb('0xe'),_0x13cebd,_0x5beb('0x11'));_0x5cd4e2(_0x2fc357['result']['message']);}})[_0x5beb('0x16')](function(_0x28dce2){logger[_0x5beb('0x13')](_0x5beb('0xe'),_0x13cebd,_0x28dce2);_0x3e521c(_0x28dce2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 08ec960..d75d08d 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 _0x0a3d=['get','/:id','isAuthenticated','show','post','create','put','update','path','express','Router','../../config/environment'];(function(_0x1d137c,_0x3ecbf0){var _0x4a8a6d=function(_0x53004f){while(--_0x53004f){_0x1d137c['push'](_0x1d137c['shift']());}};_0x4a8a6d(++_0x3ecbf0);}(_0x0a3d,0xd4));var _0xd0a3=function(_0x33c464,_0x231797){_0x33c464=_0x33c464-0x0;var _0x261e16=_0x0a3d[_0x33c464];return _0x261e16;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd0a3('0x0'));var timeout=require('connect-timeout');var express=require(_0xd0a3('0x1'));var router=express[_0xd0a3('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd0a3('0x3'));var controller=require('./intSugarcrmField.controller');router[_0xd0a3('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd0a3('0x4')](_0xd0a3('0x5'),auth[_0xd0a3('0x6')](),controller[_0xd0a3('0x7')]);router[_0xd0a3('0x8')]('/',auth[_0xd0a3('0x6')](),controller[_0xd0a3('0x9')]);router[_0xd0a3('0xa')](_0xd0a3('0x5'),auth[_0xd0a3('0x6')](),controller[_0xd0a3('0xb')]);router['delete'](_0xd0a3('0x5'),auth[_0xd0a3('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb53e=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb53e,0xd7));var _0xeb53=function(_0xb7cac8,_0x31ea6c){_0xb7cac8=_0xb7cac8-0x0;var _0x214788=_0xb53e[_0xb7cac8];return _0x214788;};'use strict';var multer=require(_0xeb53('0x0'));var util=require(_0xeb53('0x1'));var path=require('path');var timeout=require(_0xeb53('0x2'));var express=require(_0xeb53('0x3'));var router=express[_0xeb53('0x4')]();var fs_extra=require(_0xeb53('0x5'));var auth=require(_0xeb53('0x6'));var interaction=require(_0xeb53('0x7'));var config=require(_0xeb53('0x8'));var controller=require(_0xeb53('0x9'));router[_0xeb53('0xa')]('/',auth[_0xeb53('0xb')](),controller[_0xeb53('0xc')]);router[_0xeb53('0xa')](_0xeb53('0xd'),auth[_0xeb53('0xb')](),controller[_0xeb53('0xe')]);router[_0xeb53('0xf')]('/',auth[_0xeb53('0xb')](),controller['create']);router[_0xeb53('0x10')]('/:id',auth[_0xeb53('0xb')](),controller[_0xeb53('0x11')]);router[_0xeb53('0x12')](_0xeb53('0xd'),auth[_0xeb53('0xb')](),controller[_0xeb53('0x13')]);module[_0xeb53('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index fa95a2b..fb8419d 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 _0x502b=['customVariable','STRING','exports','ENUM','string','variable','picklist'];(function(_0x21090b,_0x39dd3b){var _0x3c68d7=function(_0x28ecd4){while(--_0x28ecd4){_0x21090b['push'](_0x21090b['shift']());}};_0x3c68d7(++_0x39dd3b);}(_0x502b,0xbf));var _0xb502=function(_0xbaeba7,_0x578dfa){_0xbaeba7=_0xbaeba7-0x0;var _0x4b42e7=_0x502b[_0xbaeba7];return _0x4b42e7;};'use strict';var Sequelize=require('sequelize');module[_0xb502('0x0')]={'type':{'type':Sequelize[_0xb502('0x1')](_0xb502('0x2'),_0xb502('0x3'),'customVariable','keyValue',_0xb502('0x4')),'defaultValue':_0xb502('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb502('0x1')](_0xb502('0x2'),_0xb502('0x3'),_0xb502('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb502('0x6')]},'nameField':{'type':Sequelize[_0xb502('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb502('0x6')]}}; \ No newline at end of file +var _0x2b67=['customVariable','keyValue','STRING','string','BOOLEAN','sequelize','exports','variable'];(function(_0x4f9ef1,_0x3cead7){var _0x3d3573=function(_0x188b68){while(--_0x188b68){_0x4f9ef1['push'](_0x4f9ef1['shift']());}};_0x3d3573(++_0x3cead7);}(_0x2b67,0x9d));var _0x72b6=function(_0x44ee22,_0x5c370b){_0x44ee22=_0x44ee22-0x0;var _0x7b3321=_0x2b67[_0x44ee22];return _0x7b3321;};'use strict';var Sequelize=require(_0x72b6('0x0'));module[_0x72b6('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x72b6('0x2'),_0x72b6('0x3'),_0x72b6('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x72b6('0x5')]},'key':{'type':Sequelize[_0x72b6('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x72b6('0x6'),_0x72b6('0x2'),_0x72b6('0x3'))},'keyContent':{'type':Sequelize[_0x72b6('0x5')]},'idField':{'type':Sequelize[_0x72b6('0x5')]},'nameField':{'type':Sequelize[_0x72b6('0x5')]},'customField':{'type':Sequelize[_0x72b6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x72b6('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 0c8e1ce..eb7feb5 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 _0xb03e=['findAll','rows','catch','show','params','find','create','body','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','VIRTUAL','merge','options','includeAll','include'];(function(_0x1bd9f0,_0x2f618d){var _0x24d691=function(_0x559e9b){while(--_0x559e9b){_0x1bd9f0['push'](_0x1bd9f0['shift']());}};_0x24d691(++_0x2f618d);}(_0xb03e,0x19a));var _0xeb03=function(_0x209dac,_0x5b323c){_0x209dac=_0x209dac-0x0;var _0x4a86df=_0xb03e[_0x209dac];return _0x4a86df;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xeb03('0x0'));var rp=require('request-promise');var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeb03('0x3'));var sox=require(_0xeb03('0x4'));var csv=require(_0xeb03('0x5'));var ejs=require(_0xeb03('0x6'));var fs=require('fs');var fs_extra=require(_0xeb03('0x7'));var _=require(_0xeb03('0x8'));var squel=require('squel');var crypto=require(_0xeb03('0x9'));var jsforce=require(_0xeb03('0xa'));var deskjs=require(_0xeb03('0xb'));var toCsv=require(_0xeb03('0x5'));var querystring=require(_0xeb03('0xc'));var Papa=require('papaparse');var Redis=require(_0xeb03('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xeb03('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb03('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeb03('0x10'));var db=require(_0xeb03('0x11'))['db'];function respondWithStatusCode(_0x568a80,_0x4a44c3){_0x4a44c3=_0x4a44c3||0xcc;return function(_0x2ad0bd){if(_0x2ad0bd){return _0x568a80[_0xeb03('0x12')](_0x4a44c3);}return _0x568a80[_0xeb03('0x13')](_0x4a44c3)[_0xeb03('0x14')]();};}function respondWithResult(_0x2b805f,_0x5e57aa){_0x5e57aa=_0x5e57aa||0xc8;return function(_0x26a5aa){if(_0x26a5aa){return _0x2b805f[_0xeb03('0x13')](_0x5e57aa)[_0xeb03('0x15')](_0x26a5aa);}};}function respondWithFilteredResult(_0x2f77d1,_0x382404){return function(_0x5b62ba){if(_0x5b62ba){var _0x36014a=typeof _0x382404[_0xeb03('0x16')]===_0xeb03('0x17')&&typeof _0x382404[_0xeb03('0x18')]===_0xeb03('0x17');var _0x594065=_0x5b62ba[_0xeb03('0x19')];var _0x32a48b=_0x36014a?0x0:_0x382404[_0xeb03('0x16')];var _0x4d8b82=_0x36014a?_0x5b62ba[_0xeb03('0x19')]:_0x382404['offset']+_0x382404[_0xeb03('0x18')];var _0x347074;if(_0x4d8b82>=_0x594065){_0x4d8b82=_0x594065;_0x347074=0xc8;}else{_0x347074=0xce;}_0x2f77d1[_0xeb03('0x13')](_0x347074);return _0x2f77d1[_0xeb03('0x1a')](_0xeb03('0x1b'),_0x32a48b+'-'+_0x4d8b82+'/'+_0x594065)[_0xeb03('0x15')](_0x5b62ba);}return null;};}function patchUpdates(_0xb70aaa){return function(_0x46b05e){try{jsonpatch[_0xeb03('0x1c')](_0x46b05e,_0xb70aaa,!![]);}catch(_0x310ad1){return BPromise[_0xeb03('0x1d')](_0x310ad1);}return _0x46b05e[_0xeb03('0x1e')]();};}function saveUpdates(_0xa7ccd1,_0x73d586){return function(_0x55c7b7){if(_0x55c7b7){return _0x55c7b7[_0xeb03('0x1f')](_0xa7ccd1)['then'](function(_0x501df3){return _0x501df3;});}return null;};}function removeEntity(_0x31ae5a,_0x380adf){return function(_0x10323e){if(_0x10323e){return _0x10323e[_0xeb03('0x20')]()[_0xeb03('0x21')](function(){_0x31ae5a[_0xeb03('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32cdb5,_0x33f1b9){return function(_0x296952){if(!_0x296952){_0x32cdb5[_0xeb03('0x12')](0x194);}return _0x296952;};}function handleError(_0x5d2ae7,_0xbecb71){_0xbecb71=_0xbecb71||0x1f4;return function(_0x204d7b){logger[_0xeb03('0x22')](_0x204d7b['stack']);if(_0x204d7b[_0xeb03('0x23')]){delete _0x204d7b['name'];}_0x5d2ae7[_0xeb03('0x13')](_0xbecb71)[_0xeb03('0x24')](_0x204d7b);};}exports['index']=function(_0x5ee4af,_0x285541){var _0x12789d={},_0x468210={},_0xf89e0c={'count':0x0,'rows':[]};var _0x59a8cc=_[_0xeb03('0x25')](db[_0xeb03('0x26')][_0xeb03('0x27')],function(_0x443e1c){return{'name':_0x443e1c[_0xeb03('0x28')],'type':_0x443e1c[_0xeb03('0x29')][_0xeb03('0x2a')]};});_0x468210[_0xeb03('0x2b')]=_[_0xeb03('0x25')](_0x59a8cc,'name');_0x468210[_0xeb03('0x2c')]=_[_0xeb03('0x2d')](_0x5ee4af[_0xeb03('0x2c')]);_0x468210[_0xeb03('0x2e')]=_[_0xeb03('0x2f')](_0x468210[_0xeb03('0x2b')],_0x468210[_0xeb03('0x2c')]);_0x12789d[_0xeb03('0x30')]=_[_0xeb03('0x2f')](_0x468210[_0xeb03('0x2b')],qs[_0xeb03('0x31')](_0x5ee4af[_0xeb03('0x2c')][_0xeb03('0x31')]));_0x12789d[_0xeb03('0x30')]=_0x12789d['attributes'][_0xeb03('0x32')]?_0x12789d['attributes']:_0x468210[_0xeb03('0x2b')];if(!_0x5ee4af[_0xeb03('0x2c')]['hasOwnProperty']('nolimit')){_0x12789d[_0xeb03('0x18')]=qs[_0xeb03('0x18')](_0x5ee4af['query'][_0xeb03('0x18')]);_0x12789d[_0xeb03('0x16')]=qs[_0xeb03('0x16')](_0x5ee4af[_0xeb03('0x2c')]['offset']);}_0x12789d['order']=qs[_0xeb03('0x33')](_0x5ee4af['query'][_0xeb03('0x33')]);_0x12789d[_0xeb03('0x34')]=qs[_0xeb03('0x2e')](_[_0xeb03('0x35')](_0x5ee4af['query'],_0x468210['filters']),_0x59a8cc);if(_0x5ee4af[_0xeb03('0x2c')]['filter']){_0x12789d['where']=_['merge'](_0x12789d[_0xeb03('0x34')],{'$or':_[_0xeb03('0x25')](_0x59a8cc,function(_0x4e134a){if(_0x4e134a['type']!==_0xeb03('0x36')){var _0x415e55={};_0x415e55[_0x4e134a[_0xeb03('0x23')]]={'$like':'%'+_0x5ee4af['query']['filter']+'%'};return _0x415e55;}})});}_0x12789d=_[_0xeb03('0x37')]({},_0x12789d,_0x5ee4af[_0xeb03('0x38')]);var _0x1a38c4={'where':_0x12789d[_0xeb03('0x34')]};return db[_0xeb03('0x26')][_0xeb03('0x19')](_0x1a38c4)[_0xeb03('0x21')](function(_0x7071c3){_0xf89e0c[_0xeb03('0x19')]=_0x7071c3;if(_0x5ee4af[_0xeb03('0x2c')][_0xeb03('0x39')]){_0x12789d[_0xeb03('0x3a')]=[{'all':!![]}];}return db['SugarcrmField'][_0xeb03('0x3b')](_0x12789d);})[_0xeb03('0x21')](function(_0x2670ef){_0xf89e0c[_0xeb03('0x3c')]=_0x2670ef;return _0xf89e0c;})[_0xeb03('0x21')](respondWithFilteredResult(_0x285541,_0x12789d))[_0xeb03('0x3d')](handleError(_0x285541,null));};exports[_0xeb03('0x3e')]=function(_0x2aa0dd,_0x847009){var _0x4e0c9e={'raw':!![],'where':{'id':_0x2aa0dd[_0xeb03('0x3f')]['id']}},_0x34d8b2={};_0x34d8b2[_0xeb03('0x2b')]=_[_0xeb03('0x2d')](db['SugarcrmField']['rawAttributes']);_0x34d8b2['query']=_[_0xeb03('0x2d')](_0x2aa0dd[_0xeb03('0x2c')]);_0x34d8b2[_0xeb03('0x2e')]=_[_0xeb03('0x2f')](_0x34d8b2[_0xeb03('0x2b')],_0x34d8b2[_0xeb03('0x2c')]);_0x4e0c9e[_0xeb03('0x30')]=_[_0xeb03('0x2f')](_0x34d8b2['model'],qs[_0xeb03('0x31')](_0x2aa0dd[_0xeb03('0x2c')][_0xeb03('0x31')]));_0x4e0c9e[_0xeb03('0x30')]=_0x4e0c9e[_0xeb03('0x30')][_0xeb03('0x32')]?_0x4e0c9e[_0xeb03('0x30')]:_0x34d8b2[_0xeb03('0x2b')];if(_0x2aa0dd[_0xeb03('0x2c')][_0xeb03('0x39')]){_0x4e0c9e[_0xeb03('0x3a')]=[{'all':!![]}];}_0x4e0c9e=_['merge']({},_0x4e0c9e,_0x2aa0dd['options']);return db[_0xeb03('0x26')][_0xeb03('0x40')](_0x4e0c9e)[_0xeb03('0x21')](handleEntityNotFound(_0x847009,null))[_0xeb03('0x21')](respondWithResult(_0x847009,null))[_0xeb03('0x3d')](handleError(_0x847009,null));};exports[_0xeb03('0x41')]=function(_0x5b2d76,_0x5dec6a){return db['SugarcrmField'][_0xeb03('0x41')](_0x5b2d76['body'],{})[_0xeb03('0x21')](respondWithResult(_0x5dec6a,0xc9))[_0xeb03('0x3d')](handleError(_0x5dec6a,null));};exports['update']=function(_0x218e4c,_0x105363){if(_0x218e4c[_0xeb03('0x42')]['id']){delete _0x218e4c[_0xeb03('0x42')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x218e4c[_0xeb03('0x3f')]['id']}})[_0xeb03('0x21')](handleEntityNotFound(_0x105363,null))[_0xeb03('0x21')](saveUpdates(_0x218e4c[_0xeb03('0x42')],null))['then'](respondWithResult(_0x105363,null))[_0xeb03('0x3d')](handleError(_0x105363,null));};exports[_0xeb03('0x20')]=function(_0x53883e,_0x3b1ee5){return db[_0xeb03('0x26')][_0xeb03('0x40')]({'where':{'id':_0x53883e[_0xeb03('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3b1ee5,null))[_0xeb03('0x21')](removeEntity(_0x3b1ee5,null))['catch'](handleError(_0x3b1ee5,null));}; \ No newline at end of file +var _0x1c5c=['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','json','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','SugarcrmField','includeAll','include','findAll','rows','catch','params','intersection','find','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3557d0,_0x39f204){var _0x38d56c=function(_0x5a582e){while(--_0x5a582e){_0x3557d0['push'](_0x3557d0['shift']());}};_0x38d56c(++_0x39f204);}(_0x1c5c,0x124));var _0xc1c5=function(_0x24e242,_0x313cf9){_0x24e242=_0x24e242-0x0;var _0xd6e537=_0x1c5c[_0x24e242];return _0xd6e537;};'use strict';var emlformat=require(_0xc1c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1c5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc1c5('0x2'));var moment=require(_0xc1c5('0x3'));var BPromise=require(_0xc1c5('0x4'));var Mustache=require('mustache');var util=require(_0xc1c5('0x5'));var path=require(_0xc1c5('0x6'));var sox=require(_0xc1c5('0x7'));var csv=require(_0xc1c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1c5('0x9'));var _=require(_0xc1c5('0xa'));var squel=require(_0xc1c5('0xb'));var crypto=require(_0xc1c5('0xc'));var jsforce=require(_0xc1c5('0xd'));var deskjs=require(_0xc1c5('0xe'));var toCsv=require(_0xc1c5('0x8'));var querystring=require(_0xc1c5('0xf'));var Papa=require(_0xc1c5('0x10'));var Redis=require(_0xc1c5('0x11'));var authService=require(_0xc1c5('0x12'));var qs=require(_0xc1c5('0x13'));var as=require(_0xc1c5('0x14'));var hardwareService=require(_0xc1c5('0x15'));var logger=require(_0xc1c5('0x16'))(_0xc1c5('0x17'));var utils=require(_0xc1c5('0x18'));var config=require(_0xc1c5('0x19'));var licenseUtil=require(_0xc1c5('0x1a'));var db=require(_0xc1c5('0x1b'))['db'];function respondWithStatusCode(_0x5d3757,_0x4dfa28){_0x4dfa28=_0x4dfa28||0xcc;return function(_0x4ce8c3){if(_0x4ce8c3){return _0x5d3757[_0xc1c5('0x1c')](_0x4dfa28);}return _0x5d3757['status'](_0x4dfa28)[_0xc1c5('0x1d')]();};}function respondWithResult(_0x42a352,_0x199131){_0x199131=_0x199131||0xc8;return function(_0xc3e371){if(_0xc3e371){return _0x42a352[_0xc1c5('0x1e')](_0x199131)['json'](_0xc3e371);}};}function respondWithFilteredResult(_0x2fa8a7,_0x8f0321){return function(_0x5c41ed){if(_0x5c41ed){var _0xf38f35=typeof _0x8f0321['offset']===_0xc1c5('0x1f')&&typeof _0x8f0321[_0xc1c5('0x20')]==='undefined';var _0x36dea5=_0x5c41ed[_0xc1c5('0x21')];var _0x629e9=_0xf38f35?0x0:_0x8f0321[_0xc1c5('0x22')];var _0x5939dc=_0xf38f35?_0x5c41ed['count']:_0x8f0321[_0xc1c5('0x22')]+_0x8f0321[_0xc1c5('0x20')];var _0x2685be;if(_0x5939dc>=_0x36dea5){_0x5939dc=_0x36dea5;_0x2685be=0xc8;}else{_0x2685be=0xce;}_0x2fa8a7[_0xc1c5('0x1e')](_0x2685be);return _0x2fa8a7[_0xc1c5('0x23')]('Content-Range',_0x629e9+'-'+_0x5939dc+'/'+_0x36dea5)[_0xc1c5('0x24')](_0x5c41ed);}return null;};}function patchUpdates(_0xb02a48){return function(_0xa3bb){try{jsonpatch[_0xc1c5('0x25')](_0xa3bb,_0xb02a48,!![]);}catch(_0x1c780c){return BPromise[_0xc1c5('0x26')](_0x1c780c);}return _0xa3bb[_0xc1c5('0x27')]();};}function saveUpdates(_0x32c69f,_0x2b59e2){return function(_0x2c4337){if(_0x2c4337){return _0x2c4337[_0xc1c5('0x28')](_0x32c69f)[_0xc1c5('0x29')](function(_0xa1a18){return _0xa1a18;});}return null;};}function removeEntity(_0x4e410a,_0x2a7715){return function(_0x41cec3){if(_0x41cec3){return _0x41cec3['destroy']()[_0xc1c5('0x29')](function(){_0x4e410a[_0xc1c5('0x1e')](0xcc)[_0xc1c5('0x1d')]();});}};}function handleEntityNotFound(_0x43c196,_0x306d50){return function(_0x30e5ad){if(!_0x30e5ad){_0x43c196[_0xc1c5('0x1c')](0x194);}return _0x30e5ad;};}function handleError(_0x52e2d5,_0x61fe37){_0x61fe37=_0x61fe37||0x1f4;return function(_0x1613d5){logger[_0xc1c5('0x2a')](_0x1613d5[_0xc1c5('0x2b')]);if(_0x1613d5[_0xc1c5('0x2c')]){delete _0x1613d5[_0xc1c5('0x2c')];}_0x52e2d5[_0xc1c5('0x1e')](_0x61fe37)['send'](_0x1613d5);};}exports[_0xc1c5('0x2d')]=function(_0x4c3904,_0x4f38d0){var _0x29e41b={},_0x408c17={},_0x34b8a8={'count':0x0,'rows':[]};var _0x20d008=_[_0xc1c5('0x2e')](db['SugarcrmField'][_0xc1c5('0x2f')],function(_0x3c2273){return{'name':_0x3c2273[_0xc1c5('0x30')],'type':_0x3c2273[_0xc1c5('0x31')][_0xc1c5('0x32')]};});_0x408c17['model']=_[_0xc1c5('0x2e')](_0x20d008,_0xc1c5('0x2c'));_0x408c17[_0xc1c5('0x33')]=_[_0xc1c5('0x34')](_0x4c3904['query']);_0x408c17[_0xc1c5('0x35')]=_['intersection'](_0x408c17[_0xc1c5('0x36')],_0x408c17[_0xc1c5('0x33')]);_0x29e41b['attributes']=_['intersection'](_0x408c17[_0xc1c5('0x36')],qs['fields'](_0x4c3904['query'][_0xc1c5('0x37')]));_0x29e41b[_0xc1c5('0x38')]=_0x29e41b[_0xc1c5('0x38')][_0xc1c5('0x39')]?_0x29e41b['attributes']:_0x408c17[_0xc1c5('0x36')];if(!_0x4c3904[_0xc1c5('0x33')][_0xc1c5('0x3a')](_0xc1c5('0x3b'))){_0x29e41b['limit']=qs[_0xc1c5('0x20')](_0x4c3904[_0xc1c5('0x33')][_0xc1c5('0x20')]);_0x29e41b[_0xc1c5('0x22')]=qs[_0xc1c5('0x22')](_0x4c3904[_0xc1c5('0x33')][_0xc1c5('0x22')]);}_0x29e41b[_0xc1c5('0x3c')]=qs[_0xc1c5('0x3d')](_0x4c3904[_0xc1c5('0x33')][_0xc1c5('0x3d')]);_0x29e41b[_0xc1c5('0x3e')]=qs[_0xc1c5('0x35')](_[_0xc1c5('0x3f')](_0x4c3904[_0xc1c5('0x33')],_0x408c17[_0xc1c5('0x35')]),_0x20d008);if(_0x4c3904[_0xc1c5('0x33')]['filter']){_0x29e41b[_0xc1c5('0x3e')]=_[_0xc1c5('0x40')](_0x29e41b[_0xc1c5('0x3e')],{'$or':_['map'](_0x20d008,function(_0x522066){if(_0x522066['type']!==_0xc1c5('0x41')){var _0x18111d={};_0x18111d[_0x522066[_0xc1c5('0x2c')]]={'$like':'%'+_0x4c3904[_0xc1c5('0x33')]['filter']+'%'};return _0x18111d;}})});}_0x29e41b=_[_0xc1c5('0x40')]({},_0x29e41b,_0x4c3904[_0xc1c5('0x42')]);var _0x35dd6d={'where':_0x29e41b[_0xc1c5('0x3e')]};return db[_0xc1c5('0x43')][_0xc1c5('0x21')](_0x35dd6d)[_0xc1c5('0x29')](function(_0x31b07a){_0x34b8a8[_0xc1c5('0x21')]=_0x31b07a;if(_0x4c3904[_0xc1c5('0x33')][_0xc1c5('0x44')]){_0x29e41b[_0xc1c5('0x45')]=[{'all':!![]}];}return db[_0xc1c5('0x43')][_0xc1c5('0x46')](_0x29e41b);})[_0xc1c5('0x29')](function(_0x7ab98c){_0x34b8a8[_0xc1c5('0x47')]=_0x7ab98c;return _0x34b8a8;})['then'](respondWithFilteredResult(_0x4f38d0,_0x29e41b))[_0xc1c5('0x48')](handleError(_0x4f38d0,null));};exports['show']=function(_0x56cac,_0x520f31){var _0x672abd={'raw':!![],'where':{'id':_0x56cac[_0xc1c5('0x49')]['id']}},_0x1da74f={};_0x1da74f['model']=_[_0xc1c5('0x34')](db[_0xc1c5('0x43')][_0xc1c5('0x2f')]);_0x1da74f[_0xc1c5('0x33')]=_['keys'](_0x56cac[_0xc1c5('0x33')]);_0x1da74f['filters']=_['intersection'](_0x1da74f['model'],_0x1da74f[_0xc1c5('0x33')]);_0x672abd['attributes']=_[_0xc1c5('0x4a')](_0x1da74f['model'],qs[_0xc1c5('0x37')](_0x56cac[_0xc1c5('0x33')]['fields']));_0x672abd[_0xc1c5('0x38')]=_0x672abd[_0xc1c5('0x38')]['length']?_0x672abd[_0xc1c5('0x38')]:_0x1da74f['model'];if(_0x56cac[_0xc1c5('0x33')][_0xc1c5('0x44')]){_0x672abd[_0xc1c5('0x45')]=[{'all':!![]}];}_0x672abd=_[_0xc1c5('0x40')]({},_0x672abd,_0x56cac['options']);return db[_0xc1c5('0x43')][_0xc1c5('0x4b')](_0x672abd)[_0xc1c5('0x29')](handleEntityNotFound(_0x520f31,null))[_0xc1c5('0x29')](respondWithResult(_0x520f31,null))[_0xc1c5('0x48')](handleError(_0x520f31,null));};exports['create']=function(_0x28f043,_0x4de28c){return db[_0xc1c5('0x43')]['create'](_0x28f043[_0xc1c5('0x4c')],{})['then'](respondWithResult(_0x4de28c,0xc9))[_0xc1c5('0x48')](handleError(_0x4de28c,null));};exports[_0xc1c5('0x28')]=function(_0x5ec8b1,_0x3a40e4){if(_0x5ec8b1[_0xc1c5('0x4c')]['id']){delete _0x5ec8b1['body']['id'];}return db[_0xc1c5('0x43')][_0xc1c5('0x4b')]({'where':{'id':_0x5ec8b1['params']['id']}})['then'](handleEntityNotFound(_0x3a40e4,null))[_0xc1c5('0x29')](saveUpdates(_0x5ec8b1['body'],null))[_0xc1c5('0x29')](respondWithResult(_0x3a40e4,null))['catch'](handleError(_0x3a40e4,null));};exports['destroy']=function(_0x2e8046,_0x297f08){return db[_0xc1c5('0x43')]['find']({'where':{'id':_0x2e8046[_0xc1c5('0x49')]['id']}})[_0xc1c5('0x29')](handleEntityNotFound(_0x297f08,null))[_0xc1c5('0x29')](removeEntity(_0x297f08,null))[_0xc1c5('0x48')](handleError(_0x297f08,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 7393071..8db2392 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 _0xa941=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x1a0011,_0x32b202){var _0x49bfb2=function(_0x2ecc23){while(--_0x2ecc23){_0x1a0011['push'](_0x1a0011['shift']());}};_0x49bfb2(++_0x32b202);}(_0xa941,0x1e0));var _0x1a94=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa941[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x1a94('0x0'));var logger=require(_0x1a94('0x1'))(_0x1a94('0x2'));var moment=require('moment');var BPromise=require(_0x1a94('0x3'));var rp=require(_0x1a94('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a94('0x5'));var config=require('../../config/environment');var attributes=require(_0x1a94('0x6'));module[_0x1a94('0x7')]=function(_0x1e1da9,_0x3dec76){return _0x1e1da9[_0x1a94('0x8')](_0x1a94('0x9'),attributes,{'tableName':_0x1a94('0xa'),'paranoid':![],'indexes':[{'name':_0x1a94('0xb'),'fields':[_0x1a94('0xc'),_0x1a94('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f0b=['define','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x2d775e,_0x4c0165){var _0x47e959=function(_0x558ee4){while(--_0x558ee4){_0x2d775e['push'](_0x2d775e['shift']());}};_0x47e959(++_0x4c0165);}(_0x4f0b,0x124));var _0xb4f0=function(_0x2470d2,_0x6b5ff1){_0x2470d2=_0x2470d2-0x0;var _0x1dfb0c=_0x4f0b[_0x2470d2];return _0x1dfb0c;};'use strict';var _=require(_0xb4f0('0x0'));var util=require(_0xb4f0('0x1'));var logger=require(_0xb4f0('0x2'))(_0xb4f0('0x3'));var moment=require(_0xb4f0('0x4'));var BPromise=require(_0xb4f0('0x5'));var rp=require(_0xb4f0('0x6'));var fs=require('fs');var path=require(_0xb4f0('0x7'));var rimraf=require(_0xb4f0('0x8'));var config=require(_0xb4f0('0x9'));var attributes=require(_0xb4f0('0xa'));module[_0xb4f0('0xb')]=function(_0x58d257,_0x19ad05){return _0x58d257[_0xb4f0('0xc')]('SugarcrmField',attributes,{'tableName':_0xb4f0('0xd'),'paranoid':![],'indexes':[{'name':_0xb4f0('0xe'),'fields':[_0xb4f0('0xf'),'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 074baf3..8668bf6 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 _0x975b=['../../config/environment','jayson/promise','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x239d8f,_0x59d10e){var _0x1597d6=function(_0x68afba){while(--_0x68afba){_0x239d8f['push'](_0x239d8f['shift']());}};_0x1597d6(++_0x59d10e);}(_0x975b,0x66));var _0xb975=function(_0xba92a7,_0x32cf31){_0xba92a7=_0xba92a7-0x0;var _0x2b7eda=_0x975b[_0xba92a7];return _0x2b7eda;};'use strict';var _=require('lodash');var util=require(_0xb975('0x0'));var moment=require(_0xb975('0x1'));var BPromise=require(_0xb975('0x2'));var rs=require(_0xb975('0x3'));var fs=require('fs');var Redis=require(_0xb975('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb975('0x5'));var logger=require(_0xb975('0x6'))(_0xb975('0x7'));var config=require(_0xb975('0x8'));var jayson=require(_0xb975('0x9'));var client=jayson['client'][_0xb975('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x513305,_0x592b12,_0x11b80b){return new BPromise(function(_0x327823,_0x57f1f3){return client[_0xb975('0xb')](_0x513305,_0x11b80b)['then'](function(_0x277340){logger[_0xb975('0xc')](_0xb975('0xd'),_0x592b12,_0xb975('0xe'));logger['debug'](_0xb975('0xf'),_0x592b12,'request\x20sent',JSON[_0xb975('0x10')](_0x277340));if(_0x277340['error']){if(_0x277340[_0xb975('0x11')][_0xb975('0x12')]===0x1f4){logger[_0xb975('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x592b12,_0x277340[_0xb975('0x11')][_0xb975('0x13')]);return _0x57f1f3(_0x277340['error']['message']);}logger[_0xb975('0x11')](_0xb975('0xd'),_0x592b12,_0x277340['error'][_0xb975('0x13')]);return _0x327823(_0x277340[_0xb975('0x11')]['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x592b12,_0xb975('0xe'));_0x327823(_0x277340[_0xb975('0x14')][_0xb975('0x13')]);}})[_0xb975('0x15')](function(_0x4843c0){logger[_0xb975('0x11')](_0xb975('0xd'),_0x592b12,_0x4843c0);_0x57f1f3(_0x4843c0);});});} \ No newline at end of file +var _0x8898=['../../config/logger','../../config/environment','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1cc8b5,_0x304d71){var _0x2b2c7a=function(_0x2211d2){while(--_0x2211d2){_0x1cc8b5['push'](_0x1cc8b5['shift']());}};_0x2b2c7a(++_0x304d71);}(_0x8898,0x163));var _0x8889=function(_0x472579,_0x3cef12){_0x472579=_0x472579-0x0;var _0x5148a7=_0x8898[_0x472579];return _0x5148a7;};'use strict';var _=require(_0x8889('0x0'));var util=require('util');var moment=require(_0x8889('0x1'));var BPromise=require(_0x8889('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8889('0x3'));var db=require(_0x8889('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8889('0x5'))('rpc');var config=require(_0x8889('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8889('0x7')][_0x8889('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xefbbdd,_0x205df5,_0x127d5e){return new BPromise(function(_0x1c8ee1,_0x553384){return client[_0x8889('0x9')](_0xefbbdd,_0x127d5e)[_0x8889('0xa')](function(_0x3477ed){logger['info'](_0x8889('0xb'),_0x205df5,_0x8889('0xc'));logger[_0x8889('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x205df5,'request\x20sent',JSON['stringify'](_0x3477ed));if(_0x3477ed['error']){if(_0x3477ed[_0x8889('0xe')]['code']===0x1f4){logger[_0x8889('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x205df5,_0x3477ed[_0x8889('0xe')][_0x8889('0xf')]);return _0x553384(_0x3477ed[_0x8889('0xe')][_0x8889('0xf')]);}logger[_0x8889('0xe')](_0x8889('0xb'),_0x205df5,_0x3477ed['error']['message']);return _0x1c8ee1(_0x3477ed[_0x8889('0xe')][_0x8889('0xf')]);}else{logger['info'](_0x8889('0xb'),_0x205df5,_0x8889('0xc'));_0x1c8ee1(_0x3477ed[_0x8889('0x10')][_0x8889('0xf')]);}})[_0x8889('0x11')](function(_0xd1d103){logger[_0x8889('0xe')](_0x8889('0xb'),_0x205df5,_0xd1d103);_0x553384(_0xd1d103);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 6ad474f..2ee1ba0 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 _0x6fb8=['getFields','post','create','addConfiguration','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x503102,_0x79b68c){var _0x5e0089=function(_0x4ee065){while(--_0x4ee065){_0x503102['push'](_0x503102['shift']());}};_0x5e0089(++_0x79b68c);}(_0x6fb8,0x104));var _0x86fb=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0x6fb8[_0x12c280];return _0x3638d3;};'use strict';var multer=require(_0x86fb('0x0'));var util=require('util');var path=require(_0x86fb('0x1'));var timeout=require(_0x86fb('0x2'));var express=require('express');var router=express[_0x86fb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x86fb('0x4'));var config=require(_0x86fb('0x5'));var controller=require(_0x86fb('0x6'));router[_0x86fb('0x7')]('/',auth[_0x86fb('0x8')](),controller[_0x86fb('0x9')]);router[_0x86fb('0x7')](_0x86fb('0xa'),auth[_0x86fb('0x8')](),controller[_0x86fb('0xb')]);router[_0x86fb('0x7')](_0x86fb('0xc'),auth[_0x86fb('0x8')](),controller['getConfigurations']);router[_0x86fb('0x7')]('/:id/fields',auth[_0x86fb('0x8')](),controller[_0x86fb('0xd')]);router[_0x86fb('0xe')]('/',auth['isAuthenticated'](),controller[_0x86fb('0xf')]);router['post'](_0x86fb('0xc'),auth[_0x86fb('0x8')](),controller[_0x86fb('0x10')]);router[_0x86fb('0x11')](_0x86fb('0xa'),auth[_0x86fb('0x8')](),controller[_0x86fb('0x12')]);router[_0x86fb('0x13')](_0x86fb('0xa'),auth[_0x86fb('0x8')](),controller['destroy']);module[_0x86fb('0x14')]=router; \ No newline at end of file +var _0x7b5b=['../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','getConfigurations','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x523122,_0x467f48){var _0x1250e2=function(_0x37d837){while(--_0x37d837){_0x523122['push'](_0x523122['shift']());}};_0x1250e2(++_0x467f48);}(_0x7b5b,0x14a));var _0xb7b5=function(_0x18bcd9,_0x1a586d){_0x18bcd9=_0x18bcd9-0x0;var _0x239579=_0x7b5b[_0x18bcd9];return _0x239579;};'use strict';var multer=require('multer');var util=require(_0xb7b5('0x0'));var path=require(_0xb7b5('0x1'));var timeout=require(_0xb7b5('0x2'));var express=require(_0xb7b5('0x3'));var router=express[_0xb7b5('0x4')]();var fs_extra=require(_0xb7b5('0x5'));var auth=require(_0xb7b5('0x6'));var interaction=require(_0xb7b5('0x7'));var config=require(_0xb7b5('0x8'));var controller=require(_0xb7b5('0x9'));router[_0xb7b5('0xa')]('/',auth[_0xb7b5('0xb')](),controller[_0xb7b5('0xc')]);router[_0xb7b5('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb7b5('0xd')]);router[_0xb7b5('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xb7b5('0xe')]);router[_0xb7b5('0xa')]('/:id/fields',auth[_0xb7b5('0xb')](),controller[_0xb7b5('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb7b5('0x10')]);router[_0xb7b5('0x11')](_0xb7b5('0x12'),auth['isAuthenticated'](),controller[_0xb7b5('0x13')]);router[_0xb7b5('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb7b5('0x15')]);router[_0xb7b5('0x16')](_0xb7b5('0x17'),auth[_0xb7b5('0xb')](),controller[_0xb7b5('0x18')]);module[_0xb7b5('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 9db6265..c998664 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 _0xbd62=['exports','STRING','HelpDesk'];(function(_0x5d7c45,_0x7f1fe0){var _0x196a18=function(_0x3aecc7){while(--_0x3aecc7){_0x5d7c45['push'](_0x5d7c45['shift']());}};_0x196a18(++_0x7f1fe0);}(_0xbd62,0x99));var _0x2bd6=function(_0x16ce40,_0xbc8451){_0x16ce40=_0x16ce40-0x0;var _0x227e2b=_0xbd62[_0x16ce40];return _0x227e2b;};'use strict';var Sequelize=require('sequelize');module[_0x2bd6('0x0')]={'name':{'type':Sequelize[_0x2bd6('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2bd6('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2bd6('0x1')],'allowNull':![],'defaultValue':_0x2bd6('0x2')},'remoteUri':{'type':Sequelize[_0x2bd6('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2bd6('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2bd6('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5f39=['STRING'];(function(_0x77f62f,_0x78b5d0){var _0x22030c=function(_0x60ab73){while(--_0x60ab73){_0x77f62f['push'](_0x77f62f['shift']());}};_0x22030c(++_0x78b5d0);}(_0x5f39,0x111));var _0x95f3=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5f39[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x95f3('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x95f3('0x0')]},'username':{'type':Sequelize[_0x95f3('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x95f3('0x0')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x95f3('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x95f3('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x95f3('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 2ac8f97..8bfa7e1 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 _0xf2c8=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','then','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','getConfigurations','VtigerConfiguration','rawAttributes','merge','options','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','VtigerField','getFields','username','remoteUri','accessKey','moduleName','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','token','describe','result','sessionName','reference','remove','includes','false','startsWith','cf_','picklist','label','value','log','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','apply','reject','save','destroy','error','stack','name','send','VtigerAccount','fieldName','type','key','model','map','query','keys','attributes','intersection','fields'];(function(_0xfbaa0,_0x15dc0d){var _0xda5936=function(_0x291658){while(--_0x291658){_0xfbaa0['push'](_0xfbaa0['shift']());}};_0xda5936(++_0x15dc0d);}(_0xf2c8,0xb3));var _0x8f2c=function(_0x5cc91a,_0x27a981){_0x5cc91a=_0x5cc91a-0x0;var _0x282cd6=_0xf2c8[_0x5cc91a];return _0x282cd6;};'use strict';var emlformat=require(_0x8f2c('0x0'));var rimraf=require(_0x8f2c('0x1'));var zipdir=require(_0x8f2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8f2c('0x3'));var moment=require(_0x8f2c('0x4'));var BPromise=require(_0x8f2c('0x5'));var Mustache=require(_0x8f2c('0x6'));var util=require(_0x8f2c('0x7'));var path=require(_0x8f2c('0x8'));var sox=require(_0x8f2c('0x9'));var csv=require('to-csv');var ejs=require(_0x8f2c('0xa'));var fs=require('fs');var fs_extra=require(_0x8f2c('0xb'));var _=require('lodash');var squel=require(_0x8f2c('0xc'));var crypto=require(_0x8f2c('0xd'));var jsforce=require(_0x8f2c('0xe'));var deskjs=require(_0x8f2c('0xf'));var toCsv=require(_0x8f2c('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8f2c('0x11'));var qs=require(_0x8f2c('0x12'));var as=require(_0x8f2c('0x13'));var hardwareService=require(_0x8f2c('0x14'));var logger=require('../../config/logger')(_0x8f2c('0x15'));var utils=require(_0x8f2c('0x16'));var config=require(_0x8f2c('0x17'));var licenseUtil=require(_0x8f2c('0x18'));var db=require(_0x8f2c('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2bbb2c,_0xf5177e){_0xf5177e=_0xf5177e||0xcc;return function(_0x3a114a){if(_0x3a114a){return _0x2bbb2c[_0x8f2c('0x1a')](_0xf5177e);}return _0x2bbb2c['status'](_0xf5177e)[_0x8f2c('0x1b')]();};}function respondWithResult(_0x6c2b59,_0x17177b){_0x17177b=_0x17177b||0xc8;return function(_0xabe9c7){if(_0xabe9c7){return _0x6c2b59[_0x8f2c('0x1c')](_0x17177b)[_0x8f2c('0x1d')](_0xabe9c7);}};}function respondWithFilteredResult(_0x8d3838,_0x4618a7){return function(_0x35c6fe){if(_0x35c6fe){var _0x417850=typeof _0x4618a7[_0x8f2c('0x1e')]==='undefined'&&typeof _0x4618a7[_0x8f2c('0x1f')]==='undefined';var _0x217c91=_0x35c6fe['count'];var _0x1cc220=_0x417850?0x0:_0x4618a7[_0x8f2c('0x1e')];var _0x4cde74=_0x417850?_0x35c6fe[_0x8f2c('0x20')]:_0x4618a7[_0x8f2c('0x1e')]+_0x4618a7['limit'];var _0x173e96;if(_0x4cde74>=_0x217c91){_0x4cde74=_0x217c91;_0x173e96=0xc8;}else{_0x173e96=0xce;}_0x8d3838[_0x8f2c('0x1c')](_0x173e96);return _0x8d3838[_0x8f2c('0x21')]('Content-Range',_0x1cc220+'-'+_0x4cde74+'/'+_0x217c91)[_0x8f2c('0x1d')](_0x35c6fe);}return null;};}function patchUpdates(_0x2f3511){return function(_0x599b36){try{jsonpatch[_0x8f2c('0x22')](_0x599b36,_0x2f3511,!![]);}catch(_0x13e5cf){return BPromise[_0x8f2c('0x23')](_0x13e5cf);}return _0x599b36[_0x8f2c('0x24')]();};}function saveUpdates(_0x2a025d,_0x296e23){return function(_0x484f8f){if(_0x484f8f){return _0x484f8f['update'](_0x2a025d)['then'](function(_0x2a7111){return _0x2a7111;});}return null;};}function removeEntity(_0x139ddc,_0xfbe8c8){return function(_0x201964){if(_0x201964){return _0x201964[_0x8f2c('0x25')]()['then'](function(){_0x139ddc[_0x8f2c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c966a,_0x17638d){return function(_0x1388e9){if(!_0x1388e9){_0x5c966a[_0x8f2c('0x1a')](0x194);}return _0x1388e9;};}function handleError(_0x47ec5e,_0x1f98b9){_0x1f98b9=_0x1f98b9||0x1f4;return function(_0x4d7ce3){logger[_0x8f2c('0x26')](_0x4d7ce3[_0x8f2c('0x27')]);if(_0x4d7ce3[_0x8f2c('0x28')]){delete _0x4d7ce3[_0x8f2c('0x28')];}_0x47ec5e[_0x8f2c('0x1c')](_0x1f98b9)[_0x8f2c('0x29')](_0x4d7ce3);};}exports['index']=function(_0x572f5e,_0x16401f){var _0x880d5d={},_0x570778={},_0x1c1acc={'count':0x0,'rows':[]};var _0x56c686=_['map'](db[_0x8f2c('0x2a')]['rawAttributes'],function(_0xb7361e){return{'name':_0xb7361e[_0x8f2c('0x2b')],'type':_0xb7361e[_0x8f2c('0x2c')][_0x8f2c('0x2d')]};});_0x570778[_0x8f2c('0x2e')]=_[_0x8f2c('0x2f')](_0x56c686,_0x8f2c('0x28'));_0x570778[_0x8f2c('0x30')]=_[_0x8f2c('0x31')](_0x572f5e[_0x8f2c('0x30')]);_0x570778['filters']=_['intersection'](_0x570778[_0x8f2c('0x2e')],_0x570778[_0x8f2c('0x30')]);_0x880d5d[_0x8f2c('0x32')]=_[_0x8f2c('0x33')](_0x570778[_0x8f2c('0x2e')],qs['fields'](_0x572f5e['query'][_0x8f2c('0x34')]));_0x880d5d[_0x8f2c('0x32')]=_0x880d5d['attributes']['length']?_0x880d5d[_0x8f2c('0x32')]:_0x570778['model'];if(!_0x572f5e[_0x8f2c('0x30')][_0x8f2c('0x35')](_0x8f2c('0x36'))){_0x880d5d[_0x8f2c('0x1f')]=qs[_0x8f2c('0x1f')](_0x572f5e[_0x8f2c('0x30')]['limit']);_0x880d5d[_0x8f2c('0x1e')]=qs['offset'](_0x572f5e[_0x8f2c('0x30')][_0x8f2c('0x1e')]);}_0x880d5d[_0x8f2c('0x37')]=qs[_0x8f2c('0x38')](_0x572f5e[_0x8f2c('0x30')][_0x8f2c('0x38')]);_0x880d5d[_0x8f2c('0x39')]=qs[_0x8f2c('0x3a')](_[_0x8f2c('0x3b')](_0x572f5e['query'],_0x570778[_0x8f2c('0x3a')]),_0x56c686);if(_0x572f5e['query'][_0x8f2c('0x3c')]){_0x880d5d[_0x8f2c('0x39')]=_['merge'](_0x880d5d[_0x8f2c('0x39')],{'$or':_['map'](_0x56c686,function(_0x16bdf5){if(_0x16bdf5[_0x8f2c('0x2c')]!==_0x8f2c('0x3d')){var _0x9d8ba7={};_0x9d8ba7[_0x16bdf5['name']]={'$like':'%'+_0x572f5e[_0x8f2c('0x30')][_0x8f2c('0x3c')]+'%'};return _0x9d8ba7;}})});}_0x880d5d=_['merge']({},_0x880d5d,_0x572f5e['options']);var _0x31d18e={'where':_0x880d5d['where']};return db[_0x8f2c('0x2a')][_0x8f2c('0x20')](_0x31d18e)[_0x8f2c('0x3e')](function(_0x4c8ce3){_0x1c1acc[_0x8f2c('0x20')]=_0x4c8ce3;if(_0x572f5e[_0x8f2c('0x30')][_0x8f2c('0x3f')]){_0x880d5d['include']=[{'all':!![]}];}return db[_0x8f2c('0x2a')][_0x8f2c('0x40')](_0x880d5d);})[_0x8f2c('0x3e')](function(_0x1ba749){_0x1c1acc[_0x8f2c('0x41')]=_0x1ba749;return _0x1c1acc;})['then'](respondWithFilteredResult(_0x16401f,_0x880d5d))[_0x8f2c('0x42')](handleError(_0x16401f,null));};exports[_0x8f2c('0x43')]=function(_0x291687,_0x15b232){var _0x168373={'raw':![],'where':{'id':_0x291687['params']['id']}},_0x4bc560={};_0x4bc560['model']=_[_0x8f2c('0x31')](db[_0x8f2c('0x2a')]['rawAttributes']);_0x4bc560['query']=_[_0x8f2c('0x31')](_0x291687[_0x8f2c('0x30')]);_0x4bc560[_0x8f2c('0x3a')]=_[_0x8f2c('0x33')](_0x4bc560[_0x8f2c('0x2e')],_0x4bc560[_0x8f2c('0x30')]);_0x168373[_0x8f2c('0x32')]=_[_0x8f2c('0x33')](_0x4bc560[_0x8f2c('0x2e')],qs['fields'](_0x291687[_0x8f2c('0x30')][_0x8f2c('0x34')]));_0x168373['attributes']=_0x168373[_0x8f2c('0x32')][_0x8f2c('0x44')]?_0x168373[_0x8f2c('0x32')]:_0x4bc560[_0x8f2c('0x2e')];if(_0x291687[_0x8f2c('0x30')][_0x8f2c('0x3f')]){_0x168373[_0x8f2c('0x45')]=[{'all':!![]}];}_0x168373=_['merge']({},_0x168373,_0x291687['options']);return db[_0x8f2c('0x2a')][_0x8f2c('0x46')](_0x168373)[_0x8f2c('0x3e')](handleEntityNotFound(_0x15b232,null))['then'](respondWithResult(_0x15b232,null))[_0x8f2c('0x42')](handleError(_0x15b232,null));};exports[_0x8f2c('0x47')]=function(_0x1c37eb,_0x25d8f0){return db['VtigerAccount'][_0x8f2c('0x47')](_0x1c37eb[_0x8f2c('0x48')],{})['then'](respondWithResult(_0x25d8f0,0xc9))[_0x8f2c('0x42')](handleError(_0x25d8f0,null));};exports['update']=function(_0x194b36,_0xf7d0d2){if(_0x194b36[_0x8f2c('0x48')]['id']){delete _0x194b36['body']['id'];}return db['VtigerAccount'][_0x8f2c('0x46')]({'where':{'id':_0x194b36[_0x8f2c('0x49')]['id']}})[_0x8f2c('0x3e')](handleEntityNotFound(_0xf7d0d2,null))[_0x8f2c('0x3e')](saveUpdates(_0x194b36[_0x8f2c('0x48')],null))[_0x8f2c('0x3e')](respondWithResult(_0xf7d0d2,null))['catch'](handleError(_0xf7d0d2,null));};exports[_0x8f2c('0x25')]=function(_0x1d5bc9,_0x54a2e2){return db[_0x8f2c('0x2a')]['find']({'where':{'id':_0x1d5bc9[_0x8f2c('0x49')]['id']}})[_0x8f2c('0x3e')](handleEntityNotFound(_0x54a2e2,null))[_0x8f2c('0x3e')](removeEntity(_0x54a2e2,null))[_0x8f2c('0x42')](handleError(_0x54a2e2,null));};exports[_0x8f2c('0x4a')]=function(_0x11914b,_0x38d4c7,_0x30363a){var _0x442479={};var _0x47de79={};var _0x488471;var _0x2e7001;return db[_0x8f2c('0x2a')]['findOne']({'where':{'id':_0x11914b[_0x8f2c('0x49')]['id']}})['then'](handleEntityNotFound(_0x38d4c7,null))[_0x8f2c('0x3e')](function(_0x2b89f1){if(_0x2b89f1){_0x488471=_0x2b89f1;_0x47de79[_0x8f2c('0x2e')]=_['keys'](db[_0x8f2c('0x4b')][_0x8f2c('0x4c')]);_0x47de79['query']=_[_0x8f2c('0x31')](_0x11914b[_0x8f2c('0x30')]);_0x47de79['filters']=_[_0x8f2c('0x33')](_0x47de79[_0x8f2c('0x2e')],_0x47de79[_0x8f2c('0x30')]);_0x442479['attributes']=_[_0x8f2c('0x33')](_0x47de79[_0x8f2c('0x2e')],qs['fields'](_0x11914b[_0x8f2c('0x30')][_0x8f2c('0x34')]));_0x442479['attributes']=_0x442479[_0x8f2c('0x32')][_0x8f2c('0x44')]?_0x442479[_0x8f2c('0x32')]:_0x47de79[_0x8f2c('0x2e')];_0x442479[_0x8f2c('0x37')]=qs[_0x8f2c('0x38')](_0x11914b['query'][_0x8f2c('0x38')]);_0x442479[_0x8f2c('0x39')]=qs[_0x8f2c('0x3a')](_['pick'](_0x11914b['query'],_0x47de79[_0x8f2c('0x3a')]));if(_0x11914b[_0x8f2c('0x30')]['filter']){_0x442479[_0x8f2c('0x39')]=_[_0x8f2c('0x4d')](_0x442479[_0x8f2c('0x39')],{'$or':_[_0x8f2c('0x2f')](_0x442479['attributes'],function(_0x1fc91a){var _0x13115f={};_0x13115f[_0x1fc91a]={'$like':'%'+_0x11914b[_0x8f2c('0x30')][_0x8f2c('0x3c')]+'%'};return _0x13115f;})});}_0x442479=_[_0x8f2c('0x4d')]({},_0x442479,_0x11914b[_0x8f2c('0x4e')]);return _0x488471['getConfigurations'](_0x442479);}})[_0x8f2c('0x3e')](function(_0x5d345d){if(_0x5d345d){_0x2e7001=_0x5d345d['length'];if(!_0x11914b['query'][_0x8f2c('0x35')]('nolimit')){_0x442479['limit']=qs[_0x8f2c('0x1f')](_0x11914b[_0x8f2c('0x30')][_0x8f2c('0x1f')]);_0x442479['offset']=qs['offset'](_0x11914b[_0x8f2c('0x30')][_0x8f2c('0x1e')]);}return _0x488471[_0x8f2c('0x4a')](_0x442479);}})[_0x8f2c('0x3e')](function(_0x2584e3){if(_0x2584e3){return _0x2584e3?{'count':_0x2e7001,'rows':_0x2584e3}:null;}})['then'](respondWithResult(_0x38d4c7,null))[_0x8f2c('0x42')](handleError(_0x38d4c7,null));};exports[_0x8f2c('0x4f')]=function(_0x325f7d,_0x4de63d,_0x1ecc98){if(_0x325f7d[_0x8f2c('0x48')]['id']){delete _0x325f7d['body']['id'];}return db[_0x8f2c('0x2a')]['findOne']({'where':{'id':_0x325f7d[_0x8f2c('0x49')]['id']}})[_0x8f2c('0x3e')](handleEntityNotFound(_0x4de63d,null))[_0x8f2c('0x3e')](function(_0x4765ec){if(_0x4765ec){_0x325f7d[_0x8f2c('0x48')][_0x8f2c('0x50')]=_0x4765ec['id'];_0x325f7d[_0x8f2c('0x48')][_0x8f2c('0x51')]=integrations[_0x8f2c('0x52')](_0x325f7d['body']['channel'],_0x325f7d[_0x8f2c('0x48')]['type']);_0x325f7d['body'][_0x8f2c('0x53')]=integrations[_0x8f2c('0x54')](_0x325f7d[_0x8f2c('0x48')]['channel'],_0x325f7d[_0x8f2c('0x48')][_0x8f2c('0x2c')]);return db[_0x8f2c('0x4b')][_0x8f2c('0x47')](_0x325f7d[_0x8f2c('0x48')],{'include':[{'model':db[_0x8f2c('0x55')],'as':'Subjects'},{'model':db[_0x8f2c('0x55')],'as':_0x8f2c('0x53')}]});}return null;})['then'](respondWithResult(_0x4de63d,null))['catch'](handleError(_0x4de63d,null));};var md5=require('md5');exports[_0x8f2c('0x56')]=function(_0x572e55,_0xfa345b,_0x3dafc4){var _0x1bd0b9=null;var _0xb0f388=null;var _0x3366ff=null;var _0x4819c3=null;var _0x2c0d6d='';return db[_0x8f2c('0x2a')]['findOne']({'where':{'id':_0x572e55[_0x8f2c('0x49')]['id']},'attributes':['id',_0x8f2c('0x28'),_0x8f2c('0x57'),'description','moduleName',_0x8f2c('0x58'),'serverUrl',_0x8f2c('0x59')]})['then'](handleEntityNotFound(_0xfa345b,null))['then'](function(_0x46b779){if(_0x46b779){_0x1bd0b9=_0x46b779[_0x8f2c('0x57')];_0xb0f388=_0x46b779[_0x8f2c('0x59')];_0x3366ff=_0x46b779[_0x8f2c('0x5a')];_0x2c0d6d=_0x46b779[_0x8f2c('0x58')];var _0x591438=_0x2c0d6d['slice'](-0x1);if(_0x591438==='/'){_0x2c0d6d=_0x2c0d6d['substring'](0x0,_0x2c0d6d[_0x8f2c('0x5b')](_0x591438));}_0x4819c3=util[_0x8f2c('0x5c')](_0x8f2c('0x5d'),_0x2c0d6d);var _0x5635e3={'method':'GET','uri':_0x4819c3,'qs':{'operation':_0x8f2c('0x5e'),'username':_0x46b779[_0x8f2c('0x57')]},'json':!![]};return rp(_0x5635e3);}})[_0x8f2c('0x3e')](function(_0x430418){if(_0x430418[_0x8f2c('0x5f')]){var _0x295ddc={'method':_0x8f2c('0x60'),'uri':_0x4819c3,'form':{'operation':_0x8f2c('0x61'),'username':_0x1bd0b9,'accessKey':md5(_0x430418['result'][_0x8f2c('0x62')]+_0xb0f388)},'json':!![]};return rp(_0x295ddc);}})[_0x8f2c('0x3e')](function(_0xba11f1){if(_0xba11f1[_0x8f2c('0x5f')]){var _0x51a63c={'method':'GET','uri':_0x4819c3,'qs':{'operation':_0x8f2c('0x63'),'username':_0x1bd0b9,'sessionName':_0xba11f1[_0x8f2c('0x64')][_0x8f2c('0x65')],'elementType':_0x3366ff},'json':!![]};return rp(_0x51a63c);}})[_0x8f2c('0x3e')](function(_0x3463c0){if(_0x3463c0['success']){var _0x2c027d=['autogenerated',_0x8f2c('0x66'),'owner'];_[_0x8f2c('0x67')](_0x3463c0[_0x8f2c('0x64')][_0x8f2c('0x34')],function(_0x58c0ad){return _0x2c027d[_0x8f2c('0x68')](_0x58c0ad['type'][_0x8f2c('0x28')]);});_['remove'](_0x3463c0['result'][_0x8f2c('0x34')],function(_0x51ab3c){return _0x51ab3c['editable']===_0x8f2c('0x69');});return{'count':_0x3463c0[_0x8f2c('0x64')]['fields']['length'],'rows':_[_0x8f2c('0x2f')](_0x3463c0[_0x8f2c('0x64')]['fields'],function(_0x231056){return{'id':_0x231056[_0x8f2c('0x28')],'name':_0x231056['label'],'custom':_[_0x8f2c('0x6a')](_0x231056[_0x8f2c('0x28')],_0x8f2c('0x6b'))?!![]:![],'options':_0x231056[_0x8f2c('0x2c')]['name']===_0x8f2c('0x6c')&&_0x231056[_0x8f2c('0x2c')]['picklistValues']['length']>0x0?_['map'](_0x231056[_0x8f2c('0x2c')]['picklistValues'],function(_0x5d5ba7){return{'name':_0x5d5ba7[_0x8f2c('0x6d')],'value':_0x5d5ba7[_0x8f2c('0x6e')]};}):[]};})};}})[_0x8f2c('0x3e')](respondWithResult(_0xfa345b,null))[_0x8f2c('0x42')](function(_0x4b38dc){console[_0x8f2c('0x6f')]('vTiger\x20error:\x20'+_0x4b38dc);var _0x4da1e0=_0x572e55[_0x8f2c('0x30')][_0x8f2c('0x70')]?0x1f4:_0x4b38dc[_0x8f2c('0x71')]||0x1f4;logger[_0x8f2c('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x8f2c('0x56'),_0x4da1e0,JSON[_0x8f2c('0x72')](_0x4b38dc));delete _0x4b38dc['name'];if(_0x4da1e0===0x191){_0x4da1e0=0x190;}_0xfa345b[_0x8f2c('0x1c')](_0x4da1e0)[_0x8f2c('0x29')](_0x572e55['query'][_0x8f2c('0x70')]?{'message':_0x8f2c('0x73'),'statusCode':_0x4b38dc[_0x8f2c('0x71')]}:_0x4b38dc);});}; \ No newline at end of file +var _0x3e52=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','VtigerField','md5','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','format','GET','getchallenge','success','POST','result','describe','sessionName','owner','remove','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','stringify','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','VtigerAccount','rawAttributes','fieldName','key','model','keys','query','filters','attributes'];(function(_0x353b58,_0x2eeb20){var _0x40cba8=function(_0x137bf3){while(--_0x137bf3){_0x353b58['push'](_0x353b58['shift']());}};_0x40cba8(++_0x2eeb20);}(_0x3e52,0xb5));var _0x23e5=function(_0xbfe63f,_0x415287){_0xbfe63f=_0xbfe63f-0x0;var _0x2b3708=_0x3e52[_0xbfe63f];return _0x2b3708;};'use strict';var emlformat=require(_0x23e5('0x0'));var rimraf=require(_0x23e5('0x1'));var zipdir=require(_0x23e5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23e5('0x3'));var moment=require(_0x23e5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x23e5('0x5'));var util=require(_0x23e5('0x6'));var path=require(_0x23e5('0x7'));var sox=require(_0x23e5('0x8'));var csv=require(_0x23e5('0x9'));var ejs=require(_0x23e5('0xa'));var fs=require('fs');var fs_extra=require(_0x23e5('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x23e5('0xc'));var jsforce=require(_0x23e5('0xd'));var deskjs=require(_0x23e5('0xe'));var toCsv=require(_0x23e5('0x9'));var querystring=require(_0x23e5('0xf'));var Papa=require('papaparse');var Redis=require(_0x23e5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x23e5('0x11'));var as=require(_0x23e5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x23e5('0x13'))(_0x23e5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x23e5('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xed5b4c,_0x2b3f91){_0x2b3f91=_0x2b3f91||0xcc;return function(_0x476022){if(_0x476022){return _0xed5b4c[_0x23e5('0x16')](_0x2b3f91);}return _0xed5b4c[_0x23e5('0x17')](_0x2b3f91)[_0x23e5('0x18')]();};}function respondWithResult(_0x2f68e1,_0x3d6f94){_0x3d6f94=_0x3d6f94||0xc8;return function(_0x2ee063){if(_0x2ee063){return _0x2f68e1[_0x23e5('0x17')](_0x3d6f94)['json'](_0x2ee063);}};}function respondWithFilteredResult(_0x1b4aff,_0x5bf327){return function(_0x384d77){if(_0x384d77){var _0x568739=typeof _0x5bf327[_0x23e5('0x19')]===_0x23e5('0x1a')&&typeof _0x5bf327[_0x23e5('0x1b')]===_0x23e5('0x1a');var _0x318c9b=_0x384d77[_0x23e5('0x1c')];var _0x4124c7=_0x568739?0x0:_0x5bf327[_0x23e5('0x19')];var _0x521a7c=_0x568739?_0x384d77[_0x23e5('0x1c')]:_0x5bf327[_0x23e5('0x19')]+_0x5bf327[_0x23e5('0x1b')];var _0x5ac1d0;if(_0x521a7c>=_0x318c9b){_0x521a7c=_0x318c9b;_0x5ac1d0=0xc8;}else{_0x5ac1d0=0xce;}_0x1b4aff[_0x23e5('0x17')](_0x5ac1d0);return _0x1b4aff[_0x23e5('0x1d')]('Content-Range',_0x4124c7+'-'+_0x521a7c+'/'+_0x318c9b)[_0x23e5('0x1e')](_0x384d77);}return null;};}function patchUpdates(_0x32e0b9){return function(_0x1ce7ac){try{jsonpatch[_0x23e5('0x1f')](_0x1ce7ac,_0x32e0b9,!![]);}catch(_0x475f34){return BPromise[_0x23e5('0x20')](_0x475f34);}return _0x1ce7ac[_0x23e5('0x21')]();};}function saveUpdates(_0x4afa0a,_0x1b2376){return function(_0x1e8e84){if(_0x1e8e84){return _0x1e8e84[_0x23e5('0x22')](_0x4afa0a)[_0x23e5('0x23')](function(_0x4a92d3){return _0x4a92d3;});}return null;};}function removeEntity(_0x5deaed,_0x42a3ca){return function(_0x345ddc){if(_0x345ddc){return _0x345ddc[_0x23e5('0x24')]()[_0x23e5('0x23')](function(){_0x5deaed['status'](0xcc)[_0x23e5('0x18')]();});}};}function handleEntityNotFound(_0x38fdf5,_0x1ee95a){return function(_0x402d48){if(!_0x402d48){_0x38fdf5[_0x23e5('0x16')](0x194);}return _0x402d48;};}function handleError(_0x5d4489,_0x430c32){_0x430c32=_0x430c32||0x1f4;return function(_0x5328f4){logger[_0x23e5('0x25')](_0x5328f4[_0x23e5('0x26')]);if(_0x5328f4[_0x23e5('0x27')]){delete _0x5328f4[_0x23e5('0x27')];}_0x5d4489['status'](_0x430c32)['send'](_0x5328f4);};}exports[_0x23e5('0x28')]=function(_0x385111,_0x3ebcfc){var _0x2db2c1={},_0x3be5d5={},_0x2dbf26={'count':0x0,'rows':[]};var _0x5aeabe=_[_0x23e5('0x29')](db[_0x23e5('0x2a')][_0x23e5('0x2b')],function(_0x44f24b){return{'name':_0x44f24b[_0x23e5('0x2c')],'type':_0x44f24b['type'][_0x23e5('0x2d')]};});_0x3be5d5[_0x23e5('0x2e')]=_[_0x23e5('0x29')](_0x5aeabe,'name');_0x3be5d5['query']=_[_0x23e5('0x2f')](_0x385111[_0x23e5('0x30')]);_0x3be5d5[_0x23e5('0x31')]=_['intersection'](_0x3be5d5[_0x23e5('0x2e')],_0x3be5d5[_0x23e5('0x30')]);_0x2db2c1[_0x23e5('0x32')]=_[_0x23e5('0x33')](_0x3be5d5[_0x23e5('0x2e')],qs[_0x23e5('0x34')](_0x385111[_0x23e5('0x30')][_0x23e5('0x34')]));_0x2db2c1[_0x23e5('0x32')]=_0x2db2c1[_0x23e5('0x32')][_0x23e5('0x35')]?_0x2db2c1[_0x23e5('0x32')]:_0x3be5d5[_0x23e5('0x2e')];if(!_0x385111[_0x23e5('0x30')][_0x23e5('0x36')](_0x23e5('0x37'))){_0x2db2c1['limit']=qs[_0x23e5('0x1b')](_0x385111['query'][_0x23e5('0x1b')]);_0x2db2c1[_0x23e5('0x19')]=qs['offset'](_0x385111[_0x23e5('0x30')][_0x23e5('0x19')]);}_0x2db2c1[_0x23e5('0x38')]=qs[_0x23e5('0x39')](_0x385111['query'][_0x23e5('0x39')]);_0x2db2c1[_0x23e5('0x3a')]=qs['filters'](_[_0x23e5('0x3b')](_0x385111[_0x23e5('0x30')],_0x3be5d5[_0x23e5('0x31')]),_0x5aeabe);if(_0x385111[_0x23e5('0x30')]['filter']){_0x2db2c1[_0x23e5('0x3a')]=_[_0x23e5('0x3c')](_0x2db2c1['where'],{'$or':_[_0x23e5('0x29')](_0x5aeabe,function(_0x453b27){if(_0x453b27[_0x23e5('0x3d')]!==_0x23e5('0x3e')){var _0x14368b={};_0x14368b[_0x453b27[_0x23e5('0x27')]]={'$like':'%'+_0x385111[_0x23e5('0x30')][_0x23e5('0x3f')]+'%'};return _0x14368b;}})});}_0x2db2c1=_[_0x23e5('0x3c')]({},_0x2db2c1,_0x385111[_0x23e5('0x40')]);var _0x50f172={'where':_0x2db2c1[_0x23e5('0x3a')]};return db['VtigerAccount']['count'](_0x50f172)[_0x23e5('0x23')](function(_0x2cff5b){_0x2dbf26[_0x23e5('0x1c')]=_0x2cff5b;if(_0x385111['query']['includeAll']){_0x2db2c1[_0x23e5('0x41')]=[{'all':!![]}];}return db[_0x23e5('0x2a')][_0x23e5('0x42')](_0x2db2c1);})[_0x23e5('0x23')](function(_0x487857){_0x2dbf26[_0x23e5('0x43')]=_0x487857;return _0x2dbf26;})[_0x23e5('0x23')](respondWithFilteredResult(_0x3ebcfc,_0x2db2c1))[_0x23e5('0x44')](handleError(_0x3ebcfc,null));};exports[_0x23e5('0x45')]=function(_0x7c5246,_0x413493){var _0x114e33={'raw':![],'where':{'id':_0x7c5246[_0x23e5('0x46')]['id']}},_0x3d936d={};_0x3d936d[_0x23e5('0x2e')]=_[_0x23e5('0x2f')](db[_0x23e5('0x2a')][_0x23e5('0x2b')]);_0x3d936d[_0x23e5('0x30')]=_[_0x23e5('0x2f')](_0x7c5246['query']);_0x3d936d[_0x23e5('0x31')]=_[_0x23e5('0x33')](_0x3d936d['model'],_0x3d936d['query']);_0x114e33['attributes']=_[_0x23e5('0x33')](_0x3d936d['model'],qs['fields'](_0x7c5246[_0x23e5('0x30')][_0x23e5('0x34')]));_0x114e33[_0x23e5('0x32')]=_0x114e33[_0x23e5('0x32')][_0x23e5('0x35')]?_0x114e33[_0x23e5('0x32')]:_0x3d936d[_0x23e5('0x2e')];if(_0x7c5246['query'][_0x23e5('0x47')]){_0x114e33[_0x23e5('0x41')]=[{'all':!![]}];}_0x114e33=_[_0x23e5('0x3c')]({},_0x114e33,_0x7c5246['options']);return db[_0x23e5('0x2a')][_0x23e5('0x48')](_0x114e33)[_0x23e5('0x23')](handleEntityNotFound(_0x413493,null))[_0x23e5('0x23')](respondWithResult(_0x413493,null))[_0x23e5('0x44')](handleError(_0x413493,null));};exports[_0x23e5('0x49')]=function(_0x3047af,_0x365bd9){return db[_0x23e5('0x2a')][_0x23e5('0x49')](_0x3047af[_0x23e5('0x4a')],{})['then'](respondWithResult(_0x365bd9,0xc9))[_0x23e5('0x44')](handleError(_0x365bd9,null));};exports[_0x23e5('0x22')]=function(_0xdd99e4,_0x316432){if(_0xdd99e4[_0x23e5('0x4a')]['id']){delete _0xdd99e4[_0x23e5('0x4a')]['id'];}return db[_0x23e5('0x2a')][_0x23e5('0x48')]({'where':{'id':_0xdd99e4[_0x23e5('0x46')]['id']}})[_0x23e5('0x23')](handleEntityNotFound(_0x316432,null))[_0x23e5('0x23')](saveUpdates(_0xdd99e4[_0x23e5('0x4a')],null))[_0x23e5('0x23')](respondWithResult(_0x316432,null))[_0x23e5('0x44')](handleError(_0x316432,null));};exports[_0x23e5('0x24')]=function(_0x11c398,_0x218e3f){return db[_0x23e5('0x2a')][_0x23e5('0x48')]({'where':{'id':_0x11c398[_0x23e5('0x46')]['id']}})[_0x23e5('0x23')](handleEntityNotFound(_0x218e3f,null))[_0x23e5('0x23')](removeEntity(_0x218e3f,null))[_0x23e5('0x44')](handleError(_0x218e3f,null));};exports['getConfigurations']=function(_0x4f7b41,_0x14baa3,_0x34427c){var _0x498e3f={};var _0x268603={};var _0x460de1;var _0x4e6195;return db['VtigerAccount'][_0x23e5('0x4b')]({'where':{'id':_0x4f7b41['params']['id']}})[_0x23e5('0x23')](handleEntityNotFound(_0x14baa3,null))[_0x23e5('0x23')](function(_0x31cb55){if(_0x31cb55){_0x460de1=_0x31cb55;_0x268603['model']=_[_0x23e5('0x2f')](db[_0x23e5('0x4c')][_0x23e5('0x2b')]);_0x268603[_0x23e5('0x30')]=_[_0x23e5('0x2f')](_0x4f7b41['query']);_0x268603[_0x23e5('0x31')]=_[_0x23e5('0x33')](_0x268603[_0x23e5('0x2e')],_0x268603['query']);_0x498e3f['attributes']=_[_0x23e5('0x33')](_0x268603['model'],qs[_0x23e5('0x34')](_0x4f7b41[_0x23e5('0x30')][_0x23e5('0x34')]));_0x498e3f[_0x23e5('0x32')]=_0x498e3f['attributes'][_0x23e5('0x35')]?_0x498e3f[_0x23e5('0x32')]:_0x268603[_0x23e5('0x2e')];_0x498e3f[_0x23e5('0x38')]=qs[_0x23e5('0x39')](_0x4f7b41[_0x23e5('0x30')][_0x23e5('0x39')]);_0x498e3f[_0x23e5('0x3a')]=qs[_0x23e5('0x31')](_['pick'](_0x4f7b41[_0x23e5('0x30')],_0x268603[_0x23e5('0x31')]));if(_0x4f7b41[_0x23e5('0x30')][_0x23e5('0x3f')]){_0x498e3f[_0x23e5('0x3a')]=_[_0x23e5('0x3c')](_0x498e3f[_0x23e5('0x3a')],{'$or':_[_0x23e5('0x29')](_0x498e3f[_0x23e5('0x32')],function(_0x576104){var _0x35b950={};_0x35b950[_0x576104]={'$like':'%'+_0x4f7b41[_0x23e5('0x30')][_0x23e5('0x3f')]+'%'};return _0x35b950;})});}_0x498e3f=_[_0x23e5('0x3c')]({},_0x498e3f,_0x4f7b41[_0x23e5('0x40')]);return _0x460de1[_0x23e5('0x4d')](_0x498e3f);}})[_0x23e5('0x23')](function(_0x3a97ea){if(_0x3a97ea){_0x4e6195=_0x3a97ea['length'];if(!_0x4f7b41['query']['hasOwnProperty']('nolimit')){_0x498e3f[_0x23e5('0x1b')]=qs[_0x23e5('0x1b')](_0x4f7b41[_0x23e5('0x30')][_0x23e5('0x1b')]);_0x498e3f[_0x23e5('0x19')]=qs[_0x23e5('0x19')](_0x4f7b41[_0x23e5('0x30')][_0x23e5('0x19')]);}return _0x460de1['getConfigurations'](_0x498e3f);}})[_0x23e5('0x23')](function(_0x1753c3){if(_0x1753c3){return _0x1753c3?{'count':_0x4e6195,'rows':_0x1753c3}:null;}})[_0x23e5('0x23')](respondWithResult(_0x14baa3,null))[_0x23e5('0x44')](handleError(_0x14baa3,null));};exports[_0x23e5('0x4e')]=function(_0xa5f476,_0x8a4065,_0x58d68d){if(_0xa5f476[_0x23e5('0x4a')]['id']){delete _0xa5f476['body']['id'];}return db[_0x23e5('0x2a')][_0x23e5('0x4b')]({'where':{'id':_0xa5f476[_0x23e5('0x46')]['id']}})[_0x23e5('0x23')](handleEntityNotFound(_0x8a4065,null))['then'](function(_0x760714){if(_0x760714){_0xa5f476['body'][_0x23e5('0x4f')]=_0x760714['id'];_0xa5f476['body']['Subjects']=integrations[_0x23e5('0x50')](_0xa5f476[_0x23e5('0x4a')][_0x23e5('0x51')],_0xa5f476[_0x23e5('0x4a')][_0x23e5('0x3d')]);_0xa5f476[_0x23e5('0x4a')][_0x23e5('0x52')]=integrations['getDescriptions'](_0xa5f476['body']['channel'],_0xa5f476[_0x23e5('0x4a')][_0x23e5('0x3d')]);return db[_0x23e5('0x4c')][_0x23e5('0x49')](_0xa5f476[_0x23e5('0x4a')],{'include':[{'model':db[_0x23e5('0x53')],'as':'Subjects'},{'model':db[_0x23e5('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x8a4065,null))['catch'](handleError(_0x8a4065,null));};var md5=require(_0x23e5('0x54'));exports[_0x23e5('0x55')]=function(_0x4ec31e,_0xc1e6c1,_0x2a6c52){var _0xc4c55c=null;var _0x559fe3=null;var _0x5019d0=null;var _0x5ae120=null;var _0x5c63aa='';return db[_0x23e5('0x2a')][_0x23e5('0x4b')]({'where':{'id':_0x4ec31e['params']['id']},'attributes':['id',_0x23e5('0x27'),_0x23e5('0x56'),_0x23e5('0x57'),_0x23e5('0x58'),'remoteUri',_0x23e5('0x59'),_0x23e5('0x5a')]})['then'](handleEntityNotFound(_0xc1e6c1,null))[_0x23e5('0x23')](function(_0x12db34){if(_0x12db34){_0xc4c55c=_0x12db34[_0x23e5('0x56')];_0x559fe3=_0x12db34[_0x23e5('0x5a')];_0x5019d0=_0x12db34[_0x23e5('0x58')];_0x5c63aa=_0x12db34[_0x23e5('0x5b')];var _0x4adc37=_0x5c63aa[_0x23e5('0x5c')](-0x1);if(_0x4adc37==='/'){_0x5c63aa=_0x5c63aa[_0x23e5('0x5d')](0x0,_0x5c63aa[_0x23e5('0x5e')](_0x4adc37));}_0x5ae120=util[_0x23e5('0x5f')]('%s/webservice.php',_0x5c63aa);var _0x1007f3={'method':_0x23e5('0x60'),'uri':_0x5ae120,'qs':{'operation':_0x23e5('0x61'),'username':_0x12db34[_0x23e5('0x56')]},'json':!![]};return rp(_0x1007f3);}})[_0x23e5('0x23')](function(_0x2a8396){if(_0x2a8396[_0x23e5('0x62')]){var _0x55963b={'method':_0x23e5('0x63'),'uri':_0x5ae120,'form':{'operation':'login','username':_0xc4c55c,'accessKey':md5(_0x2a8396[_0x23e5('0x64')]['token']+_0x559fe3)},'json':!![]};return rp(_0x55963b);}})[_0x23e5('0x23')](function(_0x4c56ae){if(_0x4c56ae[_0x23e5('0x62')]){var _0x114f33={'method':'GET','uri':_0x5ae120,'qs':{'operation':_0x23e5('0x65'),'username':_0xc4c55c,'sessionName':_0x4c56ae[_0x23e5('0x64')][_0x23e5('0x66')],'elementType':_0x5019d0},'json':!![]};return rp(_0x114f33);}})[_0x23e5('0x23')](function(_0x39f1ab){if(_0x39f1ab[_0x23e5('0x62')]){var _0x1cb36=['autogenerated','reference',_0x23e5('0x67')];_[_0x23e5('0x68')](_0x39f1ab[_0x23e5('0x64')]['fields'],function(_0x52e279){return _0x1cb36['includes'](_0x52e279[_0x23e5('0x3d')]['name']);});_[_0x23e5('0x68')](_0x39f1ab[_0x23e5('0x64')][_0x23e5('0x34')],function(_0x5de02c){return _0x5de02c['editable']===_0x23e5('0x69');});return{'count':_0x39f1ab[_0x23e5('0x64')][_0x23e5('0x34')]['length'],'rows':_[_0x23e5('0x29')](_0x39f1ab[_0x23e5('0x64')]['fields'],function(_0x18345e){return{'id':_0x18345e[_0x23e5('0x27')],'name':_0x18345e[_0x23e5('0x6a')],'custom':_[_0x23e5('0x6b')](_0x18345e['name'],'cf_')?!![]:![],'options':_0x18345e[_0x23e5('0x3d')][_0x23e5('0x27')]===_0x23e5('0x6c')&&_0x18345e[_0x23e5('0x3d')][_0x23e5('0x6d')][_0x23e5('0x35')]>0x0?_[_0x23e5('0x29')](_0x18345e[_0x23e5('0x3d')][_0x23e5('0x6d')],function(_0x3df049){return{'name':_0x3df049['label'],'value':_0x3df049[_0x23e5('0x6e')]};}):[]};})};}})['then'](respondWithResult(_0xc1e6c1,null))[_0x23e5('0x44')](function(_0x4dce00){console[_0x23e5('0x6f')](_0x23e5('0x70')+_0x4dce00);var _0x5ca5b9=_0x4ec31e['query'][_0x23e5('0x71')]?0x1f4:_0x4dce00[_0x23e5('0x72')]||0x1f4;logger[_0x23e5('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x23e5('0x55'),_0x5ca5b9,JSON[_0x23e5('0x73')](_0x4dce00));delete _0x4dce00[_0x23e5('0x27')];if(_0x5ca5b9===0x191){_0x5ca5b9=0x190;}_0xc1e6c1[_0x23e5('0x17')](_0x5ca5b9)['send'](_0x4ec31e[_0x23e5('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4dce00[_0x23e5('0x72')]}:_0x4dce00);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 5329352..85dd786 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 _0xf85c=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0xf85c,0x11e));var _0xcf85=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xf85c[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0xcf85('0x0'));var util=require(_0xcf85('0x1'));var logger=require(_0xcf85('0x2'))(_0xcf85('0x3'));var moment=require(_0xcf85('0x4'));var BPromise=require(_0xcf85('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf85('0x6'));var rimraf=require('rimraf');var config=require(_0xcf85('0x7'));var attributes=require(_0xcf85('0x8'));var integrations=require(_0xcf85('0x9'));module['exports']=function(_0x33024e,_0x326a9b){return _0x33024e[_0xcf85('0xa')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x026c=['../../components/integrations/configuration','exports','define','VtigerAccount','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f8a86,_0x577523){var _0x588de8=function(_0x19cfc7){while(--_0x19cfc7){_0x2f8a86['push'](_0x2f8a86['shift']());}};_0x588de8(++_0x577523);}(_0x026c,0x70));var _0xc026=function(_0x2dce9f,_0x1d1880){_0x2dce9f=_0x2dce9f-0x0;var _0x1cd454=_0x026c[_0x2dce9f];return _0x1cd454;};'use strict';var _=require(_0xc026('0x0'));var util=require(_0xc026('0x1'));var logger=require(_0xc026('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc026('0x3'));var rp=require(_0xc026('0x4'));var fs=require('fs');var path=require(_0xc026('0x5'));var rimraf=require(_0xc026('0x6'));var config=require(_0xc026('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xc026('0x8'));module[_0xc026('0x9')]=function(_0x5e38d0,_0x1a140b){return _0x5e38d0[_0xc026('0xa')](_0xc026('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 0f1aa44..faab27c 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 _0x4ded=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','error','code','VtigerAccount,\x20%s,\x20%s','message','info','result','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','stringify','find','ShowVtigerAccount','lodash','util'];(function(_0x16df0d,_0x2f9985){var _0x4b061e=function(_0x56d13d){while(--_0x56d13d){_0x16df0d['push'](_0x16df0d['shift']());}};_0x4b061e(++_0x2f9985);}(_0x4ded,0x116));var _0xd4de=function(_0x489a47,_0x4ecb00){_0x489a47=_0x489a47-0x0;var _0x190ca6=_0x4ded[_0x489a47];return _0x190ca6;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var moment=require(_0xd4de('0x2'));var BPromise=require(_0xd4de('0x3'));var rs=require(_0xd4de('0x4'));var fs=require('fs');var Redis=require(_0xd4de('0x5'));var db=require(_0xd4de('0x6'))['db'];var utils=require(_0xd4de('0x7'));var logger=require(_0xd4de('0x8'))(_0xd4de('0x9'));var config=require(_0xd4de('0xa'));var jayson=require(_0xd4de('0xb'));var client=jayson['client'][_0xd4de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2433b8,_0x15eb91,_0x2c56d5){return new BPromise(function(_0x4453c2,_0x1e8c35){return client['request'](_0x2433b8,_0x2c56d5)[_0xd4de('0xd')](function(_0x5ebcf3){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x15eb91,_0xd4de('0xe'));logger[_0xd4de('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x15eb91,'request\x20sent',JSON['stringify'](_0x5ebcf3));if(_0x5ebcf3[_0xd4de('0x10')]){if(_0x5ebcf3['error'][_0xd4de('0x11')]===0x1f4){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x1e8c35(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x4453c2(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}else{logger[_0xd4de('0x14')](_0xd4de('0x12'),_0x15eb91,_0xd4de('0xe'));_0x4453c2(_0x5ebcf3[_0xd4de('0x15')]['message']);}})['catch'](function(_0x3df820){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x3df820);_0x1e8c35(_0x3df820);});});}exports[_0xd4de('0x16')]=function(_0x5b1d1c){var _0x4d0df6=this;return new Promise(function(_0x1e91d5,_0x54b757){return db[_0xd4de('0x17')][_0xd4de('0x18')]({'raw':_0x5b1d1c['options']?_0x5b1d1c[_0xd4de('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1a')]||null:null,'attributes':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c['options'][_0xd4de('0x1b')]||null:null,'limit':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1c')]||null:null,'include':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1d')],function(_0x534b37){return{'model':db[_0x534b37[_0xd4de('0x1f')]],'as':_0x534b37['as'],'attributes':_0x534b37[_0xd4de('0x1b')],'include':_0x534b37[_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x534b37[_0xd4de('0x1d')],function(_0x984904){return{'model':db[_0x984904[_0xd4de('0x1f')]],'as':_0x984904['as'],'attributes':_0x984904[_0xd4de('0x1b')],'include':_0x984904[_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x984904[_0xd4de('0x1d')],function(_0xb2d8a1){return{'model':db[_0xb2d8a1['model']],'as':_0xb2d8a1['as'],'attributes':_0xb2d8a1[_0xd4de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd4de('0xd')](function(_0x5005b0){logger[_0xd4de('0x14')]('GetVtigerAccount',_0x5b1d1c);logger[_0xd4de('0xf')](_0xd4de('0x16'),_0x5b1d1c,JSON[_0xd4de('0x20')](_0x5005b0));_0x1e91d5(_0x5005b0);})['catch'](function(_0xd4de93){logger[_0xd4de('0x10')](_0xd4de('0x16'),_0xd4de93['message'],_0x5b1d1c);_0x54b757(_0x4d0df6[_0xd4de('0x10')](0x1f4,_0xd4de93[_0xd4de('0x13')]));});});};exports['ShowVtigerAccount']=function(_0x5103b5){var _0x5706fe=this;return new Promise(function(_0x3f6491,_0x496795){return db[_0xd4de('0x17')][_0xd4de('0x21')]({'raw':_0x5103b5[_0xd4de('0x19')]?_0x5103b5[_0xd4de('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5103b5[_0xd4de('0x19')]?_0x5103b5[_0xd4de('0x19')]['where']||null:null,'attributes':_0x5103b5[_0xd4de('0x19')]?_0x5103b5[_0xd4de('0x19')]['attributes']||null:null,'include':_0x5103b5['options']?_0x5103b5[_0xd4de('0x19')][_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x5103b5[_0xd4de('0x19')]['include'],function(_0x2bdc98){return{'model':db[_0x2bdc98[_0xd4de('0x1f')]],'as':_0x2bdc98['as'],'attributes':_0x2bdc98['attributes'],'include':_0x2bdc98[_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x2bdc98[_0xd4de('0x1d')],function(_0x34528a){return{'model':db[_0x34528a[_0xd4de('0x1f')]],'as':_0x34528a['as'],'attributes':_0x34528a[_0xd4de('0x1b')],'include':_0x34528a['include']?_['map'](_0x34528a[_0xd4de('0x1d')],function(_0x2d2fda){return{'model':db[_0x2d2fda[_0xd4de('0x1f')]],'as':_0x2d2fda['as'],'attributes':_0x2d2fda['attributes']};}):[]};}):[]};}):[]:[]})[_0xd4de('0xd')](function(_0x44b96c){logger['info'](_0xd4de('0x22'),_0x5103b5);logger[_0xd4de('0xf')](_0xd4de('0x22'),_0x5103b5,JSON[_0xd4de('0x20')](_0x44b96c));_0x3f6491(_0x44b96c);})['catch'](function(_0x53d7dc){logger[_0xd4de('0x10')]('ShowVtigerAccount',_0x53d7dc[_0xd4de('0x13')],_0x5103b5);_0x496795(_0x5706fe['error'](0x1f4,_0x53d7dc[_0xd4de('0x13')]));});});}; \ No newline at end of file +var _0x13f6=['debug','stringify','error','code','message','info','result','GetVtigerAccount','VtigerAccount','findAll','options','limit','include','map','model','attributes','ShowVtigerAccount','find','raw','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5826da,_0x4ffb7f){var _0x127236=function(_0x5c2f74){while(--_0x5c2f74){_0x5826da['push'](_0x5826da['shift']());}};_0x127236(++_0x4ffb7f);}(_0x13f6,0x124));var _0x613f=function(_0x2ba34b,_0xd4bbf3){_0x2ba34b=_0x2ba34b-0x0;var _0x2e807e=_0x13f6[_0x2ba34b];return _0x2e807e;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5618fa,_0x4b546b,_0x5a84f2){return new BPromise(function(_0x5c93c0,_0x2d5973){return client[_0x613f('0xa')](_0x5618fa,_0x5a84f2)[_0x613f('0xb')](function(_0x35b672){logger['info'](_0x613f('0xc'),_0x4b546b,_0x613f('0xd'));logger[_0x613f('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4b546b,_0x613f('0xd'),JSON[_0x613f('0xf')](_0x35b672));if(_0x35b672[_0x613f('0x10')]){if(_0x35b672['error'][_0x613f('0x11')]===0x1f4){logger[_0x613f('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x4b546b,_0x35b672['error']['message']);return _0x2d5973(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}logger[_0x613f('0x10')](_0x613f('0xc'),_0x4b546b,_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);return _0x5c93c0(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}else{logger[_0x613f('0x13')](_0x613f('0xc'),_0x4b546b,'request\x20sent');_0x5c93c0(_0x35b672[_0x613f('0x14')]['message']);}})['catch'](function(_0x1bc605){logger[_0x613f('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x4b546b,_0x1bc605);_0x2d5973(_0x1bc605);});});}exports[_0x613f('0x15')]=function(_0x4f9dae){var _0x62ebfe=this;return new Promise(function(_0x1e5a11,_0x431266){return db[_0x613f('0x16')][_0x613f('0x17')]({'raw':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae['options']['where']||null:null,'attributes':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae[_0x613f('0x18')]['attributes']||null:null,'limit':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae[_0x613f('0x18')][_0x613f('0x19')]||null:null,'include':_0x4f9dae['options']?_0x4f9dae['options'][_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x4f9dae[_0x613f('0x18')]['include'],function(_0x41104e){return{'model':db[_0x41104e[_0x613f('0x1c')]],'as':_0x41104e['as'],'attributes':_0x41104e[_0x613f('0x1d')],'include':_0x41104e[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x41104e['include'],function(_0x30fb15){return{'model':db[_0x30fb15[_0x613f('0x1c')]],'as':_0x30fb15['as'],'attributes':_0x30fb15['attributes'],'include':_0x30fb15[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x30fb15[_0x613f('0x1a')],function(_0x4a878d){return{'model':db[_0x4a878d['model']],'as':_0x4a878d['as'],'attributes':_0x4a878d['attributes']};}):[]};}):[]};}):[]:[]})[_0x613f('0xb')](function(_0x594c28){logger[_0x613f('0x13')](_0x613f('0x15'),_0x4f9dae);logger['debug'](_0x613f('0x15'),_0x4f9dae,JSON[_0x613f('0xf')](_0x594c28));_0x1e5a11(_0x594c28);})['catch'](function(_0x4cff5d){logger['error'](_0x613f('0x15'),_0x4cff5d[_0x613f('0x12')],_0x4f9dae);_0x431266(_0x62ebfe[_0x613f('0x10')](0x1f4,_0x4cff5d['message']));});});};exports[_0x613f('0x1e')]=function(_0x439478){var _0xd335a6=this;return new Promise(function(_0x19bb8f,_0x4f8500){return db[_0x613f('0x16')][_0x613f('0x1f')]({'raw':_0x439478[_0x613f('0x18')]?_0x439478[_0x613f('0x18')][_0x613f('0x20')]===undefined?!![]:![]:!![],'where':_0x439478[_0x613f('0x18')]?_0x439478['options'][_0x613f('0x21')]||null:null,'attributes':_0x439478[_0x613f('0x18')]?_0x439478[_0x613f('0x18')]['attributes']||null:null,'include':_0x439478[_0x613f('0x18')]?_0x439478['options'][_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x439478[_0x613f('0x18')][_0x613f('0x1a')],function(_0x2bceaa){return{'model':db[_0x2bceaa[_0x613f('0x1c')]],'as':_0x2bceaa['as'],'attributes':_0x2bceaa['attributes'],'include':_0x2bceaa[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x2bceaa[_0x613f('0x1a')],function(_0x25b2e4){return{'model':db[_0x25b2e4[_0x613f('0x1c')]],'as':_0x25b2e4['as'],'attributes':_0x25b2e4['attributes'],'include':_0x25b2e4['include']?_['map'](_0x25b2e4[_0x613f('0x1a')],function(_0x72c804){return{'model':db[_0x72c804[_0x613f('0x1c')]],'as':_0x72c804['as'],'attributes':_0x72c804[_0x613f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fc02e){logger[_0x613f('0x13')]('ShowVtigerAccount',_0x439478);logger[_0x613f('0xe')]('ShowVtigerAccount',_0x439478,JSON[_0x613f('0xf')](_0x2fc02e));_0x19bb8f(_0x2fc02e);})['catch'](function(_0x36dfd4){logger['error'](_0x613f('0x1e'),_0x36dfd4[_0x613f('0x12')],_0x439478);_0x4f8500(_0xd335a6[_0x613f('0x10')](0x1f4,_0x36dfd4['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 38097f4..5418630 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 _0x888d=['isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','/:id','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get'];(function(_0x22de93,_0x175f6e){var _0xcd801=function(_0x23ea7e){while(--_0x23ea7e){_0x22de93['push'](_0x22de93['shift']());}};_0xcd801(++_0x175f6e);}(_0x888d,0x199));var _0xd888=function(_0x19bce8,_0x188b99){_0x19bce8=_0x19bce8-0x0;var _0x36b3c3=_0x888d[_0x19bce8];return _0x36b3c3;};'use strict';var multer=require('multer');var util=require(_0xd888('0x0'));var path=require(_0xd888('0x1'));var timeout=require('connect-timeout');var express=require(_0xd888('0x2'));var router=express[_0xd888('0x3')]();var fs_extra=require(_0xd888('0x4'));var auth=require(_0xd888('0x5'));var interaction=require(_0xd888('0x6'));var config=require(_0xd888('0x7'));var controller=require(_0xd888('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd888('0x9')]);router[_0xd888('0xa')]('/:id',auth[_0xd888('0xb')](),controller[_0xd888('0xc')]);router['get'](_0xd888('0xd'),auth[_0xd888('0xb')](),controller['getFields']);router[_0xd888('0xa')](_0xd888('0xe'),auth[_0xd888('0xb')](),controller[_0xd888('0xf')]);router[_0xd888('0xa')](_0xd888('0x10'),auth[_0xd888('0xb')](),controller[_0xd888('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd888('0x12')]);router['put']('/:id',auth[_0xd888('0xb')](),controller[_0xd888('0x13')]);router['delete'](_0xd888('0x14'),auth[_0xd888('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbc0d=['../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x47717f,_0x7b777f){var _0x37a524=function(_0x356c94){while(--_0x356c94){_0x47717f['push'](_0x47717f['shift']());}};_0x37a524(++_0x7b777f);}(_0xbc0d,0x1c9));var _0xdbc0=function(_0x1d5ba8,_0x412a52){_0x1d5ba8=_0x1d5ba8-0x0;var _0x1022a2=_0xbc0d[_0x1d5ba8];return _0x1022a2;};'use strict';var multer=require(_0xdbc0('0x0'));var util=require(_0xdbc0('0x1'));var path=require('path');var timeout=require(_0xdbc0('0x2'));var express=require('express');var router=express[_0xdbc0('0x3')]();var fs_extra=require(_0xdbc0('0x4'));var auth=require(_0xdbc0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdbc0('0x6'));var controller=require(_0xdbc0('0x7'));router[_0xdbc0('0x8')]('/',auth[_0xdbc0('0x9')](),controller[_0xdbc0('0xa')]);router['get'](_0xdbc0('0xb'),auth[_0xdbc0('0x9')](),controller['show']);router[_0xdbc0('0x8')](_0xdbc0('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xdbc0('0x8')](_0xdbc0('0xd'),auth['isAuthenticated'](),controller[_0xdbc0('0xe')]);router['get'](_0xdbc0('0xf'),auth[_0xdbc0('0x9')](),controller[_0xdbc0('0x10')]);router[_0xdbc0('0x11')]('/',auth[_0xdbc0('0x9')](),controller[_0xdbc0('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdbc0('0x13')](_0xdbc0('0xb'),auth[_0xdbc0('0x9')](),controller[_0xdbc0('0x14')]);module[_0xdbc0('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index f758e13..de77b62 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 _0x5a51=['STRING','sequelize','exports'];(function(_0x18bd81,_0x567c25){var _0x298435=function(_0x5461ac){while(--_0x5461ac){_0x18bd81['push'](_0x18bd81['shift']());}};_0x298435(++_0x567c25);}(_0x5a51,0x127));var _0x15a5=function(_0x401724,_0xff576){_0x401724=_0x401724-0x0;var _0x586460=_0x5a51[_0x401724];return _0x586460;};'use strict';var Sequelize=require(_0x15a5('0x0'));module[_0x15a5('0x1')]={'name':{'type':Sequelize[_0x15a5('0x2')]},'description':{'type':Sequelize[_0x15a5('0x2')]}}; \ No newline at end of file +var _0x61cc=['exports','STRING','sequelize'];(function(_0x36fc68,_0x27e7b4){var _0x2e718a=function(_0x3eaa08){while(--_0x3eaa08){_0x36fc68['push'](_0x36fc68['shift']());}};_0x2e718a(++_0x27e7b4);}(_0x61cc,0x1dc));var _0xc61c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x61cc[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xc61c('0x0'));module[_0xc61c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc61c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index e6ee577..d9fdb4e 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 _0x595c=['api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','find','catch','create','body','getFields','findOne','pick','VtigerField','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','mustache','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'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0x595c,0x1e3));var _0xc595=function(_0x25d513,_0x5417fc){_0x25d513=_0x25d513-0x0;var _0x11cea4=_0x595c[_0x25d513];return _0x11cea4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc595('0x0'));var rp=require(_0xc595('0x1'));var moment=require(_0xc595('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc595('0x3'));var util=require('util');var path=require(_0xc595('0x4'));var sox=require(_0xc595('0x5'));var csv=require(_0xc595('0x6'));var ejs=require(_0xc595('0x7'));var fs=require('fs');var fs_extra=require(_0xc595('0x8'));var _=require(_0xc595('0x9'));var squel=require(_0xc595('0xa'));var crypto=require(_0xc595('0xb'));var jsforce=require(_0xc595('0xc'));var deskjs=require(_0xc595('0xd'));var toCsv=require(_0xc595('0x6'));var querystring=require(_0xc595('0xe'));var Papa=require(_0xc595('0xf'));var Redis=require(_0xc595('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc595('0x11'));var as=require(_0xc595('0x12'));var hardwareService=require(_0xc595('0x13'));var logger=require(_0xc595('0x14'))(_0xc595('0x15'));var utils=require(_0xc595('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc595('0x17'));var db=require(_0xc595('0x18'))['db'];function respondWithStatusCode(_0x21c005,_0x35ed6a){_0x35ed6a=_0x35ed6a||0xcc;return function(_0x558c54){if(_0x558c54){return _0x21c005['sendStatus'](_0x35ed6a);}return _0x21c005['status'](_0x35ed6a)[_0xc595('0x19')]();};}function respondWithResult(_0x8a0fc5,_0x418127){_0x418127=_0x418127||0xc8;return function(_0x120c95){if(_0x120c95){return _0x8a0fc5[_0xc595('0x1a')](_0x418127)[_0xc595('0x1b')](_0x120c95);}};}function respondWithFilteredResult(_0x58fd7c,_0x450fb2){return function(_0x21eac5){if(_0x21eac5){var _0x5dab59=typeof _0x450fb2[_0xc595('0x1c')]===_0xc595('0x1d')&&typeof _0x450fb2[_0xc595('0x1e')]===_0xc595('0x1d');var _0x51755f=_0x21eac5[_0xc595('0x1f')];var _0x3182cd=_0x5dab59?0x0:_0x450fb2[_0xc595('0x1c')];var _0x461593=_0x5dab59?_0x21eac5[_0xc595('0x1f')]:_0x450fb2['offset']+_0x450fb2[_0xc595('0x1e')];var _0x573deb;if(_0x461593>=_0x51755f){_0x461593=_0x51755f;_0x573deb=0xc8;}else{_0x573deb=0xce;}_0x58fd7c[_0xc595('0x1a')](_0x573deb);return _0x58fd7c[_0xc595('0x20')](_0xc595('0x21'),_0x3182cd+'-'+_0x461593+'/'+_0x51755f)[_0xc595('0x1b')](_0x21eac5);}return null;};}function patchUpdates(_0x56f85b){return function(_0x216699){try{jsonpatch['apply'](_0x216699,_0x56f85b,!![]);}catch(_0xc1c4f9){return BPromise[_0xc595('0x22')](_0xc1c4f9);}return _0x216699[_0xc595('0x23')]();};}function saveUpdates(_0x432fbc,_0x590dd2){return function(_0x179a3f){if(_0x179a3f){return _0x179a3f[_0xc595('0x24')](_0x432fbc)['then'](function(_0x2eed87){return _0x2eed87;});}return null;};}function removeEntity(_0x10aa39,_0x22caed){return function(_0x4565b2){if(_0x4565b2){return _0x4565b2[_0xc595('0x25')]()[_0xc595('0x26')](function(){_0x10aa39[_0xc595('0x1a')](0xcc)[_0xc595('0x19')]();});}};}function handleEntityNotFound(_0x447f62,_0x1e1908){return function(_0x431ca4){if(!_0x431ca4){_0x447f62[_0xc595('0x27')](0x194);}return _0x431ca4;};}function handleError(_0x3871b9,_0x47b11a){_0x47b11a=_0x47b11a||0x1f4;return function(_0xeaa8cc){logger[_0xc595('0x28')](_0xeaa8cc[_0xc595('0x29')]);if(_0xeaa8cc[_0xc595('0x2a')]){delete _0xeaa8cc[_0xc595('0x2a')];}_0x3871b9[_0xc595('0x1a')](_0x47b11a)[_0xc595('0x2b')](_0xeaa8cc);};}exports[_0xc595('0x2c')]=function(_0x540f99,_0x32c682){var _0x562a74={},_0x16607c={},_0x2aa126={'count':0x0,'rows':[]};var _0x27d381=_[_0xc595('0x2d')](db[_0xc595('0x2e')][_0xc595('0x2f')],function(_0xb7d1c){return{'name':_0xb7d1c[_0xc595('0x30')],'type':_0xb7d1c[_0xc595('0x31')][_0xc595('0x32')]};});_0x16607c[_0xc595('0x33')]=_[_0xc595('0x2d')](_0x27d381,'name');_0x16607c[_0xc595('0x34')]=_[_0xc595('0x35')](_0x540f99[_0xc595('0x34')]);_0x16607c[_0xc595('0x36')]=_[_0xc595('0x37')](_0x16607c[_0xc595('0x33')],_0x16607c[_0xc595('0x34')]);_0x562a74[_0xc595('0x38')]=_[_0xc595('0x37')](_0x16607c[_0xc595('0x33')],qs[_0xc595('0x39')](_0x540f99['query']['fields']));_0x562a74[_0xc595('0x38')]=_0x562a74['attributes']['length']?_0x562a74[_0xc595('0x38')]:_0x16607c[_0xc595('0x33')];if(!_0x540f99[_0xc595('0x34')][_0xc595('0x3a')](_0xc595('0x3b'))){_0x562a74[_0xc595('0x1e')]=qs[_0xc595('0x1e')](_0x540f99['query'][_0xc595('0x1e')]);_0x562a74[_0xc595('0x1c')]=qs[_0xc595('0x1c')](_0x540f99[_0xc595('0x34')][_0xc595('0x1c')]);}_0x562a74[_0xc595('0x3c')]=qs['sort'](_0x540f99['query'][_0xc595('0x3d')]);_0x562a74[_0xc595('0x3e')]=qs['filters'](_['pick'](_0x540f99[_0xc595('0x34')],_0x16607c['filters']),_0x27d381);if(_0x540f99[_0xc595('0x34')][_0xc595('0x3f')]){_0x562a74[_0xc595('0x3e')]=_[_0xc595('0x40')](_0x562a74[_0xc595('0x3e')],{'$or':_[_0xc595('0x2d')](_0x27d381,function(_0x3ff244){if(_0x3ff244[_0xc595('0x31')]!==_0xc595('0x41')){var _0x340f1c={};_0x340f1c[_0x3ff244[_0xc595('0x2a')]]={'$like':'%'+_0x540f99[_0xc595('0x34')]['filter']+'%'};return _0x340f1c;}})});}_0x562a74=_['merge']({},_0x562a74,_0x540f99[_0xc595('0x42')]);var _0x5d64bd={'where':_0x562a74[_0xc595('0x3e')]};return db['VtigerConfiguration']['count'](_0x5d64bd)[_0xc595('0x26')](function(_0x3db10f){_0x2aa126[_0xc595('0x1f')]=_0x3db10f;if(_0x540f99[_0xc595('0x34')][_0xc595('0x43')]){_0x562a74['include']=[{'all':!![]}];}return db[_0xc595('0x2e')][_0xc595('0x44')](_0x562a74);})['then'](function(_0x2b5c23){_0x2aa126[_0xc595('0x45')]=_0x2b5c23;return _0x2aa126;})[_0xc595('0x26')](respondWithFilteredResult(_0x32c682,_0x562a74))['catch'](handleError(_0x32c682,null));};exports[_0xc595('0x46')]=function(_0x2f26e4,_0xcff817){var _0x3e1b99={'raw':![],'where':{'id':_0x2f26e4[_0xc595('0x47')]['id']}},_0x5e2a62={};_0x5e2a62['model']=_[_0xc595('0x35')](db['VtigerConfiguration']['rawAttributes']);_0x5e2a62[_0xc595('0x34')]=_[_0xc595('0x35')](_0x2f26e4[_0xc595('0x34')]);_0x5e2a62[_0xc595('0x36')]=_['intersection'](_0x5e2a62[_0xc595('0x33')],_0x5e2a62['query']);_0x3e1b99[_0xc595('0x38')]=_[_0xc595('0x37')](_0x5e2a62[_0xc595('0x33')],qs[_0xc595('0x39')](_0x2f26e4[_0xc595('0x34')][_0xc595('0x39')]));_0x3e1b99[_0xc595('0x38')]=_0x3e1b99[_0xc595('0x38')][_0xc595('0x48')]?_0x3e1b99[_0xc595('0x38')]:_0x5e2a62['model'];if(_0x2f26e4['query'][_0xc595('0x43')]){_0x3e1b99[_0xc595('0x49')]=[{'all':!![]}];}_0x3e1b99=_['merge']({},_0x3e1b99,_0x2f26e4['options']);return db[_0xc595('0x2e')][_0xc595('0x4a')](_0x3e1b99)[_0xc595('0x26')](handleEntityNotFound(_0xcff817,null))[_0xc595('0x26')](respondWithResult(_0xcff817,null))[_0xc595('0x4b')](handleError(_0xcff817,null));};exports[_0xc595('0x4c')]=function(_0x48191f,_0x49ba19){return db[_0xc595('0x2e')][_0xc595('0x4c')](_0x48191f[_0xc595('0x4d')],{})[_0xc595('0x26')](respondWithResult(_0x49ba19,0xc9))[_0xc595('0x4b')](handleError(_0x49ba19,null));};exports[_0xc595('0x24')]=function(_0x4f7fae,_0xb092c9){if(_0x4f7fae[_0xc595('0x4d')]['id']){delete _0x4f7fae[_0xc595('0x4d')]['id'];}return db[_0xc595('0x2e')][_0xc595('0x4a')]({'where':{'id':_0x4f7fae[_0xc595('0x47')]['id']}})[_0xc595('0x26')](handleEntityNotFound(_0xb092c9,null))[_0xc595('0x26')](saveUpdates(_0x4f7fae[_0xc595('0x4d')],null))[_0xc595('0x26')](respondWithResult(_0xb092c9,null))[_0xc595('0x4b')](handleError(_0xb092c9,null));};exports[_0xc595('0x25')]=function(_0x32e548,_0x3940c1){return db[_0xc595('0x2e')][_0xc595('0x4a')]({'where':{'id':_0x32e548[_0xc595('0x47')]['id']}})[_0xc595('0x26')](handleEntityNotFound(_0x3940c1,null))['then'](removeEntity(_0x3940c1,null))[_0xc595('0x4b')](handleError(_0x3940c1,null));};exports[_0xc595('0x4e')]=function(_0x1ef3eb,_0x40770d,_0x111dd9){var _0x16ecf9={};var _0x407cad={};var _0x1f9761;var _0x20033f;return db['VtigerConfiguration'][_0xc595('0x4f')]({'where':{'id':_0x1ef3eb['params']['id']}})[_0xc595('0x26')](handleEntityNotFound(_0x40770d,null))[_0xc595('0x26')](function(_0x42a450){if(_0x42a450){_0x1f9761=_0x42a450;_0x407cad['model']=_[_0xc595('0x35')](db['VtigerField'][_0xc595('0x2f')]);_0x407cad['query']=_['keys'](_0x1ef3eb[_0xc595('0x34')]);_0x407cad[_0xc595('0x36')]=_[_0xc595('0x37')](_0x407cad[_0xc595('0x33')],_0x407cad[_0xc595('0x34')]);_0x16ecf9[_0xc595('0x38')]=_[_0xc595('0x37')](_0x407cad['model'],qs[_0xc595('0x39')](_0x1ef3eb[_0xc595('0x34')][_0xc595('0x39')]));_0x16ecf9[_0xc595('0x38')]=_0x16ecf9['attributes']['length']?_0x16ecf9[_0xc595('0x38')]:_0x407cad[_0xc595('0x33')];_0x16ecf9[_0xc595('0x3c')]=qs[_0xc595('0x3d')](_0x1ef3eb[_0xc595('0x34')][_0xc595('0x3d')]);_0x16ecf9[_0xc595('0x3e')]=qs['filters'](_[_0xc595('0x50')](_0x1ef3eb['query'],_0x407cad[_0xc595('0x36')]));if(_0x1ef3eb['query'][_0xc595('0x3f')]){_0x16ecf9[_0xc595('0x3e')]=_[_0xc595('0x40')](_0x16ecf9[_0xc595('0x3e')],{'$or':_[_0xc595('0x2d')](_0x16ecf9['attributes'],function(_0x53f201){var _0x58ee2c={};_0x58ee2c[_0x53f201]={'$like':'%'+_0x1ef3eb[_0xc595('0x34')]['filter']+'%'};return _0x58ee2c;})});}_0x16ecf9=_[_0xc595('0x40')]({},_0x16ecf9,_0x1ef3eb['options']);return _0x1f9761[_0xc595('0x4e')](_0x16ecf9);}})[_0xc595('0x26')](function(_0x349c86){if(_0x349c86){_0x20033f=_0x349c86[_0xc595('0x48')];if(!_0x1ef3eb['query'][_0xc595('0x3a')](_0xc595('0x3b'))){_0x16ecf9[_0xc595('0x1e')]=qs[_0xc595('0x1e')](_0x1ef3eb['query']['limit']);_0x16ecf9[_0xc595('0x1c')]=qs[_0xc595('0x1c')](_0x1ef3eb[_0xc595('0x34')][_0xc595('0x1c')]);}return _0x1f9761[_0xc595('0x4e')](_0x16ecf9);}})['then'](function(_0x49d755){if(_0x49d755){return _0x49d755?{'count':_0x20033f,'rows':_0x49d755}:null;}})[_0xc595('0x26')](respondWithResult(_0x40770d,null))['catch'](handleError(_0x40770d,null));};exports['getSubjects']=function(_0x47b517,_0x2e818e,_0x430463){var _0x3cb779={};var _0xe0e0ff={};var _0xd2d402;var _0x5e1cf5;return db[_0xc595('0x2e')][_0xc595('0x4f')]({'where':{'id':_0x47b517[_0xc595('0x47')]['id']}})['then'](handleEntityNotFound(_0x2e818e,null))['then'](function(_0x2001ae){if(_0x2001ae){_0xd2d402=_0x2001ae;_0xe0e0ff[_0xc595('0x33')]=_['keys'](db[_0xc595('0x51')][_0xc595('0x2f')]);_0xe0e0ff[_0xc595('0x34')]=_[_0xc595('0x35')](_0x47b517[_0xc595('0x34')]);_0xe0e0ff[_0xc595('0x36')]=_[_0xc595('0x37')](_0xe0e0ff[_0xc595('0x33')],_0xe0e0ff[_0xc595('0x34')]);_0x3cb779['attributes']=_[_0xc595('0x37')](_0xe0e0ff[_0xc595('0x33')],qs['fields'](_0x47b517[_0xc595('0x34')][_0xc595('0x39')]));_0x3cb779[_0xc595('0x38')]=_0x3cb779[_0xc595('0x38')][_0xc595('0x48')]?_0x3cb779[_0xc595('0x38')]:_0xe0e0ff['model'];_0x3cb779[_0xc595('0x3c')]=qs[_0xc595('0x3d')](_0x47b517[_0xc595('0x34')]['sort']);_0x3cb779['where']=qs[_0xc595('0x36')](_[_0xc595('0x50')](_0x47b517[_0xc595('0x34')],_0xe0e0ff[_0xc595('0x36')]));if(_0x47b517[_0xc595('0x34')]['filter']){_0x3cb779[_0xc595('0x3e')]=_[_0xc595('0x40')](_0x3cb779['where'],{'$or':_[_0xc595('0x2d')](_0x3cb779[_0xc595('0x38')],function(_0x176ccf){var _0x11c48d={};_0x11c48d[_0x176ccf]={'$like':'%'+_0x47b517[_0xc595('0x34')][_0xc595('0x3f')]+'%'};return _0x11c48d;})});}_0x3cb779=_['merge']({},_0x3cb779,_0x47b517[_0xc595('0x42')]);return _0xd2d402[_0xc595('0x52')](_0x3cb779);}})[_0xc595('0x26')](function(_0x51b9fb){if(_0x51b9fb){_0x5e1cf5=_0x51b9fb[_0xc595('0x48')];if(!_0x47b517['query'][_0xc595('0x3a')](_0xc595('0x3b'))){_0x3cb779['limit']=qs[_0xc595('0x1e')](_0x47b517[_0xc595('0x34')][_0xc595('0x1e')]);_0x3cb779['offset']=qs[_0xc595('0x1c')](_0x47b517[_0xc595('0x34')][_0xc595('0x1c')]);}return _0xd2d402[_0xc595('0x52')](_0x3cb779);}})[_0xc595('0x26')](function(_0x481b9e){if(_0x481b9e){return _0x481b9e?{'count':_0x5e1cf5,'rows':_0x481b9e}:null;}})[_0xc595('0x26')](respondWithResult(_0x2e818e,null))[_0xc595('0x4b')](handleError(_0x2e818e,null));};exports['getDescriptions']=function(_0x42239b,_0x5d926b,_0x48dec9){var _0x1e84f7={};var _0x1653e0={};var _0x3e997c;var _0x163bb4;return db[_0xc595('0x2e')]['findOne']({'where':{'id':_0x42239b[_0xc595('0x47')]['id']}})[_0xc595('0x26')](handleEntityNotFound(_0x5d926b,null))[_0xc595('0x26')](function(_0x549969){if(_0x549969){_0x3e997c=_0x549969;_0x1653e0[_0xc595('0x33')]=_[_0xc595('0x35')](db['VtigerField'][_0xc595('0x2f')]);_0x1653e0[_0xc595('0x34')]=_[_0xc595('0x35')](_0x42239b[_0xc595('0x34')]);_0x1653e0[_0xc595('0x36')]=_['intersection'](_0x1653e0['model'],_0x1653e0[_0xc595('0x34')]);_0x1e84f7[_0xc595('0x38')]=_['intersection'](_0x1653e0[_0xc595('0x33')],qs[_0xc595('0x39')](_0x42239b[_0xc595('0x34')][_0xc595('0x39')]));_0x1e84f7[_0xc595('0x38')]=_0x1e84f7[_0xc595('0x38')][_0xc595('0x48')]?_0x1e84f7['attributes']:_0x1653e0['model'];_0x1e84f7[_0xc595('0x3c')]=qs[_0xc595('0x3d')](_0x42239b[_0xc595('0x34')][_0xc595('0x3d')]);_0x1e84f7[_0xc595('0x3e')]=qs[_0xc595('0x36')](_[_0xc595('0x50')](_0x42239b[_0xc595('0x34')],_0x1653e0[_0xc595('0x36')]));if(_0x42239b[_0xc595('0x34')]['filter']){_0x1e84f7[_0xc595('0x3e')]=_[_0xc595('0x40')](_0x1e84f7[_0xc595('0x3e')],{'$or':_[_0xc595('0x2d')](_0x1e84f7[_0xc595('0x38')],function(_0x356669){var _0x13d51c={};_0x13d51c[_0x356669]={'$like':'%'+_0x42239b[_0xc595('0x34')][_0xc595('0x3f')]+'%'};return _0x13d51c;})});}_0x1e84f7=_[_0xc595('0x40')]({},_0x1e84f7,_0x42239b[_0xc595('0x42')]);return _0x3e997c[_0xc595('0x53')](_0x1e84f7);}})[_0xc595('0x26')](function(_0x3f028b){if(_0x3f028b){_0x163bb4=_0x3f028b['length'];if(!_0x42239b[_0xc595('0x34')][_0xc595('0x3a')]('nolimit')){_0x1e84f7[_0xc595('0x1e')]=qs['limit'](_0x42239b[_0xc595('0x34')][_0xc595('0x1e')]);_0x1e84f7['offset']=qs[_0xc595('0x1c')](_0x42239b['query'][_0xc595('0x1c')]);}return _0x3e997c['getDescriptions'](_0x1e84f7);}})[_0xc595('0x26')](function(_0x125b71){if(_0x125b71){return _0x125b71?{'count':_0x163bb4,'rows':_0x125b71}:null;}})[_0xc595('0x26')](respondWithResult(_0x5d926b,null))[_0xc595('0x4b')](handleError(_0x5d926b,null));}; \ No newline at end of file +var _0xba47=['../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','set','reject','then','destroy','sendStatus','name','send','index','map','VtigerConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','rows','catch','params','rawAttributes','create','update','body','find','getFields','VtigerField','length','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2bd2a2,_0x556fd2){var _0x3c9069=function(_0x35e520){while(--_0x35e520){_0x2bd2a2['push'](_0x2bd2a2['shift']());}};_0x3c9069(++_0x556fd2);}(_0xba47,0x1ac));var _0x7ba4=function(_0x1475ba,_0x555aae){_0x1475ba=_0x1475ba-0x0;var _0x4efcf7=_0xba47[_0x1475ba];return _0x4efcf7;};'use strict';var emlformat=require(_0x7ba4('0x0'));var rimraf=require(_0x7ba4('0x1'));var zipdir=require(_0x7ba4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ba4('0x3'));var moment=require(_0x7ba4('0x4'));var BPromise=require(_0x7ba4('0x5'));var Mustache=require(_0x7ba4('0x6'));var util=require('util');var path=require(_0x7ba4('0x7'));var sox=require(_0x7ba4('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ba4('0x9'));var _=require(_0x7ba4('0xa'));var squel=require(_0x7ba4('0xb'));var crypto=require(_0x7ba4('0xc'));var jsforce=require(_0x7ba4('0xd'));var deskjs=require(_0x7ba4('0xe'));var toCsv=require(_0x7ba4('0xf'));var querystring=require(_0x7ba4('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7ba4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7ba4('0x12'));var hardwareService=require(_0x7ba4('0x13'));var logger=require(_0x7ba4('0x14'))(_0x7ba4('0x15'));var utils=require('../../config/utils');var config=require(_0x7ba4('0x16'));var licenseUtil=require(_0x7ba4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x83d2c,_0x266be2){_0x266be2=_0x266be2||0xcc;return function(_0x2fdee0){if(_0x2fdee0){return _0x83d2c['sendStatus'](_0x266be2);}return _0x83d2c[_0x7ba4('0x18')](_0x266be2)[_0x7ba4('0x19')]();};}function respondWithResult(_0x26da9d,_0x471e93){_0x471e93=_0x471e93||0xc8;return function(_0xcf45f6){if(_0xcf45f6){return _0x26da9d[_0x7ba4('0x18')](_0x471e93)[_0x7ba4('0x1a')](_0xcf45f6);}};}function respondWithFilteredResult(_0x1e16c5,_0x3197d9){return function(_0x480e0b){if(_0x480e0b){var _0x4b0fb7=typeof _0x3197d9[_0x7ba4('0x1b')]===_0x7ba4('0x1c')&&typeof _0x3197d9['limit']===_0x7ba4('0x1c');var _0xbc6330=_0x480e0b[_0x7ba4('0x1d')];var _0xd5bdde=_0x4b0fb7?0x0:_0x3197d9[_0x7ba4('0x1b')];var _0x988f2f=_0x4b0fb7?_0x480e0b[_0x7ba4('0x1d')]:_0x3197d9[_0x7ba4('0x1b')]+_0x3197d9['limit'];var _0x5d14ba;if(_0x988f2f>=_0xbc6330){_0x988f2f=_0xbc6330;_0x5d14ba=0xc8;}else{_0x5d14ba=0xce;}_0x1e16c5[_0x7ba4('0x18')](_0x5d14ba);return _0x1e16c5[_0x7ba4('0x1e')]('Content-Range',_0xd5bdde+'-'+_0x988f2f+'/'+_0xbc6330)[_0x7ba4('0x1a')](_0x480e0b);}return null;};}function patchUpdates(_0x14a214){return function(_0x3601ba){try{jsonpatch['apply'](_0x3601ba,_0x14a214,!![]);}catch(_0x5b1dde){return BPromise[_0x7ba4('0x1f')](_0x5b1dde);}return _0x3601ba['save']();};}function saveUpdates(_0x4bd364,_0x225b6a){return function(_0x4dffd7){if(_0x4dffd7){return _0x4dffd7['update'](_0x4bd364)[_0x7ba4('0x20')](function(_0x246943){return _0x246943;});}return null;};}function removeEntity(_0x3a3c67,_0x413a67){return function(_0x2afc11){if(_0x2afc11){return _0x2afc11[_0x7ba4('0x21')]()[_0x7ba4('0x20')](function(){_0x3a3c67['status'](0xcc)[_0x7ba4('0x19')]();});}};}function handleEntityNotFound(_0x34ee62,_0x10508e){return function(_0x3c679c){if(!_0x3c679c){_0x34ee62[_0x7ba4('0x22')](0x194);}return _0x3c679c;};}function handleError(_0x28c51c,_0x4f0ce5){_0x4f0ce5=_0x4f0ce5||0x1f4;return function(_0x901837){logger['error'](_0x901837['stack']);if(_0x901837['name']){delete _0x901837[_0x7ba4('0x23')];}_0x28c51c[_0x7ba4('0x18')](_0x4f0ce5)[_0x7ba4('0x24')](_0x901837);};}exports[_0x7ba4('0x25')]=function(_0x37d8cd,_0x494754){var _0x315cdb={},_0x45be5c={},_0xfb47a5={'count':0x0,'rows':[]};var _0x40a6fb=_[_0x7ba4('0x26')](db[_0x7ba4('0x27')]['rawAttributes'],function(_0x4fdbc7){return{'name':_0x4fdbc7[_0x7ba4('0x28')],'type':_0x4fdbc7[_0x7ba4('0x29')][_0x7ba4('0x2a')]};});_0x45be5c[_0x7ba4('0x2b')]=_[_0x7ba4('0x26')](_0x40a6fb,_0x7ba4('0x23'));_0x45be5c[_0x7ba4('0x2c')]=_[_0x7ba4('0x2d')](_0x37d8cd[_0x7ba4('0x2c')]);_0x45be5c[_0x7ba4('0x2e')]=_['intersection'](_0x45be5c[_0x7ba4('0x2b')],_0x45be5c[_0x7ba4('0x2c')]);_0x315cdb['attributes']=_[_0x7ba4('0x2f')](_0x45be5c[_0x7ba4('0x2b')],qs['fields'](_0x37d8cd[_0x7ba4('0x2c')][_0x7ba4('0x30')]));_0x315cdb['attributes']=_0x315cdb[_0x7ba4('0x31')]['length']?_0x315cdb['attributes']:_0x45be5c[_0x7ba4('0x2b')];if(!_0x37d8cd['query'][_0x7ba4('0x32')](_0x7ba4('0x33'))){_0x315cdb[_0x7ba4('0x34')]=qs[_0x7ba4('0x34')](_0x37d8cd[_0x7ba4('0x2c')][_0x7ba4('0x34')]);_0x315cdb['offset']=qs[_0x7ba4('0x1b')](_0x37d8cd[_0x7ba4('0x2c')][_0x7ba4('0x1b')]);}_0x315cdb[_0x7ba4('0x35')]=qs['sort'](_0x37d8cd[_0x7ba4('0x2c')][_0x7ba4('0x36')]);_0x315cdb[_0x7ba4('0x37')]=qs[_0x7ba4('0x2e')](_[_0x7ba4('0x38')](_0x37d8cd['query'],_0x45be5c[_0x7ba4('0x2e')]),_0x40a6fb);if(_0x37d8cd[_0x7ba4('0x2c')][_0x7ba4('0x39')]){_0x315cdb['where']=_[_0x7ba4('0x3a')](_0x315cdb[_0x7ba4('0x37')],{'$or':_[_0x7ba4('0x26')](_0x40a6fb,function(_0x498520){if(_0x498520[_0x7ba4('0x29')]!=='VIRTUAL'){var _0x21c7f8={};_0x21c7f8[_0x498520['name']]={'$like':'%'+_0x37d8cd[_0x7ba4('0x2c')][_0x7ba4('0x39')]+'%'};return _0x21c7f8;}})});}_0x315cdb=_[_0x7ba4('0x3a')]({},_0x315cdb,_0x37d8cd[_0x7ba4('0x3b')]);var _0x2307ef={'where':_0x315cdb[_0x7ba4('0x37')]};return db[_0x7ba4('0x27')][_0x7ba4('0x1d')](_0x2307ef)[_0x7ba4('0x20')](function(_0x234182){_0xfb47a5['count']=_0x234182;if(_0x37d8cd['query']['includeAll']){_0x315cdb[_0x7ba4('0x3c')]=[{'all':!![]}];}return db[_0x7ba4('0x27')]['findAll'](_0x315cdb);})[_0x7ba4('0x20')](function(_0x3daf6f){_0xfb47a5[_0x7ba4('0x3d')]=_0x3daf6f;return _0xfb47a5;})['then'](respondWithFilteredResult(_0x494754,_0x315cdb))[_0x7ba4('0x3e')](handleError(_0x494754,null));};exports['show']=function(_0x21338c,_0x242b7e){var _0x306e4e={'raw':![],'where':{'id':_0x21338c[_0x7ba4('0x3f')]['id']}},_0x35b21a={};_0x35b21a['model']=_['keys'](db[_0x7ba4('0x27')][_0x7ba4('0x40')]);_0x35b21a[_0x7ba4('0x2c')]=_['keys'](_0x21338c[_0x7ba4('0x2c')]);_0x35b21a['filters']=_[_0x7ba4('0x2f')](_0x35b21a[_0x7ba4('0x2b')],_0x35b21a['query']);_0x306e4e[_0x7ba4('0x31')]=_[_0x7ba4('0x2f')](_0x35b21a[_0x7ba4('0x2b')],qs[_0x7ba4('0x30')](_0x21338c[_0x7ba4('0x2c')][_0x7ba4('0x30')]));_0x306e4e[_0x7ba4('0x31')]=_0x306e4e[_0x7ba4('0x31')]['length']?_0x306e4e[_0x7ba4('0x31')]:_0x35b21a[_0x7ba4('0x2b')];if(_0x21338c[_0x7ba4('0x2c')]['includeAll']){_0x306e4e[_0x7ba4('0x3c')]=[{'all':!![]}];}_0x306e4e=_['merge']({},_0x306e4e,_0x21338c[_0x7ba4('0x3b')]);return db[_0x7ba4('0x27')]['find'](_0x306e4e)[_0x7ba4('0x20')](handleEntityNotFound(_0x242b7e,null))[_0x7ba4('0x20')](respondWithResult(_0x242b7e,null))[_0x7ba4('0x3e')](handleError(_0x242b7e,null));};exports['create']=function(_0x2ce0c0,_0x3000cf){return db['VtigerConfiguration'][_0x7ba4('0x41')](_0x2ce0c0['body'],{})[_0x7ba4('0x20')](respondWithResult(_0x3000cf,0xc9))[_0x7ba4('0x3e')](handleError(_0x3000cf,null));};exports[_0x7ba4('0x42')]=function(_0x4e62d6,_0x448cb5){if(_0x4e62d6[_0x7ba4('0x43')]['id']){delete _0x4e62d6[_0x7ba4('0x43')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x4e62d6[_0x7ba4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x448cb5,null))[_0x7ba4('0x20')](saveUpdates(_0x4e62d6['body'],null))[_0x7ba4('0x20')](respondWithResult(_0x448cb5,null))['catch'](handleError(_0x448cb5,null));};exports[_0x7ba4('0x21')]=function(_0x7044cc,_0x4946ae){return db[_0x7ba4('0x27')][_0x7ba4('0x44')]({'where':{'id':_0x7044cc[_0x7ba4('0x3f')]['id']}})[_0x7ba4('0x20')](handleEntityNotFound(_0x4946ae,null))[_0x7ba4('0x20')](removeEntity(_0x4946ae,null))['catch'](handleError(_0x4946ae,null));};exports[_0x7ba4('0x45')]=function(_0x1dfa4b,_0xd6d1da,_0xed34b2){var _0x5645f3={};var _0x104690={};var _0x26a000;var _0x18609d;return db[_0x7ba4('0x27')]['findOne']({'where':{'id':_0x1dfa4b[_0x7ba4('0x3f')]['id']}})[_0x7ba4('0x20')](handleEntityNotFound(_0xd6d1da,null))[_0x7ba4('0x20')](function(_0x3ffc1d){if(_0x3ffc1d){_0x26a000=_0x3ffc1d;_0x104690[_0x7ba4('0x2b')]=_[_0x7ba4('0x2d')](db[_0x7ba4('0x46')]['rawAttributes']);_0x104690['query']=_[_0x7ba4('0x2d')](_0x1dfa4b[_0x7ba4('0x2c')]);_0x104690[_0x7ba4('0x2e')]=_[_0x7ba4('0x2f')](_0x104690[_0x7ba4('0x2b')],_0x104690['query']);_0x5645f3['attributes']=_['intersection'](_0x104690['model'],qs[_0x7ba4('0x30')](_0x1dfa4b[_0x7ba4('0x2c')][_0x7ba4('0x30')]));_0x5645f3['attributes']=_0x5645f3[_0x7ba4('0x31')]['length']?_0x5645f3[_0x7ba4('0x31')]:_0x104690[_0x7ba4('0x2b')];_0x5645f3[_0x7ba4('0x35')]=qs[_0x7ba4('0x36')](_0x1dfa4b[_0x7ba4('0x2c')][_0x7ba4('0x36')]);_0x5645f3[_0x7ba4('0x37')]=qs[_0x7ba4('0x2e')](_[_0x7ba4('0x38')](_0x1dfa4b[_0x7ba4('0x2c')],_0x104690['filters']));if(_0x1dfa4b[_0x7ba4('0x2c')]['filter']){_0x5645f3['where']=_[_0x7ba4('0x3a')](_0x5645f3['where'],{'$or':_[_0x7ba4('0x26')](_0x5645f3[_0x7ba4('0x31')],function(_0x347cec){var _0x1a0436={};_0x1a0436[_0x347cec]={'$like':'%'+_0x1dfa4b[_0x7ba4('0x2c')][_0x7ba4('0x39')]+'%'};return _0x1a0436;})});}_0x5645f3=_[_0x7ba4('0x3a')]({},_0x5645f3,_0x1dfa4b[_0x7ba4('0x3b')]);return _0x26a000['getFields'](_0x5645f3);}})['then'](function(_0x10f248){if(_0x10f248){_0x18609d=_0x10f248[_0x7ba4('0x47')];if(!_0x1dfa4b[_0x7ba4('0x2c')]['hasOwnProperty'](_0x7ba4('0x33'))){_0x5645f3[_0x7ba4('0x34')]=qs[_0x7ba4('0x34')](_0x1dfa4b[_0x7ba4('0x2c')]['limit']);_0x5645f3['offset']=qs[_0x7ba4('0x1b')](_0x1dfa4b[_0x7ba4('0x2c')]['offset']);}return _0x26a000[_0x7ba4('0x45')](_0x5645f3);}})['then'](function(_0x3f5a1c){if(_0x3f5a1c){return _0x3f5a1c?{'count':_0x18609d,'rows':_0x3f5a1c}:null;}})[_0x7ba4('0x20')](respondWithResult(_0xd6d1da,null))[_0x7ba4('0x3e')](handleError(_0xd6d1da,null));};exports[_0x7ba4('0x48')]=function(_0x197137,_0x281511,_0x480cb4){var _0x5c0c62={};var _0x556ac5={};var _0x1f1c6e;var _0x1d0ad6;return db[_0x7ba4('0x27')][_0x7ba4('0x49')]({'where':{'id':_0x197137['params']['id']}})[_0x7ba4('0x20')](handleEntityNotFound(_0x281511,null))['then'](function(_0x3bf8c0){if(_0x3bf8c0){_0x1f1c6e=_0x3bf8c0;_0x556ac5['model']=_[_0x7ba4('0x2d')](db[_0x7ba4('0x46')]['rawAttributes']);_0x556ac5[_0x7ba4('0x2c')]=_[_0x7ba4('0x2d')](_0x197137[_0x7ba4('0x2c')]);_0x556ac5['filters']=_[_0x7ba4('0x2f')](_0x556ac5[_0x7ba4('0x2b')],_0x556ac5['query']);_0x5c0c62[_0x7ba4('0x31')]=_['intersection'](_0x556ac5[_0x7ba4('0x2b')],qs[_0x7ba4('0x30')](_0x197137[_0x7ba4('0x2c')][_0x7ba4('0x30')]));_0x5c0c62[_0x7ba4('0x31')]=_0x5c0c62[_0x7ba4('0x31')][_0x7ba4('0x47')]?_0x5c0c62[_0x7ba4('0x31')]:_0x556ac5[_0x7ba4('0x2b')];_0x5c0c62[_0x7ba4('0x35')]=qs['sort'](_0x197137[_0x7ba4('0x2c')]['sort']);_0x5c0c62[_0x7ba4('0x37')]=qs[_0x7ba4('0x2e')](_['pick'](_0x197137[_0x7ba4('0x2c')],_0x556ac5[_0x7ba4('0x2e')]));if(_0x197137[_0x7ba4('0x2c')][_0x7ba4('0x39')]){_0x5c0c62[_0x7ba4('0x37')]=_[_0x7ba4('0x3a')](_0x5c0c62['where'],{'$or':_['map'](_0x5c0c62[_0x7ba4('0x31')],function(_0x4c6569){var _0x5e88cd={};_0x5e88cd[_0x4c6569]={'$like':'%'+_0x197137['query']['filter']+'%'};return _0x5e88cd;})});}_0x5c0c62=_[_0x7ba4('0x3a')]({},_0x5c0c62,_0x197137[_0x7ba4('0x3b')]);return _0x1f1c6e[_0x7ba4('0x48')](_0x5c0c62);}})[_0x7ba4('0x20')](function(_0x149ec7){if(_0x149ec7){_0x1d0ad6=_0x149ec7[_0x7ba4('0x47')];if(!_0x197137[_0x7ba4('0x2c')][_0x7ba4('0x32')](_0x7ba4('0x33'))){_0x5c0c62[_0x7ba4('0x34')]=qs['limit'](_0x197137[_0x7ba4('0x2c')][_0x7ba4('0x34')]);_0x5c0c62[_0x7ba4('0x1b')]=qs[_0x7ba4('0x1b')](_0x197137['query']['offset']);}return _0x1f1c6e[_0x7ba4('0x48')](_0x5c0c62);}})[_0x7ba4('0x20')](function(_0x2bd5a8){if(_0x2bd5a8){return _0x2bd5a8?{'count':_0x1d0ad6,'rows':_0x2bd5a8}:null;}})[_0x7ba4('0x20')](respondWithResult(_0x281511,null))[_0x7ba4('0x3e')](handleError(_0x281511,null));};exports['getDescriptions']=function(_0x35404d,_0x54b139,_0x1ce2a1){var _0x56dca0={};var _0x48b87d={};var _0x23fe4b;var _0x436de8;return db[_0x7ba4('0x27')]['findOne']({'where':{'id':_0x35404d[_0x7ba4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x54b139,null))[_0x7ba4('0x20')](function(_0x1a36b5){if(_0x1a36b5){_0x23fe4b=_0x1a36b5;_0x48b87d[_0x7ba4('0x2b')]=_[_0x7ba4('0x2d')](db[_0x7ba4('0x46')][_0x7ba4('0x40')]);_0x48b87d[_0x7ba4('0x2c')]=_[_0x7ba4('0x2d')](_0x35404d['query']);_0x48b87d[_0x7ba4('0x2e')]=_[_0x7ba4('0x2f')](_0x48b87d[_0x7ba4('0x2b')],_0x48b87d[_0x7ba4('0x2c')]);_0x56dca0[_0x7ba4('0x31')]=_['intersection'](_0x48b87d[_0x7ba4('0x2b')],qs['fields'](_0x35404d[_0x7ba4('0x2c')]['fields']));_0x56dca0[_0x7ba4('0x31')]=_0x56dca0['attributes'][_0x7ba4('0x47')]?_0x56dca0[_0x7ba4('0x31')]:_0x48b87d[_0x7ba4('0x2b')];_0x56dca0[_0x7ba4('0x35')]=qs[_0x7ba4('0x36')](_0x35404d[_0x7ba4('0x2c')][_0x7ba4('0x36')]);_0x56dca0[_0x7ba4('0x37')]=qs[_0x7ba4('0x2e')](_[_0x7ba4('0x38')](_0x35404d[_0x7ba4('0x2c')],_0x48b87d[_0x7ba4('0x2e')]));if(_0x35404d['query'][_0x7ba4('0x39')]){_0x56dca0[_0x7ba4('0x37')]=_[_0x7ba4('0x3a')](_0x56dca0['where'],{'$or':_[_0x7ba4('0x26')](_0x56dca0['attributes'],function(_0x168705){var _0x1c297c={};_0x1c297c[_0x168705]={'$like':'%'+_0x35404d[_0x7ba4('0x2c')][_0x7ba4('0x39')]+'%'};return _0x1c297c;})});}_0x56dca0=_[_0x7ba4('0x3a')]({},_0x56dca0,_0x35404d['options']);return _0x23fe4b[_0x7ba4('0x4a')](_0x56dca0);}})[_0x7ba4('0x20')](function(_0x9f9d87){if(_0x9f9d87){_0x436de8=_0x9f9d87[_0x7ba4('0x47')];if(!_0x35404d[_0x7ba4('0x2c')]['hasOwnProperty'](_0x7ba4('0x33'))){_0x56dca0[_0x7ba4('0x34')]=qs['limit'](_0x35404d[_0x7ba4('0x2c')][_0x7ba4('0x34')]);_0x56dca0[_0x7ba4('0x1b')]=qs[_0x7ba4('0x1b')](_0x35404d[_0x7ba4('0x2c')][_0x7ba4('0x1b')]);}return _0x23fe4b[_0x7ba4('0x4a')](_0x56dca0);}})[_0x7ba4('0x20')](function(_0x53665d){if(_0x53665d){return _0x53665d?{'count':_0x436de8,'rows':_0x53665d}:null;}})[_0x7ba4('0x20')](respondWithResult(_0x54b139,null))['catch'](handleError(_0x54b139,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index ae02bb4..20675d2 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 _0x26ec=['define','VtigerConfiguration','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x40287b,_0xc33817){var _0x6ae1b3=function(_0x1c563c){while(--_0x1c563c){_0x40287b['push'](_0x40287b['shift']());}};_0x6ae1b3(++_0xc33817);}(_0x26ec,0xe9));var _0xc26e=function(_0x38b0f1,_0xa1d93d){_0x38b0f1=_0x38b0f1-0x0;var _0x327bbc=_0x26ec[_0x38b0f1];return _0x327bbc;};'use strict';var _=require(_0xc26e('0x0'));var util=require(_0xc26e('0x1'));var logger=require(_0xc26e('0x2'))('api');var moment=require(_0xc26e('0x3'));var BPromise=require(_0xc26e('0x4'));var rp=require(_0xc26e('0x5'));var fs=require('fs');var path=require(_0xc26e('0x6'));var rimraf=require('rimraf');var config=require(_0xc26e('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xc26e('0x8')]=function(_0x1de060,_0x2bb7c5){return _0x1de060[_0xc26e('0x9')](_0xc26e('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x810b=['api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','util','../../config/logger'];(function(_0x55c541,_0x5c9e26){var _0x26b890=function(_0x21ac3c){while(--_0x21ac3c){_0x55c541['push'](_0x55c541['shift']());}};_0x26b890(++_0x5c9e26);}(_0x810b,0x15a));var _0xb810=function(_0x16dfa7,_0x1a92df){_0x16dfa7=_0x16dfa7-0x0;var _0x1734c0=_0x810b[_0x16dfa7];return _0x1734c0;};'use strict';var _=require('lodash');var util=require(_0xb810('0x0'));var logger=require(_0xb810('0x1'))(_0xb810('0x2'));var moment=require(_0xb810('0x3'));var BPromise=require(_0xb810('0x4'));var rp=require(_0xb810('0x5'));var fs=require('fs');var path=require(_0xb810('0x6'));var rimraf=require('rimraf');var config=require(_0xb810('0x7'));var attributes=require(_0xb810('0x8'));module[_0xb810('0x9')]=function(_0x108498,_0x1a2ab2){return _0x108498[_0xb810('0xa')]('VtigerConfiguration',attributes,{'tableName':_0xb810('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 81994a6..1ae3b8a 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 _0xd954=['VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x9f9380,_0x313674){var _0x45290e=function(_0x50ab18){while(--_0x50ab18){_0x9f9380['push'](_0x9f9380['shift']());}};_0x45290e(++_0x313674);}(_0xd954,0x1d5));var _0x4d95=function(_0x2f7270,_0x307af1){_0x2f7270=_0x2f7270-0x0;var _0xe1d89a=_0xd954[_0x2f7270];return _0xe1d89a;};'use strict';var _=require(_0x4d95('0x0'));var util=require(_0x4d95('0x1'));var moment=require(_0x4d95('0x2'));var BPromise=require(_0x4d95('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d95('0x4'))['db'];var utils=require(_0x4d95('0x5'));var logger=require(_0x4d95('0x6'))(_0x4d95('0x7'));var config=require(_0x4d95('0x8'));var jayson=require(_0x4d95('0x9'));var client=jayson[_0x4d95('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f489a,_0x2c5c02,_0x39f164){return new BPromise(function(_0x5bd93a,_0x15a354){return client[_0x4d95('0xb')](_0x3f489a,_0x39f164)[_0x4d95('0xc')](function(_0x28d0fe){logger[_0x4d95('0xd')](_0x4d95('0xe'),_0x2c5c02,_0x4d95('0xf'));logger[_0x4d95('0x10')](_0x4d95('0x11'),_0x2c5c02,_0x4d95('0xf'),JSON['stringify'](_0x28d0fe));if(_0x28d0fe[_0x4d95('0x12')]){if(_0x28d0fe[_0x4d95('0x12')][_0x4d95('0x13')]===0x1f4){logger[_0x4d95('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x2c5c02,_0x28d0fe[_0x4d95('0x12')]['message']);return _0x15a354(_0x28d0fe[_0x4d95('0x12')][_0x4d95('0x14')]);}logger[_0x4d95('0x12')](_0x4d95('0xe'),_0x2c5c02,_0x28d0fe[_0x4d95('0x12')][_0x4d95('0x14')]);return _0x5bd93a(_0x28d0fe[_0x4d95('0x12')][_0x4d95('0x14')]);}else{logger[_0x4d95('0xd')](_0x4d95('0xe'),_0x2c5c02,'request\x20sent');_0x5bd93a(_0x28d0fe[_0x4d95('0x15')][_0x4d95('0x14')]);}})[_0x4d95('0x16')](function(_0x3348c3){logger[_0x4d95('0x12')](_0x4d95('0xe'),_0x2c5c02,_0x3348c3);_0x15a354(_0x3348c3);});});} \ No newline at end of file +var _0x141a=['request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x4a8829,_0x51568a){var _0x9c0248=function(_0x1d9742){while(--_0x1d9742){_0x4a8829['push'](_0x4a8829['shift']());}};_0x9c0248(++_0x51568a);}(_0x141a,0x110));var _0xa141=function(_0x45a64c,_0x45857c){_0x45a64c=_0x45a64c-0x0;var _0x553de9=_0x141a[_0x45a64c];return _0x553de9;};'use strict';var _=require('lodash');var util=require(_0xa141('0x0'));var moment=require(_0xa141('0x1'));var BPromise=require(_0xa141('0x2'));var rs=require(_0xa141('0x3'));var fs=require('fs');var Redis=require(_0xa141('0x4'));var db=require(_0xa141('0x5'))['db'];var utils=require(_0xa141('0x6'));var logger=require(_0xa141('0x7'))(_0xa141('0x8'));var config=require('../../config/environment');var jayson=require(_0xa141('0x9'));var client=jayson['client'][_0xa141('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4272f1,_0x4ba18d,_0x9601db){return new BPromise(function(_0x46e9e1,_0x3d2e26){return client[_0xa141('0xb')](_0x4272f1,_0x9601db)[_0xa141('0xc')](function(_0x330439){logger[_0xa141('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x4ba18d,_0xa141('0xe'));logger['debug'](_0xa141('0xf'),_0x4ba18d,_0xa141('0xe'),JSON[_0xa141('0x10')](_0x330439));if(_0x330439[_0xa141('0x11')]){if(_0x330439['error']['code']===0x1f4){logger[_0xa141('0x11')](_0xa141('0x12'),_0x4ba18d,_0x330439[_0xa141('0x11')][_0xa141('0x13')]);return _0x3d2e26(_0x330439[_0xa141('0x11')]['message']);}logger['error'](_0xa141('0x12'),_0x4ba18d,_0x330439[_0xa141('0x11')]['message']);return _0x46e9e1(_0x330439['error']['message']);}else{logger[_0xa141('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x4ba18d,_0xa141('0xe'));_0x46e9e1(_0x330439[_0xa141('0x14')][_0xa141('0x13')]);}})[_0xa141('0x15')](function(_0x56dcae){logger['error'](_0xa141('0x12'),_0x4ba18d,_0x56dcae);_0x3d2e26(_0x56dcae);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index e5b671c..97e17bd 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 _0x9d54=['isAuthenticated','show','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x4ca7c3,_0x20a99e){var _0x454288=function(_0x4032dd){while(--_0x4032dd){_0x4ca7c3['push'](_0x4ca7c3['shift']());}};_0x454288(++_0x20a99e);}(_0x9d54,0x15b));var _0x49d5=function(_0x400f64,_0x5bc51e){_0x400f64=_0x400f64-0x0;var _0x41c060=_0x9d54[_0x400f64];return _0x41c060;};'use strict';var multer=require(_0x49d5('0x0'));var util=require(_0x49d5('0x1'));var path=require(_0x49d5('0x2'));var timeout=require(_0x49d5('0x3'));var express=require(_0x49d5('0x4'));var router=express[_0x49d5('0x5')]();var fs_extra=require(_0x49d5('0x6'));var auth=require(_0x49d5('0x7'));var interaction=require(_0x49d5('0x8'));var config=require(_0x49d5('0x9'));var controller=require('./intVtigerField.controller');router[_0x49d5('0xa')]('/',auth['isAuthenticated'](),controller[_0x49d5('0xb')]);router[_0x49d5('0xa')](_0x49d5('0xc'),auth[_0x49d5('0xd')](),controller[_0x49d5('0xe')]);router[_0x49d5('0xf')]('/',auth[_0x49d5('0xd')](),controller['create']);router[_0x49d5('0x10')](_0x49d5('0xc'),auth[_0x49d5('0xd')](),controller[_0x49d5('0x11')]);router[_0x49d5('0x12')](_0x49d5('0xc'),auth[_0x49d5('0xd')](),controller['destroy']);module[_0x49d5('0x13')]=router; \ No newline at end of file +var _0xb914=['./intVtigerField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x242023,_0x2d5ede){var _0x19375d=function(_0x1456e7){while(--_0x1456e7){_0x242023['push'](_0x242023['shift']());}};_0x19375d(++_0x2d5ede);}(_0xb914,0x8b));var _0x4b91=function(_0x38d8f5,_0x547e60){_0x38d8f5=_0x38d8f5-0x0;var _0x1db685=_0xb914[_0x38d8f5];return _0x1db685;};'use strict';var multer=require(_0x4b91('0x0'));var util=require(_0x4b91('0x1'));var path=require('path');var timeout=require(_0x4b91('0x2'));var express=require('express');var router=express[_0x4b91('0x3')]();var fs_extra=require(_0x4b91('0x4'));var auth=require(_0x4b91('0x5'));var interaction=require(_0x4b91('0x6'));var config=require(_0x4b91('0x7'));var controller=require(_0x4b91('0x8'));router[_0x4b91('0x9')]('/',auth['isAuthenticated'](),controller[_0x4b91('0xa')]);router['get'](_0x4b91('0xb'),auth[_0x4b91('0xc')](),controller[_0x4b91('0xd')]);router[_0x4b91('0xe')]('/',auth[_0x4b91('0xc')](),controller[_0x4b91('0xf')]);router[_0x4b91('0x10')](_0x4b91('0xb'),auth[_0x4b91('0xc')](),controller[_0x4b91('0x11')]);router[_0x4b91('0x12')]('/:id',auth[_0x4b91('0xc')](),controller[_0x4b91('0x13')]);module[_0x4b91('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c69ee21..cf8e69e 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 _0x2339=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING','BOOLEAN'];(function(_0xf15857,_0x2cf860){var _0x2f4e5c=function(_0x3c01aa){while(--_0x3c01aa){_0xf15857['push'](_0xf15857['shift']());}};_0x2f4e5c(++_0x2cf860);}(_0x2339,0xf8));var _0x9233=function(_0x18a033,_0x3c5fae){_0x18a033=_0x18a033-0x0;var _0xfd0041=_0x2339[_0x18a033];return _0xfd0041;};'use strict';var Sequelize=require(_0x9233('0x0'));module[_0x9233('0x1')]={'type':{'type':Sequelize[_0x9233('0x2')](_0x9233('0x3'),'variable',_0x9233('0x4'),_0x9233('0x5'),'picklist'),'defaultValue':_0x9233('0x3')},'content':{'type':Sequelize[_0x9233('0x6')]},'key':{'type':Sequelize[_0x9233('0x6')]},'keyType':{'type':Sequelize[_0x9233('0x2')]('string','variable',_0x9233('0x4'))},'keyContent':{'type':Sequelize[_0x9233('0x6')]},'idField':{'type':Sequelize[_0x9233('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9233('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9233('0x6')]}}; \ No newline at end of file +var _0xe77a=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x57d2e6,_0x331cc5){var _0x14d40c=function(_0x353fc8){while(--_0x353fc8){_0x57d2e6['push'](_0x57d2e6['shift']());}};_0x14d40c(++_0x331cc5);}(_0xe77a,0xf2));var _0xae77=function(_0x320f9f,_0x2d1cbe){_0x320f9f=_0x320f9f-0x0;var _0x7e9ba4=_0xe77a[_0x320f9f];return _0x7e9ba4;};'use strict';var Sequelize=require(_0xae77('0x0'));module[_0xae77('0x1')]={'type':{'type':Sequelize[_0xae77('0x2')](_0xae77('0x3'),_0xae77('0x4'),_0xae77('0x5'),_0xae77('0x6'),_0xae77('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xae77('0x8')]},'key':{'type':Sequelize[_0xae77('0x8')]},'keyType':{'type':Sequelize[_0xae77('0x2')](_0xae77('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xae77('0x8')]},'idField':{'type':Sequelize[_0xae77('0x8')]},'nameField':{'type':Sequelize[_0xae77('0x8')]},'customField':{'type':Sequelize[_0xae77('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xae77('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f5a51ad..52413af 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 _0x996d=['order','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','params','rawAttributes','intersection','fields','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VtigerField','type','key','map','query','keys','filters','model','attributes','length','hasOwnProperty','nolimit','limit'];(function(_0x52f25d,_0x3fabcc){var _0x443f30=function(_0x3a8a99){while(--_0x3a8a99){_0x52f25d['push'](_0x52f25d['shift']());}};_0x443f30(++_0x3fabcc);}(_0x996d,0xed));var _0xd996=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x996d[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xd996('0x0'));var rimraf=require(_0xd996('0x1'));var zipdir=require(_0xd996('0x2'));var jsonpatch=require(_0xd996('0x3'));var rp=require('request-promise');var moment=require(_0xd996('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd996('0x5'));var sox=require(_0xd996('0x6'));var csv=require(_0xd996('0x7'));var ejs=require(_0xd996('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd996('0x9'));var squel=require('squel');var crypto=require(_0xd996('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd996('0xb'));var toCsv=require(_0xd996('0x7'));var querystring=require(_0xd996('0xc'));var Papa=require(_0xd996('0xd'));var Redis=require(_0xd996('0xe'));var authService=require(_0xd996('0xf'));var qs=require(_0xd996('0x10'));var as=require(_0xd996('0x11'));var hardwareService=require(_0xd996('0x12'));var logger=require(_0xd996('0x13'))(_0xd996('0x14'));var utils=require('../../config/utils');var config=require(_0xd996('0x15'));var licenseUtil=require(_0xd996('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2da206,_0x179165){_0x179165=_0x179165||0xcc;return function(_0x377d5d){if(_0x377d5d){return _0x2da206[_0xd996('0x17')](_0x179165);}return _0x2da206[_0xd996('0x18')](_0x179165)[_0xd996('0x19')]();};}function respondWithResult(_0x1d07b0,_0x5ce52f){_0x5ce52f=_0x5ce52f||0xc8;return function(_0x11444a){if(_0x11444a){return _0x1d07b0[_0xd996('0x18')](_0x5ce52f)[_0xd996('0x1a')](_0x11444a);}};}function respondWithFilteredResult(_0x5ea70a,_0x55ba3e){return function(_0x29e536){if(_0x29e536){var _0x4f869a=typeof _0x55ba3e[_0xd996('0x1b')]==='undefined'&&typeof _0x55ba3e['limit']===_0xd996('0x1c');var _0x172902=_0x29e536['count'];var _0x3e632c=_0x4f869a?0x0:_0x55ba3e[_0xd996('0x1b')];var _0x121bc8=_0x4f869a?_0x29e536['count']:_0x55ba3e[_0xd996('0x1b')]+_0x55ba3e['limit'];var _0x114ba8;if(_0x121bc8>=_0x172902){_0x121bc8=_0x172902;_0x114ba8=0xc8;}else{_0x114ba8=0xce;}_0x5ea70a[_0xd996('0x18')](_0x114ba8);return _0x5ea70a[_0xd996('0x1d')](_0xd996('0x1e'),_0x3e632c+'-'+_0x121bc8+'/'+_0x172902)['json'](_0x29e536);}return null;};}function patchUpdates(_0x2168a9){return function(_0x44e94f){try{jsonpatch[_0xd996('0x1f')](_0x44e94f,_0x2168a9,!![]);}catch(_0x2be12c){return BPromise[_0xd996('0x20')](_0x2be12c);}return _0x44e94f[_0xd996('0x21')]();};}function saveUpdates(_0x2b22a4,_0x1731b4){return function(_0xc1e718){if(_0xc1e718){return _0xc1e718[_0xd996('0x22')](_0x2b22a4)[_0xd996('0x23')](function(_0x1ed7df){return _0x1ed7df;});}return null;};}function removeEntity(_0x2eb6fe,_0x58ddad){return function(_0x5844b5){if(_0x5844b5){return _0x5844b5[_0xd996('0x24')]()[_0xd996('0x23')](function(){_0x2eb6fe['status'](0xcc)[_0xd996('0x19')]();});}};}function handleEntityNotFound(_0x52e7ca,_0x596098){return function(_0x578359){if(!_0x578359){_0x52e7ca[_0xd996('0x17')](0x194);}return _0x578359;};}function handleError(_0x1ae949,_0x136606){_0x136606=_0x136606||0x1f4;return function(_0x273b93){logger[_0xd996('0x25')](_0x273b93[_0xd996('0x26')]);if(_0x273b93[_0xd996('0x27')]){delete _0x273b93[_0xd996('0x27')];}_0x1ae949['status'](_0x136606)[_0xd996('0x28')](_0x273b93);};}exports[_0xd996('0x29')]=function(_0x4d268e,_0x4d1fe1){var _0x19511f={},_0xc013b7={},_0x2d49d7={'count':0x0,'rows':[]};var _0x5a791c=_['map'](db[_0xd996('0x2a')]['rawAttributes'],function(_0x397966){return{'name':_0x397966['fieldName'],'type':_0x397966[_0xd996('0x2b')][_0xd996('0x2c')]};});_0xc013b7['model']=_[_0xd996('0x2d')](_0x5a791c,_0xd996('0x27'));_0xc013b7[_0xd996('0x2e')]=_[_0xd996('0x2f')](_0x4d268e[_0xd996('0x2e')]);_0xc013b7[_0xd996('0x30')]=_['intersection'](_0xc013b7[_0xd996('0x31')],_0xc013b7[_0xd996('0x2e')]);_0x19511f[_0xd996('0x32')]=_['intersection'](_0xc013b7[_0xd996('0x31')],qs['fields'](_0x4d268e[_0xd996('0x2e')]['fields']));_0x19511f[_0xd996('0x32')]=_0x19511f[_0xd996('0x32')][_0xd996('0x33')]?_0x19511f[_0xd996('0x32')]:_0xc013b7[_0xd996('0x31')];if(!_0x4d268e[_0xd996('0x2e')][_0xd996('0x34')](_0xd996('0x35'))){_0x19511f[_0xd996('0x36')]=qs['limit'](_0x4d268e[_0xd996('0x2e')][_0xd996('0x36')]);_0x19511f[_0xd996('0x1b')]=qs[_0xd996('0x1b')](_0x4d268e['query'][_0xd996('0x1b')]);}_0x19511f[_0xd996('0x37')]=qs[_0xd996('0x38')](_0x4d268e[_0xd996('0x2e')]['sort']);_0x19511f['where']=qs[_0xd996('0x30')](_['pick'](_0x4d268e['query'],_0xc013b7[_0xd996('0x30')]),_0x5a791c);if(_0x4d268e[_0xd996('0x2e')][_0xd996('0x39')]){_0x19511f[_0xd996('0x3a')]=_[_0xd996('0x3b')](_0x19511f[_0xd996('0x3a')],{'$or':_['map'](_0x5a791c,function(_0x500896){if(_0x500896[_0xd996('0x2b')]!==_0xd996('0x3c')){var _0xb1d669={};_0xb1d669[_0x500896[_0xd996('0x27')]]={'$like':'%'+_0x4d268e['query'][_0xd996('0x39')]+'%'};return _0xb1d669;}})});}_0x19511f=_[_0xd996('0x3b')]({},_0x19511f,_0x4d268e[_0xd996('0x3d')]);var _0x286d1f={'where':_0x19511f[_0xd996('0x3a')]};return db['VtigerField'][_0xd996('0x3e')](_0x286d1f)[_0xd996('0x23')](function(_0xdcbcca){_0x2d49d7[_0xd996('0x3e')]=_0xdcbcca;if(_0x4d268e[_0xd996('0x2e')][_0xd996('0x3f')]){_0x19511f[_0xd996('0x40')]=[{'all':!![]}];}return db[_0xd996('0x2a')][_0xd996('0x41')](_0x19511f);})['then'](function(_0x3db06b){_0x2d49d7['rows']=_0x3db06b;return _0x2d49d7;})[_0xd996('0x23')](respondWithFilteredResult(_0x4d1fe1,_0x19511f))['catch'](handleError(_0x4d1fe1,null));};exports['show']=function(_0x1e5574,_0x27c44c){var _0x44e20b={'raw':!![],'where':{'id':_0x1e5574[_0xd996('0x42')]['id']}},_0x7fb912={};_0x7fb912['model']=_[_0xd996('0x2f')](db['VtigerField'][_0xd996('0x43')]);_0x7fb912[_0xd996('0x2e')]=_[_0xd996('0x2f')](_0x1e5574['query']);_0x7fb912[_0xd996('0x30')]=_[_0xd996('0x44')](_0x7fb912[_0xd996('0x31')],_0x7fb912[_0xd996('0x2e')]);_0x44e20b[_0xd996('0x32')]=_['intersection'](_0x7fb912[_0xd996('0x31')],qs['fields'](_0x1e5574[_0xd996('0x2e')][_0xd996('0x45')]));_0x44e20b[_0xd996('0x32')]=_0x44e20b[_0xd996('0x32')][_0xd996('0x33')]?_0x44e20b[_0xd996('0x32')]:_0x7fb912[_0xd996('0x31')];if(_0x1e5574['query']['includeAll']){_0x44e20b[_0xd996('0x40')]=[{'all':!![]}];}_0x44e20b=_[_0xd996('0x3b')]({},_0x44e20b,_0x1e5574[_0xd996('0x3d')]);return db[_0xd996('0x2a')][_0xd996('0x46')](_0x44e20b)[_0xd996('0x23')](handleEntityNotFound(_0x27c44c,null))[_0xd996('0x23')](respondWithResult(_0x27c44c,null))[_0xd996('0x47')](handleError(_0x27c44c,null));};exports['create']=function(_0x5a1ce6,_0x56096e){return db[_0xd996('0x2a')]['create'](_0x5a1ce6[_0xd996('0x48')],{})['then'](respondWithResult(_0x56096e,0xc9))[_0xd996('0x47')](handleError(_0x56096e,null));};exports[_0xd996('0x22')]=function(_0x2cd730,_0x36ecf){if(_0x2cd730[_0xd996('0x48')]['id']){delete _0x2cd730[_0xd996('0x48')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x2cd730[_0xd996('0x42')]['id']}})['then'](handleEntityNotFound(_0x36ecf,null))[_0xd996('0x23')](saveUpdates(_0x2cd730[_0xd996('0x48')],null))[_0xd996('0x23')](respondWithResult(_0x36ecf,null))[_0xd996('0x47')](handleError(_0x36ecf,null));};exports[_0xd996('0x24')]=function(_0x1a65d1,_0xd5f11){return db['VtigerField'][_0xd996('0x46')]({'where':{'id':_0x1a65d1[_0xd996('0x42')]['id']}})[_0xd996('0x23')](handleEntityNotFound(_0xd5f11,null))[_0xd996('0x23')](removeEntity(_0xd5f11,null))[_0xd996('0x47')](handleError(_0xd5f11,null));}; \ No newline at end of file +var _0x7de0=['pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x158bd4,_0xd6bd64){var _0x34f2f4=function(_0x20dab4){while(--_0x20dab4){_0x158bd4['push'](_0x158bd4['shift']());}};_0x34f2f4(++_0xd6bd64);}(_0x7de0,0x9b));var _0x07de=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x7de0[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0x07de('0x0'));var rimraf=require(_0x07de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x07de('0x2'));var rp=require('request-promise');var moment=require(_0x07de('0x3'));var BPromise=require(_0x07de('0x4'));var Mustache=require(_0x07de('0x5'));var util=require(_0x07de('0x6'));var path=require('path');var sox=require(_0x07de('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x07de('0x8'));var crypto=require(_0x07de('0x9'));var jsforce=require(_0x07de('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x07de('0xb'));var Redis=require('ioredis');var authService=require(_0x07de('0xc'));var qs=require(_0x07de('0xd'));var as=require(_0x07de('0xe'));var hardwareService=require(_0x07de('0xf'));var logger=require(_0x07de('0x10'))(_0x07de('0x11'));var utils=require('../../config/utils');var config=require(_0x07de('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x07de('0x13'))['db'];function respondWithStatusCode(_0x39ed25,_0x4a5cbf){_0x4a5cbf=_0x4a5cbf||0xcc;return function(_0x4789c9){if(_0x4789c9){return _0x39ed25[_0x07de('0x14')](_0x4a5cbf);}return _0x39ed25[_0x07de('0x15')](_0x4a5cbf)[_0x07de('0x16')]();};}function respondWithResult(_0x4e39d9,_0x5819cc){_0x5819cc=_0x5819cc||0xc8;return function(_0x13640b){if(_0x13640b){return _0x4e39d9['status'](_0x5819cc)[_0x07de('0x17')](_0x13640b);}};}function respondWithFilteredResult(_0x4f0cc8,_0x1bb899){return function(_0x56267a){if(_0x56267a){var _0xf8422=typeof _0x1bb899['offset']===_0x07de('0x18')&&typeof _0x1bb899[_0x07de('0x19')]===_0x07de('0x18');var _0x21fc53=_0x56267a[_0x07de('0x1a')];var _0x375ba7=_0xf8422?0x0:_0x1bb899[_0x07de('0x1b')];var _0x25a94a=_0xf8422?_0x56267a[_0x07de('0x1a')]:_0x1bb899[_0x07de('0x1b')]+_0x1bb899[_0x07de('0x19')];var _0x5ee841;if(_0x25a94a>=_0x21fc53){_0x25a94a=_0x21fc53;_0x5ee841=0xc8;}else{_0x5ee841=0xce;}_0x4f0cc8[_0x07de('0x15')](_0x5ee841);return _0x4f0cc8[_0x07de('0x1c')](_0x07de('0x1d'),_0x375ba7+'-'+_0x25a94a+'/'+_0x21fc53)[_0x07de('0x17')](_0x56267a);}return null;};}function patchUpdates(_0x5bcc53){return function(_0x5e3064){try{jsonpatch[_0x07de('0x1e')](_0x5e3064,_0x5bcc53,!![]);}catch(_0x2b1f54){return BPromise[_0x07de('0x1f')](_0x2b1f54);}return _0x5e3064[_0x07de('0x20')]();};}function saveUpdates(_0x450b13,_0xefcd3){return function(_0x1b7d35){if(_0x1b7d35){return _0x1b7d35[_0x07de('0x21')](_0x450b13)[_0x07de('0x22')](function(_0x3129eb){return _0x3129eb;});}return null;};}function removeEntity(_0x1f940d,_0x33c143){return function(_0x11240e){if(_0x11240e){return _0x11240e[_0x07de('0x23')]()[_0x07de('0x22')](function(){_0x1f940d['status'](0xcc)[_0x07de('0x16')]();});}};}function handleEntityNotFound(_0x1099ee,_0x553523){return function(_0x29b467){if(!_0x29b467){_0x1099ee[_0x07de('0x14')](0x194);}return _0x29b467;};}function handleError(_0x3d8eed,_0x279782){_0x279782=_0x279782||0x1f4;return function(_0x3231cd){logger[_0x07de('0x24')](_0x3231cd[_0x07de('0x25')]);if(_0x3231cd[_0x07de('0x26')]){delete _0x3231cd[_0x07de('0x26')];}_0x3d8eed['status'](_0x279782)[_0x07de('0x27')](_0x3231cd);};}exports[_0x07de('0x28')]=function(_0x16ec62,_0x5d0366){var _0x42a1f9={},_0x46b4f4={},_0x2936a1={'count':0x0,'rows':[]};var _0x157062=_[_0x07de('0x29')](db[_0x07de('0x2a')][_0x07de('0x2b')],function(_0x4ec765){return{'name':_0x4ec765[_0x07de('0x2c')],'type':_0x4ec765[_0x07de('0x2d')]['key']};});_0x46b4f4[_0x07de('0x2e')]=_[_0x07de('0x29')](_0x157062,_0x07de('0x26'));_0x46b4f4['query']=_[_0x07de('0x2f')](_0x16ec62[_0x07de('0x30')]);_0x46b4f4[_0x07de('0x31')]=_[_0x07de('0x32')](_0x46b4f4[_0x07de('0x2e')],_0x46b4f4[_0x07de('0x30')]);_0x42a1f9[_0x07de('0x33')]=_[_0x07de('0x32')](_0x46b4f4['model'],qs[_0x07de('0x34')](_0x16ec62['query']['fields']));_0x42a1f9[_0x07de('0x33')]=_0x42a1f9['attributes'][_0x07de('0x35')]?_0x42a1f9[_0x07de('0x33')]:_0x46b4f4[_0x07de('0x2e')];if(!_0x16ec62[_0x07de('0x30')]['hasOwnProperty'](_0x07de('0x36'))){_0x42a1f9[_0x07de('0x19')]=qs[_0x07de('0x19')](_0x16ec62[_0x07de('0x30')][_0x07de('0x19')]);_0x42a1f9[_0x07de('0x1b')]=qs[_0x07de('0x1b')](_0x16ec62[_0x07de('0x30')][_0x07de('0x1b')]);}_0x42a1f9[_0x07de('0x37')]=qs[_0x07de('0x38')](_0x16ec62[_0x07de('0x30')]['sort']);_0x42a1f9[_0x07de('0x39')]=qs[_0x07de('0x31')](_[_0x07de('0x3a')](_0x16ec62[_0x07de('0x30')],_0x46b4f4['filters']),_0x157062);if(_0x16ec62['query'][_0x07de('0x3b')]){_0x42a1f9['where']=_[_0x07de('0x3c')](_0x42a1f9[_0x07de('0x39')],{'$or':_[_0x07de('0x29')](_0x157062,function(_0x42d95c){if(_0x42d95c['type']!==_0x07de('0x3d')){var _0x28b668={};_0x28b668[_0x42d95c['name']]={'$like':'%'+_0x16ec62[_0x07de('0x30')][_0x07de('0x3b')]+'%'};return _0x28b668;}})});}_0x42a1f9=_[_0x07de('0x3c')]({},_0x42a1f9,_0x16ec62[_0x07de('0x3e')]);var _0x51a3da={'where':_0x42a1f9[_0x07de('0x39')]};return db[_0x07de('0x2a')][_0x07de('0x1a')](_0x51a3da)[_0x07de('0x22')](function(_0x59f0bd){_0x2936a1['count']=_0x59f0bd;if(_0x16ec62[_0x07de('0x30')][_0x07de('0x3f')]){_0x42a1f9['include']=[{'all':!![]}];}return db['VtigerField'][_0x07de('0x40')](_0x42a1f9);})[_0x07de('0x22')](function(_0x7a9a88){_0x2936a1['rows']=_0x7a9a88;return _0x2936a1;})[_0x07de('0x22')](respondWithFilteredResult(_0x5d0366,_0x42a1f9))['catch'](handleError(_0x5d0366,null));};exports[_0x07de('0x41')]=function(_0x1a62c6,_0xbf6058){var _0x2682e6={'raw':!![],'where':{'id':_0x1a62c6['params']['id']}},_0xbabc97={};_0xbabc97[_0x07de('0x2e')]=_[_0x07de('0x2f')](db[_0x07de('0x2a')][_0x07de('0x2b')]);_0xbabc97[_0x07de('0x30')]=_['keys'](_0x1a62c6[_0x07de('0x30')]);_0xbabc97[_0x07de('0x31')]=_[_0x07de('0x32')](_0xbabc97[_0x07de('0x2e')],_0xbabc97[_0x07de('0x30')]);_0x2682e6[_0x07de('0x33')]=_[_0x07de('0x32')](_0xbabc97[_0x07de('0x2e')],qs[_0x07de('0x34')](_0x1a62c6[_0x07de('0x30')][_0x07de('0x34')]));_0x2682e6[_0x07de('0x33')]=_0x2682e6[_0x07de('0x33')][_0x07de('0x35')]?_0x2682e6[_0x07de('0x33')]:_0xbabc97[_0x07de('0x2e')];if(_0x1a62c6['query'][_0x07de('0x3f')]){_0x2682e6['include']=[{'all':!![]}];}_0x2682e6=_[_0x07de('0x3c')]({},_0x2682e6,_0x1a62c6['options']);return db[_0x07de('0x2a')][_0x07de('0x42')](_0x2682e6)[_0x07de('0x22')](handleEntityNotFound(_0xbf6058,null))['then'](respondWithResult(_0xbf6058,null))[_0x07de('0x43')](handleError(_0xbf6058,null));};exports[_0x07de('0x44')]=function(_0x4326c1,_0x4e4dd4){return db[_0x07de('0x2a')][_0x07de('0x44')](_0x4326c1[_0x07de('0x45')],{})[_0x07de('0x22')](respondWithResult(_0x4e4dd4,0xc9))[_0x07de('0x43')](handleError(_0x4e4dd4,null));};exports[_0x07de('0x21')]=function(_0x27615e,_0x279e6d){if(_0x27615e[_0x07de('0x45')]['id']){delete _0x27615e['body']['id'];}return db[_0x07de('0x2a')][_0x07de('0x42')]({'where':{'id':_0x27615e[_0x07de('0x46')]['id']}})[_0x07de('0x22')](handleEntityNotFound(_0x279e6d,null))[_0x07de('0x22')](saveUpdates(_0x27615e['body'],null))[_0x07de('0x22')](respondWithResult(_0x279e6d,null))[_0x07de('0x43')](handleError(_0x279e6d,null));};exports[_0x07de('0x23')]=function(_0xbbc433,_0x5abd4a){return db[_0x07de('0x2a')][_0x07de('0x42')]({'where':{'id':_0xbbc433[_0x07de('0x46')]['id']}})['then'](handleEntityNotFound(_0x5abd4a,null))[_0x07de('0x22')](removeEntity(_0x5abd4a,null))[_0x07de('0x43')](handleError(_0x5abd4a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 3682edb..ba8e0d3 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 _0xa21a=['../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2be006,_0x240ed5){var _0x8cf714=function(_0x5d81be){while(--_0x5d81be){_0x2be006['push'](_0x2be006['shift']());}};_0x8cf714(++_0x240ed5);}(_0xa21a,0x149));var _0xaa21=function(_0x284461,_0x459cf9){_0x284461=_0x284461-0x0;var _0x288d7f=_0xa21a[_0x284461];return _0x288d7f;};'use strict';var _=require(_0xaa21('0x0'));var util=require(_0xaa21('0x1'));var logger=require(_0xaa21('0x2'))('api');var moment=require(_0xaa21('0x3'));var BPromise=require(_0xaa21('0x4'));var rp=require(_0xaa21('0x5'));var fs=require('fs');var path=require(_0xaa21('0x6'));var rimraf=require('rimraf');var config=require(_0xaa21('0x7'));var attributes=require(_0xaa21('0x8'));module['exports']=function(_0x2d03ff,_0x49ffab){return _0x2d03ff[_0xaa21('0x9')](_0xaa21('0xa'),attributes,{'tableName':_0xaa21('0xb'),'paranoid':![],'indexes':[{'name':_0xaa21('0xc'),'fields':[_0xaa21('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e6c=['../../config/environment','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1e6c,0x69));var _0xc1e6=function(_0x18bac5,_0x2e54fc){_0x18bac5=_0x18bac5-0x0;var _0xdc6c44=_0x1e6c[_0x18bac5];return _0xdc6c44;};'use strict';var _=require(_0xc1e6('0x0'));var util=require(_0xc1e6('0x1'));var logger=require(_0xc1e6('0x2'))(_0xc1e6('0x3'));var moment=require(_0xc1e6('0x4'));var BPromise=require('bluebird');var rp=require(_0xc1e6('0x5'));var fs=require('fs');var path=require(_0xc1e6('0x6'));var rimraf=require('rimraf');var config=require(_0xc1e6('0x7'));var attributes=require(_0xc1e6('0x8'));module[_0xc1e6('0x9')]=function(_0x2b21f2,_0x240764){return _0x2b21f2['define'](_0xc1e6('0xa'),attributes,{'tableName':_0xc1e6('0xb'),'paranoid':![],'indexes':[{'name':_0xc1e6('0xc'),'fields':['idField',_0xc1e6('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 4efd4f1..b9bde95 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 _0x3fcc=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3c3698,_0xa0bf08){var _0x4e6637=function(_0x1fc9a4){while(--_0x1fc9a4){_0x3c3698['push'](_0x3c3698['shift']());}};_0x4e6637(++_0xa0bf08);}(_0x3fcc,0x104));var _0xc3fc=function(_0x24eea8,_0x5b0e6c){_0x24eea8=_0x24eea8-0x0;var _0xa45f11=_0x3fcc[_0x24eea8];return _0xa45f11;};'use strict';var _=require(_0xc3fc('0x0'));var util=require(_0xc3fc('0x1'));var moment=require(_0xc3fc('0x2'));var BPromise=require(_0xc3fc('0x3'));var rs=require(_0xc3fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc3fc('0x5'));var logger=require(_0xc3fc('0x6'))(_0xc3fc('0x7'));var config=require(_0xc3fc('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc3fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26ca92,_0x57b904,_0x5187cf){return new BPromise(function(_0x422824,_0x2b61ea){return client[_0xc3fc('0xa')](_0x26ca92,_0x5187cf)[_0xc3fc('0xb')](function(_0x4742c3){logger['info'](_0xc3fc('0xc'),_0x57b904,_0xc3fc('0xd'));logger['debug'](_0xc3fc('0xe'),_0x57b904,_0xc3fc('0xd'),JSON[_0xc3fc('0xf')](_0x4742c3));if(_0x4742c3[_0xc3fc('0x10')]){if(_0x4742c3[_0xc3fc('0x10')][_0xc3fc('0x11')]===0x1f4){logger['error'](_0xc3fc('0xc'),_0x57b904,_0x4742c3[_0xc3fc('0x10')]['message']);return _0x2b61ea(_0x4742c3['error'][_0xc3fc('0x12')]);}logger[_0xc3fc('0x10')]('VtigerField,\x20%s,\x20%s',_0x57b904,_0x4742c3[_0xc3fc('0x10')][_0xc3fc('0x12')]);return _0x422824(_0x4742c3[_0xc3fc('0x10')][_0xc3fc('0x12')]);}else{logger[_0xc3fc('0x13')](_0xc3fc('0xc'),_0x57b904,_0xc3fc('0xd'));_0x422824(_0x4742c3['result'][_0xc3fc('0x12')]);}})['catch'](function(_0x221434){logger[_0xc3fc('0x10')](_0xc3fc('0xc'),_0x57b904,_0x221434);_0x2b61ea(_0x221434);});});} \ No newline at end of file +var _0xeba1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2d9535,_0x4bc592){var _0xb4e710=function(_0x50b9a9){while(--_0x50b9a9){_0x2d9535['push'](_0x2d9535['shift']());}};_0xb4e710(++_0x4bc592);}(_0xeba1,0xd8));var _0x1eba=function(_0x48100b,_0x22674a){_0x48100b=_0x48100b-0x0;var _0x35dd0b=_0xeba1[_0x48100b];return _0x35dd0b;};'use strict';var _=require(_0x1eba('0x0'));var util=require(_0x1eba('0x1'));var moment=require(_0x1eba('0x2'));var BPromise=require(_0x1eba('0x3'));var rs=require(_0x1eba('0x4'));var fs=require('fs');var Redis=require(_0x1eba('0x5'));var db=require(_0x1eba('0x6'))['db'];var utils=require(_0x1eba('0x7'));var logger=require(_0x1eba('0x8'))(_0x1eba('0x9'));var config=require(_0x1eba('0xa'));var jayson=require(_0x1eba('0xb'));var client=jayson[_0x1eba('0xc')][_0x1eba('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4e5908,_0x4b6f72,_0x2fb418){return new BPromise(function(_0x10235b,_0x5b7d27){return client[_0x1eba('0xe')](_0x4e5908,_0x2fb418)['then'](function(_0x30c626){logger['info'](_0x1eba('0xf'),_0x4b6f72,_0x1eba('0x10'));logger[_0x1eba('0x11')](_0x1eba('0x12'),_0x4b6f72,_0x1eba('0x10'),JSON[_0x1eba('0x13')](_0x30c626));if(_0x30c626[_0x1eba('0x14')]){if(_0x30c626[_0x1eba('0x14')][_0x1eba('0x15')]===0x1f4){logger[_0x1eba('0x14')]('VtigerField,\x20%s,\x20%s',_0x4b6f72,_0x30c626[_0x1eba('0x14')]['message']);return _0x5b7d27(_0x30c626[_0x1eba('0x14')][_0x1eba('0x16')]);}logger[_0x1eba('0x14')](_0x1eba('0xf'),_0x4b6f72,_0x30c626[_0x1eba('0x14')][_0x1eba('0x16')]);return _0x10235b(_0x30c626[_0x1eba('0x14')][_0x1eba('0x16')]);}else{logger['info'](_0x1eba('0xf'),_0x4b6f72,_0x1eba('0x10'));_0x10235b(_0x30c626[_0x1eba('0x17')][_0x1eba('0x16')]);}})['catch'](function(_0x192e52){logger[_0x1eba('0x14')](_0x1eba('0xf'),_0x4b6f72,_0x192e52);_0x5b7d27(_0x192e52);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 5fb56b1..85ec976 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 _0x2b7e=['/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put'];(function(_0x41c1dd,_0x3ad5d0){var _0x3337a6=function(_0x18a3b7){while(--_0x18a3b7){_0x41c1dd['push'](_0x41c1dd['shift']());}};_0x3337a6(++_0x3ad5d0);}(_0x2b7e,0x1b4));var _0xe2b7=function(_0x48ccf2,_0x381185){_0x48ccf2=_0x48ccf2-0x0;var _0x207d58=_0x2b7e[_0x48ccf2];return _0x207d58;};'use strict';var multer=require(_0xe2b7('0x0'));var util=require(_0xe2b7('0x1'));var path=require(_0xe2b7('0x2'));var timeout=require(_0xe2b7('0x3'));var express=require(_0xe2b7('0x4'));var router=express[_0xe2b7('0x5')]();var fs_extra=require(_0xe2b7('0x6'));var auth=require(_0xe2b7('0x7'));var interaction=require(_0xe2b7('0x8'));var config=require('../../config/environment');var controller=require(_0xe2b7('0x9'));router[_0xe2b7('0xa')]('/',auth[_0xe2b7('0xb')](),controller['index']);router[_0xe2b7('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe2b7('0xc')]);router['get'](_0xe2b7('0xd'),auth['isAuthenticated'](),controller[_0xe2b7('0xe')]);router[_0xe2b7('0xa')](_0xe2b7('0xf'),auth[_0xe2b7('0xb')](),controller[_0xe2b7('0x10')]);router['post']('/',auth[_0xe2b7('0xb')](),controller['create']);router[_0xe2b7('0x11')](_0xe2b7('0xd'),auth[_0xe2b7('0xb')](),controller[_0xe2b7('0x12')]);router[_0xe2b7('0x13')](_0xe2b7('0x14'),auth[_0xe2b7('0xb')](),controller[_0xe2b7('0x15')]);router[_0xe2b7('0x16')](_0xe2b7('0x14'),auth[_0xe2b7('0xb')](),controller[_0xe2b7('0x17')]);module['exports']=router; \ No newline at end of file +var _0xdf39=['update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intZendeskAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put'];(function(_0xd60cb,_0x25496e){var _0x47eecd=function(_0x19c183){while(--_0x19c183){_0xd60cb['push'](_0xd60cb['shift']());}};_0x47eecd(++_0x25496e);}(_0xdf39,0x1bb));var _0x9df3=function(_0x33f1fb,_0x3ab074){_0x33f1fb=_0x33f1fb-0x0;var _0x40c575=_0xdf39[_0x33f1fb];return _0x40c575;};'use strict';var multer=require(_0x9df3('0x0'));var util=require(_0x9df3('0x1'));var path=require('path');var timeout=require(_0x9df3('0x2'));var express=require(_0x9df3('0x3'));var router=express[_0x9df3('0x4')]();var fs_extra=require(_0x9df3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9df3('0x6'));var controller=require(_0x9df3('0x7'));router['get']('/',auth[_0x9df3('0x8')](),controller['index']);router[_0x9df3('0x9')](_0x9df3('0xa'),auth[_0x9df3('0x8')](),controller[_0x9df3('0xb')]);router[_0x9df3('0x9')](_0x9df3('0xc'),auth[_0x9df3('0x8')](),controller[_0x9df3('0xd')]);router[_0x9df3('0x9')]('/:id/fields',auth[_0x9df3('0x8')](),controller[_0x9df3('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9df3('0xf')]);router[_0x9df3('0x10')]('/:id/configurations',auth[_0x9df3('0x8')](),controller[_0x9df3('0x11')]);router[_0x9df3('0x12')](_0x9df3('0xa'),auth[_0x9df3('0x8')](),controller[_0x9df3('0x13')]);router['delete'](_0x9df3('0xa'),auth[_0x9df3('0x8')](),controller[_0x9df3('0x14')]);module[_0x9df3('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 7d24ffb..248a615 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 _0x71ab=['newTab','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab'];(function(_0x2728b4,_0x2cf984){var _0x47c6b1=function(_0x135a92){while(--_0x135a92){_0x2728b4['push'](_0x2728b4['shift']());}};_0x47c6b1(++_0x2cf984);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb71a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xb71a('0x2')},'password':{'type':Sequelize[_0xb71a('0x1')]},'token':{'type':Sequelize[_0xb71a('0x1')]},'remoteUri':{'type':Sequelize[_0xb71a('0x1')],'unique':_0xb71a('0x3')},'authType':{'type':Sequelize[_0xb71a('0x4')](_0xb71a('0x5'),_0xb71a('0x6')),'defaultValue':_0xb71a('0x5')},'serverUrl':{'type':Sequelize[_0xb71a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb71a('0x4')](_0xb71a('0x7'),_0xb71a('0x8')),'defaultValue':_0xb71a('0x7')}}; \ No newline at end of file +var _0xd991=['remoteUri','ENUM','password','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x29ee0a,_0x2e019b){var _0x54efbf=function(_0x3c2377){while(--_0x3c2377){_0x29ee0a['push'](_0x29ee0a['shift']());}};_0x54efbf(++_0x2e019b);}(_0xd991,0x115));var _0x1d99=function(_0x44a233,_0x1b133f){_0x44a233=_0x44a233-0x0;var _0x272ff3=_0xd991[_0x44a233];return _0x272ff3;};'use strict';var Sequelize=require(_0x1d99('0x0'));module[_0x1d99('0x1')]={'name':{'type':Sequelize[_0x1d99('0x2')]},'description':{'type':Sequelize[_0x1d99('0x2')]},'username':{'type':Sequelize[_0x1d99('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x1d99('0x2')]},'token':{'type':Sequelize[_0x1d99('0x2')]},'remoteUri':{'type':Sequelize[_0x1d99('0x2')],'unique':_0x1d99('0x3')},'authType':{'type':Sequelize[_0x1d99('0x4')](_0x1d99('0x5'),'token'),'defaultValue':_0x1d99('0x5')},'serverUrl':{'type':Sequelize[_0x1d99('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1d99('0x6'),_0x1d99('0x7')),'defaultValue':_0x1d99('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 074badd..aa6f8fd 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 _0xd4f4=['base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','position','title','system_field_options','custom_field_options','test','send','Wrong\x20credentials','statusCode','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','status','end','json','offset','undefined','limit','apply','reject','save','then','sendStatus','stack','name','index','map','ZendeskAccount','rawAttributes','type','key','model','keys','filters','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','rows','catch','intersection','includeAll','find','create','update','body','params','destroy','findOne','ZendeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','password','token','authType','remoteUri','slice','GET','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s:%s','username','toString'];(function(_0x2f1525,_0x53c73b){var _0x31390b=function(_0x294f85){while(--_0x294f85){_0x2f1525['push'](_0x2f1525['shift']());}};_0x31390b(++_0x53c73b);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x3c4e47,_0x47ee91){_0x3c4e47=_0x3c4e47-0x0;var _0x274fb6=_0xd4f4[_0x3c4e47];return _0x274fb6;};'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'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b4f4e,_0x15fe6a){_0x15fe6a=_0x15fe6a||0xcc;return function(_0xe9b7a6){if(_0xe9b7a6){return _0x5b4f4e['sendStatus'](_0x15fe6a);}return _0x5b4f4e[_0x4d4f('0x1d')](_0x15fe6a)[_0x4d4f('0x1e')]();};}function respondWithResult(_0x1878b6,_0x59252c){_0x59252c=_0x59252c||0xc8;return function(_0x145804){if(_0x145804){return _0x1878b6[_0x4d4f('0x1d')](_0x59252c)[_0x4d4f('0x1f')](_0x145804);}};}function respondWithFilteredResult(_0x4a3364,_0x59bfb5){return function(_0x5e4ff5){if(_0x5e4ff5){var _0x18a528=typeof _0x59bfb5[_0x4d4f('0x20')]===_0x4d4f('0x21')&&typeof _0x59bfb5['limit']===_0x4d4f('0x21');var _0x17a437=_0x5e4ff5['count'];var _0x5dbbeb=_0x18a528?0x0:_0x59bfb5['offset'];var _0x5a58af=_0x18a528?_0x5e4ff5['count']:_0x59bfb5[_0x4d4f('0x20')]+_0x59bfb5[_0x4d4f('0x22')];var _0x433222;if(_0x5a58af>=_0x17a437){_0x5a58af=_0x17a437;_0x433222=0xc8;}else{_0x433222=0xce;}_0x4a3364[_0x4d4f('0x1d')](_0x433222);return _0x4a3364['set']('Content-Range',_0x5dbbeb+'-'+_0x5a58af+'/'+_0x17a437)[_0x4d4f('0x1f')](_0x5e4ff5);}return null;};}function patchUpdates(_0x4dd360){return function(_0x34a232){try{jsonpatch[_0x4d4f('0x23')](_0x34a232,_0x4dd360,!![]);}catch(_0x3d1e38){return BPromise[_0x4d4f('0x24')](_0x3d1e38);}return _0x34a232[_0x4d4f('0x25')]();};}function saveUpdates(_0x5beab4,_0x570520){return function(_0x4043f2){if(_0x4043f2){return _0x4043f2['update'](_0x5beab4)[_0x4d4f('0x26')](function(_0x3d5d93){return _0x3d5d93;});}return null;};}function removeEntity(_0x2d2fb3,_0x3f4a55){return function(_0xf3f7a4){if(_0xf3f7a4){return _0xf3f7a4['destroy']()[_0x4d4f('0x26')](function(){_0x2d2fb3[_0x4d4f('0x1d')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x28443b,_0x5cf9e7){return function(_0x51a7c5){if(!_0x51a7c5){_0x28443b[_0x4d4f('0x27')](0x194);}return _0x51a7c5;};}function handleError(_0xd51604,_0xa2492c){_0xa2492c=_0xa2492c||0x1f4;return function(_0x1f79f9){logger['error'](_0x1f79f9[_0x4d4f('0x28')]);if(_0x1f79f9[_0x4d4f('0x29')]){delete _0x1f79f9[_0x4d4f('0x29')];}_0xd51604[_0x4d4f('0x1d')](_0xa2492c)['send'](_0x1f79f9);};}exports[_0x4d4f('0x2a')]=function(_0x51cb3d,_0x1688bb){var _0x333a40={},_0x550040={},_0x2768f1={'count':0x0,'rows':[]};var _0x123383=_[_0x4d4f('0x2b')](db[_0x4d4f('0x2c')][_0x4d4f('0x2d')],function(_0x43a704){return{'name':_0x43a704['fieldName'],'type':_0x43a704[_0x4d4f('0x2e')][_0x4d4f('0x2f')]};});_0x550040[_0x4d4f('0x30')]=_[_0x4d4f('0x2b')](_0x123383,_0x4d4f('0x29'));_0x550040['query']=_[_0x4d4f('0x31')](_0x51cb3d['query']);_0x550040[_0x4d4f('0x32')]=_['intersection'](_0x550040['model'],_0x550040['query']);_0x333a40[_0x4d4f('0x33')]=_['intersection'](_0x550040[_0x4d4f('0x30')],qs[_0x4d4f('0x34')](_0x51cb3d[_0x4d4f('0x35')]['fields']));_0x333a40[_0x4d4f('0x33')]=_0x333a40[_0x4d4f('0x33')][_0x4d4f('0x36')]?_0x333a40['attributes']:_0x550040[_0x4d4f('0x30')];if(!_0x51cb3d['query'][_0x4d4f('0x37')](_0x4d4f('0x38'))){_0x333a40[_0x4d4f('0x22')]=qs[_0x4d4f('0x22')](_0x51cb3d[_0x4d4f('0x35')][_0x4d4f('0x22')]);_0x333a40[_0x4d4f('0x20')]=qs[_0x4d4f('0x20')](_0x51cb3d['query']['offset']);}_0x333a40[_0x4d4f('0x39')]=qs['sort'](_0x51cb3d['query'][_0x4d4f('0x3a')]);_0x333a40[_0x4d4f('0x3b')]=qs[_0x4d4f('0x32')](_[_0x4d4f('0x3c')](_0x51cb3d[_0x4d4f('0x35')],_0x550040['filters']),_0x123383);if(_0x51cb3d[_0x4d4f('0x35')][_0x4d4f('0x3d')]){_0x333a40['where']=_[_0x4d4f('0x3e')](_0x333a40[_0x4d4f('0x3b')],{'$or':_[_0x4d4f('0x2b')](_0x123383,function(_0x42f9ed){if(_0x42f9ed[_0x4d4f('0x2e')]!==_0x4d4f('0x3f')){var _0x20290e={};_0x20290e[_0x42f9ed[_0x4d4f('0x29')]]={'$like':'%'+_0x51cb3d[_0x4d4f('0x35')]['filter']+'%'};return _0x20290e;}})});}_0x333a40=_['merge']({},_0x333a40,_0x51cb3d[_0x4d4f('0x40')]);var _0x324a3c={'where':_0x333a40[_0x4d4f('0x3b')]};return db[_0x4d4f('0x2c')]['count'](_0x324a3c)['then'](function(_0x3afb4c){_0x2768f1[_0x4d4f('0x41')]=_0x3afb4c;if(_0x51cb3d['query']['includeAll']){_0x333a40[_0x4d4f('0x42')]=[{'all':!![]}];}return db[_0x4d4f('0x2c')]['findAll'](_0x333a40);})[_0x4d4f('0x26')](function(_0x330bca){_0x2768f1[_0x4d4f('0x43')]=_0x330bca;return _0x2768f1;})[_0x4d4f('0x26')](respondWithFilteredResult(_0x1688bb,_0x333a40))[_0x4d4f('0x44')](handleError(_0x1688bb,null));};exports['show']=function(_0x2b274e,_0x4c7c24){var _0x45a0c1={'raw':![],'where':{'id':_0x2b274e['params']['id']}},_0x5e4839={};_0x5e4839[_0x4d4f('0x30')]=_[_0x4d4f('0x31')](db[_0x4d4f('0x2c')]['rawAttributes']);_0x5e4839[_0x4d4f('0x35')]=_['keys'](_0x2b274e[_0x4d4f('0x35')]);_0x5e4839['filters']=_[_0x4d4f('0x45')](_0x5e4839[_0x4d4f('0x30')],_0x5e4839[_0x4d4f('0x35')]);_0x45a0c1[_0x4d4f('0x33')]=_[_0x4d4f('0x45')](_0x5e4839['model'],qs['fields'](_0x2b274e[_0x4d4f('0x35')][_0x4d4f('0x34')]));_0x45a0c1[_0x4d4f('0x33')]=_0x45a0c1[_0x4d4f('0x33')]['length']?_0x45a0c1['attributes']:_0x5e4839['model'];if(_0x2b274e[_0x4d4f('0x35')][_0x4d4f('0x46')]){_0x45a0c1[_0x4d4f('0x42')]=[{'all':!![]}];}_0x45a0c1=_[_0x4d4f('0x3e')]({},_0x45a0c1,_0x2b274e[_0x4d4f('0x40')]);return db[_0x4d4f('0x2c')][_0x4d4f('0x47')](_0x45a0c1)[_0x4d4f('0x26')](handleEntityNotFound(_0x4c7c24,null))[_0x4d4f('0x26')](respondWithResult(_0x4c7c24,null))[_0x4d4f('0x44')](handleError(_0x4c7c24,null));};exports[_0x4d4f('0x48')]=function(_0x1c290b,_0x5c7a41){return db[_0x4d4f('0x2c')][_0x4d4f('0x48')](_0x1c290b['body'],{})[_0x4d4f('0x26')](respondWithResult(_0x5c7a41,0xc9))['catch'](handleError(_0x5c7a41,null));};exports[_0x4d4f('0x49')]=function(_0x401466,_0x50a3b3){if(_0x401466[_0x4d4f('0x4a')]['id']){delete _0x401466[_0x4d4f('0x4a')]['id'];}return db[_0x4d4f('0x2c')][_0x4d4f('0x47')]({'where':{'id':_0x401466[_0x4d4f('0x4b')]['id']}})[_0x4d4f('0x26')](handleEntityNotFound(_0x50a3b3,null))[_0x4d4f('0x26')](saveUpdates(_0x401466[_0x4d4f('0x4a')],null))[_0x4d4f('0x26')](respondWithResult(_0x50a3b3,null))[_0x4d4f('0x44')](handleError(_0x50a3b3,null));};exports[_0x4d4f('0x4c')]=function(_0x3a21a6,_0x504d85){return db[_0x4d4f('0x2c')]['find']({'where':{'id':_0x3a21a6['params']['id']}})['then'](handleEntityNotFound(_0x504d85,null))[_0x4d4f('0x26')](removeEntity(_0x504d85,null))[_0x4d4f('0x44')](handleError(_0x504d85,null));};exports['getConfigurations']=function(_0x5f3252,_0x2a3bc4,_0x4c80c4){var _0x5adc7b={};var _0x3191b1={};var _0x528573;var _0x17b59e;return db[_0x4d4f('0x2c')][_0x4d4f('0x4d')]({'where':{'id':_0x5f3252[_0x4d4f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2a3bc4,null))[_0x4d4f('0x26')](function(_0x2008c3){if(_0x2008c3){_0x528573=_0x2008c3;_0x3191b1[_0x4d4f('0x30')]=_[_0x4d4f('0x31')](db[_0x4d4f('0x4e')]['rawAttributes']);_0x3191b1[_0x4d4f('0x35')]=_['keys'](_0x5f3252[_0x4d4f('0x35')]);_0x3191b1['filters']=_[_0x4d4f('0x45')](_0x3191b1[_0x4d4f('0x30')],_0x3191b1['query']);_0x5adc7b[_0x4d4f('0x33')]=_[_0x4d4f('0x45')](_0x3191b1['model'],qs[_0x4d4f('0x34')](_0x5f3252['query'][_0x4d4f('0x34')]));_0x5adc7b['attributes']=_0x5adc7b['attributes'][_0x4d4f('0x36')]?_0x5adc7b[_0x4d4f('0x33')]:_0x3191b1[_0x4d4f('0x30')];_0x5adc7b[_0x4d4f('0x39')]=qs[_0x4d4f('0x3a')](_0x5f3252['query']['sort']);_0x5adc7b[_0x4d4f('0x3b')]=qs['filters'](_[_0x4d4f('0x3c')](_0x5f3252[_0x4d4f('0x35')],_0x3191b1[_0x4d4f('0x32')]));if(_0x5f3252[_0x4d4f('0x35')][_0x4d4f('0x3d')]){_0x5adc7b[_0x4d4f('0x3b')]=_['merge'](_0x5adc7b[_0x4d4f('0x3b')],{'$or':_[_0x4d4f('0x2b')](_0x5adc7b[_0x4d4f('0x33')],function(_0x4bb7ac){var _0x2011aa={};_0x2011aa[_0x4bb7ac]={'$like':'%'+_0x5f3252[_0x4d4f('0x35')][_0x4d4f('0x3d')]+'%'};return _0x2011aa;})});}_0x5adc7b=_['merge']({},_0x5adc7b,_0x5f3252[_0x4d4f('0x40')]);return _0x528573['getConfigurations'](_0x5adc7b);}})[_0x4d4f('0x26')](function(_0x2145ca){if(_0x2145ca){_0x17b59e=_0x2145ca[_0x4d4f('0x36')];if(!_0x5f3252[_0x4d4f('0x35')][_0x4d4f('0x37')](_0x4d4f('0x38'))){_0x5adc7b[_0x4d4f('0x22')]=qs[_0x4d4f('0x22')](_0x5f3252[_0x4d4f('0x35')]['limit']);_0x5adc7b[_0x4d4f('0x20')]=qs[_0x4d4f('0x20')](_0x5f3252['query'][_0x4d4f('0x20')]);}return _0x528573[_0x4d4f('0x4f')](_0x5adc7b);}})[_0x4d4f('0x26')](function(_0xae8fe){if(_0xae8fe){return _0xae8fe?{'count':_0x17b59e,'rows':_0xae8fe}:null;}})['then'](respondWithResult(_0x2a3bc4,null))[_0x4d4f('0x44')](handleError(_0x2a3bc4,null));};exports[_0x4d4f('0x50')]=function(_0x5995f2,_0x4d979a,_0x55552d){if(_0x5995f2[_0x4d4f('0x4a')]['id']){delete _0x5995f2['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x5995f2[_0x4d4f('0x4b')]['id']}})[_0x4d4f('0x26')](handleEntityNotFound(_0x4d979a,null))['then'](function(_0x347bb1){if(_0x347bb1){_0x5995f2[_0x4d4f('0x4a')][_0x4d4f('0x51')]=_0x347bb1['id'];_0x5995f2[_0x4d4f('0x4a')][_0x4d4f('0x52')]=integrations[_0x4d4f('0x53')](_0x5995f2[_0x4d4f('0x4a')][_0x4d4f('0x54')],_0x5995f2['body'][_0x4d4f('0x2e')]);_0x5995f2['body'][_0x4d4f('0x55')]=integrations[_0x4d4f('0x56')](_0x5995f2[_0x4d4f('0x4a')]['channel'],_0x5995f2[_0x4d4f('0x4a')][_0x4d4f('0x2e')]);return db[_0x4d4f('0x4e')][_0x4d4f('0x48')](_0x5995f2['body'],{'include':[{'model':db[_0x4d4f('0x57')],'as':'Subjects'},{'model':db[_0x4d4f('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4d979a,null))[_0x4d4f('0x44')](handleError(_0x4d979a,null));};exports[_0x4d4f('0x58')]=function(_0x5dd9ff,_0x3ade3d,_0x53a18b){var _0x41ffe7='';return db[_0x4d4f('0x2c')][_0x4d4f('0x4d')]({'where':{'id':_0x5dd9ff[_0x4d4f('0x4b')]['id']},'attributes':['id','username',_0x4d4f('0x59'),_0x4d4f('0x5a'),_0x4d4f('0x5b'),'remoteUri']})[_0x4d4f('0x26')](handleEntityNotFound(_0x3ade3d,null))[_0x4d4f('0x26')](function(_0x21046c){if(_0x21046c){_0x41ffe7=_0x21046c[_0x4d4f('0x5c')];var _0x3c5aee=_0x41ffe7[_0x4d4f('0x5d')](-0x1);if(_0x3c5aee==='/'){_0x41ffe7=_0x41ffe7['substring'](0x0,_0x41ffe7['lastIndexOf'](_0x3c5aee));}var _0x2ce3ce={'method':_0x4d4f('0x5e'),'uri':util['format'](_0x4d4f('0x5f'),_0x41ffe7,_0x4d4f('0x60')),'json':!![]};switch(_0x21046c[_0x4d4f('0x5b')]){case _0x4d4f('0x59'):_0x2ce3ce[_0x4d4f('0x61')]={'Authorization':util[_0x4d4f('0x62')](_0x4d4f('0x63'),new Buffer(util[_0x4d4f('0x62')](_0x4d4f('0x64'),_0x21046c[_0x4d4f('0x65')],_0x21046c[_0x4d4f('0x59')]))[_0x4d4f('0x66')](_0x4d4f('0x67')))};break;case _0x4d4f('0x5a'):_0x2ce3ce[_0x4d4f('0x61')]={'Authorization':util['format'](_0x4d4f('0x63'),new Buffer(util[_0x4d4f('0x62')](_0x4d4f('0x68'),_0x21046c[_0x4d4f('0x65')],_0x21046c['token']))['toString'](_0x4d4f('0x67')))};break;default:throw new db[(_0x4d4f('0x69'))][(_0x4d4f('0x6a'))](_0x4d4f('0x6b'));}return rp(_0x2ce3ce);}})[_0x4d4f('0x26')](function(_0x2876b5){if(_0x2876b5){var _0x19a8fb=[_0x4d4f('0x6c'),_0x4d4f('0x6d'),_0x4d4f('0x6e'),'assignee'];_[_0x4d4f('0x6f')](_0x2876b5[_0x4d4f('0x60')],function(_0x101a0a){return _0x19a8fb[_0x4d4f('0x70')](_0x101a0a['type']);});return{'count':_0x2876b5['ticket_fields']['length'],'rows':_[_0x4d4f('0x2b')](_0x2876b5['ticket_fields'],function(_0x3e592b){return{'id':_0x3e592b['id'],'name':_0x3e592b[_0x4d4f('0x71')]>0x7?_0x3e592b[_0x4d4f('0x72')]:_0x3e592b[_0x4d4f('0x2e')],'custom':_0x3e592b[_0x4d4f('0x71')]>0x7?!![]:![],'options':_0x3e592b[_0x4d4f('0x73')]?_0x3e592b[_0x4d4f('0x73')]:_0x3e592b[_0x4d4f('0x74')]?_0x3e592b['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x3ade3d,null))[_0x4d4f('0x44')](function(_0x59a813){var _0x3a81b7=_0x5dd9ff[_0x4d4f('0x35')][_0x4d4f('0x75')]?0x1f4:_0x59a813['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4d4f('0x58'),_0x3a81b7,JSON['stringify'](_0x59a813));delete _0x59a813[_0x4d4f('0x29')];if(_0x3a81b7===0x191){_0x3a81b7=0x190;}_0x3ade3d['status'](_0x3a81b7)[_0x4d4f('0x76')](_0x5dd9ff[_0x4d4f('0x35')][_0x4d4f('0x75')]?{'message':_0x4d4f('0x77'),'statusCode':_0x59a813[_0x4d4f('0x78')]}:_0x59a813);});}; \ No newline at end of file +var _0x04b8=['lodash','squel','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','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','ZendeskAccount','findAll','rows','catch','keys','include','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x468abd,_0x11b6dd){var _0x833467=function(_0xfedf03){while(--_0xfedf03){_0x468abd['push'](_0x468abd['shift']());}};_0x833467(++_0x11b6dd);}(_0x04b8,0x159));var _0x804b=function(_0x5a3c3c,_0x2740df){_0x5a3c3c=_0x5a3c3c-0x0;var _0x29a9ac=_0x04b8[_0x5a3c3c];return _0x29a9ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x804b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x804b('0x1'));var rp=require(_0x804b('0x2'));var moment=require('moment');var BPromise=require(_0x804b('0x3'));var Mustache=require(_0x804b('0x4'));var util=require('util');var path=require(_0x804b('0x5'));var sox=require(_0x804b('0x6'));var csv=require(_0x804b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x804b('0x8'));var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804b('0x12'));var logger=require(_0x804b('0x13'))(_0x804b('0x14'));var utils=require(_0x804b('0x15'));var config=require(_0x804b('0x16'));var licenseUtil=require(_0x804b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x804b('0x18'));function respondWithStatusCode(_0x5303cc,_0x23ee57){_0x23ee57=_0x23ee57||0xcc;return function(_0x3a2702){if(_0x3a2702){return _0x5303cc[_0x804b('0x19')](_0x23ee57);}return _0x5303cc[_0x804b('0x1a')](_0x23ee57)['end']();};}function respondWithResult(_0x215825,_0x1b01a7){_0x1b01a7=_0x1b01a7||0xc8;return function(_0x274bb8){if(_0x274bb8){return _0x215825[_0x804b('0x1a')](_0x1b01a7)['json'](_0x274bb8);}};}function respondWithFilteredResult(_0x2fd593,_0x8ccbe0){return function(_0x5e1cfe){if(_0x5e1cfe){var _0x3c5986=typeof _0x8ccbe0['offset']===_0x804b('0x1b')&&typeof _0x8ccbe0[_0x804b('0x1c')]===_0x804b('0x1b');var _0x1760f8=_0x5e1cfe[_0x804b('0x1d')];var _0x5a0a82=_0x3c5986?0x0:_0x8ccbe0[_0x804b('0x1e')];var _0x50b4fe=_0x3c5986?_0x5e1cfe[_0x804b('0x1d')]:_0x8ccbe0[_0x804b('0x1e')]+_0x8ccbe0[_0x804b('0x1c')];var _0x469251;if(_0x50b4fe>=_0x1760f8){_0x50b4fe=_0x1760f8;_0x469251=0xc8;}else{_0x469251=0xce;}_0x2fd593['status'](_0x469251);return _0x2fd593[_0x804b('0x1f')](_0x804b('0x20'),_0x5a0a82+'-'+_0x50b4fe+'/'+_0x1760f8)[_0x804b('0x21')](_0x5e1cfe);}return null;};}function patchUpdates(_0x11eaf6){return function(_0x27844b){try{jsonpatch[_0x804b('0x22')](_0x27844b,_0x11eaf6,!![]);}catch(_0x3241a0){return BPromise[_0x804b('0x23')](_0x3241a0);}return _0x27844b[_0x804b('0x24')]();};}function saveUpdates(_0x2b7271,_0x1acc48){return function(_0x5a968b){if(_0x5a968b){return _0x5a968b[_0x804b('0x25')](_0x2b7271)[_0x804b('0x26')](function(_0x5585f8){return _0x5585f8;});}return null;};}function removeEntity(_0x44a921,_0x367024){return function(_0x115b8f){if(_0x115b8f){return _0x115b8f[_0x804b('0x27')]()[_0x804b('0x26')](function(){_0x44a921['status'](0xcc)[_0x804b('0x28')]();});}};}function handleEntityNotFound(_0x7d9c33,_0x4e7266){return function(_0x12b6a6){if(!_0x12b6a6){_0x7d9c33[_0x804b('0x19')](0x194);}return _0x12b6a6;};}function handleError(_0x1117a5,_0x27d5ec){_0x27d5ec=_0x27d5ec||0x1f4;return function(_0x2d88da){logger['error'](_0x2d88da[_0x804b('0x29')]);if(_0x2d88da[_0x804b('0x2a')]){delete _0x2d88da[_0x804b('0x2a')];}_0x1117a5[_0x804b('0x1a')](_0x27d5ec)[_0x804b('0x2b')](_0x2d88da);};}exports['index']=function(_0x3eb531,_0x2931ff){var _0x410871={},_0x5c7026={},_0x3dbd41={'count':0x0,'rows':[]};var _0x407357=_[_0x804b('0x2c')](db['ZendeskAccount'][_0x804b('0x2d')],function(_0x471c04){return{'name':_0x471c04['fieldName'],'type':_0x471c04[_0x804b('0x2e')][_0x804b('0x2f')]};});_0x5c7026[_0x804b('0x30')]=_[_0x804b('0x2c')](_0x407357,_0x804b('0x2a'));_0x5c7026[_0x804b('0x31')]=_['keys'](_0x3eb531[_0x804b('0x31')]);_0x5c7026[_0x804b('0x32')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],_0x5c7026[_0x804b('0x31')]);_0x410871[_0x804b('0x34')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],qs[_0x804b('0x35')](_0x3eb531[_0x804b('0x31')][_0x804b('0x35')]));_0x410871[_0x804b('0x34')]=_0x410871[_0x804b('0x34')][_0x804b('0x36')]?_0x410871[_0x804b('0x34')]:_0x5c7026[_0x804b('0x30')];if(!_0x3eb531[_0x804b('0x31')][_0x804b('0x37')](_0x804b('0x38'))){_0x410871[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3eb531[_0x804b('0x31')][_0x804b('0x1c')]);_0x410871[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3eb531['query']['offset']);}_0x410871['order']=qs[_0x804b('0x39')](_0x3eb531[_0x804b('0x31')][_0x804b('0x39')]);_0x410871['where']=qs['filters'](_['pick'](_0x3eb531[_0x804b('0x31')],_0x5c7026[_0x804b('0x32')]),_0x407357);if(_0x3eb531[_0x804b('0x31')][_0x804b('0x3a')]){_0x410871[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x410871[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x407357,function(_0x27ba88){if(_0x27ba88[_0x804b('0x2e')]!==_0x804b('0x3d')){var _0x22a3fa={};_0x22a3fa[_0x27ba88[_0x804b('0x2a')]]={'$like':'%'+_0x3eb531['query'][_0x804b('0x3a')]+'%'};return _0x22a3fa;}})});}_0x410871=_[_0x804b('0x3c')]({},_0x410871,_0x3eb531[_0x804b('0x3e')]);var _0x3d6d8a={'where':_0x410871[_0x804b('0x3b')]};return db['ZendeskAccount']['count'](_0x3d6d8a)[_0x804b('0x26')](function(_0x2afafd){_0x3dbd41[_0x804b('0x1d')]=_0x2afafd;if(_0x3eb531['query'][_0x804b('0x3f')]){_0x410871['include']=[{'all':!![]}];}return db[_0x804b('0x40')][_0x804b('0x41')](_0x410871);})[_0x804b('0x26')](function(_0x304710){_0x3dbd41[_0x804b('0x42')]=_0x304710;return _0x3dbd41;})[_0x804b('0x26')](respondWithFilteredResult(_0x2931ff,_0x410871))[_0x804b('0x43')](handleError(_0x2931ff,null));};exports['show']=function(_0x17972a,_0x1c0363){var _0x1dcec8={'raw':![],'where':{'id':_0x17972a['params']['id']}},_0x1d25f6={};_0x1d25f6[_0x804b('0x30')]=_[_0x804b('0x44')](db[_0x804b('0x40')][_0x804b('0x2d')]);_0x1d25f6[_0x804b('0x31')]=_[_0x804b('0x44')](_0x17972a[_0x804b('0x31')]);_0x1d25f6[_0x804b('0x32')]=_['intersection'](_0x1d25f6[_0x804b('0x30')],_0x1d25f6['query']);_0x1dcec8['attributes']=_['intersection'](_0x1d25f6[_0x804b('0x30')],qs['fields'](_0x17972a[_0x804b('0x31')][_0x804b('0x35')]));_0x1dcec8[_0x804b('0x34')]=_0x1dcec8[_0x804b('0x34')]['length']?_0x1dcec8[_0x804b('0x34')]:_0x1d25f6[_0x804b('0x30')];if(_0x17972a[_0x804b('0x31')]['includeAll']){_0x1dcec8[_0x804b('0x45')]=[{'all':!![]}];}_0x1dcec8=_[_0x804b('0x3c')]({},_0x1dcec8,_0x17972a[_0x804b('0x3e')]);return db['ZendeskAccount'][_0x804b('0x46')](_0x1dcec8)[_0x804b('0x26')](handleEntityNotFound(_0x1c0363,null))[_0x804b('0x26')](respondWithResult(_0x1c0363,null))[_0x804b('0x43')](handleError(_0x1c0363,null));};exports[_0x804b('0x47')]=function(_0x3a39f5,_0x392bc0){return db[_0x804b('0x40')][_0x804b('0x47')](_0x3a39f5[_0x804b('0x48')],{})[_0x804b('0x26')](respondWithResult(_0x392bc0,0xc9))[_0x804b('0x43')](handleError(_0x392bc0,null));};exports[_0x804b('0x25')]=function(_0x2c1796,_0x578e92){if(_0x2c1796['body']['id']){delete _0x2c1796[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x46')]({'where':{'id':_0x2c1796[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x578e92,null))['then'](saveUpdates(_0x2c1796[_0x804b('0x48')],null))[_0x804b('0x26')](respondWithResult(_0x578e92,null))[_0x804b('0x43')](handleError(_0x578e92,null));};exports[_0x804b('0x27')]=function(_0x47247c,_0x111e3f){return db['ZendeskAccount']['find']({'where':{'id':_0x47247c[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x111e3f,null))['then'](removeEntity(_0x111e3f,null))['catch'](handleError(_0x111e3f,null));};exports[_0x804b('0x4a')]=function(_0x3d56bb,_0x4a5068,_0x4efe2a){var _0x164c5d={};var _0x38c2c0={};var _0x54cc99;var _0x2756de;return db['ZendeskAccount'][_0x804b('0x4b')]({'where':{'id':_0x3d56bb['params']['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4a5068,null))[_0x804b('0x26')](function(_0x47c835){if(_0x47c835){_0x54cc99=_0x47c835;_0x38c2c0[_0x804b('0x30')]=_['keys'](db[_0x804b('0x4c')][_0x804b('0x2d')]);_0x38c2c0[_0x804b('0x31')]=_[_0x804b('0x44')](_0x3d56bb[_0x804b('0x31')]);_0x38c2c0[_0x804b('0x32')]=_[_0x804b('0x33')](_0x38c2c0[_0x804b('0x30')],_0x38c2c0[_0x804b('0x31')]);_0x164c5d[_0x804b('0x34')]=_['intersection'](_0x38c2c0['model'],qs[_0x804b('0x35')](_0x3d56bb['query']['fields']));_0x164c5d[_0x804b('0x34')]=_0x164c5d[_0x804b('0x34')][_0x804b('0x36')]?_0x164c5d[_0x804b('0x34')]:_0x38c2c0['model'];_0x164c5d['order']=qs[_0x804b('0x39')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x39')]);_0x164c5d[_0x804b('0x3b')]=qs[_0x804b('0x32')](_[_0x804b('0x4d')](_0x3d56bb[_0x804b('0x31')],_0x38c2c0[_0x804b('0x32')]));if(_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]){_0x164c5d[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x164c5d[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x164c5d[_0x804b('0x34')],function(_0x3d98a2){var _0x524291={};_0x524291[_0x3d98a2]={'$like':'%'+_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]+'%'};return _0x524291;})});}_0x164c5d=_['merge']({},_0x164c5d,_0x3d56bb[_0x804b('0x3e')]);return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})[_0x804b('0x26')](function(_0x2576a4){if(_0x2576a4){_0x2756de=_0x2576a4['length'];if(!_0x3d56bb[_0x804b('0x31')][_0x804b('0x37')]('nolimit')){_0x164c5d[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3d56bb[_0x804b('0x31')]['limit']);_0x164c5d[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x1e')]);}return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})['then'](function(_0xb08c4e){if(_0xb08c4e){return _0xb08c4e?{'count':_0x2756de,'rows':_0xb08c4e}:null;}})[_0x804b('0x26')](respondWithResult(_0x4a5068,null))[_0x804b('0x43')](handleError(_0x4a5068,null));};exports[_0x804b('0x4e')]=function(_0x5dcc63,_0x4f8a81,_0x183796){if(_0x5dcc63['body']['id']){delete _0x5dcc63[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x4b')]({'where':{'id':_0x5dcc63[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4f8a81,null))['then'](function(_0x27f06c){if(_0x27f06c){_0x5dcc63[_0x804b('0x48')][_0x804b('0x4f')]=_0x27f06c['id'];_0x5dcc63['body'][_0x804b('0x50')]=integrations[_0x804b('0x51')](_0x5dcc63['body'][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);_0x5dcc63[_0x804b('0x48')]['Descriptions']=integrations[_0x804b('0x53')](_0x5dcc63[_0x804b('0x48')][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);return db['ZendeskConfiguration'][_0x804b('0x47')](_0x5dcc63[_0x804b('0x48')],{'include':[{'model':db[_0x804b('0x54')],'as':_0x804b('0x50')},{'model':db['ZendeskField'],'as':_0x804b('0x55')}]});}return null;})[_0x804b('0x26')](respondWithResult(_0x4f8a81,null))[_0x804b('0x43')](handleError(_0x4f8a81,null));};exports[_0x804b('0x56')]=function(_0x17e21c,_0x1bb4ec,_0x5b3b79){var _0x39ed3c='';return db[_0x804b('0x40')]['findOne']({'where':{'id':_0x17e21c[_0x804b('0x49')]['id']},'attributes':['id',_0x804b('0x57'),_0x804b('0x58'),_0x804b('0x59'),'authType',_0x804b('0x5a')]})[_0x804b('0x26')](handleEntityNotFound(_0x1bb4ec,null))['then'](function(_0x2541cd){if(_0x2541cd){_0x39ed3c=_0x2541cd[_0x804b('0x5a')];var _0x549504=_0x39ed3c[_0x804b('0x5b')](-0x1);if(_0x549504==='/'){_0x39ed3c=_0x39ed3c['substring'](0x0,_0x39ed3c[_0x804b('0x5c')](_0x549504));}var _0x3e2813={'method':_0x804b('0x5d'),'uri':util[_0x804b('0x5e')](_0x804b('0x5f'),_0x39ed3c,_0x804b('0x60')),'json':!![]};switch(_0x2541cd[_0x804b('0x61')]){case'password':_0x3e2813[_0x804b('0x62')]={'Authorization':util['format'](_0x804b('0x63'),new Buffer(util[_0x804b('0x5e')](_0x804b('0x64'),_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x58')]))[_0x804b('0x65')](_0x804b('0x66')))};break;case _0x804b('0x59'):_0x3e2813[_0x804b('0x62')]={'Authorization':util[_0x804b('0x5e')](_0x804b('0x63'),new Buffer(util['format']('%s/token:%s',_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x59')]))[_0x804b('0x65')](_0x804b('0x66')))};break;default:throw new db['Sequelize'][(_0x804b('0x67'))](_0x804b('0x68'));}return rp(_0x3e2813);}})[_0x804b('0x26')](function(_0x3dda89){if(_0x3dda89){var _0x260419=[_0x804b('0x69'),_0x804b('0x6a'),_0x804b('0x6b'),_0x804b('0x6c')];_[_0x804b('0x6d')](_0x3dda89['ticket_fields'],function(_0x5a6661){return _0x260419[_0x804b('0x6e')](_0x5a6661[_0x804b('0x2e')]);});return{'count':_0x3dda89['ticket_fields'][_0x804b('0x36')],'rows':_[_0x804b('0x2c')](_0x3dda89['ticket_fields'],function(_0x345bf7){return{'id':_0x345bf7['id'],'name':_0x345bf7['position']>0x7?_0x345bf7['title']:_0x345bf7[_0x804b('0x2e')],'custom':_0x345bf7[_0x804b('0x6f')]>0x7?!![]:![],'options':_0x345bf7['system_field_options']?_0x345bf7['system_field_options']:_0x345bf7[_0x804b('0x70')]?_0x345bf7[_0x804b('0x70')]:[]};})};}})['then'](respondWithResult(_0x1bb4ec,null))[_0x804b('0x43')](function(_0x5e2756){var _0x42dfc3=_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?0x1f4:_0x5e2756['statusCode']||0x1f4;logger[_0x804b('0x72')](_0x804b('0x73'),_0x804b('0x56'),_0x42dfc3,JSON[_0x804b('0x74')](_0x5e2756));delete _0x5e2756[_0x804b('0x2a')];if(_0x42dfc3===0x191){_0x42dfc3=0x190;}_0x1bb4ec[_0x804b('0x1a')](_0x42dfc3)[_0x804b('0x2b')](_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?{'message':_0x804b('0x75'),'statusCode':_0x5e2756['statusCode']}:_0x5e2756);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 3b44a93..53d6124 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 _0x2ac0=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount'];(function(_0x94030f,_0x476ed2){var _0x9f7747=function(_0x2b977a){while(--_0x2b977a){_0x94030f['push'](_0x94030f['shift']());}};_0x9f7747(++_0x476ed2);}(_0x2ac0,0xcc));var _0x02ac=function(_0x578d64,_0x15da79){_0x578d64=_0x578d64-0x0;var _0x8b4e42=_0x2ac0[_0x578d64];return _0x8b4e42;};'use strict';var _=require(_0x02ac('0x0'));var util=require(_0x02ac('0x1'));var logger=require(_0x02ac('0x2'))(_0x02ac('0x3'));var moment=require(_0x02ac('0x4'));var BPromise=require(_0x02ac('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02ac('0x6'));var rimraf=require('rimraf');var config=require(_0x02ac('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x02ac('0x8'));module[_0x02ac('0x9')]=function(_0x1ffdd4,_0x4d3d24){return _0x1ffdd4[_0x02ac('0xa')](_0x02ac('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80f9=['bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','util','../../config/logger','api'];(function(_0x1ed3d9,_0x5c42c4){var _0x12c1d2=function(_0x415fd3){while(--_0x415fd3){_0x1ed3d9['push'](_0x1ed3d9['shift']());}};_0x12c1d2(++_0x5c42c4);}(_0x80f9,0xd4));var _0x980f=function(_0x1e48d6,_0x5736ea){_0x1e48d6=_0x1e48d6-0x0;var _0xc45691=_0x80f9[_0x1e48d6];return _0xc45691;};'use strict';var _=require(_0x980f('0x0'));var util=require(_0x980f('0x1'));var logger=require(_0x980f('0x2'))(_0x980f('0x3'));var moment=require('moment');var BPromise=require(_0x980f('0x4'));var rp=require(_0x980f('0x5'));var fs=require('fs');var path=require(_0x980f('0x6'));var rimraf=require(_0x980f('0x7'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x980f('0x8'));module[_0x980f('0x9')]=function(_0x5cf2fe,_0x2da235){return _0x5cf2fe[_0x980f('0xa')](_0x980f('0xb'),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 00d0f3a..67f1000 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 _0x741a=['debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetZendeskAccount','ZendeskAccount','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s'];(function(_0x3b7698,_0x4b0c43){var _0xf3169e=function(_0x17576e){while(--_0x17576e){_0x3b7698['push'](_0x3b7698['shift']());}};_0xf3169e(++_0x4b0c43);}(_0x741a,0x7b));var _0xa741=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0x741a[_0x11f249];return _0x5c3656;};'use strict';var _=require(_0xa741('0x0'));var util=require(_0xa741('0x1'));var moment=require(_0xa741('0x2'));var BPromise=require(_0xa741('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa741('0x4'));var db=require(_0xa741('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa741('0x6'));var jayson=require(_0xa741('0x7'));var client=jayson[_0xa741('0x8')][_0xa741('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37182c,_0x9b6033,_0x33be28){return new BPromise(function(_0x1e9c51,_0x183e10){return client[_0xa741('0xa')](_0x37182c,_0x33be28)[_0xa741('0xb')](function(_0x5b9529){logger['info'](_0xa741('0xc'),_0x9b6033,'request\x20sent');logger[_0xa741('0xd')](_0xa741('0xe'),_0x9b6033,_0xa741('0xf'),JSON[_0xa741('0x10')](_0x5b9529));if(_0x5b9529[_0xa741('0x11')]){if(_0x5b9529['error'][_0xa741('0x12')]===0x1f4){logger[_0xa741('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x9b6033,_0x5b9529['error'][_0xa741('0x13')]);return _0x183e10(_0x5b9529[_0xa741('0x11')]['message']);}logger[_0xa741('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x9b6033,_0x5b9529[_0xa741('0x11')][_0xa741('0x13')]);return _0x1e9c51(_0x5b9529[_0xa741('0x11')][_0xa741('0x13')]);}else{logger[_0xa741('0x14')]('ZendeskAccount,\x20%s,\x20%s',_0x9b6033,_0xa741('0xf'));_0x1e9c51(_0x5b9529['result'][_0xa741('0x13')]);}})[_0xa741('0x15')](function(_0xae3701){logger[_0xa741('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x9b6033,_0xae3701);_0x183e10(_0xae3701);});});}exports[_0xa741('0x16')]=function(_0x53e035){var _0x547879=this;return new Promise(function(_0x46ae68,_0x13ebfe){return db[_0xa741('0x17')]['findAll']({'raw':_0x53e035[_0xa741('0x18')]?_0x53e035[_0xa741('0x18')][_0xa741('0x19')]===undefined?!![]:![]:!![],'where':_0x53e035[_0xa741('0x18')]?_0x53e035[_0xa741('0x18')]['where']||null:null,'attributes':_0x53e035[_0xa741('0x18')]?_0x53e035['options'][_0xa741('0x1a')]||null:null,'limit':_0x53e035[_0xa741('0x18')]?_0x53e035['options'][_0xa741('0x1b')]||null:null,'include':_0x53e035[_0xa741('0x18')]?_0x53e035[_0xa741('0x18')][_0xa741('0x1c')]?_[_0xa741('0x1d')](_0x53e035[_0xa741('0x18')][_0xa741('0x1c')],function(_0x1b7b55){return{'model':db[_0x1b7b55[_0xa741('0x1e')]],'as':_0x1b7b55['as'],'attributes':_0x1b7b55['attributes'],'include':_0x1b7b55[_0xa741('0x1c')]?_[_0xa741('0x1d')](_0x1b7b55[_0xa741('0x1c')],function(_0x123ef0){return{'model':db[_0x123ef0[_0xa741('0x1e')]],'as':_0x123ef0['as'],'attributes':_0x123ef0[_0xa741('0x1a')],'include':_0x123ef0[_0xa741('0x1c')]?_[_0xa741('0x1d')](_0x123ef0[_0xa741('0x1c')],function(_0x2a75bc){return{'model':db[_0x2a75bc[_0xa741('0x1e')]],'as':_0x2a75bc['as'],'attributes':_0x2a75bc[_0xa741('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa741('0xb')](function(_0x15829b){logger[_0xa741('0x14')](_0xa741('0x16'),_0x53e035);logger[_0xa741('0xd')]('GetZendeskAccount',_0x53e035,JSON['stringify'](_0x15829b));_0x46ae68(_0x15829b);})[_0xa741('0x15')](function(_0x5489c6){logger[_0xa741('0x11')](_0xa741('0x16'),_0x5489c6[_0xa741('0x13')],_0x53e035);_0x13ebfe(_0x547879[_0xa741('0x11')](0x1f4,_0x5489c6[_0xa741('0x13')]));});});};exports[_0xa741('0x1f')]=function(_0x3cb3d7){var _0x139460=this;return new Promise(function(_0x421d35,_0x27721e){return db[_0xa741('0x17')][_0xa741('0x20')]({'raw':_0x3cb3d7['options']?_0x3cb3d7[_0xa741('0x18')][_0xa741('0x19')]===undefined?!![]:![]:!![],'where':_0x3cb3d7[_0xa741('0x18')]?_0x3cb3d7[_0xa741('0x18')][_0xa741('0x21')]||null:null,'attributes':_0x3cb3d7[_0xa741('0x18')]?_0x3cb3d7[_0xa741('0x18')]['attributes']||null:null,'include':_0x3cb3d7[_0xa741('0x18')]?_0x3cb3d7[_0xa741('0x18')][_0xa741('0x1c')]?_[_0xa741('0x1d')](_0x3cb3d7[_0xa741('0x18')][_0xa741('0x1c')],function(_0x1db9e1){return{'model':db[_0x1db9e1['model']],'as':_0x1db9e1['as'],'attributes':_0x1db9e1[_0xa741('0x1a')],'include':_0x1db9e1[_0xa741('0x1c')]?_['map'](_0x1db9e1[_0xa741('0x1c')],function(_0x2bf6b2){return{'model':db[_0x2bf6b2[_0xa741('0x1e')]],'as':_0x2bf6b2['as'],'attributes':_0x2bf6b2['attributes'],'include':_0x2bf6b2[_0xa741('0x1c')]?_['map'](_0x2bf6b2[_0xa741('0x1c')],function(_0x1eb581){return{'model':db[_0x1eb581[_0xa741('0x1e')]],'as':_0x1eb581['as'],'attributes':_0x1eb581[_0xa741('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa741('0xb')](function(_0x489178){logger['info']('ShowZendeskAccount',_0x3cb3d7);logger[_0xa741('0xd')](_0xa741('0x1f'),_0x3cb3d7,JSON[_0xa741('0x10')](_0x489178));_0x421d35(_0x489178);})[_0xa741('0x15')](function(_0x4dcd00){logger[_0xa741('0x11')](_0xa741('0x1f'),_0x4dcd00[_0xa741('0x13')],_0x3cb3d7);_0x27721e(_0x139460[_0xa741('0x11')](0x1f4,_0x4dcd00[_0xa741('0x13')]));});});}; \ No newline at end of file +var _0x0c9d=['catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','ShowZendeskAccount','find','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x24cd7e,_0x11d3e6){var _0x29be41=function(_0x174d26){while(--_0x174d26){_0x24cd7e['push'](_0x24cd7e['shift']());}};_0x29be41(++_0x11d3e6);}(_0x0c9d,0x1ad));var _0xd0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd0c9('0x0'));var util=require('util');var moment=require(_0xd0c9('0x1'));var BPromise=require(_0xd0c9('0x2'));var rs=require(_0xd0c9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd0c9('0x4'));var logger=require(_0xd0c9('0x5'))(_0xd0c9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd0c9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46f6f9,_0x2743c5,_0x5bc6c5){return new BPromise(function(_0x203310,_0x5b74d8){return client['request'](_0x46f6f9,_0x5bc6c5)[_0xd0c9('0x8')](function(_0x2390a3){logger[_0xd0c9('0x9')](_0xd0c9('0xa'),_0x2743c5,_0xd0c9('0xb'));logger[_0xd0c9('0xc')](_0xd0c9('0xd'),_0x2743c5,_0xd0c9('0xb'),JSON[_0xd0c9('0xe')](_0x2390a3));if(_0x2390a3[_0xd0c9('0xf')]){if(_0x2390a3[_0xd0c9('0xf')][_0xd0c9('0x10')]===0x1f4){logger[_0xd0c9('0xf')](_0xd0c9('0xa'),_0x2743c5,_0x2390a3['error'][_0xd0c9('0x11')]);return _0x5b74d8(_0x2390a3[_0xd0c9('0xf')][_0xd0c9('0x11')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2743c5,_0x2390a3[_0xd0c9('0xf')][_0xd0c9('0x11')]);return _0x203310(_0x2390a3[_0xd0c9('0xf')]['message']);}else{logger[_0xd0c9('0x9')](_0xd0c9('0xa'),_0x2743c5,_0xd0c9('0xb'));_0x203310(_0x2390a3[_0xd0c9('0x12')]['message']);}})[_0xd0c9('0x13')](function(_0x10b492){logger[_0xd0c9('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x2743c5,_0x10b492);_0x5b74d8(_0x10b492);});});}exports[_0xd0c9('0x14')]=function(_0xe06cbe){var _0x5ee7d1=this;return new Promise(function(_0x12b21e,_0x5ba486){return db[_0xd0c9('0x15')][_0xd0c9('0x16')]({'raw':_0xe06cbe[_0xd0c9('0x17')]?_0xe06cbe[_0xd0c9('0x17')][_0xd0c9('0x18')]===undefined?!![]:![]:!![],'where':_0xe06cbe[_0xd0c9('0x17')]?_0xe06cbe[_0xd0c9('0x17')][_0xd0c9('0x19')]||null:null,'attributes':_0xe06cbe[_0xd0c9('0x17')]?_0xe06cbe[_0xd0c9('0x17')][_0xd0c9('0x1a')]||null:null,'limit':_0xe06cbe[_0xd0c9('0x17')]?_0xe06cbe[_0xd0c9('0x17')]['limit']||null:null,'include':_0xe06cbe['options']?_0xe06cbe['options'][_0xd0c9('0x1b')]?_[_0xd0c9('0x1c')](_0xe06cbe[_0xd0c9('0x17')]['include'],function(_0x2dbf34){return{'model':db[_0x2dbf34[_0xd0c9('0x1d')]],'as':_0x2dbf34['as'],'attributes':_0x2dbf34[_0xd0c9('0x1a')],'include':_0x2dbf34[_0xd0c9('0x1b')]?_[_0xd0c9('0x1c')](_0x2dbf34[_0xd0c9('0x1b')],function(_0xba9c3d){return{'model':db[_0xba9c3d[_0xd0c9('0x1d')]],'as':_0xba9c3d['as'],'attributes':_0xba9c3d['attributes'],'include':_0xba9c3d[_0xd0c9('0x1b')]?_[_0xd0c9('0x1c')](_0xba9c3d[_0xd0c9('0x1b')],function(_0x1e6de4){return{'model':db[_0x1e6de4[_0xd0c9('0x1d')]],'as':_0x1e6de4['as'],'attributes':_0x1e6de4[_0xd0c9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd0c9('0x8')](function(_0x2f0691){logger[_0xd0c9('0x9')](_0xd0c9('0x14'),_0xe06cbe);logger[_0xd0c9('0xc')](_0xd0c9('0x14'),_0xe06cbe,JSON[_0xd0c9('0xe')](_0x2f0691));_0x12b21e(_0x2f0691);})[_0xd0c9('0x13')](function(_0x27b03d){logger[_0xd0c9('0xf')](_0xd0c9('0x14'),_0x27b03d[_0xd0c9('0x11')],_0xe06cbe);_0x5ba486(_0x5ee7d1[_0xd0c9('0xf')](0x1f4,_0x27b03d[_0xd0c9('0x11')]));});});};exports[_0xd0c9('0x1e')]=function(_0x2795c8){var _0x2c217a=this;return new Promise(function(_0x32c8f1,_0x27a987){return db['ZendeskAccount'][_0xd0c9('0x1f')]({'raw':_0x2795c8[_0xd0c9('0x17')]?_0x2795c8[_0xd0c9('0x17')][_0xd0c9('0x18')]===undefined?!![]:![]:!![],'where':_0x2795c8['options']?_0x2795c8['options'][_0xd0c9('0x19')]||null:null,'attributes':_0x2795c8[_0xd0c9('0x17')]?_0x2795c8[_0xd0c9('0x17')][_0xd0c9('0x1a')]||null:null,'include':_0x2795c8[_0xd0c9('0x17')]?_0x2795c8[_0xd0c9('0x17')]['include']?_[_0xd0c9('0x1c')](_0x2795c8[_0xd0c9('0x17')][_0xd0c9('0x1b')],function(_0x1083e4){return{'model':db[_0x1083e4[_0xd0c9('0x1d')]],'as':_0x1083e4['as'],'attributes':_0x1083e4[_0xd0c9('0x1a')],'include':_0x1083e4[_0xd0c9('0x1b')]?_[_0xd0c9('0x1c')](_0x1083e4[_0xd0c9('0x1b')],function(_0x56548a){return{'model':db[_0x56548a[_0xd0c9('0x1d')]],'as':_0x56548a['as'],'attributes':_0x56548a[_0xd0c9('0x1a')],'include':_0x56548a[_0xd0c9('0x1b')]?_[_0xd0c9('0x1c')](_0x56548a[_0xd0c9('0x1b')],function(_0x50bfe1){return{'model':db[_0x50bfe1[_0xd0c9('0x1d')]],'as':_0x50bfe1['as'],'attributes':_0x50bfe1[_0xd0c9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd0c9('0x8')](function(_0x2644f5){logger[_0xd0c9('0x9')](_0xd0c9('0x1e'),_0x2795c8);logger[_0xd0c9('0xc')](_0xd0c9('0x1e'),_0x2795c8,JSON[_0xd0c9('0xe')](_0x2644f5));_0x32c8f1(_0x2644f5);})[_0xd0c9('0x13')](function(_0x308082){logger[_0xd0c9('0xf')](_0xd0c9('0x1e'),_0x308082[_0xd0c9('0x11')],_0x2795c8);_0x27a987(_0x2c217a[_0xd0c9('0xf')](0x1f4,_0x308082[_0xd0c9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index b487a17..8cddda3 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 _0x5c00=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0xaf8a88,_0x14d4a3){var _0x2c7b28=function(_0x460030){while(--_0x460030){_0xaf8a88['push'](_0xaf8a88['shift']());}};_0x2c7b28(++_0x14d4a3);}(_0x5c00,0x17e));var _0x05c0=function(_0x35b7ba,_0x155c7f){_0x35b7ba=_0x35b7ba-0x0;var _0x25ea5e=_0x5c00[_0x35b7ba];return _0x25ea5e;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id/fields',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/descriptions',auth[_0x05c0('0x9')](),controller['getDescriptions']);router[_0x05c0('0x8')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller['getTags']);router[_0x05c0('0x10')]('/',auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0x10')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x12')]);router[_0x05c0('0x13')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller['update']);router[_0x05c0('0x15')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x16')]);module[_0x05c0('0x17')]=router; \ No newline at end of file +var _0x4483=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects'];(function(_0x40b0b9,_0x59cd60){var _0x28e0e2=function(_0x2b75c6){while(--_0x2b75c6){_0x40b0b9['push'](_0x40b0b9['shift']());}};_0x28e0e2(++_0x59cd60);}(_0x4483,0x1a3));var _0x3448=function(_0x23fd7b,_0x394165){_0x23fd7b=_0x23fd7b-0x0;var _0x4a4402=_0x4483[_0x23fd7b];return _0x4a4402;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id/fields',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3448('0x13')]);router[_0x3448('0x14')]('/',auth['isAuthenticated'](),controller[_0x3448('0x15')]);router[_0x3448('0x14')](_0x3448('0x16'),auth['isAuthenticated'](),controller[_0x3448('0x17')]);router[_0x3448('0x18')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x19')]);router[_0x3448('0x1a')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x1b')]);module[_0x3448('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 14323c0..9c30e26 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 _0x1aab=['sequelize','exports','STRING'];(function(_0x1aabbd,_0x4a6869){var _0x513dcd=function(_0x70d75a){while(--_0x70d75a){_0x1aabbd['push'](_0x1aabbd['shift']());}};_0x513dcd(++_0x4a6869);}(_0x1aab,0xb1));var _0xb1aa=function(_0x447d2b,_0x1f79c0){_0x447d2b=_0x447d2b-0x0;var _0x48a1f0=_0x1aab[_0x447d2b];return _0x48a1f0;};'use strict';var Sequelize=require(_0xb1aa('0x0'));module[_0xb1aa('0x1')]={'name':{'type':Sequelize[_0xb1aa('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3273=['STRING','sequelize','exports'];(function(_0x44e695,_0x129bbf){var _0x5b48d7=function(_0x273f1d){while(--_0x273f1d){_0x44e695['push'](_0x44e695['shift']());}};_0x5b48d7(++_0x129bbf);}(_0x3273,0xfa));var _0x3327=function(_0x2ce9d,_0x4ff962){_0x2ce9d=_0x2ce9d-0x0;var _0x578428=_0x3273[_0x2ce9d];return _0x578428;};'use strict';var Sequelize=require(_0x3327('0x0'));module[_0x3327('0x1')]={'name':{'type':Sequelize[_0x3327('0x2')]},'description':{'type':Sequelize[_0x3327('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 09af914..af62507 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 _0x190a=['api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','update','destroy','getFields','ZendeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','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','../../config/license/hardware'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x190a,0x94));var _0xa190=function(_0x5ea778,_0x711f5f){_0x5ea778=_0x5ea778-0x0;var _0x4168f5=_0x190a[_0x5ea778];return _0x4168f5;};'use strict';var emlformat=require(_0xa190('0x0'));var rimraf=require(_0xa190('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa190('0x2'));var rp=require(_0xa190('0x3'));var moment=require(_0xa190('0x4'));var BPromise=require(_0xa190('0x5'));var Mustache=require(_0xa190('0x6'));var util=require(_0xa190('0x7'));var path=require(_0xa190('0x8'));var sox=require(_0xa190('0x9'));var csv=require('to-csv');var ejs=require(_0xa190('0xa'));var fs=require('fs');var fs_extra=require(_0xa190('0xb'));var _=require(_0xa190('0xc'));var squel=require(_0xa190('0xd'));var crypto=require(_0xa190('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa190('0xf'));var toCsv=require(_0xa190('0x10'));var querystring=require(_0xa190('0x11'));var Papa=require(_0xa190('0x12'));var Redis=require(_0xa190('0x13'));var authService=require(_0xa190('0x14'));var qs=require(_0xa190('0x15'));var as=require(_0xa190('0x16'));var hardwareService=require(_0xa190('0x17'));var logger=require('../../config/logger')(_0xa190('0x18'));var utils=require(_0xa190('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xa190('0x1a'));var db=require(_0xa190('0x1b'))['db'];function respondWithStatusCode(_0x532e75,_0x3882c8){_0x3882c8=_0x3882c8||0xcc;return function(_0x26932e){if(_0x26932e){return _0x532e75['sendStatus'](_0x3882c8);}return _0x532e75['status'](_0x3882c8)[_0xa190('0x1c')]();};}function respondWithResult(_0x32e3a4,_0x121ad0){_0x121ad0=_0x121ad0||0xc8;return function(_0x25da8b){if(_0x25da8b){return _0x32e3a4[_0xa190('0x1d')](_0x121ad0)['json'](_0x25da8b);}};}function respondWithFilteredResult(_0x3dc692,_0x2e69cc){return function(_0x1b0f33){if(_0x1b0f33){var _0x4c7636=typeof _0x2e69cc[_0xa190('0x1e')]===_0xa190('0x1f')&&typeof _0x2e69cc[_0xa190('0x20')]===_0xa190('0x1f');var _0x3dff55=_0x1b0f33['count'];var _0x16e462=_0x4c7636?0x0:_0x2e69cc[_0xa190('0x1e')];var _0x4b3768=_0x4c7636?_0x1b0f33[_0xa190('0x21')]:_0x2e69cc['offset']+_0x2e69cc['limit'];var _0x469977;if(_0x4b3768>=_0x3dff55){_0x4b3768=_0x3dff55;_0x469977=0xc8;}else{_0x469977=0xce;}_0x3dc692[_0xa190('0x1d')](_0x469977);return _0x3dc692[_0xa190('0x22')](_0xa190('0x23'),_0x16e462+'-'+_0x4b3768+'/'+_0x3dff55)[_0xa190('0x24')](_0x1b0f33);}return null;};}function patchUpdates(_0x304c27){return function(_0x108498){try{jsonpatch['apply'](_0x108498,_0x304c27,!![]);}catch(_0x2ad19e){return BPromise[_0xa190('0x25')](_0x2ad19e);}return _0x108498[_0xa190('0x26')]();};}function saveUpdates(_0x2e0e32,_0x3344c3){return function(_0x223c1c){if(_0x223c1c){return _0x223c1c['update'](_0x2e0e32)[_0xa190('0x27')](function(_0x136c91){return _0x136c91;});}return null;};}function removeEntity(_0x1444b9,_0x501596){return function(_0x1f0c40){if(_0x1f0c40){return _0x1f0c40['destroy']()[_0xa190('0x27')](function(){_0x1444b9[_0xa190('0x1d')](0xcc)[_0xa190('0x1c')]();});}};}function handleEntityNotFound(_0x3cbc67,_0x2a9f62){return function(_0x596d58){if(!_0x596d58){_0x3cbc67['sendStatus'](0x194);}return _0x596d58;};}function handleError(_0x5319e1,_0x33dbcb){_0x33dbcb=_0x33dbcb||0x1f4;return function(_0x3c11c1){logger['error'](_0x3c11c1[_0xa190('0x28')]);if(_0x3c11c1[_0xa190('0x29')]){delete _0x3c11c1['name'];}_0x5319e1['status'](_0x33dbcb)[_0xa190('0x2a')](_0x3c11c1);};}exports[_0xa190('0x2b')]=function(_0x4feac8,_0x2a5b24){var _0x49a6a5={},_0x2f8651={},_0x25f1e3={'count':0x0,'rows':[]};var _0x459a9f=_[_0xa190('0x2c')](db[_0xa190('0x2d')][_0xa190('0x2e')],function(_0x482a7f){return{'name':_0x482a7f[_0xa190('0x2f')],'type':_0x482a7f[_0xa190('0x30')][_0xa190('0x31')]};});_0x2f8651[_0xa190('0x32')]=_[_0xa190('0x2c')](_0x459a9f,'name');_0x2f8651[_0xa190('0x33')]=_[_0xa190('0x34')](_0x4feac8[_0xa190('0x33')]);_0x2f8651[_0xa190('0x35')]=_[_0xa190('0x36')](_0x2f8651[_0xa190('0x32')],_0x2f8651['query']);_0x49a6a5['attributes']=_[_0xa190('0x36')](_0x2f8651[_0xa190('0x32')],qs['fields'](_0x4feac8[_0xa190('0x33')][_0xa190('0x37')]));_0x49a6a5[_0xa190('0x38')]=_0x49a6a5[_0xa190('0x38')][_0xa190('0x39')]?_0x49a6a5[_0xa190('0x38')]:_0x2f8651[_0xa190('0x32')];if(!_0x4feac8[_0xa190('0x33')][_0xa190('0x3a')](_0xa190('0x3b'))){_0x49a6a5['limit']=qs[_0xa190('0x20')](_0x4feac8[_0xa190('0x33')][_0xa190('0x20')]);_0x49a6a5[_0xa190('0x1e')]=qs[_0xa190('0x1e')](_0x4feac8['query']['offset']);}_0x49a6a5[_0xa190('0x3c')]=qs[_0xa190('0x3d')](_0x4feac8['query'][_0xa190('0x3d')]);_0x49a6a5[_0xa190('0x3e')]=qs[_0xa190('0x35')](_[_0xa190('0x3f')](_0x4feac8[_0xa190('0x33')],_0x2f8651[_0xa190('0x35')]),_0x459a9f);if(_0x4feac8[_0xa190('0x33')][_0xa190('0x40')]){_0x49a6a5[_0xa190('0x3e')]=_[_0xa190('0x41')](_0x49a6a5[_0xa190('0x3e')],{'$or':_[_0xa190('0x2c')](_0x459a9f,function(_0x598008){if(_0x598008['type']!==_0xa190('0x42')){var _0x4691bf={};_0x4691bf[_0x598008[_0xa190('0x29')]]={'$like':'%'+_0x4feac8[_0xa190('0x33')]['filter']+'%'};return _0x4691bf;}})});}_0x49a6a5=_['merge']({},_0x49a6a5,_0x4feac8[_0xa190('0x43')]);var _0x5c665a={'where':_0x49a6a5[_0xa190('0x3e')]};return db[_0xa190('0x2d')][_0xa190('0x21')](_0x5c665a)[_0xa190('0x27')](function(_0x39f855){_0x25f1e3['count']=_0x39f855;if(_0x4feac8['query'][_0xa190('0x44')]){_0x49a6a5[_0xa190('0x45')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x49a6a5);})['then'](function(_0x271912){_0x25f1e3[_0xa190('0x46')]=_0x271912;return _0x25f1e3;})[_0xa190('0x27')](respondWithFilteredResult(_0x2a5b24,_0x49a6a5))[_0xa190('0x47')](handleError(_0x2a5b24,null));};exports[_0xa190('0x48')]=function(_0x1dea69,_0x27281a){var _0x189600={'raw':![],'where':{'id':_0x1dea69[_0xa190('0x49')]['id']}},_0x50dfb8={};_0x50dfb8['model']=_[_0xa190('0x34')](db[_0xa190('0x2d')][_0xa190('0x2e')]);_0x50dfb8['query']=_[_0xa190('0x34')](_0x1dea69[_0xa190('0x33')]);_0x50dfb8[_0xa190('0x35')]=_[_0xa190('0x36')](_0x50dfb8[_0xa190('0x32')],_0x50dfb8['query']);_0x189600[_0xa190('0x38')]=_[_0xa190('0x36')](_0x50dfb8[_0xa190('0x32')],qs[_0xa190('0x37')](_0x1dea69[_0xa190('0x33')][_0xa190('0x37')]));_0x189600[_0xa190('0x38')]=_0x189600[_0xa190('0x38')][_0xa190('0x39')]?_0x189600[_0xa190('0x38')]:_0x50dfb8[_0xa190('0x32')];if(_0x1dea69[_0xa190('0x33')][_0xa190('0x44')]){_0x189600[_0xa190('0x45')]=[{'all':!![]}];}_0x189600=_['merge']({},_0x189600,_0x1dea69['options']);return db[_0xa190('0x2d')]['find'](_0x189600)[_0xa190('0x27')](handleEntityNotFound(_0x27281a,null))['then'](respondWithResult(_0x27281a,null))[_0xa190('0x47')](handleError(_0x27281a,null));};exports[_0xa190('0x4a')]=function(_0x370718,_0x3980b4){return db[_0xa190('0x2d')][_0xa190('0x4a')](_0x370718[_0xa190('0x4b')],{})['then'](respondWithResult(_0x3980b4,0xc9))[_0xa190('0x47')](handleError(_0x3980b4,null));};exports[_0xa190('0x4c')]=function(_0x2b1a90,_0x5d0cf9){if(_0x2b1a90['body']['id']){delete _0x2b1a90['body']['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x2b1a90['params']['id']}})[_0xa190('0x27')](handleEntityNotFound(_0x5d0cf9,null))[_0xa190('0x27')](saveUpdates(_0x2b1a90['body'],null))[_0xa190('0x27')](respondWithResult(_0x5d0cf9,null))[_0xa190('0x47')](handleError(_0x5d0cf9,null));};exports[_0xa190('0x4d')]=function(_0x6ae632,_0x562e23){return db['ZendeskConfiguration']['find']({'where':{'id':_0x6ae632[_0xa190('0x49')]['id']}})[_0xa190('0x27')](handleEntityNotFound(_0x562e23,null))[_0xa190('0x27')](removeEntity(_0x562e23,null))['catch'](handleError(_0x562e23,null));};exports[_0xa190('0x4e')]=function(_0x18680d,_0x2f6a91,_0x3cdbf2){var _0x267c8e={};var _0x489198={};var _0x10d500;var _0x2e37fb;return db[_0xa190('0x2d')]['findOne']({'where':{'id':_0x18680d[_0xa190('0x49')]['id']}})[_0xa190('0x27')](handleEntityNotFound(_0x2f6a91,null))[_0xa190('0x27')](function(_0x42745c){if(_0x42745c){_0x10d500=_0x42745c;_0x489198['model']=_[_0xa190('0x34')](db[_0xa190('0x4f')]['rawAttributes']);_0x489198['query']=_[_0xa190('0x34')](_0x18680d['query']);_0x489198[_0xa190('0x35')]=_[_0xa190('0x36')](_0x489198[_0xa190('0x32')],_0x489198[_0xa190('0x33')]);_0x267c8e[_0xa190('0x38')]=_[_0xa190('0x36')](_0x489198['model'],qs[_0xa190('0x37')](_0x18680d[_0xa190('0x33')][_0xa190('0x37')]));_0x267c8e[_0xa190('0x38')]=_0x267c8e['attributes'][_0xa190('0x39')]?_0x267c8e[_0xa190('0x38')]:_0x489198[_0xa190('0x32')];_0x267c8e[_0xa190('0x3c')]=qs[_0xa190('0x3d')](_0x18680d['query']['sort']);_0x267c8e[_0xa190('0x3e')]=qs[_0xa190('0x35')](_[_0xa190('0x3f')](_0x18680d[_0xa190('0x33')],_0x489198[_0xa190('0x35')]));if(_0x18680d['query'][_0xa190('0x40')]){_0x267c8e[_0xa190('0x3e')]=_[_0xa190('0x41')](_0x267c8e[_0xa190('0x3e')],{'$or':_[_0xa190('0x2c')](_0x267c8e[_0xa190('0x38')],function(_0x3ac245){var _0x31675a={};_0x31675a[_0x3ac245]={'$like':'%'+_0x18680d[_0xa190('0x33')][_0xa190('0x40')]+'%'};return _0x31675a;})});}_0x267c8e=_['merge']({},_0x267c8e,_0x18680d['options']);return _0x10d500[_0xa190('0x4e')](_0x267c8e);}})[_0xa190('0x27')](function(_0x53fea5){if(_0x53fea5){_0x2e37fb=_0x53fea5[_0xa190('0x39')];if(!_0x18680d[_0xa190('0x33')][_0xa190('0x3a')]('nolimit')){_0x267c8e[_0xa190('0x20')]=qs['limit'](_0x18680d[_0xa190('0x33')][_0xa190('0x20')]);_0x267c8e['offset']=qs[_0xa190('0x1e')](_0x18680d[_0xa190('0x33')][_0xa190('0x1e')]);}return _0x10d500[_0xa190('0x4e')](_0x267c8e);}})[_0xa190('0x27')](function(_0x1571e7){if(_0x1571e7){return _0x1571e7?{'count':_0x2e37fb,'rows':_0x1571e7}:null;}})[_0xa190('0x27')](respondWithResult(_0x2f6a91,null))[_0xa190('0x47')](handleError(_0x2f6a91,null));};exports[_0xa190('0x50')]=function(_0xced136,_0x490d9,_0x807432){var _0x4b9cec={};var _0x4524dd={};var _0x847da;var _0x33abe7;return db['ZendeskConfiguration'][_0xa190('0x51')]({'where':{'id':_0xced136[_0xa190('0x49')]['id']}})[_0xa190('0x27')](handleEntityNotFound(_0x490d9,null))['then'](function(_0x398745){if(_0x398745){_0x847da=_0x398745;_0x4524dd[_0xa190('0x32')]=_[_0xa190('0x34')](db[_0xa190('0x4f')]['rawAttributes']);_0x4524dd[_0xa190('0x33')]=_[_0xa190('0x34')](_0xced136[_0xa190('0x33')]);_0x4524dd[_0xa190('0x35')]=_[_0xa190('0x36')](_0x4524dd['model'],_0x4524dd['query']);_0x4b9cec[_0xa190('0x38')]=_['intersection'](_0x4524dd[_0xa190('0x32')],qs[_0xa190('0x37')](_0xced136[_0xa190('0x33')][_0xa190('0x37')]));_0x4b9cec[_0xa190('0x38')]=_0x4b9cec[_0xa190('0x38')]['length']?_0x4b9cec[_0xa190('0x38')]:_0x4524dd[_0xa190('0x32')];_0x4b9cec[_0xa190('0x3c')]=qs[_0xa190('0x3d')](_0xced136[_0xa190('0x33')][_0xa190('0x3d')]);_0x4b9cec['where']=qs[_0xa190('0x35')](_[_0xa190('0x3f')](_0xced136[_0xa190('0x33')],_0x4524dd[_0xa190('0x35')]));if(_0xced136[_0xa190('0x33')]['filter']){_0x4b9cec[_0xa190('0x3e')]=_[_0xa190('0x41')](_0x4b9cec['where'],{'$or':_[_0xa190('0x2c')](_0x4b9cec[_0xa190('0x38')],function(_0x127f5c){var _0x87a5c2={};_0x87a5c2[_0x127f5c]={'$like':'%'+_0xced136['query'][_0xa190('0x40')]+'%'};return _0x87a5c2;})});}_0x4b9cec=_[_0xa190('0x41')]({},_0x4b9cec,_0xced136[_0xa190('0x43')]);return _0x847da[_0xa190('0x50')](_0x4b9cec);}})['then'](function(_0x202e80){if(_0x202e80){_0x33abe7=_0x202e80[_0xa190('0x39')];if(!_0xced136[_0xa190('0x33')][_0xa190('0x3a')](_0xa190('0x3b'))){_0x4b9cec[_0xa190('0x20')]=qs[_0xa190('0x20')](_0xced136['query']['limit']);_0x4b9cec['offset']=qs[_0xa190('0x1e')](_0xced136[_0xa190('0x33')][_0xa190('0x1e')]);}return _0x847da[_0xa190('0x50')](_0x4b9cec);}})[_0xa190('0x27')](function(_0x4979e0){if(_0x4979e0){return _0x4979e0?{'count':_0x33abe7,'rows':_0x4979e0}:null;}})[_0xa190('0x27')](respondWithResult(_0x490d9,null))['catch'](handleError(_0x490d9,null));};exports[_0xa190('0x52')]=function(_0x4b78fd,_0xa35471,_0x15718b){var _0x9ad7c1={};var _0x50a2ee={};var _0x3525cf;var _0x1be0a5;return db[_0xa190('0x2d')][_0xa190('0x51')]({'where':{'id':_0x4b78fd[_0xa190('0x49')]['id']}})[_0xa190('0x27')](handleEntityNotFound(_0xa35471,null))[_0xa190('0x27')](function(_0x180575){if(_0x180575){_0x3525cf=_0x180575;_0x50a2ee[_0xa190('0x32')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x50a2ee[_0xa190('0x33')]=_[_0xa190('0x34')](_0x4b78fd[_0xa190('0x33')]);_0x50a2ee[_0xa190('0x35')]=_[_0xa190('0x36')](_0x50a2ee[_0xa190('0x32')],_0x50a2ee[_0xa190('0x33')]);_0x9ad7c1['attributes']=_[_0xa190('0x36')](_0x50a2ee['model'],qs[_0xa190('0x37')](_0x4b78fd[_0xa190('0x33')][_0xa190('0x37')]));_0x9ad7c1[_0xa190('0x38')]=_0x9ad7c1[_0xa190('0x38')][_0xa190('0x39')]?_0x9ad7c1[_0xa190('0x38')]:_0x50a2ee[_0xa190('0x32')];_0x9ad7c1[_0xa190('0x3c')]=qs[_0xa190('0x3d')](_0x4b78fd[_0xa190('0x33')][_0xa190('0x3d')]);_0x9ad7c1['where']=qs['filters'](_[_0xa190('0x3f')](_0x4b78fd[_0xa190('0x33')],_0x50a2ee['filters']));if(_0x4b78fd[_0xa190('0x33')][_0xa190('0x40')]){_0x9ad7c1[_0xa190('0x3e')]=_[_0xa190('0x41')](_0x9ad7c1['where'],{'$or':_['map'](_0x9ad7c1['attributes'],function(_0x2ac06e){var _0x22b99f={};_0x22b99f[_0x2ac06e]={'$like':'%'+_0x4b78fd[_0xa190('0x33')]['filter']+'%'};return _0x22b99f;})});}_0x9ad7c1=_[_0xa190('0x41')]({},_0x9ad7c1,_0x4b78fd[_0xa190('0x43')]);return _0x3525cf['getDescriptions'](_0x9ad7c1);}})['then'](function(_0x3a4668){if(_0x3a4668){_0x1be0a5=_0x3a4668[_0xa190('0x39')];if(!_0x4b78fd[_0xa190('0x33')][_0xa190('0x3a')](_0xa190('0x3b'))){_0x9ad7c1[_0xa190('0x20')]=qs[_0xa190('0x20')](_0x4b78fd[_0xa190('0x33')]['limit']);_0x9ad7c1[_0xa190('0x1e')]=qs[_0xa190('0x1e')](_0x4b78fd[_0xa190('0x33')][_0xa190('0x1e')]);}return _0x3525cf[_0xa190('0x52')](_0x9ad7c1);}})[_0xa190('0x27')](function(_0x1aeb29){if(_0x1aeb29){return _0x1aeb29?{'count':_0x1be0a5,'rows':_0x1aeb29}:null;}})[_0xa190('0x27')](respondWithResult(_0xa35471,null))['catch'](handleError(_0xa35471,null));};exports[_0xa190('0x53')]=function(_0x337266,_0x4f4cae,_0x4d23f7){var _0x2c9928={};var _0x32a8fe={};var _0x5aa8f3;var _0x49aa58;return db['ZendeskConfiguration'][_0xa190('0x51')]({'where':{'id':_0x337266[_0xa190('0x49')]['id']}})[_0xa190('0x27')](handleEntityNotFound(_0x4f4cae,null))[_0xa190('0x27')](function(_0x567a4b){if(_0x567a4b){_0x5aa8f3=_0x567a4b;_0x32a8fe[_0xa190('0x32')]=_['keys'](db[_0xa190('0x54')][_0xa190('0x2e')]);_0x32a8fe[_0xa190('0x33')]=_[_0xa190('0x34')](_0x337266['query']);_0x32a8fe[_0xa190('0x35')]=_['intersection'](_0x32a8fe[_0xa190('0x32')],_0x32a8fe[_0xa190('0x33')]);_0x2c9928[_0xa190('0x38')]=_[_0xa190('0x36')](_0x32a8fe['model'],qs[_0xa190('0x37')](_0x337266[_0xa190('0x33')][_0xa190('0x37')]));_0x2c9928['attributes']=_0x2c9928[_0xa190('0x38')][_0xa190('0x39')]?_0x2c9928[_0xa190('0x38')]:_0x32a8fe[_0xa190('0x32')];_0x2c9928[_0xa190('0x3c')]=qs[_0xa190('0x3d')](_0x337266[_0xa190('0x33')][_0xa190('0x3d')]);_0x2c9928[_0xa190('0x3e')]=qs[_0xa190('0x35')](_[_0xa190('0x3f')](_0x337266[_0xa190('0x33')],_0x32a8fe[_0xa190('0x35')]));if(_0x337266[_0xa190('0x33')][_0xa190('0x40')]){_0x2c9928[_0xa190('0x3e')]=_[_0xa190('0x41')](_0x2c9928['where'],{'$or':_['map'](_0x2c9928[_0xa190('0x38')],function(_0x27e5ee){var _0x3053ee={};_0x3053ee[_0x27e5ee]={'$like':'%'+_0x337266[_0xa190('0x33')][_0xa190('0x40')]+'%'};return _0x3053ee;})});}_0x2c9928=_[_0xa190('0x41')]({},_0x2c9928,_0x337266['options']);return _0x5aa8f3[_0xa190('0x53')](_0x2c9928);}})['then'](function(_0x10dd80){if(_0x10dd80){_0x49aa58=_0x10dd80[_0xa190('0x39')];if(!_0x337266[_0xa190('0x33')][_0xa190('0x3a')](_0xa190('0x3b'))){_0x2c9928['limit']=qs[_0xa190('0x20')](_0x337266[_0xa190('0x33')]['limit']);_0x2c9928[_0xa190('0x1e')]=qs[_0xa190('0x1e')](_0x337266[_0xa190('0x33')][_0xa190('0x1e')]);}return _0x5aa8f3[_0xa190('0x53')](_0x2c9928);}})[_0xa190('0x27')](function(_0x51f1e1){if(_0x51f1e1){return _0x51f1e1?{'count':_0x49aa58,'rows':_0x51f1e1}:null;}})[_0xa190('0x27')](respondWithResult(_0x4f4cae,null))['catch'](handleError(_0x4f4cae,null));};exports[_0xa190('0x55')]=function(_0x188dfa,_0x50be4f,_0x5a0ca8){if(_0x188dfa[_0xa190('0x4b')]['id']){delete _0x188dfa[_0xa190('0x4b')]['id'];}return db[_0xa190('0x2d')][_0xa190('0x51')]({'where':{'id':_0x188dfa[_0xa190('0x49')]['id']}})['then'](handleEntityNotFound(_0x50be4f,null))['then'](function(_0x300b8c){if(_0x300b8c){return _0x300b8c[_0xa190('0x55')](_0x188dfa[_0xa190('0x4b')]['ids']||[]);}return null;})[_0xa190('0x27')](respondWithResult(_0x50be4f,null))['catch'](handleError(_0x50be4f,null));}; \ No newline at end of file +var _0x3d24=['params','find','create','body','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x28938f,_0x38e41c){var _0x2a3414=function(_0x23e500){while(--_0x23e500){_0x28938f['push'](_0x28938f['shift']());}};_0x2a3414(++_0x38e41c);}(_0x3d24,0x152));var _0x43d2=function(_0x33303f,_0x589962){_0x33303f=_0x33303f-0x0;var _0x455949=_0x3d24[_0x33303f];return _0x455949;};'use strict';var emlformat=require(_0x43d2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x43d2('0x1'));var rp=require(_0x43d2('0x2'));var moment=require(_0x43d2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x43d2('0x4'));var util=require(_0x43d2('0x5'));var path=require(_0x43d2('0x6'));var sox=require(_0x43d2('0x7'));var csv=require(_0x43d2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43d2('0x9'));var squel=require(_0x43d2('0xa'));var crypto=require(_0x43d2('0xb'));var jsforce=require(_0x43d2('0xc'));var deskjs=require(_0x43d2('0xd'));var toCsv=require(_0x43d2('0x8'));var querystring=require(_0x43d2('0xe'));var Papa=require('papaparse');var Redis=require(_0x43d2('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x43d2('0x10'));var hardwareService=require(_0x43d2('0x11'));var logger=require('../../config/logger')(_0x43d2('0x12'));var utils=require(_0x43d2('0x13'));var config=require(_0x43d2('0x14'));var licenseUtil=require(_0x43d2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x567191,_0x46f844){_0x46f844=_0x46f844||0xcc;return function(_0x21b15a){if(_0x21b15a){return _0x567191[_0x43d2('0x16')](_0x46f844);}return _0x567191[_0x43d2('0x17')](_0x46f844)[_0x43d2('0x18')]();};}function respondWithResult(_0x121bef,_0x136636){_0x136636=_0x136636||0xc8;return function(_0x7a1f3f){if(_0x7a1f3f){return _0x121bef[_0x43d2('0x17')](_0x136636)[_0x43d2('0x19')](_0x7a1f3f);}};}function respondWithFilteredResult(_0x8c0802,_0x457153){return function(_0x32bdce){if(_0x32bdce){var _0x1167f3=typeof _0x457153[_0x43d2('0x1a')]===_0x43d2('0x1b')&&typeof _0x457153[_0x43d2('0x1c')]==='undefined';var _0x16a1b2=_0x32bdce[_0x43d2('0x1d')];var _0x138c9a=_0x1167f3?0x0:_0x457153[_0x43d2('0x1a')];var _0x6d300b=_0x1167f3?_0x32bdce[_0x43d2('0x1d')]:_0x457153[_0x43d2('0x1a')]+_0x457153[_0x43d2('0x1c')];var _0x33f355;if(_0x6d300b>=_0x16a1b2){_0x6d300b=_0x16a1b2;_0x33f355=0xc8;}else{_0x33f355=0xce;}_0x8c0802[_0x43d2('0x17')](_0x33f355);return _0x8c0802[_0x43d2('0x1e')](_0x43d2('0x1f'),_0x138c9a+'-'+_0x6d300b+'/'+_0x16a1b2)[_0x43d2('0x19')](_0x32bdce);}return null;};}function patchUpdates(_0x38906b){return function(_0x3b0172){try{jsonpatch[_0x43d2('0x20')](_0x3b0172,_0x38906b,!![]);}catch(_0x401625){return BPromise[_0x43d2('0x21')](_0x401625);}return _0x3b0172[_0x43d2('0x22')]();};}function saveUpdates(_0x394f09,_0x154036){return function(_0x4a9dbe){if(_0x4a9dbe){return _0x4a9dbe[_0x43d2('0x23')](_0x394f09)['then'](function(_0x41f4e1){return _0x41f4e1;});}return null;};}function removeEntity(_0x5e929c,_0x4ab46d){return function(_0x5d3548){if(_0x5d3548){return _0x5d3548[_0x43d2('0x24')]()[_0x43d2('0x25')](function(){_0x5e929c[_0x43d2('0x17')](0xcc)[_0x43d2('0x18')]();});}};}function handleEntityNotFound(_0xb3be37,_0xbd4d2a){return function(_0x56e939){if(!_0x56e939){_0xb3be37[_0x43d2('0x16')](0x194);}return _0x56e939;};}function handleError(_0x184ba4,_0x13b0cc){_0x13b0cc=_0x13b0cc||0x1f4;return function(_0x140e56){logger['error'](_0x140e56[_0x43d2('0x26')]);if(_0x140e56[_0x43d2('0x27')]){delete _0x140e56[_0x43d2('0x27')];}_0x184ba4[_0x43d2('0x17')](_0x13b0cc)['send'](_0x140e56);};}exports['index']=function(_0x583138,_0x40ae12){var _0x1316af={},_0xd0ff2={},_0xedf92a={'count':0x0,'rows':[]};var _0x557851=_[_0x43d2('0x28')](db[_0x43d2('0x29')][_0x43d2('0x2a')],function(_0x107a5d){return{'name':_0x107a5d[_0x43d2('0x2b')],'type':_0x107a5d[_0x43d2('0x2c')]['key']};});_0xd0ff2[_0x43d2('0x2d')]=_['map'](_0x557851,_0x43d2('0x27'));_0xd0ff2[_0x43d2('0x2e')]=_[_0x43d2('0x2f')](_0x583138[_0x43d2('0x2e')]);_0xd0ff2[_0x43d2('0x30')]=_[_0x43d2('0x31')](_0xd0ff2[_0x43d2('0x2d')],_0xd0ff2[_0x43d2('0x2e')]);_0x1316af[_0x43d2('0x32')]=_[_0x43d2('0x31')](_0xd0ff2['model'],qs[_0x43d2('0x33')](_0x583138[_0x43d2('0x2e')][_0x43d2('0x33')]));_0x1316af[_0x43d2('0x32')]=_0x1316af['attributes'][_0x43d2('0x34')]?_0x1316af['attributes']:_0xd0ff2['model'];if(!_0x583138['query'][_0x43d2('0x35')]('nolimit')){_0x1316af[_0x43d2('0x1c')]=qs[_0x43d2('0x1c')](_0x583138['query'][_0x43d2('0x1c')]);_0x1316af[_0x43d2('0x1a')]=qs['offset'](_0x583138[_0x43d2('0x2e')]['offset']);}_0x1316af[_0x43d2('0x36')]=qs[_0x43d2('0x37')](_0x583138[_0x43d2('0x2e')][_0x43d2('0x37')]);_0x1316af[_0x43d2('0x38')]=qs['filters'](_[_0x43d2('0x39')](_0x583138['query'],_0xd0ff2[_0x43d2('0x30')]),_0x557851);if(_0x583138[_0x43d2('0x2e')][_0x43d2('0x3a')]){_0x1316af[_0x43d2('0x38')]=_[_0x43d2('0x3b')](_0x1316af['where'],{'$or':_[_0x43d2('0x28')](_0x557851,function(_0x3c3bf6){if(_0x3c3bf6[_0x43d2('0x2c')]!==_0x43d2('0x3c')){var _0x47a89f={};_0x47a89f[_0x3c3bf6['name']]={'$like':'%'+_0x583138[_0x43d2('0x2e')][_0x43d2('0x3a')]+'%'};return _0x47a89f;}})});}_0x1316af=_[_0x43d2('0x3b')]({},_0x1316af,_0x583138[_0x43d2('0x3d')]);var _0x8473aa={'where':_0x1316af[_0x43d2('0x38')]};return db[_0x43d2('0x29')][_0x43d2('0x1d')](_0x8473aa)[_0x43d2('0x25')](function(_0x2f07cc){_0xedf92a['count']=_0x2f07cc;if(_0x583138['query'][_0x43d2('0x3e')]){_0x1316af[_0x43d2('0x3f')]=[{'all':!![]}];}return db[_0x43d2('0x29')][_0x43d2('0x40')](_0x1316af);})[_0x43d2('0x25')](function(_0x54188a){_0xedf92a[_0x43d2('0x41')]=_0x54188a;return _0xedf92a;})[_0x43d2('0x25')](respondWithFilteredResult(_0x40ae12,_0x1316af))[_0x43d2('0x42')](handleError(_0x40ae12,null));};exports['show']=function(_0x31b35c,_0x2a331c){var _0x56093b={'raw':![],'where':{'id':_0x31b35c[_0x43d2('0x43')]['id']}},_0x1d47b6={};_0x1d47b6[_0x43d2('0x2d')]=_[_0x43d2('0x2f')](db[_0x43d2('0x29')][_0x43d2('0x2a')]);_0x1d47b6[_0x43d2('0x2e')]=_[_0x43d2('0x2f')](_0x31b35c[_0x43d2('0x2e')]);_0x1d47b6[_0x43d2('0x30')]=_[_0x43d2('0x31')](_0x1d47b6['model'],_0x1d47b6[_0x43d2('0x2e')]);_0x56093b[_0x43d2('0x32')]=_[_0x43d2('0x31')](_0x1d47b6[_0x43d2('0x2d')],qs[_0x43d2('0x33')](_0x31b35c[_0x43d2('0x2e')]['fields']));_0x56093b[_0x43d2('0x32')]=_0x56093b[_0x43d2('0x32')][_0x43d2('0x34')]?_0x56093b[_0x43d2('0x32')]:_0x1d47b6['model'];if(_0x31b35c[_0x43d2('0x2e')][_0x43d2('0x3e')]){_0x56093b[_0x43d2('0x3f')]=[{'all':!![]}];}_0x56093b=_[_0x43d2('0x3b')]({},_0x56093b,_0x31b35c[_0x43d2('0x3d')]);return db[_0x43d2('0x29')][_0x43d2('0x44')](_0x56093b)[_0x43d2('0x25')](handleEntityNotFound(_0x2a331c,null))[_0x43d2('0x25')](respondWithResult(_0x2a331c,null))[_0x43d2('0x42')](handleError(_0x2a331c,null));};exports['create']=function(_0x4c2d05,_0x41d307){return db[_0x43d2('0x29')][_0x43d2('0x45')](_0x4c2d05['body'],{})[_0x43d2('0x25')](respondWithResult(_0x41d307,0xc9))['catch'](handleError(_0x41d307,null));};exports[_0x43d2('0x23')]=function(_0x1e6598,_0x17f44d){if(_0x1e6598[_0x43d2('0x46')]['id']){delete _0x1e6598[_0x43d2('0x46')]['id'];}return db[_0x43d2('0x29')][_0x43d2('0x44')]({'where':{'id':_0x1e6598[_0x43d2('0x43')]['id']}})[_0x43d2('0x25')](handleEntityNotFound(_0x17f44d,null))[_0x43d2('0x25')](saveUpdates(_0x1e6598[_0x43d2('0x46')],null))[_0x43d2('0x25')](respondWithResult(_0x17f44d,null))[_0x43d2('0x42')](handleError(_0x17f44d,null));};exports[_0x43d2('0x24')]=function(_0x15bc62,_0x1c3081){return db[_0x43d2('0x29')]['find']({'where':{'id':_0x15bc62[_0x43d2('0x43')]['id']}})[_0x43d2('0x25')](handleEntityNotFound(_0x1c3081,null))[_0x43d2('0x25')](removeEntity(_0x1c3081,null))['catch'](handleError(_0x1c3081,null));};exports[_0x43d2('0x47')]=function(_0x306e86,_0x6ef10a,_0x159f16){var _0x43631f={};var _0xebaa55={};var _0x216c24;var _0xf53dee;return db[_0x43d2('0x29')][_0x43d2('0x48')]({'where':{'id':_0x306e86[_0x43d2('0x43')]['id']}})['then'](handleEntityNotFound(_0x6ef10a,null))[_0x43d2('0x25')](function(_0x51a2a3){if(_0x51a2a3){_0x216c24=_0x51a2a3;_0xebaa55[_0x43d2('0x2d')]=_[_0x43d2('0x2f')](db[_0x43d2('0x49')][_0x43d2('0x2a')]);_0xebaa55[_0x43d2('0x2e')]=_[_0x43d2('0x2f')](_0x306e86[_0x43d2('0x2e')]);_0xebaa55[_0x43d2('0x30')]=_['intersection'](_0xebaa55['model'],_0xebaa55[_0x43d2('0x2e')]);_0x43631f[_0x43d2('0x32')]=_[_0x43d2('0x31')](_0xebaa55[_0x43d2('0x2d')],qs[_0x43d2('0x33')](_0x306e86['query'][_0x43d2('0x33')]));_0x43631f[_0x43d2('0x32')]=_0x43631f[_0x43d2('0x32')]['length']?_0x43631f[_0x43d2('0x32')]:_0xebaa55[_0x43d2('0x2d')];_0x43631f[_0x43d2('0x36')]=qs[_0x43d2('0x37')](_0x306e86['query'][_0x43d2('0x37')]);_0x43631f['where']=qs[_0x43d2('0x30')](_[_0x43d2('0x39')](_0x306e86[_0x43d2('0x2e')],_0xebaa55[_0x43d2('0x30')]));if(_0x306e86[_0x43d2('0x2e')][_0x43d2('0x3a')]){_0x43631f['where']=_['merge'](_0x43631f[_0x43d2('0x38')],{'$or':_[_0x43d2('0x28')](_0x43631f[_0x43d2('0x32')],function(_0x442a2f){var _0x46cbeb={};_0x46cbeb[_0x442a2f]={'$like':'%'+_0x306e86['query'][_0x43d2('0x3a')]+'%'};return _0x46cbeb;})});}_0x43631f=_[_0x43d2('0x3b')]({},_0x43631f,_0x306e86[_0x43d2('0x3d')]);return _0x216c24[_0x43d2('0x47')](_0x43631f);}})['then'](function(_0x5b0a01){if(_0x5b0a01){_0xf53dee=_0x5b0a01[_0x43d2('0x34')];if(!_0x306e86[_0x43d2('0x2e')][_0x43d2('0x35')](_0x43d2('0x4a'))){_0x43631f[_0x43d2('0x1c')]=qs[_0x43d2('0x1c')](_0x306e86[_0x43d2('0x2e')][_0x43d2('0x1c')]);_0x43631f[_0x43d2('0x1a')]=qs[_0x43d2('0x1a')](_0x306e86['query'][_0x43d2('0x1a')]);}return _0x216c24[_0x43d2('0x47')](_0x43631f);}})[_0x43d2('0x25')](function(_0x54074f){if(_0x54074f){return _0x54074f?{'count':_0xf53dee,'rows':_0x54074f}:null;}})[_0x43d2('0x25')](respondWithResult(_0x6ef10a,null))[_0x43d2('0x42')](handleError(_0x6ef10a,null));};exports['getSubjects']=function(_0x14fdf3,_0x2dacc9,_0x219b58){var _0x2ef0e0={};var _0x12fb91={};var _0x56d380;var _0x16ad9f;return db[_0x43d2('0x29')][_0x43d2('0x48')]({'where':{'id':_0x14fdf3[_0x43d2('0x43')]['id']}})['then'](handleEntityNotFound(_0x2dacc9,null))['then'](function(_0x5e8b60){if(_0x5e8b60){_0x56d380=_0x5e8b60;_0x12fb91['model']=_[_0x43d2('0x2f')](db[_0x43d2('0x49')][_0x43d2('0x2a')]);_0x12fb91['query']=_[_0x43d2('0x2f')](_0x14fdf3['query']);_0x12fb91[_0x43d2('0x30')]=_[_0x43d2('0x31')](_0x12fb91[_0x43d2('0x2d')],_0x12fb91[_0x43d2('0x2e')]);_0x2ef0e0[_0x43d2('0x32')]=_[_0x43d2('0x31')](_0x12fb91[_0x43d2('0x2d')],qs[_0x43d2('0x33')](_0x14fdf3[_0x43d2('0x2e')][_0x43d2('0x33')]));_0x2ef0e0[_0x43d2('0x32')]=_0x2ef0e0[_0x43d2('0x32')][_0x43d2('0x34')]?_0x2ef0e0['attributes']:_0x12fb91[_0x43d2('0x2d')];_0x2ef0e0['order']=qs[_0x43d2('0x37')](_0x14fdf3[_0x43d2('0x2e')][_0x43d2('0x37')]);_0x2ef0e0['where']=qs[_0x43d2('0x30')](_[_0x43d2('0x39')](_0x14fdf3[_0x43d2('0x2e')],_0x12fb91[_0x43d2('0x30')]));if(_0x14fdf3[_0x43d2('0x2e')][_0x43d2('0x3a')]){_0x2ef0e0[_0x43d2('0x38')]=_[_0x43d2('0x3b')](_0x2ef0e0[_0x43d2('0x38')],{'$or':_[_0x43d2('0x28')](_0x2ef0e0[_0x43d2('0x32')],function(_0x222416){var _0x471358={};_0x471358[_0x222416]={'$like':'%'+_0x14fdf3['query'][_0x43d2('0x3a')]+'%'};return _0x471358;})});}_0x2ef0e0=_[_0x43d2('0x3b')]({},_0x2ef0e0,_0x14fdf3['options']);return _0x56d380[_0x43d2('0x4b')](_0x2ef0e0);}})[_0x43d2('0x25')](function(_0x112124){if(_0x112124){_0x16ad9f=_0x112124[_0x43d2('0x34')];if(!_0x14fdf3[_0x43d2('0x2e')]['hasOwnProperty']('nolimit')){_0x2ef0e0[_0x43d2('0x1c')]=qs[_0x43d2('0x1c')](_0x14fdf3['query']['limit']);_0x2ef0e0[_0x43d2('0x1a')]=qs[_0x43d2('0x1a')](_0x14fdf3[_0x43d2('0x2e')][_0x43d2('0x1a')]);}return _0x56d380[_0x43d2('0x4b')](_0x2ef0e0);}})[_0x43d2('0x25')](function(_0x567f9f){if(_0x567f9f){return _0x567f9f?{'count':_0x16ad9f,'rows':_0x567f9f}:null;}})[_0x43d2('0x25')](respondWithResult(_0x2dacc9,null))['catch'](handleError(_0x2dacc9,null));};exports[_0x43d2('0x4c')]=function(_0x448687,_0x589b73,_0x523129){var _0x4aa570={};var _0x56513a={};var _0x13f082;var _0x3ae59e;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x448687['params']['id']}})[_0x43d2('0x25')](handleEntityNotFound(_0x589b73,null))['then'](function(_0x23334f){if(_0x23334f){_0x13f082=_0x23334f;_0x56513a[_0x43d2('0x2d')]=_['keys'](db[_0x43d2('0x49')][_0x43d2('0x2a')]);_0x56513a[_0x43d2('0x2e')]=_['keys'](_0x448687['query']);_0x56513a[_0x43d2('0x30')]=_[_0x43d2('0x31')](_0x56513a[_0x43d2('0x2d')],_0x56513a[_0x43d2('0x2e')]);_0x4aa570['attributes']=_[_0x43d2('0x31')](_0x56513a['model'],qs[_0x43d2('0x33')](_0x448687[_0x43d2('0x2e')][_0x43d2('0x33')]));_0x4aa570[_0x43d2('0x32')]=_0x4aa570[_0x43d2('0x32')]['length']?_0x4aa570['attributes']:_0x56513a[_0x43d2('0x2d')];_0x4aa570[_0x43d2('0x36')]=qs[_0x43d2('0x37')](_0x448687[_0x43d2('0x2e')]['sort']);_0x4aa570[_0x43d2('0x38')]=qs[_0x43d2('0x30')](_[_0x43d2('0x39')](_0x448687[_0x43d2('0x2e')],_0x56513a[_0x43d2('0x30')]));if(_0x448687[_0x43d2('0x2e')][_0x43d2('0x3a')]){_0x4aa570['where']=_[_0x43d2('0x3b')](_0x4aa570['where'],{'$or':_[_0x43d2('0x28')](_0x4aa570[_0x43d2('0x32')],function(_0x11125a){var _0x2627af={};_0x2627af[_0x11125a]={'$like':'%'+_0x448687[_0x43d2('0x2e')]['filter']+'%'};return _0x2627af;})});}_0x4aa570=_[_0x43d2('0x3b')]({},_0x4aa570,_0x448687[_0x43d2('0x3d')]);return _0x13f082['getDescriptions'](_0x4aa570);}})[_0x43d2('0x25')](function(_0x42cfc3){if(_0x42cfc3){_0x3ae59e=_0x42cfc3[_0x43d2('0x34')];if(!_0x448687[_0x43d2('0x2e')]['hasOwnProperty'](_0x43d2('0x4a'))){_0x4aa570[_0x43d2('0x1c')]=qs['limit'](_0x448687[_0x43d2('0x2e')][_0x43d2('0x1c')]);_0x4aa570[_0x43d2('0x1a')]=qs[_0x43d2('0x1a')](_0x448687['query']['offset']);}return _0x13f082[_0x43d2('0x4c')](_0x4aa570);}})[_0x43d2('0x25')](function(_0x1e769e){if(_0x1e769e){return _0x1e769e?{'count':_0x3ae59e,'rows':_0x1e769e}:null;}})[_0x43d2('0x25')](respondWithResult(_0x589b73,null))[_0x43d2('0x42')](handleError(_0x589b73,null));};exports['getTags']=function(_0x2430e7,_0x50c8bd,_0xde5d41){var _0xc495ed={};var _0x31ed8c={};var _0x1589b2;var _0x1be3d6;return db['ZendeskConfiguration'][_0x43d2('0x48')]({'where':{'id':_0x2430e7[_0x43d2('0x43')]['id']}})[_0x43d2('0x25')](handleEntityNotFound(_0x50c8bd,null))['then'](function(_0x377e85){if(_0x377e85){_0x1589b2=_0x377e85;_0x31ed8c['model']=_[_0x43d2('0x2f')](db[_0x43d2('0x4d')][_0x43d2('0x2a')]);_0x31ed8c[_0x43d2('0x2e')]=_['keys'](_0x2430e7[_0x43d2('0x2e')]);_0x31ed8c[_0x43d2('0x30')]=_[_0x43d2('0x31')](_0x31ed8c[_0x43d2('0x2d')],_0x31ed8c['query']);_0xc495ed[_0x43d2('0x32')]=_[_0x43d2('0x31')](_0x31ed8c[_0x43d2('0x2d')],qs['fields'](_0x2430e7['query'][_0x43d2('0x33')]));_0xc495ed[_0x43d2('0x32')]=_0xc495ed[_0x43d2('0x32')][_0x43d2('0x34')]?_0xc495ed[_0x43d2('0x32')]:_0x31ed8c['model'];_0xc495ed[_0x43d2('0x36')]=qs['sort'](_0x2430e7[_0x43d2('0x2e')][_0x43d2('0x37')]);_0xc495ed[_0x43d2('0x38')]=qs[_0x43d2('0x30')](_['pick'](_0x2430e7[_0x43d2('0x2e')],_0x31ed8c[_0x43d2('0x30')]));if(_0x2430e7['query'][_0x43d2('0x3a')]){_0xc495ed[_0x43d2('0x38')]=_[_0x43d2('0x3b')](_0xc495ed['where'],{'$or':_[_0x43d2('0x28')](_0xc495ed['attributes'],function(_0x363997){var _0x46253d={};_0x46253d[_0x363997]={'$like':'%'+_0x2430e7[_0x43d2('0x2e')][_0x43d2('0x3a')]+'%'};return _0x46253d;})});}_0xc495ed=_[_0x43d2('0x3b')]({},_0xc495ed,_0x2430e7[_0x43d2('0x3d')]);return _0x1589b2[_0x43d2('0x4e')](_0xc495ed);}})[_0x43d2('0x25')](function(_0x52dbcf){if(_0x52dbcf){_0x1be3d6=_0x52dbcf[_0x43d2('0x34')];if(!_0x2430e7['query'][_0x43d2('0x35')](_0x43d2('0x4a'))){_0xc495ed[_0x43d2('0x1c')]=qs[_0x43d2('0x1c')](_0x2430e7['query'][_0x43d2('0x1c')]);_0xc495ed[_0x43d2('0x1a')]=qs[_0x43d2('0x1a')](_0x2430e7[_0x43d2('0x2e')][_0x43d2('0x1a')]);}return _0x1589b2[_0x43d2('0x4e')](_0xc495ed);}})['then'](function(_0xc03455){if(_0xc03455){return _0xc03455?{'count':_0x1be3d6,'rows':_0xc03455}:null;}})['then'](respondWithResult(_0x50c8bd,null))[_0x43d2('0x42')](handleError(_0x50c8bd,null));};exports[_0x43d2('0x4f')]=function(_0x1e048b,_0x2106df,_0x4b52a3){if(_0x1e048b['body']['id']){delete _0x1e048b[_0x43d2('0x46')]['id'];}return db[_0x43d2('0x29')]['findOne']({'where':{'id':_0x1e048b[_0x43d2('0x43')]['id']}})[_0x43d2('0x25')](handleEntityNotFound(_0x2106df,null))[_0x43d2('0x25')](function(_0x2c52d6){if(_0x2c52d6){return _0x2c52d6[_0x43d2('0x4f')](_0x1e048b[_0x43d2('0x46')][_0x43d2('0x50')]||[]);}return null;})[_0x43d2('0x25')](respondWithResult(_0x2106df,null))[_0x43d2('0x42')](handleError(_0x2106df,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 2d81b26..e9cecd6 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 _0xfff0=['./intZendeskConfiguration.attributes','define','int_zendesk_configurations','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xfff0,0x139));var _0x0fff=function(_0x22b4fe,_0x28201c){_0x22b4fe=_0x22b4fe-0x0;var _0x1141af=_0xfff0[_0x22b4fe];return _0x1141af;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var logger=require(_0x0fff('0x1'))(_0x0fff('0x2'));var moment=require('moment');var BPromise=require(_0x0fff('0x3'));var rp=require(_0x0fff('0x4'));var fs=require('fs');var path=require(_0x0fff('0x5'));var rimraf=require('rimraf');var config=require(_0x0fff('0x6'));var attributes=require(_0x0fff('0x7'));module['exports']=function(_0x33c813,_0x4c2221){return _0x33c813[_0x0fff('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x0fff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x896e=['request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3528d8,_0x2e900c){var _0x61c45b=function(_0x3d5a37){while(--_0x3d5a37){_0x3528d8['push'](_0x3528d8['shift']());}};_0x61c45b(++_0x2e900c);}(_0x896e,0x1e9));var _0xe896=function(_0x232157,_0x4e7827){_0x232157=_0x232157-0x0;var _0x33eaa7=_0x896e[_0x232157];return _0x33eaa7;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var logger=require(_0xe896('0x2'))(_0xe896('0x3'));var moment=require(_0xe896('0x4'));var BPromise=require(_0xe896('0x5'));var rp=require(_0xe896('0x6'));var fs=require('fs');var path=require(_0xe896('0x7'));var rimraf=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var attributes=require(_0xe896('0xa'));module[_0xe896('0xb')]=function(_0x52ac80,_0x24c430){return _0x52ac80[_0xe896('0xc')](_0xe896('0xd'),attributes,{'tableName':_0xe896('0xe'),'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 bb70de5..69c4bc0 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 _0xe5e1=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','request\x20sent'];(function(_0x74fd69,_0x12027d){var _0x14cca1=function(_0x270f2f){while(--_0x270f2f){_0x74fd69['push'](_0x74fd69['shift']());}};_0x14cca1(++_0x12027d);}(_0xe5e1,0x158));var _0x1e5e=function(_0x487849,_0x55d05e){_0x487849=_0x487849-0x0;var _0xd3a665=_0xe5e1[_0x487849];return _0xd3a665;};'use strict';var _=require(_0x1e5e('0x0'));var util=require(_0x1e5e('0x1'));var moment=require(_0x1e5e('0x2'));var BPromise=require(_0x1e5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e5e('0x4'));var db=require(_0x1e5e('0x5'))['db'];var utils=require(_0x1e5e('0x6'));var logger=require(_0x1e5e('0x7'))(_0x1e5e('0x8'));var config=require(_0x1e5e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e5e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14b94e,_0x499855,_0x55c971){return new BPromise(function(_0x5bcd0e,_0x46846f){return client['request'](_0x14b94e,_0x55c971)['then'](function(_0x4be2f8){logger[_0x1e5e('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x499855,_0x1e5e('0xc'));logger[_0x1e5e('0xd')](_0x1e5e('0xe'),_0x499855,'request\x20sent',JSON['stringify'](_0x4be2f8));if(_0x4be2f8[_0x1e5e('0xf')]){if(_0x4be2f8[_0x1e5e('0xf')][_0x1e5e('0x10')]===0x1f4){logger[_0x1e5e('0xf')](_0x1e5e('0x11'),_0x499855,_0x4be2f8[_0x1e5e('0xf')][_0x1e5e('0x12')]);return _0x46846f(_0x4be2f8[_0x1e5e('0xf')][_0x1e5e('0x12')]);}logger[_0x1e5e('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x499855,_0x4be2f8[_0x1e5e('0xf')]['message']);return _0x5bcd0e(_0x4be2f8[_0x1e5e('0xf')]['message']);}else{logger[_0x1e5e('0xb')](_0x1e5e('0x11'),_0x499855,_0x1e5e('0xc'));_0x5bcd0e(_0x4be2f8[_0x1e5e('0x13')]['message']);}})[_0x1e5e('0x14')](function(_0x193f89){logger[_0x1e5e('0xf')](_0x1e5e('0x11'),_0x499855,_0x193f89);_0x46846f(_0x193f89);});});} \ No newline at end of file +var _0xc7a1=['../../config/utils','rpc','../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xc7a1,0xa1));var _0x1c7a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc7a1[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x1c7a('0x0'));var util=require(_0x1c7a('0x1'));var moment=require(_0x1c7a('0x2'));var BPromise=require(_0x1c7a('0x3'));var rs=require(_0x1c7a('0x4'));var fs=require('fs');var Redis=require(_0x1c7a('0x5'));var db=require(_0x1c7a('0x6'))['db'];var utils=require(_0x1c7a('0x7'));var logger=require('../../config/logger')(_0x1c7a('0x8'));var config=require(_0x1c7a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1c7a('0xa')][_0x1c7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f4474,_0x54c121,_0x2e57d1){return new BPromise(function(_0x352964,_0x39f2ed){return client[_0x1c7a('0xc')](_0x3f4474,_0x2e57d1)[_0x1c7a('0xd')](function(_0x3d6857){logger[_0x1c7a('0xe')](_0x1c7a('0xf'),_0x54c121,'request\x20sent');logger[_0x1c7a('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x54c121,_0x1c7a('0x11'),JSON[_0x1c7a('0x12')](_0x3d6857));if(_0x3d6857[_0x1c7a('0x13')]){if(_0x3d6857[_0x1c7a('0x13')][_0x1c7a('0x14')]===0x1f4){logger[_0x1c7a('0x13')](_0x1c7a('0xf'),_0x54c121,_0x3d6857[_0x1c7a('0x13')][_0x1c7a('0x15')]);return _0x39f2ed(_0x3d6857[_0x1c7a('0x13')][_0x1c7a('0x15')]);}logger[_0x1c7a('0x13')](_0x1c7a('0xf'),_0x54c121,_0x3d6857['error'][_0x1c7a('0x15')]);return _0x352964(_0x3d6857['error'][_0x1c7a('0x15')]);}else{logger[_0x1c7a('0xe')](_0x1c7a('0xf'),_0x54c121,_0x1c7a('0x11'));_0x352964(_0x3d6857[_0x1c7a('0x16')]['message']);}})[_0x1c7a('0x17')](function(_0x49449c){logger[_0x1c7a('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x54c121,_0x49449c);_0x39f2ed(_0x49449c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index cae1e82..8d03a48 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 _0x2251=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','put','update','/:id'];(function(_0x3b4b6a,_0x2070fe){var _0x595086=function(_0x196c7a){while(--_0x196c7a){_0x3b4b6a['push'](_0x3b4b6a['shift']());}};_0x595086(++_0x2070fe);}(_0x2251,0x66));var _0x1225=function(_0x37b646,_0x4f34e9){_0x37b646=_0x37b646-0x0;var _0x6deef3=_0x2251[_0x37b646];return _0x6deef3;};'use strict';var multer=require(_0x1225('0x0'));var util=require(_0x1225('0x1'));var path=require(_0x1225('0x2'));var timeout=require(_0x1225('0x3'));var express=require(_0x1225('0x4'));var router=express[_0x1225('0x5')]();var fs_extra=require(_0x1225('0x6'));var auth=require(_0x1225('0x7'));var interaction=require(_0x1225('0x8'));var config=require(_0x1225('0x9'));var controller=require('./intZendeskField.controller');router[_0x1225('0xa')]('/',auth[_0x1225('0xb')](),controller[_0x1225('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1225('0xd')]);router[_0x1225('0xe')]('/',auth[_0x1225('0xb')](),controller['create']);router[_0x1225('0xf')]('/:id',auth[_0x1225('0xb')](),controller[_0x1225('0x10')]);router['delete'](_0x1225('0x11'),auth[_0x1225('0xb')](),controller[_0x1225('0x12')]);module[_0x1225('0x13')]=router; \ No newline at end of file +var _0x89c3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x1a9e6e,_0x1cd59f){var _0x3751fb=function(_0x58211d){while(--_0x58211d){_0x1a9e6e['push'](_0x1a9e6e['shift']());}};_0x3751fb(++_0x1cd59f);}(_0x89c3,0x94));var _0x389c=function(_0x260fc0,_0x4c242e){_0x260fc0=_0x260fc0-0x0;var _0x3a72bc=_0x89c3[_0x260fc0];return _0x3a72bc;};'use strict';var multer=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var path=require(_0x389c('0x2'));var timeout=require(_0x389c('0x3'));var express=require(_0x389c('0x4'));var router=express[_0x389c('0x5')]();var fs_extra=require(_0x389c('0x6'));var auth=require(_0x389c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x389c('0x8'));var controller=require('./intZendeskField.controller');router[_0x389c('0x9')]('/',auth['isAuthenticated'](),controller[_0x389c('0xa')]);router['get'](_0x389c('0xb'),auth[_0x389c('0xc')](),controller[_0x389c('0xd')]);router[_0x389c('0xe')]('/',auth['isAuthenticated'](),controller[_0x389c('0xf')]);router[_0x389c('0x10')]('/:id',auth[_0x389c('0xc')](),controller[_0x389c('0x11')]);router['delete']('/:id',auth[_0x389c('0xc')](),controller[_0x389c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d5c6ceb..bee590e 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 _0xdbce=['BOOLEAN','sequelize','exports','string','variable','customVariable','picklist','STRING'];(function(_0x520a3f,_0x57eba7){var _0x189b9e=function(_0x43c8c2){while(--_0x43c8c2){_0x520a3f['push'](_0x520a3f['shift']());}};_0x189b9e(++_0x57eba7);}(_0xdbce,0xa1));var _0xedbc=function(_0x34fd5e,_0x5e35b2){_0x34fd5e=_0x34fd5e-0x0;var _0x3877b9=_0xdbce[_0x34fd5e];return _0x3877b9;};'use strict';var Sequelize=require(_0xedbc('0x0'));module[_0xedbc('0x1')]={'type':{'type':Sequelize['ENUM'](_0xedbc('0x2'),_0xedbc('0x3'),_0xedbc('0x4'),'keyValue',_0xedbc('0x5')),'defaultValue':_0xedbc('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xedbc('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xedbc('0x2'),'variable',_0xedbc('0x4'))},'keyContent':{'type':Sequelize[_0xedbc('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xedbc('0x6')]},'customField':{'type':Sequelize[_0xedbc('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xedbc('0x6')]}}; \ No newline at end of file +var _0x0d3e=['BOOLEAN','exports','ENUM','string','variable','customVariable','STRING'];(function(_0x43bfaf,_0x18aac8){var _0x495f56=function(_0x1cbf61){while(--_0x1cbf61){_0x43bfaf['push'](_0x43bfaf['shift']());}};_0x495f56(++_0x18aac8);}(_0x0d3e,0x12e));var _0xe0d3=function(_0x3e659f,_0x17abb3){_0x3e659f=_0x3e659f-0x0;var _0x32bc81=_0x0d3e[_0x3e659f];return _0x32bc81;};'use strict';var Sequelize=require('sequelize');module[_0xe0d3('0x0')]={'type':{'type':Sequelize[_0xe0d3('0x1')](_0xe0d3('0x2'),_0xe0d3('0x3'),_0xe0d3('0x4'),'keyValue','picklist'),'defaultValue':_0xe0d3('0x2')},'content':{'type':Sequelize[_0xe0d3('0x5')]},'key':{'type':Sequelize[_0xe0d3('0x5')]},'keyType':{'type':Sequelize[_0xe0d3('0x1')]('string','variable',_0xe0d3('0x4'))},'keyContent':{'type':Sequelize[_0xe0d3('0x5')]},'idField':{'type':Sequelize[_0xe0d3('0x5')]},'nameField':{'type':Sequelize[_0xe0d3('0x5')]},'customField':{'type':Sequelize[_0xe0d3('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe0d3('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 65719ea..8d60035 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 _0x43f5=['includeAll','include','findAll','show','params','rawAttributes','intersection','find','create','body','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','ZendeskField','fieldName','type','key','map','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','options'];(function(_0x201211,_0x2e2788){var _0x3641da=function(_0xfb58b4){while(--_0xfb58b4){_0x201211['push'](_0x201211['shift']());}};_0x3641da(++_0x2e2788);}(_0x43f5,0x9d));var _0x543f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x43f5[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x543f('0x0'));var rimraf=require(_0x543f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x543f('0x2'));var rp=require(_0x543f('0x3'));var moment=require(_0x543f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x543f('0x5'));var util=require(_0x543f('0x6'));var path=require(_0x543f('0x7'));var sox=require(_0x543f('0x8'));var csv=require(_0x543f('0x9'));var ejs=require(_0x543f('0xa'));var fs=require('fs');var fs_extra=require(_0x543f('0xb'));var _=require(_0x543f('0xc'));var squel=require('squel');var crypto=require(_0x543f('0xd'));var jsforce=require(_0x543f('0xe'));var deskjs=require(_0x543f('0xf'));var toCsv=require(_0x543f('0x9'));var querystring=require(_0x543f('0x10'));var Papa=require('papaparse');var Redis=require(_0x543f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x543f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x543f('0x13'));var utils=require(_0x543f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2df78b,_0x7cd9de){_0x7cd9de=_0x7cd9de||0xcc;return function(_0x3e9d1b){if(_0x3e9d1b){return _0x2df78b['sendStatus'](_0x7cd9de);}return _0x2df78b[_0x543f('0x15')](_0x7cd9de)[_0x543f('0x16')]();};}function respondWithResult(_0x1eb1c,_0x4b7ffb){_0x4b7ffb=_0x4b7ffb||0xc8;return function(_0x2fadd7){if(_0x2fadd7){return _0x1eb1c[_0x543f('0x15')](_0x4b7ffb)['json'](_0x2fadd7);}};}function respondWithFilteredResult(_0x59cf7e,_0xe6c6d1){return function(_0x5e879d){if(_0x5e879d){var _0x17b54c=typeof _0xe6c6d1[_0x543f('0x17')]===_0x543f('0x18')&&typeof _0xe6c6d1[_0x543f('0x19')]==='undefined';var _0x7a522d=_0x5e879d[_0x543f('0x1a')];var _0x212219=_0x17b54c?0x0:_0xe6c6d1[_0x543f('0x17')];var _0x3264bd=_0x17b54c?_0x5e879d[_0x543f('0x1a')]:_0xe6c6d1['offset']+_0xe6c6d1['limit'];var _0xbe5034;if(_0x3264bd>=_0x7a522d){_0x3264bd=_0x7a522d;_0xbe5034=0xc8;}else{_0xbe5034=0xce;}_0x59cf7e[_0x543f('0x15')](_0xbe5034);return _0x59cf7e[_0x543f('0x1b')](_0x543f('0x1c'),_0x212219+'-'+_0x3264bd+'/'+_0x7a522d)[_0x543f('0x1d')](_0x5e879d);}return null;};}function patchUpdates(_0x5ae65b){return function(_0xc39bce){try{jsonpatch[_0x543f('0x1e')](_0xc39bce,_0x5ae65b,!![]);}catch(_0xab996e){return BPromise['reject'](_0xab996e);}return _0xc39bce[_0x543f('0x1f')]();};}function saveUpdates(_0x18fbaf,_0xd3a0a1){return function(_0x4fa1cc){if(_0x4fa1cc){return _0x4fa1cc[_0x543f('0x20')](_0x18fbaf)['then'](function(_0x3961f8){return _0x3961f8;});}return null;};}function removeEntity(_0x49701c,_0x3914d3){return function(_0x5a9bc1){if(_0x5a9bc1){return _0x5a9bc1[_0x543f('0x21')]()[_0x543f('0x22')](function(){_0x49701c[_0x543f('0x15')](0xcc)[_0x543f('0x16')]();});}};}function handleEntityNotFound(_0x2827a3,_0x1a1b51){return function(_0x3c2108){if(!_0x3c2108){_0x2827a3[_0x543f('0x23')](0x194);}return _0x3c2108;};}function handleError(_0x1de959,_0x17b22b){_0x17b22b=_0x17b22b||0x1f4;return function(_0x2c22c8){logger[_0x543f('0x24')](_0x2c22c8[_0x543f('0x25')]);if(_0x2c22c8['name']){delete _0x2c22c8[_0x543f('0x26')];}_0x1de959[_0x543f('0x15')](_0x17b22b)[_0x543f('0x27')](_0x2c22c8);};}exports[_0x543f('0x28')]=function(_0x1c0495,_0x7f9c7b){var _0x1b31e6={},_0x5773cc={},_0x82694d={'count':0x0,'rows':[]};var _0x40412f=_['map'](db[_0x543f('0x29')]['rawAttributes'],function(_0x5ede7b){return{'name':_0x5ede7b[_0x543f('0x2a')],'type':_0x5ede7b[_0x543f('0x2b')][_0x543f('0x2c')]};});_0x5773cc['model']=_[_0x543f('0x2d')](_0x40412f,_0x543f('0x26'));_0x5773cc[_0x543f('0x2e')]=_[_0x543f('0x2f')](_0x1c0495[_0x543f('0x2e')]);_0x5773cc['filters']=_['intersection'](_0x5773cc[_0x543f('0x30')],_0x5773cc['query']);_0x1b31e6[_0x543f('0x31')]=_['intersection'](_0x5773cc[_0x543f('0x30')],qs['fields'](_0x1c0495[_0x543f('0x2e')][_0x543f('0x32')]));_0x1b31e6[_0x543f('0x31')]=_0x1b31e6['attributes'][_0x543f('0x33')]?_0x1b31e6['attributes']:_0x5773cc[_0x543f('0x30')];if(!_0x1c0495[_0x543f('0x2e')][_0x543f('0x34')](_0x543f('0x35'))){_0x1b31e6[_0x543f('0x19')]=qs[_0x543f('0x19')](_0x1c0495[_0x543f('0x2e')][_0x543f('0x19')]);_0x1b31e6[_0x543f('0x17')]=qs['offset'](_0x1c0495[_0x543f('0x2e')]['offset']);}_0x1b31e6[_0x543f('0x36')]=qs[_0x543f('0x37')](_0x1c0495[_0x543f('0x2e')]['sort']);_0x1b31e6['where']=qs['filters'](_[_0x543f('0x38')](_0x1c0495[_0x543f('0x2e')],_0x5773cc[_0x543f('0x39')]),_0x40412f);if(_0x1c0495[_0x543f('0x2e')]['filter']){_0x1b31e6[_0x543f('0x3a')]=_[_0x543f('0x3b')](_0x1b31e6[_0x543f('0x3a')],{'$or':_[_0x543f('0x2d')](_0x40412f,function(_0x458609){if(_0x458609['type']!==_0x543f('0x3c')){var _0x3891cd={};_0x3891cd[_0x458609[_0x543f('0x26')]]={'$like':'%'+_0x1c0495[_0x543f('0x2e')]['filter']+'%'};return _0x3891cd;}})});}_0x1b31e6=_[_0x543f('0x3b')]({},_0x1b31e6,_0x1c0495[_0x543f('0x3d')]);var _0x327957={'where':_0x1b31e6['where']};return db[_0x543f('0x29')][_0x543f('0x1a')](_0x327957)[_0x543f('0x22')](function(_0x5da661){_0x82694d[_0x543f('0x1a')]=_0x5da661;if(_0x1c0495[_0x543f('0x2e')][_0x543f('0x3e')]){_0x1b31e6[_0x543f('0x3f')]=[{'all':!![]}];}return db[_0x543f('0x29')][_0x543f('0x40')](_0x1b31e6);})[_0x543f('0x22')](function(_0x635cbf){_0x82694d['rows']=_0x635cbf;return _0x82694d;})[_0x543f('0x22')](respondWithFilteredResult(_0x7f9c7b,_0x1b31e6))['catch'](handleError(_0x7f9c7b,null));};exports[_0x543f('0x41')]=function(_0x1c1c00,_0x31bf58){var _0x2c4afd={'raw':!![],'where':{'id':_0x1c1c00[_0x543f('0x42')]['id']}},_0x1e52cb={};_0x1e52cb['model']=_[_0x543f('0x2f')](db[_0x543f('0x29')][_0x543f('0x43')]);_0x1e52cb[_0x543f('0x2e')]=_[_0x543f('0x2f')](_0x1c1c00[_0x543f('0x2e')]);_0x1e52cb[_0x543f('0x39')]=_[_0x543f('0x44')](_0x1e52cb[_0x543f('0x30')],_0x1e52cb[_0x543f('0x2e')]);_0x2c4afd[_0x543f('0x31')]=_[_0x543f('0x44')](_0x1e52cb[_0x543f('0x30')],qs[_0x543f('0x32')](_0x1c1c00[_0x543f('0x2e')]['fields']));_0x2c4afd[_0x543f('0x31')]=_0x2c4afd[_0x543f('0x31')][_0x543f('0x33')]?_0x2c4afd[_0x543f('0x31')]:_0x1e52cb['model'];if(_0x1c1c00[_0x543f('0x2e')][_0x543f('0x3e')]){_0x2c4afd['include']=[{'all':!![]}];}_0x2c4afd=_[_0x543f('0x3b')]({},_0x2c4afd,_0x1c1c00[_0x543f('0x3d')]);return db['ZendeskField'][_0x543f('0x45')](_0x2c4afd)[_0x543f('0x22')](handleEntityNotFound(_0x31bf58,null))[_0x543f('0x22')](respondWithResult(_0x31bf58,null))['catch'](handleError(_0x31bf58,null));};exports['create']=function(_0x45eddb,_0x1af1e5){return db[_0x543f('0x29')][_0x543f('0x46')](_0x45eddb[_0x543f('0x47')],{})[_0x543f('0x22')](respondWithResult(_0x1af1e5,0xc9))[_0x543f('0x48')](handleError(_0x1af1e5,null));};exports[_0x543f('0x20')]=function(_0x38d4cc,_0xb7146e){if(_0x38d4cc[_0x543f('0x47')]['id']){delete _0x38d4cc[_0x543f('0x47')]['id'];}return db[_0x543f('0x29')]['find']({'where':{'id':_0x38d4cc[_0x543f('0x42')]['id']}})[_0x543f('0x22')](handleEntityNotFound(_0xb7146e,null))[_0x543f('0x22')](saveUpdates(_0x38d4cc[_0x543f('0x47')],null))[_0x543f('0x22')](respondWithResult(_0xb7146e,null))[_0x543f('0x48')](handleError(_0xb7146e,null));};exports['destroy']=function(_0x57b39a,_0x5601cc){return db[_0x543f('0x29')][_0x543f('0x45')]({'where':{'id':_0x57b39a[_0x543f('0x42')]['id']}})['then'](handleEntityNotFound(_0x5601cc,null))[_0x543f('0x22')](removeEntity(_0x5601cc,null))[_0x543f('0x48')](handleError(_0x5601cc,null));}; \ No newline at end of file +var _0xb720=['end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZendeskField','includeAll','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','sendStatus','status'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0xb720,0x191));var _0x0b72=function(_0x5dc8c3,_0x22eee9){_0x5dc8c3=_0x5dc8c3-0x0;var _0x456a93=_0xb720[_0x5dc8c3];return _0x456a93;};'use strict';var emlformat=require(_0x0b72('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b72('0x1'));var jsonpatch=require(_0x0b72('0x2'));var rp=require(_0x0b72('0x3'));var moment=require(_0x0b72('0x4'));var BPromise=require(_0x0b72('0x5'));var Mustache=require(_0x0b72('0x6'));var util=require(_0x0b72('0x7'));var path=require(_0x0b72('0x8'));var sox=require(_0x0b72('0x9'));var csv=require('to-csv');var ejs=require(_0x0b72('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b72('0xb'));var squel=require(_0x0b72('0xc'));var crypto=require(_0x0b72('0xd'));var jsforce=require(_0x0b72('0xe'));var deskjs=require(_0x0b72('0xf'));var toCsv=require(_0x0b72('0x10'));var querystring=require(_0x0b72('0x11'));var Papa=require(_0x0b72('0x12'));var Redis=require(_0x0b72('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0b72('0x14'));var as=require(_0x0b72('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0b72('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x356034,_0x1fa33c){_0x1fa33c=_0x1fa33c||0xcc;return function(_0x2d4f3f){if(_0x2d4f3f){return _0x356034[_0x0b72('0x17')](_0x1fa33c);}return _0x356034[_0x0b72('0x18')](_0x1fa33c)[_0x0b72('0x19')]();};}function respondWithResult(_0x2083dc,_0x5e31ca){_0x5e31ca=_0x5e31ca||0xc8;return function(_0x3174c5){if(_0x3174c5){return _0x2083dc['status'](_0x5e31ca)[_0x0b72('0x1a')](_0x3174c5);}};}function respondWithFilteredResult(_0x405317,_0x3da564){return function(_0x192bc7){if(_0x192bc7){var _0x181244=typeof _0x3da564[_0x0b72('0x1b')]==='undefined'&&typeof _0x3da564[_0x0b72('0x1c')]===_0x0b72('0x1d');var _0x1a3243=_0x192bc7['count'];var _0x3713aa=_0x181244?0x0:_0x3da564['offset'];var _0xfe7a75=_0x181244?_0x192bc7[_0x0b72('0x1e')]:_0x3da564['offset']+_0x3da564[_0x0b72('0x1c')];var _0x1ff36b;if(_0xfe7a75>=_0x1a3243){_0xfe7a75=_0x1a3243;_0x1ff36b=0xc8;}else{_0x1ff36b=0xce;}_0x405317[_0x0b72('0x18')](_0x1ff36b);return _0x405317[_0x0b72('0x1f')](_0x0b72('0x20'),_0x3713aa+'-'+_0xfe7a75+'/'+_0x1a3243)['json'](_0x192bc7);}return null;};}function patchUpdates(_0x1e793d){return function(_0x202b58){try{jsonpatch[_0x0b72('0x21')](_0x202b58,_0x1e793d,!![]);}catch(_0x538480){return BPromise['reject'](_0x538480);}return _0x202b58[_0x0b72('0x22')]();};}function saveUpdates(_0x1b310c,_0x73bc5f){return function(_0x56e12d){if(_0x56e12d){return _0x56e12d[_0x0b72('0x23')](_0x1b310c)[_0x0b72('0x24')](function(_0x420d53){return _0x420d53;});}return null;};}function removeEntity(_0x274bfe,_0x553b33){return function(_0x2cca65){if(_0x2cca65){return _0x2cca65[_0x0b72('0x25')]()[_0x0b72('0x24')](function(){_0x274bfe[_0x0b72('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x120c8e,_0x407f1c){return function(_0x3f8d55){if(!_0x3f8d55){_0x120c8e['sendStatus'](0x194);}return _0x3f8d55;};}function handleError(_0x4fda85,_0x522857){_0x522857=_0x522857||0x1f4;return function(_0x44dc5c){logger['error'](_0x44dc5c['stack']);if(_0x44dc5c[_0x0b72('0x26')]){delete _0x44dc5c[_0x0b72('0x26')];}_0x4fda85['status'](_0x522857)[_0x0b72('0x27')](_0x44dc5c);};}exports[_0x0b72('0x28')]=function(_0x4a1b0c,_0x21175d){var _0x1ab879={},_0x57fe31={},_0x29841b={'count':0x0,'rows':[]};var _0x5dc221=_[_0x0b72('0x29')](db['ZendeskField'][_0x0b72('0x2a')],function(_0x5ade4d){return{'name':_0x5ade4d[_0x0b72('0x2b')],'type':_0x5ade4d[_0x0b72('0x2c')][_0x0b72('0x2d')]};});_0x57fe31['model']=_[_0x0b72('0x29')](_0x5dc221,'name');_0x57fe31[_0x0b72('0x2e')]=_[_0x0b72('0x2f')](_0x4a1b0c[_0x0b72('0x2e')]);_0x57fe31[_0x0b72('0x30')]=_[_0x0b72('0x31')](_0x57fe31[_0x0b72('0x32')],_0x57fe31[_0x0b72('0x2e')]);_0x1ab879[_0x0b72('0x33')]=_[_0x0b72('0x31')](_0x57fe31[_0x0b72('0x32')],qs[_0x0b72('0x34')](_0x4a1b0c[_0x0b72('0x2e')]['fields']));_0x1ab879[_0x0b72('0x33')]=_0x1ab879[_0x0b72('0x33')]['length']?_0x1ab879[_0x0b72('0x33')]:_0x57fe31['model'];if(!_0x4a1b0c[_0x0b72('0x2e')][_0x0b72('0x35')](_0x0b72('0x36'))){_0x1ab879[_0x0b72('0x1c')]=qs['limit'](_0x4a1b0c[_0x0b72('0x2e')][_0x0b72('0x1c')]);_0x1ab879['offset']=qs[_0x0b72('0x1b')](_0x4a1b0c['query'][_0x0b72('0x1b')]);}_0x1ab879['order']=qs[_0x0b72('0x37')](_0x4a1b0c[_0x0b72('0x2e')][_0x0b72('0x37')]);_0x1ab879[_0x0b72('0x38')]=qs[_0x0b72('0x30')](_[_0x0b72('0x39')](_0x4a1b0c['query'],_0x57fe31[_0x0b72('0x30')]),_0x5dc221);if(_0x4a1b0c['query'][_0x0b72('0x3a')]){_0x1ab879[_0x0b72('0x38')]=_[_0x0b72('0x3b')](_0x1ab879[_0x0b72('0x38')],{'$or':_['map'](_0x5dc221,function(_0x492530){if(_0x492530[_0x0b72('0x2c')]!=='VIRTUAL'){var _0x3f5723={};_0x3f5723[_0x492530['name']]={'$like':'%'+_0x4a1b0c['query'][_0x0b72('0x3a')]+'%'};return _0x3f5723;}})});}_0x1ab879=_[_0x0b72('0x3b')]({},_0x1ab879,_0x4a1b0c[_0x0b72('0x3c')]);var _0x46e1b0={'where':_0x1ab879['where']};return db[_0x0b72('0x3d')][_0x0b72('0x1e')](_0x46e1b0)[_0x0b72('0x24')](function(_0x36c5d9){_0x29841b[_0x0b72('0x1e')]=_0x36c5d9;if(_0x4a1b0c[_0x0b72('0x2e')][_0x0b72('0x3e')]){_0x1ab879[_0x0b72('0x3f')]=[{'all':!![]}];}return db[_0x0b72('0x3d')]['findAll'](_0x1ab879);})[_0x0b72('0x24')](function(_0xabd7dc){_0x29841b[_0x0b72('0x40')]=_0xabd7dc;return _0x29841b;})['then'](respondWithFilteredResult(_0x21175d,_0x1ab879))[_0x0b72('0x41')](handleError(_0x21175d,null));};exports[_0x0b72('0x42')]=function(_0x46dacf,_0x38f157){var _0x4151ca={'raw':!![],'where':{'id':_0x46dacf[_0x0b72('0x43')]['id']}},_0x386da8={};_0x386da8[_0x0b72('0x32')]=_[_0x0b72('0x2f')](db[_0x0b72('0x3d')][_0x0b72('0x2a')]);_0x386da8[_0x0b72('0x2e')]=_['keys'](_0x46dacf[_0x0b72('0x2e')]);_0x386da8[_0x0b72('0x30')]=_[_0x0b72('0x31')](_0x386da8[_0x0b72('0x32')],_0x386da8[_0x0b72('0x2e')]);_0x4151ca['attributes']=_[_0x0b72('0x31')](_0x386da8[_0x0b72('0x32')],qs['fields'](_0x46dacf[_0x0b72('0x2e')][_0x0b72('0x34')]));_0x4151ca[_0x0b72('0x33')]=_0x4151ca[_0x0b72('0x33')]['length']?_0x4151ca[_0x0b72('0x33')]:_0x386da8['model'];if(_0x46dacf[_0x0b72('0x2e')]['includeAll']){_0x4151ca[_0x0b72('0x3f')]=[{'all':!![]}];}_0x4151ca=_['merge']({},_0x4151ca,_0x46dacf[_0x0b72('0x3c')]);return db['ZendeskField'][_0x0b72('0x44')](_0x4151ca)[_0x0b72('0x24')](handleEntityNotFound(_0x38f157,null))[_0x0b72('0x24')](respondWithResult(_0x38f157,null))[_0x0b72('0x41')](handleError(_0x38f157,null));};exports[_0x0b72('0x45')]=function(_0x4dd125,_0x5731f3){return db[_0x0b72('0x3d')][_0x0b72('0x45')](_0x4dd125[_0x0b72('0x46')],{})[_0x0b72('0x24')](respondWithResult(_0x5731f3,0xc9))['catch'](handleError(_0x5731f3,null));};exports[_0x0b72('0x23')]=function(_0x41f8b6,_0x1674b3){if(_0x41f8b6[_0x0b72('0x46')]['id']){delete _0x41f8b6['body']['id'];}return db[_0x0b72('0x3d')]['find']({'where':{'id':_0x41f8b6['params']['id']}})[_0x0b72('0x24')](handleEntityNotFound(_0x1674b3,null))[_0x0b72('0x24')](saveUpdates(_0x41f8b6[_0x0b72('0x46')],null))[_0x0b72('0x24')](respondWithResult(_0x1674b3,null))['catch'](handleError(_0x1674b3,null));};exports[_0x0b72('0x25')]=function(_0x4084d6,_0x4a2ff3){return db[_0x0b72('0x3d')][_0x0b72('0x44')]({'where':{'id':_0x4084d6[_0x0b72('0x43')]['id']}})[_0x0b72('0x24')](handleEntityNotFound(_0x4a2ff3,null))[_0x0b72('0x24')](removeEntity(_0x4a2ff3,null))['catch'](handleError(_0x4a2ff3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 21936b0..995523c 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 _0x8b36=['./intZendeskField.attributes','exports','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x553e41,_0x33cd36){var _0x7ec113=function(_0x425300){while(--_0x425300){_0x553e41['push'](_0x553e41['shift']());}};_0x7ec113(++_0x33cd36);}(_0x8b36,0x1cd));var _0x68b3=function(_0x5cbf66,_0x2f127f){_0x5cbf66=_0x5cbf66-0x0;var _0x47927e=_0x8b36[_0x5cbf66];return _0x47927e;};'use strict';var _=require(_0x68b3('0x0'));var util=require(_0x68b3('0x1'));var logger=require(_0x68b3('0x2'))(_0x68b3('0x3'));var moment=require(_0x68b3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x68b3('0x5'));var rimraf=require(_0x68b3('0x6'));var config=require('../../config/environment');var attributes=require(_0x68b3('0x7'));module[_0x68b3('0x8')]=function(_0x57b53a,_0x1e09e7){return _0x57b53a['define']('ZendeskField',attributes,{'tableName':_0x68b3('0x9'),'paranoid':![],'indexes':[{'name':_0x68b3('0xa'),'fields':[_0x68b3('0xb'),_0x68b3('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf515=['rimraf','../../config/environment','./intZendeskField.attributes','exports','int_zendesk_fields','idField','lodash','api','request-promise'];(function(_0x1ae4a9,_0x4c0ed9){var _0x54d0b0=function(_0x4fff20){while(--_0x4fff20){_0x1ae4a9['push'](_0x1ae4a9['shift']());}};_0x54d0b0(++_0x4c0ed9);}(_0xf515,0xd5));var _0x5f51=function(_0xc1a81c,_0x89afe8){_0xc1a81c=_0xc1a81c-0x0;var _0x1c2c6a=_0xf515[_0xc1a81c];return _0x1c2c6a;};'use strict';var _=require(_0x5f51('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5f51('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5f51('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f51('0x3'));var config=require(_0x5f51('0x4'));var attributes=require(_0x5f51('0x5'));module[_0x5f51('0x6')]=function(_0x9b64e3,_0x2c788b){return _0x9b64e3['define']('ZendeskField',attributes,{'tableName':_0x5f51('0x7'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x5f51('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 3c650e7..463b98f 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 _0xf8c9=['../../config/environment','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x17d76b,_0x54345b){var _0x16f3ac=function(_0x315442){while(--_0x315442){_0x17d76b['push'](_0x17d76b['shift']());}};_0x16f3ac(++_0x54345b);}(_0xf8c9,0xb1));var _0x9f8c=function(_0x31972b,_0x4e6f14){_0x31972b=_0x31972b-0x0;var _0x3451c1=_0xf8c9[_0x31972b];return _0x3451c1;};'use strict';var _=require(_0x9f8c('0x0'));var util=require(_0x9f8c('0x1'));var moment=require(_0x9f8c('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f8c('0x3'));var fs=require('fs');var Redis=require(_0x9f8c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9f8c('0x5'))(_0x9f8c('0x6'));var config=require(_0x9f8c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9f8c('0x8')][_0x9f8c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfc8085,_0x2fdead,_0x451737){return new BPromise(function(_0x7b432a,_0x30b5aa){return client[_0x9f8c('0xa')](_0xfc8085,_0x451737)[_0x9f8c('0xb')](function(_0x4e78a8){logger[_0x9f8c('0xc')](_0x9f8c('0xd'),_0x2fdead,'request\x20sent');logger[_0x9f8c('0xe')](_0x9f8c('0xf'),_0x2fdead,_0x9f8c('0x10'),JSON[_0x9f8c('0x11')](_0x4e78a8));if(_0x4e78a8[_0x9f8c('0x12')]){if(_0x4e78a8['error'][_0x9f8c('0x13')]===0x1f4){logger[_0x9f8c('0x12')](_0x9f8c('0xd'),_0x2fdead,_0x4e78a8[_0x9f8c('0x12')][_0x9f8c('0x14')]);return _0x30b5aa(_0x4e78a8[_0x9f8c('0x12')][_0x9f8c('0x14')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x2fdead,_0x4e78a8[_0x9f8c('0x12')]['message']);return _0x7b432a(_0x4e78a8[_0x9f8c('0x12')][_0x9f8c('0x14')]);}else{logger['info'](_0x9f8c('0xd'),_0x2fdead,'request\x20sent');_0x7b432a(_0x4e78a8[_0x9f8c('0x15')][_0x9f8c('0x14')]);}})[_0x9f8c('0x16')](function(_0x4b90d8){logger[_0x9f8c('0x12')](_0x9f8c('0xd'),_0x2fdead,_0x4b90d8);_0x30b5aa(_0x4b90d8);});});} \ No newline at end of file +var _0xc76a=['util','moment','ioredis','../../config/logger','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x1e4f2b,_0x2f3071){var _0x358004=function(_0x32586c){while(--_0x32586c){_0x1e4f2b['push'](_0x1e4f2b['shift']());}};_0x358004(++_0x2f3071);}(_0xc76a,0xe4));var _0xac76=function(_0xc51f05,_0x31cf8b){_0xc51f05=_0xc51f05-0x0;var _0x57ea49=_0xc76a[_0xc51f05];return _0x57ea49;};'use strict';var _=require('lodash');var util=require(_0xac76('0x0'));var moment=require(_0xac76('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac76('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xac76('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xac76('0x4')][_0xac76('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1adef7,_0x5d55db,_0xfb49bc){return new BPromise(function(_0x17f63c,_0x2a5a66){return client[_0xac76('0x6')](_0x1adef7,_0xfb49bc)[_0xac76('0x7')](function(_0x1ba15d){logger['info'](_0xac76('0x8'),_0x5d55db,_0xac76('0x9'));logger[_0xac76('0xa')](_0xac76('0xb'),_0x5d55db,'request\x20sent',JSON[_0xac76('0xc')](_0x1ba15d));if(_0x1ba15d['error']){if(_0x1ba15d[_0xac76('0xd')][_0xac76('0xe')]===0x1f4){logger[_0xac76('0xd')]('ZendeskField,\x20%s,\x20%s',_0x5d55db,_0x1ba15d[_0xac76('0xd')]['message']);return _0x2a5a66(_0x1ba15d[_0xac76('0xd')][_0xac76('0xf')]);}logger['error'](_0xac76('0x8'),_0x5d55db,_0x1ba15d[_0xac76('0xd')]['message']);return _0x17f63c(_0x1ba15d[_0xac76('0xd')][_0xac76('0xf')]);}else{logger[_0xac76('0x10')]('ZendeskField,\x20%s,\x20%s',_0x5d55db,_0xac76('0x9'));_0x17f63c(_0x1ba15d[_0xac76('0x11')][_0xac76('0xf')]);}})[_0xac76('0x12')](function(_0x5554a2){logger['error'](_0xac76('0x8'),_0x5d55db,_0x5554a2);_0x2a5a66(_0x5554a2);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ad418ef..cbf670b 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 _0x17ae=['index','/:id','/:id/fields','post','/:id/configurations','addConfiguration','put','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x10ca3c,_0x57dd68){var _0x30f446=function(_0x50f18f){while(--_0x50f18f){_0x10ca3c['push'](_0x10ca3c['shift']());}};_0x30f446(++_0x57dd68);}(_0x17ae,0x198));var _0xe17a=function(_0x3e6398,_0x5e8559){_0x3e6398=_0x3e6398-0x0;var _0x5b943b=_0x17ae[_0x3e6398];return _0x5b943b;};'use strict';var multer=require('multer');var util=require(_0xe17a('0x0'));var path=require(_0xe17a('0x1'));var timeout=require('connect-timeout');var express=require(_0xe17a('0x2'));var router=express[_0xe17a('0x3')]();var fs_extra=require(_0xe17a('0x4'));var auth=require(_0xe17a('0x5'));var interaction=require(_0xe17a('0x6'));var config=require('../../config/environment');var controller=require(_0xe17a('0x7'));router[_0xe17a('0x8')]('/',auth[_0xe17a('0x9')](),controller[_0xe17a('0xa')]);router[_0xe17a('0x8')](_0xe17a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe17a('0x8')]('/:id/configurations',auth[_0xe17a('0x9')](),controller['getConfigurations']);router[_0xe17a('0x8')](_0xe17a('0xc'),auth[_0xe17a('0x9')](),controller['getFields']);router[_0xe17a('0xd')]('/',auth[_0xe17a('0x9')](),controller['create']);router[_0xe17a('0xd')](_0xe17a('0xe'),auth[_0xe17a('0x9')](),controller[_0xe17a('0xf')]);router[_0xe17a('0x10')](_0xe17a('0xb'),auth[_0xe17a('0x9')](),controller['update']);router['delete'](_0xe17a('0xb'),auth['isAuthenticated'](),controller[_0xe17a('0x11')]);module[_0xe17a('0x12')]=router; \ No newline at end of file +var _0x6e7e=['delete','/:id','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id/fields','post','create','/:id/configurations','put'];(function(_0x561487,_0x30b000){var _0x581388=function(_0x2db25a){while(--_0x2db25a){_0x561487['push'](_0x561487['shift']());}};_0x581388(++_0x30b000);}(_0x6e7e,0x123));var _0xe6e7=function(_0x287253,_0x380a6f){_0x287253=_0x287253-0x0;var _0x57c547=_0x6e7e[_0x287253];return _0x57c547;};'use strict';var multer=require(_0xe6e7('0x0'));var util=require(_0xe6e7('0x1'));var path=require(_0xe6e7('0x2'));var timeout=require(_0xe6e7('0x3'));var express=require(_0xe6e7('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe6e7('0x5'));var interaction=require(_0xe6e7('0x6'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0xe6e7('0x7')]('/',auth[_0xe6e7('0x8')](),controller[_0xe6e7('0x9')]);router[_0xe6e7('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe6e7('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xe6e7('0x7')](_0xe6e7('0xa'),auth[_0xe6e7('0x8')](),controller['getFields']);router[_0xe6e7('0xb')]('/',auth[_0xe6e7('0x8')](),controller[_0xe6e7('0xc')]);router[_0xe6e7('0xb')](_0xe6e7('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xe6e7('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe6e7('0xf')](_0xe6e7('0x10'),auth[_0xe6e7('0x8')](),controller[_0xe6e7('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 d7e0335..929de50 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 _0xb821=['STRING','exports'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xb821,0xa7));var _0x1b82=function(_0x20aab1,_0xc6d854){_0x20aab1=_0x20aab1-0x0;var _0x277dff=_0xb821[_0x20aab1];return _0x277dff;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'name':{'type':Sequelize[_0x1b82('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x1b82('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1b82('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x1b82('0x1')]},'refreshToken':{'type':Sequelize[_0x1b82('0x1')]}}; \ No newline at end of file +var _0x17ba=['sequelize','exports','STRING'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x17ba,0xab));var _0xa17b=function(_0x2afae4,_0x929553){_0x2afae4=_0x2afae4-0x0;var _0x3ba2bc=_0x17ba[_0x2afae4];return _0x3ba2bc;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa17b('0x2')]},'host':{'type':Sequelize[_0xa17b('0x2')]},'zone':{'type':Sequelize[_0xa17b('0x2')]},'clientId':{'type':Sequelize[_0xa17b('0x2')]},'clientSecret':{'type':Sequelize[_0xa17b('0x2')]},'serverUrl':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xa17b('0x2')]},'refreshToken':{'type':Sequelize[_0xa17b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5a47f7e..1ea5906 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 _0x8ab4=['addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Type','remove','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','ZohoAccount','includeAll','findAll','rows','show','include','find','catch','create','body','params','getConfigurations','findOne','ZohoConfiguration','rawAttributes'];(function(_0x31081f,_0x24916a){var _0x4cdd11=function(_0x38e782){while(--_0x38e782){_0x31081f['push'](_0x31081f['shift']());}};_0x4cdd11(++_0x24916a);}(_0x8ab4,0x137));var _0x48ab=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x8ab4[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x48ab('0x0'));var rimraf=require(_0x48ab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48ab('0x2'));var rp=require('request-promise');var moment=require(_0x48ab('0x3'));var BPromise=require(_0x48ab('0x4'));var Mustache=require(_0x48ab('0x5'));var util=require(_0x48ab('0x6'));var path=require(_0x48ab('0x7'));var sox=require(_0x48ab('0x8'));var csv=require(_0x48ab('0x9'));var ejs=require(_0x48ab('0xa'));var fs=require('fs');var fs_extra=require(_0x48ab('0xb'));var _=require(_0x48ab('0xc'));var squel=require(_0x48ab('0xd'));var crypto=require(_0x48ab('0xe'));var jsforce=require(_0x48ab('0xf'));var deskjs=require(_0x48ab('0x10'));var toCsv=require('to-csv');var querystring=require(_0x48ab('0x11'));var Papa=require(_0x48ab('0x12'));var Redis=require(_0x48ab('0x13'));var authService=require(_0x48ab('0x14'));var qs=require(_0x48ab('0x15'));var as=require(_0x48ab('0x16'));var hardwareService=require(_0x48ab('0x17'));var logger=require(_0x48ab('0x18'))(_0x48ab('0x19'));var utils=require('../../config/utils');var config=require(_0x48ab('0x1a'));var licenseUtil=require(_0x48ab('0x1b'));var db=require(_0x48ab('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x56ffb6,_0x499a70){_0x499a70=_0x499a70||0xcc;return function(_0x5950ce){if(_0x5950ce){return _0x56ffb6[_0x48ab('0x1d')](_0x499a70);}return _0x56ffb6[_0x48ab('0x1e')](_0x499a70)[_0x48ab('0x1f')]();};}function respondWithResult(_0x5a62f0,_0x5c4204){_0x5c4204=_0x5c4204||0xc8;return function(_0x2b050e){if(_0x2b050e){return _0x5a62f0[_0x48ab('0x1e')](_0x5c4204)[_0x48ab('0x20')](_0x2b050e);}};}function respondWithFilteredResult(_0x5e8fcc,_0x31eece){return function(_0x240503){if(_0x240503){var _0x125724=typeof _0x31eece[_0x48ab('0x21')]==='undefined'&&typeof _0x31eece[_0x48ab('0x22')]==='undefined';var _0x23345b=_0x240503[_0x48ab('0x23')];var _0x14fd09=_0x125724?0x0:_0x31eece[_0x48ab('0x21')];var _0x4d1bb8=_0x125724?_0x240503['count']:_0x31eece[_0x48ab('0x21')]+_0x31eece['limit'];var _0x40f284;if(_0x4d1bb8>=_0x23345b){_0x4d1bb8=_0x23345b;_0x40f284=0xc8;}else{_0x40f284=0xce;}_0x5e8fcc[_0x48ab('0x1e')](_0x40f284);return _0x5e8fcc[_0x48ab('0x24')](_0x48ab('0x25'),_0x14fd09+'-'+_0x4d1bb8+'/'+_0x23345b)[_0x48ab('0x20')](_0x240503);}return null;};}function patchUpdates(_0x276b4f){return function(_0x19d871){try{jsonpatch[_0x48ab('0x26')](_0x19d871,_0x276b4f,!![]);}catch(_0x1419c5){return BPromise['reject'](_0x1419c5);}return _0x19d871[_0x48ab('0x27')]();};}function saveUpdates(_0x2ef919,_0x498c0b){return function(_0x2e99f5){if(_0x2e99f5){return _0x2e99f5[_0x48ab('0x28')](_0x2ef919)[_0x48ab('0x29')](function(_0x1acfff){return _0x1acfff;});}return null;};}function removeEntity(_0x4ff9e3,_0x559cba){return function(_0x42e1c7){if(_0x42e1c7){return _0x42e1c7[_0x48ab('0x2a')]()['then'](function(){_0x4ff9e3[_0x48ab('0x1e')](0xcc)[_0x48ab('0x1f')]();});}};}function handleEntityNotFound(_0x2c42ae,_0x5a9c5f){return function(_0xeb1ef8){if(!_0xeb1ef8){_0x2c42ae[_0x48ab('0x1d')](0x194);}return _0xeb1ef8;};}function handleError(_0x18c1bb,_0xa50e43){_0xa50e43=_0xa50e43||0x1f4;return function(_0x14b1b6){logger[_0x48ab('0x2b')](_0x14b1b6[_0x48ab('0x2c')]);if(_0x14b1b6[_0x48ab('0x2d')]){delete _0x14b1b6[_0x48ab('0x2d')];}_0x18c1bb[_0x48ab('0x1e')](_0xa50e43)[_0x48ab('0x2e')](_0x14b1b6);};}exports[_0x48ab('0x2f')]=function(_0x1cc4c5,_0x58859){var _0x57da19={},_0x5efc13={},_0x5946ff={'count':0x0,'rows':[]};var _0xc973d5=_[_0x48ab('0x30')](db['ZohoAccount']['rawAttributes'],function(_0x122e97){return{'name':_0x122e97['fieldName'],'type':_0x122e97[_0x48ab('0x31')][_0x48ab('0x32')]};});_0x5efc13[_0x48ab('0x33')]=_[_0x48ab('0x30')](_0xc973d5,_0x48ab('0x2d'));_0x5efc13[_0x48ab('0x34')]=_[_0x48ab('0x35')](_0x1cc4c5['query']);_0x5efc13[_0x48ab('0x36')]=_[_0x48ab('0x37')](_0x5efc13[_0x48ab('0x33')],_0x5efc13[_0x48ab('0x34')]);_0x57da19[_0x48ab('0x38')]=_[_0x48ab('0x37')](_0x5efc13[_0x48ab('0x33')],qs[_0x48ab('0x39')](_0x1cc4c5['query'][_0x48ab('0x39')]));_0x57da19[_0x48ab('0x38')]=_0x57da19[_0x48ab('0x38')][_0x48ab('0x3a')]?_0x57da19['attributes']:_0x5efc13[_0x48ab('0x33')];if(!_0x1cc4c5[_0x48ab('0x34')][_0x48ab('0x3b')](_0x48ab('0x3c'))){_0x57da19[_0x48ab('0x22')]=qs['limit'](_0x1cc4c5[_0x48ab('0x34')][_0x48ab('0x22')]);_0x57da19[_0x48ab('0x21')]=qs['offset'](_0x1cc4c5[_0x48ab('0x34')][_0x48ab('0x21')]);}_0x57da19['order']=qs[_0x48ab('0x3d')](_0x1cc4c5['query']['sort']);_0x57da19['where']=qs[_0x48ab('0x36')](_[_0x48ab('0x3e')](_0x1cc4c5[_0x48ab('0x34')],_0x5efc13[_0x48ab('0x36')]),_0xc973d5);if(_0x1cc4c5[_0x48ab('0x34')][_0x48ab('0x3f')]){_0x57da19[_0x48ab('0x40')]=_[_0x48ab('0x41')](_0x57da19[_0x48ab('0x40')],{'$or':_[_0x48ab('0x30')](_0xc973d5,function(_0xbfb401){if(_0xbfb401[_0x48ab('0x31')]!=='VIRTUAL'){var _0x329f74={};_0x329f74[_0xbfb401['name']]={'$like':'%'+_0x1cc4c5[_0x48ab('0x34')][_0x48ab('0x3f')]+'%'};return _0x329f74;}})});}_0x57da19=_['merge']({},_0x57da19,_0x1cc4c5[_0x48ab('0x42')]);var _0x4f1700={'where':_0x57da19[_0x48ab('0x40')]};return db[_0x48ab('0x43')]['count'](_0x4f1700)[_0x48ab('0x29')](function(_0x398ee7){_0x5946ff['count']=_0x398ee7;if(_0x1cc4c5[_0x48ab('0x34')][_0x48ab('0x44')]){_0x57da19['include']=[{'all':!![]}];}return db[_0x48ab('0x43')][_0x48ab('0x45')](_0x57da19);})[_0x48ab('0x29')](function(_0x2beb79){_0x5946ff[_0x48ab('0x46')]=_0x2beb79;return _0x5946ff;})['then'](respondWithFilteredResult(_0x58859,_0x57da19))['catch'](handleError(_0x58859,null));};exports[_0x48ab('0x47')]=function(_0x29c08d,_0xff10cd){var _0x344186={'raw':![],'where':{'id':_0x29c08d['params']['id']}},_0x19df73={};_0x19df73[_0x48ab('0x33')]=_[_0x48ab('0x35')](db[_0x48ab('0x43')]['rawAttributes']);_0x19df73[_0x48ab('0x34')]=_['keys'](_0x29c08d[_0x48ab('0x34')]);_0x19df73[_0x48ab('0x36')]=_[_0x48ab('0x37')](_0x19df73['model'],_0x19df73[_0x48ab('0x34')]);_0x344186[_0x48ab('0x38')]=_[_0x48ab('0x37')](_0x19df73[_0x48ab('0x33')],qs[_0x48ab('0x39')](_0x29c08d['query'][_0x48ab('0x39')]));_0x344186[_0x48ab('0x38')]=_0x344186['attributes'][_0x48ab('0x3a')]?_0x344186['attributes']:_0x19df73['model'];if(_0x29c08d[_0x48ab('0x34')][_0x48ab('0x44')]){_0x344186[_0x48ab('0x48')]=[{'all':!![]}];}_0x344186=_[_0x48ab('0x41')]({},_0x344186,_0x29c08d[_0x48ab('0x42')]);return db['ZohoAccount'][_0x48ab('0x49')](_0x344186)[_0x48ab('0x29')](handleEntityNotFound(_0xff10cd,null))['then'](respondWithResult(_0xff10cd,null))[_0x48ab('0x4a')](handleError(_0xff10cd,null));};exports[_0x48ab('0x4b')]=function(_0x2f445f,_0x6578bd){return db['ZohoAccount']['create'](_0x2f445f[_0x48ab('0x4c')],{})[_0x48ab('0x29')](respondWithResult(_0x6578bd,0xc9))['catch'](handleError(_0x6578bd,null));};exports[_0x48ab('0x28')]=function(_0x2d2f92,_0x249a93){if(_0x2d2f92['body']['id']){delete _0x2d2f92['body']['id'];}return db[_0x48ab('0x43')]['find']({'where':{'id':_0x2d2f92[_0x48ab('0x4d')]['id']}})[_0x48ab('0x29')](handleEntityNotFound(_0x249a93,null))[_0x48ab('0x29')](saveUpdates(_0x2d2f92[_0x48ab('0x4c')],null))['then'](respondWithResult(_0x249a93,null))['catch'](handleError(_0x249a93,null));};exports['destroy']=function(_0x22ae5d,_0x56ee87){return db[_0x48ab('0x43')]['find']({'where':{'id':_0x22ae5d[_0x48ab('0x4d')]['id']}})[_0x48ab('0x29')](handleEntityNotFound(_0x56ee87,null))[_0x48ab('0x29')](removeEntity(_0x56ee87,null))[_0x48ab('0x4a')](handleError(_0x56ee87,null));};exports[_0x48ab('0x4e')]=function(_0x2cf03c,_0x475354,_0x3cf4c9){var _0x1266e6={};var _0x5d7d40={};var _0x462b2e;var _0x1284d5;return db[_0x48ab('0x43')][_0x48ab('0x4f')]({'where':{'id':_0x2cf03c[_0x48ab('0x4d')]['id']}})[_0x48ab('0x29')](handleEntityNotFound(_0x475354,null))[_0x48ab('0x29')](function(_0x51076b){if(_0x51076b){_0x462b2e=_0x51076b;_0x5d7d40[_0x48ab('0x33')]=_[_0x48ab('0x35')](db[_0x48ab('0x50')][_0x48ab('0x51')]);_0x5d7d40[_0x48ab('0x34')]=_[_0x48ab('0x35')](_0x2cf03c[_0x48ab('0x34')]);_0x5d7d40[_0x48ab('0x36')]=_['intersection'](_0x5d7d40[_0x48ab('0x33')],_0x5d7d40[_0x48ab('0x34')]);_0x1266e6[_0x48ab('0x38')]=_[_0x48ab('0x37')](_0x5d7d40[_0x48ab('0x33')],qs[_0x48ab('0x39')](_0x2cf03c['query'][_0x48ab('0x39')]));_0x1266e6[_0x48ab('0x38')]=_0x1266e6['attributes'][_0x48ab('0x3a')]?_0x1266e6[_0x48ab('0x38')]:_0x5d7d40[_0x48ab('0x33')];_0x1266e6['order']=qs[_0x48ab('0x3d')](_0x2cf03c['query'][_0x48ab('0x3d')]);_0x1266e6[_0x48ab('0x40')]=qs[_0x48ab('0x36')](_['pick'](_0x2cf03c[_0x48ab('0x34')],_0x5d7d40[_0x48ab('0x36')]));if(_0x2cf03c[_0x48ab('0x34')][_0x48ab('0x3f')]){_0x1266e6[_0x48ab('0x40')]=_[_0x48ab('0x41')](_0x1266e6['where'],{'$or':_[_0x48ab('0x30')](_0x1266e6[_0x48ab('0x38')],function(_0x12c42c){var _0xaccaa0={};_0xaccaa0[_0x12c42c]={'$like':'%'+_0x2cf03c[_0x48ab('0x34')][_0x48ab('0x3f')]+'%'};return _0xaccaa0;})});}_0x1266e6=_[_0x48ab('0x41')]({},_0x1266e6,_0x2cf03c['options']);return _0x462b2e[_0x48ab('0x4e')](_0x1266e6);}})[_0x48ab('0x29')](function(_0x39f28f){if(_0x39f28f){_0x1284d5=_0x39f28f[_0x48ab('0x3a')];if(!_0x2cf03c[_0x48ab('0x34')][_0x48ab('0x3b')](_0x48ab('0x3c'))){_0x1266e6[_0x48ab('0x22')]=qs[_0x48ab('0x22')](_0x2cf03c[_0x48ab('0x34')][_0x48ab('0x22')]);_0x1266e6[_0x48ab('0x21')]=qs['offset'](_0x2cf03c[_0x48ab('0x34')][_0x48ab('0x21')]);}return _0x462b2e['getConfigurations'](_0x1266e6);}})[_0x48ab('0x29')](function(_0x4cfa1d){if(_0x4cfa1d){return _0x4cfa1d?{'count':_0x1284d5,'rows':_0x4cfa1d}:null;}})[_0x48ab('0x29')](respondWithResult(_0x475354,null))['catch'](handleError(_0x475354,null));};exports[_0x48ab('0x52')]=function(_0x1b5ea9,_0x727503,_0x552006){if(_0x1b5ea9[_0x48ab('0x4c')]['id']){delete _0x1b5ea9['body']['id'];}return db[_0x48ab('0x43')][_0x48ab('0x4f')]({'where':{'id':_0x1b5ea9[_0x48ab('0x4d')]['id']}})[_0x48ab('0x29')](handleEntityNotFound(_0x727503,null))[_0x48ab('0x29')](function(_0x5a575a){if(_0x5a575a){_0x1b5ea9[_0x48ab('0x4c')][_0x48ab('0x53')]=_0x5a575a['id'];_0x1b5ea9[_0x48ab('0x4c')][_0x48ab('0x54')]=integrations[_0x48ab('0x55')](_0x1b5ea9[_0x48ab('0x4c')]['channel'],_0x1b5ea9['body'][_0x48ab('0x31')]);_0x1b5ea9[_0x48ab('0x4c')][_0x48ab('0x56')]=integrations[_0x48ab('0x57')](_0x1b5ea9[_0x48ab('0x4c')][_0x48ab('0x58')],_0x1b5ea9[_0x48ab('0x4c')][_0x48ab('0x31')]);return db[_0x48ab('0x50')][_0x48ab('0x4b')](_0x1b5ea9['body'],{'include':[{'model':db[_0x48ab('0x59')],'as':_0x48ab('0x54')},{'model':db['ZohoField'],'as':_0x48ab('0x56')}]});}return null;})['then'](respondWithResult(_0x727503,null))[_0x48ab('0x4a')](handleError(_0x727503,null));};function getAccessToken(_0x1aeeba){return new Promise(function(_0xe53718,_0x3008fe){var _0x2a3c82;switch(_0x1aeeba[_0x48ab('0x5a')]){case'US':_0x2a3c82='https://accounts.zoho.com';break;case'AU':_0x2a3c82='https://accounts.zoho.com.au';break;case'EU':_0x2a3c82='https://accounts.zoho.eu';break;case'IN':_0x2a3c82=_0x48ab('0x5b');break;case'CN':_0x2a3c82='https://accounts.zoho.com.cn';break;default:_0x2a3c82=_0x48ab('0x5c');break;}var _0x52f000={'method':_0x48ab('0x5d'),'uri':_0x2a3c82+_0x48ab('0x5e'),'qs':{'refresh_token':_0x1aeeba[_0x48ab('0x5f')],'client_id':_0x1aeeba[_0x48ab('0x60')],'client_secret':_0x1aeeba[_0x48ab('0x61')],'grant_type':_0x48ab('0x62')},'json':!![]};return rp(_0x52f000)[_0x48ab('0x29')](function(_0x3f26b2){if(_0x3f26b2[_0x48ab('0x63')]){_0xe53718(_0x3f26b2['access_token']);}else{_0x3008fe('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x48ab('0x4a')](function(_0x505148){_0x3008fe(_0x505148);});});}exports[_0x48ab('0x64')]=function(_0x968ecf,_0xee3324,_0x5333f1){var _0x3a0af1,_0x127de8,_0x1a4ce8,_0x8f09fd,_0x14b964;return db[_0x48ab('0x43')][_0x48ab('0x4f')]({'where':{'id':_0x968ecf['params']['id']},'attributes':['id',_0x48ab('0x65'),_0x48ab('0x5a'),_0x48ab('0x60'),_0x48ab('0x61'),_0x48ab('0x66'),'code',_0x48ab('0x5f')]})['then'](handleEntityNotFound(_0xee3324,null))[_0x48ab('0x29')](function(_0x503821){_0x14b964=_0x503821;_0x3a0af1=_0x14b964[_0x48ab('0x65')];_0x127de8=_0x3a0af1===_0x48ab('0x67')?'eu':_0x48ab('0x68');_0x1a4ce8=_0x14b964[_0x48ab('0x66')];var _0x1072e5=_0x1a4ce8[_0x48ab('0x69')](-0x1);if(_0x1072e5==='/'||_0x1072e5==='\x5c'||_0x1072e5===':'){_0x1a4ce8=_0x1a4ce8[_0x48ab('0x6a')](0x0,_0x1a4ce8[_0x48ab('0x6b')](_0x1072e5));}if(!_0x14b964[_0x48ab('0x5f')]){throw new Error(_0x48ab('0x6c'));}return getAccessToken(_0x14b964);})['then'](function(_0x9c0363){if(_0x9c0363){return rp({'method':_0x48ab('0x6d'),'uri':util[_0x48ab('0x6e')](_0x48ab('0x6f'),_0x127de8),'qs':{'module':_0x48ab('0x70')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x9c0363},'json':!![]});}})[_0x48ab('0x29')](function(_0x5247ca){if(_0x5247ca){if(_0x5247ca[_0x48ab('0x71')]&&_0x5247ca[_0x48ab('0x71')][_0x48ab('0x2b')]){throw new Error(_0x5247ca[_0x48ab('0x71')][_0x48ab('0x2b')]['message']);}var _0x2710fa=[];var _0x342187=[];var _0x467441=[_0x48ab('0x72'),_0x48ab('0x73'),'Description',_0x48ab('0x74'),_0x48ab('0x75'),_0x48ab('0x76'),'Call_Start_Time',_0x48ab('0x77')];_0x342187=_[_0x48ab('0x78')](_0x5247ca[_0x48ab('0x39')],function(_0x4824eb){return _0x467441['includes'](_0x4824eb['api_name']);});for(var _0x543d0a=0x0;_0x543d0a<_0x342187['length'];_0x543d0a++){if(_0x342187[_0x543d0a][_0x48ab('0x79')]===![]){_0x2710fa[_0x48ab('0x7a')]({'id':_0x342187[_0x543d0a]['id'],'name':_0x342187[_0x543d0a][_0x48ab('0x7b')],'custom':_0x342187[_0x543d0a][_0x48ab('0x7c')],'options':_0x342187[_0x543d0a]['data_type']===_0x48ab('0x7d')&&_0x342187[_0x543d0a][_0x48ab('0x7e')][_0x48ab('0x3a')]>-0x1?_['map'](_0x342187[_0x543d0a][_0x48ab('0x7e')],function(_0x443c21){return{'name':_0x443c21,'value':_0x443c21};}):[]});}}return{'count':_0x2710fa[_0x48ab('0x3a')],'rows':_0x2710fa};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0xee3324,null))['catch'](function(_0x424a23){var _0x57efa6=_0x968ecf['query'][_0x48ab('0x7f')]?0x1f4:_0x424a23[_0x48ab('0x80')]||0x1f4;logger[_0x48ab('0x2b')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x57efa6,JSON[_0x48ab('0x81')](_0x424a23));delete _0x424a23['name'];if(_0x57efa6===0x191){_0x57efa6=0x190;}_0xee3324['status'](_0x57efa6)['send'](_0x968ecf[_0x48ab('0x34')][_0x48ab('0x7f')]?{'message':_0x48ab('0x82'),'statusCode':_0x424a23[_0x48ab('0x80')]}:_0x424a23);});}; \ No newline at end of file +var _0x5fe1=['refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','response','message','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','api_name','system_mandatory','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','order','sort','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','clientId','clientSecret','access_token','getFields','host','code','com','serverUrl','substring','lastIndexOf'];(function(_0x5d4390,_0x21b7d8){var _0x4f3e01=function(_0x42372f){while(--_0x42372f){_0x5d4390['push'](_0x5d4390['shift']());}};_0x4f3e01(++_0x21b7d8);}(_0x5fe1,0x8e));var _0x15fe=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x5fe1[_0x369151];return _0x4292d5;};'use strict';var emlformat=require(_0x15fe('0x0'));var rimraf=require(_0x15fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x15fe('0x2'));var rp=require(_0x15fe('0x3'));var moment=require('moment');var BPromise=require(_0x15fe('0x4'));var Mustache=require(_0x15fe('0x5'));var util=require('util');var path=require(_0x15fe('0x6'));var sox=require(_0x15fe('0x7'));var csv=require(_0x15fe('0x8'));var ejs=require(_0x15fe('0x9'));var fs=require('fs');var fs_extra=require(_0x15fe('0xa'));var _=require('lodash');var squel=require(_0x15fe('0xb'));var crypto=require(_0x15fe('0xc'));var jsforce=require(_0x15fe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x15fe('0x8'));var querystring=require(_0x15fe('0xe'));var Papa=require(_0x15fe('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x15fe('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15fe('0x11'));var logger=require(_0x15fe('0x12'))('api');var utils=require(_0x15fe('0x13'));var config=require(_0x15fe('0x14'));var licenseUtil=require(_0x15fe('0x15'));var db=require(_0x15fe('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x586648,_0x3320ea){_0x3320ea=_0x3320ea||0xcc;return function(_0x1b4775){if(_0x1b4775){return _0x586648[_0x15fe('0x17')](_0x3320ea);}return _0x586648[_0x15fe('0x18')](_0x3320ea)[_0x15fe('0x19')]();};}function respondWithResult(_0x36da81,_0xf007a4){_0xf007a4=_0xf007a4||0xc8;return function(_0x4ad142){if(_0x4ad142){return _0x36da81[_0x15fe('0x18')](_0xf007a4)[_0x15fe('0x1a')](_0x4ad142);}};}function respondWithFilteredResult(_0x27f738,_0x201e89){return function(_0x45fb5c){if(_0x45fb5c){var _0x5aca3b=typeof _0x201e89[_0x15fe('0x1b')]==='undefined'&&typeof _0x201e89[_0x15fe('0x1c')]===_0x15fe('0x1d');var _0x39f1f3=_0x45fb5c[_0x15fe('0x1e')];var _0x3458dc=_0x5aca3b?0x0:_0x201e89[_0x15fe('0x1b')];var _0x28106f=_0x5aca3b?_0x45fb5c[_0x15fe('0x1e')]:_0x201e89[_0x15fe('0x1b')]+_0x201e89[_0x15fe('0x1c')];var _0x500f25;if(_0x28106f>=_0x39f1f3){_0x28106f=_0x39f1f3;_0x500f25=0xc8;}else{_0x500f25=0xce;}_0x27f738[_0x15fe('0x18')](_0x500f25);return _0x27f738['set'](_0x15fe('0x1f'),_0x3458dc+'-'+_0x28106f+'/'+_0x39f1f3)[_0x15fe('0x1a')](_0x45fb5c);}return null;};}function patchUpdates(_0x14ef63){return function(_0x1328c9){try{jsonpatch['apply'](_0x1328c9,_0x14ef63,!![]);}catch(_0xe3ed6d){return BPromise[_0x15fe('0x20')](_0xe3ed6d);}return _0x1328c9['save']();};}function saveUpdates(_0x2212e7,_0x16cc9e){return function(_0x453e26){if(_0x453e26){return _0x453e26[_0x15fe('0x21')](_0x2212e7)[_0x15fe('0x22')](function(_0x515ffb){return _0x515ffb;});}return null;};}function removeEntity(_0x6e9e59,_0x317038){return function(_0x3912cc){if(_0x3912cc){return _0x3912cc[_0x15fe('0x23')]()[_0x15fe('0x22')](function(){_0x6e9e59[_0x15fe('0x18')](0xcc)[_0x15fe('0x19')]();});}};}function handleEntityNotFound(_0x86a791,_0x4d950b){return function(_0x482548){if(!_0x482548){_0x86a791[_0x15fe('0x17')](0x194);}return _0x482548;};}function handleError(_0x1ed5d8,_0x3f457d){_0x3f457d=_0x3f457d||0x1f4;return function(_0x1752b6){logger[_0x15fe('0x24')](_0x1752b6[_0x15fe('0x25')]);if(_0x1752b6[_0x15fe('0x26')]){delete _0x1752b6[_0x15fe('0x26')];}_0x1ed5d8[_0x15fe('0x18')](_0x3f457d)[_0x15fe('0x27')](_0x1752b6);};}exports[_0x15fe('0x28')]=function(_0x2efb62,_0x137276){var _0x5a27ec={},_0x499b30={},_0x834863={'count':0x0,'rows':[]};var _0xb50a21=_[_0x15fe('0x29')](db[_0x15fe('0x2a')][_0x15fe('0x2b')],function(_0x20dbba){return{'name':_0x20dbba['fieldName'],'type':_0x20dbba[_0x15fe('0x2c')][_0x15fe('0x2d')]};});_0x499b30[_0x15fe('0x2e')]=_['map'](_0xb50a21,_0x15fe('0x26'));_0x499b30[_0x15fe('0x2f')]=_[_0x15fe('0x30')](_0x2efb62[_0x15fe('0x2f')]);_0x499b30[_0x15fe('0x31')]=_['intersection'](_0x499b30[_0x15fe('0x2e')],_0x499b30[_0x15fe('0x2f')]);_0x5a27ec[_0x15fe('0x32')]=_[_0x15fe('0x33')](_0x499b30['model'],qs[_0x15fe('0x34')](_0x2efb62[_0x15fe('0x2f')][_0x15fe('0x34')]));_0x5a27ec[_0x15fe('0x32')]=_0x5a27ec[_0x15fe('0x32')]['length']?_0x5a27ec['attributes']:_0x499b30[_0x15fe('0x2e')];if(!_0x2efb62['query'][_0x15fe('0x35')](_0x15fe('0x36'))){_0x5a27ec[_0x15fe('0x1c')]=qs[_0x15fe('0x1c')](_0x2efb62[_0x15fe('0x2f')][_0x15fe('0x1c')]);_0x5a27ec[_0x15fe('0x1b')]=qs['offset'](_0x2efb62[_0x15fe('0x2f')][_0x15fe('0x1b')]);}_0x5a27ec['order']=qs['sort'](_0x2efb62[_0x15fe('0x2f')]['sort']);_0x5a27ec[_0x15fe('0x37')]=qs[_0x15fe('0x31')](_[_0x15fe('0x38')](_0x2efb62[_0x15fe('0x2f')],_0x499b30['filters']),_0xb50a21);if(_0x2efb62[_0x15fe('0x2f')][_0x15fe('0x39')]){_0x5a27ec[_0x15fe('0x37')]=_[_0x15fe('0x3a')](_0x5a27ec[_0x15fe('0x37')],{'$or':_[_0x15fe('0x29')](_0xb50a21,function(_0x4e40e4){if(_0x4e40e4[_0x15fe('0x2c')]!=='VIRTUAL'){var _0x1d4150={};_0x1d4150[_0x4e40e4[_0x15fe('0x26')]]={'$like':'%'+_0x2efb62[_0x15fe('0x2f')][_0x15fe('0x39')]+'%'};return _0x1d4150;}})});}_0x5a27ec=_['merge']({},_0x5a27ec,_0x2efb62[_0x15fe('0x3b')]);var _0x2debe3={'where':_0x5a27ec[_0x15fe('0x37')]};return db['ZohoAccount'][_0x15fe('0x1e')](_0x2debe3)['then'](function(_0x458fd4){_0x834863['count']=_0x458fd4;if(_0x2efb62[_0x15fe('0x2f')][_0x15fe('0x3c')]){_0x5a27ec[_0x15fe('0x3d')]=[{'all':!![]}];}return db[_0x15fe('0x2a')]['findAll'](_0x5a27ec);})[_0x15fe('0x22')](function(_0x454200){_0x834863[_0x15fe('0x3e')]=_0x454200;return _0x834863;})[_0x15fe('0x22')](respondWithFilteredResult(_0x137276,_0x5a27ec))[_0x15fe('0x3f')](handleError(_0x137276,null));};exports[_0x15fe('0x40')]=function(_0x147702,_0x11a4e8){var _0x42c873={'raw':![],'where':{'id':_0x147702[_0x15fe('0x41')]['id']}},_0x2808a8={};_0x2808a8[_0x15fe('0x2e')]=_[_0x15fe('0x30')](db['ZohoAccount'][_0x15fe('0x2b')]);_0x2808a8[_0x15fe('0x2f')]=_['keys'](_0x147702[_0x15fe('0x2f')]);_0x2808a8['filters']=_[_0x15fe('0x33')](_0x2808a8[_0x15fe('0x2e')],_0x2808a8[_0x15fe('0x2f')]);_0x42c873[_0x15fe('0x32')]=_[_0x15fe('0x33')](_0x2808a8[_0x15fe('0x2e')],qs[_0x15fe('0x34')](_0x147702[_0x15fe('0x2f')][_0x15fe('0x34')]));_0x42c873[_0x15fe('0x32')]=_0x42c873['attributes'][_0x15fe('0x42')]?_0x42c873[_0x15fe('0x32')]:_0x2808a8[_0x15fe('0x2e')];if(_0x147702[_0x15fe('0x2f')][_0x15fe('0x3c')]){_0x42c873['include']=[{'all':!![]}];}_0x42c873=_[_0x15fe('0x3a')]({},_0x42c873,_0x147702[_0x15fe('0x3b')]);return db[_0x15fe('0x2a')][_0x15fe('0x43')](_0x42c873)[_0x15fe('0x22')](handleEntityNotFound(_0x11a4e8,null))[_0x15fe('0x22')](respondWithResult(_0x11a4e8,null))[_0x15fe('0x3f')](handleError(_0x11a4e8,null));};exports[_0x15fe('0x44')]=function(_0x2a1c0f,_0x5c1fea){return db[_0x15fe('0x2a')][_0x15fe('0x44')](_0x2a1c0f[_0x15fe('0x45')],{})[_0x15fe('0x22')](respondWithResult(_0x5c1fea,0xc9))[_0x15fe('0x3f')](handleError(_0x5c1fea,null));};exports[_0x15fe('0x21')]=function(_0x365ffc,_0x15a1cd){if(_0x365ffc['body']['id']){delete _0x365ffc[_0x15fe('0x45')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x365ffc[_0x15fe('0x41')]['id']}})[_0x15fe('0x22')](handleEntityNotFound(_0x15a1cd,null))['then'](saveUpdates(_0x365ffc[_0x15fe('0x45')],null))['then'](respondWithResult(_0x15a1cd,null))[_0x15fe('0x3f')](handleError(_0x15a1cd,null));};exports['destroy']=function(_0x454a76,_0x17a5be){return db[_0x15fe('0x2a')][_0x15fe('0x43')]({'where':{'id':_0x454a76[_0x15fe('0x41')]['id']}})['then'](handleEntityNotFound(_0x17a5be,null))[_0x15fe('0x22')](removeEntity(_0x17a5be,null))[_0x15fe('0x3f')](handleError(_0x17a5be,null));};exports[_0x15fe('0x46')]=function(_0x347e00,_0x2c85fd,_0x4b12c0){var _0x5d576e={};var _0x100205={};var _0x296ebf;var _0x29893c;return db['ZohoAccount'][_0x15fe('0x47')]({'where':{'id':_0x347e00[_0x15fe('0x41')]['id']}})['then'](handleEntityNotFound(_0x2c85fd,null))[_0x15fe('0x22')](function(_0x35487c){if(_0x35487c){_0x296ebf=_0x35487c;_0x100205[_0x15fe('0x2e')]=_[_0x15fe('0x30')](db['ZohoConfiguration']['rawAttributes']);_0x100205[_0x15fe('0x2f')]=_[_0x15fe('0x30')](_0x347e00[_0x15fe('0x2f')]);_0x100205[_0x15fe('0x31')]=_[_0x15fe('0x33')](_0x100205[_0x15fe('0x2e')],_0x100205[_0x15fe('0x2f')]);_0x5d576e[_0x15fe('0x32')]=_[_0x15fe('0x33')](_0x100205[_0x15fe('0x2e')],qs['fields'](_0x347e00[_0x15fe('0x2f')][_0x15fe('0x34')]));_0x5d576e['attributes']=_0x5d576e['attributes'][_0x15fe('0x42')]?_0x5d576e['attributes']:_0x100205[_0x15fe('0x2e')];_0x5d576e[_0x15fe('0x48')]=qs[_0x15fe('0x49')](_0x347e00[_0x15fe('0x2f')][_0x15fe('0x49')]);_0x5d576e[_0x15fe('0x37')]=qs[_0x15fe('0x31')](_[_0x15fe('0x38')](_0x347e00[_0x15fe('0x2f')],_0x100205[_0x15fe('0x31')]));if(_0x347e00['query']['filter']){_0x5d576e['where']=_[_0x15fe('0x3a')](_0x5d576e[_0x15fe('0x37')],{'$or':_[_0x15fe('0x29')](_0x5d576e['attributes'],function(_0x3c8aec){var _0x16bc88={};_0x16bc88[_0x3c8aec]={'$like':'%'+_0x347e00[_0x15fe('0x2f')][_0x15fe('0x39')]+'%'};return _0x16bc88;})});}_0x5d576e=_['merge']({},_0x5d576e,_0x347e00[_0x15fe('0x3b')]);return _0x296ebf[_0x15fe('0x46')](_0x5d576e);}})[_0x15fe('0x22')](function(_0x570df5){if(_0x570df5){_0x29893c=_0x570df5[_0x15fe('0x42')];if(!_0x347e00[_0x15fe('0x2f')][_0x15fe('0x35')](_0x15fe('0x36'))){_0x5d576e[_0x15fe('0x1c')]=qs[_0x15fe('0x1c')](_0x347e00[_0x15fe('0x2f')]['limit']);_0x5d576e[_0x15fe('0x1b')]=qs['offset'](_0x347e00[_0x15fe('0x2f')]['offset']);}return _0x296ebf['getConfigurations'](_0x5d576e);}})['then'](function(_0x3e70bd){if(_0x3e70bd){return _0x3e70bd?{'count':_0x29893c,'rows':_0x3e70bd}:null;}})[_0x15fe('0x22')](respondWithResult(_0x2c85fd,null))[_0x15fe('0x3f')](handleError(_0x2c85fd,null));};exports[_0x15fe('0x4a')]=function(_0x32d899,_0x2374c1,_0x163b35){if(_0x32d899[_0x15fe('0x45')]['id']){delete _0x32d899[_0x15fe('0x45')]['id'];}return db[_0x15fe('0x2a')]['findOne']({'where':{'id':_0x32d899['params']['id']}})[_0x15fe('0x22')](handleEntityNotFound(_0x2374c1,null))['then'](function(_0x4f6b7a){if(_0x4f6b7a){_0x32d899['body'][_0x15fe('0x4b')]=_0x4f6b7a['id'];_0x32d899['body']['Subjects']=integrations[_0x15fe('0x4c')](_0x32d899[_0x15fe('0x45')]['channel'],_0x32d899[_0x15fe('0x45')][_0x15fe('0x2c')]);_0x32d899[_0x15fe('0x45')][_0x15fe('0x4d')]=integrations[_0x15fe('0x4e')](_0x32d899[_0x15fe('0x45')][_0x15fe('0x4f')],_0x32d899['body'][_0x15fe('0x2c')]);return db[_0x15fe('0x50')][_0x15fe('0x44')](_0x32d899[_0x15fe('0x45')],{'include':[{'model':db[_0x15fe('0x51')],'as':'Subjects'},{'model':db[_0x15fe('0x51')],'as':_0x15fe('0x4d')}]});}return null;})[_0x15fe('0x22')](respondWithResult(_0x2374c1,null))[_0x15fe('0x3f')](handleError(_0x2374c1,null));};function getAccessToken(_0x972594){return new Promise(function(_0x270bbf,_0x224db0){var _0x136bf0;switch(_0x972594[_0x15fe('0x52')]){case'US':_0x136bf0='https://accounts.zoho.com';break;case'AU':_0x136bf0=_0x15fe('0x53');break;case'EU':_0x136bf0='https://accounts.zoho.eu';break;case'IN':_0x136bf0=_0x15fe('0x54');break;case'CN':_0x136bf0=_0x15fe('0x55');break;default:_0x136bf0=_0x15fe('0x56');break;}var _0x38b2ec={'method':_0x15fe('0x57'),'uri':_0x136bf0+'/oauth/v2/token','qs':{'refresh_token':_0x972594['refreshToken'],'client_id':_0x972594[_0x15fe('0x58')],'client_secret':_0x972594[_0x15fe('0x59')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x38b2ec)[_0x15fe('0x22')](function(_0x25f9cf){if(_0x25f9cf[_0x15fe('0x5a')]){_0x270bbf(_0x25f9cf[_0x15fe('0x5a')]);}else{_0x224db0('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x15fe('0x3f')](function(_0xfaa69f){_0x224db0(_0xfaa69f);});});}exports[_0x15fe('0x5b')]=function(_0x3b5a18,_0xfb1555,_0x459ed4){var _0x1f7c4e,_0x2cb99a,_0x563b57,_0x4592f4,_0x5d8cb6;return db['ZohoAccount']['findOne']({'where':{'id':_0x3b5a18['params']['id']},'attributes':['id',_0x15fe('0x5c'),_0x15fe('0x52'),_0x15fe('0x58'),'clientSecret','serverUrl',_0x15fe('0x5d'),'refreshToken']})[_0x15fe('0x22')](handleEntityNotFound(_0xfb1555,null))[_0x15fe('0x22')](function(_0x5af529){_0x5d8cb6=_0x5af529;_0x1f7c4e=_0x5d8cb6[_0x15fe('0x5c')];_0x2cb99a=_0x1f7c4e==='zoho.eu'?'eu':_0x15fe('0x5e');_0x563b57=_0x5d8cb6[_0x15fe('0x5f')];var _0x1a1e82=_0x563b57['slice'](-0x1);if(_0x1a1e82==='/'||_0x1a1e82==='\x5c'||_0x1a1e82===':'){_0x563b57=_0x563b57[_0x15fe('0x60')](0x0,_0x563b57[_0x15fe('0x61')](_0x1a1e82));}if(!_0x5d8cb6[_0x15fe('0x62')]){throw new Error(_0x15fe('0x63'));}return getAccessToken(_0x5d8cb6);})['then'](function(_0x33b05c){if(_0x33b05c){return rp({'method':_0x15fe('0x64'),'uri':util[_0x15fe('0x65')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x2cb99a),'qs':{'module':_0x15fe('0x66')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x33b05c},'json':!![]});}})[_0x15fe('0x22')](function(_0x576642){if(_0x576642){if(_0x576642['response']&&_0x576642[_0x15fe('0x67')][_0x15fe('0x24')]){throw new Error(_0x576642['response'][_0x15fe('0x24')][_0x15fe('0x68')]);}var _0x1446ec=[];var _0x5ba2de=[];var _0x340b10=['Owner','Subject',_0x15fe('0x69'),_0x15fe('0x6a'),'Call_Duration',_0x15fe('0x6b'),_0x15fe('0x6c'),_0x15fe('0x6d')];_0x5ba2de=_['remove'](_0x576642[_0x15fe('0x34')],function(_0x525b98){return _0x340b10['includes'](_0x525b98[_0x15fe('0x6e')]);});for(var _0x557fbe=0x0;_0x557fbe<_0x5ba2de[_0x15fe('0x42')];_0x557fbe++){if(_0x5ba2de[_0x557fbe][_0x15fe('0x6f')]===![]){_0x1446ec['push']({'id':_0x5ba2de[_0x557fbe]['id'],'name':_0x5ba2de[_0x557fbe][_0x15fe('0x70')],'custom':_0x5ba2de[_0x557fbe][_0x15fe('0x71')],'options':_0x5ba2de[_0x557fbe]['data_type']===_0x15fe('0x72')&&_0x5ba2de[_0x557fbe][_0x15fe('0x73')][_0x15fe('0x42')]>-0x1?_[_0x15fe('0x29')](_0x5ba2de[_0x557fbe][_0x15fe('0x73')],function(_0x346c98){return{'name':_0x346c98,'value':_0x346c98};}):[]});}}return{'count':_0x1446ec[_0x15fe('0x42')],'rows':_0x1446ec};}else{return{'count':0x0,'rows':[]};}})[_0x15fe('0x22')](respondWithResult(_0xfb1555,null))[_0x15fe('0x3f')](function(_0xab437d){var _0x47129c=_0x3b5a18['query'][_0x15fe('0x74')]?0x1f4:_0xab437d[_0x15fe('0x75')]||0x1f4;logger[_0x15fe('0x24')](_0x15fe('0x76'),'getFields',_0x47129c,JSON[_0x15fe('0x77')](_0xab437d));delete _0xab437d[_0x15fe('0x26')];if(_0x47129c===0x191){_0x47129c=0x190;}_0xfb1555['status'](_0x47129c)['send'](_0x3b5a18[_0x15fe('0x2f')][_0x15fe('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0xab437d[_0x15fe('0x75')]}:_0xab437d);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 1e751ac..a84f4f1 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 _0xf1d2=['serverUrl','clientId','clientSecret','code','host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','application/x-www-form-urlencoded','then','refreshToken','refresh_token','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','/oauth/v2/token','authorization_code','parse','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','changed','zone'];(function(_0x727d78,_0x2f7912){var _0x104ce8=function(_0x4c1347){while(--_0x4c1347){_0x727d78['push'](_0x727d78['shift']());}};_0x104ce8(++_0x2f7912);}(_0xf1d2,0x11f));var _0x2f1d=function(_0x1709e7,_0x2ced21){_0x1709e7=_0x1709e7-0x0;var _0x402819=_0xf1d2[_0x1709e7];return _0x402819;};'use strict';var _=require('lodash');var util=require(_0x2f1d('0x0'));var logger=require('../../config/logger')(_0x2f1d('0x1'));var moment=require(_0x2f1d('0x2'));var BPromise=require(_0x2f1d('0x3'));var rp=require(_0x2f1d('0x4'));var fs=require('fs');var path=require(_0x2f1d('0x5'));var rimraf=require(_0x2f1d('0x6'));var config=require(_0x2f1d('0x7'));var attributes=require(_0x2f1d('0x8'));var integrations=require(_0x2f1d('0x9'));module[_0x2f1d('0xa')]=function(_0x3195d5,_0x343c83){return _0x3195d5[_0x2f1d('0xb')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x45b10f,_0x5971e0,_0x475a5f){if(_0x45b10f[_0x2f1d('0xc')](_0x2f1d('0xd'))||_0x45b10f[_0x2f1d('0xc')](_0x2f1d('0xe'))||_0x45b10f[_0x2f1d('0xc')](_0x2f1d('0xf'))||_0x45b10f['changed'](_0x2f1d('0x10'))||_0x45b10f[_0x2f1d('0xc')](_0x2f1d('0x11'))||_0x45b10f[_0x2f1d('0xc')](_0x2f1d('0x12'))){var _0x1f3659,_0x374fb2;_0x1f3659=_0x45b10f[_0x2f1d('0xe')];var _0xd5d5bd=_0x1f3659[_0x2f1d('0x13')](-0x1);if(_0xd5d5bd==='/'||_0xd5d5bd==='\x5c'||_0xd5d5bd===':'){_0x1f3659=_0x1f3659[_0x2f1d('0x14')](0x0,_0x1f3659['lastIndexOf'](_0xd5d5bd));}switch(_0x45b10f[_0x2f1d('0xd')]){case'US':_0x374fb2=_0x2f1d('0x15');break;case'AU':_0x374fb2='https://accounts.zoho.com.au';break;case'IN':_0x374fb2='https://accounts.zoho.in';break;case'CN':_0x374fb2=_0x2f1d('0x16');break;default:_0x374fb2=_0x2f1d('0x17');break;}var _0x44a932={'method':_0x2f1d('0x18'),'uri':_0x374fb2+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x45b10f[_0x2f1d('0xf')],'client_secret':_0x45b10f[_0x2f1d('0x10')],'redirect_uri':_0x45b10f['serverUrl'],'code':_0x45b10f[_0x2f1d('0x11')]},'headers':{'Content-Type':_0x2f1d('0x19')}};return rp(_0x44a932)[_0x2f1d('0x1a')](function(_0x444890){var _0x3a068e=JSON['parse'](_0x444890);if(_0x3a068e['refresh_token']){_0x45b10f[_0x2f1d('0x1b')]=_0x3a068e[_0x2f1d('0x1c')];logger[_0x2f1d('0x1d')](util[_0x2f1d('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x45b10f[_0x2f1d('0x1f')],_0x45b10f['id']));}else{logger[_0x2f1d('0x20')](util[_0x2f1d('0x1e')](_0x2f1d('0x21'),_0x45b10f[_0x2f1d('0x1f')],_0x45b10f['id']),util[_0x2f1d('0x22')](_0x3a068e,{'showHidden':![],'depth':null}));}return _0x475a5f(null,_0x5971e0);})[_0x2f1d('0x23')](function(_0x247aec){logger[_0x2f1d('0x20')](util['format'](_0x2f1d('0x21'),_0x45b10f['name'],_0x45b10f['id']),util[_0x2f1d('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x475a5f(_0x247aec);});}else{return _0x475a5f(null,_0x5971e0);}},'beforeUpdate':function(_0x826d23,_0x15120f,_0x661e25){if(_0x826d23[_0x2f1d('0xc')](_0x2f1d('0xd'))||_0x826d23[_0x2f1d('0xc')](_0x2f1d('0xe'))||_0x826d23['changed'](_0x2f1d('0xf'))||_0x826d23['changed'](_0x2f1d('0x10'))||_0x826d23['changed'](_0x2f1d('0x11'))||_0x826d23['changed'](_0x2f1d('0x12'))){var _0x8600fb,_0x18917f;_0x8600fb=_0x826d23[_0x2f1d('0xe')];var _0x353861=_0x8600fb[_0x2f1d('0x13')](-0x1);if(_0x353861==='/'||_0x353861==='\x5c'||_0x353861===':'){_0x8600fb=_0x8600fb['substring'](0x0,_0x8600fb[_0x2f1d('0x24')](_0x353861));}switch(_0x826d23['zone']){case'US':_0x18917f=_0x2f1d('0x15');break;case'AU':_0x18917f=_0x2f1d('0x25');break;case'IN':_0x18917f=_0x2f1d('0x26');break;case'CN':_0x18917f=_0x2f1d('0x16');break;default:_0x18917f=_0x2f1d('0x17');break;}var _0x3fbc8c={'method':'POST','uri':_0x18917f+_0x2f1d('0x27'),'form':{'grant_type':_0x2f1d('0x28'),'client_id':_0x826d23[_0x2f1d('0xf')],'client_secret':_0x826d23[_0x2f1d('0x10')],'redirect_uri':_0x826d23[_0x2f1d('0xe')],'code':_0x826d23[_0x2f1d('0x11')]},'headers':{'Content-Type':_0x2f1d('0x19')}};return rp(_0x3fbc8c)[_0x2f1d('0x1a')](function(_0x2bc634){var _0x1ec52d=JSON[_0x2f1d('0x29')](_0x2bc634);if(_0x1ec52d['refresh_token']){_0x826d23['refreshToken']=_0x1ec52d[_0x2f1d('0x1c')];logger[_0x2f1d('0x1d')](util[_0x2f1d('0x1e')](_0x2f1d('0x2a'),_0x826d23[_0x2f1d('0x1f')],_0x826d23['id']));}else{logger[_0x2f1d('0x20')](util['format'](_0x2f1d('0x21'),_0x826d23[_0x2f1d('0x1f')],_0x826d23['id']),util[_0x2f1d('0x22')](_0x1ec52d,{'showHidden':![],'depth':null}));}return _0x661e25(null,_0x15120f);})[_0x2f1d('0x23')](function(_0x344659){logger[_0x2f1d('0x20')](util[_0x2f1d('0x1e')](_0x2f1d('0x21'),_0x826d23[_0x2f1d('0x1f')],_0x826d23['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x661e25(_0x344659);});}else{return _0x661e25(null,_0x15120f);}}}});}; \ No newline at end of file +var _0x33a8=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','slice','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','parse','refreshToken','lodash'];(function(_0x3c0d41,_0x188e31){var _0x52a980=function(_0x8ea686){while(--_0x8ea686){_0x3c0d41['push'](_0x3c0d41['shift']());}};_0x52a980(++_0x188e31);}(_0x33a8,0xe5));var _0x833a=function(_0xadbf08,_0x4546c8){_0xadbf08=_0xadbf08-0x0;var _0x297ca7=_0x33a8[_0xadbf08];return _0x297ca7;};'use strict';var _=require(_0x833a('0x0'));var util=require(_0x833a('0x1'));var logger=require(_0x833a('0x2'))(_0x833a('0x3'));var moment=require(_0x833a('0x4'));var BPromise=require(_0x833a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x833a('0x6'));var rimraf=require(_0x833a('0x7'));var config=require(_0x833a('0x8'));var attributes=require(_0x833a('0x9'));var integrations=require(_0x833a('0xa'));module[_0x833a('0xb')]=function(_0x541358,_0xd9558){return _0x541358[_0x833a('0xc')](_0x833a('0xd'),attributes,{'tableName':_0x833a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x31c83b,_0x5d86bf,_0x551e41){if(_0x31c83b[_0x833a('0xf')](_0x833a('0x10'))||_0x31c83b[_0x833a('0xf')](_0x833a('0x11'))||_0x31c83b['changed'](_0x833a('0x12'))||_0x31c83b[_0x833a('0xf')](_0x833a('0x13'))||_0x31c83b['changed'](_0x833a('0x14'))||_0x31c83b[_0x833a('0xf')](_0x833a('0x15'))){var _0x17739c,_0x18ccc1;_0x17739c=_0x31c83b[_0x833a('0x11')];var _0x1cd3fa=_0x17739c['slice'](-0x1);if(_0x1cd3fa==='/'||_0x1cd3fa==='\x5c'||_0x1cd3fa===':'){_0x17739c=_0x17739c[_0x833a('0x16')](0x0,_0x17739c[_0x833a('0x17')](_0x1cd3fa));}switch(_0x31c83b[_0x833a('0x10')]){case'US':_0x18ccc1='https://accounts.zoho.com';break;case'AU':_0x18ccc1=_0x833a('0x18');break;case'IN':_0x18ccc1='https://accounts.zoho.in';break;case'CN':_0x18ccc1='https://accounts.zoho.com.cn';break;default:_0x18ccc1=_0x833a('0x19');break;}var _0x278276={'method':_0x833a('0x1a'),'uri':_0x18ccc1+_0x833a('0x1b'),'form':{'grant_type':_0x833a('0x1c'),'client_id':_0x31c83b['clientId'],'client_secret':_0x31c83b['clientSecret'],'redirect_uri':_0x31c83b[_0x833a('0x11')],'code':_0x31c83b[_0x833a('0x14')]},'headers':{'Content-Type':_0x833a('0x1d')}};return rp(_0x278276)[_0x833a('0x1e')](function(_0x17ef7e){var _0x262aed=JSON['parse'](_0x17ef7e);if(_0x262aed[_0x833a('0x1f')]){_0x31c83b['refreshToken']=_0x262aed[_0x833a('0x1f')];logger[_0x833a('0x20')](util[_0x833a('0x21')](_0x833a('0x22'),_0x31c83b[_0x833a('0x23')],_0x31c83b['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x31c83b[_0x833a('0x23')],_0x31c83b['id']),util[_0x833a('0x24')](_0x262aed,{'showHidden':![],'depth':null}));}return _0x551e41(null,_0x5d86bf);})[_0x833a('0x25')](function(_0x41cf7f){logger[_0x833a('0x26')](util[_0x833a('0x21')](_0x833a('0x27'),_0x31c83b[_0x833a('0x23')],_0x31c83b['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x551e41(_0x41cf7f);});}else{return _0x551e41(null,_0x5d86bf);}},'beforeUpdate':function(_0x5804d8,_0x3b15fc,_0x137a79){if(_0x5804d8['changed'](_0x833a('0x10'))||_0x5804d8[_0x833a('0xf')]('serverUrl')||_0x5804d8[_0x833a('0xf')](_0x833a('0x12'))||_0x5804d8[_0x833a('0xf')]('clientSecret')||_0x5804d8[_0x833a('0xf')]('code')||_0x5804d8[_0x833a('0xf')]('host')){var _0xb80485,_0x3657bb;_0xb80485=_0x5804d8[_0x833a('0x11')];var _0x27f400=_0xb80485[_0x833a('0x28')](-0x1);if(_0x27f400==='/'||_0x27f400==='\x5c'||_0x27f400===':'){_0xb80485=_0xb80485['substring'](0x0,_0xb80485[_0x833a('0x17')](_0x27f400));}switch(_0x5804d8[_0x833a('0x10')]){case'US':_0x3657bb=_0x833a('0x29');break;case'AU':_0x3657bb=_0x833a('0x18');break;case'IN':_0x3657bb=_0x833a('0x2a');break;case'CN':_0x3657bb=_0x833a('0x2b');break;default:_0x3657bb=_0x833a('0x19');break;}var _0x176a10={'method':_0x833a('0x1a'),'uri':_0x3657bb+_0x833a('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x5804d8[_0x833a('0x12')],'client_secret':_0x5804d8[_0x833a('0x13')],'redirect_uri':_0x5804d8[_0x833a('0x11')],'code':_0x5804d8[_0x833a('0x14')]},'headers':{'Content-Type':_0x833a('0x1d')}};return rp(_0x176a10)['then'](function(_0x5eb6cb){var _0x56bcd1=JSON[_0x833a('0x2c')](_0x5eb6cb);if(_0x56bcd1[_0x833a('0x1f')]){_0x5804d8[_0x833a('0x2d')]=_0x56bcd1[_0x833a('0x1f')];logger[_0x833a('0x20')](util['format'](_0x833a('0x22'),_0x5804d8[_0x833a('0x23')],_0x5804d8['id']));}else{logger[_0x833a('0x26')](util[_0x833a('0x21')](_0x833a('0x27'),_0x5804d8[_0x833a('0x23')],_0x5804d8['id']),util['inspect'](_0x56bcd1,{'showHidden':![],'depth':null}));}return _0x137a79(null,_0x3b15fc);})[_0x833a('0x25')](function(_0x3cfc1c){logger[_0x833a('0x26')](util[_0x833a('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5804d8[_0x833a('0x23')],_0x5804d8['id']),util[_0x833a('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x137a79(_0x3cfc1c);});}else{return _0x137a79(null,_0x3b15fc);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index bf95045..821a973 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 _0x8f4c=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','map','include','model','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x5494ab,_0x35bb9d){var _0x363a38=function(_0x2e6662){while(--_0x2e6662){_0x5494ab['push'](_0x5494ab['shift']());}};_0x363a38(++_0x35bb9d);}(_0x8f4c,0x113));var _0xc8f4=function(_0x44671c,_0x2a7436){_0x44671c=_0x44671c-0x0;var _0x5a61bc=_0x8f4c[_0x44671c];return _0x5a61bc;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')]({'raw':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1b')]===undefined?!![]:![]:!![],'where':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')]['where']||null:null,'attributes':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1c')]||null:null,'limit':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1d')]||null:null,'include':_0x108076[_0xc8f4('0x1a')]?_0x108076[_0xc8f4('0x1a')]['include']?_[_0xc8f4('0x1e')](_0x108076[_0xc8f4('0x1a')][_0xc8f4('0x1f')],function(_0x1d159e){return{'model':db[_0x1d159e['model']],'as':_0x1d159e['as'],'attributes':_0x1d159e[_0xc8f4('0x1c')],'include':_0x1d159e['include']?_[_0xc8f4('0x1e')](_0x1d159e['include'],function(_0x177a44){return{'model':db[_0x177a44[_0xc8f4('0x20')]],'as':_0x177a44['as'],'attributes':_0x177a44['attributes'],'include':_0x177a44[_0xc8f4('0x1f')]?_[_0xc8f4('0x1e')](_0x177a44[_0xc8f4('0x1f')],function(_0x2fa052){return{'model':db[_0x2fa052['model']],'as':_0x2fa052['as'],'attributes':_0x2fa052[_0xc8f4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc8f4('0xb')](function(_0x5db666){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON[_0xc8f4('0x10')](_0x5db666));_0x4763c1(_0x5db666);})[_0xc8f4('0x16')](function(_0x4a25da){logger[_0xc8f4('0x11')](_0xc8f4('0x17'),_0x4a25da[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973['error'](0x1f4,_0x4a25da[_0xc8f4('0x13')]));});});};exports[_0xc8f4('0x21')]=function(_0x5ab6cb){var _0x56ec4b=this;return new Promise(function(_0x4d6c43,_0x2717ff){return db[_0xc8f4('0x18')][_0xc8f4('0x22')]({'raw':_0x5ab6cb[_0xc8f4('0x1a')]?_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ab6cb[_0xc8f4('0x1a')]?_0x5ab6cb[_0xc8f4('0x1a')]['where']||null:null,'attributes':_0x5ab6cb[_0xc8f4('0x1a')]?_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1c')]||null:null,'include':_0x5ab6cb['options']?_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1f')]?_['map'](_0x5ab6cb[_0xc8f4('0x1a')][_0xc8f4('0x1f')],function(_0x36f24f){return{'model':db[_0x36f24f['model']],'as':_0x36f24f['as'],'attributes':_0x36f24f[_0xc8f4('0x1c')],'include':_0x36f24f[_0xc8f4('0x1f')]?_[_0xc8f4('0x1e')](_0x36f24f['include'],function(_0x1c9d57){return{'model':db[_0x1c9d57[_0xc8f4('0x20')]],'as':_0x1c9d57['as'],'attributes':_0x1c9d57[_0xc8f4('0x1c')],'include':_0x1c9d57[_0xc8f4('0x1f')]?_[_0xc8f4('0x1e')](_0x1c9d57[_0xc8f4('0x1f')],function(_0xeacb80){return{'model':db[_0xeacb80[_0xc8f4('0x20')]],'as':_0xeacb80['as'],'attributes':_0xeacb80[_0xc8f4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc8f4('0xb')](function(_0x35b516){logger[_0xc8f4('0x14')](_0xc8f4('0x21'),_0x5ab6cb);logger[_0xc8f4('0xe')](_0xc8f4('0x21'),_0x5ab6cb,JSON[_0xc8f4('0x10')](_0x35b516));_0x4d6c43(_0x35b516);})['catch'](function(_0x3a8cac){logger['error'](_0xc8f4('0x21'),_0x3a8cac['message'],_0x5ab6cb);_0x2717ff(_0x56ec4b[_0xc8f4('0x11')](0x1f4,_0x3a8cac[_0xc8f4('0x13')]));});});}; \ No newline at end of file +var _0x10ad=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetZohoAccount','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','find','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1ed8b8,_0x5255fb){var _0x4e01d3=function(_0x2b1aec){while(--_0x2b1aec){_0x1ed8b8['push'](_0x1ed8b8['shift']());}};_0x4e01d3(++_0x5255fb);}(_0x10ad,0xf4));var _0xd10a=function(_0x99b617,_0x331413){_0x99b617=_0x99b617-0x0;var _0x4d9f42=_0x10ad[_0x99b617];return _0x4d9f42;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd10a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd10a('0x1'));var db=require(_0xd10a('0x2'))['db'];var utils=require(_0xd10a('0x3'));var logger=require(_0xd10a('0x4'))('rpc');var config=require(_0xd10a('0x5'));var jayson=require(_0xd10a('0x6'));var client=jayson[_0xd10a('0x7')][_0xd10a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x429316,_0xdae354,_0x217329){return new BPromise(function(_0x194a4a,_0x5be3da){return client['request'](_0x429316,_0x217329)[_0xd10a('0x9')](function(_0x4d8613){logger[_0xd10a('0xa')](_0xd10a('0xb'),_0xdae354,_0xd10a('0xc'));logger[_0xd10a('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xdae354,_0xd10a('0xc'),JSON[_0xd10a('0xe')](_0x4d8613));if(_0x4d8613[_0xd10a('0xf')]){if(_0x4d8613['error'][_0xd10a('0x10')]===0x1f4){logger[_0xd10a('0xf')](_0xd10a('0xb'),_0xdae354,_0x4d8613[_0xd10a('0xf')][_0xd10a('0x11')]);return _0x5be3da(_0x4d8613[_0xd10a('0xf')]['message']);}logger['error'](_0xd10a('0xb'),_0xdae354,_0x4d8613[_0xd10a('0xf')][_0xd10a('0x11')]);return _0x194a4a(_0x4d8613[_0xd10a('0xf')]['message']);}else{logger['info'](_0xd10a('0xb'),_0xdae354,_0xd10a('0xc'));_0x194a4a(_0x4d8613[_0xd10a('0x12')][_0xd10a('0x11')]);}})[_0xd10a('0x13')](function(_0x33bb89){logger[_0xd10a('0xf')](_0xd10a('0xb'),_0xdae354,_0x33bb89);_0x5be3da(_0x33bb89);});});}exports[_0xd10a('0x14')]=function(_0x48a07b){var _0x589fb3=this;return new Promise(function(_0x40dd9f,_0x27d1a7){return db['ZohoAccount']['findAll']({'raw':_0x48a07b['options']?_0x48a07b[_0xd10a('0x15')][_0xd10a('0x16')]===undefined?!![]:![]:!![],'where':_0x48a07b['options']?_0x48a07b[_0xd10a('0x15')][_0xd10a('0x17')]||null:null,'attributes':_0x48a07b['options']?_0x48a07b['options'][_0xd10a('0x18')]||null:null,'limit':_0x48a07b['options']?_0x48a07b[_0xd10a('0x15')][_0xd10a('0x19')]||null:null,'include':_0x48a07b[_0xd10a('0x15')]?_0x48a07b[_0xd10a('0x15')][_0xd10a('0x1a')]?_[_0xd10a('0x1b')](_0x48a07b['options'][_0xd10a('0x1a')],function(_0x13eefe){return{'model':db[_0x13eefe[_0xd10a('0x1c')]],'as':_0x13eefe['as'],'attributes':_0x13eefe[_0xd10a('0x18')],'include':_0x13eefe[_0xd10a('0x1a')]?_[_0xd10a('0x1b')](_0x13eefe[_0xd10a('0x1a')],function(_0x3715fe){return{'model':db[_0x3715fe['model']],'as':_0x3715fe['as'],'attributes':_0x3715fe['attributes'],'include':_0x3715fe['include']?_[_0xd10a('0x1b')](_0x3715fe[_0xd10a('0x1a')],function(_0x58f500){return{'model':db[_0x58f500[_0xd10a('0x1c')]],'as':_0x58f500['as'],'attributes':_0x58f500[_0xd10a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd10a('0x9')](function(_0x152bd5){logger[_0xd10a('0xa')]('GetZohoAccount',_0x48a07b);logger[_0xd10a('0xd')](_0xd10a('0x14'),_0x48a07b,JSON[_0xd10a('0xe')](_0x152bd5));_0x40dd9f(_0x152bd5);})[_0xd10a('0x13')](function(_0x41e582){logger[_0xd10a('0xf')](_0xd10a('0x14'),_0x41e582[_0xd10a('0x11')],_0x48a07b);_0x27d1a7(_0x589fb3[_0xd10a('0xf')](0x1f4,_0x41e582[_0xd10a('0x11')]));});});};exports[_0xd10a('0x1d')]=function(_0x45e9fd){var _0x12ab07=this;return new Promise(function(_0xd7741,_0x4ad3d4){return db['ZohoAccount'][_0xd10a('0x1e')]({'raw':_0x45e9fd[_0xd10a('0x15')]?_0x45e9fd[_0xd10a('0x15')][_0xd10a('0x16')]===undefined?!![]:![]:!![],'where':_0x45e9fd[_0xd10a('0x15')]?_0x45e9fd[_0xd10a('0x15')]['where']||null:null,'attributes':_0x45e9fd[_0xd10a('0x15')]?_0x45e9fd[_0xd10a('0x15')]['attributes']||null:null,'include':_0x45e9fd['options']?_0x45e9fd[_0xd10a('0x15')][_0xd10a('0x1a')]?_[_0xd10a('0x1b')](_0x45e9fd[_0xd10a('0x15')]['include'],function(_0xa6aeeb){return{'model':db[_0xa6aeeb['model']],'as':_0xa6aeeb['as'],'attributes':_0xa6aeeb[_0xd10a('0x18')],'include':_0xa6aeeb['include']?_['map'](_0xa6aeeb[_0xd10a('0x1a')],function(_0x1bce2b){return{'model':db[_0x1bce2b[_0xd10a('0x1c')]],'as':_0x1bce2b['as'],'attributes':_0x1bce2b['attributes'],'include':_0x1bce2b[_0xd10a('0x1a')]?_['map'](_0x1bce2b[_0xd10a('0x1a')],function(_0x1ab0a2){return{'model':db[_0x1ab0a2[_0xd10a('0x1c')]],'as':_0x1ab0a2['as'],'attributes':_0x1ab0a2[_0xd10a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd10a('0x9')](function(_0x22ee6e){logger[_0xd10a('0xa')]('ShowZohoAccount',_0x45e9fd);logger[_0xd10a('0xd')](_0xd10a('0x1d'),_0x45e9fd,JSON[_0xd10a('0xe')](_0x22ee6e));_0xd7741(_0x22ee6e);})[_0xd10a('0x13')](function(_0x4997b0){logger[_0xd10a('0xf')](_0xd10a('0x1d'),_0x4997b0[_0xd10a('0x11')],_0x45e9fd);_0x4ad3d4(_0x12ab07['error'](0x1f4,_0x4997b0['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 61f8320..aa251c7 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 _0x5007=['fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','post','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x1346e9,_0x46dd15){var _0x3b4cba=function(_0x5bf3f9){while(--_0x5bf3f9){_0x1346e9['push'](_0x1346e9['shift']());}};_0x3b4cba(++_0x46dd15);}(_0x5007,0xf2));var _0x7500=function(_0x3a73a1,_0x3cc202){_0x3a73a1=_0x3a73a1-0x0;var _0x39ab34=_0x5007[_0x3a73a1];return _0x39ab34;};'use strict';var multer=require(_0x7500('0x0'));var util=require(_0x7500('0x1'));var path=require(_0x7500('0x2'));var timeout=require(_0x7500('0x3'));var express=require(_0x7500('0x4'));var router=express['Router']();var fs_extra=require(_0x7500('0x5'));var auth=require(_0x7500('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x7500('0x7')]('/',auth[_0x7500('0x8')](),controller[_0x7500('0x9')]);router[_0x7500('0x7')](_0x7500('0xa'),auth['isAuthenticated'](),controller[_0x7500('0xb')]);router[_0x7500('0x7')](_0x7500('0xc'),auth[_0x7500('0x8')](),controller[_0x7500('0xd')]);router[_0x7500('0x7')]('/:id/subjects',auth[_0x7500('0x8')](),controller['getSubjects']);router[_0x7500('0x7')](_0x7500('0xe'),auth[_0x7500('0x8')](),controller['getDescriptions']);router[_0x7500('0xf')]('/',auth[_0x7500('0x8')](),controller['create']);router[_0x7500('0x10')](_0x7500('0xa'),auth[_0x7500('0x8')](),controller[_0x7500('0x11')]);router['delete'](_0x7500('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7500('0x12')]=router; \ No newline at end of file +var _0xade3=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update'];(function(_0x282ba9,_0x25f397){var _0x135504=function(_0x8d5282){while(--_0x8d5282){_0x282ba9['push'](_0x282ba9['shift']());}};_0x135504(++_0x25f397);}(_0xade3,0xd1));var _0x3ade=function(_0x59eedc,_0x542c7d){_0x59eedc=_0x59eedc-0x0;var _0x5808b3=_0xade3[_0x59eedc];return _0x5808b3;};'use strict';var multer=require(_0x3ade('0x0'));var util=require(_0x3ade('0x1'));var path=require('path');var timeout=require(_0x3ade('0x2'));var express=require(_0x3ade('0x3'));var router=express[_0x3ade('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3ade('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3ade('0x6'));var controller=require(_0x3ade('0x7'));router[_0x3ade('0x8')]('/',auth[_0x3ade('0x9')](),controller[_0x3ade('0xa')]);router[_0x3ade('0x8')](_0x3ade('0xb'),auth['isAuthenticated'](),controller[_0x3ade('0xc')]);router[_0x3ade('0x8')](_0x3ade('0xd'),auth[_0x3ade('0x9')](),controller[_0x3ade('0xe')]);router[_0x3ade('0x8')](_0x3ade('0xf'),auth[_0x3ade('0x9')](),controller[_0x3ade('0x10')]);router[_0x3ade('0x8')](_0x3ade('0x11'),auth[_0x3ade('0x9')](),controller['getDescriptions']);router[_0x3ade('0x12')]('/',auth[_0x3ade('0x9')](),controller[_0x3ade('0x13')]);router['put'](_0x3ade('0xb'),auth['isAuthenticated'](),controller[_0x3ade('0x14')]);router['delete'](_0x3ade('0xb'),auth['isAuthenticated'](),controller[_0x3ade('0x15')]);module[_0x3ade('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index b723a8e..9e08f6d 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 _0xa9be=['nothing','contact_lead','STRING','ENUM','lead','contact'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xa9be,0x1b2));var _0xea9b=function(_0x5f2266,_0x2f9272){_0x5f2266=_0x5f2266-0x0;var _0x3d1fe5=_0xa9be[_0x5f2266];return _0x3d1fe5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xea9b('0x0')]},'moduleCreate':{'type':Sequelize[_0xea9b('0x1')](_0xea9b('0x2'),_0xea9b('0x3'),_0xea9b('0x4')),'defaultValue':_0xea9b('0x2')},'moduleSearch':{'type':Sequelize[_0xea9b('0x1')]('contact_lead',_0xea9b('0x3'),_0xea9b('0x2')),'defaultValue':_0xea9b('0x5')},'description':{'type':Sequelize[_0xea9b('0x0')]}}; \ No newline at end of file +var _0x407d=['exports','lead','contact','nothing','contact_lead','sequelize'];(function(_0x57cb7d,_0x2b1081){var _0x58907c=function(_0x32efe7){while(--_0x32efe7){_0x57cb7d['push'](_0x57cb7d['shift']());}};_0x58907c(++_0x2b1081);}(_0x407d,0x19d));var _0xd407=function(_0x405174,_0x4f3131){_0x405174=_0x405174-0x0;var _0x20fec3=_0x407d[_0x405174];return _0x20fec3;};'use strict';var Sequelize=require(_0xd407('0x0'));module[_0xd407('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0xd407('0x2'),_0xd407('0x3'),_0xd407('0x4')),'defaultValue':_0xd407('0x2')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact',_0xd407('0x2')),'defaultValue':_0xd407('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 1bbd4c2..76dc9d4 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 _0x5078=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','ZohoConfiguration','includeAll','findAll','show','params','keys','include','find','catch','create','body','update','destroy','getFields','ZohoField','length','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','end','status','json'];(function(_0x243984,_0x5dfe29){var _0x475e3e=function(_0x53a0ba){while(--_0x53a0ba){_0x243984['push'](_0x243984['shift']());}};_0x475e3e(++_0x5dfe29);}(_0x5078,0x124));var _0x8507=function(_0x3e1ccd,_0x3d3880){_0x3e1ccd=_0x3e1ccd-0x0;var _0x3e02ed=_0x5078[_0x3e1ccd];return _0x3e02ed;};'use strict';var emlformat=require(_0x8507('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8507('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8507('0x2'));var Mustache=require(_0x8507('0x3'));var util=require(_0x8507('0x4'));var path=require(_0x8507('0x5'));var sox=require(_0x8507('0x6'));var csv=require(_0x8507('0x7'));var ejs=require(_0x8507('0x8'));var fs=require('fs');var fs_extra=require(_0x8507('0x9'));var _=require(_0x8507('0xa'));var squel=require(_0x8507('0xb'));var crypto=require(_0x8507('0xc'));var jsforce=require(_0x8507('0xd'));var deskjs=require(_0x8507('0xe'));var toCsv=require(_0x8507('0x7'));var querystring=require(_0x8507('0xf'));var Papa=require(_0x8507('0x10'));var Redis=require(_0x8507('0x11'));var authService=require(_0x8507('0x12'));var qs=require(_0x8507('0x13'));var as=require(_0x8507('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8507('0x15'))(_0x8507('0x16'));var utils=require(_0x8507('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31b554,_0x1bd614){_0x1bd614=_0x1bd614||0xcc;return function(_0x523832){if(_0x523832){return _0x31b554[_0x8507('0x18')](_0x1bd614);}return _0x31b554['status'](_0x1bd614)[_0x8507('0x19')]();};}function respondWithResult(_0x137b26,_0x3a18ee){_0x3a18ee=_0x3a18ee||0xc8;return function(_0x40add8){if(_0x40add8){return _0x137b26[_0x8507('0x1a')](_0x3a18ee)[_0x8507('0x1b')](_0x40add8);}};}function respondWithFilteredResult(_0x2195d5,_0x50bef1){return function(_0xa244f2){if(_0xa244f2){var _0x4fd627=typeof _0x50bef1[_0x8507('0x1c')]===_0x8507('0x1d')&&typeof _0x50bef1[_0x8507('0x1e')]===_0x8507('0x1d');var _0x206e65=_0xa244f2[_0x8507('0x1f')];var _0x24a6c2=_0x4fd627?0x0:_0x50bef1[_0x8507('0x1c')];var _0x5aaf66=_0x4fd627?_0xa244f2[_0x8507('0x1f')]:_0x50bef1[_0x8507('0x1c')]+_0x50bef1[_0x8507('0x1e')];var _0x6baa44;if(_0x5aaf66>=_0x206e65){_0x5aaf66=_0x206e65;_0x6baa44=0xc8;}else{_0x6baa44=0xce;}_0x2195d5['status'](_0x6baa44);return _0x2195d5[_0x8507('0x20')](_0x8507('0x21'),_0x24a6c2+'-'+_0x5aaf66+'/'+_0x206e65)[_0x8507('0x1b')](_0xa244f2);}return null;};}function patchUpdates(_0x2aea34){return function(_0x3444a7){try{jsonpatch[_0x8507('0x22')](_0x3444a7,_0x2aea34,!![]);}catch(_0x360b4a){return BPromise[_0x8507('0x23')](_0x360b4a);}return _0x3444a7[_0x8507('0x24')]();};}function saveUpdates(_0x261754,_0x3b72c1){return function(_0x3b5a50){if(_0x3b5a50){return _0x3b5a50['update'](_0x261754)[_0x8507('0x25')](function(_0x415bdb){return _0x415bdb;});}return null;};}function removeEntity(_0xeb232d,_0xeafeab){return function(_0x47f029){if(_0x47f029){return _0x47f029['destroy']()['then'](function(){_0xeb232d[_0x8507('0x1a')](0xcc)[_0x8507('0x19')]();});}};}function handleEntityNotFound(_0x56c253,_0x491ffd){return function(_0x3f455d){if(!_0x3f455d){_0x56c253[_0x8507('0x18')](0x194);}return _0x3f455d;};}function handleError(_0x34b899,_0x320104){_0x320104=_0x320104||0x1f4;return function(_0x25ebc0){logger[_0x8507('0x26')](_0x25ebc0[_0x8507('0x27')]);if(_0x25ebc0[_0x8507('0x28')]){delete _0x25ebc0[_0x8507('0x28')];}_0x34b899[_0x8507('0x1a')](_0x320104)[_0x8507('0x29')](_0x25ebc0);};}exports['index']=function(_0x3e3d7d,_0x23967f){var _0x538e30={},_0x53096a={},_0x1ffd92={'count':0x0,'rows':[]};var _0x3df8fe=_[_0x8507('0x2a')](db['ZohoConfiguration'][_0x8507('0x2b')],function(_0xe69858){return{'name':_0xe69858['fieldName'],'type':_0xe69858[_0x8507('0x2c')][_0x8507('0x2d')]};});_0x53096a[_0x8507('0x2e')]=_[_0x8507('0x2a')](_0x3df8fe,_0x8507('0x28'));_0x53096a[_0x8507('0x2f')]=_['keys'](_0x3e3d7d[_0x8507('0x2f')]);_0x53096a[_0x8507('0x30')]=_[_0x8507('0x31')](_0x53096a[_0x8507('0x2e')],_0x53096a[_0x8507('0x2f')]);_0x538e30['attributes']=_[_0x8507('0x31')](_0x53096a['model'],qs[_0x8507('0x32')](_0x3e3d7d['query'][_0x8507('0x32')]));_0x538e30[_0x8507('0x33')]=_0x538e30[_0x8507('0x33')]['length']?_0x538e30[_0x8507('0x33')]:_0x53096a[_0x8507('0x2e')];if(!_0x3e3d7d['query']['hasOwnProperty'](_0x8507('0x34'))){_0x538e30[_0x8507('0x1e')]=qs[_0x8507('0x1e')](_0x3e3d7d[_0x8507('0x2f')]['limit']);_0x538e30['offset']=qs[_0x8507('0x1c')](_0x3e3d7d[_0x8507('0x2f')]['offset']);}_0x538e30[_0x8507('0x35')]=qs[_0x8507('0x36')](_0x3e3d7d[_0x8507('0x2f')]['sort']);_0x538e30[_0x8507('0x37')]=qs[_0x8507('0x30')](_[_0x8507('0x38')](_0x3e3d7d['query'],_0x53096a[_0x8507('0x30')]),_0x3df8fe);if(_0x3e3d7d[_0x8507('0x2f')][_0x8507('0x39')]){_0x538e30[_0x8507('0x37')]=_['merge'](_0x538e30['where'],{'$or':_[_0x8507('0x2a')](_0x3df8fe,function(_0x38ddd9){if(_0x38ddd9[_0x8507('0x2c')]!=='VIRTUAL'){var _0x4294a0={};_0x4294a0[_0x38ddd9['name']]={'$like':'%'+_0x3e3d7d[_0x8507('0x2f')][_0x8507('0x39')]+'%'};return _0x4294a0;}})});}_0x538e30=_[_0x8507('0x3a')]({},_0x538e30,_0x3e3d7d[_0x8507('0x3b')]);var _0x2bddde={'where':_0x538e30[_0x8507('0x37')]};return db[_0x8507('0x3c')][_0x8507('0x1f')](_0x2bddde)[_0x8507('0x25')](function(_0x230bc8){_0x1ffd92[_0x8507('0x1f')]=_0x230bc8;if(_0x3e3d7d[_0x8507('0x2f')][_0x8507('0x3d')]){_0x538e30['include']=[{'all':!![]}];}return db[_0x8507('0x3c')][_0x8507('0x3e')](_0x538e30);})[_0x8507('0x25')](function(_0xeb7358){_0x1ffd92['rows']=_0xeb7358;return _0x1ffd92;})[_0x8507('0x25')](respondWithFilteredResult(_0x23967f,_0x538e30))['catch'](handleError(_0x23967f,null));};exports[_0x8507('0x3f')]=function(_0x5ab1d0,_0x4dab02){var _0x1df6cd={'raw':![],'where':{'id':_0x5ab1d0[_0x8507('0x40')]['id']}},_0x4cbab7={};_0x4cbab7[_0x8507('0x2e')]=_[_0x8507('0x41')](db[_0x8507('0x3c')][_0x8507('0x2b')]);_0x4cbab7['query']=_[_0x8507('0x41')](_0x5ab1d0[_0x8507('0x2f')]);_0x4cbab7[_0x8507('0x30')]=_[_0x8507('0x31')](_0x4cbab7['model'],_0x4cbab7[_0x8507('0x2f')]);_0x1df6cd[_0x8507('0x33')]=_['intersection'](_0x4cbab7[_0x8507('0x2e')],qs[_0x8507('0x32')](_0x5ab1d0['query'][_0x8507('0x32')]));_0x1df6cd['attributes']=_0x1df6cd[_0x8507('0x33')]['length']?_0x1df6cd[_0x8507('0x33')]:_0x4cbab7[_0x8507('0x2e')];if(_0x5ab1d0[_0x8507('0x2f')][_0x8507('0x3d')]){_0x1df6cd[_0x8507('0x42')]=[{'all':!![]}];}_0x1df6cd=_[_0x8507('0x3a')]({},_0x1df6cd,_0x5ab1d0[_0x8507('0x3b')]);return db['ZohoConfiguration'][_0x8507('0x43')](_0x1df6cd)[_0x8507('0x25')](handleEntityNotFound(_0x4dab02,null))[_0x8507('0x25')](respondWithResult(_0x4dab02,null))[_0x8507('0x44')](handleError(_0x4dab02,null));};exports[_0x8507('0x45')]=function(_0x365cc7,_0x2224b6){return db[_0x8507('0x3c')][_0x8507('0x45')](_0x365cc7[_0x8507('0x46')],{})[_0x8507('0x25')](respondWithResult(_0x2224b6,0xc9))['catch'](handleError(_0x2224b6,null));};exports[_0x8507('0x47')]=function(_0x3c9b8a,_0x57b325){if(_0x3c9b8a['body']['id']){delete _0x3c9b8a[_0x8507('0x46')]['id'];}return db['ZohoConfiguration'][_0x8507('0x43')]({'where':{'id':_0x3c9b8a[_0x8507('0x40')]['id']}})[_0x8507('0x25')](handleEntityNotFound(_0x57b325,null))[_0x8507('0x25')](saveUpdates(_0x3c9b8a[_0x8507('0x46')],null))[_0x8507('0x25')](respondWithResult(_0x57b325,null))[_0x8507('0x44')](handleError(_0x57b325,null));};exports[_0x8507('0x48')]=function(_0x37db86,_0x26a290){return db['ZohoConfiguration'][_0x8507('0x43')]({'where':{'id':_0x37db86['params']['id']}})['then'](handleEntityNotFound(_0x26a290,null))[_0x8507('0x25')](removeEntity(_0x26a290,null))[_0x8507('0x44')](handleError(_0x26a290,null));};exports[_0x8507('0x49')]=function(_0x2a4363,_0x168489,_0x2cd502){var _0x1e749b={};var _0x3b1b65={};var _0x3fdf0b;var _0x37357d;return db[_0x8507('0x3c')]['findOne']({'where':{'id':_0x2a4363[_0x8507('0x40')]['id']}})[_0x8507('0x25')](handleEntityNotFound(_0x168489,null))[_0x8507('0x25')](function(_0x5bc4a5){if(_0x5bc4a5){_0x3fdf0b=_0x5bc4a5;_0x3b1b65['model']=_[_0x8507('0x41')](db[_0x8507('0x4a')][_0x8507('0x2b')]);_0x3b1b65['query']=_[_0x8507('0x41')](_0x2a4363[_0x8507('0x2f')]);_0x3b1b65[_0x8507('0x30')]=_['intersection'](_0x3b1b65[_0x8507('0x2e')],_0x3b1b65[_0x8507('0x2f')]);_0x1e749b[_0x8507('0x33')]=_['intersection'](_0x3b1b65[_0x8507('0x2e')],qs[_0x8507('0x32')](_0x2a4363[_0x8507('0x2f')]['fields']));_0x1e749b[_0x8507('0x33')]=_0x1e749b[_0x8507('0x33')][_0x8507('0x4b')]?_0x1e749b[_0x8507('0x33')]:_0x3b1b65[_0x8507('0x2e')];_0x1e749b[_0x8507('0x35')]=qs[_0x8507('0x36')](_0x2a4363[_0x8507('0x2f')]['sort']);_0x1e749b[_0x8507('0x37')]=qs[_0x8507('0x30')](_[_0x8507('0x38')](_0x2a4363['query'],_0x3b1b65['filters']));if(_0x2a4363[_0x8507('0x2f')][_0x8507('0x39')]){_0x1e749b[_0x8507('0x37')]=_['merge'](_0x1e749b[_0x8507('0x37')],{'$or':_[_0x8507('0x2a')](_0x1e749b[_0x8507('0x33')],function(_0x1a49fc){var _0x109544={};_0x109544[_0x1a49fc]={'$like':'%'+_0x2a4363['query'][_0x8507('0x39')]+'%'};return _0x109544;})});}_0x1e749b=_[_0x8507('0x3a')]({},_0x1e749b,_0x2a4363[_0x8507('0x3b')]);return _0x3fdf0b['getFields'](_0x1e749b);}})[_0x8507('0x25')](function(_0x206228){if(_0x206228){_0x37357d=_0x206228['length'];if(!_0x2a4363[_0x8507('0x2f')][_0x8507('0x4c')](_0x8507('0x34'))){_0x1e749b[_0x8507('0x1e')]=qs[_0x8507('0x1e')](_0x2a4363['query'][_0x8507('0x1e')]);_0x1e749b['offset']=qs[_0x8507('0x1c')](_0x2a4363['query'][_0x8507('0x1c')]);}return _0x3fdf0b[_0x8507('0x49')](_0x1e749b);}})[_0x8507('0x25')](function(_0x10a5b9){if(_0x10a5b9){return _0x10a5b9?{'count':_0x37357d,'rows':_0x10a5b9}:null;}})[_0x8507('0x25')](respondWithResult(_0x168489,null))['catch'](handleError(_0x168489,null));};exports[_0x8507('0x4d')]=function(_0x3a091d,_0x175084,_0x42a1bb){var _0x329701={};var _0x2a041b={};var _0xc17ee2;var _0x1a5aac;return db[_0x8507('0x3c')][_0x8507('0x4e')]({'where':{'id':_0x3a091d[_0x8507('0x40')]['id']}})[_0x8507('0x25')](handleEntityNotFound(_0x175084,null))[_0x8507('0x25')](function(_0x2671e3){if(_0x2671e3){_0xc17ee2=_0x2671e3;_0x2a041b[_0x8507('0x2e')]=_[_0x8507('0x41')](db[_0x8507('0x4a')][_0x8507('0x2b')]);_0x2a041b[_0x8507('0x2f')]=_[_0x8507('0x41')](_0x3a091d[_0x8507('0x2f')]);_0x2a041b['filters']=_[_0x8507('0x31')](_0x2a041b[_0x8507('0x2e')],_0x2a041b['query']);_0x329701[_0x8507('0x33')]=_[_0x8507('0x31')](_0x2a041b[_0x8507('0x2e')],qs[_0x8507('0x32')](_0x3a091d['query'][_0x8507('0x32')]));_0x329701['attributes']=_0x329701[_0x8507('0x33')][_0x8507('0x4b')]?_0x329701['attributes']:_0x2a041b[_0x8507('0x2e')];_0x329701[_0x8507('0x35')]=qs['sort'](_0x3a091d[_0x8507('0x2f')][_0x8507('0x36')]);_0x329701[_0x8507('0x37')]=qs[_0x8507('0x30')](_[_0x8507('0x38')](_0x3a091d[_0x8507('0x2f')],_0x2a041b['filters']));if(_0x3a091d['query'][_0x8507('0x39')]){_0x329701[_0x8507('0x37')]=_[_0x8507('0x3a')](_0x329701['where'],{'$or':_['map'](_0x329701['attributes'],function(_0x58f1ae){var _0x1b9458={};_0x1b9458[_0x58f1ae]={'$like':'%'+_0x3a091d['query'][_0x8507('0x39')]+'%'};return _0x1b9458;})});}_0x329701=_[_0x8507('0x3a')]({},_0x329701,_0x3a091d[_0x8507('0x3b')]);return _0xc17ee2['getSubjects'](_0x329701);}})[_0x8507('0x25')](function(_0x698096){if(_0x698096){_0x1a5aac=_0x698096[_0x8507('0x4b')];if(!_0x3a091d[_0x8507('0x2f')][_0x8507('0x4c')]('nolimit')){_0x329701[_0x8507('0x1e')]=qs[_0x8507('0x1e')](_0x3a091d[_0x8507('0x2f')]['limit']);_0x329701[_0x8507('0x1c')]=qs['offset'](_0x3a091d[_0x8507('0x2f')]['offset']);}return _0xc17ee2['getSubjects'](_0x329701);}})[_0x8507('0x25')](function(_0x36c788){if(_0x36c788){return _0x36c788?{'count':_0x1a5aac,'rows':_0x36c788}:null;}})['then'](respondWithResult(_0x175084,null))['catch'](handleError(_0x175084,null));};exports[_0x8507('0x4f')]=function(_0x20111a,_0x4ebe8f,_0x54dd7a){var _0x526da0={};var _0x33843c={};var _0x491df4;var _0x3d92b4;return db[_0x8507('0x3c')][_0x8507('0x4e')]({'where':{'id':_0x20111a[_0x8507('0x40')]['id']}})[_0x8507('0x25')](handleEntityNotFound(_0x4ebe8f,null))[_0x8507('0x25')](function(_0x13421f){if(_0x13421f){_0x491df4=_0x13421f;_0x33843c['model']=_[_0x8507('0x41')](db[_0x8507('0x4a')][_0x8507('0x2b')]);_0x33843c[_0x8507('0x2f')]=_[_0x8507('0x41')](_0x20111a[_0x8507('0x2f')]);_0x33843c['filters']=_[_0x8507('0x31')](_0x33843c[_0x8507('0x2e')],_0x33843c[_0x8507('0x2f')]);_0x526da0[_0x8507('0x33')]=_[_0x8507('0x31')](_0x33843c[_0x8507('0x2e')],qs['fields'](_0x20111a[_0x8507('0x2f')][_0x8507('0x32')]));_0x526da0[_0x8507('0x33')]=_0x526da0[_0x8507('0x33')][_0x8507('0x4b')]?_0x526da0[_0x8507('0x33')]:_0x33843c['model'];_0x526da0['order']=qs[_0x8507('0x36')](_0x20111a[_0x8507('0x2f')][_0x8507('0x36')]);_0x526da0[_0x8507('0x37')]=qs[_0x8507('0x30')](_[_0x8507('0x38')](_0x20111a[_0x8507('0x2f')],_0x33843c['filters']));if(_0x20111a[_0x8507('0x2f')][_0x8507('0x39')]){_0x526da0[_0x8507('0x37')]=_[_0x8507('0x3a')](_0x526da0[_0x8507('0x37')],{'$or':_['map'](_0x526da0[_0x8507('0x33')],function(_0x25aa29){var _0x3f1e84={};_0x3f1e84[_0x25aa29]={'$like':'%'+_0x20111a[_0x8507('0x2f')][_0x8507('0x39')]+'%'};return _0x3f1e84;})});}_0x526da0=_[_0x8507('0x3a')]({},_0x526da0,_0x20111a['options']);return _0x491df4['getDescriptions'](_0x526da0);}})['then'](function(_0x387fcb){if(_0x387fcb){_0x3d92b4=_0x387fcb[_0x8507('0x4b')];if(!_0x20111a['query'][_0x8507('0x4c')]('nolimit')){_0x526da0['limit']=qs[_0x8507('0x1e')](_0x20111a[_0x8507('0x2f')][_0x8507('0x1e')]);_0x526da0['offset']=qs[_0x8507('0x1c')](_0x20111a['query'][_0x8507('0x1c')]);}return _0x491df4[_0x8507('0x4f')](_0x526da0);}})['then'](function(_0x462cbf){if(_0x462cbf){return _0x462cbf?{'count':_0x3d92b4,'rows':_0x462cbf}:null;}})[_0x8507('0x25')](respondWithResult(_0x4ebe8f,null))[_0x8507('0x44')](handleError(_0x4ebe8f,null));}; \ No newline at end of file +var _0x60b1=['squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','send','map','rawAttributes','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ZohoConfiguration','rows','show','find','catch','create','body','params','getFields','findOne','ZohoField','sort','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x5ae319,_0x62bcf2){var _0x3b0ab1=function(_0x23c9d6){while(--_0x23c9d6){_0x5ae319['push'](_0x5ae319['shift']());}};_0x3b0ab1(++_0x62bcf2);}(_0x60b1,0x91));var _0x160b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x60b1[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x160b('0x0'));var zipdir=require(_0x160b('0x1'));var jsonpatch=require(_0x160b('0x2'));var rp=require(_0x160b('0x3'));var moment=require(_0x160b('0x4'));var BPromise=require(_0x160b('0x5'));var Mustache=require(_0x160b('0x6'));var util=require('util');var path=require(_0x160b('0x7'));var sox=require(_0x160b('0x8'));var csv=require(_0x160b('0x9'));var ejs=require(_0x160b('0xa'));var fs=require('fs');var fs_extra=require(_0x160b('0xb'));var _=require(_0x160b('0xc'));var squel=require(_0x160b('0xd'));var crypto=require('crypto');var jsforce=require(_0x160b('0xe'));var deskjs=require(_0x160b('0xf'));var toCsv=require(_0x160b('0x9'));var querystring=require(_0x160b('0x10'));var Papa=require('papaparse');var Redis=require(_0x160b('0x11'));var authService=require(_0x160b('0x12'));var qs=require(_0x160b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x160b('0x14'));var logger=require(_0x160b('0x15'))(_0x160b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x160b('0x17'));var db=require(_0x160b('0x18'))['db'];function respondWithStatusCode(_0x46448a,_0x421745){_0x421745=_0x421745||0xcc;return function(_0x176983){if(_0x176983){return _0x46448a[_0x160b('0x19')](_0x421745);}return _0x46448a[_0x160b('0x1a')](_0x421745)[_0x160b('0x1b')]();};}function respondWithResult(_0x15c19d,_0x4f6ec3){_0x4f6ec3=_0x4f6ec3||0xc8;return function(_0x1407a6){if(_0x1407a6){return _0x15c19d[_0x160b('0x1a')](_0x4f6ec3)[_0x160b('0x1c')](_0x1407a6);}};}function respondWithFilteredResult(_0x17bf7e,_0xbc778e){return function(_0x5e85a6){if(_0x5e85a6){var _0x3e1610=typeof _0xbc778e['offset']===_0x160b('0x1d')&&typeof _0xbc778e['limit']===_0x160b('0x1d');var _0x323bc0=_0x5e85a6[_0x160b('0x1e')];var _0x213030=_0x3e1610?0x0:_0xbc778e[_0x160b('0x1f')];var _0x13b013=_0x3e1610?_0x5e85a6[_0x160b('0x1e')]:_0xbc778e['offset']+_0xbc778e['limit'];var _0x563177;if(_0x13b013>=_0x323bc0){_0x13b013=_0x323bc0;_0x563177=0xc8;}else{_0x563177=0xce;}_0x17bf7e[_0x160b('0x1a')](_0x563177);return _0x17bf7e['set'](_0x160b('0x20'),_0x213030+'-'+_0x13b013+'/'+_0x323bc0)[_0x160b('0x1c')](_0x5e85a6);}return null;};}function patchUpdates(_0x5d9371){return function(_0x4c927e){try{jsonpatch[_0x160b('0x21')](_0x4c927e,_0x5d9371,!![]);}catch(_0x2c0eaa){return BPromise[_0x160b('0x22')](_0x2c0eaa);}return _0x4c927e[_0x160b('0x23')]();};}function saveUpdates(_0x4a4feb,_0x15d136){return function(_0xb54ee4){if(_0xb54ee4){return _0xb54ee4[_0x160b('0x24')](_0x4a4feb)[_0x160b('0x25')](function(_0x3bc291){return _0x3bc291;});}return null;};}function removeEntity(_0x559166,_0x170dff){return function(_0x4c6d38){if(_0x4c6d38){return _0x4c6d38[_0x160b('0x26')]()['then'](function(){_0x559166[_0x160b('0x1a')](0xcc)[_0x160b('0x1b')]();});}};}function handleEntityNotFound(_0x30dc10,_0x24c22f){return function(_0x4d65db){if(!_0x4d65db){_0x30dc10[_0x160b('0x19')](0x194);}return _0x4d65db;};}function handleError(_0x2f663c,_0x4689b8){_0x4689b8=_0x4689b8||0x1f4;return function(_0x3dd90b){logger[_0x160b('0x27')](_0x3dd90b['stack']);if(_0x3dd90b['name']){delete _0x3dd90b['name'];}_0x2f663c['status'](_0x4689b8)[_0x160b('0x28')](_0x3dd90b);};}exports['index']=function(_0x414548,_0x2c06c0){var _0x184ea0={},_0x1aafb6={},_0x9fdac={'count':0x0,'rows':[]};var _0x32e058=_[_0x160b('0x29')](db['ZohoConfiguration'][_0x160b('0x2a')],function(_0x55b9ea){return{'name':_0x55b9ea['fieldName'],'type':_0x55b9ea[_0x160b('0x2b')]['key']};});_0x1aafb6[_0x160b('0x2c')]=_[_0x160b('0x29')](_0x32e058,_0x160b('0x2d'));_0x1aafb6[_0x160b('0x2e')]=_[_0x160b('0x2f')](_0x414548['query']);_0x1aafb6[_0x160b('0x30')]=_[_0x160b('0x31')](_0x1aafb6[_0x160b('0x2c')],_0x1aafb6[_0x160b('0x2e')]);_0x184ea0[_0x160b('0x32')]=_[_0x160b('0x31')](_0x1aafb6[_0x160b('0x2c')],qs[_0x160b('0x33')](_0x414548['query'][_0x160b('0x33')]));_0x184ea0['attributes']=_0x184ea0['attributes'][_0x160b('0x34')]?_0x184ea0[_0x160b('0x32')]:_0x1aafb6[_0x160b('0x2c')];if(!_0x414548[_0x160b('0x2e')][_0x160b('0x35')](_0x160b('0x36'))){_0x184ea0[_0x160b('0x37')]=qs[_0x160b('0x37')](_0x414548[_0x160b('0x2e')]['limit']);_0x184ea0[_0x160b('0x1f')]=qs[_0x160b('0x1f')](_0x414548[_0x160b('0x2e')][_0x160b('0x1f')]);}_0x184ea0[_0x160b('0x38')]=qs['sort'](_0x414548['query']['sort']);_0x184ea0[_0x160b('0x39')]=qs[_0x160b('0x30')](_[_0x160b('0x3a')](_0x414548[_0x160b('0x2e')],_0x1aafb6['filters']),_0x32e058);if(_0x414548['query'][_0x160b('0x3b')]){_0x184ea0[_0x160b('0x39')]=_[_0x160b('0x3c')](_0x184ea0['where'],{'$or':_[_0x160b('0x29')](_0x32e058,function(_0x2e135c){if(_0x2e135c[_0x160b('0x2b')]!==_0x160b('0x3d')){var _0x4865b7={};_0x4865b7[_0x2e135c[_0x160b('0x2d')]]={'$like':'%'+_0x414548['query'][_0x160b('0x3b')]+'%'};return _0x4865b7;}})});}_0x184ea0=_[_0x160b('0x3c')]({},_0x184ea0,_0x414548[_0x160b('0x3e')]);var _0x407f6a={'where':_0x184ea0[_0x160b('0x39')]};return db['ZohoConfiguration'][_0x160b('0x1e')](_0x407f6a)[_0x160b('0x25')](function(_0x27e279){_0x9fdac['count']=_0x27e279;if(_0x414548[_0x160b('0x2e')][_0x160b('0x3f')]){_0x184ea0[_0x160b('0x40')]=[{'all':!![]}];}return db[_0x160b('0x41')]['findAll'](_0x184ea0);})[_0x160b('0x25')](function(_0xacccab){_0x9fdac[_0x160b('0x42')]=_0xacccab;return _0x9fdac;})[_0x160b('0x25')](respondWithFilteredResult(_0x2c06c0,_0x184ea0))['catch'](handleError(_0x2c06c0,null));};exports[_0x160b('0x43')]=function(_0x4a851f,_0x51e351){var _0x3953b1={'raw':![],'where':{'id':_0x4a851f['params']['id']}},_0x33c2af={};_0x33c2af['model']=_['keys'](db[_0x160b('0x41')][_0x160b('0x2a')]);_0x33c2af['query']=_[_0x160b('0x2f')](_0x4a851f['query']);_0x33c2af[_0x160b('0x30')]=_[_0x160b('0x31')](_0x33c2af[_0x160b('0x2c')],_0x33c2af[_0x160b('0x2e')]);_0x3953b1[_0x160b('0x32')]=_['intersection'](_0x33c2af[_0x160b('0x2c')],qs[_0x160b('0x33')](_0x4a851f[_0x160b('0x2e')][_0x160b('0x33')]));_0x3953b1[_0x160b('0x32')]=_0x3953b1[_0x160b('0x32')][_0x160b('0x34')]?_0x3953b1['attributes']:_0x33c2af[_0x160b('0x2c')];if(_0x4a851f[_0x160b('0x2e')][_0x160b('0x3f')]){_0x3953b1['include']=[{'all':!![]}];}_0x3953b1=_[_0x160b('0x3c')]({},_0x3953b1,_0x4a851f['options']);return db[_0x160b('0x41')][_0x160b('0x44')](_0x3953b1)[_0x160b('0x25')](handleEntityNotFound(_0x51e351,null))[_0x160b('0x25')](respondWithResult(_0x51e351,null))[_0x160b('0x45')](handleError(_0x51e351,null));};exports[_0x160b('0x46')]=function(_0x449b40,_0x45ccb7){return db[_0x160b('0x41')][_0x160b('0x46')](_0x449b40['body'],{})[_0x160b('0x25')](respondWithResult(_0x45ccb7,0xc9))[_0x160b('0x45')](handleError(_0x45ccb7,null));};exports[_0x160b('0x24')]=function(_0x44a34b,_0x564869){if(_0x44a34b['body']['id']){delete _0x44a34b[_0x160b('0x47')]['id'];}return db[_0x160b('0x41')][_0x160b('0x44')]({'where':{'id':_0x44a34b[_0x160b('0x48')]['id']}})[_0x160b('0x25')](handleEntityNotFound(_0x564869,null))[_0x160b('0x25')](saveUpdates(_0x44a34b['body'],null))[_0x160b('0x25')](respondWithResult(_0x564869,null))[_0x160b('0x45')](handleError(_0x564869,null));};exports[_0x160b('0x26')]=function(_0x104efb,_0x44ecfc){return db[_0x160b('0x41')]['find']({'where':{'id':_0x104efb['params']['id']}})[_0x160b('0x25')](handleEntityNotFound(_0x44ecfc,null))[_0x160b('0x25')](removeEntity(_0x44ecfc,null))['catch'](handleError(_0x44ecfc,null));};exports[_0x160b('0x49')]=function(_0x345f7b,_0x5113d3,_0x5f018b){var _0x280d86={};var _0x1bf5c9={};var _0x50c1c3;var _0x497c88;return db[_0x160b('0x41')][_0x160b('0x4a')]({'where':{'id':_0x345f7b[_0x160b('0x48')]['id']}})['then'](handleEntityNotFound(_0x5113d3,null))[_0x160b('0x25')](function(_0x14d89a){if(_0x14d89a){_0x50c1c3=_0x14d89a;_0x1bf5c9['model']=_[_0x160b('0x2f')](db[_0x160b('0x4b')][_0x160b('0x2a')]);_0x1bf5c9[_0x160b('0x2e')]=_['keys'](_0x345f7b[_0x160b('0x2e')]);_0x1bf5c9['filters']=_[_0x160b('0x31')](_0x1bf5c9[_0x160b('0x2c')],_0x1bf5c9[_0x160b('0x2e')]);_0x280d86[_0x160b('0x32')]=_[_0x160b('0x31')](_0x1bf5c9[_0x160b('0x2c')],qs[_0x160b('0x33')](_0x345f7b[_0x160b('0x2e')][_0x160b('0x33')]));_0x280d86['attributes']=_0x280d86[_0x160b('0x32')][_0x160b('0x34')]?_0x280d86[_0x160b('0x32')]:_0x1bf5c9[_0x160b('0x2c')];_0x280d86['order']=qs[_0x160b('0x4c')](_0x345f7b['query'][_0x160b('0x4c')]);_0x280d86[_0x160b('0x39')]=qs[_0x160b('0x30')](_[_0x160b('0x3a')](_0x345f7b[_0x160b('0x2e')],_0x1bf5c9[_0x160b('0x30')]));if(_0x345f7b[_0x160b('0x2e')][_0x160b('0x3b')]){_0x280d86[_0x160b('0x39')]=_[_0x160b('0x3c')](_0x280d86['where'],{'$or':_[_0x160b('0x29')](_0x280d86['attributes'],function(_0x516fec){var _0x226016={};_0x226016[_0x516fec]={'$like':'%'+_0x345f7b[_0x160b('0x2e')][_0x160b('0x3b')]+'%'};return _0x226016;})});}_0x280d86=_[_0x160b('0x3c')]({},_0x280d86,_0x345f7b[_0x160b('0x3e')]);return _0x50c1c3[_0x160b('0x49')](_0x280d86);}})['then'](function(_0x314f55){if(_0x314f55){_0x497c88=_0x314f55[_0x160b('0x34')];if(!_0x345f7b[_0x160b('0x2e')][_0x160b('0x35')]('nolimit')){_0x280d86[_0x160b('0x37')]=qs[_0x160b('0x37')](_0x345f7b[_0x160b('0x2e')][_0x160b('0x37')]);_0x280d86[_0x160b('0x1f')]=qs[_0x160b('0x1f')](_0x345f7b[_0x160b('0x2e')][_0x160b('0x1f')]);}return _0x50c1c3[_0x160b('0x49')](_0x280d86);}})[_0x160b('0x25')](function(_0x53c027){if(_0x53c027){return _0x53c027?{'count':_0x497c88,'rows':_0x53c027}:null;}})['then'](respondWithResult(_0x5113d3,null))[_0x160b('0x45')](handleError(_0x5113d3,null));};exports[_0x160b('0x4d')]=function(_0x5926eb,_0xdd9897,_0x38e7bc){var _0x579fd5={};var _0x29350d={};var _0x39298a;var _0x2469e8;return db[_0x160b('0x41')][_0x160b('0x4a')]({'where':{'id':_0x5926eb[_0x160b('0x48')]['id']}})[_0x160b('0x25')](handleEntityNotFound(_0xdd9897,null))[_0x160b('0x25')](function(_0x306beb){if(_0x306beb){_0x39298a=_0x306beb;_0x29350d[_0x160b('0x2c')]=_[_0x160b('0x2f')](db[_0x160b('0x4b')][_0x160b('0x2a')]);_0x29350d['query']=_[_0x160b('0x2f')](_0x5926eb[_0x160b('0x2e')]);_0x29350d[_0x160b('0x30')]=_[_0x160b('0x31')](_0x29350d[_0x160b('0x2c')],_0x29350d[_0x160b('0x2e')]);_0x579fd5[_0x160b('0x32')]=_[_0x160b('0x31')](_0x29350d['model'],qs[_0x160b('0x33')](_0x5926eb[_0x160b('0x2e')][_0x160b('0x33')]));_0x579fd5[_0x160b('0x32')]=_0x579fd5[_0x160b('0x32')]['length']?_0x579fd5[_0x160b('0x32')]:_0x29350d[_0x160b('0x2c')];_0x579fd5[_0x160b('0x38')]=qs[_0x160b('0x4c')](_0x5926eb[_0x160b('0x2e')]['sort']);_0x579fd5[_0x160b('0x39')]=qs[_0x160b('0x30')](_[_0x160b('0x3a')](_0x5926eb[_0x160b('0x2e')],_0x29350d[_0x160b('0x30')]));if(_0x5926eb[_0x160b('0x2e')]['filter']){_0x579fd5[_0x160b('0x39')]=_['merge'](_0x579fd5[_0x160b('0x39')],{'$or':_[_0x160b('0x29')](_0x579fd5[_0x160b('0x32')],function(_0x59e06b){var _0x19ee3d={};_0x19ee3d[_0x59e06b]={'$like':'%'+_0x5926eb['query'][_0x160b('0x3b')]+'%'};return _0x19ee3d;})});}_0x579fd5=_[_0x160b('0x3c')]({},_0x579fd5,_0x5926eb[_0x160b('0x3e')]);return _0x39298a[_0x160b('0x4d')](_0x579fd5);}})[_0x160b('0x25')](function(_0x46e784){if(_0x46e784){_0x2469e8=_0x46e784[_0x160b('0x34')];if(!_0x5926eb['query'][_0x160b('0x35')](_0x160b('0x36'))){_0x579fd5['limit']=qs[_0x160b('0x37')](_0x5926eb[_0x160b('0x2e')][_0x160b('0x37')]);_0x579fd5[_0x160b('0x1f')]=qs[_0x160b('0x1f')](_0x5926eb[_0x160b('0x2e')][_0x160b('0x1f')]);}return _0x39298a[_0x160b('0x4d')](_0x579fd5);}})[_0x160b('0x25')](function(_0x5141a6){if(_0x5141a6){return _0x5141a6?{'count':_0x2469e8,'rows':_0x5141a6}:null;}})['then'](respondWithResult(_0xdd9897,null))['catch'](handleError(_0xdd9897,null));};exports[_0x160b('0x4e')]=function(_0x32e64a,_0xf5bd5a,_0x20c5b1){var _0xe4eb3e={};var _0x3535d1={};var _0x4dfd21;var _0x183366;return db[_0x160b('0x41')][_0x160b('0x4a')]({'where':{'id':_0x32e64a[_0x160b('0x48')]['id']}})[_0x160b('0x25')](handleEntityNotFound(_0xf5bd5a,null))[_0x160b('0x25')](function(_0x33fda0){if(_0x33fda0){_0x4dfd21=_0x33fda0;_0x3535d1['model']=_['keys'](db[_0x160b('0x4b')]['rawAttributes']);_0x3535d1[_0x160b('0x2e')]=_[_0x160b('0x2f')](_0x32e64a[_0x160b('0x2e')]);_0x3535d1[_0x160b('0x30')]=_[_0x160b('0x31')](_0x3535d1[_0x160b('0x2c')],_0x3535d1[_0x160b('0x2e')]);_0xe4eb3e[_0x160b('0x32')]=_[_0x160b('0x31')](_0x3535d1[_0x160b('0x2c')],qs[_0x160b('0x33')](_0x32e64a['query'][_0x160b('0x33')]));_0xe4eb3e[_0x160b('0x32')]=_0xe4eb3e[_0x160b('0x32')][_0x160b('0x34')]?_0xe4eb3e[_0x160b('0x32')]:_0x3535d1[_0x160b('0x2c')];_0xe4eb3e[_0x160b('0x38')]=qs[_0x160b('0x4c')](_0x32e64a[_0x160b('0x2e')]['sort']);_0xe4eb3e['where']=qs[_0x160b('0x30')](_['pick'](_0x32e64a[_0x160b('0x2e')],_0x3535d1[_0x160b('0x30')]));if(_0x32e64a[_0x160b('0x2e')][_0x160b('0x3b')]){_0xe4eb3e[_0x160b('0x39')]=_['merge'](_0xe4eb3e['where'],{'$or':_[_0x160b('0x29')](_0xe4eb3e[_0x160b('0x32')],function(_0x4824c7){var _0x42c6df={};_0x42c6df[_0x4824c7]={'$like':'%'+_0x32e64a[_0x160b('0x2e')][_0x160b('0x3b')]+'%'};return _0x42c6df;})});}_0xe4eb3e=_[_0x160b('0x3c')]({},_0xe4eb3e,_0x32e64a[_0x160b('0x3e')]);return _0x4dfd21[_0x160b('0x4e')](_0xe4eb3e);}})['then'](function(_0x33615f){if(_0x33615f){_0x183366=_0x33615f[_0x160b('0x34')];if(!_0x32e64a[_0x160b('0x2e')][_0x160b('0x35')](_0x160b('0x36'))){_0xe4eb3e[_0x160b('0x37')]=qs[_0x160b('0x37')](_0x32e64a['query'][_0x160b('0x37')]);_0xe4eb3e[_0x160b('0x1f')]=qs[_0x160b('0x1f')](_0x32e64a['query'][_0x160b('0x1f')]);}return _0x4dfd21[_0x160b('0x4e')](_0xe4eb3e);}})[_0x160b('0x25')](function(_0x1de6b3){if(_0x1de6b3){return _0x1de6b3?{'count':_0x183366,'rows':_0x1de6b3}:null;}})['then'](respondWithResult(_0xf5bd5a,null))[_0x160b('0x45')](handleError(_0xf5bd5a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 399632a..15d7b13 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 _0x0e57=['moment','request-promise','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x124041,_0x4d585a){var _0x153145=function(_0x505cb4){while(--_0x505cb4){_0x124041['push'](_0x124041['shift']());}};_0x153145(++_0x4d585a);}(_0x0e57,0x98));var _0x70e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e57[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x70e5('0x0'));var util=require(_0x70e5('0x1'));var logger=require(_0x70e5('0x2'))(_0x70e5('0x3'));var moment=require(_0x70e5('0x4'));var BPromise=require('bluebird');var rp=require(_0x70e5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x70e5('0x6'));var attributes=require(_0x70e5('0x7'));module[_0x70e5('0x8')]=function(_0x567d8c,_0x44bcab){return _0x567d8c[_0x70e5('0x9')](_0x70e5('0xa'),attributes,{'tableName':_0x70e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7971=['bluebird','request-promise','rimraf','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x1e1ecf,_0x175529){var _0x52be90=function(_0x2da012){while(--_0x2da012){_0x1e1ecf['push'](_0x1e1ecf['shift']());}};_0x52be90(++_0x175529);}(_0x7971,0x19f));var _0x1797=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7971[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x1797('0x0'));var util=require(_0x1797('0x1'));var logger=require(_0x1797('0x2'))(_0x1797('0x3'));var moment=require(_0x1797('0x4'));var BPromise=require(_0x1797('0x5'));var rp=require(_0x1797('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1797('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x1797('0x8')]=function(_0x148e8c,_0x549dc3){return _0x148e8c[_0x1797('0x9')](_0x1797('0xa'),attributes,{'tableName':_0x1797('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 123e1ef..c4454ee 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 _0x3524=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error'];(function(_0x39399f,_0x286482){var _0xde5cc6=function(_0x3880ac){while(--_0x3880ac){_0x39399f['push'](_0x39399f['shift']());}};_0xde5cc6(++_0x286482);}(_0x3524,0x1b8));var _0x4352=function(_0x10cdf6,_0x4b8187){_0x10cdf6=_0x10cdf6-0x0;var _0x13bd25=_0x3524[_0x10cdf6];return _0x13bd25;};'use strict';var _=require('lodash');var util=require(_0x4352('0x0'));var moment=require('moment');var BPromise=require(_0x4352('0x1'));var rs=require(_0x4352('0x2'));var fs=require('fs');var Redis=require(_0x4352('0x3'));var db=require(_0x4352('0x4'))['db'];var utils=require(_0x4352('0x5'));var logger=require('../../config/logger')(_0x4352('0x6'));var config=require(_0x4352('0x7'));var jayson=require(_0x4352('0x8'));var client=jayson[_0x4352('0x9')][_0x4352('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33ff3c,_0xefec66,_0x1769e9){return new BPromise(function(_0xb813e2,_0xeae20b){return client[_0x4352('0xb')](_0x33ff3c,_0x1769e9)[_0x4352('0xc')](function(_0x4629c7){logger[_0x4352('0xd')](_0x4352('0xe'),_0xefec66,'request\x20sent');logger['debug'](_0x4352('0xf'),_0xefec66,_0x4352('0x10'),JSON[_0x4352('0x11')](_0x4629c7));if(_0x4629c7['error']){if(_0x4629c7['error'][_0x4352('0x12')]===0x1f4){logger[_0x4352('0x13')](_0x4352('0xe'),_0xefec66,_0x4629c7[_0x4352('0x13')][_0x4352('0x14')]);return _0xeae20b(_0x4629c7[_0x4352('0x13')][_0x4352('0x14')]);}logger[_0x4352('0x13')](_0x4352('0xe'),_0xefec66,_0x4629c7[_0x4352('0x13')]['message']);return _0xb813e2(_0x4629c7[_0x4352('0x13')][_0x4352('0x14')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0xefec66,_0x4352('0x10'));_0xb813e2(_0x4629c7[_0x4352('0x15')]['message']);}})[_0x4352('0x16')](function(_0x504965){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0xefec66,_0x504965);_0xeae20b(_0x504965);});});} \ No newline at end of file +var _0x3add=['info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','debug','request\x20sent','stringify','code','error','ZohoConfiguration,\x20%s,\x20%s','message'];(function(_0x322e7f,_0x3bb5ca){var _0x4d06c3=function(_0x519a3f){while(--_0x519a3f){_0x322e7f['push'](_0x322e7f['shift']());}};_0x4d06c3(++_0x3bb5ca);}(_0x3add,0x1a6));var _0xd3ad=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0x3add[_0x272638];return _0x19d027;};'use strict';var _=require('lodash');var util=require(_0xd3ad('0x0'));var moment=require(_0xd3ad('0x1'));var BPromise=require(_0xd3ad('0x2'));var rs=require(_0xd3ad('0x3'));var fs=require('fs');var Redis=require(_0xd3ad('0x4'));var db=require(_0xd3ad('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3ad('0x6'))(_0xd3ad('0x7'));var config=require(_0xd3ad('0x8'));var jayson=require(_0xd3ad('0x9'));var client=jayson['client'][_0xd3ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5833be,_0x4efa5a,_0x447f96){return new BPromise(function(_0x386565,_0x5864cf){return client['request'](_0x5833be,_0x447f96)[_0xd3ad('0xb')](function(_0x3cb5fb){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x4efa5a,'request\x20sent');logger[_0xd3ad('0xc')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4efa5a,_0xd3ad('0xd'),JSON[_0xd3ad('0xe')](_0x3cb5fb));if(_0x3cb5fb['error']){if(_0x3cb5fb['error'][_0xd3ad('0xf')]===0x1f4){logger[_0xd3ad('0x10')](_0xd3ad('0x11'),_0x4efa5a,_0x3cb5fb[_0xd3ad('0x10')][_0xd3ad('0x12')]);return _0x5864cf(_0x3cb5fb[_0xd3ad('0x10')][_0xd3ad('0x12')]);}logger[_0xd3ad('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x4efa5a,_0x3cb5fb['error'][_0xd3ad('0x12')]);return _0x386565(_0x3cb5fb[_0xd3ad('0x10')][_0xd3ad('0x12')]);}else{logger[_0xd3ad('0x13')](_0xd3ad('0x11'),_0x4efa5a,_0xd3ad('0xd'));_0x386565(_0x3cb5fb['result'][_0xd3ad('0x12')]);}})[_0xd3ad('0x14')](function(_0x47672a){logger[_0xd3ad('0x10')](_0xd3ad('0x11'),_0x4efa5a,_0x47672a);_0x5864cf(_0x47672a);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 03b60ca..18a48cf 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 _0xacf3=['show','create','put','/:id','update','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','isAuthenticated'];(function(_0x2c525d,_0x456533){var _0xacedfc=function(_0x20807e){while(--_0x20807e){_0x2c525d['push'](_0x2c525d['shift']());}};_0xacedfc(++_0x456533);}(_0xacf3,0x115));var _0x3acf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xacf3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3acf('0x0'));var timeout=require(_0x3acf('0x1'));var express=require(_0x3acf('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3acf('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3acf('0x4'));var controller=require('./intZohoField.controller');router[_0x3acf('0x5')]('/',auth['isAuthenticated'](),controller[_0x3acf('0x6')]);router['get']('/:id',auth[_0x3acf('0x7')](),controller[_0x3acf('0x8')]);router['post']('/',auth[_0x3acf('0x7')](),controller[_0x3acf('0x9')]);router[_0x3acf('0xa')](_0x3acf('0xb'),auth[_0x3acf('0x7')](),controller[_0x3acf('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3acf('0xd')]);module[_0x3acf('0xe')]=router; \ No newline at end of file +var _0x8aca=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2c49bf,_0x41be3c){var _0x59cbc1=function(_0x358e4d){while(--_0x358e4d){_0x2c49bf['push'](_0x2c49bf['shift']());}};_0x59cbc1(++_0x41be3c);}(_0x8aca,0xbd));var _0xa8ac=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x8aca[_0x193e28];return _0x20ef59;};'use strict';var multer=require(_0xa8ac('0x0'));var util=require(_0xa8ac('0x1'));var path=require(_0xa8ac('0x2'));var timeout=require('connect-timeout');var express=require(_0xa8ac('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa8ac('0x4'));var interaction=require(_0xa8ac('0x5'));var config=require(_0xa8ac('0x6'));var controller=require(_0xa8ac('0x7'));router['get']('/',auth[_0xa8ac('0x8')](),controller['index']);router['get']('/:id',auth[_0xa8ac('0x8')](),controller['show']);router[_0xa8ac('0x9')]('/',auth[_0xa8ac('0x8')](),controller[_0xa8ac('0xa')]);router[_0xa8ac('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa8ac('0xc')]);router[_0xa8ac('0xd')]('/:id',auth[_0xa8ac('0x8')](),controller[_0xa8ac('0xe')]);module[_0xa8ac('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 42726b5..d5f0ade 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 _0x4c0a=['exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x1541c6,_0x170408){var _0x41901b=function(_0x517db0){while(--_0x517db0){_0x1541c6['push'](_0x1541c6['shift']());}};_0x41901b(++_0x170408);}(_0x4c0a,0xd8));var _0xa4c0=function(_0x2e3207,_0x45ffe2){_0x2e3207=_0x2e3207-0x0;var _0x50a529=_0x4c0a[_0x2e3207];return _0x50a529;};'use strict';var Sequelize=require('sequelize');module[_0xa4c0('0x0')]={'type':{'type':Sequelize[_0xa4c0('0x1')](_0xa4c0('0x2'),_0xa4c0('0x3'),'customVariable',_0xa4c0('0x4'),_0xa4c0('0x5')),'defaultValue':_0xa4c0('0x2')},'content':{'type':Sequelize[_0xa4c0('0x6')]},'key':{'type':Sequelize[_0xa4c0('0x6')]},'keyType':{'type':Sequelize[_0xa4c0('0x1')](_0xa4c0('0x2'),_0xa4c0('0x3'),_0xa4c0('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa4c0('0x6')]},'nameField':{'type':Sequelize[_0xa4c0('0x6')]},'customField':{'type':Sequelize[_0xa4c0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa4c0('0x6')]}}; \ No newline at end of file +var _0x30cf=['keyValue','picklist','string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x3e95ec,_0x1977c9){var _0x456abf=function(_0x5ec0c3){while(--_0x5ec0c3){_0x3e95ec['push'](_0x3e95ec['shift']());}};_0x456abf(++_0x1977c9);}(_0x30cf,0x88));var _0xf30c=function(_0x240f93,_0x3f19d7){_0x240f93=_0x240f93-0x0;var _0x305452=_0x30cf[_0x240f93];return _0x305452;};'use strict';var Sequelize=require(_0xf30c('0x0'));module[_0xf30c('0x1')]={'type':{'type':Sequelize[_0xf30c('0x2')]('string',_0xf30c('0x3'),'customVariable',_0xf30c('0x4'),_0xf30c('0x5')),'defaultValue':_0xf30c('0x6')},'content':{'type':Sequelize[_0xf30c('0x7')]},'key':{'type':Sequelize[_0xf30c('0x7')]},'keyType':{'type':Sequelize[_0xf30c('0x2')](_0xf30c('0x6'),_0xf30c('0x3'),_0xf30c('0x8'))},'keyContent':{'type':Sequelize[_0xf30c('0x7')]},'idField':{'type':Sequelize[_0xf30c('0x7')]},'nameField':{'type':Sequelize[_0xf30c('0x7')]},'customField':{'type':Sequelize[_0xf30c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf30c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index f70599f..d8e1798 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 _0x2716=['moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','include','catch','show','includeAll','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x21a11d,_0x18d8ec){var _0x474e50=function(_0x45d33b){while(--_0x45d33b){_0x21a11d['push'](_0x21a11d['shift']());}};_0x474e50(++_0x18d8ec);}(_0x2716,0xd4));var _0x6271=function(_0x2573f7,_0x1200bc){_0x2573f7=_0x2573f7-0x0;var _0x57740d=_0x2716[_0x2573f7];return _0x57740d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6271('0x0'));var zipdir=require(_0x6271('0x1'));var jsonpatch=require(_0x6271('0x2'));var rp=require(_0x6271('0x3'));var moment=require(_0x6271('0x4'));var BPromise=require(_0x6271('0x5'));var Mustache=require(_0x6271('0x6'));var util=require(_0x6271('0x7'));var path=require('path');var sox=require(_0x6271('0x8'));var csv=require(_0x6271('0x9'));var ejs=require(_0x6271('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6271('0xb'));var squel=require(_0x6271('0xc'));var crypto=require(_0x6271('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6271('0xe'));var toCsv=require(_0x6271('0x9'));var querystring=require(_0x6271('0xf'));var Papa=require(_0x6271('0x10'));var Redis=require(_0x6271('0x11'));var authService=require(_0x6271('0x12'));var qs=require(_0x6271('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6271('0x14'));var logger=require(_0x6271('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x6271('0x16'));var licenseUtil=require(_0x6271('0x17'));var db=require(_0x6271('0x18'))['db'];function respondWithStatusCode(_0x5e62a8,_0x229b96){_0x229b96=_0x229b96||0xcc;return function(_0x20139b){if(_0x20139b){return _0x5e62a8[_0x6271('0x19')](_0x229b96);}return _0x5e62a8['status'](_0x229b96)[_0x6271('0x1a')]();};}function respondWithResult(_0x3fc7fa,_0x3ba2b7){_0x3ba2b7=_0x3ba2b7||0xc8;return function(_0x22ec6b){if(_0x22ec6b){return _0x3fc7fa[_0x6271('0x1b')](_0x3ba2b7)['json'](_0x22ec6b);}};}function respondWithFilteredResult(_0x445219,_0x13cc1f){return function(_0x42c771){if(_0x42c771){var _0x34366e=typeof _0x13cc1f['offset']===_0x6271('0x1c')&&typeof _0x13cc1f[_0x6271('0x1d')]===_0x6271('0x1c');var _0xca1470=_0x42c771[_0x6271('0x1e')];var _0xdf5031=_0x34366e?0x0:_0x13cc1f['offset'];var _0x3a1da5=_0x34366e?_0x42c771[_0x6271('0x1e')]:_0x13cc1f['offset']+_0x13cc1f[_0x6271('0x1d')];var _0x16836c;if(_0x3a1da5>=_0xca1470){_0x3a1da5=_0xca1470;_0x16836c=0xc8;}else{_0x16836c=0xce;}_0x445219[_0x6271('0x1b')](_0x16836c);return _0x445219[_0x6271('0x1f')](_0x6271('0x20'),_0xdf5031+'-'+_0x3a1da5+'/'+_0xca1470)[_0x6271('0x21')](_0x42c771);}return null;};}function patchUpdates(_0x2f4c5e){return function(_0x33d976){try{jsonpatch[_0x6271('0x22')](_0x33d976,_0x2f4c5e,!![]);}catch(_0x187b5c){return BPromise['reject'](_0x187b5c);}return _0x33d976[_0x6271('0x23')]();};}function saveUpdates(_0xb81ec9,_0x5cf34d){return function(_0x4ffd3f){if(_0x4ffd3f){return _0x4ffd3f[_0x6271('0x24')](_0xb81ec9)[_0x6271('0x25')](function(_0x35294d){return _0x35294d;});}return null;};}function removeEntity(_0x1cea6c,_0x386dc7){return function(_0x43b93a){if(_0x43b93a){return _0x43b93a[_0x6271('0x26')]()['then'](function(){_0x1cea6c[_0x6271('0x1b')](0xcc)[_0x6271('0x1a')]();});}};}function handleEntityNotFound(_0x359221,_0x329a34){return function(_0x22a76b){if(!_0x22a76b){_0x359221[_0x6271('0x19')](0x194);}return _0x22a76b;};}function handleError(_0x4105a4,_0x42f10f){_0x42f10f=_0x42f10f||0x1f4;return function(_0x3b4e6c){logger['error'](_0x3b4e6c['stack']);if(_0x3b4e6c[_0x6271('0x27')]){delete _0x3b4e6c[_0x6271('0x27')];}_0x4105a4['status'](_0x42f10f)['send'](_0x3b4e6c);};}exports[_0x6271('0x28')]=function(_0x260b4e,_0x6b7489){var _0x4b3385={},_0x1b828a={},_0x3ba0d0={'count':0x0,'rows':[]};var _0x45e54a=_[_0x6271('0x29')](db[_0x6271('0x2a')][_0x6271('0x2b')],function(_0x45c166){return{'name':_0x45c166[_0x6271('0x2c')],'type':_0x45c166[_0x6271('0x2d')][_0x6271('0x2e')]};});_0x1b828a[_0x6271('0x2f')]=_[_0x6271('0x29')](_0x45e54a,_0x6271('0x27'));_0x1b828a['query']=_[_0x6271('0x30')](_0x260b4e[_0x6271('0x31')]);_0x1b828a[_0x6271('0x32')]=_['intersection'](_0x1b828a['model'],_0x1b828a['query']);_0x4b3385[_0x6271('0x33')]=_[_0x6271('0x34')](_0x1b828a[_0x6271('0x2f')],qs[_0x6271('0x35')](_0x260b4e[_0x6271('0x31')][_0x6271('0x35')]));_0x4b3385[_0x6271('0x33')]=_0x4b3385[_0x6271('0x33')][_0x6271('0x36')]?_0x4b3385[_0x6271('0x33')]:_0x1b828a[_0x6271('0x2f')];if(!_0x260b4e[_0x6271('0x31')][_0x6271('0x37')](_0x6271('0x38'))){_0x4b3385[_0x6271('0x1d')]=qs['limit'](_0x260b4e['query'][_0x6271('0x1d')]);_0x4b3385['offset']=qs[_0x6271('0x39')](_0x260b4e[_0x6271('0x31')][_0x6271('0x39')]);}_0x4b3385[_0x6271('0x3a')]=qs[_0x6271('0x3b')](_0x260b4e[_0x6271('0x31')]['sort']);_0x4b3385[_0x6271('0x3c')]=qs['filters'](_[_0x6271('0x3d')](_0x260b4e['query'],_0x1b828a[_0x6271('0x32')]),_0x45e54a);if(_0x260b4e[_0x6271('0x31')][_0x6271('0x3e')]){_0x4b3385[_0x6271('0x3c')]=_[_0x6271('0x3f')](_0x4b3385[_0x6271('0x3c')],{'$or':_[_0x6271('0x29')](_0x45e54a,function(_0x4197d6){if(_0x4197d6['type']!=='VIRTUAL'){var _0x3fb69c={};_0x3fb69c[_0x4197d6[_0x6271('0x27')]]={'$like':'%'+_0x260b4e['query'][_0x6271('0x3e')]+'%'};return _0x3fb69c;}})});}_0x4b3385=_[_0x6271('0x3f')]({},_0x4b3385,_0x260b4e['options']);var _0x539e0e={'where':_0x4b3385[_0x6271('0x3c')]};return db['ZohoField'][_0x6271('0x1e')](_0x539e0e)[_0x6271('0x25')](function(_0xc95c42){_0x3ba0d0[_0x6271('0x1e')]=_0xc95c42;if(_0x260b4e[_0x6271('0x31')]['includeAll']){_0x4b3385[_0x6271('0x40')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x4b3385);})['then'](function(_0x31571d){_0x3ba0d0['rows']=_0x31571d;return _0x3ba0d0;})[_0x6271('0x25')](respondWithFilteredResult(_0x6b7489,_0x4b3385))[_0x6271('0x41')](handleError(_0x6b7489,null));};exports[_0x6271('0x42')]=function(_0x207d19,_0x243ae4){var _0x2e7dc8={'raw':!![],'where':{'id':_0x207d19['params']['id']}},_0xc6c1a1={};_0xc6c1a1['model']=_['keys'](db[_0x6271('0x2a')][_0x6271('0x2b')]);_0xc6c1a1[_0x6271('0x31')]=_[_0x6271('0x30')](_0x207d19[_0x6271('0x31')]);_0xc6c1a1[_0x6271('0x32')]=_[_0x6271('0x34')](_0xc6c1a1[_0x6271('0x2f')],_0xc6c1a1[_0x6271('0x31')]);_0x2e7dc8[_0x6271('0x33')]=_[_0x6271('0x34')](_0xc6c1a1[_0x6271('0x2f')],qs[_0x6271('0x35')](_0x207d19['query']['fields']));_0x2e7dc8[_0x6271('0x33')]=_0x2e7dc8[_0x6271('0x33')][_0x6271('0x36')]?_0x2e7dc8['attributes']:_0xc6c1a1[_0x6271('0x2f')];if(_0x207d19[_0x6271('0x31')][_0x6271('0x43')]){_0x2e7dc8['include']=[{'all':!![]}];}_0x2e7dc8=_[_0x6271('0x3f')]({},_0x2e7dc8,_0x207d19['options']);return db[_0x6271('0x2a')][_0x6271('0x44')](_0x2e7dc8)[_0x6271('0x25')](handleEntityNotFound(_0x243ae4,null))[_0x6271('0x25')](respondWithResult(_0x243ae4,null))[_0x6271('0x41')](handleError(_0x243ae4,null));};exports[_0x6271('0x45')]=function(_0x213098,_0x3b7bec){return db[_0x6271('0x2a')][_0x6271('0x45')](_0x213098[_0x6271('0x46')],{})[_0x6271('0x25')](respondWithResult(_0x3b7bec,0xc9))['catch'](handleError(_0x3b7bec,null));};exports[_0x6271('0x24')]=function(_0x473928,_0x21956f){if(_0x473928['body']['id']){delete _0x473928[_0x6271('0x46')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x473928['params']['id']}})[_0x6271('0x25')](handleEntityNotFound(_0x21956f,null))[_0x6271('0x25')](saveUpdates(_0x473928[_0x6271('0x46')],null))[_0x6271('0x25')](respondWithResult(_0x21956f,null))[_0x6271('0x41')](handleError(_0x21956f,null));};exports['destroy']=function(_0x3e8705,_0x356af9){return db['ZohoField'][_0x6271('0x44')]({'where':{'id':_0x3e8705[_0x6271('0x47')]['id']}})[_0x6271('0x25')](handleEntityNotFound(_0x356af9,null))[_0x6271('0x25')](removeEntity(_0x356af9,null))[_0x6271('0x41')](handleError(_0x356af9,null));}; \ No newline at end of file +var _0x225b=['name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','destroy','then','end','error','stack'];(function(_0x185369,_0x46be46){var _0x4b98ba=function(_0x40bbb4){while(--_0x40bbb4){_0x185369['push'](_0x185369['shift']());}};_0x4b98ba(++_0x46be46);}(_0x225b,0xb1));var _0xb225=function(_0x222e82,_0x476db9){_0x222e82=_0x222e82-0x0;var _0x4ea340=_0x225b[_0x222e82];return _0x4ea340;};'use strict';var emlformat=require(_0xb225('0x0'));var rimraf=require(_0xb225('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb225('0x2'));var rp=require(_0xb225('0x3'));var moment=require('moment');var BPromise=require(_0xb225('0x4'));var Mustache=require('mustache');var util=require(_0xb225('0x5'));var path=require('path');var sox=require(_0xb225('0x6'));var csv=require(_0xb225('0x7'));var ejs=require(_0xb225('0x8'));var fs=require('fs');var fs_extra=require(_0xb225('0x9'));var _=require(_0xb225('0xa'));var squel=require(_0xb225('0xb'));var crypto=require(_0xb225('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb225('0xd'));var toCsv=require(_0xb225('0x7'));var querystring=require(_0xb225('0xe'));var Papa=require(_0xb225('0xf'));var Redis=require('ioredis');var authService=require(_0xb225('0x10'));var qs=require(_0xb225('0x11'));var as=require(_0xb225('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb225('0x13'))(_0xb225('0x14'));var utils=require(_0xb225('0x15'));var config=require(_0xb225('0x16'));var licenseUtil=require(_0xb225('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2916e5,_0xd09413){_0xd09413=_0xd09413||0xcc;return function(_0x396c4e){if(_0x396c4e){return _0x2916e5[_0xb225('0x18')](_0xd09413);}return _0x2916e5[_0xb225('0x19')](_0xd09413)['end']();};}function respondWithResult(_0x53624f,_0x28f330){_0x28f330=_0x28f330||0xc8;return function(_0x897e1c){if(_0x897e1c){return _0x53624f[_0xb225('0x19')](_0x28f330)[_0xb225('0x1a')](_0x897e1c);}};}function respondWithFilteredResult(_0x2b5202,_0x3a640b){return function(_0x44d32d){if(_0x44d32d){var _0x2be9b4=typeof _0x3a640b[_0xb225('0x1b')]===_0xb225('0x1c')&&typeof _0x3a640b[_0xb225('0x1d')]===_0xb225('0x1c');var _0x5ccb06=_0x44d32d[_0xb225('0x1e')];var _0x5bd9e8=_0x2be9b4?0x0:_0x3a640b[_0xb225('0x1b')];var _0x10a0b6=_0x2be9b4?_0x44d32d[_0xb225('0x1e')]:_0x3a640b[_0xb225('0x1b')]+_0x3a640b[_0xb225('0x1d')];var _0x212aea;if(_0x10a0b6>=_0x5ccb06){_0x10a0b6=_0x5ccb06;_0x212aea=0xc8;}else{_0x212aea=0xce;}_0x2b5202[_0xb225('0x19')](_0x212aea);return _0x2b5202['set']('Content-Range',_0x5bd9e8+'-'+_0x10a0b6+'/'+_0x5ccb06)[_0xb225('0x1a')](_0x44d32d);}return null;};}function patchUpdates(_0x1ec7ae){return function(_0x24c854){try{jsonpatch['apply'](_0x24c854,_0x1ec7ae,!![]);}catch(_0x4d40cf){return BPromise[_0xb225('0x1f')](_0x4d40cf);}return _0x24c854[_0xb225('0x20')]();};}function saveUpdates(_0x34ec68,_0x12f00a){return function(_0x8e76be){if(_0x8e76be){return _0x8e76be[_0xb225('0x21')](_0x34ec68)['then'](function(_0x3c6029){return _0x3c6029;});}return null;};}function removeEntity(_0x556ebf,_0x535522){return function(_0x3c323b){if(_0x3c323b){return _0x3c323b[_0xb225('0x22')]()[_0xb225('0x23')](function(){_0x556ebf[_0xb225('0x19')](0xcc)[_0xb225('0x24')]();});}};}function handleEntityNotFound(_0x420330,_0xf90a8b){return function(_0x5d11ff){if(!_0x5d11ff){_0x420330['sendStatus'](0x194);}return _0x5d11ff;};}function handleError(_0x5c8195,_0x26ae38){_0x26ae38=_0x26ae38||0x1f4;return function(_0x12e2b9){logger[_0xb225('0x25')](_0x12e2b9[_0xb225('0x26')]);if(_0x12e2b9[_0xb225('0x27')]){delete _0x12e2b9['name'];}_0x5c8195[_0xb225('0x19')](_0x26ae38)[_0xb225('0x28')](_0x12e2b9);};}exports[_0xb225('0x29')]=function(_0x41bf0d,_0x4200f9){var _0x2b69cb={},_0x5a6eff={},_0x3ac1b4={'count':0x0,'rows':[]};var _0x7ffb03=_[_0xb225('0x2a')](db[_0xb225('0x2b')][_0xb225('0x2c')],function(_0x378724){return{'name':_0x378724[_0xb225('0x2d')],'type':_0x378724[_0xb225('0x2e')][_0xb225('0x2f')]};});_0x5a6eff[_0xb225('0x30')]=_[_0xb225('0x2a')](_0x7ffb03,'name');_0x5a6eff[_0xb225('0x31')]=_[_0xb225('0x32')](_0x41bf0d['query']);_0x5a6eff[_0xb225('0x33')]=_['intersection'](_0x5a6eff[_0xb225('0x30')],_0x5a6eff[_0xb225('0x31')]);_0x2b69cb[_0xb225('0x34')]=_[_0xb225('0x35')](_0x5a6eff[_0xb225('0x30')],qs[_0xb225('0x36')](_0x41bf0d[_0xb225('0x31')][_0xb225('0x36')]));_0x2b69cb[_0xb225('0x34')]=_0x2b69cb['attributes'][_0xb225('0x37')]?_0x2b69cb['attributes']:_0x5a6eff[_0xb225('0x30')];if(!_0x41bf0d['query']['hasOwnProperty'](_0xb225('0x38'))){_0x2b69cb[_0xb225('0x1d')]=qs[_0xb225('0x1d')](_0x41bf0d[_0xb225('0x31')]['limit']);_0x2b69cb[_0xb225('0x1b')]=qs[_0xb225('0x1b')](_0x41bf0d[_0xb225('0x31')][_0xb225('0x1b')]);}_0x2b69cb[_0xb225('0x39')]=qs[_0xb225('0x3a')](_0x41bf0d[_0xb225('0x31')][_0xb225('0x3a')]);_0x2b69cb['where']=qs['filters'](_[_0xb225('0x3b')](_0x41bf0d['query'],_0x5a6eff[_0xb225('0x33')]),_0x7ffb03);if(_0x41bf0d[_0xb225('0x31')]['filter']){_0x2b69cb[_0xb225('0x3c')]=_[_0xb225('0x3d')](_0x2b69cb['where'],{'$or':_[_0xb225('0x2a')](_0x7ffb03,function(_0x257cdb){if(_0x257cdb[_0xb225('0x2e')]!==_0xb225('0x3e')){var _0x1a1253={};_0x1a1253[_0x257cdb['name']]={'$like':'%'+_0x41bf0d[_0xb225('0x31')][_0xb225('0x3f')]+'%'};return _0x1a1253;}})});}_0x2b69cb=_['merge']({},_0x2b69cb,_0x41bf0d[_0xb225('0x40')]);var _0x26078a={'where':_0x2b69cb[_0xb225('0x3c')]};return db['ZohoField']['count'](_0x26078a)['then'](function(_0x5e4cad){_0x3ac1b4[_0xb225('0x1e')]=_0x5e4cad;if(_0x41bf0d[_0xb225('0x31')]['includeAll']){_0x2b69cb['include']=[{'all':!![]}];}return db[_0xb225('0x2b')]['findAll'](_0x2b69cb);})[_0xb225('0x23')](function(_0x152eb3){_0x3ac1b4[_0xb225('0x41')]=_0x152eb3;return _0x3ac1b4;})['then'](respondWithFilteredResult(_0x4200f9,_0x2b69cb))[_0xb225('0x42')](handleError(_0x4200f9,null));};exports['show']=function(_0x416f36,_0x1a6784){var _0x3b5f98={'raw':!![],'where':{'id':_0x416f36[_0xb225('0x43')]['id']}},_0x276a8c={};_0x276a8c[_0xb225('0x30')]=_[_0xb225('0x32')](db[_0xb225('0x2b')]['rawAttributes']);_0x276a8c[_0xb225('0x31')]=_[_0xb225('0x32')](_0x416f36[_0xb225('0x31')]);_0x276a8c[_0xb225('0x33')]=_[_0xb225('0x35')](_0x276a8c['model'],_0x276a8c[_0xb225('0x31')]);_0x3b5f98[_0xb225('0x34')]=_[_0xb225('0x35')](_0x276a8c[_0xb225('0x30')],qs[_0xb225('0x36')](_0x416f36[_0xb225('0x31')]['fields']));_0x3b5f98[_0xb225('0x34')]=_0x3b5f98[_0xb225('0x34')][_0xb225('0x37')]?_0x3b5f98[_0xb225('0x34')]:_0x276a8c['model'];if(_0x416f36[_0xb225('0x31')][_0xb225('0x44')]){_0x3b5f98['include']=[{'all':!![]}];}_0x3b5f98=_[_0xb225('0x3d')]({},_0x3b5f98,_0x416f36[_0xb225('0x40')]);return db[_0xb225('0x2b')][_0xb225('0x45')](_0x3b5f98)['then'](handleEntityNotFound(_0x1a6784,null))['then'](respondWithResult(_0x1a6784,null))['catch'](handleError(_0x1a6784,null));};exports[_0xb225('0x46')]=function(_0x29c9e0,_0x20bde5){return db['ZohoField'][_0xb225('0x46')](_0x29c9e0['body'],{})[_0xb225('0x23')](respondWithResult(_0x20bde5,0xc9))[_0xb225('0x42')](handleError(_0x20bde5,null));};exports[_0xb225('0x21')]=function(_0x4f23fb,_0x512c7e){if(_0x4f23fb[_0xb225('0x47')]['id']){delete _0x4f23fb[_0xb225('0x47')]['id'];}return db[_0xb225('0x2b')][_0xb225('0x45')]({'where':{'id':_0x4f23fb[_0xb225('0x43')]['id']}})['then'](handleEntityNotFound(_0x512c7e,null))[_0xb225('0x23')](saveUpdates(_0x4f23fb['body'],null))['then'](respondWithResult(_0x512c7e,null))[_0xb225('0x42')](handleError(_0x512c7e,null));};exports[_0xb225('0x22')]=function(_0x59ea13,_0x54cd0e){return db[_0xb225('0x2b')]['find']({'where':{'id':_0x59ea13[_0xb225('0x43')]['id']}})[_0xb225('0x23')](handleEntityNotFound(_0x54cd0e,null))[_0xb225('0x23')](removeEntity(_0x54cd0e,null))[_0xb225('0x42')](handleError(_0x54cd0e,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 491e664..db0769a 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 _0xf61e=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index'];(function(_0x1ab13e,_0x44507a){var _0xa28f8=function(_0x231213){while(--_0x231213){_0x1ab13e['push'](_0x1ab13e['shift']());}};_0xa28f8(++_0x44507a);}(_0xf61e,0x191));var _0xef61=function(_0x594030,_0x219e30){_0x594030=_0x594030-0x0;var _0x231a29=_0xf61e[_0x594030];return _0x231a29;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('ZohoField',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[{'name':_0xef61('0xe'),'fields':[_0xef61('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb11=['bluebird','path','../../config/environment','./intZohoField.attributes','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x137ade,_0xae42be){var _0x5303db=function(_0x517f01){while(--_0x517f01){_0x137ade['push'](_0x137ade['shift']());}};_0x5303db(++_0xae42be);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xfb11[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var logger=require(_0x1fb1('0x1'))(_0x1fb1('0x2'));var moment=require('moment');var BPromise=require(_0x1fb1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb1('0x4'));var rimraf=require('rimraf');var config=require(_0x1fb1('0x5'));var attributes=require(_0x1fb1('0x6'));module['exports']=function(_0x25d44f,_0x133727){return _0x25d44f['define'](_0x1fb1('0x7'),attributes,{'tableName':_0x1fb1('0x8'),'paranoid':![],'indexes':[{'name':_0x1fb1('0x9'),'fields':[_0x1fb1('0xa'),_0x1fb1('0xb')],'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 633ba61..2246608 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 _0x9eb5=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x18ef0d,_0x5378f0){var _0x1cb21a=function(_0x19c455){while(--_0x19c455){_0x18ef0d['push'](_0x18ef0d['shift']());}};_0x1cb21a(++_0x5378f0);}(_0x9eb5,0x160));var _0x59eb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9eb5[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x59eb('0x0'));var moment=require(_0x59eb('0x1'));var BPromise=require(_0x59eb('0x2'));var rs=require(_0x59eb('0x3'));var fs=require('fs');var Redis=require(_0x59eb('0x4'));var db=require(_0x59eb('0x5'))['db'];var utils=require(_0x59eb('0x6'));var logger=require('../../config/logger')(_0x59eb('0x7'));var config=require(_0x59eb('0x8'));var jayson=require(_0x59eb('0x9'));var client=jayson[_0x59eb('0xa')][_0x59eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fb2a5,_0x296027,_0x3c0bc5){return new BPromise(function(_0x130f03,_0xb4e141){return client['request'](_0x4fb2a5,_0x3c0bc5)[_0x59eb('0xc')](function(_0xcc6ad7){logger[_0x59eb('0xd')](_0x59eb('0xe'),_0x296027,_0x59eb('0xf'));logger[_0x59eb('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x296027,_0x59eb('0xf'),JSON[_0x59eb('0x11')](_0xcc6ad7));if(_0xcc6ad7[_0x59eb('0x12')]){if(_0xcc6ad7[_0x59eb('0x12')]['code']===0x1f4){logger['error'](_0x59eb('0xe'),_0x296027,_0xcc6ad7[_0x59eb('0x12')][_0x59eb('0x13')]);return _0xb4e141(_0xcc6ad7[_0x59eb('0x12')]['message']);}logger[_0x59eb('0x12')](_0x59eb('0xe'),_0x296027,_0xcc6ad7['error'][_0x59eb('0x13')]);return _0x130f03(_0xcc6ad7['error'][_0x59eb('0x13')]);}else{logger[_0x59eb('0xd')](_0x59eb('0xe'),_0x296027,_0x59eb('0xf'));_0x130f03(_0xcc6ad7[_0x59eb('0x14')][_0x59eb('0x13')]);}})['catch'](function(_0x270256){logger[_0x59eb('0x12')](_0x59eb('0xe'),_0x296027,_0x270256);_0xb4e141(_0x270256);});});} \ No newline at end of file +var _0xa884=['client','http','request','then','info','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2278e8,_0x21f45d){var _0xf31b76=function(_0x36715f){while(--_0x36715f){_0x2278e8['push'](_0x2278e8['shift']());}};_0xf31b76(++_0x21f45d);}(_0xa884,0x15e));var _0x4a88=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0xa884[_0x650e11];return _0x1a9b47;};'use strict';var _=require(_0x4a88('0x0'));var util=require(_0x4a88('0x1'));var moment=require(_0x4a88('0x2'));var BPromise=require(_0x4a88('0x3'));var rs=require(_0x4a88('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4a88('0x5'));var logger=require(_0x4a88('0x6'))(_0x4a88('0x7'));var config=require(_0x4a88('0x8'));var jayson=require(_0x4a88('0x9'));var client=jayson[_0x4a88('0xa')][_0x4a88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6d09,_0x1bbd40,_0x57392d){return new BPromise(function(_0x42b069,_0x5e7d69){return client[_0x4a88('0xc')](_0x4c6d09,_0x57392d)[_0x4a88('0xd')](function(_0x2b3731){logger[_0x4a88('0xe')]('ZohoField,\x20%s,\x20%s',_0x1bbd40,_0x4a88('0xf'));logger['debug'](_0x4a88('0x10'),_0x1bbd40,_0x4a88('0xf'),JSON[_0x4a88('0x11')](_0x2b3731));if(_0x2b3731['error']){if(_0x2b3731[_0x4a88('0x12')][_0x4a88('0x13')]===0x1f4){logger[_0x4a88('0x12')](_0x4a88('0x14'),_0x1bbd40,_0x2b3731[_0x4a88('0x12')][_0x4a88('0x15')]);return _0x5e7d69(_0x2b3731[_0x4a88('0x12')][_0x4a88('0x15')]);}logger[_0x4a88('0x12')](_0x4a88('0x14'),_0x1bbd40,_0x2b3731[_0x4a88('0x12')][_0x4a88('0x15')]);return _0x42b069(_0x2b3731[_0x4a88('0x12')][_0x4a88('0x15')]);}else{logger['info'](_0x4a88('0x14'),_0x1bbd40,'request\x20sent');_0x42b069(_0x2b3731[_0x4a88('0x16')]['message']);}})[_0x4a88('0x17')](function(_0x865847){logger[_0x4a88('0x12')](_0x4a88('0x14'),_0x1bbd40,_0x865847);_0x5e7d69(_0x865847);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 0353dd3..3429b6b 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(_0x392781,_0x44c019){var _0x26420c=function(_0x2298be){while(--_0x2298be){_0x392781['push'](_0x392781['shift']());}};_0x26420c(++_0x44c019);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3c1f7d,_0x11949c){var _0x40cad6=function(_0x177409){while(--_0x177409){_0x3c1f7d['push'](_0x3c1f7d['shift']());}};_0x40cad6(++_0x11949c);}(_0xe706,0xa3));var _0x6e70=function(_0xbed58e,_0x3a1272){_0xbed58e=_0xbed58e-0x0;var _0x295e44=_0xe706[_0xbed58e];return _0x295e44;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index da8ebdc..725f249 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 _0x8493=['BOOLEAN','state','sequelize','STRING','app.js'];(function(_0x31e26d,_0x109038){var _0x3f78bc=function(_0xfe923d){while(--_0xfe923d){_0x31e26d['push'](_0x31e26d['shift']());}};_0x3f78bc(++_0x109038);}(_0x8493,0x151));var _0x3849=function(_0x71cd05,_0x36ac11){_0x71cd05=_0x71cd05-0x0;var _0x59c9e7=_0x8493[_0x71cd05];return _0x59c9e7;};'use strict';var Sequelize=require(_0x3849('0x0'));module['exports']={'name':{'type':Sequelize[_0x3849('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x3849('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x3849('0x1')],'defaultValue':_0x3849('0x2')},'filename':{'type':Sequelize[_0x3849('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3849('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x3849('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x3849('0x1')]},'logo':{'type':Sequelize[_0x3849('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0x3849('0x4')},'description':{'type':Sequelize[_0x3849('0x1')]},'title':{'type':Sequelize[_0x3849('0x1')]},'remoteUri':{'type':Sequelize[_0x3849('0x1')]},'link':{'type':Sequelize[_0x3849('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x1601=['STRING','exports','unique_name_and_version'];(function(_0x4e1ffa,_0x1b85fe){var _0x172c8a=function(_0x414ecd){while(--_0x414ecd){_0x4e1ffa['push'](_0x4e1ffa['shift']());}};_0x172c8a(++_0x1b85fe);}(_0x1601,0x151));var _0x1160=function(_0x197043,_0x3ebf47){_0x197043=_0x197043-0x0;var _0x233e33=_0x1601[_0x197043];return _0x233e33;};'use strict';var Sequelize=require('sequelize');module[_0x1160('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1160('0x1')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1160('0x1')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x1160('0x2')]},'path':{'type':Sequelize[_0x1160('0x2')]},'type':{'type':Sequelize[_0x1160('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x1160('0x2')]},'logo':{'type':Sequelize[_0x1160('0x2')]},'state':{'type':Sequelize[_0x1160('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x1160('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1160('0x2')]},'link':{'type':Sequelize[_0x1160('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 7df4012..7453897 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 _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','Integration','fieldName','type','key'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xadb5,0xad));var _0x5adb=function(_0x1369e1,_0x108cbd){_0x1369e1=_0x1369e1-0x0;var _0x4331fa=_0xadb5[_0x1369e1];return _0x4331fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['Integration']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['Integration'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['Integration'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file +var _0xe3da=['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','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse'];(function(_0x124614,_0x5392b){var _0x301b96=function(_0x237ab5){while(--_0x237ab5){_0x124614['push'](_0x124614['shift']());}};_0x301b96(++_0x5392b);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 373fc8f..6d4f37b 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 _0xbc64=['util','../../config/logger','api','path','../../config/environment','exports','define','Integration','integrations'];(function(_0x4a3fdb,_0x136fcc){var _0x5566a0=function(_0x35faf6){while(--_0x35faf6){_0x4a3fdb['push'](_0x4a3fdb['shift']());}};_0x5566a0(++_0x136fcc);}(_0xbc64,0x14d));var _0x4bc6=function(_0xe45b6d,_0x443cac){_0xe45b6d=_0xe45b6d-0x0;var _0x4d6f47=_0xbc64[_0xe45b6d];return _0x4d6f47;};'use strict';var _=require('lodash');var util=require(_0x4bc6('0x0'));var logger=require(_0x4bc6('0x1'))(_0x4bc6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bc6('0x3'));var rimraf=require('rimraf');var config=require(_0x4bc6('0x4'));var attributes=require('./integration.attributes');module[_0x4bc6('0x5')]=function(_0x749b17,_0x532da7){return _0x749b17[_0x4bc6('0x6')](_0x4bc6('0x7'),attributes,{'tableName':_0x4bc6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x124f=['moment','bluebird','path','rimraf','../../config/environment','./integration.attributes','define','integrations','lodash'];(function(_0x798d5a,_0x4fab9c){var _0x1d23ef=function(_0x2a2e7a){while(--_0x2a2e7a){_0x798d5a['push'](_0x798d5a['shift']());}};_0x1d23ef(++_0x4fab9c);}(_0x124f,0x8f));var _0xf124=function(_0x1867ee,_0x5ccefc){_0x1867ee=_0x1867ee-0x0;var _0x49345c=_0x124f[_0x1867ee];return _0x49345c;};'use strict';var _=require(_0xf124('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf124('0x1'));var BPromise=require(_0xf124('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf124('0x3'));var rimraf=require(_0xf124('0x4'));var config=require(_0xf124('0x5'));var attributes=require(_0xf124('0x6'));module['exports']=function(_0x5cde65,_0x57b0d8){return _0x5cde65[_0xf124('0x7')]('Integration',attributes,{'tableName':_0xf124('0x8'),'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 3a0fa00..539ab15 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 _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc2c7,0x134));var _0x7c2c=function(_0x54b25e,_0x5c13c7){_0x54b25e=_0x54b25e-0x0;var _0x5b80e7=_0xc2c7[_0x54b25e];return _0x5b80e7;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('Integration,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1a1f82,_0x16e88b){var _0x152427=function(_0xcddcba){while(--_0xcddcba){_0x1a1f82['push'](_0x1a1f82['shift']());}};_0x152427(++_0x16e88b);}(_0xadb5,0xad));var _0x5adb=function(_0x1e4088,_0x4870ef){_0x1e4088=_0x1e4088-0x0;var _0x525141=_0xadb5[_0x1e4088];return _0x525141;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index a2216f5..ae9dc73 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 _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x48cb1f,_0x5ca68d){var _0x172c4d=function(_0x85040){while(--_0x85040){_0x48cb1f['push'](_0x48cb1f['shift']());}};_0x172c4d(++_0x5ca68d);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./integrationReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file +var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x6e57fc,_0x484568){_0x6e57fc=_0x6e57fc-0x0;var _0x309bea=_0x5f2f[_0x6e57fc];return _0x309bea;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index b4b4b0c..14f3f36 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 _0x90db=['SENT','SENDING','RECEIVED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x424414,_0x3f16a5){var _0x3fb38f=function(_0x18d5be){while(--_0x18d5be){_0x424414['push'](_0x424414['shift']());}};_0x3fb38f(++_0x3f16a5);}(_0x90db,0x179));var _0xb90d=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x90db[_0x42f009];return _0x22a1e0;};'use strict';var Sequelize=require(_0xb90d('0x0'));module[_0xb90d('0x1')]={'integration':{'type':Sequelize[_0xb90d('0x2')]},'eventChannel':{'type':Sequelize[_0xb90d('0x2')]},'exitStatus':{'type':Sequelize[_0xb90d('0x2')]},'ticketId':{'type':Sequelize[_0xb90d('0x2')]},'integrationId':{'type':Sequelize[_0xb90d('0x3')]},'contacts':{'type':Sequelize[_0xb90d('0x2')]},'uniqueid':{'type':Sequelize[_0xb90d('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb90d('0x2')]},'queue':{'type':Sequelize[_0xb90d('0x2')]},'interface':{'type':Sequelize[_0xb90d('0x2')]},'membername':{'type':Sequelize[_0xb90d('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb90d('0x4')]},'agentconnectAt':{'type':Sequelize[_0xb90d('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xb90d('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xb90d('0x4')]},'talktime':{'type':Sequelize[_0xb90d('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb90d('0x3')]},'reason':{'type':Sequelize[_0xb90d('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xb90d('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb90d('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xb90d('0x4')]},'lastevent':{'type':Sequelize[_0xb90d('0x2')]},'channel':{'type':Sequelize[_0xb90d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xb90d('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb90d('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb90d('0x2')]},'context':{'type':Sequelize[_0xb90d('0x2')]},'exten':{'type':Sequelize[_0xb90d('0x2')]},'priority':{'type':Sequelize[_0xb90d('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xb90d('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb90d('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb90d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb90d('0x2')]},'destlanguage':{'type':Sequelize[_0xb90d('0x2')]},'destaccountcode':{'type':Sequelize[_0xb90d('0x2')]},'destcontext':{'type':Sequelize[_0xb90d('0x2')]},'destexten':{'type':Sequelize[_0xb90d('0x2')]},'destpriority':{'type':Sequelize[_0xb90d('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xb90d('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xb90d('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xb90d('0x2')]},'attachment':{'type':Sequelize[_0xb90d('0x6')]},'html':{'type':Sequelize[_0xb90d('0x6')]},'text':{'type':Sequelize[_0xb90d('0x6')]},'status':{'type':Sequelize[_0xb90d('0x7')](_0xb90d('0x8'),_0xb90d('0x9'),_0xb90d('0xa'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xb90d('0x2')]},'appdata':{'type':Sequelize[_0xb90d('0x2')]},'projectId':{'type':Sequelize[_0xb90d('0x3')]}}; \ No newline at end of file +var _0x1e94=['sequelize','STRING','DATE','INTEGER','BOOLEAN','TEXT','SENT','SENDING','FAILED'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x1e94,0x87));var _0x41e9=function(_0x32dc49,_0x112ae2){_0x32dc49=_0x32dc49-0x0;var _0x169742=_0x1e94[_0x32dc49];return _0x169742;};'use strict';var Sequelize=require(_0x41e9('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x41e9('0x1')]},'exitStatus':{'type':Sequelize[_0x41e9('0x1')]},'ticketId':{'type':Sequelize[_0x41e9('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x41e9('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x41e9('0x1')]},'interface':{'type':Sequelize[_0x41e9('0x1')]},'membername':{'type':Sequelize[_0x41e9('0x1')]},'agentcalledAt':{'type':Sequelize[_0x41e9('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x41e9('0x3')]},'agentcomplete':{'type':Sequelize[_0x41e9('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x41e9('0x2')]},'talktime':{'type':Sequelize[_0x41e9('0x3')]},'agentacw':{'type':Sequelize[_0x41e9('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x41e9('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x41e9('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x41e9('0x2')]},'agentdump':{'type':Sequelize[_0x41e9('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x41e9('0x2')]},'lastevent':{'type':Sequelize[_0x41e9('0x1')]},'channel':{'type':Sequelize[_0x41e9('0x1')]},'channelstate':{'type':Sequelize[_0x41e9('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x41e9('0x1')]},'exten':{'type':Sequelize[_0x41e9('0x1')]},'priority':{'type':Sequelize[_0x41e9('0x1')]},'destchannel':{'type':Sequelize[_0x41e9('0x1')]},'destchannelstate':{'type':Sequelize[_0x41e9('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x41e9('0x1')]},'destcalleridname':{'type':Sequelize[_0x41e9('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x41e9('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x41e9('0x1')]},'destlanguage':{'type':Sequelize[_0x41e9('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x41e9('0x1')]},'destexten':{'type':Sequelize[_0x41e9('0x1')]},'destpriority':{'type':Sequelize[_0x41e9('0x1')]},'destuniqueid':{'type':Sequelize[_0x41e9('0x1')]},'messageId':{'type':Sequelize[_0x41e9('0x1')]},'inReplyTo':{'type':Sequelize[_0x41e9('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x41e9('0x1')]},'to':{'type':Sequelize[_0x41e9('0x1')]},'cc':{'type':Sequelize[_0x41e9('0x1')]},'attachment':{'type':Sequelize[_0x41e9('0x5')]},'html':{'type':Sequelize[_0x41e9('0x5')]},'text':{'type':Sequelize[_0x41e9('0x5')]},'status':{'type':Sequelize['ENUM'](_0x41e9('0x6'),_0x41e9('0x7'),'RECEIVED',_0x41e9('0x8'))},'url':{'type':Sequelize[_0x41e9('0x1')]},'app':{'type':Sequelize[_0x41e9('0x1')]},'appdata':{'type':Sequelize[_0x41e9('0x1')]},'projectId':{'type':Sequelize[_0x41e9('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 6a342da..a39d0e6 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 _0x3b5c=['rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','IntegrationReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params'];(function(_0x4bf35e,_0xda90df){var _0x24c842=function(_0x360a7f){while(--_0x360a7f){_0x4bf35e['push'](_0x4bf35e['shift']());}};_0x24c842(++_0xda90df);}(_0x3b5c,0x9d));var _0xc3b5=function(_0x5d9f40,_0x35eed1){_0x5d9f40=_0x5d9f40-0x0;var _0x523a3c=_0x3b5c[_0x5d9f40];return _0x523a3c;};'use strict';var emlformat=require(_0xc3b5('0x0'));var rimraf=require(_0xc3b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc3b5('0x2'));var rp=require(_0xc3b5('0x3'));var moment=require(_0xc3b5('0x4'));var BPromise=require(_0xc3b5('0x5'));var Mustache=require(_0xc3b5('0x6'));var util=require(_0xc3b5('0x7'));var path=require(_0xc3b5('0x8'));var sox=require(_0xc3b5('0x9'));var csv=require(_0xc3b5('0xa'));var ejs=require(_0xc3b5('0xb'));var fs=require('fs');var fs_extra=require(_0xc3b5('0xc'));var _=require(_0xc3b5('0xd'));var squel=require('squel');var crypto=require(_0xc3b5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc3b5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc3b5('0x10'));var Papa=require(_0xc3b5('0x11'));var Redis=require('ioredis');var authService=require(_0xc3b5('0x12'));var qs=require(_0xc3b5('0x13'));var as=require(_0xc3b5('0x14'));var hardwareService=require(_0xc3b5('0x15'));var logger=require(_0xc3b5('0x16'))('api');var utils=require(_0xc3b5('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc3b5('0x18'))['db'];function respondWithStatusCode(_0x295ba7,_0x1c4d3e){_0x1c4d3e=_0x1c4d3e||0xcc;return function(_0x4bfcbe){if(_0x4bfcbe){return _0x295ba7['sendStatus'](_0x1c4d3e);}return _0x295ba7[_0xc3b5('0x19')](_0x1c4d3e)[_0xc3b5('0x1a')]();};}function respondWithResult(_0x1a9a75,_0xfc5fd3){_0xfc5fd3=_0xfc5fd3||0xc8;return function(_0x5119ef){if(_0x5119ef){return _0x1a9a75[_0xc3b5('0x19')](_0xfc5fd3)[_0xc3b5('0x1b')](_0x5119ef);}};}function respondWithFilteredResult(_0x117da4,_0x5b7c96){return function(_0x1a22ed){if(_0x1a22ed){var _0x697cb9=typeof _0x5b7c96['offset']===_0xc3b5('0x1c')&&typeof _0x5b7c96['limit']===_0xc3b5('0x1c');var _0x73770c=_0x1a22ed[_0xc3b5('0x1d')];var _0x111636=_0x697cb9?0x0:_0x5b7c96['offset'];var _0x116c06=_0x697cb9?_0x1a22ed[_0xc3b5('0x1d')]:_0x5b7c96[_0xc3b5('0x1e')]+_0x5b7c96[_0xc3b5('0x1f')];var _0x179b5e;if(_0x116c06>=_0x73770c){_0x116c06=_0x73770c;_0x179b5e=0xc8;}else{_0x179b5e=0xce;}_0x117da4[_0xc3b5('0x19')](_0x179b5e);return _0x117da4[_0xc3b5('0x20')](_0xc3b5('0x21'),_0x111636+'-'+_0x116c06+'/'+_0x73770c)['json'](_0x1a22ed);}return null;};}function patchUpdates(_0xf63840){return function(_0x5a175e){try{jsonpatch[_0xc3b5('0x22')](_0x5a175e,_0xf63840,!![]);}catch(_0x5f016c){return BPromise[_0xc3b5('0x23')](_0x5f016c);}return _0x5a175e[_0xc3b5('0x24')]();};}function saveUpdates(_0x35ec77,_0x4be594){return function(_0x5caf43){if(_0x5caf43){return _0x5caf43[_0xc3b5('0x25')](_0x35ec77)[_0xc3b5('0x26')](function(_0x359289){return _0x359289;});}return null;};}function removeEntity(_0x49dfb8,_0x35484c){return function(_0x175f77){if(_0x175f77){return _0x175f77[_0xc3b5('0x27')]()[_0xc3b5('0x26')](function(){_0x49dfb8[_0xc3b5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1dae,_0x4e209b){return function(_0x23439d){if(!_0x23439d){_0x5b1dae['sendStatus'](0x194);}return _0x23439d;};}function handleError(_0x42bd2d,_0x49ee69){_0x49ee69=_0x49ee69||0x1f4;return function(_0x2a1e45){logger['error'](_0x2a1e45[_0xc3b5('0x28')]);if(_0x2a1e45[_0xc3b5('0x29')]){delete _0x2a1e45[_0xc3b5('0x29')];}_0x42bd2d[_0xc3b5('0x19')](_0x49ee69)['send'](_0x2a1e45);};}exports[_0xc3b5('0x2a')]=function(_0x4b5e8e,_0x50c955){var _0x585237={},_0x378ca5={},_0x5b9493={'count':0x0,'rows':[]};var _0x229d71=_[_0xc3b5('0x2b')](db[_0xc3b5('0x2c')]['rawAttributes'],function(_0x2cca69){return{'name':_0x2cca69['fieldName'],'type':_0x2cca69[_0xc3b5('0x2d')][_0xc3b5('0x2e')]};});_0x378ca5[_0xc3b5('0x2f')]=_[_0xc3b5('0x2b')](_0x229d71,_0xc3b5('0x29'));_0x378ca5[_0xc3b5('0x30')]=_[_0xc3b5('0x31')](_0x4b5e8e[_0xc3b5('0x30')]);_0x378ca5[_0xc3b5('0x32')]=_[_0xc3b5('0x33')](_0x378ca5[_0xc3b5('0x2f')],_0x378ca5[_0xc3b5('0x30')]);_0x585237['attributes']=_[_0xc3b5('0x33')](_0x378ca5[_0xc3b5('0x2f')],qs[_0xc3b5('0x34')](_0x4b5e8e[_0xc3b5('0x30')][_0xc3b5('0x34')]));_0x585237[_0xc3b5('0x35')]=_0x585237[_0xc3b5('0x35')][_0xc3b5('0x36')]?_0x585237['attributes']:_0x378ca5[_0xc3b5('0x2f')];if(!_0x4b5e8e[_0xc3b5('0x30')][_0xc3b5('0x37')](_0xc3b5('0x38'))){_0x585237['limit']=qs['limit'](_0x4b5e8e[_0xc3b5('0x30')][_0xc3b5('0x1f')]);_0x585237[_0xc3b5('0x1e')]=qs[_0xc3b5('0x1e')](_0x4b5e8e[_0xc3b5('0x30')][_0xc3b5('0x1e')]);}_0x585237[_0xc3b5('0x39')]=qs[_0xc3b5('0x3a')](_0x4b5e8e['query'][_0xc3b5('0x3a')]);_0x585237[_0xc3b5('0x3b')]=qs[_0xc3b5('0x32')](_[_0xc3b5('0x3c')](_0x4b5e8e[_0xc3b5('0x30')],_0x378ca5[_0xc3b5('0x32')]),_0x229d71);if(_0x4b5e8e[_0xc3b5('0x30')][_0xc3b5('0x3d')]){_0x585237[_0xc3b5('0x3b')]=_[_0xc3b5('0x3e')](_0x585237[_0xc3b5('0x3b')],{'$or':_[_0xc3b5('0x2b')](_0x229d71,function(_0x47256e){if(_0x47256e[_0xc3b5('0x2d')]!==_0xc3b5('0x3f')){var _0x26207d={};_0x26207d[_0x47256e[_0xc3b5('0x29')]]={'$like':'%'+_0x4b5e8e[_0xc3b5('0x30')][_0xc3b5('0x3d')]+'%'};return _0x26207d;}})});}_0x585237=_[_0xc3b5('0x3e')]({},_0x585237,_0x4b5e8e[_0xc3b5('0x40')]);var _0x4fd1eb={'where':_0x585237['where']};return db[_0xc3b5('0x2c')][_0xc3b5('0x1d')](_0x4fd1eb)[_0xc3b5('0x26')](function(_0x52600b){_0x5b9493['count']=_0x52600b;if(_0x4b5e8e['query'][_0xc3b5('0x41')]){_0x585237[_0xc3b5('0x42')]=[{'all':!![]}];}return db[_0xc3b5('0x2c')][_0xc3b5('0x43')](_0x585237);})['then'](function(_0x4eb1e3){_0x5b9493[_0xc3b5('0x44')]=_0x4eb1e3;return _0x5b9493;})['then'](respondWithFilteredResult(_0x50c955,_0x585237))[_0xc3b5('0x45')](handleError(_0x50c955,null));};exports['show']=function(_0x4c17f0,_0x4f3b8d){var _0x17d5ed={'raw':![],'where':{'id':_0x4c17f0[_0xc3b5('0x46')]['id']}},_0x1f7767={};_0x1f7767[_0xc3b5('0x2f')]=_[_0xc3b5('0x31')](db['IntegrationReport'][_0xc3b5('0x47')]);_0x1f7767[_0xc3b5('0x30')]=_[_0xc3b5('0x31')](_0x4c17f0[_0xc3b5('0x30')]);_0x1f7767[_0xc3b5('0x32')]=_[_0xc3b5('0x33')](_0x1f7767[_0xc3b5('0x2f')],_0x1f7767['query']);_0x17d5ed[_0xc3b5('0x35')]=_[_0xc3b5('0x33')](_0x1f7767[_0xc3b5('0x2f')],qs[_0xc3b5('0x34')](_0x4c17f0['query']['fields']));_0x17d5ed[_0xc3b5('0x35')]=_0x17d5ed['attributes']['length']?_0x17d5ed['attributes']:_0x1f7767[_0xc3b5('0x2f')];if(_0x4c17f0[_0xc3b5('0x30')]['includeAll']){_0x17d5ed[_0xc3b5('0x42')]=[{'all':!![]}];}_0x17d5ed=_['merge']({},_0x17d5ed,_0x4c17f0[_0xc3b5('0x40')]);return db['IntegrationReport'][_0xc3b5('0x48')](_0x17d5ed)[_0xc3b5('0x26')](handleEntityNotFound(_0x4f3b8d,null))['then'](respondWithResult(_0x4f3b8d,null))['catch'](handleError(_0x4f3b8d,null));};exports[_0xc3b5('0x49')]=function(_0x5970c6,_0x44934c){return db[_0xc3b5('0x2c')][_0xc3b5('0x49')](_0x5970c6['body'],{})[_0xc3b5('0x26')](respondWithResult(_0x44934c,0xc9))[_0xc3b5('0x45')](handleError(_0x44934c,null));};exports['update']=function(_0x14563c,_0x3a4b43){if(_0x14563c[_0xc3b5('0x4a')]['id']){delete _0x14563c[_0xc3b5('0x4a')]['id'];}return db[_0xc3b5('0x2c')][_0xc3b5('0x48')]({'where':{'id':_0x14563c[_0xc3b5('0x46')]['id']}})[_0xc3b5('0x26')](handleEntityNotFound(_0x3a4b43,null))[_0xc3b5('0x26')](saveUpdates(_0x14563c['body'],null))['then'](respondWithResult(_0x3a4b43,null))['catch'](handleError(_0x3a4b43,null));};exports[_0xc3b5('0x27')]=function(_0x3ec5b0,_0x3bfa53){return db[_0xc3b5('0x2c')][_0xc3b5('0x48')]({'where':{'id':_0x3ec5b0['params']['id']}})[_0xc3b5('0x26')](handleEntityNotFound(_0x3bfa53,null))[_0xc3b5('0x26')](removeEntity(_0x3bfa53,null))[_0xc3b5('0x45')](handleError(_0x3bfa53,null));};exports[_0xc3b5('0x4b')]=function(_0x4eef5e,_0x19dcf3){return db[_0xc3b5('0x2c')]['describe']()[_0xc3b5('0x26')](respondWithResult(_0x19dcf3,null))[_0xc3b5('0x45')](handleError(_0x19dcf3,null));}; \ No newline at end of file +var _0xbaf4=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','then','catch','show','fields','find','create','body','params','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0xcc482,_0x492b02){var _0x396a7c=function(_0x432b11){while(--_0x432b11){_0xcc482['push'](_0xcc482['shift']());}};_0x396a7c(++_0x492b02);}(_0xbaf4,0xdc));var _0x4baf=function(_0x2eba59,_0x36f016){_0x2eba59=_0x2eba59-0x0;var _0x104b43=_0xbaf4[_0x2eba59];return _0x104b43;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4baf('0x0'));var zipdir=require(_0x4baf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4baf('0x2'));var BPromise=require(_0x4baf('0x3'));var Mustache=require(_0x4baf('0x4'));var util=require(_0x4baf('0x5'));var path=require(_0x4baf('0x6'));var sox=require(_0x4baf('0x7'));var csv=require(_0x4baf('0x8'));var ejs=require(_0x4baf('0x9'));var fs=require('fs');var fs_extra=require(_0x4baf('0xa'));var _=require('lodash');var squel=require(_0x4baf('0xb'));var crypto=require(_0x4baf('0xc'));var jsforce=require(_0x4baf('0xd'));var deskjs=require(_0x4baf('0xe'));var toCsv=require(_0x4baf('0x8'));var querystring=require(_0x4baf('0xf'));var Papa=require(_0x4baf('0x10'));var Redis=require(_0x4baf('0x11'));var authService=require(_0x4baf('0x12'));var qs=require(_0x4baf('0x13'));var as=require(_0x4baf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4baf('0x15'))(_0x4baf('0x16'));var utils=require(_0x4baf('0x17'));var config=require(_0x4baf('0x18'));var licenseUtil=require(_0x4baf('0x19'));var db=require(_0x4baf('0x1a'))['db'];function respondWithStatusCode(_0xc7e205,_0x5a0907){_0x5a0907=_0x5a0907||0xcc;return function(_0x20068f){if(_0x20068f){return _0xc7e205[_0x4baf('0x1b')](_0x5a0907);}return _0xc7e205[_0x4baf('0x1c')](_0x5a0907)[_0x4baf('0x1d')]();};}function respondWithResult(_0x3c47e0,_0x406621){_0x406621=_0x406621||0xc8;return function(_0x2c1a84){if(_0x2c1a84){return _0x3c47e0[_0x4baf('0x1c')](_0x406621)[_0x4baf('0x1e')](_0x2c1a84);}};}function respondWithFilteredResult(_0x2fb938,_0x1bc5f8){return function(_0x382fb4){if(_0x382fb4){var _0x366028=typeof _0x1bc5f8[_0x4baf('0x1f')]===_0x4baf('0x20')&&typeof _0x1bc5f8[_0x4baf('0x21')]===_0x4baf('0x20');var _0x70774=_0x382fb4[_0x4baf('0x22')];var _0x592234=_0x366028?0x0:_0x1bc5f8[_0x4baf('0x1f')];var _0x509a26=_0x366028?_0x382fb4[_0x4baf('0x22')]:_0x1bc5f8[_0x4baf('0x1f')]+_0x1bc5f8[_0x4baf('0x21')];var _0x404aa7;if(_0x509a26>=_0x70774){_0x509a26=_0x70774;_0x404aa7=0xc8;}else{_0x404aa7=0xce;}_0x2fb938[_0x4baf('0x1c')](_0x404aa7);return _0x2fb938[_0x4baf('0x23')](_0x4baf('0x24'),_0x592234+'-'+_0x509a26+'/'+_0x70774)['json'](_0x382fb4);}return null;};}function patchUpdates(_0x3b1644){return function(_0x3b6d33){try{jsonpatch[_0x4baf('0x25')](_0x3b6d33,_0x3b1644,!![]);}catch(_0x3c7ba5){return BPromise[_0x4baf('0x26')](_0x3c7ba5);}return _0x3b6d33[_0x4baf('0x27')]();};}function saveUpdates(_0x5eda9a,_0x4faecd){return function(_0x445119){if(_0x445119){return _0x445119[_0x4baf('0x28')](_0x5eda9a)['then'](function(_0x44d9d1){return _0x44d9d1;});}return null;};}function removeEntity(_0x3df288,_0x589ccc){return function(_0x3af974){if(_0x3af974){return _0x3af974[_0x4baf('0x29')]()['then'](function(){_0x3df288[_0x4baf('0x1c')](0xcc)[_0x4baf('0x1d')]();});}};}function handleEntityNotFound(_0x44f5e0,_0x13af8e){return function(_0x4f1c33){if(!_0x4f1c33){_0x44f5e0[_0x4baf('0x1b')](0x194);}return _0x4f1c33;};}function handleError(_0x300a33,_0xf6ddb6){_0xf6ddb6=_0xf6ddb6||0x1f4;return function(_0x2cd1b2){logger[_0x4baf('0x2a')](_0x2cd1b2[_0x4baf('0x2b')]);if(_0x2cd1b2[_0x4baf('0x2c')]){delete _0x2cd1b2['name'];}_0x300a33[_0x4baf('0x1c')](_0xf6ddb6)[_0x4baf('0x2d')](_0x2cd1b2);};}exports[_0x4baf('0x2e')]=function(_0x245ed4,_0x1e76a1){var _0x2288ff={},_0x1713c8={},_0x57c17d={'count':0x0,'rows':[]};var _0x443b1a=_[_0x4baf('0x2f')](db[_0x4baf('0x30')][_0x4baf('0x31')],function(_0x1b80ca){return{'name':_0x1b80ca['fieldName'],'type':_0x1b80ca['type'][_0x4baf('0x32')]};});_0x1713c8[_0x4baf('0x33')]=_[_0x4baf('0x2f')](_0x443b1a,_0x4baf('0x2c'));_0x1713c8['query']=_[_0x4baf('0x34')](_0x245ed4[_0x4baf('0x35')]);_0x1713c8[_0x4baf('0x36')]=_[_0x4baf('0x37')](_0x1713c8['model'],_0x1713c8['query']);_0x2288ff[_0x4baf('0x38')]=_[_0x4baf('0x37')](_0x1713c8[_0x4baf('0x33')],qs['fields'](_0x245ed4[_0x4baf('0x35')]['fields']));_0x2288ff[_0x4baf('0x38')]=_0x2288ff[_0x4baf('0x38')][_0x4baf('0x39')]?_0x2288ff['attributes']:_0x1713c8[_0x4baf('0x33')];if(!_0x245ed4[_0x4baf('0x35')][_0x4baf('0x3a')](_0x4baf('0x3b'))){_0x2288ff[_0x4baf('0x21')]=qs['limit'](_0x245ed4['query'][_0x4baf('0x21')]);_0x2288ff[_0x4baf('0x1f')]=qs[_0x4baf('0x1f')](_0x245ed4['query'][_0x4baf('0x1f')]);}_0x2288ff[_0x4baf('0x3c')]=qs[_0x4baf('0x3d')](_0x245ed4[_0x4baf('0x35')]['sort']);_0x2288ff['where']=qs[_0x4baf('0x36')](_['pick'](_0x245ed4[_0x4baf('0x35')],_0x1713c8[_0x4baf('0x36')]),_0x443b1a);if(_0x245ed4[_0x4baf('0x35')][_0x4baf('0x3e')]){_0x2288ff[_0x4baf('0x3f')]=_[_0x4baf('0x40')](_0x2288ff[_0x4baf('0x3f')],{'$or':_[_0x4baf('0x2f')](_0x443b1a,function(_0xcd5cf8){if(_0xcd5cf8['type']!==_0x4baf('0x41')){var _0x43fda6={};_0x43fda6[_0xcd5cf8[_0x4baf('0x2c')]]={'$like':'%'+_0x245ed4[_0x4baf('0x35')][_0x4baf('0x3e')]+'%'};return _0x43fda6;}})});}_0x2288ff=_[_0x4baf('0x40')]({},_0x2288ff,_0x245ed4[_0x4baf('0x42')]);var _0x5147b4={'where':_0x2288ff[_0x4baf('0x3f')]};return db[_0x4baf('0x30')][_0x4baf('0x22')](_0x5147b4)['then'](function(_0xfce2bb){_0x57c17d[_0x4baf('0x22')]=_0xfce2bb;if(_0x245ed4[_0x4baf('0x35')][_0x4baf('0x43')]){_0x2288ff[_0x4baf('0x44')]=[{'all':!![]}];}return db[_0x4baf('0x30')]['findAll'](_0x2288ff);})[_0x4baf('0x45')](function(_0x1c34e0){_0x57c17d['rows']=_0x1c34e0;return _0x57c17d;})[_0x4baf('0x45')](respondWithFilteredResult(_0x1e76a1,_0x2288ff))[_0x4baf('0x46')](handleError(_0x1e76a1,null));};exports[_0x4baf('0x47')]=function(_0x270e6e,_0x421f72){var _0x13e77a={'raw':![],'where':{'id':_0x270e6e['params']['id']}},_0x57bc57={};_0x57bc57[_0x4baf('0x33')]=_[_0x4baf('0x34')](db[_0x4baf('0x30')]['rawAttributes']);_0x57bc57['query']=_[_0x4baf('0x34')](_0x270e6e[_0x4baf('0x35')]);_0x57bc57[_0x4baf('0x36')]=_[_0x4baf('0x37')](_0x57bc57[_0x4baf('0x33')],_0x57bc57['query']);_0x13e77a[_0x4baf('0x38')]=_['intersection'](_0x57bc57[_0x4baf('0x33')],qs[_0x4baf('0x48')](_0x270e6e[_0x4baf('0x35')][_0x4baf('0x48')]));_0x13e77a['attributes']=_0x13e77a[_0x4baf('0x38')][_0x4baf('0x39')]?_0x13e77a[_0x4baf('0x38')]:_0x57bc57[_0x4baf('0x33')];if(_0x270e6e[_0x4baf('0x35')][_0x4baf('0x43')]){_0x13e77a[_0x4baf('0x44')]=[{'all':!![]}];}_0x13e77a=_[_0x4baf('0x40')]({},_0x13e77a,_0x270e6e[_0x4baf('0x42')]);return db[_0x4baf('0x30')][_0x4baf('0x49')](_0x13e77a)[_0x4baf('0x45')](handleEntityNotFound(_0x421f72,null))['then'](respondWithResult(_0x421f72,null))[_0x4baf('0x46')](handleError(_0x421f72,null));};exports['create']=function(_0x4096c3,_0x4b129b){return db[_0x4baf('0x30')][_0x4baf('0x4a')](_0x4096c3['body'],{})[_0x4baf('0x45')](respondWithResult(_0x4b129b,0xc9))[_0x4baf('0x46')](handleError(_0x4b129b,null));};exports[_0x4baf('0x28')]=function(_0x1c7224,_0x340bdf){if(_0x1c7224[_0x4baf('0x4b')]['id']){delete _0x1c7224[_0x4baf('0x4b')]['id'];}return db[_0x4baf('0x30')][_0x4baf('0x49')]({'where':{'id':_0x1c7224[_0x4baf('0x4c')]['id']}})['then'](handleEntityNotFound(_0x340bdf,null))[_0x4baf('0x45')](saveUpdates(_0x1c7224[_0x4baf('0x4b')],null))[_0x4baf('0x45')](respondWithResult(_0x340bdf,null))[_0x4baf('0x46')](handleError(_0x340bdf,null));};exports[_0x4baf('0x29')]=function(_0x1ecebf,_0x232810){return db[_0x4baf('0x30')][_0x4baf('0x49')]({'where':{'id':_0x1ecebf[_0x4baf('0x4c')]['id']}})['then'](handleEntityNotFound(_0x232810,null))['then'](removeEntity(_0x232810,null))['catch'](handleError(_0x232810,null));};exports[_0x4baf('0x4d')]=function(_0x39a906,_0x325d5c){return db[_0x4baf('0x30')][_0x4baf('0x4d')]()['then'](respondWithResult(_0x325d5c,null))[_0x4baf('0x46')](handleError(_0x325d5c,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index ebf2636..9251367 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 _0xab0f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','report_integration'];(function(_0x82cff,_0x1de062){var _0x3a243a=function(_0x37dc16){while(--_0x37dc16){_0x82cff['push'](_0x82cff['shift']());}};_0x3a243a(++_0x1de062);}(_0xab0f,0x174));var _0xfab0=function(_0x47a7fc,_0x3fe0c8){_0x47a7fc=_0x47a7fc-0x0;var _0x5364ac=_0xab0f[_0x47a7fc];return _0x5364ac;};'use strict';var _=require(_0xfab0('0x0'));var util=require(_0xfab0('0x1'));var logger=require(_0xfab0('0x2'))(_0xfab0('0x3'));var moment=require(_0xfab0('0x4'));var BPromise=require(_0xfab0('0x5'));var rp=require(_0xfab0('0x6'));var fs=require('fs');var path=require(_0xfab0('0x7'));var rimraf=require(_0xfab0('0x8'));var config=require(_0xfab0('0x9'));var attributes=require('./integrationReport.attributes');module[_0xfab0('0xa')]=function(_0x3ddee5,_0x4ba27c){return _0x3ddee5['define']('IntegrationReport',attributes,{'tableName':_0xfab0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb23b=['./integrationReport.attributes','define','IntegrationReport','report_integration','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1780e6,_0x4da461){var _0x5dadb1=function(_0x19c427){while(--_0x19c427){_0x1780e6['push'](_0x1780e6['shift']());}};_0x5dadb1(++_0x4da461);}(_0xb23b,0x1b4));var _0xbb23=function(_0xf97eb0,_0x1578b7){_0xf97eb0=_0xf97eb0-0x0;var _0xea70f4=_0xb23b[_0xf97eb0];return _0xea70f4;};'use strict';var _=require(_0xbb23('0x0'));var util=require('util');var logger=require(_0xbb23('0x1'))(_0xbb23('0x2'));var moment=require(_0xbb23('0x3'));var BPromise=require(_0xbb23('0x4'));var rp=require(_0xbb23('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb23('0x6'));var config=require(_0xbb23('0x7'));var attributes=require(_0xbb23('0x8'));module['exports']=function(_0x1d9b55,_0x15e7d5){return _0x1d9b55[_0xbb23('0x9')](_0xbb23('0xa'),attributes,{'tableName':_0xbb23('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index ec9446e..458f388 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 _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0x33800d,_0x195a91){var _0x491b1f=function(_0x4e3513){while(--_0x4e3513){_0x33800d['push'](_0x33800d['shift']());}};_0x491b1f(++_0x195a91);}(_0x2675,0x75));var _0x5267=function(_0x517560,_0x54e985){_0x517560=_0x517560-0x0;var _0x4d0ed6=_0x2675[_0x517560];return _0x4d0ed6;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x53ec,0x192));var _0xc53e=function(_0x3f7101,_0x3af08b){_0x3f7101=_0x3f7101-0x0;var _0x1a30a0=_0x53ec[_0x3f7101];return _0x1a30a0;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index cee6da3..e010a0b 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 _0x90b1=['/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval'];(function(_0x2acd0f,_0x3ac736){var _0x434b3e=function(_0x2fdca0){while(--_0x2fdca0){_0x2acd0f['push'](_0x2acd0f['shift']());}};_0x434b3e(++_0x3ac736);}(_0x90b1,0x1bb));var _0x190b=function(_0x57d740,_0x50be99){_0x57d740=_0x57d740-0x0;var _0x6607ef=_0x90b1[_0x57d740];return _0x6607ef;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./interval.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0x8')](_0x190b('0xc'),auth['isAuthenticated'](),controller[_0x190b('0xd')]);router[_0x190b('0xe')]('/',auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0xe')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller[_0x190b('0x10')]);router['post'](_0x190b('0x11'),auth[_0x190b('0xa')](),controller['addIntervals']);router[_0x190b('0x12')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0x13')]);router[_0x190b('0x14')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0x15')]);module[_0x190b('0x16')]=router; \ No newline at end of file +var _0xeac1=['../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','getIntervals','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x5c04bc,_0x355148){var _0x49f5d2=function(_0x569898){while(--_0x569898){_0x5c04bc['push'](_0x5c04bc['shift']());}};_0x49f5d2(++_0x355148);}(_0xeac1,0x146));var _0x1eac=function(_0x149206,_0xe1f4e1){_0x149206=_0x149206-0x0;var _0x46f46c=_0xeac1[_0x149206];return _0x46f46c;};'use strict';var multer=require('multer');var util=require(_0x1eac('0x0'));var path=require(_0x1eac('0x1'));var timeout=require(_0x1eac('0x2'));var express=require('express');var router=express[_0x1eac('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1eac('0x4'));var config=require(_0x1eac('0x5'));var controller=require(_0x1eac('0x6'));router[_0x1eac('0x7')]('/',auth[_0x1eac('0x8')](),controller[_0x1eac('0x9')]);router[_0x1eac('0x7')](_0x1eac('0xa'),auth[_0x1eac('0x8')](),controller['show']);router[_0x1eac('0x7')]('/:id/sub_intervals',auth[_0x1eac('0x8')](),controller[_0x1eac('0xb')]);router[_0x1eac('0xc')]('/',auth[_0x1eac('0x8')](),controller[_0x1eac('0xd')]);router[_0x1eac('0xc')](_0x1eac('0xe'),auth[_0x1eac('0x8')](),controller[_0x1eac('0xf')]);router[_0x1eac('0xc')](_0x1eac('0x10'),auth[_0x1eac('0x8')](),controller['addIntervals']);router[_0x1eac('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1eac('0x12')]);router[_0x1eac('0x13')](_0x1eac('0xa'),auth[_0x1eac('0x8')](),controller[_0x1eac('0x14')]);module[_0x1eac('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 48ea741..a11790e 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 _0xd033=['STRING','exports'];(function(_0xa0d6e8,_0x41e320){var _0x4ba300=function(_0x5ad796){while(--_0x5ad796){_0xa0d6e8['push'](_0xa0d6e8['shift']());}};_0x4ba300(++_0x41e320);}(_0xd033,0x117));var _0x3d03=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0xd033[_0x45c981];return _0x4f62c8;};'use strict';var Sequelize=require('sequelize');module[_0x3d03('0x0')]={'name':{'type':Sequelize[_0x3d03('0x1')]},'description':{'type':Sequelize[_0x3d03('0x1')]},'interval':{'type':Sequelize[_0x3d03('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xcc97=['exports','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xcc97,0x186));var _0x7cc9=function(_0x530083,_0x537dc8){_0x530083=_0x530083-0x0;var _0x22c236=_0xcc97[_0x530083];return _0x22c236;};'use strict';var Sequelize=require('sequelize');module[_0x7cc9('0x0')]={'name':{'type':Sequelize[_0x7cc9('0x1')]},'description':{'type':Sequelize[_0x7cc9('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index f9a8c40..27ffda6 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 _0x3959=['undefined','limit','count','set','json','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','stack','name','send','map','Interval','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','IntervalId','getIntervals','findOne','pick','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','status','end','offset'];(function(_0x1e56e3,_0x289169){var _0x31eccd=function(_0x5eb492){while(--_0x5eb492){_0x1e56e3['push'](_0x1e56e3['shift']());}};_0x31eccd(++_0x289169);}(_0x3959,0x99));var _0x9395=function(_0x6d2976,_0x2e27b5){_0x6d2976=_0x6d2976-0x0;var _0x50031f=_0x3959[_0x6d2976];return _0x50031f;};'use strict';var emlformat=require(_0x9395('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9395('0x1'));var jsonpatch=require(_0x9395('0x2'));var rp=require(_0x9395('0x3'));var moment=require(_0x9395('0x4'));var BPromise=require(_0x9395('0x5'));var Mustache=require('mustache');var util=require(_0x9395('0x6'));var path=require(_0x9395('0x7'));var sox=require(_0x9395('0x8'));var csv=require(_0x9395('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9395('0xa'));var jsforce=require(_0x9395('0xb'));var deskjs=require(_0x9395('0xc'));var toCsv=require(_0x9395('0x9'));var querystring=require(_0x9395('0xd'));var Papa=require(_0x9395('0xe'));var Redis=require(_0x9395('0xf'));var authService=require(_0x9395('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9395('0x11'));var hardwareService=require(_0x9395('0x12'));var logger=require(_0x9395('0x13'))('api');var utils=require(_0x9395('0x14'));var config=require(_0x9395('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9395('0x16'))['db'];var extensions=require(_0x9395('0x17'));function respondWithStatusCode(_0x35a489,_0x147a52){_0x147a52=_0x147a52||0xcc;return function(_0x6be7ed){if(_0x6be7ed){return _0x35a489['sendStatus'](_0x147a52);}return _0x35a489[_0x9395('0x18')](_0x147a52)[_0x9395('0x19')]();};}function respondWithResult(_0x131b51,_0x138ac5){_0x138ac5=_0x138ac5||0xc8;return function(_0x127bf6){if(_0x127bf6){return _0x131b51['status'](_0x138ac5)['json'](_0x127bf6);}};}function respondWithFilteredResult(_0x573c89,_0x273c45){return function(_0xc05927){if(_0xc05927){var _0x4e9df2=typeof _0x273c45[_0x9395('0x1a')]===_0x9395('0x1b')&&typeof _0x273c45[_0x9395('0x1c')]==='undefined';var _0x31dbeb=_0xc05927[_0x9395('0x1d')];var _0x36d794=_0x4e9df2?0x0:_0x273c45[_0x9395('0x1a')];var _0x146e20=_0x4e9df2?_0xc05927[_0x9395('0x1d')]:_0x273c45['offset']+_0x273c45[_0x9395('0x1c')];var _0x23df6b;if(_0x146e20>=_0x31dbeb){_0x146e20=_0x31dbeb;_0x23df6b=0xc8;}else{_0x23df6b=0xce;}_0x573c89['status'](_0x23df6b);return _0x573c89[_0x9395('0x1e')]('Content-Range',_0x36d794+'-'+_0x146e20+'/'+_0x31dbeb)[_0x9395('0x1f')](_0xc05927);}return null;};}function patchUpdates(_0x280fb5){return function(_0x5b10d4){try{jsonpatch[_0x9395('0x20')](_0x5b10d4,_0x280fb5,!![]);}catch(_0x32fdf5){return BPromise[_0x9395('0x21')](_0x32fdf5);}return _0x5b10d4[_0x9395('0x22')]();};}function saveUpdates(_0x4ae3cb,_0x3dee53){return function(_0xa7d9d){if(_0xa7d9d){return _0xa7d9d['update'](_0x4ae3cb)[_0x9395('0x23')](function(_0xbe06c7){return _0xbe06c7;});}return null;};}function removeEntity(_0xc09514,_0x43eae8){return function(_0x18b95d){if(_0x18b95d){return _0x18b95d[_0x9395('0x24')]()[_0x9395('0x23')](function(){var _0x1447c0=_0x18b95d[_0x9395('0x25')]({'plain':!![]});var _0x53ba2d=_0x9395('0x26');return db[_0x9395('0x27')][_0x9395('0x24')]({'where':{'type':_0x53ba2d,'resourceId':_0x1447c0['id']}})[_0x9395('0x23')](function(){return _0x18b95d;});})[_0x9395('0x23')](function(){_0xc09514[_0x9395('0x18')](0xcc)[_0x9395('0x19')]();});}};}function handleEntityNotFound(_0x197c89,_0x5cfe58){return function(_0x252ecc){if(!_0x252ecc){_0x197c89['sendStatus'](0x194);}return _0x252ecc;};}function handleError(_0x3b7465,_0x5485f4){_0x5485f4=_0x5485f4||0x1f4;return function(_0x35e736){logger['error'](_0x35e736[_0x9395('0x28')]);if(_0x35e736[_0x9395('0x29')]){delete _0x35e736[_0x9395('0x29')];}_0x3b7465['status'](_0x5485f4)[_0x9395('0x2a')](_0x35e736);};}exports['index']=function(_0x15684a,_0x5a5dca){var _0x23326c={},_0x5ddd1b={},_0x86ec0={'count':0x0,'rows':[]};var _0x3e844b=_[_0x9395('0x2b')](db[_0x9395('0x2c')][_0x9395('0x2d')],function(_0x4ccc46){return{'name':_0x4ccc46['fieldName'],'type':_0x4ccc46['type'][_0x9395('0x2e')]};});_0x5ddd1b[_0x9395('0x2f')]=_['map'](_0x3e844b,'name');_0x5ddd1b['query']=_[_0x9395('0x30')](_0x15684a[_0x9395('0x31')]);_0x5ddd1b[_0x9395('0x32')]=_[_0x9395('0x33')](_0x5ddd1b[_0x9395('0x2f')],_0x5ddd1b['query']);_0x23326c[_0x9395('0x34')]=_[_0x9395('0x33')](_0x5ddd1b[_0x9395('0x2f')],qs['fields'](_0x15684a[_0x9395('0x31')][_0x9395('0x35')]));_0x23326c[_0x9395('0x34')]=_0x23326c[_0x9395('0x34')][_0x9395('0x36')]?_0x23326c[_0x9395('0x34')]:_0x5ddd1b[_0x9395('0x2f')];if(!_0x15684a[_0x9395('0x31')][_0x9395('0x37')](_0x9395('0x38'))){_0x23326c[_0x9395('0x1c')]=qs['limit'](_0x15684a[_0x9395('0x31')][_0x9395('0x1c')]);_0x23326c[_0x9395('0x1a')]=qs[_0x9395('0x1a')](_0x15684a['query'][_0x9395('0x1a')]);}_0x23326c[_0x9395('0x39')]=qs[_0x9395('0x3a')](_0x15684a[_0x9395('0x31')][_0x9395('0x3a')]);_0x23326c['where']=qs[_0x9395('0x32')](_['pick'](_0x15684a[_0x9395('0x31')],_0x5ddd1b[_0x9395('0x32')]),_0x3e844b);if(_0x15684a[_0x9395('0x31')][_0x9395('0x3b')]){_0x23326c[_0x9395('0x3c')]=_['merge'](_0x23326c['where'],{'$or':_[_0x9395('0x2b')](_0x3e844b,function(_0x4b3af7){if(_0x4b3af7[_0x9395('0x3d')]!==_0x9395('0x3e')){var _0x2ed93a={};_0x2ed93a[_0x4b3af7[_0x9395('0x29')]]={'$like':'%'+_0x15684a[_0x9395('0x31')][_0x9395('0x3b')]+'%'};return _0x2ed93a;}})});}_0x23326c=_[_0x9395('0x3f')]({},_0x23326c,_0x15684a[_0x9395('0x40')]);var _0x2cae56={'where':_0x23326c[_0x9395('0x3c')]};return db[_0x9395('0x2c')][_0x9395('0x1d')](_0x2cae56)[_0x9395('0x23')](function(_0x433d35){_0x86ec0['count']=_0x433d35;if(_0x15684a[_0x9395('0x31')][_0x9395('0x41')]){_0x23326c['include']=[{'all':!![]}];}return db[_0x9395('0x2c')][_0x9395('0x42')](_0x23326c);})[_0x9395('0x23')](function(_0x161348){_0x86ec0[_0x9395('0x43')]=_0x161348;return _0x86ec0;})[_0x9395('0x23')](respondWithFilteredResult(_0x5a5dca,_0x23326c))[_0x9395('0x44')](handleError(_0x5a5dca,null));};exports[_0x9395('0x45')]=function(_0x1fc07d,_0x5e5d83){var _0x4e426d={'raw':!![],'where':{'id':_0x1fc07d[_0x9395('0x46')]['id']}},_0x4da5bc={};_0x4da5bc[_0x9395('0x2f')]=_[_0x9395('0x30')](db[_0x9395('0x2c')][_0x9395('0x2d')]);_0x4da5bc['query']=_[_0x9395('0x30')](_0x1fc07d['query']);_0x4da5bc[_0x9395('0x32')]=_[_0x9395('0x33')](_0x4da5bc[_0x9395('0x2f')],_0x4da5bc[_0x9395('0x31')]);_0x4e426d[_0x9395('0x34')]=_[_0x9395('0x33')](_0x4da5bc[_0x9395('0x2f')],qs['fields'](_0x1fc07d['query'][_0x9395('0x35')]));_0x4e426d[_0x9395('0x34')]=_0x4e426d[_0x9395('0x34')]['length']?_0x4e426d[_0x9395('0x34')]:_0x4da5bc['model'];if(_0x1fc07d['query'][_0x9395('0x41')]){_0x4e426d[_0x9395('0x47')]=[{'all':!![]}];}_0x4e426d=_['merge']({},_0x4e426d,_0x1fc07d['options']);return db['Interval'][_0x9395('0x48')](_0x4e426d)[_0x9395('0x23')](handleEntityNotFound(_0x5e5d83,null))[_0x9395('0x23')](respondWithResult(_0x5e5d83,null))[_0x9395('0x44')](handleError(_0x5e5d83,null));};exports[_0x9395('0x49')]=function(_0x57307f,_0x3bd31a){return db['Interval'][_0x9395('0x49')](_0x57307f[_0x9395('0x4a')],{})[_0x9395('0x23')](function(_0x4ff856){var _0x5699f3=_0x57307f[_0x9395('0x4b')][_0x9395('0x25')]({'plain':!![]});if(!_0x5699f3)throw new Error(_0x9395('0x4c'));if(_0x5699f3[_0x9395('0x4d')]===_0x9395('0x4b')){var _0x17623e=_0x4ff856[_0x9395('0x25')]({'plain':!![]});var _0x426e15=_0x9395('0x26');return db[_0x9395('0x4e')][_0x9395('0x48')]({'where':{'name':_0x426e15,'userProfileId':_0x5699f3[_0x9395('0x4f')]},'raw':!![]})[_0x9395('0x23')](function(_0x114deb){if(_0x114deb&&_0x114deb[_0x9395('0x50')]===0x0){return db[_0x9395('0x27')][_0x9395('0x49')]({'name':_0x17623e[_0x9395('0x29')],'resourceId':_0x17623e['id'],'type':_0x114deb[_0x9395('0x29')],'sectionId':_0x114deb['id']},{})[_0x9395('0x23')](function(){return _0x4ff856;});}else{return _0x4ff856;}})['catch'](function(_0x1b49a6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b49a6);throw _0x1b49a6;});}return _0x4ff856;})['then'](respondWithResult(_0x3bd31a,0xc9))[_0x9395('0x44')](handleError(_0x3bd31a,null));};exports[_0x9395('0x51')]=function(_0x1644e6,_0x5b63dd){if(_0x1644e6[_0x9395('0x4a')]['id']){delete _0x1644e6[_0x9395('0x4a')]['id'];}return db[_0x9395('0x2c')][_0x9395('0x48')]({'where':{'id':_0x1644e6[_0x9395('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b63dd,null))[_0x9395('0x23')](saveUpdates(_0x1644e6['body'],null))[_0x9395('0x23')](respondWithResult(_0x5b63dd,null))[_0x9395('0x44')](handleError(_0x5b63dd,null));};exports[_0x9395('0x24')]=function(_0x47604e,_0x704cce){return db[_0x9395('0x2c')][_0x9395('0x48')]({'where':{'id':_0x47604e[_0x9395('0x46')]['id']}})[_0x9395('0x23')](handleEntityNotFound(_0x704cce,null))[_0x9395('0x23')](removeEntity(_0x704cce,null))[_0x9395('0x44')](handleError(_0x704cce,null));};exports['addInterval']=function(_0x42885e,_0x4e7a79,_0x3aa815){if(_0x42885e[_0x9395('0x4a')]['id']){delete _0x42885e['body']['id'];}return db['Interval']['find']({'where':{'id':_0x42885e[_0x9395('0x46')]['id']}})[_0x9395('0x23')](handleEntityNotFound(_0x4e7a79,null))[_0x9395('0x23')](function(_0x5d8a2c){if(_0x5d8a2c){_0x42885e[_0x9395('0x4a')][_0x9395('0x52')]=_0x5d8a2c['id'];return db[_0x9395('0x2c')]['create'](_0x42885e[_0x9395('0x4a')]);}})[_0x9395('0x23')](respondWithResult(_0x4e7a79,null))[_0x9395('0x44')](handleError(_0x4e7a79,null));};exports[_0x9395('0x53')]=function(_0x1be2d4,_0x31a8d5,_0x105411){var _0x5516fe={};var _0x779071={};var _0x334999;var _0xecd5f1;return db[_0x9395('0x2c')][_0x9395('0x54')]({'where':{'id':_0x1be2d4[_0x9395('0x46')]['id']}})[_0x9395('0x23')](handleEntityNotFound(_0x31a8d5,null))[_0x9395('0x23')](function(_0x4b6d71){if(_0x4b6d71){_0x334999=_0x4b6d71;_0x779071[_0x9395('0x2f')]=_[_0x9395('0x30')](db[_0x9395('0x2c')][_0x9395('0x2d')]);_0x779071[_0x9395('0x31')]=_[_0x9395('0x30')](_0x1be2d4[_0x9395('0x31')]);_0x779071[_0x9395('0x32')]=_['intersection'](_0x779071[_0x9395('0x2f')],_0x779071['query']);_0x5516fe[_0x9395('0x34')]=_[_0x9395('0x33')](_0x779071['model'],qs[_0x9395('0x35')](_0x1be2d4[_0x9395('0x31')]['fields']));_0x5516fe[_0x9395('0x34')]=_0x5516fe[_0x9395('0x34')][_0x9395('0x36')]?_0x5516fe[_0x9395('0x34')]:_0x779071[_0x9395('0x2f')];_0x5516fe[_0x9395('0x39')]=qs[_0x9395('0x3a')](_0x1be2d4[_0x9395('0x31')]['sort']);_0x5516fe[_0x9395('0x3c')]=qs['filters'](_[_0x9395('0x55')](_0x1be2d4[_0x9395('0x31')],_0x779071[_0x9395('0x32')]));if(_0x1be2d4[_0x9395('0x31')][_0x9395('0x3b')]){_0x5516fe[_0x9395('0x3c')]=_[_0x9395('0x3f')](_0x5516fe[_0x9395('0x3c')],{'$or':_[_0x9395('0x2b')](_0x5516fe[_0x9395('0x34')],function(_0x37f501){var _0x36dac8={};_0x36dac8[_0x37f501]={'$like':'%'+_0x1be2d4[_0x9395('0x31')]['filter']+'%'};return _0x36dac8;})});}_0x5516fe=_['merge']({},_0x5516fe,_0x1be2d4[_0x9395('0x40')]);return _0x334999[_0x9395('0x53')](_0x5516fe);}})['then'](function(_0x426841){if(_0x426841){_0xecd5f1=_0x426841['length'];if(!_0x1be2d4[_0x9395('0x31')][_0x9395('0x37')](_0x9395('0x38'))){_0x5516fe[_0x9395('0x1c')]=qs[_0x9395('0x1c')](_0x1be2d4[_0x9395('0x31')][_0x9395('0x1c')]);_0x5516fe[_0x9395('0x1a')]=qs[_0x9395('0x1a')](_0x1be2d4[_0x9395('0x31')][_0x9395('0x1a')]);}return _0x334999[_0x9395('0x53')](_0x5516fe);}})[_0x9395('0x23')](function(_0x12de8a){if(_0x12de8a){return _0x12de8a?{'count':_0xecd5f1,'rows':_0x12de8a}:null;}})['then'](respondWithResult(_0x31a8d5,null))['catch'](handleError(_0x31a8d5,null));};exports[_0x9395('0x56')]=function(_0x5243a3,_0x22ab7e,_0x2e9fb9){return db[_0x9395('0x2c')][_0x9395('0x54')]({'where':{'id':_0x5243a3['params']['id']}})[_0x9395('0x23')](handleEntityNotFound(_0x22ab7e,null))[_0x9395('0x23')](function(_0x14c5b3){if(_0x14c5b3){return db[_0x9395('0x57')][_0x9395('0x58')](function(_0x5cd23c){return db['Interval'][_0x9395('0x24')]({'where':{'IntervalId':_0x5243a3['params']['id']},'transaction':_0x5cd23c})[_0x9395('0x23')](function(_0x1b3560){var _0x5b329d=_[_0x9395('0x2b')](_0x5243a3[_0x9395('0x4a')],function(_0x482c7f){delete _0x482c7f['id'];_0x482c7f[_0x9395('0x52')]=_0x5243a3['params']['id'];return _0x482c7f;});return db['Interval'][_0x9395('0x59')](_0x5b329d,{'transaction':_0x5cd23c});});})[_0x9395('0x23')](function(){return db[_0x9395('0x2c')]['findAll']({'where':{'IntervalId':_0x5243a3['params']['id']}});});}})[_0x9395('0x23')](respondWithResult(_0x22ab7e,null))[_0x9395('0x44')](handleError(_0x22ab7e,null));}; \ No newline at end of file +var _0x9131=['attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Interval','findAll','rows','catch','params','fields','find','create','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','getIntervals','hasOwnProperty','addIntervals','findOne','sequelize','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x9131,0x133));var _0x1913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9131[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1913('0x0'));var rimraf=require(_0x1913('0x1'));var zipdir=require(_0x1913('0x2'));var jsonpatch=require(_0x1913('0x3'));var rp=require(_0x1913('0x4'));var moment=require('moment');var BPromise=require(_0x1913('0x5'));var Mustache=require(_0x1913('0x6'));var util=require(_0x1913('0x7'));var path=require(_0x1913('0x8'));var sox=require(_0x1913('0x9'));var csv=require(_0x1913('0xa'));var ejs=require(_0x1913('0xb'));var fs=require('fs');var fs_extra=require(_0x1913('0xc'));var _=require(_0x1913('0xd'));var squel=require(_0x1913('0xe'));var crypto=require(_0x1913('0xf'));var jsforce=require(_0x1913('0x10'));var deskjs=require(_0x1913('0x11'));var toCsv=require(_0x1913('0xa'));var querystring=require(_0x1913('0x12'));var Papa=require(_0x1913('0x13'));var Redis=require(_0x1913('0x14'));var authService=require(_0x1913('0x15'));var qs=require(_0x1913('0x16'));var as=require(_0x1913('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1913('0x18'))(_0x1913('0x19'));var utils=require(_0x1913('0x1a'));var config=require(_0x1913('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x1913('0x1c'))['db'];var extensions=require(_0x1913('0x1d'));function respondWithStatusCode(_0x57da64,_0x2d8159){_0x2d8159=_0x2d8159||0xcc;return function(_0x1ff68d){if(_0x1ff68d){return _0x57da64[_0x1913('0x1e')](_0x2d8159);}return _0x57da64[_0x1913('0x1f')](_0x2d8159)['end']();};}function respondWithResult(_0x4e9728,_0x1daa43){_0x1daa43=_0x1daa43||0xc8;return function(_0x423000){if(_0x423000){return _0x4e9728[_0x1913('0x1f')](_0x1daa43)['json'](_0x423000);}};}function respondWithFilteredResult(_0x394d61,_0x3be623){return function(_0x2c024b){if(_0x2c024b){var _0x1eed96=typeof _0x3be623[_0x1913('0x20')]==='undefined'&&typeof _0x3be623[_0x1913('0x21')]==='undefined';var _0x3cd0d6=_0x2c024b[_0x1913('0x22')];var _0x41504a=_0x1eed96?0x0:_0x3be623[_0x1913('0x20')];var _0x1f09af=_0x1eed96?_0x2c024b[_0x1913('0x22')]:_0x3be623[_0x1913('0x20')]+_0x3be623[_0x1913('0x21')];var _0x33b12a;if(_0x1f09af>=_0x3cd0d6){_0x1f09af=_0x3cd0d6;_0x33b12a=0xc8;}else{_0x33b12a=0xce;}_0x394d61[_0x1913('0x1f')](_0x33b12a);return _0x394d61[_0x1913('0x23')](_0x1913('0x24'),_0x41504a+'-'+_0x1f09af+'/'+_0x3cd0d6)['json'](_0x2c024b);}return null;};}function patchUpdates(_0x3533e4){return function(_0x4fceb5){try{jsonpatch[_0x1913('0x25')](_0x4fceb5,_0x3533e4,!![]);}catch(_0x1a2073){return BPromise[_0x1913('0x26')](_0x1a2073);}return _0x4fceb5[_0x1913('0x27')]();};}function saveUpdates(_0x32f917,_0x126a47){return function(_0x21131e){if(_0x21131e){return _0x21131e[_0x1913('0x28')](_0x32f917)[_0x1913('0x29')](function(_0x27c46e){return _0x27c46e;});}return null;};}function removeEntity(_0x1fe4fa,_0x34184f){return function(_0x352906){if(_0x352906){return _0x352906[_0x1913('0x2a')]()['then'](function(){var _0x4f23e7=_0x352906[_0x1913('0x2b')]({'plain':!![]});var _0x1e6873=_0x1913('0x2c');return db[_0x1913('0x2d')][_0x1913('0x2a')]({'where':{'type':_0x1e6873,'resourceId':_0x4f23e7['id']}})['then'](function(){return _0x352906;});})['then'](function(){_0x1fe4fa[_0x1913('0x1f')](0xcc)[_0x1913('0x2e')]();});}};}function handleEntityNotFound(_0x5ed2f5,_0x295af5){return function(_0x537207){if(!_0x537207){_0x5ed2f5[_0x1913('0x1e')](0x194);}return _0x537207;};}function handleError(_0x1039b9,_0x597bc7){_0x597bc7=_0x597bc7||0x1f4;return function(_0x4e240f){logger[_0x1913('0x2f')](_0x4e240f[_0x1913('0x30')]);if(_0x4e240f['name']){delete _0x4e240f[_0x1913('0x31')];}_0x1039b9[_0x1913('0x1f')](_0x597bc7)[_0x1913('0x32')](_0x4e240f);};}exports[_0x1913('0x33')]=function(_0x4eed54,_0x136419){var _0x46e73d={},_0x4b5f72={},_0x3d1bd4={'count':0x0,'rows':[]};var _0x38f449=_[_0x1913('0x34')](db['Interval'][_0x1913('0x35')],function(_0x3a1b53){return{'name':_0x3a1b53[_0x1913('0x36')],'type':_0x3a1b53[_0x1913('0x37')]['key']};});_0x4b5f72['model']=_[_0x1913('0x34')](_0x38f449,_0x1913('0x31'));_0x4b5f72[_0x1913('0x38')]=_[_0x1913('0x39')](_0x4eed54[_0x1913('0x38')]);_0x4b5f72[_0x1913('0x3a')]=_[_0x1913('0x3b')](_0x4b5f72[_0x1913('0x3c')],_0x4b5f72[_0x1913('0x38')]);_0x46e73d['attributes']=_[_0x1913('0x3b')](_0x4b5f72['model'],qs['fields'](_0x4eed54[_0x1913('0x38')]['fields']));_0x46e73d[_0x1913('0x3d')]=_0x46e73d[_0x1913('0x3d')][_0x1913('0x3e')]?_0x46e73d['attributes']:_0x4b5f72[_0x1913('0x3c')];if(!_0x4eed54[_0x1913('0x38')]['hasOwnProperty'](_0x1913('0x3f'))){_0x46e73d[_0x1913('0x21')]=qs[_0x1913('0x21')](_0x4eed54[_0x1913('0x38')][_0x1913('0x21')]);_0x46e73d['offset']=qs[_0x1913('0x20')](_0x4eed54['query'][_0x1913('0x20')]);}_0x46e73d[_0x1913('0x40')]=qs['sort'](_0x4eed54['query'][_0x1913('0x41')]);_0x46e73d[_0x1913('0x42')]=qs[_0x1913('0x3a')](_[_0x1913('0x43')](_0x4eed54[_0x1913('0x38')],_0x4b5f72[_0x1913('0x3a')]),_0x38f449);if(_0x4eed54[_0x1913('0x38')][_0x1913('0x44')]){_0x46e73d[_0x1913('0x42')]=_[_0x1913('0x45')](_0x46e73d[_0x1913('0x42')],{'$or':_[_0x1913('0x34')](_0x38f449,function(_0x2b1907){if(_0x2b1907[_0x1913('0x37')]!==_0x1913('0x46')){var _0x528c81={};_0x528c81[_0x2b1907[_0x1913('0x31')]]={'$like':'%'+_0x4eed54[_0x1913('0x38')][_0x1913('0x44')]+'%'};return _0x528c81;}})});}_0x46e73d=_[_0x1913('0x45')]({},_0x46e73d,_0x4eed54[_0x1913('0x47')]);var _0x3d4fa4={'where':_0x46e73d[_0x1913('0x42')]};return db['Interval']['count'](_0x3d4fa4)[_0x1913('0x29')](function(_0x3049f6){_0x3d1bd4[_0x1913('0x22')]=_0x3049f6;if(_0x4eed54[_0x1913('0x38')][_0x1913('0x48')]){_0x46e73d[_0x1913('0x49')]=[{'all':!![]}];}return db[_0x1913('0x4a')][_0x1913('0x4b')](_0x46e73d);})[_0x1913('0x29')](function(_0x40dc1f){_0x3d1bd4[_0x1913('0x4c')]=_0x40dc1f;return _0x3d1bd4;})[_0x1913('0x29')](respondWithFilteredResult(_0x136419,_0x46e73d))[_0x1913('0x4d')](handleError(_0x136419,null));};exports['show']=function(_0x1dcf97,_0x3ad46d){var _0x22ada8={'raw':!![],'where':{'id':_0x1dcf97[_0x1913('0x4e')]['id']}},_0x3e0036={};_0x3e0036[_0x1913('0x3c')]=_[_0x1913('0x39')](db[_0x1913('0x4a')]['rawAttributes']);_0x3e0036[_0x1913('0x38')]=_[_0x1913('0x39')](_0x1dcf97[_0x1913('0x38')]);_0x3e0036[_0x1913('0x3a')]=_[_0x1913('0x3b')](_0x3e0036[_0x1913('0x3c')],_0x3e0036[_0x1913('0x38')]);_0x22ada8['attributes']=_['intersection'](_0x3e0036['model'],qs[_0x1913('0x4f')](_0x1dcf97[_0x1913('0x38')][_0x1913('0x4f')]));_0x22ada8[_0x1913('0x3d')]=_0x22ada8[_0x1913('0x3d')][_0x1913('0x3e')]?_0x22ada8[_0x1913('0x3d')]:_0x3e0036['model'];if(_0x1dcf97[_0x1913('0x38')][_0x1913('0x48')]){_0x22ada8['include']=[{'all':!![]}];}_0x22ada8=_['merge']({},_0x22ada8,_0x1dcf97[_0x1913('0x47')]);return db[_0x1913('0x4a')][_0x1913('0x50')](_0x22ada8)[_0x1913('0x29')](handleEntityNotFound(_0x3ad46d,null))[_0x1913('0x29')](respondWithResult(_0x3ad46d,null))[_0x1913('0x4d')](handleError(_0x3ad46d,null));};exports[_0x1913('0x51')]=function(_0x4fe44f,_0x108409){return db[_0x1913('0x4a')]['create'](_0x4fe44f['body'],{})[_0x1913('0x29')](function(_0x4df480){var _0x3318b5=_0x4fe44f['user'][_0x1913('0x2b')]({'plain':!![]});if(!_0x3318b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3318b5[_0x1913('0x52')]===_0x1913('0x53')){var _0x254be2=_0x4df480['get']({'plain':!![]});var _0x28d1d0='Intervals';return db['UserProfileSection'][_0x1913('0x50')]({'where':{'name':_0x28d1d0,'userProfileId':_0x3318b5['userProfileId']},'raw':!![]})[_0x1913('0x29')](function(_0x1270fa){if(_0x1270fa&&_0x1270fa['autoAssociation']===0x0){return db[_0x1913('0x2d')][_0x1913('0x51')]({'name':_0x254be2[_0x1913('0x31')],'resourceId':_0x254be2['id'],'type':_0x1270fa[_0x1913('0x31')],'sectionId':_0x1270fa['id']},{})[_0x1913('0x29')](function(){return _0x4df480;});}else{return _0x4df480;}})[_0x1913('0x4d')](function(_0x26a1be){logger[_0x1913('0x2f')](_0x1913('0x54'),_0x26a1be);throw _0x26a1be;});}return _0x4df480;})[_0x1913('0x29')](respondWithResult(_0x108409,0xc9))['catch'](handleError(_0x108409,null));};exports[_0x1913('0x28')]=function(_0x50dfa2,_0x45a503){if(_0x50dfa2[_0x1913('0x55')]['id']){delete _0x50dfa2[_0x1913('0x55')]['id'];}return db[_0x1913('0x4a')][_0x1913('0x50')]({'where':{'id':_0x50dfa2[_0x1913('0x4e')]['id']}})[_0x1913('0x29')](handleEntityNotFound(_0x45a503,null))[_0x1913('0x29')](saveUpdates(_0x50dfa2[_0x1913('0x55')],null))[_0x1913('0x29')](respondWithResult(_0x45a503,null))[_0x1913('0x4d')](handleError(_0x45a503,null));};exports['destroy']=function(_0x312fc1,_0x561c6b){return db[_0x1913('0x4a')]['find']({'where':{'id':_0x312fc1['params']['id']}})[_0x1913('0x29')](handleEntityNotFound(_0x561c6b,null))[_0x1913('0x29')](removeEntity(_0x561c6b,null))[_0x1913('0x4d')](handleError(_0x561c6b,null));};exports[_0x1913('0x56')]=function(_0x15b078,_0x26ee34,_0x1448f3){if(_0x15b078['body']['id']){delete _0x15b078[_0x1913('0x55')]['id'];}return db[_0x1913('0x4a')][_0x1913('0x50')]({'where':{'id':_0x15b078[_0x1913('0x4e')]['id']}})[_0x1913('0x29')](handleEntityNotFound(_0x26ee34,null))[_0x1913('0x29')](function(_0x4bed86){if(_0x4bed86){_0x15b078[_0x1913('0x55')]['IntervalId']=_0x4bed86['id'];return db[_0x1913('0x4a')][_0x1913('0x51')](_0x15b078[_0x1913('0x55')]);}})[_0x1913('0x29')](respondWithResult(_0x26ee34,null))[_0x1913('0x4d')](handleError(_0x26ee34,null));};exports['getIntervals']=function(_0x170fb7,_0x5c7d94,_0xb698eb){var _0x4c3f6b={};var _0x1982a3={};var _0x57f13e;var _0x33bccd;return db[_0x1913('0x4a')]['findOne']({'where':{'id':_0x170fb7[_0x1913('0x4e')]['id']}})[_0x1913('0x29')](handleEntityNotFound(_0x5c7d94,null))[_0x1913('0x29')](function(_0x48a9e8){if(_0x48a9e8){_0x57f13e=_0x48a9e8;_0x1982a3[_0x1913('0x3c')]=_['keys'](db[_0x1913('0x4a')][_0x1913('0x35')]);_0x1982a3['query']=_[_0x1913('0x39')](_0x170fb7['query']);_0x1982a3[_0x1913('0x3a')]=_[_0x1913('0x3b')](_0x1982a3[_0x1913('0x3c')],_0x1982a3['query']);_0x4c3f6b[_0x1913('0x3d')]=_[_0x1913('0x3b')](_0x1982a3[_0x1913('0x3c')],qs[_0x1913('0x4f')](_0x170fb7[_0x1913('0x38')]['fields']));_0x4c3f6b['attributes']=_0x4c3f6b[_0x1913('0x3d')][_0x1913('0x3e')]?_0x4c3f6b['attributes']:_0x1982a3[_0x1913('0x3c')];_0x4c3f6b[_0x1913('0x40')]=qs[_0x1913('0x41')](_0x170fb7[_0x1913('0x38')][_0x1913('0x41')]);_0x4c3f6b[_0x1913('0x42')]=qs[_0x1913('0x3a')](_[_0x1913('0x43')](_0x170fb7[_0x1913('0x38')],_0x1982a3['filters']));if(_0x170fb7[_0x1913('0x38')][_0x1913('0x44')]){_0x4c3f6b[_0x1913('0x42')]=_[_0x1913('0x45')](_0x4c3f6b[_0x1913('0x42')],{'$or':_[_0x1913('0x34')](_0x4c3f6b['attributes'],function(_0x55a807){var _0x3f6ce4={};_0x3f6ce4[_0x55a807]={'$like':'%'+_0x170fb7['query']['filter']+'%'};return _0x3f6ce4;})});}_0x4c3f6b=_[_0x1913('0x45')]({},_0x4c3f6b,_0x170fb7[_0x1913('0x47')]);return _0x57f13e[_0x1913('0x57')](_0x4c3f6b);}})[_0x1913('0x29')](function(_0x304928){if(_0x304928){_0x33bccd=_0x304928[_0x1913('0x3e')];if(!_0x170fb7['query'][_0x1913('0x58')]('nolimit')){_0x4c3f6b[_0x1913('0x21')]=qs[_0x1913('0x21')](_0x170fb7[_0x1913('0x38')][_0x1913('0x21')]);_0x4c3f6b['offset']=qs['offset'](_0x170fb7[_0x1913('0x38')][_0x1913('0x20')]);}return _0x57f13e['getIntervals'](_0x4c3f6b);}})['then'](function(_0x104b20){if(_0x104b20){return _0x104b20?{'count':_0x33bccd,'rows':_0x104b20}:null;}})[_0x1913('0x29')](respondWithResult(_0x5c7d94,null))[_0x1913('0x4d')](handleError(_0x5c7d94,null));};exports[_0x1913('0x59')]=function(_0x35d555,_0x4828e2,_0x530bf3){return db[_0x1913('0x4a')][_0x1913('0x5a')]({'where':{'id':_0x35d555['params']['id']}})['then'](handleEntityNotFound(_0x4828e2,null))[_0x1913('0x29')](function(_0x3af290){if(_0x3af290){return db[_0x1913('0x5b')]['transaction'](function(_0x1cf19e){return db['Interval']['destroy']({'where':{'IntervalId':_0x35d555['params']['id']},'transaction':_0x1cf19e})[_0x1913('0x29')](function(_0x15fadb){var _0x49419b=_[_0x1913('0x34')](_0x35d555[_0x1913('0x55')],function(_0x4163cc){delete _0x4163cc['id'];_0x4163cc['IntervalId']=_0x35d555['params']['id'];return _0x4163cc;});return db[_0x1913('0x4a')]['bulkCreate'](_0x49419b,{'transaction':_0x1cf19e});});})[_0x1913('0x29')](function(){return db['Interval'][_0x1913('0x4b')]({'where':{'IntervalId':_0x35d555['params']['id']}});});}})[_0x1913('0x29')](respondWithResult(_0x4828e2,null))[_0x1913('0x4d')](handleError(_0x4828e2,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 0d99396..181c92c 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 _0xda06=['exports','Interval','tools_intervals','rewrite','interval','string','getIntervals','then','all','map','ifTime','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime'];(function(_0x4b4c3b,_0x121398){var _0x125d77=function(_0x3cdff5){while(--_0x3cdff5){_0x4b4c3b['push'](_0x4b4c3b['shift']());}};_0x125d77(++_0x121398);}(_0xda06,0x1e7));var _0x6da0=function(_0x17e600,_0x1fdf60){_0x17e600=_0x17e600-0x0;var _0x317515=_0xda06[_0x17e600];return _0x317515;};'use strict';var attributes=require(_0x6da0('0x0'));var extensions=require(_0x6da0('0x1'));var iftime=require(_0x6da0('0x2'))['iftime'];module[_0x6da0('0x3')]=function(_0x195f6c){return _0x195f6c['define'](_0x6da0('0x4'),attributes,{'tableName':_0x6da0('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x26f1c4){extensions['rewrite'](_0x195f6c,_0x26f1c4);},'afterBulkCreate':function(_0x444be8,_0x50558e,_0x1ad3e9){_0x1ad3e9();extensions[_0x6da0('0x6')](_0x195f6c,_0x444be8[0x0]);},'afterUpdate':function(_0xb5b97f){extensions[_0x6da0('0x6')](_0x195f6c,_0xb5b97f);},'afterDestroy':function(_0x4a58f3){extensions[_0x6da0('0x6')](_0x195f6c,_0x4a58f3);}},'instanceMethods':{'ifTime':function(_0x4e8d68=undefined,_0x3ae354=new Date()){if(typeof this[_0x6da0('0x7')]===_0x6da0('0x8')){return iftime(this['interval'],_0x4e8d68,_0x3ae354);}else{return this[_0x6da0('0x9')]()[_0x6da0('0xa')](function(_0x242086){return Promise[_0x6da0('0xb')](_0x242086[_0x6da0('0xc')](function(_0x324dc6){return _0x324dc6[_0x6da0('0xd')](_0x4e8d68,_0x3ae354);}));})[_0x6da0('0xa')](function(_0x23e0af){return _0x23e0af['reduce'](function(_0x523da5,_0x1c8b1d){return _0x523da5||_0x1c8b1d;},![]);});}}}});}; \ No newline at end of file +var _0xa799=['ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval','rewrite','string','getIntervals','then','all'];(function(_0x1f8494,_0x38f6a1){var _0x28c057=function(_0x2dd8db){while(--_0x2dd8db){_0x1f8494['push'](_0x1f8494['shift']());}};_0x28c057(++_0x38f6a1);}(_0xa799,0x1a2));var _0x9a79=function(_0x1139b6,_0x32a3e1){_0x1139b6=_0x1139b6-0x0;var _0x4d1abf=_0xa799[_0x1139b6];return _0x4d1abf;};'use strict';var attributes=require(_0x9a79('0x0'));var extensions=require(_0x9a79('0x1'));var iftime=require(_0x9a79('0x2'))['iftime'];module[_0x9a79('0x3')]=function(_0x91f369){return _0x91f369[_0x9a79('0x4')](_0x9a79('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x17a143){extensions[_0x9a79('0x6')](_0x91f369,_0x17a143);},'afterBulkCreate':function(_0x587a9d,_0x5f4815,_0x35a908){_0x35a908();extensions['rewrite'](_0x91f369,_0x587a9d[0x0]);},'afterUpdate':function(_0xa1c6d4){extensions['rewrite'](_0x91f369,_0xa1c6d4);},'afterDestroy':function(_0x4f68fa){extensions[_0x9a79('0x6')](_0x91f369,_0x4f68fa);}},'instanceMethods':{'ifTime':function(_0x4fd798=undefined,_0x573ea3=new Date()){if(typeof this['interval']===_0x9a79('0x7')){return iftime(this['interval'],_0x4fd798,_0x573ea3);}else{return this[_0x9a79('0x8')]()[_0x9a79('0x9')](function(_0x5be3e1){return Promise[_0x9a79('0xa')](_0x5be3e1['map'](function(_0x3f689c){return _0x3f689c[_0x9a79('0xb')](_0x4fd798,_0x573ea3);}));})[_0x9a79('0x9')](function(_0x524917){return _0x524917[_0x9a79('0xc')](function(_0x1d0abd,_0x2f29ee){return _0x1d0abd||_0x2f29ee;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a5c51be..0e33a1b 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 _0xdd65=['model','then','debug','catch','error','message','ShowInterval','Interval','find','where','info','stringify','findAll','ifTime','format','name','join','IntervalIftime','intervalIds','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','isArray','reduce','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','options','raw','attributes','include','map'];(function(_0x3dacf9,_0x20e855){var _0x1a00b4=function(_0x501744){while(--_0x501744){_0x3dacf9['push'](_0x3dacf9['shift']());}};_0x1a00b4(++_0x20e855);}(_0xdd65,0xe4));var _0x5dd6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xdd65[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5dd6('0x0'));var util=require('util');var db=require(_0x5dd6('0x1'))['db'];var iftime=require(_0x5dd6('0x2'))[_0x5dd6('0x3')];var logger=require(_0x5dd6('0x4'))(_0x5dd6('0x5'));exports[_0x5dd6('0x6')]=function(_0x2c91db){var _0x489cc8=this;return new Promise(function(_0x164cc7,_0x24ee1c){return db['Interval']['findAll']({'raw':_0x2c91db[_0x5dd6('0x7')]?_0x2c91db[_0x5dd6('0x7')][_0x5dd6('0x8')]===undefined?!![]:![]:!![],'where':_0x2c91db['options']?_0x2c91db[_0x5dd6('0x7')]['where']||null:null,'attributes':_0x2c91db[_0x5dd6('0x7')]?_0x2c91db['options'][_0x5dd6('0x9')]||null:null,'limit':_0x2c91db[_0x5dd6('0x7')]?_0x2c91db[_0x5dd6('0x7')]['limit']||null:null,'include':_0x2c91db[_0x5dd6('0x7')]?_0x2c91db[_0x5dd6('0x7')][_0x5dd6('0xa')]?_[_0x5dd6('0xb')](_0x2c91db['options'][_0x5dd6('0xa')],function(_0x1fe1a3){return{'model':db[_0x1fe1a3['model']],'as':_0x1fe1a3['as'],'attributes':_0x1fe1a3[_0x5dd6('0x9')],'include':_0x1fe1a3[_0x5dd6('0xa')]?_[_0x5dd6('0xb')](_0x1fe1a3[_0x5dd6('0xa')],function(_0x362f20){return{'model':db[_0x362f20[_0x5dd6('0xc')]],'as':_0x362f20['as'],'attributes':_0x362f20[_0x5dd6('0x9')],'include':_0x362f20[_0x5dd6('0xa')]?_['map'](_0x362f20[_0x5dd6('0xa')],function(_0xaecf25){return{'model':db[_0xaecf25['model']],'as':_0xaecf25['as'],'attributes':_0xaecf25[_0x5dd6('0x9')]};}):[]};}):[]};}):[]:[]})[_0x5dd6('0xd')](function(_0x4cb60f){logger['info'](_0x5dd6('0x6'),_0x2c91db);logger[_0x5dd6('0xe')](_0x5dd6('0x6'),_0x2c91db,JSON['stringify'](_0x4cb60f));_0x164cc7(_0x4cb60f);})[_0x5dd6('0xf')](function(_0x469d0f){logger[_0x5dd6('0x10')]('GetInterval',_0x469d0f[_0x5dd6('0x11')],_0x2c91db);_0x24ee1c(_0x489cc8[_0x5dd6('0x10')](0x1f4,_0x469d0f[_0x5dd6('0x11')]));});});};exports[_0x5dd6('0x12')]=function(_0x1e4bcb){var _0x3ce448=this;return new Promise(function(_0x55962b,_0x526534){return db[_0x5dd6('0x13')][_0x5dd6('0x14')]({'raw':_0x1e4bcb[_0x5dd6('0x7')]?_0x1e4bcb['options'][_0x5dd6('0x8')]===undefined?!![]:![]:!![],'where':_0x1e4bcb[_0x5dd6('0x7')]?_0x1e4bcb[_0x5dd6('0x7')][_0x5dd6('0x15')]||null:null,'attributes':_0x1e4bcb[_0x5dd6('0x7')]?_0x1e4bcb[_0x5dd6('0x7')][_0x5dd6('0x9')]||null:null,'include':_0x1e4bcb[_0x5dd6('0x7')]?_0x1e4bcb[_0x5dd6('0x7')][_0x5dd6('0xa')]?_[_0x5dd6('0xb')](_0x1e4bcb[_0x5dd6('0x7')][_0x5dd6('0xa')],function(_0x3f1410){return{'model':db[_0x3f1410['model']],'as':_0x3f1410['as'],'attributes':_0x3f1410[_0x5dd6('0x9')],'include':_0x3f1410[_0x5dd6('0xa')]?_['map'](_0x3f1410[_0x5dd6('0xa')],function(_0x4f7390){return{'model':db[_0x4f7390['model']],'as':_0x4f7390['as'],'attributes':_0x4f7390[_0x5dd6('0x9')],'include':_0x4f7390[_0x5dd6('0xa')]?_['map'](_0x4f7390['include'],function(_0x792244){return{'model':db[_0x792244[_0x5dd6('0xc')]],'as':_0x792244['as'],'attributes':_0x792244[_0x5dd6('0x9')]};}):[]};}):[]};}):[]:[]})[_0x5dd6('0xd')](function(_0x11edcc){logger[_0x5dd6('0x16')](_0x5dd6('0x12'),_0x1e4bcb);logger['debug'](_0x5dd6('0x12'),_0x1e4bcb,JSON[_0x5dd6('0x17')](_0x11edcc));_0x55962b(_0x11edcc);})[_0x5dd6('0xf')](function(_0x3bb729){logger[_0x5dd6('0x10')](_0x5dd6('0x12'),_0x3bb729[_0x5dd6('0x11')],_0x1e4bcb);_0x526534(_0x3ce448[_0x5dd6('0x10')](0x1f4,_0x3bb729['message']));});});};function checkArrayOfIntervals(_0x128fa2,_0x30a44d){var _0x40aac5=[];return db['Interval'][_0x5dd6('0x18')]({'where':{'id':_0x128fa2}})[_0x5dd6('0xd')](function(_0x429bf7){_0x40aac5=_0x429bf7;return Promise['all'](_0x40aac5[_0x5dd6('0xb')](function(_0x58c31d){return _0x58c31d[_0x5dd6('0x19')](_0x30a44d);}));})[_0x5dd6('0xd')](function(_0xc70e5d){var _0x2d5684=_0xc70e5d['reduce'](function(_0x351032,_0x1f18ae){return _0x351032||_0x1f18ae;},![]);logger[_0x5dd6('0x16')](util[_0x5dd6('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x40aac5[_0x5dd6('0xb')](function(_0x174446){return _0x174446[_0x5dd6('0x1b')];})[_0x5dd6('0x1c')](',\x20'),_0x40aac5[_0x5dd6('0xb')](function(_0x32ab70){return _0x32ab70['id'];})[_0x5dd6('0x1c')](',\x20')));return _0x2d5684;});}function checkSingleInterval(_0x5b8c8d,_0x5f06ff){return db['Interval']['findById'](_0x5b8c8d)[_0x5dd6('0xd')](function(_0x214221){if(_0x214221){logger[_0x5dd6('0x16')](util[_0x5dd6('0x1a')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x214221[_0x5dd6('0x1b')],_0x214221['id']));return _0x214221['ifTime'](_0x5f06ff);}});}exports[_0x5dd6('0x1d')]=function(_0x3dae23){var _0x463998=_0x3dae23[_0x5dd6('0x1e')];var _0x166b0e=Array['isArray'](_0x3dae23[_0x5dd6('0x1f')])?_0x3dae23[_0x5dd6('0x1f')]:typeof _0x3dae23[_0x5dd6('0x1f')]===_0x5dd6('0x20')?[_0x3dae23[_0x5dd6('0x1f')]]:[];var _0x527ccb=_0x3dae23['timezone']||undefined;var _0x17d912=![];if(_0x166b0e[_0x5dd6('0x21')]){logger['info'](util[_0x5dd6('0x1a')](_0x5dd6('0x22'),_0x166b0e[_0x5dd6('0x1c')](';\x20')));}if(_0x527ccb){logger[_0x5dd6('0x16')](util[_0x5dd6('0x1a')](_0x5dd6('0x23'),_0x527ccb));}logger[_0x5dd6('0xe')]('Iftime',_0x17d912);logger[_0x5dd6('0x24')](_0x5dd6('0x1d'),_0x3dae23);return Promise[_0x5dd6('0x25')]()['then'](function(){if(Array[_0x5dd6('0x26')](_0x463998)){return checkArrayOfIntervals(_0x463998,_0x527ccb);}else if(_0x463998){return checkSingleInterval(_0x463998,_0x527ccb);}})['then'](function(_0x3d2c01){var _0x323488=_0x166b0e[_0x5dd6('0x27')](function(_0x16341c,_0x5887f6){return _0x16341c||iftime(_0x5887f6,_0x527ccb);},![]);_0x17d912=_0x3d2c01||_0x323488;return _0x17d912;})[_0x5dd6('0xf')](function(_0x1aa149){logger[_0x5dd6('0x10')](_0x5dd6('0x1d'),_0x3dae23,_0x1aa149);throw this[_0x5dd6('0x10')](0x1f4,_0x1aa149[_0x5dd6('0x11')]);});}; \ No newline at end of file +var _0x594b=['stringify','catch','message','find','then','ShowInterval','debug','error','Interval','ifTime','reduce','name','join','findById','format','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','findAll','options','raw','where','attributes','limit','include','model','map','info'];(function(_0x191f9d,_0x21976f){var _0x58e60d=function(_0x598c0d){while(--_0x598c0d){_0x191f9d['push'](_0x191f9d['shift']());}};_0x58e60d(++_0x21976f);}(_0x594b,0x147));var _0xb594=function(_0x3bc18f,_0x5ee407){_0x3bc18f=_0x3bc18f-0x0;var _0xc8fb12=_0x594b[_0x3bc18f];return _0xc8fb12;};'use strict';var _=require(_0xb594('0x0'));var util=require(_0xb594('0x1'));var db=require(_0xb594('0x2'))['db'];var iftime=require(_0xb594('0x3'))[_0xb594('0x4')];var logger=require('../../config/logger')(_0xb594('0x5'));exports[_0xb594('0x6')]=function(_0x101993){var _0x10dceb=this;return new Promise(function(_0x42e8b,_0x25532a){return db['Interval'][_0xb594('0x7')]({'raw':_0x101993[_0xb594('0x8')]?_0x101993[_0xb594('0x8')][_0xb594('0x9')]===undefined?!![]:![]:!![],'where':_0x101993[_0xb594('0x8')]?_0x101993[_0xb594('0x8')][_0xb594('0xa')]||null:null,'attributes':_0x101993[_0xb594('0x8')]?_0x101993[_0xb594('0x8')][_0xb594('0xb')]||null:null,'limit':_0x101993[_0xb594('0x8')]?_0x101993[_0xb594('0x8')][_0xb594('0xc')]||null:null,'include':_0x101993[_0xb594('0x8')]?_0x101993[_0xb594('0x8')][_0xb594('0xd')]?_['map'](_0x101993[_0xb594('0x8')][_0xb594('0xd')],function(_0x4d66da){return{'model':db[_0x4d66da[_0xb594('0xe')]],'as':_0x4d66da['as'],'attributes':_0x4d66da['attributes'],'include':_0x4d66da[_0xb594('0xd')]?_[_0xb594('0xf')](_0x4d66da['include'],function(_0x2cbdaa){return{'model':db[_0x2cbdaa[_0xb594('0xe')]],'as':_0x2cbdaa['as'],'attributes':_0x2cbdaa['attributes'],'include':_0x2cbdaa[_0xb594('0xd')]?_[_0xb594('0xf')](_0x2cbdaa[_0xb594('0xd')],function(_0x51058e){return{'model':db[_0x51058e[_0xb594('0xe')]],'as':_0x51058e['as'],'attributes':_0x51058e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5de023){logger[_0xb594('0x10')](_0xb594('0x6'),_0x101993);logger['debug'](_0xb594('0x6'),_0x101993,JSON[_0xb594('0x11')](_0x5de023));_0x42e8b(_0x5de023);})[_0xb594('0x12')](function(_0x3b4718){logger['error'](_0xb594('0x6'),_0x3b4718[_0xb594('0x13')],_0x101993);_0x25532a(_0x10dceb['error'](0x1f4,_0x3b4718[_0xb594('0x13')]));});});};exports['ShowInterval']=function(_0x8e9cb0){var _0x4b0e58=this;return new Promise(function(_0x4407cc,_0x106cd6){return db['Interval'][_0xb594('0x14')]({'raw':_0x8e9cb0[_0xb594('0x8')]?_0x8e9cb0[_0xb594('0x8')][_0xb594('0x9')]===undefined?!![]:![]:!![],'where':_0x8e9cb0[_0xb594('0x8')]?_0x8e9cb0[_0xb594('0x8')][_0xb594('0xa')]||null:null,'attributes':_0x8e9cb0['options']?_0x8e9cb0[_0xb594('0x8')]['attributes']||null:null,'include':_0x8e9cb0['options']?_0x8e9cb0[_0xb594('0x8')][_0xb594('0xd')]?_['map'](_0x8e9cb0['options'][_0xb594('0xd')],function(_0x299d26){return{'model':db[_0x299d26[_0xb594('0xe')]],'as':_0x299d26['as'],'attributes':_0x299d26[_0xb594('0xb')],'include':_0x299d26[_0xb594('0xd')]?_['map'](_0x299d26[_0xb594('0xd')],function(_0x5038ee){return{'model':db[_0x5038ee[_0xb594('0xe')]],'as':_0x5038ee['as'],'attributes':_0x5038ee[_0xb594('0xb')],'include':_0x5038ee['include']?_[_0xb594('0xf')](_0x5038ee['include'],function(_0x28a5e5){return{'model':db[_0x28a5e5[_0xb594('0xe')]],'as':_0x28a5e5['as'],'attributes':_0x28a5e5['attributes']};}):[]};}):[]};}):[]:[]})[_0xb594('0x15')](function(_0x255ba1){logger[_0xb594('0x10')](_0xb594('0x16'),_0x8e9cb0);logger[_0xb594('0x17')](_0xb594('0x16'),_0x8e9cb0,JSON[_0xb594('0x11')](_0x255ba1));_0x4407cc(_0x255ba1);})[_0xb594('0x12')](function(_0x192464){logger['error'](_0xb594('0x16'),_0x192464['message'],_0x8e9cb0);_0x106cd6(_0x4b0e58[_0xb594('0x18')](0x1f4,_0x192464[_0xb594('0x13')]));});});};function checkArrayOfIntervals(_0x3f02d9,_0x239982){var _0x52b51f=[];return db[_0xb594('0x19')][_0xb594('0x7')]({'where':{'id':_0x3f02d9}})[_0xb594('0x15')](function(_0x2a7261){_0x52b51f=_0x2a7261;return Promise['all'](_0x52b51f[_0xb594('0xf')](function(_0x5050a8){return _0x5050a8[_0xb594('0x1a')](_0x239982);}));})[_0xb594('0x15')](function(_0x2dcd1d){var _0x2fdd94=_0x2dcd1d[_0xb594('0x1b')](function(_0x21e234,_0x30b081){return _0x21e234||_0x30b081;},![]);logger[_0xb594('0x10')](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x52b51f[_0xb594('0xf')](function(_0x574e91){return _0x574e91[_0xb594('0x1c')];})[_0xb594('0x1d')](',\x20'),_0x52b51f[_0xb594('0xf')](function(_0x14035e){return _0x14035e['id'];})[_0xb594('0x1d')](',\x20')));return _0x2fdd94;});}function checkSingleInterval(_0x1db808,_0x49df12){return db[_0xb594('0x19')][_0xb594('0x1e')](_0x1db808)[_0xb594('0x15')](function(_0x5b168c){if(_0x5b168c){logger[_0xb594('0x10')](util[_0xb594('0x1f')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x5b168c['name'],_0x5b168c['id']));return _0x5b168c[_0xb594('0x1a')](_0x49df12);}});}exports[_0xb594('0x20')]=function(_0xbbbb66){var _0x5a45c2=_0xbbbb66[_0xb594('0x21')];var _0x399770=Array[_0xb594('0x22')](_0xbbbb66[_0xb594('0x23')])?_0xbbbb66['intervals']:typeof _0xbbbb66[_0xb594('0x23')]===_0xb594('0x24')?[_0xbbbb66[_0xb594('0x23')]]:[];var _0x3e2e27=_0xbbbb66[_0xb594('0x25')]||undefined;var _0x488b74=![];if(_0x399770[_0xb594('0x26')]){logger[_0xb594('0x10')](util[_0xb594('0x1f')](_0xb594('0x27'),_0x399770[_0xb594('0x1d')](';\x20')));}if(_0x3e2e27){logger['info'](util[_0xb594('0x1f')](_0xb594('0x28'),_0x3e2e27));}logger['debug'](_0xb594('0x29'),_0x488b74);logger['silly'](_0xb594('0x20'),_0xbbbb66);return Promise[_0xb594('0x2a')]()[_0xb594('0x15')](function(){if(Array[_0xb594('0x22')](_0x5a45c2)){return checkArrayOfIntervals(_0x5a45c2,_0x3e2e27);}else if(_0x5a45c2){return checkSingleInterval(_0x5a45c2,_0x3e2e27);}})[_0xb594('0x15')](function(_0x18b27f){var _0x300ddb=_0x399770[_0xb594('0x1b')](function(_0x1df002,_0x127c95){return _0x1df002||iftime(_0x127c95,_0x3e2e27);},![]);_0x488b74=_0x18b27f||_0x300ddb;return _0x488b74;})[_0xb594('0x12')](function(_0x209e67){logger['error']('IntervalIftime',_0xbbbb66,_0x209e67);throw this[_0xb594('0x18')](0x1f4,_0x209e67['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index a454004..1221467 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x311b0c,_0x526166){var _0x4af3af=function(_0x30dbd3){while(--_0x30dbd3){_0x311b0c['push'](_0x311b0c['shift']());}};_0x4af3af(++_0x526166);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5b8816,_0x25e1cb){_0x5b8816=_0x5b8816-0x0;var _0x71d26e=_0x5f2f[_0x5b8816];return _0x71d26e;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x13c312,_0xfe3386){var _0x7c3fe5=function(_0xe79163){while(--_0xe79163){_0x13c312['push'](_0x13c312['shift']());}};_0x7c3fe5(++_0xfe3386);}(_0xdb28,0x106));var _0x8db2=function(_0x1c08cc,_0x53bc4b){_0x1c08cc=_0x1c08cc-0x0;var _0x41d7af=_0xdb28[_0x1c08cc];return _0x41d7af;};'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 a964b24..c578948 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 _0xdac1=['json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','application/json','Basic\x20','toString','request','setEncoding','data','end','status','statusCode','parse','error'];(function(_0x698e19,_0x37fd58){var _0x3db5bf=function(_0x73b6b0){while(--_0x73b6b0){_0x698e19['push'](_0x698e19['shift']());}};_0x3db5bf(++_0x37fd58);}(_0xdac1,0x67));var _0x1dac=function(_0x32c0ac,_0x1d8160){_0x32c0ac=_0x32c0ac-0x0;var _0x871cc1=_0xdac1[_0x32c0ac];return _0x871cc1;};'use strict';var BPromise=require(_0x1dac('0x0'));var https=require(_0x1dac('0x1'));var logger=require('../../config/logger')(_0x1dac('0x2'));var USERNAME=_0x1dac('0x3');var PASSWORD=_0x1dac('0x4');function openIssue(_0x22f2b0,_0x12083e){var _0x1b4850={'fields':{'project':{'key':_0x22f2b0[_0x1dac('0x5')]||'MOTGUI'},'summary':(_0x22f2b0[_0x1dac('0x6')]||_0x1dac('0x7'))+_0x1dac('0x8')+_0x22f2b0['ip'],'description':_0x22f2b0[_0x1dac('0x9')]||JSON[_0x1dac('0xa')](_0x22f2b0),'issuetype':{'name':_0x22f2b0[_0x1dac('0xb')]||_0x1dac('0xc')}}};_0x1b4850[_0x1dac('0xd')][_0x1dac('0xe')]=_0x22f2b0[_0x1dac('0xf')];_0x1b4850['fields'][_0x1dac('0x10')]=_0x22f2b0[_0x1dac('0x11')];_0x1b4850['fields'][_0x1dac('0x12')]=_0x22f2b0['newToken'];_0x1b4850[_0x1dac('0xd')][_0x1dac('0x13')]=_0x22f2b0[_0x1dac('0x14')];_0x1b4850[_0x1dac('0xd')][_0x1dac('0x15')]=_0x22f2b0[_0x1dac('0x16')];_0x1b4850[_0x1dac('0xd')][_0x1dac('0x17')]=_0x22f2b0['ip'];var _0x8509d9={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x1dac('0x18'),'Authorization':_0x1dac('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x1dac('0x1a')]('base64')}};var _0x3cb453=JSON[_0x1dac('0xa')](_0x1b4850);var _0x5b8836=https[_0x1dac('0x1b')](_0x8509d9,function(_0x1e21d0){_0x1e21d0[_0x1dac('0x1c')]('utf8');var _0x5cdb21='';_0x1e21d0['on'](_0x1dac('0x1d'),function(_0x5acc38){_0x5cdb21+=_0x5acc38;});_0x1e21d0['on'](_0x1dac('0x1e'),function(){if(_0x12083e){return _0x12083e[_0x1dac('0x1f')](_0x1e21d0[_0x1dac('0x20')])['json'](JSON[_0x1dac('0x21')](_0x5cdb21));}});});_0x5b8836['on'](_0x1dac('0x22'),function(_0x2bd525){if(_0x12083e){return _0x12083e[_0x1dac('0x1f')](0x1f4)[_0x1dac('0x23')]({'errors':[{'message':_0x1dac('0x24'),'type':_0x1dac('0x25')}]});}});_0x5b8836[_0x1dac('0x26')](_0x3cb453);_0x5b8836[_0x1dac('0x1e')]();}exports[_0x1dac('0x27')]=openIssue;exports[_0x1dac('0x28')]=function(_0x1aa3b1,_0x3e1a87){_0x1aa3b1[_0x1dac('0x29')]['ip']=_0x1aa3b1[_0x1dac('0x2a')]['x-forwarded-for']||_0x1aa3b1[_0x1dac('0x2b')][_0x1dac('0x2c')]||_0x1aa3b1[_0x1dac('0x2d')]['remoteAddress']||_0x1aa3b1[_0x1dac('0x2b')][_0x1dac('0x2d')][_0x1dac('0x2c')];return openIssue(_0x1aa3b1['body'],_0x3e1a87);}; \ No newline at end of file +var _0x3129=['\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary'];(function(_0x53a9fa,_0x3e5667){var _0x32c5dd=function(_0x4a29e5){while(--_0x4a29e5){_0x53a9fa['push'](_0x53a9fa['shift']());}};_0x32c5dd(++_0x3e5667);}(_0x3129,0xec));var _0x9312=function(_0x587b79,_0x1f31fd){_0x587b79=_0x587b79-0x0;var _0x5eb875=_0x3129[_0x587b79];return _0x5eb875;};'use strict';var BPromise=require(_0x9312('0x0'));var https=require(_0x9312('0x1'));var logger=require(_0x9312('0x2'))(_0x9312('0x3'));var USERNAME=_0x9312('0x4');var PASSWORD=_0x9312('0x5');function openIssue(_0x1e126d,_0x116c05){var _0x3a6528={'fields':{'project':{'key':_0x1e126d[_0x9312('0x6')]||_0x9312('0x7')},'summary':(_0x1e126d[_0x9312('0x8')]||'Report')+_0x9312('0x9')+_0x1e126d['ip'],'description':_0x1e126d['description']||JSON[_0x9312('0xa')](_0x1e126d),'issuetype':{'name':_0x1e126d[_0x9312('0xb')]||_0x9312('0xc')}}};_0x3a6528[_0x9312('0xd')][_0x9312('0xe')]=_0x1e126d[_0x9312('0xf')];_0x3a6528[_0x9312('0xd')][_0x9312('0x10')]=_0x1e126d['oldToken'];_0x3a6528[_0x9312('0xd')][_0x9312('0x11')]=_0x1e126d[_0x9312('0x12')];_0x3a6528['fields'][_0x9312('0x13')]=_0x1e126d[_0x9312('0x14')];_0x3a6528['fields'][_0x9312('0x15')]=_0x1e126d[_0x9312('0x16')];_0x3a6528[_0x9312('0xd')][_0x9312('0x17')]=_0x1e126d['ip'];var _0x565332={'host':_0x9312('0x18'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x9312('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x9312('0x1a'),'Authorization':_0x9312('0x1b')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x9312('0x1c'))}};var _0x1c7c10=JSON[_0x9312('0xa')](_0x3a6528);var _0x1c809a=https[_0x9312('0x1d')](_0x565332,function(_0x26bb83){_0x26bb83[_0x9312('0x1e')](_0x9312('0x1f'));var _0x2771c0='';_0x26bb83['on'](_0x9312('0x20'),function(_0x2d7f33){_0x2771c0+=_0x2d7f33;});_0x26bb83['on'](_0x9312('0x21'),function(){if(_0x116c05){return _0x116c05[_0x9312('0x22')](_0x26bb83[_0x9312('0x23')])[_0x9312('0x24')](JSON[_0x9312('0x25')](_0x2771c0));}});});_0x1c809a['on'](_0x9312('0x26'),function(_0x5e67b6){if(_0x116c05){return _0x116c05[_0x9312('0x22')](0x1f4)[_0x9312('0x24')]({'errors':[{'message':_0x9312('0x27'),'type':_0x9312('0x28')}]});}});_0x1c809a[_0x9312('0x29')](_0x1c7c10);_0x1c809a[_0x9312('0x21')]();}exports[_0x9312('0x2a')]=openIssue;exports['send']=function(_0x3c2ede,_0x46aa44){_0x3c2ede['body']['ip']=_0x3c2ede[_0x9312('0x2b')][_0x9312('0x2c')]||_0x3c2ede[_0x9312('0x2d')][_0x9312('0x2e')]||_0x3c2ede[_0x9312('0x2f')][_0x9312('0x2e')]||_0x3c2ede[_0x9312('0x2d')][_0x9312('0x2f')]['remoteAddress'];return openIssue(_0x3c2ede[_0x9312('0x30')],_0x46aa44);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index f72e06b..e127663 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 _0x4ea3=['multer','util','path','connect-timeout','Router','../../components/auth/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','post','update','destroy','exports'];(function(_0x4971ca,_0x2ae39a){var _0x10c18e=function(_0x469242){while(--_0x469242){_0x4971ca['push'](_0x4971ca['shift']());}};_0x10c18e(++_0x2ae39a);}(_0x4ea3,0x70));var _0x34ea=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4ea3[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['describe']);router[_0x34ea('0x7')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller['show']);router[_0x34ea('0xc')]('/',auth[_0x34ea('0x8')](),controller['create']);router['put'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xd')]);router['delete'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xe')]);module[_0x34ea('0xf')]=router; \ No newline at end of file +var _0x0a9a=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','destroy','util','connect-timeout','express'];(function(_0x7bdda5,_0x3358f5){var _0x45be29=function(_0x7b64ff){while(--_0x7b64ff){_0x7bdda5['push'](_0x7bdda5['shift']());}};_0x45be29(++_0x3358f5);}(_0x0a9a,0x183));var _0xa0a9=function(_0x2a2ff5,_0x4588f6){_0x2a2ff5=_0x2a2ff5-0x0;var _0xa9a91f=_0x0a9a[_0x2a2ff5];return _0xa9a91f;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/describe',auth[_0xa0a9('0x8')](),controller['describe']);router[_0xa0a9('0x7')](_0xa0a9('0xa'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xc')]);router['put']('/:id',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);router['delete'](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 560a618..03dab91 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7a54,0x106));var _0x47a5=function(_0x30622e,_0x20ebcb){_0x30622e=_0x30622e-0x0;var _0x1d1079=_0x7a54[_0x30622e];return _0x1d1079;};'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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x1e8f9f,_0x4fe148){_0x1e8f9f=_0x1e8f9f-0x0;var _0x739ac=_0x7a54[_0x1e8f9f];return _0x739ac;};'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 6fd2342..aab3d3d 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 _0xaa5c=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','util','to-csv'];(function(_0x322522,_0x4db288){var _0x293bcf=function(_0xf108b8){while(--_0xf108b8){_0x322522['push'](_0x322522['shift']());}};_0x293bcf(++_0x4db288);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x2e0a78,_0x413dd2){_0x2e0a78=_0x2e0a78-0x0;var _0x93e65c=_0xaa5c[_0x2e0a78];return _0x93e65c;};'use strict';var emlformat=require(_0xcaa5('0x0'));var rimraf=require(_0xcaa5('0x1'));var zipdir=require(_0xcaa5('0x2'));var jsonpatch=require(_0xcaa5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcaa5('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xcaa5('0x5'));var ejs=require(_0xcaa5('0x6'));var fs=require('fs');var fs_extra=require(_0xcaa5('0x7'));var _=require('lodash');var squel=require(_0xcaa5('0x8'));var crypto=require(_0xcaa5('0x9'));var jsforce=require(_0xcaa5('0xa'));var deskjs=require(_0xcaa5('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcaa5('0xc'));var Papa=require(_0xcaa5('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcaa5('0xe'));var as=require(_0xcaa5('0xf'));var hardwareService=require(_0xcaa5('0x10'));var logger=require('../../config/logger')(_0xcaa5('0x11'));var utils=require('../../config/utils');var config=require(_0xcaa5('0x12'));var licenseUtil=require(_0xcaa5('0x13'));var db=require(_0xcaa5('0x14'))['db'];function respondWithStatusCode(_0x3b8783,_0x16bb6d){_0x16bb6d=_0x16bb6d||0xcc;return function(_0xbf4c57){if(_0xbf4c57){return _0x3b8783[_0xcaa5('0x15')](_0x16bb6d);}return _0x3b8783['status'](_0x16bb6d)[_0xcaa5('0x16')]();};}function respondWithResult(_0x240651,_0x474770){_0x474770=_0x474770||0xc8;return function(_0x295c9f){if(_0x295c9f){return _0x240651[_0xcaa5('0x17')](_0x474770)[_0xcaa5('0x18')](_0x295c9f);}};}function respondWithFilteredResult(_0x3e1c8e,_0xa2c6b6){return function(_0x8b7ad5){if(_0x8b7ad5){var _0x53e67f=typeof _0xa2c6b6[_0xcaa5('0x19')]==='undefined'&&typeof _0xa2c6b6[_0xcaa5('0x1a')]===_0xcaa5('0x1b');var _0x5ac8e5=_0x8b7ad5[_0xcaa5('0x1c')];var _0x2dae23=_0x53e67f?0x0:_0xa2c6b6[_0xcaa5('0x19')];var _0x7dad0b=_0x53e67f?_0x8b7ad5[_0xcaa5('0x1c')]:_0xa2c6b6['offset']+_0xa2c6b6[_0xcaa5('0x1a')];var _0x4470c1;if(_0x7dad0b>=_0x5ac8e5){_0x7dad0b=_0x5ac8e5;_0x4470c1=0xc8;}else{_0x4470c1=0xce;}_0x3e1c8e[_0xcaa5('0x17')](_0x4470c1);return _0x3e1c8e[_0xcaa5('0x1d')]('Content-Range',_0x2dae23+'-'+_0x7dad0b+'/'+_0x5ac8e5)[_0xcaa5('0x18')](_0x8b7ad5);}return null;};}function patchUpdates(_0x581ff8){return function(_0x93f6d4){try{jsonpatch[_0xcaa5('0x1e')](_0x93f6d4,_0x581ff8,!![]);}catch(_0xeca790){return BPromise[_0xcaa5('0x1f')](_0xeca790);}return _0x93f6d4[_0xcaa5('0x20')]();};}function saveUpdates(_0x52ca18,_0x48b8ee){return function(_0x51be62){if(_0x51be62){return _0x51be62[_0xcaa5('0x21')](_0x52ca18)['then'](function(_0x1ba266){return _0x1ba266;});}return null;};}function removeEntity(_0x5075ac,_0x39fb88){return function(_0x554027){if(_0x554027){return _0x554027[_0xcaa5('0x22')]()[_0xcaa5('0x23')](function(){_0x5075ac[_0xcaa5('0x17')](0xcc)[_0xcaa5('0x16')]();});}};}function handleEntityNotFound(_0x5c7693,_0xe4ae3b){return function(_0x51f0f0){if(!_0x51f0f0){_0x5c7693[_0xcaa5('0x15')](0x194);}return _0x51f0f0;};}function handleError(_0x57e076,_0x3b3c71){_0x3b3c71=_0x3b3c71||0x1f4;return function(_0x37d922){logger[_0xcaa5('0x24')](_0x37d922[_0xcaa5('0x25')]);if(_0x37d922[_0xcaa5('0x26')]){delete _0x37d922[_0xcaa5('0x26')];}_0x57e076[_0xcaa5('0x17')](_0x3b3c71)[_0xcaa5('0x27')](_0x37d922);};}exports['index']=function(_0x4c356d,_0x2f1420){var _0x3edb25={},_0x2d58f9={},_0x5c49fd={'count':0x0,'rows':[]};var _0x56db73=_[_0xcaa5('0x28')](db[_0xcaa5('0x29')][_0xcaa5('0x2a')],function(_0xe549d7){return{'name':_0xe549d7[_0xcaa5('0x2b')],'type':_0xe549d7[_0xcaa5('0x2c')][_0xcaa5('0x2d')]};});_0x2d58f9[_0xcaa5('0x2e')]=_[_0xcaa5('0x28')](_0x56db73,'name');_0x2d58f9[_0xcaa5('0x2f')]=_[_0xcaa5('0x30')](_0x4c356d[_0xcaa5('0x2f')]);_0x2d58f9[_0xcaa5('0x31')]=_['intersection'](_0x2d58f9[_0xcaa5('0x2e')],_0x2d58f9['query']);_0x3edb25[_0xcaa5('0x32')]=_[_0xcaa5('0x33')](_0x2d58f9[_0xcaa5('0x2e')],qs['fields'](_0x4c356d[_0xcaa5('0x2f')][_0xcaa5('0x34')]));_0x3edb25[_0xcaa5('0x32')]=_0x3edb25[_0xcaa5('0x32')]['length']?_0x3edb25[_0xcaa5('0x32')]:_0x2d58f9[_0xcaa5('0x2e')];if(!_0x4c356d[_0xcaa5('0x2f')][_0xcaa5('0x35')](_0xcaa5('0x36'))){_0x3edb25['limit']=qs['limit'](_0x4c356d[_0xcaa5('0x2f')][_0xcaa5('0x1a')]);_0x3edb25[_0xcaa5('0x19')]=qs['offset'](_0x4c356d[_0xcaa5('0x2f')]['offset']);}_0x3edb25[_0xcaa5('0x37')]=qs[_0xcaa5('0x38')](_0x4c356d['query'][_0xcaa5('0x38')]);_0x3edb25[_0xcaa5('0x39')]=qs[_0xcaa5('0x31')](_[_0xcaa5('0x3a')](_0x4c356d['query'],_0x2d58f9[_0xcaa5('0x31')]),_0x56db73);if(_0x4c356d[_0xcaa5('0x2f')][_0xcaa5('0x3b')]){_0x3edb25[_0xcaa5('0x39')]=_[_0xcaa5('0x3c')](_0x3edb25[_0xcaa5('0x39')],{'$or':_[_0xcaa5('0x28')](_0x56db73,function(_0x32b556){if(_0x32b556['type']!==_0xcaa5('0x3d')){var _0x3c024b={};_0x3c024b[_0x32b556[_0xcaa5('0x26')]]={'$like':'%'+_0x4c356d[_0xcaa5('0x2f')]['filter']+'%'};return _0x3c024b;}})});}_0x3edb25=_[_0xcaa5('0x3c')]({},_0x3edb25,_0x4c356d['options']);var _0x1fd607={'where':_0x3edb25[_0xcaa5('0x39')]};return db['JscriptyAnswerReport'][_0xcaa5('0x1c')](_0x1fd607)[_0xcaa5('0x23')](function(_0x130c90){_0x5c49fd[_0xcaa5('0x1c')]=_0x130c90;if(_0x4c356d[_0xcaa5('0x2f')][_0xcaa5('0x3e')]){_0x3edb25['include']=[{'all':!![]}];}return db[_0xcaa5('0x29')][_0xcaa5('0x3f')](_0x3edb25);})[_0xcaa5('0x23')](function(_0x3e9b40){_0x5c49fd[_0xcaa5('0x40')]=_0x3e9b40;return _0x5c49fd;})[_0xcaa5('0x23')](respondWithFilteredResult(_0x2f1420,_0x3edb25))[_0xcaa5('0x41')](handleError(_0x2f1420,null));};exports[_0xcaa5('0x42')]=function(_0x12ea07,_0x22313c){var _0x29f93a={'raw':!![],'where':{'id':_0x12ea07[_0xcaa5('0x43')]['id']}},_0x81887c={};_0x81887c[_0xcaa5('0x2e')]=_['keys'](db[_0xcaa5('0x29')]['rawAttributes']);_0x81887c[_0xcaa5('0x2f')]=_[_0xcaa5('0x30')](_0x12ea07[_0xcaa5('0x2f')]);_0x81887c[_0xcaa5('0x31')]=_['intersection'](_0x81887c[_0xcaa5('0x2e')],_0x81887c[_0xcaa5('0x2f')]);_0x29f93a[_0xcaa5('0x32')]=_[_0xcaa5('0x33')](_0x81887c[_0xcaa5('0x2e')],qs[_0xcaa5('0x34')](_0x12ea07[_0xcaa5('0x2f')][_0xcaa5('0x34')]));_0x29f93a['attributes']=_0x29f93a[_0xcaa5('0x32')]['length']?_0x29f93a[_0xcaa5('0x32')]:_0x81887c[_0xcaa5('0x2e')];if(_0x12ea07[_0xcaa5('0x2f')][_0xcaa5('0x3e')]){_0x29f93a[_0xcaa5('0x44')]=[{'all':!![]}];}_0x29f93a=_[_0xcaa5('0x3c')]({},_0x29f93a,_0x12ea07[_0xcaa5('0x45')]);return db[_0xcaa5('0x29')]['find'](_0x29f93a)[_0xcaa5('0x23')](handleEntityNotFound(_0x22313c,null))[_0xcaa5('0x23')](respondWithResult(_0x22313c,null))[_0xcaa5('0x41')](handleError(_0x22313c,null));};exports['create']=function(_0x2ab2a1,_0x2424f6){return db[_0xcaa5('0x29')]['create'](_0x2ab2a1[_0xcaa5('0x46')],{})[_0xcaa5('0x23')](respondWithResult(_0x2424f6,0xc9))[_0xcaa5('0x41')](handleError(_0x2424f6,null));};exports[_0xcaa5('0x21')]=function(_0x2fcb89,_0x9ccb2f){if(_0x2fcb89[_0xcaa5('0x46')]['id']){delete _0x2fcb89['body']['id'];}return db[_0xcaa5('0x29')]['find']({'where':{'id':_0x2fcb89[_0xcaa5('0x43')]['id']}})['then'](handleEntityNotFound(_0x9ccb2f,null))[_0xcaa5('0x23')](saveUpdates(_0x2fcb89[_0xcaa5('0x46')],null))[_0xcaa5('0x23')](respondWithResult(_0x9ccb2f,null))[_0xcaa5('0x41')](handleError(_0x9ccb2f,null));};exports[_0xcaa5('0x22')]=function(_0x42263b,_0x1ddd15){return db[_0xcaa5('0x29')]['find']({'where':{'id':_0x42263b[_0xcaa5('0x43')]['id']}})[_0xcaa5('0x23')](handleEntityNotFound(_0x1ddd15,null))[_0xcaa5('0x23')](removeEntity(_0x1ddd15,null))[_0xcaa5('0x41')](handleError(_0x1ddd15,null));};exports[_0xcaa5('0x47')]=function(_0x44f35e,_0x2c6aae){return db[_0xcaa5('0x29')]['describe']()[_0xcaa5('0x23')](respondWithResult(_0x2c6aae,null))[_0xcaa5('0x41')](handleError(_0x2c6aae,null));}; \ No newline at end of file +var _0x4813=['offset','limit','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','show','params','keys','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4813,0x14e));var _0x3481=function(_0x1eb573,_0x333af3){_0x1eb573=_0x1eb573-0x0;var _0x226e69=_0x4813[_0x1eb573];return _0x226e69;};'use strict';var emlformat=require(_0x3481('0x0'));var rimraf=require(_0x3481('0x1'));var zipdir=require(_0x3481('0x2'));var jsonpatch=require(_0x3481('0x3'));var rp=require(_0x3481('0x4'));var moment=require(_0x3481('0x5'));var BPromise=require(_0x3481('0x6'));var Mustache=require('mustache');var util=require(_0x3481('0x7'));var path=require(_0x3481('0x8'));var sox=require(_0x3481('0x9'));var csv=require(_0x3481('0xa'));var ejs=require(_0x3481('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3481('0xc'));var crypto=require('crypto');var jsforce=require(_0x3481('0xd'));var deskjs=require(_0x3481('0xe'));var toCsv=require(_0x3481('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3481('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3481('0x10'));var logger=require(_0x3481('0x11'))(_0x3481('0x12'));var utils=require(_0x3481('0x13'));var config=require(_0x3481('0x14'));var licenseUtil=require(_0x3481('0x15'));var db=require(_0x3481('0x16'))['db'];function respondWithStatusCode(_0x3f1376,_0x37cc2b){_0x37cc2b=_0x37cc2b||0xcc;return function(_0x22b89b){if(_0x22b89b){return _0x3f1376[_0x3481('0x17')](_0x37cc2b);}return _0x3f1376[_0x3481('0x18')](_0x37cc2b)['end']();};}function respondWithResult(_0x16358e,_0xb77c75){_0xb77c75=_0xb77c75||0xc8;return function(_0x1bcfad){if(_0x1bcfad){return _0x16358e[_0x3481('0x18')](_0xb77c75)[_0x3481('0x19')](_0x1bcfad);}};}function respondWithFilteredResult(_0x39e581,_0x4a1d09){return function(_0x1bb126){if(_0x1bb126){var _0x41c2aa=typeof _0x4a1d09['offset']==='undefined'&&typeof _0x4a1d09['limit']==='undefined';var _0x4f5d1b=_0x1bb126['count'];var _0x32a315=_0x41c2aa?0x0:_0x4a1d09[_0x3481('0x1a')];var _0x5a8e65=_0x41c2aa?_0x1bb126['count']:_0x4a1d09[_0x3481('0x1a')]+_0x4a1d09[_0x3481('0x1b')];var _0x3b43dc;if(_0x5a8e65>=_0x4f5d1b){_0x5a8e65=_0x4f5d1b;_0x3b43dc=0xc8;}else{_0x3b43dc=0xce;}_0x39e581['status'](_0x3b43dc);return _0x39e581['set'](_0x3481('0x1c'),_0x32a315+'-'+_0x5a8e65+'/'+_0x4f5d1b)[_0x3481('0x19')](_0x1bb126);}return null;};}function patchUpdates(_0x1e0aa0){return function(_0x1ba743){try{jsonpatch[_0x3481('0x1d')](_0x1ba743,_0x1e0aa0,!![]);}catch(_0x4469d4){return BPromise['reject'](_0x4469d4);}return _0x1ba743[_0x3481('0x1e')]();};}function saveUpdates(_0x3cdb98,_0x162305){return function(_0xea1072){if(_0xea1072){return _0xea1072['update'](_0x3cdb98)[_0x3481('0x1f')](function(_0x48eb64){return _0x48eb64;});}return null;};}function removeEntity(_0x2185ba,_0x33c6fa){return function(_0x418a7d){if(_0x418a7d){return _0x418a7d[_0x3481('0x20')]()['then'](function(){_0x2185ba['status'](0xcc)[_0x3481('0x21')]();});}};}function handleEntityNotFound(_0x3e5963,_0x249754){return function(_0x405816){if(!_0x405816){_0x3e5963['sendStatus'](0x194);}return _0x405816;};}function handleError(_0x2e837a,_0x6ce3f3){_0x6ce3f3=_0x6ce3f3||0x1f4;return function(_0x1181e1){logger[_0x3481('0x22')](_0x1181e1[_0x3481('0x23')]);if(_0x1181e1[_0x3481('0x24')]){delete _0x1181e1[_0x3481('0x24')];}_0x2e837a[_0x3481('0x18')](_0x6ce3f3)[_0x3481('0x25')](_0x1181e1);};}exports[_0x3481('0x26')]=function(_0x4a20d5,_0x131363){var _0x4a8492={},_0xdcacba={},_0x1f079a={'count':0x0,'rows':[]};var _0x2864f1=_['map'](db[_0x3481('0x27')][_0x3481('0x28')],function(_0x2df894){return{'name':_0x2df894[_0x3481('0x29')],'type':_0x2df894[_0x3481('0x2a')]['key']};});_0xdcacba[_0x3481('0x2b')]=_[_0x3481('0x2c')](_0x2864f1,_0x3481('0x24'));_0xdcacba[_0x3481('0x2d')]=_['keys'](_0x4a20d5[_0x3481('0x2d')]);_0xdcacba[_0x3481('0x2e')]=_[_0x3481('0x2f')](_0xdcacba[_0x3481('0x2b')],_0xdcacba[_0x3481('0x2d')]);_0x4a8492[_0x3481('0x30')]=_[_0x3481('0x2f')](_0xdcacba[_0x3481('0x2b')],qs['fields'](_0x4a20d5[_0x3481('0x2d')][_0x3481('0x31')]));_0x4a8492[_0x3481('0x30')]=_0x4a8492['attributes'][_0x3481('0x32')]?_0x4a8492['attributes']:_0xdcacba[_0x3481('0x2b')];if(!_0x4a20d5['query'][_0x3481('0x33')]('nolimit')){_0x4a8492[_0x3481('0x1b')]=qs[_0x3481('0x1b')](_0x4a20d5[_0x3481('0x2d')]['limit']);_0x4a8492[_0x3481('0x1a')]=qs['offset'](_0x4a20d5[_0x3481('0x2d')]['offset']);}_0x4a8492[_0x3481('0x34')]=qs[_0x3481('0x35')](_0x4a20d5[_0x3481('0x2d')][_0x3481('0x35')]);_0x4a8492[_0x3481('0x36')]=qs[_0x3481('0x2e')](_[_0x3481('0x37')](_0x4a20d5[_0x3481('0x2d')],_0xdcacba[_0x3481('0x2e')]),_0x2864f1);if(_0x4a20d5['query'][_0x3481('0x38')]){_0x4a8492['where']=_[_0x3481('0x39')](_0x4a8492[_0x3481('0x36')],{'$or':_[_0x3481('0x2c')](_0x2864f1,function(_0x40fd6f){if(_0x40fd6f['type']!=='VIRTUAL'){var _0x2207fb={};_0x2207fb[_0x40fd6f[_0x3481('0x24')]]={'$like':'%'+_0x4a20d5[_0x3481('0x2d')][_0x3481('0x38')]+'%'};return _0x2207fb;}})});}_0x4a8492=_['merge']({},_0x4a8492,_0x4a20d5[_0x3481('0x3a')]);var _0x3c7874={'where':_0x4a8492[_0x3481('0x36')]};return db[_0x3481('0x27')][_0x3481('0x3b')](_0x3c7874)[_0x3481('0x1f')](function(_0x33c33f){_0x1f079a['count']=_0x33c33f;if(_0x4a20d5[_0x3481('0x2d')][_0x3481('0x3c')]){_0x4a8492[_0x3481('0x3d')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x4a8492);})[_0x3481('0x1f')](function(_0x420b8c){_0x1f079a[_0x3481('0x3e')]=_0x420b8c;return _0x1f079a;})['then'](respondWithFilteredResult(_0x131363,_0x4a8492))['catch'](handleError(_0x131363,null));};exports[_0x3481('0x3f')]=function(_0x335292,_0x3fc0e7){var _0xbccc9e={'raw':!![],'where':{'id':_0x335292[_0x3481('0x40')]['id']}},_0x5c4928={};_0x5c4928['model']=_[_0x3481('0x41')](db[_0x3481('0x27')][_0x3481('0x28')]);_0x5c4928[_0x3481('0x2d')]=_['keys'](_0x335292['query']);_0x5c4928['filters']=_['intersection'](_0x5c4928[_0x3481('0x2b')],_0x5c4928[_0x3481('0x2d')]);_0xbccc9e[_0x3481('0x30')]=_[_0x3481('0x2f')](_0x5c4928[_0x3481('0x2b')],qs[_0x3481('0x31')](_0x335292[_0x3481('0x2d')][_0x3481('0x31')]));_0xbccc9e[_0x3481('0x30')]=_0xbccc9e[_0x3481('0x30')][_0x3481('0x32')]?_0xbccc9e['attributes']:_0x5c4928['model'];if(_0x335292[_0x3481('0x2d')][_0x3481('0x3c')]){_0xbccc9e[_0x3481('0x3d')]=[{'all':!![]}];}_0xbccc9e=_[_0x3481('0x39')]({},_0xbccc9e,_0x335292['options']);return db[_0x3481('0x27')]['find'](_0xbccc9e)[_0x3481('0x1f')](handleEntityNotFound(_0x3fc0e7,null))[_0x3481('0x1f')](respondWithResult(_0x3fc0e7,null))[_0x3481('0x42')](handleError(_0x3fc0e7,null));};exports[_0x3481('0x43')]=function(_0x30f54e,_0x50dd72){return db[_0x3481('0x27')]['create'](_0x30f54e[_0x3481('0x44')],{})[_0x3481('0x1f')](respondWithResult(_0x50dd72,0xc9))['catch'](handleError(_0x50dd72,null));};exports[_0x3481('0x45')]=function(_0x54ec34,_0x27e106){if(_0x54ec34[_0x3481('0x44')]['id']){delete _0x54ec34[_0x3481('0x44')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x54ec34[_0x3481('0x40')]['id']}})[_0x3481('0x1f')](handleEntityNotFound(_0x27e106,null))[_0x3481('0x1f')](saveUpdates(_0x54ec34[_0x3481('0x44')],null))['then'](respondWithResult(_0x27e106,null))[_0x3481('0x42')](handleError(_0x27e106,null));};exports[_0x3481('0x20')]=function(_0xdd5422,_0x4b7598){return db['JscriptyAnswerReport'][_0x3481('0x46')]({'where':{'id':_0xdd5422[_0x3481('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b7598,null))[_0x3481('0x1f')](removeEntity(_0x4b7598,null))[_0x3481('0x42')](handleError(_0x4b7598,null));};exports[_0x3481('0x47')]=function(_0x222b83,_0x403ba9){return db['JscriptyAnswerReport'][_0x3481('0x47')]()[_0x3481('0x1f')](respondWithResult(_0x403ba9,null))[_0x3481('0x42')](handleError(_0x403ba9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index be222f3..ec3470f 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 _0xec22=['api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','util','../../config/logger'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xec22,0x1de));var _0x2ec2=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xec22[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0x2ec2('0x0'));var logger=require(_0x2ec2('0x1'))(_0x2ec2('0x2'));var moment=require(_0x2ec2('0x3'));var BPromise=require(_0x2ec2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ec2('0x5'));var rimraf=require(_0x2ec2('0x6'));var config=require(_0x2ec2('0x7'));var attributes=require(_0x2ec2('0x8'));module[_0x2ec2('0x9')]=function(_0x54737b,_0xf3e138){return _0x54737b[_0x2ec2('0xa')](_0x2ec2('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbd3=['exports','define','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x3e079f,_0x189e15){var _0x296a34=function(_0xa31a0a){while(--_0xa31a0a){_0x3e079f['push'](_0x3e079f['shift']());}};_0x296a34(++_0x189e15);}(_0xfbd3,0x141));var _0x3fbd=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xfbd3[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x3fbd('0x0'));var util=require(_0x3fbd('0x1'));var logger=require(_0x3fbd('0x2'))(_0x3fbd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3fbd('0x4'));var fs=require('fs');var path=require(_0x3fbd('0x5'));var rimraf=require(_0x3fbd('0x6'));var config=require(_0x3fbd('0x7'));var attributes=require(_0x3fbd('0x8'));module[_0x3fbd('0x9')]=function(_0x521146,_0x31358a){return _0x521146[_0x3fbd('0xa')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 2ba7458..a5775b9 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 _0x7013=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3d7925,_0x320817){var _0x22faa1=function(_0xd524dc){while(--_0xd524dc){_0x3d7925['push'](_0x3d7925['shift']());}};_0x22faa1(++_0x320817);}(_0x7013,0xbb));var _0x3701=function(_0x1afe27,_0x460e8b){_0x1afe27=_0x1afe27-0x0;var _0x1dbe0b=_0x7013[_0x1afe27];return _0x1dbe0b;};'use strict';var _=require(_0x3701('0x0'));var util=require(_0x3701('0x1'));var moment=require(_0x3701('0x2'));var BPromise=require(_0x3701('0x3'));var rs=require(_0x3701('0x4'));var fs=require('fs');var Redis=require(_0x3701('0x5'));var db=require(_0x3701('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3701('0x7'))(_0x3701('0x8'));var config=require(_0x3701('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3701('0xa')][_0x3701('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ba18e,_0x4cd173,_0x409294){return new BPromise(function(_0xaad1ec,_0x461790){return client['request'](_0x4ba18e,_0x409294)[_0x3701('0xc')](function(_0x2c1197){logger[_0x3701('0xd')](_0x3701('0xe'),_0x4cd173,'request\x20sent');logger[_0x3701('0xf')](_0x3701('0x10'),_0x4cd173,_0x3701('0x11'),JSON[_0x3701('0x12')](_0x2c1197));if(_0x2c1197[_0x3701('0x13')]){if(_0x2c1197[_0x3701('0x13')][_0x3701('0x14')]===0x1f4){logger[_0x3701('0x13')](_0x3701('0xe'),_0x4cd173,_0x2c1197[_0x3701('0x13')]['message']);return _0x461790(_0x2c1197[_0x3701('0x13')][_0x3701('0x15')]);}logger[_0x3701('0x13')](_0x3701('0xe'),_0x4cd173,_0x2c1197['error'][_0x3701('0x15')]);return _0xaad1ec(_0x2c1197['error'][_0x3701('0x15')]);}else{logger[_0x3701('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4cd173,_0x3701('0x11'));_0xaad1ec(_0x2c1197['result'][_0x3701('0x15')]);}})[_0x3701('0x16')](function(_0x1fd018){logger[_0x3701('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4cd173,_0x1fd018);_0x461790(_0x1fd018);});});} \ No newline at end of file +var _0xb3f3=['util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','lodash'];(function(_0x589eb4,_0xaa2019){var _0xf50816=function(_0x572fc5){while(--_0x572fc5){_0x589eb4['push'](_0x589eb4['shift']());}};_0xf50816(++_0xaa2019);}(_0xb3f3,0x1cb));var _0x3b3f=function(_0x5d0f97,_0x25009f){_0x5d0f97=_0x5d0f97-0x0;var _0xc7236=_0xb3f3[_0x5d0f97];return _0xc7236;};'use strict';var _=require(_0x3b3f('0x0'));var util=require(_0x3b3f('0x1'));var moment=require(_0x3b3f('0x2'));var BPromise=require(_0x3b3f('0x3'));var rs=require(_0x3b3f('0x4'));var fs=require('fs');var Redis=require(_0x3b3f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3b3f('0x6'))('rpc');var config=require(_0x3b3f('0x7'));var jayson=require(_0x3b3f('0x8'));var client=jayson[_0x3b3f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27b987,_0x3796be,_0x26cd52){return new BPromise(function(_0x3b8d7d,_0x406174){return client[_0x3b3f('0xa')](_0x27b987,_0x26cd52)['then'](function(_0x56fe67){logger[_0x3b3f('0xb')](_0x3b3f('0xc'),_0x3796be,_0x3b3f('0xd'));logger[_0x3b3f('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x3796be,_0x3b3f('0xd'),JSON[_0x3b3f('0xf')](_0x56fe67));if(_0x56fe67['error']){if(_0x56fe67['error'][_0x3b3f('0x10')]===0x1f4){logger[_0x3b3f('0x11')](_0x3b3f('0xc'),_0x3796be,_0x56fe67['error'][_0x3b3f('0x12')]);return _0x406174(_0x56fe67[_0x3b3f('0x11')][_0x3b3f('0x12')]);}logger['error'](_0x3b3f('0xc'),_0x3796be,_0x56fe67[_0x3b3f('0x11')][_0x3b3f('0x12')]);return _0x3b8d7d(_0x56fe67[_0x3b3f('0x11')]['message']);}else{logger[_0x3b3f('0xb')](_0x3b3f('0xc'),_0x3796be,_0x3b3f('0xd'));_0x3b8d7d(_0x56fe67[_0x3b3f('0x13')][_0x3b3f('0x12')]);}})['catch'](function(_0x299101){logger['error'](_0x3b3f('0xc'),_0x3796be,_0x299101);_0x406174(_0x299101);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 0848123..f5da6fd 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 _0x1cfa=['exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','get','/:id','show','getSessions','/:id/answers','/:id/summary','post','/:id/clone','clone','put','update','delete'];(function(_0x5931a9,_0x5aaf34){var _0x104a93=function(_0x24bfa8){while(--_0x24bfa8){_0x5931a9['push'](_0x5931a9['shift']());}};_0x104a93(++_0x5aaf34);}(_0x1cfa,0x94));var _0xa1cf=function(_0x5dc6a4,_0x37e256){_0x5dc6a4=_0x5dc6a4-0x0;var _0x134f70=_0x1cfa[_0x5dc6a4];return _0x134f70;};'use strict';var multer=require(_0xa1cf('0x0'));var util=require('util');var path=require(_0xa1cf('0x1'));var timeout=require(_0xa1cf('0x2'));var express=require('express');var router=express[_0xa1cf('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa1cf('0x4'));var config=require(_0xa1cf('0x5'));var controller=require(_0xa1cf('0x6'));router['get']('/',auth[_0xa1cf('0x7')](),controller['index']);router[_0xa1cf('0x8')](_0xa1cf('0x9'),auth[_0xa1cf('0x7')](),controller[_0xa1cf('0xa')]);router['get']('/:id/sessions',auth['isAuthenticated'](),controller[_0xa1cf('0xb')]);router['get'](_0xa1cf('0xc'),auth[_0xa1cf('0x7')](),controller['getAnswers']);router[_0xa1cf('0x8')](_0xa1cf('0xd'),auth[_0xa1cf('0x7')](),timeout('30s'),controller['getSummary']);router[_0xa1cf('0xe')]('/',auth[_0xa1cf('0x7')](),controller['create']);router[_0xa1cf('0xe')](_0xa1cf('0xf'),auth['isAuthenticated'](),controller[_0xa1cf('0x10')]);router[_0xa1cf('0x11')](_0xa1cf('0x9'),auth[_0xa1cf('0x7')](),controller[_0xa1cf('0x12')]);router[_0xa1cf('0x13')](_0xa1cf('0x9'),auth[_0xa1cf('0x7')](),controller['destroy']);module[_0xa1cf('0x14')]=router; \ No newline at end of file +var _0x76a2=['show','/:id/sessions','isAuthenticated','/:id/answers','/:id/summary','getSummary','post','/:id/clone','clone','/:id','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x76a2,0x1f0));var _0x276a=function(_0x26ed29,_0x2288f1){_0x26ed29=_0x26ed29-0x0;var _0x26182c=_0x76a2[_0x26ed29];return _0x26182c;};'use strict';var multer=require(_0x276a('0x0'));var util=require('util');var path=require(_0x276a('0x1'));var timeout=require('connect-timeout');var express=require(_0x276a('0x2'));var router=express[_0x276a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x276a('0x4'));var interaction=require(_0x276a('0x5'));var config=require(_0x276a('0x6'));var controller=require(_0x276a('0x7'));router[_0x276a('0x8')]('/',auth['isAuthenticated'](),controller[_0x276a('0x9')]);router[_0x276a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x276a('0xa')]);router[_0x276a('0x8')](_0x276a('0xb'),auth[_0x276a('0xc')](),controller['getSessions']);router[_0x276a('0x8')](_0x276a('0xd'),auth[_0x276a('0xc')](),controller['getAnswers']);router['get'](_0x276a('0xe'),auth[_0x276a('0xc')](),timeout('30s'),controller[_0x276a('0xf')]);router[_0x276a('0x10')]('/',auth[_0x276a('0xc')](),controller['create']);router['post'](_0x276a('0x11'),auth[_0x276a('0xc')](),controller[_0x276a('0x12')]);router['put'](_0x276a('0x13'),auth[_0x276a('0xc')](),controller['update']);router[_0x276a('0x14')](_0x276a('0x13'),auth[_0x276a('0xc')](),controller[_0x276a('0x15')]);module[_0x276a('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 3849ea1..6d04c31 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 _0xafe9=['isObjectLike','setDataValue','stringify','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','lodash','exports','STRING','name','TEXT'];(function(_0x302ce3,_0x1a3cfb){var _0x10bdbc=function(_0x5598a8){while(--_0x5598a8){_0x302ce3['push'](_0x302ce3['shift']());}};_0x10bdbc(++_0x1a3cfb);}(_0xafe9,0xaf));var _0x9afe=function(_0x5f125e,_0x28bb1f){_0x5f125e=_0x5f125e-0x0;var _0x2681ce=_0xafe9[_0x5f125e];return _0x2681ce;};'use strict';var Sequelize=require('sequelize');var _=require(_0x9afe('0x0'));var util=require('util');module[_0x9afe('0x1')]={'name':{'type':Sequelize[_0x9afe('0x2')],'unique':_0x9afe('0x3')},'description':{'type':Sequelize[_0x9afe('0x2')]},'formData':{'type':Sequelize[_0x9afe('0x4')]('long'),'set':function(_0x232a5c){if(_[_0x9afe('0x5')](_0x232a5c)){this[_0x9afe('0x6')]('formData',JSON[_0x9afe('0x7')](_0x232a5c));}else if(_['isString'](_0x232a5c)){this['setDataValue'](_0x9afe('0x8'),_0x232a5c);}else{this[_0x9afe('0x6')]('formData',util[_0x9afe('0x9')](_0x9afe('0xa'),this['getDataValue'](_0x9afe('0x3'))||'',this[_0x9afe('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa78b=['setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','exports','STRING','name'];(function(_0x42cb01,_0x1c9d22){var _0x498fa8=function(_0x361334){while(--_0x361334){_0x42cb01['push'](_0x42cb01['shift']());}};_0x498fa8(++_0x1c9d22);}(_0xa78b,0x1f3));var _0xba78=function(_0x4ebc8f,_0x71255){_0x4ebc8f=_0x4ebc8f-0x0;var _0x1b94a8=_0xa78b[_0x4ebc8f];return _0x1b94a8;};'use strict';var Sequelize=require(_0xba78('0x0'));var _=require('lodash');var util=require(_0xba78('0x1'));module[_0xba78('0x2')]={'name':{'type':Sequelize[_0xba78('0x3')],'unique':_0xba78('0x4')},'description':{'type':Sequelize[_0xba78('0x3')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x1a1eaf){if(_['isObjectLike'](_0x1a1eaf)){this[_0xba78('0x5')]('formData',JSON[_0xba78('0x6')](_0x1a1eaf));}else if(_[_0xba78('0x7')](_0x1a1eaf)){this['setDataValue']('formData',_0x1a1eaf);}else{this[_0xba78('0x5')](_0xba78('0x8'),util[_0xba78('0x9')](_0xba78('0xa'),this['getDataValue']('name')||'',this[_0xba78('0xb')](_0xba78('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xba78('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 7b0f6e8..4a3a5af 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 _0xda2d=['answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','Projects','UserProfileResource','stack','name','send','index','JscriptyProject','type','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','filter','map','options','includeAll','rows','catch','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','merge','omit','createdAt','updatedAt','autoAssociation','getSessions','JscriptySessionReport','hasOwnProperty','nolimit','pick','ProjectId','findAll','getAnswers','findOne','JscriptyAnswerReport','apply','toString','indexOf','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','SessionId'];(function(_0x15e6c8,_0x16fe76){var _0x3440e8=function(_0x2fb057){while(--_0x2fb057){_0x15e6c8['push'](_0x15e6c8['shift']());}};_0x3440e8(++_0x16fe76);}(_0xda2d,0x102));var _0xdda2=function(_0x3456d3,_0x4349ea){_0x3456d3=_0x3456d3-0x0;var _0x25829f=_0xda2d[_0x3456d3];return _0x25829f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdda2('0x0'));var zipdir=require(_0xdda2('0x1'));var jsonpatch=require(_0xdda2('0x2'));var rp=require(_0xdda2('0x3'));var moment=require(_0xdda2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdda2('0x5'));var sox=require(_0xdda2('0x6'));var csv=require(_0xdda2('0x7'));var ejs=require(_0xdda2('0x8'));var fs=require('fs');var fs_extra=require(_0xdda2('0x9'));var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d25d,_0xa6446b){_0xa6446b=_0xa6446b||0xcc;return function(_0x320f73){if(_0x320f73){return _0x56d25d[_0xdda2('0x19')](_0xa6446b);}return _0x56d25d[_0xdda2('0x1a')](_0xa6446b)[_0xdda2('0x1b')]();};}function respondWithResult(_0x475222,_0x3490f1){_0x3490f1=_0x3490f1||0xc8;return function(_0x4df902){if(_0x4df902){return _0x475222[_0xdda2('0x1a')](_0x3490f1)['json'](_0x4df902);}};}function respondWithFilteredResult(_0xbef148,_0xb6b01e){return function(_0x3553d5){if(_0x3553d5){var _0x457764=typeof _0xb6b01e[_0xdda2('0x1c')]==='undefined'&&typeof _0xb6b01e['limit']===_0xdda2('0x1d');var _0x518c6d=_0x3553d5[_0xdda2('0x1e')];var _0x1a3b35=_0x457764?0x0:_0xb6b01e[_0xdda2('0x1c')];var _0x2b6ee8=_0x457764?_0x3553d5[_0xdda2('0x1e')]:_0xb6b01e[_0xdda2('0x1c')]+_0xb6b01e[_0xdda2('0x1f')];var _0x351151;if(_0x2b6ee8>=_0x518c6d){_0x2b6ee8=_0x518c6d;_0x351151=0xc8;}else{_0x351151=0xce;}_0xbef148[_0xdda2('0x1a')](_0x351151);return _0xbef148[_0xdda2('0x20')](_0xdda2('0x21'),_0x1a3b35+'-'+_0x2b6ee8+'/'+_0x518c6d)[_0xdda2('0x22')](_0x3553d5);}return null;};}function patchUpdates(_0x4eed30){return function(_0x41fe7d){try{jsonpatch['apply'](_0x41fe7d,_0x4eed30,!![]);}catch(_0xc4567c){return BPromise[_0xdda2('0x23')](_0xc4567c);}return _0x41fe7d[_0xdda2('0x24')]();};}function saveUpdates(_0x4c5226,_0x347ee6){return function(_0x5a9bb8){if(_0x5a9bb8){return _0x5a9bb8[_0xdda2('0x25')](_0x4c5226)[_0xdda2('0x26')](function(_0x4ac3eb){return _0x4ac3eb;});}return null;};}function removeEntity(_0x144f1e,_0xfda248){return function(_0x2528d7){if(_0x2528d7){return _0x2528d7[_0xdda2('0x27')]()[_0xdda2('0x26')](function(){var _0x5739ad=_0x2528d7[_0xdda2('0x28')]({'plain':!![]});var _0x4be5ea=_0xdda2('0x29');return db[_0xdda2('0x2a')]['destroy']({'where':{'type':_0x4be5ea,'resourceId':_0x5739ad['id']}})['then'](function(){return _0x2528d7;});})[_0xdda2('0x26')](function(){_0x144f1e[_0xdda2('0x1a')](0xcc)[_0xdda2('0x1b')]();});}};}function handleEntityNotFound(_0x5e9e74,_0x90d919){return function(_0x5d26ae){if(!_0x5d26ae){_0x5e9e74[_0xdda2('0x19')](0x194);}return _0x5d26ae;};}function handleError(_0xe53dee,_0xe16ec7){_0xe16ec7=_0xe16ec7||0x1f4;return function(_0x91b41a){logger['error'](_0x91b41a[_0xdda2('0x2b')]);if(_0x91b41a[_0xdda2('0x2c')]){delete _0x91b41a['name'];}_0xe53dee[_0xdda2('0x1a')](_0xe16ec7)[_0xdda2('0x2d')](_0x91b41a);};}exports[_0xdda2('0x2e')]=function(_0x15e511,_0x5540e5){var _0x129eba={},_0x5e107f={},_0x4b19b7={'count':0x0,'rows':[]};var _0x1ca9f3=_['map'](db[_0xdda2('0x2f')]['rawAttributes'],function(_0x53ff76){return{'name':_0x53ff76['fieldName'],'type':_0x53ff76[_0xdda2('0x30')]['key']};});_0x5e107f[_0xdda2('0x31')]=_['map'](_0x1ca9f3,'name');_0x5e107f['query']=_[_0xdda2('0x32')](_0x15e511[_0xdda2('0x33')]);_0x5e107f[_0xdda2('0x34')]=_[_0xdda2('0x35')](_0x5e107f[_0xdda2('0x31')],_0x5e107f[_0xdda2('0x33')]);_0x129eba[_0xdda2('0x36')]=_[_0xdda2('0x35')](_0x5e107f[_0xdda2('0x31')],qs[_0xdda2('0x37')](_0x15e511['query'][_0xdda2('0x37')]));_0x129eba[_0xdda2('0x36')]=_0x129eba[_0xdda2('0x36')][_0xdda2('0x38')]?_0x129eba[_0xdda2('0x36')]:_0x5e107f[_0xdda2('0x31')];if(!_0x15e511[_0xdda2('0x33')]['hasOwnProperty']('nolimit')){_0x129eba[_0xdda2('0x1f')]=qs[_0xdda2('0x1f')](_0x15e511[_0xdda2('0x33')]['limit']);_0x129eba['offset']=qs[_0xdda2('0x1c')](_0x15e511[_0xdda2('0x33')][_0xdda2('0x1c')]);}_0x129eba[_0xdda2('0x39')]=qs[_0xdda2('0x3a')](_0x15e511['query'][_0xdda2('0x3a')]);_0x129eba[_0xdda2('0x3b')]=qs['filters'](_['pick'](_0x15e511[_0xdda2('0x33')],_0x5e107f[_0xdda2('0x34')]),_0x1ca9f3);if(_0x15e511[_0xdda2('0x33')][_0xdda2('0x3c')]){_0x129eba[_0xdda2('0x3b')]=_['merge'](_0x129eba[_0xdda2('0x3b')],{'$or':_[_0xdda2('0x3d')](_0x1ca9f3,function(_0x7dac2c){if(_0x7dac2c[_0xdda2('0x30')]!=='VIRTUAL'){var _0x4dc38f={};_0x4dc38f[_0x7dac2c[_0xdda2('0x2c')]]={'$like':'%'+_0x15e511[_0xdda2('0x33')][_0xdda2('0x3c')]+'%'};return _0x4dc38f;}})});}_0x129eba=_['merge']({},_0x129eba,_0x15e511[_0xdda2('0x3e')]);var _0x542ceb={'where':_0x129eba[_0xdda2('0x3b')]};return db['JscriptyProject'][_0xdda2('0x1e')](_0x542ceb)[_0xdda2('0x26')](function(_0x1db762){_0x4b19b7[_0xdda2('0x1e')]=_0x1db762;if(_0x15e511['query'][_0xdda2('0x3f')]){_0x129eba['include']=[{'all':!![]}];}return db[_0xdda2('0x2f')]['findAll'](_0x129eba);})[_0xdda2('0x26')](function(_0x12589b){_0x4b19b7[_0xdda2('0x40')]=_0x12589b;return _0x4b19b7;})[_0xdda2('0x26')](respondWithFilteredResult(_0x5540e5,_0x129eba))[_0xdda2('0x41')](handleError(_0x5540e5,null));};exports['show']=function(_0x1e29dc,_0x15a616){var _0x54735b={'raw':![],'where':{'id':_0x1e29dc['params']['id']}},_0x2caced={};_0x2caced[_0xdda2('0x31')]=_[_0xdda2('0x32')](db[_0xdda2('0x2f')][_0xdda2('0x42')]);_0x2caced[_0xdda2('0x33')]=_[_0xdda2('0x32')](_0x1e29dc[_0xdda2('0x33')]);_0x2caced[_0xdda2('0x34')]=_[_0xdda2('0x35')](_0x2caced[_0xdda2('0x31')],_0x2caced[_0xdda2('0x33')]);_0x54735b[_0xdda2('0x36')]=_[_0xdda2('0x35')](_0x2caced['model'],qs['fields'](_0x1e29dc['query'][_0xdda2('0x37')]));_0x54735b[_0xdda2('0x36')]=_0x54735b['attributes'][_0xdda2('0x38')]?_0x54735b[_0xdda2('0x36')]:_0x2caced[_0xdda2('0x31')];if(_0x1e29dc['query'][_0xdda2('0x3f')]){_0x54735b[_0xdda2('0x43')]=[{'all':!![]}];}_0x54735b=_['merge']({},_0x54735b,_0x1e29dc['options']);return db[_0xdda2('0x2f')]['find'](_0x54735b)[_0xdda2('0x26')](handleEntityNotFound(_0x15a616,null))['then'](respondWithResult(_0x15a616,null))[_0xdda2('0x41')](handleError(_0x15a616,null));};exports[_0xdda2('0x44')]=function(_0x50bd88,_0x585665){return db[_0xdda2('0x2f')][_0xdda2('0x44')](_0x50bd88[_0xdda2('0x45')],{})[_0xdda2('0x26')](function(_0x578a6c){var _0x1edbc6=_0x50bd88[_0xdda2('0x46')][_0xdda2('0x28')]({'plain':!![]});if(!_0x1edbc6)throw new Error(_0xdda2('0x47'));if(_0x1edbc6[_0xdda2('0x48')]==='user'){var _0x1a56cc=_0x578a6c[_0xdda2('0x28')]({'plain':!![]});var _0x51f2b6=_0xdda2('0x29');return db[_0xdda2('0x49')][_0xdda2('0x4a')]({'where':{'name':_0x51f2b6,'userProfileId':_0x1edbc6[_0xdda2('0x4b')]},'raw':!![]})[_0xdda2('0x26')](function(_0x265169){if(_0x265169&&_0x265169['autoAssociation']===0x0){return db[_0xdda2('0x2a')]['create']({'name':_0x1a56cc[_0xdda2('0x2c')],'resourceId':_0x1a56cc['id'],'type':_0x265169['name'],'sectionId':_0x265169['id']},{})[_0xdda2('0x26')](function(){return _0x578a6c;});}else{return _0x578a6c;}})['catch'](function(_0x3b5bbf){logger[_0xdda2('0x4c')](_0xdda2('0x4d'),_0x3b5bbf);throw _0x3b5bbf;});}return _0x578a6c;})[_0xdda2('0x26')](respondWithResult(_0x585665,0xc9))[_0xdda2('0x41')](handleError(_0x585665,null));};exports[_0xdda2('0x4e')]=function(_0x471b86,_0x40655d){var _0x538ebb={'where':{'id':_0x471b86[_0xdda2('0x4f')]['id']}},_0x477982={};_0x477982[_0xdda2('0x31')]=_['keys'](db[_0xdda2('0x2f')][_0xdda2('0x42')]);_0x538ebb['attributes']=_[_0xdda2('0x35')](_0x477982['model'],qs[_0xdda2('0x37')](_0x471b86[_0xdda2('0x33')][_0xdda2('0x37')]));_0x538ebb[_0xdda2('0x36')]=_0x538ebb[_0xdda2('0x36')]['length']?_0x538ebb['attributes']:_0x477982['model'];if(_0x471b86[_0xdda2('0x33')][_0xdda2('0x3f')]){_0x538ebb['include']=[{'all':!![]}];}_0x538ebb=_[_0xdda2('0x50')]({},_0x538ebb,_0x471b86[_0xdda2('0x3e')]);return db[_0xdda2('0x2f')]['find'](_0x538ebb)[_0xdda2('0x26')](handleEntityNotFound(_0x40655d,null))[_0xdda2('0x26')](function(_0x113266){if(_0x113266){var _0x58ae15=_0x113266[_0xdda2('0x28')]({'plain':!![]});_0x58ae15=qs[_0xdda2('0x51')](_0x58ae15,['id',_0xdda2('0x52'),_0xdda2('0x53')]);_0x471b86['body']=_[_0xdda2('0x51')](_0x471b86['body'],['id','createdAt','updatedAt']);return db[_0xdda2('0x2f')][_0xdda2('0x44')](_[_0xdda2('0x50')](_0x58ae15,_0x471b86[_0xdda2('0x45')]),{'include':_0x471b86[_0xdda2('0x33')][_0xdda2('0x3f')]?[{'all':!![]}]:undefined})[_0xdda2('0x26')](function(_0x3ac33a){var _0x269ad1=_0x471b86[_0xdda2('0x46')][_0xdda2('0x28')]({'plain':!![]});if(!_0x269ad1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x269ad1[_0xdda2('0x48')]===_0xdda2('0x46')){var _0x266ec0=_0x3ac33a[_0xdda2('0x28')]({'plain':!![]});var _0x90bb5c=_0xdda2('0x29');return db[_0xdda2('0x49')]['find']({'where':{'name':_0x90bb5c,'userProfileId':_0x269ad1[_0xdda2('0x4b')]},'raw':!![]})[_0xdda2('0x26')](function(_0x19e650){if(_0x19e650&&_0x19e650[_0xdda2('0x54')]===0x0){return db[_0xdda2('0x2a')]['create']({'name':_0x266ec0[_0xdda2('0x2c')],'resourceId':_0x266ec0['id'],'type':_0x19e650[_0xdda2('0x2c')],'sectionId':_0x19e650['id']},{})[_0xdda2('0x26')](function(){return _0x3ac33a;});}else{return _0x3ac33a;}})[_0xdda2('0x41')](function(_0x21d0e4){logger['error'](_0xdda2('0x4d'),_0x21d0e4);throw _0x21d0e4;});}return _0x3ac33a;});}})[_0xdda2('0x26')](respondWithResult(_0x40655d,0xc9))[_0xdda2('0x41')](handleError(_0x40655d,null));};exports[_0xdda2('0x25')]=function(_0x1ac15a,_0x5d34d7){if(_0x1ac15a[_0xdda2('0x45')]['id']){delete _0x1ac15a[_0xdda2('0x45')]['id'];}return db[_0xdda2('0x2f')]['find']({'where':{'id':_0x1ac15a[_0xdda2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5d34d7,null))[_0xdda2('0x26')](saveUpdates(_0x1ac15a[_0xdda2('0x45')],null))[_0xdda2('0x26')](respondWithResult(_0x5d34d7,null))['catch'](handleError(_0x5d34d7,null));};exports[_0xdda2('0x27')]=function(_0xc60963,_0x511fb9){return db[_0xdda2('0x2f')]['find']({'where':{'id':_0xc60963[_0xdda2('0x4f')]['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x511fb9,null))[_0xdda2('0x26')](removeEntity(_0x511fb9,null))[_0xdda2('0x41')](handleError(_0x511fb9,null));};exports[_0xdda2('0x55')]=function(_0x4a061a,_0x586ca1,_0x42fe90){var _0x25cf60={'raw':!![],'where':{}};var _0x547fbd={};var _0x53e9e0={'count':0x0,'rows':[]};return db[_0xdda2('0x2f')]['findOne']({'where':{'id':_0x4a061a[_0xdda2('0x4f')]['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x586ca1,null))['then'](function(_0x263f6d){if(_0x263f6d){_0x547fbd[_0xdda2('0x31')]=_[_0xdda2('0x32')](db[_0xdda2('0x56')][_0xdda2('0x42')]);_0x547fbd[_0xdda2('0x33')]=_['keys'](_0x4a061a[_0xdda2('0x33')]);_0x547fbd[_0xdda2('0x34')]=_[_0xdda2('0x35')](_0x547fbd['model'],_0x547fbd[_0xdda2('0x33')]);_0x25cf60[_0xdda2('0x36')]=_['intersection'](_0x547fbd['model'],qs[_0xdda2('0x37')](_0x4a061a[_0xdda2('0x33')][_0xdda2('0x37')]));_0x25cf60['attributes']=_0x25cf60['attributes'][_0xdda2('0x38')]?_0x25cf60['attributes']:_0x547fbd[_0xdda2('0x31')];if(!_0x4a061a[_0xdda2('0x33')][_0xdda2('0x57')](_0xdda2('0x58'))){_0x25cf60[_0xdda2('0x1f')]=qs[_0xdda2('0x1f')](_0x4a061a['query']['limit']);_0x25cf60[_0xdda2('0x1c')]=qs['offset'](_0x4a061a[_0xdda2('0x33')][_0xdda2('0x1c')]);}_0x25cf60[_0xdda2('0x39')]=qs[_0xdda2('0x3a')](_0x4a061a[_0xdda2('0x33')][_0xdda2('0x3a')]);_0x25cf60[_0xdda2('0x3b')]=qs[_0xdda2('0x34')](_[_0xdda2('0x59')](_0x4a061a['query'],_0x547fbd[_0xdda2('0x34')]));_0x25cf60[_0xdda2('0x3b')][_0xdda2('0x5a')]=_0x263f6d['id'];if(_0x4a061a[_0xdda2('0x33')]['filter']){_0x25cf60[_0xdda2('0x3b')]=_[_0xdda2('0x50')](_0x25cf60[_0xdda2('0x3b')],{'$or':_[_0xdda2('0x3d')](_0x25cf60['attributes'],function(_0x51766f){var _0xe4110b={};_0xe4110b[_0x51766f]={'$like':'%'+_0x4a061a[_0xdda2('0x33')][_0xdda2('0x3c')]+'%'};return _0xe4110b;})});}_0x25cf60=_[_0xdda2('0x50')]({},_0x25cf60,_0x4a061a['options']);return db[_0xdda2('0x56')][_0xdda2('0x1e')]({'where':_0x25cf60[_0xdda2('0x3b')]})[_0xdda2('0x26')](function(_0x2dda16){_0x53e9e0[_0xdda2('0x1e')]=_0x2dda16;if(_0x4a061a[_0xdda2('0x33')][_0xdda2('0x3f')]){_0x25cf60[_0xdda2('0x43')]=[{'all':!![]}];}return db[_0xdda2('0x56')][_0xdda2('0x5b')](_0x25cf60);})[_0xdda2('0x26')](function(_0x285cb2){_0x53e9e0[_0xdda2('0x40')]=_0x285cb2;return _0x53e9e0;});}})[_0xdda2('0x26')](respondWithFilteredResult(_0x586ca1,_0x25cf60))['catch'](handleError(_0x586ca1,null));};exports[_0xdda2('0x5c')]=function(_0x20969b,_0x58fcea,_0x50f7f6){var _0x3cb641={'raw':!![],'where':{}};var _0x40fd4c={};var _0x1ba7dd={'count':0x0,'rows':[]};return db[_0xdda2('0x2f')][_0xdda2('0x5d')]({'where':{'id':_0x20969b[_0xdda2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x58fcea,null))[_0xdda2('0x26')](function(_0x1f3abe){if(_0x1f3abe){_0x40fd4c[_0xdda2('0x31')]=_[_0xdda2('0x32')](db['JscriptyAnswerReport'][_0xdda2('0x42')]);_0x40fd4c['query']=_[_0xdda2('0x32')](_0x20969b[_0xdda2('0x33')]);_0x40fd4c['filters']=_[_0xdda2('0x35')](_0x40fd4c[_0xdda2('0x31')],_0x40fd4c[_0xdda2('0x33')]);_0x3cb641[_0xdda2('0x36')]=_[_0xdda2('0x35')](_0x40fd4c[_0xdda2('0x31')],qs[_0xdda2('0x37')](_0x20969b[_0xdda2('0x33')][_0xdda2('0x37')]));_0x3cb641[_0xdda2('0x36')]=_0x3cb641[_0xdda2('0x36')]['length']?_0x3cb641[_0xdda2('0x36')]:_0x40fd4c[_0xdda2('0x31')];if(!_0x20969b[_0xdda2('0x33')][_0xdda2('0x57')](_0xdda2('0x58'))){_0x3cb641['limit']=qs[_0xdda2('0x1f')](_0x20969b[_0xdda2('0x33')]['limit']);_0x3cb641[_0xdda2('0x1c')]=qs[_0xdda2('0x1c')](_0x20969b['query']['offset']);}_0x3cb641[_0xdda2('0x39')]=qs[_0xdda2('0x3a')](_0x20969b[_0xdda2('0x33')][_0xdda2('0x3a')]);_0x3cb641[_0xdda2('0x3b')]=qs[_0xdda2('0x34')](_['pick'](_0x20969b[_0xdda2('0x33')],_0x40fd4c[_0xdda2('0x34')]));_0x3cb641['where'][_0xdda2('0x5a')]=_0x1f3abe['id'];if(_0x20969b[_0xdda2('0x33')]['filter']){_0x3cb641[_0xdda2('0x3b')]=_[_0xdda2('0x50')](_0x3cb641[_0xdda2('0x3b')],{'$or':_['map'](_0x3cb641[_0xdda2('0x36')],function(_0x4a34ee){var _0x45e549={};_0x45e549[_0x4a34ee]={'$like':'%'+_0x20969b[_0xdda2('0x33')][_0xdda2('0x3c')]+'%'};return _0x45e549;})});}_0x3cb641=_[_0xdda2('0x50')]({},_0x3cb641,_0x20969b['options']);return db['JscriptyAnswerReport'][_0xdda2('0x1e')]({'where':_0x3cb641[_0xdda2('0x3b')]})['then'](function(_0x468e32){_0x1ba7dd[_0xdda2('0x1e')]=_0x468e32;if(_0x20969b[_0xdda2('0x33')][_0xdda2('0x3f')]){_0x3cb641[_0xdda2('0x43')]=[{'all':!![]}];}return db[_0xdda2('0x5e')][_0xdda2('0x5b')](_0x3cb641);})[_0xdda2('0x26')](function(_0x3046c1){_0x1ba7dd[_0xdda2('0x40')]=_0x3046c1;return _0x1ba7dd;});}})[_0xdda2('0x26')](respondWithFilteredResult(_0x58fcea,_0x3cb641))[_0xdda2('0x41')](handleError(_0x58fcea,null));};function char(_0x528185){return'number'===typeof _0x528185?String['fromCharCode'][_0xdda2('0x5f')](null,arguments):_0x528185;}function needsEncapsulation(_0x4edf20){return!!_0x4edf20&&(_0x4edf20[_0xdda2('0x60')]()[_0xdda2('0x61')](char(0xd))>=0x0||_0x4edf20[_0xdda2('0x60')]()[_0xdda2('0x61')](char(0xa))>=0x0||_0x4edf20['toString']()[_0xdda2('0x61')](char(0x2c))>=0x0||_0x4edf20[_0xdda2('0x60')]()[_0xdda2('0x61')](char(0x22))>=0x0);}function encapsulate(_0x49d5a6){var _0x1d80c0=char(0x22),_0x86235b='\x5c'+char(0x22),_0x2588f5=_0x49d5a6['toString']()['replace'](new RegExp(_0x1d80c0,'g'),_0x86235b);return _0x1d80c0+_0x2588f5+_0x1d80c0;}exports[_0xdda2('0x62')]=function(_0x46e3e4,_0x42df5b,_0x5e3718){var _0x29a037,_0x32a2e9;var _0xdb1841={'where':{'ProjectId':_0x46e3e4[_0xdda2('0x4f')]['id']}};if(_0x46e3e4[_0xdda2('0x33')][_0xdda2('0x63')]){_0xdb1841[_0xdda2('0x3b')]['starttime']=JSON[_0xdda2('0x64')](_0x46e3e4[_0xdda2('0x33')][_0xdda2('0x63')]);}return db[_0xdda2('0x56')]['findAll'](_0xdb1841)[_0xdda2('0x26')](handleEntityNotFound(_0x42df5b,null))[_0xdda2('0x26')](function(_0x36de73){if(_0x36de73){_0x29a037=_0x36de73;return db[_0xdda2('0x65')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x29a037,'id')},'ProjectId':_0x46e3e4['params']['id']},'order':_0xdda2('0x66')});}})[_0xdda2('0x26')](handleEntityNotFound(_0x42df5b,null))[_0xdda2('0x26')](function(_0x429f24){if(_0x429f24){_0x32a2e9=_0x429f24;var _0x1cc1f4={};for(var _0x3cdef1=0x0,_0x5880b8=_0x32a2e9[_0xdda2('0x38')];_0x3cdef1<_0x5880b8;_0x3cdef1++){if(!_0x1cc1f4[_0xdda2('0x57')](_0x32a2e9[_0x3cdef1][_0xdda2('0x67')])){_0x1cc1f4[_0x32a2e9[_0x3cdef1][_0xdda2('0x67')]]=needsEncapsulation(_0x32a2e9[_0x3cdef1][_0xdda2('0x68')])?encapsulate(_0x32a2e9[_0x3cdef1][_0xdda2('0x68')]):_0x32a2e9[_0x3cdef1][_0xdda2('0x68')];}}var _0xbfd011=[],_0x4cdca6={};for(var _0x1aa741=0x0,_0x517b60=_0x29a037[_0xdda2('0x38')];_0x1aa741<_0x517b60;_0x1aa741++){_0x4cdca6={'ProjectId':_0x46e3e4['params']['id'],'SessionId':_0x29a037[_0x1aa741]['id'],'StartTime':moment(_0x29a037[_0x1aa741][_0xdda2('0x69')])['format'](_0xdda2('0x6a'))};for(var _0x31e555=0x0,_0x329d18=_0x32a2e9[_0xdda2('0x38')];_0x31e555<_0x329d18;_0x31e555++){if(_0x32a2e9[_0x31e555][_0xdda2('0x6b')]==_0x29a037[_0x1aa741]['id']&&_0x1cc1f4[_0xdda2('0x57')](_0x32a2e9[_0x31e555][_0xdda2('0x67')])){_0x4cdca6[_0x1cc1f4[_0x32a2e9[_0x31e555][_0xdda2('0x67')]]]=_0x32a2e9[_0x31e555][_0xdda2('0x6c')];}}for(var _0x49db3b in _0x1cc1f4){if(!_0x4cdca6[_0xdda2('0x57')](_0x1cc1f4[_0x49db3b])){_0x4cdca6[_0x1cc1f4[_0x49db3b]]=null;}}_0xbfd011[_0xdda2('0x6d')](_0x4cdca6);}return _0xbfd011;}})['then'](function(_0x42db44){if(!_[_0xdda2('0x6e')](_0x42db44)){var _0x2f3807=toCsv(_0x42db44);var _0x5600da=Date[_0xdda2('0x6f')]();fs[_0xdda2('0x70')](util[_0xdda2('0x71')](_0xdda2('0x72'),_0x46e3e4[_0xdda2('0x4f')]['id'],_0x5600da),_0x2f3807);_0x42df5b[_0xdda2('0x73')](_0xdda2('0x74'),_0xdda2('0x75')+util[_0xdda2('0x71')](_0xdda2('0x76'),_0x46e3e4['params']['id'],_0x5600da));_0x42df5b[_0xdda2('0x73')](_0xdda2('0x77'),_0xdda2('0x78'));return _0x42df5b[_0xdda2('0x79')](util[_0xdda2('0x71')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x46e3e4[_0xdda2('0x4f')]['id'],_0x5600da));}else{return _0x42df5b[_0xdda2('0x19')](0xcc);}})[_0xdda2('0x41')](handleError(_0x42df5b,null));}; \ No newline at end of file +var _0x18a9=['getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','startTime','starttime','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','sendStatus','error','stack','name','send','index','JscriptyProject','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','JscriptySessionReport','pick','ProjectId'];(function(_0x12991a,_0x5c7263){var _0x247c48=function(_0x431efd){while(--_0x431efd){_0x12991a['push'](_0x12991a['shift']());}};_0x247c48(++_0x5c7263);}(_0x18a9,0x17e));var _0x918a=function(_0x25e881,_0xe7d421){_0x25e881=_0x25e881-0x0;var _0x26d60a=_0x18a9[_0x25e881];return _0x26d60a;};'use strict';var emlformat=require(_0x918a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x918a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x918a('0x2'));var moment=require(_0x918a('0x3'));var BPromise=require(_0x918a('0x4'));var Mustache=require(_0x918a('0x5'));var util=require(_0x918a('0x6'));var path=require(_0x918a('0x7'));var sox=require(_0x918a('0x8'));var csv=require(_0x918a('0x9'));var ejs=require(_0x918a('0xa'));var fs=require('fs');var fs_extra=require(_0x918a('0xb'));var _=require('lodash');var squel=require(_0x918a('0xc'));var crypto=require('crypto');var jsforce=require(_0x918a('0xd'));var deskjs=require(_0x918a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x918a('0xf'));var Papa=require('papaparse');var Redis=require(_0x918a('0x10'));var authService=require(_0x918a('0x11'));var qs=require(_0x918a('0x12'));var as=require(_0x918a('0x13'));var hardwareService=require(_0x918a('0x14'));var logger=require('../../config/logger')(_0x918a('0x15'));var utils=require(_0x918a('0x16'));var config=require(_0x918a('0x17'));var licenseUtil=require(_0x918a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b8a42,_0x3f02af){_0x3f02af=_0x3f02af||0xcc;return function(_0x316b36){if(_0x316b36){return _0x1b8a42['sendStatus'](_0x3f02af);}return _0x1b8a42[_0x918a('0x19')](_0x3f02af)[_0x918a('0x1a')]();};}function respondWithResult(_0xb72115,_0x53f115){_0x53f115=_0x53f115||0xc8;return function(_0x41e8b0){if(_0x41e8b0){return _0xb72115[_0x918a('0x19')](_0x53f115)['json'](_0x41e8b0);}};}function respondWithFilteredResult(_0x543a84,_0x149566){return function(_0xf6ef2b){if(_0xf6ef2b){var _0x3ec709=typeof _0x149566['offset']===_0x918a('0x1b')&&typeof _0x149566[_0x918a('0x1c')]==='undefined';var _0x3912bc=_0xf6ef2b[_0x918a('0x1d')];var _0x3b5f4b=_0x3ec709?0x0:_0x149566['offset'];var _0x124804=_0x3ec709?_0xf6ef2b[_0x918a('0x1d')]:_0x149566['offset']+_0x149566[_0x918a('0x1c')];var _0x4b7458;if(_0x124804>=_0x3912bc){_0x124804=_0x3912bc;_0x4b7458=0xc8;}else{_0x4b7458=0xce;}_0x543a84['status'](_0x4b7458);return _0x543a84['set'](_0x918a('0x1e'),_0x3b5f4b+'-'+_0x124804+'/'+_0x3912bc)[_0x918a('0x1f')](_0xf6ef2b);}return null;};}function patchUpdates(_0x5e2cb0){return function(_0x1cc225){try{jsonpatch[_0x918a('0x20')](_0x1cc225,_0x5e2cb0,!![]);}catch(_0x34f0c2){return BPromise[_0x918a('0x21')](_0x34f0c2);}return _0x1cc225[_0x918a('0x22')]();};}function saveUpdates(_0xa9110d,_0x1c5f9b){return function(_0x18bdac){if(_0x18bdac){return _0x18bdac[_0x918a('0x23')](_0xa9110d)[_0x918a('0x24')](function(_0x3d090c){return _0x3d090c;});}return null;};}function removeEntity(_0x5a4d87,_0x186fb5){return function(_0x4e4399){if(_0x4e4399){return _0x4e4399[_0x918a('0x25')]()[_0x918a('0x24')](function(){var _0x55256a=_0x4e4399[_0x918a('0x26')]({'plain':!![]});var _0x2ac566=_0x918a('0x27');return db[_0x918a('0x28')]['destroy']({'where':{'type':_0x2ac566,'resourceId':_0x55256a['id']}})[_0x918a('0x24')](function(){return _0x4e4399;});})[_0x918a('0x24')](function(){_0x5a4d87['status'](0xcc)[_0x918a('0x1a')]();});}};}function handleEntityNotFound(_0x1604fd,_0x4cd551){return function(_0x2fe4e7){if(!_0x2fe4e7){_0x1604fd[_0x918a('0x29')](0x194);}return _0x2fe4e7;};}function handleError(_0x24e49c,_0x52a57b){_0x52a57b=_0x52a57b||0x1f4;return function(_0x3a2fe2){logger[_0x918a('0x2a')](_0x3a2fe2[_0x918a('0x2b')]);if(_0x3a2fe2['name']){delete _0x3a2fe2[_0x918a('0x2c')];}_0x24e49c['status'](_0x52a57b)[_0x918a('0x2d')](_0x3a2fe2);};}exports[_0x918a('0x2e')]=function(_0x52969e,_0xd21ff3){var _0x3e02c0={},_0x2b9d34={},_0x9d9a98={'count':0x0,'rows':[]};var _0x1c2e2f=_['map'](db[_0x918a('0x2f')][_0x918a('0x30')],function(_0x41aa2f){return{'name':_0x41aa2f['fieldName'],'type':_0x41aa2f[_0x918a('0x31')][_0x918a('0x32')]};});_0x2b9d34[_0x918a('0x33')]=_[_0x918a('0x34')](_0x1c2e2f,_0x918a('0x2c'));_0x2b9d34[_0x918a('0x35')]=_[_0x918a('0x36')](_0x52969e['query']);_0x2b9d34[_0x918a('0x37')]=_[_0x918a('0x38')](_0x2b9d34[_0x918a('0x33')],_0x2b9d34[_0x918a('0x35')]);_0x3e02c0[_0x918a('0x39')]=_[_0x918a('0x38')](_0x2b9d34[_0x918a('0x33')],qs[_0x918a('0x3a')](_0x52969e[_0x918a('0x35')][_0x918a('0x3a')]));_0x3e02c0[_0x918a('0x39')]=_0x3e02c0['attributes'][_0x918a('0x3b')]?_0x3e02c0['attributes']:_0x2b9d34[_0x918a('0x33')];if(!_0x52969e[_0x918a('0x35')][_0x918a('0x3c')](_0x918a('0x3d'))){_0x3e02c0[_0x918a('0x1c')]=qs[_0x918a('0x1c')](_0x52969e['query'][_0x918a('0x1c')]);_0x3e02c0[_0x918a('0x3e')]=qs['offset'](_0x52969e[_0x918a('0x35')][_0x918a('0x3e')]);}_0x3e02c0[_0x918a('0x3f')]=qs[_0x918a('0x40')](_0x52969e[_0x918a('0x35')][_0x918a('0x40')]);_0x3e02c0[_0x918a('0x41')]=qs[_0x918a('0x37')](_['pick'](_0x52969e[_0x918a('0x35')],_0x2b9d34['filters']),_0x1c2e2f);if(_0x52969e[_0x918a('0x35')][_0x918a('0x42')]){_0x3e02c0['where']=_[_0x918a('0x43')](_0x3e02c0[_0x918a('0x41')],{'$or':_[_0x918a('0x34')](_0x1c2e2f,function(_0x138a6c){if(_0x138a6c[_0x918a('0x31')]!==_0x918a('0x44')){var _0x4b3c5a={};_0x4b3c5a[_0x138a6c[_0x918a('0x2c')]]={'$like':'%'+_0x52969e['query'][_0x918a('0x42')]+'%'};return _0x4b3c5a;}})});}_0x3e02c0=_[_0x918a('0x43')]({},_0x3e02c0,_0x52969e[_0x918a('0x45')]);var _0x30e7b3={'where':_0x3e02c0[_0x918a('0x41')]};return db[_0x918a('0x2f')]['count'](_0x30e7b3)[_0x918a('0x24')](function(_0xf91204){_0x9d9a98['count']=_0xf91204;if(_0x52969e[_0x918a('0x35')]['includeAll']){_0x3e02c0[_0x918a('0x46')]=[{'all':!![]}];}return db['JscriptyProject'][_0x918a('0x47')](_0x3e02c0);})[_0x918a('0x24')](function(_0x463fa0){_0x9d9a98[_0x918a('0x48')]=_0x463fa0;return _0x9d9a98;})[_0x918a('0x24')](respondWithFilteredResult(_0xd21ff3,_0x3e02c0))[_0x918a('0x49')](handleError(_0xd21ff3,null));};exports[_0x918a('0x4a')]=function(_0x53913d,_0x53de1c){var _0x58af7e={'raw':![],'where':{'id':_0x53913d[_0x918a('0x4b')]['id']}},_0x1b8298={};_0x1b8298['model']=_[_0x918a('0x36')](db[_0x918a('0x2f')]['rawAttributes']);_0x1b8298[_0x918a('0x35')]=_[_0x918a('0x36')](_0x53913d['query']);_0x1b8298['filters']=_[_0x918a('0x38')](_0x1b8298[_0x918a('0x33')],_0x1b8298['query']);_0x58af7e[_0x918a('0x39')]=_[_0x918a('0x38')](_0x1b8298['model'],qs[_0x918a('0x3a')](_0x53913d[_0x918a('0x35')][_0x918a('0x3a')]));_0x58af7e[_0x918a('0x39')]=_0x58af7e['attributes'][_0x918a('0x3b')]?_0x58af7e[_0x918a('0x39')]:_0x1b8298[_0x918a('0x33')];if(_0x53913d[_0x918a('0x35')][_0x918a('0x4c')]){_0x58af7e['include']=[{'all':!![]}];}_0x58af7e=_[_0x918a('0x43')]({},_0x58af7e,_0x53913d[_0x918a('0x45')]);return db[_0x918a('0x2f')][_0x918a('0x4d')](_0x58af7e)['then'](handleEntityNotFound(_0x53de1c,null))['then'](respondWithResult(_0x53de1c,null))[_0x918a('0x49')](handleError(_0x53de1c,null));};exports[_0x918a('0x4e')]=function(_0xb991d1,_0x248313){return db['JscriptyProject'][_0x918a('0x4e')](_0xb991d1['body'],{})['then'](function(_0x49fde2){var _0x51d3c6=_0xb991d1[_0x918a('0x4f')][_0x918a('0x26')]({'plain':!![]});if(!_0x51d3c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51d3c6[_0x918a('0x50')]===_0x918a('0x4f')){var _0x13f1fa=_0x49fde2['get']({'plain':!![]});var _0x4360cc='Projects';return db[_0x918a('0x51')][_0x918a('0x4d')]({'where':{'name':_0x4360cc,'userProfileId':_0x51d3c6[_0x918a('0x52')]},'raw':!![]})[_0x918a('0x24')](function(_0x496c45){if(_0x496c45&&_0x496c45[_0x918a('0x53')]===0x0){return db[_0x918a('0x28')]['create']({'name':_0x13f1fa[_0x918a('0x2c')],'resourceId':_0x13f1fa['id'],'type':_0x496c45[_0x918a('0x2c')],'sectionId':_0x496c45['id']},{})[_0x918a('0x24')](function(){return _0x49fde2;});}else{return _0x49fde2;}})[_0x918a('0x49')](function(_0x19a8cb){logger[_0x918a('0x2a')](_0x918a('0x54'),_0x19a8cb);throw _0x19a8cb;});}return _0x49fde2;})[_0x918a('0x24')](respondWithResult(_0x248313,0xc9))['catch'](handleError(_0x248313,null));};exports['clone']=function(_0x14e64d,_0x298998){var _0x1047e5={'where':{'id':_0x14e64d[_0x918a('0x4b')]['id']}},_0x4cb14e={};_0x4cb14e[_0x918a('0x33')]=_[_0x918a('0x36')](db[_0x918a('0x2f')][_0x918a('0x30')]);_0x1047e5[_0x918a('0x39')]=_[_0x918a('0x38')](_0x4cb14e[_0x918a('0x33')],qs[_0x918a('0x3a')](_0x14e64d['query'][_0x918a('0x3a')]));_0x1047e5['attributes']=_0x1047e5[_0x918a('0x39')][_0x918a('0x3b')]?_0x1047e5[_0x918a('0x39')]:_0x4cb14e[_0x918a('0x33')];if(_0x14e64d[_0x918a('0x35')]['includeAll']){_0x1047e5['include']=[{'all':!![]}];}_0x1047e5=_[_0x918a('0x43')]({},_0x1047e5,_0x14e64d[_0x918a('0x45')]);return db[_0x918a('0x2f')][_0x918a('0x4d')](_0x1047e5)[_0x918a('0x24')](handleEntityNotFound(_0x298998,null))[_0x918a('0x24')](function(_0x9e1378){if(_0x9e1378){var _0x4c36a1=_0x9e1378[_0x918a('0x26')]({'plain':!![]});_0x4c36a1=qs[_0x918a('0x55')](_0x4c36a1,['id','createdAt',_0x918a('0x56')]);_0x14e64d[_0x918a('0x57')]=_['omit'](_0x14e64d[_0x918a('0x57')],['id','createdAt',_0x918a('0x56')]);return db[_0x918a('0x2f')]['create'](_[_0x918a('0x43')](_0x4c36a1,_0x14e64d[_0x918a('0x57')]),{'include':_0x14e64d[_0x918a('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x2be04c){var _0x4a8523=_0x14e64d[_0x918a('0x4f')][_0x918a('0x26')]({'plain':!![]});if(!_0x4a8523)throw new Error(_0x918a('0x58'));if(_0x4a8523[_0x918a('0x50')]===_0x918a('0x4f')){var _0x5d0a98=_0x2be04c[_0x918a('0x26')]({'plain':!![]});var _0x3676e0=_0x918a('0x27');return db[_0x918a('0x51')][_0x918a('0x4d')]({'where':{'name':_0x3676e0,'userProfileId':_0x4a8523[_0x918a('0x52')]},'raw':!![]})['then'](function(_0x20ea01){if(_0x20ea01&&_0x20ea01[_0x918a('0x53')]===0x0){return db[_0x918a('0x28')][_0x918a('0x4e')]({'name':_0x5d0a98[_0x918a('0x2c')],'resourceId':_0x5d0a98['id'],'type':_0x20ea01[_0x918a('0x2c')],'sectionId':_0x20ea01['id']},{})[_0x918a('0x24')](function(){return _0x2be04c;});}else{return _0x2be04c;}})[_0x918a('0x49')](function(_0x4a28a0){logger[_0x918a('0x2a')](_0x918a('0x54'),_0x4a28a0);throw _0x4a28a0;});}return _0x2be04c;});}})['then'](respondWithResult(_0x298998,0xc9))[_0x918a('0x49')](handleError(_0x298998,null));};exports['update']=function(_0x50f24f,_0x13c541){if(_0x50f24f[_0x918a('0x57')]['id']){delete _0x50f24f[_0x918a('0x57')]['id'];}return db['JscriptyProject'][_0x918a('0x4d')]({'where':{'id':_0x50f24f[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x13c541,null))[_0x918a('0x24')](saveUpdates(_0x50f24f[_0x918a('0x57')],null))[_0x918a('0x24')](respondWithResult(_0x13c541,null))[_0x918a('0x49')](handleError(_0x13c541,null));};exports[_0x918a('0x25')]=function(_0x316857,_0x2c7b66){return db[_0x918a('0x2f')][_0x918a('0x4d')]({'where':{'id':_0x316857[_0x918a('0x4b')]['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x2c7b66,null))[_0x918a('0x24')](removeEntity(_0x2c7b66,null))['catch'](handleError(_0x2c7b66,null));};exports[_0x918a('0x59')]=function(_0xaeb91d,_0x5984cc,_0x3fdd9b){var _0x4a7c9c={'raw':!![],'where':{}};var _0x2871ff={};var _0x50a108={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x918a('0x5a')]({'where':{'id':_0xaeb91d['params']['id']}})['then'](handleEntityNotFound(_0x5984cc,null))['then'](function(_0x53a938){if(_0x53a938){_0x2871ff[_0x918a('0x33')]=_['keys'](db[_0x918a('0x5b')]['rawAttributes']);_0x2871ff[_0x918a('0x35')]=_[_0x918a('0x36')](_0xaeb91d['query']);_0x2871ff[_0x918a('0x37')]=_[_0x918a('0x38')](_0x2871ff['model'],_0x2871ff[_0x918a('0x35')]);_0x4a7c9c[_0x918a('0x39')]=_[_0x918a('0x38')](_0x2871ff['model'],qs[_0x918a('0x3a')](_0xaeb91d['query'][_0x918a('0x3a')]));_0x4a7c9c[_0x918a('0x39')]=_0x4a7c9c['attributes'][_0x918a('0x3b')]?_0x4a7c9c[_0x918a('0x39')]:_0x2871ff[_0x918a('0x33')];if(!_0xaeb91d[_0x918a('0x35')][_0x918a('0x3c')]('nolimit')){_0x4a7c9c[_0x918a('0x1c')]=qs[_0x918a('0x1c')](_0xaeb91d[_0x918a('0x35')][_0x918a('0x1c')]);_0x4a7c9c[_0x918a('0x3e')]=qs[_0x918a('0x3e')](_0xaeb91d[_0x918a('0x35')][_0x918a('0x3e')]);}_0x4a7c9c[_0x918a('0x3f')]=qs['sort'](_0xaeb91d['query'][_0x918a('0x40')]);_0x4a7c9c[_0x918a('0x41')]=qs[_0x918a('0x37')](_[_0x918a('0x5c')](_0xaeb91d[_0x918a('0x35')],_0x2871ff[_0x918a('0x37')]));_0x4a7c9c[_0x918a('0x41')][_0x918a('0x5d')]=_0x53a938['id'];if(_0xaeb91d[_0x918a('0x35')][_0x918a('0x42')]){_0x4a7c9c[_0x918a('0x41')]=_[_0x918a('0x43')](_0x4a7c9c[_0x918a('0x41')],{'$or':_['map'](_0x4a7c9c['attributes'],function(_0x1737d6){var _0x987a4a={};_0x987a4a[_0x1737d6]={'$like':'%'+_0xaeb91d['query'][_0x918a('0x42')]+'%'};return _0x987a4a;})});}_0x4a7c9c=_[_0x918a('0x43')]({},_0x4a7c9c,_0xaeb91d[_0x918a('0x45')]);return db['JscriptySessionReport'][_0x918a('0x1d')]({'where':_0x4a7c9c[_0x918a('0x41')]})[_0x918a('0x24')](function(_0x3afd72){_0x50a108[_0x918a('0x1d')]=_0x3afd72;if(_0xaeb91d[_0x918a('0x35')][_0x918a('0x4c')]){_0x4a7c9c[_0x918a('0x46')]=[{'all':!![]}];}return db[_0x918a('0x5b')][_0x918a('0x47')](_0x4a7c9c);})[_0x918a('0x24')](function(_0x53e2c1){_0x50a108['rows']=_0x53e2c1;return _0x50a108;});}})[_0x918a('0x24')](respondWithFilteredResult(_0x5984cc,_0x4a7c9c))[_0x918a('0x49')](handleError(_0x5984cc,null));};exports[_0x918a('0x5e')]=function(_0xcdb8d6,_0x55ffb5,_0x4eafa6){var _0x1639d={'raw':!![],'where':{}};var _0x2698ef={};var _0x323d94={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0xcdb8d6['params']['id']}})[_0x918a('0x24')](handleEntityNotFound(_0x55ffb5,null))[_0x918a('0x24')](function(_0x5d0965){if(_0x5d0965){_0x2698ef[_0x918a('0x33')]=_['keys'](db[_0x918a('0x5f')][_0x918a('0x30')]);_0x2698ef['query']=_['keys'](_0xcdb8d6[_0x918a('0x35')]);_0x2698ef['filters']=_['intersection'](_0x2698ef['model'],_0x2698ef[_0x918a('0x35')]);_0x1639d[_0x918a('0x39')]=_[_0x918a('0x38')](_0x2698ef[_0x918a('0x33')],qs[_0x918a('0x3a')](_0xcdb8d6[_0x918a('0x35')][_0x918a('0x3a')]));_0x1639d[_0x918a('0x39')]=_0x1639d[_0x918a('0x39')][_0x918a('0x3b')]?_0x1639d[_0x918a('0x39')]:_0x2698ef[_0x918a('0x33')];if(!_0xcdb8d6['query'][_0x918a('0x3c')](_0x918a('0x3d'))){_0x1639d['limit']=qs['limit'](_0xcdb8d6[_0x918a('0x35')][_0x918a('0x1c')]);_0x1639d['offset']=qs['offset'](_0xcdb8d6[_0x918a('0x35')][_0x918a('0x3e')]);}_0x1639d['order']=qs[_0x918a('0x40')](_0xcdb8d6['query'][_0x918a('0x40')]);_0x1639d[_0x918a('0x41')]=qs[_0x918a('0x37')](_['pick'](_0xcdb8d6[_0x918a('0x35')],_0x2698ef[_0x918a('0x37')]));_0x1639d[_0x918a('0x41')][_0x918a('0x5d')]=_0x5d0965['id'];if(_0xcdb8d6[_0x918a('0x35')][_0x918a('0x42')]){_0x1639d[_0x918a('0x41')]=_['merge'](_0x1639d[_0x918a('0x41')],{'$or':_[_0x918a('0x34')](_0x1639d[_0x918a('0x39')],function(_0xb47646){var _0x5722d0={};_0x5722d0[_0xb47646]={'$like':'%'+_0xcdb8d6[_0x918a('0x35')][_0x918a('0x42')]+'%'};return _0x5722d0;})});}_0x1639d=_[_0x918a('0x43')]({},_0x1639d,_0xcdb8d6['options']);return db[_0x918a('0x5f')]['count']({'where':_0x1639d[_0x918a('0x41')]})[_0x918a('0x24')](function(_0x420a76){_0x323d94[_0x918a('0x1d')]=_0x420a76;if(_0xcdb8d6[_0x918a('0x35')]['includeAll']){_0x1639d[_0x918a('0x46')]=[{'all':!![]}];}return db[_0x918a('0x5f')][_0x918a('0x47')](_0x1639d);})[_0x918a('0x24')](function(_0x495dee){_0x323d94[_0x918a('0x48')]=_0x495dee;return _0x323d94;});}})[_0x918a('0x24')](respondWithFilteredResult(_0x55ffb5,_0x1639d))['catch'](handleError(_0x55ffb5,null));};function char(_0x37fa14){return _0x918a('0x60')===typeof _0x37fa14?String[_0x918a('0x61')][_0x918a('0x20')](null,arguments):_0x37fa14;}function needsEncapsulation(_0x17fad2){return!!_0x17fad2&&(_0x17fad2[_0x918a('0x62')]()[_0x918a('0x63')](char(0xd))>=0x0||_0x17fad2['toString']()[_0x918a('0x63')](char(0xa))>=0x0||_0x17fad2[_0x918a('0x62')]()[_0x918a('0x63')](char(0x2c))>=0x0||_0x17fad2['toString']()[_0x918a('0x63')](char(0x22))>=0x0);}function encapsulate(_0x5250a1){var _0x24471f=char(0x22),_0x171787='\x5c'+char(0x22),_0x204653=_0x5250a1[_0x918a('0x62')]()['replace'](new RegExp(_0x24471f,'g'),_0x171787);return _0x24471f+_0x204653+_0x24471f;}exports['getSummary']=function(_0x3f6e9b,_0x52313a,_0xb20cf3){var _0x1cb4d1,_0x230af1;var _0x59e4cd={'where':{'ProjectId':_0x3f6e9b[_0x918a('0x4b')]['id']}};if(_0x3f6e9b['query'][_0x918a('0x64')]){_0x59e4cd['where'][_0x918a('0x65')]=JSON['parse'](_0x3f6e9b[_0x918a('0x35')][_0x918a('0x64')]);}return db[_0x918a('0x5b')][_0x918a('0x47')](_0x59e4cd)[_0x918a('0x24')](handleEntityNotFound(_0x52313a,null))[_0x918a('0x24')](function(_0x16587c){if(_0x16587c){_0x1cb4d1=_0x16587c;return db['JscriptyQuestionReport'][_0x918a('0x47')]({'where':{'SessionId':{'$in':_[_0x918a('0x34')](_0x1cb4d1,'id')},'ProjectId':_0x3f6e9b[_0x918a('0x4b')]['id']},'order':_0x918a('0x66')});}})[_0x918a('0x24')](handleEntityNotFound(_0x52313a,null))[_0x918a('0x24')](function(_0x31fe86){if(_0x31fe86){_0x230af1=_0x31fe86;var _0x338ec1={};for(var _0x2d0bae=0x0,_0x1ef186=_0x230af1[_0x918a('0x3b')];_0x2d0bae<_0x1ef186;_0x2d0bae++){if(!_0x338ec1[_0x918a('0x3c')](_0x230af1[_0x2d0bae][_0x918a('0x67')])){_0x338ec1[_0x230af1[_0x2d0bae][_0x918a('0x67')]]=needsEncapsulation(_0x230af1[_0x2d0bae][_0x918a('0x68')])?encapsulate(_0x230af1[_0x2d0bae][_0x918a('0x68')]):_0x230af1[_0x2d0bae]['question'];}}var _0x27d4b5=[],_0x132a1e={};for(var _0x392ea0=0x0,_0xad0680=_0x1cb4d1[_0x918a('0x3b')];_0x392ea0<_0xad0680;_0x392ea0++){_0x132a1e={'ProjectId':_0x3f6e9b[_0x918a('0x4b')]['id'],'SessionId':_0x1cb4d1[_0x392ea0]['id'],'StartTime':moment(_0x1cb4d1[_0x392ea0]['starttime'])['format'](_0x918a('0x69'))};for(var _0x30187f=0x0,_0x2ff6b3=_0x230af1[_0x918a('0x3b')];_0x30187f<_0x2ff6b3;_0x30187f++){if(_0x230af1[_0x30187f][_0x918a('0x6a')]==_0x1cb4d1[_0x392ea0]['id']&&_0x338ec1[_0x918a('0x3c')](_0x230af1[_0x30187f][_0x918a('0x67')])){_0x132a1e[_0x338ec1[_0x230af1[_0x30187f][_0x918a('0x67')]]]=_0x230af1[_0x30187f][_0x918a('0x6b')];}}for(var _0x18e9f8 in _0x338ec1){if(!_0x132a1e[_0x918a('0x3c')](_0x338ec1[_0x18e9f8])){_0x132a1e[_0x338ec1[_0x18e9f8]]=null;}}_0x27d4b5[_0x918a('0x6c')](_0x132a1e);}return _0x27d4b5;}})['then'](function(_0x17d090){if(!_[_0x918a('0x6d')](_0x17d090)){var _0x43c3a7=toCsv(_0x17d090);var _0x4740b9=Date[_0x918a('0x6e')]();fs[_0x918a('0x6f')](util[_0x918a('0x70')](_0x918a('0x71'),_0x3f6e9b['params']['id'],_0x4740b9),_0x43c3a7);_0x52313a['setHeader'](_0x918a('0x72'),_0x918a('0x73')+util['format'](_0x918a('0x74'),_0x3f6e9b['params']['id'],_0x4740b9));_0x52313a['setHeader']('Content-type',_0x918a('0x75'));return _0x52313a[_0x918a('0x76')](util[_0x918a('0x70')](_0x918a('0x71'),_0x3f6e9b[_0x918a('0x4b')]['id'],_0x4740b9));}else{return _0x52313a[_0x918a('0x29')](0xcc);}})[_0x918a('0x49')](handleError(_0x52313a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 7dc9a3e..92e254f 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 _0x165d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x5acaa4,_0x549f5b){var _0x4b9175=function(_0x1ca9e4){while(--_0x1ca9e4){_0x5acaa4['push'](_0x5acaa4['shift']());}};_0x4b9175(++_0x549f5b);}(_0x165d,0x14a));var _0xd165=function(_0x10e27d,_0xb43940){_0x10e27d=_0x10e27d-0x0;var _0x2ec520=_0x165d[_0x10e27d];return _0x2ec520;};'use strict';var _=require(_0xd165('0x0'));var util=require(_0xd165('0x1'));var logger=require(_0xd165('0x2'))(_0xd165('0x3'));var moment=require(_0xd165('0x4'));var BPromise=require(_0xd165('0x5'));var rp=require(_0xd165('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd165('0x7'));var config=require(_0xd165('0x8'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x5435f9,_0x42d256){return _0x5435f9[_0xd165('0x9')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56e7=['define','JscriptyProject','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x3b9a7c,_0x2e1e73){var _0xcb9f69=function(_0xbd1e6d){while(--_0xbd1e6d){_0x3b9a7c['push'](_0x3b9a7c['shift']());}};_0xcb9f69(++_0x2e1e73);}(_0x56e7,0x7b));var _0x756e=function(_0x211cad,_0x393dde){_0x211cad=_0x211cad-0x0;var _0x351ca4=_0x56e7[_0x211cad];return _0x351ca4;};'use strict';var _=require('lodash');var util=require(_0x756e('0x0'));var logger=require(_0x756e('0x1'))('api');var moment=require(_0x756e('0x2'));var BPromise=require(_0x756e('0x3'));var rp=require(_0x756e('0x4'));var fs=require('fs');var path=require(_0x756e('0x5'));var rimraf=require(_0x756e('0x6'));var config=require(_0x756e('0x7'));var attributes=require(_0x756e('0x8'));module['exports']=function(_0x3b3b8f,_0x404189){return _0x3b3b8f[_0x756e('0x9')](_0x756e('0xa'),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 48eaee5..f8bf004 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(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0xda3f,0xec));var _0xfda3=function(_0x336a72,_0xbb7b6a){_0x336a72=_0x336a72-0x0;var _0x37d0e7=_0xda3f[_0x336a72];return _0x37d0e7;};'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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x146375,_0x38b30d){var _0x24a6aa=function(_0x1386e5){while(--_0x1386e5){_0x146375['push'](_0x146375['shift']());}};_0x24a6aa(++_0x38b30d);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 4b9cab3..b07f060 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 _0x143c=['isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x5adc0a,_0x73fac5){var _0x23f5f8=function(_0xf1abbf){while(--_0xf1abbf){_0x5adc0a['push'](_0x5adc0a['shift']());}};_0x23f5f8(++_0x73fac5);}(_0x143c,0x16c));var _0xc143=function(_0x43f47b,_0x311636){_0x43f47b=_0x43f47b-0x0;var _0x4af9a6=_0x143c[_0x43f47b];return _0x4af9a6;};'use strict';var multer=require(_0xc143('0x0'));var util=require(_0xc143('0x1'));var path=require(_0xc143('0x2'));var timeout=require(_0xc143('0x3'));var express=require(_0xc143('0x4'));var router=express[_0xc143('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc143('0x6'));var interaction=require(_0xc143('0x7'));var config=require(_0xc143('0x8'));var controller=require(_0xc143('0x9'));router['get']('/',auth[_0xc143('0xa')](),controller[_0xc143('0xb')]);router[_0xc143('0xc')](_0xc143('0xd'),auth[_0xc143('0xa')](),controller[_0xc143('0xe')]);router[_0xc143('0xc')](_0xc143('0xf'),auth[_0xc143('0xa')](),controller[_0xc143('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc143('0x11')]);router[_0xc143('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xc143('0x13')]);router[_0xc143('0x14')]('/:id',auth[_0xc143('0xa')](),controller['destroy']);module[_0xc143('0x15')]=router; \ No newline at end of file +var _0xd57a=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xd57a,0xdf));var _0xad57=function(_0x172cd4,_0x2108fb){_0x172cd4=_0x172cd4-0x0;var _0x38a8f3=_0xd57a[_0x172cd4];return _0x38a8f3;};'use strict';var multer=require(_0xad57('0x0'));var util=require(_0xad57('0x1'));var path=require(_0xad57('0x2'));var timeout=require('connect-timeout');var express=require(_0xad57('0x3'));var router=express[_0xad57('0x4')]();var fs_extra=require(_0xad57('0x5'));var auth=require(_0xad57('0x6'));var interaction=require(_0xad57('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0xad57('0x8')]('/',auth[_0xad57('0x9')](),controller[_0xad57('0xa')]);router[_0xad57('0x8')](_0xad57('0xb'),auth[_0xad57('0x9')](),controller[_0xad57('0xc')]);router['get'](_0xad57('0xd'),auth[_0xad57('0x9')](),controller[_0xad57('0xe')]);router[_0xad57('0xf')]('/',auth[_0xad57('0x9')](),controller[_0xad57('0x10')]);router[_0xad57('0x11')](_0xad57('0xd'),auth['isAuthenticated'](),controller[_0xad57('0x12')]);router[_0xad57('0x13')](_0xad57('0xd'),auth[_0xad57('0x9')](),controller[_0xad57('0x14')]);module[_0xad57('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index ac3f79c..797c081 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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7a54,0x106));var _0x47a5=function(_0x104fd1,_0x5878a2){_0x104fd1=_0x104fd1-0x0;var _0x3e8f11=_0x7a54[_0x104fd1];return _0x3e8f11;};'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(_0x39b5d3,_0x26aadb){_0x39b5d3=_0x39b5d3-0x0;var _0x35a173=_0x7a54[_0x39b5d3];return _0x35a173;};'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 1858b19..02baf8e 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 _0x42cb=['type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','count','findAll','show','params','fields','include','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','save','update','then','destroy','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName'];(function(_0x99e298,_0x4c95ad){var _0x32d7f1=function(_0x450c21){while(--_0x450c21){_0x99e298['push'](_0x99e298['shift']());}};_0x32d7f1(++_0x4c95ad);}(_0x42cb,0xae));var _0xb42c=function(_0x474dcb,_0x41aee4){_0x474dcb=_0x474dcb-0x0;var _0x1dd371=_0x42cb[_0x474dcb];return _0x1dd371;};'use strict';var emlformat=require(_0xb42c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb42c('0x1'));var jsonpatch=require(_0xb42c('0x2'));var rp=require(_0xb42c('0x3'));var moment=require('moment');var BPromise=require(_0xb42c('0x4'));var Mustache=require(_0xb42c('0x5'));var util=require(_0xb42c('0x6'));var path=require(_0xb42c('0x7'));var sox=require('sox');var csv=require(_0xb42c('0x8'));var ejs=require(_0xb42c('0x9'));var fs=require('fs');var fs_extra=require(_0xb42c('0xa'));var _=require('lodash');var squel=require(_0xb42c('0xb'));var crypto=require(_0xb42c('0xc'));var jsforce=require(_0xb42c('0xd'));var deskjs=require(_0xb42c('0xe'));var toCsv=require(_0xb42c('0x8'));var querystring=require(_0xb42c('0xf'));var Papa=require(_0xb42c('0x10'));var Redis=require(_0xb42c('0x11'));var authService=require(_0xb42c('0x12'));var qs=require(_0xb42c('0x13'));var as=require(_0xb42c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb42c('0x15'))(_0xb42c('0x16'));var utils=require(_0xb42c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb42c('0x18'))['db'];function respondWithStatusCode(_0xbe8d90,_0x5e3056){_0x5e3056=_0x5e3056||0xcc;return function(_0x3be93d){if(_0x3be93d){return _0xbe8d90[_0xb42c('0x19')](_0x5e3056);}return _0xbe8d90[_0xb42c('0x1a')](_0x5e3056)[_0xb42c('0x1b')]();};}function respondWithResult(_0x271f99,_0x406b58){_0x406b58=_0x406b58||0xc8;return function(_0x19f8c3){if(_0x19f8c3){return _0x271f99['status'](_0x406b58)[_0xb42c('0x1c')](_0x19f8c3);}};}function respondWithFilteredResult(_0x4b6192,_0x1163bc){return function(_0xd48821){if(_0xd48821){var _0x348577=typeof _0x1163bc[_0xb42c('0x1d')]===_0xb42c('0x1e')&&typeof _0x1163bc[_0xb42c('0x1f')]===_0xb42c('0x1e');var _0x4b6f0f=_0xd48821['count'];var _0x5803fd=_0x348577?0x0:_0x1163bc['offset'];var _0x3e7d76=_0x348577?_0xd48821['count']:_0x1163bc['offset']+_0x1163bc['limit'];var _0x9eea65;if(_0x3e7d76>=_0x4b6f0f){_0x3e7d76=_0x4b6f0f;_0x9eea65=0xc8;}else{_0x9eea65=0xce;}_0x4b6192[_0xb42c('0x1a')](_0x9eea65);return _0x4b6192['set'](_0xb42c('0x20'),_0x5803fd+'-'+_0x3e7d76+'/'+_0x4b6f0f)[_0xb42c('0x1c')](_0xd48821);}return null;};}function patchUpdates(_0x4ce78b){return function(_0x3f868e){try{jsonpatch['apply'](_0x3f868e,_0x4ce78b,!![]);}catch(_0x11a98a){return BPromise['reject'](_0x11a98a);}return _0x3f868e[_0xb42c('0x21')]();};}function saveUpdates(_0xebdc9,_0x2f82d2){return function(_0x58baa0){if(_0x58baa0){return _0x58baa0[_0xb42c('0x22')](_0xebdc9)[_0xb42c('0x23')](function(_0x3c650e){return _0x3c650e;});}return null;};}function removeEntity(_0x5cb8c8,_0x4f2001){return function(_0x4995c3){if(_0x4995c3){return _0x4995c3[_0xb42c('0x24')]()['then'](function(){_0x5cb8c8[_0xb42c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe189dc,_0x25fff1){return function(_0x4ee333){if(!_0x4ee333){_0xe189dc[_0xb42c('0x19')](0x194);}return _0x4ee333;};}function handleError(_0x7be80d,_0x3c5f4d){_0x3c5f4d=_0x3c5f4d||0x1f4;return function(_0x463ca3){logger[_0xb42c('0x25')](_0x463ca3[_0xb42c('0x26')]);if(_0x463ca3[_0xb42c('0x27')]){delete _0x463ca3['name'];}_0x7be80d[_0xb42c('0x1a')](_0x3c5f4d)[_0xb42c('0x28')](_0x463ca3);};}exports['index']=function(_0x36895e,_0x58977c){var _0xb72394={},_0xfa4d={},_0x34b037={'count':0x0,'rows':[]};var _0x39e3c4=_[_0xb42c('0x29')](db[_0xb42c('0x2a')][_0xb42c('0x2b')],function(_0xb5556b){return{'name':_0xb5556b[_0xb42c('0x2c')],'type':_0xb5556b[_0xb42c('0x2d')][_0xb42c('0x2e')]};});_0xfa4d['model']=_[_0xb42c('0x29')](_0x39e3c4,_0xb42c('0x27'));_0xfa4d[_0xb42c('0x2f')]=_[_0xb42c('0x30')](_0x36895e[_0xb42c('0x2f')]);_0xfa4d['filters']=_[_0xb42c('0x31')](_0xfa4d[_0xb42c('0x32')],_0xfa4d['query']);_0xb72394[_0xb42c('0x33')]=_[_0xb42c('0x31')](_0xfa4d[_0xb42c('0x32')],qs['fields'](_0x36895e[_0xb42c('0x2f')]['fields']));_0xb72394[_0xb42c('0x33')]=_0xb72394[_0xb42c('0x33')][_0xb42c('0x34')]?_0xb72394[_0xb42c('0x33')]:_0xfa4d[_0xb42c('0x32')];if(!_0x36895e[_0xb42c('0x2f')][_0xb42c('0x35')](_0xb42c('0x36'))){_0xb72394['limit']=qs[_0xb42c('0x1f')](_0x36895e[_0xb42c('0x2f')][_0xb42c('0x1f')]);_0xb72394[_0xb42c('0x1d')]=qs[_0xb42c('0x1d')](_0x36895e[_0xb42c('0x2f')][_0xb42c('0x1d')]);}_0xb72394[_0xb42c('0x37')]=qs[_0xb42c('0x38')](_0x36895e['query'][_0xb42c('0x38')]);_0xb72394[_0xb42c('0x39')]=qs[_0xb42c('0x3a')](_['pick'](_0x36895e[_0xb42c('0x2f')],_0xfa4d[_0xb42c('0x3a')]),_0x39e3c4);if(_0x36895e[_0xb42c('0x2f')]['filter']){_0xb72394['where']=_[_0xb42c('0x3b')](_0xb72394[_0xb42c('0x39')],{'$or':_[_0xb42c('0x29')](_0x39e3c4,function(_0x5131d1){if(_0x5131d1['type']!==_0xb42c('0x3c')){var _0x639508={};_0x639508[_0x5131d1['name']]={'$like':'%'+_0x36895e[_0xb42c('0x2f')]['filter']+'%'};return _0x639508;}})});}_0xb72394=_[_0xb42c('0x3b')]({},_0xb72394,_0x36895e[_0xb42c('0x3d')]);var _0xb2daac={'where':_0xb72394[_0xb42c('0x39')]};return db['JscriptyQuestionReport'][_0xb42c('0x3e')](_0xb2daac)[_0xb42c('0x23')](function(_0x3ff8a6){_0x34b037[_0xb42c('0x3e')]=_0x3ff8a6;if(_0x36895e[_0xb42c('0x2f')]['includeAll']){_0xb72394['include']=[{'all':!![]}];}return db[_0xb42c('0x2a')][_0xb42c('0x3f')](_0xb72394);})[_0xb42c('0x23')](function(_0x258b7c){_0x34b037['rows']=_0x258b7c;return _0x34b037;})[_0xb42c('0x23')](respondWithFilteredResult(_0x58977c,_0xb72394))['catch'](handleError(_0x58977c,null));};exports[_0xb42c('0x40')]=function(_0x260eb9,_0x2cfdf1){var _0x91c3b2={'raw':!![],'where':{'id':_0x260eb9[_0xb42c('0x41')]['id']}},_0xe64209={};_0xe64209['model']=_[_0xb42c('0x30')](db['JscriptyQuestionReport'][_0xb42c('0x2b')]);_0xe64209[_0xb42c('0x2f')]=_[_0xb42c('0x30')](_0x260eb9[_0xb42c('0x2f')]);_0xe64209[_0xb42c('0x3a')]=_['intersection'](_0xe64209[_0xb42c('0x32')],_0xe64209['query']);_0x91c3b2[_0xb42c('0x33')]=_['intersection'](_0xe64209[_0xb42c('0x32')],qs[_0xb42c('0x42')](_0x260eb9[_0xb42c('0x2f')][_0xb42c('0x42')]));_0x91c3b2[_0xb42c('0x33')]=_0x91c3b2[_0xb42c('0x33')][_0xb42c('0x34')]?_0x91c3b2[_0xb42c('0x33')]:_0xe64209['model'];if(_0x260eb9[_0xb42c('0x2f')]['includeAll']){_0x91c3b2[_0xb42c('0x43')]=[{'all':!![]}];}_0x91c3b2=_['merge']({},_0x91c3b2,_0x260eb9['options']);return db[_0xb42c('0x2a')][_0xb42c('0x44')](_0x91c3b2)[_0xb42c('0x23')](handleEntityNotFound(_0x2cfdf1,null))[_0xb42c('0x23')](respondWithResult(_0x2cfdf1,null))[_0xb42c('0x45')](handleError(_0x2cfdf1,null));};exports['create']=function(_0x4a1651,_0x31acef){return db[_0xb42c('0x2a')][_0xb42c('0x46')](_0x4a1651[_0xb42c('0x47')],{})[_0xb42c('0x23')](respondWithResult(_0x31acef,0xc9))[_0xb42c('0x45')](handleError(_0x31acef,null));};exports[_0xb42c('0x22')]=function(_0x3926a5,_0x2ca89d){if(_0x3926a5['body']['id']){delete _0x3926a5[_0xb42c('0x47')]['id'];}return db[_0xb42c('0x2a')][_0xb42c('0x44')]({'where':{'id':_0x3926a5[_0xb42c('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ca89d,null))[_0xb42c('0x23')](saveUpdates(_0x3926a5['body'],null))[_0xb42c('0x23')](respondWithResult(_0x2ca89d,null))[_0xb42c('0x45')](handleError(_0x2ca89d,null));};exports[_0xb42c('0x24')]=function(_0x40f160,_0x583ba2){return db[_0xb42c('0x2a')][_0xb42c('0x44')]({'where':{'id':_0x40f160[_0xb42c('0x41')]['id']}})[_0xb42c('0x23')](handleEntityNotFound(_0x583ba2,null))[_0xb42c('0x23')](removeEntity(_0x583ba2,null))[_0xb42c('0x45')](handleError(_0x583ba2,null));};exports[_0xb42c('0x48')]=function(_0x4f76a7,_0x28bf6c){return db[_0xb42c('0x2a')]['describe']()['then'](respondWithResult(_0x28bf6c,null))[_0xb42c('0x45')](handleError(_0x28bf6c,null));}; \ No newline at end of file +var _0x23c2=['findAll','rows','catch','show','find','create','body','params','destroy','describe','eml-format','zip-dir','moment','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x430b95,_0x104f01){var _0x16adb4=function(_0x906d5a){while(--_0x906d5a){_0x430b95['push'](_0x430b95['shift']());}};_0x16adb4(++_0x104f01);}(_0x23c2,0x177));var _0x223c=function(_0x3e0191,_0x1d4b20){_0x3e0191=_0x3e0191-0x0;var _0xf2ae83=_0x23c2[_0x3e0191];return _0xf2ae83;};'use strict';var emlformat=require(_0x223c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x223c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x223c('0x2'));var BPromise=require(_0x223c('0x3'));var Mustache=require('mustache');var util=require(_0x223c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x223c('0x5'));var ejs=require(_0x223c('0x6'));var fs=require('fs');var fs_extra=require(_0x223c('0x7'));var _=require('lodash');var squel=require(_0x223c('0x8'));var crypto=require(_0x223c('0x9'));var jsforce=require(_0x223c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x223c('0x5'));var querystring=require(_0x223c('0xb'));var Papa=require('papaparse');var Redis=require(_0x223c('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x223c('0xd'));var as=require(_0x223c('0xe'));var hardwareService=require(_0x223c('0xf'));var logger=require('../../config/logger')(_0x223c('0x10'));var utils=require(_0x223c('0x11'));var config=require(_0x223c('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x223c('0x13'))['db'];function respondWithStatusCode(_0x309949,_0x70baab){_0x70baab=_0x70baab||0xcc;return function(_0x35d129){if(_0x35d129){return _0x309949[_0x223c('0x14')](_0x70baab);}return _0x309949['status'](_0x70baab)[_0x223c('0x15')]();};}function respondWithResult(_0x24e1a8,_0x2ec414){_0x2ec414=_0x2ec414||0xc8;return function(_0x25457d){if(_0x25457d){return _0x24e1a8[_0x223c('0x16')](_0x2ec414)['json'](_0x25457d);}};}function respondWithFilteredResult(_0x55c5a3,_0x54e2fd){return function(_0x581cc8){if(_0x581cc8){var _0x39a960=typeof _0x54e2fd[_0x223c('0x17')]==='undefined'&&typeof _0x54e2fd[_0x223c('0x18')]==='undefined';var _0x1128c9=_0x581cc8[_0x223c('0x19')];var _0x3ecba9=_0x39a960?0x0:_0x54e2fd[_0x223c('0x17')];var _0x579bea=_0x39a960?_0x581cc8[_0x223c('0x19')]:_0x54e2fd[_0x223c('0x17')]+_0x54e2fd[_0x223c('0x18')];var _0x3f43f8;if(_0x579bea>=_0x1128c9){_0x579bea=_0x1128c9;_0x3f43f8=0xc8;}else{_0x3f43f8=0xce;}_0x55c5a3[_0x223c('0x16')](_0x3f43f8);return _0x55c5a3[_0x223c('0x1a')](_0x223c('0x1b'),_0x3ecba9+'-'+_0x579bea+'/'+_0x1128c9)[_0x223c('0x1c')](_0x581cc8);}return null;};}function patchUpdates(_0x59b7e5){return function(_0x3cfc71){try{jsonpatch[_0x223c('0x1d')](_0x3cfc71,_0x59b7e5,!![]);}catch(_0x1a703b){return BPromise[_0x223c('0x1e')](_0x1a703b);}return _0x3cfc71[_0x223c('0x1f')]();};}function saveUpdates(_0x9a217b,_0x3fe74d){return function(_0x274a6b){if(_0x274a6b){return _0x274a6b[_0x223c('0x20')](_0x9a217b)[_0x223c('0x21')](function(_0x32fcc1){return _0x32fcc1;});}return null;};}function removeEntity(_0x2dd6ac,_0x845bf9){return function(_0x1fd25a){if(_0x1fd25a){return _0x1fd25a['destroy']()[_0x223c('0x21')](function(){_0x2dd6ac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a866a,_0x297270){return function(_0x5950d4){if(!_0x5950d4){_0x1a866a['sendStatus'](0x194);}return _0x5950d4;};}function handleError(_0x3399b1,_0x32aa06){_0x32aa06=_0x32aa06||0x1f4;return function(_0x5a8c38){logger[_0x223c('0x22')](_0x5a8c38[_0x223c('0x23')]);if(_0x5a8c38[_0x223c('0x24')]){delete _0x5a8c38['name'];}_0x3399b1[_0x223c('0x16')](_0x32aa06)[_0x223c('0x25')](_0x5a8c38);};}exports[_0x223c('0x26')]=function(_0x5c9e14,_0x1c9491){var _0x828efc={},_0x4e5435={},_0x397b53={'count':0x0,'rows':[]};var _0x5a7cf2=_[_0x223c('0x27')](db[_0x223c('0x28')][_0x223c('0x29')],function(_0x44fb8f){return{'name':_0x44fb8f[_0x223c('0x2a')],'type':_0x44fb8f[_0x223c('0x2b')]['key']};});_0x4e5435[_0x223c('0x2c')]=_[_0x223c('0x27')](_0x5a7cf2,_0x223c('0x24'));_0x4e5435['query']=_[_0x223c('0x2d')](_0x5c9e14[_0x223c('0x2e')]);_0x4e5435[_0x223c('0x2f')]=_['intersection'](_0x4e5435[_0x223c('0x2c')],_0x4e5435[_0x223c('0x2e')]);_0x828efc[_0x223c('0x30')]=_[_0x223c('0x31')](_0x4e5435['model'],qs['fields'](_0x5c9e14[_0x223c('0x2e')][_0x223c('0x32')]));_0x828efc[_0x223c('0x30')]=_0x828efc[_0x223c('0x30')][_0x223c('0x33')]?_0x828efc[_0x223c('0x30')]:_0x4e5435['model'];if(!_0x5c9e14['query'][_0x223c('0x34')]('nolimit')){_0x828efc['limit']=qs[_0x223c('0x18')](_0x5c9e14[_0x223c('0x2e')][_0x223c('0x18')]);_0x828efc['offset']=qs[_0x223c('0x17')](_0x5c9e14[_0x223c('0x2e')][_0x223c('0x17')]);}_0x828efc[_0x223c('0x35')]=qs[_0x223c('0x36')](_0x5c9e14[_0x223c('0x2e')][_0x223c('0x36')]);_0x828efc[_0x223c('0x37')]=qs[_0x223c('0x2f')](_[_0x223c('0x38')](_0x5c9e14[_0x223c('0x2e')],_0x4e5435[_0x223c('0x2f')]),_0x5a7cf2);if(_0x5c9e14[_0x223c('0x2e')][_0x223c('0x39')]){_0x828efc[_0x223c('0x37')]=_[_0x223c('0x3a')](_0x828efc['where'],{'$or':_[_0x223c('0x27')](_0x5a7cf2,function(_0x147ac8){if(_0x147ac8[_0x223c('0x2b')]!==_0x223c('0x3b')){var _0x5b75eb={};_0x5b75eb[_0x147ac8['name']]={'$like':'%'+_0x5c9e14[_0x223c('0x2e')][_0x223c('0x39')]+'%'};return _0x5b75eb;}})});}_0x828efc=_[_0x223c('0x3a')]({},_0x828efc,_0x5c9e14[_0x223c('0x3c')]);var _0xb15f22={'where':_0x828efc[_0x223c('0x37')]};return db[_0x223c('0x28')][_0x223c('0x19')](_0xb15f22)[_0x223c('0x21')](function(_0x45877f){_0x397b53['count']=_0x45877f;if(_0x5c9e14[_0x223c('0x2e')][_0x223c('0x3d')]){_0x828efc[_0x223c('0x3e')]=[{'all':!![]}];}return db[_0x223c('0x28')][_0x223c('0x3f')](_0x828efc);})[_0x223c('0x21')](function(_0x1b039d){_0x397b53[_0x223c('0x40')]=_0x1b039d;return _0x397b53;})['then'](respondWithFilteredResult(_0x1c9491,_0x828efc))[_0x223c('0x41')](handleError(_0x1c9491,null));};exports[_0x223c('0x42')]=function(_0x47707a,_0x24e4dd){var _0x320c81={'raw':!![],'where':{'id':_0x47707a['params']['id']}},_0x19692a={};_0x19692a['model']=_[_0x223c('0x2d')](db['JscriptyQuestionReport'][_0x223c('0x29')]);_0x19692a[_0x223c('0x2e')]=_[_0x223c('0x2d')](_0x47707a[_0x223c('0x2e')]);_0x19692a[_0x223c('0x2f')]=_[_0x223c('0x31')](_0x19692a['model'],_0x19692a['query']);_0x320c81[_0x223c('0x30')]=_['intersection'](_0x19692a[_0x223c('0x2c')],qs['fields'](_0x47707a[_0x223c('0x2e')][_0x223c('0x32')]));_0x320c81[_0x223c('0x30')]=_0x320c81[_0x223c('0x30')][_0x223c('0x33')]?_0x320c81[_0x223c('0x30')]:_0x19692a[_0x223c('0x2c')];if(_0x47707a[_0x223c('0x2e')][_0x223c('0x3d')]){_0x320c81[_0x223c('0x3e')]=[{'all':!![]}];}_0x320c81=_[_0x223c('0x3a')]({},_0x320c81,_0x47707a['options']);return db['JscriptyQuestionReport'][_0x223c('0x43')](_0x320c81)[_0x223c('0x21')](handleEntityNotFound(_0x24e4dd,null))['then'](respondWithResult(_0x24e4dd,null))[_0x223c('0x41')](handleError(_0x24e4dd,null));};exports[_0x223c('0x44')]=function(_0x555ff5,_0x849e0d){return db[_0x223c('0x28')][_0x223c('0x44')](_0x555ff5['body'],{})[_0x223c('0x21')](respondWithResult(_0x849e0d,0xc9))[_0x223c('0x41')](handleError(_0x849e0d,null));};exports[_0x223c('0x20')]=function(_0x1b5945,_0x1a6d84){if(_0x1b5945[_0x223c('0x45')]['id']){delete _0x1b5945['body']['id'];}return db[_0x223c('0x28')][_0x223c('0x43')]({'where':{'id':_0x1b5945[_0x223c('0x46')]['id']}})[_0x223c('0x21')](handleEntityNotFound(_0x1a6d84,null))['then'](saveUpdates(_0x1b5945[_0x223c('0x45')],null))[_0x223c('0x21')](respondWithResult(_0x1a6d84,null))[_0x223c('0x41')](handleError(_0x1a6d84,null));};exports[_0x223c('0x47')]=function(_0x1262f9,_0x3fcc81){return db[_0x223c('0x28')][_0x223c('0x43')]({'where':{'id':_0x1262f9['params']['id']}})[_0x223c('0x21')](handleEntityNotFound(_0x3fcc81,null))['then'](removeEntity(_0x3fcc81,null))[_0x223c('0x41')](handleError(_0x3fcc81,null));};exports[_0x223c('0x48')]=function(_0x90e476,_0x2d0d0a){return db[_0x223c('0x28')][_0x223c('0x48')]()[_0x223c('0x21')](respondWithResult(_0x2d0d0a,null))['catch'](handleError(_0x2d0d0a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 8b3f9cb..f04a190 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 _0x808b=['moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x808b,0x135));var _0xb808=function(_0x130149,_0x535e7e){_0x130149=_0x130149-0x0;var _0x2afdb3=_0x808b[_0x130149];return _0x2afdb3;};'use strict';var _=require('lodash');var util=require(_0xb808('0x0'));var logger=require(_0xb808('0x1'))(_0xb808('0x2'));var moment=require(_0xb808('0x3'));var BPromise=require(_0xb808('0x4'));var rp=require(_0xb808('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb808('0x6'));var config=require(_0xb808('0x7'));var attributes=require(_0xb808('0x8'));module['exports']=function(_0x2e3f45,_0x2f84a4){return _0x2e3f45[_0xb808('0x9')](_0xb808('0xa'),attributes,{'tableName':_0xb808('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c8e=['report_jscripty_questions','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c8e,0x17d));var _0xe4c8=function(_0x262baa,_0x283058){_0x262baa=_0x262baa-0x0;var _0x4f2257=_0x4c8e[_0x262baa];return _0x4f2257;};'use strict';var _=require(_0xe4c8('0x0'));var util=require(_0xe4c8('0x1'));var logger=require(_0xe4c8('0x2'))(_0xe4c8('0x3'));var moment=require('moment');var BPromise=require(_0xe4c8('0x4'));var rp=require(_0xe4c8('0x5'));var fs=require('fs');var path=require(_0xe4c8('0x6'));var rimraf=require('rimraf');var config=require(_0xe4c8('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xe4c8('0x8')]=function(_0x15eb21,_0x4ec27c){return _0x15eb21['define']('JscriptyQuestionReport',attributes,{'tableName':_0xe4c8('0x9'),'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 2dcbc55..ffa019c 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 _0x5df2=['http','request','then','info','request\x20sent','debug','stringify','error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x5df2,0x19b));var _0x25df=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x5df2[_0x1deb03];return _0x189fe7;};'use strict';var _=require('lodash');var util=require(_0x25df('0x0'));var moment=require(_0x25df('0x1'));var BPromise=require('bluebird');var rs=require(_0x25df('0x2'));var fs=require('fs');var Redis=require(_0x25df('0x3'));var db=require(_0x25df('0x4'))['db'];var utils=require(_0x25df('0x5'));var logger=require(_0x25df('0x6'))(_0x25df('0x7'));var config=require(_0x25df('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x25df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b5453,_0x217511,_0x7edfc4){return new BPromise(function(_0x42384a,_0x363027){return client[_0x25df('0xa')](_0x1b5453,_0x7edfc4)[_0x25df('0xb')](function(_0x4aee4f){logger[_0x25df('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x217511,_0x25df('0xd'));logger[_0x25df('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x217511,_0x25df('0xd'),JSON[_0x25df('0xf')](_0x4aee4f));if(_0x4aee4f[_0x25df('0x10')]){if(_0x4aee4f[_0x25df('0x10')][_0x25df('0x11')]===0x1f4){logger[_0x25df('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x217511,_0x4aee4f[_0x25df('0x10')][_0x25df('0x12')]);return _0x363027(_0x4aee4f['error']['message']);}logger[_0x25df('0x10')](_0x25df('0x13'),_0x217511,_0x4aee4f[_0x25df('0x10')][_0x25df('0x12')]);return _0x42384a(_0x4aee4f[_0x25df('0x10')][_0x25df('0x12')]);}else{logger['info'](_0x25df('0x13'),_0x217511,_0x25df('0xd'));_0x42384a(_0x4aee4f[_0x25df('0x14')][_0x25df('0x12')]);}})['catch'](function(_0x56f3cc){logger[_0x25df('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x217511,_0x56f3cc);_0x363027(_0x56f3cc);});});} \ No newline at end of file +var _0x9eca=['info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2d661e,_0x4bfe70){var _0x4c1d7e=function(_0x550322){while(--_0x550322){_0x2d661e['push'](_0x2d661e['shift']());}};_0x4c1d7e(++_0x4bfe70);}(_0x9eca,0x66));var _0xa9ec=function(_0x5d1f9a,_0x3c75fd){_0x5d1f9a=_0x5d1f9a-0x0;var _0x864ff7=_0x9eca[_0x5d1f9a];return _0x864ff7;};'use strict';var _=require(_0xa9ec('0x0'));var util=require('util');var moment=require(_0xa9ec('0x1'));var BPromise=require(_0xa9ec('0x2'));var rs=require(_0xa9ec('0x3'));var fs=require('fs');var Redis=require(_0xa9ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9ec('0x5'));var logger=require(_0xa9ec('0x6'))(_0xa9ec('0x7'));var config=require(_0xa9ec('0x8'));var jayson=require(_0xa9ec('0x9'));var client=jayson['client'][_0xa9ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18a2a8,_0x49a32c,_0x507f9e){return new BPromise(function(_0x4499d9,_0x275576){return client[_0xa9ec('0xb')](_0x18a2a8,_0x507f9e)[_0xa9ec('0xc')](function(_0x3fe28c){logger[_0xa9ec('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x49a32c,_0xa9ec('0xe'));logger[_0xa9ec('0xf')](_0xa9ec('0x10'),_0x49a32c,_0xa9ec('0xe'),JSON[_0xa9ec('0x11')](_0x3fe28c));if(_0x3fe28c[_0xa9ec('0x12')]){if(_0x3fe28c[_0xa9ec('0x12')][_0xa9ec('0x13')]===0x1f4){logger['error'](_0xa9ec('0x14'),_0x49a32c,_0x3fe28c[_0xa9ec('0x12')][_0xa9ec('0x15')]);return _0x275576(_0x3fe28c['error'][_0xa9ec('0x15')]);}logger['error'](_0xa9ec('0x14'),_0x49a32c,_0x3fe28c[_0xa9ec('0x12')]['message']);return _0x4499d9(_0x3fe28c[_0xa9ec('0x12')][_0xa9ec('0x15')]);}else{logger[_0xa9ec('0xd')](_0xa9ec('0x14'),_0x49a32c,'request\x20sent');_0x4499d9(_0x3fe28c['result']['message']);}})[_0xa9ec('0x16')](function(_0x2a947b){logger[_0xa9ec('0x12')](_0xa9ec('0x14'),_0x49a32c,_0x2a947b);_0x275576(_0x2a947b);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index f356433..4eca33c 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 _0x3552=['../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','/:id/questions','getQuestions','post','create','put','destroy','multer','path','connect-timeout','express','Router'];(function(_0x494d7a,_0xbda44a){var _0x51fca3=function(_0x117ed8){while(--_0x117ed8){_0x494d7a['push'](_0x494d7a['shift']());}};_0x51fca3(++_0xbda44a);}(_0x3552,0x171));var _0x2355=function(_0x2b6be9,_0x5cc118){_0x2b6be9=_0x2b6be9-0x0;var _0x3a847a=_0x3552[_0x2b6be9];return _0x3a847a;};'use strict';var multer=require(_0x2355('0x0'));var util=require('util');var path=require(_0x2355('0x1'));var timeout=require(_0x2355('0x2'));var express=require(_0x2355('0x3'));var router=express[_0x2355('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2355('0x5'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x2355('0x6')](),controller[_0x2355('0x7')]);router[_0x2355('0x8')](_0x2355('0x9'),auth[_0x2355('0x6')](),controller['describe']);router['get'](_0x2355('0xa'),auth[_0x2355('0x6')](),controller['show']);router[_0x2355('0x8')](_0x2355('0xb'),auth[_0x2355('0x6')](),controller[_0x2355('0xc')]);router[_0x2355('0xd')]('/',auth[_0x2355('0x6')](),controller[_0x2355('0xe')]);router[_0x2355('0xf')](_0x2355('0xa'),auth[_0x2355('0x6')](),controller['update']);router['delete']('/:id',auth[_0x2355('0x6')](),controller[_0x2355('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0b1a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','show','/:id/questions','getQuestions','post','put','/:id','delete','destroy','exports','multer','util','connect-timeout'];(function(_0xcb285b,_0xd0c94a){var _0xf4af46=function(_0x187add){while(--_0x187add){_0xcb285b['push'](_0xcb285b['shift']());}};_0xf4af46(++_0xd0c94a);}(_0x0b1a,0xfa));var _0xa0b1=function(_0x2ee94f,_0x2066e9){_0x2ee94f=_0x2ee94f-0x0;var _0x5845db=_0x0b1a[_0x2ee94f];return _0x5845db;};'use strict';var multer=require(_0xa0b1('0x0'));var util=require(_0xa0b1('0x1'));var path=require('path');var timeout=require(_0xa0b1('0x2'));var express=require(_0xa0b1('0x3'));var router=express[_0xa0b1('0x4')]();var fs_extra=require(_0xa0b1('0x5'));var auth=require(_0xa0b1('0x6'));var interaction=require(_0xa0b1('0x7'));var config=require(_0xa0b1('0x8'));var controller=require(_0xa0b1('0x9'));router[_0xa0b1('0xa')]('/',auth[_0xa0b1('0xb')](),controller[_0xa0b1('0xc')]);router[_0xa0b1('0xa')]('/describe',auth[_0xa0b1('0xb')](),controller[_0xa0b1('0xd')]);router['get']('/:id',auth[_0xa0b1('0xb')](),controller[_0xa0b1('0xe')]);router[_0xa0b1('0xa')](_0xa0b1('0xf'),auth[_0xa0b1('0xb')](),controller[_0xa0b1('0x10')]);router[_0xa0b1('0x11')]('/',auth[_0xa0b1('0xb')](),controller['create']);router[_0xa0b1('0x12')](_0xa0b1('0x13'),auth[_0xa0b1('0xb')](),controller['update']);router[_0xa0b1('0x14')](_0xa0b1('0x13'),auth[_0xa0b1('0xb')](),controller[_0xa0b1('0x15')]);module[_0xa0b1('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 31eddf5..462ea61 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 _0x6aa4=['setDataValue','endtime','format','STRING','BOOLEAN','sequelize','DATE','starttime'];(function(_0x55255e,_0x490aad){var _0x1a1622=function(_0x5cbf77){while(--_0x5cbf77){_0x55255e['push'](_0x55255e['shift']());}};_0x1a1622(++_0x490aad);}(_0x6aa4,0x15d));var _0x46aa=function(_0x1050e3,_0x39b6c0){_0x1050e3=_0x1050e3-0x0;var _0x2064d7=_0x6aa4[_0x1050e3];return _0x2064d7;};'use strict';var moment=require('moment');var Sequelize=require(_0x46aa('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x46aa('0x1')],'set':function(_0x591fec){this['setDataValue'](_0x46aa('0x2'),_0x591fec);this[_0x46aa('0x3')](_0x46aa('0x4'),moment()[_0x46aa('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x46aa('0x1')]},'membername':{'type':Sequelize[_0x46aa('0x6')]},'projectname':{'type':Sequelize[_0x46aa('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x46aa('0x6')]},'calleridname':{'type':Sequelize[_0x46aa('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x46aa('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xfa63=['DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xfa63,0xf0));var _0x3fa6=function(_0x59f355,_0x488cc0){_0x59f355=_0x59f355-0x0;var _0x15498f=_0xfa63[_0x59f355];return _0x15498f;};'use strict';var moment=require(_0x3fa6('0x0'));var Sequelize=require(_0x3fa6('0x1'));module[_0x3fa6('0x2')]={'starttime':{'type':Sequelize[_0x3fa6('0x3')],'set':function(_0x59acc5){this[_0x3fa6('0x4')]('starttime',_0x59acc5);this['setDataValue'](_0x3fa6('0x5'),moment()['format'](_0x3fa6('0x6')));}},'endtime':{'type':Sequelize[_0x3fa6('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x3fa6('0x7')]},'queue':{'type':Sequelize[_0x3fa6('0x7')]},'uniqueid':{'type':Sequelize[_0x3fa6('0x7')]},'calleridname':{'type':Sequelize[_0x3fa6('0x7')]},'calleridnum':{'type':Sequelize[_0x3fa6('0x7')]},'completed':{'type':Sequelize[_0x3fa6('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 2ee0f3e..24c8bfb 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 _0xb19f=['params','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show'];(function(_0x5c06c2,_0x488c06){var _0x3ff502=function(_0x230697){while(--_0x230697){_0x5c06c2['push'](_0x5c06c2['shift']());}};_0x3ff502(++_0x488c06);}(_0xb19f,0xa9));var _0xfb19=function(_0x34bb68,_0x5b0079){_0x34bb68=_0x34bb68-0x0;var _0x3db9fb=_0xb19f[_0x34bb68];return _0x3db9fb;};'use strict';var emlformat=require(_0xfb19('0x0'));var rimraf=require(_0xfb19('0x1'));var zipdir=require(_0xfb19('0x2'));var jsonpatch=require(_0xfb19('0x3'));var rp=require(_0xfb19('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfb19('0x5'));var util=require(_0xfb19('0x6'));var path=require(_0xfb19('0x7'));var sox=require('sox');var csv=require(_0xfb19('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb19('0x9'));var squel=require(_0xfb19('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfb19('0xb'));var toCsv=require(_0xfb19('0x8'));var querystring=require(_0xfb19('0xc'));var Papa=require('papaparse');var Redis=require(_0xfb19('0xd'));var authService=require(_0xfb19('0xe'));var qs=require(_0xfb19('0xf'));var as=require(_0xfb19('0x10'));var hardwareService=require(_0xfb19('0x11'));var logger=require(_0xfb19('0x12'))(_0xfb19('0x13'));var utils=require(_0xfb19('0x14'));var config=require(_0xfb19('0x15'));var licenseUtil=require(_0xfb19('0x16'));var db=require(_0xfb19('0x17'))['db'];function respondWithStatusCode(_0x225132,_0x1ebd53){_0x1ebd53=_0x1ebd53||0xcc;return function(_0x36ceb8){if(_0x36ceb8){return _0x225132['sendStatus'](_0x1ebd53);}return _0x225132[_0xfb19('0x18')](_0x1ebd53)[_0xfb19('0x19')]();};}function respondWithResult(_0x410c3e,_0x2bcde6){_0x2bcde6=_0x2bcde6||0xc8;return function(_0x50901d){if(_0x50901d){return _0x410c3e['status'](_0x2bcde6)[_0xfb19('0x1a')](_0x50901d);}};}function respondWithFilteredResult(_0x861e17,_0x1e45ea){return function(_0x58402c){if(_0x58402c){var _0x26112f=typeof _0x1e45ea[_0xfb19('0x1b')]==='undefined'&&typeof _0x1e45ea[_0xfb19('0x1c')]===_0xfb19('0x1d');var _0x11c0c8=_0x58402c['count'];var _0x4cecc8=_0x26112f?0x0:_0x1e45ea[_0xfb19('0x1b')];var _0x37da12=_0x26112f?_0x58402c[_0xfb19('0x1e')]:_0x1e45ea[_0xfb19('0x1b')]+_0x1e45ea[_0xfb19('0x1c')];var _0x2e16fb;if(_0x37da12>=_0x11c0c8){_0x37da12=_0x11c0c8;_0x2e16fb=0xc8;}else{_0x2e16fb=0xce;}_0x861e17[_0xfb19('0x18')](_0x2e16fb);return _0x861e17[_0xfb19('0x1f')](_0xfb19('0x20'),_0x4cecc8+'-'+_0x37da12+'/'+_0x11c0c8)[_0xfb19('0x1a')](_0x58402c);}return null;};}function patchUpdates(_0x5d078e){return function(_0x5a2634){try{jsonpatch['apply'](_0x5a2634,_0x5d078e,!![]);}catch(_0x25b66c){return BPromise[_0xfb19('0x21')](_0x25b66c);}return _0x5a2634[_0xfb19('0x22')]();};}function saveUpdates(_0x2e8165,_0x4d866e){return function(_0x42387b){if(_0x42387b){return _0x42387b[_0xfb19('0x23')](_0x2e8165)[_0xfb19('0x24')](function(_0x2fdf17){return _0x2fdf17;});}return null;};}function removeEntity(_0x1f2f64,_0x16e9d4){return function(_0x5eabfb){if(_0x5eabfb){return _0x5eabfb[_0xfb19('0x25')]()[_0xfb19('0x24')](function(){_0x1f2f64['status'](0xcc)[_0xfb19('0x19')]();});}};}function handleEntityNotFound(_0xe93278,_0x5bb3e4){return function(_0x184047){if(!_0x184047){_0xe93278[_0xfb19('0x26')](0x194);}return _0x184047;};}function handleError(_0x47061d,_0x5ba4dc){_0x5ba4dc=_0x5ba4dc||0x1f4;return function(_0x44b92d){logger['error'](_0x44b92d[_0xfb19('0x27')]);if(_0x44b92d['name']){delete _0x44b92d[_0xfb19('0x28')];}_0x47061d[_0xfb19('0x18')](_0x5ba4dc)[_0xfb19('0x29')](_0x44b92d);};}exports[_0xfb19('0x2a')]=function(_0x3f3e6d,_0x4f9dad){var _0x38c92c={},_0x2d0edb={},_0x48b206={'count':0x0,'rows':[]};var _0x2dd7c7=_[_0xfb19('0x2b')](db[_0xfb19('0x2c')][_0xfb19('0x2d')],function(_0x209ef3){return{'name':_0x209ef3[_0xfb19('0x2e')],'type':_0x209ef3[_0xfb19('0x2f')]['key']};});_0x2d0edb[_0xfb19('0x30')]=_[_0xfb19('0x2b')](_0x2dd7c7,_0xfb19('0x28'));_0x2d0edb[_0xfb19('0x31')]=_[_0xfb19('0x32')](_0x3f3e6d[_0xfb19('0x31')]);_0x2d0edb[_0xfb19('0x33')]=_[_0xfb19('0x34')](_0x2d0edb[_0xfb19('0x30')],_0x2d0edb[_0xfb19('0x31')]);_0x38c92c[_0xfb19('0x35')]=_[_0xfb19('0x34')](_0x2d0edb['model'],qs['fields'](_0x3f3e6d[_0xfb19('0x31')][_0xfb19('0x36')]));_0x38c92c['attributes']=_0x38c92c[_0xfb19('0x35')][_0xfb19('0x37')]?_0x38c92c[_0xfb19('0x35')]:_0x2d0edb[_0xfb19('0x30')];if(!_0x3f3e6d[_0xfb19('0x31')]['hasOwnProperty'](_0xfb19('0x38'))){_0x38c92c[_0xfb19('0x1c')]=qs[_0xfb19('0x1c')](_0x3f3e6d[_0xfb19('0x31')][_0xfb19('0x1c')]);_0x38c92c[_0xfb19('0x1b')]=qs[_0xfb19('0x1b')](_0x3f3e6d[_0xfb19('0x31')][_0xfb19('0x1b')]);}_0x38c92c[_0xfb19('0x39')]=qs[_0xfb19('0x3a')](_0x3f3e6d['query'][_0xfb19('0x3a')]);_0x38c92c[_0xfb19('0x3b')]=qs[_0xfb19('0x33')](_[_0xfb19('0x3c')](_0x3f3e6d['query'],_0x2d0edb[_0xfb19('0x33')]),_0x2dd7c7);if(_0x3f3e6d[_0xfb19('0x31')]['filter']){_0x38c92c[_0xfb19('0x3b')]=_[_0xfb19('0x3d')](_0x38c92c['where'],{'$or':_['map'](_0x2dd7c7,function(_0x3e4957){if(_0x3e4957[_0xfb19('0x2f')]!==_0xfb19('0x3e')){var _0x7c5e81={};_0x7c5e81[_0x3e4957[_0xfb19('0x28')]]={'$like':'%'+_0x3f3e6d[_0xfb19('0x31')][_0xfb19('0x3f')]+'%'};return _0x7c5e81;}})});}_0x38c92c=_['merge']({},_0x38c92c,_0x3f3e6d[_0xfb19('0x40')]);var _0x2f8158={'where':_0x38c92c[_0xfb19('0x3b')]};return db[_0xfb19('0x2c')]['count'](_0x2f8158)['then'](function(_0x3d44a0){_0x48b206[_0xfb19('0x1e')]=_0x3d44a0;if(_0x3f3e6d[_0xfb19('0x31')][_0xfb19('0x41')]){_0x38c92c[_0xfb19('0x42')]=[{'all':!![]}];}return db[_0xfb19('0x2c')][_0xfb19('0x43')](_0x38c92c);})[_0xfb19('0x24')](function(_0x25e4b1){_0x48b206[_0xfb19('0x44')]=_0x25e4b1;return _0x48b206;})['then'](respondWithFilteredResult(_0x4f9dad,_0x38c92c))[_0xfb19('0x45')](handleError(_0x4f9dad,null));};exports[_0xfb19('0x46')]=function(_0x1e19b1,_0x5aa6a2){var _0x1d1ab5={'raw':!![],'where':{'id':_0x1e19b1[_0xfb19('0x47')]['id']}},_0xc583c2={};_0xc583c2[_0xfb19('0x30')]=_[_0xfb19('0x32')](db[_0xfb19('0x2c')][_0xfb19('0x2d')]);_0xc583c2['query']=_[_0xfb19('0x32')](_0x1e19b1[_0xfb19('0x31')]);_0xc583c2[_0xfb19('0x33')]=_[_0xfb19('0x34')](_0xc583c2['model'],_0xc583c2['query']);_0x1d1ab5['attributes']=_['intersection'](_0xc583c2[_0xfb19('0x30')],qs[_0xfb19('0x36')](_0x1e19b1[_0xfb19('0x31')][_0xfb19('0x36')]));_0x1d1ab5[_0xfb19('0x35')]=_0x1d1ab5[_0xfb19('0x35')][_0xfb19('0x37')]?_0x1d1ab5[_0xfb19('0x35')]:_0xc583c2[_0xfb19('0x30')];if(_0x1e19b1[_0xfb19('0x31')][_0xfb19('0x41')]){_0x1d1ab5['include']=[{'all':!![]}];}_0x1d1ab5=_[_0xfb19('0x3d')]({},_0x1d1ab5,_0x1e19b1['options']);return db[_0xfb19('0x2c')]['find'](_0x1d1ab5)[_0xfb19('0x24')](handleEntityNotFound(_0x5aa6a2,null))[_0xfb19('0x24')](respondWithResult(_0x5aa6a2,null))['catch'](handleError(_0x5aa6a2,null));};exports[_0xfb19('0x48')]=function(_0x5872cd,_0x14eade){return db[_0xfb19('0x2c')]['create'](_0x5872cd[_0xfb19('0x49')],{})[_0xfb19('0x24')](respondWithResult(_0x14eade,0xc9))['catch'](handleError(_0x14eade,null));};exports[_0xfb19('0x23')]=function(_0x5a6e56,_0x35927f){if(_0x5a6e56[_0xfb19('0x49')]['id']){delete _0x5a6e56[_0xfb19('0x49')]['id'];}return db[_0xfb19('0x2c')][_0xfb19('0x4a')]({'where':{'id':_0x5a6e56['params']['id']}})[_0xfb19('0x24')](handleEntityNotFound(_0x35927f,null))[_0xfb19('0x24')](saveUpdates(_0x5a6e56['body'],null))[_0xfb19('0x24')](respondWithResult(_0x35927f,null))[_0xfb19('0x45')](handleError(_0x35927f,null));};exports[_0xfb19('0x25')]=function(_0x3ff601,_0xfd60a7){return db[_0xfb19('0x2c')][_0xfb19('0x4a')]({'where':{'id':_0x3ff601[_0xfb19('0x47')]['id']}})['then'](handleEntityNotFound(_0xfd60a7,null))[_0xfb19('0x24')](removeEntity(_0xfd60a7,null))[_0xfb19('0x45')](handleError(_0xfd60a7,null));};exports[_0xfb19('0x4b')]=function(_0x546e6b,_0x4b42c6){return db[_0xfb19('0x2c')][_0xfb19('0x4b')]()[_0xfb19('0x24')](respondWithResult(_0x4b42c6,null))[_0xfb19('0x45')](handleError(_0x4b42c6,null));};exports[_0xfb19('0x4c')]=function(_0x406c74,_0x830f7d,_0x291eac){var _0x13093={'raw':!![],'where':{}};var _0x1be8ac={};var _0x427708={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xfb19('0x4d')]({'where':{'id':_0x406c74['params']['id']}})[_0xfb19('0x24')](handleEntityNotFound(_0x830f7d,null))[_0xfb19('0x24')](function(_0x2a61cc){if(_0x2a61cc){_0x1be8ac[_0xfb19('0x30')]=_[_0xfb19('0x32')](db[_0xfb19('0x4e')]['rawAttributes']);_0x1be8ac[_0xfb19('0x31')]=_[_0xfb19('0x32')](_0x406c74[_0xfb19('0x31')]);_0x1be8ac[_0xfb19('0x33')]=_[_0xfb19('0x34')](_0x1be8ac[_0xfb19('0x30')],_0x1be8ac[_0xfb19('0x31')]);_0x13093[_0xfb19('0x35')]=_['intersection'](_0x1be8ac['model'],qs['fields'](_0x406c74[_0xfb19('0x31')][_0xfb19('0x36')]));_0x13093[_0xfb19('0x35')]=_0x13093[_0xfb19('0x35')][_0xfb19('0x37')]?_0x13093[_0xfb19('0x35')]:_0x1be8ac[_0xfb19('0x30')];if(!_0x406c74[_0xfb19('0x31')]['hasOwnProperty']('nolimit')){_0x13093[_0xfb19('0x1c')]=qs[_0xfb19('0x1c')](_0x406c74[_0xfb19('0x31')][_0xfb19('0x1c')]);_0x13093[_0xfb19('0x1b')]=qs[_0xfb19('0x1b')](_0x406c74[_0xfb19('0x31')][_0xfb19('0x1b')]);}_0x13093[_0xfb19('0x39')]=qs['sort'](_0x406c74[_0xfb19('0x31')][_0xfb19('0x3a')]);_0x13093[_0xfb19('0x3b')]=qs[_0xfb19('0x33')](_[_0xfb19('0x3c')](_0x406c74[_0xfb19('0x31')],_0x1be8ac[_0xfb19('0x33')]));_0x13093['where'][_0xfb19('0x4f')]=_0x2a61cc['id'];if(_0x406c74[_0xfb19('0x31')][_0xfb19('0x3f')]){_0x13093[_0xfb19('0x3b')]=_['merge'](_0x13093['where'],{'$or':_[_0xfb19('0x2b')](_0x13093[_0xfb19('0x35')],function(_0x12d412){var _0x1a795f={};_0x1a795f[_0x12d412]={'$like':'%'+_0x406c74['query'][_0xfb19('0x3f')]+'%'};return _0x1a795f;})});}_0x13093=_[_0xfb19('0x3d')]({},_0x13093,_0x406c74['options']);return db[_0xfb19('0x4e')]['count']({'where':_0x13093['where']})[_0xfb19('0x24')](function(_0xe2cec3){_0x427708[_0xfb19('0x1e')]=_0xe2cec3;if(_0x406c74[_0xfb19('0x31')][_0xfb19('0x41')]){_0x13093['include']=[{'all':!![]}];}return db[_0xfb19('0x4e')][_0xfb19('0x43')](_0x13093);})[_0xfb19('0x24')](function(_0x17d5af){_0x427708['rows']=_0x17d5af;return _0x427708;});}})[_0xfb19('0x24')](respondWithFilteredResult(_0x830f7d,_0x13093))[_0xfb19('0x45')](handleError(_0x830f7d,null));}; \ No newline at end of file +var _0xf47c=['util','path','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','map','JscriptySessionReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','options','count','include','findAll','rows','catch','show','params','create','body','update','find','describe','getQuestions','JscriptyQuestionReport','hasOwnProperty','SessionId','includeAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0xf47c,0x176));var _0xcf47=function(_0x40df80,_0x19d0a6){_0x40df80=_0x40df80-0x0;var _0x5e14e0=_0xf47c[_0x40df80];return _0x5e14e0;};'use strict';var emlformat=require(_0xcf47('0x0'));var rimraf=require(_0xcf47('0x1'));var zipdir=require(_0xcf47('0x2'));var jsonpatch=require(_0xcf47('0x3'));var rp=require(_0xcf47('0x4'));var moment=require('moment');var BPromise=require(_0xcf47('0x5'));var Mustache=require('mustache');var util=require(_0xcf47('0x6'));var path=require(_0xcf47('0x7'));var sox=require(_0xcf47('0x8'));var csv=require(_0xcf47('0x9'));var ejs=require(_0xcf47('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf47('0xb'));var squel=require('squel');var crypto=require(_0xcf47('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcf47('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcf47('0xe'));var authService=require(_0xcf47('0xf'));var qs=require(_0xcf47('0x10'));var as=require(_0xcf47('0x11'));var hardwareService=require(_0xcf47('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xcf47('0x13'));var licenseUtil=require(_0xcf47('0x14'));var db=require(_0xcf47('0x15'))['db'];function respondWithStatusCode(_0x3e04a2,_0x20e9a0){_0x20e9a0=_0x20e9a0||0xcc;return function(_0x56616e){if(_0x56616e){return _0x3e04a2[_0xcf47('0x16')](_0x20e9a0);}return _0x3e04a2[_0xcf47('0x17')](_0x20e9a0)[_0xcf47('0x18')]();};}function respondWithResult(_0x55792b,_0x758baf){_0x758baf=_0x758baf||0xc8;return function(_0x204826){if(_0x204826){return _0x55792b[_0xcf47('0x17')](_0x758baf)['json'](_0x204826);}};}function respondWithFilteredResult(_0x11238d,_0x411456){return function(_0x13a432){if(_0x13a432){var _0x2efd6e=typeof _0x411456[_0xcf47('0x19')]==='undefined'&&typeof _0x411456['limit']===_0xcf47('0x1a');var _0x1a9a52=_0x13a432['count'];var _0x11c194=_0x2efd6e?0x0:_0x411456['offset'];var _0x3a2e4b=_0x2efd6e?_0x13a432['count']:_0x411456[_0xcf47('0x19')]+_0x411456['limit'];var _0x1d33ef;if(_0x3a2e4b>=_0x1a9a52){_0x3a2e4b=_0x1a9a52;_0x1d33ef=0xc8;}else{_0x1d33ef=0xce;}_0x11238d[_0xcf47('0x17')](_0x1d33ef);return _0x11238d[_0xcf47('0x1b')](_0xcf47('0x1c'),_0x11c194+'-'+_0x3a2e4b+'/'+_0x1a9a52)[_0xcf47('0x1d')](_0x13a432);}return null;};}function patchUpdates(_0x16a1fa){return function(_0x10992b){try{jsonpatch['apply'](_0x10992b,_0x16a1fa,!![]);}catch(_0x11d9ac){return BPromise[_0xcf47('0x1e')](_0x11d9ac);}return _0x10992b[_0xcf47('0x1f')]();};}function saveUpdates(_0x34c741,_0x29a6ac){return function(_0x855e2c){if(_0x855e2c){return _0x855e2c['update'](_0x34c741)[_0xcf47('0x20')](function(_0x45755b){return _0x45755b;});}return null;};}function removeEntity(_0x1fdf6f,_0x25794a){return function(_0x5da4a2){if(_0x5da4a2){return _0x5da4a2[_0xcf47('0x21')]()['then'](function(){_0x1fdf6f[_0xcf47('0x17')](0xcc)[_0xcf47('0x18')]();});}};}function handleEntityNotFound(_0x34825b,_0x1f7a61){return function(_0x113b61){if(!_0x113b61){_0x34825b[_0xcf47('0x16')](0x194);}return _0x113b61;};}function handleError(_0x2eca69,_0x5160ca){_0x5160ca=_0x5160ca||0x1f4;return function(_0x24c4ff){logger[_0xcf47('0x22')](_0x24c4ff[_0xcf47('0x23')]);if(_0x24c4ff[_0xcf47('0x24')]){delete _0x24c4ff['name'];}_0x2eca69[_0xcf47('0x17')](_0x5160ca)[_0xcf47('0x25')](_0x24c4ff);};}exports['index']=function(_0xaab606,_0x42b2a9){var _0x10bde2={},_0x2a8bc9={},_0x13e141={'count':0x0,'rows':[]};var _0x20e65c=_[_0xcf47('0x26')](db[_0xcf47('0x27')][_0xcf47('0x28')],function(_0x393b8d){return{'name':_0x393b8d['fieldName'],'type':_0x393b8d[_0xcf47('0x29')]['key']};});_0x2a8bc9[_0xcf47('0x2a')]=_[_0xcf47('0x26')](_0x20e65c,_0xcf47('0x24'));_0x2a8bc9['query']=_[_0xcf47('0x2b')](_0xaab606[_0xcf47('0x2c')]);_0x2a8bc9[_0xcf47('0x2d')]=_[_0xcf47('0x2e')](_0x2a8bc9['model'],_0x2a8bc9['query']);_0x10bde2[_0xcf47('0x2f')]=_['intersection'](_0x2a8bc9[_0xcf47('0x2a')],qs[_0xcf47('0x30')](_0xaab606[_0xcf47('0x2c')]['fields']));_0x10bde2[_0xcf47('0x2f')]=_0x10bde2[_0xcf47('0x2f')][_0xcf47('0x31')]?_0x10bde2['attributes']:_0x2a8bc9[_0xcf47('0x2a')];if(!_0xaab606['query']['hasOwnProperty'](_0xcf47('0x32'))){_0x10bde2[_0xcf47('0x33')]=qs[_0xcf47('0x33')](_0xaab606[_0xcf47('0x2c')][_0xcf47('0x33')]);_0x10bde2[_0xcf47('0x19')]=qs[_0xcf47('0x19')](_0xaab606[_0xcf47('0x2c')][_0xcf47('0x19')]);}_0x10bde2[_0xcf47('0x34')]=qs[_0xcf47('0x35')](_0xaab606[_0xcf47('0x2c')][_0xcf47('0x35')]);_0x10bde2['where']=qs[_0xcf47('0x2d')](_[_0xcf47('0x36')](_0xaab606['query'],_0x2a8bc9[_0xcf47('0x2d')]),_0x20e65c);if(_0xaab606['query'][_0xcf47('0x37')]){_0x10bde2[_0xcf47('0x38')]=_[_0xcf47('0x39')](_0x10bde2[_0xcf47('0x38')],{'$or':_[_0xcf47('0x26')](_0x20e65c,function(_0x59f032){if(_0x59f032[_0xcf47('0x29')]!=='VIRTUAL'){var _0x45485d={};_0x45485d[_0x59f032['name']]={'$like':'%'+_0xaab606[_0xcf47('0x2c')]['filter']+'%'};return _0x45485d;}})});}_0x10bde2=_[_0xcf47('0x39')]({},_0x10bde2,_0xaab606[_0xcf47('0x3a')]);var _0x20021e={'where':_0x10bde2[_0xcf47('0x38')]};return db[_0xcf47('0x27')][_0xcf47('0x3b')](_0x20021e)[_0xcf47('0x20')](function(_0x36f466){_0x13e141[_0xcf47('0x3b')]=_0x36f466;if(_0xaab606['query']['includeAll']){_0x10bde2[_0xcf47('0x3c')]=[{'all':!![]}];}return db[_0xcf47('0x27')][_0xcf47('0x3d')](_0x10bde2);})[_0xcf47('0x20')](function(_0x2ec22d){_0x13e141[_0xcf47('0x3e')]=_0x2ec22d;return _0x13e141;})[_0xcf47('0x20')](respondWithFilteredResult(_0x42b2a9,_0x10bde2))[_0xcf47('0x3f')](handleError(_0x42b2a9,null));};exports[_0xcf47('0x40')]=function(_0x30b1c4,_0x157396){var _0x203c9d={'raw':!![],'where':{'id':_0x30b1c4[_0xcf47('0x41')]['id']}},_0x53ad29={};_0x53ad29[_0xcf47('0x2a')]=_[_0xcf47('0x2b')](db[_0xcf47('0x27')][_0xcf47('0x28')]);_0x53ad29[_0xcf47('0x2c')]=_[_0xcf47('0x2b')](_0x30b1c4[_0xcf47('0x2c')]);_0x53ad29[_0xcf47('0x2d')]=_['intersection'](_0x53ad29['model'],_0x53ad29[_0xcf47('0x2c')]);_0x203c9d[_0xcf47('0x2f')]=_[_0xcf47('0x2e')](_0x53ad29[_0xcf47('0x2a')],qs[_0xcf47('0x30')](_0x30b1c4[_0xcf47('0x2c')][_0xcf47('0x30')]));_0x203c9d[_0xcf47('0x2f')]=_0x203c9d[_0xcf47('0x2f')][_0xcf47('0x31')]?_0x203c9d['attributes']:_0x53ad29[_0xcf47('0x2a')];if(_0x30b1c4[_0xcf47('0x2c')]['includeAll']){_0x203c9d[_0xcf47('0x3c')]=[{'all':!![]}];}_0x203c9d=_['merge']({},_0x203c9d,_0x30b1c4['options']);return db[_0xcf47('0x27')]['find'](_0x203c9d)[_0xcf47('0x20')](handleEntityNotFound(_0x157396,null))[_0xcf47('0x20')](respondWithResult(_0x157396,null))[_0xcf47('0x3f')](handleError(_0x157396,null));};exports['create']=function(_0x55f845,_0x3d0cb2){return db[_0xcf47('0x27')][_0xcf47('0x42')](_0x55f845[_0xcf47('0x43')],{})[_0xcf47('0x20')](respondWithResult(_0x3d0cb2,0xc9))[_0xcf47('0x3f')](handleError(_0x3d0cb2,null));};exports[_0xcf47('0x44')]=function(_0x50dca0,_0x5368b7){if(_0x50dca0[_0xcf47('0x43')]['id']){delete _0x50dca0[_0xcf47('0x43')]['id'];}return db['JscriptySessionReport'][_0xcf47('0x45')]({'where':{'id':_0x50dca0[_0xcf47('0x41')]['id']}})[_0xcf47('0x20')](handleEntityNotFound(_0x5368b7,null))[_0xcf47('0x20')](saveUpdates(_0x50dca0[_0xcf47('0x43')],null))['then'](respondWithResult(_0x5368b7,null))[_0xcf47('0x3f')](handleError(_0x5368b7,null));};exports['destroy']=function(_0x1ace13,_0x9a9557){return db[_0xcf47('0x27')][_0xcf47('0x45')]({'where':{'id':_0x1ace13[_0xcf47('0x41')]['id']}})[_0xcf47('0x20')](handleEntityNotFound(_0x9a9557,null))[_0xcf47('0x20')](removeEntity(_0x9a9557,null))[_0xcf47('0x3f')](handleError(_0x9a9557,null));};exports['describe']=function(_0x249e0f,_0x418a61){return db[_0xcf47('0x27')][_0xcf47('0x46')]()[_0xcf47('0x20')](respondWithResult(_0x418a61,null))[_0xcf47('0x3f')](handleError(_0x418a61,null));};exports[_0xcf47('0x47')]=function(_0x46c8be,_0x57fa18,_0x4b087b){var _0x32b5e0={'raw':!![],'where':{}};var _0x2f513b={};var _0x34fb9e={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x46c8be[_0xcf47('0x41')]['id']}})[_0xcf47('0x20')](handleEntityNotFound(_0x57fa18,null))[_0xcf47('0x20')](function(_0x5efdd5){if(_0x5efdd5){_0x2f513b['model']=_[_0xcf47('0x2b')](db[_0xcf47('0x48')][_0xcf47('0x28')]);_0x2f513b[_0xcf47('0x2c')]=_[_0xcf47('0x2b')](_0x46c8be[_0xcf47('0x2c')]);_0x2f513b['filters']=_[_0xcf47('0x2e')](_0x2f513b[_0xcf47('0x2a')],_0x2f513b[_0xcf47('0x2c')]);_0x32b5e0['attributes']=_['intersection'](_0x2f513b['model'],qs[_0xcf47('0x30')](_0x46c8be['query'][_0xcf47('0x30')]));_0x32b5e0[_0xcf47('0x2f')]=_0x32b5e0[_0xcf47('0x2f')][_0xcf47('0x31')]?_0x32b5e0[_0xcf47('0x2f')]:_0x2f513b[_0xcf47('0x2a')];if(!_0x46c8be[_0xcf47('0x2c')][_0xcf47('0x49')](_0xcf47('0x32'))){_0x32b5e0[_0xcf47('0x33')]=qs[_0xcf47('0x33')](_0x46c8be[_0xcf47('0x2c')]['limit']);_0x32b5e0[_0xcf47('0x19')]=qs[_0xcf47('0x19')](_0x46c8be['query'][_0xcf47('0x19')]);}_0x32b5e0[_0xcf47('0x34')]=qs['sort'](_0x46c8be[_0xcf47('0x2c')][_0xcf47('0x35')]);_0x32b5e0[_0xcf47('0x38')]=qs[_0xcf47('0x2d')](_[_0xcf47('0x36')](_0x46c8be[_0xcf47('0x2c')],_0x2f513b[_0xcf47('0x2d')]));_0x32b5e0[_0xcf47('0x38')][_0xcf47('0x4a')]=_0x5efdd5['id'];if(_0x46c8be[_0xcf47('0x2c')]['filter']){_0x32b5e0[_0xcf47('0x38')]=_['merge'](_0x32b5e0[_0xcf47('0x38')],{'$or':_['map'](_0x32b5e0[_0xcf47('0x2f')],function(_0x4b1bca){var _0x26a596={};_0x26a596[_0x4b1bca]={'$like':'%'+_0x46c8be[_0xcf47('0x2c')][_0xcf47('0x37')]+'%'};return _0x26a596;})});}_0x32b5e0=_['merge']({},_0x32b5e0,_0x46c8be[_0xcf47('0x3a')]);return db[_0xcf47('0x48')][_0xcf47('0x3b')]({'where':_0x32b5e0[_0xcf47('0x38')]})['then'](function(_0x37fccc){_0x34fb9e['count']=_0x37fccc;if(_0x46c8be['query'][_0xcf47('0x4b')]){_0x32b5e0['include']=[{'all':!![]}];}return db[_0xcf47('0x48')][_0xcf47('0x3d')](_0x32b5e0);})[_0xcf47('0x20')](function(_0x36db94){_0x34fb9e[_0xcf47('0x3e')]=_0x36db94;return _0x34fb9e;});}})[_0xcf47('0x20')](respondWithFilteredResult(_0x57fa18,_0x32b5e0))[_0xcf47('0x3f')](handleError(_0x57fa18,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index b59dd13..8224e70 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 _0x90b1=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x17fa35,_0x2384da){var _0x573b02=function(_0x2ff8d9){while(--_0x2ff8d9){_0x17fa35['push'](_0x17fa35['shift']());}};_0x573b02(++_0x2384da);}(_0x90b1,0x1bb));var _0x190b=function(_0x2b6b92,_0x57303d){_0x2b6b92=_0x2b6b92-0x0;var _0x2233dc=_0x90b1[_0x2b6b92];return _0x2233dc;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2662b4,_0x18e014){var _0x412f50=function(_0x5cac28){while(--_0x5cac28){_0x2662b4['push'](_0x2662b4['shift']());}};_0x412f50(++_0x18e014);}(_0x31f0,0xb7));var _0x031f=function(_0x8e5a7e,_0x59b461){_0x8e5a7e=_0x8e5a7e-0x0;var _0xa9bd1=_0x31f0[_0x8e5a7e];return _0xa9bd1;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 1e7864e..c16b255 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptySessionReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x36dee4,_0x3d3cfe){var _0x13872f=function(_0x146a35){while(--_0x146a35){_0x36dee4['push'](_0x36dee4['shift']());}};_0x13872f(++_0x3d3cfe);}(_0x5fab,0x177));var _0xb5fa=function(_0x4fe93e,_0x44f9e2){_0x4fe93e=_0x4fe93e-0x0;var _0x5f1d5a=_0x5fab[_0x4fe93e];return _0x5f1d5a;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4de3c8,_0x997416){var _0x394335=function(_0x4d15b1){while(--_0x4d15b1){_0x4de3c8['push'](_0x4de3c8['shift']());}};_0x394335(++_0x997416);}(_0x7880,0x1f4));var _0x0788=function(_0x407844,_0x47eedc){_0x407844=_0x407844-0x0;var _0x36f5df=_0x7880[_0x407844];return _0x36f5df;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index a63944b..5b66ba5 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 _0xbc69=['exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','/download_log_file','isAuthenticated'];(function(_0x4f3949,_0x1b28b5){var _0x2bbb60=function(_0x137b51){while(--_0x137b51){_0x4f3949['push'](_0x4f3949['shift']());}};_0x2bbb60(++_0x1b28b5);}(_0xbc69,0xe5));var _0x9bc6=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xbc69[_0x3826ad];return _0x17b900;};'use strict';var multer=require(_0x9bc6('0x0'));var util=require('util');var path=require(_0x9bc6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9bc6('0x2')]();var fs_extra=require(_0x9bc6('0x3'));var auth=require(_0x9bc6('0x4'));var interaction=require(_0x9bc6('0x5'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0x9bc6('0x6')]('/',controller[_0x9bc6('0x7')]);router['put'](_0x9bc6('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x9bc6('0x6')](_0x9bc6('0x9'),auth[_0x9bc6('0xa')](),controller['downloadLogFile']);module[_0x9bc6('0xb')]=router; \ No newline at end of file +var _0x302a=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile'];(function(_0x440372,_0x1ec6d1){var _0x381be4=function(_0x389a35){while(--_0x389a35){_0x440372['push'](_0x440372['shift']());}};_0x381be4(++_0x1ec6d1);}(_0x302a,0x80));var _0xa302=function(_0x4de3cd,_0x48cec0){_0x4de3cd=_0x4de3cd-0x0;var _0x3ea74f=_0x302a[_0x4de3cd];return _0x3ea74f;};'use strict';var multer=require(_0xa302('0x0'));var util=require('util');var path=require(_0xa302('0x1'));var timeout=require(_0xa302('0x2'));var express=require(_0xa302('0x3'));var router=express[_0xa302('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa302('0x5'));var config=require(_0xa302('0x6'));var controller=require(_0xa302('0x7'));router[_0xa302('0x8')]('/',controller[_0xa302('0x9')]);router[_0xa302('0xa')](_0xa302('0xb'),auth[_0xa302('0xc')](),controller[_0xa302('0xd')]);router[_0xa302('0x8')](_0xa302('0xe'),auth[_0xa302('0xc')](),controller[_0xa302('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 7e056a8..e2db9a5 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 _0xb5a9=['INTEGER','exports','TEXT','STRING'];(function(_0x2ceba7,_0x451ce4){var _0x5348eb=function(_0x3596fc){while(--_0x3596fc){_0x2ceba7['push'](_0x2ceba7['shift']());}};_0x5348eb(++_0x451ce4);}(_0xb5a9,0x111));var _0x9b5a=function(_0x397124,_0x59821a){_0x397124=_0x397124-0x0;var _0x34f423=_0xb5a9[_0x397124];return _0x34f423;};'use strict';var Sequelize=require('sequelize');module[_0x9b5a('0x0')]={'license':{'type':Sequelize[_0x9b5a('0x1')]},'data1':{'type':Sequelize[_0x9b5a('0x2')]},'data2':{'type':Sequelize[_0x9b5a('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x9b5a('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6b2f=['sequelize','exports','STRING','INTEGER'];(function(_0x5a66c0,_0x482c3){var _0x4cc30d=function(_0x47f2e9){while(--_0x47f2e9){_0x5a66c0['push'](_0x5a66c0['shift']());}};_0x4cc30d(++_0x482c3);}(_0x6b2f,0x144));var _0xf6b2=function(_0x2c8784,_0x46db8a){_0x2c8784=_0x2c8784-0x0;var _0x5490e2=_0x6b2f[_0x2c8784];return _0x5490e2;};'use strict';var Sequelize=require(_0xf6b2('0x0'));module[_0xf6b2('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xf6b2('0x2')]},'data2':{'type':Sequelize[_0xf6b2('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xf6b2('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 9066726..bbbd184 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 _0xca99=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','merge','catch','body','checkLicense','key','downloadLogFile','license-info.log','join','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status'];(function(_0x21f8a8,_0x1d7071){var _0x21d3d5=function(_0x4ee4b4){while(--_0x4ee4b4){_0x21f8a8['push'](_0x21f8a8['shift']());}};_0x21d3d5(++_0x1d7071);}(_0xca99,0x138));var _0x9ca9=function(_0xbd9588,_0x22e90f){_0xbd9588=_0xbd9588-0x0;var _0x35a8d7=_0xca99[_0xbd9588];return _0x35a8d7;};'use strict';var emlformat=require(_0x9ca9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ca9('0x1'));var jsonpatch=require(_0x9ca9('0x2'));var rp=require(_0x9ca9('0x3'));var moment=require(_0x9ca9('0x4'));var BPromise=require(_0x9ca9('0x5'));var Mustache=require(_0x9ca9('0x6'));var util=require(_0x9ca9('0x7'));var path=require(_0x9ca9('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9ca9('0x9'));var fs=require('fs');var fs_extra=require(_0x9ca9('0xa'));var _=require(_0x9ca9('0xb'));var squel=require(_0x9ca9('0xc'));var crypto=require(_0x9ca9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9ca9('0xe'));var toCsv=require(_0x9ca9('0xf'));var querystring=require(_0x9ca9('0x10'));var Papa=require('papaparse');var Redis=require(_0x9ca9('0x11'));var authService=require(_0x9ca9('0x12'));var qs=require(_0x9ca9('0x13'));var as=require(_0x9ca9('0x14'));var hardwareService=require(_0x9ca9('0x15'));var logger=require(_0x9ca9('0x16'))(_0x9ca9('0x17'));var utils=require(_0x9ca9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9ca9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x302fe3,_0x3bdfb8){_0x3bdfb8=_0x3bdfb8||0xcc;return function(_0x39718e){if(_0x39718e){return _0x302fe3[_0x9ca9('0x1a')](_0x3bdfb8);}return _0x302fe3[_0x9ca9('0x1b')](_0x3bdfb8)[_0x9ca9('0x1c')]();};}function respondWithResult(_0x574018,_0x337e9c){_0x337e9c=_0x337e9c||0xc8;return function(_0x8b5f14){if(_0x8b5f14){return _0x574018[_0x9ca9('0x1b')](_0x337e9c)[_0x9ca9('0x1d')](_0x8b5f14);}};}function respondWithFilteredResult(_0x115bc9,_0x39305e){return function(_0xc60dc5){if(_0xc60dc5){var _0xb3643b=typeof _0x39305e[_0x9ca9('0x1e')]===_0x9ca9('0x1f')&&typeof _0x39305e[_0x9ca9('0x20')]===_0x9ca9('0x1f');var _0x2a55e7=_0xc60dc5[_0x9ca9('0x21')];var _0x400a9a=_0xb3643b?0x0:_0x39305e[_0x9ca9('0x1e')];var _0x2e8583=_0xb3643b?_0xc60dc5[_0x9ca9('0x21')]:_0x39305e[_0x9ca9('0x1e')]+_0x39305e['limit'];var _0x53f6c4;if(_0x2e8583>=_0x2a55e7){_0x2e8583=_0x2a55e7;_0x53f6c4=0xc8;}else{_0x53f6c4=0xce;}_0x115bc9[_0x9ca9('0x1b')](_0x53f6c4);return _0x115bc9[_0x9ca9('0x22')](_0x9ca9('0x23'),_0x400a9a+'-'+_0x2e8583+'/'+_0x2a55e7)[_0x9ca9('0x1d')](_0xc60dc5);}return null;};}function patchUpdates(_0x4e7932){return function(_0x121f84){try{jsonpatch[_0x9ca9('0x24')](_0x121f84,_0x4e7932,!![]);}catch(_0x5131a1){return BPromise[_0x9ca9('0x25')](_0x5131a1);}return _0x121f84['save']();};}function saveUpdates(_0x22f589,_0x1c5745){return function(_0x3671bf){if(_0x3671bf){return _0x3671bf[_0x9ca9('0x26')](_0x22f589)[_0x9ca9('0x27')](function(_0x44ab75){return _0x44ab75;});}return null;};}function removeEntity(_0x18b08d,_0x49824b){return function(_0x23c475){if(_0x23c475){return _0x23c475[_0x9ca9('0x28')]()[_0x9ca9('0x27')](function(){_0x18b08d[_0x9ca9('0x1b')](0xcc)[_0x9ca9('0x1c')]();});}};}function handleEntityNotFound(_0x5b130f,_0xfd6a61){return function(_0x180cb7){if(!_0x180cb7){_0x5b130f[_0x9ca9('0x1a')](0x194);}return _0x180cb7;};}function handleError(_0x4b1e9f,_0x34bf3b){_0x34bf3b=_0x34bf3b||0x1f4;return function(_0x27585e){logger['error'](_0x27585e[_0x9ca9('0x29')]);if(_0x27585e[_0x9ca9('0x2a')]){delete _0x27585e[_0x9ca9('0x2a')];}_0x4b1e9f[_0x9ca9('0x1b')](_0x34bf3b)['send'](_0x27585e);};}var utilLicense=require(_0x9ca9('0x19'));exports[_0x9ca9('0x2b')]=function(_0x4482d2,_0x14a2d5){var _0x215607={'raw':!![],'where':{'id':0x1}},_0x4b95c6={};_0x4b95c6[_0x9ca9('0x2c')]=_[_0x9ca9('0x2d')](db[_0x9ca9('0x2e')][_0x9ca9('0x2f')]);_0x4b95c6[_0x9ca9('0x30')]=_[_0x9ca9('0x2d')](_0x4482d2['query']);_0x4b95c6[_0x9ca9('0x31')]=_[_0x9ca9('0x32')](_0x4b95c6['model'],_0x4b95c6[_0x9ca9('0x30')]);_0x215607['attributes']=_[_0x9ca9('0x32')](_0x4b95c6[_0x9ca9('0x2c')],qs[_0x9ca9('0x33')](_0x4482d2[_0x9ca9('0x30')][_0x9ca9('0x33')]));_0x215607[_0x9ca9('0x34')]=_0x215607[_0x9ca9('0x34')][_0x9ca9('0x35')]?_0x215607[_0x9ca9('0x34')]:_0x4b95c6[_0x9ca9('0x2c')];_0x215607=_[_0x9ca9('0x36')]({},_0x215607,_0x4482d2['options']);return utilLicense['getLicense'](_0x215607)[_0x9ca9('0x27')](respondWithResult(_0x14a2d5,null))[_0x9ca9('0x37')](handleError(_0x14a2d5,null));};exports[_0x9ca9('0x26')]=function(_0x1d9958,_0x5500cb){if(_0x1d9958[_0x9ca9('0x38')]['id']){delete _0x1d9958[_0x9ca9('0x38')]['id'];}return db[_0x9ca9('0x2e')]['find']({'where':{'id':_0x1d9958['params']['id']}})[_0x9ca9('0x27')](handleEntityNotFound(_0x5500cb,null))['then'](function(_0x589d76){var _0x450aff=_0x589d76['get']({'plain':!![]});return utilLicense[_0x9ca9('0x39')](_0x450aff,_0x1d9958['body'][_0x9ca9('0x3a')]);})[_0x9ca9('0x27')](function(_0x5a24f8){if(!_0x5a24f8['demo']){return saveUpdates(_0x1d9958['body'],null);}return _0x5a24f8;})[_0x9ca9('0x27')](respondWithResult(_0x5500cb,null))[_0x9ca9('0x37')](handleError(_0x5500cb,null));};exports[_0x9ca9('0x3b')]=function(_0x28429c,_0x2449a5){var _0x3f4671=_0x9ca9('0x3c');var _0x67e185=path[_0x9ca9('0x3d')]('/var','log',_0x9ca9('0x3e'),_0x3f4671);_0x2449a5[_0x9ca9('0x3f')](_0x9ca9('0x40'),_0x9ca9('0x41')+_0x3f4671);_0x2449a5[_0x9ca9('0x22')](_0x9ca9('0x42'),_0x9ca9('0x43'));_0x2449a5['download'](_0x67e185);}; \ No newline at end of file +var _0x0980=['catch','downloadLogFile','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','set','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','length','merge','options','getLicense','body','find','params','get','checkLicense','key','demo'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0980,0x97));var _0x0098=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0980[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x0098('0x0'));var rimraf=require(_0x0098('0x1'));var zipdir=require(_0x0098('0x2'));var jsonpatch=require(_0x0098('0x3'));var rp=require('request-promise');var moment=require(_0x0098('0x4'));var BPromise=require(_0x0098('0x5'));var Mustache=require(_0x0098('0x6'));var util=require('util');var path=require(_0x0098('0x7'));var sox=require(_0x0098('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0098('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0098('0xa'));var deskjs=require(_0x0098('0xb'));var toCsv=require(_0x0098('0xc'));var querystring=require('querystring');var Papa=require(_0x0098('0xd'));var Redis=require(_0x0098('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0098('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0098('0x10'))('api');var utils=require(_0x0098('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x0098('0x12'));var db=require(_0x0098('0x13'))['db'];function respondWithStatusCode(_0x4cd044,_0x4e708a){_0x4e708a=_0x4e708a||0xcc;return function(_0x3a9e38){if(_0x3a9e38){return _0x4cd044[_0x0098('0x14')](_0x4e708a);}return _0x4cd044[_0x0098('0x15')](_0x4e708a)[_0x0098('0x16')]();};}function respondWithResult(_0x17c96e,_0xe316c6){_0xe316c6=_0xe316c6||0xc8;return function(_0x4f207d){if(_0x4f207d){return _0x17c96e[_0x0098('0x15')](_0xe316c6)[_0x0098('0x17')](_0x4f207d);}};}function respondWithFilteredResult(_0x293c75,_0x347100){return function(_0x59cc5f){if(_0x59cc5f){var _0x44233d=typeof _0x347100[_0x0098('0x18')]===_0x0098('0x19')&&typeof _0x347100[_0x0098('0x1a')]===_0x0098('0x19');var _0x52beac=_0x59cc5f['count'];var _0x7a088f=_0x44233d?0x0:_0x347100[_0x0098('0x18')];var _0x20918a=_0x44233d?_0x59cc5f[_0x0098('0x1b')]:_0x347100[_0x0098('0x18')]+_0x347100[_0x0098('0x1a')];var _0x228572;if(_0x20918a>=_0x52beac){_0x20918a=_0x52beac;_0x228572=0xc8;}else{_0x228572=0xce;}_0x293c75[_0x0098('0x15')](_0x228572);return _0x293c75['set'](_0x0098('0x1c'),_0x7a088f+'-'+_0x20918a+'/'+_0x52beac)[_0x0098('0x17')](_0x59cc5f);}return null;};}function patchUpdates(_0x518c55){return function(_0x58e46d){try{jsonpatch[_0x0098('0x1d')](_0x58e46d,_0x518c55,!![]);}catch(_0x11ec46){return BPromise[_0x0098('0x1e')](_0x11ec46);}return _0x58e46d[_0x0098('0x1f')]();};}function saveUpdates(_0x527a0d,_0x44c9fc){return function(_0x4a64b7){if(_0x4a64b7){return _0x4a64b7[_0x0098('0x20')](_0x527a0d)[_0x0098('0x21')](function(_0x2c09fd){return _0x2c09fd;});}return null;};}function removeEntity(_0x23fc30,_0x229e84){return function(_0x2ba455){if(_0x2ba455){return _0x2ba455[_0x0098('0x22')]()[_0x0098('0x21')](function(){_0x23fc30[_0x0098('0x15')](0xcc)[_0x0098('0x16')]();});}};}function handleEntityNotFound(_0x1d4637,_0x38eedc){return function(_0x22fd51){if(!_0x22fd51){_0x1d4637[_0x0098('0x14')](0x194);}return _0x22fd51;};}function handleError(_0xf4fcc6,_0x193691){_0x193691=_0x193691||0x1f4;return function(_0x3a829a){logger[_0x0098('0x23')](_0x3a829a[_0x0098('0x24')]);if(_0x3a829a[_0x0098('0x25')]){delete _0x3a829a[_0x0098('0x25')];}_0xf4fcc6[_0x0098('0x15')](_0x193691)[_0x0098('0x26')](_0x3a829a);};}var utilLicense=require(_0x0098('0x12'));exports[_0x0098('0x27')]=function(_0x526b03,_0x1605de){var _0x444cec={'raw':!![],'where':{'id':0x1}},_0x220fe3={};_0x220fe3['model']=_[_0x0098('0x28')](db[_0x0098('0x29')][_0x0098('0x2a')]);_0x220fe3['query']=_[_0x0098('0x28')](_0x526b03[_0x0098('0x2b')]);_0x220fe3[_0x0098('0x2c')]=_[_0x0098('0x2d')](_0x220fe3[_0x0098('0x2e')],_0x220fe3[_0x0098('0x2b')]);_0x444cec[_0x0098('0x2f')]=_[_0x0098('0x2d')](_0x220fe3[_0x0098('0x2e')],qs['fields'](_0x526b03[_0x0098('0x2b')]['fields']));_0x444cec[_0x0098('0x2f')]=_0x444cec[_0x0098('0x2f')][_0x0098('0x30')]?_0x444cec[_0x0098('0x2f')]:_0x220fe3[_0x0098('0x2e')];_0x444cec=_[_0x0098('0x31')]({},_0x444cec,_0x526b03[_0x0098('0x32')]);return utilLicense[_0x0098('0x33')](_0x444cec)['then'](respondWithResult(_0x1605de,null))['catch'](handleError(_0x1605de,null));};exports[_0x0098('0x20')]=function(_0x16c57d,_0x4bb54f){if(_0x16c57d['body']['id']){delete _0x16c57d[_0x0098('0x34')]['id'];}return db[_0x0098('0x29')][_0x0098('0x35')]({'where':{'id':_0x16c57d[_0x0098('0x36')]['id']}})['then'](handleEntityNotFound(_0x4bb54f,null))[_0x0098('0x21')](function(_0x2215a3){var _0x49f255=_0x2215a3[_0x0098('0x37')]({'plain':!![]});return utilLicense[_0x0098('0x38')](_0x49f255,_0x16c57d[_0x0098('0x34')][_0x0098('0x39')]);})[_0x0098('0x21')](function(_0x663790){if(!_0x663790[_0x0098('0x3a')]){return saveUpdates(_0x16c57d[_0x0098('0x34')],null);}return _0x663790;})[_0x0098('0x21')](respondWithResult(_0x4bb54f,null))[_0x0098('0x3b')](handleError(_0x4bb54f,null));};exports[_0x0098('0x3c')]=function(_0x9a5a04,_0x3ae946){var _0xcb9f45='license-info.log';var _0x5b5a33=path[_0x0098('0x3d')](_0x0098('0x3e'),_0x0098('0x3f'),_0x0098('0x40'),_0xcb9f45);_0x3ae946['setHeader'](_0x0098('0x41'),_0x0098('0x42')+_0xcb9f45);_0x3ae946[_0x0098('0x43')]('Content-Type',_0x0098('0x44'));_0x3ae946[_0x0098('0x45')](_0x5b5a33);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 26c7f93..aa92b79 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 _0x71e6=['rimraf','../../config/environment','exports','License','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x9cc155,_0x328c0c){var _0x45ab2f=function(_0x229d82){while(--_0x229d82){_0x9cc155['push'](_0x9cc155['shift']());}};_0x45ab2f(++_0x328c0c);}(_0x71e6,0x7c));var _0x671e=function(_0x2c9cce,_0x21e21c){_0x2c9cce=_0x2c9cce-0x0;var _0x4bc082=_0x71e6[_0x2c9cce];return _0x4bc082;};'use strict';var _=require(_0x671e('0x0'));var util=require(_0x671e('0x1'));var logger=require(_0x671e('0x2'))(_0x671e('0x3'));var moment=require('moment');var BPromise=require(_0x671e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x671e('0x5'));var rimraf=require(_0x671e('0x6'));var config=require(_0x671e('0x7'));var attributes=require('./license.attributes');module[_0x671e('0x8')]=function(_0x173f20,_0x2d457e){return _0x173f20['define'](_0x671e('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5834=['bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define','License','lodash','util','../../config/logger','moment'];(function(_0x4eeb93,_0x27bbb9){var _0x22092c=function(_0x278ebb){while(--_0x278ebb){_0x4eeb93['push'](_0x4eeb93['shift']());}};_0x22092c(++_0x27bbb9);}(_0x5834,0xec));var _0x4583=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x5834[_0x26b80e];return _0x84a8a8;};'use strict';var _=require(_0x4583('0x0'));var util=require(_0x4583('0x1'));var logger=require(_0x4583('0x2'))('api');var moment=require(_0x4583('0x3'));var BPromise=require(_0x4583('0x4'));var rp=require(_0x4583('0x5'));var fs=require('fs');var path=require(_0x4583('0x6'));var rimraf=require('rimraf');var config=require(_0x4583('0x7'));var attributes=require(_0x4583('0x8'));module[_0x4583('0x9')]=function(_0x499786,_0x398421){return _0x499786[_0x4583('0xa')](_0x4583('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 0a387a5..3efe414 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 _0x688e=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x688e,0x105));var _0xe688=function(_0x3950ce,_0xd6024b){_0x3950ce=_0x3950ce-0x0;var _0x14eb08=_0x688e[_0x3950ce];return _0x14eb08;};'use strict';var _=require(_0xe688('0x0'));var util=require(_0xe688('0x1'));var moment=require('moment');var BPromise=require(_0xe688('0x2'));var rs=require(_0xe688('0x3'));var fs=require('fs');var Redis=require(_0xe688('0x4'));var db=require(_0xe688('0x5'))['db'];var utils=require(_0xe688('0x6'));var logger=require(_0xe688('0x7'))('rpc');var config=require(_0xe688('0x8'));var jayson=require(_0xe688('0x9'));var client=jayson[_0xe688('0xa')][_0xe688('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b826c,_0x474be8,_0x5a41f9){return new BPromise(function(_0x2f4f63,_0x66c1d0){return client[_0xe688('0xc')](_0x2b826c,_0x5a41f9)[_0xe688('0xd')](function(_0x28351d){logger['info'](_0xe688('0xe'),_0x474be8,_0xe688('0xf'));logger[_0xe688('0x10')](_0xe688('0x11'),_0x474be8,'request\x20sent',JSON[_0xe688('0x12')](_0x28351d));if(_0x28351d[_0xe688('0x13')]){if(_0x28351d[_0xe688('0x13')]['code']===0x1f4){logger[_0xe688('0x13')](_0xe688('0xe'),_0x474be8,_0x28351d[_0xe688('0x13')]['message']);return _0x66c1d0(_0x28351d[_0xe688('0x13')][_0xe688('0x14')]);}logger['error'](_0xe688('0xe'),_0x474be8,_0x28351d[_0xe688('0x13')][_0xe688('0x14')]);return _0x2f4f63(_0x28351d[_0xe688('0x13')][_0xe688('0x14')]);}else{logger[_0xe688('0x15')]('License,\x20%s,\x20%s',_0x474be8,_0xe688('0xf'));_0x2f4f63(_0x28351d[_0xe688('0x16')][_0xe688('0x14')]);}})['catch'](function(_0x111851){logger[_0xe688('0x13')](_0xe688('0xe'),_0x474be8,_0x111851);_0x66c1d0(_0x111851);});});} \ No newline at end of file +var _0x173b=['License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x58fd33,_0x40dc7){var _0x18f594=function(_0x1b6e43){while(--_0x1b6e43){_0x58fd33['push'](_0x58fd33['shift']());}};_0x18f594(++_0x40dc7);}(_0x173b,0x14a));var _0xb173=function(_0x4ecedb,_0x2dffa3){_0x4ecedb=_0x4ecedb-0x0;var _0x3544cc=_0x173b[_0x4ecedb];return _0x3544cc;};'use strict';var _=require(_0xb173('0x0'));var util=require(_0xb173('0x1'));var moment=require(_0xb173('0x2'));var BPromise=require(_0xb173('0x3'));var rs=require(_0xb173('0x4'));var fs=require('fs');var Redis=require(_0xb173('0x5'));var db=require(_0xb173('0x6'))['db'];var utils=require(_0xb173('0x7'));var logger=require(_0xb173('0x8'))('rpc');var config=require(_0xb173('0x9'));var jayson=require(_0xb173('0xa'));var client=jayson[_0xb173('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a0471,_0xc114eb,_0x31a920){return new BPromise(function(_0x17318a,_0xcc38e4){return client[_0xb173('0xc')](_0x3a0471,_0x31a920)[_0xb173('0xd')](function(_0x561323){logger[_0xb173('0xe')](_0xb173('0xf'),_0xc114eb,'request\x20sent');logger['debug'](_0xb173('0x10'),_0xc114eb,'request\x20sent',JSON[_0xb173('0x11')](_0x561323));if(_0x561323[_0xb173('0x12')]){if(_0x561323[_0xb173('0x12')][_0xb173('0x13')]===0x1f4){logger[_0xb173('0x12')](_0xb173('0xf'),_0xc114eb,_0x561323[_0xb173('0x12')][_0xb173('0x14')]);return _0xcc38e4(_0x561323[_0xb173('0x12')][_0xb173('0x14')]);}logger[_0xb173('0x12')](_0xb173('0xf'),_0xc114eb,_0x561323['error']['message']);return _0x17318a(_0x561323[_0xb173('0x12')][_0xb173('0x14')]);}else{logger['info'](_0xb173('0xf'),_0xc114eb,_0xb173('0x15'));_0x17318a(_0x561323['result'][_0xb173('0x14')]);}})[_0xb173('0x16')](function(_0x57a17d){logger[_0xb173('0x12')](_0xb173('0xf'),_0xc114eb,_0x57a17d);_0xcc38e4(_0x57a17d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 80707a3..360b3ba 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 _0x4bd9=['/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','/:id/in_servers','addImap','/:id/out_servers','addInteraction','/:id/send','send','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages'];(function(_0x424895,_0x14c6f8){var _0xbf70ff=function(_0x2aacf5){while(--_0x2aacf5){_0x424895['push'](_0x424895['shift']());}};_0xbf70ff(++_0x14c6f8);}(_0x4bd9,0xd9));var _0x94bd=function(_0x40a11c,_0x1c7a1d){_0x40a11c=_0x40a11c-0x0;var _0xdb0aec=_0x4bd9[_0x40a11c];return _0xdb0aec;};'use strict';var multer=require(_0x94bd('0x0'));var util=require(_0x94bd('0x1'));var path=require(_0x94bd('0x2'));var timeout=require(_0x94bd('0x3'));var express=require(_0x94bd('0x4'));var router=express[_0x94bd('0x5')]();var fs_extra=require(_0x94bd('0x6'));var auth=require(_0x94bd('0x7'));var interaction=require(_0x94bd('0x8'));var config=require('../../config/environment');var controller=require(_0x94bd('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x94bd('0xa')]);router[_0x94bd('0xb')](_0x94bd('0xc'),auth[_0x94bd('0xd')](),controller[_0x94bd('0xe')]);router[_0x94bd('0xb')](_0x94bd('0xf'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x10')]);router[_0x94bd('0xb')](_0x94bd('0x11'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x12')]);router[_0x94bd('0xb')](_0x94bd('0x13'),auth[_0x94bd('0xd')](),controller['getAnswers']);router[_0x94bd('0xb')]('/:id/in_servers',auth[_0x94bd('0xd')](),controller[_0x94bd('0x14')]);router[_0x94bd('0xb')]('/:id/out_servers',auth[_0x94bd('0xd')](),controller[_0x94bd('0x15')]);router[_0x94bd('0xb')](_0x94bd('0x16'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x17')]);router['get'](_0x94bd('0x18'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x19')]);router[_0x94bd('0xb')](_0x94bd('0x1a'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x1b')]);router[_0x94bd('0xb')](_0x94bd('0x1c'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x1d')]);router['get'](_0x94bd('0x1e'),auth['isAuthenticated'](),controller[_0x94bd('0x1f')]);router[_0x94bd('0x20')](_0x94bd('0x11'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x21')]);router[_0x94bd('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x94bd('0x22')]);router[_0x94bd('0x20')]('/',auth[_0x94bd('0xd')](),controller[_0x94bd('0x23')]);router[_0x94bd('0x20')](_0x94bd('0x24'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x25')]);router[_0x94bd('0x20')](_0x94bd('0x26'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x94bd('0x20')](_0x94bd('0x16'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x27')]);router[_0x94bd('0x20')](_0x94bd('0x18'),auth['isAuthenticated'](),controller['addApplications']);router[_0x94bd('0x20')](_0x94bd('0x28'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x29')]);router[_0x94bd('0x20')](_0x94bd('0x1e'),auth[_0x94bd('0xd')](),controller['addAgents']);router['put']('/:id',auth[_0x94bd('0xd')](),controller['update']);router[_0x94bd('0x2a')]('/:id/dispositions',auth[_0x94bd('0xd')](),controller['removeDispositions']);router[_0x94bd('0x2a')](_0x94bd('0x13'),auth[_0x94bd('0xd')](),controller[_0x94bd('0x2b')]);router[_0x94bd('0x2a')](_0x94bd('0x24'),auth['isAuthenticated'](),controller[_0x94bd('0x2c')]);router[_0x94bd('0x2a')](_0x94bd('0x26'),auth['isAuthenticated'](),controller[_0x94bd('0x2d')]);router[_0x94bd('0x2a')]('/:id',auth['isAuthenticated'](),controller[_0x94bd('0x2e')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x94bd('0x2f')]);module[_0x94bd('0x30')]=router; \ No newline at end of file +var _0x0e02=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','addDisposition','addAnswer','post','addSmtp','/:id/interactions','addApplications','/:id/send','send','addAgents','update','delete','/:id/dispositions','removeDispositions','removeAnswers','removeImap','removeSmtp','exports'];(function(_0x2405de,_0x201c05){var _0x2e3ecb=function(_0x2ccef8){while(--_0x2ccef8){_0x2405de['push'](_0x2405de['shift']());}};_0x2e3ecb(++_0x201c05);}(_0x0e02,0xe6));var _0x20e0=function(_0x16df5e,_0x48ae27){_0x16df5e=_0x16df5e-0x0;var _0x366ee4=_0x0e02[_0x16df5e];return _0x366ee4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x20e0('0x0'));var timeout=require(_0x20e0('0x1'));var express=require(_0x20e0('0x2'));var router=express[_0x20e0('0x3')]();var fs_extra=require(_0x20e0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x20e0('0x5'));var config=require(_0x20e0('0x6'));var controller=require(_0x20e0('0x7'));router[_0x20e0('0x8')]('/',auth[_0x20e0('0x9')](),controller[_0x20e0('0xa')]);router['get'](_0x20e0('0xb'),auth[_0x20e0('0x9')](),controller[_0x20e0('0xc')]);router[_0x20e0('0x8')](_0x20e0('0xd'),auth[_0x20e0('0x9')](),controller[_0x20e0('0xe')]);router[_0x20e0('0x8')]('/:id/dispositions',auth[_0x20e0('0x9')](),controller[_0x20e0('0xf')]);router[_0x20e0('0x8')](_0x20e0('0x10'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x11')]);router[_0x20e0('0x8')](_0x20e0('0x12'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x13')]);router['get'](_0x20e0('0x14'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x15')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x20e0('0x8')](_0x20e0('0x16'),auth['isAuthenticated'](),controller[_0x20e0('0x17')]);router[_0x20e0('0x8')](_0x20e0('0x18'),auth['isAuthenticated'](),controller[_0x20e0('0x19')]);router[_0x20e0('0x8')](_0x20e0('0x1a'),auth['isAuthenticated'](),controller[_0x20e0('0x1b')]);router[_0x20e0('0x8')](_0x20e0('0x1c'),auth[_0x20e0('0x9')](),controller['getAgents']);router['post']('/:id/dispositions',auth[_0x20e0('0x9')](),controller[_0x20e0('0x1d')]);router['post'](_0x20e0('0x10'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x1e')]);router[_0x20e0('0x1f')]('/',auth[_0x20e0('0x9')](),controller['create']);router[_0x20e0('0x1f')](_0x20e0('0x12'),auth[_0x20e0('0x9')](),controller['addImap']);router[_0x20e0('0x1f')](_0x20e0('0x14'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x20')]);router[_0x20e0('0x1f')](_0x20e0('0x21'),auth[_0x20e0('0x9')](),controller['addInteraction']);router['post'](_0x20e0('0x16'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x22')]);router['post'](_0x20e0('0x23'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x24')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x20e0('0x25')]);router['put'](_0x20e0('0xd'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x26')]);router[_0x20e0('0x27')](_0x20e0('0x28'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x29')]);router['delete']('/:id/canned_answers',auth[_0x20e0('0x9')](),controller[_0x20e0('0x2a')]);router['delete'](_0x20e0('0x12'),auth['isAuthenticated'](),controller[_0x20e0('0x2b')]);router[_0x20e0('0x27')](_0x20e0('0x14'),auth[_0x20e0('0x9')](),controller[_0x20e0('0x2c')]);router[_0x20e0('0x27')](_0x20e0('0xd'),auth[_0x20e0('0x9')](),controller['destroy']);router['delete'](_0x20e0('0x1c'),auth[_0x20e0('0x9')](),controller['removeAgents']);module[_0x20e0('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index bb5f104..733944e 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 _0xe471=['mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','sequelize','exports','BOOLEAN','STRING','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','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(_0x283e0e,_0x3f29df){var _0x37f29a=function(_0x57235f){while(--_0x57235f){_0x283e0e['push'](_0x283e0e['shift']());}};_0x37f29a(++_0x3f29df);}(_0xe471,0x148));var _0x1e47=function(_0x13dd75,_0x3ce801){_0x13dd75=_0x13dd75-0x0;var _0x162745=_0xe471[_0x13dd75];return _0x162745;};'use strict';var Sequelize=require(_0x1e47('0x0'));module[_0x1e47('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x1e47('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x1e47('0x3')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1e47('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1e47('0x3')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x1e47('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1e47('0x3')],'allowNull':![],'defaultValue':_0x1e47('0x4')},'fontSize':{'type':Sequelize[_0x1e47('0x5')](0x2)[_0x1e47('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1e47('0x7')],'defaultValue':function(){return _0x1e47('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1e47('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1e47('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1e47('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1e47('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1e47('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1e47('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1e47('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1e47('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1e47('0xa'),'set':function(_0x32d5a5){if(!_0x32d5a5)this[_0x1e47('0xb')](_0x1e47('0xc'),null);this[_0x1e47('0xb')]('mandatoryDisposition',_0x32d5a5);}},'provider':{'type':Sequelize[_0x1e47('0xd')](_0x1e47('0xe'),_0x1e47('0xf'),_0x1e47('0x10'),'outlook365'),'defaultValue':null,'get':function(){var _0x5d2289=this[_0x1e47('0x11')](_0x1e47('0x12'));return _0x5d2289||_0x1e47('0x13');},'set':function(_0x11c5e4){if(_0x11c5e4==='custom'){_0x11c5e4=null;}return this[_0x1e47('0xb')](_0x1e47('0x12'),_0x11c5e4);}}}; \ No newline at end of file +var _0x4036=['getDataValue','provider','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','outlook365'];(function(_0x34ded7,_0x5752df){var _0x39e7ce=function(_0x5bfc6c){while(--_0x5bfc6c){_0x34ded7['push'](_0x34ded7['shift']());}};_0x39e7ce(++_0x5752df);}(_0x4036,0x172));var _0x6403=function(_0x5183a2,_0x28354d){_0x5183a2=_0x5183a2-0x0;var _0x13db01=_0x4036[_0x5183a2];return _0x13db01;};'use strict';var Sequelize=require(_0x6403('0x0'));module[_0x6403('0x1')]={'description':{'type':Sequelize[_0x6403('0x2')]},'name':{'type':Sequelize[_0x6403('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x6403('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x6403('0x4')]},'markAsUnread':{'type':Sequelize[_0x6403('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6403('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x6403('0x5')](0x2)[_0x6403('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6403('0x4')],'defaultValue':function(){return _0x6403('0x7');}},'notificationSound':{'type':Sequelize[_0x6403('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6403('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6403('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6403('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6403('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6403('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6403('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6403('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6403('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6403('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x50a85c){if(!_0x50a85c)this[_0x6403('0x8')](_0x6403('0x9'),null);this[_0x6403('0x8')]('mandatoryDisposition',_0x50a85c);}},'provider':{'type':Sequelize[_0x6403('0xa')](_0x6403('0xb'),_0x6403('0xc'),'yahoo',_0x6403('0xd')),'defaultValue':null,'get':function(){var _0x3e8f29=this[_0x6403('0xe')](_0x6403('0xf'));return _0x3e8f29||'custom';},'set':function(_0x163360){if(_0x163360==='custom'){_0x163360=null;}return this[_0x6403('0x8')](_0x6403('0xf'),_0x163360);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index bb3b937..4e2a832 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 _0x0e82=['getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','create','getAnswers','CannedAnswer','removeAnswers','custom','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','Owner','fullname','internal','Tag','color','tag','addApplications','transaction','sequelize','READ_COMMITTED','MailApplication','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','getSmtpOptions','SendMail','List\x20not\x20found','defaults','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','User','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','register','jayson/promise','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','status','end','json','offset','undefined','limit','set','Content-Range','update','destroy','MailAccounts','UserProfileResource','sendStatus','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','MailServerOut','keys','MailAccount','fields','options','find','body','provider','Pause','Mail\x20Account\x20not\x20found','describe','MailAccountId'];(function(_0x30e84c,_0x4937fc){var _0x3aea2b=function(_0x306f46){while(--_0x306f46){_0x30e84c['push'](_0x30e84c['shift']());}};_0x3aea2b(++_0x4937fc);}(_0x0e82,0x1e7));var _0x20e8=function(_0xb50a43,_0x4bfdbd){_0xb50a43=_0xb50a43-0x0;var _0x2986de=_0x0e82[_0xb50a43];return _0x2986de;};'use strict';var moment=require(_0x20e8('0x0'));var BPromise=require(_0x20e8('0x1'));var util=require(_0x20e8('0x2'));var path=require(_0x20e8('0x3'));var _=require(_0x20e8('0x4'));var juice=require('juice');var Redis=require(_0x20e8('0x5'));var qs=require(_0x20e8('0x6'));var logger=require(_0x20e8('0x7'))('api');var config=require(_0x20e8('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x20e8('0x9')],{'host':_0x20e8('0xa'),'port':0x18eb});var socket=require(_0x20e8('0xb'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x20e8('0xc')](socket);var jayson=require(_0x20e8('0xd'));var client=jayson['client'][_0x20e8('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x2d54a0,_0x41e330,_0x16faf8,_0xf6cb6){return new BPromise(function(_0x14efef,_0xcb15ce){var _0x8dd944=_0xf6cb6||client;return _0x8dd944['request'](_0x2d54a0,_0x16faf8)[_0x20e8('0xf')](function(_0xd8a565){logger[_0x20e8('0x10')](_0x20e8('0x11'),_0x41e330,_0x20e8('0x12'));logger[_0x20e8('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x41e330,_0x20e8('0x12'),JSON[_0x20e8('0x14')](_0xd8a565));if(_0xd8a565[_0x20e8('0x15')]){if(_0xd8a565[_0x20e8('0x15')]['code']===0x1f4){logger[_0x20e8('0x15')](_0x20e8('0x11'),_0x41e330,_0xd8a565[_0x20e8('0x15')][_0x20e8('0x16')]);return _0xcb15ce(_0xd8a565[_0x20e8('0x15')][_0x20e8('0x16')]);}logger[_0x20e8('0x15')](_0x20e8('0x11'),_0x41e330,_0xd8a565[_0x20e8('0x15')]['message']);return _0x14efef(_0xd8a565['error']['message']);}else{logger[_0x20e8('0x10')]('MailAccount,\x20%s,\x20%s',_0x41e330,_0x20e8('0x12'));_0x14efef(_0xd8a565[_0x20e8('0x17')]['message']);}})['catch'](function(_0x1de456){logger[_0x20e8('0x15')](_0x20e8('0x11'),_0x41e330,_0x1de456);_0xcb15ce(_0x1de456);});});}function respondWithStatusCode(_0x38552e,_0x475ac0){_0x475ac0=_0x475ac0||0xcc;return function(_0x2e14be){if(_0x2e14be){return _0x38552e['sendStatus'](_0x475ac0);}return _0x38552e[_0x20e8('0x18')](_0x475ac0)[_0x20e8('0x19')]();};}function respondWithResult(_0x2b1b1d,_0x443145){_0x443145=_0x443145||0xc8;return function(_0x4f0f59){if(_0x4f0f59){return _0x2b1b1d[_0x20e8('0x18')](_0x443145)[_0x20e8('0x1a')](_0x4f0f59);}};}function respondWithFilteredResult(_0x2a5d2b,_0x213cb6){return function(_0x2153c1){if(_0x2153c1){var _0xc7c266=typeof _0x213cb6[_0x20e8('0x1b')]===_0x20e8('0x1c')&&typeof _0x213cb6[_0x20e8('0x1d')]==='undefined';var _0x2bb4f9=_0x2153c1['count'];var _0x81452a=_0xc7c266?0x0:_0x213cb6[_0x20e8('0x1b')];var _0x54a3ff=_0xc7c266?_0x2153c1['count']:_0x213cb6[_0x20e8('0x1b')]+_0x213cb6[_0x20e8('0x1d')];var _0x363971;if(_0x54a3ff>=_0x2bb4f9){_0x54a3ff=_0x2bb4f9;_0x363971=0xc8;}else{_0x363971=0xce;}_0x2a5d2b['status'](_0x363971);return _0x2a5d2b[_0x20e8('0x1e')](_0x20e8('0x1f'),_0x81452a+'-'+_0x54a3ff+'/'+_0x2bb4f9)[_0x20e8('0x1a')](_0x2153c1);}return null;};}function saveUpdates(_0x3cb3b6){return function(_0x32caaa){if(_0x32caaa){return _0x32caaa[_0x20e8('0x20')](_0x3cb3b6)[_0x20e8('0xf')](function(_0x36d40a){return _0x36d40a;});}return null;};}function removeEntity(_0x40fa94){return function(_0xa5b895){if(_0xa5b895){return _0xa5b895[_0x20e8('0x21')]()[_0x20e8('0xf')](function(){var _0x3df2b4=_0xa5b895['get']({'plain':!![]});var _0x244a73=_0x20e8('0x22');return db[_0x20e8('0x23')][_0x20e8('0x21')]({'where':{'type':_0x244a73,'resourceId':_0x3df2b4['id']}})[_0x20e8('0xf')](function(){return _0xa5b895;});})[_0x20e8('0xf')](function(){_0x40fa94[_0x20e8('0x18')](0xcc)[_0x20e8('0x19')]();});}};}function handleEntityNotFound(_0x14eb7a){return function(_0x24c0bf){if(!_0x24c0bf){_0x14eb7a[_0x20e8('0x24')](0x194);}return _0x24c0bf;};}function handleError(_0x46de9c,_0x581d9e){_0x581d9e=_0x581d9e||0x1f4;return function(_0x179144){logger[_0x20e8('0x15')](_0x179144['stack']);if(_0x179144['name']){delete _0x179144[_0x20e8('0x25')];}_0x46de9c[_0x20e8('0x18')](_0x581d9e)[_0x20e8('0x26')](_0x179144);};}function getImapHost(_0xc87b36){switch(_0xc87b36){case _0x20e8('0x27'):return _0x20e8('0x28');case _0x20e8('0x29'):return _0x20e8('0x2a');case _0x20e8('0x2b'):return _0x20e8('0x2c');case'outlook365':return _0x20e8('0x2d');}throw new Error('Unknown\x20email\x20service\x20provider',_0xc87b36);}function getSmtpHost(_0x37ac7d){switch(_0x37ac7d){case'gmail':return _0x20e8('0x2e');case _0x20e8('0x29'):return _0x20e8('0x2f');case _0x20e8('0x2b'):return _0x20e8('0x30');case _0x20e8('0x31'):return _0x20e8('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0x37ac7d);}function getAuthenticationOptions(_0xae2361,_0x2b7bb7){var _0x1147de={};var _0x26e5b2={};if(_0xae2361){_0x1147de[_0x20e8('0x33')]=_0x26e5b2[_0x20e8('0x33')]=_0x2b7bb7[_0x20e8('0x34')];_0x1147de['password']=_0x26e5b2[_0x20e8('0x35')]=_0x2b7bb7[_0x20e8('0x36')];if(_0x2b7bb7['modernAuthentication']){_0x1147de[_0x20e8('0x37')]=_0x26e5b2[_0x20e8('0x37')]=!![];_0x1147de[_0x20e8('0x38')]=_0x26e5b2[_0x20e8('0x38')]=_0x2b7bb7[_0x20e8('0x38')];_0x1147de['password']=_0x26e5b2['pass']=null;}else{_0x1147de[_0x20e8('0x38')]=_0x26e5b2[_0x20e8('0x38')]=null;}_0x1147de[_0x20e8('0x39')]=getImapHost(_0xae2361);_0x1147de[_0x20e8('0x3a')]=0x3e1;_0x26e5b2[_0x20e8('0x39')]=getSmtpHost(_0xae2361);_0x26e5b2[_0x20e8('0x3a')]=0x24b;_0x26e5b2[_0x20e8('0x3b')]=![];_0x1147de['service']=_0x26e5b2[_0x20e8('0x3c')]=null;}else{if(_0x2b7bb7[_0x20e8('0x3d')]){_0x1147de['user']=_0x26e5b2[_0x20e8('0x33')]=_0x2b7bb7[_0x20e8('0x34')];_0x1147de[_0x20e8('0x36')]=_0x26e5b2[_0x20e8('0x35')]=_0x2b7bb7[_0x20e8('0x36')];}else{_0x1147de[_0x20e8('0x3d')]=_0x26e5b2['authentication']=![];_0x1147de[_0x20e8('0x33')]=_0x26e5b2[_0x20e8('0x33')]=null;_0x1147de[_0x20e8('0x36')]=_0x26e5b2[_0x20e8('0x35')]=null;}_0x1147de[_0x20e8('0x39')]=_0x2b7bb7[_0x20e8('0x3e')][_0x20e8('0x39')];_0x1147de[_0x20e8('0x3a')]=_0x2b7bb7[_0x20e8('0x3e')][_0x20e8('0x3a')];_0x26e5b2['host']=_0x2b7bb7['Smtp'][_0x20e8('0x39')];_0x26e5b2[_0x20e8('0x3a')]=_0x2b7bb7[_0x20e8('0x3f')][_0x20e8('0x3a')];}return{'Imap':_0x1147de,'Smtp':_0x26e5b2};}exports[_0x20e8('0x40')]=function(_0x4a20bb,_0x804319){var _0x1e95ac={'include':[{'model':db[_0x20e8('0x41')],'as':_0x20e8('0x3e')},{'model':db['MailServerOut'],'as':_0x20e8('0x3f')},{'model':db['Pause'],'as':_0x20e8('0x42')}]},_0x109da3={},_0x4944f6={'count':0x0,'rows':[]};var _0x7f1214=_[_0x20e8('0x43')](db['MailAccount'][_0x20e8('0x44')],function(_0xbec705){return{'name':_0xbec705[_0x20e8('0x45')],'type':_0xbec705['type'][_0x20e8('0x46')]};});_0x109da3[_0x20e8('0x47')]=_[_0x20e8('0x43')](_0x7f1214,'name');_0x109da3[_0x20e8('0x48')]=_['keys'](_0x4a20bb[_0x20e8('0x48')]);_0x109da3[_0x20e8('0x49')]=_[_0x20e8('0x4a')](_0x109da3[_0x20e8('0x47')],_0x109da3[_0x20e8('0x48')]);_0x1e95ac[_0x20e8('0x4b')]=_[_0x20e8('0x4a')](_0x109da3[_0x20e8('0x47')],qs['fields'](_0x4a20bb[_0x20e8('0x48')]['fields']));_0x1e95ac['attributes']=_0x1e95ac['attributes'][_0x20e8('0x4c')]?_0x1e95ac['attributes']:_0x109da3[_0x20e8('0x47')];if(!_0x4a20bb[_0x20e8('0x48')][_0x20e8('0x4d')](_0x20e8('0x4e'))){_0x1e95ac[_0x20e8('0x1d')]=qs[_0x20e8('0x1d')](_0x4a20bb[_0x20e8('0x48')][_0x20e8('0x1d')]);_0x1e95ac['offset']=qs['offset'](_0x4a20bb[_0x20e8('0x48')][_0x20e8('0x1b')]);}_0x1e95ac[_0x20e8('0x4f')]=qs[_0x20e8('0x50')](_0x4a20bb[_0x20e8('0x48')][_0x20e8('0x50')]);_0x1e95ac[_0x20e8('0x51')]=qs[_0x20e8('0x49')](_[_0x20e8('0x52')](_0x4a20bb[_0x20e8('0x48')],_0x109da3[_0x20e8('0x49')]),_0x7f1214);if(_0x4a20bb[_0x20e8('0x48')]['filter']){_0x1e95ac[_0x20e8('0x51')]=_[_0x20e8('0x53')](_0x1e95ac['where'],{'$or':_['map'](_0x7f1214,function(_0x27c953){if(_0x27c953[_0x20e8('0x54')]!==_0x20e8('0x55')){var _0x4f9d8f={};_0x4f9d8f[_0x27c953[_0x20e8('0x25')]]={'$like':'%'+_0x4a20bb[_0x20e8('0x48')][_0x20e8('0x56')]+'%'};return _0x4f9d8f;}})});}_0x1e95ac=_[_0x20e8('0x53')]({},_0x1e95ac,_0x4a20bb['options']);var _0x22e23e={'where':_0x1e95ac[_0x20e8('0x51')]};return db['MailAccount'][_0x20e8('0x57')](_0x22e23e)[_0x20e8('0xf')](function(_0x5618c5){_0x4944f6[_0x20e8('0x57')]=_0x5618c5;if(_0x4a20bb[_0x20e8('0x48')][_0x20e8('0x58')]){_0x1e95ac[_0x20e8('0x59')]=[{'all':!![]}];}return db['MailAccount'][_0x20e8('0x5a')](_0x1e95ac);})[_0x20e8('0xf')](function(_0x3e9a9d){_0x4944f6[_0x20e8('0x5b')]=_0x3e9a9d;return _0x4944f6;})[_0x20e8('0xf')](respondWithFilteredResult(_0x804319,_0x1e95ac))[_0x20e8('0x5c')](handleError(_0x804319,null));};exports[_0x20e8('0x5d')]=function(_0x434c09,_0x3a8381){var _0x406e80={'raw':![],'where':{'id':_0x434c09[_0x20e8('0x5e')]['id']},'include':[{'model':db[_0x20e8('0x41')],'as':'Imap'},{'model':db[_0x20e8('0x5f')],'as':_0x20e8('0x3f')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2d918a={};_0x2d918a['model']=_[_0x20e8('0x60')](db[_0x20e8('0x61')][_0x20e8('0x44')]);_0x2d918a[_0x20e8('0x48')]=_[_0x20e8('0x60')](_0x434c09[_0x20e8('0x48')]);_0x2d918a[_0x20e8('0x49')]=_[_0x20e8('0x4a')](_0x2d918a['model'],_0x2d918a[_0x20e8('0x48')]);_0x406e80[_0x20e8('0x4b')]=_[_0x20e8('0x4a')](_0x2d918a['model'],qs[_0x20e8('0x62')](_0x434c09['query']['fields']));_0x406e80[_0x20e8('0x4b')]=_0x406e80[_0x20e8('0x4b')][_0x20e8('0x4c')]?_0x406e80[_0x20e8('0x4b')]:_0x2d918a[_0x20e8('0x47')];if(_0x434c09[_0x20e8('0x48')][_0x20e8('0x58')]){_0x406e80['include']=[{'all':!![]}];}_0x406e80=_[_0x20e8('0x53')]({},_0x406e80,_0x434c09[_0x20e8('0x63')]);return db[_0x20e8('0x61')][_0x20e8('0x64')](_0x406e80)[_0x20e8('0xf')](handleEntityNotFound(_0x3a8381,null))[_0x20e8('0xf')](respondWithResult(_0x3a8381,null))[_0x20e8('0x5c')](handleError(_0x3a8381,null));};exports[_0x20e8('0x20')]=function(_0x544fab,_0xd8ff9b){if(_0x544fab[_0x20e8('0x65')]['id']){delete _0x544fab[_0x20e8('0x65')]['id'];}var _0x52a42a=_0x544fab[_0x20e8('0x65')][_0x20e8('0x66')]==='custom'?null:_0x544fab['body'][_0x20e8('0x66')];var _0x16868f=_0x544fab[_0x20e8('0x65')][_0x20e8('0x3e')]||{};var _0x7c47a8=_0x544fab[_0x20e8('0x65')][_0x20e8('0x3f')]||{};if(_0x52a42a){_0x16868f['host']=getImapHost(_0x52a42a);_0x16868f[_0x20e8('0x3a')]=0x3e1;_0x7c47a8[_0x20e8('0x39')]=getSmtpHost(_0x52a42a);_0x7c47a8[_0x20e8('0x3a')]=0x24b;_0x7c47a8[_0x20e8('0x3b')]=![];}if(_0x7c47a8['modernAuthentication']){_0x7c47a8[_0x20e8('0x3b')]=![];}else{_0x7c47a8[_0x20e8('0x38')]=null;}if(!_0x16868f[_0x20e8('0x37')])_0x16868f[_0x20e8('0x38')]=null;_0x544fab[_0x20e8('0x65')][_0x20e8('0x3e')]=_0x16868f;_0x544fab[_0x20e8('0x65')][_0x20e8('0x3f')]=_0x7c47a8;return db[_0x20e8('0x61')]['find']({'where':{'id':_0x544fab[_0x20e8('0x5e')]['id']},'include':[{'model':db[_0x20e8('0x41')],'as':_0x20e8('0x3e')},{'model':db[_0x20e8('0x5f')],'as':_0x20e8('0x3f')},{'model':db[_0x20e8('0x67')],'as':'mandatoryDispositionPause'}]})[_0x20e8('0xf')](handleEntityNotFound(_0xd8ff9b,null))[_0x20e8('0xf')](function(_0x4a07fd){if(!_0x4a07fd)throw new Error(_0x20e8('0x68'));if(_0x4a07fd[_0x20e8('0x3c')])delete _0x544fab[_0x20e8('0x65')][_0x20e8('0x3e')];return _0x4a07fd;})[_0x20e8('0xf')](saveUpdates(_0x544fab[_0x20e8('0x65')],null))[_0x20e8('0xf')](function(_0x76452b){if(!_0x544fab[_0x20e8('0x65')][_0x20e8('0x3e')])return _0x76452b;return db['MailServerIn'][_0x20e8('0x20')](_0x544fab[_0x20e8('0x65')][_0x20e8('0x3e')],{'where':{'MailAccountId':_0x76452b['id']}})[_0x20e8('0xf')](function(){return _0x76452b;});})[_0x20e8('0xf')](function(_0x3bba85){if(!_0x544fab['body']['Smtp'])return _0x3bba85;return db['MailServerOut']['update'](_0x544fab['body'][_0x20e8('0x3f')],{'where':{'MailAccountId':_0x3bba85['id']}})['then'](function(){return _0x3bba85;});})[_0x20e8('0xf')](respondWithResult(_0xd8ff9b,null))[_0x20e8('0x5c')](handleError(_0xd8ff9b,null));};exports[_0x20e8('0x69')]=function(_0x2d7a8e,_0x230c58){return db[_0x20e8('0x61')][_0x20e8('0x69')]()[_0x20e8('0xf')](respondWithResult(_0x230c58,null))[_0x20e8('0x5c')](handleError(_0x230c58,null));};exports['addDisposition']=function(_0x419568,_0x2c58db){if(_0x419568[_0x20e8('0x65')]['id']){delete _0x419568[_0x20e8('0x65')]['id'];}return db['MailAccount'][_0x20e8('0x64')]({'where':{'id':_0x419568[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x2c58db,null))[_0x20e8('0xf')](function(_0x3312c3){if(_0x3312c3){_0x419568[_0x20e8('0x65')][_0x20e8('0x6a')]=_0x3312c3['id'];return db['Disposition']['create'](_0x419568[_0x20e8('0x65')]);}})[_0x20e8('0xf')](respondWithResult(_0x2c58db,null))[_0x20e8('0x5c')](handleError(_0x2c58db,null));};exports[_0x20e8('0x6b')]=function(_0x3c782d,_0x33df8d){var _0x59b353={'raw':![],'where':{}};var _0x4b2bcd={};var _0x5f0b66={'count':0x0,'rows':[]};return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x3c782d[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x33df8d,null))[_0x20e8('0xf')](function(_0x6cbaf0){if(_0x6cbaf0){_0x4b2bcd[_0x20e8('0x47')]=_[_0x20e8('0x60')](db[_0x20e8('0x6d')][_0x20e8('0x44')]);_0x4b2bcd[_0x20e8('0x48')]=_[_0x20e8('0x60')](_0x3c782d[_0x20e8('0x48')]);_0x4b2bcd[_0x20e8('0x49')]=_[_0x20e8('0x4a')](_0x4b2bcd[_0x20e8('0x47')],_0x4b2bcd[_0x20e8('0x48')]);_0x59b353[_0x20e8('0x4b')]=_['intersection'](_0x4b2bcd['model'],qs[_0x20e8('0x62')](_0x3c782d[_0x20e8('0x48')]['fields']));_0x59b353[_0x20e8('0x4b')]=_0x59b353[_0x20e8('0x4b')][_0x20e8('0x4c')]?_0x59b353[_0x20e8('0x4b')]:_0x4b2bcd['model'];if(!_0x3c782d[_0x20e8('0x48')][_0x20e8('0x4d')](_0x20e8('0x4e'))){_0x59b353['limit']=qs[_0x20e8('0x1d')](_0x3c782d[_0x20e8('0x48')]['limit']);_0x59b353[_0x20e8('0x1b')]=qs[_0x20e8('0x1b')](_0x3c782d[_0x20e8('0x48')][_0x20e8('0x1b')]);}_0x59b353[_0x20e8('0x4f')]=qs[_0x20e8('0x50')](_0x3c782d[_0x20e8('0x48')][_0x20e8('0x50')]);_0x59b353[_0x20e8('0x51')]=qs[_0x20e8('0x49')](_[_0x20e8('0x52')](_0x3c782d[_0x20e8('0x48')],_0x4b2bcd[_0x20e8('0x49')]));_0x59b353[_0x20e8('0x51')]['MailAccountId']=_0x6cbaf0['id'];if(_0x3c782d['query'][_0x20e8('0x56')]){_0x59b353[_0x20e8('0x51')]=_[_0x20e8('0x53')](_0x59b353['where'],{'$or':_['map'](_0x59b353[_0x20e8('0x4b')],function(_0x53d05d){var _0x549bc7={};_0x549bc7[_0x53d05d]={'$like':'%'+_0x3c782d[_0x20e8('0x48')][_0x20e8('0x56')]+'%'};return _0x549bc7;})});}_0x59b353=_[_0x20e8('0x53')]({},_0x59b353,_0x3c782d[_0x20e8('0x63')]);return db['Disposition'][_0x20e8('0x57')]({'where':_0x59b353[_0x20e8('0x51')]})[_0x20e8('0xf')](function(_0x133c6a){_0x5f0b66['count']=_0x133c6a;if(_0x3c782d[_0x20e8('0x48')][_0x20e8('0x58')]){_0x59b353[_0x20e8('0x59')]=[{'all':!![]}];}return db[_0x20e8('0x6d')]['findAll'](_0x59b353);})[_0x20e8('0xf')](function(_0x29b670){_0x5f0b66['rows']=_0x29b670;return _0x5f0b66;});}})[_0x20e8('0xf')](respondWithFilteredResult(_0x33df8d,_0x59b353))[_0x20e8('0x5c')](handleError(_0x33df8d,null));};exports[_0x20e8('0x6e')]=function(_0x32e890,_0x9ccb84){return db['MailAccount'][_0x20e8('0x64')]({'where':{'id':_0x32e890['params']['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x9ccb84,null))[_0x20e8('0xf')](function(_0x353d57){if(_0x353d57){return _0x353d57[_0x20e8('0x6e')](_0x32e890[_0x20e8('0x48')][_0x20e8('0x6f')]);}})[_0x20e8('0xf')](respondWithStatusCode(_0x9ccb84,null))[_0x20e8('0x5c')](handleError(_0x9ccb84,null));};exports[_0x20e8('0x70')]=function(_0x48cba8,_0x12af04){if(_0x48cba8['body']['id']){delete _0x48cba8[_0x20e8('0x65')]['id'];}return db['MailAccount'][_0x20e8('0x64')]({'where':{'id':_0x48cba8[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x12af04,null))['then'](function(_0x3e94e7){if(_0x3e94e7){_0x48cba8[_0x20e8('0x65')]['MailAccountId']=_0x3e94e7['id'];return db['CannedAnswer'][_0x20e8('0x71')](_0x48cba8['body']);}})[_0x20e8('0xf')](respondWithResult(_0x12af04,null))[_0x20e8('0x5c')](handleError(_0x12af04,null));};exports[_0x20e8('0x72')]=function(_0x12e606,_0x292468){var _0x499e22={'raw':![],'where':{}};var _0x16567f={};var _0x5c691a={'count':0x0,'rows':[]};return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x12e606[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x292468,null))[_0x20e8('0xf')](function(_0x2855a9){if(_0x2855a9){_0x16567f['model']=_[_0x20e8('0x60')](db[_0x20e8('0x73')]['rawAttributes']);_0x16567f['query']=_[_0x20e8('0x60')](_0x12e606[_0x20e8('0x48')]);_0x16567f[_0x20e8('0x49')]=_[_0x20e8('0x4a')](_0x16567f[_0x20e8('0x47')],_0x16567f['query']);_0x499e22['attributes']=_[_0x20e8('0x4a')](_0x16567f['model'],qs['fields'](_0x12e606[_0x20e8('0x48')]['fields']));_0x499e22[_0x20e8('0x4b')]=_0x499e22['attributes'][_0x20e8('0x4c')]?_0x499e22[_0x20e8('0x4b')]:_0x16567f[_0x20e8('0x47')];if(!_0x12e606[_0x20e8('0x48')]['hasOwnProperty']('nolimit')){_0x499e22[_0x20e8('0x1d')]=qs[_0x20e8('0x1d')](_0x12e606[_0x20e8('0x48')]['limit']);_0x499e22[_0x20e8('0x1b')]=qs[_0x20e8('0x1b')](_0x12e606['query'][_0x20e8('0x1b')]);}_0x499e22[_0x20e8('0x4f')]=qs['sort'](_0x12e606['query'][_0x20e8('0x50')]);_0x499e22['where']=qs['filters'](_[_0x20e8('0x52')](_0x12e606['query'],_0x16567f['filters']));_0x499e22[_0x20e8('0x51')][_0x20e8('0x6a')]=_0x2855a9['id'];if(_0x12e606[_0x20e8('0x48')]['filter']){_0x499e22[_0x20e8('0x51')]=_[_0x20e8('0x53')](_0x499e22[_0x20e8('0x51')],{'$or':_[_0x20e8('0x43')](_0x499e22[_0x20e8('0x4b')],function(_0x13331e){var _0x1600eb={};_0x1600eb[_0x13331e]={'$like':'%'+_0x12e606['query']['filter']+'%'};return _0x1600eb;})});}_0x499e22=_[_0x20e8('0x53')]({},_0x499e22,_0x12e606[_0x20e8('0x63')]);return db['CannedAnswer'][_0x20e8('0x57')]({'where':_0x499e22[_0x20e8('0x51')]})[_0x20e8('0xf')](function(_0x12d89a){_0x5c691a[_0x20e8('0x57')]=_0x12d89a;if(_0x12e606[_0x20e8('0x48')][_0x20e8('0x58')]){_0x499e22['include']=[{'all':!![]}];}return db[_0x20e8('0x73')][_0x20e8('0x5a')](_0x499e22);})[_0x20e8('0xf')](function(_0xa99dc3){_0x5c691a[_0x20e8('0x5b')]=_0xa99dc3;return _0x5c691a;});}})[_0x20e8('0xf')](respondWithFilteredResult(_0x292468,_0x499e22))['catch'](handleError(_0x292468,null));};exports[_0x20e8('0x74')]=function(_0x44188c,_0x448ec4){return db['MailAccount'][_0x20e8('0x64')]({'where':{'id':_0x44188c[_0x20e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x448ec4,null))[_0x20e8('0xf')](function(_0x107fa5){if(_0x107fa5){return _0x107fa5[_0x20e8('0x74')](_0x44188c[_0x20e8('0x48')][_0x20e8('0x6f')]);}})[_0x20e8('0xf')](respondWithStatusCode(_0x448ec4,null))[_0x20e8('0x5c')](handleError(_0x448ec4,null));};exports[_0x20e8('0x71')]=function(_0x50ec79,_0x295cc2){var _0x3b8058={'name':_0x50ec79[_0x20e8('0x65')][_0x20e8('0x25')],'key':_0x50ec79['body']['key'],'provider':_0x50ec79['body'][_0x20e8('0x66')]===_0x20e8('0x75')?null:_0x50ec79['body']['provider'],'email':_0x50ec79[_0x20e8('0x65')][_0x20e8('0x76')],'ListId':_0x50ec79['body'][_0x20e8('0x77')],'active':!_[_0x20e8('0x78')](_0x50ec79[_0x20e8('0x65')][_0x20e8('0x79')])?_0x50ec79[_0x20e8('0x65')][_0x20e8('0x79')]:!![],'description':_0x50ec79[_0x20e8('0x65')][_0x20e8('0x7a')]||null};var _0x1a91da=getAuthenticationOptions(_0x3b8058[_0x20e8('0x66')],_0x50ec79['body']);_0x3b8058[_0x20e8('0x3e')]=_0x1a91da[_0x20e8('0x3e')];_0x3b8058['Smtp']=_0x1a91da[_0x20e8('0x3f')];return db[_0x20e8('0x61')]['create'](_0x3b8058,{'include':[{'model':db['MailServerOut'],'as':_0x20e8('0x3f')},{'model':db[_0x20e8('0x41')],'as':_0x20e8('0x3e')}]})[_0x20e8('0xf')](function(_0x5abd40){var _0x1fc297=_0x50ec79[_0x20e8('0x33')]['get']({'plain':!![]});if(!_0x1fc297)throw new Error(_0x20e8('0x7b'));if(_0x1fc297[_0x20e8('0x7c')]===_0x20e8('0x33')){var _0x160201=_0x5abd40[_0x20e8('0x7d')]({'plain':!![]});return db['UserProfileSection'][_0x20e8('0x64')]({'where':{'name':_0x20e8('0x22'),'userProfileId':_0x1fc297[_0x20e8('0x7e')]},'raw':!![]})[_0x20e8('0xf')](function(_0x3da467){if(_0x3da467&&_0x3da467[_0x20e8('0x7f')]===0x0){return db[_0x20e8('0x23')][_0x20e8('0x71')]({'name':_0x160201[_0x20e8('0x25')],'resourceId':_0x160201['id'],'type':_0x3da467[_0x20e8('0x25')],'sectionId':_0x3da467['id']},{})[_0x20e8('0xf')](function(){return _0x5abd40;});}else{return _0x5abd40;}})[_0x20e8('0x5c')](function(_0x25f911){logger[_0x20e8('0x15')](_0x20e8('0x80'),_0x25f911);throw _0x25f911;});}return _0x5abd40;})[_0x20e8('0xf')](respondWithResult(_0x295cc2,0xc9))[_0x20e8('0x5c')](handleError(_0x295cc2,null));};exports['getImap']=function(_0x5b98db,_0x25e1a5){return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x5b98db[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x25e1a5,null))[_0x20e8('0xf')](function(_0x4f9f16){if(_0x4f9f16){return _0x4f9f16[_0x20e8('0x81')]();}return null;})[_0x20e8('0xf')](respondWithResult(_0x25e1a5,null))[_0x20e8('0x5c')](handleError(_0x25e1a5,null));};exports[_0x20e8('0x82')]=function(_0x4bf706,_0x1072a2){if(_0x4bf706[_0x20e8('0x65')]['id']){delete _0x4bf706[_0x20e8('0x65')]['id'];}return db[_0x20e8('0x61')][_0x20e8('0x64')]({'where':{'id':_0x4bf706[_0x20e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1072a2,null))['then'](function(_0x24cac2){if(_0x24cac2){_0x4bf706['body']['MailAccountId']=_0x24cac2['id'];return db[_0x20e8('0x41')][_0x20e8('0x71')](_0x4bf706[_0x20e8('0x65')]);}})[_0x20e8('0xf')](respondWithResult(_0x1072a2,null))[_0x20e8('0x5c')](handleError(_0x1072a2,null));};exports[_0x20e8('0x83')]=function(_0x1eec74,_0x400ae3){return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x1eec74[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x400ae3,null))['then'](function(_0x57ec0d){if(_0x57ec0d){return _0x57ec0d[_0x20e8('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x400ae3,null))['catch'](handleError(_0x400ae3,null));};exports[_0x20e8('0x85')]=function(_0x2608dd,_0x523959){return db['MailAccount'][_0x20e8('0x6c')]({'where':{'id':_0x2608dd['params']['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x523959,null))[_0x20e8('0xf')](function(_0x123813){if(_0x123813){return _0x123813[_0x20e8('0x85')]();}return null;})[_0x20e8('0xf')](respondWithResult(_0x523959,null))[_0x20e8('0x5c')](handleError(_0x523959,null));};exports[_0x20e8('0x86')]=function(_0x638245,_0x344ea9){if(_0x638245[_0x20e8('0x65')]['id']){delete _0x638245[_0x20e8('0x65')]['id'];}return db[_0x20e8('0x61')][_0x20e8('0x64')]({'where':{'id':_0x638245[_0x20e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x344ea9,null))['then'](function(_0x2007f2){if(_0x2007f2){_0x638245[_0x20e8('0x65')]['MailAccountId']=_0x2007f2['id'];return db[_0x20e8('0x5f')]['create'](_0x638245[_0x20e8('0x65')]);}})[_0x20e8('0xf')](respondWithResult(_0x344ea9,null))['catch'](handleError(_0x344ea9,null));};exports['removeSmtp']=function(_0x1e2829,_0x36dde0){return db['MailAccount'][_0x20e8('0x6c')]({'where':{'id':_0x1e2829[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x36dde0,null))['then'](function(_0x25c1d9){if(_0x25c1d9){return _0x25c1d9[_0x20e8('0x87')](null);}return null;})['then'](respondWithStatusCode(_0x36dde0,null))[_0x20e8('0x5c')](handleError(_0x36dde0,null));};exports[_0x20e8('0x88')]=function(_0x5a5ee0,_0x1ce59a){return db[_0x20e8('0x89')][_0x20e8('0x64')]({'where':{'id':_0x5a5ee0[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x1ce59a,null))[_0x20e8('0xf')](function(_0x3a7650){if(_0x3a7650){return _0x3a7650[_0x20e8('0x88')](_0x5a5ee0[_0x20e8('0x65')]['ids'],_['omit'](_0x5a5ee0[_0x20e8('0x65')],[_0x20e8('0x6f'),'id'])||{});}})[_0x20e8('0xf')](respondWithResult(_0x1ce59a,null))['catch'](handleError(_0x1ce59a,null));};exports[_0x20e8('0x8a')]=function(_0x1214ef,_0x4744db){var _0x5c3712={'raw':![],'where':{}};var _0x406764={};var _0x52fe15={'count':0x0,'rows':[]};return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x1214ef[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x4744db,null))[_0x20e8('0xf')](function(_0x320e89){if(_0x320e89){_0x406764['model']=_[_0x20e8('0x60')](db[_0x20e8('0x89')]['rawAttributes']);_0x406764['query']=_[_0x20e8('0x60')](_0x1214ef[_0x20e8('0x48')]);_0x406764[_0x20e8('0x49')]=_['intersection'](_0x406764[_0x20e8('0x47')],_0x406764['query']);_0x5c3712[_0x20e8('0x4b')]=_[_0x20e8('0x4a')](_0x406764[_0x20e8('0x47')],qs['fields'](_0x1214ef[_0x20e8('0x48')][_0x20e8('0x62')]));_0x5c3712[_0x20e8('0x4b')]=_0x5c3712[_0x20e8('0x4b')]['length']?_0x5c3712['attributes']:_0x406764[_0x20e8('0x47')];if(!_0x1214ef[_0x20e8('0x48')]['hasOwnProperty'](_0x20e8('0x4e'))){_0x5c3712[_0x20e8('0x1d')]=qs[_0x20e8('0x1d')](_0x1214ef[_0x20e8('0x48')][_0x20e8('0x1d')]);_0x5c3712[_0x20e8('0x1b')]=qs[_0x20e8('0x1b')](_0x1214ef[_0x20e8('0x48')][_0x20e8('0x1b')]);}_0x5c3712['order']=qs['sort'](_0x1214ef[_0x20e8('0x48')][_0x20e8('0x50')]);_0x5c3712[_0x20e8('0x51')]=qs[_0x20e8('0x49')](_['pick'](_0x1214ef[_0x20e8('0x48')],_0x406764['filters']));_0x5c3712[_0x20e8('0x51')]['MailAccountId']=_0x320e89['id'];if(_0x1214ef[_0x20e8('0x48')][_0x20e8('0x56')]){_0x5c3712['where']=_[_0x20e8('0x53')](_0x5c3712[_0x20e8('0x51')],{'$or':_[_0x20e8('0x43')](_0x5c3712['attributes'],function(_0x366552){var _0x149303={};_0x149303[_0x366552]={'$like':'%'+_0x1214ef[_0x20e8('0x48')][_0x20e8('0x56')]+'%'};return _0x149303;})});}_0x5c3712=_[_0x20e8('0x53')]({},_0x5c3712,_0x1214ef[_0x20e8('0x63')]);return db['MailInteraction'][_0x20e8('0x57')]({'where':_0x5c3712[_0x20e8('0x51')]})[_0x20e8('0xf')](function(_0x5227bc){_0x52fe15[_0x20e8('0x57')]=_0x5227bc;if(_0x1214ef['query']['includeAll']){_0x5c3712[_0x20e8('0x59')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x20e8('0x8b'),'attributes':['name',_0x20e8('0x8c'),_0x20e8('0x8d')],'required':![]},{'model':db[_0x20e8('0x8e')],'as':'Tags','attributes':['id',_0x20e8('0x25'),_0x20e8('0x8f')],'where':_0x1214ef[_0x20e8('0x48')][_0x20e8('0x90')]?{'id':_0x1214ef[_0x20e8('0x48')][_0x20e8('0x90')]}:undefined,'required':_0x1214ef[_0x20e8('0x48')][_0x20e8('0x90')]?!![]:![]}];}return db[_0x20e8('0x89')][_0x20e8('0x5a')](_0x5c3712);})[_0x20e8('0xf')](function(_0x8d7a33){_0x52fe15[_0x20e8('0x5b')]=_0x8d7a33;return _0x52fe15;});}})[_0x20e8('0xf')](respondWithFilteredResult(_0x4744db,_0x5c3712))[_0x20e8('0x5c')](handleError(_0x4744db,null));};exports[_0x20e8('0x91')]=function addApplications(_0x189087,_0x40a0bd){var _0x5e7fe5=_0x189087[_0x20e8('0x5e')]['id'];var _0x10c67f=_0x189087[_0x20e8('0x65')];var _0x3f7a11=0xc8;var _0x2b5f08=null;return db['sequelize'][_0x20e8('0x92')]({'isolationLevel':db[_0x20e8('0x93')]['Transaction']['ISOLATION_LEVELS'][_0x20e8('0x94')]},function(_0x2c5d53){return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x5e7fe5},'transaction':_0x2c5d53})[_0x20e8('0xf')](function(_0x72ba9){if(_0x72ba9){return db[_0x20e8('0x95')][_0x20e8('0x21')]({'where':{'MailAccountId':_0x5e7fe5},'transaction':_0x2c5d53})[_0x20e8('0xf')](function(){var _0x48f976=_[_0x20e8('0x43')](_0x10c67f,function(_0x2408b5){_0x2408b5[_0x20e8('0x6a')]=_0x5e7fe5;return _0x2408b5;});return db[_0x20e8('0x95')]['bulkCreate'](_0x48f976,{'transaction':_0x2c5d53});});}else{_0x3f7a11=0x194;_0x2b5f08=[];}});})[_0x20e8('0xf')](function(){if(_0x3f7a11!==0x194){return db['MailApplication'][_0x20e8('0x96')]({'where':{'MailAccountId':_0x5e7fe5},'order':_0x20e8('0x97')})[_0x20e8('0xf')](function(_0x1b8902){_0x2b5f08=_0x1b8902;});}})[_0x20e8('0x5c')](function(_0x1dc60e){_0x3f7a11=0x1f4;logger['error'](_0x1dc60e[_0x20e8('0x98')]);if(_0x1dc60e[_0x20e8('0x25')]){delete _0x1dc60e['name'];}_0x2b5f08=_0x1dc60e;})[_0x20e8('0x99')](function(){if(_0x2b5f08===null){_0x40a0bd[_0x20e8('0x24')](_0x3f7a11);}else{if(_0x3f7a11===0x1f4){_0x40a0bd[_0x20e8('0x18')](_0x3f7a11)['send'](_0x2b5f08);}else{_0x40a0bd['status'](_0x3f7a11)[_0x20e8('0x1a')](_0x2b5f08);}}});};exports[_0x20e8('0x9a')]=function(_0x39f818,_0x46bcde){var _0x310cde={};var _0x3f2b6e={};var _0x4bf14e;var _0x30ccff;return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x39f818[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x46bcde,null))[_0x20e8('0xf')](function(_0x505aa4){if(_0x505aa4){_0x4bf14e=_0x505aa4;_0x3f2b6e[_0x20e8('0x47')]=_[_0x20e8('0x60')](db[_0x20e8('0x95')][_0x20e8('0x44')]);_0x3f2b6e[_0x20e8('0x48')]=_[_0x20e8('0x60')](_0x39f818[_0x20e8('0x48')]);_0x3f2b6e['filters']=_['intersection'](_0x3f2b6e['model'],_0x3f2b6e[_0x20e8('0x48')]);_0x310cde['attributes']=_['intersection'](_0x3f2b6e[_0x20e8('0x47')],qs[_0x20e8('0x62')](_0x39f818[_0x20e8('0x48')]['fields']));_0x310cde[_0x20e8('0x4b')]=_0x310cde['attributes'][_0x20e8('0x4c')]?_0x310cde[_0x20e8('0x4b')]:_0x3f2b6e[_0x20e8('0x47')];_0x310cde['order']=qs[_0x20e8('0x50')](_0x39f818[_0x20e8('0x48')][_0x20e8('0x50')]);_0x310cde[_0x20e8('0x51')]=qs[_0x20e8('0x49')](_[_0x20e8('0x52')](_0x39f818[_0x20e8('0x48')],_0x3f2b6e['filters']));if(_0x39f818['query'][_0x20e8('0x56')]){_0x310cde[_0x20e8('0x51')]=_[_0x20e8('0x53')](_0x310cde['where'],{'$or':_[_0x20e8('0x43')](_0x310cde[_0x20e8('0x4b')],function(_0x2efc13){var _0x441f86={};_0x441f86[_0x2efc13]={'$like':'%'+_0x39f818[_0x20e8('0x48')][_0x20e8('0x56')]+'%'};return _0x441f86;})});}_0x310cde=_[_0x20e8('0x53')]({},_0x310cde,_0x39f818[_0x20e8('0x63')]);return _0x4bf14e['getApplications'](_0x310cde);}})['then'](function(_0x57a3fa){if(_0x57a3fa){_0x30ccff=_0x57a3fa[_0x20e8('0x4c')];if(!_0x39f818[_0x20e8('0x48')][_0x20e8('0x4d')](_0x20e8('0x4e'))){_0x310cde[_0x20e8('0x1d')]=qs[_0x20e8('0x1d')](_0x39f818[_0x20e8('0x48')][_0x20e8('0x1d')]);_0x310cde['offset']=qs[_0x20e8('0x1b')](_0x39f818[_0x20e8('0x48')]['offset']);}return _0x4bf14e['getApplications'](_0x310cde);}})[_0x20e8('0xf')](function(_0x51d7db){if(_0x51d7db){return _0x51d7db?{'count':_0x30ccff,'rows':_0x51d7db}:null;}})['then'](respondWithResult(_0x46bcde,null))[_0x20e8('0x5c')](handleError(_0x46bcde,null));};exports[_0x20e8('0x9b')]=function(_0x469d3d,_0x2e8690){var _0x4ffc79={'raw':!![],'where':{}};var _0x4b1e35={};var _0x2db439={'count':0x0,'rows':[]};return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x469d3d[_0x20e8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2e8690,null))['then'](function(_0x260db8){if(_0x260db8){_0x4b1e35[_0x20e8('0x47')]=_[_0x20e8('0x60')](db[_0x20e8('0x9c')][_0x20e8('0x44')]);_0x4b1e35[_0x20e8('0x48')]=_[_0x20e8('0x60')](_0x469d3d[_0x20e8('0x48')]);_0x4b1e35[_0x20e8('0x49')]=_[_0x20e8('0x4a')](_0x4b1e35[_0x20e8('0x47')],_0x4b1e35[_0x20e8('0x48')]);_0x4ffc79['attributes']=_[_0x20e8('0x4a')](_0x4b1e35[_0x20e8('0x47')],qs[_0x20e8('0x62')](_0x469d3d[_0x20e8('0x48')][_0x20e8('0x62')]));_0x4ffc79['attributes']=_0x4ffc79['attributes'][_0x20e8('0x4c')]?_0x4ffc79['attributes']:_0x4b1e35[_0x20e8('0x47')];if(!_0x469d3d[_0x20e8('0x48')][_0x20e8('0x4d')](_0x20e8('0x4e'))){_0x4ffc79['limit']=qs['limit'](_0x469d3d[_0x20e8('0x48')]['limit']);_0x4ffc79['offset']=qs[_0x20e8('0x1b')](_0x469d3d[_0x20e8('0x48')]['offset']);}_0x4ffc79[_0x20e8('0x4f')]=qs[_0x20e8('0x50')](_0x469d3d[_0x20e8('0x48')][_0x20e8('0x50')]);_0x4ffc79[_0x20e8('0x51')]=qs['filters'](_[_0x20e8('0x52')](_0x469d3d[_0x20e8('0x48')],_0x4b1e35[_0x20e8('0x49')]));_0x4ffc79[_0x20e8('0x51')]['MailAccountId']=_0x260db8['id'];if(_0x469d3d[_0x20e8('0x48')]['filter']){_0x4ffc79['where']=_[_0x20e8('0x53')](_0x4ffc79[_0x20e8('0x51')],{'$or':_[_0x20e8('0x43')](_0x4ffc79['attributes'],function(_0x3a4ff4){var _0x5c5fb3={};_0x5c5fb3[_0x3a4ff4]={'$like':'%'+_0x469d3d[_0x20e8('0x48')][_0x20e8('0x56')]+'%'};return _0x5c5fb3;})});}if(_0x469d3d[_0x20e8('0x48')][_0x20e8('0x9d')]){var _0x45c11f=_0x469d3d[_0x20e8('0x48')][_0x20e8('0x9d')][_0x20e8('0x9e')](',');var _0x58aa69={};_0x58aa69[_0x45c11f[0x0]]={'$gte':moment(_0x45c11f[0x1])[_0x20e8('0x9f')](_0x20e8('0xa0'))};_0x4ffc79[_0x20e8('0x51')]=_[_0x20e8('0x53')](_0x4ffc79[_0x20e8('0x51')],_0x58aa69);}_0x4ffc79=_[_0x20e8('0x53')]({},_0x4ffc79,_0x469d3d['options']);return db[_0x20e8('0x9c')][_0x20e8('0x57')]({'where':_0x4ffc79['where']})[_0x20e8('0xf')](function(_0x308a50){_0x2db439[_0x20e8('0x57')]=_0x308a50;if(_0x469d3d[_0x20e8('0x48')]['includeAll']){_0x4ffc79['include']=[{'all':!![]}];}return db['MailMessage'][_0x20e8('0x5a')](_0x4ffc79);})[_0x20e8('0xf')](function(_0x46e883){if(_0x469d3d[_0x20e8('0x48')]['inlineCss']===_0x20e8('0xa1')){for(var _0x5f417d=0x0;_0x5f417d<_0x46e883[_0x20e8('0x4c')];_0x5f417d++){_0x46e883[_0x5f417d]['body']=juice(_0x46e883[_0x5f417d][_0x20e8('0x65')]);}}_0x2db439[_0x20e8('0x5b')]=_0x46e883;return _0x2db439;});}})[_0x20e8('0xf')](respondWithFilteredResult(_0x2e8690,_0x4ffc79))[_0x20e8('0x5c')](handleError(_0x2e8690,null));};exports['send']=function(_0x17457c,_0xa260df){var _0x2c8bb7,_0x5d195f={},_0x71c4a6;if(_0x17457c[_0x20e8('0x65')]['to']){_0x71c4a6=_0x17457c['body']['to'][_0x20e8('0x9e')](',')[0x0];}return db[_0x20e8('0x61')]['find']({'where':{'id':_0x17457c[_0x20e8('0x5e')]['id']},'include':[{'model':db[_0x20e8('0xa2')],'as':_0x20e8('0xa3'),'include':[{'model':db[_0x20e8('0xa4')],'as':_0x20e8('0xa5'),'where':{'email':_0x71c4a6},'limit':0x1,'order':[[_0x20e8('0xa6'),_0x20e8('0xa7')]]}]},{'model':db['MailServerOut'],'as':_0x20e8('0x3f'),'raw':!![],'include':[{'model':db[_0x20e8('0xa8')],'as':'CloudProvider','raw':!![]}]}]})[_0x20e8('0xf')](handleEntityNotFound(_0xa260df,null))[_0x20e8('0xf')](function(_0x1ac166){if(!_0x1ac166)return;_0x2c8bb7=_0x1ac166;if(!_0x1ac166['Smtp'])throw new Error(_0x20e8('0xa9'));if(_[_0x20e8('0x78')](_0x17457c['body'][_0x20e8('0xaa')])){_0x17457c[_0x20e8('0x65')][_0x20e8('0xaa')]=util[_0x20e8('0x9f')](_0x20e8('0xab'),_0x1ac166[_0x20e8('0x25')],_0x1ac166['email']||_0x1ac166[_0x20e8('0x3f')][_0x20e8('0x33')]);}if(_0x17457c[_0x20e8('0x65')]['attachments']&&_0x17457c[_0x20e8('0x65')][_0x20e8('0xac')][_0x20e8('0x4c')]){for(var _0x1cac7f=0x0;_0x1cac7f<_0x17457c['body'][_0x20e8('0xac')][_0x20e8('0x4c')];_0x1cac7f+=0x1){_0x17457c[_0x20e8('0x65')][_0x20e8('0xac')][_0x1cac7f]={'filename':_0x17457c[_0x20e8('0x65')][_0x20e8('0xac')][_0x1cac7f][_0x20e8('0x25')],'path':path[_0x20e8('0xad')](config['root'],_0x20e8('0xae'),_0x17457c[_0x20e8('0x65')][_0x20e8('0xac')][_0x1cac7f][_0x20e8('0xaf')])};}}var _0x4b4919=_0x1ac166[_0x20e8('0xb0')]();return respondWithRpcPromise(_0x20e8('0xb1'),'sendMail',{'account':_0x4b4919,'message':_0x17457c[_0x20e8('0x65')]});})['then'](function(_0x5f0564){if(!_0x5f0564)return;_0x5d195f=_0x5f0564;if(!_0x2c8bb7[_0x20e8('0xa3')])throw new Error(_0x20e8('0xb2'));if(_0x2c8bb7['List'][_0x20e8('0xa5')]['length'])return _0x2c8bb7[_0x20e8('0xa3')][_0x20e8('0xa5')][0x0];return db['CmContact']['create'](_[_0x20e8('0xb3')](_0x17457c[_0x20e8('0x65')],{'firstName':_0x17457c[_0x20e8('0x65')]['to'],'email':_0x17457c[_0x20e8('0x65')]['to'],'phone':_0x17457c[_0x20e8('0x65')]['to'],'ListId':_0x2c8bb7[_0x20e8('0x77')]}));})[_0x20e8('0xf')](function(_0x36c9be){if(!_0x36c9be)return;var _0x1f6ea9={'UserId':_0x17457c[_0x20e8('0x33')]['id'],'ContactId':_0x36c9be['id'],'MailAccountId':_0x2c8bb7['id'],'inReplyTo':_0x5d195f[_0x20e8('0xb4')],'to':_0x17457c[_0x20e8('0x65')][_0x20e8('0xaa')],'cc':_0x17457c[_0x20e8('0x65')]['cc'],'subject':_0x17457c[_0x20e8('0x65')]['subject'],'attach':_0x17457c[_0x20e8('0x65')][_0x20e8('0xb5')],'firstMsgDirection':_0x20e8('0xb6'),'lastMsgAt':moment()[_0x20e8('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x20e8('0x53')](_0x17457c['body'],{'messageId':_0x5d195f[_0x20e8('0xb4')],'sentAt':moment()[_0x20e8('0x9f')](_0x20e8('0xa0')),'read':!![],'MailAccountId':_0x2c8bb7['id'],'UserId':_0x17457c['user']['id'],'ContactId':_0x36c9be['id']})]};if(_0x17457c[_0x20e8('0x65')]['Interaction']){_0x1f6ea9=_[_0x20e8('0x53')](_0x1f6ea9,_0x17457c[_0x20e8('0x65')][_0x20e8('0xb7')]);}return db[_0x20e8('0x89')][_0x20e8('0x71')](_0x1f6ea9,{'include':[{'model':db['MailMessage'],'as':_0x20e8('0xb8')}]});})[_0x20e8('0xf')](respondWithResult(_0xa260df,null))[_0x20e8('0x5c')](handleError(_0xa260df,null));};exports[_0x20e8('0xb9')]=function(_0x216d27,_0x91de90){return db[_0x20e8('0x61')][_0x20e8('0x64')]({'where':{'id':_0x216d27['params']['id']},'include':[{'model':db[_0x20e8('0x5f')],'as':_0x20e8('0x3f'),'raw':!![],'include':[{'model':db[_0x20e8('0xa8')],'as':_0x20e8('0xa8'),'raw':!![]}]}]})[_0x20e8('0xf')](handleEntityNotFound(_0x91de90,null))[_0x20e8('0xf')](function(_0x163654){if(!_0x163654[_0x20e8('0x3f')])return;var _0x50b8ef=_0x163654[_0x20e8('0xb0')]();return respondWithRpcPromise(_0x20e8('0xba'),_0x20e8('0xb9'),{'account':_0x50b8ef});})[_0x20e8('0xf')](respondWithResult(_0x91de90,null))[_0x20e8('0x5c')](handleError(_0x91de90,null));};exports[_0x20e8('0x21')]=function(_0x3e83cd,_0x5f440a){return db[_0x20e8('0x61')]['find']({'where':{'id':_0x3e83cd[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x5f440a,null))[_0x20e8('0xf')](function(_0x1dd345){if(_0x1dd345&&_0x1dd345[_0x20e8('0x3c')]){throw new db[(_0x20e8('0xbb'))][(_0x20e8('0xbc'))](_0x20e8('0xbd'));}return _0x1dd345;})[_0x20e8('0xf')](removeEntity(_0x5f440a,null))['catch'](handleError(_0x5f440a,null));};exports['addAgents']=function(_0x3bf6b3,_0x1cb226){return db[_0x20e8('0x61')][_0x20e8('0x64')]({'where':{'id':_0x3bf6b3[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x1cb226,null))[_0x20e8('0xf')](function(_0x41545a){if(_0x41545a){return _0x41545a[_0x20e8('0xbe')](_0x3bf6b3[_0x20e8('0x65')]['ids'],_['omit'](_0x3bf6b3[_0x20e8('0x65')],[_0x20e8('0x6f'),'id'])||{})['spread'](function(_0x2a4e0e){for(var _0x21b0dc=0x0;_0x21b0dc<_0x3bf6b3[_0x20e8('0x65')]['ids'][_0x20e8('0x4c')];_0x21b0dc+=0x1){socket['emit'](_0x20e8('0xbf'),{'UserId':Number(_0x3bf6b3['body']['ids'][_0x21b0dc]),'MailAccountId':Number(_0x3bf6b3[_0x20e8('0x5e')]['id'])});}return _0x2a4e0e;});}})[_0x20e8('0xf')](respondWithResult(_0x1cb226,null))['catch'](handleError(_0x1cb226,null));};exports['removeAgents']=function(_0x4f9f3d,_0x464b11){return db['MailAccount'][_0x20e8('0x64')]({'where':{'id':_0x4f9f3d[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x464b11,null))[_0x20e8('0xf')](function(_0x3b9903){if(_0x3b9903){return _0x3b9903[_0x20e8('0xc0')](_0x4f9f3d[_0x20e8('0x48')][_0x20e8('0x6f')])[_0x20e8('0xf')](function(){if(_[_0x20e8('0xc1')](_0x4f9f3d[_0x20e8('0x48')][_0x20e8('0x6f')])){for(var _0x4796be=0x0;_0x4796be<_0x4f9f3d[_0x20e8('0x48')][_0x20e8('0x6f')]['length'];_0x4796be+=0x1){socket[_0x20e8('0xc2')](_0x20e8('0xc3'),{'UserId':Number(_0x4f9f3d[_0x20e8('0x48')][_0x20e8('0x6f')][_0x4796be]),'MailAccountId':Number(_0x4f9f3d['params']['id'])});}}else{socket[_0x20e8('0xc2')]('userMailAccount:remove',{'UserId':Number(_0x4f9f3d[_0x20e8('0x48')][_0x20e8('0x6f')]),'MailAccountId':Number(_0x4f9f3d['params']['id'])});}});}})[_0x20e8('0xf')](respondWithStatusCode(_0x464b11,null))[_0x20e8('0x5c')](handleError(_0x464b11,null));};exports[_0x20e8('0xc4')]=function(_0x257d66,_0x46d86a){var _0x294e33={};var _0x3d0fe6={};var _0x382ae1;var _0x80611;return db[_0x20e8('0x61')][_0x20e8('0x6c')]({'where':{'id':_0x257d66[_0x20e8('0x5e')]['id']}})[_0x20e8('0xf')](handleEntityNotFound(_0x46d86a,null))[_0x20e8('0xf')](function(_0x1a10b8){if(_0x1a10b8){_0x382ae1=_0x1a10b8;_0x3d0fe6[_0x20e8('0x47')]=_[_0x20e8('0x60')](db[_0x20e8('0xc5')][_0x20e8('0x44')]);_0x3d0fe6[_0x20e8('0x48')]=_[_0x20e8('0x60')](_0x257d66[_0x20e8('0x48')]);_0x3d0fe6[_0x20e8('0x49')]=_[_0x20e8('0x4a')](_0x3d0fe6['model'],_0x3d0fe6[_0x20e8('0x48')]);_0x294e33[_0x20e8('0x4b')]=_['intersection'](_0x3d0fe6[_0x20e8('0x47')],qs[_0x20e8('0x62')](_0x257d66[_0x20e8('0x48')]['fields']));_0x294e33[_0x20e8('0x4b')]=_0x294e33['attributes'][_0x20e8('0x4c')]?_0x294e33[_0x20e8('0x4b')]:_0x3d0fe6[_0x20e8('0x47')];_0x294e33[_0x20e8('0x4f')]=qs[_0x20e8('0x50')](_0x257d66[_0x20e8('0x48')][_0x20e8('0x50')]);_0x294e33['where']=qs[_0x20e8('0x49')](_['pick'](_0x257d66[_0x20e8('0x48')],_0x3d0fe6[_0x20e8('0x49')]));if(_0x257d66['query'][_0x20e8('0x56')]){_0x294e33['where']=_[_0x20e8('0x53')](_0x294e33[_0x20e8('0x51')],{'$or':_['map'](_0x294e33[_0x20e8('0x4b')],function(_0x2c5e87){var _0x560644={};_0x560644[_0x2c5e87]={'$like':'%'+_0x257d66[_0x20e8('0x48')][_0x20e8('0x56')]+'%'};return _0x560644;})});}_0x294e33=_[_0x20e8('0x53')]({},_0x294e33,_0x257d66[_0x20e8('0x63')]);return _0x382ae1[_0x20e8('0xc4')](_0x294e33);}})[_0x20e8('0xf')](function(_0x1d796c){if(_0x1d796c){_0x80611=_0x1d796c[_0x20e8('0x4c')];if(!_0x257d66[_0x20e8('0x48')]['hasOwnProperty'](_0x20e8('0x4e'))){_0x294e33[_0x20e8('0x1d')]=qs[_0x20e8('0x1d')](_0x257d66[_0x20e8('0x48')][_0x20e8('0x1d')]);_0x294e33[_0x20e8('0x1b')]=qs['offset'](_0x257d66[_0x20e8('0x48')][_0x20e8('0x1b')]);}return _0x382ae1[_0x20e8('0xc4')](_0x294e33);}})[_0x20e8('0xf')](function(_0x4824e9){if(_0x4824e9){return _0x4824e9?{'count':_0x80611,'rows':_0x4824e9}:null;}})['then'](respondWithResult(_0x46d86a,null))[_0x20e8('0x5c')](handleError(_0x46d86a,null));}; \ No newline at end of file +var _0x3757=['getDispositions','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','sort','removeAnswers','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','juice','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','destroy','sendStatus','stack','name','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','MailAccount','include','findAll','params','Pause','includeAll','find','update','body','provider','custom','mandatoryDispositionPause','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','create'];(function(_0x1fafdc,_0x55e96c){var _0x3f8801=function(_0x4f7a0f){while(--_0x4f7a0f){_0x1fafdc['push'](_0x1fafdc['shift']());}};_0x3f8801(++_0x55e96c);}(_0x3757,0x1ee));var _0x7375=function(_0x4814c5,_0x6f3000){_0x4814c5=_0x4814c5-0x0;var _0x5d8029=_0x3757[_0x4814c5];return _0x5d8029;};'use strict';var moment=require(_0x7375('0x0'));var BPromise=require(_0x7375('0x1'));var util=require(_0x7375('0x2'));var path=require('path');var _=require('lodash');var juice=require(_0x7375('0x3'));var Redis=require(_0x7375('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x7375('0x5'))(_0x7375('0x6'));var config=require('../../config/environment');var db=require(_0x7375('0x7'))['db'];config[_0x7375('0x8')]=_[_0x7375('0x9')](config[_0x7375('0x8')],{'host':_0x7375('0xa'),'port':0x18eb});var socket=require(_0x7375('0xb'))(new Redis(config[_0x7375('0x8')]));require(_0x7375('0xc'))[_0x7375('0xd')](socket);var jayson=require(_0x7375('0xe'));var client=jayson[_0x7375('0xf')][_0x7375('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x3eb425,_0x123d1f,_0x51c4ae,_0x59e114){return new BPromise(function(_0x57313a,_0x5d408d){var _0x4a4558=_0x59e114||client;return _0x4a4558[_0x7375('0x11')](_0x3eb425,_0x51c4ae)[_0x7375('0x12')](function(_0x4c3721){logger[_0x7375('0x13')](_0x7375('0x14'),_0x123d1f,_0x7375('0x15'));logger[_0x7375('0x16')](_0x7375('0x17'),_0x123d1f,'request\x20sent',JSON[_0x7375('0x18')](_0x4c3721));if(_0x4c3721[_0x7375('0x19')]){if(_0x4c3721[_0x7375('0x19')][_0x7375('0x1a')]===0x1f4){logger[_0x7375('0x19')](_0x7375('0x14'),_0x123d1f,_0x4c3721['error'][_0x7375('0x1b')]);return _0x5d408d(_0x4c3721[_0x7375('0x19')][_0x7375('0x1b')]);}logger[_0x7375('0x19')]('MailAccount,\x20%s,\x20%s',_0x123d1f,_0x4c3721['error'][_0x7375('0x1b')]);return _0x57313a(_0x4c3721[_0x7375('0x19')][_0x7375('0x1b')]);}else{logger[_0x7375('0x13')]('MailAccount,\x20%s,\x20%s',_0x123d1f,_0x7375('0x15'));_0x57313a(_0x4c3721['result'][_0x7375('0x1b')]);}})[_0x7375('0x1c')](function(_0x598123){logger[_0x7375('0x19')](_0x7375('0x14'),_0x123d1f,_0x598123);_0x5d408d(_0x598123);});});}function respondWithStatusCode(_0x6c68fa,_0x59b5c2){_0x59b5c2=_0x59b5c2||0xcc;return function(_0x4f6d01){if(_0x4f6d01){return _0x6c68fa['sendStatus'](_0x59b5c2);}return _0x6c68fa['status'](_0x59b5c2)[_0x7375('0x1d')]();};}function respondWithResult(_0x28f745,_0x3e73cb){_0x3e73cb=_0x3e73cb||0xc8;return function(_0x45033e){if(_0x45033e){return _0x28f745[_0x7375('0x1e')](_0x3e73cb)[_0x7375('0x1f')](_0x45033e);}};}function respondWithFilteredResult(_0x5035a5,_0x399ed1){return function(_0xd04d48){if(_0xd04d48){var _0x2bb1c7=typeof _0x399ed1[_0x7375('0x20')]===_0x7375('0x21')&&typeof _0x399ed1[_0x7375('0x22')]===_0x7375('0x21');var _0x4eaf00=_0xd04d48[_0x7375('0x23')];var _0x36b0ab=_0x2bb1c7?0x0:_0x399ed1[_0x7375('0x20')];var _0x4fd0e8=_0x2bb1c7?_0xd04d48[_0x7375('0x23')]:_0x399ed1['offset']+_0x399ed1['limit'];var _0x554d25;if(_0x4fd0e8>=_0x4eaf00){_0x4fd0e8=_0x4eaf00;_0x554d25=0xc8;}else{_0x554d25=0xce;}_0x5035a5['status'](_0x554d25);return _0x5035a5[_0x7375('0x24')](_0x7375('0x25'),_0x36b0ab+'-'+_0x4fd0e8+'/'+_0x4eaf00)['json'](_0xd04d48);}return null;};}function saveUpdates(_0x502320){return function(_0xfcd4c0){if(_0xfcd4c0){return _0xfcd4c0['update'](_0x502320)[_0x7375('0x12')](function(_0x39f99c){return _0x39f99c;});}return null;};}function removeEntity(_0x34b06b){return function(_0x30e0b7){if(_0x30e0b7){return _0x30e0b7[_0x7375('0x26')]()[_0x7375('0x12')](function(){var _0x412786=_0x30e0b7['get']({'plain':!![]});var _0x155856='MailAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x155856,'resourceId':_0x412786['id']}})[_0x7375('0x12')](function(){return _0x30e0b7;});})[_0x7375('0x12')](function(){_0x34b06b['status'](0xcc)[_0x7375('0x1d')]();});}};}function handleEntityNotFound(_0x2520de){return function(_0x486a7a){if(!_0x486a7a){_0x2520de[_0x7375('0x27')](0x194);}return _0x486a7a;};}function handleError(_0x4abb1b,_0x537e85){_0x537e85=_0x537e85||0x1f4;return function(_0x1bfb03){logger[_0x7375('0x19')](_0x1bfb03[_0x7375('0x28')]);if(_0x1bfb03[_0x7375('0x29')]){delete _0x1bfb03[_0x7375('0x29')];}_0x4abb1b[_0x7375('0x1e')](_0x537e85)[_0x7375('0x2a')](_0x1bfb03);};}function getImapHost(_0xdc6566){switch(_0xdc6566){case _0x7375('0x2b'):return'imap.gmail.com';case _0x7375('0x2c'):return _0x7375('0x2d');case _0x7375('0x2e'):return _0x7375('0x2f');case _0x7375('0x30'):return _0x7375('0x31');}throw new Error('Unknown\x20email\x20service\x20provider',_0xdc6566);}function getSmtpHost(_0xebd9d7){switch(_0xebd9d7){case _0x7375('0x2b'):return _0x7375('0x32');case _0x7375('0x2c'):return _0x7375('0x33');case _0x7375('0x2e'):return _0x7375('0x34');case _0x7375('0x30'):return _0x7375('0x35');}throw new Error(_0x7375('0x36'),_0xebd9d7);}function getAuthenticationOptions(_0x2c7bea,_0x4ad25b){var _0x2a2435={};var _0x52633b={};if(_0x2c7bea){_0x2a2435[_0x7375('0x37')]=_0x52633b['user']=_0x4ad25b[_0x7375('0x38')];_0x2a2435[_0x7375('0x39')]=_0x52633b[_0x7375('0x3a')]=_0x4ad25b[_0x7375('0x39')];if(_0x4ad25b['modernAuthentication']){_0x2a2435[_0x7375('0x3b')]=_0x52633b['modernAuthentication']=!![];_0x2a2435[_0x7375('0x3c')]=_0x52633b[_0x7375('0x3c')]=_0x4ad25b[_0x7375('0x3c')];_0x2a2435[_0x7375('0x39')]=_0x52633b[_0x7375('0x3a')]=null;}else{_0x2a2435['CloudProviderId']=_0x52633b[_0x7375('0x3c')]=null;}_0x2a2435[_0x7375('0x3d')]=getImapHost(_0x2c7bea);_0x2a2435[_0x7375('0x3e')]=0x3e1;_0x52633b[_0x7375('0x3d')]=getSmtpHost(_0x2c7bea);_0x52633b[_0x7375('0x3e')]=0x24b;_0x52633b[_0x7375('0x3f')]=![];_0x2a2435[_0x7375('0x40')]=_0x52633b[_0x7375('0x40')]=null;}else{if(_0x4ad25b[_0x7375('0x41')]){_0x2a2435[_0x7375('0x37')]=_0x52633b[_0x7375('0x37')]=_0x4ad25b[_0x7375('0x38')];_0x2a2435[_0x7375('0x39')]=_0x52633b[_0x7375('0x3a')]=_0x4ad25b[_0x7375('0x39')];}else{_0x2a2435[_0x7375('0x41')]=_0x52633b[_0x7375('0x41')]=![];_0x2a2435['user']=_0x52633b['user']=null;_0x2a2435[_0x7375('0x39')]=_0x52633b['pass']=null;}_0x2a2435[_0x7375('0x3d')]=_0x4ad25b[_0x7375('0x42')]['host'];_0x2a2435['port']=_0x4ad25b[_0x7375('0x42')]['port'];_0x52633b[_0x7375('0x3d')]=_0x4ad25b[_0x7375('0x43')]['host'];_0x52633b['port']=_0x4ad25b[_0x7375('0x43')]['port'];}return{'Imap':_0x2a2435,'Smtp':_0x52633b};}exports[_0x7375('0x44')]=function(_0x340fdd,_0xc0636){var _0x5e9576={'include':[{'model':db[_0x7375('0x45')],'as':_0x7375('0x42')},{'model':db[_0x7375('0x46')],'as':_0x7375('0x43')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x38151c={},_0x55784d={'count':0x0,'rows':[]};var _0x30e6d4=_[_0x7375('0x47')](db['MailAccount'][_0x7375('0x48')],function(_0x15b5e3){return{'name':_0x15b5e3[_0x7375('0x49')],'type':_0x15b5e3[_0x7375('0x4a')][_0x7375('0x4b')]};});_0x38151c['model']=_[_0x7375('0x47')](_0x30e6d4,_0x7375('0x29'));_0x38151c['query']=_[_0x7375('0x4c')](_0x340fdd[_0x7375('0x4d')]);_0x38151c['filters']=_[_0x7375('0x4e')](_0x38151c[_0x7375('0x4f')],_0x38151c[_0x7375('0x4d')]);_0x5e9576[_0x7375('0x50')]=_[_0x7375('0x4e')](_0x38151c[_0x7375('0x4f')],qs[_0x7375('0x51')](_0x340fdd[_0x7375('0x4d')][_0x7375('0x51')]));_0x5e9576['attributes']=_0x5e9576[_0x7375('0x50')][_0x7375('0x52')]?_0x5e9576['attributes']:_0x38151c[_0x7375('0x4f')];if(!_0x340fdd[_0x7375('0x4d')][_0x7375('0x53')](_0x7375('0x54'))){_0x5e9576[_0x7375('0x22')]=qs['limit'](_0x340fdd[_0x7375('0x4d')]['limit']);_0x5e9576[_0x7375('0x20')]=qs[_0x7375('0x20')](_0x340fdd[_0x7375('0x4d')][_0x7375('0x20')]);}_0x5e9576['order']=qs['sort'](_0x340fdd[_0x7375('0x4d')]['sort']);_0x5e9576[_0x7375('0x55')]=qs[_0x7375('0x56')](_[_0x7375('0x57')](_0x340fdd[_0x7375('0x4d')],_0x38151c['filters']),_0x30e6d4);if(_0x340fdd[_0x7375('0x4d')][_0x7375('0x58')]){_0x5e9576['where']=_[_0x7375('0x59')](_0x5e9576['where'],{'$or':_['map'](_0x30e6d4,function(_0x174b3b){if(_0x174b3b['type']!==_0x7375('0x5a')){var _0x2846f0={};_0x2846f0[_0x174b3b[_0x7375('0x29')]]={'$like':'%'+_0x340fdd['query'][_0x7375('0x58')]+'%'};return _0x2846f0;}})});}_0x5e9576=_['merge']({},_0x5e9576,_0x340fdd[_0x7375('0x5b')]);var _0x591d90={'where':_0x5e9576[_0x7375('0x55')]};return db[_0x7375('0x5c')][_0x7375('0x23')](_0x591d90)[_0x7375('0x12')](function(_0x2061c9){_0x55784d[_0x7375('0x23')]=_0x2061c9;if(_0x340fdd[_0x7375('0x4d')]['includeAll']){_0x5e9576[_0x7375('0x5d')]=[{'all':!![]}];}return db[_0x7375('0x5c')][_0x7375('0x5e')](_0x5e9576);})[_0x7375('0x12')](function(_0x5dad5d){_0x55784d['rows']=_0x5dad5d;return _0x55784d;})[_0x7375('0x12')](respondWithFilteredResult(_0xc0636,_0x5e9576))['catch'](handleError(_0xc0636,null));};exports['show']=function(_0x2adf89,_0x133800){var _0xd751c0={'raw':![],'where':{'id':_0x2adf89[_0x7375('0x5f')]['id']},'include':[{'model':db[_0x7375('0x45')],'as':_0x7375('0x42')},{'model':db['MailServerOut'],'as':_0x7375('0x43')},{'model':db[_0x7375('0x60')],'as':'mandatoryDispositionPause'}]},_0x2db014={};_0x2db014[_0x7375('0x4f')]=_[_0x7375('0x4c')](db[_0x7375('0x5c')][_0x7375('0x48')]);_0x2db014[_0x7375('0x4d')]=_['keys'](_0x2adf89[_0x7375('0x4d')]);_0x2db014[_0x7375('0x56')]=_[_0x7375('0x4e')](_0x2db014['model'],_0x2db014[_0x7375('0x4d')]);_0xd751c0[_0x7375('0x50')]=_[_0x7375('0x4e')](_0x2db014['model'],qs['fields'](_0x2adf89[_0x7375('0x4d')][_0x7375('0x51')]));_0xd751c0[_0x7375('0x50')]=_0xd751c0['attributes']['length']?_0xd751c0[_0x7375('0x50')]:_0x2db014[_0x7375('0x4f')];if(_0x2adf89[_0x7375('0x4d')][_0x7375('0x61')]){_0xd751c0[_0x7375('0x5d')]=[{'all':!![]}];}_0xd751c0=_[_0x7375('0x59')]({},_0xd751c0,_0x2adf89[_0x7375('0x5b')]);return db['MailAccount'][_0x7375('0x62')](_0xd751c0)[_0x7375('0x12')](handleEntityNotFound(_0x133800,null))['then'](respondWithResult(_0x133800,null))[_0x7375('0x1c')](handleError(_0x133800,null));};exports[_0x7375('0x63')]=function(_0x272ef4,_0xa96d03){if(_0x272ef4[_0x7375('0x64')]['id']){delete _0x272ef4[_0x7375('0x64')]['id'];}var _0x4f8d6f=_0x272ef4[_0x7375('0x64')][_0x7375('0x65')]===_0x7375('0x66')?null:_0x272ef4['body'][_0x7375('0x65')];var _0x292a3e=_0x272ef4[_0x7375('0x64')][_0x7375('0x42')]||{};var _0x240a4c=_0x272ef4[_0x7375('0x64')][_0x7375('0x43')]||{};if(_0x4f8d6f){_0x292a3e['host']=getImapHost(_0x4f8d6f);_0x292a3e[_0x7375('0x3e')]=0x3e1;_0x240a4c[_0x7375('0x3d')]=getSmtpHost(_0x4f8d6f);_0x240a4c[_0x7375('0x3e')]=0x24b;_0x240a4c['secure']=![];}if(_0x240a4c['modernAuthentication']){_0x240a4c['secure']=![];}else{_0x240a4c[_0x7375('0x3c')]=null;}if(!_0x292a3e['modernAuthentication'])_0x292a3e['CloudProviderId']=null;_0x272ef4[_0x7375('0x64')][_0x7375('0x42')]=_0x292a3e;_0x272ef4['body'][_0x7375('0x43')]=_0x240a4c;return db[_0x7375('0x5c')]['find']({'where':{'id':_0x272ef4[_0x7375('0x5f')]['id']},'include':[{'model':db[_0x7375('0x45')],'as':_0x7375('0x42')},{'model':db[_0x7375('0x46')],'as':_0x7375('0x43')},{'model':db[_0x7375('0x60')],'as':_0x7375('0x67')}]})['then'](handleEntityNotFound(_0xa96d03,null))[_0x7375('0x12')](function(_0x38c17e){if(!_0x38c17e)throw new Error(_0x7375('0x68'));if(_0x38c17e[_0x7375('0x40')])delete _0x272ef4['body'][_0x7375('0x42')];return _0x38c17e;})['then'](saveUpdates(_0x272ef4['body'],null))[_0x7375('0x12')](function(_0x5af360){if(!_0x272ef4['body'][_0x7375('0x42')])return _0x5af360;return db[_0x7375('0x45')][_0x7375('0x63')](_0x272ef4[_0x7375('0x64')]['Imap'],{'where':{'MailAccountId':_0x5af360['id']}})[_0x7375('0x12')](function(){return _0x5af360;});})[_0x7375('0x12')](function(_0x14ad64){if(!_0x272ef4['body']['Smtp'])return _0x14ad64;return db[_0x7375('0x46')][_0x7375('0x63')](_0x272ef4[_0x7375('0x64')][_0x7375('0x43')],{'where':{'MailAccountId':_0x14ad64['id']}})[_0x7375('0x12')](function(){return _0x14ad64;});})[_0x7375('0x12')](respondWithResult(_0xa96d03,null))[_0x7375('0x1c')](handleError(_0xa96d03,null));};exports[_0x7375('0x69')]=function(_0x37ed5b,_0x2671cd){return db['MailAccount']['describe']()[_0x7375('0x12')](respondWithResult(_0x2671cd,null))[_0x7375('0x1c')](handleError(_0x2671cd,null));};exports['addDisposition']=function(_0x4d64b9,_0x522d17){if(_0x4d64b9[_0x7375('0x64')]['id']){delete _0x4d64b9[_0x7375('0x64')]['id'];}return db[_0x7375('0x5c')][_0x7375('0x62')]({'where':{'id':_0x4d64b9['params']['id']}})['then'](handleEntityNotFound(_0x522d17,null))['then'](function(_0x5a26de){if(_0x5a26de){_0x4d64b9['body'][_0x7375('0x6a')]=_0x5a26de['id'];return db[_0x7375('0x6b')][_0x7375('0x6c')](_0x4d64b9['body']);}})[_0x7375('0x12')](respondWithResult(_0x522d17,null))[_0x7375('0x1c')](handleError(_0x522d17,null));};exports[_0x7375('0x6d')]=function(_0x126fd9,_0x29edbf){var _0x4e403b={'raw':![],'where':{}};var _0x332e27={};var _0x2b9ff6={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x126fd9[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x29edbf,null))[_0x7375('0x12')](function(_0x46e6c0){if(_0x46e6c0){_0x332e27[_0x7375('0x4f')]=_[_0x7375('0x4c')](db[_0x7375('0x6b')][_0x7375('0x48')]);_0x332e27[_0x7375('0x4d')]=_[_0x7375('0x4c')](_0x126fd9[_0x7375('0x4d')]);_0x332e27['filters']=_[_0x7375('0x4e')](_0x332e27[_0x7375('0x4f')],_0x332e27[_0x7375('0x4d')]);_0x4e403b['attributes']=_[_0x7375('0x4e')](_0x332e27[_0x7375('0x4f')],qs['fields'](_0x126fd9[_0x7375('0x4d')][_0x7375('0x51')]));_0x4e403b['attributes']=_0x4e403b['attributes'][_0x7375('0x52')]?_0x4e403b[_0x7375('0x50')]:_0x332e27[_0x7375('0x4f')];if(!_0x126fd9[_0x7375('0x4d')]['hasOwnProperty'](_0x7375('0x54'))){_0x4e403b[_0x7375('0x22')]=qs[_0x7375('0x22')](_0x126fd9[_0x7375('0x4d')][_0x7375('0x22')]);_0x4e403b[_0x7375('0x20')]=qs[_0x7375('0x20')](_0x126fd9[_0x7375('0x4d')][_0x7375('0x20')]);}_0x4e403b[_0x7375('0x6e')]=qs['sort'](_0x126fd9[_0x7375('0x4d')]['sort']);_0x4e403b[_0x7375('0x55')]=qs[_0x7375('0x56')](_[_0x7375('0x57')](_0x126fd9['query'],_0x332e27[_0x7375('0x56')]));_0x4e403b[_0x7375('0x55')][_0x7375('0x6a')]=_0x46e6c0['id'];if(_0x126fd9[_0x7375('0x4d')]['filter']){_0x4e403b[_0x7375('0x55')]=_[_0x7375('0x59')](_0x4e403b[_0x7375('0x55')],{'$or':_[_0x7375('0x47')](_0x4e403b[_0x7375('0x50')],function(_0x3a0cfd){var _0x2502fe={};_0x2502fe[_0x3a0cfd]={'$like':'%'+_0x126fd9['query']['filter']+'%'};return _0x2502fe;})});}_0x4e403b=_['merge']({},_0x4e403b,_0x126fd9[_0x7375('0x5b')]);return db[_0x7375('0x6b')][_0x7375('0x23')]({'where':_0x4e403b['where']})['then'](function(_0x4dd124){_0x2b9ff6['count']=_0x4dd124;if(_0x126fd9[_0x7375('0x4d')]['includeAll']){_0x4e403b['include']=[{'all':!![]}];}return db[_0x7375('0x6b')][_0x7375('0x5e')](_0x4e403b);})[_0x7375('0x12')](function(_0x317cf7){_0x2b9ff6[_0x7375('0x6f')]=_0x317cf7;return _0x2b9ff6;});}})[_0x7375('0x12')](respondWithFilteredResult(_0x29edbf,_0x4e403b))[_0x7375('0x1c')](handleError(_0x29edbf,null));};exports[_0x7375('0x70')]=function(_0x59dc25,_0x2e1ee8){return db[_0x7375('0x5c')][_0x7375('0x62')]({'where':{'id':_0x59dc25['params']['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x2e1ee8,null))[_0x7375('0x12')](function(_0x26c5d6){if(_0x26c5d6){return _0x26c5d6[_0x7375('0x70')](_0x59dc25[_0x7375('0x4d')][_0x7375('0x71')]);}})[_0x7375('0x12')](respondWithStatusCode(_0x2e1ee8,null))[_0x7375('0x1c')](handleError(_0x2e1ee8,null));};exports[_0x7375('0x72')]=function(_0x2f8910,_0x27414e){if(_0x2f8910[_0x7375('0x64')]['id']){delete _0x2f8910[_0x7375('0x64')]['id'];}return db['MailAccount'][_0x7375('0x62')]({'where':{'id':_0x2f8910['params']['id']}})['then'](handleEntityNotFound(_0x27414e,null))['then'](function(_0x27c0e9){if(_0x27c0e9){_0x2f8910[_0x7375('0x64')][_0x7375('0x6a')]=_0x27c0e9['id'];return db[_0x7375('0x73')][_0x7375('0x6c')](_0x2f8910['body']);}})[_0x7375('0x12')](respondWithResult(_0x27414e,null))['catch'](handleError(_0x27414e,null));};exports[_0x7375('0x74')]=function(_0x54f9f7,_0x313176){var _0x40aa55={'raw':![],'where':{}};var _0x58746e={};var _0x19765e={'count':0x0,'rows':[]};return db['MailAccount'][_0x7375('0x75')]({'where':{'id':_0x54f9f7[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x313176,null))[_0x7375('0x12')](function(_0x84ce3e){if(_0x84ce3e){_0x58746e[_0x7375('0x4f')]=_[_0x7375('0x4c')](db[_0x7375('0x73')][_0x7375('0x48')]);_0x58746e[_0x7375('0x4d')]=_[_0x7375('0x4c')](_0x54f9f7['query']);_0x58746e[_0x7375('0x56')]=_[_0x7375('0x4e')](_0x58746e[_0x7375('0x4f')],_0x58746e['query']);_0x40aa55[_0x7375('0x50')]=_['intersection'](_0x58746e[_0x7375('0x4f')],qs['fields'](_0x54f9f7[_0x7375('0x4d')]['fields']));_0x40aa55[_0x7375('0x50')]=_0x40aa55[_0x7375('0x50')][_0x7375('0x52')]?_0x40aa55['attributes']:_0x58746e['model'];if(!_0x54f9f7['query']['hasOwnProperty'](_0x7375('0x54'))){_0x40aa55[_0x7375('0x22')]=qs[_0x7375('0x22')](_0x54f9f7[_0x7375('0x4d')][_0x7375('0x22')]);_0x40aa55['offset']=qs[_0x7375('0x20')](_0x54f9f7['query']['offset']);}_0x40aa55['order']=qs[_0x7375('0x76')](_0x54f9f7[_0x7375('0x4d')][_0x7375('0x76')]);_0x40aa55['where']=qs[_0x7375('0x56')](_[_0x7375('0x57')](_0x54f9f7[_0x7375('0x4d')],_0x58746e[_0x7375('0x56')]));_0x40aa55[_0x7375('0x55')][_0x7375('0x6a')]=_0x84ce3e['id'];if(_0x54f9f7[_0x7375('0x4d')][_0x7375('0x58')]){_0x40aa55[_0x7375('0x55')]=_['merge'](_0x40aa55[_0x7375('0x55')],{'$or':_[_0x7375('0x47')](_0x40aa55[_0x7375('0x50')],function(_0x2bdd2f){var _0x227b2c={};_0x227b2c[_0x2bdd2f]={'$like':'%'+_0x54f9f7['query']['filter']+'%'};return _0x227b2c;})});}_0x40aa55=_[_0x7375('0x59')]({},_0x40aa55,_0x54f9f7['options']);return db[_0x7375('0x73')]['count']({'where':_0x40aa55[_0x7375('0x55')]})[_0x7375('0x12')](function(_0x5f4381){_0x19765e[_0x7375('0x23')]=_0x5f4381;if(_0x54f9f7['query'][_0x7375('0x61')]){_0x40aa55['include']=[{'all':!![]}];}return db[_0x7375('0x73')][_0x7375('0x5e')](_0x40aa55);})['then'](function(_0x5376ba){_0x19765e[_0x7375('0x6f')]=_0x5376ba;return _0x19765e;});}})[_0x7375('0x12')](respondWithFilteredResult(_0x313176,_0x40aa55))[_0x7375('0x1c')](handleError(_0x313176,null));};exports[_0x7375('0x77')]=function(_0x185db3,_0x23477d){return db[_0x7375('0x5c')][_0x7375('0x62')]({'where':{'id':_0x185db3[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x23477d,null))[_0x7375('0x12')](function(_0x3284fc){if(_0x3284fc){return _0x3284fc[_0x7375('0x77')](_0x185db3['query'][_0x7375('0x71')]);}})['then'](respondWithStatusCode(_0x23477d,null))['catch'](handleError(_0x23477d,null));};exports['create']=function(_0x4a2aec,_0xd4a87d){var _0x32864a={'name':_0x4a2aec[_0x7375('0x64')][_0x7375('0x29')],'key':_0x4a2aec['body'][_0x7375('0x4b')],'provider':_0x4a2aec[_0x7375('0x64')]['provider']===_0x7375('0x66')?null:_0x4a2aec[_0x7375('0x64')][_0x7375('0x65')],'email':_0x4a2aec[_0x7375('0x64')]['email'],'ListId':_0x4a2aec[_0x7375('0x64')][_0x7375('0x78')],'active':!_[_0x7375('0x79')](_0x4a2aec[_0x7375('0x64')][_0x7375('0x7a')])?_0x4a2aec['body'][_0x7375('0x7a')]:!![],'description':_0x4a2aec[_0x7375('0x64')][_0x7375('0x7b')]||null};var _0x3b3c9b=getAuthenticationOptions(_0x32864a[_0x7375('0x65')],_0x4a2aec[_0x7375('0x64')]);_0x32864a[_0x7375('0x42')]=_0x3b3c9b[_0x7375('0x42')];_0x32864a[_0x7375('0x43')]=_0x3b3c9b[_0x7375('0x43')];return db[_0x7375('0x5c')]['create'](_0x32864a,{'include':[{'model':db['MailServerOut'],'as':_0x7375('0x43')},{'model':db['MailServerIn'],'as':_0x7375('0x42')}]})['then'](function(_0x242844){var _0x4f0ffc=_0x4a2aec[_0x7375('0x37')][_0x7375('0x7c')]({'plain':!![]});if(!_0x4f0ffc)throw new Error(_0x7375('0x7d'));if(_0x4f0ffc[_0x7375('0x7e')]==='user'){var _0x30adcb=_0x242844[_0x7375('0x7c')]({'plain':!![]});return db[_0x7375('0x7f')][_0x7375('0x62')]({'where':{'name':'MailAccounts','userProfileId':_0x4f0ffc[_0x7375('0x80')]},'raw':!![]})[_0x7375('0x12')](function(_0x322bda){if(_0x322bda&&_0x322bda[_0x7375('0x81')]===0x0){return db[_0x7375('0x82')][_0x7375('0x6c')]({'name':_0x30adcb['name'],'resourceId':_0x30adcb['id'],'type':_0x322bda[_0x7375('0x29')],'sectionId':_0x322bda['id']},{})[_0x7375('0x12')](function(){return _0x242844;});}else{return _0x242844;}})['catch'](function(_0x1ef8a4){logger['error'](_0x7375('0x83'),_0x1ef8a4);throw _0x1ef8a4;});}return _0x242844;})[_0x7375('0x12')](respondWithResult(_0xd4a87d,0xc9))['catch'](handleError(_0xd4a87d,null));};exports[_0x7375('0x84')]=function(_0x2cddc7,_0x8e594e){return db[_0x7375('0x5c')][_0x7375('0x75')]({'where':{'id':_0x2cddc7[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x8e594e,null))['then'](function(_0x585274){if(_0x585274){return _0x585274[_0x7375('0x84')]();}return null;})[_0x7375('0x12')](respondWithResult(_0x8e594e,null))[_0x7375('0x1c')](handleError(_0x8e594e,null));};exports[_0x7375('0x85')]=function(_0x9507a1,_0x167e34){if(_0x9507a1[_0x7375('0x64')]['id']){delete _0x9507a1[_0x7375('0x64')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x9507a1[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x167e34,null))['then'](function(_0x135164){if(_0x135164){_0x9507a1[_0x7375('0x64')][_0x7375('0x6a')]=_0x135164['id'];return db[_0x7375('0x45')]['create'](_0x9507a1[_0x7375('0x64')]);}})['then'](respondWithResult(_0x167e34,null))['catch'](handleError(_0x167e34,null));};exports[_0x7375('0x86')]=function(_0x80a032,_0x4f5b66){return db[_0x7375('0x5c')][_0x7375('0x75')]({'where':{'id':_0x80a032[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x4f5b66,null))[_0x7375('0x12')](function(_0x577df7){if(_0x577df7){return _0x577df7[_0x7375('0x87')](null);}return null;})[_0x7375('0x12')](respondWithStatusCode(_0x4f5b66,null))[_0x7375('0x1c')](handleError(_0x4f5b66,null));};exports[_0x7375('0x88')]=function(_0x2681f9,_0x5ba409){return db[_0x7375('0x5c')][_0x7375('0x75')]({'where':{'id':_0x2681f9['params']['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x5ba409,null))[_0x7375('0x12')](function(_0xbd12e9){if(_0xbd12e9){return _0xbd12e9['getSmtp']();}return null;})[_0x7375('0x12')](respondWithResult(_0x5ba409,null))['catch'](handleError(_0x5ba409,null));};exports[_0x7375('0x89')]=function(_0x55eab8,_0x28b688){if(_0x55eab8[_0x7375('0x64')]['id']){delete _0x55eab8['body']['id'];}return db[_0x7375('0x5c')][_0x7375('0x62')]({'where':{'id':_0x55eab8[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x28b688,null))['then'](function(_0x573426){if(_0x573426){_0x55eab8[_0x7375('0x64')][_0x7375('0x6a')]=_0x573426['id'];return db[_0x7375('0x46')]['create'](_0x55eab8['body']);}})[_0x7375('0x12')](respondWithResult(_0x28b688,null))[_0x7375('0x1c')](handleError(_0x28b688,null));};exports[_0x7375('0x8a')]=function(_0x185f49,_0x3bf5b5){return db[_0x7375('0x5c')]['findOne']({'where':{'id':_0x185f49['params']['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x3bf5b5,null))[_0x7375('0x12')](function(_0x447204){if(_0x447204){return _0x447204[_0x7375('0x8b')](null);}return null;})[_0x7375('0x12')](respondWithStatusCode(_0x3bf5b5,null))[_0x7375('0x1c')](handleError(_0x3bf5b5,null));};exports[_0x7375('0x8c')]=function(_0x4e2b0e,_0x32baca){return db[_0x7375('0x8d')]['find']({'where':{'id':_0x4e2b0e[_0x7375('0x5f')]['id']}})['then'](handleEntityNotFound(_0x32baca,null))[_0x7375('0x12')](function(_0x16f13e){if(_0x16f13e){return _0x16f13e[_0x7375('0x8c')](_0x4e2b0e[_0x7375('0x64')]['ids'],_[_0x7375('0x8e')](_0x4e2b0e[_0x7375('0x64')],[_0x7375('0x71'),'id'])||{});}})['then'](respondWithResult(_0x32baca,null))['catch'](handleError(_0x32baca,null));};exports[_0x7375('0x8f')]=function(_0x2edff8,_0x1b9824){var _0x423962={'raw':![],'where':{}};var _0x52e013={};var _0x57ee53={'count':0x0,'rows':[]};return db[_0x7375('0x5c')]['findOne']({'where':{'id':_0x2edff8['params']['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x1b9824,null))[_0x7375('0x12')](function(_0x1a698a){if(_0x1a698a){_0x52e013[_0x7375('0x4f')]=_[_0x7375('0x4c')](db[_0x7375('0x8d')][_0x7375('0x48')]);_0x52e013[_0x7375('0x4d')]=_[_0x7375('0x4c')](_0x2edff8[_0x7375('0x4d')]);_0x52e013['filters']=_[_0x7375('0x4e')](_0x52e013[_0x7375('0x4f')],_0x52e013[_0x7375('0x4d')]);_0x423962[_0x7375('0x50')]=_[_0x7375('0x4e')](_0x52e013[_0x7375('0x4f')],qs[_0x7375('0x51')](_0x2edff8[_0x7375('0x4d')][_0x7375('0x51')]));_0x423962[_0x7375('0x50')]=_0x423962[_0x7375('0x50')][_0x7375('0x52')]?_0x423962[_0x7375('0x50')]:_0x52e013['model'];if(!_0x2edff8[_0x7375('0x4d')][_0x7375('0x53')](_0x7375('0x54'))){_0x423962[_0x7375('0x22')]=qs['limit'](_0x2edff8['query'][_0x7375('0x22')]);_0x423962[_0x7375('0x20')]=qs[_0x7375('0x20')](_0x2edff8[_0x7375('0x4d')][_0x7375('0x20')]);}_0x423962['order']=qs[_0x7375('0x76')](_0x2edff8[_0x7375('0x4d')][_0x7375('0x76')]);_0x423962['where']=qs[_0x7375('0x56')](_[_0x7375('0x57')](_0x2edff8[_0x7375('0x4d')],_0x52e013[_0x7375('0x56')]));_0x423962[_0x7375('0x55')][_0x7375('0x6a')]=_0x1a698a['id'];if(_0x2edff8[_0x7375('0x4d')][_0x7375('0x58')]){_0x423962[_0x7375('0x55')]=_['merge'](_0x423962[_0x7375('0x55')],{'$or':_[_0x7375('0x47')](_0x423962[_0x7375('0x50')],function(_0x539164){var _0x579c8a={};_0x579c8a[_0x539164]={'$like':'%'+_0x2edff8[_0x7375('0x4d')][_0x7375('0x58')]+'%'};return _0x579c8a;})});}_0x423962=_[_0x7375('0x59')]({},_0x423962,_0x2edff8[_0x7375('0x5b')]);return db[_0x7375('0x8d')]['count']({'where':_0x423962['where']})[_0x7375('0x12')](function(_0x3049c0){_0x57ee53[_0x7375('0x23')]=_0x3049c0;if(_0x2edff8[_0x7375('0x4d')][_0x7375('0x61')]){_0x423962[_0x7375('0x5d')]=[{'model':db[_0x7375('0x90')],'as':_0x7375('0x91'),'required':![]},{'model':db[_0x7375('0x92')],'as':_0x7375('0x93'),'attributes':['name','fullname',_0x7375('0x94')],'required':![]},{'model':db[_0x7375('0x95')],'as':_0x7375('0x96'),'attributes':['id',_0x7375('0x29'),_0x7375('0x97')],'where':_0x2edff8[_0x7375('0x4d')][_0x7375('0x98')]?{'id':_0x2edff8[_0x7375('0x4d')][_0x7375('0x98')]}:undefined,'required':_0x2edff8[_0x7375('0x4d')][_0x7375('0x98')]?!![]:![]}];}return db['MailInteraction'][_0x7375('0x5e')](_0x423962);})[_0x7375('0x12')](function(_0x2c445f){_0x57ee53[_0x7375('0x6f')]=_0x2c445f;return _0x57ee53;});}})[_0x7375('0x12')](respondWithFilteredResult(_0x1b9824,_0x423962))[_0x7375('0x1c')](handleError(_0x1b9824,null));};exports['addApplications']=function addApplications(_0x5a09af,_0x596a7e){var _0x3d2191=_0x5a09af[_0x7375('0x5f')]['id'];var _0x3f2972=_0x5a09af[_0x7375('0x64')];var _0x1bbd9c=0xc8;var _0x97cd9d=null;return db[_0x7375('0x99')][_0x7375('0x9a')]({'isolationLevel':db[_0x7375('0x99')][_0x7375('0x9b')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x3cd599){return db[_0x7375('0x5c')][_0x7375('0x75')]({'where':{'id':_0x3d2191},'transaction':_0x3cd599})[_0x7375('0x12')](function(_0x3e02b8){if(_0x3e02b8){return db[_0x7375('0x9c')]['destroy']({'where':{'MailAccountId':_0x3d2191},'transaction':_0x3cd599})[_0x7375('0x12')](function(){var _0x2002a0=_['map'](_0x3f2972,function(_0x50220e){_0x50220e[_0x7375('0x6a')]=_0x3d2191;return _0x50220e;});return db[_0x7375('0x9c')]['bulkCreate'](_0x2002a0,{'transaction':_0x3cd599});});}else{_0x1bbd9c=0x194;_0x97cd9d=[];}});})[_0x7375('0x12')](function(){if(_0x1bbd9c!==0x194){return db[_0x7375('0x9c')][_0x7375('0x9d')]({'where':{'MailAccountId':_0x3d2191},'order':_0x7375('0x9e')})[_0x7375('0x12')](function(_0x1dd37f){_0x97cd9d=_0x1dd37f;});}})['catch'](function(_0x392d31){_0x1bbd9c=0x1f4;logger[_0x7375('0x19')](_0x392d31[_0x7375('0x28')]);if(_0x392d31[_0x7375('0x29')]){delete _0x392d31[_0x7375('0x29')];}_0x97cd9d=_0x392d31;})[_0x7375('0x9f')](function(){if(_0x97cd9d===null){_0x596a7e['sendStatus'](_0x1bbd9c);}else{if(_0x1bbd9c===0x1f4){_0x596a7e['status'](_0x1bbd9c)[_0x7375('0x2a')](_0x97cd9d);}else{_0x596a7e[_0x7375('0x1e')](_0x1bbd9c)[_0x7375('0x1f')](_0x97cd9d);}}});};exports[_0x7375('0xa0')]=function(_0x32d75d,_0x55b9e3){var _0x15ea38={};var _0x44cce6={};var _0x5867c2;var _0x446a54;return db[_0x7375('0x5c')]['findOne']({'where':{'id':_0x32d75d[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x55b9e3,null))[_0x7375('0x12')](function(_0x2dcc75){if(_0x2dcc75){_0x5867c2=_0x2dcc75;_0x44cce6[_0x7375('0x4f')]=_[_0x7375('0x4c')](db[_0x7375('0x9c')][_0x7375('0x48')]);_0x44cce6[_0x7375('0x4d')]=_['keys'](_0x32d75d['query']);_0x44cce6['filters']=_[_0x7375('0x4e')](_0x44cce6[_0x7375('0x4f')],_0x44cce6['query']);_0x15ea38[_0x7375('0x50')]=_['intersection'](_0x44cce6[_0x7375('0x4f')],qs[_0x7375('0x51')](_0x32d75d[_0x7375('0x4d')][_0x7375('0x51')]));_0x15ea38[_0x7375('0x50')]=_0x15ea38[_0x7375('0x50')][_0x7375('0x52')]?_0x15ea38[_0x7375('0x50')]:_0x44cce6[_0x7375('0x4f')];_0x15ea38[_0x7375('0x6e')]=qs[_0x7375('0x76')](_0x32d75d[_0x7375('0x4d')][_0x7375('0x76')]);_0x15ea38[_0x7375('0x55')]=qs[_0x7375('0x56')](_['pick'](_0x32d75d['query'],_0x44cce6[_0x7375('0x56')]));if(_0x32d75d['query'][_0x7375('0x58')]){_0x15ea38['where']=_[_0x7375('0x59')](_0x15ea38['where'],{'$or':_['map'](_0x15ea38[_0x7375('0x50')],function(_0x1c17b0){var _0x321113={};_0x321113[_0x1c17b0]={'$like':'%'+_0x32d75d['query'][_0x7375('0x58')]+'%'};return _0x321113;})});}_0x15ea38=_['merge']({},_0x15ea38,_0x32d75d[_0x7375('0x5b')]);return _0x5867c2[_0x7375('0xa0')](_0x15ea38);}})[_0x7375('0x12')](function(_0x4beb93){if(_0x4beb93){_0x446a54=_0x4beb93[_0x7375('0x52')];if(!_0x32d75d['query'][_0x7375('0x53')](_0x7375('0x54'))){_0x15ea38[_0x7375('0x22')]=qs[_0x7375('0x22')](_0x32d75d[_0x7375('0x4d')][_0x7375('0x22')]);_0x15ea38[_0x7375('0x20')]=qs[_0x7375('0x20')](_0x32d75d[_0x7375('0x4d')][_0x7375('0x20')]);}return _0x5867c2[_0x7375('0xa0')](_0x15ea38);}})['then'](function(_0x4dfd83){if(_0x4dfd83){return _0x4dfd83?{'count':_0x446a54,'rows':_0x4dfd83}:null;}})[_0x7375('0x12')](respondWithResult(_0x55b9e3,null))[_0x7375('0x1c')](handleError(_0x55b9e3,null));};exports[_0x7375('0xa1')]=function(_0xb046f2,_0x1355ae){var _0x1be238={'raw':!![],'where':{}};var _0x73425f={};var _0x218038={'count':0x0,'rows':[]};return db['MailAccount'][_0x7375('0x75')]({'where':{'id':_0xb046f2[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x1355ae,null))[_0x7375('0x12')](function(_0x3f62f6){if(_0x3f62f6){_0x73425f[_0x7375('0x4f')]=_['keys'](db[_0x7375('0xa2')][_0x7375('0x48')]);_0x73425f[_0x7375('0x4d')]=_['keys'](_0xb046f2[_0x7375('0x4d')]);_0x73425f[_0x7375('0x56')]=_[_0x7375('0x4e')](_0x73425f[_0x7375('0x4f')],_0x73425f[_0x7375('0x4d')]);_0x1be238[_0x7375('0x50')]=_[_0x7375('0x4e')](_0x73425f['model'],qs[_0x7375('0x51')](_0xb046f2[_0x7375('0x4d')][_0x7375('0x51')]));_0x1be238[_0x7375('0x50')]=_0x1be238['attributes']['length']?_0x1be238['attributes']:_0x73425f['model'];if(!_0xb046f2[_0x7375('0x4d')][_0x7375('0x53')](_0x7375('0x54'))){_0x1be238[_0x7375('0x22')]=qs['limit'](_0xb046f2['query'][_0x7375('0x22')]);_0x1be238[_0x7375('0x20')]=qs[_0x7375('0x20')](_0xb046f2['query']['offset']);}_0x1be238[_0x7375('0x6e')]=qs[_0x7375('0x76')](_0xb046f2['query']['sort']);_0x1be238[_0x7375('0x55')]=qs[_0x7375('0x56')](_[_0x7375('0x57')](_0xb046f2[_0x7375('0x4d')],_0x73425f['filters']));_0x1be238[_0x7375('0x55')][_0x7375('0x6a')]=_0x3f62f6['id'];if(_0xb046f2[_0x7375('0x4d')]['filter']){_0x1be238['where']=_[_0x7375('0x59')](_0x1be238[_0x7375('0x55')],{'$or':_['map'](_0x1be238[_0x7375('0x50')],function(_0x4815f6){var _0x1121fc={};_0x1121fc[_0x4815f6]={'$like':'%'+_0xb046f2[_0x7375('0x4d')]['filter']+'%'};return _0x1121fc;})});}if(_0xb046f2[_0x7375('0x4d')]['$gte']){var _0x426f3a=_0xb046f2[_0x7375('0x4d')]['$gte'][_0x7375('0xa3')](',');var _0x42af65={};_0x42af65[_0x426f3a[0x0]]={'$gte':moment(_0x426f3a[0x1])['format'](_0x7375('0xa4'))};_0x1be238[_0x7375('0x55')]=_[_0x7375('0x59')](_0x1be238[_0x7375('0x55')],_0x42af65);}_0x1be238=_[_0x7375('0x59')]({},_0x1be238,_0xb046f2['options']);return db['MailMessage'][_0x7375('0x23')]({'where':_0x1be238[_0x7375('0x55')]})[_0x7375('0x12')](function(_0x34b082){_0x218038[_0x7375('0x23')]=_0x34b082;if(_0xb046f2['query'][_0x7375('0x61')]){_0x1be238[_0x7375('0x5d')]=[{'all':!![]}];}return db[_0x7375('0xa2')][_0x7375('0x5e')](_0x1be238);})[_0x7375('0x12')](function(_0x3b9bd9){if(_0xb046f2[_0x7375('0x4d')][_0x7375('0xa5')]===_0x7375('0xa6')){for(var _0x30703e=0x0;_0x30703e<_0x3b9bd9[_0x7375('0x52')];_0x30703e++){_0x3b9bd9[_0x30703e][_0x7375('0x64')]=juice(_0x3b9bd9[_0x30703e]['body']);}}_0x218038['rows']=_0x3b9bd9;return _0x218038;});}})['then'](respondWithFilteredResult(_0x1355ae,_0x1be238))[_0x7375('0x1c')](handleError(_0x1355ae,null));};exports[_0x7375('0x2a')]=function(_0x462397,_0x38b19f){var _0xa26944,_0x59ad0a={},_0x559635;if(_0x462397[_0x7375('0x64')]['to']){_0x559635=_0x462397['body']['to'][_0x7375('0xa3')](',')[0x0];}return db[_0x7375('0x5c')][_0x7375('0x62')]({'where':{'id':_0x462397[_0x7375('0x5f')]['id']},'include':[{'model':db[_0x7375('0xa7')],'as':_0x7375('0xa8'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x559635},'limit':0x1,'order':[['updatedAt',_0x7375('0xa9')]]}]},{'model':db['MailServerOut'],'as':_0x7375('0x43'),'raw':!![],'include':[{'model':db[_0x7375('0xaa')],'as':'CloudProvider','raw':!![]}]}]})[_0x7375('0x12')](handleEntityNotFound(_0x38b19f,null))['then'](function(_0x3a23ff){if(!_0x3a23ff)return;_0xa26944=_0x3a23ff;if(!_0x3a23ff[_0x7375('0x43')])throw new Error(_0x7375('0xab'));if(_['isNil'](_0x462397['body'][_0x7375('0xac')])){_0x462397[_0x7375('0x64')][_0x7375('0xac')]=util[_0x7375('0xad')](_0x7375('0xae'),_0x3a23ff['name'],_0x3a23ff['email']||_0x3a23ff['Smtp'][_0x7375('0x37')]);}if(_0x462397[_0x7375('0x64')]['attachments']&&_0x462397['body'][_0x7375('0xaf')]['length']){for(var _0xa8e00a=0x0;_0xa8e00a<_0x462397['body'][_0x7375('0xaf')][_0x7375('0x52')];_0xa8e00a+=0x1){_0x462397[_0x7375('0x64')]['attachments'][_0xa8e00a]={'filename':_0x462397['body'][_0x7375('0xaf')][_0xa8e00a][_0x7375('0x29')],'path':path[_0x7375('0xb0')](config[_0x7375('0xb1')],_0x7375('0xb2'),_0x462397[_0x7375('0x64')][_0x7375('0xaf')][_0xa8e00a][_0x7375('0xb3')])};}}var _0x3f7546=_0x3a23ff[_0x7375('0xb4')]();return respondWithRpcPromise(_0x7375('0xb5'),'sendMail',{'account':_0x3f7546,'message':_0x462397[_0x7375('0x64')]});})['then'](function(_0x5a75bd){if(!_0x5a75bd)return;_0x59ad0a=_0x5a75bd;if(!_0xa26944['List'])throw new Error(_0x7375('0xb6'));if(_0xa26944['List'][_0x7375('0xb7')]['length'])return _0xa26944[_0x7375('0xa8')][_0x7375('0xb7')][0x0];return db[_0x7375('0x90')]['create'](_['defaults'](_0x462397[_0x7375('0x64')],{'firstName':_0x462397[_0x7375('0x64')]['to'],'email':_0x462397[_0x7375('0x64')]['to'],'phone':_0x462397['body']['to'],'ListId':_0xa26944[_0x7375('0x78')]}));})[_0x7375('0x12')](function(_0x3317a1){if(!_0x3317a1)return;var _0x57d53d={'UserId':_0x462397[_0x7375('0x37')]['id'],'ContactId':_0x3317a1['id'],'MailAccountId':_0xa26944['id'],'inReplyTo':_0x59ad0a[_0x7375('0xb8')],'to':_0x462397['body']['from'],'cc':_0x462397[_0x7375('0x64')]['cc'],'subject':_0x462397[_0x7375('0x64')][_0x7375('0xb9')],'attach':_0x462397['body'][_0x7375('0xba')],'firstMsgDirection':_0x7375('0xbb'),'lastMsgAt':moment()[_0x7375('0xad')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x7375('0xbb'),'Messages':[_['merge'](_0x462397[_0x7375('0x64')],{'messageId':_0x59ad0a['messageId'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0xa26944['id'],'UserId':_0x462397['user']['id'],'ContactId':_0x3317a1['id']})]};if(_0x462397[_0x7375('0x64')][_0x7375('0xbc')]){_0x57d53d=_[_0x7375('0x59')](_0x57d53d,_0x462397[_0x7375('0x64')]['Interaction']);}return db[_0x7375('0x8d')][_0x7375('0x6c')](_0x57d53d,{'include':[{'model':db[_0x7375('0xa2')],'as':_0x7375('0xbd')}]});})[_0x7375('0x12')](respondWithResult(_0x38b19f,null))['catch'](handleError(_0x38b19f,null));};exports[_0x7375('0xbe')]=function(_0x3cfbe8,_0x3fe8be){return db[_0x7375('0x5c')][_0x7375('0x62')]({'where':{'id':_0x3cfbe8[_0x7375('0x5f')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x7375('0xaa')],'as':_0x7375('0xaa'),'raw':!![]}]}]})[_0x7375('0x12')](handleEntityNotFound(_0x3fe8be,null))['then'](function(_0x6985c9){if(!_0x6985c9[_0x7375('0x43')])return;var _0x84d7a=_0x6985c9[_0x7375('0xb4')]();return respondWithRpcPromise(_0x7375('0xbf'),_0x7375('0xbe'),{'account':_0x84d7a});})[_0x7375('0x12')](respondWithResult(_0x3fe8be,null))['catch'](handleError(_0x3fe8be,null));};exports[_0x7375('0x26')]=function(_0x14cbb7,_0x16cf1a){return db[_0x7375('0x5c')]['find']({'where':{'id':_0x14cbb7[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x16cf1a,null))[_0x7375('0x12')](function(_0x2baef3){if(_0x2baef3&&_0x2baef3['service']){throw new db[(_0x7375('0xc0'))][(_0x7375('0xc1'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x2baef3;})[_0x7375('0x12')](removeEntity(_0x16cf1a,null))[_0x7375('0x1c')](handleError(_0x16cf1a,null));};exports[_0x7375('0xc2')]=function(_0x491912,_0x54a857){return db['MailAccount']['find']({'where':{'id':_0x491912[_0x7375('0x5f')]['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x54a857,null))[_0x7375('0x12')](function(_0x151b6d){if(_0x151b6d){return _0x151b6d[_0x7375('0xc2')](_0x491912[_0x7375('0x64')][_0x7375('0x71')],_[_0x7375('0x8e')](_0x491912['body'],[_0x7375('0x71'),'id'])||{})[_0x7375('0xc3')](function(_0x446b0e){for(var _0x5eb51c=0x0;_0x5eb51c<_0x491912[_0x7375('0x64')][_0x7375('0x71')][_0x7375('0x52')];_0x5eb51c+=0x1){socket[_0x7375('0xc4')](_0x7375('0xc5'),{'UserId':Number(_0x491912['body'][_0x7375('0x71')][_0x5eb51c]),'MailAccountId':Number(_0x491912[_0x7375('0x5f')]['id'])});}return _0x446b0e;});}})[_0x7375('0x12')](respondWithResult(_0x54a857,null))[_0x7375('0x1c')](handleError(_0x54a857,null));};exports['removeAgents']=function(_0x5410a0,_0x24b0fc){return db[_0x7375('0x5c')]['find']({'where':{'id':_0x5410a0['params']['id']}})[_0x7375('0x12')](handleEntityNotFound(_0x24b0fc,null))[_0x7375('0x12')](function(_0x533556){if(_0x533556){return _0x533556['removeAgents'](_0x5410a0['query'][_0x7375('0x71')])['then'](function(){if(_[_0x7375('0xc6')](_0x5410a0[_0x7375('0x4d')][_0x7375('0x71')])){for(var _0x2c4640=0x0;_0x2c4640<_0x5410a0[_0x7375('0x4d')][_0x7375('0x71')]['length'];_0x2c4640+=0x1){socket[_0x7375('0xc4')](_0x7375('0xc7'),{'UserId':Number(_0x5410a0[_0x7375('0x4d')]['ids'][_0x2c4640]),'MailAccountId':Number(_0x5410a0[_0x7375('0x5f')]['id'])});}}else{socket['emit'](_0x7375('0xc7'),{'UserId':Number(_0x5410a0[_0x7375('0x4d')][_0x7375('0x71')]),'MailAccountId':Number(_0x5410a0[_0x7375('0x5f')]['id'])});}});}})[_0x7375('0x12')](respondWithStatusCode(_0x24b0fc,null))[_0x7375('0x1c')](handleError(_0x24b0fc,null));};exports[_0x7375('0xc8')]=function(_0x446564,_0x3ca6ac){var _0x107a48={};var _0x24e597={};var _0x3e37a4;var _0x555c8f;return db[_0x7375('0x5c')]['findOne']({'where':{'id':_0x446564['params']['id']}})['then'](handleEntityNotFound(_0x3ca6ac,null))['then'](function(_0x401762){if(_0x401762){_0x3e37a4=_0x401762;_0x24e597[_0x7375('0x4f')]=_['keys'](db[_0x7375('0x92')]['rawAttributes']);_0x24e597[_0x7375('0x4d')]=_[_0x7375('0x4c')](_0x446564['query']);_0x24e597[_0x7375('0x56')]=_[_0x7375('0x4e')](_0x24e597[_0x7375('0x4f')],_0x24e597[_0x7375('0x4d')]);_0x107a48[_0x7375('0x50')]=_[_0x7375('0x4e')](_0x24e597[_0x7375('0x4f')],qs[_0x7375('0x51')](_0x446564[_0x7375('0x4d')][_0x7375('0x51')]));_0x107a48[_0x7375('0x50')]=_0x107a48[_0x7375('0x50')][_0x7375('0x52')]?_0x107a48[_0x7375('0x50')]:_0x24e597['model'];_0x107a48[_0x7375('0x6e')]=qs['sort'](_0x446564[_0x7375('0x4d')][_0x7375('0x76')]);_0x107a48[_0x7375('0x55')]=qs[_0x7375('0x56')](_['pick'](_0x446564[_0x7375('0x4d')],_0x24e597[_0x7375('0x56')]));if(_0x446564[_0x7375('0x4d')][_0x7375('0x58')]){_0x107a48['where']=_[_0x7375('0x59')](_0x107a48[_0x7375('0x55')],{'$or':_[_0x7375('0x47')](_0x107a48[_0x7375('0x50')],function(_0x10f73e){var _0x45d830={};_0x45d830[_0x10f73e]={'$like':'%'+_0x446564['query']['filter']+'%'};return _0x45d830;})});}_0x107a48=_['merge']({},_0x107a48,_0x446564['options']);return _0x3e37a4['getAgents'](_0x107a48);}})[_0x7375('0x12')](function(_0x5234f1){if(_0x5234f1){_0x555c8f=_0x5234f1[_0x7375('0x52')];if(!_0x446564[_0x7375('0x4d')][_0x7375('0x53')](_0x7375('0x54'))){_0x107a48[_0x7375('0x22')]=qs[_0x7375('0x22')](_0x446564[_0x7375('0x4d')]['limit']);_0x107a48[_0x7375('0x20')]=qs[_0x7375('0x20')](_0x446564[_0x7375('0x4d')][_0x7375('0x20')]);}return _0x3e37a4[_0x7375('0xc8')](_0x107a48);}})['then'](function(_0x377a06){if(_0x377a06){return _0x377a06?{'count':_0x555c8f,'rows':_0x377a06}:null;}})[_0x7375('0x12')](respondWithResult(_0x3ca6ac,null))[_0x7375('0x1c')](handleError(_0x3ca6ac,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index be83a3e..82d528e 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 _0x8f6b=['save','update','emit','hook','events','../../mysqldb','MailAccount'];(function(_0x3763f4,_0x3e96f4){var _0x2e8dab=function(_0x3fd5c7){while(--_0x3fd5c7){_0x3763f4['push'](_0x3763f4['shift']());}};_0x2e8dab(++_0x3e96f4);}(_0x8f6b,0x146));var _0xb8f6=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x8f6b[_0x25bea7];return _0x175952;};'use strict';var EventEmitter=require(_0xb8f6('0x0'));var MailAccount=require(_0xb8f6('0x1'))['db'][_0xb8f6('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb8f6('0x3'),'afterUpdate':_0xb8f6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x36b78d){return function(_0x456df3,_0x49693f,_0x333054){MailAccountEvents['emit'](_0x36b78d+':'+_0x456df3['id'],_0x456df3);MailAccountEvents[_0xb8f6('0x5')](_0x36b78d,_0x456df3);_0x333054(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xb8f6('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x4219=['events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3ba619,_0x4a0e97){var _0x121e45=function(_0x1e3245){while(--_0x1e3245){_0x3ba619['push'](_0x3ba619['shift']());}};_0x121e45(++_0x4a0e97);}(_0x4219,0xdc));var _0x9421=function(_0x2bbf32,_0x4e63f4){_0x2bbf32=_0x2bbf32-0x0;var _0x2b9814=_0x4219[_0x2bbf32];return _0x2b9814;};'use strict';var EventEmitter=require(_0x9421('0x0'));var MailAccount=require(_0x9421('0x1'))['db'][_0x9421('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9421('0x3')](0x0);var events={'afterCreate':_0x9421('0x4'),'afterUpdate':_0x9421('0x5'),'afterDestroy':_0x9421('0x6')};function emitEvent(_0x2a80e0){return function(_0x1187f3,_0x1e344c,_0xb6c5cf){MailAccountEvents[_0x9421('0x7')](_0x2a80e0+':'+_0x1187f3['id'],_0x1187f3);MailAccountEvents[_0x9421('0x7')](_0x2a80e0,_0x1187f3);_0xb6c5cf(null);};}for(var e in events){if(events[_0x9421('0x8')](e)){var event=events[e];MailAccount[_0x9421('0x9')](e,emitEvent(event));}}module[_0x9421('0xa')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index dceeeb8..464b4c4 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 _0xb09d=['OAuth2','user','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','secure','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x2fc51d,_0x5bd035){var _0x3f3366=function(_0x1025cc){while(--_0x1025cc){_0x2fc51d['push'](_0x2fc51d['shift']());}};_0x3f3366(++_0x5bd035);}(_0xb09d,0x76));var _0xdb09=function(_0x476a6c,_0x1015c7){_0x476a6c=_0x476a6c-0x0;var _0x2c58dc=_0xb09d[_0x476a6c];return _0x2c58dc;};'use strict';var attributes=require(_0xdb09('0x0'));module[_0xdb09('0x1')]=function(_0x153e23){return _0x153e23[_0xdb09('0x2')](_0xdb09('0x3'),attributes,{'tableName':_0xdb09('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x15b1fc=this;var _0x251a83={'id':_0x15b1fc['id'],'tls':{'rejectUnauthorized':![]}};if(_0x15b1fc[_0xdb09('0x5')]!==_0xdb09('0x6')){_0x251a83[_0xdb09('0x7')]=_0x15b1fc[_0xdb09('0x5')];}else{_0x251a83[_0xdb09('0x8')]=_0x15b1fc[_0xdb09('0x9')][_0xdb09('0x8')];_0x251a83[_0xdb09('0xa')]=_0x15b1fc[_0xdb09('0x9')]['port'];_0x251a83['secure']=_0x15b1fc['Smtp'][_0xdb09('0xb')];}if(_0x15b1fc[_0xdb09('0x9')]['authentication']){if(_0x15b1fc[_0xdb09('0x9')][_0xdb09('0xc')]){if(!_0x15b1fc[_0xdb09('0x9')]['CloudProvider'])throw new Error(_0xdb09('0xd'));_0x251a83[_0xdb09('0xe')]={'type':_0xdb09('0xf'),'user':_0x15b1fc[_0xdb09('0x9')][_0xdb09('0x10')],'accessToken':_0x15b1fc[_0xdb09('0x9')]['CloudProvider'][_0xdb09('0x11')]};}else{_0x251a83[_0xdb09('0xe')]={'user':_0x15b1fc[_0xdb09('0x9')][_0xdb09('0x10')],'pass':_0x15b1fc[_0xdb09('0x9')][_0xdb09('0x12')]};}}return _0x251a83;}}});}; \ No newline at end of file +var _0x511a=['provider','custom','service','host','Smtp','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','pass','exports','define','MailAccount','mail_accounts'];(function(_0x5a5970,_0x467c50){var _0x493182=function(_0x3e85cd){while(--_0x3e85cd){_0x5a5970['push'](_0x5a5970['shift']());}};_0x493182(++_0x467c50);}(_0x511a,0x94));var _0xa511=function(_0x167db3,_0x43d0ee){_0x167db3=_0x167db3-0x0;var _0x4811dc=_0x511a[_0x167db3];return _0x4811dc;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xa511('0x0')]=function(_0x6a439d){return _0x6a439d[_0xa511('0x1')](_0xa511('0x2'),attributes,{'tableName':_0xa511('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x58f537=this;var _0x4afeb0={'id':_0x58f537['id'],'tls':{'rejectUnauthorized':![]}};if(_0x58f537[_0xa511('0x4')]!==_0xa511('0x5')){_0x4afeb0[_0xa511('0x6')]=_0x58f537[_0xa511('0x4')];}else{_0x4afeb0[_0xa511('0x7')]=_0x58f537[_0xa511('0x8')]['host'];_0x4afeb0[_0xa511('0x9')]=_0x58f537[_0xa511('0x8')]['port'];_0x4afeb0['secure']=_0x58f537[_0xa511('0x8')][_0xa511('0xa')];}if(_0x58f537['Smtp']['authentication']){if(_0x58f537[_0xa511('0x8')][_0xa511('0xb')]){if(!_0x58f537[_0xa511('0x8')][_0xa511('0xc')])throw new Error(_0xa511('0xd'));_0x4afeb0['auth']={'type':_0xa511('0xe'),'user':_0x58f537[_0xa511('0x8')][_0xa511('0xf')],'accessToken':_0x58f537['Smtp'][_0xa511('0xc')][_0xa511('0x10')]};}else{_0x4afeb0[_0xa511('0x11')]={'user':_0x58f537['Smtp']['user'],'pass':_0x58f537[_0xa511('0x8')][_0xa511('0x12')]};}}return _0x4afeb0;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 3709989..6e75890 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 _0xe0ae=['DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','getSmtpOptions','applications','orderBy','priority','autoclose','push','length','close','*,*,*,*','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','format','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','interaction','unshift','agent','name','waitForTheAssignedAgent','queueId','MailQueue','Start','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','request\x20sent','debug','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowMailAccount','find','setDataValue','smtpOptions','mail','difference','keys','CmContact','rawAttributes','createdAt','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','Contacts'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe0ae,0xa1));var _0xee0a=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0xe0ae[_0x1f1e31];return _0x229b56;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xee0a('0x0'));var rs=require(_0xee0a('0x1'));var Redis=require('ioredis');var db=require(_0xee0a('0x2'))['db'];var logger=require('../../config/logger')(_0xee0a('0x3'));var config=require(_0xee0a('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xee0a('0x5')]['http']({'port':0x232c});config['redis']=_[_0xee0a('0x6')](config[_0xee0a('0x7')],{'host':_0xee0a('0x8'),'port':0x18eb});var socket=require(_0xee0a('0x9'))(new Redis(config['redis']));require(_0xee0a('0xa'))['register'](socket);function respondWithRpcPromise(_0x4e2c89,_0x1f9d42,_0x3d0b3f){return new BPromise(function(_0xbd4483,_0x57d190){return client[_0xee0a('0xb')](_0x4e2c89,_0x3d0b3f)[_0xee0a('0xc')](function(_0x548eb7){logger[_0xee0a('0xd')]('MailAccount,\x20%s,\x20%s',_0x1f9d42,_0xee0a('0xe'));logger[_0xee0a('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1f9d42,_0xee0a('0xe'),JSON['stringify'](_0x548eb7));if(_0x548eb7[_0xee0a('0x10')]){if(_0x548eb7[_0xee0a('0x10')]['code']===0x1f4){logger['error'](_0xee0a('0x11'),_0x1f9d42,_0x548eb7[_0xee0a('0x10')][_0xee0a('0x12')]);return _0x57d190(_0x548eb7[_0xee0a('0x10')][_0xee0a('0x12')]);}logger['error'](_0xee0a('0x11'),_0x1f9d42,_0x548eb7[_0xee0a('0x10')]['message']);return _0xbd4483(_0x548eb7[_0xee0a('0x10')][_0xee0a('0x12')]);}else{logger[_0xee0a('0xd')](_0xee0a('0x11'),_0x1f9d42,'request\x20sent');_0xbd4483(_0x548eb7[_0xee0a('0x13')][_0xee0a('0x12')]);}})[_0xee0a('0x14')](function(_0x55c474){logger[_0xee0a('0x10')](_0xee0a('0x11'),_0x1f9d42,_0x55c474);_0x57d190(_0x55c474);});});}exports[_0xee0a('0x15')]=function(_0x24f8f1){var _0x5d29e0=this;return new Promise(function(_0xe9d5d4,_0x10c224){return db[_0xee0a('0x16')][_0xee0a('0x17')]({'raw':_0x24f8f1['options']?_0x24f8f1[_0xee0a('0x18')][_0xee0a('0x19')]===undefined?!![]:![]:!![],'where':_0x24f8f1[_0xee0a('0x18')]?_0x24f8f1[_0xee0a('0x18')][_0xee0a('0x1a')]||null:null,'attributes':_0x24f8f1[_0xee0a('0x18')]?_0x24f8f1[_0xee0a('0x18')]['attributes']||null:null,'limit':_0x24f8f1[_0xee0a('0x18')]?_0x24f8f1[_0xee0a('0x18')][_0xee0a('0x1b')]||null:null,'include':_0x24f8f1[_0xee0a('0x18')]?_0x24f8f1['options'][_0xee0a('0x1c')]?_[_0xee0a('0x1d')](_0x24f8f1[_0xee0a('0x18')][_0xee0a('0x1c')],function(_0x4c61e2){return{'model':db[_0x4c61e2['model']],'as':_0x4c61e2['as'],'attributes':_0x4c61e2['attributes'],'include':_0x4c61e2[_0xee0a('0x1c')]?_['map'](_0x4c61e2['include'],function(_0x1c9ad8){return{'model':db[_0x1c9ad8[_0xee0a('0x1e')]],'as':_0x1c9ad8['as'],'attributes':_0x1c9ad8[_0xee0a('0x1f')],'include':_0x1c9ad8['include']?_[_0xee0a('0x1d')](_0x1c9ad8[_0xee0a('0x1c')],function(_0x15b1c0){return{'model':db[_0x15b1c0[_0xee0a('0x1e')]],'as':_0x15b1c0['as'],'attributes':_0x15b1c0[_0xee0a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xee0a('0xc')](function(_0x145332){logger[_0xee0a('0xd')](_0xee0a('0x15'),_0x24f8f1);logger[_0xee0a('0xf')]('GetMailAccount',_0x24f8f1,JSON[_0xee0a('0x20')](_0x145332));_0xe9d5d4(_0x145332);})[_0xee0a('0x14')](function(_0x284be5){logger[_0xee0a('0x10')](_0xee0a('0x15'),_0x284be5[_0xee0a('0x12')],_0x24f8f1);_0x10c224(_0x5d29e0['error'](0x1f4,_0x284be5[_0xee0a('0x12')]));});});};exports[_0xee0a('0x21')]=function(_0x86cef4){var _0x114042=this;return new Promise(function(_0x4b9cd7,_0x354dff){return db['MailAccount'][_0xee0a('0x22')]({'raw':_0x86cef4[_0xee0a('0x18')]?_0x86cef4[_0xee0a('0x18')][_0xee0a('0x19')]===undefined?!![]:![]:!![],'where':_0x86cef4[_0xee0a('0x18')]?_0x86cef4[_0xee0a('0x18')][_0xee0a('0x1a')]||null:null,'attributes':_0x86cef4[_0xee0a('0x18')]?_0x86cef4['options'][_0xee0a('0x1f')]||null:null,'include':_0x86cef4[_0xee0a('0x18')]?_0x86cef4['options'][_0xee0a('0x1c')]?_[_0xee0a('0x1d')](_0x86cef4[_0xee0a('0x18')]['include'],function(_0x131b60){return{'model':db[_0x131b60[_0xee0a('0x1e')]],'as':_0x131b60['as'],'attributes':_0x131b60[_0xee0a('0x1f')],'include':_0x131b60['include']?_[_0xee0a('0x1d')](_0x131b60[_0xee0a('0x1c')],function(_0x340dc8){return{'model':db[_0x340dc8['model']],'as':_0x340dc8['as'],'attributes':_0x340dc8['attributes'],'include':_0x340dc8[_0xee0a('0x1c')]?_[_0xee0a('0x1d')](_0x340dc8[_0xee0a('0x1c')],function(_0x25041c){return{'model':db[_0x25041c[_0xee0a('0x1e')]],'as':_0x25041c['as'],'attributes':_0x25041c[_0xee0a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xee0a('0xc')](function(_0x616351){if(_0x86cef4[_0xee0a('0x18')]['smtp']===!![])_0x616351[_0xee0a('0x23')](_0xee0a('0x24'),_0x616351['getSmtpOptions']());logger[_0xee0a('0xd')](_0xee0a('0x21'),_0x86cef4);logger['debug'](_0xee0a('0x21'),_0x86cef4,JSON[_0xee0a('0x20')](_0x616351));_0x4b9cd7(_0x616351);})[_0xee0a('0x14')](function(_0x4393d9){logger[_0xee0a('0x10')](_0xee0a('0x21'),_0x4393d9[_0xee0a('0x12')],_0x86cef4);_0x354dff(_0x114042[_0xee0a('0x10')](0x1f4,_0x4393d9[_0xee0a('0x12')]));});});};exports['NotifyMailAccount']=function(_0x429eca){var _0x263878=this;return new Promise(function(_0x41eba8,_0xf3efee){var _0x4c87e8={'body':_0x429eca['body'],'channel':_0xee0a('0x25')};var _0x2715f7=_[_0xee0a('0x26')](_[_0xee0a('0x27')](db[_0xee0a('0x28')][_0xee0a('0x29')]),[_0xee0a('0x2a'),'updatedAt','CompanyId',_0xee0a('0x2b')]);var _0x283062=![];if(_0x429eca['body']['id']){delete _0x429eca[_0xee0a('0x2c')]['id'];}if(_[_0xee0a('0x2d')](_0x429eca['body'][_0xee0a('0x2e')])){return _0xf3efee(_0x263878[_0xee0a('0x10')](0x1f4,_0xee0a('0x2f')));}if(_[_0xee0a('0x2d')](_0x429eca[_0xee0a('0x2c')][_0xee0a('0x2c')])||_0x429eca[_0xee0a('0x2c')]['body']===''){return _0xf3efee(_0x263878['error'](0x1f4,_0xee0a('0x30')));}if(_['isNil'](_0x429eca['body']['mapKey'])){return _0xf3efee(_0x263878[_0xee0a('0x10')](0x1f4,_0xee0a('0x31')+_0x2715f7));}if(!_['includes'](_0x2715f7,_0x429eca['body']['mapKey'])){return _0xf3efee(_0x263878['error'](0x1f4,_0xee0a('0x32')+_0x2715f7));}var _0x2e687f={};_0x2e687f[_0x429eca[_0xee0a('0x2c')][_0xee0a('0x33')]]=_0x429eca[_0xee0a('0x2c')][_0xee0a('0x2e')];return db['MailAccount'][_0xee0a('0x22')]({'where':{'id':_0x429eca['account']['id']},'include':[{'model':db[_0xee0a('0x34')],'as':_0xee0a('0x35'),'include':[{'model':db[_0xee0a('0x28')],'as':_0xee0a('0x36'),'where':_0x2e687f,'limit':0x1,'order':[['updatedAt',_0xee0a('0x37')]]}]},{'model':db[_0xee0a('0x38')],'as':_0xee0a('0x39')},{'model':db[_0xee0a('0x3a')],'as':_0xee0a('0x3b'),'include':[{'model':db[_0xee0a('0x3c')],'as':_0xee0a('0x3c')}]}]})['then'](function(_0x51300e){if(_0x51300e&&_0x51300e[_0xee0a('0x35')]){var _0x2162b8=_0x51300e[_0xee0a('0x3d')]({'plain':!![]});_0x4c87e8[_0xee0a('0x3e')]=_[_0xee0a('0x3f')](_0x2162b8,[_0xee0a('0x39'),_0xee0a('0x35')]);_0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x24')]=_0x51300e[_0xee0a('0x40')]();_0x4c87e8[_0xee0a('0x41')]=_0x2162b8[_0xee0a('0x39')];_0x4c87e8['list']=_0x2162b8[_0xee0a('0x35')];_0x4c87e8[_0xee0a('0x41')]=_[_0xee0a('0x42')](_0x4c87e8[_0xee0a('0x41')],[_0xee0a('0x43')],['asc']);if(_0x4c87e8[_0xee0a('0x3e')]&&_0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x44')]){_0x4c87e8[_0xee0a('0x41')][_0xee0a('0x45')]({'id':0x0,'priority':_0x4c87e8['applications'][_0xee0a('0x46')]+0x1,'app':_0xee0a('0x47'),'appdata':_0xee0a('0x44'),'interval':_0xee0a('0x48')});}if(_0x4c87e8[_0xee0a('0x3e')]['Applications']){delete _0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x39')];}if(_0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x35')]){delete _0x4c87e8[_0xee0a('0x3e')][_0xee0a('0x35')];}if(_0x2162b8[_0xee0a('0x35')][_0xee0a('0x36')][_0xee0a('0x46')]){return _0x2162b8[_0xee0a('0x35')][_0xee0a('0x36')][0x0];}var _0x24b147=_[_0xee0a('0x6')](_0x429eca[_0xee0a('0x2c')],{'firstName':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x2e')],'ListId':_0x2162b8[_0xee0a('0x2b')]});_0x24b147[_0x429eca[_0xee0a('0x2c')][_0xee0a('0x33')]]=_0x429eca[_0xee0a('0x2c')][_0xee0a('0x2e')];return db[_0xee0a('0x28')]['create'](_0x24b147);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x35eb93){_0x4c87e8['contact']=_0x35eb93;if(_0x35eb93){if(!_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x49')]){_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x49')]=rs[_0xee0a('0x4a')]()+'\x20'+_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x2e')];}var _0x99e2b0={'ContactId':_0x35eb93['id'],'MailAccountId':_0x429eca[_0xee0a('0x3e')]['id'],'inReplyTo':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x49')],'to':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x2e')],'cc':_0x429eca[_0xee0a('0x2c')]['message']['cc'],'subject':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x4b')],'attach':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x4c')],'lastMsgAt':moment()['format'](_0xee0a('0x4d')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x429eca['account']['id']},'include':[{'model':db[_0xee0a('0x4e')],'as':_0xee0a('0x4f'),'attributes':[_0xee0a('0x49')],'where':{'messageId':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x50')]}}]})[_0xee0a('0xc')](function(_0xe583e5){if(_0xe583e5){return[_0xe583e5,![]];}return db['MailInteraction'][_0xee0a('0x51')](_0x99e2b0)['then'](function(_0x593c77){return[_0x593c77,!![]];});});}else{throw new Error(_0xee0a('0x52'));}})[_0xee0a('0x53')](function(_0x2aa5d3,_0x20f149){if(_0x2aa5d3){_0x283062=_0x20f149;if(!_0x20f149){return _0x2aa5d3[_0xee0a('0x54')]({'inReplyTo':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x49')],'to':_0x429eca['body'][_0xee0a('0x12')]['from'],'cc':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')]['cc'],'subject':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x4b')],'attach':_0x2aa5d3[_0xee0a('0x4c')]?_0x2aa5d3['attach']:_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x4c')],'substatus':null,'substatusAt':moment()['format'](_0xee0a('0x4d')),'lastMsgAt':moment()[_0xee0a('0x55')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2aa5d3;}}})[_0xee0a('0xc')](function(_0x4b76b9){_0x4c87e8['interaction']=_0x4b76b9['get']({'plain':!![]});_0x4c87e8['interaction'][_0xee0a('0x56')]=_0x283062;return db['MailMessage'][_0xee0a('0x51')]({'body':_0x429eca['body'][_0xee0a('0x2c')],'MailAccountId':_0x429eca[_0xee0a('0x3e')]['id'],'MailInteractionId':_0x4b76b9['id'],'direction':'in','ContactId':_0x4c87e8[_0xee0a('0x57')]['id'],'messageId':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x49')],'from':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x2e')],'to':_0x429eca[_0xee0a('0x2c')]['message']['to'],'cc':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')]['cc'],'subject':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x4b')],'attach':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x4c')],'Attachments':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x58')],'originTo':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x59')],'originCc':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x5a')],'bcc':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x5b')],'ChatWebsiteId':_0x429eca[_0xee0a('0x2c')][_0xee0a('0x12')][_0xee0a('0x5c')]||null,'originChannel':_0x429eca['body'][_0xee0a('0x12')][_0xee0a('0x5d')]||_0xee0a('0x5e'),'ChatOfflineMessageId':_0x429eca[_0xee0a('0x2c')]['message'][_0xee0a('0x5f')]||null},{'include':[{'model':db[_0xee0a('0x60')],'as':_0xee0a('0x61')}]});})[_0xee0a('0xc')](function(_0x23373d){_0x4c87e8['message']=_0x23373d;if(!_0x4c87e8['interaction'][_0xee0a('0x62')]){return;}return db[_0xee0a('0x63')][_0xee0a('0x22')]({'attributes':['id','name'],'where':{'id':_0x4c87e8[_0xee0a('0x64')][_0xee0a('0x62')]}});})[_0xee0a('0xc')](function(_0x319487){if(_0x319487){_0x4c87e8[_0xee0a('0x41')][_0xee0a('0x65')]({'id':0x0,'priority':0x0,'app':_0xee0a('0x66'),'appdata':_0x319487[_0xee0a('0x67')]+','+(_0x4c87e8['account'][_0xee0a('0x68')]||0xa),'interval':_0xee0a('0x48')});}if(!_0x4c87e8[_0xee0a('0x64')][_0xee0a('0x69')]){return;}return db[_0xee0a('0x6a')]['find']({'attributes':['id',_0xee0a('0x67')],'where':{'id':_0x4c87e8[_0xee0a('0x64')][_0xee0a('0x69')]}});})[_0xee0a('0xc')](function(_0x12b9db){if(_0x12b9db){_0x4c87e8['applications']['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x12b9db['name']+','+(_0x4c87e8[_0xee0a('0x3e')]['waitForTheAssignedQueue']||0x12c),'interval':_0xee0a('0x48')});}return respondWithRpcPromise(_0xee0a('0x6b'),'startRouting',_0x4c87e8);})[_0xee0a('0xc')](function(_0x59dd8b){_0x41eba8(_0x59dd8b);})[_0xee0a('0x14')](function(_0x5750bb){_0xf3efee(_0x263878[_0xee0a('0x10')](0x1f4,_0x5750bb[_0xee0a('0x12')]));});});}; \ No newline at end of file +var _0xc21e=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','raw','options','attributes','limit','include','map','model','then','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','rawAttributes','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','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','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','smtpOptions','orderBy','applications','priority','asc','autoclose','push','length','close','*,*,*,*','CmContact','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','spread','update','subject','interaction','created','MailMessage','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x74a1cd,_0x21a830){var _0x312fd5=function(_0x3dbe4a){while(--_0x3dbe4a){_0x74a1cd['push'](_0x74a1cd['shift']());}};_0x312fd5(++_0x21a830);}(_0xc21e,0x1ca));var _0xec21=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc21e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0xec21('0x0'));var BPromise=require(_0xec21('0x1'));var rs=require(_0xec21('0x2'));var Redis=require(_0xec21('0x3'));var db=require(_0xec21('0x4'))['db'];var logger=require(_0xec21('0x5'))('rpc');var config=require(_0xec21('0x6'));var jayson=require(_0xec21('0x7'));var client=jayson[_0xec21('0x8')][_0xec21('0x9')]({'port':0x232c});config[_0xec21('0xa')]=_[_0xec21('0xb')](config[_0xec21('0xa')],{'host':_0xec21('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec21('0xa')]));require(_0xec21('0xd'))[_0xec21('0xe')](socket);function respondWithRpcPromise(_0xfbab77,_0x4d478,_0x569559){return new BPromise(function(_0x110420,_0x1d5e4b){return client[_0xec21('0xf')](_0xfbab77,_0x569559)['then'](function(_0x5f059d){logger[_0xec21('0x10')](_0xec21('0x11'),_0x4d478,'request\x20sent');logger[_0xec21('0x12')](_0xec21('0x13'),_0x4d478,_0xec21('0x14'),JSON[_0xec21('0x15')](_0x5f059d));if(_0x5f059d[_0xec21('0x16')]){if(_0x5f059d['error'][_0xec21('0x17')]===0x1f4){logger['error'](_0xec21('0x11'),_0x4d478,_0x5f059d[_0xec21('0x16')][_0xec21('0x18')]);return _0x1d5e4b(_0x5f059d['error'][_0xec21('0x18')]);}logger[_0xec21('0x16')](_0xec21('0x11'),_0x4d478,_0x5f059d[_0xec21('0x16')][_0xec21('0x18')]);return _0x110420(_0x5f059d[_0xec21('0x16')][_0xec21('0x18')]);}else{logger[_0xec21('0x10')]('MailAccount,\x20%s,\x20%s',_0x4d478,_0xec21('0x14'));_0x110420(_0x5f059d[_0xec21('0x19')][_0xec21('0x18')]);}})[_0xec21('0x1a')](function(_0x3ab226){logger[_0xec21('0x16')](_0xec21('0x11'),_0x4d478,_0x3ab226);_0x1d5e4b(_0x3ab226);});});}exports[_0xec21('0x1b')]=function(_0x3c790e){var _0x350443=this;return new Promise(function(_0x4f4b12,_0x4c244b){return db[_0xec21('0x1c')][_0xec21('0x1d')]({'raw':_0x3c790e['options']?_0x3c790e['options'][_0xec21('0x1e')]===undefined?!![]:![]:!![],'where':_0x3c790e[_0xec21('0x1f')]?_0x3c790e[_0xec21('0x1f')]['where']||null:null,'attributes':_0x3c790e[_0xec21('0x1f')]?_0x3c790e[_0xec21('0x1f')][_0xec21('0x20')]||null:null,'limit':_0x3c790e['options']?_0x3c790e[_0xec21('0x1f')][_0xec21('0x21')]||null:null,'include':_0x3c790e[_0xec21('0x1f')]?_0x3c790e[_0xec21('0x1f')][_0xec21('0x22')]?_[_0xec21('0x23')](_0x3c790e['options'][_0xec21('0x22')],function(_0x26cdae){return{'model':db[_0x26cdae['model']],'as':_0x26cdae['as'],'attributes':_0x26cdae[_0xec21('0x20')],'include':_0x26cdae['include']?_[_0xec21('0x23')](_0x26cdae['include'],function(_0x4ef840){return{'model':db[_0x4ef840[_0xec21('0x24')]],'as':_0x4ef840['as'],'attributes':_0x4ef840[_0xec21('0x20')],'include':_0x4ef840[_0xec21('0x22')]?_[_0xec21('0x23')](_0x4ef840[_0xec21('0x22')],function(_0x5521e3){return{'model':db[_0x5521e3[_0xec21('0x24')]],'as':_0x5521e3['as'],'attributes':_0x5521e3['attributes']};}):[]};}):[]};}):[]:[]})[_0xec21('0x25')](function(_0x233bf9){logger[_0xec21('0x10')](_0xec21('0x1b'),_0x3c790e);logger['debug'](_0xec21('0x1b'),_0x3c790e,JSON[_0xec21('0x15')](_0x233bf9));_0x4f4b12(_0x233bf9);})[_0xec21('0x1a')](function(_0x233231){logger[_0xec21('0x16')](_0xec21('0x1b'),_0x233231[_0xec21('0x18')],_0x3c790e);_0x4c244b(_0x350443[_0xec21('0x16')](0x1f4,_0x233231[_0xec21('0x18')]));});});};exports[_0xec21('0x26')]=function(_0x43a2de){var _0x57e004=this;return new Promise(function(_0x31f861,_0x2a14aa){return db[_0xec21('0x1c')][_0xec21('0x27')]({'raw':_0x43a2de[_0xec21('0x1f')]?_0x43a2de['options'][_0xec21('0x1e')]===undefined?!![]:![]:!![],'where':_0x43a2de['options']?_0x43a2de['options']['where']||null:null,'attributes':_0x43a2de[_0xec21('0x1f')]?_0x43a2de[_0xec21('0x1f')][_0xec21('0x20')]||null:null,'include':_0x43a2de[_0xec21('0x1f')]?_0x43a2de[_0xec21('0x1f')][_0xec21('0x22')]?_[_0xec21('0x23')](_0x43a2de[_0xec21('0x1f')][_0xec21('0x22')],function(_0x1a7586){return{'model':db[_0x1a7586[_0xec21('0x24')]],'as':_0x1a7586['as'],'attributes':_0x1a7586[_0xec21('0x20')],'include':_0x1a7586['include']?_[_0xec21('0x23')](_0x1a7586[_0xec21('0x22')],function(_0x4a91a8){return{'model':db[_0x4a91a8[_0xec21('0x24')]],'as':_0x4a91a8['as'],'attributes':_0x4a91a8['attributes'],'include':_0x4a91a8['include']?_[_0xec21('0x23')](_0x4a91a8['include'],function(_0x4556c2){return{'model':db[_0x4556c2['model']],'as':_0x4556c2['as'],'attributes':_0x4556c2[_0xec21('0x20')]};}):[]};}):[]};}):[]:[]})[_0xec21('0x25')](function(_0x54b3a6){if(_0x43a2de[_0xec21('0x1f')][_0xec21('0x28')]===!![])_0x54b3a6[_0xec21('0x29')]('smtpOptions',_0x54b3a6[_0xec21('0x2a')]());logger[_0xec21('0x10')](_0xec21('0x26'),_0x43a2de);logger['debug'](_0xec21('0x26'),_0x43a2de,JSON[_0xec21('0x15')](_0x54b3a6));_0x31f861(_0x54b3a6);})[_0xec21('0x1a')](function(_0x154b8b){logger[_0xec21('0x16')]('ShowMailAccount',_0x154b8b[_0xec21('0x18')],_0x43a2de);_0x2a14aa(_0x57e004[_0xec21('0x16')](0x1f4,_0x154b8b['message']));});});};exports[_0xec21('0x2b')]=function(_0x54e642){var _0x1f0916=this;return new Promise(function(_0x18e20d,_0xf13561){var _0x49f90a={'body':_0x54e642[_0xec21('0x2c')],'channel':_0xec21('0x2d')};var _0x1093f6=_[_0xec21('0x2e')](_['keys'](db['CmContact'][_0xec21('0x2f')]),['createdAt',_0xec21('0x30'),'CompanyId',_0xec21('0x31')]);var _0x52e024=![];if(_0x54e642[_0xec21('0x2c')]['id']){delete _0x54e642[_0xec21('0x2c')]['id'];}if(_['isNil'](_0x54e642[_0xec21('0x2c')][_0xec21('0x32')])){return _0xf13561(_0x1f0916['error'](0x1f4,_0xec21('0x33')));}if(_[_0xec21('0x34')](_0x54e642[_0xec21('0x2c')][_0xec21('0x2c')])||_0x54e642[_0xec21('0x2c')][_0xec21('0x2c')]===''){return _0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0xec21('0x35')));}if(_[_0xec21('0x34')](_0x54e642['body']['mapKey'])){return _0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0xec21('0x36')+_0x1093f6));}if(!_[_0xec21('0x37')](_0x1093f6,_0x54e642['body'][_0xec21('0x38')])){return _0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0xec21('0x39')+_0x1093f6));}var _0x555d95={};_0x555d95[_0x54e642['body']['mapKey']]=_0x54e642[_0xec21('0x2c')][_0xec21('0x32')];return db[_0xec21('0x1c')][_0xec21('0x27')]({'where':{'id':_0x54e642[_0xec21('0x3a')]['id']},'include':[{'model':db[_0xec21('0x3b')],'as':_0xec21('0x3c'),'include':[{'model':db['CmContact'],'as':_0xec21('0x3d'),'where':_0x555d95,'limit':0x1,'order':[[_0xec21('0x30'),_0xec21('0x3e')]]}]},{'model':db[_0xec21('0x3f')],'as':_0xec21('0x40')},{'model':db[_0xec21('0x41')],'as':_0xec21('0x42'),'include':[{'model':db[_0xec21('0x43')],'as':'CloudProvider'}]}]})[_0xec21('0x25')](function(_0x21e67f){if(_0x21e67f&&_0x21e67f[_0xec21('0x3c')]){var _0x58e490=_0x21e67f['get']({'plain':!![]});_0x49f90a['account']=_[_0xec21('0x44')](_0x58e490,[_0xec21('0x40'),'List']);_0x49f90a[_0xec21('0x3a')][_0xec21('0x45')]=_0x21e67f[_0xec21('0x2a')]();_0x49f90a['applications']=_0x58e490[_0xec21('0x40')];_0x49f90a['list']=_0x58e490[_0xec21('0x3c')];_0x49f90a['applications']=_[_0xec21('0x46')](_0x49f90a[_0xec21('0x47')],[_0xec21('0x48')],[_0xec21('0x49')]);if(_0x49f90a[_0xec21('0x3a')]&&_0x49f90a['account'][_0xec21('0x4a')]){_0x49f90a['applications'][_0xec21('0x4b')]({'id':0x0,'priority':_0x49f90a['applications'][_0xec21('0x4c')]+0x1,'app':_0xec21('0x4d'),'appdata':_0xec21('0x4a'),'interval':_0xec21('0x4e')});}if(_0x49f90a[_0xec21('0x3a')][_0xec21('0x40')]){delete _0x49f90a['account'][_0xec21('0x40')];}if(_0x49f90a[_0xec21('0x3a')][_0xec21('0x3c')]){delete _0x49f90a[_0xec21('0x3a')]['List'];}if(_0x58e490[_0xec21('0x3c')][_0xec21('0x3d')][_0xec21('0x4c')]){return _0x58e490['List']['Contacts'][0x0];}var _0x674ba7=_['defaults'](_0x54e642[_0xec21('0x2c')],{'firstName':_0x54e642[_0xec21('0x2c')]['from'],'ListId':_0x58e490['ListId']});_0x674ba7[_0x54e642[_0xec21('0x2c')][_0xec21('0x38')]]=_0x54e642[_0xec21('0x2c')][_0xec21('0x32')];return db[_0xec21('0x4f')][_0xec21('0x50')](_0x674ba7);}else{throw new Error(_0xec21('0x51'));}})[_0xec21('0x25')](function(_0x4a5351){_0x49f90a[_0xec21('0x52')]=_0x4a5351;if(_0x4a5351){if(!_0x54e642['body'][_0xec21('0x18')]['messageId']){_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x53')]=rs[_0xec21('0x54')]()+'\x20'+_0x54e642[_0xec21('0x2c')]['message']['from'];}var _0x49cd02={'ContactId':_0x4a5351['id'],'MailAccountId':_0x54e642[_0xec21('0x3a')]['id'],'inReplyTo':_0x54e642['body'][_0xec21('0x18')][_0xec21('0x53')],'to':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x32')],'cc':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['cc'],'subject':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['subject'],'attach':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x55')],'lastMsgAt':moment()[_0xec21('0x56')](_0xec21('0x57')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x54e642[_0xec21('0x3a')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0xec21('0x53')],'where':{'messageId':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['inReplyTo']}}]})[_0xec21('0x25')](function(_0x43848f){if(_0x43848f){return[_0x43848f,![]];}return db[_0xec21('0x58')][_0xec21('0x50')](_0x49cd02)[_0xec21('0x25')](function(_0x2ae987){return[_0x2ae987,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xec21('0x59')](function(_0x1cb2b1,_0x3a4bd6){if(_0x1cb2b1){_0x52e024=_0x3a4bd6;if(!_0x3a4bd6){return _0x1cb2b1[_0xec21('0x5a')]({'inReplyTo':_0x54e642['body']['message']['messageId'],'to':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x32')],'cc':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['cc'],'subject':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x5b')],'attach':_0x1cb2b1[_0xec21('0x55')]?_0x1cb2b1[_0xec21('0x55')]:_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x55')],'substatus':null,'substatusAt':moment()[_0xec21('0x56')](_0xec21('0x57')),'lastMsgAt':moment()['format'](_0xec21('0x57')),'lastMsgDirection':'in'});}else{return _0x1cb2b1;}}})[_0xec21('0x25')](function(_0x11d9e7){_0x49f90a[_0xec21('0x5c')]=_0x11d9e7['get']({'plain':!![]});_0x49f90a['interaction'][_0xec21('0x5d')]=_0x52e024;return db[_0xec21('0x5e')][_0xec21('0x50')]({'body':_0x54e642[_0xec21('0x2c')]['body'],'MailAccountId':_0x54e642[_0xec21('0x3a')]['id'],'MailInteractionId':_0x11d9e7['id'],'direction':'in','ContactId':_0x49f90a['contact']['id'],'messageId':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x53')],'from':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['from'],'to':_0x54e642['body'][_0xec21('0x18')]['to'],'cc':_0x54e642[_0xec21('0x2c')]['message']['cc'],'subject':_0x54e642['body'][_0xec21('0x18')][_0xec21('0x5b')],'attach':_0x54e642['body']['message'][_0xec21('0x55')],'Attachments':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x5f')],'originTo':_0x54e642['body']['message'][_0xec21('0x60')],'originCc':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x61')],'bcc':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x62')],'ChatWebsiteId':_0x54e642['body']['message'][_0xec21('0x63')]||null,'originChannel':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x64')]||_0xec21('0x65'),'ChatOfflineMessageId':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x66')]||null},{'include':[{'model':db[_0xec21('0x67')],'as':'Attachments'}]});})[_0xec21('0x25')](function(_0x194287){_0x49f90a['message']=_0x194287;if(!_0x49f90a['interaction'][_0xec21('0x68')]){return;}return db[_0xec21('0x69')][_0xec21('0x27')]({'attributes':['id',_0xec21('0x6a')],'where':{'id':_0x49f90a[_0xec21('0x5c')][_0xec21('0x68')]}});})['then'](function(_0x2cb4d6){if(_0x2cb4d6){_0x49f90a[_0xec21('0x47')][_0xec21('0x6b')]({'id':0x0,'priority':0x0,'app':_0xec21('0x6c'),'appdata':_0x2cb4d6[_0xec21('0x6a')]+','+(_0x49f90a[_0xec21('0x3a')][_0xec21('0x6d')]||0xa),'interval':_0xec21('0x4e')});}if(!_0x49f90a[_0xec21('0x5c')][_0xec21('0x6e')]){return;}return db[_0xec21('0x6f')][_0xec21('0x27')]({'attributes':['id',_0xec21('0x6a')],'where':{'id':_0x49f90a[_0xec21('0x5c')]['queueId']}});})[_0xec21('0x25')](function(_0x502fb8){if(_0x502fb8){_0x49f90a[_0xec21('0x47')][_0xec21('0x6b')]({'id':0x0,'priority':0x1,'app':_0xec21('0x70'),'appdata':_0x502fb8[_0xec21('0x6a')]+','+(_0x49f90a[_0xec21('0x3a')][_0xec21('0x71')]||0x12c),'interval':_0xec21('0x4e')});}return respondWithRpcPromise(_0xec21('0x72'),_0xec21('0x73'),_0x49f90a);})['then'](function(_0x44077f){_0x18e20d(_0x44077f);})[_0xec21('0x1a')](function(_0x5def11){_0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0x5def11[_0xec21('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 05d0fb5..ede4bc7 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 _0x7d87=['update','emit','removeListener','register','mailAccount:','./mailAccount.events','remove'];(function(_0x2b6ec7,_0x514fd5){var _0x41063d=function(_0x4ddff1){while(--_0x4ddff1){_0x2b6ec7['push'](_0x2b6ec7['shift']());}};_0x41063d(++_0x514fd5);}(_0x7d87,0x178));var _0x77d8=function(_0x2a1866,_0x3f8038){_0x2a1866=_0x2a1866-0x0;var _0x604541=_0x7d87[_0x2a1866];return _0x604541;};'use strict';var MailAccountEvents=require(_0x77d8('0x0'));var events=['save',_0x77d8('0x1'),_0x77d8('0x2')];function createListener(_0x30ed08,_0x2b28e6){return function(_0x3dd798){_0x2b28e6[_0x77d8('0x3')](_0x30ed08,_0x3dd798);};}function removeListener(_0x539778,_0x3da7cd){return function(){MailAccountEvents[_0x77d8('0x4')](_0x539778,_0x3da7cd);};}exports[_0x77d8('0x5')]=function(_0x3a15cf){for(var _0x3e4849=0x0,_0x4b9c8a=events['length'];_0x3e4849<_0x4b9c8a;_0x3e4849++){var _0x160d5c=events[_0x3e4849];var _0x3d0135=createListener(_0x77d8('0x6')+_0x160d5c,_0x3a15cf);MailAccountEvents['on'](_0x160d5c,_0x3d0135);}}; \ No newline at end of file +var _0xc15c=['remove','update','mailAccount:'];(function(_0x379095,_0x475602){var _0x253cf9=function(_0xa743a7){while(--_0xa743a7){_0x379095['push'](_0x379095['shift']());}};_0x253cf9(++_0x475602);}(_0xc15c,0xae));var _0xcc15=function(_0x35e81a,_0x50fa10){_0x35e81a=_0x35e81a-0x0;var _0x363d00=_0xc15c[_0x35e81a];return _0x363d00;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0xcc15('0x0'),_0xcc15('0x1')];function createListener(_0x3df035,_0x507afc){return function(_0x1dd99c){_0x507afc['emit'](_0x3df035,_0x1dd99c);};}function removeListener(_0x571abf,_0x1d3a5f){return function(){MailAccountEvents['removeListener'](_0x571abf,_0x1d3a5f);};}exports['register']=function(_0x11ae7e){for(var _0x15135d=0x0,_0x597a7e=events['length'];_0x15135d<_0x597a7e;_0x15135d++){var _0x5de043=events[_0x15135d];var _0x25fee6=createListener(_0xcc15('0x2')+_0x5de043,_0x11ae7e);MailAccountEvents['on'](_0x5de043,_0x25fee6);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 7e01c2d..83971b0 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 _0x7b02=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update','destroy','exports','multer','util'];(function(_0x2610a8,_0x471458){var _0x2430ee=function(_0x486f93){while(--_0x486f93){_0x2610a8['push'](_0x2610a8['shift']());}};_0x2430ee(++_0x471458);}(_0x7b02,0xde));var _0x27b0=function(_0x37b167,_0xd28313){_0x37b167=_0x37b167-0x0;var _0x11b32c=_0x7b02[_0x37b167];return _0x11b32c;};'use strict';var multer=require(_0x27b0('0x0'));var util=require(_0x27b0('0x1'));var path=require(_0x27b0('0x2'));var timeout=require(_0x27b0('0x3'));var express=require(_0x27b0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x27b0('0x5'));var interaction=require(_0x27b0('0x6'));var config=require(_0x27b0('0x7'));var controller=require('./mailApplication.controller');router[_0x27b0('0x8')](_0x27b0('0x9'),auth[_0x27b0('0xa')](),controller[_0x27b0('0xb')]);router[_0x27b0('0xc')](_0x27b0('0x9'),auth[_0x27b0('0xa')](),controller[_0x27b0('0xd')]);router['delete'](_0x27b0('0x9'),auth[_0x27b0('0xa')](),controller[_0x27b0('0xe')]);module[_0x27b0('0xf')]=router; \ No newline at end of file +var _0x8293=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put'];(function(_0x17707b,_0x2744f0){var _0xb7df61=function(_0x4c8dd4){while(--_0x4c8dd4){_0x17707b['push'](_0x17707b['shift']());}};_0xb7df61(++_0x2744f0);}(_0x8293,0xfb));var _0x3829=function(_0x2569d0,_0x4e2953){_0x2569d0=_0x2569d0-0x0;var _0x4c5555=_0x8293[_0x2569d0];return _0x4c5555;};'use strict';var multer=require(_0x3829('0x0'));var util=require(_0x3829('0x1'));var path=require(_0x3829('0x2'));var timeout=require(_0x3829('0x3'));var express=require(_0x3829('0x4'));var router=express[_0x3829('0x5')]();var fs_extra=require(_0x3829('0x6'));var auth=require(_0x3829('0x7'));var interaction=require(_0x3829('0x8'));var config=require('../../config/environment');var controller=require(_0x3829('0x9'));router[_0x3829('0xa')](_0x3829('0xb'),auth[_0x3829('0xc')](),controller[_0x3829('0xd')]);router[_0x3829('0xe')](_0x3829('0xb'),auth[_0x3829('0xc')](),controller[_0x3829('0xf')]);router[_0x3829('0x10')](_0x3829('0xb'),auth[_0x3829('0xc')](),controller[_0x3829('0x11')]);module[_0x3829('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 2af7d0f..b1125e2 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 _0x43c5=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x1f9c54,_0x4710f1){var _0x3eaa0c=function(_0x12d446){while(--_0x12d446){_0x1f9c54['push'](_0x1f9c54['shift']());}};_0x3eaa0c(++_0x4710f1);}(_0x43c5,0x13e));var _0x543c=function(_0x2bde6f,_0x144341){_0x2bde6f=_0x2bde6f-0x0;var _0x50ea15=_0x43c5[_0x2bde6f];return _0x50ea15;};'use strict';var Sequelize=require(_0x543c('0x0'));module[_0x543c('0x1')]={'priority':{'type':Sequelize[_0x543c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x543c('0x3')],'allowNull':![],'defaultValue':_0x543c('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x543c('0x3')]},'interval':{'type':Sequelize[_0x543c('0x3')],'defaultValue':_0x543c('0x5')}}; \ No newline at end of file +var _0x0deb=['sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x5bac21,_0x1561ea){var _0x3c33c6=function(_0x171a39){while(--_0x171a39){_0x5bac21['push'](_0x5bac21['shift']());}};_0x3c33c6(++_0x1561ea);}(_0x0deb,0x1d1));var _0xb0de=function(_0x355f52,_0x1321ca){_0x355f52=_0x355f52-0x0;var _0x199cc6=_0x0deb[_0x355f52];return _0x199cc6;};'use strict';var Sequelize=require(_0xb0de('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb0de('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb0de('0x2')],'allowNull':![],'defaultValue':_0xb0de('0x3')},'appdata':{'type':Sequelize[_0xb0de('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb0de('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 5a9a04e..7645fa0 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 _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x851192,_0x3ee14c){var _0x544ca6=function(_0x56ed7d){while(--_0x56ed7d){_0x851192['push'](_0x851192['shift']());}};_0x544ca6(++_0x3ee14c);}(_0xac4a,0x13f));var _0xaac4=function(_0x3dd0a0,_0x248b43){_0x3dd0a0=_0x3dd0a0-0x0;var _0x1a358d=_0xac4a[_0x3dd0a0];return _0x1a358d;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file +var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x190dde,_0x5bb90f){var _0x2a3638=function(_0x242516){while(--_0x242516){_0x190dde['push'](_0x190dde['shift']());}};_0x2a3638(++_0x5bb90f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x22464a,_0x535278){_0x22464a=_0x22464a-0x0;var _0x293737=_0x9bde[_0x22464a];return _0x293737;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1e4a6e7..35e757e 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 _0x6830=['exports','define','MailApplication','mail_applications','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6830,0x1a9));var _0x0683=function(_0xb9d223,_0x21b9e5){_0xb9d223=_0xb9d223-0x0;var _0x340b55=_0x6830[_0xb9d223];return _0x340b55;};'use strict';var _=require('lodash');var util=require(_0x0683('0x0'));var logger=require(_0x0683('0x1'))('api');var moment=require(_0x0683('0x2'));var BPromise=require('bluebird');var rp=require(_0x0683('0x3'));var fs=require('fs');var path=require(_0x0683('0x4'));var rimraf=require(_0x0683('0x5'));var config=require(_0x0683('0x6'));var attributes=require('./mailApplication.attributes');module[_0x0683('0x7')]=function(_0x1aea6c,_0x5ec2c7){return _0x1aea6c[_0x0683('0x8')](_0x0683('0x9'),attributes,{'tableName':_0x0683('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0683('0xb')});}; \ No newline at end of file +var _0x30f3=['exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./mailApplication.attributes'];(function(_0x27c980,_0x547830){var _0x27ecc0=function(_0x19479a){while(--_0x19479a){_0x27c980['push'](_0x27c980['shift']());}};_0x27ecc0(++_0x547830);}(_0x30f3,0x87));var _0x330f=function(_0x3ba2d6,_0x4910cb){_0x3ba2d6=_0x3ba2d6-0x0;var _0x6f362a=_0x30f3[_0x3ba2d6];return _0x6f362a;};'use strict';var _=require(_0x330f('0x0'));var util=require(_0x330f('0x1'));var logger=require(_0x330f('0x2'))(_0x330f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x330f('0x4'));var rimraf=require(_0x330f('0x5'));var config=require(_0x330f('0x6'));var attributes=require(_0x330f('0x7'));module[_0x330f('0x8')]=function(_0x43141d,_0x278abf){return _0x43141d[_0x330f('0x9')](_0x330f('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x330f('0xb'),'collate':_0x330f('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 97d32ad..da3b90d 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 _0x32e3=['MailApplication','update','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailApplication'];(function(_0x34a124,_0x3d3894){var _0x3388f1=function(_0x2142b7){while(--_0x2142b7){_0x34a124['push'](_0x34a124['shift']());}};_0x3388f1(++_0x3d3894);}(_0x32e3,0x1d8));var _0x332e=function(_0x43a129,_0x10b57c){_0x43a129=_0x43a129-0x0;var _0x1f8193=_0x32e3[_0x43a129];return _0x1f8193;};'use strict';var _=require(_0x332e('0x0'));var util=require(_0x332e('0x1'));var moment=require(_0x332e('0x2'));var BPromise=require(_0x332e('0x3'));var rs=require(_0x332e('0x4'));var fs=require('fs');var Redis=require(_0x332e('0x5'));var db=require(_0x332e('0x6'))['db'];var utils=require(_0x332e('0x7'));var logger=require('../../config/logger')(_0x332e('0x8'));var config=require(_0x332e('0x9'));var jayson=require(_0x332e('0xa'));var client=jayson[_0x332e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x213a15,_0x4dfba7,_0x59126b){return new BPromise(function(_0x239b9c,_0x1205c2){return client['request'](_0x213a15,_0x59126b)[_0x332e('0xc')](function(_0x4566d2){logger['info'](_0x332e('0xd'),_0x4dfba7,'request\x20sent');logger[_0x332e('0xe')](_0x332e('0xf'),_0x4dfba7,'request\x20sent',JSON[_0x332e('0x10')](_0x4566d2));if(_0x4566d2['error']){if(_0x4566d2[_0x332e('0x11')][_0x332e('0x12')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x4dfba7,_0x4566d2['error']['message']);return _0x1205c2(_0x4566d2[_0x332e('0x11')]['message']);}logger[_0x332e('0x11')]('MailApplication,\x20%s,\x20%s',_0x4dfba7,_0x4566d2[_0x332e('0x11')][_0x332e('0x13')]);return _0x239b9c(_0x4566d2['error'][_0x332e('0x13')]);}else{logger[_0x332e('0x14')](_0x332e('0xd'),_0x4dfba7,'request\x20sent');_0x239b9c(_0x4566d2[_0x332e('0x15')][_0x332e('0x13')]);}})[_0x332e('0x16')](function(_0x2c4c5e){logger[_0x332e('0x11')](_0x332e('0xd'),_0x4dfba7,_0x2c4c5e);_0x1205c2(_0x2c4c5e);});});}exports[_0x332e('0x17')]=function(_0x9f7981){var _0x171a11=this;return new Promise(function(_0x53b3f8,_0x44859a){return db[_0x332e('0x18')][_0x332e('0x19')](_0x9f7981['body'],{'raw':_0x9f7981[_0x332e('0x1a')]?_0x9f7981[_0x332e('0x1a')][_0x332e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9f7981['options']?_0x9f7981[_0x332e('0x1a')][_0x332e('0x1c')]||null:null,'attributes':_0x9f7981[_0x332e('0x1a')]?_0x9f7981[_0x332e('0x1a')][_0x332e('0x1d')]||null:null,'limit':_0x9f7981[_0x332e('0x1a')]?_0x9f7981['options'][_0x332e('0x1e')]||null:null})['then'](function(_0x411848){logger['info'](_0x332e('0x17'),_0x9f7981);logger[_0x332e('0xe')](_0x332e('0x17'),_0x9f7981,JSON['stringify'](_0x411848));_0x53b3f8(_0x411848);})['catch'](function(_0xc1bca0){logger[_0x332e('0x11')]('UpdateMailApplication',_0xc1bca0['message'],_0x9f7981);_0x44859a(_0x171a11[_0x332e('0x11')](0x1f4,_0xc1bca0['message']));});});}; \ No newline at end of file +var _0x0f74=['request','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','info','catch','options','raw','where','attributes','limit','then','UpdateMailApplication','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x411dc3,_0x447538){var _0x3265f2=function(_0x3ecb17){while(--_0x3ecb17){_0x411dc3['push'](_0x411dc3['shift']());}};_0x3265f2(++_0x447538);}(_0x0f74,0x13b));var _0x40f7=function(_0x44b78d,_0x126ee1){_0x44b78d=_0x44b78d-0x0;var _0x499fe=_0x0f74[_0x44b78d];return _0x499fe;};'use strict';var _=require(_0x40f7('0x0'));var util=require(_0x40f7('0x1'));var moment=require(_0x40f7('0x2'));var BPromise=require('bluebird');var rs=require(_0x40f7('0x3'));var fs=require('fs');var Redis=require(_0x40f7('0x4'));var db=require(_0x40f7('0x5'))['db'];var utils=require(_0x40f7('0x6'));var logger=require(_0x40f7('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x40f7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f2564,_0x24f382,_0x2bdbb5){return new BPromise(function(_0x9a71e0,_0x32a2a4){return client[_0x40f7('0x9')](_0x2f2564,_0x2bdbb5)['then'](function(_0x13b1ee){logger['info']('MailApplication,\x20%s,\x20%s',_0x24f382,_0x40f7('0xa'));logger[_0x40f7('0xb')](_0x40f7('0xc'),_0x24f382,'request\x20sent',JSON[_0x40f7('0xd')](_0x13b1ee));if(_0x13b1ee[_0x40f7('0xe')]){if(_0x13b1ee[_0x40f7('0xe')][_0x40f7('0xf')]===0x1f4){logger[_0x40f7('0xe')](_0x40f7('0x10'),_0x24f382,_0x13b1ee['error'][_0x40f7('0x11')]);return _0x32a2a4(_0x13b1ee[_0x40f7('0xe')][_0x40f7('0x11')]);}logger[_0x40f7('0xe')](_0x40f7('0x10'),_0x24f382,_0x13b1ee['error'][_0x40f7('0x11')]);return _0x9a71e0(_0x13b1ee[_0x40f7('0xe')]['message']);}else{logger[_0x40f7('0x12')](_0x40f7('0x10'),_0x24f382,'request\x20sent');_0x9a71e0(_0x13b1ee['result'][_0x40f7('0x11')]);}})[_0x40f7('0x13')](function(_0x41fbb9){logger['error']('MailApplication,\x20%s,\x20%s',_0x24f382,_0x41fbb9);_0x32a2a4(_0x41fbb9);});});}exports['UpdateMailApplication']=function(_0x397a8e){var _0x4731ff=this;return new Promise(function(_0x53f738,_0x49a2d5){return db['MailApplication']['update'](_0x397a8e['body'],{'raw':_0x397a8e[_0x40f7('0x14')]?_0x397a8e['options'][_0x40f7('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x397a8e[_0x40f7('0x14')]?_0x397a8e['options'][_0x40f7('0x16')]||null:null,'attributes':_0x397a8e[_0x40f7('0x14')]?_0x397a8e[_0x40f7('0x14')][_0x40f7('0x17')]||null:null,'limit':_0x397a8e['options']?_0x397a8e[_0x40f7('0x14')][_0x40f7('0x18')]||null:null})[_0x40f7('0x19')](function(_0x289783){logger[_0x40f7('0x12')](_0x40f7('0x1a'),_0x397a8e);logger[_0x40f7('0xb')](_0x40f7('0x1a'),_0x397a8e,JSON[_0x40f7('0xd')](_0x289783));_0x53f738(_0x289783);})[_0x40f7('0x13')](function(_0x47c95b){logger['error']('UpdateMailApplication',_0x47c95b[_0x40f7('0x11')],_0x397a8e);_0x49a2d5(_0x4731ff[_0x40f7('0xe')](0x1f4,_0x47c95b[_0x40f7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index b2f0d19..9144852 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 _0xe9fb=['/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','addTags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','/:id','/:id/messages'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xe9fb,0xe0));var _0xbe9f=function(_0x2af38a,_0x27524b){_0x2af38a=_0x2af38a-0x0;var _0x54ff30=_0xe9fb[_0x2af38a];return _0x54ff30;};'use strict';var express=require(_0xbe9f('0x0'));var router=express[_0xbe9f('0x1')]();var auth=require(_0xbe9f('0x2'));var interaction=require(_0xbe9f('0x3'));var controller=require(_0xbe9f('0x4'));router[_0xbe9f('0x5')]('/',auth[_0xbe9f('0x6')](),controller['index']);router[_0xbe9f('0x5')](_0xbe9f('0x7'),auth[_0xbe9f('0x6')](),controller['describe']);router[_0xbe9f('0x5')](_0xbe9f('0x8'),auth[_0xbe9f('0x6')](),controller['show']);router[_0xbe9f('0x5')](_0xbe9f('0x9'),auth[_0xbe9f('0x6')](),controller['getMessages']);router[_0xbe9f('0x5')](_0xbe9f('0xa'),auth[_0xbe9f('0x6')](),controller[_0xbe9f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbe9f('0xc')]);router[_0xbe9f('0xd')](_0xbe9f('0x9'),auth[_0xbe9f('0x6')](),controller[_0xbe9f('0xe')]);router[_0xbe9f('0xd')](_0xbe9f('0xf'),auth[_0xbe9f('0x6')](),interaction[_0xbe9f('0x10')](_0xbe9f('0x11'),'mailinteraction:addtags'),controller[_0xbe9f('0x12')]);router['put'](_0xbe9f('0x8'),auth[_0xbe9f('0x6')](),interaction[_0xbe9f('0x10')](_0xbe9f('0x11'),_0xbe9f('0x13')),controller[_0xbe9f('0x14')]);router[_0xbe9f('0x15')](_0xbe9f('0x8'),auth['isAuthenticated'](),interaction[_0xbe9f('0x10')](_0xbe9f('0x11'),_0xbe9f('0x16')),controller[_0xbe9f('0x17')]);router[_0xbe9f('0x15')]('/:id/tags',auth[_0xbe9f('0x6')](),controller[_0xbe9f('0x18')]);module[_0xbe9f('0x19')]=router; \ No newline at end of file +var _0xd593=['addTags','update','delete','mailinteraction:destroy','destroy','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags'];(function(_0x20bcea,_0x3bd892){var _0x5eaaca=function(_0x81aa0c){while(--_0x81aa0c){_0x20bcea['push'](_0x20bcea['shift']());}};_0x5eaaca(++_0x3bd892);}(_0xd593,0x1a6));var _0x3d59=function(_0xa767af,_0x3799ca){_0xa767af=_0xa767af-0x0;var _0x3fe4b6=_0xd593[_0xa767af];return _0x3fe4b6;};'use strict';var express=require(_0x3d59('0x0'));var router=express[_0x3d59('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x3d59('0x2'));var controller=require(_0x3d59('0x3'));router[_0x3d59('0x4')]('/',auth[_0x3d59('0x5')](),controller[_0x3d59('0x6')]);router[_0x3d59('0x4')]('/describe',auth[_0x3d59('0x5')](),controller[_0x3d59('0x7')]);router[_0x3d59('0x4')](_0x3d59('0x8'),auth[_0x3d59('0x5')](),controller[_0x3d59('0x9')]);router[_0x3d59('0x4')](_0x3d59('0xa'),auth[_0x3d59('0x5')](),controller[_0x3d59('0xb')]);router[_0x3d59('0x4')](_0x3d59('0xc'),auth['isAuthenticated'](),controller[_0x3d59('0xd')]);router[_0x3d59('0xe')]('/',auth[_0x3d59('0x5')](),controller['create']);router['post'](_0x3d59('0xa'),auth[_0x3d59('0x5')](),controller[_0x3d59('0xf')]);router[_0x3d59('0xe')](_0x3d59('0x10'),auth[_0x3d59('0x5')](),interaction[_0x3d59('0x11')](_0x3d59('0x12'),_0x3d59('0x13')),controller[_0x3d59('0x14')]);router['put'](_0x3d59('0x8'),auth[_0x3d59('0x5')](),interaction[_0x3d59('0x11')](_0x3d59('0x12'),'mailinteraction:update'),controller[_0x3d59('0x15')]);router[_0x3d59('0x16')](_0x3d59('0x8'),auth['isAuthenticated'](),interaction[_0x3d59('0x11')](_0x3d59('0x12'),_0x3d59('0x17')),controller[_0x3d59('0x18')]);router[_0x3d59('0x16')]('/:id/tags',auth[_0x3d59('0x5')](),controller['removeTags']);module[_0x3d59('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 1bb9a10..86ddd2f 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 _0x4817=['long','TEXT','BOOLEAN','ENUM','INTEGER','DATE','STRING'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x4817,0x11d));var _0x7481=function(_0x2100e5,_0x3dda09){_0x2100e5=_0x2100e5-0x0;var _0x55afb9=_0x4817[_0x2100e5];return _0x55afb9;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7481('0x0')]},'disposition':{'type':Sequelize[_0x7481('0x1')]},'secondDisposition':{'type':Sequelize[_0x7481('0x1')]},'thirdDisposition':{'type':Sequelize[_0x7481('0x1')]},'note':{'type':Sequelize[_0x7481('0x1')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x7481('0x2'))},'subject':{'type':Sequelize[_0x7481('0x3')]()},'attach':{'type':Sequelize[_0x7481('0x4')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x7481('0x1')](0x3c)},'substatusAt':{'type':Sequelize[_0x7481('0x0')]},'firstMsgDirection':{'type':Sequelize[_0x7481('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7481('0x0')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7481('0x4')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7481('0x6')]}}; \ No newline at end of file +var _0x3a75=['INTEGER','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','ENUM','out'];(function(_0x254d2a,_0x47cfe4){var _0x352f1f=function(_0x24805e){while(--_0x24805e){_0x254d2a['push'](_0x254d2a['shift']());}};_0x352f1f(++_0x47cfe4);}(_0x3a75,0xb5));var _0x53a7=function(_0x387604,_0x2ada22){_0x387604=_0x387604-0x0;var _0x1da0be=_0x3a75[_0x387604];return _0x1da0be;};'use strict';var Sequelize=require(_0x53a7('0x0'));var iconv=require(_0x53a7('0x1'));module['exports']={'closed':{'type':Sequelize[_0x53a7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x53a7('0x3')]},'disposition':{'type':Sequelize[_0x53a7('0x4')]},'secondDisposition':{'type':Sequelize[_0x53a7('0x4')]},'thirdDisposition':{'type':Sequelize[_0x53a7('0x4')]},'note':{'type':Sequelize[_0x53a7('0x4')]},'inReplyTo':{'type':Sequelize[_0x53a7('0x4')](0x1fe)},'to':{'type':Sequelize[_0x53a7('0x4')]},'cc':{'type':Sequelize[_0x53a7('0x5')]('long')},'subject':{'type':Sequelize[_0x53a7('0x5')]()},'attach':{'type':Sequelize[_0x53a7('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x53a7('0x3')]},'substatus':{'type':Sequelize[_0x53a7('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x53a7('0x6')]('in',_0x53a7('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x53a7('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x53a7('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x53a7('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x53a7('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 1e6b15a..e9e6b03 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 _0xa9c1=['pick','where','MailInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','findAll','inlineCss','true','rows','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','Attachment','Messages','bcc','subject','get','mkdirSync','from','decode','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','offset','limit','undefined','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','mail','query','user','catch','show','params','model','keys','attributes','intersection','fields','includeAll','include','options','find','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','filters','length','hasOwnProperty','nolimit','sort'];(function(_0x383126,_0x2c3d21){var _0x36d006=function(_0x389931){while(--_0x389931){_0x383126['push'](_0x383126['shift']());}};_0x36d006(++_0x2c3d21);}(_0xa9c1,0x11d));var _0x1a9c=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9c1[_0x32d457];return _0x338386;};'use strict';var emlformat=require(_0x1a9c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a9c('0x1'));var moment=require(_0x1a9c('0x2'));var BPromise=require('bluebird');var util=require(_0x1a9c('0x3'));var path=require(_0x1a9c('0x4'));var fs=require('fs');var _=require(_0x1a9c('0x5'));var juice=require(_0x1a9c('0x6'));var Redis=require(_0x1a9c('0x7'));var interaction=require(_0x1a9c('0x8'));var qs=require(_0x1a9c('0x9'));var logger=require('../../config/logger')(_0x1a9c('0xa'));var config=require(_0x1a9c('0xb'));var db=require(_0x1a9c('0xc'))['db'];var htmlEntities=require(_0x1a9c('0xd'));config[_0x1a9c('0xe')]=_[_0x1a9c('0xf')](config['redis'],{'host':_0x1a9c('0x10'),'port':0x18eb});var socket=require(_0x1a9c('0x11'))(new Redis(config[_0x1a9c('0xe')]));require(_0x1a9c('0x12'))[_0x1a9c('0x13')](socket);function respondWithStatusCode(_0x38bb40,_0x41dab7){_0x41dab7=_0x41dab7||0xcc;return function(_0x492e13){if(_0x492e13){return _0x38bb40['sendStatus'](_0x41dab7);}return _0x38bb40[_0x1a9c('0x14')](_0x41dab7)[_0x1a9c('0x15')]();};}function respondWithResult(_0x682255,_0x59f2af){_0x59f2af=_0x59f2af||0xc8;return function(_0x47bf47){if(_0x47bf47){return _0x682255[_0x1a9c('0x14')](_0x59f2af)['json'](_0x47bf47);}};}function respondWithFilteredResult(_0x44b3e5,_0x61ef4a){return function(_0x43d880){if(_0x43d880){var _0x37905a=typeof _0x61ef4a[_0x1a9c('0x16')]==='undefined'&&typeof _0x61ef4a[_0x1a9c('0x17')]===_0x1a9c('0x18');var _0x19f884=_0x43d880[_0x1a9c('0x19')];var _0x688636=_0x37905a?0x0:_0x61ef4a[_0x1a9c('0x16')];var _0x193752=_0x37905a?_0x43d880[_0x1a9c('0x19')]:_0x61ef4a[_0x1a9c('0x16')]+_0x61ef4a['limit'];var _0xc92c2;if(_0x193752>=_0x19f884){_0x193752=_0x19f884;_0xc92c2=0xc8;}else{_0xc92c2=0xce;}_0x44b3e5['status'](_0xc92c2);return _0x44b3e5[_0x1a9c('0x1a')](_0x1a9c('0x1b'),_0x688636+'-'+_0x193752+'/'+_0x19f884)['json'](_0x43d880);}return null;};}function saveUpdates(_0x56c11f){return function(_0xe6f615){if(_0xe6f615){return _0xe6f615[_0x1a9c('0x1c')](_0x56c11f)[_0x1a9c('0x1d')](function(_0x7c4f94){return _0x7c4f94;});}return null;};}function removeEntity(_0x39a497){return function(_0x38f117){if(_0x38f117){return _0x38f117[_0x1a9c('0x1e')]()[_0x1a9c('0x1d')](function(){_0x39a497['status'](0xcc)[_0x1a9c('0x15')]();});}};}function handleEntityNotFound(_0x10055c){return function(_0x204720){if(!_0x204720){_0x10055c[_0x1a9c('0x1f')](0x194);}return _0x204720;};}function handleError(_0x168031,_0x44284c){_0x44284c=_0x44284c||0x1f4;return function(_0x247286){logger[_0x1a9c('0x20')](_0x247286[_0x1a9c('0x21')]);if(_0x247286[_0x1a9c('0x22')]){delete _0x247286[_0x1a9c('0x22')];}_0x168031[_0x1a9c('0x14')](_0x44284c)[_0x1a9c('0x23')](_0x247286);};}exports[_0x1a9c('0x24')]=function(_0x12c1d7,_0x220d5a){var _0x248236={};var _0x56dc65=_[_0x1a9c('0x25')](db[_0x1a9c('0x26')][_0x1a9c('0x27')],function(_0x541487){return{'name':_0x541487[_0x1a9c('0x28')],'type':_0x541487[_0x1a9c('0x29')][_0x1a9c('0x2a')]};});_0x248236=qs['getOptions'](_0x56dc65,_0x12c1d7);return interaction['findAll'](_0x1a9c('0x2b'),_0x12c1d7[_0x1a9c('0x2c')],_0x12c1d7[_0x1a9c('0x2d')],_0x248236,_0x56dc65)[_0x1a9c('0x1d')](respondWithFilteredResult(_0x220d5a,_0x248236))[_0x1a9c('0x2e')](handleError(_0x220d5a,null));};exports[_0x1a9c('0x2f')]=function(_0x989bad,_0x29807b){var _0x556b93={'raw':![],'where':{'id':_0x989bad[_0x1a9c('0x30')]['id']}},_0x162cde={};_0x162cde[_0x1a9c('0x31')]=_[_0x1a9c('0x32')](db[_0x1a9c('0x26')][_0x1a9c('0x27')]);_0x162cde[_0x1a9c('0x2c')]=_[_0x1a9c('0x32')](_0x989bad[_0x1a9c('0x2c')]);_0x162cde['filters']=_['intersection'](_0x162cde[_0x1a9c('0x31')],_0x162cde['query']);_0x556b93[_0x1a9c('0x33')]=_[_0x1a9c('0x34')](_0x162cde[_0x1a9c('0x31')],qs['fields'](_0x989bad[_0x1a9c('0x2c')][_0x1a9c('0x35')]));_0x556b93['attributes']=_0x556b93[_0x1a9c('0x33')]['length']?_0x556b93[_0x1a9c('0x33')]:_0x162cde[_0x1a9c('0x31')];if(_0x989bad['query'][_0x1a9c('0x36')]){_0x556b93[_0x1a9c('0x37')]=[{'all':!![]}];}_0x556b93=_['merge']({},_0x556b93,_0x989bad[_0x1a9c('0x38')]);return db[_0x1a9c('0x26')][_0x1a9c('0x39')](_0x556b93)[_0x1a9c('0x1d')](handleEntityNotFound(_0x29807b,null))[_0x1a9c('0x1d')](respondWithResult(_0x29807b,null))[_0x1a9c('0x2e')](handleError(_0x29807b,null));};exports[_0x1a9c('0x3a')]=function(_0x404041,_0x529633){return db[_0x1a9c('0x26')]['create'](_0x404041['body'],{})['then'](respondWithResult(_0x529633,0xc9))[_0x1a9c('0x2e')](handleError(_0x529633,null));};exports[_0x1a9c('0x1c')]=function(_0x46cbc8,_0x4bdf52){if(_0x46cbc8[_0x1a9c('0x3b')]['id']){delete _0x46cbc8[_0x1a9c('0x3b')]['id'];}return db['MailInteraction'][_0x1a9c('0x39')]({'where':{'id':_0x46cbc8['params']['id']}})['then'](handleEntityNotFound(_0x4bdf52,null))[_0x1a9c('0x1d')](saveUpdates(_0x46cbc8['body'],null))[_0x1a9c('0x1d')](respondWithResult(_0x4bdf52,null))['catch'](handleError(_0x4bdf52,null));};exports[_0x1a9c('0x1e')]=function(_0x2da011,_0x2af781){return db[_0x1a9c('0x26')]['find']({'where':{'id':_0x2da011[_0x1a9c('0x30')]['id']}})[_0x1a9c('0x1d')](handleEntityNotFound(_0x2af781,null))[_0x1a9c('0x1d')](removeEntity(_0x2af781,null))[_0x1a9c('0x2e')](handleError(_0x2af781,null));};exports[_0x1a9c('0x3c')]=function(_0x14712e,_0x4cdf56){return db['MailInteraction']['describe']()[_0x1a9c('0x1d')](respondWithResult(_0x4cdf56,null))[_0x1a9c('0x2e')](handleError(_0x4cdf56,null));};exports[_0x1a9c('0x3d')]=function(_0x292dda,_0x3078d5){return db[_0x1a9c('0x3e')][_0x1a9c('0x39')]({'where':{'id':_0x292dda[_0x1a9c('0x30')]['id']}})['then'](handleEntityNotFound(_0x3078d5,null))[_0x1a9c('0x1d')](function(_0x1e9d0d){if(_0x1e9d0d){return _0x1e9d0d[_0x1a9c('0x3d')](_0x292dda[_0x1a9c('0x3b')][_0x1a9c('0x3f')],_[_0x1a9c('0x40')](_0x292dda[_0x1a9c('0x3b')],[_0x1a9c('0x3f'),'id'])||{});}})['then'](respondWithResult(_0x3078d5,null))['catch'](handleError(_0x3078d5,null));};exports[_0x1a9c('0x41')]=function(_0x44d740,_0x2e71a2){var _0x1cc6eb={'raw':![],'where':{}};var _0x39fba5={};var _0x35d6fc={'count':0x0,'rows':[]};return db[_0x1a9c('0x26')][_0x1a9c('0x42')]({'where':{'id':_0x44d740[_0x1a9c('0x30')]['id']}})['then'](handleEntityNotFound(_0x2e71a2,null))['then'](function(_0x2d3c5c){if(_0x2d3c5c){_0x39fba5[_0x1a9c('0x31')]=_['keys'](db[_0x1a9c('0x3e')][_0x1a9c('0x27')]);_0x39fba5[_0x1a9c('0x2c')]=_[_0x1a9c('0x32')](_0x44d740[_0x1a9c('0x2c')]);_0x39fba5[_0x1a9c('0x43')]=_[_0x1a9c('0x34')](_0x39fba5['model'],_0x39fba5[_0x1a9c('0x2c')]);_0x1cc6eb[_0x1a9c('0x33')]=_[_0x1a9c('0x34')](_0x39fba5[_0x1a9c('0x31')],qs[_0x1a9c('0x35')](_0x44d740['query'][_0x1a9c('0x35')]));_0x1cc6eb['attributes']=_0x1cc6eb[_0x1a9c('0x33')][_0x1a9c('0x44')]?_0x1cc6eb['attributes']:_0x39fba5[_0x1a9c('0x31')];if(!_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x45')](_0x1a9c('0x46'))){_0x1cc6eb['limit']=qs['limit'](_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x17')]);_0x1cc6eb[_0x1a9c('0x16')]=qs[_0x1a9c('0x16')](_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x16')]);}_0x1cc6eb['order']=qs[_0x1a9c('0x47')](_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x47')]);_0x1cc6eb['where']=qs[_0x1a9c('0x43')](_[_0x1a9c('0x48')](_0x44d740[_0x1a9c('0x2c')],_0x39fba5[_0x1a9c('0x43')]));_0x1cc6eb[_0x1a9c('0x49')][_0x1a9c('0x4a')]=_0x2d3c5c['id'];if(_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x4b')]){_0x1cc6eb[_0x1a9c('0x49')]=_['merge'](_0x1cc6eb[_0x1a9c('0x49')],{'$or':_[_0x1a9c('0x25')](_0x1cc6eb[_0x1a9c('0x33')],function(_0x7264b0){var _0x32e4af={};_0x32e4af[_0x7264b0]={'$like':'%'+_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x4b')]+'%'};return _0x32e4af;})});}if(_0x44d740['query'][_0x1a9c('0x4c')]){var _0x3ac375=_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x4c')]['split'](',');var _0x391fd3={};_0x391fd3[_0x3ac375[0x0]]={'$gte':moment(_0x3ac375[0x1])[_0x1a9c('0x4d')](_0x1a9c('0x4e'))};_0x1cc6eb[_0x1a9c('0x49')]=_[_0x1a9c('0x4f')](_0x1cc6eb[_0x1a9c('0x49')],_0x391fd3);}_0x1cc6eb=_[_0x1a9c('0x4f')]({},_0x1cc6eb,_0x44d740[_0x1a9c('0x38')]);return db['MailMessage'][_0x1a9c('0x19')]({'where':_0x1cc6eb['where']})[_0x1a9c('0x1d')](function(_0x4441ae){_0x35d6fc[_0x1a9c('0x19')]=_0x4441ae;if(_0x44d740['query'][_0x1a9c('0x36')]){_0x1cc6eb[_0x1a9c('0x37')]=[{'all':!![]}];}return db['MailMessage'][_0x1a9c('0x50')](_0x1cc6eb);})['then'](function(_0x305e2e){if(_0x44d740[_0x1a9c('0x2c')][_0x1a9c('0x51')]===_0x1a9c('0x52')){for(var _0x4620b2=0x0;_0x4620b2<_0x305e2e[_0x1a9c('0x44')];_0x4620b2++){_0x305e2e[_0x4620b2][_0x1a9c('0x3b')]=juice(_0x305e2e[_0x4620b2][_0x1a9c('0x3b')]);}}_0x35d6fc[_0x1a9c('0x53')]=_0x305e2e;return _0x35d6fc;});}})[_0x1a9c('0x1d')](respondWithFilteredResult(_0x2e71a2,_0x1cc6eb))[_0x1a9c('0x2e')](handleError(_0x2e71a2,null));};exports[_0x1a9c('0x54')]=function(_0x4626eb,_0x49656d){return db[_0x1a9c('0x26')][_0x1a9c('0x39')]({'where':{'id':_0x4626eb['params']['id']}})[_0x1a9c('0x1d')](handleEntityNotFound(_0x49656d,null))[_0x1a9c('0x1d')](function(_0x5c9e04){if(_0x5c9e04){return _0x5c9e04[_0x1a9c('0x55')](_0x4626eb[_0x1a9c('0x3b')][_0x1a9c('0x3f')],_[_0x1a9c('0x40')](_0x4626eb['body'],['ids','id'])||{})[_0x1a9c('0x56')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x4626eb[_0x1a9c('0x3b')][_0x1a9c('0x3f')]}});})[_0x1a9c('0x1d')](function(_0x318476){socket[_0x1a9c('0x57')](_0x1a9c('0x58'),{'id':Number(_0x4626eb['params']['id']),'tags':_0x318476||[]});return{'id':Number(_0x4626eb['params']['id']),'tags':_0x318476||[]};});}})[_0x1a9c('0x1d')](respondWithResult(_0x49656d,null))[_0x1a9c('0x2e')](handleError(_0x49656d,null));};exports[_0x1a9c('0x59')]=function(_0x52f2c5,_0x575e55){return db['MailInteraction']['find']({'where':{'id':_0x52f2c5[_0x1a9c('0x30')]['id']}})[_0x1a9c('0x1d')](handleEntityNotFound(_0x575e55,null))['then'](function(_0x2ecf6d){if(_0x2ecf6d){return _0x2ecf6d[_0x1a9c('0x59')](_0x52f2c5[_0x1a9c('0x2c')][_0x1a9c('0x3f')]);}})[_0x1a9c('0x1d')](respondWithStatusCode(_0x575e55,null))[_0x1a9c('0x2e')](handleError(_0x575e55,null));};exports[_0x1a9c('0x5a')]=function(_0x734329,_0x4c4128){var _0x3498f4=moment()[_0x1a9c('0x5b')]()[_0x1a9c('0x5c')]();var _0x459590=path[_0x1a9c('0x5d')](config[_0x1a9c('0x5e')],'server',_0x1a9c('0x5f'),_0x1a9c('0x60'));var _0x2f9dfe=path[_0x1a9c('0x5d')](config[_0x1a9c('0x5e')],_0x1a9c('0x61'),_0x1a9c('0x5f'),_0x1a9c('0x62'));var _0x30f846=path[_0x1a9c('0x5d')](_0x459590,_0x3498f4);var _0x1c15c5=util[_0x1a9c('0x4d')](_0x1a9c('0x63'),_0x734329[_0x1a9c('0x30')]['id'],_0x3498f4);var _0x5c01a5=path[_0x1a9c('0x5d')](_0x459590,_0x1c15c5);var _0x464aac=[];if(_0x734329['query'][_0x1a9c('0x62')]){_0x464aac[_0x1a9c('0x64')]({'model':db[_0x1a9c('0x65')],'as':'Attachments','raw':!![]});}var _0x1a3006=[{'model':db[_0x1a9c('0x3e')],'as':_0x1a9c('0x66'),'attributes':['id',_0x1a9c('0x3b'),'from','to','cc',_0x1a9c('0x67'),_0x1a9c('0x68'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x464aac}];return db[_0x1a9c('0x26')][_0x1a9c('0x39')]({'where':{'id':_0x734329[_0x1a9c('0x30')]['id']},'include':_0x1a3006})[_0x1a9c('0x1d')](handleEntityNotFound(_0x4c4128,null))[_0x1a9c('0x1d')](function(_0x2d3cb0){if(_0x2d3cb0&&_0x2d3cb0['Messages']){var _0x6edc91=_0x2d3cb0[_0x1a9c('0x69')]({'plain':!![]});fs[_0x1a9c('0x6a')](_0x30f846);return BPromise['each'](_0x6edc91[_0x1a9c('0x66')],function(_0xa16d5c,_0x479437){var _0x16337f={'from':_0xa16d5c[_0x1a9c('0x6b')],'to':_0xa16d5c['to']||'missing.recipient@your.company.com','subject':_0xa16d5c[_0x1a9c('0x68')],'html':htmlEntities[_0x1a9c('0x6c')](_0xa16d5c[_0x1a9c('0x3b')]),'headers':{'Date':moment(_0xa16d5c['createdAt'])[_0x1a9c('0x4d')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xa16d5c['cc']){_0x16337f[_0x1a9c('0x6d')]['Cc']=_0xa16d5c['cc'];}if(_0xa16d5c[_0x1a9c('0x67')]){_0x16337f['headers'][_0x1a9c('0x6e')]=_0xa16d5c[_0x1a9c('0x67')];}return new BPromise(function(_0x53bb0e,_0xdc28e5){if(_0xa16d5c['Attachments']){for(var _0x3f276e=0x0;_0x3f276e<_0xa16d5c[_0x1a9c('0x6f')][_0x1a9c('0x44')];_0x3f276e++){var _0x5ab1e6=_0xa16d5c[_0x1a9c('0x6f')][_0x3f276e];var _0x2da1a4=path[_0x1a9c('0x5d')](_0x2f9dfe,_0x5ab1e6[_0x1a9c('0x70')]);if(fs[_0x1a9c('0x71')](_0x2da1a4)){_0x16337f[_0x1a9c('0x62')][_0x1a9c('0x64')]({'name':_0x5ab1e6[_0x1a9c('0x22')],'contentType':_0x5ab1e6[_0x1a9c('0x29')],'data':fs[_0x1a9c('0x72')](_0x2da1a4)});}}}emlformat[_0x1a9c('0x73')](_0x16337f,function(_0x105fe9,_0x56aba2){if(_0x105fe9)return _0xdc28e5(_0x105fe9);fs[_0x1a9c('0x74')](path['join'](_0x30f846,util[_0x1a9c('0x4d')](_0x1a9c('0x75'),_0x479437)),_0x56aba2);return _0x53bb0e(_0x56aba2);});});})['then'](function(){return new BPromise(function(_0x5bb6e5,_0x48bad5){zipdir(_0x30f846,{'saveTo':_0x5c01a5},function(_0x2462d2,_0x1b17cf){if(_0x2462d2)return _0x48bad5(_0x2462d2);return _0x5bb6e5(_0x1b17cf);});})[_0x1a9c('0x1d')](function(){return new BPromise(function(_0x5da3c0,_0x378db6){rimraf(_0x30f846,function(_0x1215ca){if(_0x1215ca)_0x378db6(_0x1215ca);return _0x5da3c0();});});})[_0x1a9c('0x1d')](function(){return _0x4c4128['download'](_0x5c01a5,_0x1c15c5,function(_0x1040c4){if(!_0x1040c4)fs[_0x1a9c('0x76')](_0x5c01a5);});});});}else{return _0x4c4128[_0x1a9c('0x1f')](0xc8);}})[_0x1a9c('0x2e')](handleError(_0x4c4128,null));}; \ No newline at end of file +var _0xd6a6=['lodash','juice','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','offset','limit','count','status','Content-Range','json','update','end','error','stack','name','send','index','rawAttributes','type','getOptions','findAll','mail','query','then','show','params','model','keys','filters','fields','attributes','length','includeAll','merge','MailInteraction','create','body','catch','find','destroy','describe','addMessage','ids','omit','getMessages','findOne','intersection','hasOwnProperty','nolimit','order','sort','where','MailInteractionId','filter','map','$gte','split','MailMessage','true','rows','addTags','setTags','Tag','color','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','Attachments','from','subject','createdAt','Messages','get','mkdirSync','each','missing.recipient@your.company.com','headers','bcc','Bcc','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','moment','util'];(function(_0x432af8,_0x477b3d){var _0x228f4f=function(_0x2110c0){while(--_0x2110c0){_0x432af8['push'](_0x432af8['shift']());}};_0x228f4f(++_0x477b3d);}(_0xd6a6,0x1b7));var _0x6d6a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6a6[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x6d6a('0x0'));var rimraf=require(_0x6d6a('0x1'));var zipdir=require(_0x6d6a('0x2'));var moment=require(_0x6d6a('0x3'));var BPromise=require('bluebird');var util=require(_0x6d6a('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x6d6a('0x5'));var juice=require(_0x6d6a('0x6'));var Redis=require(_0x6d6a('0x7'));var interaction=require(_0x6d6a('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0x6d6a('0x9'))(_0x6d6a('0xa'));var config=require(_0x6d6a('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0x6d6a('0xc')]=_[_0x6d6a('0xd')](config[_0x6d6a('0xc')],{'host':_0x6d6a('0xe'),'port':0x18eb});var socket=require(_0x6d6a('0xf'))(new Redis(config[_0x6d6a('0xc')]));require('./mailInteraction.socket')[_0x6d6a('0x10')](socket);function respondWithStatusCode(_0xe9ecd0,_0x40003d){_0x40003d=_0x40003d||0xcc;return function(_0x509c57){if(_0x509c57){return _0xe9ecd0[_0x6d6a('0x11')](_0x40003d);}return _0xe9ecd0['status'](_0x40003d)['end']();};}function respondWithResult(_0x27e557,_0x43d789){_0x43d789=_0x43d789||0xc8;return function(_0x3ad91e){if(_0x3ad91e){return _0x27e557['status'](_0x43d789)['json'](_0x3ad91e);}};}function respondWithFilteredResult(_0x1a4dfb,_0x4ec2c3){return function(_0x5a49da){if(_0x5a49da){var _0x389b3f=typeof _0x4ec2c3[_0x6d6a('0x12')]==='undefined'&&typeof _0x4ec2c3[_0x6d6a('0x13')]==='undefined';var _0x2d88c4=_0x5a49da['count'];var _0x4bfbe0=_0x389b3f?0x0:_0x4ec2c3[_0x6d6a('0x12')];var _0x5c19eb=_0x389b3f?_0x5a49da[_0x6d6a('0x14')]:_0x4ec2c3[_0x6d6a('0x12')]+_0x4ec2c3[_0x6d6a('0x13')];var _0x53264f;if(_0x5c19eb>=_0x2d88c4){_0x5c19eb=_0x2d88c4;_0x53264f=0xc8;}else{_0x53264f=0xce;}_0x1a4dfb[_0x6d6a('0x15')](_0x53264f);return _0x1a4dfb['set'](_0x6d6a('0x16'),_0x4bfbe0+'-'+_0x5c19eb+'/'+_0x2d88c4)[_0x6d6a('0x17')](_0x5a49da);}return null;};}function saveUpdates(_0xb0cc82){return function(_0x35bb9d){if(_0x35bb9d){return _0x35bb9d[_0x6d6a('0x18')](_0xb0cc82)['then'](function(_0x56a2a2){return _0x56a2a2;});}return null;};}function removeEntity(_0xd2b02c){return function(_0x536519){if(_0x536519){return _0x536519['destroy']()['then'](function(){_0xd2b02c['status'](0xcc)[_0x6d6a('0x19')]();});}};}function handleEntityNotFound(_0x3b162b){return function(_0x1009d8){if(!_0x1009d8){_0x3b162b[_0x6d6a('0x11')](0x194);}return _0x1009d8;};}function handleError(_0x20544a,_0x36b2c3){_0x36b2c3=_0x36b2c3||0x1f4;return function(_0x43b4f9){logger[_0x6d6a('0x1a')](_0x43b4f9[_0x6d6a('0x1b')]);if(_0x43b4f9[_0x6d6a('0x1c')]){delete _0x43b4f9[_0x6d6a('0x1c')];}_0x20544a[_0x6d6a('0x15')](_0x36b2c3)[_0x6d6a('0x1d')](_0x43b4f9);};}exports[_0x6d6a('0x1e')]=function(_0x9b3e2a,_0x44bafc){var _0x23ab52={};var _0x32f6ee=_['map'](db['MailInteraction'][_0x6d6a('0x1f')],function(_0x47e395){return{'name':_0x47e395['fieldName'],'type':_0x47e395[_0x6d6a('0x20')]['key']};});_0x23ab52=qs[_0x6d6a('0x21')](_0x32f6ee,_0x9b3e2a);return interaction[_0x6d6a('0x22')](_0x6d6a('0x23'),_0x9b3e2a[_0x6d6a('0x24')],_0x9b3e2a['user'],_0x23ab52,_0x32f6ee)[_0x6d6a('0x25')](respondWithFilteredResult(_0x44bafc,_0x23ab52))['catch'](handleError(_0x44bafc,null));};exports[_0x6d6a('0x26')]=function(_0x34a0a1,_0x200648){var _0x494bd9={'raw':![],'where':{'id':_0x34a0a1[_0x6d6a('0x27')]['id']}},_0x3d5065={};_0x3d5065[_0x6d6a('0x28')]=_[_0x6d6a('0x29')](db['MailInteraction'][_0x6d6a('0x1f')]);_0x3d5065['query']=_['keys'](_0x34a0a1[_0x6d6a('0x24')]);_0x3d5065[_0x6d6a('0x2a')]=_['intersection'](_0x3d5065['model'],_0x3d5065[_0x6d6a('0x24')]);_0x494bd9['attributes']=_['intersection'](_0x3d5065['model'],qs[_0x6d6a('0x2b')](_0x34a0a1[_0x6d6a('0x24')][_0x6d6a('0x2b')]));_0x494bd9['attributes']=_0x494bd9[_0x6d6a('0x2c')][_0x6d6a('0x2d')]?_0x494bd9['attributes']:_0x3d5065[_0x6d6a('0x28')];if(_0x34a0a1[_0x6d6a('0x24')][_0x6d6a('0x2e')]){_0x494bd9['include']=[{'all':!![]}];}_0x494bd9=_[_0x6d6a('0x2f')]({},_0x494bd9,_0x34a0a1['options']);return db[_0x6d6a('0x30')]['find'](_0x494bd9)[_0x6d6a('0x25')](handleEntityNotFound(_0x200648,null))[_0x6d6a('0x25')](respondWithResult(_0x200648,null))['catch'](handleError(_0x200648,null));};exports[_0x6d6a('0x31')]=function(_0x1d261f,_0x143b7d){return db['MailInteraction'][_0x6d6a('0x31')](_0x1d261f[_0x6d6a('0x32')],{})[_0x6d6a('0x25')](respondWithResult(_0x143b7d,0xc9))[_0x6d6a('0x33')](handleError(_0x143b7d,null));};exports[_0x6d6a('0x18')]=function(_0x121fd1,_0x46a377){if(_0x121fd1[_0x6d6a('0x32')]['id']){delete _0x121fd1[_0x6d6a('0x32')]['id'];}return db[_0x6d6a('0x30')][_0x6d6a('0x34')]({'where':{'id':_0x121fd1[_0x6d6a('0x27')]['id']}})[_0x6d6a('0x25')](handleEntityNotFound(_0x46a377,null))[_0x6d6a('0x25')](saveUpdates(_0x121fd1['body'],null))[_0x6d6a('0x25')](respondWithResult(_0x46a377,null))[_0x6d6a('0x33')](handleError(_0x46a377,null));};exports[_0x6d6a('0x35')]=function(_0x57f82a,_0x26f69f){return db['MailInteraction']['find']({'where':{'id':_0x57f82a[_0x6d6a('0x27')]['id']}})[_0x6d6a('0x25')](handleEntityNotFound(_0x26f69f,null))[_0x6d6a('0x25')](removeEntity(_0x26f69f,null))['catch'](handleError(_0x26f69f,null));};exports[_0x6d6a('0x36')]=function(_0x4027db,_0x283b18){return db[_0x6d6a('0x30')][_0x6d6a('0x36')]()['then'](respondWithResult(_0x283b18,null))['catch'](handleError(_0x283b18,null));};exports[_0x6d6a('0x37')]=function(_0x8875c6,_0x2e020c){return db['MailMessage']['find']({'where':{'id':_0x8875c6[_0x6d6a('0x27')]['id']}})[_0x6d6a('0x25')](handleEntityNotFound(_0x2e020c,null))['then'](function(_0x137e9d){if(_0x137e9d){return _0x137e9d[_0x6d6a('0x37')](_0x8875c6['body'][_0x6d6a('0x38')],_[_0x6d6a('0x39')](_0x8875c6[_0x6d6a('0x32')],[_0x6d6a('0x38'),'id'])||{});}})[_0x6d6a('0x25')](respondWithResult(_0x2e020c,null))[_0x6d6a('0x33')](handleError(_0x2e020c,null));};exports[_0x6d6a('0x3a')]=function(_0x3f8118,_0x545fd5){var _0x5b6466={'raw':![],'where':{}};var _0x21871f={};var _0x21e990={'count':0x0,'rows':[]};return db[_0x6d6a('0x30')][_0x6d6a('0x3b')]({'where':{'id':_0x3f8118['params']['id']}})[_0x6d6a('0x25')](handleEntityNotFound(_0x545fd5,null))[_0x6d6a('0x25')](function(_0x4b6753){if(_0x4b6753){_0x21871f[_0x6d6a('0x28')]=_['keys'](db['MailMessage'][_0x6d6a('0x1f')]);_0x21871f['query']=_[_0x6d6a('0x29')](_0x3f8118[_0x6d6a('0x24')]);_0x21871f[_0x6d6a('0x2a')]=_[_0x6d6a('0x3c')](_0x21871f[_0x6d6a('0x28')],_0x21871f[_0x6d6a('0x24')]);_0x5b6466[_0x6d6a('0x2c')]=_[_0x6d6a('0x3c')](_0x21871f[_0x6d6a('0x28')],qs[_0x6d6a('0x2b')](_0x3f8118['query'][_0x6d6a('0x2b')]));_0x5b6466[_0x6d6a('0x2c')]=_0x5b6466[_0x6d6a('0x2c')]['length']?_0x5b6466[_0x6d6a('0x2c')]:_0x21871f[_0x6d6a('0x28')];if(!_0x3f8118[_0x6d6a('0x24')][_0x6d6a('0x3d')](_0x6d6a('0x3e'))){_0x5b6466[_0x6d6a('0x13')]=qs['limit'](_0x3f8118[_0x6d6a('0x24')][_0x6d6a('0x13')]);_0x5b6466[_0x6d6a('0x12')]=qs[_0x6d6a('0x12')](_0x3f8118[_0x6d6a('0x24')][_0x6d6a('0x12')]);}_0x5b6466[_0x6d6a('0x3f')]=qs[_0x6d6a('0x40')](_0x3f8118[_0x6d6a('0x24')]['sort']);_0x5b6466[_0x6d6a('0x41')]=qs[_0x6d6a('0x2a')](_['pick'](_0x3f8118[_0x6d6a('0x24')],_0x21871f[_0x6d6a('0x2a')]));_0x5b6466[_0x6d6a('0x41')][_0x6d6a('0x42')]=_0x4b6753['id'];if(_0x3f8118['query'][_0x6d6a('0x43')]){_0x5b6466['where']=_[_0x6d6a('0x2f')](_0x5b6466[_0x6d6a('0x41')],{'$or':_[_0x6d6a('0x44')](_0x5b6466['attributes'],function(_0x358ecf){var _0x427322={};_0x427322[_0x358ecf]={'$like':'%'+_0x3f8118[_0x6d6a('0x24')][_0x6d6a('0x43')]+'%'};return _0x427322;})});}if(_0x3f8118[_0x6d6a('0x24')][_0x6d6a('0x45')]){var _0x513afe=_0x3f8118[_0x6d6a('0x24')][_0x6d6a('0x45')][_0x6d6a('0x46')](',');var _0xe5cf85={};_0xe5cf85[_0x513afe[0x0]]={'$gte':moment(_0x513afe[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x5b6466[_0x6d6a('0x41')]=_[_0x6d6a('0x2f')](_0x5b6466[_0x6d6a('0x41')],_0xe5cf85);}_0x5b6466=_[_0x6d6a('0x2f')]({},_0x5b6466,_0x3f8118['options']);return db[_0x6d6a('0x47')][_0x6d6a('0x14')]({'where':_0x5b6466[_0x6d6a('0x41')]})['then'](function(_0x3e17b7){_0x21e990['count']=_0x3e17b7;if(_0x3f8118[_0x6d6a('0x24')][_0x6d6a('0x2e')]){_0x5b6466['include']=[{'all':!![]}];}return db['MailMessage'][_0x6d6a('0x22')](_0x5b6466);})[_0x6d6a('0x25')](function(_0x45e5fd){if(_0x3f8118[_0x6d6a('0x24')]['inlineCss']===_0x6d6a('0x48')){for(var _0x3a7473=0x0;_0x3a7473<_0x45e5fd[_0x6d6a('0x2d')];_0x3a7473++){_0x45e5fd[_0x3a7473]['body']=juice(_0x45e5fd[_0x3a7473][_0x6d6a('0x32')]);}}_0x21e990[_0x6d6a('0x49')]=_0x45e5fd;return _0x21e990;});}})['then'](respondWithFilteredResult(_0x545fd5,_0x5b6466))['catch'](handleError(_0x545fd5,null));};exports[_0x6d6a('0x4a')]=function(_0x588752,_0x3ea1af){return db['MailInteraction'][_0x6d6a('0x34')]({'where':{'id':_0x588752['params']['id']}})[_0x6d6a('0x25')](handleEntityNotFound(_0x3ea1af,null))[_0x6d6a('0x25')](function(_0x46626a){if(_0x46626a){return _0x46626a[_0x6d6a('0x4b')](_0x588752[_0x6d6a('0x32')][_0x6d6a('0x38')],_[_0x6d6a('0x39')](_0x588752[_0x6d6a('0x32')],[_0x6d6a('0x38'),'id'])||{})['spread'](function(){return db[_0x6d6a('0x4c')][_0x6d6a('0x22')]({'attributes':['id',_0x6d6a('0x1c'),_0x6d6a('0x4d')],'where':{'id':_0x588752['body'][_0x6d6a('0x38')]}});})[_0x6d6a('0x25')](function(_0x3b7086){socket[_0x6d6a('0x4e')](_0x6d6a('0x4f'),{'id':Number(_0x588752[_0x6d6a('0x27')]['id']),'tags':_0x3b7086||[]});return{'id':Number(_0x588752[_0x6d6a('0x27')]['id']),'tags':_0x3b7086||[]};});}})['then'](respondWithResult(_0x3ea1af,null))[_0x6d6a('0x33')](handleError(_0x3ea1af,null));};exports[_0x6d6a('0x50')]=function(_0x636cfd,_0x449752){return db[_0x6d6a('0x30')][_0x6d6a('0x34')]({'where':{'id':_0x636cfd[_0x6d6a('0x27')]['id']}})[_0x6d6a('0x25')](handleEntityNotFound(_0x449752,null))['then'](function(_0x3d72cf){if(_0x3d72cf){return _0x3d72cf[_0x6d6a('0x50')](_0x636cfd[_0x6d6a('0x24')]['ids']);}})[_0x6d6a('0x25')](respondWithStatusCode(_0x449752,null))[_0x6d6a('0x33')](handleError(_0x449752,null));};exports['download']=function(_0x3c49f3,_0x18107f){var _0x26ca80=moment()[_0x6d6a('0x51')]()['toString']();var _0x3e0851=path[_0x6d6a('0x52')](config[_0x6d6a('0x53')],_0x6d6a('0x54'),_0x6d6a('0x55'),_0x6d6a('0x56'));var _0x45ee2a=path[_0x6d6a('0x52')](config[_0x6d6a('0x53')],_0x6d6a('0x54'),_0x6d6a('0x55'),_0x6d6a('0x57'));var _0x25e27a=path[_0x6d6a('0x52')](_0x3e0851,_0x26ca80);var _0x413a7b=util[_0x6d6a('0x58')](_0x6d6a('0x59'),_0x3c49f3[_0x6d6a('0x27')]['id'],_0x26ca80);var _0x3de2b2=path['join'](_0x3e0851,_0x413a7b);var _0x3237ea=[];if(_0x3c49f3[_0x6d6a('0x24')]['attachments']){_0x3237ea[_0x6d6a('0x5a')]({'model':db[_0x6d6a('0x5b')],'as':_0x6d6a('0x5c'),'raw':!![]});}var _0x267f4a=[{'model':db[_0x6d6a('0x47')],'as':'Messages','attributes':['id',_0x6d6a('0x32'),_0x6d6a('0x5d'),'to','cc','bcc',_0x6d6a('0x5e'),_0x6d6a('0x5f')],'where':{'secret':![]},'order':qs[_0x6d6a('0x40')]('id'),'include':_0x3237ea}];return db[_0x6d6a('0x30')][_0x6d6a('0x34')]({'where':{'id':_0x3c49f3[_0x6d6a('0x27')]['id']},'include':_0x267f4a})[_0x6d6a('0x25')](handleEntityNotFound(_0x18107f,null))[_0x6d6a('0x25')](function(_0x2fbada){if(_0x2fbada&&_0x2fbada[_0x6d6a('0x60')]){var _0x411607=_0x2fbada[_0x6d6a('0x61')]({'plain':!![]});fs[_0x6d6a('0x62')](_0x25e27a);return BPromise[_0x6d6a('0x63')](_0x411607['Messages'],function(_0x4a7d4b,_0x53d890){var _0xd38dab={'from':_0x4a7d4b[_0x6d6a('0x5d')],'to':_0x4a7d4b['to']||_0x6d6a('0x64'),'subject':_0x4a7d4b[_0x6d6a('0x5e')],'html':htmlEntities['decode'](_0x4a7d4b['body']),'headers':{'Date':moment(_0x4a7d4b[_0x6d6a('0x5f')])[_0x6d6a('0x58')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x4a7d4b['cc']){_0xd38dab[_0x6d6a('0x65')]['Cc']=_0x4a7d4b['cc'];}if(_0x4a7d4b[_0x6d6a('0x66')]){_0xd38dab['headers'][_0x6d6a('0x67')]=_0x4a7d4b[_0x6d6a('0x66')];}return new BPromise(function(_0x774bb,_0x183527){if(_0x4a7d4b[_0x6d6a('0x5c')]){for(var _0x3aa2b1=0x0;_0x3aa2b1<_0x4a7d4b[_0x6d6a('0x5c')][_0x6d6a('0x2d')];_0x3aa2b1++){var _0x117a69=_0x4a7d4b['Attachments'][_0x3aa2b1];var _0xdb64c0=path['join'](_0x45ee2a,_0x117a69['basename']);if(fs[_0x6d6a('0x68')](_0xdb64c0)){_0xd38dab[_0x6d6a('0x57')]['push']({'name':_0x117a69[_0x6d6a('0x1c')],'contentType':_0x117a69[_0x6d6a('0x20')],'data':fs[_0x6d6a('0x69')](_0xdb64c0)});}}}emlformat[_0x6d6a('0x6a')](_0xd38dab,function(_0x4559b8,_0x4e4c54){if(_0x4559b8)return _0x183527(_0x4559b8);fs[_0x6d6a('0x6b')](path[_0x6d6a('0x52')](_0x25e27a,util[_0x6d6a('0x58')](_0x6d6a('0x6c'),_0x53d890)),_0x4e4c54);return _0x774bb(_0x4e4c54);});});})[_0x6d6a('0x25')](function(){return new BPromise(function(_0xd21095,_0x5a6aee){zipdir(_0x25e27a,{'saveTo':_0x3de2b2},function(_0x43bbe2,_0x28af83){if(_0x43bbe2)return _0x5a6aee(_0x43bbe2);return _0xd21095(_0x28af83);});})['then'](function(){return new BPromise(function(_0x422e9d,_0x5612b7){rimraf(_0x25e27a,function(_0x5cc31e){if(_0x5cc31e)_0x5612b7(_0x5cc31e);return _0x422e9d();});});})[_0x6d6a('0x25')](function(){return _0x18107f[_0x6d6a('0x6d')](_0x3de2b2,_0x413a7b,function(_0x16ed4f){if(!_0x16ed4f)fs[_0x6d6a('0x6e')](_0x3de2b2);});});});}else{return _0x18107f[_0x6d6a('0x11')](0xc8);}})[_0x6d6a('0x33')](handleError(_0x18107f,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 870d63f..a6bca09 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 _0x9116=['exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','map','then','unreadMessages','length','emit','catch','hook'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9116,0x10f));var _0x6911=function(_0xb95e68,_0x46fea5){_0xb95e68=_0xb95e68-0x0;var _0x274df0=_0x9116[_0xb95e68];return _0x274df0;};'use strict';var EventEmitter=require(_0x6911('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x6911('0x1')];var MailMessage=require(_0x6911('0x2'))['db'][_0x6911('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6911('0x4')](0x0);var events={'afterCreate':_0x6911('0x5'),'afterUpdate':_0x6911('0x6'),'afterDestroy':'remove'};function emitEvent(_0x573957){return function(_0x91ecba,_0x58fd4e,_0xb79588){_0x91ecba[_0x6911('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x30c27c){_0x91ecba[_0x6911('0x8')](_0x6911('0x9'),_0x30c27c[_0x6911('0xa')](function(_0x261813){return{'id':_0x261813['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x91ecba['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6911('0xb')](function(_0x25b678){_0x91ecba[_0x6911('0x8')](_0x6911('0xc'),_0x25b678[_0x6911('0xd')]);MailInteractionEvents[_0x6911('0xe')](_0x573957+':'+_0x91ecba['id'],_0x91ecba);MailInteractionEvents[_0x6911('0xe')](_0x573957,_0x91ecba);_0xb79588(null);})[_0x6911('0xf')](_0xb79588(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x6911('0x10')](e,emitEvent(event));}}module[_0x6911('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x9345=['save','remove','getUsers','then','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','MailMessage'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x9345,0x6c));var _0x5934=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0x9345[_0x5ef55a];return _0x20ae40;};'use strict';var EventEmitter=require(_0x5934('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x5934('0x1')];var MailMessage=require(_0x5934('0x2'))['db'][_0x5934('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5934('0x4'),'afterUpdate':'update','afterDestroy':_0x5934('0x5')};function emitEvent(_0xee1ad6){return function(_0x47d21b,_0x2ebd79,_0x593360){_0x47d21b[_0x5934('0x6')]({'attributes':['id'],'raw':!![]})[_0x5934('0x7')](function(_0xa1a450){_0x47d21b['setDataValue'](_0x5934('0x8'),_0xa1a450['map'](function(_0x49a872){return{'id':_0x49a872['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x47d21b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2bfebd){_0x47d21b['setDataValue'](_0x5934('0x9'),_0x2bfebd[_0x5934('0xa')]);MailInteractionEvents[_0x5934('0xb')](_0xee1ad6+':'+_0x47d21b['id'],_0x47d21b);MailInteractionEvents['emit'](_0xee1ad6,_0x47d21b);_0x593360(null);})[_0x5934('0xc')](_0x593360(null));};}for(var e in events){if(events[_0x5934('0xd')](e)){var event=events[e];MailInteraction[_0x5934('0xe')](e,emitEvent(event));}}module[_0x5934('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 2e8ff71..7c1a32f 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 _0x6b2d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models','update','then','catch','utf8mb4_unicode_ci','util'];(function(_0x18363c,_0x40e913){var _0x3c1f7f=function(_0x11c01d){while(--_0x11c01d){_0x18363c['push'](_0x18363c['shift']());}};_0x3c1f7f(++_0x40e913);}(_0x6b2d,0x143));var _0xd6b2=function(_0x1a1ebd,_0x4f8bfe){_0x1a1ebd=_0x1a1ebd-0x0;var _0x3a8a13=_0x6b2d[_0x1a1ebd];return _0x3a8a13;};'use strict';var _=require('lodash');var util=require(_0xd6b2('0x0'));var logger=require(_0xd6b2('0x1'))(_0xd6b2('0x2'));var moment=require(_0xd6b2('0x3'));var BPromise=require(_0xd6b2('0x4'));var rp=require(_0xd6b2('0x5'));var fs=require('fs');var path=require(_0xd6b2('0x6'));var rimraf=require(_0xd6b2('0x7'));var config=require(_0xd6b2('0x8'));var attributes=require(_0xd6b2('0x9'));module[_0xd6b2('0xa')]=function(_0x2b7bf8,_0x1bf25e){return _0x2b7bf8[_0xd6b2('0xb')]('MailInteraction',attributes,{'tableName':_0xd6b2('0xc'),'paranoid':![],'indexes':[{'name':_0xd6b2('0xd'),'fields':['subject','to'],'type':_0xd6b2('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a618a,_0x1f24c2,_0x2ef9c9){if(_0x1a618a[_0xd6b2('0xf')]){_0x1a618a[_0xd6b2('0x10')]=moment()[_0xd6b2('0x11')](_0xd6b2('0x12'));}if(_0x1a618a[_0xd6b2('0x13')]){_0x1a618a['closedAt']=moment()[_0xd6b2('0x11')](_0xd6b2('0x12'));}_0x2ef9c9(null,_0x1f24c2);},'beforeUpdate':function(_0x570b44,_0x4832c9,_0x5aa7e3){if(_0x570b44[_0xd6b2('0x14')](_0xd6b2('0xf'))){_0x570b44[_0xd6b2('0x10')]=_0x570b44[_0xd6b2('0xf')]?moment()[_0xd6b2('0x11')](_0xd6b2('0x12')):null;}if(_0x570b44[_0xd6b2('0x14')]('closed')){_0x570b44[_0xd6b2('0x15')]=moment()[_0xd6b2('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x570b44['substatus']=null;_0x570b44[_0xd6b2('0x10')]=null;}_0x5aa7e3(null,_0x570b44);},'afterUpdate':function(_0x1c5fda,_0xdababf,_0x982eb9){var _0x3f4d55=_0x2b7bf8[_0xd6b2('0x16')];var _0x2d6102=_0x1c5fda['get']({'plain':!![]});if(_0x2d6102[_0xd6b2('0x13')]){return _0x3f4d55['MailMessage'][_0xd6b2('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x2d6102['id']}})[_0xd6b2('0x18')](function(){_0x982eb9();})[_0xd6b2('0x19')](function(_0x2aa58b){_0x982eb9(_0x2aa58b);});}else{_0x982eb9();}}},'charset':'utf8mb4','collate':_0xd6b2('0x1a')});}; \ No newline at end of file +var _0x8a89=['substatus','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed'];(function(_0x502f76,_0x27cad9){var _0x4fc00e=function(_0x19ea0){while(--_0x19ea0){_0x502f76['push'](_0x502f76['shift']());}};_0x4fc00e(++_0x27cad9);}(_0x8a89,0x1db));var _0x98a8=function(_0x4c70c4,_0x963969){_0x4c70c4=_0x4c70c4-0x0;var _0x437865=_0x8a89[_0x4c70c4];return _0x437865;};'use strict';var _=require(_0x98a8('0x0'));var util=require('util');var logger=require(_0x98a8('0x1'))(_0x98a8('0x2'));var moment=require('moment');var BPromise=require(_0x98a8('0x3'));var rp=require(_0x98a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x98a8('0x5'));var config=require(_0x98a8('0x6'));var attributes=require(_0x98a8('0x7'));module[_0x98a8('0x8')]=function(_0x11e1f6,_0x2184e3){return _0x11e1f6[_0x98a8('0x9')]('MailInteraction',attributes,{'tableName':_0x98a8('0xa'),'paranoid':![],'indexes':[{'name':_0x98a8('0xb'),'fields':[_0x98a8('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24004d,_0x2a16f8,_0x48368b){if(_0x24004d['substatus']){_0x24004d[_0x98a8('0xd')]=moment()[_0x98a8('0xe')](_0x98a8('0xf'));}if(_0x24004d[_0x98a8('0x10')]){_0x24004d[_0x98a8('0x11')]=moment()[_0x98a8('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x48368b(null,_0x2a16f8);},'beforeUpdate':function(_0x1ff1f0,_0x2cd5ce,_0x4e6c22){if(_0x1ff1f0[_0x98a8('0x12')](_0x98a8('0x13'))){_0x1ff1f0[_0x98a8('0xd')]=_0x1ff1f0[_0x98a8('0x13')]?moment()[_0x98a8('0xe')](_0x98a8('0xf')):null;}if(_0x1ff1f0[_0x98a8('0x12')](_0x98a8('0x10'))){_0x1ff1f0['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1ff1f0[_0x98a8('0x13')]=null;_0x1ff1f0['substatusAt']=null;}_0x4e6c22(null,_0x1ff1f0);},'afterUpdate':function(_0x32985e,_0x415b3d,_0x43da5d){var _0x3294f3=_0x11e1f6['models'];var _0x27d573=_0x32985e[_0x98a8('0x14')]({'plain':!![]});if(_0x27d573[_0x98a8('0x10')]){return _0x3294f3['MailMessage'][_0x98a8('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x27d573['id']}})[_0x98a8('0x16')](function(){_0x43da5d();})[_0x98a8('0x17')](function(_0x376ff0){_0x43da5d(_0x376ff0);});}else{_0x43da5d();}}},'charset':_0x98a8('0x18'),'collate':_0x98a8('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 91253d7..b1232ea 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 _0x8b17=['result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','limit','then','AddTagsToMailInteraction','find','where','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message'];(function(_0x460268,_0x1446a3){var _0x6e3d8f=function(_0x44f1b8){while(--_0x44f1b8){_0x460268['push'](_0x460268['shift']());}};_0x6e3d8f(++_0x1446a3);}(_0x8b17,0xbe));var _0x78b1=function(_0x43e41f,_0x14f856){_0x43e41f=_0x43e41f-0x0;var _0xc885a5=_0x8b17[_0x43e41f];return _0xc885a5;};'use strict';var _=require('lodash');var util=require(_0x78b1('0x0'));var moment=require(_0x78b1('0x1'));var BPromise=require(_0x78b1('0x2'));var rs=require(_0x78b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78b1('0x4'))['db'];var utils=require(_0x78b1('0x5'));var logger=require(_0x78b1('0x6'))(_0x78b1('0x7'));var config=require(_0x78b1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x78b1('0x9')][_0x78b1('0xa')]({'port':0x232a});config[_0x78b1('0xb')]=_['defaults'](config[_0x78b1('0xb')],{'host':_0x78b1('0xc'),'port':0x18eb});var socket=require(_0x78b1('0xd'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x78b1('0xe')](socket);function respondWithRpcPromise(_0x559c32,_0x18bd50,_0x2fc62c){return new BPromise(function(_0xa16b94,_0x38281f){return client[_0x78b1('0xf')](_0x559c32,_0x2fc62c)['then'](function(_0x27f945){logger[_0x78b1('0x10')]('MailInteraction,\x20%s,\x20%s',_0x18bd50,_0x78b1('0x11'));logger[_0x78b1('0x12')](_0x78b1('0x13'),_0x18bd50,_0x78b1('0x11'),JSON[_0x78b1('0x14')](_0x27f945));if(_0x27f945[_0x78b1('0x15')]){if(_0x27f945[_0x78b1('0x15')][_0x78b1('0x16')]===0x1f4){logger['error'](_0x78b1('0x17'),_0x18bd50,_0x27f945[_0x78b1('0x15')][_0x78b1('0x18')]);return _0x38281f(_0x27f945[_0x78b1('0x15')][_0x78b1('0x18')]);}logger[_0x78b1('0x15')](_0x78b1('0x17'),_0x18bd50,_0x27f945['error'][_0x78b1('0x18')]);return _0xa16b94(_0x27f945[_0x78b1('0x15')][_0x78b1('0x18')]);}else{logger[_0x78b1('0x10')]('MailInteraction,\x20%s,\x20%s',_0x18bd50,_0x78b1('0x11'));_0xa16b94(_0x27f945[_0x78b1('0x19')][_0x78b1('0x18')]);}})[_0x78b1('0x1a')](function(_0x5571bb){logger[_0x78b1('0x15')](_0x78b1('0x17'),_0x18bd50,_0x5571bb);_0x38281f(_0x5571bb);});});}exports[_0x78b1('0x1b')]=function(_0x4af0a9){var _0x16e9cb=this;return new Promise(function(_0x3d5b4c,_0x1dd290){return db[_0x78b1('0x1c')][_0x78b1('0x1d')](_0x4af0a9[_0x78b1('0x1e')],{'raw':_0x4af0a9['options']?_0x4af0a9[_0x78b1('0x1f')][_0x78b1('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4af0a9[_0x78b1('0x1f')]?_0x4af0a9[_0x78b1('0x1f')]['where']||null:null,'attributes':_0x4af0a9[_0x78b1('0x1f')]?_0x4af0a9[_0x78b1('0x1f')]['attributes']||null:null,'limit':_0x4af0a9[_0x78b1('0x1f')]?_0x4af0a9[_0x78b1('0x1f')][_0x78b1('0x21')]||null:null})[_0x78b1('0x22')](function(_0x25e3bc){logger['info']('UpdateMailInteraction',_0x4af0a9);logger[_0x78b1('0x12')](_0x78b1('0x1b'),_0x4af0a9,JSON['stringify'](_0x25e3bc));_0x3d5b4c(_0x25e3bc);})[_0x78b1('0x1a')](function(_0xfd551f){logger[_0x78b1('0x15')](_0x78b1('0x1b'),_0xfd551f[_0x78b1('0x18')],_0x4af0a9);_0x1dd290(_0x16e9cb['error'](0x1f4,_0xfd551f[_0x78b1('0x18')]));});});};exports[_0x78b1('0x23')]=function(_0x4f2069){return new Promise(function(_0x56719f,_0x324953){return db[_0x78b1('0x1c')][_0x78b1('0x24')]({'where':_0x4f2069[_0x78b1('0x1f')]?_0x4f2069[_0x78b1('0x1f')][_0x78b1('0x25')]||null:null})[_0x78b1('0x22')](function(_0x4a6a9e){if(_0x4a6a9e){return _0x4a6a9e[_0x78b1('0x26')](_0x4f2069[_0x78b1('0x1e')][_0x78b1('0x27')],_[_0x78b1('0x28')](_0x4f2069[_0x78b1('0x1e')],['ids','id'])||{});}})[_0x78b1('0x29')](function(_0x4d05f5){logger[_0x78b1('0x10')]('AddTags',_0x4f2069);logger[_0x78b1('0x12')](_0x78b1('0x2a'),_0x4f2069,JSON['stringify'](_0x4d05f5));_0x56719f(_0x4d05f5);})[_0x78b1('0x1a')](function(_0x1a4faa){logger[_0x78b1('0x15')](_0x78b1('0x2a'),_0x1a4faa[_0x78b1('0x18')],_0x4f2069);_0x324953(_this[_0x78b1('0x15')](0x1f4,_0x1a4faa['message']));});});}; \ No newline at end of file +var _0x6f44=['message','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToMailInteraction','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x89a5fa,_0x354d3c){var _0x332590=function(_0x55e7f7){while(--_0x55e7f7){_0x89a5fa['push'](_0x89a5fa['shift']());}};_0x332590(++_0x354d3c);}(_0x6f44,0x1ea));var _0x46f4=function(_0x4e22d4,_0x2a7a57){_0x4e22d4=_0x4e22d4-0x0;var _0x4a6c13=_0x6f44[_0x4e22d4];return _0x4a6c13;};'use strict';var _=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var moment=require('moment');var BPromise=require(_0x46f4('0x2'));var rs=require(_0x46f4('0x3'));var fs=require('fs');var Redis=require(_0x46f4('0x4'));var db=require(_0x46f4('0x5'))['db'];var utils=require(_0x46f4('0x6'));var logger=require(_0x46f4('0x7'))(_0x46f4('0x8'));var config=require(_0x46f4('0x9'));var jayson=require(_0x46f4('0xa'));var client=jayson['client'][_0x46f4('0xb')]({'port':0x232a});config[_0x46f4('0xc')]=_[_0x46f4('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x46f4('0xe'))(new Redis(config[_0x46f4('0xc')]));require('./mailInteraction.socket')[_0x46f4('0xf')](socket);function respondWithRpcPromise(_0x5662a3,_0x2064fd,_0x487ef8){return new BPromise(function(_0x14cc75,_0x1fe1a5){return client[_0x46f4('0x10')](_0x5662a3,_0x487ef8)[_0x46f4('0x11')](function(_0xbc1148){logger[_0x46f4('0x12')](_0x46f4('0x13'),_0x2064fd,_0x46f4('0x14'));logger[_0x46f4('0x15')](_0x46f4('0x16'),_0x2064fd,_0x46f4('0x14'),JSON[_0x46f4('0x17')](_0xbc1148));if(_0xbc1148['error']){if(_0xbc1148[_0x46f4('0x18')][_0x46f4('0x19')]===0x1f4){logger['error'](_0x46f4('0x13'),_0x2064fd,_0xbc1148[_0x46f4('0x18')][_0x46f4('0x1a')]);return _0x1fe1a5(_0xbc1148['error'][_0x46f4('0x1a')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x2064fd,_0xbc1148[_0x46f4('0x18')][_0x46f4('0x1a')]);return _0x14cc75(_0xbc1148[_0x46f4('0x18')]['message']);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x2064fd,'request\x20sent');_0x14cc75(_0xbc1148[_0x46f4('0x1b')][_0x46f4('0x1a')]);}})['catch'](function(_0x22209b){logger[_0x46f4('0x18')](_0x46f4('0x13'),_0x2064fd,_0x22209b);_0x1fe1a5(_0x22209b);});});}exports[_0x46f4('0x1c')]=function(_0x4b0650){var _0x1af169=this;return new Promise(function(_0x390137,_0x1627db){return db[_0x46f4('0x1d')][_0x46f4('0x1e')](_0x4b0650[_0x46f4('0x1f')],{'raw':_0x4b0650['options']?_0x4b0650[_0x46f4('0x20')][_0x46f4('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b0650[_0x46f4('0x20')]?_0x4b0650['options'][_0x46f4('0x22')]||null:null,'attributes':_0x4b0650[_0x46f4('0x20')]?_0x4b0650[_0x46f4('0x20')][_0x46f4('0x23')]||null:null,'limit':_0x4b0650[_0x46f4('0x20')]?_0x4b0650[_0x46f4('0x20')][_0x46f4('0x24')]||null:null})[_0x46f4('0x11')](function(_0x39eb2f){logger[_0x46f4('0x12')](_0x46f4('0x1c'),_0x4b0650);logger[_0x46f4('0x15')](_0x46f4('0x1c'),_0x4b0650,JSON['stringify'](_0x39eb2f));_0x390137(_0x39eb2f);})[_0x46f4('0x25')](function(_0x30d4fc){logger[_0x46f4('0x18')](_0x46f4('0x1c'),_0x30d4fc[_0x46f4('0x1a')],_0x4b0650);_0x1627db(_0x1af169[_0x46f4('0x18')](0x1f4,_0x30d4fc['message']));});});};exports[_0x46f4('0x26')]=function(_0x552ab0){return new Promise(function(_0x546d2b,_0x53ac21){return db[_0x46f4('0x1d')]['find']({'where':_0x552ab0[_0x46f4('0x20')]?_0x552ab0[_0x46f4('0x20')][_0x46f4('0x22')]||null:null})[_0x46f4('0x11')](function(_0x375da1){if(_0x375da1){return _0x375da1['addTags'](_0x552ab0[_0x46f4('0x1f')][_0x46f4('0x27')],_[_0x46f4('0x28')](_0x552ab0['body'],[_0x46f4('0x27'),'id'])||{});}})[_0x46f4('0x29')](function(_0x450d3f){logger['info']('AddTags',_0x552ab0);logger[_0x46f4('0x15')](_0x46f4('0x2a'),_0x552ab0,JSON[_0x46f4('0x17')](_0x450d3f));_0x546d2b(_0x450d3f);})['catch'](function(_0x2bb1e3){logger[_0x46f4('0x18')]('AddTags',_0x2bb1e3[_0x46f4('0x1a')],_0x552ab0);_0x53ac21(_this['error'](0x1f4,_0x2bb1e3[_0x46f4('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index d44ac35..1bf9247 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 _0x9631=['update','emit','register','mailInteraction:','./mailInteraction.events','save'];(function(_0x167696,_0x48e4e4){var _0x4168c3=function(_0x46b5dd){while(--_0x46b5dd){_0x167696['push'](_0x167696['shift']());}};_0x4168c3(++_0x48e4e4);}(_0x9631,0x148));var _0x1963=function(_0x5b05de,_0x441400){_0x5b05de=_0x5b05de-0x0;var _0x1dbd07=_0x9631[_0x5b05de];return _0x1dbd07;};'use strict';var MailInteractionEvents=require(_0x1963('0x0'));var events=[_0x1963('0x1'),'remove',_0x1963('0x2')];function createListener(_0x173d6d,_0x253eff){return function(_0x284924){_0x253eff[_0x1963('0x3')](_0x173d6d,_0x284924);};}function removeListener(_0x5c2682,_0x4bac73){return function(){MailInteractionEvents['removeListener'](_0x5c2682,_0x4bac73);};}exports[_0x1963('0x4')]=function(_0x4efbf6){for(var _0x4f39de=0x0,_0xe4309a=events['length'];_0x4f39de<_0xe4309a;_0x4f39de++){var _0x6be5ab=events[_0x4f39de];var _0x3bee84=createListener(_0x1963('0x5')+_0x6be5ab,_0x4efbf6);MailInteractionEvents['on'](_0x6be5ab,_0x3bee84);}}; \ No newline at end of file +var _0xbd64=['length','mailInteraction:','save','remove','update','removeListener','register'];(function(_0x3939ba,_0x438370){var _0x3a20b5=function(_0x15c94b){while(--_0x15c94b){_0x3939ba['push'](_0x3939ba['shift']());}};_0x3a20b5(++_0x438370);}(_0xbd64,0xb1));var _0x4bd6=function(_0x4f1e86,_0x585e4a){_0x4f1e86=_0x4f1e86-0x0;var _0x5aed86=_0xbd64[_0x4f1e86];return _0x5aed86;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x4bd6('0x0'),_0x4bd6('0x1'),_0x4bd6('0x2')];function createListener(_0x531b24,_0x5c5378){return function(_0x23e89e){_0x5c5378['emit'](_0x531b24,_0x23e89e);};}function removeListener(_0x19c1aa,_0x8f1bd3){return function(){MailInteractionEvents[_0x4bd6('0x3')](_0x19c1aa,_0x8f1bd3);};}exports[_0x4bd6('0x4')]=function(_0x55beeb){for(var _0x2cbc11=0x0,_0x117150=events[_0x4bd6('0x5')];_0x2cbc11<_0x117150;_0x2cbc11++){var _0x356675=events[_0x2cbc11];var _0x34cf9c=createListener(_0x4bd6('0x6')+_0x356675,_0x55beeb);MailInteractionEvents['on'](_0x356675,_0x34cf9c);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index ed303fe..22a195a 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa23f=['get','/describe','isAuthenticated','describe','express','Router'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa23f,0x7c));var _0xfa23=function(_0x23e1d7,_0x422032){_0x23e1d7=_0x23e1d7-0x0;var _0x113fee=_0xa23f[_0x23e1d7];return _0x113fee;};'use strict';var express=require(_0xfa23('0x0'));var router=express[_0xfa23('0x1')]();var auth=require('../../components/auth/service');var controller=require('./mailInteractionHasTag.controller');router[_0xfa23('0x2')](_0xfa23('0x3'),auth[_0xfa23('0x4')](),controller[_0xfa23('0x5')]);module['exports']=router; \ No newline at end of file +var _0x5d17=['express','Router','get','/describe','isAuthenticated','exports'];(function(_0x5f410a,_0x15e991){var _0x33f1be=function(_0x2a788d){while(--_0x2a788d){_0x5f410a['push'](_0x5f410a['shift']());}};_0x33f1be(++_0x15e991);}(_0x5d17,0x114));var _0x75d1=function(_0x15449d,_0x537b1d){_0x15449d=_0x15449d-0x0;var _0x55cf8c=_0x5d17[_0x15449d];return _0x55cf8c;};'use strict';var express=require(_0x75d1('0x0'));var router=express[_0x75d1('0x1')]();var auth=require('../../components/auth/service');var controller=require('./mailInteractionHasTag.controller');router[_0x75d1('0x2')](_0x75d1('0x3'),auth[_0x75d1('0x4')](),controller['describe']);module[_0x75d1('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 3993008..4451685 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x44afe1,_0x314593){var _0x5ef2c4=function(_0x45f898){while(--_0x45f898){_0x44afe1['push'](_0x44afe1['shift']());}};_0x5ef2c4(++_0x314593);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x486876,_0x5d5ddb){var _0x2506bd=function(_0x2646bc){while(--_0x2646bc){_0x486876['push'](_0x486876['shift']());}};_0x2506bd(++_0x5d5ddb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 2607c97..4353c3a 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f9d=['INTEGER','sequelize','exports'];(function(_0x21f17f,_0x49d662){var _0x21d30e=function(_0x315c66){while(--_0x315c66){_0x21f17f['push'](_0x21f17f['shift']());}};_0x21d30e(++_0x49d662);}(_0x4f9d,0x127));var _0xd4f9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4f9d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd4f9('0x0'));module[_0xd4f9('0x1')]={'MailInteractionId':{'type':Sequelize[_0xd4f9('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xd4f9('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xb4ed=['INTEGER','sequelize','exports'];(function(_0x4365b5,_0x31cbaf){var _0x3602a5=function(_0x4d0295){while(--_0x4d0295){_0x4365b5['push'](_0x4365b5['shift']());}};_0x3602a5(++_0x31cbaf);}(_0xb4ed,0x18a));var _0xdb4e=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0xb4ed[_0x322522];return _0x293bcf;};'use strict';var Sequelize=require(_0xdb4e('0x0'));module[_0xdb4e('0x1')]={'MailInteractionId':{'type':Sequelize[_0xdb4e('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xdb4e('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 9c5bdbe..e23fe07 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe13a=['mail_interaction_has_tags','./mailInteractionHasTag','exports','define'];(function(_0x40a166,_0x4f526a){var _0x725abe=function(_0x3f42c5){while(--_0x3f42c5){_0x40a166['push'](_0x40a166['shift']());}};_0x725abe(++_0x4f526a);}(_0xe13a,0x125));var _0xae13=function(_0x585758,_0x5747b8){_0x585758=_0x585758-0x0;var _0x4e4806=_0xe13a[_0x585758];return _0x4e4806;};'use strict';var attributes=require(_0xae13('0x0'));module[_0xae13('0x1')]=function(_0x51c6cf){return _0x51c6cf[_0xae13('0x2')]('MailInteractionHasTag',attributes,{'tableName':_0xae13('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8508=['./mailInteractionHasTag','exports','define','mail_interaction_has_tags'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0x8508,0x120));var _0x8850=function(_0x1c7b8c,_0x427cdf){_0x1c7b8c=_0x1c7b8c-0x0;var _0x4fd5e9=_0x8508[_0x1c7b8c];return _0x4fd5e9;};'use strict';var attributes=require(_0x8850('0x0'));module[_0x8850('0x1')]=function(_0x31adcd){return _0x31adcd[_0x8850('0x2')]('MailInteractionHasTag',attributes,{'tableName':_0x8850('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a42cfb5..844b740 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 _0xc1aa=['mail','mailmessage:create','put','/:id','accept','/:id/reject','reject','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id/download','download','post'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xc1aa,0xa9));var _0xac1a=function(_0x28bc41,_0x1eca28){_0x28bc41=_0x28bc41-0x0;var _0x31821b=_0xc1aa[_0x28bc41];return _0x31821b;};'use strict';var multer=require(_0xac1a('0x0'));var util=require('util');var path=require(_0xac1a('0x1'));var timeout=require(_0xac1a('0x2'));var express=require(_0xac1a('0x3'));var router=express['Router']();var fs_extra=require(_0xac1a('0x4'));var auth=require(_0xac1a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xac1a('0x6'));var controller=require('./mailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xac1a('0x7')]);router[_0xac1a('0x8')](_0xac1a('0x9'),auth[_0xac1a('0xa')](),controller[_0xac1a('0xb')]);router['get']('/:id',auth[_0xac1a('0xa')](),controller['show']);router[_0xac1a('0x8')](_0xac1a('0xc'),auth[_0xac1a('0xa')](),controller[_0xac1a('0xd')]);router[_0xac1a('0xe')]('/',auth[_0xac1a('0xa')](),interaction['tracked'](_0xac1a('0xf'),_0xac1a('0x10')),controller['create']);router[_0xac1a('0x11')](_0xac1a('0x12'),auth[_0xac1a('0xa')](),controller['update']);router[_0xac1a('0x11')]('/:id/accept',auth[_0xac1a('0xa')](),controller[_0xac1a('0x13')]);router[_0xac1a('0x11')](_0xac1a('0x14'),auth[_0xac1a('0xa')](),controller[_0xac1a('0x15')]);router['delete'](_0xac1a('0x12'),auth[_0xac1a('0xa')](),controller['destroy']);module[_0xac1a('0x16')]=router; \ No newline at end of file +var _0x0cfa=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','show','download','tracked','mail','mailmessage:create','put','/:id','update','/:id/accept','/:id/reject'];(function(_0x21eb60,_0x25cfdb){var _0xf3a77b=function(_0x30a8d4){while(--_0x30a8d4){_0x21eb60['push'](_0x21eb60['shift']());}};_0xf3a77b(++_0x25cfdb);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x141af9,_0x2d080f){_0x141af9=_0x141af9-0x0;var _0x1568d6=_0x0cfa[_0x141af9];return _0x1568d6;};'use strict';var multer=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var path=require(_0xa0cf('0x2'));var timeout=require(_0xa0cf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa0cf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa0cf('0x5'));var controller=require(_0xa0cf('0x6'));router[_0xa0cf('0x7')]('/',auth[_0xa0cf('0x8')](),controller['index']);router[_0xa0cf('0x7')]('/describe',auth[_0xa0cf('0x8')](),controller['describe']);router[_0xa0cf('0x7')]('/:id',auth[_0xa0cf('0x8')](),controller[_0xa0cf('0x9')]);router[_0xa0cf('0x7')]('/:id/download',auth[_0xa0cf('0x8')](),controller[_0xa0cf('0xa')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xa0cf('0xb')](_0xa0cf('0xc'),_0xa0cf('0xd')),controller['create']);router[_0xa0cf('0xe')](_0xa0cf('0xf'),auth[_0xa0cf('0x8')](),controller[_0xa0cf('0x10')]);router[_0xa0cf('0xe')](_0xa0cf('0x11'),auth[_0xa0cf('0x8')](),controller['accept']);router[_0xa0cf('0xe')](_0xa0cf('0x12'),auth[_0xa0cf('0x8')](),controller['reject']);router[_0xa0cf('0x13')](_0xa0cf('0xf'),auth[_0xa0cf('0x8')](),controller[_0xa0cf('0x14')]);module[_0xa0cf('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index d17ffed..8186c54 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 _0x9db1=['STRING','BOOLEAN','DATE','ENUM','Chat','Email','sequelize','lodash','exports','TEXT','long','medium','out'];(function(_0x2d1c0c,_0x1b0440){var _0x3343de=function(_0x508544){while(--_0x508544){_0x2d1c0c['push'](_0x2d1c0c['shift']());}};_0x3343de(++_0x1b0440);}(_0x9db1,0xf0));var _0x19db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9db1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x19db('0x0'));var _=require(_0x19db('0x1'));module[_0x19db('0x2')]={'body':{'type':Sequelize[_0x19db('0x3')](_0x19db('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x19db('0x3')](_0x19db('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x19db('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x19db('0x7')](0x1fe)},'from':{'type':Sequelize[_0x19db('0x7')]},'to':{'type':Sequelize[_0x19db('0x3')]('long')},'cc':{'type':Sequelize[_0x19db('0x3')](_0x19db('0x4'))},'bcc':{'type':Sequelize[_0x19db('0x3')](_0x19db('0x4'))},'subject':{'type':Sequelize[_0x19db('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x19db('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x19db('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x19db('0x4'))},'originCc':{'type':Sequelize[_0x19db('0x3')](_0x19db('0x4'))},'originChannel':{'type':Sequelize[_0x19db('0xa')]('Email',_0x19db('0xb')),'defaultValue':_0x19db('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0x21ad=['Email','Chat','sequelize','lodash','exports','TEXT','medium','ENUM','STRING','long','DATE','INTEGER','BOOLEAN'];(function(_0x1dd8a3,_0x109a7d){var _0x402f8e=function(_0x2a6e2b){while(--_0x2a6e2b){_0x1dd8a3['push'](_0x1dd8a3['shift']());}};_0x402f8e(++_0x109a7d);}(_0x21ad,0x161));var _0xd21a=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x21ad[_0x31cb5f];return _0x586042;};'use strict';var Sequelize=require(_0xd21a('0x0'));var _=require(_0xd21a('0x1'));module[_0xd21a('0x2')]={'body':{'type':Sequelize[_0xd21a('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xd21a('0x3')](_0xd21a('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd21a('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd21a('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xd21a('0x3')](_0xd21a('0x7'))},'cc':{'type':Sequelize[_0xd21a('0x3')]('long')},'bcc':{'type':Sequelize['TEXT'](_0xd21a('0x7'))},'subject':{'type':Sequelize[_0xd21a('0x3')]},'sentAt':{'type':Sequelize[_0xd21a('0x8')]},'attach':{'type':Sequelize[_0xd21a('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xd21a('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xd21a('0x8')]},'originTo':{'type':Sequelize[_0xd21a('0x3')]('long')},'originCc':{'type':Sequelize[_0xd21a('0x3')](_0xd21a('0x7'))},'originChannel':{'type':Sequelize[_0xd21a('0x5')](_0xd21a('0xb'),_0xd21a('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 4324c25..83489f2 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 _0x68da=['mail','acceptMessage','reject','UserId','user','agent','MailInteraction','MailInteractionId','interaction','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','interface','channel','motionChannel','fromString','rejectmessage','unix','toString','server','files','message-%s.eml','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','writeFileSync','download','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','status','offset','limit','undefined','count','set','Content-Range','json','update','then','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','filter','includeAll','include','findAll','catch','show','params','options','find','body','describe','create','direction','out','secret','split','findOne','MailAccountId','CmList','List','Contacts','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','CmContact','defaults','ListId','SendMail','sendMail','messageId','format','stringify','accept'];(function(_0x25806d,_0x115548){var _0x2f08d5=function(_0x5597df){while(--_0x5597df){_0x25806d['push'](_0x25806d['shift']());}};_0x2f08d5(++_0x115548);}(_0x68da,0x1eb));var _0xa68d=function(_0x2166a3,_0x237c50){_0x2166a3=_0x2166a3-0x0;var _0x260035=_0x68da[_0x2166a3];return _0x260035;};'use strict';var emlformat=require(_0xa68d('0x0'));var moment=require(_0xa68d('0x1'));var util=require(_0xa68d('0x2'));var path=require(_0xa68d('0x3'));var fs=require('fs');var _=require(_0xa68d('0x4'));var Redis=require(_0xa68d('0x5'));var htmlToText=require(_0xa68d('0x6'));var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xa68d('0x7'))('api');var interaction_log=require(_0xa68d('0x7'))(_0xa68d('0x8'));var config=require(_0xa68d('0x9'));var db=require(_0xa68d('0xa'))['db'];config[_0xa68d('0xb')]=_['defaults'](config[_0xa68d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa68d('0xc'))(new Redis(config[_0xa68d('0xb')]));var htmlEntities=require(_0xa68d('0xd'));require('./mailMessage.socket')[_0xa68d('0xe')](socket);var jayson=require(_0xa68d('0xf'));var client=jayson[_0xa68d('0x10')]['http']({'port':0x232c});var client9003=jayson[_0xa68d('0x10')][_0xa68d('0x11')]({'port':0x232b});var client9002=jayson[_0xa68d('0x10')][_0xa68d('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x2e7ab2,_0x3b1a11,_0x2edf57,_0x3906e3){return new Promise(function(_0x49ffd8,_0x23e74d){var _0x3d48c7=_0x3906e3||client;return _0x3d48c7[_0xa68d('0x12')](_0x2e7ab2,_0x2edf57)['then'](function(_0x4aa6f4){logger[_0xa68d('0x13')](_0xa68d('0x14'),_0x3b1a11,_0xa68d('0x15'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x3b1a11,_0xa68d('0x15'),JSON['stringify'](_0x4aa6f4));if(_0x4aa6f4[_0xa68d('0x16')]){if(_0x4aa6f4[_0xa68d('0x16')][_0xa68d('0x17')]===0x1f4){logger[_0xa68d('0x16')](_0xa68d('0x14'),_0x3b1a11,_0x4aa6f4[_0xa68d('0x16')][_0xa68d('0x18')]);return _0x23e74d(_0x4aa6f4[_0xa68d('0x16')]['message']);}logger[_0xa68d('0x16')](_0xa68d('0x14'),_0x3b1a11,_0x4aa6f4[_0xa68d('0x16')]['message']);return _0x49ffd8(_0x4aa6f4[_0xa68d('0x16')][_0xa68d('0x18')]);}else{logger[_0xa68d('0x13')](_0xa68d('0x14'),_0x3b1a11,'request\x20sent');_0x49ffd8(_0x4aa6f4[_0xa68d('0x19')]['message']);}})['catch'](function(_0x3c740e){logger[_0xa68d('0x16')](_0xa68d('0x14'),_0x3b1a11,_0x3c740e);_0x23e74d(_0x3c740e);});});}function respondWithResult(_0x5b20fc,_0x557b86){_0x557b86=_0x557b86||0xc8;return function(_0x5333fa){if(_0x5333fa){return _0x5b20fc[_0xa68d('0x1a')](_0x557b86)['json'](_0x5333fa);}};}function respondWithFilteredResult(_0x50a31b,_0x307f31){return function(_0x2ae015){if(_0x2ae015){var _0x3c5df3=typeof _0x307f31[_0xa68d('0x1b')]==='undefined'&&typeof _0x307f31[_0xa68d('0x1c')]===_0xa68d('0x1d');var _0x10e910=_0x2ae015['count'];var _0xdf8aff=_0x3c5df3?0x0:_0x307f31[_0xa68d('0x1b')];var _0x5ec317=_0x3c5df3?_0x2ae015[_0xa68d('0x1e')]:_0x307f31[_0xa68d('0x1b')]+_0x307f31[_0xa68d('0x1c')];var _0x4558b9;if(_0x5ec317>=_0x10e910){_0x5ec317=_0x10e910;_0x4558b9=0xc8;}else{_0x4558b9=0xce;}_0x50a31b[_0xa68d('0x1a')](_0x4558b9);return _0x50a31b[_0xa68d('0x1f')](_0xa68d('0x20'),_0xdf8aff+'-'+_0x5ec317+'/'+_0x10e910)[_0xa68d('0x21')](_0x2ae015);}return null;};}function saveUpdates(_0x3e3f19){return function(_0x4159a4){if(_0x4159a4){return _0x4159a4[_0xa68d('0x22')](_0x3e3f19)[_0xa68d('0x23')](function(_0x25cb58){return _0x25cb58;});}return null;};}function removeEntity(_0x115fe3){return function(_0x171d7f){if(_0x171d7f){return _0x171d7f[_0xa68d('0x24')]()[_0xa68d('0x23')](function(){_0x115fe3[_0xa68d('0x1a')](0xcc)[_0xa68d('0x25')]();});}};}function handleEntityNotFound(_0x18dc5b){return function(_0x1e31dd){if(!_0x1e31dd){_0x18dc5b[_0xa68d('0x26')](0x194);}return _0x1e31dd;};}function handleError(_0x9d8894,_0x7b0ae){_0x7b0ae=_0x7b0ae||0x1f4;return function(_0x2b8598){logger[_0xa68d('0x16')](_0x2b8598[_0xa68d('0x27')]);if(_0x2b8598[_0xa68d('0x28')]){delete _0x2b8598[_0xa68d('0x28')];}_0x9d8894['status'](_0x7b0ae)[_0xa68d('0x29')](_0x2b8598);};}exports[_0xa68d('0x2a')]=function(_0x560440,_0x5181a7){var _0x31341c={},_0x1e2dd3={},_0x333e6e={'count':0x0,'rows':[]};var _0x5c0b5b=_[_0xa68d('0x2b')](db[_0xa68d('0x2c')][_0xa68d('0x2d')],function(_0x456e05){return{'name':_0x456e05['fieldName'],'type':_0x456e05[_0xa68d('0x2e')][_0xa68d('0x2f')]};});_0x1e2dd3[_0xa68d('0x30')]=_[_0xa68d('0x2b')](_0x5c0b5b,_0xa68d('0x28'));_0x1e2dd3[_0xa68d('0x31')]=_[_0xa68d('0x32')](_0x560440[_0xa68d('0x31')]);_0x1e2dd3['filters']=_['intersection'](_0x1e2dd3[_0xa68d('0x30')],_0x1e2dd3['query']);_0x31341c[_0xa68d('0x33')]=_[_0xa68d('0x34')](_0x1e2dd3[_0xa68d('0x30')],qs[_0xa68d('0x35')](_0x560440[_0xa68d('0x31')][_0xa68d('0x35')]));_0x31341c[_0xa68d('0x33')]=_0x31341c[_0xa68d('0x33')][_0xa68d('0x36')]?_0x31341c[_0xa68d('0x33')]:_0x1e2dd3[_0xa68d('0x30')];if(!_0x560440[_0xa68d('0x31')][_0xa68d('0x37')](_0xa68d('0x38'))){_0x31341c[_0xa68d('0x1c')]=qs[_0xa68d('0x1c')](_0x560440['query'][_0xa68d('0x1c')]);_0x31341c[_0xa68d('0x1b')]=qs[_0xa68d('0x1b')](_0x560440['query'][_0xa68d('0x1b')]);}_0x31341c['order']=qs[_0xa68d('0x39')](_0x560440['query'][_0xa68d('0x39')]);_0x31341c['where']=qs[_0xa68d('0x3a')](_[_0xa68d('0x3b')](_0x560440[_0xa68d('0x31')],_0x1e2dd3['filters']),_0x5c0b5b);if(_0x560440['query']['filter']){_0x31341c[_0xa68d('0x3c')]=_[_0xa68d('0x3d')](_0x31341c[_0xa68d('0x3c')],{'$or':_[_0xa68d('0x2b')](_0x5c0b5b,function(_0x317a49){if(_0x317a49[_0xa68d('0x2e')]!=='VIRTUAL'){var _0x10e4fb={};_0x10e4fb[_0x317a49['name']]={'$like':'%'+_0x560440[_0xa68d('0x31')][_0xa68d('0x3e')]+'%'};return _0x10e4fb;}})});}_0x31341c=_['merge']({},_0x31341c,_0x560440['options']);var _0x582778={'where':_0x31341c['where']};return db[_0xa68d('0x2c')][_0xa68d('0x1e')](_0x582778)['then'](function(_0x2709b4){_0x333e6e[_0xa68d('0x1e')]=_0x2709b4;if(_0x560440[_0xa68d('0x31')][_0xa68d('0x3f')]){_0x31341c[_0xa68d('0x40')]=[{'all':!![]}];}return db[_0xa68d('0x2c')][_0xa68d('0x41')](_0x31341c);})[_0xa68d('0x23')](function(_0x4ef417){_0x333e6e['rows']=_0x4ef417;return _0x333e6e;})['then'](respondWithFilteredResult(_0x5181a7,_0x31341c))[_0xa68d('0x42')](handleError(_0x5181a7,null));};exports[_0xa68d('0x43')]=function(_0x3acb05,_0x1bcc0e){var _0x2b0244={'raw':!![],'where':{'id':_0x3acb05[_0xa68d('0x44')]['id']}},_0x3665c6={};_0x3665c6[_0xa68d('0x30')]=_[_0xa68d('0x32')](db[_0xa68d('0x2c')][_0xa68d('0x2d')]);_0x3665c6[_0xa68d('0x31')]=_['keys'](_0x3acb05[_0xa68d('0x31')]);_0x3665c6[_0xa68d('0x3a')]=_['intersection'](_0x3665c6[_0xa68d('0x30')],_0x3665c6[_0xa68d('0x31')]);_0x2b0244['attributes']=_[_0xa68d('0x34')](_0x3665c6[_0xa68d('0x30')],qs[_0xa68d('0x35')](_0x3acb05[_0xa68d('0x31')][_0xa68d('0x35')]));_0x2b0244[_0xa68d('0x33')]=_0x2b0244[_0xa68d('0x33')][_0xa68d('0x36')]?_0x2b0244[_0xa68d('0x33')]:_0x3665c6[_0xa68d('0x30')];if(_0x3acb05['query'][_0xa68d('0x3f')]){_0x2b0244[_0xa68d('0x40')]=[{'all':!![]}];}_0x2b0244=_['merge']({},_0x2b0244,_0x3acb05[_0xa68d('0x45')]);return db[_0xa68d('0x2c')][_0xa68d('0x46')](_0x2b0244)[_0xa68d('0x23')](handleEntityNotFound(_0x1bcc0e,null))[_0xa68d('0x23')](respondWithResult(_0x1bcc0e,null))[_0xa68d('0x42')](handleError(_0x1bcc0e,null));};exports['update']=function(_0x399951,_0x507c7b){if(_0x399951[_0xa68d('0x47')]['id']){delete _0x399951[_0xa68d('0x47')]['id'];}return db[_0xa68d('0x2c')][_0xa68d('0x46')]({'where':{'id':_0x399951[_0xa68d('0x44')]['id']}})['then'](handleEntityNotFound(_0x507c7b,null))[_0xa68d('0x23')](saveUpdates(_0x399951[_0xa68d('0x47')],null))[_0xa68d('0x23')](respondWithResult(_0x507c7b,null))[_0xa68d('0x42')](handleError(_0x507c7b,null));};exports[_0xa68d('0x24')]=function(_0x310811,_0x46ae11){return db[_0xa68d('0x2c')][_0xa68d('0x46')]({'where':{'id':_0x310811[_0xa68d('0x44')]['id']}})[_0xa68d('0x23')](handleEntityNotFound(_0x46ae11,null))[_0xa68d('0x23')](removeEntity(_0x46ae11,null))['catch'](handleError(_0x46ae11,null));};exports[_0xa68d('0x48')]=function(_0xdc293c,_0x2e32cb){return db[_0xa68d('0x2c')][_0xa68d('0x48')]()[_0xa68d('0x23')](respondWithResult(_0x2e32cb,null))[_0xa68d('0x42')](handleError(_0x2e32cb,null));};exports[_0xa68d('0x49')]=function(_0x2fa6c1,_0x2efeba){return db[_0xa68d('0x2c')]['create'](_0x2fa6c1[_0xa68d('0x47')])[_0xa68d('0x23')](function(_0x3cf782){if(_0x3cf782){if(_0x3cf782[_0xa68d('0x4a')]===_0xa68d('0x4b')&&!_0x3cf782[_0xa68d('0x4c')]){var _0x2b83ee,_0x4aebe0,_0x167d60;if(_0x2fa6c1[_0xa68d('0x47')]['to']){_0x4aebe0=_0x2fa6c1['body']['to'][_0xa68d('0x4d')](',')[0x0];}return db['MailAccount'][_0xa68d('0x4e')]({'where':{'id':_0x3cf782[_0xa68d('0x4f')]},'include':[{'model':db[_0xa68d('0x50')],'as':_0xa68d('0x51'),'include':[{'model':db['CmContact'],'as':_0xa68d('0x52'),'where':{'email':_0x4aebe0},'limit':0x1,'order':[['updatedAt',_0xa68d('0x53')]]}]},{'model':db[_0xa68d('0x54')],'as':_0xa68d('0x55'),'raw':!![],'include':[{'model':db[_0xa68d('0x56')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x7bcdad){_0x2b83ee=_0x7bcdad;if(!_0x2b83ee||!_0x2b83ee['Smtp'])return;var _0x5cf2c2=_0x2b83ee[_0xa68d('0x57')]();if(_0x2fa6c1[_0xa68d('0x47')][_0xa68d('0x58')]&&_0x2fa6c1['body'][_0xa68d('0x58')]['length']){for(var _0x2bd6e=0x0;_0x2bd6e<_0x2fa6c1[_0xa68d('0x47')][_0xa68d('0x58')][_0xa68d('0x36')];_0x2bd6e+=0x1){_0x2fa6c1[_0xa68d('0x47')]['attachments'][_0x2bd6e]={'filename':_0x2fa6c1[_0xa68d('0x47')][_0xa68d('0x58')][_0x2bd6e]['name'],'path':path[_0xa68d('0x59')](config[_0xa68d('0x5a')],'server/files/attachments',_0x2fa6c1[_0xa68d('0x47')][_0xa68d('0x58')][_0x2bd6e][_0xa68d('0x5b')])};}}_0x167d60={'account':_0x5cf2c2,'message':_0x2fa6c1[_0xa68d('0x47')]};return;})['then'](function(){if(_0x2b83ee[_0xa68d('0x51')]){if(_0x2b83ee[_0xa68d('0x51')][_0xa68d('0x52')]['length']){return _0x2b83ee['List'][_0xa68d('0x52')][0x0];}else{return db[_0xa68d('0x5c')]['create'](_[_0xa68d('0x5d')](_0x2fa6c1['body'],{'firstName':_0x2fa6c1[_0xa68d('0x47')]['to'],'email':_0x2fa6c1[_0xa68d('0x47')]['to'],'phone':_0x2fa6c1[_0xa68d('0x47')]['to'],'ListId':_0x2b83ee[_0xa68d('0x5e')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xa68d('0x23')](function(){if(_0x167d60){return respondWithRpcPromise(_0xa68d('0x5f'),_0xa68d('0x60'),_0x167d60,client9003)[_0xa68d('0x23')](function(_0x46ea85){return _0x3cf782[_0xa68d('0x22')]({'read':!![],'messageId':_0x46ea85[_0xa68d('0x61')],'sentAt':moment()[_0xa68d('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xa68d('0x42')](function(_0x5852d9){logger[_0xa68d('0x16')]('%s',JSON[_0xa68d('0x63')](_0x5852d9));return _0x3cf782;});}return _0x3cf782;});}return _0x3cf782;}})[_0xa68d('0x23')](respondWithResult(_0x2efeba,0xc9))['catch'](handleError(_0x2efeba,null));};exports[_0xa68d('0x64')]=function(_0x3b67a9,_0x125d1a){var _0x22a7a9=_0xa68d('0x65');return interactionService[_0xa68d('0x66')](_0x3b67a9,_0x22a7a9)[_0xa68d('0x23')](respondWithResult(_0x125d1a,null))[_0xa68d('0x42')](handleError(_0x125d1a,null));};exports[_0xa68d('0x67')]=function(_0x6c027a,_0x479ff1){var _0x297c56={'agent':{},'channel':_0xa68d('0x65')};if(_0x6c027a[_0xa68d('0x47')]['id']){delete _0x6c027a[_0xa68d('0x47')]['id'];}_0x6c027a[_0xa68d('0x47')][_0xa68d('0x68')]=_0x6c027a[_0xa68d('0x47')][_0xa68d('0x68')]||_0x6c027a[_0xa68d('0x69')]['id'];_0x297c56[_0xa68d('0x6a')]['id']=_0x6c027a[_0xa68d('0x47')][_0xa68d('0x68')];return db['MailMessage'][_0xa68d('0x46')]({'where':{'id':_0x6c027a[_0xa68d('0x44')]['id'],'UserId':null}})[_0xa68d('0x23')](handleEntityNotFound(_0x479ff1,null))[_0xa68d('0x23')](function(_0x35327e){if(_0x35327e){_0x297c56[_0xa68d('0x18')]=_0x35327e['get']({'plain':!![]});return db[_0xa68d('0x6b')][_0xa68d('0x46')]({'where':{'id':_0x35327e[_0xa68d('0x6c')]}});}return null;})[_0xa68d('0x23')](handleEntityNotFound(_0x479ff1,null))[_0xa68d('0x23')](function(_0x41f0cc){if(_0x41f0cc){_0x297c56[_0xa68d('0x6d')]=_0x41f0cc[_0xa68d('0x6e')]({'plain':!![]});interaction_log[_0xa68d('0x13')](_0xa68d('0x6f'),_0x6c027a[_0xa68d('0x69')]['id'],_0x6c027a['user'][_0xa68d('0x28')],_0x6c027a[_0xa68d('0x69')][_0xa68d('0x70')],_0x297c56['interaction']['id'],_0x6c027a['body']?JSON[_0xa68d('0x63')](_0x6c027a[_0xa68d('0x47')]):'null');return respondWithRpcPromise('RejectMessage',_0xa68d('0x71'),_0x297c56);}return null;})[_0xa68d('0x23')](function(_0x29218f){var _0xd208b2=_0xa68d('0x72')+_0x29218f[_0xa68d('0x18')][_0xa68d('0x73')];return db[_0xa68d('0x74')][_0xa68d('0x31')](_0xd208b2,{'type':db[_0xa68d('0x75')][_0xa68d('0x76')]['SELECT'],'raw':!![]})[_0xa68d('0x23')](function(_0x33c2b7){return _0x33c2b7;});})['then'](function(_0x2bba36){if(_0x2bba36){_0x297c56[_0xa68d('0x18')][_0xa68d('0x77')]=_0x2bba36[0x0];if(!_0x6c027a[_0xa68d('0x47')][_0xa68d('0x68')])return;return db[_0xa68d('0x78')][_0xa68d('0x46')]({'where':{'id':_0x6c027a['body'][_0xa68d('0x68')],'role':_0xa68d('0x6a')},'attributes':['id','name',_0xa68d('0x79'),_0xa68d('0x7a'),'internal'],'raw':!![]});}return null;})[_0xa68d('0x23')](function(_0x5fdc56){if(!_0x5fdc56)return null;_0x297c56[_0xa68d('0x18')][_0xa68d('0x6a')]=_0x5fdc56;return _0x297c56;})[_0xa68d('0x23')](function(_0x1ed30c){if(_0x1ed30c){_0x1ed30c[_0xa68d('0x18')][_0xa68d('0x7b')]=util['format']('SIP/%s',_0x6c027a[_0xa68d('0x69')][_0xa68d('0x28')]);_0x1ed30c['message']['channel']=_0x297c56[_0xa68d('0x7c')];_0x1ed30c[_0xa68d('0x18')][_0xa68d('0x7d')]=_0x297c56[_0xa68d('0x7c')];_0x1ed30c[_0xa68d('0x18')]['event']=_0xa68d('0x67');_0x1ed30c[_0xa68d('0x18')][_0xa68d('0x47')]=htmlToText[_0xa68d('0x7e')](_0x297c56[_0xa68d('0x18')][_0xa68d('0x47')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0xa68d('0x7f'),'message':_0x1ed30c[_0xa68d('0x18')]},client9002);return _0x297c56;}return null;})[_0xa68d('0x23')](respondWithResult(_0x479ff1,null))['catch'](handleError(_0x479ff1,null));};exports['download']=function(_0xb3175d,_0x4b80a7){var _0x55de30=moment()[_0xa68d('0x80')]()[_0xa68d('0x81')]();var _0x1f1fc2=path['join'](config['root'],_0xa68d('0x82'),_0xa68d('0x83'),'tmp');var _0x21611e=path[_0xa68d('0x59')](config[_0xa68d('0x5a')],_0xa68d('0x82'),_0xa68d('0x83'),_0xa68d('0x58'));var _0x33fb71=util[_0xa68d('0x62')](_0xa68d('0x84'),_0x55de30);return db[_0xa68d('0x2c')][_0xa68d('0x46')]({'where':{'id':_0xb3175d[_0xa68d('0x44')]['id']},'attributes':['id','body',_0xa68d('0x85'),'to','cc','bcc',_0xa68d('0x86'),_0xa68d('0x87')],'include':_0xb3175d[_0xa68d('0x31')][_0xa68d('0x58')]?[{'model':db[_0xa68d('0x88')],'as':_0xa68d('0x89')}]:undefined})[_0xa68d('0x23')](handleEntityNotFound(_0x4b80a7,null))[_0xa68d('0x23')](function(_0x559df8){if(_0x559df8){var _0x1d4a5c=_0x559df8;var _0x166eab={'from':_0x1d4a5c[_0xa68d('0x85')],'to':_0x1d4a5c['to'],'subject':_0x1d4a5c['subject'],'html':htmlEntities[_0xa68d('0x8a')](_0x1d4a5c[_0xa68d('0x47')]),'headers':{'Date':moment(_0x1d4a5c['createdAt'])[_0xa68d('0x62')](_0xa68d('0x8b'))},'attachments':[]};if(_0x559df8['cc']){_0x166eab[_0xa68d('0x8c')]['Cc']=_0x559df8['cc'];}if(_0x559df8[_0xa68d('0x8d')]){_0x166eab[_0xa68d('0x8c')][_0xa68d('0x8e')]=_0x559df8[_0xa68d('0x8d')];}return new Promise(function(_0x1d09ab,_0x4ac6c3){if(_0x559df8[_0xa68d('0x89')]){for(var _0x30aa15=0x0;_0x30aa15<_0x559df8[_0xa68d('0x89')][_0xa68d('0x36')];_0x30aa15++){var _0x1d19c3=_0x559df8[_0xa68d('0x89')][_0x30aa15];var _0x207afc=path[_0xa68d('0x59')](_0x21611e,_0x1d19c3['basename']);if(fs[_0xa68d('0x8f')](_0x207afc)){_0x166eab['attachments'][_0xa68d('0x90')]({'name':_0x1d19c3['name'],'contentType':_0x1d19c3[_0xa68d('0x2e')],'data':fs['readFileSync'](_0x207afc)});}}}emlformat['build'](_0x166eab,function(_0x136083,_0x2c7235){if(_0x136083)return _0x4ac6c3(_0x136083);fs[_0xa68d('0x91')](path[_0xa68d('0x59')](_0x1f1fc2,_0x33fb71),_0x2c7235);return _0x1d09ab(_0x2c7235);});});}})[_0xa68d('0x23')](function(_0x365056){if(_0x365056){return _0x4b80a7[_0xa68d('0x92')](path[_0xa68d('0x59')](_0x1f1fc2,_0x33fb71),_0x33fb71,function(_0xdf35df){if(!_0xdf35df)fs[_0xa68d('0x93')](path[_0xa68d('0x59')](_0x1f1fc2,_0x33fb71));});}})[_0xa68d('0x42')](handleError(_0x4b80a7,null));}; \ No newline at end of file +var _0xa78f=['Contacts','updatedAt','DESC','MailServerOut','Smtp','attachments','join','root','server/files/attachments','basename','defaults','ListId','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','acceptMessage','reject','UserId','user','agent','get','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','fullname','email','internal','interface','channel','event','fromString','EventManager','rejectmessage','download','unix','toString','server','files','tmp','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','existsSync','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','util','path','ioredis','../../components/interaction/service','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter','html-entities','./mailMessage.socket','register','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','json','offset','undefined','limit','set','update','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','MailMessage','count','include','show','params','includeAll','options','body','find','destroy','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','CmContact'];(function(_0x3f323a,_0x1a6f41){var _0x144ed7=function(_0x1d5872){while(--_0x1d5872){_0x3f323a['push'](_0x3f323a['shift']());}};_0x144ed7(++_0x1a6f41);}(_0xa78f,0xcd));var _0xfa78=function(_0x1b8f87,_0x149cb4){_0x1b8f87=_0x1b8f87-0x0;var _0x35642a=_0xa78f[_0x1b8f87];return _0x35642a;};'use strict';var emlformat=require(_0xfa78('0x0'));var moment=require(_0xfa78('0x1'));var util=require(_0xfa78('0x2'));var path=require(_0xfa78('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xfa78('0x4'));var htmlToText=require('html-to-text');var interactionService=require(_0xfa78('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xfa78('0x6'))('api');var interaction_log=require(_0xfa78('0x6'))(_0xfa78('0x7'));var config=require(_0xfa78('0x8'));var db=require(_0xfa78('0x9'))['db'];config[_0xfa78('0xa')]=_['defaults'](config[_0xfa78('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa78('0xb'))(new Redis(config['redis']));var htmlEntities=require(_0xfa78('0xc'));require(_0xfa78('0xd'))[_0xfa78('0xe')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9003=jayson['client'][_0xfa78('0xf')]({'port':0x232b});var client9002=jayson[_0xfa78('0x10')][_0xfa78('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x45efc7,_0x2d08af,_0x5956f1,_0x16eacd){return new Promise(function(_0x3855b5,_0x53735c){var _0x187761=_0x16eacd||client;return _0x187761[_0xfa78('0x11')](_0x45efc7,_0x5956f1)[_0xfa78('0x12')](function(_0xc99d5){logger[_0xfa78('0x13')](_0xfa78('0x14'),_0x2d08af,_0xfa78('0x15'));logger[_0xfa78('0x16')](_0xfa78('0x17'),_0x2d08af,_0xfa78('0x15'),JSON['stringify'](_0xc99d5));if(_0xc99d5[_0xfa78('0x18')]){if(_0xc99d5[_0xfa78('0x18')][_0xfa78('0x19')]===0x1f4){logger[_0xfa78('0x18')](_0xfa78('0x14'),_0x2d08af,_0xc99d5[_0xfa78('0x18')][_0xfa78('0x1a')]);return _0x53735c(_0xc99d5[_0xfa78('0x18')][_0xfa78('0x1a')]);}logger[_0xfa78('0x18')](_0xfa78('0x14'),_0x2d08af,_0xc99d5[_0xfa78('0x18')]['message']);return _0x3855b5(_0xc99d5[_0xfa78('0x18')][_0xfa78('0x1a')]);}else{logger[_0xfa78('0x13')](_0xfa78('0x14'),_0x2d08af,_0xfa78('0x15'));_0x3855b5(_0xc99d5['result'][_0xfa78('0x1a')]);}})[_0xfa78('0x1b')](function(_0x5ee11c){logger['error'](_0xfa78('0x14'),_0x2d08af,_0x5ee11c);_0x53735c(_0x5ee11c);});});}function respondWithResult(_0x2c6a57,_0x48ccb7){_0x48ccb7=_0x48ccb7||0xc8;return function(_0x10bd90){if(_0x10bd90){return _0x2c6a57[_0xfa78('0x1c')](_0x48ccb7)[_0xfa78('0x1d')](_0x10bd90);}};}function respondWithFilteredResult(_0x37a8a7,_0x1ba356){return function(_0xf47c2e){if(_0xf47c2e){var _0x36b2ae=typeof _0x1ba356[_0xfa78('0x1e')]===_0xfa78('0x1f')&&typeof _0x1ba356[_0xfa78('0x20')]==='undefined';var _0x3fc831=_0xf47c2e['count'];var _0xa89ec1=_0x36b2ae?0x0:_0x1ba356[_0xfa78('0x1e')];var _0x3e664d=_0x36b2ae?_0xf47c2e['count']:_0x1ba356[_0xfa78('0x1e')]+_0x1ba356[_0xfa78('0x20')];var _0x50c795;if(_0x3e664d>=_0x3fc831){_0x3e664d=_0x3fc831;_0x50c795=0xc8;}else{_0x50c795=0xce;}_0x37a8a7['status'](_0x50c795);return _0x37a8a7[_0xfa78('0x21')]('Content-Range',_0xa89ec1+'-'+_0x3e664d+'/'+_0x3fc831)[_0xfa78('0x1d')](_0xf47c2e);}return null;};}function saveUpdates(_0x3f4b10){return function(_0x230a94){if(_0x230a94){return _0x230a94[_0xfa78('0x22')](_0x3f4b10)[_0xfa78('0x12')](function(_0x3ebae0){return _0x3ebae0;});}return null;};}function removeEntity(_0x24c75c){return function(_0x27968b){if(_0x27968b){return _0x27968b['destroy']()['then'](function(){_0x24c75c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aa4d0){return function(_0x4d54b5){if(!_0x4d54b5){_0x4aa4d0['sendStatus'](0x194);}return _0x4d54b5;};}function handleError(_0x244858,_0x20576c){_0x20576c=_0x20576c||0x1f4;return function(_0x1c9d01){logger['error'](_0x1c9d01[_0xfa78('0x23')]);if(_0x1c9d01[_0xfa78('0x24')]){delete _0x1c9d01[_0xfa78('0x24')];}_0x244858[_0xfa78('0x1c')](_0x20576c)[_0xfa78('0x25')](_0x1c9d01);};}exports[_0xfa78('0x26')]=function(_0x1409b2,_0x40634a){var _0x3cea19={},_0x54abc0={},_0x51e4de={'count':0x0,'rows':[]};var _0x456967=_[_0xfa78('0x27')](db['MailMessage'][_0xfa78('0x28')],function(_0x43ee51){return{'name':_0x43ee51[_0xfa78('0x29')],'type':_0x43ee51['type'][_0xfa78('0x2a')]};});_0x54abc0[_0xfa78('0x2b')]=_[_0xfa78('0x27')](_0x456967,'name');_0x54abc0[_0xfa78('0x2c')]=_[_0xfa78('0x2d')](_0x1409b2['query']);_0x54abc0[_0xfa78('0x2e')]=_[_0xfa78('0x2f')](_0x54abc0[_0xfa78('0x2b')],_0x54abc0['query']);_0x3cea19[_0xfa78('0x30')]=_[_0xfa78('0x2f')](_0x54abc0['model'],qs[_0xfa78('0x31')](_0x1409b2[_0xfa78('0x2c')][_0xfa78('0x31')]));_0x3cea19[_0xfa78('0x30')]=_0x3cea19['attributes'][_0xfa78('0x32')]?_0x3cea19[_0xfa78('0x30')]:_0x54abc0['model'];if(!_0x1409b2[_0xfa78('0x2c')][_0xfa78('0x33')]('nolimit')){_0x3cea19[_0xfa78('0x20')]=qs[_0xfa78('0x20')](_0x1409b2[_0xfa78('0x2c')][_0xfa78('0x20')]);_0x3cea19[_0xfa78('0x1e')]=qs['offset'](_0x1409b2[_0xfa78('0x2c')][_0xfa78('0x1e')]);}_0x3cea19[_0xfa78('0x34')]=qs['sort'](_0x1409b2['query'][_0xfa78('0x35')]);_0x3cea19[_0xfa78('0x36')]=qs['filters'](_['pick'](_0x1409b2[_0xfa78('0x2c')],_0x54abc0[_0xfa78('0x2e')]),_0x456967);if(_0x1409b2[_0xfa78('0x2c')][_0xfa78('0x37')]){_0x3cea19['where']=_[_0xfa78('0x38')](_0x3cea19['where'],{'$or':_[_0xfa78('0x27')](_0x456967,function(_0x8853d4){if(_0x8853d4[_0xfa78('0x39')]!=='VIRTUAL'){var _0x37118e={};_0x37118e[_0x8853d4[_0xfa78('0x24')]]={'$like':'%'+_0x1409b2[_0xfa78('0x2c')][_0xfa78('0x37')]+'%'};return _0x37118e;}})});}_0x3cea19=_[_0xfa78('0x38')]({},_0x3cea19,_0x1409b2['options']);var _0xc22055={'where':_0x3cea19[_0xfa78('0x36')]};return db[_0xfa78('0x3a')][_0xfa78('0x3b')](_0xc22055)[_0xfa78('0x12')](function(_0x3aabfb){_0x51e4de['count']=_0x3aabfb;if(_0x1409b2[_0xfa78('0x2c')]['includeAll']){_0x3cea19[_0xfa78('0x3c')]=[{'all':!![]}];}return db[_0xfa78('0x3a')]['findAll'](_0x3cea19);})[_0xfa78('0x12')](function(_0x1b8cda){_0x51e4de['rows']=_0x1b8cda;return _0x51e4de;})[_0xfa78('0x12')](respondWithFilteredResult(_0x40634a,_0x3cea19))[_0xfa78('0x1b')](handleError(_0x40634a,null));};exports[_0xfa78('0x3d')]=function(_0x13f144,_0x13df95){var _0x450f82={'raw':!![],'where':{'id':_0x13f144[_0xfa78('0x3e')]['id']}},_0x437e8e={};_0x437e8e['model']=_[_0xfa78('0x2d')](db[_0xfa78('0x3a')][_0xfa78('0x28')]);_0x437e8e[_0xfa78('0x2c')]=_[_0xfa78('0x2d')](_0x13f144[_0xfa78('0x2c')]);_0x437e8e['filters']=_[_0xfa78('0x2f')](_0x437e8e[_0xfa78('0x2b')],_0x437e8e[_0xfa78('0x2c')]);_0x450f82[_0xfa78('0x30')]=_[_0xfa78('0x2f')](_0x437e8e[_0xfa78('0x2b')],qs['fields'](_0x13f144[_0xfa78('0x2c')][_0xfa78('0x31')]));_0x450f82['attributes']=_0x450f82[_0xfa78('0x30')][_0xfa78('0x32')]?_0x450f82[_0xfa78('0x30')]:_0x437e8e[_0xfa78('0x2b')];if(_0x13f144[_0xfa78('0x2c')][_0xfa78('0x3f')]){_0x450f82[_0xfa78('0x3c')]=[{'all':!![]}];}_0x450f82=_[_0xfa78('0x38')]({},_0x450f82,_0x13f144[_0xfa78('0x40')]);return db['MailMessage']['find'](_0x450f82)[_0xfa78('0x12')](handleEntityNotFound(_0x13df95,null))[_0xfa78('0x12')](respondWithResult(_0x13df95,null))[_0xfa78('0x1b')](handleError(_0x13df95,null));};exports[_0xfa78('0x22')]=function(_0x3c70cd,_0x2828ed){if(_0x3c70cd[_0xfa78('0x41')]['id']){delete _0x3c70cd[_0xfa78('0x41')]['id'];}return db['MailMessage'][_0xfa78('0x42')]({'where':{'id':_0x3c70cd[_0xfa78('0x3e')]['id']}})[_0xfa78('0x12')](handleEntityNotFound(_0x2828ed,null))['then'](saveUpdates(_0x3c70cd['body'],null))[_0xfa78('0x12')](respondWithResult(_0x2828ed,null))[_0xfa78('0x1b')](handleError(_0x2828ed,null));};exports[_0xfa78('0x43')]=function(_0x3ab901,_0x4f5cd1){return db[_0xfa78('0x3a')][_0xfa78('0x42')]({'where':{'id':_0x3ab901['params']['id']}})[_0xfa78('0x12')](handleEntityNotFound(_0x4f5cd1,null))['then'](removeEntity(_0x4f5cd1,null))['catch'](handleError(_0x4f5cd1,null));};exports['describe']=function(_0x29c1ed,_0xe715cc){return db['MailMessage'][_0xfa78('0x44')]()[_0xfa78('0x12')](respondWithResult(_0xe715cc,null))[_0xfa78('0x1b')](handleError(_0xe715cc,null));};exports[_0xfa78('0x45')]=function(_0x1901fe,_0x3816a1){return db['MailMessage'][_0xfa78('0x45')](_0x1901fe[_0xfa78('0x41')])[_0xfa78('0x12')](function(_0xd6292){if(_0xd6292){if(_0xd6292[_0xfa78('0x46')]===_0xfa78('0x47')&&!_0xd6292[_0xfa78('0x48')]){var _0x3b98e7,_0x5181d3,_0x48b698;if(_0x1901fe[_0xfa78('0x41')]['to']){_0x5181d3=_0x1901fe[_0xfa78('0x41')]['to'][_0xfa78('0x49')](',')[0x0];}return db[_0xfa78('0x4a')]['findOne']({'where':{'id':_0xd6292[_0xfa78('0x4b')]},'include':[{'model':db[_0xfa78('0x4c')],'as':_0xfa78('0x4d'),'include':[{'model':db[_0xfa78('0x4e')],'as':_0xfa78('0x4f'),'where':{'email':_0x5181d3},'limit':0x1,'order':[[_0xfa78('0x50'),_0xfa78('0x51')]]}]},{'model':db[_0xfa78('0x52')],'as':_0xfa78('0x53'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x56e20f){_0x3b98e7=_0x56e20f;if(!_0x3b98e7||!_0x3b98e7[_0xfa78('0x53')])return;var _0x12449b=_0x3b98e7['getSmtpOptions']();if(_0x1901fe[_0xfa78('0x41')][_0xfa78('0x54')]&&_0x1901fe[_0xfa78('0x41')][_0xfa78('0x54')][_0xfa78('0x32')]){for(var _0x3536f2=0x0;_0x3536f2<_0x1901fe[_0xfa78('0x41')]['attachments'][_0xfa78('0x32')];_0x3536f2+=0x1){_0x1901fe[_0xfa78('0x41')][_0xfa78('0x54')][_0x3536f2]={'filename':_0x1901fe['body'][_0xfa78('0x54')][_0x3536f2][_0xfa78('0x24')],'path':path[_0xfa78('0x55')](config[_0xfa78('0x56')],_0xfa78('0x57'),_0x1901fe[_0xfa78('0x41')][_0xfa78('0x54')][_0x3536f2][_0xfa78('0x58')])};}}_0x48b698={'account':_0x12449b,'message':_0x1901fe[_0xfa78('0x41')]};return;})[_0xfa78('0x12')](function(){if(_0x3b98e7['List']){if(_0x3b98e7[_0xfa78('0x4d')][_0xfa78('0x4f')][_0xfa78('0x32')]){return _0x3b98e7[_0xfa78('0x4d')]['Contacts'][0x0];}else{return db[_0xfa78('0x4e')][_0xfa78('0x45')](_[_0xfa78('0x59')](_0x1901fe[_0xfa78('0x41')],{'firstName':_0x1901fe[_0xfa78('0x41')]['to'],'email':_0x1901fe[_0xfa78('0x41')]['to'],'phone':_0x1901fe[_0xfa78('0x41')]['to'],'ListId':_0x3b98e7[_0xfa78('0x5a')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xfa78('0x12')](function(){if(_0x48b698){return respondWithRpcPromise(_0xfa78('0x5b'),_0xfa78('0x5c'),_0x48b698,client9003)['then'](function(_0x4f2b90){return _0xd6292[_0xfa78('0x22')]({'read':!![],'messageId':_0x4f2b90['messageId'],'sentAt':moment()[_0xfa78('0x5d')](_0xfa78('0x5e'))});})['catch'](function(_0x18cdb){logger[_0xfa78('0x18')]('%s',JSON['stringify'](_0x18cdb));return _0xd6292;});}return _0xd6292;});}return _0xd6292;}})[_0xfa78('0x12')](respondWithResult(_0x3816a1,0xc9))[_0xfa78('0x1b')](handleError(_0x3816a1,null));};exports[_0xfa78('0x5f')]=function(_0x5f00a6,_0x3bdbfd){var _0x39ca27=_0xfa78('0x60');return interactionService[_0xfa78('0x61')](_0x5f00a6,_0x39ca27)[_0xfa78('0x12')](respondWithResult(_0x3bdbfd,null))[_0xfa78('0x1b')](handleError(_0x3bdbfd,null));};exports[_0xfa78('0x62')]=function(_0x31f03f,_0x25c4b7){var _0xf486ca={'agent':{},'channel':_0xfa78('0x60')};if(_0x31f03f[_0xfa78('0x41')]['id']){delete _0x31f03f['body']['id'];}_0x31f03f[_0xfa78('0x41')]['UserId']=_0x31f03f[_0xfa78('0x41')][_0xfa78('0x63')]||_0x31f03f[_0xfa78('0x64')]['id'];_0xf486ca[_0xfa78('0x65')]['id']=_0x31f03f[_0xfa78('0x41')]['UserId'];return db[_0xfa78('0x3a')][_0xfa78('0x42')]({'where':{'id':_0x31f03f[_0xfa78('0x3e')]['id'],'UserId':null}})[_0xfa78('0x12')](handleEntityNotFound(_0x25c4b7,null))[_0xfa78('0x12')](function(_0x416d56){if(_0x416d56){_0xf486ca['message']=_0x416d56[_0xfa78('0x66')]({'plain':!![]});return db['MailInteraction'][_0xfa78('0x42')]({'where':{'id':_0x416d56[_0xfa78('0x67')]}});}return null;})[_0xfa78('0x12')](handleEntityNotFound(_0x25c4b7,null))[_0xfa78('0x12')](function(_0x2ac86c){if(_0x2ac86c){_0xf486ca['interaction']=_0x2ac86c[_0xfa78('0x66')]({'plain':!![]});interaction_log[_0xfa78('0x13')](_0xfa78('0x68'),_0x31f03f[_0xfa78('0x64')]['id'],_0x31f03f['user'][_0xfa78('0x24')],_0x31f03f[_0xfa78('0x64')][_0xfa78('0x69')],_0xf486ca[_0xfa78('0x6a')]['id'],_0x31f03f[_0xfa78('0x41')]?JSON[_0xfa78('0x6b')](_0x31f03f[_0xfa78('0x41')]):'null');return respondWithRpcPromise('RejectMessage',_0xfa78('0x6c'),_0xf486ca);}return null;})['then'](function(_0x1ed7d7){var _0x2f1074=_0xfa78('0x6d')+_0x1ed7d7[_0xfa78('0x1a')][_0xfa78('0x6e')];return db[_0xfa78('0x6f')]['query'](_0x2f1074,{'type':db[_0xfa78('0x70')]['QueryTypes'][_0xfa78('0x71')],'raw':!![]})[_0xfa78('0x12')](function(_0x207030){return _0x207030;});})[_0xfa78('0x12')](function(_0x54bdee){if(_0x54bdee){_0xf486ca['message']['contact']=_0x54bdee[0x0];if(!_0x31f03f[_0xfa78('0x41')][_0xfa78('0x63')])return;return db['User'][_0xfa78('0x42')]({'where':{'id':_0x31f03f[_0xfa78('0x41')][_0xfa78('0x63')],'role':_0xfa78('0x65')},'attributes':['id','name',_0xfa78('0x72'),_0xfa78('0x73'),_0xfa78('0x74')],'raw':!![]});}return null;})[_0xfa78('0x12')](function(_0x26cc7a){if(!_0x26cc7a)return null;_0xf486ca[_0xfa78('0x1a')][_0xfa78('0x65')]=_0x26cc7a;return _0xf486ca;})[_0xfa78('0x12')](function(_0x57589f){if(_0x57589f){_0x57589f[_0xfa78('0x1a')][_0xfa78('0x75')]=util[_0xfa78('0x5d')]('SIP/%s',_0x31f03f[_0xfa78('0x64')][_0xfa78('0x24')]);_0x57589f['message']['channel']=_0xf486ca[_0xfa78('0x76')];_0x57589f[_0xfa78('0x1a')]['motionChannel']=_0xf486ca[_0xfa78('0x76')];_0x57589f[_0xfa78('0x1a')][_0xfa78('0x77')]=_0xfa78('0x62');_0x57589f[_0xfa78('0x1a')][_0xfa78('0x41')]=htmlToText[_0xfa78('0x78')](_0xf486ca[_0xfa78('0x1a')][_0xfa78('0x41')]);respondWithRpcPromise(_0xfa78('0x79'),'EventManager',{'event':_0xfa78('0x7a'),'message':_0x57589f[_0xfa78('0x1a')]},client9002);return _0xf486ca;}return null;})[_0xfa78('0x12')](respondWithResult(_0x25c4b7,null))[_0xfa78('0x1b')](handleError(_0x25c4b7,null));};exports[_0xfa78('0x7b')]=function(_0x3ff3d9,_0x4bdf7a){var _0x42a2c7=moment()[_0xfa78('0x7c')]()[_0xfa78('0x7d')]();var _0x5b02ae=path[_0xfa78('0x55')](config[_0xfa78('0x56')],_0xfa78('0x7e'),_0xfa78('0x7f'),_0xfa78('0x80'));var _0x3264fb=path[_0xfa78('0x55')](config[_0xfa78('0x56')],_0xfa78('0x7e'),_0xfa78('0x7f'),_0xfa78('0x54'));var _0x1c120a=util[_0xfa78('0x5d')]('message-%s.eml',_0x42a2c7);return db['MailMessage']['find']({'where':{'id':_0x3ff3d9['params']['id']},'attributes':['id',_0xfa78('0x41'),_0xfa78('0x81'),'to','cc',_0xfa78('0x82'),_0xfa78('0x83'),_0xfa78('0x84')],'include':_0x3ff3d9[_0xfa78('0x2c')]['attachments']?[{'model':db[_0xfa78('0x85')],'as':_0xfa78('0x86')}]:undefined})[_0xfa78('0x12')](handleEntityNotFound(_0x4bdf7a,null))['then'](function(_0x1bc068){if(_0x1bc068){var _0x2776db=_0x1bc068;var _0x2084ae={'from':_0x2776db[_0xfa78('0x81')],'to':_0x2776db['to'],'subject':_0x2776db['subject'],'html':htmlEntities[_0xfa78('0x87')](_0x2776db['body']),'headers':{'Date':moment(_0x2776db[_0xfa78('0x84')])[_0xfa78('0x5d')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1bc068['cc']){_0x2084ae[_0xfa78('0x88')]['Cc']=_0x1bc068['cc'];}if(_0x1bc068[_0xfa78('0x82')]){_0x2084ae[_0xfa78('0x88')]['Bcc']=_0x1bc068['bcc'];}return new Promise(function(_0x49f38c,_0x3138d2){if(_0x1bc068['Attachments']){for(var _0x454e09=0x0;_0x454e09<_0x1bc068[_0xfa78('0x86')][_0xfa78('0x32')];_0x454e09++){var _0x453d7c=_0x1bc068[_0xfa78('0x86')][_0x454e09];var _0x4d2d82=path[_0xfa78('0x55')](_0x3264fb,_0x453d7c[_0xfa78('0x58')]);if(fs[_0xfa78('0x89')](_0x4d2d82)){_0x2084ae[_0xfa78('0x54')][_0xfa78('0x8a')]({'name':_0x453d7c['name'],'contentType':_0x453d7c['type'],'data':fs[_0xfa78('0x8b')](_0x4d2d82)});}}}emlformat['build'](_0x2084ae,function(_0x3c64f4,_0x1788b3){if(_0x3c64f4)return _0x3138d2(_0x3c64f4);fs[_0xfa78('0x8c')](path['join'](_0x5b02ae,_0x1c120a),_0x1788b3);return _0x49f38c(_0x1788b3);});});}})[_0xfa78('0x12')](function(_0x442f4d){if(_0x442f4d){return _0x4bdf7a['download'](path[_0xfa78('0x55')](_0x5b02ae,_0x1c120a),_0x1c120a,function(_0x47d51b){if(!_0x47d51b)fs[_0xfa78('0x8d')](path[_0xfa78('0x55')](_0x5b02ae,_0x1c120a));});}})['catch'](handleError(_0x4bdf7a,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 08a41d5..7ba9c4b 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 _0x8308=['exports','events','MailMessage','setMaxListeners','update','emit','hook'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x8308,0x151));var _0x8830=function(_0xd04611,_0x6f7365){_0xd04611=_0xd04611-0x0;var _0x72e2db=_0x8308[_0xd04611];return _0x72e2db;};'use strict';var EventEmitter=require(_0x8830('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x8830('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8830('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8830('0x3'),'afterDestroy':'remove'};function emitEvent(_0x51f9f1){return function(_0x520ee1,_0x43267c,_0x2e88aa){MailMessageEvents[_0x8830('0x4')](_0x51f9f1+':'+_0x520ee1['id'],_0x520ee1);MailMessageEvents[_0x8830('0x4')](_0x51f9f1,_0x520ee1);_0x2e88aa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x8830('0x5')](e,emitEvent(event));}}module[_0x8830('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x11af=['remove','emit','hook','events','../../mysqldb','MailMessage','save','update'];(function(_0x5b2ee4,_0x18131a){var _0xbc34f2=function(_0x36e443){while(--_0x36e443){_0x5b2ee4['push'](_0x5b2ee4['shift']());}};_0xbc34f2(++_0x18131a);}(_0x11af,0x173));var _0xf11a=function(_0x35be5b,_0x43dd6d){_0x35be5b=_0x35be5b-0x0;var _0x95761a=_0x11af[_0x35be5b];return _0x95761a;};'use strict';var EventEmitter=require(_0xf11a('0x0'));var MailMessage=require(_0xf11a('0x1'))['db'][_0xf11a('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf11a('0x3'),'afterUpdate':_0xf11a('0x4'),'afterDestroy':_0xf11a('0x5')};function emitEvent(_0x27bfc6){return function(_0x5b86c7,_0x55631b,_0x18a982){MailMessageEvents['emit'](_0x27bfc6+':'+_0x5b86c7['id'],_0x5b86c7);MailMessageEvents[_0xf11a('0x6')](_0x27bfc6,_0x5b86c7);_0x18a982(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xf11a('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index faf2c98..44d824e 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 _0x5041=['direction','toLowerCase','out','secret','UserId','MailInteraction','MailInteractionId','then','update','catch','error','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./mailMessage.attributes','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5041,0x12d));var _0x1504=function(_0x2726fe,_0x270860){_0x2726fe=_0x2726fe-0x0;var _0x37108e=_0x5041[_0x2726fe];return _0x37108e;};'use strict';var _=require('lodash');var util=require(_0x1504('0x0'));var logger=require(_0x1504('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1504('0x2'));var rp=require(_0x1504('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x1504('0x4'));var rimraf=require('rimraf');var config=require(_0x1504('0x5'));var attributes=require(_0x1504('0x6'));module['exports']=function(_0x482be5,_0x3ae6e2){return _0x482be5[_0x1504('0x7')](_0x1504('0x8'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x1504('0x9')]},{'name':_0x1504('0xa'),'fields':[_0x1504('0xb'),_0x1504('0xc')],'type':_0x1504('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4b1839,_0x59bdbc,_0x47b399){if(_0x4b1839[_0x1504('0xe')]){_0x4b1839[_0x1504('0xb')]=htmlToText[_0x1504('0xf')](_0x4b1839[_0x1504('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x47b399(null,_0x59bdbc);},'afterCreate':function(_0x3c91c5,_0x1b315f,_0x301f02){var _0x517ebc=_0x482be5[_0x1504('0x10')];var _0x58ec0b=_0x3c91c5[_0x1504('0x11')]({'plain':!![]});if(_0x58ec0b[_0x1504('0x12')][_0x1504('0x13')]()==='in'||_0x58ec0b[_0x1504('0x12')]['toLowerCase']()===_0x1504('0x14')&&!_0x58ec0b[_0x1504('0x15')]&&!_['isNil'](_0x58ec0b[_0x1504('0x16')])){_0x517ebc[_0x1504('0x17')]['findOne']({'where':{'id':_0x58ec0b[_0x1504('0x18')]}})[_0x1504('0x19')](function(_0x4082e0){if(_0x4082e0){_0x4082e0[_0x1504('0x1a')]({'lastMsgAt':_0x58ec0b['createdAt'],'lastMsgDirection':_0x58ec0b['direction'][_0x1504('0x13')]()});}})[_0x1504('0x1b')](function(_0x455e61){console[_0x1504('0x1c')](_0x455e61);});}_0x301f02();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x350d=['out','secret','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','define','MailMessage','mail_messages','messageId','fti_mail_messages','FULLTEXT','body','plainBody','fromString','get','direction','toLowerCase'];(function(_0x1483be,_0x327606){var _0x26e12b=function(_0x445b06){while(--_0x445b06){_0x1483be['push'](_0x1483be['shift']());}};_0x26e12b(++_0x327606);}(_0x350d,0x198));var _0xd350=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x350d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd350('0x0'));var logger=require(_0xd350('0x1'))(_0xd350('0x2'));var moment=require('moment');var BPromise=require(_0xd350('0x3'));var rp=require(_0xd350('0x4'));var htmlToText=require(_0xd350('0x5'));var fs=require('fs');var path=require(_0xd350('0x6'));var rimraf=require(_0xd350('0x7'));var config=require(_0xd350('0x8'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x2c27e7,_0x12a70d){return _0x2c27e7[_0xd350('0x9')](_0xd350('0xa'),attributes,{'tableName':_0xd350('0xb'),'paranoid':![],'indexes':[{'name':_0xd350('0xc'),'fields':[_0xd350('0xc')]},{'name':_0xd350('0xd'),'fields':['plainBody','subject'],'type':_0xd350('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x164128,_0xe82816,_0x1ef7a8){if(_0x164128[_0xd350('0xf')]){_0x164128[_0xd350('0x10')]=htmlToText[_0xd350('0x11')](_0x164128[_0xd350('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1ef7a8(null,_0xe82816);},'afterCreate':function(_0x16fea6,_0x898e19,_0x4cf753){var _0x3a7ba5=_0x2c27e7['models'];var _0x43d030=_0x16fea6[_0xd350('0x12')]({'plain':!![]});if(_0x43d030[_0xd350('0x13')][_0xd350('0x14')]()==='in'||_0x43d030[_0xd350('0x13')][_0xd350('0x14')]()===_0xd350('0x15')&&!_0x43d030[_0xd350('0x16')]&&!_['isNil'](_0x43d030[_0xd350('0x17')])){_0x3a7ba5[_0xd350('0x18')][_0xd350('0x19')]({'where':{'id':_0x43d030[_0xd350('0x1a')]}})[_0xd350('0x1b')](function(_0x3faa2f){if(_0x3faa2f){_0x3faa2f['update']({'lastMsgAt':_0x43d030[_0xd350('0x1c')],'lastMsgDirection':_0x43d030['direction'][_0xd350('0x14')]()});}})[_0xd350('0x1d')](function(_0xa5478){console[_0xd350('0x1e')](_0xa5478);});}_0x4cf753();}},'charset':_0xd350('0x1f'),'collate':_0xd350('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index f136411..60daafb 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 _0xbbbc=['CreateMailMessage','MailMessage','create','body','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','request','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x24c38a,_0x3ee208){_0x24c38a=_0x24c38a-0x0;var _0xd55eb7=_0xbbbc[_0x24c38a];return _0xd55eb7;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});config[_0xcbbb('0xc')]=_[_0xcbbb('0xd')](config[_0xcbbb('0xc')],{'host':_0xcbbb('0xe'),'port':0x18eb});var socket=require(_0xcbbb('0xf'))(new Redis(config[_0xcbbb('0xc')]));require(_0xcbbb('0x10'))['register'](socket);function respondWithRpcPromise(_0x225156,_0x4b0138,_0x5893f9){return new BPromise(function(_0x107c35,_0x56c7d0){return client[_0xcbbb('0x11')](_0x225156,_0x5893f9)['then'](function(_0x3766c2){logger[_0xcbbb('0x12')]('MailMessage,\x20%s,\x20%s',_0x4b0138,_0xcbbb('0x13'));logger['debug'](_0xcbbb('0x14'),_0x4b0138,'request\x20sent',JSON[_0xcbbb('0x15')](_0x3766c2));if(_0x3766c2[_0xcbbb('0x16')]){if(_0x3766c2[_0xcbbb('0x16')]['code']===0x1f4){logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x3766c2[_0xcbbb('0x16')][_0xcbbb('0x18')]);return _0x56c7d0(_0x3766c2['error']['message']);}logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x3766c2[_0xcbbb('0x16')][_0xcbbb('0x18')]);return _0x107c35(_0x3766c2['error'][_0xcbbb('0x18')]);}else{logger['info'](_0xcbbb('0x17'),_0x4b0138,_0xcbbb('0x13'));_0x107c35(_0x3766c2[_0xcbbb('0x19')]['message']);}})['catch'](function(_0x4bcd9a){logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x4bcd9a);_0x56c7d0(_0x4bcd9a);});});}exports[_0xcbbb('0x1a')]=function(_0x25e92f){var _0x658337=this;return new Promise(function(_0x1cca90,_0x45de5f){return db[_0xcbbb('0x1b')][_0xcbbb('0x1c')](_0x25e92f[_0xcbbb('0x1d')],{'raw':_0x25e92f['options']?_0x25e92f[_0xcbbb('0x1e')][_0xcbbb('0x1f')]===undefined?!![]:![]:!![]})[_0xcbbb('0x20')](function(_0x42aaf1){logger[_0xcbbb('0x12')](_0xcbbb('0x1a'),_0x25e92f);logger[_0xcbbb('0x21')](_0xcbbb('0x1a'),_0x25e92f,JSON[_0xcbbb('0x15')](_0x42aaf1));_0x1cca90(_0x42aaf1);})['catch'](function(_0xf39ddd){logger[_0xcbbb('0x16')]('CreateMailMessage',_0xf39ddd[_0xcbbb('0x18')],_0x25e92f);_0x45de5f(_0x658337['error'](0x1f4,_0xf39ddd['message']));});});}; \ No newline at end of file +var _0x1399=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateMailMessage','MailMessage','create','body','options','raw','debug','stringify'];(function(_0x50e001,_0x45aa55){var _0x3fe4a2=function(_0x42dd11){while(--_0x42dd11){_0x50e001['push'](_0x50e001['shift']());}};_0x3fe4a2(++_0x45aa55);}(_0x1399,0x16c));var _0x9139=function(_0x7de746,_0x1ce1fc){_0x7de746=_0x7de746-0x0;var _0x538066=_0x1399[_0x7de746];return _0x538066;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var moment=require('moment');var BPromise=require(_0x9139('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9139('0x3'));var db=require(_0x9139('0x4'))['db'];var utils=require(_0x9139('0x5'));var logger=require(_0x9139('0x6'))(_0x9139('0x7'));var config=require(_0x9139('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9139('0x9')]({'port':0x232a});config[_0x9139('0xa')]=_[_0x9139('0xb')](config['redis'],{'host':_0x9139('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9139('0xd'))[_0x9139('0xe')](socket);function respondWithRpcPromise(_0x4830cd,_0x315de8,_0x1bfa6b){return new BPromise(function(_0x5c90eb,_0x4f7f3a){return client[_0x9139('0xf')](_0x4830cd,_0x1bfa6b)[_0x9139('0x10')](function(_0x23357c){logger[_0x9139('0x11')](_0x9139('0x12'),_0x315de8,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'),JSON['stringify'](_0x23357c));if(_0x23357c[_0x9139('0x14')]){if(_0x23357c[_0x9139('0x14')][_0x9139('0x15')]===0x1f4){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x23357c[_0x9139('0x14')]['message']);return _0x4f7f3a(_0x23357c['error']['message']);}logger[_0x9139('0x14')](_0x9139('0x12'),_0x315de8,_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);return _0x5c90eb(_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'));_0x5c90eb(_0x23357c[_0x9139('0x17')]['message']);}})['catch'](function(_0x30a363){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x30a363);_0x4f7f3a(_0x30a363);});});}exports[_0x9139('0x18')]=function(_0x1ef57b){var _0x1a592e=this;return new Promise(function(_0x3c8296,_0xd2eb33){return db[_0x9139('0x19')][_0x9139('0x1a')](_0x1ef57b[_0x9139('0x1b')],{'raw':_0x1ef57b[_0x9139('0x1c')]?_0x1ef57b[_0x9139('0x1c')][_0x9139('0x1d')]===undefined?!![]:![]:!![]})[_0x9139('0x10')](function(_0x5a3e2e){logger[_0x9139('0x11')](_0x9139('0x18'),_0x1ef57b);logger[_0x9139('0x1e')](_0x9139('0x18'),_0x1ef57b,JSON[_0x9139('0x1f')](_0x5a3e2e));_0x3c8296(_0x5a3e2e);})[_0x9139('0x20')](function(_0x4b7fe0){logger[_0x9139('0x14')](_0x9139('0x18'),_0x4b7fe0['message'],_0x1ef57b);_0xd2eb33(_0x1a592e[_0x9139('0x14')](0x1f4,_0x4b7fe0[_0x9139('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 77c5a6d..c5f051d 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 _0x6db1=['remove','update','emit','removeListener','register','length','./mailMessage.events','save'];(function(_0x4b1a91,_0x80b4c4){var _0xc2fa56=function(_0x198f7d){while(--_0x198f7d){_0x4b1a91['push'](_0x4b1a91['shift']());}};_0xc2fa56(++_0x80b4c4);}(_0x6db1,0x13e));var _0x16db=function(_0x4b7873,_0x14bfda){_0x4b7873=_0x4b7873-0x0;var _0x35a5ee=_0x6db1[_0x4b7873];return _0x35a5ee;};'use strict';var MailMessageEvents=require(_0x16db('0x0'));var events=[_0x16db('0x1'),_0x16db('0x2'),_0x16db('0x3')];function createListener(_0x3d461d,_0x368dda){return function(_0x579046){_0x368dda[_0x16db('0x4')](_0x3d461d,_0x579046);};}function removeListener(_0x2520ff,_0x38f9cb){return function(){MailMessageEvents[_0x16db('0x5')](_0x2520ff,_0x38f9cb);};}exports[_0x16db('0x6')]=function(_0x1cf88f){for(var _0x38b8af=0x0,_0x1adae8=events[_0x16db('0x7')];_0x38b8af<_0x1adae8;_0x38b8af++){var _0x400d33=events[_0x38b8af];var _0x1a9012=createListener('mailMessage:'+_0x400d33,_0x1cf88f);MailMessageEvents['on'](_0x400d33,_0x1a9012);}}; \ No newline at end of file +var _0x18db=['emit','removeListener','register','length','mailMessage:','./mailMessage.events','remove'];(function(_0x4f3242,_0x391954){var _0x49844f=function(_0x5ee033){while(--_0x5ee033){_0x4f3242['push'](_0x4f3242['shift']());}};_0x49844f(++_0x391954);}(_0x18db,0x6e));var _0xb18d=function(_0x2dbe73,_0x185cf9){_0x2dbe73=_0x2dbe73-0x0;var _0x2ac241=_0x18db[_0x2dbe73];return _0x2ac241;};'use strict';var MailMessageEvents=require(_0xb18d('0x0'));var events=['save',_0xb18d('0x1'),'update'];function createListener(_0x4ed245,_0x1dc087){return function(_0x1e24bd){_0x1dc087[_0xb18d('0x2')](_0x4ed245,_0x1e24bd);};}function removeListener(_0x14b8ec,_0x9767c9){return function(){MailMessageEvents[_0xb18d('0x3')](_0x14b8ec,_0x9767c9);};}exports[_0xb18d('0x4')]=function(_0x2fe76b){for(var _0x912558=0x0,_0x4b210d=events[_0xb18d('0x5')];_0x912558<_0x4b210d;_0x912558++){var _0x5e4f93=events[_0x912558];var _0x2cd62f=createListener(_0xb18d('0x6')+_0x5e4f93,_0x2fe76b);MailMessageEvents['on'](_0x5e4f93,_0x2cd62f);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index f91a521..e774aa9 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 _0x6b1e=['show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','update','destroy','delete','removeTeams','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./mailQueue.controller','get','isAuthenticated','index','/:id'];(function(_0x593752,_0xfc3827){var _0x4612be=function(_0x2d64c6){while(--_0x2d64c6){_0x593752['push'](_0x593752['shift']());}};_0x4612be(++_0xfc3827);}(_0x6b1e,0xe7));var _0xe6b1=function(_0x530699,_0x512be0){_0x530699=_0x530699-0x0;var _0x2d183e=_0x6b1e[_0x530699];return _0x2d183e;};'use strict';var multer=require(_0xe6b1('0x0'));var util=require(_0xe6b1('0x1'));var path=require(_0xe6b1('0x2'));var timeout=require('connect-timeout');var express=require(_0xe6b1('0x3'));var router=express[_0xe6b1('0x4')]();var fs_extra=require(_0xe6b1('0x5'));var auth=require(_0xe6b1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe6b1('0x7'));router[_0xe6b1('0x8')]('/',auth[_0xe6b1('0x9')](),controller[_0xe6b1('0xa')]);router[_0xe6b1('0x8')]('/describe',auth[_0xe6b1('0x9')](),controller['describe']);router['get'](_0xe6b1('0xb'),auth[_0xe6b1('0x9')](),controller[_0xe6b1('0xc')]);router['get'](_0xe6b1('0xd'),auth[_0xe6b1('0x9')](),controller[_0xe6b1('0xe')]);router['get'](_0xe6b1('0xf'),auth[_0xe6b1('0x9')](),controller[_0xe6b1('0x10')]);router[_0xe6b1('0x8')](_0xe6b1('0x11'),auth['isAuthenticated'](),controller[_0xe6b1('0x12')]);router[_0xe6b1('0x13')]('/',auth[_0xe6b1('0x9')](),controller[_0xe6b1('0x14')]);router[_0xe6b1('0x13')]('/:id/teams',auth[_0xe6b1('0x9')](),controller['addTeams']);router[_0xe6b1('0x13')](_0xe6b1('0x11'),auth[_0xe6b1('0x9')](),controller['addAgents']);router[_0xe6b1('0x15')](_0xe6b1('0xb'),auth[_0xe6b1('0x9')](),controller[_0xe6b1('0x16')]);router['delete'](_0xe6b1('0xb'),auth['isAuthenticated'](),controller[_0xe6b1('0x17')]);router[_0xe6b1('0x18')](_0xe6b1('0xf'),auth[_0xe6b1('0x9')](),controller[_0xe6b1('0x19')]);router[_0xe6b1('0x18')]('/:id/users',auth[_0xe6b1('0x9')](),controller['removeAgents']);module[_0xe6b1('0x1a')]=router; \ No newline at end of file +var _0xbfc3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path'];(function(_0x1c4958,_0x3357ff){var _0x1cd861=function(_0x11c36e){while(--_0x11c36e){_0x1c4958['push'](_0x1c4958['shift']());}};_0x1cd861(++_0x3357ff);}(_0xbfc3,0x189));var _0x3bfc=function(_0x5bff95,_0x5c39b9){_0x5bff95=_0x5bff95-0x0;var _0x49c147=_0xbfc3[_0x5bff95];return _0x49c147;};'use strict';var multer=require(_0x3bfc('0x0'));var util=require(_0x3bfc('0x1'));var path=require(_0x3bfc('0x2'));var timeout=require(_0x3bfc('0x3'));var express=require(_0x3bfc('0x4'));var router=express[_0x3bfc('0x5')]();var fs_extra=require(_0x3bfc('0x6'));var auth=require(_0x3bfc('0x7'));var interaction=require(_0x3bfc('0x8'));var config=require(_0x3bfc('0x9'));var controller=require(_0x3bfc('0xa'));router['get']('/',auth[_0x3bfc('0xb')](),controller[_0x3bfc('0xc')]);router['get'](_0x3bfc('0xd'),auth[_0x3bfc('0xb')](),controller[_0x3bfc('0xe')]);router[_0x3bfc('0xf')](_0x3bfc('0x10'),auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x11')]);router[_0x3bfc('0xf')](_0x3bfc('0x12'),auth[_0x3bfc('0xb')](),controller['getMembers']);router[_0x3bfc('0xf')]('/:id/teams',auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x13')]);router[_0x3bfc('0xf')](_0x3bfc('0x14'),auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x15')]);router[_0x3bfc('0x16')]('/',auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x17')]);router[_0x3bfc('0x16')](_0x3bfc('0x18'),auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x19')]);router[_0x3bfc('0x16')](_0x3bfc('0x14'),auth[_0x3bfc('0xb')](),controller['addAgents']);router[_0x3bfc('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x3bfc('0x1b')]);router[_0x3bfc('0x1c')](_0x3bfc('0x10'),auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x1d')]);router[_0x3bfc('0x1c')]('/:id/teams',auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x1e')]);router[_0x3bfc('0x1c')](_0x3bfc('0x14'),auth[_0x3bfc('0xb')](),controller[_0x3bfc('0x1f')]);module[_0x3bfc('0x20')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 690a3e9..7b2992c 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 _0x471c=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x5a4fa8,_0x1ca50f){var _0x4a2160=function(_0x4f294c){while(--_0x4f294c){_0x5a4fa8['push'](_0x5a4fa8['shift']());}};_0x4a2160(++_0x1ca50f);}(_0x471c,0x1ce));var _0xc471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x471c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc471('0x0'));module[_0xc471('0x1')]={'name':{'type':Sequelize[_0xc471('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc471('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc471('0x4')](_0xc471('0x5'),_0xc471('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xe95b=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe95b,0x1b4));var _0xbe95=function(_0x2844fd,_0x1ed0b4){_0x2844fd=_0x2844fd-0x0;var _0x5a62b8=_0xe95b[_0x2844fd];return _0x5a62b8;};'use strict';var Sequelize=require(_0xbe95('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe95('0x1')],'unique':_0xbe95('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbe95('0x1')]},'timeout':{'type':Sequelize[_0xbe95('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbe95('0x4')](_0xbe95('0x5'),_0xbe95('0x6'),_0xbe95('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 9bde826..a60be83 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 _0x2dbd=['value','removeTeams','isEmpty','forEach','addAgents','omit','spread','userMailQueue:save','removeAgents','isArray','userMailQueue:remove','getAgents','bluebird','util','lodash','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','get','MailQueues','UserProfileResource','destroy','name','send','index','map','rawAttributes','fieldName','type','where','MailQueue','include','findAll','rows','params','model','keys','query','filters','intersection','attributes','length','includeAll','merge','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','getMembers','findOne','UserMailQueue','fields','hasOwnProperty','sort','pick','MailQueueId','filter','User','findAndCountAll','agent','mailPause','createdAt','%s/%s','SIP','getTeams','Team','order','nolimit','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','includes','all','compact'];(function(_0x2aa009,_0x5a1f96){var _0x52d850=function(_0x4f7438){while(--_0x4f7438){_0x2aa009['push'](_0x2aa009['shift']());}};_0x52d850(++_0x5a1f96);}(_0x2dbd,0x82));var _0xd2db=function(_0x414c69,_0x1a3e60){_0x414c69=_0x414c69-0x0;var _0x36ee32=_0x2dbd[_0x414c69];return _0x36ee32;};'use strict';var BPromise=require(_0xd2db('0x0'));var util=require(_0xd2db('0x1'));var _=require(_0xd2db('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0xd2db('0x3'));var logger=require('../../config/logger')(_0xd2db('0x4'));var config=require('../../config/environment');var db=require(_0xd2db('0x5'))['db'];config[_0xd2db('0x6')]=_[_0xd2db('0x7')](config[_0xd2db('0x6')],{'host':_0xd2db('0x8'),'port':0x18eb});var socket=require(_0xd2db('0x9'))(new Redis(config['redis']));require(_0xd2db('0xa'))[_0xd2db('0xb')](socket);function respondWithStatusCode(_0x486379,_0xd3de46){_0xd3de46=_0xd3de46||0xcc;return function(_0x490385){if(_0x490385){return _0x486379['sendStatus'](_0xd3de46);}return _0x486379[_0xd2db('0xc')](_0xd3de46)[_0xd2db('0xd')]();};}function respondWithResult(_0x4846d9,_0x3bfaae){_0x3bfaae=_0x3bfaae||0xc8;return function(_0x50bcc5){if(_0x50bcc5){return _0x4846d9[_0xd2db('0xc')](_0x3bfaae)[_0xd2db('0xe')](_0x50bcc5);}};}function respondWithFilteredResult(_0x65b309,_0x9bb0b3){return function(_0x3eed88){if(_0x3eed88){var _0x1ff10e=typeof _0x9bb0b3[_0xd2db('0xf')]===_0xd2db('0x10')&&typeof _0x9bb0b3['limit']===_0xd2db('0x10');var _0x239a22=_0x3eed88['count'];var _0x33e892=_0x1ff10e?0x0:_0x9bb0b3[_0xd2db('0xf')];var _0x35a5ce=_0x1ff10e?_0x3eed88[_0xd2db('0x11')]:_0x9bb0b3['offset']+_0x9bb0b3[_0xd2db('0x12')];var _0xfa6238;if(_0x35a5ce>=_0x239a22){_0x35a5ce=_0x239a22;_0xfa6238=0xc8;}else{_0xfa6238=0xce;}_0x65b309[_0xd2db('0xc')](_0xfa6238);return _0x65b309[_0xd2db('0x13')](_0xd2db('0x14'),_0x33e892+'-'+_0x35a5ce+'/'+_0x239a22)[_0xd2db('0xe')](_0x3eed88);}return null;};}function saveUpdates(_0x1991f8){return function(_0x1ec93e){if(_0x1ec93e){return _0x1ec93e[_0xd2db('0x15')](_0x1991f8)[_0xd2db('0x16')](function(_0x24d853){return _0x24d853;});}return null;};}function removeEntity(_0x17a6cf){return function(_0x599423){if(_0x599423){return _0x599423['destroy']()[_0xd2db('0x16')](function(){var _0x3cc6b5=_0x599423[_0xd2db('0x17')]({'plain':!![]});var _0xb67bd4=_0xd2db('0x18');return db[_0xd2db('0x19')][_0xd2db('0x1a')]({'where':{'type':_0xb67bd4,'resourceId':_0x3cc6b5['id']}})[_0xd2db('0x16')](function(){return _0x599423;});})[_0xd2db('0x16')](function(){_0x17a6cf['status'](0xcc)[_0xd2db('0xd')]();});}};}function handleEntityNotFound(_0x15cee1){return function(_0x5d59f8){if(!_0x5d59f8){_0x15cee1['sendStatus'](0x194);}return _0x5d59f8;};}function handleError(_0x119733,_0x35ca9c){_0x35ca9c=_0x35ca9c||0x1f4;return function(_0x25e803){logger['error'](_0x25e803['stack']);if(_0x25e803['name']){delete _0x25e803[_0xd2db('0x1b')];}_0x119733[_0xd2db('0xc')](_0x35ca9c)[_0xd2db('0x1c')](_0x25e803);};}exports[_0xd2db('0x1d')]=function(_0x5c0f89,_0x362a46){var _0x292aaf={};var _0x41d887={'count':0x0,'rows':[]};var _0x423347=_[_0xd2db('0x1e')](db['MailQueue'][_0xd2db('0x1f')],function(_0x4824e3){return{'name':_0x4824e3[_0xd2db('0x20')],'type':_0x4824e3[_0xd2db('0x21')]['key']};});_0x292aaf=qs['getOptions'](_0x423347,_0x5c0f89);var _0x140cea={'where':_0x292aaf[_0xd2db('0x22')]};return db[_0xd2db('0x23')][_0xd2db('0x11')](_0x140cea)[_0xd2db('0x16')](function(_0x20461a){_0x41d887[_0xd2db('0x11')]=_0x20461a;_0x292aaf[_0xd2db('0x24')]=qs[_0xd2db('0x24')](_0x5c0f89['query']);return db['MailQueue'][_0xd2db('0x25')](_0x292aaf);})[_0xd2db('0x16')](function(_0xf76450){_0x41d887[_0xd2db('0x26')]=_0xf76450;return _0x41d887;})['then'](respondWithFilteredResult(_0x362a46,_0x292aaf))['catch'](handleError(_0x362a46,null));};exports['show']=function(_0x59e12c,_0x216b22){var _0x375c3f={'raw':!![],'where':{'id':_0x59e12c[_0xd2db('0x27')]['id']}},_0x27a164={};_0x27a164[_0xd2db('0x28')]=_[_0xd2db('0x29')](db['MailQueue']['rawAttributes']);_0x27a164[_0xd2db('0x2a')]=_['keys'](_0x59e12c[_0xd2db('0x2a')]);_0x27a164[_0xd2db('0x2b')]=_[_0xd2db('0x2c')](_0x27a164[_0xd2db('0x28')],_0x27a164['query']);_0x375c3f[_0xd2db('0x2d')]=_[_0xd2db('0x2c')](_0x27a164[_0xd2db('0x28')],qs['fields'](_0x59e12c[_0xd2db('0x2a')]['fields']));_0x375c3f[_0xd2db('0x2d')]=_0x375c3f[_0xd2db('0x2d')][_0xd2db('0x2e')]?_0x375c3f['attributes']:_0x27a164[_0xd2db('0x28')];if(_0x59e12c[_0xd2db('0x2a')][_0xd2db('0x2f')]){_0x375c3f[_0xd2db('0x24')]=[{'all':!![]}];}_0x375c3f=_[_0xd2db('0x30')]({},_0x375c3f,_0x59e12c[_0xd2db('0x31')]);return db[_0xd2db('0x23')][_0xd2db('0x32')](_0x375c3f)['then'](handleEntityNotFound(_0x216b22,null))[_0xd2db('0x16')](respondWithResult(_0x216b22,null))['catch'](handleError(_0x216b22,null));};exports[_0xd2db('0x33')]=function(_0x1260fe,_0x34a491){return db[_0xd2db('0x23')]['create'](_0x1260fe[_0xd2db('0x34')],{})[_0xd2db('0x16')](function(_0x4c681b){var _0x188158=_0x1260fe[_0xd2db('0x35')][_0xd2db('0x17')]({'plain':!![]});if(!_0x188158)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x188158[_0xd2db('0x36')]===_0xd2db('0x35')){var _0x5479bb=_0x4c681b[_0xd2db('0x17')]({'plain':!![]});var _0x26459c=_0xd2db('0x18');return db[_0xd2db('0x37')][_0xd2db('0x32')]({'where':{'name':_0x26459c,'userProfileId':_0x188158[_0xd2db('0x38')]},'raw':!![]})['then'](function(_0xab8df){if(_0xab8df&&_0xab8df[_0xd2db('0x39')]===0x0){return db[_0xd2db('0x19')]['create']({'name':_0x5479bb[_0xd2db('0x1b')],'resourceId':_0x5479bb['id'],'type':_0xab8df['name'],'sectionId':_0xab8df['id']},{})[_0xd2db('0x16')](function(){return _0x4c681b;});}else{return _0x4c681b;}})['catch'](function(_0x2bd059){logger[_0xd2db('0x3a')](_0xd2db('0x3b'),_0x2bd059);throw _0x2bd059;});}return _0x4c681b;})[_0xd2db('0x16')](respondWithResult(_0x34a491,0xc9))[_0xd2db('0x3c')](handleError(_0x34a491,null));};exports['update']=function(_0x42fe0b,_0x596580){if(_0x42fe0b['body']['id']){delete _0x42fe0b[_0xd2db('0x34')]['id'];}return db[_0xd2db('0x23')][_0xd2db('0x32')]({'where':{'id':_0x42fe0b[_0xd2db('0x27')]['id']}})[_0xd2db('0x16')](handleEntityNotFound(_0x596580,null))[_0xd2db('0x16')](saveUpdates(_0x42fe0b[_0xd2db('0x34')],null))['then'](respondWithResult(_0x596580,null))[_0xd2db('0x3c')](handleError(_0x596580,null));};exports[_0xd2db('0x1a')]=function(_0x351c41,_0x45b14a){return db['MailQueue'][_0xd2db('0x32')]({'where':{'id':_0x351c41['params']['id']}})[_0xd2db('0x16')](handleEntityNotFound(_0x45b14a,null))[_0xd2db('0x16')](removeEntity(_0x45b14a,null))['catch'](handleError(_0x45b14a,null));};exports[_0xd2db('0x3d')]=function(_0x40d25d,_0x244599){return db[_0xd2db('0x23')][_0xd2db('0x3d')]()['then'](respondWithResult(_0x244599,null))['catch'](handleError(_0x244599,null));};exports[_0xd2db('0x3e')]=function(_0x37e15c,_0x4a5e70){var _0x2801c6={'raw':!![],'where':{}},_0x38a09a={},_0x35f0bc;return db[_0xd2db('0x23')][_0xd2db('0x3f')]({'where':{'id':_0x37e15c['params']['id']}})[_0xd2db('0x16')](handleEntityNotFound(_0x4a5e70,null))[_0xd2db('0x16')](function(_0x48390b){if(_0x48390b){_0x35f0bc=_0x48390b[_0xd2db('0x17')]({'plain':!![]});_0x38a09a[_0xd2db('0x28')]=_[_0xd2db('0x29')](db[_0xd2db('0x40')][_0xd2db('0x1f')]);_0x38a09a[_0xd2db('0x2a')]=_[_0xd2db('0x29')](_0x37e15c[_0xd2db('0x2a')]);_0x38a09a['filters']=_[_0xd2db('0x2c')](_0x38a09a[_0xd2db('0x28')],_0x38a09a[_0xd2db('0x2a')]);_0x2801c6[_0xd2db('0x2d')]=_[_0xd2db('0x2c')](_0x38a09a[_0xd2db('0x28')],qs[_0xd2db('0x41')](_0x37e15c[_0xd2db('0x2a')][_0xd2db('0x41')]));_0x2801c6[_0xd2db('0x2d')]=_0x2801c6['attributes'][_0xd2db('0x2e')]?_0x2801c6['attributes']:_0x38a09a['model'];if(!_0x37e15c[_0xd2db('0x2a')][_0xd2db('0x42')]('nolimit')){_0x2801c6[_0xd2db('0x12')]=qs[_0xd2db('0x12')](_0x37e15c[_0xd2db('0x2a')][_0xd2db('0x12')]);_0x2801c6[_0xd2db('0xf')]=qs[_0xd2db('0xf')](_0x37e15c[_0xd2db('0x2a')][_0xd2db('0xf')]);}_0x2801c6['order']=qs[_0xd2db('0x43')](_0x37e15c[_0xd2db('0x2a')][_0xd2db('0x43')]);_0x2801c6[_0xd2db('0x22')]=qs['filters'](_[_0xd2db('0x44')](_0x37e15c['query'],_0x38a09a[_0xd2db('0x2b')]));_0x2801c6['where'][_0xd2db('0x45')]=_0x48390b['id'];if(_0x37e15c[_0xd2db('0x2a')][_0xd2db('0x46')]){_0x2801c6[_0xd2db('0x22')]=_[_0xd2db('0x30')](_0x2801c6['where'],{'$or':_['map'](_0x2801c6[_0xd2db('0x2d')],function(_0x48b77f){var _0x1d5b81={};_0x1d5b81[_0x48b77f]={'$like':'%'+_0x37e15c['query']['filter']+'%'};return _0x1d5b81;})});}_0x2801c6=_[_0xd2db('0x30')]({},_0x2801c6,_0x37e15c[_0xd2db('0x31')]);return db[_0xd2db('0x40')][_0xd2db('0x25')](_0x2801c6);}})['then'](function(_0x5b76db){if(_0x5b76db){return db[_0xd2db('0x47')][_0xd2db('0x48')]({'where':{'id':_[_0xd2db('0x1e')](_0x5b76db,'UserId'),'role':_0xd2db('0x49')},'attributes':['id',_0xd2db('0x1b'),_0xd2db('0x4a'),'updatedAt',_0xd2db('0x4b')]});}})[_0xd2db('0x16')](function(_0x289409){if(_0x289409){return{'count':_0x289409['count'],'rows':_[_0xd2db('0x1e')](_0x289409[_0xd2db('0x26')],function(_0x478f02){return{'membername':_0x478f02[_0xd2db('0x1b')],'UserId':_0x478f02['id'],'queue_name':_0x35f0bc['name'],'MailQueueId':_0x35f0bc['id'],'interface':util['format'](_0xd2db('0x4c'),_0xd2db('0x4d'),_0x478f02['name']),'penalty':0x0,'paused':_0x478f02['mailPause'],'createdAt':_0x478f02[_0xd2db('0x4b')],'updatedAt':_0x478f02['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4a5e70,_0x2801c6))['catch'](handleError(_0x4a5e70,null));};exports[_0xd2db('0x4e')]=function(_0x418d23,_0x216bad){var _0x228a47={};var _0x54969f={};var _0x1a58a7;var _0x1ef129;return db['MailQueue'][_0xd2db('0x3f')]({'where':{'id':_0x418d23[_0xd2db('0x27')]['id']}})[_0xd2db('0x16')](handleEntityNotFound(_0x216bad,null))[_0xd2db('0x16')](function(_0x447e41){if(_0x447e41){_0x1a58a7=_0x447e41;_0x54969f[_0xd2db('0x28')]=_[_0xd2db('0x29')](db[_0xd2db('0x4f')][_0xd2db('0x1f')]);_0x54969f[_0xd2db('0x2a')]=_[_0xd2db('0x29')](_0x418d23[_0xd2db('0x2a')]);_0x54969f['filters']=_[_0xd2db('0x2c')](_0x54969f['model'],_0x54969f[_0xd2db('0x2a')]);_0x228a47[_0xd2db('0x2d')]=_['intersection'](_0x54969f[_0xd2db('0x28')],qs[_0xd2db('0x41')](_0x418d23['query'][_0xd2db('0x41')]));_0x228a47[_0xd2db('0x2d')]=_0x228a47['attributes']['length']?_0x228a47[_0xd2db('0x2d')]:_0x54969f[_0xd2db('0x28')];_0x228a47[_0xd2db('0x50')]=qs[_0xd2db('0x43')](_0x418d23[_0xd2db('0x2a')][_0xd2db('0x43')]);_0x228a47[_0xd2db('0x22')]=qs[_0xd2db('0x2b')](_['pick'](_0x418d23[_0xd2db('0x2a')],_0x54969f[_0xd2db('0x2b')]));if(_0x418d23[_0xd2db('0x2a')][_0xd2db('0x46')]){_0x228a47['where']=_[_0xd2db('0x30')](_0x228a47['where'],{'$or':_[_0xd2db('0x1e')](_0x228a47[_0xd2db('0x2d')],function(_0x5e5530){var _0xd86cb1={};_0xd86cb1[_0x5e5530]={'$like':'%'+_0x418d23[_0xd2db('0x2a')][_0xd2db('0x46')]+'%'};return _0xd86cb1;})});}_0x228a47=_[_0xd2db('0x30')]({},_0x228a47,_0x418d23[_0xd2db('0x31')]);return _0x1a58a7['getTeams'](_0x228a47);}})[_0xd2db('0x16')](function(_0xff1fe8){if(_0xff1fe8){_0x1ef129=_0xff1fe8[_0xd2db('0x2e')];if(!_0x418d23[_0xd2db('0x2a')][_0xd2db('0x42')](_0xd2db('0x51'))){_0x228a47[_0xd2db('0x12')]=qs[_0xd2db('0x12')](_0x418d23[_0xd2db('0x2a')][_0xd2db('0x12')]);_0x228a47[_0xd2db('0xf')]=qs[_0xd2db('0xf')](_0x418d23[_0xd2db('0x2a')][_0xd2db('0xf')]);}return _0x1a58a7[_0xd2db('0x4e')](_0x228a47);}})['then'](function(_0x5cefac){if(_0x5cefac){return _0x5cefac?{'count':_0x1ef129,'rows':_0x5cefac}:null;}})[_0xd2db('0x16')](respondWithResult(_0x216bad,null))[_0xd2db('0x3c')](handleError(_0x216bad,null));};exports[_0xd2db('0x52')]=function(_0x5be1c1,_0x59bdbb){var _0x155539=_0x5be1c1['body'][_0xd2db('0x53')];return db[_0xd2db('0x4f')][_0xd2db('0x25')]({'where':{'id':_0x155539},'attributes':['id'],'include':[{'model':db[_0xd2db('0x47')],'as':_0xd2db('0x54'),'attributes':['id',_0xd2db('0x1b'),_0xd2db('0x55'),_0xd2db('0x56'),_0xd2db('0x57')],'raw':!![]}]})[_0xd2db('0x16')](function(_0x5477a4){if(_0x5477a4){var _0x3b4ff0=_[_0xd2db('0x58')](_0x5477a4,function(_0x5de93e){var _0x18cc20=_0x5de93e[_0xd2db('0x17')]({'plain':!![]});return _0x18cc20[_0xd2db('0x54')];});return db[_0xd2db('0x23')]['find']({'where':{'id':_0x5be1c1[_0xd2db('0x27')]['id']}})[_0xd2db('0x16')](function(_0x3f564c){return db[_0xd2db('0x59')][_0xd2db('0x5a')](function(_0x831659){return _0x3f564c[_0xd2db('0x52')](_0x155539,{'transaction':_0x831659})[_0xd2db('0x16')](function(){return BPromise[_0xd2db('0x5b')](_0x3b4ff0,function(_0x58fdab){return db[_0xd2db('0x40')][_0xd2db('0x5c')]({'where':{'UserId':_0x58fdab['id'],'MailQueueId':_0x5be1c1[_0xd2db('0x27')]['id']},'transaction':_0x831659});});})[_0xd2db('0x16')](function(){_0x3b4ff0['forEach'](function(_0x157a56){socket[_0xd2db('0x5d')]('userMailQueue:save',{'UserId':_0x157a56['id'],'MailQueueId':_0x3f564c['id']});});});});});}})[_0xd2db('0x16')](respondWithStatusCode(_0x59bdbb,null))[_0xd2db('0x3c')](handleError(_0x59bdbb,null));};exports['removeTeams']=function(_0x2cdf30,_0x15bece){return db['Team']['findAll']({'where':{'id':_0x2cdf30[_0xd2db('0x2a')][_0xd2db('0x53')]},'attributes':['id'],'include':[{'model':db[_0xd2db('0x47')],'as':_0xd2db('0x54'),'attributes':['id'],'raw':!![]}]})[_0xd2db('0x16')](handleEntityNotFound(_0x15bece,null))[_0xd2db('0x16')](function(_0x1e92bb){var _0x1b1791=_[_0xd2db('0x1e')](_0x1e92bb,'id');var _0x5aebca=[];var _0x2f9eca=[];var _0x4f1540=squel['select']();_0x4f1540[_0xd2db('0x5e')](_0xd2db('0x5f'))[_0xd2db('0x60')]('team_has_mail_queues','tq')[_0xd2db('0x61')]('user_has_teams','ut',_0xd2db('0x62'))[_0xd2db('0x22')]('MailQueueId\x20=\x20?',_0x2cdf30[_0xd2db('0x27')]['id']);for(var _0x2644dd=0x0;_0x2644dd<_0x1e92bb[_0xd2db('0x2e')];_0x2644dd+=0x1){let _0x34eea6=_0x1e92bb[_0x2644dd];for(var _0x30b00d=0x0;_0x30b00d<_0x34eea6['Agents'][_0xd2db('0x2e')];_0x30b00d+=0x1){let _0xef6828=_0x34eea6[_0xd2db('0x54')][_0x30b00d];var _0x52d5f2=_0x4f1540['clone']();_0x52d5f2[_0xd2db('0x22')](_0xd2db('0x63'),_0xef6828['id']);_0x2f9eca['push'](db[_0xd2db('0x59')][_0xd2db('0x2a')](_0x52d5f2[_0xd2db('0x64')](),{'type':db[_0xd2db('0x59')]['QueryTypes'][_0xd2db('0x65')]})[_0xd2db('0x16')](function(_0x5a23fd){if(_0x5a23fd['length']===0x1){return _0xef6828['id'];}else{var _0x540406=_[_0xd2db('0x66')](_['map'](_0x5a23fd,'TeamId'),function(_0x594d64){return _[_0xd2db('0x67')](_0x1b1791,_0x594d64);});if(_0x540406){return _0xef6828['id'];}}}));}}return BPromise[_0xd2db('0x68')](_0x2f9eca)[_0xd2db('0x16')](function(_0x78a069){_0x5aebca=_(_0x5aebca)['union'](_0x78a069)[_0xd2db('0x69')]()[_0xd2db('0x6a')]();return db[_0xd2db('0x23')][_0xd2db('0x32')]({'where':{'id':_0x2cdf30[_0xd2db('0x27')]['id']}})[_0xd2db('0x16')](function(_0x5e5df0){return db[_0xd2db('0x59')][_0xd2db('0x5a')](function(_0x18ab3a){return _0x5e5df0[_0xd2db('0x6b')](_0x2cdf30[_0xd2db('0x2a')]['ids'],{'transaction':_0x18ab3a})[_0xd2db('0x16')](function(){if(!_[_0xd2db('0x6c')](_0x5aebca)){return _0x5e5df0['removeAgents'](_0x5aebca,{'transaction':_0x18ab3a});}})['then'](function(){_0x5aebca[_0xd2db('0x6d')](function(_0x3a719e){socket['emit']('userMailQueue:remove',{'UserId':_0x3a719e,'MailQueueId':_0x5e5df0['id']});});});});});});})[_0xd2db('0x16')](respondWithStatusCode(_0x15bece,null))[_0xd2db('0x3c')](handleError(_0x15bece,null));};exports[_0xd2db('0x6e')]=function(_0x2f3792,_0x1afeda){return db['MailQueue'][_0xd2db('0x32')]({'where':{'id':_0x2f3792['params']['id']}})['then'](handleEntityNotFound(_0x1afeda,null))['then'](function(_0x51ca73){if(_0x51ca73){return _0x51ca73[_0xd2db('0x6e')](_0x2f3792['body']['ids'],_[_0xd2db('0x6f')](_0x2f3792[_0xd2db('0x34')],['ids','id'])||{})[_0xd2db('0x70')](function(_0x39956f){for(var _0x18b1b8=0x0;_0x18b1b8<_0x2f3792['body'][_0xd2db('0x53')][_0xd2db('0x2e')];_0x18b1b8+=0x1){socket[_0xd2db('0x5d')](_0xd2db('0x71'),{'UserId':Number(_0x2f3792[_0xd2db('0x34')][_0xd2db('0x53')][_0x18b1b8]),'MailQueueId':Number(_0x2f3792['params']['id'])});}return _0x39956f;});}})[_0xd2db('0x16')](respondWithResult(_0x1afeda,null))['catch'](handleError(_0x1afeda,null));};exports['removeAgents']=function(_0x4a6646,_0x5ab344){return db[_0xd2db('0x23')][_0xd2db('0x32')]({'where':{'id':_0x4a6646['params']['id']}})['then'](handleEntityNotFound(_0x5ab344,null))[_0xd2db('0x16')](function(_0x4dcc5f){if(_0x4dcc5f){return _0x4dcc5f[_0xd2db('0x72')](_0x4a6646['query']['ids'])[_0xd2db('0x16')](function(){if(_[_0xd2db('0x73')](_0x4a6646[_0xd2db('0x2a')][_0xd2db('0x53')])){for(var _0x45fbf1=0x0;_0x45fbf1<_0x4a6646['query'][_0xd2db('0x53')][_0xd2db('0x2e')];_0x45fbf1+=0x1){socket[_0xd2db('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x4a6646[_0xd2db('0x2a')][_0xd2db('0x53')][_0x45fbf1]),'MailQueueId':Number(_0x4a6646['params']['id'])});}}else{socket[_0xd2db('0x5d')](_0xd2db('0x74'),{'UserId':Number(_0x4a6646[_0xd2db('0x2a')][_0xd2db('0x53')]),'MailQueueId':Number(_0x4a6646[_0xd2db('0x27')]['id'])});}});}})[_0xd2db('0x16')](respondWithStatusCode(_0x5ab344,null))['catch'](handleError(_0x5ab344,null));};exports[_0xd2db('0x75')]=function(_0x9ae6a0,_0x18a238){var _0xf3c9cd={};var _0x1ae83e={};var _0x151f29;var _0x32f9b0;return db['MailQueue']['findOne']({'where':{'id':_0x9ae6a0['params']['id']}})['then'](handleEntityNotFound(_0x18a238,null))['then'](function(_0x20ddde){if(_0x20ddde){_0x151f29=_0x20ddde;_0x1ae83e['model']=_['keys'](db[_0xd2db('0x47')][_0xd2db('0x1f')]);_0x1ae83e[_0xd2db('0x2a')]=_[_0xd2db('0x29')](_0x9ae6a0[_0xd2db('0x2a')]);_0x1ae83e[_0xd2db('0x2b')]=_[_0xd2db('0x2c')](_0x1ae83e['model'],_0x1ae83e['query']);_0xf3c9cd[_0xd2db('0x2d')]=_[_0xd2db('0x2c')](_0x1ae83e[_0xd2db('0x28')],qs[_0xd2db('0x41')](_0x9ae6a0['query'][_0xd2db('0x41')]));_0xf3c9cd[_0xd2db('0x2d')]=_0xf3c9cd[_0xd2db('0x2d')][_0xd2db('0x2e')]?_0xf3c9cd[_0xd2db('0x2d')]:_0x1ae83e[_0xd2db('0x28')];_0xf3c9cd['order']=qs['sort'](_0x9ae6a0[_0xd2db('0x2a')][_0xd2db('0x43')]);_0xf3c9cd['where']=qs['filters'](_[_0xd2db('0x44')](_0x9ae6a0[_0xd2db('0x2a')],_0x1ae83e[_0xd2db('0x2b')]));if(_0x9ae6a0[_0xd2db('0x2a')][_0xd2db('0x46')]){_0xf3c9cd[_0xd2db('0x22')]=_[_0xd2db('0x30')](_0xf3c9cd['where'],{'$or':_[_0xd2db('0x1e')](_0xf3c9cd[_0xd2db('0x2d')],function(_0x182579){var _0x1d6ff1={};_0x1d6ff1[_0x182579]={'$like':'%'+_0x9ae6a0[_0xd2db('0x2a')][_0xd2db('0x46')]+'%'};return _0x1d6ff1;})});}_0xf3c9cd=_['merge']({},_0xf3c9cd,_0x9ae6a0[_0xd2db('0x31')]);return _0x151f29[_0xd2db('0x75')](_0xf3c9cd);}})['then'](function(_0x205c59){if(_0x205c59){_0x32f9b0=_0x205c59['length'];if(!_0x9ae6a0[_0xd2db('0x2a')]['hasOwnProperty']('nolimit')){_0xf3c9cd[_0xd2db('0x12')]=qs[_0xd2db('0x12')](_0x9ae6a0[_0xd2db('0x2a')]['limit']);_0xf3c9cd[_0xd2db('0xf')]=qs['offset'](_0x9ae6a0[_0xd2db('0x2a')][_0xd2db('0xf')]);}return _0x151f29[_0xd2db('0x75')](_0xf3c9cd);}})[_0xd2db('0x16')](function(_0x262c94){if(_0x262c94){return _0x262c94?{'count':_0x32f9b0,'rows':_0x262c94}:null;}})[_0xd2db('0x16')](respondWithResult(_0x18a238,null))[_0xd2db('0x3c')](handleError(_0x18a238,null));}; \ No newline at end of file +var _0xb5e4=['model','keys','filters','intersection','attributes','fields','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','hasOwnProperty','nolimit','order','sort','where','pick','MailQueueId','merge','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','filter','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','include','query','MailQueue','findAll','catch','params'];(function(_0x238049,_0x43e7f7){var _0x5a942c=function(_0x4fcdad){while(--_0x4fcdad){_0x238049['push'](_0x238049['shift']());}};_0x5a942c(++_0x43e7f7);}(_0xb5e4,0x149));var _0x4b5e=function(_0x5c9ced,_0x48c7c2){_0x5c9ced=_0x5c9ced-0x0;var _0xf9758f=_0xb5e4[_0x5c9ced];return _0xf9758f;};'use strict';var BPromise=require(_0x4b5e('0x0'));var util=require(_0x4b5e('0x1'));var _=require(_0x4b5e('0x2'));var squel=require(_0x4b5e('0x3'));var Redis=require(_0x4b5e('0x4'));var qs=require(_0x4b5e('0x5'));var logger=require(_0x4b5e('0x6'))('api');var config=require(_0x4b5e('0x7'));var db=require(_0x4b5e('0x8'))['db'];config[_0x4b5e('0x9')]=_[_0x4b5e('0xa')](config[_0x4b5e('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b5e('0xb'))(new Redis(config['redis']));require(_0x4b5e('0xc'))[_0x4b5e('0xd')](socket);function respondWithStatusCode(_0x3d2ef6,_0x63ab7d){_0x63ab7d=_0x63ab7d||0xcc;return function(_0x4eeb21){if(_0x4eeb21){return _0x3d2ef6['sendStatus'](_0x63ab7d);}return _0x3d2ef6[_0x4b5e('0xe')](_0x63ab7d)[_0x4b5e('0xf')]();};}function respondWithResult(_0x430958,_0x4e273c){_0x4e273c=_0x4e273c||0xc8;return function(_0x4cbcbc){if(_0x4cbcbc){return _0x430958['status'](_0x4e273c)[_0x4b5e('0x10')](_0x4cbcbc);}};}function respondWithFilteredResult(_0x11c0de,_0x542fe5){return function(_0x213fd3){if(_0x213fd3){var _0x4dcd47=typeof _0x542fe5[_0x4b5e('0x11')]===_0x4b5e('0x12')&&typeof _0x542fe5[_0x4b5e('0x13')]===_0x4b5e('0x12');var _0x2d232e=_0x213fd3[_0x4b5e('0x14')];var _0x3fb224=_0x4dcd47?0x0:_0x542fe5[_0x4b5e('0x11')];var _0x47d634=_0x4dcd47?_0x213fd3[_0x4b5e('0x14')]:_0x542fe5[_0x4b5e('0x11')]+_0x542fe5[_0x4b5e('0x13')];var _0x5245f8;if(_0x47d634>=_0x2d232e){_0x47d634=_0x2d232e;_0x5245f8=0xc8;}else{_0x5245f8=0xce;}_0x11c0de['status'](_0x5245f8);return _0x11c0de[_0x4b5e('0x15')](_0x4b5e('0x16'),_0x3fb224+'-'+_0x47d634+'/'+_0x2d232e)['json'](_0x213fd3);}return null;};}function saveUpdates(_0x437811){return function(_0x9d44f7){if(_0x9d44f7){return _0x9d44f7[_0x4b5e('0x17')](_0x437811)[_0x4b5e('0x18')](function(_0x552be6){return _0x552be6;});}return null;};}function removeEntity(_0x481464){return function(_0x54de43){if(_0x54de43){return _0x54de43[_0x4b5e('0x19')]()['then'](function(){var _0x41b239=_0x54de43[_0x4b5e('0x1a')]({'plain':!![]});var _0x3f6a43='MailQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x3f6a43,'resourceId':_0x41b239['id']}})['then'](function(){return _0x54de43;});})[_0x4b5e('0x18')](function(){_0x481464[_0x4b5e('0xe')](0xcc)[_0x4b5e('0xf')]();});}};}function handleEntityNotFound(_0x441eaf){return function(_0x41f319){if(!_0x41f319){_0x441eaf[_0x4b5e('0x1b')](0x194);}return _0x41f319;};}function handleError(_0x120753,_0x42e5fa){_0x42e5fa=_0x42e5fa||0x1f4;return function(_0x48f592){logger[_0x4b5e('0x1c')](_0x48f592['stack']);if(_0x48f592['name']){delete _0x48f592[_0x4b5e('0x1d')];}_0x120753[_0x4b5e('0xe')](_0x42e5fa)[_0x4b5e('0x1e')](_0x48f592);};}exports[_0x4b5e('0x1f')]=function(_0x1bde7e,_0xe8bd44){var _0x54dde3={};var _0x40bf95={'count':0x0,'rows':[]};var _0x44499c=_[_0x4b5e('0x20')](db['MailQueue'][_0x4b5e('0x21')],function(_0x112439){return{'name':_0x112439[_0x4b5e('0x22')],'type':_0x112439[_0x4b5e('0x23')][_0x4b5e('0x24')]};});_0x54dde3=qs['getOptions'](_0x44499c,_0x1bde7e);var _0x4adeda={'where':_0x54dde3['where']};return db['MailQueue']['count'](_0x4adeda)['then'](function(_0x1104b1){_0x40bf95[_0x4b5e('0x14')]=_0x1104b1;_0x54dde3[_0x4b5e('0x25')]=qs[_0x4b5e('0x25')](_0x1bde7e[_0x4b5e('0x26')]);return db[_0x4b5e('0x27')][_0x4b5e('0x28')](_0x54dde3);})[_0x4b5e('0x18')](function(_0x44c286){_0x40bf95['rows']=_0x44c286;return _0x40bf95;})[_0x4b5e('0x18')](respondWithFilteredResult(_0xe8bd44,_0x54dde3))[_0x4b5e('0x29')](handleError(_0xe8bd44,null));};exports['show']=function(_0x292607,_0x484311){var _0x49ca76={'raw':!![],'where':{'id':_0x292607[_0x4b5e('0x2a')]['id']}},_0x375015={};_0x375015[_0x4b5e('0x2b')]=_[_0x4b5e('0x2c')](db['MailQueue'][_0x4b5e('0x21')]);_0x375015[_0x4b5e('0x26')]=_['keys'](_0x292607[_0x4b5e('0x26')]);_0x375015[_0x4b5e('0x2d')]=_[_0x4b5e('0x2e')](_0x375015['model'],_0x375015[_0x4b5e('0x26')]);_0x49ca76[_0x4b5e('0x2f')]=_['intersection'](_0x375015[_0x4b5e('0x2b')],qs[_0x4b5e('0x30')](_0x292607[_0x4b5e('0x26')][_0x4b5e('0x30')]));_0x49ca76['attributes']=_0x49ca76['attributes'][_0x4b5e('0x31')]?_0x49ca76[_0x4b5e('0x2f')]:_0x375015[_0x4b5e('0x2b')];if(_0x292607[_0x4b5e('0x26')][_0x4b5e('0x32')]){_0x49ca76[_0x4b5e('0x25')]=[{'all':!![]}];}_0x49ca76=_['merge']({},_0x49ca76,_0x292607[_0x4b5e('0x33')]);return db['MailQueue'][_0x4b5e('0x34')](_0x49ca76)[_0x4b5e('0x18')](handleEntityNotFound(_0x484311,null))[_0x4b5e('0x18')](respondWithResult(_0x484311,null))['catch'](handleError(_0x484311,null));};exports[_0x4b5e('0x35')]=function(_0x389fd8,_0x2dfdce){return db[_0x4b5e('0x27')]['create'](_0x389fd8[_0x4b5e('0x36')],{})[_0x4b5e('0x18')](function(_0xb00d3){var _0x8b51db=_0x389fd8[_0x4b5e('0x37')][_0x4b5e('0x1a')]({'plain':!![]});if(!_0x8b51db)throw new Error(_0x4b5e('0x38'));if(_0x8b51db[_0x4b5e('0x39')]===_0x4b5e('0x37')){var _0x1af978=_0xb00d3[_0x4b5e('0x1a')]({'plain':!![]});var _0x1f45eb=_0x4b5e('0x3a');return db[_0x4b5e('0x3b')]['find']({'where':{'name':_0x1f45eb,'userProfileId':_0x8b51db['userProfileId']},'raw':!![]})[_0x4b5e('0x18')](function(_0x35be1b){if(_0x35be1b&&_0x35be1b[_0x4b5e('0x3c')]===0x0){return db['UserProfileResource'][_0x4b5e('0x35')]({'name':_0x1af978[_0x4b5e('0x1d')],'resourceId':_0x1af978['id'],'type':_0x35be1b[_0x4b5e('0x1d')],'sectionId':_0x35be1b['id']},{})[_0x4b5e('0x18')](function(){return _0xb00d3;});}else{return _0xb00d3;}})[_0x4b5e('0x29')](function(_0x1407b3){logger[_0x4b5e('0x1c')](_0x4b5e('0x3d'),_0x1407b3);throw _0x1407b3;});}return _0xb00d3;})[_0x4b5e('0x18')](respondWithResult(_0x2dfdce,0xc9))[_0x4b5e('0x29')](handleError(_0x2dfdce,null));};exports[_0x4b5e('0x17')]=function(_0x4b6d28,_0x22d6d7){if(_0x4b6d28[_0x4b5e('0x36')]['id']){delete _0x4b6d28['body']['id'];}return db['MailQueue'][_0x4b5e('0x34')]({'where':{'id':_0x4b6d28[_0x4b5e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x22d6d7,null))['then'](saveUpdates(_0x4b6d28[_0x4b5e('0x36')],null))[_0x4b5e('0x18')](respondWithResult(_0x22d6d7,null))[_0x4b5e('0x29')](handleError(_0x22d6d7,null));};exports['destroy']=function(_0x194d8f,_0x2731ad){return db['MailQueue']['find']({'where':{'id':_0x194d8f[_0x4b5e('0x2a')]['id']}})[_0x4b5e('0x18')](handleEntityNotFound(_0x2731ad,null))[_0x4b5e('0x18')](removeEntity(_0x2731ad,null))[_0x4b5e('0x29')](handleError(_0x2731ad,null));};exports[_0x4b5e('0x3e')]=function(_0x387d4f,_0x258993){return db[_0x4b5e('0x27')][_0x4b5e('0x3e')]()['then'](respondWithResult(_0x258993,null))[_0x4b5e('0x29')](handleError(_0x258993,null));};exports[_0x4b5e('0x3f')]=function(_0x255978,_0x33d947){var _0x15e3d6={'raw':!![],'where':{}},_0x3cefd8={},_0x38cf89;return db[_0x4b5e('0x27')]['findOne']({'where':{'id':_0x255978['params']['id']}})[_0x4b5e('0x18')](handleEntityNotFound(_0x33d947,null))[_0x4b5e('0x18')](function(_0x266638){if(_0x266638){_0x38cf89=_0x266638['get']({'plain':!![]});_0x3cefd8[_0x4b5e('0x2b')]=_[_0x4b5e('0x2c')](db[_0x4b5e('0x40')][_0x4b5e('0x21')]);_0x3cefd8[_0x4b5e('0x26')]=_['keys'](_0x255978['query']);_0x3cefd8[_0x4b5e('0x2d')]=_['intersection'](_0x3cefd8[_0x4b5e('0x2b')],_0x3cefd8[_0x4b5e('0x26')]);_0x15e3d6[_0x4b5e('0x2f')]=_[_0x4b5e('0x2e')](_0x3cefd8['model'],qs[_0x4b5e('0x30')](_0x255978[_0x4b5e('0x26')][_0x4b5e('0x30')]));_0x15e3d6[_0x4b5e('0x2f')]=_0x15e3d6['attributes']['length']?_0x15e3d6[_0x4b5e('0x2f')]:_0x3cefd8[_0x4b5e('0x2b')];if(!_0x255978[_0x4b5e('0x26')][_0x4b5e('0x41')](_0x4b5e('0x42'))){_0x15e3d6[_0x4b5e('0x13')]=qs[_0x4b5e('0x13')](_0x255978[_0x4b5e('0x26')][_0x4b5e('0x13')]);_0x15e3d6[_0x4b5e('0x11')]=qs['offset'](_0x255978['query'][_0x4b5e('0x11')]);}_0x15e3d6[_0x4b5e('0x43')]=qs[_0x4b5e('0x44')](_0x255978['query'][_0x4b5e('0x44')]);_0x15e3d6[_0x4b5e('0x45')]=qs[_0x4b5e('0x2d')](_[_0x4b5e('0x46')](_0x255978[_0x4b5e('0x26')],_0x3cefd8[_0x4b5e('0x2d')]));_0x15e3d6[_0x4b5e('0x45')][_0x4b5e('0x47')]=_0x266638['id'];if(_0x255978[_0x4b5e('0x26')]['filter']){_0x15e3d6[_0x4b5e('0x45')]=_[_0x4b5e('0x48')](_0x15e3d6[_0x4b5e('0x45')],{'$or':_[_0x4b5e('0x20')](_0x15e3d6[_0x4b5e('0x2f')],function(_0x1d5dd7){var _0x4df3e7={};_0x4df3e7[_0x1d5dd7]={'$like':'%'+_0x255978['query']['filter']+'%'};return _0x4df3e7;})});}_0x15e3d6=_[_0x4b5e('0x48')]({},_0x15e3d6,_0x255978['options']);return db['UserMailQueue']['findAll'](_0x15e3d6);}})[_0x4b5e('0x18')](function(_0x49e5e8){if(_0x49e5e8){return db[_0x4b5e('0x49')][_0x4b5e('0x4a')]({'where':{'id':_[_0x4b5e('0x20')](_0x49e5e8,'UserId'),'role':_0x4b5e('0x4b')},'attributes':['id','name',_0x4b5e('0x4c'),_0x4b5e('0x4d'),_0x4b5e('0x4e')]});}})['then'](function(_0x228c3f){if(_0x228c3f){return{'count':_0x228c3f[_0x4b5e('0x14')],'rows':_['map'](_0x228c3f[_0x4b5e('0x4f')],function(_0x4e8d4c){return{'membername':_0x4e8d4c[_0x4b5e('0x1d')],'UserId':_0x4e8d4c['id'],'queue_name':_0x38cf89[_0x4b5e('0x1d')],'MailQueueId':_0x38cf89['id'],'interface':util[_0x4b5e('0x50')](_0x4b5e('0x51'),_0x4b5e('0x52'),_0x4e8d4c[_0x4b5e('0x1d')]),'penalty':0x0,'paused':_0x4e8d4c[_0x4b5e('0x4c')],'createdAt':_0x4e8d4c['createdAt'],'updatedAt':_0x4e8d4c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4b5e('0x18')](respondWithFilteredResult(_0x33d947,_0x15e3d6))[_0x4b5e('0x29')](handleError(_0x33d947,null));};exports[_0x4b5e('0x53')]=function(_0x108b4a,_0x22ae3e){var _0x2ae67f={};var _0x3f5b37={};var _0x32f25a;var _0xa0bc28;return db[_0x4b5e('0x27')]['findOne']({'where':{'id':_0x108b4a['params']['id']}})[_0x4b5e('0x18')](handleEntityNotFound(_0x22ae3e,null))['then'](function(_0x21c7bf){if(_0x21c7bf){_0x32f25a=_0x21c7bf;_0x3f5b37[_0x4b5e('0x2b')]=_[_0x4b5e('0x2c')](db[_0x4b5e('0x54')][_0x4b5e('0x21')]);_0x3f5b37['query']=_[_0x4b5e('0x2c')](_0x108b4a['query']);_0x3f5b37[_0x4b5e('0x2d')]=_[_0x4b5e('0x2e')](_0x3f5b37[_0x4b5e('0x2b')],_0x3f5b37[_0x4b5e('0x26')]);_0x2ae67f[_0x4b5e('0x2f')]=_[_0x4b5e('0x2e')](_0x3f5b37[_0x4b5e('0x2b')],qs['fields'](_0x108b4a[_0x4b5e('0x26')]['fields']));_0x2ae67f[_0x4b5e('0x2f')]=_0x2ae67f[_0x4b5e('0x2f')][_0x4b5e('0x31')]?_0x2ae67f[_0x4b5e('0x2f')]:_0x3f5b37[_0x4b5e('0x2b')];_0x2ae67f[_0x4b5e('0x43')]=qs[_0x4b5e('0x44')](_0x108b4a[_0x4b5e('0x26')]['sort']);_0x2ae67f['where']=qs[_0x4b5e('0x2d')](_[_0x4b5e('0x46')](_0x108b4a[_0x4b5e('0x26')],_0x3f5b37[_0x4b5e('0x2d')]));if(_0x108b4a['query'][_0x4b5e('0x55')]){_0x2ae67f[_0x4b5e('0x45')]=_[_0x4b5e('0x48')](_0x2ae67f[_0x4b5e('0x45')],{'$or':_['map'](_0x2ae67f[_0x4b5e('0x2f')],function(_0x1f50c2){var _0x4803df={};_0x4803df[_0x1f50c2]={'$like':'%'+_0x108b4a[_0x4b5e('0x26')][_0x4b5e('0x55')]+'%'};return _0x4803df;})});}_0x2ae67f=_[_0x4b5e('0x48')]({},_0x2ae67f,_0x108b4a[_0x4b5e('0x33')]);return _0x32f25a[_0x4b5e('0x53')](_0x2ae67f);}})[_0x4b5e('0x18')](function(_0x20cac6){if(_0x20cac6){_0xa0bc28=_0x20cac6[_0x4b5e('0x31')];if(!_0x108b4a[_0x4b5e('0x26')][_0x4b5e('0x41')](_0x4b5e('0x42'))){_0x2ae67f[_0x4b5e('0x13')]=qs['limit'](_0x108b4a['query'][_0x4b5e('0x13')]);_0x2ae67f['offset']=qs['offset'](_0x108b4a[_0x4b5e('0x26')][_0x4b5e('0x11')]);}return _0x32f25a['getTeams'](_0x2ae67f);}})[_0x4b5e('0x18')](function(_0x258ce7){if(_0x258ce7){return _0x258ce7?{'count':_0xa0bc28,'rows':_0x258ce7}:null;}})[_0x4b5e('0x18')](respondWithResult(_0x22ae3e,null))[_0x4b5e('0x29')](handleError(_0x22ae3e,null));};exports[_0x4b5e('0x56')]=function(_0x274913,_0x4c3b3a){var _0x293c4a=_0x274913[_0x4b5e('0x36')][_0x4b5e('0x57')];return db[_0x4b5e('0x54')]['findAll']({'where':{'id':_0x293c4a},'attributes':['id'],'include':[{'model':db[_0x4b5e('0x49')],'as':_0x4b5e('0x58'),'attributes':['id',_0x4b5e('0x1d'),'online',_0x4b5e('0x59'),_0x4b5e('0x5a')],'raw':!![]}]})[_0x4b5e('0x18')](function(_0x4af759){if(_0x4af759){var _0x2fb115=_[_0x4b5e('0x5b')](_0x4af759,function(_0x2f60ad){var _0x379f39=_0x2f60ad[_0x4b5e('0x1a')]({'plain':!![]});return _0x379f39['Agents'];});return db[_0x4b5e('0x27')][_0x4b5e('0x34')]({'where':{'id':_0x274913[_0x4b5e('0x2a')]['id']}})[_0x4b5e('0x18')](function(_0x4a9d1b){return db[_0x4b5e('0x5c')][_0x4b5e('0x5d')](function(_0x23bf76){return _0x4a9d1b[_0x4b5e('0x56')](_0x293c4a,{'transaction':_0x23bf76})[_0x4b5e('0x18')](function(){return BPromise[_0x4b5e('0x5e')](_0x2fb115,function(_0x470d21){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x470d21['id'],'MailQueueId':_0x274913[_0x4b5e('0x2a')]['id']},'transaction':_0x23bf76});});})[_0x4b5e('0x18')](function(){_0x2fb115[_0x4b5e('0x5f')](function(_0x45da2){socket[_0x4b5e('0x60')](_0x4b5e('0x61'),{'UserId':_0x45da2['id'],'MailQueueId':_0x4a9d1b['id']});});});});});}})[_0x4b5e('0x18')](respondWithStatusCode(_0x4c3b3a,null))[_0x4b5e('0x29')](handleError(_0x4c3b3a,null));};exports[_0x4b5e('0x62')]=function(_0x25a00f,_0x1ced22){return db['Team'][_0x4b5e('0x28')]({'where':{'id':_0x25a00f[_0x4b5e('0x26')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1ced22,null))[_0x4b5e('0x18')](function(_0x2eb879){var _0x49e036=_[_0x4b5e('0x20')](_0x2eb879,'id');var _0x583467=[];var _0x5b16ad=[];var _0x4d3e27=squel[_0x4b5e('0x63')]();_0x4d3e27[_0x4b5e('0x64')](_0x4b5e('0x65'))['from'](_0x4b5e('0x66'),'tq')[_0x4b5e('0x67')](_0x4b5e('0x68'),'ut',_0x4b5e('0x69'))[_0x4b5e('0x45')](_0x4b5e('0x6a'),_0x25a00f[_0x4b5e('0x2a')]['id']);for(var _0x6ac0f3=0x0;_0x6ac0f3<_0x2eb879['length'];_0x6ac0f3+=0x1){let _0x957d4=_0x2eb879[_0x6ac0f3];for(var _0x1a40be=0x0;_0x1a40be<_0x957d4[_0x4b5e('0x58')][_0x4b5e('0x31')];_0x1a40be+=0x1){let _0x2d1acb=_0x957d4['Agents'][_0x1a40be];var _0xc8da7a=_0x4d3e27[_0x4b5e('0x6b')]();_0xc8da7a['where'](_0x4b5e('0x6c'),_0x2d1acb['id']);_0x5b16ad[_0x4b5e('0x6d')](db['sequelize'][_0x4b5e('0x26')](_0xc8da7a[_0x4b5e('0x6e')](),{'type':db[_0x4b5e('0x5c')][_0x4b5e('0x6f')]['SELECT']})[_0x4b5e('0x18')](function(_0x332279){if(_0x332279['length']===0x1){return _0x2d1acb['id'];}else{var _0x403bbf=_[_0x4b5e('0x70')](_['map'](_0x332279,_0x4b5e('0x71')),function(_0x5489a4){return _[_0x4b5e('0x72')](_0x49e036,_0x5489a4);});if(_0x403bbf){return _0x2d1acb['id'];}}}));}}return BPromise[_0x4b5e('0x73')](_0x5b16ad)[_0x4b5e('0x18')](function(_0x58ad7e){_0x583467=_(_0x583467)[_0x4b5e('0x74')](_0x58ad7e)['compact']()['value']();return db['MailQueue']['find']({'where':{'id':_0x25a00f[_0x4b5e('0x2a')]['id']}})[_0x4b5e('0x18')](function(_0x38618e){return db[_0x4b5e('0x5c')][_0x4b5e('0x5d')](function(_0x4842c1){return _0x38618e[_0x4b5e('0x62')](_0x25a00f[_0x4b5e('0x26')]['ids'],{'transaction':_0x4842c1})[_0x4b5e('0x18')](function(){if(!_['isEmpty'](_0x583467)){return _0x38618e[_0x4b5e('0x75')](_0x583467,{'transaction':_0x4842c1});}})[_0x4b5e('0x18')](function(){_0x583467['forEach'](function(_0x306bb7){socket['emit'](_0x4b5e('0x76'),{'UserId':_0x306bb7,'MailQueueId':_0x38618e['id']});});});});});});})[_0x4b5e('0x18')](respondWithStatusCode(_0x1ced22,null))[_0x4b5e('0x29')](handleError(_0x1ced22,null));};exports[_0x4b5e('0x77')]=function(_0x5808b8,_0x555821){return db['MailQueue'][_0x4b5e('0x34')]({'where':{'id':_0x5808b8[_0x4b5e('0x2a')]['id']}})[_0x4b5e('0x18')](handleEntityNotFound(_0x555821,null))['then'](function(_0xc9c137){if(_0xc9c137){return _0xc9c137['addAgents'](_0x5808b8[_0x4b5e('0x36')][_0x4b5e('0x57')],_[_0x4b5e('0x78')](_0x5808b8[_0x4b5e('0x36')],[_0x4b5e('0x57'),'id'])||{})[_0x4b5e('0x79')](function(_0x357ad6){for(var _0x153961=0x0;_0x153961<_0x5808b8['body'][_0x4b5e('0x57')][_0x4b5e('0x31')];_0x153961+=0x1){socket[_0x4b5e('0x60')]('userMailQueue:save',{'UserId':Number(_0x5808b8[_0x4b5e('0x36')]['ids'][_0x153961]),'MailQueueId':Number(_0x5808b8[_0x4b5e('0x2a')]['id'])});}return _0x357ad6;});}})[_0x4b5e('0x18')](respondWithResult(_0x555821,null))[_0x4b5e('0x29')](handleError(_0x555821,null));};exports[_0x4b5e('0x75')]=function(_0x56163f,_0x1193e7){return db['MailQueue']['find']({'where':{'id':_0x56163f['params']['id']}})['then'](handleEntityNotFound(_0x1193e7,null))[_0x4b5e('0x18')](function(_0x54ef31){if(_0x54ef31){return _0x54ef31[_0x4b5e('0x75')](_0x56163f[_0x4b5e('0x26')][_0x4b5e('0x57')])[_0x4b5e('0x18')](function(){if(_[_0x4b5e('0x7a')](_0x56163f['query'][_0x4b5e('0x57')])){for(var _0x1d1ddf=0x0;_0x1d1ddf<_0x56163f[_0x4b5e('0x26')][_0x4b5e('0x57')][_0x4b5e('0x31')];_0x1d1ddf+=0x1){socket['emit'](_0x4b5e('0x76'),{'UserId':Number(_0x56163f[_0x4b5e('0x26')][_0x4b5e('0x57')][_0x1d1ddf]),'MailQueueId':Number(_0x56163f[_0x4b5e('0x2a')]['id'])});}}else{socket['emit'](_0x4b5e('0x76'),{'UserId':Number(_0x56163f['query'][_0x4b5e('0x57')]),'MailQueueId':Number(_0x56163f[_0x4b5e('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x1193e7,null))[_0x4b5e('0x29')](handleError(_0x1193e7,null));};exports[_0x4b5e('0x7b')]=function(_0x9f9cfb,_0x3757b4){var _0x2da512={};var _0x33d72c={};var _0x5b5df7;var _0xf1cfe7;return db[_0x4b5e('0x27')]['findOne']({'where':{'id':_0x9f9cfb[_0x4b5e('0x2a')]['id']}})[_0x4b5e('0x18')](handleEntityNotFound(_0x3757b4,null))['then'](function(_0x511f4d){if(_0x511f4d){_0x5b5df7=_0x511f4d;_0x33d72c['model']=_['keys'](db[_0x4b5e('0x49')][_0x4b5e('0x21')]);_0x33d72c[_0x4b5e('0x26')]=_['keys'](_0x9f9cfb['query']);_0x33d72c['filters']=_[_0x4b5e('0x2e')](_0x33d72c[_0x4b5e('0x2b')],_0x33d72c[_0x4b5e('0x26')]);_0x2da512[_0x4b5e('0x2f')]=_['intersection'](_0x33d72c[_0x4b5e('0x2b')],qs[_0x4b5e('0x30')](_0x9f9cfb[_0x4b5e('0x26')][_0x4b5e('0x30')]));_0x2da512[_0x4b5e('0x2f')]=_0x2da512[_0x4b5e('0x2f')][_0x4b5e('0x31')]?_0x2da512[_0x4b5e('0x2f')]:_0x33d72c[_0x4b5e('0x2b')];_0x2da512['order']=qs['sort'](_0x9f9cfb[_0x4b5e('0x26')][_0x4b5e('0x44')]);_0x2da512[_0x4b5e('0x45')]=qs[_0x4b5e('0x2d')](_[_0x4b5e('0x46')](_0x9f9cfb[_0x4b5e('0x26')],_0x33d72c[_0x4b5e('0x2d')]));if(_0x9f9cfb[_0x4b5e('0x26')][_0x4b5e('0x55')]){_0x2da512[_0x4b5e('0x45')]=_['merge'](_0x2da512[_0x4b5e('0x45')],{'$or':_[_0x4b5e('0x20')](_0x2da512[_0x4b5e('0x2f')],function(_0x5825b6){var _0x56646b={};_0x56646b[_0x5825b6]={'$like':'%'+_0x9f9cfb['query'][_0x4b5e('0x55')]+'%'};return _0x56646b;})});}_0x2da512=_['merge']({},_0x2da512,_0x9f9cfb[_0x4b5e('0x33')]);return _0x5b5df7[_0x4b5e('0x7b')](_0x2da512);}})[_0x4b5e('0x18')](function(_0x1b94d2){if(_0x1b94d2){_0xf1cfe7=_0x1b94d2[_0x4b5e('0x31')];if(!_0x9f9cfb[_0x4b5e('0x26')]['hasOwnProperty']('nolimit')){_0x2da512[_0x4b5e('0x13')]=qs[_0x4b5e('0x13')](_0x9f9cfb[_0x4b5e('0x26')][_0x4b5e('0x13')]);_0x2da512[_0x4b5e('0x11')]=qs[_0x4b5e('0x11')](_0x9f9cfb['query']['offset']);}return _0x5b5df7[_0x4b5e('0x7b')](_0x2da512);}})[_0x4b5e('0x18')](function(_0x178d9f){if(_0x178d9f){return _0x178d9f?{'count':_0xf1cfe7,'rows':_0x178d9f}:null;}})[_0x4b5e('0x18')](respondWithResult(_0x3757b4,null))[_0x4b5e('0x29')](handleError(_0x3757b4,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 114bcea..c6c50b0 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 _0x8c05=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x164595,_0x1c5e47){var _0x4ef91a=function(_0xe5f2af){while(--_0xe5f2af){_0x164595['push'](_0x164595['shift']());}};_0x4ef91a(++_0x1c5e47);}(_0x8c05,0x141));var _0x58c0=function(_0x3c96b6,_0xf57a10){_0x3c96b6=_0x3c96b6-0x0;var _0xfaa232=_0x8c05[_0x3c96b6];return _0xfaa232;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x58c0('0x0'))['db'][_0x58c0('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x58c0('0x2')](0x0);var events={'afterCreate':_0x58c0('0x3'),'afterUpdate':_0x58c0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e8330){return function(_0x527b5d,_0x507db6,_0x3dad25){MailQueueEvents[_0x58c0('0x5')](_0x3e8330+':'+_0x527b5d['id'],_0x527b5d);MailQueueEvents[_0x58c0('0x5')](_0x3e8330,_0x527b5d);_0x3dad25(null);};}for(var e in events){if(events[_0x58c0('0x6')](e)){var event=events[e];MailQueue[_0x58c0('0x7')](e,emitEvent(event));}}module[_0x58c0('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x3d2a=['hook','exports','events','save','update','remove','emit','hasOwnProperty'];(function(_0x1bee5e,_0x841de6){var _0x1955cd=function(_0x292282){while(--_0x292282){_0x1bee5e['push'](_0x1bee5e['shift']());}};_0x1955cd(++_0x841de6);}(_0x3d2a,0x11a));var _0xa3d2=function(_0x1937c8,_0x5a1f28){_0x1937c8=_0x1937c8-0x0;var _0x48bedf=_0x3d2a[_0x1937c8];return _0x48bedf;};'use strict';var EventEmitter=require(_0xa3d2('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa3d2('0x1'),'afterUpdate':_0xa3d2('0x2'),'afterDestroy':_0xa3d2('0x3')};function emitEvent(_0x2f5c02){return function(_0x190819,_0x209820,_0x4852ea){MailQueueEvents[_0xa3d2('0x4')](_0x2f5c02+':'+_0x190819['id'],_0x190819);MailQueueEvents[_0xa3d2('0x4')](_0x2f5c02,_0x190819);_0x4852ea(null);};}for(var e in events){if(events[_0xa3d2('0x5')](e)){var event=events[e];MailQueue[_0xa3d2('0x6')](e,emitEvent(event));}}module[_0xa3d2('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 8abfd57..b9932e1 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 _0xaa6d=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue'];(function(_0x39bdfd,_0x529f3b){var _0x4b0c42=function(_0x4a070c){while(--_0x4a070c){_0x39bdfd['push'](_0x39bdfd['shift']());}};_0x4b0c42(++_0x529f3b);}(_0xaa6d,0xdc));var _0xdaa6=function(_0x44d01f,_0x170753){_0x44d01f=_0x44d01f-0x0;var _0x1232b6=_0xaa6d[_0x44d01f];return _0x1232b6;};'use strict';var _=require(_0xdaa6('0x0'));var util=require(_0xdaa6('0x1'));var logger=require(_0xdaa6('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdaa6('0x3'));var rp=require(_0xdaa6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaa6('0x5'));var config=require(_0xdaa6('0x6'));var attributes=require(_0xdaa6('0x7'));module[_0xdaa6('0x8')]=function(_0x36686c,_0x804b16){return _0x36686c[_0xdaa6('0x9')](_0xdaa6('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x106c=['MailQueue','mail_queues','util','../../config/logger','api','moment','../../config/environment','./mailQueue.attributes','exports'];(function(_0x3e52dc,_0x24306f){var _0x6061fa=function(_0x2ce6d9){while(--_0x2ce6d9){_0x3e52dc['push'](_0x3e52dc['shift']());}};_0x6061fa(++_0x24306f);}(_0x106c,0x1d6));var _0xc106=function(_0x50b433,_0x45a76a){_0x50b433=_0x50b433-0x0;var _0x569230=_0x106c[_0x50b433];return _0x569230;};'use strict';var _=require('lodash');var util=require(_0xc106('0x0'));var logger=require(_0xc106('0x1'))(_0xc106('0x2'));var moment=require(_0xc106('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc106('0x4'));var attributes=require(_0xc106('0x5'));module[_0xc106('0x6')]=function(_0x1f1c41,_0x2bc799){return _0x1f1c41['define'](_0xc106('0x7'),attributes,{'tableName':_0xc106('0x8'),'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 f3024ff..c0f2337 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 _0x8f99=['findAll','options','where','include','attributes','map','ShowMailQueue','find','raw','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0x8f99,0x184));var _0x98f9=function(_0x571513,_0x11e020){_0x571513=_0x571513-0x0;var _0x277712=_0x8f99[_0x571513];return _0x277712;};'use strict';var _=require('lodash');var util=require(_0x98f9('0x0'));var moment=require(_0x98f9('0x1'));var BPromise=require(_0x98f9('0x2'));var rs=require(_0x98f9('0x3'));var fs=require('fs');var Redis=require(_0x98f9('0x4'));var db=require(_0x98f9('0x5'))['db'];var utils=require(_0x98f9('0x6'));var logger=require(_0x98f9('0x7'))('rpc');var config=require(_0x98f9('0x8'));var jayson=require(_0x98f9('0x9'));var client=jayson[_0x98f9('0xa')][_0x98f9('0xb')]({'port':0x232a});config[_0x98f9('0xc')]=_['defaults'](config[_0x98f9('0xc')],{'host':_0x98f9('0xd'),'port':0x18eb});var socket=require(_0x98f9('0xe'))(new Redis(config[_0x98f9('0xc')]));require(_0x98f9('0xf'))[_0x98f9('0x10')](socket);function respondWithRpcPromise(_0xc8a471,_0x5a48c4,_0x3c67ca){return new BPromise(function(_0x413ac9,_0x1f80c6){return client[_0x98f9('0x11')](_0xc8a471,_0x3c67ca)[_0x98f9('0x12')](function(_0xa11eef){logger[_0x98f9('0x13')](_0x98f9('0x14'),_0x5a48c4,_0x98f9('0x15'));logger[_0x98f9('0x16')](_0x98f9('0x17'),_0x5a48c4,_0x98f9('0x15'),JSON[_0x98f9('0x18')](_0xa11eef));if(_0xa11eef[_0x98f9('0x19')]){if(_0xa11eef[_0x98f9('0x19')][_0x98f9('0x1a')]===0x1f4){logger[_0x98f9('0x19')]('MailQueue,\x20%s,\x20%s',_0x5a48c4,_0xa11eef[_0x98f9('0x19')]['message']);return _0x1f80c6(_0xa11eef['error'][_0x98f9('0x1b')]);}logger[_0x98f9('0x19')](_0x98f9('0x14'),_0x5a48c4,_0xa11eef[_0x98f9('0x19')]['message']);return _0x413ac9(_0xa11eef[_0x98f9('0x19')]['message']);}else{logger['info'](_0x98f9('0x14'),_0x5a48c4,_0x98f9('0x15'));_0x413ac9(_0xa11eef[_0x98f9('0x1c')]['message']);}})[_0x98f9('0x1d')](function(_0x32b7f9){logger[_0x98f9('0x19')](_0x98f9('0x14'),_0x5a48c4,_0x32b7f9);_0x1f80c6(_0x32b7f9);});});}exports[_0x98f9('0x1e')]=function(_0x3dd921){var _0x1c0cfc=this;return new Promise(function(_0x27d550,_0x53d012){return db[_0x98f9('0x1f')][_0x98f9('0x20')]({'raw':_0x3dd921[_0x98f9('0x21')]?_0x3dd921[_0x98f9('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x3dd921[_0x98f9('0x21')]?_0x3dd921[_0x98f9('0x21')][_0x98f9('0x22')]||null:null,'attributes':_0x3dd921[_0x98f9('0x21')]?_0x3dd921[_0x98f9('0x21')]['attributes']||null:null,'limit':_0x3dd921[_0x98f9('0x21')]?_0x3dd921[_0x98f9('0x21')]['limit']||null:null,'include':_0x3dd921[_0x98f9('0x21')]?_0x3dd921[_0x98f9('0x21')][_0x98f9('0x23')]?_['map'](_0x3dd921['options'][_0x98f9('0x23')],function(_0x13612d){return{'model':db[_0x13612d['model']],'as':_0x13612d['as'],'attributes':_0x13612d[_0x98f9('0x24')],'include':_0x13612d[_0x98f9('0x23')]?_[_0x98f9('0x25')](_0x13612d[_0x98f9('0x23')],function(_0x7b4c35){return{'model':db[_0x7b4c35['model']],'as':_0x7b4c35['as'],'attributes':_0x7b4c35['attributes'],'include':_0x7b4c35[_0x98f9('0x23')]?_[_0x98f9('0x25')](_0x7b4c35[_0x98f9('0x23')],function(_0xc3a856){return{'model':db[_0xc3a856['model']],'as':_0xc3a856['as'],'attributes':_0xc3a856[_0x98f9('0x24')]};}):[]};}):[]};}):[]:[]})[_0x98f9('0x12')](function(_0x2e9100){logger[_0x98f9('0x13')](_0x98f9('0x1e'),_0x3dd921);logger['debug'](_0x98f9('0x1e'),_0x3dd921,JSON['stringify'](_0x2e9100));_0x27d550(_0x2e9100);})[_0x98f9('0x1d')](function(_0x233140){logger['error'](_0x98f9('0x1e'),_0x233140[_0x98f9('0x1b')],_0x3dd921);_0x53d012(_0x1c0cfc[_0x98f9('0x19')](0x1f4,_0x233140['message']));});});};exports[_0x98f9('0x26')]=function(_0x107156){var _0x56ffcb=this;return new Promise(function(_0x2af9e4,_0x55b470){return db[_0x98f9('0x1f')][_0x98f9('0x27')]({'raw':_0x107156[_0x98f9('0x21')]?_0x107156[_0x98f9('0x21')][_0x98f9('0x28')]===undefined?!![]:![]:!![],'where':_0x107156[_0x98f9('0x21')]?_0x107156[_0x98f9('0x21')]['where']||null:null,'attributes':_0x107156[_0x98f9('0x21')]?_0x107156[_0x98f9('0x21')][_0x98f9('0x24')]||null:null,'include':_0x107156[_0x98f9('0x21')]?_0x107156[_0x98f9('0x21')][_0x98f9('0x23')]?_[_0x98f9('0x25')](_0x107156[_0x98f9('0x21')][_0x98f9('0x23')],function(_0x262e1d){return{'model':db[_0x262e1d[_0x98f9('0x29')]],'as':_0x262e1d['as'],'attributes':_0x262e1d[_0x98f9('0x24')],'include':_0x262e1d['include']?_[_0x98f9('0x25')](_0x262e1d[_0x98f9('0x23')],function(_0x1806d1){return{'model':db[_0x1806d1[_0x98f9('0x29')]],'as':_0x1806d1['as'],'attributes':_0x1806d1[_0x98f9('0x24')],'include':_0x1806d1[_0x98f9('0x23')]?_[_0x98f9('0x25')](_0x1806d1['include'],function(_0x473712){return{'model':db[_0x473712[_0x98f9('0x29')]],'as':_0x473712['as'],'attributes':_0x473712[_0x98f9('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb707dd){logger[_0x98f9('0x13')]('ShowMailQueue',_0x107156);logger[_0x98f9('0x16')](_0x98f9('0x26'),_0x107156,JSON['stringify'](_0xb707dd));_0x2af9e4(_0xb707dd);})['catch'](function(_0x1c6cfd){logger['error'](_0x98f9('0x26'),_0x1c6cfd['message'],_0x107156);_0x55b470(_0x56ffcb['error'](0x1f4,_0x1c6cfd[_0x98f9('0x1b')]));});});}; \ No newline at end of file +var _0x1374=['debug','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','result','catch','MailQueue','findAll','options','where','attributes','limit','map','model','include','GetMailQueue','ShowMailQueue','find','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request\x20sent'];(function(_0x7e5fed,_0x2d0a98){var _0x294bc7=function(_0x12d1d0){while(--_0x12d1d0){_0x7e5fed['push'](_0x7e5fed['shift']());}};_0x294bc7(++_0x2d0a98);}(_0x1374,0xba));var _0x4137=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x1374[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x4137('0x0'));var util=require(_0x4137('0x1'));var moment=require(_0x4137('0x2'));var BPromise=require(_0x4137('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4137('0x4'));var db=require(_0x4137('0x5'))['db'];var utils=require(_0x4137('0x6'));var logger=require(_0x4137('0x7'))(_0x4137('0x8'));var config=require(_0x4137('0x9'));var jayson=require(_0x4137('0xa'));var client=jayson['client'][_0x4137('0xb')]({'port':0x232a});config[_0x4137('0xc')]=_[_0x4137('0xd')](config[_0x4137('0xc')],{'host':_0x4137('0xe'),'port':0x18eb});var socket=require(_0x4137('0xf'))(new Redis(config[_0x4137('0xc')]));require(_0x4137('0x10'))[_0x4137('0x11')](socket);function respondWithRpcPromise(_0x1b15ad,_0x868b54,_0x7d0fb9){return new BPromise(function(_0x40cfb3,_0x92bb79){return client['request'](_0x1b15ad,_0x7d0fb9)['then'](function(_0x1bf914){logger['info']('MailQueue,\x20%s,\x20%s',_0x868b54,_0x4137('0x12'));logger[_0x4137('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x868b54,'request\x20sent',JSON[_0x4137('0x14')](_0x1bf914));if(_0x1bf914[_0x4137('0x15')]){if(_0x1bf914[_0x4137('0x15')][_0x4137('0x16')]===0x1f4){logger[_0x4137('0x15')](_0x4137('0x17'),_0x868b54,_0x1bf914['error'][_0x4137('0x18')]);return _0x92bb79(_0x1bf914[_0x4137('0x15')][_0x4137('0x18')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x868b54,_0x1bf914[_0x4137('0x15')]['message']);return _0x40cfb3(_0x1bf914['error']['message']);}else{logger[_0x4137('0x19')]('MailQueue,\x20%s,\x20%s',_0x868b54,_0x4137('0x12'));_0x40cfb3(_0x1bf914[_0x4137('0x1a')]['message']);}})[_0x4137('0x1b')](function(_0x4d8ffa){logger[_0x4137('0x15')](_0x4137('0x17'),_0x868b54,_0x4d8ffa);_0x92bb79(_0x4d8ffa);});});}exports['GetMailQueue']=function(_0x1b9390){var _0x25bca0=this;return new Promise(function(_0xd368f,_0x27ac3c){return db[_0x4137('0x1c')][_0x4137('0x1d')]({'raw':_0x1b9390['options']?_0x1b9390[_0x4137('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1b9390[_0x4137('0x1e')]?_0x1b9390[_0x4137('0x1e')][_0x4137('0x1f')]||null:null,'attributes':_0x1b9390[_0x4137('0x1e')]?_0x1b9390['options'][_0x4137('0x20')]||null:null,'limit':_0x1b9390[_0x4137('0x1e')]?_0x1b9390['options'][_0x4137('0x21')]||null:null,'include':_0x1b9390['options']?_0x1b9390[_0x4137('0x1e')]['include']?_[_0x4137('0x22')](_0x1b9390[_0x4137('0x1e')]['include'],function(_0x211ce6){return{'model':db[_0x211ce6[_0x4137('0x23')]],'as':_0x211ce6['as'],'attributes':_0x211ce6[_0x4137('0x20')],'include':_0x211ce6[_0x4137('0x24')]?_[_0x4137('0x22')](_0x211ce6[_0x4137('0x24')],function(_0x91e970){return{'model':db[_0x91e970[_0x4137('0x23')]],'as':_0x91e970['as'],'attributes':_0x91e970[_0x4137('0x20')],'include':_0x91e970[_0x4137('0x24')]?_[_0x4137('0x22')](_0x91e970[_0x4137('0x24')],function(_0x20a8bc){return{'model':db[_0x20a8bc[_0x4137('0x23')]],'as':_0x20a8bc['as'],'attributes':_0x20a8bc[_0x4137('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31e490){logger[_0x4137('0x19')]('GetMailQueue',_0x1b9390);logger[_0x4137('0x13')](_0x4137('0x25'),_0x1b9390,JSON[_0x4137('0x14')](_0x31e490));_0xd368f(_0x31e490);})[_0x4137('0x1b')](function(_0x1a711e){logger[_0x4137('0x15')](_0x4137('0x25'),_0x1a711e[_0x4137('0x18')],_0x1b9390);_0x27ac3c(_0x25bca0['error'](0x1f4,_0x1a711e[_0x4137('0x18')]));});});};exports[_0x4137('0x26')]=function(_0xa3fdb3){var _0x2e785b=this;return new Promise(function(_0x597194,_0x1be3c4){return db[_0x4137('0x1c')][_0x4137('0x27')]({'raw':_0xa3fdb3[_0x4137('0x1e')]?_0xa3fdb3[_0x4137('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xa3fdb3[_0x4137('0x1e')]?_0xa3fdb3[_0x4137('0x1e')]['where']||null:null,'attributes':_0xa3fdb3['options']?_0xa3fdb3[_0x4137('0x1e')][_0x4137('0x20')]||null:null,'include':_0xa3fdb3[_0x4137('0x1e')]?_0xa3fdb3[_0x4137('0x1e')][_0x4137('0x24')]?_['map'](_0xa3fdb3[_0x4137('0x1e')][_0x4137('0x24')],function(_0x401e89){return{'model':db[_0x401e89[_0x4137('0x23')]],'as':_0x401e89['as'],'attributes':_0x401e89[_0x4137('0x20')],'include':_0x401e89['include']?_[_0x4137('0x22')](_0x401e89[_0x4137('0x24')],function(_0x452dbe){return{'model':db[_0x452dbe['model']],'as':_0x452dbe['as'],'attributes':_0x452dbe['attributes'],'include':_0x452dbe[_0x4137('0x24')]?_[_0x4137('0x22')](_0x452dbe['include'],function(_0xc8e72){return{'model':db[_0xc8e72[_0x4137('0x23')]],'as':_0xc8e72['as'],'attributes':_0xc8e72[_0x4137('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4137('0x28')](function(_0x5afc9e){logger[_0x4137('0x19')]('ShowMailQueue',_0xa3fdb3);logger[_0x4137('0x13')](_0x4137('0x26'),_0xa3fdb3,JSON[_0x4137('0x14')](_0x5afc9e));_0x597194(_0x5afc9e);})['catch'](function(_0x571ac1){logger['error']('ShowMailQueue',_0x571ac1[_0x4137('0x18')],_0xa3fdb3);_0x1be3c4(_0x2e785b[_0x4137('0x15')](0x1f4,_0x571ac1[_0x4137('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 51b6b6d..4610451 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 _0x15e8=['removeListener','mailQueue:','save','update','emit'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x15e8,0x13d));var _0x815e=function(_0x514a77,_0x2c8e51){_0x514a77=_0x514a77-0x0;var _0x3c7f46=_0x15e8[_0x514a77];return _0x3c7f46;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x815e('0x0'),'remove',_0x815e('0x1')];function createListener(_0x7b9f93,_0x3fabf8){return function(_0x1bac02){_0x3fabf8[_0x815e('0x2')](_0x7b9f93,_0x1bac02);};}function removeListener(_0x20bbe6,_0x2dc9cb){return function(){MailQueueEvents[_0x815e('0x3')](_0x20bbe6,_0x2dc9cb);};}exports['register']=function(_0x4147f2){for(var _0xa7cf7d=0x0,_0xcbfe4e=events['length'];_0xa7cf7d<_0xcbfe4e;_0xa7cf7d++){var _0x2563c4=events[_0xa7cf7d];var _0x5798b1=createListener(_0x815e('0x4')+_0x2563c4,_0x4147f2);MailQueueEvents['on'](_0x2563c4,_0x5798b1);}}; \ No newline at end of file +var _0x4b1b=['remove','update','emit','length','mailQueue:','./mailQueue.events','save'];(function(_0x108ecc,_0x4a8994){var _0x30e54e=function(_0x2d2612){while(--_0x2d2612){_0x108ecc['push'](_0x108ecc['shift']());}};_0x30e54e(++_0x4a8994);}(_0x4b1b,0x17f));var _0xb4b1=function(_0xe99116,_0x2d6f73){_0xe99116=_0xe99116-0x0;var _0x184b95=_0x4b1b[_0xe99116];return _0x184b95;};'use strict';var MailQueueEvents=require(_0xb4b1('0x0'));var events=[_0xb4b1('0x1'),_0xb4b1('0x2'),_0xb4b1('0x3')];function createListener(_0x3710bb,_0x14d327){return function(_0x198c8c){_0x14d327[_0xb4b1('0x4')](_0x3710bb,_0x198c8c);};}function removeListener(_0x88fd21,_0x5a1435){return function(){MailQueueEvents['removeListener'](_0x88fd21,_0x5a1435);};}exports['register']=function(_0x49ddcd){for(var _0x2b28b4=0x0,_0x7d6283=events[_0xb4b1('0x5')];_0x2b28b4<_0x7d6283;_0x2b28b4++){var _0xfeb13a=events[_0x2b28b4];var _0x2903d3=createListener(_0xb4b1('0x6')+_0xfeb13a,_0x49ddcd);MailQueueEvents['on'](_0xfeb13a,_0x2903d3);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 4987089..0e5ebab 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 _0x55c8=['post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x55c8,0x7d));var _0x855c=function(_0x5704f0,_0x40fce3){_0x5704f0=_0x5704f0-0x0;var _0x22fade=_0x55c8[_0x5704f0];return _0x22fade;};'use strict';var multer=require('multer');var util=require(_0x855c('0x0'));var path=require(_0x855c('0x1'));var timeout=require(_0x855c('0x2'));var express=require(_0x855c('0x3'));var router=express[_0x855c('0x4')]();var fs_extra=require(_0x855c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x855c('0x6'));var config=require('../../config/environment');var controller=require(_0x855c('0x7'));router[_0x855c('0x8')]('/',auth[_0x855c('0x9')](),controller[_0x855c('0xa')]);router[_0x855c('0x8')](_0x855c('0xb'),auth['isAuthenticated'](),controller[_0x855c('0xc')]);router[_0x855c('0x8')](_0x855c('0xd'),auth[_0x855c('0x9')](),controller[_0x855c('0xe')]);router[_0x855c('0xf')]('/',auth[_0x855c('0x9')](),controller['create']);router['put'](_0x855c('0xd'),auth[_0x855c('0x9')](),controller[_0x855c('0x10')]);router[_0x855c('0x11')](_0x855c('0xd'),auth[_0x855c('0x9')](),controller[_0x855c('0x12')]);module[_0x855c('0x13')]=router; \ No newline at end of file +var _0xc687=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','index','get','isAuthenticated','describe','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1a7118,_0xf21148){var _0xf8eff4=function(_0x21d3d8){while(--_0x21d3d8){_0x1a7118['push'](_0x1a7118['shift']());}};_0xf8eff4(++_0xf21148);}(_0xc687,0x1b2));var _0x7c68=function(_0x3f10d0,_0x2f7826){_0x3f10d0=_0x3f10d0-0x0;var _0x2bbcb1=_0xc687[_0x3f10d0];return _0x2bbcb1;};'use strict';var multer=require(_0x7c68('0x0'));var util=require(_0x7c68('0x1'));var path=require(_0x7c68('0x2'));var timeout=require(_0x7c68('0x3'));var express=require(_0x7c68('0x4'));var router=express[_0x7c68('0x5')]();var fs_extra=require(_0x7c68('0x6'));var auth=require(_0x7c68('0x7'));var interaction=require(_0x7c68('0x8'));var config=require(_0x7c68('0x9'));var controller=require(_0x7c68('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x7c68('0xb')]);router[_0x7c68('0xc')]('/describe',auth[_0x7c68('0xd')](),controller[_0x7c68('0xe')]);router[_0x7c68('0xc')]('/:id',auth[_0x7c68('0xd')](),controller['show']);router['post']('/',auth[_0x7c68('0xd')](),controller[_0x7c68('0xf')]);router['put'](_0x7c68('0x10'),auth[_0x7c68('0xd')](),controller[_0x7c68('0x11')]);router['delete'](_0x7c68('0x10'),auth[_0x7c68('0xd')](),controller[_0x7c68('0x12')]);module[_0x7c68('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 cd3e71b..b7278b0 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 _0x22f3=['moment','sequelize','exports','STRING','DATE'];(function(_0x121b1a,_0x42fdb7){var _0x2d89a6=function(_0x1b6027){while(--_0x1b6027){_0x121b1a['push'](_0x121b1a['shift']());}};_0x2d89a6(++_0x42fdb7);}(_0x22f3,0x73));var _0x322f=function(_0x36c0bc,_0x599030){_0x36c0bc=_0x36c0bc-0x0;var _0x44f6c8=_0x22f3[_0x36c0bc];return _0x44f6c8;};'use strict';var moment=require(_0x322f('0x0'));var Sequelize=require(_0x322f('0x1'));module[_0x322f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x322f('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x322f('0x4')]},'acceptAt':{'type':Sequelize[_0x322f('0x4')]},'exitAt':{'type':Sequelize[_0x322f('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd9e5=['exports','STRING','DATE','moment','sequelize'];(function(_0x7f14eb,_0x293155){var _0x554bff=function(_0x43ed25){while(--_0x43ed25){_0x7f14eb['push'](_0x7f14eb['shift']());}};_0x554bff(++_0x293155);}(_0xd9e5,0x19d));var _0x5d9e=function(_0x51b94b,_0x38fa2e){_0x51b94b=_0x51b94b-0x0;var _0x1900b5=_0xd9e5[_0x51b94b];return _0x1900b5;};'use strict';var moment=require(_0x5d9e('0x0'));var Sequelize=require(_0x5d9e('0x1'));module[_0x5d9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5d9e('0x3')]},'joinAt':{'type':Sequelize[_0x5d9e('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5d9e('0x4')]},'exitAt':{'type':Sequelize[_0x5d9e('0x4')]},'reason':{'type':Sequelize[_0x5d9e('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index f720a78..98774fb 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 _0x627e=['limit','count','set','reject','save','then','destroy','error','stack','name','index','MailQueueReport','fieldName','key','map','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','rows','catch','params','fields','length','includeAll','include','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','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(_0x3a236f,_0x28488e){var _0x5bf8c2=function(_0xa02005){while(--_0xa02005){_0x3a236f['push'](_0x3a236f['shift']());}};_0x5bf8c2(++_0x28488e);}(_0x627e,0x14a));var _0xe627=function(_0x292bec,_0x29ec50){_0x292bec=_0x292bec-0x0;var _0x231869=_0x627e[_0x292bec];return _0x231869;};'use strict';var emlformat=require(_0xe627('0x0'));var rimraf=require(_0xe627('0x1'));var zipdir=require(_0xe627('0x2'));var jsonpatch=require(_0xe627('0x3'));var rp=require(_0xe627('0x4'));var moment=require('moment');var BPromise=require(_0xe627('0x5'));var Mustache=require(_0xe627('0x6'));var util=require(_0xe627('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe627('0x8'));var fs=require('fs');var fs_extra=require(_0xe627('0x9'));var _=require(_0xe627('0xa'));var squel=require(_0xe627('0xb'));var crypto=require(_0xe627('0xc'));var jsforce=require(_0xe627('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe627('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe627('0xf'));var authService=require(_0xe627('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe627('0x11'));var logger=require(_0xe627('0x12'))(_0xe627('0x13'));var utils=require(_0xe627('0x14'));var config=require(_0xe627('0x15'));var licenseUtil=require(_0xe627('0x16'));var db=require(_0xe627('0x17'))['db'];function respondWithStatusCode(_0x3919be,_0x1922f5){_0x1922f5=_0x1922f5||0xcc;return function(_0x582190){if(_0x582190){return _0x3919be[_0xe627('0x18')](_0x1922f5);}return _0x3919be[_0xe627('0x19')](_0x1922f5)[_0xe627('0x1a')]();};}function respondWithResult(_0x4be370,_0x42dd1c){_0x42dd1c=_0x42dd1c||0xc8;return function(_0x1e2e62){if(_0x1e2e62){return _0x4be370[_0xe627('0x19')](_0x42dd1c)[_0xe627('0x1b')](_0x1e2e62);}};}function respondWithFilteredResult(_0x62896f,_0x6a9a15){return function(_0x271325){if(_0x271325){var _0x54720a=typeof _0x6a9a15[_0xe627('0x1c')]===_0xe627('0x1d')&&typeof _0x6a9a15[_0xe627('0x1e')]===_0xe627('0x1d');var _0x403982=_0x271325[_0xe627('0x1f')];var _0x56559b=_0x54720a?0x0:_0x6a9a15[_0xe627('0x1c')];var _0x538b22=_0x54720a?_0x271325[_0xe627('0x1f')]:_0x6a9a15['offset']+_0x6a9a15[_0xe627('0x1e')];var _0x565213;if(_0x538b22>=_0x403982){_0x538b22=_0x403982;_0x565213=0xc8;}else{_0x565213=0xce;}_0x62896f['status'](_0x565213);return _0x62896f[_0xe627('0x20')]('Content-Range',_0x56559b+'-'+_0x538b22+'/'+_0x403982)[_0xe627('0x1b')](_0x271325);}return null;};}function patchUpdates(_0x3391ce){return function(_0x4adde7){try{jsonpatch['apply'](_0x4adde7,_0x3391ce,!![]);}catch(_0x4ecfa6){return BPromise[_0xe627('0x21')](_0x4ecfa6);}return _0x4adde7[_0xe627('0x22')]();};}function saveUpdates(_0x4e3338,_0x708a8a){return function(_0x33cb27){if(_0x33cb27){return _0x33cb27['update'](_0x4e3338)[_0xe627('0x23')](function(_0x29221b){return _0x29221b;});}return null;};}function removeEntity(_0x52d492,_0x42f3d1){return function(_0x19adbc){if(_0x19adbc){return _0x19adbc[_0xe627('0x24')]()['then'](function(){_0x52d492[_0xe627('0x19')](0xcc)[_0xe627('0x1a')]();});}};}function handleEntityNotFound(_0x1a5081,_0x3ddd8d){return function(_0x4b9ff9){if(!_0x4b9ff9){_0x1a5081[_0xe627('0x18')](0x194);}return _0x4b9ff9;};}function handleError(_0x1fe192,_0x1635a0){_0x1635a0=_0x1635a0||0x1f4;return function(_0x29eb8e){logger[_0xe627('0x25')](_0x29eb8e[_0xe627('0x26')]);if(_0x29eb8e[_0xe627('0x27')]){delete _0x29eb8e[_0xe627('0x27')];}_0x1fe192[_0xe627('0x19')](_0x1635a0)['send'](_0x29eb8e);};}exports[_0xe627('0x28')]=function(_0x5aeba1,_0x5cd7c8){var _0x1e0bd7={},_0xdf63c8={},_0x5799a3={'count':0x0,'rows':[]};var _0x39c23f=_['map'](db[_0xe627('0x29')]['rawAttributes'],function(_0x262253){return{'name':_0x262253[_0xe627('0x2a')],'type':_0x262253['type'][_0xe627('0x2b')]};});_0xdf63c8['model']=_[_0xe627('0x2c')](_0x39c23f,_0xe627('0x27'));_0xdf63c8[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x5aeba1[_0xe627('0x2d')]);_0xdf63c8[_0xe627('0x2f')]=_[_0xe627('0x30')](_0xdf63c8[_0xe627('0x31')],_0xdf63c8[_0xe627('0x2d')]);_0x1e0bd7[_0xe627('0x32')]=_[_0xe627('0x30')](_0xdf63c8['model'],qs['fields'](_0x5aeba1[_0xe627('0x2d')]['fields']));_0x1e0bd7[_0xe627('0x32')]=_0x1e0bd7['attributes']['length']?_0x1e0bd7[_0xe627('0x32')]:_0xdf63c8['model'];if(!_0x5aeba1['query'][_0xe627('0x33')](_0xe627('0x34'))){_0x1e0bd7[_0xe627('0x1e')]=qs['limit'](_0x5aeba1['query']['limit']);_0x1e0bd7[_0xe627('0x1c')]=qs['offset'](_0x5aeba1[_0xe627('0x2d')][_0xe627('0x1c')]);}_0x1e0bd7['order']=qs[_0xe627('0x35')](_0x5aeba1[_0xe627('0x2d')]['sort']);_0x1e0bd7[_0xe627('0x36')]=qs[_0xe627('0x2f')](_[_0xe627('0x37')](_0x5aeba1[_0xe627('0x2d')],_0xdf63c8[_0xe627('0x2f')]),_0x39c23f);if(_0x5aeba1[_0xe627('0x2d')]['filter']){_0x1e0bd7[_0xe627('0x36')]=_['merge'](_0x1e0bd7[_0xe627('0x36')],{'$or':_['map'](_0x39c23f,function(_0xe90eda){if(_0xe90eda[_0xe627('0x38')]!==_0xe627('0x39')){var _0x21a533={};_0x21a533[_0xe90eda[_0xe627('0x27')]]={'$like':'%'+_0x5aeba1[_0xe627('0x2d')][_0xe627('0x3a')]+'%'};return _0x21a533;}})});}_0x1e0bd7=_[_0xe627('0x3b')]({},_0x1e0bd7,_0x5aeba1[_0xe627('0x3c')]);var _0x415a25={'where':_0x1e0bd7[_0xe627('0x36')]};return db[_0xe627('0x29')][_0xe627('0x1f')](_0x415a25)['then'](function(_0x4ddff5){_0x5799a3['count']=_0x4ddff5;if(_0x5aeba1['query']['includeAll']){_0x1e0bd7['include']=[{'all':!![]}];}return db[_0xe627('0x29')]['findAll'](_0x1e0bd7);})[_0xe627('0x23')](function(_0x59cd6a){_0x5799a3[_0xe627('0x3d')]=_0x59cd6a;return _0x5799a3;})[_0xe627('0x23')](respondWithFilteredResult(_0x5cd7c8,_0x1e0bd7))[_0xe627('0x3e')](handleError(_0x5cd7c8,null));};exports['show']=function(_0x58e110,_0x26064c){var _0x5f3374={'raw':!![],'where':{'id':_0x58e110[_0xe627('0x3f')]['id']}},_0x5e352e={};_0x5e352e['model']=_[_0xe627('0x2e')](db['MailQueueReport']['rawAttributes']);_0x5e352e[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x58e110[_0xe627('0x2d')]);_0x5e352e['filters']=_['intersection'](_0x5e352e[_0xe627('0x31')],_0x5e352e['query']);_0x5f3374['attributes']=_[_0xe627('0x30')](_0x5e352e[_0xe627('0x31')],qs[_0xe627('0x40')](_0x58e110[_0xe627('0x2d')][_0xe627('0x40')]));_0x5f3374[_0xe627('0x32')]=_0x5f3374['attributes'][_0xe627('0x41')]?_0x5f3374[_0xe627('0x32')]:_0x5e352e['model'];if(_0x58e110['query'][_0xe627('0x42')]){_0x5f3374[_0xe627('0x43')]=[{'all':!![]}];}_0x5f3374=_[_0xe627('0x3b')]({},_0x5f3374,_0x58e110[_0xe627('0x3c')]);return db[_0xe627('0x29')][_0xe627('0x44')](_0x5f3374)[_0xe627('0x23')](handleEntityNotFound(_0x26064c,null))['then'](respondWithResult(_0x26064c,null))[_0xe627('0x3e')](handleError(_0x26064c,null));};exports['create']=function(_0x648456,_0xcd19f5){return db[_0xe627('0x29')]['create'](_0x648456[_0xe627('0x45')],{})['then'](respondWithResult(_0xcd19f5,0xc9))[_0xe627('0x3e')](handleError(_0xcd19f5,null));};exports[_0xe627('0x46')]=function(_0x375e05,_0x30e057){if(_0x375e05[_0xe627('0x45')]['id']){delete _0x375e05['body']['id'];}return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x375e05[_0xe627('0x3f')]['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x30e057,null))[_0xe627('0x23')](saveUpdates(_0x375e05[_0xe627('0x45')],null))[_0xe627('0x23')](respondWithResult(_0x30e057,null))[_0xe627('0x3e')](handleError(_0x30e057,null));};exports[_0xe627('0x24')]=function(_0x3824da,_0x550b74){return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x3824da['params']['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x550b74,null))[_0xe627('0x23')](removeEntity(_0x550b74,null))['catch'](handleError(_0x550b74,null));};exports[_0xe627('0x47')]=function(_0x3a827e,_0x542a4c){return db[_0xe627('0x29')][_0xe627('0x47')]()['then'](respondWithResult(_0x542a4c,null))[_0xe627('0x3e')](handleError(_0x542a4c,null));}; \ No newline at end of file +var _0x4975=['to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','MailQueueReport','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x11bfb5,_0x3e8e81){var _0x3aca7f=function(_0x5336e7){while(--_0x5336e7){_0x11bfb5['push'](_0x11bfb5['shift']());}};_0x3aca7f(++_0x3e8e81);}(_0x4975,0x86));var _0x5497=function(_0x4fb3d7,_0x1fdb34){_0x4fb3d7=_0x4fb3d7-0x0;var _0x26a6d2=_0x4975[_0x4fb3d7];return _0x26a6d2;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['MailQueueReport']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':!![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['MailQueueReport'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['MailQueueReport'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 095b9a5..95cbef3 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 _0xd714=['MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x2ccd06,_0x2f6aae){var _0xb17be4=function(_0x1117a5){while(--_0x1117a5){_0x2ccd06['push'](_0x2ccd06['shift']());}};_0xb17be4(++_0x2f6aae);}(_0xd714,0x1e4));var _0x4d71=function(_0x283b55,_0x279bee){_0x283b55=_0x283b55-0x0;var _0x192e58=_0xd714[_0x283b55];return _0x192e58;};'use strict';var _=require(_0x4d71('0x0'));var util=require(_0x4d71('0x1'));var logger=require('../../config/logger')(_0x4d71('0x2'));var moment=require(_0x4d71('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d71('0x4'));var rimraf=require(_0x4d71('0x5'));var config=require(_0x4d71('0x6'));var attributes=require(_0x4d71('0x7'));module[_0x4d71('0x8')]=function(_0x154fa5,_0x3e04a6){return _0x154fa5[_0x4d71('0x9')](_0x4d71('0xa'),attributes,{'tableName':_0x4d71('0xb'),'paranoid':![],'indexes':[{'name':_0x4d71('0xc'),'fields':[_0x4d71('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfaf0=['request-promise','path','./mailQueueReport.attributes','define','MailQueueReport','uniqueid','lodash','util','api','moment'];(function(_0x458a46,_0x58cfeb){var _0x42eee1=function(_0xbe7cbe){while(--_0xbe7cbe){_0x458a46['push'](_0x458a46['shift']());}};_0x42eee1(++_0x58cfeb);}(_0xfaf0,0x6a));var _0x0faf=function(_0x38b8a1,_0x503759){_0x38b8a1=_0x38b8a1-0x0;var _0x286b01=_0xfaf0[_0x38b8a1];return _0x286b01;};'use strict';var _=require(_0x0faf('0x0'));var util=require(_0x0faf('0x1'));var logger=require('../../config/logger')(_0x0faf('0x2'));var moment=require(_0x0faf('0x3'));var BPromise=require('bluebird');var rp=require(_0x0faf('0x4'));var fs=require('fs');var path=require(_0x0faf('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0faf('0x6'));module['exports']=function(_0x345a37,_0x17372b){return _0x345a37[_0x0faf('0x7')](_0x0faf('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x0faf('0x9'),'fields':[_0x0faf('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8470eeb..f35458c 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x8ad45d,_0x2c14cd){var _0x1c31b0=function(_0x278393){while(--_0x278393){_0x8ad45d['push'](_0x8ad45d['shift']());}};_0x1c31b0(++_0x2c14cd);}(_0x2ef3,0xba));var _0x32ef=function(_0x486cfb,_0x51722f){_0x486cfb=_0x486cfb-0x0;var _0x381669=_0x2ef3[_0x486cfb];return _0x381669;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0xeadc11,_0x27e378){var _0x4257b6=function(_0x38bb40){while(--_0x38bb40){_0xeadc11['push'](_0xeadc11['shift']());}};_0x4257b6(++_0x27e378);}(_0x2ef3,0xba));var _0x32ef=function(_0x87caf,_0x2555d0){_0x87caf=_0x87caf-0x0;var _0x16ccf5=_0x2ef3[_0x87caf];return _0x16ccf5;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 25eb348..4d5a216 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3ed39d,_0x1b8390){var _0x39ac11=function(_0x3ff587){while(--_0x3ff587){_0x3ed39d['push'](_0x3ed39d['shift']());}};_0x39ac11(++_0x1b8390);}(_0x70e0,0x17b));var _0x070e=function(_0x1681b3,_0x7d09f8){_0x1681b3=_0x1681b3-0x0;var _0x3aee83=_0x70e0[_0x1681b3];return _0x3aee83;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x128f18,_0xd7ba38){var _0x28d6fb=function(_0x155986){while(--_0x155986){_0x128f18['push'](_0x128f18['shift']());}};_0x28d6fb(++_0xd7ba38);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 299cea0..f5a2856 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 _0x8858=['INBOX','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x20234e,_0x367077){var _0x5a0349=function(_0x20b066){while(--_0x20b066){_0x20234e['push'](_0x20234e['shift']());}};_0x5a0349(++_0x367077);}(_0x8858,0xdf));var _0x8885=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x8858[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x8885('0x0'));module[_0x8885('0x1')]={'description':{'type':Sequelize[_0x8885('0x2')]},'host':{'type':Sequelize[_0x8885('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x8885('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x8885('0x3')]},'tls':{'type':Sequelize[_0x8885('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x8885('0x2')],'defaultValue':_0x8885('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x8885('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x8885('0x2')]},'modernAuthentication':{'type':Sequelize[_0x8885('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa038=['INTEGER','INBOX','sequelize','STRING','BOOLEAN'];(function(_0x5c8d87,_0x27c270){var _0x5f4e3f=function(_0x4285f8){while(--_0x4285f8){_0x5c8d87['push'](_0x5c8d87['shift']());}};_0x5f4e3f(++_0x27c270);}(_0xa038,0x197));var _0x8a03=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xa038[_0xfa634c];return _0x73e478;};'use strict';var Sequelize=require(_0x8a03('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x8a03('0x1')]},'authentication':{'type':Sequelize[_0x8a03('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x8a03('0x1')]},'password':{'type':Sequelize[_0x8a03('0x1')]},'port':{'type':Sequelize[_0x8a03('0x3')]},'tls':{'type':Sequelize[_0x8a03('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x8a03('0x1')],'defaultValue':_0x8a03('0x4')},'connTimeout':{'type':Sequelize[_0x8a03('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x8a03('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 188267b..f453f1a 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 _0xc9a4=['exports','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x26675d,_0x5857ee){var _0x2e82c6=function(_0x1718c1){while(--_0x1718c1){_0x26675d['push'](_0x26675d['shift']());}};_0x2e82c6(++_0x5857ee);}(_0xc9a4,0x162));var _0x4c9a=function(_0x564c61,_0x54a6d3){_0x564c61=_0x564c61-0x0;var _0x21377b=_0xc9a4[_0x564c61];return _0x21377b;};'use strict';var _=require(_0x4c9a('0x0'));var util=require(_0x4c9a('0x1'));var logger=require(_0x4c9a('0x2'))('api');var moment=require(_0x4c9a('0x3'));var BPromise=require(_0x4c9a('0x4'));var rp=require(_0x4c9a('0x5'));var fs=require('fs');var path=require(_0x4c9a('0x6'));var rimraf=require(_0x4c9a('0x7'));var config=require(_0x4c9a('0x8'));var attributes=require('./mailServerIn.attributes');module[_0x4c9a('0x9')]=function(_0x52fba5,_0x2443fe){return _0x52fba5['define']('MailServerIn',attributes,{'tableName':_0x4c9a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1038=['bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment'];(function(_0x3e54fd,_0x2847bd){var _0x189bb9=function(_0x1aefa0){while(--_0x1aefa0){_0x3e54fd['push'](_0x3e54fd['shift']());}};_0x189bb9(++_0x2847bd);}(_0x1038,0x167));var _0x8103=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x1038[_0x622035];return _0x326cf2;};'use strict';var _=require(_0x8103('0x0'));var util=require(_0x8103('0x1'));var logger=require(_0x8103('0x2'))(_0x8103('0x3'));var moment=require(_0x8103('0x4'));var BPromise=require(_0x8103('0x5'));var rp=require(_0x8103('0x6'));var fs=require('fs');var path=require(_0x8103('0x7'));var rimraf=require(_0x8103('0x8'));var config=require(_0x8103('0x9'));var attributes=require(_0x8103('0xa'));module['exports']=function(_0x1289c8,_0x42dc2c){return _0x1289c8['define'](_0x8103('0xb'),attributes,{'tableName':_0x8103('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 319d901..e6797f5 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 _0xc29b=['stringify','error','code','message','result','catch','GetMailServerIn','options','where','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x5e0eec,_0x21bd9e){var _0x3788d3=function(_0x35c44d){while(--_0x35c44d){_0x5e0eec['push'](_0x5e0eec['shift']());}};_0x3788d3(++_0x21bd9e);}(_0xc29b,0x12d));var _0xbc29=function(_0x3a2a5c,_0x4017ea){_0x3a2a5c=_0x3a2a5c-0x0;var _0x5b603e=_0xc29b[_0x3a2a5c];return _0x5b603e;};'use strict';var _=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var moment=require(_0xbc29('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc29('0x3'));var fs=require('fs');var Redis=require(_0xbc29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc29('0x5'));var logger=require(_0xbc29('0x6'))(_0xbc29('0x7'));var config=require(_0xbc29('0x8'));var jayson=require(_0xbc29('0x9'));var client=jayson[_0xbc29('0xa')][_0xbc29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40f0c9,_0x463e2b,_0x37d9dd){return new BPromise(function(_0x2e5fb7,_0x29b188){return client[_0xbc29('0xc')](_0x40f0c9,_0x37d9dd)[_0xbc29('0xd')](function(_0x320cb4){logger[_0xbc29('0xe')](_0xbc29('0xf'),_0x463e2b,_0xbc29('0x10'));logger[_0xbc29('0x11')](_0xbc29('0x12'),_0x463e2b,'request\x20sent',JSON[_0xbc29('0x13')](_0x320cb4));if(_0x320cb4[_0xbc29('0x14')]){if(_0x320cb4[_0xbc29('0x14')][_0xbc29('0x15')]===0x1f4){logger[_0xbc29('0x14')](_0xbc29('0xf'),_0x463e2b,_0x320cb4[_0xbc29('0x14')]['message']);return _0x29b188(_0x320cb4[_0xbc29('0x14')][_0xbc29('0x16')]);}logger[_0xbc29('0x14')]('MailServerIn,\x20%s,\x20%s',_0x463e2b,_0x320cb4['error'][_0xbc29('0x16')]);return _0x2e5fb7(_0x320cb4['error'][_0xbc29('0x16')]);}else{logger[_0xbc29('0xe')](_0xbc29('0xf'),_0x463e2b,'request\x20sent');_0x2e5fb7(_0x320cb4[_0xbc29('0x17')]['message']);}})[_0xbc29('0x18')](function(_0x3b5bae){logger[_0xbc29('0x14')](_0xbc29('0xf'),_0x463e2b,_0x3b5bae);_0x29b188(_0x3b5bae);});});}exports[_0xbc29('0x19')]=function(_0x42b0be){var _0x56b592=this;return new Promise(function(_0x9e84e3,_0xc4a1c1){return db['MailServerIn']['findAll']({'raw':_0x42b0be[_0xbc29('0x1a')]?_0x42b0be['options']['raw']===undefined?!![]:![]:!![],'where':_0x42b0be[_0xbc29('0x1a')]?_0x42b0be[_0xbc29('0x1a')][_0xbc29('0x1b')]||null:null,'attributes':_0x42b0be[_0xbc29('0x1a')]?_0x42b0be[_0xbc29('0x1a')][_0xbc29('0x1c')]||null:null,'limit':_0x42b0be[_0xbc29('0x1a')]?_0x42b0be[_0xbc29('0x1a')]['limit']||null:null,'include':_0x42b0be[_0xbc29('0x1a')]?_0x42b0be[_0xbc29('0x1a')][_0xbc29('0x1d')]?_[_0xbc29('0x1e')](_0x42b0be[_0xbc29('0x1a')]['include'],function(_0x24523f){return{'model':db[_0x24523f[_0xbc29('0x1f')]],'as':_0x24523f['as'],'attributes':_0x24523f[_0xbc29('0x1c')],'include':_0x24523f[_0xbc29('0x1d')]?_['map'](_0x24523f[_0xbc29('0x1d')],function(_0x3ad136){return{'model':db[_0x3ad136['model']],'as':_0x3ad136['as'],'attributes':_0x3ad136[_0xbc29('0x1c')],'include':_0x3ad136[_0xbc29('0x1d')]?_['map'](_0x3ad136['include'],function(_0x2c7b63){return{'model':db[_0x2c7b63['model']],'as':_0x2c7b63['as'],'attributes':_0x2c7b63['attributes']};}):[]};}):[]};}):[]:[]})[_0xbc29('0xd')](function(_0xf9f8cf){logger[_0xbc29('0xe')]('GetMailServerIn',_0x42b0be);logger[_0xbc29('0x11')](_0xbc29('0x19'),_0x42b0be,JSON[_0xbc29('0x13')](_0xf9f8cf));_0x9e84e3(_0xf9f8cf);})[_0xbc29('0x18')](function(_0x1797c9){logger['error']('GetMailServerIn',_0x1797c9[_0xbc29('0x16')],_0x42b0be);_0xc4a1c1(_0x56b592[_0xbc29('0x14')](0x1f4,_0x1797c9['message']));});});}; \ No newline at end of file +var _0x37a4=['lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMailServerIn','findAll','options','where','attributes','limit','include','map','model'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x37a4,0xcb));var _0x437a=function(_0xdd83bf,_0x295443){_0xdd83bf=_0xdd83bf-0x0;var _0x52193d=_0x37a4[_0xdd83bf];return _0x52193d;};'use strict';var _=require(_0x437a('0x0'));var util=require('util');var moment=require(_0x437a('0x1'));var BPromise=require('bluebird');var rs=require(_0x437a('0x2'));var fs=require('fs');var Redis=require(_0x437a('0x3'));var db=require(_0x437a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x437a('0x5'));var config=require(_0x437a('0x6'));var jayson=require(_0x437a('0x7'));var client=jayson[_0x437a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c567f,_0x3a4961,_0x5017ce){return new BPromise(function(_0x36270b,_0x15ac16){return client[_0x437a('0x9')](_0x1c567f,_0x5017ce)[_0x437a('0xa')](function(_0xb81523){logger[_0x437a('0xb')](_0x437a('0xc'),_0x3a4961,_0x437a('0xd'));logger[_0x437a('0xe')](_0x437a('0xf'),_0x3a4961,_0x437a('0xd'),JSON['stringify'](_0xb81523));if(_0xb81523[_0x437a('0x10')]){if(_0xb81523[_0x437a('0x10')][_0x437a('0x11')]===0x1f4){logger[_0x437a('0x10')](_0x437a('0xc'),_0x3a4961,_0xb81523['error'][_0x437a('0x12')]);return _0x15ac16(_0xb81523['error'][_0x437a('0x12')]);}logger[_0x437a('0x10')](_0x437a('0xc'),_0x3a4961,_0xb81523[_0x437a('0x10')][_0x437a('0x12')]);return _0x36270b(_0xb81523[_0x437a('0x10')][_0x437a('0x12')]);}else{logger[_0x437a('0xb')](_0x437a('0xc'),_0x3a4961,_0x437a('0xd'));_0x36270b(_0xb81523[_0x437a('0x13')][_0x437a('0x12')]);}})['catch'](function(_0x469122){logger['error'](_0x437a('0xc'),_0x3a4961,_0x469122);_0x15ac16(_0x469122);});});}exports[_0x437a('0x14')]=function(_0x170ba3){var _0x60f54b=this;return new Promise(function(_0x3d1a23,_0x2f98f9){return db['MailServerIn'][_0x437a('0x15')]({'raw':_0x170ba3[_0x437a('0x16')]?_0x170ba3[_0x437a('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x170ba3[_0x437a('0x16')]?_0x170ba3['options'][_0x437a('0x17')]||null:null,'attributes':_0x170ba3[_0x437a('0x16')]?_0x170ba3['options'][_0x437a('0x18')]||null:null,'limit':_0x170ba3['options']?_0x170ba3[_0x437a('0x16')][_0x437a('0x19')]||null:null,'include':_0x170ba3[_0x437a('0x16')]?_0x170ba3[_0x437a('0x16')][_0x437a('0x1a')]?_[_0x437a('0x1b')](_0x170ba3[_0x437a('0x16')][_0x437a('0x1a')],function(_0x288faa){return{'model':db[_0x288faa[_0x437a('0x1c')]],'as':_0x288faa['as'],'attributes':_0x288faa[_0x437a('0x18')],'include':_0x288faa[_0x437a('0x1a')]?_['map'](_0x288faa[_0x437a('0x1a')],function(_0x29ccd0){return{'model':db[_0x29ccd0[_0x437a('0x1c')]],'as':_0x29ccd0['as'],'attributes':_0x29ccd0['attributes'],'include':_0x29ccd0[_0x437a('0x1a')]?_['map'](_0x29ccd0[_0x437a('0x1a')],function(_0x422c2e){return{'model':db[_0x422c2e[_0x437a('0x1c')]],'as':_0x422c2e['as'],'attributes':_0x422c2e[_0x437a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x437a('0xa')](function(_0x1c00f1){logger[_0x437a('0xb')](_0x437a('0x14'),_0x170ba3);logger[_0x437a('0xe')]('GetMailServerIn',_0x170ba3,JSON['stringify'](_0x1c00f1));_0x3d1a23(_0x1c00f1);})['catch'](function(_0x434eb1){logger[_0x437a('0x10')](_0x437a('0x14'),_0x434eb1['message'],_0x170ba3);_0x2f98f9(_0x60f54b[_0x437a('0x10')](0x1f4,_0x434eb1[_0x437a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 099a70a..c3a7079 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(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7a54,0x106));var _0x47a5=function(_0x1cc031,_0x44a0b3){_0x1cc031=_0x1cc031-0x0;var _0x3ee64b=_0x7a54[_0x1cc031];return _0x3ee64b;};'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(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x7a54,0x106));var _0x47a5=function(_0x32b986,_0x25560a){_0x32b986=_0x32b986-0x0;var _0x166b15=_0x7a54[_0x32b986];return _0x166b15;};'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 cc6497f..79fd1ab 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 _0x5c00=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x35d1f9,_0xee484c){var _0x2d7877=function(_0x52117d){while(--_0x52117d){_0x35d1f9['push'](_0x35d1f9['shift']());}};_0x2d7877(++_0xee484c);}(_0x5c00,0x17e));var _0x05c0=function(_0x24875d,_0x4fb24d){_0x24875d=_0x24875d-0x0;var _0x181471=_0x5c00[_0x24875d];return _0x181471;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'description':{'type':Sequelize[_0x05c0('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x05c0('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x05c0('0x3')]},'secure':{'type':Sequelize[_0x05c0('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x05c0('0x2')]},'authentication':{'type':Sequelize[_0x05c0('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbee3=['exports','STRING','BOOLEAN'];(function(_0x391638,_0x199b7f){var _0x4ea053=function(_0x31a8d4){while(--_0x31a8d4){_0x391638['push'](_0x391638['shift']());}};_0x4ea053(++_0x199b7f);}(_0xbee3,0xd5));var _0x3bee=function(_0x3caf9f,_0xec59b8){_0x3caf9f=_0x3caf9f-0x0;var _0x203e82=_0xbee3[_0x3caf9f];return _0x203e82;};'use strict';var Sequelize=require('sequelize');module[_0x3bee('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x3bee('0x1')]},'pass':{'type':Sequelize[_0x3bee('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x3bee('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x3bee('0x1')]},'authentication':{'type':Sequelize[_0x3bee('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 63e9a74..00d22be 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 _0x385e=['sendStatus','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','model','query','keys','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x385e,0x18b));var _0xe385=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x385e[_0x1762b4];return _0x29beda;};'use strict';var emlformat=require(_0xe385('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe385('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe385('0x2'));var moment=require('moment');var BPromise=require(_0xe385('0x3'));var Mustache=require(_0xe385('0x4'));var util=require(_0xe385('0x5'));var path=require(_0xe385('0x6'));var sox=require(_0xe385('0x7'));var csv=require('to-csv');var ejs=require(_0xe385('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe385('0x9'));var squel=require(_0xe385('0xa'));var crypto=require(_0xe385('0xb'));var jsforce=require(_0xe385('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe385('0xd'));var querystring=require(_0xe385('0xe'));var Papa=require(_0xe385('0xf'));var Redis=require(_0xe385('0x10'));var authService=require(_0xe385('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe385('0x12'));var hardwareService=require(_0xe385('0x13'));var logger=require(_0xe385('0x14'))(_0xe385('0x15'));var utils=require('../../config/utils');var config=require(_0xe385('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x591883,_0x406b5c){_0x406b5c=_0x406b5c||0xcc;return function(_0x3c60d0){if(_0x3c60d0){return _0x591883['sendStatus'](_0x406b5c);}return _0x591883[_0xe385('0x17')](_0x406b5c)['end']();};}function respondWithResult(_0x359de8,_0x29c825){_0x29c825=_0x29c825||0xc8;return function(_0x2e56b8){if(_0x2e56b8){return _0x359de8['status'](_0x29c825)[_0xe385('0x18')](_0x2e56b8);}};}function respondWithFilteredResult(_0x139a13,_0x49d443){return function(_0x269b70){if(_0x269b70){var _0x428572=typeof _0x49d443[_0xe385('0x19')]===_0xe385('0x1a')&&typeof _0x49d443[_0xe385('0x1b')]===_0xe385('0x1a');var _0x2eb8d9=_0x269b70[_0xe385('0x1c')];var _0x3a0f49=_0x428572?0x0:_0x49d443['offset'];var _0x4aa3c3=_0x428572?_0x269b70[_0xe385('0x1c')]:_0x49d443[_0xe385('0x19')]+_0x49d443[_0xe385('0x1b')];var _0x224b78;if(_0x4aa3c3>=_0x2eb8d9){_0x4aa3c3=_0x2eb8d9;_0x224b78=0xc8;}else{_0x224b78=0xce;}_0x139a13['status'](_0x224b78);return _0x139a13[_0xe385('0x1d')](_0xe385('0x1e'),_0x3a0f49+'-'+_0x4aa3c3+'/'+_0x2eb8d9)[_0xe385('0x18')](_0x269b70);}return null;};}function patchUpdates(_0x19498b){return function(_0x38588e){try{jsonpatch[_0xe385('0x1f')](_0x38588e,_0x19498b,!![]);}catch(_0x537d0d){return BPromise[_0xe385('0x20')](_0x537d0d);}return _0x38588e['save']();};}function saveUpdates(_0x50ab8f,_0x5dadb0){return function(_0x59f99a){if(_0x59f99a){return _0x59f99a[_0xe385('0x21')](_0x50ab8f)[_0xe385('0x22')](function(_0x52fba4){return _0x52fba4;});}return null;};}function removeEntity(_0x5782b0,_0x5c6cc0){return function(_0x4a1dea){if(_0x4a1dea){return _0x4a1dea[_0xe385('0x23')]()[_0xe385('0x22')](function(){_0x5782b0[_0xe385('0x17')](0xcc)[_0xe385('0x24')]();});}};}function handleEntityNotFound(_0x317c92,_0x5b481d){return function(_0x3132c2){if(!_0x3132c2){_0x317c92[_0xe385('0x25')](0x194);}return _0x3132c2;};}function handleError(_0x227a3f,_0x5621de){_0x5621de=_0x5621de||0x1f4;return function(_0x52d97f){logger[_0xe385('0x26')](_0x52d97f[_0xe385('0x27')]);if(_0x52d97f['name']){delete _0x52d97f[_0xe385('0x28')];}_0x227a3f[_0xe385('0x17')](_0x5621de)['send'](_0x52d97f);};}exports[_0xe385('0x29')]=function(_0x35b076,_0x56facd){var _0x41d902={},_0x1f78ea={},_0x210445={'count':0x0,'rows':[]};var _0x97edd6=_[_0xe385('0x2a')](db[_0xe385('0x2b')][_0xe385('0x2c')],function(_0x4e7504){return{'name':_0x4e7504[_0xe385('0x2d')],'type':_0x4e7504[_0xe385('0x2e')]['key']};});_0x1f78ea[_0xe385('0x2f')]=_[_0xe385('0x2a')](_0x97edd6,_0xe385('0x28'));_0x1f78ea[_0xe385('0x30')]=_[_0xe385('0x31')](_0x35b076[_0xe385('0x30')]);_0x1f78ea['filters']=_['intersection'](_0x1f78ea['model'],_0x1f78ea[_0xe385('0x30')]);_0x41d902['attributes']=_['intersection'](_0x1f78ea[_0xe385('0x2f')],qs[_0xe385('0x32')](_0x35b076['query']['fields']));_0x41d902['attributes']=_0x41d902[_0xe385('0x33')]['length']?_0x41d902[_0xe385('0x33')]:_0x1f78ea[_0xe385('0x2f')];if(!_0x35b076[_0xe385('0x30')][_0xe385('0x34')](_0xe385('0x35'))){_0x41d902[_0xe385('0x1b')]=qs['limit'](_0x35b076[_0xe385('0x30')][_0xe385('0x1b')]);_0x41d902[_0xe385('0x19')]=qs['offset'](_0x35b076[_0xe385('0x30')]['offset']);}_0x41d902[_0xe385('0x36')]=qs['sort'](_0x35b076[_0xe385('0x30')]['sort']);_0x41d902[_0xe385('0x37')]=qs[_0xe385('0x38')](_[_0xe385('0x39')](_0x35b076[_0xe385('0x30')],_0x1f78ea[_0xe385('0x38')]),_0x97edd6);if(_0x35b076[_0xe385('0x30')][_0xe385('0x3a')]){_0x41d902['where']=_[_0xe385('0x3b')](_0x41d902[_0xe385('0x37')],{'$or':_[_0xe385('0x2a')](_0x97edd6,function(_0x13480f){if(_0x13480f[_0xe385('0x2e')]!==_0xe385('0x3c')){var _0x48cbfb={};_0x48cbfb[_0x13480f[_0xe385('0x28')]]={'$like':'%'+_0x35b076[_0xe385('0x30')]['filter']+'%'};return _0x48cbfb;}})});}_0x41d902=_[_0xe385('0x3b')]({},_0x41d902,_0x35b076[_0xe385('0x3d')]);var _0x233232={'where':_0x41d902[_0xe385('0x37')]};return db[_0xe385('0x2b')][_0xe385('0x1c')](_0x233232)['then'](function(_0x2e0c3f){_0x210445[_0xe385('0x1c')]=_0x2e0c3f;if(_0x35b076[_0xe385('0x30')][_0xe385('0x3e')]){_0x41d902['include']=[{'all':!![]}];}return db[_0xe385('0x2b')][_0xe385('0x3f')](_0x41d902);})[_0xe385('0x22')](function(_0x4f46c8){_0x210445[_0xe385('0x40')]=_0x4f46c8;return _0x210445;})['then'](respondWithFilteredResult(_0x56facd,_0x41d902))['catch'](handleError(_0x56facd,null));};exports[_0xe385('0x41')]=function(_0x1167a0,_0x6f2b7e){var _0x50e895={'raw':!![],'where':{'id':_0x1167a0[_0xe385('0x42')]['id']}},_0x556674={};_0x556674[_0xe385('0x2f')]=_[_0xe385('0x31')](db['MailServerOut'][_0xe385('0x2c')]);_0x556674['query']=_[_0xe385('0x31')](_0x1167a0[_0xe385('0x30')]);_0x556674[_0xe385('0x38')]=_['intersection'](_0x556674[_0xe385('0x2f')],_0x556674[_0xe385('0x30')]);_0x50e895['attributes']=_['intersection'](_0x556674[_0xe385('0x2f')],qs[_0xe385('0x32')](_0x1167a0[_0xe385('0x30')][_0xe385('0x32')]));_0x50e895[_0xe385('0x33')]=_0x50e895[_0xe385('0x33')]['length']?_0x50e895[_0xe385('0x33')]:_0x556674[_0xe385('0x2f')];if(_0x1167a0[_0xe385('0x30')][_0xe385('0x3e')]){_0x50e895[_0xe385('0x43')]=[{'all':!![]}];}_0x50e895=_[_0xe385('0x3b')]({},_0x50e895,_0x1167a0['options']);return db[_0xe385('0x2b')][_0xe385('0x44')](_0x50e895)['then'](handleEntityNotFound(_0x6f2b7e,null))[_0xe385('0x22')](respondWithResult(_0x6f2b7e,null))[_0xe385('0x45')](handleError(_0x6f2b7e,null));};exports[_0xe385('0x46')]=function(_0x55e074,_0x2529b5){return db['MailServerOut'][_0xe385('0x46')](_0x55e074[_0xe385('0x47')],{})[_0xe385('0x22')](respondWithResult(_0x2529b5,0xc9))[_0xe385('0x45')](handleError(_0x2529b5,null));};exports[_0xe385('0x21')]=function(_0x4428f1,_0x2eca32){if(_0x4428f1['body']['id']){delete _0x4428f1[_0xe385('0x47')]['id'];}return db[_0xe385('0x2b')][_0xe385('0x44')]({'where':{'id':_0x4428f1[_0xe385('0x42')]['id']}})['then'](handleEntityNotFound(_0x2eca32,null))['then'](saveUpdates(_0x4428f1['body'],null))['then'](respondWithResult(_0x2eca32,null))[_0xe385('0x45')](handleError(_0x2eca32,null));};exports['destroy']=function(_0x32127a,_0x3a89b0){return db['MailServerOut'][_0xe385('0x44')]({'where':{'id':_0x32127a[_0xe385('0x42')]['id']}})[_0xe385('0x22')](handleEntityNotFound(_0x3a89b0,null))[_0xe385('0x22')](removeEntity(_0x3a89b0,null))[_0xe385('0x45')](handleError(_0x3a89b0,null));}; \ No newline at end of file +var _0x9019=['count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','MailServerOut','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0x9019,0xc9));var _0x9901=function(_0xa8f776,_0x420cbf){_0xa8f776=_0xa8f776-0x0;var _0x435961=_0x9019[_0xa8f776];return _0x435961;};'use strict';var emlformat=require(_0x9901('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9901('0x1'));var jsonpatch=require(_0x9901('0x2'));var rp=require(_0x9901('0x3'));var moment=require('moment');var BPromise=require(_0x9901('0x4'));var Mustache=require(_0x9901('0x5'));var util=require(_0x9901('0x6'));var path=require(_0x9901('0x7'));var sox=require(_0x9901('0x8'));var csv=require('to-csv');var ejs=require(_0x9901('0x9'));var fs=require('fs');var fs_extra=require(_0x9901('0xa'));var _=require('lodash');var squel=require(_0x9901('0xb'));var crypto=require(_0x9901('0xc'));var jsforce=require(_0x9901('0xd'));var deskjs=require(_0x9901('0xe'));var toCsv=require(_0x9901('0xf'));var querystring=require(_0x9901('0x10'));var Papa=require('papaparse');var Redis=require(_0x9901('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9901('0x12'));var as=require(_0x9901('0x13'));var hardwareService=require(_0x9901('0x14'));var logger=require(_0x9901('0x15'))(_0x9901('0x16'));var utils=require(_0x9901('0x17'));var config=require(_0x9901('0x18'));var licenseUtil=require(_0x9901('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f5c46,_0x2c61d9){_0x2c61d9=_0x2c61d9||0xcc;return function(_0x2a8597){if(_0x2a8597){return _0x2f5c46[_0x9901('0x1a')](_0x2c61d9);}return _0x2f5c46['status'](_0x2c61d9)[_0x9901('0x1b')]();};}function respondWithResult(_0x50682e,_0x2728fa){_0x2728fa=_0x2728fa||0xc8;return function(_0x543545){if(_0x543545){return _0x50682e[_0x9901('0x1c')](_0x2728fa)[_0x9901('0x1d')](_0x543545);}};}function respondWithFilteredResult(_0x72600b,_0x13bb45){return function(_0x486936){if(_0x486936){var _0x114b7c=typeof _0x13bb45[_0x9901('0x1e')]===_0x9901('0x1f')&&typeof _0x13bb45[_0x9901('0x20')]==='undefined';var _0x33a79c=_0x486936['count'];var _0x2a4214=_0x114b7c?0x0:_0x13bb45[_0x9901('0x1e')];var _0x464ed2=_0x114b7c?_0x486936[_0x9901('0x21')]:_0x13bb45[_0x9901('0x1e')]+_0x13bb45[_0x9901('0x20')];var _0x5e1193;if(_0x464ed2>=_0x33a79c){_0x464ed2=_0x33a79c;_0x5e1193=0xc8;}else{_0x5e1193=0xce;}_0x72600b[_0x9901('0x1c')](_0x5e1193);return _0x72600b[_0x9901('0x22')](_0x9901('0x23'),_0x2a4214+'-'+_0x464ed2+'/'+_0x33a79c)['json'](_0x486936);}return null;};}function patchUpdates(_0x4a3781){return function(_0x5de1d7){try{jsonpatch[_0x9901('0x24')](_0x5de1d7,_0x4a3781,!![]);}catch(_0x10463f){return BPromise[_0x9901('0x25')](_0x10463f);}return _0x5de1d7[_0x9901('0x26')]();};}function saveUpdates(_0x42acd8,_0x27f506){return function(_0x4693e3){if(_0x4693e3){return _0x4693e3[_0x9901('0x27')](_0x42acd8)['then'](function(_0x535fbc){return _0x535fbc;});}return null;};}function removeEntity(_0x15e566,_0x52a72b){return function(_0x46a298){if(_0x46a298){return _0x46a298[_0x9901('0x28')]()[_0x9901('0x29')](function(){_0x15e566[_0x9901('0x1c')](0xcc)[_0x9901('0x1b')]();});}};}function handleEntityNotFound(_0x723719,_0xf3e44e){return function(_0x241428){if(!_0x241428){_0x723719['sendStatus'](0x194);}return _0x241428;};}function handleError(_0x378442,_0x50c8d9){_0x50c8d9=_0x50c8d9||0x1f4;return function(_0x583f73){logger['error'](_0x583f73[_0x9901('0x2a')]);if(_0x583f73[_0x9901('0x2b')]){delete _0x583f73[_0x9901('0x2b')];}_0x378442[_0x9901('0x1c')](_0x50c8d9)[_0x9901('0x2c')](_0x583f73);};}exports['index']=function(_0x120e14,_0x21ae9a){var _0x54d264={},_0x4a50f3={},_0x35ede0={'count':0x0,'rows':[]};var _0x58b48b=_[_0x9901('0x2d')](db['MailServerOut'][_0x9901('0x2e')],function(_0x44d340){return{'name':_0x44d340[_0x9901('0x2f')],'type':_0x44d340[_0x9901('0x30')]['key']};});_0x4a50f3['model']=_[_0x9901('0x2d')](_0x58b48b,_0x9901('0x2b'));_0x4a50f3[_0x9901('0x31')]=_[_0x9901('0x32')](_0x120e14[_0x9901('0x31')]);_0x4a50f3[_0x9901('0x33')]=_[_0x9901('0x34')](_0x4a50f3[_0x9901('0x35')],_0x4a50f3[_0x9901('0x31')]);_0x54d264[_0x9901('0x36')]=_[_0x9901('0x34')](_0x4a50f3[_0x9901('0x35')],qs[_0x9901('0x37')](_0x120e14[_0x9901('0x31')][_0x9901('0x37')]));_0x54d264['attributes']=_0x54d264[_0x9901('0x36')][_0x9901('0x38')]?_0x54d264[_0x9901('0x36')]:_0x4a50f3[_0x9901('0x35')];if(!_0x120e14[_0x9901('0x31')][_0x9901('0x39')](_0x9901('0x3a'))){_0x54d264[_0x9901('0x20')]=qs['limit'](_0x120e14[_0x9901('0x31')][_0x9901('0x20')]);_0x54d264['offset']=qs[_0x9901('0x1e')](_0x120e14['query'][_0x9901('0x1e')]);}_0x54d264[_0x9901('0x3b')]=qs[_0x9901('0x3c')](_0x120e14['query']['sort']);_0x54d264[_0x9901('0x3d')]=qs['filters'](_[_0x9901('0x3e')](_0x120e14['query'],_0x4a50f3['filters']),_0x58b48b);if(_0x120e14['query']['filter']){_0x54d264[_0x9901('0x3d')]=_['merge'](_0x54d264[_0x9901('0x3d')],{'$or':_['map'](_0x58b48b,function(_0x2724ec){if(_0x2724ec[_0x9901('0x30')]!==_0x9901('0x3f')){var _0x3c77a5={};_0x3c77a5[_0x2724ec[_0x9901('0x2b')]]={'$like':'%'+_0x120e14[_0x9901('0x31')][_0x9901('0x40')]+'%'};return _0x3c77a5;}})});}_0x54d264=_[_0x9901('0x41')]({},_0x54d264,_0x120e14[_0x9901('0x42')]);var _0x4a3a5e={'where':_0x54d264['where']};return db[_0x9901('0x43')][_0x9901('0x21')](_0x4a3a5e)['then'](function(_0x1458c7){_0x35ede0[_0x9901('0x21')]=_0x1458c7;if(_0x120e14[_0x9901('0x31')][_0x9901('0x44')]){_0x54d264[_0x9901('0x45')]=[{'all':!![]}];}return db[_0x9901('0x43')][_0x9901('0x46')](_0x54d264);})[_0x9901('0x29')](function(_0x165c95){_0x35ede0[_0x9901('0x47')]=_0x165c95;return _0x35ede0;})['then'](respondWithFilteredResult(_0x21ae9a,_0x54d264))[_0x9901('0x48')](handleError(_0x21ae9a,null));};exports[_0x9901('0x49')]=function(_0x347de7,_0x150a7d){var _0x1a6460={'raw':!![],'where':{'id':_0x347de7[_0x9901('0x4a')]['id']}},_0x2d08c7={};_0x2d08c7['model']=_[_0x9901('0x32')](db[_0x9901('0x43')][_0x9901('0x2e')]);_0x2d08c7[_0x9901('0x31')]=_[_0x9901('0x32')](_0x347de7[_0x9901('0x31')]);_0x2d08c7[_0x9901('0x33')]=_[_0x9901('0x34')](_0x2d08c7[_0x9901('0x35')],_0x2d08c7[_0x9901('0x31')]);_0x1a6460[_0x9901('0x36')]=_['intersection'](_0x2d08c7[_0x9901('0x35')],qs['fields'](_0x347de7['query'][_0x9901('0x37')]));_0x1a6460[_0x9901('0x36')]=_0x1a6460[_0x9901('0x36')]['length']?_0x1a6460[_0x9901('0x36')]:_0x2d08c7[_0x9901('0x35')];if(_0x347de7[_0x9901('0x31')][_0x9901('0x44')]){_0x1a6460[_0x9901('0x45')]=[{'all':!![]}];}_0x1a6460=_['merge']({},_0x1a6460,_0x347de7['options']);return db[_0x9901('0x43')][_0x9901('0x4b')](_0x1a6460)[_0x9901('0x29')](handleEntityNotFound(_0x150a7d,null))[_0x9901('0x29')](respondWithResult(_0x150a7d,null))['catch'](handleError(_0x150a7d,null));};exports[_0x9901('0x4c')]=function(_0x15a883,_0x14c1f8){return db[_0x9901('0x43')][_0x9901('0x4c')](_0x15a883['body'],{})[_0x9901('0x29')](respondWithResult(_0x14c1f8,0xc9))[_0x9901('0x48')](handleError(_0x14c1f8,null));};exports['update']=function(_0x3bda09,_0xe9b23d){if(_0x3bda09[_0x9901('0x4d')]['id']){delete _0x3bda09[_0x9901('0x4d')]['id'];}return db['MailServerOut'][_0x9901('0x4b')]({'where':{'id':_0x3bda09['params']['id']}})[_0x9901('0x29')](handleEntityNotFound(_0xe9b23d,null))['then'](saveUpdates(_0x3bda09[_0x9901('0x4d')],null))['then'](respondWithResult(_0xe9b23d,null))[_0x9901('0x48')](handleError(_0xe9b23d,null));};exports[_0x9901('0x28')]=function(_0x496101,_0x13dc18){return db[_0x9901('0x43')][_0x9901('0x4b')]({'where':{'id':_0x496101[_0x9901('0x4a')]['id']}})[_0x9901('0x29')](handleEntityNotFound(_0x13dc18,null))[_0x9901('0x29')](removeEntity(_0x13dc18,null))[_0x9901('0x48')](handleError(_0x13dc18,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 0251507..4c6159f 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 _0x74f8=['bluebird','request-promise','path','rimraf','./mailServerOut.attributes','define','mail_servers_out','util','api'];(function(_0x1103c4,_0x562d1d){var _0x1c19ab=function(_0x10e254){while(--_0x10e254){_0x1103c4['push'](_0x1103c4['shift']());}};_0x1c19ab(++_0x562d1d);}(_0x74f8,0x193));var _0x874f=function(_0x37b7a0,_0x2ee4f5){_0x37b7a0=_0x37b7a0-0x0;var _0x4fb461=_0x74f8[_0x37b7a0];return _0x4fb461;};'use strict';var _=require('lodash');var util=require(_0x874f('0x0'));var logger=require('../../config/logger')(_0x874f('0x1'));var moment=require('moment');var BPromise=require(_0x874f('0x2'));var rp=require(_0x874f('0x3'));var fs=require('fs');var path=require(_0x874f('0x4'));var rimraf=require(_0x874f('0x5'));var config=require('../../config/environment');var attributes=require(_0x874f('0x6'));module['exports']=function(_0x3eb03b,_0x36cbea){return _0x3eb03b[_0x874f('0x7')]('MailServerOut',attributes,{'tableName':_0x874f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f7f=['define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0x2f7f,0xbe));var _0xf2f7=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x2f7f[_0x568496];return _0x26c5c1;};'use strict';var _=require(_0xf2f7('0x0'));var util=require(_0xf2f7('0x1'));var logger=require(_0xf2f7('0x2'))('api');var moment=require(_0xf2f7('0x3'));var BPromise=require('bluebird');var rp=require(_0xf2f7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf2f7('0x5'));var attributes=require(_0xf2f7('0x6'));module[_0xf2f7('0x7')]=function(_0x58be1e,_0x276057){return _0x58be1e[_0xf2f7('0x8')](_0xf2f7('0x9'),attributes,{'tableName':_0xf2f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index c4c30eb..7bbebbf 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x1b3bee,_0xae2f60){var _0x1efd9f=function(_0x1e2ddf){while(--_0x1e2ddf){_0x1b3bee['push'](_0x1b3bee['shift']());}};_0x1efd9f(++_0xae2f60);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x15d111,_0x1feb3d){var _0x159c1c=function(_0xccffbc){while(--_0xccffbc){_0x15d111['push'](_0x15d111['shift']());}};_0x159c1c(++_0x1feb3d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4d7aaf,_0xb955da){_0x4d7aaf=_0x4d7aaf-0x0;var _0x33fb7b=_0x5f2f[_0x4d7aaf];return _0x33fb7b;};'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')]('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index ed3f4b5..66fc1e2 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 _0xdc0a=['show','post','create','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x17302a,_0x1af632){var _0x70f938=function(_0x25a995){while(--_0x25a995){_0x17302a['push'](_0x17302a['shift']());}};_0x70f938(++_0x1af632);}(_0xdc0a,0x96));var _0xadc0=function(_0x335806,_0x5e7dbf){_0x335806=_0x335806-0x0;var _0x2de72b=_0xdc0a[_0x335806];return _0x2de72b;};'use strict';var multer=require('multer');var util=require(_0xadc0('0x0'));var path=require('path');var timeout=require(_0xadc0('0x1'));var express=require(_0xadc0('0x2'));var router=express['Router']();var fs_extra=require(_0xadc0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xadc0('0x4'));var config=require(_0xadc0('0x5'));var controller=require(_0xadc0('0x6'));router['get']('/',auth[_0xadc0('0x7')](),controller[_0xadc0('0x8')]);router[_0xadc0('0x9')]('/describe',auth[_0xadc0('0x7')](),controller[_0xadc0('0xa')]);router['get'](_0xadc0('0xb'),auth[_0xadc0('0x7')](),controller[_0xadc0('0xc')]);router[_0xadc0('0xd')]('/',auth[_0xadc0('0x7')](),controller[_0xadc0('0xe')]);router['put'](_0xadc0('0xb'),auth[_0xadc0('0x7')](),controller['update']);router[_0xadc0('0xf')]('/:id',auth[_0xadc0('0x7')](),controller[_0xadc0('0x10')]);module[_0xadc0('0x11')]=router; \ No newline at end of file +var _0x0ca3=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/:id','show','post','put','update'];(function(_0x22e6ec,_0x78f3d9){var _0x30b94f=function(_0x4f4b27){while(--_0x4f4b27){_0x22e6ec['push'](_0x22e6ec['shift']());}};_0x30b94f(++_0x78f3d9);}(_0x0ca3,0x114));var _0x30ca=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0x0ca3[_0xfbdff6];return _0x4cb9be;};'use strict';var multer=require(_0x30ca('0x0'));var util=require(_0x30ca('0x1'));var path=require(_0x30ca('0x2'));var timeout=require(_0x30ca('0x3'));var express=require('express');var router=express[_0x30ca('0x4')]();var fs_extra=require(_0x30ca('0x5'));var auth=require(_0x30ca('0x6'));var interaction=require(_0x30ca('0x7'));var config=require(_0x30ca('0x8'));var controller=require(_0x30ca('0x9'));router['get']('/',auth[_0x30ca('0xa')](),controller[_0x30ca('0xb')]);router[_0x30ca('0xc')]('/describe',auth[_0x30ca('0xa')](),controller['describe']);router[_0x30ca('0xc')](_0x30ca('0xd'),auth['isAuthenticated'](),controller[_0x30ca('0xe')]);router[_0x30ca('0xf')]('/',auth[_0x30ca('0xa')](),controller['create']);router[_0x30ca('0x10')](_0x30ca('0xd'),auth[_0x30ca('0xa')](),controller[_0x30ca('0x11')]);router[_0x30ca('0x12')](_0x30ca('0xd'),auth[_0x30ca('0xa')](),controller[_0x30ca('0x13')]);module[_0x30ca('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index dc72500..1610329 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 _0x2eb2=['name','exports','STRING'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0x2eb2,0x19f));var _0x22eb=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x2eb2[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'unique':_0x22eb('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x22eb('0x1')]}}; \ No newline at end of file +var _0x8506=['exports','name'];(function(_0x416447,_0x399384){var _0x1d668b=function(_0x19ca87){while(--_0x19ca87){_0x416447['push'](_0x416447['shift']());}};_0x1d668b(++_0x399384);}(_0x8506,0xe8));var _0x6850=function(_0x51b0aa,_0x4b52ac){_0x51b0aa=_0x51b0aa-0x0;var _0x16a5ca=_0x8506[_0x51b0aa];return _0x16a5ca;};'use strict';var Sequelize=require('sequelize');module[_0x6850('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6850('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index be823c3..df09b76 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 _0x4a0d=['map','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','MailSubstatus','count','includeAll','include','rows','catch','show','params','rawAttributes','length','merge','options','create','body','find','describe','zip-dir','request-promise','bluebird','mustache','util','path','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','save','update','then','destroy','error','stack','name'];(function(_0x49d054,_0xf1039c){var _0x56d143=function(_0x5efd31){while(--_0x5efd31){_0x49d054['push'](_0x49d054['shift']());}};_0x56d143(++_0xf1039c);}(_0x4a0d,0x199));var _0xd4a0=function(_0x3ec74e,_0x2f6536){_0x3ec74e=_0x3ec74e-0x0;var _0x5a53f9=_0x4a0d[_0x3ec74e];return _0x5a53f9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd4a0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd4a0('0x1'));var moment=require('moment');var BPromise=require(_0xd4a0('0x2'));var Mustache=require(_0xd4a0('0x3'));var util=require(_0xd4a0('0x4'));var path=require(_0xd4a0('0x5'));var sox=require('sox');var csv=require(_0xd4a0('0x6'));var ejs=require(_0xd4a0('0x7'));var fs=require('fs');var fs_extra=require(_0xd4a0('0x8'));var _=require(_0xd4a0('0x9'));var squel=require('squel');var crypto=require(_0xd4a0('0xa'));var jsforce=require(_0xd4a0('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd4a0('0xc'));var Papa=require(_0xd4a0('0xd'));var Redis=require(_0xd4a0('0xe'));var authService=require(_0xd4a0('0xf'));var qs=require(_0xd4a0('0x10'));var as=require(_0xd4a0('0x11'));var hardwareService=require(_0xd4a0('0x12'));var logger=require(_0xd4a0('0x13'))(_0xd4a0('0x14'));var utils=require(_0xd4a0('0x15'));var config=require(_0xd4a0('0x16'));var licenseUtil=require(_0xd4a0('0x17'));var db=require(_0xd4a0('0x18'))['db'];function respondWithStatusCode(_0x7ab492,_0x13f73a){_0x13f73a=_0x13f73a||0xcc;return function(_0x287099){if(_0x287099){return _0x7ab492[_0xd4a0('0x19')](_0x13f73a);}return _0x7ab492[_0xd4a0('0x1a')](_0x13f73a)[_0xd4a0('0x1b')]();};}function respondWithResult(_0x193269,_0x215c19){_0x215c19=_0x215c19||0xc8;return function(_0x34e460){if(_0x34e460){return _0x193269[_0xd4a0('0x1a')](_0x215c19)[_0xd4a0('0x1c')](_0x34e460);}};}function respondWithFilteredResult(_0x521b3b,_0x3662c6){return function(_0x3fe70b){if(_0x3fe70b){var _0x69cbe8=typeof _0x3662c6['offset']==='undefined'&&typeof _0x3662c6[_0xd4a0('0x1d')]===_0xd4a0('0x1e');var _0x7c6a37=_0x3fe70b['count'];var _0x254d84=_0x69cbe8?0x0:_0x3662c6[_0xd4a0('0x1f')];var _0x271c10=_0x69cbe8?_0x3fe70b['count']:_0x3662c6['offset']+_0x3662c6[_0xd4a0('0x1d')];var _0x28c584;if(_0x271c10>=_0x7c6a37){_0x271c10=_0x7c6a37;_0x28c584=0xc8;}else{_0x28c584=0xce;}_0x521b3b[_0xd4a0('0x1a')](_0x28c584);return _0x521b3b[_0xd4a0('0x20')](_0xd4a0('0x21'),_0x254d84+'-'+_0x271c10+'/'+_0x7c6a37)[_0xd4a0('0x1c')](_0x3fe70b);}return null;};}function patchUpdates(_0x43211b){return function(_0x5a5d91){try{jsonpatch['apply'](_0x5a5d91,_0x43211b,!![]);}catch(_0x5ed29a){return BPromise['reject'](_0x5ed29a);}return _0x5a5d91[_0xd4a0('0x22')]();};}function saveUpdates(_0x1e0218,_0x1f916a){return function(_0x537902){if(_0x537902){return _0x537902[_0xd4a0('0x23')](_0x1e0218)[_0xd4a0('0x24')](function(_0x639684){return _0x639684;});}return null;};}function removeEntity(_0x41e600,_0x2487c2){return function(_0xa00a95){if(_0xa00a95){return _0xa00a95[_0xd4a0('0x25')]()[_0xd4a0('0x24')](function(){_0x41e600['status'](0xcc)[_0xd4a0('0x1b')]();});}};}function handleEntityNotFound(_0xd64a91,_0x5cf41f){return function(_0x4ee875){if(!_0x4ee875){_0xd64a91[_0xd4a0('0x19')](0x194);}return _0x4ee875;};}function handleError(_0x79c8fb,_0x274814){_0x274814=_0x274814||0x1f4;return function(_0x29edbc){logger[_0xd4a0('0x26')](_0x29edbc[_0xd4a0('0x27')]);if(_0x29edbc['name']){delete _0x29edbc[_0xd4a0('0x28')];}_0x79c8fb[_0xd4a0('0x1a')](_0x274814)['send'](_0x29edbc);};}exports['index']=function(_0x4e3cdc,_0x59dffe){var _0x500cc7={},_0x59abe2={},_0x172d90={'count':0x0,'rows':[]};var _0x32f81d=_[_0xd4a0('0x29')](db['MailSubstatus']['rawAttributes'],function(_0x399d2a){return{'name':_0x399d2a[_0xd4a0('0x2a')],'type':_0x399d2a[_0xd4a0('0x2b')][_0xd4a0('0x2c')]};});_0x59abe2['model']=_[_0xd4a0('0x29')](_0x32f81d,_0xd4a0('0x28'));_0x59abe2['query']=_[_0xd4a0('0x2d')](_0x4e3cdc[_0xd4a0('0x2e')]);_0x59abe2[_0xd4a0('0x2f')]=_['intersection'](_0x59abe2['model'],_0x59abe2[_0xd4a0('0x2e')]);_0x500cc7[_0xd4a0('0x30')]=_[_0xd4a0('0x31')](_0x59abe2[_0xd4a0('0x32')],qs[_0xd4a0('0x33')](_0x4e3cdc['query'][_0xd4a0('0x33')]));_0x500cc7['attributes']=_0x500cc7['attributes']['length']?_0x500cc7[_0xd4a0('0x30')]:_0x59abe2[_0xd4a0('0x32')];if(!_0x4e3cdc[_0xd4a0('0x2e')][_0xd4a0('0x34')](_0xd4a0('0x35'))){_0x500cc7[_0xd4a0('0x1d')]=qs[_0xd4a0('0x1d')](_0x4e3cdc['query'][_0xd4a0('0x1d')]);_0x500cc7[_0xd4a0('0x1f')]=qs['offset'](_0x4e3cdc[_0xd4a0('0x2e')][_0xd4a0('0x1f')]);}_0x500cc7['order']=qs[_0xd4a0('0x36')](_0x4e3cdc[_0xd4a0('0x2e')][_0xd4a0('0x36')]);_0x500cc7['where']=qs[_0xd4a0('0x2f')](_[_0xd4a0('0x37')](_0x4e3cdc[_0xd4a0('0x2e')],_0x59abe2[_0xd4a0('0x2f')]),_0x32f81d);if(_0x4e3cdc[_0xd4a0('0x2e')][_0xd4a0('0x38')]){_0x500cc7[_0xd4a0('0x39')]=_['merge'](_0x500cc7[_0xd4a0('0x39')],{'$or':_['map'](_0x32f81d,function(_0x22ddae){if(_0x22ddae['type']!==_0xd4a0('0x3a')){var _0x558188={};_0x558188[_0x22ddae['name']]={'$like':'%'+_0x4e3cdc[_0xd4a0('0x2e')][_0xd4a0('0x38')]+'%'};return _0x558188;}})});}_0x500cc7=_['merge']({},_0x500cc7,_0x4e3cdc['options']);var _0x22e0c0={'where':_0x500cc7[_0xd4a0('0x39')]};return db[_0xd4a0('0x3b')][_0xd4a0('0x3c')](_0x22e0c0)[_0xd4a0('0x24')](function(_0x4f9ddd){_0x172d90['count']=_0x4f9ddd;if(_0x4e3cdc[_0xd4a0('0x2e')][_0xd4a0('0x3d')]){_0x500cc7[_0xd4a0('0x3e')]=[{'all':!![]}];}return db[_0xd4a0('0x3b')]['findAll'](_0x500cc7);})[_0xd4a0('0x24')](function(_0x4dcaf2){_0x172d90[_0xd4a0('0x3f')]=_0x4dcaf2;return _0x172d90;})[_0xd4a0('0x24')](respondWithFilteredResult(_0x59dffe,_0x500cc7))[_0xd4a0('0x40')](handleError(_0x59dffe,null));};exports[_0xd4a0('0x41')]=function(_0x262d1b,_0x3e9d55){var _0x1ca19={'raw':!![],'where':{'id':_0x262d1b[_0xd4a0('0x42')]['id']}},_0x1bba87={};_0x1bba87[_0xd4a0('0x32')]=_[_0xd4a0('0x2d')](db[_0xd4a0('0x3b')][_0xd4a0('0x43')]);_0x1bba87['query']=_[_0xd4a0('0x2d')](_0x262d1b[_0xd4a0('0x2e')]);_0x1bba87[_0xd4a0('0x2f')]=_['intersection'](_0x1bba87[_0xd4a0('0x32')],_0x1bba87[_0xd4a0('0x2e')]);_0x1ca19[_0xd4a0('0x30')]=_['intersection'](_0x1bba87[_0xd4a0('0x32')],qs[_0xd4a0('0x33')](_0x262d1b[_0xd4a0('0x2e')][_0xd4a0('0x33')]));_0x1ca19[_0xd4a0('0x30')]=_0x1ca19[_0xd4a0('0x30')][_0xd4a0('0x44')]?_0x1ca19['attributes']:_0x1bba87[_0xd4a0('0x32')];if(_0x262d1b['query'][_0xd4a0('0x3d')]){_0x1ca19[_0xd4a0('0x3e')]=[{'all':!![]}];}_0x1ca19=_[_0xd4a0('0x45')]({},_0x1ca19,_0x262d1b[_0xd4a0('0x46')]);return db[_0xd4a0('0x3b')]['find'](_0x1ca19)['then'](handleEntityNotFound(_0x3e9d55,null))[_0xd4a0('0x24')](respondWithResult(_0x3e9d55,null))[_0xd4a0('0x40')](handleError(_0x3e9d55,null));};exports[_0xd4a0('0x47')]=function(_0x2fc78a,_0xc2cb57){return db['MailSubstatus'][_0xd4a0('0x47')](_0x2fc78a[_0xd4a0('0x48')],{})[_0xd4a0('0x24')](respondWithResult(_0xc2cb57,0xc9))[_0xd4a0('0x40')](handleError(_0xc2cb57,null));};exports[_0xd4a0('0x23')]=function(_0x20f697,_0x58da24){if(_0x20f697[_0xd4a0('0x48')]['id']){delete _0x20f697[_0xd4a0('0x48')]['id'];}return db[_0xd4a0('0x3b')][_0xd4a0('0x49')]({'where':{'id':_0x20f697['params']['id']}})[_0xd4a0('0x24')](handleEntityNotFound(_0x58da24,null))[_0xd4a0('0x24')](saveUpdates(_0x20f697[_0xd4a0('0x48')],null))[_0xd4a0('0x24')](respondWithResult(_0x58da24,null))[_0xd4a0('0x40')](handleError(_0x58da24,null));};exports['destroy']=function(_0x1c024d,_0x120ce7){return db[_0xd4a0('0x3b')][_0xd4a0('0x49')]({'where':{'id':_0x1c024d['params']['id']}})['then'](handleEntityNotFound(_0x120ce7,null))[_0xd4a0('0x24')](removeEntity(_0x120ce7,null))[_0xd4a0('0x40')](handleError(_0x120ce7,null));};exports[_0xd4a0('0x4a')]=function(_0x3a2808,_0x58510d){return db[_0xd4a0('0x3b')]['describe']()[_0xd4a0('0x24')](respondWithResult(_0x58510d,null))['catch'](handleError(_0x58510d,null));}; \ No newline at end of file +var _0xc4af=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','name','index','MailSubstatus','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','include','findAll','catch','show','params','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0xc4af,0x1a3));var _0xfc4a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc4af[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xfc4a('0x0'));var rimraf=require(_0xfc4a('0x1'));var zipdir=require(_0xfc4a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc4a('0x3'));var moment=require(_0xfc4a('0x4'));var BPromise=require(_0xfc4a('0x5'));var Mustache=require(_0xfc4a('0x6'));var util=require(_0xfc4a('0x7'));var path=require(_0xfc4a('0x8'));var sox=require(_0xfc4a('0x9'));var csv=require(_0xfc4a('0xa'));var ejs=require(_0xfc4a('0xb'));var fs=require('fs');var fs_extra=require(_0xfc4a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfc4a('0xd'));var deskjs=require(_0xfc4a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfc4a('0xf'));var Papa=require('papaparse');var Redis=require(_0xfc4a('0x10'));var authService=require(_0xfc4a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfc4a('0x12'));var hardwareService=require(_0xfc4a('0x13'));var logger=require(_0xfc4a('0x14'))(_0xfc4a('0x15'));var utils=require(_0xfc4a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfc4a('0x17'));var db=require(_0xfc4a('0x18'))['db'];function respondWithStatusCode(_0x27ed5a,_0x56790f){_0x56790f=_0x56790f||0xcc;return function(_0x5cc239){if(_0x5cc239){return _0x27ed5a[_0xfc4a('0x19')](_0x56790f);}return _0x27ed5a['status'](_0x56790f)[_0xfc4a('0x1a')]();};}function respondWithResult(_0x1b5d1d,_0x3b0a59){_0x3b0a59=_0x3b0a59||0xc8;return function(_0x230d27){if(_0x230d27){return _0x1b5d1d[_0xfc4a('0x1b')](_0x3b0a59)[_0xfc4a('0x1c')](_0x230d27);}};}function respondWithFilteredResult(_0x40d59f,_0x40387b){return function(_0x2ca40c){if(_0x2ca40c){var _0x4d68c6=typeof _0x40387b[_0xfc4a('0x1d')]===_0xfc4a('0x1e')&&typeof _0x40387b['limit']===_0xfc4a('0x1e');var _0x5c062e=_0x2ca40c[_0xfc4a('0x1f')];var _0x302535=_0x4d68c6?0x0:_0x40387b[_0xfc4a('0x1d')];var _0x13af6a=_0x4d68c6?_0x2ca40c[_0xfc4a('0x1f')]:_0x40387b[_0xfc4a('0x1d')]+_0x40387b[_0xfc4a('0x20')];var _0xcc3263;if(_0x13af6a>=_0x5c062e){_0x13af6a=_0x5c062e;_0xcc3263=0xc8;}else{_0xcc3263=0xce;}_0x40d59f[_0xfc4a('0x1b')](_0xcc3263);return _0x40d59f['set'](_0xfc4a('0x21'),_0x302535+'-'+_0x13af6a+'/'+_0x5c062e)[_0xfc4a('0x1c')](_0x2ca40c);}return null;};}function patchUpdates(_0x9d0654){return function(_0x1813a7){try{jsonpatch['apply'](_0x1813a7,_0x9d0654,!![]);}catch(_0x3f8518){return BPromise[_0xfc4a('0x22')](_0x3f8518);}return _0x1813a7[_0xfc4a('0x23')]();};}function saveUpdates(_0x611a6e,_0x7463e9){return function(_0x4877f0){if(_0x4877f0){return _0x4877f0[_0xfc4a('0x24')](_0x611a6e)[_0xfc4a('0x25')](function(_0x5e899c){return _0x5e899c;});}return null;};}function removeEntity(_0x388c16,_0x42625c){return function(_0x5a0427){if(_0x5a0427){return _0x5a0427[_0xfc4a('0x26')]()[_0xfc4a('0x25')](function(){_0x388c16[_0xfc4a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x162f9b,_0x199c41){return function(_0x4db779){if(!_0x4db779){_0x162f9b[_0xfc4a('0x19')](0x194);}return _0x4db779;};}function handleError(_0x1f5a32,_0x51ffb4){_0x51ffb4=_0x51ffb4||0x1f4;return function(_0x2527da){logger[_0xfc4a('0x27')](_0x2527da['stack']);if(_0x2527da['name']){delete _0x2527da[_0xfc4a('0x28')];}_0x1f5a32[_0xfc4a('0x1b')](_0x51ffb4)['send'](_0x2527da);};}exports[_0xfc4a('0x29')]=function(_0x349dfa,_0x430613){var _0x189e8b={},_0x1dffa3={},_0x4591a7={'count':0x0,'rows':[]};var _0x747e9=_['map'](db[_0xfc4a('0x2a')][_0xfc4a('0x2b')],function(_0x1b0f37){return{'name':_0x1b0f37[_0xfc4a('0x2c')],'type':_0x1b0f37[_0xfc4a('0x2d')][_0xfc4a('0x2e')]};});_0x1dffa3[_0xfc4a('0x2f')]=_[_0xfc4a('0x30')](_0x747e9,_0xfc4a('0x28'));_0x1dffa3[_0xfc4a('0x31')]=_[_0xfc4a('0x32')](_0x349dfa[_0xfc4a('0x31')]);_0x1dffa3[_0xfc4a('0x33')]=_[_0xfc4a('0x34')](_0x1dffa3[_0xfc4a('0x2f')],_0x1dffa3[_0xfc4a('0x31')]);_0x189e8b[_0xfc4a('0x35')]=_[_0xfc4a('0x34')](_0x1dffa3[_0xfc4a('0x2f')],qs[_0xfc4a('0x36')](_0x349dfa['query'][_0xfc4a('0x36')]));_0x189e8b[_0xfc4a('0x35')]=_0x189e8b[_0xfc4a('0x35')][_0xfc4a('0x37')]?_0x189e8b[_0xfc4a('0x35')]:_0x1dffa3['model'];if(!_0x349dfa[_0xfc4a('0x31')][_0xfc4a('0x38')]('nolimit')){_0x189e8b['limit']=qs['limit'](_0x349dfa[_0xfc4a('0x31')]['limit']);_0x189e8b[_0xfc4a('0x1d')]=qs[_0xfc4a('0x1d')](_0x349dfa[_0xfc4a('0x31')][_0xfc4a('0x1d')]);}_0x189e8b['order']=qs[_0xfc4a('0x39')](_0x349dfa['query'][_0xfc4a('0x39')]);_0x189e8b[_0xfc4a('0x3a')]=qs['filters'](_['pick'](_0x349dfa[_0xfc4a('0x31')],_0x1dffa3['filters']),_0x747e9);if(_0x349dfa[_0xfc4a('0x31')][_0xfc4a('0x3b')]){_0x189e8b[_0xfc4a('0x3a')]=_[_0xfc4a('0x3c')](_0x189e8b[_0xfc4a('0x3a')],{'$or':_[_0xfc4a('0x30')](_0x747e9,function(_0x44c234){if(_0x44c234[_0xfc4a('0x2d')]!=='VIRTUAL'){var _0x29bc69={};_0x29bc69[_0x44c234[_0xfc4a('0x28')]]={'$like':'%'+_0x349dfa['query'][_0xfc4a('0x3b')]+'%'};return _0x29bc69;}})});}_0x189e8b=_[_0xfc4a('0x3c')]({},_0x189e8b,_0x349dfa[_0xfc4a('0x3d')]);var _0x17a137={'where':_0x189e8b[_0xfc4a('0x3a')]};return db[_0xfc4a('0x2a')][_0xfc4a('0x1f')](_0x17a137)[_0xfc4a('0x25')](function(_0x2b3da0){_0x4591a7['count']=_0x2b3da0;if(_0x349dfa[_0xfc4a('0x31')]['includeAll']){_0x189e8b[_0xfc4a('0x3e')]=[{'all':!![]}];}return db[_0xfc4a('0x2a')][_0xfc4a('0x3f')](_0x189e8b);})['then'](function(_0xa60770){_0x4591a7['rows']=_0xa60770;return _0x4591a7;})[_0xfc4a('0x25')](respondWithFilteredResult(_0x430613,_0x189e8b))[_0xfc4a('0x40')](handleError(_0x430613,null));};exports[_0xfc4a('0x41')]=function(_0x25daba,_0xb238a5){var _0x4bb4fb={'raw':!![],'where':{'id':_0x25daba[_0xfc4a('0x42')]['id']}},_0xe15467={};_0xe15467[_0xfc4a('0x2f')]=_[_0xfc4a('0x32')](db[_0xfc4a('0x2a')][_0xfc4a('0x2b')]);_0xe15467[_0xfc4a('0x31')]=_[_0xfc4a('0x32')](_0x25daba[_0xfc4a('0x31')]);_0xe15467[_0xfc4a('0x33')]=_['intersection'](_0xe15467[_0xfc4a('0x2f')],_0xe15467['query']);_0x4bb4fb[_0xfc4a('0x35')]=_['intersection'](_0xe15467['model'],qs[_0xfc4a('0x36')](_0x25daba[_0xfc4a('0x31')][_0xfc4a('0x36')]));_0x4bb4fb['attributes']=_0x4bb4fb[_0xfc4a('0x35')][_0xfc4a('0x37')]?_0x4bb4fb['attributes']:_0xe15467[_0xfc4a('0x2f')];if(_0x25daba[_0xfc4a('0x31')][_0xfc4a('0x43')]){_0x4bb4fb[_0xfc4a('0x3e')]=[{'all':!![]}];}_0x4bb4fb=_['merge']({},_0x4bb4fb,_0x25daba[_0xfc4a('0x3d')]);return db['MailSubstatus']['find'](_0x4bb4fb)[_0xfc4a('0x25')](handleEntityNotFound(_0xb238a5,null))['then'](respondWithResult(_0xb238a5,null))[_0xfc4a('0x40')](handleError(_0xb238a5,null));};exports[_0xfc4a('0x44')]=function(_0x38e72c,_0x7e9e46){return db[_0xfc4a('0x2a')][_0xfc4a('0x44')](_0x38e72c[_0xfc4a('0x45')],{})['then'](respondWithResult(_0x7e9e46,0xc9))[_0xfc4a('0x40')](handleError(_0x7e9e46,null));};exports[_0xfc4a('0x24')]=function(_0x4f9778,_0x5845b0){if(_0x4f9778[_0xfc4a('0x45')]['id']){delete _0x4f9778['body']['id'];}return db[_0xfc4a('0x2a')][_0xfc4a('0x46')]({'where':{'id':_0x4f9778[_0xfc4a('0x42')]['id']}})[_0xfc4a('0x25')](handleEntityNotFound(_0x5845b0,null))[_0xfc4a('0x25')](saveUpdates(_0x4f9778[_0xfc4a('0x45')],null))[_0xfc4a('0x25')](respondWithResult(_0x5845b0,null))[_0xfc4a('0x40')](handleError(_0x5845b0,null));};exports['destroy']=function(_0x3f4af1,_0x5d2aa4){return db[_0xfc4a('0x2a')][_0xfc4a('0x46')]({'where':{'id':_0x3f4af1[_0xfc4a('0x42')]['id']}})[_0xfc4a('0x25')](handleEntityNotFound(_0x5d2aa4,null))[_0xfc4a('0x25')](removeEntity(_0x5d2aa4,null))[_0xfc4a('0x40')](handleError(_0x5d2aa4,null));};exports[_0xfc4a('0x47')]=function(_0x318fbf,_0x35d829){return db[_0xfc4a('0x2a')]['describe']()['then'](respondWithResult(_0x35d829,null))[_0xfc4a('0x40')](handleError(_0x35d829,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 70f8e76..cbe8f1b 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 _0x03c0=['hook','exports','events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x3096c8,_0x4cf94c){var _0x4cb984=function(_0x5a1efc){while(--_0x5a1efc){_0x3096c8['push'](_0x3096c8['shift']());}};_0x4cb984(++_0x4cf94c);}(_0x03c0,0x6a));var _0x003c=function(_0x489e3b,_0x4728af){_0x489e3b=_0x489e3b-0x0;var _0x32b6cc=_0x03c0[_0x489e3b];return _0x32b6cc;};'use strict';var EventEmitter=require(_0x003c('0x0'));var MailSubstatus=require(_0x003c('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x003c('0x2')](0x0);var events={'afterUpdate':_0x003c('0x3')};function emitEvent(_0x280924){return function(_0x137f99,_0xe34621,_0x21dc8c){MailSubstatusEvents[_0x003c('0x4')](_0x280924+':'+_0x137f99['id'],_0x137f99);MailSubstatusEvents['emit'](_0x280924,_0x137f99);_0x21dc8c(null);};}for(var e in events){if(events[_0x003c('0x5')](e)){var event=events[e];MailSubstatus[_0x003c('0x6')](e,emitEvent(event));}}module[_0x003c('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x6abb=['setMaxListeners','update','emit','hook','exports','../../mysqldb'];(function(_0x44532f,_0x2dac86){var _0x11e878=function(_0x1cb557){while(--_0x1cb557){_0x44532f['push'](_0x44532f['shift']());}};_0x11e878(++_0x2dac86);}(_0x6abb,0xf5));var _0xb6ab=function(_0x42f8fb,_0x326d5b){_0x42f8fb=_0x42f8fb-0x0;var _0x3e3df9=_0x6abb[_0x42f8fb];return _0x3e3df9;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xb6ab('0x0'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xb6ab('0x1')](0x0);var events={'afterUpdate':_0xb6ab('0x2')};function emitEvent(_0x9b638c){return function(_0x202ec0,_0x53a6e5,_0x55d0db){MailSubstatusEvents[_0xb6ab('0x3')](_0x9b638c+':'+_0x202ec0['id'],_0x202ec0);MailSubstatusEvents[_0xb6ab('0x3')](_0x9b638c,_0x202ec0);_0x55d0db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xb6ab('0x4')](e,emitEvent(event));}}module[_0xb6ab('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index ac86044..56ebd48 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 _0x7c5f=['MailSubstatus','mail_substatuses','update','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports','define'];(function(_0x238e7a,_0x5b7bea){var _0xb72185=function(_0x4b66d5){while(--_0x4b66d5){_0x238e7a['push'](_0x238e7a['shift']());}};_0xb72185(++_0x5b7bea);}(_0x7c5f,0x1aa));var _0xf7c5=function(_0x5088b8,_0x1770bb){_0x5088b8=_0x5088b8-0x0;var _0x471f79=_0x7c5f[_0x5088b8];return _0x471f79;};'use strict';var attributes=require(_0xf7c5('0x0'));module[_0xf7c5('0x1')]=function(_0x2dff83){var _0x444ee3=_0x2dff83['models'];return _0x2dff83[_0xf7c5('0x2')](_0xf7c5('0x3'),attributes,{'tableName':_0xf7c5('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3727e1,_0x553bd8,_0x4aa204){return _0x444ee3['Condition'][_0xf7c5('0x5')]({'value':_0x3727e1['name']},{'where':{'field':_0xf7c5('0x6'),'value':_0x3727e1[_0xf7c5('0x7')][_0xf7c5('0x8')]}})[_0xf7c5('0x9')](function(){_0x4aa204();})[_0xf7c5('0xa')](function(_0x2d9762){_0x4aa204(_0x2d9762);});}}});}; \ No newline at end of file +var _0xcaa7=['exports','models','MailSubstatus','mail_substatuses','Condition','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes'];(function(_0x3a84e7,_0x3ea135){var _0x1f7d06=function(_0x86eb1d){while(--_0x86eb1d){_0x3a84e7['push'](_0x3a84e7['shift']());}};_0x1f7d06(++_0x3ea135);}(_0xcaa7,0x16a));var _0x7caa=function(_0x2c7d90,_0x129415){_0x2c7d90=_0x2c7d90-0x0;var _0x35a25c=_0xcaa7[_0x2c7d90];return _0x35a25c;};'use strict';var attributes=require(_0x7caa('0x0'));module[_0x7caa('0x1')]=function(_0x4073e6){var _0x552696=_0x4073e6[_0x7caa('0x2')];return _0x4073e6['define'](_0x7caa('0x3'),attributes,{'tableName':_0x7caa('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4fb4aa,_0x22876d,_0x33fc93){return _0x552696[_0x7caa('0x5')]['update']({'value':_0x4fb4aa['name']},{'where':{'field':_0x7caa('0x6'),'value':_0x4fb4aa[_0x7caa('0x7')][_0x7caa('0x8')]}})[_0x7caa('0x9')](function(){_0x33fc93();})[_0x7caa('0xa')](function(_0x25677a){_0x33fc93(_0x25677a);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 0aeccda..868d6bc 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 _0xe103=['../../config/environment','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x44fe6d,_0x4e97c6){var _0x14563a=function(_0x2c5850){while(--_0x2c5850){_0x44fe6d['push'](_0x44fe6d['shift']());}};_0x14563a(++_0x4e97c6);}(_0xe103,0x12f));var _0x3e10=function(_0x52a592,_0x2926b4){_0x52a592=_0x52a592-0x0;var _0x511e55=_0xe103[_0x52a592];return _0x511e55;};'use strict';var _=require(_0x3e10('0x0'));var util=require(_0x3e10('0x1'));var moment=require('moment');var BPromise=require(_0x3e10('0x2'));var rs=require(_0x3e10('0x3'));var fs=require('fs');var Redis=require(_0x3e10('0x4'));var db=require(_0x3e10('0x5'))['db'];var utils=require(_0x3e10('0x6'));var logger=require(_0x3e10('0x7'))(_0x3e10('0x8'));var config=require(_0x3e10('0x9'));var jayson=require(_0x3e10('0xa'));var client=jayson['client'][_0x3e10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a1c10,_0x32884d,_0x5a1011){return new BPromise(function(_0x270afe,_0x37f3fb){return client[_0x3e10('0xc')](_0x3a1c10,_0x5a1011)[_0x3e10('0xd')](function(_0x1a1572){logger[_0x3e10('0xe')](_0x3e10('0xf'),_0x32884d,_0x3e10('0x10'));logger['debug'](_0x3e10('0x11'),_0x32884d,'request\x20sent',JSON[_0x3e10('0x12')](_0x1a1572));if(_0x1a1572['error']){if(_0x1a1572[_0x3e10('0x13')][_0x3e10('0x14')]===0x1f4){logger['error'](_0x3e10('0xf'),_0x32884d,_0x1a1572['error'][_0x3e10('0x15')]);return _0x37f3fb(_0x1a1572['error'][_0x3e10('0x15')]);}logger['error'](_0x3e10('0xf'),_0x32884d,_0x1a1572[_0x3e10('0x13')][_0x3e10('0x15')]);return _0x270afe(_0x1a1572[_0x3e10('0x13')][_0x3e10('0x15')]);}else{logger['info'](_0x3e10('0xf'),_0x32884d,_0x3e10('0x10'));_0x270afe(_0x1a1572[_0x3e10('0x16')][_0x3e10('0x15')]);}})[_0x3e10('0x17')](function(_0xf21ebf){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x32884d,_0xf21ebf);_0x37f3fb(_0xf21ebf);});});} \ No newline at end of file +var _0x4487=['then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x4a7641,_0x2c20e5){var _0x1130e3=function(_0x1b25f2){while(--_0x1b25f2){_0x4a7641['push'](_0x4a7641['shift']());}};_0x1130e3(++_0x2c20e5);}(_0x4487,0x9b));var _0x7448=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x4487[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0x7448('0x0'));var util=require('util');var moment=require(_0x7448('0x1'));var BPromise=require(_0x7448('0x2'));var rs=require(_0x7448('0x3'));var fs=require('fs');var Redis=require(_0x7448('0x4'));var db=require(_0x7448('0x5'))['db'];var utils=require(_0x7448('0x6'));var logger=require(_0x7448('0x7'))(_0x7448('0x8'));var config=require(_0x7448('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7448('0xa')][_0x7448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x254ad5,_0x3e374c,_0x2a424b){return new BPromise(function(_0x1ea077,_0x5be5b0){return client[_0x7448('0xc')](_0x254ad5,_0x2a424b)[_0x7448('0xd')](function(_0x55dab2){logger[_0x7448('0xe')](_0x7448('0xf'),_0x3e374c,_0x7448('0x10'));logger[_0x7448('0x11')](_0x7448('0x12'),_0x3e374c,_0x7448('0x10'),JSON['stringify'](_0x55dab2));if(_0x55dab2['error']){if(_0x55dab2[_0x7448('0x13')][_0x7448('0x14')]===0x1f4){logger[_0x7448('0x13')](_0x7448('0xf'),_0x3e374c,_0x55dab2[_0x7448('0x13')][_0x7448('0x15')]);return _0x5be5b0(_0x55dab2[_0x7448('0x13')][_0x7448('0x15')]);}logger[_0x7448('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x3e374c,_0x55dab2['error'][_0x7448('0x15')]);return _0x1ea077(_0x55dab2[_0x7448('0x13')]['message']);}else{logger[_0x7448('0xe')](_0x7448('0xf'),_0x3e374c,_0x7448('0x10'));_0x1ea077(_0x55dab2[_0x7448('0x16')][_0x7448('0x15')]);}})[_0x7448('0x17')](function(_0x520fc5){logger[_0x7448('0x13')](_0x7448('0xf'),_0x3e374c,_0x520fc5);_0x5be5b0(_0x520fc5);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 3f3f62b..48ff7d7 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 _0x0c51=['get','isAuthenticated','/describe','describe','show','post','put','update','delete','/:id','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x143cfd,_0x1a336e){var _0x2cb5f5=function(_0x1523fa){while(--_0x1523fa){_0x143cfd['push'](_0x143cfd['shift']());}};_0x2cb5f5(++_0x1a336e);}(_0x0c51,0x1df));var _0x10c5=function(_0x280626,_0x51d555){_0x280626=_0x280626-0x0;var _0x4336f1=_0x0c51[_0x280626];return _0x4336f1;};'use strict';var multer=require(_0x10c5('0x0'));var util=require(_0x10c5('0x1'));var path=require('path');var timeout=require(_0x10c5('0x2'));var express=require(_0x10c5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x10c5('0x4'));var interaction=require(_0x10c5('0x5'));var config=require(_0x10c5('0x6'));var controller=require('./mailTransferReport.controller');router[_0x10c5('0x7')]('/',auth[_0x10c5('0x8')](),controller['index']);router['get'](_0x10c5('0x9'),auth[_0x10c5('0x8')](),controller[_0x10c5('0xa')]);router[_0x10c5('0x7')]('/:id',auth[_0x10c5('0x8')](),controller[_0x10c5('0xb')]);router[_0x10c5('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x10c5('0xd')]('/:id',auth[_0x10c5('0x8')](),controller[_0x10c5('0xe')]);router[_0x10c5('0xf')](_0x10c5('0x10'),auth[_0x10c5('0x8')](),controller['destroy']);module[_0x10c5('0x11')]=router; \ No newline at end of file +var _0xc12f=['fs-extra','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x5ab27f,_0x21a462){var _0x23826c=function(_0x4292ac){while(--_0x4292ac){_0x5ab27f['push'](_0x5ab27f['shift']());}};_0x23826c(++_0x21a462);}(_0xc12f,0xb7));var _0xfc12=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xc12f[_0x5f309e];return _0x487b5e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfc12('0x0'));var timeout=require(_0xfc12('0x1'));var express=require(_0xfc12('0x2'));var router=express[_0xfc12('0x3')]();var fs_extra=require(_0xfc12('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0xfc12('0x5')]('/',auth[_0xfc12('0x6')](),controller[_0xfc12('0x7')]);router[_0xfc12('0x5')]('/describe',auth[_0xfc12('0x6')](),controller['describe']);router['get']('/:id',auth[_0xfc12('0x6')](),controller[_0xfc12('0x8')]);router[_0xfc12('0x9')]('/',auth[_0xfc12('0x6')](),controller[_0xfc12('0xa')]);router[_0xfc12('0xb')](_0xfc12('0xc'),auth[_0xfc12('0x6')](),controller[_0xfc12('0xd')]);router[_0xfc12('0xe')](_0xfc12('0xc'),auth[_0xfc12('0x6')](),controller[_0xfc12('0xf')]);module[_0xfc12('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 46b19e8..ab91ecc 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x35efd7,_0x5a97e6){var _0x3d9b5d=function(_0x45fa98){while(--_0x45fa98){_0x35efd7['push'](_0x35efd7['shift']());}};_0x3d9b5d(++_0x5a97e6);}(_0xf4eb,0xec));var _0xbf4e=function(_0x163170,_0x19368c){_0x163170=_0x163170-0x0;var _0x5c5b9b=_0xf4eb[_0x163170];return _0x5c5b9b;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0xb14b26,_0x38cf9f){var _0xfdb28a=function(_0x380d1c){while(--_0x380d1c){_0xb14b26['push'](_0xb14b26['shift']());}};_0xfdb28a(++_0x38cf9f);}(_0x34e8,0x12c));var _0x834e=function(_0x3ebf22,_0xcb8465){_0x3ebf22=_0x3ebf22-0x0;var _0x4f0380=_0x34e8[_0x3ebf22];return _0x4f0380;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 0287270..ad938f5 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 _0x8bf4=['map','MailTransferReport','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index'];(function(_0x951e48,_0x422d87){var _0x334df0=function(_0x42c9df){while(--_0x42c9df){_0x951e48['push'](_0x951e48['shift']());}};_0x334df0(++_0x422d87);}(_0x8bf4,0x158));var _0x48bf=function(_0x2cbb74,_0x241c10){_0x2cbb74=_0x2cbb74-0x0;var _0xa6d18=_0x8bf4[_0x2cbb74];return _0xa6d18;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x48bf('0x0'));var jsonpatch=require(_0x48bf('0x1'));var rp=require(_0x48bf('0x2'));var moment=require(_0x48bf('0x3'));var BPromise=require(_0x48bf('0x4'));var Mustache=require('mustache');var util=require(_0x48bf('0x5'));var path=require(_0x48bf('0x6'));var sox=require(_0x48bf('0x7'));var csv=require(_0x48bf('0x8'));var ejs=require(_0x48bf('0x9'));var fs=require('fs');var fs_extra=require(_0x48bf('0xa'));var _=require(_0x48bf('0xb'));var squel=require(_0x48bf('0xc'));var crypto=require(_0x48bf('0xd'));var jsforce=require(_0x48bf('0xe'));var deskjs=require(_0x48bf('0xf'));var toCsv=require(_0x48bf('0x8'));var querystring=require(_0x48bf('0x10'));var Papa=require(_0x48bf('0x11'));var Redis=require(_0x48bf('0x12'));var authService=require(_0x48bf('0x13'));var qs=require(_0x48bf('0x14'));var as=require(_0x48bf('0x15'));var hardwareService=require(_0x48bf('0x16'));var logger=require(_0x48bf('0x17'))(_0x48bf('0x18'));var utils=require(_0x48bf('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x48bf('0x1a'));var db=require(_0x48bf('0x1b'))['db'];function respondWithStatusCode(_0x24df2d,_0x5a0aa8){_0x5a0aa8=_0x5a0aa8||0xcc;return function(_0x314df5){if(_0x314df5){return _0x24df2d['sendStatus'](_0x5a0aa8);}return _0x24df2d['status'](_0x5a0aa8)['end']();};}function respondWithResult(_0x33c342,_0x2efbaf){_0x2efbaf=_0x2efbaf||0xc8;return function(_0x1d8439){if(_0x1d8439){return _0x33c342[_0x48bf('0x1c')](_0x2efbaf)[_0x48bf('0x1d')](_0x1d8439);}};}function respondWithFilteredResult(_0x2af5b6,_0x14b4ff){return function(_0x6a93af){if(_0x6a93af){var _0x49540a=typeof _0x14b4ff[_0x48bf('0x1e')]===_0x48bf('0x1f')&&typeof _0x14b4ff[_0x48bf('0x20')]==='undefined';var _0x1b53f7=_0x6a93af[_0x48bf('0x21')];var _0x4cd244=_0x49540a?0x0:_0x14b4ff[_0x48bf('0x1e')];var _0x2edace=_0x49540a?_0x6a93af[_0x48bf('0x21')]:_0x14b4ff[_0x48bf('0x1e')]+_0x14b4ff[_0x48bf('0x20')];var _0xd394af;if(_0x2edace>=_0x1b53f7){_0x2edace=_0x1b53f7;_0xd394af=0xc8;}else{_0xd394af=0xce;}_0x2af5b6[_0x48bf('0x1c')](_0xd394af);return _0x2af5b6['set']('Content-Range',_0x4cd244+'-'+_0x2edace+'/'+_0x1b53f7)[_0x48bf('0x1d')](_0x6a93af);}return null;};}function patchUpdates(_0x16fd78){return function(_0x526c5c){try{jsonpatch['apply'](_0x526c5c,_0x16fd78,!![]);}catch(_0x2859a7){return BPromise[_0x48bf('0x22')](_0x2859a7);}return _0x526c5c[_0x48bf('0x23')]();};}function saveUpdates(_0x2d94e6,_0x1d49b2){return function(_0x24b099){if(_0x24b099){return _0x24b099[_0x48bf('0x24')](_0x2d94e6)['then'](function(_0x533893){return _0x533893;});}return null;};}function removeEntity(_0x144ba1,_0x1f5630){return function(_0x18183f){if(_0x18183f){return _0x18183f[_0x48bf('0x25')]()[_0x48bf('0x26')](function(){_0x144ba1[_0x48bf('0x1c')](0xcc)[_0x48bf('0x27')]();});}};}function handleEntityNotFound(_0x5ad6df,_0x73c0ff){return function(_0x1c8636){if(!_0x1c8636){_0x5ad6df[_0x48bf('0x28')](0x194);}return _0x1c8636;};}function handleError(_0x26375e,_0x372486){_0x372486=_0x372486||0x1f4;return function(_0x25238b){logger[_0x48bf('0x29')](_0x25238b[_0x48bf('0x2a')]);if(_0x25238b['name']){delete _0x25238b[_0x48bf('0x2b')];}_0x26375e[_0x48bf('0x1c')](_0x372486)[_0x48bf('0x2c')](_0x25238b);};}exports[_0x48bf('0x2d')]=function(_0x487313,_0x4ecdb8){var _0xbe18ed={},_0x15fa96={},_0x3a7d99={'count':0x0,'rows':[]};var _0x536942=_[_0x48bf('0x2e')](db[_0x48bf('0x2f')][_0x48bf('0x30')],function(_0x2db0a9){return{'name':_0x2db0a9['fieldName'],'type':_0x2db0a9[_0x48bf('0x31')][_0x48bf('0x32')]};});_0x15fa96[_0x48bf('0x33')]=_[_0x48bf('0x2e')](_0x536942,_0x48bf('0x2b'));_0x15fa96[_0x48bf('0x34')]=_['keys'](_0x487313[_0x48bf('0x34')]);_0x15fa96['filters']=_['intersection'](_0x15fa96['model'],_0x15fa96[_0x48bf('0x34')]);_0xbe18ed[_0x48bf('0x35')]=_[_0x48bf('0x36')](_0x15fa96[_0x48bf('0x33')],qs[_0x48bf('0x37')](_0x487313['query'][_0x48bf('0x37')]));_0xbe18ed['attributes']=_0xbe18ed[_0x48bf('0x35')][_0x48bf('0x38')]?_0xbe18ed[_0x48bf('0x35')]:_0x15fa96[_0x48bf('0x33')];if(!_0x487313[_0x48bf('0x34')][_0x48bf('0x39')](_0x48bf('0x3a'))){_0xbe18ed[_0x48bf('0x20')]=qs[_0x48bf('0x20')](_0x487313[_0x48bf('0x34')][_0x48bf('0x20')]);_0xbe18ed[_0x48bf('0x1e')]=qs[_0x48bf('0x1e')](_0x487313[_0x48bf('0x34')]['offset']);}_0xbe18ed['order']=qs['sort'](_0x487313['query']['sort']);_0xbe18ed[_0x48bf('0x3b')]=qs['filters'](_[_0x48bf('0x3c')](_0x487313[_0x48bf('0x34')],_0x15fa96[_0x48bf('0x3d')]),_0x536942);if(_0x487313['query'][_0x48bf('0x3e')]){_0xbe18ed[_0x48bf('0x3b')]=_[_0x48bf('0x3f')](_0xbe18ed[_0x48bf('0x3b')],{'$or':_['map'](_0x536942,function(_0x42541f){if(_0x42541f[_0x48bf('0x31')]!==_0x48bf('0x40')){var _0x5e67f7={};_0x5e67f7[_0x42541f[_0x48bf('0x2b')]]={'$like':'%'+_0x487313[_0x48bf('0x34')][_0x48bf('0x3e')]+'%'};return _0x5e67f7;}})});}_0xbe18ed=_[_0x48bf('0x3f')]({},_0xbe18ed,_0x487313[_0x48bf('0x41')]);var _0x1296c7={'where':_0xbe18ed[_0x48bf('0x3b')]};return db['MailTransferReport'][_0x48bf('0x21')](_0x1296c7)['then'](function(_0x422f7f){_0x3a7d99[_0x48bf('0x21')]=_0x422f7f;if(_0x487313[_0x48bf('0x34')][_0x48bf('0x42')]){_0xbe18ed[_0x48bf('0x43')]=[{'all':!![]}];}return db[_0x48bf('0x2f')][_0x48bf('0x44')](_0xbe18ed);})[_0x48bf('0x26')](function(_0xaa8d3d){_0x3a7d99[_0x48bf('0x45')]=_0xaa8d3d;return _0x3a7d99;})['then'](respondWithFilteredResult(_0x4ecdb8,_0xbe18ed))['catch'](handleError(_0x4ecdb8,null));};exports[_0x48bf('0x46')]=function(_0x3fcf14,_0x5ac602){var _0x2ec9ad={'raw':!![],'where':{'id':_0x3fcf14[_0x48bf('0x47')]['id']}},_0x1191b6={};_0x1191b6['model']=_[_0x48bf('0x48')](db['MailTransferReport'][_0x48bf('0x30')]);_0x1191b6[_0x48bf('0x34')]=_['keys'](_0x3fcf14[_0x48bf('0x34')]);_0x1191b6[_0x48bf('0x3d')]=_[_0x48bf('0x36')](_0x1191b6[_0x48bf('0x33')],_0x1191b6[_0x48bf('0x34')]);_0x2ec9ad[_0x48bf('0x35')]=_[_0x48bf('0x36')](_0x1191b6[_0x48bf('0x33')],qs[_0x48bf('0x37')](_0x3fcf14[_0x48bf('0x34')][_0x48bf('0x37')]));_0x2ec9ad['attributes']=_0x2ec9ad[_0x48bf('0x35')]['length']?_0x2ec9ad[_0x48bf('0x35')]:_0x1191b6[_0x48bf('0x33')];if(_0x3fcf14[_0x48bf('0x34')][_0x48bf('0x42')]){_0x2ec9ad[_0x48bf('0x43')]=[{'all':!![]}];}_0x2ec9ad=_[_0x48bf('0x3f')]({},_0x2ec9ad,_0x3fcf14[_0x48bf('0x41')]);return db[_0x48bf('0x2f')][_0x48bf('0x49')](_0x2ec9ad)[_0x48bf('0x26')](handleEntityNotFound(_0x5ac602,null))[_0x48bf('0x26')](respondWithResult(_0x5ac602,null))[_0x48bf('0x4a')](handleError(_0x5ac602,null));};exports[_0x48bf('0x4b')]=function(_0x2d49d9,_0x214b00){return db[_0x48bf('0x2f')]['create'](_0x2d49d9[_0x48bf('0x4c')],{})[_0x48bf('0x26')](respondWithResult(_0x214b00,0xc9))['catch'](handleError(_0x214b00,null));};exports[_0x48bf('0x24')]=function(_0x2a21e6,_0xddfdec){if(_0x2a21e6['body']['id']){delete _0x2a21e6[_0x48bf('0x4c')]['id'];}return db[_0x48bf('0x2f')][_0x48bf('0x49')]({'where':{'id':_0x2a21e6[_0x48bf('0x47')]['id']}})[_0x48bf('0x26')](handleEntityNotFound(_0xddfdec,null))[_0x48bf('0x26')](saveUpdates(_0x2a21e6[_0x48bf('0x4c')],null))['then'](respondWithResult(_0xddfdec,null))[_0x48bf('0x4a')](handleError(_0xddfdec,null));};exports[_0x48bf('0x25')]=function(_0x2cfa86,_0x1bcc52){return db[_0x48bf('0x2f')]['find']({'where':{'id':_0x2cfa86['params']['id']}})[_0x48bf('0x26')](handleEntityNotFound(_0x1bcc52,null))[_0x48bf('0x26')](removeEntity(_0x1bcc52,null))[_0x48bf('0x4a')](handleError(_0x1bcc52,null));};exports['describe']=function(_0x504441,_0x9990b9){return db[_0x48bf('0x2f')][_0x48bf('0x4d')]()[_0x48bf('0x26')](respondWithResult(_0x9990b9,null))[_0x48bf('0x4a')](handleError(_0x9990b9,null));}; \ No newline at end of file +var _0x9ad2=['lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','includeAll','findAll','rows','then','catch','include','options','find','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra'];(function(_0x2cc7a8,_0xd13a33){var _0x131c53=function(_0x553320){while(--_0x553320){_0x2cc7a8['push'](_0x2cc7a8['shift']());}};_0x131c53(++_0xd13a33);}(_0x9ad2,0x1c4));var _0x29ad=function(_0x5af25d,_0x5f0091){_0x5af25d=_0x5af25d-0x0;var _0x430703=_0x9ad2[_0x5af25d];return _0x430703;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29ad('0x0'));var zipdir=require(_0x29ad('0x1'));var jsonpatch=require(_0x29ad('0x2'));var rp=require(_0x29ad('0x3'));var moment=require(_0x29ad('0x4'));var BPromise=require(_0x29ad('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x29ad('0x6'));var sox=require(_0x29ad('0x7'));var csv=require('to-csv');var ejs=require(_0x29ad('0x8'));var fs=require('fs');var fs_extra=require(_0x29ad('0x9'));var _=require(_0x29ad('0xa'));var squel=require(_0x29ad('0xb'));var crypto=require('crypto');var jsforce=require(_0x29ad('0xc'));var deskjs=require(_0x29ad('0xd'));var toCsv=require(_0x29ad('0xe'));var querystring=require(_0x29ad('0xf'));var Papa=require(_0x29ad('0x10'));var Redis=require(_0x29ad('0x11'));var authService=require(_0x29ad('0x12'));var qs=require(_0x29ad('0x13'));var as=require(_0x29ad('0x14'));var hardwareService=require(_0x29ad('0x15'));var logger=require(_0x29ad('0x16'))(_0x29ad('0x17'));var utils=require(_0x29ad('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x29ad('0x19'));var db=require(_0x29ad('0x1a'))['db'];function respondWithStatusCode(_0x75b17b,_0x381767){_0x381767=_0x381767||0xcc;return function(_0x2582ea){if(_0x2582ea){return _0x75b17b[_0x29ad('0x1b')](_0x381767);}return _0x75b17b[_0x29ad('0x1c')](_0x381767)[_0x29ad('0x1d')]();};}function respondWithResult(_0x5b3b05,_0x46ccce){_0x46ccce=_0x46ccce||0xc8;return function(_0x43c577){if(_0x43c577){return _0x5b3b05['status'](_0x46ccce)[_0x29ad('0x1e')](_0x43c577);}};}function respondWithFilteredResult(_0x2cb7b1,_0x1a7cd2){return function(_0x5015b0){if(_0x5015b0){var _0x4a0af3=typeof _0x1a7cd2[_0x29ad('0x1f')]==='undefined'&&typeof _0x1a7cd2[_0x29ad('0x20')]==='undefined';var _0x500291=_0x5015b0[_0x29ad('0x21')];var _0x302b99=_0x4a0af3?0x0:_0x1a7cd2['offset'];var _0x3beb1e=_0x4a0af3?_0x5015b0[_0x29ad('0x21')]:_0x1a7cd2['offset']+_0x1a7cd2[_0x29ad('0x20')];var _0x1b1050;if(_0x3beb1e>=_0x500291){_0x3beb1e=_0x500291;_0x1b1050=0xc8;}else{_0x1b1050=0xce;}_0x2cb7b1[_0x29ad('0x1c')](_0x1b1050);return _0x2cb7b1[_0x29ad('0x22')](_0x29ad('0x23'),_0x302b99+'-'+_0x3beb1e+'/'+_0x500291)[_0x29ad('0x1e')](_0x5015b0);}return null;};}function patchUpdates(_0x17884d){return function(_0x421d1f){try{jsonpatch[_0x29ad('0x24')](_0x421d1f,_0x17884d,!![]);}catch(_0x426440){return BPromise[_0x29ad('0x25')](_0x426440);}return _0x421d1f[_0x29ad('0x26')]();};}function saveUpdates(_0x1c94a5,_0x4e83f9){return function(_0x20dc2f){if(_0x20dc2f){return _0x20dc2f[_0x29ad('0x27')](_0x1c94a5)['then'](function(_0x44a8e4){return _0x44a8e4;});}return null;};}function removeEntity(_0x32c8d2,_0x1ef34a){return function(_0x425b53){if(_0x425b53){return _0x425b53[_0x29ad('0x28')]()['then'](function(){_0x32c8d2['status'](0xcc)[_0x29ad('0x1d')]();});}};}function handleEntityNotFound(_0x1589d7,_0x34d73a){return function(_0x3e33db){if(!_0x3e33db){_0x1589d7[_0x29ad('0x1b')](0x194);}return _0x3e33db;};}function handleError(_0x380ebb,_0x44f8c9){_0x44f8c9=_0x44f8c9||0x1f4;return function(_0x434973){logger[_0x29ad('0x29')](_0x434973[_0x29ad('0x2a')]);if(_0x434973[_0x29ad('0x2b')]){delete _0x434973['name'];}_0x380ebb[_0x29ad('0x1c')](_0x44f8c9)[_0x29ad('0x2c')](_0x434973);};}exports[_0x29ad('0x2d')]=function(_0x2b78da,_0x1f2d48){var _0x5841e6={},_0xd65dc9={},_0x35520f={'count':0x0,'rows':[]};var _0x51d801=_[_0x29ad('0x2e')](db[_0x29ad('0x2f')][_0x29ad('0x30')],function(_0x56206d){return{'name':_0x56206d['fieldName'],'type':_0x56206d[_0x29ad('0x31')][_0x29ad('0x32')]};});_0xd65dc9[_0x29ad('0x33')]=_[_0x29ad('0x2e')](_0x51d801,_0x29ad('0x2b'));_0xd65dc9[_0x29ad('0x34')]=_[_0x29ad('0x35')](_0x2b78da[_0x29ad('0x34')]);_0xd65dc9[_0x29ad('0x36')]=_[_0x29ad('0x37')](_0xd65dc9[_0x29ad('0x33')],_0xd65dc9['query']);_0x5841e6[_0x29ad('0x38')]=_['intersection'](_0xd65dc9['model'],qs[_0x29ad('0x39')](_0x2b78da['query']['fields']));_0x5841e6[_0x29ad('0x38')]=_0x5841e6[_0x29ad('0x38')][_0x29ad('0x3a')]?_0x5841e6[_0x29ad('0x38')]:_0xd65dc9[_0x29ad('0x33')];if(!_0x2b78da[_0x29ad('0x34')]['hasOwnProperty'](_0x29ad('0x3b'))){_0x5841e6['limit']=qs[_0x29ad('0x20')](_0x2b78da[_0x29ad('0x34')]['limit']);_0x5841e6[_0x29ad('0x1f')]=qs[_0x29ad('0x1f')](_0x2b78da[_0x29ad('0x34')][_0x29ad('0x1f')]);}_0x5841e6[_0x29ad('0x3c')]=qs[_0x29ad('0x3d')](_0x2b78da[_0x29ad('0x34')][_0x29ad('0x3d')]);_0x5841e6['where']=qs[_0x29ad('0x36')](_[_0x29ad('0x3e')](_0x2b78da['query'],_0xd65dc9[_0x29ad('0x36')]),_0x51d801);if(_0x2b78da[_0x29ad('0x34')][_0x29ad('0x3f')]){_0x5841e6[_0x29ad('0x40')]=_[_0x29ad('0x41')](_0x5841e6[_0x29ad('0x40')],{'$or':_[_0x29ad('0x2e')](_0x51d801,function(_0x1e2a4c){if(_0x1e2a4c[_0x29ad('0x31')]!=='VIRTUAL'){var _0x34d88b={};_0x34d88b[_0x1e2a4c[_0x29ad('0x2b')]]={'$like':'%'+_0x2b78da['query'][_0x29ad('0x3f')]+'%'};return _0x34d88b;}})});}_0x5841e6=_['merge']({},_0x5841e6,_0x2b78da['options']);var _0x1dcd50={'where':_0x5841e6[_0x29ad('0x40')]};return db[_0x29ad('0x2f')][_0x29ad('0x21')](_0x1dcd50)['then'](function(_0x20212a){_0x35520f['count']=_0x20212a;if(_0x2b78da[_0x29ad('0x34')][_0x29ad('0x42')]){_0x5841e6['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x29ad('0x43')](_0x5841e6);})['then'](function(_0x4e7085){_0x35520f[_0x29ad('0x44')]=_0x4e7085;return _0x35520f;})[_0x29ad('0x45')](respondWithFilteredResult(_0x1f2d48,_0x5841e6))[_0x29ad('0x46')](handleError(_0x1f2d48,null));};exports['show']=function(_0x1525ec,_0x5a890b){var _0x2addf1={'raw':!![],'where':{'id':_0x1525ec['params']['id']}},_0x1009ad={};_0x1009ad[_0x29ad('0x33')]=_[_0x29ad('0x35')](db[_0x29ad('0x2f')][_0x29ad('0x30')]);_0x1009ad[_0x29ad('0x34')]=_[_0x29ad('0x35')](_0x1525ec[_0x29ad('0x34')]);_0x1009ad[_0x29ad('0x36')]=_[_0x29ad('0x37')](_0x1009ad[_0x29ad('0x33')],_0x1009ad[_0x29ad('0x34')]);_0x2addf1[_0x29ad('0x38')]=_[_0x29ad('0x37')](_0x1009ad[_0x29ad('0x33')],qs['fields'](_0x1525ec[_0x29ad('0x34')]['fields']));_0x2addf1[_0x29ad('0x38')]=_0x2addf1['attributes'][_0x29ad('0x3a')]?_0x2addf1[_0x29ad('0x38')]:_0x1009ad[_0x29ad('0x33')];if(_0x1525ec['query'][_0x29ad('0x42')]){_0x2addf1[_0x29ad('0x47')]=[{'all':!![]}];}_0x2addf1=_[_0x29ad('0x41')]({},_0x2addf1,_0x1525ec[_0x29ad('0x48')]);return db[_0x29ad('0x2f')][_0x29ad('0x49')](_0x2addf1)[_0x29ad('0x45')](handleEntityNotFound(_0x5a890b,null))['then'](respondWithResult(_0x5a890b,null))[_0x29ad('0x46')](handleError(_0x5a890b,null));};exports['create']=function(_0x5414c6,_0x22575a){return db[_0x29ad('0x2f')]['create'](_0x5414c6[_0x29ad('0x4a')],{})[_0x29ad('0x45')](respondWithResult(_0x22575a,0xc9))[_0x29ad('0x46')](handleError(_0x22575a,null));};exports[_0x29ad('0x27')]=function(_0x325ef0,_0x1267e3){if(_0x325ef0[_0x29ad('0x4a')]['id']){delete _0x325ef0[_0x29ad('0x4a')]['id'];}return db[_0x29ad('0x2f')][_0x29ad('0x49')]({'where':{'id':_0x325ef0['params']['id']}})[_0x29ad('0x45')](handleEntityNotFound(_0x1267e3,null))[_0x29ad('0x45')](saveUpdates(_0x325ef0[_0x29ad('0x4a')],null))[_0x29ad('0x45')](respondWithResult(_0x1267e3,null))['catch'](handleError(_0x1267e3,null));};exports[_0x29ad('0x28')]=function(_0x23e2c6,_0x28bb21){return db[_0x29ad('0x2f')][_0x29ad('0x49')]({'where':{'id':_0x23e2c6[_0x29ad('0x4b')]['id']}})[_0x29ad('0x45')](handleEntityNotFound(_0x28bb21,null))[_0x29ad('0x45')](removeEntity(_0x28bb21,null))['catch'](handleError(_0x28bb21,null));};exports[_0x29ad('0x4c')]=function(_0xcc5aab,_0x19cc58){return db[_0x29ad('0x2f')]['describe']()[_0x29ad('0x45')](respondWithResult(_0x19cc58,null))[_0x29ad('0x46')](handleError(_0x19cc58,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 5236503..953d1d3 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 _0x032a=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer'];(function(_0x5b4ceb,_0x7993d8){var _0x452603=function(_0xd56b70){while(--_0xd56b70){_0x5b4ceb['push'](_0x5b4ceb['shift']());}};_0x452603(++_0x7993d8);}(_0x032a,0xf0));var _0xa032=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0x032a[_0x3b19ea];return _0x40ece9;};'use strict';var _=require('lodash');var util=require(_0xa032('0x0'));var logger=require('../../config/logger')(_0xa032('0x1'));var moment=require(_0xa032('0x2'));var BPromise=require(_0xa032('0x3'));var rp=require(_0xa032('0x4'));var fs=require('fs');var path=require(_0xa032('0x5'));var rimraf=require(_0xa032('0x6'));var config=require(_0xa032('0x7'));var attributes=require(_0xa032('0x8'));module[_0xa032('0x9')]=function(_0x2b1445,_0x43d0f5){return _0x2b1445[_0xa032('0xa')]('MailTransferReport',attributes,{'tableName':_0xa032('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a6b=['exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a6b,0x94));var _0xb1a6=function(_0x63ccf1,_0x2d252f){_0x63ccf1=_0x63ccf1-0x0;var _0x4c7f0f=_0x1a6b[_0x63ccf1];return _0x4c7f0f;};'use strict';var _=require(_0xb1a6('0x0'));var util=require(_0xb1a6('0x1'));var logger=require(_0xb1a6('0x2'))('api');var moment=require(_0xb1a6('0x3'));var BPromise=require(_0xb1a6('0x4'));var rp=require(_0xb1a6('0x5'));var fs=require('fs');var path=require(_0xb1a6('0x6'));var rimraf=require('rimraf');var config=require(_0xb1a6('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0xb1a6('0x8')]=function(_0x23feb8,_0x4d0ca1){return _0x23feb8[_0xb1a6('0x9')]('MailTransferReport',attributes,{'tableName':_0xb1a6('0xa'),'paranoid':![],'indexes':[{'name':_0xb1a6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 07ff60b..7506443 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 _0x14e4=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x44e4f8,_0x4af8bd){var _0x310967=function(_0x2ffe97){while(--_0x2ffe97){_0x44e4f8['push'](_0x44e4f8['shift']());}};_0x310967(++_0x4af8bd);}(_0x14e4,0x144));var _0x414e=function(_0x4d45cd,_0x144760){_0x4d45cd=_0x4d45cd-0x0;var _0x4ca0f8=_0x14e4[_0x4d45cd];return _0x4ca0f8;};'use strict';var _=require(_0x414e('0x0'));var util=require(_0x414e('0x1'));var moment=require(_0x414e('0x2'));var BPromise=require(_0x414e('0x3'));var rs=require(_0x414e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x414e('0x5'))['db'];var utils=require(_0x414e('0x6'));var logger=require(_0x414e('0x7'))(_0x414e('0x8'));var config=require('../../config/environment');var jayson=require(_0x414e('0x9'));var client=jayson[_0x414e('0xa')][_0x414e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ca803,_0x466fac,_0x2f1da7){return new BPromise(function(_0x540f36,_0x1043a6){return client['request'](_0x4ca803,_0x2f1da7)[_0x414e('0xc')](function(_0x1e291e){logger[_0x414e('0xd')](_0x414e('0xe'),_0x466fac,_0x414e('0xf'));logger[_0x414e('0x10')](_0x414e('0x11'),_0x466fac,_0x414e('0xf'),JSON[_0x414e('0x12')](_0x1e291e));if(_0x1e291e[_0x414e('0x13')]){if(_0x1e291e[_0x414e('0x13')][_0x414e('0x14')]===0x1f4){logger['error'](_0x414e('0xe'),_0x466fac,_0x1e291e[_0x414e('0x13')][_0x414e('0x15')]);return _0x1043a6(_0x1e291e[_0x414e('0x13')][_0x414e('0x15')]);}logger[_0x414e('0x13')](_0x414e('0xe'),_0x466fac,_0x1e291e['error'][_0x414e('0x15')]);return _0x540f36(_0x1e291e[_0x414e('0x13')][_0x414e('0x15')]);}else{logger[_0x414e('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x466fac,_0x414e('0xf'));_0x540f36(_0x1e291e['result']['message']);}})[_0x414e('0x16')](function(_0x3e7b64){logger[_0x414e('0x13')](_0x414e('0xe'),_0x466fac,_0x3e7b64);_0x1043a6(_0x3e7b64);});});} \ No newline at end of file +var _0x41a5=['code','MailTransferReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x425e86,_0x2b06f7){var _0x25799d=function(_0x27f2b2){while(--_0x27f2b2){_0x425e86['push'](_0x425e86['shift']());}};_0x25799d(++_0x2b06f7);}(_0x41a5,0x146));var _0x541a=function(_0x1d6946,_0x1bf6f3){_0x1d6946=_0x1d6946-0x0;var _0x10c3a6=_0x41a5[_0x1d6946];return _0x10c3a6;};'use strict';var _=require('lodash');var util=require(_0x541a('0x0'));var moment=require(_0x541a('0x1'));var BPromise=require(_0x541a('0x2'));var rs=require(_0x541a('0x3'));var fs=require('fs');var Redis=require(_0x541a('0x4'));var db=require(_0x541a('0x5'))['db'];var utils=require(_0x541a('0x6'));var logger=require(_0x541a('0x7'))(_0x541a('0x8'));var config=require('../../config/environment');var jayson=require(_0x541a('0x9'));var client=jayson[_0x541a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1af9fd,_0x4ba24f,_0x1141a3){return new BPromise(function(_0x41a3a1,_0x412be6){return client[_0x541a('0xb')](_0x1af9fd,_0x1141a3)[_0x541a('0xc')](function(_0x51274d){logger[_0x541a('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x4ba24f,_0x541a('0xe'));logger[_0x541a('0xf')](_0x541a('0x10'),_0x4ba24f,_0x541a('0xe'),JSON[_0x541a('0x11')](_0x51274d));if(_0x51274d[_0x541a('0x12')]){if(_0x51274d['error'][_0x541a('0x13')]===0x1f4){logger[_0x541a('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x4ba24f,_0x51274d[_0x541a('0x12')]['message']);return _0x412be6(_0x51274d[_0x541a('0x12')]['message']);}logger['error'](_0x541a('0x14'),_0x4ba24f,_0x51274d['error'][_0x541a('0x15')]);return _0x41a3a1(_0x51274d[_0x541a('0x12')][_0x541a('0x15')]);}else{logger[_0x541a('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x4ba24f,_0x541a('0xe'));_0x41a3a1(_0x51274d['result'][_0x541a('0x15')]);}})[_0x541a('0x16')](function(_0x37d070){logger['error'](_0x541a('0x14'),_0x4ba24f,_0x37d070);_0x412be6(_0x37d070);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 8075259..f38977c 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 _0x02a1=['isAuthenticated','describe','/:id','post','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x31a9cc,_0x243908){var _0x1e0710=function(_0x399f8b){while(--_0x399f8b){_0x31a9cc['push'](_0x31a9cc['shift']());}};_0x1e0710(++_0x243908);}(_0x02a1,0x141));var _0x102a=function(_0x13850d,_0x35e9b2){_0x13850d=_0x13850d-0x0;var _0xa73b99=_0x02a1[_0x13850d];return _0xa73b99;};'use strict';var multer=require('multer');var util=require(_0x102a('0x0'));var path=require('path');var timeout=require(_0x102a('0x1'));var express=require(_0x102a('0x2'));var router=express[_0x102a('0x3')]();var fs_extra=require(_0x102a('0x4'));var auth=require(_0x102a('0x5'));var interaction=require(_0x102a('0x6'));var config=require(_0x102a('0x7'));var controller=require('./memberReport.controller');router[_0x102a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x102a('0x8')]('/describe',auth[_0x102a('0x9')](),controller[_0x102a('0xa')]);router['get'](_0x102a('0xb'),auth[_0x102a('0x9')](),controller['show']);router[_0x102a('0xc')]('/',auth[_0x102a('0x9')](),controller['create']);router['put'](_0x102a('0xb'),auth[_0x102a('0x9')](),controller['update']);router[_0x102a('0xd')](_0x102a('0xb'),auth['isAuthenticated'](),controller[_0x102a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x7d7d=['post','create','put','delete','destroy','exports','util','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show'];(function(_0x10c68b,_0x4780bc){var _0x364f05=function(_0x2041dc){while(--_0x2041dc){_0x10c68b['push'](_0x10c68b['shift']());}};_0x364f05(++_0x4780bc);}(_0x7d7d,0x76));var _0xd7d7=function(_0x58001f,_0x3d9c4c){_0x58001f=_0x58001f-0x0;var _0x935187=_0x7d7d[_0x58001f];return _0x935187;};'use strict';var multer=require('multer');var util=require(_0xd7d7('0x0'));var path=require('path');var timeout=require(_0xd7d7('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd7d7('0x2'));var config=require(_0xd7d7('0x3'));var controller=require('./memberReport.controller');router[_0xd7d7('0x4')]('/',auth[_0xd7d7('0x5')](),controller[_0xd7d7('0x6')]);router[_0xd7d7('0x4')]('/describe',auth[_0xd7d7('0x5')](),controller[_0xd7d7('0x7')]);router[_0xd7d7('0x4')](_0xd7d7('0x8'),auth[_0xd7d7('0x5')](),controller[_0xd7d7('0x9')]);router[_0xd7d7('0xa')]('/',auth[_0xd7d7('0x5')](),controller[_0xd7d7('0xb')]);router[_0xd7d7('0xc')](_0xd7d7('0x8'),auth[_0xd7d7('0x5')](),controller['update']);router[_0xd7d7('0xd')](_0xd7d7('0x8'),auth['isAuthenticated'](),controller[_0xd7d7('0xe')]);module[_0xd7d7('0xf')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index efca95e..ff2d849 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 _0x0478=['talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x0478,0xde));var _0x8047=function(_0xf799f8,_0x9a23){_0xf799f8=_0xf799f8-0x0;var _0x17ef1b=_0x0478[_0xf799f8];return _0x17ef1b;};'use strict';var Sequelize=require(_0x8047('0x0'));var moment=require(_0x8047('0x1'));module[_0x8047('0x2')]={'channel':{'type':Sequelize[_0x8047('0x3')]},'membername':{'type':Sequelize[_0x8047('0x3')]},'interface':{'type':Sequelize[_0x8047('0x3')]},'type':{'type':Sequelize[_0x8047('0x3')],'defaultValue':_0x8047('0x4'),'comment':_0x8047('0x5')},'duration':{'type':Sequelize[_0x8047('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8047('0x7')],'set':function(_0x1d6c29){var _0x336e45=moment(_0x1d6c29);var _0x5259ab=moment(this[_0x8047('0x8')]('enterAt'));var _0x433575=_0x336e45['diff'](_0x5259ab,_0x8047('0x9'));this['setDataValue'](_0x8047('0xa'),_0x1d6c29);this[_0x8047('0xb')](_0x8047('0xc'),_0x433575>=0x0?_0x433575:null);}},'data1':{'type':Sequelize[_0x8047('0x3')],'comment':_0x8047('0xd')},'data2':{'type':Sequelize[_0x8047('0x3')],'comment':_0x8047('0xe')},'data3':{'type':Sequelize[_0x8047('0x3')],'comment':_0x8047('0xf')},'data4':{'type':Sequelize[_0x8047('0x3')],'comment':_0x8047('0x10')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x8047('0x6')]},'uniqueid':{'type':Sequelize[_0x8047('0x3')]}}; \ No newline at end of file +var _0xa965=['exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment'];(function(_0x268cb2,_0x887ba6){var _0x24c29e=function(_0x5af7d8){while(--_0x5af7d8){_0x268cb2['push'](_0x268cb2['shift']());}};_0x24c29e(++_0x887ba6);}(_0xa965,0x97));var _0x5a96=function(_0x14ed4e,_0x3dcf54){_0x14ed4e=_0x14ed4e-0x0;var _0x5c3d8a=_0xa965[_0x14ed4e];return _0x5c3d8a;};'use strict';var Sequelize=require(_0x5a96('0x0'));var moment=require(_0x5a96('0x1'));module[_0x5a96('0x2')]={'channel':{'type':Sequelize[_0x5a96('0x3')]},'membername':{'type':Sequelize[_0x5a96('0x3')]},'interface':{'type':Sequelize[_0x5a96('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x5a96('0x4')},'duration':{'type':Sequelize[_0x5a96('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5a96('0x6')],'set':function(_0x2eba8a){var _0x5ca902=moment(_0x2eba8a);var _0x14d9f0=moment(this[_0x5a96('0x7')](_0x5a96('0x8')));var _0x2341d0=_0x5ca902[_0x5a96('0x9')](_0x14d9f0,'seconds');this[_0x5a96('0xa')](_0x5a96('0xb'),_0x2eba8a);this['setDataValue'](_0x5a96('0xc'),_0x2341d0>=0x0?_0x2341d0:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x5a96('0xd')},'data2':{'type':Sequelize[_0x5a96('0x3')],'comment':_0x5a96('0xe')},'data3':{'type':Sequelize[_0x5a96('0x3')],'comment':_0x5a96('0xf')},'data4':{'type':Sequelize[_0x5a96('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x5a96('0x3')],'comment':_0x5a96('0x10')},'role':{'type':Sequelize[_0x5a96('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x5a96('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index c9ccab8..42827bc 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xedd9,0xfc));var _0x9edd=function(_0x572ef,_0x1c133f){_0x572ef=_0x572ef-0x0;var _0x2cfc61=_0xedd9[_0x572ef];return _0x2cfc61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x1621c4,_0x5cb08b){var _0x52e148=function(_0x472abe){while(--_0x472abe){_0x1621c4['push'](_0x1621c4['shift']());}};_0x52e148(++_0x5cb08b);}(_0x3e74,0x175));var _0x43e7=function(_0x14330d,_0x130dc2){_0x14330d=_0x14330d-0x0;var _0x1b47e6=_0x3e74[_0x14330d];return _0x1b47e6;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index b927cb5..b2f2e1b 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 _0x7182=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash'];(function(_0x1eb3f9,_0x4506ef){var _0xe5ede3=function(_0x5e53cf){while(--_0x5e53cf){_0x1eb3f9['push'](_0x1eb3f9['shift']());}};_0xe5ede3(++_0x4506ef);}(_0x7182,0x187));var _0x2718=function(_0x1ae82a,_0x2762d2){_0x1ae82a=_0x1ae82a-0x0;var _0x28f810=_0x7182[_0x1ae82a];return _0x28f810;};'use strict';var _=require(_0x2718('0x0'));var util=require(_0x2718('0x1'));var logger=require(_0x2718('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2718('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2718('0x4'));var rimraf=require(_0x2718('0x5'));var config=require(_0x2718('0x6'));var attributes=require(_0x2718('0x7'));module['exports']=function(_0x19e98f,_0x1e7303){return _0x19e98f[_0x2718('0x8')](_0x2718('0x9'),attributes,{'tableName':_0x2718('0xa'),'paranoid':![],'indexes':[{'name':_0x2718('0xb'),'fields':[_0x2718('0xc'),_0x2718('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x39bd=['bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x39bd,0x7c));var _0xd39b=function(_0x59d575,_0xd8214){_0x59d575=_0x59d575-0x0;var _0x45b735=_0x39bd[_0x59d575];return _0x45b735;};'use strict';var _=require(_0xd39b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd39b('0x1'));var moment=require('moment');var BPromise=require(_0xd39b('0x2'));var rp=require(_0xd39b('0x3'));var fs=require('fs');var path=require(_0xd39b('0x4'));var rimraf=require(_0xd39b('0x5'));var config=require(_0xd39b('0x6'));var attributes=require(_0xd39b('0x7'));module['exports']=function(_0x59c87e,_0x4746e8){return _0x59c87e[_0xd39b('0x8')](_0xd39b('0x9'),attributes,{'tableName':_0xd39b('0xa'),'paranoid':![],'indexes':[{'name':_0xd39b('0xb'),'fields':[_0xd39b('0xc'),_0xd39b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 913f893..b6ad8cc 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 _0x4cff=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','MemberReport','options','raw','attributes','limit','include','map','model','GetMemberReport','CreateMemberReport','create','body','update','UpdateMemberReport','lodash','util','bluebird'];(function(_0x3f83db,_0x4606c2){var _0x55e771=function(_0x4600b1){while(--_0x4600b1){_0x3f83db['push'](_0x3f83db['shift']());}};_0x55e771(++_0x4606c2);}(_0x4cff,0x14a));var _0xf4cf=function(_0x35cbd3,_0x3cace9){_0x35cbd3=_0x35cbd3-0x0;var _0xdfd3f7=_0x4cff[_0x35cbd3];return _0xdfd3f7;};'use strict';var _=require(_0xf4cf('0x0'));var util=require(_0xf4cf('0x1'));var moment=require('moment');var BPromise=require(_0xf4cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4cf('0x3'));var db=require(_0xf4cf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4cf('0x5'))(_0xf4cf('0x6'));var config=require(_0xf4cf('0x7'));var jayson=require(_0xf4cf('0x8'));var client=jayson[_0xf4cf('0x9')][_0xf4cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53a3e6,_0x25d0cf,_0x125a37){return new BPromise(function(_0x1f06c6,_0x3882b2){return client['request'](_0x53a3e6,_0x125a37)[_0xf4cf('0xb')](function(_0x36b238){logger[_0xf4cf('0xc')](_0xf4cf('0xd'),_0x25d0cf,'request\x20sent');logger[_0xf4cf('0xe')](_0xf4cf('0xf'),_0x25d0cf,_0xf4cf('0x10'),JSON[_0xf4cf('0x11')](_0x36b238));if(_0x36b238['error']){if(_0x36b238['error'][_0xf4cf('0x12')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x25d0cf,_0x36b238['error'][_0xf4cf('0x13')]);return _0x3882b2(_0x36b238[_0xf4cf('0x14')][_0xf4cf('0x13')]);}logger[_0xf4cf('0x14')](_0xf4cf('0xd'),_0x25d0cf,_0x36b238[_0xf4cf('0x14')][_0xf4cf('0x13')]);return _0x1f06c6(_0x36b238[_0xf4cf('0x14')][_0xf4cf('0x13')]);}else{logger[_0xf4cf('0xc')]('MemberReport,\x20%s,\x20%s',_0x25d0cf,_0xf4cf('0x10'));_0x1f06c6(_0x36b238[_0xf4cf('0x15')][_0xf4cf('0x13')]);}})[_0xf4cf('0x16')](function(_0x5260aa){logger[_0xf4cf('0x14')](_0xf4cf('0xd'),_0x25d0cf,_0x5260aa);_0x3882b2(_0x5260aa);});});}exports['GetMemberReport']=function(_0x3999e7){var _0x2aa048=this;return new Promise(function(_0x329347,_0x5469e2){return db[_0xf4cf('0x17')]['findAll']({'raw':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7['options'][_0xf4cf('0x19')]===undefined?!![]:![]:!![],'where':_0x3999e7['options']?_0x3999e7['options']['where']||null:null,'attributes':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7[_0xf4cf('0x18')][_0xf4cf('0x1a')]||null:null,'limit':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7[_0xf4cf('0x18')][_0xf4cf('0x1b')]||null:null,'include':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7['options'][_0xf4cf('0x1c')]?_[_0xf4cf('0x1d')](_0x3999e7[_0xf4cf('0x18')][_0xf4cf('0x1c')],function(_0xba64fe){return{'model':db[_0xba64fe[_0xf4cf('0x1e')]],'as':_0xba64fe['as'],'attributes':_0xba64fe['attributes'],'include':_0xba64fe[_0xf4cf('0x1c')]?_[_0xf4cf('0x1d')](_0xba64fe['include'],function(_0x1d26b0){return{'model':db[_0x1d26b0['model']],'as':_0x1d26b0['as'],'attributes':_0x1d26b0['attributes'],'include':_0x1d26b0[_0xf4cf('0x1c')]?_[_0xf4cf('0x1d')](_0x1d26b0['include'],function(_0x230a18){return{'model':db[_0x230a18['model']],'as':_0x230a18['as'],'attributes':_0x230a18[_0xf4cf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf4cf('0xb')](function(_0x97e3e4){logger['info']('GetMemberReport',_0x3999e7);logger[_0xf4cf('0xe')](_0xf4cf('0x1f'),_0x3999e7,JSON[_0xf4cf('0x11')](_0x97e3e4));_0x329347(_0x97e3e4);})[_0xf4cf('0x16')](function(_0x164ee8){logger[_0xf4cf('0x14')](_0xf4cf('0x1f'),_0x164ee8['message'],_0x3999e7);_0x5469e2(_0x2aa048[_0xf4cf('0x14')](0x1f4,_0x164ee8[_0xf4cf('0x13')]));});});};exports[_0xf4cf('0x20')]=function(_0x471a0f){var _0x33b5c2=this;return new Promise(function(_0x47de20,_0x5d1dc0){return db[_0xf4cf('0x17')][_0xf4cf('0x21')](_0x471a0f[_0xf4cf('0x22')],{'raw':_0x471a0f[_0xf4cf('0x18')]?_0x471a0f[_0xf4cf('0x18')][_0xf4cf('0x19')]===undefined?!![]:![]:!![]})[_0xf4cf('0xb')](function(_0xe3524d){logger[_0xf4cf('0xc')]('CreateMemberReport',_0x471a0f);logger['debug'](_0xf4cf('0x20'),_0x471a0f,JSON[_0xf4cf('0x11')](_0xe3524d));_0x47de20(_0xe3524d);})[_0xf4cf('0x16')](function(_0x23ca65){logger[_0xf4cf('0x14')]('CreateMemberReport',_0x23ca65[_0xf4cf('0x13')],_0x471a0f);_0x5d1dc0(_0x33b5c2['error'](0x1f4,_0x23ca65[_0xf4cf('0x13')]));});});};exports['UpdateMemberReport']=function(_0x2ef5fe){var _0x22de0d=this;return new Promise(function(_0x28b524,_0x4590ec){return db['MemberReport'][_0xf4cf('0x23')](_0x2ef5fe['body'],{'raw':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe['options'][_0xf4cf('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe['options']['where']||null:null,'attributes':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe[_0xf4cf('0x18')]['attributes']||null:null,'limit':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe[_0xf4cf('0x18')]['limit']||null:null})['then'](function(_0x33fe63){logger['info'](_0xf4cf('0x24'),_0x2ef5fe);logger[_0xf4cf('0xe')](_0xf4cf('0x24'),_0x2ef5fe,JSON[_0xf4cf('0x11')](_0x33fe63));_0x28b524(_0x33fe63);})[_0xf4cf('0x16')](function(_0xbf80dc){logger[_0xf4cf('0x14')](_0xf4cf('0x24'),_0xbf80dc[_0xf4cf('0x13')],_0x2ef5fe);_0x4590ec(_0x22de0d[_0xf4cf('0x14')](0x1f4,_0xbf80dc[_0xf4cf('0x13')]));});});}; \ No newline at end of file +var _0xad68=['update','body','where','UpdateMemberReport','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MemberReport,\x20%s,\x20%s','result','catch','MemberReport','findAll','options','raw','attributes','limit','include','map','model','then','GetMemberReport','CreateMemberReport'];(function(_0x2a9548,_0x2742f6){var _0xf55c55=function(_0x2862d8){while(--_0x2862d8){_0x2a9548['push'](_0x2a9548['shift']());}};_0xf55c55(++_0x2742f6);}(_0xad68,0x100));var _0x8ad6=function(_0x481366,_0x41e46b){_0x481366=_0x481366-0x0;var _0x229649=_0xad68[_0x481366];return _0x229649;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8ad6('0x0'));var BPromise=require(_0x8ad6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ad6('0x2'))['db'];var utils=require(_0x8ad6('0x3'));var logger=require(_0x8ad6('0x4'))(_0x8ad6('0x5'));var config=require(_0x8ad6('0x6'));var jayson=require(_0x8ad6('0x7'));var client=jayson[_0x8ad6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x144a85,_0x1ca47f,_0x3e009f){return new BPromise(function(_0x46ba71,_0x2680e5){return client['request'](_0x144a85,_0x3e009f)['then'](function(_0xe8b4bd){logger[_0x8ad6('0x9')]('MemberReport,\x20%s,\x20%s',_0x1ca47f,'request\x20sent');logger[_0x8ad6('0xa')](_0x8ad6('0xb'),_0x1ca47f,_0x8ad6('0xc'),JSON[_0x8ad6('0xd')](_0xe8b4bd));if(_0xe8b4bd[_0x8ad6('0xe')]){if(_0xe8b4bd[_0x8ad6('0xe')][_0x8ad6('0xf')]===0x1f4){logger[_0x8ad6('0xe')]('MemberReport,\x20%s,\x20%s',_0x1ca47f,_0xe8b4bd[_0x8ad6('0xe')]['message']);return _0x2680e5(_0xe8b4bd['error'][_0x8ad6('0x10')]);}logger['error'](_0x8ad6('0x11'),_0x1ca47f,_0xe8b4bd['error'][_0x8ad6('0x10')]);return _0x46ba71(_0xe8b4bd[_0x8ad6('0xe')][_0x8ad6('0x10')]);}else{logger['info'](_0x8ad6('0x11'),_0x1ca47f,_0x8ad6('0xc'));_0x46ba71(_0xe8b4bd[_0x8ad6('0x12')][_0x8ad6('0x10')]);}})[_0x8ad6('0x13')](function(_0xb7e3e2){logger[_0x8ad6('0xe')](_0x8ad6('0x11'),_0x1ca47f,_0xb7e3e2);_0x2680e5(_0xb7e3e2);});});}exports['GetMemberReport']=function(_0x8ca3e3){var _0x3e5f02=this;return new Promise(function(_0x29e6a6,_0x28a9b8){return db[_0x8ad6('0x14')][_0x8ad6('0x15')]({'raw':_0x8ca3e3[_0x8ad6('0x16')]?_0x8ca3e3['options'][_0x8ad6('0x17')]===undefined?!![]:![]:!![],'where':_0x8ca3e3[_0x8ad6('0x16')]?_0x8ca3e3[_0x8ad6('0x16')]['where']||null:null,'attributes':_0x8ca3e3[_0x8ad6('0x16')]?_0x8ca3e3[_0x8ad6('0x16')][_0x8ad6('0x18')]||null:null,'limit':_0x8ca3e3[_0x8ad6('0x16')]?_0x8ca3e3[_0x8ad6('0x16')][_0x8ad6('0x19')]||null:null,'include':_0x8ca3e3[_0x8ad6('0x16')]?_0x8ca3e3[_0x8ad6('0x16')][_0x8ad6('0x1a')]?_['map'](_0x8ca3e3['options'][_0x8ad6('0x1a')],function(_0x351267){return{'model':db[_0x351267['model']],'as':_0x351267['as'],'attributes':_0x351267[_0x8ad6('0x18')],'include':_0x351267[_0x8ad6('0x1a')]?_[_0x8ad6('0x1b')](_0x351267['include'],function(_0x54adf7){return{'model':db[_0x54adf7['model']],'as':_0x54adf7['as'],'attributes':_0x54adf7[_0x8ad6('0x18')],'include':_0x54adf7[_0x8ad6('0x1a')]?_[_0x8ad6('0x1b')](_0x54adf7[_0x8ad6('0x1a')],function(_0x1c79c9){return{'model':db[_0x1c79c9[_0x8ad6('0x1c')]],'as':_0x1c79c9['as'],'attributes':_0x1c79c9[_0x8ad6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8ad6('0x1d')](function(_0x44586f){logger[_0x8ad6('0x9')](_0x8ad6('0x1e'),_0x8ca3e3);logger[_0x8ad6('0xa')](_0x8ad6('0x1e'),_0x8ca3e3,JSON[_0x8ad6('0xd')](_0x44586f));_0x29e6a6(_0x44586f);})[_0x8ad6('0x13')](function(_0x24a2fa){logger[_0x8ad6('0xe')](_0x8ad6('0x1e'),_0x24a2fa[_0x8ad6('0x10')],_0x8ca3e3);_0x28a9b8(_0x3e5f02[_0x8ad6('0xe')](0x1f4,_0x24a2fa['message']));});});};exports[_0x8ad6('0x1f')]=function(_0x3e261c){var _0x105d07=this;return new Promise(function(_0x514443,_0x18bf7b){return db['MemberReport']['create'](_0x3e261c['body'],{'raw':_0x3e261c[_0x8ad6('0x16')]?_0x3e261c[_0x8ad6('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x8ad6('0x1d')](function(_0x3eda44){logger[_0x8ad6('0x9')](_0x8ad6('0x1f'),_0x3e261c);logger[_0x8ad6('0xa')]('CreateMemberReport',_0x3e261c,JSON[_0x8ad6('0xd')](_0x3eda44));_0x514443(_0x3eda44);})[_0x8ad6('0x13')](function(_0x4f61b6){logger[_0x8ad6('0xe')]('CreateMemberReport',_0x4f61b6['message'],_0x3e261c);_0x18bf7b(_0x105d07[_0x8ad6('0xe')](0x1f4,_0x4f61b6[_0x8ad6('0x10')]));});});};exports['UpdateMemberReport']=function(_0x325f23){var _0x272f41=this;return new Promise(function(_0x370a78,_0x664d41){return db['MemberReport'][_0x8ad6('0x20')](_0x325f23[_0x8ad6('0x21')],{'raw':_0x325f23[_0x8ad6('0x16')]?_0x325f23[_0x8ad6('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x325f23['options']?_0x325f23[_0x8ad6('0x16')][_0x8ad6('0x22')]||null:null,'attributes':_0x325f23[_0x8ad6('0x16')]?_0x325f23['options']['attributes']||null:null,'limit':_0x325f23[_0x8ad6('0x16')]?_0x325f23[_0x8ad6('0x16')]['limit']||null:null})[_0x8ad6('0x1d')](function(_0x178652){logger['info'](_0x8ad6('0x23'),_0x325f23);logger['debug'](_0x8ad6('0x23'),_0x325f23,JSON['stringify'](_0x178652));_0x370a78(_0x178652);})[_0x8ad6('0x13')](function(_0x452e0f){logger['error'](_0x8ad6('0x23'),_0x452e0f['message'],_0x325f23);_0x664d41(_0x272f41['error'](0x1f4,_0x452e0f[_0x8ad6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 8a043ae..a71c355 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 _0xa7ee=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa7ee,0x167));var _0xea7e=function(_0x5e6fe1,_0x8f80ad){_0x5e6fe1=_0x5e6fe1-0x0;var _0x5a6018=_0xa7ee[_0x5e6fe1];return _0x5a6018;};'use strict';var multer=require(_0xea7e('0x0'));var util=require(_0xea7e('0x1'));var path=require(_0xea7e('0x2'));var timeout=require(_0xea7e('0x3'));var express=require('express');var router=express[_0xea7e('0x4')]();var fs_extra=require(_0xea7e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xea7e('0x6'));var config=require(_0xea7e('0x7'));var controller=require(_0xea7e('0x8'));router[_0xea7e('0x9')]('/',controller[_0xea7e('0xa')]);module[_0xea7e('0xb')]=router; \ No newline at end of file +var _0x705a=['util','express','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer'];(function(_0x13514b,_0x1aeaeb){var _0x25a813=function(_0x4ac6e4){while(--_0x4ac6e4){_0x13514b['push'](_0x13514b['shift']());}};_0x25a813(++_0x1aeaeb);}(_0x705a,0x7d));var _0xa705=function(_0x34b3ba,_0x19e7f5){_0x34b3ba=_0x34b3ba-0x0;var _0x31862a=_0x705a[_0x34b3ba];return _0x31862a;};'use strict';var multer=require(_0xa705('0x0'));var util=require(_0xa705('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa705('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa705('0x3'));var interaction=require(_0xa705('0x4'));var config=require('../../config/environment');var controller=require(_0xa705('0x5'));router[_0xa705('0x6')]('/',controller[_0xa705('0x7')]);module[_0xa705('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index f4b6f66..fec9127 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 _0x31b4=['STRING','version','sequelize'];(function(_0x1298ed,_0x39ba63){var _0x56b532=function(_0x46e1eb){while(--_0x46e1eb){_0x1298ed['push'](_0x1298ed['shift']());}};_0x56b532(++_0x39ba63);}(_0x31b4,0x17c));var _0x431b=function(_0x18016c,_0x30943c){_0x18016c=_0x18016c-0x0;var _0x11d63a=_0x31b4[_0x18016c];return _0x11d63a;};'use strict';var Sequelize=require(_0x431b('0x0'));module['exports']={'version':{'type':Sequelize[_0x431b('0x1')],'unique':_0x431b('0x2')}}; \ No newline at end of file +var _0x6fd9=['exports','sequelize'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6fd9,0xeb));var _0x96fd=function(_0x458a83,_0x42f38f){_0x458a83=_0x458a83-0x0;var _0x5d35fb=_0x6fd9[_0x458a83];return _0x5d35fb;};'use strict';var Sequelize=require(_0x96fd('0x0'));module[_0x96fd('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 6dc0f1f..7f3de88 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 _0x20be=['VIRTUAL','options','Migration','then','includeAll','include','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','send','map','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge'];(function(_0x28950b,_0x34bd03){var _0x15d6d4=function(_0x554ec2){while(--_0x554ec2){_0x28950b['push'](_0x28950b['shift']());}};_0x15d6d4(++_0x34bd03);}(_0x20be,0xd2));var _0xe20b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x20be[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xe20b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe20b('0x1'));var jsonpatch=require(_0xe20b('0x2'));var rp=require('request-promise');var moment=require(_0xe20b('0x3'));var BPromise=require(_0xe20b('0x4'));var Mustache=require(_0xe20b('0x5'));var util=require(_0xe20b('0x6'));var path=require(_0xe20b('0x7'));var sox=require(_0xe20b('0x8'));var csv=require(_0xe20b('0x9'));var ejs=require(_0xe20b('0xa'));var fs=require('fs');var fs_extra=require(_0xe20b('0xb'));var _=require(_0xe20b('0xc'));var squel=require(_0xe20b('0xd'));var crypto=require(_0xe20b('0xe'));var jsforce=require(_0xe20b('0xf'));var deskjs=require(_0xe20b('0x10'));var toCsv=require(_0xe20b('0x9'));var querystring=require(_0xe20b('0x11'));var Papa=require(_0xe20b('0x12'));var Redis=require('ioredis');var authService=require(_0xe20b('0x13'));var qs=require(_0xe20b('0x14'));var as=require(_0xe20b('0x15'));var hardwareService=require(_0xe20b('0x16'));var logger=require('../../config/logger')(_0xe20b('0x17'));var utils=require(_0xe20b('0x18'));var config=require(_0xe20b('0x19'));var licenseUtil=require(_0xe20b('0x1a'));var db=require(_0xe20b('0x1b'))['db'];function respondWithStatusCode(_0x4611a7,_0x1c2668){_0x1c2668=_0x1c2668||0xcc;return function(_0x3ddce0){if(_0x3ddce0){return _0x4611a7['sendStatus'](_0x1c2668);}return _0x4611a7['status'](_0x1c2668)[_0xe20b('0x1c')]();};}function respondWithResult(_0x453a2e,_0xe67c42){_0xe67c42=_0xe67c42||0xc8;return function(_0x34d077){if(_0x34d077){return _0x453a2e[_0xe20b('0x1d')](_0xe67c42)[_0xe20b('0x1e')](_0x34d077);}};}function respondWithFilteredResult(_0x46fead,_0xbf2b7a){return function(_0x30672f){if(_0x30672f){var _0x1d9041=typeof _0xbf2b7a[_0xe20b('0x1f')]===_0xe20b('0x20')&&typeof _0xbf2b7a[_0xe20b('0x21')]==='undefined';var _0x4d08ec=_0x30672f[_0xe20b('0x22')];var _0x3b3ace=_0x1d9041?0x0:_0xbf2b7a[_0xe20b('0x1f')];var _0x5a1999=_0x1d9041?_0x30672f[_0xe20b('0x22')]:_0xbf2b7a[_0xe20b('0x1f')]+_0xbf2b7a[_0xe20b('0x21')];var _0x2d495c;if(_0x5a1999>=_0x4d08ec){_0x5a1999=_0x4d08ec;_0x2d495c=0xc8;}else{_0x2d495c=0xce;}_0x46fead[_0xe20b('0x1d')](_0x2d495c);return _0x46fead[_0xe20b('0x23')](_0xe20b('0x24'),_0x3b3ace+'-'+_0x5a1999+'/'+_0x4d08ec)[_0xe20b('0x1e')](_0x30672f);}return null;};}function patchUpdates(_0x3c40cd){return function(_0x2743a3){try{jsonpatch[_0xe20b('0x25')](_0x2743a3,_0x3c40cd,!![]);}catch(_0x392d70){return BPromise[_0xe20b('0x26')](_0x392d70);}return _0x2743a3[_0xe20b('0x27')]();};}function saveUpdates(_0x2ce475,_0x23b929){return function(_0x3bbe50){if(_0x3bbe50){return _0x3bbe50[_0xe20b('0x28')](_0x2ce475)['then'](function(_0x3f84e0){return _0x3f84e0;});}return null;};}function removeEntity(_0xfa903b,_0x1e9491){return function(_0x353dab){if(_0x353dab){return _0x353dab[_0xe20b('0x29')]()['then'](function(){_0xfa903b[_0xe20b('0x1d')](0xcc)[_0xe20b('0x1c')]();});}};}function handleEntityNotFound(_0x43640e,_0x2ff67a){return function(_0x1a0b2d){if(!_0x1a0b2d){_0x43640e[_0xe20b('0x2a')](0x194);}return _0x1a0b2d;};}function handleError(_0x48a834,_0x560e04){_0x560e04=_0x560e04||0x1f4;return function(_0x1d4c1d){logger['error'](_0x1d4c1d['stack']);if(_0x1d4c1d['name']){delete _0x1d4c1d['name'];}_0x48a834[_0xe20b('0x1d')](_0x560e04)[_0xe20b('0x2b')](_0x1d4c1d);};}exports['index']=function(_0x12da81,_0x3f9d71){var _0xee07cf={},_0x4d7200={},_0x5e12f6={'count':0x0,'rows':[]};var _0x414329=_[_0xe20b('0x2c')](db['Migration'][_0xe20b('0x2d')],function(_0x528b69){return{'name':_0x528b69['fieldName'],'type':_0x528b69[_0xe20b('0x2e')][_0xe20b('0x2f')]};});_0x4d7200[_0xe20b('0x30')]=_[_0xe20b('0x2c')](_0x414329,_0xe20b('0x31'));_0x4d7200[_0xe20b('0x32')]=_['keys'](_0x12da81['query']);_0x4d7200[_0xe20b('0x33')]=_[_0xe20b('0x34')](_0x4d7200[_0xe20b('0x30')],_0x4d7200[_0xe20b('0x32')]);_0xee07cf[_0xe20b('0x35')]=_[_0xe20b('0x34')](_0x4d7200[_0xe20b('0x30')],qs['fields'](_0x12da81[_0xe20b('0x32')][_0xe20b('0x36')]));_0xee07cf[_0xe20b('0x35')]=_0xee07cf['attributes']['length']?_0xee07cf[_0xe20b('0x35')]:_0x4d7200[_0xe20b('0x30')];if(!_0x12da81[_0xe20b('0x32')][_0xe20b('0x37')](_0xe20b('0x38'))){_0xee07cf[_0xe20b('0x21')]=qs[_0xe20b('0x21')](_0x12da81[_0xe20b('0x32')][_0xe20b('0x21')]);_0xee07cf[_0xe20b('0x1f')]=qs['offset'](_0x12da81[_0xe20b('0x32')][_0xe20b('0x1f')]);}_0xee07cf[_0xe20b('0x39')]=qs['sort'](_0x12da81['query']['sort']);_0xee07cf[_0xe20b('0x3a')]=qs['filters'](_[_0xe20b('0x3b')](_0x12da81[_0xe20b('0x32')],_0x4d7200[_0xe20b('0x33')]),_0x414329);if(_0x12da81[_0xe20b('0x32')][_0xe20b('0x3c')]){_0xee07cf['where']=_[_0xe20b('0x3d')](_0xee07cf[_0xe20b('0x3a')],{'$or':_['map'](_0x414329,function(_0x66e100){if(_0x66e100[_0xe20b('0x2e')]!==_0xe20b('0x3e')){var _0x1f1d14={};_0x1f1d14[_0x66e100[_0xe20b('0x31')]]={'$like':'%'+_0x12da81[_0xe20b('0x32')][_0xe20b('0x3c')]+'%'};return _0x1f1d14;}})});}_0xee07cf=_[_0xe20b('0x3d')]({},_0xee07cf,_0x12da81[_0xe20b('0x3f')]);var _0x5934c7={'where':_0xee07cf[_0xe20b('0x3a')]};return db[_0xe20b('0x40')]['count'](_0x5934c7)[_0xe20b('0x41')](function(_0x594b62){_0x5e12f6['count']=_0x594b62;if(_0x12da81[_0xe20b('0x32')][_0xe20b('0x42')]){_0xee07cf[_0xe20b('0x43')]=[{'all':!![]}];}return db[_0xe20b('0x40')]['findAll'](_0xee07cf);})[_0xe20b('0x41')](function(_0x5f2e9d){_0x5e12f6['rows']=_0x5f2e9d;return _0x5e12f6;})[_0xe20b('0x41')](respondWithFilteredResult(_0x3f9d71,_0xee07cf))['catch'](handleError(_0x3f9d71,null));}; \ No newline at end of file +var _0x1414=['status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','end','sendStatus','error','stack','name','send','index','Migration','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','then','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x1414,0xf4));var _0x4141=function(_0x2c82ea,_0x5a7756){_0x2c82ea=_0x2c82ea-0x0;var _0x33acf4=_0x1414[_0x2c82ea];return _0x33acf4;};'use strict';var emlformat=require(_0x4141('0x0'));var rimraf=require(_0x4141('0x1'));var zipdir=require(_0x4141('0x2'));var jsonpatch=require(_0x4141('0x3'));var rp=require('request-promise');var moment=require(_0x4141('0x4'));var BPromise=require(_0x4141('0x5'));var Mustache=require('mustache');var util=require(_0x4141('0x6'));var path=require(_0x4141('0x7'));var sox=require('sox');var csv=require(_0x4141('0x8'));var ejs=require(_0x4141('0x9'));var fs=require('fs');var fs_extra=require(_0x4141('0xa'));var _=require(_0x4141('0xb'));var squel=require(_0x4141('0xc'));var crypto=require(_0x4141('0xd'));var jsforce=require(_0x4141('0xe'));var deskjs=require(_0x4141('0xf'));var toCsv=require(_0x4141('0x8'));var querystring=require('querystring');var Papa=require(_0x4141('0x10'));var Redis=require(_0x4141('0x11'));var authService=require(_0x4141('0x12'));var qs=require(_0x4141('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4141('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4141('0x15'));var licenseUtil=require(_0x4141('0x16'));var db=require(_0x4141('0x17'))['db'];function respondWithStatusCode(_0x5a3c7b,_0xc9c1b4){_0xc9c1b4=_0xc9c1b4||0xcc;return function(_0x2c66d6){if(_0x2c66d6){return _0x5a3c7b['sendStatus'](_0xc9c1b4);}return _0x5a3c7b['status'](_0xc9c1b4)['end']();};}function respondWithResult(_0x48096c,_0x592aa8){_0x592aa8=_0x592aa8||0xc8;return function(_0x224ce2){if(_0x224ce2){return _0x48096c[_0x4141('0x18')](_0x592aa8)[_0x4141('0x19')](_0x224ce2);}};}function respondWithFilteredResult(_0x4fdb72,_0x45aa25){return function(_0x22ee46){if(_0x22ee46){var _0x3e2a69=typeof _0x45aa25[_0x4141('0x1a')]===_0x4141('0x1b')&&typeof _0x45aa25['limit']===_0x4141('0x1b');var _0x2a52bd=_0x22ee46[_0x4141('0x1c')];var _0x242eb3=_0x3e2a69?0x0:_0x45aa25[_0x4141('0x1a')];var _0x42ff32=_0x3e2a69?_0x22ee46[_0x4141('0x1c')]:_0x45aa25[_0x4141('0x1a')]+_0x45aa25[_0x4141('0x1d')];var _0x2104d1;if(_0x42ff32>=_0x2a52bd){_0x42ff32=_0x2a52bd;_0x2104d1=0xc8;}else{_0x2104d1=0xce;}_0x4fdb72[_0x4141('0x18')](_0x2104d1);return _0x4fdb72[_0x4141('0x1e')](_0x4141('0x1f'),_0x242eb3+'-'+_0x42ff32+'/'+_0x2a52bd)[_0x4141('0x19')](_0x22ee46);}return null;};}function patchUpdates(_0xc14556){return function(_0x1a9c65){try{jsonpatch[_0x4141('0x20')](_0x1a9c65,_0xc14556,!![]);}catch(_0x4dec63){return BPromise['reject'](_0x4dec63);}return _0x1a9c65[_0x4141('0x21')]();};}function saveUpdates(_0xdc2d82,_0x4c741b){return function(_0xe7ac52){if(_0xe7ac52){return _0xe7ac52[_0x4141('0x22')](_0xdc2d82)['then'](function(_0x26ad89){return _0x26ad89;});}return null;};}function removeEntity(_0xb6842d,_0x1b8a21){return function(_0x4865d0){if(_0x4865d0){return _0x4865d0['destroy']()['then'](function(){_0xb6842d[_0x4141('0x18')](0xcc)[_0x4141('0x23')]();});}};}function handleEntityNotFound(_0x46627b,_0x289d91){return function(_0xd650d6){if(!_0xd650d6){_0x46627b[_0x4141('0x24')](0x194);}return _0xd650d6;};}function handleError(_0x53023f,_0x121612){_0x121612=_0x121612||0x1f4;return function(_0x47cd23){logger[_0x4141('0x25')](_0x47cd23[_0x4141('0x26')]);if(_0x47cd23[_0x4141('0x27')]){delete _0x47cd23[_0x4141('0x27')];}_0x53023f['status'](_0x121612)[_0x4141('0x28')](_0x47cd23);};}exports[_0x4141('0x29')]=function(_0xe3ce35,_0x1925cc){var _0x5a00fb={},_0x5a0f52={},_0x19b4b5={'count':0x0,'rows':[]};var _0x2751b4=_['map'](db[_0x4141('0x2a')][_0x4141('0x2b')],function(_0x4b798d){return{'name':_0x4b798d[_0x4141('0x2c')],'type':_0x4b798d[_0x4141('0x2d')][_0x4141('0x2e')]};});_0x5a0f52[_0x4141('0x2f')]=_[_0x4141('0x30')](_0x2751b4,'name');_0x5a0f52[_0x4141('0x31')]=_['keys'](_0xe3ce35[_0x4141('0x31')]);_0x5a0f52[_0x4141('0x32')]=_['intersection'](_0x5a0f52[_0x4141('0x2f')],_0x5a0f52[_0x4141('0x31')]);_0x5a00fb[_0x4141('0x33')]=_['intersection'](_0x5a0f52[_0x4141('0x2f')],qs[_0x4141('0x34')](_0xe3ce35['query'][_0x4141('0x34')]));_0x5a00fb['attributes']=_0x5a00fb[_0x4141('0x33')]['length']?_0x5a00fb['attributes']:_0x5a0f52[_0x4141('0x2f')];if(!_0xe3ce35[_0x4141('0x31')][_0x4141('0x35')](_0x4141('0x36'))){_0x5a00fb[_0x4141('0x1d')]=qs['limit'](_0xe3ce35['query'][_0x4141('0x1d')]);_0x5a00fb[_0x4141('0x1a')]=qs[_0x4141('0x1a')](_0xe3ce35[_0x4141('0x31')][_0x4141('0x1a')]);}_0x5a00fb[_0x4141('0x37')]=qs['sort'](_0xe3ce35[_0x4141('0x31')][_0x4141('0x38')]);_0x5a00fb['where']=qs[_0x4141('0x32')](_[_0x4141('0x39')](_0xe3ce35[_0x4141('0x31')],_0x5a0f52[_0x4141('0x32')]),_0x2751b4);if(_0xe3ce35[_0x4141('0x31')][_0x4141('0x3a')]){_0x5a00fb[_0x4141('0x3b')]=_['merge'](_0x5a00fb[_0x4141('0x3b')],{'$or':_[_0x4141('0x30')](_0x2751b4,function(_0x832d62){if(_0x832d62['type']!=='VIRTUAL'){var _0x5365bb={};_0x5365bb[_0x832d62[_0x4141('0x27')]]={'$like':'%'+_0xe3ce35[_0x4141('0x31')]['filter']+'%'};return _0x5365bb;}})});}_0x5a00fb=_[_0x4141('0x3c')]({},_0x5a00fb,_0xe3ce35[_0x4141('0x3d')]);var _0x2245fa={'where':_0x5a00fb[_0x4141('0x3b')]};return db[_0x4141('0x2a')][_0x4141('0x1c')](_0x2245fa)[_0x4141('0x3e')](function(_0x4ca91f){_0x19b4b5[_0x4141('0x1c')]=_0x4ca91f;if(_0xe3ce35[_0x4141('0x31')][_0x4141('0x3f')]){_0x5a00fb['include']=[{'all':!![]}];}return db[_0x4141('0x2a')][_0x4141('0x40')](_0x5a00fb);})[_0x4141('0x3e')](function(_0x2f8c6c){_0x19b4b5[_0x4141('0x41')]=_0x2f8c6c;return _0x19b4b5;})[_0x4141('0x3e')](respondWithFilteredResult(_0x1925cc,_0x5a00fb))[_0x4141('0x42')](handleError(_0x1925cc,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 3b5cfe0..7ad599a 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 _0x6452=['../../config/logger','bluebird','path','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0x6452,0xda));var _0x2645=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x6452[_0x5a2d95];return _0x2c3986;};'use strict';var _=require(_0x2645('0x0'));var util=require(_0x2645('0x1'));var logger=require(_0x2645('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2645('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2645('0x4'));var rimraf=require('rimraf');var config=require(_0x2645('0x5'));var attributes=require(_0x2645('0x6'));module[_0x2645('0x7')]=function(_0x2b7532,_0x2a3344){return _0x2b7532[_0x2645('0x8')](_0x2645('0x9'),attributes,{'tableName':_0x2645('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1373=['moment','bluebird','path','rimraf','./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api'];(function(_0x3bc895,_0xcc39a8){var _0x35d8fc=function(_0x46355b){while(--_0x46355b){_0x3bc895['push'](_0x3bc895['shift']());}};_0x35d8fc(++_0xcc39a8);}(_0x1373,0x1a9));var _0x3137=function(_0x301658,_0x353760){_0x301658=_0x301658-0x0;var _0x348cf6=_0x1373[_0x301658];return _0x348cf6;};'use strict';var _=require(_0x3137('0x0'));var util=require(_0x3137('0x1'));var logger=require(_0x3137('0x2'))(_0x3137('0x3'));var moment=require(_0x3137('0x4'));var BPromise=require(_0x3137('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3137('0x6'));var rimraf=require(_0x3137('0x7'));var config=require('../../config/environment');var attributes=require(_0x3137('0x8'));module[_0x3137('0x9')]=function(_0x134b84,_0xde4544){return _0x134b84[_0x3137('0xa')](_0x3137('0xb'),attributes,{'tableName':_0x3137('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 180bad3..aba98cd 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 _0xa477=['client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x11b0f7,_0x383a35){var _0x4b1b77=function(_0x247ad4){while(--_0x247ad4){_0x11b0f7['push'](_0x11b0f7['shift']());}};_0x4b1b77(++_0x383a35);}(_0xa477,0xe6));var _0x7a47=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa477[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require('moment');var BPromise=require(_0x7a47('0x2'));var rs=require(_0x7a47('0x3'));var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')][_0x7a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0e,_0x54e9aa,_0x47f594){return new BPromise(function(_0x4276ed,_0x49db4c){return client[_0x7a47('0xc')](_0x4c6e0e,_0x47f594)[_0x7a47('0xd')](function(_0x52eb49){logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,_0x7a47('0x10'));logger[_0x7a47('0x11')](_0x7a47('0x12'),_0x54e9aa,'request\x20sent',JSON[_0x7a47('0x13')](_0x52eb49));if(_0x52eb49[_0x7a47('0x14')]){if(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x15')]===0x1f4){logger['error'](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);return _0x49db4c(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')]['message']);return _0x4276ed(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}else{logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,'request\x20sent');_0x4276ed(_0x52eb49[_0x7a47('0x17')][_0x7a47('0x16')]);}})['catch'](function(_0x4a81fb){logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x4a81fb);_0x49db4c(_0x4a81fb);});});} \ No newline at end of file +var _0xc7ea=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x128450,_0x5869ba){var _0x4d80ed=function(_0x4a2da3){while(--_0x4a2da3){_0x128450['push'](_0x128450['shift']());}};_0x4d80ed(++_0x5869ba);}(_0xc7ea,0x171));var _0xac7e=function(_0x2646a5,_0x4c7180){_0x2646a5=_0x2646a5-0x0;var _0x2c8339=_0xc7ea[_0x2646a5];return _0x2c8339;};'use strict';var _=require(_0xac7e('0x0'));var util=require(_0xac7e('0x1'));var moment=require('moment');var BPromise=require(_0xac7e('0x2'));var rs=require(_0xac7e('0x3'));var fs=require('fs');var Redis=require(_0xac7e('0x4'));var db=require(_0xac7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac7e('0x6'))(_0xac7e('0x7'));var config=require(_0xac7e('0x8'));var jayson=require(_0xac7e('0x9'));var client=jayson[_0xac7e('0xa')][_0xac7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x447bfe,_0x1aca29,_0x1612f3){return new BPromise(function(_0x1cb874,_0x4d83fb){return client[_0xac7e('0xc')](_0x447bfe,_0x1612f3)[_0xac7e('0xd')](function(_0x2efbf4){logger[_0xac7e('0xe')](_0xac7e('0xf'),_0x1aca29,_0xac7e('0x10'));logger[_0xac7e('0x11')](_0xac7e('0x12'),_0x1aca29,_0xac7e('0x10'),JSON[_0xac7e('0x13')](_0x2efbf4));if(_0x2efbf4[_0xac7e('0x14')]){if(_0x2efbf4[_0xac7e('0x14')]['code']===0x1f4){logger[_0xac7e('0x14')](_0xac7e('0xf'),_0x1aca29,_0x2efbf4['error'][_0xac7e('0x15')]);return _0x4d83fb(_0x2efbf4[_0xac7e('0x14')][_0xac7e('0x15')]);}logger[_0xac7e('0x14')](_0xac7e('0xf'),_0x1aca29,_0x2efbf4['error'][_0xac7e('0x15')]);return _0x1cb874(_0x2efbf4[_0xac7e('0x14')][_0xac7e('0x15')]);}else{logger[_0xac7e('0xe')](_0xac7e('0xf'),_0x1aca29,_0xac7e('0x10'));_0x1cb874(_0x2efbf4[_0xac7e('0x16')][_0xac7e('0x15')]);}})['catch'](function(_0x3f4869){logger[_0xac7e('0x14')](_0xac7e('0xf'),_0x1aca29,_0x3f4869);_0x4d83fb(_0x3f4869);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 75e9d27..c114d17 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 _0xb4b6=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x584e84,_0x57097f){var _0x57f690=function(_0x2bab55){while(--_0x2bab55){_0x584e84['push'](_0x584e84['shift']());}};_0x57f690(++_0x57097f);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x184101,_0x1bc040){_0x184101=_0x184101-0x0;var _0x5090c8=_0xb4b6[_0x184101];return _0x5090c8;};'use strict';var multer=require('multer');var util=require(_0x6b4b('0x0'));var path=require(_0x6b4b('0x1'));var timeout=require(_0x6b4b('0x2'));var express=require(_0x6b4b('0x3'));var router=express[_0x6b4b('0x4')]();var fs_extra=require(_0x6b4b('0x5'));var auth=require(_0x6b4b('0x6'));var interaction=require(_0x6b4b('0x7'));var config=require(_0x6b4b('0x8'));var controller=require('./network.controller');router[_0x6b4b('0x9')]('/',auth['isAuthenticated'](),controller[_0x6b4b('0xa')]);router[_0x6b4b('0x9')](_0x6b4b('0xb'),auth[_0x6b4b('0xc')](),controller[_0x6b4b('0xd')]);router['post']('/',auth[_0x6b4b('0xc')](),controller[_0x6b4b('0xe')]);router[_0x6b4b('0xf')](_0x6b4b('0xb'),auth[_0x6b4b('0xc')](),controller[_0x6b4b('0x10')]);router[_0x6b4b('0x11')](_0x6b4b('0xb'),auth['isAuthenticated'](),controller[_0x6b4b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3c50=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','create','update','delete','isAuthenticated','destroy','exports'];(function(_0x5c802c,_0x434257){var _0x3ca25f=function(_0x5984cb){while(--_0x5984cb){_0x5c802c['push'](_0x5c802c['shift']());}};_0x3ca25f(++_0x434257);}(_0x3c50,0x132));var _0x03c5=function(_0x470ee9,_0x2b745d){_0x470ee9=_0x470ee9-0x0;var _0x2f3506=_0x3c50[_0x470ee9];return _0x2f3506;};'use strict';var multer=require(_0x03c5('0x0'));var util=require('util');var path=require(_0x03c5('0x1'));var timeout=require('connect-timeout');var express=require(_0x03c5('0x2'));var router=express[_0x03c5('0x3')]();var fs_extra=require(_0x03c5('0x4'));var auth=require(_0x03c5('0x5'));var interaction=require(_0x03c5('0x6'));var config=require(_0x03c5('0x7'));var controller=require('./network.controller');router[_0x03c5('0x8')]('/',auth['isAuthenticated'](),controller[_0x03c5('0x9')]);router[_0x03c5('0x8')](_0x03c5('0xa'),auth['isAuthenticated'](),controller[_0x03c5('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x03c5('0xc')]);router['put'](_0x03c5('0xa'),auth['isAuthenticated'](),controller[_0x03c5('0xd')]);router[_0x03c5('0xe')]('/:id',auth[_0x03c5('0xf')](),controller[_0x03c5('0x10')]);module[_0x03c5('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index e278126..a47d568 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 _0x29c9=['stun','turn','STRING','sequelize','ENUM','localnet'];(function(_0x1ded0f,_0x2c82a9){var _0x1ad47a=function(_0x5b745b){while(--_0x5b745b){_0x1ded0f['push'](_0x1ded0f['shift']());}};_0x1ad47a(++_0x2c82a9);}(_0x29c9,0xed));var _0x929c=function(_0x283254,_0x4c16a1){_0x283254=_0x283254-0x0;var _0x8488d3=_0x29c9[_0x283254];return _0x8488d3;};'use strict';var Sequelize=require(_0x929c('0x0'));module['exports']={'type':{'type':Sequelize[_0x929c('0x1')](_0x929c('0x2'),'externip',_0x929c('0x3'),_0x929c('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x929c('0x5')]},'password':{'type':Sequelize[_0x929c('0x5')]}}; \ No newline at end of file +var _0x4c70=['turn','STRING','sequelize','ENUM','localnet','externip'];(function(_0x4d56b9,_0x9221f0){var _0x37b056=function(_0x174fe9){while(--_0x174fe9){_0x4d56b9['push'](_0x4d56b9['shift']());}};_0x37b056(++_0x9221f0);}(_0x4c70,0x122));var _0x04c7=function(_0x10eb6b,_0x3fe155){_0x10eb6b=_0x10eb6b-0x0;var _0x3a3ab1=_0x4c70[_0x10eb6b];return _0x3a3ab1;};'use strict';var Sequelize=require(_0x04c7('0x0'));module['exports']={'type':{'type':Sequelize[_0x04c7('0x1')](_0x04c7('0x2'),_0x04c7('0x3'),'stun',_0x04c7('0x4'))},'value':{'type':Sequelize[_0x04c7('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 7797866..5a38802 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 _0x9ae6=['readFileSync','root','writeFileSync','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','chan_sip.so','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','offset','limit','undefined','count','status','set','update','destroy','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','toUpperCase','join','utf8','render','Reload','res_stun_monitor.so','TURN'];(function(_0x3a04c6,_0x12a482){var _0xf4131a=function(_0x413ea2){while(--_0x413ea2){_0x3a04c6['push'](_0x3a04c6['shift']());}};_0xf4131a(++_0x12a482);}(_0x9ae6,0xbf));var _0x69ae=function(_0x96a34a,_0x48b3c6){_0x96a34a=_0x96a34a-0x0;var _0x4e325e=_0x9ae6[_0x96a34a];return _0x4e325e;};'use strict';var util=require(_0x69ae('0x0'));var path=require(_0x69ae('0x1'));var ejs=require(_0x69ae('0x2'));var fs=require('fs');var _=require(_0x69ae('0x3'));var qs=require(_0x69ae('0x4'));var logger=require(_0x69ae('0x5'))(_0x69ae('0x6'));var config=require(_0x69ae('0x7'));var db=require(_0x69ae('0x8'))['db'];var jayson=require(_0x69ae('0x9'));var client=jayson[_0x69ae('0xa')][_0x69ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x277db0,_0x3d819c,_0x4758fc,_0x454ae1){return new Promise(function(_0x26ac4d,_0x37a138){var _0x9c6203=_0x454ae1||client;return _0x9c6203[_0x69ae('0xc')](_0x277db0,_0x4758fc)[_0x69ae('0xd')](function(_0x481c55){logger['info'](_0x69ae('0xe'),_0x3d819c,_0x69ae('0xf'));logger[_0x69ae('0x10')](_0x69ae('0x11'),_0x3d819c,_0x69ae('0xf'),JSON[_0x69ae('0x12')](_0x481c55));if(_0x481c55[_0x69ae('0x13')]){if(_0x481c55[_0x69ae('0x13')][_0x69ae('0x14')]===0x1f4){logger[_0x69ae('0x13')](_0x69ae('0xe'),_0x3d819c,_0x481c55[_0x69ae('0x13')][_0x69ae('0x15')]);return _0x37a138(_0x481c55[_0x69ae('0x13')]['message']);}logger[_0x69ae('0x13')](_0x69ae('0xe'),_0x3d819c,_0x481c55[_0x69ae('0x13')][_0x69ae('0x15')]);return _0x26ac4d(_0x481c55[_0x69ae('0x13')][_0x69ae('0x15')]);}else{logger['info'](_0x69ae('0xe'),_0x3d819c,_0x69ae('0xf'));_0x26ac4d(_0x481c55[_0x69ae('0x16')][_0x69ae('0x15')]);}})[_0x69ae('0x17')](function(_0x404d5e){logger[_0x69ae('0x13')](_0x69ae('0xe'),_0x3d819c,_0x404d5e);_0x37a138(_0x404d5e);});});}function respondWithResult(_0x4dbf1e,_0x517809){_0x517809=_0x517809||0xc8;return function(_0x1470c2){if(_0x1470c2){return _0x4dbf1e['status'](_0x517809)[_0x69ae('0x18')](_0x1470c2);}};}function respondWithFilteredResult(_0x32e9c2,_0x281587){return function(_0xcf397d){if(_0xcf397d){var _0x59a6ac=typeof _0x281587[_0x69ae('0x19')]==='undefined'&&typeof _0x281587[_0x69ae('0x1a')]===_0x69ae('0x1b');var _0xff891b=_0xcf397d[_0x69ae('0x1c')];var _0x120062=_0x59a6ac?0x0:_0x281587[_0x69ae('0x19')];var _0x382fb0=_0x59a6ac?_0xcf397d['count']:_0x281587[_0x69ae('0x19')]+_0x281587[_0x69ae('0x1a')];var _0x2391dc;if(_0x382fb0>=_0xff891b){_0x382fb0=_0xff891b;_0x2391dc=0xc8;}else{_0x2391dc=0xce;}_0x32e9c2[_0x69ae('0x1d')](_0x2391dc);return _0x32e9c2[_0x69ae('0x1e')]('Content-Range',_0x120062+'-'+_0x382fb0+'/'+_0xff891b)[_0x69ae('0x18')](_0xcf397d);}return null;};}function saveUpdates(_0x2da80a){return function(_0x39c142){if(_0x39c142){return _0x39c142[_0x69ae('0x1f')](_0x2da80a)[_0x69ae('0xd')](function(_0x232391){return _0x232391;});}return null;};}function removeEntity(_0x19a79f){return function(_0x466b0c){if(_0x466b0c){return _0x466b0c[_0x69ae('0x20')]()[_0x69ae('0xd')](function(){_0x19a79f[_0x69ae('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e2c39){return function(_0x5e30d4){if(!_0x5e30d4){_0x1e2c39['sendStatus'](0x194);}return _0x5e30d4;};}function handleError(_0x531964,_0x332c09){_0x332c09=_0x332c09||0x1f4;return function(_0x1e3a18){logger[_0x69ae('0x13')](_0x1e3a18[_0x69ae('0x21')]);if(_0x1e3a18[_0x69ae('0x22')]){delete _0x1e3a18[_0x69ae('0x22')];}_0x531964[_0x69ae('0x1d')](_0x332c09)[_0x69ae('0x23')](_0x1e3a18);};}exports[_0x69ae('0x24')]=function(_0x8a54cb,_0xd6f044){var _0x53471a={},_0x413241={},_0xd739d2={'count':0x0,'rows':[]};var _0x3745c0=_[_0x69ae('0x25')](db[_0x69ae('0x26')][_0x69ae('0x27')],function(_0x32fe2a){return{'name':_0x32fe2a[_0x69ae('0x28')],'type':_0x32fe2a[_0x69ae('0x29')][_0x69ae('0x2a')]};});_0x413241[_0x69ae('0x2b')]=_[_0x69ae('0x25')](_0x3745c0,_0x69ae('0x22'));_0x413241[_0x69ae('0x2c')]=_['keys'](_0x8a54cb[_0x69ae('0x2c')]);_0x413241[_0x69ae('0x2d')]=_[_0x69ae('0x2e')](_0x413241[_0x69ae('0x2b')],_0x413241[_0x69ae('0x2c')]);_0x53471a[_0x69ae('0x2f')]=_[_0x69ae('0x2e')](_0x413241[_0x69ae('0x2b')],qs[_0x69ae('0x30')](_0x8a54cb[_0x69ae('0x2c')][_0x69ae('0x30')]));_0x53471a[_0x69ae('0x2f')]=_0x53471a[_0x69ae('0x2f')][_0x69ae('0x31')]?_0x53471a[_0x69ae('0x2f')]:_0x413241[_0x69ae('0x2b')];if(!_0x8a54cb['query'][_0x69ae('0x32')](_0x69ae('0x33'))){_0x53471a[_0x69ae('0x1a')]=qs[_0x69ae('0x1a')](_0x8a54cb[_0x69ae('0x2c')][_0x69ae('0x1a')]);_0x53471a[_0x69ae('0x19')]=qs[_0x69ae('0x19')](_0x8a54cb[_0x69ae('0x2c')][_0x69ae('0x19')]);}_0x53471a[_0x69ae('0x34')]=qs[_0x69ae('0x35')](_0x8a54cb[_0x69ae('0x2c')][_0x69ae('0x35')]);_0x53471a['where']=qs[_0x69ae('0x2d')](_[_0x69ae('0x36')](_0x8a54cb['query'],_0x413241[_0x69ae('0x2d')]),_0x3745c0);if(_0x8a54cb[_0x69ae('0x2c')][_0x69ae('0x37')]){_0x53471a[_0x69ae('0x38')]=_[_0x69ae('0x39')](_0x53471a['where'],{'$or':_[_0x69ae('0x25')](_0x3745c0,function(_0x38d310){if(_0x38d310[_0x69ae('0x29')]!==_0x69ae('0x3a')){var _0x11e316={};_0x11e316[_0x38d310['name']]={'$like':'%'+_0x8a54cb[_0x69ae('0x2c')]['filter']+'%'};return _0x11e316;}})});}_0x53471a=_[_0x69ae('0x39')]({},_0x53471a,_0x8a54cb[_0x69ae('0x3b')]);var _0x118985={'where':_0x53471a[_0x69ae('0x38')]};return db['Network'][_0x69ae('0x1c')](_0x118985)[_0x69ae('0xd')](function(_0x58a1cc){_0xd739d2[_0x69ae('0x1c')]=_0x58a1cc;if(_0x8a54cb['query'][_0x69ae('0x3c')]){_0x53471a[_0x69ae('0x3d')]=[{'all':!![]}];}return db['Network'][_0x69ae('0x3e')](_0x53471a);})[_0x69ae('0xd')](function(_0x3015df){_0xd739d2[_0x69ae('0x3f')]=_0x3015df;return _0xd739d2;})[_0x69ae('0xd')](respondWithFilteredResult(_0xd6f044,_0x53471a))[_0x69ae('0x17')](handleError(_0xd6f044,null));};exports[_0x69ae('0x40')]=function(_0x55090e,_0x22ed4c){var _0x5b94fa={'raw':!![],'where':{'id':_0x55090e['params']['id']}},_0x1b9ad4={};_0x1b9ad4[_0x69ae('0x2b')]=_[_0x69ae('0x41')](db[_0x69ae('0x26')][_0x69ae('0x27')]);_0x1b9ad4[_0x69ae('0x2c')]=_[_0x69ae('0x41')](_0x55090e[_0x69ae('0x2c')]);_0x1b9ad4[_0x69ae('0x2d')]=_[_0x69ae('0x2e')](_0x1b9ad4[_0x69ae('0x2b')],_0x1b9ad4['query']);_0x5b94fa[_0x69ae('0x2f')]=_['intersection'](_0x1b9ad4[_0x69ae('0x2b')],qs['fields'](_0x55090e[_0x69ae('0x2c')][_0x69ae('0x30')]));_0x5b94fa[_0x69ae('0x2f')]=_0x5b94fa[_0x69ae('0x2f')][_0x69ae('0x31')]?_0x5b94fa[_0x69ae('0x2f')]:_0x1b9ad4[_0x69ae('0x2b')];if(_0x55090e[_0x69ae('0x2c')][_0x69ae('0x3c')]){_0x5b94fa['include']=[{'all':!![]}];}_0x5b94fa=_['merge']({},_0x5b94fa,_0x55090e[_0x69ae('0x3b')]);return db[_0x69ae('0x26')][_0x69ae('0x42')](_0x5b94fa)[_0x69ae('0xd')](handleEntityNotFound(_0x22ed4c,null))[_0x69ae('0xd')](respondWithResult(_0x22ed4c,null))['catch'](handleError(_0x22ed4c,null));};exports[_0x69ae('0x43')]=function(_0x188329,_0x2eac5f){var _0x1b05e4;return db[_0x69ae('0x26')][_0x69ae('0x43')](_0x188329[_0x69ae('0x44')],{'raw':!![]})[_0x69ae('0xd')](function(_0x56bd1e){_0x1b05e4=_0x56bd1e;return db['Network'][_0x69ae('0x3e')]({'where':{'type':_0x188329['body'][_0x69ae('0x29')]},'raw':!![]});})['then'](function(_0x2f84d6){if(_0x1b05e4[_0x69ae('0x29')][_0x69ae('0x45')]()=='STUN'){var _0x451491=fs['readFileSync'](path[_0x69ae('0x46')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x69ae('0x47'));var _0x41906=ejs[_0x69ae('0x48')](_0x451491,{'networks':_0x2f84d6||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x41906);return respondWithRpcPromise(_0x69ae('0x49'),'create',{'module':_0x69ae('0x4a')});}else if(_0x1b05e4[_0x69ae('0x29')][_0x69ae('0x45')]()==_0x69ae('0x4b')){var _0x27d455=fs[_0x69ae('0x4c')](path['join'](config[_0x69ae('0x4d')],'server/files/templates/turn_multiple.ejs'),_0x69ae('0x47'));var _0x130064=ejs['render'](_0x27d455,{'networks':_0x2f84d6||[]});fs[_0x69ae('0x4e')](_0x69ae('0x4f'),_0x130064);return respondWithRpcPromise(_0x69ae('0x49'),_0x69ae('0x43'),{'module':_0x69ae('0x4a')});}else{var _0x35fe1c=fs[_0x69ae('0x4c')](path[_0x69ae('0x46')](config[_0x69ae('0x4d')],'server/files/templates/network.ejs'),_0x69ae('0x47'));var _0x2e02f4=ejs[_0x69ae('0x48')](_0x35fe1c,{'networks':_0x2f84d6||[]});fs[_0x69ae('0x4e')](util[_0x69ae('0x50')](_0x69ae('0x51'),_0x188329[_0x69ae('0x44')]['type'][_0x69ae('0x52')]()),_0x2e02f4);return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});}})[_0x69ae('0xd')](function(){return _0x1b05e4;})[_0x69ae('0xd')](respondWithResult(_0x2eac5f,0xc9))[_0x69ae('0x17')](handleError(_0x2eac5f,null));};exports[_0x69ae('0x1f')]=function(_0x228d23,_0x6ecaa7){var _0x38a00a;return db[_0x69ae('0x26')][_0x69ae('0x42')]({'where':{'id':_0x228d23[_0x69ae('0x53')]['id']}})[_0x69ae('0xd')](handleEntityNotFound(_0x6ecaa7,null))[_0x69ae('0xd')](saveUpdates(_0x228d23['body'],null))[_0x69ae('0xd')](function(_0x3ba439){if(_0x3ba439){_0x38a00a=_0x3ba439;return db[_0x69ae('0x26')]['findAll']({'where':{'type':_0x38a00a[_0x69ae('0x29')]},'raw':!![]});}return null;})[_0x69ae('0xd')](function(_0x33071d){if(_0x38a00a[_0x69ae('0x29')][_0x69ae('0x45')]()=='STUN'){var _0x3a4061=fs[_0x69ae('0x4c')](path[_0x69ae('0x46')](config[_0x69ae('0x4d')],_0x69ae('0x54')),_0x69ae('0x47'));var _0x1f9127=ejs[_0x69ae('0x48')](_0x3a4061,{'networks':_0x33071d||[]});fs[_0x69ae('0x4e')](_0x69ae('0x55'),_0x1f9127);return respondWithRpcPromise(_0x69ae('0x49'),_0x69ae('0x1f'),{'module':'res_stun_monitor.so'});}else if(_0x38a00a['type']['toUpperCase']()==_0x69ae('0x4b')){var _0xbf1292=fs[_0x69ae('0x4c')](path[_0x69ae('0x46')](config['root'],_0x69ae('0x56')),_0x69ae('0x47'));var _0x294492=ejs[_0x69ae('0x48')](_0xbf1292,{'networks':_0x33071d||[]});fs[_0x69ae('0x4e')](_0x69ae('0x4f'),_0x294492);return respondWithRpcPromise(_0x69ae('0x49'),_0x69ae('0x1f'),{'module':_0x69ae('0x4a')});}else{var _0x28c217=fs['readFileSync'](path[_0x69ae('0x46')](config[_0x69ae('0x4d')],_0x69ae('0x57')),_0x69ae('0x47'));var _0x3b1791=ejs[_0x69ae('0x48')](_0x28c217,{'networks':_0x33071d||[]});fs[_0x69ae('0x4e')](util[_0x69ae('0x50')](_0x69ae('0x51'),_0x228d23[_0x69ae('0x44')][_0x69ae('0x29')][_0x69ae('0x52')]()),_0x3b1791);return respondWithRpcPromise(_0x69ae('0x49'),_0x69ae('0x1f'),{'module':_0x69ae('0x58')});}})[_0x69ae('0xd')](function(_0x39dae8){if(_0x39dae8){return _0x38a00a;}return null;})['then'](respondWithResult(_0x6ecaa7,null))[_0x69ae('0x17')](handleError(_0x6ecaa7,null));};exports[_0x69ae('0x20')]=function(_0x45c521,_0x40677e){var _0x3a1971;return db[_0x69ae('0x26')][_0x69ae('0x42')]({'where':{'id':_0x45c521[_0x69ae('0x53')]['id']}})[_0x69ae('0xd')](function(_0x9f6172){_0x3a1971=_0x9f6172;return _0x9f6172;})[_0x69ae('0xd')](handleEntityNotFound(_0x40677e,null))[_0x69ae('0xd')](removeEntity(_0x40677e,null))[_0x69ae('0xd')](function(){if(_0x3a1971){return db[_0x69ae('0x26')]['findAll']({'where':{'type':_0x3a1971[_0x69ae('0x29')]},'raw':!![]});}})[_0x69ae('0xd')](function(_0x275404){if(_0x3a1971['type'][_0x69ae('0x45')]()=='STUN'){var _0x688ba2=fs[_0x69ae('0x4c')](path[_0x69ae('0x46')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x69ae('0x47'));var _0x1138ab=ejs[_0x69ae('0x48')](_0x688ba2,{'networks':_0x275404||[]});fs[_0x69ae('0x4e')](_0x69ae('0x55'),_0x1138ab);return respondWithRpcPromise(_0x69ae('0x49'),'destroy',{'module':_0x69ae('0x4a')});}else if(_0x3a1971['type'][_0x69ae('0x45')]()=='TURN'){var _0x3797f5=fs[_0x69ae('0x4c')](path[_0x69ae('0x46')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x69ae('0x47'));var _0x578c05=ejs[_0x69ae('0x48')](_0x3797f5,{'networks':_0x275404||[]});fs[_0x69ae('0x4e')](_0x69ae('0x4f'),_0x578c05);return respondWithRpcPromise(_0x69ae('0x49'),'destroy',{'module':_0x69ae('0x4a')});}else{var _0x1cfc63=fs[_0x69ae('0x4c')](path['join'](config[_0x69ae('0x4d')],'server/files/templates/network.ejs'),_0x69ae('0x47'));var _0x4779cd=ejs[_0x69ae('0x48')](_0x1cfc63,{'networks':_0x275404||[]});fs[_0x69ae('0x4e')](util[_0x69ae('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x3a1971[_0x69ae('0x29')]['toLowerCase']()),_0x4779cd);return respondWithRpcPromise(_0x69ae('0x49'),_0x69ae('0x20'),{'module':_0x69ae('0x58')});}})['catch'](handleError(_0x40677e,null));}; \ No newline at end of file +var _0x4412=['utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/turn_xcally.conf','util','ejs','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','name','send','map','Network','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs'];(function(_0x548d7d,_0x2d41fc){var _0xb1c878=function(_0x570f09){while(--_0x570f09){_0x548d7d['push'](_0x548d7d['shift']());}};_0xb1c878(++_0x2d41fc);}(_0x4412,0x162));var _0x2441=function(_0x3447d5,_0x4250ac){_0x3447d5=_0x3447d5-0x0;var _0x20250b=_0x4412[_0x3447d5];return _0x20250b;};'use strict';var util=require(_0x2441('0x0'));var path=require('path');var ejs=require(_0x2441('0x1'));var fs=require('fs');var _=require(_0x2441('0x2'));var qs=require(_0x2441('0x3'));var logger=require(_0x2441('0x4'))('api');var config=require(_0x2441('0x5'));var db=require(_0x2441('0x6'))['db'];var jayson=require(_0x2441('0x7'));var client=jayson[_0x2441('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa849ea,_0x3d1b91,_0x3d4563,_0x34e7c4){return new Promise(function(_0x5934ee,_0x39919a){var _0x289c4f=_0x34e7c4||client;return _0x289c4f[_0x2441('0x9')](_0xa849ea,_0x3d4563)[_0x2441('0xa')](function(_0x4c9606){logger[_0x2441('0xb')](_0x2441('0xc'),_0x3d1b91,_0x2441('0xd'));logger[_0x2441('0xe')](_0x2441('0xf'),_0x3d1b91,_0x2441('0xd'),JSON[_0x2441('0x10')](_0x4c9606));if(_0x4c9606['error']){if(_0x4c9606['error']['code']===0x1f4){logger[_0x2441('0x11')](_0x2441('0xc'),_0x3d1b91,_0x4c9606[_0x2441('0x11')][_0x2441('0x12')]);return _0x39919a(_0x4c9606[_0x2441('0x11')][_0x2441('0x12')]);}logger[_0x2441('0x11')]('Network,\x20%s,\x20%s',_0x3d1b91,_0x4c9606['error']['message']);return _0x5934ee(_0x4c9606[_0x2441('0x11')][_0x2441('0x12')]);}else{logger['info'](_0x2441('0xc'),_0x3d1b91,_0x2441('0xd'));_0x5934ee(_0x4c9606[_0x2441('0x13')][_0x2441('0x12')]);}})[_0x2441('0x14')](function(_0x4410a1){logger[_0x2441('0x11')](_0x2441('0xc'),_0x3d1b91,_0x4410a1);_0x39919a(_0x4410a1);});});}function respondWithResult(_0x525a37,_0x2c3536){_0x2c3536=_0x2c3536||0xc8;return function(_0x3a7e8f){if(_0x3a7e8f){return _0x525a37[_0x2441('0x15')](_0x2c3536)[_0x2441('0x16')](_0x3a7e8f);}};}function respondWithFilteredResult(_0x5c81b1,_0xe7d01b){return function(_0x26ee65){if(_0x26ee65){var _0x4af02a=typeof _0xe7d01b[_0x2441('0x17')]==='undefined'&&typeof _0xe7d01b[_0x2441('0x18')]===_0x2441('0x19');var _0x1d3872=_0x26ee65[_0x2441('0x1a')];var _0x4311ea=_0x4af02a?0x0:_0xe7d01b[_0x2441('0x17')];var _0x89d2c0=_0x4af02a?_0x26ee65[_0x2441('0x1a')]:_0xe7d01b['offset']+_0xe7d01b[_0x2441('0x18')];var _0x1e9de0;if(_0x89d2c0>=_0x1d3872){_0x89d2c0=_0x1d3872;_0x1e9de0=0xc8;}else{_0x1e9de0=0xce;}_0x5c81b1[_0x2441('0x15')](_0x1e9de0);return _0x5c81b1[_0x2441('0x1b')](_0x2441('0x1c'),_0x4311ea+'-'+_0x89d2c0+'/'+_0x1d3872)[_0x2441('0x16')](_0x26ee65);}return null;};}function saveUpdates(_0x5e052b){return function(_0x3493aa){if(_0x3493aa){return _0x3493aa[_0x2441('0x1d')](_0x5e052b)[_0x2441('0xa')](function(_0x48a17b){return _0x48a17b;});}return null;};}function removeEntity(_0x4af771){return function(_0x241a11){if(_0x241a11){return _0x241a11[_0x2441('0x1e')]()[_0x2441('0xa')](function(){_0x4af771[_0x2441('0x15')](0xcc)[_0x2441('0x1f')]();});}};}function handleEntityNotFound(_0x53b1b1){return function(_0x14051f){if(!_0x14051f){_0x53b1b1[_0x2441('0x20')](0x194);}return _0x14051f;};}function handleError(_0x4eb395,_0x1c7c97){_0x1c7c97=_0x1c7c97||0x1f4;return function(_0x459205){logger['error'](_0x459205['stack']);if(_0x459205[_0x2441('0x21')]){delete _0x459205['name'];}_0x4eb395[_0x2441('0x15')](_0x1c7c97)[_0x2441('0x22')](_0x459205);};}exports['index']=function(_0x5de834,_0x3bfa28){var _0x35e3e1={},_0x3f783f={},_0x5d6ad8={'count':0x0,'rows':[]};var _0xbf0a7a=_[_0x2441('0x23')](db[_0x2441('0x24')][_0x2441('0x25')],function(_0x453859){return{'name':_0x453859['fieldName'],'type':_0x453859[_0x2441('0x26')][_0x2441('0x27')]};});_0x3f783f[_0x2441('0x28')]=_[_0x2441('0x23')](_0xbf0a7a,_0x2441('0x21'));_0x3f783f['query']=_[_0x2441('0x29')](_0x5de834['query']);_0x3f783f['filters']=_[_0x2441('0x2a')](_0x3f783f[_0x2441('0x28')],_0x3f783f[_0x2441('0x2b')]);_0x35e3e1[_0x2441('0x2c')]=_[_0x2441('0x2a')](_0x3f783f[_0x2441('0x28')],qs[_0x2441('0x2d')](_0x5de834['query']['fields']));_0x35e3e1[_0x2441('0x2c')]=_0x35e3e1['attributes'][_0x2441('0x2e')]?_0x35e3e1[_0x2441('0x2c')]:_0x3f783f[_0x2441('0x28')];if(!_0x5de834[_0x2441('0x2b')]['hasOwnProperty']('nolimit')){_0x35e3e1[_0x2441('0x18')]=qs[_0x2441('0x18')](_0x5de834['query']['limit']);_0x35e3e1[_0x2441('0x17')]=qs[_0x2441('0x17')](_0x5de834[_0x2441('0x2b')]['offset']);}_0x35e3e1[_0x2441('0x2f')]=qs[_0x2441('0x30')](_0x5de834[_0x2441('0x2b')][_0x2441('0x30')]);_0x35e3e1[_0x2441('0x31')]=qs[_0x2441('0x32')](_[_0x2441('0x33')](_0x5de834['query'],_0x3f783f['filters']),_0xbf0a7a);if(_0x5de834['query'][_0x2441('0x34')]){_0x35e3e1[_0x2441('0x31')]=_[_0x2441('0x35')](_0x35e3e1['where'],{'$or':_[_0x2441('0x23')](_0xbf0a7a,function(_0x3da51c){if(_0x3da51c[_0x2441('0x26')]!==_0x2441('0x36')){var _0x561952={};_0x561952[_0x3da51c['name']]={'$like':'%'+_0x5de834['query'][_0x2441('0x34')]+'%'};return _0x561952;}})});}_0x35e3e1=_['merge']({},_0x35e3e1,_0x5de834[_0x2441('0x37')]);var _0x38e5a3={'where':_0x35e3e1[_0x2441('0x31')]};return db[_0x2441('0x24')][_0x2441('0x1a')](_0x38e5a3)[_0x2441('0xa')](function(_0x27a959){_0x5d6ad8[_0x2441('0x1a')]=_0x27a959;if(_0x5de834[_0x2441('0x2b')][_0x2441('0x38')]){_0x35e3e1[_0x2441('0x39')]=[{'all':!![]}];}return db[_0x2441('0x24')][_0x2441('0x3a')](_0x35e3e1);})['then'](function(_0x580074){_0x5d6ad8[_0x2441('0x3b')]=_0x580074;return _0x5d6ad8;})[_0x2441('0xa')](respondWithFilteredResult(_0x3bfa28,_0x35e3e1))[_0x2441('0x14')](handleError(_0x3bfa28,null));};exports[_0x2441('0x3c')]=function(_0x399cf6,_0x3667fa){var _0x5eac4b={'raw':!![],'where':{'id':_0x399cf6[_0x2441('0x3d')]['id']}},_0x1840c0={};_0x1840c0[_0x2441('0x28')]=_[_0x2441('0x29')](db[_0x2441('0x24')][_0x2441('0x25')]);_0x1840c0[_0x2441('0x2b')]=_[_0x2441('0x29')](_0x399cf6['query']);_0x1840c0[_0x2441('0x32')]=_[_0x2441('0x2a')](_0x1840c0[_0x2441('0x28')],_0x1840c0[_0x2441('0x2b')]);_0x5eac4b[_0x2441('0x2c')]=_[_0x2441('0x2a')](_0x1840c0[_0x2441('0x28')],qs[_0x2441('0x2d')](_0x399cf6['query'][_0x2441('0x2d')]));_0x5eac4b[_0x2441('0x2c')]=_0x5eac4b[_0x2441('0x2c')][_0x2441('0x2e')]?_0x5eac4b[_0x2441('0x2c')]:_0x1840c0[_0x2441('0x28')];if(_0x399cf6[_0x2441('0x2b')][_0x2441('0x38')]){_0x5eac4b[_0x2441('0x39')]=[{'all':!![]}];}_0x5eac4b=_[_0x2441('0x35')]({},_0x5eac4b,_0x399cf6[_0x2441('0x37')]);return db[_0x2441('0x24')][_0x2441('0x3e')](_0x5eac4b)['then'](handleEntityNotFound(_0x3667fa,null))['then'](respondWithResult(_0x3667fa,null))[_0x2441('0x14')](handleError(_0x3667fa,null));};exports[_0x2441('0x3f')]=function(_0x550631,_0x5c6fb4){var _0x28c262;return db[_0x2441('0x24')][_0x2441('0x3f')](_0x550631[_0x2441('0x40')],{'raw':!![]})['then'](function(_0x53b28e){_0x28c262=_0x53b28e;return db['Network']['findAll']({'where':{'type':_0x550631['body']['type']},'raw':!![]});})['then'](function(_0x3e7386){if(_0x28c262[_0x2441('0x26')][_0x2441('0x41')]()==_0x2441('0x42')){var _0x5954b5=fs[_0x2441('0x43')](path[_0x2441('0x44')](config[_0x2441('0x45')],_0x2441('0x46')),_0x2441('0x47'));var _0xa946b6=ejs[_0x2441('0x48')](_0x5954b5,{'networks':_0x3e7386||[]});fs[_0x2441('0x49')](_0x2441('0x4a'),_0xa946b6);return respondWithRpcPromise(_0x2441('0x4b'),_0x2441('0x3f'),{'module':_0x2441('0x4c')});}else if(_0x28c262[_0x2441('0x26')][_0x2441('0x41')]()==_0x2441('0x4d')){var _0x12f1f8=fs[_0x2441('0x43')](path['join'](config['root'],_0x2441('0x4e')),_0x2441('0x47'));var _0x4e6a45=ejs[_0x2441('0x48')](_0x12f1f8,{'networks':_0x3e7386||[]});fs[_0x2441('0x49')]('/etc/asterisk/turn_xcally.conf',_0x4e6a45);return respondWithRpcPromise(_0x2441('0x4b'),'create',{'module':_0x2441('0x4c')});}else{var _0x2919e8=fs[_0x2441('0x43')](path[_0x2441('0x44')](config[_0x2441('0x45')],_0x2441('0x4f')),_0x2441('0x47'));var _0x2df333=ejs['render'](_0x2919e8,{'networks':_0x3e7386||[]});fs['writeFileSync'](util[_0x2441('0x50')](_0x2441('0x51'),_0x550631['body'][_0x2441('0x26')][_0x2441('0x52')]()),_0x2df333);return respondWithRpcPromise(_0x2441('0x4b'),_0x2441('0x3f'),{'module':_0x2441('0x53')});}})['then'](function(){return _0x28c262;})[_0x2441('0xa')](respondWithResult(_0x5c6fb4,0xc9))[_0x2441('0x14')](handleError(_0x5c6fb4,null));};exports[_0x2441('0x1d')]=function(_0xcbda81,_0xa7a092){var _0x5ee70b;return db[_0x2441('0x24')]['find']({'where':{'id':_0xcbda81['params']['id']}})[_0x2441('0xa')](handleEntityNotFound(_0xa7a092,null))[_0x2441('0xa')](saveUpdates(_0xcbda81[_0x2441('0x40')],null))[_0x2441('0xa')](function(_0x2bb92c){if(_0x2bb92c){_0x5ee70b=_0x2bb92c;return db[_0x2441('0x24')][_0x2441('0x3a')]({'where':{'type':_0x5ee70b[_0x2441('0x26')]},'raw':!![]});}return null;})[_0x2441('0xa')](function(_0x207a16){if(_0x5ee70b[_0x2441('0x26')][_0x2441('0x41')]()==_0x2441('0x42')){var _0x4b336d=fs[_0x2441('0x43')](path[_0x2441('0x44')](config[_0x2441('0x45')],_0x2441('0x46')),'utf8');var _0x1f3bf6=ejs[_0x2441('0x48')](_0x4b336d,{'networks':_0x207a16||[]});fs[_0x2441('0x49')](_0x2441('0x4a'),_0x1f3bf6);return respondWithRpcPromise('Reload',_0x2441('0x1d'),{'module':_0x2441('0x4c')});}else if(_0x5ee70b[_0x2441('0x26')]['toUpperCase']()==_0x2441('0x4d')){var _0x520fe5=fs[_0x2441('0x43')](path[_0x2441('0x44')](config[_0x2441('0x45')],_0x2441('0x4e')),_0x2441('0x47'));var _0x21fbfd=ejs[_0x2441('0x48')](_0x520fe5,{'networks':_0x207a16||[]});fs[_0x2441('0x49')](_0x2441('0x54'),_0x21fbfd);return respondWithRpcPromise(_0x2441('0x4b'),_0x2441('0x1d'),{'module':_0x2441('0x4c')});}else{var _0x6f0bbf=fs['readFileSync'](path[_0x2441('0x44')](config['root'],_0x2441('0x4f')),_0x2441('0x47'));var _0x1684f0=ejs[_0x2441('0x48')](_0x6f0bbf,{'networks':_0x207a16||[]});fs[_0x2441('0x49')](util[_0x2441('0x50')](_0x2441('0x51'),_0xcbda81[_0x2441('0x40')]['type'][_0x2441('0x52')]()),_0x1684f0);return respondWithRpcPromise(_0x2441('0x4b'),_0x2441('0x1d'),{'module':_0x2441('0x53')});}})['then'](function(_0x43e059){if(_0x43e059){return _0x5ee70b;}return null;})[_0x2441('0xa')](respondWithResult(_0xa7a092,null))[_0x2441('0x14')](handleError(_0xa7a092,null));};exports['destroy']=function(_0x389768,_0x335d24){var _0x1f63d9;return db['Network'][_0x2441('0x3e')]({'where':{'id':_0x389768[_0x2441('0x3d')]['id']}})[_0x2441('0xa')](function(_0x4f8044){_0x1f63d9=_0x4f8044;return _0x4f8044;})[_0x2441('0xa')](handleEntityNotFound(_0x335d24,null))[_0x2441('0xa')](removeEntity(_0x335d24,null))[_0x2441('0xa')](function(){if(_0x1f63d9){return db[_0x2441('0x24')][_0x2441('0x3a')]({'where':{'type':_0x1f63d9['type']},'raw':!![]});}})[_0x2441('0xa')](function(_0x349831){if(_0x1f63d9[_0x2441('0x26')][_0x2441('0x41')]()==_0x2441('0x42')){var _0x522d40=fs['readFileSync'](path[_0x2441('0x44')](config[_0x2441('0x45')],_0x2441('0x46')),_0x2441('0x47'));var _0x5cef14=ejs['render'](_0x522d40,{'networks':_0x349831||[]});fs[_0x2441('0x49')](_0x2441('0x4a'),_0x5cef14);return respondWithRpcPromise(_0x2441('0x4b'),_0x2441('0x1e'),{'module':_0x2441('0x4c')});}else if(_0x1f63d9[_0x2441('0x26')]['toUpperCase']()==_0x2441('0x4d')){var _0x268886=fs[_0x2441('0x43')](path[_0x2441('0x44')](config['root'],_0x2441('0x4e')),_0x2441('0x47'));var _0x4265f0=ejs[_0x2441('0x48')](_0x268886,{'networks':_0x349831||[]});fs[_0x2441('0x49')]('/etc/asterisk/turn_xcally.conf',_0x4265f0);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else{var _0x331ab2=fs[_0x2441('0x43')](path[_0x2441('0x44')](config[_0x2441('0x45')],_0x2441('0x4f')),_0x2441('0x47'));var _0x1b66f6=ejs[_0x2441('0x48')](_0x331ab2,{'networks':_0x349831||[]});fs[_0x2441('0x49')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x1f63d9[_0x2441('0x26')][_0x2441('0x52')]()),_0x1b66f6);return respondWithRpcPromise(_0x2441('0x4b'),_0x2441('0x1e'),{'module':_0x2441('0x53')});}})[_0x2441('0x14')](handleError(_0x335d24,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 109d59f..c7f6f08 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 _0x54f3=['api','moment','bluebird','rimraf','../../config/environment','./network.attributes','Network','network','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54f3,0x120));var _0x354f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x54f3[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0x354f('0x0'));var logger=require(_0x354f('0x1'))(_0x354f('0x2'));var moment=require(_0x354f('0x3'));var BPromise=require(_0x354f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x354f('0x5'));var config=require(_0x354f('0x6'));var attributes=require(_0x354f('0x7'));module['exports']=function(_0x5618ac,_0x234ac6){return _0x5618ac['define'](_0x354f('0x8'),attributes,{'tableName':_0x354f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bb0=['exports','define','Network','lodash','util','../../config/logger','moment','path','../../config/environment','./network.attributes'];(function(_0x452145,_0x1fa5b6){var _0x1b49f2=function(_0xd99025){while(--_0xd99025){_0x452145['push'](_0x452145['shift']());}};_0x1b49f2(++_0x1fa5b6);}(_0x2bb0,0xf3));var _0x02bb=function(_0x18e68d,_0x3345c2){_0x18e68d=_0x18e68d-0x0;var _0x114fb0=_0x2bb0[_0x18e68d];return _0x114fb0;};'use strict';var _=require(_0x02bb('0x0'));var util=require(_0x02bb('0x1'));var logger=require(_0x02bb('0x2'))('api');var moment=require(_0x02bb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x02bb('0x4'));var rimraf=require('rimraf');var config=require(_0x02bb('0x5'));var attributes=require(_0x02bb('0x6'));module[_0x02bb('0x7')]=function(_0x390ff7,_0x43dbb7){return _0x390ff7[_0x02bb('0x8')](_0x02bb('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index e5066a6..9c7bb0c 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x374020,_0x17f5d1){_0x374020=_0x374020-0x0;var _0x362f9f=_0x7a54[_0x374020];return _0x362f9f;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x6c258d,_0x1795f9){_0x6c258d=_0x6c258d-0x0;var _0x2c53f8=_0x7a54[_0x6c258d];return _0x2c53f8;};'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 28febcb..e25e5f4 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 _0xa456=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','getAgents','post','create','addAnswer','notify','/:id/applications','/:id/users','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','multer','util'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0xa456,0x142));var _0x6a45=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xa456[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var path=require(_0x6a45('0x2'));var timeout=require(_0x6a45('0x3'));var express=require('express');var router=express[_0x6a45('0x4')]();var fs_extra=require(_0x6a45('0x5'));var auth=require(_0x6a45('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a45('0x7'));var controller=require(_0x6a45('0x8'));router[_0x6a45('0x9')]('/',auth[_0x6a45('0xa')](),controller['index']);router[_0x6a45('0x9')](_0x6a45('0xb'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xc')]);router[_0x6a45('0x9')]('/:id',auth[_0x6a45('0xa')](),controller['show']);router[_0x6a45('0x9')](_0x6a45('0xd'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xe')]);router[_0x6a45('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6a45('0xf')]);router[_0x6a45('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x6a45('0x9')](_0x6a45('0x10'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x11')]);router[_0x6a45('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x6a45('0x12')]);router[_0x6a45('0x13')]('/',auth['isAuthenticated'](),controller[_0x6a45('0x14')]);router[_0x6a45('0x13')](_0x6a45('0xd'),auth[_0x6a45('0xa')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x6a45('0xa')](),controller[_0x6a45('0x15')]);router[_0x6a45('0x13')]('/:id/notify',controller[_0x6a45('0x16')]);router[_0x6a45('0x13')](_0x6a45('0x17'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x6a45('0x18'),auth[_0x6a45('0xa')](),controller['addAgents']);router[_0x6a45('0x13')](_0x6a45('0x19'),auth['isAuthenticated'](),controller[_0x6a45('0x1a')]);router[_0x6a45('0x1b')](_0x6a45('0x1c'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x1d')]);router['delete']('/:id',auth[_0x6a45('0xa')](),controller[_0x6a45('0x1e')]);router[_0x6a45('0x1f')](_0x6a45('0xd'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x20')]);router[_0x6a45('0x1f')](_0x6a45('0x21'),auth[_0x6a45('0xa')](),controller[_0x6a45('0x22')]);router[_0x6a45('0x1f')](_0x6a45('0x18'),auth['isAuthenticated'](),controller[_0x6a45('0x23')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['show','/:id/dispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x161709,_0x3f9c90){var _0x33be6f=function(_0x2ffa89){while(--_0x2ffa89){_0x161709['push'](_0x161709['shift']());}};_0x33be6f(++_0x3f9c90);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a3cc7,_0x2900e3){_0x1a3cc7=_0x1a3cc7-0x0;var _0x338438=_0xb10b[_0x1a3cc7];return _0x338438;};'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('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getAnswers']);router[_0xbb10('0x9')]('/:id/applications',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('0x16')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x16')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x18')]);router['post'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);router[_0xbb10('0x16')](_0xbb10('0x1a'),controller[_0xbb10('0x1b')]);router[_0xbb10('0x16')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['post'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x16')](_0xbb10('0x1f'),auth[_0xbb10('0xb')](),controller['send']);router[_0xbb10('0x20')](_0xbb10('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xbb10('0x21')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x22')]);router[_0xbb10('0x21')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x23')]);router[_0xbb10('0x21')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xbb10('0x25')]);module[_0xbb10('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 ad8bb20..45a7110 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 _0xe7e0=['mandatoryDisposition','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x294288,_0x3005db){var _0x3b0156=function(_0x52b138){while(--_0x52b138){_0x294288['push'](_0x294288['shift']());}};_0x3b0156(++_0x3005db);}(_0xe7e0,0xc7));var _0x0e7e=function(_0x524f7d,_0x20d3f2){_0x524f7d=_0x524f7d-0x0;var _0x5137c9=_0xe7e0[_0x524f7d];return _0x5137c9;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x0e7e('0x0')]={'name':{'type':Sequelize[_0x0e7e('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x0e7e('0x1')]},'token':{'type':Sequelize[_0x0e7e('0x1')],'defaultValue':function(){return rs[_0x0e7e('0x2')]();}},'replyUri':{'type':Sequelize[_0x0e7e('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0e7e('0x3')],'defaultValue':function(){return _0x0e7e('0x4');}},'notificationSound':{'type':Sequelize[_0x0e7e('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0e7e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0e7e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x0e7e('0x1')]},'queueTransfer':{'type':Sequelize[_0x0e7e('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0e7e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0e7e('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0e7e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0e7e('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x0e7e('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2a3278){if(!_0x2a3278)this[_0x0e7e('0x8')](_0x0e7e('0x9'),null);this[_0x0e7e('0x8')](_0x0e7e('0xa'),_0x2a3278);}}}; \ No newline at end of file +var _0xfb4b=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xfb4b,0x95));var _0xbfb4=function(_0x540d50,_0x329512){_0x540d50=_0x540d50-0x0;var _0x26ced3=_0xfb4b[_0x540d50];return _0x26ced3;};'use strict';var Sequelize=require(_0xbfb4('0x0'));var rs=require(_0xbfb4('0x1'));module['exports']={'name':{'type':Sequelize[_0xbfb4('0x2')],'unique':_0xbfb4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xbfb4('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xbfb4('0x4')]();}},'replyUri':{'type':Sequelize[_0xbfb4('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xbfb4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbfb4('0x5')],'defaultValue':function(){return _0xbfb4('0x6');}},'notificationSound':{'type':Sequelize[_0xbfb4('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbfb4('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbfb4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xbfb4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xbfb4('0x2')]},'queueTransfer':{'type':Sequelize[_0xbfb4('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbfb4('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbfb4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbfb4('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xbfb4('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xbfb4('0x7')],'defaultValue':![],'comment':_0xbfb4('0xa'),'set':function(_0x5cee72){if(!_0x5cee72)this[_0xbfb4('0xb')]('mandatoryDispositionPauseId',null);this[_0xbfb4('0xb')]('mandatoryDisposition',_0x5cee72);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 6048372..7fc66f3 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 _0xada4=['list','orderBy','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','User','agent','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','priority','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','tag','addAgents','omit','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','set','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','end','stack','name','send','index','Pause','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','OpenchannelAccount','findAll','rows','params','mandatoryDispositionPause','keys','length','find','create','body','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','applications'];(function(_0xc414fb,_0x39ca04){var _0x19ec4d=function(_0x433916){while(--_0x433916){_0xc414fb['push'](_0xc414fb['shift']());}};_0x19ec4d(++_0x39ca04);}(_0xada4,0x1bc));var _0x4ada=function(_0x51a06b,_0x563f1f){_0x51a06b=_0x51a06b-0x0;var _0xd26906=_0xada4[_0x51a06b];return _0xd26906;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ada('0x0'));var zipdir=require(_0x4ada('0x1'));var jsonpatch=require(_0x4ada('0x2'));var rp=require(_0x4ada('0x3'));var moment=require(_0x4ada('0x4'));var BPromise=require(_0x4ada('0x5'));var Mustache=require(_0x4ada('0x6'));var util=require('util');var path=require(_0x4ada('0x7'));var sox=require(_0x4ada('0x8'));var csv=require(_0x4ada('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ada('0xa'));var _=require(_0x4ada('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4ada('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4ada('0x9'));var querystring=require(_0x4ada('0xd'));var Papa=require(_0x4ada('0xe'));var Redis=require(_0x4ada('0xf'));var authService=require(_0x4ada('0x10'));var qs=require(_0x4ada('0x11'));var as=require(_0x4ada('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ada('0x13'))('api');var utils=require(_0x4ada('0x14'));var config=require(_0x4ada('0x15'));var licenseUtil=require(_0x4ada('0x16'));var db=require(_0x4ada('0x17'))['db'];config[_0x4ada('0x18')]=_[_0x4ada('0x19')](config[_0x4ada('0x18')],{'host':_0x4ada('0x1a'),'port':0x18eb});var socket=require(_0x4ada('0x1b'))(new Redis(config[_0x4ada('0x18')]));require(_0x4ada('0x1c'))[_0x4ada('0x1d')](socket);var jayson=require(_0x4ada('0x1e'));var client=jayson[_0x4ada('0x1f')][_0x4ada('0x20')]({'port':0x232c});var client9002=jayson[_0x4ada('0x1f')][_0x4ada('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3f34fb,_0x304c9a,_0x40522b,_0x3f6ec8){return new BPromise(function(_0x2951e9,_0x56239a){var _0xfc48ea=_0x3f6ec8||client;return _0xfc48ea[_0x4ada('0x21')](_0x3f34fb,_0x40522b)[_0x4ada('0x22')](function(_0xa67bd5){logger[_0x4ada('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x304c9a,'request\x20sent');logger[_0x4ada('0x24')](_0x4ada('0x25'),_0x304c9a,_0x4ada('0x26'),JSON[_0x4ada('0x27')](_0xa67bd5));if(_0xa67bd5[_0x4ada('0x28')]){if(_0xa67bd5[_0x4ada('0x28')][_0x4ada('0x29')]===0x1f4){logger[_0x4ada('0x28')](_0x4ada('0x2a'),_0x304c9a,_0xa67bd5[_0x4ada('0x28')][_0x4ada('0x2b')]);return _0x56239a(_0xa67bd5[_0x4ada('0x28')][_0x4ada('0x2b')]);}logger[_0x4ada('0x28')](_0x4ada('0x2a'),_0x304c9a,_0xa67bd5['error']['message']);return _0x2951e9(_0xa67bd5['error'][_0x4ada('0x2b')]);}else{logger[_0x4ada('0x23')](_0x4ada('0x2a'),_0x304c9a,_0x4ada('0x26'));_0x2951e9(_0xa67bd5[_0x4ada('0x2c')][_0x4ada('0x2b')]);}})[_0x4ada('0x2d')](function(_0x1e6eed){logger[_0x4ada('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x304c9a,_0x1e6eed);_0x56239a(_0x1e6eed);});});}function respondWithStatusCode(_0x32846c,_0x2b43e9){_0x2b43e9=_0x2b43e9||0xcc;return function(_0x150086){if(_0x150086){return _0x32846c[_0x4ada('0x2e')](_0x2b43e9);}return _0x32846c['status'](_0x2b43e9)['end']();};}function respondWithResult(_0x1b2a95,_0x414bef){_0x414bef=_0x414bef||0xc8;return function(_0x23ad41){if(_0x23ad41){return _0x1b2a95[_0x4ada('0x2f')](_0x414bef)[_0x4ada('0x30')](_0x23ad41);}};}function respondWithFilteredResult(_0x58e563,_0xfac6fd){return function(_0x7b6193){if(_0x7b6193){var _0x247d5f=typeof _0xfac6fd[_0x4ada('0x31')]===_0x4ada('0x32')&&typeof _0xfac6fd['limit']===_0x4ada('0x32');var _0x1708ea=_0x7b6193[_0x4ada('0x33')];var _0x4159a1=_0x247d5f?0x0:_0xfac6fd['offset'];var _0x4aeaea=_0x247d5f?_0x7b6193['count']:_0xfac6fd[_0x4ada('0x31')]+_0xfac6fd['limit'];var _0xc8d815;if(_0x4aeaea>=_0x1708ea){_0x4aeaea=_0x1708ea;_0xc8d815=0xc8;}else{_0xc8d815=0xce;}_0x58e563[_0x4ada('0x2f')](_0xc8d815);return _0x58e563[_0x4ada('0x34')]('Content-Range',_0x4159a1+'-'+_0x4aeaea+'/'+_0x1708ea)[_0x4ada('0x30')](_0x7b6193);}return null;};}function patchUpdates(_0x3437d0){return function(_0x41013c){try{jsonpatch[_0x4ada('0x35')](_0x41013c,_0x3437d0,!![]);}catch(_0x4d13c5){return BPromise[_0x4ada('0x36')](_0x4d13c5);}return _0x41013c[_0x4ada('0x37')]();};}function saveUpdates(_0xd8daf5,_0x1fb12d){return function(_0x2f86dc){if(_0x2f86dc){return _0x2f86dc[_0x4ada('0x38')](_0xd8daf5)[_0x4ada('0x22')](function(_0x5ebe8d){return _0x5ebe8d;});}return null;};}function removeEntity(_0x57ca4c,_0x526e87){return function(_0x3b96d6){if(_0x3b96d6){return _0x3b96d6[_0x4ada('0x39')]()[_0x4ada('0x22')](function(){var _0x2ed871=_0x3b96d6['get']({'plain':!![]});var _0x404988=_0x4ada('0x3a');return db[_0x4ada('0x3b')][_0x4ada('0x39')]({'where':{'type':_0x404988,'resourceId':_0x2ed871['id']}})[_0x4ada('0x22')](function(){return _0x3b96d6;});})['then'](function(){_0x57ca4c[_0x4ada('0x2f')](0xcc)[_0x4ada('0x3c')]();});}};}function handleEntityNotFound(_0x364369,_0x43fe5d){return function(_0x28f4c9){if(!_0x28f4c9){_0x364369[_0x4ada('0x2e')](0x194);}return _0x28f4c9;};}function handleError(_0xb1df30,_0x3a1ca1){_0x3a1ca1=_0x3a1ca1||0x1f4;return function(_0x3a2c7c){logger[_0x4ada('0x28')](_0x3a2c7c[_0x4ada('0x3d')]);if(_0x3a2c7c[_0x4ada('0x3e')]){delete _0x3a2c7c['name'];}_0xb1df30[_0x4ada('0x2f')](_0x3a1ca1)[_0x4ada('0x3f')](_0x3a2c7c);};}exports[_0x4ada('0x40')]=function(_0x98cd1a,_0x152a58){var _0x2c41ed={'include':[{'model':db[_0x4ada('0x41')],'as':'mandatoryDispositionPause'}]},_0x47cb72={},_0x35d84c={'count':0x0,'rows':[]};var _0xb71764=_[_0x4ada('0x42')](db['OpenchannelAccount'][_0x4ada('0x43')],function(_0x50a4cb){return{'name':_0x50a4cb['fieldName'],'type':_0x50a4cb[_0x4ada('0x44')][_0x4ada('0x45')]};});_0x47cb72[_0x4ada('0x46')]=_[_0x4ada('0x42')](_0xb71764,'name');_0x47cb72[_0x4ada('0x47')]=_['keys'](_0x98cd1a[_0x4ada('0x47')]);_0x47cb72[_0x4ada('0x48')]=_[_0x4ada('0x49')](_0x47cb72[_0x4ada('0x46')],_0x47cb72['query']);_0x2c41ed[_0x4ada('0x4a')]=_['intersection'](_0x47cb72[_0x4ada('0x46')],qs[_0x4ada('0x4b')](_0x98cd1a['query']['fields']));_0x2c41ed[_0x4ada('0x4a')]=_0x2c41ed[_0x4ada('0x4a')]['length']?_0x2c41ed[_0x4ada('0x4a')]:_0x47cb72[_0x4ada('0x46')];if(!_0x98cd1a[_0x4ada('0x47')][_0x4ada('0x4c')](_0x4ada('0x4d'))){_0x2c41ed[_0x4ada('0x4e')]=qs['limit'](_0x98cd1a[_0x4ada('0x47')][_0x4ada('0x4e')]);_0x2c41ed[_0x4ada('0x31')]=qs[_0x4ada('0x31')](_0x98cd1a['query'][_0x4ada('0x31')]);}_0x2c41ed[_0x4ada('0x4f')]=qs[_0x4ada('0x50')](_0x98cd1a[_0x4ada('0x47')][_0x4ada('0x50')]);_0x2c41ed[_0x4ada('0x51')]=qs[_0x4ada('0x48')](_[_0x4ada('0x52')](_0x98cd1a[_0x4ada('0x47')],_0x47cb72[_0x4ada('0x48')]),_0xb71764);if(_0x98cd1a[_0x4ada('0x47')][_0x4ada('0x53')]){_0x2c41ed[_0x4ada('0x51')]=_[_0x4ada('0x54')](_0x2c41ed[_0x4ada('0x51')],{'$or':_[_0x4ada('0x42')](_0xb71764,function(_0x4f9ef4){if(_0x4f9ef4['type']!==_0x4ada('0x55')){var _0x2e0983={};_0x2e0983[_0x4f9ef4[_0x4ada('0x3e')]]={'$like':'%'+_0x98cd1a[_0x4ada('0x47')][_0x4ada('0x53')]+'%'};return _0x2e0983;}})});}_0x2c41ed=_[_0x4ada('0x54')]({},_0x2c41ed,_0x98cd1a[_0x4ada('0x56')]);var _0x43120c={'where':_0x2c41ed['where']};return db['OpenchannelAccount'][_0x4ada('0x33')](_0x43120c)[_0x4ada('0x22')](function(_0x65d567){_0x35d84c[_0x4ada('0x33')]=_0x65d567;if(_0x98cd1a[_0x4ada('0x47')][_0x4ada('0x57')]){_0x2c41ed[_0x4ada('0x58')]=[{'all':!![]}];}return db[_0x4ada('0x59')][_0x4ada('0x5a')](_0x2c41ed);})[_0x4ada('0x22')](function(_0x58b809){_0x35d84c[_0x4ada('0x5b')]=_0x58b809;return _0x35d84c;})[_0x4ada('0x22')](respondWithFilteredResult(_0x152a58,_0x2c41ed))[_0x4ada('0x2d')](handleError(_0x152a58,null));};exports['show']=function(_0x2532a4,_0x10091f){var _0x42710c={'raw':![],'where':{'id':_0x2532a4[_0x4ada('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x4ada('0x5d')}]},_0x2a84bb={};_0x2a84bb[_0x4ada('0x46')]=_['keys'](db[_0x4ada('0x59')]['rawAttributes']);_0x2a84bb[_0x4ada('0x47')]=_[_0x4ada('0x5e')](_0x2532a4[_0x4ada('0x47')]);_0x2a84bb['filters']=_['intersection'](_0x2a84bb['model'],_0x2a84bb[_0x4ada('0x47')]);_0x42710c['attributes']=_[_0x4ada('0x49')](_0x2a84bb['model'],qs[_0x4ada('0x4b')](_0x2532a4[_0x4ada('0x47')][_0x4ada('0x4b')]));_0x42710c[_0x4ada('0x4a')]=_0x42710c['attributes'][_0x4ada('0x5f')]?_0x42710c['attributes']:_0x2a84bb[_0x4ada('0x46')];if(_0x2532a4[_0x4ada('0x47')]['includeAll']){_0x42710c[_0x4ada('0x58')]=[{'all':!![]}];}_0x42710c=_[_0x4ada('0x54')]({},_0x42710c,_0x2532a4[_0x4ada('0x56')]);return db[_0x4ada('0x59')][_0x4ada('0x60')](_0x42710c)[_0x4ada('0x22')](handleEntityNotFound(_0x10091f,null))['then'](respondWithResult(_0x10091f,null))['catch'](handleError(_0x10091f,null));};exports[_0x4ada('0x61')]=function(_0x4eb766,_0x22e4d0){return db[_0x4ada('0x59')][_0x4ada('0x61')](_0x4eb766[_0x4ada('0x62')],{})[_0x4ada('0x22')](function(_0x24e6f0){var _0x39d277=_0x4eb766[_0x4ada('0x63')][_0x4ada('0x64')]({'plain':!![]});if(!_0x39d277)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39d277['role']===_0x4ada('0x63')){var _0x48f752=_0x24e6f0[_0x4ada('0x64')]({'plain':!![]});var _0x2523ca=_0x4ada('0x3a');return db[_0x4ada('0x65')][_0x4ada('0x60')]({'where':{'name':_0x2523ca,'userProfileId':_0x39d277['userProfileId']},'raw':!![]})['then'](function(_0x31efc7){if(_0x31efc7&&_0x31efc7[_0x4ada('0x66')]===0x0){return db[_0x4ada('0x3b')]['create']({'name':_0x48f752['name'],'resourceId':_0x48f752['id'],'type':_0x31efc7[_0x4ada('0x3e')],'sectionId':_0x31efc7['id']},{})['then'](function(){return _0x24e6f0;});}else{return _0x24e6f0;}})['catch'](function(_0x2cd4bb){logger['error'](_0x4ada('0x67'),_0x2cd4bb);throw _0x2cd4bb;});}return _0x24e6f0;})[_0x4ada('0x22')](respondWithResult(_0x22e4d0,0xc9))[_0x4ada('0x2d')](handleError(_0x22e4d0,null));};exports['update']=function(_0x381b52,_0x7a9eff){if(_0x381b52['body']['id']){delete _0x381b52[_0x4ada('0x62')]['id'];}return db[_0x4ada('0x59')]['find']({'where':{'id':_0x381b52[_0x4ada('0x5c')]['id']},'include':[{'model':db[_0x4ada('0x41')],'as':'mandatoryDispositionPause'}]})[_0x4ada('0x22')](handleEntityNotFound(_0x7a9eff,null))[_0x4ada('0x22')](saveUpdates(_0x381b52[_0x4ada('0x62')],null))[_0x4ada('0x22')](respondWithResult(_0x7a9eff,null))[_0x4ada('0x2d')](handleError(_0x7a9eff,null));};exports[_0x4ada('0x39')]=function(_0x28b18a,_0x109df3){return db['OpenchannelAccount'][_0x4ada('0x60')]({'where':{'id':_0x28b18a[_0x4ada('0x5c')]['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x109df3,null))[_0x4ada('0x22')](removeEntity(_0x109df3,null))[_0x4ada('0x2d')](handleError(_0x109df3,null));};exports[_0x4ada('0x68')]=function(_0x585a8a,_0x210ae2){return db[_0x4ada('0x59')][_0x4ada('0x68')]()[_0x4ada('0x22')](respondWithResult(_0x210ae2,null))[_0x4ada('0x2d')](handleError(_0x210ae2,null));};exports['addDisposition']=function(_0xed9273,_0x54b7f7,_0x427f36){if(_0xed9273['body']['id']){delete _0xed9273['body']['id'];}return db[_0x4ada('0x59')][_0x4ada('0x60')]({'where':{'id':_0xed9273[_0x4ada('0x5c')]['id']}})['then'](handleEntityNotFound(_0x54b7f7,null))['then'](function(_0x5efe9f){if(_0x5efe9f){_0xed9273[_0x4ada('0x62')]['OpenchannelAccountId']=_0x5efe9f['id'];return db[_0x4ada('0x69')][_0x4ada('0x61')](_0xed9273['body']);}})['then'](respondWithResult(_0x54b7f7,null))[_0x4ada('0x2d')](handleError(_0x54b7f7,null));};exports[_0x4ada('0x6a')]=function(_0x3335f4,_0x78716b,_0x2442b3){var _0x50e575={'raw':![],'where':{}};var _0x373265={};var _0x4adbb8={'count':0x0,'rows':[]};return db[_0x4ada('0x59')][_0x4ada('0x6b')]({'where':{'id':_0x3335f4['params']['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x78716b,null))[_0x4ada('0x22')](function(_0x36a794){if(_0x36a794){_0x373265[_0x4ada('0x46')]=_['keys'](db[_0x4ada('0x69')]['rawAttributes']);_0x373265[_0x4ada('0x47')]=_[_0x4ada('0x5e')](_0x3335f4[_0x4ada('0x47')]);_0x373265[_0x4ada('0x48')]=_[_0x4ada('0x49')](_0x373265[_0x4ada('0x46')],_0x373265[_0x4ada('0x47')]);_0x50e575[_0x4ada('0x4a')]=_['intersection'](_0x373265[_0x4ada('0x46')],qs[_0x4ada('0x4b')](_0x3335f4['query'][_0x4ada('0x4b')]));_0x50e575['attributes']=_0x50e575[_0x4ada('0x4a')][_0x4ada('0x5f')]?_0x50e575[_0x4ada('0x4a')]:_0x373265[_0x4ada('0x46')];if(!_0x3335f4['query'][_0x4ada('0x4c')](_0x4ada('0x4d'))){_0x50e575[_0x4ada('0x4e')]=qs['limit'](_0x3335f4[_0x4ada('0x47')][_0x4ada('0x4e')]);_0x50e575[_0x4ada('0x31')]=qs['offset'](_0x3335f4[_0x4ada('0x47')][_0x4ada('0x31')]);}_0x50e575[_0x4ada('0x4f')]=qs[_0x4ada('0x50')](_0x3335f4[_0x4ada('0x47')][_0x4ada('0x50')]);_0x50e575[_0x4ada('0x51')]=qs[_0x4ada('0x48')](_[_0x4ada('0x52')](_0x3335f4[_0x4ada('0x47')],_0x373265[_0x4ada('0x48')]));_0x50e575['where'][_0x4ada('0x6c')]=_0x36a794['id'];if(_0x3335f4[_0x4ada('0x47')][_0x4ada('0x53')]){_0x50e575[_0x4ada('0x51')]=_[_0x4ada('0x54')](_0x50e575[_0x4ada('0x51')],{'$or':_[_0x4ada('0x42')](_0x50e575[_0x4ada('0x4a')],function(_0x3a3232){var _0x2da02e={};_0x2da02e[_0x3a3232]={'$like':'%'+_0x3335f4[_0x4ada('0x47')]['filter']+'%'};return _0x2da02e;})});}_0x50e575=_['merge']({},_0x50e575,_0x3335f4['options']);return db[_0x4ada('0x69')][_0x4ada('0x33')]({'where':_0x50e575[_0x4ada('0x51')]})[_0x4ada('0x22')](function(_0x44da03){_0x4adbb8['count']=_0x44da03;if(_0x3335f4['query']['includeAll']){_0x50e575[_0x4ada('0x58')]=[{'all':!![]}];}return db[_0x4ada('0x69')][_0x4ada('0x5a')](_0x50e575);})[_0x4ada('0x22')](function(_0x15ce25){_0x4adbb8['rows']=_0x15ce25;return _0x4adbb8;});}})[_0x4ada('0x22')](respondWithFilteredResult(_0x78716b,_0x50e575))[_0x4ada('0x2d')](handleError(_0x78716b,null));};exports['removeDispositions']=function(_0x54f872,_0x4385e5,_0x371cd1){return db['OpenchannelAccount'][_0x4ada('0x60')]({'where':{'id':_0x54f872[_0x4ada('0x5c')]['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x4385e5,null))[_0x4ada('0x22')](function(_0x38214c){if(_0x38214c){return _0x38214c[_0x4ada('0x6d')](_0x54f872['query'][_0x4ada('0x6e')]);}})[_0x4ada('0x22')](respondWithStatusCode(_0x4385e5,null))[_0x4ada('0x2d')](handleError(_0x4385e5,null));};exports['addAnswer']=function(_0x5ab0bb,_0x132c0a,_0x4d7a23){if(_0x5ab0bb[_0x4ada('0x62')]['id']){delete _0x5ab0bb[_0x4ada('0x62')]['id'];}return db['OpenchannelAccount'][_0x4ada('0x60')]({'where':{'id':_0x5ab0bb[_0x4ada('0x5c')]['id']}})['then'](handleEntityNotFound(_0x132c0a,null))[_0x4ada('0x22')](function(_0x19f9cf){if(_0x19f9cf){_0x5ab0bb[_0x4ada('0x62')][_0x4ada('0x6c')]=_0x19f9cf['id'];return db[_0x4ada('0x6f')][_0x4ada('0x61')](_0x5ab0bb['body']);}})[_0x4ada('0x22')](respondWithResult(_0x132c0a,null))[_0x4ada('0x2d')](handleError(_0x132c0a,null));};exports[_0x4ada('0x70')]=function(_0x327d71,_0x175c73,_0x4d1b2b){var _0x4d43f9={'raw':![],'where':{}};var _0x47e522={};var _0x58c4eb={'count':0x0,'rows':[]};return db[_0x4ada('0x59')][_0x4ada('0x6b')]({'where':{'id':_0x327d71['params']['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x175c73,null))[_0x4ada('0x22')](function(_0x2e1f68){if(_0x2e1f68){_0x47e522[_0x4ada('0x46')]=_['keys'](db[_0x4ada('0x6f')][_0x4ada('0x43')]);_0x47e522[_0x4ada('0x47')]=_[_0x4ada('0x5e')](_0x327d71['query']);_0x47e522[_0x4ada('0x48')]=_[_0x4ada('0x49')](_0x47e522['model'],_0x47e522[_0x4ada('0x47')]);_0x4d43f9['attributes']=_[_0x4ada('0x49')](_0x47e522['model'],qs['fields'](_0x327d71['query'][_0x4ada('0x4b')]));_0x4d43f9[_0x4ada('0x4a')]=_0x4d43f9['attributes'][_0x4ada('0x5f')]?_0x4d43f9[_0x4ada('0x4a')]:_0x47e522[_0x4ada('0x46')];if(!_0x327d71[_0x4ada('0x47')][_0x4ada('0x4c')](_0x4ada('0x4d'))){_0x4d43f9[_0x4ada('0x4e')]=qs[_0x4ada('0x4e')](_0x327d71['query']['limit']);_0x4d43f9['offset']=qs['offset'](_0x327d71[_0x4ada('0x47')][_0x4ada('0x31')]);}_0x4d43f9[_0x4ada('0x4f')]=qs[_0x4ada('0x50')](_0x327d71[_0x4ada('0x47')][_0x4ada('0x50')]);_0x4d43f9['where']=qs[_0x4ada('0x48')](_[_0x4ada('0x52')](_0x327d71['query'],_0x47e522[_0x4ada('0x48')]));_0x4d43f9[_0x4ada('0x51')][_0x4ada('0x6c')]=_0x2e1f68['id'];if(_0x327d71[_0x4ada('0x47')]['filter']){_0x4d43f9[_0x4ada('0x51')]=_[_0x4ada('0x54')](_0x4d43f9[_0x4ada('0x51')],{'$or':_['map'](_0x4d43f9['attributes'],function(_0x2ac9bc){var _0x107708={};_0x107708[_0x2ac9bc]={'$like':'%'+_0x327d71['query'][_0x4ada('0x53')]+'%'};return _0x107708;})});}_0x4d43f9=_[_0x4ada('0x54')]({},_0x4d43f9,_0x327d71[_0x4ada('0x56')]);return db[_0x4ada('0x6f')]['count']({'where':_0x4d43f9[_0x4ada('0x51')]})[_0x4ada('0x22')](function(_0x2112ed){_0x58c4eb['count']=_0x2112ed;if(_0x327d71['query']['includeAll']){_0x4d43f9[_0x4ada('0x58')]=[{'all':!![]}];}return db[_0x4ada('0x6f')][_0x4ada('0x5a')](_0x4d43f9);})[_0x4ada('0x22')](function(_0x36bc9e){_0x58c4eb[_0x4ada('0x5b')]=_0x36bc9e;return _0x58c4eb;});}})[_0x4ada('0x22')](respondWithFilteredResult(_0x175c73,_0x4d43f9))[_0x4ada('0x2d')](handleError(_0x175c73,null));};exports[_0x4ada('0x71')]=function(_0x55040d,_0x177ed2,_0x74f71d){return db['OpenchannelAccount'][_0x4ada('0x60')]({'where':{'id':_0x55040d[_0x4ada('0x5c')]['id']}})['then'](handleEntityNotFound(_0x177ed2,null))[_0x4ada('0x22')](function(_0x52ea4d){if(_0x52ea4d){return _0x52ea4d[_0x4ada('0x71')](_0x55040d[_0x4ada('0x47')][_0x4ada('0x6e')]);}})[_0x4ada('0x22')](respondWithStatusCode(_0x177ed2,null))[_0x4ada('0x2d')](handleError(_0x177ed2,null));};exports[_0x4ada('0x72')]=function(_0x20764f,_0x1239f6,_0x4506e0){var _0x46768c={'body':_0x20764f[_0x4ada('0x62')],'channel':_0x4ada('0x73')};var _0x39c2fe=[];var _0x18ca87=[];var _0x5a336b={};var _0xd5e437=![];return db[_0x4ada('0x74')][_0x4ada('0x68')]()[_0x4ada('0x22')](function(_0x2f1192){if(!_0x2f1192){throw new db[(_0x4ada('0x75'))][(_0x4ada('0x76'))]('no\x20available\x20attributes');}_0x39c2fe=_['difference'](_['keys'](_0x2f1192),[_0x4ada('0x77'),_0x4ada('0x78')]);_0x18ca87=_[_0x4ada('0x79')](_[_0x4ada('0x5e')](_0x2f1192),[_0x4ada('0x77'),_0x4ada('0x78'),_0x4ada('0x7a'),_0x4ada('0x7b')]);if(_0x20764f[_0x4ada('0x62')]['id']){delete _0x20764f[_0x4ada('0x62')]['id'];}if(_[_0x4ada('0x7c')](_0x20764f[_0x4ada('0x62')][_0x4ada('0x7d')])){throw new db['Sequelize'][(_0x4ada('0x76'))](_0x4ada('0x7e'));}if(_[_0x4ada('0x7c')](_0x20764f['body']['body'])||_0x20764f['body'][_0x4ada('0x62')]===''){throw new db[(_0x4ada('0x75'))]['ValidationError'](_0x4ada('0x7f'));}if(_[_0x4ada('0x7c')](_0x20764f['body'][_0x4ada('0x80')])){throw new db[(_0x4ada('0x75'))][(_0x4ada('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18ca87);}if(!_[_0x4ada('0x81')](_0x18ca87,_0x20764f[_0x4ada('0x62')][_0x4ada('0x80')])){throw new db[(_0x4ada('0x75'))][(_0x4ada('0x76'))](_0x4ada('0x82')+_0x18ca87);}_0x5a336b[_0x20764f[_0x4ada('0x62')][_0x4ada('0x80')]]=_0x20764f[_0x4ada('0x62')][_0x4ada('0x7d')];})['then'](function(){return db[_0x4ada('0x59')][_0x4ada('0x60')]({'where':{'id':_0x20764f[_0x4ada('0x5c')]['id']},'include':[{'model':db[_0x4ada('0x83')],'as':_0x4ada('0x84'),'include':[{'model':db[_0x4ada('0x74')],'as':_0x4ada('0x85'),'where':_0x5a336b,'limit':0x1,'order':[['updatedAt',_0x4ada('0x86')]]}]},{'model':db[_0x4ada('0x87')],'as':_0x4ada('0x88')}]});})[_0x4ada('0x22')](handleEntityNotFound(_0x1239f6,null))[_0x4ada('0x22')](function(_0x362e7d){if(_0x362e7d&&_0x362e7d[_0x4ada('0x84')]){_0x46768c['account']=_0x362e7d;_0x46768c[_0x4ada('0x89')]=_0x362e7d['Applications'];_0x46768c[_0x4ada('0x8a')]=_0x362e7d['List'];_0x46768c[_0x4ada('0x89')]=_[_0x4ada('0x8b')](_0x46768c[_0x4ada('0x89')],['priority'],[_0x4ada('0x8c')]);if(_0x46768c[_0x4ada('0x8d')][_0x4ada('0x88')]){delete _0x46768c['account'][_0x4ada('0x88')];}if(_0x46768c[_0x4ada('0x8d')]['List']&&_0x46768c[_0x4ada('0x8d')][_0x4ada('0x84')][_0x4ada('0x85')][_0x4ada('0x5f')]){return _0x46768c[_0x4ada('0x8d')]['List'][_0x4ada('0x85')][0x0];}var _0x6f61b9=_['defaults'](_0x20764f[_0x4ada('0x62')],{'firstName':_0x20764f['body'][_0x4ada('0x7d')],'ListId':_0x362e7d[_0x4ada('0x7b')]});_0x6f61b9[_0x20764f[_0x4ada('0x62')][_0x4ada('0x80')]]=_0x20764f[_0x4ada('0x62')][_0x4ada('0x7d')];return db['CmContact'][_0x4ada('0x61')](_0x6f61b9,{'fields':_0x39c2fe,'raw':!![]});}})[_0x4ada('0x22')](handleEntityNotFound(_0x1239f6,null))[_0x4ada('0x22')](function(_0x4ae44b){_0x46768c[_0x4ada('0x8e')]=_0x4ae44b;if(_0x4ae44b){var _0x46a781={'ContactId':_0x4ae44b['id'],'OpenchannelAccountId':_0x20764f[_0x4ada('0x5c')]['id'],'from':(_0x4ae44b[_0x4ada('0x8f')]||'')+'\x20'+(_0x4ae44b[_0x4ada('0x90')]||'')};var _0x3728bb={'OpenchannelAccountId':_0x20764f[_0x4ada('0x5c')]['id'],'closed':![]};if(_0x20764f[_0x4ada('0x62')][_0x4ada('0x91')]){_0x3728bb['threadId']=_0x20764f['body'][_0x4ada('0x91')];return db[_0x4ada('0x92')]['find']({'where':_0x3728bb})['then'](function(_0x20b458){if(_0x20b458){return[_0x20b458,![]];}_0x46a781['threadId']=_0x20764f[_0x4ada('0x62')]['threadId'];_0x46a781[_0x4ada('0x93')]=_0x20764f[_0x4ada('0x62')][_0x4ada('0x93')];return db['OpenchannelInteraction'][_0x4ada('0x61')](_0x46a781)['then'](function(_0x492904){return[_0x492904,!![]];});});}else{_0x3728bb['threadId']=null;}_0x3728bb[_0x4ada('0x94')]=_0x4ae44b['id'];return db[_0x4ada('0x92')][_0x4ada('0x60')]({'where':_0x3728bb})[_0x4ada('0x22')](function(_0x36eb23){if(_0x36eb23){return[_0x36eb23,![]];}return db[_0x4ada('0x92')][_0x4ada('0x61')](_0x46a781)[_0x4ada('0x22')](function(_0x34695c){return[_0x34695c,!![]];});});}})[_0x4ada('0x95')](function(_0x3d1e1b,_0x2af5fe){if(_0x3d1e1b){_0xd5e437=_0x2af5fe;if(!_0x2af5fe){var _0x2fe371={'from':(_0x46768c['contact'][_0x4ada('0x8f')]||'')+'\x20'+(_0x46768c[_0x4ada('0x8e')]['lastName']||'')};if(_0x20764f['body']['threadId']&&_0x20764f['body'][_0x4ada('0x96')]&&_0x20764f[_0x4ada('0x62')]['threadId']!=_0x20764f['body']['messageId']){_0x2fe371['threadId']=_0x20764f[_0x4ada('0x62')][_0x4ada('0x96')];}return _0x3d1e1b[_0x4ada('0x38')](_0x2fe371);}else{return _0x3d1e1b;}}})[_0x4ada('0x22')](function(_0x2b9d06){_0x46768c['interaction']=_0x2b9d06['get']({'plain':!![]});_0x46768c['interaction']['created']=_0xd5e437;if(_0x46768c[_0x4ada('0x97')][_0x4ada('0x98')]){if(_0x46768c[_0x4ada('0x8d')][_0x4ada('0x99')]){_0x46768c[_0x4ada('0x89')][_0x4ada('0x9a')]({'id':0x0,'priority':_0x46768c[_0x4ada('0x89')][_0x4ada('0x5f')]+0x1,'app':'close','appdata':_0x4ada('0x9b'),'interval':_0x4ada('0x9c')});}}return db[_0x4ada('0x9d')]['create']({'body':_0x20764f['body'][_0x4ada('0x62')],'OpenchannelAccountId':_0x20764f[_0x4ada('0x5c')]['id'],'OpenchannelInteractionId':_0x2b9d06['id'],'direction':'in','ContactId':_0x46768c[_0x4ada('0x8e')]['id'],'AttachmentId':_0x20764f[_0x4ada('0x62')]['AttachmentId']});})[_0x4ada('0x22')](function(_0x432dde){_0x46768c[_0x4ada('0x2b')]=_0x432dde;if(!_0x46768c[_0x4ada('0x97')]['UserId'])return;return db[_0x4ada('0x9e')][_0x4ada('0x60')]({'attributes':['id',_0x4ada('0x3e')],'where':{'id':_0x46768c[_0x4ada('0x97')]['UserId']}});})[_0x4ada('0x22')](function(_0x4950f6){if(_0x4950f6){_0x46768c[_0x4ada('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4ada('0x9f'),'appdata':_0x4950f6['name']+','+(_0x46768c[_0x4ada('0x8d')][_0x4ada('0xa0')]||0xa),'interval':_0x4ada('0x9c')});}if(!_0x46768c['interaction'][_0x4ada('0xa1')])return;return db['OpenchannelQueue']['find']({'attributes':['id','name'],'where':{'id':_0x46768c[_0x4ada('0x97')][_0x4ada('0xa1')]}});})['then'](function(_0x4a7c1c){if(_0x4a7c1c){_0x46768c[_0x4ada('0x89')][_0x4ada('0xa2')]({'id':0x0,'priority':0x1,'app':_0x4ada('0xa3'),'appdata':_0x4a7c1c['name']+','+(_0x46768c[_0x4ada('0x8d')][_0x4ada('0xa4')]||0x12c),'interval':_0x4ada('0x9c')});}return respondWithRpcPromise(_0x4ada('0xa5'),'startRouting',_0x46768c);})[_0x4ada('0x22')](function(_0x3f17de){respondWithRpcPromise('EventManager',_0x4ada('0xa6'),{'event':_0x4ada('0x72'),'message':_0x3f17de},client9002);return _0x3f17de;})[_0x4ada('0x22')](respondWithResult(_0x1239f6,null))[_0x4ada('0x2d')](handleError(_0x1239f6,null));};exports[_0x4ada('0xa7')]=function(_0x4a3def,_0x3bb607){var _0x1816fc=_0x4a3def[_0x4ada('0x5c')]['id'];var _0xa32cb7=_0x4a3def[_0x4ada('0x62')];var _0x45bd58=0xc8;var _0x2f0a81=null;return db[_0x4ada('0xa8')][_0x4ada('0xa9')]({'isolationLevel':db[_0x4ada('0xa8')][_0x4ada('0xaa')][_0x4ada('0xab')][_0x4ada('0xac')]},function(_0x91c67){return db[_0x4ada('0x59')][_0x4ada('0x6b')]({'where':{'id':_0x1816fc},'transaction':_0x91c67})[_0x4ada('0x22')](function(_0x3e47bd){if(_0x3e47bd){return db['OpenchannelApplication'][_0x4ada('0x39')]({'where':{'OpenchannelAccountId':_0x1816fc},'transaction':_0x91c67})[_0x4ada('0x22')](function(){var _0xcff17d=_[_0x4ada('0x42')](_0xa32cb7,function(_0x1195a3){_0x1195a3[_0x4ada('0x6c')]=_0x1816fc;return _0x1195a3;});return db['OpenchannelApplication'][_0x4ada('0xad')](_0xcff17d,{'transaction':_0x91c67});});}else{_0x45bd58=0x194;_0x2f0a81=[];}});})[_0x4ada('0x22')](function(){if(_0x45bd58!==0x194){return db[_0x4ada('0x87')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1816fc},'order':_0x4ada('0xae')})[_0x4ada('0x22')](function(_0x17c047){_0x2f0a81=_0x17c047;});}})[_0x4ada('0x2d')](function(_0x43774a){_0x45bd58=0x1f4;logger[_0x4ada('0x28')](_0x43774a['stack']);if(_0x43774a[_0x4ada('0x3e')]){delete _0x43774a[_0x4ada('0x3e')];}_0x2f0a81=_0x43774a;})[_0x4ada('0xaf')](function(){if(_0x2f0a81===null){_0x3bb607[_0x4ada('0x2e')](_0x45bd58);}else{if(_0x45bd58===0x1f4){_0x3bb607[_0x4ada('0x2f')](_0x45bd58)[_0x4ada('0x3f')](_0x2f0a81);}else{_0x3bb607[_0x4ada('0x2f')](_0x45bd58)[_0x4ada('0x30')](_0x2f0a81);}}});};exports['getApplications']=function(_0x4cfcb0,_0x4df25a,_0x339212){var _0x150da0={};var _0x275465={};var _0x33db7c;var _0x961e5f;return db[_0x4ada('0x59')][_0x4ada('0x6b')]({'where':{'id':_0x4cfcb0[_0x4ada('0x5c')]['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x4df25a,null))[_0x4ada('0x22')](function(_0x40f254){if(_0x40f254){_0x33db7c=_0x40f254;_0x275465[_0x4ada('0x46')]=_['keys'](db[_0x4ada('0x87')][_0x4ada('0x43')]);_0x275465['query']=_['keys'](_0x4cfcb0[_0x4ada('0x47')]);_0x275465[_0x4ada('0x48')]=_[_0x4ada('0x49')](_0x275465[_0x4ada('0x46')],_0x275465[_0x4ada('0x47')]);_0x150da0[_0x4ada('0x4a')]=_['intersection'](_0x275465['model'],qs[_0x4ada('0x4b')](_0x4cfcb0['query'][_0x4ada('0x4b')]));_0x150da0['attributes']=_0x150da0[_0x4ada('0x4a')]['length']?_0x150da0[_0x4ada('0x4a')]:_0x275465[_0x4ada('0x46')];_0x150da0[_0x4ada('0x4f')]=qs[_0x4ada('0x50')](_0x4cfcb0[_0x4ada('0x47')][_0x4ada('0x50')]);_0x150da0[_0x4ada('0x51')]=qs[_0x4ada('0x48')](_[_0x4ada('0x52')](_0x4cfcb0[_0x4ada('0x47')],_0x275465['filters']));if(_0x4cfcb0[_0x4ada('0x47')]['filter']){_0x150da0[_0x4ada('0x51')]=_['merge'](_0x150da0[_0x4ada('0x51')],{'$or':_[_0x4ada('0x42')](_0x150da0['attributes'],function(_0x4a5334){var _0x265e7e={};_0x265e7e[_0x4a5334]={'$like':'%'+_0x4cfcb0[_0x4ada('0x47')][_0x4ada('0x53')]+'%'};return _0x265e7e;})});}_0x150da0=_['merge']({},_0x150da0,_0x4cfcb0['options']);return _0x33db7c[_0x4ada('0xb0')](_0x150da0);}})[_0x4ada('0x22')](function(_0x4c25c2){if(_0x4c25c2){_0x961e5f=_0x4c25c2[_0x4ada('0x5f')];if(!_0x4cfcb0[_0x4ada('0x47')][_0x4ada('0x4c')](_0x4ada('0x4d'))){_0x150da0['limit']=qs[_0x4ada('0x4e')](_0x4cfcb0[_0x4ada('0x47')][_0x4ada('0x4e')]);_0x150da0[_0x4ada('0x31')]=qs[_0x4ada('0x31')](_0x4cfcb0['query'][_0x4ada('0x31')]);}return _0x33db7c[_0x4ada('0xb0')](_0x150da0);}})[_0x4ada('0x22')](function(_0x5e3c8c){if(_0x5e3c8c){return _0x5e3c8c?{'count':_0x961e5f,'rows':_0x5e3c8c}:null;}})[_0x4ada('0x22')](respondWithResult(_0x4df25a,null))['catch'](handleError(_0x4df25a,null));};exports[_0x4ada('0xb1')]=function(_0x4bbed8,_0x421fb9,_0x55b08b){var _0x1e27df={'raw':![],'where':{}};var _0x1ce581={};var _0x605e2d={'count':0x0,'rows':[]};return db[_0x4ada('0x59')][_0x4ada('0x6b')]({'where':{'id':_0x4bbed8[_0x4ada('0x5c')]['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x421fb9,null))[_0x4ada('0x22')](function(_0x204b82){if(_0x204b82){_0x1ce581[_0x4ada('0x46')]=_['keys'](db[_0x4ada('0x92')][_0x4ada('0x43')]);_0x1ce581[_0x4ada('0x47')]=_['keys'](_0x4bbed8[_0x4ada('0x47')]);_0x1ce581[_0x4ada('0x48')]=_['intersection'](_0x1ce581[_0x4ada('0x46')],_0x1ce581[_0x4ada('0x47')]);_0x1e27df['attributes']=_['intersection'](_0x1ce581[_0x4ada('0x46')],qs['fields'](_0x4bbed8[_0x4ada('0x47')][_0x4ada('0x4b')]));_0x1e27df['attributes']=_0x1e27df[_0x4ada('0x4a')][_0x4ada('0x5f')]?_0x1e27df[_0x4ada('0x4a')]:_0x1ce581[_0x4ada('0x46')];if(!_0x4bbed8[_0x4ada('0x47')][_0x4ada('0x4c')]('nolimit')){_0x1e27df[_0x4ada('0x4e')]=qs[_0x4ada('0x4e')](_0x4bbed8['query'][_0x4ada('0x4e')]);_0x1e27df[_0x4ada('0x31')]=qs['offset'](_0x4bbed8[_0x4ada('0x47')]['offset']);}_0x1e27df[_0x4ada('0x4f')]=qs[_0x4ada('0x50')](_0x4bbed8[_0x4ada('0x47')][_0x4ada('0x50')]);_0x1e27df[_0x4ada('0x51')]=qs[_0x4ada('0x48')](_['pick'](_0x4bbed8[_0x4ada('0x47')],_0x1ce581[_0x4ada('0x48')]));_0x1e27df[_0x4ada('0x51')]['OpenchannelAccountId']=_0x204b82['id'];if(_0x4bbed8['query'][_0x4ada('0x53')]){_0x1e27df[_0x4ada('0x51')]=_[_0x4ada('0x54')](_0x1e27df['where'],{'$or':_['map'](_0x1e27df[_0x4ada('0x4a')],function(_0x6cc71d){var _0x2d6253={};_0x2d6253[_0x6cc71d]={'$like':'%'+_0x4bbed8[_0x4ada('0x47')][_0x4ada('0x53')]+'%'};return _0x2d6253;})});}_0x1e27df=_[_0x4ada('0x54')]({},_0x1e27df,_0x4bbed8['options']);return db['OpenchannelInteraction'][_0x4ada('0x33')]({'where':_0x1e27df[_0x4ada('0x51')]})[_0x4ada('0x22')](function(_0xadb600){_0x605e2d[_0x4ada('0x33')]=_0xadb600;if(_0x4bbed8[_0x4ada('0x47')][_0x4ada('0x57')]){_0x1e27df[_0x4ada('0x58')]=[{'model':db['CmContact'],'as':_0x4ada('0xb2'),'required':![]},{'model':db[_0x4ada('0x9e')],'as':_0x4ada('0xb3'),'attributes':[_0x4ada('0x3e'),'fullname',_0x4ada('0xb4')],'required':![]},{'model':db[_0x4ada('0xb5')],'as':_0x4ada('0xb6'),'attributes':['id','name','color'],'where':_0x4bbed8[_0x4ada('0x47')]['tag']?{'id':_0x4bbed8[_0x4ada('0x47')][_0x4ada('0xb7')]}:undefined,'required':_0x4bbed8[_0x4ada('0x47')][_0x4ada('0xb7')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x4ada('0x5a')](_0x1e27df);})[_0x4ada('0x22')](function(_0x4118b6){_0x605e2d[_0x4ada('0x5b')]=_0x4118b6;return _0x605e2d;});}})[_0x4ada('0x22')](respondWithFilteredResult(_0x421fb9,_0x1e27df))[_0x4ada('0x2d')](handleError(_0x421fb9,null));};exports[_0x4ada('0xb8')]=function(_0x556964,_0x436df9,_0x179811){return db['OpenchannelAccount']['find']({'where':{'id':_0x556964[_0x4ada('0x5c')]['id']}})['then'](handleEntityNotFound(_0x436df9,null))[_0x4ada('0x22')](function(_0x5327ac){if(_0x5327ac){return _0x5327ac[_0x4ada('0xb8')](_0x556964[_0x4ada('0x62')][_0x4ada('0x6e')],_[_0x4ada('0xb9')](_0x556964[_0x4ada('0x62')],[_0x4ada('0x6e'),'id'])||{})[_0x4ada('0x95')](function(_0x162aed){for(var _0x6a8342=0x0;_0x6a8342<_0x556964[_0x4ada('0x62')]['ids']['length'];_0x6a8342+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x556964['body'][_0x4ada('0x6e')][_0x6a8342]),'OpenchannelAccountId':Number(_0x556964[_0x4ada('0x5c')]['id'])});}return _0x162aed;});}})[_0x4ada('0x22')](respondWithResult(_0x436df9,null))[_0x4ada('0x2d')](handleError(_0x436df9,null));};exports[_0x4ada('0xba')]=function(_0x1ed298,_0x15dd13,_0x498d83){return db[_0x4ada('0x59')][_0x4ada('0x60')]({'where':{'id':_0x1ed298['params']['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x15dd13,null))[_0x4ada('0x22')](function(_0x3fe185){if(_0x3fe185){return _0x3fe185[_0x4ada('0xba')](_0x1ed298[_0x4ada('0x47')][_0x4ada('0x6e')])[_0x4ada('0x22')](function(){if(_[_0x4ada('0xbb')](_0x1ed298[_0x4ada('0x47')][_0x4ada('0x6e')])){for(var _0x4ffbd2=0x0;_0x4ffbd2<_0x1ed298[_0x4ada('0x47')][_0x4ada('0x6e')][_0x4ada('0x5f')];_0x4ffbd2+=0x1){socket[_0x4ada('0xbc')](_0x4ada('0xbd'),{'UserId':Number(_0x1ed298['query'][_0x4ada('0x6e')][_0x4ffbd2]),'OpenchannelAccountId':Number(_0x1ed298[_0x4ada('0x5c')]['id'])});}}else{socket[_0x4ada('0xbc')](_0x4ada('0xbd'),{'UserId':Number(_0x1ed298['query'][_0x4ada('0x6e')]),'OpenchannelAccountId':Number(_0x1ed298[_0x4ada('0x5c')]['id'])});}});}})[_0x4ada('0x22')](respondWithStatusCode(_0x15dd13,null))['catch'](handleError(_0x15dd13,null));};exports[_0x4ada('0xbe')]=function(_0x43b980,_0x23df83,_0x3b8e82){var _0x5bca23={};var _0x336448={};var _0x505417;var _0x5b1a25;return db[_0x4ada('0x59')][_0x4ada('0x6b')]({'where':{'id':_0x43b980[_0x4ada('0x5c')]['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x23df83,null))[_0x4ada('0x22')](function(_0x1565c5){if(_0x1565c5){_0x505417=_0x1565c5;_0x336448[_0x4ada('0x46')]=_[_0x4ada('0x5e')](db['User'][_0x4ada('0x43')]);_0x336448[_0x4ada('0x47')]=_[_0x4ada('0x5e')](_0x43b980['query']);_0x336448['filters']=_[_0x4ada('0x49')](_0x336448['model'],_0x336448[_0x4ada('0x47')]);_0x5bca23[_0x4ada('0x4a')]=_[_0x4ada('0x49')](_0x336448[_0x4ada('0x46')],qs[_0x4ada('0x4b')](_0x43b980['query'][_0x4ada('0x4b')]));_0x5bca23[_0x4ada('0x4a')]=_0x5bca23[_0x4ada('0x4a')][_0x4ada('0x5f')]?_0x5bca23[_0x4ada('0x4a')]:_0x336448[_0x4ada('0x46')];_0x5bca23[_0x4ada('0x4f')]=qs[_0x4ada('0x50')](_0x43b980[_0x4ada('0x47')]['sort']);_0x5bca23[_0x4ada('0x51')]=qs[_0x4ada('0x48')](_[_0x4ada('0x52')](_0x43b980[_0x4ada('0x47')],_0x336448[_0x4ada('0x48')]));if(_0x43b980[_0x4ada('0x47')][_0x4ada('0x53')]){_0x5bca23['where']=_[_0x4ada('0x54')](_0x5bca23[_0x4ada('0x51')],{'$or':_['map'](_0x5bca23[_0x4ada('0x4a')],function(_0x4a1bf3){var _0x445a2d={};_0x445a2d[_0x4a1bf3]={'$like':'%'+_0x43b980[_0x4ada('0x47')][_0x4ada('0x53')]+'%'};return _0x445a2d;})});}_0x5bca23=_[_0x4ada('0x54')]({},_0x5bca23,_0x43b980['options']);return _0x505417[_0x4ada('0xbe')](_0x5bca23);}})[_0x4ada('0x22')](function(_0x377234){if(_0x377234){_0x5b1a25=_0x377234[_0x4ada('0x5f')];if(!_0x43b980['query'][_0x4ada('0x4c')](_0x4ada('0x4d'))){_0x5bca23[_0x4ada('0x4e')]=qs[_0x4ada('0x4e')](_0x43b980[_0x4ada('0x47')]['limit']);_0x5bca23[_0x4ada('0x31')]=qs[_0x4ada('0x31')](_0x43b980['query']['offset']);}return _0x505417[_0x4ada('0xbe')](_0x5bca23);}})[_0x4ada('0x22')](function(_0x284036){if(_0x284036){return _0x284036?{'count':_0x5b1a25,'rows':_0x284036}:null;}})['then'](respondWithResult(_0x23df83,null))[_0x4ada('0x2d')](handleError(_0x23df83,null));};exports['send']=function(_0x2c8df1,_0x176f10,_0x5ba696){var _0x38147d,_0x8f7db4,_0x570ea1;if(_[_0x4ada('0x7c')](_0x2c8df1[_0x4ada('0x62')][_0x4ada('0x62')])||_0x2c8df1[_0x4ada('0x62')][_0x4ada('0x62')]===''){throw new db[(_0x4ada('0x75'))]['ValidationError'](_0x4ada('0x7f'));}if(_[_0x4ada('0x7c')](_0x2c8df1[_0x4ada('0x62')]['to'])){}_0x38147d=_0x2c8df1[_0x4ada('0x62')]['to'];return db['OpenchannelAccount'][_0x4ada('0x6b')]({'where':{'id':_0x2c8df1[_0x4ada('0x5c')]['id']}})[_0x4ada('0x22')](handleEntityNotFound(_0x176f10,null))['then'](function(_0x3f92bd){if(_0x3f92bd){return db[_0x4ada('0x59')]['find']({'where':{'id':_0x3f92bd['id']},'include':[{'model':db[_0x4ada('0x83')],'as':'List','include':[{'model':db[_0x4ada('0x74')],'as':_0x4ada('0x85'),'where':{[_0x3f92bd[_0x4ada('0x80')]]:_0x38147d},'limit':0x1,'order':[[_0x4ada('0x78'),'DESC']]}]}]})[_0x4ada('0x22')](handleEntityNotFound(_0x176f10,null))[_0x4ada('0x22')](function(_0x21fb70){if(_0x21fb70&&_0x21fb70[_0x4ada('0x84')]){_0x8f7db4=_0x21fb70['get']({'plain':!![]});if(_0x8f7db4[_0x4ada('0x84')]&&_0x8f7db4[_0x4ada('0x84')][_0x4ada('0x85')][_0x4ada('0x5f')]){return _0x8f7db4[_0x4ada('0x84')][_0x4ada('0x85')][0x0];}return db[_0x4ada('0x74')][_0x4ada('0x61')](_['defaults'](_0x2c8df1[_0x4ada('0x62')],{'firstName':_0x38147d,[_0x21fb70[_0x4ada('0x80')]]:_0x38147d,'phone':_0x38147d,'ListId':_0x8f7db4[_0x4ada('0x7b')]}));}})[_0x4ada('0x22')](handleEntityNotFound(_0x176f10,null))[_0x4ada('0x22')](function(_0x1a2022){if(_0x1a2022){_0x570ea1=_0x1a2022;return db[_0x4ada('0x92')]['find']({'where':{'ContactId':_0x570ea1['id'],'closed':![],'OpenchannelAccountId':_0x8f7db4['id']}})[_0x4ada('0x22')](function(_0x11a4af){if(_0x11a4af){return[_0x11a4af,![]];}return db[_0x4ada('0x92')][_0x4ada('0x61')]({'UserId':_0x2c8df1[_0x4ada('0x63')]['id'],'ContactId':_0x570ea1['id'],'OpenchannelAccountId':_0x8f7db4['id'],'lastMsgDirection':_0x4ada('0xbf'),'firstMsgDirection':_0x4ada('0xbf'),'Messages':[_['merge'](_0x2c8df1['body'],{'read':![],'body':_0x2c8df1[_0x4ada('0x62')][_0x4ada('0x62')],'OpenchannelAccountId':_0x8f7db4['id'],'UserId':_0x2c8df1[_0x4ada('0x63')]['id'],'ContactId':_0x570ea1['id']})]},{'include':[{'model':db[_0x4ada('0x9d')],'as':_0x4ada('0xc0')}]})[_0x4ada('0x22')](function(_0x565c7a){return[_0x565c7a,!![]];});});}})['spread'](function(_0x46858b,_0x3837ba){if(_0x3837ba){return _0x46858b;}return db[_0x4ada('0x9d')][_0x4ada('0x61')](_[_0x4ada('0x54')](_0x2c8df1[_0x4ada('0x62')],{'read':![],'body':_0x2c8df1[_0x4ada('0x62')][_0x4ada('0x62')],'OpenchannelAccountId':_0x8f7db4['id'],'OpenchannelInteractionId':_0x46858b['id'],'UserId':_0x2c8df1[_0x4ada('0x63')]['id'],'ContactId':_0x570ea1['id']}))[_0x4ada('0x22')](function(_0x13b184){_0x46858b[_0x4ada('0xc1')][_0x4ada('0xc0')]=[];_0x46858b[_0x4ada('0xc1')][_0x4ada('0xc0')][_0x4ada('0x9a')](_0x13b184[_0x4ada('0xc1')]);return _0x46858b;});});}})[_0x4ada('0x22')](respondWithResult(_0x176f10,null))[_0x4ada('0x2d')](handleError(_0x176f10,null));}; \ No newline at end of file +var _0x8c97=['bulkCreate','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','save','update','destroy','stack','name','send','index','Pause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','merge','filter','options','includeAll','include','findAll','show','find','create','body','user','get','OpenchannelAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','mandatoryDispositionPause','describe','OpenchannelAccountId','Disposition','findOne','nolimit','order','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','CmContact','Contacts','Applications','applications','list','orderBy','priority','asc','account','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','interaction','unshift','waitForTheAssignedAgent','queueId','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8c97,0x194));var _0x78c9=function(_0x2d6a06,_0x1cfb60){_0x2d6a06=_0x2d6a06-0x0;var _0x25edd2=_0x8c97[_0x2d6a06];return _0x25edd2;};'use strict';var emlformat=require(_0x78c9('0x0'));var rimraf=require(_0x78c9('0x1'));var zipdir=require(_0x78c9('0x2'));var jsonpatch=require(_0x78c9('0x3'));var rp=require('request-promise');var moment=require(_0x78c9('0x4'));var BPromise=require(_0x78c9('0x5'));var Mustache=require('mustache');var util=require(_0x78c9('0x6'));var path=require(_0x78c9('0x7'));var sox=require(_0x78c9('0x8'));var csv=require(_0x78c9('0x9'));var ejs=require(_0x78c9('0xa'));var fs=require('fs');var fs_extra=require(_0x78c9('0xb'));var _=require(_0x78c9('0xc'));var squel=require(_0x78c9('0xd'));var crypto=require(_0x78c9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x78c9('0xf'));var toCsv=require(_0x78c9('0x9'));var querystring=require(_0x78c9('0x10'));var Papa=require('papaparse');var Redis=require(_0x78c9('0x11'));var authService=require(_0x78c9('0x12'));var qs=require(_0x78c9('0x13'));var as=require(_0x78c9('0x14'));var hardwareService=require(_0x78c9('0x15'));var logger=require(_0x78c9('0x16'))(_0x78c9('0x17'));var utils=require('../../config/utils');var config=require(_0x78c9('0x18'));var licenseUtil=require(_0x78c9('0x19'));var db=require(_0x78c9('0x1a'))['db'];config['redis']=_[_0x78c9('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x78c9('0x1c'))(new Redis(config[_0x78c9('0x1d')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x78c9('0x1e'));var client=jayson[_0x78c9('0x1f')][_0x78c9('0x20')]({'port':0x232c});var client9002=jayson[_0x78c9('0x1f')][_0x78c9('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2d440d,_0x5b6476,_0x26337c,_0x340a36){return new BPromise(function(_0x1ec89e,_0x452e26){var _0x41ad55=_0x340a36||client;return _0x41ad55[_0x78c9('0x21')](_0x2d440d,_0x26337c)[_0x78c9('0x22')](function(_0x5ccf0b){logger['info'](_0x78c9('0x23'),_0x5b6476,_0x78c9('0x24'));logger[_0x78c9('0x25')](_0x78c9('0x26'),_0x5b6476,_0x78c9('0x24'),JSON['stringify'](_0x5ccf0b));if(_0x5ccf0b['error']){if(_0x5ccf0b[_0x78c9('0x27')][_0x78c9('0x28')]===0x1f4){logger[_0x78c9('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x5b6476,_0x5ccf0b[_0x78c9('0x27')][_0x78c9('0x29')]);return _0x452e26(_0x5ccf0b[_0x78c9('0x27')][_0x78c9('0x29')]);}logger['error'](_0x78c9('0x23'),_0x5b6476,_0x5ccf0b[_0x78c9('0x27')][_0x78c9('0x29')]);return _0x1ec89e(_0x5ccf0b['error'][_0x78c9('0x29')]);}else{logger[_0x78c9('0x2a')](_0x78c9('0x23'),_0x5b6476,'request\x20sent');_0x1ec89e(_0x5ccf0b[_0x78c9('0x2b')]['message']);}})[_0x78c9('0x2c')](function(_0x4ffae8){logger[_0x78c9('0x27')](_0x78c9('0x23'),_0x5b6476,_0x4ffae8);_0x452e26(_0x4ffae8);});});}function respondWithStatusCode(_0x57b2d5,_0x58036f){_0x58036f=_0x58036f||0xcc;return function(_0x31b38b){if(_0x31b38b){return _0x57b2d5[_0x78c9('0x2d')](_0x58036f);}return _0x57b2d5[_0x78c9('0x2e')](_0x58036f)[_0x78c9('0x2f')]();};}function respondWithResult(_0x15043c,_0x344785){_0x344785=_0x344785||0xc8;return function(_0x4d3cf6){if(_0x4d3cf6){return _0x15043c[_0x78c9('0x2e')](_0x344785)[_0x78c9('0x30')](_0x4d3cf6);}};}function respondWithFilteredResult(_0x949c5d,_0x125a3b){return function(_0x1298db){if(_0x1298db){var _0x500b0c=typeof _0x125a3b[_0x78c9('0x31')]===_0x78c9('0x32')&&typeof _0x125a3b['limit']==='undefined';var _0x82fd8f=_0x1298db['count'];var _0x3ab44c=_0x500b0c?0x0:_0x125a3b[_0x78c9('0x31')];var _0x41256c=_0x500b0c?_0x1298db[_0x78c9('0x33')]:_0x125a3b[_0x78c9('0x31')]+_0x125a3b[_0x78c9('0x34')];var _0x2f72d8;if(_0x41256c>=_0x82fd8f){_0x41256c=_0x82fd8f;_0x2f72d8=0xc8;}else{_0x2f72d8=0xce;}_0x949c5d[_0x78c9('0x2e')](_0x2f72d8);return _0x949c5d[_0x78c9('0x35')]('Content-Range',_0x3ab44c+'-'+_0x41256c+'/'+_0x82fd8f)['json'](_0x1298db);}return null;};}function patchUpdates(_0x592197){return function(_0x2cf801){try{jsonpatch['apply'](_0x2cf801,_0x592197,!![]);}catch(_0x1be530){return BPromise['reject'](_0x1be530);}return _0x2cf801[_0x78c9('0x36')]();};}function saveUpdates(_0x79b81e,_0x1d7895){return function(_0x5adaa4){if(_0x5adaa4){return _0x5adaa4[_0x78c9('0x37')](_0x79b81e)[_0x78c9('0x22')](function(_0x5f24d7){return _0x5f24d7;});}return null;};}function removeEntity(_0x151d97,_0x25b48f){return function(_0x14d160){if(_0x14d160){return _0x14d160[_0x78c9('0x38')]()[_0x78c9('0x22')](function(){var _0x13f201=_0x14d160['get']({'plain':!![]});var _0x5e6ed1='OpenchannelAccounts';return db['UserProfileResource'][_0x78c9('0x38')]({'where':{'type':_0x5e6ed1,'resourceId':_0x13f201['id']}})['then'](function(){return _0x14d160;});})[_0x78c9('0x22')](function(){_0x151d97[_0x78c9('0x2e')](0xcc)[_0x78c9('0x2f')]();});}};}function handleEntityNotFound(_0x3c64f6,_0x23299a){return function(_0x5072fe){if(!_0x5072fe){_0x3c64f6[_0x78c9('0x2d')](0x194);}return _0x5072fe;};}function handleError(_0x1f90b2,_0x4229e9){_0x4229e9=_0x4229e9||0x1f4;return function(_0x382b20){logger[_0x78c9('0x27')](_0x382b20[_0x78c9('0x39')]);if(_0x382b20['name']){delete _0x382b20[_0x78c9('0x3a')];}_0x1f90b2[_0x78c9('0x2e')](_0x4229e9)[_0x78c9('0x3b')](_0x382b20);};}exports[_0x78c9('0x3c')]=function(_0x4d18f8,_0x2f1e33){var _0x57464a={'include':[{'model':db[_0x78c9('0x3d')],'as':'mandatoryDispositionPause'}]},_0x125c1f={},_0xfc4b54={'count':0x0,'rows':[]};var _0xd6deaa=_['map'](db[_0x78c9('0x3e')][_0x78c9('0x3f')],function(_0x52254e){return{'name':_0x52254e[_0x78c9('0x40')],'type':_0x52254e[_0x78c9('0x41')][_0x78c9('0x42')]};});_0x125c1f[_0x78c9('0x43')]=_[_0x78c9('0x44')](_0xd6deaa,_0x78c9('0x3a'));_0x125c1f[_0x78c9('0x45')]=_[_0x78c9('0x46')](_0x4d18f8[_0x78c9('0x45')]);_0x125c1f['filters']=_[_0x78c9('0x47')](_0x125c1f[_0x78c9('0x43')],_0x125c1f[_0x78c9('0x45')]);_0x57464a[_0x78c9('0x48')]=_[_0x78c9('0x47')](_0x125c1f[_0x78c9('0x43')],qs[_0x78c9('0x49')](_0x4d18f8[_0x78c9('0x45')][_0x78c9('0x49')]));_0x57464a['attributes']=_0x57464a[_0x78c9('0x48')][_0x78c9('0x4a')]?_0x57464a['attributes']:_0x125c1f[_0x78c9('0x43')];if(!_0x4d18f8[_0x78c9('0x45')][_0x78c9('0x4b')]('nolimit')){_0x57464a['limit']=qs[_0x78c9('0x34')](_0x4d18f8[_0x78c9('0x45')]['limit']);_0x57464a[_0x78c9('0x31')]=qs[_0x78c9('0x31')](_0x4d18f8[_0x78c9('0x45')][_0x78c9('0x31')]);}_0x57464a['order']=qs[_0x78c9('0x4c')](_0x4d18f8[_0x78c9('0x45')][_0x78c9('0x4c')]);_0x57464a[_0x78c9('0x4d')]=qs[_0x78c9('0x4e')](_['pick'](_0x4d18f8[_0x78c9('0x45')],_0x125c1f['filters']),_0xd6deaa);if(_0x4d18f8[_0x78c9('0x45')]['filter']){_0x57464a['where']=_[_0x78c9('0x4f')](_0x57464a[_0x78c9('0x4d')],{'$or':_[_0x78c9('0x44')](_0xd6deaa,function(_0x182e70){if(_0x182e70[_0x78c9('0x41')]!=='VIRTUAL'){var _0x5c59d7={};_0x5c59d7[_0x182e70[_0x78c9('0x3a')]]={'$like':'%'+_0x4d18f8['query'][_0x78c9('0x50')]+'%'};return _0x5c59d7;}})});}_0x57464a=_[_0x78c9('0x4f')]({},_0x57464a,_0x4d18f8[_0x78c9('0x51')]);var _0x307405={'where':_0x57464a[_0x78c9('0x4d')]};return db['OpenchannelAccount'][_0x78c9('0x33')](_0x307405)[_0x78c9('0x22')](function(_0x3f22c3){_0xfc4b54[_0x78c9('0x33')]=_0x3f22c3;if(_0x4d18f8[_0x78c9('0x45')][_0x78c9('0x52')]){_0x57464a[_0x78c9('0x53')]=[{'all':!![]}];}return db[_0x78c9('0x3e')][_0x78c9('0x54')](_0x57464a);})[_0x78c9('0x22')](function(_0x2a46ff){_0xfc4b54['rows']=_0x2a46ff;return _0xfc4b54;})[_0x78c9('0x22')](respondWithFilteredResult(_0x2f1e33,_0x57464a))[_0x78c9('0x2c')](handleError(_0x2f1e33,null));};exports[_0x78c9('0x55')]=function(_0x59b8ac,_0x3c89e2){var _0x164949={'raw':![],'where':{'id':_0x59b8ac['params']['id']},'include':[{'model':db[_0x78c9('0x3d')],'as':'mandatoryDispositionPause'}]},_0xe1e5d3={};_0xe1e5d3[_0x78c9('0x43')]=_[_0x78c9('0x46')](db['OpenchannelAccount'][_0x78c9('0x3f')]);_0xe1e5d3['query']=_[_0x78c9('0x46')](_0x59b8ac[_0x78c9('0x45')]);_0xe1e5d3[_0x78c9('0x4e')]=_[_0x78c9('0x47')](_0xe1e5d3[_0x78c9('0x43')],_0xe1e5d3[_0x78c9('0x45')]);_0x164949[_0x78c9('0x48')]=_[_0x78c9('0x47')](_0xe1e5d3['model'],qs[_0x78c9('0x49')](_0x59b8ac[_0x78c9('0x45')]['fields']));_0x164949['attributes']=_0x164949[_0x78c9('0x48')][_0x78c9('0x4a')]?_0x164949['attributes']:_0xe1e5d3[_0x78c9('0x43')];if(_0x59b8ac['query']['includeAll']){_0x164949[_0x78c9('0x53')]=[{'all':!![]}];}_0x164949=_['merge']({},_0x164949,_0x59b8ac[_0x78c9('0x51')]);return db[_0x78c9('0x3e')][_0x78c9('0x56')](_0x164949)[_0x78c9('0x22')](handleEntityNotFound(_0x3c89e2,null))[_0x78c9('0x22')](respondWithResult(_0x3c89e2,null))[_0x78c9('0x2c')](handleError(_0x3c89e2,null));};exports[_0x78c9('0x57')]=function(_0x5fddd0,_0x7cbf73){return db[_0x78c9('0x3e')][_0x78c9('0x57')](_0x5fddd0[_0x78c9('0x58')],{})['then'](function(_0x1a2524){var _0x4bcc81=_0x5fddd0[_0x78c9('0x59')][_0x78c9('0x5a')]({'plain':!![]});if(!_0x4bcc81)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bcc81['role']==='user'){var _0x5e5312=_0x1a2524[_0x78c9('0x5a')]({'plain':!![]});var _0x4dc0be=_0x78c9('0x5b');return db['UserProfileSection'][_0x78c9('0x56')]({'where':{'name':_0x4dc0be,'userProfileId':_0x4bcc81[_0x78c9('0x5c')]},'raw':!![]})['then'](function(_0x354d06){if(_0x354d06&&_0x354d06[_0x78c9('0x5d')]===0x0){return db[_0x78c9('0x5e')][_0x78c9('0x57')]({'name':_0x5e5312[_0x78c9('0x3a')],'resourceId':_0x5e5312['id'],'type':_0x354d06[_0x78c9('0x3a')],'sectionId':_0x354d06['id']},{})[_0x78c9('0x22')](function(){return _0x1a2524;});}else{return _0x1a2524;}})['catch'](function(_0x798570){logger[_0x78c9('0x27')](_0x78c9('0x5f'),_0x798570);throw _0x798570;});}return _0x1a2524;})[_0x78c9('0x22')](respondWithResult(_0x7cbf73,0xc9))[_0x78c9('0x2c')](handleError(_0x7cbf73,null));};exports[_0x78c9('0x37')]=function(_0x4457f0,_0x5af310){if(_0x4457f0[_0x78c9('0x58')]['id']){delete _0x4457f0['body']['id'];}return db[_0x78c9('0x3e')][_0x78c9('0x56')]({'where':{'id':_0x4457f0[_0x78c9('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0x78c9('0x61')}]})['then'](handleEntityNotFound(_0x5af310,null))['then'](saveUpdates(_0x4457f0[_0x78c9('0x58')],null))['then'](respondWithResult(_0x5af310,null))['catch'](handleError(_0x5af310,null));};exports[_0x78c9('0x38')]=function(_0x3672d7,_0x3dac52){return db['OpenchannelAccount'][_0x78c9('0x56')]({'where':{'id':_0x3672d7[_0x78c9('0x60')]['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x3dac52,null))[_0x78c9('0x22')](removeEntity(_0x3dac52,null))[_0x78c9('0x2c')](handleError(_0x3dac52,null));};exports[_0x78c9('0x62')]=function(_0x244b3e,_0x228fcc){return db['OpenchannelAccount']['describe']()[_0x78c9('0x22')](respondWithResult(_0x228fcc,null))[_0x78c9('0x2c')](handleError(_0x228fcc,null));};exports['addDisposition']=function(_0x3c1fd0,_0x5dc1f6,_0x18c6e6){if(_0x3c1fd0[_0x78c9('0x58')]['id']){delete _0x3c1fd0[_0x78c9('0x58')]['id'];}return db['OpenchannelAccount'][_0x78c9('0x56')]({'where':{'id':_0x3c1fd0[_0x78c9('0x60')]['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x5dc1f6,null))['then'](function(_0x3248ec){if(_0x3248ec){_0x3c1fd0['body'][_0x78c9('0x63')]=_0x3248ec['id'];return db[_0x78c9('0x64')][_0x78c9('0x57')](_0x3c1fd0[_0x78c9('0x58')]);}})[_0x78c9('0x22')](respondWithResult(_0x5dc1f6,null))['catch'](handleError(_0x5dc1f6,null));};exports['getDispositions']=function(_0x4e39ed,_0x9975de,_0x2eb568){var _0x3ef1bc={'raw':![],'where':{}};var _0x499206={};var _0x509a02={'count':0x0,'rows':[]};return db[_0x78c9('0x3e')][_0x78c9('0x65')]({'where':{'id':_0x4e39ed[_0x78c9('0x60')]['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x9975de,null))[_0x78c9('0x22')](function(_0x404a22){if(_0x404a22){_0x499206[_0x78c9('0x43')]=_[_0x78c9('0x46')](db['Disposition']['rawAttributes']);_0x499206[_0x78c9('0x45')]=_[_0x78c9('0x46')](_0x4e39ed[_0x78c9('0x45')]);_0x499206[_0x78c9('0x4e')]=_['intersection'](_0x499206[_0x78c9('0x43')],_0x499206[_0x78c9('0x45')]);_0x3ef1bc[_0x78c9('0x48')]=_[_0x78c9('0x47')](_0x499206[_0x78c9('0x43')],qs[_0x78c9('0x49')](_0x4e39ed['query'][_0x78c9('0x49')]));_0x3ef1bc[_0x78c9('0x48')]=_0x3ef1bc[_0x78c9('0x48')]['length']?_0x3ef1bc[_0x78c9('0x48')]:_0x499206[_0x78c9('0x43')];if(!_0x4e39ed[_0x78c9('0x45')][_0x78c9('0x4b')](_0x78c9('0x66'))){_0x3ef1bc['limit']=qs['limit'](_0x4e39ed['query'][_0x78c9('0x34')]);_0x3ef1bc[_0x78c9('0x31')]=qs[_0x78c9('0x31')](_0x4e39ed[_0x78c9('0x45')][_0x78c9('0x31')]);}_0x3ef1bc[_0x78c9('0x67')]=qs[_0x78c9('0x4c')](_0x4e39ed['query'][_0x78c9('0x4c')]);_0x3ef1bc[_0x78c9('0x4d')]=qs[_0x78c9('0x4e')](_[_0x78c9('0x68')](_0x4e39ed[_0x78c9('0x45')],_0x499206['filters']));_0x3ef1bc['where'][_0x78c9('0x63')]=_0x404a22['id'];if(_0x4e39ed[_0x78c9('0x45')]['filter']){_0x3ef1bc[_0x78c9('0x4d')]=_[_0x78c9('0x4f')](_0x3ef1bc[_0x78c9('0x4d')],{'$or':_[_0x78c9('0x44')](_0x3ef1bc['attributes'],function(_0x4d8b8f){var _0x138c00={};_0x138c00[_0x4d8b8f]={'$like':'%'+_0x4e39ed[_0x78c9('0x45')][_0x78c9('0x50')]+'%'};return _0x138c00;})});}_0x3ef1bc=_['merge']({},_0x3ef1bc,_0x4e39ed['options']);return db['Disposition']['count']({'where':_0x3ef1bc[_0x78c9('0x4d')]})['then'](function(_0x43b938){_0x509a02[_0x78c9('0x33')]=_0x43b938;if(_0x4e39ed[_0x78c9('0x45')][_0x78c9('0x52')]){_0x3ef1bc['include']=[{'all':!![]}];}return db[_0x78c9('0x64')][_0x78c9('0x54')](_0x3ef1bc);})[_0x78c9('0x22')](function(_0x20cfd7){_0x509a02[_0x78c9('0x69')]=_0x20cfd7;return _0x509a02;});}})[_0x78c9('0x22')](respondWithFilteredResult(_0x9975de,_0x3ef1bc))['catch'](handleError(_0x9975de,null));};exports[_0x78c9('0x6a')]=function(_0x2dbdb2,_0x51879a,_0x31c014){return db[_0x78c9('0x3e')][_0x78c9('0x56')]({'where':{'id':_0x2dbdb2['params']['id']}})['then'](handleEntityNotFound(_0x51879a,null))[_0x78c9('0x22')](function(_0x3023a7){if(_0x3023a7){return _0x3023a7[_0x78c9('0x6a')](_0x2dbdb2['query'][_0x78c9('0x6b')]);}})[_0x78c9('0x22')](respondWithStatusCode(_0x51879a,null))[_0x78c9('0x2c')](handleError(_0x51879a,null));};exports[_0x78c9('0x6c')]=function(_0x370df0,_0xd3148d,_0x39b63a){if(_0x370df0[_0x78c9('0x58')]['id']){delete _0x370df0[_0x78c9('0x58')]['id'];}return db[_0x78c9('0x3e')][_0x78c9('0x56')]({'where':{'id':_0x370df0['params']['id']}})['then'](handleEntityNotFound(_0xd3148d,null))[_0x78c9('0x22')](function(_0xa712f9){if(_0xa712f9){_0x370df0[_0x78c9('0x58')][_0x78c9('0x63')]=_0xa712f9['id'];return db['CannedAnswer'][_0x78c9('0x57')](_0x370df0[_0x78c9('0x58')]);}})[_0x78c9('0x22')](respondWithResult(_0xd3148d,null))['catch'](handleError(_0xd3148d,null));};exports['getAnswers']=function(_0x5eafee,_0x3f9514,_0xd2fcad){var _0x25228a={'raw':![],'where':{}};var _0x3a4d5d={};var _0x371571={'count':0x0,'rows':[]};return db[_0x78c9('0x3e')][_0x78c9('0x65')]({'where':{'id':_0x5eafee['params']['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x3f9514,null))[_0x78c9('0x22')](function(_0x4f60d7){if(_0x4f60d7){_0x3a4d5d[_0x78c9('0x43')]=_['keys'](db[_0x78c9('0x6d')][_0x78c9('0x3f')]);_0x3a4d5d[_0x78c9('0x45')]=_[_0x78c9('0x46')](_0x5eafee[_0x78c9('0x45')]);_0x3a4d5d[_0x78c9('0x4e')]=_[_0x78c9('0x47')](_0x3a4d5d[_0x78c9('0x43')],_0x3a4d5d[_0x78c9('0x45')]);_0x25228a[_0x78c9('0x48')]=_['intersection'](_0x3a4d5d[_0x78c9('0x43')],qs['fields'](_0x5eafee[_0x78c9('0x45')]['fields']));_0x25228a['attributes']=_0x25228a[_0x78c9('0x48')][_0x78c9('0x4a')]?_0x25228a[_0x78c9('0x48')]:_0x3a4d5d[_0x78c9('0x43')];if(!_0x5eafee['query']['hasOwnProperty'](_0x78c9('0x66'))){_0x25228a[_0x78c9('0x34')]=qs[_0x78c9('0x34')](_0x5eafee['query'][_0x78c9('0x34')]);_0x25228a[_0x78c9('0x31')]=qs[_0x78c9('0x31')](_0x5eafee['query']['offset']);}_0x25228a['order']=qs[_0x78c9('0x4c')](_0x5eafee[_0x78c9('0x45')][_0x78c9('0x4c')]);_0x25228a['where']=qs[_0x78c9('0x4e')](_[_0x78c9('0x68')](_0x5eafee[_0x78c9('0x45')],_0x3a4d5d[_0x78c9('0x4e')]));_0x25228a[_0x78c9('0x4d')][_0x78c9('0x63')]=_0x4f60d7['id'];if(_0x5eafee['query'][_0x78c9('0x50')]){_0x25228a[_0x78c9('0x4d')]=_['merge'](_0x25228a[_0x78c9('0x4d')],{'$or':_[_0x78c9('0x44')](_0x25228a['attributes'],function(_0x8d99b){var _0x110e37={};_0x110e37[_0x8d99b]={'$like':'%'+_0x5eafee[_0x78c9('0x45')][_0x78c9('0x50')]+'%'};return _0x110e37;})});}_0x25228a=_[_0x78c9('0x4f')]({},_0x25228a,_0x5eafee[_0x78c9('0x51')]);return db[_0x78c9('0x6d')][_0x78c9('0x33')]({'where':_0x25228a[_0x78c9('0x4d')]})['then'](function(_0x2bb794){_0x371571[_0x78c9('0x33')]=_0x2bb794;if(_0x5eafee[_0x78c9('0x45')][_0x78c9('0x52')]){_0x25228a[_0x78c9('0x53')]=[{'all':!![]}];}return db[_0x78c9('0x6d')]['findAll'](_0x25228a);})[_0x78c9('0x22')](function(_0x136885){_0x371571[_0x78c9('0x69')]=_0x136885;return _0x371571;});}})['then'](respondWithFilteredResult(_0x3f9514,_0x25228a))[_0x78c9('0x2c')](handleError(_0x3f9514,null));};exports['removeAnswers']=function(_0x2ec38e,_0x4649d7,_0x282d3b){return db[_0x78c9('0x3e')]['find']({'where':{'id':_0x2ec38e['params']['id']}})['then'](handleEntityNotFound(_0x4649d7,null))[_0x78c9('0x22')](function(_0x3d9dda){if(_0x3d9dda){return _0x3d9dda['removeAnswers'](_0x2ec38e['query'][_0x78c9('0x6b')]);}})[_0x78c9('0x22')](respondWithStatusCode(_0x4649d7,null))[_0x78c9('0x2c')](handleError(_0x4649d7,null));};exports[_0x78c9('0x6e')]=function(_0x448fab,_0x4997ac,_0x4abece){var _0x54b09d={'body':_0x448fab[_0x78c9('0x58')],'channel':_0x78c9('0x6f')};var _0xef760c=[];var _0x114934=[];var _0x4d5779={};var _0x31bcb5=![];return db['CmContact'][_0x78c9('0x62')]()[_0x78c9('0x22')](function(_0x4f104c){if(!_0x4f104c){throw new db[(_0x78c9('0x70'))][(_0x78c9('0x71'))](_0x78c9('0x72'));}_0xef760c=_[_0x78c9('0x73')](_[_0x78c9('0x46')](_0x4f104c),[_0x78c9('0x74'),_0x78c9('0x75')]);_0x114934=_[_0x78c9('0x73')](_['keys'](_0x4f104c),[_0x78c9('0x74'),_0x78c9('0x75'),_0x78c9('0x76'),_0x78c9('0x77')]);if(_0x448fab[_0x78c9('0x58')]['id']){delete _0x448fab[_0x78c9('0x58')]['id'];}if(_[_0x78c9('0x78')](_0x448fab['body'][_0x78c9('0x79')])){throw new db[(_0x78c9('0x70'))][(_0x78c9('0x71'))](_0x78c9('0x7a'));}if(_[_0x78c9('0x78')](_0x448fab['body'][_0x78c9('0x58')])||_0x448fab[_0x78c9('0x58')][_0x78c9('0x58')]===''){throw new db['Sequelize'][(_0x78c9('0x71'))](_0x78c9('0x7b'));}if(_[_0x78c9('0x78')](_0x448fab[_0x78c9('0x58')][_0x78c9('0x7c')])){throw new db[(_0x78c9('0x70'))]['ValidationError'](_0x78c9('0x7d')+_0x114934);}if(!_[_0x78c9('0x7e')](_0x114934,_0x448fab['body'][_0x78c9('0x7c')])){throw new db['Sequelize'][(_0x78c9('0x71'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x114934);}_0x4d5779[_0x448fab[_0x78c9('0x58')][_0x78c9('0x7c')]]=_0x448fab['body']['from'];})[_0x78c9('0x22')](function(){return db[_0x78c9('0x3e')]['find']({'where':{'id':_0x448fab[_0x78c9('0x60')]['id']},'include':[{'model':db[_0x78c9('0x7f')],'as':_0x78c9('0x80'),'include':[{'model':db[_0x78c9('0x81')],'as':_0x78c9('0x82'),'where':_0x4d5779,'limit':0x1,'order':[[_0x78c9('0x75'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x78c9('0x83')}]});})[_0x78c9('0x22')](handleEntityNotFound(_0x4997ac,null))[_0x78c9('0x22')](function(_0x85f10){if(_0x85f10&&_0x85f10['List']){_0x54b09d['account']=_0x85f10;_0x54b09d[_0x78c9('0x84')]=_0x85f10['Applications'];_0x54b09d[_0x78c9('0x85')]=_0x85f10[_0x78c9('0x80')];_0x54b09d[_0x78c9('0x84')]=_[_0x78c9('0x86')](_0x54b09d[_0x78c9('0x84')],[_0x78c9('0x87')],[_0x78c9('0x88')]);if(_0x54b09d[_0x78c9('0x89')]['Applications']){delete _0x54b09d[_0x78c9('0x89')]['Applications'];}if(_0x54b09d[_0x78c9('0x89')][_0x78c9('0x80')]&&_0x54b09d[_0x78c9('0x89')][_0x78c9('0x80')]['Contacts'][_0x78c9('0x4a')]){return _0x54b09d[_0x78c9('0x89')][_0x78c9('0x80')][_0x78c9('0x82')][0x0];}var _0x41d788=_['defaults'](_0x448fab[_0x78c9('0x58')],{'firstName':_0x448fab[_0x78c9('0x58')][_0x78c9('0x79')],'ListId':_0x85f10[_0x78c9('0x77')]});_0x41d788[_0x448fab[_0x78c9('0x58')]['mapKey']]=_0x448fab['body'][_0x78c9('0x79')];return db[_0x78c9('0x81')][_0x78c9('0x57')](_0x41d788,{'fields':_0xef760c,'raw':!![]});}})[_0x78c9('0x22')](handleEntityNotFound(_0x4997ac,null))[_0x78c9('0x22')](function(_0x285963){_0x54b09d['contact']=_0x285963;if(_0x285963){var _0x521b2f={'ContactId':_0x285963['id'],'OpenchannelAccountId':_0x448fab[_0x78c9('0x60')]['id'],'from':(_0x285963[_0x78c9('0x8a')]||'')+'\x20'+(_0x285963['lastName']||'')};var _0x558d0e={'OpenchannelAccountId':_0x448fab[_0x78c9('0x60')]['id'],'closed':![]};if(_0x448fab[_0x78c9('0x58')][_0x78c9('0x8b')]){_0x558d0e[_0x78c9('0x8b')]=_0x448fab[_0x78c9('0x58')]['threadId'];return db[_0x78c9('0x8c')]['find']({'where':_0x558d0e})[_0x78c9('0x22')](function(_0x1b6386){if(_0x1b6386){return[_0x1b6386,![]];}_0x521b2f[_0x78c9('0x8b')]=_0x448fab['body'][_0x78c9('0x8b')];_0x521b2f['externalUrl']=_0x448fab[_0x78c9('0x58')][_0x78c9('0x8d')];return db['OpenchannelInteraction'][_0x78c9('0x57')](_0x521b2f)[_0x78c9('0x22')](function(_0x405a8f){return[_0x405a8f,!![]];});});}else{_0x558d0e[_0x78c9('0x8b')]=null;}_0x558d0e[_0x78c9('0x8e')]=_0x285963['id'];return db['OpenchannelInteraction'][_0x78c9('0x56')]({'where':_0x558d0e})['then'](function(_0x1ae2fa){if(_0x1ae2fa){return[_0x1ae2fa,![]];}return db[_0x78c9('0x8c')]['create'](_0x521b2f)[_0x78c9('0x22')](function(_0x5690da){return[_0x5690da,!![]];});});}})[_0x78c9('0x8f')](function(_0x2ba204,_0xfb1b1b){if(_0x2ba204){_0x31bcb5=_0xfb1b1b;if(!_0xfb1b1b){var _0x4e8e22={'from':(_0x54b09d[_0x78c9('0x90')][_0x78c9('0x8a')]||'')+'\x20'+(_0x54b09d[_0x78c9('0x90')][_0x78c9('0x91')]||'')};if(_0x448fab[_0x78c9('0x58')][_0x78c9('0x8b')]&&_0x448fab[_0x78c9('0x58')][_0x78c9('0x92')]&&_0x448fab[_0x78c9('0x58')][_0x78c9('0x8b')]!=_0x448fab[_0x78c9('0x58')][_0x78c9('0x92')]){_0x4e8e22[_0x78c9('0x8b')]=_0x448fab['body'][_0x78c9('0x92')];}return _0x2ba204[_0x78c9('0x37')](_0x4e8e22);}else{return _0x2ba204;}}})[_0x78c9('0x22')](function(_0x3c702b){_0x54b09d['interaction']=_0x3c702b[_0x78c9('0x5a')]({'plain':!![]});_0x54b09d['interaction'][_0x78c9('0x93')]=_0x31bcb5;if(_0x54b09d['interaction'][_0x78c9('0x93')]){if(_0x54b09d[_0x78c9('0x89')][_0x78c9('0x94')]){_0x54b09d['applications'][_0x78c9('0x95')]({'id':0x0,'priority':_0x54b09d[_0x78c9('0x84')]['length']+0x1,'app':_0x78c9('0x96'),'appdata':_0x78c9('0x97'),'interval':_0x78c9('0x98')});}}return db[_0x78c9('0x99')][_0x78c9('0x57')]({'body':_0x448fab[_0x78c9('0x58')][_0x78c9('0x58')],'OpenchannelAccountId':_0x448fab[_0x78c9('0x60')]['id'],'OpenchannelInteractionId':_0x3c702b['id'],'direction':'in','ContactId':_0x54b09d[_0x78c9('0x90')]['id'],'AttachmentId':_0x448fab[_0x78c9('0x58')][_0x78c9('0x9a')]});})[_0x78c9('0x22')](function(_0x395c20){_0x54b09d[_0x78c9('0x29')]=_0x395c20;if(!_0x54b09d['interaction'][_0x78c9('0x9b')])return;return db[_0x78c9('0x9c')][_0x78c9('0x56')]({'attributes':['id',_0x78c9('0x3a')],'where':{'id':_0x54b09d[_0x78c9('0x9d')]['UserId']}});})[_0x78c9('0x22')](function(_0x5aa63d){if(_0x5aa63d){_0x54b09d[_0x78c9('0x84')][_0x78c9('0x9e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5aa63d[_0x78c9('0x3a')]+','+(_0x54b09d['account'][_0x78c9('0x9f')]||0xa),'interval':'*,*,*,*'});}if(!_0x54b09d[_0x78c9('0x9d')]['queueId'])return;return db['OpenchannelQueue'][_0x78c9('0x56')]({'attributes':['id',_0x78c9('0x3a')],'where':{'id':_0x54b09d[_0x78c9('0x9d')][_0x78c9('0xa0')]}});})[_0x78c9('0x22')](function(_0x29820f){if(_0x29820f){_0x54b09d[_0x78c9('0x84')][_0x78c9('0x9e')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x29820f[_0x78c9('0x3a')]+','+(_0x54b09d[_0x78c9('0x89')][_0x78c9('0xa1')]||0x12c),'interval':_0x78c9('0x98')});}return respondWithRpcPromise(_0x78c9('0xa2'),_0x78c9('0xa3'),_0x54b09d);})[_0x78c9('0x22')](function(_0x5a081b){respondWithRpcPromise(_0x78c9('0xa4'),_0x78c9('0xa4'),{'event':_0x78c9('0x6e'),'message':_0x5a081b},client9002);return _0x5a081b;})['then'](respondWithResult(_0x4997ac,null))[_0x78c9('0x2c')](handleError(_0x4997ac,null));};exports[_0x78c9('0xa5')]=function(_0x164fde,_0x1d1cee){var _0x2fb650=_0x164fde['params']['id'];var _0x5133bb=_0x164fde['body'];var _0x165bb8=0xc8;var _0x5e3ed1=null;return db[_0x78c9('0xa6')][_0x78c9('0xa7')]({'isolationLevel':db[_0x78c9('0xa6')][_0x78c9('0xa8')][_0x78c9('0xa9')][_0x78c9('0xaa')]},function(_0x1abeb0){return db['OpenchannelAccount'][_0x78c9('0x65')]({'where':{'id':_0x2fb650},'transaction':_0x1abeb0})[_0x78c9('0x22')](function(_0x466b9e){if(_0x466b9e){return db['OpenchannelApplication'][_0x78c9('0x38')]({'where':{'OpenchannelAccountId':_0x2fb650},'transaction':_0x1abeb0})[_0x78c9('0x22')](function(){var _0x4acd60=_['map'](_0x5133bb,function(_0x1afc01){_0x1afc01[_0x78c9('0x63')]=_0x2fb650;return _0x1afc01;});return db[_0x78c9('0xab')][_0x78c9('0xac')](_0x4acd60,{'transaction':_0x1abeb0});});}else{_0x165bb8=0x194;_0x5e3ed1=[];}});})['then'](function(){if(_0x165bb8!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2fb650},'order':'priority'})[_0x78c9('0x22')](function(_0x5177ef){_0x5e3ed1=_0x5177ef;});}})[_0x78c9('0x2c')](function(_0x582265){_0x165bb8=0x1f4;logger[_0x78c9('0x27')](_0x582265['stack']);if(_0x582265[_0x78c9('0x3a')]){delete _0x582265[_0x78c9('0x3a')];}_0x5e3ed1=_0x582265;})['finally'](function(){if(_0x5e3ed1===null){_0x1d1cee[_0x78c9('0x2d')](_0x165bb8);}else{if(_0x165bb8===0x1f4){_0x1d1cee['status'](_0x165bb8)[_0x78c9('0x3b')](_0x5e3ed1);}else{_0x1d1cee[_0x78c9('0x2e')](_0x165bb8)[_0x78c9('0x30')](_0x5e3ed1);}}});};exports[_0x78c9('0xad')]=function(_0x23b2eb,_0x1e04c1,_0xaaf7fe){var _0x5f4947={};var _0x32d007={};var _0x4c5635;var _0x22781a;return db[_0x78c9('0x3e')]['findOne']({'where':{'id':_0x23b2eb['params']['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x1e04c1,null))['then'](function(_0x27380a){if(_0x27380a){_0x4c5635=_0x27380a;_0x32d007[_0x78c9('0x43')]=_[_0x78c9('0x46')](db[_0x78c9('0xab')][_0x78c9('0x3f')]);_0x32d007['query']=_[_0x78c9('0x46')](_0x23b2eb[_0x78c9('0x45')]);_0x32d007[_0x78c9('0x4e')]=_['intersection'](_0x32d007[_0x78c9('0x43')],_0x32d007[_0x78c9('0x45')]);_0x5f4947['attributes']=_[_0x78c9('0x47')](_0x32d007[_0x78c9('0x43')],qs['fields'](_0x23b2eb[_0x78c9('0x45')][_0x78c9('0x49')]));_0x5f4947[_0x78c9('0x48')]=_0x5f4947[_0x78c9('0x48')]['length']?_0x5f4947[_0x78c9('0x48')]:_0x32d007['model'];_0x5f4947['order']=qs[_0x78c9('0x4c')](_0x23b2eb[_0x78c9('0x45')][_0x78c9('0x4c')]);_0x5f4947[_0x78c9('0x4d')]=qs[_0x78c9('0x4e')](_[_0x78c9('0x68')](_0x23b2eb[_0x78c9('0x45')],_0x32d007['filters']));if(_0x23b2eb[_0x78c9('0x45')][_0x78c9('0x50')]){_0x5f4947[_0x78c9('0x4d')]=_[_0x78c9('0x4f')](_0x5f4947[_0x78c9('0x4d')],{'$or':_['map'](_0x5f4947[_0x78c9('0x48')],function(_0x6d7f04){var _0xe5a0ed={};_0xe5a0ed[_0x6d7f04]={'$like':'%'+_0x23b2eb['query'][_0x78c9('0x50')]+'%'};return _0xe5a0ed;})});}_0x5f4947=_['merge']({},_0x5f4947,_0x23b2eb['options']);return _0x4c5635['getApplications'](_0x5f4947);}})[_0x78c9('0x22')](function(_0xf9800){if(_0xf9800){_0x22781a=_0xf9800[_0x78c9('0x4a')];if(!_0x23b2eb[_0x78c9('0x45')][_0x78c9('0x4b')](_0x78c9('0x66'))){_0x5f4947['limit']=qs[_0x78c9('0x34')](_0x23b2eb[_0x78c9('0x45')][_0x78c9('0x34')]);_0x5f4947[_0x78c9('0x31')]=qs[_0x78c9('0x31')](_0x23b2eb[_0x78c9('0x45')][_0x78c9('0x31')]);}return _0x4c5635[_0x78c9('0xad')](_0x5f4947);}})[_0x78c9('0x22')](function(_0x407dc3){if(_0x407dc3){return _0x407dc3?{'count':_0x22781a,'rows':_0x407dc3}:null;}})[_0x78c9('0x22')](respondWithResult(_0x1e04c1,null))[_0x78c9('0x2c')](handleError(_0x1e04c1,null));};exports[_0x78c9('0xae')]=function(_0xd31ed2,_0x4ec637,_0x3e2f7c){var _0x3b57c5={'raw':![],'where':{}};var _0x1f8dc1={};var _0x5a72c8={'count':0x0,'rows':[]};return db[_0x78c9('0x3e')][_0x78c9('0x65')]({'where':{'id':_0xd31ed2[_0x78c9('0x60')]['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x4ec637,null))[_0x78c9('0x22')](function(_0x4d5e54){if(_0x4d5e54){_0x1f8dc1[_0x78c9('0x43')]=_[_0x78c9('0x46')](db['OpenchannelInteraction'][_0x78c9('0x3f')]);_0x1f8dc1[_0x78c9('0x45')]=_[_0x78c9('0x46')](_0xd31ed2[_0x78c9('0x45')]);_0x1f8dc1['filters']=_[_0x78c9('0x47')](_0x1f8dc1[_0x78c9('0x43')],_0x1f8dc1[_0x78c9('0x45')]);_0x3b57c5[_0x78c9('0x48')]=_['intersection'](_0x1f8dc1[_0x78c9('0x43')],qs[_0x78c9('0x49')](_0xd31ed2['query'][_0x78c9('0x49')]));_0x3b57c5[_0x78c9('0x48')]=_0x3b57c5[_0x78c9('0x48')][_0x78c9('0x4a')]?_0x3b57c5['attributes']:_0x1f8dc1[_0x78c9('0x43')];if(!_0xd31ed2['query']['hasOwnProperty']('nolimit')){_0x3b57c5[_0x78c9('0x34')]=qs[_0x78c9('0x34')](_0xd31ed2[_0x78c9('0x45')][_0x78c9('0x34')]);_0x3b57c5[_0x78c9('0x31')]=qs['offset'](_0xd31ed2[_0x78c9('0x45')][_0x78c9('0x31')]);}_0x3b57c5[_0x78c9('0x67')]=qs[_0x78c9('0x4c')](_0xd31ed2['query'][_0x78c9('0x4c')]);_0x3b57c5['where']=qs[_0x78c9('0x4e')](_[_0x78c9('0x68')](_0xd31ed2[_0x78c9('0x45')],_0x1f8dc1['filters']));_0x3b57c5[_0x78c9('0x4d')][_0x78c9('0x63')]=_0x4d5e54['id'];if(_0xd31ed2['query'][_0x78c9('0x50')]){_0x3b57c5[_0x78c9('0x4d')]=_[_0x78c9('0x4f')](_0x3b57c5[_0x78c9('0x4d')],{'$or':_[_0x78c9('0x44')](_0x3b57c5['attributes'],function(_0x39110a){var _0x11da34={};_0x11da34[_0x39110a]={'$like':'%'+_0xd31ed2[_0x78c9('0x45')]['filter']+'%'};return _0x11da34;})});}_0x3b57c5=_['merge']({},_0x3b57c5,_0xd31ed2['options']);return db['OpenchannelInteraction'][_0x78c9('0x33')]({'where':_0x3b57c5[_0x78c9('0x4d')]})[_0x78c9('0x22')](function(_0x5d773c){_0x5a72c8['count']=_0x5d773c;if(_0xd31ed2[_0x78c9('0x45')][_0x78c9('0x52')]){_0x3b57c5[_0x78c9('0x53')]=[{'model':db['CmContact'],'as':_0x78c9('0xaf'),'required':![]},{'model':db[_0x78c9('0x9c')],'as':'Owner','attributes':['name',_0x78c9('0xb0'),_0x78c9('0xb1')],'required':![]},{'model':db[_0x78c9('0xb2')],'as':_0x78c9('0xb3'),'attributes':['id',_0x78c9('0x3a'),_0x78c9('0xb4')],'where':_0xd31ed2[_0x78c9('0x45')][_0x78c9('0xb5')]?{'id':_0xd31ed2[_0x78c9('0x45')][_0x78c9('0xb5')]}:undefined,'required':_0xd31ed2[_0x78c9('0x45')][_0x78c9('0xb5')]?!![]:![]}];}return db[_0x78c9('0x8c')][_0x78c9('0x54')](_0x3b57c5);})[_0x78c9('0x22')](function(_0x2204ce){_0x5a72c8[_0x78c9('0x69')]=_0x2204ce;return _0x5a72c8;});}})[_0x78c9('0x22')](respondWithFilteredResult(_0x4ec637,_0x3b57c5))[_0x78c9('0x2c')](handleError(_0x4ec637,null));};exports[_0x78c9('0xb6')]=function(_0x2bc425,_0x8d5b0f,_0x1b45ea){return db[_0x78c9('0x3e')][_0x78c9('0x56')]({'where':{'id':_0x2bc425[_0x78c9('0x60')]['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x8d5b0f,null))[_0x78c9('0x22')](function(_0x5a3b6e){if(_0x5a3b6e){return _0x5a3b6e[_0x78c9('0xb6')](_0x2bc425[_0x78c9('0x58')]['ids'],_['omit'](_0x2bc425[_0x78c9('0x58')],['ids','id'])||{})[_0x78c9('0x8f')](function(_0x1f67d5){for(var _0x4c70ef=0x0;_0x4c70ef<_0x2bc425[_0x78c9('0x58')][_0x78c9('0x6b')]['length'];_0x4c70ef+=0x1){socket[_0x78c9('0xb7')]('userOpenchannelAccount:save',{'UserId':Number(_0x2bc425['body'][_0x78c9('0x6b')][_0x4c70ef]),'OpenchannelAccountId':Number(_0x2bc425[_0x78c9('0x60')]['id'])});}return _0x1f67d5;});}})['then'](respondWithResult(_0x8d5b0f,null))[_0x78c9('0x2c')](handleError(_0x8d5b0f,null));};exports[_0x78c9('0xb8')]=function(_0x5aef42,_0x1ff4f9,_0x31db0f){return db[_0x78c9('0x3e')][_0x78c9('0x56')]({'where':{'id':_0x5aef42['params']['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x1ff4f9,null))[_0x78c9('0x22')](function(_0x15d00a){if(_0x15d00a){return _0x15d00a[_0x78c9('0xb8')](_0x5aef42[_0x78c9('0x45')][_0x78c9('0x6b')])[_0x78c9('0x22')](function(){if(_[_0x78c9('0xb9')](_0x5aef42['query'][_0x78c9('0x6b')])){for(var _0x264c7f=0x0;_0x264c7f<_0x5aef42[_0x78c9('0x45')][_0x78c9('0x6b')][_0x78c9('0x4a')];_0x264c7f+=0x1){socket[_0x78c9('0xb7')](_0x78c9('0xba'),{'UserId':Number(_0x5aef42[_0x78c9('0x45')]['ids'][_0x264c7f]),'OpenchannelAccountId':Number(_0x5aef42[_0x78c9('0x60')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x5aef42['query']['ids']),'OpenchannelAccountId':Number(_0x5aef42[_0x78c9('0x60')]['id'])});}});}})[_0x78c9('0x22')](respondWithStatusCode(_0x1ff4f9,null))[_0x78c9('0x2c')](handleError(_0x1ff4f9,null));};exports[_0x78c9('0xbb')]=function(_0x31b965,_0x2f5708,_0x4426be){var _0x46ea3d={};var _0x2ecb6a={};var _0x2fa46f;var _0x4b3556;return db['OpenchannelAccount'][_0x78c9('0x65')]({'where':{'id':_0x31b965[_0x78c9('0x60')]['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x2f5708,null))[_0x78c9('0x22')](function(_0x4a3608){if(_0x4a3608){_0x2fa46f=_0x4a3608;_0x2ecb6a[_0x78c9('0x43')]=_[_0x78c9('0x46')](db[_0x78c9('0x9c')]['rawAttributes']);_0x2ecb6a[_0x78c9('0x45')]=_[_0x78c9('0x46')](_0x31b965[_0x78c9('0x45')]);_0x2ecb6a[_0x78c9('0x4e')]=_[_0x78c9('0x47')](_0x2ecb6a[_0x78c9('0x43')],_0x2ecb6a['query']);_0x46ea3d[_0x78c9('0x48')]=_[_0x78c9('0x47')](_0x2ecb6a[_0x78c9('0x43')],qs[_0x78c9('0x49')](_0x31b965[_0x78c9('0x45')][_0x78c9('0x49')]));_0x46ea3d[_0x78c9('0x48')]=_0x46ea3d[_0x78c9('0x48')][_0x78c9('0x4a')]?_0x46ea3d['attributes']:_0x2ecb6a[_0x78c9('0x43')];_0x46ea3d['order']=qs[_0x78c9('0x4c')](_0x31b965[_0x78c9('0x45')][_0x78c9('0x4c')]);_0x46ea3d[_0x78c9('0x4d')]=qs['filters'](_[_0x78c9('0x68')](_0x31b965[_0x78c9('0x45')],_0x2ecb6a[_0x78c9('0x4e')]));if(_0x31b965['query'][_0x78c9('0x50')]){_0x46ea3d[_0x78c9('0x4d')]=_[_0x78c9('0x4f')](_0x46ea3d[_0x78c9('0x4d')],{'$or':_[_0x78c9('0x44')](_0x46ea3d[_0x78c9('0x48')],function(_0x19171c){var _0x11c637={};_0x11c637[_0x19171c]={'$like':'%'+_0x31b965[_0x78c9('0x45')]['filter']+'%'};return _0x11c637;})});}_0x46ea3d=_['merge']({},_0x46ea3d,_0x31b965['options']);return _0x2fa46f[_0x78c9('0xbb')](_0x46ea3d);}})[_0x78c9('0x22')](function(_0x45b9ce){if(_0x45b9ce){_0x4b3556=_0x45b9ce[_0x78c9('0x4a')];if(!_0x31b965[_0x78c9('0x45')]['hasOwnProperty'](_0x78c9('0x66'))){_0x46ea3d[_0x78c9('0x34')]=qs[_0x78c9('0x34')](_0x31b965[_0x78c9('0x45')][_0x78c9('0x34')]);_0x46ea3d[_0x78c9('0x31')]=qs[_0x78c9('0x31')](_0x31b965[_0x78c9('0x45')][_0x78c9('0x31')]);}return _0x2fa46f[_0x78c9('0xbb')](_0x46ea3d);}})['then'](function(_0x6ff55){if(_0x6ff55){return _0x6ff55?{'count':_0x4b3556,'rows':_0x6ff55}:null;}})[_0x78c9('0x22')](respondWithResult(_0x2f5708,null))[_0x78c9('0x2c')](handleError(_0x2f5708,null));};exports[_0x78c9('0x3b')]=function(_0xdc203f,_0x3779b9,_0x5e0b33){var _0x2a7dcc,_0x4aae45,_0x21a0bd;if(_[_0x78c9('0x78')](_0xdc203f['body'][_0x78c9('0x58')])||_0xdc203f[_0x78c9('0x58')][_0x78c9('0x58')]===''){throw new db[(_0x78c9('0x70'))][(_0x78c9('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x78c9('0x78')](_0xdc203f[_0x78c9('0x58')]['to'])){}_0x2a7dcc=_0xdc203f[_0x78c9('0x58')]['to'];return db[_0x78c9('0x3e')]['findOne']({'where':{'id':_0xdc203f[_0x78c9('0x60')]['id']}})[_0x78c9('0x22')](handleEntityNotFound(_0x3779b9,null))[_0x78c9('0x22')](function(_0x168f96){if(_0x168f96){return db['OpenchannelAccount'][_0x78c9('0x56')]({'where':{'id':_0x168f96['id']},'include':[{'model':db['CmList'],'as':_0x78c9('0x80'),'include':[{'model':db[_0x78c9('0x81')],'as':_0x78c9('0x82'),'where':{[_0x168f96['mapKey']]:_0x2a7dcc},'limit':0x1,'order':[['updatedAt',_0x78c9('0xbc')]]}]}]})[_0x78c9('0x22')](handleEntityNotFound(_0x3779b9,null))['then'](function(_0x17de8c){if(_0x17de8c&&_0x17de8c['List']){_0x4aae45=_0x17de8c[_0x78c9('0x5a')]({'plain':!![]});if(_0x4aae45[_0x78c9('0x80')]&&_0x4aae45['List'][_0x78c9('0x82')][_0x78c9('0x4a')]){return _0x4aae45[_0x78c9('0x80')]['Contacts'][0x0];}return db['CmContact'][_0x78c9('0x57')](_['defaults'](_0xdc203f[_0x78c9('0x58')],{'firstName':_0x2a7dcc,[_0x17de8c[_0x78c9('0x7c')]]:_0x2a7dcc,'phone':_0x2a7dcc,'ListId':_0x4aae45['ListId']}));}})[_0x78c9('0x22')](handleEntityNotFound(_0x3779b9,null))[_0x78c9('0x22')](function(_0xadd492){if(_0xadd492){_0x21a0bd=_0xadd492;return db[_0x78c9('0x8c')][_0x78c9('0x56')]({'where':{'ContactId':_0x21a0bd['id'],'closed':![],'OpenchannelAccountId':_0x4aae45['id']}})['then'](function(_0x43626a){if(_0x43626a){return[_0x43626a,![]];}return db[_0x78c9('0x8c')]['create']({'UserId':_0xdc203f[_0x78c9('0x59')]['id'],'ContactId':_0x21a0bd['id'],'OpenchannelAccountId':_0x4aae45['id'],'lastMsgDirection':_0x78c9('0xbd'),'firstMsgDirection':'out','Messages':[_[_0x78c9('0x4f')](_0xdc203f['body'],{'read':![],'body':_0xdc203f[_0x78c9('0x58')][_0x78c9('0x58')],'OpenchannelAccountId':_0x4aae45['id'],'UserId':_0xdc203f[_0x78c9('0x59')]['id'],'ContactId':_0x21a0bd['id']})]},{'include':[{'model':db[_0x78c9('0x99')],'as':_0x78c9('0xbe')}]})['then'](function(_0x414004){return[_0x414004,!![]];});});}})['spread'](function(_0x3a4f30,_0x70568f){if(_0x70568f){return _0x3a4f30;}return db[_0x78c9('0x99')][_0x78c9('0x57')](_[_0x78c9('0x4f')](_0xdc203f[_0x78c9('0x58')],{'read':![],'body':_0xdc203f['body'][_0x78c9('0x58')],'OpenchannelAccountId':_0x4aae45['id'],'OpenchannelInteractionId':_0x3a4f30['id'],'UserId':_0xdc203f[_0x78c9('0x59')]['id'],'ContactId':_0x21a0bd['id']}))[_0x78c9('0x22')](function(_0x481fbd){_0x3a4f30[_0x78c9('0xbf')][_0x78c9('0xbe')]=[];_0x3a4f30[_0x78c9('0xbf')]['Messages'][_0x78c9('0x95')](_0x481fbd[_0x78c9('0xbf')]);return _0x3a4f30;});});}})['then'](respondWithResult(_0x3779b9,null))[_0x78c9('0x2c')](handleError(_0x3779b9,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index d100026..1c87432 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 _0xb688=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x1d06a5,_0x4fc577){var _0xbaab59=function(_0x458664){while(--_0x458664){_0x1d06a5['push'](_0x1d06a5['shift']());}};_0xbaab59(++_0x4fc577);}(_0xb688,0xcf));var _0x8b68=function(_0x53a28a,_0x1ffb7d){_0x53a28a=_0x53a28a-0x0;var _0x178c61=_0xb688[_0x53a28a];return _0x178c61;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x8b68('0x0'))['db'][_0x8b68('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8b68('0x2')](0x0);var events={'afterCreate':_0x8b68('0x3'),'afterUpdate':_0x8b68('0x4'),'afterDestroy':_0x8b68('0x5')};function emitEvent(_0x4e281c){return function(_0x41030e,_0x27925d,_0x30f33d){OpenchannelAccountEvents[_0x8b68('0x6')](_0x4e281c+':'+_0x41030e['id'],_0x41030e);OpenchannelAccountEvents['emit'](_0x4e281c,_0x41030e);_0x30f33d(null);};}for(var e in events){if(events[_0x8b68('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8b68('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x13f6=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x5d8b5e,_0x19c68e){var _0x90dea0=function(_0x4e832a){while(--_0x4e832a){_0x5d8b5e['push'](_0x5d8b5e['shift']());}};_0x90dea0(++_0x19c68e);}(_0x13f6,0x124));var _0x613f=function(_0x46538e,_0x1a2620){_0x46538e=_0x46538e-0x0;var _0x4da081=_0x13f6[_0x46538e];return _0x4da081;};'use strict';var EventEmitter=require(_0x613f('0x0'));var OpenchannelAccount=require(_0x613f('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x613f('0x2'),'afterUpdate':_0x613f('0x3'),'afterDestroy':_0x613f('0x4')};function emitEvent(_0x5414ff){return function(_0x179f6e,_0x1e01e3,_0x20af2f){OpenchannelAccountEvents['emit'](_0x5414ff+':'+_0x179f6e['id'],_0x179f6e);OpenchannelAccountEvents[_0x613f('0x5')](_0x5414ff,_0x179f6e);_0x20af2f(null);};}for(var e in events){if(events[_0x613f('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index d9b9e94..107b970 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(_0x2ce5e3,_0x371dc1){var _0x5ced9a=function(_0x1d9e69){while(--_0x1d9e69){_0x2ce5e3['push'](_0x2ce5e3['shift']());}};_0x5ced9a(++_0x371dc1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0xad5150,_0x4d0c3c){var _0x55cc8b=function(_0x52a2ef){while(--_0x52a2ef){_0xad5150['push'](_0xad5150['shift']());}};_0x55cc8b(++_0x4d0c3c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 44a7d34..2c284b1 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 _0x6e6c=['OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x598a8b,_0x151600){var _0x2411dd=function(_0x3e9947){while(--_0x3e9947){_0x598a8b['push'](_0x598a8b['shift']());}};_0x2411dd(++_0x151600);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var moment=require('moment');var BPromise=require(_0xc6e6('0x2'));var rs=require(_0xc6e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6e6('0x4'));var logger=require('../../config/logger')(_0xc6e6('0x5'));var config=require('../../config/environment');var jayson=require(_0xc6e6('0x6'));var client=jayson[_0xc6e6('0x7')]['http']({'port':0x232a});config[_0xc6e6('0x8')]=_[_0xc6e6('0x9')](config['redis'],{'host':_0xc6e6('0xa'),'port':0x18eb});var socket=require(_0xc6e6('0xb'))(new Redis(config['redis']));require(_0xc6e6('0xc'))['register'](socket);function respondWithRpcPromise(_0x172aa9,_0x3b2f50,_0x29f78a){return new BPromise(function(_0x3ddf6f,_0x12596b){return client[_0xc6e6('0xd')](_0x172aa9,_0x29f78a)[_0xc6e6('0xe')](function(_0x10aae5){logger[_0xc6e6('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x3b2f50,_0xc6e6('0x10'));logger['debug'](_0xc6e6('0x11'),_0x3b2f50,_0xc6e6('0x10'),JSON[_0xc6e6('0x12')](_0x10aae5));if(_0x10aae5[_0xc6e6('0x13')]){if(_0x10aae5['error'][_0xc6e6('0x14')]===0x1f4){logger[_0xc6e6('0x13')](_0xc6e6('0x15'),_0x3b2f50,_0x10aae5[_0xc6e6('0x13')][_0xc6e6('0x16')]);return _0x12596b(_0x10aae5['error'][_0xc6e6('0x16')]);}logger[_0xc6e6('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x3b2f50,_0x10aae5[_0xc6e6('0x13')][_0xc6e6('0x16')]);return _0x3ddf6f(_0x10aae5[_0xc6e6('0x13')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x3b2f50,_0xc6e6('0x10'));_0x3ddf6f(_0x10aae5['result'][_0xc6e6('0x16')]);}})[_0xc6e6('0x17')](function(_0x1ecc8f){logger[_0xc6e6('0x13')](_0xc6e6('0x15'),_0x3b2f50,_0x1ecc8f);_0x12596b(_0x1ecc8f);});});} \ No newline at end of file +var _0x41bb=['stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x272b70,_0x2ed3c4){var _0x406b78=function(_0x570726){while(--_0x570726){_0x272b70['push'](_0x272b70['shift']());}};_0x406b78(++_0x2ed3c4);}(_0x41bb,0xc5));var _0xb41b=function(_0x30974f,_0x31c0c2){_0x30974f=_0x30974f-0x0;var _0x38d25d=_0x41bb[_0x30974f];return _0x38d25d;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xb41b('0xa')],{'host':_0xb41b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb41b('0xa')]));require(_0xb41b('0xc'))[_0xb41b('0xd')](socket);function respondWithRpcPromise(_0xa2aa66,_0x26d531,_0x11f049){return new BPromise(function(_0x5e5c5b,_0x4baa03){return client[_0xb41b('0xe')](_0xa2aa66,_0x11f049)['then'](function(_0x2e906c){logger[_0xb41b('0xf')](_0xb41b('0x10'),_0x26d531,_0xb41b('0x11'));logger[_0xb41b('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x26d531,_0xb41b('0x11'),JSON[_0xb41b('0x13')](_0x2e906c));if(_0x2e906c[_0xb41b('0x14')]){if(_0x2e906c[_0xb41b('0x14')][_0xb41b('0x15')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x26d531,_0x2e906c['error'][_0xb41b('0x16')]);return _0x4baa03(_0x2e906c[_0xb41b('0x14')][_0xb41b('0x16')]);}logger[_0xb41b('0x14')](_0xb41b('0x10'),_0x26d531,_0x2e906c['error'][_0xb41b('0x16')]);return _0x5e5c5b(_0x2e906c[_0xb41b('0x14')][_0xb41b('0x16')]);}else{logger[_0xb41b('0xf')](_0xb41b('0x10'),_0x26d531,_0xb41b('0x11'));_0x5e5c5b(_0x2e906c[_0xb41b('0x17')]['message']);}})['catch'](function(_0x5da8e3){logger[_0xb41b('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x26d531,_0x5da8e3);_0x4baa03(_0x5da8e3);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 2d49018..95a2536 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 _0x0eaa=['emit','removeListener','register','./openchannelAccount.events','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0xda2906,_0x998a4a){_0xda2906=_0xda2906-0x0;var _0x1bf955=_0x0eaa[_0xda2906];return _0x1bf955;};'use strict';var OpenchannelAccountEvents=require(_0xa0ea('0x0'));var events=[_0xa0ea('0x1'),'remove','update'];function createListener(_0x17efb8,_0x1fe195){return function(_0x5800e9){_0x1fe195[_0xa0ea('0x2')](_0x17efb8,_0x5800e9);};}function removeListener(_0x1c74b8,_0x30dd52){return function(){OpenchannelAccountEvents[_0xa0ea('0x3')](_0x1c74b8,_0x30dd52);};}exports[_0xa0ea('0x4')]=function(_0x5636ed){for(var _0x3c6586=0x0,_0x521881=events['length'];_0x3c6586<_0x521881;_0x3c6586++){var _0x361178=events[_0x3c6586];var _0x8632a1=createListener('openchannelAccount:'+_0x361178,_0x5636ed);OpenchannelAccountEvents['on'](_0x361178,_0x8632a1);}}; \ No newline at end of file +var _0x1da1=['./openchannelAccount.events','save','remove','update','emit','register'];(function(_0xa94837,_0x2004d2){var _0xab61c4=function(_0x348470){while(--_0x348470){_0xa94837['push'](_0xa94837['shift']());}};_0xab61c4(++_0x2004d2);}(_0x1da1,0x1a4));var _0x11da=function(_0x5676c4,_0x402978){_0x5676c4=_0x5676c4-0x0;var _0x382c12=_0x1da1[_0x5676c4];return _0x382c12;};'use strict';var OpenchannelAccountEvents=require(_0x11da('0x0'));var events=[_0x11da('0x1'),_0x11da('0x2'),_0x11da('0x3')];function createListener(_0x46896e,_0x5b0fe4){return function(_0x55af86){_0x5b0fe4[_0x11da('0x4')](_0x46896e,_0x55af86);};}function removeListener(_0x1beca5,_0x3d6bd5){return function(){OpenchannelAccountEvents['removeListener'](_0x1beca5,_0x3d6bd5);};}exports[_0x11da('0x5')]=function(_0x209cbb){for(var _0x15c324=0x0,_0x5ecc27=events['length'];_0x15c324<_0x5ecc27;_0x15c324++){var _0x287653=events[_0x15c324];var _0x109f4b=createListener('openchannelAccount:'+_0x287653,_0x209cbb);OpenchannelAccountEvents['on'](_0x287653,_0x109f4b);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 32f32ad..c8cbd5f 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 _0x062b=['show','post','create','delete','/:id','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x101dce,_0x3b887c){var _0x5a92bb=function(_0x5bac04){while(--_0x5bac04){_0x101dce['push'](_0x101dce['shift']());}};_0x5a92bb(++_0x3b887c);}(_0x062b,0x1d7));var _0xb062=function(_0x3087bf,_0xb3c0d2){_0x3087bf=_0x3087bf-0x0;var _0x1c4a5e=_0x062b[_0x3087bf];return _0x1c4a5e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb062('0x0'));var timeout=require(_0xb062('0x1'));var express=require('express');var router=express[_0xb062('0x2')]();var fs_extra=require(_0xb062('0x3'));var auth=require(_0xb062('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb062('0x5'));var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0xb062('0x6')](),controller[_0xb062('0x7')]);router[_0xb062('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb062('0x9')]);router[_0xb062('0xa')]('/',auth[_0xb062('0x6')](),controller[_0xb062('0xb')]);router['put']('/:id',auth[_0xb062('0x6')](),controller['update']);router[_0xb062('0xc')](_0xb062('0xd'),auth[_0xb062('0x6')](),controller[_0xb062('0xe')]);module[_0xb062('0xf')]=router; \ No newline at end of file +var _0x3128=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x3128,0x118));var _0x8312=function(_0x46cf21,_0x2c1ac9){_0x46cf21=_0x46cf21-0x0;var _0x1c2cbe=_0x3128[_0x46cf21];return _0x1c2cbe;};'use strict';var multer=require(_0x8312('0x0'));var util=require(_0x8312('0x1'));var path=require(_0x8312('0x2'));var timeout=require(_0x8312('0x3'));var express=require(_0x8312('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8312('0x5'));var interaction=require(_0x8312('0x6'));var config=require(_0x8312('0x7'));var controller=require('./openchannelApplication.controller');router[_0x8312('0x8')]('/',auth['isAuthenticated'](),controller[_0x8312('0x9')]);router[_0x8312('0x8')](_0x8312('0xa'),auth[_0x8312('0xb')](),controller[_0x8312('0xc')]);router[_0x8312('0xd')]('/',auth[_0x8312('0xb')](),controller['create']);router[_0x8312('0xe')](_0x8312('0xa'),auth[_0x8312('0xb')](),controller[_0x8312('0xf')]);router[_0x8312('0x10')](_0x8312('0xa'),auth[_0x8312('0xb')](),controller[_0x8312('0x11')]);module[_0x8312('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 5d8aa68..c10f60d 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 _0xdbc6=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0xdbc6,0x1cb));var _0x6dbc=function(_0x481d75,_0x39611d){_0x481d75=_0x481d75-0x0;var _0x52e6f8=_0xdbc6[_0x481d75];return _0x52e6f8;};'use strict';var Sequelize=require('sequelize');module[_0x6dbc('0x0')]={'priority':{'type':Sequelize[_0x6dbc('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6dbc('0x2')],'allowNull':![],'defaultValue':_0x6dbc('0x3')},'appdata':{'type':Sequelize[_0x6dbc('0x4')]()},'description':{'type':Sequelize[_0x6dbc('0x2')]},'interval':{'type':Sequelize[_0x6dbc('0x2')],'defaultValue':_0x6dbc('0x5')}}; \ No newline at end of file +var _0x8af9=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x9e4a55,_0x15b54e){var _0x5bc4ec=function(_0x1727c1){while(--_0x1727c1){_0x9e4a55['push'](_0x9e4a55['shift']());}};_0x5bc4ec(++_0x15b54e);}(_0x8af9,0x1b6));var _0x98af=function(_0x144397,_0x5888af){_0x144397=_0x144397-0x0;var _0x5047c4=_0x8af9[_0x144397];return _0x5047c4;};'use strict';var Sequelize=require(_0x98af('0x0'));module[_0x98af('0x1')]={'priority':{'type':Sequelize[_0x98af('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x98af('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x98af('0x4')]()},'description':{'type':Sequelize[_0x98af('0x3')]},'interval':{'type':Sequelize[_0x98af('0x3')],'defaultValue':_0x98af('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 7683726..96ebbb0 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 _0x6ae7=['findAll','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include'];(function(_0x4bdda3,_0x25f960){var _0x3f8722=function(_0x341120){while(--_0x341120){_0x4bdda3['push'](_0x4bdda3['shift']());}};_0x3f8722(++_0x25f960);}(_0x6ae7,0x134));var _0x76ae=function(_0x352ebf,_0x111b01){_0x352ebf=_0x352ebf-0x0;var _0x3dfcb1=_0x6ae7[_0x352ebf];return _0x3dfcb1;};'use strict';var emlformat=require(_0x76ae('0x0'));var rimraf=require(_0x76ae('0x1'));var zipdir=require(_0x76ae('0x2'));var jsonpatch=require(_0x76ae('0x3'));var rp=require(_0x76ae('0x4'));var moment=require(_0x76ae('0x5'));var BPromise=require(_0x76ae('0x6'));var Mustache=require(_0x76ae('0x7'));var util=require(_0x76ae('0x8'));var path=require('path');var sox=require(_0x76ae('0x9'));var csv=require(_0x76ae('0xa'));var ejs=require(_0x76ae('0xb'));var fs=require('fs');var fs_extra=require(_0x76ae('0xc'));var _=require('lodash');var squel=require(_0x76ae('0xd'));var crypto=require('crypto');var jsforce=require(_0x76ae('0xe'));var deskjs=require(_0x76ae('0xf'));var toCsv=require(_0x76ae('0xa'));var querystring=require(_0x76ae('0x10'));var Papa=require(_0x76ae('0x11'));var Redis=require(_0x76ae('0x12'));var authService=require(_0x76ae('0x13'));var qs=require(_0x76ae('0x14'));var as=require(_0x76ae('0x15'));var hardwareService=require(_0x76ae('0x16'));var logger=require(_0x76ae('0x17'))('api');var utils=require(_0x76ae('0x18'));var config=require(_0x76ae('0x19'));var licenseUtil=require(_0x76ae('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15a6da,_0x42edad){_0x42edad=_0x42edad||0xcc;return function(_0xeec77a){if(_0xeec77a){return _0x15a6da['sendStatus'](_0x42edad);}return _0x15a6da[_0x76ae('0x1b')](_0x42edad)[_0x76ae('0x1c')]();};}function respondWithResult(_0x201385,_0x11bde2){_0x11bde2=_0x11bde2||0xc8;return function(_0x5c6942){if(_0x5c6942){return _0x201385[_0x76ae('0x1b')](_0x11bde2)['json'](_0x5c6942);}};}function respondWithFilteredResult(_0x2e3406,_0x5b0b9e){return function(_0x230212){if(_0x230212){var _0x36a5a0=typeof _0x5b0b9e[_0x76ae('0x1d')]===_0x76ae('0x1e')&&typeof _0x5b0b9e[_0x76ae('0x1f')]===_0x76ae('0x1e');var _0x469dfd=_0x230212[_0x76ae('0x20')];var _0x1f4d3e=_0x36a5a0?0x0:_0x5b0b9e[_0x76ae('0x1d')];var _0x4f0e48=_0x36a5a0?_0x230212['count']:_0x5b0b9e[_0x76ae('0x1d')]+_0x5b0b9e[_0x76ae('0x1f')];var _0xc65779;if(_0x4f0e48>=_0x469dfd){_0x4f0e48=_0x469dfd;_0xc65779=0xc8;}else{_0xc65779=0xce;}_0x2e3406[_0x76ae('0x1b')](_0xc65779);return _0x2e3406[_0x76ae('0x21')]('Content-Range',_0x1f4d3e+'-'+_0x4f0e48+'/'+_0x469dfd)['json'](_0x230212);}return null;};}function patchUpdates(_0x31e2a6){return function(_0x55dca8){try{jsonpatch[_0x76ae('0x22')](_0x55dca8,_0x31e2a6,!![]);}catch(_0x4eff61){return BPromise[_0x76ae('0x23')](_0x4eff61);}return _0x55dca8[_0x76ae('0x24')]();};}function saveUpdates(_0x288fb3,_0x31e657){return function(_0x22436f){if(_0x22436f){return _0x22436f[_0x76ae('0x25')](_0x288fb3)[_0x76ae('0x26')](function(_0x24070c){return _0x24070c;});}return null;};}function removeEntity(_0x4683ac,_0x217463){return function(_0x156299){if(_0x156299){return _0x156299[_0x76ae('0x27')]()[_0x76ae('0x26')](function(){_0x4683ac['status'](0xcc)[_0x76ae('0x1c')]();});}};}function handleEntityNotFound(_0x4163b5,_0x4cf694){return function(_0x3a6a69){if(!_0x3a6a69){_0x4163b5[_0x76ae('0x28')](0x194);}return _0x3a6a69;};}function handleError(_0x2e0062,_0x537a7f){_0x537a7f=_0x537a7f||0x1f4;return function(_0x2ebc58){logger[_0x76ae('0x29')](_0x2ebc58[_0x76ae('0x2a')]);if(_0x2ebc58[_0x76ae('0x2b')]){delete _0x2ebc58['name'];}_0x2e0062[_0x76ae('0x1b')](_0x537a7f)['send'](_0x2ebc58);};}exports[_0x76ae('0x2c')]=function(_0x1e5c3f,_0xb924aa){var _0xa9b28d={},_0x36075a={},_0x1aecdf={'count':0x0,'rows':[]};var _0x45e1c6=_[_0x76ae('0x2d')](db[_0x76ae('0x2e')][_0x76ae('0x2f')],function(_0x407118){return{'name':_0x407118[_0x76ae('0x30')],'type':_0x407118[_0x76ae('0x31')][_0x76ae('0x32')]};});_0x36075a[_0x76ae('0x33')]=_[_0x76ae('0x2d')](_0x45e1c6,_0x76ae('0x2b'));_0x36075a['query']=_['keys'](_0x1e5c3f[_0x76ae('0x34')]);_0x36075a[_0x76ae('0x35')]=_['intersection'](_0x36075a[_0x76ae('0x33')],_0x36075a[_0x76ae('0x34')]);_0xa9b28d[_0x76ae('0x36')]=_[_0x76ae('0x37')](_0x36075a[_0x76ae('0x33')],qs[_0x76ae('0x38')](_0x1e5c3f['query'][_0x76ae('0x38')]));_0xa9b28d[_0x76ae('0x36')]=_0xa9b28d[_0x76ae('0x36')][_0x76ae('0x39')]?_0xa9b28d[_0x76ae('0x36')]:_0x36075a[_0x76ae('0x33')];if(!_0x1e5c3f[_0x76ae('0x34')][_0x76ae('0x3a')](_0x76ae('0x3b'))){_0xa9b28d['limit']=qs['limit'](_0x1e5c3f[_0x76ae('0x34')]['limit']);_0xa9b28d[_0x76ae('0x1d')]=qs[_0x76ae('0x1d')](_0x1e5c3f['query'][_0x76ae('0x1d')]);}_0xa9b28d['order']=qs[_0x76ae('0x3c')](_0x1e5c3f[_0x76ae('0x34')]['sort']);_0xa9b28d[_0x76ae('0x3d')]=qs['filters'](_['pick'](_0x1e5c3f[_0x76ae('0x34')],_0x36075a[_0x76ae('0x35')]),_0x45e1c6);if(_0x1e5c3f['query'][_0x76ae('0x3e')]){_0xa9b28d[_0x76ae('0x3d')]=_[_0x76ae('0x3f')](_0xa9b28d[_0x76ae('0x3d')],{'$or':_[_0x76ae('0x2d')](_0x45e1c6,function(_0x579db0){if(_0x579db0['type']!=='VIRTUAL'){var _0x1dad6f={};_0x1dad6f[_0x579db0['name']]={'$like':'%'+_0x1e5c3f[_0x76ae('0x34')][_0x76ae('0x3e')]+'%'};return _0x1dad6f;}})});}_0xa9b28d=_[_0x76ae('0x3f')]({},_0xa9b28d,_0x1e5c3f[_0x76ae('0x40')]);var _0x49e4eb={'where':_0xa9b28d[_0x76ae('0x3d')]};return db[_0x76ae('0x2e')]['count'](_0x49e4eb)[_0x76ae('0x26')](function(_0x5eafd2){_0x1aecdf[_0x76ae('0x20')]=_0x5eafd2;if(_0x1e5c3f[_0x76ae('0x34')][_0x76ae('0x41')]){_0xa9b28d[_0x76ae('0x42')]=[{'all':!![]}];}return db[_0x76ae('0x2e')][_0x76ae('0x43')](_0xa9b28d);})[_0x76ae('0x26')](function(_0xb19cb3){_0x1aecdf['rows']=_0xb19cb3;return _0x1aecdf;})[_0x76ae('0x26')](respondWithFilteredResult(_0xb924aa,_0xa9b28d))[_0x76ae('0x44')](handleError(_0xb924aa,null));};exports[_0x76ae('0x45')]=function(_0x43f8d3,_0x5f2220){var _0x360ee8={'raw':!![],'where':{'id':_0x43f8d3[_0x76ae('0x46')]['id']}},_0x3dfef8={};_0x3dfef8['model']=_[_0x76ae('0x47')](db['OpenchannelApplication'][_0x76ae('0x2f')]);_0x3dfef8[_0x76ae('0x34')]=_[_0x76ae('0x47')](_0x43f8d3[_0x76ae('0x34')]);_0x3dfef8[_0x76ae('0x35')]=_[_0x76ae('0x37')](_0x3dfef8['model'],_0x3dfef8[_0x76ae('0x34')]);_0x360ee8[_0x76ae('0x36')]=_['intersection'](_0x3dfef8[_0x76ae('0x33')],qs[_0x76ae('0x38')](_0x43f8d3[_0x76ae('0x34')][_0x76ae('0x38')]));_0x360ee8['attributes']=_0x360ee8['attributes'][_0x76ae('0x39')]?_0x360ee8[_0x76ae('0x36')]:_0x3dfef8[_0x76ae('0x33')];if(_0x43f8d3['query'][_0x76ae('0x41')]){_0x360ee8[_0x76ae('0x42')]=[{'all':!![]}];}_0x360ee8=_[_0x76ae('0x3f')]({},_0x360ee8,_0x43f8d3['options']);return db['OpenchannelApplication'][_0x76ae('0x48')](_0x360ee8)[_0x76ae('0x26')](handleEntityNotFound(_0x5f2220,null))[_0x76ae('0x26')](respondWithResult(_0x5f2220,null))[_0x76ae('0x44')](handleError(_0x5f2220,null));};exports[_0x76ae('0x49')]=function(_0xeeffa8,_0x1294d0){return db[_0x76ae('0x2e')][_0x76ae('0x49')](_0xeeffa8[_0x76ae('0x4a')],{})[_0x76ae('0x26')](respondWithResult(_0x1294d0,0xc9))[_0x76ae('0x44')](handleError(_0x1294d0,null));};exports[_0x76ae('0x25')]=function(_0xbd728f,_0x389f06){if(_0xbd728f[_0x76ae('0x4a')]['id']){delete _0xbd728f[_0x76ae('0x4a')]['id'];}return db[_0x76ae('0x2e')][_0x76ae('0x48')]({'where':{'id':_0xbd728f[_0x76ae('0x46')]['id']}})[_0x76ae('0x26')](handleEntityNotFound(_0x389f06,null))[_0x76ae('0x26')](saveUpdates(_0xbd728f[_0x76ae('0x4a')],null))['then'](respondWithResult(_0x389f06,null))[_0x76ae('0x44')](handleError(_0x389f06,null));};exports['destroy']=function(_0x29bf6e,_0x1c191a){return db['OpenchannelApplication'][_0x76ae('0x48')]({'where':{'id':_0x29bf6e[_0x76ae('0x46')]['id']}})[_0x76ae('0x26')](handleEntityNotFound(_0x1c191a,null))[_0x76ae('0x26')](removeEntity(_0x1c191a,null))[_0x76ae('0x44')](handleError(_0x1c191a,null));}; \ No newline at end of file +var _0xeab7=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','model'];(function(_0xa06c99,_0x5a4d67){var _0x1e3e32=function(_0x4cc3e8){while(--_0x4cc3e8){_0xa06c99['push'](_0xa06c99['shift']());}};_0x1e3e32(++_0x5a4d67);}(_0xeab7,0x187));var _0x7eab=function(_0x163f34,_0x1222c6){_0x163f34=_0x163f34-0x0;var _0xe3975b=_0xeab7[_0x163f34];return _0xe3975b;};'use strict';var emlformat=require(_0x7eab('0x0'));var rimraf=require(_0x7eab('0x1'));var zipdir=require(_0x7eab('0x2'));var jsonpatch=require(_0x7eab('0x3'));var rp=require('request-promise');var moment=require(_0x7eab('0x4'));var BPromise=require(_0x7eab('0x5'));var Mustache=require(_0x7eab('0x6'));var util=require('util');var path=require(_0x7eab('0x7'));var sox=require('sox');var csv=require(_0x7eab('0x8'));var ejs=require(_0x7eab('0x9'));var fs=require('fs');var fs_extra=require(_0x7eab('0xa'));var _=require(_0x7eab('0xb'));var squel=require(_0x7eab('0xc'));var crypto=require(_0x7eab('0xd'));var jsforce=require(_0x7eab('0xe'));var deskjs=require(_0x7eab('0xf'));var toCsv=require(_0x7eab('0x8'));var querystring=require(_0x7eab('0x10'));var Papa=require(_0x7eab('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7eab('0x12'));var logger=require('../../config/logger')(_0x7eab('0x13'));var utils=require(_0x7eab('0x14'));var config=require(_0x7eab('0x15'));var licenseUtil=require(_0x7eab('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dd3df,_0x50a102){_0x50a102=_0x50a102||0xcc;return function(_0x3479be){if(_0x3479be){return _0x5dd3df['sendStatus'](_0x50a102);}return _0x5dd3df[_0x7eab('0x17')](_0x50a102)[_0x7eab('0x18')]();};}function respondWithResult(_0x33e9ac,_0xcdcbc5){_0xcdcbc5=_0xcdcbc5||0xc8;return function(_0x1041df){if(_0x1041df){return _0x33e9ac[_0x7eab('0x17')](_0xcdcbc5)[_0x7eab('0x19')](_0x1041df);}};}function respondWithFilteredResult(_0x3bb069,_0x3de6f6){return function(_0x27f24f){if(_0x27f24f){var _0x2a9368=typeof _0x3de6f6[_0x7eab('0x1a')]===_0x7eab('0x1b')&&typeof _0x3de6f6[_0x7eab('0x1c')]===_0x7eab('0x1b');var _0x6d3d7a=_0x27f24f['count'];var _0x448735=_0x2a9368?0x0:_0x3de6f6[_0x7eab('0x1a')];var _0x17c6e8=_0x2a9368?_0x27f24f[_0x7eab('0x1d')]:_0x3de6f6[_0x7eab('0x1a')]+_0x3de6f6[_0x7eab('0x1c')];var _0x2c3105;if(_0x17c6e8>=_0x6d3d7a){_0x17c6e8=_0x6d3d7a;_0x2c3105=0xc8;}else{_0x2c3105=0xce;}_0x3bb069[_0x7eab('0x17')](_0x2c3105);return _0x3bb069[_0x7eab('0x1e')](_0x7eab('0x1f'),_0x448735+'-'+_0x17c6e8+'/'+_0x6d3d7a)[_0x7eab('0x19')](_0x27f24f);}return null;};}function patchUpdates(_0x44290f){return function(_0x622c4c){try{jsonpatch['apply'](_0x622c4c,_0x44290f,!![]);}catch(_0x416652){return BPromise['reject'](_0x416652);}return _0x622c4c['save']();};}function saveUpdates(_0x40235e,_0x4b3911){return function(_0x34051b){if(_0x34051b){return _0x34051b[_0x7eab('0x20')](_0x40235e)[_0x7eab('0x21')](function(_0x3d88e8){return _0x3d88e8;});}return null;};}function removeEntity(_0x15b39b,_0x490a19){return function(_0x5ed664){if(_0x5ed664){return _0x5ed664[_0x7eab('0x22')]()['then'](function(){_0x15b39b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x420b98,_0x124248){return function(_0x44d9cf){if(!_0x44d9cf){_0x420b98[_0x7eab('0x23')](0x194);}return _0x44d9cf;};}function handleError(_0x3bacc1,_0x503893){_0x503893=_0x503893||0x1f4;return function(_0x207645){logger[_0x7eab('0x24')](_0x207645[_0x7eab('0x25')]);if(_0x207645['name']){delete _0x207645[_0x7eab('0x26')];}_0x3bacc1[_0x7eab('0x17')](_0x503893)[_0x7eab('0x27')](_0x207645);};}exports[_0x7eab('0x28')]=function(_0x4f6ac3,_0x2d4ea4){var _0x4453f7={},_0x5dc914={},_0x1644be={'count':0x0,'rows':[]};var _0xcc2833=_[_0x7eab('0x29')](db[_0x7eab('0x2a')][_0x7eab('0x2b')],function(_0x59efb1){return{'name':_0x59efb1['fieldName'],'type':_0x59efb1[_0x7eab('0x2c')][_0x7eab('0x2d')]};});_0x5dc914[_0x7eab('0x2e')]=_[_0x7eab('0x29')](_0xcc2833,_0x7eab('0x26'));_0x5dc914[_0x7eab('0x2f')]=_[_0x7eab('0x30')](_0x4f6ac3[_0x7eab('0x2f')]);_0x5dc914['filters']=_[_0x7eab('0x31')](_0x5dc914[_0x7eab('0x2e')],_0x5dc914[_0x7eab('0x2f')]);_0x4453f7[_0x7eab('0x32')]=_[_0x7eab('0x31')](_0x5dc914[_0x7eab('0x2e')],qs[_0x7eab('0x33')](_0x4f6ac3[_0x7eab('0x2f')][_0x7eab('0x33')]));_0x4453f7['attributes']=_0x4453f7[_0x7eab('0x32')][_0x7eab('0x34')]?_0x4453f7[_0x7eab('0x32')]:_0x5dc914[_0x7eab('0x2e')];if(!_0x4f6ac3['query'][_0x7eab('0x35')](_0x7eab('0x36'))){_0x4453f7[_0x7eab('0x1c')]=qs[_0x7eab('0x1c')](_0x4f6ac3['query'][_0x7eab('0x1c')]);_0x4453f7[_0x7eab('0x1a')]=qs[_0x7eab('0x1a')](_0x4f6ac3[_0x7eab('0x2f')][_0x7eab('0x1a')]);}_0x4453f7['order']=qs[_0x7eab('0x37')](_0x4f6ac3[_0x7eab('0x2f')][_0x7eab('0x37')]);_0x4453f7[_0x7eab('0x38')]=qs[_0x7eab('0x39')](_[_0x7eab('0x3a')](_0x4f6ac3[_0x7eab('0x2f')],_0x5dc914[_0x7eab('0x39')]),_0xcc2833);if(_0x4f6ac3[_0x7eab('0x2f')][_0x7eab('0x3b')]){_0x4453f7[_0x7eab('0x38')]=_[_0x7eab('0x3c')](_0x4453f7[_0x7eab('0x38')],{'$or':_[_0x7eab('0x29')](_0xcc2833,function(_0x232082){if(_0x232082[_0x7eab('0x2c')]!==_0x7eab('0x3d')){var _0x10fe68={};_0x10fe68[_0x232082[_0x7eab('0x26')]]={'$like':'%'+_0x4f6ac3['query'][_0x7eab('0x3b')]+'%'};return _0x10fe68;}})});}_0x4453f7=_[_0x7eab('0x3c')]({},_0x4453f7,_0x4f6ac3[_0x7eab('0x3e')]);var _0x3bce1e={'where':_0x4453f7['where']};return db[_0x7eab('0x2a')][_0x7eab('0x1d')](_0x3bce1e)[_0x7eab('0x21')](function(_0x1d3c09){_0x1644be['count']=_0x1d3c09;if(_0x4f6ac3[_0x7eab('0x2f')][_0x7eab('0x3f')]){_0x4453f7[_0x7eab('0x40')]=[{'all':!![]}];}return db[_0x7eab('0x2a')][_0x7eab('0x41')](_0x4453f7);})[_0x7eab('0x21')](function(_0x5c4f73){_0x1644be[_0x7eab('0x42')]=_0x5c4f73;return _0x1644be;})[_0x7eab('0x21')](respondWithFilteredResult(_0x2d4ea4,_0x4453f7))[_0x7eab('0x43')](handleError(_0x2d4ea4,null));};exports[_0x7eab('0x44')]=function(_0x3943f9,_0x895382){var _0x36af32={'raw':!![],'where':{'id':_0x3943f9[_0x7eab('0x45')]['id']}},_0x5325ea={};_0x5325ea['model']=_[_0x7eab('0x30')](db[_0x7eab('0x2a')]['rawAttributes']);_0x5325ea['query']=_[_0x7eab('0x30')](_0x3943f9['query']);_0x5325ea[_0x7eab('0x39')]=_[_0x7eab('0x31')](_0x5325ea[_0x7eab('0x2e')],_0x5325ea['query']);_0x36af32[_0x7eab('0x32')]=_[_0x7eab('0x31')](_0x5325ea[_0x7eab('0x2e')],qs[_0x7eab('0x33')](_0x3943f9[_0x7eab('0x2f')][_0x7eab('0x33')]));_0x36af32[_0x7eab('0x32')]=_0x36af32[_0x7eab('0x32')][_0x7eab('0x34')]?_0x36af32[_0x7eab('0x32')]:_0x5325ea[_0x7eab('0x2e')];if(_0x3943f9['query'][_0x7eab('0x3f')]){_0x36af32[_0x7eab('0x40')]=[{'all':!![]}];}_0x36af32=_[_0x7eab('0x3c')]({},_0x36af32,_0x3943f9[_0x7eab('0x3e')]);return db[_0x7eab('0x2a')][_0x7eab('0x46')](_0x36af32)[_0x7eab('0x21')](handleEntityNotFound(_0x895382,null))['then'](respondWithResult(_0x895382,null))[_0x7eab('0x43')](handleError(_0x895382,null));};exports[_0x7eab('0x47')]=function(_0x4b97d4,_0x506753){return db[_0x7eab('0x2a')][_0x7eab('0x47')](_0x4b97d4[_0x7eab('0x48')],{})[_0x7eab('0x21')](respondWithResult(_0x506753,0xc9))[_0x7eab('0x43')](handleError(_0x506753,null));};exports['update']=function(_0x1dbd61,_0xaa103c){if(_0x1dbd61[_0x7eab('0x48')]['id']){delete _0x1dbd61[_0x7eab('0x48')]['id'];}return db[_0x7eab('0x2a')]['find']({'where':{'id':_0x1dbd61[_0x7eab('0x45')]['id']}})[_0x7eab('0x21')](handleEntityNotFound(_0xaa103c,null))[_0x7eab('0x21')](saveUpdates(_0x1dbd61[_0x7eab('0x48')],null))[_0x7eab('0x21')](respondWithResult(_0xaa103c,null))[_0x7eab('0x43')](handleError(_0xaa103c,null));};exports[_0x7eab('0x22')]=function(_0x364b85,_0x51bc78){return db[_0x7eab('0x2a')][_0x7eab('0x46')]({'where':{'id':_0x364b85[_0x7eab('0x45')]['id']}})[_0x7eab('0x21')](handleEntityNotFound(_0x51bc78,null))[_0x7eab('0x21')](removeEntity(_0x51bc78,null))['catch'](handleError(_0x51bc78,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index bce601c..d037460 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 _0xe0eb=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x3c6ed6,_0x485148){var _0x3a97aa=function(_0x1c8bfa){while(--_0x1c8bfa){_0x3c6ed6['push'](_0x3c6ed6['shift']());}};_0x3a97aa(++_0x485148);}(_0xe0eb,0x1b0));var _0xbe0e=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0xe0eb[_0x1ab180];return _0xfb2c2d;};'use strict';var _=require(_0xbe0e('0x0'));var util=require(_0xbe0e('0x1'));var logger=require(_0xbe0e('0x2'))(_0xbe0e('0x3'));var moment=require(_0xbe0e('0x4'));var BPromise=require(_0xbe0e('0x5'));var rp=require(_0xbe0e('0x6'));var fs=require('fs');var path=require(_0xbe0e('0x7'));var rimraf=require(_0xbe0e('0x8'));var config=require(_0xbe0e('0x9'));var attributes=require(_0xbe0e('0xa'));module[_0xbe0e('0xb')]=function(_0x129efd,_0x41182f){return _0x129efd[_0xbe0e('0xc')]('OpenchannelApplication',attributes,{'tableName':_0xbe0e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe0e('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3adc=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x3b5964,_0x2f21c4){var _0xbc8296=function(_0x1f0789){while(--_0x1f0789){_0x3b5964['push'](_0x3b5964['shift']());}};_0xbc8296(++_0x2f21c4);}(_0x3adc,0x1a5));var _0xc3ad=function(_0x436b03,_0x3d9bf0){_0x436b03=_0x436b03-0x0;var _0x38103f=_0x3adc[_0x436b03];return _0x38103f;};'use strict';var _=require(_0xc3ad('0x0'));var util=require(_0xc3ad('0x1'));var logger=require(_0xc3ad('0x2'))(_0xc3ad('0x3'));var moment=require(_0xc3ad('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3ad('0x5'));var fs=require('fs');var path=require(_0xc3ad('0x6'));var rimraf=require(_0xc3ad('0x7'));var config=require(_0xc3ad('0x8'));var attributes=require(_0xc3ad('0x9'));module['exports']=function(_0x2b4b46,_0x57f037){return _0x2b4b46[_0xc3ad('0xa')](_0xc3ad('0xb'),attributes,{'tableName':_0xc3ad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc3ad('0xd'),'collate':_0xc3ad('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 3bb2b02..ed55863 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 _0x78a8=['update','body','options','raw','where','attributes','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','UpdateOpenchannelApplication'];(function(_0x50365c,_0x3c0c8b){var _0x330f1e=function(_0x41ad0d){while(--_0x41ad0d){_0x50365c['push'](_0x50365c['shift']());}};_0x330f1e(++_0x3c0c8b);}(_0x78a8,0x1b7));var _0x878a=function(_0x4f123e,_0x10e145){_0x4f123e=_0x4f123e-0x0;var _0xdd2b90=_0x78a8[_0x4f123e];return _0xdd2b90;};'use strict';var _=require(_0x878a('0x0'));var util=require('util');var moment=require(_0x878a('0x1'));var BPromise=require(_0x878a('0x2'));var rs=require(_0x878a('0x3'));var fs=require('fs');var Redis=require(_0x878a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x878a('0x5'));var logger=require(_0x878a('0x6'))(_0x878a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x878a('0x8')][_0x878a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f3eb6,_0x1aa22c,_0x5a34f7){return new BPromise(function(_0x2ee23f,_0x718da){return client['request'](_0x5f3eb6,_0x5a34f7)[_0x878a('0xa')](function(_0x2aa2c3){logger['info'](_0x878a('0xb'),_0x1aa22c,_0x878a('0xc'));logger[_0x878a('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x1aa22c,_0x878a('0xc'),JSON[_0x878a('0xe')](_0x2aa2c3));if(_0x2aa2c3[_0x878a('0xf')]){if(_0x2aa2c3[_0x878a('0xf')][_0x878a('0x10')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x1aa22c,_0x2aa2c3[_0x878a('0xf')][_0x878a('0x11')]);return _0x718da(_0x2aa2c3[_0x878a('0xf')][_0x878a('0x11')]);}logger[_0x878a('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x1aa22c,_0x2aa2c3[_0x878a('0xf')][_0x878a('0x11')]);return _0x2ee23f(_0x2aa2c3['error'][_0x878a('0x11')]);}else{logger[_0x878a('0x12')](_0x878a('0xb'),_0x1aa22c,_0x878a('0xc'));_0x2ee23f(_0x2aa2c3['result']['message']);}})['catch'](function(_0x151626){logger[_0x878a('0xf')](_0x878a('0xb'),_0x1aa22c,_0x151626);_0x718da(_0x151626);});});}exports[_0x878a('0x13')]=function(_0x1856a7){var _0x511d01=this;return new Promise(function(_0x3b952c,_0xd6b073){return db['OpenchannelApplication'][_0x878a('0x14')](_0x1856a7[_0x878a('0x15')],{'raw':_0x1856a7['options']?_0x1856a7[_0x878a('0x16')][_0x878a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1856a7[_0x878a('0x16')]?_0x1856a7[_0x878a('0x16')][_0x878a('0x18')]||null:null,'attributes':_0x1856a7[_0x878a('0x16')]?_0x1856a7['options'][_0x878a('0x19')]||null:null,'limit':_0x1856a7['options']?_0x1856a7[_0x878a('0x16')]['limit']||null:null})[_0x878a('0xa')](function(_0x1306d1){logger['info'](_0x878a('0x13'),_0x1856a7);logger[_0x878a('0xd')]('UpdateOpenchannelApplication',_0x1856a7,JSON[_0x878a('0xe')](_0x1306d1));_0x3b952c(_0x1306d1);})[_0x878a('0x1a')](function(_0x4a3be0){logger[_0x878a('0xf')](_0x878a('0x13'),_0x4a3be0['message'],_0x1856a7);_0xd6b073(_0x511d01[_0x878a('0xf')](0x1f4,_0x4a3be0[_0x878a('0x11')]));});});}; \ No newline at end of file +var _0xad12=['attributes','limit','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xad12,0xbe));var _0x2ad1=function(_0x153b7f,_0x56e5a3){_0x153b7f=_0x153b7f-0x0;var _0x117b80=_0xad12[_0x153b7f];return _0x117b80;};'use strict';var _=require(_0x2ad1('0x0'));var util=require(_0x2ad1('0x1'));var moment=require('moment');var BPromise=require(_0x2ad1('0x2'));var rs=require(_0x2ad1('0x3'));var fs=require('fs');var Redis=require(_0x2ad1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2ad1('0x5'))(_0x2ad1('0x6'));var config=require(_0x2ad1('0x7'));var jayson=require(_0x2ad1('0x8'));var client=jayson[_0x2ad1('0x9')][_0x2ad1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x575b05,_0x3afe80,_0x5520ce){return new BPromise(function(_0x197101,_0x167a81){return client['request'](_0x575b05,_0x5520ce)[_0x2ad1('0xb')](function(_0x4c9acb){logger[_0x2ad1('0xc')](_0x2ad1('0xd'),_0x3afe80,_0x2ad1('0xe'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x3afe80,_0x2ad1('0xe'),JSON['stringify'](_0x4c9acb));if(_0x4c9acb[_0x2ad1('0xf')]){if(_0x4c9acb['error'][_0x2ad1('0x10')]===0x1f4){logger[_0x2ad1('0xf')](_0x2ad1('0xd'),_0x3afe80,_0x4c9acb[_0x2ad1('0xf')][_0x2ad1('0x11')]);return _0x167a81(_0x4c9acb[_0x2ad1('0xf')][_0x2ad1('0x11')]);}logger['error'](_0x2ad1('0xd'),_0x3afe80,_0x4c9acb[_0x2ad1('0xf')][_0x2ad1('0x11')]);return _0x197101(_0x4c9acb[_0x2ad1('0xf')][_0x2ad1('0x11')]);}else{logger['info'](_0x2ad1('0xd'),_0x3afe80,_0x2ad1('0xe'));_0x197101(_0x4c9acb[_0x2ad1('0x12')][_0x2ad1('0x11')]);}})[_0x2ad1('0x13')](function(_0xb5bad3){logger[_0x2ad1('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x3afe80,_0xb5bad3);_0x167a81(_0xb5bad3);});});}exports[_0x2ad1('0x14')]=function(_0x6a1ef5){var _0x244012=this;return new Promise(function(_0x16e3b0,_0xdc3df3){return db[_0x2ad1('0x15')][_0x2ad1('0x16')](_0x6a1ef5[_0x2ad1('0x17')],{'raw':_0x6a1ef5[_0x2ad1('0x18')]?_0x6a1ef5['options'][_0x2ad1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6a1ef5[_0x2ad1('0x18')]?_0x6a1ef5['options'][_0x2ad1('0x1a')]||null:null,'attributes':_0x6a1ef5[_0x2ad1('0x18')]?_0x6a1ef5[_0x2ad1('0x18')][_0x2ad1('0x1b')]||null:null,'limit':_0x6a1ef5[_0x2ad1('0x18')]?_0x6a1ef5['options'][_0x2ad1('0x1c')]||null:null})[_0x2ad1('0xb')](function(_0xe81b22){logger['info'](_0x2ad1('0x14'),_0x6a1ef5);logger[_0x2ad1('0x1d')](_0x2ad1('0x14'),_0x6a1ef5,JSON[_0x2ad1('0x1e')](_0xe81b22));_0x16e3b0(_0xe81b22);})[_0x2ad1('0x13')](function(_0x1c6e43){logger[_0x2ad1('0xf')](_0x2ad1('0x14'),_0x1c6e43[_0x2ad1('0x11')],_0x6a1ef5);_0xdc3df3(_0x244012['error'](0x1f4,_0x1c6e43[_0x2ad1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 9bf92e0..c556cf4 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 _0x4cd3=['addTags','put','openchannelinteraction:update','update','destroy','delete','removeTags','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','isAuthenticated','/:id','show','/:id/messages','getMessages','get','/:id/download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags'];(function(_0x5252b8,_0x56e845){var _0x14bb8e=function(_0x33eaa1){while(--_0x33eaa1){_0x5252b8['push'](_0x5252b8['shift']());}};_0x14bb8e(++_0x56e845);}(_0x4cd3,0x164));var _0x34cd=function(_0x2055a7,_0x415a4c){_0x2055a7=_0x2055a7-0x0;var _0x42a14d=_0x4cd3[_0x2055a7];return _0x42a14d;};'use strict';var multer=require(_0x34cd('0x0'));var util=require(_0x34cd('0x1'));var path=require(_0x34cd('0x2'));var timeout=require('connect-timeout');var express=require(_0x34cd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x34cd('0x4'));var interaction=require(_0x34cd('0x5'));var config=require('../../config/environment');var controller=require(_0x34cd('0x6'));router['get']('/',auth[_0x34cd('0x7')](),controller['index']);router['get']('/describe',auth[_0x34cd('0x7')](),controller['describe']);router['get'](_0x34cd('0x8'),auth[_0x34cd('0x7')](),controller[_0x34cd('0x9')]);router['get'](_0x34cd('0xa'),auth[_0x34cd('0x7')](),controller[_0x34cd('0xb')]);router[_0x34cd('0xc')](_0x34cd('0xd'),auth[_0x34cd('0x7')](),controller['download']);router['post']('/',auth[_0x34cd('0x7')](),controller[_0x34cd('0xe')]);router[_0x34cd('0xf')]('/:id/messages',auth[_0x34cd('0x7')](),controller[_0x34cd('0x10')]);router[_0x34cd('0xf')](_0x34cd('0x11'),auth[_0x34cd('0x7')](),interaction[_0x34cd('0x12')](_0x34cd('0x13'),_0x34cd('0x14')),controller[_0x34cd('0x15')]);router[_0x34cd('0x16')]('/:id',auth[_0x34cd('0x7')](),interaction[_0x34cd('0x12')](_0x34cd('0x13'),_0x34cd('0x17')),controller[_0x34cd('0x18')]);router['delete'](_0x34cd('0x8'),auth[_0x34cd('0x7')](),interaction[_0x34cd('0x12')](_0x34cd('0x13'),'openchannelinteraction:destroy'),controller[_0x34cd('0x19')]);router[_0x34cd('0x1a')](_0x34cd('0x11'),auth[_0x34cd('0x7')](),controller[_0x34cd('0x1b')]);module[_0x34cd('0x1c')]=router; \ No newline at end of file +var _0x8d72=['addTags','put','tracked','openchannelinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','openchannel','openchannelinteraction:addtags'];(function(_0x3d7aa1,_0x14c003){var _0x2add27=function(_0x6938c){while(--_0x6938c){_0x3d7aa1['push'](_0x3d7aa1['shift']());}};_0x2add27(++_0x14c003);}(_0x8d72,0x1e6));var _0x28d7=function(_0x117754,_0x558cf0){_0x117754=_0x117754-0x0;var _0x5b71ab=_0x8d72[_0x117754];return _0x5b71ab;};'use strict';var multer=require(_0x28d7('0x0'));var util=require(_0x28d7('0x1'));var path=require(_0x28d7('0x2'));var timeout=require('connect-timeout');var express=require(_0x28d7('0x3'));var router=express[_0x28d7('0x4')]();var fs_extra=require(_0x28d7('0x5'));var auth=require(_0x28d7('0x6'));var interaction=require(_0x28d7('0x7'));var config=require(_0x28d7('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x28d7('0x9')]('/',auth['isAuthenticated'](),controller[_0x28d7('0xa')]);router[_0x28d7('0x9')](_0x28d7('0xb'),auth[_0x28d7('0xc')](),controller[_0x28d7('0xd')]);router[_0x28d7('0x9')](_0x28d7('0xe'),auth[_0x28d7('0xc')](),controller[_0x28d7('0xf')]);router[_0x28d7('0x9')](_0x28d7('0x10'),auth['isAuthenticated'](),controller[_0x28d7('0x11')]);router[_0x28d7('0x9')](_0x28d7('0x12'),auth[_0x28d7('0xc')](),controller[_0x28d7('0x13')]);router['post']('/',auth[_0x28d7('0xc')](),controller[_0x28d7('0x14')]);router['post'](_0x28d7('0x10'),auth[_0x28d7('0xc')](),controller['addMessage']);router[_0x28d7('0x15')]('/:id/tags',auth[_0x28d7('0xc')](),interaction['tracked'](_0x28d7('0x16'),_0x28d7('0x17')),controller[_0x28d7('0x18')]);router[_0x28d7('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x28d7('0x1a')](_0x28d7('0x16'),_0x28d7('0x1b')),controller[_0x28d7('0x1c')]);router[_0x28d7('0x1d')](_0x28d7('0xe'),auth[_0x28d7('0xc')](),interaction[_0x28d7('0x1a')]('openchannel','openchannelinteraction:destroy'),controller[_0x28d7('0x1e')]);router[_0x28d7('0x1d')](_0x28d7('0x1f'),auth[_0x28d7('0xc')](),controller[_0x28d7('0x20')]);module[_0x28d7('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 91a9b4d..a2ee663 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 _0x6de9=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','exports'];(function(_0x243673,_0x4e8204){var _0x104dc8=function(_0x2db77e){while(--_0x2db77e){_0x243673['push'](_0x243673['shift']());}};_0x104dc8(++_0x4e8204);}(_0x6de9,0xe6));var _0x96de=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6de9[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x96de('0x0'));module[_0x96de('0x1')]={'closed':{'type':Sequelize[_0x96de('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x96de('0x3')]},'disposition':{'type':Sequelize[_0x96de('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x96de('0x4')]},'note':{'type':Sequelize[_0x96de('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x96de('0x4')]},'externalUrl':{'type':Sequelize[_0x96de('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x96de('0x5')]('in',_0x96de('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x96de('0x5')]('in',_0x96de('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x96de('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x96de('0x7')]}}; \ No newline at end of file +var _0x9d86=['STRING','ENUM','out','BOOLEAN','INTEGER','sequelize','DATE'];(function(_0x5d0bae,_0x147e4d){var _0x1dd9e8=function(_0x40985b){while(--_0x40985b){_0x5d0bae['push'](_0x5d0bae['shift']());}};_0x1dd9e8(++_0x147e4d);}(_0x9d86,0xbb));var _0x69d8=function(_0x2bfce0,_0x554be2){_0x2bfce0=_0x2bfce0-0x0;var _0x37d45b=_0x9d86[_0x2bfce0];return _0x37d45b;};'use strict';var Sequelize=require(_0x69d8('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x69d8('0x1')]},'disposition':{'type':Sequelize[_0x69d8('0x2')]},'secondDisposition':{'type':Sequelize[_0x69d8('0x2')]},'thirdDisposition':{'type':Sequelize[_0x69d8('0x2')]},'note':{'type':Sequelize[_0x69d8('0x2')]},'read1stAt':{'type':Sequelize[_0x69d8('0x1')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x69d8('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x69d8('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x69d8('0x3')]('in',_0x69d8('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x69d8('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x69d8('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index b8acc13..aee5ea4 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 _0x2ace=['Tag','emit','openchannelInteractionTags:save','removeTags','unix','join','root','server','files','attachments','User','fullname','push','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','toString','closed','disposition','Public','Private','basename','createReadStream','pipe','createWriteStream','out','Contact','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','getOptions','openchannel','query','user','show','params','keys','OpenchannelInteraction','filters','model','fields','attributes','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','intersection','hasOwnProperty','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags'];(function(_0x169330,_0x56df88){var _0x3c91f8=function(_0x360b24){while(--_0x360b24){_0x169330['push'](_0x169330['shift']());}};_0x3c91f8(++_0x56df88);}(_0x2ace,0xb3));var _0xe2ac=function(_0x1ffd67,_0x1c18ba){_0x1ffd67=_0x1ffd67-0x0;var _0xce170f=_0x2ace[_0x1ffd67];return _0xce170f;};'use strict';var rimraf=require(_0xe2ac('0x0'));var zipdir=require(_0xe2ac('0x1'));var moment=require('moment');var util=require(_0xe2ac('0x2'));var path=require(_0xe2ac('0x3'));var ejs=require(_0xe2ac('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xe2ac('0x5'));var interaction=require(_0xe2ac('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0xe2ac('0x7'));var logger=require(_0xe2ac('0x8'))(_0xe2ac('0x9'));var config=require(_0xe2ac('0xa'));var db=require(_0xe2ac('0xb'))['db'];config[_0xe2ac('0xc')]=_[_0xe2ac('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe2ac('0xe'))(new Redis(config[_0xe2ac('0xc')]));require(_0xe2ac('0xf'))[_0xe2ac('0x10')](socket);function respondWithStatusCode(_0x42739d,_0x3afa2b){_0x3afa2b=_0x3afa2b||0xcc;return function(_0x193805){if(_0x193805){return _0x42739d[_0xe2ac('0x11')](_0x3afa2b);}return _0x42739d[_0xe2ac('0x12')](_0x3afa2b)[_0xe2ac('0x13')]();};}function respondWithResult(_0x70af91,_0xdde4a1){_0xdde4a1=_0xdde4a1||0xc8;return function(_0x2fe5d3){if(_0x2fe5d3){return _0x70af91['status'](_0xdde4a1)[_0xe2ac('0x14')](_0x2fe5d3);}};}function respondWithFilteredResult(_0x283f72,_0x349a98){return function(_0x508ada){if(_0x508ada){var _0x484b43=typeof _0x349a98[_0xe2ac('0x15')]===_0xe2ac('0x16')&&typeof _0x349a98['limit']===_0xe2ac('0x16');var _0x92d4c3=_0x508ada[_0xe2ac('0x17')];var _0x420213=_0x484b43?0x0:_0x349a98[_0xe2ac('0x15')];var _0x449996=_0x484b43?_0x508ada[_0xe2ac('0x17')]:_0x349a98[_0xe2ac('0x15')]+_0x349a98[_0xe2ac('0x18')];var _0x3c26e7;if(_0x449996>=_0x92d4c3){_0x449996=_0x92d4c3;_0x3c26e7=0xc8;}else{_0x3c26e7=0xce;}_0x283f72[_0xe2ac('0x12')](_0x3c26e7);return _0x283f72[_0xe2ac('0x19')](_0xe2ac('0x1a'),_0x420213+'-'+_0x449996+'/'+_0x92d4c3)[_0xe2ac('0x14')](_0x508ada);}return null;};}function saveUpdates(_0x359322){return function(_0x1f57bd){if(_0x1f57bd){return _0x1f57bd[_0xe2ac('0x1b')](_0x359322)[_0xe2ac('0x1c')](function(_0x2d0a4f){return _0x2d0a4f;});}return null;};}function removeEntity(_0x1a23fd){return function(_0x113174){if(_0x113174){return _0x113174[_0xe2ac('0x1d')]()[_0xe2ac('0x1c')](function(){_0x1a23fd[_0xe2ac('0x12')](0xcc)[_0xe2ac('0x13')]();});}};}function handleEntityNotFound(_0x42617a){return function(_0xfe9e65){if(!_0xfe9e65){_0x42617a[_0xe2ac('0x11')](0x194);}return _0xfe9e65;};}function handleError(_0x7a1388,_0x57903c){_0x57903c=_0x57903c||0x1f4;return function(_0x4a1dd6){logger[_0xe2ac('0x1e')](_0x4a1dd6[_0xe2ac('0x1f')]);if(_0x4a1dd6[_0xe2ac('0x20')]){delete _0x4a1dd6['name'];}_0x7a1388['status'](_0x57903c)[_0xe2ac('0x21')](_0x4a1dd6);};}exports['index']=function(_0x57e234,_0x47f529){var _0x1690a1={};var _0x4c2756=_[_0xe2ac('0x22')](db['OpenchannelInteraction'][_0xe2ac('0x23')],function(_0x56b616){return{'name':_0x56b616[_0xe2ac('0x24')],'type':_0x56b616[_0xe2ac('0x25')][_0xe2ac('0x26')]};});_0x1690a1=qs[_0xe2ac('0x27')](_0x4c2756,_0x57e234);return interaction['findAll'](_0xe2ac('0x28'),_0x57e234[_0xe2ac('0x29')],_0x57e234[_0xe2ac('0x2a')],_0x1690a1,_0x4c2756)['then'](respondWithFilteredResult(_0x47f529,_0x1690a1))['catch'](handleError(_0x47f529,null));};exports[_0xe2ac('0x2b')]=function(_0x589405,_0x139a69){var _0x581924={};if(_0x589405[_0xe2ac('0x29')]['type']&&_0x589405[_0xe2ac('0x29')][_0xe2ac('0x25')]==='from'){_0x581924['from']=_0x589405[_0xe2ac('0x2c')]['id'];}else{_0x581924['id']=_0x589405['params']['id'];}var _0x3c0cdd={'raw':![],'where':_0x581924},_0x3d94f0={};_0x3d94f0['model']=_[_0xe2ac('0x2d')](db[_0xe2ac('0x2e')][_0xe2ac('0x23')]);_0x3d94f0[_0xe2ac('0x29')]=_[_0xe2ac('0x2d')](_0x589405[_0xe2ac('0x29')]);_0x3d94f0[_0xe2ac('0x2f')]=_['intersection'](_0x3d94f0['model'],_0x3d94f0[_0xe2ac('0x29')]);_0x3c0cdd['attributes']=_['intersection'](_0x3d94f0[_0xe2ac('0x30')],qs['fields'](_0x589405[_0xe2ac('0x29')][_0xe2ac('0x31')]));_0x3c0cdd[_0xe2ac('0x32')]=_0x3c0cdd[_0xe2ac('0x32')][_0xe2ac('0x33')]?_0x3c0cdd['attributes']:_0x3d94f0[_0xe2ac('0x30')];if(_0x589405[_0xe2ac('0x29')][_0xe2ac('0x34')]){_0x3c0cdd[_0xe2ac('0x35')]=[{'all':!![]}];}_0x3c0cdd=_[_0xe2ac('0x36')]({},_0x3c0cdd,_0x589405[_0xe2ac('0x37')]);return db[_0xe2ac('0x2e')][_0xe2ac('0x38')](_0x3c0cdd)[_0xe2ac('0x1c')](handleEntityNotFound(_0x139a69,null))['then'](respondWithResult(_0x139a69,null))[_0xe2ac('0x39')](handleError(_0x139a69,null));};exports[_0xe2ac('0x3a')]=function(_0x3ea171,_0x50e8d6){return db[_0xe2ac('0x2e')][_0xe2ac('0x3a')](_0x3ea171[_0xe2ac('0x3b')],{})[_0xe2ac('0x1c')](respondWithResult(_0x50e8d6,0xc9))[_0xe2ac('0x39')](handleError(_0x50e8d6,null));};exports[_0xe2ac('0x1b')]=function(_0x4750f4,_0x94e679){if(_0x4750f4[_0xe2ac('0x3b')]['id']){delete _0x4750f4[_0xe2ac('0x3b')]['id'];}return db[_0xe2ac('0x2e')]['find']({'where':{'id':_0x4750f4['params']['id']}})[_0xe2ac('0x1c')](handleEntityNotFound(_0x94e679,null))[_0xe2ac('0x1c')](saveUpdates(_0x4750f4[_0xe2ac('0x3b')],null))[_0xe2ac('0x1c')](respondWithResult(_0x94e679,null))[_0xe2ac('0x39')](handleError(_0x94e679,null));};exports[_0xe2ac('0x1d')]=function(_0x1c4370,_0x1f88e1){return db[_0xe2ac('0x2e')]['find']({'where':{'id':_0x1c4370[_0xe2ac('0x2c')]['id']}})[_0xe2ac('0x1c')](handleEntityNotFound(_0x1f88e1,null))[_0xe2ac('0x1c')](removeEntity(_0x1f88e1,null))[_0xe2ac('0x39')](handleError(_0x1f88e1,null));};exports['describe']=function(_0x42f6ed,_0x7575c){return db['OpenchannelInteraction'][_0xe2ac('0x3c')]()[_0xe2ac('0x1c')](respondWithResult(_0x7575c,null))[_0xe2ac('0x39')](handleError(_0x7575c,null));};exports[_0xe2ac('0x3d')]=function(_0x1ba65b,_0x11c5d8){return db[_0xe2ac('0x3e')][_0xe2ac('0x38')]({'where':{'id':_0x1ba65b[_0xe2ac('0x2c')]['id']}})[_0xe2ac('0x1c')](handleEntityNotFound(_0x11c5d8,null))[_0xe2ac('0x1c')](function(_0x2003f9){if(_0x2003f9){return _0x2003f9[_0xe2ac('0x3d')](_0x1ba65b[_0xe2ac('0x3b')]['ids'],_[_0xe2ac('0x3f')](_0x1ba65b['body'],[_0xe2ac('0x40'),'id'])||{});}})[_0xe2ac('0x1c')](respondWithResult(_0x11c5d8,null))[_0xe2ac('0x39')](handleError(_0x11c5d8,null));};exports[_0xe2ac('0x41')]=function(_0x533738,_0x5676d2){var _0x2ff505={'raw':![],'where':{}};var _0x39eab6={};var _0x233598={'count':0x0,'rows':[]};return db[_0xe2ac('0x2e')]['findOne']({'where':{'id':_0x533738['params']['id']}})[_0xe2ac('0x1c')](handleEntityNotFound(_0x5676d2,null))['then'](function(_0x208ad0){if(_0x208ad0){_0x39eab6['model']=_[_0xe2ac('0x2d')](db[_0xe2ac('0x3e')][_0xe2ac('0x23')]);_0x39eab6[_0xe2ac('0x29')]=_[_0xe2ac('0x2d')](_0x533738[_0xe2ac('0x29')]);_0x39eab6[_0xe2ac('0x2f')]=_[_0xe2ac('0x42')](_0x39eab6[_0xe2ac('0x30')],_0x39eab6['query']);_0x2ff505[_0xe2ac('0x32')]=_[_0xe2ac('0x42')](_0x39eab6[_0xe2ac('0x30')],qs['fields'](_0x533738[_0xe2ac('0x29')][_0xe2ac('0x31')]));_0x2ff505['attributes']=_0x2ff505[_0xe2ac('0x32')][_0xe2ac('0x33')]?_0x2ff505['attributes']:_0x39eab6[_0xe2ac('0x30')];if(!_0x533738['query'][_0xe2ac('0x43')]('nolimit')){_0x2ff505[_0xe2ac('0x18')]=qs['limit'](_0x533738[_0xe2ac('0x29')]['limit']);_0x2ff505[_0xe2ac('0x15')]=qs['offset'](_0x533738[_0xe2ac('0x29')]['offset']);}_0x2ff505['order']=qs[_0xe2ac('0x44')](_0x533738[_0xe2ac('0x29')][_0xe2ac('0x44')]);_0x2ff505[_0xe2ac('0x45')]=qs[_0xe2ac('0x2f')](_[_0xe2ac('0x46')](_0x533738[_0xe2ac('0x29')],_0x39eab6[_0xe2ac('0x2f')]));_0x2ff505[_0xe2ac('0x45')][_0xe2ac('0x47')]=_0x208ad0['id'];if(_0x533738['query']['filter']){_0x2ff505[_0xe2ac('0x45')]=_[_0xe2ac('0x36')](_0x2ff505[_0xe2ac('0x45')],{'$or':_['map'](_0x2ff505[_0xe2ac('0x32')],function(_0x204619){var _0x22bb47={};_0x22bb47[_0x204619]={'$like':'%'+_0x533738[_0xe2ac('0x29')][_0xe2ac('0x48')]+'%'};return _0x22bb47;})});}if(_0x533738[_0xe2ac('0x29')][_0xe2ac('0x49')]){var _0x284a04=_0x533738[_0xe2ac('0x29')][_0xe2ac('0x49')]['split'](',');var _0x3fee5e={};_0x3fee5e[_0x284a04[0x0]]={'$gte':moment(_0x284a04[0x1])[_0xe2ac('0x4a')](_0xe2ac('0x4b'))};_0x2ff505[_0xe2ac('0x45')]=_[_0xe2ac('0x36')](_0x2ff505[_0xe2ac('0x45')],_0x3fee5e);}_0x2ff505=_[_0xe2ac('0x36')]({},_0x2ff505,_0x533738['options']);return db['OpenchannelMessage'][_0xe2ac('0x17')]({'where':_0x2ff505[_0xe2ac('0x45')]})[_0xe2ac('0x1c')](function(_0x47108d){_0x233598[_0xe2ac('0x17')]=_0x47108d;if(_0x533738[_0xe2ac('0x29')]['includeAll']){_0x2ff505['include']=[{'all':!![]}];}return db[_0xe2ac('0x3e')][_0xe2ac('0x4c')](_0x2ff505);})['then'](function(_0x2370ee){_0x233598['rows']=_0x2370ee;return _0x233598;});}})[_0xe2ac('0x1c')](respondWithFilteredResult(_0x5676d2,_0x2ff505))[_0xe2ac('0x39')](handleError(_0x5676d2,null));};exports[_0xe2ac('0x4d')]=function(_0x35d1d2,_0x1a4b1d){return db[_0xe2ac('0x2e')][_0xe2ac('0x38')]({'where':{'id':_0x35d1d2[_0xe2ac('0x2c')]['id']}})[_0xe2ac('0x1c')](handleEntityNotFound(_0x1a4b1d,null))[_0xe2ac('0x1c')](function(_0x561f8d){if(_0x561f8d){return _0x561f8d[_0xe2ac('0x4e')](_0x35d1d2[_0xe2ac('0x3b')]['ids'],_[_0xe2ac('0x3f')](_0x35d1d2[_0xe2ac('0x3b')],[_0xe2ac('0x40'),'id'])||{})['spread'](function(){return db[_0xe2ac('0x4f')]['findAll']({'attributes':['id',_0xe2ac('0x20'),'color'],'where':{'id':_0x35d1d2[_0xe2ac('0x3b')][_0xe2ac('0x40')]}});})[_0xe2ac('0x1c')](function(_0x63086b){socket[_0xe2ac('0x50')](_0xe2ac('0x51'),{'id':Number(_0x35d1d2[_0xe2ac('0x2c')]['id']),'tags':_0x63086b||[]});return{'id':Number(_0x35d1d2[_0xe2ac('0x2c')]['id']),'tags':_0x63086b||[]};});}})[_0xe2ac('0x1c')](respondWithResult(_0x1a4b1d,null))[_0xe2ac('0x39')](handleError(_0x1a4b1d,null));};exports[_0xe2ac('0x52')]=function(_0x5f41e3,_0x31544b){return db[_0xe2ac('0x2e')][_0xe2ac('0x38')]({'where':{'id':_0x5f41e3[_0xe2ac('0x2c')]['id']}})[_0xe2ac('0x1c')](handleEntityNotFound(_0x31544b,null))[_0xe2ac('0x1c')](function(_0x4ab15f){if(_0x4ab15f){return _0x4ab15f[_0xe2ac('0x52')](_0x5f41e3[_0xe2ac('0x29')][_0xe2ac('0x40')]);}})['then'](respondWithStatusCode(_0x31544b,null))[_0xe2ac('0x39')](handleError(_0x31544b,null));};exports['download']=function(_0x973bf1,_0x6740ec){var _0x4c244f=moment()[_0xe2ac('0x53')]()['toString']();var _0x2d596a=path[_0xe2ac('0x54')](config[_0xe2ac('0x55')],_0xe2ac('0x56'),_0xe2ac('0x57'),'tmp');var _0x6e19d3=path[_0xe2ac('0x54')](config['root'],_0xe2ac('0x56'),'files',_0xe2ac('0x58'));var _0xf1684e=path[_0xe2ac('0x54')](_0x2d596a,_0x4c244f);var _0x415817=util[_0xe2ac('0x4a')]('transcript-%d-%s.zip',_0x973bf1[_0xe2ac('0x2c')]['id'],_0x4c244f);var _0x450928=path[_0xe2ac('0x54')](_0x2d596a,_0x415817);var _0x187022=[];_0x187022['push']({'model':db[_0xe2ac('0x59')],'as':_0xe2ac('0x59'),'attributes':['id',_0xe2ac('0x5a')],'raw':!![]});_0x187022[_0xe2ac('0x5b')]({'model':db[_0xe2ac('0x5c')],'as':'Contact','attributes':['id',_0xe2ac('0x5d'),_0xe2ac('0x5e')],'raw':!![]});if(_0x973bf1[_0xe2ac('0x29')][_0xe2ac('0x58')]){_0x187022[_0xe2ac('0x5b')]({'model':db[_0xe2ac('0x5f')],'as':_0xe2ac('0x5f'),'raw':!![]});}var _0x4c9ade=[{'model':db[_0xe2ac('0x3e')],'as':_0xe2ac('0x60'),'attributes':['id','body',_0xe2ac('0x61'),_0xe2ac('0x62'),_0xe2ac('0x63'),_0xe2ac('0x64')],'include':_0x187022}];_0x4c9ade[_0xe2ac('0x5b')]({'model':db[_0xe2ac('0x65')],'as':'Account','attributes':['id',_0xe2ac('0x20')]});_0x4c9ade[_0xe2ac('0x5b')]({'model':db[_0xe2ac('0x59')],'as':_0xe2ac('0x66'),'attributes':['id',_0xe2ac('0x5a')]});return db[_0xe2ac('0x2e')][_0xe2ac('0x38')]({'where':{'id':_0x973bf1[_0xe2ac('0x2c')]['id']},'include':_0x4c9ade})[_0xe2ac('0x1c')](handleEntityNotFound(_0x6740ec,null))['then'](function(_0x46449e){if(_0x46449e){var _0x5b22e1=_0x46449e[_0xe2ac('0x67')]({'plain':!![]});fs[_0xe2ac('0x68')](_0xf1684e);var _0x144c4f={'channel':_0xe2ac('0x69'),'account':_0x5b22e1[_0xe2ac('0x6a')][_0xe2ac('0x20')],'agent':_0x5b22e1[_0xe2ac('0x66')]?_0x5b22e1['Owner'][_0xe2ac('0x5a')]:_0xe2ac('0x6b'),'createdAt':moment(_0x5b22e1[_0xe2ac('0x61')])[_0xe2ac('0x4a')](_0xe2ac('0x4b'))[_0xe2ac('0x6c')](),'closedAt':_0x5b22e1[_0xe2ac('0x6d')]?moment(_0x5b22e1['closedAt'])[_0xe2ac('0x4a')](_0xe2ac('0x4b'))[_0xe2ac('0x6c')]():'','disposition':_0x5b22e1[_0xe2ac('0x6e')],'visibility':_0x5b22e1['threadId']?_0xe2ac('0x6f'):_0xe2ac('0x70'),'messages':_(_0x5b22e1[_0xe2ac('0x60')])['filter']({'secret':![]})[_0xe2ac('0x22')](function(_0x222838){if(_0x222838['Attachment']){var _0x2e4849=path[_0xe2ac('0x54')](_0x6e19d3,_0x222838['Attachment'][_0xe2ac('0x71')]);if(fs['existsSync'](_0x2e4849)){fs[_0xe2ac('0x72')](_0x2e4849)[_0xe2ac('0x73')](fs[_0xe2ac('0x74')](path[_0xe2ac('0x54')](_0xf1684e,_0x222838[_0xe2ac('0x5f')][_0xe2ac('0x71')])));}}return{'date':moment(_0x222838[_0xe2ac('0x61')])[_0xe2ac('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x222838['direction']===_0xe2ac('0x75')?_0x222838['User']?_0x222838['User']['fullname']:'System':_0x222838[_0xe2ac('0x76')][_0xe2ac('0x5d')]+(_0x222838[_0xe2ac('0x76')][_0xe2ac('0x5e')]?'\x20'+_0x222838[_0xe2ac('0x76')][_0xe2ac('0x5e')]:''),'body':_0x222838['Attachment']?_0x222838[_0xe2ac('0x5f')][_0xe2ac('0x71')]:_0x222838[_0xe2ac('0x3b')],'direction':_0x222838['direction']===_0xe2ac('0x75')?'A':'C','secret':_0x222838[_0xe2ac('0x63')],'read':_0x222838[_0xe2ac('0x64')],'attachment':_0x222838['Attachment']};})[_0xe2ac('0x77')]()};return ejs[_0xe2ac('0x78')](path[_0xe2ac('0x54')](config['root'],_0xe2ac('0x56'),_0xe2ac('0x79'),_0xe2ac('0x7a')),{'interaction':_0x144c4f})['then'](function(_0x5ead80){var _0x1ac74a=path[_0xe2ac('0x54')](_0xf1684e,_0xe2ac('0x7b')+_0x5b22e1['id']+'-'+_0x4c244f+_0xe2ac('0x7c'));var _0x1288c9={'path':_0x1ac74a,'channel':_0xe2ac('0x69'),'interactionId':_0x5b22e1['id']};return pdf[_0xe2ac('0x7d')](_0x5ead80,_0x1288c9);})['then'](function(){return new Promise(function(_0x171e2c,_0x4ea669){zipdir(_0xf1684e,{'saveTo':_0x450928},function(_0x2e9ac1,_0x3c8a62){if(_0x2e9ac1)return _0x4ea669(_0x2e9ac1);return _0x171e2c(_0x3c8a62);});})[_0xe2ac('0x1c')](function(){return new Promise(function(_0x1071f5,_0x4f69fd){rimraf(_0xf1684e,function(_0x4ae4fe){if(_0x4ae4fe)_0x4f69fd(_0x4ae4fe);return _0x1071f5();});});})[_0xe2ac('0x1c')](function(){return _0x6740ec[_0xe2ac('0x7e')](_0x450928,_0x415817,function(_0x59cd9d){if(_0x59cd9d){logger['error'](_0xe2ac('0x7f'),_0x59cd9d);}else{fs[_0xe2ac('0x80')](_0x450928);}});});});}else{return _0x6740ec['sendStatus'](0xc8);}})[_0xe2ac('0x39')](handleError(_0x6740ec,null));}; \ No newline at end of file +var _0xca9e=['mkdirSync','Openchannel','N.A.','toString','closed','closedAt','disposition','threadId','Public','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','renderFile','root','server','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','error','rimraf','moment','util','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','name','send','index','OpenchannelInteraction','rawAttributes','fieldName','getOptions','findAll','user','catch','query','from','params','model','keys','filters','attributes','intersection','fields','length','includeAll','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','findOne','hasOwnProperty','nolimit','order','sort','pick','OpenchannelInteractionId','filter','where','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','setTags','omit','spread','color','removeTags','download','unix','join','files','tmp','attachments','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','Attachment','createdAt','secret','read','Account','Owner','fullname','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca9e,0x99));var _0xeca9=function(_0x13ad9f,_0x50751a){_0x13ad9f=_0x13ad9f-0x0;var _0xa6a338=_0xca9e[_0x13ad9f];return _0xa6a338;};'use strict';var rimraf=require(_0xeca9('0x0'));var zipdir=require('zip-dir');var moment=require(_0xeca9('0x1'));var util=require(_0xeca9('0x2'));var path=require(_0xeca9('0x3'));var ejs=require(_0xeca9('0x4'));var fs=require('fs');var _=require(_0xeca9('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xeca9('0x6'));var pdf=require(_0xeca9('0x7'));var logger=require(_0xeca9('0x8'))(_0xeca9('0x9'));var config=require(_0xeca9('0xa'));var db=require(_0xeca9('0xb'))['db'];config['redis']=_[_0xeca9('0xc')](config['redis'],{'host':_0xeca9('0xd'),'port':0x18eb});var socket=require(_0xeca9('0xe'))(new Redis(config[_0xeca9('0xf')]));require(_0xeca9('0x10'))['register'](socket);function respondWithStatusCode(_0x1fab95,_0x4cf206){_0x4cf206=_0x4cf206||0xcc;return function(_0x555f31){if(_0x555f31){return _0x1fab95[_0xeca9('0x11')](_0x4cf206);}return _0x1fab95['status'](_0x4cf206)[_0xeca9('0x12')]();};}function respondWithResult(_0x1d74e2,_0x554a60){_0x554a60=_0x554a60||0xc8;return function(_0xa8fb1d){if(_0xa8fb1d){return _0x1d74e2[_0xeca9('0x13')](_0x554a60)[_0xeca9('0x14')](_0xa8fb1d);}};}function respondWithFilteredResult(_0x4c292a,_0x1081a1){return function(_0x2a996b){if(_0x2a996b){var _0x4a0c99=typeof _0x1081a1[_0xeca9('0x15')]===_0xeca9('0x16')&&typeof _0x1081a1[_0xeca9('0x17')]===_0xeca9('0x16');var _0x3dd712=_0x2a996b[_0xeca9('0x18')];var _0x42820f=_0x4a0c99?0x0:_0x1081a1['offset'];var _0x29ebc6=_0x4a0c99?_0x2a996b[_0xeca9('0x18')]:_0x1081a1[_0xeca9('0x15')]+_0x1081a1['limit'];var _0x3cb685;if(_0x29ebc6>=_0x3dd712){_0x29ebc6=_0x3dd712;_0x3cb685=0xc8;}else{_0x3cb685=0xce;}_0x4c292a[_0xeca9('0x13')](_0x3cb685);return _0x4c292a[_0xeca9('0x19')](_0xeca9('0x1a'),_0x42820f+'-'+_0x29ebc6+'/'+_0x3dd712)[_0xeca9('0x14')](_0x2a996b);}return null;};}function saveUpdates(_0x1e5527){return function(_0x14f8c){if(_0x14f8c){return _0x14f8c[_0xeca9('0x1b')](_0x1e5527)[_0xeca9('0x1c')](function(_0x5aa9ed){return _0x5aa9ed;});}return null;};}function removeEntity(_0x460702){return function(_0xf1a27d){if(_0xf1a27d){return _0xf1a27d[_0xeca9('0x1d')]()['then'](function(){_0x460702['status'](0xcc)[_0xeca9('0x12')]();});}};}function handleEntityNotFound(_0x219376){return function(_0x4db6a3){if(!_0x4db6a3){_0x219376[_0xeca9('0x11')](0x194);}return _0x4db6a3;};}function handleError(_0x16d86e,_0x1acd36){_0x1acd36=_0x1acd36||0x1f4;return function(_0x248e70){logger['error'](_0x248e70['stack']);if(_0x248e70['name']){delete _0x248e70[_0xeca9('0x1e')];}_0x16d86e['status'](_0x1acd36)[_0xeca9('0x1f')](_0x248e70);};}exports[_0xeca9('0x20')]=function(_0x2fe072,_0x7d3cb0){var _0x40deba={};var _0x2e6c02=_['map'](db[_0xeca9('0x21')][_0xeca9('0x22')],function(_0x1f9959){return{'name':_0x1f9959[_0xeca9('0x23')],'type':_0x1f9959['type']['key']};});_0x40deba=qs[_0xeca9('0x24')](_0x2e6c02,_0x2fe072);return interaction[_0xeca9('0x25')]('openchannel',_0x2fe072['query'],_0x2fe072[_0xeca9('0x26')],_0x40deba,_0x2e6c02)[_0xeca9('0x1c')](respondWithFilteredResult(_0x7d3cb0,_0x40deba))[_0xeca9('0x27')](handleError(_0x7d3cb0,null));};exports['show']=function(_0x5f3c44,_0x4f7a50){var _0x51a2db={};if(_0x5f3c44[_0xeca9('0x28')]['type']&&_0x5f3c44['query']['type']===_0xeca9('0x29')){_0x51a2db[_0xeca9('0x29')]=_0x5f3c44[_0xeca9('0x2a')]['id'];}else{_0x51a2db['id']=_0x5f3c44[_0xeca9('0x2a')]['id'];}var _0xe8d53b={'raw':![],'where':_0x51a2db},_0x2e861e={};_0x2e861e[_0xeca9('0x2b')]=_['keys'](db[_0xeca9('0x21')][_0xeca9('0x22')]);_0x2e861e[_0xeca9('0x28')]=_[_0xeca9('0x2c')](_0x5f3c44[_0xeca9('0x28')]);_0x2e861e[_0xeca9('0x2d')]=_['intersection'](_0x2e861e[_0xeca9('0x2b')],_0x2e861e['query']);_0xe8d53b[_0xeca9('0x2e')]=_[_0xeca9('0x2f')](_0x2e861e[_0xeca9('0x2b')],qs[_0xeca9('0x30')](_0x5f3c44[_0xeca9('0x28')][_0xeca9('0x30')]));_0xe8d53b['attributes']=_0xe8d53b[_0xeca9('0x2e')][_0xeca9('0x31')]?_0xe8d53b[_0xeca9('0x2e')]:_0x2e861e['model'];if(_0x5f3c44['query'][_0xeca9('0x32')]){_0xe8d53b['include']=[{'all':!![]}];}_0xe8d53b=_['merge']({},_0xe8d53b,_0x5f3c44[_0xeca9('0x33')]);return db[_0xeca9('0x21')][_0xeca9('0x34')](_0xe8d53b)['then'](handleEntityNotFound(_0x4f7a50,null))[_0xeca9('0x1c')](respondWithResult(_0x4f7a50,null))[_0xeca9('0x27')](handleError(_0x4f7a50,null));};exports[_0xeca9('0x35')]=function(_0x25bd54,_0x1d31bc){return db['OpenchannelInteraction']['create'](_0x25bd54[_0xeca9('0x36')],{})['then'](respondWithResult(_0x1d31bc,0xc9))[_0xeca9('0x27')](handleError(_0x1d31bc,null));};exports[_0xeca9('0x1b')]=function(_0x516f6c,_0x12637d){if(_0x516f6c[_0xeca9('0x36')]['id']){delete _0x516f6c['body']['id'];}return db[_0xeca9('0x21')][_0xeca9('0x34')]({'where':{'id':_0x516f6c[_0xeca9('0x2a')]['id']}})['then'](handleEntityNotFound(_0x12637d,null))[_0xeca9('0x1c')](saveUpdates(_0x516f6c[_0xeca9('0x36')],null))[_0xeca9('0x1c')](respondWithResult(_0x12637d,null))[_0xeca9('0x27')](handleError(_0x12637d,null));};exports[_0xeca9('0x1d')]=function(_0x3fed6d,_0x4ec1e8){return db[_0xeca9('0x21')][_0xeca9('0x34')]({'where':{'id':_0x3fed6d[_0xeca9('0x2a')]['id']}})[_0xeca9('0x1c')](handleEntityNotFound(_0x4ec1e8,null))[_0xeca9('0x1c')](removeEntity(_0x4ec1e8,null))[_0xeca9('0x27')](handleError(_0x4ec1e8,null));};exports[_0xeca9('0x37')]=function(_0x2e1245,_0x5e3f96){return db[_0xeca9('0x21')][_0xeca9('0x37')]()['then'](respondWithResult(_0x5e3f96,null))[_0xeca9('0x27')](handleError(_0x5e3f96,null));};exports[_0xeca9('0x38')]=function(_0x20a617,_0x93da07){return db[_0xeca9('0x39')][_0xeca9('0x34')]({'where':{'id':_0x20a617[_0xeca9('0x2a')]['id']}})[_0xeca9('0x1c')](handleEntityNotFound(_0x93da07,null))[_0xeca9('0x1c')](function(_0x199f8f){if(_0x199f8f){return _0x199f8f[_0xeca9('0x38')](_0x20a617[_0xeca9('0x36')][_0xeca9('0x3a')],_['omit'](_0x20a617[_0xeca9('0x36')],['ids','id'])||{});}})[_0xeca9('0x1c')](respondWithResult(_0x93da07,null))[_0xeca9('0x27')](handleError(_0x93da07,null));};exports['getMessages']=function(_0x37b623,_0x28c034){var _0x10a78f={'raw':![],'where':{}};var _0x1418d5={};var _0x1af1b8={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xeca9('0x3b')]({'where':{'id':_0x37b623[_0xeca9('0x2a')]['id']}})[_0xeca9('0x1c')](handleEntityNotFound(_0x28c034,null))[_0xeca9('0x1c')](function(_0x57b5f2){if(_0x57b5f2){_0x1418d5['model']=_[_0xeca9('0x2c')](db[_0xeca9('0x39')][_0xeca9('0x22')]);_0x1418d5['query']=_[_0xeca9('0x2c')](_0x37b623[_0xeca9('0x28')]);_0x1418d5[_0xeca9('0x2d')]=_[_0xeca9('0x2f')](_0x1418d5[_0xeca9('0x2b')],_0x1418d5[_0xeca9('0x28')]);_0x10a78f[_0xeca9('0x2e')]=_['intersection'](_0x1418d5[_0xeca9('0x2b')],qs[_0xeca9('0x30')](_0x37b623['query'][_0xeca9('0x30')]));_0x10a78f['attributes']=_0x10a78f[_0xeca9('0x2e')][_0xeca9('0x31')]?_0x10a78f[_0xeca9('0x2e')]:_0x1418d5[_0xeca9('0x2b')];if(!_0x37b623[_0xeca9('0x28')][_0xeca9('0x3c')](_0xeca9('0x3d'))){_0x10a78f[_0xeca9('0x17')]=qs[_0xeca9('0x17')](_0x37b623['query']['limit']);_0x10a78f['offset']=qs[_0xeca9('0x15')](_0x37b623[_0xeca9('0x28')]['offset']);}_0x10a78f[_0xeca9('0x3e')]=qs[_0xeca9('0x3f')](_0x37b623[_0xeca9('0x28')][_0xeca9('0x3f')]);_0x10a78f['where']=qs['filters'](_[_0xeca9('0x40')](_0x37b623['query'],_0x1418d5[_0xeca9('0x2d')]));_0x10a78f['where'][_0xeca9('0x41')]=_0x57b5f2['id'];if(_0x37b623[_0xeca9('0x28')][_0xeca9('0x42')]){_0x10a78f[_0xeca9('0x43')]=_['merge'](_0x10a78f[_0xeca9('0x43')],{'$or':_[_0xeca9('0x44')](_0x10a78f[_0xeca9('0x2e')],function(_0x11ebf6){var _0xad6bd5={};_0xad6bd5[_0x11ebf6]={'$like':'%'+_0x37b623[_0xeca9('0x28')]['filter']+'%'};return _0xad6bd5;})});}if(_0x37b623[_0xeca9('0x28')]['$gte']){var _0x1506a6=_0x37b623['query'][_0xeca9('0x45')][_0xeca9('0x46')](',');var _0x493fd5={};_0x493fd5[_0x1506a6[0x0]]={'$gte':moment(_0x1506a6[0x1])[_0xeca9('0x47')](_0xeca9('0x48'))};_0x10a78f[_0xeca9('0x43')]=_[_0xeca9('0x49')](_0x10a78f[_0xeca9('0x43')],_0x493fd5);}_0x10a78f=_[_0xeca9('0x49')]({},_0x10a78f,_0x37b623[_0xeca9('0x33')]);return db['OpenchannelMessage'][_0xeca9('0x18')]({'where':_0x10a78f[_0xeca9('0x43')]})[_0xeca9('0x1c')](function(_0x2ddc15){_0x1af1b8[_0xeca9('0x18')]=_0x2ddc15;if(_0x37b623[_0xeca9('0x28')][_0xeca9('0x32')]){_0x10a78f['include']=[{'all':!![]}];}return db[_0xeca9('0x39')][_0xeca9('0x25')](_0x10a78f);})[_0xeca9('0x1c')](function(_0x5012de){_0x1af1b8[_0xeca9('0x4a')]=_0x5012de;return _0x1af1b8;});}})[_0xeca9('0x1c')](respondWithFilteredResult(_0x28c034,_0x10a78f))[_0xeca9('0x27')](handleError(_0x28c034,null));};exports[_0xeca9('0x4b')]=function(_0x5b3187,_0x1dc73d){return db['OpenchannelInteraction']['find']({'where':{'id':_0x5b3187[_0xeca9('0x2a')]['id']}})[_0xeca9('0x1c')](handleEntityNotFound(_0x1dc73d,null))[_0xeca9('0x1c')](function(_0xaea2b1){if(_0xaea2b1){return _0xaea2b1[_0xeca9('0x4c')](_0x5b3187['body'][_0xeca9('0x3a')],_[_0xeca9('0x4d')](_0x5b3187[_0xeca9('0x36')],[_0xeca9('0x3a'),'id'])||{})[_0xeca9('0x4e')](function(){return db['Tag'][_0xeca9('0x25')]({'attributes':['id',_0xeca9('0x1e'),_0xeca9('0x4f')],'where':{'id':_0x5b3187[_0xeca9('0x36')][_0xeca9('0x3a')]}});})[_0xeca9('0x1c')](function(_0x4faa59){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x5b3187[_0xeca9('0x2a')]['id']),'tags':_0x4faa59||[]});return{'id':Number(_0x5b3187['params']['id']),'tags':_0x4faa59||[]};});}})['then'](respondWithResult(_0x1dc73d,null))[_0xeca9('0x27')](handleError(_0x1dc73d,null));};exports[_0xeca9('0x50')]=function(_0x13237f,_0x12e30d){return db['OpenchannelInteraction'][_0xeca9('0x34')]({'where':{'id':_0x13237f['params']['id']}})[_0xeca9('0x1c')](handleEntityNotFound(_0x12e30d,null))['then'](function(_0x36748c){if(_0x36748c){return _0x36748c['removeTags'](_0x13237f['query'][_0xeca9('0x3a')]);}})[_0xeca9('0x1c')](respondWithStatusCode(_0x12e30d,null))[_0xeca9('0x27')](handleError(_0x12e30d,null));};exports[_0xeca9('0x51')]=function(_0x5697f6,_0x1a94ae){var _0x37e8f2=moment()[_0xeca9('0x52')]()['toString']();var _0x6651fc=path[_0xeca9('0x53')](config['root'],'server',_0xeca9('0x54'),_0xeca9('0x55'));var _0x4b6379=path[_0xeca9('0x53')](config['root'],'server',_0xeca9('0x54'),_0xeca9('0x56'));var _0x17b118=path[_0xeca9('0x53')](_0x6651fc,_0x37e8f2);var _0x125110=util[_0xeca9('0x47')](_0xeca9('0x57'),_0x5697f6['params']['id'],_0x37e8f2);var _0x709676=path[_0xeca9('0x53')](_0x6651fc,_0x125110);var _0x12ae80=[];_0x12ae80['push']({'model':db[_0xeca9('0x58')],'as':_0xeca9('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x12ae80[_0xeca9('0x59')]({'model':db[_0xeca9('0x5a')],'as':_0xeca9('0x5b'),'attributes':['id',_0xeca9('0x5c'),'lastName'],'raw':!![]});if(_0x5697f6[_0xeca9('0x28')]['attachments']){_0x12ae80[_0xeca9('0x59')]({'model':db['Attachment'],'as':_0xeca9('0x5d'),'raw':!![]});}var _0x558419=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0xeca9('0x36'),_0xeca9('0x5e'),'direction',_0xeca9('0x5f'),_0xeca9('0x60')],'include':_0x12ae80}];_0x558419['push']({'model':db['OpenchannelAccount'],'as':_0xeca9('0x61'),'attributes':['id',_0xeca9('0x1e')]});_0x558419[_0xeca9('0x59')]({'model':db[_0xeca9('0x58')],'as':_0xeca9('0x62'),'attributes':['id',_0xeca9('0x63')]});return db[_0xeca9('0x21')]['find']({'where':{'id':_0x5697f6[_0xeca9('0x2a')]['id']},'include':_0x558419})[_0xeca9('0x1c')](handleEntityNotFound(_0x1a94ae,null))[_0xeca9('0x1c')](function(_0x529d37){if(_0x529d37){var _0x193611=_0x529d37[_0xeca9('0x64')]({'plain':!![]});fs[_0xeca9('0x65')](_0x17b118);var _0x49530a={'channel':_0xeca9('0x66'),'account':_0x193611[_0xeca9('0x61')][_0xeca9('0x1e')],'agent':_0x193611[_0xeca9('0x62')]?_0x193611[_0xeca9('0x62')][_0xeca9('0x63')]:_0xeca9('0x67'),'createdAt':moment(_0x193611['createdAt'])[_0xeca9('0x47')](_0xeca9('0x48'))[_0xeca9('0x68')](),'closedAt':_0x193611[_0xeca9('0x69')]?moment(_0x193611[_0xeca9('0x6a')])['format'](_0xeca9('0x48'))['toString']():'','disposition':_0x193611[_0xeca9('0x6b')],'visibility':_0x193611[_0xeca9('0x6c')]?_0xeca9('0x6d'):'Private','messages':_(_0x193611[_0xeca9('0x6e')])[_0xeca9('0x42')]({'secret':![]})['map'](function(_0x54ecc3){if(_0x54ecc3[_0xeca9('0x5d')]){var _0x1f1bbf=path[_0xeca9('0x53')](_0x4b6379,_0x54ecc3[_0xeca9('0x5d')][_0xeca9('0x6f')]);if(fs[_0xeca9('0x70')](_0x1f1bbf)){fs[_0xeca9('0x71')](_0x1f1bbf)[_0xeca9('0x72')](fs[_0xeca9('0x73')](path[_0xeca9('0x53')](_0x17b118,_0x54ecc3[_0xeca9('0x5d')]['basename'])));}}return{'date':moment(_0x54ecc3[_0xeca9('0x5e')])[_0xeca9('0x47')](_0xeca9('0x48'))[_0xeca9('0x68')](),'sender':_0x54ecc3['direction']===_0xeca9('0x74')?_0x54ecc3[_0xeca9('0x58')]?_0x54ecc3[_0xeca9('0x58')]['fullname']:_0xeca9('0x75'):_0x54ecc3[_0xeca9('0x5b')][_0xeca9('0x5c')]+(_0x54ecc3[_0xeca9('0x5b')]['lastName']?'\x20'+_0x54ecc3[_0xeca9('0x5b')][_0xeca9('0x76')]:''),'body':_0x54ecc3[_0xeca9('0x5d')]?_0x54ecc3[_0xeca9('0x5d')][_0xeca9('0x6f')]:_0x54ecc3['body'],'direction':_0x54ecc3['direction']===_0xeca9('0x74')?'A':'C','secret':_0x54ecc3['secret'],'read':_0x54ecc3[_0xeca9('0x60')],'attachment':_0x54ecc3[_0xeca9('0x5d')]};})['value']()};return ejs[_0xeca9('0x77')](path[_0xeca9('0x53')](config[_0xeca9('0x78')],_0xeca9('0x79'),'views',_0xeca9('0x7a')),{'interaction':_0x49530a})[_0xeca9('0x1c')](function(_0x3e3a6f){var _0x340982=path[_0xeca9('0x53')](_0x17b118,_0xeca9('0x7b')+_0x193611['id']+'-'+_0x37e8f2+_0xeca9('0x7c'));var _0x442190={'path':_0x340982,'channel':_0xeca9('0x66'),'interactionId':_0x193611['id']};return pdf[_0xeca9('0x7d')](_0x3e3a6f,_0x442190);})['then'](function(){return new Promise(function(_0x53a2ec,_0x4f6871){zipdir(_0x17b118,{'saveTo':_0x709676},function(_0x1b340b,_0x28ba41){if(_0x1b340b)return _0x4f6871(_0x1b340b);return _0x53a2ec(_0x28ba41);});})['then'](function(){return new Promise(function(_0x2e21c8,_0x41231a){rimraf(_0x17b118,function(_0x2a0c9e){if(_0x2a0c9e)_0x41231a(_0x2a0c9e);return _0x2e21c8();});});})['then'](function(){return _0x1a94ae[_0xeca9('0x51')](_0x709676,_0x125110,function(_0x509ee3){if(_0x509ee3){logger[_0xeca9('0x7e')]('Unable\x20to\x20delete\x20zip\x20file',_0x509ee3);}else{fs['unlinkSync'](_0x709676);}});});});}else{return _0x1a94ae[_0xeca9('0x11')](0xc8);}})[_0xeca9('0x27')](handleError(_0x1a94ae,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 74f041a..8af8871 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 _0xb208=['exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','setDataValue','map','findAll','then','unreadMessages','length','emit','hasOwnProperty'];(function(_0x402ba7,_0x34af6c){var _0x330c44=function(_0x1ab909){while(--_0x1ab909){_0x402ba7['push'](_0x402ba7['shift']());}};_0x330c44(++_0x34af6c);}(_0xb208,0x1c3));var _0x8b20=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb208[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x8b20('0x0'));var OpenchannelInteraction=require(_0x8b20('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x8b20('0x1'))['db'][_0x8b20('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8b20('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b20('0x4'),'afterDestroy':_0x8b20('0x5')};function emitEvent(_0x375262){return function(_0x462fa6,_0x4c96ab,_0xa7d2a){_0x462fa6['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x132a54){_0x462fa6[_0x8b20('0x6')]('Users',_0x132a54[_0x8b20('0x7')](function(_0x2b73d8){return{'id':_0x2b73d8['id']};}));return OpenchannelMessage[_0x8b20('0x8')]({'where':{'OpenchannelInteractionId':_0x462fa6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8b20('0x9')](function(_0xe49f9c){_0x462fa6[_0x8b20('0x6')](_0x8b20('0xa'),_0xe49f9c[_0x8b20('0xb')]);OpenchannelInteractionEvents[_0x8b20('0xc')](_0x375262+':'+_0x462fa6['id'],_0x462fa6);OpenchannelInteractionEvents['emit'](_0x375262,_0x462fa6);_0xa7d2a(null);})['catch'](_0xa7d2a(null));};}for(var e in events){if(events[_0x8b20('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x8b20('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x6a99=['unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','map','findAll'];(function(_0x5d07ff,_0x1f976f){var _0x5226ad=function(_0x1653a4){while(--_0x1653a4){_0x5d07ff['push'](_0x5d07ff['shift']());}};_0x5226ad(++_0x1f976f);}(_0x6a99,0x18c));var _0x96a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6a99[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x96a9('0x0'));var OpenchannelInteraction=require(_0x96a9('0x1'))['db'][_0x96a9('0x2')];var OpenchannelMessage=require(_0x96a9('0x1'))['db'][_0x96a9('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x96a9('0x4')](0x0);var events={'afterCreate':_0x96a9('0x5'),'afterUpdate':_0x96a9('0x6'),'afterDestroy':_0x96a9('0x7')};function emitEvent(_0x3eba1f){return function(_0x22adbe,_0x5ee907,_0x42210d){_0x22adbe[_0x96a9('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x66501){_0x22adbe[_0x96a9('0x9')]('Users',_0x66501[_0x96a9('0xa')](function(_0x2d30f7){return{'id':_0x2d30f7['id']};}));return OpenchannelMessage[_0x96a9('0xb')]({'where':{'OpenchannelInteractionId':_0x22adbe['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x304216){_0x22adbe[_0x96a9('0x9')](_0x96a9('0xc'),_0x304216['length']);OpenchannelInteractionEvents[_0x96a9('0xd')](_0x3eba1f+':'+_0x22adbe['id'],_0x22adbe);OpenchannelInteractionEvents[_0x96a9('0xd')](_0x3eba1f,_0x22adbe);_0x42210d(null);})[_0x96a9('0xe')](_0x42210d(null));};}for(var e in events){if(events[_0x96a9('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x96a9('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 949bfb2..923c94c 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 _0x5d99=['../../config/environment','define','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x5d99,0x1b7));var _0x95d9=function(_0x5959c9,_0x2ed153){_0x5959c9=_0x5959c9-0x0;var _0x4ffcbc=_0x5d99[_0x5959c9];return _0x4ffcbc;};'use strict';var _=require(_0x95d9('0x0'));var util=require(_0x95d9('0x1'));var logger=require(_0x95d9('0x2'))(_0x95d9('0x3'));var moment=require(_0x95d9('0x4'));var BPromise=require(_0x95d9('0x5'));var rp=require(_0x95d9('0x6'));var fs=require('fs');var path=require(_0x95d9('0x7'));var rimraf=require(_0x95d9('0x8'));var config=require(_0x95d9('0x9'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x27d75e,_0x3a2582){return _0x27d75e[_0x95d9('0xa')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x95d9('0xb'),'collate':_0x95d9('0xc'),'hooks':{'beforeUpdate':function(_0x59a4e0,_0x27c9d3,_0x467f87){if(_0x59a4e0[_0x95d9('0xd')]('closed')){_0x59a4e0[_0x95d9('0xe')]=moment()[_0x95d9('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x467f87(null,_0x59a4e0);}}});}; \ No newline at end of file +var _0x3550=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','lodash','util'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x3550,0x11b));var _0x0355=function(_0x1879ba,_0x8a6257){_0x1879ba=_0x1879ba-0x0;var _0x507437=_0x3550[_0x1879ba];return _0x507437;};'use strict';var _=require(_0x0355('0x0'));var util=require(_0x0355('0x1'));var logger=require(_0x0355('0x2'))('api');var moment=require(_0x0355('0x3'));var BPromise=require(_0x0355('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0355('0x5'));var config=require(_0x0355('0x6'));var attributes=require(_0x0355('0x7'));module[_0x0355('0x8')]=function(_0x1188ab,_0x2f9b92){return _0x1188ab['define'](_0x0355('0x9'),attributes,{'tableName':_0x0355('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0355('0xb'),'hooks':{'beforeUpdate':function(_0xb93e60,_0x2d057c,_0x42146d){if(_0xb93e60[_0x0355('0xc')](_0x0355('0xd'))){_0xb93e60[_0x0355('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x42146d(null,_0xb93e60);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index be26a28..a77de24 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 _0x44ff=['where','attributes','limit','UpdateOpenchannelInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','OpenchannelInteraction','body','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44ff,0xad));var _0xf44f=function(_0x339e37,_0x13eb45){_0x339e37=_0x339e37-0x0;var _0xce94dd=_0x44ff[_0x339e37];return _0xce94dd;};'use strict';var _=require(_0xf44f('0x0'));var util=require(_0xf44f('0x1'));var moment=require(_0xf44f('0x2'));var BPromise=require(_0xf44f('0x3'));var rs=require(_0xf44f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf44f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf44f('0x6'));var config=require('../../config/environment');var jayson=require(_0xf44f('0x7'));var client=jayson[_0xf44f('0x8')][_0xf44f('0x9')]({'port':0x232a});config['redis']=_[_0xf44f('0xa')](config[_0xf44f('0xb')],{'host':_0xf44f('0xc'),'port':0x18eb});var socket=require(_0xf44f('0xd'))(new Redis(config[_0xf44f('0xb')]));require(_0xf44f('0xe'))[_0xf44f('0xf')](socket);function respondWithRpcPromise(_0x168c66,_0x3a987f,_0x17041a){return new BPromise(function(_0x4279d7,_0x44081c){return client[_0xf44f('0x10')](_0x168c66,_0x17041a)[_0xf44f('0x11')](function(_0x2aacd5){logger[_0xf44f('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3a987f,_0xf44f('0x13'));logger[_0xf44f('0x14')](_0xf44f('0x15'),_0x3a987f,_0xf44f('0x13'),JSON[_0xf44f('0x16')](_0x2aacd5));if(_0x2aacd5[_0xf44f('0x17')]){if(_0x2aacd5['error']['code']===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3a987f,_0x2aacd5[_0xf44f('0x17')][_0xf44f('0x18')]);return _0x44081c(_0x2aacd5[_0xf44f('0x17')][_0xf44f('0x18')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3a987f,_0x2aacd5[_0xf44f('0x17')][_0xf44f('0x18')]);return _0x4279d7(_0x2aacd5[_0xf44f('0x17')][_0xf44f('0x18')]);}else{logger['info'](_0xf44f('0x19'),_0x3a987f,_0xf44f('0x13'));_0x4279d7(_0x2aacd5[_0xf44f('0x1a')]['message']);}})[_0xf44f('0x1b')](function(_0x595bf6){logger[_0xf44f('0x17')](_0xf44f('0x19'),_0x3a987f,_0x595bf6);_0x44081c(_0x595bf6);});});}exports['UpdateOpenchannelInteraction']=function(_0x1eec2c){var _0x4f7f6a=this;return new Promise(function(_0x5c26df,_0x2e9488){return db[_0xf44f('0x1c')]['update'](_0x1eec2c[_0xf44f('0x1d')],{'raw':_0x1eec2c['options']?_0x1eec2c[_0xf44f('0x1e')][_0xf44f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eec2c['options']?_0x1eec2c[_0xf44f('0x1e')][_0xf44f('0x20')]||null:null,'attributes':_0x1eec2c[_0xf44f('0x1e')]?_0x1eec2c['options'][_0xf44f('0x21')]||null:null,'limit':_0x1eec2c[_0xf44f('0x1e')]?_0x1eec2c[_0xf44f('0x1e')][_0xf44f('0x22')]||null:null})[_0xf44f('0x11')](function(_0x1e543b){logger[_0xf44f('0x12')](_0xf44f('0x23'),_0x1eec2c);logger[_0xf44f('0x14')](_0xf44f('0x23'),_0x1eec2c,JSON[_0xf44f('0x16')](_0x1e543b));_0x5c26df(_0x1e543b);})[_0xf44f('0x1b')](function(_0x120067){logger[_0xf44f('0x17')](_0xf44f('0x23'),_0x120067[_0xf44f('0x18')],_0x1eec2c);_0x2e9488(_0x4f7f6a[_0xf44f('0x17')](0x1f4,_0x120067[_0xf44f('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x258ce8){return new Promise(function(_0x566186,_0x3486b1){return db[_0xf44f('0x1c')][_0xf44f('0x24')]({'where':_0x258ce8[_0xf44f('0x1e')]?_0x258ce8[_0xf44f('0x1e')][_0xf44f('0x20')]||null:null})[_0xf44f('0x11')](function(_0xe014d){if(_0xe014d){return _0xe014d['addTags'](_0x258ce8[_0xf44f('0x1d')][_0xf44f('0x25')],_[_0xf44f('0x26')](_0x258ce8[_0xf44f('0x1d')],[_0xf44f('0x25'),'id'])||{});}})[_0xf44f('0x27')](function(_0x3d33b3){logger[_0xf44f('0x12')](_0xf44f('0x28'),_0x258ce8);logger[_0xf44f('0x14')]('AddTags',_0x258ce8,JSON[_0xf44f('0x16')](_0x3d33b3));_0x566186(_0x3d33b3);})[_0xf44f('0x1b')](function(_0x2f874a){logger[_0xf44f('0x17')](_0xf44f('0x28'),_0x2f874a[_0xf44f('0x18')],_0x258ce8);_0x3486b1(_this[_0xf44f('0x17')](0x1f4,_0x2f874a[_0xf44f('0x18')]));});});}; \ No newline at end of file +var _0x3d39=['socket.io-emitter','redis','./openchannelInteraction.socket','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','then','AddTagsToOpenchannelInteraction','find','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','localhost'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3d39,0x14a));var _0x93d3=function(_0x1bcc02,_0x3f6e5c){_0x1bcc02=_0x1bcc02-0x0;var _0x55c792=_0x3d39[_0x1bcc02];return _0x55c792;};'use strict';var _=require(_0x93d3('0x0'));var util=require('util');var moment=require(_0x93d3('0x1'));var BPromise=require(_0x93d3('0x2'));var rs=require(_0x93d3('0x3'));var fs=require('fs');var Redis=require(_0x93d3('0x4'));var db=require(_0x93d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x93d3('0x6'))('rpc');var config=require(_0x93d3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x93d3('0x8')][_0x93d3('0x9')]({'port':0x232a});config['redis']=_[_0x93d3('0xa')](config['redis'],{'host':_0x93d3('0xb'),'port':0x18eb});var socket=require(_0x93d3('0xc'))(new Redis(config[_0x93d3('0xd')]));require(_0x93d3('0xe'))['register'](socket);function respondWithRpcPromise(_0x5ab4ae,_0x3256c3,_0x128859){return new BPromise(function(_0x23cc27,_0x3037c5){return client['request'](_0x5ab4ae,_0x128859)['then'](function(_0x209675){logger['info'](_0x93d3('0xf'),_0x3256c3,'request\x20sent');logger[_0x93d3('0x10')](_0x93d3('0x11'),_0x3256c3,'request\x20sent',JSON[_0x93d3('0x12')](_0x209675));if(_0x209675['error']){if(_0x209675[_0x93d3('0x13')]['code']===0x1f4){logger[_0x93d3('0x13')](_0x93d3('0xf'),_0x3256c3,_0x209675[_0x93d3('0x13')]['message']);return _0x3037c5(_0x209675[_0x93d3('0x13')][_0x93d3('0x14')]);}logger[_0x93d3('0x13')](_0x93d3('0xf'),_0x3256c3,_0x209675[_0x93d3('0x13')]['message']);return _0x23cc27(_0x209675['error'][_0x93d3('0x14')]);}else{logger[_0x93d3('0x15')](_0x93d3('0xf'),_0x3256c3,'request\x20sent');_0x23cc27(_0x209675[_0x93d3('0x16')]['message']);}})[_0x93d3('0x17')](function(_0x22fc7f){logger[_0x93d3('0x13')](_0x93d3('0xf'),_0x3256c3,_0x22fc7f);_0x3037c5(_0x22fc7f);});});}exports[_0x93d3('0x18')]=function(_0x10ab9f){var _0x14dd74=this;return new Promise(function(_0x3d8221,_0x5e9aea){return db[_0x93d3('0x19')]['update'](_0x10ab9f[_0x93d3('0x1a')],{'raw':_0x10ab9f[_0x93d3('0x1b')]?_0x10ab9f['options'][_0x93d3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10ab9f[_0x93d3('0x1b')]?_0x10ab9f['options'][_0x93d3('0x1d')]||null:null,'attributes':_0x10ab9f['options']?_0x10ab9f[_0x93d3('0x1b')][_0x93d3('0x1e')]||null:null,'limit':_0x10ab9f['options']?_0x10ab9f[_0x93d3('0x1b')]['limit']||null:null})[_0x93d3('0x1f')](function(_0x397117){logger['info'](_0x93d3('0x18'),_0x10ab9f);logger[_0x93d3('0x10')]('UpdateOpenchannelInteraction',_0x10ab9f,JSON[_0x93d3('0x12')](_0x397117));_0x3d8221(_0x397117);})[_0x93d3('0x17')](function(_0x1dd95a){logger[_0x93d3('0x13')](_0x93d3('0x18'),_0x1dd95a['message'],_0x10ab9f);_0x5e9aea(_0x14dd74[_0x93d3('0x13')](0x1f4,_0x1dd95a[_0x93d3('0x14')]));});});};exports[_0x93d3('0x20')]=function(_0x1e084c){return new Promise(function(_0x1189cd,_0x4df434){return db[_0x93d3('0x19')][_0x93d3('0x21')]({'where':_0x1e084c[_0x93d3('0x1b')]?_0x1e084c['options']['where']||null:null})['then'](function(_0xec0dad){if(_0xec0dad){return _0xec0dad['addTags'](_0x1e084c['body'][_0x93d3('0x22')],_[_0x93d3('0x23')](_0x1e084c[_0x93d3('0x1a')],[_0x93d3('0x22'),'id'])||{});}})[_0x93d3('0x24')](function(_0x157b8e){logger[_0x93d3('0x15')]('AddTags',_0x1e084c);logger[_0x93d3('0x10')](_0x93d3('0x25'),_0x1e084c,JSON[_0x93d3('0x12')](_0x157b8e));_0x1189cd(_0x157b8e);})[_0x93d3('0x17')](function(_0x5558f7){logger['error'](_0x93d3('0x25'),_0x5558f7[_0x93d3('0x14')],_0x1e084c);_0x4df434(_this[_0x93d3('0x13')](0x1f4,_0x5558f7[_0x93d3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index f09bc2f..9b5eb18 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 _0x474f=['save','remove','update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x191dff,_0xb60d16){var _0x410a43=function(_0x25ccdc){while(--_0x25ccdc){_0x191dff['push'](_0x191dff['shift']());}};_0x410a43(++_0xb60d16);}(_0x474f,0x167));var _0xf474=function(_0x3e1b91,_0x5e5b26){_0x3e1b91=_0x3e1b91-0x0;var _0x144259=_0x474f[_0x3e1b91];return _0x144259;};'use strict';var OpenchannelInteractionEvents=require(_0xf474('0x0'));var events=[_0xf474('0x1'),_0xf474('0x2'),_0xf474('0x3')];function createListener(_0x178689,_0x51d0c8){return function(_0x5a4713){_0x51d0c8[_0xf474('0x4')](_0x178689,_0x5a4713);};}function removeListener(_0x51d1c4,_0x594003){return function(){OpenchannelInteractionEvents[_0xf474('0x5')](_0x51d1c4,_0x594003);};}exports[_0xf474('0x6')]=function(_0x5524b0){for(var _0x20d33b=0x0,_0x463430=events[_0xf474('0x7')];_0x20d33b<_0x463430;_0x20d33b++){var _0x1bf421=events[_0x20d33b];var _0x2d67f3=createListener(_0xf474('0x8')+_0x1bf421,_0x5524b0);OpenchannelInteractionEvents['on'](_0x1bf421,_0x2d67f3);}}; \ No newline at end of file +var _0x9015=['emit','removeListener','register','length','openchannelInteraction:','save','remove'];(function(_0x50e818,_0x68ddd1){var _0x58fa49=function(_0x43eefe){while(--_0x43eefe){_0x50e818['push'](_0x50e818['shift']());}};_0x58fa49(++_0x68ddd1);}(_0x9015,0x1e8));var _0x5901=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x9015[_0x1203f];return _0x365f0a;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x5901('0x0'),_0x5901('0x1'),'update'];function createListener(_0x55286a,_0x570d9b){return function(_0x53b622){_0x570d9b[_0x5901('0x2')](_0x55286a,_0x53b622);};}function removeListener(_0x22bc9d,_0x7d632c){return function(){OpenchannelInteractionEvents[_0x5901('0x3')](_0x22bc9d,_0x7d632c);};}exports[_0x5901('0x4')]=function(_0x6253f7){for(var _0x5e49ca=0x0,_0x36eb90=events[_0x5901('0x5')];_0x5e49ca<_0x36eb90;_0x5e49ca++){var _0x4cb7e3=events[_0x5e49ca];var _0x433695=createListener(_0x5901('0x6')+_0x4cb7e3,_0x6253f7);OpenchannelInteractionEvents['on'](_0x4cb7e3,_0x433695);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 427ddae..4c2a3e8 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x382f4f,_0x38a4a3){var _0x35c689=function(_0x5c1abf){while(--_0x5c1abf){_0x382f4f['push'](_0x382f4f['shift']());}};_0x35c689(++_0x38a4a3);}(_0xe706,0xa3));var _0x6e70=function(_0xda6d0f,_0x35e271){_0xda6d0f=_0xda6d0f-0x0;var _0x244540=_0xe706[_0xda6d0f];return _0x244540;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x2b18e9,_0x18e52f){var _0x9d0c32=function(_0x3ba0ba){while(--_0x3ba0ba){_0x2b18e9['push'](_0x2b18e9['shift']());}};_0x9d0c32(++_0x18e52f);}(_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('./openchannelMessage.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')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 7685dee..5c4c63d 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 _0xc06d=['BOOLEAN','ENUM','DATE','sequelize','exports','TEXT','medium'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0xc06d,0x15a));var _0xdc06=function(_0xd66a9a,_0x1eacb3){_0xd66a9a=_0xd66a9a-0x0;var _0x2f033f=_0xc06d[_0xd66a9a];return _0x2f033f;};'use strict';var Sequelize=require(_0xdc06('0x0'));module[_0xdc06('0x1')]={'body':{'type':Sequelize[_0xdc06('0x2')](_0xdc06('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xdc06('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdc06('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xdc06('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xdc06('0x2')]}}; \ No newline at end of file +var _0x57f8=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x5ad66c,_0x3da763){var _0x16cd4b=function(_0x21b3a2){while(--_0x21b3a2){_0x5ad66c['push'](_0x5ad66c['shift']());}};_0x16cd4b(++_0x3da763);}(_0x57f8,0x198));var _0x857f=function(_0x34d2a0,_0x6cde4f){_0x34d2a0=_0x34d2a0-0x0;var _0x505c5b=_0x57f8[_0x34d2a0];return _0x505c5b;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'body':{'type':Sequelize[_0x857f('0x1')](_0x857f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x857f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x857f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x857f('0x4')]('in',_0x857f('0x5')),'defaultValue':_0x857f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x857f('0x6')]},'providerName':{'type':Sequelize[_0x857f('0x7')]},'providerResponse':{'type':Sequelize[_0x857f('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 2aae38b..a7662c2 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 _0x64e8=['openchannel-interactions','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','includeAll','find','create','body','describe','accept','openchannel','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','interaction','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','reject','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','http','client'];(function(_0x2d16c3,_0x2652c3){var _0x5586e3=function(_0x1182b1){while(--_0x1182b1){_0x2d16c3['push'](_0x2d16c3['shift']());}};_0x5586e3(++_0x2652c3);}(_0x64e8,0x181));var _0x864e=function(_0x18e684,_0x2ec7ff){_0x18e684=_0x18e684-0x0;var _0xbac9f9=_0x64e8[_0x18e684];return _0xbac9f9;};'use strict';var util=require(_0x864e('0x0'));var _=require(_0x864e('0x1'));var Redis=require(_0x864e('0x2'));var interactionService=require(_0x864e('0x3'));var qs=require(_0x864e('0x4'));var logger=require(_0x864e('0x5'))(_0x864e('0x6'));var config=require(_0x864e('0x7'));var db=require(_0x864e('0x8'))['db'];config[_0x864e('0x9')]=_['defaults'](config['redis'],{'host':_0x864e('0xa'),'port':0x18eb});var socket=require(_0x864e('0xb'))(new Redis(config[_0x864e('0x9')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x864e('0xc'));var client=jayson['client'][_0x864e('0xd')]({'port':0x232c});var client9002=jayson[_0x864e('0xe')][_0x864e('0xd')]({'port':0x232a});var interaction_log=require(_0x864e('0x5'))(_0x864e('0xf'));function respondWithRpcPromise(_0x10c1fe,_0x589383,_0x36d7ea,_0x371b8d){return new Promise(function(_0xa22c22,_0x55cb24){var _0x643f4e=_0x371b8d||client;return _0x643f4e[_0x864e('0x10')](_0x10c1fe,_0x36d7ea)[_0x864e('0x11')](function(_0x59f207){logger[_0x864e('0x12')](_0x864e('0x13'),_0x589383,_0x864e('0x14'));logger[_0x864e('0x15')](_0x864e('0x16'),_0x589383,'request\x20sent',JSON[_0x864e('0x17')](_0x59f207));if(_0x59f207[_0x864e('0x18')]){if(_0x59f207[_0x864e('0x18')][_0x864e('0x19')]===0x1f4){logger[_0x864e('0x18')](_0x864e('0x13'),_0x589383,_0x59f207[_0x864e('0x18')][_0x864e('0x1a')]);return _0x55cb24(_0x59f207[_0x864e('0x18')][_0x864e('0x1a')]);}logger[_0x864e('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x589383,_0x59f207[_0x864e('0x18')][_0x864e('0x1a')]);return _0xa22c22(_0x59f207[_0x864e('0x18')][_0x864e('0x1a')]);}else{logger['info'](_0x864e('0x13'),_0x589383,_0x864e('0x14'));_0xa22c22(_0x59f207['result'][_0x864e('0x1a')]);}})[_0x864e('0x1b')](function(_0x5f16d5){logger[_0x864e('0x18')](_0x864e('0x13'),_0x589383,_0x5f16d5);_0x55cb24(_0x5f16d5);});});}function respondWithResult(_0x453c66,_0x40c782){_0x40c782=_0x40c782||0xc8;return function(_0x1e0e1d){if(_0x1e0e1d){return _0x453c66[_0x864e('0x1c')](_0x40c782)[_0x864e('0x1d')](_0x1e0e1d);}};}function respondWithFilteredResult(_0x3d364f,_0xc7680b){return function(_0x37bfe9){if(_0x37bfe9){var _0xc5c5cf=typeof _0xc7680b[_0x864e('0x1e')]==='undefined'&&typeof _0xc7680b[_0x864e('0x1f')]===_0x864e('0x20');var _0x16a988=_0x37bfe9['count'];var _0x59816c=_0xc5c5cf?0x0:_0xc7680b[_0x864e('0x1e')];var _0x357322=_0xc5c5cf?_0x37bfe9[_0x864e('0x21')]:_0xc7680b['offset']+_0xc7680b[_0x864e('0x1f')];var _0x100802;if(_0x357322>=_0x16a988){_0x357322=_0x16a988;_0x100802=0xc8;}else{_0x100802=0xce;}_0x3d364f[_0x864e('0x1c')](_0x100802);return _0x3d364f[_0x864e('0x22')](_0x864e('0x23'),_0x59816c+'-'+_0x357322+'/'+_0x16a988)[_0x864e('0x1d')](_0x37bfe9);}return null;};}function saveUpdates(_0x23d84c){return function(_0x51fb09){if(_0x51fb09){return _0x51fb09[_0x864e('0x24')](_0x23d84c)[_0x864e('0x11')](function(_0xda4954){return _0xda4954;});}return null;};}function removeEntity(_0x922508){return function(_0x4404ed){if(_0x4404ed){return _0x4404ed[_0x864e('0x25')]()[_0x864e('0x11')](function(){_0x922508[_0x864e('0x1c')](0xcc)[_0x864e('0x26')]();});}};}function handleEntityNotFound(_0x45af8f){return function(_0x335d64){if(!_0x335d64){_0x45af8f[_0x864e('0x27')](0x194);}return _0x335d64;};}function handleError(_0x4592d9,_0x3bde65){_0x3bde65=_0x3bde65||0x1f4;return function(_0xeef91c){logger['error'](_0xeef91c[_0x864e('0x28')]);if(_0xeef91c[_0x864e('0x29')]){delete _0xeef91c['name'];}_0x4592d9[_0x864e('0x1c')](_0x3bde65)['send'](_0xeef91c);};}exports['index']=function(_0x241a65,_0x46b5b9){var _0x82dd92={},_0x1ab701={},_0x4c2db2={'count':0x0,'rows':[]};var _0x19f3a7=_[_0x864e('0x2a')](db[_0x864e('0x2b')][_0x864e('0x2c')],function(_0xcc0f26){return{'name':_0xcc0f26[_0x864e('0x2d')],'type':_0xcc0f26[_0x864e('0x2e')][_0x864e('0x2f')]};});_0x1ab701[_0x864e('0x30')]=_['map'](_0x19f3a7,_0x864e('0x29'));_0x1ab701[_0x864e('0x31')]=_['keys'](_0x241a65[_0x864e('0x31')]);_0x1ab701[_0x864e('0x32')]=_['intersection'](_0x1ab701[_0x864e('0x30')],_0x1ab701['query']);_0x82dd92[_0x864e('0x33')]=_[_0x864e('0x34')](_0x1ab701[_0x864e('0x30')],qs['fields'](_0x241a65['query'][_0x864e('0x35')]));_0x82dd92[_0x864e('0x33')]=_0x82dd92[_0x864e('0x33')][_0x864e('0x36')]?_0x82dd92[_0x864e('0x33')]:_0x1ab701[_0x864e('0x30')];if(!_0x241a65[_0x864e('0x31')][_0x864e('0x37')](_0x864e('0x38'))){_0x82dd92['limit']=qs['limit'](_0x241a65[_0x864e('0x31')][_0x864e('0x1f')]);_0x82dd92['offset']=qs[_0x864e('0x1e')](_0x241a65[_0x864e('0x31')]['offset']);}_0x82dd92[_0x864e('0x39')]=qs[_0x864e('0x3a')](_0x241a65[_0x864e('0x31')]['sort']);_0x82dd92['where']=qs[_0x864e('0x32')](_[_0x864e('0x3b')](_0x241a65['query'],_0x1ab701['filters']),_0x19f3a7);if(_0x241a65['query'][_0x864e('0x3c')]){_0x82dd92[_0x864e('0x3d')]=_[_0x864e('0x3e')](_0x82dd92['where'],{'$or':_[_0x864e('0x2a')](_0x19f3a7,function(_0x1e38c7){if(_0x1e38c7['type']!==_0x864e('0x3f')){var _0x962133={};_0x962133[_0x1e38c7[_0x864e('0x29')]]={'$like':'%'+_0x241a65['query'][_0x864e('0x3c')]+'%'};return _0x962133;}})});}_0x82dd92=_[_0x864e('0x3e')]({},_0x82dd92,_0x241a65[_0x864e('0x40')]);var _0x50f1ce={'where':_0x82dd92[_0x864e('0x3d')]};return db[_0x864e('0x2b')][_0x864e('0x21')](_0x50f1ce)[_0x864e('0x11')](function(_0x33b9bf){_0x4c2db2['count']=_0x33b9bf;if(_0x241a65[_0x864e('0x31')]['includeAll']){_0x82dd92[_0x864e('0x41')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x864e('0x42')](_0x82dd92);})[_0x864e('0x11')](function(_0x3c85cf){_0x4c2db2['rows']=_0x3c85cf;return _0x4c2db2;})[_0x864e('0x11')](respondWithFilteredResult(_0x46b5b9,_0x82dd92))['catch'](handleError(_0x46b5b9,null));};exports[_0x864e('0x43')]=function(_0x59f905,_0x4d290f){var _0x5457b6={'raw':!![],'where':{'id':_0x59f905[_0x864e('0x44')]['id']}},_0x585acf={};_0x585acf[_0x864e('0x30')]=_['keys'](db[_0x864e('0x2b')][_0x864e('0x2c')]);_0x585acf[_0x864e('0x31')]=_['keys'](_0x59f905[_0x864e('0x31')]);_0x585acf[_0x864e('0x32')]=_[_0x864e('0x34')](_0x585acf[_0x864e('0x30')],_0x585acf[_0x864e('0x31')]);_0x5457b6[_0x864e('0x33')]=_[_0x864e('0x34')](_0x585acf[_0x864e('0x30')],qs[_0x864e('0x35')](_0x59f905[_0x864e('0x31')][_0x864e('0x35')]));_0x5457b6[_0x864e('0x33')]=_0x5457b6[_0x864e('0x33')]['length']?_0x5457b6[_0x864e('0x33')]:_0x585acf['model'];if(_0x59f905[_0x864e('0x31')][_0x864e('0x45')]){_0x5457b6[_0x864e('0x41')]=[{'all':!![]}];}_0x5457b6=_['merge']({},_0x5457b6,_0x59f905[_0x864e('0x40')]);return db[_0x864e('0x2b')][_0x864e('0x46')](_0x5457b6)[_0x864e('0x11')](handleEntityNotFound(_0x4d290f,null))[_0x864e('0x11')](respondWithResult(_0x4d290f,null))['catch'](handleError(_0x4d290f,null));};exports[_0x864e('0x47')]=function(_0x28c792,_0x21ecc4){return db[_0x864e('0x2b')][_0x864e('0x47')](_0x28c792[_0x864e('0x48')],{})[_0x864e('0x11')](respondWithResult(_0x21ecc4,0xc9))[_0x864e('0x1b')](handleError(_0x21ecc4,null));};exports[_0x864e('0x24')]=function(_0x3d73ed,_0x2544c3){if(_0x3d73ed['body']['id']){delete _0x3d73ed[_0x864e('0x48')]['id'];}return db[_0x864e('0x2b')]['find']({'where':{'id':_0x3d73ed['params']['id']}})[_0x864e('0x11')](handleEntityNotFound(_0x2544c3,null))[_0x864e('0x11')](saveUpdates(_0x3d73ed['body'],null))[_0x864e('0x11')](respondWithResult(_0x2544c3,null))[_0x864e('0x1b')](handleError(_0x2544c3,null));};exports[_0x864e('0x25')]=function(_0x30a1e1,_0x2fe38a){return db[_0x864e('0x2b')]['find']({'where':{'id':_0x30a1e1[_0x864e('0x44')]['id']}})[_0x864e('0x11')](handleEntityNotFound(_0x2fe38a,null))[_0x864e('0x11')](removeEntity(_0x2fe38a,null))[_0x864e('0x1b')](handleError(_0x2fe38a,null));};exports['describe']=function(_0x13ae8b,_0x4318e1){return db[_0x864e('0x2b')][_0x864e('0x49')]()['then'](respondWithResult(_0x4318e1,null))['catch'](handleError(_0x4318e1,null));};exports[_0x864e('0x4a')]=function(_0x2a3c1c,_0x3a6b87){var _0x8b14ef='openchannel';return interactionService['acceptMessage'](_0x2a3c1c,_0x8b14ef)[_0x864e('0x11')](respondWithResult(_0x3a6b87,null))[_0x864e('0x1b')](handleError(_0x3a6b87,null));};exports['reject']=function(_0x588c35,_0x165e79){var _0x5282fe={'agent':{},'channel':_0x864e('0x4b')};if(_0x588c35[_0x864e('0x48')]['id']){delete _0x588c35[_0x864e('0x48')]['id'];}_0x588c35[_0x864e('0x48')][_0x864e('0x4c')]=_0x588c35[_0x864e('0x48')][_0x864e('0x4c')]||_0x588c35[_0x864e('0x4d')]['id'];_0x5282fe[_0x864e('0x4e')]['id']=_0x588c35[_0x864e('0x48')][_0x864e('0x4c')];return db[_0x864e('0x2b')][_0x864e('0x46')]({'where':{'id':_0x588c35[_0x864e('0x44')]['id'],'UserId':null}})[_0x864e('0x11')](handleEntityNotFound(_0x165e79,null))[_0x864e('0x11')](function(_0x4c92ee){if(_0x4c92ee){_0x5282fe[_0x864e('0x1a')]=_0x4c92ee['get']({'plain':!![]});return db[_0x864e('0x4f')]['find']({'where':{'id':_0x4c92ee[_0x864e('0x50')]}});}return null;})[_0x864e('0x11')](handleEntityNotFound(_0x165e79,null))[_0x864e('0x11')](function(_0x308df8){if(_0x308df8){_0x5282fe[_0x864e('0x51')]=_0x308df8[_0x864e('0x52')]({'plain':!![]});interaction_log[_0x864e('0x12')](_0x864e('0x53'),_0x588c35[_0x864e('0x4d')]['id'],_0x588c35[_0x864e('0x4d')]['name'],_0x588c35[_0x864e('0x4d')][_0x864e('0x54')],_0x5282fe[_0x864e('0x51')]['id'],_0x588c35['body']?JSON[_0x864e('0x17')](_0x588c35[_0x864e('0x48')]):'null');return respondWithRpcPromise(_0x864e('0x55'),'rejectMessage',_0x5282fe);}return null;})[_0x864e('0x11')](function(_0x168a25){var _0x270bfa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x168a25[_0x864e('0x1a')][_0x864e('0x56')];return db[_0x864e('0x57')][_0x864e('0x31')](_0x270bfa,{'type':db[_0x864e('0x58')][_0x864e('0x59')][_0x864e('0x5a')],'raw':!![]})['then'](function(_0x5bb3be){return _0x5bb3be;});})[_0x864e('0x11')](function(_0x2ba28d){if(_0x2ba28d){_0x5282fe[_0x864e('0x1a')][_0x864e('0x5b')]=_0x2ba28d[0x0];if(!_0x588c35[_0x864e('0x48')]['UserId'])return;return db[_0x864e('0x5c')]['find']({'where':{'id':_0x588c35[_0x864e('0x48')][_0x864e('0x4c')],'role':_0x864e('0x4e')},'attributes':['id','name',_0x864e('0x5d'),_0x864e('0x5e'),_0x864e('0x5f')],'raw':!![]});}return null;})['then'](function(_0x2efed9){if(!_0x2efed9)return null;_0x5282fe[_0x864e('0x1a')][_0x864e('0x4e')]=_0x2efed9;return _0x5282fe;})[_0x864e('0x11')](function(_0x16a6f8){if(_0x16a6f8){_0x16a6f8[_0x864e('0x1a')]['interface']=util['format'](_0x864e('0x60'),_0x588c35[_0x864e('0x4d')]['name']);_0x16a6f8['message']['channel']=_0x5282fe['channel'];_0x16a6f8[_0x864e('0x1a')]['motionChannel']=_0x5282fe['channel'];_0x16a6f8[_0x864e('0x1a')]['event']=_0x864e('0x61');respondWithRpcPromise('EventManager',_0x864e('0x62'),{'event':_0x864e('0x63'),'message':_0x16a6f8[_0x864e('0x1a')]},client9002);return _0x5282fe;}return null;})[_0x864e('0x11')](respondWithResult(_0x165e79,null))[_0x864e('0x1b')](handleError(_0x165e79,null));}; \ No newline at end of file +var _0x1772=['api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','openchannel-interactions','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','OpenchannelMessage','type','key','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','create','body','update','find','describe','accept','openchannel','acceptMessage','reject','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','interaction','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','fullname','internal','interface','channel','motionChannel','event','EventManager','rejectmessage','util','lodash','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x1772,0x130));var _0x2177=function(_0x3fbb15,_0x4ade43){_0x3fbb15=_0x3fbb15-0x0;var _0x16fe3a=_0x1772[_0x3fbb15];return _0x16fe3a;};'use strict';var util=require(_0x2177('0x0'));var _=require(_0x2177('0x1'));var Redis=require(_0x2177('0x2'));var interactionService=require('../../components/interaction/service');var qs=require(_0x2177('0x3'));var logger=require(_0x2177('0x4'))(_0x2177('0x5'));var config=require(_0x2177('0x6'));var db=require(_0x2177('0x7'))['db'];config[_0x2177('0x8')]=_['defaults'](config[_0x2177('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x2177('0x9'))(new Redis(config['redis']));require(_0x2177('0xa'))['register'](socket);var jayson=require(_0x2177('0xb'));var client=jayson[_0x2177('0xc')][_0x2177('0xd')]({'port':0x232c});var client9002=jayson[_0x2177('0xc')]['http']({'port':0x232a});var interaction_log=require(_0x2177('0x4'))(_0x2177('0xe'));function respondWithRpcPromise(_0x1ccfce,_0x2ff5ad,_0x1cacca,_0x11874a){return new Promise(function(_0x109fdb,_0x2366f3){var _0x3bbfd1=_0x11874a||client;return _0x3bbfd1[_0x2177('0xf')](_0x1ccfce,_0x1cacca)[_0x2177('0x10')](function(_0x1a0ab1){logger[_0x2177('0x11')](_0x2177('0x12'),_0x2ff5ad,_0x2177('0x13'));logger[_0x2177('0x14')](_0x2177('0x15'),_0x2ff5ad,'request\x20sent',JSON['stringify'](_0x1a0ab1));if(_0x1a0ab1[_0x2177('0x16')]){if(_0x1a0ab1[_0x2177('0x16')][_0x2177('0x17')]===0x1f4){logger[_0x2177('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x2ff5ad,_0x1a0ab1[_0x2177('0x16')][_0x2177('0x18')]);return _0x2366f3(_0x1a0ab1[_0x2177('0x16')][_0x2177('0x18')]);}logger[_0x2177('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x2ff5ad,_0x1a0ab1['error'][_0x2177('0x18')]);return _0x109fdb(_0x1a0ab1[_0x2177('0x16')]['message']);}else{logger['info'](_0x2177('0x12'),_0x2ff5ad,_0x2177('0x13'));_0x109fdb(_0x1a0ab1['result'][_0x2177('0x18')]);}})[_0x2177('0x19')](function(_0x2c4e98){logger[_0x2177('0x16')](_0x2177('0x12'),_0x2ff5ad,_0x2c4e98);_0x2366f3(_0x2c4e98);});});}function respondWithResult(_0x8f7681,_0x3fcc8e){_0x3fcc8e=_0x3fcc8e||0xc8;return function(_0x4b71e5){if(_0x4b71e5){return _0x8f7681[_0x2177('0x1a')](_0x3fcc8e)[_0x2177('0x1b')](_0x4b71e5);}};}function respondWithFilteredResult(_0x48810f,_0x23b5fd){return function(_0x5351ea){if(_0x5351ea){var _0x5d9c70=typeof _0x23b5fd[_0x2177('0x1c')]===_0x2177('0x1d')&&typeof _0x23b5fd[_0x2177('0x1e')]==='undefined';var _0x1f86d9=_0x5351ea[_0x2177('0x1f')];var _0xd37cac=_0x5d9c70?0x0:_0x23b5fd[_0x2177('0x1c')];var _0x984edb=_0x5d9c70?_0x5351ea[_0x2177('0x1f')]:_0x23b5fd[_0x2177('0x1c')]+_0x23b5fd[_0x2177('0x1e')];var _0x5608be;if(_0x984edb>=_0x1f86d9){_0x984edb=_0x1f86d9;_0x5608be=0xc8;}else{_0x5608be=0xce;}_0x48810f[_0x2177('0x1a')](_0x5608be);return _0x48810f[_0x2177('0x20')](_0x2177('0x21'),_0xd37cac+'-'+_0x984edb+'/'+_0x1f86d9)[_0x2177('0x1b')](_0x5351ea);}return null;};}function saveUpdates(_0x48e16c){return function(_0x2a942a){if(_0x2a942a){return _0x2a942a['update'](_0x48e16c)[_0x2177('0x10')](function(_0x1c1d0e){return _0x1c1d0e;});}return null;};}function removeEntity(_0xdb47ac){return function(_0x12158e){if(_0x12158e){return _0x12158e[_0x2177('0x22')]()[_0x2177('0x10')](function(){_0xdb47ac[_0x2177('0x1a')](0xcc)[_0x2177('0x23')]();});}};}function handleEntityNotFound(_0x57c19b){return function(_0x1a0266){if(!_0x1a0266){_0x57c19b[_0x2177('0x24')](0x194);}return _0x1a0266;};}function handleError(_0x53bfaa,_0x1f5726){_0x1f5726=_0x1f5726||0x1f4;return function(_0x2c9d85){logger['error'](_0x2c9d85[_0x2177('0x25')]);if(_0x2c9d85[_0x2177('0x26')]){delete _0x2c9d85['name'];}_0x53bfaa[_0x2177('0x1a')](_0x1f5726)[_0x2177('0x27')](_0x2c9d85);};}exports[_0x2177('0x28')]=function(_0x387baa,_0x40c137){var _0x1abf2b={},_0x567072={},_0x2ef7f5={'count':0x0,'rows':[]};var _0x7320b8=_[_0x2177('0x29')](db[_0x2177('0x2a')]['rawAttributes'],function(_0x16d06e){return{'name':_0x16d06e['fieldName'],'type':_0x16d06e[_0x2177('0x2b')][_0x2177('0x2c')]};});_0x567072['model']=_[_0x2177('0x29')](_0x7320b8,'name');_0x567072[_0x2177('0x2d')]=_['keys'](_0x387baa[_0x2177('0x2d')]);_0x567072['filters']=_['intersection'](_0x567072[_0x2177('0x2e')],_0x567072['query']);_0x1abf2b['attributes']=_[_0x2177('0x2f')](_0x567072[_0x2177('0x2e')],qs[_0x2177('0x30')](_0x387baa['query'][_0x2177('0x30')]));_0x1abf2b[_0x2177('0x31')]=_0x1abf2b['attributes'][_0x2177('0x32')]?_0x1abf2b[_0x2177('0x31')]:_0x567072[_0x2177('0x2e')];if(!_0x387baa['query'][_0x2177('0x33')](_0x2177('0x34'))){_0x1abf2b[_0x2177('0x1e')]=qs['limit'](_0x387baa['query'][_0x2177('0x1e')]);_0x1abf2b[_0x2177('0x1c')]=qs[_0x2177('0x1c')](_0x387baa[_0x2177('0x2d')][_0x2177('0x1c')]);}_0x1abf2b[_0x2177('0x35')]=qs[_0x2177('0x36')](_0x387baa['query'][_0x2177('0x36')]);_0x1abf2b[_0x2177('0x37')]=qs[_0x2177('0x38')](_['pick'](_0x387baa[_0x2177('0x2d')],_0x567072[_0x2177('0x38')]),_0x7320b8);if(_0x387baa[_0x2177('0x2d')][_0x2177('0x39')]){_0x1abf2b['where']=_['merge'](_0x1abf2b['where'],{'$or':_[_0x2177('0x29')](_0x7320b8,function(_0x2921f9){if(_0x2921f9['type']!=='VIRTUAL'){var _0x352a86={};_0x352a86[_0x2921f9['name']]={'$like':'%'+_0x387baa['query'][_0x2177('0x39')]+'%'};return _0x352a86;}})});}_0x1abf2b=_[_0x2177('0x3a')]({},_0x1abf2b,_0x387baa[_0x2177('0x3b')]);var _0xb1698a={'where':_0x1abf2b[_0x2177('0x37')]};return db[_0x2177('0x2a')]['count'](_0xb1698a)[_0x2177('0x10')](function(_0x695b14){_0x2ef7f5[_0x2177('0x1f')]=_0x695b14;if(_0x387baa[_0x2177('0x2d')][_0x2177('0x3c')]){_0x1abf2b[_0x2177('0x3d')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x2177('0x3e')](_0x1abf2b);})[_0x2177('0x10')](function(_0x3f16a0){_0x2ef7f5[_0x2177('0x3f')]=_0x3f16a0;return _0x2ef7f5;})[_0x2177('0x10')](respondWithFilteredResult(_0x40c137,_0x1abf2b))[_0x2177('0x19')](handleError(_0x40c137,null));};exports['show']=function(_0x5688f8,_0x2d711c){var _0x4b327f={'raw':!![],'where':{'id':_0x5688f8[_0x2177('0x40')]['id']}},_0x50eb64={};_0x50eb64[_0x2177('0x2e')]=_[_0x2177('0x41')](db[_0x2177('0x2a')][_0x2177('0x42')]);_0x50eb64[_0x2177('0x2d')]=_[_0x2177('0x41')](_0x5688f8[_0x2177('0x2d')]);_0x50eb64[_0x2177('0x38')]=_['intersection'](_0x50eb64[_0x2177('0x2e')],_0x50eb64[_0x2177('0x2d')]);_0x4b327f[_0x2177('0x31')]=_['intersection'](_0x50eb64[_0x2177('0x2e')],qs[_0x2177('0x30')](_0x5688f8['query'][_0x2177('0x30')]));_0x4b327f[_0x2177('0x31')]=_0x4b327f[_0x2177('0x31')][_0x2177('0x32')]?_0x4b327f['attributes']:_0x50eb64['model'];if(_0x5688f8[_0x2177('0x2d')][_0x2177('0x3c')]){_0x4b327f['include']=[{'all':!![]}];}_0x4b327f=_[_0x2177('0x3a')]({},_0x4b327f,_0x5688f8[_0x2177('0x3b')]);return db[_0x2177('0x2a')]['find'](_0x4b327f)[_0x2177('0x10')](handleEntityNotFound(_0x2d711c,null))[_0x2177('0x10')](respondWithResult(_0x2d711c,null))[_0x2177('0x19')](handleError(_0x2d711c,null));};exports[_0x2177('0x43')]=function(_0x70b080,_0x117b10){return db['OpenchannelMessage'][_0x2177('0x43')](_0x70b080[_0x2177('0x44')],{})[_0x2177('0x10')](respondWithResult(_0x117b10,0xc9))[_0x2177('0x19')](handleError(_0x117b10,null));};exports[_0x2177('0x45')]=function(_0x103008,_0x4e6574){if(_0x103008[_0x2177('0x44')]['id']){delete _0x103008[_0x2177('0x44')]['id'];}return db['OpenchannelMessage'][_0x2177('0x46')]({'where':{'id':_0x103008[_0x2177('0x40')]['id']}})['then'](handleEntityNotFound(_0x4e6574,null))[_0x2177('0x10')](saveUpdates(_0x103008[_0x2177('0x44')],null))[_0x2177('0x10')](respondWithResult(_0x4e6574,null))[_0x2177('0x19')](handleError(_0x4e6574,null));};exports['destroy']=function(_0x308244,_0x3c6c26){return db[_0x2177('0x2a')]['find']({'where':{'id':_0x308244[_0x2177('0x40')]['id']}})[_0x2177('0x10')](handleEntityNotFound(_0x3c6c26,null))['then'](removeEntity(_0x3c6c26,null))[_0x2177('0x19')](handleError(_0x3c6c26,null));};exports[_0x2177('0x47')]=function(_0xbadc8b,_0xc2b968){return db[_0x2177('0x2a')][_0x2177('0x47')]()[_0x2177('0x10')](respondWithResult(_0xc2b968,null))[_0x2177('0x19')](handleError(_0xc2b968,null));};exports[_0x2177('0x48')]=function(_0x164666,_0x442517){var _0x4745fc=_0x2177('0x49');return interactionService[_0x2177('0x4a')](_0x164666,_0x4745fc)[_0x2177('0x10')](respondWithResult(_0x442517,null))['catch'](handleError(_0x442517,null));};exports[_0x2177('0x4b')]=function(_0x416613,_0x2d982d){var _0x4aa5e7={'agent':{},'channel':_0x2177('0x49')};if(_0x416613['body']['id']){delete _0x416613['body']['id'];}_0x416613['body'][_0x2177('0x4c')]=_0x416613[_0x2177('0x44')]['UserId']||_0x416613[_0x2177('0x4d')]['id'];_0x4aa5e7[_0x2177('0x4e')]['id']=_0x416613[_0x2177('0x44')]['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0x416613[_0x2177('0x40')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d982d,null))['then'](function(_0x72d1df){if(_0x72d1df){_0x4aa5e7[_0x2177('0x18')]=_0x72d1df['get']({'plain':!![]});return db[_0x2177('0x4f')]['find']({'where':{'id':_0x72d1df[_0x2177('0x50')]}});}return null;})[_0x2177('0x10')](handleEntityNotFound(_0x2d982d,null))[_0x2177('0x10')](function(_0xba952d){if(_0xba952d){_0x4aa5e7[_0x2177('0x51')]=_0xba952d[_0x2177('0x52')]({'plain':!![]});interaction_log[_0x2177('0x11')](_0x2177('0x53'),_0x416613['user']['id'],_0x416613[_0x2177('0x4d')][_0x2177('0x26')],_0x416613[_0x2177('0x4d')][_0x2177('0x54')],_0x4aa5e7[_0x2177('0x51')]['id'],_0x416613[_0x2177('0x44')]?JSON[_0x2177('0x55')](_0x416613[_0x2177('0x44')]):_0x2177('0x56'));return respondWithRpcPromise(_0x2177('0x57'),_0x2177('0x58'),_0x4aa5e7);}return null;})[_0x2177('0x10')](function(_0x53e916){var _0x52b7b0=_0x2177('0x59')+_0x53e916[_0x2177('0x18')][_0x2177('0x5a')];return db['sequelize']['query'](_0x52b7b0,{'type':db['Sequelize'][_0x2177('0x5b')][_0x2177('0x5c')],'raw':!![]})['then'](function(_0x581f8e){return _0x581f8e;});})[_0x2177('0x10')](function(_0x5d5a74){if(_0x5d5a74){_0x4aa5e7[_0x2177('0x18')][_0x2177('0x5d')]=_0x5d5a74[0x0];if(!_0x416613[_0x2177('0x44')][_0x2177('0x4c')])return;return db[_0x2177('0x5e')]['find']({'where':{'id':_0x416613[_0x2177('0x44')]['UserId'],'role':'agent'},'attributes':['id',_0x2177('0x26'),_0x2177('0x5f'),'email',_0x2177('0x60')],'raw':!![]});}return null;})[_0x2177('0x10')](function(_0x4f8012){if(!_0x4f8012)return null;_0x4aa5e7[_0x2177('0x18')][_0x2177('0x4e')]=_0x4f8012;return _0x4aa5e7;})[_0x2177('0x10')](function(_0xd09cba){if(_0xd09cba){_0xd09cba['message'][_0x2177('0x61')]=util['format']('SIP/%s',_0x416613[_0x2177('0x4d')][_0x2177('0x26')]);_0xd09cba['message'][_0x2177('0x62')]=_0x4aa5e7['channel'];_0xd09cba[_0x2177('0x18')][_0x2177('0x63')]=_0x4aa5e7[_0x2177('0x62')];_0xd09cba[_0x2177('0x18')][_0x2177('0x64')]=_0x2177('0x4b');respondWithRpcPromise('EventManager',_0x2177('0x65'),{'event':_0x2177('0x66'),'message':_0xd09cba[_0x2177('0x18')]},client9002);return _0x4aa5e7;}return null;})[_0x2177('0x10')](respondWithResult(_0x2d982d,null))[_0x2177('0x19')](handleError(_0x2d982d,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 19e8114..d306add 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 _0x3d15=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3d15,0x81));var _0x53d1=function(_0x342967,_0x176fd7){_0x342967=_0x342967-0x0;var _0x393b7e=_0x3d15[_0x342967];return _0x393b7e;};'use strict';var EventEmitter=require(_0x53d1('0x0'));var OpenchannelMessage=require(_0x53d1('0x1'))['db'][_0x53d1('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x53d1('0x3')](0x0);var events={'afterCreate':_0x53d1('0x4'),'afterUpdate':_0x53d1('0x5'),'afterDestroy':_0x53d1('0x6')};function emitEvent(_0x4e85a8){return function(_0x2e2717,_0x1890f2,_0xe53b25){OpenchannelMessageEvents['emit'](_0x4e85a8+':'+_0x2e2717['id'],_0x2e2717);OpenchannelMessageEvents[_0x53d1('0x7')](_0x4e85a8,_0x2e2717);_0xe53b25(null);};}for(var e in events){if(events[_0x53d1('0x8')](e)){var event=events[e];OpenchannelMessage[_0x53d1('0x9')](e,emitEvent(event));}}module[_0x53d1('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x1f38=['hook','exports','../../mysqldb','OpenchannelMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x29e2af,_0x15e2b1){var _0x1ea06a=function(_0x34d736){while(--_0x34d736){_0x29e2af['push'](_0x29e2af['shift']());}};_0x1ea06a(++_0x15e2b1);}(_0x1f38,0x158));var _0x81f3=function(_0x4bb94b,_0x50628a){_0x4bb94b=_0x4bb94b-0x0;var _0x36dcc6=_0x1f38[_0x4bb94b];return _0x36dcc6;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x81f3('0x0'))['db'][_0x81f3('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x81f3('0x2'),'afterUpdate':_0x81f3('0x3'),'afterDestroy':_0x81f3('0x4')};function emitEvent(_0x581cb7){return function(_0x405e7e,_0x2a394f,_0x350476){OpenchannelMessageEvents[_0x81f3('0x5')](_0x581cb7+':'+_0x405e7e['id'],_0x405e7e);OpenchannelMessageEvents['emit'](_0x581cb7,_0x405e7e);_0x350476(null);};}for(var e in events){if(events[_0x81f3('0x6')](e)){var event=events[e];OpenchannelMessage[_0x81f3('0x7')](e,emitEvent(event));}}module[_0x81f3('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 2edfe6f..7d7f715 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 _0x1a9f=['rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','find','OpenchannelAccountId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a9f,0x150));var _0xf1a9=function(_0x31b9cf,_0x1a809b){_0x31b9cf=_0x31b9cf-0x0;var _0x357b8a=_0x1a9f[_0x31b9cf];return _0x357b8a;};'use strict';var _=require(_0xf1a9('0x0'));var util=require(_0xf1a9('0x1'));var logger=require(_0xf1a9('0x2'))(_0xf1a9('0x3'));var moment=require(_0xf1a9('0x4'));var BPromise=require(_0xf1a9('0x5'));var rp=require(_0xf1a9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf1a9('0x7'));var config=require(_0xf1a9('0x8'));var attributes=require(_0xf1a9('0x9'));module[_0xf1a9('0xa')]=function(_0x52cb68,_0x1ff946){return _0x52cb68[_0xf1a9('0xb')](_0xf1a9('0xc'),attributes,{'tableName':_0xf1a9('0xd'),'paranoid':![],'indexes':[{'name':_0xf1a9('0xe'),'fields':[_0xf1a9('0xf')],'type':_0xf1a9('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x148a6f,_0x183f46,_0x2446b4){var _0x471436=_0x52cb68['models'];var _0x3b885c=_0x148a6f[_0xf1a9('0x11')]({'plain':!![]});if(_0x3b885c[_0xf1a9('0x12')][_0xf1a9('0x13')]()==='in'||_0x3b885c['direction']['toLowerCase']()===_0xf1a9('0x14')&&!_0x3b885c[_0xf1a9('0x15')]&&!_[_0xf1a9('0x16')](_0x3b885c['UserId'])){_0x471436[_0xf1a9('0x17')][_0xf1a9('0x18')]({'where':{'id':_0x3b885c[_0xf1a9('0x19')]}})[_0xf1a9('0x1a')](function(_0x29def7){if(_0x29def7){_0x29def7[_0xf1a9('0x1b')]({'lastMsgAt':_0x3b885c[_0xf1a9('0x1c')],'lastMsgDirection':_0x3b885c[_0xf1a9('0x12')][_0xf1a9('0x13')]()});}})[_0xf1a9('0x1d')](function(_0x370746){console[_0xf1a9('0x1e')](_0x370746);});}if(_0x3b885c[_0xf1a9('0x12')]===_0xf1a9('0x14')&&!_0x3b885c[_0xf1a9('0x15')]){var _0x1ce768;_0x471436[_0xf1a9('0x1f')][_0xf1a9('0x20')]()['then'](function(_0x55072c){return _0x471436['OpenchannelAccount'][_0xf1a9('0x21')]({'where':{'id':_0x3b885c[_0xf1a9('0x22')]},'include':[{'model':_0x471436[_0xf1a9('0x17')],'as':'Interactions','where':{'id':_0x3b885c[_0xf1a9('0x19')]},'limit':0x1,'include':[{'model':_0x471436[_0xf1a9('0x1f')],'as':_0xf1a9('0x23'),'attributes':_[_0xf1a9('0x24')](_0x55072c)}]}]});})[_0xf1a9('0x1a')](function(_0x34300d){_0x1ce768=_0x34300d[_0xf1a9('0x11')]({'plain':!![]});if(_0x1ce768&&_0x1ce768[_0xf1a9('0x25')]){logger['info'](_0xf1a9('0x26'),_0xf1a9('0x27'),util[_0xf1a9('0x28')](_0xf1a9('0x29'),_0x3b885c['id'],_0x1ce768[_0xf1a9('0x25')]));if(_0x1ce768[_0xf1a9('0x2a')]&&_0x1ce768['Interactions']['length']){_0x3b885c['Interaction']=_['omit'](_0x1ce768[_0xf1a9('0x2a')][0x0],'Contact');_0x3b885c[_0xf1a9('0x23')]=_0x1ce768['Interactions'][0x0]['Contact'];}var _0x183f46={'method':_0xf1a9('0x2b'),'uri':encodeURI(_0x1ce768[_0xf1a9('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x183f46['method']){case'GET':_0x183f46['qs']=_0x3b885c;break;case _0xf1a9('0x2b'):_0x183f46['body']=_0x3b885c;break;}return rp(_0x183f46)['then'](function(_0x3ae67c){logger['info'](_0xf1a9('0x26'),'afterCreate',util[_0xf1a9('0x28')](_0xf1a9('0x2c'),_0x3b885c['id'],_0x1ce768[_0xf1a9('0x25')]));if(_0x3ae67c[_0xf1a9('0xf')][_0xf1a9('0x2d')]&&_0x3ae67c[_0xf1a9('0xf')][_0xf1a9('0x2d')]!=_0x3b885c[_0xf1a9('0x2e')]['threadId']){return _0x471436[_0xf1a9('0x17')][_0xf1a9('0x1b')]({'threadId':_0x3ae67c[_0xf1a9('0xf')][_0xf1a9('0x2d')]},{'where':{'id':_0x3b885c[_0xf1a9('0x2e')]['id']}});}else{return;}})[_0xf1a9('0x1a')](function(){return _0x148a6f[_0xf1a9('0x1b')]({'read':!![]});})[_0xf1a9('0x1d')](function(_0xdee7){logger['error']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xf1a9('0x2f')](_0xdee7,{'showHidden':![],'depth':null}));_0x2446b4();});}else{_0x2446b4();}})['finally'](function(){_0x2446b4();});}else{_0x2446b4();}}},'charset':'utf8mb4','collate':_0xf1a9('0x30')});}; \ No newline at end of file +var _0x66ab=['toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','Interaction','omit','Contact','POST','format','threadId','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','get','direction'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x66ab,0x153));var _0xb66a=function(_0x4bd09f,_0x17df6b){_0x4bd09f=_0x4bd09f-0x0;var _0x131757=_0x66ab[_0x4bd09f];return _0x131757;};'use strict';var _=require(_0xb66a('0x0'));var util=require(_0xb66a('0x1'));var logger=require(_0xb66a('0x2'))(_0xb66a('0x3'));var moment=require(_0xb66a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb66a('0x5'));var fs=require('fs');var path=require(_0xb66a('0x6'));var rimraf=require(_0xb66a('0x7'));var config=require(_0xb66a('0x8'));var attributes=require(_0xb66a('0x9'));module[_0xb66a('0xa')]=function(_0x2a8e24,_0x31a24){return _0x2a8e24[_0xb66a('0xb')](_0xb66a('0xc'),attributes,{'tableName':_0xb66a('0xd'),'paranoid':![],'indexes':[{'name':_0xb66a('0xe'),'fields':[_0xb66a('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25af50,_0x2da5a8,_0x394be7){var _0x45b9ba=_0x2a8e24['models'];var _0x43b8ad=_0x25af50[_0xb66a('0x10')]({'plain':!![]});if(_0x43b8ad[_0xb66a('0x11')][_0xb66a('0x12')]()==='in'||_0x43b8ad[_0xb66a('0x11')][_0xb66a('0x12')]()===_0xb66a('0x13')&&!_0x43b8ad[_0xb66a('0x14')]&&!_[_0xb66a('0x15')](_0x43b8ad[_0xb66a('0x16')])){_0x45b9ba[_0xb66a('0x17')][_0xb66a('0x18')]({'where':{'id':_0x43b8ad[_0xb66a('0x19')]}})[_0xb66a('0x1a')](function(_0x4edb86){if(_0x4edb86){_0x4edb86[_0xb66a('0x1b')]({'lastMsgAt':_0x43b8ad['createdAt'],'lastMsgDirection':_0x43b8ad[_0xb66a('0x11')][_0xb66a('0x12')]()});}})[_0xb66a('0x1c')](function(_0x10790b){console[_0xb66a('0x1d')](_0x10790b);});}if(_0x43b8ad['direction']===_0xb66a('0x13')&&!_0x43b8ad[_0xb66a('0x14')]){var _0x188b75;_0x45b9ba['CmContact'][_0xb66a('0x1e')]()[_0xb66a('0x1a')](function(_0x195d9c){return _0x45b9ba[_0xb66a('0x1f')][_0xb66a('0x20')]({'where':{'id':_0x43b8ad[_0xb66a('0x21')]},'include':[{'model':_0x45b9ba[_0xb66a('0x17')],'as':_0xb66a('0x22'),'where':{'id':_0x43b8ad[_0xb66a('0x19')]},'limit':0x1,'include':[{'model':_0x45b9ba[_0xb66a('0x23')],'as':'Contact','attributes':_[_0xb66a('0x24')](_0x195d9c)}]}]});})[_0xb66a('0x1a')](function(_0x15e1a6){_0x188b75=_0x15e1a6[_0xb66a('0x10')]({'plain':!![]});if(_0x188b75&&_0x188b75[_0xb66a('0x25')]){logger[_0xb66a('0x26')](_0xb66a('0x27'),_0xb66a('0x28'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x43b8ad['id'],_0x188b75[_0xb66a('0x25')]));if(_0x188b75[_0xb66a('0x22')]&&_0x188b75['Interactions'][_0xb66a('0x29')]){_0x43b8ad[_0xb66a('0x2a')]=_[_0xb66a('0x2b')](_0x188b75[_0xb66a('0x22')][0x0],_0xb66a('0x2c'));_0x43b8ad['Contact']=_0x188b75[_0xb66a('0x22')][0x0]['Contact'];}var _0x2da5a8={'method':'POST','uri':encodeURI(_0x188b75[_0xb66a('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2da5a8['method']){case'GET':_0x2da5a8['qs']=_0x43b8ad;break;case _0xb66a('0x2d'):_0x2da5a8[_0xb66a('0xf')]=_0x43b8ad;break;}return rp(_0x2da5a8)[_0xb66a('0x1a')](function(_0x43ecf0){logger['info'](_0xb66a('0x27'),_0xb66a('0x28'),util[_0xb66a('0x2e')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x43b8ad['id'],_0x188b75['replyUri']));if(_0x43ecf0[_0xb66a('0xf')][_0xb66a('0x2f')]&&_0x43ecf0['body']['threadId']!=_0x43b8ad[_0xb66a('0x2a')][_0xb66a('0x2f')]){return _0x45b9ba[_0xb66a('0x17')]['update']({'threadId':_0x43ecf0[_0xb66a('0xf')]['threadId']},{'where':{'id':_0x43b8ad['Interaction']['id']}});}else{return;}})[_0xb66a('0x1a')](function(){return _0x25af50[_0xb66a('0x1b')]({'read':!![]});})['catch'](function(_0x5f3008){logger['error'](_0xb66a('0x27'),_0xb66a('0x28'),util[_0xb66a('0x30')](_0x5f3008,{'showHidden':![],'depth':null}));_0x394be7();});}else{_0x394be7();}})[_0xb66a('0x31')](function(){_0x394be7();});}else{_0x394be7();}}},'charset':_0xb66a('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index adf83ab..cc1bff6 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x51aee3,_0x30c7e4){var _0x346280=function(_0x456939){while(--_0x456939){_0x51aee3['push'](_0x51aee3['shift']());}};_0x346280(++_0x30c7e4);}(_0xdb28,0x106));var _0x8db2=function(_0x59ced6,_0xdc0004){_0x59ced6=_0x59ced6-0x0;var _0x4f9f10=_0xdb28[_0x59ced6];return _0x4f9f10;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x230366,_0x23cc5d){var _0x3f8f11=function(_0x331238){while(--_0x331238){_0x230366['push'](_0x230366['shift']());}};_0x3f8f11(++_0x23cc5d);}(_0xadb5,0xad));var _0x5adb=function(_0x3ad444,_0xde57f){_0x3ad444=_0x3ad444-0x0;var _0x1aa435=_0xadb5[_0x3ad444];return _0x1aa435;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 820666f..652c69e 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 _0xe397=['remove','emit','register','length','./openchannelMessage.events','save'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xe397,0xac));var _0x7e39=function(_0x58ac34,_0x5b5bfb){_0x58ac34=_0x58ac34-0x0;var _0x3921ab=_0xe397[_0x58ac34];return _0x3921ab;};'use strict';var OpenchannelMessageEvents=require(_0x7e39('0x0'));var events=[_0x7e39('0x1'),_0x7e39('0x2'),'update'];function createListener(_0x1382ff,_0x92070d){return function(_0x117826){_0x92070d[_0x7e39('0x3')](_0x1382ff,_0x117826);};}function removeListener(_0x2e5f77,_0x3ef9d0){return function(){OpenchannelMessageEvents['removeListener'](_0x2e5f77,_0x3ef9d0);};}exports[_0x7e39('0x4')]=function(_0x55b365){for(var _0x21e4df=0x0,_0x28ccef=events[_0x7e39('0x5')];_0x21e4df<_0x28ccef;_0x21e4df++){var _0x51bc8d=events[_0x21e4df];var _0x1262fe=createListener('openchannelMessage:'+_0x51bc8d,_0x55b365);OpenchannelMessageEvents['on'](_0x51bc8d,_0x1262fe);}}; \ No newline at end of file +var _0x3bd7=['update','emit','removeListener','length','remove'];(function(_0x461d3b,_0x572c17){var _0x1c847d=function(_0x5a459c){while(--_0x5a459c){_0x461d3b['push'](_0x461d3b['shift']());}};_0x1c847d(++_0x572c17);}(_0x3bd7,0x199));var _0x73bd=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x3bd7[_0x2aea9e];return _0x430b92;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x73bd('0x0'),_0x73bd('0x1')];function createListener(_0x22da7f,_0x4f66a5){return function(_0x4242ff){_0x4f66a5[_0x73bd('0x2')](_0x22da7f,_0x4242ff);};}function removeListener(_0x1b4214,_0x56fbc2){return function(){OpenchannelMessageEvents[_0x73bd('0x3')](_0x1b4214,_0x56fbc2);};}exports['register']=function(_0xe20fe9){for(var _0x1aa5e1=0x0,_0x4bca41=events[_0x73bd('0x4')];_0x1aa5e1<_0x4bca41;_0x1aa5e1++){var _0x4c1254=events[_0x1aa5e1];var _0x569bef=createListener('openchannelMessage:'+_0x4c1254,_0xe20fe9);OpenchannelMessageEvents['on'](_0x4c1254,_0x569bef);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 4cb817c..4c48ae2 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 _0xd7cc=['multer','util','path','express','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','/:id','update','destroy','delete','removeAgents','exports'];(function(_0x4d353b,_0x383c10){var _0x1f11f9=function(_0x2f6a2b){while(--_0x2f6a2b){_0x4d353b['push'](_0x4d353b['shift']());}};_0x1f11f9(++_0x383c10);}(_0xd7cc,0x134));var _0xcd7c=function(_0x4543f4,_0xa0e0fb){_0x4543f4=_0x4543f4-0x0;var _0x556cf7=_0xd7cc[_0x4543f4];return _0x556cf7;};'use strict';var multer=require(_0xcd7c('0x0'));var util=require(_0xcd7c('0x1'));var path=require(_0xcd7c('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd7c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcd7c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcd7c('0x5'));var controller=require(_0xcd7c('0x6'));router[_0xcd7c('0x7')]('/',auth[_0xcd7c('0x8')](),controller[_0xcd7c('0x9')]);router[_0xcd7c('0x7')]('/describe',auth[_0xcd7c('0x8')](),controller[_0xcd7c('0xa')]);router[_0xcd7c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xcd7c('0xb')]);router[_0xcd7c('0x7')](_0xcd7c('0xc'),auth[_0xcd7c('0x8')](),controller['getMembers']);router['get']('/:id/teams',auth[_0xcd7c('0x8')](),controller[_0xcd7c('0xd')]);router[_0xcd7c('0x7')](_0xcd7c('0xe'),auth[_0xcd7c('0x8')](),controller[_0xcd7c('0xf')]);router[_0xcd7c('0x10')]('/',auth[_0xcd7c('0x8')](),controller[_0xcd7c('0x11')]);router[_0xcd7c('0x10')](_0xcd7c('0x12'),auth[_0xcd7c('0x8')](),controller[_0xcd7c('0x13')]);router[_0xcd7c('0x10')](_0xcd7c('0xe'),auth[_0xcd7c('0x8')](),controller[_0xcd7c('0x14')]);router[_0xcd7c('0x15')](_0xcd7c('0x16'),auth[_0xcd7c('0x8')](),controller[_0xcd7c('0x17')]);router['delete'](_0xcd7c('0x16'),auth[_0xcd7c('0x8')](),controller[_0xcd7c('0x18')]);router['delete'](_0xcd7c('0x12'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xcd7c('0x19')](_0xcd7c('0xe'),auth[_0xcd7c('0x8')](),controller[_0xcd7c('0x1a')]);module[_0xcd7c('0x1b')]=router; \ No newline at end of file +var _0x0de7=['/:id','/:id/teams','getTeams','/:id/users','post','create','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x0de7,0xba));var _0x70de=function(_0x4250cc,_0x4ed99e){_0x4250cc=_0x4250cc-0x0;var _0x3e26aa=_0x0de7[_0x4250cc];return _0x3e26aa;};'use strict';var multer=require(_0x70de('0x0'));var util=require(_0x70de('0x1'));var path=require('path');var timeout=require(_0x70de('0x2'));var express=require(_0x70de('0x3'));var router=express[_0x70de('0x4')]();var fs_extra=require(_0x70de('0x5'));var auth=require(_0x70de('0x6'));var interaction=require(_0x70de('0x7'));var config=require('../../config/environment');var controller=require(_0x70de('0x8'));router['get']('/',auth[_0x70de('0x9')](),controller[_0x70de('0xa')]);router[_0x70de('0xb')](_0x70de('0xc'),auth[_0x70de('0x9')](),controller[_0x70de('0xd')]);router[_0x70de('0xb')](_0x70de('0xe'),auth[_0x70de('0x9')](),controller['show']);router[_0x70de('0xb')]('/:id/members',auth[_0x70de('0x9')](),controller['getMembers']);router[_0x70de('0xb')](_0x70de('0xf'),auth[_0x70de('0x9')](),controller[_0x70de('0x10')]);router[_0x70de('0xb')](_0x70de('0x11'),auth[_0x70de('0x9')](),controller['getAgents']);router[_0x70de('0x12')]('/',auth[_0x70de('0x9')](),controller[_0x70de('0x13')]);router[_0x70de('0x12')](_0x70de('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x70de('0x12')](_0x70de('0x11'),auth[_0x70de('0x9')](),controller['addAgents']);router['put'](_0x70de('0xe'),auth[_0x70de('0x9')](),controller['update']);router[_0x70de('0x14')]('/:id',auth[_0x70de('0x9')](),controller[_0x70de('0x15')]);router['delete'](_0x70de('0xf'),auth[_0x70de('0x9')](),controller[_0x70de('0x16')]);router[_0x70de('0x14')](_0x70de('0x11'),auth[_0x70de('0x9')](),controller[_0x70de('0x17')]);module[_0x70de('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index e57cf15..b425dfb 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 _0x4a8c=['name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5488cc,_0x57b187){var _0xa8962e=function(_0x4be4d5){while(--_0x4be4d5){_0x5488cc['push'](_0x5488cc['shift']());}};_0xa8962e(++_0x57b187);}(_0x4a8c,0xf5));var _0xc4a8=function(_0x29d0b0,_0x3c64df){_0x29d0b0=_0x29d0b0-0x0;var _0x482479=_0x4a8c[_0x29d0b0];return _0x482479;};'use strict';var Sequelize=require(_0xc4a8('0x0'));module[_0xc4a8('0x1')]={'name':{'type':Sequelize[_0xc4a8('0x2')],'unique':_0xc4a8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc4a8('0x2')]},'timeout':{'type':Sequelize[_0xc4a8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc4a8('0x5')]('rrmemory',_0xc4a8('0x6'),_0xc4a8('0x7'))}}; \ No newline at end of file +var _0xe83f=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe83f,0x13a));var _0xfe83=function(_0x60ff7e,_0x1823d5){_0x60ff7e=_0x60ff7e-0x0;var _0x27c040=_0xe83f[_0x60ff7e];return _0x27c040;};'use strict';var Sequelize=require('sequelize');module[_0xfe83('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfe83('0x1')]},'timeout':{'type':Sequelize[_0xfe83('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfe83('0x3')](_0xfe83('0x4'),_0xfe83('0x5'),_0xfe83('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 989b6f6..eb78d50 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 _0xcc1f=['lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','OpenchannelQueues','UserProfileResource','stack','name','send','index','map','OpenchannelQueue','fieldName','key','getOptions','where','include','findAll','rows','catch','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','sort','pick','OpenchannelQueueId','filter','User','findAndCountAll','agent','openchannelPause','createdAt','format','SIP','updatedAt','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','includes','union','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','getAgents','order','bluebird','util'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xcc1f,0x75));var _0xfcc1=function(_0x313f41,_0x17d6a0){_0x313f41=_0x313f41-0x0;var _0x41a004=_0xcc1f[_0x313f41];return _0x41a004;};'use strict';var BPromise=require(_0xfcc1('0x0'));var util=require(_0xfcc1('0x1'));var _=require(_0xfcc1('0x2'));var squel=require(_0xfcc1('0x3'));var Redis=require(_0xfcc1('0x4'));var qs=require(_0xfcc1('0x5'));var logger=require(_0xfcc1('0x6'))('api');var config=require(_0xfcc1('0x7'));var db=require(_0xfcc1('0x8'))['db'];config[_0xfcc1('0x9')]=_[_0xfcc1('0xa')](config[_0xfcc1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcc1('0xb'))(new Redis(config[_0xfcc1('0x9')]));require(_0xfcc1('0xc'))[_0xfcc1('0xd')](socket);function respondWithStatusCode(_0x5eef3e,_0xe67d8b){_0xe67d8b=_0xe67d8b||0xcc;return function(_0x59813f){if(_0x59813f){return _0x5eef3e['sendStatus'](_0xe67d8b);}return _0x5eef3e[_0xfcc1('0xe')](_0xe67d8b)[_0xfcc1('0xf')]();};}function respondWithResult(_0x34b5d7,_0x335fdf){_0x335fdf=_0x335fdf||0xc8;return function(_0x2dd7a2){if(_0x2dd7a2){return _0x34b5d7[_0xfcc1('0xe')](_0x335fdf)[_0xfcc1('0x10')](_0x2dd7a2);}};}function respondWithFilteredResult(_0x3f69b3,_0x285150){return function(_0x1b30f6){if(_0x1b30f6){var _0x34b0b2=typeof _0x285150['offset']===_0xfcc1('0x11')&&typeof _0x285150[_0xfcc1('0x12')]===_0xfcc1('0x11');var _0x24c5da=_0x1b30f6[_0xfcc1('0x13')];var _0x1b7513=_0x34b0b2?0x0:_0x285150['offset'];var _0x174cc7=_0x34b0b2?_0x1b30f6['count']:_0x285150[_0xfcc1('0x14')]+_0x285150[_0xfcc1('0x12')];var _0x356813;if(_0x174cc7>=_0x24c5da){_0x174cc7=_0x24c5da;_0x356813=0xc8;}else{_0x356813=0xce;}_0x3f69b3[_0xfcc1('0xe')](_0x356813);return _0x3f69b3['set'](_0xfcc1('0x15'),_0x1b7513+'-'+_0x174cc7+'/'+_0x24c5da)[_0xfcc1('0x10')](_0x1b30f6);}return null;};}function saveUpdates(_0x4dde28){return function(_0x34bfeb){if(_0x34bfeb){return _0x34bfeb[_0xfcc1('0x16')](_0x4dde28)[_0xfcc1('0x17')](function(_0x1d0828){return _0x1d0828;});}return null;};}function removeEntity(_0x1a0bfd){return function(_0x315935){if(_0x315935){return _0x315935['destroy']()[_0xfcc1('0x17')](function(){var _0x1d748b=_0x315935[_0xfcc1('0x18')]({'plain':!![]});var _0x473ecf=_0xfcc1('0x19');return db[_0xfcc1('0x1a')]['destroy']({'where':{'type':_0x473ecf,'resourceId':_0x1d748b['id']}})[_0xfcc1('0x17')](function(){return _0x315935;});})[_0xfcc1('0x17')](function(){_0x1a0bfd['status'](0xcc)[_0xfcc1('0xf')]();});}};}function handleEntityNotFound(_0x57b7cf){return function(_0x3ab3bc){if(!_0x3ab3bc){_0x57b7cf['sendStatus'](0x194);}return _0x3ab3bc;};}function handleError(_0x4f568a,_0x577d66){_0x577d66=_0x577d66||0x1f4;return function(_0x26e37c){logger['error'](_0x26e37c[_0xfcc1('0x1b')]);if(_0x26e37c[_0xfcc1('0x1c')]){delete _0x26e37c['name'];}_0x4f568a[_0xfcc1('0xe')](_0x577d66)[_0xfcc1('0x1d')](_0x26e37c);};}exports[_0xfcc1('0x1e')]=function(_0xe3f3f7,_0x461cfa){var _0x12d91a={};var _0xd42149={'count':0x0,'rows':[]};var _0x500cb3=_[_0xfcc1('0x1f')](db[_0xfcc1('0x20')]['rawAttributes'],function(_0x15d2dc){return{'name':_0x15d2dc[_0xfcc1('0x21')],'type':_0x15d2dc['type'][_0xfcc1('0x22')]};});_0x12d91a=qs[_0xfcc1('0x23')](_0x500cb3,_0xe3f3f7);var _0x1daff0={'where':_0x12d91a[_0xfcc1('0x24')]};return db[_0xfcc1('0x20')][_0xfcc1('0x13')](_0x1daff0)[_0xfcc1('0x17')](function(_0x2bc897){_0xd42149['count']=_0x2bc897;_0x12d91a[_0xfcc1('0x25')]=qs[_0xfcc1('0x25')](_0xe3f3f7['query']);return db[_0xfcc1('0x20')][_0xfcc1('0x26')](_0x12d91a);})[_0xfcc1('0x17')](function(_0x48a724){_0xd42149[_0xfcc1('0x27')]=_0x48a724;return _0xd42149;})[_0xfcc1('0x17')](respondWithFilteredResult(_0x461cfa,_0x12d91a))[_0xfcc1('0x28')](handleError(_0x461cfa,null));};exports[_0xfcc1('0x29')]=function(_0x3a4d1e,_0x6fbc78){var _0x12a83c={'raw':!![],'where':{'id':_0x3a4d1e[_0xfcc1('0x2a')]['id']}},_0x5831a9={};_0x5831a9[_0xfcc1('0x2b')]=_[_0xfcc1('0x2c')](db['OpenchannelQueue'][_0xfcc1('0x2d')]);_0x5831a9[_0xfcc1('0x2e')]=_[_0xfcc1('0x2c')](_0x3a4d1e['query']);_0x5831a9[_0xfcc1('0x2f')]=_[_0xfcc1('0x30')](_0x5831a9[_0xfcc1('0x2b')],_0x5831a9[_0xfcc1('0x2e')]);_0x12a83c[_0xfcc1('0x31')]=_[_0xfcc1('0x30')](_0x5831a9[_0xfcc1('0x2b')],qs[_0xfcc1('0x32')](_0x3a4d1e[_0xfcc1('0x2e')]['fields']));_0x12a83c[_0xfcc1('0x31')]=_0x12a83c[_0xfcc1('0x31')][_0xfcc1('0x33')]?_0x12a83c['attributes']:_0x5831a9[_0xfcc1('0x2b')];if(_0x3a4d1e[_0xfcc1('0x2e')][_0xfcc1('0x34')]){_0x12a83c[_0xfcc1('0x25')]=[{'all':!![]}];}_0x12a83c=_[_0xfcc1('0x35')]({},_0x12a83c,_0x3a4d1e[_0xfcc1('0x36')]);return db['OpenchannelQueue'][_0xfcc1('0x37')](_0x12a83c)[_0xfcc1('0x17')](handleEntityNotFound(_0x6fbc78,null))[_0xfcc1('0x17')](respondWithResult(_0x6fbc78,null))[_0xfcc1('0x28')](handleError(_0x6fbc78,null));};exports[_0xfcc1('0x38')]=function(_0x59e141,_0x58b9ee){return db['OpenchannelQueue'][_0xfcc1('0x38')](_0x59e141[_0xfcc1('0x39')],{})['then'](function(_0x689582){var _0x33ee7a=_0x59e141['user'][_0xfcc1('0x18')]({'plain':!![]});if(!_0x33ee7a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33ee7a[_0xfcc1('0x3a')]==='user'){var _0x5525f0=_0x689582[_0xfcc1('0x18')]({'plain':!![]});var _0x2d9464='OpenchannelQueues';return db['UserProfileSection'][_0xfcc1('0x37')]({'where':{'name':_0x2d9464,'userProfileId':_0x33ee7a[_0xfcc1('0x3b')]},'raw':!![]})['then'](function(_0x217f2e){if(_0x217f2e&&_0x217f2e['autoAssociation']===0x0){return db['UserProfileResource'][_0xfcc1('0x38')]({'name':_0x5525f0['name'],'resourceId':_0x5525f0['id'],'type':_0x217f2e[_0xfcc1('0x1c')],'sectionId':_0x217f2e['id']},{})['then'](function(){return _0x689582;});}else{return _0x689582;}})[_0xfcc1('0x28')](function(_0x379a07){logger[_0xfcc1('0x3c')](_0xfcc1('0x3d'),_0x379a07);throw _0x379a07;});}return _0x689582;})[_0xfcc1('0x17')](respondWithResult(_0x58b9ee,0xc9))['catch'](handleError(_0x58b9ee,null));};exports[_0xfcc1('0x16')]=function(_0x2a49ba,_0x13bc81){if(_0x2a49ba[_0xfcc1('0x39')]['id']){delete _0x2a49ba[_0xfcc1('0x39')]['id'];}return db[_0xfcc1('0x20')]['find']({'where':{'id':_0x2a49ba[_0xfcc1('0x2a')]['id']}})[_0xfcc1('0x17')](handleEntityNotFound(_0x13bc81,null))[_0xfcc1('0x17')](saveUpdates(_0x2a49ba[_0xfcc1('0x39')],null))[_0xfcc1('0x17')](respondWithResult(_0x13bc81,null))['catch'](handleError(_0x13bc81,null));};exports['destroy']=function(_0x213f8a,_0x51a7de){return db[_0xfcc1('0x20')]['find']({'where':{'id':_0x213f8a[_0xfcc1('0x2a')]['id']}})['then'](handleEntityNotFound(_0x51a7de,null))['then'](removeEntity(_0x51a7de,null))[_0xfcc1('0x28')](handleError(_0x51a7de,null));};exports[_0xfcc1('0x3e')]=function(_0x116c9b,_0x4b46fa){return db[_0xfcc1('0x20')][_0xfcc1('0x3e')]()['then'](respondWithResult(_0x4b46fa,null))['catch'](handleError(_0x4b46fa,null));};exports[_0xfcc1('0x3f')]=function(_0x474577,_0x1975f4){var _0x4d7726={'raw':!![],'where':{}},_0x1e6afb={},_0x1e6ba1;return db[_0xfcc1('0x20')][_0xfcc1('0x40')]({'where':{'id':_0x474577['params']['id']}})[_0xfcc1('0x17')](handleEntityNotFound(_0x1975f4,null))['then'](function(_0x209191){if(_0x209191){_0x1e6ba1=_0x209191['get']({'plain':!![]});_0x1e6afb['model']=_['keys'](db['UserOpenchannelQueue'][_0xfcc1('0x2d')]);_0x1e6afb['query']=_[_0xfcc1('0x2c')](_0x474577[_0xfcc1('0x2e')]);_0x1e6afb[_0xfcc1('0x2f')]=_[_0xfcc1('0x30')](_0x1e6afb[_0xfcc1('0x2b')],_0x1e6afb['query']);_0x4d7726[_0xfcc1('0x31')]=_[_0xfcc1('0x30')](_0x1e6afb[_0xfcc1('0x2b')],qs['fields'](_0x474577['query'][_0xfcc1('0x32')]));_0x4d7726[_0xfcc1('0x31')]=_0x4d7726['attributes']['length']?_0x4d7726[_0xfcc1('0x31')]:_0x1e6afb[_0xfcc1('0x2b')];if(!_0x474577['query']['hasOwnProperty'](_0xfcc1('0x41'))){_0x4d7726[_0xfcc1('0x12')]=qs[_0xfcc1('0x12')](_0x474577['query'][_0xfcc1('0x12')]);_0x4d7726[_0xfcc1('0x14')]=qs[_0xfcc1('0x14')](_0x474577[_0xfcc1('0x2e')][_0xfcc1('0x14')]);}_0x4d7726['order']=qs[_0xfcc1('0x42')](_0x474577['query'][_0xfcc1('0x42')]);_0x4d7726['where']=qs[_0xfcc1('0x2f')](_[_0xfcc1('0x43')](_0x474577['query'],_0x1e6afb[_0xfcc1('0x2f')]));_0x4d7726['where'][_0xfcc1('0x44')]=_0x209191['id'];if(_0x474577[_0xfcc1('0x2e')][_0xfcc1('0x45')]){_0x4d7726[_0xfcc1('0x24')]=_['merge'](_0x4d7726[_0xfcc1('0x24')],{'$or':_[_0xfcc1('0x1f')](_0x4d7726[_0xfcc1('0x31')],function(_0x559db7){var _0x406bc8={};_0x406bc8[_0x559db7]={'$like':'%'+_0x474577[_0xfcc1('0x2e')][_0xfcc1('0x45')]+'%'};return _0x406bc8;})});}_0x4d7726=_[_0xfcc1('0x35')]({},_0x4d7726,_0x474577[_0xfcc1('0x36')]);return db['UserOpenchannelQueue']['findAll'](_0x4d7726);}})[_0xfcc1('0x17')](function(_0xa78a88){if(_0xa78a88){return db[_0xfcc1('0x46')][_0xfcc1('0x47')]({'where':{'id':_['map'](_0xa78a88,'UserId'),'role':_0xfcc1('0x48')},'attributes':['id',_0xfcc1('0x1c'),_0xfcc1('0x49'),'updatedAt',_0xfcc1('0x4a')]});}})[_0xfcc1('0x17')](function(_0xff8bae){if(_0xff8bae){return{'count':_0xff8bae['count'],'rows':_[_0xfcc1('0x1f')](_0xff8bae[_0xfcc1('0x27')],function(_0x56aa16){return{'membername':_0x56aa16['name'],'UserId':_0x56aa16['id'],'queue_name':_0x1e6ba1[_0xfcc1('0x1c')],'OpenchannelQueueId':_0x1e6ba1['id'],'interface':util[_0xfcc1('0x4b')]('%s/%s',_0xfcc1('0x4c'),_0x56aa16[_0xfcc1('0x1c')]),'penalty':0x0,'paused':_0x56aa16[_0xfcc1('0x49')],'createdAt':_0x56aa16[_0xfcc1('0x4a')],'updatedAt':_0x56aa16[_0xfcc1('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfcc1('0x17')](respondWithFilteredResult(_0x1975f4,_0x4d7726))[_0xfcc1('0x28')](handleError(_0x1975f4,null));};exports[_0xfcc1('0x4e')]=function(_0x36bcad,_0x118f64){var _0x2ac97f={};var _0x460b99={};var _0x2af6ae;var _0x250ed8;return db['OpenchannelQueue'][_0xfcc1('0x40')]({'where':{'id':_0x36bcad[_0xfcc1('0x2a')]['id']}})[_0xfcc1('0x17')](handleEntityNotFound(_0x118f64,null))[_0xfcc1('0x17')](function(_0x2b14ef){if(_0x2b14ef){_0x2af6ae=_0x2b14ef;_0x460b99[_0xfcc1('0x2b')]=_[_0xfcc1('0x2c')](db[_0xfcc1('0x4f')][_0xfcc1('0x2d')]);_0x460b99[_0xfcc1('0x2e')]=_[_0xfcc1('0x2c')](_0x36bcad['query']);_0x460b99[_0xfcc1('0x2f')]=_['intersection'](_0x460b99[_0xfcc1('0x2b')],_0x460b99[_0xfcc1('0x2e')]);_0x2ac97f[_0xfcc1('0x31')]=_[_0xfcc1('0x30')](_0x460b99[_0xfcc1('0x2b')],qs[_0xfcc1('0x32')](_0x36bcad[_0xfcc1('0x2e')][_0xfcc1('0x32')]));_0x2ac97f[_0xfcc1('0x31')]=_0x2ac97f[_0xfcc1('0x31')][_0xfcc1('0x33')]?_0x2ac97f[_0xfcc1('0x31')]:_0x460b99['model'];_0x2ac97f['order']=qs[_0xfcc1('0x42')](_0x36bcad[_0xfcc1('0x2e')]['sort']);_0x2ac97f[_0xfcc1('0x24')]=qs['filters'](_[_0xfcc1('0x43')](_0x36bcad[_0xfcc1('0x2e')],_0x460b99[_0xfcc1('0x2f')]));if(_0x36bcad[_0xfcc1('0x2e')][_0xfcc1('0x45')]){_0x2ac97f[_0xfcc1('0x24')]=_['merge'](_0x2ac97f['where'],{'$or':_['map'](_0x2ac97f['attributes'],function(_0x47a1f7){var _0x3db388={};_0x3db388[_0x47a1f7]={'$like':'%'+_0x36bcad['query'][_0xfcc1('0x45')]+'%'};return _0x3db388;})});}_0x2ac97f=_[_0xfcc1('0x35')]({},_0x2ac97f,_0x36bcad[_0xfcc1('0x36')]);return _0x2af6ae['getTeams'](_0x2ac97f);}})[_0xfcc1('0x17')](function(_0x282078){if(_0x282078){_0x250ed8=_0x282078[_0xfcc1('0x33')];if(!_0x36bcad[_0xfcc1('0x2e')][_0xfcc1('0x50')](_0xfcc1('0x41'))){_0x2ac97f[_0xfcc1('0x12')]=qs[_0xfcc1('0x12')](_0x36bcad[_0xfcc1('0x2e')][_0xfcc1('0x12')]);_0x2ac97f[_0xfcc1('0x14')]=qs[_0xfcc1('0x14')](_0x36bcad['query']['offset']);}return _0x2af6ae[_0xfcc1('0x4e')](_0x2ac97f);}})[_0xfcc1('0x17')](function(_0xc48dc7){if(_0xc48dc7){return _0xc48dc7?{'count':_0x250ed8,'rows':_0xc48dc7}:null;}})[_0xfcc1('0x17')](respondWithResult(_0x118f64,null))['catch'](handleError(_0x118f64,null));};exports[_0xfcc1('0x51')]=function(_0x2bd915,_0x13c701){var _0x1d538d=_0x2bd915[_0xfcc1('0x39')][_0xfcc1('0x52')];return db[_0xfcc1('0x4f')][_0xfcc1('0x26')]({'where':{'id':_0x1d538d},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfcc1('0x53'),'attributes':['id','name',_0xfcc1('0x54'),_0xfcc1('0x55'),_0xfcc1('0x56')],'raw':!![]}]})[_0xfcc1('0x17')](function(_0x531e88){if(_0x531e88){var _0x421b83=_['flatMap'](_0x531e88,function(_0x46c0ed){var _0x366e61=_0x46c0ed[_0xfcc1('0x18')]({'plain':!![]});return _0x366e61[_0xfcc1('0x53')];});return db[_0xfcc1('0x20')][_0xfcc1('0x37')]({'where':{'id':_0x2bd915[_0xfcc1('0x2a')]['id']}})[_0xfcc1('0x17')](function(_0x33b0d7){return db[_0xfcc1('0x57')][_0xfcc1('0x58')](function(_0x23d90d){return _0x33b0d7[_0xfcc1('0x51')](_0x1d538d,{'transaction':_0x23d90d})[_0xfcc1('0x17')](function(){return BPromise[_0xfcc1('0x59')](_0x421b83,function(_0x53437a){return db['UserOpenchannelQueue'][_0xfcc1('0x5a')]({'where':{'UserId':_0x53437a['id'],'OpenchannelQueueId':_0x2bd915[_0xfcc1('0x2a')]['id']},'transaction':_0x23d90d});});})[_0xfcc1('0x17')](function(){_0x421b83[_0xfcc1('0x5b')](function(_0x1198e9){socket[_0xfcc1('0x5c')](_0xfcc1('0x5d'),{'UserId':_0x1198e9['id'],'OpenchannelQueueId':_0x33b0d7['id']});});});});});}})[_0xfcc1('0x17')](respondWithStatusCode(_0x13c701,null))[_0xfcc1('0x28')](handleError(_0x13c701,null));};exports[_0xfcc1('0x5e')]=function(_0x326a3b,_0x2a76f3){return db[_0xfcc1('0x4f')]['findAll']({'where':{'id':_0x326a3b[_0xfcc1('0x2e')][_0xfcc1('0x52')]},'attributes':['id'],'include':[{'model':db[_0xfcc1('0x46')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfcc1('0x17')](handleEntityNotFound(_0x2a76f3,null))[_0xfcc1('0x17')](function(_0x4ca98e){var _0x3a3031=_['map'](_0x4ca98e,'id');var _0x10f184=[];var _0x122b60=[];var _0x31b504=squel[_0xfcc1('0x5f')]();_0x31b504[_0xfcc1('0x60')](_0xfcc1('0x61'))[_0xfcc1('0x62')](_0xfcc1('0x63'),'tq')[_0xfcc1('0x64')]('user_has_teams','ut',_0xfcc1('0x65'))[_0xfcc1('0x24')](_0xfcc1('0x66'),_0x326a3b['params']['id']);for(var _0xafadf=0x0;_0xafadf<_0x4ca98e[_0xfcc1('0x33')];_0xafadf+=0x1){let _0x395c07=_0x4ca98e[_0xafadf];for(var _0x1ea9d4=0x0;_0x1ea9d4<_0x395c07[_0xfcc1('0x53')]['length'];_0x1ea9d4+=0x1){let _0x225788=_0x395c07[_0xfcc1('0x53')][_0x1ea9d4];var _0x39c81a=_0x31b504[_0xfcc1('0x67')]();_0x39c81a[_0xfcc1('0x24')]('ut.UserId\x20=\x20?',_0x225788['id']);_0x122b60[_0xfcc1('0x68')](db['sequelize'][_0xfcc1('0x2e')](_0x39c81a[_0xfcc1('0x69')](),{'type':db[_0xfcc1('0x57')][_0xfcc1('0x6a')]['SELECT']})['then'](function(_0x137f18){if(_0x137f18[_0xfcc1('0x33')]===0x1){return _0x225788['id'];}else{var _0x356d77=_[_0xfcc1('0x6b')](_[_0xfcc1('0x1f')](_0x137f18,_0xfcc1('0x6c')),function(_0xd2cc75){return _[_0xfcc1('0x6d')](_0x3a3031,_0xd2cc75);});if(_0x356d77){return _0x225788['id'];}}}));}}return BPromise['all'](_0x122b60)[_0xfcc1('0x17')](function(_0x159c0c){_0x10f184=_(_0x10f184)[_0xfcc1('0x6e')](_0x159c0c)['compact']()[_0xfcc1('0x6f')]();return db[_0xfcc1('0x20')][_0xfcc1('0x37')]({'where':{'id':_0x326a3b['params']['id']}})[_0xfcc1('0x17')](function(_0x865a74){return db[_0xfcc1('0x57')]['transaction'](function(_0x2dea1f){return _0x865a74[_0xfcc1('0x5e')](_0x326a3b[_0xfcc1('0x2e')][_0xfcc1('0x52')],{'transaction':_0x2dea1f})[_0xfcc1('0x17')](function(){if(!_[_0xfcc1('0x70')](_0x10f184)){return _0x865a74[_0xfcc1('0x71')](_0x10f184,{'transaction':_0x2dea1f});}})['then'](function(){_0x10f184[_0xfcc1('0x5b')](function(_0x587c5e){socket[_0xfcc1('0x5c')](_0xfcc1('0x72'),{'UserId':_0x587c5e,'OpenchannelQueueId':_0x865a74['id']});});});});});});})[_0xfcc1('0x17')](respondWithStatusCode(_0x2a76f3,null))[_0xfcc1('0x28')](handleError(_0x2a76f3,null));};exports['addAgents']=function(_0x287a4f,_0x4f8205){return db[_0xfcc1('0x20')][_0xfcc1('0x37')]({'where':{'id':_0x287a4f['params']['id']}})[_0xfcc1('0x17')](handleEntityNotFound(_0x4f8205,null))[_0xfcc1('0x17')](function(_0x4e2d8e){if(_0x4e2d8e){return _0x4e2d8e[_0xfcc1('0x73')](_0x287a4f[_0xfcc1('0x39')]['ids'],_[_0xfcc1('0x74')](_0x287a4f[_0xfcc1('0x39')],[_0xfcc1('0x52'),'id'])||{})['spread'](function(_0x4cca80){for(var _0x2fcb0b=0x0;_0x2fcb0b<_0x287a4f[_0xfcc1('0x39')][_0xfcc1('0x52')][_0xfcc1('0x33')];_0x2fcb0b+=0x1){socket[_0xfcc1('0x5c')]('userOpenchannelQueue:save',{'UserId':Number(_0x287a4f['body'][_0xfcc1('0x52')][_0x2fcb0b]),'OpenchannelQueueId':Number(_0x287a4f[_0xfcc1('0x2a')]['id'])});}return _0x4cca80;});}})[_0xfcc1('0x17')](respondWithResult(_0x4f8205,null))[_0xfcc1('0x28')](handleError(_0x4f8205,null));};exports[_0xfcc1('0x71')]=function(_0x2c46d2,_0x4c9476){return db[_0xfcc1('0x20')][_0xfcc1('0x37')]({'where':{'id':_0x2c46d2[_0xfcc1('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4c9476,null))[_0xfcc1('0x17')](function(_0x361e5c){if(_0x361e5c){return _0x361e5c['removeAgents'](_0x2c46d2[_0xfcc1('0x2e')]['ids'])[_0xfcc1('0x17')](function(){if(_['isArray'](_0x2c46d2[_0xfcc1('0x2e')]['ids'])){for(var _0x8bb978=0x0;_0x8bb978<_0x2c46d2[_0xfcc1('0x2e')][_0xfcc1('0x52')][_0xfcc1('0x33')];_0x8bb978+=0x1){socket[_0xfcc1('0x5c')](_0xfcc1('0x72'),{'UserId':Number(_0x2c46d2[_0xfcc1('0x2e')][_0xfcc1('0x52')][_0x8bb978]),'OpenchannelQueueId':Number(_0x2c46d2[_0xfcc1('0x2a')]['id'])});}}else{socket[_0xfcc1('0x5c')](_0xfcc1('0x72'),{'UserId':Number(_0x2c46d2['query'][_0xfcc1('0x52')]),'OpenchannelQueueId':Number(_0x2c46d2['params']['id'])});}});}})[_0xfcc1('0x17')](respondWithStatusCode(_0x4c9476,null))[_0xfcc1('0x28')](handleError(_0x4c9476,null));};exports[_0xfcc1('0x75')]=function(_0x21de3c,_0x179834){var _0x3da376={};var _0x31c978={};var _0x330a0f;var _0x4a717a;return db[_0xfcc1('0x20')][_0xfcc1('0x40')]({'where':{'id':_0x21de3c[_0xfcc1('0x2a')]['id']}})[_0xfcc1('0x17')](handleEntityNotFound(_0x179834,null))[_0xfcc1('0x17')](function(_0xfe186b){if(_0xfe186b){_0x330a0f=_0xfe186b;_0x31c978[_0xfcc1('0x2b')]=_[_0xfcc1('0x2c')](db[_0xfcc1('0x46')]['rawAttributes']);_0x31c978[_0xfcc1('0x2e')]=_[_0xfcc1('0x2c')](_0x21de3c[_0xfcc1('0x2e')]);_0x31c978[_0xfcc1('0x2f')]=_[_0xfcc1('0x30')](_0x31c978['model'],_0x31c978['query']);_0x3da376[_0xfcc1('0x31')]=_[_0xfcc1('0x30')](_0x31c978[_0xfcc1('0x2b')],qs[_0xfcc1('0x32')](_0x21de3c[_0xfcc1('0x2e')][_0xfcc1('0x32')]));_0x3da376['attributes']=_0x3da376[_0xfcc1('0x31')][_0xfcc1('0x33')]?_0x3da376[_0xfcc1('0x31')]:_0x31c978[_0xfcc1('0x2b')];_0x3da376[_0xfcc1('0x76')]=qs[_0xfcc1('0x42')](_0x21de3c[_0xfcc1('0x2e')]['sort']);_0x3da376[_0xfcc1('0x24')]=qs[_0xfcc1('0x2f')](_['pick'](_0x21de3c[_0xfcc1('0x2e')],_0x31c978[_0xfcc1('0x2f')]));if(_0x21de3c[_0xfcc1('0x2e')][_0xfcc1('0x45')]){_0x3da376[_0xfcc1('0x24')]=_[_0xfcc1('0x35')](_0x3da376[_0xfcc1('0x24')],{'$or':_[_0xfcc1('0x1f')](_0x3da376[_0xfcc1('0x31')],function(_0xf0f845){var _0x3df616={};_0x3df616[_0xf0f845]={'$like':'%'+_0x21de3c[_0xfcc1('0x2e')][_0xfcc1('0x45')]+'%'};return _0x3df616;})});}_0x3da376=_[_0xfcc1('0x35')]({},_0x3da376,_0x21de3c[_0xfcc1('0x36')]);return _0x330a0f[_0xfcc1('0x75')](_0x3da376);}})[_0xfcc1('0x17')](function(_0x2270ea){if(_0x2270ea){_0x4a717a=_0x2270ea[_0xfcc1('0x33')];if(!_0x21de3c[_0xfcc1('0x2e')][_0xfcc1('0x50')](_0xfcc1('0x41'))){_0x3da376['limit']=qs[_0xfcc1('0x12')](_0x21de3c[_0xfcc1('0x2e')][_0xfcc1('0x12')]);_0x3da376['offset']=qs['offset'](_0x21de3c[_0xfcc1('0x2e')]['offset']);}return _0x330a0f['getAgents'](_0x3da376);}})['then'](function(_0x14b55f){if(_0x14b55f){return _0x14b55f?{'count':_0x4a717a,'rows':_0x14b55f}:null;}})['then'](respondWithResult(_0x179834,null))['catch'](handleError(_0x179834,null));}; \ No newline at end of file +var _0xaf9a=['findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','nolimit','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','emit','userOpenchannelQueue:save','Team','ids','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','union','compact','isEmpty','removeAgents','addAgents','omit','isArray','userOpenchannelQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','sendStatus','error','name','send','index','map','OpenchannelQueue','fieldName','type','key','where','include','findAll','rows','catch','show','params','model','keys','rawAttributes','query','attributes','intersection','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','filters','hasOwnProperty','order','sort','pick','OpenchannelQueueId','filter','options','UserOpenchannelQueue','User'];(function(_0x10dc85,_0x22bb2d){var _0x2adb59=function(_0x4b56a1){while(--_0x4b56a1){_0x10dc85['push'](_0x10dc85['shift']());}};_0x2adb59(++_0x22bb2d);}(_0xaf9a,0xa5));var _0xaaf9=function(_0x452361,_0x1e6ae2){_0x452361=_0x452361-0x0;var _0x125cbd=_0xaf9a[_0x452361];return _0x125cbd;};'use strict';var BPromise=require(_0xaaf9('0x0'));var util=require(_0xaaf9('0x1'));var _=require(_0xaaf9('0x2'));var squel=require(_0xaaf9('0x3'));var Redis=require('ioredis');var qs=require(_0xaaf9('0x4'));var logger=require('../../config/logger')(_0xaaf9('0x5'));var config=require('../../config/environment');var db=require(_0xaaf9('0x6'))['db'];config[_0xaaf9('0x7')]=_[_0xaaf9('0x8')](config[_0xaaf9('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xaaf9('0x9'))(new Redis(config[_0xaaf9('0x7')]));require(_0xaaf9('0xa'))[_0xaaf9('0xb')](socket);function respondWithStatusCode(_0x215bab,_0x4e424e){_0x4e424e=_0x4e424e||0xcc;return function(_0x1399ae){if(_0x1399ae){return _0x215bab['sendStatus'](_0x4e424e);}return _0x215bab[_0xaaf9('0xc')](_0x4e424e)['end']();};}function respondWithResult(_0x2051c8,_0x20bb43){_0x20bb43=_0x20bb43||0xc8;return function(_0x1ff010){if(_0x1ff010){return _0x2051c8['status'](_0x20bb43)[_0xaaf9('0xd')](_0x1ff010);}};}function respondWithFilteredResult(_0x3ed624,_0xee3144){return function(_0x47c8ed){if(_0x47c8ed){var _0x1611e6=typeof _0xee3144['offset']===_0xaaf9('0xe')&&typeof _0xee3144[_0xaaf9('0xf')]==='undefined';var _0x37ea99=_0x47c8ed[_0xaaf9('0x10')];var _0x43ff13=_0x1611e6?0x0:_0xee3144['offset'];var _0xaaf80a=_0x1611e6?_0x47c8ed[_0xaaf9('0x10')]:_0xee3144[_0xaaf9('0x11')]+_0xee3144[_0xaaf9('0xf')];var _0x55e8ca;if(_0xaaf80a>=_0x37ea99){_0xaaf80a=_0x37ea99;_0x55e8ca=0xc8;}else{_0x55e8ca=0xce;}_0x3ed624[_0xaaf9('0xc')](_0x55e8ca);return _0x3ed624['set'](_0xaaf9('0x12'),_0x43ff13+'-'+_0xaaf80a+'/'+_0x37ea99)[_0xaaf9('0xd')](_0x47c8ed);}return null;};}function saveUpdates(_0x10ebc0){return function(_0xa8551){if(_0xa8551){return _0xa8551[_0xaaf9('0x13')](_0x10ebc0)[_0xaaf9('0x14')](function(_0x255182){return _0x255182;});}return null;};}function removeEntity(_0x3a5ee0){return function(_0x2a9cf6){if(_0x2a9cf6){return _0x2a9cf6[_0xaaf9('0x15')]()[_0xaaf9('0x14')](function(){var _0x254571=_0x2a9cf6[_0xaaf9('0x16')]({'plain':!![]});var _0x53d367=_0xaaf9('0x17');return db[_0xaaf9('0x18')]['destroy']({'where':{'type':_0x53d367,'resourceId':_0x254571['id']}})[_0xaaf9('0x14')](function(){return _0x2a9cf6;});})['then'](function(){_0x3a5ee0[_0xaaf9('0xc')](0xcc)[_0xaaf9('0x19')]();});}};}function handleEntityNotFound(_0x242cab){return function(_0x2a82f8){if(!_0x2a82f8){_0x242cab[_0xaaf9('0x1a')](0x194);}return _0x2a82f8;};}function handleError(_0x43c7f1,_0x2f1cd2){_0x2f1cd2=_0x2f1cd2||0x1f4;return function(_0x24186a){logger[_0xaaf9('0x1b')](_0x24186a['stack']);if(_0x24186a['name']){delete _0x24186a[_0xaaf9('0x1c')];}_0x43c7f1['status'](_0x2f1cd2)[_0xaaf9('0x1d')](_0x24186a);};}exports[_0xaaf9('0x1e')]=function(_0x266f75,_0x57c4fa){var _0x44467b={};var _0x923636={'count':0x0,'rows':[]};var _0x287ac7=_[_0xaaf9('0x1f')](db[_0xaaf9('0x20')]['rawAttributes'],function(_0x5bdad2){return{'name':_0x5bdad2[_0xaaf9('0x21')],'type':_0x5bdad2[_0xaaf9('0x22')][_0xaaf9('0x23')]};});_0x44467b=qs['getOptions'](_0x287ac7,_0x266f75);var _0xd38ef3={'where':_0x44467b[_0xaaf9('0x24')]};return db[_0xaaf9('0x20')][_0xaaf9('0x10')](_0xd38ef3)[_0xaaf9('0x14')](function(_0x1e4073){_0x923636['count']=_0x1e4073;_0x44467b[_0xaaf9('0x25')]=qs[_0xaaf9('0x25')](_0x266f75['query']);return db[_0xaaf9('0x20')][_0xaaf9('0x26')](_0x44467b);})[_0xaaf9('0x14')](function(_0x153cd8){_0x923636[_0xaaf9('0x27')]=_0x153cd8;return _0x923636;})['then'](respondWithFilteredResult(_0x57c4fa,_0x44467b))[_0xaaf9('0x28')](handleError(_0x57c4fa,null));};exports[_0xaaf9('0x29')]=function(_0x4123ed,_0x176e6c){var _0x27769b={'raw':!![],'where':{'id':_0x4123ed[_0xaaf9('0x2a')]['id']}},_0x1e038d={};_0x1e038d[_0xaaf9('0x2b')]=_[_0xaaf9('0x2c')](db[_0xaaf9('0x20')][_0xaaf9('0x2d')]);_0x1e038d[_0xaaf9('0x2e')]=_['keys'](_0x4123ed[_0xaaf9('0x2e')]);_0x1e038d['filters']=_['intersection'](_0x1e038d[_0xaaf9('0x2b')],_0x1e038d['query']);_0x27769b[_0xaaf9('0x2f')]=_[_0xaaf9('0x30')](_0x1e038d['model'],qs['fields'](_0x4123ed[_0xaaf9('0x2e')][_0xaaf9('0x31')]));_0x27769b[_0xaaf9('0x2f')]=_0x27769b['attributes'][_0xaaf9('0x32')]?_0x27769b[_0xaaf9('0x2f')]:_0x1e038d[_0xaaf9('0x2b')];if(_0x4123ed['query'][_0xaaf9('0x33')]){_0x27769b[_0xaaf9('0x25')]=[{'all':!![]}];}_0x27769b=_[_0xaaf9('0x34')]({},_0x27769b,_0x4123ed['options']);return db[_0xaaf9('0x20')][_0xaaf9('0x35')](_0x27769b)[_0xaaf9('0x14')](handleEntityNotFound(_0x176e6c,null))['then'](respondWithResult(_0x176e6c,null))[_0xaaf9('0x28')](handleError(_0x176e6c,null));};exports[_0xaaf9('0x36')]=function(_0x1edb5f,_0x3e0e61){return db['OpenchannelQueue'][_0xaaf9('0x36')](_0x1edb5f[_0xaaf9('0x37')],{})[_0xaaf9('0x14')](function(_0x2e71cc){var _0x38dab5=_0x1edb5f[_0xaaf9('0x38')][_0xaaf9('0x16')]({'plain':!![]});if(!_0x38dab5)throw new Error(_0xaaf9('0x39'));if(_0x38dab5[_0xaaf9('0x3a')]==='user'){var _0xc4ee05=_0x2e71cc[_0xaaf9('0x16')]({'plain':!![]});var _0x3d1ce4=_0xaaf9('0x17');return db[_0xaaf9('0x3b')][_0xaaf9('0x35')]({'where':{'name':_0x3d1ce4,'userProfileId':_0x38dab5[_0xaaf9('0x3c')]},'raw':!![]})[_0xaaf9('0x14')](function(_0x129bfc){if(_0x129bfc&&_0x129bfc[_0xaaf9('0x3d')]===0x0){return db['UserProfileResource'][_0xaaf9('0x36')]({'name':_0xc4ee05[_0xaaf9('0x1c')],'resourceId':_0xc4ee05['id'],'type':_0x129bfc[_0xaaf9('0x1c')],'sectionId':_0x129bfc['id']},{})[_0xaaf9('0x14')](function(){return _0x2e71cc;});}else{return _0x2e71cc;}})[_0xaaf9('0x28')](function(_0x4e242b){logger[_0xaaf9('0x1b')](_0xaaf9('0x3e'),_0x4e242b);throw _0x4e242b;});}return _0x2e71cc;})[_0xaaf9('0x14')](respondWithResult(_0x3e0e61,0xc9))['catch'](handleError(_0x3e0e61,null));};exports[_0xaaf9('0x13')]=function(_0x3c8de9,_0x21d0fc){if(_0x3c8de9[_0xaaf9('0x37')]['id']){delete _0x3c8de9['body']['id'];}return db['OpenchannelQueue'][_0xaaf9('0x35')]({'where':{'id':_0x3c8de9['params']['id']}})[_0xaaf9('0x14')](handleEntityNotFound(_0x21d0fc,null))[_0xaaf9('0x14')](saveUpdates(_0x3c8de9[_0xaaf9('0x37')],null))[_0xaaf9('0x14')](respondWithResult(_0x21d0fc,null))[_0xaaf9('0x28')](handleError(_0x21d0fc,null));};exports['destroy']=function(_0x2609f3,_0x5ed2fe){return db['OpenchannelQueue'][_0xaaf9('0x35')]({'where':{'id':_0x2609f3[_0xaaf9('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5ed2fe,null))[_0xaaf9('0x14')](removeEntity(_0x5ed2fe,null))[_0xaaf9('0x28')](handleError(_0x5ed2fe,null));};exports[_0xaaf9('0x3f')]=function(_0x262427,_0xb85200){return db['OpenchannelQueue'][_0xaaf9('0x3f')]()['then'](respondWithResult(_0xb85200,null))[_0xaaf9('0x28')](handleError(_0xb85200,null));};exports['getMembers']=function(_0x10e22e,_0x5ecdfd){var _0x1845c5={'raw':!![],'where':{}},_0x169f6e={},_0x599b4e;return db[_0xaaf9('0x20')][_0xaaf9('0x40')]({'where':{'id':_0x10e22e['params']['id']}})[_0xaaf9('0x14')](handleEntityNotFound(_0x5ecdfd,null))['then'](function(_0x3e8311){if(_0x3e8311){_0x599b4e=_0x3e8311[_0xaaf9('0x16')]({'plain':!![]});_0x169f6e[_0xaaf9('0x2b')]=_[_0xaaf9('0x2c')](db['UserOpenchannelQueue'][_0xaaf9('0x2d')]);_0x169f6e[_0xaaf9('0x2e')]=_['keys'](_0x10e22e[_0xaaf9('0x2e')]);_0x169f6e[_0xaaf9('0x41')]=_['intersection'](_0x169f6e[_0xaaf9('0x2b')],_0x169f6e['query']);_0x1845c5[_0xaaf9('0x2f')]=_['intersection'](_0x169f6e[_0xaaf9('0x2b')],qs['fields'](_0x10e22e['query'][_0xaaf9('0x31')]));_0x1845c5[_0xaaf9('0x2f')]=_0x1845c5['attributes'][_0xaaf9('0x32')]?_0x1845c5['attributes']:_0x169f6e[_0xaaf9('0x2b')];if(!_0x10e22e[_0xaaf9('0x2e')][_0xaaf9('0x42')]('nolimit')){_0x1845c5[_0xaaf9('0xf')]=qs[_0xaaf9('0xf')](_0x10e22e['query'][_0xaaf9('0xf')]);_0x1845c5[_0xaaf9('0x11')]=qs[_0xaaf9('0x11')](_0x10e22e['query']['offset']);}_0x1845c5[_0xaaf9('0x43')]=qs[_0xaaf9('0x44')](_0x10e22e[_0xaaf9('0x2e')]['sort']);_0x1845c5[_0xaaf9('0x24')]=qs['filters'](_[_0xaaf9('0x45')](_0x10e22e[_0xaaf9('0x2e')],_0x169f6e[_0xaaf9('0x41')]));_0x1845c5[_0xaaf9('0x24')][_0xaaf9('0x46')]=_0x3e8311['id'];if(_0x10e22e[_0xaaf9('0x2e')][_0xaaf9('0x47')]){_0x1845c5['where']=_[_0xaaf9('0x34')](_0x1845c5['where'],{'$or':_[_0xaaf9('0x1f')](_0x1845c5['attributes'],function(_0x1fbe0b){var _0x175915={};_0x175915[_0x1fbe0b]={'$like':'%'+_0x10e22e[_0xaaf9('0x2e')][_0xaaf9('0x47')]+'%'};return _0x175915;})});}_0x1845c5=_['merge']({},_0x1845c5,_0x10e22e[_0xaaf9('0x48')]);return db[_0xaaf9('0x49')][_0xaaf9('0x26')](_0x1845c5);}})[_0xaaf9('0x14')](function(_0x4316dd){if(_0x4316dd){return db[_0xaaf9('0x4a')][_0xaaf9('0x4b')]({'where':{'id':_[_0xaaf9('0x1f')](_0x4316dd,_0xaaf9('0x4c')),'role':_0xaaf9('0x4d')},'attributes':['id',_0xaaf9('0x1c'),_0xaaf9('0x4e'),_0xaaf9('0x4f'),_0xaaf9('0x50')]});}})['then'](function(_0xdfa3d0){if(_0xdfa3d0){return{'count':_0xdfa3d0[_0xaaf9('0x10')],'rows':_[_0xaaf9('0x1f')](_0xdfa3d0[_0xaaf9('0x27')],function(_0x3b6876){return{'membername':_0x3b6876[_0xaaf9('0x1c')],'UserId':_0x3b6876['id'],'queue_name':_0x599b4e[_0xaaf9('0x1c')],'OpenchannelQueueId':_0x599b4e['id'],'interface':util[_0xaaf9('0x51')]('%s/%s',_0xaaf9('0x52'),_0x3b6876[_0xaaf9('0x1c')]),'penalty':0x0,'paused':_0x3b6876[_0xaaf9('0x4e')],'createdAt':_0x3b6876[_0xaaf9('0x50')],'updatedAt':_0x3b6876[_0xaaf9('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaaf9('0x14')](respondWithFilteredResult(_0x5ecdfd,_0x1845c5))[_0xaaf9('0x28')](handleError(_0x5ecdfd,null));};exports['getTeams']=function(_0x51c014,_0x2f45b8){var _0x2dd422={};var _0x2aa6e2={};var _0x3410d5;var _0x37b258;return db[_0xaaf9('0x20')][_0xaaf9('0x40')]({'where':{'id':_0x51c014[_0xaaf9('0x2a')]['id']}})[_0xaaf9('0x14')](handleEntityNotFound(_0x2f45b8,null))[_0xaaf9('0x14')](function(_0x4d398a){if(_0x4d398a){_0x3410d5=_0x4d398a;_0x2aa6e2['model']=_[_0xaaf9('0x2c')](db['Team'][_0xaaf9('0x2d')]);_0x2aa6e2[_0xaaf9('0x2e')]=_['keys'](_0x51c014[_0xaaf9('0x2e')]);_0x2aa6e2[_0xaaf9('0x41')]=_['intersection'](_0x2aa6e2[_0xaaf9('0x2b')],_0x2aa6e2[_0xaaf9('0x2e')]);_0x2dd422[_0xaaf9('0x2f')]=_['intersection'](_0x2aa6e2[_0xaaf9('0x2b')],qs[_0xaaf9('0x31')](_0x51c014[_0xaaf9('0x2e')][_0xaaf9('0x31')]));_0x2dd422[_0xaaf9('0x2f')]=_0x2dd422[_0xaaf9('0x2f')][_0xaaf9('0x32')]?_0x2dd422['attributes']:_0x2aa6e2[_0xaaf9('0x2b')];_0x2dd422[_0xaaf9('0x43')]=qs['sort'](_0x51c014[_0xaaf9('0x2e')][_0xaaf9('0x44')]);_0x2dd422[_0xaaf9('0x24')]=qs['filters'](_[_0xaaf9('0x45')](_0x51c014[_0xaaf9('0x2e')],_0x2aa6e2[_0xaaf9('0x41')]));if(_0x51c014[_0xaaf9('0x2e')][_0xaaf9('0x47')]){_0x2dd422[_0xaaf9('0x24')]=_[_0xaaf9('0x34')](_0x2dd422[_0xaaf9('0x24')],{'$or':_[_0xaaf9('0x1f')](_0x2dd422[_0xaaf9('0x2f')],function(_0x4ae9f5){var _0x4c821f={};_0x4c821f[_0x4ae9f5]={'$like':'%'+_0x51c014[_0xaaf9('0x2e')][_0xaaf9('0x47')]+'%'};return _0x4c821f;})});}_0x2dd422=_['merge']({},_0x2dd422,_0x51c014[_0xaaf9('0x48')]);return _0x3410d5[_0xaaf9('0x53')](_0x2dd422);}})['then'](function(_0x616e1){if(_0x616e1){_0x37b258=_0x616e1[_0xaaf9('0x32')];if(!_0x51c014['query'][_0xaaf9('0x42')](_0xaaf9('0x54'))){_0x2dd422[_0xaaf9('0xf')]=qs[_0xaaf9('0xf')](_0x51c014['query']['limit']);_0x2dd422['offset']=qs[_0xaaf9('0x11')](_0x51c014[_0xaaf9('0x2e')]['offset']);}return _0x3410d5['getTeams'](_0x2dd422);}})[_0xaaf9('0x14')](function(_0xfb4c01){if(_0xfb4c01){return _0xfb4c01?{'count':_0x37b258,'rows':_0xfb4c01}:null;}})[_0xaaf9('0x14')](respondWithResult(_0x2f45b8,null))[_0xaaf9('0x28')](handleError(_0x2f45b8,null));};exports['addTeams']=function(_0x3e1c13,_0xb97bf6){var _0x555f56=_0x3e1c13[_0xaaf9('0x37')]['ids'];return db['Team']['findAll']({'where':{'id':_0x555f56},'attributes':['id'],'include':[{'model':db[_0xaaf9('0x4a')],'as':_0xaaf9('0x55'),'attributes':['id',_0xaaf9('0x1c'),_0xaaf9('0x56'),_0xaaf9('0x57'),_0xaaf9('0x58')],'raw':!![]}]})['then'](function(_0x383e7e){if(_0x383e7e){var _0x21a53=_[_0xaaf9('0x59')](_0x383e7e,function(_0x4190d4){var _0x2f395a=_0x4190d4['get']({'plain':!![]});return _0x2f395a[_0xaaf9('0x55')];});return db[_0xaaf9('0x20')][_0xaaf9('0x35')]({'where':{'id':_0x3e1c13['params']['id']}})[_0xaaf9('0x14')](function(_0x51bfce){return db[_0xaaf9('0x5a')][_0xaaf9('0x5b')](function(_0x55850f){return _0x51bfce[_0xaaf9('0x5c')](_0x555f56,{'transaction':_0x55850f})[_0xaaf9('0x14')](function(){return BPromise[_0xaaf9('0x5d')](_0x21a53,function(_0x2c439e){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x2c439e['id'],'OpenchannelQueueId':_0x3e1c13[_0xaaf9('0x2a')]['id']},'transaction':_0x55850f});});})[_0xaaf9('0x14')](function(){_0x21a53['forEach'](function(_0x54dd9d){socket[_0xaaf9('0x5e')](_0xaaf9('0x5f'),{'UserId':_0x54dd9d['id'],'OpenchannelQueueId':_0x51bfce['id']});});});});});}})['then'](respondWithStatusCode(_0xb97bf6,null))[_0xaaf9('0x28')](handleError(_0xb97bf6,null));};exports['removeTeams']=function(_0x30c1d0,_0x2b5b52){return db[_0xaaf9('0x60')]['findAll']({'where':{'id':_0x30c1d0[_0xaaf9('0x2e')][_0xaaf9('0x61')]},'attributes':['id'],'include':[{'model':db[_0xaaf9('0x4a')],'as':_0xaaf9('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2b5b52,null))[_0xaaf9('0x14')](function(_0x4695f1){var _0x428ef7=_[_0xaaf9('0x1f')](_0x4695f1,'id');var _0x33b40f=[];var _0x52b6d9=[];var _0x32fb4c=squel['select']();_0x32fb4c[_0xaaf9('0x62')](_0xaaf9('0x63'))['from'](_0xaaf9('0x64'),'tq')[_0xaaf9('0x65')](_0xaaf9('0x66'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xaaf9('0x24')](_0xaaf9('0x67'),_0x30c1d0[_0xaaf9('0x2a')]['id']);for(var _0x5aa8b3=0x0;_0x5aa8b3<_0x4695f1[_0xaaf9('0x32')];_0x5aa8b3+=0x1){let _0xc7d63f=_0x4695f1[_0x5aa8b3];for(var _0x13d432=0x0;_0x13d432<_0xc7d63f['Agents']['length'];_0x13d432+=0x1){let _0x3fe2ea=_0xc7d63f[_0xaaf9('0x55')][_0x13d432];var _0x22c266=_0x32fb4c[_0xaaf9('0x68')]();_0x22c266['where'](_0xaaf9('0x69'),_0x3fe2ea['id']);_0x52b6d9[_0xaaf9('0x6a')](db[_0xaaf9('0x5a')][_0xaaf9('0x2e')](_0x22c266['toString'](),{'type':db[_0xaaf9('0x5a')][_0xaaf9('0x6b')]['SELECT']})['then'](function(_0x449950){if(_0x449950[_0xaaf9('0x32')]===0x1){return _0x3fe2ea['id'];}else{var _0x4eefd9=_[_0xaaf9('0x6c')](_[_0xaaf9('0x1f')](_0x449950,_0xaaf9('0x6d')),function(_0x38e4cf){return _[_0xaaf9('0x6e')](_0x428ef7,_0x38e4cf);});if(_0x4eefd9){return _0x3fe2ea['id'];}}}));}}return BPromise['all'](_0x52b6d9)[_0xaaf9('0x14')](function(_0x47f23b){_0x33b40f=_(_0x33b40f)[_0xaaf9('0x6f')](_0x47f23b)[_0xaaf9('0x70')]()['value']();return db[_0xaaf9('0x20')]['find']({'where':{'id':_0x30c1d0[_0xaaf9('0x2a')]['id']}})['then'](function(_0xa9ba04){return db[_0xaaf9('0x5a')][_0xaaf9('0x5b')](function(_0x5d777a){return _0xa9ba04['removeTeams'](_0x30c1d0[_0xaaf9('0x2e')][_0xaaf9('0x61')],{'transaction':_0x5d777a})[_0xaaf9('0x14')](function(){if(!_[_0xaaf9('0x71')](_0x33b40f)){return _0xa9ba04[_0xaaf9('0x72')](_0x33b40f,{'transaction':_0x5d777a});}})[_0xaaf9('0x14')](function(){_0x33b40f['forEach'](function(_0x4dce05){socket[_0xaaf9('0x5e')]('userOpenchannelQueue:remove',{'UserId':_0x4dce05,'OpenchannelQueueId':_0xa9ba04['id']});});});});});});})[_0xaaf9('0x14')](respondWithStatusCode(_0x2b5b52,null))[_0xaaf9('0x28')](handleError(_0x2b5b52,null));};exports[_0xaaf9('0x73')]=function(_0x3a4dd0,_0x280588){return db[_0xaaf9('0x20')][_0xaaf9('0x35')]({'where':{'id':_0x3a4dd0[_0xaaf9('0x2a')]['id']}})[_0xaaf9('0x14')](handleEntityNotFound(_0x280588,null))['then'](function(_0x585603){if(_0x585603){return _0x585603[_0xaaf9('0x73')](_0x3a4dd0[_0xaaf9('0x37')][_0xaaf9('0x61')],_[_0xaaf9('0x74')](_0x3a4dd0[_0xaaf9('0x37')],[_0xaaf9('0x61'),'id'])||{})['spread'](function(_0x43c761){for(var _0xbfd0ac=0x0;_0xbfd0ac<_0x3a4dd0[_0xaaf9('0x37')]['ids']['length'];_0xbfd0ac+=0x1){socket[_0xaaf9('0x5e')](_0xaaf9('0x5f'),{'UserId':Number(_0x3a4dd0['body'][_0xaaf9('0x61')][_0xbfd0ac]),'OpenchannelQueueId':Number(_0x3a4dd0[_0xaaf9('0x2a')]['id'])});}return _0x43c761;});}})['then'](respondWithResult(_0x280588,null))['catch'](handleError(_0x280588,null));};exports[_0xaaf9('0x72')]=function(_0x1102de,_0x34d60b){return db[_0xaaf9('0x20')][_0xaaf9('0x35')]({'where':{'id':_0x1102de[_0xaaf9('0x2a')]['id']}})[_0xaaf9('0x14')](handleEntityNotFound(_0x34d60b,null))[_0xaaf9('0x14')](function(_0x2fd204){if(_0x2fd204){return _0x2fd204[_0xaaf9('0x72')](_0x1102de[_0xaaf9('0x2e')][_0xaaf9('0x61')])[_0xaaf9('0x14')](function(){if(_[_0xaaf9('0x75')](_0x1102de[_0xaaf9('0x2e')][_0xaaf9('0x61')])){for(var _0x4c91e9=0x0;_0x4c91e9<_0x1102de[_0xaaf9('0x2e')][_0xaaf9('0x61')]['length'];_0x4c91e9+=0x1){socket[_0xaaf9('0x5e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x1102de[_0xaaf9('0x2e')][_0xaaf9('0x61')][_0x4c91e9]),'OpenchannelQueueId':Number(_0x1102de[_0xaaf9('0x2a')]['id'])});}}else{socket[_0xaaf9('0x5e')](_0xaaf9('0x76'),{'UserId':Number(_0x1102de['query'][_0xaaf9('0x61')]),'OpenchannelQueueId':Number(_0x1102de['params']['id'])});}});}})[_0xaaf9('0x14')](respondWithStatusCode(_0x34d60b,null))[_0xaaf9('0x28')](handleError(_0x34d60b,null));};exports[_0xaaf9('0x77')]=function(_0xea1693,_0x357a9a){var _0x256bd9={};var _0x524f27={};var _0x5b2c95;var _0x1325ae;return db[_0xaaf9('0x20')]['findOne']({'where':{'id':_0xea1693['params']['id']}})[_0xaaf9('0x14')](handleEntityNotFound(_0x357a9a,null))[_0xaaf9('0x14')](function(_0x1a7691){if(_0x1a7691){_0x5b2c95=_0x1a7691;_0x524f27[_0xaaf9('0x2b')]=_[_0xaaf9('0x2c')](db['User'][_0xaaf9('0x2d')]);_0x524f27[_0xaaf9('0x2e')]=_[_0xaaf9('0x2c')](_0xea1693[_0xaaf9('0x2e')]);_0x524f27[_0xaaf9('0x41')]=_[_0xaaf9('0x30')](_0x524f27[_0xaaf9('0x2b')],_0x524f27[_0xaaf9('0x2e')]);_0x256bd9[_0xaaf9('0x2f')]=_['intersection'](_0x524f27[_0xaaf9('0x2b')],qs[_0xaaf9('0x31')](_0xea1693[_0xaaf9('0x2e')][_0xaaf9('0x31')]));_0x256bd9[_0xaaf9('0x2f')]=_0x256bd9['attributes'][_0xaaf9('0x32')]?_0x256bd9[_0xaaf9('0x2f')]:_0x524f27[_0xaaf9('0x2b')];_0x256bd9[_0xaaf9('0x43')]=qs['sort'](_0xea1693[_0xaaf9('0x2e')][_0xaaf9('0x44')]);_0x256bd9['where']=qs[_0xaaf9('0x41')](_[_0xaaf9('0x45')](_0xea1693['query'],_0x524f27['filters']));if(_0xea1693['query'][_0xaaf9('0x47')]){_0x256bd9[_0xaaf9('0x24')]=_['merge'](_0x256bd9['where'],{'$or':_[_0xaaf9('0x1f')](_0x256bd9[_0xaaf9('0x2f')],function(_0x450b74){var _0x3c1718={};_0x3c1718[_0x450b74]={'$like':'%'+_0xea1693[_0xaaf9('0x2e')][_0xaaf9('0x47')]+'%'};return _0x3c1718;})});}_0x256bd9=_[_0xaaf9('0x34')]({},_0x256bd9,_0xea1693['options']);return _0x5b2c95[_0xaaf9('0x77')](_0x256bd9);}})['then'](function(_0x5de109){if(_0x5de109){_0x1325ae=_0x5de109[_0xaaf9('0x32')];if(!_0xea1693[_0xaaf9('0x2e')][_0xaaf9('0x42')](_0xaaf9('0x54'))){_0x256bd9[_0xaaf9('0xf')]=qs[_0xaaf9('0xf')](_0xea1693[_0xaaf9('0x2e')][_0xaaf9('0xf')]);_0x256bd9[_0xaaf9('0x11')]=qs['offset'](_0xea1693['query'][_0xaaf9('0x11')]);}return _0x5b2c95[_0xaaf9('0x77')](_0x256bd9);}})[_0xaaf9('0x14')](function(_0x2ecf37){if(_0x2ecf37){return _0x2ecf37?{'count':_0x1325ae,'rows':_0x2ecf37}:null;}})['then'](respondWithResult(_0x357a9a,null))[_0xaaf9('0x28')](handleError(_0x357a9a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 8ec1f3b..245b06d 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 _0xe20e=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x299949,_0x29095d){var _0xa6b08a=function(_0x397f88){while(--_0x397f88){_0x299949['push'](_0x299949['shift']());}};_0xa6b08a(++_0x29095d);}(_0xe20e,0x146));var _0xee20=function(_0x2cfbcf,_0x2cf96f){_0x2cfbcf=_0x2cfbcf-0x0;var _0x41fc13=_0xe20e[_0x2cfbcf];return _0x41fc13;};'use strict';var EventEmitter=require(_0xee20('0x0'));var OpenchannelQueue=require(_0xee20('0x1'))['db'][_0xee20('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xee20('0x3')](0x0);var events={'afterCreate':_0xee20('0x4'),'afterUpdate':'update','afterDestroy':_0xee20('0x5')};function emitEvent(_0x1c9eef){return function(_0x388666,_0x5c3724,_0x1c98bf){OpenchannelQueueEvents[_0xee20('0x6')](_0x1c9eef+':'+_0x388666['id'],_0x388666);OpenchannelQueueEvents['emit'](_0x1c9eef,_0x388666);_0x1c98bf(null);};}for(var e in events){if(events[_0xee20('0x7')](e)){var event=events[e];OpenchannelQueue[_0xee20('0x8')](e,emitEvent(event));}}module[_0xee20('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xd700=['save','update','remove','emit','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0xdac678,_0x5d1714){var _0x92c2fe=function(_0x1108c5){while(--_0x1108c5){_0xdac678['push'](_0xdac678['shift']());}};_0x92c2fe(++_0x5d1714);}(_0xd700,0x164));var _0x0d70=function(_0x8ec947,_0x444fa2){_0x8ec947=_0x8ec947-0x0;var _0x115d2b=_0xd700[_0x8ec947];return _0x115d2b;};'use strict';var EventEmitter=require(_0x0d70('0x0'));var OpenchannelQueue=require(_0x0d70('0x1'))['db'][_0x0d70('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0d70('0x3')](0x0);var events={'afterCreate':_0x0d70('0x4'),'afterUpdate':_0x0d70('0x5'),'afterDestroy':_0x0d70('0x6')};function emitEvent(_0x3a0754){return function(_0x4116b9,_0x47f7af,_0x59f41f){OpenchannelQueueEvents['emit'](_0x3a0754+':'+_0x4116b9['id'],_0x4116b9);OpenchannelQueueEvents[_0x0d70('0x7')](_0x3a0754,_0x4116b9);_0x59f41f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x0d70('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index ff9c423..36232c0 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 _0x462a=['openchannel_queues','lodash','api','bluebird','request-promise','path','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x412f2c,_0x46c5c2){var _0x4876d9=function(_0x18f331){while(--_0x18f331){_0x412f2c['push'](_0x412f2c['shift']());}};_0x4876d9(++_0x46c5c2);}(_0x462a,0x6f));var _0xa462=function(_0x4ef25d,_0x5c71ca){_0x4ef25d=_0x4ef25d-0x0;var _0x34040f=_0x462a[_0x4ef25d];return _0x34040f;};'use strict';var _=require(_0xa462('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa462('0x1'));var moment=require('moment');var BPromise=require(_0xa462('0x2'));var rp=require(_0xa462('0x3'));var fs=require('fs');var path=require(_0xa462('0x4'));var rimraf=require(_0xa462('0x5'));var config=require('../../config/environment');var attributes=require(_0xa462('0x6'));module[_0xa462('0x7')]=function(_0x573555,_0x1796c4){return _0x573555[_0xa462('0x8')](_0xa462('0x9'),attributes,{'tableName':_0xa462('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7da=['OpenchannelQueue','lodash','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3b2b54,_0x2c38b7){var _0x16df50=function(_0x49d598){while(--_0x49d598){_0x3b2b54['push'](_0x3b2b54['shift']());}};_0x16df50(++_0x2c38b7);}(_0xf7da,0x1c3));var _0xaf7d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xf7da[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xaf7d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaf7d('0x1'));var moment=require(_0xaf7d('0x2'));var BPromise=require('bluebird');var rp=require(_0xaf7d('0x3'));var fs=require('fs');var path=require(_0xaf7d('0x4'));var rimraf=require(_0xaf7d('0x5'));var config=require(_0xaf7d('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0xaf7d('0x7')]=function(_0x77f8e2,_0x42d012){return _0x77f8e2[_0xaf7d('0x8')](_0xaf7d('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 6304640..1c94239 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 _0x2755=['request','then','request\x20sent','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','OpenchannelQueue','options','raw','limit','include','attributes','model','map','info','GetOpenchannelQueue','debug','stringify','catch','ShowOpenchannelQueue','find','where','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x358d68,_0x229010){var _0x255242=function(_0x5bd780){while(--_0x5bd780){_0x358d68['push'](_0x358d68['shift']());}};_0x255242(++_0x229010);}(_0x2755,0xe0));var _0x5275=function(_0x26daa3,_0x92de6d){_0x26daa3=_0x26daa3-0x0;var _0x49b9ca=_0x2755[_0x26daa3];return _0x49b9ca;};'use strict';var _=require(_0x5275('0x0'));var util=require(_0x5275('0x1'));var moment=require(_0x5275('0x2'));var BPromise=require(_0x5275('0x3'));var rs=require(_0x5275('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5275('0x5'));var logger=require('../../config/logger')(_0x5275('0x6'));var config=require(_0x5275('0x7'));var jayson=require(_0x5275('0x8'));var client=jayson[_0x5275('0x9')][_0x5275('0xa')]({'port':0x232a});config[_0x5275('0xb')]=_[_0x5275('0xc')](config[_0x5275('0xb')],{'host':_0x5275('0xd'),'port':0x18eb});var socket=require(_0x5275('0xe'))(new Redis(config[_0x5275('0xb')]));require('./openchannelQueue.socket')[_0x5275('0xf')](socket);function respondWithRpcPromise(_0x1b3bf0,_0x22c242,_0x2b8d24){return new BPromise(function(_0x1a9900,_0x3a7e4e){return client[_0x5275('0x10')](_0x1b3bf0,_0x2b8d24)[_0x5275('0x11')](function(_0x135929){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x22c242,_0x5275('0x12'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x22c242,_0x5275('0x12'),JSON['stringify'](_0x135929));if(_0x135929[_0x5275('0x13')]){if(_0x135929['error'][_0x5275('0x14')]===0x1f4){logger[_0x5275('0x13')](_0x5275('0x15'),_0x22c242,_0x135929[_0x5275('0x13')][_0x5275('0x16')]);return _0x3a7e4e(_0x135929[_0x5275('0x13')][_0x5275('0x16')]);}logger[_0x5275('0x13')](_0x5275('0x15'),_0x22c242,_0x135929[_0x5275('0x13')]['message']);return _0x1a9900(_0x135929[_0x5275('0x13')][_0x5275('0x16')]);}else{logger['info'](_0x5275('0x15'),_0x22c242,_0x5275('0x12'));_0x1a9900(_0x135929[_0x5275('0x17')]['message']);}})['catch'](function(_0x46913f){logger[_0x5275('0x13')](_0x5275('0x15'),_0x22c242,_0x46913f);_0x3a7e4e(_0x46913f);});});}exports['GetOpenchannelQueue']=function(_0x5b33ab){var _0x39d211=this;return new Promise(function(_0x4cb15e,_0x260f80){return db[_0x5275('0x18')]['findAll']({'raw':_0x5b33ab[_0x5275('0x19')]?_0x5b33ab[_0x5275('0x19')][_0x5275('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b33ab['options']?_0x5b33ab[_0x5275('0x19')]['where']||null:null,'attributes':_0x5b33ab['options']?_0x5b33ab[_0x5275('0x19')]['attributes']||null:null,'limit':_0x5b33ab[_0x5275('0x19')]?_0x5b33ab[_0x5275('0x19')][_0x5275('0x1b')]||null:null,'include':_0x5b33ab[_0x5275('0x19')]?_0x5b33ab[_0x5275('0x19')][_0x5275('0x1c')]?_['map'](_0x5b33ab[_0x5275('0x19')][_0x5275('0x1c')],function(_0x3fb420){return{'model':db[_0x3fb420['model']],'as':_0x3fb420['as'],'attributes':_0x3fb420[_0x5275('0x1d')],'include':_0x3fb420[_0x5275('0x1c')]?_['map'](_0x3fb420[_0x5275('0x1c')],function(_0xebdf44){return{'model':db[_0xebdf44[_0x5275('0x1e')]],'as':_0xebdf44['as'],'attributes':_0xebdf44[_0x5275('0x1d')],'include':_0xebdf44[_0x5275('0x1c')]?_[_0x5275('0x1f')](_0xebdf44['include'],function(_0x1fe7c9){return{'model':db[_0x1fe7c9['model']],'as':_0x1fe7c9['as'],'attributes':_0x1fe7c9[_0x5275('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5275('0x11')](function(_0x1486b4){logger[_0x5275('0x20')](_0x5275('0x21'),_0x5b33ab);logger[_0x5275('0x22')](_0x5275('0x21'),_0x5b33ab,JSON[_0x5275('0x23')](_0x1486b4));_0x4cb15e(_0x1486b4);})[_0x5275('0x24')](function(_0x3daf9e){logger[_0x5275('0x13')](_0x5275('0x21'),_0x3daf9e[_0x5275('0x16')],_0x5b33ab);_0x260f80(_0x39d211[_0x5275('0x13')](0x1f4,_0x3daf9e[_0x5275('0x16')]));});});};exports[_0x5275('0x25')]=function(_0x4f87c7){var _0x143ec9=this;return new Promise(function(_0x25f8ba,_0x5ebfec){return db[_0x5275('0x18')][_0x5275('0x26')]({'raw':_0x4f87c7[_0x5275('0x19')]?_0x4f87c7[_0x5275('0x19')][_0x5275('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f87c7[_0x5275('0x19')]?_0x4f87c7[_0x5275('0x19')][_0x5275('0x27')]||null:null,'attributes':_0x4f87c7['options']?_0x4f87c7[_0x5275('0x19')][_0x5275('0x1d')]||null:null,'include':_0x4f87c7[_0x5275('0x19')]?_0x4f87c7[_0x5275('0x19')]['include']?_[_0x5275('0x1f')](_0x4f87c7[_0x5275('0x19')]['include'],function(_0x9bb5b3){return{'model':db[_0x9bb5b3[_0x5275('0x1e')]],'as':_0x9bb5b3['as'],'attributes':_0x9bb5b3[_0x5275('0x1d')],'include':_0x9bb5b3[_0x5275('0x1c')]?_['map'](_0x9bb5b3['include'],function(_0x2af46c){return{'model':db[_0x2af46c[_0x5275('0x1e')]],'as':_0x2af46c['as'],'attributes':_0x2af46c['attributes'],'include':_0x2af46c[_0x5275('0x1c')]?_[_0x5275('0x1f')](_0x2af46c[_0x5275('0x1c')],function(_0x4ce492){return{'model':db[_0x4ce492[_0x5275('0x1e')]],'as':_0x4ce492['as'],'attributes':_0x4ce492['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x37b7d2){logger[_0x5275('0x20')](_0x5275('0x25'),_0x4f87c7);logger['debug']('ShowOpenchannelQueue',_0x4f87c7,JSON['stringify'](_0x37b7d2));_0x25f8ba(_0x37b7d2);})[_0x5275('0x24')](function(_0x4fa9e3){logger[_0x5275('0x13')]('ShowOpenchannelQueue',_0x4fa9e3[_0x5275('0x16')],_0x4f87c7);_0x5ebfec(_0x143ec9[_0x5275('0x13')](0x1f4,_0x4fa9e3[_0x5275('0x16')]));});});}; \ No newline at end of file +var _0xbd60=['model','then','catch','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x58bf55,_0x1e0a77){var _0x3be445=function(_0x103bfc){while(--_0x103bfc){_0x58bf55['push'](_0x58bf55['shift']());}};_0x3be445(++_0x1e0a77);}(_0xbd60,0x180));var _0x0bd6=function(_0x179314,_0x32d3a2){_0x179314=_0x179314-0x0;var _0x3556f7=_0xbd60[_0x179314];return _0x3556f7;};'use strict';var _=require(_0x0bd6('0x0'));var util=require('util');var moment=require(_0x0bd6('0x1'));var BPromise=require(_0x0bd6('0x2'));var rs=require(_0x0bd6('0x3'));var fs=require('fs');var Redis=require(_0x0bd6('0x4'));var db=require(_0x0bd6('0x5'))['db'];var utils=require(_0x0bd6('0x6'));var logger=require('../../config/logger')(_0x0bd6('0x7'));var config=require(_0x0bd6('0x8'));var jayson=require(_0x0bd6('0x9'));var client=jayson[_0x0bd6('0xa')][_0x0bd6('0xb')]({'port':0x232a});config[_0x0bd6('0xc')]=_[_0x0bd6('0xd')](config[_0x0bd6('0xc')],{'host':_0x0bd6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0bd6('0xf'))[_0x0bd6('0x10')](socket);function respondWithRpcPromise(_0x50c74e,_0x4474ad,_0x5aac9e){return new BPromise(function(_0x5041d5,_0x10c235){return client[_0x0bd6('0x11')](_0x50c74e,_0x5aac9e)['then'](function(_0x2dc988){logger[_0x0bd6('0x12')](_0x0bd6('0x13'),_0x4474ad,_0x0bd6('0x14'));logger[_0x0bd6('0x15')](_0x0bd6('0x16'),_0x4474ad,_0x0bd6('0x14'),JSON[_0x0bd6('0x17')](_0x2dc988));if(_0x2dc988['error']){if(_0x2dc988[_0x0bd6('0x18')]['code']===0x1f4){logger[_0x0bd6('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x4474ad,_0x2dc988[_0x0bd6('0x18')][_0x0bd6('0x19')]);return _0x10c235(_0x2dc988['error']['message']);}logger['error'](_0x0bd6('0x13'),_0x4474ad,_0x2dc988[_0x0bd6('0x18')][_0x0bd6('0x19')]);return _0x5041d5(_0x2dc988[_0x0bd6('0x18')][_0x0bd6('0x19')]);}else{logger[_0x0bd6('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x4474ad,'request\x20sent');_0x5041d5(_0x2dc988[_0x0bd6('0x1a')]['message']);}})['catch'](function(_0x1795dd){logger[_0x0bd6('0x18')](_0x0bd6('0x13'),_0x4474ad,_0x1795dd);_0x10c235(_0x1795dd);});});}exports[_0x0bd6('0x1b')]=function(_0x12313b){var _0x389d9c=this;return new Promise(function(_0x505540,_0x547841){return db['OpenchannelQueue'][_0x0bd6('0x1c')]({'raw':_0x12313b[_0x0bd6('0x1d')]?_0x12313b[_0x0bd6('0x1d')][_0x0bd6('0x1e')]===undefined?!![]:![]:!![],'where':_0x12313b[_0x0bd6('0x1d')]?_0x12313b[_0x0bd6('0x1d')][_0x0bd6('0x1f')]||null:null,'attributes':_0x12313b['options']?_0x12313b[_0x0bd6('0x1d')][_0x0bd6('0x20')]||null:null,'limit':_0x12313b[_0x0bd6('0x1d')]?_0x12313b[_0x0bd6('0x1d')][_0x0bd6('0x21')]||null:null,'include':_0x12313b[_0x0bd6('0x1d')]?_0x12313b[_0x0bd6('0x1d')][_0x0bd6('0x22')]?_[_0x0bd6('0x23')](_0x12313b[_0x0bd6('0x1d')][_0x0bd6('0x22')],function(_0x20e3a7){return{'model':db[_0x20e3a7[_0x0bd6('0x24')]],'as':_0x20e3a7['as'],'attributes':_0x20e3a7[_0x0bd6('0x20')],'include':_0x20e3a7[_0x0bd6('0x22')]?_['map'](_0x20e3a7[_0x0bd6('0x22')],function(_0x2c37d4){return{'model':db[_0x2c37d4[_0x0bd6('0x24')]],'as':_0x2c37d4['as'],'attributes':_0x2c37d4[_0x0bd6('0x20')],'include':_0x2c37d4[_0x0bd6('0x22')]?_[_0x0bd6('0x23')](_0x2c37d4[_0x0bd6('0x22')],function(_0x1e493b){return{'model':db[_0x1e493b[_0x0bd6('0x24')]],'as':_0x1e493b['as'],'attributes':_0x1e493b[_0x0bd6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0bd6('0x25')](function(_0x151613){logger[_0x0bd6('0x12')](_0x0bd6('0x1b'),_0x12313b);logger['debug'](_0x0bd6('0x1b'),_0x12313b,JSON[_0x0bd6('0x17')](_0x151613));_0x505540(_0x151613);})[_0x0bd6('0x26')](function(_0x4607e3){logger['error']('GetOpenchannelQueue',_0x4607e3[_0x0bd6('0x19')],_0x12313b);_0x547841(_0x389d9c[_0x0bd6('0x18')](0x1f4,_0x4607e3[_0x0bd6('0x19')]));});});};exports[_0x0bd6('0x27')]=function(_0x31066c){var _0x201a82=this;return new Promise(function(_0x5f9bf,_0x263a57){return db[_0x0bd6('0x28')][_0x0bd6('0x29')]({'raw':_0x31066c[_0x0bd6('0x1d')]?_0x31066c[_0x0bd6('0x1d')][_0x0bd6('0x1e')]===undefined?!![]:![]:!![],'where':_0x31066c['options']?_0x31066c[_0x0bd6('0x1d')][_0x0bd6('0x1f')]||null:null,'attributes':_0x31066c['options']?_0x31066c[_0x0bd6('0x1d')][_0x0bd6('0x20')]||null:null,'include':_0x31066c[_0x0bd6('0x1d')]?_0x31066c[_0x0bd6('0x1d')][_0x0bd6('0x22')]?_['map'](_0x31066c[_0x0bd6('0x1d')][_0x0bd6('0x22')],function(_0x553273){return{'model':db[_0x553273['model']],'as':_0x553273['as'],'attributes':_0x553273['attributes'],'include':_0x553273['include']?_[_0x0bd6('0x23')](_0x553273['include'],function(_0x2e6c5f){return{'model':db[_0x2e6c5f[_0x0bd6('0x24')]],'as':_0x2e6c5f['as'],'attributes':_0x2e6c5f[_0x0bd6('0x20')],'include':_0x2e6c5f[_0x0bd6('0x22')]?_[_0x0bd6('0x23')](_0x2e6c5f[_0x0bd6('0x22')],function(_0x39d5f4){return{'model':db[_0x39d5f4[_0x0bd6('0x24')]],'as':_0x39d5f4['as'],'attributes':_0x39d5f4[_0x0bd6('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x263436){logger[_0x0bd6('0x12')](_0x0bd6('0x27'),_0x31066c);logger['debug'](_0x0bd6('0x27'),_0x31066c,JSON[_0x0bd6('0x17')](_0x263436));_0x5f9bf(_0x263436);})['catch'](function(_0x39330c){logger[_0x0bd6('0x18')](_0x0bd6('0x27'),_0x39330c[_0x0bd6('0x19')],_0x31066c);_0x263a57(_0x201a82[_0x0bd6('0x18')](0x1f4,_0x39330c[_0x0bd6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 66744dd..cd04863 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 _0x6c1b=['length','save','remove','update','emit','removeListener','register'];(function(_0x3b891a,_0x1d6577){var _0x5d7f88=function(_0x169e74){while(--_0x169e74){_0x3b891a['push'](_0x3b891a['shift']());}};_0x5d7f88(++_0x1d6577);}(_0x6c1b,0x9b));var _0xb6c1=function(_0x3b3ceb,_0x35dc71){_0x3b3ceb=_0x3b3ceb-0x0;var _0x45c88d=_0x6c1b[_0x3b3ceb];return _0x45c88d;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xb6c1('0x0'),_0xb6c1('0x1'),_0xb6c1('0x2')];function createListener(_0x3e3166,_0x3eb068){return function(_0x12eaa1){_0x3eb068[_0xb6c1('0x3')](_0x3e3166,_0x12eaa1);};}function removeListener(_0x59591d,_0x57b3cf){return function(){OpenchannelQueueEvents[_0xb6c1('0x4')](_0x59591d,_0x57b3cf);};}exports[_0xb6c1('0x5')]=function(_0x452c74){for(var _0x27c2d1=0x0,_0x240bc9=events[_0xb6c1('0x6')];_0x27c2d1<_0x240bc9;_0x27c2d1++){var _0x33af9f=events[_0x27c2d1];var _0x484784=createListener('openchannelQueue:'+_0x33af9f,_0x452c74);OpenchannelQueueEvents['on'](_0x33af9f,_0x484784);}}; \ No newline at end of file +var _0x6189=['update','register','length','openchannelQueue:','save','remove'];(function(_0x5acfba,_0x47e7e3){var _0x958004=function(_0x17e079){while(--_0x17e079){_0x5acfba['push'](_0x5acfba['shift']());}};_0x958004(++_0x47e7e3);}(_0x6189,0x148));var _0x9618=function(_0x446ea3,_0x581dc1){_0x446ea3=_0x446ea3-0x0;var _0x5e4a90=_0x6189[_0x446ea3];return _0x5e4a90;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x9618('0x0'),_0x9618('0x1'),_0x9618('0x2')];function createListener(_0x46b1fa,_0x136a9a){return function(_0x49c16e){_0x136a9a['emit'](_0x46b1fa,_0x49c16e);};}function removeListener(_0x264a06,_0x34ad87){return function(){OpenchannelQueueEvents['removeListener'](_0x264a06,_0x34ad87);};}exports[_0x9618('0x3')]=function(_0x3c2bd9){for(var _0x2ea715=0x0,_0x14810d=events[_0x9618('0x4')];_0x2ea715<_0x14810d;_0x2ea715++){var _0x38e062=events[_0x2ea715];var _0xbd1787=createListener(_0x9618('0x5')+_0x38e062,_0x3c2bd9);OpenchannelQueueEvents['on'](_0x38e062,_0xbd1787);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 7624704..69a966b 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 _0xad8b=['/:id','post','create','put','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3515d7,_0x40696a){var _0x50fada=function(_0x26d72f){while(--_0x26d72f){_0x3515d7['push'](_0x3515d7['shift']());}};_0x50fada(++_0x40696a);}(_0xad8b,0x16e));var _0xbad8=function(_0x3dc9dc,_0x232d61){_0x3dc9dc=_0x3dc9dc-0x0;var _0x100498=_0xad8b[_0x3dc9dc];return _0x100498;};'use strict';var multer=require(_0xbad8('0x0'));var util=require(_0xbad8('0x1'));var path=require('path');var timeout=require(_0xbad8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbad8('0x3'));var auth=require(_0xbad8('0x4'));var interaction=require(_0xbad8('0x5'));var config=require(_0xbad8('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0xbad8('0x7')]('/',auth[_0xbad8('0x8')](),controller['index']);router[_0xbad8('0x7')]('/describe',auth[_0xbad8('0x8')](),controller['describe']);router[_0xbad8('0x7')](_0xbad8('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xbad8('0xa')]('/',auth[_0xbad8('0x8')](),controller[_0xbad8('0xb')]);router[_0xbad8('0xc')](_0xbad8('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xbad8('0xd')](_0xbad8('0x9'),auth[_0xbad8('0x8')](),controller['destroy']);module[_0xbad8('0xe')]=router; \ No newline at end of file +var _0xcdfd=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x435cc5,_0x3f4545){var _0xfff27=function(_0x37eb70){while(--_0x37eb70){_0x435cc5['push'](_0x435cc5['shift']());}};_0xfff27(++_0x3f4545);}(_0xcdfd,0x141));var _0xdcdf=function(_0x3dfc6a,_0x3f5c71){_0x3dfc6a=_0x3dfc6a-0x0;var _0x1872ba=_0xcdfd[_0x3dfc6a];return _0x1872ba;};'use strict';var multer=require(_0xdcdf('0x0'));var util=require(_0xdcdf('0x1'));var path=require(_0xdcdf('0x2'));var timeout=require(_0xdcdf('0x3'));var express=require(_0xdcdf('0x4'));var router=express[_0xdcdf('0x5')]();var fs_extra=require(_0xdcdf('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdcdf('0x7'));var config=require(_0xdcdf('0x8'));var controller=require(_0xdcdf('0x9'));router['get']('/',auth[_0xdcdf('0xa')](),controller[_0xdcdf('0xb')]);router[_0xdcdf('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xdcdf('0xd')]);router['get'](_0xdcdf('0xe'),auth[_0xdcdf('0xa')](),controller[_0xdcdf('0xf')]);router[_0xdcdf('0x10')]('/',auth[_0xdcdf('0xa')](),controller[_0xdcdf('0x11')]);router[_0xdcdf('0x12')](_0xdcdf('0xe'),auth[_0xdcdf('0xa')](),controller[_0xdcdf('0x13')]);router[_0xdcdf('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xdcdf('0x15')]);module[_0xdcdf('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 1f69da6..881fb43 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 _0xffcf=['moment','sequelize','STRING','DATE'];(function(_0x1a21c4,_0x5644d7){var _0x34385d=function(_0x2e2767){while(--_0x2e2767){_0x1a21c4['push'](_0x1a21c4['shift']());}};_0x34385d(++_0x5644d7);}(_0xffcf,0x180));var _0xfffc=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0xffcf[_0x19ac6e];return _0x1cdcf3;};'use strict';var moment=require(_0xfffc('0x0'));var Sequelize=require(_0xfffc('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xfffc('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfffc('0x3')]},'leaveAt':{'type':Sequelize[_0xfffc('0x3')]},'acceptAt':{'type':Sequelize[_0xfffc('0x3')]},'exitAt':{'type':Sequelize[_0xfffc('0x3')]},'reason':{'type':Sequelize[_0xfffc('0x2')]}}; \ No newline at end of file +var _0xc432=['STRING','DATE','moment'];(function(_0xdffc9a,_0x8779fb){var _0x591a69=function(_0x53ad9b){while(--_0x53ad9b){_0xdffc9a['push'](_0xdffc9a['shift']());}};_0x591a69(++_0x8779fb);}(_0xc432,0xb0));var _0x2c43=function(_0xbfca8e,_0x5d2d79){_0xbfca8e=_0xbfca8e-0x0;var _0x3eb4dd=_0xc432[_0xbfca8e];return _0x3eb4dd;};'use strict';var moment=require(_0x2c43('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2c43('0x1')]},'joinAt':{'type':Sequelize[_0x2c43('0x2')]},'leaveAt':{'type':Sequelize[_0x2c43('0x2')]},'acceptAt':{'type':Sequelize[_0x2c43('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x2c43('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index db69ca5..d70ba29 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 _0x567f=['json','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range'];(function(_0x88df1b,_0xda41dd){var _0x24af06=function(_0x5014a0){while(--_0x5014a0){_0x88df1b['push'](_0x88df1b['shift']());}};_0x24af06(++_0xda41dd);}(_0x567f,0xc1));var _0xf567=function(_0x49536b,_0x2abe5d){_0x49536b=_0x49536b-0x0;var _0x30de59=_0x567f[_0x49536b];return _0x30de59;};'use strict';var emlformat=require(_0xf567('0x0'));var rimraf=require(_0xf567('0x1'));var zipdir=require(_0xf567('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf567('0x3'));var moment=require('moment');var BPromise=require(_0xf567('0x4'));var Mustache=require(_0xf567('0x5'));var util=require(_0xf567('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf567('0x7'));var ejs=require(_0xf567('0x8'));var fs=require('fs');var fs_extra=require(_0xf567('0x9'));var _=require(_0xf567('0xa'));var squel=require(_0xf567('0xb'));var crypto=require(_0xf567('0xc'));var jsforce=require(_0xf567('0xd'));var deskjs=require(_0xf567('0xe'));var toCsv=require(_0xf567('0x7'));var querystring=require(_0xf567('0xf'));var Papa=require(_0xf567('0x10'));var Redis=require(_0xf567('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf567('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf567('0x13'));var logger=require(_0xf567('0x14'))('api');var utils=require(_0xf567('0x15'));var config=require(_0xf567('0x16'));var licenseUtil=require(_0xf567('0x17'));var db=require(_0xf567('0x18'))['db'];function respondWithStatusCode(_0x4ee2f0,_0x3ac9d9){_0x3ac9d9=_0x3ac9d9||0xcc;return function(_0x51828d){if(_0x51828d){return _0x4ee2f0[_0xf567('0x19')](_0x3ac9d9);}return _0x4ee2f0[_0xf567('0x1a')](_0x3ac9d9)['end']();};}function respondWithResult(_0x534602,_0x936626){_0x936626=_0x936626||0xc8;return function(_0x21991b){if(_0x21991b){return _0x534602[_0xf567('0x1a')](_0x936626)['json'](_0x21991b);}};}function respondWithFilteredResult(_0x3c0898,_0xf40b9f){return function(_0x37efa8){if(_0x37efa8){var _0x496143=typeof _0xf40b9f[_0xf567('0x1b')]===_0xf567('0x1c')&&typeof _0xf40b9f[_0xf567('0x1d')]==='undefined';var _0x5ad745=_0x37efa8[_0xf567('0x1e')];var _0x340a36=_0x496143?0x0:_0xf40b9f[_0xf567('0x1b')];var _0x173c1e=_0x496143?_0x37efa8[_0xf567('0x1e')]:_0xf40b9f[_0xf567('0x1b')]+_0xf40b9f[_0xf567('0x1d')];var _0x428bf8;if(_0x173c1e>=_0x5ad745){_0x173c1e=_0x5ad745;_0x428bf8=0xc8;}else{_0x428bf8=0xce;}_0x3c0898[_0xf567('0x1a')](_0x428bf8);return _0x3c0898['set'](_0xf567('0x1f'),_0x340a36+'-'+_0x173c1e+'/'+_0x5ad745)[_0xf567('0x20')](_0x37efa8);}return null;};}function patchUpdates(_0x46ee1a){return function(_0x216677){try{jsonpatch[_0xf567('0x21')](_0x216677,_0x46ee1a,!![]);}catch(_0x1d0091){return BPromise[_0xf567('0x22')](_0x1d0091);}return _0x216677['save']();};}function saveUpdates(_0x76fdd5,_0x20fad7){return function(_0x1644a7){if(_0x1644a7){return _0x1644a7[_0xf567('0x23')](_0x76fdd5)[_0xf567('0x24')](function(_0x58147a){return _0x58147a;});}return null;};}function removeEntity(_0x5bb6a7,_0x101af1){return function(_0x54730d){if(_0x54730d){return _0x54730d[_0xf567('0x25')]()[_0xf567('0x24')](function(){_0x5bb6a7[_0xf567('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a7fd8,_0x46e12b){return function(_0x6741b7){if(!_0x6741b7){_0x3a7fd8[_0xf567('0x19')](0x194);}return _0x6741b7;};}function handleError(_0x27bfbe,_0x1413aa){_0x1413aa=_0x1413aa||0x1f4;return function(_0x421e9e){logger[_0xf567('0x26')](_0x421e9e[_0xf567('0x27')]);if(_0x421e9e['name']){delete _0x421e9e[_0xf567('0x28')];}_0x27bfbe[_0xf567('0x1a')](_0x1413aa)[_0xf567('0x29')](_0x421e9e);};}exports[_0xf567('0x2a')]=function(_0x3d5813,_0x201d5d){var _0x3255d2={},_0x338a26={},_0x40003e={'count':0x0,'rows':[]};var _0x16810f=_[_0xf567('0x2b')](db[_0xf567('0x2c')][_0xf567('0x2d')],function(_0x44c13f){return{'name':_0x44c13f[_0xf567('0x2e')],'type':_0x44c13f[_0xf567('0x2f')]['key']};});_0x338a26[_0xf567('0x30')]=_[_0xf567('0x2b')](_0x16810f,_0xf567('0x28'));_0x338a26[_0xf567('0x31')]=_[_0xf567('0x32')](_0x3d5813[_0xf567('0x31')]);_0x338a26[_0xf567('0x33')]=_[_0xf567('0x34')](_0x338a26['model'],_0x338a26[_0xf567('0x31')]);_0x3255d2[_0xf567('0x35')]=_['intersection'](_0x338a26['model'],qs[_0xf567('0x36')](_0x3d5813[_0xf567('0x31')]['fields']));_0x3255d2[_0xf567('0x35')]=_0x3255d2['attributes']['length']?_0x3255d2[_0xf567('0x35')]:_0x338a26[_0xf567('0x30')];if(!_0x3d5813[_0xf567('0x31')][_0xf567('0x37')]('nolimit')){_0x3255d2[_0xf567('0x1d')]=qs['limit'](_0x3d5813[_0xf567('0x31')][_0xf567('0x1d')]);_0x3255d2[_0xf567('0x1b')]=qs[_0xf567('0x1b')](_0x3d5813[_0xf567('0x31')][_0xf567('0x1b')]);}_0x3255d2[_0xf567('0x38')]=qs[_0xf567('0x39')](_0x3d5813[_0xf567('0x31')][_0xf567('0x39')]);_0x3255d2[_0xf567('0x3a')]=qs[_0xf567('0x33')](_['pick'](_0x3d5813['query'],_0x338a26[_0xf567('0x33')]),_0x16810f);if(_0x3d5813['query']['filter']){_0x3255d2[_0xf567('0x3a')]=_['merge'](_0x3255d2[_0xf567('0x3a')],{'$or':_[_0xf567('0x2b')](_0x16810f,function(_0x5df27f){if(_0x5df27f[_0xf567('0x2f')]!==_0xf567('0x3b')){var _0x3600d5={};_0x3600d5[_0x5df27f[_0xf567('0x28')]]={'$like':'%'+_0x3d5813['query'][_0xf567('0x3c')]+'%'};return _0x3600d5;}})});}_0x3255d2=_[_0xf567('0x3d')]({},_0x3255d2,_0x3d5813[_0xf567('0x3e')]);var _0x6a7404={'where':_0x3255d2['where']};return db[_0xf567('0x2c')][_0xf567('0x1e')](_0x6a7404)['then'](function(_0x3046e8){_0x40003e[_0xf567('0x1e')]=_0x3046e8;if(_0x3d5813['query'][_0xf567('0x3f')]){_0x3255d2[_0xf567('0x40')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xf567('0x41')](_0x3255d2);})['then'](function(_0x46d6a1){_0x40003e[_0xf567('0x42')]=_0x46d6a1;return _0x40003e;})['then'](respondWithFilteredResult(_0x201d5d,_0x3255d2))[_0xf567('0x43')](handleError(_0x201d5d,null));};exports[_0xf567('0x44')]=function(_0x474fdb,_0x3a73d1){var _0x2e2e92={'raw':!![],'where':{'id':_0x474fdb[_0xf567('0x45')]['id']}},_0x45c4cc={};_0x45c4cc[_0xf567('0x30')]=_[_0xf567('0x32')](db[_0xf567('0x2c')]['rawAttributes']);_0x45c4cc[_0xf567('0x31')]=_[_0xf567('0x32')](_0x474fdb['query']);_0x45c4cc['filters']=_[_0xf567('0x34')](_0x45c4cc[_0xf567('0x30')],_0x45c4cc['query']);_0x2e2e92[_0xf567('0x35')]=_[_0xf567('0x34')](_0x45c4cc['model'],qs[_0xf567('0x36')](_0x474fdb['query'][_0xf567('0x36')]));_0x2e2e92[_0xf567('0x35')]=_0x2e2e92[_0xf567('0x35')][_0xf567('0x46')]?_0x2e2e92[_0xf567('0x35')]:_0x45c4cc[_0xf567('0x30')];if(_0x474fdb[_0xf567('0x31')]['includeAll']){_0x2e2e92[_0xf567('0x40')]=[{'all':!![]}];}_0x2e2e92=_[_0xf567('0x3d')]({},_0x2e2e92,_0x474fdb[_0xf567('0x3e')]);return db[_0xf567('0x2c')][_0xf567('0x47')](_0x2e2e92)[_0xf567('0x24')](handleEntityNotFound(_0x3a73d1,null))[_0xf567('0x24')](respondWithResult(_0x3a73d1,null))[_0xf567('0x43')](handleError(_0x3a73d1,null));};exports['create']=function(_0x82c694,_0x4896d4){return db[_0xf567('0x2c')][_0xf567('0x48')](_0x82c694[_0xf567('0x49')],{})[_0xf567('0x24')](respondWithResult(_0x4896d4,0xc9))['catch'](handleError(_0x4896d4,null));};exports['update']=function(_0x26f8e0,_0x2b3a91){if(_0x26f8e0[_0xf567('0x49')]['id']){delete _0x26f8e0[_0xf567('0x49')]['id'];}return db[_0xf567('0x2c')][_0xf567('0x47')]({'where':{'id':_0x26f8e0['params']['id']}})['then'](handleEntityNotFound(_0x2b3a91,null))[_0xf567('0x24')](saveUpdates(_0x26f8e0['body'],null))['then'](respondWithResult(_0x2b3a91,null))[_0xf567('0x43')](handleError(_0x2b3a91,null));};exports[_0xf567('0x25')]=function(_0x534348,_0x498c7b){return db[_0xf567('0x2c')]['find']({'where':{'id':_0x534348['params']['id']}})['then'](handleEntityNotFound(_0x498c7b,null))[_0xf567('0x24')](removeEntity(_0x498c7b,null))[_0xf567('0x43')](handleError(_0x498c7b,null));};exports['describe']=function(_0x4e49c1,_0x4c4d1f){return db[_0xf567('0x2c')][_0xf567('0x4a')]()[_0xf567('0x24')](respondWithResult(_0x4c4d1f,null))[_0xf567('0x43')](handleError(_0x4c4d1f,null));}; \ No newline at end of file +var _0x42d5=['sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','eml-format','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x447249,_0x50f9bf){var _0x2a77b2=function(_0x1f4779){while(--_0x1f4779){_0x447249['push'](_0x447249['shift']());}};_0x2a77b2(++_0x50f9bf);}(_0x42d5,0x1c7));var _0x542d=function(_0xd6674a,_0x2638d0){_0xd6674a=_0xd6674a-0x0;var _0x267304=_0x42d5[_0xd6674a];return _0x267304;};'use strict';var emlformat=require(_0x542d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x542d('0x1'));var BPromise=require(_0x542d('0x2'));var Mustache=require(_0x542d('0x3'));var util=require('util');var path=require(_0x542d('0x4'));var sox=require(_0x542d('0x5'));var csv=require('to-csv');var ejs=require(_0x542d('0x6'));var fs=require('fs');var fs_extra=require(_0x542d('0x7'));var _=require(_0x542d('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x542d('0x9'));var deskjs=require(_0x542d('0xa'));var toCsv=require('to-csv');var querystring=require(_0x542d('0xb'));var Papa=require('papaparse');var Redis=require(_0x542d('0xc'));var authService=require(_0x542d('0xd'));var qs=require(_0x542d('0xe'));var as=require(_0x542d('0xf'));var hardwareService=require(_0x542d('0x10'));var logger=require(_0x542d('0x11'))(_0x542d('0x12'));var utils=require('../../config/utils');var config=require(_0x542d('0x13'));var licenseUtil=require(_0x542d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ffd05,_0x229719){_0x229719=_0x229719||0xcc;return function(_0x3e5171){if(_0x3e5171){return _0x1ffd05[_0x542d('0x15')](_0x229719);}return _0x1ffd05[_0x542d('0x16')](_0x229719)[_0x542d('0x17')]();};}function respondWithResult(_0x9e5e64,_0x1ce19b){_0x1ce19b=_0x1ce19b||0xc8;return function(_0x791952){if(_0x791952){return _0x9e5e64['status'](_0x1ce19b)['json'](_0x791952);}};}function respondWithFilteredResult(_0x5cf3e5,_0xdd1a66){return function(_0x5c0302){if(_0x5c0302){var _0xb7f12f=typeof _0xdd1a66['offset']===_0x542d('0x18')&&typeof _0xdd1a66[_0x542d('0x19')]==='undefined';var _0x4ee5cd=_0x5c0302[_0x542d('0x1a')];var _0x152dc3=_0xb7f12f?0x0:_0xdd1a66[_0x542d('0x1b')];var _0x1cc5dd=_0xb7f12f?_0x5c0302[_0x542d('0x1a')]:_0xdd1a66['offset']+_0xdd1a66[_0x542d('0x19')];var _0x19b18a;if(_0x1cc5dd>=_0x4ee5cd){_0x1cc5dd=_0x4ee5cd;_0x19b18a=0xc8;}else{_0x19b18a=0xce;}_0x5cf3e5[_0x542d('0x16')](_0x19b18a);return _0x5cf3e5[_0x542d('0x1c')](_0x542d('0x1d'),_0x152dc3+'-'+_0x1cc5dd+'/'+_0x4ee5cd)[_0x542d('0x1e')](_0x5c0302);}return null;};}function patchUpdates(_0xd22d56){return function(_0x429167){try{jsonpatch[_0x542d('0x1f')](_0x429167,_0xd22d56,!![]);}catch(_0x2bc55f){return BPromise[_0x542d('0x20')](_0x2bc55f);}return _0x429167[_0x542d('0x21')]();};}function saveUpdates(_0x4f5c1e,_0xc146d1){return function(_0x1fc78f){if(_0x1fc78f){return _0x1fc78f[_0x542d('0x22')](_0x4f5c1e)['then'](function(_0x215d0d){return _0x215d0d;});}return null;};}function removeEntity(_0x411e72,_0x4f9b0a){return function(_0x3ba86a){if(_0x3ba86a){return _0x3ba86a[_0x542d('0x23')]()[_0x542d('0x24')](function(){_0x411e72[_0x542d('0x16')](0xcc)[_0x542d('0x17')]();});}};}function handleEntityNotFound(_0x314aae,_0x76c4b5){return function(_0x7fb998){if(!_0x7fb998){_0x314aae[_0x542d('0x15')](0x194);}return _0x7fb998;};}function handleError(_0x2449b6,_0x3dee49){_0x3dee49=_0x3dee49||0x1f4;return function(_0x2e7ef7){logger['error'](_0x2e7ef7[_0x542d('0x25')]);if(_0x2e7ef7[_0x542d('0x26')]){delete _0x2e7ef7[_0x542d('0x26')];}_0x2449b6[_0x542d('0x16')](_0x3dee49)[_0x542d('0x27')](_0x2e7ef7);};}exports[_0x542d('0x28')]=function(_0x272e1d,_0x29645b){var _0x327c78={},_0x232103={},_0x15fedd={'count':0x0,'rows':[]};var _0x479b84=_['map'](db[_0x542d('0x29')][_0x542d('0x2a')],function(_0x56f6f3){return{'name':_0x56f6f3[_0x542d('0x2b')],'type':_0x56f6f3[_0x542d('0x2c')][_0x542d('0x2d')]};});_0x232103[_0x542d('0x2e')]=_[_0x542d('0x2f')](_0x479b84,'name');_0x232103[_0x542d('0x30')]=_[_0x542d('0x31')](_0x272e1d[_0x542d('0x30')]);_0x232103['filters']=_[_0x542d('0x32')](_0x232103[_0x542d('0x2e')],_0x232103[_0x542d('0x30')]);_0x327c78[_0x542d('0x33')]=_[_0x542d('0x32')](_0x232103['model'],qs['fields'](_0x272e1d[_0x542d('0x30')][_0x542d('0x34')]));_0x327c78['attributes']=_0x327c78[_0x542d('0x33')][_0x542d('0x35')]?_0x327c78['attributes']:_0x232103[_0x542d('0x2e')];if(!_0x272e1d[_0x542d('0x30')][_0x542d('0x36')]('nolimit')){_0x327c78['limit']=qs[_0x542d('0x19')](_0x272e1d[_0x542d('0x30')][_0x542d('0x19')]);_0x327c78[_0x542d('0x1b')]=qs[_0x542d('0x1b')](_0x272e1d[_0x542d('0x30')][_0x542d('0x1b')]);}_0x327c78[_0x542d('0x37')]=qs['sort'](_0x272e1d[_0x542d('0x30')][_0x542d('0x38')]);_0x327c78['where']=qs[_0x542d('0x39')](_[_0x542d('0x3a')](_0x272e1d[_0x542d('0x30')],_0x232103[_0x542d('0x39')]),_0x479b84);if(_0x272e1d[_0x542d('0x30')][_0x542d('0x3b')]){_0x327c78[_0x542d('0x3c')]=_[_0x542d('0x3d')](_0x327c78[_0x542d('0x3c')],{'$or':_['map'](_0x479b84,function(_0x134ef9){if(_0x134ef9['type']!==_0x542d('0x3e')){var _0x59bef1={};_0x59bef1[_0x134ef9[_0x542d('0x26')]]={'$like':'%'+_0x272e1d[_0x542d('0x30')][_0x542d('0x3b')]+'%'};return _0x59bef1;}})});}_0x327c78=_[_0x542d('0x3d')]({},_0x327c78,_0x272e1d[_0x542d('0x3f')]);var _0xcc9cbc={'where':_0x327c78[_0x542d('0x3c')]};return db[_0x542d('0x29')][_0x542d('0x1a')](_0xcc9cbc)[_0x542d('0x24')](function(_0x32a28f){_0x15fedd[_0x542d('0x1a')]=_0x32a28f;if(_0x272e1d[_0x542d('0x30')][_0x542d('0x40')]){_0x327c78[_0x542d('0x41')]=[{'all':!![]}];}return db[_0x542d('0x29')]['findAll'](_0x327c78);})[_0x542d('0x24')](function(_0x509ea7){_0x15fedd[_0x542d('0x42')]=_0x509ea7;return _0x15fedd;})[_0x542d('0x24')](respondWithFilteredResult(_0x29645b,_0x327c78))[_0x542d('0x43')](handleError(_0x29645b,null));};exports[_0x542d('0x44')]=function(_0x177d9f,_0x6d4eee){var _0x113e39={'raw':!![],'where':{'id':_0x177d9f['params']['id']}},_0x1c1271={};_0x1c1271[_0x542d('0x2e')]=_['keys'](db['OpenchannelQueueReport'][_0x542d('0x2a')]);_0x1c1271[_0x542d('0x30')]=_[_0x542d('0x31')](_0x177d9f['query']);_0x1c1271['filters']=_[_0x542d('0x32')](_0x1c1271['model'],_0x1c1271[_0x542d('0x30')]);_0x113e39[_0x542d('0x33')]=_[_0x542d('0x32')](_0x1c1271['model'],qs['fields'](_0x177d9f['query']['fields']));_0x113e39[_0x542d('0x33')]=_0x113e39[_0x542d('0x33')][_0x542d('0x35')]?_0x113e39[_0x542d('0x33')]:_0x1c1271[_0x542d('0x2e')];if(_0x177d9f[_0x542d('0x30')][_0x542d('0x40')]){_0x113e39['include']=[{'all':!![]}];}_0x113e39=_[_0x542d('0x3d')]({},_0x113e39,_0x177d9f[_0x542d('0x3f')]);return db[_0x542d('0x29')][_0x542d('0x45')](_0x113e39)[_0x542d('0x24')](handleEntityNotFound(_0x6d4eee,null))[_0x542d('0x24')](respondWithResult(_0x6d4eee,null))[_0x542d('0x43')](handleError(_0x6d4eee,null));};exports['create']=function(_0x418779,_0x419ffa){return db[_0x542d('0x29')][_0x542d('0x46')](_0x418779[_0x542d('0x47')],{})[_0x542d('0x24')](respondWithResult(_0x419ffa,0xc9))['catch'](handleError(_0x419ffa,null));};exports['update']=function(_0x5386ac,_0x495176){if(_0x5386ac[_0x542d('0x47')]['id']){delete _0x5386ac[_0x542d('0x47')]['id'];}return db['OpenchannelQueueReport'][_0x542d('0x45')]({'where':{'id':_0x5386ac['params']['id']}})['then'](handleEntityNotFound(_0x495176,null))[_0x542d('0x24')](saveUpdates(_0x5386ac[_0x542d('0x47')],null))[_0x542d('0x24')](respondWithResult(_0x495176,null))[_0x542d('0x43')](handleError(_0x495176,null));};exports[_0x542d('0x23')]=function(_0x454323,_0x18ab9a){return db[_0x542d('0x29')]['find']({'where':{'id':_0x454323[_0x542d('0x48')]['id']}})[_0x542d('0x24')](handleEntityNotFound(_0x18ab9a,null))[_0x542d('0x24')](removeEntity(_0x18ab9a,null))[_0x542d('0x43')](handleError(_0x18ab9a,null));};exports['describe']=function(_0x48cffe,_0x4c50d0){return db[_0x542d('0x29')]['describe']()[_0x542d('0x24')](respondWithResult(_0x4c50d0,null))[_0x542d('0x43')](handleError(_0x4c50d0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index ece795a..2b368cd 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x224b00,_0x2024df){var _0x2896b4=function(_0x3f75c9){while(--_0x3f75c9){_0x224b00['push'](_0x224b00['shift']());}};_0x2896b4(++_0x2024df);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4aa[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x11595a,_0x58ed48){var _0x34cc1e=function(_0x5e6aec){while(--_0x5e6aec){_0x11595a['push'](_0x11595a['shift']());}};_0x34cc1e(++_0x58ed48);}(_0x5fc3,0xa8));var _0x35fc=function(_0x42ca15,_0x193ccb){_0x42ca15=_0x42ca15-0x0;var _0x1c6ded=_0x5fc3[_0x42ca15];return _0x1c6ded;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index ed1ec5f..3c342ca 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 _0xfcbb=['body','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','UpdateOpenchannelQueueReport','update'];(function(_0x82e2cf,_0x351e10){var _0x8bc00f=function(_0x408f57){while(--_0x408f57){_0x82e2cf['push'](_0x82e2cf['shift']());}};_0x8bc00f(++_0x351e10);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x131edc,_0x251ac4){_0x131edc=_0x131edc-0x0;var _0x648d58=_0xfcbb[_0x131edc];return _0x648d58;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbfcb('0xa')](function(_0x1a7225){logger['info']('CreateOpenchannelQueueReport',_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x1a7225));_0x3404aa(_0x1a7225);})[_0xbfcb('0x15')](function(_0x1c5924){logger['error'](_0xbfcb('0x16'),_0x1c5924[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x1c5924[_0xbfcb('0x13')]));});});};exports[_0xbfcb('0x1a')]=function(_0x19616c){var _0x69c8e9=this;return new Promise(function(_0x14e43c,_0x11f6f7){return db[_0xbfcb('0x17')][_0xbfcb('0x1b')](_0x19616c[_0xbfcb('0x1c')],{'raw':_0x19616c[_0xbfcb('0x19')]?_0x19616c[_0xbfcb('0x19')][_0xbfcb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19616c[_0xbfcb('0x19')]?_0x19616c['options'][_0xbfcb('0x1e')]||null:null,'attributes':_0x19616c[_0xbfcb('0x19')]?_0x19616c['options'][_0xbfcb('0x1f')]||null:null,'limit':_0x19616c[_0xbfcb('0x19')]?_0x19616c[_0xbfcb('0x19')][_0xbfcb('0x20')]||null:null})[_0xbfcb('0xa')](function(_0x3542e9){logger[_0xbfcb('0xb')](_0xbfcb('0x1a'),_0x19616c);logger[_0xbfcb('0xd')](_0xbfcb('0x1a'),_0x19616c,JSON['stringify'](_0x3542e9));_0x14e43c(_0x3542e9);})[_0xbfcb('0x15')](function(_0x3aa3cd){logger[_0xbfcb('0x10')](_0xbfcb('0x1a'),_0x3aa3cd[_0xbfcb('0x13')],_0x19616c);_0x11f6f7(_0x69c8e9[_0xbfcb('0x10')](0x1f4,_0x3aa3cd[_0xbfcb('0x13')]));});});}; \ No newline at end of file +var _0x536f=['../../config/logger','../../config/environment','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','debug','catch','update','body','raw','where','attributes','UpdateOpenchannelQueueReport','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0xcc581c,_0x414241){var _0xcd8e39=function(_0xdee7eb){while(--_0xdee7eb){_0xcc581c['push'](_0xcc581c['shift']());}};_0xcd8e39(++_0x414241);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf536('0x1'));var db=require(_0xf536('0x2'))['db'];var utils=require(_0xf536('0x3'));var logger=require(_0xf536('0x4'))('rpc');var config=require(_0xf536('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf536('0x6')][_0xf536('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fc517,_0x486ee3,_0x5952b7){return new BPromise(function(_0x3b5191,_0x422541){return client[_0xf536('0x8')](_0x2fc517,_0x5952b7)[_0xf536('0x9')](function(_0x4f2eaf){logger['info'](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x486ee3,_0xf536('0xb'),JSON[_0xf536('0xc')](_0x4f2eaf));if(_0x4f2eaf[_0xf536('0xd')]){if(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xe')]===0x1f4){logger['error'](_0xf536('0xa'),_0x486ee3,_0x4f2eaf['error'][_0xf536('0xf')]);return _0x422541(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}logger[_0xf536('0xd')](_0xf536('0xa'),_0x486ee3,_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);return _0x3b5191(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}else{logger[_0xf536('0x10')](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));_0x3b5191(_0x4f2eaf['result'][_0xf536('0xf')]);}})['catch'](function(_0x238b9d){logger['error'](_0xf536('0xa'),_0x486ee3,_0x238b9d);_0x422541(_0x238b9d);});});}exports[_0xf536('0x11')]=function(_0xbca324){var _0x19756b=this;return new Promise(function(_0x4532a0,_0x189334){return db[_0xf536('0x12')][_0xf536('0x13')](_0xbca324['body'],{'raw':_0xbca324[_0xf536('0x14')]?_0xbca324[_0xf536('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x466f95){logger[_0xf536('0x10')](_0xf536('0x11'),_0xbca324);logger[_0xf536('0x15')](_0xf536('0x11'),_0xbca324,JSON[_0xf536('0xc')](_0x466f95));_0x4532a0(_0x466f95);})[_0xf536('0x16')](function(_0xe1d6a8){logger[_0xf536('0xd')](_0xf536('0x11'),_0xe1d6a8['message'],_0xbca324);_0x189334(_0x19756b[_0xf536('0xd')](0x1f4,_0xe1d6a8[_0xf536('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1df79c){var _0xddf70e=this;return new Promise(function(_0x2d9dfb,_0x252cae){return db[_0xf536('0x12')][_0xf536('0x17')](_0x1df79c[_0xf536('0x18')],{'raw':_0x1df79c['options']?_0x1df79c[_0xf536('0x14')][_0xf536('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1df79c[_0xf536('0x14')]?_0x1df79c[_0xf536('0x14')][_0xf536('0x1a')]||null:null,'attributes':_0x1df79c['options']?_0x1df79c[_0xf536('0x14')][_0xf536('0x1b')]||null:null,'limit':_0x1df79c[_0xf536('0x14')]?_0x1df79c[_0xf536('0x14')]['limit']||null:null})[_0xf536('0x9')](function(_0x485da0){logger[_0xf536('0x10')](_0xf536('0x1c'),_0x1df79c);logger[_0xf536('0x15')](_0xf536('0x1c'),_0x1df79c,JSON[_0xf536('0xc')](_0x485da0));_0x2d9dfb(_0x485da0);})[_0xf536('0x16')](function(_0x330c47){logger[_0xf536('0xd')](_0xf536('0x1c'),_0x330c47[_0xf536('0xf')],_0x1df79c);_0x252cae(_0xddf70e[_0xf536('0xd')](0x1f4,_0x330c47[_0xf536('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index f624f28..628e524 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 _0x2184=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x40acaf,_0x5b87da){var _0x579e9f=function(_0x5153e9){while(--_0x5153e9){_0x40acaf['push'](_0x40acaf['shift']());}};_0x579e9f(++_0x5b87da);}(_0x2184,0x6d));var _0x4218=function(_0x10b4db,_0x5da334){_0x10b4db=_0x10b4db-0x0;var _0x2e738e=_0x2184[_0x10b4db];return _0x2e738e;};'use strict';var multer=require(_0x4218('0x0'));var util=require(_0x4218('0x1'));var path=require(_0x4218('0x2'));var timeout=require(_0x4218('0x3'));var express=require(_0x4218('0x4'));var router=express[_0x4218('0x5')]();var fs_extra=require(_0x4218('0x6'));var auth=require(_0x4218('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4218('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0x4218('0x9')]('/',auth[_0x4218('0xa')](),controller['index']);router[_0x4218('0x9')](_0x4218('0xb'),auth[_0x4218('0xa')](),controller['describe']);router[_0x4218('0x9')](_0x4218('0xc'),auth['isAuthenticated'](),controller[_0x4218('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4218('0xe')]);router[_0x4218('0xf')](_0x4218('0xc'),auth[_0x4218('0xa')](),controller[_0x4218('0x10')]);router[_0x4218('0x11')]('/:id',auth[_0x4218('0xa')](),controller['destroy']);module[_0x4218('0x12')]=router; \ No newline at end of file +var _0x4af1=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create','put','destroy','exports','multer'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x4af1,0x179));var _0x14af=function(_0x580239,_0x135bfc){_0x580239=_0x580239-0x0;var _0x31993c=_0x4af1[_0x580239];return _0x31993c;};'use strict';var multer=require(_0x14af('0x0'));var util=require(_0x14af('0x1'));var path=require('path');var timeout=require(_0x14af('0x2'));var express=require(_0x14af('0x3'));var router=express['Router']();var fs_extra=require(_0x14af('0x4'));var auth=require(_0x14af('0x5'));var interaction=require(_0x14af('0x6'));var config=require(_0x14af('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x14af('0x8')]('/',auth[_0x14af('0x9')](),controller[_0x14af('0xa')]);router[_0x14af('0x8')]('/describe',auth[_0x14af('0x9')](),controller[_0x14af('0xb')]);router[_0x14af('0x8')](_0x14af('0xc'),auth[_0x14af('0x9')](),controller[_0x14af('0xd')]);router['post']('/',auth[_0x14af('0x9')](),controller[_0x14af('0xe')]);router[_0x14af('0xf')]('/:id',auth[_0x14af('0x9')](),controller['update']);router['delete'](_0x14af('0xc'),auth[_0x14af('0x9')](),controller[_0x14af('0x10')]);module[_0x14af('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index ccd2c98..2fe7ee6 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x2c7377,_0x32ade5){var _0x35e181=function(_0x1be1e6){while(--_0x1be1e6){_0x2c7377['push'](_0x2c7377['shift']());}};_0x35e181(++_0x32ade5);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5ad43c,_0x3e6348){_0x5ad43c=_0x5ad43c-0x0;var _0x1ee77e=_0xb43b[_0x5ad43c];return _0x1ee77e;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 522b19e..ce4e1e9 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 _0x2721=['mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','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','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','destroy','then','name','send','index','map','OpenchannelTransferReport','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','find','catch','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x447f9b,_0x5d18c6){var _0xcfee4e=function(_0x15cea3){while(--_0x15cea3){_0x447f9b['push'](_0x447f9b['shift']());}};_0xcfee4e(++_0x5d18c6);}(_0x2721,0x1c3));var _0x1272=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x2721[_0x5f309e];return _0x487b5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1272('0x0'));var zipdir=require(_0x1272('0x1'));var jsonpatch=require(_0x1272('0x2'));var rp=require(_0x1272('0x3'));var moment=require(_0x1272('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1272('0x5'));var util=require(_0x1272('0x6'));var path=require(_0x1272('0x7'));var sox=require('sox');var csv=require(_0x1272('0x8'));var ejs=require(_0x1272('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1272('0xa'));var squel=require(_0x1272('0xb'));var crypto=require(_0x1272('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1272('0xd'));var toCsv=require(_0x1272('0x8'));var querystring=require(_0x1272('0xe'));var Papa=require(_0x1272('0xf'));var Redis=require(_0x1272('0x10'));var authService=require(_0x1272('0x11'));var qs=require(_0x1272('0x12'));var as=require(_0x1272('0x13'));var hardwareService=require(_0x1272('0x14'));var logger=require('../../config/logger')(_0x1272('0x15'));var utils=require('../../config/utils');var config=require(_0x1272('0x16'));var licenseUtil=require(_0x1272('0x17'));var db=require(_0x1272('0x18'))['db'];function respondWithStatusCode(_0x12b1ae,_0x2ffe35){_0x2ffe35=_0x2ffe35||0xcc;return function(_0x5ebe8e){if(_0x5ebe8e){return _0x12b1ae[_0x1272('0x19')](_0x2ffe35);}return _0x12b1ae[_0x1272('0x1a')](_0x2ffe35)[_0x1272('0x1b')]();};}function respondWithResult(_0x5d78d6,_0x11738d){_0x11738d=_0x11738d||0xc8;return function(_0x281f96){if(_0x281f96){return _0x5d78d6['status'](_0x11738d)['json'](_0x281f96);}};}function respondWithFilteredResult(_0x33710f,_0x212140){return function(_0x105f0b){if(_0x105f0b){var _0x4c5f1a=typeof _0x212140[_0x1272('0x1c')]==='undefined'&&typeof _0x212140[_0x1272('0x1d')]===_0x1272('0x1e');var _0x1f9e25=_0x105f0b['count'];var _0x594848=_0x4c5f1a?0x0:_0x212140[_0x1272('0x1c')];var _0x468a88=_0x4c5f1a?_0x105f0b[_0x1272('0x1f')]:_0x212140[_0x1272('0x1c')]+_0x212140[_0x1272('0x1d')];var _0x52534a;if(_0x468a88>=_0x1f9e25){_0x468a88=_0x1f9e25;_0x52534a=0xc8;}else{_0x52534a=0xce;}_0x33710f[_0x1272('0x1a')](_0x52534a);return _0x33710f[_0x1272('0x20')](_0x1272('0x21'),_0x594848+'-'+_0x468a88+'/'+_0x1f9e25)[_0x1272('0x22')](_0x105f0b);}return null;};}function patchUpdates(_0x41ce09){return function(_0xba9878){try{jsonpatch['apply'](_0xba9878,_0x41ce09,!![]);}catch(_0x17ecc2){return BPromise[_0x1272('0x23')](_0x17ecc2);}return _0xba9878[_0x1272('0x24')]();};}function saveUpdates(_0x2a991e,_0x142f91){return function(_0x17d648){if(_0x17d648){return _0x17d648[_0x1272('0x25')](_0x2a991e)['then'](function(_0x330fec){return _0x330fec;});}return null;};}function removeEntity(_0x50190e,_0x43e892){return function(_0x2e7ac6){if(_0x2e7ac6){return _0x2e7ac6[_0x1272('0x26')]()[_0x1272('0x27')](function(){_0x50190e['status'](0xcc)[_0x1272('0x1b')]();});}};}function handleEntityNotFound(_0x581994,_0x409b9f){return function(_0x585bc5){if(!_0x585bc5){_0x581994['sendStatus'](0x194);}return _0x585bc5;};}function handleError(_0x134511,_0x4fc0f5){_0x4fc0f5=_0x4fc0f5||0x1f4;return function(_0x4ca777){logger['error'](_0x4ca777['stack']);if(_0x4ca777['name']){delete _0x4ca777[_0x1272('0x28')];}_0x134511[_0x1272('0x1a')](_0x4fc0f5)[_0x1272('0x29')](_0x4ca777);};}exports[_0x1272('0x2a')]=function(_0x47c51a,_0x3cf2c7){var _0xcd4f26={},_0x314773={},_0x4b159c={'count':0x0,'rows':[]};var _0x3dc9e1=_[_0x1272('0x2b')](db[_0x1272('0x2c')][_0x1272('0x2d')],function(_0x2b7375){return{'name':_0x2b7375['fieldName'],'type':_0x2b7375['type'][_0x1272('0x2e')]};});_0x314773[_0x1272('0x2f')]=_[_0x1272('0x2b')](_0x3dc9e1,_0x1272('0x28'));_0x314773[_0x1272('0x30')]=_[_0x1272('0x31')](_0x47c51a[_0x1272('0x30')]);_0x314773['filters']=_[_0x1272('0x32')](_0x314773[_0x1272('0x2f')],_0x314773[_0x1272('0x30')]);_0xcd4f26['attributes']=_['intersection'](_0x314773[_0x1272('0x2f')],qs[_0x1272('0x33')](_0x47c51a[_0x1272('0x30')][_0x1272('0x33')]));_0xcd4f26[_0x1272('0x34')]=_0xcd4f26[_0x1272('0x34')][_0x1272('0x35')]?_0xcd4f26[_0x1272('0x34')]:_0x314773['model'];if(!_0x47c51a[_0x1272('0x30')][_0x1272('0x36')](_0x1272('0x37'))){_0xcd4f26[_0x1272('0x1d')]=qs[_0x1272('0x1d')](_0x47c51a[_0x1272('0x30')]['limit']);_0xcd4f26[_0x1272('0x1c')]=qs[_0x1272('0x1c')](_0x47c51a[_0x1272('0x30')][_0x1272('0x1c')]);}_0xcd4f26[_0x1272('0x38')]=qs['sort'](_0x47c51a[_0x1272('0x30')][_0x1272('0x39')]);_0xcd4f26[_0x1272('0x3a')]=qs[_0x1272('0x3b')](_[_0x1272('0x3c')](_0x47c51a[_0x1272('0x30')],_0x314773[_0x1272('0x3b')]),_0x3dc9e1);if(_0x47c51a[_0x1272('0x30')][_0x1272('0x3d')]){_0xcd4f26[_0x1272('0x3a')]=_[_0x1272('0x3e')](_0xcd4f26[_0x1272('0x3a')],{'$or':_[_0x1272('0x2b')](_0x3dc9e1,function(_0x478066){if(_0x478066[_0x1272('0x3f')]!==_0x1272('0x40')){var _0x416b47={};_0x416b47[_0x478066['name']]={'$like':'%'+_0x47c51a[_0x1272('0x30')][_0x1272('0x3d')]+'%'};return _0x416b47;}})});}_0xcd4f26=_['merge']({},_0xcd4f26,_0x47c51a[_0x1272('0x41')]);var _0x480798={'where':_0xcd4f26['where']};return db[_0x1272('0x2c')][_0x1272('0x1f')](_0x480798)[_0x1272('0x27')](function(_0x1bca54){_0x4b159c[_0x1272('0x1f')]=_0x1bca54;if(_0x47c51a[_0x1272('0x30')][_0x1272('0x42')]){_0xcd4f26[_0x1272('0x43')]=[{'all':!![]}];}return db[_0x1272('0x2c')]['findAll'](_0xcd4f26);})[_0x1272('0x27')](function(_0x454c66){_0x4b159c[_0x1272('0x44')]=_0x454c66;return _0x4b159c;})['then'](respondWithFilteredResult(_0x3cf2c7,_0xcd4f26))['catch'](handleError(_0x3cf2c7,null));};exports[_0x1272('0x45')]=function(_0x1fe3de,_0x58d46d){var _0x33dee0={'raw':!![],'where':{'id':_0x1fe3de['params']['id']}},_0xe69223={};_0xe69223['model']=_['keys'](db[_0x1272('0x2c')]['rawAttributes']);_0xe69223[_0x1272('0x30')]=_[_0x1272('0x31')](_0x1fe3de[_0x1272('0x30')]);_0xe69223[_0x1272('0x3b')]=_[_0x1272('0x32')](_0xe69223['model'],_0xe69223[_0x1272('0x30')]);_0x33dee0[_0x1272('0x34')]=_[_0x1272('0x32')](_0xe69223[_0x1272('0x2f')],qs[_0x1272('0x33')](_0x1fe3de[_0x1272('0x30')][_0x1272('0x33')]));_0x33dee0[_0x1272('0x34')]=_0x33dee0[_0x1272('0x34')][_0x1272('0x35')]?_0x33dee0[_0x1272('0x34')]:_0xe69223[_0x1272('0x2f')];if(_0x1fe3de['query']['includeAll']){_0x33dee0[_0x1272('0x43')]=[{'all':!![]}];}_0x33dee0=_[_0x1272('0x3e')]({},_0x33dee0,_0x1fe3de['options']);return db[_0x1272('0x2c')][_0x1272('0x46')](_0x33dee0)[_0x1272('0x27')](handleEntityNotFound(_0x58d46d,null))[_0x1272('0x27')](respondWithResult(_0x58d46d,null))[_0x1272('0x47')](handleError(_0x58d46d,null));};exports[_0x1272('0x48')]=function(_0x22f536,_0x148e80){return db[_0x1272('0x2c')][_0x1272('0x48')](_0x22f536[_0x1272('0x49')],{})[_0x1272('0x27')](respondWithResult(_0x148e80,0xc9))[_0x1272('0x47')](handleError(_0x148e80,null));};exports[_0x1272('0x25')]=function(_0x4f0dba,_0x51c6c0){if(_0x4f0dba['body']['id']){delete _0x4f0dba[_0x1272('0x49')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x4f0dba['params']['id']}})[_0x1272('0x27')](handleEntityNotFound(_0x51c6c0,null))['then'](saveUpdates(_0x4f0dba[_0x1272('0x49')],null))[_0x1272('0x27')](respondWithResult(_0x51c6c0,null))[_0x1272('0x47')](handleError(_0x51c6c0,null));};exports[_0x1272('0x26')]=function(_0x3cc266,_0x3d2475){return db[_0x1272('0x2c')][_0x1272('0x46')]({'where':{'id':_0x3cc266[_0x1272('0x4a')]['id']}})[_0x1272('0x27')](handleEntityNotFound(_0x3d2475,null))[_0x1272('0x27')](removeEntity(_0x3d2475,null))['catch'](handleError(_0x3d2475,null));};exports[_0x1272('0x4b')]=function(_0x1b7025,_0x2312fc){return db['OpenchannelTransferReport'][_0x1272('0x4b')]()[_0x1272('0x27')](respondWithResult(_0x2312fc,null))['catch'](handleError(_0x2312fc,null));}; \ No newline at end of file +var _0x7ad4=['query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','findAll','show','params','length','includeAll','include','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model'];(function(_0x7f842,_0x50c142){var _0x52afae=function(_0x144d38){while(--_0x144d38){_0x7f842['push'](_0x7f842['shift']());}};_0x52afae(++_0x50c142);}(_0x7ad4,0x1e9));var _0x47ad=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7ad4[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x47ad('0x0'));var rimraf=require(_0x47ad('0x1'));var zipdir=require(_0x47ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47ad('0x3'));var moment=require(_0x47ad('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x47ad('0x5'));var path=require('path');var sox=require(_0x47ad('0x6'));var csv=require(_0x47ad('0x7'));var ejs=require(_0x47ad('0x8'));var fs=require('fs');var fs_extra=require(_0x47ad('0x9'));var _=require('lodash');var squel=require(_0x47ad('0xa'));var crypto=require(_0x47ad('0xb'));var jsforce=require(_0x47ad('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x47ad('0xd'));var Papa=require(_0x47ad('0xe'));var Redis=require(_0x47ad('0xf'));var authService=require(_0x47ad('0x10'));var qs=require(_0x47ad('0x11'));var as=require(_0x47ad('0x12'));var hardwareService=require(_0x47ad('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x47ad('0x14'));var config=require(_0x47ad('0x15'));var licenseUtil=require(_0x47ad('0x16'));var db=require(_0x47ad('0x17'))['db'];function respondWithStatusCode(_0x2962f7,_0x2a07a3){_0x2a07a3=_0x2a07a3||0xcc;return function(_0x167ebe){if(_0x167ebe){return _0x2962f7[_0x47ad('0x18')](_0x2a07a3);}return _0x2962f7[_0x47ad('0x19')](_0x2a07a3)[_0x47ad('0x1a')]();};}function respondWithResult(_0x1744de,_0x50e24){_0x50e24=_0x50e24||0xc8;return function(_0x55f5b3){if(_0x55f5b3){return _0x1744de[_0x47ad('0x19')](_0x50e24)[_0x47ad('0x1b')](_0x55f5b3);}};}function respondWithFilteredResult(_0x226b46,_0x33ca89){return function(_0x59f04d){if(_0x59f04d){var _0x416fbd=typeof _0x33ca89['offset']==='undefined'&&typeof _0x33ca89[_0x47ad('0x1c')]===_0x47ad('0x1d');var _0x590dd9=_0x59f04d[_0x47ad('0x1e')];var _0x2f0714=_0x416fbd?0x0:_0x33ca89[_0x47ad('0x1f')];var _0x5b7948=_0x416fbd?_0x59f04d[_0x47ad('0x1e')]:_0x33ca89['offset']+_0x33ca89[_0x47ad('0x1c')];var _0x1c8e5f;if(_0x5b7948>=_0x590dd9){_0x5b7948=_0x590dd9;_0x1c8e5f=0xc8;}else{_0x1c8e5f=0xce;}_0x226b46[_0x47ad('0x19')](_0x1c8e5f);return _0x226b46[_0x47ad('0x20')](_0x47ad('0x21'),_0x2f0714+'-'+_0x5b7948+'/'+_0x590dd9)[_0x47ad('0x1b')](_0x59f04d);}return null;};}function patchUpdates(_0x424ca0){return function(_0x5c4def){try{jsonpatch['apply'](_0x5c4def,_0x424ca0,!![]);}catch(_0x3152be){return BPromise[_0x47ad('0x22')](_0x3152be);}return _0x5c4def[_0x47ad('0x23')]();};}function saveUpdates(_0x27ebea,_0x40879a){return function(_0x13cf71){if(_0x13cf71){return _0x13cf71[_0x47ad('0x24')](_0x27ebea)['then'](function(_0x2237a4){return _0x2237a4;});}return null;};}function removeEntity(_0x30a08d,_0x147904){return function(_0x4229ce){if(_0x4229ce){return _0x4229ce[_0x47ad('0x25')]()[_0x47ad('0x26')](function(){_0x30a08d[_0x47ad('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x227671,_0x261982){return function(_0x452f00){if(!_0x452f00){_0x227671[_0x47ad('0x18')](0x194);}return _0x452f00;};}function handleError(_0x535294,_0x337846){_0x337846=_0x337846||0x1f4;return function(_0x17c244){logger[_0x47ad('0x27')](_0x17c244[_0x47ad('0x28')]);if(_0x17c244[_0x47ad('0x29')]){delete _0x17c244['name'];}_0x535294[_0x47ad('0x19')](_0x337846)[_0x47ad('0x2a')](_0x17c244);};}exports[_0x47ad('0x2b')]=function(_0x40074c,_0x357f92){var _0x1a52dc={},_0x1782f4={},_0x381ed1={'count':0x0,'rows':[]};var _0x189acc=_[_0x47ad('0x2c')](db[_0x47ad('0x2d')][_0x47ad('0x2e')],function(_0x4acb22){return{'name':_0x4acb22[_0x47ad('0x2f')],'type':_0x4acb22[_0x47ad('0x30')]['key']};});_0x1782f4[_0x47ad('0x31')]=_['map'](_0x189acc,_0x47ad('0x29'));_0x1782f4[_0x47ad('0x32')]=_[_0x47ad('0x33')](_0x40074c[_0x47ad('0x32')]);_0x1782f4['filters']=_[_0x47ad('0x34')](_0x1782f4['model'],_0x1782f4[_0x47ad('0x32')]);_0x1a52dc[_0x47ad('0x35')]=_['intersection'](_0x1782f4[_0x47ad('0x31')],qs[_0x47ad('0x36')](_0x40074c[_0x47ad('0x32')][_0x47ad('0x36')]));_0x1a52dc[_0x47ad('0x35')]=_0x1a52dc[_0x47ad('0x35')]['length']?_0x1a52dc[_0x47ad('0x35')]:_0x1782f4[_0x47ad('0x31')];if(!_0x40074c[_0x47ad('0x32')][_0x47ad('0x37')](_0x47ad('0x38'))){_0x1a52dc[_0x47ad('0x1c')]=qs[_0x47ad('0x1c')](_0x40074c[_0x47ad('0x32')][_0x47ad('0x1c')]);_0x1a52dc[_0x47ad('0x1f')]=qs[_0x47ad('0x1f')](_0x40074c[_0x47ad('0x32')][_0x47ad('0x1f')]);}_0x1a52dc[_0x47ad('0x39')]=qs[_0x47ad('0x3a')](_0x40074c['query'][_0x47ad('0x3a')]);_0x1a52dc['where']=qs[_0x47ad('0x3b')](_[_0x47ad('0x3c')](_0x40074c[_0x47ad('0x32')],_0x1782f4['filters']),_0x189acc);if(_0x40074c[_0x47ad('0x32')]['filter']){_0x1a52dc['where']=_[_0x47ad('0x3d')](_0x1a52dc[_0x47ad('0x3e')],{'$or':_['map'](_0x189acc,function(_0x346fd7){if(_0x346fd7[_0x47ad('0x30')]!==_0x47ad('0x3f')){var _0x17d3a3={};_0x17d3a3[_0x346fd7[_0x47ad('0x29')]]={'$like':'%'+_0x40074c['query'][_0x47ad('0x40')]+'%'};return _0x17d3a3;}})});}_0x1a52dc=_[_0x47ad('0x3d')]({},_0x1a52dc,_0x40074c['options']);var _0x5914d5={'where':_0x1a52dc['where']};return db['OpenchannelTransferReport'][_0x47ad('0x1e')](_0x5914d5)['then'](function(_0x51ed0e){_0x381ed1[_0x47ad('0x1e')]=_0x51ed0e;if(_0x40074c[_0x47ad('0x32')]['includeAll']){_0x1a52dc['include']=[{'all':!![]}];}return db[_0x47ad('0x2d')][_0x47ad('0x41')](_0x1a52dc);})['then'](function(_0xbd34e7){_0x381ed1['rows']=_0xbd34e7;return _0x381ed1;})[_0x47ad('0x26')](respondWithFilteredResult(_0x357f92,_0x1a52dc))['catch'](handleError(_0x357f92,null));};exports[_0x47ad('0x42')]=function(_0x5317e4,_0x1e8c60){var _0x513361={'raw':!![],'where':{'id':_0x5317e4[_0x47ad('0x43')]['id']}},_0x57070e={};_0x57070e[_0x47ad('0x31')]=_['keys'](db[_0x47ad('0x2d')][_0x47ad('0x2e')]);_0x57070e['query']=_[_0x47ad('0x33')](_0x5317e4[_0x47ad('0x32')]);_0x57070e[_0x47ad('0x3b')]=_[_0x47ad('0x34')](_0x57070e[_0x47ad('0x31')],_0x57070e['query']);_0x513361[_0x47ad('0x35')]=_[_0x47ad('0x34')](_0x57070e[_0x47ad('0x31')],qs[_0x47ad('0x36')](_0x5317e4[_0x47ad('0x32')][_0x47ad('0x36')]));_0x513361[_0x47ad('0x35')]=_0x513361[_0x47ad('0x35')][_0x47ad('0x44')]?_0x513361['attributes']:_0x57070e[_0x47ad('0x31')];if(_0x5317e4[_0x47ad('0x32')][_0x47ad('0x45')]){_0x513361[_0x47ad('0x46')]=[{'all':!![]}];}_0x513361=_[_0x47ad('0x3d')]({},_0x513361,_0x5317e4[_0x47ad('0x47')]);return db[_0x47ad('0x2d')][_0x47ad('0x48')](_0x513361)[_0x47ad('0x26')](handleEntityNotFound(_0x1e8c60,null))[_0x47ad('0x26')](respondWithResult(_0x1e8c60,null))[_0x47ad('0x49')](handleError(_0x1e8c60,null));};exports[_0x47ad('0x4a')]=function(_0xba3110,_0x457e64){return db[_0x47ad('0x2d')][_0x47ad('0x4a')](_0xba3110[_0x47ad('0x4b')],{})[_0x47ad('0x26')](respondWithResult(_0x457e64,0xc9))[_0x47ad('0x49')](handleError(_0x457e64,null));};exports[_0x47ad('0x24')]=function(_0x196242,_0x431162){if(_0x196242[_0x47ad('0x4b')]['id']){delete _0x196242[_0x47ad('0x4b')]['id'];}return db['OpenchannelTransferReport'][_0x47ad('0x48')]({'where':{'id':_0x196242['params']['id']}})[_0x47ad('0x26')](handleEntityNotFound(_0x431162,null))[_0x47ad('0x26')](saveUpdates(_0x196242[_0x47ad('0x4b')],null))[_0x47ad('0x26')](respondWithResult(_0x431162,null))[_0x47ad('0x49')](handleError(_0x431162,null));};exports[_0x47ad('0x25')]=function(_0x7e29ed,_0x22e9e6){return db[_0x47ad('0x2d')][_0x47ad('0x48')]({'where':{'id':_0x7e29ed[_0x47ad('0x43')]['id']}})[_0x47ad('0x26')](handleEntityNotFound(_0x22e9e6,null))[_0x47ad('0x26')](removeEntity(_0x22e9e6,null))[_0x47ad('0x49')](handleError(_0x22e9e6,null));};exports[_0x47ad('0x4c')]=function(_0x25cbdb,_0x390f48){return db[_0x47ad('0x2d')][_0x47ad('0x4c')]()[_0x47ad('0x26')](respondWithResult(_0x390f48,null))[_0x47ad('0x49')](handleError(_0x390f48,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d947b15..133cc30 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 _0x2a51=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','request-promise','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x584d66,_0x596890){var _0x2e8f1c=function(_0x58afac){while(--_0x58afac){_0x584d66['push'](_0x584d66['shift']());}};_0x2e8f1c(++_0x596890);}(_0x2a51,0x1d7));var _0x12a5=function(_0x3f1431,_0x361a12){_0x3f1431=_0x3f1431-0x0;var _0x3e780f=_0x2a51[_0x3f1431];return _0x3e780f;};'use strict';var _=require(_0x12a5('0x0'));var util=require(_0x12a5('0x1'));var logger=require('../../config/logger')(_0x12a5('0x2'));var moment=require(_0x12a5('0x3'));var BPromise=require('bluebird');var rp=require(_0x12a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x12a5('0x5'));var attributes=require(_0x12a5('0x6'));module[_0x12a5('0x7')]=function(_0x30adef,_0x55214c){return _0x30adef[_0x12a5('0x8')](_0x12a5('0x9'),attributes,{'tableName':_0x12a5('0xa'),'paranoid':![],'indexes':[{'name':_0x12a5('0xb'),'fields':[_0x12a5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x279d=['bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5ba8b3,_0x462f2b){var _0x4ba550=function(_0x3afc24){while(--_0x3afc24){_0x5ba8b3['push'](_0x5ba8b3['shift']());}};_0x4ba550(++_0x462f2b);}(_0x279d,0x133));var _0xd279=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x279d[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xd279('0x0'));var util=require(_0xd279('0x1'));var logger=require(_0xd279('0x2'))(_0xd279('0x3'));var moment=require(_0xd279('0x4'));var BPromise=require(_0xd279('0x5'));var rp=require(_0xd279('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd279('0x7'));var config=require(_0xd279('0x8'));var attributes=require(_0xd279('0x9'));module['exports']=function(_0x177636,_0x2c3fb6){return _0x177636['define'](_0xd279('0xa'),attributes,{'tableName':_0xd279('0xb'),'paranoid':![],'indexes':[{'name':_0xd279('0xc'),'fields':[_0xd279('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 66accab..71a616f 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 _0x078c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x24ac52,_0x33f5b8){var _0x4f4f21=function(_0x4dfe2c){while(--_0x4dfe2c){_0x24ac52['push'](_0x24ac52['shift']());}};_0x4f4f21(++_0x33f5b8);}(_0x078c,0x19f));var _0xc078=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0x078c[_0x30bd66];return _0x74c9dd;};'use strict';var _=require(_0xc078('0x0'));var util=require('util');var moment=require(_0xc078('0x1'));var BPromise=require(_0xc078('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc078('0x3'));var db=require(_0xc078('0x4'))['db'];var utils=require(_0xc078('0x5'));var logger=require(_0xc078('0x6'))('rpc');var config=require(_0xc078('0x7'));var jayson=require(_0xc078('0x8'));var client=jayson[_0xc078('0x9')][_0xc078('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40e428,_0x1705b0,_0x22661e){return new BPromise(function(_0x4030b1,_0x4d56df){return client['request'](_0x40e428,_0x22661e)['then'](function(_0x28dc54){logger[_0xc078('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1705b0,_0xc078('0xc'));logger[_0xc078('0xd')](_0xc078('0xe'),_0x1705b0,_0xc078('0xc'),JSON[_0xc078('0xf')](_0x28dc54));if(_0x28dc54['error']){if(_0x28dc54['error'][_0xc078('0x10')]===0x1f4){logger[_0xc078('0x11')](_0xc078('0x12'),_0x1705b0,_0x28dc54[_0xc078('0x11')][_0xc078('0x13')]);return _0x4d56df(_0x28dc54[_0xc078('0x11')][_0xc078('0x13')]);}logger[_0xc078('0x11')](_0xc078('0x12'),_0x1705b0,_0x28dc54[_0xc078('0x11')][_0xc078('0x13')]);return _0x4030b1(_0x28dc54[_0xc078('0x11')][_0xc078('0x13')]);}else{logger[_0xc078('0xb')](_0xc078('0x12'),_0x1705b0,'request\x20sent');_0x4030b1(_0x28dc54[_0xc078('0x14')][_0xc078('0x13')]);}})[_0xc078('0x15')](function(_0x595b14){logger[_0xc078('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1705b0,_0x595b14);_0x4d56df(_0x595b14);});});} \ No newline at end of file +var _0x4ab0=['jayson/promise','client','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x162a95,_0x9dfb1f){var _0x54cd40=function(_0x249ed1){while(--_0x249ed1){_0x162a95['push'](_0x162a95['shift']());}};_0x54cd40(++_0x9dfb1f);}(_0x4ab0,0xd5));var _0x04ab=function(_0x2fd0d1,_0x24f605){_0x2fd0d1=_0x2fd0d1-0x0;var _0x359edf=_0x4ab0[_0x2fd0d1];return _0x359edf;};'use strict';var _=require('lodash');var util=require(_0x04ab('0x0'));var moment=require(_0x04ab('0x1'));var BPromise=require(_0x04ab('0x2'));var rs=require(_0x04ab('0x3'));var fs=require('fs');var Redis=require(_0x04ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x04ab('0x5'))(_0x04ab('0x6'));var config=require('../../config/environment');var jayson=require(_0x04ab('0x7'));var client=jayson[_0x04ab('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f5901,_0x293f1d,_0x1ff7f6){return new BPromise(function(_0x4bc05e,_0x101d6b){return client[_0x04ab('0x9')](_0x3f5901,_0x1ff7f6)[_0x04ab('0xa')](function(_0x41ce1e){logger['info'](_0x04ab('0xb'),_0x293f1d,_0x04ab('0xc'));logger[_0x04ab('0xd')](_0x04ab('0xe'),_0x293f1d,'request\x20sent',JSON[_0x04ab('0xf')](_0x41ce1e));if(_0x41ce1e[_0x04ab('0x10')]){if(_0x41ce1e[_0x04ab('0x10')][_0x04ab('0x11')]===0x1f4){logger[_0x04ab('0x10')](_0x04ab('0xb'),_0x293f1d,_0x41ce1e['error'][_0x04ab('0x12')]);return _0x101d6b(_0x41ce1e['error'][_0x04ab('0x12')]);}logger[_0x04ab('0x10')](_0x04ab('0xb'),_0x293f1d,_0x41ce1e[_0x04ab('0x10')]['message']);return _0x4bc05e(_0x41ce1e['error']['message']);}else{logger[_0x04ab('0x13')](_0x04ab('0xb'),_0x293f1d,_0x04ab('0xc'));_0x4bc05e(_0x41ce1e[_0x04ab('0x14')][_0x04ab('0x12')]);}})[_0x04ab('0x15')](function(_0x42c937){logger[_0x04ab('0x10')](_0x04ab('0xb'),_0x293f1d,_0x42c937);_0x101d6b(_0x42c937);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 65a81bd..1fd8ddc 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 _0x7efa=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x7efa,0x68));var _0xa7ef=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x7efa[_0xadde88];return _0x3b8eb6;};'use strict';var multer=require(_0xa7ef('0x0'));var util=require(_0xa7ef('0x1'));var path=require(_0xa7ef('0x2'));var timeout=require(_0xa7ef('0x3'));var express=require(_0xa7ef('0x4'));var router=express[_0xa7ef('0x5')]();var fs_extra=require(_0xa7ef('0x6'));var auth=require(_0xa7ef('0x7'));var interaction=require(_0xa7ef('0x8'));var config=require(_0xa7ef('0x9'));var controller=require(_0xa7ef('0xa'));router[_0xa7ef('0xb')]('/',auth[_0xa7ef('0xc')](),controller[_0xa7ef('0xd')]);router['get'](_0xa7ef('0xe'),auth[_0xa7ef('0xc')](),controller[_0xa7ef('0xf')]);router[_0xa7ef('0x10')]('/',auth[_0xa7ef('0xc')](),controller[_0xa7ef('0x11')]);router['put'](_0xa7ef('0xe'),auth[_0xa7ef('0xc')](),controller['update']);router[_0xa7ef('0x12')]('/:id',auth[_0xa7ef('0xc')](),controller[_0xa7ef('0x13')]);module[_0xa7ef('0x14')]=router; \ No newline at end of file +var _0xbe9f=['create','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2d2684,_0x206264){var _0x2af4db=function(_0x194aba){while(--_0x194aba){_0x2d2684['push'](_0x2d2684['shift']());}};_0x2af4db(++_0x206264);}(_0xbe9f,0x1ac));var _0xfbe9=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xbe9f[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xfbe9('0x0'));var util=require(_0xfbe9('0x1'));var path=require(_0xfbe9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfbe9('0x3')]();var fs_extra=require(_0xfbe9('0x4'));var auth=require(_0xfbe9('0x5'));var interaction=require(_0xfbe9('0x6'));var config=require(_0xfbe9('0x7'));var controller=require(_0xfbe9('0x8'));router[_0xfbe9('0x9')]('/',auth[_0xfbe9('0xa')](),controller[_0xfbe9('0xb')]);router['get'](_0xfbe9('0xc'),auth[_0xfbe9('0xa')](),controller[_0xfbe9('0xd')]);router['post']('/',auth[_0xfbe9('0xa')](),controller[_0xfbe9('0xe')]);router['put'](_0xfbe9('0xc'),auth[_0xfbe9('0xa')](),controller[_0xfbe9('0xf')]);router[_0xfbe9('0x10')](_0xfbe9('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 0cb4c25..7113bba 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 _0x1b9d=['name','STRING','exports'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x1b9d,0xa7));var _0xd1b9=function(_0xdb951d,_0x1dc42b){_0xdb951d=_0xdb951d-0x0;var _0x5e789e=_0x1b9d[_0xdb951d];return _0x5e789e;};'use strict';var Sequelize=require('sequelize');module[_0xd1b9('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd1b9('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xd1b9('0x2')]}}; \ No newline at end of file +var _0x9e47=['sequelize','exports','STRING','name'];(function(_0x49431e,_0x17699a){var _0x759cc0=function(_0x149f00){while(--_0x149f00){_0x49431e['push'](_0x49431e['shift']());}};_0x759cc0(++_0x17699a);}(_0x9e47,0xd4));var _0x79e4=function(_0x5433cc,_0x54c691){_0x5433cc=_0x5433cc-0x0;var _0x5cacd4=_0x9e47[_0x5433cc];return _0x5cacd4;};'use strict';var Sequelize=require(_0x79e4('0x0'));module[_0x79e4('0x1')]={'name':{'type':Sequelize[_0x79e4('0x2')],'unique':_0x79e4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x79e4('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 2756f0a..5c01de7 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 _0x3c73=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','params','rawAttributes','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Pauses','UserProfileResource','end','error','stack','name','send','map','Pause','type','key','model','query','filters','intersection','attributes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3c73,0x163));var _0x33c7=function(_0x272127,_0x2b458e){_0x272127=_0x272127-0x0;var _0x64ed4f=_0x3c73[_0x272127];return _0x64ed4f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x33c7('0x0'));var jsonpatch=require(_0x33c7('0x1'));var rp=require(_0x33c7('0x2'));var moment=require(_0x33c7('0x3'));var BPromise=require(_0x33c7('0x4'));var Mustache=require(_0x33c7('0x5'));var util=require('util');var path=require(_0x33c7('0x6'));var sox=require(_0x33c7('0x7'));var csv=require('to-csv');var ejs=require(_0x33c7('0x8'));var fs=require('fs');var fs_extra=require(_0x33c7('0x9'));var _=require(_0x33c7('0xa'));var squel=require(_0x33c7('0xb'));var crypto=require('crypto');var jsforce=require(_0x33c7('0xc'));var deskjs=require(_0x33c7('0xd'));var toCsv=require(_0x33c7('0xe'));var querystring=require(_0x33c7('0xf'));var Papa=require(_0x33c7('0x10'));var Redis=require(_0x33c7('0x11'));var authService=require(_0x33c7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x33c7('0x13'));var hardwareService=require(_0x33c7('0x14'));var logger=require('../../config/logger')(_0x33c7('0x15'));var utils=require(_0x33c7('0x16'));var config=require(_0x33c7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x33c7('0x18'))['db'];function respondWithStatusCode(_0x2a50e8,_0x1c0eec){_0x1c0eec=_0x1c0eec||0xcc;return function(_0x6145d7){if(_0x6145d7){return _0x2a50e8[_0x33c7('0x19')](_0x1c0eec);}return _0x2a50e8[_0x33c7('0x1a')](_0x1c0eec)['end']();};}function respondWithResult(_0xbf64a2,_0x193006){_0x193006=_0x193006||0xc8;return function(_0x58d370){if(_0x58d370){return _0xbf64a2[_0x33c7('0x1a')](_0x193006)[_0x33c7('0x1b')](_0x58d370);}};}function respondWithFilteredResult(_0x53076f,_0x3f1309){return function(_0x2ab6ef){if(_0x2ab6ef){var _0x82bc01=typeof _0x3f1309[_0x33c7('0x1c')]==='undefined'&&typeof _0x3f1309[_0x33c7('0x1d')]===_0x33c7('0x1e');var _0x18301b=_0x2ab6ef[_0x33c7('0x1f')];var _0x379735=_0x82bc01?0x0:_0x3f1309[_0x33c7('0x1c')];var _0x336fd3=_0x82bc01?_0x2ab6ef[_0x33c7('0x1f')]:_0x3f1309[_0x33c7('0x1c')]+_0x3f1309[_0x33c7('0x1d')];var _0x5b5e5d;if(_0x336fd3>=_0x18301b){_0x336fd3=_0x18301b;_0x5b5e5d=0xc8;}else{_0x5b5e5d=0xce;}_0x53076f[_0x33c7('0x1a')](_0x5b5e5d);return _0x53076f[_0x33c7('0x20')](_0x33c7('0x21'),_0x379735+'-'+_0x336fd3+'/'+_0x18301b)[_0x33c7('0x1b')](_0x2ab6ef);}return null;};}function patchUpdates(_0x3b6333){return function(_0x40f1f7){try{jsonpatch[_0x33c7('0x22')](_0x40f1f7,_0x3b6333,!![]);}catch(_0x3ef444){return BPromise[_0x33c7('0x23')](_0x3ef444);}return _0x40f1f7[_0x33c7('0x24')]();};}function saveUpdates(_0x21221f,_0x8c5c2b){return function(_0x47e461){if(_0x47e461){return _0x47e461['update'](_0x21221f)[_0x33c7('0x25')](function(_0xfc5e22){return _0xfc5e22;});}return null;};}function removeEntity(_0x22f949,_0x2395fa){return function(_0xb23ec4){if(_0xb23ec4){return _0xb23ec4[_0x33c7('0x26')]()[_0x33c7('0x25')](function(){var _0x3f2710=_0xb23ec4['get']({'plain':!![]});var _0x423fc7=_0x33c7('0x27');return db[_0x33c7('0x28')][_0x33c7('0x26')]({'where':{'type':_0x423fc7,'resourceId':_0x3f2710['id']}})[_0x33c7('0x25')](function(){return _0xb23ec4;});})[_0x33c7('0x25')](function(){_0x22f949[_0x33c7('0x1a')](0xcc)[_0x33c7('0x29')]();});}};}function handleEntityNotFound(_0x4b4e4f,_0x356a4a){return function(_0x59e5bd){if(!_0x59e5bd){_0x4b4e4f[_0x33c7('0x19')](0x194);}return _0x59e5bd;};}function handleError(_0x3a4be2,_0x185c4a){_0x185c4a=_0x185c4a||0x1f4;return function(_0x5a34e1){logger[_0x33c7('0x2a')](_0x5a34e1[_0x33c7('0x2b')]);if(_0x5a34e1[_0x33c7('0x2c')]){delete _0x5a34e1[_0x33c7('0x2c')];}_0x3a4be2[_0x33c7('0x1a')](_0x185c4a)[_0x33c7('0x2d')](_0x5a34e1);};}exports['index']=function(_0x3472a3,_0x63459e){var _0x1d7135={},_0x351b7a={},_0x105133={'count':0x0,'rows':[]};var _0x2e068e=_[_0x33c7('0x2e')](db[_0x33c7('0x2f')]['rawAttributes'],function(_0x3ef7aa){return{'name':_0x3ef7aa['fieldName'],'type':_0x3ef7aa[_0x33c7('0x30')][_0x33c7('0x31')]};});_0x351b7a[_0x33c7('0x32')]=_[_0x33c7('0x2e')](_0x2e068e,_0x33c7('0x2c'));_0x351b7a[_0x33c7('0x33')]=_['keys'](_0x3472a3[_0x33c7('0x33')]);_0x351b7a[_0x33c7('0x34')]=_[_0x33c7('0x35')](_0x351b7a[_0x33c7('0x32')],_0x351b7a['query']);_0x1d7135[_0x33c7('0x36')]=_['intersection'](_0x351b7a[_0x33c7('0x32')],qs[_0x33c7('0x37')](_0x3472a3[_0x33c7('0x33')][_0x33c7('0x37')]));_0x1d7135[_0x33c7('0x36')]=_0x1d7135['attributes'][_0x33c7('0x38')]?_0x1d7135[_0x33c7('0x36')]:_0x351b7a[_0x33c7('0x32')];if(!_0x3472a3['query'][_0x33c7('0x39')](_0x33c7('0x3a'))){_0x1d7135[_0x33c7('0x1d')]=qs[_0x33c7('0x1d')](_0x3472a3['query'][_0x33c7('0x1d')]);_0x1d7135['offset']=qs[_0x33c7('0x1c')](_0x3472a3[_0x33c7('0x33')]['offset']);}_0x1d7135[_0x33c7('0x3b')]=qs[_0x33c7('0x3c')](_0x3472a3[_0x33c7('0x33')][_0x33c7('0x3c')]);_0x1d7135[_0x33c7('0x3d')]=qs['filters'](_[_0x33c7('0x3e')](_0x3472a3['query'],_0x351b7a[_0x33c7('0x34')]),_0x2e068e);if(_0x3472a3[_0x33c7('0x33')][_0x33c7('0x3f')]){_0x1d7135[_0x33c7('0x3d')]=_['merge'](_0x1d7135[_0x33c7('0x3d')],{'$or':_[_0x33c7('0x2e')](_0x2e068e,function(_0x16facf){if(_0x16facf[_0x33c7('0x30')]!==_0x33c7('0x40')){var _0x26b145={};_0x26b145[_0x16facf[_0x33c7('0x2c')]]={'$like':'%'+_0x3472a3[_0x33c7('0x33')][_0x33c7('0x3f')]+'%'};return _0x26b145;}})});}_0x1d7135=_[_0x33c7('0x41')]({},_0x1d7135,_0x3472a3[_0x33c7('0x42')]);var _0x283d10={'where':_0x1d7135[_0x33c7('0x3d')]};return db['Pause'][_0x33c7('0x1f')](_0x283d10)[_0x33c7('0x25')](function(_0x5c8043){_0x105133[_0x33c7('0x1f')]=_0x5c8043;if(_0x3472a3[_0x33c7('0x33')]['includeAll']){_0x1d7135[_0x33c7('0x43')]=[{'all':!![]}];}return db[_0x33c7('0x2f')][_0x33c7('0x44')](_0x1d7135);})[_0x33c7('0x25')](function(_0x12c43d){_0x105133['rows']=_0x12c43d;return _0x105133;})[_0x33c7('0x25')](respondWithFilteredResult(_0x63459e,_0x1d7135))['catch'](handleError(_0x63459e,null));};exports['show']=function(_0x282f75,_0x1a30c2){var _0x4c8d2d={'raw':!![],'where':{'id':_0x282f75[_0x33c7('0x45')]['id']}},_0x31deb4={};_0x31deb4[_0x33c7('0x32')]=_['keys'](db[_0x33c7('0x2f')][_0x33c7('0x46')]);_0x31deb4[_0x33c7('0x33')]=_['keys'](_0x282f75[_0x33c7('0x33')]);_0x31deb4[_0x33c7('0x34')]=_['intersection'](_0x31deb4['model'],_0x31deb4[_0x33c7('0x33')]);_0x4c8d2d['attributes']=_[_0x33c7('0x35')](_0x31deb4[_0x33c7('0x32')],qs[_0x33c7('0x37')](_0x282f75[_0x33c7('0x33')][_0x33c7('0x37')]));_0x4c8d2d[_0x33c7('0x36')]=_0x4c8d2d[_0x33c7('0x36')]['length']?_0x4c8d2d['attributes']:_0x31deb4[_0x33c7('0x32')];if(_0x282f75[_0x33c7('0x33')][_0x33c7('0x47')]){_0x4c8d2d[_0x33c7('0x43')]=[{'all':!![]}];}_0x4c8d2d=_[_0x33c7('0x41')]({},_0x4c8d2d,_0x282f75['options']);return db[_0x33c7('0x2f')][_0x33c7('0x48')](_0x4c8d2d)[_0x33c7('0x25')](handleEntityNotFound(_0x1a30c2,null))['then'](respondWithResult(_0x1a30c2,null))[_0x33c7('0x49')](handleError(_0x1a30c2,null));};exports[_0x33c7('0x4a')]=function(_0x4429bc,_0x36e9c2){return db['Pause'][_0x33c7('0x4a')](_0x4429bc[_0x33c7('0x4b')],{})[_0x33c7('0x25')](function(_0x3c5ec5){var _0x34478c=_0x4429bc[_0x33c7('0x4c')][_0x33c7('0x4d')]({'plain':!![]});if(!_0x34478c)throw new Error(_0x33c7('0x4e'));if(_0x34478c[_0x33c7('0x4f')]===_0x33c7('0x4c')){var _0x5c595f=_0x3c5ec5[_0x33c7('0x4d')]({'plain':!![]});var _0x4955da=_0x33c7('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x4955da,'userProfileId':_0x34478c[_0x33c7('0x50')]},'raw':!![]})[_0x33c7('0x25')](function(_0x3cc353){if(_0x3cc353&&_0x3cc353['autoAssociation']===0x0){return db[_0x33c7('0x28')][_0x33c7('0x4a')]({'name':_0x5c595f['name'],'resourceId':_0x5c595f['id'],'type':_0x3cc353[_0x33c7('0x2c')],'sectionId':_0x3cc353['id']},{})['then'](function(){return _0x3c5ec5;});}else{return _0x3c5ec5;}})[_0x33c7('0x49')](function(_0x581904){logger[_0x33c7('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x581904);throw _0x581904;});}return _0x3c5ec5;})[_0x33c7('0x25')](respondWithResult(_0x36e9c2,0xc9))[_0x33c7('0x49')](handleError(_0x36e9c2,null));};exports[_0x33c7('0x51')]=function(_0x51366d,_0xad0c70){if(_0x51366d[_0x33c7('0x4b')]['id']){delete _0x51366d[_0x33c7('0x4b')]['id'];}return db[_0x33c7('0x2f')][_0x33c7('0x48')]({'where':{'id':_0x51366d[_0x33c7('0x45')]['id']}})[_0x33c7('0x25')](handleEntityNotFound(_0xad0c70,null))['then'](saveUpdates(_0x51366d[_0x33c7('0x4b')],null))[_0x33c7('0x25')](respondWithResult(_0xad0c70,null))[_0x33c7('0x49')](handleError(_0xad0c70,null));};exports[_0x33c7('0x26')]=function(_0x271e5b,_0x12320f){return db['Pause'][_0x33c7('0x48')]({'where':{'id':_0x271e5b[_0x33c7('0x45')]['id']}})[_0x33c7('0x25')](handleEntityNotFound(_0x12320f,null))[_0x33c7('0x25')](removeEntity(_0x12320f,null))[_0x33c7('0x49')](handleError(_0x12320f,null));}; \ No newline at end of file +var _0xd9c1=['sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','role','user','UserProfileSection','userProfileId','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x111852,_0x26ffd5){var _0x427ad4=function(_0x48d911){while(--_0x48d911){_0x111852['push'](_0x111852['shift']());}};_0x427ad4(++_0x26ffd5);}(_0xd9c1,0x137));var _0x1d9c=function(_0xb5c31d,_0x504ba5){_0xb5c31d=_0xb5c31d-0x0;var _0x5e7cc4=_0xd9c1[_0xb5c31d];return _0x5e7cc4;};'use strict';var emlformat=require(_0x1d9c('0x0'));var rimraf=require(_0x1d9c('0x1'));var zipdir=require(_0x1d9c('0x2'));var jsonpatch=require(_0x1d9c('0x3'));var rp=require(_0x1d9c('0x4'));var moment=require('moment');var BPromise=require(_0x1d9c('0x5'));var Mustache=require(_0x1d9c('0x6'));var util=require(_0x1d9c('0x7'));var path=require(_0x1d9c('0x8'));var sox=require(_0x1d9c('0x9'));var csv=require('to-csv');var ejs=require(_0x1d9c('0xa'));var fs=require('fs');var fs_extra=require(_0x1d9c('0xb'));var _=require(_0x1d9c('0xc'));var squel=require('squel');var crypto=require(_0x1d9c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1d9c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1d9c('0xf'));var Redis=require(_0x1d9c('0x10'));var authService=require(_0x1d9c('0x11'));var qs=require(_0x1d9c('0x12'));var as=require(_0x1d9c('0x13'));var hardwareService=require(_0x1d9c('0x14'));var logger=require(_0x1d9c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1d9c('0x16'));var licenseUtil=require(_0x1d9c('0x17'));var db=require(_0x1d9c('0x18'))['db'];function respondWithStatusCode(_0xbe65,_0x1cf1d9){_0x1cf1d9=_0x1cf1d9||0xcc;return function(_0x301122){if(_0x301122){return _0xbe65[_0x1d9c('0x19')](_0x1cf1d9);}return _0xbe65[_0x1d9c('0x1a')](_0x1cf1d9)['end']();};}function respondWithResult(_0x2e28fd,_0x25fafd){_0x25fafd=_0x25fafd||0xc8;return function(_0x3c55fc){if(_0x3c55fc){return _0x2e28fd[_0x1d9c('0x1a')](_0x25fafd)[_0x1d9c('0x1b')](_0x3c55fc);}};}function respondWithFilteredResult(_0x29e7b5,_0x3f6687){return function(_0x57fbba){if(_0x57fbba){var _0x766c51=typeof _0x3f6687['offset']==='undefined'&&typeof _0x3f6687[_0x1d9c('0x1c')]===_0x1d9c('0x1d');var _0x3b6a12=_0x57fbba[_0x1d9c('0x1e')];var _0x29cce5=_0x766c51?0x0:_0x3f6687['offset'];var _0x5da5d0=_0x766c51?_0x57fbba[_0x1d9c('0x1e')]:_0x3f6687[_0x1d9c('0x1f')]+_0x3f6687[_0x1d9c('0x1c')];var _0x159e77;if(_0x5da5d0>=_0x3b6a12){_0x5da5d0=_0x3b6a12;_0x159e77=0xc8;}else{_0x159e77=0xce;}_0x29e7b5[_0x1d9c('0x1a')](_0x159e77);return _0x29e7b5[_0x1d9c('0x20')](_0x1d9c('0x21'),_0x29cce5+'-'+_0x5da5d0+'/'+_0x3b6a12)[_0x1d9c('0x1b')](_0x57fbba);}return null;};}function patchUpdates(_0x26ce1f){return function(_0x46a639){try{jsonpatch[_0x1d9c('0x22')](_0x46a639,_0x26ce1f,!![]);}catch(_0x3146eb){return BPromise['reject'](_0x3146eb);}return _0x46a639[_0x1d9c('0x23')]();};}function saveUpdates(_0xac7797,_0x44639e){return function(_0xb124fa){if(_0xb124fa){return _0xb124fa['update'](_0xac7797)[_0x1d9c('0x24')](function(_0x5759db){return _0x5759db;});}return null;};}function removeEntity(_0x1b9b4b,_0x54bcd8){return function(_0xfa4b87){if(_0xfa4b87){return _0xfa4b87[_0x1d9c('0x25')]()['then'](function(){var _0xbd7d9=_0xfa4b87[_0x1d9c('0x26')]({'plain':!![]});var _0x111df8=_0x1d9c('0x27');return db[_0x1d9c('0x28')][_0x1d9c('0x25')]({'where':{'type':_0x111df8,'resourceId':_0xbd7d9['id']}})[_0x1d9c('0x24')](function(){return _0xfa4b87;});})[_0x1d9c('0x24')](function(){_0x1b9b4b[_0x1d9c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x429842,_0x186873){return function(_0x3927c9){if(!_0x3927c9){_0x429842['sendStatus'](0x194);}return _0x3927c9;};}function handleError(_0x28174d,_0x4789dc){_0x4789dc=_0x4789dc||0x1f4;return function(_0x9689ae){logger[_0x1d9c('0x29')](_0x9689ae[_0x1d9c('0x2a')]);if(_0x9689ae[_0x1d9c('0x2b')]){delete _0x9689ae['name'];}_0x28174d['status'](_0x4789dc)[_0x1d9c('0x2c')](_0x9689ae);};}exports[_0x1d9c('0x2d')]=function(_0x3ef7c7,_0x2e07ed){var _0x2934ad={},_0x202f17={},_0xcf8465={'count':0x0,'rows':[]};var _0x1e54a8=_[_0x1d9c('0x2e')](db[_0x1d9c('0x2f')][_0x1d9c('0x30')],function(_0x49d6a3){return{'name':_0x49d6a3[_0x1d9c('0x31')],'type':_0x49d6a3[_0x1d9c('0x32')][_0x1d9c('0x33')]};});_0x202f17[_0x1d9c('0x34')]=_['map'](_0x1e54a8,_0x1d9c('0x2b'));_0x202f17['query']=_[_0x1d9c('0x35')](_0x3ef7c7[_0x1d9c('0x36')]);_0x202f17[_0x1d9c('0x37')]=_[_0x1d9c('0x38')](_0x202f17[_0x1d9c('0x34')],_0x202f17['query']);_0x2934ad[_0x1d9c('0x39')]=_[_0x1d9c('0x38')](_0x202f17['model'],qs['fields'](_0x3ef7c7[_0x1d9c('0x36')][_0x1d9c('0x3a')]));_0x2934ad[_0x1d9c('0x39')]=_0x2934ad[_0x1d9c('0x39')][_0x1d9c('0x3b')]?_0x2934ad[_0x1d9c('0x39')]:_0x202f17['model'];if(!_0x3ef7c7[_0x1d9c('0x36')][_0x1d9c('0x3c')](_0x1d9c('0x3d'))){_0x2934ad['limit']=qs[_0x1d9c('0x1c')](_0x3ef7c7[_0x1d9c('0x36')]['limit']);_0x2934ad[_0x1d9c('0x1f')]=qs[_0x1d9c('0x1f')](_0x3ef7c7[_0x1d9c('0x36')][_0x1d9c('0x1f')]);}_0x2934ad[_0x1d9c('0x3e')]=qs['sort'](_0x3ef7c7[_0x1d9c('0x36')][_0x1d9c('0x3f')]);_0x2934ad[_0x1d9c('0x40')]=qs[_0x1d9c('0x37')](_['pick'](_0x3ef7c7[_0x1d9c('0x36')],_0x202f17[_0x1d9c('0x37')]),_0x1e54a8);if(_0x3ef7c7[_0x1d9c('0x36')][_0x1d9c('0x41')]){_0x2934ad['where']=_[_0x1d9c('0x42')](_0x2934ad[_0x1d9c('0x40')],{'$or':_[_0x1d9c('0x2e')](_0x1e54a8,function(_0x1cba31){if(_0x1cba31[_0x1d9c('0x32')]!==_0x1d9c('0x43')){var _0x36c90b={};_0x36c90b[_0x1cba31[_0x1d9c('0x2b')]]={'$like':'%'+_0x3ef7c7[_0x1d9c('0x36')][_0x1d9c('0x41')]+'%'};return _0x36c90b;}})});}_0x2934ad=_[_0x1d9c('0x42')]({},_0x2934ad,_0x3ef7c7[_0x1d9c('0x44')]);var _0x59910d={'where':_0x2934ad['where']};return db['Pause'][_0x1d9c('0x1e')](_0x59910d)[_0x1d9c('0x24')](function(_0x44413){_0xcf8465['count']=_0x44413;if(_0x3ef7c7[_0x1d9c('0x36')][_0x1d9c('0x45')]){_0x2934ad[_0x1d9c('0x46')]=[{'all':!![]}];}return db[_0x1d9c('0x2f')][_0x1d9c('0x47')](_0x2934ad);})[_0x1d9c('0x24')](function(_0x21d604){_0xcf8465[_0x1d9c('0x48')]=_0x21d604;return _0xcf8465;})[_0x1d9c('0x24')](respondWithFilteredResult(_0x2e07ed,_0x2934ad))[_0x1d9c('0x49')](handleError(_0x2e07ed,null));};exports[_0x1d9c('0x4a')]=function(_0x5904b9,_0x2e395c){var _0xdd8bef={'raw':!![],'where':{'id':_0x5904b9[_0x1d9c('0x4b')]['id']}},_0x554b3f={};_0x554b3f[_0x1d9c('0x34')]=_['keys'](db[_0x1d9c('0x2f')][_0x1d9c('0x30')]);_0x554b3f[_0x1d9c('0x36')]=_['keys'](_0x5904b9['query']);_0x554b3f[_0x1d9c('0x37')]=_[_0x1d9c('0x38')](_0x554b3f[_0x1d9c('0x34')],_0x554b3f[_0x1d9c('0x36')]);_0xdd8bef['attributes']=_['intersection'](_0x554b3f[_0x1d9c('0x34')],qs[_0x1d9c('0x3a')](_0x5904b9[_0x1d9c('0x36')][_0x1d9c('0x3a')]));_0xdd8bef[_0x1d9c('0x39')]=_0xdd8bef[_0x1d9c('0x39')][_0x1d9c('0x3b')]?_0xdd8bef[_0x1d9c('0x39')]:_0x554b3f[_0x1d9c('0x34')];if(_0x5904b9['query']['includeAll']){_0xdd8bef[_0x1d9c('0x46')]=[{'all':!![]}];}_0xdd8bef=_[_0x1d9c('0x42')]({},_0xdd8bef,_0x5904b9[_0x1d9c('0x44')]);return db[_0x1d9c('0x2f')][_0x1d9c('0x4c')](_0xdd8bef)[_0x1d9c('0x24')](handleEntityNotFound(_0x2e395c,null))[_0x1d9c('0x24')](respondWithResult(_0x2e395c,null))['catch'](handleError(_0x2e395c,null));};exports[_0x1d9c('0x4d')]=function(_0x467e63,_0x25820c){return db[_0x1d9c('0x2f')][_0x1d9c('0x4d')](_0x467e63['body'],{})[_0x1d9c('0x24')](function(_0x1a9fba){var _0x4e448e=_0x467e63['user']['get']({'plain':!![]});if(!_0x4e448e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e448e[_0x1d9c('0x4e')]===_0x1d9c('0x4f')){var _0x32a1f9=_0x1a9fba[_0x1d9c('0x26')]({'plain':!![]});var _0x12d516=_0x1d9c('0x27');return db[_0x1d9c('0x50')][_0x1d9c('0x4c')]({'where':{'name':_0x12d516,'userProfileId':_0x4e448e[_0x1d9c('0x51')]},'raw':!![]})[_0x1d9c('0x24')](function(_0xfdde3){if(_0xfdde3&&_0xfdde3['autoAssociation']===0x0){return db['UserProfileResource'][_0x1d9c('0x4d')]({'name':_0x32a1f9['name'],'resourceId':_0x32a1f9['id'],'type':_0xfdde3[_0x1d9c('0x2b')],'sectionId':_0xfdde3['id']},{})[_0x1d9c('0x24')](function(){return _0x1a9fba;});}else{return _0x1a9fba;}})['catch'](function(_0x28bbcb){logger[_0x1d9c('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28bbcb);throw _0x28bbcb;});}return _0x1a9fba;})[_0x1d9c('0x24')](respondWithResult(_0x25820c,0xc9))['catch'](handleError(_0x25820c,null));};exports[_0x1d9c('0x52')]=function(_0x1e4482,_0x281686){if(_0x1e4482[_0x1d9c('0x53')]['id']){delete _0x1e4482[_0x1d9c('0x53')]['id'];}return db[_0x1d9c('0x2f')][_0x1d9c('0x4c')]({'where':{'id':_0x1e4482['params']['id']}})[_0x1d9c('0x24')](handleEntityNotFound(_0x281686,null))[_0x1d9c('0x24')](saveUpdates(_0x1e4482[_0x1d9c('0x53')],null))[_0x1d9c('0x24')](respondWithResult(_0x281686,null))['catch'](handleError(_0x281686,null));};exports[_0x1d9c('0x25')]=function(_0x1738f1,_0x36ffaa){return db[_0x1d9c('0x2f')]['find']({'where':{'id':_0x1738f1[_0x1d9c('0x4b')]['id']}})[_0x1d9c('0x24')](handleEntityNotFound(_0x36ffaa,null))['then'](removeEntity(_0x36ffaa,null))[_0x1d9c('0x49')](handleError(_0x36ffaa,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 753543d..ef41ee0 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x4838e6,_0x193bd9){var _0x2893ce=function(_0x4c05f7){while(--_0x4c05f7){_0x4838e6['push'](_0x4838e6['shift']());}};_0x2893ce(++_0x193bd9);}(_0xe14b,0x93));var _0xbe14=function(_0x73c054,_0x13a967){_0x73c054=_0x73c054-0x0;var _0xf62ca4=_0xe14b[_0x73c054];return _0xf62ca4;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index f2b17ab..428ad2e 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(_0x818f5a,_0x257ad4){var _0x4d9014=function(_0x2d51c5){while(--_0x2d51c5){_0x818f5a['push'](_0x818f5a['shift']());}};_0x4d9014(++_0x257ad4);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b0d98,_0x346f06){_0x3b0d98=_0x3b0d98-0x0;var _0x296885=_0xb10b[_0x3b0d98];return _0x296885;};'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(_0x1ce210,_0x32e6ba){var _0x452b3d=function(_0x27ea63){while(--_0x27ea63){_0x1ce210['push'](_0x1ce210['shift']());}};_0x452b3d(++_0x32e6ba);}(_0xb10b,0x12a));var _0xbb10=function(_0x4cdf87,_0x200caf){_0x4cdf87=_0x4cdf87-0x0;var _0x14d49d=_0xb10b[_0x4cdf87];return _0x14d49d;};'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 4c41179..05f2da9 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 _0xb903=['replace','basename','originalname','now','extname','post','single','/webhook','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','webhookGet','/:id','isAuthenticated','join','root'];(function(_0x5ea58c,_0x3e6d96){var _0x4d45d0=function(_0x192308){while(--_0x192308){_0x5ea58c['push'](_0x5ea58c['shift']());}};_0x4d45d0(++_0x3e6d96);}(_0xb903,0x185));var _0x3b90=function(_0x4065df,_0x99785b){_0x4065df=_0x4065df-0x0;var _0x4dca58=_0xb903[_0x4065df];return _0x4dca58;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var fs_extra=require(_0x3b90('0x5'));var auth=require(_0x3b90('0x6'));var interaction=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var controller=require(_0x3b90('0x9'));router[_0x3b90('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router['get']('/webhook',controller[_0x3b90('0xc')]);router[_0x3b90('0xa')](_0x3b90('0xd'),auth[_0x3b90('0xe')](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x336913,_0x5af39c,_0x574955){_0x574955(null,path[_0x3b90('0xf')](config[_0x3b90('0x10')],'server/files/plugins'));},'filename':function(_0x45b75f,_0x174c0d,_0x43c08c){_0x174c0d['originalname']=_0x174c0d['originalname'][_0x3b90('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x43c08c(null,util['format']('%s-%s%s',path[_0x3b90('0x12')](_0x174c0d[_0x3b90('0x13')],path['extname'](_0x174c0d['originalname'])),Date[_0x3b90('0x14')](),path[_0x3b90('0x15')](_0x174c0d[_0x3b90('0x13')])));}})});router[_0x3b90('0x16')]('/',upload[_0x3b90('0x17')]('file'),controller['upload']);router[_0x3b90('0x16')](_0x3b90('0x18'),controller['webhookPost']);router[_0x3b90('0x19')](_0x3b90('0xd'),auth[_0x3b90('0xe')](),controller[_0x3b90('0x1a')]);router['delete'](_0x3b90('0xd'),auth['isAuthenticated'](),controller[_0x3b90('0x1b')]);module[_0x3b90('0x1c')]=router; \ No newline at end of file +var _0xbec5=['get','index','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','upload','webhookPost','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller'];(function(_0x4e88e3,_0x5282c5){var _0x3183c5=function(_0x2909b3){while(--_0x2909b3){_0x4e88e3['push'](_0x4e88e3['shift']());}};_0x3183c5(++_0x5282c5);}(_0xbec5,0xe5));var _0x5bec=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0xbec5[_0x879e31];return _0x3467e8;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),controller[_0x5bec('0xc')]);router[_0x5bec('0x9')](_0x5bec('0xd'),auth[_0x5bec('0xe')](),controller[_0x5bec('0xf')]);router['get'](_0x5bec('0x10'),auth['isAuthenticated'](),controller[_0x5bec('0x11')]);var upload=multer({'storage':multer[_0x5bec('0x12')]({'destination':function(_0x117162,_0x4a5482,_0x288d1b){_0x288d1b(null,path[_0x5bec('0x13')](config[_0x5bec('0x14')],'server/files/plugins'));},'filename':function(_0x6bee21,_0x1c888f,_0x589d14){_0x1c888f[_0x5bec('0x15')]=_0x1c888f[_0x5bec('0x15')][_0x5bec('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x589d14(null,util[_0x5bec('0x17')](_0x5bec('0x18'),path[_0x5bec('0x19')](_0x1c888f[_0x5bec('0x15')],path[_0x5bec('0x1a')](_0x1c888f[_0x5bec('0x15')])),Date[_0x5bec('0x1b')](),path[_0x5bec('0x1a')](_0x1c888f[_0x5bec('0x15')])));}})});router[_0x5bec('0x1c')]('/',upload['single']('file'),controller[_0x5bec('0x1d')]);router[_0x5bec('0x1c')](_0x5bec('0xb'),controller[_0x5bec('0x1e')]);router['put']('/:id',auth[_0x5bec('0xe')](),controller[_0x5bec('0x1f')]);router['delete'](_0x5bec('0xd'),auth[_0x5bec('0xe')](),controller[_0x5bec('0x20')]);module[_0x5bec('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index f590260..32d2137 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 _0xfdd2=['TEXT','BOOLEAN','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html'];(function(_0x1d2e88,_0xd590b6){var _0x1d762e=function(_0x1a337a){while(--_0x1a337a){_0x1d2e88['push'](_0x1d2e88['shift']());}};_0x1d762e(++_0xd590b6);}(_0xfdd2,0xc4));var _0x2fdd=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xfdd2[_0x11ce46];return _0x368a1e;};'use strict';var Sequelize=require('sequelize');module[_0x2fdd('0x0')]={'name':{'type':Sequelize[_0x2fdd('0x1')]},'type':{'type':Sequelize[_0x2fdd('0x2')](_0x2fdd('0x3'),'script')},'description':{'type':Sequelize[_0x2fdd('0x4')]},'version':{'type':Sequelize[_0x2fdd('0x4')]},'path':{'type':Sequelize[_0x2fdd('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x2fdd('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x2fdd('0x2')]('adminOnly',_0x2fdd('0x6'),_0x2fdd('0x7'),_0x2fdd('0x8')),'defaultValue':_0x2fdd('0x7'),'comment':_0x2fdd('0x9')},'icon':{'type':Sequelize[_0x2fdd('0x1')]},'adminUrl':{'type':Sequelize[_0x2fdd('0x1')]},'agentUrl':{'type':Sequelize[_0x2fdd('0x1')]},'scriptName':{'type':Sequelize[_0x2fdd('0x1')]},'scriptPath':{'type':Sequelize[_0x2fdd('0x1')]}}; \ No newline at end of file +var _0x61e8=['html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','ENUM'];(function(_0xcd76ee,_0x345953){var _0x289064=function(_0x1e7957){while(--_0x1e7957){_0xcd76ee['push'](_0xcd76ee['shift']());}};_0x289064(++_0x345953);}(_0x61e8,0x18f));var _0x861e=function(_0x312bd4,_0x4cce7b){_0x312bd4=_0x312bd4-0x0;var _0x2f5d6b=_0x61e8[_0x312bd4];return _0x2f5d6b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x861e('0x0')](_0x861e('0x1'),_0x861e('0x2'))},'description':{'type':Sequelize[_0x861e('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x861e('0x4')],'comment':_0x861e('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x861e('0x6')},'sidebar':{'type':Sequelize[_0x861e('0x0')]('adminOnly','agentOnly',_0x861e('0x7'),'never'),'defaultValue':_0x861e('0x7'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x861e('0x4')]},'adminUrl':{'type':Sequelize[_0x861e('0x4')]},'agentUrl':{'type':Sequelize[_0x861e('0x4')]},'scriptName':{'type':Sequelize[_0x861e('0x4')]},'scriptPath':{'type':Sequelize[_0x861e('0x4')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 5b8d579..450c919 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 _0xbd75=['Invalid\x20manifest:\x20name\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','test','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','userProfileId','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','http://localhost:','port','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./plugin.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','Plugin','includeAll','include','findAll','rows','params','find','catch','download','join','format','%s.zip','basename','createWriteStream','warning','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','lstatSync','isFile','Invalid\x20plugin\x20structure','some','manifest.json','parse'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbd75,0x190));var _0x5bd7=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xbd75[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x5bd7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bd7('0x1'));var jsonpatch=require(_0x5bd7('0x2'));var rp=require(_0x5bd7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5bd7('0x4'));var path=require(_0x5bd7('0x5'));var sox=require(_0x5bd7('0x6'));var csv=require(_0x5bd7('0x7'));var ejs=require(_0x5bd7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5bd7('0x9'));var crypto=require(_0x5bd7('0xa'));var jsforce=require(_0x5bd7('0xb'));var deskjs=require(_0x5bd7('0xc'));var toCsv=require(_0x5bd7('0x7'));var querystring=require(_0x5bd7('0xd'));var Papa=require(_0x5bd7('0xe'));var extract=require(_0x5bd7('0xf'));var rimraf=require(_0x5bd7('0x10'));var archiver=require(_0x5bd7('0x11'));var Redis=require(_0x5bd7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5bd7('0x13'));var as=require(_0x5bd7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bd7('0x15'))(_0x5bd7('0x16'));var utils=require(_0x5bd7('0x17'));var config=require(_0x5bd7('0x18'));var licenseUtil=require(_0x5bd7('0x19'));var db=require(_0x5bd7('0x1a'))['db'];config['redis']=_[_0x5bd7('0x1b')](config['redis'],{'host':_0x5bd7('0x1c'),'port':0x18eb});var socket=require(_0x5bd7('0x1d'))(new Redis(config[_0x5bd7('0x1e')]));require(_0x5bd7('0x1f'))[_0x5bd7('0x20')](socket);function respondWithStatusCode(_0x240706,_0xf56ec3){_0xf56ec3=_0xf56ec3||0xcc;return function(_0x3c6d24){if(_0x3c6d24){return _0x240706[_0x5bd7('0x21')](_0xf56ec3);}return _0x240706[_0x5bd7('0x22')](_0xf56ec3)[_0x5bd7('0x23')]();};}function respondWithResult(_0x11d59d,_0x1a4176){_0x1a4176=_0x1a4176||0xc8;return function(_0x313130){if(_0x313130){return _0x11d59d[_0x5bd7('0x22')](_0x1a4176)[_0x5bd7('0x24')](_0x313130);}};}function respondWithFilteredResult(_0x3b8879,_0x1dc7c6){return function(_0x36add3){if(_0x36add3){var _0x5ea69a=typeof _0x1dc7c6['offset']===_0x5bd7('0x25')&&typeof _0x1dc7c6[_0x5bd7('0x26')]===_0x5bd7('0x25');var _0x53bd9e=_0x36add3[_0x5bd7('0x27')];var _0x2c6bda=_0x5ea69a?0x0:_0x1dc7c6[_0x5bd7('0x28')];var _0x1dbfc8=_0x5ea69a?_0x36add3[_0x5bd7('0x27')]:_0x1dc7c6['offset']+_0x1dc7c6[_0x5bd7('0x26')];var _0x34bc16;if(_0x1dbfc8>=_0x53bd9e){_0x1dbfc8=_0x53bd9e;_0x34bc16=0xc8;}else{_0x34bc16=0xce;}_0x3b8879[_0x5bd7('0x22')](_0x34bc16);return _0x3b8879[_0x5bd7('0x29')]('Content-Range',_0x2c6bda+'-'+_0x1dbfc8+'/'+_0x53bd9e)['json'](_0x36add3);}return null;};}function patchUpdates(_0x53d15f){return function(_0x59bd00){try{jsonpatch[_0x5bd7('0x2a')](_0x59bd00,_0x53d15f,!![]);}catch(_0x4f2491){return BPromise[_0x5bd7('0x2b')](_0x4f2491);}return _0x59bd00[_0x5bd7('0x2c')]();};}function saveUpdates(_0x380da5,_0x5cce7a){return function(_0x237085){if(_0x237085){return _0x237085[_0x5bd7('0x2d')](_0x380da5)[_0x5bd7('0x2e')](function(_0x4cac61){return _0x4cac61;});}return null;};}function removeEntity(_0x3a9ef9,_0x121a3c){return function(_0x31d6d3){if(_0x31d6d3){return _0x31d6d3[_0x5bd7('0x2f')]()[_0x5bd7('0x2e')](function(){var _0x32ed76=_0x31d6d3[_0x5bd7('0x30')]({'plain':!![]});var _0x5c8d60='Plugins';return db[_0x5bd7('0x31')][_0x5bd7('0x2f')]({'where':{'type':_0x5c8d60,'resourceId':_0x32ed76['id']}})[_0x5bd7('0x2e')](function(){return _0x31d6d3;});})[_0x5bd7('0x2e')](function(){_0x3a9ef9[_0x5bd7('0x22')](0xcc)[_0x5bd7('0x23')]();});}};}function handleEntityNotFound(_0x337824,_0x2e1173){return function(_0x50d4c4){if(!_0x50d4c4){_0x337824['sendStatus'](0x194);}return _0x50d4c4;};}function handleError(_0x2616f7,_0x521e80){_0x521e80=_0x521e80||0x1f4;return function(_0x5c9d74){logger[_0x5bd7('0x32')](_0x5c9d74['stack']);if(_0x5c9d74[_0x5bd7('0x33')]){delete _0x5c9d74['name'];}_0x2616f7['status'](_0x521e80)[_0x5bd7('0x34')](_0x5c9d74);};}exports[_0x5bd7('0x35')]=function(_0x418ab2,_0xe548eb){var _0x152986={},_0x2ec3d1={},_0x2e3ac1={'count':0x0,'rows':[]};var _0x1e36ee=_[_0x5bd7('0x36')](db['Plugin'][_0x5bd7('0x37')],function(_0x39df8c){return{'name':_0x39df8c['fieldName'],'type':_0x39df8c[_0x5bd7('0x38')][_0x5bd7('0x39')]};});_0x2ec3d1[_0x5bd7('0x3a')]=_['map'](_0x1e36ee,'name');_0x2ec3d1['query']=_[_0x5bd7('0x3b')](_0x418ab2[_0x5bd7('0x3c')]);_0x2ec3d1['filters']=_[_0x5bd7('0x3d')](_0x2ec3d1[_0x5bd7('0x3a')],_0x2ec3d1[_0x5bd7('0x3c')]);_0x152986[_0x5bd7('0x3e')]=_[_0x5bd7('0x3d')](_0x2ec3d1[_0x5bd7('0x3a')],qs[_0x5bd7('0x3f')](_0x418ab2['query'][_0x5bd7('0x3f')]));_0x152986[_0x5bd7('0x3e')]=_0x152986[_0x5bd7('0x3e')][_0x5bd7('0x40')]?_0x152986['attributes']:_0x2ec3d1['model'];if(!_0x418ab2[_0x5bd7('0x3c')]['hasOwnProperty'](_0x5bd7('0x41'))){_0x152986[_0x5bd7('0x26')]=qs[_0x5bd7('0x26')](_0x418ab2[_0x5bd7('0x3c')][_0x5bd7('0x26')]);_0x152986[_0x5bd7('0x28')]=qs[_0x5bd7('0x28')](_0x418ab2[_0x5bd7('0x3c')][_0x5bd7('0x28')]);}_0x152986[_0x5bd7('0x42')]=qs[_0x5bd7('0x43')](_0x418ab2[_0x5bd7('0x3c')][_0x5bd7('0x43')]);_0x152986[_0x5bd7('0x44')]=qs[_0x5bd7('0x45')](_['pick'](_0x418ab2[_0x5bd7('0x3c')],_0x2ec3d1[_0x5bd7('0x45')]),_0x1e36ee);if(_0x418ab2[_0x5bd7('0x3c')][_0x5bd7('0x46')]){_0x152986[_0x5bd7('0x44')]=_['merge'](_0x152986[_0x5bd7('0x44')],{'$or':_['map'](_0x1e36ee,function(_0xa7f1f1){if(_0xa7f1f1[_0x5bd7('0x38')]!==_0x5bd7('0x47')){var _0x4e57c2={};_0x4e57c2[_0xa7f1f1['name']]={'$like':'%'+_0x418ab2['query'][_0x5bd7('0x46')]+'%'};return _0x4e57c2;}})});}_0x152986=_[_0x5bd7('0x48')]({},_0x152986,_0x418ab2[_0x5bd7('0x49')]);var _0x211417={'where':_0x152986[_0x5bd7('0x44')]};return db[_0x5bd7('0x4a')][_0x5bd7('0x27')](_0x211417)[_0x5bd7('0x2e')](function(_0x26a630){_0x2e3ac1[_0x5bd7('0x27')]=_0x26a630;if(_0x418ab2[_0x5bd7('0x3c')][_0x5bd7('0x4b')]){_0x152986[_0x5bd7('0x4c')]=[{'all':!![]}];}return db[_0x5bd7('0x4a')][_0x5bd7('0x4d')](_0x152986);})[_0x5bd7('0x2e')](function(_0x5e0557){_0x2e3ac1[_0x5bd7('0x4e')]=_0x5e0557;return _0x2e3ac1;})['then'](respondWithFilteredResult(_0xe548eb,_0x152986))['catch'](handleError(_0xe548eb,null));};exports['show']=function(_0x51c48f,_0x3d5fe9){var _0x463ace={'raw':!![],'where':{'id':_0x51c48f[_0x5bd7('0x4f')]['id']}},_0x1a0f76={};_0x1a0f76[_0x5bd7('0x3a')]=_[_0x5bd7('0x3b')](db[_0x5bd7('0x4a')]['rawAttributes']);_0x1a0f76[_0x5bd7('0x3c')]=_[_0x5bd7('0x3b')](_0x51c48f['query']);_0x1a0f76['filters']=_['intersection'](_0x1a0f76[_0x5bd7('0x3a')],_0x1a0f76['query']);_0x463ace[_0x5bd7('0x3e')]=_[_0x5bd7('0x3d')](_0x1a0f76[_0x5bd7('0x3a')],qs[_0x5bd7('0x3f')](_0x51c48f['query']['fields']));_0x463ace['attributes']=_0x463ace[_0x5bd7('0x3e')][_0x5bd7('0x40')]?_0x463ace[_0x5bd7('0x3e')]:_0x1a0f76[_0x5bd7('0x3a')];if(_0x51c48f[_0x5bd7('0x3c')]['includeAll']){_0x463ace[_0x5bd7('0x4c')]=[{'all':!![]}];}_0x463ace=_['merge']({},_0x463ace,_0x51c48f[_0x5bd7('0x49')]);return db[_0x5bd7('0x4a')][_0x5bd7('0x50')](_0x463ace)[_0x5bd7('0x2e')](handleEntityNotFound(_0x3d5fe9,null))['then'](respondWithResult(_0x3d5fe9,null))[_0x5bd7('0x51')](handleError(_0x3d5fe9,null));};exports[_0x5bd7('0x52')]=function(_0x5a8933,_0xb9b892,_0x2de5d2){return db['Plugin']['find']({'where':{'id':_0x5a8933[_0x5bd7('0x4f')]['id']},'attributes':[_0x5bd7('0x33'),_0x5bd7('0x5')],'raw':!![]})[_0x5bd7('0x2e')](handleEntityNotFound(_0xb9b892,null))[_0x5bd7('0x2e')](function(_0x517067){if(_0x517067){var _0x3bcb38=path[_0x5bd7('0x53')](config['root'],'server/files/plugins',util[_0x5bd7('0x54')](_0x5bd7('0x55'),path[_0x5bd7('0x56')](_0x517067[_0x5bd7('0x5')])));var _0x57a10e=fs[_0x5bd7('0x57')](_0x3bcb38);var _0x4984b9=archiver('zip',{'zlib':{'level':0x9}});_0x4984b9['on'](_0x5bd7('0x58'),function(_0x2dc6f7){if(_0x2dc6f7['code']==='ENOENT'){logger[_0x5bd7('0x32')](_0x2dc6f7);}else{throw new db[(_0x5bd7('0x59'))][(_0x5bd7('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x4984b9['on'](_0x5bd7('0x32'),function(_0x46a0e1){throw new db['Sequelize']['Error'](_0x5bd7('0x5b'));});_0x4984b9[_0x5bd7('0x5c')](_0x57a10e);_0x4984b9[_0x5bd7('0x5d')](_0x5bd7('0x5e'),{'cwd':path[_0x5bd7('0x53')](config[_0x5bd7('0x5f')],_0x5bd7('0x60'),path[_0x5bd7('0x61')](_0x517067[_0x5bd7('0x5')])),'ignore':[path[_0x5bd7('0x53')](path[_0x5bd7('0x56')](_0x517067['path']),_0x5bd7('0x62')),path[_0x5bd7('0x53')](path['basename'](_0x517067['path']),_0x5bd7('0x63'))],'nodir':!![]})[_0x5bd7('0x64')]();_0x57a10e['on'](_0x5bd7('0x65'),function(){if(!fs[_0x5bd7('0x66')](_0x3bcb38)){throw new db['Sequelize']['Error'](_0x5bd7('0x67'));}return _0xb9b892[_0x5bd7('0x52')](_0x3bcb38,util['format'](_0x5bd7('0x55'),path['basename'](_0x517067['path'])),function(_0x1063d9){if(_0x1063d9){throw new db[(_0x5bd7('0x59'))]['Error'](_0x5bd7('0x68'));}fs[_0x5bd7('0x69')](_0x3bcb38);logger[_0x5bd7('0x6a')](_0x5bd7('0x6b'));logger[_0x5bd7('0x6a')](_0x5bd7('0x6c'));});});}return null;})[_0x5bd7('0x51')](handleError(_0xb9b892,null));};exports['upload']=function(_0x1decf3,_0x18c4ce,_0x6054b6){var _0x2a6322=path[_0x5bd7('0x56')](_0x1decf3[_0x5bd7('0x6d')][_0x5bd7('0x6e')],path[_0x5bd7('0x6f')](_0x1decf3[_0x5bd7('0x6d')][_0x5bd7('0x6e')]));var _0x450bae=path[_0x5bd7('0x53')](config[_0x5bd7('0x5f')],_0x5bd7('0x60'),_0x1decf3[_0x5bd7('0x6d')][_0x5bd7('0x6e')]);var _0x184dcc=path[_0x5bd7('0x53')](config[_0x5bd7('0x5f')],_0x5bd7('0x60'),_0x2a6322);logger[_0x5bd7('0x6a')](_0x5bd7('0x70'),_0x450bae);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x184dcc);try{fs[_0x5bd7('0x71')](_0x450bae,parseInt(_0x5bd7('0x72'),0x8));extract(_0x450bae,{'dir':_0x184dcc},function(_0x439337){if(_0x439337){logger[_0x5bd7('0x32')](_0x439337);handleError(_0x439337,!![]);};var _0x485a6d=fs[_0x5bd7('0x73')](_0x184dcc);if(_0x485a6d[_0x5bd7('0x40')]>0x1){removeReferences(_0x450bae,_0x184dcc);logger['error']('Invalid\x20plugin\x20structure');return _0x6054b6(new Error('Invalid\x20plugin\x20structure'));}var _0x3e5338=fs[_0x5bd7('0x74')](path['join'](_0x184dcc,_0x485a6d[0x0]));if(_0x3e5338[_0x5bd7('0x75')]()){removeReferences(_0x450bae,_0x184dcc);logger[_0x5bd7('0x32')](_0x5bd7('0x76'));return _0x6054b6(new Error(_0x5bd7('0x76')));}if(_0x3e5338['isDirectory']()){var _0xe76bc6=fs['readdirSync'](path[_0x5bd7('0x53')](_0x184dcc,_0x485a6d[0x0]));if(_0xe76bc6[_0x5bd7('0x40')]===0x0){removeReferences(_0x450bae,_0x184dcc);logger[_0x5bd7('0x32')](_0x5bd7('0x76'));return _0x6054b6(new Error(_0x5bd7('0x76')));}var _0x31cc49=_0xe76bc6[_0x5bd7('0x77')](function(_0x42d1d7){return _0x42d1d7===_0x5bd7('0x78');});if(!_0x31cc49){return _0x6054b6(new Error('Plugin\x20manifest\x20missing'));}var _0x3cc4a3=fs['readFileSync'](path[_0x5bd7('0x53')](_0x184dcc,_0x485a6d[0x0],_0x5bd7('0x78')));var _0x3d4f47=JSON[_0x5bd7('0x79')](_0x3cc4a3);if('undefined'==typeof _0x3d4f47[_0x5bd7('0x33')]){return _0x6054b6(new Error(_0x5bd7('0x7a')));}if(_0x5bd7('0x25')==typeof _0x3d4f47[_0x5bd7('0x38')]){return _0x6054b6(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x5bd7('0x25')==typeof _0x3d4f47[_0x5bd7('0x7b')]){return _0x6054b6(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x5bd7('0x25')==typeof _0x3d4f47[_0x5bd7('0x7c')]){return _0x6054b6(new Error(_0x5bd7('0x7d')));}if(_0x3d4f47[_0x5bd7('0x38')]===_0x5bd7('0x7e')){if(_0x5bd7('0x25')==typeof _0x3d4f47[_0x5bd7('0x7c')]['views']){return _0x6054b6(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x5bd7('0x25')==typeof _0x3d4f47['parameters'][_0x5bd7('0x7f')][_0x5bd7('0x80')]&&_0x5bd7('0x25')==typeof _0x3d4f47[_0x5bd7('0x7c')][_0x5bd7('0x7f')][_0x5bd7('0x81')]){return _0x6054b6(new Error(_0x5bd7('0x82')));}}else if(_0x3d4f47[_0x5bd7('0x38')]==='script'){if(_0x5bd7('0x25')==typeof _0x3d4f47['parameters']['scriptName']){return _0x6054b6(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x5bd7('0x25')==typeof _0x3d4f47['parameters'][_0x5bd7('0x83')]){return _0x6054b6(new Error(_0x5bd7('0x84')));}}else{return _0x6054b6(new Error(_0x5bd7('0x85')));}var _0x32fac4=_0x3d4f47[_0x5bd7('0x33')];var _0x1c5d92=_0x3d4f47[_0x5bd7('0x86')];var _0x1d0ceb=_0x3d4f47[_0x5bd7('0x38')];var _0x3479b6=_0x3d4f47[_0x5bd7('0x87')]?_0x3d4f47[_0x5bd7('0x87')]:_0x5bd7('0x88');var _0x56d832=_0x3d4f47[_0x5bd7('0x89')]?_0x3d4f47[_0x5bd7('0x89')]:_0x5bd7('0x8a');var _0x46af48='';var _0x58fc73='';var _0x4c571b='';var _0x4f413b='';var _0x3dc6fd=_0x3d4f47[_0x5bd7('0x7b')];if(_0x1d0ceb===_0x5bd7('0x7e')){if('undefined'!=typeof _0x3d4f47[_0x5bd7('0x7c')][_0x5bd7('0x7f')][_0x5bd7('0x80')]){var _0x14f74f=_0x3d4f47['parameters'][_0x5bd7('0x7f')][_0x5bd7('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x14f74f)){_0x46af48=path[_0x5bd7('0x53')](_0x5bd7('0x8b'),_0x2a6322,_0x485a6d[0x0],_0x14f74f);}else{_0x46af48=_0x14f74f;}}else{logger[_0x5bd7('0x6a')](_0x5bd7('0x8c'));}if(_0x5bd7('0x25')!=typeof _0x3d4f47[_0x5bd7('0x7c')][_0x5bd7('0x7f')][_0x5bd7('0x81')]){var _0x3e6614=_0x3d4f47[_0x5bd7('0x7c')][_0x5bd7('0x7f')][_0x5bd7('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3e6614)){_0x58fc73=path[_0x5bd7('0x53')](_0x5bd7('0x8b'),_0x2a6322,_0x485a6d[0x0],_0x3e6614);}else{_0x58fc73=_0x3e6614;}}else{logger[_0x5bd7('0x6a')](_0x5bd7('0x8d'));}}else if(_0x1d0ceb===_0x5bd7('0x8e')){_0x4c571b=_0x3d4f47[_0x5bd7('0x7c')][_0x5bd7('0x8f')];_0x4f413b=_0x3d4f47[_0x5bd7('0x7c')]['scriptPath'];if(_0x5bd7('0x25')!=typeof _0x3d4f47[_0x5bd7('0x7c')]['views']){if(_0x5bd7('0x25')!=typeof _0x3d4f47['parameters'][_0x5bd7('0x7f')][_0x5bd7('0x80')]){var _0x14f74f=_0x3d4f47[_0x5bd7('0x7c')][_0x5bd7('0x7f')][_0x5bd7('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x5bd7('0x90')](_0x14f74f)){_0x46af48=path['join'](_0x5bd7('0x8b'),_0x2a6322,_0x485a6d[0x0],_0x14f74f);}else{_0x46af48=_0x14f74f;}}if(_0x5bd7('0x25')!=typeof _0x3d4f47[_0x5bd7('0x7c')][_0x5bd7('0x7f')]['agent']){var _0x3e6614=_0x3d4f47['parameters']['views'][_0x5bd7('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x5bd7('0x90')](_0x3e6614)){_0x58fc73=path['join'](_0x5bd7('0x8b'),_0x2a6322,_0x485a6d[0x0],_0x3e6614);}else{_0x58fc73=_0x3e6614;}}}}var _0x535fa2={'name':_0x32fac4,'description':_0x1c5d92,'path':path[_0x5bd7('0x53')](_0x2a6322,_0x485a6d[0x0]),'type':_0x1d0ceb,'sidebar':_0x3479b6,'icon':_0x56d832,'adminUrl':_0x46af48,'agentUrl':_0x58fc73,'scriptName':_0x4c571b,'scriptPath':_0x4f413b,'version':_0x3dc6fd};removeReferences(_0x450bae,null);return db[_0x5bd7('0x4a')][_0x5bd7('0x91')](_0x535fa2)['then'](function(_0x5b8bc3){var _0x2422dc={'role':_0x1decf3[_0x5bd7('0x92')][_0x5bd7('0x93')],'userProfileId':_0x1decf3[_0x5bd7('0x92')]['userProfileId']};if(!_0x2422dc)throw new Error(_0x5bd7('0x94'));if(_0x2422dc[_0x5bd7('0x93')]===_0x5bd7('0x95')){var _0x4c4971=_0x5b8bc3[_0x5bd7('0x30')]({'plain':!![]});return db[_0x5bd7('0x96')][_0x5bd7('0x50')]({'where':{'name':_0x5bd7('0x97'),'userProfileId':_0x2422dc[_0x5bd7('0x98')]},'raw':!![]})['then'](function(_0x127a8f){if(_0x127a8f&&_0x127a8f[_0x5bd7('0x99')]===0x0){return db[_0x5bd7('0x31')][_0x5bd7('0x91')]({'name':_0x4c4971[_0x5bd7('0x33')],'resourceId':_0x4c4971['id'],'type':_0x127a8f[_0x5bd7('0x33')],'sectionId':_0x127a8f['id']},{})[_0x5bd7('0x2e')](function(){return _0x5b8bc3;});}else{return _0x5b8bc3;}})['catch'](function(_0x47f12b){logger[_0x5bd7('0x32')](_0x5bd7('0x9a'),_0x47f12b);throw _0x47f12b;});}return _0x5b8bc3;})[_0x5bd7('0x2e')](respondWithResult(_0x18c4ce,null))[_0x5bd7('0x51')](handleError(_0x18c4ce,null));}});}catch(_0x13a23b){_0x18c4ce[_0x5bd7('0x22')](0x1f4)['send'](_0x13a23b);}};function removeReferences(_0x4fcaad,_0x2bf2a4){try{if(_0x4fcaad){fs[_0x5bd7('0x69')](_0x4fcaad);logger[_0x5bd7('0x6a')](_0x5bd7('0x9b'));}if(_0x2bf2a4){rimraf(_0x2bf2a4,function(){});logger[_0x5bd7('0x6a')](_0x5bd7('0x9c'));}}catch(_0x453bda){logger[_0x5bd7('0x32')](_0x453bda);}}exports[_0x5bd7('0x2d')]=function(_0x2af67a,_0x3bb951,_0x1701f5){return db[_0x5bd7('0x4a')]['find']({'where':{'id':_0x2af67a['params']['id']}})['then'](handleEntityNotFound(_0x3bb951,null))[_0x5bd7('0x2e')](saveUpdates(_0x2af67a[_0x5bd7('0x92')],null))[_0x5bd7('0x2e')](respondWithResult(_0x3bb951,null))[_0x5bd7('0x51')](handleError(_0x3bb951,null));};exports[_0x5bd7('0x9d')]=function(_0x1326c2,_0x32d5be,_0x25fa5c){return db[_0x5bd7('0x4a')][_0x5bd7('0x50')]({'where':{'id':_0x1326c2[_0x5bd7('0x4f')]['id']}})[_0x5bd7('0x2e')](function(_0x526a5c){if(_0x526a5c){return _0x526a5c['destroy']();}})['then'](function(_0x2365cb){rimraf(path['join'](config[_0x5bd7('0x5f')],_0x5bd7('0x60'),path[_0x5bd7('0x61')](_0x2365cb[_0x5bd7('0x5')])),function(){});return _0x2365cb;})[_0x5bd7('0x2e')](handleEntityNotFound(_0x32d5be,null))[_0x5bd7('0x2e')](respondWithStatusCode(_0x32d5be,null))[_0x5bd7('0x51')](handleError(_0x32d5be,null));};exports[_0x5bd7('0x9e')]=function(_0x43c388,_0x23a6df,_0x5284a6){return BPromise[_0x5bd7('0x9f')]()[_0x5bd7('0x2e')](function(){if(!_0x43c388[_0x5bd7('0x3c')]['path']){throw new Error(_0x5bd7('0xa0'));}if(!_0x43c388[_0x5bd7('0x3c')]['port']){throw new Error(_0x5bd7('0xa1'));}var _0x4e7e8f=_0x43c388[_0x5bd7('0x3c')][_0x5bd7('0xa2')]?_0x43c388['query'][_0x5bd7('0xa2')]+':'+_0x43c388[_0x5bd7('0x3c')]['port']:_0x5bd7('0xa3')+_0x43c388['query'][_0x5bd7('0xa4')];var _0x476c7d=_0x43c388[_0x5bd7('0x3c')][_0x5bd7('0x24')]?_0x43c388[_0x5bd7('0x3c')][_0x5bd7('0x24')]:!![];var _0x29abbe=_0x43c388[_0x5bd7('0x3c')][_0x5bd7('0xa5')]?_0x43c388[_0x5bd7('0x3c')][_0x5bd7('0xa5')]:null;var _0x3f0013={'method':_0x43c388[_0x5bd7('0xa6')],'uri':util['format'](_0x5bd7('0xa7'),_0x4e7e8f,_0x43c388['query'][_0x5bd7('0x5')]),'json':_0x476c7d,'resolveWithFullResponse':!![],'encoding':_0x29abbe,'qs':_0x43c388[_0x5bd7('0x3c')]};if(_0x43c388['headers']){_0x3f0013['headers']=_0x43c388[_0x5bd7('0xa8')];if(_0x3f0013[_0x5bd7('0xa8')]['content-length']){delete _0x3f0013[_0x5bd7('0xa8')][_0x5bd7('0xa9')];}}if(_0x3f0013['headers'][_0x5bd7('0xaa')]){delete _0x3f0013[_0x5bd7('0xa8')][_0x5bd7('0xaa')];}return rp(_0x3f0013);})[_0x5bd7('0x2e')](function(_0x275d2c){if(_0x275d2c){_0x23a6df[_0x5bd7('0x29')](_0x275d2c[_0x5bd7('0xa8')]);logger['info'](_0x275d2c[_0x5bd7('0x92')]);if(_[_0x5bd7('0xab')](_0x43c388[_0x5bd7('0x3c')]['path'],_0x5bd7('0x52'))&&_0x275d2c['statusCode']==0x1f4){return _0x23a6df[_0x5bd7('0x21')](_0x275d2c[_0x5bd7('0xac')]);}else{return _0x23a6df[_0x5bd7('0x22')](_0x275d2c[_0x5bd7('0xac')])[_0x5bd7('0x34')](_0x275d2c['body']);}}else{return _0x23a6df[_0x5bd7('0x21')](0xc8);}})[_0x5bd7('0x51')](handleError(_0x23a6df,null));};exports[_0x5bd7('0xad')]=function(_0x49c34c,_0x1d0181,_0x20bd9a){return BPromise[_0x5bd7('0x9f')]()[_0x5bd7('0x2e')](function(){if(!_0x49c34c[_0x5bd7('0x3c')]['path']){throw new Error(_0x5bd7('0xa0'));}if(!_0x49c34c[_0x5bd7('0x3c')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3beacf=_0x49c34c[_0x5bd7('0x3c')][_0x5bd7('0xa2')]?_0x49c34c[_0x5bd7('0x3c')]['hostname']+':'+_0x49c34c[_0x5bd7('0x3c')][_0x5bd7('0xa4')]:_0x5bd7('0xa3')+_0x49c34c[_0x5bd7('0x3c')]['port'];var _0x567539=_0x49c34c[_0x5bd7('0x3c')][_0x5bd7('0x24')]?_0x49c34c[_0x5bd7('0x3c')][_0x5bd7('0x24')]:!![];var _0x4c0450=_0x49c34c[_0x5bd7('0x3c')][_0x5bd7('0xa5')]?_0x49c34c[_0x5bd7('0x3c')]['encoding']:null;var _0x56486b={'method':_0x49c34c[_0x5bd7('0xa6')],'uri':util[_0x5bd7('0x54')]('%s%s',_0x3beacf,_0x49c34c['query'][_0x5bd7('0x5')]),'json':_0x567539,'resolveWithFullResponse':!![],'encoding':_0x4c0450,'body':_0x49c34c[_0x5bd7('0x92')]};if(_0x49c34c[_0x5bd7('0xa8')]){_0x56486b[_0x5bd7('0xa8')]=_0x49c34c[_0x5bd7('0xa8')];if(_0x56486b['headers'][_0x5bd7('0xa9')]){delete _0x56486b[_0x5bd7('0xa8')]['content-length'];}}if(_0x56486b['headers']['content-type']){delete _0x56486b[_0x5bd7('0xa8')][_0x5bd7('0xaa')];}return rp(_0x56486b);})[_0x5bd7('0x2e')](function(_0x23f3a3){if(_0x23f3a3){_0x1d0181[_0x5bd7('0x29')](_0x23f3a3['headers']);logger[_0x5bd7('0x6a')](_0x23f3a3[_0x5bd7('0x92')]);return _0x1d0181[_0x5bd7('0x22')](_0x23f3a3['statusCode'])[_0x5bd7('0x34')](_0x23f3a3[_0x5bd7('0x92')]);}else{return _0x1d0181[_0x5bd7('0x21')](0xc8);}})['catch'](handleError(_0x1d0181,null));}; \ No newline at end of file +var _0x2a60=['zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','join','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','lstatSync','isFile','Invalid\x20plugin\x20structure','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-type','endsWith','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','content-length','statusCode','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','offset','undefined','count','set','json','apply','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','intersection','options','find','catch','download','params','root','server/files/plugins','format','basename','createWriteStream'];(function(_0x2375e1,_0x3d125a){var _0x2ccc7d=function(_0x343bb6){while(--_0x343bb6){_0x2375e1['push'](_0x2375e1['shift']());}};_0x2ccc7d(++_0x3d125a);}(_0x2a60,0x1b9));var _0x02a6=function(_0x5ee175,_0x547ff2){_0x5ee175=_0x5ee175-0x0;var _0x325634=_0x2a60[_0x5ee175];return _0x325634;};'use strict';var emlformat=require(_0x02a6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x02a6('0x1'));var rp=require('request-promise');var moment=require(_0x02a6('0x2'));var BPromise=require(_0x02a6('0x3'));var Mustache=require(_0x02a6('0x4'));var util=require(_0x02a6('0x5'));var path=require(_0x02a6('0x6'));var sox=require(_0x02a6('0x7'));var csv=require(_0x02a6('0x8'));var ejs=require(_0x02a6('0x9'));var fs=require('fs');var fs_extra=require(_0x02a6('0xa'));var _=require(_0x02a6('0xb'));var squel=require('squel');var crypto=require(_0x02a6('0xc'));var jsforce=require(_0x02a6('0xd'));var deskjs=require(_0x02a6('0xe'));var toCsv=require(_0x02a6('0x8'));var querystring=require(_0x02a6('0xf'));var Papa=require(_0x02a6('0x10'));var extract=require(_0x02a6('0x11'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x02a6('0x12'));var authService=require(_0x02a6('0x13'));var qs=require(_0x02a6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x02a6('0x15'));var utils=require(_0x02a6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x02a6('0x17'));var db=require(_0x02a6('0x18'))['db'];config['redis']=_[_0x02a6('0x19')](config[_0x02a6('0x1a')],{'host':_0x02a6('0x1b'),'port':0x18eb});var socket=require(_0x02a6('0x1c'))(new Redis(config[_0x02a6('0x1a')]));require('./plugin.socket')[_0x02a6('0x1d')](socket);function respondWithStatusCode(_0x585a9b,_0x3b6e7a){_0x3b6e7a=_0x3b6e7a||0xcc;return function(_0x457fef){if(_0x457fef){return _0x585a9b['sendStatus'](_0x3b6e7a);}return _0x585a9b[_0x02a6('0x1e')](_0x3b6e7a)[_0x02a6('0x1f')]();};}function respondWithResult(_0xab90d,_0x32fa70){_0x32fa70=_0x32fa70||0xc8;return function(_0x52f199){if(_0x52f199){return _0xab90d[_0x02a6('0x1e')](_0x32fa70)['json'](_0x52f199);}};}function respondWithFilteredResult(_0x4f6cbe,_0x4be296){return function(_0xc018d6){if(_0xc018d6){var _0x3ab24b=typeof _0x4be296[_0x02a6('0x20')]===_0x02a6('0x21')&&typeof _0x4be296['limit']===_0x02a6('0x21');var _0x4f61d3=_0xc018d6[_0x02a6('0x22')];var _0x404e69=_0x3ab24b?0x0:_0x4be296[_0x02a6('0x20')];var _0xd5af0d=_0x3ab24b?_0xc018d6['count']:_0x4be296[_0x02a6('0x20')]+_0x4be296['limit'];var _0x534c9a;if(_0xd5af0d>=_0x4f61d3){_0xd5af0d=_0x4f61d3;_0x534c9a=0xc8;}else{_0x534c9a=0xce;}_0x4f6cbe[_0x02a6('0x1e')](_0x534c9a);return _0x4f6cbe[_0x02a6('0x23')]('Content-Range',_0x404e69+'-'+_0xd5af0d+'/'+_0x4f61d3)[_0x02a6('0x24')](_0xc018d6);}return null;};}function patchUpdates(_0x24c583){return function(_0x223a59){try{jsonpatch[_0x02a6('0x25')](_0x223a59,_0x24c583,!![]);}catch(_0x31c5a7){return BPromise['reject'](_0x31c5a7);}return _0x223a59['save']();};}function saveUpdates(_0xa0df64,_0x16060a){return function(_0x2d5f58){if(_0x2d5f58){return _0x2d5f58[_0x02a6('0x26')](_0xa0df64)[_0x02a6('0x27')](function(_0x12f6d3){return _0x12f6d3;});}return null;};}function removeEntity(_0x1cf849,_0x4ddfad){return function(_0x2dd259){if(_0x2dd259){return _0x2dd259[_0x02a6('0x28')]()['then'](function(){var _0x10e6a8=_0x2dd259[_0x02a6('0x29')]({'plain':!![]});var _0x1be690='Plugins';return db[_0x02a6('0x2a')][_0x02a6('0x28')]({'where':{'type':_0x1be690,'resourceId':_0x10e6a8['id']}})[_0x02a6('0x27')](function(){return _0x2dd259;});})[_0x02a6('0x27')](function(){_0x1cf849[_0x02a6('0x1e')](0xcc)[_0x02a6('0x1f')]();});}};}function handleEntityNotFound(_0x235422,_0x561bb9){return function(_0x46268a){if(!_0x46268a){_0x235422[_0x02a6('0x2b')](0x194);}return _0x46268a;};}function handleError(_0x508039,_0x470fc6){_0x470fc6=_0x470fc6||0x1f4;return function(_0x3d7aad){logger[_0x02a6('0x2c')](_0x3d7aad[_0x02a6('0x2d')]);if(_0x3d7aad['name']){delete _0x3d7aad[_0x02a6('0x2e')];}_0x508039[_0x02a6('0x1e')](_0x470fc6)[_0x02a6('0x2f')](_0x3d7aad);};}exports[_0x02a6('0x30')]=function(_0x435c0a,_0x2622e8){var _0x16eadb={},_0x59e056={},_0x3b78e5={'count':0x0,'rows':[]};var _0x5d2acc=_[_0x02a6('0x31')](db[_0x02a6('0x32')][_0x02a6('0x33')],function(_0x56b6e1){return{'name':_0x56b6e1[_0x02a6('0x34')],'type':_0x56b6e1[_0x02a6('0x35')]['key']};});_0x59e056['model']=_[_0x02a6('0x31')](_0x5d2acc,'name');_0x59e056[_0x02a6('0x36')]=_[_0x02a6('0x37')](_0x435c0a[_0x02a6('0x36')]);_0x59e056[_0x02a6('0x38')]=_['intersection'](_0x59e056[_0x02a6('0x39')],_0x59e056['query']);_0x16eadb[_0x02a6('0x3a')]=_['intersection'](_0x59e056[_0x02a6('0x39')],qs[_0x02a6('0x3b')](_0x435c0a[_0x02a6('0x36')][_0x02a6('0x3b')]));_0x16eadb[_0x02a6('0x3a')]=_0x16eadb[_0x02a6('0x3a')][_0x02a6('0x3c')]?_0x16eadb[_0x02a6('0x3a')]:_0x59e056['model'];if(!_0x435c0a[_0x02a6('0x36')][_0x02a6('0x3d')](_0x02a6('0x3e'))){_0x16eadb['limit']=qs[_0x02a6('0x3f')](_0x435c0a[_0x02a6('0x36')]['limit']);_0x16eadb[_0x02a6('0x20')]=qs['offset'](_0x435c0a[_0x02a6('0x36')]['offset']);}_0x16eadb[_0x02a6('0x40')]=qs['sort'](_0x435c0a['query'][_0x02a6('0x41')]);_0x16eadb[_0x02a6('0x42')]=qs[_0x02a6('0x38')](_[_0x02a6('0x43')](_0x435c0a[_0x02a6('0x36')],_0x59e056[_0x02a6('0x38')]),_0x5d2acc);if(_0x435c0a['query']['filter']){_0x16eadb['where']=_[_0x02a6('0x44')](_0x16eadb[_0x02a6('0x42')],{'$or':_['map'](_0x5d2acc,function(_0x235d7b){if(_0x235d7b[_0x02a6('0x35')]!==_0x02a6('0x45')){var _0x18738f={};_0x18738f[_0x235d7b['name']]={'$like':'%'+_0x435c0a[_0x02a6('0x36')][_0x02a6('0x46')]+'%'};return _0x18738f;}})});}_0x16eadb=_[_0x02a6('0x44')]({},_0x16eadb,_0x435c0a['options']);var _0xc8c8d9={'where':_0x16eadb[_0x02a6('0x42')]};return db['Plugin']['count'](_0xc8c8d9)[_0x02a6('0x27')](function(_0x457ac3){_0x3b78e5[_0x02a6('0x22')]=_0x457ac3;if(_0x435c0a[_0x02a6('0x36')][_0x02a6('0x47')]){_0x16eadb[_0x02a6('0x48')]=[{'all':!![]}];}return db[_0x02a6('0x32')][_0x02a6('0x49')](_0x16eadb);})['then'](function(_0x78111d){_0x3b78e5[_0x02a6('0x4a')]=_0x78111d;return _0x3b78e5;})[_0x02a6('0x27')](respondWithFilteredResult(_0x2622e8,_0x16eadb))['catch'](handleError(_0x2622e8,null));};exports[_0x02a6('0x4b')]=function(_0x3868e4,_0x4ec1a6){var _0x49e069={'raw':!![],'where':{'id':_0x3868e4['params']['id']}},_0x4512a6={};_0x4512a6[_0x02a6('0x39')]=_['keys'](db[_0x02a6('0x32')][_0x02a6('0x33')]);_0x4512a6[_0x02a6('0x36')]=_[_0x02a6('0x37')](_0x3868e4[_0x02a6('0x36')]);_0x4512a6[_0x02a6('0x38')]=_[_0x02a6('0x4c')](_0x4512a6[_0x02a6('0x39')],_0x4512a6[_0x02a6('0x36')]);_0x49e069[_0x02a6('0x3a')]=_['intersection'](_0x4512a6[_0x02a6('0x39')],qs[_0x02a6('0x3b')](_0x3868e4[_0x02a6('0x36')][_0x02a6('0x3b')]));_0x49e069[_0x02a6('0x3a')]=_0x49e069[_0x02a6('0x3a')]['length']?_0x49e069[_0x02a6('0x3a')]:_0x4512a6[_0x02a6('0x39')];if(_0x3868e4[_0x02a6('0x36')][_0x02a6('0x47')]){_0x49e069[_0x02a6('0x48')]=[{'all':!![]}];}_0x49e069=_[_0x02a6('0x44')]({},_0x49e069,_0x3868e4[_0x02a6('0x4d')]);return db['Plugin'][_0x02a6('0x4e')](_0x49e069)[_0x02a6('0x27')](handleEntityNotFound(_0x4ec1a6,null))[_0x02a6('0x27')](respondWithResult(_0x4ec1a6,null))[_0x02a6('0x4f')](handleError(_0x4ec1a6,null));};exports[_0x02a6('0x50')]=function(_0x32cd8c,_0x9d578a,_0x5123d5){return db[_0x02a6('0x32')][_0x02a6('0x4e')]({'where':{'id':_0x32cd8c[_0x02a6('0x51')]['id']},'attributes':[_0x02a6('0x2e'),_0x02a6('0x6')],'raw':!![]})[_0x02a6('0x27')](handleEntityNotFound(_0x9d578a,null))['then'](function(_0x37c0f3){if(_0x37c0f3){var _0x1e335c=path['join'](config[_0x02a6('0x52')],_0x02a6('0x53'),util[_0x02a6('0x54')]('%s.zip',path[_0x02a6('0x55')](_0x37c0f3[_0x02a6('0x6')])));var _0xfeba4a=fs[_0x02a6('0x56')](_0x1e335c);var _0x1c2ac5=archiver(_0x02a6('0x57'),{'zlib':{'level':0x9}});_0x1c2ac5['on'](_0x02a6('0x58'),function(_0x275bb1){if(_0x275bb1[_0x02a6('0x59')]===_0x02a6('0x5a')){logger[_0x02a6('0x2c')](_0x275bb1);}else{throw new db[(_0x02a6('0x5b'))][(_0x02a6('0x5c'))](_0x02a6('0x5d'));}});_0x1c2ac5['on']('error',function(_0xf88d28){throw new db[(_0x02a6('0x5b'))][(_0x02a6('0x5c'))](_0x02a6('0x5d'));});_0x1c2ac5[_0x02a6('0x5e')](_0xfeba4a);_0x1c2ac5[_0x02a6('0x5f')]('**/*',{'cwd':path[_0x02a6('0x60')](config[_0x02a6('0x52')],_0x02a6('0x53'),path[_0x02a6('0x61')](_0x37c0f3[_0x02a6('0x6')])),'ignore':[path[_0x02a6('0x60')](path[_0x02a6('0x55')](_0x37c0f3[_0x02a6('0x6')]),_0x02a6('0x62')),path['join'](path[_0x02a6('0x55')](_0x37c0f3['path']),_0x02a6('0x63'))],'nodir':!![]})[_0x02a6('0x64')]();_0xfeba4a['on']('close',function(){if(!fs[_0x02a6('0x65')](_0x1e335c)){throw new db[(_0x02a6('0x5b'))][(_0x02a6('0x5c'))](_0x02a6('0x66'));}return _0x9d578a['download'](_0x1e335c,util[_0x02a6('0x54')](_0x02a6('0x67'),path[_0x02a6('0x55')](_0x37c0f3[_0x02a6('0x6')])),function(_0x22eccb){if(_0x22eccb){throw new db[(_0x02a6('0x5b'))]['Error'](_0x02a6('0x68'));}fs['unlinkSync'](_0x1e335c);logger[_0x02a6('0x69')](_0x02a6('0x6a'));logger[_0x02a6('0x69')](_0x02a6('0x6b'));});});}return null;})[_0x02a6('0x4f')](handleError(_0x9d578a,null));};exports[_0x02a6('0x6c')]=function(_0x26cd55,_0xb24f3c,_0x367a9a){var _0x48220d=path['basename'](_0x26cd55['file'][_0x02a6('0x6d')],path[_0x02a6('0x6e')](_0x26cd55['file'][_0x02a6('0x6d')]));var _0x3511aa=path[_0x02a6('0x60')](config[_0x02a6('0x52')],'server/files/plugins',_0x26cd55[_0x02a6('0x6f')][_0x02a6('0x6d')]);var _0x1ef8fb=path['join'](config['root'],_0x02a6('0x53'),_0x48220d);logger['info'](_0x02a6('0x70'),_0x3511aa);logger[_0x02a6('0x69')](_0x02a6('0x71'),_0x1ef8fb);try{fs[_0x02a6('0x72')](_0x3511aa,parseInt(_0x02a6('0x73'),0x8));extract(_0x3511aa,{'dir':_0x1ef8fb},function(_0x6a5d5a){if(_0x6a5d5a){logger['error'](_0x6a5d5a);handleError(_0x6a5d5a,!![]);};var _0x5ef091=fs['readdirSync'](_0x1ef8fb);if(_0x5ef091['length']>0x1){removeReferences(_0x3511aa,_0x1ef8fb);logger['error']('Invalid\x20plugin\x20structure');return _0x367a9a(new Error('Invalid\x20plugin\x20structure'));}var _0x5dea0e=fs[_0x02a6('0x74')](path['join'](_0x1ef8fb,_0x5ef091[0x0]));if(_0x5dea0e[_0x02a6('0x75')]()){removeReferences(_0x3511aa,_0x1ef8fb);logger[_0x02a6('0x2c')](_0x02a6('0x76'));return _0x367a9a(new Error(_0x02a6('0x76')));}if(_0x5dea0e[_0x02a6('0x77')]()){var _0x3e3a67=fs[_0x02a6('0x78')](path['join'](_0x1ef8fb,_0x5ef091[0x0]));if(_0x3e3a67[_0x02a6('0x3c')]===0x0){removeReferences(_0x3511aa,_0x1ef8fb);logger['error'](_0x02a6('0x76'));return _0x367a9a(new Error(_0x02a6('0x76')));}var _0x12c5b2=_0x3e3a67[_0x02a6('0x79')](function(_0x971063){return _0x971063==='manifest.json';});if(!_0x12c5b2){return _0x367a9a(new Error(_0x02a6('0x7a')));}var _0x20b2f2=fs[_0x02a6('0x7b')](path[_0x02a6('0x60')](_0x1ef8fb,_0x5ef091[0x0],'manifest.json'));var _0x1e2a65=JSON[_0x02a6('0x7c')](_0x20b2f2);if(_0x02a6('0x21')==typeof _0x1e2a65[_0x02a6('0x2e')]){return _0x367a9a(new Error(_0x02a6('0x7d')));}if('undefined'==typeof _0x1e2a65['type']){return _0x367a9a(new Error(_0x02a6('0x7e')));}if(_0x02a6('0x21')==typeof _0x1e2a65[_0x02a6('0x7f')]){return _0x367a9a(new Error(_0x02a6('0x80')));}if(_0x02a6('0x21')==typeof _0x1e2a65[_0x02a6('0x81')]){return _0x367a9a(new Error(_0x02a6('0x82')));}if(_0x1e2a65[_0x02a6('0x35')]==='html'){if(_0x02a6('0x21')==typeof _0x1e2a65['parameters'][_0x02a6('0x83')]){return _0x367a9a(new Error(_0x02a6('0x84')));}if(_0x02a6('0x21')==typeof _0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')][_0x02a6('0x85')]&&_0x02a6('0x21')==typeof _0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')][_0x02a6('0x86')]){return _0x367a9a(new Error(_0x02a6('0x87')));}}else if(_0x1e2a65[_0x02a6('0x35')]==='script'){if('undefined'==typeof _0x1e2a65[_0x02a6('0x81')][_0x02a6('0x88')]){return _0x367a9a(new Error(_0x02a6('0x89')));}if(_0x02a6('0x21')==typeof _0x1e2a65['parameters'][_0x02a6('0x8a')]){return _0x367a9a(new Error(_0x02a6('0x8b')));}}else{return _0x367a9a(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x282043=_0x1e2a65['name'];var _0x174b81=_0x1e2a65[_0x02a6('0x8c')];var _0x55e1cd=_0x1e2a65[_0x02a6('0x35')];var _0x11afb2=_0x1e2a65[_0x02a6('0x8d')]?_0x1e2a65['sidebar']:_0x02a6('0x8e');var _0x36482a=_0x1e2a65[_0x02a6('0x8f')]?_0x1e2a65[_0x02a6('0x8f')]:_0x02a6('0x90');var _0x1af9ce='';var _0x333ae4='';var _0x34da5a='';var _0x3e6818='';var _0x45b6ee=_0x1e2a65[_0x02a6('0x7f')];if(_0x55e1cd==='html'){if(_0x02a6('0x21')!=typeof _0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')]['admin']){var _0x20df23=_0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')][_0x02a6('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x02a6('0x91')](_0x20df23)){_0x1af9ce=path[_0x02a6('0x60')](_0x02a6('0x92'),_0x48220d,_0x5ef091[0x0],_0x20df23);}else{_0x1af9ce=_0x20df23;}}else{logger[_0x02a6('0x69')](_0x02a6('0x93'));}if('undefined'!=typeof _0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')][_0x02a6('0x86')]){var _0x4a34d3=_0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')][_0x02a6('0x86')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4a34d3)){_0x333ae4=path[_0x02a6('0x60')]('plugins',_0x48220d,_0x5ef091[0x0],_0x4a34d3);}else{_0x333ae4=_0x4a34d3;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x55e1cd==='script'){_0x34da5a=_0x1e2a65[_0x02a6('0x81')]['scriptName'];_0x3e6818=_0x1e2a65['parameters'][_0x02a6('0x8a')];if(_0x02a6('0x21')!=typeof _0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')]){if('undefined'!=typeof _0x1e2a65['parameters'][_0x02a6('0x83')][_0x02a6('0x85')]){var _0x20df23=_0x1e2a65[_0x02a6('0x81')][_0x02a6('0x83')][_0x02a6('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x02a6('0x91')](_0x20df23)){_0x1af9ce=path[_0x02a6('0x60')](_0x02a6('0x92'),_0x48220d,_0x5ef091[0x0],_0x20df23);}else{_0x1af9ce=_0x20df23;}}if(_0x02a6('0x21')!=typeof _0x1e2a65[_0x02a6('0x81')]['views'][_0x02a6('0x86')]){var _0x4a34d3=_0x1e2a65['parameters'][_0x02a6('0x83')][_0x02a6('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x02a6('0x91')](_0x4a34d3)){_0x333ae4=path[_0x02a6('0x60')](_0x02a6('0x92'),_0x48220d,_0x5ef091[0x0],_0x4a34d3);}else{_0x333ae4=_0x4a34d3;}}}}var _0x9f1cee={'name':_0x282043,'description':_0x174b81,'path':path[_0x02a6('0x60')](_0x48220d,_0x5ef091[0x0]),'type':_0x55e1cd,'sidebar':_0x11afb2,'icon':_0x36482a,'adminUrl':_0x1af9ce,'agentUrl':_0x333ae4,'scriptName':_0x34da5a,'scriptPath':_0x3e6818,'version':_0x45b6ee};removeReferences(_0x3511aa,null);return db['Plugin']['create'](_0x9f1cee)[_0x02a6('0x27')](function(_0x316127){var _0x2088a9={'role':_0x26cd55[_0x02a6('0x94')][_0x02a6('0x95')],'userProfileId':_0x26cd55[_0x02a6('0x94')][_0x02a6('0x96')]};if(!_0x2088a9)throw new Error(_0x02a6('0x97'));if(_0x2088a9[_0x02a6('0x95')]===_0x02a6('0x98')){var _0xe734bd=_0x316127['get']({'plain':!![]});return db[_0x02a6('0x99')][_0x02a6('0x4e')]({'where':{'name':_0x02a6('0x9a'),'userProfileId':_0x2088a9['userProfileId']},'raw':!![]})[_0x02a6('0x27')](function(_0x3cc436){if(_0x3cc436&&_0x3cc436[_0x02a6('0x9b')]===0x0){return db['UserProfileResource'][_0x02a6('0x9c')]({'name':_0xe734bd[_0x02a6('0x2e')],'resourceId':_0xe734bd['id'],'type':_0x3cc436['name'],'sectionId':_0x3cc436['id']},{})[_0x02a6('0x27')](function(){return _0x316127;});}else{return _0x316127;}})[_0x02a6('0x4f')](function(_0x20f51d){logger[_0x02a6('0x2c')](_0x02a6('0x9d'),_0x20f51d);throw _0x20f51d;});}return _0x316127;})[_0x02a6('0x27')](respondWithResult(_0xb24f3c,null))[_0x02a6('0x4f')](handleError(_0xb24f3c,null));}});}catch(_0x8b78b2){_0xb24f3c['status'](0x1f4)[_0x02a6('0x2f')](_0x8b78b2);}};function removeReferences(_0x3eb578,_0x180572){try{if(_0x3eb578){fs[_0x02a6('0x9e')](_0x3eb578);logger[_0x02a6('0x69')](_0x02a6('0x9f'));}if(_0x180572){rimraf(_0x180572,function(){});logger[_0x02a6('0x69')](_0x02a6('0xa0'));}}catch(_0x1e95f0){logger[_0x02a6('0x2c')](_0x1e95f0);}}exports[_0x02a6('0x26')]=function(_0x81eed7,_0x48b07e,_0x625865){return db[_0x02a6('0x32')]['find']({'where':{'id':_0x81eed7[_0x02a6('0x51')]['id']}})[_0x02a6('0x27')](handleEntityNotFound(_0x48b07e,null))[_0x02a6('0x27')](saveUpdates(_0x81eed7[_0x02a6('0x94')],null))[_0x02a6('0x27')](respondWithResult(_0x48b07e,null))[_0x02a6('0x4f')](handleError(_0x48b07e,null));};exports['delete']=function(_0x571725,_0x5e6fce,_0x5a5984){return db[_0x02a6('0x32')][_0x02a6('0x4e')]({'where':{'id':_0x571725[_0x02a6('0x51')]['id']}})['then'](function(_0x1dc722){if(_0x1dc722){return _0x1dc722[_0x02a6('0x28')]();}})[_0x02a6('0x27')](function(_0x5480d6){rimraf(path[_0x02a6('0x60')](config[_0x02a6('0x52')],_0x02a6('0x53'),path[_0x02a6('0x61')](_0x5480d6[_0x02a6('0x6')])),function(){});return _0x5480d6;})[_0x02a6('0x27')](handleEntityNotFound(_0x5e6fce,null))[_0x02a6('0x27')](respondWithStatusCode(_0x5e6fce,null))['catch'](handleError(_0x5e6fce,null));};exports[_0x02a6('0xa1')]=function(_0x55091d,_0x126860,_0x25ee5b){return BPromise[_0x02a6('0xa2')]()[_0x02a6('0x27')](function(){if(!_0x55091d['query'][_0x02a6('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x55091d[_0x02a6('0x36')][_0x02a6('0xa3')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x4f7ed4=_0x55091d[_0x02a6('0x36')][_0x02a6('0xa4')]?_0x55091d[_0x02a6('0x36')]['hostname']+':'+_0x55091d['query']['port']:_0x02a6('0xa5')+_0x55091d[_0x02a6('0x36')][_0x02a6('0xa3')];var _0xc335b5=_0x55091d[_0x02a6('0x36')]['json']?_0x55091d[_0x02a6('0x36')][_0x02a6('0x24')]:!![];var _0x147d9f=_0x55091d[_0x02a6('0x36')][_0x02a6('0xa6')]?_0x55091d['query'][_0x02a6('0xa6')]:null;var _0x242627={'method':_0x55091d[_0x02a6('0xa7')],'uri':util[_0x02a6('0x54')](_0x02a6('0xa8'),_0x4f7ed4,_0x55091d[_0x02a6('0x36')][_0x02a6('0x6')]),'json':_0xc335b5,'resolveWithFullResponse':!![],'encoding':_0x147d9f,'qs':_0x55091d[_0x02a6('0x36')]};if(_0x55091d[_0x02a6('0xa9')]){_0x242627[_0x02a6('0xa9')]=_0x55091d[_0x02a6('0xa9')];if(_0x242627['headers']['content-length']){delete _0x242627[_0x02a6('0xa9')]['content-length'];}}if(_0x242627['headers'][_0x02a6('0xaa')]){delete _0x242627[_0x02a6('0xa9')]['content-type'];}return rp(_0x242627);})[_0x02a6('0x27')](function(_0x18e08a){if(_0x18e08a){_0x126860[_0x02a6('0x23')](_0x18e08a[_0x02a6('0xa9')]);logger[_0x02a6('0x69')](_0x18e08a[_0x02a6('0x94')]);if(_[_0x02a6('0xab')](_0x55091d['query'][_0x02a6('0x6')],_0x02a6('0x50'))&&_0x18e08a['statusCode']==0x1f4){return _0x126860[_0x02a6('0x2b')](_0x18e08a['statusCode']);}else{return _0x126860[_0x02a6('0x1e')](_0x18e08a['statusCode'])[_0x02a6('0x2f')](_0x18e08a[_0x02a6('0x94')]);}}else{return _0x126860[_0x02a6('0x2b')](0xc8);}})[_0x02a6('0x4f')](handleError(_0x126860,null));};exports['webhookPost']=function(_0x240235,_0x5aa9b9,_0x23db97){return BPromise[_0x02a6('0xa2')]()[_0x02a6('0x27')](function(){if(!_0x240235[_0x02a6('0x36')][_0x02a6('0x6')]){throw new Error(_0x02a6('0xac'));}if(!_0x240235[_0x02a6('0x36')][_0x02a6('0xa3')]){throw new Error(_0x02a6('0xad'));}var _0x4222dd=_0x240235[_0x02a6('0x36')][_0x02a6('0xa4')]?_0x240235['query']['hostname']+':'+_0x240235[_0x02a6('0x36')][_0x02a6('0xa3')]:_0x02a6('0xa5')+_0x240235[_0x02a6('0x36')]['port'];var _0x547fb8=_0x240235[_0x02a6('0x36')][_0x02a6('0x24')]?_0x240235[_0x02a6('0x36')][_0x02a6('0x24')]:!![];var _0x263b1c=_0x240235[_0x02a6('0x36')][_0x02a6('0xa6')]?_0x240235[_0x02a6('0x36')]['encoding']:null;var _0x2f560b={'method':_0x240235[_0x02a6('0xa7')],'uri':util[_0x02a6('0x54')](_0x02a6('0xa8'),_0x4222dd,_0x240235[_0x02a6('0x36')]['path']),'json':_0x547fb8,'resolveWithFullResponse':!![],'encoding':_0x263b1c,'body':_0x240235[_0x02a6('0x94')]};if(_0x240235[_0x02a6('0xa9')]){_0x2f560b[_0x02a6('0xa9')]=_0x240235['headers'];if(_0x2f560b['headers'][_0x02a6('0xae')]){delete _0x2f560b['headers'][_0x02a6('0xae')];}}if(_0x2f560b[_0x02a6('0xa9')][_0x02a6('0xaa')]){delete _0x2f560b[_0x02a6('0xa9')][_0x02a6('0xaa')];}return rp(_0x2f560b);})['then'](function(_0x5445d5){if(_0x5445d5){_0x5aa9b9[_0x02a6('0x23')](_0x5445d5[_0x02a6('0xa9')]);logger[_0x02a6('0x69')](_0x5445d5['body']);return _0x5aa9b9[_0x02a6('0x1e')](_0x5445d5[_0x02a6('0xaf')])[_0x02a6('0x2f')](_0x5445d5[_0x02a6('0x94')]);}else{return _0x5aa9b9[_0x02a6('0x2b')](0xc8);}})['catch'](handleError(_0x5aa9b9,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 82febf2..cbab4ee 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 _0xb7ac=['emit','hasOwnProperty','events','../../mysqldb','Plugin','setMaxListeners','save','remove'];(function(_0x136e17,_0x3515eb){var _0x5189f6=function(_0x34e91f){while(--_0x34e91f){_0x136e17['push'](_0x136e17['shift']());}};_0x5189f6(++_0x3515eb);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x17220d,_0x5e615e){_0x17220d=_0x17220d-0x0;var _0x5e1f4b=_0xb7ac[_0x17220d];return _0x5e1f4b;};'use strict';var EventEmitter=require(_0xcb7a('0x0'));var Plugin=require(_0xcb7a('0x1'))['db'][_0xcb7a('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xcb7a('0x3')](0x0);var events={'afterCreate':_0xcb7a('0x4'),'afterUpdate':'update','afterDestroy':_0xcb7a('0x5')};function emitEvent(_0x4817ac){return function(_0x41408c,_0xaa5a21,_0x50be72){PluginEvents[_0xcb7a('0x6')](_0x4817ac+':'+_0x41408c['id'],_0x41408c);PluginEvents[_0xcb7a('0x6')](_0x4817ac,_0x41408c);_0x50be72(null);};}for(var e in events){if(events[_0xcb7a('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x7046=['events','../../mysqldb','Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x4c8944,_0x54f1b1){var _0x533add=function(_0x19b0a8){while(--_0x19b0a8){_0x4c8944['push'](_0x4c8944['shift']());}};_0x533add(++_0x54f1b1);}(_0x7046,0x144));var _0x6704=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7046[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0x6704('0x0'));var Plugin=require(_0x6704('0x1'))['db'][_0x6704('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x6704('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6704('0x4'),'afterDestroy':_0x6704('0x5')};function emitEvent(_0x2899c5){return function(_0x5258e7,_0x1e9b2a,_0x35bcc6){PluginEvents[_0x6704('0x6')](_0x2899c5+':'+_0x5258e7['id'],_0x5258e7);PluginEvents[_0x6704('0x6')](_0x2899c5,_0x5258e7);_0x35bcc6(null);};}for(var e in events){if(events[_0x6704('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x6704('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index ab82091..378e5af 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 _0xf8d5=['bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api'];(function(_0x35d9af,_0x5a6d19){var _0x1b38fe=function(_0x2a11f6){while(--_0x2a11f6){_0x35d9af['push'](_0x35d9af['shift']());}};_0x1b38fe(++_0x5a6d19);}(_0xf8d5,0xcc));var _0x5f8d=function(_0xfab1f0,_0x3a7a02){_0xfab1f0=_0xfab1f0-0x0;var _0x4d2d14=_0xf8d5[_0xfab1f0];return _0x4d2d14;};'use strict';var _=require(_0x5f8d('0x0'));var util=require(_0x5f8d('0x1'));var logger=require(_0x5f8d('0x2'))(_0x5f8d('0x3'));var moment=require('moment');var BPromise=require(_0x5f8d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f8d('0x5'));var rimraf=require(_0x5f8d('0x6'));var config=require(_0x5f8d('0x7'));var attributes=require(_0x5f8d('0x8'));module[_0x5f8d('0x9')]=function(_0x4a7d5e,_0x2c7a26){return _0x4a7d5e[_0x5f8d('0xa')](_0x5f8d('0xb'),attributes,{'tableName':_0x5f8d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa4=['../../config/environment','./plugin.attributes','exports','define','plugins','lodash','util','api','moment','bluebird','path'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0x6aa4,0x12e));var _0x46aa=function(_0x24a67b,_0x47cdbc){_0x24a67b=_0x24a67b-0x0;var _0x222073=_0x6aa4[_0x24a67b];return _0x222073;};'use strict';var _=require(_0x46aa('0x0'));var util=require(_0x46aa('0x1'));var logger=require('../../config/logger')(_0x46aa('0x2'));var moment=require(_0x46aa('0x3'));var BPromise=require(_0x46aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x46aa('0x5'));var rimraf=require('rimraf');var config=require(_0x46aa('0x6'));var attributes=require(_0x46aa('0x7'));module[_0x46aa('0x8')]=function(_0x515846,_0x28779){return _0x515846[_0x46aa('0x9')]('Plugin',attributes,{'tableName':_0x46aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 5a56590..da54bc1 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 _0xd838=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreatePlugin','Plugin','body','options','lodash'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd838,0x95));var _0x8d83=function(_0x3c06c9,_0x43f29f){_0x3c06c9=_0x3c06c9-0x0;var _0x18a92f=_0xd838[_0x3c06c9];return _0x18a92f;};'use strict';var _=require(_0x8d83('0x0'));var util=require(_0x8d83('0x1'));var moment=require(_0x8d83('0x2'));var BPromise=require(_0x8d83('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d83('0x4'));var db=require(_0x8d83('0x5'))['db'];var utils=require(_0x8d83('0x6'));var logger=require(_0x8d83('0x7'))(_0x8d83('0x8'));var config=require(_0x8d83('0x9'));var jayson=require(_0x8d83('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x8d83('0xb')]=_['defaults'](config['redis'],{'host':_0x8d83('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8d83('0xb')]));require('./plugin.socket')[_0x8d83('0xd')](socket);function respondWithRpcPromise(_0x224013,_0x307088,_0x145af8){return new BPromise(function(_0xb0cefe,_0x202d88){return client[_0x8d83('0xe')](_0x224013,_0x145af8)[_0x8d83('0xf')](function(_0x3b088b){logger[_0x8d83('0x10')](_0x8d83('0x11'),_0x307088,_0x8d83('0x12'));logger[_0x8d83('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x307088,_0x8d83('0x12'),JSON[_0x8d83('0x14')](_0x3b088b));if(_0x3b088b[_0x8d83('0x15')]){if(_0x3b088b['error'][_0x8d83('0x16')]===0x1f4){logger[_0x8d83('0x15')](_0x8d83('0x11'),_0x307088,_0x3b088b[_0x8d83('0x15')][_0x8d83('0x17')]);return _0x202d88(_0x3b088b['error'][_0x8d83('0x17')]);}logger[_0x8d83('0x15')](_0x8d83('0x11'),_0x307088,_0x3b088b[_0x8d83('0x15')]['message']);return _0xb0cefe(_0x3b088b[_0x8d83('0x15')]['message']);}else{logger[_0x8d83('0x10')](_0x8d83('0x11'),_0x307088,_0x8d83('0x12'));_0xb0cefe(_0x3b088b[_0x8d83('0x18')][_0x8d83('0x17')]);}})[_0x8d83('0x19')](function(_0x13acc8){logger[_0x8d83('0x15')]('Plugin,\x20%s,\x20%s',_0x307088,_0x13acc8);_0x202d88(_0x13acc8);});});}exports[_0x8d83('0x1a')]=function(_0x64d924){var _0x265299=this;return new Promise(function(_0x35560f,_0x604132){return db[_0x8d83('0x1b')]['create'](_0x64d924[_0x8d83('0x1c')],{'raw':_0x64d924[_0x8d83('0x1d')]?_0x64d924[_0x8d83('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x8d83('0xf')](function(_0x3b5512){logger['info'](_0x8d83('0x1a'),_0x64d924);logger[_0x8d83('0x13')]('CreatePlugin',_0x64d924,JSON[_0x8d83('0x14')](_0x3b5512));_0x35560f(_0x3b5512);})[_0x8d83('0x19')](function(_0x547b7a){logger['error'](_0x8d83('0x1a'),_0x547b7a[_0x8d83('0x17')],_0x64d924);_0x604132(_0x265299[_0x8d83('0x15')](0x1f4,_0x547b7a[_0x8d83('0x17')]));});});}; \ No newline at end of file +var _0x697e=['Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Plugin,\x20%s,\x20%s','result','catch','options','raw','CreatePlugin','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','./plugin.socket','register','request','then','info','request\x20sent','debug'];(function(_0x19bdb3,_0x4e8659){var _0x87f65b=function(_0x4dcdc1){while(--_0x4dcdc1){_0x19bdb3['push'](_0x19bdb3['shift']());}};_0x87f65b(++_0x4e8659);}(_0x697e,0xe4));var _0xe697=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x697e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xe697('0x0'));var moment=require(_0xe697('0x1'));var BPromise=require(_0xe697('0x2'));var rs=require(_0xe697('0x3'));var fs=require('fs');var Redis=require(_0xe697('0x4'));var db=require(_0xe697('0x5'))['db'];var utils=require(_0xe697('0x6'));var logger=require(_0xe697('0x7'))(_0xe697('0x8'));var config=require('../../config/environment');var jayson=require(_0xe697('0x9'));var client=jayson[_0xe697('0xa')]['http']({'port':0x232a});config[_0xe697('0xb')]=_['defaults'](config[_0xe697('0xb')],{'host':_0xe697('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe697('0xb')]));require(_0xe697('0xd'))[_0xe697('0xe')](socket);function respondWithRpcPromise(_0x8d5a8,_0x3d77b7,_0x3760dc){return new BPromise(function(_0x3faf90,_0x1657d4){return client[_0xe697('0xf')](_0x8d5a8,_0x3760dc)[_0xe697('0x10')](function(_0x63f632){logger[_0xe697('0x11')]('Plugin,\x20%s,\x20%s',_0x3d77b7,_0xe697('0x12'));logger[_0xe697('0x13')](_0xe697('0x14'),_0x3d77b7,_0xe697('0x12'),JSON[_0xe697('0x15')](_0x63f632));if(_0x63f632[_0xe697('0x16')]){if(_0x63f632[_0xe697('0x16')][_0xe697('0x17')]===0x1f4){logger[_0xe697('0x16')]('Plugin,\x20%s,\x20%s',_0x3d77b7,_0x63f632[_0xe697('0x16')]['message']);return _0x1657d4(_0x63f632[_0xe697('0x16')][_0xe697('0x18')]);}logger['error'](_0xe697('0x19'),_0x3d77b7,_0x63f632[_0xe697('0x16')]['message']);return _0x3faf90(_0x63f632[_0xe697('0x16')][_0xe697('0x18')]);}else{logger['info'](_0xe697('0x19'),_0x3d77b7,_0xe697('0x12'));_0x3faf90(_0x63f632[_0xe697('0x1a')][_0xe697('0x18')]);}})[_0xe697('0x1b')](function(_0x17b988){logger[_0xe697('0x16')]('Plugin,\x20%s,\x20%s',_0x3d77b7,_0x17b988);_0x1657d4(_0x17b988);});});}exports['CreatePlugin']=function(_0x43a0e0){var _0xee6087=this;return new Promise(function(_0x3c9472,_0x411c2e){return db['Plugin']['create'](_0x43a0e0['body'],{'raw':_0x43a0e0[_0xe697('0x1c')]?_0x43a0e0[_0xe697('0x1c')][_0xe697('0x1d')]===undefined?!![]:![]:!![]})[_0xe697('0x10')](function(_0x4150d1){logger['info'](_0xe697('0x1e'),_0x43a0e0);logger['debug'](_0xe697('0x1e'),_0x43a0e0,JSON[_0xe697('0x15')](_0x4150d1));_0x3c9472(_0x4150d1);})[_0xe697('0x1b')](function(_0x2f6175){logger['error'](_0xe697('0x1e'),_0x2f6175['message'],_0x43a0e0);_0x411c2e(_0xee6087[_0xe697('0x16')](0x1f4,_0x2f6175['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index c0e2e26..4be984b 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 _0x0158=['emit','removeListener','register','length','plugin:','./plugin.events','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0158,0x155));var _0x8015=function(_0x3d9872,_0x28f80a){_0x3d9872=_0x3d9872-0x0;var _0x48d36c=_0x0158[_0x3d9872];return _0x48d36c;};'use strict';var PluginEvents=require(_0x8015('0x0'));var events=[_0x8015('0x1'),'remove','update'];function createListener(_0x1a98e9,_0x1fe845){return function(_0x1ecbd1){_0x1fe845[_0x8015('0x2')](_0x1a98e9,_0x1ecbd1);};}function removeListener(_0x1b70d9,_0x4e9e53){return function(){PluginEvents[_0x8015('0x3')](_0x1b70d9,_0x4e9e53);};}exports[_0x8015('0x4')]=function(_0x112b1e){for(var _0x21af6a=0x0,_0x4b67a5=events[_0x8015('0x5')];_0x21af6a<_0x4b67a5;_0x21af6a++){var _0x469972=events[_0x21af6a];var _0x296430=createListener(_0x8015('0x6')+_0x469972,_0x112b1e);PluginEvents['on'](_0x469972,_0x296430);}}; \ No newline at end of file +var _0xa11e=['length','plugin:','./plugin.events','save','remove','update','emit','removeListener','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa11e,0x110));var _0xea11=function(_0x5c7fe3,_0x437916){_0x5c7fe3=_0x5c7fe3-0x0;var _0xe29f1e=_0xa11e[_0x5c7fe3];return _0xe29f1e;};'use strict';var PluginEvents=require(_0xea11('0x0'));var events=[_0xea11('0x1'),_0xea11('0x2'),_0xea11('0x3')];function createListener(_0x3f4ce2,_0x171130){return function(_0xa0b7ca){_0x171130[_0xea11('0x4')](_0x3f4ce2,_0xa0b7ca);};}function removeListener(_0x58a6cf,_0xcee3c3){return function(){PluginEvents[_0xea11('0x5')](_0x58a6cf,_0xcee3c3);};}exports[_0xea11('0x6')]=function(_0x3228b4){for(var _0x525b95=0x0,_0x3d62ad=events[_0xea11('0x7')];_0x525b95<_0x3d62ad;_0x525b95++){var _0x4e0099=events[_0x525b95];var _0x44c216=createListener(_0xea11('0x8')+_0x4e0099,_0x3228b4);PluginEvents['on'](_0x4e0099,_0x44c216);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 536ab62..367ebdd 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(_0x2e262f,_0x497433){var _0xac129a=function(_0x214e2c){while(--_0x214e2c){_0x2e262f['push'](_0x2e262f['shift']());}};_0xac129a(++_0x497433);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x2e0a25,_0x2da7a6){var _0x359873=function(_0x47fb4b){while(--_0x47fb4b){_0x2e0a25['push'](_0x2e0a25['shift']());}};_0x359873(++_0x2da7a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 1aed71a..16663ea 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(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x0565,0xf2));var _0x5056=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x0565[_0x342700];return _0x53406f;};'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 _0x8ce3=['length','catch','show','describe','params','then','create','body','script','join','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','api','path','child_process','exec','bluebird','status','json','stack','name','send','npm\x20install','info','error','index','list','reject','express','motion2'];(function(_0x304429,_0x5c956f){var _0x26a77f=function(_0xe50d9d){while(--_0xe50d9d){_0x304429['push'](_0x304429['shift']());}};_0x26a77f(++_0x5c956f);}(_0x8ce3,0xc3));var _0x38ce=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0x8ce3[_0x2c5255];return _0x30d0ea;};'use strict';var _=require(_0x38ce('0x0'));var pm2=require(_0x38ce('0x1'));var logger=require('../../config/logger')(_0x38ce('0x2'));var path=require(_0x38ce('0x3'));var exec=require(_0x38ce('0x4'))[_0x38ce('0x5')];var BPromise=require(_0x38ce('0x6'));function handleEntityNotFound(_0x17b96d,_0x1efae3){return function(_0x381fa0){if(!_0x381fa0){_0x17b96d['sendStatus'](0x194);;}return _0x381fa0;};}function respondWithResult(_0x372f86,_0xb24f4c){_0xb24f4c=_0xb24f4c||0xc8;return function(_0x58074c){if(_0x58074c){return _0x372f86[_0x38ce('0x7')](_0xb24f4c)[_0x38ce('0x8')](_0x58074c);}return null;};}function handleError(_0x3f8011,_0x482955){_0x482955=_0x482955||0x1f4;return function(_0x3c66e5){logger['error'](_0x3c66e5[_0x38ce('0x9')]);if(_0x3c66e5['name']){delete _0x3c66e5[_0x38ce('0xa')];}_0x3f8011[_0x38ce('0x7')](_0x482955)[_0x38ce('0xb')](_0x3c66e5);};}function execChildProcess(){return new BPromise(function(_0x2c0cab,_0x564332){exec(_0x38ce('0xc'),function(_0x2a9045,_0x171a02,_0x29bd3a){logger[_0x38ce('0xd')](_0x171a02);logger[_0x38ce('0xd')](_0x29bd3a);if(_0x2a9045){logger[_0x38ce('0xe')](_0x2a9045);return _0x564332(_0x2a9045);}return _0x2c0cab(_0x171a02);});});}exports[_0x38ce('0xf')]=function(_0x263d6f,_0x2e661b){return pm2[_0x38ce('0x10')]()['then'](function(_0x48ba7c){if(_0x48ba7c){var _0x3c4d7f=_[_0x38ce('0x11')](_0x48ba7c,function(_0x2369f3){return _0x2369f3['name']===_0x38ce('0x12')||_0x2369f3['name']===_0x38ce('0x13');});return{'rows':_0x3c4d7f,'count':_0x3c4d7f[_0x38ce('0x14')]};}return null;})['then'](respondWithResult(_0x2e661b,null))[_0x38ce('0x15')](handleError(_0x2e661b,null));};exports[_0x38ce('0x16')]=function(_0x1dfaba,_0x51f670){return pm2[_0x38ce('0x17')](_0x1dfaba[_0x38ce('0x18')]['id'])[_0x38ce('0x19')](respondWithResult(_0x51f670,null))[_0x38ce('0x19')](handleEntityNotFound(_0x51f670,null))[_0x38ce('0x15')](handleError(_0x51f670,null));};exports[_0x38ce('0x1a')]=function(_0x2d4218,_0x518b04){if(_0x2d4218[_0x38ce('0x1b')][_0x38ce('0xa')]&&_0x2d4218[_0x38ce('0x1b')][_0x38ce('0x1c')]){var _0x30b060=path[_0x38ce('0x1d')](__dirname,_0x38ce('0x1e'),_0x2d4218[_0x38ce('0x1b')][_0x38ce('0x1c')]);var _0x3cf50b=process[_0x38ce('0x1f')]();process['chdir'](path[_0x38ce('0x20')](_0x30b060));return execChildProcess()[_0x38ce('0x19')](function(_0xe40e9c){process[_0x38ce('0x21')](_0x3cf50b);return pm2['start']({'name':_0x2d4218[_0x38ce('0x1b')][_0x38ce('0xa')],'script':_0x30b060});})['then'](function(_0xe0af00){pm2[_0x38ce('0x22')]();return _0xe0af00[0x0];})[_0x38ce('0x19')](respondWithResult(_0x518b04,0xc9))['catch'](handleError(_0x518b04,null));}else{return _0x518b04['status'](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x23')});}};exports[_0x38ce('0x24')]=function(_0x21d4e7,_0x264cf0){if(_0x21d4e7[_0x38ce('0x1b')]['id']){delete _0x21d4e7[_0x38ce('0x1b')]['id'];}var _0xce1f64={'online':_0x38ce('0x25'),'stopped':_0x38ce('0x26')};if(_0xce1f64[_0x38ce('0x27')](_0x21d4e7[_0x38ce('0x1b')]['status'])){return pm2[_0xce1f64[_0x21d4e7[_0x38ce('0x1b')][_0x38ce('0x7')]]](_0x21d4e7['params']['id'])[_0x38ce('0x19')](respondWithResult(_0x264cf0,0xc8))[_0x38ce('0x15')](handleError(_0x264cf0,null));}else{return _0x264cf0['status'](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x28')});}};exports['destroy']=function(_0x28d775,_0x53f2c9){if(_0x28d775[_0x38ce('0x1b')]['id']){delete _0x28d775[_0x38ce('0x1b')]['id'];}if(_0x28d775[_0x38ce('0x18')]['id']){return pm2[_0x38ce('0x29')](_0x28d775[_0x38ce('0x18')]['id'])[_0x38ce('0x19')](function(_0x34262a){pm2[_0x38ce('0x22')]();return _0x34262a[0x0];})['then'](respondWithResult(_0x53f2c9,null))['catch'](handleError(_0x53f2c9,null));}else{return _0x53f2c9[_0x38ce('0x7')](0x1f4)[_0x38ce('0xb')]({'message':_0x38ce('0x2a')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 9a86bc4..7d93f3b 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 _0x5c03=['express','Router','../../components/auth/service','./realtime.controller','get','/agents','getAgents','/queues','isAuthenticated','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5c03,0x10e));var _0x35c0=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x5c03[_0x47a349];return _0x18ab75;};'use strict';var express=require(_0x35c0('0x0'));var router=express[_0x35c0('0x1')]();var auth=require(_0x35c0('0x2'));var controller=require(_0x35c0('0x3'));router[_0x35c0('0x4')](_0x35c0('0x5'),auth['isAuthenticated'](),controller[_0x35c0('0x6')]);router['get'](_0x35c0('0x7'),auth[_0x35c0('0x8')](),controller['getQueues']);module[_0x35c0('0x9')]=router; \ No newline at end of file +var _0x7ffa=['./realtime.controller','/agents','isAuthenticated','/queues','getQueues','exports','Router'];(function(_0x464eb8,_0x294dba){var _0x39f9d3=function(_0x7b84a6){while(--_0x7b84a6){_0x464eb8['push'](_0x464eb8['shift']());}};_0x39f9d3(++_0x294dba);}(_0x7ffa,0x8b));var _0xa7ff=function(_0x1fa06f,_0x4711f8){_0x1fa06f=_0x1fa06f-0x0;var _0x213336=_0x7ffa[_0x1fa06f];return _0x213336;};'use strict';var express=require('express');var router=express[_0xa7ff('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xa7ff('0x1'));router['get'](_0xa7ff('0x2'),auth[_0xa7ff('0x3')](),controller['getAgents']);router['get'](_0xa7ff('0x4'),auth[_0xa7ff('0x3')](),controller[_0xa7ff('0x5')]);module[_0xa7ff('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 6a7d390..77706fb 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 _0x1683=['order','forEach','*pause','Pause','merge','user','online','extraQueryConditions','assign','omit','UserProfile','getResources','findAndCountAll','rows','find','filterAgentAttributes','getAgentStatus','pause','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','map','pick','getQueues','isValidChannel','toLowerCase','Queue','type','outbound','dialMethod','userProfileId','QueueCampaigns','startCase','Queues','name','getRealtimeQueues','initializeQueues','catch','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','resolve','then','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','globalStatus','validateSortParameter','fields','join','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','User','rawAttributes','fieldName','key','role','agent','getOptions','raw','length','push','sequelize','FIELD(id,'];(function(_0x2048c7,_0x4e13d1){var _0x2ac7c3=function(_0x1bc414){while(--_0x1bc414){_0x2048c7['push'](_0x2048c7['shift']());}};_0x2ac7c3(++_0x4e13d1);}(_0x1683,0x81));var _0x3168=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1683[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x3168('0x0'));var rta=require(_0x3168('0x1'));var rtq=require('../../components/realtime/queues');var qs=require(_0x3168('0x2'));var utils=require(_0x3168('0x3'));var db=require(_0x3168('0x4'))['db'];var APIBadRequestError=require(_0x3168('0x5'))[_0x3168('0x6')];var APIHandleError=require(_0x3168('0x5'))['handleError'];function respondWithFilteredResult(_0x47e4fe,_0x5f0185){return function(_0x3664f7){if(_0x3664f7){var _0x2d49f2=typeof _0x5f0185[_0x3168('0x7')]===_0x3168('0x8')&&typeof _0x5f0185[_0x3168('0x9')]===_0x3168('0x8');var _0x148606=_0x3664f7['count'];var _0x48ec80=_0x2d49f2?0x0:_0x5f0185[_0x3168('0x7')];var _0x370b8f=_0x2d49f2?_0x3664f7[_0x3168('0xa')]:_0x5f0185[_0x3168('0x7')]+_0x5f0185[_0x3168('0x9')];var _0x221952;if(_0x370b8f>=_0x148606){_0x370b8f=_0x148606;_0x221952=0xc8;}else{_0x221952=0xce;}_0x47e4fe[_0x3168('0xb')](_0x221952);return _0x47e4fe['set'](_0x3168('0xc'),_0x48ec80+'-'+_0x370b8f+'/'+_0x148606)[_0x3168('0xd')](_0x3664f7);}return null;};}exports[_0x3168('0xe')]=function(_0x3c99d3,_0x1ac095){var _0x133423={'count':0x0,'rows':[]};var _0x256318={};var _0x1acb95;var _0x4fb75c=utils[_0x3168('0xf')]();var _0x49e4e4;var _0x52eb55;var _0x408f37=_0x3c99d3[_0x3168('0x10')][_0x3168('0x11')];var _0x537cfd=_0x3c99d3[_0x3168('0x10')][_0x3168('0x12')];var _0x3fe995=_0x3c99d3[_0x3168('0x10')][_0x3168('0x13')];var _0x2196ae=_0x537cfd==='pause'||_0x537cfd==='*pause'?!![]:![];var _0x1dc1ce=[];var _0x5584e2;var _0x2f44b0;Promise[_0x3168('0x14')]()[_0x3168('0x15')](function(){if(_0x3c99d3[_0x3168('0x10')][_0x3168('0x16')]){if(!utils['isValidChannel'](_0x3c99d3[_0x3168('0x10')][_0x3168('0x16')])){throw new APIBadRequestError(util[_0x3168('0x17')](_0x3168('0x18'),_0x3c99d3['query']['channel']));}_0x1acb95=_0x3c99d3[_0x3168('0x10')][_0x3168('0x16')]['toLowerCase']();}if(!_0x3c99d3[_0x3168('0x10')][_0x3168('0x19')]||!_0x3c99d3[_0x3168('0x10')][_0x3168('0x19')][_0x3168('0x1a')](_0x3168('0x1b'))){_0x3c99d3['query'][_0x3168('0x19')]=rta[_0x3168('0x1c')](_0x3c99d3['query'][_0x3168('0x19')]);return;}var _0x4b7f97=rta['getUpdatedSortOptions'](_0x3c99d3[_0x3168('0x10')]['sort']);_0x3c99d3[_0x3168('0x10')][_0x3168('0x19')]=_0x4b7f97[_0x3168('0x1d')][_0x3168('0x1e')](',');_0x5584e2=_0x4b7f97['order'];})['then'](function(){if(!_0x408f37){return[];}return rta[_0x3168('0x1f')](_0x408f37,_0x1acb95);})['then'](function(_0xdf7a36){_0x1dc1ce=_0xdf7a36;return rta[_0x3168('0x20')]();})[_0x3168('0x15')](function(_0x40619a){_0x52eb55=_0x40619a['rows'];if((!_0x537cfd||_0x2196ae)&&!_0x5584e2){return _0x1dc1ce;}if(_0x5584e2&&!_0x537cfd){return rta[_0x3168('0x21')](_0x52eb55,_0x1dc1ce,_0x5584e2);}else{return rta[_0x3168('0x22')](_0x52eb55,_0x1dc1ce,_0x537cfd);}})['then'](function(_0x4812bf){_0x1dc1ce=_0x4812bf;var _0x13ce5c=![];if(_0x1dc1ce['length']===0x0){if(_0x408f37||_0x537cfd){_0x13ce5c=!![];}if(_0x2196ae){_0x13ce5c=![];}}if(_0x13ce5c){return _0x133423;}var _0x3f76ef=_['map'](db[_0x3168('0x23')][_0x3168('0x24')],function(_0x1551be){return{'name':_0x1551be[_0x3168('0x25')],'type':_0x1551be['type'][_0x3168('0x26')]};});_0x3c99d3[_0x3168('0x10')][_0x3168('0x27')]=_0x3168('0x28');_0x256318=qs[_0x3168('0x29')](_0x3f76ef,_0x3c99d3);_0x256318[_0x3168('0x2a')]=!![];var _0x495b28=[];if(_0x1dc1ce[_0x3168('0x2b')]>0x0){_0x495b28[_0x3168('0x2c')]({'id':{'$in':_0x1dc1ce}});if(_0x5584e2&&!_0x537cfd){_0x2f44b0=[db[_0x3168('0x2d')]['literal'](_0x3168('0x2e')+_0x1dc1ce+')')];_0x256318[_0x3168('0x2f')]=_0x2f44b0;}}if(_0x2196ae){_0x4fb75c[_0x3168('0x30')](function(_0x2423e2){var _0x13df49=!![];if(_0x537cfd===_0x3168('0x31')&&_0x1acb95!==_0x2423e2){_0x13df49=![];}_0x495b28['push']({[_0x2423e2+'Pause']:_0x13df49});});if(_0x3fe995){_0x495b28[_0x3168('0x2c')]({'pauseType':_0x3fe995});}}else if(_0x537cfd){_0x4fb75c[_0x3168('0x30')](function(_0xd15b4e){_0x495b28['push']({[_0xd15b4e+_0x3168('0x32')]:![]});});}_0x256318['where']=_[_0x3168('0x33')](_0x256318['where'],{'$and':_0x495b28});if(_0x3c99d3['user']['role']===_0x3168('0x34')){var _0x1fb49d={'params':{'id':_0x3c99d3[_0x3168('0x34')]['userProfileId']},'query':{'section':'Agents','role':_0x3168('0x28'),'raw':!![],'ids':_0x1dc1ce,'customSorting':_0x2f44b0}};if(_0x3c99d3[_0x3168('0x10')][_0x3168('0x35')]){_0x1fb49d['query']['online']=!![];}if(_0x2196ae){_0x1fb49d[_0x3168('0x10')][_0x3168('0x36')]=_0x495b28;}_0x1fb49d['query']=Object[_0x3168('0x37')](_0x1fb49d[_0x3168('0x10')],_[_0x3168('0x38')](_0x3c99d3['query'],'id'));return db[_0x3168('0x39')][_0x3168('0x3a')](_0x1fb49d);}return db[_0x3168('0x23')][_0x3168('0x3b')](_0x256318);})[_0x3168('0x15')](function(_0x202e9c){_0x133423[_0x3168('0xa')]=_0x202e9c[_0x3168('0xa')];_0x49e4e4=_0x202e9c[_0x3168('0x3c')];return _0x49e4e4['map'](function(_0x11a7aa){var _0x533a8b=_[_0x3168('0x3d')](_0x52eb55,['id',_0x11a7aa['id']]);if(_0x533a8b){var _0x457c12=rta[_0x3168('0x3e')](_0x533a8b);_[_0x3168('0x33')](_0x11a7aa,_0x457c12);}_0x11a7aa['globalStatus']=rta[_0x3168('0x3f')](_0x11a7aa);if(_0x11a7aa[_0x3168('0x1b')][_0x3168('0x1a')](_0x3168('0x40'))){_0x4fb75c[_0x3168('0x30')](function(_0x381898){if(_0x11a7aa[_0x381898+_0x3168('0x32')]){if(_0x381898===_0x3168('0x41')){if(_0x11a7aa[_0x3168('0x42')]!==_0x3168('0x43')){_0x11a7aa['voiceStatus']='pause';}}else{_0x11a7aa[_0x381898+_0x3168('0x44')]='pause';}}});}return _0x11a7aa;});})[_0x3168('0x15')](function(_0x47c2a7){if(!_0x5584e2||_0x2f44b0){return _0x47c2a7;}return rta[_0x3168('0x45')](_0x47c2a7,_0x5584e2);})['then'](function(_0x1adba5){var _0x156a96=rta[_0x3168('0x46')]();_0x133423['rows']=_0x1adba5[_0x3168('0x47')](function(_0x496890){return _[_0x3168('0x48')](_0x496890,_0x156a96);});return _0x133423;})[_0x3168('0x15')](respondWithFilteredResult(_0x1ac095,_0x256318))['catch'](APIHandleError(_0x1ac095));};exports[_0x3168('0x49')]=function(_0x5a0961,_0x3f1a6e){var _0x5e4afc={'count':0x0,'rows':[]};var _0x571a20={};var _0x38dc85;var _0x35794a;var _0x238675;Promise[_0x3168('0x14')]()['then'](function(){if(_0x5a0961[_0x3168('0x10')][_0x3168('0x16')]){if(!utils[_0x3168('0x4a')](_0x5a0961[_0x3168('0x10')][_0x3168('0x16')])){throw new APIBadRequestError(util['format'](_0x3168('0x18'),_0x5a0961[_0x3168('0x10')][_0x3168('0x16')]));}_0x38dc85=_0x5a0961['query']['channel'][_0x3168('0x4b')]();}var _0x257a85=_['startCase'](_0x38dc85)+_0x3168('0x4c');var _0x580192=_[_0x3168('0x47')](db[_0x257a85][_0x3168('0x24')],function(_0x3cb734){return{'name':_0x3cb734['fieldName'],'type':_0x3cb734[_0x3168('0x4d')][_0x3168('0x26')]};});if(!_0x5a0961[_0x3168('0x10')][_0x3168('0x1d')]){var _0x391dc1=['id','name'];if(_0x38dc85===_0x3168('0x41')){_0x391dc1[_0x3168('0x2c')](_0x3168('0x4d'));if(_0x5a0961[_0x3168('0x10')][_0x3168('0x4d')]===_0x3168('0x4e')){_0x391dc1['push'](['dialActive',_0x3168('0x4f')]);}}_0x5a0961[_0x3168('0x10')][_0x3168('0x1d')]=_0x391dc1[_0x3168('0x1e')](',');}_0x571a20=qs[_0x3168('0x29')](_0x580192,_0x5a0961);if(_0x5a0961[_0x3168('0x34')][_0x3168('0x27')]==='user'){var _0x20b3aa={'params':{'id':_0x5a0961['user'][_0x3168('0x50')]},'query':{'section':_0x38dc85===_0x3168('0x41')&&_0x5a0961[_0x3168('0x10')][_0x3168('0x4d')]==='outbound'?_0x3168('0x51'):_[_0x3168('0x52')](_0x38dc85)+_0x3168('0x53'),'type':_0x5a0961[_0x3168('0x10')][_0x3168('0x4d')],'nolimit':!![],'sort':_0x3168('0x54'),'filter':_0x5a0961[_0x3168('0x10')]['filter']}};_0x20b3aa[_0x3168('0x10')]=Object[_0x3168('0x37')](_0x20b3aa['query'],_0x5a0961['query']);delete _0x20b3aa[_0x3168('0x10')]['id'];return db[_0x3168('0x39')][_0x3168('0x3a')](_0x20b3aa);}return db[_0x257a85][_0x3168('0x3b')](_0x571a20);})[_0x3168('0x15')](function(_0x1ccba6){_0x5e4afc[_0x3168('0xa')]=_0x1ccba6[_0x3168('0xa')];_0x35794a=_0x1ccba6[_0x3168('0x3c')];return rtq[_0x3168('0x55')](_0x5a0961,_0x38dc85);})[_0x3168('0x15')](function(_0x6eb177){_0x238675=_0x6eb177[_0x3168('0x3c')];return rtq[_0x3168('0x56')](_0x35794a,_0x238675,_0x38dc85,_0x5a0961[_0x3168('0x10')]['type']);})['then'](function(_0x38b748){_0x5e4afc[_0x3168('0x3c')]=_0x38b748;return _0x5e4afc;})[_0x3168('0x15')](respondWithFilteredResult(_0x3f1a6e,_0x571a20))[_0x3168('0x57')](APIHandleError(_0x3f1a6e));}; \ No newline at end of file +var _0xa9f3=['user','userProfileId','Agents','agent','online','extraQueryConditions','assign','omit','UserProfile','getResources','User','findAndCountAll','rows','map','find','filterAgentAttributes','getAgentStatus','includes','voice','pause','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','startCase','key','outbound','dialActive','dialMethod','QueueCampaigns','Queues','name','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','../../errors/api','handleError','undefined','count','offset','limit','status','set','Content-Range','json','getAgents','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','*pause','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','order','getRealtimeAgents','length','rawAttributes','fieldName','type','role','getOptions','push','sequelize','literal','forEach','Pause','where','merge'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa9f3,0x1d3));var _0x3a9f=function(_0x3edd69,_0x333a26){_0x3edd69=_0x3edd69-0x0;var _0x1b19f4=_0xa9f3[_0x3edd69];return _0x1b19f4;};'use strict';var _=require(_0x3a9f('0x0'));var util=require(_0x3a9f('0x1'));var rta=require(_0x3a9f('0x2'));var rtq=require(_0x3a9f('0x3'));var qs=require(_0x3a9f('0x4'));var utils=require('../../config/utils');var db=require(_0x3a9f('0x5'))['db'];var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APIHandleError=require(_0x3a9f('0x6'))[_0x3a9f('0x7')];function respondWithFilteredResult(_0x23a18e,_0x4d441e){return function(_0x55b681){if(_0x55b681){var _0x310108=typeof _0x4d441e['offset']===_0x3a9f('0x8')&&typeof _0x4d441e['limit']===_0x3a9f('0x8');var _0x29b39e=_0x55b681[_0x3a9f('0x9')];var _0x5477b1=_0x310108?0x0:_0x4d441e[_0x3a9f('0xa')];var _0x4b5b26=_0x310108?_0x55b681[_0x3a9f('0x9')]:_0x4d441e[_0x3a9f('0xa')]+_0x4d441e[_0x3a9f('0xb')];var _0x25b6b1;if(_0x4b5b26>=_0x29b39e){_0x4b5b26=_0x29b39e;_0x25b6b1=0xc8;}else{_0x25b6b1=0xce;}_0x23a18e[_0x3a9f('0xc')](_0x25b6b1);return _0x23a18e[_0x3a9f('0xd')](_0x3a9f('0xe'),_0x5477b1+'-'+_0x4b5b26+'/'+_0x29b39e)[_0x3a9f('0xf')](_0x55b681);}return null;};}exports[_0x3a9f('0x10')]=function(_0x4f0ec0,_0x2b1511){var _0x14acfd={'count':0x0,'rows':[]};var _0x1d26a7={};var _0x4176fe;var _0x5e758a=utils[_0x3a9f('0x11')]();var _0x5b3660;var _0x3faed4;var _0x3a40f2=_0x4f0ec0['query'][_0x3a9f('0x12')];var _0x546be2=_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x14')];var _0x1b23be=_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x15')];var _0x427437=_0x546be2==='pause'||_0x546be2===_0x3a9f('0x16')?!![]:![];var _0x13881c=[];var _0x344044;var _0x4ee741;Promise['resolve']()[_0x3a9f('0x17')](function(){if(_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x18')]){if(!utils[_0x3a9f('0x19')](_0x4f0ec0['query'][_0x3a9f('0x18')])){throw new APIBadRequestError(util[_0x3a9f('0x1a')](_0x3a9f('0x1b'),_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x18')]));}_0x4176fe=_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x18')][_0x3a9f('0x1c')]();}if(!_0x4f0ec0['query'][_0x3a9f('0x1d')]||!_0x4f0ec0['query']['sort']['includes'](_0x3a9f('0x1e'))){_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x1d')]=rta[_0x3a9f('0x1f')](_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x1d')]);return;}var _0x422ecd=rta[_0x3a9f('0x20')](_0x4f0ec0['query'][_0x3a9f('0x1d')]);_0x4f0ec0[_0x3a9f('0x13')][_0x3a9f('0x1d')]=_0x422ecd[_0x3a9f('0x21')]['join'](',');_0x344044=_0x422ecd[_0x3a9f('0x22')];})[_0x3a9f('0x17')](function(){if(!_0x3a40f2){return[];}return rta['getAgentIdsByQueues'](_0x3a40f2,_0x4176fe);})['then'](function(_0x544e0d){_0x13881c=_0x544e0d;return rta[_0x3a9f('0x23')]();})['then'](function(_0x1dc8a0){_0x3faed4=_0x1dc8a0['rows'];if((!_0x546be2||_0x427437)&&!_0x344044){return _0x13881c;}if(_0x344044&&!_0x546be2){return rta['getSortedAgentsIdsByStatus'](_0x3faed4,_0x13881c,_0x344044);}else{return rta['getAgentIdsByStatus'](_0x3faed4,_0x13881c,_0x546be2);}})[_0x3a9f('0x17')](function(_0x132c25){_0x13881c=_0x132c25;var _0x5950f8=![];if(_0x13881c[_0x3a9f('0x24')]===0x0){if(_0x3a40f2||_0x546be2){_0x5950f8=!![];}if(_0x427437){_0x5950f8=![];}}if(_0x5950f8){return _0x14acfd;}var _0x23e1a7=_['map'](db['User'][_0x3a9f('0x25')],function(_0x595b13){return{'name':_0x595b13[_0x3a9f('0x26')],'type':_0x595b13[_0x3a9f('0x27')]['key']};});_0x4f0ec0['query'][_0x3a9f('0x28')]='agent';_0x1d26a7=qs[_0x3a9f('0x29')](_0x23e1a7,_0x4f0ec0);_0x1d26a7['raw']=!![];var _0x5a4f28=[];if(_0x13881c[_0x3a9f('0x24')]>0x0){_0x5a4f28[_0x3a9f('0x2a')]({'id':{'$in':_0x13881c}});if(_0x344044&&!_0x546be2){_0x4ee741=[db[_0x3a9f('0x2b')][_0x3a9f('0x2c')]('FIELD(id,'+_0x13881c+')')];_0x1d26a7[_0x3a9f('0x22')]=_0x4ee741;}}if(_0x427437){_0x5e758a[_0x3a9f('0x2d')](function(_0x1e983f){var _0x1863e0=!![];if(_0x546be2===_0x3a9f('0x16')&&_0x4176fe!==_0x1e983f){_0x1863e0=![];}_0x5a4f28[_0x3a9f('0x2a')]({[_0x1e983f+_0x3a9f('0x2e')]:_0x1863e0});});if(_0x1b23be){_0x5a4f28[_0x3a9f('0x2a')]({'pauseType':_0x1b23be});}}else if(_0x546be2){_0x5e758a['forEach'](function(_0x40319a){_0x5a4f28[_0x3a9f('0x2a')]({[_0x40319a+_0x3a9f('0x2e')]:![]});});}_0x1d26a7[_0x3a9f('0x2f')]=_[_0x3a9f('0x30')](_0x1d26a7[_0x3a9f('0x2f')],{'$and':_0x5a4f28});if(_0x4f0ec0['user']['role']===_0x3a9f('0x31')){var _0x8559a7={'params':{'id':_0x4f0ec0[_0x3a9f('0x31')][_0x3a9f('0x32')]},'query':{'section':_0x3a9f('0x33'),'role':_0x3a9f('0x34'),'raw':!![],'ids':_0x13881c,'customSorting':_0x4ee741}};if(_0x4f0ec0['query'][_0x3a9f('0x35')]){_0x8559a7[_0x3a9f('0x13')][_0x3a9f('0x35')]=!![];}if(_0x427437){_0x8559a7['query'][_0x3a9f('0x36')]=_0x5a4f28;}_0x8559a7[_0x3a9f('0x13')]=Object[_0x3a9f('0x37')](_0x8559a7[_0x3a9f('0x13')],_[_0x3a9f('0x38')](_0x4f0ec0[_0x3a9f('0x13')],'id'));return db[_0x3a9f('0x39')][_0x3a9f('0x3a')](_0x8559a7);}return db[_0x3a9f('0x3b')][_0x3a9f('0x3c')](_0x1d26a7);})['then'](function(_0x205f31){_0x14acfd[_0x3a9f('0x9')]=_0x205f31[_0x3a9f('0x9')];_0x5b3660=_0x205f31[_0x3a9f('0x3d')];return _0x5b3660[_0x3a9f('0x3e')](function(_0x5d2e32){var _0x117f1f=_[_0x3a9f('0x3f')](_0x3faed4,['id',_0x5d2e32['id']]);if(_0x117f1f){var _0x199966=rta[_0x3a9f('0x40')](_0x117f1f);_['merge'](_0x5d2e32,_0x199966);}_0x5d2e32[_0x3a9f('0x1e')]=rta[_0x3a9f('0x41')](_0x5d2e32);if(_0x5d2e32['globalStatus'][_0x3a9f('0x42')]('pause')){_0x5e758a[_0x3a9f('0x2d')](function(_0x78bca1){if(_0x5d2e32[_0x78bca1+'Pause']){if(_0x78bca1===_0x3a9f('0x43')){if(_0x5d2e32['voiceStatus']!=='talking'){_0x5d2e32['voiceStatus']=_0x3a9f('0x44');}}else{_0x5d2e32[_0x78bca1+_0x3a9f('0x45')]=_0x3a9f('0x44');}}});}return _0x5d2e32;});})[_0x3a9f('0x17')](function(_0x1cadfe){if(!_0x344044||_0x4ee741){return _0x1cadfe;}return rta[_0x3a9f('0x46')](_0x1cadfe,_0x344044);})[_0x3a9f('0x17')](function(_0x154f8d){var _0x12402d=rta[_0x3a9f('0x47')]();_0x14acfd['rows']=_0x154f8d[_0x3a9f('0x3e')](function(_0x43fa49){return _[_0x3a9f('0x48')](_0x43fa49,_0x12402d);});return _0x14acfd;})[_0x3a9f('0x17')](respondWithFilteredResult(_0x2b1511,_0x1d26a7))[_0x3a9f('0x49')](APIHandleError(_0x2b1511));};exports[_0x3a9f('0x4a')]=function(_0x58304e,_0x1fddb0){var _0x1a684a={'count':0x0,'rows':[]};var _0x443eb1={};var _0x5ee654;var _0x268067;var _0x23209c;Promise['resolve']()[_0x3a9f('0x17')](function(){if(_0x58304e[_0x3a9f('0x13')][_0x3a9f('0x18')]){if(!utils[_0x3a9f('0x19')](_0x58304e[_0x3a9f('0x13')]['channel'])){throw new APIBadRequestError(util[_0x3a9f('0x1a')](_0x3a9f('0x1b'),_0x58304e[_0x3a9f('0x13')][_0x3a9f('0x18')]));}_0x5ee654=_0x58304e[_0x3a9f('0x13')]['channel'][_0x3a9f('0x1c')]();}var _0x55ae84=_[_0x3a9f('0x4b')](_0x5ee654)+'Queue';var _0x8a86ec=_[_0x3a9f('0x3e')](db[_0x55ae84]['rawAttributes'],function(_0x3d0dd5){return{'name':_0x3d0dd5[_0x3a9f('0x26')],'type':_0x3d0dd5[_0x3a9f('0x27')][_0x3a9f('0x4c')]};});if(!_0x58304e[_0x3a9f('0x13')]['fields']){var _0x1bec59=['id','name'];if(_0x5ee654===_0x3a9f('0x43')){_0x1bec59['push'](_0x3a9f('0x27'));if(_0x58304e['query'][_0x3a9f('0x27')]===_0x3a9f('0x4d')){_0x1bec59[_0x3a9f('0x2a')]([_0x3a9f('0x4e'),_0x3a9f('0x4f')]);}}_0x58304e[_0x3a9f('0x13')]['fields']=_0x1bec59['join'](',');}_0x443eb1=qs['getOptions'](_0x8a86ec,_0x58304e);if(_0x58304e[_0x3a9f('0x31')][_0x3a9f('0x28')]===_0x3a9f('0x31')){var _0x21ca0f={'params':{'id':_0x58304e[_0x3a9f('0x31')][_0x3a9f('0x32')]},'query':{'section':_0x5ee654===_0x3a9f('0x43')&&_0x58304e[_0x3a9f('0x13')]['type']===_0x3a9f('0x4d')?_0x3a9f('0x50'):_['startCase'](_0x5ee654)+_0x3a9f('0x51'),'type':_0x58304e[_0x3a9f('0x13')][_0x3a9f('0x27')],'nolimit':!![],'sort':_0x3a9f('0x52'),'filter':_0x58304e[_0x3a9f('0x13')][_0x3a9f('0x53')]}};_0x21ca0f[_0x3a9f('0x13')]=Object[_0x3a9f('0x37')](_0x21ca0f[_0x3a9f('0x13')],_0x58304e['query']);delete _0x21ca0f['query']['id'];return db['UserProfile'][_0x3a9f('0x3a')](_0x21ca0f);}return db[_0x55ae84][_0x3a9f('0x3c')](_0x443eb1);})[_0x3a9f('0x17')](function(_0x5cb2db){_0x1a684a[_0x3a9f('0x9')]=_0x5cb2db[_0x3a9f('0x9')];_0x268067=_0x5cb2db[_0x3a9f('0x3d')];return rtq[_0x3a9f('0x54')](_0x58304e,_0x5ee654);})[_0x3a9f('0x17')](function(_0x2e5f9d){_0x23209c=_0x2e5f9d[_0x3a9f('0x3d')];return rtq[_0x3a9f('0x55')](_0x268067,_0x23209c,_0x5ee654,_0x58304e[_0x3a9f('0x13')]['type']);})[_0x3a9f('0x17')](function(_0x412fe0){_0x1a684a['rows']=_0x412fe0;return _0x1a684a;})['then'](respondWithFilteredResult(_0x1fddb0,_0x443eb1))[_0x3a9f('0x49')](APIHandleError(_0x1fddb0));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 9a5a75d..fc66836 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1f0fa6,_0x267e0b){var _0x457cb7=function(_0x548ce9){while(--_0x548ce9){_0x1f0fa6['push'](_0x1f0fa6['shift']());}};_0x457cb7(++_0x267e0b);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xa1f5c4,_0x247496){var _0x3f2f74=function(_0x3dae53){while(--_0x3dae53){_0xa1f5c4['push'](_0xa1f5c4['shift']());}};_0x3f2f74(++_0x247496);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index fd40a58..32f2be5 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 _0xc1c6=['DATE','STRING','sequelize','exports','INTEGER'];(function(_0x61b81f,_0x56878d){var _0x87a3d2=function(_0x265de9){while(--_0x265de9){_0x61b81f['push'](_0x61b81f['shift']());}};_0x87a3d2(++_0x56878d);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4d6dd0,_0x462567){_0x4d6dd0=_0x4d6dd0-0x0;var _0x1fb742=_0xc1c6[_0x4d6dd0];return _0x1fb742;};'use strict';var Sequelize=require(_0x6c1c('0x0'));module[_0x6c1c('0x1')]={'state':{'type':Sequelize[_0x6c1c('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x6c1c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6c1c('0x3')]},'responsetime':{'type':Sequelize[_0x6c1c('0x3')]},'ringtime':{'type':Sequelize[_0x6c1c('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6c1c('0x4')]}}; \ No newline at end of file +var _0x869e=['INTEGER','DATE','STRING','sequelize','exports'];(function(_0xed3008,_0x24ec19){var _0xa84e62=function(_0x3356f2){while(--_0x3356f2){_0xed3008['push'](_0xed3008['shift']());}};_0xa84e62(++_0x24ec19);}(_0x869e,0x15c));var _0xe869=function(_0x1ecf91,_0x3f6399){_0x1ecf91=_0x1ecf91-0x0;var _0x103dd8=_0x869e[_0x1ecf91];return _0x103dd8;};'use strict';var Sequelize=require(_0xe869('0x0'));module[_0xe869('0x1')]={'state':{'type':Sequelize[_0xe869('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xe869('0x3')]},'uniqueid':{'type':Sequelize[_0xe869('0x4')]},'starttime':{'type':Sequelize[_0xe869('0x3')]},'responsetime':{'type':Sequelize[_0xe869('0x3')]},'ringtime':{'type':Sequelize[_0xe869('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xe869('0x4')]},'membername':{'type':Sequelize[_0xe869('0x4')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 86b82f6..a244201 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 _0x268a=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x525335,_0x35fe4e){var _0x29c6af=function(_0x31c4c3){while(--_0x31c4c3){_0x525335['push'](_0x525335['shift']());}};_0x29c6af(++_0x35fe4e);}(_0x268a,0x171));var _0xa268=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0x268a[_0x3ec1da];return _0x472358;};'use strict';var _=require(_0xa268('0x0'));var util=require('util');var logger=require(_0xa268('0x1'))(_0xa268('0x2'));var moment=require(_0xa268('0x3'));var BPromise=require(_0xa268('0x4'));var rp=require(_0xa268('0x5'));var fs=require('fs');var path=require(_0xa268('0x6'));var rimraf=require(_0xa268('0x7'));var config=require(_0xa268('0x8'));var attributes=require(_0xa268('0x9'));module[_0xa268('0xa')]=function(_0x1a1c81,_0x88f69e){return _0x1a1c81[_0xa268('0xb')](_0xa268('0xc'),attributes,{'tableName':_0xa268('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d70=['./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0xd34b55,_0x217d27){var _0x26162f=function(_0x3d3a32){while(--_0x3d3a32){_0xd34b55['push'](_0xd34b55['shift']());}};_0x26162f(++_0x217d27);}(_0x8d70,0x17a));var _0x08d7=function(_0x27f94a,_0x350916){_0x27f94a=_0x27f94a-0x0;var _0x34876a=_0x8d70[_0x27f94a];return _0x34876a;};'use strict';var _=require(_0x08d7('0x0'));var util=require(_0x08d7('0x1'));var logger=require(_0x08d7('0x2'))(_0x08d7('0x3'));var moment=require(_0x08d7('0x4'));var BPromise=require('bluebird');var rp=require(_0x08d7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x08d7('0x6'));var attributes=require(_0x08d7('0x7'));module[_0x08d7('0x8')]=function(_0x3fb307,_0x350b36){return _0x3fb307[_0x08d7('0x9')]('ReportAgentPreview',attributes,{'tableName':_0x08d7('0xa'),'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 659cc16..576bc8c 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 _0x2749=['info','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateReportAgentPreview','create','raw','then'];(function(_0x236f82,_0x38df0c){var _0x16720c=function(_0x33fd48){while(--_0x33fd48){_0x236f82['push'](_0x236f82['shift']());}};_0x16720c(++_0x38df0c);}(_0x2749,0x6e));var _0x9274=function(_0x4b86f1,_0x2dc384){_0x4b86f1=_0x4b86f1-0x0;var _0x399e75=_0x2749[_0x4b86f1];return _0x399e75;};'use strict';var _=require(_0x9274('0x0'));var util=require(_0x9274('0x1'));var moment=require(_0x9274('0x2'));var BPromise=require(_0x9274('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9274('0x4'));var db=require(_0x9274('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9274('0x6'))(_0x9274('0x7'));var config=require('../../config/environment');var jayson=require(_0x9274('0x8'));var client=jayson[_0x9274('0x9')][_0x9274('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f9ae7,_0x1ea8c3,_0xb662f){return new BPromise(function(_0x29700c,_0x28bf23){return client[_0x9274('0xb')](_0x4f9ae7,_0xb662f)['then'](function(_0x5d960b){logger['info'](_0x9274('0xc'),_0x1ea8c3,_0x9274('0xd'));logger[_0x9274('0xe')](_0x9274('0xf'),_0x1ea8c3,'request\x20sent',JSON['stringify'](_0x5d960b));if(_0x5d960b[_0x9274('0x10')]){if(_0x5d960b[_0x9274('0x10')][_0x9274('0x11')]===0x1f4){logger[_0x9274('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x1ea8c3,_0x5d960b['error'][_0x9274('0x12')]);return _0x28bf23(_0x5d960b[_0x9274('0x10')][_0x9274('0x12')]);}logger[_0x9274('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x1ea8c3,_0x5d960b[_0x9274('0x10')]['message']);return _0x29700c(_0x5d960b['error'][_0x9274('0x12')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x1ea8c3,'request\x20sent');_0x29700c(_0x5d960b[_0x9274('0x13')][_0x9274('0x12')]);}})[_0x9274('0x14')](function(_0x2b3d06){logger[_0x9274('0x10')](_0x9274('0xc'),_0x1ea8c3,_0x2b3d06);_0x28bf23(_0x2b3d06);});});}exports[_0x9274('0x15')]=function(_0x149276){var _0x2d431e=this;return new Promise(function(_0x29e853,_0x1a8377){return db['ReportAgentPreview'][_0x9274('0x16')](_0x149276['body'],{'raw':_0x149276['options']?_0x149276['options'][_0x9274('0x17')]===undefined?!![]:![]:!![]})[_0x9274('0x18')](function(_0x3897d4){logger[_0x9274('0x19')](_0x9274('0x15'),_0x149276);logger[_0x9274('0xe')]('CreateReportAgentPreview',_0x149276,JSON[_0x9274('0x1a')](_0x3897d4));_0x29e853(_0x3897d4);})[_0x9274('0x14')](function(_0x6e6415){logger['error']('CreateReportAgentPreview',_0x6e6415[_0x9274('0x12')],_0x149276);_0x1a8377(_0x2d431e['error'](0x1f4,_0x6e6415['message']));});});}; \ No newline at end of file +var _0x3597=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','message','result','catch','ReportAgentPreview','create','options','CreateReportAgentPreview','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0x3597,0x91));var _0x7359=function(_0x31cd4a,_0x23eac9){_0x31cd4a=_0x31cd4a-0x0;var _0x57eb73=_0x3597[_0x31cd4a];return _0x57eb73;};'use strict';var _=require(_0x7359('0x0'));var util=require('util');var moment=require(_0x7359('0x1'));var BPromise=require(_0x7359('0x2'));var rs=require(_0x7359('0x3'));var fs=require('fs');var Redis=require(_0x7359('0x4'));var db=require(_0x7359('0x5'))['db'];var utils=require(_0x7359('0x6'));var logger=require(_0x7359('0x7'))('rpc');var config=require(_0x7359('0x8'));var jayson=require(_0x7359('0x9'));var client=jayson[_0x7359('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b9b20,_0x5143ae,_0x435848){return new BPromise(function(_0x3e4f4e,_0xc03e3){return client[_0x7359('0xb')](_0x1b9b20,_0x435848)[_0x7359('0xc')](function(_0x5830ee){logger[_0x7359('0xd')](_0x7359('0xe'),_0x5143ae,_0x7359('0xf'));logger[_0x7359('0x10')](_0x7359('0x11'),_0x5143ae,_0x7359('0xf'),JSON['stringify'](_0x5830ee));if(_0x5830ee['error']){if(_0x5830ee[_0x7359('0x12')]['code']===0x1f4){logger[_0x7359('0x12')](_0x7359('0xe'),_0x5143ae,_0x5830ee[_0x7359('0x12')][_0x7359('0x13')]);return _0xc03e3(_0x5830ee[_0x7359('0x12')][_0x7359('0x13')]);}logger['error'](_0x7359('0xe'),_0x5143ae,_0x5830ee[_0x7359('0x12')][_0x7359('0x13')]);return _0x3e4f4e(_0x5830ee['error'][_0x7359('0x13')]);}else{logger[_0x7359('0xd')](_0x7359('0xe'),_0x5143ae,_0x7359('0xf'));_0x3e4f4e(_0x5830ee[_0x7359('0x14')][_0x7359('0x13')]);}})[_0x7359('0x15')](function(_0x410fa2){logger[_0x7359('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x5143ae,_0x410fa2);_0xc03e3(_0x410fa2);});});}exports['CreateReportAgentPreview']=function(_0x5cb20c){var _0x536fca=this;return new Promise(function(_0xa269ee,_0x4b81ed){return db[_0x7359('0x16')][_0x7359('0x17')](_0x5cb20c['body'],{'raw':_0x5cb20c['options']?_0x5cb20c[_0x7359('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x7359('0xc')](function(_0x119cf9){logger[_0x7359('0xd')](_0x7359('0x19'),_0x5cb20c);logger[_0x7359('0x10')](_0x7359('0x19'),_0x5cb20c,JSON[_0x7359('0x1a')](_0x119cf9));_0xa269ee(_0x119cf9);})[_0x7359('0x15')](function(_0x8a804a){logger[_0x7359('0x12')](_0x7359('0x19'),_0x8a804a['message'],_0x5cb20c);_0x4b81ed(_0x536fca[_0x7359('0x12')](0x1f4,_0x8a804a[_0x7359('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 2a43968..b15dc54 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 _0x92d6=['isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','mailQueues','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','/telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','post','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels'];(function(_0x582f8b,_0x27e0d6){var _0x46cfcc=function(_0x47ea87){while(--_0x47ea87){_0x582f8b['push'](_0x582f8b['shift']());}};_0x46cfcc(++_0x27e0d6);}(_0x92d6,0x14b));var _0x692d=function(_0x273699,_0x34dcf6){_0x273699=_0x273699-0x0;var _0x4625c5=_0x92d6[_0x273699];return _0x4625c5;};'use strict';var multer=require(_0x692d('0x0'));var util=require(_0x692d('0x1'));var path=require(_0x692d('0x2'));var express=require(_0x692d('0x3'));var router=express[_0x692d('0x4')]();var auth=require(_0x692d('0x5'));var controller=require(_0x692d('0x6'));router[_0x692d('0x7')](_0x692d('0x8'),auth[_0x692d('0x9')](),controller[_0x692d('0xa')]);router[_0x692d('0x7')](_0x692d('0xb'),auth['isAuthenticated'](),controller[_0x692d('0xc')]);router[_0x692d('0x7')](_0x692d('0xd'),auth[_0x692d('0x9')](),controller[_0x692d('0xe')]);router[_0x692d('0x7')](_0x692d('0xf'),auth[_0x692d('0x9')](),controller['voiceQueues']);router['get'](_0x692d('0x10'),auth[_0x692d('0x9')](),controller[_0x692d('0x11')]);router['get']('/mail/queues',auth[_0x692d('0x9')](),controller[_0x692d('0x12')]);router['get']('/mail/accounts',auth[_0x692d('0x9')](),controller[_0x692d('0x13')]);router[_0x692d('0x7')]('/openchannel/queues',auth[_0x692d('0x9')](),controller[_0x692d('0x14')]);router[_0x692d('0x7')](_0x692d('0x15'),auth['isAuthenticated'](),controller[_0x692d('0x16')]);router[_0x692d('0x7')]('/whatsapp/queues',auth[_0x692d('0x9')](),controller['whatsappQueues']);router[_0x692d('0x7')](_0x692d('0x17'),auth['isAuthenticated'](),controller['faxQueues']);router[_0x692d('0x7')](_0x692d('0x18'),auth[_0x692d('0x9')](),controller[_0x692d('0x19')]);router[_0x692d('0x7')](_0x692d('0x1a'),auth[_0x692d('0x9')](),controller[_0x692d('0x1b')]);router[_0x692d('0x7')](_0x692d('0x1c'),auth[_0x692d('0x9')](),controller[_0x692d('0x1d')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x692d('0x1e')]);router[_0x692d('0x7')](_0x692d('0x1f'),auth[_0x692d('0x9')](),controller[_0x692d('0x20')]);router[_0x692d('0x7')](_0x692d('0x21'),auth['isAuthenticated'](),controller[_0x692d('0x22')]);router[_0x692d('0x23')](_0x692d('0x21'),auth[_0x692d('0x9')](),controller[_0x692d('0x24')]);router['get'](_0x692d('0x25'),auth[_0x692d('0x9')](),controller[_0x692d('0x26')]);router['get'](_0x692d('0x27'),auth['isAuthenticated'](),controller[_0x692d('0x28')]);router[_0x692d('0x7')](_0x692d('0x29'),auth[_0x692d('0x9')](),controller[_0x692d('0x2a')]);router[_0x692d('0x23')](_0x692d('0x2b'),auth[_0x692d('0x9')](),controller['agentCapacity']);router['get'](_0x692d('0x2c'),auth['isAuthenticated'](),controller['telephones']);router[_0x692d('0x7')]('/trunks',auth['isAuthenticated'](),controller[_0x692d('0x2d')]);router['get'](_0x692d('0x2e'),auth[_0x692d('0x9')](),controller[_0x692d('0x2f')]);router[_0x692d('0x7')](_0x692d('0x30'),auth[_0x692d('0x9')](),controller[_0x692d('0x31')]);router['get'](_0x692d('0x32'),auth[_0x692d('0x9')](),controller['chatQueuesWaitingInteractions']);router['get'](_0x692d('0x33'),auth[_0x692d('0x9')](),controller[_0x692d('0x34')]);router['get'](_0x692d('0x35'),auth[_0x692d('0x9')](),controller[_0x692d('0x36')]);router[_0x692d('0x7')](_0x692d('0x37'),auth[_0x692d('0x9')](),controller[_0x692d('0x38')]);router[_0x692d('0x7')](_0x692d('0x39'),auth[_0x692d('0x9')](),controller[_0x692d('0x3a')]);router[_0x692d('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0x692d('0x9')](),controller[_0x692d('0x3b')]);router[_0x692d('0x7')]('/fax/queues/waitinginteractions',auth[_0x692d('0x9')](),controller[_0x692d('0x3c')]);router['post'](_0x692d('0x3d'),auth['isAuthenticated'](),controller[_0x692d('0x3e')](_0x692d('0x3f')));router[_0x692d('0x7')](_0x692d('0x40'),auth['isAuthenticated'](),controller[_0x692d('0x41')]);router['post'](_0x692d('0x42'),auth[_0x692d('0x9')](),controller[_0x692d('0x3e')](_0x692d('0x43')));router[_0x692d('0x7')](_0x692d('0x44'),auth[_0x692d('0x9')](),controller[_0x692d('0x45')]);router['post'](_0x692d('0x46'),auth['isAuthenticated'](),controller[_0x692d('0x3e')](_0x692d('0x47')));router[_0x692d('0x7')]('/fax/queues/:id',auth[_0x692d('0x9')](),controller[_0x692d('0x48')]);router[_0x692d('0x49')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x692d('0x3e')](_0x692d('0x4a')));router[_0x692d('0x7')](_0x692d('0x4b'),auth[_0x692d('0x9')](),controller[_0x692d('0x4c')]);router[_0x692d('0x49')](_0x692d('0x4d'),auth[_0x692d('0x9')](),controller[_0x692d('0x3e')](_0x692d('0x4e')));router[_0x692d('0x49')](_0x692d('0x4f'),auth[_0x692d('0x9')](),controller[_0x692d('0x3e')]('whatsapp'));router[_0x692d('0x7')](_0x692d('0x50'),auth[_0x692d('0x9')](),controller[_0x692d('0x51')]);router[_0x692d('0x7')](_0x692d('0x52'),auth['isAuthenticated'](),controller[_0x692d('0x53')]);router[_0x692d('0x49')](_0x692d('0x54'),auth[_0x692d('0x9')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x6231=['/agents','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','agentNotify','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels'];(function(_0x1566fc,_0x3e42cc){var _0x578288=function(_0x1dd98e){while(--_0x1dd98e){_0x1566fc['push'](_0x1566fc['shift']());}};_0x578288(++_0x3e42cc);}(_0x6231,0x113));var _0x1623=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6231[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1623('0x0'));var express=require(_0x1623('0x1'));var router=express[_0x1623('0x2')]();var auth=require(_0x1623('0x3'));var controller=require(_0x1623('0x4'));router[_0x1623('0x5')]('/voice/channels',auth[_0x1623('0x6')](),controller[_0x1623('0x7')]);router[_0x1623('0x5')](_0x1623('0x8'),auth['isAuthenticated'](),controller[_0x1623('0x9')]);router['get'](_0x1623('0xa'),auth[_0x1623('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0x1623('0x5')](_0x1623('0xb'),auth[_0x1623('0x6')](),controller[_0x1623('0xc')]);router[_0x1623('0x5')](_0x1623('0xd'),auth[_0x1623('0x6')](),controller['chatQueues']);router['get'](_0x1623('0xe'),auth[_0x1623('0x6')](),controller[_0x1623('0xf')]);router[_0x1623('0x5')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x1623('0x10')]);router[_0x1623('0x5')](_0x1623('0x11'),auth['isAuthenticated'](),controller[_0x1623('0x12')]);router[_0x1623('0x5')]('/sms/queues',auth['isAuthenticated'](),controller[_0x1623('0x13')]);router[_0x1623('0x5')]('/whatsapp/queues',auth[_0x1623('0x6')](),controller[_0x1623('0x14')]);router[_0x1623('0x5')](_0x1623('0x15'),auth[_0x1623('0x6')](),controller[_0x1623('0x16')]);router['get'](_0x1623('0x17'),auth[_0x1623('0x6')](),controller['voiceQueuesPreview']);router[_0x1623('0x5')](_0x1623('0x18'),auth['isAuthenticated'](),controller[_0x1623('0x19')]);router[_0x1623('0x5')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x1623('0x1a')]);router[_0x1623('0x5')](_0x1623('0x1b'),auth[_0x1623('0x6')](),controller[_0x1623('0x1c')]);router[_0x1623('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x1623('0x6')](),controller[_0x1623('0x1d')]);router[_0x1623('0x5')](_0x1623('0x1e'),auth[_0x1623('0x6')](),controller[_0x1623('0x1f')]);router[_0x1623('0x20')](_0x1623('0x1e'),auth[_0x1623('0x6')](),controller[_0x1623('0x21')]);router['get'](_0x1623('0x22'),auth[_0x1623('0x6')](),controller['outbound']);router[_0x1623('0x5')](_0x1623('0x23'),auth[_0x1623('0x6')](),controller[_0x1623('0x24')]);router[_0x1623('0x5')](_0x1623('0x25'),auth[_0x1623('0x6')](),controller['agents']);router[_0x1623('0x20')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x1623('0x26')]);router[_0x1623('0x5')]('/telephones',auth[_0x1623('0x6')](),controller[_0x1623('0x27')]);router[_0x1623('0x5')](_0x1623('0x28'),auth[_0x1623('0x6')](),controller[_0x1623('0x29')]);router[_0x1623('0x5')](_0x1623('0x2a'),auth['isAuthenticated'](),controller[_0x1623('0x2b')]);router[_0x1623('0x5')]('/fax/accounts',auth['isAuthenticated'](),controller['faxAccounts']);router[_0x1623('0x5')](_0x1623('0x2c'),auth[_0x1623('0x6')](),controller[_0x1623('0x2d')]);router[_0x1623('0x5')](_0x1623('0x2e'),auth[_0x1623('0x6')](),controller[_0x1623('0x2f')]);router[_0x1623('0x5')](_0x1623('0x30'),auth[_0x1623('0x6')](),controller[_0x1623('0x31')]);router['get'](_0x1623('0x32'),auth['isAuthenticated'](),controller[_0x1623('0x33')]);router[_0x1623('0x5')](_0x1623('0x34'),auth['isAuthenticated'](),controller[_0x1623('0x35')]);router[_0x1623('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0x1623('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0x1623('0x5')](_0x1623('0x36'),auth[_0x1623('0x6')](),controller[_0x1623('0x37')]);router['post'](_0x1623('0x38'),auth[_0x1623('0x6')](),controller[_0x1623('0x39')](_0x1623('0x3a')));router[_0x1623('0x5')](_0x1623('0x3b'),auth[_0x1623('0x6')](),controller[_0x1623('0x3c')]);router[_0x1623('0x3d')](_0x1623('0x3e'),auth[_0x1623('0x6')](),controller[_0x1623('0x39')](_0x1623('0x3f')));router['get'](_0x1623('0x40'),auth[_0x1623('0x6')](),controller['showChatQueues']);router[_0x1623('0x3d')]('/fax/queues/:id/notify',auth[_0x1623('0x6')](),controller['queueNotify'](_0x1623('0x41')));router[_0x1623('0x5')](_0x1623('0x42'),auth[_0x1623('0x6')](),controller['showFaxQueues']);router[_0x1623('0x3d')](_0x1623('0x43'),auth[_0x1623('0x6')](),controller[_0x1623('0x39')](_0x1623('0x44')));router[_0x1623('0x5')](_0x1623('0x45'),auth['isAuthenticated'](),controller[_0x1623('0x46')]);router['post']('/sms/queues/:id/notify',auth[_0x1623('0x6')](),controller['queueNotify'](_0x1623('0x47')));router[_0x1623('0x3d')](_0x1623('0x48'),auth['isAuthenticated'](),controller[_0x1623('0x39')](_0x1623('0x49')));router['get'](_0x1623('0x4a'),auth['isAuthenticated'](),controller[_0x1623('0x4b')]);router[_0x1623('0x5')]('/whatsapp/queues/:id',auth[_0x1623('0x6')](),controller[_0x1623('0x4c')]);router[_0x1623('0x3d')]('/agents/:id/notify',auth[_0x1623('0x6')](),controller[_0x1623('0x4d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 6b1287d..5c04af0 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 _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0xe56773,_0x4be7df){var _0x40edbe=function(_0x4f2306){while(--_0x4f2306){_0xe56773['push'](_0xe56773['shift']());}};_0x40edbe(++_0x4be7df);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x137cc2,_0x13978e){var _0x3c9820=function(_0x55016d){while(--_0x55016d){_0x137cc2['push'](_0x137cc2['shift']());}};_0x3c9820(++_0x13978e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3bddcc9..c146969 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 _0xa328=['create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','isAuthenticated','index','get','/:id','/:id/run','run','post'];(function(_0x6c735d,_0x4e819e){var _0x246f43=function(_0x1787e1){while(--_0x1787e1){_0x6c735d['push'](_0x6c735d['shift']());}};_0x246f43(++_0x4e819e);}(_0xa328,0x108));var _0x8a32=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0xa328[_0x2d1971];return _0x4d7759;};'use strict';var multer=require(_0x8a32('0x0'));var util=require(_0x8a32('0x1'));var path=require('path');var timeout=require(_0x8a32('0x2'));var express=require(_0x8a32('0x3'));var router=express[_0x8a32('0x4')]();var fs_extra=require(_0x8a32('0x5'));var auth=require(_0x8a32('0x6'));var interaction=require(_0x8a32('0x7'));var config=require('../../config/environment');var controller=require(_0x8a32('0x8'));router['get']('/',auth[_0x8a32('0x9')](),controller[_0x8a32('0xa')]);router[_0x8a32('0xb')](_0x8a32('0xc'),auth[_0x8a32('0x9')](),controller['show']);router['get'](_0x8a32('0xd'),auth[_0x8a32('0x9')](),controller[_0x8a32('0xe')]);router[_0x8a32('0xf')]('/',auth['isAuthenticated'](),controller[_0x8a32('0x10')]);router[_0x8a32('0x11')](_0x8a32('0xc'),auth[_0x8a32('0x9')](),controller['update']);router['delete'](_0x8a32('0xc'),auth[_0x8a32('0x9')](),controller[_0x8a32('0x12')]);module[_0x8a32('0x13')]=router; \ No newline at end of file +var _0x7cc7=['get','index','/:id/run','isAuthenticated','create','put','update','delete','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xaf788c,_0x14eabb){var _0x128727=function(_0x526780){while(--_0x526780){_0xaf788c['push'](_0xaf788c['shift']());}};_0x128727(++_0x14eabb);}(_0x7cc7,0x1e5));var _0x77cc=function(_0x11e79b,_0x42c500){_0x11e79b=_0x11e79b-0x0;var _0x7cb31b=_0x7cc7[_0x11e79b];return _0x7cb31b;};'use strict';var multer=require('multer');var util=require(_0x77cc('0x0'));var path=require(_0x77cc('0x1'));var timeout=require(_0x77cc('0x2'));var express=require(_0x77cc('0x3'));var router=express[_0x77cc('0x4')]();var fs_extra=require(_0x77cc('0x5'));var auth=require(_0x77cc('0x6'));var interaction=require(_0x77cc('0x7'));var config=require(_0x77cc('0x8'));var controller=require('./schedule.controller');router[_0x77cc('0x9')]('/',auth['isAuthenticated'](),controller[_0x77cc('0xa')]);router[_0x77cc('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x77cc('0xb'),auth['isAuthenticated'](),controller['run']);router['post']('/',auth[_0x77cc('0xc')](),controller[_0x77cc('0xd')]);router[_0x77cc('0xe')]('/:id',auth[_0x77cc('0xc')](),controller[_0x77cc('0xf')]);router[_0x77cc('0x10')](_0x77cc('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x77cc('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e001591..53866b1 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 _0x22ec=['custom','default','TEXT','sequelize','STRING','BOOLEAN','DATE','ENUM','years','quarters','weeks','days','hours','minutes','csv','xlsx'];(function(_0x36e518,_0x14ad30){var _0x444725=function(_0xa3a442){while(--_0xa3a442){_0x36e518['push'](_0x36e518['shift']());}};_0x444725(++_0x14ad30);}(_0x22ec,0x193));var _0xc22e=function(_0x5e44ba,_0x23ee70){_0x5e44ba=_0x5e44ba-0x0;var _0x55c91f=_0x22ec[_0x5e44ba];return _0x55c91f;};'use strict';var Sequelize=require(_0xc22e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xc22e('0x1')]},'active':{'type':Sequelize[_0xc22e('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc22e('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xc22e('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc22e('0x4')](_0xc22e('0x5'),_0xc22e('0x6'),'months',_0xc22e('0x7'),_0xc22e('0x8'),_0xc22e('0x9'),_0xc22e('0xa')),'allowNull':![],'defaultValue':_0xc22e('0x8')},'output':{'type':Sequelize[_0xc22e('0x4')](_0xc22e('0xb'),'pdf',_0xc22e('0xc')),'allowNull':![],'defaultValue':_0xc22e('0xb')},'type':{'type':Sequelize[_0xc22e('0x4')](_0xc22e('0xd'),_0xc22e('0xe')),'allowNull':![],'defaultValue':_0xc22e('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xc22e('0xf')]},'bcc':{'type':Sequelize[_0xc22e('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xc22e('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8ace=['months','weeks','days','minutes','ENUM','csv','pdf','custom','BOOLEAN','TEXT','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','quarters'];(function(_0x281015,_0xead8eb){var _0xfcbe5c=function(_0x2c8662){while(--_0x2c8662){_0x281015['push'](_0x281015['shift']());}};_0xfcbe5c(++_0xead8eb);}(_0x8ace,0x1ca));var _0xe8ac=function(_0x47bbd5,_0xfab6bc){_0x47bbd5=_0x47bbd5-0x0;var _0xea2a13=_0x8ace[_0x47bbd5];return _0xea2a13;};'use strict';var Sequelize=require('sequelize');module[_0xe8ac('0x0')]={'name':{'type':Sequelize[_0xe8ac('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe8ac('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe8ac('0x2')},'startAt':{'type':Sequelize[_0xe8ac('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xe8ac('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe8ac('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xe8ac('0x5'),_0xe8ac('0x6'),_0xe8ac('0x7'),_0xe8ac('0x8'),'hours',_0xe8ac('0x9')),'allowNull':![],'defaultValue':_0xe8ac('0x8')},'output':{'type':Sequelize[_0xe8ac('0xa')](_0xe8ac('0xb'),_0xe8ac('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0xe8ac('0xb')},'type':{'type':Sequelize['ENUM'](_0xe8ac('0xd'),'default'),'allowNull':![],'defaultValue':_0xe8ac('0xd')},'sendMail':{'type':Sequelize[_0xe8ac('0xe')],'defaultValue':![]},'email':{'type':Sequelize[_0xe8ac('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xe8ac('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xe8ac('0xe')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index caf5835..3c81ed2 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 _0x40a1=['eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','merge','where','VIRTUAL','includeAll','include','Schedule','findAll','rows','show','rawAttributes','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','run'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0x40a1,0x158));var _0x140a=function(_0x460d04,_0x2210e5){_0x460d04=_0x460d04-0x0;var _0x144806=_0x40a1[_0x460d04];return _0x144806;};'use strict';var emlformat=require(_0x140a('0x0'));var rimraf=require(_0x140a('0x1'));var zipdir=require(_0x140a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x140a('0x3'));var moment=require('moment');var BPromise=require(_0x140a('0x4'));var Mustache=require(_0x140a('0x5'));var util=require(_0x140a('0x6'));var path=require(_0x140a('0x7'));var sox=require('sox');var csv=require(_0x140a('0x8'));var ejs=require(_0x140a('0x9'));var fs=require('fs');var fs_extra=require(_0x140a('0xa'));var _=require(_0x140a('0xb'));var squel=require(_0x140a('0xc'));var crypto=require(_0x140a('0xd'));var jsforce=require(_0x140a('0xe'));var deskjs=require(_0x140a('0xf'));var toCsv=require(_0x140a('0x8'));var querystring=require(_0x140a('0x10'));var Papa=require(_0x140a('0x11'));var Redis=require(_0x140a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x140a('0x13'));var as=require(_0x140a('0x14'));var hardwareService=require(_0x140a('0x15'));var logger=require(_0x140a('0x16'))(_0x140a('0x17'));var utils=require(_0x140a('0x18'));var config=require(_0x140a('0x19'));var licenseUtil=require(_0x140a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x252456,_0x23617d){_0x23617d=_0x23617d||0xcc;return function(_0x2bd17a){if(_0x2bd17a){return _0x252456[_0x140a('0x1b')](_0x23617d);}return _0x252456[_0x140a('0x1c')](_0x23617d)[_0x140a('0x1d')]();};}function respondWithResult(_0x22ef50,_0x7bb051){_0x7bb051=_0x7bb051||0xc8;return function(_0x3033eb){if(_0x3033eb){return _0x22ef50[_0x140a('0x1c')](_0x7bb051)[_0x140a('0x1e')](_0x3033eb);}};}function respondWithFilteredResult(_0x4b2050,_0x33ba83){return function(_0xf2a076){if(_0xf2a076){var _0x4edad1=typeof _0x33ba83[_0x140a('0x1f')]==='undefined'&&typeof _0x33ba83['limit']===_0x140a('0x20');var _0x4ed74a=_0xf2a076[_0x140a('0x21')];var _0x22e8ca=_0x4edad1?0x0:_0x33ba83[_0x140a('0x1f')];var _0x7a23d7=_0x4edad1?_0xf2a076['count']:_0x33ba83[_0x140a('0x1f')]+_0x33ba83['limit'];var _0x2abfc9;if(_0x7a23d7>=_0x4ed74a){_0x7a23d7=_0x4ed74a;_0x2abfc9=0xc8;}else{_0x2abfc9=0xce;}_0x4b2050[_0x140a('0x1c')](_0x2abfc9);return _0x4b2050[_0x140a('0x22')](_0x140a('0x23'),_0x22e8ca+'-'+_0x7a23d7+'/'+_0x4ed74a)[_0x140a('0x1e')](_0xf2a076);}return null;};}function patchUpdates(_0x127f81){return function(_0x48a76b){try{jsonpatch[_0x140a('0x24')](_0x48a76b,_0x127f81,!![]);}catch(_0x16a8e8){return BPromise[_0x140a('0x25')](_0x16a8e8);}return _0x48a76b['save']();};}function saveUpdates(_0x28cea4,_0x745a4a){return function(_0x7aeb7){if(_0x7aeb7){return _0x7aeb7[_0x140a('0x26')](_0x28cea4)[_0x140a('0x27')](function(_0x3242e3){return _0x3242e3;});}return null;};}function removeEntity(_0x40da75,_0x11242d){return function(_0x1a0fa2){if(_0x1a0fa2){return _0x1a0fa2[_0x140a('0x28')]()[_0x140a('0x27')](function(){var _0x26b295=_0x1a0fa2[_0x140a('0x29')]({'plain':!![]});var _0x31e2b7=_0x140a('0x2a');return db[_0x140a('0x2b')][_0x140a('0x28')]({'where':{'type':_0x31e2b7,'resourceId':_0x26b295['id']}})[_0x140a('0x27')](function(){return _0x1a0fa2;});})[_0x140a('0x27')](function(){_0x40da75['status'](0xcc)[_0x140a('0x1d')]();});}};}function handleEntityNotFound(_0x43bcc8,_0x261452){return function(_0x56cebf){if(!_0x56cebf){_0x43bcc8[_0x140a('0x1b')](0x194);}return _0x56cebf;};}function handleError(_0xb29488,_0x556f1f){_0x556f1f=_0x556f1f||0x1f4;return function(_0x29e3a1){logger[_0x140a('0x2c')](_0x29e3a1['stack']);if(_0x29e3a1[_0x140a('0x2d')]){delete _0x29e3a1[_0x140a('0x2d')];}_0xb29488[_0x140a('0x1c')](_0x556f1f)['send'](_0x29e3a1);};}exports[_0x140a('0x2e')]=function(_0x39a54b,_0x3a2095){var _0x57d3f9={},_0x49a8c1={},_0x1fe785={'count':0x0,'rows':[]};var _0x15ff61=_[_0x140a('0x2f')](db['Schedule']['rawAttributes'],function(_0x5bf0b0){return{'name':_0x5bf0b0[_0x140a('0x30')],'type':_0x5bf0b0[_0x140a('0x31')][_0x140a('0x32')]};});_0x49a8c1[_0x140a('0x33')]=_[_0x140a('0x2f')](_0x15ff61,_0x140a('0x2d'));_0x49a8c1['query']=_['keys'](_0x39a54b[_0x140a('0x34')]);_0x49a8c1[_0x140a('0x35')]=_[_0x140a('0x36')](_0x49a8c1['model'],_0x49a8c1['query']);_0x57d3f9[_0x140a('0x37')]=_[_0x140a('0x36')](_0x49a8c1[_0x140a('0x33')],qs[_0x140a('0x38')](_0x39a54b['query']['fields']));_0x57d3f9['attributes']=_0x57d3f9[_0x140a('0x37')][_0x140a('0x39')]?_0x57d3f9['attributes']:_0x49a8c1[_0x140a('0x33')];if(!_0x39a54b['query'][_0x140a('0x3a')](_0x140a('0x3b'))){_0x57d3f9[_0x140a('0x3c')]=qs[_0x140a('0x3c')](_0x39a54b[_0x140a('0x34')][_0x140a('0x3c')]);_0x57d3f9['offset']=qs[_0x140a('0x1f')](_0x39a54b[_0x140a('0x34')][_0x140a('0x1f')]);}_0x57d3f9['order']=qs[_0x140a('0x3d')](_0x39a54b[_0x140a('0x34')][_0x140a('0x3d')]);_0x57d3f9['where']=qs[_0x140a('0x35')](_[_0x140a('0x3e')](_0x39a54b['query'],_0x49a8c1[_0x140a('0x35')]),_0x15ff61);if(_0x39a54b[_0x140a('0x34')]['filter']){_0x57d3f9['where']=_[_0x140a('0x3f')](_0x57d3f9[_0x140a('0x40')],{'$or':_['map'](_0x15ff61,function(_0x1324d5){if(_0x1324d5['type']!==_0x140a('0x41')){var _0x26f07e={};_0x26f07e[_0x1324d5[_0x140a('0x2d')]]={'$like':'%'+_0x39a54b[_0x140a('0x34')]['filter']+'%'};return _0x26f07e;}})});}_0x57d3f9=_[_0x140a('0x3f')]({},_0x57d3f9,_0x39a54b['options']);var _0x4e5a5e={'where':_0x57d3f9[_0x140a('0x40')]};return db['Schedule'][_0x140a('0x21')](_0x4e5a5e)[_0x140a('0x27')](function(_0x1c3d56){_0x1fe785['count']=_0x1c3d56;if(_0x39a54b[_0x140a('0x34')][_0x140a('0x42')]){_0x57d3f9[_0x140a('0x43')]=[{'all':!![]}];}return db[_0x140a('0x44')][_0x140a('0x45')](_0x57d3f9);})[_0x140a('0x27')](function(_0x2d55ad){_0x1fe785[_0x140a('0x46')]=_0x2d55ad;return _0x1fe785;})[_0x140a('0x27')](respondWithFilteredResult(_0x3a2095,_0x57d3f9))['catch'](handleError(_0x3a2095,null));};exports[_0x140a('0x47')]=function(_0x248773,_0x5babfc){var _0x9d766a={'raw':![],'where':{'id':_0x248773['params']['id']}},_0x31f8c7={};_0x31f8c7[_0x140a('0x33')]=_['keys'](db[_0x140a('0x44')][_0x140a('0x48')]);_0x31f8c7['query']=_[_0x140a('0x49')](_0x248773[_0x140a('0x34')]);_0x31f8c7[_0x140a('0x35')]=_[_0x140a('0x36')](_0x31f8c7[_0x140a('0x33')],_0x31f8c7['query']);_0x9d766a[_0x140a('0x37')]=_['intersection'](_0x31f8c7[_0x140a('0x33')],qs[_0x140a('0x38')](_0x248773[_0x140a('0x34')][_0x140a('0x38')]));_0x9d766a[_0x140a('0x37')]=_0x9d766a[_0x140a('0x37')][_0x140a('0x39')]?_0x9d766a[_0x140a('0x37')]:_0x31f8c7[_0x140a('0x33')];if(_0x248773[_0x140a('0x34')][_0x140a('0x42')]){_0x9d766a[_0x140a('0x43')]=[{'all':!![]}];}_0x9d766a=_[_0x140a('0x3f')]({},_0x9d766a,_0x248773['options']);return db[_0x140a('0x44')][_0x140a('0x4a')](_0x9d766a)[_0x140a('0x27')](handleEntityNotFound(_0x5babfc,null))[_0x140a('0x27')](respondWithResult(_0x5babfc,null))['catch'](handleError(_0x5babfc,null));};exports[_0x140a('0x4b')]=function(_0x20de48,_0x18cfca){return db['Schedule'][_0x140a('0x4b')](_0x20de48['body'],{})[_0x140a('0x27')](function(_0x5f2dc7){var _0x3ab1d4=_0x20de48['user'][_0x140a('0x29')]({'plain':!![]});if(!_0x3ab1d4)throw new Error(_0x140a('0x4c'));if(_0x3ab1d4[_0x140a('0x4d')]===_0x140a('0x4e')){var _0x40693c=_0x5f2dc7[_0x140a('0x29')]({'plain':!![]});var _0x1bf892=_0x140a('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x1bf892,'userProfileId':_0x3ab1d4[_0x140a('0x4f')]},'raw':!![]})['then'](function(_0x1cff4d){if(_0x1cff4d&&_0x1cff4d[_0x140a('0x50')]===0x0){return db['UserProfileResource'][_0x140a('0x4b')]({'name':_0x40693c[_0x140a('0x2d')],'resourceId':_0x40693c['id'],'type':_0x1cff4d[_0x140a('0x2d')],'sectionId':_0x1cff4d['id']},{})[_0x140a('0x27')](function(){return _0x5f2dc7;});}else{return _0x5f2dc7;}})[_0x140a('0x51')](function(_0x17a207){logger['error'](_0x140a('0x52'),_0x17a207);throw _0x17a207;});}return _0x5f2dc7;})[_0x140a('0x27')](respondWithResult(_0x18cfca,0xc9))[_0x140a('0x51')](handleError(_0x18cfca,null));};exports[_0x140a('0x26')]=function(_0x20ad2c,_0x269f1d){if(_0x20ad2c['body']['id']){delete _0x20ad2c['body']['id'];}return db['Schedule'][_0x140a('0x4a')]({'where':{'id':_0x20ad2c['params']['id']}})['then'](handleEntityNotFound(_0x269f1d,null))[_0x140a('0x27')](saveUpdates(_0x20ad2c[_0x140a('0x53')],null))[_0x140a('0x27')](respondWithResult(_0x269f1d,null))[_0x140a('0x51')](handleError(_0x269f1d,null));};exports['destroy']=function(_0xac9210,_0x4b9737){return db[_0x140a('0x44')][_0x140a('0x4a')]({'where':{'id':_0xac9210[_0x140a('0x54')]['id']}})[_0x140a('0x27')](handleEntityNotFound(_0x4b9737,null))[_0x140a('0x27')](removeEntity(_0x4b9737,null))['catch'](handleError(_0x4b9737,null));};exports['run']=function(_0x330b49,_0x467d08,_0x3a1fe){var _0x33c6ec=require('../../config/schedule');return db[_0x140a('0x44')][_0x140a('0x4a')]({'where':{'id':_0x330b49['params']['id']},'raw':!![]})[_0x140a('0x27')](handleEntityNotFound(_0x467d08,null))[_0x140a('0x27')](function(){_0x33c6ec[_0x140a('0x55')](_0x330b49[_0x140a('0x54')]['id']);})[_0x140a('0x27')](respondWithStatusCode(_0x467d08,null))['catch'](handleError(_0x467d08,null));}; \ No newline at end of file +var _0xf140=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','then','get','Scheduler','stack','name','send','index','Schedule','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xf140,0x1e1));var _0x0f14=function(_0x3b1648,_0x4504c0){_0x3b1648=_0x3b1648-0x0;var _0x44225e=_0xf140[_0x3b1648];return _0x44225e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f14('0x0'));var zipdir=require(_0x0f14('0x1'));var jsonpatch=require(_0x0f14('0x2'));var rp=require(_0x0f14('0x3'));var moment=require(_0x0f14('0x4'));var BPromise=require(_0x0f14('0x5'));var Mustache=require(_0x0f14('0x6'));var util=require(_0x0f14('0x7'));var path=require(_0x0f14('0x8'));var sox=require('sox');var csv=require(_0x0f14('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0f14('0xa'));var squel=require(_0x0f14('0xb'));var crypto=require('crypto');var jsforce=require(_0x0f14('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0f14('0x9'));var querystring=require(_0x0f14('0xd'));var Papa=require(_0x0f14('0xe'));var Redis=require(_0x0f14('0xf'));var authService=require(_0x0f14('0x10'));var qs=require(_0x0f14('0x11'));var as=require(_0x0f14('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f14('0x13'))(_0x0f14('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0f14('0x15'));var db=require(_0x0f14('0x16'))['db'];function respondWithStatusCode(_0x1aa93b,_0x14b77c){_0x14b77c=_0x14b77c||0xcc;return function(_0x4950a4){if(_0x4950a4){return _0x1aa93b[_0x0f14('0x17')](_0x14b77c);}return _0x1aa93b[_0x0f14('0x18')](_0x14b77c)[_0x0f14('0x19')]();};}function respondWithResult(_0x6407e3,_0x5c5f0e){_0x5c5f0e=_0x5c5f0e||0xc8;return function(_0x313f98){if(_0x313f98){return _0x6407e3[_0x0f14('0x18')](_0x5c5f0e)[_0x0f14('0x1a')](_0x313f98);}};}function respondWithFilteredResult(_0x4dc59b,_0x419639){return function(_0x3326e3){if(_0x3326e3){var _0x107c9d=typeof _0x419639[_0x0f14('0x1b')]===_0x0f14('0x1c')&&typeof _0x419639['limit']===_0x0f14('0x1c');var _0x568c54=_0x3326e3[_0x0f14('0x1d')];var _0x576e95=_0x107c9d?0x0:_0x419639[_0x0f14('0x1b')];var _0x1571c9=_0x107c9d?_0x3326e3['count']:_0x419639[_0x0f14('0x1b')]+_0x419639[_0x0f14('0x1e')];var _0x3768f5;if(_0x1571c9>=_0x568c54){_0x1571c9=_0x568c54;_0x3768f5=0xc8;}else{_0x3768f5=0xce;}_0x4dc59b[_0x0f14('0x18')](_0x3768f5);return _0x4dc59b[_0x0f14('0x1f')](_0x0f14('0x20'),_0x576e95+'-'+_0x1571c9+'/'+_0x568c54)[_0x0f14('0x1a')](_0x3326e3);}return null;};}function patchUpdates(_0x409adc){return function(_0xfa0d64){try{jsonpatch['apply'](_0xfa0d64,_0x409adc,!![]);}catch(_0x4fc16c){return BPromise[_0x0f14('0x21')](_0x4fc16c);}return _0xfa0d64[_0x0f14('0x22')]();};}function saveUpdates(_0x250397,_0x2f0066){return function(_0x58c38f){if(_0x58c38f){return _0x58c38f['update'](_0x250397)['then'](function(_0x588adc){return _0x588adc;});}return null;};}function removeEntity(_0x2c6f2d,_0x2da4fc){return function(_0x5806d7){if(_0x5806d7){return _0x5806d7[_0x0f14('0x23')]()[_0x0f14('0x24')](function(){var _0x4479eb=_0x5806d7[_0x0f14('0x25')]({'plain':!![]});var _0x1f2402=_0x0f14('0x26');return db['UserProfileResource'][_0x0f14('0x23')]({'where':{'type':_0x1f2402,'resourceId':_0x4479eb['id']}})[_0x0f14('0x24')](function(){return _0x5806d7;});})[_0x0f14('0x24')](function(){_0x2c6f2d[_0x0f14('0x18')](0xcc)[_0x0f14('0x19')]();});}};}function handleEntityNotFound(_0x24232b,_0x5033a7){return function(_0x4d2cbc){if(!_0x4d2cbc){_0x24232b[_0x0f14('0x17')](0x194);}return _0x4d2cbc;};}function handleError(_0x298434,_0x3af539){_0x3af539=_0x3af539||0x1f4;return function(_0x69fe32){logger['error'](_0x69fe32[_0x0f14('0x27')]);if(_0x69fe32[_0x0f14('0x28')]){delete _0x69fe32[_0x0f14('0x28')];}_0x298434[_0x0f14('0x18')](_0x3af539)[_0x0f14('0x29')](_0x69fe32);};}exports[_0x0f14('0x2a')]=function(_0x24b104,_0xc47819){var _0x141156={},_0x53c962={},_0x6948d6={'count':0x0,'rows':[]};var _0x3c9d94=_['map'](db[_0x0f14('0x2b')][_0x0f14('0x2c')],function(_0x5cf61e){return{'name':_0x5cf61e[_0x0f14('0x2d')],'type':_0x5cf61e['type'][_0x0f14('0x2e')]};});_0x53c962[_0x0f14('0x2f')]=_[_0x0f14('0x30')](_0x3c9d94,'name');_0x53c962[_0x0f14('0x31')]=_[_0x0f14('0x32')](_0x24b104[_0x0f14('0x31')]);_0x53c962['filters']=_[_0x0f14('0x33')](_0x53c962[_0x0f14('0x2f')],_0x53c962['query']);_0x141156['attributes']=_[_0x0f14('0x33')](_0x53c962[_0x0f14('0x2f')],qs[_0x0f14('0x34')](_0x24b104['query'][_0x0f14('0x34')]));_0x141156['attributes']=_0x141156[_0x0f14('0x35')][_0x0f14('0x36')]?_0x141156['attributes']:_0x53c962[_0x0f14('0x2f')];if(!_0x24b104['query'][_0x0f14('0x37')](_0x0f14('0x38'))){_0x141156['limit']=qs[_0x0f14('0x1e')](_0x24b104[_0x0f14('0x31')]['limit']);_0x141156[_0x0f14('0x1b')]=qs[_0x0f14('0x1b')](_0x24b104[_0x0f14('0x31')][_0x0f14('0x1b')]);}_0x141156['order']=qs[_0x0f14('0x39')](_0x24b104[_0x0f14('0x31')]['sort']);_0x141156['where']=qs[_0x0f14('0x3a')](_[_0x0f14('0x3b')](_0x24b104[_0x0f14('0x31')],_0x53c962[_0x0f14('0x3a')]),_0x3c9d94);if(_0x24b104['query'][_0x0f14('0x3c')]){_0x141156[_0x0f14('0x3d')]=_['merge'](_0x141156[_0x0f14('0x3d')],{'$or':_[_0x0f14('0x30')](_0x3c9d94,function(_0x6a0306){if(_0x6a0306[_0x0f14('0x3e')]!==_0x0f14('0x3f')){var _0x22709b={};_0x22709b[_0x6a0306[_0x0f14('0x28')]]={'$like':'%'+_0x24b104[_0x0f14('0x31')][_0x0f14('0x3c')]+'%'};return _0x22709b;}})});}_0x141156=_[_0x0f14('0x40')]({},_0x141156,_0x24b104[_0x0f14('0x41')]);var _0x359b67={'where':_0x141156['where']};return db[_0x0f14('0x2b')]['count'](_0x359b67)[_0x0f14('0x24')](function(_0x14a254){_0x6948d6[_0x0f14('0x1d')]=_0x14a254;if(_0x24b104[_0x0f14('0x31')][_0x0f14('0x42')]){_0x141156[_0x0f14('0x43')]=[{'all':!![]}];}return db[_0x0f14('0x2b')][_0x0f14('0x44')](_0x141156);})[_0x0f14('0x24')](function(_0x5313f0){_0x6948d6[_0x0f14('0x45')]=_0x5313f0;return _0x6948d6;})[_0x0f14('0x24')](respondWithFilteredResult(_0xc47819,_0x141156))[_0x0f14('0x46')](handleError(_0xc47819,null));};exports[_0x0f14('0x47')]=function(_0xd2d476,_0x578c1a){var _0x55bf4e={'raw':![],'where':{'id':_0xd2d476[_0x0f14('0x48')]['id']}},_0x4a880a={};_0x4a880a['model']=_[_0x0f14('0x32')](db[_0x0f14('0x2b')][_0x0f14('0x2c')]);_0x4a880a['query']=_[_0x0f14('0x32')](_0xd2d476[_0x0f14('0x31')]);_0x4a880a[_0x0f14('0x3a')]=_[_0x0f14('0x33')](_0x4a880a[_0x0f14('0x2f')],_0x4a880a[_0x0f14('0x31')]);_0x55bf4e[_0x0f14('0x35')]=_[_0x0f14('0x33')](_0x4a880a[_0x0f14('0x2f')],qs[_0x0f14('0x34')](_0xd2d476[_0x0f14('0x31')][_0x0f14('0x34')]));_0x55bf4e['attributes']=_0x55bf4e[_0x0f14('0x35')]['length']?_0x55bf4e[_0x0f14('0x35')]:_0x4a880a[_0x0f14('0x2f')];if(_0xd2d476[_0x0f14('0x31')]['includeAll']){_0x55bf4e[_0x0f14('0x43')]=[{'all':!![]}];}_0x55bf4e=_['merge']({},_0x55bf4e,_0xd2d476['options']);return db[_0x0f14('0x2b')][_0x0f14('0x49')](_0x55bf4e)[_0x0f14('0x24')](handleEntityNotFound(_0x578c1a,null))[_0x0f14('0x24')](respondWithResult(_0x578c1a,null))[_0x0f14('0x46')](handleError(_0x578c1a,null));};exports[_0x0f14('0x4a')]=function(_0x46c154,_0x17f421){return db[_0x0f14('0x2b')][_0x0f14('0x4a')](_0x46c154[_0x0f14('0x4b')],{})[_0x0f14('0x24')](function(_0x5bc8ba){var _0x1c05e5=_0x46c154[_0x0f14('0x4c')]['get']({'plain':!![]});if(!_0x1c05e5)throw new Error(_0x0f14('0x4d'));if(_0x1c05e5[_0x0f14('0x4e')]===_0x0f14('0x4c')){var _0x2a7a9c=_0x5bc8ba[_0x0f14('0x25')]({'plain':!![]});var _0x10a87b=_0x0f14('0x26');return db['UserProfileSection'][_0x0f14('0x49')]({'where':{'name':_0x10a87b,'userProfileId':_0x1c05e5[_0x0f14('0x4f')]},'raw':!![]})[_0x0f14('0x24')](function(_0x5d39de){if(_0x5d39de&&_0x5d39de[_0x0f14('0x50')]===0x0){return db['UserProfileResource'][_0x0f14('0x4a')]({'name':_0x2a7a9c[_0x0f14('0x28')],'resourceId':_0x2a7a9c['id'],'type':_0x5d39de[_0x0f14('0x28')],'sectionId':_0x5d39de['id']},{})[_0x0f14('0x24')](function(){return _0x5bc8ba;});}else{return _0x5bc8ba;}})[_0x0f14('0x46')](function(_0x501309){logger['error'](_0x0f14('0x51'),_0x501309);throw _0x501309;});}return _0x5bc8ba;})[_0x0f14('0x24')](respondWithResult(_0x17f421,0xc9))[_0x0f14('0x46')](handleError(_0x17f421,null));};exports[_0x0f14('0x52')]=function(_0x67aa95,_0x15b23f){if(_0x67aa95['body']['id']){delete _0x67aa95[_0x0f14('0x4b')]['id'];}return db[_0x0f14('0x2b')][_0x0f14('0x49')]({'where':{'id':_0x67aa95['params']['id']}})[_0x0f14('0x24')](handleEntityNotFound(_0x15b23f,null))[_0x0f14('0x24')](saveUpdates(_0x67aa95[_0x0f14('0x4b')],null))[_0x0f14('0x24')](respondWithResult(_0x15b23f,null))[_0x0f14('0x46')](handleError(_0x15b23f,null));};exports[_0x0f14('0x23')]=function(_0xec201f,_0x5d20ba){return db['Schedule'][_0x0f14('0x49')]({'where':{'id':_0xec201f[_0x0f14('0x48')]['id']}})[_0x0f14('0x24')](handleEntityNotFound(_0x5d20ba,null))[_0x0f14('0x24')](removeEntity(_0x5d20ba,null))[_0x0f14('0x46')](handleError(_0x5d20ba,null));};exports['run']=function(_0x54a3f9,_0x8763f8,_0x1007ab){var _0x537898=require('../../config/schedule');return db[_0x0f14('0x2b')][_0x0f14('0x49')]({'where':{'id':_0x54a3f9[_0x0f14('0x48')]['id']},'raw':!![]})[_0x0f14('0x24')](handleEntityNotFound(_0x8763f8,null))[_0x0f14('0x24')](function(){_0x537898['run'](_0x54a3f9['params']['id']);})[_0x0f14('0x24')](respondWithStatusCode(_0x8763f8,null))[_0x0f14('0x46')](handleError(_0x8763f8,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 23d7fe2..4a5022c 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 _0x5fca=['../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','Schedule','lodash','util'];(function(_0x521865,_0xb5ffc3){var _0x54c30f=function(_0x4b7c34){while(--_0x4b7c34){_0x521865['push'](_0x521865['shift']());}};_0x54c30f(++_0xb5ffc3);}(_0x5fca,0x1ab));var _0xa5fc=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x5fca[_0x506d83];return _0x335e8b;};'use strict';var _=require(_0xa5fc('0x0'));var util=require(_0xa5fc('0x1'));var logger=require(_0xa5fc('0x2'))('api');var moment=require(_0xa5fc('0x3'));var BPromise=require(_0xa5fc('0x4'));var rp=require(_0xa5fc('0x5'));var fs=require('fs');var path=require(_0xa5fc('0x6'));var rimraf=require(_0xa5fc('0x7'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0xa5fc('0x8')]=function(_0x4559d0,_0x1c7da1){return _0x4559d0[_0xa5fc('0x9')](_0xa5fc('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe45e=['../../config/environment','./schedule.attributes','exports','define','tools_schedules','util','moment','request-promise','path','rimraf'];(function(_0x1b6c96,_0x30bd30){var _0x80e240=function(_0x294150){while(--_0x294150){_0x1b6c96['push'](_0x1b6c96['shift']());}};_0x80e240(++_0x30bd30);}(_0xe45e,0xa5));var _0xee45=function(_0x560448,_0x2c1082){_0x560448=_0x560448-0x0;var _0x550276=_0xe45e[_0x560448];return _0x550276;};'use strict';var _=require('lodash');var util=require(_0xee45('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xee45('0x1'));var BPromise=require('bluebird');var rp=require(_0xee45('0x2'));var fs=require('fs');var path=require(_0xee45('0x3'));var rimraf=require(_0xee45('0x4'));var config=require(_0xee45('0x5'));var attributes=require(_0xee45('0x6'));module[_0xee45('0x7')]=function(_0x31da7d,_0x91713d){return _0x31da7d[_0xee45('0x8')]('Schedule',attributes,{'tableName':_0xee45('0x9'),'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 9036c25..3d3ae59 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 _0xacbc=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x56b5d1,_0x59be02){var _0x5bfe4a=function(_0x9ed053){while(--_0x9ed053){_0x56b5d1['push'](_0x56b5d1['shift']());}};_0x5bfe4a(++_0x59be02);}(_0xacbc,0x13f));var _0xcacb=function(_0x60b6df,_0xcbc63d){_0x60b6df=_0x60b6df-0x0;var _0x58dcf1=_0xacbc[_0x60b6df];return _0x58dcf1;};'use strict';var _=require(_0xcacb('0x0'));var util=require(_0xcacb('0x1'));var moment=require(_0xcacb('0x2'));var BPromise=require('bluebird');var rs=require(_0xcacb('0x3'));var fs=require('fs');var Redis=require(_0xcacb('0x4'));var db=require(_0xcacb('0x5'))['db'];var utils=require(_0xcacb('0x6'));var logger=require('../../config/logger')(_0xcacb('0x7'));var config=require(_0xcacb('0x8'));var jayson=require(_0xcacb('0x9'));var client=jayson[_0xcacb('0xa')][_0xcacb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1330ad,_0x452287,_0x34c36f){return new BPromise(function(_0x5347ac,_0x269449){return client[_0xcacb('0xc')](_0x1330ad,_0x34c36f)[_0xcacb('0xd')](function(_0x37168f){logger[_0xcacb('0xe')](_0xcacb('0xf'),_0x452287,_0xcacb('0x10'));logger[_0xcacb('0x11')](_0xcacb('0x12'),_0x452287,_0xcacb('0x10'),JSON[_0xcacb('0x13')](_0x37168f));if(_0x37168f[_0xcacb('0x14')]){if(_0x37168f[_0xcacb('0x14')]['code']===0x1f4){logger[_0xcacb('0x14')](_0xcacb('0xf'),_0x452287,_0x37168f[_0xcacb('0x14')][_0xcacb('0x15')]);return _0x269449(_0x37168f[_0xcacb('0x14')][_0xcacb('0x15')]);}logger[_0xcacb('0x14')](_0xcacb('0xf'),_0x452287,_0x37168f[_0xcacb('0x14')][_0xcacb('0x15')]);return _0x5347ac(_0x37168f[_0xcacb('0x14')][_0xcacb('0x15')]);}else{logger[_0xcacb('0xe')](_0xcacb('0xf'),_0x452287,'request\x20sent');_0x5347ac(_0x37168f[_0xcacb('0x16')][_0xcacb('0x15')]);}})['catch'](function(_0x435f39){logger[_0xcacb('0x14')](_0xcacb('0xf'),_0x452287,_0x435f39);_0x269449(_0x435f39);});});} \ No newline at end of file +var _0x59ac=['error','code','message','info','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x24669e,_0x49e709){var _0x27682e=function(_0x39c1ec){while(--_0x39c1ec){_0x24669e['push'](_0x24669e['shift']());}};_0x27682e(++_0x49e709);}(_0x59ac,0x7d));var _0xc59a=function(_0x17325e,_0x5863f2){_0x17325e=_0x17325e-0x0;var _0x51062a=_0x59ac[_0x17325e];return _0x51062a;};'use strict';var _=require('lodash');var util=require(_0xc59a('0x0'));var moment=require('moment');var BPromise=require(_0xc59a('0x1'));var rs=require(_0xc59a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc59a('0x3'))['db'];var utils=require(_0xc59a('0x4'));var logger=require('../../config/logger')(_0xc59a('0x5'));var config=require(_0xc59a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc59a('0x7')][_0xc59a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2049a3,_0x589e6f,_0x5e9267){return new BPromise(function(_0x3330d6,_0x1521ce){return client[_0xc59a('0x9')](_0x2049a3,_0x5e9267)[_0xc59a('0xa')](function(_0x54bb5e){logger['info'](_0xc59a('0xb'),_0x589e6f,_0xc59a('0xc'));logger['debug'](_0xc59a('0xd'),_0x589e6f,_0xc59a('0xc'),JSON[_0xc59a('0xe')](_0x54bb5e));if(_0x54bb5e[_0xc59a('0xf')]){if(_0x54bb5e[_0xc59a('0xf')][_0xc59a('0x10')]===0x1f4){logger[_0xc59a('0xf')](_0xc59a('0xb'),_0x589e6f,_0x54bb5e['error'][_0xc59a('0x11')]);return _0x1521ce(_0x54bb5e[_0xc59a('0xf')][_0xc59a('0x11')]);}logger[_0xc59a('0xf')](_0xc59a('0xb'),_0x589e6f,_0x54bb5e[_0xc59a('0xf')][_0xc59a('0x11')]);return _0x3330d6(_0x54bb5e['error'][_0xc59a('0x11')]);}else{logger[_0xc59a('0x12')](_0xc59a('0xb'),_0x589e6f,_0xc59a('0xc'));_0x3330d6(_0x54bb5e['result'][_0xc59a('0x11')]);}})[_0xc59a('0x13')](function(_0x57c8da){logger[_0xc59a('0xf')](_0xc59a('0xb'),_0x589e6f,_0x57c8da);_0x1521ce(_0x57c8da);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index b632919..c1c263f 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 _0x2b41=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','describe','/:id','download','create','put','delete','destroy'];(function(_0x43bafa,_0xf7eef0){var _0x2389a4=function(_0x4e5cbb){while(--_0x4e5cbb){_0x43bafa['push'](_0x43bafa['shift']());}};_0x2389a4(++_0xf7eef0);}(_0x2b41,0x191));var _0x12b4=function(_0x91340d,_0x13ee89){_0x91340d=_0x91340d-0x0;var _0x4d935f=_0x2b41[_0x91340d];return _0x4d935f;};'use strict';var multer=require(_0x12b4('0x0'));var util=require(_0x12b4('0x1'));var path=require(_0x12b4('0x2'));var timeout=require('connect-timeout');var express=require(_0x12b4('0x3'));var router=express[_0x12b4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x12b4('0x5'));var interaction=require(_0x12b4('0x6'));var config=require(_0x12b4('0x7'));var controller=require(_0x12b4('0x8'));router['get']('/',auth[_0x12b4('0x9')](),controller[_0x12b4('0xa')]);router[_0x12b4('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x12b4('0xc')]);router[_0x12b4('0xb')](_0x12b4('0xd'),auth[_0x12b4('0x9')](),controller['show']);router[_0x12b4('0xb')]('/:id/download',auth[_0x12b4('0x9')](),controller[_0x12b4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x12b4('0xf')]);router[_0x12b4('0x10')]('/:id',auth[_0x12b4('0x9')](),controller['update']);router[_0x12b4('0x11')]('/:id',auth[_0x12b4('0x9')](),controller[_0x12b4('0x12')]);module[_0x12b4('0x13')]=router; \ No newline at end of file +var _0x44b3=['index','get','/describe','describe','/:id','/:id/download','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./screenRecording.controller','isAuthenticated'];(function(_0x2d3be7,_0x5e7b0f){var _0x4fd2e9=function(_0xfdbc70){while(--_0xfdbc70){_0x2d3be7['push'](_0x2d3be7['shift']());}};_0x4fd2e9(++_0x5e7b0f);}(_0x44b3,0x137));var _0x344b=function(_0x1a945e,_0x1a75e0){_0x1a945e=_0x1a945e-0x0;var _0x37d430=_0x44b3[_0x1a945e];return _0x37d430;};'use strict';var multer=require(_0x344b('0x0'));var util=require(_0x344b('0x1'));var path=require(_0x344b('0x2'));var timeout=require(_0x344b('0x3'));var express=require(_0x344b('0x4'));var router=express['Router']();var fs_extra=require(_0x344b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x344b('0x6'));var config=require('../../config/environment');var controller=require(_0x344b('0x7'));router['get']('/',auth[_0x344b('0x8')](),controller[_0x344b('0x9')]);router[_0x344b('0xa')](_0x344b('0xb'),auth['isAuthenticated'](),controller[_0x344b('0xc')]);router[_0x344b('0xa')](_0x344b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x344b('0xa')](_0x344b('0xe'),auth[_0x344b('0x8')](),controller['download']);router[_0x344b('0xf')]('/',auth[_0x344b('0x8')](),controller['create']);router[_0x344b('0x10')](_0x344b('0xd'),auth[_0x344b('0x8')](),controller['update']);router[_0x344b('0x11')](_0x344b('0xd'),auth[_0x344b('0x8')](),controller[_0x344b('0x12')]);module[_0x344b('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 7da7445..bb25dc0 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 _0xbbdd=['DATE','getDataValue','closedAt','format','updatedAt','moment','../../config/environment','exports','extname','STRING','replace','setDataValue','value','INTEGER','startedAt','subtract','duration','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x2a4143,_0x2164f0){var _0xf2950f=function(_0x3b9fe7){while(--_0x3b9fe7){_0x2a4143['push'](_0x2a4143['shift']());}};_0xf2950f(++_0x2164f0);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xbbdd[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdbbd('0x0'));var path=require('path');var config=require(_0xdbbd('0x1'));module[_0xdbbd('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('value')?path[_0xdbbd('0x3')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0xdbbd('0x4')]},'channel':{'type':Sequelize[_0xdbbd('0x4')]},'value':{'type':Sequelize[_0xdbbd('0x4')],'set':function(_0x44beae){var _0x59b866=_0x44beae[_0xdbbd('0x5')](/\\/g,'/');this[_0xdbbd('0x6')](_0xdbbd('0x7'),_0x59b866);}},'rating':{'type':Sequelize[_0xdbbd('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xdbbd('0x8')],'set':function(_0x38198c){this[_0xdbbd('0x6')](_0xdbbd('0x9'),moment()[_0xdbbd('0xa')](_0x38198c,'ms'));this[_0xdbbd('0x6')]('closedAt',moment());this[_0xdbbd('0x6')](_0xdbbd('0xb'),_0x38198c);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('startedAt'))['format'](_0xdbbd('0xc'))[_0xdbbd('0xd')]();}},'closedAt':{'type':Sequelize[_0xdbbd('0xe')],'get':function(){return moment(this[_0xdbbd('0xf')](_0xdbbd('0x10')))[_0xdbbd('0x11')](_0xdbbd('0xc'))['toString']();}},'createdAt':{'type':Sequelize[_0xdbbd('0xe')],'get':function(){return moment(this[_0xdbbd('0xf')]('createdAt'))[_0xdbbd('0x11')](_0xdbbd('0xc'))[_0xdbbd('0xd')]();}},'updatedAt':{'type':Sequelize[_0xdbbd('0xe')],'get':function(){return moment(this['getDataValue'](_0xdbbd('0x12')))[_0xdbbd('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xdbbd('0xd')]();}}}; \ No newline at end of file +var _0x57ca=['MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','DATE','startedAt','format'];(function(_0x7bda4d,_0x4f3c28){var _0x51362c=function(_0x43c4e2){while(--_0x43c4e2){_0x7bda4d['push'](_0x7bda4d['shift']());}};_0x51362c(++_0x4f3c28);}(_0x57ca,0x108));var _0xa57c=function(_0x209526,_0x40a1f0){_0x209526=_0x209526-0x0;var _0x40d077=_0x57ca[_0x209526];return _0x40d077;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var config=require('../../config/environment');module[_0xa57c('0x2')]={'format':{'type':Sequelize[_0xa57c('0x3')],'get':function(){return this[_0xa57c('0x4')](_0xa57c('0x5'))?path[_0xa57c('0x6')](this['getDataValue'](_0xa57c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xa57c('0x7')]},'channel':{'type':Sequelize[_0xa57c('0x7')]},'value':{'type':Sequelize[_0xa57c('0x7')],'set':function(_0xbdfffb){var _0x314574=_0xbdfffb[_0xa57c('0x8')](/\\/g,'/');this[_0xa57c('0x9')]('value',_0x314574);}},'rating':{'type':Sequelize[_0xa57c('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x46ba92){this[_0xa57c('0x9')]('startedAt',moment()[_0xa57c('0xb')](_0x46ba92,'ms'));this['setDataValue'](_0xa57c('0xc'),moment());this[_0xa57c('0x9')]('duration',_0x46ba92);}},'startedAt':{'type':Sequelize[_0xa57c('0xd')],'get':function(){return moment(this['getDataValue'](_0xa57c('0xe')))[_0xa57c('0xf')](_0xa57c('0x10'))[_0xa57c('0x11')]();}},'closedAt':{'type':Sequelize[_0xa57c('0xd')],'get':function(){return moment(this['getDataValue'](_0xa57c('0xc')))['format'](_0xa57c('0x10'))[_0xa57c('0x11')]();}},'createdAt':{'type':Sequelize[_0xa57c('0xd')],'get':function(){return moment(this[_0xa57c('0x4')](_0xa57c('0x12')))[_0xa57c('0xf')](_0xa57c('0x10'))['toString']();}},'updatedAt':{'type':Sequelize[_0xa57c('0xd')],'get':function(){return moment(this[_0xa57c('0x4')](_0xa57c('0x13')))['format'](_0xa57c('0x10'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 7f7143b..4a71648 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 _0xee14=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','catch','params','find','create','body','duration','describe','../../components/encryptor','uniqueid','value','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','filename','download','unlink','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','join','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x30a19d,_0x4588c7){var _0x3d60e8=function(_0x1b96cd){while(--_0x1b96cd){_0x30a19d['push'](_0x30a19d['shift']());}};_0x3d60e8(++_0x4588c7);}(_0xee14,0x13a));var _0x4ee1=function(_0x29ecb0,_0x632aa6){_0x29ecb0=_0x29ecb0-0x0;var _0x1d37bf=_0xee14[_0x29ecb0];return _0x1d37bf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ee1('0x0'));var jsonpatch=require(_0x4ee1('0x1'));var rp=require(_0x4ee1('0x2'));var moment=require(_0x4ee1('0x3'));var BPromise=require(_0x4ee1('0x4'));var Mustache=require(_0x4ee1('0x5'));var util=require(_0x4ee1('0x6'));var path=require(_0x4ee1('0x7'));var sox=require(_0x4ee1('0x8'));var csv=require('to-csv');var ejs=require(_0x4ee1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0xf'));var querystring=require('querystring');var Papa=require(_0x4ee1('0x10'));var Redis=require(_0x4ee1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x12'));var as=require(_0x4ee1('0x13'));var hardwareService=require(_0x4ee1('0x14'));var logger=require(_0x4ee1('0x15'))('api');var utils=require(_0x4ee1('0x16'));var config=require(_0x4ee1('0x17'));var licenseUtil=require(_0x4ee1('0x18'));var db=require(_0x4ee1('0x19'))['db'];function respondWithStatusCode(_0x2f864e,_0x174427){_0x174427=_0x174427||0xcc;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0x1a')](_0x174427);}return _0x2f864e[_0x4ee1('0x1b')](_0x174427)[_0x4ee1('0x1c')]();};}function respondWithResult(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0xc8;return function(_0x1c342a){if(_0x1c342a){return _0x24a915[_0x4ee1('0x1b')](_0x46d2c2)[_0x4ee1('0x1d')](_0x1c342a);}};}function respondWithFilteredResult(_0xb7eafd,_0x4e3490){return function(_0x2f9194){if(_0x2f9194){var _0x38008f=typeof _0x4e3490[_0x4ee1('0x1e')]===_0x4ee1('0x1f')&&typeof _0x4e3490[_0x4ee1('0x20')]===_0x4ee1('0x1f');var _0x2eff91=_0x2f9194[_0x4ee1('0x21')];var _0x360056=_0x38008f?0x0:_0x4e3490[_0x4ee1('0x1e')];var _0x274de5=_0x38008f?_0x2f9194['count']:_0x4e3490[_0x4ee1('0x1e')]+_0x4e3490[_0x4ee1('0x20')];var _0x173388;if(_0x274de5>=_0x2eff91){_0x274de5=_0x2eff91;_0x173388=0xc8;}else{_0x173388=0xce;}_0xb7eafd[_0x4ee1('0x1b')](_0x173388);return _0xb7eafd[_0x4ee1('0x22')](_0x4ee1('0x23'),_0x360056+'-'+_0x274de5+'/'+_0x2eff91)['json'](_0x2f9194);}return null;};}function patchUpdates(_0x8a631f){return function(_0x333e96){try{jsonpatch[_0x4ee1('0x24')](_0x333e96,_0x8a631f,!![]);}catch(_0x3f0d59){return BPromise[_0x4ee1('0x25')](_0x3f0d59);}return _0x333e96[_0x4ee1('0x26')]();};}function saveUpdates(_0x328f21,_0x40fd98){return function(_0x1dc1a8){if(_0x1dc1a8){return _0x1dc1a8[_0x4ee1('0x27')](_0x328f21)['then'](function(_0x53d43f){return _0x53d43f;});}return null;};}function removeEntity(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(_0xaf87e7){return _0xaf87e7[_0x4ee1('0x28')]()[_0x4ee1('0x29')](function(){_0x14110c[_0x4ee1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc0b5,_0x442c71){return function(_0x28b7e1){if(!_0x28b7e1){_0x5cc0b5['sendStatus'](0x194);}return _0x28b7e1;};}function handleError(_0x35900d,_0x213db8){_0x213db8=_0x213db8||0x1f4;return function(_0x36654c){logger[_0x4ee1('0x2a')](_0x36654c[_0x4ee1('0x2b')]);if(_0x36654c[_0x4ee1('0x2c')]){delete _0x36654c[_0x4ee1('0x2c')];}_0x35900d['status'](_0x213db8)[_0x4ee1('0x2d')](_0x36654c);};}exports['index']=function(_0x4746c2,_0x4ec408){var _0x3dc870={},_0x1d91be={},_0x59a34e={'count':0x0,'rows':[]};var _0x13944c=_[_0x4ee1('0x2e')](db['ScreenRecording'][_0x4ee1('0x2f')],function(_0x5b3792){return{'name':_0x5b3792[_0x4ee1('0x30')],'type':_0x5b3792[_0x4ee1('0x31')][_0x4ee1('0x32')]};});_0x1d91be[_0x4ee1('0x33')]=_[_0x4ee1('0x34')](_['map'](_0x13944c,_0x4ee1('0x2c')),[_0x4ee1('0x35')]);_0x1d91be[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x4746c2[_0x4ee1('0x36')]);_0x1d91be[_0x4ee1('0x38')]=_['intersection'](_0x1d91be['model'],_0x1d91be[_0x4ee1('0x36')]);_0x3dc870[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x1d91be['model'],qs[_0x4ee1('0x3b')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x3dc870[_0x4ee1('0x39')]=_0x3dc870[_0x4ee1('0x39')][_0x4ee1('0x3c')]?_0x3dc870[_0x4ee1('0x39')]:_0x1d91be[_0x4ee1('0x33')];if(!_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3d')](_0x4ee1('0x3e'))){_0x3dc870[_0x4ee1('0x20')]=qs[_0x4ee1('0x20')](_0x4746c2['query'][_0x4ee1('0x20')]);_0x3dc870[_0x4ee1('0x1e')]=qs[_0x4ee1('0x1e')](_0x4746c2['query']['offset']);}_0x3dc870[_0x4ee1('0x3f')]=qs[_0x4ee1('0x40')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x40')]);_0x3dc870['where']=qs[_0x4ee1('0x38')](_[_0x4ee1('0x41')](_0x4746c2[_0x4ee1('0x36')],_0x1d91be[_0x4ee1('0x38')]),_0x13944c);if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x42')]){_0x3dc870[_0x4ee1('0x43')]=_[_0x4ee1('0x44')](_0x3dc870['where'],{'$or':_[_0x4ee1('0x2e')](_0x13944c,function(_0x1116b4){if(_0x1116b4[_0x4ee1('0x31')]!==_0x4ee1('0x45')){var _0x45bb22={};_0x45bb22[_0x1116b4[_0x4ee1('0x2c')]]={'$like':'%'+_0x4746c2['query'][_0x4ee1('0x42')]+'%'};return _0x45bb22;}})});}_0x3dc870=_[_0x4ee1('0x44')]({},_0x3dc870,_0x4746c2[_0x4ee1('0x46')]);var _0x333690={'where':_0x3dc870[_0x4ee1('0x43')]};return db[_0x4ee1('0x47')][_0x4ee1('0x21')](_0x333690)[_0x4ee1('0x29')](function(_0x23bb5f){_0x59a34e[_0x4ee1('0x21')]=_0x23bb5f;if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x48')]){_0x3dc870[_0x4ee1('0x49')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4ee1('0x4a')](_0x3dc870);})[_0x4ee1('0x29')](function(_0x5ee7b4){_0x59a34e[_0x4ee1('0x4b')]=_0x5ee7b4;return _0x59a34e;})['then'](respondWithFilteredResult(_0x4ec408,_0x3dc870))[_0x4ee1('0x4c')](handleError(_0x4ec408,null));};exports['show']=function(_0x14c333,_0xc7580c){var _0x557126={'raw':![],'where':{'id':_0x14c333[_0x4ee1('0x4d')]['id']}},_0x25d683={};_0x25d683[_0x4ee1('0x33')]=_[_0x4ee1('0x37')](db['ScreenRecording'][_0x4ee1('0x2f')]);_0x25d683[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x14c333['query']);_0x25d683['filters']=_[_0x4ee1('0x3a')](_0x25d683[_0x4ee1('0x33')],_0x25d683[_0x4ee1('0x36')]);_0x557126[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x25d683['model'],qs['fields'](_0x14c333[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x557126[_0x4ee1('0x39')]=_0x557126[_0x4ee1('0x39')]['length']?_0x557126[_0x4ee1('0x39')]:_0x25d683[_0x4ee1('0x33')];if(_0x14c333['query'][_0x4ee1('0x48')]){_0x557126[_0x4ee1('0x49')]=[{'all':!![]}];}_0x557126=_[_0x4ee1('0x44')]({},_0x557126,_0x14c333[_0x4ee1('0x46')]);return db[_0x4ee1('0x47')][_0x4ee1('0x4e')](_0x557126)[_0x4ee1('0x29')](handleEntityNotFound(_0xc7580c,null))[_0x4ee1('0x29')](respondWithResult(_0xc7580c,null))[_0x4ee1('0x4c')](handleError(_0xc7580c,null));};exports['create']=function(_0x49b667,_0x1a972b){return db[_0x4ee1('0x47')][_0x4ee1('0x4f')](_0x49b667[_0x4ee1('0x50')],{})['then'](respondWithResult(_0x1a972b,0xc9))[_0x4ee1('0x4c')](handleError(_0x1a972b,null));};exports[_0x4ee1('0x27')]=function(_0x42dd8d,_0x2bc77f){if(_0x42dd8d[_0x4ee1('0x50')]['id']){delete _0x42dd8d['body']['id'];}delete _0x42dd8d[_0x4ee1('0x50')][_0x4ee1('0x51')];delete _0x42dd8d[_0x4ee1('0x50')]['createdAt'];delete _0x42dd8d[_0x4ee1('0x50')]['closedAt'];delete _0x42dd8d[_0x4ee1('0x50')]['value'];return db[_0x4ee1('0x47')]['find']({'where':{'id':_0x42dd8d[_0x4ee1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2bc77f,null))[_0x4ee1('0x29')](saveUpdates(_0x42dd8d[_0x4ee1('0x50')],null))[_0x4ee1('0x29')](respondWithResult(_0x2bc77f,null))['catch'](handleError(_0x2bc77f,null));};exports[_0x4ee1('0x52')]=function(_0x4118d7,_0xcdb873){return db[_0x4ee1('0x47')][_0x4ee1('0x52')]()[_0x4ee1('0x29')](respondWithResult(_0xcdb873,null))[_0x4ee1('0x4c')](handleError(_0xcdb873,null));};exports['download']=function(_0x4c4178,_0x1feb78,_0xcddc5d){var _0xf58cd8=require(_0x4ee1('0x53'));var _0x44e65f=![];var _0x31e82d={};if(_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]&&_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]===_0x4ee1('0x54')){_0x31e82d[_0x4ee1('0x54')]=_0x4c4178[_0x4ee1('0x4d')]['id'];}else{_0x31e82d['id']=_0x4c4178['params']['id'];}return db[_0x4ee1('0x47')]['find']({'where':_0x31e82d,'attributes':['id',_0x4ee1('0x55')],'raw':!![]})[_0x4ee1('0x29')](handleEntityNotFound(_0x1feb78,null))['then'](function(_0x1e0aac){if(_0x1e0aac){var _0x184e36=path['join'](config['root'],_0x4ee1('0x56'),_0x1e0aac['value']);var _0x1ce99e=util[_0x4ee1('0x35')]('%s.cypher',_0x184e36);if(fs[_0x4ee1('0x57')](_0x1ce99e)){_0x44e65f=!![];return _0xf58cd8[_0x4ee1('0x58')](_0x1ce99e,_0x184e36,config[_0x4ee1('0x59')][_0x4ee1('0x5a')])[_0x4ee1('0x29')](function(){return _0x1e0aac;});}return _0x1e0aac;}})[_0x4ee1('0x29')](function(_0x11f619){if(_0x11f619){var _0x5f5694=path['join'](config[_0x4ee1('0x5b')],_0x4ee1('0x56'),_0x11f619['value']);if(!fs[_0x4ee1('0x57')](_0x5f5694)){throw new db[(_0x4ee1('0x5c'))][(_0x4ee1('0x5d'))]('ScreenRecording\x20not\x20found');}if(_0x11f619[_0x4ee1('0x5e')]){return _0x1feb78['download'](_0x5f5694,_0x11f619[_0x4ee1('0x5e')]+path['extname'](_0x5f5694),function(){if(_0x44e65f){fs['unlink'](_0x5f5694);}});}else{return _0x1feb78[_0x4ee1('0x5f')](_0x5f5694,function(_0x16fcd0){if(_0x44e65f){fs[_0x4ee1('0x60')](_0x5f5694);}});}}})[_0x4ee1('0x4c')](function(_0x38e889){if(_0x38e889['message']===_0x4ee1('0x61')){_0x1feb78[_0x4ee1('0x1b')](0x194)[_0x4ee1('0x2d')]('Not\x20found');}else{return handleError(_0x1feb78,null);}});};exports[_0x4ee1('0x28')]=function(_0x109dc6,_0x3fdd61){return db[_0x4ee1('0x47')][_0x4ee1('0x4e')]({'where':{'id':_0x109dc6[_0x4ee1('0x4d')]['id']}})[_0x4ee1('0x29')](function(_0x20ca0b){if(_[_0x4ee1('0x62')](_0x20ca0b)){throw new ReferenceError(_0x4ee1('0x63'));}return _0x20ca0b;})[_0x4ee1('0x29')](function(_0x38e86f){var _0x5d396c=path[_0x4ee1('0x64')](config['root'],_0x4ee1('0x56'),_0x38e86f['value']);logger[_0x4ee1('0x65')](_0x4ee1('0x66'),_0x5d396c);if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs[_0x4ee1('0x57')](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs[_0x4ee1('0x69')](_0x5d396c);}_0x5d396c=_0x5d396c+_0x4ee1('0x6a');if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs['existsSync'](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs['unlinkSync'](_0x5d396c);}return _0x38e86f;})['then'](function(_0x40dac3){if(!_0x40dac3)throw new InternalError();return _0x40dac3[_0x4ee1('0x28')]();})['then'](function(){_0x3fdd61[_0x4ee1('0x1b')](0xcc)[_0x4ee1('0x1c')]();})[_0x4ee1('0x4c')](handleError(_0x3fdd61,null));}; \ No newline at end of file +var _0x5fc3=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','ScreenRecording','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','existsSync','decryptFile','secrets','join','Sequelize','ValidationError','filename','unlink','message','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus'];(function(_0x118591,_0x247276){var _0x4c4e55=function(_0x246910){while(--_0x246910){_0x118591['push'](_0x118591['shift']());}};_0x4c4e55(++_0x247276);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0x5fc3[_0x2bf466];return _0x856885;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){_0x2d8183['status'](0xcc)[_0x35fc('0x19')]();});}};}function handleEntityNotFound(_0x5a93df,_0x3d4a98){return function(_0x51cfec){if(!_0x51cfec){_0x5a93df[_0x35fc('0x17')](0x194);}return _0x51cfec;};}function handleError(_0x598d7a,_0x1bf180){_0x1bf180=_0x1bf180||0x1f4;return function(_0xdfab9f){logger['error'](_0xdfab9f['stack']);if(_0xdfab9f[_0x35fc('0x26')]){delete _0xdfab9f['name'];}_0x598d7a[_0x35fc('0x18')](_0x1bf180)[_0x35fc('0x27')](_0xdfab9f);};}exports['index']=function(_0x26b7cb,_0x645eac){var _0x383837={},_0x9f3c8a={},_0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x28')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x2b')]['key']};});_0x9f3c8a[_0x35fc('0x2c')]=_[_0x35fc('0x2d')](_[_0x35fc('0x28')](_0x134dfa,_0x35fc('0x26')),[_0x35fc('0x2e')]);_0x9f3c8a[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x26b7cb[_0x35fc('0x2f')]);_0x9f3c8a[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x9f3c8a['model'],_0x9f3c8a['query']);_0x383837[_0x35fc('0x33')]=_['intersection'](_0x9f3c8a[_0x35fc('0x2c')],qs[_0x35fc('0x34')](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x34')]));_0x383837[_0x35fc('0x33')]=_0x383837[_0x35fc('0x33')]['length']?_0x383837[_0x35fc('0x33')]:_0x9f3c8a[_0x35fc('0x2c')];if(!_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x35')](_0x35fc('0x36'))){_0x383837[_0x35fc('0x1c')]=qs['limit'](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x1c')]);_0x383837[_0x35fc('0x1a')]=qs['offset'](_0x26b7cb[_0x35fc('0x2f')]['offset']);}_0x383837[_0x35fc('0x37')]=qs[_0x35fc('0x38')](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x38')]);_0x383837['where']=qs['filters'](_['pick'](_0x26b7cb[_0x35fc('0x2f')],_0x9f3c8a['filters']),_0x134dfa);if(_0x26b7cb[_0x35fc('0x2f')]['filter']){_0x383837[_0x35fc('0x39')]=_[_0x35fc('0x3a')](_0x383837[_0x35fc('0x39')],{'$or':_[_0x35fc('0x28')](_0x134dfa,function(_0x1c10e0){if(_0x1c10e0[_0x35fc('0x2b')]!==_0x35fc('0x3b')){var _0x4ec0dc={};_0x4ec0dc[_0x1c10e0[_0x35fc('0x26')]]={'$like':'%'+_0x26b7cb[_0x35fc('0x2f')]['filter']+'%'};return _0x4ec0dc;}})});}_0x383837=_[_0x35fc('0x3a')]({},_0x383837,_0x26b7cb[_0x35fc('0x3c')]);var _0x1aac67={'where':_0x383837[_0x35fc('0x39')]};return db[_0x35fc('0x29')][_0x35fc('0x1d')](_0x1aac67)['then'](function(_0x3f6480){_0x3735da[_0x35fc('0x1d')]=_0x3f6480;if(_0x26b7cb[_0x35fc('0x2f')]['includeAll']){_0x383837[_0x35fc('0x3d')]=[{'all':!![]}];}return db[_0x35fc('0x29')]['findAll'](_0x383837);})[_0x35fc('0x24')](function(_0x280af1){_0x3735da[_0x35fc('0x3e')]=_0x280af1;return _0x3735da;})[_0x35fc('0x24')](respondWithFilteredResult(_0x645eac,_0x383837))[_0x35fc('0x3f')](handleError(_0x645eac,null));};exports[_0x35fc('0x40')]=function(_0x211b70,_0x3ec51f){var _0x5a7e9e={'raw':![],'where':{'id':_0x211b70[_0x35fc('0x41')]['id']}},_0x596e83={};_0x596e83[_0x35fc('0x2c')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x596e83[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x211b70['query']);_0x596e83[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x596e83[_0x35fc('0x2c')],_0x596e83[_0x35fc('0x2f')]);_0x5a7e9e['attributes']=_['intersection'](_0x596e83['model'],qs['fields'](_0x211b70['query'][_0x35fc('0x34')]));_0x5a7e9e[_0x35fc('0x33')]=_0x5a7e9e['attributes'][_0x35fc('0x42')]?_0x5a7e9e['attributes']:_0x596e83[_0x35fc('0x2c')];if(_0x211b70[_0x35fc('0x2f')][_0x35fc('0x43')]){_0x5a7e9e[_0x35fc('0x3d')]=[{'all':!![]}];}_0x5a7e9e=_[_0x35fc('0x3a')]({},_0x5a7e9e,_0x211b70['options']);return db[_0x35fc('0x29')][_0x35fc('0x44')](_0x5a7e9e)['then'](handleEntityNotFound(_0x3ec51f,null))[_0x35fc('0x24')](respondWithResult(_0x3ec51f,null))[_0x35fc('0x3f')](handleError(_0x3ec51f,null));};exports[_0x35fc('0x45')]=function(_0x211746,_0x5bc8c3){return db[_0x35fc('0x29')]['create'](_0x211746['body'],{})[_0x35fc('0x24')](respondWithResult(_0x5bc8c3,0xc9))[_0x35fc('0x3f')](handleError(_0x5bc8c3,null));};exports[_0x35fc('0x23')]=function(_0xca8aef,_0xf2ca20){if(_0xca8aef[_0x35fc('0x46')]['id']){delete _0xca8aef[_0x35fc('0x46')]['id'];}delete _0xca8aef[_0x35fc('0x46')]['duration'];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x47')];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x48')];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x49')];return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0xca8aef[_0x35fc('0x41')]['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0xf2ca20,null))[_0x35fc('0x24')](saveUpdates(_0xca8aef[_0x35fc('0x46')],null))[_0x35fc('0x24')](respondWithResult(_0xf2ca20,null))[_0x35fc('0x3f')](handleError(_0xf2ca20,null));};exports['describe']=function(_0x553ed6,_0x144f77){return db[_0x35fc('0x29')][_0x35fc('0x4a')]()[_0x35fc('0x24')](respondWithResult(_0x144f77,null))[_0x35fc('0x3f')](handleError(_0x144f77,null));};exports[_0x35fc('0x4b')]=function(_0x4a4798,_0x4f024c,_0x388521){var _0x19b2ce=require(_0x35fc('0x4c'));var _0x38bc78=![];var _0x5b2595={};if(_0x4a4798[_0x35fc('0x2f')][_0x35fc('0x2b')]&&_0x4a4798['query'][_0x35fc('0x2b')]===_0x35fc('0x4d')){_0x5b2595['uniqueid']=_0x4a4798[_0x35fc('0x41')]['id'];}else{_0x5b2595['id']=_0x4a4798[_0x35fc('0x41')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':_0x5b2595,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x4f024c,null))['then'](function(_0x240338){if(_0x240338){var _0x2ea8d6=path['join'](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x240338[_0x35fc('0x49')]);var _0x145854=util[_0x35fc('0x2e')]('%s.cypher',_0x2ea8d6);if(fs[_0x35fc('0x50')](_0x145854)){_0x38bc78=!![];return _0x19b2ce[_0x35fc('0x51')](_0x145854,_0x2ea8d6,config[_0x35fc('0x52')]['recording'])[_0x35fc('0x24')](function(){return _0x240338;});}return _0x240338;}})[_0x35fc('0x24')](function(_0x47fb1a){if(_0x47fb1a){var _0x35a676=path[_0x35fc('0x53')](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x47fb1a[_0x35fc('0x49')]);if(!fs[_0x35fc('0x50')](_0x35a676)){throw new db[(_0x35fc('0x54'))][(_0x35fc('0x55'))]('ScreenRecording\x20not\x20found');}if(_0x47fb1a[_0x35fc('0x56')]){return _0x4f024c[_0x35fc('0x4b')](_0x35a676,_0x47fb1a[_0x35fc('0x56')]+path['extname'](_0x35a676),function(){if(_0x38bc78){fs[_0x35fc('0x57')](_0x35a676);}});}else{return _0x4f024c['download'](_0x35a676,function(_0x4ceacc){if(_0x38bc78){fs['unlink'](_0x35a676);}});}}})[_0x35fc('0x3f')](function(_0xb1c68a){if(_0xb1c68a[_0x35fc('0x58')]===_0x35fc('0x59')){_0x4f024c[_0x35fc('0x18')](0x194)['send']('Not\x20found');}else{return handleError(_0x4f024c,null);}});};exports['destroy']=function(_0x4faef4,_0x51d231){return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0x4faef4[_0x35fc('0x41')]['id']}})[_0x35fc('0x24')](function(_0x511e8b){if(_[_0x35fc('0x5a')](_0x511e8b)){throw new ReferenceError(_0x35fc('0x5b'));}return _0x511e8b;})[_0x35fc('0x24')](function(_0x1b0063){var _0x37bea1=path[_0x35fc('0x53')](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x1b0063[_0x35fc('0x49')]);logger['info'](_0x35fc('0x5c'),_0x37bea1);if(!_['isNil'](_0x1b0063[_0x35fc('0x49')])&&fs[_0x35fc('0x50')](_0x37bea1)){logger[_0x35fc('0x5d')](_0x35fc('0x5e')+_0x37bea1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35fc('0x5f')](_0x37bea1);}_0x37bea1=_0x37bea1+'.cypher';if(!_['isNil'](_0x1b0063['value'])&&fs[_0x35fc('0x50')](_0x37bea1)){logger['info'](_0x35fc('0x5e')+_0x37bea1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35fc('0x5f')](_0x37bea1);}return _0x1b0063;})['then'](function(_0x42a53a){if(!_0x42a53a)throw new InternalError();return _0x42a53a[_0x35fc('0x25')]();})[_0x35fc('0x24')](function(){_0x51d231[_0x35fc('0x18')](0xcc)['end']();})[_0x35fc('0x3f')](handleError(_0x51d231,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index d6deda3..69af415 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 _0xe69f=['bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','api','moment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe69f,0x14f));var _0xfe69=function(_0x1b8a7f,_0x567dd1){_0x1b8a7f=_0x1b8a7f-0x0;var _0x177b52=_0xe69f[_0x1b8a7f];return _0x177b52;};'use strict';var _=require(_0xfe69('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfe69('0x1'));var moment=require(_0xfe69('0x2'));var BPromise=require(_0xfe69('0x3'));var rp=require(_0xfe69('0x4'));var fs=require('fs');var path=require(_0xfe69('0x5'));var rimraf=require(_0xfe69('0x6'));var config=require(_0xfe69('0x7'));var attributes=require(_0xfe69('0x8'));module[_0xfe69('0x9')]=function(_0x5ae3a4,_0x1f4ca8){return _0x5ae3a4['define'](_0xfe69('0xa'),attributes,{'tableName':_0xfe69('0xb'),'paranoid':![],'indexes':[{'name':_0xfe69('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4439=['interactionid','util','api','moment','request-promise','rimraf','../../config/environment','./screenRecording.attributes','screen_recordings'];(function(_0x186026,_0xf863af){var _0x2ef2f0=function(_0x3c11eb){while(--_0x3c11eb){_0x186026['push'](_0x186026['shift']());}};_0x2ef2f0(++_0xf863af);}(_0x4439,0x64));var _0x9443=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x4439[_0x420b24];return _0x4da552;};'use strict';var _=require('lodash');var util=require(_0x9443('0x0'));var logger=require('../../config/logger')(_0x9443('0x1'));var moment=require(_0x9443('0x2'));var BPromise=require('bluebird');var rp=require(_0x9443('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9443('0x4'));var config=require(_0x9443('0x5'));var attributes=require(_0x9443('0x6'));module['exports']=function(_0x1cda09,_0x234637){return _0x1cda09['define']('ScreenRecording',attributes,{'tableName':_0x9443('0x7'),'paranoid':![],'indexes':[{'name':_0x9443('0x8'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 386d2ab..8d81edf 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 _0xf720=['code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x42a055,_0xb9776f){var _0x5a64b4=function(_0x431eaf){while(--_0x431eaf){_0x42a055['push'](_0x42a055['shift']());}};_0x5a64b4(++_0xb9776f);}(_0xf720,0x124));var _0x0f72=function(_0x5292af,_0x30f880){_0x5292af=_0x5292af-0x0;var _0x1b5b2a=_0xf720[_0x5292af];return _0x1b5b2a;};'use strict';var _=require(_0x0f72('0x0'));var util=require(_0x0f72('0x1'));var moment=require('moment');var BPromise=require(_0x0f72('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f72('0x3'));var db=require(_0x0f72('0x4'))['db'];var utils=require(_0x0f72('0x5'));var logger=require(_0x0f72('0x6'))(_0x0f72('0x7'));var config=require(_0x0f72('0x8'));var jayson=require(_0x0f72('0x9'));var client=jayson[_0x0f72('0xa')][_0x0f72('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d4b43,_0x71552a,_0x4e2daa){return new BPromise(function(_0x404450,_0x261c1d){return client[_0x0f72('0xc')](_0x5d4b43,_0x4e2daa)[_0x0f72('0xd')](function(_0x192010){logger[_0x0f72('0xe')](_0x0f72('0xf'),_0x71552a,_0x0f72('0x10'));logger['debug'](_0x0f72('0x11'),_0x71552a,'request\x20sent',JSON[_0x0f72('0x12')](_0x192010));if(_0x192010[_0x0f72('0x13')]){if(_0x192010[_0x0f72('0x13')][_0x0f72('0x14')]===0x1f4){logger[_0x0f72('0x13')](_0x0f72('0xf'),_0x71552a,_0x192010['error'][_0x0f72('0x15')]);return _0x261c1d(_0x192010[_0x0f72('0x13')][_0x0f72('0x15')]);}logger[_0x0f72('0x13')](_0x0f72('0xf'),_0x71552a,_0x192010[_0x0f72('0x13')][_0x0f72('0x15')]);return _0x404450(_0x192010[_0x0f72('0x13')][_0x0f72('0x15')]);}else{logger[_0x0f72('0xe')](_0x0f72('0xf'),_0x71552a,_0x0f72('0x10'));_0x404450(_0x192010[_0x0f72('0x16')][_0x0f72('0x15')]);}})[_0x0f72('0x17')](function(_0x79026d){logger['error'](_0x0f72('0xf'),_0x71552a,_0x79026d);_0x261c1d(_0x79026d);});});} \ No newline at end of file +var _0x8638=['request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8638,0x109));var _0x8863=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x8638[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x8863('0x0'));var util=require(_0x8863('0x1'));var moment=require('moment');var BPromise=require(_0x8863('0x2'));var rs=require(_0x8863('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8863('0x4'));var logger=require(_0x8863('0x5'))(_0x8863('0x6'));var config=require(_0x8863('0x7'));var jayson=require(_0x8863('0x8'));var client=jayson[_0x8863('0x9')][_0x8863('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c695d,_0x1bc2ee,_0x4508a8){return new BPromise(function(_0x39d165,_0x10f0be){return client[_0x8863('0xb')](_0x4c695d,_0x4508a8)[_0x8863('0xc')](function(_0x43557b){logger[_0x8863('0xd')](_0x8863('0xe'),_0x1bc2ee,_0x8863('0xf'));logger[_0x8863('0x10')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x1bc2ee,_0x8863('0xf'),JSON[_0x8863('0x11')](_0x43557b));if(_0x43557b[_0x8863('0x12')]){if(_0x43557b[_0x8863('0x12')][_0x8863('0x13')]===0x1f4){logger[_0x8863('0x12')](_0x8863('0xe'),_0x1bc2ee,_0x43557b[_0x8863('0x12')][_0x8863('0x14')]);return _0x10f0be(_0x43557b['error'][_0x8863('0x14')]);}logger[_0x8863('0x12')](_0x8863('0xe'),_0x1bc2ee,_0x43557b['error']['message']);return _0x39d165(_0x43557b[_0x8863('0x12')][_0x8863('0x14')]);}else{logger[_0x8863('0xd')](_0x8863('0xe'),_0x1bc2ee,_0x8863('0xf'));_0x39d165(_0x43557b[_0x8863('0x15')]['message']);}})[_0x8863('0x16')](function(_0x314dbf){logger[_0x8863('0x12')](_0x8863('0xe'),_0x1bc2ee,_0x314dbf);_0x10f0be(_0x314dbf);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 9ff6ce9..e37aa2e 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 _0x81dc=['server/files/images/logos/','format','logologin','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','root','%s%s','logo','extname','originalname','post','single','file','addLogo','join'];(function(_0x46f9,_0x41b032){var _0x44e46f=function(_0x2fff17){while(--_0x2fff17){_0x46f9['push'](_0x46f9['shift']());}};_0x44e46f(++_0x41b032);}(_0x81dc,0xef));var _0xc81d=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x81dc[_0x34f701];return _0x3e2429;};'use strict';var multer=require('multer');var util=require(_0xc81d('0x0'));var path=require(_0xc81d('0x1'));var timeout=require(_0xc81d('0x2'));var express=require(_0xc81d('0x3'));var router=express[_0xc81d('0x4')]();var fs_extra=require(_0xc81d('0x5'));var auth=require(_0xc81d('0x6'));var interaction=require(_0xc81d('0x7'));var config=require(_0xc81d('0x8'));var controller=require(_0xc81d('0x9'));router[_0xc81d('0xa')]('/',auth[_0xc81d('0xb')](),controller[_0xc81d('0xc')]);router[_0xc81d('0xa')](_0xc81d('0xd'),controller[_0xc81d('0xe')]);router[_0xc81d('0xa')](_0xc81d('0xf'),controller[_0xc81d('0x10')]);router[_0xc81d('0xa')](_0xc81d('0x11'),controller[_0xc81d('0x12')]);router[_0xc81d('0xa')](_0xc81d('0x13'),controller[_0xc81d('0x14')]);router['get'](_0xc81d('0x15'),controller[_0xc81d('0x16')]);router[_0xc81d('0xa')](_0xc81d('0x17'),controller['getPreferred']);router[_0xc81d('0xa')](_0xc81d('0x18'),controller[_0xc81d('0x19')]);var upload=multer({'storage':multer[_0xc81d('0x1a')]({'destination':function(_0x314b0e,_0x507c2f,_0x1aa4c7){_0x1aa4c7(null,path['join'](config[_0xc81d('0x1b')],'server/files/images/logos/'));},'filename':function(_0x22bcc1,_0x5d92a9,_0x72357c){_0x72357c(null,util['format'](_0xc81d('0x1c'),_0xc81d('0x1d'),path[_0xc81d('0x1e')](_0x5d92a9[_0xc81d('0x1f')])));}})});router[_0xc81d('0x20')](_0xc81d('0x11'),upload[_0xc81d('0x21')](_0xc81d('0x22')),controller[_0xc81d('0x23')]);var upload=multer({'storage':multer[_0xc81d('0x1a')]({'destination':function(_0x56c96b,_0x578204,_0x6d86f5){_0x6d86f5(null,path[_0xc81d('0x24')](config[_0xc81d('0x1b')],_0xc81d('0x25')));},'filename':function(_0xd04b6a,_0x283cfc,_0x3568bd){_0x3568bd(null,util[_0xc81d('0x26')](_0xc81d('0x1c'),_0xc81d('0x27'),path[_0xc81d('0x1e')](_0x283cfc[_0xc81d('0x1f')])));}})});router[_0xc81d('0x20')](_0xc81d('0x13'),upload[_0xc81d('0x21')](_0xc81d('0x22')),controller[_0xc81d('0x28')]);var upload=multer({'storage':multer[_0xc81d('0x1a')]({'destination':function(_0x45881a,_0x550fa8,_0x44ba23){_0x44ba23(null,path[_0xc81d('0x24')](config[_0xc81d('0x1b')],_0xc81d('0x25')));},'filename':function(_0x392b7a,_0xc23bb8,_0x25818b){_0x25818b(null,util['format'](_0xc81d('0x1c'),_0xc81d('0x29'),path[_0xc81d('0x1e')](_0xc23bb8[_0xc81d('0x1f')])));}})});router[_0xc81d('0x20')]('/:id/preferred',upload[_0xc81d('0x21')](_0xc81d('0x22')),controller[_0xc81d('0x2a')]);var upload=multer({'storage':multer[_0xc81d('0x1a')]({'destination':function(_0x12d5e0,_0x199035,_0x2df4f3){_0x2df4f3(null,path[_0xc81d('0x24')](config[_0xc81d('0x1b')],_0xc81d('0x25')));},'filename':function(_0xfe694d,_0x1214bd,_0x1eeae7){_0x1eeae7(null,util['format']('%s%s',_0xc81d('0x2b'),path[_0xc81d('0x1e')](_0x1214bd[_0xc81d('0x1f')])));}})});router[_0xc81d('0x20')](_0xc81d('0x18'),upload[_0xc81d('0x21')](_0xc81d('0x22')),controller[_0xc81d('0x2c')]);router[_0xc81d('0x2d')]('/:id',auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x574e=['getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','join','/:id/logo_login','addLogoLogin','addPreferred','favicon','put','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getDate','/:id','show','/:id/logo'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x574e,0x1de));var _0xe574=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x574e[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0xe574('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe574('0x1'));var express=require(_0xe574('0x2'));var router=express[_0xe574('0x3')]();var fs_extra=require(_0xe574('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe574('0x5'));var config=require(_0xe574('0x6'));var controller=require('./setting.controller');router[_0xe574('0x7')]('/',auth[_0xe574('0x8')](),controller[_0xe574('0x9')]);router[_0xe574('0x7')]('/now',controller[_0xe574('0xa')]);router[_0xe574('0x7')](_0xe574('0xb'),controller[_0xe574('0xc')]);router[_0xe574('0x7')](_0xe574('0xd'),controller[_0xe574('0xe')]);router['get']('/:id/logo_login',controller[_0xe574('0xf')]);router[_0xe574('0x7')](_0xe574('0x10'),controller[_0xe574('0x11')]);router['get'](_0xe574('0x12'),controller['getPreferred']);router[_0xe574('0x7')](_0xe574('0x13'),controller[_0xe574('0x14')]);var upload=multer({'storage':multer[_0xe574('0x15')]({'destination':function(_0x16e1b5,_0x5ae54d,_0x2e6668){_0x2e6668(null,path['join'](config[_0xe574('0x16')],_0xe574('0x17')));},'filename':function(_0x452c3c,_0x42a81f,_0x4d0cf2){_0x4d0cf2(null,util[_0xe574('0x18')](_0xe574('0x19'),_0xe574('0x1a'),path[_0xe574('0x1b')](_0x42a81f[_0xe574('0x1c')])));}})});router[_0xe574('0x1d')]('/:id/logo',upload[_0xe574('0x1e')](_0xe574('0x1f')),controller[_0xe574('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5666db,_0x31b25b,_0x286373){_0x286373(null,path[_0xe574('0x21')](config[_0xe574('0x16')],'server/files/images/logos/'));},'filename':function(_0x5551f1,_0x1020c0,_0x408e32){_0x408e32(null,util['format'](_0xe574('0x19'),'logologin',path[_0xe574('0x1b')](_0x1020c0[_0xe574('0x1c')])));}})});router['post'](_0xe574('0x22'),upload[_0xe574('0x1e')](_0xe574('0x1f')),controller[_0xe574('0x23')]);var upload=multer({'storage':multer[_0xe574('0x15')]({'destination':function(_0x3d52c8,_0x3a11f5,_0x31213e){_0x31213e(null,path['join'](config[_0xe574('0x16')],_0xe574('0x17')));},'filename':function(_0x1602bc,_0x4ad13e,_0x54e648){_0x54e648(null,util[_0xe574('0x18')](_0xe574('0x19'),'preferred',path[_0xe574('0x1b')](_0x4ad13e[_0xe574('0x1c')])));}})});router[_0xe574('0x1d')](_0xe574('0x12'),upload[_0xe574('0x1e')]('file'),controller[_0xe574('0x24')]);var upload=multer({'storage':multer[_0xe574('0x15')]({'destination':function(_0x58ff1a,_0x52f35,_0x1828fa){_0x1828fa(null,path['join'](config[_0xe574('0x16')],'server/files/images/logos/'));},'filename':function(_0xe46602,_0x29f630,_0x1540c7){_0x1540c7(null,util[_0xe574('0x18')](_0xe574('0x19'),_0xe574('0x25'),path['extname'](_0x29f630['originalname'])));}})});router['post'](_0xe574('0x13'),upload['single'](_0xe574('0x1f')),controller['addFavicon']);router[_0xe574('0x26')](_0xe574('0xb'),auth[_0xe574('0x8')](),controller[_0xe574('0x27')]);module[_0xe574('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 22a16b2..b48ac7e 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 _0x32e8=['STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize','INTEGER','min_internal','min_mailbox'];(function(_0x34c7bc,_0x47d8f3){var _0x522052=function(_0x49885b){while(--_0x49885b){_0x34c7bc['push'](_0x34c7bc['shift']());}};_0x522052(++_0x47d8f3);}(_0x32e8,0x137));var _0x832e=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0x32e8[_0x4b5813];return _0x423465;};'use strict';var Sequelize=require(_0x832e('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x832e('0x1')](0xb),'unique':_0x832e('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x832e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x832e('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x832e('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x832e('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x832e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x832e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x832e('0x4')]},'turnaddr':{'type':Sequelize[_0x832e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x832e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x832e('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x832e('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x832e('0x4')],'defaultValue':_0x832e('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x832e('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x832e('0x4')]},'defaultPreferred':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x832e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x832e('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x832e('0x1')]},'transcribeRegion':{'type':Sequelize[_0x832e('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x832e('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x832e('0x4')]},'bucket':{'type':Sequelize[_0x832e('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x832e('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x832e('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x832e('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x832e('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x832e('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x832e('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x832e('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xd16a=['UNSIGNED','sequelize','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate'];(function(_0x463ccd,_0x2de72b){var _0x1d04eb=function(_0x7dd8ef){while(--_0x7dd8ef){_0x463ccd['push'](_0x463ccd['shift']());}};_0x1d04eb(++_0x2de72b);}(_0xd16a,0x121));var _0xad16=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd16a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xad16('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xad16('0x1')](0xb),'unique':_0xad16('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xad16('0x1')](0xb),'unique':_0xad16('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xad16('0x4')],'defaultValue':_0xad16('0x5')},'logo':{'type':Sequelize[_0xad16('0x4')]},'defaultLogo':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xad16('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xad16('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xad16('0x4')]},'turnaddr':{'type':Sequelize[_0xad16('0x4')]},'turnusername':{'type':Sequelize[_0xad16('0x4')]},'turnpassword':{'type':Sequelize[_0xad16('0x4')]},'pageTitle':{'type':Sequelize[_0xad16('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xad16('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xad16('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xad16('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xad16('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xad16('0x4')]},'defaultPreferred':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xad16('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xad16('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xad16('0x4')]},'defaultFavicon':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xad16('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xad16('0x1')]},'transcribeRegion':{'type':Sequelize[_0xad16('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xad16('0x1')]},'sentimentRegion':{'type':Sequelize[_0xad16('0x4')]},'language':{'type':Sequelize[_0xad16('0x4')]},'bucket':{'type':Sequelize[_0xad16('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xad16('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xad16('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0xad16('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xad16('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xad16('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xad16('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xad16('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xad16('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xad16('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xad16('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index c03a6aa..55f9b1c 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 _0x8a13=['error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','apply','save','update','end','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','options','includeAll','include','rows','catch','show','body','find','file','filename','logo','params','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','default','custom','Sequelize','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','favicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x263fcc,_0x38c118){var _0x25a0a1=function(_0x5af6b2){while(--_0x5af6b2){_0x263fcc['push'](_0x263fcc['shift']());}};_0x25a0a1(++_0x38c118);}(_0x8a13,0xd6));var _0x38a1=function(_0x53f0db,_0x35c67c){_0x53f0db=_0x53f0db-0x0;var _0xae0a5c=_0x8a13[_0x53f0db];return _0xae0a5c;};'use strict';var emlformat=require(_0x38a1('0x0'));var rimraf=require(_0x38a1('0x1'));var zipdir=require(_0x38a1('0x2'));var jsonpatch=require(_0x38a1('0x3'));var rp=require(_0x38a1('0x4'));var moment=require(_0x38a1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x38a1('0x6'));var util=require(_0x38a1('0x7'));var path=require(_0x38a1('0x8'));var sox=require(_0x38a1('0x9'));var csv=require(_0x38a1('0xa'));var ejs=require(_0x38a1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x38a1('0xc'));var crypto=require(_0x38a1('0xd'));var jsforce=require(_0x38a1('0xe'));var deskjs=require(_0x38a1('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x38a1('0x10'));var Redis=require('ioredis');var authService=require(_0x38a1('0x11'));var qs=require(_0x38a1('0x12'));var as=require(_0x38a1('0x13'));var hardwareService=require(_0x38a1('0x14'));var logger=require(_0x38a1('0x15'))(_0x38a1('0x16'));var utils=require(_0x38a1('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x38a1('0x18'))['db'];var jayson=require(_0x38a1('0x19'));var client=jayson[_0x38a1('0x1a')][_0x38a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3f2bba,_0x9278d,_0x339d87,_0x31eb8d){return new BPromise(function(_0x507b7d,_0x3fd09d){var _0x24fa88=_0x31eb8d||client;return _0x24fa88[_0x38a1('0x1c')](_0x3f2bba,_0x339d87)[_0x38a1('0x1d')](function(_0x382938){logger[_0x38a1('0x1e')](_0x38a1('0x1f'),_0x9278d,'request\x20sent');logger[_0x38a1('0x20')](_0x38a1('0x21'),_0x9278d,_0x38a1('0x22'),JSON[_0x38a1('0x23')](_0x382938));if(_0x382938[_0x38a1('0x24')]){if(_0x382938[_0x38a1('0x24')][_0x38a1('0x25')]===0x1f4){logger[_0x38a1('0x24')](_0x38a1('0x1f'),_0x9278d,_0x382938['error'][_0x38a1('0x26')]);return _0x3fd09d(_0x382938[_0x38a1('0x24')][_0x38a1('0x26')]);}logger[_0x38a1('0x24')](_0x38a1('0x1f'),_0x9278d,_0x382938[_0x38a1('0x24')]['message']);return _0x507b7d(_0x382938[_0x38a1('0x24')][_0x38a1('0x26')]);}else{logger['info'](_0x38a1('0x1f'),_0x9278d,'request\x20sent');_0x507b7d(_0x382938[_0x38a1('0x27')]['message']);}})['catch'](function(_0x10a4ca){logger[_0x38a1('0x24')](_0x38a1('0x1f'),_0x9278d,_0x10a4ca);_0x3fd09d(_0x10a4ca);});});}function respondWithStatusCode(_0x4d3dcc,_0x5a0f18){_0x5a0f18=_0x5a0f18||0xcc;return function(_0x56b8a7){if(_0x56b8a7){return _0x4d3dcc[_0x38a1('0x28')](_0x5a0f18);}return _0x4d3dcc[_0x38a1('0x29')](_0x5a0f18)['end']();};}function respondWithResult(_0x325d6d,_0x1d15e1){_0x1d15e1=_0x1d15e1||0xc8;return function(_0x34737c){if(_0x34737c){return _0x325d6d['status'](_0x1d15e1)[_0x38a1('0x2a')](_0x34737c);}};}function respondWithFilteredResult(_0x5469d1,_0x147b56){return function(_0x870241){if(_0x870241){var _0x11c95c=typeof _0x147b56[_0x38a1('0x2b')]===_0x38a1('0x2c')&&typeof _0x147b56[_0x38a1('0x2d')]===_0x38a1('0x2c');var _0x587db1=_0x870241[_0x38a1('0x2e')];var _0x2ed540=_0x11c95c?0x0:_0x147b56[_0x38a1('0x2b')];var _0x4da6cd=_0x11c95c?_0x870241[_0x38a1('0x2e')]:_0x147b56[_0x38a1('0x2b')]+_0x147b56[_0x38a1('0x2d')];var _0x6ecdb3;if(_0x4da6cd>=_0x587db1){_0x4da6cd=_0x587db1;_0x6ecdb3=0xc8;}else{_0x6ecdb3=0xce;}_0x5469d1['status'](_0x6ecdb3);return _0x5469d1['set']('Content-Range',_0x2ed540+'-'+_0x4da6cd+'/'+_0x587db1)[_0x38a1('0x2a')](_0x870241);}return null;};}function patchUpdates(_0xcf853c){return function(_0x3972fe){try{jsonpatch[_0x38a1('0x2f')](_0x3972fe,_0xcf853c,!![]);}catch(_0x40b793){return BPromise['reject'](_0x40b793);}return _0x3972fe[_0x38a1('0x30')]();};}function saveUpdates(_0x274155,_0x513cbc){return function(_0x27cf25){if(_0x27cf25){return _0x27cf25[_0x38a1('0x31')](_0x274155)[_0x38a1('0x1d')](function(_0x36f70f){return _0x36f70f;});}return null;};}function removeEntity(_0x35302f,_0x57c3c5){return function(_0x5b8bd0){if(_0x5b8bd0){return _0x5b8bd0['destroy']()[_0x38a1('0x1d')](function(){_0x35302f[_0x38a1('0x29')](0xcc)[_0x38a1('0x32')]();});}};}function handleEntityNotFound(_0x331f30,_0x2a9c38){return function(_0x7f0441){if(!_0x7f0441){_0x331f30['sendStatus'](0x194);}return _0x7f0441;};}function handleError(_0x276153,_0x58ebd4){_0x58ebd4=_0x58ebd4||0x1f4;return function(_0x26baff){logger['error'](_0x26baff[_0x38a1('0x33')]);if(_0x26baff[_0x38a1('0x34')]){delete _0x26baff[_0x38a1('0x34')];}_0x276153['status'](_0x58ebd4)[_0x38a1('0x35')](_0x26baff);};}exports[_0x38a1('0x36')]=function(_0x2881cb,_0x2f26e3){var _0x271473={},_0x4eb0ee={},_0x306ac1={'count':0x0,'rows':[]};var _0x470972=_[_0x38a1('0x37')](db[_0x38a1('0x38')][_0x38a1('0x39')],function(_0x5aebc9){return{'name':_0x5aebc9[_0x38a1('0x3a')],'type':_0x5aebc9[_0x38a1('0x3b')][_0x38a1('0x3c')]};});_0x4eb0ee[_0x38a1('0x3d')]=_['map'](_0x470972,'name');_0x4eb0ee[_0x38a1('0x3e')]=_[_0x38a1('0x3f')](_0x2881cb['query']);_0x4eb0ee['filters']=_['intersection'](_0x4eb0ee['model'],_0x4eb0ee[_0x38a1('0x3e')]);_0x271473[_0x38a1('0x40')]=_[_0x38a1('0x41')](_0x4eb0ee['model'],qs[_0x38a1('0x42')](_0x2881cb[_0x38a1('0x3e')][_0x38a1('0x42')]));_0x271473['attributes']=_0x271473[_0x38a1('0x40')][_0x38a1('0x43')]?_0x271473['attributes']:_0x4eb0ee['model'];if(!_0x2881cb[_0x38a1('0x3e')][_0x38a1('0x44')](_0x38a1('0x45'))){_0x271473[_0x38a1('0x2d')]=qs[_0x38a1('0x2d')](_0x2881cb[_0x38a1('0x3e')][_0x38a1('0x2d')]);_0x271473[_0x38a1('0x2b')]=qs['offset'](_0x2881cb[_0x38a1('0x3e')][_0x38a1('0x2b')]);}_0x271473[_0x38a1('0x46')]=qs[_0x38a1('0x47')](_0x2881cb[_0x38a1('0x3e')][_0x38a1('0x47')]);_0x271473[_0x38a1('0x48')]=qs[_0x38a1('0x49')](_['pick'](_0x2881cb['query'],_0x4eb0ee[_0x38a1('0x49')]),_0x470972);if(_0x2881cb[_0x38a1('0x3e')][_0x38a1('0x4a')]){_0x271473['where']=_['merge'](_0x271473[_0x38a1('0x48')],{'$or':_['map'](_0x470972,function(_0x2b5694){if(_0x2b5694[_0x38a1('0x3b')]!=='VIRTUAL'){var _0x58d4b4={};_0x58d4b4[_0x2b5694[_0x38a1('0x34')]]={'$like':'%'+_0x2881cb['query'][_0x38a1('0x4a')]+'%'};return _0x58d4b4;}})});}_0x271473=_['merge']({},_0x271473,_0x2881cb[_0x38a1('0x4b')]);var _0x4db067={'where':_0x271473[_0x38a1('0x48')]};return db[_0x38a1('0x38')]['count'](_0x4db067)[_0x38a1('0x1d')](function(_0x40cb14){_0x306ac1['count']=_0x40cb14;if(_0x2881cb[_0x38a1('0x3e')][_0x38a1('0x4c')]){_0x271473[_0x38a1('0x4d')]=[{'all':!![]}];}return db[_0x38a1('0x38')]['findAll'](_0x271473);})[_0x38a1('0x1d')](function(_0x481dd7){_0x306ac1[_0x38a1('0x4e')]=_0x481dd7;return _0x306ac1;})[_0x38a1('0x1d')](respondWithFilteredResult(_0x2f26e3,_0x271473))[_0x38a1('0x4f')](handleError(_0x2f26e3,null));};exports[_0x38a1('0x50')]=function(_0x283d63,_0x28f33f){var _0x500c61={'raw':![],'where':{'id':_0x283d63['params']['id']}},_0xa946a1={};_0xa946a1[_0x38a1('0x3d')]=_[_0x38a1('0x3f')](db['Setting'][_0x38a1('0x39')]);_0xa946a1[_0x38a1('0x3e')]=_['keys'](_0x283d63['query']);_0xa946a1[_0x38a1('0x49')]=_[_0x38a1('0x41')](_0xa946a1['model'],_0xa946a1['query']);_0x500c61[_0x38a1('0x40')]=_[_0x38a1('0x41')](_0xa946a1[_0x38a1('0x3d')],qs[_0x38a1('0x42')](_0x283d63[_0x38a1('0x3e')][_0x38a1('0x42')]));_0x500c61[_0x38a1('0x40')]=_0x500c61[_0x38a1('0x40')][_0x38a1('0x43')]?_0x500c61[_0x38a1('0x40')]:_0xa946a1[_0x38a1('0x3d')];if(_0x283d63[_0x38a1('0x3e')][_0x38a1('0x4c')]){_0x500c61['include']=[{'all':!![]}];}_0x500c61=_['merge']({},_0x500c61,_0x283d63[_0x38a1('0x4b')]);return db[_0x38a1('0x38')]['find'](_0x500c61)[_0x38a1('0x1d')](handleEntityNotFound(_0x28f33f,null))['then'](respondWithResult(_0x28f33f,null))[_0x38a1('0x4f')](handleError(_0x28f33f,null));};exports[_0x38a1('0x31')]=function(_0x3e8cc6,_0x5c1589){if(_0x3e8cc6[_0x38a1('0x51')]['id']){delete _0x3e8cc6[_0x38a1('0x51')]['id'];}return db[_0x38a1('0x38')][_0x38a1('0x52')]({'where':{'id':_0x3e8cc6['params']['id']}})[_0x38a1('0x1d')](handleEntityNotFound(_0x5c1589,null))[_0x38a1('0x1d')](saveUpdates(_0x3e8cc6['body'],null))[_0x38a1('0x1d')](respondWithResult(_0x5c1589,null))[_0x38a1('0x4f')](handleError(_0x5c1589,null));};exports['addLogo']=function(_0x4153ef,_0x401e69,_0xf573cd){if(_0x4153ef[_0x38a1('0x53')]&&_0x4153ef['file'][_0x38a1('0x54')]){_0x4153ef[_0x38a1('0x51')][_0x38a1('0x55')]=_0x4153ef[_0x38a1('0x53')]['filename'];}return db['Setting']['find']({'where':{'id':_0x4153ef[_0x38a1('0x56')]['id']}})[_0x38a1('0x1d')](handleEntityNotFound(_0x401e69,null))[_0x38a1('0x1d')](saveUpdates(_0x4153ef[_0x38a1('0x51')],null))['then'](respondWithResult(_0x401e69,null))[_0x38a1('0x4f')](handleError(_0x401e69,null));};exports[_0x38a1('0x57')]=function(_0x1e99ed,_0x4001c,_0xa4ec6e){if(_0x1e99ed[_0x38a1('0x53')]&&_0x1e99ed[_0x38a1('0x53')][_0x38a1('0x54')]){_0x1e99ed[_0x38a1('0x51')][_0x38a1('0x58')]=_0x1e99ed[_0x38a1('0x53')][_0x38a1('0x54')];}return db['Setting'][_0x38a1('0x52')]({'where':{'id':_0x1e99ed[_0x38a1('0x56')]['id']}})[_0x38a1('0x1d')](handleEntityNotFound(_0x4001c,null))[_0x38a1('0x1d')](saveUpdates(_0x1e99ed['body'],null))['then'](respondWithResult(_0x4001c,null))['catch'](handleError(_0x4001c,null));};var utilLicense=require(_0x38a1('0x59'));exports[_0x38a1('0x5a')]=function(_0x3c3d2d,_0x124f13,_0x41452e){var _0x2e8254=_0x38a1('0x5b');var _0x4d78eb={'custom':![]};return utilLicense[_0x38a1('0x5c')]()[_0x38a1('0x1d')](function(_0x367e14){if(_0x367e14){_0x4d78eb=_0x367e14;}return db[_0x38a1('0x38')][_0x38a1('0x52')]({'where':{'id':_0x3c3d2d['params']['id']},'attributes':[_0x38a1('0x55'),_0x38a1('0x58'),_0x38a1('0x5d'),'favicon',_0x38a1('0x5e'),_0x38a1('0x5f'),_0x38a1('0x60'),_0x38a1('0x61')],'raw':!![]});})[_0x38a1('0x1d')](handleEntityNotFound(_0x124f13,null))[_0x38a1('0x1d')](function(_0x565e60){if(_0x565e60){var _0x42971f=_0x565e60[_0x38a1('0x55')]&&fs[_0x38a1('0x62')](path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x2e8254,_['toLower'](_0x565e60['logo'])))?path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x2e8254,_[_0x38a1('0x65')](_0x565e60['logo'])):path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x2e8254,_['toLower'](_0x38a1('0x66')));var _0x463225='default'+_[_0x38a1('0x67')]('logo');if(_0x565e60[_0x463225]||!_0x4d78eb['custom']){_0x42971f=path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x2e8254,_['toLower'](_0x38a1('0x66')));}if(!fs[_0x38a1('0x62')](_0x42971f)){throw new db['Sequelize'][(_0x38a1('0x68'))](_[_0x38a1('0x67')]('logo')+_0x38a1('0x69'));}return _0x124f13[_0x38a1('0x6a')](_0x42971f);}})[_0x38a1('0x4f')](handleError(_0x124f13,null));};var utilLicense=require(_0x38a1('0x59'));exports[_0x38a1('0x6b')]=function(_0x5f4a1c,_0x3544dc,_0x59539a){var _0x2b5fe1='server/files/images/logos';var _0x2e876b={'custom':![]};return utilLicense[_0x38a1('0x5c')]()['then'](function(_0x2a0e5b){if(_0x2a0e5b){_0x2e876b=_0x2a0e5b;}return db['Setting'][_0x38a1('0x52')]({'where':{'id':_0x5f4a1c[_0x38a1('0x56')]['id']},'attributes':[_0x38a1('0x55'),'loginLogo','preferred','favicon',_0x38a1('0x5e'),'defaultLoginLogo',_0x38a1('0x60'),_0x38a1('0x61')],'raw':!![]});})[_0x38a1('0x1d')](handleEntityNotFound(_0x3544dc,null))[_0x38a1('0x1d')](function(_0x170ff1){if(_0x170ff1){var _0x7aeea6=_0x170ff1[_0x38a1('0x58')]&&fs[_0x38a1('0x62')](path[_0x38a1('0x63')](config['root'],_0x2b5fe1,_[_0x38a1('0x65')](_0x170ff1[_0x38a1('0x58')])))?path[_0x38a1('0x63')](config['root'],_0x2b5fe1,_['toLower'](_0x170ff1[_0x38a1('0x58')])):path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x2b5fe1,_[_0x38a1('0x65')](_0x38a1('0x6c')));var _0x175282=_0x38a1('0x6d')+_[_0x38a1('0x67')](_0x38a1('0x58'));if(_0x170ff1[_0x175282]||!_0x2e876b[_0x38a1('0x6e')]){_0x7aeea6=path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x2b5fe1,_[_0x38a1('0x65')](_0x38a1('0x6c')));}if(!fs['existsSync'](_0x7aeea6)){throw new db[(_0x38a1('0x6f'))][(_0x38a1('0x68'))](_[_0x38a1('0x67')]('loginLogo')+'\x20not\x20found');}return _0x3544dc[_0x38a1('0x6a')](_0x7aeea6);}})[_0x38a1('0x4f')](handleError(_0x3544dc,null));};exports[_0x38a1('0x70')]=function(_0x1e8496,_0x58ec41){return db[_0x38a1('0x38')][_0x38a1('0x52')]({'where':{'id':_0x1e8496['params']['id']},'attributes':[_0x38a1('0x71')]})['then'](respondWithResult(_0x58ec41,null))['catch'](handleError(_0x58ec41,null));};exports[_0x38a1('0x72')]=function(_0x1fdc13,_0x38f9ca,_0x530b75){if(_0x1fdc13['file']&&_0x1fdc13['file'][_0x38a1('0x54')]){_0x1fdc13['body'][_0x38a1('0x5d')]=_0x1fdc13[_0x38a1('0x53')][_0x38a1('0x54')];}return db[_0x38a1('0x38')][_0x38a1('0x52')]({'where':{'id':_0x1fdc13['params']['id']}})[_0x38a1('0x1d')](handleEntityNotFound(_0x38f9ca,null))[_0x38a1('0x1d')](saveUpdates(_0x1fdc13[_0x38a1('0x51')],null))[_0x38a1('0x1d')](respondWithResult(_0x38f9ca,null))[_0x38a1('0x4f')](handleError(_0x38f9ca,null));};var utilLicense=require(_0x38a1('0x59'));exports['getPreferred']=function(_0x726796,_0x12051f,_0x5e0792){var _0x17334b=_0x38a1('0x5b');var _0x12ae6c={'custom':![]};return utilLicense[_0x38a1('0x5c')]()['then'](function(_0x17d0d2){if(_0x17d0d2){_0x12ae6c=_0x17d0d2;}return db[_0x38a1('0x38')][_0x38a1('0x52')]({'where':{'id':_0x726796[_0x38a1('0x56')]['id']},'attributes':[_0x38a1('0x55'),'loginLogo',_0x38a1('0x5d'),'favicon',_0x38a1('0x5e'),'defaultLoginLogo','defaultPreferred',_0x38a1('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x12051f,null))[_0x38a1('0x1d')](function(_0x46c419){if(_0x46c419){var _0x417395=_0x46c419[_0x38a1('0x5d')]&&fs['existsSync'](path['join'](config[_0x38a1('0x64')],_0x17334b,_['toLower'](_0x46c419[_0x38a1('0x5d')])))?path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x17334b,_[_0x38a1('0x65')](_0x46c419[_0x38a1('0x5d')])):path[_0x38a1('0x63')](config[_0x38a1('0x64')],_0x17334b,_[_0x38a1('0x65')](_0x38a1('0x73')));var _0xcd73e3=_0x38a1('0x6d')+_['upperFirst'](_0x38a1('0x5d'));if(_0x46c419[_0xcd73e3]||!_0x12ae6c[_0x38a1('0x6e')]||!_0x12ae6c[_0x38a1('0x5d')]){_0x417395=path[_0x38a1('0x63')](config['root'],_0x17334b,_[_0x38a1('0x65')]('default_preferred.png'));}if(!fs['existsSync'](_0x417395)){throw new db[(_0x38a1('0x6f'))][(_0x38a1('0x68'))](_[_0x38a1('0x67')](_0x38a1('0x5d'))+_0x38a1('0x69'));}return _0x12051f[_0x38a1('0x6a')](_0x417395);}})[_0x38a1('0x4f')](handleError(_0x12051f,null));};exports[_0x38a1('0x74')]=function(_0x52b0d7,_0x15c027,_0xc05a0c){if(_0x52b0d7[_0x38a1('0x53')]&&_0x52b0d7[_0x38a1('0x53')]['filename']){_0x52b0d7[_0x38a1('0x51')]['favicon']=_0x52b0d7[_0x38a1('0x53')][_0x38a1('0x54')];}return db[_0x38a1('0x38')]['find']({'where':{'id':_0x52b0d7[_0x38a1('0x56')]['id']}})[_0x38a1('0x1d')](handleEntityNotFound(_0x15c027,null))[_0x38a1('0x1d')](saveUpdates(_0x52b0d7['body'],null))[_0x38a1('0x1d')](respondWithResult(_0x15c027,null))[_0x38a1('0x4f')](handleError(_0x15c027,null));};var utilLicense=require(_0x38a1('0x59'));exports[_0x38a1('0x75')]=function(_0xcbfd02,_0x4dbdc9,_0x10d584){var _0x6324c7='server/files/images/logos';var _0x5653ef={'custom':![]};return utilLicense[_0x38a1('0x5c')]()['then'](function(_0x1480af){if(_0x1480af){_0x5653ef=_0x1480af;}return db[_0x38a1('0x38')]['find']({'where':{'id':_0xcbfd02[_0x38a1('0x56')]['id']},'attributes':['logo',_0x38a1('0x58'),_0x38a1('0x5d'),'favicon',_0x38a1('0x5e'),_0x38a1('0x5f'),_0x38a1('0x60'),_0x38a1('0x61')],'raw':!![]});})[_0x38a1('0x1d')](handleEntityNotFound(_0x4dbdc9,null))[_0x38a1('0x1d')](function(_0x522af4){if(_0x522af4){var _0x32239c=_0x522af4[_0x38a1('0x76')]&&fs[_0x38a1('0x62')](path[_0x38a1('0x63')](config['root'],_0x6324c7,_[_0x38a1('0x65')](_0x522af4[_0x38a1('0x76')])))?path['join'](config[_0x38a1('0x64')],_0x6324c7,_[_0x38a1('0x65')](_0x522af4['favicon'])):path['join'](config[_0x38a1('0x64')],_0x6324c7,_[_0x38a1('0x65')](_0x38a1('0x77')));var _0x54f7ee=_0x38a1('0x6d')+_[_0x38a1('0x67')](_0x38a1('0x76'));if(_0x522af4[_0x54f7ee]||!_0x5653ef['custom']){_0x32239c=path['join'](config['root'],_0x6324c7,_[_0x38a1('0x65')](_0x38a1('0x77')));}if(!fs['existsSync'](_0x32239c)){throw new db['Sequelize']['ValidationError'](_[_0x38a1('0x67')](_0x38a1('0x76'))+'\x20not\x20found');}return _0x4dbdc9[_0x38a1('0x6a')](_0x32239c);}})[_0x38a1('0x4f')](handleError(_0x4dbdc9,null));};exports[_0x38a1('0x78')]=function(_0x26aac7,_0x3c518c){var _0x6b1260={'offset':moment()['utcOffset']()};_0x6b1260[_0x38a1('0x79')]=moment()[_0x38a1('0x7a')](_0x6b1260[_0x38a1('0x2b')])[_0x38a1('0x7b')](_0x38a1('0x7c'));return _0x3c518c[_0x38a1('0x29')](0xc8)['send'](_0x6b1260);}; \ No newline at end of file +var _0xfda0=['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','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','end','send','index','map','Setting','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','length','find','body','params','addLogo','file','filename','addLogoLogin','loginLogo','server/files/images/logos','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','getLicense','defaultPreferred','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x36c571,_0x11d7f3){var _0x2c69c3=function(_0x2120bf){while(--_0x2120bf){_0x36c571['push'](_0x36c571['shift']());}};_0x2c69c3(++_0x11d7f3);}(_0xfda0,0xee));var _0x0fda=function(_0x312558,_0x3e70a2){_0x312558=_0x312558-0x0;var _0x2060ab=_0xfda0[_0x312558];return _0x2060ab;};'use strict';var emlformat=require(_0x0fda('0x0'));var rimraf=require(_0x0fda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0fda('0x2'));var moment=require(_0x0fda('0x3'));var BPromise=require(_0x0fda('0x4'));var Mustache=require(_0x0fda('0x5'));var util=require(_0x0fda('0x6'));var path=require(_0x0fda('0x7'));var sox=require(_0x0fda('0x8'));var csv=require(_0x0fda('0x9'));var ejs=require(_0x0fda('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fda('0xb'));var squel=require(_0x0fda('0xc'));var crypto=require(_0x0fda('0xd'));var jsforce=require(_0x0fda('0xe'));var deskjs=require(_0x0fda('0xf'));var toCsv=require(_0x0fda('0x9'));var querystring=require('querystring');var Papa=require(_0x0fda('0x10'));var Redis=require('ioredis');var authService=require(_0x0fda('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0fda('0x12'));var hardwareService=require(_0x0fda('0x13'));var logger=require(_0x0fda('0x14'))(_0x0fda('0x15'));var utils=require(_0x0fda('0x16'));var config=require(_0x0fda('0x17'));var licenseUtil=require(_0x0fda('0x18'));var db=require(_0x0fda('0x19'))['db'];var jayson=require(_0x0fda('0x1a'));var client=jayson[_0x0fda('0x1b')][_0x0fda('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1c076d,_0x4523e7,_0xc7f16d,_0x3096fa){return new BPromise(function(_0x54ed72,_0x432a0c){var _0x854d59=_0x3096fa||client;return _0x854d59[_0x0fda('0x1d')](_0x1c076d,_0xc7f16d)[_0x0fda('0x1e')](function(_0x3f31e0){logger['info'](_0x0fda('0x1f'),_0x4523e7,_0x0fda('0x20'));logger[_0x0fda('0x21')](_0x0fda('0x22'),_0x4523e7,_0x0fda('0x20'),JSON['stringify'](_0x3f31e0));if(_0x3f31e0[_0x0fda('0x23')]){if(_0x3f31e0[_0x0fda('0x23')]['code']===0x1f4){logger[_0x0fda('0x23')](_0x0fda('0x1f'),_0x4523e7,_0x3f31e0[_0x0fda('0x23')]['message']);return _0x432a0c(_0x3f31e0[_0x0fda('0x23')][_0x0fda('0x24')]);}logger[_0x0fda('0x23')](_0x0fda('0x1f'),_0x4523e7,_0x3f31e0['error'][_0x0fda('0x24')]);return _0x54ed72(_0x3f31e0['error'][_0x0fda('0x24')]);}else{logger[_0x0fda('0x25')](_0x0fda('0x1f'),_0x4523e7,_0x0fda('0x20'));_0x54ed72(_0x3f31e0[_0x0fda('0x26')][_0x0fda('0x24')]);}})[_0x0fda('0x27')](function(_0x250420){logger[_0x0fda('0x23')](_0x0fda('0x1f'),_0x4523e7,_0x250420);_0x432a0c(_0x250420);});});}function respondWithStatusCode(_0x399ee3,_0x469568){_0x469568=_0x469568||0xcc;return function(_0x123210){if(_0x123210){return _0x399ee3[_0x0fda('0x28')](_0x469568);}return _0x399ee3['status'](_0x469568)['end']();};}function respondWithResult(_0x234a80,_0x4653da){_0x4653da=_0x4653da||0xc8;return function(_0x37e0ae){if(_0x37e0ae){return _0x234a80[_0x0fda('0x29')](_0x4653da)['json'](_0x37e0ae);}};}function respondWithFilteredResult(_0x2d0e33,_0x27b549){return function(_0x37796e){if(_0x37796e){var _0xc1a305=typeof _0x27b549[_0x0fda('0x2a')]===_0x0fda('0x2b')&&typeof _0x27b549['limit']===_0x0fda('0x2b');var _0x403c9c=_0x37796e[_0x0fda('0x2c')];var _0x3a5107=_0xc1a305?0x0:_0x27b549[_0x0fda('0x2a')];var _0x1f2dfb=_0xc1a305?_0x37796e['count']:_0x27b549['offset']+_0x27b549[_0x0fda('0x2d')];var _0x2528e9;if(_0x1f2dfb>=_0x403c9c){_0x1f2dfb=_0x403c9c;_0x2528e9=0xc8;}else{_0x2528e9=0xce;}_0x2d0e33[_0x0fda('0x29')](_0x2528e9);return _0x2d0e33[_0x0fda('0x2e')](_0x0fda('0x2f'),_0x3a5107+'-'+_0x1f2dfb+'/'+_0x403c9c)[_0x0fda('0x30')](_0x37796e);}return null;};}function patchUpdates(_0x1b26ad){return function(_0x27678b){try{jsonpatch[_0x0fda('0x31')](_0x27678b,_0x1b26ad,!![]);}catch(_0x3a69e7){return BPromise[_0x0fda('0x32')](_0x3a69e7);}return _0x27678b[_0x0fda('0x33')]();};}function saveUpdates(_0x3e344b,_0x484bb4){return function(_0x3547db){if(_0x3547db){return _0x3547db[_0x0fda('0x34')](_0x3e344b)[_0x0fda('0x1e')](function(_0x5d3370){return _0x5d3370;});}return null;};}function removeEntity(_0x313637,_0x249d3c){return function(_0x4fc6f5){if(_0x4fc6f5){return _0x4fc6f5['destroy']()[_0x0fda('0x1e')](function(){_0x313637[_0x0fda('0x29')](0xcc)[_0x0fda('0x35')]();});}};}function handleEntityNotFound(_0x4abb54,_0x173e47){return function(_0x294d93){if(!_0x294d93){_0x4abb54[_0x0fda('0x28')](0x194);}return _0x294d93;};}function handleError(_0x2e13dc,_0x1de899){_0x1de899=_0x1de899||0x1f4;return function(_0x170395){logger['error'](_0x170395['stack']);if(_0x170395['name']){delete _0x170395['name'];}_0x2e13dc[_0x0fda('0x29')](_0x1de899)[_0x0fda('0x36')](_0x170395);};}exports[_0x0fda('0x37')]=function(_0x2b0dff,_0x3e30a1){var _0x22dc0a={},_0x4c268f={},_0xf32dfa={'count':0x0,'rows':[]};var _0x25aafd=_[_0x0fda('0x38')](db[_0x0fda('0x39')]['rawAttributes'],function(_0x3585c7){return{'name':_0x3585c7[_0x0fda('0x3a')],'type':_0x3585c7[_0x0fda('0x3b')][_0x0fda('0x3c')]};});_0x4c268f[_0x0fda('0x3d')]=_[_0x0fda('0x38')](_0x25aafd,_0x0fda('0x3e'));_0x4c268f['query']=_[_0x0fda('0x3f')](_0x2b0dff[_0x0fda('0x40')]);_0x4c268f[_0x0fda('0x41')]=_[_0x0fda('0x42')](_0x4c268f[_0x0fda('0x3d')],_0x4c268f['query']);_0x22dc0a[_0x0fda('0x43')]=_['intersection'](_0x4c268f[_0x0fda('0x3d')],qs['fields'](_0x2b0dff['query'][_0x0fda('0x44')]));_0x22dc0a['attributes']=_0x22dc0a[_0x0fda('0x43')]['length']?_0x22dc0a['attributes']:_0x4c268f[_0x0fda('0x3d')];if(!_0x2b0dff[_0x0fda('0x40')]['hasOwnProperty'](_0x0fda('0x45'))){_0x22dc0a[_0x0fda('0x2d')]=qs[_0x0fda('0x2d')](_0x2b0dff[_0x0fda('0x40')][_0x0fda('0x2d')]);_0x22dc0a[_0x0fda('0x2a')]=qs[_0x0fda('0x2a')](_0x2b0dff[_0x0fda('0x40')]['offset']);}_0x22dc0a[_0x0fda('0x46')]=qs[_0x0fda('0x47')](_0x2b0dff[_0x0fda('0x40')][_0x0fda('0x47')]);_0x22dc0a[_0x0fda('0x48')]=qs['filters'](_[_0x0fda('0x49')](_0x2b0dff[_0x0fda('0x40')],_0x4c268f[_0x0fda('0x41')]),_0x25aafd);if(_0x2b0dff[_0x0fda('0x40')][_0x0fda('0x4a')]){_0x22dc0a[_0x0fda('0x48')]=_[_0x0fda('0x4b')](_0x22dc0a[_0x0fda('0x48')],{'$or':_['map'](_0x25aafd,function(_0x2da836){if(_0x2da836[_0x0fda('0x3b')]!==_0x0fda('0x4c')){var _0xa96f00={};_0xa96f00[_0x2da836[_0x0fda('0x3e')]]={'$like':'%'+_0x2b0dff[_0x0fda('0x40')]['filter']+'%'};return _0xa96f00;}})});}_0x22dc0a=_['merge']({},_0x22dc0a,_0x2b0dff[_0x0fda('0x4d')]);var _0x1a779e={'where':_0x22dc0a[_0x0fda('0x48')]};return db[_0x0fda('0x39')][_0x0fda('0x2c')](_0x1a779e)['then'](function(_0x3aa349){_0xf32dfa['count']=_0x3aa349;if(_0x2b0dff[_0x0fda('0x40')][_0x0fda('0x4e')]){_0x22dc0a[_0x0fda('0x4f')]=[{'all':!![]}];}return db[_0x0fda('0x39')]['findAll'](_0x22dc0a);})[_0x0fda('0x1e')](function(_0x2e0d07){_0xf32dfa[_0x0fda('0x50')]=_0x2e0d07;return _0xf32dfa;})['then'](respondWithFilteredResult(_0x3e30a1,_0x22dc0a))[_0x0fda('0x27')](handleError(_0x3e30a1,null));};exports[_0x0fda('0x51')]=function(_0x4ab9d6,_0x160bac){var _0x452df2={'raw':![],'where':{'id':_0x4ab9d6['params']['id']}},_0x1daf84={};_0x1daf84[_0x0fda('0x3d')]=_[_0x0fda('0x3f')](db[_0x0fda('0x39')][_0x0fda('0x52')]);_0x1daf84['query']=_['keys'](_0x4ab9d6['query']);_0x1daf84[_0x0fda('0x41')]=_[_0x0fda('0x42')](_0x1daf84[_0x0fda('0x3d')],_0x1daf84[_0x0fda('0x40')]);_0x452df2[_0x0fda('0x43')]=_[_0x0fda('0x42')](_0x1daf84[_0x0fda('0x3d')],qs[_0x0fda('0x44')](_0x4ab9d6[_0x0fda('0x40')]['fields']));_0x452df2['attributes']=_0x452df2[_0x0fda('0x43')][_0x0fda('0x53')]?_0x452df2[_0x0fda('0x43')]:_0x1daf84['model'];if(_0x4ab9d6['query']['includeAll']){_0x452df2[_0x0fda('0x4f')]=[{'all':!![]}];}_0x452df2=_[_0x0fda('0x4b')]({},_0x452df2,_0x4ab9d6[_0x0fda('0x4d')]);return db[_0x0fda('0x39')][_0x0fda('0x54')](_0x452df2)['then'](handleEntityNotFound(_0x160bac,null))[_0x0fda('0x1e')](respondWithResult(_0x160bac,null))[_0x0fda('0x27')](handleError(_0x160bac,null));};exports[_0x0fda('0x34')]=function(_0x13b56c,_0x4215b1){if(_0x13b56c[_0x0fda('0x55')]['id']){delete _0x13b56c[_0x0fda('0x55')]['id'];}return db[_0x0fda('0x39')][_0x0fda('0x54')]({'where':{'id':_0x13b56c[_0x0fda('0x56')]['id']}})[_0x0fda('0x1e')](handleEntityNotFound(_0x4215b1,null))['then'](saveUpdates(_0x13b56c[_0x0fda('0x55')],null))[_0x0fda('0x1e')](respondWithResult(_0x4215b1,null))['catch'](handleError(_0x4215b1,null));};exports[_0x0fda('0x57')]=function(_0x2956dd,_0x386ab6,_0x2ea4f8){if(_0x2956dd[_0x0fda('0x58')]&&_0x2956dd[_0x0fda('0x58')][_0x0fda('0x59')]){_0x2956dd[_0x0fda('0x55')]['logo']=_0x2956dd['file'][_0x0fda('0x59')];}return db['Setting'][_0x0fda('0x54')]({'where':{'id':_0x2956dd[_0x0fda('0x56')]['id']}})['then'](handleEntityNotFound(_0x386ab6,null))[_0x0fda('0x1e')](saveUpdates(_0x2956dd[_0x0fda('0x55')],null))[_0x0fda('0x1e')](respondWithResult(_0x386ab6,null))[_0x0fda('0x27')](handleError(_0x386ab6,null));};exports[_0x0fda('0x5a')]=function(_0x51330b,_0xdbf66e,_0x2dc25d){if(_0x51330b[_0x0fda('0x58')]&&_0x51330b[_0x0fda('0x58')][_0x0fda('0x59')]){_0x51330b[_0x0fda('0x55')][_0x0fda('0x5b')]=_0x51330b[_0x0fda('0x58')]['filename'];}return db[_0x0fda('0x39')][_0x0fda('0x54')]({'where':{'id':_0x51330b[_0x0fda('0x56')]['id']}})[_0x0fda('0x1e')](handleEntityNotFound(_0xdbf66e,null))[_0x0fda('0x1e')](saveUpdates(_0x51330b[_0x0fda('0x55')],null))[_0x0fda('0x1e')](respondWithResult(_0xdbf66e,null))[_0x0fda('0x27')](handleError(_0xdbf66e,null));};var utilLicense=require(_0x0fda('0x18'));exports['getLogo']=function(_0x557a32,_0x4c81aa,_0x5d299e){var _0x2f2ab6=_0x0fda('0x5c');var _0x5c75d1={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x167c80){if(_0x167c80){_0x5c75d1=_0x167c80;}return db['Setting'][_0x0fda('0x54')]({'where':{'id':_0x557a32['params']['id']},'attributes':[_0x0fda('0x5d'),_0x0fda('0x5b'),_0x0fda('0x5e'),_0x0fda('0x5f'),_0x0fda('0x60'),_0x0fda('0x61'),'defaultPreferred',_0x0fda('0x62')],'raw':!![]});})[_0x0fda('0x1e')](handleEntityNotFound(_0x4c81aa,null))[_0x0fda('0x1e')](function(_0x598cf5){if(_0x598cf5){var _0x1a0f31=_0x598cf5[_0x0fda('0x5d')]&&fs[_0x0fda('0x63')](path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x2f2ab6,_[_0x0fda('0x66')](_0x598cf5[_0x0fda('0x5d')])))?path['join'](config[_0x0fda('0x65')],_0x2f2ab6,_[_0x0fda('0x66')](_0x598cf5[_0x0fda('0x5d')])):path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x2f2ab6,_[_0x0fda('0x66')](_0x0fda('0x67')));var _0x2d543b=_0x0fda('0x68')+_['upperFirst'](_0x0fda('0x5d'));if(_0x598cf5[_0x2d543b]||!_0x5c75d1[_0x0fda('0x69')]){_0x1a0f31=path['join'](config[_0x0fda('0x65')],_0x2f2ab6,_[_0x0fda('0x66')](_0x0fda('0x67')));}if(!fs[_0x0fda('0x63')](_0x1a0f31)){throw new db[(_0x0fda('0x6a'))][(_0x0fda('0x6b'))](_[_0x0fda('0x6c')]('logo')+_0x0fda('0x6d'));}return _0x4c81aa[_0x0fda('0x6e')](_0x1a0f31);}})[_0x0fda('0x27')](handleError(_0x4c81aa,null));};var utilLicense=require(_0x0fda('0x18'));exports[_0x0fda('0x6f')]=function(_0x2adccc,_0x3008d4,_0x72b30b){var _0x739c52=_0x0fda('0x5c');var _0x4eccae={'custom':![]};return utilLicense[_0x0fda('0x70')]()[_0x0fda('0x1e')](function(_0x366ddc){if(_0x366ddc){_0x4eccae=_0x366ddc;}return db[_0x0fda('0x39')][_0x0fda('0x54')]({'where':{'id':_0x2adccc['params']['id']},'attributes':[_0x0fda('0x5d'),_0x0fda('0x5b'),_0x0fda('0x5e'),_0x0fda('0x5f'),_0x0fda('0x60'),'defaultLoginLogo',_0x0fda('0x71'),'defaultFavicon'],'raw':!![]});})[_0x0fda('0x1e')](handleEntityNotFound(_0x3008d4,null))['then'](function(_0x3f1bc6){if(_0x3f1bc6){var _0x4683c2=_0x3f1bc6[_0x0fda('0x5b')]&&fs['existsSync'](path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x739c52,_[_0x0fda('0x66')](_0x3f1bc6[_0x0fda('0x5b')])))?path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x739c52,_[_0x0fda('0x66')](_0x3f1bc6[_0x0fda('0x5b')])):path['join'](config['root'],_0x739c52,_['toLower']('default_loginLogo.svg'));var _0x44cd02='default'+_[_0x0fda('0x6c')](_0x0fda('0x5b'));if(_0x3f1bc6[_0x44cd02]||!_0x4eccae[_0x0fda('0x69')]){_0x4683c2=path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x739c52,_[_0x0fda('0x66')]('default_loginLogo.svg'));}if(!fs[_0x0fda('0x63')](_0x4683c2)){throw new db[(_0x0fda('0x6a'))][(_0x0fda('0x6b'))](_[_0x0fda('0x6c')]('loginLogo')+_0x0fda('0x6d'));}return _0x3008d4['download'](_0x4683c2);}})[_0x0fda('0x27')](handleError(_0x3008d4,null));};exports[_0x0fda('0x72')]=function(_0x401f33,_0x5cbe53){return db['Setting']['find']({'where':{'id':_0x401f33[_0x0fda('0x56')]['id']},'attributes':['securePassword']})[_0x0fda('0x1e')](respondWithResult(_0x5cbe53,null))[_0x0fda('0x27')](handleError(_0x5cbe53,null));};exports[_0x0fda('0x73')]=function(_0x272f1b,_0x219ad9,_0x37b847){if(_0x272f1b[_0x0fda('0x58')]&&_0x272f1b['file'][_0x0fda('0x59')]){_0x272f1b[_0x0fda('0x55')][_0x0fda('0x5e')]=_0x272f1b['file'][_0x0fda('0x59')];}return db[_0x0fda('0x39')][_0x0fda('0x54')]({'where':{'id':_0x272f1b[_0x0fda('0x56')]['id']}})[_0x0fda('0x1e')](handleEntityNotFound(_0x219ad9,null))[_0x0fda('0x1e')](saveUpdates(_0x272f1b['body'],null))[_0x0fda('0x1e')](respondWithResult(_0x219ad9,null))[_0x0fda('0x27')](handleError(_0x219ad9,null));};var utilLicense=require(_0x0fda('0x18'));exports[_0x0fda('0x74')]=function(_0x27aa83,_0x3d8190,_0x4fb5f6){var _0x229141=_0x0fda('0x5c');var _0xec99a9={'custom':![]};return utilLicense['getLicense']()[_0x0fda('0x1e')](function(_0x217ed4){if(_0x217ed4){_0xec99a9=_0x217ed4;}return db[_0x0fda('0x39')][_0x0fda('0x54')]({'where':{'id':_0x27aa83[_0x0fda('0x56')]['id']},'attributes':[_0x0fda('0x5d'),'loginLogo','preferred',_0x0fda('0x5f'),'defaultLogo',_0x0fda('0x61'),_0x0fda('0x71'),'defaultFavicon'],'raw':!![]});})[_0x0fda('0x1e')](handleEntityNotFound(_0x3d8190,null))[_0x0fda('0x1e')](function(_0x235582){if(_0x235582){var _0x2217b3=_0x235582[_0x0fda('0x5e')]&&fs['existsSync'](path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x229141,_['toLower'](_0x235582[_0x0fda('0x5e')])))?path['join'](config[_0x0fda('0x65')],_0x229141,_[_0x0fda('0x66')](_0x235582['preferred'])):path[_0x0fda('0x64')](config['root'],_0x229141,_[_0x0fda('0x66')](_0x0fda('0x75')));var _0x21cdad=_0x0fda('0x68')+_[_0x0fda('0x6c')]('preferred');if(_0x235582[_0x21cdad]||!_0xec99a9[_0x0fda('0x69')]||!_0xec99a9[_0x0fda('0x5e')]){_0x2217b3=path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x229141,_[_0x0fda('0x66')]('default_preferred.png'));}if(!fs[_0x0fda('0x63')](_0x2217b3)){throw new db[(_0x0fda('0x6a'))]['ValidationError'](_[_0x0fda('0x6c')](_0x0fda('0x5e'))+_0x0fda('0x6d'));}return _0x3d8190[_0x0fda('0x6e')](_0x2217b3);}})[_0x0fda('0x27')](handleError(_0x3d8190,null));};exports[_0x0fda('0x76')]=function(_0x28a33c,_0x368702,_0x134d6c){if(_0x28a33c[_0x0fda('0x58')]&&_0x28a33c[_0x0fda('0x58')][_0x0fda('0x59')]){_0x28a33c[_0x0fda('0x55')][_0x0fda('0x5f')]=_0x28a33c[_0x0fda('0x58')]['filename'];}return db[_0x0fda('0x39')]['find']({'where':{'id':_0x28a33c[_0x0fda('0x56')]['id']}})[_0x0fda('0x1e')](handleEntityNotFound(_0x368702,null))['then'](saveUpdates(_0x28a33c[_0x0fda('0x55')],null))[_0x0fda('0x1e')](respondWithResult(_0x368702,null))[_0x0fda('0x27')](handleError(_0x368702,null));};var utilLicense=require(_0x0fda('0x18'));exports[_0x0fda('0x77')]=function(_0x5ddaa3,_0x3e2d32,_0x57da79){var _0x242f85=_0x0fda('0x5c');var _0x1669ed={'custom':![]};return utilLicense[_0x0fda('0x70')]()[_0x0fda('0x1e')](function(_0x1fbcce){if(_0x1fbcce){_0x1669ed=_0x1fbcce;}return db['Setting']['find']({'where':{'id':_0x5ddaa3[_0x0fda('0x56')]['id']},'attributes':[_0x0fda('0x5d'),_0x0fda('0x5b'),_0x0fda('0x5e'),_0x0fda('0x5f'),_0x0fda('0x60'),_0x0fda('0x61'),_0x0fda('0x71'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x3e2d32,null))[_0x0fda('0x1e')](function(_0x10cbfc){if(_0x10cbfc){var _0x10eb86=_0x10cbfc[_0x0fda('0x5f')]&&fs[_0x0fda('0x63')](path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x242f85,_['toLower'](_0x10cbfc['favicon'])))?path['join'](config['root'],_0x242f85,_[_0x0fda('0x66')](_0x10cbfc[_0x0fda('0x5f')])):path[_0x0fda('0x64')](config['root'],_0x242f85,_['toLower'](_0x0fda('0x78')));var _0x38963a=_0x0fda('0x68')+_['upperFirst'](_0x0fda('0x5f'));if(_0x10cbfc[_0x38963a]||!_0x1669ed[_0x0fda('0x69')]){_0x10eb86=path[_0x0fda('0x64')](config[_0x0fda('0x65')],_0x242f85,_['toLower']('default_favicon.ico'));}if(!fs[_0x0fda('0x63')](_0x10eb86)){throw new db[(_0x0fda('0x6a'))][(_0x0fda('0x6b'))](_['upperFirst'](_0x0fda('0x5f'))+_0x0fda('0x6d'));}return _0x3e2d32[_0x0fda('0x6e')](_0x10eb86);}})[_0x0fda('0x27')](handleError(_0x3e2d32,null));};exports[_0x0fda('0x79')]=function(_0x119582,_0x2ebcb7){var _0x4a5bea={'offset':moment()[_0x0fda('0x7a')]()};_0x4a5bea[_0x0fda('0x7b')]=moment()[_0x0fda('0x7a')](_0x4a5bea[_0x0fda('0x2a')])['format'](_0x0fda('0x7c'));return _0x2ebcb7['status'](0xc8)[_0x0fda('0x36')](_0x4a5bea);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 8244379..bd87547 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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x55ca,0x126));var _0xa55c=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x55ca[_0x5c6244];return _0x5800ce;};'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 cb8e2e2..2897d91 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 _0xfb9b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','Setting','find','options','where','attributes','include','map','model','ShowSetting','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xba768,_0x5ac737){var _0x4c64af=function(_0x49aea6){while(--_0x49aea6){_0xba768['push'](_0xba768['shift']());}};_0x4c64af(++_0x5ac737);}(_0xfb9b,0x1aa));var _0xbfb9=function(_0x35c292,_0x36bb88){_0x35c292=_0x35c292-0x0;var _0x16a3a5=_0xfb9b[_0x35c292];return _0x16a3a5;};'use strict';var _=require(_0xbfb9('0x0'));var util=require(_0xbfb9('0x1'));var moment=require(_0xbfb9('0x2'));var BPromise=require(_0xbfb9('0x3'));var rs=require(_0xbfb9('0x4'));var fs=require('fs');var Redis=require(_0xbfb9('0x5'));var db=require(_0xbfb9('0x6'))['db'];var utils=require(_0xbfb9('0x7'));var logger=require(_0xbfb9('0x8'))(_0xbfb9('0x9'));var config=require(_0xbfb9('0xa'));var jayson=require(_0xbfb9('0xb'));var client=jayson[_0xbfb9('0xc')][_0xbfb9('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38f582,_0x16025c,_0x27032e){return new BPromise(function(_0xed1f7e,_0x47632c){return client[_0xbfb9('0xe')](_0x38f582,_0x27032e)[_0xbfb9('0xf')](function(_0x3c9465){logger['info']('Setting,\x20%s,\x20%s',_0x16025c,_0xbfb9('0x10'));logger[_0xbfb9('0x11')](_0xbfb9('0x12'),_0x16025c,_0xbfb9('0x10'),JSON[_0xbfb9('0x13')](_0x3c9465));if(_0x3c9465[_0xbfb9('0x14')]){if(_0x3c9465[_0xbfb9('0x14')][_0xbfb9('0x15')]===0x1f4){logger[_0xbfb9('0x14')](_0xbfb9('0x16'),_0x16025c,_0x3c9465['error'][_0xbfb9('0x17')]);return _0x47632c(_0x3c9465['error'][_0xbfb9('0x17')]);}logger['error'](_0xbfb9('0x16'),_0x16025c,_0x3c9465['error'][_0xbfb9('0x17')]);return _0xed1f7e(_0x3c9465[_0xbfb9('0x14')][_0xbfb9('0x17')]);}else{logger[_0xbfb9('0x18')](_0xbfb9('0x16'),_0x16025c,_0xbfb9('0x10'));_0xed1f7e(_0x3c9465[_0xbfb9('0x19')][_0xbfb9('0x17')]);}})[_0xbfb9('0x1a')](function(_0x297d43){logger[_0xbfb9('0x14')](_0xbfb9('0x16'),_0x16025c,_0x297d43);_0x47632c(_0x297d43);});});}exports['ShowSetting']=function(_0x3a1f63){var _0x2fc74e=this;return new Promise(function(_0x7c9fd2,_0x5bffa0){return db[_0xbfb9('0x1b')][_0xbfb9('0x1c')]({'raw':_0x3a1f63[_0xbfb9('0x1d')]?_0x3a1f63[_0xbfb9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3a1f63[_0xbfb9('0x1d')]?_0x3a1f63['options'][_0xbfb9('0x1e')]||null:null,'attributes':_0x3a1f63['options']?_0x3a1f63[_0xbfb9('0x1d')][_0xbfb9('0x1f')]||null:null,'include':_0x3a1f63[_0xbfb9('0x1d')]?_0x3a1f63[_0xbfb9('0x1d')][_0xbfb9('0x20')]?_[_0xbfb9('0x21')](_0x3a1f63['options'][_0xbfb9('0x20')],function(_0x43fac9){return{'model':db[_0x43fac9['model']],'as':_0x43fac9['as'],'attributes':_0x43fac9[_0xbfb9('0x1f')],'include':_0x43fac9[_0xbfb9('0x20')]?_[_0xbfb9('0x21')](_0x43fac9[_0xbfb9('0x20')],function(_0x47f0eb){return{'model':db[_0x47f0eb[_0xbfb9('0x22')]],'as':_0x47f0eb['as'],'attributes':_0x47f0eb[_0xbfb9('0x1f')],'include':_0x47f0eb[_0xbfb9('0x20')]?_[_0xbfb9('0x21')](_0x47f0eb[_0xbfb9('0x20')],function(_0x5fb011){return{'model':db[_0x5fb011['model']],'as':_0x5fb011['as'],'attributes':_0x5fb011[_0xbfb9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbfb9('0xf')](function(_0x30664e){logger[_0xbfb9('0x18')](_0xbfb9('0x23'),_0x3a1f63);logger[_0xbfb9('0x11')]('ShowSetting',_0x3a1f63,JSON[_0xbfb9('0x13')](_0x30664e));_0x7c9fd2(_0x30664e);})[_0xbfb9('0x1a')](function(_0x52ba84){logger[_0xbfb9('0x14')](_0xbfb9('0x23'),_0x52ba84[_0xbfb9('0x17')],_0x3a1f63);_0x5bffa0(_0x2fc74e[_0xbfb9('0x14')](0x1f4,_0x52ba84['message']));});});}; \ No newline at end of file +var _0x4f46=['raw','where','include','map','model','attributes','then','ShowSetting','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Setting','find','options'];(function(_0x14241c,_0x513878){var _0x50d4d7=function(_0x256d3f){while(--_0x256d3f){_0x14241c['push'](_0x14241c['shift']());}};_0x50d4d7(++_0x513878);}(_0x4f46,0x174));var _0x64f4=function(_0x211de7,_0x2e6f69){_0x211de7=_0x211de7-0x0;var _0x2b29e0=_0x4f46[_0x211de7];return _0x2b29e0;};'use strict';var _=require(_0x64f4('0x0'));var util=require('util');var moment=require(_0x64f4('0x1'));var BPromise=require(_0x64f4('0x2'));var rs=require(_0x64f4('0x3'));var fs=require('fs');var Redis=require(_0x64f4('0x4'));var db=require(_0x64f4('0x5'))['db'];var utils=require(_0x64f4('0x6'));var logger=require(_0x64f4('0x7'))('rpc');var config=require(_0x64f4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x64f4('0x9')][_0x64f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4075ff,_0x1189ba,_0x33ec3b){return new BPromise(function(_0x1d6d37,_0x1be2df){return client['request'](_0x4075ff,_0x33ec3b)['then'](function(_0x2ce711){logger[_0x64f4('0xb')](_0x64f4('0xc'),_0x1189ba,_0x64f4('0xd'));logger[_0x64f4('0xe')](_0x64f4('0xf'),_0x1189ba,_0x64f4('0xd'),JSON[_0x64f4('0x10')](_0x2ce711));if(_0x2ce711[_0x64f4('0x11')]){if(_0x2ce711['error'][_0x64f4('0x12')]===0x1f4){logger[_0x64f4('0x11')]('Setting,\x20%s,\x20%s',_0x1189ba,_0x2ce711['error'][_0x64f4('0x13')]);return _0x1be2df(_0x2ce711[_0x64f4('0x11')][_0x64f4('0x13')]);}logger[_0x64f4('0x11')](_0x64f4('0xc'),_0x1189ba,_0x2ce711[_0x64f4('0x11')]['message']);return _0x1d6d37(_0x2ce711[_0x64f4('0x11')][_0x64f4('0x13')]);}else{logger[_0x64f4('0xb')](_0x64f4('0xc'),_0x1189ba,_0x64f4('0xd'));_0x1d6d37(_0x2ce711[_0x64f4('0x14')][_0x64f4('0x13')]);}})['catch'](function(_0x3f929d){logger['error'](_0x64f4('0xc'),_0x1189ba,_0x3f929d);_0x1be2df(_0x3f929d);});});}exports['ShowSetting']=function(_0x4a4d94){var _0x269534=this;return new Promise(function(_0x260866,_0x591ff3){return db[_0x64f4('0x15')][_0x64f4('0x16')]({'raw':_0x4a4d94[_0x64f4('0x17')]?_0x4a4d94[_0x64f4('0x17')][_0x64f4('0x18')]===undefined?!![]:![]:!![],'where':_0x4a4d94['options']?_0x4a4d94['options'][_0x64f4('0x19')]||null:null,'attributes':_0x4a4d94[_0x64f4('0x17')]?_0x4a4d94[_0x64f4('0x17')]['attributes']||null:null,'include':_0x4a4d94[_0x64f4('0x17')]?_0x4a4d94[_0x64f4('0x17')][_0x64f4('0x1a')]?_[_0x64f4('0x1b')](_0x4a4d94[_0x64f4('0x17')][_0x64f4('0x1a')],function(_0x5e7018){return{'model':db[_0x5e7018[_0x64f4('0x1c')]],'as':_0x5e7018['as'],'attributes':_0x5e7018[_0x64f4('0x1d')],'include':_0x5e7018['include']?_['map'](_0x5e7018['include'],function(_0x4551e1){return{'model':db[_0x4551e1['model']],'as':_0x4551e1['as'],'attributes':_0x4551e1['attributes'],'include':_0x4551e1['include']?_[_0x64f4('0x1b')](_0x4551e1[_0x64f4('0x1a')],function(_0xc202ac){return{'model':db[_0xc202ac[_0x64f4('0x1c')]],'as':_0xc202ac['as'],'attributes':_0xc202ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x64f4('0x1e')](function(_0x744cf6){logger[_0x64f4('0xb')](_0x64f4('0x1f'),_0x4a4d94);logger[_0x64f4('0xe')](_0x64f4('0x1f'),_0x4a4d94,JSON[_0x64f4('0x10')](_0x744cf6));_0x260866(_0x744cf6);})[_0x64f4('0x20')](function(_0x10d2de){logger['error']('ShowSetting',_0x10d2de[_0x64f4('0x13')],_0x4a4d94);_0x591ff3(_0x269534['error'](0x1f4,_0x10d2de[_0x64f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index f96c899..8d396c3 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 _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x189ce9,_0x17cb4f){var _0x4261a1=function(_0x4431d8){while(--_0x4431d8){_0x189ce9['push'](_0x189ce9['shift']());}};_0x4261a1(++_0x17cb4f);}(_0x7a54,0x106));var _0x47a5=function(_0x441881,_0x3935ae){_0x441881=_0x441881-0x0;var _0x3e4394=_0x7a54[_0x441881];return _0x3e4394;};'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['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x2e9be4,_0x463bf6){var _0x22cb76=function(_0x185fab){while(--_0x185fab){_0x2e9be4['push'](_0x2e9be4['shift']());}};_0x22cb76(++_0x463bf6);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 38d010a..38154d8 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 _0xd2cb=['plivo','clickatell','bandwidth','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','skebby','connectel','clicksend'];(function(_0xf024be,_0x55a7e3){var _0x2dad1e=function(_0x81bb62){while(--_0x81bb62){_0xf024be['push'](_0xf024be['shift']());}};_0x2dad1e(++_0x55a7e3);}(_0xd2cb,0xe9));var _0xbd2c=function(_0x159b72,_0x183756){_0x159b72=_0x159b72-0x0;var _0x4fa7b7=_0xd2cb[_0x159b72];return _0x4fa7b7;};'use strict';var Sequelize=require(_0xbd2c('0x0'));var rs=require('randomstring');module[_0xbd2c('0x1')]={'name':{'type':Sequelize[_0xbd2c('0x2')],'unique':_0xbd2c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xbd2c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xbd2c('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xbd2c('0x2')],'defaultValue':function(){return rs[_0xbd2c('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbd2c('0x5')]('twilio',_0xbd2c('0x6'),_0xbd2c('0x7'),_0xbd2c('0x8'),_0xbd2c('0x9'),_0xbd2c('0xa'),_0xbd2c('0xb'),'csc',_0xbd2c('0xc'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xbd2c('0x2')]},'authToken':{'type':Sequelize[_0xbd2c('0x2')]},'smsMethod':{'type':Sequelize[_0xbd2c('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xbd2c('0x2')]},'apiKey':{'type':Sequelize[_0xbd2c('0x2')]},'applicationId':{'type':Sequelize[_0xbd2c('0x2')]},'accountId':{'type':Sequelize[_0xbd2c('0x2')]},'senderString':{'type':Sequelize[_0xbd2c('0x2')]},'deliveryReport':{'type':Sequelize[_0xbd2c('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xbd2c('0xe')],'defaultValue':function(){return _0xbd2c('0xf');}},'notificationSound':{'type':Sequelize[_0xbd2c('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbd2c('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbd2c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xbd2c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xbd2c('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbd2c('0x10')],'comment':_0xbd2c('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xbd2c('0xd')],'defaultValue':![],'comment':_0xbd2c('0x12'),'set':function(_0x5c0134){if(!_0x5c0134)this[_0xbd2c('0x13')](_0xbd2c('0x14'),null);this['setDataValue'](_0xbd2c('0x15'),_0x5c0134);}}}; \ No newline at end of file +var _0xa038=['bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','STRING','generate','ENUM','twilio','skebby','connectel','clickatell'];(function(_0x25996d,_0x5b282e){var _0x12d802=function(_0x34fe7b){while(--_0x34fe7b){_0x25996d['push'](_0x25996d['shift']());}};_0x12d802(++_0x5b282e);}(_0xa038,0x83));var _0x8a03=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xa038[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require(_0x8a03('0x0'));var rs=require(_0x8a03('0x1'));module['exports']={'name':{'type':Sequelize[_0x8a03('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x8a03('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8a03('0x3')]();}},'phone':{'type':Sequelize[_0x8a03('0x2')]},'type':{'type':Sequelize[_0x8a03('0x4')](_0x8a03('0x5'),_0x8a03('0x6'),_0x8a03('0x7'),'clicksend','plivo',_0x8a03('0x8'),_0x8a03('0x9'),_0x8a03('0xa'),_0x8a03('0xb'),_0x8a03('0xc'))},'accountSid':{'type':Sequelize[_0x8a03('0x2')]},'authId':{'type':Sequelize[_0x8a03('0x2')]},'authToken':{'type':Sequelize[_0x8a03('0x2')]},'smsMethod':{'type':Sequelize[_0x8a03('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x8a03('0x2')]},'password':{'type':Sequelize[_0x8a03('0x2')]},'apiKey':{'type':Sequelize[_0x8a03('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x8a03('0x2')]},'senderString':{'type':Sequelize[_0x8a03('0x2')]},'deliveryReport':{'type':Sequelize[_0x8a03('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x8a03('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8a03('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x8a03('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8a03('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8a03('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8a03('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8a03('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8a03('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8a03('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8a03('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8a03('0xf')],'comment':_0x8a03('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x8a03('0xd')],'defaultValue':![],'comment':_0x8a03('0x11'),'set':function(_0x16e2ea){if(!_0x16e2ea)this['setDataValue'](_0x8a03('0x12'),null);this[_0x8a03('0x13')]('mandatoryDisposition',_0x16e2ea);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 6ed80e7..fb04c4d 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 _0x3789=['transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','priority','getApplications','order','getInteractions','fullname','internal','tag','to\x20is\x20mandatory','CmList','List','defaults','out','SmsMessage','Messages','dataValues','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','clicksend','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','message-id','state','addAgents','emit','userSmsAccount:save','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','client','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','SmsAccount','includeAll','include','rows','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','asc','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','MessageSid','skebby','text','connectel','messageId','message_id','plivo','From','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','ContactId','AttachmentId','UserId','User','queueId','SmsQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','\x0a','addApplications','sequelize'];(function(_0x37ac9d,_0xafe035){var _0x2c01a2=function(_0x950449){while(--_0x950449){_0x37ac9d['push'](_0x37ac9d['shift']());}};_0x2c01a2(++_0xafe035);}(_0x3789,0x1f2));var _0x9378=function(_0x17c6de,_0x5ed89b){_0x17c6de=_0x17c6de-0x0;var _0x19fb8f=_0x3789[_0x17c6de];return _0x19fb8f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9378('0x0'));var zipdir=require(_0x9378('0x1'));var jsonpatch=require(_0x9378('0x2'));var rp=require('request-promise');var moment=require(_0x9378('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9378('0x4'));var util=require(_0x9378('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9378('0x6'));var fs=require('fs');var fs_extra=require(_0x9378('0x7'));var _=require('lodash');var squel=require(_0x9378('0x8'));var crypto=require(_0x9378('0x9'));var jsforce=require(_0x9378('0xa'));var deskjs=require(_0x9378('0xb'));var toCsv=require(_0x9378('0xc'));var querystring=require(_0x9378('0xd'));var Papa=require(_0x9378('0xe'));var Redis=require('ioredis');var authService=require(_0x9378('0xf'));var qs=require(_0x9378('0x10'));var as=require(_0x9378('0x11'));var hardwareService=require(_0x9378('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9378('0x13'));var licenseUtil=require(_0x9378('0x14'));var db=require(_0x9378('0x15'))['db'];config[_0x9378('0x16')]=_['defaults'](config[_0x9378('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9378('0x17'))(new Redis(config[_0x9378('0x16')]));require('./smsAccount.socket')[_0x9378('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9378('0x19')]['http']({'port':0x232c});function respondWithRpcPromise(_0xb36906,_0x3a0b46,_0x262dd7,_0x382551){return new BPromise(function(_0x40ea3d,_0x56627b){var _0x49617a=_0x382551||client;return _0x49617a[_0x9378('0x1a')](_0xb36906,_0x262dd7)[_0x9378('0x1b')](function(_0x1991bb){logger['info'](_0x9378('0x1c'),_0x3a0b46,_0x9378('0x1d'));logger['debug'](_0x9378('0x1e'),_0x3a0b46,_0x9378('0x1d'),JSON[_0x9378('0x1f')](_0x1991bb));if(_0x1991bb['error']){if(_0x1991bb[_0x9378('0x20')]['code']===0x1f4){logger[_0x9378('0x20')](_0x9378('0x1c'),_0x3a0b46,_0x1991bb[_0x9378('0x20')][_0x9378('0x21')]);return _0x56627b(_0x1991bb[_0x9378('0x20')][_0x9378('0x21')]);}logger[_0x9378('0x20')](_0x9378('0x1c'),_0x3a0b46,_0x1991bb[_0x9378('0x20')][_0x9378('0x21')]);return _0x40ea3d(_0x1991bb[_0x9378('0x20')][_0x9378('0x21')]);}else{logger[_0x9378('0x22')](_0x9378('0x1c'),_0x3a0b46,_0x9378('0x1d'));_0x40ea3d(_0x1991bb[_0x9378('0x23')]['message']);}})[_0x9378('0x24')](function(_0x437e8e){logger['error']('SmsAccount,\x20%s,\x20%s',_0x3a0b46,_0x437e8e);_0x56627b(_0x437e8e);});});}function respondWithStatusCode(_0x5f058e,_0x4ccd2c){_0x4ccd2c=_0x4ccd2c||0xcc;return function(_0x56a626){if(_0x56a626){return _0x5f058e['sendStatus'](_0x4ccd2c);}return _0x5f058e[_0x9378('0x25')](_0x4ccd2c)[_0x9378('0x26')]();};}function respondWithResult(_0x4c2781,_0x5243f8){_0x5243f8=_0x5243f8||0xc8;return function(_0x3bc43f){if(_0x3bc43f){return _0x4c2781[_0x9378('0x25')](_0x5243f8)[_0x9378('0x27')](_0x3bc43f);}};}function respondWithFilteredResult(_0x1b41a4,_0x34528f){return function(_0xbbc4b5){if(_0xbbc4b5){var _0x22c3f0=typeof _0x34528f['offset']===_0x9378('0x28')&&typeof _0x34528f[_0x9378('0x29')]===_0x9378('0x28');var _0x5ac86d=_0xbbc4b5[_0x9378('0x2a')];var _0x50cda3=_0x22c3f0?0x0:_0x34528f[_0x9378('0x2b')];var _0x4e7097=_0x22c3f0?_0xbbc4b5['count']:_0x34528f[_0x9378('0x2b')]+_0x34528f[_0x9378('0x29')];var _0x45403d;if(_0x4e7097>=_0x5ac86d){_0x4e7097=_0x5ac86d;_0x45403d=0xc8;}else{_0x45403d=0xce;}_0x1b41a4['status'](_0x45403d);return _0x1b41a4[_0x9378('0x2c')](_0x9378('0x2d'),_0x50cda3+'-'+_0x4e7097+'/'+_0x5ac86d)[_0x9378('0x27')](_0xbbc4b5);}return null;};}function patchUpdates(_0x1bd18f){return function(_0x3a8ce0){try{jsonpatch[_0x9378('0x2e')](_0x3a8ce0,_0x1bd18f,!![]);}catch(_0x59d4cc){return BPromise[_0x9378('0x2f')](_0x59d4cc);}return _0x3a8ce0[_0x9378('0x30')]();};}function saveUpdates(_0x1b1399,_0x87c084){return function(_0x274851){if(_0x274851){return _0x274851[_0x9378('0x31')](_0x1b1399)[_0x9378('0x1b')](function(_0xd62e03){return _0xd62e03;});}return null;};}function removeEntity(_0x5e59e2,_0x4263cc){return function(_0x141bba){if(_0x141bba){return _0x141bba[_0x9378('0x32')]()[_0x9378('0x1b')](function(){var _0x1a2173=_0x141bba[_0x9378('0x33')]({'plain':!![]});var _0x23947b=_0x9378('0x34');return db[_0x9378('0x35')]['destroy']({'where':{'type':_0x23947b,'resourceId':_0x1a2173['id']}})['then'](function(){return _0x141bba;});})['then'](function(){_0x5e59e2[_0x9378('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5caf18,_0x70c855){return function(_0x21ee62){if(!_0x21ee62){_0x5caf18[_0x9378('0x36')](0x194);}return _0x21ee62;};}function handleError(_0x1811fa,_0x32d352){_0x32d352=_0x32d352||0x1f4;return function(_0x293547){logger['error'](_0x293547[_0x9378('0x37')]);if(_0x293547[_0x9378('0x38')]){delete _0x293547[_0x9378('0x38')];}_0x1811fa[_0x9378('0x25')](_0x32d352)[_0x9378('0x39')](_0x293547);};}exports['index']=function(_0x44d4ac,_0x31cfcd){var _0x36fa98={'include':[{'model':db[_0x9378('0x3a')],'as':_0x9378('0x3b')}]},_0x2111f0={},_0x47c3b0={'count':0x0,'rows':[]};var _0x49d0b2=_[_0x9378('0x3c')](db['SmsAccount'][_0x9378('0x3d')],function(_0x1179cd){return{'name':_0x1179cd[_0x9378('0x3e')],'type':_0x1179cd['type'][_0x9378('0x3f')]};});_0x2111f0['model']=_[_0x9378('0x3c')](_0x49d0b2,_0x9378('0x38'));_0x2111f0[_0x9378('0x40')]=_[_0x9378('0x41')](_0x44d4ac[_0x9378('0x40')]);_0x2111f0[_0x9378('0x42')]=_[_0x9378('0x43')](_0x2111f0[_0x9378('0x44')],_0x2111f0[_0x9378('0x40')]);_0x36fa98[_0x9378('0x45')]=_['intersection'](_0x2111f0[_0x9378('0x44')],qs[_0x9378('0x46')](_0x44d4ac['query'][_0x9378('0x46')]));_0x36fa98[_0x9378('0x45')]=_0x36fa98[_0x9378('0x45')][_0x9378('0x47')]?_0x36fa98[_0x9378('0x45')]:_0x2111f0[_0x9378('0x44')];if(!_0x44d4ac[_0x9378('0x40')][_0x9378('0x48')](_0x9378('0x49'))){_0x36fa98['limit']=qs[_0x9378('0x29')](_0x44d4ac['query']['limit']);_0x36fa98[_0x9378('0x2b')]=qs[_0x9378('0x2b')](_0x44d4ac[_0x9378('0x40')]['offset']);}_0x36fa98['order']=qs[_0x9378('0x4a')](_0x44d4ac[_0x9378('0x40')]['sort']);_0x36fa98[_0x9378('0x4b')]=qs['filters'](_[_0x9378('0x4c')](_0x44d4ac['query'],_0x2111f0['filters']),_0x49d0b2);if(_0x44d4ac[_0x9378('0x40')][_0x9378('0x4d')]){_0x36fa98[_0x9378('0x4b')]=_['merge'](_0x36fa98[_0x9378('0x4b')],{'$or':_['map'](_0x49d0b2,function(_0x7b0427){if(_0x7b0427[_0x9378('0x4e')]!==_0x9378('0x4f')){var _0x5eb5a2={};_0x5eb5a2[_0x7b0427['name']]={'$like':'%'+_0x44d4ac[_0x9378('0x40')][_0x9378('0x4d')]+'%'};return _0x5eb5a2;}})});}_0x36fa98=_[_0x9378('0x50')]({},_0x36fa98,_0x44d4ac['options']);var _0x406227={'where':_0x36fa98[_0x9378('0x4b')]};return db[_0x9378('0x51')][_0x9378('0x2a')](_0x406227)['then'](function(_0x558159){_0x47c3b0[_0x9378('0x2a')]=_0x558159;if(_0x44d4ac[_0x9378('0x40')][_0x9378('0x52')]){_0x36fa98[_0x9378('0x53')]=[{'all':!![]}];}return db[_0x9378('0x51')]['findAll'](_0x36fa98);})[_0x9378('0x1b')](function(_0x183351){_0x47c3b0[_0x9378('0x54')]=_0x183351;return _0x47c3b0;})['then'](respondWithFilteredResult(_0x31cfcd,_0x36fa98))[_0x9378('0x24')](handleError(_0x31cfcd,null));};exports[_0x9378('0x55')]=function(_0x26fc6a,_0x5b56a0){var _0xaee957={'raw':![],'where':{'id':_0x26fc6a[_0x9378('0x56')]['id']},'include':[{'model':db[_0x9378('0x3a')],'as':_0x9378('0x3b')}]},_0x38fdc7={};_0x38fdc7['model']=_[_0x9378('0x41')](db[_0x9378('0x51')]['rawAttributes']);_0x38fdc7[_0x9378('0x40')]=_['keys'](_0x26fc6a[_0x9378('0x40')]);_0x38fdc7['filters']=_[_0x9378('0x43')](_0x38fdc7[_0x9378('0x44')],_0x38fdc7[_0x9378('0x40')]);_0xaee957[_0x9378('0x45')]=_[_0x9378('0x43')](_0x38fdc7[_0x9378('0x44')],qs[_0x9378('0x46')](_0x26fc6a[_0x9378('0x40')][_0x9378('0x46')]));_0xaee957['attributes']=_0xaee957[_0x9378('0x45')]['length']?_0xaee957[_0x9378('0x45')]:_0x38fdc7[_0x9378('0x44')];if(_0x26fc6a[_0x9378('0x40')][_0x9378('0x52')]){_0xaee957['include']=[{'all':!![]}];}_0xaee957=_[_0x9378('0x50')]({},_0xaee957,_0x26fc6a[_0x9378('0x57')]);return db[_0x9378('0x51')][_0x9378('0x58')](_0xaee957)['then'](handleEntityNotFound(_0x5b56a0,null))[_0x9378('0x1b')](respondWithResult(_0x5b56a0,null))[_0x9378('0x24')](handleError(_0x5b56a0,null));};exports[_0x9378('0x59')]=function(_0x2e4ea6,_0x2b129c){return db[_0x9378('0x51')][_0x9378('0x59')](_0x2e4ea6[_0x9378('0x5a')],{})['then'](function(_0x5999f5){var _0x57e8d7=_0x2e4ea6[_0x9378('0x5b')][_0x9378('0x33')]({'plain':!![]});if(!_0x57e8d7)throw new Error(_0x9378('0x5c'));if(_0x57e8d7[_0x9378('0x5d')]===_0x9378('0x5b')){var _0x4c6127=_0x5999f5[_0x9378('0x33')]({'plain':!![]});var _0x264f6b=_0x9378('0x34');return db['UserProfileSection'][_0x9378('0x58')]({'where':{'name':_0x264f6b,'userProfileId':_0x57e8d7['userProfileId']},'raw':!![]})['then'](function(_0x4efcef){if(_0x4efcef&&_0x4efcef['autoAssociation']===0x0){return db[_0x9378('0x35')][_0x9378('0x59')]({'name':_0x4c6127[_0x9378('0x38')],'resourceId':_0x4c6127['id'],'type':_0x4efcef[_0x9378('0x38')],'sectionId':_0x4efcef['id']},{})[_0x9378('0x1b')](function(){return _0x5999f5;});}else{return _0x5999f5;}})[_0x9378('0x24')](function(_0x5b0e95){logger[_0x9378('0x20')](_0x9378('0x5e'),_0x5b0e95);throw _0x5b0e95;});}return _0x5999f5;})[_0x9378('0x1b')](respondWithResult(_0x2b129c,0xc9))[_0x9378('0x24')](handleError(_0x2b129c,null));};exports['update']=function(_0x11ff5d,_0x3e232f){if(_0x11ff5d[_0x9378('0x5a')]['id']){delete _0x11ff5d[_0x9378('0x5a')]['id'];}return db[_0x9378('0x51')][_0x9378('0x58')]({'where':{'id':_0x11ff5d[_0x9378('0x56')]['id']},'include':[{'model':db[_0x9378('0x3a')],'as':_0x9378('0x3b')}]})[_0x9378('0x1b')](handleEntityNotFound(_0x3e232f,null))[_0x9378('0x1b')](saveUpdates(_0x11ff5d['body'],null))[_0x9378('0x1b')](respondWithResult(_0x3e232f,null))[_0x9378('0x24')](handleError(_0x3e232f,null));};exports[_0x9378('0x32')]=function(_0x588e69,_0x16d568){return db[_0x9378('0x51')]['find']({'where':{'id':_0x588e69[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x16d568,null))[_0x9378('0x1b')](removeEntity(_0x16d568,null))['catch'](handleError(_0x16d568,null));};exports[_0x9378('0x5f')]=function(_0x3320a6,_0x4cbe2c){return db[_0x9378('0x51')][_0x9378('0x5f')]()[_0x9378('0x1b')](respondWithResult(_0x4cbe2c,null))[_0x9378('0x24')](handleError(_0x4cbe2c,null));};exports['addDisposition']=function(_0x173283,_0x548910,_0x4a0fb6){if(_0x173283[_0x9378('0x5a')]['id']){delete _0x173283[_0x9378('0x5a')]['id'];}return db[_0x9378('0x51')]['find']({'where':{'id':_0x173283[_0x9378('0x56')]['id']}})['then'](handleEntityNotFound(_0x548910,null))['then'](function(_0x43b549){if(_0x43b549){_0x173283[_0x9378('0x5a')]['SmsAccountId']=_0x43b549['id'];return db[_0x9378('0x60')][_0x9378('0x59')](_0x173283[_0x9378('0x5a')]);}})[_0x9378('0x1b')](respondWithResult(_0x548910,null))[_0x9378('0x24')](handleError(_0x548910,null));};exports[_0x9378('0x61')]=function(_0x58a995,_0x209672,_0x27c7cf){var _0x2329af={'raw':![],'where':{}};var _0x230efc={};var _0x36ee95={'count':0x0,'rows':[]};return db[_0x9378('0x51')][_0x9378('0x62')]({'where':{'id':_0x58a995[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x209672,null))[_0x9378('0x1b')](function(_0x165d1a){if(_0x165d1a){_0x230efc['model']=_[_0x9378('0x41')](db[_0x9378('0x60')]['rawAttributes']);_0x230efc[_0x9378('0x40')]=_[_0x9378('0x41')](_0x58a995[_0x9378('0x40')]);_0x230efc[_0x9378('0x42')]=_[_0x9378('0x43')](_0x230efc[_0x9378('0x44')],_0x230efc[_0x9378('0x40')]);_0x2329af['attributes']=_['intersection'](_0x230efc[_0x9378('0x44')],qs[_0x9378('0x46')](_0x58a995['query']['fields']));_0x2329af['attributes']=_0x2329af['attributes'][_0x9378('0x47')]?_0x2329af[_0x9378('0x45')]:_0x230efc[_0x9378('0x44')];if(!_0x58a995[_0x9378('0x40')][_0x9378('0x48')](_0x9378('0x49'))){_0x2329af[_0x9378('0x29')]=qs[_0x9378('0x29')](_0x58a995['query'][_0x9378('0x29')]);_0x2329af[_0x9378('0x2b')]=qs[_0x9378('0x2b')](_0x58a995[_0x9378('0x40')][_0x9378('0x2b')]);}_0x2329af['order']=qs[_0x9378('0x4a')](_0x58a995[_0x9378('0x40')]['sort']);_0x2329af[_0x9378('0x4b')]=qs[_0x9378('0x42')](_[_0x9378('0x4c')](_0x58a995[_0x9378('0x40')],_0x230efc[_0x9378('0x42')]));_0x2329af[_0x9378('0x4b')]['SmsAccountId']=_0x165d1a['id'];if(_0x58a995[_0x9378('0x40')][_0x9378('0x4d')]){_0x2329af[_0x9378('0x4b')]=_[_0x9378('0x50')](_0x2329af[_0x9378('0x4b')],{'$or':_[_0x9378('0x3c')](_0x2329af[_0x9378('0x45')],function(_0x56aed9){var _0x5523f2={};_0x5523f2[_0x56aed9]={'$like':'%'+_0x58a995[_0x9378('0x40')][_0x9378('0x4d')]+'%'};return _0x5523f2;})});}_0x2329af=_[_0x9378('0x50')]({},_0x2329af,_0x58a995[_0x9378('0x57')]);return db['Disposition'][_0x9378('0x2a')]({'where':_0x2329af[_0x9378('0x4b')]})[_0x9378('0x1b')](function(_0x5db8d9){_0x36ee95[_0x9378('0x2a')]=_0x5db8d9;if(_0x58a995[_0x9378('0x40')]['includeAll']){_0x2329af[_0x9378('0x53')]=[{'all':!![]}];}return db[_0x9378('0x60')][_0x9378('0x63')](_0x2329af);})[_0x9378('0x1b')](function(_0x2da2b0){_0x36ee95['rows']=_0x2da2b0;return _0x36ee95;});}})['then'](respondWithFilteredResult(_0x209672,_0x2329af))[_0x9378('0x24')](handleError(_0x209672,null));};exports[_0x9378('0x64')]=function(_0x3d348b,_0x14e6ba,_0x5ce235){return db[_0x9378('0x51')]['find']({'where':{'id':_0x3d348b[_0x9378('0x56')]['id']}})['then'](handleEntityNotFound(_0x14e6ba,null))[_0x9378('0x1b')](function(_0x35ce65){if(_0x35ce65){return _0x35ce65[_0x9378('0x64')](_0x3d348b[_0x9378('0x40')][_0x9378('0x65')]);}})[_0x9378('0x1b')](respondWithStatusCode(_0x14e6ba,null))[_0x9378('0x24')](handleError(_0x14e6ba,null));};exports[_0x9378('0x66')]=function(_0x477e49,_0x2b268a,_0x317fc9){if(_0x477e49['body']['id']){delete _0x477e49[_0x9378('0x5a')]['id'];}return db[_0x9378('0x51')][_0x9378('0x58')]({'where':{'id':_0x477e49[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x2b268a,null))[_0x9378('0x1b')](function(_0x335cfb){if(_0x335cfb){_0x477e49[_0x9378('0x5a')][_0x9378('0x67')]=_0x335cfb['id'];return db[_0x9378('0x68')]['create'](_0x477e49[_0x9378('0x5a')]);}})[_0x9378('0x1b')](respondWithResult(_0x2b268a,null))[_0x9378('0x24')](handleError(_0x2b268a,null));};exports[_0x9378('0x69')]=function(_0xcf1bd5,_0x29cd36,_0x38f2f4){var _0x1df29a={'raw':![],'where':{}};var _0x68fc66={};var _0x237656={'count':0x0,'rows':[]};return db[_0x9378('0x51')][_0x9378('0x62')]({'where':{'id':_0xcf1bd5['params']['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x29cd36,null))[_0x9378('0x1b')](function(_0x595523){if(_0x595523){_0x68fc66[_0x9378('0x44')]=_['keys'](db[_0x9378('0x68')][_0x9378('0x3d')]);_0x68fc66[_0x9378('0x40')]=_[_0x9378('0x41')](_0xcf1bd5['query']);_0x68fc66['filters']=_[_0x9378('0x43')](_0x68fc66[_0x9378('0x44')],_0x68fc66[_0x9378('0x40')]);_0x1df29a[_0x9378('0x45')]=_[_0x9378('0x43')](_0x68fc66[_0x9378('0x44')],qs[_0x9378('0x46')](_0xcf1bd5['query'][_0x9378('0x46')]));_0x1df29a[_0x9378('0x45')]=_0x1df29a[_0x9378('0x45')]['length']?_0x1df29a['attributes']:_0x68fc66['model'];if(!_0xcf1bd5[_0x9378('0x40')][_0x9378('0x48')](_0x9378('0x49'))){_0x1df29a[_0x9378('0x29')]=qs[_0x9378('0x29')](_0xcf1bd5['query'][_0x9378('0x29')]);_0x1df29a[_0x9378('0x2b')]=qs[_0x9378('0x2b')](_0xcf1bd5['query']['offset']);}_0x1df29a['order']=qs[_0x9378('0x4a')](_0xcf1bd5[_0x9378('0x40')][_0x9378('0x4a')]);_0x1df29a['where']=qs['filters'](_[_0x9378('0x4c')](_0xcf1bd5['query'],_0x68fc66[_0x9378('0x42')]));_0x1df29a[_0x9378('0x4b')][_0x9378('0x67')]=_0x595523['id'];if(_0xcf1bd5[_0x9378('0x40')][_0x9378('0x4d')]){_0x1df29a[_0x9378('0x4b')]=_[_0x9378('0x50')](_0x1df29a[_0x9378('0x4b')],{'$or':_[_0x9378('0x3c')](_0x1df29a[_0x9378('0x45')],function(_0x4ca90b){var _0x446a20={};_0x446a20[_0x4ca90b]={'$like':'%'+_0xcf1bd5[_0x9378('0x40')][_0x9378('0x4d')]+'%'};return _0x446a20;})});}_0x1df29a=_['merge']({},_0x1df29a,_0xcf1bd5['options']);return db['CannedAnswer'][_0x9378('0x2a')]({'where':_0x1df29a['where']})['then'](function(_0x1e1c24){_0x237656[_0x9378('0x2a')]=_0x1e1c24;if(_0xcf1bd5[_0x9378('0x40')][_0x9378('0x52')]){_0x1df29a[_0x9378('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9378('0x63')](_0x1df29a);})['then'](function(_0x2cdd10){_0x237656[_0x9378('0x54')]=_0x2cdd10;return _0x237656;});}})['then'](respondWithFilteredResult(_0x29cd36,_0x1df29a))[_0x9378('0x24')](handleError(_0x29cd36,null));};exports[_0x9378('0x6a')]=function(_0x319c44,_0x5a0690,_0x40e255){return db[_0x9378('0x51')]['find']({'where':{'id':_0x319c44[_0x9378('0x56')]['id']}})['then'](handleEntityNotFound(_0x5a0690,null))[_0x9378('0x1b')](function(_0x6e2f8e){if(_0x6e2f8e){return _0x6e2f8e['removeAnswers'](_0x319c44['query']['ids']);}})[_0x9378('0x1b')](respondWithStatusCode(_0x5a0690,null))['catch'](handleError(_0x5a0690,null));};exports[_0x9378('0x6b')]=function(_0x161235,_0x68bf13,_0x7d8fa5){var _0x107902={'channel':_0x9378('0x6c')};var _0x3d7dd0=[];var _0x5f7585=[];var _0x3ee219={};return db[_0x9378('0x51')][_0x9378('0x58')]({'where':{'id':_0x161235[_0x9378('0x56')]['id']},'include':[{'model':db[_0x9378('0x6d')],'as':_0x9378('0x6e')}]})[_0x9378('0x1b')](handleEntityNotFound(_0x68bf13,null))[_0x9378('0x1b')](function(_0xc43398){_0x107902[_0x9378('0x6f')]=_0xc43398;_0x107902[_0x9378('0x70')]=_[_0x9378('0x71')](_0xc43398[_0x9378('0x6e')],['priority'],[_0x9378('0x72')]);if(_0x107902['account'][_0x9378('0x6e')]){delete _0x107902['account'][_0x9378('0x6e')];}return db[_0x9378('0x73')][_0x9378('0x5f')]();})[_0x9378('0x1b')](function(_0x5e8a39){if(!_0x5e8a39){throw new db[(_0x9378('0x74'))]['ValidationError']('no\x20available\x20attributes');}_0x3d7dd0=_[_0x9378('0x75')](_[_0x9378('0x41')](_0x5e8a39),[_0x9378('0x76'),_0x9378('0x77')]);_0x5f7585=_[_0x9378('0x75')](_[_0x9378('0x41')](_0x5e8a39),[_0x9378('0x76'),_0x9378('0x77'),_0x9378('0x78'),_0x9378('0x79')]);_0x107902[_0x9378('0x5a')]={'mapKey':_0x9378('0x7a')};if(_0x107902['account'][_0x9378('0x4e')]){switch(_0x107902['account'][_0x9378('0x4e')]){case _0x9378('0x7b'):_0x107902['body'][_0x9378('0x7c')]=_0x161235[_0x9378('0x5a')]['From'];_0x107902[_0x9378('0x5a')][_0x9378('0x5a')]=_0x161235[_0x9378('0x5a')]['Body'];_0x107902[_0x9378('0x5a')]['messageId']=_0x161235['body'][_0x9378('0x7d')];break;case _0x9378('0x7e'):_0x107902['body']['from']='+'+_0x161235['body']['sender'];_0x107902[_0x9378('0x5a')][_0x9378('0x5a')]=_0x161235[_0x9378('0x5a')][_0x9378('0x7f')];break;case _0x9378('0x80'):_0x107902[_0x9378('0x5a')][_0x9378('0x7c')]=_0x161235[_0x9378('0x5a')]['from'];_0x107902[_0x9378('0x5a')][_0x9378('0x5a')]=_0x161235[_0x9378('0x5a')][_0x9378('0x21')];break;case'clicksend':_0x107902['body'][_0x9378('0x7c')]=_0x161235[_0x9378('0x5a')][_0x9378('0x7c')];_0x107902[_0x9378('0x5a')][_0x9378('0x5a')]=_0x161235[_0x9378('0x5a')][_0x9378('0x5a')];_0x107902[_0x9378('0x5a')][_0x9378('0x81')]=_0x161235[_0x9378('0x5a')][_0x9378('0x82')];break;case _0x9378('0x83'):_0x107902[_0x9378('0x5a')]['from']=_0x161235[_0x9378('0x5a')][_0x9378('0x84')];_0x107902['body'][_0x9378('0x5a')]=_0x161235['body'][_0x9378('0x85')];_0x107902[_0x9378('0x5a')][_0x9378('0x81')]=_0x161235[_0x9378('0x5a')]['MessageUUID'];break;case _0x9378('0x86'):_0x107902[_0x9378('0x5a')]['from']='+'+_0x161235['body'][_0x9378('0x87')][0x0][_0x9378('0x7c')];_0x107902[_0x9378('0x5a')]['body']=_0x161235[_0x9378('0x5a')][_0x9378('0x87')][0x0][_0x9378('0x7f')];_0x107902[_0x9378('0x5a')][_0x9378('0x81')]=_0x161235['body'][_0x9378('0x87')][0x0][_0x9378('0x81')];break;case _0x9378('0x88'):_0x107902[_0x9378('0x5a')]['from']=_0x161235[_0x9378('0x5a')][_0x9378('0x89')];_0x107902['body'][_0x9378('0x5a')]=_0x161235[_0x9378('0x5a')][_0x9378('0x8a')]['message'];break;case _0x9378('0x8b'):_0x107902['body']['from']=_0x161235[_0x9378('0x5a')][_0x9378('0x8c')];_0x107902[_0x9378('0x5a')][_0x9378('0x5a')]=_0x161235[_0x9378('0x5a')][_0x9378('0x7f')];_0x107902[_0x9378('0x5a')][_0x9378('0x81')]=_0x161235[_0x9378('0x5a')][_0x9378('0x8d')];break;case _0x9378('0x8e'):_0x107902['body']['messageId']=_0x161235['body'][0x0][_0x9378('0x21')]['id'];_0x107902[_0x9378('0x5a')][_0x9378('0x7c')]=_0x161235[_0x9378('0x5a')][0x0]['message'][_0x9378('0x7c')];_0x107902[_0x9378('0x5a')]['body']=_0x161235[_0x9378('0x5a')][0x0][_0x9378('0x21')]['text'];break;case _0x9378('0x8f'):_0x107902[_0x9378('0x5a')][_0x9378('0x7c')]=_0x161235[_0x9378('0x5a')][_0x9378('0x7c')];_0x107902['body'][_0x9378('0x5a')]=_0x161235[_0x9378('0x5a')][_0x9378('0x21')];_0x107902[_0x9378('0x5a')][_0x9378('0x81')]=_0x161235[_0x9378('0x5a')][_0x9378('0x90')];break;}}if(_0x107902[_0x9378('0x5a')]['id']){delete _0x107902[_0x9378('0x5a')]['id'];}if(_[_0x9378('0x91')](_0x107902[_0x9378('0x5a')][_0x9378('0x7c')])){throw new db[(_0x9378('0x74'))][(_0x9378('0x92'))](_0x9378('0x93'));}if(_[_0x9378('0x91')](_0x107902[_0x9378('0x5a')][_0x9378('0x5a')])||_0x107902[_0x9378('0x5a')][_0x9378('0x5a')]===''){throw new db[(_0x9378('0x74'))][(_0x9378('0x92'))](_0x9378('0x94'));}if(_['isNil'](_0x107902['body'][_0x9378('0x95')])){throw new db['Sequelize']['ValidationError'](_0x9378('0x96')+_0x5f7585);}if(!_[_0x9378('0x97')](_0x5f7585,_0x107902[_0x9378('0x5a')][_0x9378('0x95')])){throw new db[(_0x9378('0x74'))][(_0x9378('0x92'))](_0x9378('0x98')+_0x5f7585);}_0x3ee219[_0x107902[_0x9378('0x5a')][_0x9378('0x95')]]=_0x107902['body'][_0x9378('0x7c')];return db['CmList'][_0x9378('0x58')]({'where':{'id':_0x107902[_0x9378('0x6f')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x9378('0x99'),'where':_0x3ee219,'limit':0x1,'order':[['updatedAt',_0x9378('0x9a')]]}]});})[_0x9378('0x1b')](handleEntityNotFound(_0x68bf13,null))[_0x9378('0x1b')](function(_0x43fb19){if(_0x43fb19){_0x107902[_0x9378('0x9b')]=_[_0x9378('0x9c')](_0x43fb19,['Contacts']);if(_0x43fb19[_0x9378('0x99')][_0x9378('0x47')]){return _0x43fb19[_0x9378('0x99')][0x0];}var _0x41d406=_['defaults'](_0x107902[_0x9378('0x5a')],{'firstName':_0x107902[_0x9378('0x5a')][_0x9378('0x7c')],'ListId':_0x43fb19['id']});_0x41d406[_0x107902['body'][_0x9378('0x95')]]=_0x107902[_0x9378('0x5a')][_0x9378('0x7c')];return db[_0x9378('0x73')][_0x9378('0x59')](_0x41d406,{'fields':_0x3d7dd0,'raw':!![]});}})['then'](handleEntityNotFound(_0x68bf13,null))[_0x9378('0x1b')](function(_0xc12601){if(_0xc12601){_0x107902[_0x9378('0x9d')]=_0xc12601;var _0x24dfff={'ContactId':_0xc12601['id'],'phone':_0x107902[_0x9378('0x5a')][_0x9378('0x7c')],'SmsAccountId':_0x161235[_0x9378('0x56')]['id']};var _0x1ba8ef={'ContactId':_0xc12601['id'],'SmsAccountId':_0x161235[_0x9378('0x56')]['id'],'closed':![]};return db['SmsInteraction'][_0x9378('0x58')]({'where':_0x1ba8ef})[_0x9378('0x1b')](function(_0x21e9d4){if(_0x21e9d4){return[_0x21e9d4,![]];}return db[_0x9378('0x9e')][_0x9378('0x59')](_0x24dfff)[_0x9378('0x1b')](function(_0x30f903){return[_0x30f903,!![]];});});}})[_0x9378('0x9f')](function(_0x5ddef6,_0x43398a){_0x107902[_0x9378('0xa0')]=_0x5ddef6[_0x9378('0x33')]({'plain':!![]});_0x107902[_0x9378('0xa0')][_0x9378('0xa1')]=![];if(_0x43398a){if(_0x107902['account'][_0x9378('0xa2')]){_0x107902['applications'][_0x9378('0xa3')]({'id':0x0,'priority':_0x107902[_0x9378('0x70')]['length']+0x1,'app':_0x9378('0xa4'),'appdata':'unmanaged','interval':_0x9378('0xa5')});}_0x107902['interaction'][_0x9378('0xa1')]=!![];}return db['SmsMessage'][_0x9378('0x59')]({'phone':_0x107902['body'][_0x9378('0x7c')],'messageId':_0x107902[_0x9378('0x5a')][_0x9378('0x81')],'body':_0x107902['body'][_0x9378('0x5a')],'SmsAccountId':_0x161235[_0x9378('0x56')]['id'],'SmsInteractionId':_0x5ddef6['id'],'direction':'in','ContactId':_0x5ddef6[_0x9378('0xa6')],'AttachmentId':_0x107902[_0x9378('0x5a')][_0x9378('0xa7')]});})[_0x9378('0x1b')](function(_0x212b55){_0x107902[_0x9378('0x21')]=_0x212b55;if(!_0x107902[_0x9378('0xa0')][_0x9378('0xa8')])return;return db[_0x9378('0xa9')][_0x9378('0x58')]({'attributes':['id',_0x9378('0x38')],'where':{'id':_0x107902[_0x9378('0xa0')]['UserId']}});})[_0x9378('0x1b')](function(_0x40115c){if(_0x40115c){_0x107902[_0x9378('0x70')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x40115c[_0x9378('0x38')]+','+(_0x107902[_0x9378('0x6f')]['waitForTheAssignedAgent']||0xa),'interval':_0x9378('0xa5')});}if(!_0x107902['interaction'][_0x9378('0xaa')])return;return db[_0x9378('0xab')][_0x9378('0x58')]({'attributes':['id','name'],'where':{'id':_0x107902['interaction']['queueId']}});})[_0x9378('0x1b')](function(_0x321dbe){if(_0x321dbe){_0x107902['applications'][_0x9378('0xac')]({'id':0x0,'priority':0x1,'app':_0x9378('0xad'),'appdata':_0x321dbe[_0x9378('0x38')]+','+(_0x107902['account'][_0x9378('0xae')]||0x12c),'interval':_0x9378('0xa5')});}return respondWithRpcPromise(_0x9378('0xaf'),_0x9378('0xb0'),_0x107902);})[_0x9378('0x1b')](function(_0x57484b){if(_0x57484b){var _0x1593b4=0xc8;var _0x5530af='receiveMessage';logger['info'](_0x9378('0x1e'),_0x5530af,_0x1593b4,'entity\x20found');logger['debug'](_0x9378('0xb1'),_0x5530af,_0x1593b4,_0x9378('0xb2'),JSON[_0x9378('0x1f')](_0x57484b));if(_0x107902[_0x9378('0x6f')][_0x9378('0x4e')]===_0x9378('0x7b')){return _0x68bf13[_0x9378('0x25')](_0x1593b4)[_0x9378('0x2c')]('Content-Type',_0x9378('0xb3'))['send'](_0x9378('0xb4'));}else{return _0x68bf13['status'](_0x1593b4)[_0x9378('0x27')](_0x57484b);}}})['catch'](handleError(_0x68bf13,null));};exports[_0x9378('0xb5')]=function(_0x127745,_0x2901e6){var _0x325622=_0x127745[_0x9378('0x56')]['id'];var _0x2547d5=_0x127745[_0x9378('0x5a')];var _0x51c2d6=0xc8;var _0x3e62dd=null;return db[_0x9378('0xb6')][_0x9378('0xb7')]({'isolationLevel':db[_0x9378('0xb6')][_0x9378('0xb8')]['ISOLATION_LEVELS'][_0x9378('0xb9')]},function(_0x9d7ba2){return db['SmsAccount'][_0x9378('0x62')]({'where':{'id':_0x325622},'transaction':_0x9d7ba2})[_0x9378('0x1b')](function(_0x2e120b){if(_0x2e120b){return db[_0x9378('0x6d')]['destroy']({'where':{'SmsAccountId':_0x325622},'transaction':_0x9d7ba2})[_0x9378('0x1b')](function(){var _0xbc83a7=_[_0x9378('0x3c')](_0x2547d5,function(_0x3d0014){_0x3d0014[_0x9378('0x67')]=_0x325622;return _0x3d0014;});return db[_0x9378('0x6d')][_0x9378('0xba')](_0xbc83a7,{'transaction':_0x9d7ba2});});}else{_0x51c2d6=0x194;_0x3e62dd=[];}});})[_0x9378('0x1b')](function(){if(_0x51c2d6!==0x194){return db[_0x9378('0x6d')][_0x9378('0xbb')]({'where':{'SmsAccountId':_0x325622},'order':_0x9378('0xbc')})[_0x9378('0x1b')](function(_0x1174b2){_0x3e62dd=_0x1174b2;});}})[_0x9378('0x24')](function(_0x212640){_0x51c2d6=0x1f4;logger['error'](_0x212640[_0x9378('0x37')]);if(_0x212640[_0x9378('0x38')]){delete _0x212640[_0x9378('0x38')];}_0x3e62dd=_0x212640;})['finally'](function(){if(_0x3e62dd===null){_0x2901e6['sendStatus'](_0x51c2d6);}else{if(_0x51c2d6===0x1f4){_0x2901e6[_0x9378('0x25')](_0x51c2d6)['send'](_0x3e62dd);}else{_0x2901e6['status'](_0x51c2d6)['json'](_0x3e62dd);}}});};exports[_0x9378('0xbd')]=function(_0x3c41fc,_0x59ea64,_0x2ceb21){var _0x480c08={};var _0x7392b1={};var _0x213940;var _0x36e2e7;return db[_0x9378('0x51')][_0x9378('0x62')]({'where':{'id':_0x3c41fc[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x59ea64,null))['then'](function(_0x3384d1){if(_0x3384d1){_0x213940=_0x3384d1;_0x7392b1['model']=_['keys'](db[_0x9378('0x6d')][_0x9378('0x3d')]);_0x7392b1[_0x9378('0x40')]=_[_0x9378('0x41')](_0x3c41fc[_0x9378('0x40')]);_0x7392b1[_0x9378('0x42')]=_[_0x9378('0x43')](_0x7392b1[_0x9378('0x44')],_0x7392b1['query']);_0x480c08[_0x9378('0x45')]=_[_0x9378('0x43')](_0x7392b1[_0x9378('0x44')],qs[_0x9378('0x46')](_0x3c41fc['query'][_0x9378('0x46')]));_0x480c08[_0x9378('0x45')]=_0x480c08[_0x9378('0x45')][_0x9378('0x47')]?_0x480c08['attributes']:_0x7392b1[_0x9378('0x44')];_0x480c08[_0x9378('0xbe')]=qs[_0x9378('0x4a')](_0x3c41fc[_0x9378('0x40')][_0x9378('0x4a')]);_0x480c08['where']=qs[_0x9378('0x42')](_[_0x9378('0x4c')](_0x3c41fc[_0x9378('0x40')],_0x7392b1[_0x9378('0x42')]));if(_0x3c41fc[_0x9378('0x40')][_0x9378('0x4d')]){_0x480c08[_0x9378('0x4b')]=_[_0x9378('0x50')](_0x480c08[_0x9378('0x4b')],{'$or':_[_0x9378('0x3c')](_0x480c08['attributes'],function(_0x5efc9a){var _0x3d7777={};_0x3d7777[_0x5efc9a]={'$like':'%'+_0x3c41fc[_0x9378('0x40')][_0x9378('0x4d')]+'%'};return _0x3d7777;})});}_0x480c08=_[_0x9378('0x50')]({},_0x480c08,_0x3c41fc[_0x9378('0x57')]);return _0x213940[_0x9378('0xbd')](_0x480c08);}})[_0x9378('0x1b')](function(_0x25fd5d){if(_0x25fd5d){_0x36e2e7=_0x25fd5d[_0x9378('0x47')];if(!_0x3c41fc['query'][_0x9378('0x48')](_0x9378('0x49'))){_0x480c08[_0x9378('0x29')]=qs[_0x9378('0x29')](_0x3c41fc[_0x9378('0x40')][_0x9378('0x29')]);_0x480c08[_0x9378('0x2b')]=qs[_0x9378('0x2b')](_0x3c41fc[_0x9378('0x40')][_0x9378('0x2b')]);}return _0x213940[_0x9378('0xbd')](_0x480c08);}})['then'](function(_0x328915){if(_0x328915){return _0x328915?{'count':_0x36e2e7,'rows':_0x328915}:null;}})[_0x9378('0x1b')](respondWithResult(_0x59ea64,null))['catch'](handleError(_0x59ea64,null));};exports[_0x9378('0xbf')]=function(_0x599d68,_0xc26f4f,_0x5ab610){var _0x6de770={'raw':![],'where':{}};var _0x18e280={};var _0x43a6b7={'count':0x0,'rows':[]};return db[_0x9378('0x51')][_0x9378('0x62')]({'where':{'id':_0x599d68[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0xc26f4f,null))[_0x9378('0x1b')](function(_0x3b617a){if(_0x3b617a){_0x18e280[_0x9378('0x44')]=_['keys'](db[_0x9378('0x9e')][_0x9378('0x3d')]);_0x18e280['query']=_[_0x9378('0x41')](_0x599d68['query']);_0x18e280[_0x9378('0x42')]=_[_0x9378('0x43')](_0x18e280[_0x9378('0x44')],_0x18e280[_0x9378('0x40')]);_0x6de770[_0x9378('0x45')]=_[_0x9378('0x43')](_0x18e280[_0x9378('0x44')],qs[_0x9378('0x46')](_0x599d68[_0x9378('0x40')][_0x9378('0x46')]));_0x6de770[_0x9378('0x45')]=_0x6de770[_0x9378('0x45')][_0x9378('0x47')]?_0x6de770[_0x9378('0x45')]:_0x18e280[_0x9378('0x44')];if(!_0x599d68['query'][_0x9378('0x48')](_0x9378('0x49'))){_0x6de770['limit']=qs[_0x9378('0x29')](_0x599d68[_0x9378('0x40')][_0x9378('0x29')]);_0x6de770[_0x9378('0x2b')]=qs['offset'](_0x599d68['query'][_0x9378('0x2b')]);}_0x6de770[_0x9378('0xbe')]=qs[_0x9378('0x4a')](_0x599d68['query'][_0x9378('0x4a')]);_0x6de770[_0x9378('0x4b')]=qs[_0x9378('0x42')](_[_0x9378('0x4c')](_0x599d68['query'],_0x18e280[_0x9378('0x42')]));_0x6de770[_0x9378('0x4b')][_0x9378('0x67')]=_0x3b617a['id'];if(_0x599d68['query'][_0x9378('0x4d')]){_0x6de770[_0x9378('0x4b')]=_[_0x9378('0x50')](_0x6de770[_0x9378('0x4b')],{'$or':_[_0x9378('0x3c')](_0x6de770['attributes'],function(_0x3b1015){var _0x339198={};_0x339198[_0x3b1015]={'$like':'%'+_0x599d68['query'][_0x9378('0x4d')]+'%'};return _0x339198;})});}_0x6de770=_[_0x9378('0x50')]({},_0x6de770,_0x599d68['options']);return db[_0x9378('0x9e')][_0x9378('0x2a')]({'where':_0x6de770[_0x9378('0x4b')]})[_0x9378('0x1b')](function(_0x419d10){_0x43a6b7['count']=_0x419d10;if(_0x599d68['query'][_0x9378('0x52')]){_0x6de770[_0x9378('0x53')]=[{'model':db[_0x9378('0x73')],'as':'Contact','required':![]},{'model':db[_0x9378('0xa9')],'as':'Owner','attributes':[_0x9378('0x38'),_0x9378('0xc0'),_0x9378('0xc1')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x9378('0x38'),'color'],'where':_0x599d68['query'][_0x9378('0xc2')]?{'id':_0x599d68[_0x9378('0x40')][_0x9378('0xc2')]}:undefined,'required':_0x599d68[_0x9378('0x40')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x9378('0x63')](_0x6de770);})[_0x9378('0x1b')](function(_0x5e11be){_0x43a6b7[_0x9378('0x54')]=_0x5e11be;return _0x43a6b7;});}})['then'](respondWithFilteredResult(_0xc26f4f,_0x6de770))[_0x9378('0x24')](handleError(_0xc26f4f,null));};exports[_0x9378('0x39')]=function(_0x2da856,_0x1882d4,_0x66ad8e){var _0x13b009,_0x3ce0f9,_0x4eb64e;if(_[_0x9378('0x91')](_0x2da856[_0x9378('0x5a')][_0x9378('0x5a')])||_0x2da856[_0x9378('0x5a')][_0x9378('0x5a')]===''){throw new db[(_0x9378('0x74'))][(_0x9378('0x92'))](_0x9378('0x94'));}if(_[_0x9378('0x91')](_0x2da856[_0x9378('0x5a')]['to'])){throw new db[(_0x9378('0x74'))][(_0x9378('0x92'))](_0x9378('0xc3'));}_0x13b009=_0x2da856[_0x9378('0x5a')]['to'];return db[_0x9378('0x51')][_0x9378('0x58')]({'where':{'id':_0x2da856[_0x9378('0x56')]['id']},'include':[{'model':db[_0x9378('0xc4')],'as':'List','include':[{'model':db[_0x9378('0x73')],'as':_0x9378('0x99'),'where':{'mobile':_0x13b009},'limit':0x1,'order':[[_0x9378('0x77'),_0x9378('0x9a')]]}]}]})['then'](handleEntityNotFound(_0x1882d4,null))['then'](function(_0x1a1334){if(_0x1a1334&&_0x1a1334['List']){_0x3ce0f9=_0x1a1334[_0x9378('0x33')]({'plain':!![]});if(_0x3ce0f9['List']&&_0x3ce0f9[_0x9378('0xc5')][_0x9378('0x99')][_0x9378('0x47')]){return _0x3ce0f9[_0x9378('0xc5')][_0x9378('0x99')][0x0];}return db[_0x9378('0x73')][_0x9378('0x59')](_[_0x9378('0xc6')](_0x2da856[_0x9378('0x5a')],{'firstName':_0x13b009,'mobile':_0x13b009,'phone':_0x13b009,'ListId':_0x3ce0f9[_0x9378('0x79')]}));}})[_0x9378('0x1b')](handleEntityNotFound(_0x1882d4,null))[_0x9378('0x1b')](function(_0x564c55){if(_0x564c55){_0x4eb64e=_0x564c55;return db[_0x9378('0x9e')][_0x9378('0x58')]({'where':{'ContactId':_0x4eb64e['id'],'closed':![],'SmsAccountId':_0x3ce0f9['id']}})[_0x9378('0x1b')](function(_0x38a036){if(_0x38a036){return[_0x38a036,![]];}return db[_0x9378('0x9e')]['create']({'UserId':_0x2da856['user']['id'],'ContactId':_0x4eb64e['id'],'SmsAccountId':_0x3ce0f9['id'],'phone':_0x13b009,'firstMsgDirection':_0x9378('0xc7'),'Messages':[_[_0x9378('0x50')](_0x2da856['body'],{'read':![],'body':_0x2da856[_0x9378('0x5a')][_0x9378('0x5a')],'phone':_0x13b009,'SmsAccountId':_0x3ce0f9['id'],'UserId':_0x2da856[_0x9378('0x5b')]['id'],'ContactId':_0x4eb64e['id']})]},{'include':[{'model':db[_0x9378('0xc8')],'as':_0x9378('0xc9')}]})['then'](function(_0x5acb13){return[_0x5acb13,!![]];});});}})[_0x9378('0x9f')](function(_0x57d774,_0x46664d){if(_0x46664d){return _0x57d774;}return db[_0x9378('0xc8')][_0x9378('0x59')](_[_0x9378('0x50')](_0x2da856['body'],{'read':![],'body':_0x2da856[_0x9378('0x5a')][_0x9378('0x5a')],'phone':_0x13b009,'SmsAccountId':_0x3ce0f9['id'],'SmsInteractionId':_0x57d774['id'],'UserId':_0x2da856['user']['id'],'ContactId':_0x4eb64e['id']}))[_0x9378('0x1b')](function(_0x132dc0){_0x57d774[_0x9378('0xca')][_0x9378('0xc9')]=[];_0x57d774['dataValues'][_0x9378('0xc9')][_0x9378('0xa3')](_0x132dc0['dataValues']);return _0x57d774;});})['then'](respondWithResult(_0x1882d4,null))[_0x9378('0x24')](handleError(_0x1882d4,null));};exports['status']=function(_0x597e6f,_0x3677bd,_0x14580b){if(_0x597e6f['body']['id']){delete _0x597e6f[_0x9378('0x5a')]['id'];}var _0x2eea21,_0x5439c8,_0x5d9c33;return db['SmsAccount']['find']({'where':{'id':_0x597e6f[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x3677bd,null))[_0x9378('0x1b')](function(_0x23b07){if(_0x23b07){_0x5d9c33=_0x23b07;logger[_0x9378('0xcb')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9378('0x25'),_0x9378('0xcc'),_0x23b07[_0x9378('0x4e')],util[_0x9378('0xcd')](_0x597e6f['body'],{'showHidden':![],'depth':null}));switch(_0x23b07[_0x9378('0x4e')]){case _0x9378('0x7e'):if(_0x597e6f[_0x9378('0x5a')][_0x9378('0xce')]&&_0x597e6f[_0x9378('0x5a')][_0x9378('0x25')]){_0x5439c8=_0x597e6f[_0x9378('0x5a')][_0x9378('0x25')];return db['SmsMessage'][_0x9378('0x58')]({'where':{'messageId':_0x597e6f[_0x9378('0x5a')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x597e6f[_0x9378('0x5a')][_0x9378('0xcf')]&&_0x597e6f['body']['statusInt']){_0x5439c8=_0x597e6f[_0x9378('0x5a')][_0x9378('0xd0')];return db[_0x9378('0xc8')][_0x9378('0x58')]({'where':{'messageId':_0x597e6f[_0x9378('0x5a')][_0x9378('0xcf')]}});}break;case'clicksend':if(_0x597e6f[_0x9378('0x5a')][_0x9378('0x82')]&&_0x597e6f['body'][_0x9378('0xd1')]){_0x5439c8=_0x597e6f[_0x9378('0x5a')][_0x9378('0xd1')];return db[_0x9378('0xc8')][_0x9378('0x58')]({'where':{'messageId':_0x597e6f[_0x9378('0x5a')][_0x9378('0x82')]}});}break;case'infobip':var _0x2f49e0=_0x597e6f['body'][_0x9378('0x87')][0x0];if(_0x2f49e0[_0x9378('0x81')]&&_0x2f49e0[_0x9378('0x25')][_0x9378('0xd2')]===_0x9378('0xd3')){_0x5439c8=_0x2f49e0[_0x9378('0x25')][_0x9378('0xd2')];return db[_0x9378('0xc8')][_0x9378('0x58')]({'where':{'messageId':_0x2f49e0[_0x9378('0x81')]}});}break;case _0x9378('0x8b'):if(_0x597e6f[_0x9378('0x5a')][_0x9378('0x81')]&&_0x597e6f['body'][_0x9378('0x25')]){_0x5439c8=_0x597e6f['body']['status'];return db[_0x9378('0xc8')][_0x9378('0x58')]({'where':{'messageId':_0x597e6f['body']['messageId']}});}break;case _0x9378('0x8e'):if(_0x597e6f[_0x9378('0x5a')][0x0]['message']['id']){_0x5439c8=_0x597e6f['body'][0x0][_0x9378('0x4e')];return db[_0x9378('0xc8')][_0x9378('0x58')]({'where':{'messageId':_0x597e6f['body'][0x0][_0x9378('0x21')]['id']}});}break;case _0x9378('0x8f'):if(_0x597e6f[_0x9378('0x5a')][_0x9378('0xd4')]&&_0x597e6f[_0x9378('0x5a')][_0x9378('0x25')]){_0x5439c8=_0x597e6f[_0x9378('0x5a')]['status'];return db[_0x9378('0xc8')]['find']({'where':{'messageId':_0x597e6f[_0x9378('0x5a')]['redif']}});}break;}}})[_0x9378('0x1b')](handleEntityNotFound(_0x3677bd,null))[_0x9378('0x1b')](function(_0x2a7a89){if(_0x2a7a89){_0x2eea21=_0x2a7a89;switch(_0x5d9c33[_0x9378('0x4e')]){case _0x9378('0x7e'):if(_0x5439c8===_0x9378('0xd3')){return _0x2eea21[_0x9378('0x31')]({'read':!![]});}else{logger[_0x9378('0x20')](_0x9378('0x1e'),'status',_0x9378('0x7e'),util[_0x9378('0xcd')](_0x597e6f[_0x9378('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x9378('0x80'):if(_0x5439c8==='1'){return _0x2eea21[_0x9378('0x31')]({'read':!![]});}else{logger[_0x9378('0x20')](_0x9378('0x1e'),_0x9378('0x25'),'skebby',util['inspect'](_0x597e6f['body'],{'showHidden':![],'depth':null}));}break;case _0x9378('0xd5'):if(!_0x597e6f['body'][_0x9378('0xd6')]&&_0x5439c8>=0xc8&&_0x5439c8<=0xce){return _0x2eea21[_0x9378('0x31')]({'read':!![]});}else{logger['error'](_0x9378('0x1e'),_0x9378('0x25'),_0x9378('0xd5'),util[_0x9378('0xcd')](_0x597e6f[_0x9378('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x9378('0x86'):var _0x1df8ca=_0x597e6f[_0x9378('0x5a')][_0x9378('0x87')][0x0];if(_0x1df8ca[_0x9378('0x25')][_0x9378('0xd2')]===_0x9378('0xd3')){return _0x2eea21[_0x9378('0x31')]({'read':!![]});}else{logger['error'](_0x9378('0x1e'),_0x9378('0x25'),_0x9378('0x86'),util['inspect'](_0x597e6f[_0x9378('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x5439c8==_0x9378('0xd7')||_0x5439c8==_0x9378('0xd8')){return _0x2eea21[_0x9378('0x31')]({'read':!![]});}else{logger[_0x9378('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9378('0x8b'),util[_0x9378('0xcd')](_0x597e6f[_0x9378('0x5a')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x5439c8==_0x9378('0xd9')){return _0x2eea21['update']({'read':!![]});}else{logger[_0x9378('0x20')](_0x9378('0x1e'),_0x9378('0x25'),_0x9378('0x8e'),util[_0x9378('0xcd')](_0x597e6f['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x5439c8===_0x9378('0xda')||_0x5439c8==='ACCEPTD'){return _0x2eea21['update']({'read':!![]});}else{logger[_0x9378('0x20')](_0x9378('0x1e'),_0x9378('0x25'),'intelepeer',util[_0x9378('0xcd')](_0x597e6f['body'],{'showHidden':![],'depth':null}));}break;}return _0x2eea21;}})['then'](respondWithResult(_0x3677bd,null))['catch'](handleError(_0x3677bd,null));};exports['statusGet']=function(_0x1f8fc1,_0x38c1dc,_0x5807f1){var _0x1ca234,_0x4d8efe,_0x1f8437;return db[_0x9378('0x51')]['find']({'where':{'id':_0x1f8fc1['params']['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x38c1dc,null))[_0x9378('0x1b')](function(_0x104842){if(_0x104842){_0x1f8437=_0x104842;logger['debug'](_0x9378('0x1e'),_0x9378('0x25'),_0x9378('0xcc'),_0x104842[_0x9378('0x4e')],util[_0x9378('0xcd')](_0x1f8fc1[_0x9378('0x40')],{'showHidden':![],'depth':null}));switch(_0x104842[_0x9378('0x4e')]){case'csc':if(_0x1f8fc1[_0x9378('0x40')][_0x9378('0xdb')]&&_0x1f8fc1[_0x9378('0x40')][_0x9378('0xdc')]){_0x4d8efe=_0x1f8fc1[_0x9378('0x40')][_0x9378('0xdc')];return db[_0x9378('0xc8')][_0x9378('0x58')]({'where':{'messageId':_0x1f8fc1['query'][_0x9378('0xdb')]}});}break;}}})['then'](handleEntityNotFound(_0x38c1dc,null))[_0x9378('0x1b')](function(_0x459d9a){if(_0x459d9a){_0x1ca234=_0x459d9a;switch(_0x1f8437['type']){case _0x9378('0x88'):if(_0x4d8efe==='2'||_0x4d8efe==='6'){return _0x1ca234[_0x9378('0x31')]({'read':!![]});}else{logger[_0x9378('0x20')](_0x9378('0x1e'),_0x9378('0x25'),_0x9378('0x88'),util['inspect'](_0x1f8fc1[_0x9378('0x40')],{'showHidden':![],'depth':null}));};break;}return _0x1ca234;}})[_0x9378('0x1b')](respondWithResult(_0x38c1dc,null))[_0x9378('0x24')](handleError(_0x38c1dc,null));};exports[_0x9378('0xdd')]=function(_0x443d79,_0x232935,_0x343f41){return db[_0x9378('0x51')][_0x9378('0x58')]({'where':{'id':_0x443d79[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x232935,null))[_0x9378('0x1b')](function(_0x3127ae){if(_0x3127ae){return _0x3127ae['addAgents'](_0x443d79['body'][_0x9378('0x65')],_[_0x9378('0x9c')](_0x443d79[_0x9378('0x5a')],[_0x9378('0x65'),'id'])||{})[_0x9378('0x9f')](function(_0x13ace7){for(var _0x1cd33e=0x0;_0x1cd33e<_0x443d79['body'][_0x9378('0x65')]['length'];_0x1cd33e+=0x1){socket[_0x9378('0xde')](_0x9378('0xdf'),{'UserId':Number(_0x443d79[_0x9378('0x5a')][_0x9378('0x65')][_0x1cd33e]),'SmsAccountId':Number(_0x443d79[_0x9378('0x56')]['id'])});}return _0x13ace7;});}})['then'](respondWithResult(_0x232935,null))[_0x9378('0x24')](handleError(_0x232935,null));};exports['removeAgents']=function(_0x453cab,_0x1cdfd2,_0xcfaff6){return db[_0x9378('0x51')][_0x9378('0x58')]({'where':{'id':_0x453cab[_0x9378('0x56')]['id']}})[_0x9378('0x1b')](handleEntityNotFound(_0x1cdfd2,null))[_0x9378('0x1b')](function(_0xfe92ad){if(_0xfe92ad){return _0xfe92ad['removeAgents'](_0x453cab[_0x9378('0x40')][_0x9378('0x65')])[_0x9378('0x1b')](function(){if(_[_0x9378('0xe0')](_0x453cab[_0x9378('0x40')]['ids'])){for(var _0x36792b=0x0;_0x36792b<_0x453cab['query']['ids'][_0x9378('0x47')];_0x36792b+=0x1){socket[_0x9378('0xde')](_0x9378('0xe1'),{'UserId':Number(_0x453cab[_0x9378('0x40')][_0x9378('0x65')][_0x36792b]),'SmsAccountId':Number(_0x453cab['params']['id'])});}}else{socket['emit'](_0x9378('0xe1'),{'UserId':Number(_0x453cab['query'][_0x9378('0x65')]),'SmsAccountId':Number(_0x453cab[_0x9378('0x56')]['id'])});}});}})[_0x9378('0x1b')](respondWithStatusCode(_0x1cdfd2,null))[_0x9378('0x24')](handleError(_0x1cdfd2,null));};exports[_0x9378('0xe2')]=function(_0x26ee43,_0x3377d9,_0x345c79){var _0x11d97c={};var _0x4794f1={};var _0x25a234;var _0x3e57e3;return db[_0x9378('0x51')][_0x9378('0x62')]({'where':{'id':_0x26ee43['params']['id']}})['then'](handleEntityNotFound(_0x3377d9,null))[_0x9378('0x1b')](function(_0x10ba4a){if(_0x10ba4a){_0x25a234=_0x10ba4a;_0x4794f1['model']=_[_0x9378('0x41')](db[_0x9378('0xa9')]['rawAttributes']);_0x4794f1[_0x9378('0x40')]=_[_0x9378('0x41')](_0x26ee43[_0x9378('0x40')]);_0x4794f1['filters']=_[_0x9378('0x43')](_0x4794f1[_0x9378('0x44')],_0x4794f1[_0x9378('0x40')]);_0x11d97c[_0x9378('0x45')]=_['intersection'](_0x4794f1[_0x9378('0x44')],qs[_0x9378('0x46')](_0x26ee43[_0x9378('0x40')][_0x9378('0x46')]));_0x11d97c[_0x9378('0x45')]=_0x11d97c['attributes']['length']?_0x11d97c[_0x9378('0x45')]:_0x4794f1['model'];_0x11d97c[_0x9378('0xbe')]=qs[_0x9378('0x4a')](_0x26ee43[_0x9378('0x40')][_0x9378('0x4a')]);_0x11d97c[_0x9378('0x4b')]=qs[_0x9378('0x42')](_[_0x9378('0x4c')](_0x26ee43[_0x9378('0x40')],_0x4794f1[_0x9378('0x42')]));if(_0x26ee43[_0x9378('0x40')][_0x9378('0x4d')]){_0x11d97c[_0x9378('0x4b')]=_[_0x9378('0x50')](_0x11d97c[_0x9378('0x4b')],{'$or':_['map'](_0x11d97c[_0x9378('0x45')],function(_0x3ae732){var _0xa21355={};_0xa21355[_0x3ae732]={'$like':'%'+_0x26ee43[_0x9378('0x40')][_0x9378('0x4d')]+'%'};return _0xa21355;})});}_0x11d97c=_[_0x9378('0x50')]({},_0x11d97c,_0x26ee43[_0x9378('0x57')]);return _0x25a234[_0x9378('0xe2')](_0x11d97c);}})[_0x9378('0x1b')](function(_0x374658){if(_0x374658){_0x3e57e3=_0x374658[_0x9378('0x47')];if(!_0x26ee43['query'][_0x9378('0x48')](_0x9378('0x49'))){_0x11d97c[_0x9378('0x29')]=qs[_0x9378('0x29')](_0x26ee43[_0x9378('0x40')]['limit']);_0x11d97c[_0x9378('0x2b')]=qs[_0x9378('0x2b')](_0x26ee43['query']['offset']);}return _0x25a234[_0x9378('0xe2')](_0x11d97c);}})[_0x9378('0x1b')](function(_0x36216e){if(_0x36216e){return _0x36216e?{'count':_0x3e57e3,'rows':_0x36216e}:null;}})[_0x9378('0x1b')](respondWithResult(_0x3377d9,null))[_0x9378('0x24')](handleError(_0x3377d9,null));}; \ No newline at end of file +var _0x11dc=['notify','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','messageId','MessageSid','skebby','sender','text','clicksend','message_id','plivo','From','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','list','omit','Contacts','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','Tags','color','tag','to\x20is\x20mandatory','CmList','List','DESC','out','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','connectel','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','describe','SmsAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','findOne','nolimit','order','removeAnswers'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x11dc,0x78));var _0xc11d=function(_0x5b174b,_0x404869){_0x5b174b=_0x5b174b-0x0;var _0x47ee37=_0x11dc[_0x5b174b];return _0x47ee37;};'use strict';var emlformat=require(_0xc11d('0x0'));var rimraf=require(_0xc11d('0x1'));var zipdir=require(_0xc11d('0x2'));var jsonpatch=require(_0xc11d('0x3'));var rp=require(_0xc11d('0x4'));var moment=require(_0xc11d('0x5'));var BPromise=require(_0xc11d('0x6'));var Mustache=require(_0xc11d('0x7'));var util=require(_0xc11d('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc11d('0x9'));var ejs=require(_0xc11d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc11d('0xb'));var squel=require('squel');var crypto=require(_0xc11d('0xc'));var jsforce=require(_0xc11d('0xd'));var deskjs=require(_0xc11d('0xe'));var toCsv=require(_0xc11d('0x9'));var querystring=require(_0xc11d('0xf'));var Papa=require(_0xc11d('0x10'));var Redis=require('ioredis');var authService=require(_0xc11d('0x11'));var qs=require(_0xc11d('0x12'));var as=require(_0xc11d('0x13'));var hardwareService=require(_0xc11d('0x14'));var logger=require(_0xc11d('0x15'))(_0xc11d('0x16'));var utils=require(_0xc11d('0x17'));var config=require(_0xc11d('0x18'));var licenseUtil=require(_0xc11d('0x19'));var db=require(_0xc11d('0x1a'))['db'];config['redis']=_['defaults'](config[_0xc11d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xc11d('0x1c'))(new Redis(config[_0xc11d('0x1b')]));require(_0xc11d('0x1d'))[_0xc11d('0x1e')](socket);var jayson=require(_0xc11d('0x1f'));var client=jayson[_0xc11d('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4f09d1,_0x5e8503,_0x29b589,_0x17a35d){return new BPromise(function(_0x44e139,_0x4ac0c4){var _0x2e8396=_0x17a35d||client;return _0x2e8396[_0xc11d('0x21')](_0x4f09d1,_0x29b589)[_0xc11d('0x22')](function(_0x5f3352){logger[_0xc11d('0x23')](_0xc11d('0x24'),_0x5e8503,_0xc11d('0x25'));logger[_0xc11d('0x26')](_0xc11d('0x27'),_0x5e8503,_0xc11d('0x25'),JSON[_0xc11d('0x28')](_0x5f3352));if(_0x5f3352[_0xc11d('0x29')]){if(_0x5f3352['error'][_0xc11d('0x2a')]===0x1f4){logger['error'](_0xc11d('0x24'),_0x5e8503,_0x5f3352['error'][_0xc11d('0x2b')]);return _0x4ac0c4(_0x5f3352['error'][_0xc11d('0x2b')]);}logger[_0xc11d('0x29')](_0xc11d('0x24'),_0x5e8503,_0x5f3352[_0xc11d('0x29')][_0xc11d('0x2b')]);return _0x44e139(_0x5f3352[_0xc11d('0x29')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x5e8503,_0xc11d('0x25'));_0x44e139(_0x5f3352[_0xc11d('0x2c')][_0xc11d('0x2b')]);}})['catch'](function(_0x1c174c){logger[_0xc11d('0x29')](_0xc11d('0x24'),_0x5e8503,_0x1c174c);_0x4ac0c4(_0x1c174c);});});}function respondWithStatusCode(_0x3e30c7,_0x16c37c){_0x16c37c=_0x16c37c||0xcc;return function(_0x4c91b0){if(_0x4c91b0){return _0x3e30c7['sendStatus'](_0x16c37c);}return _0x3e30c7['status'](_0x16c37c)[_0xc11d('0x2d')]();};}function respondWithResult(_0xbe93d5,_0x4b6314){_0x4b6314=_0x4b6314||0xc8;return function(_0x2e9465){if(_0x2e9465){return _0xbe93d5[_0xc11d('0x2e')](_0x4b6314)[_0xc11d('0x2f')](_0x2e9465);}};}function respondWithFilteredResult(_0x5e6c25,_0x2ec4fe){return function(_0x5d8e65){if(_0x5d8e65){var _0x130a00=typeof _0x2ec4fe[_0xc11d('0x30')]==='undefined'&&typeof _0x2ec4fe[_0xc11d('0x31')]===_0xc11d('0x32');var _0x398206=_0x5d8e65[_0xc11d('0x33')];var _0x2a28e6=_0x130a00?0x0:_0x2ec4fe[_0xc11d('0x30')];var _0x41aada=_0x130a00?_0x5d8e65[_0xc11d('0x33')]:_0x2ec4fe[_0xc11d('0x30')]+_0x2ec4fe[_0xc11d('0x31')];var _0xae1aa;if(_0x41aada>=_0x398206){_0x41aada=_0x398206;_0xae1aa=0xc8;}else{_0xae1aa=0xce;}_0x5e6c25[_0xc11d('0x2e')](_0xae1aa);return _0x5e6c25[_0xc11d('0x34')](_0xc11d('0x35'),_0x2a28e6+'-'+_0x41aada+'/'+_0x398206)['json'](_0x5d8e65);}return null;};}function patchUpdates(_0x4d9ef6){return function(_0x3caae6){try{jsonpatch[_0xc11d('0x36')](_0x3caae6,_0x4d9ef6,!![]);}catch(_0xd5691c){return BPromise['reject'](_0xd5691c);}return _0x3caae6['save']();};}function saveUpdates(_0x35c1c1,_0x294b4b){return function(_0x4c12b1){if(_0x4c12b1){return _0x4c12b1[_0xc11d('0x37')](_0x35c1c1)[_0xc11d('0x22')](function(_0x4f63be){return _0x4f63be;});}return null;};}function removeEntity(_0x1f80ca,_0x2e563f){return function(_0x3077d5){if(_0x3077d5){return _0x3077d5[_0xc11d('0x38')]()['then'](function(){var _0x3bd3b2=_0x3077d5[_0xc11d('0x39')]({'plain':!![]});var _0x873469=_0xc11d('0x3a');return db[_0xc11d('0x3b')]['destroy']({'where':{'type':_0x873469,'resourceId':_0x3bd3b2['id']}})[_0xc11d('0x22')](function(){return _0x3077d5;});})[_0xc11d('0x22')](function(){_0x1f80ca[_0xc11d('0x2e')](0xcc)[_0xc11d('0x2d')]();});}};}function handleEntityNotFound(_0x40c223,_0x13a55e){return function(_0x192051){if(!_0x192051){_0x40c223[_0xc11d('0x3c')](0x194);}return _0x192051;};}function handleError(_0xecda2c,_0x4471b8){_0x4471b8=_0x4471b8||0x1f4;return function(_0x2c8739){logger[_0xc11d('0x29')](_0x2c8739[_0xc11d('0x3d')]);if(_0x2c8739[_0xc11d('0x3e')]){delete _0x2c8739['name'];}_0xecda2c[_0xc11d('0x2e')](_0x4471b8)[_0xc11d('0x3f')](_0x2c8739);};}exports[_0xc11d('0x40')]=function(_0x56fe84,_0x35572d){var _0x455258={'include':[{'model':db[_0xc11d('0x41')],'as':_0xc11d('0x42')}]},_0x47dae5={},_0x26e51b={'count':0x0,'rows':[]};var _0x5120d7=_['map'](db[_0xc11d('0x43')][_0xc11d('0x44')],function(_0x325769){return{'name':_0x325769[_0xc11d('0x45')],'type':_0x325769[_0xc11d('0x46')]['key']};});_0x47dae5['model']=_[_0xc11d('0x47')](_0x5120d7,'name');_0x47dae5[_0xc11d('0x48')]=_['keys'](_0x56fe84[_0xc11d('0x48')]);_0x47dae5[_0xc11d('0x49')]=_[_0xc11d('0x4a')](_0x47dae5[_0xc11d('0x4b')],_0x47dae5[_0xc11d('0x48')]);_0x455258[_0xc11d('0x4c')]=_[_0xc11d('0x4a')](_0x47dae5['model'],qs[_0xc11d('0x4d')](_0x56fe84[_0xc11d('0x48')]['fields']));_0x455258[_0xc11d('0x4c')]=_0x455258[_0xc11d('0x4c')][_0xc11d('0x4e')]?_0x455258['attributes']:_0x47dae5[_0xc11d('0x4b')];if(!_0x56fe84['query'][_0xc11d('0x4f')]('nolimit')){_0x455258['limit']=qs['limit'](_0x56fe84['query'][_0xc11d('0x31')]);_0x455258[_0xc11d('0x30')]=qs[_0xc11d('0x30')](_0x56fe84[_0xc11d('0x48')][_0xc11d('0x30')]);}_0x455258['order']=qs[_0xc11d('0x50')](_0x56fe84['query'][_0xc11d('0x50')]);_0x455258[_0xc11d('0x51')]=qs[_0xc11d('0x49')](_[_0xc11d('0x52')](_0x56fe84[_0xc11d('0x48')],_0x47dae5[_0xc11d('0x49')]),_0x5120d7);if(_0x56fe84[_0xc11d('0x48')][_0xc11d('0x53')]){_0x455258[_0xc11d('0x51')]=_[_0xc11d('0x54')](_0x455258[_0xc11d('0x51')],{'$or':_[_0xc11d('0x47')](_0x5120d7,function(_0x31f435){if(_0x31f435['type']!=='VIRTUAL'){var _0x35c7a6={};_0x35c7a6[_0x31f435['name']]={'$like':'%'+_0x56fe84[_0xc11d('0x48')]['filter']+'%'};return _0x35c7a6;}})});}_0x455258=_[_0xc11d('0x54')]({},_0x455258,_0x56fe84[_0xc11d('0x55')]);var _0x3f4201={'where':_0x455258[_0xc11d('0x51')]};return db[_0xc11d('0x43')][_0xc11d('0x33')](_0x3f4201)['then'](function(_0x1d758b){_0x26e51b['count']=_0x1d758b;if(_0x56fe84['query'][_0xc11d('0x56')]){_0x455258[_0xc11d('0x57')]=[{'all':!![]}];}return db[_0xc11d('0x43')][_0xc11d('0x58')](_0x455258);})[_0xc11d('0x22')](function(_0x57ee73){_0x26e51b[_0xc11d('0x59')]=_0x57ee73;return _0x26e51b;})['then'](respondWithFilteredResult(_0x35572d,_0x455258))[_0xc11d('0x5a')](handleError(_0x35572d,null));};exports[_0xc11d('0x5b')]=function(_0x242680,_0x35f40c){var _0x3f7ffd={'raw':![],'where':{'id':_0x242680[_0xc11d('0x5c')]['id']},'include':[{'model':db[_0xc11d('0x41')],'as':'mandatoryDispositionPause'}]},_0x4a7e4c={};_0x4a7e4c[_0xc11d('0x4b')]=_[_0xc11d('0x5d')](db[_0xc11d('0x43')][_0xc11d('0x44')]);_0x4a7e4c[_0xc11d('0x48')]=_[_0xc11d('0x5d')](_0x242680[_0xc11d('0x48')]);_0x4a7e4c[_0xc11d('0x49')]=_[_0xc11d('0x4a')](_0x4a7e4c[_0xc11d('0x4b')],_0x4a7e4c[_0xc11d('0x48')]);_0x3f7ffd[_0xc11d('0x4c')]=_[_0xc11d('0x4a')](_0x4a7e4c[_0xc11d('0x4b')],qs['fields'](_0x242680[_0xc11d('0x48')][_0xc11d('0x4d')]));_0x3f7ffd[_0xc11d('0x4c')]=_0x3f7ffd[_0xc11d('0x4c')][_0xc11d('0x4e')]?_0x3f7ffd['attributes']:_0x4a7e4c[_0xc11d('0x4b')];if(_0x242680[_0xc11d('0x48')][_0xc11d('0x56')]){_0x3f7ffd[_0xc11d('0x57')]=[{'all':!![]}];}_0x3f7ffd=_[_0xc11d('0x54')]({},_0x3f7ffd,_0x242680[_0xc11d('0x55')]);return db[_0xc11d('0x43')][_0xc11d('0x5e')](_0x3f7ffd)[_0xc11d('0x22')](handleEntityNotFound(_0x35f40c,null))[_0xc11d('0x22')](respondWithResult(_0x35f40c,null))[_0xc11d('0x5a')](handleError(_0x35f40c,null));};exports[_0xc11d('0x5f')]=function(_0x179d4f,_0x366a31){return db[_0xc11d('0x43')]['create'](_0x179d4f[_0xc11d('0x60')],{})[_0xc11d('0x22')](function(_0x13ad59){var _0x2e3f34=_0x179d4f['user'][_0xc11d('0x39')]({'plain':!![]});if(!_0x2e3f34)throw new Error(_0xc11d('0x61'));if(_0x2e3f34['role']===_0xc11d('0x62')){var _0x4c917f=_0x13ad59[_0xc11d('0x39')]({'plain':!![]});var _0x4eab84=_0xc11d('0x3a');return db[_0xc11d('0x63')][_0xc11d('0x5e')]({'where':{'name':_0x4eab84,'userProfileId':_0x2e3f34[_0xc11d('0x64')]},'raw':!![]})[_0xc11d('0x22')](function(_0x2518a6){if(_0x2518a6&&_0x2518a6[_0xc11d('0x65')]===0x0){return db[_0xc11d('0x3b')]['create']({'name':_0x4c917f[_0xc11d('0x3e')],'resourceId':_0x4c917f['id'],'type':_0x2518a6[_0xc11d('0x3e')],'sectionId':_0x2518a6['id']},{})['then'](function(){return _0x13ad59;});}else{return _0x13ad59;}})[_0xc11d('0x5a')](function(_0x33e366){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33e366);throw _0x33e366;});}return _0x13ad59;})[_0xc11d('0x22')](respondWithResult(_0x366a31,0xc9))[_0xc11d('0x5a')](handleError(_0x366a31,null));};exports[_0xc11d('0x37')]=function(_0x258dbe,_0xdcc603){if(_0x258dbe[_0xc11d('0x60')]['id']){delete _0x258dbe[_0xc11d('0x60')]['id'];}return db[_0xc11d('0x43')][_0xc11d('0x5e')]({'where':{'id':_0x258dbe[_0xc11d('0x5c')]['id']},'include':[{'model':db[_0xc11d('0x41')],'as':_0xc11d('0x42')}]})['then'](handleEntityNotFound(_0xdcc603,null))['then'](saveUpdates(_0x258dbe['body'],null))[_0xc11d('0x22')](respondWithResult(_0xdcc603,null))[_0xc11d('0x5a')](handleError(_0xdcc603,null));};exports[_0xc11d('0x38')]=function(_0x419588,_0x4845c5){return db[_0xc11d('0x43')][_0xc11d('0x5e')]({'where':{'id':_0x419588[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x4845c5,null))[_0xc11d('0x22')](removeEntity(_0x4845c5,null))[_0xc11d('0x5a')](handleError(_0x4845c5,null));};exports[_0xc11d('0x66')]=function(_0x455cb4,_0x53647f){return db[_0xc11d('0x43')][_0xc11d('0x66')]()[_0xc11d('0x22')](respondWithResult(_0x53647f,null))[_0xc11d('0x5a')](handleError(_0x53647f,null));};exports['addDisposition']=function(_0x553b03,_0x2ef895,_0x4cfa5b){if(_0x553b03[_0xc11d('0x60')]['id']){delete _0x553b03[_0xc11d('0x60')]['id'];}return db[_0xc11d('0x43')]['find']({'where':{'id':_0x553b03['params']['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x2ef895,null))['then'](function(_0x176e6f){if(_0x176e6f){_0x553b03[_0xc11d('0x60')][_0xc11d('0x67')]=_0x176e6f['id'];return db[_0xc11d('0x68')][_0xc11d('0x5f')](_0x553b03[_0xc11d('0x60')]);}})[_0xc11d('0x22')](respondWithResult(_0x2ef895,null))['catch'](handleError(_0x2ef895,null));};exports['getDispositions']=function(_0x5ec6e2,_0x1b18ad,_0x129636){var _0x56bb3b={'raw':![],'where':{}};var _0x30480e={};var _0x576c07={'count':0x0,'rows':[]};return db[_0xc11d('0x43')]['findOne']({'where':{'id':_0x5ec6e2['params']['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x1b18ad,null))[_0xc11d('0x22')](function(_0x471744){if(_0x471744){_0x30480e[_0xc11d('0x4b')]=_[_0xc11d('0x5d')](db[_0xc11d('0x68')][_0xc11d('0x44')]);_0x30480e[_0xc11d('0x48')]=_[_0xc11d('0x5d')](_0x5ec6e2[_0xc11d('0x48')]);_0x30480e[_0xc11d('0x49')]=_[_0xc11d('0x4a')](_0x30480e[_0xc11d('0x4b')],_0x30480e[_0xc11d('0x48')]);_0x56bb3b['attributes']=_[_0xc11d('0x4a')](_0x30480e['model'],qs[_0xc11d('0x4d')](_0x5ec6e2['query'][_0xc11d('0x4d')]));_0x56bb3b[_0xc11d('0x4c')]=_0x56bb3b[_0xc11d('0x4c')][_0xc11d('0x4e')]?_0x56bb3b[_0xc11d('0x4c')]:_0x30480e['model'];if(!_0x5ec6e2[_0xc11d('0x48')][_0xc11d('0x4f')]('nolimit')){_0x56bb3b[_0xc11d('0x31')]=qs[_0xc11d('0x31')](_0x5ec6e2['query'][_0xc11d('0x31')]);_0x56bb3b[_0xc11d('0x30')]=qs['offset'](_0x5ec6e2[_0xc11d('0x48')][_0xc11d('0x30')]);}_0x56bb3b['order']=qs['sort'](_0x5ec6e2['query'][_0xc11d('0x50')]);_0x56bb3b[_0xc11d('0x51')]=qs[_0xc11d('0x49')](_[_0xc11d('0x52')](_0x5ec6e2[_0xc11d('0x48')],_0x30480e[_0xc11d('0x49')]));_0x56bb3b[_0xc11d('0x51')][_0xc11d('0x67')]=_0x471744['id'];if(_0x5ec6e2[_0xc11d('0x48')][_0xc11d('0x53')]){_0x56bb3b[_0xc11d('0x51')]=_[_0xc11d('0x54')](_0x56bb3b[_0xc11d('0x51')],{'$or':_['map'](_0x56bb3b[_0xc11d('0x4c')],function(_0x24c9b4){var _0x346bd4={};_0x346bd4[_0x24c9b4]={'$like':'%'+_0x5ec6e2['query'][_0xc11d('0x53')]+'%'};return _0x346bd4;})});}_0x56bb3b=_[_0xc11d('0x54')]({},_0x56bb3b,_0x5ec6e2[_0xc11d('0x55')]);return db['Disposition'][_0xc11d('0x33')]({'where':_0x56bb3b['where']})['then'](function(_0x1e6e4f){_0x576c07['count']=_0x1e6e4f;if(_0x5ec6e2['query'][_0xc11d('0x56')]){_0x56bb3b[_0xc11d('0x57')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x56bb3b);})[_0xc11d('0x22')](function(_0x2009d0){_0x576c07[_0xc11d('0x59')]=_0x2009d0;return _0x576c07;});}})[_0xc11d('0x22')](respondWithFilteredResult(_0x1b18ad,_0x56bb3b))[_0xc11d('0x5a')](handleError(_0x1b18ad,null));};exports['removeDispositions']=function(_0x3ca4af,_0x5478bb,_0x12d4e2){return db[_0xc11d('0x43')][_0xc11d('0x5e')]({'where':{'id':_0x3ca4af[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x5478bb,null))[_0xc11d('0x22')](function(_0xbda1fe){if(_0xbda1fe){return _0xbda1fe[_0xc11d('0x69')](_0x3ca4af['query'][_0xc11d('0x6a')]);}})[_0xc11d('0x22')](respondWithStatusCode(_0x5478bb,null))[_0xc11d('0x5a')](handleError(_0x5478bb,null));};exports[_0xc11d('0x6b')]=function(_0x504cb3,_0x173119,_0x41d7b6){if(_0x504cb3[_0xc11d('0x60')]['id']){delete _0x504cb3[_0xc11d('0x60')]['id'];}return db[_0xc11d('0x43')]['find']({'where':{'id':_0x504cb3[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x173119,null))['then'](function(_0x1c0ea1){if(_0x1c0ea1){_0x504cb3[_0xc11d('0x60')][_0xc11d('0x67')]=_0x1c0ea1['id'];return db[_0xc11d('0x6c')][_0xc11d('0x5f')](_0x504cb3[_0xc11d('0x60')]);}})[_0xc11d('0x22')](respondWithResult(_0x173119,null))[_0xc11d('0x5a')](handleError(_0x173119,null));};exports['getAnswers']=function(_0x3adb3c,_0x37499a,_0x3928ae){var _0xfc0f6b={'raw':![],'where':{}};var _0x574829={};var _0x5eabec={'count':0x0,'rows':[]};return db[_0xc11d('0x43')][_0xc11d('0x6d')]({'where':{'id':_0x3adb3c[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x37499a,null))[_0xc11d('0x22')](function(_0x223a00){if(_0x223a00){_0x574829['model']=_[_0xc11d('0x5d')](db[_0xc11d('0x6c')][_0xc11d('0x44')]);_0x574829[_0xc11d('0x48')]=_['keys'](_0x3adb3c[_0xc11d('0x48')]);_0x574829[_0xc11d('0x49')]=_[_0xc11d('0x4a')](_0x574829['model'],_0x574829[_0xc11d('0x48')]);_0xfc0f6b['attributes']=_['intersection'](_0x574829['model'],qs[_0xc11d('0x4d')](_0x3adb3c[_0xc11d('0x48')][_0xc11d('0x4d')]));_0xfc0f6b[_0xc11d('0x4c')]=_0xfc0f6b[_0xc11d('0x4c')][_0xc11d('0x4e')]?_0xfc0f6b[_0xc11d('0x4c')]:_0x574829[_0xc11d('0x4b')];if(!_0x3adb3c[_0xc11d('0x48')][_0xc11d('0x4f')](_0xc11d('0x6e'))){_0xfc0f6b[_0xc11d('0x31')]=qs[_0xc11d('0x31')](_0x3adb3c[_0xc11d('0x48')][_0xc11d('0x31')]);_0xfc0f6b[_0xc11d('0x30')]=qs[_0xc11d('0x30')](_0x3adb3c[_0xc11d('0x48')][_0xc11d('0x30')]);}_0xfc0f6b[_0xc11d('0x6f')]=qs[_0xc11d('0x50')](_0x3adb3c[_0xc11d('0x48')][_0xc11d('0x50')]);_0xfc0f6b[_0xc11d('0x51')]=qs['filters'](_[_0xc11d('0x52')](_0x3adb3c['query'],_0x574829['filters']));_0xfc0f6b[_0xc11d('0x51')][_0xc11d('0x67')]=_0x223a00['id'];if(_0x3adb3c['query']['filter']){_0xfc0f6b[_0xc11d('0x51')]=_[_0xc11d('0x54')](_0xfc0f6b['where'],{'$or':_[_0xc11d('0x47')](_0xfc0f6b[_0xc11d('0x4c')],function(_0x24afac){var _0x483cf9={};_0x483cf9[_0x24afac]={'$like':'%'+_0x3adb3c[_0xc11d('0x48')][_0xc11d('0x53')]+'%'};return _0x483cf9;})});}_0xfc0f6b=_[_0xc11d('0x54')]({},_0xfc0f6b,_0x3adb3c[_0xc11d('0x55')]);return db['CannedAnswer']['count']({'where':_0xfc0f6b[_0xc11d('0x51')]})[_0xc11d('0x22')](function(_0x1a2f64){_0x5eabec[_0xc11d('0x33')]=_0x1a2f64;if(_0x3adb3c[_0xc11d('0x48')]['includeAll']){_0xfc0f6b[_0xc11d('0x57')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0xfc0f6b);})[_0xc11d('0x22')](function(_0x169b27){_0x5eabec[_0xc11d('0x59')]=_0x169b27;return _0x5eabec;});}})[_0xc11d('0x22')](respondWithFilteredResult(_0x37499a,_0xfc0f6b))[_0xc11d('0x5a')](handleError(_0x37499a,null));};exports[_0xc11d('0x70')]=function(_0x1a10d0,_0x98822,_0x58c9c6){return db['SmsAccount'][_0xc11d('0x5e')]({'where':{'id':_0x1a10d0['params']['id']}})['then'](handleEntityNotFound(_0x98822,null))[_0xc11d('0x22')](function(_0x405861){if(_0x405861){return _0x405861[_0xc11d('0x70')](_0x1a10d0[_0xc11d('0x48')][_0xc11d('0x6a')]);}})[_0xc11d('0x22')](respondWithStatusCode(_0x98822,null))[_0xc11d('0x5a')](handleError(_0x98822,null));};exports[_0xc11d('0x71')]=function(_0x3dcbfe,_0x5e1b11,_0x3cc7eb){var _0x75d4f9={'channel':_0xc11d('0x72')};var _0x5467da=[];var _0x5bf3f0=[];var _0x351308={};return db[_0xc11d('0x43')][_0xc11d('0x5e')]({'where':{'id':_0x3dcbfe[_0xc11d('0x5c')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xc11d('0x73')}]})[_0xc11d('0x22')](handleEntityNotFound(_0x5e1b11,null))[_0xc11d('0x22')](function(_0x294ca1){_0x75d4f9[_0xc11d('0x74')]=_0x294ca1;_0x75d4f9[_0xc11d('0x75')]=_[_0xc11d('0x76')](_0x294ca1[_0xc11d('0x73')],[_0xc11d('0x77')],[_0xc11d('0x78')]);if(_0x75d4f9[_0xc11d('0x74')]['Applications']){delete _0x75d4f9[_0xc11d('0x74')][_0xc11d('0x73')];}return db[_0xc11d('0x79')][_0xc11d('0x66')]();})[_0xc11d('0x22')](function(_0x1bea8e){if(!_0x1bea8e){throw new db[(_0xc11d('0x7a'))][(_0xc11d('0x7b'))](_0xc11d('0x7c'));}_0x5467da=_[_0xc11d('0x7d')](_['keys'](_0x1bea8e),[_0xc11d('0x7e'),'updatedAt']);_0x5bf3f0=_[_0xc11d('0x7d')](_[_0xc11d('0x5d')](_0x1bea8e),[_0xc11d('0x7e'),_0xc11d('0x7f'),_0xc11d('0x80'),'ListId']);_0x75d4f9[_0xc11d('0x60')]={'mapKey':_0xc11d('0x81')};if(_0x75d4f9[_0xc11d('0x74')]['type']){switch(_0x75d4f9[_0xc11d('0x74')]['type']){case _0xc11d('0x82'):_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')]=_0x3dcbfe[_0xc11d('0x60')]['From'];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe[_0xc11d('0x60')]['Body'];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x84')]=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x85')];break;case _0xc11d('0x86'):_0x75d4f9[_0xc11d('0x60')]['from']='+'+_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x87')];_0x75d4f9[_0xc11d('0x60')]['body']=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x88')];break;case'connectel':_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')]=_0x3dcbfe['body'][_0xc11d('0x83')];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x2b')];break;case _0xc11d('0x89'):_0x75d4f9['body'][_0xc11d('0x83')]=_0x3dcbfe['body']['from'];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x60')];_0x75d4f9['body'][_0xc11d('0x84')]=_0x3dcbfe['body'][_0xc11d('0x8a')];break;case _0xc11d('0x8b'):_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')]=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x8c')];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe['body']['Text'];_0x75d4f9['body'][_0xc11d('0x84')]=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x8d')];break;case _0xc11d('0x8e'):_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')]='+'+_0x3dcbfe[_0xc11d('0x60')]['results'][0x0][_0xc11d('0x83')];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe['body']['results'][0x0]['text'];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x84')]=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x8f')][0x0]['messageId'];break;case _0xc11d('0x90'):_0x75d4f9[_0xc11d('0x60')]['from']=_0x3dcbfe['body'][_0xc11d('0x91')];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe[_0xc11d('0x60')]['segmentedMessage'][_0xc11d('0x2b')];break;case _0xc11d('0x92'):_0x75d4f9[_0xc11d('0x60')]['from']=_0x3dcbfe[_0xc11d('0x60')][_0xc11d('0x93')];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe[_0xc11d('0x60')]['text'];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x84')]=_0x3dcbfe[_0xc11d('0x60')]['replyMessageId'];break;case _0xc11d('0x94'):_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x84')]=_0x3dcbfe[_0xc11d('0x60')][0x0][_0xc11d('0x2b')]['id'];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')]=_0x3dcbfe[_0xc11d('0x60')][0x0][_0xc11d('0x2b')]['from'];_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]=_0x3dcbfe[_0xc11d('0x60')][0x0]['message']['text'];break;case _0xc11d('0x95'):_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')]=_0x3dcbfe[_0xc11d('0x60')]['from'];_0x75d4f9['body'][_0xc11d('0x60')]=_0x3dcbfe[_0xc11d('0x60')]['message'];_0x75d4f9['body'][_0xc11d('0x84')]=_0x3dcbfe['body'][_0xc11d('0x96')];break;}}if(_0x75d4f9[_0xc11d('0x60')]['id']){delete _0x75d4f9[_0xc11d('0x60')]['id'];}if(_['isNil'](_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')])){throw new db[(_0xc11d('0x7a'))][(_0xc11d('0x7b'))](_0xc11d('0x97'));}if(_[_0xc11d('0x98')](_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')])||_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x60')]===''){throw new db[(_0xc11d('0x7a'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x75d4f9['body'][_0xc11d('0x99')])){throw new db[(_0xc11d('0x7a'))][(_0xc11d('0x7b'))](_0xc11d('0x9a')+_0x5bf3f0);}if(!_['includes'](_0x5bf3f0,_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x99')])){throw new db['Sequelize']['ValidationError'](_0xc11d('0x9b')+_0x5bf3f0);}_0x351308[_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x99')]]=_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')];return db['CmList'][_0xc11d('0x5e')]({'where':{'id':_0x75d4f9[_0xc11d('0x74')][_0xc11d('0x9c')]},'include':[{'model':db[_0xc11d('0x79')],'as':'Contacts','where':_0x351308,'limit':0x1,'order':[[_0xc11d('0x7f'),'DESC']]}]});})[_0xc11d('0x22')](handleEntityNotFound(_0x5e1b11,null))[_0xc11d('0x22')](function(_0xdd1850){if(_0xdd1850){_0x75d4f9[_0xc11d('0x9d')]=_[_0xc11d('0x9e')](_0xdd1850,[_0xc11d('0x9f')]);if(_0xdd1850['Contacts'][_0xc11d('0x4e')]){return _0xdd1850['Contacts'][0x0];}var _0x340eb3=_[_0xc11d('0xa0')](_0x75d4f9[_0xc11d('0x60')],{'firstName':_0x75d4f9['body'][_0xc11d('0x83')],'ListId':_0xdd1850['id']});_0x340eb3[_0x75d4f9['body']['mapKey']]=_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')];return db[_0xc11d('0x79')][_0xc11d('0x5f')](_0x340eb3,{'fields':_0x5467da,'raw':!![]});}})[_0xc11d('0x22')](handleEntityNotFound(_0x5e1b11,null))[_0xc11d('0x22')](function(_0x3a087c){if(_0x3a087c){_0x75d4f9[_0xc11d('0xa1')]=_0x3a087c;var _0x5ccc6b={'ContactId':_0x3a087c['id'],'phone':_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')],'SmsAccountId':_0x3dcbfe[_0xc11d('0x5c')]['id']};var _0x7cbbdb={'ContactId':_0x3a087c['id'],'SmsAccountId':_0x3dcbfe[_0xc11d('0x5c')]['id'],'closed':![]};return db[_0xc11d('0xa2')][_0xc11d('0x5e')]({'where':_0x7cbbdb})[_0xc11d('0x22')](function(_0x33a732){if(_0x33a732){return[_0x33a732,![]];}return db[_0xc11d('0xa2')][_0xc11d('0x5f')](_0x5ccc6b)[_0xc11d('0x22')](function(_0x2cc5c6){return[_0x2cc5c6,!![]];});});}})[_0xc11d('0xa3')](function(_0x197222,_0x93b2a8){_0x75d4f9[_0xc11d('0xa4')]=_0x197222[_0xc11d('0x39')]({'plain':!![]});_0x75d4f9[_0xc11d('0xa4')][_0xc11d('0xa5')]=![];if(_0x93b2a8){if(_0x75d4f9[_0xc11d('0x74')][_0xc11d('0xa6')]){_0x75d4f9[_0xc11d('0x75')][_0xc11d('0xa7')]({'id':0x0,'priority':_0x75d4f9[_0xc11d('0x75')][_0xc11d('0x4e')]+0x1,'app':_0xc11d('0xa8'),'appdata':'unmanaged','interval':_0xc11d('0xa9')});}_0x75d4f9[_0xc11d('0xa4')]['created']=!![];}return db[_0xc11d('0xaa')]['create']({'phone':_0x75d4f9[_0xc11d('0x60')][_0xc11d('0x83')],'messageId':_0x75d4f9['body'][_0xc11d('0x84')],'body':_0x75d4f9['body'][_0xc11d('0x60')],'SmsAccountId':_0x3dcbfe[_0xc11d('0x5c')]['id'],'SmsInteractionId':_0x197222['id'],'direction':'in','ContactId':_0x197222[_0xc11d('0xab')],'AttachmentId':_0x75d4f9[_0xc11d('0x60')][_0xc11d('0xac')]});})[_0xc11d('0x22')](function(_0x4479b7){_0x75d4f9[_0xc11d('0x2b')]=_0x4479b7;if(!_0x75d4f9['interaction'][_0xc11d('0xad')])return;return db[_0xc11d('0xae')][_0xc11d('0x5e')]({'attributes':['id',_0xc11d('0x3e')],'where':{'id':_0x75d4f9[_0xc11d('0xa4')][_0xc11d('0xad')]}});})[_0xc11d('0x22')](function(_0x421a42){if(_0x421a42){_0x75d4f9[_0xc11d('0x75')][_0xc11d('0xaf')]({'id':0x0,'priority':0x0,'app':_0xc11d('0xb0'),'appdata':_0x421a42[_0xc11d('0x3e')]+','+(_0x75d4f9[_0xc11d('0x74')][_0xc11d('0xb1')]||0xa),'interval':_0xc11d('0xa9')});}if(!_0x75d4f9['interaction'][_0xc11d('0xb2')])return;return db[_0xc11d('0xb3')]['find']({'attributes':['id',_0xc11d('0x3e')],'where':{'id':_0x75d4f9[_0xc11d('0xa4')][_0xc11d('0xb2')]}});})[_0xc11d('0x22')](function(_0x3c42cc){if(_0x3c42cc){_0x75d4f9[_0xc11d('0x75')][_0xc11d('0xaf')]({'id':0x0,'priority':0x1,'app':_0xc11d('0xb4'),'appdata':_0x3c42cc[_0xc11d('0x3e')]+','+(_0x75d4f9[_0xc11d('0x74')][_0xc11d('0xb5')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xc11d('0xb6'),_0x75d4f9);})['then'](function(_0x157c43){if(_0x157c43){var _0x3959d9=0xc8;var _0x3e8c8a=_0xc11d('0xb7');logger['info'](_0xc11d('0x27'),_0x3e8c8a,_0x3959d9,'entity\x20found');logger['debug'](_0xc11d('0xb8'),_0x3e8c8a,_0x3959d9,'entity\x20found',JSON[_0xc11d('0x28')](_0x157c43));if(_0x75d4f9[_0xc11d('0x74')][_0xc11d('0x46')]===_0xc11d('0x82')){return _0x5e1b11[_0xc11d('0x2e')](_0x3959d9)[_0xc11d('0x34')]('Content-Type','text/xml')[_0xc11d('0x3f')](_0xc11d('0xb9'));}else{return _0x5e1b11[_0xc11d('0x2e')](_0x3959d9)['json'](_0x157c43);}}})[_0xc11d('0x5a')](handleError(_0x5e1b11,null));};exports['addApplications']=function(_0x43aeb6,_0xf4fbe2){var _0x36d412=_0x43aeb6[_0xc11d('0x5c')]['id'];var _0x495752=_0x43aeb6['body'];var _0x58f4d3=0xc8;var _0x3c3baf=null;return db[_0xc11d('0xba')][_0xc11d('0xbb')]({'isolationLevel':db[_0xc11d('0xba')][_0xc11d('0xbc')][_0xc11d('0xbd')][_0xc11d('0xbe')]},function(_0x1261c2){return db[_0xc11d('0x43')]['findOne']({'where':{'id':_0x36d412},'transaction':_0x1261c2})[_0xc11d('0x22')](function(_0x50e74e){if(_0x50e74e){return db[_0xc11d('0xbf')][_0xc11d('0x38')]({'where':{'SmsAccountId':_0x36d412},'transaction':_0x1261c2})[_0xc11d('0x22')](function(){var _0x4a941b=_[_0xc11d('0x47')](_0x495752,function(_0x25b5ba){_0x25b5ba[_0xc11d('0x67')]=_0x36d412;return _0x25b5ba;});return db[_0xc11d('0xbf')][_0xc11d('0xc0')](_0x4a941b,{'transaction':_0x1261c2});});}else{_0x58f4d3=0x194;_0x3c3baf=[];}});})['then'](function(){if(_0x58f4d3!==0x194){return db['SmsApplication'][_0xc11d('0xc1')]({'where':{'SmsAccountId':_0x36d412},'order':_0xc11d('0x77')})[_0xc11d('0x22')](function(_0x24a198){_0x3c3baf=_0x24a198;});}})[_0xc11d('0x5a')](function(_0x48947f){_0x58f4d3=0x1f4;logger[_0xc11d('0x29')](_0x48947f[_0xc11d('0x3d')]);if(_0x48947f['name']){delete _0x48947f[_0xc11d('0x3e')];}_0x3c3baf=_0x48947f;})[_0xc11d('0xc2')](function(){if(_0x3c3baf===null){_0xf4fbe2[_0xc11d('0x3c')](_0x58f4d3);}else{if(_0x58f4d3===0x1f4){_0xf4fbe2[_0xc11d('0x2e')](_0x58f4d3)[_0xc11d('0x3f')](_0x3c3baf);}else{_0xf4fbe2[_0xc11d('0x2e')](_0x58f4d3)[_0xc11d('0x2f')](_0x3c3baf);}}});};exports[_0xc11d('0xc3')]=function(_0x5a943e,_0x2fab28,_0x3324fb){var _0x309e50={};var _0x5037ee={};var _0x165689;var _0x22b42c;return db[_0xc11d('0x43')][_0xc11d('0x6d')]({'where':{'id':_0x5a943e[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x2fab28,null))[_0xc11d('0x22')](function(_0x1e7626){if(_0x1e7626){_0x165689=_0x1e7626;_0x5037ee['model']=_['keys'](db['SmsApplication'][_0xc11d('0x44')]);_0x5037ee[_0xc11d('0x48')]=_['keys'](_0x5a943e['query']);_0x5037ee[_0xc11d('0x49')]=_[_0xc11d('0x4a')](_0x5037ee[_0xc11d('0x4b')],_0x5037ee[_0xc11d('0x48')]);_0x309e50[_0xc11d('0x4c')]=_[_0xc11d('0x4a')](_0x5037ee[_0xc11d('0x4b')],qs['fields'](_0x5a943e[_0xc11d('0x48')][_0xc11d('0x4d')]));_0x309e50[_0xc11d('0x4c')]=_0x309e50['attributes'][_0xc11d('0x4e')]?_0x309e50[_0xc11d('0x4c')]:_0x5037ee[_0xc11d('0x4b')];_0x309e50[_0xc11d('0x6f')]=qs['sort'](_0x5a943e[_0xc11d('0x48')]['sort']);_0x309e50[_0xc11d('0x51')]=qs[_0xc11d('0x49')](_[_0xc11d('0x52')](_0x5a943e[_0xc11d('0x48')],_0x5037ee[_0xc11d('0x49')]));if(_0x5a943e[_0xc11d('0x48')][_0xc11d('0x53')]){_0x309e50[_0xc11d('0x51')]=_[_0xc11d('0x54')](_0x309e50['where'],{'$or':_['map'](_0x309e50['attributes'],function(_0x2bf6fb){var _0x54ab2b={};_0x54ab2b[_0x2bf6fb]={'$like':'%'+_0x5a943e[_0xc11d('0x48')][_0xc11d('0x53')]+'%'};return _0x54ab2b;})});}_0x309e50=_[_0xc11d('0x54')]({},_0x309e50,_0x5a943e[_0xc11d('0x55')]);return _0x165689[_0xc11d('0xc3')](_0x309e50);}})[_0xc11d('0x22')](function(_0x21f663){if(_0x21f663){_0x22b42c=_0x21f663[_0xc11d('0x4e')];if(!_0x5a943e[_0xc11d('0x48')][_0xc11d('0x4f')](_0xc11d('0x6e'))){_0x309e50[_0xc11d('0x31')]=qs[_0xc11d('0x31')](_0x5a943e[_0xc11d('0x48')][_0xc11d('0x31')]);_0x309e50['offset']=qs[_0xc11d('0x30')](_0x5a943e['query']['offset']);}return _0x165689[_0xc11d('0xc3')](_0x309e50);}})[_0xc11d('0x22')](function(_0x496ce8){if(_0x496ce8){return _0x496ce8?{'count':_0x22b42c,'rows':_0x496ce8}:null;}})[_0xc11d('0x22')](respondWithResult(_0x2fab28,null))[_0xc11d('0x5a')](handleError(_0x2fab28,null));};exports[_0xc11d('0xc4')]=function(_0x450d2c,_0x1965c8,_0x40d18b){var _0x3b95e2={'raw':![],'where':{}};var _0x5ecb0c={};var _0xf9fd8c={'count':0x0,'rows':[]};return db[_0xc11d('0x43')][_0xc11d('0x6d')]({'where':{'id':_0x450d2c[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x1965c8,null))[_0xc11d('0x22')](function(_0x2e1bfc){if(_0x2e1bfc){_0x5ecb0c[_0xc11d('0x4b')]=_[_0xc11d('0x5d')](db[_0xc11d('0xa2')][_0xc11d('0x44')]);_0x5ecb0c[_0xc11d('0x48')]=_[_0xc11d('0x5d')](_0x450d2c['query']);_0x5ecb0c[_0xc11d('0x49')]=_[_0xc11d('0x4a')](_0x5ecb0c[_0xc11d('0x4b')],_0x5ecb0c[_0xc11d('0x48')]);_0x3b95e2[_0xc11d('0x4c')]=_[_0xc11d('0x4a')](_0x5ecb0c[_0xc11d('0x4b')],qs['fields'](_0x450d2c[_0xc11d('0x48')][_0xc11d('0x4d')]));_0x3b95e2[_0xc11d('0x4c')]=_0x3b95e2[_0xc11d('0x4c')][_0xc11d('0x4e')]?_0x3b95e2[_0xc11d('0x4c')]:_0x5ecb0c[_0xc11d('0x4b')];if(!_0x450d2c['query'][_0xc11d('0x4f')](_0xc11d('0x6e'))){_0x3b95e2[_0xc11d('0x31')]=qs['limit'](_0x450d2c[_0xc11d('0x48')][_0xc11d('0x31')]);_0x3b95e2['offset']=qs[_0xc11d('0x30')](_0x450d2c[_0xc11d('0x48')][_0xc11d('0x30')]);}_0x3b95e2[_0xc11d('0x6f')]=qs[_0xc11d('0x50')](_0x450d2c[_0xc11d('0x48')][_0xc11d('0x50')]);_0x3b95e2[_0xc11d('0x51')]=qs[_0xc11d('0x49')](_[_0xc11d('0x52')](_0x450d2c[_0xc11d('0x48')],_0x5ecb0c['filters']));_0x3b95e2[_0xc11d('0x51')][_0xc11d('0x67')]=_0x2e1bfc['id'];if(_0x450d2c[_0xc11d('0x48')][_0xc11d('0x53')]){_0x3b95e2[_0xc11d('0x51')]=_[_0xc11d('0x54')](_0x3b95e2[_0xc11d('0x51')],{'$or':_[_0xc11d('0x47')](_0x3b95e2[_0xc11d('0x4c')],function(_0xd46771){var _0x9bf315={};_0x9bf315[_0xd46771]={'$like':'%'+_0x450d2c['query']['filter']+'%'};return _0x9bf315;})});}_0x3b95e2=_['merge']({},_0x3b95e2,_0x450d2c['options']);return db['SmsInteraction']['count']({'where':_0x3b95e2[_0xc11d('0x51')]})[_0xc11d('0x22')](function(_0x3b0e4c){_0xf9fd8c[_0xc11d('0x33')]=_0x3b0e4c;if(_0x450d2c[_0xc11d('0x48')][_0xc11d('0x56')]){_0x3b95e2[_0xc11d('0x57')]=[{'model':db[_0xc11d('0x79')],'as':_0xc11d('0xc5'),'required':![]},{'model':db['User'],'as':_0xc11d('0xc6'),'attributes':[_0xc11d('0x3e'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0xc11d('0xc7'),'attributes':['id',_0xc11d('0x3e'),_0xc11d('0xc8')],'where':_0x450d2c['query']['tag']?{'id':_0x450d2c['query'][_0xc11d('0xc9')]}:undefined,'required':_0x450d2c[_0xc11d('0x48')][_0xc11d('0xc9')]?!![]:![]}];}return db[_0xc11d('0xa2')][_0xc11d('0x58')](_0x3b95e2);})[_0xc11d('0x22')](function(_0x1637f6){_0xf9fd8c[_0xc11d('0x59')]=_0x1637f6;return _0xf9fd8c;});}})[_0xc11d('0x22')](respondWithFilteredResult(_0x1965c8,_0x3b95e2))[_0xc11d('0x5a')](handleError(_0x1965c8,null));};exports[_0xc11d('0x3f')]=function(_0xfe374a,_0x55632d,_0x29e13e){var _0x262019,_0x5d143c,_0x5e6274;if(_['isNil'](_0xfe374a[_0xc11d('0x60')][_0xc11d('0x60')])||_0xfe374a[_0xc11d('0x60')][_0xc11d('0x60')]===''){throw new db[(_0xc11d('0x7a'))][(_0xc11d('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc11d('0x98')](_0xfe374a[_0xc11d('0x60')]['to'])){throw new db[(_0xc11d('0x7a'))][(_0xc11d('0x7b'))](_0xc11d('0xca'));}_0x262019=_0xfe374a[_0xc11d('0x60')]['to'];return db['SmsAccount']['find']({'where':{'id':_0xfe374a[_0xc11d('0x5c')]['id']},'include':[{'model':db[_0xc11d('0xcb')],'as':_0xc11d('0xcc'),'include':[{'model':db[_0xc11d('0x79')],'as':'Contacts','where':{'mobile':_0x262019},'limit':0x1,'order':[[_0xc11d('0x7f'),_0xc11d('0xcd')]]}]}]})['then'](handleEntityNotFound(_0x55632d,null))[_0xc11d('0x22')](function(_0x527443){if(_0x527443&&_0x527443[_0xc11d('0xcc')]){_0x5d143c=_0x527443[_0xc11d('0x39')]({'plain':!![]});if(_0x5d143c[_0xc11d('0xcc')]&&_0x5d143c[_0xc11d('0xcc')][_0xc11d('0x9f')][_0xc11d('0x4e')]){return _0x5d143c[_0xc11d('0xcc')][_0xc11d('0x9f')][0x0];}return db[_0xc11d('0x79')]['create'](_['defaults'](_0xfe374a[_0xc11d('0x60')],{'firstName':_0x262019,'mobile':_0x262019,'phone':_0x262019,'ListId':_0x5d143c[_0xc11d('0x9c')]}));}})[_0xc11d('0x22')](handleEntityNotFound(_0x55632d,null))[_0xc11d('0x22')](function(_0x91880d){if(_0x91880d){_0x5e6274=_0x91880d;return db['SmsInteraction']['find']({'where':{'ContactId':_0x5e6274['id'],'closed':![],'SmsAccountId':_0x5d143c['id']}})[_0xc11d('0x22')](function(_0xb905d6){if(_0xb905d6){return[_0xb905d6,![]];}return db['SmsInteraction'][_0xc11d('0x5f')]({'UserId':_0xfe374a[_0xc11d('0x62')]['id'],'ContactId':_0x5e6274['id'],'SmsAccountId':_0x5d143c['id'],'phone':_0x262019,'firstMsgDirection':_0xc11d('0xce'),'Messages':[_[_0xc11d('0x54')](_0xfe374a[_0xc11d('0x60')],{'read':![],'body':_0xfe374a[_0xc11d('0x60')]['body'],'phone':_0x262019,'SmsAccountId':_0x5d143c['id'],'UserId':_0xfe374a[_0xc11d('0x62')]['id'],'ContactId':_0x5e6274['id']})]},{'include':[{'model':db[_0xc11d('0xaa')],'as':_0xc11d('0xcf')}]})[_0xc11d('0x22')](function(_0x330082){return[_0x330082,!![]];});});}})['spread'](function(_0x5050cf,_0x5d11fe){if(_0x5d11fe){return _0x5050cf;}return db[_0xc11d('0xaa')][_0xc11d('0x5f')](_[_0xc11d('0x54')](_0xfe374a['body'],{'read':![],'body':_0xfe374a[_0xc11d('0x60')][_0xc11d('0x60')],'phone':_0x262019,'SmsAccountId':_0x5d143c['id'],'SmsInteractionId':_0x5050cf['id'],'UserId':_0xfe374a[_0xc11d('0x62')]['id'],'ContactId':_0x5e6274['id']}))[_0xc11d('0x22')](function(_0x1f5f87){_0x5050cf[_0xc11d('0xd0')][_0xc11d('0xcf')]=[];_0x5050cf[_0xc11d('0xd0')][_0xc11d('0xcf')]['push'](_0x1f5f87[_0xc11d('0xd0')]);return _0x5050cf;});})[_0xc11d('0x22')](respondWithResult(_0x55632d,null))[_0xc11d('0x5a')](handleError(_0x55632d,null));};exports[_0xc11d('0x2e')]=function(_0x25a7b4,_0x5687c4,_0x86c430){if(_0x25a7b4['body']['id']){delete _0x25a7b4['body']['id'];}var _0x1a3055,_0x1de8ed,_0x58a452;return db['SmsAccount'][_0xc11d('0x5e')]({'where':{'id':_0x25a7b4[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x5687c4,null))['then'](function(_0x326231){if(_0x326231){_0x58a452=_0x326231;logger[_0xc11d('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc11d('0x2e'),'received\x20delivery\x20report\x20from',_0x326231[_0xc11d('0x46')],util[_0xc11d('0xd1')](_0x25a7b4[_0xc11d('0x60')],{'showHidden':![],'depth':null}));switch(_0x326231[_0xc11d('0x46')]){case _0xc11d('0x86'):if(_0x25a7b4['body']['skebby_dispatch_id']&&_0x25a7b4[_0xc11d('0x60')]['status']){_0x1de8ed=_0x25a7b4[_0xc11d('0x60')][_0xc11d('0x2e')];return db[_0xc11d('0xaa')][_0xc11d('0x5e')]({'where':{'messageId':_0x25a7b4[_0xc11d('0x60')][_0xc11d('0xd2')]}});}break;case'connectel':if(_0x25a7b4[_0xc11d('0x60')][_0xc11d('0xd3')]&&_0x25a7b4[_0xc11d('0x60')][_0xc11d('0xd4')]){_0x1de8ed=_0x25a7b4['body'][_0xc11d('0xd4')];return db['SmsMessage'][_0xc11d('0x5e')]({'where':{'messageId':_0x25a7b4['body'][_0xc11d('0xd3')]}});}break;case'clicksend':if(_0x25a7b4[_0xc11d('0x60')][_0xc11d('0x8a')]&&_0x25a7b4[_0xc11d('0x60')][_0xc11d('0xd5')]){_0x1de8ed=_0x25a7b4[_0xc11d('0x60')][_0xc11d('0xd5')];return db[_0xc11d('0xaa')][_0xc11d('0x5e')]({'where':{'messageId':_0x25a7b4['body']['message_id']}});}break;case _0xc11d('0x8e'):var _0x330e0d=_0x25a7b4[_0xc11d('0x60')][_0xc11d('0x8f')][0x0];if(_0x330e0d[_0xc11d('0x84')]&&_0x330e0d['status'][_0xc11d('0xd6')]===_0xc11d('0xd7')){_0x1de8ed=_0x330e0d[_0xc11d('0x2e')][_0xc11d('0xd6')];return db[_0xc11d('0xaa')]['find']({'where':{'messageId':_0x330e0d[_0xc11d('0x84')]}});}break;case _0xc11d('0x92'):if(_0x25a7b4[_0xc11d('0x60')][_0xc11d('0x84')]&&_0x25a7b4[_0xc11d('0x60')][_0xc11d('0x2e')]){_0x1de8ed=_0x25a7b4[_0xc11d('0x60')][_0xc11d('0x2e')];return db[_0xc11d('0xaa')][_0xc11d('0x5e')]({'where':{'messageId':_0x25a7b4['body'][_0xc11d('0x84')]}});}break;case _0xc11d('0x94'):if(_0x25a7b4[_0xc11d('0x60')][0x0][_0xc11d('0x2b')]['id']){_0x1de8ed=_0x25a7b4[_0xc11d('0x60')][0x0][_0xc11d('0x46')];return db[_0xc11d('0xaa')][_0xc11d('0x5e')]({'where':{'messageId':_0x25a7b4['body'][0x0]['message']['id']}});}break;case _0xc11d('0x95'):if(_0x25a7b4[_0xc11d('0x60')][_0xc11d('0xd8')]&&_0x25a7b4['body'][_0xc11d('0x2e')]){_0x1de8ed=_0x25a7b4['body'][_0xc11d('0x2e')];return db[_0xc11d('0xaa')]['find']({'where':{'messageId':_0x25a7b4[_0xc11d('0x60')][_0xc11d('0xd8')]}});}break;}}})[_0xc11d('0x22')](handleEntityNotFound(_0x5687c4,null))[_0xc11d('0x22')](function(_0x4be91b){if(_0x4be91b){_0x1a3055=_0x4be91b;switch(_0x58a452[_0xc11d('0x46')]){case _0xc11d('0x86'):if(_0x1de8ed==='DELIVERED'){return _0x1a3055[_0xc11d('0x37')]({'read':!![]});}else{logger[_0xc11d('0x29')](_0xc11d('0x27'),_0xc11d('0x2e'),_0xc11d('0x86'),util[_0xc11d('0xd1')](_0x25a7b4[_0xc11d('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc11d('0xd9'):if(_0x1de8ed==='1'){return _0x1a3055[_0xc11d('0x37')]({'read':!![]});}else{logger[_0xc11d('0x29')](_0xc11d('0x27'),_0xc11d('0x2e'),_0xc11d('0x86'),util[_0xc11d('0xd1')](_0x25a7b4[_0xc11d('0x60')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x25a7b4[_0xc11d('0x60')]['error_code']&&_0x1de8ed>=0xc8&&_0x1de8ed<=0xce){return _0x1a3055[_0xc11d('0x37')]({'read':!![]});}else{logger[_0xc11d('0x29')](_0xc11d('0x27'),_0xc11d('0x2e'),'clicksend',util[_0xc11d('0xd1')](_0x25a7b4['body'],{'showHidden':![],'depth':null}));}break;case _0xc11d('0x8e'):var _0x3db2ce=_0x25a7b4[_0xc11d('0x60')][_0xc11d('0x8f')][0x0];if(_0x3db2ce[_0xc11d('0x2e')][_0xc11d('0xd6')]===_0xc11d('0xd7')){return _0x1a3055[_0xc11d('0x37')]({'read':!![]});}else{logger[_0xc11d('0x29')](_0xc11d('0x27'),_0xc11d('0x2e'),'infobip',util[_0xc11d('0xd1')](_0x25a7b4[_0xc11d('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc11d('0x92'):if(_0x1de8ed==_0xc11d('0xda')||_0x1de8ed==_0xc11d('0xdb')){return _0x1a3055['update']({'read':!![]});}else{logger[_0xc11d('0x29')](_0xc11d('0x27'),'status','clickatell',util['inspect'](_0x25a7b4[_0xc11d('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc11d('0x94'):if(_0x1de8ed==_0xc11d('0xdc')){return _0x1a3055[_0xc11d('0x37')]({'read':!![]});}else{logger['error'](_0xc11d('0x27'),_0xc11d('0x2e'),'bandwidth',util[_0xc11d('0xd1')](_0x25a7b4[_0xc11d('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc11d('0x95'):if(_0x1de8ed==='DELIVRD'||_0x1de8ed===_0xc11d('0xdd')){return _0x1a3055[_0xc11d('0x37')]({'read':!![]});}else{logger[_0xc11d('0x29')](_0xc11d('0x27'),_0xc11d('0x2e'),_0xc11d('0x95'),util['inspect'](_0x25a7b4['body'],{'showHidden':![],'depth':null}));}break;}return _0x1a3055;}})[_0xc11d('0x22')](respondWithResult(_0x5687c4,null))['catch'](handleError(_0x5687c4,null));};exports[_0xc11d('0xde')]=function(_0x4b3d1a,_0x544ae1,_0x40224a){var _0x59cb41,_0x35c0b5,_0x2b967b;return db[_0xc11d('0x43')]['find']({'where':{'id':_0x4b3d1a[_0xc11d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x544ae1,null))['then'](function(_0x1b1794){if(_0x1b1794){_0x2b967b=_0x1b1794;logger[_0xc11d('0x26')](_0xc11d('0x27'),_0xc11d('0x2e'),_0xc11d('0xdf'),_0x1b1794[_0xc11d('0x46')],util[_0xc11d('0xd1')](_0x4b3d1a[_0xc11d('0x48')],{'showHidden':![],'depth':null}));switch(_0x1b1794['type']){case _0xc11d('0x90'):if(_0x4b3d1a[_0xc11d('0x48')][_0xc11d('0xe0')]&&_0x4b3d1a[_0xc11d('0x48')][_0xc11d('0xe1')]){_0x35c0b5=_0x4b3d1a[_0xc11d('0x48')][_0xc11d('0xe1')];return db['SmsMessage'][_0xc11d('0x5e')]({'where':{'messageId':_0x4b3d1a[_0xc11d('0x48')]['message-id']}});}break;}}})[_0xc11d('0x22')](handleEntityNotFound(_0x544ae1,null))[_0xc11d('0x22')](function(_0x32b61f){if(_0x32b61f){_0x59cb41=_0x32b61f;switch(_0x2b967b['type']){case _0xc11d('0x90'):if(_0x35c0b5==='2'||_0x35c0b5==='6'){return _0x59cb41[_0xc11d('0x37')]({'read':!![]});}else{logger[_0xc11d('0x29')](_0xc11d('0x27'),'status','csc',util['inspect'](_0x4b3d1a['query'],{'showHidden':![],'depth':null}));};break;}return _0x59cb41;}})['then'](respondWithResult(_0x544ae1,null))[_0xc11d('0x5a')](handleError(_0x544ae1,null));};exports[_0xc11d('0xe2')]=function(_0x4cbae0,_0x34b9b2,_0x58fbf7){return db[_0xc11d('0x43')][_0xc11d('0x5e')]({'where':{'id':_0x4cbae0[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x34b9b2,null))['then'](function(_0x2636a6){if(_0x2636a6){return _0x2636a6[_0xc11d('0xe2')](_0x4cbae0[_0xc11d('0x60')][_0xc11d('0x6a')],_[_0xc11d('0x9e')](_0x4cbae0['body'],[_0xc11d('0x6a'),'id'])||{})[_0xc11d('0xa3')](function(_0x294396){for(var _0x196ab5=0x0;_0x196ab5<_0x4cbae0[_0xc11d('0x60')]['ids'][_0xc11d('0x4e')];_0x196ab5+=0x1){socket[_0xc11d('0xe3')](_0xc11d('0xe4'),{'UserId':Number(_0x4cbae0[_0xc11d('0x60')][_0xc11d('0x6a')][_0x196ab5]),'SmsAccountId':Number(_0x4cbae0[_0xc11d('0x5c')]['id'])});}return _0x294396;});}})['then'](respondWithResult(_0x34b9b2,null))['catch'](handleError(_0x34b9b2,null));};exports['removeAgents']=function(_0xd4c742,_0x3f2186,_0xc41803){return db[_0xc11d('0x43')]['find']({'where':{'id':_0xd4c742[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x3f2186,null))[_0xc11d('0x22')](function(_0x36f907){if(_0x36f907){return _0x36f907[_0xc11d('0xe5')](_0xd4c742[_0xc11d('0x48')][_0xc11d('0x6a')])[_0xc11d('0x22')](function(){if(_[_0xc11d('0xe6')](_0xd4c742[_0xc11d('0x48')][_0xc11d('0x6a')])){for(var _0xb2fbe4=0x0;_0xb2fbe4<_0xd4c742['query'][_0xc11d('0x6a')][_0xc11d('0x4e')];_0xb2fbe4+=0x1){socket[_0xc11d('0xe3')](_0xc11d('0xe7'),{'UserId':Number(_0xd4c742['query'][_0xc11d('0x6a')][_0xb2fbe4]),'SmsAccountId':Number(_0xd4c742[_0xc11d('0x5c')]['id'])});}}else{socket['emit'](_0xc11d('0xe7'),{'UserId':Number(_0xd4c742['query'][_0xc11d('0x6a')]),'SmsAccountId':Number(_0xd4c742[_0xc11d('0x5c')]['id'])});}});}})[_0xc11d('0x22')](respondWithStatusCode(_0x3f2186,null))['catch'](handleError(_0x3f2186,null));};exports[_0xc11d('0xe8')]=function(_0xf79394,_0x49bf7f,_0x49891b){var _0x183143={};var _0x270d3c={};var _0xf789cb;var _0x575e34;return db[_0xc11d('0x43')]['findOne']({'where':{'id':_0xf79394[_0xc11d('0x5c')]['id']}})[_0xc11d('0x22')](handleEntityNotFound(_0x49bf7f,null))[_0xc11d('0x22')](function(_0x429d08){if(_0x429d08){_0xf789cb=_0x429d08;_0x270d3c[_0xc11d('0x4b')]=_[_0xc11d('0x5d')](db[_0xc11d('0xae')][_0xc11d('0x44')]);_0x270d3c[_0xc11d('0x48')]=_[_0xc11d('0x5d')](_0xf79394['query']);_0x270d3c[_0xc11d('0x49')]=_['intersection'](_0x270d3c['model'],_0x270d3c['query']);_0x183143[_0xc11d('0x4c')]=_[_0xc11d('0x4a')](_0x270d3c[_0xc11d('0x4b')],qs[_0xc11d('0x4d')](_0xf79394[_0xc11d('0x48')][_0xc11d('0x4d')]));_0x183143[_0xc11d('0x4c')]=_0x183143[_0xc11d('0x4c')][_0xc11d('0x4e')]?_0x183143[_0xc11d('0x4c')]:_0x270d3c[_0xc11d('0x4b')];_0x183143[_0xc11d('0x6f')]=qs['sort'](_0xf79394[_0xc11d('0x48')]['sort']);_0x183143[_0xc11d('0x51')]=qs['filters'](_[_0xc11d('0x52')](_0xf79394[_0xc11d('0x48')],_0x270d3c[_0xc11d('0x49')]));if(_0xf79394['query'][_0xc11d('0x53')]){_0x183143[_0xc11d('0x51')]=_['merge'](_0x183143[_0xc11d('0x51')],{'$or':_[_0xc11d('0x47')](_0x183143[_0xc11d('0x4c')],function(_0x32f635){var _0x4ac885={};_0x4ac885[_0x32f635]={'$like':'%'+_0xf79394[_0xc11d('0x48')]['filter']+'%'};return _0x4ac885;})});}_0x183143=_[_0xc11d('0x54')]({},_0x183143,_0xf79394['options']);return _0xf789cb[_0xc11d('0xe8')](_0x183143);}})[_0xc11d('0x22')](function(_0xd98ba7){if(_0xd98ba7){_0x575e34=_0xd98ba7['length'];if(!_0xf79394[_0xc11d('0x48')]['hasOwnProperty'](_0xc11d('0x6e'))){_0x183143[_0xc11d('0x31')]=qs[_0xc11d('0x31')](_0xf79394[_0xc11d('0x48')]['limit']);_0x183143[_0xc11d('0x30')]=qs['offset'](_0xf79394[_0xc11d('0x48')][_0xc11d('0x30')]);}return _0xf789cb[_0xc11d('0xe8')](_0x183143);}})['then'](function(_0x31c443){if(_0x31c443){return _0x31c443?{'count':_0x575e34,'rows':_0x31c443}:null;}})[_0xc11d('0x22')](respondWithResult(_0x49bf7f,null))[_0xc11d('0x5a')](handleError(_0x49bf7f,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index d8e1875..d9bb872 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 _0x1a64=['exports','events','SmsAccount','save','update','emit','hook'];(function(_0x4f20ec,_0x46903e){var _0x1a8012=function(_0x37bbcb){while(--_0x37bbcb){_0x4f20ec['push'](_0x4f20ec['shift']());}};_0x1a8012(++_0x46903e);}(_0x1a64,0x16d));var _0x41a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a64[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x41a6('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x41a6('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x41a6('0x2'),'afterUpdate':_0x41a6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x276545){return function(_0x16218e,_0x140318,_0x5083c2){SmsAccountEvents[_0x41a6('0x4')](_0x276545+':'+_0x16218e['id'],_0x16218e);SmsAccountEvents[_0x41a6('0x4')](_0x276545,_0x16218e);_0x5083c2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x41a6('0x5')](e,emitEvent(event));}}module[_0x41a6('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0x761a=['save','emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x83d08e,_0x228942){var _0x404d4f=function(_0x161ce){while(--_0x161ce){_0x83d08e['push'](_0x83d08e['shift']());}};_0x404d4f(++_0x228942);}(_0x761a,0x104));var _0xa761=function(_0x44b002,_0x2062a2){_0x44b002=_0x44b002-0x0;var _0x2e3ab4=_0x761a[_0x44b002];return _0x2e3ab4;};'use strict';var EventEmitter=require(_0xa761('0x0'));var SmsAccount=require(_0xa761('0x1'))['db'][_0xa761('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa761('0x3')](0x0);var events={'afterCreate':_0xa761('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x123bef){return function(_0x29f342,_0xaf7e25,_0x473104){SmsAccountEvents[_0xa761('0x5')](_0x123bef+':'+_0x29f342['id'],_0x29f342);SmsAccountEvents[_0xa761('0x5')](_0x123bef,_0x29f342);_0x473104(null);};}for(var e in events){if(events[_0xa761('0x6')](e)){var event=events[e];SmsAccount[_0xa761('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 18bc6e6..261b118 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 _0x76cd=['bluebird','request-promise','path','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment'];(function(_0x53b0e5,_0x26a000){var _0x545130=function(_0x16ea13){while(--_0x16ea13){_0x53b0e5['push'](_0x53b0e5['shift']());}};_0x545130(++_0x26a000);}(_0x76cd,0x6a));var _0xd76c=function(_0x1c4ea3,_0x5ec757){_0x1c4ea3=_0x1c4ea3-0x0;var _0x319753=_0x76cd[_0x1c4ea3];return _0x319753;};'use strict';var _=require(_0xd76c('0x0'));var util=require('util');var logger=require(_0xd76c('0x1'))(_0xd76c('0x2'));var moment=require(_0xd76c('0x3'));var BPromise=require(_0xd76c('0x4'));var rp=require(_0xd76c('0x5'));var fs=require('fs');var path=require(_0xd76c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd76c('0x7'));module['exports']=function(_0x4685ba,_0x36061a){return _0x4685ba[_0xd76c('0x8')](_0xd76c('0x9'),attributes,{'tableName':_0xd76c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe62d=['SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x24ab18,_0x11d696){var _0x5e0ca1=function(_0x9b8dd7){while(--_0x9b8dd7){_0x24ab18['push'](_0x24ab18['shift']());}};_0x5e0ca1(++_0x11d696);}(_0xe62d,0x10a));var _0xde62=function(_0x476123,_0x47b9cc){_0x476123=_0x476123-0x0;var _0x5ca23f=_0xe62d[_0x476123];return _0x5ca23f;};'use strict';var _=require(_0xde62('0x0'));var util=require(_0xde62('0x1'));var logger=require(_0xde62('0x2'))(_0xde62('0x3'));var moment=require(_0xde62('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xde62('0x5'));var rimraf=require(_0xde62('0x6'));var config=require(_0xde62('0x7'));var attributes=require('./smsAccount.attributes');module[_0xde62('0x8')]=function(_0x14c524,_0x1cfb9e){return _0x14c524[_0xde62('0x9')](_0xde62('0xa'),attributes,{'tableName':_0xde62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 89a89c2..d30a90d 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 _0x8387=['result','catch','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','request\x20sent','stringify','code','error','message','SmsAccount,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8387,0xc9));var _0x7838=function(_0xa808d9,_0x186110){_0xa808d9=_0xa808d9-0x0;var _0x2ae6af=_0x8387[_0xa808d9];return _0x2ae6af;};'use strict';var _=require(_0x7838('0x0'));var util=require(_0x7838('0x1'));var moment=require(_0x7838('0x2'));var BPromise=require(_0x7838('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7838('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7838('0x5'));var logger=require(_0x7838('0x6'))(_0x7838('0x7'));var config=require(_0x7838('0x8'));var jayson=require(_0x7838('0x9'));var client=jayson[_0x7838('0xa')][_0x7838('0xb')]({'port':0x232a});config['redis']=_[_0x7838('0xc')](config[_0x7838('0xd')],{'host':_0x7838('0xe'),'port':0x18eb});var socket=require(_0x7838('0xf'))(new Redis(config[_0x7838('0xd')]));require(_0x7838('0x10'))[_0x7838('0x11')](socket);function respondWithRpcPromise(_0x4980f4,_0x32d4a5,_0x47fcfd){return new BPromise(function(_0x1135af,_0x19b9f2){return client[_0x7838('0x12')](_0x4980f4,_0x47fcfd)[_0x7838('0x13')](function(_0x14cebc){logger[_0x7838('0x14')]('SmsAccount,\x20%s,\x20%s',_0x32d4a5,_0x7838('0x15'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x32d4a5,_0x7838('0x15'),JSON[_0x7838('0x16')](_0x14cebc));if(_0x14cebc['error']){if(_0x14cebc['error'][_0x7838('0x17')]===0x1f4){logger[_0x7838('0x18')]('SmsAccount,\x20%s,\x20%s',_0x32d4a5,_0x14cebc[_0x7838('0x18')][_0x7838('0x19')]);return _0x19b9f2(_0x14cebc[_0x7838('0x18')][_0x7838('0x19')]);}logger[_0x7838('0x18')](_0x7838('0x1a'),_0x32d4a5,_0x14cebc[_0x7838('0x18')]['message']);return _0x1135af(_0x14cebc[_0x7838('0x18')][_0x7838('0x19')]);}else{logger[_0x7838('0x14')](_0x7838('0x1a'),_0x32d4a5,_0x7838('0x15'));_0x1135af(_0x14cebc[_0x7838('0x1b')][_0x7838('0x19')]);}})[_0x7838('0x1c')](function(_0x523d49){logger[_0x7838('0x18')](_0x7838('0x1a'),_0x32d4a5,_0x523d49);_0x19b9f2(_0x523d49);});});}exports[_0x7838('0x1d')]=function(_0x5a403e){var _0x4ad624=this;return new Promise(function(_0x4b6dc6,_0x297dd8){return db[_0x7838('0x1e')]['find']({'raw':_0x5a403e[_0x7838('0x1f')]?_0x5a403e['options'][_0x7838('0x20')]===undefined?!![]:![]:!![],'where':_0x5a403e[_0x7838('0x1f')]?_0x5a403e[_0x7838('0x1f')][_0x7838('0x21')]||null:null,'attributes':_0x5a403e[_0x7838('0x1f')]?_0x5a403e[_0x7838('0x1f')][_0x7838('0x22')]||null:null,'include':_0x5a403e[_0x7838('0x1f')]?_0x5a403e[_0x7838('0x1f')][_0x7838('0x23')]?_[_0x7838('0x24')](_0x5a403e['options'][_0x7838('0x23')],function(_0x5f0412){return{'model':db[_0x5f0412['model']],'as':_0x5f0412['as'],'attributes':_0x5f0412[_0x7838('0x22')],'include':_0x5f0412['include']?_['map'](_0x5f0412['include'],function(_0x387660){return{'model':db[_0x387660[_0x7838('0x25')]],'as':_0x387660['as'],'attributes':_0x387660[_0x7838('0x22')],'include':_0x387660['include']?_['map'](_0x387660[_0x7838('0x23')],function(_0x2c0394){return{'model':db[_0x2c0394[_0x7838('0x25')]],'as':_0x2c0394['as'],'attributes':_0x2c0394['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cbd45){logger[_0x7838('0x14')](_0x7838('0x1d'),_0x5a403e);logger['debug']('ShowSmsAccount',_0x5a403e,JSON['stringify'](_0x5cbd45));_0x4b6dc6(_0x5cbd45);})[_0x7838('0x1c')](function(_0x4afb9b){logger[_0x7838('0x18')]('ShowSmsAccount',_0x4afb9b[_0x7838('0x19')],_0x5a403e);_0x297dd8(_0x4ad624[_0x7838('0x18')](0x1f4,_0x4afb9b['message']));});});}; \ No newline at end of file +var _0x2cb2=['request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','util','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register'];(function(_0x20f6dd,_0x17dd5e){var _0x2d16e1=function(_0x193b7a){while(--_0x193b7a){_0x20f6dd['push'](_0x20f6dd['shift']());}};_0x2d16e1(++_0x17dd5e);}(_0x2cb2,0x1f2));var _0x22cb=function(_0x6544dd,_0x1866d7){_0x6544dd=_0x6544dd-0x0;var _0x355f5a=_0x2cb2[_0x6544dd];return _0x355f5a;};'use strict';var _=require('lodash');var util=require(_0x22cb('0x0'));var moment=require('moment');var BPromise=require(_0x22cb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22cb('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x22cb('0x3'));var config=require(_0x22cb('0x4'));var jayson=require(_0x22cb('0x5'));var client=jayson['client'][_0x22cb('0x6')]({'port':0x232a});config[_0x22cb('0x7')]=_['defaults'](config['redis'],{'host':_0x22cb('0x8'),'port':0x18eb});var socket=require(_0x22cb('0x9'))(new Redis(config[_0x22cb('0x7')]));require(_0x22cb('0xa'))[_0x22cb('0xb')](socket);function respondWithRpcPromise(_0x659ce1,_0x641af6,_0x272056){return new BPromise(function(_0x29ee19,_0x1bc8be){return client[_0x22cb('0xc')](_0x659ce1,_0x272056)[_0x22cb('0xd')](function(_0x1057b3){logger[_0x22cb('0xe')](_0x22cb('0xf'),_0x641af6,'request\x20sent');logger[_0x22cb('0x10')](_0x22cb('0x11'),_0x641af6,_0x22cb('0x12'),JSON['stringify'](_0x1057b3));if(_0x1057b3[_0x22cb('0x13')]){if(_0x1057b3[_0x22cb('0x13')][_0x22cb('0x14')]===0x1f4){logger[_0x22cb('0x13')](_0x22cb('0xf'),_0x641af6,_0x1057b3[_0x22cb('0x13')][_0x22cb('0x15')]);return _0x1bc8be(_0x1057b3['error']['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x641af6,_0x1057b3['error'][_0x22cb('0x15')]);return _0x29ee19(_0x1057b3[_0x22cb('0x13')]['message']);}else{logger[_0x22cb('0xe')]('SmsAccount,\x20%s,\x20%s',_0x641af6,_0x22cb('0x12'));_0x29ee19(_0x1057b3[_0x22cb('0x16')][_0x22cb('0x15')]);}})[_0x22cb('0x17')](function(_0x15e46f){logger[_0x22cb('0x13')](_0x22cb('0xf'),_0x641af6,_0x15e46f);_0x1bc8be(_0x15e46f);});});}exports[_0x22cb('0x18')]=function(_0x34cb56){var _0x161520=this;return new Promise(function(_0x1db010,_0x475468){return db[_0x22cb('0x19')][_0x22cb('0x1a')]({'raw':_0x34cb56['options']?_0x34cb56[_0x22cb('0x1b')][_0x22cb('0x1c')]===undefined?!![]:![]:!![],'where':_0x34cb56[_0x22cb('0x1b')]?_0x34cb56['options'][_0x22cb('0x1d')]||null:null,'attributes':_0x34cb56['options']?_0x34cb56[_0x22cb('0x1b')][_0x22cb('0x1e')]||null:null,'include':_0x34cb56[_0x22cb('0x1b')]?_0x34cb56[_0x22cb('0x1b')][_0x22cb('0x1f')]?_[_0x22cb('0x20')](_0x34cb56[_0x22cb('0x1b')][_0x22cb('0x1f')],function(_0x30e247){return{'model':db[_0x30e247['model']],'as':_0x30e247['as'],'attributes':_0x30e247[_0x22cb('0x1e')],'include':_0x30e247[_0x22cb('0x1f')]?_[_0x22cb('0x20')](_0x30e247[_0x22cb('0x1f')],function(_0x4062d0){return{'model':db[_0x4062d0[_0x22cb('0x21')]],'as':_0x4062d0['as'],'attributes':_0x4062d0[_0x22cb('0x1e')],'include':_0x4062d0[_0x22cb('0x1f')]?_[_0x22cb('0x20')](_0x4062d0[_0x22cb('0x1f')],function(_0x207557){return{'model':db[_0x207557[_0x22cb('0x21')]],'as':_0x207557['as'],'attributes':_0x207557[_0x22cb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x22cb('0xd')](function(_0x44deed){logger[_0x22cb('0xe')](_0x22cb('0x18'),_0x34cb56);logger[_0x22cb('0x10')](_0x22cb('0x18'),_0x34cb56,JSON['stringify'](_0x44deed));_0x1db010(_0x44deed);})[_0x22cb('0x17')](function(_0x30d60f){logger[_0x22cb('0x13')](_0x22cb('0x18'),_0x30d60f[_0x22cb('0x15')],_0x34cb56);_0x475468(_0x161520['error'](0x1f4,_0x30d60f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 70da6eb..aa785e6 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 a276579..8e0f352 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 _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(_0x54791b,_0x3caee7){var _0x280dca=function(_0x1a13bc){while(--_0x1a13bc){_0x54791b['push'](_0x54791b['shift']());}};_0x280dca(++_0x3caee7);}(_0x008c,0x188));var _0xc008=function(_0x525864,_0x1bb3ea){_0x525864=_0x525864-0x0;var _0x4f9964=_0x008c[_0x525864];return _0x4f9964;};'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 +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x5601f8,_0x211c63){var _0x1e1901=function(_0x23be74){while(--_0x23be74){_0x5601f8['push'](_0x5601f8['shift']());}};_0x1e1901(++_0x211c63);}(_0x3e74,0x175));var _0x43e7=function(_0x529b4e,_0x49529d){_0x529b4e=_0x529b4e-0x0;var _0x337b2f=_0x3e74[_0x529b4e];return _0x337b2f;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index ce73f84..28cedfb 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 _0xf171=['exports','INTEGER','STRING','noop','TEXT'];(function(_0x3146d7,_0x4de04b){var _0x11e7a8=function(_0x134642){while(--_0x134642){_0x3146d7['push'](_0x3146d7['shift']());}};_0x11e7a8(++_0x4de04b);}(_0xf171,0x1d6));var _0x1f17=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0xf171[_0x27604f];return _0x40d189;};'use strict';var Sequelize=require('sequelize');module[_0x1f17('0x0')]={'priority':{'type':Sequelize[_0x1f17('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1f17('0x2')],'allowNull':![],'defaultValue':_0x1f17('0x3')},'appdata':{'type':Sequelize[_0x1f17('0x4')]()},'description':{'type':Sequelize[_0x1f17('0x2')]},'interval':{'type':Sequelize[_0x1f17('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd65d=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xd65d,0x142));var _0xdd65=function(_0x3694e1,_0x2f5ad9){_0x3694e1=_0x3694e1-0x0;var _0x3d4cf0=_0xd65d[_0x3694e1];return _0x3d4cf0;};'use strict';var Sequelize=require('sequelize');module[_0xdd65('0x0')]={'priority':{'type':Sequelize[_0xdd65('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xdd65('0x2')],'allowNull':![],'defaultValue':_0xdd65('0x3')},'appdata':{'type':Sequelize[_0xdd65('0x4')]()},'description':{'type':Sequelize[_0xdd65('0x2')]},'interval':{'type':Sequelize[_0xdd65('0x2')],'defaultValue':_0xdd65('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index f73ec73..edf8e7a 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 _0xf745=['save','then','stack','name','index','map','SmsApplication','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','apply'];(function(_0x292f35,_0x72e859){var _0x288e75=function(_0x1bba68){while(--_0x1bba68){_0x292f35['push'](_0x292f35['shift']());}};_0x288e75(++_0x72e859);}(_0xf745,0x6d));var _0x5f74=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf745[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x5f74('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5f74('0x1'));var rp=require(_0x5f74('0x2'));var moment=require(_0x5f74('0x3'));var BPromise=require(_0x5f74('0x4'));var Mustache=require(_0x5f74('0x5'));var util=require(_0x5f74('0x6'));var path=require(_0x5f74('0x7'));var sox=require(_0x5f74('0x8'));var csv=require(_0x5f74('0x9'));var ejs=require(_0x5f74('0xa'));var fs=require('fs');var fs_extra=require(_0x5f74('0xb'));var _=require('lodash');var squel=require(_0x5f74('0xc'));var crypto=require(_0x5f74('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5f74('0xe'));var toCsv=require(_0x5f74('0x9'));var querystring=require(_0x5f74('0xf'));var Papa=require(_0x5f74('0x10'));var Redis=require(_0x5f74('0x11'));var authService=require(_0x5f74('0x12'));var qs=require(_0x5f74('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f74('0x14'));var logger=require(_0x5f74('0x15'))(_0x5f74('0x16'));var utils=require(_0x5f74('0x17'));var config=require(_0x5f74('0x18'));var licenseUtil=require(_0x5f74('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x593344,_0x1c9a00){_0x1c9a00=_0x1c9a00||0xcc;return function(_0x3b468f){if(_0x3b468f){return _0x593344['sendStatus'](_0x1c9a00);}return _0x593344[_0x5f74('0x1a')](_0x1c9a00)['end']();};}function respondWithResult(_0x11e9d5,_0x5e5585){_0x5e5585=_0x5e5585||0xc8;return function(_0x2afe84){if(_0x2afe84){return _0x11e9d5[_0x5f74('0x1a')](_0x5e5585)[_0x5f74('0x1b')](_0x2afe84);}};}function respondWithFilteredResult(_0x31e86b,_0x69f889){return function(_0x3d48e3){if(_0x3d48e3){var _0x101603=typeof _0x69f889[_0x5f74('0x1c')]===_0x5f74('0x1d')&&typeof _0x69f889[_0x5f74('0x1e')]===_0x5f74('0x1d');var _0x211bc5=_0x3d48e3[_0x5f74('0x1f')];var _0x17f1db=_0x101603?0x0:_0x69f889['offset'];var _0x490497=_0x101603?_0x3d48e3[_0x5f74('0x1f')]:_0x69f889['offset']+_0x69f889[_0x5f74('0x1e')];var _0x45b518;if(_0x490497>=_0x211bc5){_0x490497=_0x211bc5;_0x45b518=0xc8;}else{_0x45b518=0xce;}_0x31e86b[_0x5f74('0x1a')](_0x45b518);return _0x31e86b['set']('Content-Range',_0x17f1db+'-'+_0x490497+'/'+_0x211bc5)[_0x5f74('0x1b')](_0x3d48e3);}return null;};}function patchUpdates(_0x2c501c){return function(_0x312af8){try{jsonpatch[_0x5f74('0x20')](_0x312af8,_0x2c501c,!![]);}catch(_0x21b43a){return BPromise['reject'](_0x21b43a);}return _0x312af8[_0x5f74('0x21')]();};}function saveUpdates(_0x13f35c,_0x13ef3a){return function(_0x2b12df){if(_0x2b12df){return _0x2b12df['update'](_0x13f35c)[_0x5f74('0x22')](function(_0x1f0f92){return _0x1f0f92;});}return null;};}function removeEntity(_0x3fc0df,_0x12b46f){return function(_0x275aa4){if(_0x275aa4){return _0x275aa4['destroy']()[_0x5f74('0x22')](function(){_0x3fc0df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x182c62,_0x93a913){return function(_0x4b83f8){if(!_0x4b83f8){_0x182c62['sendStatus'](0x194);}return _0x4b83f8;};}function handleError(_0x5efd8c,_0x6e911b){_0x6e911b=_0x6e911b||0x1f4;return function(_0x46a432){logger['error'](_0x46a432[_0x5f74('0x23')]);if(_0x46a432[_0x5f74('0x24')]){delete _0x46a432['name'];}_0x5efd8c[_0x5f74('0x1a')](_0x6e911b)['send'](_0x46a432);};}exports[_0x5f74('0x25')]=function(_0x4e8770,_0x1eab55){var _0x1593b1={},_0x45928a={},_0xc87c4b={'count':0x0,'rows':[]};var _0x29cefb=_[_0x5f74('0x26')](db[_0x5f74('0x27')]['rawAttributes'],function(_0x567a11){return{'name':_0x567a11[_0x5f74('0x28')],'type':_0x567a11['type'][_0x5f74('0x29')]};});_0x45928a[_0x5f74('0x2a')]=_['map'](_0x29cefb,'name');_0x45928a[_0x5f74('0x2b')]=_[_0x5f74('0x2c')](_0x4e8770[_0x5f74('0x2b')]);_0x45928a['filters']=_[_0x5f74('0x2d')](_0x45928a[_0x5f74('0x2a')],_0x45928a['query']);_0x1593b1[_0x5f74('0x2e')]=_[_0x5f74('0x2d')](_0x45928a[_0x5f74('0x2a')],qs[_0x5f74('0x2f')](_0x4e8770[_0x5f74('0x2b')][_0x5f74('0x2f')]));_0x1593b1[_0x5f74('0x2e')]=_0x1593b1[_0x5f74('0x2e')][_0x5f74('0x30')]?_0x1593b1[_0x5f74('0x2e')]:_0x45928a[_0x5f74('0x2a')];if(!_0x4e8770[_0x5f74('0x2b')]['hasOwnProperty'](_0x5f74('0x31'))){_0x1593b1[_0x5f74('0x1e')]=qs[_0x5f74('0x1e')](_0x4e8770['query'][_0x5f74('0x1e')]);_0x1593b1[_0x5f74('0x1c')]=qs[_0x5f74('0x1c')](_0x4e8770['query']['offset']);}_0x1593b1[_0x5f74('0x32')]=qs['sort'](_0x4e8770[_0x5f74('0x2b')][_0x5f74('0x33')]);_0x1593b1['where']=qs[_0x5f74('0x34')](_[_0x5f74('0x35')](_0x4e8770[_0x5f74('0x2b')],_0x45928a[_0x5f74('0x34')]),_0x29cefb);if(_0x4e8770[_0x5f74('0x2b')][_0x5f74('0x36')]){_0x1593b1[_0x5f74('0x37')]=_[_0x5f74('0x38')](_0x1593b1[_0x5f74('0x37')],{'$or':_['map'](_0x29cefb,function(_0x54c3b1){if(_0x54c3b1[_0x5f74('0x39')]!==_0x5f74('0x3a')){var _0x6cb3ab={};_0x6cb3ab[_0x54c3b1[_0x5f74('0x24')]]={'$like':'%'+_0x4e8770[_0x5f74('0x2b')][_0x5f74('0x36')]+'%'};return _0x6cb3ab;}})});}_0x1593b1=_[_0x5f74('0x38')]({},_0x1593b1,_0x4e8770['options']);var _0x2f634c={'where':_0x1593b1['where']};return db[_0x5f74('0x27')]['count'](_0x2f634c)[_0x5f74('0x22')](function(_0x5c4cfe){_0xc87c4b[_0x5f74('0x1f')]=_0x5c4cfe;if(_0x4e8770[_0x5f74('0x2b')]['includeAll']){_0x1593b1[_0x5f74('0x3b')]=[{'all':!![]}];}return db[_0x5f74('0x27')][_0x5f74('0x3c')](_0x1593b1);})['then'](function(_0x2a9fd4){_0xc87c4b[_0x5f74('0x3d')]=_0x2a9fd4;return _0xc87c4b;})[_0x5f74('0x22')](respondWithFilteredResult(_0x1eab55,_0x1593b1))[_0x5f74('0x3e')](handleError(_0x1eab55,null));};exports[_0x5f74('0x3f')]=function(_0x23d1fb,_0x43dc0c){var _0x3c9b41={'raw':!![],'where':{'id':_0x23d1fb['params']['id']}},_0x53d3e4={};_0x53d3e4[_0x5f74('0x2a')]=_[_0x5f74('0x2c')](db['SmsApplication'][_0x5f74('0x40')]);_0x53d3e4[_0x5f74('0x2b')]=_[_0x5f74('0x2c')](_0x23d1fb[_0x5f74('0x2b')]);_0x53d3e4[_0x5f74('0x34')]=_[_0x5f74('0x2d')](_0x53d3e4[_0x5f74('0x2a')],_0x53d3e4['query']);_0x3c9b41[_0x5f74('0x2e')]=_['intersection'](_0x53d3e4[_0x5f74('0x2a')],qs[_0x5f74('0x2f')](_0x23d1fb[_0x5f74('0x2b')][_0x5f74('0x2f')]));_0x3c9b41['attributes']=_0x3c9b41[_0x5f74('0x2e')][_0x5f74('0x30')]?_0x3c9b41[_0x5f74('0x2e')]:_0x53d3e4['model'];if(_0x23d1fb[_0x5f74('0x2b')]['includeAll']){_0x3c9b41[_0x5f74('0x3b')]=[{'all':!![]}];}_0x3c9b41=_[_0x5f74('0x38')]({},_0x3c9b41,_0x23d1fb[_0x5f74('0x41')]);return db['SmsApplication'][_0x5f74('0x42')](_0x3c9b41)[_0x5f74('0x22')](handleEntityNotFound(_0x43dc0c,null))[_0x5f74('0x22')](respondWithResult(_0x43dc0c,null))['catch'](handleError(_0x43dc0c,null));};exports[_0x5f74('0x43')]=function(_0x2014b7,_0x157d2a){return db[_0x5f74('0x27')][_0x5f74('0x43')](_0x2014b7['body'],{})[_0x5f74('0x22')](respondWithResult(_0x157d2a,0xc9))[_0x5f74('0x3e')](handleError(_0x157d2a,null));};exports['update']=function(_0x358f15,_0x5791b1){if(_0x358f15['body']['id']){delete _0x358f15[_0x5f74('0x44')]['id'];}return db[_0x5f74('0x27')]['find']({'where':{'id':_0x358f15[_0x5f74('0x45')]['id']}})['then'](handleEntityNotFound(_0x5791b1,null))[_0x5f74('0x22')](saveUpdates(_0x358f15['body'],null))[_0x5f74('0x22')](respondWithResult(_0x5791b1,null))[_0x5f74('0x3e')](handleError(_0x5791b1,null));};exports[_0x5f74('0x46')]=function(_0x4d0a91,_0x552fdc){return db[_0x5f74('0x27')]['find']({'where':{'id':_0x4d0a91[_0x5f74('0x45')]['id']}})[_0x5f74('0x22')](handleEntityNotFound(_0x552fdc,null))['then'](removeEntity(_0x552fdc,null))[_0x5f74('0x3e')](handleError(_0x552fdc,null));}; \ No newline at end of file +var _0xe627=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','SmsApplication','includeAll','rows','catch','show','params','include','find','create'];(function(_0xbd95e7,_0x25de09){var _0x79ff0d=function(_0x3c9c28){while(--_0x3c9c28){_0xbd95e7['push'](_0xbd95e7['shift']());}};_0x79ff0d(++_0x25de09);}(_0xe627,0xeb));var _0x7e62=function(_0x2a8c3e,_0x313d5f){_0x2a8c3e=_0x2a8c3e-0x0;var _0x4eb725=_0xe627[_0x2a8c3e];return _0x4eb725;};'use strict';var emlformat=require(_0x7e62('0x0'));var rimraf=require(_0x7e62('0x1'));var zipdir=require(_0x7e62('0x2'));var jsonpatch=require(_0x7e62('0x3'));var rp=require(_0x7e62('0x4'));var moment=require(_0x7e62('0x5'));var BPromise=require(_0x7e62('0x6'));var Mustache=require(_0x7e62('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7e62('0x8'));var ejs=require(_0x7e62('0x9'));var fs=require('fs');var fs_extra=require(_0x7e62('0xa'));var _=require(_0x7e62('0xb'));var squel=require(_0x7e62('0xc'));var crypto=require(_0x7e62('0xd'));var jsforce=require(_0x7e62('0xe'));var deskjs=require(_0x7e62('0xf'));var toCsv=require(_0x7e62('0x8'));var querystring=require(_0x7e62('0x10'));var Papa=require('papaparse');var Redis=require(_0x7e62('0x11'));var authService=require(_0x7e62('0x12'));var qs=require(_0x7e62('0x13'));var as=require(_0x7e62('0x14'));var hardwareService=require(_0x7e62('0x15'));var logger=require(_0x7e62('0x16'))('api');var utils=require(_0x7e62('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7e62('0x18'));var db=require(_0x7e62('0x19'))['db'];function respondWithStatusCode(_0x11f703,_0x89f9a1){_0x89f9a1=_0x89f9a1||0xcc;return function(_0x5a3a47){if(_0x5a3a47){return _0x11f703[_0x7e62('0x1a')](_0x89f9a1);}return _0x11f703[_0x7e62('0x1b')](_0x89f9a1)[_0x7e62('0x1c')]();};}function respondWithResult(_0x41a40c,_0x1861e4){_0x1861e4=_0x1861e4||0xc8;return function(_0x5569ef){if(_0x5569ef){return _0x41a40c[_0x7e62('0x1b')](_0x1861e4)[_0x7e62('0x1d')](_0x5569ef);}};}function respondWithFilteredResult(_0xa090e2,_0x45a8e2){return function(_0x4c173d){if(_0x4c173d){var _0x2582fd=typeof _0x45a8e2['offset']===_0x7e62('0x1e')&&typeof _0x45a8e2[_0x7e62('0x1f')]===_0x7e62('0x1e');var _0x319894=_0x4c173d[_0x7e62('0x20')];var _0x132b74=_0x2582fd?0x0:_0x45a8e2[_0x7e62('0x21')];var _0x1fff70=_0x2582fd?_0x4c173d['count']:_0x45a8e2[_0x7e62('0x21')]+_0x45a8e2['limit'];var _0x3eaece;if(_0x1fff70>=_0x319894){_0x1fff70=_0x319894;_0x3eaece=0xc8;}else{_0x3eaece=0xce;}_0xa090e2[_0x7e62('0x1b')](_0x3eaece);return _0xa090e2[_0x7e62('0x22')](_0x7e62('0x23'),_0x132b74+'-'+_0x1fff70+'/'+_0x319894)[_0x7e62('0x1d')](_0x4c173d);}return null;};}function patchUpdates(_0x37cd1f){return function(_0x306b2c){try{jsonpatch[_0x7e62('0x24')](_0x306b2c,_0x37cd1f,!![]);}catch(_0x2fd783){return BPromise['reject'](_0x2fd783);}return _0x306b2c[_0x7e62('0x25')]();};}function saveUpdates(_0x645444,_0x547129){return function(_0xd84930){if(_0xd84930){return _0xd84930[_0x7e62('0x26')](_0x645444)[_0x7e62('0x27')](function(_0x56eafd){return _0x56eafd;});}return null;};}function removeEntity(_0x26d2e6,_0x36d583){return function(_0x59e444){if(_0x59e444){return _0x59e444[_0x7e62('0x28')]()[_0x7e62('0x27')](function(){_0x26d2e6[_0x7e62('0x1b')](0xcc)[_0x7e62('0x1c')]();});}};}function handleEntityNotFound(_0x5553fa,_0xb9f35){return function(_0x3f44f6){if(!_0x3f44f6){_0x5553fa['sendStatus'](0x194);}return _0x3f44f6;};}function handleError(_0x9cb35e,_0x497053){_0x497053=_0x497053||0x1f4;return function(_0x12fd04){logger[_0x7e62('0x29')](_0x12fd04[_0x7e62('0x2a')]);if(_0x12fd04[_0x7e62('0x2b')]){delete _0x12fd04[_0x7e62('0x2b')];}_0x9cb35e[_0x7e62('0x1b')](_0x497053)[_0x7e62('0x2c')](_0x12fd04);};}exports[_0x7e62('0x2d')]=function(_0x12bd82,_0x9654ba){var _0x55b39d={},_0x17064a={},_0x2d4e68={'count':0x0,'rows':[]};var _0x1573d2=_['map'](db['SmsApplication'][_0x7e62('0x2e')],function(_0x964bd1){return{'name':_0x964bd1[_0x7e62('0x2f')],'type':_0x964bd1[_0x7e62('0x30')][_0x7e62('0x31')]};});_0x17064a['model']=_[_0x7e62('0x32')](_0x1573d2,_0x7e62('0x2b'));_0x17064a[_0x7e62('0x33')]=_[_0x7e62('0x34')](_0x12bd82[_0x7e62('0x33')]);_0x17064a[_0x7e62('0x35')]=_[_0x7e62('0x36')](_0x17064a[_0x7e62('0x37')],_0x17064a[_0x7e62('0x33')]);_0x55b39d[_0x7e62('0x38')]=_[_0x7e62('0x36')](_0x17064a[_0x7e62('0x37')],qs[_0x7e62('0x39')](_0x12bd82[_0x7e62('0x33')]['fields']));_0x55b39d['attributes']=_0x55b39d[_0x7e62('0x38')][_0x7e62('0x3a')]?_0x55b39d[_0x7e62('0x38')]:_0x17064a[_0x7e62('0x37')];if(!_0x12bd82[_0x7e62('0x33')][_0x7e62('0x3b')]('nolimit')){_0x55b39d['limit']=qs[_0x7e62('0x1f')](_0x12bd82[_0x7e62('0x33')]['limit']);_0x55b39d[_0x7e62('0x21')]=qs['offset'](_0x12bd82[_0x7e62('0x33')][_0x7e62('0x21')]);}_0x55b39d[_0x7e62('0x3c')]=qs[_0x7e62('0x3d')](_0x12bd82[_0x7e62('0x33')][_0x7e62('0x3d')]);_0x55b39d['where']=qs['filters'](_[_0x7e62('0x3e')](_0x12bd82[_0x7e62('0x33')],_0x17064a[_0x7e62('0x35')]),_0x1573d2);if(_0x12bd82['query'][_0x7e62('0x3f')]){_0x55b39d[_0x7e62('0x40')]=_[_0x7e62('0x41')](_0x55b39d[_0x7e62('0x40')],{'$or':_[_0x7e62('0x32')](_0x1573d2,function(_0x416dd9){if(_0x416dd9[_0x7e62('0x30')]!==_0x7e62('0x42')){var _0x1b1fe1={};_0x1b1fe1[_0x416dd9[_0x7e62('0x2b')]]={'$like':'%'+_0x12bd82[_0x7e62('0x33')][_0x7e62('0x3f')]+'%'};return _0x1b1fe1;}})});}_0x55b39d=_[_0x7e62('0x41')]({},_0x55b39d,_0x12bd82[_0x7e62('0x43')]);var _0x2c3669={'where':_0x55b39d[_0x7e62('0x40')]};return db[_0x7e62('0x44')][_0x7e62('0x20')](_0x2c3669)['then'](function(_0x37c155){_0x2d4e68[_0x7e62('0x20')]=_0x37c155;if(_0x12bd82[_0x7e62('0x33')][_0x7e62('0x45')]){_0x55b39d['include']=[{'all':!![]}];}return db[_0x7e62('0x44')]['findAll'](_0x55b39d);})[_0x7e62('0x27')](function(_0x40f8ed){_0x2d4e68[_0x7e62('0x46')]=_0x40f8ed;return _0x2d4e68;})[_0x7e62('0x27')](respondWithFilteredResult(_0x9654ba,_0x55b39d))[_0x7e62('0x47')](handleError(_0x9654ba,null));};exports[_0x7e62('0x48')]=function(_0x4ff06b,_0x435305){var _0x480f72={'raw':!![],'where':{'id':_0x4ff06b[_0x7e62('0x49')]['id']}},_0x2ed7e6={};_0x2ed7e6[_0x7e62('0x37')]=_[_0x7e62('0x34')](db['SmsApplication'][_0x7e62('0x2e')]);_0x2ed7e6['query']=_['keys'](_0x4ff06b[_0x7e62('0x33')]);_0x2ed7e6[_0x7e62('0x35')]=_['intersection'](_0x2ed7e6[_0x7e62('0x37')],_0x2ed7e6['query']);_0x480f72['attributes']=_[_0x7e62('0x36')](_0x2ed7e6[_0x7e62('0x37')],qs[_0x7e62('0x39')](_0x4ff06b['query'][_0x7e62('0x39')]));_0x480f72[_0x7e62('0x38')]=_0x480f72[_0x7e62('0x38')][_0x7e62('0x3a')]?_0x480f72[_0x7e62('0x38')]:_0x2ed7e6[_0x7e62('0x37')];if(_0x4ff06b[_0x7e62('0x33')]['includeAll']){_0x480f72[_0x7e62('0x4a')]=[{'all':!![]}];}_0x480f72=_[_0x7e62('0x41')]({},_0x480f72,_0x4ff06b[_0x7e62('0x43')]);return db[_0x7e62('0x44')][_0x7e62('0x4b')](_0x480f72)['then'](handleEntityNotFound(_0x435305,null))[_0x7e62('0x27')](respondWithResult(_0x435305,null))[_0x7e62('0x47')](handleError(_0x435305,null));};exports[_0x7e62('0x4c')]=function(_0x4425e8,_0x16f047){return db['SmsApplication'][_0x7e62('0x4c')](_0x4425e8[_0x7e62('0x4d')],{})[_0x7e62('0x27')](respondWithResult(_0x16f047,0xc9))[_0x7e62('0x47')](handleError(_0x16f047,null));};exports[_0x7e62('0x26')]=function(_0x57a7c9,_0x141ec8){if(_0x57a7c9['body']['id']){delete _0x57a7c9[_0x7e62('0x4d')]['id'];}return db[_0x7e62('0x44')][_0x7e62('0x4b')]({'where':{'id':_0x57a7c9[_0x7e62('0x49')]['id']}})[_0x7e62('0x27')](handleEntityNotFound(_0x141ec8,null))[_0x7e62('0x27')](saveUpdates(_0x57a7c9[_0x7e62('0x4d')],null))[_0x7e62('0x27')](respondWithResult(_0x141ec8,null))[_0x7e62('0x47')](handleError(_0x141ec8,null));};exports[_0x7e62('0x28')]=function(_0x12ad06,_0x2238f2){return db[_0x7e62('0x44')]['find']({'where':{'id':_0x12ad06[_0x7e62('0x49')]['id']}})[_0x7e62('0x27')](handleEntityNotFound(_0x2238f2,null))[_0x7e62('0x27')](removeEntity(_0x2238f2,null))[_0x7e62('0x47')](handleError(_0x2238f2,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 6f7861c..d6f5c68 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 _0x3cbd=['moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x15e0d2,_0x8333c){var _0x45bb73=function(_0x52cb41){while(--_0x52cb41){_0x15e0d2['push'](_0x15e0d2['shift']());}};_0x45bb73(++_0x8333c);}(_0x3cbd,0x184));var _0xd3cb=function(_0x42d645,_0x61c13f){_0x42d645=_0x42d645-0x0;var _0x448a1=_0x3cbd[_0x42d645];return _0x448a1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd3cb('0x0'))(_0xd3cb('0x1'));var moment=require(_0xd3cb('0x2'));var BPromise=require(_0xd3cb('0x3'));var rp=require(_0xd3cb('0x4'));var fs=require('fs');var path=require(_0xd3cb('0x5'));var rimraf=require(_0xd3cb('0x6'));var config=require('../../config/environment');var attributes=require(_0xd3cb('0x7'));module[_0xd3cb('0x8')]=function(_0x2fe7da,_0x252dc0){return _0x2fe7da[_0xd3cb('0x9')](_0xd3cb('0xa'),attributes,{'tableName':_0xd3cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd3cb('0xc')});}; \ No newline at end of file +var _0xd7b9=['exports','define','SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5c8a11,_0x10805f){var _0x116b22=function(_0x10a697){while(--_0x10a697){_0x5c8a11['push'](_0x5c8a11['shift']());}};_0x116b22(++_0x10805f);}(_0xd7b9,0x11d));var _0x9d7b=function(_0x338491,_0x25f9f9){_0x338491=_0x338491-0x0;var _0x4bf6fc=_0xd7b9[_0x338491];return _0x4bf6fc;};'use strict';var _=require(_0x9d7b('0x0'));var util=require(_0x9d7b('0x1'));var logger=require(_0x9d7b('0x2'))(_0x9d7b('0x3'));var moment=require(_0x9d7b('0x4'));var BPromise=require(_0x9d7b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d7b('0x6'));var rimraf=require(_0x9d7b('0x7'));var config=require(_0x9d7b('0x8'));var attributes=require('./smsApplication.attributes');module[_0x9d7b('0x9')]=function(_0x1d6346,_0x51c420){return _0x1d6346[_0x9d7b('0xa')](_0x9d7b('0xb'),attributes,{'tableName':_0x9d7b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9d7b('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 222a4f5..c9c02b1 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 _0x79d7=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79d7,0x9c));var _0x779d=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x79d7[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x779d('0x0'));var util=require('util');var moment=require(_0x779d('0x1'));var BPromise=require(_0x779d('0x2'));var rs=require(_0x779d('0x3'));var fs=require('fs');var Redis=require(_0x779d('0x4'));var db=require(_0x779d('0x5'))['db'];var utils=require(_0x779d('0x6'));var logger=require('../../config/logger')(_0x779d('0x7'));var config=require(_0x779d('0x8'));var jayson=require(_0x779d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x227c87,_0x4c7fb4,_0xc067dd){return new BPromise(function(_0x2f83f6,_0x4c7c92){return client['request'](_0x227c87,_0xc067dd)['then'](function(_0x5b4ef2){logger[_0x779d('0xa')](_0x779d('0xb'),_0x4c7fb4,_0x779d('0xc'));logger['debug'](_0x779d('0xd'),_0x4c7fb4,'request\x20sent',JSON[_0x779d('0xe')](_0x5b4ef2));if(_0x5b4ef2['error']){if(_0x5b4ef2[_0x779d('0xf')][_0x779d('0x10')]===0x1f4){logger[_0x779d('0xf')]('SmsApplication,\x20%s,\x20%s',_0x4c7fb4,_0x5b4ef2[_0x779d('0xf')][_0x779d('0x11')]);return _0x4c7c92(_0x5b4ef2[_0x779d('0xf')][_0x779d('0x11')]);}logger[_0x779d('0xf')](_0x779d('0xb'),_0x4c7fb4,_0x5b4ef2['error'][_0x779d('0x11')]);return _0x2f83f6(_0x5b4ef2[_0x779d('0xf')][_0x779d('0x11')]);}else{logger[_0x779d('0xa')](_0x779d('0xb'),_0x4c7fb4,'request\x20sent');_0x2f83f6(_0x5b4ef2[_0x779d('0x12')][_0x779d('0x11')]);}})[_0x779d('0x13')](function(_0x4cc248){logger[_0x779d('0xf')](_0x779d('0xb'),_0x4c7fb4,_0x4cc248);_0x4c7c92(_0x4cc248);});});} \ No newline at end of file +var _0x6017=['rpc','client','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x437f8f,_0x1d5b2b){var _0x45390e=function(_0x1cc917){while(--_0x1cc917){_0x437f8f['push'](_0x437f8f['shift']());}};_0x45390e(++_0x1d5b2b);}(_0x6017,0xae));var _0x7601=function(_0x1bd2c4,_0x4359d1){_0x1bd2c4=_0x1bd2c4-0x0;var _0x4ca1a8=_0x6017[_0x1bd2c4];return _0x4ca1a8;};'use strict';var _=require(_0x7601('0x0'));var util=require(_0x7601('0x1'));var moment=require(_0x7601('0x2'));var BPromise=require('bluebird');var rs=require(_0x7601('0x3'));var fs=require('fs');var Redis=require(_0x7601('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7601('0x5'));var logger=require('../../config/logger')(_0x7601('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7601('0x7')][_0x7601('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcb5ed9,_0x34a36d,_0x2bc643){return new BPromise(function(_0xe6e524,_0x4ff3e4){return client[_0x7601('0x9')](_0xcb5ed9,_0x2bc643)[_0x7601('0xa')](function(_0xd3a338){logger['info'](_0x7601('0xb'),_0x34a36d,_0x7601('0xc'));logger[_0x7601('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x34a36d,_0x7601('0xc'),JSON[_0x7601('0xe')](_0xd3a338));if(_0xd3a338[_0x7601('0xf')]){if(_0xd3a338[_0x7601('0xf')][_0x7601('0x10')]===0x1f4){logger[_0x7601('0xf')](_0x7601('0xb'),_0x34a36d,_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);return _0x4ff3e4(_0xd3a338[_0x7601('0xf')]['message']);}logger[_0x7601('0xf')]('SmsApplication,\x20%s,\x20%s',_0x34a36d,_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);return _0xe6e524(_0xd3a338[_0x7601('0xf')][_0x7601('0x11')]);}else{logger[_0x7601('0x12')](_0x7601('0xb'),_0x34a36d,_0x7601('0xc'));_0xe6e524(_0xd3a338[_0x7601('0x13')][_0x7601('0x11')]);}})['catch'](function(_0xa0e556){logger[_0x7601('0xf')]('SmsApplication,\x20%s,\x20%s',_0x34a36d,_0xa0e556);_0x4ff3e4(_0xa0e556);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index b2afd35..4766579 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 _0x6e6c=['create','addMessage','tracked','sms','smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x4ffbc3,_0x51ea74){var _0x2d4b85=function(_0x1bdcd6){while(--_0x1bdcd6){_0x4ffbc3['push'](_0x4ffbc3['shift']());}};_0x2d4b85(++_0x51ea74);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./smsInteraction.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0x6')]('/:id',auth[_0xc6e6('0x7')](),controller['show']);router[_0xc6e6('0x6')](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xb')]);router[_0xc6e6('0x6')](_0xc6e6('0xc'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xd')]);router[_0xc6e6('0xe')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xf')]);router['post'](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x10')]);router[_0xc6e6('0xe')]('/:id/tags',auth[_0xc6e6('0x7')](),interaction[_0xc6e6('0x11')](_0xc6e6('0x12'),_0xc6e6('0x13')),controller[_0xc6e6('0x14')]);router['put'](_0xc6e6('0x15'),auth[_0xc6e6('0x7')](),interaction['tracked'](_0xc6e6('0x12'),_0xc6e6('0x16')),controller[_0xc6e6('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xc6e6('0x11')]('sms',_0xc6e6('0x18')),controller[_0xc6e6('0x19')]);router[_0xc6e6('0x1a')](_0xc6e6('0x1b'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x1c')]);module[_0xc6e6('0x1d')]=router; \ No newline at end of file +var _0x3423=['/:id','/:id/messages','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','delete','smsinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['show']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/download',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['post']('/',auth[_0x3342('0xa')](),controller['create']);router[_0x3342('0x11')](_0x3342('0xf'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x11')](_0x3342('0x13'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x16')),controller['addTags']);router[_0x3342('0x17')](_0x3342('0xe'),auth['isAuthenticated'](),interaction[_0x3342('0x14')](_0x3342('0x15'),'smsinteraction:update'),controller['update']);router[_0x3342('0x18')](_0x3342('0xe'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x19')),controller[_0x3342('0x1a')]);router[_0x3342('0x18')](_0x3342('0x13'),auth['isAuthenticated'](),controller[_0x3342('0x1b')]);module[_0x3342('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 550853c..f60bc6c 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 _0x6829=['ENUM','out','BOOLEAN','sequelize','moment','STRING','DATE'];(function(_0x363848,_0x46a12b){var _0x38e6ef=function(_0x15ab7e){while(--_0x15ab7e){_0x363848['push'](_0x363848['shift']());}};_0x38e6ef(++_0x46a12b);}(_0x6829,0x14c));var _0x9682=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x6829[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0x9682('0x0'));var moment=require(_0x9682('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9682('0x2')]},'secondDisposition':{'type':Sequelize[_0x9682('0x2')]},'thirdDisposition':{'type':Sequelize[_0x9682('0x2')]},'note':{'type':Sequelize[_0x9682('0x2')]},'phone':{'type':Sequelize[_0x9682('0x2')]},'read1stAt':{'type':Sequelize[_0x9682('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9682('0x4')]('in',_0x9682('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9682('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9682('0x4')]('in',_0x9682('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9682('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa908=['out','BOOLEAN','INTEGER','sequelize','exports','DATE','STRING','ENUM'];(function(_0x478f5a,_0x272c62){var _0x4e15d7=function(_0x157556){while(--_0x157556){_0x478f5a['push'](_0x478f5a['shift']());}};_0x4e15d7(++_0x272c62);}(_0xa908,0x1c3));var _0x8a90=function(_0x469393,_0x247969){_0x469393=_0x469393-0x0;var _0x5f720d=_0xa908[_0x469393];return _0x5f720d;};'use strict';var Sequelize=require(_0x8a90('0x0'));var moment=require('moment');module[_0x8a90('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8a90('0x2')]},'disposition':{'type':Sequelize[_0x8a90('0x3')]},'secondDisposition':{'type':Sequelize[_0x8a90('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8a90('0x3')]},'note':{'type':Sequelize[_0x8a90('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x8a90('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x8a90('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8a90('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8a90('0x4')]('in',_0x8a90('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8a90('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8a90('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 0e1982e..ffb0dd8 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 _0x36c3=['SmsMessage','addMessage','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','addTags','setTags','ids','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','User','fullname','push','CmContact','Contact','firstName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','closed','closedAt','out','System','lastName','value','server','views','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','bluebird','util','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','update','destroy','then','error','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','describe'];(function(_0x53ff8,_0x23e2f9){var _0x212442=function(_0xcb6971){while(--_0xcb6971){_0x53ff8['push'](_0x53ff8['shift']());}};_0x212442(++_0x23e2f9);}(_0x36c3,0x132));var _0x336c=function(_0x12ae97,_0x385f36){_0x12ae97=_0x12ae97-0x0;var _0xb50847=_0x36c3[_0x12ae97];return _0xb50847;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x336c('0x0'));var moment=require(_0x336c('0x1'));var BPromise=require(_0x336c('0x2'));var util=require(_0x336c('0x3'));var path=require('path');var ejs=require(_0x336c('0x4'));var fs=require('fs');var _=require(_0x336c('0x5'));var Redis=require('ioredis');var interaction=require(_0x336c('0x6'));var qs=require(_0x336c('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x336c('0x8'))(_0x336c('0x9'));var config=require(_0x336c('0xa'));var db=require(_0x336c('0xb'))['db'];config[_0x336c('0xc')]=_[_0x336c('0xd')](config[_0x336c('0xc')],{'host':_0x336c('0xe'),'port':0x18eb});var socket=require(_0x336c('0xf'))(new Redis(config['redis']));require(_0x336c('0x10'))[_0x336c('0x11')](socket);function respondWithStatusCode(_0x5e7b4f,_0x2965a3){_0x2965a3=_0x2965a3||0xcc;return function(_0x2d58cf){if(_0x2d58cf){return _0x5e7b4f[_0x336c('0x12')](_0x2965a3);}return _0x5e7b4f[_0x336c('0x13')](_0x2965a3)[_0x336c('0x14')]();};}function respondWithResult(_0x379b03,_0x2ce64b){_0x2ce64b=_0x2ce64b||0xc8;return function(_0x4110a4){if(_0x4110a4){return _0x379b03['status'](_0x2ce64b)[_0x336c('0x15')](_0x4110a4);}};}function respondWithFilteredResult(_0x39f82d,_0x320427){return function(_0x402e52){if(_0x402e52){var _0x13e96a=typeof _0x320427[_0x336c('0x16')]===_0x336c('0x17')&&typeof _0x320427['limit']===_0x336c('0x17');var _0x114ef7=_0x402e52[_0x336c('0x18')];var _0x1089d6=_0x13e96a?0x0:_0x320427[_0x336c('0x16')];var _0x3dbc86=_0x13e96a?_0x402e52[_0x336c('0x18')]:_0x320427['offset']+_0x320427[_0x336c('0x19')];var _0x572e99;if(_0x3dbc86>=_0x114ef7){_0x3dbc86=_0x114ef7;_0x572e99=0xc8;}else{_0x572e99=0xce;}_0x39f82d[_0x336c('0x13')](_0x572e99);return _0x39f82d[_0x336c('0x1a')]('Content-Range',_0x1089d6+'-'+_0x3dbc86+'/'+_0x114ef7)[_0x336c('0x15')](_0x402e52);}return null;};}function saveUpdates(_0x35bc32){return function(_0x595ba8){if(_0x595ba8){return _0x595ba8[_0x336c('0x1b')](_0x35bc32)['then'](function(_0x1f48af){return _0x1f48af;});}return null;};}function removeEntity(_0x56b971){return function(_0x19843e){if(_0x19843e){return _0x19843e[_0x336c('0x1c')]()[_0x336c('0x1d')](function(){_0x56b971[_0x336c('0x13')](0xcc)[_0x336c('0x14')]();});}};}function handleEntityNotFound(_0x3d5981){return function(_0xf1d6e8){if(!_0xf1d6e8){_0x3d5981[_0x336c('0x12')](0x194);}return _0xf1d6e8;};}function handleError(_0x597567,_0x50945e){_0x50945e=_0x50945e||0x1f4;return function(_0x11759d){logger[_0x336c('0x1e')](_0x11759d[_0x336c('0x1f')]);if(_0x11759d[_0x336c('0x20')]){delete _0x11759d[_0x336c('0x20')];}_0x597567['status'](_0x50945e)[_0x336c('0x21')](_0x11759d);};}exports[_0x336c('0x22')]=function(_0x33c083,_0x127792){var _0x3fb9d8={};var _0x3f5ca8=_['map'](db[_0x336c('0x23')][_0x336c('0x24')],function(_0x3ac93f){return{'name':_0x3ac93f[_0x336c('0x25')],'type':_0x3ac93f[_0x336c('0x26')][_0x336c('0x27')]};});_0x3fb9d8=qs[_0x336c('0x28')](_0x3f5ca8,_0x33c083);return interaction[_0x336c('0x29')](_0x336c('0x2a'),_0x33c083[_0x336c('0x2b')],_0x33c083['user'],_0x3fb9d8,_0x3f5ca8)[_0x336c('0x1d')](respondWithFilteredResult(_0x127792,_0x3fb9d8))[_0x336c('0x2c')](handleError(_0x127792,null));};exports[_0x336c('0x2d')]=function(_0x2c4c7d,_0x466fe7){var _0x1ba26e={'raw':![],'where':{'id':_0x2c4c7d[_0x336c('0x2e')]['id']}},_0x556e7c={};_0x556e7c[_0x336c('0x2f')]=_[_0x336c('0x30')](db[_0x336c('0x23')][_0x336c('0x24')]);_0x556e7c[_0x336c('0x2b')]=_['keys'](_0x2c4c7d[_0x336c('0x2b')]);_0x556e7c[_0x336c('0x31')]=_[_0x336c('0x32')](_0x556e7c[_0x336c('0x2f')],_0x556e7c['query']);_0x1ba26e[_0x336c('0x33')]=_[_0x336c('0x32')](_0x556e7c[_0x336c('0x2f')],qs[_0x336c('0x34')](_0x2c4c7d[_0x336c('0x2b')]['fields']));_0x1ba26e['attributes']=_0x1ba26e[_0x336c('0x33')][_0x336c('0x35')]?_0x1ba26e['attributes']:_0x556e7c[_0x336c('0x2f')];if(_0x2c4c7d[_0x336c('0x2b')][_0x336c('0x36')]){_0x1ba26e['include']=[{'all':!![]}];}_0x1ba26e=_[_0x336c('0x37')]({},_0x1ba26e,_0x2c4c7d['options']);return db[_0x336c('0x23')][_0x336c('0x38')](_0x1ba26e)[_0x336c('0x1d')](handleEntityNotFound(_0x466fe7,null))['then'](respondWithResult(_0x466fe7,null))[_0x336c('0x2c')](handleError(_0x466fe7,null));};exports['create']=function(_0x1e2b8b,_0x53f4d4){return db[_0x336c('0x23')][_0x336c('0x39')](_0x1e2b8b[_0x336c('0x3a')],{})[_0x336c('0x1d')](respondWithResult(_0x53f4d4,0xc9))[_0x336c('0x2c')](handleError(_0x53f4d4,null));};exports[_0x336c('0x1b')]=function(_0x3f7e5a,_0x4c895b){if(_0x3f7e5a[_0x336c('0x3a')]['id']){delete _0x3f7e5a[_0x336c('0x3a')]['id'];}return db[_0x336c('0x23')][_0x336c('0x38')]({'where':{'id':_0x3f7e5a[_0x336c('0x2e')]['id']}})[_0x336c('0x1d')](handleEntityNotFound(_0x4c895b,null))[_0x336c('0x1d')](saveUpdates(_0x3f7e5a['body'],null))[_0x336c('0x1d')](respondWithResult(_0x4c895b,null))['catch'](handleError(_0x4c895b,null));};exports[_0x336c('0x1c')]=function(_0x426005,_0x50718b){return db[_0x336c('0x23')][_0x336c('0x38')]({'where':{'id':_0x426005[_0x336c('0x2e')]['id']}})[_0x336c('0x1d')](handleEntityNotFound(_0x50718b,null))[_0x336c('0x1d')](removeEntity(_0x50718b,null))[_0x336c('0x2c')](handleError(_0x50718b,null));};exports['describe']=function(_0x3b046a,_0x442c4d){return db[_0x336c('0x23')][_0x336c('0x3b')]()['then'](respondWithResult(_0x442c4d,null))[_0x336c('0x2c')](handleError(_0x442c4d,null));};exports['addMessage']=function(_0x5dea1f,_0x147201){return db[_0x336c('0x3c')][_0x336c('0x38')]({'where':{'id':_0x5dea1f[_0x336c('0x2e')]['id']}})[_0x336c('0x1d')](handleEntityNotFound(_0x147201,null))[_0x336c('0x1d')](function(_0x427d88){if(_0x427d88){return _0x427d88[_0x336c('0x3d')](_0x5dea1f['body']['ids'],_[_0x336c('0x3e')](_0x5dea1f['body'],['ids','id'])||{});}})[_0x336c('0x1d')](respondWithResult(_0x147201,null))[_0x336c('0x2c')](handleError(_0x147201,null));};exports[_0x336c('0x3f')]=function(_0x4b0019,_0x53522b){var _0x571678={'raw':![],'where':{}};var _0x168b83={};var _0x40ca4d={'count':0x0,'rows':[]};return db[_0x336c('0x23')]['findOne']({'where':{'id':_0x4b0019['params']['id']}})['then'](handleEntityNotFound(_0x53522b,null))['then'](function(_0x1f5932){if(_0x1f5932){_0x168b83[_0x336c('0x2f')]=_['keys'](db['SmsMessage']['rawAttributes']);_0x168b83[_0x336c('0x2b')]=_[_0x336c('0x30')](_0x4b0019[_0x336c('0x2b')]);_0x168b83[_0x336c('0x31')]=_[_0x336c('0x32')](_0x168b83[_0x336c('0x2f')],_0x168b83[_0x336c('0x2b')]);_0x571678[_0x336c('0x33')]=_[_0x336c('0x32')](_0x168b83[_0x336c('0x2f')],qs[_0x336c('0x34')](_0x4b0019[_0x336c('0x2b')][_0x336c('0x34')]));_0x571678[_0x336c('0x33')]=_0x571678[_0x336c('0x33')][_0x336c('0x35')]?_0x571678[_0x336c('0x33')]:_0x168b83[_0x336c('0x2f')];if(!_0x4b0019[_0x336c('0x2b')][_0x336c('0x40')](_0x336c('0x41'))){_0x571678['limit']=qs[_0x336c('0x19')](_0x4b0019[_0x336c('0x2b')][_0x336c('0x19')]);_0x571678['offset']=qs['offset'](_0x4b0019['query'][_0x336c('0x16')]);}_0x571678[_0x336c('0x42')]=qs[_0x336c('0x43')](_0x4b0019['query'][_0x336c('0x43')]);_0x571678[_0x336c('0x44')]=qs[_0x336c('0x31')](_['pick'](_0x4b0019[_0x336c('0x2b')],_0x168b83[_0x336c('0x31')]));_0x571678[_0x336c('0x44')][_0x336c('0x45')]=_0x1f5932['id'];if(_0x4b0019[_0x336c('0x2b')]['filter']){_0x571678[_0x336c('0x44')]=_[_0x336c('0x37')](_0x571678[_0x336c('0x44')],{'$or':_['map'](_0x571678[_0x336c('0x33')],function(_0x1f6db8){var _0x1ce07b={};_0x1ce07b[_0x1f6db8]={'$like':'%'+_0x4b0019[_0x336c('0x2b')][_0x336c('0x46')]+'%'};return _0x1ce07b;})});}if(_0x4b0019['query']['$gte']){var _0x549fc4=_0x4b0019[_0x336c('0x2b')][_0x336c('0x47')][_0x336c('0x48')](',');var _0x2f403d={};_0x2f403d[_0x549fc4[0x0]]={'$gte':moment(_0x549fc4[0x1])[_0x336c('0x49')](_0x336c('0x4a'))};_0x571678[_0x336c('0x44')]=_[_0x336c('0x37')](_0x571678[_0x336c('0x44')],_0x2f403d);}_0x571678=_['merge']({},_0x571678,_0x4b0019[_0x336c('0x4b')]);return db[_0x336c('0x3c')][_0x336c('0x18')]({'where':_0x571678[_0x336c('0x44')]})[_0x336c('0x1d')](function(_0x150cfb){_0x40ca4d[_0x336c('0x18')]=_0x150cfb;if(_0x4b0019[_0x336c('0x2b')]['includeAll']){_0x571678[_0x336c('0x4c')]=[{'all':!![]}];}return db[_0x336c('0x3c')][_0x336c('0x29')](_0x571678);})['then'](function(_0x1f3016){_0x40ca4d[_0x336c('0x4d')]=_0x1f3016;return _0x40ca4d;});}})[_0x336c('0x1d')](respondWithFilteredResult(_0x53522b,_0x571678))['catch'](handleError(_0x53522b,null));};exports[_0x336c('0x4e')]=function(_0x1d8a6c,_0x17078d){return db[_0x336c('0x23')][_0x336c('0x38')]({'where':{'id':_0x1d8a6c['params']['id']}})[_0x336c('0x1d')](handleEntityNotFound(_0x17078d,null))['then'](function(_0x2adf6d){if(_0x2adf6d){return _0x2adf6d[_0x336c('0x4f')](_0x1d8a6c['body'][_0x336c('0x50')],_['omit'](_0x1d8a6c[_0x336c('0x3a')],[_0x336c('0x50'),'id'])||{})[_0x336c('0x51')](function(){return db[_0x336c('0x52')][_0x336c('0x29')]({'attributes':['id',_0x336c('0x20'),'color'],'where':{'id':_0x1d8a6c[_0x336c('0x3a')][_0x336c('0x50')]}});})[_0x336c('0x1d')](function(_0xc0d554){socket[_0x336c('0x53')](_0x336c('0x54'),{'id':Number(_0x1d8a6c[_0x336c('0x2e')]['id']),'tags':_0xc0d554||[]});return{'id':Number(_0x1d8a6c[_0x336c('0x2e')]['id']),'tags':_0xc0d554||[]};});}})[_0x336c('0x1d')](respondWithResult(_0x17078d,null))[_0x336c('0x2c')](handleError(_0x17078d,null));};exports[_0x336c('0x55')]=function(_0x5dfa49,_0x18b28c){return db[_0x336c('0x23')][_0x336c('0x38')]({'where':{'id':_0x5dfa49[_0x336c('0x2e')]['id']}})['then'](handleEntityNotFound(_0x18b28c,null))[_0x336c('0x1d')](function(_0x19fccf){if(_0x19fccf){return _0x19fccf[_0x336c('0x55')](_0x5dfa49[_0x336c('0x2b')]['ids']);}})[_0x336c('0x1d')](respondWithStatusCode(_0x18b28c,null))[_0x336c('0x2c')](handleError(_0x18b28c,null));};exports[_0x336c('0x56')]=function(_0x537de5,_0x486aa5){var _0x3e7885=moment()[_0x336c('0x57')]()[_0x336c('0x58')]();var _0x4a7edf=path[_0x336c('0x59')](config[_0x336c('0x5a')],'server',_0x336c('0x5b'),_0x336c('0x5c'));var _0x4191e7=path['join'](_0x4a7edf,_0x3e7885);var _0x3fd449=util['format']('transcript-%d-%s.zip',_0x537de5[_0x336c('0x2e')]['id'],_0x3e7885);var _0x76a03f=path['join'](_0x4a7edf,_0x3fd449);var _0x39c675=[];_0x39c675['push']({'model':db[_0x336c('0x5d')],'as':_0x336c('0x5d'),'attributes':['id',_0x336c('0x5e')],'raw':!![]});_0x39c675[_0x336c('0x5f')]({'model':db[_0x336c('0x60')],'as':_0x336c('0x61'),'attributes':['id',_0x336c('0x62'),'lastName'],'raw':!![]});var _0x4a57e9=[{'model':db[_0x336c('0x3c')],'as':_0x336c('0x63'),'attributes':['id','body',_0x336c('0x64'),_0x336c('0x65'),_0x336c('0x66'),_0x336c('0x67')],'include':_0x39c675}];_0x4a57e9[_0x336c('0x5f')]({'model':db[_0x336c('0x68')],'as':_0x336c('0x69'),'attributes':['id',_0x336c('0x20')]});_0x4a57e9[_0x336c('0x5f')]({'model':db[_0x336c('0x5d')],'as':_0x336c('0x6a'),'attributes':['id',_0x336c('0x5e')]});return db[_0x336c('0x23')][_0x336c('0x38')]({'where':{'id':_0x537de5['params']['id']},'include':_0x4a57e9})[_0x336c('0x1d')](handleEntityNotFound(_0x486aa5,null))['then'](function(_0x5f0461){if(_0x5f0461){var _0x4d796e=_0x5f0461['get']({'plain':!![]});fs[_0x336c('0x6b')](_0x4191e7);var _0xef4e87={'channel':_0x336c('0x6c'),'account':_0x4d796e[_0x336c('0x69')][_0x336c('0x20')],'agent':_0x4d796e[_0x336c('0x6a')]?_0x4d796e[_0x336c('0x6a')][_0x336c('0x5e')]:_0x336c('0x6d'),'createdAt':moment(_0x4d796e['createdAt'])[_0x336c('0x49')](_0x336c('0x4a'))[_0x336c('0x58')](),'closedAt':_0x4d796e[_0x336c('0x6e')]?moment(_0x4d796e[_0x336c('0x6f')])['format'](_0x336c('0x4a'))['toString']():'','disposition':_0x4d796e['disposition'],'messages':_(_0x4d796e[_0x336c('0x63')])[_0x336c('0x46')]({'secret':![]})['map'](function(_0x319a15){return{'date':moment(_0x319a15['createdAt'])[_0x336c('0x49')](_0x336c('0x4a'))[_0x336c('0x58')](),'sender':_0x319a15[_0x336c('0x65')]===_0x336c('0x70')?_0x319a15[_0x336c('0x5d')]?_0x319a15[_0x336c('0x5d')][_0x336c('0x5e')]:_0x336c('0x71'):_0x319a15[_0x336c('0x61')][_0x336c('0x62')]+(_0x319a15['Contact'][_0x336c('0x72')]?'\x20'+_0x319a15['Contact'][_0x336c('0x72')]:''),'body':_0x319a15[_0x336c('0x3a')],'direction':_0x319a15[_0x336c('0x65')]==='out'?'A':'C','secret':_0x319a15['secret'],'read':_0x319a15[_0x336c('0x67')]};})[_0x336c('0x73')]()};return ejs['renderFile'](path[_0x336c('0x59')](config['root'],_0x336c('0x74'),_0x336c('0x75'),'downloadInteraction.ejs'),{'interaction':_0xef4e87})[_0x336c('0x1d')](function(_0x12279e){var _0x5aab6b=path[_0x336c('0x59')](_0x4191e7,'transcript-'+_0x4d796e['id']+'-'+_0x3e7885+'.pdf');var _0x1170c5={'path':_0x5aab6b,'channel':_0x336c('0x6c'),'interactionId':_0x4d796e['id']};return pdf[_0x336c('0x76')](_0x12279e,_0x1170c5);})[_0x336c('0x1d')](function(){return new BPromise(function(_0x15de48,_0x574f93){zipdir(_0x4191e7,{'saveTo':_0x76a03f},function(_0x1f9816,_0x4d9f7b){if(_0x1f9816)return _0x574f93(_0x1f9816);return _0x15de48(_0x4d9f7b);});})[_0x336c('0x1d')](function(){return new BPromise(function(_0x3cbe8f,_0x3c6aec){rimraf(_0x4191e7,function(_0x34d7f9){if(_0x34d7f9)_0x3c6aec(_0x34d7f9);return _0x3cbe8f();});});})['then'](function(){return _0x486aa5['download'](_0x76a03f,_0x3fd449,function(_0x2bfef2){if(_0x2bfef2){console[_0x336c('0x77')](_0x336c('0x78'),_0x2bfef2);}else{fs[_0x336c('0x79')](_0x76a03f);}});});});}else{return _0x486aa5[_0x336c('0x12')](0xc8);}})[_0x336c('0x2c')](handleError(_0x486aa5,null));}; \ No newline at end of file +var _0xf03b=['YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','spread','Tag','name','color','emit','removeTags','download','toString','join','root','server','files','User','push','CmContact','Contact','firstName','lastName','Messages','direction','secret','read','SmsAccount','Owner','fullname','get','mkdirSync','Sms','Account','createdAt','closed','closedAt','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','update','then','destroy','stack','send','index','map','rawAttributes','fieldName','type','key','getOptions','query','user','catch','show','model','keys','SmsInteraction','filters','intersection','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','SmsMessage','params','ids','omit','getMessages','findOne','attributes','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','format'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0xf03b,0x19f));var _0xbf03=function(_0xf36a0d,_0x3b603f){_0xf36a0d=_0xf36a0d-0x0;var _0x2da0e7=_0xf03b[_0xf36a0d];return _0x2da0e7;};'use strict';var rimraf=require(_0xbf03('0x0'));var zipdir=require(_0xbf03('0x1'));var moment=require(_0xbf03('0x2'));var BPromise=require(_0xbf03('0x3'));var util=require('util');var path=require(_0xbf03('0x4'));var ejs=require(_0xbf03('0x5'));var fs=require('fs');var _=require(_0xbf03('0x6'));var Redis=require(_0xbf03('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0xbf03('0x8'));var pdf=require(_0xbf03('0x9'));var logger=require(_0xbf03('0xa'))(_0xbf03('0xb'));var config=require(_0xbf03('0xc'));var db=require(_0xbf03('0xd'))['db'];config[_0xbf03('0xe')]=_[_0xbf03('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbf03('0x10'))(new Redis(config[_0xbf03('0xe')]));require(_0xbf03('0x11'))[_0xbf03('0x12')](socket);function respondWithStatusCode(_0x5136b6,_0x384ed0){_0x384ed0=_0x384ed0||0xcc;return function(_0x5461d0){if(_0x5461d0){return _0x5136b6[_0xbf03('0x13')](_0x384ed0);}return _0x5136b6[_0xbf03('0x14')](_0x384ed0)[_0xbf03('0x15')]();};}function respondWithResult(_0xe5a032,_0xdf276e){_0xdf276e=_0xdf276e||0xc8;return function(_0xb01e9e){if(_0xb01e9e){return _0xe5a032[_0xbf03('0x14')](_0xdf276e)['json'](_0xb01e9e);}};}function respondWithFilteredResult(_0x1f7879,_0x3e36a9){return function(_0x4af423){if(_0x4af423){var _0x47479b=typeof _0x3e36a9['offset']==='undefined'&&typeof _0x3e36a9['limit']===_0xbf03('0x16');var _0x995ed=_0x4af423[_0xbf03('0x17')];var _0x29e486=_0x47479b?0x0:_0x3e36a9[_0xbf03('0x18')];var _0x3c072d=_0x47479b?_0x4af423[_0xbf03('0x17')]:_0x3e36a9[_0xbf03('0x18')]+_0x3e36a9[_0xbf03('0x19')];var _0x1a5a6d;if(_0x3c072d>=_0x995ed){_0x3c072d=_0x995ed;_0x1a5a6d=0xc8;}else{_0x1a5a6d=0xce;}_0x1f7879['status'](_0x1a5a6d);return _0x1f7879[_0xbf03('0x1a')](_0xbf03('0x1b'),_0x29e486+'-'+_0x3c072d+'/'+_0x995ed)['json'](_0x4af423);}return null;};}function saveUpdates(_0x4a96bb){return function(_0x585e31){if(_0x585e31){return _0x585e31[_0xbf03('0x1c')](_0x4a96bb)[_0xbf03('0x1d')](function(_0xc4260a){return _0xc4260a;});}return null;};}function removeEntity(_0x186b5a){return function(_0x238653){if(_0x238653){return _0x238653[_0xbf03('0x1e')]()['then'](function(){_0x186b5a[_0xbf03('0x14')](0xcc)[_0xbf03('0x15')]();});}};}function handleEntityNotFound(_0x473808){return function(_0x4eb2ed){if(!_0x4eb2ed){_0x473808[_0xbf03('0x13')](0x194);}return _0x4eb2ed;};}function handleError(_0x12bc3b,_0x3f3f41){_0x3f3f41=_0x3f3f41||0x1f4;return function(_0x22f0ec){logger['error'](_0x22f0ec[_0xbf03('0x1f')]);if(_0x22f0ec['name']){delete _0x22f0ec['name'];}_0x12bc3b[_0xbf03('0x14')](_0x3f3f41)[_0xbf03('0x20')](_0x22f0ec);};}exports[_0xbf03('0x21')]=function(_0xc68bdf,_0x49b60d){var _0x5975fc={};var _0x50b236=_[_0xbf03('0x22')](db['SmsInteraction'][_0xbf03('0x23')],function(_0x265bb4){return{'name':_0x265bb4[_0xbf03('0x24')],'type':_0x265bb4[_0xbf03('0x25')][_0xbf03('0x26')]};});_0x5975fc=qs[_0xbf03('0x27')](_0x50b236,_0xc68bdf);return interaction['findAll']('sms',_0xc68bdf[_0xbf03('0x28')],_0xc68bdf[_0xbf03('0x29')],_0x5975fc,_0x50b236)[_0xbf03('0x1d')](respondWithFilteredResult(_0x49b60d,_0x5975fc))[_0xbf03('0x2a')](handleError(_0x49b60d,null));};exports[_0xbf03('0x2b')]=function(_0x2a0942,_0x39c70f){var _0x2159a1={'raw':![],'where':{'id':_0x2a0942['params']['id']}},_0x549bf3={};_0x549bf3[_0xbf03('0x2c')]=_[_0xbf03('0x2d')](db[_0xbf03('0x2e')][_0xbf03('0x23')]);_0x549bf3['query']=_[_0xbf03('0x2d')](_0x2a0942['query']);_0x549bf3[_0xbf03('0x2f')]=_[_0xbf03('0x30')](_0x549bf3[_0xbf03('0x2c')],_0x549bf3[_0xbf03('0x28')]);_0x2159a1['attributes']=_[_0xbf03('0x30')](_0x549bf3[_0xbf03('0x2c')],qs['fields'](_0x2a0942[_0xbf03('0x28')][_0xbf03('0x31')]));_0x2159a1['attributes']=_0x2159a1['attributes'][_0xbf03('0x32')]?_0x2159a1['attributes']:_0x549bf3['model'];if(_0x2a0942[_0xbf03('0x28')][_0xbf03('0x33')]){_0x2159a1[_0xbf03('0x34')]=[{'all':!![]}];}_0x2159a1=_[_0xbf03('0x35')]({},_0x2159a1,_0x2a0942[_0xbf03('0x36')]);return db[_0xbf03('0x2e')]['find'](_0x2159a1)[_0xbf03('0x1d')](handleEntityNotFound(_0x39c70f,null))[_0xbf03('0x1d')](respondWithResult(_0x39c70f,null))[_0xbf03('0x2a')](handleError(_0x39c70f,null));};exports[_0xbf03('0x37')]=function(_0x2ce051,_0x2a2d15){return db[_0xbf03('0x2e')][_0xbf03('0x37')](_0x2ce051[_0xbf03('0x38')],{})['then'](respondWithResult(_0x2a2d15,0xc9))['catch'](handleError(_0x2a2d15,null));};exports['update']=function(_0x135f94,_0x4ae930){if(_0x135f94[_0xbf03('0x38')]['id']){delete _0x135f94['body']['id'];}return db['SmsInteraction'][_0xbf03('0x39')]({'where':{'id':_0x135f94['params']['id']}})['then'](handleEntityNotFound(_0x4ae930,null))['then'](saveUpdates(_0x135f94[_0xbf03('0x38')],null))[_0xbf03('0x1d')](respondWithResult(_0x4ae930,null))[_0xbf03('0x2a')](handleError(_0x4ae930,null));};exports['destroy']=function(_0x47cb3d,_0x4b601a){return db[_0xbf03('0x2e')]['find']({'where':{'id':_0x47cb3d['params']['id']}})[_0xbf03('0x1d')](handleEntityNotFound(_0x4b601a,null))['then'](removeEntity(_0x4b601a,null))[_0xbf03('0x2a')](handleError(_0x4b601a,null));};exports['describe']=function(_0x9c0dd3,_0x2fd76d){return db[_0xbf03('0x2e')][_0xbf03('0x3a')]()[_0xbf03('0x1d')](respondWithResult(_0x2fd76d,null))[_0xbf03('0x2a')](handleError(_0x2fd76d,null));};exports[_0xbf03('0x3b')]=function(_0xda416,_0x227c33){return db[_0xbf03('0x3c')]['find']({'where':{'id':_0xda416[_0xbf03('0x3d')]['id']}})[_0xbf03('0x1d')](handleEntityNotFound(_0x227c33,null))[_0xbf03('0x1d')](function(_0x37ca5c){if(_0x37ca5c){return _0x37ca5c[_0xbf03('0x3b')](_0xda416[_0xbf03('0x38')][_0xbf03('0x3e')],_[_0xbf03('0x3f')](_0xda416[_0xbf03('0x38')],[_0xbf03('0x3e'),'id'])||{});}})[_0xbf03('0x1d')](respondWithResult(_0x227c33,null))[_0xbf03('0x2a')](handleError(_0x227c33,null));};exports[_0xbf03('0x40')]=function(_0x186c3e,_0xe96ef7){var _0x27f98f={'raw':![],'where':{}};var _0x373755={};var _0x5ba356={'count':0x0,'rows':[]};return db[_0xbf03('0x2e')][_0xbf03('0x41')]({'where':{'id':_0x186c3e['params']['id']}})[_0xbf03('0x1d')](handleEntityNotFound(_0xe96ef7,null))[_0xbf03('0x1d')](function(_0x45ef92){if(_0x45ef92){_0x373755[_0xbf03('0x2c')]=_[_0xbf03('0x2d')](db[_0xbf03('0x3c')][_0xbf03('0x23')]);_0x373755[_0xbf03('0x28')]=_[_0xbf03('0x2d')](_0x186c3e[_0xbf03('0x28')]);_0x373755[_0xbf03('0x2f')]=_[_0xbf03('0x30')](_0x373755[_0xbf03('0x2c')],_0x373755[_0xbf03('0x28')]);_0x27f98f['attributes']=_[_0xbf03('0x30')](_0x373755[_0xbf03('0x2c')],qs['fields'](_0x186c3e['query'][_0xbf03('0x31')]));_0x27f98f[_0xbf03('0x42')]=_0x27f98f[_0xbf03('0x42')]['length']?_0x27f98f[_0xbf03('0x42')]:_0x373755[_0xbf03('0x2c')];if(!_0x186c3e[_0xbf03('0x28')][_0xbf03('0x43')](_0xbf03('0x44'))){_0x27f98f[_0xbf03('0x19')]=qs[_0xbf03('0x19')](_0x186c3e[_0xbf03('0x28')][_0xbf03('0x19')]);_0x27f98f[_0xbf03('0x18')]=qs[_0xbf03('0x18')](_0x186c3e['query']['offset']);}_0x27f98f[_0xbf03('0x45')]=qs[_0xbf03('0x46')](_0x186c3e[_0xbf03('0x28')][_0xbf03('0x46')]);_0x27f98f[_0xbf03('0x47')]=qs[_0xbf03('0x2f')](_[_0xbf03('0x48')](_0x186c3e[_0xbf03('0x28')],_0x373755[_0xbf03('0x2f')]));_0x27f98f[_0xbf03('0x47')][_0xbf03('0x49')]=_0x45ef92['id'];if(_0x186c3e[_0xbf03('0x28')][_0xbf03('0x4a')]){_0x27f98f[_0xbf03('0x47')]=_[_0xbf03('0x35')](_0x27f98f[_0xbf03('0x47')],{'$or':_['map'](_0x27f98f['attributes'],function(_0x514186){var _0x198870={};_0x198870[_0x514186]={'$like':'%'+_0x186c3e[_0xbf03('0x28')][_0xbf03('0x4a')]+'%'};return _0x198870;})});}if(_0x186c3e[_0xbf03('0x28')][_0xbf03('0x4b')]){var _0x24b21b=_0x186c3e['query'][_0xbf03('0x4b')]['split'](',');var _0x512aac={};_0x512aac[_0x24b21b[0x0]]={'$gte':moment(_0x24b21b[0x1])[_0xbf03('0x4c')](_0xbf03('0x4d'))};_0x27f98f[_0xbf03('0x47')]=_[_0xbf03('0x35')](_0x27f98f[_0xbf03('0x47')],_0x512aac);}_0x27f98f=_['merge']({},_0x27f98f,_0x186c3e[_0xbf03('0x36')]);return db[_0xbf03('0x3c')][_0xbf03('0x17')]({'where':_0x27f98f[_0xbf03('0x47')]})[_0xbf03('0x1d')](function(_0x5c43ec){_0x5ba356[_0xbf03('0x17')]=_0x5c43ec;if(_0x186c3e['query']['includeAll']){_0x27f98f['include']=[{'all':!![]}];}return db['SmsMessage'][_0xbf03('0x4e')](_0x27f98f);})[_0xbf03('0x1d')](function(_0x1ac8a7){_0x5ba356[_0xbf03('0x4f')]=_0x1ac8a7;return _0x5ba356;});}})[_0xbf03('0x1d')](respondWithFilteredResult(_0xe96ef7,_0x27f98f))['catch'](handleError(_0xe96ef7,null));};exports[_0xbf03('0x50')]=function(_0xbe004e,_0x3874d7){return db[_0xbf03('0x2e')][_0xbf03('0x39')]({'where':{'id':_0xbe004e[_0xbf03('0x3d')]['id']}})[_0xbf03('0x1d')](handleEntityNotFound(_0x3874d7,null))['then'](function(_0x2ed964){if(_0x2ed964){return _0x2ed964['setTags'](_0xbe004e[_0xbf03('0x38')][_0xbf03('0x3e')],_[_0xbf03('0x3f')](_0xbe004e[_0xbf03('0x38')],[_0xbf03('0x3e'),'id'])||{})[_0xbf03('0x51')](function(){return db[_0xbf03('0x52')][_0xbf03('0x4e')]({'attributes':['id',_0xbf03('0x53'),_0xbf03('0x54')],'where':{'id':_0xbe004e[_0xbf03('0x38')][_0xbf03('0x3e')]}});})['then'](function(_0x1db0b9){socket[_0xbf03('0x55')]('smsInteractionTags:save',{'id':Number(_0xbe004e[_0xbf03('0x3d')]['id']),'tags':_0x1db0b9||[]});return{'id':Number(_0xbe004e[_0xbf03('0x3d')]['id']),'tags':_0x1db0b9||[]};});}})[_0xbf03('0x1d')](respondWithResult(_0x3874d7,null))[_0xbf03('0x2a')](handleError(_0x3874d7,null));};exports[_0xbf03('0x56')]=function(_0x2bc4fd,_0x825825){return db[_0xbf03('0x2e')]['find']({'where':{'id':_0x2bc4fd['params']['id']}})[_0xbf03('0x1d')](handleEntityNotFound(_0x825825,null))[_0xbf03('0x1d')](function(_0x1dbcd9){if(_0x1dbcd9){return _0x1dbcd9[_0xbf03('0x56')](_0x2bc4fd['query'][_0xbf03('0x3e')]);}})[_0xbf03('0x1d')](respondWithStatusCode(_0x825825,null))[_0xbf03('0x2a')](handleError(_0x825825,null));};exports[_0xbf03('0x57')]=function(_0x428bea,_0x23566d){var _0x5b353f=moment()['unix']()[_0xbf03('0x58')]();var _0x173f9e=path[_0xbf03('0x59')](config[_0xbf03('0x5a')],_0xbf03('0x5b'),_0xbf03('0x5c'),'tmp');var _0x2212f6=path['join'](_0x173f9e,_0x5b353f);var _0x13ab05=util['format']('transcript-%d-%s.zip',_0x428bea[_0xbf03('0x3d')]['id'],_0x5b353f);var _0x3e602e=path[_0xbf03('0x59')](_0x173f9e,_0x13ab05);var _0x3a6a53=[];_0x3a6a53['push']({'model':db[_0xbf03('0x5d')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3a6a53[_0xbf03('0x5e')]({'model':db[_0xbf03('0x5f')],'as':_0xbf03('0x60'),'attributes':['id',_0xbf03('0x61'),_0xbf03('0x62')],'raw':!![]});var _0xb35ae7=[{'model':db[_0xbf03('0x3c')],'as':_0xbf03('0x63'),'attributes':['id',_0xbf03('0x38'),'createdAt',_0xbf03('0x64'),_0xbf03('0x65'),_0xbf03('0x66')],'include':_0x3a6a53}];_0xb35ae7['push']({'model':db[_0xbf03('0x67')],'as':'Account','attributes':['id',_0xbf03('0x53')]});_0xb35ae7[_0xbf03('0x5e')]({'model':db[_0xbf03('0x5d')],'as':_0xbf03('0x68'),'attributes':['id',_0xbf03('0x69')]});return db[_0xbf03('0x2e')][_0xbf03('0x39')]({'where':{'id':_0x428bea[_0xbf03('0x3d')]['id']},'include':_0xb35ae7})[_0xbf03('0x1d')](handleEntityNotFound(_0x23566d,null))[_0xbf03('0x1d')](function(_0x2cd1ec){if(_0x2cd1ec){var _0x311d81=_0x2cd1ec[_0xbf03('0x6a')]({'plain':!![]});fs[_0xbf03('0x6b')](_0x2212f6);var _0x2e4f7f={'channel':_0xbf03('0x6c'),'account':_0x311d81[_0xbf03('0x6d')][_0xbf03('0x53')],'agent':_0x311d81[_0xbf03('0x68')]?_0x311d81['Owner']['fullname']:'N.A.','createdAt':moment(_0x311d81[_0xbf03('0x6e')])['format'](_0xbf03('0x4d'))[_0xbf03('0x58')](),'closedAt':_0x311d81[_0xbf03('0x6f')]?moment(_0x311d81[_0xbf03('0x70')])['format'](_0xbf03('0x4d'))[_0xbf03('0x58')]():'','disposition':_0x311d81['disposition'],'messages':_(_0x311d81[_0xbf03('0x63')])[_0xbf03('0x4a')]({'secret':![]})[_0xbf03('0x22')](function(_0xcd9708){return{'date':moment(_0xcd9708[_0xbf03('0x6e')])[_0xbf03('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbf03('0x58')](),'sender':_0xcd9708['direction']==='out'?_0xcd9708[_0xbf03('0x5d')]?_0xcd9708[_0xbf03('0x5d')][_0xbf03('0x69')]:'System':_0xcd9708[_0xbf03('0x60')]['firstName']+(_0xcd9708[_0xbf03('0x60')][_0xbf03('0x62')]?'\x20'+_0xcd9708[_0xbf03('0x60')][_0xbf03('0x62')]:''),'body':_0xcd9708['body'],'direction':_0xcd9708[_0xbf03('0x64')]===_0xbf03('0x71')?'A':'C','secret':_0xcd9708[_0xbf03('0x65')],'read':_0xcd9708[_0xbf03('0x66')]};})[_0xbf03('0x72')]()};return ejs[_0xbf03('0x73')](path[_0xbf03('0x59')](config[_0xbf03('0x5a')],_0xbf03('0x5b'),_0xbf03('0x74'),_0xbf03('0x75')),{'interaction':_0x2e4f7f})[_0xbf03('0x1d')](function(_0x528dbf){var _0x1b7e9b=path[_0xbf03('0x59')](_0x2212f6,_0xbf03('0x76')+_0x311d81['id']+'-'+_0x5b353f+_0xbf03('0x77'));var _0xa19833={'path':_0x1b7e9b,'channel':_0xbf03('0x6c'),'interactionId':_0x311d81['id']};return pdf[_0xbf03('0x78')](_0x528dbf,_0xa19833);})['then'](function(){return new BPromise(function(_0x403775,_0x4f65ed){zipdir(_0x2212f6,{'saveTo':_0x3e602e},function(_0x5ace83,_0x5ad59e){if(_0x5ace83)return _0x4f65ed(_0x5ace83);return _0x403775(_0x5ad59e);});})[_0xbf03('0x1d')](function(){return new BPromise(function(_0x1fd9a0,_0x45669d){rimraf(_0x2212f6,function(_0x373cec){if(_0x373cec)_0x45669d(_0x373cec);return _0x1fd9a0();});});})['then'](function(){return _0x23566d['download'](_0x3e602e,_0x13ab05,function(_0x12ab67){if(_0x12ab67){console[_0xbf03('0x79')]('err',_0x12ab67);}else{fs[_0xbf03('0x7a')](_0x3e602e);}});});});}else{return _0x23566d[_0xbf03('0x13')](0xc8);}})[_0xbf03('0x2a')](handleError(_0x23566d,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f5a79cd..1540182 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 _0x1893=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x13640e,_0x303d5d){var _0x4bc04d=function(_0x522dbb){while(--_0x522dbb){_0x13640e['push'](_0x13640e['shift']());}};_0x4bc04d(++_0x303d5d);}(_0x1893,0xa2));var _0x3189=function(_0x63de62,_0xe5cc89){_0x63de62=_0x63de62-0x0;var _0x3daddf=_0x1893[_0x63de62];return _0x3daddf;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x3189('0x0')];var SmsMessage=require(_0x3189('0x1'))['db'][_0x3189('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3189('0x3')](0x0);var events={'afterCreate':_0x3189('0x4'),'afterUpdate':_0x3189('0x5'),'afterDestroy':_0x3189('0x6')};function emitEvent(_0x5371db){return function(_0x27445,_0x4faebf,_0x2333e6){_0x27445[_0x3189('0x7')]({'attributes':['id'],'raw':!![]})[_0x3189('0x8')](function(_0x118970){_0x27445[_0x3189('0x9')](_0x3189('0xa'),_0x118970['map'](function(_0x1d5f6a){return{'id':_0x1d5f6a['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x27445['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3189('0x8')](function(_0x4ac683){_0x27445[_0x3189('0x9')](_0x3189('0xb'),_0x4ac683[_0x3189('0xc')]);SmsInteractionEvents[_0x3189('0xd')](_0x5371db+':'+_0x27445['id'],_0x27445);SmsInteractionEvents['emit'](_0x5371db,_0x27445);_0x2333e6(null);})[_0x3189('0xe')](_0x2333e6(null));};}for(var e in events){if(events[_0x3189('0xf')](e)){var event=events[e];SmsInteraction[_0x3189('0x10')](e,emitEvent(event));}}module[_0x3189('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0xfcbb=['catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x5c6a78,_0x5c0503){var _0x236c5e=function(_0x44ef45){while(--_0x44ef45){_0x5c6a78['push'](_0x5c6a78['shift']());}};_0x236c5e(++_0x5c0503);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x492c40,_0xc5ad39){_0x492c40=_0x492c40-0x0;var _0x3e1580=_0xfcbb[_0x492c40];return _0x3e1580;};'use strict';var EventEmitter=require(_0xbfcb('0x0'));var SmsInteraction=require(_0xbfcb('0x1'))['db'][_0xbfcb('0x2')];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xbfcb('0x3')](0x0);var events={'afterCreate':_0xbfcb('0x4'),'afterUpdate':_0xbfcb('0x5'),'afterDestroy':_0xbfcb('0x6')};function emitEvent(_0x1d8b50){return function(_0x5c5a1a,_0x5201d3,_0x32c2aa){_0x5c5a1a[_0xbfcb('0x7')]({'attributes':['id'],'raw':!![]})[_0xbfcb('0x8')](function(_0x2df839){_0x5c5a1a[_0xbfcb('0x9')](_0xbfcb('0xa'),_0x2df839[_0xbfcb('0xb')](function(_0x571001){return{'id':_0x571001['id']};}));return SmsMessage[_0xbfcb('0xc')]({'where':{'SmsInteractionId':_0x5c5a1a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbfcb('0x8')](function(_0x346685){_0x5c5a1a['setDataValue'](_0xbfcb('0xd'),_0x346685[_0xbfcb('0xe')]);SmsInteractionEvents[_0xbfcb('0xf')](_0x1d8b50+':'+_0x5c5a1a['id'],_0x5c5a1a);SmsInteractionEvents[_0xbfcb('0xf')](_0x1d8b50,_0x5c5a1a);_0x32c2aa(null);})[_0xbfcb('0x10')](_0x32c2aa(null));};}for(var e in events){if(events[_0xbfcb('0x11')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xbfcb('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 782c057..1f04616 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 _0x2901=['./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x239bb5,_0x144952){var _0x15e817=function(_0x3beea9){while(--_0x3beea9){_0x239bb5['push'](_0x239bb5['shift']());}};_0x15e817(++_0x144952);}(_0x2901,0x1d4));var _0x1290=function(_0x46716c,_0x437635){_0x46716c=_0x46716c-0x0;var _0xfe64d=_0x2901[_0x46716c];return _0xfe64d;};'use strict';var _=require(_0x1290('0x0'));var util=require('util');var logger=require(_0x1290('0x1'))(_0x1290('0x2'));var moment=require(_0x1290('0x3'));var BPromise=require(_0x1290('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1290('0x5'));var rimraf=require(_0x1290('0x6'));var config=require(_0x1290('0x7'));var attributes=require(_0x1290('0x8'));module[_0x1290('0x9')]=function(_0x418a31,_0x243e97){return _0x418a31['define'](_0x1290('0xa'),attributes,{'tableName':_0x1290('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e5af0,_0x511dbd,_0x24955c){if(_0x1e5af0[_0x1290('0xc')](_0x1290('0xd'))){_0x1e5af0[_0x1290('0xe')]=moment()[_0x1290('0xf')](_0x1290('0x10'));}_0x24955c(null,_0x1e5af0);}}});}; \ No newline at end of file +var _0x9b43=['define','sms_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes','exports'];(function(_0x1b0d4c,_0x7e6a1){var _0xb0d298=function(_0x3c0811){while(--_0x3c0811){_0x1b0d4c['push'](_0x1b0d4c['shift']());}};_0xb0d298(++_0x7e6a1);}(_0x9b43,0x135));var _0x39b4=function(_0x5a4eaa,_0x152556){_0x5a4eaa=_0x5a4eaa-0x0;var _0x3f4b8b=_0x9b43[_0x5a4eaa];return _0x3f4b8b;};'use strict';var _=require(_0x39b4('0x0'));var util=require(_0x39b4('0x1'));var logger=require(_0x39b4('0x2'))(_0x39b4('0x3'));var moment=require(_0x39b4('0x4'));var BPromise=require(_0x39b4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39b4('0x6'));var rimraf=require(_0x39b4('0x7'));var config=require(_0x39b4('0x8'));var attributes=require(_0x39b4('0x9'));module[_0x39b4('0xa')]=function(_0x2eb573,_0x1b2e04){return _0x2eb573[_0x39b4('0xb')]('SmsInteraction',attributes,{'tableName':_0x39b4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d07fd,_0x43ccab,_0x340ee3){if(_0x5d07fd[_0x39b4('0xd')](_0x39b4('0xe'))){_0x5d07fd['closedAt']=moment()['format'](_0x39b4('0xf'));}_0x340ee3(null,_0x5d07fd);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 911c435..ce8935c 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 _0x8fea=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','stringify','catch','AddTagsToSmsInteraction','find','addTags','ids','AddTags','lodash','bluebird','randomstring'];(function(_0x2c0f14,_0x543765){var _0x57b26=function(_0x20c81e){while(--_0x20c81e){_0x2c0f14['push'](_0x2c0f14['shift']());}};_0x57b26(++_0x543765);}(_0x8fea,0xe7));var _0xa8fe=function(_0x494c6f,_0x54dbe7){_0x494c6f=_0x494c6f-0x0;var _0x4c9c08=_0x8fea[_0x494c6f];return _0x4c9c08;};'use strict';var _=require(_0xa8fe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa8fe('0x1'));var rs=require(_0xa8fe('0x2'));var fs=require('fs');var Redis=require(_0xa8fe('0x3'));var db=require(_0xa8fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8fe('0x5'))(_0xa8fe('0x6'));var config=require(_0xa8fe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa8fe('0x8')][_0xa8fe('0x9')]({'port':0x232a});config['redis']=_[_0xa8fe('0xa')](config['redis'],{'host':_0xa8fe('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa8fe('0xc'))[_0xa8fe('0xd')](socket);function respondWithRpcPromise(_0x232bac,_0x2ba2a1,_0x3eda6a){return new BPromise(function(_0x5543e4,_0xbdb0a8){return client['request'](_0x232bac,_0x3eda6a)[_0xa8fe('0xe')](function(_0x199ce9){logger[_0xa8fe('0xf')](_0xa8fe('0x10'),_0x2ba2a1,_0xa8fe('0x11'));logger[_0xa8fe('0x12')](_0xa8fe('0x13'),_0x2ba2a1,_0xa8fe('0x11'),JSON['stringify'](_0x199ce9));if(_0x199ce9['error']){if(_0x199ce9[_0xa8fe('0x14')][_0xa8fe('0x15')]===0x1f4){logger['error'](_0xa8fe('0x10'),_0x2ba2a1,_0x199ce9[_0xa8fe('0x14')][_0xa8fe('0x16')]);return _0xbdb0a8(_0x199ce9['error'][_0xa8fe('0x16')]);}logger[_0xa8fe('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x2ba2a1,_0x199ce9[_0xa8fe('0x14')]['message']);return _0x5543e4(_0x199ce9[_0xa8fe('0x14')][_0xa8fe('0x16')]);}else{logger[_0xa8fe('0xf')](_0xa8fe('0x10'),_0x2ba2a1,'request\x20sent');_0x5543e4(_0x199ce9[_0xa8fe('0x17')][_0xa8fe('0x16')]);}})['catch'](function(_0x4988d1){logger[_0xa8fe('0x14')](_0xa8fe('0x10'),_0x2ba2a1,_0x4988d1);_0xbdb0a8(_0x4988d1);});});}exports[_0xa8fe('0x18')]=function(_0x374c04){var _0x96023f=this;return new Promise(function(_0x37cc84,_0x5a82ef){return db[_0xa8fe('0x19')][_0xa8fe('0x1a')](_0x374c04[_0xa8fe('0x1b')],{'raw':_0x374c04['options']?_0x374c04[_0xa8fe('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x374c04[_0xa8fe('0x1c')]?_0x374c04[_0xa8fe('0x1c')][_0xa8fe('0x1d')]||null:null,'attributes':_0x374c04['options']?_0x374c04[_0xa8fe('0x1c')][_0xa8fe('0x1e')]||null:null,'limit':_0x374c04['options']?_0x374c04['options'][_0xa8fe('0x1f')]||null:null})[_0xa8fe('0xe')](function(_0x4adacc){logger[_0xa8fe('0xf')]('UpdateSmsInteraction',_0x374c04);logger[_0xa8fe('0x12')]('UpdateSmsInteraction',_0x374c04,JSON[_0xa8fe('0x20')](_0x4adacc));_0x37cc84(_0x4adacc);})[_0xa8fe('0x21')](function(_0x3b1444){logger[_0xa8fe('0x14')](_0xa8fe('0x18'),_0x3b1444[_0xa8fe('0x16')],_0x374c04);_0x5a82ef(_0x96023f[_0xa8fe('0x14')](0x1f4,_0x3b1444[_0xa8fe('0x16')]));});});};exports[_0xa8fe('0x22')]=function(_0x1acba1){return new Promise(function(_0x578509,_0x3abd54){return db['SmsInteraction'][_0xa8fe('0x23')]({'where':_0x1acba1[_0xa8fe('0x1c')]?_0x1acba1[_0xa8fe('0x1c')][_0xa8fe('0x1d')]||null:null})[_0xa8fe('0xe')](function(_0x2a878c){if(_0x2a878c){return _0x2a878c[_0xa8fe('0x24')](_0x1acba1[_0xa8fe('0x1b')][_0xa8fe('0x25')],_['omit'](_0x1acba1[_0xa8fe('0x1b')],[_0xa8fe('0x25'),'id'])||{});}})['spread'](function(_0x2df74a){logger[_0xa8fe('0xf')]('AddTags',_0x1acba1);logger['debug'](_0xa8fe('0x26'),_0x1acba1,JSON[_0xa8fe('0x20')](_0x2df74a));_0x578509(_0x2df74a);})[_0xa8fe('0x21')](function(_0x319a72){logger[_0xa8fe('0x14')](_0xa8fe('0x26'),_0x319a72[_0xa8fe('0x16')],_0x1acba1);_0x3abd54(_this[_0xa8fe('0x14')](0x1f4,_0x319a72[_0xa8fe('0x16')]));});});}; \ No newline at end of file +var _0x88ae=['info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','then','debug','stringify','AddTagsToSmsInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register'];(function(_0x1acfb9,_0x52bc80){var _0x1416e3=function(_0x1909d1){while(--_0x1909d1){_0x1acfb9['push'](_0x1acfb9['shift']());}};_0x1416e3(++_0x52bc80);}(_0x88ae,0x1dc));var _0xe88a=function(_0x9e671f,_0x2d25ac){_0x9e671f=_0x9e671f-0x0;var _0x2f6959=_0x88ae[_0x9e671f];return _0x2f6959;};'use strict';var _=require(_0xe88a('0x0'));var util=require(_0xe88a('0x1'));var moment=require(_0xe88a('0x2'));var BPromise=require(_0xe88a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe88a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe88a('0x5'));var logger=require(_0xe88a('0x6'))('rpc');var config=require(_0xe88a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe88a('0x8')][_0xe88a('0x9')]({'port':0x232a});config[_0xe88a('0xa')]=_[_0xe88a('0xb')](config[_0xe88a('0xa')],{'host':_0xe88a('0xc'),'port':0x18eb});var socket=require(_0xe88a('0xd'))(new Redis(config[_0xe88a('0xa')]));require(_0xe88a('0xe'))[_0xe88a('0xf')](socket);function respondWithRpcPromise(_0x1c5022,_0x1c246c,_0x1022f7){return new BPromise(function(_0x5b4823,_0x23887a){return client['request'](_0x1c5022,_0x1022f7)['then'](function(_0x554404){logger[_0xe88a('0x10')](_0xe88a('0x11'),_0x1c246c,_0xe88a('0x12'));logger['debug'](_0xe88a('0x13'),_0x1c246c,_0xe88a('0x12'),JSON['stringify'](_0x554404));if(_0x554404['error']){if(_0x554404[_0xe88a('0x14')][_0xe88a('0x15')]===0x1f4){logger['error'](_0xe88a('0x11'),_0x1c246c,_0x554404[_0xe88a('0x14')][_0xe88a('0x16')]);return _0x23887a(_0x554404[_0xe88a('0x14')][_0xe88a('0x16')]);}logger[_0xe88a('0x14')](_0xe88a('0x11'),_0x1c246c,_0x554404[_0xe88a('0x14')][_0xe88a('0x16')]);return _0x5b4823(_0x554404['error']['message']);}else{logger[_0xe88a('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x1c246c,_0xe88a('0x12'));_0x5b4823(_0x554404['result']['message']);}})[_0xe88a('0x17')](function(_0x3c146c){logger['error'](_0xe88a('0x11'),_0x1c246c,_0x3c146c);_0x23887a(_0x3c146c);});});}exports[_0xe88a('0x18')]=function(_0x19ab32){var _0x31d295=this;return new Promise(function(_0x4b1b01,_0xab4d23){return db[_0xe88a('0x19')]['update'](_0x19ab32[_0xe88a('0x1a')],{'raw':_0x19ab32[_0xe88a('0x1b')]?_0x19ab32[_0xe88a('0x1b')][_0xe88a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19ab32[_0xe88a('0x1b')]?_0x19ab32[_0xe88a('0x1b')][_0xe88a('0x1d')]||null:null,'attributes':_0x19ab32[_0xe88a('0x1b')]?_0x19ab32['options'][_0xe88a('0x1e')]||null:null,'limit':_0x19ab32[_0xe88a('0x1b')]?_0x19ab32[_0xe88a('0x1b')][_0xe88a('0x1f')]||null:null})[_0xe88a('0x20')](function(_0x282f57){logger['info']('UpdateSmsInteraction',_0x19ab32);logger[_0xe88a('0x21')](_0xe88a('0x18'),_0x19ab32,JSON[_0xe88a('0x22')](_0x282f57));_0x4b1b01(_0x282f57);})[_0xe88a('0x17')](function(_0xf7a605){logger['error'](_0xe88a('0x18'),_0xf7a605[_0xe88a('0x16')],_0x19ab32);_0xab4d23(_0x31d295[_0xe88a('0x14')](0x1f4,_0xf7a605[_0xe88a('0x16')]));});});};exports[_0xe88a('0x23')]=function(_0x156eef){return new Promise(function(_0x18c2ee,_0x322298){return db['SmsInteraction']['find']({'where':_0x156eef['options']?_0x156eef[_0xe88a('0x1b')][_0xe88a('0x1d')]||null:null})[_0xe88a('0x20')](function(_0x21be32){if(_0x21be32){return _0x21be32[_0xe88a('0x24')](_0x156eef[_0xe88a('0x1a')][_0xe88a('0x25')],_[_0xe88a('0x26')](_0x156eef[_0xe88a('0x1a')],[_0xe88a('0x25'),'id'])||{});}})[_0xe88a('0x27')](function(_0x3e18d9){logger[_0xe88a('0x10')](_0xe88a('0x28'),_0x156eef);logger[_0xe88a('0x21')](_0xe88a('0x28'),_0x156eef,JSON[_0xe88a('0x22')](_0x3e18d9));_0x18c2ee(_0x3e18d9);})[_0xe88a('0x17')](function(_0x1e2b55){logger[_0xe88a('0x14')](_0xe88a('0x28'),_0x1e2b55[_0xe88a('0x16')],_0x156eef);_0x322298(_this[_0xe88a('0x14')](0x1f4,_0x1e2b55['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index b4abcb0..c4ea7a2 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 _0x31ee=['smsInteraction:','./smsInteraction.events','save','remove','emit','register','length'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0x31ee,0x120));var _0xe31e=function(_0x5e454a,_0x2c949c){_0x5e454a=_0x5e454a-0x0;var _0x2bafa1=_0x31ee[_0x5e454a];return _0x2bafa1;};'use strict';var SmsInteractionEvents=require(_0xe31e('0x0'));var events=[_0xe31e('0x1'),_0xe31e('0x2'),'update'];function createListener(_0x567759,_0x496099){return function(_0x461ae2){_0x496099[_0xe31e('0x3')](_0x567759,_0x461ae2);};}function removeListener(_0x3e460e,_0x3dc35f){return function(){SmsInteractionEvents['removeListener'](_0x3e460e,_0x3dc35f);};}exports[_0xe31e('0x4')]=function(_0x239fb2){for(var _0x4d9857=0x0,_0x177a90=events[_0xe31e('0x5')];_0x4d9857<_0x177a90;_0x4d9857++){var _0x9b43d1=events[_0x4d9857];var _0x51b236=createListener(_0xe31e('0x6')+_0x9b43d1,_0x239fb2);SmsInteractionEvents['on'](_0x9b43d1,_0x51b236);}}; \ No newline at end of file +var _0x86c8=['register','length','smsInteraction:','./smsInteraction.events','remove','emit','removeListener'];(function(_0x19b7b5,_0x5ec225){var _0x13047e=function(_0x542eb2){while(--_0x542eb2){_0x19b7b5['push'](_0x19b7b5['shift']());}};_0x13047e(++_0x5ec225);}(_0x86c8,0x1a7));var _0x886c=function(_0x174ad8,_0x46e5f0){_0x174ad8=_0x174ad8-0x0;var _0x20f68b=_0x86c8[_0x174ad8];return _0x20f68b;};'use strict';var SmsInteractionEvents=require(_0x886c('0x0'));var events=['save',_0x886c('0x1'),'update'];function createListener(_0x2b0afc,_0x5f4595){return function(_0x5da8eb){_0x5f4595[_0x886c('0x2')](_0x2b0afc,_0x5da8eb);};}function removeListener(_0x5cd15e,_0x44511c){return function(){SmsInteractionEvents[_0x886c('0x3')](_0x5cd15e,_0x44511c);};}exports[_0x886c('0x4')]=function(_0x416a1d){for(var _0x53cea0=0x0,_0x1afe1a=events[_0x886c('0x5')];_0x53cea0<_0x1afe1a;_0x53cea0++){var _0x33710b=events[_0x53cea0];var _0x4c72ea=createListener(_0x886c('0x6')+_0x33710b,_0x416a1d);SmsInteractionEvents['on'](_0x33710b,_0x4c72ea);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 44d2ece..cc58926 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 _0xdac7=['multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','update','/:id/accept','accept','put','/:id/reject','reject','exports'];(function(_0x35ec00,_0x12ad42){var _0x8fdad5=function(_0x3f4158){while(--_0x3f4158){_0x35ec00['push'](_0x35ec00['shift']());}};_0x8fdad5(++_0x12ad42);}(_0xdac7,0x180));var _0x7dac=function(_0x47a52b,_0x117767){_0x47a52b=_0x47a52b-0x0;var _0x575dd7=_0xdac7[_0x47a52b];return _0x575dd7;};'use strict';var multer=require(_0x7dac('0x0'));var util=require(_0x7dac('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7dac('0x2')]();var fs_extra=require(_0x7dac('0x3'));var auth=require(_0x7dac('0x4'));var interaction=require(_0x7dac('0x5'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router['get']('/',auth[_0x7dac('0x6')](),controller[_0x7dac('0x7')]);router['get'](_0x7dac('0x8'),auth['isAuthenticated'](),controller[_0x7dac('0x9')]);router['get'](_0x7dac('0xa'),auth[_0x7dac('0x6')](),controller[_0x7dac('0xb')]);router[_0x7dac('0xc')]('/',auth[_0x7dac('0x6')](),interaction[_0x7dac('0xd')](_0x7dac('0xe'),_0x7dac('0xf')),controller[_0x7dac('0x10')]);router[_0x7dac('0xc')]('/:id/status',controller['status']);router['put'](_0x7dac('0xa'),auth['isAuthenticated'](),controller[_0x7dac('0x11')]);router['put'](_0x7dac('0x12'),auth[_0x7dac('0x6')](),controller[_0x7dac('0x13')]);router[_0x7dac('0x14')](_0x7dac('0x15'),auth[_0x7dac('0x6')](),controller[_0x7dac('0x16')]);router['delete'](_0x7dac('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7dac('0x17')]=router; \ No newline at end of file +var _0xe126=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','tracked','smsmessage:create','/:id/status','status','update','put','/:id/accept','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x270656,_0x4c38c5){var _0x4b8e7a=function(_0x276f23){while(--_0x276f23){_0x270656['push'](_0x270656['shift']());}};_0x4b8e7a(++_0x4c38c5);}(_0xe126,0xeb));var _0x6e12=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xe126[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require(_0x6e12('0x0'));var util=require(_0x6e12('0x1'));var path=require('path');var timeout=require(_0x6e12('0x2'));var express=require(_0x6e12('0x3'));var router=express[_0x6e12('0x4')]();var fs_extra=require(_0x6e12('0x5'));var auth=require(_0x6e12('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6e12('0x7'));var controller=require('./smsMessage.controller');router[_0x6e12('0x8')]('/',auth[_0x6e12('0x9')](),controller['index']);router[_0x6e12('0x8')](_0x6e12('0xa'),auth[_0x6e12('0x9')](),controller[_0x6e12('0xb')]);router[_0x6e12('0x8')](_0x6e12('0xc'),auth[_0x6e12('0x9')](),controller['show']);router['post']('/',auth[_0x6e12('0x9')](),interaction[_0x6e12('0xd')]('sms',_0x6e12('0xe')),controller['create']);router['post'](_0x6e12('0xf'),controller[_0x6e12('0x10')]);router['put'](_0x6e12('0xc'),auth['isAuthenticated'](),controller[_0x6e12('0x11')]);router[_0x6e12('0x12')](_0x6e12('0x13'),auth[_0x6e12('0x9')](),controller['accept']);router[_0x6e12('0x12')]('/:id/reject',auth[_0x6e12('0x9')](),controller[_0x6e12('0x14')]);router[_0x6e12('0x15')](_0x6e12('0xc'),auth['isAuthenticated'](),controller[_0x6e12('0x16')]);module[_0x6e12('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index da9b4ce..32330a7 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 _0x6a3b=['exports','TEXT','medium','ENUM','out','STRING','DATE'];(function(_0x9db88,_0x110607){var _0x3ecd4c=function(_0x16eb66){while(--_0x16eb66){_0x9db88['push'](_0x9db88['shift']());}};_0x3ecd4c(++_0x110607);}(_0x6a3b,0x134));var _0xb6a3=function(_0x19cc9d,_0x259def){_0x19cc9d=_0x19cc9d-0x0;var _0x81ce21=_0x6a3b[_0x19cc9d];return _0x81ce21;};'use strict';var Sequelize=require('sequelize');module[_0xb6a3('0x0')]={'body':{'type':Sequelize[_0xb6a3('0x1')](_0xb6a3('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb6a3('0x3')]('in','out'),'defaultValue':_0xb6a3('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb6a3('0x5')](0xbe)},'phone':{'type':Sequelize[_0xb6a3('0x5')]},'readAt':{'type':Sequelize[_0xb6a3('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb6a3('0x5')]},'providerResponse':{'type':Sequelize[_0xb6a3('0x1')]}}; \ No newline at end of file +var _0xedc1=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xf286f5,_0x42aa45){var _0x58c4af=function(_0xe47e2){while(--_0xe47e2){_0xf286f5['push'](_0xf286f5['shift']());}};_0x58c4af(++_0x42aa45);}(_0xedc1,0x158));var _0x1edc=function(_0x2f06e0,_0x2e1c2a){_0x2f06e0=_0x2f06e0-0x0;var _0xf2711b=_0xedc1[_0x2f06e0];return _0xf2711b;};'use strict';var Sequelize=require(_0x1edc('0x0'));module[_0x1edc('0x1')]={'body':{'type':Sequelize[_0x1edc('0x2')](_0x1edc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1edc('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1edc('0x5')]('in','out'),'defaultValue':_0x1edc('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1edc('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x1edc('0x8')]},'secret':{'type':Sequelize[_0x1edc('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1edc('0x7')]},'providerResponse':{'type':Sequelize[_0x1edc('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index add4e55..27ded6c 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 _0xf05f=['include','findAll','rows','show','params','includeAll','options','find','create','body','describe','accept','sms','acceptMessage','reject','UserId','agent','get','SmsInteraction','SmsInteractionId','interaction','user','role','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','plivio','infobip','results','groupName','DELIVERED','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','sms-interactions','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','count','limit','set','update','then','destroy','sendStatus','stack','name','send','index','SmsMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge'];(function(_0x263b78,_0x324a64){var _0x7f7c24=function(_0x47ae12){while(--_0x47ae12){_0x263b78['push'](_0x263b78['shift']());}};_0x7f7c24(++_0x324a64);}(_0xf05f,0xae));var _0xff05=function(_0x5b733c,_0x489127){_0x5b733c=_0x5b733c-0x0;var _0x58f479=_0xf05f[_0x5b733c];return _0x58f479;};'use strict';var util=require('util');var _=require(_0xff05('0x0'));var Redis=require(_0xff05('0x1'));var interactionService=require(_0xff05('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xff05('0x3'))(_0xff05('0x4'));var config=require(_0xff05('0x5'));var db=require(_0xff05('0x6'))['db'];config[_0xff05('0x7')]=_[_0xff05('0x8')](config[_0xff05('0x7')],{'host':_0xff05('0x9'),'port':0x18eb});var socket=require(_0xff05('0xa'))(new Redis(config[_0xff05('0x7')]));require(_0xff05('0xb'))[_0xff05('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0xff05('0xd')][_0xff05('0xe')]({'port':0x232c});var client9002=jayson[_0xff05('0xd')][_0xff05('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0xff05('0xf'));function respondWithRpcPromise(_0xf2714d,_0x1386d8,_0x2239b8,_0x4184ab){return new Promise(function(_0x1387db,_0x544787){var _0x56b9f4=_0x4184ab||client;return _0x56b9f4[_0xff05('0x10')](_0xf2714d,_0x2239b8)['then'](function(_0x321f6b){logger[_0xff05('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1386d8,_0xff05('0x12'));logger[_0xff05('0x13')](_0xff05('0x14'),_0x1386d8,_0xff05('0x12'),JSON[_0xff05('0x15')](_0x321f6b));if(_0x321f6b[_0xff05('0x16')]){if(_0x321f6b[_0xff05('0x16')]['code']===0x1f4){logger[_0xff05('0x16')](_0xff05('0x17'),_0x1386d8,_0x321f6b['error'][_0xff05('0x18')]);return _0x544787(_0x321f6b[_0xff05('0x16')][_0xff05('0x18')]);}logger[_0xff05('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1386d8,_0x321f6b[_0xff05('0x16')][_0xff05('0x18')]);return _0x1387db(_0x321f6b[_0xff05('0x16')][_0xff05('0x18')]);}else{logger[_0xff05('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1386d8,_0xff05('0x12'));_0x1387db(_0x321f6b[_0xff05('0x19')][_0xff05('0x18')]);}})[_0xff05('0x1a')](function(_0x2f0aa3){logger[_0xff05('0x16')](_0xff05('0x17'),_0x1386d8,_0x2f0aa3);_0x544787(_0x2f0aa3);});});}function respondWithResult(_0x583760,_0x51effa){_0x51effa=_0x51effa||0xc8;return function(_0x323f38){if(_0x323f38){return _0x583760[_0xff05('0x1b')](_0x51effa)[_0xff05('0x1c')](_0x323f38);}};}function respondWithFilteredResult(_0x46db74,_0x5c5b76){return function(_0x127ac8){if(_0x127ac8){var _0x248cbb=typeof _0x5c5b76[_0xff05('0x1d')]===_0xff05('0x1e')&&typeof _0x5c5b76['limit']==='undefined';var _0xee3fdb=_0x127ac8[_0xff05('0x1f')];var _0x1be604=_0x248cbb?0x0:_0x5c5b76['offset'];var _0x2e3153=_0x248cbb?_0x127ac8[_0xff05('0x1f')]:_0x5c5b76['offset']+_0x5c5b76[_0xff05('0x20')];var _0x40f2b0;if(_0x2e3153>=_0xee3fdb){_0x2e3153=_0xee3fdb;_0x40f2b0=0xc8;}else{_0x40f2b0=0xce;}_0x46db74[_0xff05('0x1b')](_0x40f2b0);return _0x46db74[_0xff05('0x21')]('Content-Range',_0x1be604+'-'+_0x2e3153+'/'+_0xee3fdb)[_0xff05('0x1c')](_0x127ac8);}return null;};}function saveUpdates(_0x197729){return function(_0x5da657){if(_0x5da657){return _0x5da657[_0xff05('0x22')](_0x197729)[_0xff05('0x23')](function(_0x4b4d03){return _0x4b4d03;});}return null;};}function removeEntity(_0x2b9d1a){return function(_0x49c1ec){if(_0x49c1ec){return _0x49c1ec[_0xff05('0x24')]()['then'](function(){_0x2b9d1a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x437a02){return function(_0x462e64){if(!_0x462e64){_0x437a02[_0xff05('0x25')](0x194);}return _0x462e64;};}function handleError(_0x1ef71e,_0xf4abef){_0xf4abef=_0xf4abef||0x1f4;return function(_0x163a09){logger[_0xff05('0x16')](_0x163a09[_0xff05('0x26')]);if(_0x163a09[_0xff05('0x27')]){delete _0x163a09['name'];}_0x1ef71e[_0xff05('0x1b')](_0xf4abef)[_0xff05('0x28')](_0x163a09);};}exports[_0xff05('0x29')]=function(_0x58feb1,_0x17ad3f){var _0x34fc1f={},_0x3a9882={},_0x41a175={'count':0x0,'rows':[]};var _0x2d7021=_['map'](db[_0xff05('0x2a')][_0xff05('0x2b')],function(_0x4e291c){return{'name':_0x4e291c[_0xff05('0x2c')],'type':_0x4e291c[_0xff05('0x2d')]['key']};});_0x3a9882[_0xff05('0x2e')]=_[_0xff05('0x2f')](_0x2d7021,_0xff05('0x27'));_0x3a9882[_0xff05('0x30')]=_[_0xff05('0x31')](_0x58feb1[_0xff05('0x30')]);_0x3a9882[_0xff05('0x32')]=_['intersection'](_0x3a9882['model'],_0x3a9882[_0xff05('0x30')]);_0x34fc1f[_0xff05('0x33')]=_[_0xff05('0x34')](_0x3a9882[_0xff05('0x2e')],qs[_0xff05('0x35')](_0x58feb1[_0xff05('0x30')][_0xff05('0x35')]));_0x34fc1f[_0xff05('0x33')]=_0x34fc1f[_0xff05('0x33')][_0xff05('0x36')]?_0x34fc1f[_0xff05('0x33')]:_0x3a9882['model'];if(!_0x58feb1[_0xff05('0x30')][_0xff05('0x37')](_0xff05('0x38'))){_0x34fc1f[_0xff05('0x20')]=qs[_0xff05('0x20')](_0x58feb1['query']['limit']);_0x34fc1f['offset']=qs[_0xff05('0x1d')](_0x58feb1[_0xff05('0x30')]['offset']);}_0x34fc1f['order']=qs[_0xff05('0x39')](_0x58feb1['query'][_0xff05('0x39')]);_0x34fc1f[_0xff05('0x3a')]=qs[_0xff05('0x32')](_['pick'](_0x58feb1['query'],_0x3a9882[_0xff05('0x32')]),_0x2d7021);if(_0x58feb1[_0xff05('0x30')]['filter']){_0x34fc1f[_0xff05('0x3a')]=_['merge'](_0x34fc1f[_0xff05('0x3a')],{'$or':_[_0xff05('0x2f')](_0x2d7021,function(_0x4a4069){if(_0x4a4069[_0xff05('0x2d')]!==_0xff05('0x3b')){var _0x21c3fd={};_0x21c3fd[_0x4a4069[_0xff05('0x27')]]={'$like':'%'+_0x58feb1[_0xff05('0x30')][_0xff05('0x3c')]+'%'};return _0x21c3fd;}})});}_0x34fc1f=_[_0xff05('0x3d')]({},_0x34fc1f,_0x58feb1['options']);var _0x5f5749={'where':_0x34fc1f[_0xff05('0x3a')]};return db['SmsMessage'][_0xff05('0x1f')](_0x5f5749)[_0xff05('0x23')](function(_0x5bb5a8){_0x41a175[_0xff05('0x1f')]=_0x5bb5a8;if(_0x58feb1[_0xff05('0x30')]['includeAll']){_0x34fc1f[_0xff05('0x3e')]=[{'all':!![]}];}return db[_0xff05('0x2a')][_0xff05('0x3f')](_0x34fc1f);})['then'](function(_0x31a220){_0x41a175[_0xff05('0x40')]=_0x31a220;return _0x41a175;})[_0xff05('0x23')](respondWithFilteredResult(_0x17ad3f,_0x34fc1f))['catch'](handleError(_0x17ad3f,null));};exports[_0xff05('0x41')]=function(_0x3fc847,_0x55ab13){var _0xa2b3bd={'raw':!![],'where':{'id':_0x3fc847[_0xff05('0x42')]['id']}},_0x3d8a6d={};_0x3d8a6d[_0xff05('0x2e')]=_['keys'](db[_0xff05('0x2a')][_0xff05('0x2b')]);_0x3d8a6d[_0xff05('0x30')]=_['keys'](_0x3fc847['query']);_0x3d8a6d[_0xff05('0x32')]=_[_0xff05('0x34')](_0x3d8a6d[_0xff05('0x2e')],_0x3d8a6d['query']);_0xa2b3bd['attributes']=_[_0xff05('0x34')](_0x3d8a6d[_0xff05('0x2e')],qs[_0xff05('0x35')](_0x3fc847[_0xff05('0x30')]['fields']));_0xa2b3bd[_0xff05('0x33')]=_0xa2b3bd[_0xff05('0x33')]['length']?_0xa2b3bd['attributes']:_0x3d8a6d['model'];if(_0x3fc847['query'][_0xff05('0x43')]){_0xa2b3bd[_0xff05('0x3e')]=[{'all':!![]}];}_0xa2b3bd=_[_0xff05('0x3d')]({},_0xa2b3bd,_0x3fc847[_0xff05('0x44')]);return db['SmsMessage'][_0xff05('0x45')](_0xa2b3bd)['then'](handleEntityNotFound(_0x55ab13,null))[_0xff05('0x23')](respondWithResult(_0x55ab13,null))[_0xff05('0x1a')](handleError(_0x55ab13,null));};exports[_0xff05('0x46')]=function(_0x397a44,_0xc19dfd){return db[_0xff05('0x2a')][_0xff05('0x46')](_0x397a44[_0xff05('0x47')],{})[_0xff05('0x23')](respondWithResult(_0xc19dfd,0xc9))[_0xff05('0x1a')](handleError(_0xc19dfd,null));};exports['update']=function(_0xe462a4,_0x30070a){if(_0xe462a4['body']['id']){delete _0xe462a4[_0xff05('0x47')]['id'];}return db[_0xff05('0x2a')][_0xff05('0x45')]({'where':{'id':_0xe462a4[_0xff05('0x42')]['id']}})[_0xff05('0x23')](handleEntityNotFound(_0x30070a,null))[_0xff05('0x23')](saveUpdates(_0xe462a4['body'],null))[_0xff05('0x23')](respondWithResult(_0x30070a,null))[_0xff05('0x1a')](handleError(_0x30070a,null));};exports[_0xff05('0x24')]=function(_0x5d6e2e,_0x3a7d1f){return db[_0xff05('0x2a')][_0xff05('0x45')]({'where':{'id':_0x5d6e2e['params']['id']}})[_0xff05('0x23')](handleEntityNotFound(_0x3a7d1f,null))[_0xff05('0x23')](removeEntity(_0x3a7d1f,null))[_0xff05('0x1a')](handleError(_0x3a7d1f,null));};exports['describe']=function(_0x283fac,_0x32cde2){return db['SmsMessage'][_0xff05('0x48')]()[_0xff05('0x23')](respondWithResult(_0x32cde2,null))['catch'](handleError(_0x32cde2,null));};exports[_0xff05('0x49')]=function(_0x2654c3,_0x3c7db9){var _0x50031c=_0xff05('0x4a');return interactionService[_0xff05('0x4b')](_0x2654c3,_0x50031c)[_0xff05('0x23')](respondWithResult(_0x3c7db9,null))[_0xff05('0x1a')](handleError(_0x3c7db9,null));};exports[_0xff05('0x4c')]=function(_0x5dc7a7,_0x24adfa){var _0x44e52e={'agent':{},'channel':_0xff05('0x4a')};if(_0x5dc7a7[_0xff05('0x47')]['id']){delete _0x5dc7a7['body']['id'];}_0x5dc7a7[_0xff05('0x47')][_0xff05('0x4d')]=_0x5dc7a7[_0xff05('0x47')]['UserId']||_0x5dc7a7['user']['id'];_0x44e52e[_0xff05('0x4e')]['id']=_0x5dc7a7[_0xff05('0x47')][_0xff05('0x4d')];return db[_0xff05('0x2a')][_0xff05('0x45')]({'where':{'id':_0x5dc7a7[_0xff05('0x42')]['id'],'UserId':null}})[_0xff05('0x23')](handleEntityNotFound(_0x24adfa,null))[_0xff05('0x23')](function(_0x5f16e0){if(_0x5f16e0){_0x44e52e['message']=_0x5f16e0[_0xff05('0x4f')]({'plain':!![]});return db[_0xff05('0x50')]['find']({'where':{'id':_0x5f16e0[_0xff05('0x51')]}});}return null;})['then'](handleEntityNotFound(_0x24adfa,null))[_0xff05('0x23')](function(_0x4c99b8){if(_0x4c99b8){_0x44e52e[_0xff05('0x52')]=_0x4c99b8[_0xff05('0x4f')]({'plain':!![]});interaction_log[_0xff05('0x11')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5dc7a7[_0xff05('0x53')]['id'],_0x5dc7a7[_0xff05('0x53')][_0xff05('0x27')],_0x5dc7a7[_0xff05('0x53')][_0xff05('0x54')],_0x44e52e[_0xff05('0x52')]['id'],_0x5dc7a7[_0xff05('0x47')]?JSON[_0xff05('0x15')](_0x5dc7a7['body']):_0xff05('0x55'));return respondWithRpcPromise('RejectMessage',_0xff05('0x56'),_0x44e52e);}return null;})[_0xff05('0x23')](function(_0xfeed25){var _0x4db8f1=_0xff05('0x57')+_0xfeed25[_0xff05('0x18')][_0xff05('0x58')];return db['sequelize'][_0xff05('0x30')](_0x4db8f1,{'type':db[_0xff05('0x59')][_0xff05('0x5a')]['SELECT'],'raw':!![]})[_0xff05('0x23')](function(_0xf6b4e0){return _0xf6b4e0;});})[_0xff05('0x23')](function(_0x3a3883){if(_0x3a3883){_0x44e52e[_0xff05('0x18')][_0xff05('0x5b')]=_0x3a3883[0x0];if(!_0x5dc7a7[_0xff05('0x47')][_0xff05('0x4d')])return;return db[_0xff05('0x5c')][_0xff05('0x45')]({'where':{'id':_0x5dc7a7['body'][_0xff05('0x4d')],'role':_0xff05('0x4e')},'attributes':['id',_0xff05('0x27'),'fullname',_0xff05('0x5d'),_0xff05('0x5e')],'raw':!![]});}return null;})[_0xff05('0x23')](function(_0x4e361f){if(!_0x4e361f)return null;_0x44e52e[_0xff05('0x18')][_0xff05('0x4e')]=_0x4e361f;return _0x44e52e;})[_0xff05('0x23')](function(_0x128803){if(_0x128803){_0x128803[_0xff05('0x18')][_0xff05('0x5f')]=util[_0xff05('0x60')](_0xff05('0x61'),_0x5dc7a7['user']['name']);_0x128803['message'][_0xff05('0x62')]=_0x44e52e[_0xff05('0x62')];_0x128803[_0xff05('0x18')][_0xff05('0x63')]=_0x44e52e[_0xff05('0x62')];_0x128803[_0xff05('0x18')][_0xff05('0x64')]='reject';respondWithRpcPromise('EventManager',_0xff05('0x65'),{'event':_0xff05('0x66'),'message':_0x128803[_0xff05('0x18')]},client9002);return _0x44e52e;}return null;})[_0xff05('0x23')](respondWithResult(_0x24adfa,null))['catch'](handleError(_0x24adfa,null));};exports[_0xff05('0x1b')]=function(_0x4574e4,_0x30eb21){if(_0x4574e4['body']['id']){delete _0x4574e4[_0xff05('0x47')]['id'];}var _0x505ce7;return db[_0xff05('0x2a')][_0xff05('0x45')]({'where':{'id':_0x4574e4[_0xff05('0x42')]['id']}})[_0xff05('0x23')](handleEntityNotFound(_0x30eb21,null))[_0xff05('0x23')](function(_0x14bb82){if(_0x14bb82){_0x505ce7=_0x14bb82;return db['SmsAccount'][_0xff05('0x45')]({'where':{'id':_0x14bb82['SmsAccountId']}});}})[_0xff05('0x23')](handleEntityNotFound(_0x30eb21,null))[_0xff05('0x23')](function(_0x16bad5){if(_0x16bad5){logger[_0xff05('0x13')](_0xff05('0x14'),_0xff05('0x1b'),_0xff05('0x67'),_0x16bad5[_0xff05('0x2d')],util[_0xff05('0x68')](_0x4574e4[_0xff05('0x47')],{'showHidden':![],'depth':null}));switch(_0x16bad5[_0xff05('0x2d')]){case _0xff05('0x69'):if(_0x4574e4[_0xff05('0x47')][_0xff05('0x6a')]&&_0x4574e4[_0xff05('0x47')][_0xff05('0x6a')]===_0x505ce7[_0xff05('0x6b')]){return _0x505ce7[_0xff05('0x22')]({'read':!![]});}else{logger[_0xff05('0x16')](_0xff05('0x6c'),_0xff05('0x1b'),_0xff05('0x69'),util[_0xff05('0x68')](_0x4574e4[_0xff05('0x47')],{'showHidden':![],'depth':null}));}break;case _0xff05('0x6d'):if(_0x4574e4[_0xff05('0x47')]['MessageUUID']&&_0x4574e4['body'][_0xff05('0x6e')]===_0x505ce7[_0xff05('0x6b')]&&_[_0xff05('0x6f')]([_0xff05('0x70'),'delivered'],_0x4574e4[_0xff05('0x47')]['Status'])>=0x0){return _0x505ce7[_0xff05('0x22')]({'read':!![]});}else{logger['error'](_0xff05('0x6c'),'status',_0xff05('0x71'),util[_0xff05('0x68')](_0x4574e4[_0xff05('0x47')],{'showHidden':![],'depth':null}));}break;case _0xff05('0x72'):var _0x2b1ec0=_0x4574e4[_0xff05('0x47')][_0xff05('0x73')][0x0];if(_0x2b1ec0[_0xff05('0x1b')][_0xff05('0x74')]===_0xff05('0x75')){return _0x505ce7['update']({'read':!![]});}else{logger['error'](_0xff05('0x6c'),_0xff05('0x1b'),'infobip',util[_0xff05('0x68')](_0x4574e4[_0xff05('0x47')],{'showHidden':![],'depth':null}));}break;}return _0x505ce7;}})[_0xff05('0x23')](respondWithResult(_0x30eb21,null))['catch'](handleError(_0x30eb21,null));}; \ No newline at end of file +var _0xd621=['type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','SmsMessage','includeAll','findAll','rows','show','params','keys','find','create','body','describe','accept','sms','UserId','user','interaction','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','format','SIP/%s','channel','motionChannel','reject','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','infobip','results','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','json','offset','undefined','limit','count','Content-Range','update','end','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x45d352,_0x121343){var _0x4178fd=function(_0x5666d4){while(--_0x5666d4){_0x45d352['push'](_0x45d352['shift']());}};_0x4178fd(++_0x121343);}(_0xd621,0x128));var _0x1d62=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0xd621[_0x24b477];return _0x4041a6;};'use strict';var util=require('util');var _=require(_0x1d62('0x0'));var Redis=require(_0x1d62('0x1'));var interactionService=require('../../components/interaction/service');var qs=require(_0x1d62('0x2'));var logger=require(_0x1d62('0x3'))(_0x1d62('0x4'));var config=require(_0x1d62('0x5'));var db=require(_0x1d62('0x6'))['db'];config[_0x1d62('0x7')]=_[_0x1d62('0x8')](config['redis'],{'host':_0x1d62('0x9'),'port':0x18eb});var socket=require(_0x1d62('0xa'))(new Redis(config['redis']));require(_0x1d62('0xb'))[_0x1d62('0xc')](socket);var jayson=require(_0x1d62('0xd'));var client=jayson[_0x1d62('0xe')][_0x1d62('0xf')]({'port':0x232c});var client9002=jayson[_0x1d62('0xe')][_0x1d62('0xf')]({'port':0x232a});var interaction_log=require(_0x1d62('0x3'))('sms-interactions');function respondWithRpcPromise(_0x40808b,_0x462aa3,_0x112ed6,_0x4f42e5){return new Promise(function(_0xbcb128,_0x1fa9cc){var _0x355557=_0x4f42e5||client;return _0x355557[_0x1d62('0x10')](_0x40808b,_0x112ed6)[_0x1d62('0x11')](function(_0x5a7a4e){logger['info'](_0x1d62('0x12'),_0x462aa3,_0x1d62('0x13'));logger['debug'](_0x1d62('0x14'),_0x462aa3,_0x1d62('0x13'),JSON['stringify'](_0x5a7a4e));if(_0x5a7a4e[_0x1d62('0x15')]){if(_0x5a7a4e[_0x1d62('0x15')][_0x1d62('0x16')]===0x1f4){logger['error'](_0x1d62('0x12'),_0x462aa3,_0x5a7a4e['error'][_0x1d62('0x17')]);return _0x1fa9cc(_0x5a7a4e[_0x1d62('0x15')][_0x1d62('0x17')]);}logger[_0x1d62('0x15')]('SmsMessage,\x20%s,\x20%s',_0x462aa3,_0x5a7a4e[_0x1d62('0x15')][_0x1d62('0x17')]);return _0xbcb128(_0x5a7a4e[_0x1d62('0x15')][_0x1d62('0x17')]);}else{logger[_0x1d62('0x18')](_0x1d62('0x12'),_0x462aa3,_0x1d62('0x13'));_0xbcb128(_0x5a7a4e[_0x1d62('0x19')][_0x1d62('0x17')]);}})[_0x1d62('0x1a')](function(_0x472570){logger[_0x1d62('0x15')]('SmsMessage,\x20%s,\x20%s',_0x462aa3,_0x472570);_0x1fa9cc(_0x472570);});});}function respondWithResult(_0x437964,_0x2eb3de){_0x2eb3de=_0x2eb3de||0xc8;return function(_0x314a20){if(_0x314a20){return _0x437964[_0x1d62('0x1b')](_0x2eb3de)[_0x1d62('0x1c')](_0x314a20);}};}function respondWithFilteredResult(_0x3a8f4f,_0x13d80d){return function(_0x2ff89e){if(_0x2ff89e){var _0x4841a0=typeof _0x13d80d[_0x1d62('0x1d')]===_0x1d62('0x1e')&&typeof _0x13d80d[_0x1d62('0x1f')]===_0x1d62('0x1e');var _0x2e3899=_0x2ff89e[_0x1d62('0x20')];var _0x1c40c1=_0x4841a0?0x0:_0x13d80d[_0x1d62('0x1d')];var _0x50dbec=_0x4841a0?_0x2ff89e[_0x1d62('0x20')]:_0x13d80d[_0x1d62('0x1d')]+_0x13d80d['limit'];var _0x64fc68;if(_0x50dbec>=_0x2e3899){_0x50dbec=_0x2e3899;_0x64fc68=0xc8;}else{_0x64fc68=0xce;}_0x3a8f4f[_0x1d62('0x1b')](_0x64fc68);return _0x3a8f4f['set'](_0x1d62('0x21'),_0x1c40c1+'-'+_0x50dbec+'/'+_0x2e3899)[_0x1d62('0x1c')](_0x2ff89e);}return null;};}function saveUpdates(_0x2a3bbf){return function(_0x5f5bf6){if(_0x5f5bf6){return _0x5f5bf6[_0x1d62('0x22')](_0x2a3bbf)[_0x1d62('0x11')](function(_0x4fc15c){return _0x4fc15c;});}return null;};}function removeEntity(_0x530d59){return function(_0x545d1e){if(_0x545d1e){return _0x545d1e['destroy']()[_0x1d62('0x11')](function(){_0x530d59[_0x1d62('0x1b')](0xcc)[_0x1d62('0x23')]();});}};}function handleEntityNotFound(_0x3c3ae4){return function(_0x32f4a1){if(!_0x32f4a1){_0x3c3ae4['sendStatus'](0x194);}return _0x32f4a1;};}function handleError(_0x1a5000,_0x3146c8){_0x3146c8=_0x3146c8||0x1f4;return function(_0x13f352){logger[_0x1d62('0x15')](_0x13f352[_0x1d62('0x24')]);if(_0x13f352[_0x1d62('0x25')]){delete _0x13f352[_0x1d62('0x25')];}_0x1a5000[_0x1d62('0x1b')](_0x3146c8)[_0x1d62('0x26')](_0x13f352);};}exports[_0x1d62('0x27')]=function(_0x192e80,_0x465949){var _0x462de8={},_0x1dfcf6={},_0x43d005={'count':0x0,'rows':[]};var _0x5bd28b=_[_0x1d62('0x28')](db['SmsMessage'][_0x1d62('0x29')],function(_0x3cc68a){return{'name':_0x3cc68a[_0x1d62('0x2a')],'type':_0x3cc68a[_0x1d62('0x2b')]['key']};});_0x1dfcf6[_0x1d62('0x2c')]=_['map'](_0x5bd28b,'name');_0x1dfcf6['query']=_['keys'](_0x192e80[_0x1d62('0x2d')]);_0x1dfcf6[_0x1d62('0x2e')]=_[_0x1d62('0x2f')](_0x1dfcf6[_0x1d62('0x2c')],_0x1dfcf6[_0x1d62('0x2d')]);_0x462de8[_0x1d62('0x30')]=_['intersection'](_0x1dfcf6[_0x1d62('0x2c')],qs['fields'](_0x192e80[_0x1d62('0x2d')][_0x1d62('0x31')]));_0x462de8[_0x1d62('0x30')]=_0x462de8[_0x1d62('0x30')][_0x1d62('0x32')]?_0x462de8[_0x1d62('0x30')]:_0x1dfcf6['model'];if(!_0x192e80['query'][_0x1d62('0x33')](_0x1d62('0x34'))){_0x462de8['limit']=qs['limit'](_0x192e80[_0x1d62('0x2d')][_0x1d62('0x1f')]);_0x462de8[_0x1d62('0x1d')]=qs[_0x1d62('0x1d')](_0x192e80['query']['offset']);}_0x462de8[_0x1d62('0x35')]=qs['sort'](_0x192e80[_0x1d62('0x2d')][_0x1d62('0x36')]);_0x462de8['where']=qs[_0x1d62('0x2e')](_[_0x1d62('0x37')](_0x192e80[_0x1d62('0x2d')],_0x1dfcf6[_0x1d62('0x2e')]),_0x5bd28b);if(_0x192e80[_0x1d62('0x2d')]['filter']){_0x462de8[_0x1d62('0x38')]=_[_0x1d62('0x39')](_0x462de8['where'],{'$or':_['map'](_0x5bd28b,function(_0x391c21){if(_0x391c21[_0x1d62('0x2b')]!==_0x1d62('0x3a')){var _0x44a400={};_0x44a400[_0x391c21[_0x1d62('0x25')]]={'$like':'%'+_0x192e80[_0x1d62('0x2d')][_0x1d62('0x3b')]+'%'};return _0x44a400;}})});}_0x462de8=_[_0x1d62('0x39')]({},_0x462de8,_0x192e80[_0x1d62('0x3c')]);var _0x33a4e8={'where':_0x462de8[_0x1d62('0x38')]};return db[_0x1d62('0x3d')][_0x1d62('0x20')](_0x33a4e8)[_0x1d62('0x11')](function(_0x1efb2f){_0x43d005[_0x1d62('0x20')]=_0x1efb2f;if(_0x192e80[_0x1d62('0x2d')][_0x1d62('0x3e')]){_0x462de8['include']=[{'all':!![]}];}return db['SmsMessage'][_0x1d62('0x3f')](_0x462de8);})['then'](function(_0x1966c8){_0x43d005[_0x1d62('0x40')]=_0x1966c8;return _0x43d005;})[_0x1d62('0x11')](respondWithFilteredResult(_0x465949,_0x462de8))[_0x1d62('0x1a')](handleError(_0x465949,null));};exports[_0x1d62('0x41')]=function(_0x294b2f,_0x1dab1f){var _0xfddcfd={'raw':!![],'where':{'id':_0x294b2f[_0x1d62('0x42')]['id']}},_0x221267={};_0x221267['model']=_[_0x1d62('0x43')](db['SmsMessage'][_0x1d62('0x29')]);_0x221267['query']=_['keys'](_0x294b2f[_0x1d62('0x2d')]);_0x221267[_0x1d62('0x2e')]=_[_0x1d62('0x2f')](_0x221267[_0x1d62('0x2c')],_0x221267[_0x1d62('0x2d')]);_0xfddcfd[_0x1d62('0x30')]=_[_0x1d62('0x2f')](_0x221267[_0x1d62('0x2c')],qs[_0x1d62('0x31')](_0x294b2f[_0x1d62('0x2d')][_0x1d62('0x31')]));_0xfddcfd[_0x1d62('0x30')]=_0xfddcfd[_0x1d62('0x30')][_0x1d62('0x32')]?_0xfddcfd[_0x1d62('0x30')]:_0x221267[_0x1d62('0x2c')];if(_0x294b2f[_0x1d62('0x2d')]['includeAll']){_0xfddcfd['include']=[{'all':!![]}];}_0xfddcfd=_['merge']({},_0xfddcfd,_0x294b2f[_0x1d62('0x3c')]);return db[_0x1d62('0x3d')][_0x1d62('0x44')](_0xfddcfd)['then'](handleEntityNotFound(_0x1dab1f,null))['then'](respondWithResult(_0x1dab1f,null))[_0x1d62('0x1a')](handleError(_0x1dab1f,null));};exports[_0x1d62('0x45')]=function(_0x26d3ab,_0x54448b){return db[_0x1d62('0x3d')][_0x1d62('0x45')](_0x26d3ab[_0x1d62('0x46')],{})[_0x1d62('0x11')](respondWithResult(_0x54448b,0xc9))['catch'](handleError(_0x54448b,null));};exports['update']=function(_0x447606,_0x2335f6){if(_0x447606[_0x1d62('0x46')]['id']){delete _0x447606[_0x1d62('0x46')]['id'];}return db[_0x1d62('0x3d')][_0x1d62('0x44')]({'where':{'id':_0x447606[_0x1d62('0x42')]['id']}})[_0x1d62('0x11')](handleEntityNotFound(_0x2335f6,null))[_0x1d62('0x11')](saveUpdates(_0x447606[_0x1d62('0x46')],null))[_0x1d62('0x11')](respondWithResult(_0x2335f6,null))['catch'](handleError(_0x2335f6,null));};exports['destroy']=function(_0x35c942,_0x3961cd){return db['SmsMessage'][_0x1d62('0x44')]({'where':{'id':_0x35c942[_0x1d62('0x42')]['id']}})[_0x1d62('0x11')](handleEntityNotFound(_0x3961cd,null))[_0x1d62('0x11')](removeEntity(_0x3961cd,null))['catch'](handleError(_0x3961cd,null));};exports[_0x1d62('0x47')]=function(_0x3074c4,_0x5a08ff){return db[_0x1d62('0x3d')][_0x1d62('0x47')]()[_0x1d62('0x11')](respondWithResult(_0x5a08ff,null))[_0x1d62('0x1a')](handleError(_0x5a08ff,null));};exports[_0x1d62('0x48')]=function(_0x5e9487,_0x4802c8){var _0x571184=_0x1d62('0x49');return interactionService['acceptMessage'](_0x5e9487,_0x571184)['then'](respondWithResult(_0x4802c8,null))['catch'](handleError(_0x4802c8,null));};exports['reject']=function(_0xfe00c9,_0x3a702d){var _0x11be48={'agent':{},'channel':'sms'};if(_0xfe00c9[_0x1d62('0x46')]['id']){delete _0xfe00c9['body']['id'];}_0xfe00c9['body'][_0x1d62('0x4a')]=_0xfe00c9[_0x1d62('0x46')]['UserId']||_0xfe00c9[_0x1d62('0x4b')]['id'];_0x11be48['agent']['id']=_0xfe00c9[_0x1d62('0x46')]['UserId'];return db[_0x1d62('0x3d')]['find']({'where':{'id':_0xfe00c9[_0x1d62('0x42')]['id'],'UserId':null}})[_0x1d62('0x11')](handleEntityNotFound(_0x3a702d,null))[_0x1d62('0x11')](function(_0x1a7b92){if(_0x1a7b92){_0x11be48[_0x1d62('0x17')]=_0x1a7b92['get']({'plain':!![]});return db['SmsInteraction'][_0x1d62('0x44')]({'where':{'id':_0x1a7b92['SmsInteractionId']}});}return null;})[_0x1d62('0x11')](handleEntityNotFound(_0x3a702d,null))[_0x1d62('0x11')](function(_0x5064dd){if(_0x5064dd){_0x11be48[_0x1d62('0x4c')]=_0x5064dd[_0x1d62('0x4d')]({'plain':!![]});interaction_log[_0x1d62('0x18')](_0x1d62('0x4e'),_0xfe00c9[_0x1d62('0x4b')]['id'],_0xfe00c9[_0x1d62('0x4b')][_0x1d62('0x25')],_0xfe00c9[_0x1d62('0x4b')][_0x1d62('0x4f')],_0x11be48[_0x1d62('0x4c')]['id'],_0xfe00c9[_0x1d62('0x46')]?JSON[_0x1d62('0x50')](_0xfe00c9[_0x1d62('0x46')]):_0x1d62('0x51'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x11be48);}return null;})['then'](function(_0x330b15){var _0x3db1fd=_0x1d62('0x52')+_0x330b15[_0x1d62('0x17')]['ContactId'];return db[_0x1d62('0x53')][_0x1d62('0x2d')](_0x3db1fd,{'type':db[_0x1d62('0x54')][_0x1d62('0x55')]['SELECT'],'raw':!![]})['then'](function(_0x13c42d){return _0x13c42d;});})[_0x1d62('0x11')](function(_0x15eb30){if(_0x15eb30){_0x11be48[_0x1d62('0x17')][_0x1d62('0x56')]=_0x15eb30[0x0];if(!_0xfe00c9[_0x1d62('0x46')][_0x1d62('0x4a')])return;return db[_0x1d62('0x57')]['find']({'where':{'id':_0xfe00c9[_0x1d62('0x46')][_0x1d62('0x4a')],'role':_0x1d62('0x58')},'attributes':['id',_0x1d62('0x25'),_0x1d62('0x59'),_0x1d62('0x5a'),'internal'],'raw':!![]});}return null;})[_0x1d62('0x11')](function(_0x3d72ee){if(!_0x3d72ee)return null;_0x11be48[_0x1d62('0x17')][_0x1d62('0x58')]=_0x3d72ee;return _0x11be48;})[_0x1d62('0x11')](function(_0x3c4498){if(_0x3c4498){_0x3c4498[_0x1d62('0x17')]['interface']=util[_0x1d62('0x5b')](_0x1d62('0x5c'),_0xfe00c9[_0x1d62('0x4b')][_0x1d62('0x25')]);_0x3c4498['message'][_0x1d62('0x5d')]=_0x11be48[_0x1d62('0x5d')];_0x3c4498[_0x1d62('0x17')][_0x1d62('0x5e')]=_0x11be48[_0x1d62('0x5d')];_0x3c4498['message']['event']=_0x1d62('0x5f');respondWithRpcPromise(_0x1d62('0x60'),_0x1d62('0x60'),{'event':_0x1d62('0x61'),'message':_0x3c4498['message']},client9002);return _0x11be48;}return null;})[_0x1d62('0x11')](respondWithResult(_0x3a702d,null))[_0x1d62('0x1a')](handleError(_0x3a702d,null));};exports[_0x1d62('0x1b')]=function(_0x68355b,_0x36a5ad){if(_0x68355b[_0x1d62('0x46')]['id']){delete _0x68355b['body']['id'];}var _0x4b0170;return db['SmsMessage'][_0x1d62('0x44')]({'where':{'id':_0x68355b[_0x1d62('0x42')]['id']}})[_0x1d62('0x11')](handleEntityNotFound(_0x36a5ad,null))[_0x1d62('0x11')](function(_0x4925b0){if(_0x4925b0){_0x4b0170=_0x4925b0;return db[_0x1d62('0x62')]['find']({'where':{'id':_0x4925b0[_0x1d62('0x63')]}});}})[_0x1d62('0x11')](handleEntityNotFound(_0x36a5ad,null))[_0x1d62('0x11')](function(_0x4122a4){if(_0x4122a4){logger[_0x1d62('0x64')](_0x1d62('0x14'),_0x1d62('0x1b'),'received\x20delivery\x20report\x20from',_0x4122a4[_0x1d62('0x2b')],util[_0x1d62('0x65')](_0x68355b[_0x1d62('0x46')],{'showHidden':![],'depth':null}));switch(_0x4122a4[_0x1d62('0x2b')]){case _0x1d62('0x66'):if(_0x68355b[_0x1d62('0x46')][_0x1d62('0x67')]&&_0x68355b[_0x1d62('0x46')]['MessageSid']===_0x4b0170[_0x1d62('0x68')]){return _0x4b0170[_0x1d62('0x22')]({'read':!![]});}else{logger[_0x1d62('0x15')](_0x1d62('0x69'),'status',_0x1d62('0x66'),util['inspect'](_0x68355b[_0x1d62('0x46')],{'showHidden':![],'depth':null}));}break;case _0x1d62('0x6a'):if(_0x68355b[_0x1d62('0x46')][_0x1d62('0x6b')]&&_0x68355b[_0x1d62('0x46')][_0x1d62('0x6b')]===_0x4b0170[_0x1d62('0x68')]&&_['indexOf']([_0x1d62('0x6c'),_0x1d62('0x6d')],_0x68355b['body'][_0x1d62('0x6e')])>=0x0){return _0x4b0170[_0x1d62('0x22')]({'read':!![]});}else{logger[_0x1d62('0x15')](_0x1d62('0x69'),_0x1d62('0x1b'),'plivio',util['inspect'](_0x68355b[_0x1d62('0x46')],{'showHidden':![],'depth':null}));}break;case _0x1d62('0x6f'):var _0x2e9a39=_0x68355b[_0x1d62('0x46')][_0x1d62('0x70')][0x0];if(_0x2e9a39['status']['groupName']==='DELIVERED'){return _0x4b0170['update']({'read':!![]});}else{logger[_0x1d62('0x15')](_0x1d62('0x69'),_0x1d62('0x1b'),'infobip',util[_0x1d62('0x65')](_0x68355b['body'],{'showHidden':![],'depth':null}));}break;}return _0x4b0170;}})[_0x1d62('0x11')](respondWithResult(_0x36a5ad,null))['catch'](handleError(_0x36a5ad,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index be35646..5e7d85e 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 _0x07f2=['emit','hasOwnProperty','hook','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x07f2,0x1c5));var _0x207f=function(_0x238387,_0x5c51c6){_0x238387=_0x238387-0x0;var _0x3b5e7a=_0x07f2[_0x238387];return _0x3b5e7a;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x207f('0x0'))['db'][_0x207f('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x207f('0x2')](0x0);var events={'afterCreate':_0x207f('0x3'),'afterUpdate':_0x207f('0x4'),'afterDestroy':_0x207f('0x5')};function emitEvent(_0x149d70){return function(_0x101c02,_0xd41a64,_0x51af54){SmsMessageEvents[_0x207f('0x6')](_0x149d70+':'+_0x101c02['id'],_0x101c02);SmsMessageEvents['emit'](_0x149d70,_0x101c02);_0x51af54(null);};}for(var e in events){if(events[_0x207f('0x7')](e)){var event=events[e];SmsMessage[_0x207f('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x1c54=['../../mysqldb','remove','emit','hasOwnProperty','hook','exports'];(function(_0x18fd21,_0x4af3d1){var _0x113f67=function(_0x45b480){while(--_0x45b480){_0x18fd21['push'](_0x18fd21['shift']());}};_0x113f67(++_0x4af3d1);}(_0x1c54,0xcc));var _0x41c5=function(_0x545eb3,_0x2d590c){_0x545eb3=_0x545eb3-0x0;var _0x24beed=_0x1c54[_0x545eb3];return _0x24beed;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x41c5('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x41c5('0x1')};function emitEvent(_0x328b86){return function(_0x1b18be,_0x2ddeb9,_0x425963){SmsMessageEvents[_0x41c5('0x2')](_0x328b86+':'+_0x1b18be['id'],_0x1b18be);SmsMessageEvents['emit'](_0x328b86,_0x1b18be);_0x425963(null);};}for(var e in events){if(events[_0x41c5('0x3')](e)){var event=events[e];SmsMessage[_0x41c5('0x4')](e,emitEvent(event));}}module[_0x41c5('0x5')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index adffb41..a1ed7ec 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 _0xcc27=['total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','http_code','data','queued_count','head','message_id','clickSend','authId','toString','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','/auth/1/session','application/json','infobip','Missing\x20parameters:\x20base_url','csc','crypto','login','sender','text','timestamp','keys','length','apiKey','createHash','md5','hex','signature=','baseUrl','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','accountId','/messages','applicationId','bandwidth','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch','error','SmsAccount','find','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','GET','sms','POST','user_key','session_key'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xcc27,0xbe));var _0x7cc2=function(_0x46dfca,_0x2f7f9c){_0x46dfca=_0x46dfca-0x0;var _0x5defd7=_0xcc27[_0x46dfca];return _0x5defd7;};'use strict';var _=require(_0x7cc2('0x0'));var util=require(_0x7cc2('0x1'));var logger=require(_0x7cc2('0x2'))(_0x7cc2('0x3'));var moment=require(_0x7cc2('0x4'));var BPromise=require(_0x7cc2('0x5'));var rp=require(_0x7cc2('0x6'));var fs=require('fs');var path=require(_0x7cc2('0x7'));var rimraf=require('rimraf');var config=require(_0x7cc2('0x8'));var attributes=require(_0x7cc2('0x9'));module['exports']=function(_0xabc502,_0x27af23){return _0xabc502[_0x7cc2('0xa')]('SmsMessage',attributes,{'tableName':_0x7cc2('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x7cc2('0xc')]},{'name':_0x7cc2('0xd'),'fields':[_0x7cc2('0xe')],'type':_0x7cc2('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x445f28,_0x104cd9,_0x20fc4f){var _0x4591b6=_0xabc502[_0x7cc2('0x10')];var _0x21b268=_0x445f28['get']({'plain':!![]});if(_0x21b268[_0x7cc2('0x11')][_0x7cc2('0x12')]()==='in'||_0x21b268[_0x7cc2('0x11')][_0x7cc2('0x12')]()===_0x7cc2('0x13')&&!_0x21b268[_0x7cc2('0x14')]&&!_['isNil'](_0x21b268[_0x7cc2('0x15')])&&!_['isNil'](_0x21b268[_0x7cc2('0x16')])){_0x4591b6[_0x7cc2('0x17')][_0x7cc2('0x18')]({'where':{'id':_0x21b268[_0x7cc2('0x16')]}})[_0x7cc2('0x19')](function(_0x4411ca){if(_0x4411ca){_0x4411ca['update']({'lastMsgAt':_0x21b268[_0x7cc2('0x1a')],'lastMsgDirection':_0x21b268[_0x7cc2('0x11')]['toLowerCase']()});}})[_0x7cc2('0x1b')](function(_0x40ac0e){console[_0x7cc2('0x1c')](_0x40ac0e);});}if(_0x21b268[_0x7cc2('0x11')]===_0x7cc2('0x13')&&!_0x21b268[_0x7cc2('0x14')]){var _0x2c8ad0;_0x4591b6[_0x7cc2('0x1d')][_0x7cc2('0x1e')]({'where':{'id':_0x21b268['SmsAccountId']},'raw':!![]})['then'](function(_0x570be9){_0x2c8ad0=_0x570be9;if(_0x2c8ad0&&_0x2c8ad0[_0x7cc2('0x1f')]){switch(_0x2c8ad0[_0x7cc2('0x1f')]){case _0x7cc2('0x20'):var _0x133203=require(_0x7cc2('0x20'));if(_0x2c8ad0[_0x7cc2('0x21')]&&_0x2c8ad0['authToken']&&_0x2c8ad0[_0x7cc2('0x22')]){var _0xfe0afc=new _0x133203(_0x2c8ad0[_0x7cc2('0x21')],_0x2c8ad0[_0x7cc2('0x23')]);_0xfe0afc[_0x7cc2('0x24')][_0x7cc2('0x25')]({'body':_0x21b268[_0x7cc2('0xe')],'to':_0x21b268[_0x7cc2('0x22')],'from':_0x2c8ad0[_0x7cc2('0x22')],'statusCallback':_0x2c8ad0[_0x7cc2('0x26')]+_0x7cc2('0x27')+_0x21b268['id']+_0x7cc2('0x28')+_0x2c8ad0[_0x7cc2('0x29')]})[_0x7cc2('0x19')](function(_0x5b1f85){if(_0x5b1f85[_0x7cc2('0x2a')]){return _0x445f28[_0x7cc2('0x2b')]({'messageId':_0x5b1f85[_0x7cc2('0x2a')]});}})[_0x7cc2('0x1b')](function(_0x1740ea){logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x20'),util['inspect'](_0x1740ea,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),'afterCreate','twilio',_0x7cc2('0x2e'));}break;case _0x7cc2('0x2f'):var _0x33e5da=_0x7cc2('0x30');if(_0x2c8ad0[_0x7cc2('0x31')]&&_0x2c8ad0[_0x7cc2('0x32')]){var _0x39c981={'recipient':[_0x21b268['phone']],'message':_0x21b268['body'],'message_type':_0x2c8ad0[_0x7cc2('0x33')]};if(_0x2c8ad0['smsMethod']&&_0x2c8ad0[_0x7cc2('0x33')]!=='SI'){_0x39c981['sender']=_0x2c8ad0['phone'];}var _0x370e00={'url':_0x33e5da+_0x7cc2('0x34')+_0x2c8ad0[_0x7cc2('0x31')]+'&password='+_0x2c8ad0[_0x7cc2('0x32')],'method':_0x7cc2('0x35')};rp(_0x370e00)[_0x7cc2('0x19')](function(_0x4de9bd){var _0x365d56=_0x4de9bd['split'](';');var _0x59147d={'user_key':_0x365d56[0x0],'session_key':_0x365d56[0x1]};_0x370e00={'url':_0x33e5da+_0x7cc2('0x36'),'method':_0x7cc2('0x37'),'headers':{'user_key':_0x59147d[_0x7cc2('0x38')],'Session_key':_0x59147d[_0x7cc2('0x39')]},'json':!![],'body':_0x39c981};return rp(_0x370e00);})[_0x7cc2('0x19')](function(_0x44fab2){if(_0x44fab2[_0x7cc2('0x3a')]>=0x1){var _0x4ef2aa={'messageId':_0x44fab2[_0x7cc2('0x3b')]};if(_0x2c8ad0[_0x7cc2('0x33')]!=='GP'||!_0x2c8ad0[_0x7cc2('0x3c')]){_0x4ef2aa[_0x7cc2('0x3d')]=!![];}return _0x445f28[_0x7cc2('0x2b')](_0x4ef2aa);}else{return logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x2f'),util[_0x7cc2('0x3e')](_0x44fab2,{'showHidden':![],'depth':null}));}})[_0x7cc2('0x1b')](function(_0x350843){return logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x2f'),util[_0x7cc2('0x3e')](_0x350843,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),'skebby',_0x7cc2('0x3f'));}break;case _0x7cc2('0x40'):if(_0x2c8ad0[_0x7cc2('0x23')]){var _0xa9ab30={'recipient':_0x21b268['phone'],'message':_0x21b268[_0x7cc2('0xe')],'sender':_0x2c8ad0[_0x7cc2('0x41')]||_0x2c8ad0['phone'],'authorization':_0x2c8ad0['authToken']};var _0x104cd9={'method':_0x7cc2('0x37'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0xa9ab30,'json':!![]};rp(_0x104cd9)['then'](function(_0x5774f7){var _0x363ff3={'messageId':_0x5774f7[_0x7cc2('0x42')]};if(!_0x2c8ad0[_0x7cc2('0x3c')]){_0x363ff3[_0x7cc2('0x3d')]=!![];}return _0x445f28[_0x7cc2('0x2b')](_0x363ff3);})[_0x7cc2('0x1b')](function(_0x423117){logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),'afterCreate',_0x7cc2('0x40'),util[_0x7cc2('0x3e')](_0x423117,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x40'),'Missing\x20parameters:\x20authToken');}break;case _0x7cc2('0x43'):if(_0x2c8ad0[_0x7cc2('0x31')]&&_0x2c8ad0[_0x7cc2('0x32')]){var _0xa9ab30={'messages':[{'source':'xCALLY\x20Motion','to':_0x21b268[_0x7cc2('0x22')],'body':_0x21b268[_0x7cc2('0xe')],'from':_0x2c8ad0['senderString']||_0x2c8ad0[_0x7cc2('0x22')]}]};var _0x4b5da4=util[_0x7cc2('0x44')](_0x7cc2('0x45'),_0x2c8ad0[_0x7cc2('0x31')],_0x2c8ad0[_0x7cc2('0x32')]);var _0x104cd9={'method':_0x7cc2('0x37'),'uri':_0x7cc2('0x46'),'body':_0xa9ab30,'headers':{'Authorization':util[_0x7cc2('0x44')](_0x7cc2('0x47'),new Buffer(_0x4b5da4)['toString']('base64'))},'json':!![]};rp(_0x104cd9)['then'](function(_0x4aca7c){if(_0x4aca7c[_0x7cc2('0x48')]>=0xc8&&_0x4aca7c[_0x7cc2('0x48')]<=0xce){if(_0x4aca7c[_0x7cc2('0x49')]&&_0x4aca7c[_0x7cc2('0x49')][_0x7cc2('0x4a')]>0x0){var _0x3f5873=_[_0x7cc2('0x4b')](_0x4aca7c[_0x7cc2('0x49')][_0x7cc2('0x24')]);var _0x4f1424={'messageId':_0x3f5873[_0x7cc2('0x4c')]};if(!_0x2c8ad0[_0x7cc2('0x3c')]){_0x4f1424[_0x7cc2('0x3d')]=!![];}return _0x445f28[_0x7cc2('0x2b')](_0x4f1424);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x4d'),util[_0x7cc2('0x3e')](_0x4aca7c,{'showHidden':![],'depth':null}));}}else{logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x4d'),util[_0x7cc2('0x3e')](_0x4aca7c,{'showHidden':![],'depth':null}));}})[_0x7cc2('0x1b')](function(_0x33a6d4){logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x4d'),util['inspect'](_0x33a6d4,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),'clickSend',_0x7cc2('0x3f'));}break;case'plivo':if(_0x2c8ad0[_0x7cc2('0x4e')]&&_0x2c8ad0['authToken']){var _0xa9ab30={'dst':_0x21b268['phone'],'text':_0x21b268[_0x7cc2('0xe')],'src':_0x2c8ad0[_0x7cc2('0x41')]||_0x2c8ad0[_0x7cc2('0x22')],'url':_0x2c8ad0['remote']+_0x7cc2('0x27')+_0x21b268['id']+'/status?token='+_0x2c8ad0[_0x7cc2('0x29')]};var _0x4b5da4=util[_0x7cc2('0x44')](_0x7cc2('0x45'),_0x2c8ad0['authId'],_0x2c8ad0[_0x7cc2('0x23')]);var _0x104cd9={'method':_0x7cc2('0x37'),'uri':util[_0x7cc2('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x2c8ad0[_0x7cc2('0x4e')]),'body':_0xa9ab30,'headers':{'Authorization':util[_0x7cc2('0x44')](_0x7cc2('0x47'),new Buffer(_0x4b5da4)[_0x7cc2('0x4f')](_0x7cc2('0x50')))},'json':!![]};rp(_0x104cd9)[_0x7cc2('0x19')](function(_0x21343c){var _0x12b629={'messageId':_0x21343c[_0x7cc2('0x51')][0x0]};return _0x445f28[_0x7cc2('0x2b')](_0x12b629);})[_0x7cc2('0x1b')](function(_0x5485a4){logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),'afterCreate',_0x7cc2('0x52'),util[_0x7cc2('0x3e')](_0x5485a4,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),'plivo',_0x7cc2('0x53'));}break;case'infobip':if(_0x2c8ad0[_0x7cc2('0x31')]&&_0x2c8ad0[_0x7cc2('0x32')]){if(_0x2c8ad0['baseUrl']){var _0x30edd2={'method':_0x7cc2('0x37'),'uri':_0x2c8ad0['baseUrl']+_0x7cc2('0x54'),'body':{'username':_0x2c8ad0[_0x7cc2('0x31')],'password':_0x2c8ad0['password']},'json':!![]};return rp(_0x30edd2)[_0x7cc2('0x19')](function(_0x1aec49){var _0x3f4e32={'method':'POST','uri':_0x2c8ad0['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x2c8ad0[_0x7cc2('0x22')],'destinations':[{'to':_0x21b268[_0x7cc2('0x22')]}],'text':_0x21b268[_0x7cc2('0xe')],'notifyUrl':_0x2c8ad0[_0x7cc2('0x26')]+_0x7cc2('0x27')+_0x21b268['id']+_0x7cc2('0x28')+_0x2c8ad0['token'],'notifyContentType':_0x7cc2('0x55'),'callbackData':_0x2c8ad0[_0x7cc2('0x22')]+';'+_0x21b268[_0x7cc2('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x1aec49[_0x7cc2('0x29')]},'json':!![]};return rp(_0x3f4e32)[_0x7cc2('0x19')](function(_0x1e474f){if(_0x1e474f[_0x7cc2('0x24')]){var _0x2004a2={'messageId':_0x1e474f[_0x7cc2('0x24')][0x0][_0x7cc2('0xc')]};if(!_0x2c8ad0[_0x7cc2('0x3c')]){_0x2004a2[_0x7cc2('0x3d')]=!![];}return _0x445f28[_0x7cc2('0x2b')](_0x2004a2);}else{return logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x56'),util['inspect'](_0x1e474f,{'showHidden':![],'depth':null}));}});})[_0x7cc2('0x1b')](function(_0x4db180){return logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x56'),util[_0x7cc2('0x3e')](_0x4db180,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x56'),_0x7cc2('0x57'));}}else{logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x56'),_0x7cc2('0x3f'));}break;case _0x7cc2('0x58'):var _0x2d4b66=require(_0x7cc2('0x59'));if(_0x2c8ad0['apiKey']){var _0x12e520={};_0x12e520[_0x7cc2('0x5a')]=_0x2c8ad0[_0x7cc2('0x31')];_0x12e520['phone']=_0x21b268[_0x7cc2('0x22')];_0x12e520[_0x7cc2('0x5b')]=_0x2c8ad0[_0x7cc2('0x22')];_0x12e520[_0x7cc2('0x5c')]=_0x21b268[_0x7cc2('0xe')];_0x12e520[_0x7cc2('0x5d')]=+new Date();var _0x491823='';var _0xd9e5a3='';var _0x11ad87=Object[_0x7cc2('0x5e')](_0x12e520);_0x11ad87['sort']();for(var _0x4185a5=0x0;_0x4185a5<_0x11ad87[_0x7cc2('0x5f')];_0x4185a5++){if(_0x491823!=''){_0x491823+='&';}_0x491823+=_0x11ad87[_0x4185a5]+'='+encodeURIComponent(_0x12e520[_0x11ad87[_0x4185a5]]);_0xd9e5a3+=_0x12e520[_0x11ad87[_0x4185a5]];}_0xd9e5a3+=_0x2c8ad0[_0x7cc2('0x60')];_0xd9e5a3=_0x2d4b66[_0x7cc2('0x61')](_0x7cc2('0x62'))[_0x7cc2('0x2b')](_0xd9e5a3)['digest'](_0x7cc2('0x63'));if(_0x491823!==''){_0x491823+='&';}_0x491823+=_0x7cc2('0x64')+_0xd9e5a3;var _0x370e00={'method':_0x7cc2('0x35'),'uri':_0x2c8ad0[_0x7cc2('0x65')]+_0x7cc2('0x66')+_0x491823,'json':!![]};return rp(_0x370e00)[_0x7cc2('0x19')](function(_0x1d9c1c){var _0x3af2e5=Object[_0x7cc2('0x5e')](_0x1d9c1c);if(_0x1d9c1c[_0x3af2e5[0x0]][_0x7cc2('0x1c')]&&parseInt(_0x1d9c1c[_0x3af2e5[0x0]][_0x7cc2('0x1c')])===0x0){var _0x3f4234={'messageId':_0x1d9c1c[_0x3af2e5[0x0]][_0x7cc2('0x67')]};if(!_0x2c8ad0[_0x7cc2('0x3c')]){_0x3f4234[_0x7cc2('0x3d')]=!![];}return _0x445f28[_0x7cc2('0x2b')](_0x3f4234);}else{return logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x58'),util[_0x7cc2('0x3e')](_0x1d9c1c['error'],{'showHidden':![],'depth':null}));}})[_0x7cc2('0x1b')](function(_0x288484){return logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x58'),util['inspect'](_0x288484,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x58'),_0x7cc2('0x68'));}break;case _0x7cc2('0x69'):if(_0x2c8ad0['apiKey']){var _0x3cb428={'method':_0x7cc2('0x37'),'uri':_0x7cc2('0x6a'),'headers':{'Authorization':_0x2c8ad0['apiKey']},'body':{'content':_0x21b268[_0x7cc2('0xe')],'to':[_0x21b268[_0x7cc2('0x22')]],'from':_0x2c8ad0[_0x7cc2('0x22')],'binary':![],'clientMessageId':_0x7cc2('0x6b'),'charset':_0x7cc2('0x6c')},'json':!![]};rp(_0x3cb428)['then'](function(_0x138a6a){if(!_0x138a6a['error']){var _0x2c19a3={'messageId':_0x138a6a[_0x7cc2('0x24')][0x0][_0x7cc2('0x6d')]};if(!_0x2c8ad0[_0x7cc2('0x3c')]){_0x2c19a3[_0x7cc2('0x3d')]=!![];}return _0x445f28[_0x7cc2('0x2b')](_0x2c19a3);}else{return logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x69'),util[_0x7cc2('0x3e')](_0x138a6a['error'],{'showHidden':![],'depth':null}));}})[_0x7cc2('0x1b')](function(_0x379518){return logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x69'),util['inspect'](_0x379518,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc2('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x69'),_0x7cc2('0x68'));}break;case'bandwidth':if(_0x2c8ad0[_0x7cc2('0x31')]&&_0x2c8ad0['password']){var _0x4b5da4=util[_0x7cc2('0x44')](_0x7cc2('0x45'),_0x2c8ad0[_0x7cc2('0x31')],_0x2c8ad0[_0x7cc2('0x32')]);var _0x104cd9={'method':_0x7cc2('0x37'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x2c8ad0[_0x7cc2('0x6e')]+_0x7cc2('0x6f'),'body':{'to':[_0x21b268[_0x7cc2('0x22')]],'text':_0x21b268['body'],'from':_0x2c8ad0[_0x7cc2('0x22')],'applicationId':_0x2c8ad0[_0x7cc2('0x70')]},'headers':{'Authorization':util['format'](_0x7cc2('0x47'),new Buffer(_0x4b5da4)[_0x7cc2('0x4f')](_0x7cc2('0x50')))},'json':!![]};rp(_0x104cd9)['then'](function(_0x59ef01){if(_0x59ef01['id']){var _0x5ba963={'messageId':_0x59ef01['id']};return _0x445f28['update'](_0x5ba963);}else{logger['error'](_0x7cc2('0x2c'),_0x7cc2('0x2d'),_0x7cc2('0x71'),util['inspect'](_0x59ef01,{'showHidden':![],'depth':null}));}})[_0x7cc2('0x1b')](function(_0x40604a){logger['error'](_0x7cc2('0x2c'),_0x7cc2('0x2d'),'bandwidth',util['inspect'](_0x40604a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7cc2('0x2c'),'afterCreate',_0x7cc2('0x71'),_0x7cc2('0x3f'));}break;case'intelepeer':if(_0x2c8ad0[_0x7cc2('0x60')]){var _0x906d83={};var _0x370e00={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x7cc2('0x72')+_0x2c8ad0[_0x7cc2('0x60')],'Content-Type':_0x7cc2('0x55')},'body':{'from':_0x2c8ad0[_0x7cc2('0x22')],'to':_0x21b268[_0x7cc2('0x22')],'text':_0x21b268[_0x7cc2('0xe')]},'json':!![]};return rp(_0x370e00)[_0x7cc2('0x19')](function(_0x1cca6b){if(_0x1cca6b[_0x7cc2('0x73')]==0xca){_0x906d83[_0x7cc2('0x74')]=_0x1cca6b;var _0x2a2694={'method':'POST','uri':_0x7cc2('0x75'),'headers':{'Authorization':'Bearer\x20'+_0x2c8ad0[_0x7cc2('0x60')],'Content-Type':_0x7cc2('0x55')},'body':{'refid':_0x906d83[_0x7cc2('0x74')]['refid']},'json':!![]};return rp(_0x2a2694)[_0x7cc2('0x19')](function(_0x23221b){_0x906d83[_0x7cc2('0x76')]=_0x23221b;var _0x5f0228={'messageId':_0x906d83[_0x7cc2('0x74')][_0x7cc2('0x77')],'read':!![]};return _0x445f28['update'](_0x5f0228);});}else{return logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),'afterCreate',_0x7cc2('0x78'),util[_0x7cc2('0x3e')](_0x1cca6b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x58c7af){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc2('0x2d'),_0x7cc2('0x78'),util[_0x7cc2('0x3e')](_0x58c7af,{'showHidden':![],'depth':null}));});}else{return logger[_0x7cc2('0x1c')](_0x7cc2('0x2c'),_0x7cc2('0x2d'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x7cc2('0x79')](function(){_0x20fc4f();});}else{_0x20fc4f();}}},'charset':_0x7cc2('0x7a'),'collate':_0x7cc2('0x7b')});}; \ No newline at end of file +var _0xfd72=['SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','SmsInteractionId','findOne','then','catch','error','secret','SmsAccountId','type','twilio','phone','accountSid','authToken','create','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','smsMethod','sender','login?username=','&password=','password','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','queued_count','head','messages','message_id','clickSend','authId','remote','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','application/json','infobip','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','login','timestamp','keys','sort','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','bandwidth','accountId','/messages','applicationId','intelepeer','apiKey','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define'];(function(_0x4180a1,_0x473266){var _0x1f4fe0=function(_0xaf6e92){while(--_0xaf6e92){_0x4180a1['push'](_0x4180a1['shift']());}};_0x1f4fe0(++_0x473266);}(_0xfd72,0x6c));var _0x2fd7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xfd72[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2fd7('0x0'));var util=require(_0x2fd7('0x1'));var logger=require(_0x2fd7('0x2'))(_0x2fd7('0x3'));var moment=require(_0x2fd7('0x4'));var BPromise=require(_0x2fd7('0x5'));var rp=require(_0x2fd7('0x6'));var fs=require('fs');var path=require(_0x2fd7('0x7'));var rimraf=require(_0x2fd7('0x8'));var config=require(_0x2fd7('0x9'));var attributes=require(_0x2fd7('0xa'));module['exports']=function(_0xfba8e8,_0x4ab1a7){return _0xfba8e8[_0x2fd7('0xb')](_0x2fd7('0xc'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x2fd7('0xd'),'fields':[_0x2fd7('0xd')]},{'name':_0x2fd7('0xe'),'fields':[_0x2fd7('0xf')],'type':_0x2fd7('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e33c7,_0x16dd95,_0x31b5f0){var _0x25dc7a=_0xfba8e8[_0x2fd7('0x11')];var _0x44d19e=_0x3e33c7[_0x2fd7('0x12')]({'plain':!![]});if(_0x44d19e[_0x2fd7('0x13')][_0x2fd7('0x14')]()==='in'||_0x44d19e[_0x2fd7('0x13')][_0x2fd7('0x14')]()===_0x2fd7('0x15')&&!_0x44d19e['secret']&&!_['isNil'](_0x44d19e['UserId'])&&!_['isNil'](_0x44d19e[_0x2fd7('0x16')])){_0x25dc7a['SmsInteraction'][_0x2fd7('0x17')]({'where':{'id':_0x44d19e[_0x2fd7('0x16')]}})[_0x2fd7('0x18')](function(_0x5f1f36){if(_0x5f1f36){_0x5f1f36['update']({'lastMsgAt':_0x44d19e['createdAt'],'lastMsgDirection':_0x44d19e[_0x2fd7('0x13')][_0x2fd7('0x14')]()});}})[_0x2fd7('0x19')](function(_0x5f3b19){console[_0x2fd7('0x1a')](_0x5f3b19);});}if(_0x44d19e['direction']===_0x2fd7('0x15')&&!_0x44d19e[_0x2fd7('0x1b')]){var _0x3a3bb7;_0x25dc7a['SmsAccount']['find']({'where':{'id':_0x44d19e[_0x2fd7('0x1c')]},'raw':!![]})[_0x2fd7('0x18')](function(_0x120338){_0x3a3bb7=_0x120338;if(_0x3a3bb7&&_0x3a3bb7[_0x2fd7('0x1d')]){switch(_0x3a3bb7[_0x2fd7('0x1d')]){case _0x2fd7('0x1e'):var _0x11d6e2=require('twilio');if(_0x3a3bb7['accountSid']&&_0x3a3bb7['authToken']&&_0x3a3bb7[_0x2fd7('0x1f')]){var _0x4bcbbc=new _0x11d6e2(_0x3a3bb7[_0x2fd7('0x20')],_0x3a3bb7[_0x2fd7('0x21')]);_0x4bcbbc['messages'][_0x2fd7('0x22')]({'body':_0x44d19e[_0x2fd7('0xf')],'to':_0x44d19e['phone'],'from':_0x3a3bb7[_0x2fd7('0x1f')],'statusCallback':_0x3a3bb7['remote']+_0x2fd7('0x23')+_0x44d19e['id']+_0x2fd7('0x24')+_0x3a3bb7[_0x2fd7('0x25')]})[_0x2fd7('0x18')](function(_0x86b680){if(_0x86b680[_0x2fd7('0x26')]){return _0x3e33c7[_0x2fd7('0x27')]({'messageId':_0x86b680['sid']});}})[_0x2fd7('0x19')](function(_0x10aa78){logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),'twilio',util['inspect'](_0x10aa78,{'showHidden':![],'depth':null}));});}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x1e'),_0x2fd7('0x2a'));}break;case _0x2fd7('0x2b'):var _0x1ec378='https://api.skebby.it/API/v1.0/REST/';if(_0x3a3bb7[_0x2fd7('0x2c')]&&_0x3a3bb7['password']){var _0x11943d={'recipient':[_0x44d19e[_0x2fd7('0x1f')]],'message':_0x44d19e[_0x2fd7('0xf')],'message_type':_0x3a3bb7[_0x2fd7('0x2d')]};if(_0x3a3bb7[_0x2fd7('0x2d')]&&_0x3a3bb7['smsMethod']!=='SI'){_0x11943d[_0x2fd7('0x2e')]=_0x3a3bb7[_0x2fd7('0x1f')];}var _0x2cb7b7={'url':_0x1ec378+_0x2fd7('0x2f')+_0x3a3bb7[_0x2fd7('0x2c')]+_0x2fd7('0x30')+_0x3a3bb7[_0x2fd7('0x31')],'method':_0x2fd7('0x32')};rp(_0x2cb7b7)[_0x2fd7('0x18')](function(_0x2f2e30){var _0x1478f0=_0x2f2e30[_0x2fd7('0x33')](';');var _0x9671bf={'user_key':_0x1478f0[0x0],'session_key':_0x1478f0[0x1]};_0x2cb7b7={'url':_0x1ec378+_0x2fd7('0x34'),'method':_0x2fd7('0x35'),'headers':{'user_key':_0x9671bf['user_key'],'Session_key':_0x9671bf[_0x2fd7('0x36')]},'json':!![],'body':_0x11943d};return rp(_0x2cb7b7);})[_0x2fd7('0x18')](function(_0x1cb520){if(_0x1cb520[_0x2fd7('0x37')]>=0x1){var _0xf38767={'messageId':_0x1cb520[_0x2fd7('0x38')]};if(_0x3a3bb7['smsMethod']!=='GP'||!_0x3a3bb7[_0x2fd7('0x39')]){_0xf38767[_0x2fd7('0x3a')]=!![];}return _0x3e33c7['update'](_0xf38767);}else{return logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),'skebby',util['inspect'](_0x1cb520,{'showHidden':![],'depth':null}));}})['catch'](function(_0x397307){return logger[_0x2fd7('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2fd7('0x29'),_0x2fd7('0x2b'),util[_0x2fd7('0x3b')](_0x397307,{'showHidden':![],'depth':null}));});}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),'afterCreate',_0x2fd7('0x2b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x2fd7('0x3c'):if(_0x3a3bb7[_0x2fd7('0x21')]){var _0x1ae77a={'recipient':_0x44d19e[_0x2fd7('0x1f')],'message':_0x44d19e['body'],'sender':_0x3a3bb7[_0x2fd7('0x3d')]||_0x3a3bb7[_0x2fd7('0x1f')],'authorization':_0x3a3bb7['authToken']};var _0x16dd95={'method':_0x2fd7('0x35'),'uri':_0x2fd7('0x3e'),'body':_0x1ae77a,'json':!![]};rp(_0x16dd95)['then'](function(_0x3293cd){var _0x4251cd={'messageId':_0x3293cd[_0x2fd7('0x3f')]};if(!_0x3a3bb7[_0x2fd7('0x39')]){_0x4251cd[_0x2fd7('0x3a')]=!![];}return _0x3e33c7['update'](_0x4251cd);})[_0x2fd7('0x19')](function(_0x2160cc){logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),'connectel',util[_0x2fd7('0x3b')](_0x2160cc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2fd7('0x28'),_0x2fd7('0x29'),'connectel',_0x2fd7('0x40'));}break;case _0x2fd7('0x41'):if(_0x3a3bb7['username']&&_0x3a3bb7['password']){var _0x1ae77a={'messages':[{'source':_0x2fd7('0x42'),'to':_0x44d19e[_0x2fd7('0x1f')],'body':_0x44d19e[_0x2fd7('0xf')],'from':_0x3a3bb7['senderString']||_0x3a3bb7[_0x2fd7('0x1f')]}]};var _0x37a06e=util['format'](_0x2fd7('0x43'),_0x3a3bb7['username'],_0x3a3bb7['password']);var _0x16dd95={'method':'POST','uri':_0x2fd7('0x44'),'body':_0x1ae77a,'headers':{'Authorization':util[_0x2fd7('0x45')](_0x2fd7('0x46'),new Buffer(_0x37a06e)[_0x2fd7('0x47')](_0x2fd7('0x48')))},'json':!![]};rp(_0x16dd95)[_0x2fd7('0x18')](function(_0x403dad){if(_0x403dad[_0x2fd7('0x49')]>=0xc8&&_0x403dad[_0x2fd7('0x49')]<=0xce){if(_0x403dad['data']&&_0x403dad['data'][_0x2fd7('0x4a')]>0x0){var _0x39245b=_[_0x2fd7('0x4b')](_0x403dad['data'][_0x2fd7('0x4c')]);var _0x15d484={'messageId':_0x39245b[_0x2fd7('0x4d')]};if(!_0x3a3bb7[_0x2fd7('0x39')]){_0x15d484[_0x2fd7('0x3a')]=!![];}return _0x3e33c7[_0x2fd7('0x27')](_0x15d484);}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),'clickSend',util['inspect'](_0x403dad,{'showHidden':![],'depth':null}));}}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x4e'),util[_0x2fd7('0x3b')](_0x403dad,{'showHidden':![],'depth':null}));}})['catch'](function(_0x290d2c){logger[_0x2fd7('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2fd7('0x29'),'clickSend',util[_0x2fd7('0x3b')](_0x290d2c,{'showHidden':![],'depth':null}));});}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x4e'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x3a3bb7[_0x2fd7('0x4f')]&&_0x3a3bb7[_0x2fd7('0x21')]){var _0x1ae77a={'dst':_0x44d19e[_0x2fd7('0x1f')],'text':_0x44d19e['body'],'src':_0x3a3bb7[_0x2fd7('0x3d')]||_0x3a3bb7[_0x2fd7('0x1f')],'url':_0x3a3bb7[_0x2fd7('0x50')]+_0x2fd7('0x23')+_0x44d19e['id']+_0x2fd7('0x24')+_0x3a3bb7[_0x2fd7('0x25')]};var _0x37a06e=util[_0x2fd7('0x45')]('%s:%s',_0x3a3bb7[_0x2fd7('0x4f')],_0x3a3bb7['authToken']);var _0x16dd95={'method':_0x2fd7('0x35'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x3a3bb7[_0x2fd7('0x4f')]),'body':_0x1ae77a,'headers':{'Authorization':util[_0x2fd7('0x45')](_0x2fd7('0x46'),new Buffer(_0x37a06e)[_0x2fd7('0x47')](_0x2fd7('0x48')))},'json':!![]};rp(_0x16dd95)[_0x2fd7('0x18')](function(_0x15c080){var _0x518a23={'messageId':_0x15c080[_0x2fd7('0x51')][0x0]};return _0x3e33c7[_0x2fd7('0x27')](_0x518a23);})[_0x2fd7('0x19')](function(_0x295606){logger['error'](_0x2fd7('0x28'),_0x2fd7('0x29'),'plivo',util[_0x2fd7('0x3b')](_0x295606,{'showHidden':![],'depth':null}));});}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),'plivo',_0x2fd7('0x52'));}break;case'infobip':if(_0x3a3bb7['username']&&_0x3a3bb7['password']){if(_0x3a3bb7['baseUrl']){var _0x15c5ae={'method':_0x2fd7('0x35'),'uri':_0x3a3bb7[_0x2fd7('0x53')]+'/auth/1/session','body':{'username':_0x3a3bb7[_0x2fd7('0x2c')],'password':_0x3a3bb7[_0x2fd7('0x31')]},'json':!![]};return rp(_0x15c5ae)['then'](function(_0x8dc6ec){var _0x56f799={'method':_0x2fd7('0x35'),'uri':_0x3a3bb7[_0x2fd7('0x53')]+_0x2fd7('0x54'),'body':{'messages':[{'from':_0x3a3bb7[_0x2fd7('0x1f')],'destinations':[{'to':_0x44d19e[_0x2fd7('0x1f')]}],'text':_0x44d19e[_0x2fd7('0xf')],'notifyUrl':_0x3a3bb7[_0x2fd7('0x50')]+_0x2fd7('0x23')+_0x44d19e['id']+'/status?token='+_0x3a3bb7[_0x2fd7('0x25')],'notifyContentType':_0x2fd7('0x55'),'callbackData':_0x3a3bb7[_0x2fd7('0x1f')]+';'+_0x44d19e['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x8dc6ec['token']},'json':!![]};return rp(_0x56f799)[_0x2fd7('0x18')](function(_0x594b6c){if(_0x594b6c['messages']){var _0x4a9db3={'messageId':_0x594b6c[_0x2fd7('0x4c')][0x0][_0x2fd7('0xd')]};if(!_0x3a3bb7[_0x2fd7('0x39')]){_0x4a9db3[_0x2fd7('0x3a')]=!![];}return _0x3e33c7[_0x2fd7('0x27')](_0x4a9db3);}else{return logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x56'),util[_0x2fd7('0x3b')](_0x594b6c,{'showHidden':![],'depth':null}));}});})[_0x2fd7('0x19')](function(_0x43eb8f){return logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),'afterCreate',_0x2fd7('0x56'),util['inspect'](_0x43eb8f,{'showHidden':![],'depth':null}));});}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x56'),_0x2fd7('0x57'));}}else{logger['error'](_0x2fd7('0x28'),'afterCreate',_0x2fd7('0x56'),_0x2fd7('0x58'));}break;case _0x2fd7('0x59'):var _0x5ee41c=require(_0x2fd7('0x5a'));if(_0x3a3bb7['apiKey']){var _0x1e21fa={};_0x1e21fa[_0x2fd7('0x5b')]=_0x3a3bb7['username'];_0x1e21fa[_0x2fd7('0x1f')]=_0x44d19e[_0x2fd7('0x1f')];_0x1e21fa[_0x2fd7('0x2e')]=_0x3a3bb7['phone'];_0x1e21fa['text']=_0x44d19e[_0x2fd7('0xf')];_0x1e21fa[_0x2fd7('0x5c')]=+new Date();var _0x7994c1='';var _0x4bcc92='';var _0x5bf5e3=Object[_0x2fd7('0x5d')](_0x1e21fa);_0x5bf5e3[_0x2fd7('0x5e')]();for(var _0x250203=0x0;_0x250203<_0x5bf5e3['length'];_0x250203++){if(_0x7994c1!=''){_0x7994c1+='&';}_0x7994c1+=_0x5bf5e3[_0x250203]+'='+encodeURIComponent(_0x1e21fa[_0x5bf5e3[_0x250203]]);_0x4bcc92+=_0x1e21fa[_0x5bf5e3[_0x250203]];}_0x4bcc92+=_0x3a3bb7['apiKey'];_0x4bcc92=_0x5ee41c[_0x2fd7('0x5f')](_0x2fd7('0x60'))[_0x2fd7('0x27')](_0x4bcc92)[_0x2fd7('0x61')](_0x2fd7('0x62'));if(_0x7994c1!==''){_0x7994c1+='&';}_0x7994c1+=_0x2fd7('0x63')+_0x4bcc92;var _0x2cb7b7={'method':'GET','uri':_0x3a3bb7['baseUrl']+_0x2fd7('0x64')+_0x7994c1,'json':!![]};return rp(_0x2cb7b7)['then'](function(_0x4914c6){var _0x3997e7=Object[_0x2fd7('0x5d')](_0x4914c6);if(_0x4914c6[_0x3997e7[0x0]][_0x2fd7('0x1a')]&&parseInt(_0x4914c6[_0x3997e7[0x0]][_0x2fd7('0x1a')])===0x0){var _0xb8a0bc={'messageId':_0x4914c6[_0x3997e7[0x0]][_0x2fd7('0x65')]};if(!_0x3a3bb7[_0x2fd7('0x39')]){_0xb8a0bc[_0x2fd7('0x3a')]=!![];}return _0x3e33c7[_0x2fd7('0x27')](_0xb8a0bc);}else{return logger['error'](_0x2fd7('0x28'),'afterCreate',_0x2fd7('0x59'),util['inspect'](_0x4914c6[_0x2fd7('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x411e8e){return logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),'csc',util['inspect'](_0x411e8e,{'showHidden':![],'depth':null}));});}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x59'),_0x2fd7('0x66'));}break;case _0x2fd7('0x67'):if(_0x3a3bb7['apiKey']){var _0x58a727={'method':'POST','uri':_0x2fd7('0x68'),'headers':{'Authorization':_0x3a3bb7['apiKey']},'body':{'content':_0x44d19e[_0x2fd7('0xf')],'to':[_0x44d19e[_0x2fd7('0x1f')]],'from':_0x3a3bb7[_0x2fd7('0x1f')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x58a727)['then'](function(_0x4df399){if(!_0x4df399[_0x2fd7('0x1a')]){var _0x38a0a4={'messageId':_0x4df399[_0x2fd7('0x4c')][0x0]['apiMessageId']};if(!_0x3a3bb7[_0x2fd7('0x39')]){_0x38a0a4[_0x2fd7('0x3a')]=!![];}return _0x3e33c7['update'](_0x38a0a4);}else{return logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x67'),util[_0x2fd7('0x3b')](_0x4df399[_0x2fd7('0x1a')],{'showHidden':![],'depth':null}));}})[_0x2fd7('0x19')](function(_0x3e2aa7){return logger['error'](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x67'),util['inspect'](_0x3e2aa7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2fd7('0x28'),_0x2fd7('0x29'),'clickatell',_0x2fd7('0x66'));}break;case _0x2fd7('0x69'):if(_0x3a3bb7['username']&&_0x3a3bb7[_0x2fd7('0x31')]){var _0x37a06e=util[_0x2fd7('0x45')](_0x2fd7('0x43'),_0x3a3bb7[_0x2fd7('0x2c')],_0x3a3bb7['password']);var _0x16dd95={'method':_0x2fd7('0x35'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x3a3bb7[_0x2fd7('0x6a')]+_0x2fd7('0x6b'),'body':{'to':[_0x44d19e[_0x2fd7('0x1f')]],'text':_0x44d19e[_0x2fd7('0xf')],'from':_0x3a3bb7[_0x2fd7('0x1f')],'applicationId':_0x3a3bb7[_0x2fd7('0x6c')]},'headers':{'Authorization':util[_0x2fd7('0x45')]('Basic\x20%s',new Buffer(_0x37a06e)[_0x2fd7('0x47')]('base64'))},'json':!![]};rp(_0x16dd95)[_0x2fd7('0x18')](function(_0x515bf6){if(_0x515bf6['id']){var _0x4728d5={'messageId':_0x515bf6['id']};return _0x3e33c7[_0x2fd7('0x27')](_0x4728d5);}else{logger['error'](_0x2fd7('0x28'),'afterCreate','bandwidth',util['inspect'](_0x515bf6,{'showHidden':![],'depth':null}));}})[_0x2fd7('0x19')](function(_0x266477){logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x69'),util[_0x2fd7('0x3b')](_0x266477,{'showHidden':![],'depth':null}));});}else{logger[_0x2fd7('0x1a')](_0x2fd7('0x28'),_0x2fd7('0x29'),_0x2fd7('0x69'),_0x2fd7('0x58'));}break;case _0x2fd7('0x6d'):if(_0x3a3bb7[_0x2fd7('0x6e')]){var _0x5076e7={};var _0x2cb7b7={'method':'POST','uri':_0x2fd7('0x6f'),'headers':{'Authorization':_0x2fd7('0x70')+_0x3a3bb7['apiKey'],'Content-Type':_0x2fd7('0x55')},'body':{'from':_0x3a3bb7[_0x2fd7('0x1f')],'to':_0x44d19e['phone'],'text':_0x44d19e[_0x2fd7('0xf')]},'json':!![]};return rp(_0x2cb7b7)[_0x2fd7('0x18')](function(_0x11b157){if(_0x11b157[_0x2fd7('0x71')]==0xca){_0x5076e7['message']=_0x11b157;var _0x1d10d2={'method':_0x2fd7('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x3a3bb7['apiKey'],'Content-Type':_0x2fd7('0x55')},'body':{'refid':_0x5076e7['message'][_0x2fd7('0x72')]},'json':!![]};return rp(_0x1d10d2)[_0x2fd7('0x18')](function(_0x5811d1){_0x5076e7[_0x2fd7('0x73')]=_0x5811d1;var _0x127923={'messageId':_0x5076e7['message']['refid'],'read':!![]};return _0x3e33c7['update'](_0x127923);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2fd7('0x29'),_0x2fd7('0x6d'),util[_0x2fd7('0x3b')](_0x11b157,{'showHidden':![],'depth':null}));}})[_0x2fd7('0x19')](function(_0x16baa4){return logger[_0x2fd7('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0x2fd7('0x3b')](_0x16baa4,{'showHidden':![],'depth':null}));});}else{return logger[_0x2fd7('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2fd7('0x6d'),_0x2fd7('0x74'));}break;}}})[_0x2fd7('0x75')](function(){_0x31b5f0();});}else{_0x31b5f0();}}},'charset':_0x2fd7('0x76'),'collate':_0x2fd7('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index fe3bf7c..658d691 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 _0x3027=['raw','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsMessage','create','body','options'];(function(_0x4f50a6,_0x3d2b69){var _0x531ac9=function(_0x473b82){while(--_0x473b82){_0x4f50a6['push'](_0x4f50a6['shift']());}};_0x531ac9(++_0x3d2b69);}(_0x3027,0xa2));var _0x7302=function(_0x2d3127,_0x5c8089){_0x2d3127=_0x2d3127-0x0;var _0x470537=_0x3027[_0x2d3127];return _0x470537;};'use strict';var _=require(_0x7302('0x0'));var util=require(_0x7302('0x1'));var moment=require(_0x7302('0x2'));var BPromise=require(_0x7302('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7302('0x4'));var db=require(_0x7302('0x5'))['db'];var utils=require(_0x7302('0x6'));var logger=require(_0x7302('0x7'))(_0x7302('0x8'));var config=require(_0x7302('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7302('0xa')]({'port':0x232a});config['redis']=_[_0x7302('0xb')](config[_0x7302('0xc')],{'host':_0x7302('0xd'),'port':0x18eb});var socket=require(_0x7302('0xe'))(new Redis(config[_0x7302('0xc')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0xdc803c,_0x23cfa0,_0x430718){return new BPromise(function(_0x6afb41,_0x4bbfbb){return client[_0x7302('0xf')](_0xdc803c,_0x430718)[_0x7302('0x10')](function(_0x3cbd18){logger[_0x7302('0x11')](_0x7302('0x12'),_0x23cfa0,_0x7302('0x13'));logger['debug'](_0x7302('0x14'),_0x23cfa0,_0x7302('0x13'),JSON[_0x7302('0x15')](_0x3cbd18));if(_0x3cbd18[_0x7302('0x16')]){if(_0x3cbd18['error'][_0x7302('0x17')]===0x1f4){logger[_0x7302('0x16')]('SmsMessage,\x20%s,\x20%s',_0x23cfa0,_0x3cbd18[_0x7302('0x16')][_0x7302('0x18')]);return _0x4bbfbb(_0x3cbd18['error'][_0x7302('0x18')]);}logger[_0x7302('0x16')](_0x7302('0x12'),_0x23cfa0,_0x3cbd18[_0x7302('0x16')][_0x7302('0x18')]);return _0x6afb41(_0x3cbd18[_0x7302('0x16')][_0x7302('0x18')]);}else{logger['info'](_0x7302('0x12'),_0x23cfa0,_0x7302('0x13'));_0x6afb41(_0x3cbd18['result'][_0x7302('0x18')]);}})[_0x7302('0x19')](function(_0x1f40bb){logger['error']('SmsMessage,\x20%s,\x20%s',_0x23cfa0,_0x1f40bb);_0x4bbfbb(_0x1f40bb);});});}exports[_0x7302('0x1a')]=function(_0xa30ad8){var _0x1f6dae=this;return new Promise(function(_0x58138d,_0xbab172){return db['SmsMessage'][_0x7302('0x1b')](_0xa30ad8[_0x7302('0x1c')],{'raw':_0xa30ad8[_0x7302('0x1d')]?_0xa30ad8['options'][_0x7302('0x1e')]===undefined?!![]:![]:!![]})[_0x7302('0x10')](function(_0x28338f){logger['info'](_0x7302('0x1a'),_0xa30ad8);logger[_0x7302('0x1f')]('CreateSmsMessage',_0xa30ad8,JSON[_0x7302('0x15')](_0x28338f));_0x58138d(_0x28338f);})[_0x7302('0x19')](function(_0xfcb6b7){logger[_0x7302('0x16')](_0x7302('0x1a'),_0xfcb6b7[_0x7302('0x18')],_0xa30ad8);_0xbab172(_0x1f6dae[_0x7302('0x16')](0x1f4,_0xfcb6b7[_0x7302('0x18')]));});});}; \ No newline at end of file +var _0x4e8c=['rpc','../../config/environment','client','http','redis','localhost','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2827db,_0x39131a){var _0x567d6e=function(_0x4ccaf6){while(--_0x4ccaf6){_0x2827db['push'](_0x2827db['shift']());}};_0x567d6e(++_0x39131a);}(_0x4e8c,0x13a));var _0xc4e8=function(_0x4d63ac,_0x4c051b){_0x4d63ac=_0x4d63ac-0x0;var _0x287c4a=_0x4e8c[_0x4d63ac];return _0x287c4a;};'use strict';var _=require('lodash');var util=require(_0xc4e8('0x0'));var moment=require('moment');var BPromise=require(_0xc4e8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4e8('0x2'));var db=require(_0xc4e8('0x3'))['db'];var utils=require(_0xc4e8('0x4'));var logger=require(_0xc4e8('0x5'))(_0xc4e8('0x6'));var config=require(_0xc4e8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc4e8('0x8')][_0xc4e8('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc4e8('0xa')],{'host':_0xc4e8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4e8('0xa')]));require(_0xc4e8('0xc'))[_0xc4e8('0xd')](socket);function respondWithRpcPromise(_0x1adf94,_0x12632a,_0x14d308){return new BPromise(function(_0x49d21f,_0x3d1349){return client[_0xc4e8('0xe')](_0x1adf94,_0x14d308)[_0xc4e8('0xf')](function(_0x4072ee){logger[_0xc4e8('0x10')]('SmsMessage,\x20%s,\x20%s',_0x12632a,_0xc4e8('0x11'));logger[_0xc4e8('0x12')](_0xc4e8('0x13'),_0x12632a,'request\x20sent',JSON['stringify'](_0x4072ee));if(_0x4072ee['error']){if(_0x4072ee[_0xc4e8('0x14')][_0xc4e8('0x15')]===0x1f4){logger['error'](_0xc4e8('0x16'),_0x12632a,_0x4072ee[_0xc4e8('0x14')][_0xc4e8('0x17')]);return _0x3d1349(_0x4072ee[_0xc4e8('0x14')][_0xc4e8('0x17')]);}logger[_0xc4e8('0x14')]('SmsMessage,\x20%s,\x20%s',_0x12632a,_0x4072ee[_0xc4e8('0x14')]['message']);return _0x49d21f(_0x4072ee[_0xc4e8('0x14')][_0xc4e8('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x12632a,_0xc4e8('0x11'));_0x49d21f(_0x4072ee['result']['message']);}})['catch'](function(_0x557a6a){logger[_0xc4e8('0x14')](_0xc4e8('0x16'),_0x12632a,_0x557a6a);_0x3d1349(_0x557a6a);});});}exports[_0xc4e8('0x18')]=function(_0x9e8fe9){var _0x47a70a=this;return new Promise(function(_0x1f0427,_0x302ba2){return db[_0xc4e8('0x19')][_0xc4e8('0x1a')](_0x9e8fe9[_0xc4e8('0x1b')],{'raw':_0x9e8fe9[_0xc4e8('0x1c')]?_0x9e8fe9[_0xc4e8('0x1c')][_0xc4e8('0x1d')]===undefined?!![]:![]:!![]})[_0xc4e8('0xf')](function(_0x4bdb3c){logger[_0xc4e8('0x10')](_0xc4e8('0x18'),_0x9e8fe9);logger[_0xc4e8('0x12')](_0xc4e8('0x18'),_0x9e8fe9,JSON[_0xc4e8('0x1e')](_0x4bdb3c));_0x1f0427(_0x4bdb3c);})[_0xc4e8('0x1f')](function(_0x3de623){logger[_0xc4e8('0x14')](_0xc4e8('0x18'),_0x3de623[_0xc4e8('0x17')],_0x9e8fe9);_0x302ba2(_0x47a70a[_0xc4e8('0x14')](0x1f4,_0x3de623[_0xc4e8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 887d85f..09aa88c 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 _0x76b4=['emit','removeListener','register','length','smsMessage:','save','remove','update'];(function(_0x47bd90,_0x367edd){var _0x3e85f8=function(_0x13ce89){while(--_0x13ce89){_0x47bd90['push'](_0x47bd90['shift']());}};_0x3e85f8(++_0x367edd);}(_0x76b4,0xd5));var _0x476b=function(_0x95a65b,_0x59995e){_0x95a65b=_0x95a65b-0x0;var _0x193100=_0x76b4[_0x95a65b];return _0x193100;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x476b('0x0'),_0x476b('0x1'),_0x476b('0x2')];function createListener(_0x3d1567,_0x2f33e4){return function(_0x523511){_0x2f33e4[_0x476b('0x3')](_0x3d1567,_0x523511);};}function removeListener(_0x423003,_0x152f84){return function(){SmsMessageEvents[_0x476b('0x4')](_0x423003,_0x152f84);};}exports[_0x476b('0x5')]=function(_0xcebda2){for(var _0x12f1c9=0x0,_0x527f7c=events[_0x476b('0x6')];_0x12f1c9<_0x527f7c;_0x12f1c9++){var _0xe64522=events[_0x12f1c9];var _0x13ac83=createListener(_0x476b('0x7')+_0xe64522,_0xcebda2);SmsMessageEvents['on'](_0xe64522,_0x13ac83);}}; \ No newline at end of file +var _0x1a3e=['smsMessage:','./smsMessage.events','save','update','emit','register'];(function(_0x230f35,_0x312535){var _0x12acae=function(_0x4545db){while(--_0x4545db){_0x230f35['push'](_0x230f35['shift']());}};_0x12acae(++_0x312535);}(_0x1a3e,0x12d));var _0xe1a3=function(_0x1c9289,_0x36beb9){_0x1c9289=_0x1c9289-0x0;var _0xb8d6bc=_0x1a3e[_0x1c9289];return _0xb8d6bc;};'use strict';var SmsMessageEvents=require(_0xe1a3('0x0'));var events=[_0xe1a3('0x1'),'remove',_0xe1a3('0x2')];function createListener(_0x1c9389,_0x5821d0){return function(_0x5c543f){_0x5821d0[_0xe1a3('0x3')](_0x1c9389,_0x5c543f);};}function removeListener(_0x9e4ac9,_0x1ef3c6){return function(){SmsMessageEvents['removeListener'](_0x9e4ac9,_0x1ef3c6);};}exports[_0xe1a3('0x4')]=function(_0x4f348d){for(var _0x4758ed=0x0,_0x513db6=events['length'];_0x4758ed<_0x513db6;_0x4758ed++){var _0x5b9ece=events[_0x4758ed];var _0x21c3f5=createListener(_0xe1a3('0x5')+_0x5b9ece,_0x4f348d);SmsMessageEvents['on'](_0x5b9ece,_0x21c3f5);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 38ec00b..40b892f 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 _0x47bd=['get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller'];(function(_0x4b468b,_0x49c47e){var _0x2890ac=function(_0x16f8a3){while(--_0x16f8a3){_0x4b468b['push'](_0x4b468b['shift']());}};_0x2890ac(++_0x49c47e);}(_0x47bd,0xab));var _0xd47b=function(_0x76756e,_0x7c88ed){_0x76756e=_0x76756e-0x0;var _0x51436b=_0x47bd[_0x76756e];return _0x51436b;};'use strict';var multer=require(_0xd47b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd47b('0x1'));var express=require(_0xd47b('0x2'));var router=express[_0xd47b('0x3')]();var fs_extra=require(_0xd47b('0x4'));var auth=require(_0xd47b('0x5'));var interaction=require(_0xd47b('0x6'));var config=require(_0xd47b('0x7'));var controller=require(_0xd47b('0x8'));router[_0xd47b('0x9')]('/',auth[_0xd47b('0xa')](),controller['index']);router[_0xd47b('0x9')](_0xd47b('0xb'),auth['isAuthenticated'](),controller[_0xd47b('0xc')]);router[_0xd47b('0x9')](_0xd47b('0xd'),auth['isAuthenticated'](),controller[_0xd47b('0xe')]);router[_0xd47b('0x9')](_0xd47b('0xf'),auth[_0xd47b('0xa')](),controller[_0xd47b('0x10')]);router[_0xd47b('0x9')](_0xd47b('0x11'),auth['isAuthenticated'](),controller[_0xd47b('0x12')]);router['get'](_0xd47b('0x13'),auth[_0xd47b('0xa')](),controller[_0xd47b('0x14')]);router[_0xd47b('0x15')]('/',auth[_0xd47b('0xa')](),controller[_0xd47b('0x16')]);router[_0xd47b('0x15')](_0xd47b('0x11'),auth[_0xd47b('0xa')](),controller[_0xd47b('0x17')]);router[_0xd47b('0x15')](_0xd47b('0x13'),auth[_0xd47b('0xa')](),controller['addAgents']);router[_0xd47b('0x18')](_0xd47b('0xd'),auth[_0xd47b('0xa')](),controller[_0xd47b('0x19')]);router['delete'](_0xd47b('0xd'),auth[_0xd47b('0xa')](),controller[_0xd47b('0x1a')]);router[_0xd47b('0x1b')]('/:id/teams',auth[_0xd47b('0xa')](),controller[_0xd47b('0x1c')]);router[_0xd47b('0x1b')](_0xd47b('0x13'),auth[_0xd47b('0xa')](),controller['removeAgents']);module[_0xd47b('0x1d')]=router; \ No newline at end of file +var _0x385f=['/:id/teams','addTeams','addAgents','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','index','/describe','isAuthenticated','describe','get','/:id','/:id/members','getTeams','/:id/users','getAgents','post','create'];(function(_0x4f64ca,_0x1bed02){var _0x5e57f7=function(_0x36922d){while(--_0x36922d){_0x4f64ca['push'](_0x4f64ca['shift']());}};_0x5e57f7(++_0x1bed02);}(_0x385f,0xd2));var _0xf385=function(_0x18f152,_0x41585a){_0x18f152=_0x18f152-0x0;var _0xa10b34=_0x385f[_0x18f152];return _0xa10b34;};'use strict';var multer=require(_0xf385('0x0'));var util=require(_0xf385('0x1'));var path=require(_0xf385('0x2'));var timeout=require(_0xf385('0x3'));var express=require(_0xf385('0x4'));var router=express['Router']();var fs_extra=require(_0xf385('0x5'));var auth=require(_0xf385('0x6'));var interaction=require(_0xf385('0x7'));var config=require(_0xf385('0x8'));var controller=require(_0xf385('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf385('0xa')]);router['get'](_0xf385('0xb'),auth[_0xf385('0xc')](),controller[_0xf385('0xd')]);router[_0xf385('0xe')](_0xf385('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xf385('0xe')](_0xf385('0x10'),auth[_0xf385('0xc')](),controller['getMembers']);router[_0xf385('0xe')]('/:id/teams',auth[_0xf385('0xc')](),controller[_0xf385('0x11')]);router[_0xf385('0xe')](_0xf385('0x12'),auth[_0xf385('0xc')](),controller[_0xf385('0x13')]);router[_0xf385('0x14')]('/',auth[_0xf385('0xc')](),controller[_0xf385('0x15')]);router[_0xf385('0x14')](_0xf385('0x16'),auth[_0xf385('0xc')](),controller[_0xf385('0x17')]);router['post'](_0xf385('0x12'),auth[_0xf385('0xc')](),controller[_0xf385('0x18')]);router['put'](_0xf385('0xf'),auth[_0xf385('0xc')](),controller['update']);router[_0xf385('0x19')]('/:id',auth[_0xf385('0xc')](),controller[_0xf385('0x1a')]);router[_0xf385('0x19')](_0xf385('0x16'),auth['isAuthenticated'](),controller[_0xf385('0x1b')]);router[_0xf385('0x19')](_0xf385('0x12'),auth[_0xf385('0xc')](),controller['removeAgents']);module[_0xf385('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 30c9175..c15cca9 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 _0xc114=['exports','STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x2698e3,_0x3dc553){var _0x162cff=function(_0x3dbd27){while(--_0x3dbd27){_0x2698e3['push'](_0x2698e3['shift']());}};_0x162cff(++_0x3dc553);}(_0xc114,0x11e));var _0x4c11=function(_0x514f80,_0x5cfd7a){_0x514f80=_0x514f80-0x0;var _0x54ed3b=_0xc114[_0x514f80];return _0x54ed3b;};'use strict';var Sequelize=require(_0x4c11('0x0'));module[_0x4c11('0x1')]={'name':{'type':Sequelize[_0x4c11('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4c11('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4c11('0x4'),_0x4c11('0x5'),_0x4c11('0x6'))}}; \ No newline at end of file +var _0xa651=['name','STRING','INTEGER','ENUM','sequelize'];(function(_0x4571f9,_0x23904e){var _0x58f3d1=function(_0x2d9861){while(--_0x2d9861){_0x4571f9['push'](_0x4571f9['shift']());}};_0x58f3d1(++_0x23904e);}(_0xa651,0x13a));var _0x1a65=function(_0x13eb7e,_0x5841c1){_0x13eb7e=_0x13eb7e-0x0;var _0x15c52e=_0xa651[_0x13eb7e];return _0x15c52e;};'use strict';var Sequelize=require(_0x1a65('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1a65('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1a65('0x2')]},'timeout':{'type':Sequelize[_0x1a65('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1a65('0x4')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index bcd01e8..2dde2a9 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x37c934,_0x304df7){var _0x564c63=function(_0x2bcc82){while(--_0x2bcc82){_0x37c934['push'](_0x37c934['shift']());}};_0x564c63(++_0x304df7);}(_0x2ef3,0xba));var _0x32ef=function(_0x188323,_0x63a0cc){_0x188323=_0x188323-0x0;var _0x5662fe=_0x2ef3[_0x188323];return _0x5662fe;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file +var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x501c5d,_0x4fbc8d){var _0x39ba22=function(_0x2be353){while(--_0x2be353){_0x501c5d['push'](_0x501c5d['shift']());}};_0x39ba22(++_0x4fbc8d);}(_0x2ef3,0xba));var _0x32ef=function(_0x2e1756,_0x38a65b){_0x2e1756=_0x2e1756-0x0;var _0x3f24d5=_0x2ef3[_0x2e1756];return _0x3f24d5;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 557a79b..03556b1 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 _0xd5c4=['hasOwnProperty','../../mysqldb','SmsQueue','save','update','remove','emit'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xd5c4,0x17b));var _0x4d5c=function(_0x2724ad,_0x1a3275){_0x2724ad=_0x2724ad-0x0;var _0x3a1e2e=_0xd5c4[_0x2724ad];return _0x3a1e2e;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x4d5c('0x0'))['db'][_0x4d5c('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4d5c('0x2'),'afterUpdate':_0x4d5c('0x3'),'afterDestroy':_0x4d5c('0x4')};function emitEvent(_0x3202a5){return function(_0x3a4d31,_0x349ad7,_0x596658){SmsQueueEvents[_0x4d5c('0x5')](_0x3202a5+':'+_0x3a4d31['id'],_0x3a4d31);SmsQueueEvents[_0x4d5c('0x5')](_0x3202a5,_0x3a4d31);_0x596658(null);};}for(var e in events){if(events[_0x4d5c('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xc8cb=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue'];(function(_0x158414,_0x5ab714){var _0x3db75b=function(_0x19d0eb){while(--_0x19d0eb){_0x158414['push'](_0x158414['shift']());}};_0x3db75b(++_0x5ab714);}(_0xc8cb,0xed));var _0xbc8c=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0xc8cb[_0x287a47];return _0x3fb726;};'use strict';var EventEmitter=require(_0xbc8c('0x0'));var SmsQueue=require(_0xbc8c('0x1'))['db'][_0xbc8c('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xbc8c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbc8c('0x4'),'afterDestroy':_0xbc8c('0x5')};function emitEvent(_0x5e93c7){return function(_0x5487fc,_0x205fc7,_0xe467da){SmsQueueEvents[_0xbc8c('0x6')](_0x5e93c7+':'+_0x5487fc['id'],_0x5487fc);SmsQueueEvents[_0xbc8c('0x6')](_0x5e93c7,_0x5487fc);_0xe467da(null);};}for(var e in events){if(events[_0xbc8c('0x7')](e)){var event=events[e];SmsQueue[_0xbc8c('0x8')](e,emitEvent(event));}}module[_0xbc8c('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index b4d51c1..b0c8027 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 _0x22dd=['path','rimraf','../../config/environment','exports','define','SmsQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x22dd,0x199));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd22d('0x0'));var util=require(_0xd22d('0x1'));var logger=require(_0xd22d('0x2'))(_0xd22d('0x3'));var moment=require(_0xd22d('0x4'));var BPromise=require(_0xd22d('0x5'));var rp=require(_0xd22d('0x6'));var fs=require('fs');var path=require(_0xd22d('0x7'));var rimraf=require(_0xd22d('0x8'));var config=require(_0xd22d('0x9'));var attributes=require('./smsQueue.attributes');module[_0xd22d('0xa')]=function(_0x483f07,_0x1bb377){return _0x483f07[_0xd22d('0xb')](_0xd22d('0xc'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96c2=['api','moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','util','../../config/logger'];(function(_0x5cc51f,_0x22c480){var _0x315a2f=function(_0x4f93bd){while(--_0x4f93bd){_0x5cc51f['push'](_0x5cc51f['shift']());}};_0x315a2f(++_0x22c480);}(_0x96c2,0x82));var _0x296c=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x96c2[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require('lodash');var util=require(_0x296c('0x0'));var logger=require(_0x296c('0x1'))(_0x296c('0x2'));var moment=require(_0x296c('0x3'));var BPromise=require(_0x296c('0x4'));var rp=require(_0x296c('0x5'));var fs=require('fs');var path=require(_0x296c('0x6'));var rimraf=require('rimraf');var config=require(_0x296c('0x7'));var attributes=require(_0x296c('0x8'));module[_0x296c('0x9')]=function(_0x267628,_0x31995b){return _0x267628[_0x296c('0xa')](_0x296c('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 7bfdbf0..b2a6ed5 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 _0x2f79=['SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','attributes','limit','model','include','map','then','GetSmsQueue','stringify','ShowSmsQueue','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14883e,_0x21af3c){var _0x25b8f7=function(_0x3ab3e8){while(--_0x3ab3e8){_0x14883e['push'](_0x14883e['shift']());}};_0x25b8f7(++_0x21af3c);}(_0x2f79,0xe0));var _0x92f7=function(_0x307ef5,_0x5dbf62){_0x307ef5=_0x307ef5-0x0;var _0x378b98=_0x2f79[_0x307ef5];return _0x378b98;};'use strict';var _=require(_0x92f7('0x0'));var util=require(_0x92f7('0x1'));var moment=require(_0x92f7('0x2'));var BPromise=require('bluebird');var rs=require(_0x92f7('0x3'));var fs=require('fs');var Redis=require(_0x92f7('0x4'));var db=require(_0x92f7('0x5'))['db'];var utils=require(_0x92f7('0x6'));var logger=require(_0x92f7('0x7'))(_0x92f7('0x8'));var config=require(_0x92f7('0x9'));var jayson=require(_0x92f7('0xa'));var client=jayson[_0x92f7('0xb')][_0x92f7('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x92f7('0xd'),'port':0x18eb});var socket=require(_0x92f7('0xe'))(new Redis(config[_0x92f7('0xf')]));require('./smsQueue.socket')[_0x92f7('0x10')](socket);function respondWithRpcPromise(_0x5dd9c2,_0x3ce27b,_0x3f591f){return new BPromise(function(_0x4488c9,_0x50c4e8){return client[_0x92f7('0x11')](_0x5dd9c2,_0x3f591f)['then'](function(_0x377b87){logger[_0x92f7('0x12')](_0x92f7('0x13'),_0x3ce27b,_0x92f7('0x14'));logger[_0x92f7('0x15')](_0x92f7('0x16'),_0x3ce27b,_0x92f7('0x14'),JSON['stringify'](_0x377b87));if(_0x377b87[_0x92f7('0x17')]){if(_0x377b87['error'][_0x92f7('0x18')]===0x1f4){logger[_0x92f7('0x17')](_0x92f7('0x13'),_0x3ce27b,_0x377b87['error']['message']);return _0x50c4e8(_0x377b87[_0x92f7('0x17')][_0x92f7('0x19')]);}logger[_0x92f7('0x17')](_0x92f7('0x13'),_0x3ce27b,_0x377b87[_0x92f7('0x17')][_0x92f7('0x19')]);return _0x4488c9(_0x377b87[_0x92f7('0x17')][_0x92f7('0x19')]);}else{logger[_0x92f7('0x12')](_0x92f7('0x13'),_0x3ce27b,_0x92f7('0x14'));_0x4488c9(_0x377b87[_0x92f7('0x1a')][_0x92f7('0x19')]);}})[_0x92f7('0x1b')](function(_0x598fcf){logger[_0x92f7('0x17')](_0x92f7('0x13'),_0x3ce27b,_0x598fcf);_0x50c4e8(_0x598fcf);});});}exports['GetSmsQueue']=function(_0x1052bb){var _0x5a17ae=this;return new Promise(function(_0x3cf802,_0x19ef90){return db['SmsQueue'][_0x92f7('0x1c')]({'raw':_0x1052bb[_0x92f7('0x1d')]?_0x1052bb[_0x92f7('0x1d')][_0x92f7('0x1e')]===undefined?!![]:![]:!![],'where':_0x1052bb[_0x92f7('0x1d')]?_0x1052bb[_0x92f7('0x1d')]['where']||null:null,'attributes':_0x1052bb[_0x92f7('0x1d')]?_0x1052bb['options'][_0x92f7('0x1f')]||null:null,'limit':_0x1052bb['options']?_0x1052bb[_0x92f7('0x1d')][_0x92f7('0x20')]||null:null,'include':_0x1052bb[_0x92f7('0x1d')]?_0x1052bb[_0x92f7('0x1d')]['include']?_['map'](_0x1052bb[_0x92f7('0x1d')]['include'],function(_0x56e186){return{'model':db[_0x56e186[_0x92f7('0x21')]],'as':_0x56e186['as'],'attributes':_0x56e186[_0x92f7('0x1f')],'include':_0x56e186[_0x92f7('0x22')]?_[_0x92f7('0x23')](_0x56e186[_0x92f7('0x22')],function(_0x14a721){return{'model':db[_0x14a721[_0x92f7('0x21')]],'as':_0x14a721['as'],'attributes':_0x14a721[_0x92f7('0x1f')],'include':_0x14a721[_0x92f7('0x22')]?_['map'](_0x14a721['include'],function(_0x5927a3){return{'model':db[_0x5927a3[_0x92f7('0x21')]],'as':_0x5927a3['as'],'attributes':_0x5927a3[_0x92f7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x92f7('0x24')](function(_0x422785){logger[_0x92f7('0x12')]('GetSmsQueue',_0x1052bb);logger[_0x92f7('0x15')](_0x92f7('0x25'),_0x1052bb,JSON[_0x92f7('0x26')](_0x422785));_0x3cf802(_0x422785);})[_0x92f7('0x1b')](function(_0x45bf57){logger[_0x92f7('0x17')](_0x92f7('0x25'),_0x45bf57[_0x92f7('0x19')],_0x1052bb);_0x19ef90(_0x5a17ae[_0x92f7('0x17')](0x1f4,_0x45bf57[_0x92f7('0x19')]));});});};exports[_0x92f7('0x27')]=function(_0x161d0b){var _0x4081e3=this;return new Promise(function(_0x176c33,_0x4fac8c){return db['SmsQueue']['find']({'raw':_0x161d0b[_0x92f7('0x1d')]?_0x161d0b[_0x92f7('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x161d0b[_0x92f7('0x1d')]?_0x161d0b[_0x92f7('0x1d')][_0x92f7('0x28')]||null:null,'attributes':_0x161d0b[_0x92f7('0x1d')]?_0x161d0b[_0x92f7('0x1d')][_0x92f7('0x1f')]||null:null,'include':_0x161d0b[_0x92f7('0x1d')]?_0x161d0b[_0x92f7('0x1d')]['include']?_[_0x92f7('0x23')](_0x161d0b[_0x92f7('0x1d')][_0x92f7('0x22')],function(_0x322de7){return{'model':db[_0x322de7[_0x92f7('0x21')]],'as':_0x322de7['as'],'attributes':_0x322de7[_0x92f7('0x1f')],'include':_0x322de7[_0x92f7('0x22')]?_['map'](_0x322de7[_0x92f7('0x22')],function(_0x44ead3){return{'model':db[_0x44ead3[_0x92f7('0x21')]],'as':_0x44ead3['as'],'attributes':_0x44ead3[_0x92f7('0x1f')],'include':_0x44ead3[_0x92f7('0x22')]?_[_0x92f7('0x23')](_0x44ead3[_0x92f7('0x22')],function(_0x41c663){return{'model':db[_0x41c663[_0x92f7('0x21')]],'as':_0x41c663['as'],'attributes':_0x41c663[_0x92f7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x92f7('0x24')](function(_0x13335b){logger[_0x92f7('0x12')]('ShowSmsQueue',_0x161d0b);logger[_0x92f7('0x15')](_0x92f7('0x27'),_0x161d0b,JSON[_0x92f7('0x26')](_0x13335b));_0x176c33(_0x13335b);})[_0x92f7('0x1b')](function(_0x57750e){logger[_0x92f7('0x17')](_0x92f7('0x27'),_0x57750e[_0x92f7('0x19')],_0x161d0b);_0x4fac8c(_0x4081e3['error'](0x1f4,_0x57750e['message']));});});}; \ No newline at end of file +var _0x93b3=['catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','SmsQueue','options','where','limit','map','model','attributes','include','GetSmsQueue','debug','ShowSmsQueue','find','raw'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x93b3,0x73));var _0x393b=function(_0x143cc6,_0xf94536){_0x143cc6=_0x143cc6-0x0;var _0x2cedba=_0x93b3[_0x143cc6];return _0x2cedba;};'use strict';var _=require('lodash');var util=require(_0x393b('0x0'));var moment=require(_0x393b('0x1'));var BPromise=require(_0x393b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x393b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x393b('0x4'));var logger=require(_0x393b('0x5'))(_0x393b('0x6'));var config=require(_0x393b('0x7'));var jayson=require(_0x393b('0x8'));var client=jayson[_0x393b('0x9')][_0x393b('0xa')]({'port':0x232a});config[_0x393b('0xb')]=_[_0x393b('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x393b('0xd'))(new Redis(config[_0x393b('0xb')]));require('./smsQueue.socket')[_0x393b('0xe')](socket);function respondWithRpcPromise(_0x297d00,_0x521d2b,_0x42a48c){return new BPromise(function(_0x30c28a,_0x454b61){return client['request'](_0x297d00,_0x42a48c)[_0x393b('0xf')](function(_0x3988f6){logger[_0x393b('0x10')](_0x393b('0x11'),_0x521d2b,_0x393b('0x12'));logger['debug'](_0x393b('0x13'),_0x521d2b,_0x393b('0x12'),JSON[_0x393b('0x14')](_0x3988f6));if(_0x3988f6['error']){if(_0x3988f6[_0x393b('0x15')]['code']===0x1f4){logger[_0x393b('0x15')]('SmsQueue,\x20%s,\x20%s',_0x521d2b,_0x3988f6[_0x393b('0x15')][_0x393b('0x16')]);return _0x454b61(_0x3988f6['error']['message']);}logger[_0x393b('0x15')]('SmsQueue,\x20%s,\x20%s',_0x521d2b,_0x3988f6[_0x393b('0x15')][_0x393b('0x16')]);return _0x30c28a(_0x3988f6[_0x393b('0x15')][_0x393b('0x16')]);}else{logger[_0x393b('0x10')](_0x393b('0x11'),_0x521d2b,_0x393b('0x12'));_0x30c28a(_0x3988f6[_0x393b('0x17')][_0x393b('0x16')]);}})['catch'](function(_0x134461){logger['error'](_0x393b('0x11'),_0x521d2b,_0x134461);_0x454b61(_0x134461);});});}exports['GetSmsQueue']=function(_0x2d5303){var _0x2d76fa=this;return new Promise(function(_0x1ed85a,_0x5b07df){return db[_0x393b('0x18')]['findAll']({'raw':_0x2d5303[_0x393b('0x19')]?_0x2d5303[_0x393b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2d5303[_0x393b('0x19')]?_0x2d5303[_0x393b('0x19')][_0x393b('0x1a')]||null:null,'attributes':_0x2d5303[_0x393b('0x19')]?_0x2d5303[_0x393b('0x19')]['attributes']||null:null,'limit':_0x2d5303['options']?_0x2d5303['options'][_0x393b('0x1b')]||null:null,'include':_0x2d5303[_0x393b('0x19')]?_0x2d5303[_0x393b('0x19')]['include']?_[_0x393b('0x1c')](_0x2d5303['options']['include'],function(_0x16dc7e){return{'model':db[_0x16dc7e[_0x393b('0x1d')]],'as':_0x16dc7e['as'],'attributes':_0x16dc7e[_0x393b('0x1e')],'include':_0x16dc7e[_0x393b('0x1f')]?_['map'](_0x16dc7e[_0x393b('0x1f')],function(_0x12ef6d){return{'model':db[_0x12ef6d[_0x393b('0x1d')]],'as':_0x12ef6d['as'],'attributes':_0x12ef6d['attributes'],'include':_0x12ef6d[_0x393b('0x1f')]?_['map'](_0x12ef6d['include'],function(_0x35ee37){return{'model':db[_0x35ee37[_0x393b('0x1d')]],'as':_0x35ee37['as'],'attributes':_0x35ee37[_0x393b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x393b('0xf')](function(_0x28e02d){logger[_0x393b('0x10')](_0x393b('0x20'),_0x2d5303);logger[_0x393b('0x21')](_0x393b('0x20'),_0x2d5303,JSON[_0x393b('0x14')](_0x28e02d));_0x1ed85a(_0x28e02d);})['catch'](function(_0x3ab36a){logger[_0x393b('0x15')]('GetSmsQueue',_0x3ab36a['message'],_0x2d5303);_0x5b07df(_0x2d76fa[_0x393b('0x15')](0x1f4,_0x3ab36a[_0x393b('0x16')]));});});};exports[_0x393b('0x22')]=function(_0x2261bb){var _0x2f3b4=this;return new Promise(function(_0xaf1a61,_0x4b28e8){return db[_0x393b('0x18')][_0x393b('0x23')]({'raw':_0x2261bb[_0x393b('0x19')]?_0x2261bb[_0x393b('0x19')][_0x393b('0x24')]===undefined?!![]:![]:!![],'where':_0x2261bb[_0x393b('0x19')]?_0x2261bb[_0x393b('0x19')][_0x393b('0x1a')]||null:null,'attributes':_0x2261bb[_0x393b('0x19')]?_0x2261bb[_0x393b('0x19')][_0x393b('0x1e')]||null:null,'include':_0x2261bb['options']?_0x2261bb['options'][_0x393b('0x1f')]?_[_0x393b('0x1c')](_0x2261bb[_0x393b('0x19')][_0x393b('0x1f')],function(_0x11d5c2){return{'model':db[_0x11d5c2[_0x393b('0x1d')]],'as':_0x11d5c2['as'],'attributes':_0x11d5c2[_0x393b('0x1e')],'include':_0x11d5c2[_0x393b('0x1f')]?_[_0x393b('0x1c')](_0x11d5c2[_0x393b('0x1f')],function(_0x1620d9){return{'model':db[_0x1620d9[_0x393b('0x1d')]],'as':_0x1620d9['as'],'attributes':_0x1620d9[_0x393b('0x1e')],'include':_0x1620d9['include']?_[_0x393b('0x1c')](_0x1620d9[_0x393b('0x1f')],function(_0x2af088){return{'model':db[_0x2af088[_0x393b('0x1d')]],'as':_0x2af088['as'],'attributes':_0x2af088['attributes']};}):[]};}):[]};}):[]:[]})[_0x393b('0xf')](function(_0x15bb50){logger['info'](_0x393b('0x22'),_0x2261bb);logger[_0x393b('0x21')]('ShowSmsQueue',_0x2261bb,JSON[_0x393b('0x14')](_0x15bb50));_0xaf1a61(_0x15bb50);})[_0x393b('0x25')](function(_0x454a12){logger[_0x393b('0x15')](_0x393b('0x22'),_0x454a12[_0x393b('0x16')],_0x2261bb);_0x4b28e8(_0x2f3b4['error'](0x1f4,_0x454a12['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index b6eed87..a4567f4 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 _0x978a=['save','removeListener','register','length'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0x978a,0x80));var _0xa978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x978a[_0x3dd15e];return _0x231fd0;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xa978('0x0'),'remove','update'];function createListener(_0x18d8d5,_0x16f69c){return function(_0x2bc7e5){_0x16f69c['emit'](_0x18d8d5,_0x2bc7e5);};}function removeListener(_0x112320,_0x235f3f){return function(){SmsQueueEvents[_0xa978('0x1')](_0x112320,_0x235f3f);};}exports[_0xa978('0x2')]=function(_0x330bd4){for(var _0x1de11e=0x0,_0x3716fb=events[_0xa978('0x3')];_0x1de11e<_0x3716fb;_0x1de11e++){var _0x5eff7b=events[_0x1de11e];var _0x1bccfa=createListener('smsQueue:'+_0x5eff7b,_0x330bd4);SmsQueueEvents['on'](_0x5eff7b,_0x1bccfa);}}; \ No newline at end of file +var _0x17f2=['smsQueue:','./smsQueue.events','save','remove','update','removeListener','register','length'];(function(_0x17ef22,_0x4b3c59){var _0x2f8875=function(_0x133620){while(--_0x133620){_0x17ef22['push'](_0x17ef22['shift']());}};_0x2f8875(++_0x4b3c59);}(_0x17f2,0x1b1));var _0x217f=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0x17f2[_0x533110];return _0xc3c866;};'use strict';var SmsQueueEvents=require(_0x217f('0x0'));var events=[_0x217f('0x1'),_0x217f('0x2'),_0x217f('0x3')];function createListener(_0x560867,_0x4ad340){return function(_0x226f9d){_0x4ad340['emit'](_0x560867,_0x226f9d);};}function removeListener(_0x2c82fb,_0x4dfa50){return function(){SmsQueueEvents[_0x217f('0x4')](_0x2c82fb,_0x4dfa50);};}exports[_0x217f('0x5')]=function(_0x413c37){for(var _0x4c3b7a=0x0,_0x193809=events[_0x217f('0x6')];_0x4c3b7a<_0x193809;_0x4c3b7a++){var _0x260908=events[_0x4c3b7a];var _0x5e47b6=createListener(_0x217f('0x7')+_0x260908,_0x413c37);SmsQueueEvents['on'](_0x260908,_0x5e47b6);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index e785ccb..533118b 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 _0x891b=['show','post','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','index','describe','/:id','isAuthenticated'];(function(_0x522d99,_0x3f19c0){var _0x323c13=function(_0x3e9ddf){while(--_0x3e9ddf){_0x522d99['push'](_0x522d99['shift']());}};_0x323c13(++_0x3f19c0);}(_0x891b,0xc5));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb891('0x0'));var timeout=require(_0xb891('0x1'));var express=require('express');var router=express[_0xb891('0x2')]();var fs_extra=require(_0xb891('0x3'));var auth=require(_0xb891('0x4'));var interaction=require(_0xb891('0x5'));var config=require('../../config/environment');var controller=require(_0xb891('0x6'));router[_0xb891('0x7')]('/',auth['isAuthenticated'](),controller[_0xb891('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb891('0x9')]);router[_0xb891('0x7')](_0xb891('0xa'),auth[_0xb891('0xb')](),controller[_0xb891('0xc')]);router[_0xb891('0xd')]('/',auth[_0xb891('0xb')](),controller['create']);router[_0xb891('0xe')](_0xb891('0xa'),auth[_0xb891('0xb')](),controller[_0xb891('0xf')]);router[_0xb891('0x10')](_0xb891('0xa'),auth[_0xb891('0xb')](),controller[_0xb891('0x11')]);module[_0xb891('0x12')]=router; \ No newline at end of file +var _0x1a61=['index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./smsQueueReport.controller','get'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x1a61,0x1e6));var _0x11a6=function(_0x809c4c,_0x22a251){_0x809c4c=_0x809c4c-0x0;var _0x2ff5bf=_0x1a61[_0x809c4c];return _0x2ff5bf;};'use strict';var multer=require(_0x11a6('0x0'));var util=require('util');var path=require(_0x11a6('0x1'));var timeout=require('connect-timeout');var express=require(_0x11a6('0x2'));var router=express[_0x11a6('0x3')]();var fs_extra=require(_0x11a6('0x4'));var auth=require(_0x11a6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x11a6('0x6'));router[_0x11a6('0x7')]('/',auth['isAuthenticated'](),controller[_0x11a6('0x8')]);router[_0x11a6('0x7')](_0x11a6('0x9'),auth[_0x11a6('0xa')](),controller[_0x11a6('0xb')]);router[_0x11a6('0x7')](_0x11a6('0xc'),auth[_0x11a6('0xa')](),controller[_0x11a6('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x11a6('0xe')](_0x11a6('0xc'),auth['isAuthenticated'](),controller[_0x11a6('0xf')]);router[_0x11a6('0x10')](_0x11a6('0xc'),auth[_0x11a6('0xa')](),controller[_0x11a6('0x11')]);module[_0x11a6('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 6dc7059..3fd3a16 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 _0x4534=['DATE','moment','sequelize','exports','STRING'];(function(_0x3e0191,_0x1d4b20){var _0xf2ae83=function(_0x277210){while(--_0x277210){_0x3e0191['push'](_0x3e0191['shift']());}};_0xf2ae83(++_0x1d4b20);}(_0x4534,0x141));var _0x4453=function(_0x1d54e1,_0x5ea0e4){_0x1d54e1=_0x1d54e1-0x0;var _0x2add35=_0x4534[_0x1d54e1];return _0x2add35;};'use strict';var moment=require(_0x4453('0x0'));var Sequelize=require(_0x4453('0x1'));module[_0x4453('0x2')]={'uniqueid':{'type':Sequelize[_0x4453('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4453('0x4')]},'leaveAt':{'type':Sequelize[_0x4453('0x4')]},'acceptAt':{'type':Sequelize[_0x4453('0x4')]},'exitAt':{'type':Sequelize[_0x4453('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdf70=['sequelize','exports','STRING','DATE','moment'];(function(_0x177dc6,_0x5aaff4){var _0x212278=function(_0x295b81){while(--_0x295b81){_0x177dc6['push'](_0x177dc6['shift']());}};_0x212278(++_0x5aaff4);}(_0xdf70,0x86));var _0x0df7=function(_0x5bdfac,_0x4a76ae){_0x5bdfac=_0x5bdfac-0x0;var _0x53a288=_0xdf70[_0x5bdfac];return _0x53a288;};'use strict';var moment=require(_0x0df7('0x0'));var Sequelize=require(_0x0df7('0x1'));module[_0x0df7('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0df7('0x3')]},'joinAt':{'type':Sequelize[_0x0df7('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0df7('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0df7('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 0a7ce99..1f39165 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 _0x0ee0=['sort','pick','filter','where','merge','VIRTUAL','SmsQueueReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','zip-dir','moment','bluebird','mustache','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0x0ee0,0x1b6));var _0x00ee=function(_0x517cba,_0xf0be72){_0x517cba=_0x517cba-0x0;var _0x4ecca7=_0x0ee0[_0x517cba];return _0x4ecca7;};'use strict';var emlformat=require(_0x00ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x00ee('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x00ee('0x2'));var BPromise=require(_0x00ee('0x3'));var Mustache=require(_0x00ee('0x4'));var util=require('util');var path=require(_0x00ee('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x00ee('0x6'));var fs=require('fs');var fs_extra=require(_0x00ee('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x00ee('0x8'));var jsforce=require(_0x00ee('0x9'));var deskjs=require(_0x00ee('0xa'));var toCsv=require(_0x00ee('0xb'));var querystring=require(_0x00ee('0xc'));var Papa=require('papaparse');var Redis=require(_0x00ee('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x00ee('0xe'));var as=require(_0x00ee('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x00ee('0x10'))(_0x00ee('0x11'));var utils=require(_0x00ee('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x00ee('0x13'));var db=require(_0x00ee('0x14'))['db'];function respondWithStatusCode(_0x128627,_0x2c86b8){_0x2c86b8=_0x2c86b8||0xcc;return function(_0x3caa69){if(_0x3caa69){return _0x128627[_0x00ee('0x15')](_0x2c86b8);}return _0x128627[_0x00ee('0x16')](_0x2c86b8)[_0x00ee('0x17')]();};}function respondWithResult(_0x5c64d7,_0x1cd271){_0x1cd271=_0x1cd271||0xc8;return function(_0x596ee9){if(_0x596ee9){return _0x5c64d7[_0x00ee('0x16')](_0x1cd271)[_0x00ee('0x18')](_0x596ee9);}};}function respondWithFilteredResult(_0x1329d6,_0x50a478){return function(_0x247a91){if(_0x247a91){var _0x33e1fc=typeof _0x50a478[_0x00ee('0x19')]===_0x00ee('0x1a')&&typeof _0x50a478[_0x00ee('0x1b')]==='undefined';var _0x4cd656=_0x247a91[_0x00ee('0x1c')];var _0x18540b=_0x33e1fc?0x0:_0x50a478[_0x00ee('0x19')];var _0x1f7dfd=_0x33e1fc?_0x247a91['count']:_0x50a478[_0x00ee('0x19')]+_0x50a478[_0x00ee('0x1b')];var _0x56bac4;if(_0x1f7dfd>=_0x4cd656){_0x1f7dfd=_0x4cd656;_0x56bac4=0xc8;}else{_0x56bac4=0xce;}_0x1329d6[_0x00ee('0x16')](_0x56bac4);return _0x1329d6['set']('Content-Range',_0x18540b+'-'+_0x1f7dfd+'/'+_0x4cd656)[_0x00ee('0x18')](_0x247a91);}return null;};}function patchUpdates(_0x14981d){return function(_0x4554bf){try{jsonpatch['apply'](_0x4554bf,_0x14981d,!![]);}catch(_0x49819e){return BPromise[_0x00ee('0x1d')](_0x49819e);}return _0x4554bf[_0x00ee('0x1e')]();};}function saveUpdates(_0x1c0275,_0x10ce6d){return function(_0x28ba96){if(_0x28ba96){return _0x28ba96[_0x00ee('0x1f')](_0x1c0275)[_0x00ee('0x20')](function(_0xa4b25f){return _0xa4b25f;});}return null;};}function removeEntity(_0x15388a,_0x59d951){return function(_0x46f98b){if(_0x46f98b){return _0x46f98b[_0x00ee('0x21')]()['then'](function(){_0x15388a['status'](0xcc)[_0x00ee('0x17')]();});}};}function handleEntityNotFound(_0x38102b,_0x1a8e49){return function(_0xf6e238){if(!_0xf6e238){_0x38102b['sendStatus'](0x194);}return _0xf6e238;};}function handleError(_0x455f51,_0x551fb0){_0x551fb0=_0x551fb0||0x1f4;return function(_0x4081e1){logger[_0x00ee('0x22')](_0x4081e1[_0x00ee('0x23')]);if(_0x4081e1[_0x00ee('0x24')]){delete _0x4081e1[_0x00ee('0x24')];}_0x455f51[_0x00ee('0x16')](_0x551fb0)[_0x00ee('0x25')](_0x4081e1);};}exports['index']=function(_0xa4ea0b,_0x4c9abf){var _0x2d0868={},_0x165339={},_0x5064ae={'count':0x0,'rows':[]};var _0x41ee04=_[_0x00ee('0x26')](db['SmsQueueReport'][_0x00ee('0x27')],function(_0x3120b8){return{'name':_0x3120b8[_0x00ee('0x28')],'type':_0x3120b8[_0x00ee('0x29')]['key']};});_0x165339[_0x00ee('0x2a')]=_[_0x00ee('0x26')](_0x41ee04,_0x00ee('0x24'));_0x165339[_0x00ee('0x2b')]=_[_0x00ee('0x2c')](_0xa4ea0b[_0x00ee('0x2b')]);_0x165339[_0x00ee('0x2d')]=_[_0x00ee('0x2e')](_0x165339['model'],_0x165339['query']);_0x2d0868[_0x00ee('0x2f')]=_['intersection'](_0x165339[_0x00ee('0x2a')],qs[_0x00ee('0x30')](_0xa4ea0b[_0x00ee('0x2b')][_0x00ee('0x30')]));_0x2d0868['attributes']=_0x2d0868[_0x00ee('0x2f')][_0x00ee('0x31')]?_0x2d0868[_0x00ee('0x2f')]:_0x165339[_0x00ee('0x2a')];if(!_0xa4ea0b[_0x00ee('0x2b')]['hasOwnProperty'](_0x00ee('0x32'))){_0x2d0868['limit']=qs[_0x00ee('0x1b')](_0xa4ea0b[_0x00ee('0x2b')][_0x00ee('0x1b')]);_0x2d0868[_0x00ee('0x19')]=qs[_0x00ee('0x19')](_0xa4ea0b[_0x00ee('0x2b')][_0x00ee('0x19')]);}_0x2d0868[_0x00ee('0x33')]=qs[_0x00ee('0x34')](_0xa4ea0b[_0x00ee('0x2b')][_0x00ee('0x34')]);_0x2d0868['where']=qs[_0x00ee('0x2d')](_[_0x00ee('0x35')](_0xa4ea0b[_0x00ee('0x2b')],_0x165339['filters']),_0x41ee04);if(_0xa4ea0b['query'][_0x00ee('0x36')]){_0x2d0868[_0x00ee('0x37')]=_[_0x00ee('0x38')](_0x2d0868[_0x00ee('0x37')],{'$or':_['map'](_0x41ee04,function(_0x57ee5a){if(_0x57ee5a[_0x00ee('0x29')]!==_0x00ee('0x39')){var _0x2c098a={};_0x2c098a[_0x57ee5a['name']]={'$like':'%'+_0xa4ea0b['query'][_0x00ee('0x36')]+'%'};return _0x2c098a;}})});}_0x2d0868=_[_0x00ee('0x38')]({},_0x2d0868,_0xa4ea0b['options']);var _0x38fdd1={'where':_0x2d0868[_0x00ee('0x37')]};return db[_0x00ee('0x3a')][_0x00ee('0x1c')](_0x38fdd1)['then'](function(_0x2c9aa9){_0x5064ae[_0x00ee('0x1c')]=_0x2c9aa9;if(_0xa4ea0b[_0x00ee('0x2b')][_0x00ee('0x3b')]){_0x2d0868[_0x00ee('0x3c')]=[{'all':!![]}];}return db[_0x00ee('0x3a')][_0x00ee('0x3d')](_0x2d0868);})[_0x00ee('0x20')](function(_0x37a4d4){_0x5064ae[_0x00ee('0x3e')]=_0x37a4d4;return _0x5064ae;})[_0x00ee('0x20')](respondWithFilteredResult(_0x4c9abf,_0x2d0868))[_0x00ee('0x3f')](handleError(_0x4c9abf,null));};exports[_0x00ee('0x40')]=function(_0x84e7f9,_0x3910a8){var _0x278764={'raw':!![],'where':{'id':_0x84e7f9['params']['id']}},_0x1d5f0d={};_0x1d5f0d[_0x00ee('0x2a')]=_[_0x00ee('0x2c')](db[_0x00ee('0x3a')][_0x00ee('0x27')]);_0x1d5f0d['query']=_[_0x00ee('0x2c')](_0x84e7f9[_0x00ee('0x2b')]);_0x1d5f0d[_0x00ee('0x2d')]=_[_0x00ee('0x2e')](_0x1d5f0d[_0x00ee('0x2a')],_0x1d5f0d['query']);_0x278764[_0x00ee('0x2f')]=_['intersection'](_0x1d5f0d[_0x00ee('0x2a')],qs[_0x00ee('0x30')](_0x84e7f9[_0x00ee('0x2b')]['fields']));_0x278764[_0x00ee('0x2f')]=_0x278764[_0x00ee('0x2f')]['length']?_0x278764[_0x00ee('0x2f')]:_0x1d5f0d['model'];if(_0x84e7f9[_0x00ee('0x2b')]['includeAll']){_0x278764['include']=[{'all':!![]}];}_0x278764=_[_0x00ee('0x38')]({},_0x278764,_0x84e7f9['options']);return db[_0x00ee('0x3a')][_0x00ee('0x41')](_0x278764)[_0x00ee('0x20')](handleEntityNotFound(_0x3910a8,null))[_0x00ee('0x20')](respondWithResult(_0x3910a8,null))['catch'](handleError(_0x3910a8,null));};exports[_0x00ee('0x42')]=function(_0x5303bf,_0x30517d){return db[_0x00ee('0x3a')]['create'](_0x5303bf[_0x00ee('0x43')],{})[_0x00ee('0x20')](respondWithResult(_0x30517d,0xc9))[_0x00ee('0x3f')](handleError(_0x30517d,null));};exports[_0x00ee('0x1f')]=function(_0x52e6ba,_0x2e211b){if(_0x52e6ba[_0x00ee('0x43')]['id']){delete _0x52e6ba[_0x00ee('0x43')]['id'];}return db[_0x00ee('0x3a')][_0x00ee('0x41')]({'where':{'id':_0x52e6ba[_0x00ee('0x44')]['id']}})[_0x00ee('0x20')](handleEntityNotFound(_0x2e211b,null))['then'](saveUpdates(_0x52e6ba[_0x00ee('0x43')],null))[_0x00ee('0x20')](respondWithResult(_0x2e211b,null))[_0x00ee('0x3f')](handleError(_0x2e211b,null));};exports[_0x00ee('0x21')]=function(_0x4e987f,_0x4e1f52){return db[_0x00ee('0x3a')]['find']({'where':{'id':_0x4e987f['params']['id']}})[_0x00ee('0x20')](handleEntityNotFound(_0x4e1f52,null))[_0x00ee('0x20')](removeEntity(_0x4e1f52,null))[_0x00ee('0x3f')](handleError(_0x4e1f52,null));};exports[_0x00ee('0x45')]=function(_0x120f09,_0x461afc){return db[_0x00ee('0x3a')]['describe']()[_0x00ee('0x20')](respondWithResult(_0x461afc,null))['catch'](handleError(_0x461afc,null));}; \ No newline at end of file +var _0x2c0a=['to-csv','ejs','fs-extra','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','error','stack','map','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','SmsQueueReport','includeAll','include','findAll','then','rows','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x2c0a,0x16d));var _0xa2c0=function(_0x118afa,_0x4bf0c1){_0x118afa=_0x118afa-0x0;var _0x167d76=_0x2c0a[_0x118afa];return _0x167d76;};'use strict';var emlformat=require(_0xa2c0('0x0'));var rimraf=require(_0xa2c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa2c0('0x2'));var rp=require(_0xa2c0('0x3'));var moment=require(_0xa2c0('0x4'));var BPromise=require(_0xa2c0('0x5'));var Mustache=require(_0xa2c0('0x6'));var util=require(_0xa2c0('0x7'));var path=require(_0xa2c0('0x8'));var sox=require(_0xa2c0('0x9'));var csv=require(_0xa2c0('0xa'));var ejs=require(_0xa2c0('0xb'));var fs=require('fs');var fs_extra=require(_0xa2c0('0xc'));var _=require('lodash');var squel=require(_0xa2c0('0xd'));var crypto=require('crypto');var jsforce=require(_0xa2c0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa2c0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa2c0('0xf'));var authService=require(_0xa2c0('0x10'));var qs=require(_0xa2c0('0x11'));var as=require(_0xa2c0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2c0('0x13'))(_0xa2c0('0x14'));var utils=require('../../config/utils');var config=require(_0xa2c0('0x15'));var licenseUtil=require(_0xa2c0('0x16'));var db=require(_0xa2c0('0x17'))['db'];function respondWithStatusCode(_0x2e988d,_0x416a7c){_0x416a7c=_0x416a7c||0xcc;return function(_0x432d4c){if(_0x432d4c){return _0x2e988d[_0xa2c0('0x18')](_0x416a7c);}return _0x2e988d[_0xa2c0('0x19')](_0x416a7c)[_0xa2c0('0x1a')]();};}function respondWithResult(_0x22ca43,_0x568f68){_0x568f68=_0x568f68||0xc8;return function(_0x9fc3c6){if(_0x9fc3c6){return _0x22ca43[_0xa2c0('0x19')](_0x568f68)[_0xa2c0('0x1b')](_0x9fc3c6);}};}function respondWithFilteredResult(_0x20ac3f,_0x326e14){return function(_0x470cb9){if(_0x470cb9){var _0xac21e4=typeof _0x326e14[_0xa2c0('0x1c')]===_0xa2c0('0x1d')&&typeof _0x326e14[_0xa2c0('0x1e')]===_0xa2c0('0x1d');var _0x580629=_0x470cb9['count'];var _0x55ef07=_0xac21e4?0x0:_0x326e14[_0xa2c0('0x1c')];var _0x2741d4=_0xac21e4?_0x470cb9[_0xa2c0('0x1f')]:_0x326e14[_0xa2c0('0x1c')]+_0x326e14[_0xa2c0('0x1e')];var _0x46e56d;if(_0x2741d4>=_0x580629){_0x2741d4=_0x580629;_0x46e56d=0xc8;}else{_0x46e56d=0xce;}_0x20ac3f[_0xa2c0('0x19')](_0x46e56d);return _0x20ac3f[_0xa2c0('0x20')]('Content-Range',_0x55ef07+'-'+_0x2741d4+'/'+_0x580629)[_0xa2c0('0x1b')](_0x470cb9);}return null;};}function patchUpdates(_0x5059fb){return function(_0x337696){try{jsonpatch[_0xa2c0('0x21')](_0x337696,_0x5059fb,!![]);}catch(_0x2e79df){return BPromise[_0xa2c0('0x22')](_0x2e79df);}return _0x337696[_0xa2c0('0x23')]();};}function saveUpdates(_0x2ae805,_0x285e76){return function(_0x3195b0){if(_0x3195b0){return _0x3195b0['update'](_0x2ae805)['then'](function(_0x344454){return _0x344454;});}return null;};}function removeEntity(_0x5c889d,_0x2ffd89){return function(_0x10e946){if(_0x10e946){return _0x10e946['destroy']()['then'](function(){_0x5c889d['status'](0xcc)[_0xa2c0('0x1a')]();});}};}function handleEntityNotFound(_0x16c00f,_0x251ff8){return function(_0x75ba7){if(!_0x75ba7){_0x16c00f[_0xa2c0('0x18')](0x194);}return _0x75ba7;};}function handleError(_0x10b3e2,_0x5ca77f){_0x5ca77f=_0x5ca77f||0x1f4;return function(_0x321ab8){logger[_0xa2c0('0x24')](_0x321ab8[_0xa2c0('0x25')]);if(_0x321ab8['name']){delete _0x321ab8['name'];}_0x10b3e2[_0xa2c0('0x19')](_0x5ca77f)['send'](_0x321ab8);};}exports['index']=function(_0x25e7a5,_0x3470f9){var _0x510c66={},_0x14c317={},_0x4bb8dc={'count':0x0,'rows':[]};var _0x46297e=_[_0xa2c0('0x26')](db['SmsQueueReport'][_0xa2c0('0x27')],function(_0x533636){return{'name':_0x533636[_0xa2c0('0x28')],'type':_0x533636[_0xa2c0('0x29')]['key']};});_0x14c317[_0xa2c0('0x2a')]=_['map'](_0x46297e,_0xa2c0('0x2b'));_0x14c317[_0xa2c0('0x2c')]=_[_0xa2c0('0x2d')](_0x25e7a5[_0xa2c0('0x2c')]);_0x14c317[_0xa2c0('0x2e')]=_['intersection'](_0x14c317['model'],_0x14c317['query']);_0x510c66[_0xa2c0('0x2f')]=_[_0xa2c0('0x30')](_0x14c317[_0xa2c0('0x2a')],qs[_0xa2c0('0x31')](_0x25e7a5[_0xa2c0('0x2c')]['fields']));_0x510c66[_0xa2c0('0x2f')]=_0x510c66[_0xa2c0('0x2f')][_0xa2c0('0x32')]?_0x510c66['attributes']:_0x14c317[_0xa2c0('0x2a')];if(!_0x25e7a5[_0xa2c0('0x2c')][_0xa2c0('0x33')](_0xa2c0('0x34'))){_0x510c66[_0xa2c0('0x1e')]=qs['limit'](_0x25e7a5[_0xa2c0('0x2c')][_0xa2c0('0x1e')]);_0x510c66[_0xa2c0('0x1c')]=qs[_0xa2c0('0x1c')](_0x25e7a5[_0xa2c0('0x2c')]['offset']);}_0x510c66[_0xa2c0('0x35')]=qs[_0xa2c0('0x36')](_0x25e7a5[_0xa2c0('0x2c')]['sort']);_0x510c66[_0xa2c0('0x37')]=qs[_0xa2c0('0x2e')](_[_0xa2c0('0x38')](_0x25e7a5[_0xa2c0('0x2c')],_0x14c317[_0xa2c0('0x2e')]),_0x46297e);if(_0x25e7a5[_0xa2c0('0x2c')]['filter']){_0x510c66['where']=_[_0xa2c0('0x39')](_0x510c66['where'],{'$or':_['map'](_0x46297e,function(_0x20da97){if(_0x20da97[_0xa2c0('0x29')]!==_0xa2c0('0x3a')){var _0x418bf1={};_0x418bf1[_0x20da97['name']]={'$like':'%'+_0x25e7a5[_0xa2c0('0x2c')][_0xa2c0('0x3b')]+'%'};return _0x418bf1;}})});}_0x510c66=_[_0xa2c0('0x39')]({},_0x510c66,_0x25e7a5['options']);var _0x554a88={'where':_0x510c66[_0xa2c0('0x37')]};return db[_0xa2c0('0x3c')]['count'](_0x554a88)['then'](function(_0x297ca5){_0x4bb8dc[_0xa2c0('0x1f')]=_0x297ca5;if(_0x25e7a5[_0xa2c0('0x2c')][_0xa2c0('0x3d')]){_0x510c66[_0xa2c0('0x3e')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xa2c0('0x3f')](_0x510c66);})[_0xa2c0('0x40')](function(_0x4bf267){_0x4bb8dc[_0xa2c0('0x41')]=_0x4bf267;return _0x4bb8dc;})['then'](respondWithFilteredResult(_0x3470f9,_0x510c66))[_0xa2c0('0x42')](handleError(_0x3470f9,null));};exports[_0xa2c0('0x43')]=function(_0x365243,_0x387af1){var _0x37dd90={'raw':!![],'where':{'id':_0x365243[_0xa2c0('0x44')]['id']}},_0x50748d={};_0x50748d[_0xa2c0('0x2a')]=_[_0xa2c0('0x2d')](db[_0xa2c0('0x3c')]['rawAttributes']);_0x50748d['query']=_[_0xa2c0('0x2d')](_0x365243[_0xa2c0('0x2c')]);_0x50748d['filters']=_[_0xa2c0('0x30')](_0x50748d[_0xa2c0('0x2a')],_0x50748d['query']);_0x37dd90[_0xa2c0('0x2f')]=_['intersection'](_0x50748d[_0xa2c0('0x2a')],qs['fields'](_0x365243[_0xa2c0('0x2c')][_0xa2c0('0x31')]));_0x37dd90['attributes']=_0x37dd90[_0xa2c0('0x2f')][_0xa2c0('0x32')]?_0x37dd90[_0xa2c0('0x2f')]:_0x50748d[_0xa2c0('0x2a')];if(_0x365243[_0xa2c0('0x2c')][_0xa2c0('0x3d')]){_0x37dd90['include']=[{'all':!![]}];}_0x37dd90=_['merge']({},_0x37dd90,_0x365243[_0xa2c0('0x45')]);return db[_0xa2c0('0x3c')][_0xa2c0('0x46')](_0x37dd90)[_0xa2c0('0x40')](handleEntityNotFound(_0x387af1,null))[_0xa2c0('0x40')](respondWithResult(_0x387af1,null))[_0xa2c0('0x42')](handleError(_0x387af1,null));};exports[_0xa2c0('0x47')]=function(_0x4e117e,_0xa00cfe){return db[_0xa2c0('0x3c')][_0xa2c0('0x47')](_0x4e117e[_0xa2c0('0x48')],{})[_0xa2c0('0x40')](respondWithResult(_0xa00cfe,0xc9))['catch'](handleError(_0xa00cfe,null));};exports['update']=function(_0x4b3181,_0x271777){if(_0x4b3181['body']['id']){delete _0x4b3181['body']['id'];}return db[_0xa2c0('0x3c')][_0xa2c0('0x46')]({'where':{'id':_0x4b3181[_0xa2c0('0x44')]['id']}})[_0xa2c0('0x40')](handleEntityNotFound(_0x271777,null))[_0xa2c0('0x40')](saveUpdates(_0x4b3181[_0xa2c0('0x48')],null))[_0xa2c0('0x40')](respondWithResult(_0x271777,null))[_0xa2c0('0x42')](handleError(_0x271777,null));};exports[_0xa2c0('0x49')]=function(_0x4d818e,_0x8b7655){return db[_0xa2c0('0x3c')]['find']({'where':{'id':_0x4d818e[_0xa2c0('0x44')]['id']}})['then'](handleEntityNotFound(_0x8b7655,null))[_0xa2c0('0x40')](removeEntity(_0x8b7655,null))[_0xa2c0('0x42')](handleError(_0x8b7655,null));};exports[_0xa2c0('0x4a')]=function(_0x5891c3,_0x6647e6){return db[_0xa2c0('0x3c')][_0xa2c0('0x4a')]()['then'](respondWithResult(_0x6647e6,null))[_0xa2c0('0x42')](handleError(_0x6647e6,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index b4b8e58..5aaf412 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(_0x1aa13e,_0x12a40b){var _0x1144bd=function(_0x5f5cae){while(--_0x5f5cae){_0x1aa13e['push'](_0x1aa13e['shift']());}};_0x1144bd(++_0x12a40b);}(_0xe706,0xa3));var _0x6e70=function(_0x3318c3,_0x35066){_0x3318c3=_0x3318c3-0x0;var _0x15c002=_0xe706[_0x3318c3];return _0x15c002;};'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 _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 5875377..b1701d5 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 _0x23d6=['CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','body','where','attributes','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SmsQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x15fd49,_0x5d2aec){var _0xb0523=function(_0x1e2799){while(--_0x1e2799){_0x15fd49['push'](_0x15fd49['shift']());}};_0xb0523(++_0x5d2aec);}(_0x23d6,0x85));var _0x623d=function(_0x3e4cd9,_0x50d11c){_0x3e4cd9=_0x3e4cd9-0x0;var _0x4fa571=_0x23d6[_0x3e4cd9];return _0x4fa571;};'use strict';var _=require(_0x623d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x623d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x623d('0x2'));var db=require(_0x623d('0x3'))['db'];var utils=require(_0x623d('0x4'));var logger=require(_0x623d('0x5'))(_0x623d('0x6'));var config=require(_0x623d('0x7'));var jayson=require(_0x623d('0x8'));var client=jayson[_0x623d('0x9')][_0x623d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x340c70,_0x1287a1,_0x98d458){return new BPromise(function(_0x4b0ac3,_0x5770fd){return client['request'](_0x340c70,_0x98d458)[_0x623d('0xb')](function(_0x57a22b){logger['info'](_0x623d('0xc'),_0x1287a1,'request\x20sent');logger[_0x623d('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1287a1,_0x623d('0xe'),JSON[_0x623d('0xf')](_0x57a22b));if(_0x57a22b[_0x623d('0x10')]){if(_0x57a22b['error'][_0x623d('0x11')]===0x1f4){logger[_0x623d('0x10')](_0x623d('0xc'),_0x1287a1,_0x57a22b[_0x623d('0x10')][_0x623d('0x12')]);return _0x5770fd(_0x57a22b[_0x623d('0x10')]['message']);}logger[_0x623d('0x10')](_0x623d('0xc'),_0x1287a1,_0x57a22b[_0x623d('0x10')][_0x623d('0x12')]);return _0x4b0ac3(_0x57a22b[_0x623d('0x10')][_0x623d('0x12')]);}else{logger[_0x623d('0x13')](_0x623d('0xc'),_0x1287a1,_0x623d('0xe'));_0x4b0ac3(_0x57a22b[_0x623d('0x14')][_0x623d('0x12')]);}})[_0x623d('0x15')](function(_0x57d80c){logger[_0x623d('0x10')](_0x623d('0xc'),_0x1287a1,_0x57d80c);_0x5770fd(_0x57d80c);});});}exports[_0x623d('0x16')]=function(_0x2e2749){var _0x423014=this;return new Promise(function(_0x429242,_0x3e3ad4){return db[_0x623d('0x17')][_0x623d('0x18')](_0x2e2749['body'],{'raw':_0x2e2749[_0x623d('0x19')]?_0x2e2749['options'][_0x623d('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x50b7d9){logger[_0x623d('0x13')](_0x623d('0x16'),_0x2e2749);logger['debug'](_0x623d('0x16'),_0x2e2749,JSON[_0x623d('0xf')](_0x50b7d9));_0x429242(_0x50b7d9);})[_0x623d('0x15')](function(_0x49648c){logger[_0x623d('0x10')](_0x623d('0x16'),_0x49648c['message'],_0x2e2749);_0x3e3ad4(_0x423014['error'](0x1f4,_0x49648c[_0x623d('0x12')]));});});};exports[_0x623d('0x1b')]=function(_0x373db9){var _0x3ff6c0=this;return new Promise(function(_0x5cd253,_0x1f383b){return db[_0x623d('0x17')]['update'](_0x373db9[_0x623d('0x1c')],{'raw':_0x373db9[_0x623d('0x19')]?_0x373db9[_0x623d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x373db9[_0x623d('0x19')]?_0x373db9[_0x623d('0x19')][_0x623d('0x1d')]||null:null,'attributes':_0x373db9[_0x623d('0x19')]?_0x373db9[_0x623d('0x19')][_0x623d('0x1e')]||null:null,'limit':_0x373db9[_0x623d('0x19')]?_0x373db9[_0x623d('0x19')]['limit']||null:null})['then'](function(_0x41e6b3){logger[_0x623d('0x13')](_0x623d('0x1b'),_0x373db9);logger[_0x623d('0xd')](_0x623d('0x1b'),_0x373db9,JSON[_0x623d('0xf')](_0x41e6b3));_0x5cd253(_0x41e6b3);})[_0x623d('0x15')](function(_0x37a71f){logger[_0x623d('0x10')](_0x623d('0x1b'),_0x37a71f[_0x623d('0x12')],_0x373db9);_0x1f383b(_0x3ff6c0['error'](0x1f4,_0x37a71f[_0x623d('0x12')]));});});}; \ No newline at end of file +var _0x2c9f=['SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','UpdateSmsQueueReport','where','attributes','limit','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SmsQueueReport,\x20%s,\x20%s','debug'];(function(_0x23193b,_0x248447){var _0x5cf7ff=function(_0x507286){while(--_0x507286){_0x23193b['push'](_0x23193b['shift']());}};_0x5cf7ff(++_0x248447);}(_0x2c9f,0x1ee));var _0xf2c9=function(_0x2b048f,_0x592b9a){_0x2b048f=_0x2b048f-0x0;var _0x5208b0=_0x2c9f[_0x2b048f];return _0x5208b0;};'use strict';var _=require(_0xf2c9('0x0'));var util=require('util');var moment=require(_0xf2c9('0x1'));var BPromise=require(_0xf2c9('0x2'));var rs=require(_0xf2c9('0x3'));var fs=require('fs');var Redis=require(_0xf2c9('0x4'));var db=require(_0xf2c9('0x5'))['db'];var utils=require(_0xf2c9('0x6'));var logger=require(_0xf2c9('0x7'))(_0xf2c9('0x8'));var config=require(_0xf2c9('0x9'));var jayson=require(_0xf2c9('0xa'));var client=jayson['client'][_0xf2c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d6f61,_0x4b431a,_0x32a728){return new BPromise(function(_0x10f472,_0x51531e){return client[_0xf2c9('0xc')](_0x5d6f61,_0x32a728)[_0xf2c9('0xd')](function(_0x76e982){logger['info'](_0xf2c9('0xe'),_0x4b431a,'request\x20sent');logger[_0xf2c9('0xf')](_0xf2c9('0x10'),_0x4b431a,_0xf2c9('0x11'),JSON[_0xf2c9('0x12')](_0x76e982));if(_0x76e982[_0xf2c9('0x13')]){if(_0x76e982['error'][_0xf2c9('0x14')]===0x1f4){logger[_0xf2c9('0x13')](_0xf2c9('0xe'),_0x4b431a,_0x76e982['error'][_0xf2c9('0x15')]);return _0x51531e(_0x76e982[_0xf2c9('0x13')][_0xf2c9('0x15')]);}logger[_0xf2c9('0x13')](_0xf2c9('0xe'),_0x4b431a,_0x76e982[_0xf2c9('0x13')][_0xf2c9('0x15')]);return _0x10f472(_0x76e982[_0xf2c9('0x13')][_0xf2c9('0x15')]);}else{logger['info'](_0xf2c9('0xe'),_0x4b431a,_0xf2c9('0x11'));_0x10f472(_0x76e982[_0xf2c9('0x16')][_0xf2c9('0x15')]);}})[_0xf2c9('0x17')](function(_0x5defb8){logger[_0xf2c9('0x13')](_0xf2c9('0xe'),_0x4b431a,_0x5defb8);_0x51531e(_0x5defb8);});});}exports[_0xf2c9('0x18')]=function(_0xaa644d){var _0x6f4db3=this;return new Promise(function(_0x158a34,_0x3f9ae6){return db[_0xf2c9('0x19')]['create'](_0xaa644d[_0xf2c9('0x1a')],{'raw':_0xaa644d['options']?_0xaa644d[_0xf2c9('0x1b')][_0xf2c9('0x1c')]===undefined?!![]:![]:!![]})[_0xf2c9('0xd')](function(_0x2e27ed){logger['info'](_0xf2c9('0x18'),_0xaa644d);logger['debug'](_0xf2c9('0x18'),_0xaa644d,JSON[_0xf2c9('0x12')](_0x2e27ed));_0x158a34(_0x2e27ed);})[_0xf2c9('0x17')](function(_0x18fee1){logger[_0xf2c9('0x13')](_0xf2c9('0x18'),_0x18fee1['message'],_0xaa644d);_0x3f9ae6(_0x6f4db3[_0xf2c9('0x13')](0x1f4,_0x18fee1[_0xf2c9('0x15')]));});});};exports[_0xf2c9('0x1d')]=function(_0x10349b){var _0xd7737f=this;return new Promise(function(_0x833108,_0x50ab65){return db[_0xf2c9('0x19')]['update'](_0x10349b['body'],{'raw':_0x10349b[_0xf2c9('0x1b')]?_0x10349b[_0xf2c9('0x1b')][_0xf2c9('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10349b['options']?_0x10349b[_0xf2c9('0x1b')][_0xf2c9('0x1e')]||null:null,'attributes':_0x10349b['options']?_0x10349b[_0xf2c9('0x1b')][_0xf2c9('0x1f')]||null:null,'limit':_0x10349b[_0xf2c9('0x1b')]?_0x10349b[_0xf2c9('0x1b')][_0xf2c9('0x20')]||null:null})['then'](function(_0x467500){logger[_0xf2c9('0x21')](_0xf2c9('0x1d'),_0x10349b);logger[_0xf2c9('0xf')](_0xf2c9('0x1d'),_0x10349b,JSON[_0xf2c9('0x12')](_0x467500));_0x833108(_0x467500);})[_0xf2c9('0x17')](function(_0x172c4e){logger['error']('UpdateSmsQueueReport',_0x172c4e['message'],_0x10349b);_0x50ab65(_0xd7737f[_0xf2c9('0x13')](0x1f4,_0x172c4e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index f9f24b7..9adfb2d 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 _0x6b8f=['destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put'];(function(_0x76fea7,_0x164167){var _0x3183c0=function(_0x1f4a4f){while(--_0x1f4a4f){_0x76fea7['push'](_0x76fea7['shift']());}};_0x3183c0(++_0x164167);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x4ebbe6,_0x316dcd){_0x4ebbe6=_0x4ebbe6-0x0;var _0x34f522=_0x6b8f[_0x4ebbe6];return _0x34f522;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf6b8('0x2'));var auth=require(_0xf6b8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf6b8('0x4'));var controller=require(_0xf6b8('0x5'));router[_0xf6b8('0x6')]('/',auth['isAuthenticated'](),controller[_0xf6b8('0x7')]);router[_0xf6b8('0x6')](_0xf6b8('0x8'),auth[_0xf6b8('0x9')](),controller['describe']);router['get'](_0xf6b8('0xa'),auth['isAuthenticated'](),controller[_0xf6b8('0xb')]);router[_0xf6b8('0xc')]('/',auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xd')]);router[_0xf6b8('0xe')](_0xf6b8('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf6b8('0xa'),auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xf')]);module[_0xf6b8('0x10')]=router; \ No newline at end of file +var _0x31af=['delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update'];(function(_0x1cb442,_0x2a7467){var _0x22e437=function(_0x4d85b9){while(--_0x4d85b9){_0x1cb442['push'](_0x1cb442['shift']());}};_0x22e437(++_0x2a7467);}(_0x31af,0xde));var _0xf31a=function(_0x24656b,_0x493eda){_0x24656b=_0x24656b-0x0;var _0x3072ba=_0x31af[_0x24656b];return _0x3072ba;};'use strict';var multer=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var path=require(_0xf31a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf31a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf31a('0x4'));var interaction=require(_0xf31a('0x5'));var config=require(_0xf31a('0x6'));var controller=require(_0xf31a('0x7'));router['get']('/',auth[_0xf31a('0x8')](),controller[_0xf31a('0x9')]);router[_0xf31a('0xa')](_0xf31a('0xb'),auth['isAuthenticated'](),controller[_0xf31a('0xc')]);router[_0xf31a('0xa')](_0xf31a('0xd'),auth[_0xf31a('0x8')](),controller['show']);router[_0xf31a('0xe')]('/',auth[_0xf31a('0x8')](),controller[_0xf31a('0xf')]);router[_0xf31a('0x10')](_0xf31a('0xd'),auth['isAuthenticated'](),controller[_0xf31a('0x11')]);router[_0xf31a('0x12')](_0xf31a('0xd'),auth[_0xf31a('0x8')](),controller['destroy']);module[_0xf31a('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 782b72b..1eea0f9 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x4d4593,_0x2579d0){var _0x83986f=function(_0x151a84){while(--_0x151a84){_0x4d4593['push'](_0x4d4593['shift']());}};_0x83986f(++_0x2579d0);}(_0xedd9,0xfc));var _0x9edd=function(_0x8f75c4,_0x5dac6f){_0x8f75c4=_0x8f75c4-0x0;var _0x37c2d4=_0xedd9[_0x8f75c4];return _0x37c2d4;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x243cca,_0x514c2d){var _0xf94771=function(_0x42d3de){while(--_0x42d3de){_0x243cca['push'](_0x243cca['shift']());}};_0xf94771(++_0x514c2d);}(_0x54ef,0x112));var _0xf54e=function(_0x5bce7e,_0x2ac385){_0x5bce7e=_0x5bce7e-0x0;var _0x3ad242=_0x54ef[_0x5bce7e];return _0x3ad242;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 21a7fc2..3e71367 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 _0x774d=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','SmsTransferReport','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where'];(function(_0x2253ea,_0x6320e){var _0x2d046c=function(_0x707761){while(--_0x707761){_0x2253ea['push'](_0x2253ea['shift']());}};_0x2d046c(++_0x6320e);}(_0x774d,0x1d6));var _0xd774=function(_0x4c5c4c,_0x3ba16b){_0x4c5c4c=_0x4c5c4c-0x0;var _0x499e4b=_0x774d[_0x4c5c4c];return _0x499e4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd774('0x0'));var zipdir=require(_0xd774('0x1'));var jsonpatch=require(_0xd774('0x2'));var rp=require(_0xd774('0x3'));var moment=require(_0xd774('0x4'));var BPromise=require(_0xd774('0x5'));var Mustache=require(_0xd774('0x6'));var util=require(_0xd774('0x7'));var path=require(_0xd774('0x8'));var sox=require(_0xd774('0x9'));var csv=require(_0xd774('0xa'));var ejs=require(_0xd774('0xb'));var fs=require('fs');var fs_extra=require(_0xd774('0xc'));var _=require(_0xd774('0xd'));var squel=require(_0xd774('0xe'));var crypto=require('crypto');var jsforce=require(_0xd774('0xf'));var deskjs=require(_0xd774('0x10'));var toCsv=require(_0xd774('0xa'));var querystring=require(_0xd774('0x11'));var Papa=require('papaparse');var Redis=require(_0xd774('0x12'));var authService=require(_0xd774('0x13'));var qs=require(_0xd774('0x14'));var as=require(_0xd774('0x15'));var hardwareService=require(_0xd774('0x16'));var logger=require('../../config/logger')(_0xd774('0x17'));var utils=require(_0xd774('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd774('0x19'));var db=require(_0xd774('0x1a'))['db'];function respondWithStatusCode(_0xe6ce5a,_0x9b91d3){_0x9b91d3=_0x9b91d3||0xcc;return function(_0x4ed04e){if(_0x4ed04e){return _0xe6ce5a[_0xd774('0x1b')](_0x9b91d3);}return _0xe6ce5a[_0xd774('0x1c')](_0x9b91d3)[_0xd774('0x1d')]();};}function respondWithResult(_0x2a6268,_0x286c09){_0x286c09=_0x286c09||0xc8;return function(_0x2b51b2){if(_0x2b51b2){return _0x2a6268[_0xd774('0x1c')](_0x286c09)['json'](_0x2b51b2);}};}function respondWithFilteredResult(_0x41dd8e,_0x3428b0){return function(_0x422128){if(_0x422128){var _0x133bee=typeof _0x3428b0[_0xd774('0x1e')]==='undefined'&&typeof _0x3428b0[_0xd774('0x1f')]===_0xd774('0x20');var _0x1b2d5a=_0x422128[_0xd774('0x21')];var _0x3487a1=_0x133bee?0x0:_0x3428b0['offset'];var _0x3c1fb9=_0x133bee?_0x422128['count']:_0x3428b0[_0xd774('0x1e')]+_0x3428b0[_0xd774('0x1f')];var _0x3d0854;if(_0x3c1fb9>=_0x1b2d5a){_0x3c1fb9=_0x1b2d5a;_0x3d0854=0xc8;}else{_0x3d0854=0xce;}_0x41dd8e['status'](_0x3d0854);return _0x41dd8e[_0xd774('0x22')](_0xd774('0x23'),_0x3487a1+'-'+_0x3c1fb9+'/'+_0x1b2d5a)['json'](_0x422128);}return null;};}function patchUpdates(_0x1d4ec6){return function(_0x54b745){try{jsonpatch['apply'](_0x54b745,_0x1d4ec6,!![]);}catch(_0x18f4d1){return BPromise[_0xd774('0x24')](_0x18f4d1);}return _0x54b745[_0xd774('0x25')]();};}function saveUpdates(_0x4f4a18,_0x26ac8b){return function(_0xeafd9f){if(_0xeafd9f){return _0xeafd9f[_0xd774('0x26')](_0x4f4a18)[_0xd774('0x27')](function(_0x367fa7){return _0x367fa7;});}return null;};}function removeEntity(_0x4d4694,_0x1171f1){return function(_0x125de9){if(_0x125de9){return _0x125de9[_0xd774('0x28')]()[_0xd774('0x27')](function(){_0x4d4694['status'](0xcc)[_0xd774('0x1d')]();});}};}function handleEntityNotFound(_0x578474,_0x166234){return function(_0x2b4b14){if(!_0x2b4b14){_0x578474[_0xd774('0x1b')](0x194);}return _0x2b4b14;};}function handleError(_0x59cd89,_0x22d171){_0x22d171=_0x22d171||0x1f4;return function(_0x39ef38){logger['error'](_0x39ef38[_0xd774('0x29')]);if(_0x39ef38[_0xd774('0x2a')]){delete _0x39ef38[_0xd774('0x2a')];}_0x59cd89['status'](_0x22d171)[_0xd774('0x2b')](_0x39ef38);};}exports['index']=function(_0x53057f,_0x10786d){var _0x13bfe8={},_0x1ec183={},_0x3029a4={'count':0x0,'rows':[]};var _0x26f4d6=_[_0xd774('0x2c')](db[_0xd774('0x2d')]['rawAttributes'],function(_0x4f0b79){return{'name':_0x4f0b79[_0xd774('0x2e')],'type':_0x4f0b79[_0xd774('0x2f')][_0xd774('0x30')]};});_0x1ec183['model']=_[_0xd774('0x2c')](_0x26f4d6,'name');_0x1ec183[_0xd774('0x31')]=_[_0xd774('0x32')](_0x53057f[_0xd774('0x31')]);_0x1ec183['filters']=_['intersection'](_0x1ec183[_0xd774('0x33')],_0x1ec183[_0xd774('0x31')]);_0x13bfe8['attributes']=_[_0xd774('0x34')](_0x1ec183[_0xd774('0x33')],qs[_0xd774('0x35')](_0x53057f[_0xd774('0x31')][_0xd774('0x35')]));_0x13bfe8[_0xd774('0x36')]=_0x13bfe8[_0xd774('0x36')][_0xd774('0x37')]?_0x13bfe8[_0xd774('0x36')]:_0x1ec183[_0xd774('0x33')];if(!_0x53057f[_0xd774('0x31')]['hasOwnProperty'](_0xd774('0x38'))){_0x13bfe8[_0xd774('0x1f')]=qs['limit'](_0x53057f[_0xd774('0x31')][_0xd774('0x1f')]);_0x13bfe8[_0xd774('0x1e')]=qs[_0xd774('0x1e')](_0x53057f['query'][_0xd774('0x1e')]);}_0x13bfe8[_0xd774('0x39')]=qs[_0xd774('0x3a')](_0x53057f[_0xd774('0x31')][_0xd774('0x3a')]);_0x13bfe8['where']=qs[_0xd774('0x3b')](_['pick'](_0x53057f['query'],_0x1ec183['filters']),_0x26f4d6);if(_0x53057f[_0xd774('0x31')][_0xd774('0x3c')]){_0x13bfe8[_0xd774('0x3d')]=_[_0xd774('0x3e')](_0x13bfe8['where'],{'$or':_[_0xd774('0x2c')](_0x26f4d6,function(_0x31365a){if(_0x31365a[_0xd774('0x2f')]!==_0xd774('0x3f')){var _0x593240={};_0x593240[_0x31365a[_0xd774('0x2a')]]={'$like':'%'+_0x53057f['query']['filter']+'%'};return _0x593240;}})});}_0x13bfe8=_[_0xd774('0x3e')]({},_0x13bfe8,_0x53057f[_0xd774('0x40')]);var _0x4148a2={'where':_0x13bfe8['where']};return db['SmsTransferReport'][_0xd774('0x21')](_0x4148a2)[_0xd774('0x27')](function(_0x33ff70){_0x3029a4[_0xd774('0x21')]=_0x33ff70;if(_0x53057f[_0xd774('0x31')][_0xd774('0x41')]){_0x13bfe8[_0xd774('0x42')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xd774('0x43')](_0x13bfe8);})[_0xd774('0x27')](function(_0x202494){_0x3029a4[_0xd774('0x44')]=_0x202494;return _0x3029a4;})['then'](respondWithFilteredResult(_0x10786d,_0x13bfe8))['catch'](handleError(_0x10786d,null));};exports[_0xd774('0x45')]=function(_0x5dbaa3,_0x1967e8){var _0x5b89f4={'raw':!![],'where':{'id':_0x5dbaa3[_0xd774('0x46')]['id']}},_0x3429f3={};_0x3429f3['model']=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x3429f3['query']=_[_0xd774('0x32')](_0x5dbaa3[_0xd774('0x31')]);_0x3429f3['filters']=_[_0xd774('0x34')](_0x3429f3[_0xd774('0x33')],_0x3429f3[_0xd774('0x31')]);_0x5b89f4[_0xd774('0x36')]=_['intersection'](_0x3429f3['model'],qs[_0xd774('0x35')](_0x5dbaa3[_0xd774('0x31')]['fields']));_0x5b89f4['attributes']=_0x5b89f4[_0xd774('0x36')][_0xd774('0x37')]?_0x5b89f4[_0xd774('0x36')]:_0x3429f3['model'];if(_0x5dbaa3[_0xd774('0x31')]['includeAll']){_0x5b89f4[_0xd774('0x42')]=[{'all':!![]}];}_0x5b89f4=_[_0xd774('0x3e')]({},_0x5b89f4,_0x5dbaa3[_0xd774('0x40')]);return db[_0xd774('0x2d')][_0xd774('0x47')](_0x5b89f4)[_0xd774('0x27')](handleEntityNotFound(_0x1967e8,null))[_0xd774('0x27')](respondWithResult(_0x1967e8,null))[_0xd774('0x48')](handleError(_0x1967e8,null));};exports[_0xd774('0x49')]=function(_0x178f4b,_0x240882){return db[_0xd774('0x2d')][_0xd774('0x49')](_0x178f4b['body'],{})['then'](respondWithResult(_0x240882,0xc9))[_0xd774('0x48')](handleError(_0x240882,null));};exports[_0xd774('0x26')]=function(_0xb23b03,_0x4d5eef){if(_0xb23b03['body']['id']){delete _0xb23b03['body']['id'];}return db[_0xd774('0x2d')][_0xd774('0x47')]({'where':{'id':_0xb23b03[_0xd774('0x46')]['id']}})[_0xd774('0x27')](handleEntityNotFound(_0x4d5eef,null))[_0xd774('0x27')](saveUpdates(_0xb23b03[_0xd774('0x4a')],null))['then'](respondWithResult(_0x4d5eef,null))[_0xd774('0x48')](handleError(_0x4d5eef,null));};exports['destroy']=function(_0x32f5fd,_0x2f2b4e){return db[_0xd774('0x2d')][_0xd774('0x47')]({'where':{'id':_0x32f5fd[_0xd774('0x46')]['id']}})[_0xd774('0x27')](handleEntityNotFound(_0x2f2b4e,null))[_0xd774('0x27')](removeEntity(_0x2f2b4e,null))[_0xd774('0x48')](handleError(_0x2f2b4e,null));};exports[_0xd774('0x4b')]=function(_0x5c1aa0,_0x141235){return db[_0xd774('0x2d')][_0xd774('0x4b')]()[_0xd774('0x27')](respondWithResult(_0x141235,null))[_0xd774('0x48')](handleError(_0x141235,null));}; \ No newline at end of file +var _0x8a6b=['set','Content-Range','apply','reject','save','update','error','stack','name','SmsTransferReport','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','filter','merge','where','options','includeAll','include','findAll','then','rows','catch','show','params','find','create','body','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8a6b,0x13b));var _0xb8a6=function(_0xd763e2,_0x2724af){_0xd763e2=_0xd763e2-0x0;var _0x2bc9d0=_0x8a6b[_0xd763e2];return _0x2bc9d0;};'use strict';var emlformat=require(_0xb8a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb8a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8a6('0x2'));var moment=require(_0xb8a6('0x3'));var BPromise=require(_0xb8a6('0x4'));var Mustache=require('mustache');var util=require(_0xb8a6('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb8a6('0x6'));var _=require(_0xb8a6('0x7'));var squel=require(_0xb8a6('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8a6('0x9'));var toCsv=require(_0xb8a6('0xa'));var querystring=require(_0xb8a6('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb8a6('0xc'));var qs=require(_0xb8a6('0xd'));var as=require(_0xb8a6('0xe'));var hardwareService=require(_0xb8a6('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xb8a6('0x10'));var config=require(_0xb8a6('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f5720,_0x5368f5){_0x5368f5=_0x5368f5||0xcc;return function(_0x147b99){if(_0x147b99){return _0x1f5720[_0xb8a6('0x12')](_0x5368f5);}return _0x1f5720[_0xb8a6('0x13')](_0x5368f5)[_0xb8a6('0x14')]();};}function respondWithResult(_0x42ad2a,_0x340c3f){_0x340c3f=_0x340c3f||0xc8;return function(_0x4080a1){if(_0x4080a1){return _0x42ad2a[_0xb8a6('0x13')](_0x340c3f)['json'](_0x4080a1);}};}function respondWithFilteredResult(_0x2f7639,_0xf8ee1d){return function(_0x4a4962){if(_0x4a4962){var _0x31669b=typeof _0xf8ee1d['offset']===_0xb8a6('0x15')&&typeof _0xf8ee1d[_0xb8a6('0x16')]==='undefined';var _0x2b1a02=_0x4a4962[_0xb8a6('0x17')];var _0x32dfb6=_0x31669b?0x0:_0xf8ee1d[_0xb8a6('0x18')];var _0x40ecca=_0x31669b?_0x4a4962['count']:_0xf8ee1d[_0xb8a6('0x18')]+_0xf8ee1d[_0xb8a6('0x16')];var _0x184d3;if(_0x40ecca>=_0x2b1a02){_0x40ecca=_0x2b1a02;_0x184d3=0xc8;}else{_0x184d3=0xce;}_0x2f7639[_0xb8a6('0x13')](_0x184d3);return _0x2f7639[_0xb8a6('0x19')](_0xb8a6('0x1a'),_0x32dfb6+'-'+_0x40ecca+'/'+_0x2b1a02)['json'](_0x4a4962);}return null;};}function patchUpdates(_0xf39e69){return function(_0x56d135){try{jsonpatch[_0xb8a6('0x1b')](_0x56d135,_0xf39e69,!![]);}catch(_0x27575c){return BPromise[_0xb8a6('0x1c')](_0x27575c);}return _0x56d135[_0xb8a6('0x1d')]();};}function saveUpdates(_0x332ebe,_0x2fa0d1){return function(_0x3c8a57){if(_0x3c8a57){return _0x3c8a57[_0xb8a6('0x1e')](_0x332ebe)['then'](function(_0x129bd9){return _0x129bd9;});}return null;};}function removeEntity(_0x53f9ec,_0x41c27f){return function(_0x5bf601){if(_0x5bf601){return _0x5bf601['destroy']()['then'](function(){_0x53f9ec[_0xb8a6('0x13')](0xcc)[_0xb8a6('0x14')]();});}};}function handleEntityNotFound(_0x36f076,_0x2efa49){return function(_0x5d34a5){if(!_0x5d34a5){_0x36f076[_0xb8a6('0x12')](0x194);}return _0x5d34a5;};}function handleError(_0x328f21,_0x2afba9){_0x2afba9=_0x2afba9||0x1f4;return function(_0x496f71){logger[_0xb8a6('0x1f')](_0x496f71[_0xb8a6('0x20')]);if(_0x496f71[_0xb8a6('0x21')]){delete _0x496f71['name'];}_0x328f21[_0xb8a6('0x13')](_0x2afba9)['send'](_0x496f71);};}exports['index']=function(_0x467867,_0x5f0a0f){var _0x563eca={},_0x55db6d={},_0xbfa722={'count':0x0,'rows':[]};var _0x36c6ba=_['map'](db[_0xb8a6('0x22')][_0xb8a6('0x23')],function(_0x4072ad){return{'name':_0x4072ad[_0xb8a6('0x24')],'type':_0x4072ad[_0xb8a6('0x25')]['key']};});_0x55db6d['model']=_[_0xb8a6('0x26')](_0x36c6ba,_0xb8a6('0x21'));_0x55db6d[_0xb8a6('0x27')]=_[_0xb8a6('0x28')](_0x467867[_0xb8a6('0x27')]);_0x55db6d['filters']=_[_0xb8a6('0x29')](_0x55db6d[_0xb8a6('0x2a')],_0x55db6d['query']);_0x563eca[_0xb8a6('0x2b')]=_[_0xb8a6('0x29')](_0x55db6d[_0xb8a6('0x2a')],qs[_0xb8a6('0x2c')](_0x467867['query'][_0xb8a6('0x2c')]));_0x563eca[_0xb8a6('0x2b')]=_0x563eca[_0xb8a6('0x2b')][_0xb8a6('0x2d')]?_0x563eca[_0xb8a6('0x2b')]:_0x55db6d[_0xb8a6('0x2a')];if(!_0x467867[_0xb8a6('0x27')][_0xb8a6('0x2e')]('nolimit')){_0x563eca[_0xb8a6('0x16')]=qs[_0xb8a6('0x16')](_0x467867[_0xb8a6('0x27')][_0xb8a6('0x16')]);_0x563eca['offset']=qs[_0xb8a6('0x18')](_0x467867['query'][_0xb8a6('0x18')]);}_0x563eca[_0xb8a6('0x2f')]=qs[_0xb8a6('0x30')](_0x467867[_0xb8a6('0x27')][_0xb8a6('0x30')]);_0x563eca['where']=qs['filters'](_[_0xb8a6('0x31')](_0x467867['query'],_0x55db6d[_0xb8a6('0x32')]),_0x36c6ba);if(_0x467867[_0xb8a6('0x27')][_0xb8a6('0x33')]){_0x563eca['where']=_[_0xb8a6('0x34')](_0x563eca[_0xb8a6('0x35')],{'$or':_[_0xb8a6('0x26')](_0x36c6ba,function(_0x5743c4){if(_0x5743c4[_0xb8a6('0x25')]!=='VIRTUAL'){var _0x5800d5={};_0x5800d5[_0x5743c4[_0xb8a6('0x21')]]={'$like':'%'+_0x467867['query'][_0xb8a6('0x33')]+'%'};return _0x5800d5;}})});}_0x563eca=_[_0xb8a6('0x34')]({},_0x563eca,_0x467867[_0xb8a6('0x36')]);var _0xf0fa7c={'where':_0x563eca[_0xb8a6('0x35')]};return db[_0xb8a6('0x22')]['count'](_0xf0fa7c)['then'](function(_0x41a6bc){_0xbfa722[_0xb8a6('0x17')]=_0x41a6bc;if(_0x467867[_0xb8a6('0x27')][_0xb8a6('0x37')]){_0x563eca[_0xb8a6('0x38')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xb8a6('0x39')](_0x563eca);})[_0xb8a6('0x3a')](function(_0x3dc7af){_0xbfa722[_0xb8a6('0x3b')]=_0x3dc7af;return _0xbfa722;})['then'](respondWithFilteredResult(_0x5f0a0f,_0x563eca))[_0xb8a6('0x3c')](handleError(_0x5f0a0f,null));};exports[_0xb8a6('0x3d')]=function(_0xc899fe,_0x1f6eef){var _0x41bd93={'raw':!![],'where':{'id':_0xc899fe[_0xb8a6('0x3e')]['id']}},_0x2f3a80={};_0x2f3a80[_0xb8a6('0x2a')]=_[_0xb8a6('0x28')](db['SmsTransferReport'][_0xb8a6('0x23')]);_0x2f3a80[_0xb8a6('0x27')]=_[_0xb8a6('0x28')](_0xc899fe[_0xb8a6('0x27')]);_0x2f3a80['filters']=_[_0xb8a6('0x29')](_0x2f3a80[_0xb8a6('0x2a')],_0x2f3a80[_0xb8a6('0x27')]);_0x41bd93[_0xb8a6('0x2b')]=_['intersection'](_0x2f3a80['model'],qs['fields'](_0xc899fe[_0xb8a6('0x27')]['fields']));_0x41bd93[_0xb8a6('0x2b')]=_0x41bd93[_0xb8a6('0x2b')][_0xb8a6('0x2d')]?_0x41bd93[_0xb8a6('0x2b')]:_0x2f3a80['model'];if(_0xc899fe[_0xb8a6('0x27')][_0xb8a6('0x37')]){_0x41bd93['include']=[{'all':!![]}];}_0x41bd93=_[_0xb8a6('0x34')]({},_0x41bd93,_0xc899fe['options']);return db[_0xb8a6('0x22')][_0xb8a6('0x3f')](_0x41bd93)[_0xb8a6('0x3a')](handleEntityNotFound(_0x1f6eef,null))[_0xb8a6('0x3a')](respondWithResult(_0x1f6eef,null))[_0xb8a6('0x3c')](handleError(_0x1f6eef,null));};exports[_0xb8a6('0x40')]=function(_0x708fa6,_0x54b9ae){return db['SmsTransferReport'][_0xb8a6('0x40')](_0x708fa6[_0xb8a6('0x41')],{})[_0xb8a6('0x3a')](respondWithResult(_0x54b9ae,0xc9))[_0xb8a6('0x3c')](handleError(_0x54b9ae,null));};exports[_0xb8a6('0x1e')]=function(_0x883142,_0x385986){if(_0x883142['body']['id']){delete _0x883142['body']['id'];}return db[_0xb8a6('0x22')]['find']({'where':{'id':_0x883142['params']['id']}})[_0xb8a6('0x3a')](handleEntityNotFound(_0x385986,null))[_0xb8a6('0x3a')](saveUpdates(_0x883142[_0xb8a6('0x41')],null))[_0xb8a6('0x3a')](respondWithResult(_0x385986,null))[_0xb8a6('0x3c')](handleError(_0x385986,null));};exports[_0xb8a6('0x42')]=function(_0x361799,_0x30e491){return db[_0xb8a6('0x22')][_0xb8a6('0x3f')]({'where':{'id':_0x361799[_0xb8a6('0x3e')]['id']}})[_0xb8a6('0x3a')](handleEntityNotFound(_0x30e491,null))[_0xb8a6('0x3a')](removeEntity(_0x30e491,null))[_0xb8a6('0x3c')](handleError(_0x30e491,null));};exports['describe']=function(_0x4a17a8,_0x4e9009){return db['SmsTransferReport'][_0xb8a6('0x43')]()['then'](respondWithResult(_0x4e9009,null))[_0xb8a6('0x3c')](handleError(_0x4e9009,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index e124977..d8f9dd2 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 _0x48d0=['path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x48d0,0xd3));var _0x048d=function(_0x275ac9,_0xf34c64){_0x275ac9=_0x275ac9-0x0;var _0x444f73=_0x48d0[_0x275ac9];return _0x444f73;};'use strict';var _=require(_0x048d('0x0'));var util=require(_0x048d('0x1'));var logger=require('../../config/logger')(_0x048d('0x2'));var moment=require(_0x048d('0x3'));var BPromise=require(_0x048d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x048d('0x5'));var rimraf=require(_0x048d('0x6'));var config=require('../../config/environment');var attributes=require(_0x048d('0x7'));module[_0x048d('0x8')]=function(_0x14b983,_0x49c342){return _0x14b983[_0x048d('0x9')](_0x048d('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x048d('0xb'),'fields':[_0x048d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x24e2=['./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x24e2,0x109));var _0x224e=function(_0x1566a8,_0x43e64c){_0x1566a8=_0x1566a8-0x0;var _0x22b9e0=_0x24e2[_0x1566a8];return _0x22b9e0;};'use strict';var _=require(_0x224e('0x0'));var util=require(_0x224e('0x1'));var logger=require(_0x224e('0x2'))('api');var moment=require(_0x224e('0x3'));var BPromise=require(_0x224e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x224e('0x5'));var rimraf=require(_0x224e('0x6'));var config=require(_0x224e('0x7'));var attributes=require(_0x224e('0x8'));module['exports']=function(_0x44817c,_0x4755c5){return _0x44817c[_0x224e('0x9')](_0x224e('0xa'),attributes,{'tableName':_0x224e('0xb'),'paranoid':![],'indexes':[{'name':_0x224e('0xc'),'fields':[_0x224e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 2a23a81..ae05c40 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 _0x3f27=['../../config/utils','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x3f27,0x1f4));var _0x73f2=function(_0x2afcb4,_0x5380f8){_0x2afcb4=_0x2afcb4-0x0;var _0x4576f1=_0x3f27[_0x2afcb4];return _0x4576f1;};'use strict';var _=require(_0x73f2('0x0'));var util=require(_0x73f2('0x1'));var moment=require(_0x73f2('0x2'));var BPromise=require(_0x73f2('0x3'));var rs=require(_0x73f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73f2('0x5'))['db'];var utils=require(_0x73f2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x73f2('0x7'));var client=jayson[_0x73f2('0x8')][_0x73f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4aa8ec,_0x10af7a,_0x5efe60){return new BPromise(function(_0x521fc9,_0xa2ea48){return client[_0x73f2('0xa')](_0x4aa8ec,_0x5efe60)[_0x73f2('0xb')](function(_0x3bf117){logger[_0x73f2('0xc')](_0x73f2('0xd'),_0x10af7a,'request\x20sent');logger[_0x73f2('0xe')](_0x73f2('0xf'),_0x10af7a,_0x73f2('0x10'),JSON['stringify'](_0x3bf117));if(_0x3bf117['error']){if(_0x3bf117['error'][_0x73f2('0x11')]===0x1f4){logger[_0x73f2('0x12')](_0x73f2('0xd'),_0x10af7a,_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);return _0xa2ea48(_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x10af7a,_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);return _0x521fc9(_0x3bf117['error']['message']);}else{logger[_0x73f2('0xc')](_0x73f2('0xd'),_0x10af7a,_0x73f2('0x10'));_0x521fc9(_0x3bf117[_0x73f2('0x14')][_0x73f2('0x13')]);}})[_0x73f2('0x15')](function(_0x32e9c6){logger[_0x73f2('0x12')](_0x73f2('0xd'),_0x10af7a,_0x32e9c6);_0xa2ea48(_0x32e9c6);});});} \ No newline at end of file +var _0x3937=['error','code','SmsTransferReport,\x20%s,\x20%s','message','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x214446,_0x283852){var _0x4db87a=function(_0x59d56e){while(--_0x59d56e){_0x214446['push'](_0x214446['shift']());}};_0x4db87a(++_0x283852);}(_0x3937,0xbf));var _0x7393=function(_0xa96367,_0x4efad5){_0xa96367=_0xa96367-0x0;var _0x4562b0=_0x3937[_0xa96367];return _0x4562b0;};'use strict';var _=require(_0x7393('0x0'));var util=require('util');var moment=require(_0x7393('0x1'));var BPromise=require(_0x7393('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7393('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7393('0x4'));var logger=require('../../config/logger')(_0x7393('0x5'));var config=require(_0x7393('0x6'));var jayson=require(_0x7393('0x7'));var client=jayson[_0x7393('0x8')][_0x7393('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42bdd1,_0x3f0800,_0x26668a){return new BPromise(function(_0x944b0b,_0x4efb50){return client['request'](_0x42bdd1,_0x26668a)[_0x7393('0xa')](function(_0x3b7bbc){logger[_0x7393('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x3f0800,_0x7393('0xc'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3f0800,'request\x20sent',JSON['stringify'](_0x3b7bbc));if(_0x3b7bbc[_0x7393('0xd')]){if(_0x3b7bbc[_0x7393('0xd')][_0x7393('0xe')]===0x1f4){logger['error'](_0x7393('0xf'),_0x3f0800,_0x3b7bbc[_0x7393('0xd')][_0x7393('0x10')]);return _0x4efb50(_0x3b7bbc[_0x7393('0xd')][_0x7393('0x10')]);}logger[_0x7393('0xd')](_0x7393('0xf'),_0x3f0800,_0x3b7bbc[_0x7393('0xd')][_0x7393('0x10')]);return _0x944b0b(_0x3b7bbc['error']['message']);}else{logger[_0x7393('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x3f0800,'request\x20sent');_0x944b0b(_0x3b7bbc['result'][_0x7393('0x10')]);}})['catch'](function(_0x2a1180){logger[_0x7393('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x3f0800,_0x2a1180);_0x4efb50(_0x2a1180);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 621c766..8e96f31 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 _0xd59e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','show','diskStorage','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','post','single','create','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x130211,_0x4df156){var _0x594030=function(_0x3b4504){while(--_0x3b4504){_0x130211['push'](_0x130211['shift']());}};_0x594030(++_0x4df156);}(_0xd59e,0x8c));var _0xed59=function(_0x43c8a8,_0x15fe00){_0x43c8a8=_0x43c8a8-0x0;var _0x3aebde=_0xd59e[_0x43c8a8];return _0x3aebde;};'use strict';var multer=require(_0xed59('0x0'));var util=require(_0xed59('0x1'));var path=require(_0xed59('0x2'));var timeout=require(_0xed59('0x3'));var express=require(_0xed59('0x4'));var router=express[_0xed59('0x5')]();var fs_extra=require(_0xed59('0x6'));var auth=require(_0xed59('0x7'));var interaction=require(_0xed59('0x8'));var config=require('../../config/environment');var controller=require(_0xed59('0x9'));router[_0xed59('0xa')]('/',auth[_0xed59('0xb')](),controller[_0xed59('0xc')]);router[_0xed59('0xa')](_0xed59('0xd'),auth['isAuthenticated'](),controller[_0xed59('0xe')]);router['get']('/:id/download',auth[_0xed59('0xb')](),controller['download']);var upload=multer({'storage':multer[_0xed59('0xf')]({'destination':function(_0x5c871c,_0x31c09f,_0xa707a){_0xa707a(null,path['join'](config[_0xed59('0x10')],_0xed59('0x11')));},'filename':function(_0x479359,_0x286646,_0x468d2a){_0x286646['originalname']=_0x286646[_0xed59('0x12')][_0xed59('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x468d2a(null,util['format'](_0xed59('0x14'),path[_0xed59('0x15')](_0x286646[_0xed59('0x12')],path[_0xed59('0x16')](_0x286646['originalname'])),Date['now'](),path['extname'](_0x286646[_0xed59('0x12')])));}})});router[_0xed59('0x17')]('/',upload[_0xed59('0x18')]('file'),controller[_0xed59('0x19')]);router[_0xed59('0x1a')](_0xed59('0xd'),auth['isAuthenticated'](),controller[_0xed59('0x1b')]);router['delete'](_0xed59('0xd'),auth[_0xed59('0xb')](),controller['delete']);module[_0xed59('0x1c')]=router; \ No newline at end of file +var _0xbb39=['delete','exports','multer','util','path','express','Router','../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','originalname','format','%s-%s%s','basename','extname','post','file','create','update'];(function(_0x22cbc9,_0x1464ee){var _0x3233b2=function(_0x4bfd44){while(--_0x4bfd44){_0x22cbc9['push'](_0x22cbc9['shift']());}};_0x3233b2(++_0x1464ee);}(_0xbb39,0x160));var _0x9bb3=function(_0x8c6eee,_0x21f601){_0x8c6eee=_0x8c6eee-0x0;var _0x5a03b5=_0xbb39[_0x8c6eee];return _0x5a03b5;};'use strict';var multer=require(_0x9bb3('0x0'));var util=require(_0x9bb3('0x1'));var path=require(_0x9bb3('0x2'));var timeout=require('connect-timeout');var express=require(_0x9bb3('0x3'));var router=express[_0x9bb3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9bb3('0x5'));var config=require('../../config/environment');var controller=require(_0x9bb3('0x6'));router[_0x9bb3('0x7')]('/',auth['isAuthenticated'](),controller[_0x9bb3('0x8')]);router[_0x9bb3('0x7')](_0x9bb3('0x9'),auth[_0x9bb3('0xa')](),controller[_0x9bb3('0xb')]);router[_0x9bb3('0x7')](_0x9bb3('0xc'),auth[_0x9bb3('0xa')](),controller[_0x9bb3('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5d4f89,_0x2f7703,_0xec2efe){_0xec2efe(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0x5d9467,_0x5ea164,_0xcef939){_0x5ea164[_0x9bb3('0xe')]=_0x5ea164[_0x9bb3('0xe')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xcef939(null,util[_0x9bb3('0xf')](_0x9bb3('0x10'),path[_0x9bb3('0x11')](_0x5ea164[_0x9bb3('0xe')],path[_0x9bb3('0x12')](_0x5ea164[_0x9bb3('0xe')])),Date['now'](),path['extname'](_0x5ea164[_0x9bb3('0xe')])));}})});router[_0x9bb3('0x13')]('/',upload['single'](_0x9bb3('0x14')),controller[_0x9bb3('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9bb3('0x16')]);router[_0x9bb3('0x17')](_0x9bb3('0x9'),auth[_0x9bb3('0xa')](),controller[_0x9bb3('0x17')]);module[_0x9bb3('0x18')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index e7a8da9..af0c8c4 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 _0x3b1e=['FLOAT','BIGINT','INTEGER','exports','name','STRING'];(function(_0x5b70f0,_0x189655){var _0x49a246=function(_0x25cd5c){while(--_0x25cd5c){_0x5b70f0['push'](_0x5b70f0['shift']());}};_0x49a246(++_0x189655);}(_0x3b1e,0x9f));var _0xe3b1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b1e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xe3b1('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xe3b1('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xe3b1('0x2')]},'display_name':{'type':Sequelize[_0xe3b1('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xe3b1('0x2')]},'original_format':{'type':Sequelize[_0xe3b1('0x2')]},'original_duration':{'type':Sequelize[_0xe3b1('0x3')]},'original_sampleCount':{'type':Sequelize[_0xe3b1('0x4')]},'original_channelCount':{'type':Sequelize[_0xe3b1('0x5')]},'original_bitRate':{'type':Sequelize[_0xe3b1('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xe3b1('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xe3b1('0x4')]},'converted_channelCount':{'type':Sequelize[_0xe3b1('0x5')]},'converted_bitRate':{'type':Sequelize[_0xe3b1('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x84ca=['BIGINT','INTEGER','sequelize','exports','STRING','FLOAT'];(function(_0x24eaa2,_0x26339a){var _0x5a7ec4=function(_0x236a04){while(--_0x236a04){_0x24eaa2['push'](_0x24eaa2['shift']());}};_0x5a7ec4(++_0x26339a);}(_0x84ca,0x6e));var _0xa84c=function(_0x21866d,_0x56e428){_0x21866d=_0x21866d-0x0;var _0x3c9f71=_0x84ca[_0x21866d];return _0x3c9f71;};'use strict';var Sequelize=require(_0xa84c('0x0'));module[_0xa84c('0x1')]={'name':{'type':Sequelize[_0xa84c('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xa84c('0x2')]},'display_name':{'type':Sequelize[_0xa84c('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xa84c('0x2')]},'original_format':{'type':Sequelize[_0xa84c('0x2')]},'original_duration':{'type':Sequelize[_0xa84c('0x3')]},'original_sampleCount':{'type':Sequelize[_0xa84c('0x4')]},'original_channelCount':{'type':Sequelize[_0xa84c('0x5')]},'original_bitRate':{'type':Sequelize[_0xa84c('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xa84c('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xa84c('0x4')]},'converted_channelCount':{'type':Sequelize[_0xa84c('0x5')]},'converted_bitRate':{'type':Sequelize[_0xa84c('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xa84c('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index dc99f81..a91e2fe 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 _0xb5c3=['hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','download','format','%s.%s','create','file','originalname','extname','filename','substring','wav','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','body','description','delete','server/files/sounds/original','original_format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','update','then','destroy','Sounds','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length'];(function(_0x3b4b83,_0xeaf2db){var _0x3542b7=function(_0x5a18d2){while(--_0x5a18d2){_0x3b4b83['push'](_0x3b4b83['shift']());}};_0x3542b7(++_0xeaf2db);}(_0xb5c3,0x1bd));var _0x3b5c=function(_0x219d53,_0x23ea68){_0x219d53=_0x219d53-0x0;var _0x4b39de=_0xb5c3[_0x219d53];return _0x4b39de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b5c('0x0'));var zipdir=require(_0x3b5c('0x1'));var jsonpatch=require(_0x3b5c('0x2'));var rp=require('request-promise');var moment=require(_0x3b5c('0x3'));var BPromise=require(_0x3b5c('0x4'));var Mustache=require(_0x3b5c('0x5'));var util=require(_0x3b5c('0x6'));var path=require(_0x3b5c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3b5c('0x8'));var crypto=require(_0x3b5c('0x9'));var jsforce=require(_0x3b5c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3b5c('0xb'));var querystring=require('querystring');var Papa=require(_0x3b5c('0xc'));var Redis=require(_0x3b5c('0xd'));var authService=require(_0x3b5c('0xe'));var qs=require(_0x3b5c('0xf'));var as=require(_0x3b5c('0x10'));var hardwareService=require(_0x3b5c('0x11'));var logger=require(_0x3b5c('0x12'))(_0x3b5c('0x13'));var utils=require(_0x3b5c('0x14'));var config=require(_0x3b5c('0x15'));var licenseUtil=require(_0x3b5c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48c5c3,_0xa204ac){_0xa204ac=_0xa204ac||0xcc;return function(_0x4baa4e){if(_0x4baa4e){return _0x48c5c3['sendStatus'](_0xa204ac);}return _0x48c5c3['status'](_0xa204ac)['end']();};}function respondWithResult(_0x57af18,_0x3a3340){_0x3a3340=_0x3a3340||0xc8;return function(_0x20ed61){if(_0x20ed61){return _0x57af18[_0x3b5c('0x17')](_0x3a3340)[_0x3b5c('0x18')](_0x20ed61);}};}function respondWithFilteredResult(_0x25fe34,_0x121d9f){return function(_0x2bf5bb){if(_0x2bf5bb){var _0x45d43b=typeof _0x121d9f[_0x3b5c('0x19')]==='undefined'&&typeof _0x121d9f[_0x3b5c('0x1a')]===_0x3b5c('0x1b');var _0x3a988f=_0x2bf5bb[_0x3b5c('0x1c')];var _0x1400e5=_0x45d43b?0x0:_0x121d9f[_0x3b5c('0x19')];var _0x36d2ef=_0x45d43b?_0x2bf5bb['count']:_0x121d9f[_0x3b5c('0x19')]+_0x121d9f[_0x3b5c('0x1a')];var _0x126f44;if(_0x36d2ef>=_0x3a988f){_0x36d2ef=_0x3a988f;_0x126f44=0xc8;}else{_0x126f44=0xce;}_0x25fe34[_0x3b5c('0x17')](_0x126f44);return _0x25fe34[_0x3b5c('0x1d')]('Content-Range',_0x1400e5+'-'+_0x36d2ef+'/'+_0x3a988f)[_0x3b5c('0x18')](_0x2bf5bb);}return null;};}function patchUpdates(_0x3b70e0){return function(_0x4f5f73){try{jsonpatch[_0x3b5c('0x1e')](_0x4f5f73,_0x3b70e0,!![]);}catch(_0x1ec59c){return BPromise['reject'](_0x1ec59c);}return _0x4f5f73['save']();};}function saveUpdates(_0x1245cc,_0xae8369){return function(_0x321da0){if(_0x321da0){return _0x321da0[_0x3b5c('0x1f')](_0x1245cc)[_0x3b5c('0x20')](function(_0x5bfd47){return _0x5bfd47;});}return null;};}function removeEntity(_0x200904,_0x4cb29b){return function(_0x79366b){if(_0x79366b){return _0x79366b[_0x3b5c('0x21')]()['then'](function(){var _0x319b75=_0x79366b['get']({'plain':!![]});var _0x1c02b9=_0x3b5c('0x22');return db[_0x3b5c('0x23')]['destroy']({'where':{'type':_0x1c02b9,'resourceId':_0x319b75['id']}})[_0x3b5c('0x20')](function(){return _0x79366b;});})[_0x3b5c('0x20')](function(){_0x200904[_0x3b5c('0x17')](0xcc)[_0x3b5c('0x24')]();});}};}function handleEntityNotFound(_0xb7bf10,_0x47e3e6){return function(_0x4c46da){if(!_0x4c46da){_0xb7bf10[_0x3b5c('0x25')](0x194);}return _0x4c46da;};}function handleError(_0x4797e7,_0x3b4958){_0x3b4958=_0x3b4958||0x1f4;return function(_0x5d8ba4){logger[_0x3b5c('0x26')](_0x5d8ba4[_0x3b5c('0x27')]);if(_0x5d8ba4[_0x3b5c('0x28')]){delete _0x5d8ba4[_0x3b5c('0x28')];}_0x4797e7[_0x3b5c('0x17')](_0x3b4958)[_0x3b5c('0x29')](_0x5d8ba4);};}exports[_0x3b5c('0x2a')]=function(_0x418bf8,_0x4bad48){var _0x1a9f7a={},_0x427542={},_0x3f9226={'count':0x0,'rows':[]};var _0x1de879=_[_0x3b5c('0x2b')](db[_0x3b5c('0x2c')][_0x3b5c('0x2d')],function(_0x2e1c05){return{'name':_0x2e1c05[_0x3b5c('0x2e')],'type':_0x2e1c05[_0x3b5c('0x2f')]['key']};});_0x427542[_0x3b5c('0x30')]=_[_0x3b5c('0x2b')](_0x1de879,'name');_0x427542[_0x3b5c('0x31')]=_['keys'](_0x418bf8[_0x3b5c('0x31')]);_0x427542[_0x3b5c('0x32')]=_['intersection'](_0x427542[_0x3b5c('0x30')],_0x427542[_0x3b5c('0x31')]);_0x1a9f7a[_0x3b5c('0x33')]=_[_0x3b5c('0x34')](_0x427542[_0x3b5c('0x30')],qs[_0x3b5c('0x35')](_0x418bf8[_0x3b5c('0x31')]['fields']));_0x1a9f7a['attributes']=_0x1a9f7a[_0x3b5c('0x33')][_0x3b5c('0x36')]?_0x1a9f7a['attributes']:_0x427542[_0x3b5c('0x30')];if(!_0x418bf8[_0x3b5c('0x31')][_0x3b5c('0x37')](_0x3b5c('0x38'))){_0x1a9f7a['limit']=qs[_0x3b5c('0x1a')](_0x418bf8[_0x3b5c('0x31')]['limit']);_0x1a9f7a[_0x3b5c('0x19')]=qs[_0x3b5c('0x19')](_0x418bf8[_0x3b5c('0x31')][_0x3b5c('0x19')]);}_0x1a9f7a['order']=qs[_0x3b5c('0x39')](_0x418bf8[_0x3b5c('0x31')][_0x3b5c('0x39')]);_0x1a9f7a[_0x3b5c('0x3a')]=qs[_0x3b5c('0x32')](_[_0x3b5c('0x3b')](_0x418bf8['query'],_0x427542['filters']),_0x1de879);if(_0x418bf8[_0x3b5c('0x31')]['filter']){_0x1a9f7a['where']=_['merge'](_0x1a9f7a[_0x3b5c('0x3a')],{'$or':_['map'](_0x1de879,function(_0x2a0e6a){if(_0x2a0e6a[_0x3b5c('0x2f')]!==_0x3b5c('0x3c')){var _0x46fbe0={};_0x46fbe0[_0x2a0e6a[_0x3b5c('0x28')]]={'$like':'%'+_0x418bf8['query'][_0x3b5c('0x3d')]+'%'};return _0x46fbe0;}})});}_0x1a9f7a=_[_0x3b5c('0x3e')]({},_0x1a9f7a,_0x418bf8['options']);var _0x28029f={'where':_0x1a9f7a[_0x3b5c('0x3a')]};return db[_0x3b5c('0x2c')][_0x3b5c('0x1c')](_0x28029f)[_0x3b5c('0x20')](function(_0x57a399){_0x3f9226['count']=_0x57a399;if(_0x418bf8[_0x3b5c('0x31')][_0x3b5c('0x3f')]){_0x1a9f7a[_0x3b5c('0x40')]=[{'all':!![]}];}return db[_0x3b5c('0x2c')][_0x3b5c('0x41')](_0x1a9f7a);})[_0x3b5c('0x20')](function(_0x4f4aa9){_0x3f9226[_0x3b5c('0x42')]=_0x4f4aa9;return _0x3f9226;})[_0x3b5c('0x20')](respondWithFilteredResult(_0x4bad48,_0x1a9f7a))[_0x3b5c('0x43')](handleError(_0x4bad48,null));};exports[_0x3b5c('0x44')]=function(_0x2d9fc8,_0x12203a){var _0x1a9e33={'raw':!![],'where':{'id':_0x2d9fc8[_0x3b5c('0x45')]['id']}},_0x56e20d={};_0x56e20d[_0x3b5c('0x30')]=_[_0x3b5c('0x46')](db[_0x3b5c('0x2c')][_0x3b5c('0x2d')]);_0x56e20d[_0x3b5c('0x31')]=_['keys'](_0x2d9fc8['query']);_0x56e20d[_0x3b5c('0x32')]=_[_0x3b5c('0x34')](_0x56e20d[_0x3b5c('0x30')],_0x56e20d['query']);_0x1a9e33[_0x3b5c('0x33')]=_['intersection'](_0x56e20d[_0x3b5c('0x30')],qs[_0x3b5c('0x35')](_0x2d9fc8['query'][_0x3b5c('0x35')]));_0x1a9e33[_0x3b5c('0x33')]=_0x1a9e33[_0x3b5c('0x33')][_0x3b5c('0x36')]?_0x1a9e33[_0x3b5c('0x33')]:_0x56e20d[_0x3b5c('0x30')];if(_0x2d9fc8[_0x3b5c('0x31')]['includeAll']){_0x1a9e33['include']=[{'all':!![]}];}_0x1a9e33=_['merge']({},_0x1a9e33,_0x2d9fc8['options']);return db[_0x3b5c('0x2c')]['find'](_0x1a9e33)[_0x3b5c('0x20')](handleEntityNotFound(_0x12203a,null))[_0x3b5c('0x20')](respondWithResult(_0x12203a,null))[_0x3b5c('0x43')](handleError(_0x12203a,null));};exports['download']=function(_0x296a72,_0x599437,_0x250864){return db[_0x3b5c('0x2c')][_0x3b5c('0x47')]({'where':{'id':_0x296a72[_0x3b5c('0x45')]['id']},'attributes':[_0x3b5c('0x28'),_0x3b5c('0x48'),_0x3b5c('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x599437,null))[_0x3b5c('0x20')](function(_0x563bad){if(_0x563bad){if(!fs[_0x3b5c('0x4a')](path[_0x3b5c('0x4b')](config[_0x3b5c('0x4c')],_0x3b5c('0x4d'),_0x563bad[_0x3b5c('0x48')]+'.'+_0x563bad[_0x3b5c('0x49')]))){throw new db[(_0x3b5c('0x4e'))]['ValidationError'](_0x3b5c('0x4f'));}return _0x599437[_0x3b5c('0x50')](path['join'](config[_0x3b5c('0x4c')],'server/files/sounds/converted',util[_0x3b5c('0x51')](_0x3b5c('0x52'),_0x563bad[_0x3b5c('0x48')],_0x563bad[_0x3b5c('0x49')])),util[_0x3b5c('0x51')]('%s.%s',_0x563bad[_0x3b5c('0x28')],_0x563bad['converted_format']));}return null;})[_0x3b5c('0x43')](handleError(_0x599437,null));};exports[_0x3b5c('0x53')]=function(_0x49ba0b,_0x15892f,_0x3d9a13){var _0x4cf832={'name':path['basename'](_0x49ba0b[_0x3b5c('0x54')][_0x3b5c('0x55')],path[_0x3b5c('0x56')](_0x49ba0b['file'][_0x3b5c('0x55')])),'save_name':path['basename'](_0x49ba0b['file'][_0x3b5c('0x57')],path[_0x3b5c('0x56')](_0x49ba0b[_0x3b5c('0x54')][_0x3b5c('0x57')])),'original_format':path[_0x3b5c('0x56')](_0x49ba0b[_0x3b5c('0x54')]['originalname'])[_0x3b5c('0x58')](0x1),'converted_format':_0x3b5c('0x59')};var _0x42635a=path['join'](config[_0x3b5c('0x4c')],'server/files/sounds/original',_0x49ba0b[_0x3b5c('0x54')][_0x3b5c('0x57')]);var _0x1ab079=path[_0x3b5c('0x4b')](config[_0x3b5c('0x4c')],_0x3b5c('0x4d'),util['format'](_0x3b5c('0x52'),path[_0x3b5c('0x5a')](_0x49ba0b[_0x3b5c('0x54')][_0x3b5c('0x57')],path[_0x3b5c('0x56')](_0x49ba0b[_0x3b5c('0x54')]['filename'])),_0x4cf832[_0x3b5c('0x49')]));logger[_0x3b5c('0x5b')](_0x3b5c('0x5c'),_0x42635a);logger[_0x3b5c('0x5b')](_0x3b5c('0x5d'),_0x1ab079);try{fs[_0x3b5c('0x5e')](_0x42635a,parseInt(_0x3b5c('0x5f'),0x8));var _0x32c8b9=sox[_0x3b5c('0x60')](_0x42635a,_0x1ab079,{'sampleRate':0x1f40,'format':_0x3b5c('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x32c8b9['on'](_0x3b5c('0x26'),function(_0x1a4d2d){fs[_0x3b5c('0x61')](_0x42635a);_0x15892f['status'](0x1f4)[_0x3b5c('0x29')](_0x1a4d2d);});_0x32c8b9['on'](_0x3b5c('0x62'),function(_0x39eb76){_0x4cf832[_0x3b5c('0x63')]=isNaN(_0x39eb76[_0x3b5c('0x64')])?null:_0x39eb76[_0x3b5c('0x64')]*0x3e8;_0x4cf832[_0x3b5c('0x65')]=isNaN(_0x39eb76[_0x3b5c('0x66')])?null:_0x39eb76[_0x3b5c('0x66')];_0x4cf832[_0x3b5c('0x67')]=isNaN(_0x39eb76[_0x3b5c('0x68')])?null:_0x39eb76[_0x3b5c('0x68')];_0x4cf832['original_bitRate']=isNaN(_0x39eb76[_0x3b5c('0x69')])?null:_0x39eb76[_0x3b5c('0x69')];_0x4cf832[_0x3b5c('0x6a')]=isNaN(_0x39eb76['sampleRate'])?null:_0x39eb76[_0x3b5c('0x6b')];});_0x32c8b9['on'](_0x3b5c('0x6c'),function(_0x17ea87){_0x4cf832[_0x3b5c('0x6d')]=isNaN(_0x17ea87['duration'])?null:_0x17ea87['duration']*0x3e8;_0x4cf832['converted_sampleCount']=isNaN(_0x17ea87[_0x3b5c('0x66')])?null:_0x17ea87[_0x3b5c('0x66')];_0x4cf832[_0x3b5c('0x6e')]=isNaN(_0x17ea87[_0x3b5c('0x68')])?null:_0x17ea87['channelCount'];_0x4cf832[_0x3b5c('0x6f')]=isNaN(_0x17ea87[_0x3b5c('0x69')])?null:_0x17ea87[_0x3b5c('0x69')];_0x4cf832[_0x3b5c('0x70')]=isNaN(_0x17ea87[_0x3b5c('0x6b')])?null:_0x17ea87[_0x3b5c('0x6b')];});_0x32c8b9['on'](_0x3b5c('0x24'),function(){fs[_0x3b5c('0x5e')](_0x1ab079,parseInt(_0x3b5c('0x5f'),0x8));return db['Sound'][_0x3b5c('0x53')](_0x4cf832)[_0x3b5c('0x20')](function(_0x4d137d){var _0x38a198={'role':_0x49ba0b['body'][_0x3b5c('0x71')],'userProfileId':_0x49ba0b['body'][_0x3b5c('0x72')]};if(!_0x38a198)throw new Error(_0x3b5c('0x73'));if(_0x38a198[_0x3b5c('0x71')]===_0x3b5c('0x74')){var _0x1a3230=_0x4d137d['get']({'plain':!![]});return db[_0x3b5c('0x75')][_0x3b5c('0x47')]({'where':{'name':'Sounds','userProfileId':_0x38a198[_0x3b5c('0x72')]},'raw':!![]})['then'](function(_0xad06f4){if(_0xad06f4&&_0xad06f4['autoAssociation']===0x0){return db[_0x3b5c('0x23')][_0x3b5c('0x53')]({'name':_0x1a3230['name'],'resourceId':_0x1a3230['id'],'type':_0xad06f4[_0x3b5c('0x28')],'sectionId':_0xad06f4['id']},{})['then'](function(){return _0x4d137d;});}else{return _0x4d137d;}})[_0x3b5c('0x43')](function(_0x17abbb){logger[_0x3b5c('0x26')](_0x3b5c('0x76'),_0x17abbb);throw _0x17abbb;});}return _0x4d137d;})['then'](respondWithResult(_0x15892f,null))[_0x3b5c('0x43')](handleError(_0x15892f,null));});_0x32c8b9[_0x3b5c('0x77')]();}catch(_0x2d1f5c){_0x15892f[_0x3b5c('0x17')](0x1f4)['send'](_0x2d1f5c);}};exports[_0x3b5c('0x1f')]=function(_0x2edd23,_0x8bb4bd,_0x347e46){return db[_0x3b5c('0x2c')][_0x3b5c('0x47')]({'where':{'id':_0x2edd23[_0x3b5c('0x45')]['id']}})['then'](handleEntityNotFound(_0x8bb4bd,null))[_0x3b5c('0x20')](saveUpdates(_['pick'](_0x2edd23[_0x3b5c('0x78')],[_0x3b5c('0x28'),_0x3b5c('0x79')]),null))[_0x3b5c('0x20')](respondWithResult(_0x8bb4bd,null))[_0x3b5c('0x43')](handleError(_0x8bb4bd,null));};exports[_0x3b5c('0x7a')]=function(_0x40100e,_0x2f03f4,_0x4fc673){return db[_0x3b5c('0x2c')][_0x3b5c('0x47')]({'where':{'id':_0x40100e[_0x3b5c('0x45')]['id']}})['then'](function(_0xe2f45b){if(_0xe2f45b){return _0xe2f45b[_0x3b5c('0x21')]();}})[_0x3b5c('0x20')](function(_0x15cb35){var _0xdc1d68=path['join'](config[_0x3b5c('0x4c')],_0x3b5c('0x7b'),util[_0x3b5c('0x51')](_0x3b5c('0x52'),_0x15cb35[_0x3b5c('0x48')],_0x15cb35[_0x3b5c('0x7c')]));var _0x3e45c9=path[_0x3b5c('0x4b')](config['root'],_0x3b5c('0x4d'),util[_0x3b5c('0x51')]('%s.%s',_0x15cb35[_0x3b5c('0x48')],_0x15cb35['converted_format']));fs['unlinkSync'](_0xdc1d68);fs[_0x3b5c('0x61')](_0x3e45c9);return _0x15cb35;})[_0x3b5c('0x20')](function(_0x4e44ad){if(_0x4e44ad){return _0x2f03f4[_0x3b5c('0x17')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x2f03f4,null))[_0x3b5c('0x43')](handleError(_0x2f03f4,null));}; \ No newline at end of file +var _0x9a68=['ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','length','options','find','download','converted_format','existsSync','root','ValidationError','format','%s.%s','save_name','catch','create','file','originalname','filename','extname','substring','wav','server/files/sounds/converted','basename','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','duration','original_sampleCount','sampleCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','channelCount','converted_bitRate','role','body','userProfileId','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','join','server/files/sounds/original','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x1daa6b,_0x2c2d73){var _0x5139b8=function(_0x42d738){while(--_0x42d738){_0x1daa6b['push'](_0x1daa6b['shift']());}};_0x5139b8(++_0x2c2d73);}(_0x9a68,0x74));var _0x89a6=function(_0x459745,_0x36c5c1){_0x459745=_0x459745-0x0;var _0x44f6f2=_0x9a68[_0x459745];return _0x44f6f2;};'use strict';var emlformat=require(_0x89a6('0x0'));var rimraf=require(_0x89a6('0x1'));var zipdir=require(_0x89a6('0x2'));var jsonpatch=require(_0x89a6('0x3'));var rp=require(_0x89a6('0x4'));var moment=require(_0x89a6('0x5'));var BPromise=require(_0x89a6('0x6'));var Mustache=require(_0x89a6('0x7'));var util=require(_0x89a6('0x8'));var path=require('path');var sox=require(_0x89a6('0x9'));var csv=require(_0x89a6('0xa'));var ejs=require(_0x89a6('0xb'));var fs=require('fs');var fs_extra=require(_0x89a6('0xc'));var _=require(_0x89a6('0xd'));var squel=require('squel');var crypto=require(_0x89a6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x89a6('0xf'));var toCsv=require(_0x89a6('0xa'));var querystring=require(_0x89a6('0x10'));var Papa=require(_0x89a6('0x11'));var Redis=require(_0x89a6('0x12'));var authService=require(_0x89a6('0x13'));var qs=require(_0x89a6('0x14'));var as=require(_0x89a6('0x15'));var hardwareService=require(_0x89a6('0x16'));var logger=require(_0x89a6('0x17'))(_0x89a6('0x18'));var utils=require(_0x89a6('0x19'));var config=require(_0x89a6('0x1a'));var licenseUtil=require(_0x89a6('0x1b'));var db=require(_0x89a6('0x1c'))['db'];function respondWithStatusCode(_0x6c63e2,_0x1e5fee){_0x1e5fee=_0x1e5fee||0xcc;return function(_0x289c00){if(_0x289c00){return _0x6c63e2[_0x89a6('0x1d')](_0x1e5fee);}return _0x6c63e2['status'](_0x1e5fee)[_0x89a6('0x1e')]();};}function respondWithResult(_0x436354,_0x356440){_0x356440=_0x356440||0xc8;return function(_0xd5774f){if(_0xd5774f){return _0x436354[_0x89a6('0x1f')](_0x356440)[_0x89a6('0x20')](_0xd5774f);}};}function respondWithFilteredResult(_0x376eef,_0x4cc232){return function(_0xb879e0){if(_0xb879e0){var _0x1891f8=typeof _0x4cc232[_0x89a6('0x21')]===_0x89a6('0x22')&&typeof _0x4cc232['limit']==='undefined';var _0x47c1d2=_0xb879e0[_0x89a6('0x23')];var _0x272227=_0x1891f8?0x0:_0x4cc232['offset'];var _0x33ab40=_0x1891f8?_0xb879e0[_0x89a6('0x23')]:_0x4cc232[_0x89a6('0x21')]+_0x4cc232[_0x89a6('0x24')];var _0xe617eb;if(_0x33ab40>=_0x47c1d2){_0x33ab40=_0x47c1d2;_0xe617eb=0xc8;}else{_0xe617eb=0xce;}_0x376eef[_0x89a6('0x1f')](_0xe617eb);return _0x376eef[_0x89a6('0x25')](_0x89a6('0x26'),_0x272227+'-'+_0x33ab40+'/'+_0x47c1d2)[_0x89a6('0x20')](_0xb879e0);}return null;};}function patchUpdates(_0x1ac5da){return function(_0xff4a28){try{jsonpatch[_0x89a6('0x27')](_0xff4a28,_0x1ac5da,!![]);}catch(_0x5efb88){return BPromise['reject'](_0x5efb88);}return _0xff4a28['save']();};}function saveUpdates(_0x267450,_0x27fa51){return function(_0x55333b){if(_0x55333b){return _0x55333b[_0x89a6('0x28')](_0x267450)[_0x89a6('0x29')](function(_0x5bb05d){return _0x5bb05d;});}return null;};}function removeEntity(_0x27570e,_0x5e9117){return function(_0x3705f3){if(_0x3705f3){return _0x3705f3[_0x89a6('0x2a')]()[_0x89a6('0x29')](function(){var _0x12b048=_0x3705f3['get']({'plain':!![]});var _0x481797='Sounds';return db[_0x89a6('0x2b')][_0x89a6('0x2a')]({'where':{'type':_0x481797,'resourceId':_0x12b048['id']}})['then'](function(){return _0x3705f3;});})['then'](function(){_0x27570e[_0x89a6('0x1f')](0xcc)[_0x89a6('0x1e')]();});}};}function handleEntityNotFound(_0x42ec67,_0xdca636){return function(_0x2a17fa){if(!_0x2a17fa){_0x42ec67[_0x89a6('0x1d')](0x194);}return _0x2a17fa;};}function handleError(_0x2c7f7e,_0x1c989e){_0x1c989e=_0x1c989e||0x1f4;return function(_0x8a1e6d){logger[_0x89a6('0x2c')](_0x8a1e6d[_0x89a6('0x2d')]);if(_0x8a1e6d[_0x89a6('0x2e')]){delete _0x8a1e6d[_0x89a6('0x2e')];}_0x2c7f7e['status'](_0x1c989e)[_0x89a6('0x2f')](_0x8a1e6d);};}exports[_0x89a6('0x30')]=function(_0x202d55,_0x4fee67){var _0xd647be={},_0x514e45={},_0x1c1bf6={'count':0x0,'rows':[]};var _0x17308a=_[_0x89a6('0x31')](db[_0x89a6('0x32')][_0x89a6('0x33')],function(_0x2aee51){return{'name':_0x2aee51[_0x89a6('0x34')],'type':_0x2aee51['type'][_0x89a6('0x35')]};});_0x514e45[_0x89a6('0x36')]=_[_0x89a6('0x31')](_0x17308a,_0x89a6('0x2e'));_0x514e45['query']=_[_0x89a6('0x37')](_0x202d55[_0x89a6('0x38')]);_0x514e45[_0x89a6('0x39')]=_[_0x89a6('0x3a')](_0x514e45[_0x89a6('0x36')],_0x514e45[_0x89a6('0x38')]);_0xd647be[_0x89a6('0x3b')]=_['intersection'](_0x514e45[_0x89a6('0x36')],qs[_0x89a6('0x3c')](_0x202d55[_0x89a6('0x38')][_0x89a6('0x3c')]));_0xd647be[_0x89a6('0x3b')]=_0xd647be['attributes']['length']?_0xd647be[_0x89a6('0x3b')]:_0x514e45[_0x89a6('0x36')];if(!_0x202d55[_0x89a6('0x38')][_0x89a6('0x3d')](_0x89a6('0x3e'))){_0xd647be[_0x89a6('0x24')]=qs[_0x89a6('0x24')](_0x202d55[_0x89a6('0x38')]['limit']);_0xd647be[_0x89a6('0x21')]=qs[_0x89a6('0x21')](_0x202d55[_0x89a6('0x38')][_0x89a6('0x21')]);}_0xd647be[_0x89a6('0x3f')]=qs[_0x89a6('0x40')](_0x202d55[_0x89a6('0x38')][_0x89a6('0x40')]);_0xd647be[_0x89a6('0x41')]=qs[_0x89a6('0x39')](_[_0x89a6('0x42')](_0x202d55[_0x89a6('0x38')],_0x514e45['filters']),_0x17308a);if(_0x202d55[_0x89a6('0x38')][_0x89a6('0x43')]){_0xd647be['where']=_[_0x89a6('0x44')](_0xd647be[_0x89a6('0x41')],{'$or':_[_0x89a6('0x31')](_0x17308a,function(_0x3cf8b7){if(_0x3cf8b7['type']!==_0x89a6('0x45')){var _0x4d057f={};_0x4d057f[_0x3cf8b7[_0x89a6('0x2e')]]={'$like':'%'+_0x202d55['query'][_0x89a6('0x43')]+'%'};return _0x4d057f;}})});}_0xd647be=_[_0x89a6('0x44')]({},_0xd647be,_0x202d55['options']);var _0x34a1ac={'where':_0xd647be[_0x89a6('0x41')]};return db[_0x89a6('0x32')]['count'](_0x34a1ac)['then'](function(_0x4a1b20){_0x1c1bf6[_0x89a6('0x23')]=_0x4a1b20;if(_0x202d55[_0x89a6('0x38')][_0x89a6('0x46')]){_0xd647be[_0x89a6('0x47')]=[{'all':!![]}];}return db[_0x89a6('0x32')][_0x89a6('0x48')](_0xd647be);})[_0x89a6('0x29')](function(_0x3cfe57){_0x1c1bf6[_0x89a6('0x49')]=_0x3cfe57;return _0x1c1bf6;})[_0x89a6('0x29')](respondWithFilteredResult(_0x4fee67,_0xd647be))['catch'](handleError(_0x4fee67,null));};exports['show']=function(_0x212d61,_0x406063){var _0x57c96b={'raw':!![],'where':{'id':_0x212d61[_0x89a6('0x4a')]['id']}},_0x358535={};_0x358535[_0x89a6('0x36')]=_[_0x89a6('0x37')](db['Sound'][_0x89a6('0x33')]);_0x358535['query']=_[_0x89a6('0x37')](_0x212d61[_0x89a6('0x38')]);_0x358535[_0x89a6('0x39')]=_['intersection'](_0x358535[_0x89a6('0x36')],_0x358535[_0x89a6('0x38')]);_0x57c96b['attributes']=_[_0x89a6('0x3a')](_0x358535[_0x89a6('0x36')],qs[_0x89a6('0x3c')](_0x212d61['query'][_0x89a6('0x3c')]));_0x57c96b[_0x89a6('0x3b')]=_0x57c96b[_0x89a6('0x3b')][_0x89a6('0x4b')]?_0x57c96b[_0x89a6('0x3b')]:_0x358535[_0x89a6('0x36')];if(_0x212d61['query'][_0x89a6('0x46')]){_0x57c96b[_0x89a6('0x47')]=[{'all':!![]}];}_0x57c96b=_[_0x89a6('0x44')]({},_0x57c96b,_0x212d61[_0x89a6('0x4c')]);return db['Sound'][_0x89a6('0x4d')](_0x57c96b)[_0x89a6('0x29')](handleEntityNotFound(_0x406063,null))[_0x89a6('0x29')](respondWithResult(_0x406063,null))['catch'](handleError(_0x406063,null));};exports[_0x89a6('0x4e')]=function(_0x1991a8,_0x49261f,_0x2143fc){return db['Sound'][_0x89a6('0x4d')]({'where':{'id':_0x1991a8['params']['id']},'attributes':[_0x89a6('0x2e'),'save_name',_0x89a6('0x4f')],'raw':!![]})[_0x89a6('0x29')](handleEntityNotFound(_0x49261f,null))[_0x89a6('0x29')](function(_0x2a0f23){if(_0x2a0f23){if(!fs[_0x89a6('0x50')](path['join'](config[_0x89a6('0x51')],'server/files/sounds/converted',_0x2a0f23['save_name']+'.'+_0x2a0f23[_0x89a6('0x4f')]))){throw new db['Sequelize'][(_0x89a6('0x52'))]('Sound\x20not\x20found');}return _0x49261f[_0x89a6('0x4e')](path['join'](config[_0x89a6('0x51')],'server/files/sounds/converted',util[_0x89a6('0x53')](_0x89a6('0x54'),_0x2a0f23[_0x89a6('0x55')],_0x2a0f23[_0x89a6('0x4f')])),util[_0x89a6('0x53')](_0x89a6('0x54'),_0x2a0f23[_0x89a6('0x2e')],_0x2a0f23[_0x89a6('0x4f')]));}return null;})[_0x89a6('0x56')](handleError(_0x49261f,null));};exports[_0x89a6('0x57')]=function(_0x55e1f0,_0x1c5b27,_0x24b79c){var _0x6ab17f={'name':path['basename'](_0x55e1f0[_0x89a6('0x58')][_0x89a6('0x59')],path['extname'](_0x55e1f0[_0x89a6('0x58')][_0x89a6('0x59')])),'save_name':path['basename'](_0x55e1f0[_0x89a6('0x58')][_0x89a6('0x5a')],path[_0x89a6('0x5b')](_0x55e1f0[_0x89a6('0x58')]['filename'])),'original_format':path[_0x89a6('0x5b')](_0x55e1f0[_0x89a6('0x58')]['originalname'])[_0x89a6('0x5c')](0x1),'converted_format':_0x89a6('0x5d')};var _0xc7beec=path['join'](config[_0x89a6('0x51')],'server/files/sounds/original',_0x55e1f0[_0x89a6('0x58')][_0x89a6('0x5a')]);var _0x206d15=path['join'](config[_0x89a6('0x51')],_0x89a6('0x5e'),util[_0x89a6('0x53')](_0x89a6('0x54'),path[_0x89a6('0x5f')](_0x55e1f0[_0x89a6('0x58')][_0x89a6('0x5a')],path['extname'](_0x55e1f0[_0x89a6('0x58')]['filename'])),_0x6ab17f['converted_format']));logger[_0x89a6('0x60')]('Sound\x20upload\x20filepath:\x20%s',_0xc7beec);logger[_0x89a6('0x60')](_0x89a6('0x61'),_0x206d15);try{fs[_0x89a6('0x62')](_0xc7beec,parseInt(_0x89a6('0x63'),0x8));var _0x291834=sox['transcode'](_0xc7beec,_0x206d15,{'sampleRate':0x1f40,'format':_0x89a6('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x291834['on'](_0x89a6('0x2c'),function(_0x31e18f){fs[_0x89a6('0x64')](_0xc7beec);_0x1c5b27[_0x89a6('0x1f')](0x1f4)['send'](_0x31e18f);});_0x291834['on'](_0x89a6('0x65'),function(_0x3541b4){_0x6ab17f['original_duration']=isNaN(_0x3541b4[_0x89a6('0x66')])?null:_0x3541b4['duration']*0x3e8;_0x6ab17f[_0x89a6('0x67')]=isNaN(_0x3541b4[_0x89a6('0x68')])?null:_0x3541b4['sampleCount'];_0x6ab17f['original_channelCount']=isNaN(_0x3541b4['channelCount'])?null:_0x3541b4['channelCount'];_0x6ab17f[_0x89a6('0x69')]=isNaN(_0x3541b4[_0x89a6('0x6a')])?null:_0x3541b4[_0x89a6('0x6a')];_0x6ab17f[_0x89a6('0x6b')]=isNaN(_0x3541b4[_0x89a6('0x6c')])?null:_0x3541b4[_0x89a6('0x6c')];});_0x291834['on'](_0x89a6('0x6d'),function(_0x29080e){_0x6ab17f[_0x89a6('0x6e')]=isNaN(_0x29080e[_0x89a6('0x66')])?null:_0x29080e[_0x89a6('0x66')]*0x3e8;_0x6ab17f['converted_sampleCount']=isNaN(_0x29080e[_0x89a6('0x68')])?null:_0x29080e['sampleCount'];_0x6ab17f[_0x89a6('0x6f')]=isNaN(_0x29080e['channelCount'])?null:_0x29080e[_0x89a6('0x70')];_0x6ab17f[_0x89a6('0x71')]=isNaN(_0x29080e[_0x89a6('0x6a')])?null:_0x29080e['bitRate'];_0x6ab17f['converted_sampleRate']=isNaN(_0x29080e[_0x89a6('0x6c')])?null:_0x29080e[_0x89a6('0x6c')];});_0x291834['on'](_0x89a6('0x1e'),function(){fs[_0x89a6('0x62')](_0x206d15,parseInt('0777',0x8));return db['Sound'][_0x89a6('0x57')](_0x6ab17f)[_0x89a6('0x29')](function(_0x38ac82){var _0x31f469={'role':_0x55e1f0['body'][_0x89a6('0x72')],'userProfileId':_0x55e1f0[_0x89a6('0x73')][_0x89a6('0x74')]};if(!_0x31f469)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31f469[_0x89a6('0x72')]===_0x89a6('0x75')){var _0x584487=_0x38ac82['get']({'plain':!![]});return db[_0x89a6('0x76')][_0x89a6('0x4d')]({'where':{'name':_0x89a6('0x77'),'userProfileId':_0x31f469[_0x89a6('0x74')]},'raw':!![]})[_0x89a6('0x29')](function(_0x183cd1){if(_0x183cd1&&_0x183cd1[_0x89a6('0x78')]===0x0){return db[_0x89a6('0x2b')][_0x89a6('0x57')]({'name':_0x584487[_0x89a6('0x2e')],'resourceId':_0x584487['id'],'type':_0x183cd1[_0x89a6('0x2e')],'sectionId':_0x183cd1['id']},{})['then'](function(){return _0x38ac82;});}else{return _0x38ac82;}})[_0x89a6('0x56')](function(_0x418034){logger[_0x89a6('0x2c')](_0x89a6('0x79'),_0x418034);throw _0x418034;});}return _0x38ac82;})[_0x89a6('0x29')](respondWithResult(_0x1c5b27,null))[_0x89a6('0x56')](handleError(_0x1c5b27,null));});_0x291834[_0x89a6('0x7a')]();}catch(_0x4d1f9d){_0x1c5b27[_0x89a6('0x1f')](0x1f4)[_0x89a6('0x2f')](_0x4d1f9d);}};exports[_0x89a6('0x28')]=function(_0x5981fe,_0x22450e,_0x4acf92){return db[_0x89a6('0x32')][_0x89a6('0x4d')]({'where':{'id':_0x5981fe[_0x89a6('0x4a')]['id']}})[_0x89a6('0x29')](handleEntityNotFound(_0x22450e,null))[_0x89a6('0x29')](saveUpdates(_[_0x89a6('0x42')](_0x5981fe[_0x89a6('0x73')],[_0x89a6('0x2e'),_0x89a6('0x7b')]),null))['then'](respondWithResult(_0x22450e,null))['catch'](handleError(_0x22450e,null));};exports[_0x89a6('0x7c')]=function(_0x8342a0,_0x386cc7,_0x24c567){return db[_0x89a6('0x32')]['find']({'where':{'id':_0x8342a0[_0x89a6('0x4a')]['id']}})[_0x89a6('0x29')](function(_0x2bc25e){if(_0x2bc25e){return _0x2bc25e[_0x89a6('0x2a')]();}})[_0x89a6('0x29')](function(_0x32784f){var _0x5d8b46=path[_0x89a6('0x7d')](config[_0x89a6('0x51')],_0x89a6('0x7e'),util['format'](_0x89a6('0x54'),_0x32784f[_0x89a6('0x55')],_0x32784f['original_format']));var _0x27c242=path[_0x89a6('0x7d')](config['root'],_0x89a6('0x5e'),util[_0x89a6('0x53')]('%s.%s',_0x32784f['save_name'],_0x32784f['converted_format']));fs[_0x89a6('0x64')](_0x5d8b46);fs[_0x89a6('0x64')](_0x27c242);return _0x32784f;})[_0x89a6('0x29')](function(_0x15b5f6){if(_0x15b5f6){return _0x386cc7[_0x89a6('0x1f')](0xcc)[_0x89a6('0x1e')]();}})['then'](handleEntityNotFound(_0x386cc7,null))['catch'](handleError(_0x386cc7,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index ac5e6a4..be9c084 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 _0x80dc=['bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','moment'];(function(_0x5033cb,_0x110dff){var _0x5cd0b3=function(_0x4787bb){while(--_0x4787bb){_0x5033cb['push'](_0x5033cb['shift']());}};_0x5cd0b3(++_0x110dff);}(_0x80dc,0xda));var _0xc80d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x80dc[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xc80d('0x0'));var util=require(_0xc80d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc80d('0x2'));var BPromise=require(_0xc80d('0x3'));var rp=require(_0xc80d('0x4'));var fs=require('fs');var path=require(_0xc80d('0x5'));var rimraf=require(_0xc80d('0x6'));var config=require(_0xc80d('0x7'));var attributes=require(_0xc80d('0x8'));module[_0xc80d('0x9')]=function(_0x27a76c,_0x1b6b8f){return _0x27a76c[_0xc80d('0xa')](_0xc80d('0xb'),attributes,{'tableName':_0xc80d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe521=['bluebird','path','rimraf','../../config/environment','exports','Sound','tools_sounds','lodash','../../config/logger','api'];(function(_0x3f4daa,_0x2f0bf1){var _0x2087ac=function(_0x158922){while(--_0x158922){_0x3f4daa['push'](_0x3f4daa['shift']());}};_0x2087ac(++_0x2f0bf1);}(_0xe521,0x6b));var _0x1e52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe521[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1e52('0x0'));var util=require('util');var logger=require(_0x1e52('0x1'))(_0x1e52('0x2'));var moment=require('moment');var BPromise=require(_0x1e52('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e52('0x4'));var rimraf=require(_0x1e52('0x5'));var config=require(_0x1e52('0x6'));var attributes=require('./sound.attributes');module[_0x1e52('0x7')]=function(_0x4f074f,_0x1b7aab){return _0x4f074f['define'](_0x1e52('0x8'),attributes,{'tableName':_0x1e52('0x9'),'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 2f014ce..959ee48 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 _0x59d4=['code','message','result','catch','ShowSound','Sound','find','options','where','attributes','include','model','map','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x59d4,0x70));var _0x459d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x59d4[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x459d('0x0'));var util=require(_0x459d('0x1'));var moment=require('moment');var BPromise=require(_0x459d('0x2'));var rs=require(_0x459d('0x3'));var fs=require('fs');var Redis=require(_0x459d('0x4'));var db=require(_0x459d('0x5'))['db'];var utils=require(_0x459d('0x6'));var logger=require(_0x459d('0x7'))(_0x459d('0x8'));var config=require(_0x459d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x459d('0xa')][_0x459d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3aaaf5,_0x40ac66,_0x31a265){return new BPromise(function(_0x5a7c8f,_0x53dc13){return client['request'](_0x3aaaf5,_0x31a265)[_0x459d('0xc')](function(_0x307036){logger[_0x459d('0xd')](_0x459d('0xe'),_0x40ac66,_0x459d('0xf'));logger[_0x459d('0x10')](_0x459d('0x11'),_0x40ac66,_0x459d('0xf'),JSON[_0x459d('0x12')](_0x307036));if(_0x307036[_0x459d('0x13')]){if(_0x307036['error'][_0x459d('0x14')]===0x1f4){logger[_0x459d('0x13')](_0x459d('0xe'),_0x40ac66,_0x307036[_0x459d('0x13')][_0x459d('0x15')]);return _0x53dc13(_0x307036['error'][_0x459d('0x15')]);}logger[_0x459d('0x13')](_0x459d('0xe'),_0x40ac66,_0x307036['error'][_0x459d('0x15')]);return _0x5a7c8f(_0x307036[_0x459d('0x13')][_0x459d('0x15')]);}else{logger[_0x459d('0xd')](_0x459d('0xe'),_0x40ac66,_0x459d('0xf'));_0x5a7c8f(_0x307036[_0x459d('0x16')]['message']);}})[_0x459d('0x17')](function(_0x154953){logger[_0x459d('0x13')](_0x459d('0xe'),_0x40ac66,_0x154953);_0x53dc13(_0x154953);});});}exports[_0x459d('0x18')]=function(_0x4e1f3e){var _0x11a12a=this;return new Promise(function(_0x136a57,_0x20f176){return db[_0x459d('0x19')][_0x459d('0x1a')]({'raw':_0x4e1f3e['options']?_0x4e1f3e[_0x459d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4e1f3e['options']?_0x4e1f3e[_0x459d('0x1b')][_0x459d('0x1c')]||null:null,'attributes':_0x4e1f3e['options']?_0x4e1f3e[_0x459d('0x1b')][_0x459d('0x1d')]||null:null,'include':_0x4e1f3e['options']?_0x4e1f3e[_0x459d('0x1b')][_0x459d('0x1e')]?_['map'](_0x4e1f3e[_0x459d('0x1b')][_0x459d('0x1e')],function(_0x46c9d1){return{'model':db[_0x46c9d1[_0x459d('0x1f')]],'as':_0x46c9d1['as'],'attributes':_0x46c9d1[_0x459d('0x1d')],'include':_0x46c9d1['include']?_[_0x459d('0x20')](_0x46c9d1[_0x459d('0x1e')],function(_0x5f26ba){return{'model':db[_0x5f26ba['model']],'as':_0x5f26ba['as'],'attributes':_0x5f26ba[_0x459d('0x1d')],'include':_0x5f26ba['include']?_['map'](_0x5f26ba['include'],function(_0x293ba8){return{'model':db[_0x293ba8[_0x459d('0x1f')]],'as':_0x293ba8['as'],'attributes':_0x293ba8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x31aa5c){logger[_0x459d('0xd')](_0x459d('0x18'),_0x4e1f3e);logger[_0x459d('0x10')](_0x459d('0x18'),_0x4e1f3e,JSON[_0x459d('0x12')](_0x31aa5c));_0x136a57(_0x31aa5c);})[_0x459d('0x17')](function(_0x1f8836){logger[_0x459d('0x13')](_0x459d('0x18'),_0x1f8836[_0x459d('0x15')],_0x4e1f3e);_0x20f176(_0x11a12a[_0x459d('0x13')](0x1f4,_0x1f8836[_0x459d('0x15')]));});});}; \ No newline at end of file +var _0x5917=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Sound','options','raw','where','attributes','map','include','model','then','ShowSound','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','Sound,\x20%s,\x20%s'];(function(_0x5fed04,_0x51b4fa){var _0x58a422=function(_0x4dc47a){while(--_0x4dc47a){_0x5fed04['push'](_0x5fed04['shift']());}};_0x58a422(++_0x51b4fa);}(_0x5917,0x134));var _0x7591=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5917[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7591('0x0'));var util=require('util');var moment=require(_0x7591('0x1'));var BPromise=require(_0x7591('0x2'));var rs=require(_0x7591('0x3'));var fs=require('fs');var Redis=require(_0x7591('0x4'));var db=require(_0x7591('0x5'))['db'];var utils=require(_0x7591('0x6'));var logger=require(_0x7591('0x7'))('rpc');var config=require(_0x7591('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7591('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cb52d,_0x1bec4e,_0x21c8ae){return new BPromise(function(_0x171d45,_0x3aa949){return client[_0x7591('0xa')](_0x3cb52d,_0x21c8ae)['then'](function(_0x1e4132){logger['info'](_0x7591('0xb'),_0x1bec4e,_0x7591('0xc'));logger[_0x7591('0xd')](_0x7591('0xe'),_0x1bec4e,'request\x20sent',JSON[_0x7591('0xf')](_0x1e4132));if(_0x1e4132[_0x7591('0x10')]){if(_0x1e4132['error'][_0x7591('0x11')]===0x1f4){logger[_0x7591('0x10')](_0x7591('0xb'),_0x1bec4e,_0x1e4132[_0x7591('0x10')][_0x7591('0x12')]);return _0x3aa949(_0x1e4132[_0x7591('0x10')][_0x7591('0x12')]);}logger['error'](_0x7591('0xb'),_0x1bec4e,_0x1e4132[_0x7591('0x10')][_0x7591('0x12')]);return _0x171d45(_0x1e4132[_0x7591('0x10')][_0x7591('0x12')]);}else{logger[_0x7591('0x13')](_0x7591('0xb'),_0x1bec4e,_0x7591('0xc'));_0x171d45(_0x1e4132[_0x7591('0x14')]['message']);}})[_0x7591('0x15')](function(_0x4e7ef4){logger['error']('Sound,\x20%s,\x20%s',_0x1bec4e,_0x4e7ef4);_0x3aa949(_0x4e7ef4);});});}exports['ShowSound']=function(_0x111108){var _0x170d90=this;return new Promise(function(_0x476f74,_0x6881db){return db[_0x7591('0x16')]['find']({'raw':_0x111108[_0x7591('0x17')]?_0x111108[_0x7591('0x17')][_0x7591('0x18')]===undefined?!![]:![]:!![],'where':_0x111108[_0x7591('0x17')]?_0x111108['options'][_0x7591('0x19')]||null:null,'attributes':_0x111108[_0x7591('0x17')]?_0x111108['options'][_0x7591('0x1a')]||null:null,'include':_0x111108[_0x7591('0x17')]?_0x111108[_0x7591('0x17')]['include']?_[_0x7591('0x1b')](_0x111108[_0x7591('0x17')][_0x7591('0x1c')],function(_0x3e5ab2){return{'model':db[_0x3e5ab2[_0x7591('0x1d')]],'as':_0x3e5ab2['as'],'attributes':_0x3e5ab2[_0x7591('0x1a')],'include':_0x3e5ab2[_0x7591('0x1c')]?_[_0x7591('0x1b')](_0x3e5ab2[_0x7591('0x1c')],function(_0x153fb9){return{'model':db[_0x153fb9[_0x7591('0x1d')]],'as':_0x153fb9['as'],'attributes':_0x153fb9[_0x7591('0x1a')],'include':_0x153fb9[_0x7591('0x1c')]?_[_0x7591('0x1b')](_0x153fb9[_0x7591('0x1c')],function(_0x200719){return{'model':db[_0x200719[_0x7591('0x1d')]],'as':_0x200719['as'],'attributes':_0x200719[_0x7591('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7591('0x1e')](function(_0xad8992){logger['info'](_0x7591('0x1f'),_0x111108);logger['debug'](_0x7591('0x1f'),_0x111108,JSON[_0x7591('0xf')](_0xad8992));_0x476f74(_0xad8992);})[_0x7591('0x15')](function(_0x466bf1){logger[_0x7591('0x10')](_0x7591('0x1f'),_0x466bf1[_0x7591('0x12')],_0x111108);_0x6881db(_0x170d90['error'](0x1f4,_0x466bf1['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index e9de655..65210af 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(_0x4fbad6,_0x3eb736){var _0x5a4bc9=function(_0x1753c4){while(--_0x1753c4){_0x4fbad6['push'](_0x4fbad6['shift']());}};_0x5a4bc9(++_0x3eb736);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1c30bf,_0x247c31){_0x1c30bf=_0x1c30bf-0x0;var _0x255b5e=_0x5eb8[_0x1c30bf];return _0x255b5e;};'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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0xc28590,_0x154df6){var _0x1ae7a2=function(_0xd039a5){while(--_0xd039a5){_0xc28590['push'](_0xc28590['shift']());}};_0x1ae7a2(++_0x154df6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xb7e7[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 6983a86..e3c7826 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 _0x2056=['sequelize','exports','TEXT','medium','ENUM','out','STRING'];(function(_0xe501ff,_0x955b7e){var _0x17135d=function(_0x8e3458){while(--_0x8e3458){_0xe501ff['push'](_0xe501ff['shift']());}};_0x17135d(++_0x955b7e);}(_0x2056,0x142));var _0x6205=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0x2056[_0x5a7f64];return _0x3d30f1;};'use strict';var Sequelize=require(_0x6205('0x0'));module[_0x6205('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x6205('0x2')](_0x6205('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6205('0x4')]('in',_0x6205('0x5')),'defaultValue':_0x6205('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6205('0x6')]},'providerResponse':{'type':Sequelize[_0x6205('0x2')]}}; \ No newline at end of file +var _0x287f=['sequelize','STRING','TEXT','out'];(function(_0x53f6f3,_0x485b4e){var _0x4dce48=function(_0x7f24cd){while(--_0x7f24cd){_0x53f6f3['push'](_0x53f6f3['shift']());}};_0x4dce48(++_0x485b4e);}(_0x287f,0x6c));var _0xf287=function(_0x5bd208,_0x532a55){_0x5bd208=_0x5bd208-0x0;var _0x2cc216=_0x287f[_0x5bd208];return _0x2cc216;};'use strict';var Sequelize=require(_0xf287('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xf287('0x1')]},'body':{'type':Sequelize[_0xf287('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf287('0x3')),'defaultValue':_0xf287('0x3'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf287('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 117b547..96171d7 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 _0x714d=['zip-dir','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','fields','length','include','options','find','create','body','rimraf'];(function(_0x558bc1,_0x308d0c){var _0x3e9e05=function(_0x42bf65){while(--_0x42bf65){_0x558bc1['push'](_0x558bc1['shift']());}};_0x3e9e05(++_0x308d0c);}(_0x714d,0x167));var _0xd714=function(_0x22faeb,_0x2af181){_0x22faeb=_0x22faeb-0x0;var _0x2fc703=_0x714d[_0x22faeb];return _0x2fc703;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd714('0x0'));var zipdir=require(_0xd714('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd714('0x2'));var moment=require(_0xd714('0x3'));var BPromise=require(_0xd714('0x4'));var Mustache=require('mustache');var util=require(_0xd714('0x5'));var path=require('path');var sox=require(_0xd714('0x6'));var csv=require('to-csv');var ejs=require(_0xd714('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd714('0x8'));var squel=require(_0xd714('0x9'));var crypto=require('crypto');var jsforce=require(_0xd714('0xa'));var deskjs=require(_0xd714('0xb'));var toCsv=require(_0xd714('0xc'));var querystring=require(_0xd714('0xd'));var Papa=require(_0xd714('0xe'));var Redis=require('ioredis');var authService=require(_0xd714('0xf'));var qs=require(_0xd714('0x10'));var as=require(_0xd714('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd714('0x12'))(_0xd714('0x13'));var utils=require('../../config/utils');var config=require(_0xd714('0x14'));var licenseUtil=require(_0xd714('0x15'));var db=require(_0xd714('0x16'))['db'];function respondWithStatusCode(_0x2aa4c0,_0x67a855){_0x67a855=_0x67a855||0xcc;return function(_0x5cd551){if(_0x5cd551){return _0x2aa4c0[_0xd714('0x17')](_0x67a855);}return _0x2aa4c0['status'](_0x67a855)[_0xd714('0x18')]();};}function respondWithResult(_0x4c8ca6,_0x112c68){_0x112c68=_0x112c68||0xc8;return function(_0x4a280a){if(_0x4a280a){return _0x4c8ca6['status'](_0x112c68)[_0xd714('0x19')](_0x4a280a);}};}function respondWithFilteredResult(_0x5db3a3,_0x322b33){return function(_0x1d9294){if(_0x1d9294){var _0x45a0a9=typeof _0x322b33[_0xd714('0x1a')]==='undefined'&&typeof _0x322b33[_0xd714('0x1b')]==='undefined';var _0x556e7f=_0x1d9294[_0xd714('0x1c')];var _0x167f32=_0x45a0a9?0x0:_0x322b33['offset'];var _0x2e1af1=_0x45a0a9?_0x1d9294[_0xd714('0x1c')]:_0x322b33[_0xd714('0x1a')]+_0x322b33[_0xd714('0x1b')];var _0x38c5ee;if(_0x2e1af1>=_0x556e7f){_0x2e1af1=_0x556e7f;_0x38c5ee=0xc8;}else{_0x38c5ee=0xce;}_0x5db3a3[_0xd714('0x1d')](_0x38c5ee);return _0x5db3a3['set'](_0xd714('0x1e'),_0x167f32+'-'+_0x2e1af1+'/'+_0x556e7f)['json'](_0x1d9294);}return null;};}function patchUpdates(_0x387688){return function(_0x17ba41){try{jsonpatch[_0xd714('0x1f')](_0x17ba41,_0x387688,!![]);}catch(_0xe1dc79){return BPromise[_0xd714('0x20')](_0xe1dc79);}return _0x17ba41[_0xd714('0x21')]();};}function saveUpdates(_0x4eabdd,_0x1c0c4b){return function(_0x2fbf0a){if(_0x2fbf0a){return _0x2fbf0a[_0xd714('0x22')](_0x4eabdd)[_0xd714('0x23')](function(_0xffcfd0){return _0xffcfd0;});}return null;};}function removeEntity(_0x32854f,_0x4e0756){return function(_0x1ebceb){if(_0x1ebceb){return _0x1ebceb[_0xd714('0x24')]()[_0xd714('0x23')](function(){_0x32854f[_0xd714('0x1d')](0xcc)[_0xd714('0x18')]();});}};}function handleEntityNotFound(_0x1bdd2e,_0x1f8e01){return function(_0x2a914b){if(!_0x2a914b){_0x1bdd2e[_0xd714('0x17')](0x194);}return _0x2a914b;};}function handleError(_0x34e03c,_0x1539ad){_0x1539ad=_0x1539ad||0x1f4;return function(_0x3f4d6b){logger['error'](_0x3f4d6b['stack']);if(_0x3f4d6b[_0xd714('0x25')]){delete _0x3f4d6b[_0xd714('0x25')];}_0x34e03c[_0xd714('0x1d')](_0x1539ad)[_0xd714('0x26')](_0x3f4d6b);};}exports[_0xd714('0x27')]=function(_0x4d27ae,_0x4ff215){var _0x2eea83={},_0x2c303b={},_0x2e96ac={'count':0x0,'rows':[]};var _0x4e9d75=_[_0xd714('0x28')](db[_0xd714('0x29')][_0xd714('0x2a')],function(_0x28d704){return{'name':_0x28d704[_0xd714('0x2b')],'type':_0x28d704[_0xd714('0x2c')][_0xd714('0x2d')]};});_0x2c303b[_0xd714('0x2e')]=_[_0xd714('0x28')](_0x4e9d75,_0xd714('0x25'));_0x2c303b[_0xd714('0x2f')]=_[_0xd714('0x30')](_0x4d27ae[_0xd714('0x2f')]);_0x2c303b[_0xd714('0x31')]=_[_0xd714('0x32')](_0x2c303b['model'],_0x2c303b[_0xd714('0x2f')]);_0x2eea83[_0xd714('0x33')]=_[_0xd714('0x32')](_0x2c303b[_0xd714('0x2e')],qs['fields'](_0x4d27ae['query']['fields']));_0x2eea83[_0xd714('0x33')]=_0x2eea83[_0xd714('0x33')]['length']?_0x2eea83[_0xd714('0x33')]:_0x2c303b[_0xd714('0x2e')];if(!_0x4d27ae[_0xd714('0x2f')]['hasOwnProperty']('nolimit')){_0x2eea83[_0xd714('0x1b')]=qs[_0xd714('0x1b')](_0x4d27ae[_0xd714('0x2f')][_0xd714('0x1b')]);_0x2eea83[_0xd714('0x1a')]=qs[_0xd714('0x1a')](_0x4d27ae[_0xd714('0x2f')][_0xd714('0x1a')]);}_0x2eea83[_0xd714('0x34')]=qs[_0xd714('0x35')](_0x4d27ae[_0xd714('0x2f')][_0xd714('0x35')]);_0x2eea83[_0xd714('0x36')]=qs[_0xd714('0x31')](_[_0xd714('0x37')](_0x4d27ae['query'],_0x2c303b[_0xd714('0x31')]),_0x4e9d75);if(_0x4d27ae['query'][_0xd714('0x38')]){_0x2eea83[_0xd714('0x36')]=_['merge'](_0x2eea83['where'],{'$or':_[_0xd714('0x28')](_0x4e9d75,function(_0x8767b2){if(_0x8767b2[_0xd714('0x2c')]!==_0xd714('0x39')){var _0x457350={};_0x457350[_0x8767b2[_0xd714('0x25')]]={'$like':'%'+_0x4d27ae['query'][_0xd714('0x38')]+'%'};return _0x457350;}})});}_0x2eea83=_[_0xd714('0x3a')]({},_0x2eea83,_0x4d27ae['options']);var _0x58dd45={'where':_0x2eea83[_0xd714('0x36')]};return db[_0xd714('0x29')][_0xd714('0x1c')](_0x58dd45)[_0xd714('0x23')](function(_0x14fe1b){_0x2e96ac[_0xd714('0x1c')]=_0x14fe1b;if(_0x4d27ae[_0xd714('0x2f')][_0xd714('0x3b')]){_0x2eea83['include']=[{'all':!![]}];}return db[_0xd714('0x29')][_0xd714('0x3c')](_0x2eea83);})['then'](function(_0x122a64){_0x2e96ac[_0xd714('0x3d')]=_0x122a64;return _0x2e96ac;})[_0xd714('0x23')](respondWithFilteredResult(_0x4ff215,_0x2eea83))[_0xd714('0x3e')](handleError(_0x4ff215,null));};exports[_0xd714('0x3f')]=function(_0x19b088,_0x385161){var _0x2cf60d={'raw':!![],'where':{'id':_0x19b088[_0xd714('0x40')]['id']}},_0x4f9bc7={};_0x4f9bc7[_0xd714('0x2e')]=_[_0xd714('0x30')](db[_0xd714('0x29')]['rawAttributes']);_0x4f9bc7[_0xd714('0x2f')]=_[_0xd714('0x30')](_0x19b088[_0xd714('0x2f')]);_0x4f9bc7[_0xd714('0x31')]=_[_0xd714('0x32')](_0x4f9bc7[_0xd714('0x2e')],_0x4f9bc7[_0xd714('0x2f')]);_0x2cf60d[_0xd714('0x33')]=_[_0xd714('0x32')](_0x4f9bc7['model'],qs['fields'](_0x19b088[_0xd714('0x2f')][_0xd714('0x41')]));_0x2cf60d[_0xd714('0x33')]=_0x2cf60d[_0xd714('0x33')][_0xd714('0x42')]?_0x2cf60d[_0xd714('0x33')]:_0x4f9bc7[_0xd714('0x2e')];if(_0x19b088[_0xd714('0x2f')]['includeAll']){_0x2cf60d[_0xd714('0x43')]=[{'all':!![]}];}_0x2cf60d=_[_0xd714('0x3a')]({},_0x2cf60d,_0x19b088[_0xd714('0x44')]);return db[_0xd714('0x29')][_0xd714('0x45')](_0x2cf60d)[_0xd714('0x23')](handleEntityNotFound(_0x385161,null))[_0xd714('0x23')](respondWithResult(_0x385161,null))[_0xd714('0x3e')](handleError(_0x385161,null));};exports[_0xd714('0x46')]=function(_0x5781e4,_0x4981d8){return db['SquareMessage'][_0xd714('0x46')](_0x5781e4[_0xd714('0x47')],{})['then'](respondWithResult(_0x4981d8,0xc9))[_0xd714('0x3e')](handleError(_0x4981d8,null));};exports[_0xd714('0x22')]=function(_0x50db5b,_0x197a92){if(_0x50db5b['body']['id']){delete _0x50db5b[_0xd714('0x47')]['id'];}return db[_0xd714('0x29')]['find']({'where':{'id':_0x50db5b['params']['id']}})[_0xd714('0x23')](handleEntityNotFound(_0x197a92,null))[_0xd714('0x23')](saveUpdates(_0x50db5b['body'],null))[_0xd714('0x23')](respondWithResult(_0x197a92,null))[_0xd714('0x3e')](handleError(_0x197a92,null));};exports[_0xd714('0x24')]=function(_0x5c1c63,_0xa4445c){return db['SquareMessage'][_0xd714('0x45')]({'where':{'id':_0x5c1c63[_0xd714('0x40')]['id']}})['then'](handleEntityNotFound(_0xa4445c,null))['then'](removeEntity(_0xa4445c,null))['catch'](handleError(_0xa4445c,null));}; \ No newline at end of file +var _0x6f83=['destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','SquareMessage','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then'];(function(_0xcbf182,_0x5d7bd4){var _0x2db93a=function(_0x321744){while(--_0x321744){_0xcbf182['push'](_0xcbf182['shift']());}};_0x2db93a(++_0x5d7bd4);}(_0x6f83,0x72));var _0x36f8=function(_0x644c54,_0x594aea){_0x644c54=_0x644c54-0x0;var _0x4523bb=_0x6f83[_0x644c54];return _0x4523bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x36f8('0x0'));var zipdir=require(_0x36f8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36f8('0x2'));var moment=require(_0x36f8('0x3'));var BPromise=require(_0x36f8('0x4'));var Mustache=require(_0x36f8('0x5'));var util=require(_0x36f8('0x6'));var path=require(_0x36f8('0x7'));var sox=require(_0x36f8('0x8'));var csv=require(_0x36f8('0x9'));var ejs=require(_0x36f8('0xa'));var fs=require('fs');var fs_extra=require(_0x36f8('0xb'));var _=require(_0x36f8('0xc'));var squel=require(_0x36f8('0xd'));var crypto=require(_0x36f8('0xe'));var jsforce=require(_0x36f8('0xf'));var deskjs=require(_0x36f8('0x10'));var toCsv=require(_0x36f8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x36f8('0x11'));var qs=require(_0x36f8('0x12'));var as=require(_0x36f8('0x13'));var hardwareService=require(_0x36f8('0x14'));var logger=require(_0x36f8('0x15'))(_0x36f8('0x16'));var utils=require(_0x36f8('0x17'));var config=require(_0x36f8('0x18'));var licenseUtil=require(_0x36f8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x71e1ab,_0x196122){_0x196122=_0x196122||0xcc;return function(_0x166a1c){if(_0x166a1c){return _0x71e1ab[_0x36f8('0x1a')](_0x196122);}return _0x71e1ab['status'](_0x196122)[_0x36f8('0x1b')]();};}function respondWithResult(_0x189e22,_0x40a1c0){_0x40a1c0=_0x40a1c0||0xc8;return function(_0x5a8556){if(_0x5a8556){return _0x189e22[_0x36f8('0x1c')](_0x40a1c0)[_0x36f8('0x1d')](_0x5a8556);}};}function respondWithFilteredResult(_0x1ba051,_0x5048e0){return function(_0x429efc){if(_0x429efc){var _0x3e3281=typeof _0x5048e0[_0x36f8('0x1e')]===_0x36f8('0x1f')&&typeof _0x5048e0['limit']==='undefined';var _0x3f9947=_0x429efc['count'];var _0x517cba=_0x3e3281?0x0:_0x5048e0[_0x36f8('0x1e')];var _0x3d6a3c=_0x3e3281?_0x429efc['count']:_0x5048e0[_0x36f8('0x1e')]+_0x5048e0[_0x36f8('0x20')];var _0x290e63;if(_0x3d6a3c>=_0x3f9947){_0x3d6a3c=_0x3f9947;_0x290e63=0xc8;}else{_0x290e63=0xce;}_0x1ba051[_0x36f8('0x1c')](_0x290e63);return _0x1ba051[_0x36f8('0x21')](_0x36f8('0x22'),_0x517cba+'-'+_0x3d6a3c+'/'+_0x3f9947)[_0x36f8('0x1d')](_0x429efc);}return null;};}function patchUpdates(_0x16b9e8){return function(_0x283fd0){try{jsonpatch[_0x36f8('0x23')](_0x283fd0,_0x16b9e8,!![]);}catch(_0x26fc64){return BPromise[_0x36f8('0x24')](_0x26fc64);}return _0x283fd0['save']();};}function saveUpdates(_0xefe5b2,_0x42d203){return function(_0x41ccc3){if(_0x41ccc3){return _0x41ccc3['update'](_0xefe5b2)[_0x36f8('0x25')](function(_0x52b5ac){return _0x52b5ac;});}return null;};}function removeEntity(_0x362eae,_0x206075){return function(_0x4d2cd9){if(_0x4d2cd9){return _0x4d2cd9[_0x36f8('0x26')]()['then'](function(){_0x362eae[_0x36f8('0x1c')](0xcc)[_0x36f8('0x1b')]();});}};}function handleEntityNotFound(_0xb2acc5,_0x2eeb82){return function(_0x6740e1){if(!_0x6740e1){_0xb2acc5[_0x36f8('0x1a')](0x194);}return _0x6740e1;};}function handleError(_0x59291b,_0x462fd2){_0x462fd2=_0x462fd2||0x1f4;return function(_0xb2bbfd){logger[_0x36f8('0x27')](_0xb2bbfd[_0x36f8('0x28')]);if(_0xb2bbfd[_0x36f8('0x29')]){delete _0xb2bbfd[_0x36f8('0x29')];}_0x59291b[_0x36f8('0x1c')](_0x462fd2)[_0x36f8('0x2a')](_0xb2bbfd);};}exports[_0x36f8('0x2b')]=function(_0x51a2a1,_0x449882){var _0x1f67ea={},_0x3f01a6={},_0x328be8={'count':0x0,'rows':[]};var _0x191cdc=_[_0x36f8('0x2c')](db['SquareMessage'][_0x36f8('0x2d')],function(_0x302745){return{'name':_0x302745[_0x36f8('0x2e')],'type':_0x302745[_0x36f8('0x2f')][_0x36f8('0x30')]};});_0x3f01a6[_0x36f8('0x31')]=_[_0x36f8('0x2c')](_0x191cdc,_0x36f8('0x29'));_0x3f01a6[_0x36f8('0x32')]=_[_0x36f8('0x33')](_0x51a2a1[_0x36f8('0x32')]);_0x3f01a6['filters']=_['intersection'](_0x3f01a6['model'],_0x3f01a6[_0x36f8('0x32')]);_0x1f67ea[_0x36f8('0x34')]=_[_0x36f8('0x35')](_0x3f01a6['model'],qs[_0x36f8('0x36')](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x36')]));_0x1f67ea[_0x36f8('0x34')]=_0x1f67ea[_0x36f8('0x34')][_0x36f8('0x37')]?_0x1f67ea[_0x36f8('0x34')]:_0x3f01a6[_0x36f8('0x31')];if(!_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x38')]('nolimit')){_0x1f67ea[_0x36f8('0x20')]=qs[_0x36f8('0x20')](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x20')]);_0x1f67ea[_0x36f8('0x1e')]=qs['offset'](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x1e')]);}_0x1f67ea[_0x36f8('0x39')]=qs['sort'](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x3a')]);_0x1f67ea[_0x36f8('0x3b')]=qs[_0x36f8('0x3c')](_['pick'](_0x51a2a1['query'],_0x3f01a6[_0x36f8('0x3c')]),_0x191cdc);if(_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x3d')]){_0x1f67ea[_0x36f8('0x3b')]=_[_0x36f8('0x3e')](_0x1f67ea[_0x36f8('0x3b')],{'$or':_[_0x36f8('0x2c')](_0x191cdc,function(_0x598db5){if(_0x598db5[_0x36f8('0x2f')]!=='VIRTUAL'){var _0x258c27={};_0x258c27[_0x598db5[_0x36f8('0x29')]]={'$like':'%'+_0x51a2a1[_0x36f8('0x32')]['filter']+'%'};return _0x258c27;}})});}_0x1f67ea=_['merge']({},_0x1f67ea,_0x51a2a1[_0x36f8('0x3f')]);var _0x245a27={'where':_0x1f67ea[_0x36f8('0x3b')]};return db[_0x36f8('0x40')][_0x36f8('0x41')](_0x245a27)[_0x36f8('0x25')](function(_0x437218){_0x328be8[_0x36f8('0x41')]=_0x437218;if(_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x42')]){_0x1f67ea['include']=[{'all':!![]}];}return db[_0x36f8('0x40')][_0x36f8('0x43')](_0x1f67ea);})[_0x36f8('0x25')](function(_0x1e97de){_0x328be8[_0x36f8('0x44')]=_0x1e97de;return _0x328be8;})['then'](respondWithFilteredResult(_0x449882,_0x1f67ea))[_0x36f8('0x45')](handleError(_0x449882,null));};exports[_0x36f8('0x46')]=function(_0x3e1700,_0x53aa30){var _0x10e763={'raw':!![],'where':{'id':_0x3e1700[_0x36f8('0x47')]['id']}},_0x3b9d5e={};_0x3b9d5e[_0x36f8('0x31')]=_[_0x36f8('0x33')](db['SquareMessage'][_0x36f8('0x2d')]);_0x3b9d5e[_0x36f8('0x32')]=_[_0x36f8('0x33')](_0x3e1700[_0x36f8('0x32')]);_0x3b9d5e[_0x36f8('0x3c')]=_[_0x36f8('0x35')](_0x3b9d5e[_0x36f8('0x31')],_0x3b9d5e[_0x36f8('0x32')]);_0x10e763['attributes']=_[_0x36f8('0x35')](_0x3b9d5e['model'],qs[_0x36f8('0x36')](_0x3e1700[_0x36f8('0x32')]['fields']));_0x10e763[_0x36f8('0x34')]=_0x10e763[_0x36f8('0x34')]['length']?_0x10e763['attributes']:_0x3b9d5e[_0x36f8('0x31')];if(_0x3e1700[_0x36f8('0x32')][_0x36f8('0x42')]){_0x10e763[_0x36f8('0x48')]=[{'all':!![]}];}_0x10e763=_[_0x36f8('0x3e')]({},_0x10e763,_0x3e1700['options']);return db['SquareMessage'][_0x36f8('0x49')](_0x10e763)[_0x36f8('0x25')](handleEntityNotFound(_0x53aa30,null))[_0x36f8('0x25')](respondWithResult(_0x53aa30,null))[_0x36f8('0x45')](handleError(_0x53aa30,null));};exports[_0x36f8('0x4a')]=function(_0x5085ac,_0x4b324d){return db[_0x36f8('0x40')][_0x36f8('0x4a')](_0x5085ac[_0x36f8('0x4b')],{})[_0x36f8('0x25')](respondWithResult(_0x4b324d,0xc9))[_0x36f8('0x45')](handleError(_0x4b324d,null));};exports['update']=function(_0x8e0950,_0x488b41){if(_0x8e0950[_0x36f8('0x4b')]['id']){delete _0x8e0950[_0x36f8('0x4b')]['id'];}return db[_0x36f8('0x40')]['find']({'where':{'id':_0x8e0950[_0x36f8('0x47')]['id']}})[_0x36f8('0x25')](handleEntityNotFound(_0x488b41,null))[_0x36f8('0x25')](saveUpdates(_0x8e0950[_0x36f8('0x4b')],null))[_0x36f8('0x25')](respondWithResult(_0x488b41,null))['catch'](handleError(_0x488b41,null));};exports[_0x36f8('0x26')]=function(_0x4bacdb,_0x5b38da){return db['SquareMessage'][_0x36f8('0x49')]({'where':{'id':_0x4bacdb[_0x36f8('0x47')]['id']}})[_0x36f8('0x25')](handleEntityNotFound(_0x5b38da,null))[_0x36f8('0x25')](removeEntity(_0x5b38da,null))[_0x36f8('0x45')](handleError(_0x5b38da,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 92964fa..2d1a7ec 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 _0x5d6e=['square_messages','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes','SquareMessage'];(function(_0x2040b3,_0xb0abee){var _0x478d15=function(_0x5befdf){while(--_0x5befdf){_0x2040b3['push'](_0x2040b3['shift']());}};_0x478d15(++_0xb0abee);}(_0x5d6e,0xfe));var _0xe5d6=function(_0x15a34f,_0x1378ba){_0x15a34f=_0x15a34f-0x0;var _0x2e7b6b=_0x5d6e[_0x15a34f];return _0x2e7b6b;};'use strict';var _=require(_0xe5d6('0x0'));var util=require(_0xe5d6('0x1'));var logger=require(_0xe5d6('0x2'))(_0xe5d6('0x3'));var moment=require('moment');var BPromise=require(_0xe5d6('0x4'));var rp=require(_0xe5d6('0x5'));var fs=require('fs');var path=require(_0xe5d6('0x6'));var rimraf=require('rimraf');var config=require(_0xe5d6('0x7'));var attributes=require(_0xe5d6('0x8'));module['exports']=function(_0x319f83,_0x157c66){return _0x319f83['define'](_0xe5d6('0x9'),attributes,{'tableName':_0xe5d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffef=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages'];(function(_0x12d13f,_0x5c09cb){var _0x20bb53=function(_0x3e0b1d){while(--_0x3e0b1d){_0x12d13f['push'](_0x12d13f['shift']());}};_0x20bb53(++_0x5c09cb);}(_0xffef,0x11e));var _0xfffe=function(_0x3cc4a3,_0x4fc3f4){_0x3cc4a3=_0x3cc4a3-0x0;var _0x557d18=_0xffef[_0x3cc4a3];return _0x557d18;};'use strict';var _=require('lodash');var util=require(_0xfffe('0x0'));var logger=require(_0xfffe('0x1'))(_0xfffe('0x2'));var moment=require(_0xfffe('0x3'));var BPromise=require('bluebird');var rp=require(_0xfffe('0x4'));var fs=require('fs');var path=require(_0xfffe('0x5'));var rimraf=require(_0xfffe('0x6'));var config=require(_0xfffe('0x7'));var attributes=require(_0xfffe('0x8'));module[_0xfffe('0x9')]=function(_0x5cd1a3,_0x327122){return _0x5cd1a3[_0xfffe('0xa')](_0xfffe('0xb'),attributes,{'tableName':_0xfffe('0xc'),'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 52a2e81..0aea1ba 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 _0x8c4c=['request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x35fb81,_0x5e750d){var _0x15440b=function(_0x3a924f){while(--_0x3a924f){_0x35fb81['push'](_0x35fb81['shift']());}};_0x15440b(++_0x5e750d);}(_0x8c4c,0x65));var _0xc8c4=function(_0x237d31,_0x3428d4){_0x237d31=_0x237d31-0x0;var _0x49fb19=_0x8c4c[_0x237d31];return _0x49fb19;};'use strict';var _=require(_0xc8c4('0x0'));var util=require(_0xc8c4('0x1'));var moment=require(_0xc8c4('0x2'));var BPromise=require(_0xc8c4('0x3'));var rs=require(_0xc8c4('0x4'));var fs=require('fs');var Redis=require(_0xc8c4('0x5'));var db=require(_0xc8c4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc8c4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc8c4('0x8'));var client=jayson[_0xc8c4('0x9')][_0xc8c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x591c24,_0x4e7a59,_0x5da2e7){return new BPromise(function(_0x254a99,_0x33f0ec){return client[_0xc8c4('0xb')](_0x591c24,_0x5da2e7)[_0xc8c4('0xc')](function(_0x51cc0a){logger[_0xc8c4('0xd')](_0xc8c4('0xe'),_0x4e7a59,_0xc8c4('0xf'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4e7a59,_0xc8c4('0xf'),JSON[_0xc8c4('0x10')](_0x51cc0a));if(_0x51cc0a[_0xc8c4('0x11')]){if(_0x51cc0a['error']['code']===0x1f4){logger[_0xc8c4('0x11')]('SquareMessage,\x20%s,\x20%s',_0x4e7a59,_0x51cc0a['error'][_0xc8c4('0x12')]);return _0x33f0ec(_0x51cc0a[_0xc8c4('0x11')][_0xc8c4('0x12')]);}logger[_0xc8c4('0x11')]('SquareMessage,\x20%s,\x20%s',_0x4e7a59,_0x51cc0a[_0xc8c4('0x11')]['message']);return _0x254a99(_0x51cc0a['error']['message']);}else{logger[_0xc8c4('0xd')](_0xc8c4('0xe'),_0x4e7a59,'request\x20sent');_0x254a99(_0x51cc0a[_0xc8c4('0x13')][_0xc8c4('0x12')]);}})[_0xc8c4('0x14')](function(_0x3601ff){logger[_0xc8c4('0x11')]('SquareMessage,\x20%s,\x20%s',_0x4e7a59,_0x3601ff);_0x33f0ec(_0x3601ff);});});}exports[_0xc8c4('0x15')]=function(_0x36f5e6){var _0x24ac2c=this;return new Promise(function(_0x1b37a1,_0x523ce7){return db[_0xc8c4('0x16')][_0xc8c4('0x17')](_0x36f5e6[_0xc8c4('0x18')],{'raw':_0x36f5e6[_0xc8c4('0x19')]?_0x36f5e6[_0xc8c4('0x19')][_0xc8c4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x542edf){logger['info']('CreateSquareMessage',_0x36f5e6);logger[_0xc8c4('0x1b')](_0xc8c4('0x15'),_0x36f5e6,JSON['stringify'](_0x542edf));_0x1b37a1(_0x542edf);})[_0xc8c4('0x14')](function(_0x474478){logger['error'](_0xc8c4('0x15'),_0x474478['message'],_0x36f5e6);_0x523ce7(_0x24ac2c[_0xc8c4('0x11')](0x1f4,_0x474478[_0xc8c4('0x12')]));});});}; \ No newline at end of file +var _0x12d1=['info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SquareMessage','options','CreateSquareMessage','moment','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then'];(function(_0x5aa441,_0x5ca270){var _0x1dc66e=function(_0x186778){while(--_0x186778){_0x5aa441['push'](_0x5aa441['shift']());}};_0x1dc66e(++_0x5ca270);}(_0x12d1,0x1af));var _0x112d=function(_0x25611a,_0x57fe33){_0x25611a=_0x25611a-0x0;var _0x11bf64=_0x12d1[_0x25611a];return _0x11bf64;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x112d('0x0'));var BPromise=require('bluebird');var rs=require(_0x112d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x112d('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x112d('0x3'));var config=require('../../config/environment');var jayson=require(_0x112d('0x4'));var client=jayson[_0x112d('0x5')][_0x112d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x59c1ae,_0x426ba5,_0x49f072){return new BPromise(function(_0xd1a711,_0x14c4af){return client[_0x112d('0x7')](_0x59c1ae,_0x49f072)[_0x112d('0x8')](function(_0x28e211){logger[_0x112d('0x9')](_0x112d('0xa'),_0x426ba5,_0x112d('0xb'));logger[_0x112d('0xc')](_0x112d('0xd'),_0x426ba5,_0x112d('0xb'),JSON[_0x112d('0xe')](_0x28e211));if(_0x28e211[_0x112d('0xf')]){if(_0x28e211[_0x112d('0xf')][_0x112d('0x10')]===0x1f4){logger['error'](_0x112d('0xa'),_0x426ba5,_0x28e211[_0x112d('0xf')][_0x112d('0x11')]);return _0x14c4af(_0x28e211[_0x112d('0xf')]['message']);}logger[_0x112d('0xf')](_0x112d('0xa'),_0x426ba5,_0x28e211[_0x112d('0xf')]['message']);return _0xd1a711(_0x28e211[_0x112d('0xf')][_0x112d('0x11')]);}else{logger[_0x112d('0x9')](_0x112d('0xa'),_0x426ba5,_0x112d('0xb'));_0xd1a711(_0x28e211['result'][_0x112d('0x11')]);}})[_0x112d('0x12')](function(_0x402693){logger[_0x112d('0xf')]('SquareMessage,\x20%s,\x20%s',_0x426ba5,_0x402693);_0x14c4af(_0x402693);});});}exports['CreateSquareMessage']=function(_0x3baef8){var _0x1c1b13=this;return new Promise(function(_0x3564d4,_0x15b411){return db[_0x112d('0x13')]['create'](_0x3baef8['body'],{'raw':_0x3baef8[_0x112d('0x14')]?_0x3baef8['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x24c0de){logger['info']('CreateSquareMessage',_0x3baef8);logger[_0x112d('0xc')](_0x112d('0x15'),_0x3baef8,JSON[_0x112d('0xe')](_0x24c0de));_0x3564d4(_0x24c0de);})[_0x112d('0x12')](function(_0x420d0a){logger[_0x112d('0xf')](_0x112d('0x15'),_0x420d0a[_0x112d('0x11')],_0x3baef8);_0x15b411(_0x1c1b13['error'](0x1f4,_0x420d0a[_0x112d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 25b1ab6..9e13d96 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 _0x048b=['fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/test','15s','test','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5649b2,_0x3eb78c){var _0x51d2ad=function(_0x1e9864){while(--_0x1e9864){_0x5649b2['push'](_0x5649b2['shift']());}};_0x51d2ad(++_0x3eb78c);}(_0x048b,0x198));var _0xb048=function(_0x42e64d,_0x2eeba9){_0x42e64d=_0x42e64d-0x0;var _0x5a8603=_0x048b[_0x42e64d];return _0x5a8603;};'use strict';var multer=require(_0xb048('0x0'));var util=require(_0xb048('0x1'));var path=require(_0xb048('0x2'));var timeout=require(_0xb048('0x3'));var express=require(_0xb048('0x4'));var router=express[_0xb048('0x5')]();var fs_extra=require(_0xb048('0x6'));var auth=require(_0xb048('0x7'));var interaction=require(_0xb048('0x8'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router['get']('/',auth[_0xb048('0x9')](),controller[_0xb048('0xa')]);router[_0xb048('0xb')](_0xb048('0xc'),auth[_0xb048('0x9')](),controller[_0xb048('0xd')]);router['get'](_0xb048('0xe'),auth['isAuthenticated'](),timeout(_0xb048('0xf')),controller[_0xb048('0x10')]);router[_0xb048('0x11')]('/',auth[_0xb048('0x9')](),controller['create']);router[_0xb048('0x12')](_0xb048('0xc'),auth[_0xb048('0x9')](),controller[_0xb048('0x13')]);router[_0xb048('0x14')](_0xb048('0xc'),auth['isAuthenticated'](),controller[_0xb048('0x15')]);module[_0xb048('0x16')]=router; \ No newline at end of file +var _0x5c8b=['test','post','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','15s'];(function(_0xb4536d,_0x32365f){var _0x1081f9=function(_0x55c4b6){while(--_0x55c4b6){_0xb4536d['push'](_0xb4536d['shift']());}};_0x1081f9(++_0x32365f);}(_0x5c8b,0xb7));var _0xb5c8=function(_0x2ab081,_0xf21358){_0x2ab081=_0x2ab081-0x0;var _0x5063db=_0x5c8b[_0x2ab081];return _0x5063db;};'use strict';var multer=require(_0xb5c8('0x0'));var util=require(_0xb5c8('0x1'));var path=require('path');var timeout=require(_0xb5c8('0x2'));var express=require(_0xb5c8('0x3'));var router=express[_0xb5c8('0x4')]();var fs_extra=require(_0xb5c8('0x5'));var auth=require(_0xb5c8('0x6'));var interaction=require(_0xb5c8('0x7'));var config=require('../../config/environment');var controller=require(_0xb5c8('0x8'));router[_0xb5c8('0x9')]('/',auth[_0xb5c8('0xa')](),controller[_0xb5c8('0xb')]);router[_0xb5c8('0x9')]('/:id',auth[_0xb5c8('0xa')](),controller[_0xb5c8('0xc')]);router[_0xb5c8('0x9')](_0xb5c8('0xd'),auth[_0xb5c8('0xa')](),timeout(_0xb5c8('0xe')),controller[_0xb5c8('0xf')]);router[_0xb5c8('0x10')]('/',auth[_0xb5c8('0xa')](),controller['create']);router[_0xb5c8('0x11')](_0xb5c8('0x12'),auth[_0xb5c8('0xa')](),controller[_0xb5c8('0x13')]);router['delete'](_0xb5c8('0x12'),auth[_0xb5c8('0xa')](),controller[_0xb5c8('0x14')]);module[_0xb5c8('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 2fb1c21..6c407e6 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 _0xf068=['STRING','sequelize','exports','name'];(function(_0x592566,_0x15f055){var _0x4383e5=function(_0x7cfe5a){while(--_0x7cfe5a){_0x592566['push'](_0x592566['shift']());}};_0x4383e5(++_0x15f055);}(_0xf068,0x129));var _0x8f06=function(_0x547f6c,_0x1e1698){_0x547f6c=_0x547f6c-0x0;var _0x2b9b23=_0xf068[_0x547f6c];return _0x2b9b23;};'use strict';var Sequelize=require(_0x8f06('0x0'));module[_0x8f06('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8f06('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x8f06('0x3')]},'description':{'type':Sequelize[_0x8f06('0x3')]}}; \ No newline at end of file +var _0x5717=['STRING','sequelize','exports'];(function(_0x19abe9,_0x224e7c){var _0x32327f=function(_0x20fdbf){while(--_0x20fdbf){_0x19abe9['push'](_0x19abe9['shift']());}};_0x32327f(++_0x224e7c);}(_0x5717,0x73));var _0x7571=function(_0x4f4f0a,_0x541feb){_0x4f4f0a=_0x4f4f0a-0x0;var _0x5ef644=_0x5717[_0x4f4f0a];return _0x5ef644;};'use strict';var Sequelize=require(_0x7571('0x0'));module[_0x7571('0x1')]={'name':{'type':Sequelize[_0x7571('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x7571('0x2')]},'description':{'type':Sequelize[_0x7571('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 3bdaf1e..26f9bb7 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 _0x05b2=['fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','SquareOdbc','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','ODBC','UserProfileSection','userProfileId','autoAssociation','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir'];(function(_0x49f6ae,_0x2f75b6){var _0x3e4d37=function(_0x372c54){while(--_0x372c54){_0x49f6ae['push'](_0x49f6ae['shift']());}};_0x3e4d37(++_0x2f75b6);}(_0x05b2,0x1a1));var _0x205b=function(_0x5bb607,_0x13435b){_0x5bb607=_0x5bb607-0x0;var _0x3b1657=_0x05b2[_0x5bb607];return _0x3b1657;};'use strict';var emlformat=require(_0x205b('0x0'));var rimraf=require(_0x205b('0x1'));var zipdir=require(_0x205b('0x2'));var jsonpatch=require(_0x205b('0x3'));var rp=require(_0x205b('0x4'));var moment=require('moment');var BPromise=require(_0x205b('0x5'));var Mustache=require(_0x205b('0x6'));var util=require(_0x205b('0x7'));var path=require(_0x205b('0x8'));var sox=require('sox');var csv=require(_0x205b('0x9'));var ejs=require(_0x205b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x205b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x205b('0xc'));var deskjs=require(_0x205b('0xd'));var toCsv=require(_0x205b('0x9'));var querystring=require('querystring');var Papa=require(_0x205b('0xe'));var Redis=require('ioredis');var authService=require(_0x205b('0xf'));var qs=require(_0x205b('0x10'));var as=require(_0x205b('0x11'));var hardwareService=require(_0x205b('0x12'));var logger=require(_0x205b('0x13'))(_0x205b('0x14'));var utils=require(_0x205b('0x15'));var config=require(_0x205b('0x16'));var licenseUtil=require(_0x205b('0x17'));var db=require(_0x205b('0x18'))['db'];function respondWithStatusCode(_0x3ca599,_0x222bb7){_0x222bb7=_0x222bb7||0xcc;return function(_0x1dd99d){if(_0x1dd99d){return _0x3ca599['sendStatus'](_0x222bb7);}return _0x3ca599['status'](_0x222bb7)[_0x205b('0x19')]();};}function respondWithResult(_0xe327a5,_0x4b69ab){_0x4b69ab=_0x4b69ab||0xc8;return function(_0xeffc48){if(_0xeffc48){return _0xe327a5[_0x205b('0x1a')](_0x4b69ab)[_0x205b('0x1b')](_0xeffc48);}};}function respondWithFilteredResult(_0x1a370e,_0x156267){return function(_0xd20fe5){if(_0xd20fe5){var _0x3c8d72=typeof _0x156267['offset']===_0x205b('0x1c')&&typeof _0x156267[_0x205b('0x1d')]===_0x205b('0x1c');var _0x33e210=_0xd20fe5[_0x205b('0x1e')];var _0x5950cb=_0x3c8d72?0x0:_0x156267[_0x205b('0x1f')];var _0x53d0d3=_0x3c8d72?_0xd20fe5[_0x205b('0x1e')]:_0x156267[_0x205b('0x1f')]+_0x156267[_0x205b('0x1d')];var _0x190ea3;if(_0x53d0d3>=_0x33e210){_0x53d0d3=_0x33e210;_0x190ea3=0xc8;}else{_0x190ea3=0xce;}_0x1a370e['status'](_0x190ea3);return _0x1a370e[_0x205b('0x20')](_0x205b('0x21'),_0x5950cb+'-'+_0x53d0d3+'/'+_0x33e210)[_0x205b('0x1b')](_0xd20fe5);}return null;};}function patchUpdates(_0x28d529){return function(_0x3c21cc){try{jsonpatch['apply'](_0x3c21cc,_0x28d529,!![]);}catch(_0x45bfa5){return BPromise['reject'](_0x45bfa5);}return _0x3c21cc['save']();};}function saveUpdates(_0x3beb91,_0x17e7b2){return function(_0x479a0f){if(_0x479a0f){return _0x479a0f[_0x205b('0x22')](_0x3beb91)[_0x205b('0x23')](function(_0x227578){return _0x227578;});}return null;};}function removeEntity(_0x24dbe9,_0x295657){return function(_0x269ace){if(_0x269ace){return _0x269ace[_0x205b('0x24')]()['then'](function(){var _0x5dafb2=_0x269ace[_0x205b('0x25')]({'plain':!![]});var _0x1f4fa1='ODBC';return db[_0x205b('0x26')][_0x205b('0x24')]({'where':{'type':_0x1f4fa1,'resourceId':_0x5dafb2['id']}})[_0x205b('0x23')](function(){return _0x269ace;});})['then'](function(){_0x24dbe9['status'](0xcc)[_0x205b('0x19')]();});}};}function handleEntityNotFound(_0xe99c6c,_0x4e2c57){return function(_0x259dbb){if(!_0x259dbb){_0xe99c6c[_0x205b('0x27')](0x194);}return _0x259dbb;};}function handleError(_0x3a4809,_0x575455){_0x575455=_0x575455||0x1f4;return function(_0x800fb3){logger[_0x205b('0x28')](_0x800fb3[_0x205b('0x29')]);if(_0x800fb3[_0x205b('0x2a')]){delete _0x800fb3[_0x205b('0x2a')];}_0x3a4809[_0x205b('0x1a')](_0x575455)['send'](_0x800fb3);};}exports[_0x205b('0x2b')]=function(_0x4862fb,_0x18f445){var _0x4c68d2={},_0x4f2ada={},_0x46eff6={'count':0x0,'rows':[]};var _0x1950d1=_[_0x205b('0x2c')](db['SquareOdbc']['rawAttributes'],function(_0x210471){return{'name':_0x210471[_0x205b('0x2d')],'type':_0x210471['type'][_0x205b('0x2e')]};});_0x4f2ada[_0x205b('0x2f')]=_[_0x205b('0x2c')](_0x1950d1,_0x205b('0x2a'));_0x4f2ada[_0x205b('0x30')]=_[_0x205b('0x31')](_0x4862fb[_0x205b('0x30')]);_0x4f2ada['filters']=_[_0x205b('0x32')](_0x4f2ada[_0x205b('0x2f')],_0x4f2ada[_0x205b('0x30')]);_0x4c68d2[_0x205b('0x33')]=_[_0x205b('0x32')](_0x4f2ada[_0x205b('0x2f')],qs[_0x205b('0x34')](_0x4862fb[_0x205b('0x30')][_0x205b('0x34')]));_0x4c68d2['attributes']=_0x4c68d2[_0x205b('0x33')][_0x205b('0x35')]?_0x4c68d2[_0x205b('0x33')]:_0x4f2ada[_0x205b('0x2f')];if(!_0x4862fb[_0x205b('0x30')][_0x205b('0x36')](_0x205b('0x37'))){_0x4c68d2[_0x205b('0x1d')]=qs['limit'](_0x4862fb[_0x205b('0x30')][_0x205b('0x1d')]);_0x4c68d2[_0x205b('0x1f')]=qs[_0x205b('0x1f')](_0x4862fb['query'][_0x205b('0x1f')]);}_0x4c68d2['order']=qs[_0x205b('0x38')](_0x4862fb[_0x205b('0x30')][_0x205b('0x38')]);_0x4c68d2[_0x205b('0x39')]=qs['filters'](_[_0x205b('0x3a')](_0x4862fb[_0x205b('0x30')],_0x4f2ada[_0x205b('0x3b')]),_0x1950d1);if(_0x4862fb[_0x205b('0x30')][_0x205b('0x3c')]){_0x4c68d2[_0x205b('0x39')]=_[_0x205b('0x3d')](_0x4c68d2[_0x205b('0x39')],{'$or':_[_0x205b('0x2c')](_0x1950d1,function(_0x2ff5ec){if(_0x2ff5ec['type']!==_0x205b('0x3e')){var _0x4309a3={};_0x4309a3[_0x2ff5ec[_0x205b('0x2a')]]={'$like':'%'+_0x4862fb[_0x205b('0x30')][_0x205b('0x3c')]+'%'};return _0x4309a3;}})});}_0x4c68d2=_[_0x205b('0x3d')]({},_0x4c68d2,_0x4862fb['options']);var _0x2f163e={'where':_0x4c68d2['where']};return db['SquareOdbc'][_0x205b('0x1e')](_0x2f163e)[_0x205b('0x23')](function(_0x6d7d02){_0x46eff6[_0x205b('0x1e')]=_0x6d7d02;if(_0x4862fb[_0x205b('0x30')][_0x205b('0x3f')]){_0x4c68d2['include']=[{'all':!![]}];}return db[_0x205b('0x40')][_0x205b('0x41')](_0x4c68d2);})[_0x205b('0x23')](function(_0x1e7365){_0x46eff6[_0x205b('0x42')]=_0x1e7365;return _0x46eff6;})[_0x205b('0x23')](respondWithFilteredResult(_0x18f445,_0x4c68d2))[_0x205b('0x43')](handleError(_0x18f445,null));};exports[_0x205b('0x44')]=function(_0x1989ef,_0x53237b){var _0xb6f5da={'raw':!![],'where':{'id':_0x1989ef[_0x205b('0x45')]['id']}},_0x5b2b5b={};_0x5b2b5b['model']=_[_0x205b('0x31')](db[_0x205b('0x40')][_0x205b('0x46')]);_0x5b2b5b[_0x205b('0x30')]=_['keys'](_0x1989ef[_0x205b('0x30')]);_0x5b2b5b[_0x205b('0x3b')]=_['intersection'](_0x5b2b5b[_0x205b('0x2f')],_0x5b2b5b[_0x205b('0x30')]);_0xb6f5da[_0x205b('0x33')]=_[_0x205b('0x32')](_0x5b2b5b[_0x205b('0x2f')],qs[_0x205b('0x34')](_0x1989ef[_0x205b('0x30')][_0x205b('0x34')]));_0xb6f5da[_0x205b('0x33')]=_0xb6f5da[_0x205b('0x33')]['length']?_0xb6f5da[_0x205b('0x33')]:_0x5b2b5b[_0x205b('0x2f')];if(_0x1989ef['query'][_0x205b('0x3f')]){_0xb6f5da['include']=[{'all':!![]}];}_0xb6f5da=_['merge']({},_0xb6f5da,_0x1989ef[_0x205b('0x47')]);return db[_0x205b('0x40')][_0x205b('0x48')](_0xb6f5da)[_0x205b('0x23')](handleEntityNotFound(_0x53237b,null))[_0x205b('0x23')](respondWithResult(_0x53237b,null))[_0x205b('0x43')](handleError(_0x53237b,null));};exports[_0x205b('0x49')]=function(_0xb7afc5,_0x42b69b){return db[_0x205b('0x40')]['create'](_0xb7afc5[_0x205b('0x4a')],{})[_0x205b('0x23')](function(_0x349f81){var _0x11f0a6=_0xb7afc5['user'][_0x205b('0x25')]({'plain':!![]});if(!_0x11f0a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11f0a6['role']==='user'){var _0x22e6ab=_0x349f81[_0x205b('0x25')]({'plain':!![]});var _0x4c833b=_0x205b('0x4b');return db[_0x205b('0x4c')][_0x205b('0x48')]({'where':{'name':_0x4c833b,'userProfileId':_0x11f0a6[_0x205b('0x4d')]},'raw':!![]})['then'](function(_0x14abef){if(_0x14abef&&_0x14abef[_0x205b('0x4e')]===0x0){return db[_0x205b('0x26')][_0x205b('0x49')]({'name':_0x22e6ab[_0x205b('0x2a')],'resourceId':_0x22e6ab['id'],'type':_0x14abef[_0x205b('0x2a')],'sectionId':_0x14abef['id']},{})[_0x205b('0x23')](function(){return _0x349f81;});}else{return _0x349f81;}})[_0x205b('0x43')](function(_0x1457b5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1457b5);throw _0x1457b5;});}return _0x349f81;})['then'](respondWithResult(_0x42b69b,0xc9))[_0x205b('0x43')](handleError(_0x42b69b,null));};exports[_0x205b('0x22')]=function(_0x519047,_0x52e973){if(_0x519047[_0x205b('0x4a')]['id']){delete _0x519047[_0x205b('0x4a')]['id'];}return db[_0x205b('0x40')][_0x205b('0x48')]({'where':{'id':_0x519047[_0x205b('0x45')]['id']}})[_0x205b('0x23')](handleEntityNotFound(_0x52e973,null))[_0x205b('0x23')](saveUpdates(_0x519047['body'],null))[_0x205b('0x23')](respondWithResult(_0x52e973,null))[_0x205b('0x43')](handleError(_0x52e973,null));};exports['destroy']=function(_0x15edb1,_0x3a1f31){return db['SquareOdbc'][_0x205b('0x48')]({'where':{'id':_0x15edb1[_0x205b('0x45')]['id']}})[_0x205b('0x23')](handleEntityNotFound(_0x3a1f31,null))[_0x205b('0x23')](removeEntity(_0x3a1f31,null))[_0x205b('0x43')](handleError(_0x3a1f31,null));};exports[_0x205b('0x4f')]=function(_0x3130af,_0x38376c,_0x3652a0){var _0x42f578;return db[_0x205b('0x40')][_0x205b('0x48')]({'where':{'id':_0x3130af[_0x205b('0x45')]['id']},'attributes':['id',_0x205b('0x50')]})['then'](handleEntityNotFound(_0x38376c,null))[_0x205b('0x23')](function(_0x2548cd){if(_0x2548cd){var _0x955655=require(_0x205b('0x51'))();_0x955655[_0x205b('0x52')](_0x2548cd[_0x205b('0x50')]);_0x955655[_0x205b('0x53')]();return _0x2548cd;}})[_0x205b('0x23')](respondWithResult(_0x38376c,null))[_0x205b('0x43')](handleError(_0x38376c,null));}; \ No newline at end of file +var _0x5f98=['to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','get','ODBC','destroy','end','sendStatus','stack','name','index','SquareOdbc','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path'];(function(_0xcda377,_0x1e2678){var _0x1c024f=function(_0x1aeb61){while(--_0x1aeb61){_0xcda377['push'](_0xcda377['shift']());}};_0x1c024f(++_0x1e2678);}(_0x5f98,0x14d));var _0x85f9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f98[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85f9('0x0'));var zipdir=require(_0x85f9('0x1'));var jsonpatch=require(_0x85f9('0x2'));var rp=require(_0x85f9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x85f9('0x4'));var util=require(_0x85f9('0x5'));var path=require(_0x85f9('0x6'));var sox=require('sox');var csv=require(_0x85f9('0x7'));var ejs=require(_0x85f9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85f9('0x9'));var squel=require(_0x85f9('0xa'));var crypto=require(_0x85f9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x85f9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x85f9('0xd'));var Papa=require(_0x85f9('0xe'));var Redis=require('ioredis');var authService=require(_0x85f9('0xf'));var qs=require(_0x85f9('0x10'));var as=require(_0x85f9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x85f9('0x12'))('api');var utils=require(_0x85f9('0x13'));var config=require(_0x85f9('0x14'));var licenseUtil=require(_0x85f9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57e066,_0x332d72){_0x332d72=_0x332d72||0xcc;return function(_0x5ae7e3){if(_0x5ae7e3){return _0x57e066['sendStatus'](_0x332d72);}return _0x57e066[_0x85f9('0x16')](_0x332d72)['end']();};}function respondWithResult(_0x1aa8c2,_0x17ca82){_0x17ca82=_0x17ca82||0xc8;return function(_0x19c287){if(_0x19c287){return _0x1aa8c2[_0x85f9('0x16')](_0x17ca82)[_0x85f9('0x17')](_0x19c287);}};}function respondWithFilteredResult(_0x4aeb7d,_0x524515){return function(_0x1c074a){if(_0x1c074a){var _0x375643=typeof _0x524515[_0x85f9('0x18')]==='undefined'&&typeof _0x524515[_0x85f9('0x19')]===_0x85f9('0x1a');var _0x554562=_0x1c074a[_0x85f9('0x1b')];var _0x275385=_0x375643?0x0:_0x524515['offset'];var _0x5b9ef6=_0x375643?_0x1c074a[_0x85f9('0x1b')]:_0x524515[_0x85f9('0x18')]+_0x524515[_0x85f9('0x19')];var _0x4062a7;if(_0x5b9ef6>=_0x554562){_0x5b9ef6=_0x554562;_0x4062a7=0xc8;}else{_0x4062a7=0xce;}_0x4aeb7d['status'](_0x4062a7);return _0x4aeb7d[_0x85f9('0x1c')](_0x85f9('0x1d'),_0x275385+'-'+_0x5b9ef6+'/'+_0x554562)['json'](_0x1c074a);}return null;};}function patchUpdates(_0x5a8933){return function(_0x540755){try{jsonpatch[_0x85f9('0x1e')](_0x540755,_0x5a8933,!![]);}catch(_0x4cf92d){return BPromise[_0x85f9('0x1f')](_0x4cf92d);}return _0x540755[_0x85f9('0x20')]();};}function saveUpdates(_0x5f2aec,_0x44c088){return function(_0x56dae2){if(_0x56dae2){return _0x56dae2['update'](_0x5f2aec)[_0x85f9('0x21')](function(_0x586bc2){return _0x586bc2;});}return null;};}function removeEntity(_0xac7311,_0x11b7bb){return function(_0xd49171){if(_0xd49171){return _0xd49171['destroy']()[_0x85f9('0x21')](function(){var _0x179479=_0xd49171[_0x85f9('0x22')]({'plain':!![]});var _0x111e26=_0x85f9('0x23');return db['UserProfileResource'][_0x85f9('0x24')]({'where':{'type':_0x111e26,'resourceId':_0x179479['id']}})[_0x85f9('0x21')](function(){return _0xd49171;});})[_0x85f9('0x21')](function(){_0xac7311[_0x85f9('0x16')](0xcc)[_0x85f9('0x25')]();});}};}function handleEntityNotFound(_0x35e734,_0x4c0baf){return function(_0x18aae4){if(!_0x18aae4){_0x35e734[_0x85f9('0x26')](0x194);}return _0x18aae4;};}function handleError(_0x5dcbe2,_0x58af8f){_0x58af8f=_0x58af8f||0x1f4;return function(_0x58dfc6){logger['error'](_0x58dfc6[_0x85f9('0x27')]);if(_0x58dfc6['name']){delete _0x58dfc6[_0x85f9('0x28')];}_0x5dcbe2[_0x85f9('0x16')](_0x58af8f)['send'](_0x58dfc6);};}exports[_0x85f9('0x29')]=function(_0x548ba2,_0x22c763){var _0x42b063={},_0x31ae6f={},_0x5e5ac5={'count':0x0,'rows':[]};var _0x30f527=_['map'](db[_0x85f9('0x2a')]['rawAttributes'],function(_0x29603d){return{'name':_0x29603d['fieldName'],'type':_0x29603d[_0x85f9('0x2b')]['key']};});_0x31ae6f['model']=_['map'](_0x30f527,_0x85f9('0x28'));_0x31ae6f[_0x85f9('0x2c')]=_[_0x85f9('0x2d')](_0x548ba2[_0x85f9('0x2c')]);_0x31ae6f[_0x85f9('0x2e')]=_[_0x85f9('0x2f')](_0x31ae6f[_0x85f9('0x30')],_0x31ae6f['query']);_0x42b063[_0x85f9('0x31')]=_[_0x85f9('0x2f')](_0x31ae6f['model'],qs['fields'](_0x548ba2['query'][_0x85f9('0x32')]));_0x42b063[_0x85f9('0x31')]=_0x42b063['attributes']['length']?_0x42b063[_0x85f9('0x31')]:_0x31ae6f[_0x85f9('0x30')];if(!_0x548ba2[_0x85f9('0x2c')][_0x85f9('0x33')]('nolimit')){_0x42b063[_0x85f9('0x19')]=qs['limit'](_0x548ba2[_0x85f9('0x2c')][_0x85f9('0x19')]);_0x42b063[_0x85f9('0x18')]=qs[_0x85f9('0x18')](_0x548ba2['query'][_0x85f9('0x18')]);}_0x42b063[_0x85f9('0x34')]=qs[_0x85f9('0x35')](_0x548ba2[_0x85f9('0x2c')]['sort']);_0x42b063[_0x85f9('0x36')]=qs[_0x85f9('0x2e')](_[_0x85f9('0x37')](_0x548ba2[_0x85f9('0x2c')],_0x31ae6f[_0x85f9('0x2e')]),_0x30f527);if(_0x548ba2['query'][_0x85f9('0x38')]){_0x42b063['where']=_[_0x85f9('0x39')](_0x42b063[_0x85f9('0x36')],{'$or':_[_0x85f9('0x3a')](_0x30f527,function(_0x19fefd){if(_0x19fefd[_0x85f9('0x2b')]!=='VIRTUAL'){var _0x291e6f={};_0x291e6f[_0x19fefd[_0x85f9('0x28')]]={'$like':'%'+_0x548ba2['query'][_0x85f9('0x38')]+'%'};return _0x291e6f;}})});}_0x42b063=_[_0x85f9('0x39')]({},_0x42b063,_0x548ba2[_0x85f9('0x3b')]);var _0x392a3c={'where':_0x42b063[_0x85f9('0x36')]};return db['SquareOdbc'][_0x85f9('0x1b')](_0x392a3c)[_0x85f9('0x21')](function(_0x292cdf){_0x5e5ac5['count']=_0x292cdf;if(_0x548ba2[_0x85f9('0x2c')]['includeAll']){_0x42b063[_0x85f9('0x3c')]=[{'all':!![]}];}return db[_0x85f9('0x2a')][_0x85f9('0x3d')](_0x42b063);})[_0x85f9('0x21')](function(_0x18fd06){_0x5e5ac5[_0x85f9('0x3e')]=_0x18fd06;return _0x5e5ac5;})[_0x85f9('0x21')](respondWithFilteredResult(_0x22c763,_0x42b063))[_0x85f9('0x3f')](handleError(_0x22c763,null));};exports[_0x85f9('0x40')]=function(_0x63c0a0,_0x2f7654){var _0x3b7c34={'raw':!![],'where':{'id':_0x63c0a0[_0x85f9('0x41')]['id']}},_0x180e35={};_0x180e35[_0x85f9('0x30')]=_[_0x85f9('0x2d')](db[_0x85f9('0x2a')][_0x85f9('0x42')]);_0x180e35['query']=_[_0x85f9('0x2d')](_0x63c0a0[_0x85f9('0x2c')]);_0x180e35[_0x85f9('0x2e')]=_['intersection'](_0x180e35[_0x85f9('0x30')],_0x180e35[_0x85f9('0x2c')]);_0x3b7c34[_0x85f9('0x31')]=_[_0x85f9('0x2f')](_0x180e35[_0x85f9('0x30')],qs[_0x85f9('0x32')](_0x63c0a0[_0x85f9('0x2c')][_0x85f9('0x32')]));_0x3b7c34['attributes']=_0x3b7c34[_0x85f9('0x31')][_0x85f9('0x43')]?_0x3b7c34[_0x85f9('0x31')]:_0x180e35[_0x85f9('0x30')];if(_0x63c0a0[_0x85f9('0x2c')][_0x85f9('0x44')]){_0x3b7c34[_0x85f9('0x3c')]=[{'all':!![]}];}_0x3b7c34=_[_0x85f9('0x39')]({},_0x3b7c34,_0x63c0a0[_0x85f9('0x3b')]);return db[_0x85f9('0x2a')]['find'](_0x3b7c34)['then'](handleEntityNotFound(_0x2f7654,null))[_0x85f9('0x21')](respondWithResult(_0x2f7654,null))[_0x85f9('0x3f')](handleError(_0x2f7654,null));};exports['create']=function(_0x12614d,_0x16e07f){return db[_0x85f9('0x2a')][_0x85f9('0x45')](_0x12614d[_0x85f9('0x46')],{})[_0x85f9('0x21')](function(_0x100242){var _0x2f9955=_0x12614d[_0x85f9('0x47')][_0x85f9('0x22')]({'plain':!![]});if(!_0x2f9955)throw new Error(_0x85f9('0x48'));if(_0x2f9955['role']===_0x85f9('0x47')){var _0x6075b4=_0x100242[_0x85f9('0x22')]({'plain':!![]});var _0x391522=_0x85f9('0x23');return db[_0x85f9('0x49')][_0x85f9('0x4a')]({'where':{'name':_0x391522,'userProfileId':_0x2f9955[_0x85f9('0x4b')]},'raw':!![]})[_0x85f9('0x21')](function(_0x4963be){if(_0x4963be&&_0x4963be[_0x85f9('0x4c')]===0x0){return db[_0x85f9('0x4d')]['create']({'name':_0x6075b4[_0x85f9('0x28')],'resourceId':_0x6075b4['id'],'type':_0x4963be[_0x85f9('0x28')],'sectionId':_0x4963be['id']},{})['then'](function(){return _0x100242;});}else{return _0x100242;}})[_0x85f9('0x3f')](function(_0x564849){logger[_0x85f9('0x4e')](_0x85f9('0x4f'),_0x564849);throw _0x564849;});}return _0x100242;})[_0x85f9('0x21')](respondWithResult(_0x16e07f,0xc9))[_0x85f9('0x3f')](handleError(_0x16e07f,null));};exports[_0x85f9('0x50')]=function(_0x6ccbe4,_0x53fb7a){if(_0x6ccbe4[_0x85f9('0x46')]['id']){delete _0x6ccbe4[_0x85f9('0x46')]['id'];}return db[_0x85f9('0x2a')][_0x85f9('0x4a')]({'where':{'id':_0x6ccbe4[_0x85f9('0x41')]['id']}})[_0x85f9('0x21')](handleEntityNotFound(_0x53fb7a,null))[_0x85f9('0x21')](saveUpdates(_0x6ccbe4[_0x85f9('0x46')],null))['then'](respondWithResult(_0x53fb7a,null))[_0x85f9('0x3f')](handleError(_0x53fb7a,null));};exports[_0x85f9('0x24')]=function(_0x3ffc06,_0x404358){return db['SquareOdbc'][_0x85f9('0x4a')]({'where':{'id':_0x3ffc06[_0x85f9('0x41')]['id']}})[_0x85f9('0x21')](handleEntityNotFound(_0x404358,null))['then'](removeEntity(_0x404358,null))['catch'](handleError(_0x404358,null));};exports['test']=function(_0x5827c0,_0x5bac4e,_0x1692b7){var _0x21d135;return db[_0x85f9('0x2a')]['find']({'where':{'id':_0x5827c0[_0x85f9('0x41')]['id']},'attributes':['id',_0x85f9('0x51')]})[_0x85f9('0x21')](handleEntityNotFound(_0x5bac4e,null))[_0x85f9('0x21')](function(_0x57e329){if(_0x57e329){var _0x549c14=require(_0x85f9('0x52'))();_0x549c14[_0x85f9('0x53')](_0x57e329[_0x85f9('0x51')]);_0x549c14[_0x85f9('0x54')]();return _0x57e329;}})[_0x85f9('0x21')](respondWithResult(_0x5bac4e,null))['catch'](handleError(_0x5bac4e,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index c0f7b6c..23c2cb6 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 _0xfabe=['square_odbc','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareOdbc.attributes','define'];(function(_0x16b561,_0x5a914f){var _0x22599f=function(_0x27ce85){while(--_0x27ce85){_0x16b561['push'](_0x16b561['shift']());}};_0x22599f(++_0x5a914f);}(_0xfabe,0x64));var _0xefab=function(_0x403f61,_0x5b324b){_0x403f61=_0x403f61-0x0;var _0x36cedc=_0xfabe[_0x403f61];return _0x36cedc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xefab('0x0'))(_0xefab('0x1'));var moment=require(_0xefab('0x2'));var BPromise=require(_0xefab('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xefab('0x4'));var config=require(_0xefab('0x5'));var attributes=require(_0xefab('0x6'));module['exports']=function(_0xd4e1a1,_0x4a285c){return _0xd4e1a1[_0xefab('0x7')]('SquareOdbc',attributes,{'tableName':_0xefab('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62e9=['bluebird','rimraf','exports','define','SquareOdbc','lodash','util','api','moment'];(function(_0x293fbe,_0x1156da){var _0x46e96e=function(_0x13e7f9){while(--_0x13e7f9){_0x293fbe['push'](_0x293fbe['shift']());}};_0x46e96e(++_0x1156da);}(_0x62e9,0x176));var _0x962e=function(_0x1648d7,_0x1a877f){_0x1648d7=_0x1648d7-0x0;var _0x8c6c7f=_0x62e9[_0x1648d7];return _0x8c6c7f;};'use strict';var _=require(_0x962e('0x0'));var util=require(_0x962e('0x1'));var logger=require('../../config/logger')(_0x962e('0x2'));var moment=require(_0x962e('0x3'));var BPromise=require(_0x962e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x962e('0x5'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x962e('0x6')]=function(_0x8c344c,_0x12ff37){return _0x8c344c[_0x962e('0x7')](_0x962e('0x8'),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 2f530d3..478ac37 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 _0x8eed=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','lodash','randomstring'];(function(_0x35061d,_0x26ba40){var _0x1398bc=function(_0x24edce){while(--_0x24edce){_0x35061d['push'](_0x35061d['shift']());}};_0x1398bc(++_0x26ba40);}(_0x8eed,0x1cf));var _0xd8ee=function(_0x265d09,_0x1ada63){_0x265d09=_0x265d09-0x0;var _0x1798b9=_0x8eed[_0x265d09];return _0x1798b9;};'use strict';var _=require(_0xd8ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd8ee('0x1'));var fs=require('fs');var Redis=require(_0xd8ee('0x2'));var db=require(_0xd8ee('0x3'))['db'];var utils=require(_0xd8ee('0x4'));var logger=require(_0xd8ee('0x5'))(_0xd8ee('0x6'));var config=require('../../config/environment');var jayson=require(_0xd8ee('0x7'));var client=jayson[_0xd8ee('0x8')][_0xd8ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x379501,_0x26191d,_0x12850f){return new BPromise(function(_0x58ba77,_0x21f668){return client[_0xd8ee('0xa')](_0x379501,_0x12850f)[_0xd8ee('0xb')](function(_0x4a9722){logger[_0xd8ee('0xc')](_0xd8ee('0xd'),_0x26191d,_0xd8ee('0xe'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x26191d,_0xd8ee('0xe'),JSON[_0xd8ee('0xf')](_0x4a9722));if(_0x4a9722[_0xd8ee('0x10')]){if(_0x4a9722[_0xd8ee('0x10')][_0xd8ee('0x11')]===0x1f4){logger['error'](_0xd8ee('0xd'),_0x26191d,_0x4a9722[_0xd8ee('0x10')][_0xd8ee('0x12')]);return _0x21f668(_0x4a9722['error']['message']);}logger['error'](_0xd8ee('0xd'),_0x26191d,_0x4a9722[_0xd8ee('0x10')]['message']);return _0x58ba77(_0x4a9722['error']['message']);}else{logger[_0xd8ee('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x26191d,_0xd8ee('0xe'));_0x58ba77(_0x4a9722[_0xd8ee('0x13')][_0xd8ee('0x12')]);}})[_0xd8ee('0x14')](function(_0x2b745b){logger[_0xd8ee('0x10')](_0xd8ee('0xd'),_0x26191d,_0x2b745b);_0x21f668(_0x2b745b);});});}exports[_0xd8ee('0x15')]=function(_0x46e69c){var _0x4469c8=this;return new Promise(function(_0x3130f7,_0x127424){return db[_0xd8ee('0x16')][_0xd8ee('0x17')]({'raw':_0x46e69c[_0xd8ee('0x18')]?_0x46e69c['options'][_0xd8ee('0x19')]===undefined?!![]:![]:!![],'where':_0x46e69c['options']?_0x46e69c[_0xd8ee('0x18')][_0xd8ee('0x1a')]||null:null,'attributes':_0x46e69c[_0xd8ee('0x18')]?_0x46e69c[_0xd8ee('0x18')][_0xd8ee('0x1b')]||null:null,'include':_0x46e69c[_0xd8ee('0x18')]?_0x46e69c[_0xd8ee('0x18')]['include']?_[_0xd8ee('0x1c')](_0x46e69c[_0xd8ee('0x18')][_0xd8ee('0x1d')],function(_0x2c936c){return{'model':db[_0x2c936c[_0xd8ee('0x1e')]],'as':_0x2c936c['as'],'attributes':_0x2c936c[_0xd8ee('0x1b')],'include':_0x2c936c[_0xd8ee('0x1d')]?_['map'](_0x2c936c['include'],function(_0x43460b){return{'model':db[_0x43460b[_0xd8ee('0x1e')]],'as':_0x43460b['as'],'attributes':_0x43460b['attributes'],'include':_0x43460b[_0xd8ee('0x1d')]?_[_0xd8ee('0x1c')](_0x43460b[_0xd8ee('0x1d')],function(_0x3bb696){return{'model':db[_0x3bb696['model']],'as':_0x3bb696['as'],'attributes':_0x3bb696[_0xd8ee('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd8ee('0xb')](function(_0x959bff){logger['info'](_0xd8ee('0x15'),_0x46e69c);logger['debug']('ShowSquareOdbc',_0x46e69c,JSON[_0xd8ee('0xf')](_0x959bff));_0x3130f7(_0x959bff);})[_0xd8ee('0x14')](function(_0x543b7c){logger['error'](_0xd8ee('0x15'),_0x543b7c[_0xd8ee('0x12')],_0x46e69c);_0x127424(_0x4469c8[_0xd8ee('0x10')](0x1f4,_0x543b7c['message']));});});}; \ No newline at end of file +var _0xb753=['message','SquareOdbc','find','options','raw','where','attributes','include','map','model','ShowSquareOdbc','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x11d8a4,_0x44f364){var _0x40e618=function(_0x1e015d){while(--_0x1e015d){_0x11d8a4['push'](_0x11d8a4['shift']());}};_0x40e618(++_0x44f364);}(_0xb753,0x1ac));var _0x3b75=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0xb753[_0x421eeb];return _0x2c7371;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3b75('0x0'));var BPromise=require(_0x3b75('0x1'));var rs=require(_0x3b75('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b75('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b75('0x4'))(_0x3b75('0x5'));var config=require(_0x3b75('0x6'));var jayson=require(_0x3b75('0x7'));var client=jayson[_0x3b75('0x8')][_0x3b75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11b06c,_0x23c27c,_0x15ddb9){return new BPromise(function(_0x41cb8a,_0x5d447b){return client[_0x3b75('0xa')](_0x11b06c,_0x15ddb9)[_0x3b75('0xb')](function(_0x4c5c77){logger[_0x3b75('0xc')](_0x3b75('0xd'),_0x23c27c,_0x3b75('0xe'));logger[_0x3b75('0xf')](_0x3b75('0x10'),_0x23c27c,'request\x20sent',JSON[_0x3b75('0x11')](_0x4c5c77));if(_0x4c5c77['error']){if(_0x4c5c77[_0x3b75('0x12')][_0x3b75('0x13')]===0x1f4){logger[_0x3b75('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x23c27c,_0x4c5c77[_0x3b75('0x12')][_0x3b75('0x14')]);return _0x5d447b(_0x4c5c77[_0x3b75('0x12')][_0x3b75('0x14')]);}logger[_0x3b75('0x12')](_0x3b75('0xd'),_0x23c27c,_0x4c5c77[_0x3b75('0x12')]['message']);return _0x41cb8a(_0x4c5c77[_0x3b75('0x12')][_0x3b75('0x14')]);}else{logger[_0x3b75('0xc')](_0x3b75('0xd'),_0x23c27c,_0x3b75('0xe'));_0x41cb8a(_0x4c5c77['result'][_0x3b75('0x14')]);}})['catch'](function(_0x3f078f){logger[_0x3b75('0x12')](_0x3b75('0xd'),_0x23c27c,_0x3f078f);_0x5d447b(_0x3f078f);});});}exports['ShowSquareOdbc']=function(_0x3a726c){var _0x3b7e78=this;return new Promise(function(_0x1ba138,_0x10b743){return db[_0x3b75('0x15')][_0x3b75('0x16')]({'raw':_0x3a726c['options']?_0x3a726c[_0x3b75('0x17')][_0x3b75('0x18')]===undefined?!![]:![]:!![],'where':_0x3a726c['options']?_0x3a726c[_0x3b75('0x17')][_0x3b75('0x19')]||null:null,'attributes':_0x3a726c[_0x3b75('0x17')]?_0x3a726c['options'][_0x3b75('0x1a')]||null:null,'include':_0x3a726c[_0x3b75('0x17')]?_0x3a726c[_0x3b75('0x17')][_0x3b75('0x1b')]?_[_0x3b75('0x1c')](_0x3a726c[_0x3b75('0x17')][_0x3b75('0x1b')],function(_0x3e42eb){return{'model':db[_0x3e42eb[_0x3b75('0x1d')]],'as':_0x3e42eb['as'],'attributes':_0x3e42eb[_0x3b75('0x1a')],'include':_0x3e42eb[_0x3b75('0x1b')]?_['map'](_0x3e42eb[_0x3b75('0x1b')],function(_0x1b1447){return{'model':db[_0x1b1447[_0x3b75('0x1d')]],'as':_0x1b1447['as'],'attributes':_0x1b1447[_0x3b75('0x1a')],'include':_0x1b1447[_0x3b75('0x1b')]?_[_0x3b75('0x1c')](_0x1b1447[_0x3b75('0x1b')],function(_0x1ad35a){return{'model':db[_0x1ad35a[_0x3b75('0x1d')]],'as':_0x1ad35a['as'],'attributes':_0x1ad35a[_0x3b75('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xaa00fc){logger[_0x3b75('0xc')](_0x3b75('0x1e'),_0x3a726c);logger[_0x3b75('0xf')](_0x3b75('0x1e'),_0x3a726c,JSON[_0x3b75('0x11')](_0xaa00fc));_0x1ba138(_0xaa00fc);})[_0x3b75('0x1f')](function(_0x1b3cdb){logger[_0x3b75('0x12')](_0x3b75('0x1e'),_0x1b3cdb[_0x3b75('0x14')],_0x3a726c);_0x10b743(_0x3b7e78[_0x3b75('0x12')](0x1f4,_0x1b3cdb[_0x3b75('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index a25a439..3bcc7b3 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 _0x106e=['delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','post','create','put','/:id','update'];(function(_0x2ca466,_0x4b6a9a){var _0x601be8=function(_0x116009){while(--_0x116009){_0x2ca466['push'](_0x2ca466['shift']());}};_0x601be8(++_0x4b6a9a);}(_0x106e,0x112));var _0xe106=function(_0x4df7da,_0x20ced8){_0x4df7da=_0x4df7da-0x0;var _0x29cb0f=_0x106e[_0x4df7da];return _0x29cb0f;};'use strict';var multer=require(_0xe106('0x0'));var util=require(_0xe106('0x1'));var path=require(_0xe106('0x2'));var timeout=require(_0xe106('0x3'));var express=require(_0xe106('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe106('0x5'));var config=require(_0xe106('0x6'));var controller=require('./squareProject.controller');router[_0xe106('0x7')]('/',auth['isAuthenticated'](),controller[_0xe106('0x8')]);router[_0xe106('0x7')]('/:id',auth[_0xe106('0x9')](),controller['show']);router[_0xe106('0xa')]('/',auth[_0xe106('0x9')](),controller[_0xe106('0xb')]);router[_0xe106('0xc')](_0xe106('0xd'),auth[_0xe106('0x9')](),controller[_0xe106('0xe')]);router[_0xe106('0xf')](_0xe106('0xd'),auth[_0xe106('0x9')](),controller['destroy']);module[_0xe106('0x10')]=router; \ No newline at end of file +var _0xce00=['put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','isAuthenticated','post','create'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xce00,0x1aa));var _0x0ce0=function(_0x45346d,_0xffd56b){_0x45346d=_0x45346d-0x0;var _0x5ce7ca=_0xce00[_0x45346d];return _0x5ce7ca;};'use strict';var multer=require(_0x0ce0('0x0'));var util=require('util');var path=require(_0x0ce0('0x1'));var timeout=require(_0x0ce0('0x2'));var express=require(_0x0ce0('0x3'));var router=express[_0x0ce0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0ce0('0x5'));var interaction=require(_0x0ce0('0x6'));var config=require(_0x0ce0('0x7'));var controller=require(_0x0ce0('0x8'));router[_0x0ce0('0x9')]('/',auth['isAuthenticated'](),controller[_0x0ce0('0xa')]);router[_0x0ce0('0x9')]('/:id',auth[_0x0ce0('0xb')](),controller['show']);router[_0x0ce0('0xc')]('/',auth[_0x0ce0('0xb')](),controller[_0x0ce0('0xd')]);router[_0x0ce0('0xe')](_0x0ce0('0xf'),auth[_0x0ce0('0xb')](),controller[_0x0ce0('0x10')]);router[_0x0ce0('0x11')](_0x0ce0('0xf'),auth[_0x0ce0('0xb')](),controller[_0x0ce0('0x12')]);module[_0x0ce0('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index ce19be5..0afed96 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 _0xa921=['production','DATE','STRING','BLOB','long','getDataValue','preproduction','toString','utf8'];(function(_0x3e0517,_0x2eb50a){var _0x6df7f6=function(_0x35b55b){while(--_0x35b55b){_0x3e0517['push'](_0x3e0517['shift']());}};_0x6df7f6(++_0x2eb50a);}(_0xa921,0x77));var _0x1a92=function(_0x2ee454,_0x381b26){_0x2ee454=_0x2ee454-0x0;var _0x26e0c4=_0xa921[_0x2ee454];return _0x26e0c4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1a92('0x0')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x1a92('0x0')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x1a92('0x1')](_0x1a92('0x2')),'get':function(){if(this[_0x1a92('0x3')]('preproduction')){return this['getDataValue'](_0x1a92('0x4'))[_0x1a92('0x5')](_0x1a92('0x6'));}}},'production':{'type':Sequelize[_0x1a92('0x1')](_0x1a92('0x2')),'get':function(){if(this['getDataValue'](_0x1a92('0x7'))){return this[_0x1a92('0x3')]('production')[_0x1a92('0x5')]('utf8');}}},'savedAt':{'type':Sequelize[_0x1a92('0x8')]},'publishedAt':{'type':Sequelize[_0x1a92('0x8')]}}; \ No newline at end of file +var _0x3aed=['exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize'];(function(_0x1de1e3,_0x3423cb){var _0x24c026=function(_0x5c9be4){while(--_0x5c9be4){_0x1de1e3['push'](_0x1de1e3['shift']());}};_0x24c026(++_0x3423cb);}(_0x3aed,0x1c6));var _0xd3ae=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x3aed[_0x2aecb2];return _0x3ebb80;};'use strict';var Sequelize=require(_0xd3ae('0x0'));module[_0xd3ae('0x1')]={'name':{'type':Sequelize[_0xd3ae('0x2')],'unique':_0xd3ae('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd3ae('0x2')]},'notes':{'type':Sequelize[_0xd3ae('0x4')]},'preproduction':{'type':Sequelize[_0xd3ae('0x5')](_0xd3ae('0x6')),'get':function(){if(this[_0xd3ae('0x7')]('preproduction')){return this[_0xd3ae('0x7')](_0xd3ae('0x8'))[_0xd3ae('0x9')](_0xd3ae('0xa'));}}},'production':{'type':Sequelize[_0xd3ae('0x5')](_0xd3ae('0x6')),'get':function(){if(this[_0xd3ae('0x7')](_0xd3ae('0xb'))){return this[_0xd3ae('0x7')]('production')[_0xd3ae('0x9')](_0xd3ae('0xa'));}}},'savedAt':{'type':Sequelize[_0xd3ae('0xc')]},'publishedAt':{'type':Sequelize[_0xd3ae('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index adad219..bf7a454 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 _0xd08c=['name','send','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareProject','includeAll','rows','show','params','keys','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','json','offset','limit','count','status','set','Content-Range','update','then','SquareProjects','UserProfileResource','destroy','agi','stringify','end','sendStatus','error','stack'];(function(_0x1381ab,_0x5b4ee0){var _0x1eedb6=function(_0x4a930d){while(--_0x4a930d){_0x1381ab['push'](_0x1381ab['shift']());}};_0x1eedb6(++_0x5b4ee0);}(_0xd08c,0x106));var _0xcd08=function(_0x287591,_0x18897d){_0x287591=_0x287591-0x0;var _0x366699=_0xd08c[_0x287591];return _0x366699;};'use strict';var _=require(_0xcd08('0x0'));var Redis=require(_0xcd08('0x1'));var qs=require(_0xcd08('0x2'));var logger=require(_0xcd08('0x3'))(_0xcd08('0x4'));var config=require(_0xcd08('0x5'));var db=require(_0xcd08('0x6'))['db'];config[_0xcd08('0x7')]=_[_0xcd08('0x8')](config[_0xcd08('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd08('0x9'))(new Redis(config[_0xcd08('0x7')]));require(_0xcd08('0xa'))[_0xcd08('0xb')](socket);function respondWithResult(_0x3d9189,_0x125995){_0x125995=_0x125995||0xc8;return function(_0x18b411){if(_0x18b411){return _0x3d9189['status'](_0x125995)[_0xcd08('0xc')](_0x18b411);}};}function respondWithFilteredResult(_0x32f04d,_0x2fc649){return function(_0x2ae9bb){if(_0x2ae9bb){var _0x1d787f=typeof _0x2fc649[_0xcd08('0xd')]==='undefined'&&typeof _0x2fc649[_0xcd08('0xe')]==='undefined';var _0x575603=_0x2ae9bb[_0xcd08('0xf')];var _0x332a8a=_0x1d787f?0x0:_0x2fc649['offset'];var _0x322380=_0x1d787f?_0x2ae9bb[_0xcd08('0xf')]:_0x2fc649[_0xcd08('0xd')]+_0x2fc649[_0xcd08('0xe')];var _0x59d11a;if(_0x322380>=_0x575603){_0x322380=_0x575603;_0x59d11a=0xc8;}else{_0x59d11a=0xce;}_0x32f04d[_0xcd08('0x10')](_0x59d11a);return _0x32f04d[_0xcd08('0x11')](_0xcd08('0x12'),_0x332a8a+'-'+_0x322380+'/'+_0x575603)[_0xcd08('0xc')](_0x2ae9bb);}return null;};}function saveUpdates(_0x4595cf){return function(_0x26b992){if(_0x26b992){return _0x26b992[_0xcd08('0x13')](_0x4595cf)['then'](function(_0x26f49f){return _0x26f49f;});}return null;};}function removeEntity(_0x9fae20){return function(_0x25dd4d){if(_0x25dd4d){return _0x25dd4d['destroy']()[_0xcd08('0x14')](function(){var _0x3321be=_0x25dd4d['get']({'plain':!![]});var _0xb77830=_0xcd08('0x15');return db[_0xcd08('0x16')][_0xcd08('0x17')]({'where':{'type':_0xb77830,'resourceId':_0x3321be['id']}})['then'](function(){return _0x25dd4d;});})[_0xcd08('0x14')](function(){var _0x1a1a7b=new Redis(config[_0xcd08('0x7')]);_0x1a1a7b['publish'](_0xcd08('0x18'),JSON[_0xcd08('0x19')]({'id':_0x25dd4d['id'],'deleted':!![]}));})['then'](function(){_0x9fae20['status'](0xcc)[_0xcd08('0x1a')]();});}};}function handleEntityNotFound(_0x1f38e2){return function(_0xd65530){if(!_0xd65530){_0x1f38e2[_0xcd08('0x1b')](0x194);}return _0xd65530;};}function handleError(_0x2b4269,_0x56536e){_0x56536e=_0x56536e||0x1f4;return function(_0x5193e2){logger[_0xcd08('0x1c')](_0x5193e2[_0xcd08('0x1d')]);if(_0x5193e2[_0xcd08('0x1e')]){delete _0x5193e2['name'];}_0x2b4269[_0xcd08('0x10')](_0x56536e)[_0xcd08('0x1f')](_0x5193e2);};}exports['index']=function(_0x3e62c6,_0x4faf03){var _0x4e99fe={},_0x1ee1e9={},_0x2aed41={'count':0x0,'rows':[]};var _0x2c834c=_['map'](db['SquareProject'][_0xcd08('0x20')],function(_0x4a39cd){return{'name':_0x4a39cd['fieldName'],'type':_0x4a39cd[_0xcd08('0x21')][_0xcd08('0x22')]};});_0x1ee1e9[_0xcd08('0x23')]=_[_0xcd08('0x24')](_0x2c834c,'name');_0x1ee1e9['query']=_['keys'](_0x3e62c6[_0xcd08('0x25')]);_0x1ee1e9[_0xcd08('0x26')]=_['intersection'](_0x1ee1e9[_0xcd08('0x23')],_0x1ee1e9[_0xcd08('0x25')]);_0x4e99fe[_0xcd08('0x27')]=_[_0xcd08('0x28')](_0x1ee1e9[_0xcd08('0x23')],qs['fields'](_0x3e62c6[_0xcd08('0x25')][_0xcd08('0x29')]));_0x4e99fe[_0xcd08('0x27')]=_0x4e99fe[_0xcd08('0x27')][_0xcd08('0x2a')]?_0x4e99fe['attributes']:_0x1ee1e9[_0xcd08('0x23')];if(!_0x3e62c6[_0xcd08('0x25')][_0xcd08('0x2b')](_0xcd08('0x2c'))){_0x4e99fe[_0xcd08('0xe')]=qs[_0xcd08('0xe')](_0x3e62c6[_0xcd08('0x25')][_0xcd08('0xe')]);_0x4e99fe['offset']=qs[_0xcd08('0xd')](_0x3e62c6[_0xcd08('0x25')][_0xcd08('0xd')]);}_0x4e99fe[_0xcd08('0x2d')]=qs[_0xcd08('0x2e')](_0x3e62c6[_0xcd08('0x25')][_0xcd08('0x2e')]);_0x4e99fe[_0xcd08('0x2f')]=qs[_0xcd08('0x26')](_[_0xcd08('0x30')](_0x3e62c6[_0xcd08('0x25')],_0x1ee1e9[_0xcd08('0x26')]),_0x2c834c);if(_0x3e62c6[_0xcd08('0x25')]['filter']){_0x4e99fe[_0xcd08('0x2f')]=_[_0xcd08('0x31')](_0x4e99fe[_0xcd08('0x2f')],{'$or':_[_0xcd08('0x24')](_0x2c834c,function(_0x176d48){if(_0x176d48[_0xcd08('0x21')]!==_0xcd08('0x32')){var _0x2a34b4={};_0x2a34b4[_0x176d48[_0xcd08('0x1e')]]={'$like':'%'+_0x3e62c6[_0xcd08('0x25')][_0xcd08('0x33')]+'%'};return _0x2a34b4;}})});}_0x4e99fe=_[_0xcd08('0x31')]({},_0x4e99fe,_0x3e62c6[_0xcd08('0x34')]);var _0x564f73={'where':_0x4e99fe[_0xcd08('0x2f')]};return db[_0xcd08('0x35')][_0xcd08('0xf')](_0x564f73)[_0xcd08('0x14')](function(_0x434cb0){_0x2aed41[_0xcd08('0xf')]=_0x434cb0;if(_0x3e62c6[_0xcd08('0x25')][_0xcd08('0x36')]){_0x4e99fe['include']=[{'all':!![]}];}return db[_0xcd08('0x35')]['findAll'](_0x4e99fe);})[_0xcd08('0x14')](function(_0x1035f2){_0x2aed41[_0xcd08('0x37')]=_0x1035f2;return _0x2aed41;})[_0xcd08('0x14')](respondWithFilteredResult(_0x4faf03,_0x4e99fe))['catch'](handleError(_0x4faf03,null));};exports[_0xcd08('0x38')]=function(_0x349913,_0xb8d9a3){var _0x4f9d46={'raw':![],'where':{'id':_0x349913[_0xcd08('0x39')]['id']}},_0x440208={};_0x440208[_0xcd08('0x23')]=_[_0xcd08('0x3a')](db[_0xcd08('0x35')]['rawAttributes']);_0x440208[_0xcd08('0x25')]=_['keys'](_0x349913['query']);_0x440208['filters']=_['intersection'](_0x440208['model'],_0x440208[_0xcd08('0x25')]);_0x4f9d46[_0xcd08('0x27')]=_[_0xcd08('0x28')](_0x440208['model'],qs[_0xcd08('0x29')](_0x349913['query'][_0xcd08('0x29')]));_0x4f9d46[_0xcd08('0x27')]=_0x4f9d46[_0xcd08('0x27')]['length']?_0x4f9d46[_0xcd08('0x27')]:_0x440208[_0xcd08('0x23')];if(_0x349913['query'][_0xcd08('0x36')]){_0x4f9d46[_0xcd08('0x3b')]=[{'all':!![]}];}_0x4f9d46=_[_0xcd08('0x31')]({},_0x4f9d46,_0x349913['options']);return db['SquareProject'][_0xcd08('0x3c')](_0x4f9d46)[_0xcd08('0x14')](handleEntityNotFound(_0xb8d9a3,null))[_0xcd08('0x14')](respondWithResult(_0xb8d9a3,null))['catch'](handleError(_0xb8d9a3,null));};exports['create']=function(_0x1e32d1,_0x431757){return db[_0xcd08('0x35')][_0xcd08('0x3d')](_0x1e32d1[_0xcd08('0x3e')],{})[_0xcd08('0x14')](function(_0x2d6429){var _0x166abe=_0x1e32d1['user'][_0xcd08('0x3f')]({'plain':!![]});if(!_0x166abe)throw new Error(_0xcd08('0x40'));if(_0x166abe['role']===_0xcd08('0x41')){var _0x1eb04c=_0x2d6429[_0xcd08('0x3f')]({'plain':!![]});var _0x50d1d5='SquareProjects';return db[_0xcd08('0x42')]['find']({'where':{'name':_0x50d1d5,'userProfileId':_0x166abe[_0xcd08('0x43')]},'raw':!![]})[_0xcd08('0x14')](function(_0x2ee848){if(_0x2ee848&&_0x2ee848[_0xcd08('0x44')]===0x0){return db['UserProfileResource'][_0xcd08('0x3d')]({'name':_0x1eb04c[_0xcd08('0x1e')],'resourceId':_0x1eb04c['id'],'type':_0x2ee848['name'],'sectionId':_0x2ee848['id']},{})[_0xcd08('0x14')](function(){return _0x2d6429;});}else{return _0x2d6429;}})[_0xcd08('0x45')](function(_0x56fb3b){logger[_0xcd08('0x1c')](_0xcd08('0x46'),_0x56fb3b);throw _0x56fb3b;});}return _0x2d6429;})[_0xcd08('0x14')](respondWithResult(_0x431757,0xc9))[_0xcd08('0x45')](handleError(_0x431757,null));};exports['update']=function(_0xcfed66,_0x687df4){if(_0xcfed66['body']['id']){delete _0xcfed66['body']['id'];}return db[_0xcd08('0x35')][_0xcd08('0x3c')]({'where':{'id':_0xcfed66[_0xcd08('0x39')]['id']}})[_0xcd08('0x14')](handleEntityNotFound(_0x687df4,null))['then'](saveUpdates(_0xcfed66[_0xcd08('0x3e')],null))[_0xcd08('0x14')](function(_0x11d16d){if(!_0x11d16d)return;var _0x3351f2=_0x11d16d[_0xcd08('0x3f')]({'plain':!![]});return _0x3351f2;})[_0xcd08('0x14')](function(_0x3613bd){var _0xeca697=new Redis(config[_0xcd08('0x7')]);_0xeca697[_0xcd08('0x47')]('agi',JSON[_0xcd08('0x19')](_[_0xcd08('0x30')](_0x3613bd,['id',_0xcd08('0x1e'),_0xcd08('0x48')])));return _0x3613bd;})[_0xcd08('0x14')](respondWithResult(_0x687df4,null))[_0xcd08('0x45')](handleError(_0x687df4,null));};exports[_0xcd08('0x17')]=function(_0x580d55,_0x51b518){return db[_0xcd08('0x35')][_0xcd08('0x3c')]({'where':{'id':_0x580d55[_0xcd08('0x39')]['id']}})[_0xcd08('0x14')](handleEntityNotFound(_0x51b518,null))['then'](removeEntity(_0x51b518,null))[_0xcd08('0x45')](handleError(_0x51b518,null));}; \ No newline at end of file +var _0x3566=['role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','SquareProjects','UserProfileResource','destroy','publish','agi','stringify','end','sendStatus','error','stack','name','index','map','SquareProject','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','filter','where','includeAll','include','rows','catch','params','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x5af812,_0x43d252){var _0x1489f2=function(_0x1c7fa9){while(--_0x1c7fa9){_0x5af812['push'](_0x5af812['shift']());}};_0x1489f2(++_0x43d252);}(_0x3566,0x121));var _0x6356=function(_0x1b410e,_0x23eacd){_0x1b410e=_0x1b410e-0x0;var _0x3d63eb=_0x3566[_0x1b410e];return _0x3d63eb;};'use strict';var _=require(_0x6356('0x0'));var Redis=require('ioredis');var qs=require(_0x6356('0x1'));var logger=require(_0x6356('0x2'))('api');var config=require(_0x6356('0x3'));var db=require(_0x6356('0x4'))['db'];config[_0x6356('0x5')]=_[_0x6356('0x6')](config[_0x6356('0x5')],{'host':_0x6356('0x7'),'port':0x18eb});var socket=require(_0x6356('0x8'))(new Redis(config[_0x6356('0x5')]));require('./squareProject.socket')[_0x6356('0x9')](socket);function respondWithResult(_0x4cb700,_0x32d6bb){_0x32d6bb=_0x32d6bb||0xc8;return function(_0x4ccead){if(_0x4ccead){return _0x4cb700[_0x6356('0xa')](_0x32d6bb)[_0x6356('0xb')](_0x4ccead);}};}function respondWithFilteredResult(_0x4318e4,_0x4a03fa){return function(_0x39b367){if(_0x39b367){var _0xe3efb1=typeof _0x4a03fa[_0x6356('0xc')]===_0x6356('0xd')&&typeof _0x4a03fa[_0x6356('0xe')]==='undefined';var _0x1a51ab=_0x39b367['count'];var _0xbc11ba=_0xe3efb1?0x0:_0x4a03fa['offset'];var _0x237ca8=_0xe3efb1?_0x39b367[_0x6356('0xf')]:_0x4a03fa[_0x6356('0xc')]+_0x4a03fa['limit'];var _0x51800;if(_0x237ca8>=_0x1a51ab){_0x237ca8=_0x1a51ab;_0x51800=0xc8;}else{_0x51800=0xce;}_0x4318e4[_0x6356('0xa')](_0x51800);return _0x4318e4[_0x6356('0x10')](_0x6356('0x11'),_0xbc11ba+'-'+_0x237ca8+'/'+_0x1a51ab)[_0x6356('0xb')](_0x39b367);}return null;};}function saveUpdates(_0x2cf68c){return function(_0x27006a){if(_0x27006a){return _0x27006a[_0x6356('0x12')](_0x2cf68c)[_0x6356('0x13')](function(_0x51fd36){return _0x51fd36;});}return null;};}function removeEntity(_0x4b6082){return function(_0x532436){if(_0x532436){return _0x532436['destroy']()['then'](function(){var _0x2c8e89=_0x532436['get']({'plain':!![]});var _0x19c5d9=_0x6356('0x14');return db[_0x6356('0x15')][_0x6356('0x16')]({'where':{'type':_0x19c5d9,'resourceId':_0x2c8e89['id']}})['then'](function(){return _0x532436;});})[_0x6356('0x13')](function(){var _0x4f98c2=new Redis(config[_0x6356('0x5')]);_0x4f98c2[_0x6356('0x17')](_0x6356('0x18'),JSON[_0x6356('0x19')]({'id':_0x532436['id'],'deleted':!![]}));})['then'](function(){_0x4b6082[_0x6356('0xa')](0xcc)[_0x6356('0x1a')]();});}};}function handleEntityNotFound(_0xb3cd38){return function(_0x390a93){if(!_0x390a93){_0xb3cd38[_0x6356('0x1b')](0x194);}return _0x390a93;};}function handleError(_0x2c26a4,_0x5c2721){_0x5c2721=_0x5c2721||0x1f4;return function(_0xd5e5f2){logger[_0x6356('0x1c')](_0xd5e5f2[_0x6356('0x1d')]);if(_0xd5e5f2[_0x6356('0x1e')]){delete _0xd5e5f2[_0x6356('0x1e')];}_0x2c26a4['status'](_0x5c2721)['send'](_0xd5e5f2);};}exports[_0x6356('0x1f')]=function(_0x27cae2,_0x4ed516){var _0x22d546={},_0x367efa={},_0x290970={'count':0x0,'rows':[]};var _0x141c39=_[_0x6356('0x20')](db[_0x6356('0x21')][_0x6356('0x22')],function(_0xc33170){return{'name':_0xc33170['fieldName'],'type':_0xc33170[_0x6356('0x23')][_0x6356('0x24')]};});_0x367efa[_0x6356('0x25')]=_[_0x6356('0x20')](_0x141c39,_0x6356('0x1e'));_0x367efa['query']=_['keys'](_0x27cae2[_0x6356('0x26')]);_0x367efa[_0x6356('0x27')]=_[_0x6356('0x28')](_0x367efa['model'],_0x367efa[_0x6356('0x26')]);_0x22d546[_0x6356('0x29')]=_['intersection'](_0x367efa[_0x6356('0x25')],qs['fields'](_0x27cae2[_0x6356('0x26')][_0x6356('0x2a')]));_0x22d546['attributes']=_0x22d546[_0x6356('0x29')][_0x6356('0x2b')]?_0x22d546[_0x6356('0x29')]:_0x367efa[_0x6356('0x25')];if(!_0x27cae2[_0x6356('0x26')][_0x6356('0x2c')](_0x6356('0x2d'))){_0x22d546['limit']=qs[_0x6356('0xe')](_0x27cae2['query']['limit']);_0x22d546[_0x6356('0xc')]=qs[_0x6356('0xc')](_0x27cae2[_0x6356('0x26')]['offset']);}_0x22d546[_0x6356('0x2e')]=qs[_0x6356('0x2f')](_0x27cae2['query']['sort']);_0x22d546['where']=qs[_0x6356('0x27')](_[_0x6356('0x30')](_0x27cae2[_0x6356('0x26')],_0x367efa[_0x6356('0x27')]),_0x141c39);if(_0x27cae2['query']['filter']){_0x22d546['where']=_[_0x6356('0x31')](_0x22d546['where'],{'$or':_['map'](_0x141c39,function(_0x26c62a){if(_0x26c62a[_0x6356('0x23')]!==_0x6356('0x32')){var _0x49d92c={};_0x49d92c[_0x26c62a[_0x6356('0x1e')]]={'$like':'%'+_0x27cae2['query'][_0x6356('0x33')]+'%'};return _0x49d92c;}})});}_0x22d546=_['merge']({},_0x22d546,_0x27cae2['options']);var _0x4d832d={'where':_0x22d546[_0x6356('0x34')]};return db['SquareProject'][_0x6356('0xf')](_0x4d832d)[_0x6356('0x13')](function(_0x979c83){_0x290970[_0x6356('0xf')]=_0x979c83;if(_0x27cae2['query'][_0x6356('0x35')]){_0x22d546[_0x6356('0x36')]=[{'all':!![]}];}return db[_0x6356('0x21')]['findAll'](_0x22d546);})[_0x6356('0x13')](function(_0x474d43){_0x290970[_0x6356('0x37')]=_0x474d43;return _0x290970;})[_0x6356('0x13')](respondWithFilteredResult(_0x4ed516,_0x22d546))[_0x6356('0x38')](handleError(_0x4ed516,null));};exports['show']=function(_0x240952,_0x1c6b76){var _0x4b5fff={'raw':![],'where':{'id':_0x240952[_0x6356('0x39')]['id']}},_0x5181c6={};_0x5181c6[_0x6356('0x25')]=_[_0x6356('0x3a')](db['SquareProject']['rawAttributes']);_0x5181c6[_0x6356('0x26')]=_['keys'](_0x240952[_0x6356('0x26')]);_0x5181c6[_0x6356('0x27')]=_['intersection'](_0x5181c6[_0x6356('0x25')],_0x5181c6[_0x6356('0x26')]);_0x4b5fff['attributes']=_[_0x6356('0x28')](_0x5181c6[_0x6356('0x25')],qs[_0x6356('0x2a')](_0x240952[_0x6356('0x26')][_0x6356('0x2a')]));_0x4b5fff[_0x6356('0x29')]=_0x4b5fff[_0x6356('0x29')][_0x6356('0x2b')]?_0x4b5fff['attributes']:_0x5181c6[_0x6356('0x25')];if(_0x240952[_0x6356('0x26')][_0x6356('0x35')]){_0x4b5fff[_0x6356('0x36')]=[{'all':!![]}];}_0x4b5fff=_['merge']({},_0x4b5fff,_0x240952[_0x6356('0x3b')]);return db[_0x6356('0x21')][_0x6356('0x3c')](_0x4b5fff)[_0x6356('0x13')](handleEntityNotFound(_0x1c6b76,null))[_0x6356('0x13')](respondWithResult(_0x1c6b76,null))[_0x6356('0x38')](handleError(_0x1c6b76,null));};exports[_0x6356('0x3d')]=function(_0x54ec6b,_0x5c0d28){return db[_0x6356('0x21')][_0x6356('0x3d')](_0x54ec6b[_0x6356('0x3e')],{})['then'](function(_0x3aafe1){var _0x3a7b44=_0x54ec6b[_0x6356('0x3f')][_0x6356('0x40')]({'plain':!![]});if(!_0x3a7b44)throw new Error(_0x6356('0x41'));if(_0x3a7b44[_0x6356('0x42')]===_0x6356('0x3f')){var _0x1043d9=_0x3aafe1[_0x6356('0x40')]({'plain':!![]});var _0x82822=_0x6356('0x14');return db[_0x6356('0x43')][_0x6356('0x3c')]({'where':{'name':_0x82822,'userProfileId':_0x3a7b44[_0x6356('0x44')]},'raw':!![]})[_0x6356('0x13')](function(_0x1216c7){if(_0x1216c7&&_0x1216c7[_0x6356('0x45')]===0x0){return db[_0x6356('0x15')][_0x6356('0x3d')]({'name':_0x1043d9[_0x6356('0x1e')],'resourceId':_0x1043d9['id'],'type':_0x1216c7[_0x6356('0x1e')],'sectionId':_0x1216c7['id']},{})[_0x6356('0x13')](function(){return _0x3aafe1;});}else{return _0x3aafe1;}})['catch'](function(_0x395ddf){logger['error'](_0x6356('0x46'),_0x395ddf);throw _0x395ddf;});}return _0x3aafe1;})[_0x6356('0x13')](respondWithResult(_0x5c0d28,0xc9))['catch'](handleError(_0x5c0d28,null));};exports['update']=function(_0x5b4235,_0x149d9f){if(_0x5b4235[_0x6356('0x3e')]['id']){delete _0x5b4235[_0x6356('0x3e')]['id'];}return db[_0x6356('0x21')][_0x6356('0x3c')]({'where':{'id':_0x5b4235[_0x6356('0x39')]['id']}})[_0x6356('0x13')](handleEntityNotFound(_0x149d9f,null))[_0x6356('0x13')](saveUpdates(_0x5b4235[_0x6356('0x3e')],null))[_0x6356('0x13')](function(_0x4b59b1){if(!_0x4b59b1)return;var _0x13bcea=_0x4b59b1[_0x6356('0x40')]({'plain':!![]});return _0x13bcea;})[_0x6356('0x13')](function(_0x3d799d){var _0x529adb=new Redis(config[_0x6356('0x5')]);_0x529adb['publish'](_0x6356('0x18'),JSON[_0x6356('0x19')](_[_0x6356('0x30')](_0x3d799d,['id',_0x6356('0x1e'),'production'])));return _0x3d799d;})[_0x6356('0x13')](respondWithResult(_0x149d9f,null))[_0x6356('0x38')](handleError(_0x149d9f,null));};exports[_0x6356('0x16')]=function(_0x25ecbb,_0x361433){return db[_0x6356('0x21')]['find']({'where':{'id':_0x25ecbb[_0x6356('0x39')]['id']}})[_0x6356('0x13')](handleEntityNotFound(_0x361433,null))['then'](removeEntity(_0x361433,null))[_0x6356('0x38')](handleError(_0x361433,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 0088e71..3e588d0 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 _0x04d0=['setMaxListeners','save','remove','emit','hook','exports','../../mysqldb','SquareProject'];(function(_0x2b15f6,_0x46662a){var _0x5435bd=function(_0x54e57f){while(--_0x54e57f){_0x2b15f6['push'](_0x2b15f6['shift']());}};_0x5435bd(++_0x46662a);}(_0x04d0,0x116));var _0x004d=function(_0x47ae21,_0x4b4d66){_0x47ae21=_0x47ae21-0x0;var _0x4727e6=_0x04d0[_0x47ae21];return _0x4727e6;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x004d('0x0'))['db'][_0x004d('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x004d('0x2')](0x0);var events={'afterCreate':_0x004d('0x3'),'afterUpdate':'update','afterDestroy':_0x004d('0x4')};function emitEvent(_0x261318){return function(_0x1c0723,_0x386955,_0x4a4057){SquareProjectEvents[_0x004d('0x5')](_0x261318+':'+_0x1c0723['id'],_0x1c0723);SquareProjectEvents[_0x004d('0x5')](_0x261318,_0x1c0723);_0x4a4057(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x004d('0x6')](e,emitEvent(event));}}module[_0x004d('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xaec1=['SquareProject','setMaxListeners','save','remove','hasOwnProperty','hook','../../mysqldb'];(function(_0x3edc39,_0x11c82d){var _0x2eec75=function(_0x588b11){while(--_0x588b11){_0x3edc39['push'](_0x3edc39['shift']());}};_0x2eec75(++_0x11c82d);}(_0xaec1,0x15d));var _0x1aec=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xaec1[_0xdea41a];return _0x15d0d8;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x1aec('0x0'))['db'][_0x1aec('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1aec('0x2')](0x0);var events={'afterCreate':_0x1aec('0x3'),'afterUpdate':'update','afterDestroy':_0x1aec('0x4')};function emitEvent(_0x4b7efd){return function(_0x1f27ba,_0x1c8295,_0x475c12){SquareProjectEvents['emit'](_0x4b7efd+':'+_0x1f27ba['id'],_0x1f27ba);SquareProjectEvents['emit'](_0x4b7efd,_0x1f27ba);_0x475c12(null);};}for(var e in events){if(events[_0x1aec('0x5')](e)){var event=events[e];SquareProject[_0x1aec('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 9512ebf..4ee1beb 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 _0xa267=['changed','preproduction','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SquareProject'];(function(_0x13d153,_0x3edda1){var _0x508a08=function(_0x465db7){while(--_0x465db7){_0x13d153['push'](_0x13d153['shift']());}};_0x508a08(++_0x3edda1);}(_0xa267,0x7d));var _0x7a26=function(_0x282e68,_0x185883){_0x282e68=_0x282e68-0x0;var _0xa4ad78=_0xa267[_0x282e68];return _0xa4ad78;};'use strict';var _=require(_0x7a26('0x0'));var util=require('util');var logger=require(_0x7a26('0x1'))(_0x7a26('0x2'));var moment=require(_0x7a26('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a26('0x4'));var fs=require('fs');var path=require(_0x7a26('0x5'));var rimraf=require(_0x7a26('0x6'));var config=require(_0x7a26('0x7'));var attributes=require('./squareProject.attributes');module[_0x7a26('0x8')]=function(_0x47e1c5,_0x4e1c56){return _0x47e1c5[_0x7a26('0x9')](_0x7a26('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16eac4,_0x4aebb5,_0xb10360){if(_0x16eac4[_0x7a26('0xb')](_0x7a26('0xc'))){_0x16eac4['savedAt']=moment()['format'](_0x7a26('0xd'));}if(_0x16eac4[_0x7a26('0xb')](_0x7a26('0xe'))){_0x16eac4[_0x7a26('0xf')]=moment()[_0x7a26('0x10')](_0x7a26('0xd'));}_0xb10360(null,_0x16eac4);}}});}; \ No newline at end of file +var _0xce28=['production','publishedAt','format','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','preproduction','YYYY-MM-DD\x20HH:mm:ss','changed'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0xce28,0x1b3));var _0x8ce2=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xce28[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x8ce2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8ce2('0x1'));var moment=require(_0x8ce2('0x2'));var BPromise=require(_0x8ce2('0x3'));var rp=require(_0x8ce2('0x4'));var fs=require('fs');var path=require(_0x8ce2('0x5'));var rimraf=require(_0x8ce2('0x6'));var config=require(_0x8ce2('0x7'));var attributes=require(_0x8ce2('0x8'));module[_0x8ce2('0x9')]=function(_0x388c5a,_0x11a9f0){return _0x388c5a[_0x8ce2('0xa')](_0x8ce2('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11d662,_0x44c62a,_0x686fa8){if(_0x11d662['changed'](_0x8ce2('0xc'))){_0x11d662['savedAt']=moment()['format'](_0x8ce2('0xd'));}if(_0x11d662[_0x8ce2('0xe')](_0x8ce2('0xf'))){_0x11d662[_0x8ce2('0x10')]=moment()[_0x8ce2('0x11')](_0x8ce2('0xd'));}_0x686fa8(null,_0x11d662);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index bbb5aaa..163d42a 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 _0xf96d=['redis','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','where','attributes','include','map','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','raw','lodash','ioredis','../../mysqldb','rpc','defaults'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0xf96d,0x175));var _0xdf96=function(_0xe11b4c,_0x2c4c64){_0xe11b4c=_0xe11b4c-0x0;var _0x4688b7=_0xf96d[_0xe11b4c];return _0x4688b7;};'use strict';var _=require(_0xdf96('0x0'));var Redis=require(_0xdf96('0x1'));var db=require(_0xdf96('0x2'))['db'];var logger=require('../../config/logger')(_0xdf96('0x3'));var config=require('../../config/environment');config['redis']=_[_0xdf96('0x4')](config[_0xdf96('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf96('0x6'))(new Redis(config[_0xdf96('0x5')]));require(_0xdf96('0x7'))[_0xdf96('0x8')](socket);exports[_0xdf96('0x9')]=function(_0x5c452c){var _0x17abe5=this;return new Promise(function(_0x1bb6cb,_0x249ae6){return db[_0xdf96('0xa')][_0xdf96('0xb')]({'raw':_0x5c452c[_0xdf96('0xc')]?_0x5c452c[_0xdf96('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x5c452c[_0xdf96('0xc')]?_0x5c452c[_0xdf96('0xc')][_0xdf96('0xd')]||null:null,'attributes':_0x5c452c['options']?_0x5c452c['options'][_0xdf96('0xe')]||null:null,'limit':_0x5c452c[_0xdf96('0xc')]?_0x5c452c[_0xdf96('0xc')]['limit']||null:null,'include':_0x5c452c[_0xdf96('0xc')]?_0x5c452c[_0xdf96('0xc')][_0xdf96('0xf')]?_[_0xdf96('0x10')](_0x5c452c[_0xdf96('0xc')][_0xdf96('0xf')],function(_0x5b25ee){return{'model':db[_0x5b25ee[_0xdf96('0x11')]],'as':_0x5b25ee['as'],'attributes':_0x5b25ee[_0xdf96('0xe')],'include':_0x5b25ee[_0xdf96('0xf')]?_['map'](_0x5b25ee[_0xdf96('0xf')],function(_0x1c8fc3){return{'model':db[_0x1c8fc3[_0xdf96('0x11')]],'as':_0x1c8fc3['as'],'attributes':_0x1c8fc3[_0xdf96('0xe')],'include':_0x1c8fc3[_0xdf96('0xf')]?_['map'](_0x1c8fc3[_0xdf96('0xf')],function(_0x81965c){return{'model':db[_0x81965c['model']],'as':_0x81965c['as'],'attributes':_0x81965c[_0xdf96('0xe')]};}):[]};}):[]};}):[]:[]})[_0xdf96('0x12')](function(_0x1e95a5){logger[_0xdf96('0x13')](_0xdf96('0x9'),_0x5c452c);logger[_0xdf96('0x14')](_0xdf96('0x9'),_0x5c452c,JSON[_0xdf96('0x15')](_0x1e95a5));_0x1bb6cb(_0x1e95a5);})[_0xdf96('0x16')](function(_0x15c98a){logger[_0xdf96('0x17')](_0xdf96('0x9'),_0x15c98a['message'],_0x5c452c);_0x249ae6(_0x17abe5['error'](0x1f4,_0x15c98a[_0xdf96('0x18')]));});});};exports[_0xdf96('0x19')]=function(_0xc354be){var _0x45302d=this;return new Promise(function(_0x29427c,_0x1e275c){return db['SquareProject']['find']({'raw':_0xc354be['options']?_0xc354be[_0xdf96('0xc')][_0xdf96('0x1a')]===undefined?!![]:![]:!![],'where':_0xc354be[_0xdf96('0xc')]?_0xc354be[_0xdf96('0xc')][_0xdf96('0xd')]||null:null,'attributes':_0xc354be['options']?_0xc354be[_0xdf96('0xc')][_0xdf96('0xe')]||null:null,'include':_0xc354be[_0xdf96('0xc')]?_0xc354be[_0xdf96('0xc')][_0xdf96('0xf')]?_[_0xdf96('0x10')](_0xc354be['options'][_0xdf96('0xf')],function(_0x3f99d0){return{'model':db[_0x3f99d0['model']],'as':_0x3f99d0['as'],'attributes':_0x3f99d0[_0xdf96('0xe')],'include':_0x3f99d0[_0xdf96('0xf')]?_[_0xdf96('0x10')](_0x3f99d0[_0xdf96('0xf')],function(_0x3d5318){return{'model':db[_0x3d5318[_0xdf96('0x11')]],'as':_0x3d5318['as'],'attributes':_0x3d5318[_0xdf96('0xe')],'include':_0x3d5318['include']?_[_0xdf96('0x10')](_0x3d5318[_0xdf96('0xf')],function(_0x4a4bef){return{'model':db[_0x4a4bef[_0xdf96('0x11')]],'as':_0x4a4bef['as'],'attributes':_0x4a4bef['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bda0a){logger[_0xdf96('0x13')](_0xdf96('0x19'),_0xc354be);logger[_0xdf96('0x14')]('ShowSquareProject',_0xc354be,JSON[_0xdf96('0x15')](_0x2bda0a));_0x29427c(_0x2bda0a);})['catch'](function(_0x27f369){logger[_0xdf96('0x17')]('ShowSquareProject',_0x27f369[_0xdf96('0x18')],_0xc354be);_0x1e275c(_0x45302d[_0xdf96('0x17')](0x1f4,_0x27f369[_0xdf96('0x18')]));});});}; \ No newline at end of file +var _0x7b9b=['SquareProject','stringify','lodash','ioredis','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','findAll','raw','options','where','attributes','include','map','model','then','info','GetSquareProjects','debug','catch','error','message','ShowSquareProject'];(function(_0x1c9721,_0x3f83a4){var _0x5b1a4c=function(_0x44f048){while(--_0x44f048){_0x1c9721['push'](_0x1c9721['shift']());}};_0x5b1a4c(++_0x3f83a4);}(_0x7b9b,0x1bc));var _0xb7b9=function(_0x3093a4,_0x13d353){_0x3093a4=_0x3093a4-0x0;var _0x204931=_0x7b9b[_0x3093a4];return _0x204931;};'use strict';var _=require(_0xb7b9('0x0'));var Redis=require(_0xb7b9('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xb7b9('0x2'))(_0xb7b9('0x3'));var config=require(_0xb7b9('0x4'));config[_0xb7b9('0x5')]=_[_0xb7b9('0x6')](config[_0xb7b9('0x5')],{'host':_0xb7b9('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb7b9('0x5')]));require('./squareProject.socket')['register'](socket);exports['GetSquareProjects']=function(_0x188423){var _0x4b38ad=this;return new Promise(function(_0x388266,_0x5fc909){return db['SquareProject'][_0xb7b9('0x8')]({'raw':_0x188423['options']?_0x188423['options'][_0xb7b9('0x9')]===undefined?!![]:![]:!![],'where':_0x188423[_0xb7b9('0xa')]?_0x188423[_0xb7b9('0xa')][_0xb7b9('0xb')]||null:null,'attributes':_0x188423['options']?_0x188423[_0xb7b9('0xa')][_0xb7b9('0xc')]||null:null,'limit':_0x188423[_0xb7b9('0xa')]?_0x188423[_0xb7b9('0xa')]['limit']||null:null,'include':_0x188423['options']?_0x188423[_0xb7b9('0xa')][_0xb7b9('0xd')]?_[_0xb7b9('0xe')](_0x188423[_0xb7b9('0xa')]['include'],function(_0x126148){return{'model':db[_0x126148[_0xb7b9('0xf')]],'as':_0x126148['as'],'attributes':_0x126148['attributes'],'include':_0x126148[_0xb7b9('0xd')]?_['map'](_0x126148[_0xb7b9('0xd')],function(_0x287bdf){return{'model':db[_0x287bdf['model']],'as':_0x287bdf['as'],'attributes':_0x287bdf['attributes'],'include':_0x287bdf['include']?_[_0xb7b9('0xe')](_0x287bdf[_0xb7b9('0xd')],function(_0x228a75){return{'model':db[_0x228a75[_0xb7b9('0xf')]],'as':_0x228a75['as'],'attributes':_0x228a75[_0xb7b9('0xc')]};}):[]};}):[]};}):[]:[]})[_0xb7b9('0x10')](function(_0x546422){logger[_0xb7b9('0x11')](_0xb7b9('0x12'),_0x188423);logger[_0xb7b9('0x13')](_0xb7b9('0x12'),_0x188423,JSON['stringify'](_0x546422));_0x388266(_0x546422);})[_0xb7b9('0x14')](function(_0x51fd1c){logger[_0xb7b9('0x15')](_0xb7b9('0x12'),_0x51fd1c[_0xb7b9('0x16')],_0x188423);_0x5fc909(_0x4b38ad[_0xb7b9('0x15')](0x1f4,_0x51fd1c['message']));});});};exports[_0xb7b9('0x17')]=function(_0x3715bd){var _0x399a45=this;return new Promise(function(_0x40f0e3,_0xdfb28d){return db[_0xb7b9('0x18')]['find']({'raw':_0x3715bd[_0xb7b9('0xa')]?_0x3715bd[_0xb7b9('0xa')][_0xb7b9('0x9')]===undefined?!![]:![]:!![],'where':_0x3715bd[_0xb7b9('0xa')]?_0x3715bd[_0xb7b9('0xa')]['where']||null:null,'attributes':_0x3715bd['options']?_0x3715bd[_0xb7b9('0xa')][_0xb7b9('0xc')]||null:null,'include':_0x3715bd[_0xb7b9('0xa')]?_0x3715bd['options']['include']?_['map'](_0x3715bd[_0xb7b9('0xa')][_0xb7b9('0xd')],function(_0x5c6c60){return{'model':db[_0x5c6c60[_0xb7b9('0xf')]],'as':_0x5c6c60['as'],'attributes':_0x5c6c60[_0xb7b9('0xc')],'include':_0x5c6c60[_0xb7b9('0xd')]?_[_0xb7b9('0xe')](_0x5c6c60[_0xb7b9('0xd')],function(_0x49f874){return{'model':db[_0x49f874[_0xb7b9('0xf')]],'as':_0x49f874['as'],'attributes':_0x49f874[_0xb7b9('0xc')],'include':_0x49f874['include']?_[_0xb7b9('0xe')](_0x49f874[_0xb7b9('0xd')],function(_0x22b21d){return{'model':db[_0x22b21d[_0xb7b9('0xf')]],'as':_0x22b21d['as'],'attributes':_0x22b21d[_0xb7b9('0xc')]};}):[]};}):[]};}):[]:[]})[_0xb7b9('0x10')](function(_0x55b96b){logger[_0xb7b9('0x11')](_0xb7b9('0x17'),_0x3715bd);logger['debug'](_0xb7b9('0x17'),_0x3715bd,JSON[_0xb7b9('0x19')](_0x55b96b));_0x40f0e3(_0x55b96b);})[_0xb7b9('0x14')](function(_0x5bde9f){logger[_0xb7b9('0x15')](_0xb7b9('0x17'),_0x5bde9f[_0xb7b9('0x16')],_0x3715bd);_0xdfb28d(_0x399a45[_0xb7b9('0x15')](0x1f4,_0x5bde9f[_0xb7b9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 66a4120..d6e4f08 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 _0xc527=['length','squareProject:','./squareProject.events','remove','emit','removeListener'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xc527,0x1e2));var _0x7c52=function(_0x204477,_0x2f9915){_0x204477=_0x204477-0x0;var _0x1a5ef9=_0xc527[_0x204477];return _0x1a5ef9;};'use strict';var SquareProjectEvents=require(_0x7c52('0x0'));var events=['save',_0x7c52('0x1'),'update'];function createListener(_0x543093,_0xe576d9){return function(_0x4a112d){_0xe576d9[_0x7c52('0x2')](_0x543093,_0x4a112d);};}function removeListener(_0x136798,_0x581a71){return function(){SquareProjectEvents[_0x7c52('0x3')](_0x136798,_0x581a71);};}exports['register']=function(_0x580fbb){for(var _0x31648e=0x0,_0x4f77bf=events[_0x7c52('0x4')];_0x31648e<_0x4f77bf;_0x31648e++){var _0x3e9457=events[_0x31648e];var _0x23a08c=createListener(_0x7c52('0x5')+_0x3e9457,_0x580fbb);SquareProjectEvents['on'](_0x3e9457,_0x23a08c);}}; \ No newline at end of file +var _0x9c56=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x57b27c,_0x84abfa){var _0xe0c87a=function(_0x238d19){while(--_0x238d19){_0x57b27c['push'](_0x57b27c['shift']());}};_0xe0c87a(++_0x84abfa);}(_0x9c56,0x149));var _0x69c5=function(_0xd466fb,_0x4e2e68){_0xd466fb=_0xd466fb-0x0;var _0x3d4d33=_0x9c56[_0xd466fb];return _0x3d4d33;};'use strict';var SquareProjectEvents=require(_0x69c5('0x0'));var events=[_0x69c5('0x1'),_0x69c5('0x2'),_0x69c5('0x3')];function createListener(_0x44835e,_0x25a557){return function(_0x38b3b4){_0x25a557[_0x69c5('0x4')](_0x44835e,_0x38b3b4);};}function removeListener(_0xc63e42,_0x453bbe){return function(){SquareProjectEvents[_0x69c5('0x5')](_0xc63e42,_0x453bbe);};}exports[_0x69c5('0x6')]=function(_0x747664){for(var _0x1c06c4=0x0,_0x1951aa=events['length'];_0x1c06c4<_0x1951aa;_0x1c06c4++){var _0x1f1dbf=events[_0x1c06c4];var _0x4dd3cb=createListener(_0x69c5('0x7')+_0x1f1dbf,_0x747664);SquareProjectEvents['on'](_0x1f1dbf,_0x4dd3cb);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 7bfb609..799c08f 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(_0x18758d,_0x292dfe){var _0x49d650=function(_0x34fdee){while(--_0x34fdee){_0x18758d['push'](_0x18758d['shift']());}};_0x49d650(++_0x292dfe);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x58309f,_0x1a5e6e){var _0x4c83e0=function(_0x2cee91){while(--_0x2cee91){_0x58309f['push'](_0x58309f['shift']());}};_0x4c83e0(++_0x1a5e6e);}(_0x53ec,0x192));var _0xc53e=function(_0x5cdf3c,_0x233f63){_0x5cdf3c=_0x5cdf3c-0x0;var _0x515b20=_0x53ec[_0x5cdf3c];return _0x515b20;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 4278644..6fab0c7 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 _0x6f47=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue'];(function(_0x2b898b,_0x1b3bda){var _0x59cd44=function(_0x242858){while(--_0x242858){_0x2b898b['push'](_0x2b898b['shift']());}};_0x59cd44(++_0x1b3bda);}(_0x6f47,0xc7));var _0x76f4=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x6f47[_0x50007c];return _0x5c1ec7;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'uniqueid':{'type':Sequelize[_0x76f4('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76f4('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x76f4('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x76f4('0x1')]},'dnid':{'type':Sequelize[_0x76f4('0x1')]},'projectName':{'type':Sequelize[_0x76f4('0x1')]},'saveName':{'type':Sequelize[_0x76f4('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x76f4('0x1')]},'format':{'type':Sequelize[_0x76f4('0x2')],'get':function(){var _0x2176a7='';var _0x497f99=this[_0x76f4('0x3')](_0x76f4('0x4'));if(_0x497f99){_0x2176a7=_0x497f99[_0x76f4('0x5')](_0x497f99[_0x76f4('0x6')]('.'));}return _0x2176a7;}}}; \ No newline at end of file +var _0xda19=['getDataValue','exports','STRING','VIRTUAL'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0xda19,0xd5));var _0x9da1=function(_0x3aae26,_0x4f0e12){_0x3aae26=_0x3aae26-0x0;var _0x33610d=_0xda19[_0x3aae26];return _0x33610d;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'uniqueid':{'type':Sequelize[_0x9da1('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9da1('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9da1('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9da1('0x1')]},'dnid':{'type':Sequelize[_0x9da1('0x1')]},'projectName':{'type':Sequelize[_0x9da1('0x1')]},'saveName':{'type':Sequelize[_0x9da1('0x1')]},'filename':{'type':Sequelize[_0x9da1('0x1')]},'savePath':{'type':Sequelize[_0x9da1('0x1')]},'format':{'type':Sequelize[_0x9da1('0x2')],'get':function(){var _0x2c3cdd='';var _0x1c24e6=this[_0x9da1('0x3')]('savePath');if(_0x1c24e6){_0x2c3cdd=_0x1c24e6['substring'](_0x1c24e6['lastIndexOf']('.'));}return _0x2c3cdd;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index c28169e..9870d5c 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 _0x103e=['jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','includeAll','include','rows','catch','show','params','options','create','body','find','../../components/encryptor','savePath','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x103e,0x114));var _0xe103=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x103e[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xe103('0x0'));var rimraf=require(_0xe103('0x1'));var zipdir=require(_0xe103('0x2'));var jsonpatch=require(_0xe103('0x3'));var rp=require('request-promise');var moment=require(_0xe103('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe103('0x5'));var util=require(_0xe103('0x6'));var path=require('path');var sox=require(_0xe103('0x7'));var csv=require('to-csv');var ejs=require(_0xe103('0x8'));var fs=require('fs');var fs_extra=require(_0xe103('0x9'));var _=require(_0xe103('0xa'));var squel=require(_0xe103('0xb'));var crypto=require('crypto');var jsforce=require(_0xe103('0xc'));var deskjs=require(_0xe103('0xd'));var toCsv=require(_0xe103('0xe'));var querystring=require(_0xe103('0xf'));var Papa=require('papaparse');var Redis=require(_0xe103('0x10'));var authService=require(_0xe103('0x11'));var qs=require(_0xe103('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe103('0x13'));var config=require(_0xe103('0x14'));var licenseUtil=require(_0xe103('0x15'));var db=require(_0xe103('0x16'))['db'];function respondWithStatusCode(_0x4ac10d,_0x35aa5b){_0x35aa5b=_0x35aa5b||0xcc;return function(_0x24eae7){if(_0x24eae7){return _0x4ac10d[_0xe103('0x17')](_0x35aa5b);}return _0x4ac10d['status'](_0x35aa5b)[_0xe103('0x18')]();};}function respondWithResult(_0x34019d,_0xd28974){_0xd28974=_0xd28974||0xc8;return function(_0x70c2dc){if(_0x70c2dc){return _0x34019d['status'](_0xd28974)[_0xe103('0x19')](_0x70c2dc);}};}function respondWithFilteredResult(_0x34e0c9,_0x533919){return function(_0x5cad96){if(_0x5cad96){var _0x47b7ae=typeof _0x533919[_0xe103('0x1a')]===_0xe103('0x1b')&&typeof _0x533919[_0xe103('0x1c')]===_0xe103('0x1b');var _0x10502a=_0x5cad96[_0xe103('0x1d')];var _0x1babfa=_0x47b7ae?0x0:_0x533919[_0xe103('0x1a')];var _0x247bd6=_0x47b7ae?_0x5cad96[_0xe103('0x1d')]:_0x533919[_0xe103('0x1a')]+_0x533919[_0xe103('0x1c')];var _0x26d260;if(_0x247bd6>=_0x10502a){_0x247bd6=_0x10502a;_0x26d260=0xc8;}else{_0x26d260=0xce;}_0x34e0c9[_0xe103('0x1e')](_0x26d260);return _0x34e0c9['set'](_0xe103('0x1f'),_0x1babfa+'-'+_0x247bd6+'/'+_0x10502a)[_0xe103('0x19')](_0x5cad96);}return null;};}function patchUpdates(_0x51eab6){return function(_0x3df2b4){try{jsonpatch[_0xe103('0x20')](_0x3df2b4,_0x51eab6,!![]);}catch(_0x29f2af){return BPromise[_0xe103('0x21')](_0x29f2af);}return _0x3df2b4[_0xe103('0x22')]();};}function saveUpdates(_0x47ff08,_0x1631a7){return function(_0x13f6ac){if(_0x13f6ac){return _0x13f6ac[_0xe103('0x23')](_0x47ff08)[_0xe103('0x24')](function(_0x5e7f73){return _0x5e7f73;});}return null;};}function removeEntity(_0xc89376,_0x574259){return function(_0x30a4f9){if(_0x30a4f9){return _0x30a4f9['destroy']()[_0xe103('0x24')](function(){_0xc89376[_0xe103('0x1e')](0xcc)[_0xe103('0x18')]();});}};}function handleEntityNotFound(_0x57fad7,_0x122898){return function(_0x15fc5f){if(!_0x15fc5f){_0x57fad7[_0xe103('0x17')](0x194);}return _0x15fc5f;};}function handleError(_0x23017f,_0x16bcb7){_0x16bcb7=_0x16bcb7||0x1f4;return function(_0x5f32fd){logger[_0xe103('0x25')](_0x5f32fd[_0xe103('0x26')]);if(_0x5f32fd[_0xe103('0x27')]){delete _0x5f32fd[_0xe103('0x27')];}_0x23017f[_0xe103('0x1e')](_0x16bcb7)[_0xe103('0x28')](_0x5f32fd);};}exports[_0xe103('0x29')]=function(_0x18c767,_0x4a1377){var _0x5cfbdd={},_0x3b5507={},_0x1f50e4={'count':0x0,'rows':[]};var _0x13a2ba=_[_0xe103('0x2a')](db[_0xe103('0x2b')][_0xe103('0x2c')],function(_0x505f83){return{'name':_0x505f83[_0xe103('0x2d')],'type':_0x505f83[_0xe103('0x2e')][_0xe103('0x2f')]};});_0x3b5507['model']=_[_0xe103('0x2a')](_0x13a2ba,_0xe103('0x27'));_0x3b5507['query']=_[_0xe103('0x30')](_0x18c767['query']);_0x3b5507['filters']=_[_0xe103('0x31')](_0x3b5507[_0xe103('0x32')],_0x3b5507[_0xe103('0x33')]);_0x5cfbdd[_0xe103('0x34')]=_[_0xe103('0x31')](_0x3b5507[_0xe103('0x32')],qs[_0xe103('0x35')](_0x18c767['query'][_0xe103('0x35')]));_0x5cfbdd[_0xe103('0x34')]=_0x5cfbdd['attributes'][_0xe103('0x36')]?_0x5cfbdd[_0xe103('0x34')]:_0x3b5507[_0xe103('0x32')];if(!_0x18c767[_0xe103('0x33')][_0xe103('0x37')](_0xe103('0x38'))){_0x5cfbdd[_0xe103('0x1c')]=qs['limit'](_0x18c767[_0xe103('0x33')]['limit']);_0x5cfbdd['offset']=qs[_0xe103('0x1a')](_0x18c767[_0xe103('0x33')][_0xe103('0x1a')]);}_0x5cfbdd[_0xe103('0x39')]=qs[_0xe103('0x3a')](_0x18c767[_0xe103('0x33')]['sort']);_0x5cfbdd['where']=qs[_0xe103('0x3b')](_['pick'](_0x18c767[_0xe103('0x33')],_0x3b5507[_0xe103('0x3b')]),_0x13a2ba);if(_0x18c767[_0xe103('0x33')][_0xe103('0x3c')]){_0x5cfbdd[_0xe103('0x3d')]=_[_0xe103('0x3e')](_0x5cfbdd[_0xe103('0x3d')],{'$or':_[_0xe103('0x2a')](_0x13a2ba,function(_0x1db54c){if(_0x1db54c['type']!=='VIRTUAL'){var _0x4707a8={};_0x4707a8[_0x1db54c[_0xe103('0x27')]]={'$like':'%'+_0x18c767[_0xe103('0x33')][_0xe103('0x3c')]+'%'};return _0x4707a8;}})});}_0x5cfbdd=_['merge']({},_0x5cfbdd,_0x18c767['options']);var _0x4b072c={'where':_0x5cfbdd[_0xe103('0x3d')]};return db[_0xe103('0x2b')]['count'](_0x4b072c)[_0xe103('0x24')](function(_0x480236){_0x1f50e4['count']=_0x480236;if(_0x18c767[_0xe103('0x33')][_0xe103('0x3f')]){_0x5cfbdd[_0xe103('0x40')]=[{'all':!![]}];}return db[_0xe103('0x2b')]['findAll'](_0x5cfbdd);})[_0xe103('0x24')](function(_0x5cb02a){_0x1f50e4[_0xe103('0x41')]=_0x5cb02a;return _0x1f50e4;})[_0xe103('0x24')](respondWithFilteredResult(_0x4a1377,_0x5cfbdd))[_0xe103('0x42')](handleError(_0x4a1377,null));};exports[_0xe103('0x43')]=function(_0x579743,_0x395a4f){var _0x13c429={'raw':!![],'where':{'id':_0x579743[_0xe103('0x44')]['id']}},_0x14cb8c={};_0x14cb8c[_0xe103('0x32')]=_[_0xe103('0x30')](db['SquareRecording'][_0xe103('0x2c')]);_0x14cb8c['query']=_[_0xe103('0x30')](_0x579743[_0xe103('0x33')]);_0x14cb8c[_0xe103('0x3b')]=_[_0xe103('0x31')](_0x14cb8c[_0xe103('0x32')],_0x14cb8c['query']);_0x13c429[_0xe103('0x34')]=_['intersection'](_0x14cb8c[_0xe103('0x32')],qs[_0xe103('0x35')](_0x579743['query'][_0xe103('0x35')]));_0x13c429['attributes']=_0x13c429[_0xe103('0x34')][_0xe103('0x36')]?_0x13c429[_0xe103('0x34')]:_0x14cb8c[_0xe103('0x32')];if(_0x579743[_0xe103('0x33')][_0xe103('0x3f')]){_0x13c429['include']=[{'all':!![]}];}_0x13c429=_['merge']({},_0x13c429,_0x579743[_0xe103('0x45')]);return db['SquareRecording']['find'](_0x13c429)[_0xe103('0x24')](handleEntityNotFound(_0x395a4f,null))[_0xe103('0x24')](respondWithResult(_0x395a4f,null))['catch'](handleError(_0x395a4f,null));};exports[_0xe103('0x46')]=function(_0x3606cd,_0x3adfa9){return db[_0xe103('0x2b')][_0xe103('0x46')](_0x3606cd[_0xe103('0x47')],{})[_0xe103('0x24')](respondWithResult(_0x3adfa9,0xc9))[_0xe103('0x42')](handleError(_0x3adfa9,null));};exports['update']=function(_0x7aab6f,_0x98dfb2){if(_0x7aab6f[_0xe103('0x47')]['id']){delete _0x7aab6f[_0xe103('0x47')]['id'];}return db[_0xe103('0x2b')][_0xe103('0x48')]({'where':{'id':_0x7aab6f[_0xe103('0x44')]['id']}})[_0xe103('0x24')](handleEntityNotFound(_0x98dfb2,null))[_0xe103('0x24')](saveUpdates(_0x7aab6f[_0xe103('0x47')],null))[_0xe103('0x24')](respondWithResult(_0x98dfb2,null))['catch'](handleError(_0x98dfb2,null));};exports['download']=function(_0xbf930a,_0x559dd1,_0x1cbb90){var _0x31a9e4=require(_0xe103('0x49'));var _0xa44eac=![];var _0x495dda={};if(_0xbf930a[_0xe103('0x33')]['type']&&_0xbf930a[_0xe103('0x33')][_0xe103('0x2e')]==='uniqueid'){_0x495dda['uniqueid']=_0xbf930a[_0xe103('0x44')]['id'];}else{_0x495dda['id']=_0xbf930a[_0xe103('0x44')]['id'];}return db[_0xe103('0x2b')][_0xe103('0x48')]({'where':_0x495dda,'attributes':['id','savePath','filename'],'raw':!![]})[_0xe103('0x24')](handleEntityNotFound(_0x559dd1,null))['then'](function(_0x4408d0){if(_0x4408d0){var _0x26e3d1=_0x4408d0[_0xe103('0x4a')];var _0x494216=util[_0xe103('0x4b')](_0xe103('0x4c'),_0x26e3d1);if(fs[_0xe103('0x4d')](_0x494216)){_0xa44eac=!![];return _0x31a9e4[_0xe103('0x4e')](_0x494216,_0x26e3d1,config[_0xe103('0x4f')]['recording'])[_0xe103('0x24')](function(){return _0x4408d0;});}return _0x4408d0;}})[_0xe103('0x24')](function(_0x166685){if(_0x166685){var _0x46f43b=_0x166685[_0xe103('0x4a')];if(!fs['existsSync'](_0x46f43b)){throw new db[(_0xe103('0x50'))][(_0xe103('0x51'))](_0xe103('0x52'));}if(_0x166685[_0xe103('0x53')]){return _0x559dd1[_0xe103('0x54')](_0x46f43b,_0x166685[_0xe103('0x53')]+path[_0xe103('0x55')](_0x46f43b),function(){if(_0xa44eac){fs['unlink'](_0x46f43b);}});}else{return _0x559dd1[_0xe103('0x54')](_0x46f43b,function(_0x4e50a5){if(_0xa44eac){fs[_0xe103('0x56')](_0x46f43b);}});}}})['catch'](function(_0x2f75bb){if(_0x2f75bb[_0xe103('0x57')]===_0xe103('0x52')){_0x559dd1[_0xe103('0x1e')](0x194)[_0xe103('0x28')](_0xe103('0x58'));}else{return handleError(_0x559dd1,null);}});};exports['destroy']=function(_0x48d4e7,_0x56ef89){return db['SquareRecording']['find']({'where':{'id':_0x48d4e7[_0xe103('0x44')]['id']}})[_0xe103('0x24')](function(_0xfe7474){if(_[_0xe103('0x59')](_0xfe7474)){throw new ReferenceError(_0xe103('0x5a'));}return _0xfe7474;})['then'](function(_0x11f8ba){var _0x221246=_0x11f8ba['savePath'];logger[_0xe103('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x221246);if(!_[_0xe103('0x59')](_0x11f8ba['savePath'])&&fs[_0xe103('0x4d')](_0x221246)){logger[_0xe103('0x5b')](_0xe103('0x5c')+_0x221246+_0xe103('0x5d'));fs[_0xe103('0x5e')](_0x221246);}_0x221246=_0x221246+_0xe103('0x5f');if(!_[_0xe103('0x59')](_0x11f8ba['savePath'])&&fs[_0xe103('0x4d')](_0x221246)){logger[_0xe103('0x5b')]('File:\x20\x22'+_0x221246+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x221246);}return _0x11f8ba;})[_0xe103('0x24')](function(_0x2b03c2){if(!_0x2b03c2)throw new InternalError();return _0x2b03c2['destroy']();})[_0xe103('0x24')](function(){_0x56ef89[_0xe103('0x1e')](0xcc)['end']();})[_0xe103('0x42')](handleError(_0x56ef89,null));}; \ No newline at end of file +var _0x088f=['.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','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','limit','count','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareRecording','includeAll','include','findAll','rows','show','params','find','catch','create','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','unlink','message','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync'];(function(_0x21df92,_0x3e7d13){var _0x3a40e0=function(_0x1c8f9a){while(--_0x1c8f9a){_0x21df92['push'](_0x21df92['shift']());}};_0x3a40e0(++_0x3e7d13);}(_0x088f,0x185));var _0xf088=function(_0xc64fa7,_0x974362){_0xc64fa7=_0xc64fa7-0x0;var _0x4d0168=_0x088f[_0xc64fa7];return _0x4d0168;};'use strict';var emlformat=require(_0xf088('0x0'));var rimraf=require(_0xf088('0x1'));var zipdir=require(_0xf088('0x2'));var jsonpatch=require(_0xf088('0x3'));var rp=require('request-promise');var moment=require(_0xf088('0x4'));var BPromise=require(_0xf088('0x5'));var Mustache=require('mustache');var util=require(_0xf088('0x6'));var path=require(_0xf088('0x7'));var sox=require(_0xf088('0x8'));var csv=require(_0xf088('0x9'));var ejs=require(_0xf088('0xa'));var fs=require('fs');var fs_extra=require(_0xf088('0xb'));var _=require(_0xf088('0xc'));var squel=require(_0xf088('0xd'));var crypto=require(_0xf088('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf088('0xf'));var toCsv=require(_0xf088('0x9'));var querystring=require('querystring');var Papa=require(_0xf088('0x10'));var Redis=require(_0xf088('0x11'));var authService=require(_0xf088('0x12'));var qs=require(_0xf088('0x13'));var as=require(_0xf088('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf088('0x15'))(_0xf088('0x16'));var utils=require(_0xf088('0x17'));var config=require(_0xf088('0x18'));var licenseUtil=require(_0xf088('0x19'));var db=require(_0xf088('0x1a'))['db'];function respondWithStatusCode(_0x4a1d5b,_0x845b57){_0x845b57=_0x845b57||0xcc;return function(_0x481867){if(_0x481867){return _0x4a1d5b[_0xf088('0x1b')](_0x845b57);}return _0x4a1d5b[_0xf088('0x1c')](_0x845b57)['end']();};}function respondWithResult(_0x7a16d9,_0x4170d2){_0x4170d2=_0x4170d2||0xc8;return function(_0x4066e9){if(_0x4066e9){return _0x7a16d9[_0xf088('0x1c')](_0x4170d2)[_0xf088('0x1d')](_0x4066e9);}};}function respondWithFilteredResult(_0x7d84b3,_0x15f6f8){return function(_0x1dcbe1){if(_0x1dcbe1){var _0x561cf3=typeof _0x15f6f8[_0xf088('0x1e')]==='undefined'&&typeof _0x15f6f8[_0xf088('0x1f')]==='undefined';var _0x5bc653=_0x1dcbe1[_0xf088('0x20')];var _0x2c67ee=_0x561cf3?0x0:_0x15f6f8[_0xf088('0x1e')];var _0x3da8ee=_0x561cf3?_0x1dcbe1[_0xf088('0x20')]:_0x15f6f8[_0xf088('0x1e')]+_0x15f6f8['limit'];var _0x561a24;if(_0x3da8ee>=_0x5bc653){_0x3da8ee=_0x5bc653;_0x561a24=0xc8;}else{_0x561a24=0xce;}_0x7d84b3['status'](_0x561a24);return _0x7d84b3[_0xf088('0x21')](_0xf088('0x22'),_0x2c67ee+'-'+_0x3da8ee+'/'+_0x5bc653)[_0xf088('0x1d')](_0x1dcbe1);}return null;};}function patchUpdates(_0x1821a4){return function(_0x3fdcc6){try{jsonpatch[_0xf088('0x23')](_0x3fdcc6,_0x1821a4,!![]);}catch(_0x39ced0){return BPromise['reject'](_0x39ced0);}return _0x3fdcc6['save']();};}function saveUpdates(_0x15f999,_0x11c968){return function(_0x2a8bfa){if(_0x2a8bfa){return _0x2a8bfa[_0xf088('0x24')](_0x15f999)[_0xf088('0x25')](function(_0x1a4da3){return _0x1a4da3;});}return null;};}function removeEntity(_0x57e1cc,_0x43e6b1){return function(_0x46aa8c){if(_0x46aa8c){return _0x46aa8c[_0xf088('0x26')]()[_0xf088('0x25')](function(){_0x57e1cc[_0xf088('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3060a1,_0x1fdb83){return function(_0x1b09fc){if(!_0x1b09fc){_0x3060a1[_0xf088('0x1b')](0x194);}return _0x1b09fc;};}function handleError(_0x25657c,_0x1776fd){_0x1776fd=_0x1776fd||0x1f4;return function(_0x3a4900){logger[_0xf088('0x27')](_0x3a4900['stack']);if(_0x3a4900[_0xf088('0x28')]){delete _0x3a4900['name'];}_0x25657c[_0xf088('0x1c')](_0x1776fd)[_0xf088('0x29')](_0x3a4900);};}exports[_0xf088('0x2a')]=function(_0x37755c,_0x43a71c){var _0x339eb5={},_0x20bce3={},_0x23a4af={'count':0x0,'rows':[]};var _0x1628c3=_[_0xf088('0x2b')](db['SquareRecording'][_0xf088('0x2c')],function(_0x4cccaf){return{'name':_0x4cccaf[_0xf088('0x2d')],'type':_0x4cccaf[_0xf088('0x2e')][_0xf088('0x2f')]};});_0x20bce3['model']=_[_0xf088('0x2b')](_0x1628c3,_0xf088('0x28'));_0x20bce3[_0xf088('0x30')]=_[_0xf088('0x31')](_0x37755c[_0xf088('0x30')]);_0x20bce3[_0xf088('0x32')]=_[_0xf088('0x33')](_0x20bce3[_0xf088('0x34')],_0x20bce3[_0xf088('0x30')]);_0x339eb5[_0xf088('0x35')]=_[_0xf088('0x33')](_0x20bce3['model'],qs[_0xf088('0x36')](_0x37755c[_0xf088('0x30')][_0xf088('0x36')]));_0x339eb5[_0xf088('0x35')]=_0x339eb5[_0xf088('0x35')][_0xf088('0x37')]?_0x339eb5[_0xf088('0x35')]:_0x20bce3[_0xf088('0x34')];if(!_0x37755c['query']['hasOwnProperty'](_0xf088('0x38'))){_0x339eb5[_0xf088('0x1f')]=qs[_0xf088('0x1f')](_0x37755c[_0xf088('0x30')][_0xf088('0x1f')]);_0x339eb5[_0xf088('0x1e')]=qs[_0xf088('0x1e')](_0x37755c['query'][_0xf088('0x1e')]);}_0x339eb5[_0xf088('0x39')]=qs[_0xf088('0x3a')](_0x37755c[_0xf088('0x30')][_0xf088('0x3a')]);_0x339eb5[_0xf088('0x3b')]=qs['filters'](_[_0xf088('0x3c')](_0x37755c[_0xf088('0x30')],_0x20bce3[_0xf088('0x32')]),_0x1628c3);if(_0x37755c[_0xf088('0x30')][_0xf088('0x3d')]){_0x339eb5[_0xf088('0x3b')]=_['merge'](_0x339eb5[_0xf088('0x3b')],{'$or':_[_0xf088('0x2b')](_0x1628c3,function(_0x3dc90e){if(_0x3dc90e[_0xf088('0x2e')]!==_0xf088('0x3e')){var _0x3e09a7={};_0x3e09a7[_0x3dc90e[_0xf088('0x28')]]={'$like':'%'+_0x37755c[_0xf088('0x30')]['filter']+'%'};return _0x3e09a7;}})});}_0x339eb5=_[_0xf088('0x3f')]({},_0x339eb5,_0x37755c[_0xf088('0x40')]);var _0x84fc54={'where':_0x339eb5[_0xf088('0x3b')]};return db[_0xf088('0x41')][_0xf088('0x20')](_0x84fc54)['then'](function(_0x4abfd2){_0x23a4af['count']=_0x4abfd2;if(_0x37755c[_0xf088('0x30')][_0xf088('0x42')]){_0x339eb5[_0xf088('0x43')]=[{'all':!![]}];}return db['SquareRecording'][_0xf088('0x44')](_0x339eb5);})['then'](function(_0x177838){_0x23a4af[_0xf088('0x45')]=_0x177838;return _0x23a4af;})[_0xf088('0x25')](respondWithFilteredResult(_0x43a71c,_0x339eb5))['catch'](handleError(_0x43a71c,null));};exports[_0xf088('0x46')]=function(_0x30e79e,_0x3f1892){var _0x28e145={'raw':!![],'where':{'id':_0x30e79e[_0xf088('0x47')]['id']}},_0x35708c={};_0x35708c[_0xf088('0x34')]=_[_0xf088('0x31')](db[_0xf088('0x41')][_0xf088('0x2c')]);_0x35708c[_0xf088('0x30')]=_['keys'](_0x30e79e[_0xf088('0x30')]);_0x35708c[_0xf088('0x32')]=_[_0xf088('0x33')](_0x35708c[_0xf088('0x34')],_0x35708c['query']);_0x28e145[_0xf088('0x35')]=_['intersection'](_0x35708c['model'],qs['fields'](_0x30e79e[_0xf088('0x30')][_0xf088('0x36')]));_0x28e145['attributes']=_0x28e145[_0xf088('0x35')][_0xf088('0x37')]?_0x28e145[_0xf088('0x35')]:_0x35708c['model'];if(_0x30e79e[_0xf088('0x30')]['includeAll']){_0x28e145[_0xf088('0x43')]=[{'all':!![]}];}_0x28e145=_[_0xf088('0x3f')]({},_0x28e145,_0x30e79e['options']);return db[_0xf088('0x41')][_0xf088('0x48')](_0x28e145)[_0xf088('0x25')](handleEntityNotFound(_0x3f1892,null))[_0xf088('0x25')](respondWithResult(_0x3f1892,null))[_0xf088('0x49')](handleError(_0x3f1892,null));};exports[_0xf088('0x4a')]=function(_0x5c296a,_0x3a7dab){return db['SquareRecording'][_0xf088('0x4a')](_0x5c296a[_0xf088('0x4b')],{})[_0xf088('0x25')](respondWithResult(_0x3a7dab,0xc9))[_0xf088('0x49')](handleError(_0x3a7dab,null));};exports[_0xf088('0x24')]=function(_0x2e4de3,_0x5de993){if(_0x2e4de3[_0xf088('0x4b')]['id']){delete _0x2e4de3['body']['id'];}return db[_0xf088('0x41')][_0xf088('0x48')]({'where':{'id':_0x2e4de3[_0xf088('0x47')]['id']}})[_0xf088('0x25')](handleEntityNotFound(_0x5de993,null))['then'](saveUpdates(_0x2e4de3[_0xf088('0x4b')],null))[_0xf088('0x25')](respondWithResult(_0x5de993,null))[_0xf088('0x49')](handleError(_0x5de993,null));};exports[_0xf088('0x4c')]=function(_0x1da433,_0x489376,_0x2fbe90){var _0x5275be=require('../../components/encryptor');var _0x549701=![];var _0x1031ce={};if(_0x1da433[_0xf088('0x30')][_0xf088('0x2e')]&&_0x1da433[_0xf088('0x30')][_0xf088('0x2e')]===_0xf088('0x4d')){_0x1031ce[_0xf088('0x4d')]=_0x1da433[_0xf088('0x47')]['id'];}else{_0x1031ce['id']=_0x1da433[_0xf088('0x47')]['id'];}return db[_0xf088('0x41')][_0xf088('0x48')]({'where':_0x1031ce,'attributes':['id',_0xf088('0x4e'),_0xf088('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x489376,null))['then'](function(_0x314f1a){if(_0x314f1a){var _0x35aeec=_0x314f1a['savePath'];var _0x501442=util[_0xf088('0x50')](_0xf088('0x51'),_0x35aeec);if(fs[_0xf088('0x52')](_0x501442)){_0x549701=!![];return _0x5275be[_0xf088('0x53')](_0x501442,_0x35aeec,config[_0xf088('0x54')][_0xf088('0x55')])['then'](function(){return _0x314f1a;});}return _0x314f1a;}})[_0xf088('0x25')](function(_0x563cd8){if(_0x563cd8){var _0x2dc436=_0x563cd8[_0xf088('0x4e')];if(!fs[_0xf088('0x52')](_0x2dc436)){throw new db[(_0xf088('0x56'))]['ValidationError'](_0xf088('0x57'));}if(_0x563cd8[_0xf088('0x4f')]){return _0x489376[_0xf088('0x4c')](_0x2dc436,_0x563cd8[_0xf088('0x4f')]+path['extname'](_0x2dc436),function(){if(_0x549701){fs[_0xf088('0x58')](_0x2dc436);}});}else{return _0x489376['download'](_0x2dc436,function(_0x3cb082){if(_0x549701){fs[_0xf088('0x58')](_0x2dc436);}});}}})[_0xf088('0x49')](function(_0x4083e7){if(_0x4083e7[_0xf088('0x59')]==='SquareRecording\x20not\x20found'){_0x489376[_0xf088('0x1c')](0x194)[_0xf088('0x29')]('Not\x20found');}else{return handleError(_0x489376,null);}});};exports['destroy']=function(_0x2d8e28,_0x4959b6){return db[_0xf088('0x41')]['find']({'where':{'id':_0x2d8e28['params']['id']}})[_0xf088('0x25')](function(_0x16183f){if(_[_0xf088('0x5a')](_0x16183f)){throw new ReferenceError(_0xf088('0x5b'));}return _0x16183f;})[_0xf088('0x25')](function(_0x2935ad){var _0x1cc33f=_0x2935ad['savePath'];logger[_0xf088('0x5c')]('cancellazione\x20fisica\x20documento\x20%s',_0x1cc33f);if(!_['isNil'](_0x2935ad[_0xf088('0x4e')])&&fs['existsSync'](_0x1cc33f)){logger[_0xf088('0x5c')](_0xf088('0x5d')+_0x1cc33f+_0xf088('0x5e'));fs[_0xf088('0x5f')](_0x1cc33f);}_0x1cc33f=_0x1cc33f+_0xf088('0x60');if(!_[_0xf088('0x5a')](_0x2935ad[_0xf088('0x4e')])&&fs['existsSync'](_0x1cc33f)){logger[_0xf088('0x5c')](_0xf088('0x5d')+_0x1cc33f+_0xf088('0x5e'));fs[_0xf088('0x5f')](_0x1cc33f);}return _0x2935ad;})[_0xf088('0x25')](function(_0x13b5cb){if(!_0x13b5cb)throw new InternalError();return _0x13b5cb[_0xf088('0x26')]();})[_0xf088('0x25')](function(){_0x4959b6[_0xf088('0x1c')](0xcc)['end']();})[_0xf088('0x49')](handleError(_0x4959b6,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 82bdde4..2ab38f5 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 _0x0954=['bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','../../config/logger','api'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0x0954,0x135));var _0x4095=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0x0954[_0x36f47c];return _0x296c55;};'use strict';var _=require(_0x4095('0x0'));var util=require('util');var logger=require(_0x4095('0x1'))(_0x4095('0x2'));var moment=require('moment');var BPromise=require(_0x4095('0x3'));var rp=require(_0x4095('0x4'));var fs=require('fs');var path=require(_0x4095('0x5'));var rimraf=require(_0x4095('0x6'));var config=require(_0x4095('0x7'));var attributes=require(_0x4095('0x8'));module['exports']=function(_0x543154,_0x57ad9c){return _0x543154[_0x4095('0x9')](_0x4095('0xa'),attributes,{'tableName':_0x4095('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf19c=['rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x91b46b,_0x2fd22d){var _0xed7d9e=function(_0x47e700){while(--_0x47e700){_0x91b46b['push'](_0x91b46b['shift']());}};_0xed7d9e(++_0x2fd22d);}(_0xf19c,0x10b));var _0xcf19=function(_0xc73162,_0x1be710){_0xc73162=_0xc73162-0x0;var _0x3fdc74=_0xf19c[_0xc73162];return _0x3fdc74;};'use strict';var _=require(_0xcf19('0x0'));var util=require(_0xcf19('0x1'));var logger=require(_0xcf19('0x2'))('api');var moment=require(_0xcf19('0x3'));var BPromise=require(_0xcf19('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf19('0x5'));var rimraf=require(_0xcf19('0x6'));var config=require(_0xcf19('0x7'));var attributes=require(_0xcf19('0x8'));module[_0xcf19('0x9')]=function(_0x59a408,_0x3d3608){return _0x59a408[_0xcf19('0xa')](_0xcf19('0xb'),attributes,{'tableName':_0xcf19('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 84d40fd..347cb5f 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 _0xdd07=['SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','SquareRecording','options','raw','CreateSquareRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd07,0x123));var _0x7dd0=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xdd07[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x7dd0('0x0'));var util=require(_0x7dd0('0x1'));var moment=require(_0x7dd0('0x2'));var BPromise=require(_0x7dd0('0x3'));var rs=require(_0x7dd0('0x4'));var fs=require('fs');var Redis=require(_0x7dd0('0x5'));var db=require(_0x7dd0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7dd0('0x7'))('rpc');var config=require(_0x7dd0('0x8'));var jayson=require(_0x7dd0('0x9'));var client=jayson['client'][_0x7dd0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ab6e6,_0x21d045,_0x3fa866){return new BPromise(function(_0x21c7c5,_0x2c4793){return client[_0x7dd0('0xb')](_0x1ab6e6,_0x3fa866)[_0x7dd0('0xc')](function(_0xf64db4){logger[_0x7dd0('0xd')](_0x7dd0('0xe'),_0x21d045,_0x7dd0('0xf'));logger[_0x7dd0('0x10')](_0x7dd0('0x11'),_0x21d045,_0x7dd0('0xf'),JSON[_0x7dd0('0x12')](_0xf64db4));if(_0xf64db4['error']){if(_0xf64db4['error'][_0x7dd0('0x13')]===0x1f4){logger[_0x7dd0('0x14')]('SquareRecording,\x20%s,\x20%s',_0x21d045,_0xf64db4['error'][_0x7dd0('0x15')]);return _0x2c4793(_0xf64db4[_0x7dd0('0x14')][_0x7dd0('0x15')]);}logger[_0x7dd0('0x14')]('SquareRecording,\x20%s,\x20%s',_0x21d045,_0xf64db4['error'][_0x7dd0('0x15')]);return _0x21c7c5(_0xf64db4[_0x7dd0('0x14')][_0x7dd0('0x15')]);}else{logger[_0x7dd0('0xd')](_0x7dd0('0xe'),_0x21d045,_0x7dd0('0xf'));_0x21c7c5(_0xf64db4[_0x7dd0('0x16')][_0x7dd0('0x15')]);}})[_0x7dd0('0x17')](function(_0x2c1053){logger[_0x7dd0('0x14')](_0x7dd0('0xe'),_0x21d045,_0x2c1053);_0x2c4793(_0x2c1053);});});}exports['CreateSquareRecording']=function(_0x59ec5c){var _0x1d6830=this;return new Promise(function(_0x23b1bd,_0x441ac1){return db[_0x7dd0('0x18')]['create'](_0x59ec5c['body'],{'raw':_0x59ec5c[_0x7dd0('0x19')]?_0x59ec5c[_0x7dd0('0x19')][_0x7dd0('0x1a')]===undefined?!![]:![]:!![]})[_0x7dd0('0xc')](function(_0x1e6954){logger[_0x7dd0('0xd')](_0x7dd0('0x1b'),_0x59ec5c);logger[_0x7dd0('0x10')](_0x7dd0('0x1b'),_0x59ec5c,JSON[_0x7dd0('0x12')](_0x1e6954));_0x23b1bd(_0x1e6954);})[_0x7dd0('0x17')](function(_0x49d2b6){logger[_0x7dd0('0x14')](_0x7dd0('0x1b'),_0x49d2b6[_0x7dd0('0x15')],_0x59ec5c);_0x441ac1(_0x1d6830[_0x7dd0('0x14')](0x1f4,_0x49d2b6[_0x7dd0('0x15')]));});});}; \ No newline at end of file +var _0xf02e=['../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2fdbdb,_0x3c56b5){var _0x2ba7f9=function(_0x61604d){while(--_0x61604d){_0x2fdbdb['push'](_0x2fdbdb['shift']());}};_0x2ba7f9(++_0x3c56b5);}(_0xf02e,0xc3));var _0xef02=function(_0x24e0db,_0x470cef){_0x24e0db=_0x24e0db-0x0;var _0x514450=_0xf02e[_0x24e0db];return _0x514450;};'use strict';var _=require(_0xef02('0x0'));var util=require('util');var moment=require(_0xef02('0x1'));var BPromise=require(_0xef02('0x2'));var rs=require(_0xef02('0x3'));var fs=require('fs');var Redis=require(_0xef02('0x4'));var db=require(_0xef02('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xef02('0x6'))(_0xef02('0x7'));var config=require(_0xef02('0x8'));var jayson=require(_0xef02('0x9'));var client=jayson[_0xef02('0xa')][_0xef02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x159ef7,_0x1f3aa9,_0x5cf142){return new BPromise(function(_0x15d49b,_0x1d94a6){return client[_0xef02('0xc')](_0x159ef7,_0x5cf142)[_0xef02('0xd')](function(_0x521943){logger['info'](_0xef02('0xe'),_0x1f3aa9,_0xef02('0xf'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x1f3aa9,_0xef02('0xf'),JSON['stringify'](_0x521943));if(_0x521943[_0xef02('0x10')]){if(_0x521943[_0xef02('0x10')][_0xef02('0x11')]===0x1f4){logger[_0xef02('0x10')]('SquareRecording,\x20%s,\x20%s',_0x1f3aa9,_0x521943['error'][_0xef02('0x12')]);return _0x1d94a6(_0x521943['error'][_0xef02('0x12')]);}logger[_0xef02('0x10')](_0xef02('0xe'),_0x1f3aa9,_0x521943[_0xef02('0x10')][_0xef02('0x12')]);return _0x15d49b(_0x521943[_0xef02('0x10')][_0xef02('0x12')]);}else{logger[_0xef02('0x13')](_0xef02('0xe'),_0x1f3aa9,_0xef02('0xf'));_0x15d49b(_0x521943[_0xef02('0x14')]['message']);}})[_0xef02('0x15')](function(_0x1cb429){logger['error'](_0xef02('0xe'),_0x1f3aa9,_0x1cb429);_0x1d94a6(_0x1cb429);});});}exports[_0xef02('0x16')]=function(_0x342492){var _0x3dd966=this;return new Promise(function(_0x258d72,_0x30b76f){return db[_0xef02('0x17')][_0xef02('0x18')](_0x342492[_0xef02('0x19')],{'raw':_0x342492['options']?_0x342492[_0xef02('0x1a')][_0xef02('0x1b')]===undefined?!![]:![]:!![]})[_0xef02('0xd')](function(_0x524921){logger[_0xef02('0x13')](_0xef02('0x16'),_0x342492);logger[_0xef02('0x1c')](_0xef02('0x16'),_0x342492,JSON['stringify'](_0x524921));_0x258d72(_0x524921);})[_0xef02('0x15')](function(_0x238bc9){logger[_0xef02('0x10')](_0xef02('0x16'),_0x238bc9[_0xef02('0x12')],_0x342492);_0x30b76f(_0x3dd966['error'](0x1f4,_0x238bc9[_0xef02('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index d0313a0..9f13b02 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(_0x283e7e,_0x513284){var _0x50b0c6=function(_0x409b0e){while(--_0x409b0e){_0x283e7e['push'](_0x283e7e['shift']());}};_0x50b0c6(++_0x513284);}(_0xe706,0xa3));var _0x6e70=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xe706[_0x2e50a2];return _0x47e5de;};'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(_0x485bad,_0x21c418){var _0x523c91=function(_0x7393a4){while(--_0x7393a4){_0x485bad['push'](_0x485bad['shift']());}};_0x523c91(++_0x21c418);}(_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 15c14f3..c7d2f1e 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 _0xd04f=['exports','STRING','sequelize'];(function(_0x2797d0,_0x3a6a05){var _0x3dfa6d=function(_0x209d12){while(--_0x209d12){_0x2797d0['push'](_0x2797d0['shift']());}};_0x3dfa6d(++_0x3a6a05);}(_0xd04f,0x1d9));var _0xfd04=function(_0x35496e,_0x4a468f){_0x35496e=_0x35496e-0x0;var _0x357746=_0xd04f[_0x35496e];return _0x357746;};'use strict';var Sequelize=require(_0xfd04('0x0'));module[_0xfd04('0x1')]={'network':{'type':Sequelize[_0xfd04('0x2')]},'network_script':{'type':Sequelize[_0xfd04('0x2')]},'request':{'type':Sequelize[_0xfd04('0x2')]},'channel':{'type':Sequelize[_0xfd04('0x2')]},'language':{'type':Sequelize[_0xfd04('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfd04('0x2')]},'version':{'type':Sequelize[_0xfd04('0x2')]},'callerid':{'type':Sequelize[_0xfd04('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xfd04('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xfd04('0x2')]},'dnid':{'type':Sequelize[_0xfd04('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xfd04('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xfd04('0x2')]},'enhanced':{'type':Sequelize[_0xfd04('0x2')]},'accountcode':{'type':Sequelize[_0xfd04('0x2')]},'threadid':{'type':Sequelize[_0xfd04('0x2')]},'project_name':{'type':Sequelize[_0xfd04('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2755=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2755,0xca));var _0x5275=function(_0x17543f,_0x34a3aa){_0x17543f=_0x17543f-0x0;var _0x479c57=_0x2755[_0x17543f];return _0x479c57;};'use strict';var Sequelize=require(_0x5275('0x0'));module[_0x5275('0x1')]={'network':{'type':Sequelize[_0x5275('0x2')]},'network_script':{'type':Sequelize[_0x5275('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5275('0x2')]},'language':{'type':Sequelize[_0x5275('0x2')]},'type':{'type':Sequelize[_0x5275('0x2')]},'uniqueid':{'type':Sequelize[_0x5275('0x2')]},'version':{'type':Sequelize[_0x5275('0x2')]},'callerid':{'type':Sequelize[_0x5275('0x2')]},'calleridname':{'type':Sequelize[_0x5275('0x2')]},'callingpres':{'type':Sequelize[_0x5275('0x2')]},'callingani2':{'type':Sequelize[_0x5275('0x2')]},'callington':{'type':Sequelize[_0x5275('0x2')]},'callingtns':{'type':Sequelize[_0x5275('0x2')]},'dnid':{'type':Sequelize[_0x5275('0x2')]},'rdnis':{'type':Sequelize[_0x5275('0x2')]},'context':{'type':Sequelize[_0x5275('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5275('0x2')]},'enhanced':{'type':Sequelize[_0x5275('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5275('0x3')]},'bot':{'type':Sequelize[_0x5275('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 57cc379..1db2fc3 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 _0xa393=['lodash','crypto','jsforce','desk.js','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','limit','undefined','count','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0xa393,0x11f));var _0x3a39=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xa393[_0x1f36bb];return _0xaf97fa;};'use strict';var emlformat=require(_0x3a39('0x0'));var rimraf=require(_0x3a39('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a39('0x2'));var rp=require(_0x3a39('0x3'));var moment=require(_0x3a39('0x4'));var BPromise=require(_0x3a39('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3a39('0x6'));var ejs=require(_0x3a39('0x7'));var fs=require('fs');var fs_extra=require(_0x3a39('0x8'));var _=require(_0x3a39('0x9'));var squel=require('squel');var crypto=require(_0x3a39('0xa'));var jsforce=require(_0x3a39('0xb'));var deskjs=require(_0x3a39('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3a39('0xd'));var Papa=require(_0x3a39('0xe'));var Redis=require(_0x3a39('0xf'));var authService=require(_0x3a39('0x10'));var qs=require(_0x3a39('0x11'));var as=require(_0x3a39('0x12'));var hardwareService=require(_0x3a39('0x13'));var logger=require('../../config/logger')(_0x3a39('0x14'));var utils=require('../../config/utils');var config=require(_0x3a39('0x15'));var licenseUtil=require(_0x3a39('0x16'));var db=require(_0x3a39('0x17'))['db'];function respondWithStatusCode(_0x21cbcb,_0x1ec2fb){_0x1ec2fb=_0x1ec2fb||0xcc;return function(_0x27e76){if(_0x27e76){return _0x21cbcb[_0x3a39('0x18')](_0x1ec2fb);}return _0x21cbcb[_0x3a39('0x19')](_0x1ec2fb)[_0x3a39('0x1a')]();};}function respondWithResult(_0x2614a0,_0x4f1fa7){_0x4f1fa7=_0x4f1fa7||0xc8;return function(_0x588c2b){if(_0x588c2b){return _0x2614a0[_0x3a39('0x19')](_0x4f1fa7)[_0x3a39('0x1b')](_0x588c2b);}};}function respondWithFilteredResult(_0x2e1b73,_0x5c72aa){return function(_0x50abf0){if(_0x50abf0){var _0x22729e=typeof _0x5c72aa[_0x3a39('0x1c')]==='undefined'&&typeof _0x5c72aa[_0x3a39('0x1d')]===_0x3a39('0x1e');var _0x464995=_0x50abf0[_0x3a39('0x1f')];var _0x37caed=_0x22729e?0x0:_0x5c72aa[_0x3a39('0x1c')];var _0x3b98ce=_0x22729e?_0x50abf0[_0x3a39('0x1f')]:_0x5c72aa[_0x3a39('0x1c')]+_0x5c72aa[_0x3a39('0x1d')];var _0x3c60b6;if(_0x3b98ce>=_0x464995){_0x3b98ce=_0x464995;_0x3c60b6=0xc8;}else{_0x3c60b6=0xce;}_0x2e1b73[_0x3a39('0x19')](_0x3c60b6);return _0x2e1b73['set'](_0x3a39('0x20'),_0x37caed+'-'+_0x3b98ce+'/'+_0x464995)['json'](_0x50abf0);}return null;};}function patchUpdates(_0x32e1da){return function(_0x1382c3){try{jsonpatch[_0x3a39('0x21')](_0x1382c3,_0x32e1da,!![]);}catch(_0x33f9ee){return BPromise['reject'](_0x33f9ee);}return _0x1382c3[_0x3a39('0x22')]();};}function saveUpdates(_0x24815c,_0x312525){return function(_0x5524d5){if(_0x5524d5){return _0x5524d5['update'](_0x24815c)[_0x3a39('0x23')](function(_0x4d70d0){return _0x4d70d0;});}return null;};}function removeEntity(_0x6d92e,_0x410d07){return function(_0x2d9bb3){if(_0x2d9bb3){return _0x2d9bb3[_0x3a39('0x24')]()[_0x3a39('0x23')](function(){_0x6d92e[_0x3a39('0x19')](0xcc)[_0x3a39('0x1a')]();});}};}function handleEntityNotFound(_0x573a4a,_0x3df153){return function(_0x12f6b0){if(!_0x12f6b0){_0x573a4a['sendStatus'](0x194);}return _0x12f6b0;};}function handleError(_0x5bdfb5,_0x344b39){_0x344b39=_0x344b39||0x1f4;return function(_0x13c2af){logger[_0x3a39('0x25')](_0x13c2af[_0x3a39('0x26')]);if(_0x13c2af[_0x3a39('0x27')]){delete _0x13c2af['name'];}_0x5bdfb5[_0x3a39('0x19')](_0x344b39)[_0x3a39('0x28')](_0x13c2af);};}exports[_0x3a39('0x29')]=function(_0x1862f6,_0xda2053){var _0x3fea3b={},_0x285b94={},_0x4d5bf8={'count':0x0,'rows':[]};var _0x210420=_[_0x3a39('0x2a')](db[_0x3a39('0x2b')][_0x3a39('0x2c')],function(_0x5e01aa){return{'name':_0x5e01aa['fieldName'],'type':_0x5e01aa['type'][_0x3a39('0x2d')]};});_0x285b94[_0x3a39('0x2e')]=_[_0x3a39('0x2a')](_0x210420,_0x3a39('0x27'));_0x285b94[_0x3a39('0x2f')]=_[_0x3a39('0x30')](_0x1862f6[_0x3a39('0x2f')]);_0x285b94[_0x3a39('0x31')]=_[_0x3a39('0x32')](_0x285b94[_0x3a39('0x2e')],_0x285b94[_0x3a39('0x2f')]);_0x3fea3b['attributes']=_[_0x3a39('0x32')](_0x285b94[_0x3a39('0x2e')],qs[_0x3a39('0x33')](_0x1862f6[_0x3a39('0x2f')][_0x3a39('0x33')]));_0x3fea3b[_0x3a39('0x34')]=_0x3fea3b[_0x3a39('0x34')]['length']?_0x3fea3b[_0x3a39('0x34')]:_0x285b94[_0x3a39('0x2e')];if(!_0x1862f6[_0x3a39('0x2f')][_0x3a39('0x35')](_0x3a39('0x36'))){_0x3fea3b[_0x3a39('0x1d')]=qs[_0x3a39('0x1d')](_0x1862f6[_0x3a39('0x2f')][_0x3a39('0x1d')]);_0x3fea3b[_0x3a39('0x1c')]=qs[_0x3a39('0x1c')](_0x1862f6[_0x3a39('0x2f')][_0x3a39('0x1c')]);}_0x3fea3b[_0x3a39('0x37')]=qs[_0x3a39('0x38')](_0x1862f6['query'][_0x3a39('0x38')]);_0x3fea3b['where']=qs[_0x3a39('0x31')](_[_0x3a39('0x39')](_0x1862f6[_0x3a39('0x2f')],_0x285b94[_0x3a39('0x31')]),_0x210420);if(_0x1862f6[_0x3a39('0x2f')][_0x3a39('0x3a')]){_0x3fea3b[_0x3a39('0x3b')]=_[_0x3a39('0x3c')](_0x3fea3b[_0x3a39('0x3b')],{'$or':_[_0x3a39('0x2a')](_0x210420,function(_0x4a201b){if(_0x4a201b[_0x3a39('0x3d')]!==_0x3a39('0x3e')){var _0x5cb7db={};_0x5cb7db[_0x4a201b['name']]={'$like':'%'+_0x1862f6['query'][_0x3a39('0x3a')]+'%'};return _0x5cb7db;}})});}_0x3fea3b=_[_0x3a39('0x3c')]({},_0x3fea3b,_0x1862f6[_0x3a39('0x3f')]);var _0x20fdf2={'where':_0x3fea3b[_0x3a39('0x3b')]};return db[_0x3a39('0x2b')][_0x3a39('0x1f')](_0x20fdf2)[_0x3a39('0x23')](function(_0x1fcc82){_0x4d5bf8[_0x3a39('0x1f')]=_0x1fcc82;if(_0x1862f6[_0x3a39('0x2f')][_0x3a39('0x40')]){_0x3fea3b['include']=[{'all':!![]}];}return db[_0x3a39('0x2b')][_0x3a39('0x41')](_0x3fea3b);})[_0x3a39('0x23')](function(_0x14abf7){_0x4d5bf8[_0x3a39('0x42')]=_0x14abf7;return _0x4d5bf8;})[_0x3a39('0x23')](respondWithFilteredResult(_0xda2053,_0x3fea3b))[_0x3a39('0x43')](handleError(_0xda2053,null));};exports[_0x3a39('0x44')]=function(_0x5524fe,_0x3256a7){var _0x2f1041={'raw':!![],'where':{'id':_0x5524fe[_0x3a39('0x45')]['id']}},_0x49e488={};_0x49e488[_0x3a39('0x2e')]=_['keys'](db[_0x3a39('0x2b')][_0x3a39('0x2c')]);_0x49e488['query']=_[_0x3a39('0x30')](_0x5524fe[_0x3a39('0x2f')]);_0x49e488[_0x3a39('0x31')]=_['intersection'](_0x49e488[_0x3a39('0x2e')],_0x49e488[_0x3a39('0x2f')]);_0x2f1041[_0x3a39('0x34')]=_[_0x3a39('0x32')](_0x49e488[_0x3a39('0x2e')],qs[_0x3a39('0x33')](_0x5524fe[_0x3a39('0x2f')][_0x3a39('0x33')]));_0x2f1041[_0x3a39('0x34')]=_0x2f1041[_0x3a39('0x34')]['length']?_0x2f1041['attributes']:_0x49e488[_0x3a39('0x2e')];if(_0x5524fe[_0x3a39('0x2f')]['includeAll']){_0x2f1041[_0x3a39('0x46')]=[{'all':!![]}];}_0x2f1041=_[_0x3a39('0x3c')]({},_0x2f1041,_0x5524fe[_0x3a39('0x3f')]);return db['SquareReport'][_0x3a39('0x47')](_0x2f1041)[_0x3a39('0x23')](handleEntityNotFound(_0x3256a7,null))[_0x3a39('0x23')](respondWithResult(_0x3256a7,null))['catch'](handleError(_0x3256a7,null));};exports[_0x3a39('0x48')]=function(_0x10b7c2,_0x1b4b78){return db[_0x3a39('0x2b')][_0x3a39('0x48')](_0x10b7c2[_0x3a39('0x49')],{})[_0x3a39('0x23')](respondWithResult(_0x1b4b78,0xc9))['catch'](handleError(_0x1b4b78,null));};exports['update']=function(_0x226676,_0x4f3ef2){if(_0x226676[_0x3a39('0x49')]['id']){delete _0x226676['body']['id'];}return db[_0x3a39('0x2b')][_0x3a39('0x47')]({'where':{'id':_0x226676[_0x3a39('0x45')]['id']}})[_0x3a39('0x23')](handleEntityNotFound(_0x4f3ef2,null))[_0x3a39('0x23')](saveUpdates(_0x226676['body'],null))[_0x3a39('0x23')](respondWithResult(_0x4f3ef2,null))[_0x3a39('0x43')](handleError(_0x4f3ef2,null));};exports[_0x3a39('0x24')]=function(_0x1cc77d,_0x2e1d9e){return db[_0x3a39('0x2b')][_0x3a39('0x47')]({'where':{'id':_0x1cc77d[_0x3a39('0x45')]['id']}})[_0x3a39('0x23')](handleEntityNotFound(_0x2e1d9e,null))[_0x3a39('0x23')](removeEntity(_0x2e1d9e,null))['catch'](handleError(_0x2e1d9e,null));};exports['describe']=function(_0x2ce458,_0x5d295f){return db[_0x3a39('0x2b')]['describe']()[_0x3a39('0x23')](respondWithResult(_0x5d295f,null))[_0x3a39('0x43')](handleError(_0x5d295f,null));}; \ No newline at end of file +var _0x8829=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareReport','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x8829,0xcf));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9882('0x0'));var zipdir=require(_0x9882('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9882('0x2'));var moment=require(_0x9882('0x3'));var BPromise=require(_0x9882('0x4'));var Mustache=require(_0x9882('0x5'));var util=require(_0x9882('0x6'));var path=require(_0x9882('0x7'));var sox=require('sox');var csv=require(_0x9882('0x8'));var ejs=require(_0x9882('0x9'));var fs=require('fs');var fs_extra=require(_0x9882('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9882('0xb'));var jsforce=require(_0x9882('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9882('0x8'));var querystring=require(_0x9882('0xd'));var Papa=require(_0x9882('0xe'));var Redis=require(_0x9882('0xf'));var authService=require(_0x9882('0x10'));var qs=require(_0x9882('0x11'));var as=require(_0x9882('0x12'));var hardwareService=require(_0x9882('0x13'));var logger=require(_0x9882('0x14'))(_0x9882('0x15'));var utils=require(_0x9882('0x16'));var config=require(_0x9882('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9882('0x18'))['db'];function respondWithStatusCode(_0xec8ea6,_0x46e1cc){_0x46e1cc=_0x46e1cc||0xcc;return function(_0x359556){if(_0x359556){return _0xec8ea6[_0x9882('0x19')](_0x46e1cc);}return _0xec8ea6[_0x9882('0x1a')](_0x46e1cc)[_0x9882('0x1b')]();};}function respondWithResult(_0x35fd97,_0x1f90c5){_0x1f90c5=_0x1f90c5||0xc8;return function(_0x4fef14){if(_0x4fef14){return _0x35fd97[_0x9882('0x1a')](_0x1f90c5)[_0x9882('0x1c')](_0x4fef14);}};}function respondWithFilteredResult(_0x2d5baa,_0x35c115){return function(_0x25579c){if(_0x25579c){var _0x422473=typeof _0x35c115[_0x9882('0x1d')]===_0x9882('0x1e')&&typeof _0x35c115['limit']===_0x9882('0x1e');var _0x163054=_0x25579c[_0x9882('0x1f')];var _0x192aba=_0x422473?0x0:_0x35c115[_0x9882('0x1d')];var _0x35f23b=_0x422473?_0x25579c[_0x9882('0x1f')]:_0x35c115[_0x9882('0x1d')]+_0x35c115[_0x9882('0x20')];var _0x56da89;if(_0x35f23b>=_0x163054){_0x35f23b=_0x163054;_0x56da89=0xc8;}else{_0x56da89=0xce;}_0x2d5baa['status'](_0x56da89);return _0x2d5baa[_0x9882('0x21')](_0x9882('0x22'),_0x192aba+'-'+_0x35f23b+'/'+_0x163054)['json'](_0x25579c);}return null;};}function patchUpdates(_0x451ca5){return function(_0x2e67e6){try{jsonpatch[_0x9882('0x23')](_0x2e67e6,_0x451ca5,!![]);}catch(_0x40c252){return BPromise[_0x9882('0x24')](_0x40c252);}return _0x2e67e6[_0x9882('0x25')]();};}function saveUpdates(_0x5bd27f,_0x4b7b5d){return function(_0x24b67f){if(_0x24b67f){return _0x24b67f[_0x9882('0x26')](_0x5bd27f)[_0x9882('0x27')](function(_0x38fa7b){return _0x38fa7b;});}return null;};}function removeEntity(_0x5201b7,_0x56db60){return function(_0xd60194){if(_0xd60194){return _0xd60194[_0x9882('0x28')]()[_0x9882('0x27')](function(){_0x5201b7[_0x9882('0x1a')](0xcc)[_0x9882('0x1b')]();});}};}function handleEntityNotFound(_0x3be835,_0x2eefcc){return function(_0x367863){if(!_0x367863){_0x3be835[_0x9882('0x19')](0x194);}return _0x367863;};}function handleError(_0xec7da2,_0x169876){_0x169876=_0x169876||0x1f4;return function(_0x50f0c9){logger[_0x9882('0x29')](_0x50f0c9[_0x9882('0x2a')]);if(_0x50f0c9[_0x9882('0x2b')]){delete _0x50f0c9[_0x9882('0x2b')];}_0xec7da2[_0x9882('0x1a')](_0x169876)[_0x9882('0x2c')](_0x50f0c9);};}exports[_0x9882('0x2d')]=function(_0x24f4fc,_0x2c2cc9){var _0x394d72={},_0x22a6de={},_0x400a08={'count':0x0,'rows':[]};var _0x4d87bc=_['map'](db[_0x9882('0x2e')]['rawAttributes'],function(_0x1839a2){return{'name':_0x1839a2[_0x9882('0x2f')],'type':_0x1839a2[_0x9882('0x30')]['key']};});_0x22a6de[_0x9882('0x31')]=_['map'](_0x4d87bc,_0x9882('0x2b'));_0x22a6de[_0x9882('0x32')]=_['keys'](_0x24f4fc[_0x9882('0x32')]);_0x22a6de[_0x9882('0x33')]=_[_0x9882('0x34')](_0x22a6de['model'],_0x22a6de[_0x9882('0x32')]);_0x394d72[_0x9882('0x35')]=_[_0x9882('0x34')](_0x22a6de[_0x9882('0x31')],qs[_0x9882('0x36')](_0x24f4fc['query']['fields']));_0x394d72['attributes']=_0x394d72['attributes'][_0x9882('0x37')]?_0x394d72[_0x9882('0x35')]:_0x22a6de['model'];if(!_0x24f4fc[_0x9882('0x32')][_0x9882('0x38')](_0x9882('0x39'))){_0x394d72[_0x9882('0x20')]=qs[_0x9882('0x20')](_0x24f4fc[_0x9882('0x32')][_0x9882('0x20')]);_0x394d72[_0x9882('0x1d')]=qs['offset'](_0x24f4fc[_0x9882('0x32')][_0x9882('0x1d')]);}_0x394d72[_0x9882('0x3a')]=qs[_0x9882('0x3b')](_0x24f4fc[_0x9882('0x32')][_0x9882('0x3b')]);_0x394d72[_0x9882('0x3c')]=qs[_0x9882('0x33')](_[_0x9882('0x3d')](_0x24f4fc['query'],_0x22a6de['filters']),_0x4d87bc);if(_0x24f4fc[_0x9882('0x32')][_0x9882('0x3e')]){_0x394d72['where']=_[_0x9882('0x3f')](_0x394d72['where'],{'$or':_[_0x9882('0x40')](_0x4d87bc,function(_0x43734b){if(_0x43734b['type']!==_0x9882('0x41')){var _0x34324d={};_0x34324d[_0x43734b['name']]={'$like':'%'+_0x24f4fc[_0x9882('0x32')][_0x9882('0x3e')]+'%'};return _0x34324d;}})});}_0x394d72=_['merge']({},_0x394d72,_0x24f4fc[_0x9882('0x42')]);var _0x538155={'where':_0x394d72[_0x9882('0x3c')]};return db[_0x9882('0x2e')][_0x9882('0x1f')](_0x538155)['then'](function(_0x1e6ff8){_0x400a08[_0x9882('0x1f')]=_0x1e6ff8;if(_0x24f4fc['query'][_0x9882('0x43')]){_0x394d72[_0x9882('0x44')]=[{'all':!![]}];}return db['SquareReport'][_0x9882('0x45')](_0x394d72);})[_0x9882('0x27')](function(_0x1537fb){_0x400a08[_0x9882('0x46')]=_0x1537fb;return _0x400a08;})[_0x9882('0x27')](respondWithFilteredResult(_0x2c2cc9,_0x394d72))[_0x9882('0x47')](handleError(_0x2c2cc9,null));};exports[_0x9882('0x48')]=function(_0x3df37b,_0x3b4194){var _0x3e883b={'raw':!![],'where':{'id':_0x3df37b[_0x9882('0x49')]['id']}},_0x1edf39={};_0x1edf39[_0x9882('0x31')]=_['keys'](db[_0x9882('0x2e')][_0x9882('0x4a')]);_0x1edf39[_0x9882('0x32')]=_['keys'](_0x3df37b[_0x9882('0x32')]);_0x1edf39['filters']=_[_0x9882('0x34')](_0x1edf39['model'],_0x1edf39['query']);_0x3e883b['attributes']=_[_0x9882('0x34')](_0x1edf39[_0x9882('0x31')],qs[_0x9882('0x36')](_0x3df37b[_0x9882('0x32')]['fields']));_0x3e883b[_0x9882('0x35')]=_0x3e883b['attributes'][_0x9882('0x37')]?_0x3e883b[_0x9882('0x35')]:_0x1edf39[_0x9882('0x31')];if(_0x3df37b[_0x9882('0x32')][_0x9882('0x43')]){_0x3e883b[_0x9882('0x44')]=[{'all':!![]}];}_0x3e883b=_[_0x9882('0x3f')]({},_0x3e883b,_0x3df37b[_0x9882('0x42')]);return db['SquareReport'][_0x9882('0x4b')](_0x3e883b)[_0x9882('0x27')](handleEntityNotFound(_0x3b4194,null))[_0x9882('0x27')](respondWithResult(_0x3b4194,null))['catch'](handleError(_0x3b4194,null));};exports['create']=function(_0x373ae8,_0x2c1237){return db[_0x9882('0x2e')][_0x9882('0x4c')](_0x373ae8['body'],{})[_0x9882('0x27')](respondWithResult(_0x2c1237,0xc9))[_0x9882('0x47')](handleError(_0x2c1237,null));};exports[_0x9882('0x26')]=function(_0x4f5590,_0x1636c7){if(_0x4f5590['body']['id']){delete _0x4f5590['body']['id'];}return db['SquareReport'][_0x9882('0x4b')]({'where':{'id':_0x4f5590[_0x9882('0x49')]['id']}})['then'](handleEntityNotFound(_0x1636c7,null))[_0x9882('0x27')](saveUpdates(_0x4f5590[_0x9882('0x4d')],null))[_0x9882('0x27')](respondWithResult(_0x1636c7,null))['catch'](handleError(_0x1636c7,null));};exports[_0x9882('0x28')]=function(_0x3aa153,_0x3f0872){return db[_0x9882('0x2e')][_0x9882('0x4b')]({'where':{'id':_0x3aa153[_0x9882('0x49')]['id']}})[_0x9882('0x27')](handleEntityNotFound(_0x3f0872,null))[_0x9882('0x27')](removeEntity(_0x3f0872,null))[_0x9882('0x47')](handleError(_0x3f0872,null));};exports[_0x9882('0x4e')]=function(_0xff6d18,_0x11f10b){return db['SquareReport'][_0x9882('0x4e')]()[_0x9882('0x27')](respondWithResult(_0x11f10b,null))['catch'](handleError(_0x11f10b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index de3afc9..99186f2 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 _0x4c78=['moment','bluebird','request-promise','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','api'];(function(_0x4f75b5,_0x4db76d){var _0x5c263b=function(_0x31e622){while(--_0x31e622){_0x4f75b5['push'](_0x4f75b5['shift']());}};_0x5c263b(++_0x4db76d);}(_0x4c78,0x1cd));var _0x84c7=function(_0x308f0e,_0x233ecf){_0x308f0e=_0x308f0e-0x0;var _0x3ef423=_0x4c78[_0x308f0e];return _0x3ef423;};'use strict';var _=require(_0x84c7('0x0'));var util=require('util');var logger=require(_0x84c7('0x1'))(_0x84c7('0x2'));var moment=require(_0x84c7('0x3'));var BPromise=require(_0x84c7('0x4'));var rp=require(_0x84c7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x84c7('0x6'));var attributes=require(_0x84c7('0x7'));module[_0x84c7('0x8')]=function(_0x1ecbe9,_0x333979){return _0x1ecbe9[_0x84c7('0x9')](_0x84c7('0xa'),attributes,{'tableName':_0x84c7('0xb'),'paranoid':![],'indexes':[{'name':_0x84c7('0xc'),'fields':[_0x84c7('0xd'),_0x84c7('0xe')]},{'name':_0x84c7('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7671=['../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x7c3553,_0x58020e){var _0x3d2fc5=function(_0x1197d1){while(--_0x1197d1){_0x7c3553['push'](_0x7c3553['shift']());}};_0x3d2fc5(++_0x58020e);}(_0x7671,0x1d9));var _0x1767=function(_0x192add,_0x4490e4){_0x192add=_0x192add-0x0;var _0x1b9d9d=_0x7671[_0x192add];return _0x1b9d9d;};'use strict';var _=require(_0x1767('0x0'));var util=require(_0x1767('0x1'));var logger=require('../../config/logger')(_0x1767('0x2'));var moment=require(_0x1767('0x3'));var BPromise=require(_0x1767('0x4'));var rp=require(_0x1767('0x5'));var fs=require('fs');var path=require(_0x1767('0x6'));var rimraf=require('rimraf');var config=require(_0x1767('0x7'));var attributes=require(_0x1767('0x8'));module[_0x1767('0x9')]=function(_0xde6673,_0x464b95){return _0xde6673['define'](_0x1767('0xa'),attributes,{'tableName':_0x1767('0xb'),'paranoid':![],'indexes':[{'name':_0x1767('0xc'),'fields':['uniqueid',_0x1767('0xd')]},{'name':_0x1767('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 36f8b52..39c0713 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 _0xa528=['UpdateSquareReport','SquareReport','update','body','where','attributes','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','SquareReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareReport','options','raw'];(function(_0x35b082,_0x411b54){var _0x2c589c=function(_0x5ff13c){while(--_0x5ff13c){_0x35b082['push'](_0x35b082['shift']());}};_0x2c589c(++_0x411b54);}(_0xa528,0x19a));var _0x8a52=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0xa528[_0x561f25];return _0x150e4c;};'use strict';var _=require(_0x8a52('0x0'));var util=require('util');var moment=require(_0x8a52('0x1'));var BPromise=require(_0x8a52('0x2'));var rs=require(_0x8a52('0x3'));var fs=require('fs');var Redis=require(_0x8a52('0x4'));var db=require(_0x8a52('0x5'))['db'];var utils=require(_0x8a52('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8a52('0x7'));var client=jayson[_0x8a52('0x8')][_0x8a52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18bcd8,_0x2b1eb4,_0x1cece5){return new BPromise(function(_0x589912,_0x153e41){return client['request'](_0x18bcd8,_0x1cece5)[_0x8a52('0xa')](function(_0x5a0396){logger['info']('SquareReport,\x20%s,\x20%s',_0x2b1eb4,_0x8a52('0xb'));logger[_0x8a52('0xc')](_0x8a52('0xd'),_0x2b1eb4,_0x8a52('0xb'),JSON['stringify'](_0x5a0396));if(_0x5a0396[_0x8a52('0xe')]){if(_0x5a0396['error'][_0x8a52('0xf')]===0x1f4){logger['error'](_0x8a52('0x10'),_0x2b1eb4,_0x5a0396['error']['message']);return _0x153e41(_0x5a0396[_0x8a52('0xe')][_0x8a52('0x11')]);}logger['error'](_0x8a52('0x10'),_0x2b1eb4,_0x5a0396[_0x8a52('0xe')][_0x8a52('0x11')]);return _0x589912(_0x5a0396[_0x8a52('0xe')]['message']);}else{logger[_0x8a52('0x12')](_0x8a52('0x10'),_0x2b1eb4,'request\x20sent');_0x589912(_0x5a0396[_0x8a52('0x13')][_0x8a52('0x11')]);}})[_0x8a52('0x14')](function(_0x404d19){logger[_0x8a52('0xe')](_0x8a52('0x10'),_0x2b1eb4,_0x404d19);_0x153e41(_0x404d19);});});}exports[_0x8a52('0x15')]=function(_0x40fc42){var _0x25730f=this;return new Promise(function(_0x559814,_0x45af08){return db['SquareReport']['create'](_0x40fc42['body'],{'raw':_0x40fc42[_0x8a52('0x16')]?_0x40fc42[_0x8a52('0x16')][_0x8a52('0x17')]===undefined?!![]:![]:!![]})[_0x8a52('0xa')](function(_0x260764){logger['info'](_0x8a52('0x15'),_0x40fc42);logger['debug'](_0x8a52('0x15'),_0x40fc42,JSON['stringify'](_0x260764));_0x559814(_0x260764);})[_0x8a52('0x14')](function(_0x78f8ae){logger[_0x8a52('0xe')](_0x8a52('0x15'),_0x78f8ae[_0x8a52('0x11')],_0x40fc42);_0x45af08(_0x25730f[_0x8a52('0xe')](0x1f4,_0x78f8ae[_0x8a52('0x11')]));});});};exports[_0x8a52('0x18')]=function(_0xfb008e){var _0x327c69=this;return new Promise(function(_0x3ac64c,_0x94fc1d){return db[_0x8a52('0x19')][_0x8a52('0x1a')](_0xfb008e[_0x8a52('0x1b')],{'raw':_0xfb008e['options']?_0xfb008e['options'][_0x8a52('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfb008e[_0x8a52('0x16')]?_0xfb008e[_0x8a52('0x16')][_0x8a52('0x1c')]||null:null,'attributes':_0xfb008e[_0x8a52('0x16')]?_0xfb008e[_0x8a52('0x16')][_0x8a52('0x1d')]||null:null,'limit':_0xfb008e[_0x8a52('0x16')]?_0xfb008e['options']['limit']||null:null})['then'](function(_0x3e771c){logger['info'](_0x8a52('0x18'),_0xfb008e);logger['debug'](_0x8a52('0x18'),_0xfb008e,JSON[_0x8a52('0x1e')](_0x3e771c));_0x3ac64c(_0x3e771c);})[_0x8a52('0x14')](function(_0x5cd81b){logger[_0x8a52('0xe')](_0x8a52('0x18'),_0x5cd81b[_0x8a52('0x11')],_0xfb008e);_0x94fc1d(_0x327c69[_0x8a52('0xe')](0x1f4,_0x5cd81b[_0x8a52('0x11')]));});});}; \ No newline at end of file +var _0xa6cd=['limit','then','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareReport','body','options','raw','UpdateSquareReport','update','where','attributes'];(function(_0x3712e2,_0x32d752){var _0x1faff4=function(_0x550dc0){while(--_0x550dc0){_0x3712e2['push'](_0x3712e2['shift']());}};_0x1faff4(++_0x32d752);}(_0xa6cd,0x110));var _0xda6c=function(_0x5f1498,_0x1295b2){_0x5f1498=_0x5f1498-0x0;var _0x3db54e=_0xa6cd[_0x5f1498];return _0x3db54e;};'use strict';var _=require(_0xda6c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xda6c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda6c('0x2'));var db=require(_0xda6c('0x3'))['db'];var utils=require(_0xda6c('0x4'));var logger=require(_0xda6c('0x5'))('rpc');var config=require(_0xda6c('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14598f,_0x3eb2c6,_0x397dd8){return new BPromise(function(_0x4da0c0,_0x15dfec){return client[_0xda6c('0x7')](_0x14598f,_0x397dd8)['then'](function(_0x45284f){logger[_0xda6c('0x8')](_0xda6c('0x9'),_0x3eb2c6,_0xda6c('0xa'));logger[_0xda6c('0xb')](_0xda6c('0xc'),_0x3eb2c6,_0xda6c('0xa'),JSON[_0xda6c('0xd')](_0x45284f));if(_0x45284f['error']){if(_0x45284f[_0xda6c('0xe')]['code']===0x1f4){logger[_0xda6c('0xe')](_0xda6c('0x9'),_0x3eb2c6,_0x45284f['error'][_0xda6c('0xf')]);return _0x15dfec(_0x45284f[_0xda6c('0xe')]['message']);}logger['error'](_0xda6c('0x9'),_0x3eb2c6,_0x45284f[_0xda6c('0xe')][_0xda6c('0xf')]);return _0x4da0c0(_0x45284f['error'][_0xda6c('0xf')]);}else{logger[_0xda6c('0x8')](_0xda6c('0x9'),_0x3eb2c6,_0xda6c('0xa'));_0x4da0c0(_0x45284f['result']['message']);}})[_0xda6c('0x10')](function(_0x50cd52){logger[_0xda6c('0xe')](_0xda6c('0x9'),_0x3eb2c6,_0x50cd52);_0x15dfec(_0x50cd52);});});}exports[_0xda6c('0x11')]=function(_0x5ee3d8){var _0x5694d9=this;return new Promise(function(_0x1cc1c6,_0x5d215a){return db['SquareReport']['create'](_0x5ee3d8[_0xda6c('0x12')],{'raw':_0x5ee3d8['options']?_0x5ee3d8[_0xda6c('0x13')][_0xda6c('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x43d691){logger[_0xda6c('0x8')](_0xda6c('0x11'),_0x5ee3d8);logger[_0xda6c('0xb')](_0xda6c('0x11'),_0x5ee3d8,JSON[_0xda6c('0xd')](_0x43d691));_0x1cc1c6(_0x43d691);})['catch'](function(_0x329b57){logger[_0xda6c('0xe')](_0xda6c('0x11'),_0x329b57[_0xda6c('0xf')],_0x5ee3d8);_0x5d215a(_0x5694d9[_0xda6c('0xe')](0x1f4,_0x329b57[_0xda6c('0xf')]));});});};exports[_0xda6c('0x15')]=function(_0x4d2931){var _0x447ab5=this;return new Promise(function(_0x4e901f,_0x1db895){return db['SquareReport'][_0xda6c('0x16')](_0x4d2931[_0xda6c('0x12')],{'raw':_0x4d2931[_0xda6c('0x13')]?_0x4d2931[_0xda6c('0x13')][_0xda6c('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d2931[_0xda6c('0x13')]?_0x4d2931['options'][_0xda6c('0x17')]||null:null,'attributes':_0x4d2931[_0xda6c('0x13')]?_0x4d2931[_0xda6c('0x13')][_0xda6c('0x18')]||null:null,'limit':_0x4d2931[_0xda6c('0x13')]?_0x4d2931[_0xda6c('0x13')][_0xda6c('0x19')]||null:null})[_0xda6c('0x1a')](function(_0x5722d0){logger[_0xda6c('0x8')](_0xda6c('0x15'),_0x4d2931);logger[_0xda6c('0xb')](_0xda6c('0x15'),_0x4d2931,JSON['stringify'](_0x5722d0));_0x4e901f(_0x5722d0);})[_0xda6c('0x10')](function(_0x182eb7){logger[_0xda6c('0xe')](_0xda6c('0x15'),_0x182eb7[_0xda6c('0xf')],_0x4d2931);_0x1db895(_0x447ab5[_0xda6c('0xe')](0x1f4,_0x182eb7[_0xda6c('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 985becb..bbb2c81 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 _0x4fc1=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','index','get','/describe','describe','/:id','isAuthenticated','show','post','create','put','update'];(function(_0xb9622e,_0x91225d){var _0x12969e=function(_0x5e8b52){while(--_0x5e8b52){_0xb9622e['push'](_0xb9622e['shift']());}};_0x12969e(++_0x91225d);}(_0x4fc1,0x157));var _0x14fc=function(_0x31bf34,_0x4f7be3){_0x31bf34=_0x31bf34-0x0;var _0x2bb4dc=_0x4fc1[_0x31bf34];return _0x2bb4dc;};'use strict';var multer=require(_0x14fc('0x0'));var util=require(_0x14fc('0x1'));var path=require(_0x14fc('0x2'));var timeout=require(_0x14fc('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x14fc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x14fc('0x5'));var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x14fc('0x6')]);router[_0x14fc('0x7')](_0x14fc('0x8'),auth['isAuthenticated'](),controller[_0x14fc('0x9')]);router['get'](_0x14fc('0xa'),auth[_0x14fc('0xb')](),controller[_0x14fc('0xc')]);router[_0x14fc('0xd')]('/',auth['isAuthenticated'](),controller[_0x14fc('0xe')]);router[_0x14fc('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x14fc('0x10')]);router[_0x14fc('0x11')]('/:id',auth[_0x14fc('0xb')](),controller[_0x14fc('0x12')]);module[_0x14fc('0x13')]=router; \ No newline at end of file +var _0x6a10=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6a10,0x6a));var _0x06a1=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x6a10[_0x3c8e9a];return _0x2d4c57;};'use strict';var multer=require(_0x06a1('0x0'));var util=require(_0x06a1('0x1'));var path=require(_0x06a1('0x2'));var timeout=require(_0x06a1('0x3'));var express=require(_0x06a1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x06a1('0x5'));var interaction=require(_0x06a1('0x6'));var config=require(_0x06a1('0x7'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x06a1('0x8')](),controller[_0x06a1('0x9')]);router[_0x06a1('0xa')](_0x06a1('0xb'),auth[_0x06a1('0x8')](),controller[_0x06a1('0xc')]);router[_0x06a1('0xa')]('/:id',auth[_0x06a1('0x8')](),controller['show']);router['post']('/',auth[_0x06a1('0x8')](),controller[_0x06a1('0xd')]);router[_0x06a1('0xe')](_0x06a1('0xf'),auth[_0x06a1('0x8')](),controller[_0x06a1('0x10')]);router[_0x06a1('0x11')](_0x06a1('0xf'),auth[_0x06a1('0x8')](),controller[_0x06a1('0x12')]);module[_0x06a1('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 79bbd98..48e7477 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 _0xc326=['sequelize','exports','STRING','TEXT'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0xc326,0x138));var _0x6c32=function(_0x1b4f21,_0x11fd2f){_0x1b4f21=_0x1b4f21-0x0;var _0x29e871=_0xc326[_0x1b4f21];return _0x29e871;};'use strict';var Sequelize=require(_0x6c32('0x0'));module[_0x6c32('0x1')]={'uniqueid':{'type':Sequelize[_0x6c32('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x6c32('0x2')]},'data':{'type':Sequelize[_0x6c32('0x3')]},'project_name':{'type':Sequelize[_0x6c32('0x2')]},'callerid':{'type':Sequelize[_0x6c32('0x2')]}}; \ No newline at end of file +var _0xd5cc=['exports','STRING','TEXT','sequelize'];(function(_0x4936f9,_0x30b15c){var _0xfc53b7=function(_0x23f3a7){while(--_0x23f3a7){_0x4936f9['push'](_0x4936f9['shift']());}};_0xfc53b7(++_0x30b15c);}(_0xd5cc,0xbb));var _0xcd5c=function(_0x31f431,_0x1002be){_0x31f431=_0x31f431-0x0;var _0x1a6956=_0xd5cc[_0x31f431];return _0x1a6956;};'use strict';var Sequelize=require(_0xcd5c('0x0'));module[_0xcd5c('0x1')]={'uniqueid':{'type':Sequelize[_0xcd5c('0x2')]},'node':{'type':Sequelize[_0xcd5c('0x2')]},'application':{'type':Sequelize[_0xcd5c('0x2')]},'data':{'type':Sequelize[_0xcd5c('0x3')]},'project_name':{'type':Sequelize[_0xcd5c('0x2')]},'callerid':{'type':Sequelize[_0xcd5c('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 9cd46a9..d1d90ef 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 _0xfbd5=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','SquareDetailsReport','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','catch','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x34c6fd,_0x422e41){var _0x129d3d=function(_0x1f92c1){while(--_0x1f92c1){_0x34c6fd['push'](_0x34c6fd['shift']());}};_0x129d3d(++_0x422e41);}(_0xfbd5,0x7e));var _0x5fbd=function(_0x13b5b2,_0x514cc6){_0x13b5b2=_0x13b5b2-0x0;var _0x46d405=_0xfbd5[_0x13b5b2];return _0x46d405;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fbd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5fbd('0x1'));var rp=require('request-promise');var moment=require(_0x5fbd('0x2'));var BPromise=require(_0x5fbd('0x3'));var Mustache=require(_0x5fbd('0x4'));var util=require(_0x5fbd('0x5'));var path=require(_0x5fbd('0x6'));var sox=require(_0x5fbd('0x7'));var csv=require(_0x5fbd('0x8'));var ejs=require(_0x5fbd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fbd('0xa'));var squel=require(_0x5fbd('0xb'));var crypto=require('crypto');var jsforce=require(_0x5fbd('0xc'));var deskjs=require(_0x5fbd('0xd'));var toCsv=require(_0x5fbd('0x8'));var querystring=require(_0x5fbd('0xe'));var Papa=require(_0x5fbd('0xf'));var Redis=require(_0x5fbd('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5fbd('0x11'));var hardwareService=require(_0x5fbd('0x12'));var logger=require(_0x5fbd('0x13'))(_0x5fbd('0x14'));var utils=require(_0x5fbd('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5fbd('0x16'))['db'];function respondWithStatusCode(_0x4ab436,_0x36a9e3){_0x36a9e3=_0x36a9e3||0xcc;return function(_0x1381cd){if(_0x1381cd){return _0x4ab436[_0x5fbd('0x17')](_0x36a9e3);}return _0x4ab436[_0x5fbd('0x18')](_0x36a9e3)[_0x5fbd('0x19')]();};}function respondWithResult(_0x4035ce,_0x40f09d){_0x40f09d=_0x40f09d||0xc8;return function(_0x1b6bc8){if(_0x1b6bc8){return _0x4035ce[_0x5fbd('0x18')](_0x40f09d)[_0x5fbd('0x1a')](_0x1b6bc8);}};}function respondWithFilteredResult(_0x38ca9a,_0xecfad1){return function(_0x5f3f90){if(_0x5f3f90){var _0x1245b4=typeof _0xecfad1[_0x5fbd('0x1b')]==='undefined'&&typeof _0xecfad1['limit']===_0x5fbd('0x1c');var _0x10f939=_0x5f3f90[_0x5fbd('0x1d')];var _0x2f53f6=_0x1245b4?0x0:_0xecfad1[_0x5fbd('0x1b')];var _0x3ac8d0=_0x1245b4?_0x5f3f90[_0x5fbd('0x1d')]:_0xecfad1[_0x5fbd('0x1b')]+_0xecfad1[_0x5fbd('0x1e')];var _0x459f5d;if(_0x3ac8d0>=_0x10f939){_0x3ac8d0=_0x10f939;_0x459f5d=0xc8;}else{_0x459f5d=0xce;}_0x38ca9a['status'](_0x459f5d);return _0x38ca9a[_0x5fbd('0x1f')](_0x5fbd('0x20'),_0x2f53f6+'-'+_0x3ac8d0+'/'+_0x10f939)['json'](_0x5f3f90);}return null;};}function patchUpdates(_0x148902){return function(_0x8888d1){try{jsonpatch[_0x5fbd('0x21')](_0x8888d1,_0x148902,!![]);}catch(_0x58d458){return BPromise[_0x5fbd('0x22')](_0x58d458);}return _0x8888d1[_0x5fbd('0x23')]();};}function saveUpdates(_0x5f21d6,_0x21a4ba){return function(_0x35afe1){if(_0x35afe1){return _0x35afe1[_0x5fbd('0x24')](_0x5f21d6)[_0x5fbd('0x25')](function(_0x124962){return _0x124962;});}return null;};}function removeEntity(_0x2d0550,_0x5cb89c){return function(_0x1669e4){if(_0x1669e4){return _0x1669e4[_0x5fbd('0x26')]()[_0x5fbd('0x25')](function(){_0x2d0550['status'](0xcc)[_0x5fbd('0x19')]();});}};}function handleEntityNotFound(_0x352c1f,_0x35d284){return function(_0x58357a){if(!_0x58357a){_0x352c1f[_0x5fbd('0x17')](0x194);}return _0x58357a;};}function handleError(_0xe7fece,_0x4ba541){_0x4ba541=_0x4ba541||0x1f4;return function(_0x22e397){logger[_0x5fbd('0x27')](_0x22e397[_0x5fbd('0x28')]);if(_0x22e397[_0x5fbd('0x29')]){delete _0x22e397[_0x5fbd('0x29')];}_0xe7fece[_0x5fbd('0x18')](_0x4ba541)[_0x5fbd('0x2a')](_0x22e397);};}exports[_0x5fbd('0x2b')]=function(_0x25ba65,_0x48898b){var _0x3bb223={},_0x29e3e5={},_0x5a99b3={'count':0x0,'rows':[]};var _0x3cb464=_[_0x5fbd('0x2c')](db['SquareDetailsReport']['rawAttributes'],function(_0x12de0e){return{'name':_0x12de0e[_0x5fbd('0x2d')],'type':_0x12de0e[_0x5fbd('0x2e')][_0x5fbd('0x2f')]};});_0x29e3e5[_0x5fbd('0x30')]=_[_0x5fbd('0x2c')](_0x3cb464,_0x5fbd('0x29'));_0x29e3e5['query']=_[_0x5fbd('0x31')](_0x25ba65[_0x5fbd('0x32')]);_0x29e3e5['filters']=_[_0x5fbd('0x33')](_0x29e3e5['model'],_0x29e3e5[_0x5fbd('0x32')]);_0x3bb223['attributes']=_[_0x5fbd('0x33')](_0x29e3e5[_0x5fbd('0x30')],qs[_0x5fbd('0x34')](_0x25ba65[_0x5fbd('0x32')][_0x5fbd('0x34')]));_0x3bb223[_0x5fbd('0x35')]=_0x3bb223[_0x5fbd('0x35')][_0x5fbd('0x36')]?_0x3bb223[_0x5fbd('0x35')]:_0x29e3e5[_0x5fbd('0x30')];if(!_0x25ba65[_0x5fbd('0x32')][_0x5fbd('0x37')](_0x5fbd('0x38'))){_0x3bb223[_0x5fbd('0x1e')]=qs[_0x5fbd('0x1e')](_0x25ba65['query'][_0x5fbd('0x1e')]);_0x3bb223[_0x5fbd('0x1b')]=qs[_0x5fbd('0x1b')](_0x25ba65[_0x5fbd('0x32')][_0x5fbd('0x1b')]);}_0x3bb223[_0x5fbd('0x39')]=qs['sort'](_0x25ba65['query'][_0x5fbd('0x3a')]);_0x3bb223[_0x5fbd('0x3b')]=qs[_0x5fbd('0x3c')](_['pick'](_0x25ba65['query'],_0x29e3e5[_0x5fbd('0x3c')]),_0x3cb464);if(_0x25ba65[_0x5fbd('0x32')]['filter']){_0x3bb223[_0x5fbd('0x3b')]=_[_0x5fbd('0x3d')](_0x3bb223[_0x5fbd('0x3b')],{'$or':_['map'](_0x3cb464,function(_0x2a11dd){if(_0x2a11dd[_0x5fbd('0x2e')]!=='VIRTUAL'){var _0x380e3b={};_0x380e3b[_0x2a11dd[_0x5fbd('0x29')]]={'$like':'%'+_0x25ba65['query'][_0x5fbd('0x3e')]+'%'};return _0x380e3b;}})});}_0x3bb223=_[_0x5fbd('0x3d')]({},_0x3bb223,_0x25ba65['options']);var _0x354c97={'where':_0x3bb223[_0x5fbd('0x3b')]};return db[_0x5fbd('0x3f')][_0x5fbd('0x1d')](_0x354c97)[_0x5fbd('0x25')](function(_0x424b3d){_0x5a99b3[_0x5fbd('0x1d')]=_0x424b3d;if(_0x25ba65[_0x5fbd('0x32')][_0x5fbd('0x40')]){_0x3bb223[_0x5fbd('0x41')]=[{'all':!![]}];}return db[_0x5fbd('0x3f')][_0x5fbd('0x42')](_0x3bb223);})[_0x5fbd('0x25')](function(_0x530af5){_0x5a99b3[_0x5fbd('0x43')]=_0x530af5;return _0x5a99b3;})[_0x5fbd('0x25')](respondWithFilteredResult(_0x48898b,_0x3bb223))['catch'](handleError(_0x48898b,null));};exports[_0x5fbd('0x44')]=function(_0x32615f,_0x13787d){var _0xb95ff0={'raw':!![],'where':{'id':_0x32615f[_0x5fbd('0x45')]['id']}},_0x24575c={};_0x24575c[_0x5fbd('0x30')]=_[_0x5fbd('0x31')](db[_0x5fbd('0x3f')][_0x5fbd('0x46')]);_0x24575c['query']=_[_0x5fbd('0x31')](_0x32615f[_0x5fbd('0x32')]);_0x24575c[_0x5fbd('0x3c')]=_[_0x5fbd('0x33')](_0x24575c[_0x5fbd('0x30')],_0x24575c[_0x5fbd('0x32')]);_0xb95ff0[_0x5fbd('0x35')]=_[_0x5fbd('0x33')](_0x24575c[_0x5fbd('0x30')],qs['fields'](_0x32615f[_0x5fbd('0x32')][_0x5fbd('0x34')]));_0xb95ff0[_0x5fbd('0x35')]=_0xb95ff0[_0x5fbd('0x35')][_0x5fbd('0x36')]?_0xb95ff0[_0x5fbd('0x35')]:_0x24575c['model'];if(_0x32615f[_0x5fbd('0x32')][_0x5fbd('0x40')]){_0xb95ff0[_0x5fbd('0x41')]=[{'all':!![]}];}_0xb95ff0=_[_0x5fbd('0x3d')]({},_0xb95ff0,_0x32615f[_0x5fbd('0x47')]);return db[_0x5fbd('0x3f')][_0x5fbd('0x48')](_0xb95ff0)[_0x5fbd('0x25')](handleEntityNotFound(_0x13787d,null))['then'](respondWithResult(_0x13787d,null))['catch'](handleError(_0x13787d,null));};exports[_0x5fbd('0x49')]=function(_0x239f79,_0x1e808c){return db[_0x5fbd('0x3f')][_0x5fbd('0x49')](_0x239f79[_0x5fbd('0x4a')],{})[_0x5fbd('0x25')](respondWithResult(_0x1e808c,0xc9))[_0x5fbd('0x4b')](handleError(_0x1e808c,null));};exports[_0x5fbd('0x24')]=function(_0xd8b187,_0x20301f){if(_0xd8b187[_0x5fbd('0x4a')]['id']){delete _0xd8b187[_0x5fbd('0x4a')]['id'];}return db[_0x5fbd('0x3f')][_0x5fbd('0x48')]({'where':{'id':_0xd8b187[_0x5fbd('0x45')]['id']}})[_0x5fbd('0x25')](handleEntityNotFound(_0x20301f,null))[_0x5fbd('0x25')](saveUpdates(_0xd8b187[_0x5fbd('0x4a')],null))[_0x5fbd('0x25')](respondWithResult(_0x20301f,null))['catch'](handleError(_0x20301f,null));};exports['destroy']=function(_0x188187,_0x31873a){return db[_0x5fbd('0x3f')][_0x5fbd('0x48')]({'where':{'id':_0x188187[_0x5fbd('0x45')]['id']}})[_0x5fbd('0x25')](handleEntityNotFound(_0x31873a,null))[_0x5fbd('0x25')](removeEntity(_0x31873a,null))['catch'](handleError(_0x31873a,null));};exports[_0x5fbd('0x4c')]=function(_0x38b430,_0x40a261){return db['SquareDetailsReport']['describe']()[_0x5fbd('0x25')](respondWithResult(_0x40a261,null))[_0x5fbd('0x4b')](handleError(_0x40a261,null));}; \ No newline at end of file +var _0x2b65=['mustache','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','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0x2b65,0x131));var _0x52b6=function(_0x1353bc,_0x432b07){_0x1353bc=_0x1353bc-0x0;var _0x3097a6=_0x2b65[_0x1353bc];return _0x3097a6;};'use strict';var emlformat=require(_0x52b6('0x0'));var rimraf=require(_0x52b6('0x1'));var zipdir=require(_0x52b6('0x2'));var jsonpatch=require(_0x52b6('0x3'));var rp=require(_0x52b6('0x4'));var moment=require(_0x52b6('0x5'));var BPromise=require(_0x52b6('0x6'));var Mustache=require(_0x52b6('0x7'));var util=require('util');var path=require(_0x52b6('0x8'));var sox=require(_0x52b6('0x9'));var csv=require(_0x52b6('0xa'));var ejs=require(_0x52b6('0xb'));var fs=require('fs');var fs_extra=require(_0x52b6('0xc'));var _=require(_0x52b6('0xd'));var squel=require(_0x52b6('0xe'));var crypto=require(_0x52b6('0xf'));var jsforce=require(_0x52b6('0x10'));var deskjs=require(_0x52b6('0x11'));var toCsv=require('to-csv');var querystring=require(_0x52b6('0x12'));var Papa=require(_0x52b6('0x13'));var Redis=require(_0x52b6('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x52b6('0x15'));var as=require(_0x52b6('0x16'));var hardwareService=require(_0x52b6('0x17'));var logger=require(_0x52b6('0x18'))('api');var utils=require(_0x52b6('0x19'));var config=require(_0x52b6('0x1a'));var licenseUtil=require(_0x52b6('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x247d40,_0xc7ccc2){_0xc7ccc2=_0xc7ccc2||0xcc;return function(_0x5292e4){if(_0x5292e4){return _0x247d40[_0x52b6('0x1c')](_0xc7ccc2);}return _0x247d40['status'](_0xc7ccc2)['end']();};}function respondWithResult(_0x2b8de5,_0x911df9){_0x911df9=_0x911df9||0xc8;return function(_0x982e14){if(_0x982e14){return _0x2b8de5[_0x52b6('0x1d')](_0x911df9)[_0x52b6('0x1e')](_0x982e14);}};}function respondWithFilteredResult(_0x1bc871,_0x383803){return function(_0x297417){if(_0x297417){var _0x1ab3f5=typeof _0x383803[_0x52b6('0x1f')]===_0x52b6('0x20')&&typeof _0x383803[_0x52b6('0x21')]===_0x52b6('0x20');var _0x47aade=_0x297417[_0x52b6('0x22')];var _0x2fa3ed=_0x1ab3f5?0x0:_0x383803[_0x52b6('0x1f')];var _0x47d203=_0x1ab3f5?_0x297417[_0x52b6('0x22')]:_0x383803[_0x52b6('0x1f')]+_0x383803['limit'];var _0x4821e3;if(_0x47d203>=_0x47aade){_0x47d203=_0x47aade;_0x4821e3=0xc8;}else{_0x4821e3=0xce;}_0x1bc871[_0x52b6('0x1d')](_0x4821e3);return _0x1bc871['set'](_0x52b6('0x23'),_0x2fa3ed+'-'+_0x47d203+'/'+_0x47aade)['json'](_0x297417);}return null;};}function patchUpdates(_0x2e472f){return function(_0xc3aa84){try{jsonpatch[_0x52b6('0x24')](_0xc3aa84,_0x2e472f,!![]);}catch(_0x15472e){return BPromise['reject'](_0x15472e);}return _0xc3aa84[_0x52b6('0x25')]();};}function saveUpdates(_0x364b0a,_0x1246db){return function(_0x3c0f76){if(_0x3c0f76){return _0x3c0f76[_0x52b6('0x26')](_0x364b0a)[_0x52b6('0x27')](function(_0xf1c324){return _0xf1c324;});}return null;};}function removeEntity(_0x272d07,_0x16e7fc){return function(_0x55aa4c){if(_0x55aa4c){return _0x55aa4c[_0x52b6('0x28')]()[_0x52b6('0x27')](function(){_0x272d07[_0x52b6('0x1d')](0xcc)[_0x52b6('0x29')]();});}};}function handleEntityNotFound(_0x81012,_0x858f84){return function(_0x1a87a2){if(!_0x1a87a2){_0x81012[_0x52b6('0x1c')](0x194);}return _0x1a87a2;};}function handleError(_0xa971b,_0x3d9072){_0x3d9072=_0x3d9072||0x1f4;return function(_0x396e80){logger[_0x52b6('0x2a')](_0x396e80[_0x52b6('0x2b')]);if(_0x396e80[_0x52b6('0x2c')]){delete _0x396e80[_0x52b6('0x2c')];}_0xa971b[_0x52b6('0x1d')](_0x3d9072)['send'](_0x396e80);};}exports[_0x52b6('0x2d')]=function(_0x14feb5,_0x1716b6){var _0x92fe9e={},_0x3f03b7={},_0x31e71a={'count':0x0,'rows':[]};var _0x2e415b=_['map'](db[_0x52b6('0x2e')][_0x52b6('0x2f')],function(_0x5a1bc3){return{'name':_0x5a1bc3[_0x52b6('0x30')],'type':_0x5a1bc3[_0x52b6('0x31')][_0x52b6('0x32')]};});_0x3f03b7[_0x52b6('0x33')]=_[_0x52b6('0x34')](_0x2e415b,'name');_0x3f03b7[_0x52b6('0x35')]=_['keys'](_0x14feb5[_0x52b6('0x35')]);_0x3f03b7[_0x52b6('0x36')]=_[_0x52b6('0x37')](_0x3f03b7[_0x52b6('0x33')],_0x3f03b7[_0x52b6('0x35')]);_0x92fe9e[_0x52b6('0x38')]=_['intersection'](_0x3f03b7[_0x52b6('0x33')],qs[_0x52b6('0x39')](_0x14feb5[_0x52b6('0x35')]['fields']));_0x92fe9e['attributes']=_0x92fe9e[_0x52b6('0x38')][_0x52b6('0x3a')]?_0x92fe9e['attributes']:_0x3f03b7[_0x52b6('0x33')];if(!_0x14feb5[_0x52b6('0x35')][_0x52b6('0x3b')](_0x52b6('0x3c'))){_0x92fe9e[_0x52b6('0x21')]=qs[_0x52b6('0x21')](_0x14feb5[_0x52b6('0x35')][_0x52b6('0x21')]);_0x92fe9e[_0x52b6('0x1f')]=qs[_0x52b6('0x1f')](_0x14feb5[_0x52b6('0x35')][_0x52b6('0x1f')]);}_0x92fe9e['order']=qs[_0x52b6('0x3d')](_0x14feb5[_0x52b6('0x35')][_0x52b6('0x3d')]);_0x92fe9e[_0x52b6('0x3e')]=qs[_0x52b6('0x36')](_['pick'](_0x14feb5['query'],_0x3f03b7[_0x52b6('0x36')]),_0x2e415b);if(_0x14feb5[_0x52b6('0x35')]['filter']){_0x92fe9e['where']=_[_0x52b6('0x3f')](_0x92fe9e['where'],{'$or':_['map'](_0x2e415b,function(_0x59aea9){if(_0x59aea9[_0x52b6('0x31')]!==_0x52b6('0x40')){var _0x12d466={};_0x12d466[_0x59aea9[_0x52b6('0x2c')]]={'$like':'%'+_0x14feb5[_0x52b6('0x35')][_0x52b6('0x41')]+'%'};return _0x12d466;}})});}_0x92fe9e=_[_0x52b6('0x3f')]({},_0x92fe9e,_0x14feb5[_0x52b6('0x42')]);var _0x592437={'where':_0x92fe9e[_0x52b6('0x3e')]};return db[_0x52b6('0x2e')]['count'](_0x592437)[_0x52b6('0x27')](function(_0x3b9f61){_0x31e71a[_0x52b6('0x22')]=_0x3b9f61;if(_0x14feb5[_0x52b6('0x35')][_0x52b6('0x43')]){_0x92fe9e[_0x52b6('0x44')]=[{'all':!![]}];}return db[_0x52b6('0x2e')][_0x52b6('0x45')](_0x92fe9e);})['then'](function(_0x1dc759){_0x31e71a[_0x52b6('0x46')]=_0x1dc759;return _0x31e71a;})[_0x52b6('0x27')](respondWithFilteredResult(_0x1716b6,_0x92fe9e))[_0x52b6('0x47')](handleError(_0x1716b6,null));};exports['show']=function(_0x3e92b4,_0xbc0117){var _0x4c3303={'raw':!![],'where':{'id':_0x3e92b4[_0x52b6('0x48')]['id']}},_0x236d60={};_0x236d60[_0x52b6('0x33')]=_[_0x52b6('0x49')](db[_0x52b6('0x2e')][_0x52b6('0x2f')]);_0x236d60[_0x52b6('0x35')]=_[_0x52b6('0x49')](_0x3e92b4[_0x52b6('0x35')]);_0x236d60[_0x52b6('0x36')]=_[_0x52b6('0x37')](_0x236d60[_0x52b6('0x33')],_0x236d60[_0x52b6('0x35')]);_0x4c3303[_0x52b6('0x38')]=_[_0x52b6('0x37')](_0x236d60[_0x52b6('0x33')],qs['fields'](_0x3e92b4['query']['fields']));_0x4c3303['attributes']=_0x4c3303[_0x52b6('0x38')][_0x52b6('0x3a')]?_0x4c3303[_0x52b6('0x38')]:_0x236d60[_0x52b6('0x33')];if(_0x3e92b4['query'][_0x52b6('0x43')]){_0x4c3303[_0x52b6('0x44')]=[{'all':!![]}];}_0x4c3303=_[_0x52b6('0x3f')]({},_0x4c3303,_0x3e92b4[_0x52b6('0x42')]);return db[_0x52b6('0x2e')][_0x52b6('0x4a')](_0x4c3303)['then'](handleEntityNotFound(_0xbc0117,null))[_0x52b6('0x27')](respondWithResult(_0xbc0117,null))[_0x52b6('0x47')](handleError(_0xbc0117,null));};exports[_0x52b6('0x4b')]=function(_0x29e11a,_0x361acf){return db[_0x52b6('0x2e')][_0x52b6('0x4b')](_0x29e11a[_0x52b6('0x4c')],{})[_0x52b6('0x27')](respondWithResult(_0x361acf,0xc9))[_0x52b6('0x47')](handleError(_0x361acf,null));};exports[_0x52b6('0x26')]=function(_0x42182a,_0x39a0e3){if(_0x42182a[_0x52b6('0x4c')]['id']){delete _0x42182a['body']['id'];}return db[_0x52b6('0x2e')][_0x52b6('0x4a')]({'where':{'id':_0x42182a[_0x52b6('0x48')]['id']}})[_0x52b6('0x27')](handleEntityNotFound(_0x39a0e3,null))[_0x52b6('0x27')](saveUpdates(_0x42182a[_0x52b6('0x4c')],null))[_0x52b6('0x27')](respondWithResult(_0x39a0e3,null))[_0x52b6('0x47')](handleError(_0x39a0e3,null));};exports['destroy']=function(_0x533784,_0x388fbe){return db[_0x52b6('0x2e')][_0x52b6('0x4a')]({'where':{'id':_0x533784[_0x52b6('0x48')]['id']}})[_0x52b6('0x27')](handleEntityNotFound(_0x388fbe,null))[_0x52b6('0x27')](removeEntity(_0x388fbe,null))[_0x52b6('0x47')](handleError(_0x388fbe,null));};exports[_0x52b6('0x4d')]=function(_0x183498,_0x3d8da1){return db[_0x52b6('0x2e')][_0x52b6('0x4d')]()[_0x52b6('0x27')](respondWithResult(_0x3d8da1,null))['catch'](handleError(_0x3d8da1,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 57344c3..ac8defb 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 _0xe39e=['rimraf','../../config/environment','exports','define','SquareDetailsReport','report_square_details','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x509dd5,_0x1a1337){var _0x1f5775=function(_0x199500){while(--_0x199500){_0x509dd5['push'](_0x509dd5['shift']());}};_0x1f5775(++_0x1a1337);}(_0xe39e,0x1a6));var _0xee39=function(_0x6f1031,_0x3c0a6f){_0x6f1031=_0x6f1031-0x0;var _0x4e1b8d=_0xe39e[_0x6f1031];return _0x4e1b8d;};'use strict';var _=require('lodash');var util=require(_0xee39('0x0'));var logger=require(_0xee39('0x1'))(_0xee39('0x2'));var moment=require(_0xee39('0x3'));var BPromise=require(_0xee39('0x4'));var rp=require(_0xee39('0x5'));var fs=require('fs');var path=require(_0xee39('0x6'));var rimraf=require(_0xee39('0x7'));var config=require(_0xee39('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0xee39('0x9')]=function(_0x41de74,_0x3951c4){return _0x41de74[_0xee39('0xa')](_0xee39('0xb'),attributes,{'tableName':_0xee39('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa944=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details'];(function(_0x334eae,_0x100379){var _0x279c84=function(_0x14dc78){while(--_0x14dc78){_0x334eae['push'](_0x334eae['shift']());}};_0x279c84(++_0x100379);}(_0xa944,0xaa));var _0x4a94=function(_0x41013b,_0x428de5){_0x41013b=_0x41013b-0x0;var _0x3f9601=_0xa944[_0x41013b];return _0x3f9601;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4a94('0x0'))('api');var moment=require(_0x4a94('0x1'));var BPromise=require(_0x4a94('0x2'));var rp=require(_0x4a94('0x3'));var fs=require('fs');var path=require(_0x4a94('0x4'));var rimraf=require(_0x4a94('0x5'));var config=require('../../config/environment');var attributes=require(_0x4a94('0x6'));module[_0x4a94('0x7')]=function(_0x5c436a,_0x3247b7){return _0x5c436a['define'](_0x4a94('0x8'),attributes,{'tableName':_0x4a94('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 5b9f33d..45dc731 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 _0xdd4f=['options','raw','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x155107,_0x1b4bef){_0x155107=_0x155107-0x0;var _0x569c25=_0xdd4f[_0x155107];return _0x569c25;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x307ac6,_0x3c72d4,_0x51acd6){return new BPromise(function(_0x3cd8e6,_0x563ae6){return client[_0xfdd4('0x9')](_0x307ac6,_0x51acd6)[_0xfdd4('0xa')](function(_0x1e823e){logger['info'](_0xfdd4('0xb'),_0x3c72d4,'request\x20sent');logger[_0xfdd4('0xc')](_0xfdd4('0xd'),_0x3c72d4,_0xfdd4('0xe'),JSON[_0xfdd4('0xf')](_0x1e823e));if(_0x1e823e[_0xfdd4('0x10')]){if(_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x11')]===0x1f4){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x12')]);return _0x563ae6(_0x1e823e['error'][_0xfdd4('0x12')]);}logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e['error'][_0xfdd4('0x12')]);return _0x3cd8e6(_0x1e823e['error'][_0xfdd4('0x12')]);}else{logger[_0xfdd4('0x13')](_0xfdd4('0xb'),_0x3c72d4,_0xfdd4('0xe'));_0x3cd8e6(_0x1e823e[_0xfdd4('0x14')]['message']);}})['catch'](function(_0x559c77){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x559c77);_0x563ae6(_0x559c77);});});}exports[_0xfdd4('0x15')]=function(_0x2ccc88){var _0x32b5f7=this;return new Promise(function(_0x33d752,_0x1746e1){return db[_0xfdd4('0x16')][_0xfdd4('0x17')](_0x2ccc88['body'],{'raw':_0x2ccc88[_0xfdd4('0x18')]?_0x2ccc88[_0xfdd4('0x18')][_0xfdd4('0x19')]===undefined?!![]:![]:!![]})[_0xfdd4('0xa')](function(_0x1454f1){logger[_0xfdd4('0x13')](_0xfdd4('0x15'),_0x2ccc88);logger[_0xfdd4('0xc')]('CreateSquareDetailsReport',_0x2ccc88,JSON[_0xfdd4('0xf')](_0x1454f1));_0x33d752(_0x1454f1);})[_0xfdd4('0x1a')](function(_0x2a24e8){logger[_0xfdd4('0x10')](_0xfdd4('0x15'),_0x2a24e8[_0xfdd4('0x12')],_0x2ccc88);_0x1746e1(_0x32b5f7[_0xfdd4('0x10')](0x1f4,_0x2a24e8[_0xfdd4('0x12')]));});});}; \ No newline at end of file +var _0x0b7f=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','SquareDetailsReport,\x20%s,\x20%s','message','request\x20sent','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','stringify','catch','lodash','util','bluebird'];(function(_0x49a785,_0xe609b3){var _0x517712=function(_0x13df3f){while(--_0x13df3f){_0x49a785['push'](_0x49a785['shift']());}};_0x517712(++_0xe609b3);}(_0x0b7f,0x115));var _0xf0b7=function(_0x212009,_0x4be73a){_0x212009=_0x212009-0x0;var _0x2ee852=_0x0b7f[_0x212009];return _0x2ee852;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var moment=require('moment');var BPromise=require(_0xf0b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0b7('0x3'));var db=require(_0xf0b7('0x4'))['db'];var utils=require(_0xf0b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0b7('0x6'));var jayson=require(_0xf0b7('0x7'));var client=jayson[_0xf0b7('0x8')][_0xf0b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2de8,_0x5e449a,_0x1408ee){return new BPromise(function(_0x276f09,_0x275a13){return client[_0xf0b7('0xa')](_0x2b2de8,_0x1408ee)[_0xf0b7('0xb')](function(_0x588b46){logger[_0xf0b7('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x5e449a,'request\x20sent');logger['debug'](_0xf0b7('0xd'),_0x5e449a,'request\x20sent',JSON['stringify'](_0x588b46));if(_0x588b46[_0xf0b7('0xe')]){if(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0xf')]===0x1f4){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x275a13(_0x588b46[_0xf0b7('0xe')]['message']);}logger['error'](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x276f09(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);}else{logger['info'](_0xf0b7('0x10'),_0x5e449a,_0xf0b7('0x12'));_0x276f09(_0x588b46[_0xf0b7('0x13')][_0xf0b7('0x11')]);}})['catch'](function(_0x303db6){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x303db6);_0x275a13(_0x303db6);});});}exports[_0xf0b7('0x14')]=function(_0x52b27e){var _0x1e5fc9=this;return new Promise(function(_0x153d23,_0x28fd36){return db[_0xf0b7('0x15')][_0xf0b7('0x16')](_0x52b27e['body'],{'raw':_0x52b27e[_0xf0b7('0x17')]?_0x52b27e['options'][_0xf0b7('0x18')]===undefined?!![]:![]:!![]})[_0xf0b7('0xb')](function(_0x374496){logger['info']('CreateSquareDetailsReport',_0x52b27e);logger[_0xf0b7('0x19')](_0xf0b7('0x14'),_0x52b27e,JSON[_0xf0b7('0x1a')](_0x374496));_0x153d23(_0x374496);})[_0xf0b7('0x1b')](function(_0xb90b3c){logger[_0xf0b7('0xe')](_0xf0b7('0x14'),_0xb90b3c[_0xf0b7('0x11')],_0x52b27e);_0x28fd36(_0x1e5fc9[_0xf0b7('0xe')](0x1f4,_0xb90b3c['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 8370c1e..7b15d9b 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 _0x4a28=['/process/:pid/kill','exports','Router','../../components/auth/service','./system.controller','get','index'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x4a28,0x183));var _0x84a2=function(_0x3dd203,_0x3238f7){_0x3dd203=_0x3dd203-0x0;var _0x3b6867=_0x4a28[_0x3dd203];return _0x3b6867;};'use strict';var express=require('express');var router=express[_0x84a2('0x0')]();var auth=require(_0x84a2('0x1'));var controller=require(_0x84a2('0x2'));router[_0x84a2('0x3')]('/',auth['isAuthenticated'](),controller[_0x84a2('0x4')]);router[_0x84a2('0x3')](_0x84a2('0x5'),auth['isAuthenticated'](),controller['killProcess']);module[_0x84a2('0x6')]=router; \ No newline at end of file +var _0x124f=['../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports','express','Router'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x124f,0xbb));var _0xf124=function(_0x3ceb91,_0x2a7f94){_0x3ceb91=_0x3ceb91-0x0;var _0x71ab37=_0x124f[_0x3ceb91];return _0x71ab37;};'use strict';var express=require(_0xf124('0x0'));var router=express[_0xf124('0x1')]();var auth=require(_0xf124('0x2'));var controller=require(_0xf124('0x3'));router[_0xf124('0x4')]('/',auth[_0xf124('0x5')](),controller[_0xf124('0x6')]);router[_0xf124('0x4')](_0xf124('0x7'),auth[_0xf124('0x5')](),controller['killProcess']);module[_0xf124('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 4a0bdf7..6c2a078 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 _0x479c=['pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','api','util','bluebird','lodash','inspect','name','send','index','then','status','catch','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0x479c,0xe8));var _0xc479=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x479c[_0x2c7618];return _0x5ce3f0;};'use strict';var info=require(_0xc479('0x0'));var exec=require('child_process')[_0xc479('0x1')];var logger=require('../../config/logger')(_0xc479('0x2'));var util=require(_0xc479('0x3'));var BPromise=require(_0xc479('0x4'));var _=require(_0xc479('0x5'));function handleError(_0x5e6c7e,_0x3e77ff,_0x47079b){_0x3e77ff=_0x3e77ff||0x1f4;return function(_0xc359b6){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x47079b,_0x3e77ff,util[_0xc479('0x6')](_0xc359b6,{'showHidden':![],'depth':null}));delete _0xc359b6[_0xc479('0x7')];_0x5e6c7e['status'](_0x3e77ff)[_0xc479('0x8')](_0xc359b6);};}exports[_0xc479('0x9')]=function(_0x20ec94,_0x290512){return info['getAllData']()[_0xc479('0xa')](function(_0x419988){return _0x290512[_0xc479('0xb')](0xc8)['json'](_0x419988);})[_0xc479('0xc')](function(_0x4fb48c){return _0x290512['status'](0x1f4)[_0xc479('0xd')](_0x4fb48c);});};exports[_0xc479('0xe')]=function(_0x59269a,_0x205441){var _0x59e293=[_0xc479('0xf')];return new BPromise(function(_0x328b54,_0x5203d6){return exec(util['format'](_0xc479('0x10'),_0x59269a[_0xc479('0x11')][_0xc479('0x12')]),function(_0x5721e5,_0x388cd6,_0xd40a89){if(_0x5721e5){return _0x5203d6(_0x5721e5);}return _0x328b54(_0x388cd6);});})['then'](function(_0xde9940){var _0x13e1dd=![];var _0x7cdbd4=_0xde9940[_0xc479('0x13')](/\n/);for(var _0x10b7fd=0x0,_0x14105d=_0x59e293[_0xc479('0x14')];_0x10b7fd<_0x14105d,_0x13e1dd===![];_0x10b7fd+=0x1){if(_0xde9940[_0xc479('0x15')](_0x59e293[_0x10b7fd])>=0x0){_0x13e1dd=!![];}}if(!_0x13e1dd){throw new Error(util['format'](_0xc479('0x16'),_0x59269a['params'][_0xc479('0x12')]));}process[_0xc479('0x17')](_0x59269a['params'][_0xc479('0x12')],'SIGINT');return _0x205441[_0xc479('0xb')](0xc8)[_0xc479('0xd')]({'message':util['format'](_0xc479('0x18'),_0x59269a[_0xc479('0x11')]['pid'])});})[_0xc479('0xc')](handleError(_0x205441,null,'killProcess'));}; \ No newline at end of file +var _0x8189=['child_process','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0x8189,0x12b));var _0x9818=function(_0x46a74d,_0x1df49e){_0x46a74d=_0x46a74d-0x0;var _0x3d3481=_0x8189[_0x46a74d];return _0x3d3481;};'use strict';var info=require(_0x9818('0x0'));var exec=require(_0x9818('0x1'))['exec'];var logger=require(_0x9818('0x2'))(_0x9818('0x3'));var util=require(_0x9818('0x4'));var BPromise=require('bluebird');var _=require(_0x9818('0x5'));function handleError(_0x3473c3,_0x5684bf,_0x3367ca){_0x5684bf=_0x5684bf||0x1f4;return function(_0x447a32){logger[_0x9818('0x6')](_0x9818('0x7'),_0x3367ca,_0x5684bf,util[_0x9818('0x8')](_0x447a32,{'showHidden':![],'depth':null}));delete _0x447a32['name'];_0x3473c3[_0x9818('0x9')](_0x5684bf)['send'](_0x447a32);};}exports[_0x9818('0xa')]=function(_0x3e8fd3,_0x248124){return info['getAllData']()[_0x9818('0xb')](function(_0x3d3518){return _0x248124[_0x9818('0x9')](0xc8)[_0x9818('0xc')](_0x3d3518);})[_0x9818('0xd')](function(_0x1842fe){return _0x248124[_0x9818('0x9')](0x1f4)[_0x9818('0xc')](_0x1842fe);});};exports[_0x9818('0xe')]=function(_0x42d9dc,_0x5ce54f){var _0x25874b=['components/import/cm'];return new BPromise(function(_0x582025,_0x3ce6f1){return exec(util[_0x9818('0xf')](_0x9818('0x10'),_0x42d9dc[_0x9818('0x11')][_0x9818('0x12')]),function(_0x2dd849,_0xe7eee8,_0x577303){if(_0x2dd849){return _0x3ce6f1(_0x2dd849);}return _0x582025(_0xe7eee8);});})[_0x9818('0xb')](function(_0x3f49e3){var _0x2b04c7=![];var _0x4bd5a1=_0x3f49e3[_0x9818('0x13')](/\n/);for(var _0x43aaeb=0x0,_0x598655=_0x25874b[_0x9818('0x14')];_0x43aaeb<_0x598655,_0x2b04c7===![];_0x43aaeb+=0x1){if(_0x3f49e3[_0x9818('0x15')](_0x25874b[_0x43aaeb])>=0x0){_0x2b04c7=!![];}}if(!_0x2b04c7){throw new Error(util[_0x9818('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x42d9dc['params'][_0x9818('0x12')]));}process[_0x9818('0x16')](_0x42d9dc['params'][_0x9818('0x12')],_0x9818('0x17'));return _0x5ce54f[_0x9818('0x9')](0xc8)[_0x9818('0xc')]({'message':util['format'](_0x9818('0x18'),_0x42d9dc['params'][_0x9818('0x12')])});})[_0x9818('0xd')](handleError(_0x5ce54f,null,_0x9818('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ef6fa87..72199c5 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 _0xe5b3=['../../config/environment','./tag.controller','get','index','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x106c21,_0x39371e){var _0x5a12fc=function(_0x1a1fb7){while(--_0x1a1fb7){_0x106c21['push'](_0x106c21['shift']());}};_0x5a12fc(++_0x39371e);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2e5798,_0x174511){_0x2e5798=_0x2e5798-0x0;var _0x29741c=_0xe5b3[_0x2e5798];return _0x29741c;};'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')]('/describe',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0xd')]);router[_0x3e5b('0xa')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3e5b('0xf')]('/',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x10')]);router[_0x3e5b('0x11')](_0x3e5b('0xe'),auth['isAuthenticated'](),controller[_0x3e5b('0x12')]);router['delete'](_0x3e5b('0xe'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x13')]);module[_0x3e5b('0x14')]=router; \ No newline at end of file +var _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get'];(function(_0x2a4173,_0x3972a7){var _0x5e3b31=function(_0x195c4d){while(--_0x195c4d){_0x2a4173['push'](_0x2a4173['shift']());}};_0x5e3b31(++_0x3972a7);}(_0xa75b,0x170));var _0xba75=function(_0x511e8d,_0x1dbcba){_0x511e8d=_0x511e8d-0x0;var _0x113f95=_0xa75b[_0x511e8d];return _0x113f95;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index d734c5a..116881c 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 _0xbca8=['sequelize','exports','STRING','name'];(function(_0x3093fe,_0x5a0cff){var _0x31517d=function(_0x4a6eba){while(--_0x4a6eba){_0x3093fe['push'](_0x3093fe['shift']());}};_0x31517d(++_0x5a0cff);}(_0xbca8,0xcc));var _0x8bca=function(_0x5d1f87,_0x2d807a){_0x5d1f87=_0x5d1f87-0x0;var _0x48b897=_0xbca8[_0x5d1f87];return _0x48b897;};'use strict';var Sequelize=require(_0x8bca('0x0'));module[_0x8bca('0x1')]={'name':{'type':Sequelize[_0x8bca('0x2')],'unique':_0x8bca('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8bca('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x8bca('0x2')]}}; \ No newline at end of file +var _0x60d7=['#0091EA','sequelize','exports','name'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x60d7,0x139));var _0x760d=function(_0x942991,_0x195803){_0x942991=_0x942991-0x0;var _0x1051a6=_0x60d7[_0x942991];return _0x1051a6;};'use strict';var Sequelize=require(_0x760d('0x0'));module[_0x760d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x760d('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x760d('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 604b680..acf60f0 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 _0x9c50=['Tag','rawAttributes','type','model','query','keys','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','findAll','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','describe','fast-json-patch','moment','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','set','Content-Range','apply','then','destroy','get','Tags','sendStatus','stack','name','map'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0x9c50,0xec));var _0x09c5=function(_0x8fca14,_0x47c0f9){_0x8fca14=_0x8fca14-0x0;var _0x3656e0=_0x9c50[_0x8fca14];return _0x3656e0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x09c5('0x0'));var rp=require('request-promise');var moment=require(_0x09c5('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x09c5('0x2'));var path=require(_0x09c5('0x3'));var sox=require('sox');var csv=require(_0x09c5('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09c5('0x5'));var _=require(_0x09c5('0x6'));var squel=require(_0x09c5('0x7'));var crypto=require('crypto');var jsforce=require(_0x09c5('0x8'));var deskjs=require(_0x09c5('0x9'));var toCsv=require(_0x09c5('0x4'));var querystring=require(_0x09c5('0xa'));var Papa=require('papaparse');var Redis=require(_0x09c5('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x09c5('0xc'));var hardwareService=require(_0x09c5('0xd'));var logger=require(_0x09c5('0xe'))(_0x09c5('0xf'));var utils=require('../../config/utils');var config=require(_0x09c5('0x10'));var licenseUtil=require(_0x09c5('0x11'));var db=require(_0x09c5('0x12'))['db'];function respondWithStatusCode(_0x249d1f,_0x25ed17){_0x25ed17=_0x25ed17||0xcc;return function(_0x3e4eba){if(_0x3e4eba){return _0x249d1f['sendStatus'](_0x25ed17);}return _0x249d1f['status'](_0x25ed17)[_0x09c5('0x13')]();};}function respondWithResult(_0x216624,_0x3900cc){_0x3900cc=_0x3900cc||0xc8;return function(_0x380922){if(_0x380922){return _0x216624['status'](_0x3900cc)['json'](_0x380922);}};}function respondWithFilteredResult(_0x46e6e9,_0x4d6342){return function(_0x4dad31){if(_0x4dad31){var _0x5cb726=typeof _0x4d6342[_0x09c5('0x14')]===_0x09c5('0x15')&&typeof _0x4d6342[_0x09c5('0x16')]===_0x09c5('0x15');var _0x2891fb=_0x4dad31[_0x09c5('0x17')];var _0x1040b1=_0x5cb726?0x0:_0x4d6342[_0x09c5('0x14')];var _0x38e59e=_0x5cb726?_0x4dad31[_0x09c5('0x17')]:_0x4d6342['offset']+_0x4d6342[_0x09c5('0x16')];var _0x3e6f5f;if(_0x38e59e>=_0x2891fb){_0x38e59e=_0x2891fb;_0x3e6f5f=0xc8;}else{_0x3e6f5f=0xce;}_0x46e6e9[_0x09c5('0x18')](_0x3e6f5f);return _0x46e6e9[_0x09c5('0x19')](_0x09c5('0x1a'),_0x1040b1+'-'+_0x38e59e+'/'+_0x2891fb)['json'](_0x4dad31);}return null;};}function patchUpdates(_0x4648fc){return function(_0x39fb75){try{jsonpatch[_0x09c5('0x1b')](_0x39fb75,_0x4648fc,!![]);}catch(_0x159c94){return BPromise['reject'](_0x159c94);}return _0x39fb75['save']();};}function saveUpdates(_0x37da46,_0x3383bb){return function(_0x32fe62){if(_0x32fe62){return _0x32fe62['update'](_0x37da46)[_0x09c5('0x1c')](function(_0xa687ac){return _0xa687ac;});}return null;};}function removeEntity(_0x48e2ef,_0x365e6d){return function(_0x5cdc52){if(_0x5cdc52){return _0x5cdc52[_0x09c5('0x1d')]()['then'](function(){var _0x476a72=_0x5cdc52[_0x09c5('0x1e')]({'plain':!![]});var _0x356001=_0x09c5('0x1f');return db['UserProfileResource'][_0x09c5('0x1d')]({'where':{'type':_0x356001,'resourceId':_0x476a72['id']}})[_0x09c5('0x1c')](function(){return _0x5cdc52;});})[_0x09c5('0x1c')](function(){_0x48e2ef['status'](0xcc)[_0x09c5('0x13')]();});}};}function handleEntityNotFound(_0x2d3f1f,_0x3aa452){return function(_0x416881){if(!_0x416881){_0x2d3f1f[_0x09c5('0x20')](0x194);}return _0x416881;};}function handleError(_0x406f32,_0x159652){_0x159652=_0x159652||0x1f4;return function(_0x53e126){logger['error'](_0x53e126[_0x09c5('0x21')]);if(_0x53e126['name']){delete _0x53e126[_0x09c5('0x22')];}_0x406f32[_0x09c5('0x18')](_0x159652)['send'](_0x53e126);};}exports['index']=function(_0x2ca501,_0x52ef10){var _0x33ab28={},_0x172fc0={},_0x3c67ba={'count':0x0,'rows':[]};var _0x52904f=_[_0x09c5('0x23')](db[_0x09c5('0x24')][_0x09c5('0x25')],function(_0x592259){return{'name':_0x592259['fieldName'],'type':_0x592259[_0x09c5('0x26')]['key']};});_0x172fc0[_0x09c5('0x27')]=_[_0x09c5('0x23')](_0x52904f,_0x09c5('0x22'));_0x172fc0[_0x09c5('0x28')]=_[_0x09c5('0x29')](_0x2ca501[_0x09c5('0x28')]);_0x172fc0['filters']=_['intersection'](_0x172fc0[_0x09c5('0x27')],_0x172fc0[_0x09c5('0x28')]);_0x33ab28[_0x09c5('0x2a')]=_['intersection'](_0x172fc0[_0x09c5('0x27')],qs[_0x09c5('0x2b')](_0x2ca501[_0x09c5('0x28')][_0x09c5('0x2b')]));_0x33ab28[_0x09c5('0x2a')]=_0x33ab28[_0x09c5('0x2a')][_0x09c5('0x2c')]?_0x33ab28[_0x09c5('0x2a')]:_0x172fc0[_0x09c5('0x27')];if(!_0x2ca501[_0x09c5('0x28')][_0x09c5('0x2d')]('nolimit')){_0x33ab28[_0x09c5('0x16')]=qs[_0x09c5('0x16')](_0x2ca501[_0x09c5('0x28')][_0x09c5('0x16')]);_0x33ab28['offset']=qs[_0x09c5('0x14')](_0x2ca501[_0x09c5('0x28')][_0x09c5('0x14')]);}_0x33ab28['order']=qs[_0x09c5('0x2e')](_0x2ca501[_0x09c5('0x28')][_0x09c5('0x2e')]);_0x33ab28[_0x09c5('0x2f')]=qs[_0x09c5('0x30')](_[_0x09c5('0x31')](_0x2ca501[_0x09c5('0x28')],_0x172fc0[_0x09c5('0x30')]),_0x52904f);if(_0x2ca501['query'][_0x09c5('0x32')]){_0x33ab28[_0x09c5('0x2f')]=_[_0x09c5('0x33')](_0x33ab28[_0x09c5('0x2f')],{'$or':_['map'](_0x52904f,function(_0x3fbcec){if(_0x3fbcec['type']!=='VIRTUAL'){var _0x1835d5={};_0x1835d5[_0x3fbcec[_0x09c5('0x22')]]={'$like':'%'+_0x2ca501['query'][_0x09c5('0x32')]+'%'};return _0x1835d5;}})});}_0x33ab28=_[_0x09c5('0x33')]({},_0x33ab28,_0x2ca501[_0x09c5('0x34')]);var _0x4c98e6={'where':_0x33ab28[_0x09c5('0x2f')]};return db[_0x09c5('0x24')][_0x09c5('0x17')](_0x4c98e6)[_0x09c5('0x1c')](function(_0x126404){_0x3c67ba[_0x09c5('0x17')]=_0x126404;if(_0x2ca501['query'][_0x09c5('0x35')]){_0x33ab28['include']=[{'all':!![]}];}return db[_0x09c5('0x24')][_0x09c5('0x36')](_0x33ab28);})[_0x09c5('0x1c')](function(_0x3f76d6){_0x3c67ba['rows']=_0x3f76d6;return _0x3c67ba;})[_0x09c5('0x1c')](respondWithFilteredResult(_0x52ef10,_0x33ab28))[_0x09c5('0x37')](handleError(_0x52ef10,null));};exports[_0x09c5('0x38')]=function(_0x5a391b,_0x159936){var _0xf525a4={'raw':!![],'where':{'id':_0x5a391b[_0x09c5('0x39')]['id']}},_0x4a27be={};_0x4a27be[_0x09c5('0x27')]=_[_0x09c5('0x29')](db[_0x09c5('0x24')]['rawAttributes']);_0x4a27be[_0x09c5('0x28')]=_['keys'](_0x5a391b[_0x09c5('0x28')]);_0x4a27be[_0x09c5('0x30')]=_[_0x09c5('0x3a')](_0x4a27be['model'],_0x4a27be[_0x09c5('0x28')]);_0xf525a4[_0x09c5('0x2a')]=_[_0x09c5('0x3a')](_0x4a27be[_0x09c5('0x27')],qs[_0x09c5('0x2b')](_0x5a391b['query'][_0x09c5('0x2b')]));_0xf525a4[_0x09c5('0x2a')]=_0xf525a4[_0x09c5('0x2a')][_0x09c5('0x2c')]?_0xf525a4[_0x09c5('0x2a')]:_0x4a27be[_0x09c5('0x27')];if(_0x5a391b[_0x09c5('0x28')][_0x09c5('0x35')]){_0xf525a4['include']=[{'all':!![]}];}_0xf525a4=_[_0x09c5('0x33')]({},_0xf525a4,_0x5a391b[_0x09c5('0x34')]);return db['Tag'][_0x09c5('0x3b')](_0xf525a4)[_0x09c5('0x1c')](handleEntityNotFound(_0x159936,null))[_0x09c5('0x1c')](respondWithResult(_0x159936,null))[_0x09c5('0x37')](handleError(_0x159936,null));};exports['create']=function(_0x377634,_0x271ddb){return db['Tag'][_0x09c5('0x3c')](_0x377634[_0x09c5('0x3d')],{})[_0x09c5('0x1c')](function(_0x1fabf4){var _0x4880ab=_0x377634[_0x09c5('0x3e')]['get']({'plain':!![]});if(!_0x4880ab)throw new Error(_0x09c5('0x3f'));if(_0x4880ab[_0x09c5('0x40')]===_0x09c5('0x3e')){var _0x8a376c=_0x1fabf4[_0x09c5('0x1e')]({'plain':!![]});var _0x3a7554=_0x09c5('0x1f');return db['UserProfileSection'][_0x09c5('0x3b')]({'where':{'name':_0x3a7554,'userProfileId':_0x4880ab[_0x09c5('0x41')]},'raw':!![]})[_0x09c5('0x1c')](function(_0x3034cb){if(_0x3034cb&&_0x3034cb[_0x09c5('0x42')]===0x0){return db['UserProfileResource'][_0x09c5('0x3c')]({'name':_0x8a376c[_0x09c5('0x22')],'resourceId':_0x8a376c['id'],'type':_0x3034cb[_0x09c5('0x22')],'sectionId':_0x3034cb['id']},{})[_0x09c5('0x1c')](function(){return _0x1fabf4;});}else{return _0x1fabf4;}})['catch'](function(_0x12c295){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12c295);throw _0x12c295;});}return _0x1fabf4;})[_0x09c5('0x1c')](respondWithResult(_0x271ddb,0xc9))[_0x09c5('0x37')](handleError(_0x271ddb,null));};exports['update']=function(_0x30e321,_0x3d5ab1){if(_0x30e321[_0x09c5('0x3d')]['id']){delete _0x30e321['body']['id'];}return db['Tag'][_0x09c5('0x3b')]({'where':{'id':_0x30e321[_0x09c5('0x39')]['id']}})[_0x09c5('0x1c')](handleEntityNotFound(_0x3d5ab1,null))[_0x09c5('0x1c')](saveUpdates(_0x30e321[_0x09c5('0x3d')],null))[_0x09c5('0x1c')](respondWithResult(_0x3d5ab1,null))[_0x09c5('0x37')](handleError(_0x3d5ab1,null));};exports[_0x09c5('0x1d')]=function(_0x3b0484,_0x5b16fa){return db['Tag'][_0x09c5('0x3b')]({'where':{'id':_0x3b0484[_0x09c5('0x39')]['id']}})[_0x09c5('0x1c')](handleEntityNotFound(_0x5b16fa,null))[_0x09c5('0x1c')](removeEntity(_0x5b16fa,null))[_0x09c5('0x37')](handleError(_0x5b16fa,null));};exports[_0x09c5('0x43')]=function(_0x25fc64,_0x2beb88){return db[_0x09c5('0x24')]['describe']()[_0x09c5('0x1c')](respondWithResult(_0x2beb88,null))[_0x09c5('0x37')](handleError(_0x2beb88,null));}; \ No newline at end of file +var _0x032f=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','Tag','include','rows','catch','show','params','length','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','Tags','UserProfileResource','stack','name','send','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x032f,0x7b));var _0xf032=function(_0x5a5257,_0xdf9f77){_0x5a5257=_0x5a5257-0x0;var _0xce6419=_0x032f[_0x5a5257];return _0xce6419;};'use strict';var emlformat=require(_0xf032('0x0'));var rimraf=require(_0xf032('0x1'));var zipdir=require(_0xf032('0x2'));var jsonpatch=require(_0xf032('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf032('0x4'));var util=require(_0xf032('0x5'));var path=require(_0xf032('0x6'));var sox=require(_0xf032('0x7'));var csv=require(_0xf032('0x8'));var ejs=require(_0xf032('0x9'));var fs=require('fs');var fs_extra=require(_0xf032('0xa'));var _=require(_0xf032('0xb'));var squel=require(_0xf032('0xc'));var crypto=require(_0xf032('0xd'));var jsforce=require(_0xf032('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf032('0x8'));var querystring=require(_0xf032('0xf'));var Papa=require(_0xf032('0x10'));var Redis=require(_0xf032('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf032('0x12'));var as=require(_0xf032('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf032('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf032('0x15'))['db'];function respondWithStatusCode(_0x3c2a78,_0x25ae7e){_0x25ae7e=_0x25ae7e||0xcc;return function(_0x21ea31){if(_0x21ea31){return _0x3c2a78[_0xf032('0x16')](_0x25ae7e);}return _0x3c2a78['status'](_0x25ae7e)['end']();};}function respondWithResult(_0x472f1b,_0x3231d0){_0x3231d0=_0x3231d0||0xc8;return function(_0x17c4ab){if(_0x17c4ab){return _0x472f1b[_0xf032('0x17')](_0x3231d0)['json'](_0x17c4ab);}};}function respondWithFilteredResult(_0x2287b1,_0x3ce02f){return function(_0x3eab9d){if(_0x3eab9d){var _0x20ec95=typeof _0x3ce02f[_0xf032('0x18')]===_0xf032('0x19')&&typeof _0x3ce02f[_0xf032('0x1a')]===_0xf032('0x19');var _0x336472=_0x3eab9d['count'];var _0x47d6de=_0x20ec95?0x0:_0x3ce02f[_0xf032('0x18')];var _0x52bd26=_0x20ec95?_0x3eab9d[_0xf032('0x1b')]:_0x3ce02f[_0xf032('0x18')]+_0x3ce02f[_0xf032('0x1a')];var _0x427898;if(_0x52bd26>=_0x336472){_0x52bd26=_0x336472;_0x427898=0xc8;}else{_0x427898=0xce;}_0x2287b1[_0xf032('0x17')](_0x427898);return _0x2287b1[_0xf032('0x1c')](_0xf032('0x1d'),_0x47d6de+'-'+_0x52bd26+'/'+_0x336472)['json'](_0x3eab9d);}return null;};}function patchUpdates(_0x135a38){return function(_0x3a7bd1){try{jsonpatch[_0xf032('0x1e')](_0x3a7bd1,_0x135a38,!![]);}catch(_0x9c1fa9){return BPromise['reject'](_0x9c1fa9);}return _0x3a7bd1[_0xf032('0x1f')]();};}function saveUpdates(_0x4954c6,_0xe129d2){return function(_0x2264dc){if(_0x2264dc){return _0x2264dc[_0xf032('0x20')](_0x4954c6)[_0xf032('0x21')](function(_0x348e20){return _0x348e20;});}return null;};}function removeEntity(_0xda000b,_0x40273a){return function(_0x3fe17f){if(_0x3fe17f){return _0x3fe17f[_0xf032('0x22')]()[_0xf032('0x21')](function(){var _0x49056e=_0x3fe17f['get']({'plain':!![]});var _0x44fb27=_0xf032('0x23');return db[_0xf032('0x24')][_0xf032('0x22')]({'where':{'type':_0x44fb27,'resourceId':_0x49056e['id']}})[_0xf032('0x21')](function(){return _0x3fe17f;});})[_0xf032('0x21')](function(){_0xda000b[_0xf032('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56b834,_0x10e8aa){return function(_0x3c5b5b){if(!_0x3c5b5b){_0x56b834['sendStatus'](0x194);}return _0x3c5b5b;};}function handleError(_0x10ddd0,_0xaa0e12){_0xaa0e12=_0xaa0e12||0x1f4;return function(_0x6b105f){logger['error'](_0x6b105f[_0xf032('0x25')]);if(_0x6b105f[_0xf032('0x26')]){delete _0x6b105f[_0xf032('0x26')];}_0x10ddd0['status'](_0xaa0e12)[_0xf032('0x27')](_0x6b105f);};}exports[_0xf032('0x28')]=function(_0x46b889,_0x4af26f){var _0x2a1ff3={},_0x396c9d={},_0x38131a={'count':0x0,'rows':[]};var _0x434496=_['map'](db['Tag'][_0xf032('0x29')],function(_0x29fb02){return{'name':_0x29fb02[_0xf032('0x2a')],'type':_0x29fb02[_0xf032('0x2b')][_0xf032('0x2c')]};});_0x396c9d[_0xf032('0x2d')]=_[_0xf032('0x2e')](_0x434496,_0xf032('0x26'));_0x396c9d[_0xf032('0x2f')]=_[_0xf032('0x30')](_0x46b889['query']);_0x396c9d[_0xf032('0x31')]=_[_0xf032('0x32')](_0x396c9d[_0xf032('0x2d')],_0x396c9d[_0xf032('0x2f')]);_0x2a1ff3['attributes']=_[_0xf032('0x32')](_0x396c9d[_0xf032('0x2d')],qs[_0xf032('0x33')](_0x46b889['query'][_0xf032('0x33')]));_0x2a1ff3[_0xf032('0x34')]=_0x2a1ff3[_0xf032('0x34')]['length']?_0x2a1ff3[_0xf032('0x34')]:_0x396c9d[_0xf032('0x2d')];if(!_0x46b889[_0xf032('0x2f')][_0xf032('0x35')](_0xf032('0x36'))){_0x2a1ff3['limit']=qs[_0xf032('0x1a')](_0x46b889[_0xf032('0x2f')][_0xf032('0x1a')]);_0x2a1ff3[_0xf032('0x18')]=qs[_0xf032('0x18')](_0x46b889[_0xf032('0x2f')][_0xf032('0x18')]);}_0x2a1ff3[_0xf032('0x37')]=qs[_0xf032('0x38')](_0x46b889[_0xf032('0x2f')][_0xf032('0x38')]);_0x2a1ff3[_0xf032('0x39')]=qs['filters'](_['pick'](_0x46b889['query'],_0x396c9d[_0xf032('0x31')]),_0x434496);if(_0x46b889['query'][_0xf032('0x3a')]){_0x2a1ff3[_0xf032('0x39')]=_['merge'](_0x2a1ff3[_0xf032('0x39')],{'$or':_[_0xf032('0x2e')](_0x434496,function(_0x16ce92){if(_0x16ce92[_0xf032('0x2b')]!==_0xf032('0x3b')){var _0x47980a={};_0x47980a[_0x16ce92[_0xf032('0x26')]]={'$like':'%'+_0x46b889[_0xf032('0x2f')][_0xf032('0x3a')]+'%'};return _0x47980a;}})});}_0x2a1ff3=_[_0xf032('0x3c')]({},_0x2a1ff3,_0x46b889[_0xf032('0x3d')]);var _0x5a98ee={'where':_0x2a1ff3[_0xf032('0x39')]};return db[_0xf032('0x3e')][_0xf032('0x1b')](_0x5a98ee)[_0xf032('0x21')](function(_0x2424c4){_0x38131a[_0xf032('0x1b')]=_0x2424c4;if(_0x46b889['query']['includeAll']){_0x2a1ff3[_0xf032('0x3f')]=[{'all':!![]}];}return db[_0xf032('0x3e')]['findAll'](_0x2a1ff3);})[_0xf032('0x21')](function(_0x2e5a54){_0x38131a[_0xf032('0x40')]=_0x2e5a54;return _0x38131a;})[_0xf032('0x21')](respondWithFilteredResult(_0x4af26f,_0x2a1ff3))[_0xf032('0x41')](handleError(_0x4af26f,null));};exports[_0xf032('0x42')]=function(_0x76cb59,_0x23e6a1){var _0x31c92d={'raw':!![],'where':{'id':_0x76cb59[_0xf032('0x43')]['id']}},_0x51348f={};_0x51348f[_0xf032('0x2d')]=_['keys'](db['Tag'][_0xf032('0x29')]);_0x51348f[_0xf032('0x2f')]=_['keys'](_0x76cb59['query']);_0x51348f['filters']=_[_0xf032('0x32')](_0x51348f[_0xf032('0x2d')],_0x51348f[_0xf032('0x2f')]);_0x31c92d[_0xf032('0x34')]=_[_0xf032('0x32')](_0x51348f['model'],qs[_0xf032('0x33')](_0x76cb59[_0xf032('0x2f')][_0xf032('0x33')]));_0x31c92d[_0xf032('0x34')]=_0x31c92d['attributes'][_0xf032('0x44')]?_0x31c92d[_0xf032('0x34')]:_0x51348f[_0xf032('0x2d')];if(_0x76cb59[_0xf032('0x2f')][_0xf032('0x45')]){_0x31c92d['include']=[{'all':!![]}];}_0x31c92d=_['merge']({},_0x31c92d,_0x76cb59['options']);return db[_0xf032('0x3e')][_0xf032('0x46')](_0x31c92d)['then'](handleEntityNotFound(_0x23e6a1,null))[_0xf032('0x21')](respondWithResult(_0x23e6a1,null))[_0xf032('0x41')](handleError(_0x23e6a1,null));};exports[_0xf032('0x47')]=function(_0x37392a,_0x5501b6){return db[_0xf032('0x3e')]['create'](_0x37392a['body'],{})[_0xf032('0x21')](function(_0x18aac9){var _0x1c5277=_0x37392a[_0xf032('0x48')][_0xf032('0x49')]({'plain':!![]});if(!_0x1c5277)throw new Error(_0xf032('0x4a'));if(_0x1c5277[_0xf032('0x4b')]===_0xf032('0x48')){var _0x3edd07=_0x18aac9[_0xf032('0x49')]({'plain':!![]});var _0x91de0e='Tags';return db[_0xf032('0x4c')][_0xf032('0x46')]({'where':{'name':_0x91de0e,'userProfileId':_0x1c5277['userProfileId']},'raw':!![]})[_0xf032('0x21')](function(_0x50dab5){if(_0x50dab5&&_0x50dab5[_0xf032('0x4d')]===0x0){return db['UserProfileResource'][_0xf032('0x47')]({'name':_0x3edd07[_0xf032('0x26')],'resourceId':_0x3edd07['id'],'type':_0x50dab5[_0xf032('0x26')],'sectionId':_0x50dab5['id']},{})['then'](function(){return _0x18aac9;});}else{return _0x18aac9;}})[_0xf032('0x41')](function(_0xa716c9){logger[_0xf032('0x4e')](_0xf032('0x4f'),_0xa716c9);throw _0xa716c9;});}return _0x18aac9;})['then'](respondWithResult(_0x5501b6,0xc9))[_0xf032('0x41')](handleError(_0x5501b6,null));};exports[_0xf032('0x20')]=function(_0x5a8bdd,_0x5260e4){if(_0x5a8bdd[_0xf032('0x50')]['id']){delete _0x5a8bdd['body']['id'];}return db[_0xf032('0x3e')]['find']({'where':{'id':_0x5a8bdd[_0xf032('0x43')]['id']}})[_0xf032('0x21')](handleEntityNotFound(_0x5260e4,null))[_0xf032('0x21')](saveUpdates(_0x5a8bdd['body'],null))[_0xf032('0x21')](respondWithResult(_0x5260e4,null))['catch'](handleError(_0x5260e4,null));};exports[_0xf032('0x22')]=function(_0x5c5607,_0x433e1a){return db['Tag'][_0xf032('0x46')]({'where':{'id':_0x5c5607[_0xf032('0x43')]['id']}})[_0xf032('0x21')](handleEntityNotFound(_0x433e1a,null))[_0xf032('0x21')](removeEntity(_0x433e1a,null))[_0xf032('0x41')](handleError(_0x433e1a,null));};exports[_0xf032('0x51')]=function(_0x42befa,_0x1a0d3d){return db[_0xf032('0x3e')][_0xf032('0x51')]()[_0xf032('0x21')](respondWithResult(_0x1a0d3d,null))['catch'](handleError(_0x1a0d3d,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index ea1e48d..cf1ae84 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 _0x0d00=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','define','tools_tags','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d00,0x189));var _0x00d0=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0x0d00[_0xaf29da];return _0x295c51;};'use strict';var _=require(_0x00d0('0x0'));var util=require(_0x00d0('0x1'));var logger=require(_0x00d0('0x2'))(_0x00d0('0x3'));var moment=require(_0x00d0('0x4'));var BPromise=require(_0x00d0('0x5'));var rp=require(_0x00d0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00d0('0x7'));var config=require(_0x00d0('0x8'));var attributes=require(_0x00d0('0x9'));module['exports']=function(_0x30ebde,_0x5fe624){return _0x30ebde[_0x00d0('0xa')]('Tag',attributes,{'tableName':_0x00d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf2b=['exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./tag.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaf2b,0x93));var _0xbaf2=function(_0x30662f,_0x4d202e){_0x30662f=_0x30662f-0x0;var _0x40d038=_0xaf2b[_0x30662f];return _0x40d038;};'use strict';var _=require(_0xbaf2('0x0'));var util=require(_0xbaf2('0x1'));var logger=require(_0xbaf2('0x2'))(_0xbaf2('0x3'));var moment=require(_0xbaf2('0x4'));var BPromise=require(_0xbaf2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbaf2('0x6'));var rimraf=require(_0xbaf2('0x7'));var config=require('../../config/environment');var attributes=require(_0xbaf2('0x8'));module[_0xbaf2('0x9')]=function(_0x14a4d1,_0x363ad6){return _0x14a4d1[_0xbaf2('0xa')](_0xbaf2('0xb'),attributes,{'tableName':_0xbaf2('0xc'),'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 a79e017..4d7cb1e 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 _0xe107=['then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x1636eb,_0x3098af){var _0x1bb4f4=function(_0x5ddc29){while(--_0x5ddc29){_0x1636eb['push'](_0x1636eb['shift']());}};_0x1bb4f4(++_0x3098af);}(_0xe107,0xb3));var _0x7e10=function(_0x295bce,_0x225c90){_0x295bce=_0x295bce-0x0;var _0x5c3f99=_0xe107[_0x295bce];return _0x5c3f99;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var moment=require(_0x7e10('0x1'));var BPromise=require(_0x7e10('0x2'));var rs=require(_0x7e10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e10('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e10('0x5'));var config=require(_0x7e10('0x6'));var jayson=require(_0x7e10('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dd3de,_0x7378b3,_0x156c56){return new BPromise(function(_0x3413f7,_0x493958){return client['request'](_0x1dd3de,_0x156c56)[_0x7e10('0x8')](function(_0x490a7a){logger['info'](_0x7e10('0x9'),_0x7378b3,_0x7e10('0xa'));logger[_0x7e10('0xb')](_0x7e10('0xc'),_0x7378b3,_0x7e10('0xa'),JSON['stringify'](_0x490a7a));if(_0x490a7a[_0x7e10('0xd')]){if(_0x490a7a['error'][_0x7e10('0xe')]===0x1f4){logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0x490a7a['error'][_0x7e10('0xf')]);return _0x493958(_0x490a7a[_0x7e10('0xd')][_0x7e10('0xf')]);}logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0x490a7a[_0x7e10('0xd')][_0x7e10('0xf')]);return _0x3413f7(_0x490a7a[_0x7e10('0xd')]['message']);}else{logger[_0x7e10('0x10')](_0x7e10('0x9'),_0x7378b3,'request\x20sent');_0x3413f7(_0x490a7a['result'][_0x7e10('0xf')]);}})['catch'](function(_0xe1abd2){logger[_0x7e10('0xd')](_0x7e10('0x9'),_0x7378b3,_0xe1abd2);_0x493958(_0xe1abd2);});});} \ No newline at end of file +var _0xeec6=['then','info','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5b077b,_0x50b707){var _0x16faf7=function(_0x41ba83){while(--_0x41ba83){_0x5b077b['push'](_0x5b077b['shift']());}};_0x16faf7(++_0x50b707);}(_0xeec6,0x1c2));var _0x6eec=function(_0x55b037,_0x2d9392){_0x55b037=_0x55b037-0x0;var _0x5f1053=_0xeec6[_0x55b037];return _0x5f1053;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('Tag,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 080fbd5..52b1ec4 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 4ef94c1..f6538b5 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 _0x757a=['exports','STRING'];(function(_0xfabbed,_0x436c20){var _0x5857f1=function(_0x36ce8e){while(--_0x36ce8e){_0xfabbed['push'](_0xfabbed['shift']());}};_0x5857f1(++_0x436c20);}(_0x757a,0xde));var _0xa757=function(_0x2beef3,_0x5bd175){_0x2beef3=_0x2beef3-0x0;var _0x135114=_0x757a[_0x2beef3];return _0x135114;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x4873e7,_0xadd09b){var _0x589ef4=function(_0x199c64){while(--_0x199c64){_0x4873e7['push'](_0x4873e7['shift']());}};_0x589ef4(++_0xadd09b);}(_0x757a,0xde));var _0xa757=function(_0x86bcd1,_0x1647b8){_0x86bcd1=_0x86bcd1-0x0;var _0x36fc08=_0x757a[_0x86bcd1];return _0x36fc08;};'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 fca5e09..4f4b91c 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 _0xfc5d=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','name','send','index','map','Team','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','Teams','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','Queues','ids','remove','addAgents','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','online','voicePause','interface','upsert','format','SIP/%s','all','spread','removeAgents','isArray','Sms','Queue:remove','UserVoiceQueueRt','getAgents','pick','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xfc5d,0x8e));var _0xdfc5=function(_0x5576a8,_0xc20c2e){_0x5576a8=_0x5576a8-0x0;var _0x3dbfe8=_0xfc5d[_0x5576a8];return _0x3dbfe8;};'use strict';var emlformat=require(_0xdfc5('0x0'));var rimraf=require(_0xdfc5('0x1'));var zipdir=require(_0xdfc5('0x2'));var jsonpatch=require(_0xdfc5('0x3'));var rp=require(_0xdfc5('0x4'));var moment=require(_0xdfc5('0x5'));var BPromise=require(_0xdfc5('0x6'));var Mustache=require(_0xdfc5('0x7'));var util=require(_0xdfc5('0x8'));var path=require(_0xdfc5('0x9'));var sox=require('sox');var csv=require(_0xdfc5('0xa'));var ejs=require(_0xdfc5('0xb'));var fs=require('fs');var fs_extra=require(_0xdfc5('0xc'));var _=require(_0xdfc5('0xd'));var squel=require('squel');var crypto=require(_0xdfc5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdfc5('0xf'));var toCsv=require(_0xdfc5('0xa'));var querystring=require(_0xdfc5('0x10'));var Papa=require(_0xdfc5('0x11'));var Redis=require(_0xdfc5('0x12'));var authService=require(_0xdfc5('0x13'));var qs=require(_0xdfc5('0x14'));var as=require(_0xdfc5('0x15'));var hardwareService=require(_0xdfc5('0x16'));var logger=require(_0xdfc5('0x17'))('api');var utils=require(_0xdfc5('0x18'));var config=require(_0xdfc5('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdfc5('0x1a'))['db'];config[_0xdfc5('0x1b')]=_[_0xdfc5('0x1c')](config['redis'],{'host':_0xdfc5('0x1d'),'port':0x18eb});var socket=require(_0xdfc5('0x1e'))(new Redis(config[_0xdfc5('0x1b')]));require(_0xdfc5('0x1f'))['register'](socket);function respondWithStatusCode(_0x5684a0,_0x17c951){_0x17c951=_0x17c951||0xcc;return function(_0x59cf5a){if(_0x59cf5a){return _0x5684a0['sendStatus'](_0x17c951);}return _0x5684a0[_0xdfc5('0x20')](_0x17c951)[_0xdfc5('0x21')]();};}function respondWithResult(_0x524ca2,_0x3af208){_0x3af208=_0x3af208||0xc8;return function(_0x533f7d){if(_0x533f7d){return _0x524ca2[_0xdfc5('0x20')](_0x3af208)[_0xdfc5('0x22')](_0x533f7d);}};}function respondWithFilteredResult(_0x5cb666,_0x5c60c6){return function(_0x46212f){if(_0x46212f){var _0xd4f67=typeof _0x5c60c6[_0xdfc5('0x23')]===_0xdfc5('0x24')&&typeof _0x5c60c6['limit']===_0xdfc5('0x24');var _0x3e7829=_0x46212f[_0xdfc5('0x25')];var _0x31955b=_0xd4f67?0x0:_0x5c60c6[_0xdfc5('0x23')];var _0x50b1fe=_0xd4f67?_0x46212f[_0xdfc5('0x25')]:_0x5c60c6[_0xdfc5('0x23')]+_0x5c60c6[_0xdfc5('0x26')];var _0x402fe7;if(_0x50b1fe>=_0x3e7829){_0x50b1fe=_0x3e7829;_0x402fe7=0xc8;}else{_0x402fe7=0xce;}_0x5cb666[_0xdfc5('0x20')](_0x402fe7);return _0x5cb666[_0xdfc5('0x27')](_0xdfc5('0x28'),_0x31955b+'-'+_0x50b1fe+'/'+_0x3e7829)[_0xdfc5('0x22')](_0x46212f);}return null;};}function patchUpdates(_0x5e72c6){return function(_0x5dcbde){try{jsonpatch[_0xdfc5('0x29')](_0x5dcbde,_0x5e72c6,!![]);}catch(_0x11a166){return BPromise[_0xdfc5('0x2a')](_0x11a166);}return _0x5dcbde['save']();};}function saveUpdates(_0x3edbb7,_0x1b3529){return function(_0x4f08fb){if(_0x4f08fb){return _0x4f08fb[_0xdfc5('0x2b')](_0x3edbb7)[_0xdfc5('0x2c')](function(_0x2460f5){return _0x2460f5;});}return null;};}function handleEntityNotFound(_0x5e515d,_0x1c3f3c){return function(_0x56ee28){if(!_0x56ee28){_0x5e515d[_0xdfc5('0x2d')](0x194);}return _0x56ee28;};}function handleError(_0x1ecc73,_0xea44e1){_0xea44e1=_0xea44e1||0x1f4;return function(_0x1e84d6){logger[_0xdfc5('0x2e')](_0x1e84d6['stack']);if(_0x1e84d6[_0xdfc5('0x2f')]){delete _0x1e84d6[_0xdfc5('0x2f')];}_0x1ecc73[_0xdfc5('0x20')](_0xea44e1)[_0xdfc5('0x30')](_0x1e84d6);};}exports[_0xdfc5('0x31')]=function(_0x57040f,_0x19405b){var _0x25fd14={},_0x1f3ec0={},_0x1b0328={'count':0x0,'rows':[]};var _0xd7dc7b=_[_0xdfc5('0x32')](db[_0xdfc5('0x33')][_0xdfc5('0x34')],function(_0x16c94d){return{'name':_0x16c94d['fieldName'],'type':_0x16c94d[_0xdfc5('0x35')]['key']};});_0x1f3ec0[_0xdfc5('0x36')]=_['map'](_0xd7dc7b,_0xdfc5('0x2f'));_0x1f3ec0[_0xdfc5('0x37')]=_[_0xdfc5('0x38')](_0x57040f[_0xdfc5('0x37')]);_0x1f3ec0[_0xdfc5('0x39')]=_[_0xdfc5('0x3a')](_0x1f3ec0[_0xdfc5('0x36')],_0x1f3ec0[_0xdfc5('0x37')]);_0x25fd14[_0xdfc5('0x3b')]=_[_0xdfc5('0x3a')](_0x1f3ec0[_0xdfc5('0x36')],qs[_0xdfc5('0x3c')](_0x57040f[_0xdfc5('0x37')][_0xdfc5('0x3c')]));_0x25fd14[_0xdfc5('0x3b')]=_0x25fd14[_0xdfc5('0x3b')]['length']?_0x25fd14[_0xdfc5('0x3b')]:_0x1f3ec0[_0xdfc5('0x36')];if(!_0x57040f[_0xdfc5('0x37')]['hasOwnProperty'](_0xdfc5('0x3d'))){_0x25fd14[_0xdfc5('0x26')]=qs['limit'](_0x57040f[_0xdfc5('0x37')][_0xdfc5('0x26')]);_0x25fd14[_0xdfc5('0x23')]=qs[_0xdfc5('0x23')](_0x57040f[_0xdfc5('0x37')][_0xdfc5('0x23')]);}_0x25fd14[_0xdfc5('0x3e')]=qs[_0xdfc5('0x3f')](_0x57040f['query']['sort']);_0x25fd14[_0xdfc5('0x40')]=qs[_0xdfc5('0x39')](_['pick'](_0x57040f['query'],_0x1f3ec0[_0xdfc5('0x39')]),_0xd7dc7b);if(_0x57040f['query'][_0xdfc5('0x41')]){_0x25fd14[_0xdfc5('0x40')]=_[_0xdfc5('0x42')](_0x25fd14['where'],{'$or':_[_0xdfc5('0x32')](_0xd7dc7b,function(_0x4ba4ca){if(_0x4ba4ca[_0xdfc5('0x35')]!==_0xdfc5('0x43')){var _0x380652={};_0x380652[_0x4ba4ca['name']]={'$like':'%'+_0x57040f['query'][_0xdfc5('0x41')]+'%'};return _0x380652;}})});}_0x25fd14=_[_0xdfc5('0x42')]({},_0x25fd14,_0x57040f['options']);var _0x731245={'where':_0x25fd14[_0xdfc5('0x40')]};return db[_0xdfc5('0x33')]['count'](_0x731245)['then'](function(_0x249f97){_0x1b0328[_0xdfc5('0x25')]=_0x249f97;if(_0x57040f[_0xdfc5('0x37')][_0xdfc5('0x44')]){_0x25fd14[_0xdfc5('0x45')]=[{'all':!![]}];}return db[_0xdfc5('0x33')][_0xdfc5('0x46')](_0x25fd14);})['then'](function(_0x49af08){_0x1b0328[_0xdfc5('0x47')]=_0x49af08;return _0x1b0328;})[_0xdfc5('0x2c')](respondWithFilteredResult(_0x19405b,_0x25fd14))[_0xdfc5('0x48')](handleError(_0x19405b,null));};exports['show']=function(_0x128890,_0x300e09){var _0x522af5={'raw':![],'where':{'id':_0x128890[_0xdfc5('0x49')]['id']}},_0x322c7c={};_0x322c7c[_0xdfc5('0x36')]=_['keys'](db[_0xdfc5('0x33')][_0xdfc5('0x34')]);_0x322c7c[_0xdfc5('0x37')]=_[_0xdfc5('0x38')](_0x128890['query']);_0x322c7c['filters']=_[_0xdfc5('0x3a')](_0x322c7c[_0xdfc5('0x36')],_0x322c7c[_0xdfc5('0x37')]);_0x522af5['attributes']=_['intersection'](_0x322c7c['model'],qs[_0xdfc5('0x3c')](_0x128890[_0xdfc5('0x37')]['fields']));_0x522af5[_0xdfc5('0x3b')]=_0x522af5[_0xdfc5('0x3b')][_0xdfc5('0x4a')]?_0x522af5[_0xdfc5('0x3b')]:_0x322c7c[_0xdfc5('0x36')];if(_0x128890[_0xdfc5('0x37')]['includeAll']){_0x522af5[_0xdfc5('0x45')]=[{'all':!![]}];}_0x522af5=_['merge']({},_0x522af5,_0x128890[_0xdfc5('0x4b')]);return db['Team'][_0xdfc5('0x4c')](_0x522af5)[_0xdfc5('0x2c')](handleEntityNotFound(_0x300e09,null))[_0xdfc5('0x2c')](respondWithResult(_0x300e09,null))[_0xdfc5('0x48')](handleError(_0x300e09,null));};exports['create']=function(_0x4050d6,_0x39ba52){return db[_0xdfc5('0x33')][_0xdfc5('0x4d')](_0x4050d6['body'],{})['then'](function(_0x4806a2){var _0x132304=_0x4050d6[_0xdfc5('0x4e')][_0xdfc5('0x4f')]({'plain':!![]});if(!_0x132304)throw new Error(_0xdfc5('0x50'));if(_0x132304[_0xdfc5('0x51')]==='user'){var _0x265501=_0x4806a2[_0xdfc5('0x4f')]({'plain':!![]});var _0x41fd91='Teams';return db[_0xdfc5('0x52')][_0xdfc5('0x4c')]({'where':{'name':_0x41fd91,'userProfileId':_0x132304['userProfileId']},'raw':!![]})['then'](function(_0x252a5e){if(_0x252a5e&&_0x252a5e[_0xdfc5('0x53')]===0x0){return db['UserProfileResource'][_0xdfc5('0x4d')]({'name':_0x265501[_0xdfc5('0x2f')],'resourceId':_0x265501['id'],'type':_0x252a5e[_0xdfc5('0x2f')],'sectionId':_0x252a5e['id']},{})[_0xdfc5('0x2c')](function(){return _0x4806a2;});}else{return _0x4806a2;}})[_0xdfc5('0x48')](function(_0x10b829){logger['error'](_0xdfc5('0x54'),_0x10b829);throw _0x10b829;});}return _0x4806a2;})[_0xdfc5('0x2c')](respondWithResult(_0x39ba52,0xc9))[_0xdfc5('0x48')](handleError(_0x39ba52,null));};exports['update']=function(_0x274404,_0x40a9f0){if(_0x274404[_0xdfc5('0x55')]['id']){delete _0x274404[_0xdfc5('0x55')]['id'];}return db[_0xdfc5('0x33')][_0xdfc5('0x4c')]({'where':{'id':_0x274404[_0xdfc5('0x49')]['id']}})[_0xdfc5('0x2c')](handleEntityNotFound(_0x40a9f0,null))[_0xdfc5('0x2c')](saveUpdates(_0x274404['body'],null))[_0xdfc5('0x2c')](respondWithResult(_0x40a9f0,null))[_0xdfc5('0x48')](handleError(_0x40a9f0,null));};exports[_0xdfc5('0x56')]=function(_0x6b6324,_0x185334){var _0x17c07d=_0x6b6324[_0xdfc5('0x49')]['id'];var _0x79df6e=[];return db[_0xdfc5('0x57')][_0xdfc5('0x58')](function(_0x360b1a){var _0x2c58f9=_0xdfc5('0x59')+_0x17c07d;return db[_0xdfc5('0x57')][_0xdfc5('0x37')](_0x2c58f9,{'type':db[_0xdfc5('0x5a')]['QueryTypes'][_0xdfc5('0x5b')],'raw':!![],'transaction':_0x360b1a})[_0xdfc5('0x2c')](function(_0x4d16a2){_0x79df6e=_[_0xdfc5('0x32')](_0x4d16a2,function(_0x40e414){return Number(_0x40e414[_0xdfc5('0x5c')]);});})[_0xdfc5('0x2c')](function(){var _0x3a280c=_0xdfc5('0x5d')+_0x17c07d;return db[_0xdfc5('0x57')][_0xdfc5('0x37')](_0x3a280c,{'type':db[_0xdfc5('0x5a')][_0xdfc5('0x5e')][_0xdfc5('0x5b')],'raw':!![],'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(_0x4de69f){var _0x1d6468=_[_0xdfc5('0x32')](_0x4de69f,function(_0x1eef38){return Number(_0x1eef38[_0xdfc5('0x5f')]);});return db['UserVoiceQueue'][_0xdfc5('0x56')]({'where':{'UserId':{'$in':_0x79df6e},'VoiceQueueId':{'$in':_0x1d6468}},'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(){var _0x4368e3=_0xdfc5('0x60')+_0x17c07d;return db[_0xdfc5('0x57')]['query'](_0x4368e3,{'type':db[_0xdfc5('0x5a')][_0xdfc5('0x5e')][_0xdfc5('0x5b')],'raw':!![],'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(_0xae72d0){var _0x2bf76b=_[_0xdfc5('0x32')](_0xae72d0,function(_0x321cff){return Number(_0x321cff[_0xdfc5('0x61')]);});return db[_0xdfc5('0x62')][_0xdfc5('0x56')]({'where':{'UserId':{'$in':_0x79df6e},'MailQueueId':{'$in':_0x2bf76b}},'transaction':_0x360b1a});})['then'](function(){var _0x188a5b=_0xdfc5('0x63')+_0x17c07d;return db[_0xdfc5('0x57')]['query'](_0x188a5b,{'type':db[_0xdfc5('0x5a')][_0xdfc5('0x5e')]['SELECT'],'raw':!![],'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(_0x4986b9){var _0x4de1e3=_['map'](_0x4986b9,function(_0x1d44f9){return Number(_0x1d44f9[_0xdfc5('0x64')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x79df6e},'SmsQueueId':{'$in':_0x4de1e3}},'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(){var _0x459798=_0xdfc5('0x65')+_0x17c07d;return db[_0xdfc5('0x57')]['query'](_0x459798,{'type':db[_0xdfc5('0x5a')][_0xdfc5('0x5e')][_0xdfc5('0x5b')],'raw':!![],'transaction':_0x360b1a});})['then'](function(_0x5e644a){var _0x4d99d3=_[_0xdfc5('0x32')](_0x5e644a,function(_0x5f1a8d){return Number(_0x5f1a8d[_0xdfc5('0x66')]);});return db[_0xdfc5('0x67')][_0xdfc5('0x56')]({'where':{'UserId':{'$in':_0x79df6e},'ChatQueueId':{'$in':_0x4d99d3}},'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(){var _0x38da0e='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17c07d;return db[_0xdfc5('0x57')][_0xdfc5('0x37')](_0x38da0e,{'type':db[_0xdfc5('0x5a')]['QueryTypes'][_0xdfc5('0x5b')],'raw':!![],'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(_0x1823a6){var _0x33076c=_['map'](_0x1823a6,function(_0x2c691f){return Number(_0x2c691f[_0xdfc5('0x68')]);});return db[_0xdfc5('0x69')][_0xdfc5('0x56')]({'where':{'UserId':{'$in':_0x79df6e},'FaxQueueId':{'$in':_0x33076c}},'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(){var _0x5ce065=_0xdfc5('0x6a')+_0x17c07d;return db[_0xdfc5('0x57')][_0xdfc5('0x37')](_0x5ce065,{'type':db[_0xdfc5('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(_0x560b31){var _0x3c79fb=_['map'](_0x560b31,function(_0x1c2b58){return Number(_0x1c2b58[_0xdfc5('0x6b')]);});return db[_0xdfc5('0x6c')][_0xdfc5('0x56')]({'where':{'UserId':{'$in':_0x79df6e},'OpenchannelQueueId':{'$in':_0x3c79fb}},'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(){var _0x47e59e=_0xdfc5('0x6d')+_0x17c07d;return db[_0xdfc5('0x57')][_0xdfc5('0x37')](_0x47e59e,{'type':db[_0xdfc5('0x5a')]['QueryTypes'][_0xdfc5('0x5b')],'raw':!![],'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(_0x31ce2a){var _0x549098=_[_0xdfc5('0x32')](_0x31ce2a,function(_0x3bd6d3){return Number(_0x3bd6d3[_0xdfc5('0x6e')]);});return db[_0xdfc5('0x6f')][_0xdfc5('0x56')]({'where':{'UserId':{'$in':_0x79df6e},'WhatsappQueueId':{'$in':_0x549098}},'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(){return db[_0xdfc5('0x70')][_0xdfc5('0x4c')]({'where':{'TeamId':_0x17c07d}});})[_0xdfc5('0x2c')](function(_0x47619d){if(_0x47619d===null){return;}return db[_0xdfc5('0x71')]['destroy']({'where':{'UserId':{'$in':_0x79df6e},'VoicePrefixId':_0x47619d[_0xdfc5('0x72')]},'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(){return db[_0xdfc5('0x33')][_0xdfc5('0x56')]({'where':{'id':_0x17c07d},'cascade':!![],'transaction':_0x360b1a});})[_0xdfc5('0x2c')](function(_0x3c1e47){if(_0x3c1e47===0x0){_0x185334[_0xdfc5('0x2d')](0x194);}else{return db[_0xdfc5('0x73')]['destroy']({'where':{'type':_0xdfc5('0x74'),'resourceId':_0x17c07d},'cascade':!![],'transaction':_0x360b1a})[_0xdfc5('0x2c')](function(){_0x185334[_0xdfc5('0x20')](0xcc)['end']();});}})[_0xdfc5('0x48')](function(_0x2bf3ce){_0x185334[_0xdfc5('0x20')](0x1f4)['send'](_0x2bf3ce);});});};exports[_0xdfc5('0x75')]=function(_0x4935ff,_0x3d1a72,_0x12f7a1){return db[_0xdfc5('0x33')][_0xdfc5('0x76')]({'where':{'id':_0x4935ff[_0xdfc5('0x49')]['id']}})['then'](handleEntityNotFound(_0x3d1a72,null))[_0xdfc5('0x2c')](function(_0x287ef2){if(!_0x4935ff['query']['channel']||!utils[_0xdfc5('0x77')](_0x4935ff[_0xdfc5('0x37')][_0xdfc5('0x78')])){throw new db[(_0xdfc5('0x5a'))][(_0xdfc5('0x79'))](_0xdfc5('0x7a'));}var _0x3c18cb={};var _0x587d2f={};_0x587d2f[_0xdfc5('0x36')]=_['keys'](db[_[_0xdfc5('0x7b')](_0x4935ff[_0xdfc5('0x37')][_0xdfc5('0x78')][_0xdfc5('0x7c')]())+_0xdfc5('0x7d')][_0xdfc5('0x34')]);_0x587d2f[_0xdfc5('0x37')]=_[_0xdfc5('0x38')](_0x4935ff[_0xdfc5('0x37')]);_0x587d2f[_0xdfc5('0x39')]=_[_0xdfc5('0x3a')](_0x587d2f[_0xdfc5('0x36')],_0x587d2f[_0xdfc5('0x37')]);_0x3c18cb[_0xdfc5('0x3b')]=_[_0xdfc5('0x3a')](_0x587d2f[_0xdfc5('0x36')],qs['fields'](_0x4935ff[_0xdfc5('0x37')]['fields']));_0x3c18cb[_0xdfc5('0x3b')]=_0x3c18cb['attributes'][_0xdfc5('0x4a')]?_0x3c18cb[_0xdfc5('0x3b')]:_0x587d2f[_0xdfc5('0x36')];_0x3c18cb[_0xdfc5('0x26')]=qs[_0xdfc5('0x26')](_0x4935ff[_0xdfc5('0x37')][_0xdfc5('0x26')]);_0x3c18cb[_0xdfc5('0x23')]=qs['offset'](_0x4935ff[_0xdfc5('0x37')][_0xdfc5('0x23')]);_0x3c18cb[_0xdfc5('0x3e')]=qs[_0xdfc5('0x3f')](_0x4935ff[_0xdfc5('0x37')]['sort']);_0x3c18cb[_0xdfc5('0x40')]=qs[_0xdfc5('0x39')](_['pick'](_0x4935ff['query'],_0x587d2f[_0xdfc5('0x39')]));_0x3c18cb=_['merge']({},_0x3c18cb,_0x4935ff[_0xdfc5('0x4b')]);return _0x287ef2['get'+_[_0xdfc5('0x7b')](_0x4935ff[_0xdfc5('0x37')][_0xdfc5('0x78')][_0xdfc5('0x7c')]())+'Queues'](_0x3c18cb);})[_0xdfc5('0x2c')](respondWithResult(_0x3d1a72,null))[_0xdfc5('0x48')](handleError(_0x3d1a72,null));};exports[_0xdfc5('0x7e')]=function(_0x208a14,_0x40d5dd,_0x18423b){return db['Team'][_0xdfc5('0x76')]({'where':{'id':_0x208a14[_0xdfc5('0x49')]['id']}})[_0xdfc5('0x2c')](function(_0x432ae1){if(_0x432ae1){if(!_0x208a14[_0xdfc5('0x55')][_0xdfc5('0x78')]||!utils[_0xdfc5('0x77')](_0x208a14[_0xdfc5('0x55')][_0xdfc5('0x78')])){throw new db[(_0xdfc5('0x5a'))][(_0xdfc5('0x79'))]('Unknown\x20channel');}return _0x432ae1['add'+_[_0xdfc5('0x7b')](_0x208a14[_0xdfc5('0x55')][_0xdfc5('0x78')][_0xdfc5('0x7c')]())+_0xdfc5('0x7f')](_0x208a14[_0xdfc5('0x55')][_0xdfc5('0x80')]);}return null;})[_0xdfc5('0x2c')](handleEntityNotFound(_0x40d5dd,null))['then'](respondWithStatusCode(_0x40d5dd,null))[_0xdfc5('0x48')](handleError(_0x40d5dd,null));};exports['removeQueues']=function(_0x21241c,_0x37ab31,_0x47923b){return db[_0xdfc5('0x33')]['findOne']({'where':{'id':_0x21241c[_0xdfc5('0x49')]['id']}})[_0xdfc5('0x2c')](function(_0x2d77e2){if(_0x2d77e2){if(!_0x21241c['query'][_0xdfc5('0x78')]||!utils[_0xdfc5('0x77')](_0x21241c[_0xdfc5('0x37')][_0xdfc5('0x78')])){throw new db[(_0xdfc5('0x5a'))][(_0xdfc5('0x79'))](_0xdfc5('0x7a'));}return _0x2d77e2[_0xdfc5('0x81')+_['capitalize'](_0x21241c[_0xdfc5('0x37')][_0xdfc5('0x78')][_0xdfc5('0x7c')]())+'Queues'](_0x21241c[_0xdfc5('0x37')][_0xdfc5('0x80')]);}return null;})['then'](handleEntityNotFound(_0x37ab31,null))[_0xdfc5('0x2c')](respondWithStatusCode(_0x37ab31,null))[_0xdfc5('0x48')](handleError(_0x37ab31,null));};exports[_0xdfc5('0x82')]=function(_0x34adb5,_0x5a0c72){var _0x3d8ff3=_['isArray'](_0x34adb5[_0xdfc5('0x55')]['ids'])?_0x34adb5[_0xdfc5('0x55')]['ids']:[_0x34adb5[_0xdfc5('0x55')]['ids']];var _0x4791ab=_0x34adb5[_0xdfc5('0x49')]['id'];return db[_0xdfc5('0x33')][_0xdfc5('0x4c')]({'where':{'id':_0x4791ab}})[_0xdfc5('0x2c')](handleEntityNotFound(_0x5a0c72,null))['then'](function(_0x5913ff){if(_0x5913ff){var _0x1af56d=[_0xdfc5('0x83'),_0xdfc5('0x84'),_0xdfc5('0x85'),'Sms',_0xdfc5('0x86'),_0xdfc5('0x87'),_0xdfc5('0x88')];return db[_0xdfc5('0x57')][_0xdfc5('0x58')](function(_0x4cde8a){var _0x4cbec6=_[_0xdfc5('0x32')](_0x1af56d,function(_0xf5fc26){var _0x542b87={'attributes':['id','name']};if(_0xf5fc26===_0xdfc5('0x83')){_0x542b87[_0xdfc5('0x89')]={'attributes':['penalty']};}return _0x5913ff[_0xdfc5('0x4f')+_0xf5fc26+_0xdfc5('0x7f')](_0x542b87)[_0xdfc5('0x2c')](function(_0x20f376){var _0x3a1a63=_[_0xdfc5('0x32')](_0x20f376,function(_0x2fd08d){var _0x1383ec=_[_0xdfc5('0x32')](_0x3d8ff3,function(_0x20bfa0){var _0x4d228c={'where':{'UserId':_0x20bfa0,[_0xf5fc26+_0xdfc5('0x8a')]:_0x2fd08d['id']},'transaction':_0x4cde8a};if(_0xf5fc26===_0xdfc5('0x83')){_0x4d228c[_0xdfc5('0x1c')]={'penalty':_0x2fd08d[_0xdfc5('0x8b')][_0xdfc5('0x8c')]};}return db[_0xdfc5('0x8d')+_0xf5fc26+_0xdfc5('0x7d')][_0xdfc5('0x8e')](_0x4d228c)['then'](function(){socket[_0xdfc5('0x8f')](_0xdfc5('0x4e')+_0xf5fc26+_0xdfc5('0x90'),{'UserId':_0x20bfa0,[_0xf5fc26+_0xdfc5('0x8a')]:_0x2fd08d['id']});if(_0xf5fc26!=='Voice'){return;}return db[_0xdfc5('0x8d')][_0xdfc5('0x46')]({'where':{'id':_0x3d8ff3,'online':0x1},'attributes':['id',_0xdfc5('0x2f'),_0xdfc5('0x91'),_0xdfc5('0x92'),_0xdfc5('0x93')],'raw':!![]})[_0xdfc5('0x2c')](function(_0x449433){var _0x4930dd=_['map'](_0x449433,function(_0x2e19dd){return db['UserVoiceQueueRt'][_0xdfc5('0x94')]({'membername':_0x2e19dd['name'],'UserId':_0x2e19dd['id'],'queue_name':_0x2fd08d[_0xdfc5('0x2f')],'VoiceQueueId':_0x2fd08d['id'],'interface':_['isNil'](_0x2e19dd[_0xdfc5('0x93')])?util[_0xdfc5('0x95')](_0xdfc5('0x96'),_0x2e19dd[_0xdfc5('0x2f')]):_0x2e19dd[_0xdfc5('0x93')],'paused':_0x2e19dd[_0xdfc5('0x92')]||![],'penalty':_0x2fd08d[_0xdfc5('0x8b')]['penalty']},{'transaction':_0x4cde8a});});return Promise[_0xdfc5('0x97')](_0x4930dd);});});});return Promise[_0xdfc5('0x97')](_0x1383ec);});return Promise[_0xdfc5('0x97')](_0x3a1a63);})[_0xdfc5('0x2c')](function(){return db[_0xdfc5('0x70')][_0xdfc5('0x76')]({'where':{'teamId':_0x4791ab}})['then'](function(_0x1a69fd){if(_0x1a69fd){var _0x5b4a08=_['map'](_0x3d8ff3,function(_0x59184d){db['UserVoicePrefix'][_0xdfc5('0x94')]({'UserId':_0x59184d,'VoicePrefixId':_0x1a69fd[_0xdfc5('0x72')]});});return Promise[_0xdfc5('0x97')](_0x5b4a08);}});});});return Promise[_0xdfc5('0x97')](_0x4cbec6)[_0xdfc5('0x2c')](function(){return _0x5913ff[_0xdfc5('0x82')](_0x3d8ff3,{'transaction':_0x4cde8a})[_0xdfc5('0x98')](function(_0x3af5ab){return _0x3af5ab;});});});}})[_0xdfc5('0x2c')](respondWithResult(_0x5a0c72,null))[_0xdfc5('0x48')](handleError(_0x5a0c72,null));};exports[_0xdfc5('0x99')]=function(_0x3148ef,_0x580433){var _0x493692=_[_0xdfc5('0x9a')](_0x3148ef[_0xdfc5('0x37')][_0xdfc5('0x80')])?_0x3148ef[_0xdfc5('0x37')][_0xdfc5('0x80')]:[_0x3148ef[_0xdfc5('0x37')]['ids']];var _0x5047b9=_0x3148ef[_0xdfc5('0x49')]['id'];return db[_0xdfc5('0x33')][_0xdfc5('0x4c')]({'where':{'id':_0x5047b9}})[_0xdfc5('0x2c')](handleEntityNotFound(_0x580433,null))[_0xdfc5('0x2c')](function(_0x37f410){if(_0x37f410){var _0x3acc36=[_0xdfc5('0x83'),_0xdfc5('0x84'),_0xdfc5('0x85'),_0xdfc5('0x9b'),_0xdfc5('0x86'),'Openchannel',_0xdfc5('0x88')];return db[_0xdfc5('0x57')][_0xdfc5('0x58')](function(_0x4f3e10){var _0x10f71d=_[_0xdfc5('0x32')](_0x3acc36,function(_0x233dbc){var _0x1250eb={'attributes':['id',_0xdfc5('0x2f')]};return _0x37f410['get'+_0x233dbc+'Queues'](_0x1250eb)[_0xdfc5('0x2c')](function(_0x509df6){var _0x188d5e=_[_0xdfc5('0x32')](_0x509df6,function(_0x155e57){return _0x155e57['removeAgents'](_0x493692,{'transaction':_0x4f3e10})[_0xdfc5('0x2c')](function(){var _0xbaec88=_['map'](_0x493692,function(_0x333cb){socket[_0xdfc5('0x8f')]('user'+_0x233dbc+_0xdfc5('0x9c'),{'UserId':Number(_0x333cb),[_0x233dbc+_0xdfc5('0x8a')]:_0x155e57['id']});if(_0x233dbc!==_0xdfc5('0x83')){return;}return db[_0xdfc5('0x9d')][_0xdfc5('0x56')]({'where':{'VoiceQueueId':_0x155e57['id'],'UserId':_0x333cb},'transaction':_0x4f3e10});});return Promise[_0xdfc5('0x97')](_0xbaec88);});});return Promise[_0xdfc5('0x97')](_0x188d5e);});});return Promise[_0xdfc5('0x97')](_0x10f71d)[_0xdfc5('0x2c')](function(){return _0x37f410[_0xdfc5('0x99')](_0x493692,{'transaction':_0x4f3e10});})[_0xdfc5('0x2c')](function(){return db[_0xdfc5('0x70')]['findOne']({'where':{'teamId':_0x5047b9}})[_0xdfc5('0x2c')](function(_0x2faa27){if(_0x2faa27){var _0xd3c9f=_[_0xdfc5('0x32')](_0x493692,function(_0x242d07){db['UserVoicePrefix'][_0xdfc5('0x56')]({'where':{'UserId':_0x242d07,'VoicePrefixId':_0x2faa27[_0xdfc5('0x72')]}});});return Promise[_0xdfc5('0x97')](_0xd3c9f);}});});});}})[_0xdfc5('0x2c')](respondWithStatusCode(_0x580433,null))['catch'](handleError(_0x580433,null));};exports[_0xdfc5('0x9e')]=function(_0x2a13b8,_0x280b2e,_0x157eb1){var _0x539540={};var _0x3c1e55={};var _0x2bd4e0;var _0x8cd655;return db[_0xdfc5('0x33')][_0xdfc5('0x76')]({'where':{'id':_0x2a13b8[_0xdfc5('0x49')]['id']}})['then'](handleEntityNotFound(_0x280b2e,null))[_0xdfc5('0x2c')](function(_0x57975d){if(_0x57975d){_0x2bd4e0=_0x57975d;_0x3c1e55[_0xdfc5('0x36')]=_[_0xdfc5('0x38')](db[_0xdfc5('0x8d')][_0xdfc5('0x34')]);_0x3c1e55[_0xdfc5('0x37')]=_[_0xdfc5('0x38')](_0x2a13b8['query']);_0x3c1e55[_0xdfc5('0x39')]=_[_0xdfc5('0x3a')](_0x3c1e55['model'],_0x3c1e55['query']);_0x539540['attributes']=_['intersection'](_0x3c1e55[_0xdfc5('0x36')],qs[_0xdfc5('0x3c')](_0x2a13b8[_0xdfc5('0x37')][_0xdfc5('0x3c')]));_0x539540['attributes']=_0x539540[_0xdfc5('0x3b')][_0xdfc5('0x4a')]?_0x539540[_0xdfc5('0x3b')]:_0x3c1e55[_0xdfc5('0x36')];_0x539540[_0xdfc5('0x3e')]=qs[_0xdfc5('0x3f')](_0x2a13b8[_0xdfc5('0x37')][_0xdfc5('0x3f')]);_0x539540[_0xdfc5('0x40')]=qs[_0xdfc5('0x39')](_[_0xdfc5('0x9f')](_0x2a13b8[_0xdfc5('0x37')],_0x3c1e55[_0xdfc5('0x39')]));if(_0x2a13b8[_0xdfc5('0x37')]['filter']){_0x539540['where']=_[_0xdfc5('0x42')](_0x539540['where'],{'$or':_['map'](_0x539540[_0xdfc5('0x3b')],function(_0x1d3ae1){var _0x15df79={};_0x15df79[_0x1d3ae1]={'$like':'%'+_0x2a13b8[_0xdfc5('0x37')][_0xdfc5('0x41')]+'%'};return _0x15df79;})});}_0x539540=_[_0xdfc5('0x42')]({},_0x539540,_0x2a13b8[_0xdfc5('0x4b')]);return _0x2bd4e0[_0xdfc5('0x9e')](_0x539540);}})[_0xdfc5('0x2c')](function(_0x178422){if(_0x178422){_0x8cd655=_0x178422[_0xdfc5('0x4a')];if(!_0x2a13b8[_0xdfc5('0x37')][_0xdfc5('0xa0')]('nolimit')){_0x539540[_0xdfc5('0x26')]=qs['limit'](_0x2a13b8[_0xdfc5('0x37')][_0xdfc5('0x26')]);_0x539540[_0xdfc5('0x23')]=qs[_0xdfc5('0x23')](_0x2a13b8['query'][_0xdfc5('0x23')]);}return _0x2bd4e0[_0xdfc5('0x9e')](_0x539540);}})[_0xdfc5('0x2c')](function(_0x39ee29){if(_0x39ee29){return _0x39ee29?{'count':_0x8cd655,'rows':_0x39ee29}:null;}})[_0xdfc5('0x2c')](respondWithResult(_0x280b2e,null))[_0xdfc5('0x48')](handleError(_0x280b2e,null));}; \ No newline at end of file +var _0x0734=['UserVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','get','Queues','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Fax','Openchannel','transaction','through','penalty','TeamVoiceQueue','findOrCreate','Queue:save','findAll','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','TeamVoicePrefix','spread','Sms','Whatsapp','removeAgents','QueueId','getAgents','User','pick','eml-format','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','Team','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','include','catch','includeAll','find','create','body','user','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue'];(function(_0x429477,_0x49affb){var _0x1d5f94=function(_0x202332){while(--_0x202332){_0x429477['push'](_0x429477['shift']());}};_0x1d5f94(++_0x49affb);}(_0x0734,0x161));var _0x4073=function(_0x177f15,_0x47214f){_0x177f15=_0x177f15-0x0;var _0x3683f6=_0x0734[_0x177f15];return _0x3683f6;};'use strict';var emlformat=require(_0x4073('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4073('0x1'));var BPromise=require(_0x4073('0x2'));var Mustache=require(_0x4073('0x3'));var util=require('util');var path=require(_0x4073('0x4'));var sox=require(_0x4073('0x5'));var csv=require('to-csv');var ejs=require(_0x4073('0x6'));var fs=require('fs');var fs_extra=require(_0x4073('0x7'));var _=require(_0x4073('0x8'));var squel=require('squel');var crypto=require(_0x4073('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4073('0xa'));var Papa=require(_0x4073('0xb'));var Redis=require('ioredis');var authService=require(_0x4073('0xc'));var qs=require(_0x4073('0xd'));var as=require(_0x4073('0xe'));var hardwareService=require(_0x4073('0xf'));var logger=require(_0x4073('0x10'))('api');var utils=require(_0x4073('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x4073('0x12'));var db=require(_0x4073('0x13'))['db'];config[_0x4073('0x14')]=_[_0x4073('0x15')](config['redis'],{'host':_0x4073('0x16'),'port':0x18eb});var socket=require(_0x4073('0x17'))(new Redis(config['redis']));require(_0x4073('0x18'))[_0x4073('0x19')](socket);function respondWithStatusCode(_0x33d8dd,_0x1a3ad5){_0x1a3ad5=_0x1a3ad5||0xcc;return function(_0x254b4b){if(_0x254b4b){return _0x33d8dd[_0x4073('0x1a')](_0x1a3ad5);}return _0x33d8dd[_0x4073('0x1b')](_0x1a3ad5)['end']();};}function respondWithResult(_0x485de8,_0x1fd75b){_0x1fd75b=_0x1fd75b||0xc8;return function(_0x450a9c){if(_0x450a9c){return _0x485de8['status'](_0x1fd75b)[_0x4073('0x1c')](_0x450a9c);}};}function respondWithFilteredResult(_0x38c113,_0x2adbfe){return function(_0x105c0e){if(_0x105c0e){var _0x284b4e=typeof _0x2adbfe[_0x4073('0x1d')]==='undefined'&&typeof _0x2adbfe[_0x4073('0x1e')]==='undefined';var _0x597bfc=_0x105c0e[_0x4073('0x1f')];var _0x191b56=_0x284b4e?0x0:_0x2adbfe[_0x4073('0x1d')];var _0xe3d8a0=_0x284b4e?_0x105c0e[_0x4073('0x1f')]:_0x2adbfe[_0x4073('0x1d')]+_0x2adbfe['limit'];var _0x3888a6;if(_0xe3d8a0>=_0x597bfc){_0xe3d8a0=_0x597bfc;_0x3888a6=0xc8;}else{_0x3888a6=0xce;}_0x38c113[_0x4073('0x1b')](_0x3888a6);return _0x38c113[_0x4073('0x20')](_0x4073('0x21'),_0x191b56+'-'+_0xe3d8a0+'/'+_0x597bfc)[_0x4073('0x1c')](_0x105c0e);}return null;};}function patchUpdates(_0x1b7ecb){return function(_0x239e51){try{jsonpatch[_0x4073('0x22')](_0x239e51,_0x1b7ecb,!![]);}catch(_0x158da7){return BPromise[_0x4073('0x23')](_0x158da7);}return _0x239e51['save']();};}function saveUpdates(_0x376d53,_0x34cd14){return function(_0x16d706){if(_0x16d706){return _0x16d706[_0x4073('0x24')](_0x376d53)[_0x4073('0x25')](function(_0x3881b9){return _0x3881b9;});}return null;};}function handleEntityNotFound(_0x9aa4d8,_0x2f0a14){return function(_0x90cac5){if(!_0x90cac5){_0x9aa4d8[_0x4073('0x1a')](0x194);}return _0x90cac5;};}function handleError(_0x249798,_0x387d30){_0x387d30=_0x387d30||0x1f4;return function(_0x2c014a){logger[_0x4073('0x26')](_0x2c014a[_0x4073('0x27')]);if(_0x2c014a['name']){delete _0x2c014a[_0x4073('0x28')];}_0x249798[_0x4073('0x1b')](_0x387d30)[_0x4073('0x29')](_0x2c014a);};}exports[_0x4073('0x2a')]=function(_0x2c713d,_0x43b7da){var _0x3094d6={},_0x184ae8={},_0x14d036={'count':0x0,'rows':[]};var _0x3183b8=_['map'](db[_0x4073('0x2b')][_0x4073('0x2c')],function(_0x197da1){return{'name':_0x197da1[_0x4073('0x2d')],'type':_0x197da1['type'][_0x4073('0x2e')]};});_0x184ae8[_0x4073('0x2f')]=_[_0x4073('0x30')](_0x3183b8,'name');_0x184ae8[_0x4073('0x31')]=_[_0x4073('0x32')](_0x2c713d[_0x4073('0x31')]);_0x184ae8[_0x4073('0x33')]=_['intersection'](_0x184ae8[_0x4073('0x2f')],_0x184ae8[_0x4073('0x31')]);_0x3094d6['attributes']=_[_0x4073('0x34')](_0x184ae8['model'],qs[_0x4073('0x35')](_0x2c713d[_0x4073('0x31')]['fields']));_0x3094d6[_0x4073('0x36')]=_0x3094d6[_0x4073('0x36')][_0x4073('0x37')]?_0x3094d6[_0x4073('0x36')]:_0x184ae8[_0x4073('0x2f')];if(!_0x2c713d['query'][_0x4073('0x38')](_0x4073('0x39'))){_0x3094d6['limit']=qs['limit'](_0x2c713d[_0x4073('0x31')][_0x4073('0x1e')]);_0x3094d6['offset']=qs[_0x4073('0x1d')](_0x2c713d[_0x4073('0x31')][_0x4073('0x1d')]);}_0x3094d6['order']=qs[_0x4073('0x3a')](_0x2c713d[_0x4073('0x31')][_0x4073('0x3a')]);_0x3094d6[_0x4073('0x3b')]=qs[_0x4073('0x33')](_['pick'](_0x2c713d['query'],_0x184ae8[_0x4073('0x33')]),_0x3183b8);if(_0x2c713d[_0x4073('0x31')]['filter']){_0x3094d6[_0x4073('0x3b')]=_[_0x4073('0x3c')](_0x3094d6[_0x4073('0x3b')],{'$or':_[_0x4073('0x30')](_0x3183b8,function(_0x3ede39){if(_0x3ede39['type']!==_0x4073('0x3d')){var _0x1a40d4={};_0x1a40d4[_0x3ede39[_0x4073('0x28')]]={'$like':'%'+_0x2c713d[_0x4073('0x31')][_0x4073('0x3e')]+'%'};return _0x1a40d4;}})});}_0x3094d6=_[_0x4073('0x3c')]({},_0x3094d6,_0x2c713d[_0x4073('0x3f')]);var _0x24a099={'where':_0x3094d6[_0x4073('0x3b')]};return db[_0x4073('0x2b')][_0x4073('0x1f')](_0x24a099)['then'](function(_0x3332cf){_0x14d036['count']=_0x3332cf;if(_0x2c713d[_0x4073('0x31')]['includeAll']){_0x3094d6[_0x4073('0x40')]=[{'all':!![]}];}return db[_0x4073('0x2b')]['findAll'](_0x3094d6);})[_0x4073('0x25')](function(_0x45242){_0x14d036['rows']=_0x45242;return _0x14d036;})['then'](respondWithFilteredResult(_0x43b7da,_0x3094d6))[_0x4073('0x41')](handleError(_0x43b7da,null));};exports['show']=function(_0x3e6388,_0x4ce5b3){var _0xa368c9={'raw':![],'where':{'id':_0x3e6388['params']['id']}},_0x19443b={};_0x19443b['model']=_[_0x4073('0x32')](db[_0x4073('0x2b')][_0x4073('0x2c')]);_0x19443b[_0x4073('0x31')]=_[_0x4073('0x32')](_0x3e6388[_0x4073('0x31')]);_0x19443b['filters']=_[_0x4073('0x34')](_0x19443b[_0x4073('0x2f')],_0x19443b[_0x4073('0x31')]);_0xa368c9[_0x4073('0x36')]=_[_0x4073('0x34')](_0x19443b['model'],qs[_0x4073('0x35')](_0x3e6388[_0x4073('0x31')]['fields']));_0xa368c9[_0x4073('0x36')]=_0xa368c9[_0x4073('0x36')][_0x4073('0x37')]?_0xa368c9[_0x4073('0x36')]:_0x19443b['model'];if(_0x3e6388[_0x4073('0x31')][_0x4073('0x42')]){_0xa368c9[_0x4073('0x40')]=[{'all':!![]}];}_0xa368c9=_[_0x4073('0x3c')]({},_0xa368c9,_0x3e6388[_0x4073('0x3f')]);return db[_0x4073('0x2b')][_0x4073('0x43')](_0xa368c9)[_0x4073('0x25')](handleEntityNotFound(_0x4ce5b3,null))[_0x4073('0x25')](respondWithResult(_0x4ce5b3,null))[_0x4073('0x41')](handleError(_0x4ce5b3,null));};exports['create']=function(_0x182096,_0x5cec6a){return db['Team'][_0x4073('0x44')](_0x182096[_0x4073('0x45')],{})[_0x4073('0x25')](function(_0x30de77){var _0x2ff460=_0x182096[_0x4073('0x46')]['get']({'plain':!![]});if(!_0x2ff460)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ff460['role']===_0x4073('0x46')){var _0x220a26=_0x30de77['get']({'plain':!![]});var _0x23b146=_0x4073('0x47');return db[_0x4073('0x48')]['find']({'where':{'name':_0x23b146,'userProfileId':_0x2ff460[_0x4073('0x49')]},'raw':!![]})[_0x4073('0x25')](function(_0x184b5a){if(_0x184b5a&&_0x184b5a[_0x4073('0x4a')]===0x0){return db['UserProfileResource'][_0x4073('0x44')]({'name':_0x220a26[_0x4073('0x28')],'resourceId':_0x220a26['id'],'type':_0x184b5a[_0x4073('0x28')],'sectionId':_0x184b5a['id']},{})['then'](function(){return _0x30de77;});}else{return _0x30de77;}})[_0x4073('0x41')](function(_0x27dea3){logger[_0x4073('0x26')](_0x4073('0x4b'),_0x27dea3);throw _0x27dea3;});}return _0x30de77;})[_0x4073('0x25')](respondWithResult(_0x5cec6a,0xc9))[_0x4073('0x41')](handleError(_0x5cec6a,null));};exports[_0x4073('0x24')]=function(_0x7826fd,_0x14bcb5){if(_0x7826fd[_0x4073('0x45')]['id']){delete _0x7826fd[_0x4073('0x45')]['id'];}return db[_0x4073('0x2b')]['find']({'where':{'id':_0x7826fd[_0x4073('0x4c')]['id']}})['then'](handleEntityNotFound(_0x14bcb5,null))['then'](saveUpdates(_0x7826fd[_0x4073('0x45')],null))[_0x4073('0x25')](respondWithResult(_0x14bcb5,null))[_0x4073('0x41')](handleError(_0x14bcb5,null));};exports[_0x4073('0x4d')]=function(_0x2d56f1,_0x1cc95e){var _0x19221a=_0x2d56f1[_0x4073('0x4c')]['id'];var _0x39581d=[];return db[_0x4073('0x4e')]['transaction'](function(_0x314129){var _0x6e3afe=_0x4073('0x4f')+_0x19221a;return db[_0x4073('0x4e')][_0x4073('0x31')](_0x6e3afe,{'type':db[_0x4073('0x50')][_0x4073('0x51')][_0x4073('0x52')],'raw':!![],'transaction':_0x314129})['then'](function(_0x2f1d88){_0x39581d=_[_0x4073('0x30')](_0x2f1d88,function(_0x1ef94e){return Number(_0x1ef94e[_0x4073('0x53')]);});})['then'](function(){var _0x4063fd=_0x4073('0x54')+_0x19221a;return db[_0x4073('0x4e')][_0x4073('0x31')](_0x4063fd,{'type':db[_0x4073('0x50')][_0x4073('0x51')]['SELECT'],'raw':!![],'transaction':_0x314129});})['then'](function(_0x338a95){var _0x22ba79=_[_0x4073('0x30')](_0x338a95,function(_0x345b38){return Number(_0x345b38[_0x4073('0x55')]);});return db[_0x4073('0x56')][_0x4073('0x4d')]({'where':{'UserId':{'$in':_0x39581d},'VoiceQueueId':{'$in':_0x22ba79}},'transaction':_0x314129});})[_0x4073('0x25')](function(){var _0x30d8c8=_0x4073('0x57')+_0x19221a;return db[_0x4073('0x4e')][_0x4073('0x31')](_0x30d8c8,{'type':db[_0x4073('0x50')]['QueryTypes'][_0x4073('0x52')],'raw':!![],'transaction':_0x314129});})[_0x4073('0x25')](function(_0x2615fd){var _0x370f6a=_[_0x4073('0x30')](_0x2615fd,function(_0x570290){return Number(_0x570290['MailQueueId']);});return db[_0x4073('0x58')][_0x4073('0x4d')]({'where':{'UserId':{'$in':_0x39581d},'MailQueueId':{'$in':_0x370f6a}},'transaction':_0x314129});})[_0x4073('0x25')](function(){var _0x498af5='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x19221a;return db[_0x4073('0x4e')][_0x4073('0x31')](_0x498af5,{'type':db['Sequelize'][_0x4073('0x51')][_0x4073('0x52')],'raw':!![],'transaction':_0x314129});})[_0x4073('0x25')](function(_0x50e95a){var _0x439ccd=_[_0x4073('0x30')](_0x50e95a,function(_0x49666f){return Number(_0x49666f[_0x4073('0x59')]);});return db[_0x4073('0x5a')][_0x4073('0x4d')]({'where':{'UserId':{'$in':_0x39581d},'SmsQueueId':{'$in':_0x439ccd}},'transaction':_0x314129});})[_0x4073('0x25')](function(){var _0x1b1be2=_0x4073('0x5b')+_0x19221a;return db[_0x4073('0x4e')][_0x4073('0x31')](_0x1b1be2,{'type':db[_0x4073('0x50')][_0x4073('0x51')][_0x4073('0x52')],'raw':!![],'transaction':_0x314129});})[_0x4073('0x25')](function(_0x37d3ce){var _0xb714b2=_['map'](_0x37d3ce,function(_0x413a4c){return Number(_0x413a4c[_0x4073('0x5c')]);});return db[_0x4073('0x5d')][_0x4073('0x4d')]({'where':{'UserId':{'$in':_0x39581d},'ChatQueueId':{'$in':_0xb714b2}},'transaction':_0x314129});})[_0x4073('0x25')](function(){var _0x1c9ac0=_0x4073('0x5e')+_0x19221a;return db[_0x4073('0x4e')][_0x4073('0x31')](_0x1c9ac0,{'type':db['Sequelize'][_0x4073('0x51')][_0x4073('0x52')],'raw':!![],'transaction':_0x314129});})[_0x4073('0x25')](function(_0x235918){var _0x11683a=_[_0x4073('0x30')](_0x235918,function(_0x50b5e9){return Number(_0x50b5e9[_0x4073('0x5f')]);});return db[_0x4073('0x60')][_0x4073('0x4d')]({'where':{'UserId':{'$in':_0x39581d},'FaxQueueId':{'$in':_0x11683a}},'transaction':_0x314129});})['then'](function(){var _0x344879=_0x4073('0x61')+_0x19221a;return db['sequelize'][_0x4073('0x31')](_0x344879,{'type':db['Sequelize']['QueryTypes'][_0x4073('0x52')],'raw':!![],'transaction':_0x314129});})[_0x4073('0x25')](function(_0x34f172){var _0x3b62ff=_[_0x4073('0x30')](_0x34f172,function(_0x2dca89){return Number(_0x2dca89[_0x4073('0x62')]);});return db[_0x4073('0x63')]['destroy']({'where':{'UserId':{'$in':_0x39581d},'OpenchannelQueueId':{'$in':_0x3b62ff}},'transaction':_0x314129});})[_0x4073('0x25')](function(){var _0x103a5c=_0x4073('0x64')+_0x19221a;return db[_0x4073('0x4e')]['query'](_0x103a5c,{'type':db[_0x4073('0x50')][_0x4073('0x51')][_0x4073('0x52')],'raw':!![],'transaction':_0x314129});})['then'](function(_0x4fef4b){var _0x1d278c=_[_0x4073('0x30')](_0x4fef4b,function(_0x4c8769){return Number(_0x4c8769[_0x4073('0x65')]);});return db[_0x4073('0x66')][_0x4073('0x4d')]({'where':{'UserId':{'$in':_0x39581d},'WhatsappQueueId':{'$in':_0x1d278c}},'transaction':_0x314129});})[_0x4073('0x25')](function(){return db['TeamVoicePrefix'][_0x4073('0x43')]({'where':{'TeamId':_0x19221a}});})[_0x4073('0x25')](function(_0x18c095){if(_0x18c095===null){return;}return db[_0x4073('0x67')]['destroy']({'where':{'UserId':{'$in':_0x39581d},'VoicePrefixId':_0x18c095[_0x4073('0x68')]},'transaction':_0x314129});})[_0x4073('0x25')](function(){return db[_0x4073('0x2b')]['destroy']({'where':{'id':_0x19221a},'cascade':!![],'transaction':_0x314129});})[_0x4073('0x25')](function(_0x12b8a8){if(_0x12b8a8===0x0){_0x1cc95e[_0x4073('0x1a')](0x194);}else{return db[_0x4073('0x69')][_0x4073('0x4d')]({'where':{'type':_0x4073('0x47'),'resourceId':_0x19221a},'cascade':!![],'transaction':_0x314129})[_0x4073('0x25')](function(){_0x1cc95e[_0x4073('0x1b')](0xcc)['end']();});}})[_0x4073('0x41')](function(_0x355f0a){_0x1cc95e[_0x4073('0x1b')](0x1f4)[_0x4073('0x29')](_0x355f0a);});});};exports[_0x4073('0x6a')]=function(_0x579227,_0x5892e4,_0x1628d0){return db['Team'][_0x4073('0x6b')]({'where':{'id':_0x579227[_0x4073('0x4c')]['id']}})[_0x4073('0x25')](handleEntityNotFound(_0x5892e4,null))['then'](function(_0x3dce67){if(!_0x579227[_0x4073('0x31')][_0x4073('0x6c')]||!utils[_0x4073('0x6d')](_0x579227['query'][_0x4073('0x6c')])){throw new db[(_0x4073('0x50'))][(_0x4073('0x6e'))](_0x4073('0x6f'));}var _0x4249b1={};var _0x4dbfae={};_0x4dbfae['model']=_[_0x4073('0x32')](db[_[_0x4073('0x70')](_0x579227['query'][_0x4073('0x6c')][_0x4073('0x71')]())+_0x4073('0x72')]['rawAttributes']);_0x4dbfae['query']=_[_0x4073('0x32')](_0x579227[_0x4073('0x31')]);_0x4dbfae[_0x4073('0x33')]=_[_0x4073('0x34')](_0x4dbfae[_0x4073('0x2f')],_0x4dbfae['query']);_0x4249b1[_0x4073('0x36')]=_[_0x4073('0x34')](_0x4dbfae[_0x4073('0x2f')],qs[_0x4073('0x35')](_0x579227['query'][_0x4073('0x35')]));_0x4249b1[_0x4073('0x36')]=_0x4249b1[_0x4073('0x36')][_0x4073('0x37')]?_0x4249b1[_0x4073('0x36')]:_0x4dbfae['model'];_0x4249b1['limit']=qs[_0x4073('0x1e')](_0x579227[_0x4073('0x31')][_0x4073('0x1e')]);_0x4249b1[_0x4073('0x1d')]=qs['offset'](_0x579227[_0x4073('0x31')][_0x4073('0x1d')]);_0x4249b1[_0x4073('0x73')]=qs[_0x4073('0x3a')](_0x579227['query']['sort']);_0x4249b1['where']=qs[_0x4073('0x33')](_['pick'](_0x579227[_0x4073('0x31')],_0x4dbfae['filters']));_0x4249b1=_[_0x4073('0x3c')]({},_0x4249b1,_0x579227['options']);return _0x3dce67[_0x4073('0x74')+_[_0x4073('0x70')](_0x579227['query'][_0x4073('0x6c')][_0x4073('0x71')]())+_0x4073('0x75')](_0x4249b1);})[_0x4073('0x25')](respondWithResult(_0x5892e4,null))[_0x4073('0x41')](handleError(_0x5892e4,null));};exports['addQueues']=function(_0x3aaa55,_0x4cb41f,_0x3aad2c){return db['Team']['findOne']({'where':{'id':_0x3aaa55[_0x4073('0x4c')]['id']}})[_0x4073('0x25')](function(_0x3e4e72){if(_0x3e4e72){if(!_0x3aaa55[_0x4073('0x45')][_0x4073('0x6c')]||!utils['isValidChannel'](_0x3aaa55['body']['channel'])){throw new db[(_0x4073('0x50'))][(_0x4073('0x6e'))](_0x4073('0x6f'));}return _0x3e4e72[_0x4073('0x76')+_[_0x4073('0x70')](_0x3aaa55[_0x4073('0x45')][_0x4073('0x6c')][_0x4073('0x71')]())+_0x4073('0x75')](_0x3aaa55['body'][_0x4073('0x77')]);}return null;})[_0x4073('0x25')](handleEntityNotFound(_0x4cb41f,null))['then'](respondWithStatusCode(_0x4cb41f,null))[_0x4073('0x41')](handleError(_0x4cb41f,null));};exports[_0x4073('0x78')]=function(_0x57aa55,_0x5e3628,_0x146f51){return db[_0x4073('0x2b')]['findOne']({'where':{'id':_0x57aa55['params']['id']}})[_0x4073('0x25')](function(_0x422296){if(_0x422296){if(!_0x57aa55['query']['channel']||!utils['isValidChannel'](_0x57aa55[_0x4073('0x31')][_0x4073('0x6c')])){throw new db[(_0x4073('0x50'))]['ValidationError'](_0x4073('0x6f'));}return _0x422296[_0x4073('0x79')+_[_0x4073('0x70')](_0x57aa55[_0x4073('0x31')][_0x4073('0x6c')][_0x4073('0x71')]())+'Queues'](_0x57aa55[_0x4073('0x31')][_0x4073('0x77')]);}return null;})[_0x4073('0x25')](handleEntityNotFound(_0x5e3628,null))[_0x4073('0x25')](respondWithStatusCode(_0x5e3628,null))[_0x4073('0x41')](handleError(_0x5e3628,null));};exports[_0x4073('0x7a')]=function(_0x4eb1ce,_0x46f7cc){var _0x2dc055=_[_0x4073('0x7b')](_0x4eb1ce[_0x4073('0x45')][_0x4073('0x77')])?_0x4eb1ce[_0x4073('0x45')][_0x4073('0x77')]:[_0x4eb1ce['body'][_0x4073('0x77')]];var _0x73412=_0x4eb1ce[_0x4073('0x4c')]['id'];return db[_0x4073('0x2b')]['find']({'where':{'id':_0x73412}})['then'](handleEntityNotFound(_0x46f7cc,null))[_0x4073('0x25')](function(_0x2bd6da){if(_0x2bd6da){var _0x171f04=[_0x4073('0x7c'),_0x4073('0x7d'),_0x4073('0x7e'),'Sms',_0x4073('0x7f'),_0x4073('0x80'),'Whatsapp'];return db[_0x4073('0x4e')][_0x4073('0x81')](function(_0x13e0f4){var _0x547f2b=_[_0x4073('0x30')](_0x171f04,function(_0x45004c){var _0x3ceb67={'attributes':['id',_0x4073('0x28')]};if(_0x45004c===_0x4073('0x7c')){_0x3ceb67[_0x4073('0x82')]={'attributes':[_0x4073('0x83')]};}return _0x2bd6da[_0x4073('0x74')+_0x45004c+_0x4073('0x75')](_0x3ceb67)['then'](function(_0x4a1167){var _0x202281=_[_0x4073('0x30')](_0x4a1167,function(_0x298a0e){var _0x25022b=_[_0x4073('0x30')](_0x2dc055,function(_0x53657d){var _0x4f09f3={'where':{'UserId':_0x53657d,[_0x45004c+'QueueId']:_0x298a0e['id']},'transaction':_0x13e0f4};if(_0x45004c===_0x4073('0x7c')){_0x4f09f3[_0x4073('0x15')]={'penalty':_0x298a0e[_0x4073('0x84')]['penalty']};}return db['User'+_0x45004c+_0x4073('0x72')][_0x4073('0x85')](_0x4f09f3)['then'](function(){socket['emit']('user'+_0x45004c+_0x4073('0x86'),{'UserId':_0x53657d,[_0x45004c+'QueueId']:_0x298a0e['id']});if(_0x45004c!==_0x4073('0x7c')){return;}return db['User'][_0x4073('0x87')]({'where':{'id':_0x2dc055,'online':0x1},'attributes':['id','name','online',_0x4073('0x88'),_0x4073('0x89')],'raw':!![]})[_0x4073('0x25')](function(_0x518521){var _0x20e216=_['map'](_0x518521,function(_0x51e7df){return db[_0x4073('0x8a')][_0x4073('0x8b')]({'membername':_0x51e7df[_0x4073('0x28')],'UserId':_0x51e7df['id'],'queue_name':_0x298a0e[_0x4073('0x28')],'VoiceQueueId':_0x298a0e['id'],'interface':_[_0x4073('0x8c')](_0x51e7df['interface'])?util['format'](_0x4073('0x8d'),_0x51e7df['name']):_0x51e7df[_0x4073('0x89')],'paused':_0x51e7df[_0x4073('0x88')]||![],'penalty':_0x298a0e[_0x4073('0x84')][_0x4073('0x83')]},{'transaction':_0x13e0f4});});return Promise[_0x4073('0x8e')](_0x20e216);});});});return Promise[_0x4073('0x8e')](_0x25022b);});return Promise['all'](_0x202281);})[_0x4073('0x25')](function(){return db[_0x4073('0x8f')][_0x4073('0x6b')]({'where':{'teamId':_0x73412}})['then'](function(_0x2824bd){if(_0x2824bd){var _0x3f66b6=_[_0x4073('0x30')](_0x2dc055,function(_0x58b767){db[_0x4073('0x67')]['upsert']({'UserId':_0x58b767,'VoicePrefixId':_0x2824bd[_0x4073('0x68')]});});return Promise[_0x4073('0x8e')](_0x3f66b6);}});});});return Promise[_0x4073('0x8e')](_0x547f2b)[_0x4073('0x25')](function(){return _0x2bd6da[_0x4073('0x7a')](_0x2dc055,{'transaction':_0x13e0f4})[_0x4073('0x90')](function(_0x3281e4){return _0x3281e4;});});});}})[_0x4073('0x25')](respondWithResult(_0x46f7cc,null))[_0x4073('0x41')](handleError(_0x46f7cc,null));};exports['removeAgents']=function(_0x37d85a,_0x5db9f0){var _0xc577ae=_[_0x4073('0x7b')](_0x37d85a['query'][_0x4073('0x77')])?_0x37d85a['query'][_0x4073('0x77')]:[_0x37d85a[_0x4073('0x31')][_0x4073('0x77')]];var _0x1b805e=_0x37d85a[_0x4073('0x4c')]['id'];return db[_0x4073('0x2b')][_0x4073('0x43')]({'where':{'id':_0x1b805e}})[_0x4073('0x25')](handleEntityNotFound(_0x5db9f0,null))[_0x4073('0x25')](function(_0x5284ee){if(_0x5284ee){var _0x3e0edd=[_0x4073('0x7c'),_0x4073('0x7d'),_0x4073('0x7e'),_0x4073('0x91'),_0x4073('0x7f'),_0x4073('0x80'),_0x4073('0x92')];return db[_0x4073('0x4e')]['transaction'](function(_0x43d2f9){var _0x32bc32=_[_0x4073('0x30')](_0x3e0edd,function(_0x5e9d02){var _0x2f96c6={'attributes':['id','name']};return _0x5284ee['get'+_0x5e9d02+_0x4073('0x75')](_0x2f96c6)[_0x4073('0x25')](function(_0x290281){var _0x5784be=_[_0x4073('0x30')](_0x290281,function(_0x421f8d){return _0x421f8d[_0x4073('0x93')](_0xc577ae,{'transaction':_0x43d2f9})[_0x4073('0x25')](function(){var _0x25d718=_[_0x4073('0x30')](_0xc577ae,function(_0x4e3a62){socket['emit'](_0x4073('0x46')+_0x5e9d02+'Queue:remove',{'UserId':Number(_0x4e3a62),[_0x5e9d02+_0x4073('0x94')]:_0x421f8d['id']});if(_0x5e9d02!==_0x4073('0x7c')){return;}return db[_0x4073('0x8a')]['destroy']({'where':{'VoiceQueueId':_0x421f8d['id'],'UserId':_0x4e3a62},'transaction':_0x43d2f9});});return Promise[_0x4073('0x8e')](_0x25d718);});});return Promise['all'](_0x5784be);});});return Promise['all'](_0x32bc32)[_0x4073('0x25')](function(){return _0x5284ee[_0x4073('0x93')](_0xc577ae,{'transaction':_0x43d2f9});})[_0x4073('0x25')](function(){return db[_0x4073('0x8f')][_0x4073('0x6b')]({'where':{'teamId':_0x1b805e}})[_0x4073('0x25')](function(_0x2f27d4){if(_0x2f27d4){var _0x2cbea1=_[_0x4073('0x30')](_0xc577ae,function(_0x52abe4){db[_0x4073('0x67')][_0x4073('0x4d')]({'where':{'UserId':_0x52abe4,'VoicePrefixId':_0x2f27d4[_0x4073('0x68')]}});});return Promise[_0x4073('0x8e')](_0x2cbea1);}});});});}})[_0x4073('0x25')](respondWithStatusCode(_0x5db9f0,null))[_0x4073('0x41')](handleError(_0x5db9f0,null));};exports[_0x4073('0x95')]=function(_0x48d584,_0x1c58eb,_0x461115){var _0x37699a={};var _0x28a54e={};var _0xe1c793;var _0x3b6bdd;return db['Team'][_0x4073('0x6b')]({'where':{'id':_0x48d584[_0x4073('0x4c')]['id']}})[_0x4073('0x25')](handleEntityNotFound(_0x1c58eb,null))[_0x4073('0x25')](function(_0x4690d6){if(_0x4690d6){_0xe1c793=_0x4690d6;_0x28a54e[_0x4073('0x2f')]=_['keys'](db[_0x4073('0x96')]['rawAttributes']);_0x28a54e[_0x4073('0x31')]=_[_0x4073('0x32')](_0x48d584['query']);_0x28a54e[_0x4073('0x33')]=_['intersection'](_0x28a54e['model'],_0x28a54e[_0x4073('0x31')]);_0x37699a[_0x4073('0x36')]=_[_0x4073('0x34')](_0x28a54e[_0x4073('0x2f')],qs[_0x4073('0x35')](_0x48d584[_0x4073('0x31')]['fields']));_0x37699a[_0x4073('0x36')]=_0x37699a['attributes'][_0x4073('0x37')]?_0x37699a['attributes']:_0x28a54e[_0x4073('0x2f')];_0x37699a['order']=qs[_0x4073('0x3a')](_0x48d584[_0x4073('0x31')]['sort']);_0x37699a[_0x4073('0x3b')]=qs['filters'](_[_0x4073('0x97')](_0x48d584['query'],_0x28a54e[_0x4073('0x33')]));if(_0x48d584[_0x4073('0x31')][_0x4073('0x3e')]){_0x37699a[_0x4073('0x3b')]=_[_0x4073('0x3c')](_0x37699a[_0x4073('0x3b')],{'$or':_[_0x4073('0x30')](_0x37699a['attributes'],function(_0x474b33){var _0x6bf211={};_0x6bf211[_0x474b33]={'$like':'%'+_0x48d584[_0x4073('0x31')][_0x4073('0x3e')]+'%'};return _0x6bf211;})});}_0x37699a=_[_0x4073('0x3c')]({},_0x37699a,_0x48d584['options']);return _0xe1c793[_0x4073('0x95')](_0x37699a);}})[_0x4073('0x25')](function(_0x4578c7){if(_0x4578c7){_0x3b6bdd=_0x4578c7[_0x4073('0x37')];if(!_0x48d584['query'][_0x4073('0x38')](_0x4073('0x39'))){_0x37699a['limit']=qs['limit'](_0x48d584[_0x4073('0x31')][_0x4073('0x1e')]);_0x37699a[_0x4073('0x1d')]=qs[_0x4073('0x1d')](_0x48d584[_0x4073('0x31')][_0x4073('0x1d')]);}return _0xe1c793[_0x4073('0x95')](_0x37699a);}})['then'](function(_0x52f098){if(_0x52f098){return _0x52f098?{'count':_0x3b6bdd,'rows':_0x52f098}:null;}})[_0x4073('0x25')](respondWithResult(_0x1c58eb,null))[_0x4073('0x41')](handleError(_0x1c58eb,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index e9b71cb..859355b 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 _0xcb0e=['remove','emit','hook','exports','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xcb0e,0x151));var _0xecb0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcb0e[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var Team=require(_0xecb0('0x0'))['db'][_0xecb0('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xecb0('0x2')](0x0);var events={'afterCreate':_0xecb0('0x3'),'afterUpdate':_0xecb0('0x4'),'afterDestroy':_0xecb0('0x5')};function emitEvent(_0x142fd4){return function(_0x20f3d7,_0x1bab66,_0x3827a2){TeamEvents[_0xecb0('0x6')](_0x142fd4+':'+_0x20f3d7['id'],_0x20f3d7);TeamEvents['emit'](_0x142fd4,_0x20f3d7);_0x3827a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xecb0('0x7')](e,emitEvent(event));}}module[_0xecb0('0x8')]=TeamEvents; \ No newline at end of file +var _0xe75a=['exports','events','../../mysqldb','Team','save','remove','emit','hasOwnProperty','hook'];(function(_0x528562,_0xb94d4a){var _0x5029e5=function(_0x231f99){while(--_0x231f99){_0x528562['push'](_0x528562['shift']());}};_0x5029e5(++_0xb94d4a);}(_0xe75a,0x13c));var _0xae75=function(_0x11f226,_0x491e30){_0x11f226=_0x11f226-0x0;var _0x30be77=_0xe75a[_0x11f226];return _0x30be77;};'use strict';var EventEmitter=require(_0xae75('0x0'));var Team=require(_0xae75('0x1'))['db'][_0xae75('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xae75('0x3'),'afterUpdate':'update','afterDestroy':_0xae75('0x4')};function emitEvent(_0x451954){return function(_0x5269d8,_0x440b31,_0x3ba25d){TeamEvents[_0xae75('0x5')](_0x451954+':'+_0x5269d8['id'],_0x5269d8);TeamEvents[_0xae75('0x5')](_0x451954,_0x5269d8);_0x3ba25d(null);};}for(var e in events){if(events[_0xae75('0x6')](e)){var event=events[e];Team[_0xae75('0x7')](e,emitEvent(event));}}module[_0xae75('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index bd89273..c1b9ea8 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 _0x706e=['Queues','then','channel','exports','define','Team','teams','Fax','Sms','Whatsapp','resolve','map','all','lodash','./team.attributes'];(function(_0x5201a0,_0x388ee9){var _0x3926e2=function(_0x4a4634){while(--_0x4a4634){_0x5201a0['push'](_0x5201a0['shift']());}};_0x3926e2(++_0x388ee9);}(_0x706e,0xdf));var _0xe706=function(_0x2b6008,_0x40950d){_0x2b6008=_0x2b6008-0x0;var _0x3e19f4=_0x706e[_0x2b6008];return _0x3e19f4;};'use strict';var _=require(_0xe706('0x0'));var attributes=require(_0xe706('0x1'));function getQueuesByChannel(_0x2513ea,_0x1ad308){var _0x2eb3ac='get'+_0x1ad308+_0xe706('0x2');return _0x2513ea[_0x2eb3ac]()[_0xe706('0x3')](function(_0x4d2237){return _['map'](_0x4d2237,function(_0x57cf05){_0x57cf05['setDataValue'](_0xe706('0x4'),_0x1ad308);return _0x57cf05;});})['catch'](function(_0x4a43b0){throw _0x4a43b0;});}module[_0xe706('0x5')]=function(_0x585947){return _0x585947[_0xe706('0x6')](_0xe706('0x7'),attributes,{'tableName':_0xe706('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3fc4ce=this;var _0x502015=['Chat',_0xe706('0x9'),'Mail','Openchannel',_0xe706('0xa'),'Voice',_0xe706('0xb')];return Promise[_0xe706('0xc')]()['then'](function(){var _0x4223c2=_[_0xe706('0xd')](_0x502015,function(_0xd9ef1b){return getQueuesByChannel(_0x3fc4ce,_0xd9ef1b);});return Promise[_0xe706('0xe')](_0x4223c2);})['catch'](function(_0x58fef4){throw _0x58fef4;});}}});}; \ No newline at end of file +var _0xbb71=['resolve','map','lodash','./team.attributes','get','then','setDataValue','channel','catch','exports','define','Team','Chat','Fax','Openchannel','Sms','Voice','Whatsapp'];(function(_0x404e42,_0xdbcc){var _0x3ec4e0=function(_0x2918f5){while(--_0x2918f5){_0x404e42['push'](_0x404e42['shift']());}};_0x3ec4e0(++_0xdbcc);}(_0xbb71,0xda));var _0x1bb7=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xbb71[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0x1bb7('0x0'));var attributes=require(_0x1bb7('0x1'));function getQueuesByChannel(_0x1256e9,_0x56a986){var _0x2652ea=_0x1bb7('0x2')+_0x56a986+'Queues';return _0x1256e9[_0x2652ea]()[_0x1bb7('0x3')](function(_0x37a678){return _['map'](_0x37a678,function(_0x490f40){_0x490f40[_0x1bb7('0x4')](_0x1bb7('0x5'),_0x56a986);return _0x490f40;});})[_0x1bb7('0x6')](function(_0x262fce){throw _0x262fce;});}module[_0x1bb7('0x7')]=function(_0xe23e02){return _0xe23e02[_0x1bb7('0x8')](_0x1bb7('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1fe190=this;var _0x4ced18=[_0x1bb7('0xa'),_0x1bb7('0xb'),'Mail',_0x1bb7('0xc'),_0x1bb7('0xd'),_0x1bb7('0xe'),_0x1bb7('0xf')];return Promise[_0x1bb7('0x10')]()[_0x1bb7('0x3')](function(){var _0x764beb=_[_0x1bb7('0x11')](_0x4ced18,function(_0x410db8){return getQueuesByChannel(_0x1fe190,_0x410db8);});return Promise['all'](_0x764beb);})[_0x1bb7('0x6')](function(_0x741f3d){throw _0x741f3d;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 6a5b793..fca1192 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 _0xc75f=['error','message','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x530c42,_0x261342){var _0x4009e6=function(_0x5db539){while(--_0x5db539){_0x530c42['push'](_0x530c42['shift']());}};_0x4009e6(++_0x261342);}(_0xc75f,0xc2));var _0xfc75=function(_0xb5abf7,_0x76e61f){_0xb5abf7=_0xb5abf7-0x0;var _0x1ef30c=_0xc75f[_0xb5abf7];return _0x1ef30c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfc75('0x0'));var BPromise=require('bluebird');var rs=require(_0xfc75('0x1'));var fs=require('fs');var Redis=require(_0xfc75('0x2'));var db=require(_0xfc75('0x3'))['db'];var utils=require(_0xfc75('0x4'));var logger=require(_0xfc75('0x5'))(_0xfc75('0x6'));var config=require(_0xfc75('0x7'));var jayson=require(_0xfc75('0x8'));var client=jayson['client'][_0xfc75('0x9')]({'port':0x232a});config['redis']=_[_0xfc75('0xa')](config[_0xfc75('0xb')],{'host':_0xfc75('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfc75('0xd'))[_0xfc75('0xe')](socket);function respondWithRpcPromise(_0x277dfe,_0x24c6bd,_0x4dba23){return new BPromise(function(_0x338b68,_0x301540){return client[_0xfc75('0xf')](_0x277dfe,_0x4dba23)[_0xfc75('0x10')](function(_0x534fd3){logger[_0xfc75('0x11')](_0xfc75('0x12'),_0x24c6bd,'request\x20sent');logger[_0xfc75('0x13')](_0xfc75('0x14'),_0x24c6bd,_0xfc75('0x15'),JSON['stringify'](_0x534fd3));if(_0x534fd3[_0xfc75('0x16')]){if(_0x534fd3['error']['code']===0x1f4){logger['error'](_0xfc75('0x12'),_0x24c6bd,_0x534fd3[_0xfc75('0x16')]['message']);return _0x301540(_0x534fd3[_0xfc75('0x16')][_0xfc75('0x17')]);}logger[_0xfc75('0x16')](_0xfc75('0x12'),_0x24c6bd,_0x534fd3[_0xfc75('0x16')]['message']);return _0x338b68(_0x534fd3['error'][_0xfc75('0x17')]);}else{logger[_0xfc75('0x11')](_0xfc75('0x12'),_0x24c6bd,'request\x20sent');_0x338b68(_0x534fd3['result'][_0xfc75('0x17')]);}})['catch'](function(_0xd91b79){logger[_0xfc75('0x16')](_0xfc75('0x12'),_0x24c6bd,_0xd91b79);_0x301540(_0xd91b79);});});} \ No newline at end of file +var _0x0ccd=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./team.socket','then','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x6ae570,_0x20bc83){var _0x2983df=function(_0x7c331e){while(--_0x7c331e){_0x6ae570['push'](_0x6ae570['shift']());}};_0x2983df(++_0x20bc83);}(_0x0ccd,0xfa));var _0xd0cc=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0x0ccd[_0x3d4ef1];return _0x409423;};'use strict';var _=require(_0xd0cc('0x0'));var util=require(_0xd0cc('0x1'));var moment=require(_0xd0cc('0x2'));var BPromise=require(_0xd0cc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0cc('0x4'))['db'];var utils=require(_0xd0cc('0x5'));var logger=require('../../config/logger')(_0xd0cc('0x6'));var config=require(_0xd0cc('0x7'));var jayson=require(_0xd0cc('0x8'));var client=jayson[_0xd0cc('0x9')]['http']({'port':0x232a});config[_0xd0cc('0xa')]=_[_0xd0cc('0xb')](config[_0xd0cc('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd0cc('0xc'))(new Redis(config[_0xd0cc('0xa')]));require(_0xd0cc('0xd'))['register'](socket);function respondWithRpcPromise(_0x284f2e,_0x330778,_0x5b01b6){return new BPromise(function(_0x40a3a5,_0x3f6c34){return client['request'](_0x284f2e,_0x5b01b6)[_0xd0cc('0xe')](function(_0x12df10){logger['info'](_0xd0cc('0xf'),_0x330778,'request\x20sent');logger[_0xd0cc('0x10')](_0xd0cc('0x11'),_0x330778,_0xd0cc('0x12'),JSON[_0xd0cc('0x13')](_0x12df10));if(_0x12df10[_0xd0cc('0x14')]){if(_0x12df10['error'][_0xd0cc('0x15')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x330778,_0x12df10[_0xd0cc('0x14')][_0xd0cc('0x16')]);return _0x3f6c34(_0x12df10[_0xd0cc('0x14')]['message']);}logger[_0xd0cc('0x14')]('Team,\x20%s,\x20%s',_0x330778,_0x12df10[_0xd0cc('0x14')]['message']);return _0x40a3a5(_0x12df10[_0xd0cc('0x14')][_0xd0cc('0x16')]);}else{logger[_0xd0cc('0x17')](_0xd0cc('0xf'),_0x330778,_0xd0cc('0x12'));_0x40a3a5(_0x12df10[_0xd0cc('0x18')][_0xd0cc('0x16')]);}})['catch'](function(_0x1eb55e){logger[_0xd0cc('0x14')](_0xd0cc('0xf'),_0x330778,_0x1eb55e);_0x3f6c34(_0x1eb55e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 62fedbf..bd3218b 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 _0x7c80=['save','removeListener','length','team:','./team.events'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7c80,0xa4));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0x07c8('0x0'));var events=[_0x07c8('0x1'),'remove','update'];function createListener(_0x25073e,_0x17fa86){return function(_0xae0c43){_0x17fa86['emit'](_0x25073e,_0xae0c43);};}function removeListener(_0x19356e,_0x750fb2){return function(){TeamEvents[_0x07c8('0x2')](_0x19356e,_0x750fb2);};}exports['register']=function(_0xfe1ead){for(var _0x56b8ca=0x0,_0x4a5354=events[_0x07c8('0x3')];_0x56b8ca<_0x4a5354;_0x56b8ca++){var _0xc0c7bf=events[_0x56b8ca];var _0x32d564=createListener(_0x07c8('0x4')+_0xc0c7bf,_0xfe1ead);TeamEvents['on'](_0xc0c7bf,_0x32d564);}}; \ No newline at end of file +var _0x76ef=['remove','update','emit','removeListener','length','team:','./team.events','save'];(function(_0x2f3e5f,_0x2fe7b9){var _0x5be5d6=function(_0x15d6ec){while(--_0x15d6ec){_0x2f3e5f['push'](_0x2f3e5f['shift']());}};_0x5be5d6(++_0x2fe7b9);}(_0x76ef,0xb6));var _0xf76e=function(_0x3fb734,_0x296772){_0x3fb734=_0x3fb734-0x0;var _0x534958=_0x76ef[_0x3fb734];return _0x534958;};'use strict';var TeamEvents=require(_0xf76e('0x0'));var events=[_0xf76e('0x1'),_0xf76e('0x2'),_0xf76e('0x3')];function createListener(_0x1260ea,_0x2bdf1){return function(_0x290545){_0x2bdf1[_0xf76e('0x4')](_0x1260ea,_0x290545);};}function removeListener(_0x44a888,_0xfa2b0b){return function(){TeamEvents[_0xf76e('0x5')](_0x44a888,_0xfa2b0b);};}exports['register']=function(_0x2a8095){for(var _0x502094=0x0,_0x4b0ffe=events[_0xf76e('0x6')];_0x502094<_0x4b0ffe;_0x502094++){var _0x4489b9=events[_0x502094];var _0x33f13b=createListener(_0xf76e('0x7')+_0x4489b9,_0x2a8095);TeamEvents['on'](_0x4489b9,_0x33f13b);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 4e82337..9fad40b 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 _0x51c4=['exports','INTEGER'];(function(_0x1f73c6,_0x15a636){var _0xce442d=function(_0x5f34b1){while(--_0x5f34b1){_0x1f73c6['push'](_0x1f73c6['shift']());}};_0xce442d(++_0x15a636);}(_0x51c4,0x192));var _0x451c=function(_0x5584dc,_0x409d2f){_0x5584dc=_0x5584dc-0x0;var _0x126ec4=_0x51c4[_0x5584dc];return _0x126ec4;};'use strict';var Sequelize=require('sequelize');module[_0x451c('0x0')]={'TeamId':{'type':Sequelize[_0x451c('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x451c('0x1')]}}; \ No newline at end of file +var _0x5374=['exports','INTEGER'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0x5374,0xd6));var _0x4537=function(_0x1c016c,_0x346f54){_0x1c016c=_0x1c016c-0x0;var _0x5ed216=_0x5374[_0x1c016c];return _0x5ed216;};'use strict';var Sequelize=require('sequelize');module[_0x4537('0x0')]={'TeamId':{'type':Sequelize[_0x4537('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index cae55db..300ec22 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 _0xdbfc=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0xdbfc,0x11d));var _0xcdbf=function(_0x4cdc81,_0x29fe4b){_0x4cdc81=_0x4cdc81-0x0;var _0x274af3=_0xdbfc[_0x4cdc81];return _0x274af3;};'use strict';var _=require(_0xcdbf('0x0'));var util=require(_0xcdbf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcdbf('0x2'));var BPromise=require(_0xcdbf('0x3'));var rp=require(_0xcdbf('0x4'));var fs=require('fs');var path=require(_0xcdbf('0x5'));var rimraf=require(_0xcdbf('0x6'));var config=require(_0xcdbf('0x7'));var attributes=require(_0xcdbf('0x8'));module['exports']=function(_0x3ffa10,_0x4129cf){return _0x3ffa10['define'](_0xcdbf('0x9'),attributes,{'tableName':_0xcdbf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x081e=['bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','lodash','util','api'];(function(_0xcba145,_0xcd2673){var _0x38e216=function(_0x48c346){while(--_0x48c346){_0xcba145['push'](_0xcba145['shift']());}};_0x38e216(++_0xcd2673);}(_0x081e,0xc5));var _0xe081=function(_0x395718,_0x20322d){_0x395718=_0x395718-0x0;var _0x3028b8=_0x081e[_0x395718];return _0x3028b8;};'use strict';var _=require(_0xe081('0x0'));var util=require(_0xe081('0x1'));var logger=require('../../config/logger')(_0xe081('0x2'));var moment=require('moment');var BPromise=require(_0xe081('0x3'));var rp=require(_0xe081('0x4'));var fs=require('fs');var path=require(_0xe081('0x5'));var rimraf=require(_0xe081('0x6'));var config=require(_0xe081('0x7'));var attributes=require(_0xe081('0x8'));module[_0xe081('0x9')]=function(_0x50d6cb,_0x2271b4){return _0x50d6cb['define']('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 76653b3..0c465bb 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4b719b,_0x440b42){var _0x90fbee=function(_0xccfd7e){while(--_0xccfd7e){_0x4b719b['push'](_0x4b719b['shift']());}};_0x90fbee(++_0x440b42);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xe59cff,_0x1a7dbe){var _0x26e8c1=function(_0x6a95cc){while(--_0x6a95cc){_0xe59cff['push'](_0xe59cff['shift']());}};_0x26e8c1(++_0x1a7dbe);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'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 39cbf69..c3bc136 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 _0x681b=['sequelize'];(function(_0x51a255,_0x35b735){var _0x11896b=function(_0x29cbc5){while(--_0x29cbc5){_0x51a255['push'](_0x51a255['shift']());}};_0x11896b(++_0x35b735);}(_0x681b,0x143));var _0xb681=function(_0x43fdb1,_0x123a0c){_0x43fdb1=_0x43fdb1-0x0;var _0x3315e7=_0x681b[_0x43fdb1];return _0x3315e7;};'use strict';var Sequelize=require(_0xb681('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0a25=['sequelize','INTEGER'];(function(_0x4c0abe,_0x4647a2){var _0x5dbe93=function(_0x3436c4){while(--_0x3436c4){_0x4c0abe['push'](_0x4c0abe['shift']());}};_0x5dbe93(++_0x4647a2);}(_0x0a25,0x1bc));var _0x50a2=function(_0x56d1ed,_0x237e84){_0x56d1ed=_0x56d1ed-0x0;var _0x1b282b=_0x0a25[_0x56d1ed];return _0x1b282b;};'use strict';var Sequelize=require(_0x50a2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x50a2('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 562698d..7018f76 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 _0x222f=['define','team_has_voice_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x8e624d,_0x2da1f6){var _0x12bd8d=function(_0x48cf6b){while(--_0x48cf6b){_0x8e624d['push'](_0x8e624d['shift']());}};_0x12bd8d(++_0x2da1f6);}(_0x222f,0x1a4));var _0xf222=function(_0x17a750,_0x8b9552){_0x17a750=_0x17a750-0x0;var _0x307b72=_0x222f[_0x17a750];return _0x307b72;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var logger=require(_0xf222('0x2'))(_0xf222('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf222('0x4'));var fs=require('fs');var path=require(_0xf222('0x5'));var rimraf=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0xf222('0x8')]=function(_0x54a758,_0x112e6d){return _0x54a758[_0xf222('0x9')]('TeamVoiceQueue',attributes,{'tableName':_0xf222('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcbd=['team_has_voice_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue'];(function(_0x565283,_0x301a2f){var _0x248698=function(_0x5521ec){while(--_0x5521ec){_0x565283['push'](_0x565283['shift']());}};_0x248698(++_0x301a2f);}(_0xfcbd,0x160));var _0xdfcb=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0xfcbd[_0x479509];return _0x382da8;};'use strict';var _=require(_0xdfcb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdfcb('0x1'));var moment=require(_0xdfcb('0x2'));var BPromise=require(_0xdfcb('0x3'));var rp=require(_0xdfcb('0x4'));var fs=require('fs');var path=require(_0xdfcb('0x5'));var rimraf=require(_0xdfcb('0x6'));var config=require(_0xdfcb('0x7'));var attributes=require(_0xdfcb('0x8'));module[_0xdfcb('0x9')]=function(_0x4bdf76,_0x5615a6){return _0x4bdf76[_0xdfcb('0xa')](_0xdfcb('0xb'),attributes,{'tableName':_0xdfcb('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 8b7a40e..a77303b 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 _0xc688=['result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','request','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x52fa1e,_0x39a40f){var _0x26849d=function(_0x4e52c3){while(--_0x4e52c3){_0x52fa1e['push'](_0x52fa1e['shift']());}};_0x26849d(++_0x39a40f);}(_0xc688,0xc0));var _0x8c68=function(_0x314feb,_0xd07315){_0x314feb=_0x314feb-0x0;var _0xd89a42=_0xc688[_0x314feb];return _0xd89a42;};'use strict';var _=require(_0x8c68('0x0'));var util=require(_0x8c68('0x1'));var moment=require('moment');var BPromise=require(_0x8c68('0x2'));var rs=require(_0x8c68('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c68('0x4'))['db'];var utils=require(_0x8c68('0x5'));var logger=require('../../config/logger')(_0x8c68('0x6'));var config=require('../../config/environment');var jayson=require(_0x8c68('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x529400,_0x17f5a3,_0x5e62be){return new BPromise(function(_0x496f4f,_0x26f8dd){return client[_0x8c68('0x8')](_0x529400,_0x5e62be)['then'](function(_0x33b768){logger['info'](_0x8c68('0x9'),_0x17f5a3,_0x8c68('0xa'));logger[_0x8c68('0xb')](_0x8c68('0xc'),_0x17f5a3,'request\x20sent',JSON[_0x8c68('0xd')](_0x33b768));if(_0x33b768[_0x8c68('0xe')]){if(_0x33b768[_0x8c68('0xe')]['code']===0x1f4){logger[_0x8c68('0xe')](_0x8c68('0x9'),_0x17f5a3,_0x33b768[_0x8c68('0xe')][_0x8c68('0xf')]);return _0x26f8dd(_0x33b768[_0x8c68('0xe')][_0x8c68('0xf')]);}logger[_0x8c68('0xe')](_0x8c68('0x9'),_0x17f5a3,_0x33b768[_0x8c68('0xe')]['message']);return _0x496f4f(_0x33b768[_0x8c68('0xe')]['message']);}else{logger[_0x8c68('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x17f5a3,'request\x20sent');_0x496f4f(_0x33b768[_0x8c68('0x11')]['message']);}})[_0x8c68('0x12')](function(_0x406e70){logger[_0x8c68('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x17f5a3,_0x406e70);_0x26f8dd(_0x406e70);});});} \ No newline at end of file +var _0x8f9e=['../../config/environment','jayson/promise','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8f9e,0x160));var _0xe8f9=function(_0x3da901,_0x498bec){_0x3da901=_0x3da901-0x0;var _0xda8ce8=_0x8f9e[_0x3da901];return _0xda8ce8;};'use strict';var _=require(_0xe8f9('0x0'));var util=require(_0xe8f9('0x1'));var moment=require('moment');var BPromise=require(_0xe8f9('0x2'));var rs=require(_0xe8f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe8f9('0x4'))('rpc');var config=require(_0xe8f9('0x5'));var jayson=require(_0xe8f9('0x6'));var client=jayson[_0xe8f9('0x7')][_0xe8f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bec90,_0x4696ef,_0x4fd4ae){return new BPromise(function(_0x34be93,_0x38611d){return client[_0xe8f9('0x9')](_0x3bec90,_0x4fd4ae)[_0xe8f9('0xa')](function(_0xd952d8){logger['info'](_0xe8f9('0xb'),_0x4696ef,_0xe8f9('0xc'));logger[_0xe8f9('0xd')](_0xe8f9('0xe'),_0x4696ef,_0xe8f9('0xc'),JSON[_0xe8f9('0xf')](_0xd952d8));if(_0xd952d8['error']){if(_0xd952d8[_0xe8f9('0x10')]['code']===0x1f4){logger[_0xe8f9('0x10')](_0xe8f9('0xb'),_0x4696ef,_0xd952d8[_0xe8f9('0x10')]['message']);return _0x38611d(_0xd952d8[_0xe8f9('0x10')][_0xe8f9('0x11')]);}logger['error'](_0xe8f9('0xb'),_0x4696ef,_0xd952d8['error'][_0xe8f9('0x11')]);return _0x34be93(_0xd952d8['error'][_0xe8f9('0x11')]);}else{logger[_0xe8f9('0x12')](_0xe8f9('0xb'),_0x4696ef,_0xe8f9('0xc'));_0x34be93(_0xd952d8[_0xe8f9('0x13')][_0xe8f9('0x11')]);}})[_0xe8f9('0x14')](function(_0x25e62c){logger[_0xe8f9('0x10')](_0xe8f9('0xb'),_0x4696ef,_0x25e62c);_0x38611d(_0x25e62c);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 7fa65b6..3277e64 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 _0x5ae9=['/:id','post','create','put','update','delete','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x44c29b,_0x269e15){var _0x4f3f87=function(_0x5b85f1){while(--_0x5b85f1){_0x44c29b['push'](_0x44c29b['shift']());}};_0x4f3f87(++_0x269e15);}(_0x5ae9,0x19b));var _0x95ae=function(_0x295df8,_0x1f9924){_0x295df8=_0x295df8-0x0;var _0x1c4b61=_0x5ae9[_0x295df8];return _0x1c4b61;};'use strict';var multer=require(_0x95ae('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x95ae('0x1'));var express=require(_0x95ae('0x2'));var router=express['Router']();var fs_extra=require(_0x95ae('0x3'));var auth=require(_0x95ae('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x95ae('0x5'));var controller=require('./template.controller');router[_0x95ae('0x6')]('/',auth[_0x95ae('0x7')](),controller[_0x95ae('0x8')]);router[_0x95ae('0x6')](_0x95ae('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x95ae('0xa')]('/',auth[_0x95ae('0x7')](),controller[_0x95ae('0xb')]);router[_0x95ae('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x95ae('0xd')]);router[_0x95ae('0xe')](_0x95ae('0x9'),auth[_0x95ae('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeaab=['exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xeaab,0xd9));var _0xbeaa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xeaab[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xbeaa('0x0'));var util=require('util');var path=require(_0xbeaa('0x1'));var timeout=require(_0xbeaa('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbeaa('0x3'));var auth=require(_0xbeaa('0x4'));var interaction=require(_0xbeaa('0x5'));var config=require(_0xbeaa('0x6'));var controller=require(_0xbeaa('0x7'));router[_0xbeaa('0x8')]('/',auth[_0xbeaa('0x9')](),controller[_0xbeaa('0xa')]);router[_0xbeaa('0x8')](_0xbeaa('0xb'),auth[_0xbeaa('0x9')](),controller[_0xbeaa('0xc')]);router[_0xbeaa('0xd')]('/',auth[_0xbeaa('0x9')](),controller['create']);router[_0xbeaa('0xe')](_0xbeaa('0xb'),auth[_0xbeaa('0x9')](),controller[_0xbeaa('0xf')]);router[_0xbeaa('0x10')](_0xbeaa('0xb'),auth[_0xbeaa('0x9')](),controller['destroy']);module[_0xbeaa('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 ac1c53b..5ddeb4e 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 _0x6a8d=['STRING','TEXT','sequelize','exports'];(function(_0x2ab6f2,_0x29649b){var _0x1aa9f4=function(_0xd7dc5e){while(--_0xd7dc5e){_0x2ab6f2['push'](_0x2ab6f2['shift']());}};_0x1aa9f4(++_0x29649b);}(_0x6a8d,0x15a));var _0xd6a8=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x6a8d[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require(_0xd6a8('0x0'));module[_0xd6a8('0x1')]={'name':{'type':Sequelize[_0xd6a8('0x2')]},'description':{'type':Sequelize[_0xd6a8('0x2')]},'html':{'type':Sequelize[_0xd6a8('0x3')]}}; \ No newline at end of file +var _0xb854=['exports','STRING','TEXT','sequelize'];(function(_0x197f4c,_0x2dcd7d){var _0x47c03c=function(_0x43f7ed){while(--_0x43f7ed){_0x197f4c['push'](_0x197f4c['shift']());}};_0x47c03c(++_0x2dcd7d);}(_0xb854,0x9f));var _0x4b85=function(_0x1161d5,_0x1364ec){_0x1161d5=_0x1161d5-0x0;var _0x5885ac=_0xb854[_0x1161d5];return _0x5885ac;};'use strict';var Sequelize=require(_0x4b85('0x0'));module[_0x4b85('0x1')]={'name':{'type':Sequelize[_0x4b85('0x2')]},'description':{'type':Sequelize[_0x4b85('0x2')]},'html':{'type':Sequelize[_0x4b85('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 00d4620..9cc7c3a 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 _0x9b95=['Templates','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x19cf1d,_0xee9800){var _0x1f57d9=function(_0x26161e){while(--_0x26161e){_0x19cf1d['push'](_0x19cf1d['shift']());}};_0x1f57d9(++_0xee9800);}(_0x9b95,0x140));var _0x59b9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9b95[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x59b9('0x0'));var rimraf=require(_0x59b9('0x1'));var zipdir=require(_0x59b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x59b9('0x3'));var BPromise=require(_0x59b9('0x4'));var Mustache=require(_0x59b9('0x5'));var util=require('util');var path=require(_0x59b9('0x6'));var sox=require(_0x59b9('0x7'));var csv=require(_0x59b9('0x8'));var ejs=require(_0x59b9('0x9'));var fs=require('fs');var fs_extra=require(_0x59b9('0xa'));var _=require('lodash');var squel=require(_0x59b9('0xb'));var crypto=require(_0x59b9('0xc'));var jsforce=require(_0x59b9('0xd'));var deskjs=require(_0x59b9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x59b9('0xf'));var Papa=require(_0x59b9('0x10'));var Redis=require('ioredis');var authService=require(_0x59b9('0x11'));var qs=require(_0x59b9('0x12'));var as=require(_0x59b9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59b9('0x14'))(_0x59b9('0x15'));var utils=require(_0x59b9('0x16'));var config=require(_0x59b9('0x17'));var licenseUtil=require(_0x59b9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1adb23,_0x2c7c53){_0x2c7c53=_0x2c7c53||0xcc;return function(_0x52ffde){if(_0x52ffde){return _0x1adb23[_0x59b9('0x19')](_0x2c7c53);}return _0x1adb23[_0x59b9('0x1a')](_0x2c7c53)['end']();};}function respondWithResult(_0x1592a0,_0x521527){_0x521527=_0x521527||0xc8;return function(_0x148f77){if(_0x148f77){return _0x1592a0[_0x59b9('0x1a')](_0x521527)[_0x59b9('0x1b')](_0x148f77);}};}function respondWithFilteredResult(_0x3ad99e,_0x47774c){return function(_0x3c2c89){if(_0x3c2c89){var _0x194741=typeof _0x47774c[_0x59b9('0x1c')]==='undefined'&&typeof _0x47774c[_0x59b9('0x1d')]==='undefined';var _0x4c4176=_0x3c2c89[_0x59b9('0x1e')];var _0x3668b6=_0x194741?0x0:_0x47774c[_0x59b9('0x1c')];var _0x27bd2f=_0x194741?_0x3c2c89[_0x59b9('0x1e')]:_0x47774c[_0x59b9('0x1c')]+_0x47774c['limit'];var _0x3e1324;if(_0x27bd2f>=_0x4c4176){_0x27bd2f=_0x4c4176;_0x3e1324=0xc8;}else{_0x3e1324=0xce;}_0x3ad99e['status'](_0x3e1324);return _0x3ad99e[_0x59b9('0x1f')](_0x59b9('0x20'),_0x3668b6+'-'+_0x27bd2f+'/'+_0x4c4176)['json'](_0x3c2c89);}return null;};}function patchUpdates(_0x659604){return function(_0x163465){try{jsonpatch['apply'](_0x163465,_0x659604,!![]);}catch(_0x38fa6b){return BPromise['reject'](_0x38fa6b);}return _0x163465[_0x59b9('0x21')]();};}function saveUpdates(_0x466b46,_0x4a5255){return function(_0x53f1a5){if(_0x53f1a5){return _0x53f1a5[_0x59b9('0x22')](_0x466b46)[_0x59b9('0x23')](function(_0x2d0cdd){return _0x2d0cdd;});}return null;};}function removeEntity(_0x1ef329,_0x2b0239){return function(_0x3be726){if(_0x3be726){return _0x3be726['destroy']()['then'](function(){var _0xd2f002=_0x3be726[_0x59b9('0x24')]({'plain':!![]});var _0x5956ee='Templates';return db[_0x59b9('0x25')][_0x59b9('0x26')]({'where':{'type':_0x5956ee,'resourceId':_0xd2f002['id']}})[_0x59b9('0x23')](function(){return _0x3be726;});})[_0x59b9('0x23')](function(){_0x1ef329['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f84f7,_0x5a3a74){return function(_0x2606b8){if(!_0x2606b8){_0x4f84f7[_0x59b9('0x19')](0x194);}return _0x2606b8;};}function handleError(_0x443cbe,_0x46a34a){_0x46a34a=_0x46a34a||0x1f4;return function(_0x2dce68){logger[_0x59b9('0x27')](_0x2dce68['stack']);if(_0x2dce68[_0x59b9('0x28')]){delete _0x2dce68[_0x59b9('0x28')];}_0x443cbe[_0x59b9('0x1a')](_0x46a34a)[_0x59b9('0x29')](_0x2dce68);};}exports[_0x59b9('0x2a')]=function(_0x51d310,_0x4ae442){var _0x4426be={},_0x390ffc={},_0x623fb4={'count':0x0,'rows':[]};var _0x1a5c99=_[_0x59b9('0x2b')](db[_0x59b9('0x2c')][_0x59b9('0x2d')],function(_0x26473b){return{'name':_0x26473b[_0x59b9('0x2e')],'type':_0x26473b[_0x59b9('0x2f')][_0x59b9('0x30')]};});_0x390ffc[_0x59b9('0x31')]=_[_0x59b9('0x2b')](_0x1a5c99,_0x59b9('0x28'));_0x390ffc['query']=_[_0x59b9('0x32')](_0x51d310[_0x59b9('0x33')]);_0x390ffc[_0x59b9('0x34')]=_['intersection'](_0x390ffc[_0x59b9('0x31')],_0x390ffc['query']);_0x4426be['attributes']=_[_0x59b9('0x35')](_0x390ffc[_0x59b9('0x31')],qs[_0x59b9('0x36')](_0x51d310[_0x59b9('0x33')][_0x59b9('0x36')]));_0x4426be[_0x59b9('0x37')]=_0x4426be[_0x59b9('0x37')]['length']?_0x4426be['attributes']:_0x390ffc[_0x59b9('0x31')];if(!_0x51d310['query'][_0x59b9('0x38')](_0x59b9('0x39'))){_0x4426be[_0x59b9('0x1d')]=qs[_0x59b9('0x1d')](_0x51d310[_0x59b9('0x33')]['limit']);_0x4426be[_0x59b9('0x1c')]=qs['offset'](_0x51d310['query']['offset']);}_0x4426be['order']=qs['sort'](_0x51d310[_0x59b9('0x33')]['sort']);_0x4426be[_0x59b9('0x3a')]=qs[_0x59b9('0x34')](_['pick'](_0x51d310[_0x59b9('0x33')],_0x390ffc[_0x59b9('0x34')]),_0x1a5c99);if(_0x51d310['query'][_0x59b9('0x3b')]){_0x4426be[_0x59b9('0x3a')]=_['merge'](_0x4426be[_0x59b9('0x3a')],{'$or':_['map'](_0x1a5c99,function(_0x309992){if(_0x309992[_0x59b9('0x2f')]!=='VIRTUAL'){var _0x38fccb={};_0x38fccb[_0x309992[_0x59b9('0x28')]]={'$like':'%'+_0x51d310[_0x59b9('0x33')][_0x59b9('0x3b')]+'%'};return _0x38fccb;}})});}_0x4426be=_[_0x59b9('0x3c')]({},_0x4426be,_0x51d310[_0x59b9('0x3d')]);var _0x4d002d={'where':_0x4426be['where']};return db[_0x59b9('0x2c')][_0x59b9('0x1e')](_0x4d002d)[_0x59b9('0x23')](function(_0x5de33a){_0x623fb4['count']=_0x5de33a;if(_0x51d310['query'][_0x59b9('0x3e')]){_0x4426be[_0x59b9('0x3f')]=[{'all':!![]}];}return db['Template']['findAll'](_0x4426be);})[_0x59b9('0x23')](function(_0x185cde){_0x623fb4[_0x59b9('0x40')]=_0x185cde;return _0x623fb4;})['then'](respondWithFilteredResult(_0x4ae442,_0x4426be))[_0x59b9('0x41')](handleError(_0x4ae442,null));};exports[_0x59b9('0x42')]=function(_0x56ba23,_0x1304ba){var _0x54cdcf={'raw':!![],'where':{'id':_0x56ba23[_0x59b9('0x43')]['id']}},_0x1704ba={};_0x1704ba[_0x59b9('0x31')]=_[_0x59b9('0x32')](db[_0x59b9('0x2c')][_0x59b9('0x2d')]);_0x1704ba['query']=_[_0x59b9('0x32')](_0x56ba23[_0x59b9('0x33')]);_0x1704ba['filters']=_[_0x59b9('0x35')](_0x1704ba[_0x59b9('0x31')],_0x1704ba['query']);_0x54cdcf[_0x59b9('0x37')]=_['intersection'](_0x1704ba[_0x59b9('0x31')],qs[_0x59b9('0x36')](_0x56ba23[_0x59b9('0x33')]['fields']));_0x54cdcf[_0x59b9('0x37')]=_0x54cdcf[_0x59b9('0x37')][_0x59b9('0x44')]?_0x54cdcf['attributes']:_0x1704ba[_0x59b9('0x31')];if(_0x56ba23[_0x59b9('0x33')][_0x59b9('0x3e')]){_0x54cdcf[_0x59b9('0x3f')]=[{'all':!![]}];}_0x54cdcf=_['merge']({},_0x54cdcf,_0x56ba23[_0x59b9('0x3d')]);return db[_0x59b9('0x2c')][_0x59b9('0x45')](_0x54cdcf)[_0x59b9('0x23')](handleEntityNotFound(_0x1304ba,null))[_0x59b9('0x23')](respondWithResult(_0x1304ba,null))[_0x59b9('0x41')](handleError(_0x1304ba,null));};exports[_0x59b9('0x46')]=function(_0x1f3e76,_0x5207d8){return db[_0x59b9('0x2c')]['create'](_0x1f3e76[_0x59b9('0x47')],{})[_0x59b9('0x23')](function(_0x494cde){var _0xd24357=_0x1f3e76[_0x59b9('0x48')][_0x59b9('0x24')]({'plain':!![]});if(!_0xd24357)throw new Error(_0x59b9('0x49'));if(_0xd24357[_0x59b9('0x4a')]==='user'){var _0x1cd41f=_0x494cde[_0x59b9('0x24')]({'plain':!![]});var _0x398fc0=_0x59b9('0x4b');return db[_0x59b9('0x4c')]['find']({'where':{'name':_0x398fc0,'userProfileId':_0xd24357['userProfileId']},'raw':!![]})['then'](function(_0x4fbb44){if(_0x4fbb44&&_0x4fbb44[_0x59b9('0x4d')]===0x0){return db[_0x59b9('0x25')][_0x59b9('0x46')]({'name':_0x1cd41f[_0x59b9('0x28')],'resourceId':_0x1cd41f['id'],'type':_0x4fbb44[_0x59b9('0x28')],'sectionId':_0x4fbb44['id']},{})[_0x59b9('0x23')](function(){return _0x494cde;});}else{return _0x494cde;}})[_0x59b9('0x41')](function(_0x312496){logger[_0x59b9('0x27')](_0x59b9('0x4e'),_0x312496);throw _0x312496;});}return _0x494cde;})[_0x59b9('0x23')](respondWithResult(_0x5207d8,0xc9))[_0x59b9('0x41')](handleError(_0x5207d8,null));};exports['update']=function(_0x58384c,_0x4db0dc){if(_0x58384c[_0x59b9('0x47')]['id']){delete _0x58384c[_0x59b9('0x47')]['id'];}return db[_0x59b9('0x2c')]['find']({'where':{'id':_0x58384c[_0x59b9('0x43')]['id']}})['then'](handleEntityNotFound(_0x4db0dc,null))['then'](saveUpdates(_0x58384c[_0x59b9('0x47')],null))[_0x59b9('0x23')](respondWithResult(_0x4db0dc,null))[_0x59b9('0x41')](handleError(_0x4db0dc,null));};exports['destroy']=function(_0x5abc95,_0x9814ff){return db['Template']['find']({'where':{'id':_0x5abc95['params']['id']}})[_0x59b9('0x23')](handleEntityNotFound(_0x9814ff,null))[_0x59b9('0x23')](removeEntity(_0x9814ff,null))['catch'](handleError(_0x9814ff,null));}; \ No newline at end of file +var _0x1cda=['sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','role','user','UserProfileSection','UserProfileResource','error','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','destroy','then','get','Templates','end','stack','name','send','index','map','Template','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','nolimit','order'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1cda,0x103));var _0xa1cd=function(_0x15a0e8,_0x1112da){_0x15a0e8=_0x15a0e8-0x0;var _0x515ad5=_0x1cda[_0x15a0e8];return _0x515ad5;};'use strict';var emlformat=require(_0xa1cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1cd('0x1'));var jsonpatch=require(_0xa1cd('0x2'));var rp=require(_0xa1cd('0x3'));var moment=require(_0xa1cd('0x4'));var BPromise=require(_0xa1cd('0x5'));var Mustache=require(_0xa1cd('0x6'));var util=require(_0xa1cd('0x7'));var path=require(_0xa1cd('0x8'));var sox=require(_0xa1cd('0x9'));var csv=require(_0xa1cd('0xa'));var ejs=require(_0xa1cd('0xb'));var fs=require('fs');var fs_extra=require(_0xa1cd('0xc'));var _=require(_0xa1cd('0xd'));var squel=require(_0xa1cd('0xe'));var crypto=require(_0xa1cd('0xf'));var jsforce=require(_0xa1cd('0x10'));var deskjs=require(_0xa1cd('0x11'));var toCsv=require('to-csv');var querystring=require(_0xa1cd('0x12'));var Papa=require(_0xa1cd('0x13'));var Redis=require('ioredis');var authService=require(_0xa1cd('0x14'));var qs=require(_0xa1cd('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1cd('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa1cd('0x17'));var licenseUtil=require(_0xa1cd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ab569,_0x523509){_0x523509=_0x523509||0xcc;return function(_0x2f9590){if(_0x2f9590){return _0x2ab569[_0xa1cd('0x19')](_0x523509);}return _0x2ab569[_0xa1cd('0x1a')](_0x523509)['end']();};}function respondWithResult(_0x3e4246,_0x4393bd){_0x4393bd=_0x4393bd||0xc8;return function(_0x40654b){if(_0x40654b){return _0x3e4246[_0xa1cd('0x1a')](_0x4393bd)[_0xa1cd('0x1b')](_0x40654b);}};}function respondWithFilteredResult(_0x81390d,_0x4c16c2){return function(_0x5123fd){if(_0x5123fd){var _0x164898=typeof _0x4c16c2[_0xa1cd('0x1c')]===_0xa1cd('0x1d')&&typeof _0x4c16c2[_0xa1cd('0x1e')]===_0xa1cd('0x1d');var _0x47d5a0=_0x5123fd['count'];var _0x400557=_0x164898?0x0:_0x4c16c2['offset'];var _0x233eaa=_0x164898?_0x5123fd[_0xa1cd('0x1f')]:_0x4c16c2[_0xa1cd('0x1c')]+_0x4c16c2[_0xa1cd('0x1e')];var _0x5727ab;if(_0x233eaa>=_0x47d5a0){_0x233eaa=_0x47d5a0;_0x5727ab=0xc8;}else{_0x5727ab=0xce;}_0x81390d['status'](_0x5727ab);return _0x81390d['set'](_0xa1cd('0x20'),_0x400557+'-'+_0x233eaa+'/'+_0x47d5a0)[_0xa1cd('0x1b')](_0x5123fd);}return null;};}function patchUpdates(_0x2889d1){return function(_0x42ddc7){try{jsonpatch['apply'](_0x42ddc7,_0x2889d1,!![]);}catch(_0x28173f){return BPromise['reject'](_0x28173f);}return _0x42ddc7[_0xa1cd('0x21')]();};}function saveUpdates(_0x2007c1,_0x4746b6){return function(_0x1c2573){if(_0x1c2573){return _0x1c2573['update'](_0x2007c1)['then'](function(_0xf84008){return _0xf84008;});}return null;};}function removeEntity(_0x52e890,_0x581fdb){return function(_0x5656d4){if(_0x5656d4){return _0x5656d4[_0xa1cd('0x22')]()[_0xa1cd('0x23')](function(){var _0x28e380=_0x5656d4[_0xa1cd('0x24')]({'plain':!![]});var _0x461f24=_0xa1cd('0x25');return db['UserProfileResource'][_0xa1cd('0x22')]({'where':{'type':_0x461f24,'resourceId':_0x28e380['id']}})[_0xa1cd('0x23')](function(){return _0x5656d4;});})[_0xa1cd('0x23')](function(){_0x52e890['status'](0xcc)[_0xa1cd('0x26')]();});}};}function handleEntityNotFound(_0x2e6ba4,_0x4d12d6){return function(_0x5e633b){if(!_0x5e633b){_0x2e6ba4[_0xa1cd('0x19')](0x194);}return _0x5e633b;};}function handleError(_0x29e6df,_0x23b056){_0x23b056=_0x23b056||0x1f4;return function(_0x2bb304){logger['error'](_0x2bb304[_0xa1cd('0x27')]);if(_0x2bb304[_0xa1cd('0x28')]){delete _0x2bb304[_0xa1cd('0x28')];}_0x29e6df[_0xa1cd('0x1a')](_0x23b056)[_0xa1cd('0x29')](_0x2bb304);};}exports[_0xa1cd('0x2a')]=function(_0xb226d1,_0x18912d){var _0x399fb0={},_0x3fef57={},_0x27dc23={'count':0x0,'rows':[]};var _0x5ca893=_[_0xa1cd('0x2b')](db[_0xa1cd('0x2c')][_0xa1cd('0x2d')],function(_0x324f1a){return{'name':_0x324f1a[_0xa1cd('0x2e')],'type':_0x324f1a['type'][_0xa1cd('0x2f')]};});_0x3fef57[_0xa1cd('0x30')]=_[_0xa1cd('0x2b')](_0x5ca893,_0xa1cd('0x28'));_0x3fef57['query']=_['keys'](_0xb226d1[_0xa1cd('0x31')]);_0x3fef57[_0xa1cd('0x32')]=_['intersection'](_0x3fef57[_0xa1cd('0x30')],_0x3fef57['query']);_0x399fb0[_0xa1cd('0x33')]=_[_0xa1cd('0x34')](_0x3fef57[_0xa1cd('0x30')],qs[_0xa1cd('0x35')](_0xb226d1[_0xa1cd('0x31')][_0xa1cd('0x35')]));_0x399fb0['attributes']=_0x399fb0[_0xa1cd('0x33')][_0xa1cd('0x36')]?_0x399fb0[_0xa1cd('0x33')]:_0x3fef57[_0xa1cd('0x30')];if(!_0xb226d1['query']['hasOwnProperty'](_0xa1cd('0x37'))){_0x399fb0['limit']=qs[_0xa1cd('0x1e')](_0xb226d1[_0xa1cd('0x31')][_0xa1cd('0x1e')]);_0x399fb0[_0xa1cd('0x1c')]=qs[_0xa1cd('0x1c')](_0xb226d1[_0xa1cd('0x31')]['offset']);}_0x399fb0[_0xa1cd('0x38')]=qs[_0xa1cd('0x39')](_0xb226d1['query'][_0xa1cd('0x39')]);_0x399fb0[_0xa1cd('0x3a')]=qs[_0xa1cd('0x32')](_['pick'](_0xb226d1[_0xa1cd('0x31')],_0x3fef57['filters']),_0x5ca893);if(_0xb226d1[_0xa1cd('0x31')][_0xa1cd('0x3b')]){_0x399fb0[_0xa1cd('0x3a')]=_[_0xa1cd('0x3c')](_0x399fb0[_0xa1cd('0x3a')],{'$or':_[_0xa1cd('0x2b')](_0x5ca893,function(_0x3199de){if(_0x3199de['type']!==_0xa1cd('0x3d')){var _0x1b19e9={};_0x1b19e9[_0x3199de[_0xa1cd('0x28')]]={'$like':'%'+_0xb226d1[_0xa1cd('0x31')][_0xa1cd('0x3b')]+'%'};return _0x1b19e9;}})});}_0x399fb0=_['merge']({},_0x399fb0,_0xb226d1[_0xa1cd('0x3e')]);var _0x44ae62={'where':_0x399fb0['where']};return db[_0xa1cd('0x2c')][_0xa1cd('0x1f')](_0x44ae62)[_0xa1cd('0x23')](function(_0x476d4a){_0x27dc23[_0xa1cd('0x1f')]=_0x476d4a;if(_0xb226d1[_0xa1cd('0x31')][_0xa1cd('0x3f')]){_0x399fb0[_0xa1cd('0x40')]=[{'all':!![]}];}return db[_0xa1cd('0x2c')][_0xa1cd('0x41')](_0x399fb0);})[_0xa1cd('0x23')](function(_0x406918){_0x27dc23['rows']=_0x406918;return _0x27dc23;})[_0xa1cd('0x23')](respondWithFilteredResult(_0x18912d,_0x399fb0))[_0xa1cd('0x42')](handleError(_0x18912d,null));};exports[_0xa1cd('0x43')]=function(_0x418caf,_0x40325c){var _0x263dbc={'raw':!![],'where':{'id':_0x418caf[_0xa1cd('0x44')]['id']}},_0x2299c7={};_0x2299c7[_0xa1cd('0x30')]=_[_0xa1cd('0x45')](db[_0xa1cd('0x2c')][_0xa1cd('0x2d')]);_0x2299c7['query']=_[_0xa1cd('0x45')](_0x418caf['query']);_0x2299c7['filters']=_[_0xa1cd('0x34')](_0x2299c7[_0xa1cd('0x30')],_0x2299c7['query']);_0x263dbc[_0xa1cd('0x33')]=_[_0xa1cd('0x34')](_0x2299c7[_0xa1cd('0x30')],qs[_0xa1cd('0x35')](_0x418caf[_0xa1cd('0x31')][_0xa1cd('0x35')]));_0x263dbc[_0xa1cd('0x33')]=_0x263dbc[_0xa1cd('0x33')][_0xa1cd('0x36')]?_0x263dbc['attributes']:_0x2299c7[_0xa1cd('0x30')];if(_0x418caf['query']['includeAll']){_0x263dbc['include']=[{'all':!![]}];}_0x263dbc=_[_0xa1cd('0x3c')]({},_0x263dbc,_0x418caf['options']);return db['Template'][_0xa1cd('0x46')](_0x263dbc)['then'](handleEntityNotFound(_0x40325c,null))[_0xa1cd('0x23')](respondWithResult(_0x40325c,null))[_0xa1cd('0x42')](handleError(_0x40325c,null));};exports['create']=function(_0x159a89,_0x5d9e65){return db[_0xa1cd('0x2c')][_0xa1cd('0x47')](_0x159a89[_0xa1cd('0x48')],{})['then'](function(_0x5d7c77){var _0x198c75=_0x159a89['user']['get']({'plain':!![]});if(!_0x198c75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x198c75[_0xa1cd('0x49')]===_0xa1cd('0x4a')){var _0x4b9721=_0x5d7c77[_0xa1cd('0x24')]({'plain':!![]});var _0x36e7c4='Templates';return db[_0xa1cd('0x4b')][_0xa1cd('0x46')]({'where':{'name':_0x36e7c4,'userProfileId':_0x198c75['userProfileId']},'raw':!![]})[_0xa1cd('0x23')](function(_0xe92b46){if(_0xe92b46&&_0xe92b46['autoAssociation']===0x0){return db[_0xa1cd('0x4c')]['create']({'name':_0x4b9721[_0xa1cd('0x28')],'resourceId':_0x4b9721['id'],'type':_0xe92b46[_0xa1cd('0x28')],'sectionId':_0xe92b46['id']},{})[_0xa1cd('0x23')](function(){return _0x5d7c77;});}else{return _0x5d7c77;}})[_0xa1cd('0x42')](function(_0x41ec3d){logger[_0xa1cd('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41ec3d);throw _0x41ec3d;});}return _0x5d7c77;})[_0xa1cd('0x23')](respondWithResult(_0x5d9e65,0xc9))[_0xa1cd('0x42')](handleError(_0x5d9e65,null));};exports[_0xa1cd('0x4e')]=function(_0x5697f2,_0x35b7ff){if(_0x5697f2[_0xa1cd('0x48')]['id']){delete _0x5697f2['body']['id'];}return db[_0xa1cd('0x2c')][_0xa1cd('0x46')]({'where':{'id':_0x5697f2[_0xa1cd('0x44')]['id']}})[_0xa1cd('0x23')](handleEntityNotFound(_0x35b7ff,null))[_0xa1cd('0x23')](saveUpdates(_0x5697f2[_0xa1cd('0x48')],null))['then'](respondWithResult(_0x35b7ff,null))[_0xa1cd('0x42')](handleError(_0x35b7ff,null));};exports[_0xa1cd('0x22')]=function(_0x4c4379,_0x5476a5){return db[_0xa1cd('0x2c')][_0xa1cd('0x46')]({'where':{'id':_0x4c4379['params']['id']}})[_0xa1cd('0x23')](handleEntityNotFound(_0x5476a5,null))[_0xa1cd('0x23')](removeEntity(_0x5476a5,null))[_0xa1cd('0x42')](handleError(_0x5476a5,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 0110ddf..d0c5210 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 _0x5bcd=['tools_templates','lodash','util','api','moment','bluebird','path','rimraf','./template.attributes','define','Template'];(function(_0x32be82,_0x21b592){var _0x35aa04=function(_0x3d59ca){while(--_0x3d59ca){_0x32be82['push'](_0x32be82['shift']());}};_0x35aa04(++_0x21b592);}(_0x5bcd,0x1ae));var _0xd5bc=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x5bcd[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0xd5bc('0x0'));var util=require(_0xd5bc('0x1'));var logger=require('../../config/logger')(_0xd5bc('0x2'));var moment=require(_0xd5bc('0x3'));var BPromise=require(_0xd5bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd5bc('0x5'));var rimraf=require(_0xd5bc('0x6'));var config=require('../../config/environment');var attributes=require(_0xd5bc('0x7'));module['exports']=function(_0x43ce6e,_0x42b041){return _0x43ce6e[_0xd5bc('0x8')](_0xd5bc('0x9'),attributes,{'tableName':_0xd5bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3018=['tools_templates','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./template.attributes','Template'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x3018,0x1b1));var _0x8301=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3018[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x8301('0x0'));var util=require(_0x8301('0x1'));var logger=require(_0x8301('0x2'))(_0x8301('0x3'));var moment=require(_0x8301('0x4'));var BPromise=require('bluebird');var rp=require(_0x8301('0x5'));var fs=require('fs');var path=require(_0x8301('0x6'));var rimraf=require(_0x8301('0x7'));var config=require(_0x8301('0x8'));var attributes=require(_0x8301('0x9'));module['exports']=function(_0x16c424,_0xbfeda2){return _0x16c424['define'](_0x8301('0xa'),attributes,{'tableName':_0x8301('0xb'),'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 939c581..ddc062b 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 _0x0d9e=['request\x20sent','error','message','result','catch','GetTemplate','Template','options','raw','attributes','limit','include','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s'];(function(_0x390da6,_0x5d43a5){var _0x456107=function(_0x28c53b){while(--_0x28c53b){_0x390da6['push'](_0x390da6['shift']());}};_0x456107(++_0x5d43a5);}(_0x0d9e,0x14c));var _0xe0d9=function(_0x59bd6b,_0x4e653f){_0x59bd6b=_0x59bd6b-0x0;var _0x61afe=_0x0d9e[_0x59bd6b];return _0x61afe;};'use strict';var _=require(_0xe0d9('0x0'));var util=require(_0xe0d9('0x1'));var moment=require(_0xe0d9('0x2'));var BPromise=require(_0xe0d9('0x3'));var rs=require(_0xe0d9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0d9('0x5'))['db'];var utils=require(_0xe0d9('0x6'));var logger=require(_0xe0d9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe0d9('0x8'));var client=jayson['client'][_0xe0d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x341bb1,_0x183bd9,_0x2320a5){return new BPromise(function(_0x2ec4d4,_0x39a611){return client[_0xe0d9('0xa')](_0x341bb1,_0x2320a5)[_0xe0d9('0xb')](function(_0x4eb561){logger[_0xe0d9('0xc')](_0xe0d9('0xd'),_0x183bd9,'request\x20sent');logger[_0xe0d9('0xe')](_0xe0d9('0xf'),_0x183bd9,_0xe0d9('0x10'),JSON['stringify'](_0x4eb561));if(_0x4eb561[_0xe0d9('0x11')]){if(_0x4eb561[_0xe0d9('0x11')]['code']===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x183bd9,_0x4eb561[_0xe0d9('0x11')]['message']);return _0x39a611(_0x4eb561[_0xe0d9('0x11')][_0xe0d9('0x12')]);}logger['error'](_0xe0d9('0xd'),_0x183bd9,_0x4eb561[_0xe0d9('0x11')]['message']);return _0x2ec4d4(_0x4eb561[_0xe0d9('0x11')]['message']);}else{logger[_0xe0d9('0xc')](_0xe0d9('0xd'),_0x183bd9,'request\x20sent');_0x2ec4d4(_0x4eb561[_0xe0d9('0x13')][_0xe0d9('0x12')]);}})[_0xe0d9('0x14')](function(_0x8284c3){logger[_0xe0d9('0x11')](_0xe0d9('0xd'),_0x183bd9,_0x8284c3);_0x39a611(_0x8284c3);});});}exports[_0xe0d9('0x15')]=function(_0x51895b){var _0x1b1f44=this;return new Promise(function(_0x5bba4c,_0x39d067){return db[_0xe0d9('0x16')]['findAll']({'raw':_0x51895b[_0xe0d9('0x17')]?_0x51895b[_0xe0d9('0x17')][_0xe0d9('0x18')]===undefined?!![]:![]:!![],'where':_0x51895b['options']?_0x51895b[_0xe0d9('0x17')]['where']||null:null,'attributes':_0x51895b[_0xe0d9('0x17')]?_0x51895b['options'][_0xe0d9('0x19')]||null:null,'limit':_0x51895b[_0xe0d9('0x17')]?_0x51895b['options'][_0xe0d9('0x1a')]||null:null,'include':_0x51895b['options']?_0x51895b[_0xe0d9('0x17')][_0xe0d9('0x1b')]?_[_0xe0d9('0x1c')](_0x51895b[_0xe0d9('0x17')]['include'],function(_0xde1569){return{'model':db[_0xde1569['model']],'as':_0xde1569['as'],'attributes':_0xde1569['attributes'],'include':_0xde1569[_0xe0d9('0x1b')]?_[_0xe0d9('0x1c')](_0xde1569[_0xe0d9('0x1b')],function(_0x1215e0){return{'model':db[_0x1215e0['model']],'as':_0x1215e0['as'],'attributes':_0x1215e0[_0xe0d9('0x19')],'include':_0x1215e0['include']?_[_0xe0d9('0x1c')](_0x1215e0[_0xe0d9('0x1b')],function(_0x2fa302){return{'model':db[_0x2fa302['model']],'as':_0x2fa302['as'],'attributes':_0x2fa302[_0xe0d9('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b4ea7){logger['info']('GetTemplate',_0x51895b);logger['debug']('GetTemplate',_0x51895b,JSON['stringify'](_0x4b4ea7));_0x5bba4c(_0x4b4ea7);})[_0xe0d9('0x14')](function(_0x3c645e){logger[_0xe0d9('0x11')]('GetTemplate',_0x3c645e[_0xe0d9('0x12')],_0x51895b);_0x39d067(_0x1b1f44[_0xe0d9('0x11')](0x1f4,_0x3c645e[_0xe0d9('0x12')]));});});}; \ No newline at end of file +var _0x4441=['http','request','request\x20sent','stringify','error','Template,\x20%s,\x20%s','message','info','catch','GetTemplate','Template','options','raw','limit','include','model','map','attributes','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x4441,0xd4));var _0x1444=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4441[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x1444('0x0'));var util=require('util');var moment=require(_0x1444('0x1'));var BPromise=require(_0x1444('0x2'));var rs=require(_0x1444('0x3'));var fs=require('fs');var Redis=require(_0x1444('0x4'));var db=require(_0x1444('0x5'))['db'];var utils=require(_0x1444('0x6'));var logger=require(_0x1444('0x7'))(_0x1444('0x8'));var config=require(_0x1444('0x9'));var jayson=require(_0x1444('0xa'));var client=jayson[_0x1444('0xb')][_0x1444('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe26b0a,_0x10cc2d,_0x2a04d2){return new BPromise(function(_0x272e3d,_0x224858){return client[_0x1444('0xd')](_0xe26b0a,_0x2a04d2)['then'](function(_0x58248b){logger['info']('Template,\x20%s,\x20%s',_0x10cc2d,_0x1444('0xe'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x10cc2d,_0x1444('0xe'),JSON[_0x1444('0xf')](_0x58248b));if(_0x58248b[_0x1444('0x10')]){if(_0x58248b[_0x1444('0x10')]['code']===0x1f4){logger[_0x1444('0x10')](_0x1444('0x11'),_0x10cc2d,_0x58248b['error'][_0x1444('0x12')]);return _0x224858(_0x58248b[_0x1444('0x10')][_0x1444('0x12')]);}logger['error']('Template,\x20%s,\x20%s',_0x10cc2d,_0x58248b[_0x1444('0x10')]['message']);return _0x272e3d(_0x58248b[_0x1444('0x10')][_0x1444('0x12')]);}else{logger[_0x1444('0x13')](_0x1444('0x11'),_0x10cc2d,_0x1444('0xe'));_0x272e3d(_0x58248b['result'][_0x1444('0x12')]);}})[_0x1444('0x14')](function(_0x4c68f7){logger[_0x1444('0x10')](_0x1444('0x11'),_0x10cc2d,_0x4c68f7);_0x224858(_0x4c68f7);});});}exports[_0x1444('0x15')]=function(_0x33e17a){var _0x4ca519=this;return new Promise(function(_0x4bf20a,_0x1bb876){return db[_0x1444('0x16')]['findAll']({'raw':_0x33e17a[_0x1444('0x17')]?_0x33e17a[_0x1444('0x17')][_0x1444('0x18')]===undefined?!![]:![]:!![],'where':_0x33e17a['options']?_0x33e17a[_0x1444('0x17')]['where']||null:null,'attributes':_0x33e17a[_0x1444('0x17')]?_0x33e17a[_0x1444('0x17')]['attributes']||null:null,'limit':_0x33e17a['options']?_0x33e17a[_0x1444('0x17')][_0x1444('0x19')]||null:null,'include':_0x33e17a[_0x1444('0x17')]?_0x33e17a[_0x1444('0x17')][_0x1444('0x1a')]?_['map'](_0x33e17a['options'][_0x1444('0x1a')],function(_0x167877){return{'model':db[_0x167877[_0x1444('0x1b')]],'as':_0x167877['as'],'attributes':_0x167877['attributes'],'include':_0x167877[_0x1444('0x1a')]?_[_0x1444('0x1c')](_0x167877[_0x1444('0x1a')],function(_0x125204){return{'model':db[_0x125204[_0x1444('0x1b')]],'as':_0x125204['as'],'attributes':_0x125204[_0x1444('0x1d')],'include':_0x125204[_0x1444('0x1a')]?_[_0x1444('0x1c')](_0x125204[_0x1444('0x1a')],function(_0x56cbd7){return{'model':db[_0x56cbd7[_0x1444('0x1b')]],'as':_0x56cbd7['as'],'attributes':_0x56cbd7[_0x1444('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1444('0x1e')](function(_0x3a1895){logger[_0x1444('0x13')](_0x1444('0x15'),_0x33e17a);logger[_0x1444('0x1f')]('GetTemplate',_0x33e17a,JSON[_0x1444('0xf')](_0x3a1895));_0x4bf20a(_0x3a1895);})[_0x1444('0x14')](function(_0x223d21){logger[_0x1444('0x10')](_0x1444('0x15'),_0x223d21[_0x1444('0x12')],_0x33e17a);_0x1bb876(_0x4ca519['error'](0x1f4,_0x223d21[_0x1444('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 37cc9ae..6770529 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 _0x17a5=['get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','update','delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','./trigger.controller'];(function(_0x34b888,_0x2afae9){var _0x5c6703=function(_0x389a6d){while(--_0x389a6d){_0x34b888['push'](_0x34b888['shift']());}};_0x5c6703(++_0x2afae9);}(_0x17a5,0x1d5));var _0x517a=function(_0x4025df,_0x5bdc3a){_0x4025df=_0x4025df-0x0;var _0x3caeca=_0x17a5[_0x4025df];return _0x3caeca;};'use strict';var multer=require('multer');var util=require(_0x517a('0x0'));var path=require(_0x517a('0x1'));var timeout=require('connect-timeout');var express=require(_0x517a('0x2'));var router=express['Router']();var fs_extra=require(_0x517a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x517a('0x4'));var config=require('../../config/environment');var controller=require(_0x517a('0x5'));router[_0x517a('0x6')]('/',auth[_0x517a('0x7')](),controller['index']);router[_0x517a('0x6')](_0x517a('0x8'),auth[_0x517a('0x7')](),controller[_0x517a('0x9')]);router[_0x517a('0x6')](_0x517a('0xa'),auth[_0x517a('0x7')](),controller[_0x517a('0xb')]);router[_0x517a('0x6')](_0x517a('0xc'),auth[_0x517a('0x7')](),controller[_0x517a('0xd')]);router[_0x517a('0x6')](_0x517a('0xe'),auth['isAuthenticated'](),controller[_0x517a('0xf')]);router[_0x517a('0x10')]('/',auth['isAuthenticated'](),controller[_0x517a('0x11')]);router[_0x517a('0x10')](_0x517a('0xa'),auth[_0x517a('0x7')](),controller[_0x517a('0x12')]);router[_0x517a('0x10')]('/:id/any_conditions',auth[_0x517a('0x7')](),controller[_0x517a('0x13')]);router[_0x517a('0x10')](_0x517a('0xe'),auth['isAuthenticated'](),controller[_0x517a('0x14')]);router['put'](_0x517a('0x8'),auth[_0x517a('0x7')](),controller[_0x517a('0x15')]);router[_0x517a('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x517a('0x17')]);module[_0x517a('0x18')]=router; \ No newline at end of file +var _0x74a2=['isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','post','addAllCondition','/:id/actions','addAction','put','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get'];(function(_0x53b1ed,_0x46eac2){var _0x2c663d=function(_0x227b1c){while(--_0x227b1c){_0x53b1ed['push'](_0x53b1ed['shift']());}};_0x2c663d(++_0x46eac2);}(_0x74a2,0x1bf));var _0x274a=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0x74a2[_0x356127];return _0x5d4c75;};'use strict';var multer=require('multer');var util=require(_0x274a('0x0'));var path=require(_0x274a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x274a('0x2')]();var fs_extra=require(_0x274a('0x3'));var auth=require(_0x274a('0x4'));var interaction=require(_0x274a('0x5'));var config=require(_0x274a('0x6'));var controller=require(_0x274a('0x7'));router[_0x274a('0x8')]('/',auth[_0x274a('0x9')](),controller[_0x274a('0xa')]);router[_0x274a('0x8')](_0x274a('0xb'),auth[_0x274a('0x9')](),controller[_0x274a('0xc')]);router[_0x274a('0x8')](_0x274a('0xd'),auth['isAuthenticated'](),controller[_0x274a('0xe')]);router[_0x274a('0x8')]('/:id/any_conditions',auth[_0x274a('0x9')](),controller[_0x274a('0xf')]);router[_0x274a('0x8')]('/:id/actions',auth[_0x274a('0x9')](),controller[_0x274a('0x10')]);router['post']('/',auth[_0x274a('0x9')](),controller['create']);router[_0x274a('0x11')](_0x274a('0xd'),auth['isAuthenticated'](),controller[_0x274a('0x12')]);router[_0x274a('0x11')]('/:id/any_conditions',auth[_0x274a('0x9')](),controller['addAnyCondition']);router['post'](_0x274a('0x13'),auth['isAuthenticated'](),controller[_0x274a('0x14')]);router[_0x274a('0x15')](_0x274a('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x274a('0xb'),auth[_0x274a('0x9')](),controller[_0x274a('0x16')]);module[_0x274a('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index db4fc52..7dd3b9e 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 _0x8f35=['exports','STRING','BOOLEAN','sequelize'];(function(_0x166ba2,_0x165751){var _0x19d4ba=function(_0x34a40d){while(--_0x34a40d){_0x166ba2['push'](_0x166ba2['shift']());}};_0x19d4ba(++_0x165751);}(_0x8f35,0x107));var _0x58f3=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x8f35[_0x11c573];return _0x6b72de;};'use strict';var Sequelize=require(_0x58f3('0x0'));module[_0x58f3('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x58f3('0x2')]},'description':{'type':Sequelize[_0x58f3('0x2')]},'status':{'type':Sequelize[_0x58f3('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xadb2=['exports','STRING'];(function(_0x287ef0,_0x22d6c6){var _0x37d443=function(_0x3b70c0){while(--_0x3b70c0){_0x287ef0['push'](_0x287ef0['shift']());}};_0x37d443(++_0x22d6c6);}(_0xadb2,0xf2));var _0x2adb=function(_0x45fc66,_0x1ee1a1){_0x45fc66=_0x45fc66-0x0;var _0x4bb191=_0xadb2[_0x45fc66];return _0x4bb191;};'use strict';var Sequelize=require('sequelize');module[_0x2adb('0x0')]={'name':{'type':Sequelize[_0x2adb('0x1')]},'channel':{'type':Sequelize[_0x2adb('0x1')]},'description':{'type':Sequelize[_0x2adb('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index ca00221..422f9d2 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 _0x0750=['get','Triggers','UserProfileResource','end','error','stack','name','send','index','map','Trigger','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','autoAssociation','addAllCondition','TriggerAllId','TriggerAnyId','Condition','getAllConditions','findOne','order','sort','getAnyConditions','addAction','getActions','Action','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0x0750,0xee));var _0x0075=function(_0x12794e,_0x340e2e){_0x12794e=_0x12794e-0x0;var _0x1e9570=_0x0750[_0x12794e];return _0x1e9570;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0075('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0075('0x1'));var rp=require('request-promise');var moment=require(_0x0075('0x2'));var BPromise=require(_0x0075('0x3'));var Mustache=require(_0x0075('0x4'));var util=require(_0x0075('0x5'));var path=require(_0x0075('0x6'));var sox=require('sox');var csv=require(_0x0075('0x7'));var ejs=require(_0x0075('0x8'));var fs=require('fs');var fs_extra=require(_0x0075('0x9'));var _=require('lodash');var squel=require(_0x0075('0xa'));var crypto=require(_0x0075('0xb'));var jsforce=require(_0x0075('0xc'));var deskjs=require(_0x0075('0xd'));var toCsv=require(_0x0075('0x7'));var querystring=require('querystring');var Papa=require(_0x0075('0xe'));var Redis=require(_0x0075('0xf'));var authService=require(_0x0075('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0075('0x11'));var hardwareService=require(_0x0075('0x12'));var logger=require(_0x0075('0x13'))(_0x0075('0x14'));var utils=require(_0x0075('0x15'));var config=require(_0x0075('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0075('0x17'))['db'];function respondWithStatusCode(_0xeffcd6,_0x804896){_0x804896=_0x804896||0xcc;return function(_0x2ce03d){if(_0x2ce03d){return _0xeffcd6['sendStatus'](_0x804896);}return _0xeffcd6['status'](_0x804896)['end']();};}function respondWithResult(_0x36a91f,_0x33420c){_0x33420c=_0x33420c||0xc8;return function(_0x201019){if(_0x201019){return _0x36a91f[_0x0075('0x18')](_0x33420c)[_0x0075('0x19')](_0x201019);}};}function respondWithFilteredResult(_0x5cc928,_0x4e49aa){return function(_0x7687e1){if(_0x7687e1){var _0xe9fae6=typeof _0x4e49aa['offset']===_0x0075('0x1a')&&typeof _0x4e49aa[_0x0075('0x1b')]==='undefined';var _0x2349ea=_0x7687e1[_0x0075('0x1c')];var _0xa6bc00=_0xe9fae6?0x0:_0x4e49aa['offset'];var _0x6a3b4a=_0xe9fae6?_0x7687e1[_0x0075('0x1c')]:_0x4e49aa[_0x0075('0x1d')]+_0x4e49aa['limit'];var _0x1032eb;if(_0x6a3b4a>=_0x2349ea){_0x6a3b4a=_0x2349ea;_0x1032eb=0xc8;}else{_0x1032eb=0xce;}_0x5cc928[_0x0075('0x18')](_0x1032eb);return _0x5cc928[_0x0075('0x1e')](_0x0075('0x1f'),_0xa6bc00+'-'+_0x6a3b4a+'/'+_0x2349ea)[_0x0075('0x19')](_0x7687e1);}return null;};}function patchUpdates(_0x23f5ef){return function(_0x214a8f){try{jsonpatch[_0x0075('0x20')](_0x214a8f,_0x23f5ef,!![]);}catch(_0x23561b){return BPromise[_0x0075('0x21')](_0x23561b);}return _0x214a8f[_0x0075('0x22')]();};}function saveUpdates(_0x4602a7,_0x359c4e){return function(_0x480646){if(_0x480646){return _0x480646[_0x0075('0x23')](_0x4602a7)[_0x0075('0x24')](function(_0x4a9bf0){return _0x4a9bf0;});}return null;};}function removeEntity(_0x11d5fe,_0x38c7c7){return function(_0x44d897){if(_0x44d897){return _0x44d897[_0x0075('0x25')]()[_0x0075('0x24')](function(){var _0x43b32d=_0x44d897[_0x0075('0x26')]({'plain':!![]});var _0x327845=_0x0075('0x27');return db[_0x0075('0x28')][_0x0075('0x25')]({'where':{'type':_0x327845,'resourceId':_0x43b32d['id']}})['then'](function(){return _0x44d897;});})[_0x0075('0x24')](function(){_0x11d5fe[_0x0075('0x18')](0xcc)[_0x0075('0x29')]();});}};}function handleEntityNotFound(_0x2b3c98,_0x19dd54){return function(_0x1f18e7){if(!_0x1f18e7){_0x2b3c98['sendStatus'](0x194);}return _0x1f18e7;};}function handleError(_0x42b1e5,_0x24b811){_0x24b811=_0x24b811||0x1f4;return function(_0x147403){logger[_0x0075('0x2a')](_0x147403[_0x0075('0x2b')]);if(_0x147403['name']){delete _0x147403[_0x0075('0x2c')];}_0x42b1e5[_0x0075('0x18')](_0x24b811)[_0x0075('0x2d')](_0x147403);};}exports[_0x0075('0x2e')]=function(_0x13504c,_0x1f2967){var _0x44c8e4={},_0x3ad30e={},_0xb8dac9={'count':0x0,'rows':[]};var _0x43f60b=_[_0x0075('0x2f')](db[_0x0075('0x30')]['rawAttributes'],function(_0x49cbaa){return{'name':_0x49cbaa['fieldName'],'type':_0x49cbaa[_0x0075('0x31')]['key']};});_0x3ad30e[_0x0075('0x32')]=_[_0x0075('0x2f')](_0x43f60b,_0x0075('0x2c'));_0x3ad30e[_0x0075('0x33')]=_[_0x0075('0x34')](_0x13504c[_0x0075('0x33')]);_0x3ad30e['filters']=_[_0x0075('0x35')](_0x3ad30e[_0x0075('0x32')],_0x3ad30e[_0x0075('0x33')]);_0x44c8e4[_0x0075('0x36')]=_['intersection'](_0x3ad30e['model'],qs[_0x0075('0x37')](_0x13504c['query'][_0x0075('0x37')]));_0x44c8e4[_0x0075('0x36')]=_0x44c8e4[_0x0075('0x36')][_0x0075('0x38')]?_0x44c8e4['attributes']:_0x3ad30e[_0x0075('0x32')];if(!_0x13504c[_0x0075('0x33')][_0x0075('0x39')](_0x0075('0x3a'))){_0x44c8e4[_0x0075('0x1b')]=qs[_0x0075('0x1b')](_0x13504c[_0x0075('0x33')][_0x0075('0x1b')]);_0x44c8e4[_0x0075('0x1d')]=qs[_0x0075('0x1d')](_0x13504c['query'][_0x0075('0x1d')]);}_0x44c8e4['order']=qs['sort'](_0x13504c[_0x0075('0x33')]['sort']);_0x44c8e4[_0x0075('0x3b')]=qs[_0x0075('0x3c')](_[_0x0075('0x3d')](_0x13504c[_0x0075('0x33')],_0x3ad30e[_0x0075('0x3c')]),_0x43f60b);if(_0x13504c[_0x0075('0x33')][_0x0075('0x3e')]){_0x44c8e4[_0x0075('0x3b')]=_[_0x0075('0x3f')](_0x44c8e4[_0x0075('0x3b')],{'$or':_['map'](_0x43f60b,function(_0x489978){if(_0x489978[_0x0075('0x31')]!==_0x0075('0x40')){var _0x5b8594={};_0x5b8594[_0x489978[_0x0075('0x2c')]]={'$like':'%'+_0x13504c['query'][_0x0075('0x3e')]+'%'};return _0x5b8594;}})});}_0x44c8e4=_['merge']({},_0x44c8e4,_0x13504c[_0x0075('0x41')]);var _0x5c3ba3={'where':_0x44c8e4[_0x0075('0x3b')]};return db[_0x0075('0x30')][_0x0075('0x1c')](_0x5c3ba3)[_0x0075('0x24')](function(_0x260956){_0xb8dac9[_0x0075('0x1c')]=_0x260956;if(_0x13504c[_0x0075('0x33')][_0x0075('0x42')]){_0x44c8e4[_0x0075('0x43')]=[{'all':!![]}];}return db['Trigger'][_0x0075('0x44')](_0x44c8e4);})[_0x0075('0x24')](function(_0x1d3f6e){_0xb8dac9[_0x0075('0x45')]=_0x1d3f6e;return _0xb8dac9;})[_0x0075('0x24')](respondWithFilteredResult(_0x1f2967,_0x44c8e4))[_0x0075('0x46')](handleError(_0x1f2967,null));};exports[_0x0075('0x47')]=function(_0x778f0f,_0x48efbc){var _0x55b861={'raw':![],'where':{'id':_0x778f0f[_0x0075('0x48')]['id']}},_0x3fab76={};_0x3fab76[_0x0075('0x32')]=_[_0x0075('0x34')](db['Trigger'][_0x0075('0x49')]);_0x3fab76[_0x0075('0x33')]=_[_0x0075('0x34')](_0x778f0f['query']);_0x3fab76[_0x0075('0x3c')]=_[_0x0075('0x35')](_0x3fab76[_0x0075('0x32')],_0x3fab76[_0x0075('0x33')]);_0x55b861[_0x0075('0x36')]=_[_0x0075('0x35')](_0x3fab76['model'],qs[_0x0075('0x37')](_0x778f0f[_0x0075('0x33')][_0x0075('0x37')]));_0x55b861[_0x0075('0x36')]=_0x55b861[_0x0075('0x36')][_0x0075('0x38')]?_0x55b861[_0x0075('0x36')]:_0x3fab76[_0x0075('0x32')];if(_0x778f0f['query'][_0x0075('0x42')]){_0x55b861[_0x0075('0x43')]=[{'all':!![]}];}_0x55b861=_['merge']({},_0x55b861,_0x778f0f[_0x0075('0x41')]);return db['Trigger'][_0x0075('0x4a')](_0x55b861)[_0x0075('0x24')](handleEntityNotFound(_0x48efbc,null))[_0x0075('0x24')](respondWithResult(_0x48efbc,null))[_0x0075('0x46')](handleError(_0x48efbc,null));};exports[_0x0075('0x4b')]=function(_0x51c902,_0x200e45){return db[_0x0075('0x30')]['create'](_0x51c902[_0x0075('0x4c')],{})[_0x0075('0x24')](function(_0x28564d){var _0x30f8b6=_0x51c902[_0x0075('0x4d')][_0x0075('0x26')]({'plain':!![]});if(!_0x30f8b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30f8b6[_0x0075('0x4e')]===_0x0075('0x4d')){var _0x2881ae=_0x28564d['get']({'plain':!![]});var _0x214fa0=_0x0075('0x27');return db['UserProfileSection'][_0x0075('0x4a')]({'where':{'name':_0x214fa0,'userProfileId':_0x30f8b6['userProfileId']},'raw':!![]})[_0x0075('0x24')](function(_0x10d4d3){if(_0x10d4d3&&_0x10d4d3[_0x0075('0x4f')]===0x0){return db[_0x0075('0x28')]['create']({'name':_0x2881ae[_0x0075('0x2c')],'resourceId':_0x2881ae['id'],'type':_0x10d4d3[_0x0075('0x2c')],'sectionId':_0x10d4d3['id']},{})[_0x0075('0x24')](function(){return _0x28564d;});}else{return _0x28564d;}})[_0x0075('0x46')](function(_0x231ff3){logger[_0x0075('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x231ff3);throw _0x231ff3;});}return _0x28564d;})[_0x0075('0x24')](respondWithResult(_0x200e45,0xc9))[_0x0075('0x46')](handleError(_0x200e45,null));};exports['update']=function(_0x1b325c,_0x333f66){if(_0x1b325c[_0x0075('0x4c')]['id']){delete _0x1b325c[_0x0075('0x4c')]['id'];}return db[_0x0075('0x30')][_0x0075('0x4a')]({'where':{'id':_0x1b325c[_0x0075('0x48')]['id']}})[_0x0075('0x24')](handleEntityNotFound(_0x333f66,null))[_0x0075('0x24')](saveUpdates(_0x1b325c[_0x0075('0x4c')],null))[_0x0075('0x24')](respondWithResult(_0x333f66,null))[_0x0075('0x46')](handleError(_0x333f66,null));};exports[_0x0075('0x25')]=function(_0x455e5a,_0x4cc7e7){return db[_0x0075('0x30')]['find']({'where':{'id':_0x455e5a[_0x0075('0x48')]['id']}})[_0x0075('0x24')](handleEntityNotFound(_0x4cc7e7,null))[_0x0075('0x24')](removeEntity(_0x4cc7e7,null))['catch'](handleError(_0x4cc7e7,null));};exports[_0x0075('0x50')]=function(_0xb3ce0,_0x6fb952,_0x11bbdf){if(_0xb3ce0[_0x0075('0x4c')]['id']){delete _0xb3ce0[_0x0075('0x4c')]['id'];}return db[_0x0075('0x30')][_0x0075('0x4a')]({'where':{'id':_0xb3ce0['params']['id']}})[_0x0075('0x24')](handleEntityNotFound(_0x6fb952,null))[_0x0075('0x24')](function(_0x109b81){if(_0x109b81){_0xb3ce0[_0x0075('0x4c')][_0x0075('0x51')]=_0x109b81['id'];return db['Condition'][_0x0075('0x4b')](_0xb3ce0[_0x0075('0x4c')]);}})[_0x0075('0x24')](respondWithResult(_0x6fb952,null))[_0x0075('0x46')](handleError(_0x6fb952,null));};exports['addAnyCondition']=function(_0x441c58,_0x14850b,_0xe0ad30){if(_0x441c58[_0x0075('0x4c')]['id']){delete _0x441c58[_0x0075('0x4c')]['id'];}return db[_0x0075('0x30')][_0x0075('0x4a')]({'where':{'id':_0x441c58['params']['id']}})[_0x0075('0x24')](handleEntityNotFound(_0x14850b,null))['then'](function(_0x2fe36d){if(_0x2fe36d){_0x441c58['body'][_0x0075('0x52')]=_0x2fe36d['id'];return db[_0x0075('0x53')]['create'](_0x441c58[_0x0075('0x4c')]);}})['then'](respondWithResult(_0x14850b,null))[_0x0075('0x46')](handleError(_0x14850b,null));};exports[_0x0075('0x54')]=function(_0x52eab9,_0x5c85f5,_0x12c389){var _0x125fce={};var _0x290d7c={};var _0x44b3ea;var _0x5dff6e;return db[_0x0075('0x30')][_0x0075('0x55')]({'where':{'id':_0x52eab9['params']['id']}})[_0x0075('0x24')](handleEntityNotFound(_0x5c85f5,null))[_0x0075('0x24')](function(_0x528749){if(_0x528749){_0x44b3ea=_0x528749;_0x290d7c[_0x0075('0x32')]=_[_0x0075('0x34')](db['Condition'][_0x0075('0x49')]);_0x290d7c[_0x0075('0x33')]=_[_0x0075('0x34')](_0x52eab9[_0x0075('0x33')]);_0x290d7c[_0x0075('0x3c')]=_[_0x0075('0x35')](_0x290d7c[_0x0075('0x32')],_0x290d7c[_0x0075('0x33')]);_0x125fce[_0x0075('0x36')]=_['intersection'](_0x290d7c[_0x0075('0x32')],qs[_0x0075('0x37')](_0x52eab9[_0x0075('0x33')]['fields']));_0x125fce[_0x0075('0x36')]=_0x125fce[_0x0075('0x36')]['length']?_0x125fce[_0x0075('0x36')]:_0x290d7c[_0x0075('0x32')];_0x125fce[_0x0075('0x56')]=qs['sort'](_0x52eab9[_0x0075('0x33')][_0x0075('0x57')]);_0x125fce[_0x0075('0x3b')]=qs['filters'](_[_0x0075('0x3d')](_0x52eab9[_0x0075('0x33')],_0x290d7c['filters']));if(_0x52eab9['query'][_0x0075('0x3e')]){_0x125fce[_0x0075('0x3b')]=_[_0x0075('0x3f')](_0x125fce[_0x0075('0x3b')],{'$or':_[_0x0075('0x2f')](_0x125fce['attributes'],function(_0x383f3c){var _0x4b4ad4={};_0x4b4ad4[_0x383f3c]={'$like':'%'+_0x52eab9[_0x0075('0x33')][_0x0075('0x3e')]+'%'};return _0x4b4ad4;})});}_0x125fce=_[_0x0075('0x3f')]({},_0x125fce,_0x52eab9['options']);return _0x44b3ea[_0x0075('0x54')](_0x125fce);}})[_0x0075('0x24')](function(_0x2fad4c){if(_0x2fad4c){_0x5dff6e=_0x2fad4c[_0x0075('0x38')];if(!_0x52eab9[_0x0075('0x33')][_0x0075('0x39')](_0x0075('0x3a'))){_0x125fce[_0x0075('0x1b')]=qs['limit'](_0x52eab9[_0x0075('0x33')]['limit']);_0x125fce[_0x0075('0x1d')]=qs[_0x0075('0x1d')](_0x52eab9[_0x0075('0x33')]['offset']);}return _0x44b3ea[_0x0075('0x54')](_0x125fce);}})[_0x0075('0x24')](function(_0x23650f){if(_0x23650f){return _0x23650f?{'count':_0x5dff6e,'rows':_0x23650f}:null;}})[_0x0075('0x24')](respondWithResult(_0x5c85f5,null))[_0x0075('0x46')](handleError(_0x5c85f5,null));};exports[_0x0075('0x58')]=function(_0x1dc9b6,_0x48f4ac,_0x4ab033){var _0x18358b={};var _0x54e713={};var _0x2cddb8;var _0x26ef01;return db[_0x0075('0x30')][_0x0075('0x55')]({'where':{'id':_0x1dc9b6[_0x0075('0x48')]['id']}})[_0x0075('0x24')](handleEntityNotFound(_0x48f4ac,null))[_0x0075('0x24')](function(_0x478fb0){if(_0x478fb0){_0x2cddb8=_0x478fb0;_0x54e713['model']=_['keys'](db[_0x0075('0x53')][_0x0075('0x49')]);_0x54e713[_0x0075('0x33')]=_[_0x0075('0x34')](_0x1dc9b6[_0x0075('0x33')]);_0x54e713[_0x0075('0x3c')]=_[_0x0075('0x35')](_0x54e713[_0x0075('0x32')],_0x54e713[_0x0075('0x33')]);_0x18358b[_0x0075('0x36')]=_[_0x0075('0x35')](_0x54e713[_0x0075('0x32')],qs[_0x0075('0x37')](_0x1dc9b6[_0x0075('0x33')][_0x0075('0x37')]));_0x18358b['attributes']=_0x18358b[_0x0075('0x36')][_0x0075('0x38')]?_0x18358b['attributes']:_0x54e713['model'];_0x18358b[_0x0075('0x56')]=qs[_0x0075('0x57')](_0x1dc9b6[_0x0075('0x33')][_0x0075('0x57')]);_0x18358b['where']=qs['filters'](_['pick'](_0x1dc9b6[_0x0075('0x33')],_0x54e713['filters']));if(_0x1dc9b6['query'][_0x0075('0x3e')]){_0x18358b[_0x0075('0x3b')]=_[_0x0075('0x3f')](_0x18358b[_0x0075('0x3b')],{'$or':_[_0x0075('0x2f')](_0x18358b[_0x0075('0x36')],function(_0x119784){var _0x98e120={};_0x98e120[_0x119784]={'$like':'%'+_0x1dc9b6[_0x0075('0x33')]['filter']+'%'};return _0x98e120;})});}_0x18358b=_[_0x0075('0x3f')]({},_0x18358b,_0x1dc9b6[_0x0075('0x41')]);return _0x2cddb8['getAnyConditions'](_0x18358b);}})[_0x0075('0x24')](function(_0x57e1a5){if(_0x57e1a5){_0x26ef01=_0x57e1a5['length'];if(!_0x1dc9b6[_0x0075('0x33')][_0x0075('0x39')](_0x0075('0x3a'))){_0x18358b[_0x0075('0x1b')]=qs[_0x0075('0x1b')](_0x1dc9b6['query'][_0x0075('0x1b')]);_0x18358b[_0x0075('0x1d')]=qs[_0x0075('0x1d')](_0x1dc9b6[_0x0075('0x33')]['offset']);}return _0x2cddb8['getAnyConditions'](_0x18358b);}})[_0x0075('0x24')](function(_0x404c7c){if(_0x404c7c){return _0x404c7c?{'count':_0x26ef01,'rows':_0x404c7c}:null;}})['then'](respondWithResult(_0x48f4ac,null))[_0x0075('0x46')](handleError(_0x48f4ac,null));};exports[_0x0075('0x59')]=function(_0x2355d4,_0x5f4b87,_0x213416){if(_0x2355d4[_0x0075('0x4c')]['id']){delete _0x2355d4[_0x0075('0x4c')]['id'];}return db[_0x0075('0x30')][_0x0075('0x4a')]({'where':{'id':_0x2355d4[_0x0075('0x48')]['id']}})[_0x0075('0x24')](handleEntityNotFound(_0x5f4b87,null))[_0x0075('0x24')](function(_0x3943e4){if(_0x3943e4){_0x2355d4[_0x0075('0x4c')]['TriggerId']=_0x3943e4['id'];return db['Action']['create'](_0x2355d4[_0x0075('0x4c')]);}})[_0x0075('0x24')](respondWithResult(_0x5f4b87,null))[_0x0075('0x46')](handleError(_0x5f4b87,null));};exports[_0x0075('0x5a')]=function(_0x463a9b,_0x169a10,_0x501b0e){var _0x48acd7={};var _0x2915b5={};var _0x3b8025;var _0x4de09b;return db[_0x0075('0x30')][_0x0075('0x55')]({'where':{'id':_0x463a9b[_0x0075('0x48')]['id']}})['then'](handleEntityNotFound(_0x169a10,null))[_0x0075('0x24')](function(_0x5c572d){if(_0x5c572d){_0x3b8025=_0x5c572d;_0x2915b5[_0x0075('0x32')]=_[_0x0075('0x34')](db[_0x0075('0x5b')]['rawAttributes']);_0x2915b5[_0x0075('0x33')]=_[_0x0075('0x34')](_0x463a9b[_0x0075('0x33')]);_0x2915b5[_0x0075('0x3c')]=_[_0x0075('0x35')](_0x2915b5[_0x0075('0x32')],_0x2915b5[_0x0075('0x33')]);_0x48acd7['attributes']=_['intersection'](_0x2915b5[_0x0075('0x32')],qs[_0x0075('0x37')](_0x463a9b[_0x0075('0x33')][_0x0075('0x37')]));_0x48acd7[_0x0075('0x36')]=_0x48acd7[_0x0075('0x36')]['length']?_0x48acd7[_0x0075('0x36')]:_0x2915b5['model'];_0x48acd7['order']=qs['sort'](_0x463a9b[_0x0075('0x33')][_0x0075('0x57')]);_0x48acd7['where']=qs['filters'](_[_0x0075('0x3d')](_0x463a9b[_0x0075('0x33')],_0x2915b5[_0x0075('0x3c')]));if(_0x463a9b[_0x0075('0x33')][_0x0075('0x3e')]){_0x48acd7['where']=_[_0x0075('0x3f')](_0x48acd7[_0x0075('0x3b')],{'$or':_['map'](_0x48acd7[_0x0075('0x36')],function(_0x4ae8ba){var _0x2743ce={};_0x2743ce[_0x4ae8ba]={'$like':'%'+_0x463a9b[_0x0075('0x33')][_0x0075('0x3e')]+'%'};return _0x2743ce;})});}_0x48acd7=_[_0x0075('0x3f')]({},_0x48acd7,_0x463a9b[_0x0075('0x41')]);return _0x3b8025[_0x0075('0x5a')](_0x48acd7);}})[_0x0075('0x24')](function(_0x15e05a){if(_0x15e05a){_0x4de09b=_0x15e05a[_0x0075('0x38')];if(!_0x463a9b[_0x0075('0x33')][_0x0075('0x39')](_0x0075('0x3a'))){_0x48acd7['limit']=qs['limit'](_0x463a9b[_0x0075('0x33')][_0x0075('0x1b')]);_0x48acd7[_0x0075('0x1d')]=qs[_0x0075('0x1d')](_0x463a9b['query']['offset']);}return _0x3b8025['getActions'](_0x48acd7);}})[_0x0075('0x24')](function(_0xa3b1){if(_0xa3b1){return _0xa3b1?{'count':_0x4de09b,'rows':_0xa3b1}:null;}})[_0x0075('0x24')](respondWithResult(_0x169a10,null))[_0x0075('0x46')](handleError(_0x169a10,null));}; \ No newline at end of file +var _0x81bc=['show','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','params','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','offset','count','apply','reject','update','destroy','get','Triggers','UserProfileResource','then','status','error','stack','name','send','index','map','Trigger','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch'];(function(_0x514ef1,_0x5d5cb1){var _0x3f5790=function(_0x12f7f4){while(--_0x12f7f4){_0x514ef1['push'](_0x514ef1['shift']());}};_0x3f5790(++_0x5d5cb1);}(_0x81bc,0xc8));var _0xc81b=function(_0x122fe6,_0x4ac758){_0x122fe6=_0x122fe6-0x0;var _0x36b7d2=_0x81bc[_0x122fe6];return _0x36b7d2;};'use strict';var emlformat=require(_0xc81b('0x0'));var rimraf=require(_0xc81b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc81b('0x2'));var moment=require(_0xc81b('0x3'));var BPromise=require(_0xc81b('0x4'));var Mustache=require(_0xc81b('0x5'));var util=require(_0xc81b('0x6'));var path=require(_0xc81b('0x7'));var sox=require(_0xc81b('0x8'));var csv=require(_0xc81b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc81b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc81b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc81b('0x9'));var querystring=require('querystring');var Papa=require(_0xc81b('0xc'));var Redis=require(_0xc81b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc81b('0xe'));var as=require(_0xc81b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc81b('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xc81b('0x11'));var licenseUtil=require(_0xc81b('0x12'));var db=require(_0xc81b('0x13'))['db'];function respondWithStatusCode(_0xdc7d8f,_0x4302cc){_0x4302cc=_0x4302cc||0xcc;return function(_0x2745e0){if(_0x2745e0){return _0xdc7d8f[_0xc81b('0x14')](_0x4302cc);}return _0xdc7d8f['status'](_0x4302cc)[_0xc81b('0x15')]();};}function respondWithResult(_0x3e68e6,_0x544b87){_0x544b87=_0x544b87||0xc8;return function(_0x43c3ff){if(_0x43c3ff){return _0x3e68e6['status'](_0x544b87)[_0xc81b('0x16')](_0x43c3ff);}};}function respondWithFilteredResult(_0x3af0c0,_0x1f7542){return function(_0x406f91){if(_0x406f91){var _0x42c23d=typeof _0x1f7542['offset']==='undefined'&&typeof _0x1f7542[_0xc81b('0x17')]===_0xc81b('0x18');var _0x233527=_0x406f91['count'];var _0x246342=_0x42c23d?0x0:_0x1f7542[_0xc81b('0x19')];var _0x1b5b8c=_0x42c23d?_0x406f91[_0xc81b('0x1a')]:_0x1f7542[_0xc81b('0x19')]+_0x1f7542['limit'];var _0x36a60c;if(_0x1b5b8c>=_0x233527){_0x1b5b8c=_0x233527;_0x36a60c=0xc8;}else{_0x36a60c=0xce;}_0x3af0c0['status'](_0x36a60c);return _0x3af0c0['set']('Content-Range',_0x246342+'-'+_0x1b5b8c+'/'+_0x233527)[_0xc81b('0x16')](_0x406f91);}return null;};}function patchUpdates(_0x519e2b){return function(_0x9ffff7){try{jsonpatch[_0xc81b('0x1b')](_0x9ffff7,_0x519e2b,!![]);}catch(_0x847aa5){return BPromise[_0xc81b('0x1c')](_0x847aa5);}return _0x9ffff7['save']();};}function saveUpdates(_0x56b336,_0x2a7b69){return function(_0x40649b){if(_0x40649b){return _0x40649b[_0xc81b('0x1d')](_0x56b336)['then'](function(_0x2b2869){return _0x2b2869;});}return null;};}function removeEntity(_0x4c1a1c,_0x18021f){return function(_0x16a453){if(_0x16a453){return _0x16a453[_0xc81b('0x1e')]()['then'](function(){var _0x588869=_0x16a453[_0xc81b('0x1f')]({'plain':!![]});var _0xf6e286=_0xc81b('0x20');return db[_0xc81b('0x21')]['destroy']({'where':{'type':_0xf6e286,'resourceId':_0x588869['id']}})[_0xc81b('0x22')](function(){return _0x16a453;});})[_0xc81b('0x22')](function(){_0x4c1a1c[_0xc81b('0x23')](0xcc)[_0xc81b('0x15')]();});}};}function handleEntityNotFound(_0x47a272,_0x456819){return function(_0x366b87){if(!_0x366b87){_0x47a272['sendStatus'](0x194);}return _0x366b87;};}function handleError(_0x294d3b,_0x4d6a17){_0x4d6a17=_0x4d6a17||0x1f4;return function(_0x73283a){logger[_0xc81b('0x24')](_0x73283a[_0xc81b('0x25')]);if(_0x73283a[_0xc81b('0x26')]){delete _0x73283a[_0xc81b('0x26')];}_0x294d3b[_0xc81b('0x23')](_0x4d6a17)[_0xc81b('0x27')](_0x73283a);};}exports[_0xc81b('0x28')]=function(_0x2aa5f2,_0x1edb92){var _0x15a3a7={},_0x1af30f={},_0x100d68={'count':0x0,'rows':[]};var _0xbb4de6=_[_0xc81b('0x29')](db[_0xc81b('0x2a')]['rawAttributes'],function(_0x2c4a01){return{'name':_0x2c4a01[_0xc81b('0x2b')],'type':_0x2c4a01[_0xc81b('0x2c')]['key']};});_0x1af30f[_0xc81b('0x2d')]=_[_0xc81b('0x29')](_0xbb4de6,_0xc81b('0x26'));_0x1af30f[_0xc81b('0x2e')]=_[_0xc81b('0x2f')](_0x2aa5f2[_0xc81b('0x2e')]);_0x1af30f['filters']=_[_0xc81b('0x30')](_0x1af30f[_0xc81b('0x2d')],_0x1af30f['query']);_0x15a3a7[_0xc81b('0x31')]=_[_0xc81b('0x30')](_0x1af30f[_0xc81b('0x2d')],qs[_0xc81b('0x32')](_0x2aa5f2[_0xc81b('0x2e')][_0xc81b('0x32')]));_0x15a3a7[_0xc81b('0x31')]=_0x15a3a7[_0xc81b('0x31')][_0xc81b('0x33')]?_0x15a3a7[_0xc81b('0x31')]:_0x1af30f[_0xc81b('0x2d')];if(!_0x2aa5f2[_0xc81b('0x2e')][_0xc81b('0x34')](_0xc81b('0x35'))){_0x15a3a7[_0xc81b('0x17')]=qs[_0xc81b('0x17')](_0x2aa5f2[_0xc81b('0x2e')][_0xc81b('0x17')]);_0x15a3a7[_0xc81b('0x19')]=qs[_0xc81b('0x19')](_0x2aa5f2[_0xc81b('0x2e')][_0xc81b('0x19')]);}_0x15a3a7[_0xc81b('0x36')]=qs[_0xc81b('0x37')](_0x2aa5f2[_0xc81b('0x2e')]['sort']);_0x15a3a7[_0xc81b('0x38')]=qs[_0xc81b('0x39')](_[_0xc81b('0x3a')](_0x2aa5f2['query'],_0x1af30f[_0xc81b('0x39')]),_0xbb4de6);if(_0x2aa5f2[_0xc81b('0x2e')][_0xc81b('0x3b')]){_0x15a3a7[_0xc81b('0x38')]=_['merge'](_0x15a3a7[_0xc81b('0x38')],{'$or':_[_0xc81b('0x29')](_0xbb4de6,function(_0x326339){if(_0x326339[_0xc81b('0x2c')]!==_0xc81b('0x3c')){var _0x278451={};_0x278451[_0x326339[_0xc81b('0x26')]]={'$like':'%'+_0x2aa5f2[_0xc81b('0x2e')]['filter']+'%'};return _0x278451;}})});}_0x15a3a7=_[_0xc81b('0x3d')]({},_0x15a3a7,_0x2aa5f2[_0xc81b('0x3e')]);var _0x45d82f={'where':_0x15a3a7[_0xc81b('0x38')]};return db[_0xc81b('0x2a')][_0xc81b('0x1a')](_0x45d82f)[_0xc81b('0x22')](function(_0x4b5341){_0x100d68[_0xc81b('0x1a')]=_0x4b5341;if(_0x2aa5f2[_0xc81b('0x2e')][_0xc81b('0x3f')]){_0x15a3a7[_0xc81b('0x40')]=[{'all':!![]}];}return db[_0xc81b('0x2a')][_0xc81b('0x41')](_0x15a3a7);})[_0xc81b('0x22')](function(_0x443d76){_0x100d68['rows']=_0x443d76;return _0x100d68;})[_0xc81b('0x22')](respondWithFilteredResult(_0x1edb92,_0x15a3a7))[_0xc81b('0x42')](handleError(_0x1edb92,null));};exports[_0xc81b('0x43')]=function(_0x5c4591,_0x3a5484){var _0x10e970={'raw':![],'where':{'id':_0x5c4591['params']['id']}},_0x364040={};_0x364040['model']=_[_0xc81b('0x2f')](db['Trigger'][_0xc81b('0x44')]);_0x364040[_0xc81b('0x2e')]=_[_0xc81b('0x2f')](_0x5c4591['query']);_0x364040['filters']=_[_0xc81b('0x30')](_0x364040['model'],_0x364040[_0xc81b('0x2e')]);_0x10e970[_0xc81b('0x31')]=_['intersection'](_0x364040[_0xc81b('0x2d')],qs[_0xc81b('0x32')](_0x5c4591[_0xc81b('0x2e')]['fields']));_0x10e970[_0xc81b('0x31')]=_0x10e970['attributes'][_0xc81b('0x33')]?_0x10e970[_0xc81b('0x31')]:_0x364040[_0xc81b('0x2d')];if(_0x5c4591['query'][_0xc81b('0x3f')]){_0x10e970['include']=[{'all':!![]}];}_0x10e970=_['merge']({},_0x10e970,_0x5c4591[_0xc81b('0x3e')]);return db[_0xc81b('0x2a')]['find'](_0x10e970)[_0xc81b('0x22')](handleEntityNotFound(_0x3a5484,null))['then'](respondWithResult(_0x3a5484,null))[_0xc81b('0x42')](handleError(_0x3a5484,null));};exports[_0xc81b('0x45')]=function(_0x1aaec0,_0x2f9b04){return db[_0xc81b('0x2a')][_0xc81b('0x45')](_0x1aaec0[_0xc81b('0x46')],{})[_0xc81b('0x22')](function(_0x213754){var _0x3f9659=_0x1aaec0[_0xc81b('0x47')][_0xc81b('0x1f')]({'plain':!![]});if(!_0x3f9659)throw new Error(_0xc81b('0x48'));if(_0x3f9659[_0xc81b('0x49')]===_0xc81b('0x47')){var _0x2e1326=_0x213754[_0xc81b('0x1f')]({'plain':!![]});var _0x9465d5=_0xc81b('0x20');return db[_0xc81b('0x4a')][_0xc81b('0x4b')]({'where':{'name':_0x9465d5,'userProfileId':_0x3f9659[_0xc81b('0x4c')]},'raw':!![]})[_0xc81b('0x22')](function(_0x4c4b68){if(_0x4c4b68&&_0x4c4b68['autoAssociation']===0x0){return db[_0xc81b('0x21')][_0xc81b('0x45')]({'name':_0x2e1326[_0xc81b('0x26')],'resourceId':_0x2e1326['id'],'type':_0x4c4b68[_0xc81b('0x26')],'sectionId':_0x4c4b68['id']},{})['then'](function(){return _0x213754;});}else{return _0x213754;}})[_0xc81b('0x42')](function(_0x8727f5){logger[_0xc81b('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8727f5);throw _0x8727f5;});}return _0x213754;})[_0xc81b('0x22')](respondWithResult(_0x2f9b04,0xc9))[_0xc81b('0x42')](handleError(_0x2f9b04,null));};exports[_0xc81b('0x1d')]=function(_0x3bf6ba,_0x32f1c0){if(_0x3bf6ba[_0xc81b('0x46')]['id']){delete _0x3bf6ba[_0xc81b('0x46')]['id'];}return db[_0xc81b('0x2a')]['find']({'where':{'id':_0x3bf6ba[_0xc81b('0x4d')]['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0x32f1c0,null))[_0xc81b('0x22')](saveUpdates(_0x3bf6ba['body'],null))[_0xc81b('0x22')](respondWithResult(_0x32f1c0,null))[_0xc81b('0x42')](handleError(_0x32f1c0,null));};exports[_0xc81b('0x1e')]=function(_0x48d50d,_0x33b701){return db[_0xc81b('0x2a')]['find']({'where':{'id':_0x48d50d['params']['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0x33b701,null))[_0xc81b('0x22')](removeEntity(_0x33b701,null))[_0xc81b('0x42')](handleError(_0x33b701,null));};exports['addAllCondition']=function(_0x3f0417,_0x28603f,_0x10f365){if(_0x3f0417['body']['id']){delete _0x3f0417['body']['id'];}return db[_0xc81b('0x2a')][_0xc81b('0x4b')]({'where':{'id':_0x3f0417[_0xc81b('0x4d')]['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0x28603f,null))['then'](function(_0x4fd747){if(_0x4fd747){_0x3f0417[_0xc81b('0x46')][_0xc81b('0x4e')]=_0x4fd747['id'];return db[_0xc81b('0x4f')][_0xc81b('0x45')](_0x3f0417[_0xc81b('0x46')]);}})['then'](respondWithResult(_0x28603f,null))[_0xc81b('0x42')](handleError(_0x28603f,null));};exports[_0xc81b('0x50')]=function(_0x3be88c,_0x4ebf0c,_0x340ba9){if(_0x3be88c[_0xc81b('0x46')]['id']){delete _0x3be88c[_0xc81b('0x46')]['id'];}return db[_0xc81b('0x2a')]['find']({'where':{'id':_0x3be88c[_0xc81b('0x4d')]['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0x4ebf0c,null))['then'](function(_0x382e42){if(_0x382e42){_0x3be88c[_0xc81b('0x46')][_0xc81b('0x51')]=_0x382e42['id'];return db['Condition'][_0xc81b('0x45')](_0x3be88c['body']);}})[_0xc81b('0x22')](respondWithResult(_0x4ebf0c,null))[_0xc81b('0x42')](handleError(_0x4ebf0c,null));};exports[_0xc81b('0x52')]=function(_0x58bc8c,_0x28acc1,_0x4a1bef){var _0x498e63={};var _0x2305f4={};var _0x3f18fd;var _0x4a5b4b;return db[_0xc81b('0x2a')][_0xc81b('0x53')]({'where':{'id':_0x58bc8c[_0xc81b('0x4d')]['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0x28acc1,null))['then'](function(_0x5e9fd7){if(_0x5e9fd7){_0x3f18fd=_0x5e9fd7;_0x2305f4[_0xc81b('0x2d')]=_[_0xc81b('0x2f')](db[_0xc81b('0x4f')][_0xc81b('0x44')]);_0x2305f4[_0xc81b('0x2e')]=_[_0xc81b('0x2f')](_0x58bc8c[_0xc81b('0x2e')]);_0x2305f4['filters']=_[_0xc81b('0x30')](_0x2305f4[_0xc81b('0x2d')],_0x2305f4[_0xc81b('0x2e')]);_0x498e63['attributes']=_[_0xc81b('0x30')](_0x2305f4[_0xc81b('0x2d')],qs['fields'](_0x58bc8c[_0xc81b('0x2e')][_0xc81b('0x32')]));_0x498e63[_0xc81b('0x31')]=_0x498e63['attributes'][_0xc81b('0x33')]?_0x498e63['attributes']:_0x2305f4[_0xc81b('0x2d')];_0x498e63[_0xc81b('0x36')]=qs[_0xc81b('0x37')](_0x58bc8c[_0xc81b('0x2e')][_0xc81b('0x37')]);_0x498e63['where']=qs[_0xc81b('0x39')](_[_0xc81b('0x3a')](_0x58bc8c[_0xc81b('0x2e')],_0x2305f4['filters']));if(_0x58bc8c[_0xc81b('0x2e')][_0xc81b('0x3b')]){_0x498e63[_0xc81b('0x38')]=_[_0xc81b('0x3d')](_0x498e63[_0xc81b('0x38')],{'$or':_[_0xc81b('0x29')](_0x498e63[_0xc81b('0x31')],function(_0x348d3c){var _0x52592d={};_0x52592d[_0x348d3c]={'$like':'%'+_0x58bc8c[_0xc81b('0x2e')][_0xc81b('0x3b')]+'%'};return _0x52592d;})});}_0x498e63=_[_0xc81b('0x3d')]({},_0x498e63,_0x58bc8c[_0xc81b('0x3e')]);return _0x3f18fd[_0xc81b('0x52')](_0x498e63);}})[_0xc81b('0x22')](function(_0x33c151){if(_0x33c151){_0x4a5b4b=_0x33c151['length'];if(!_0x58bc8c[_0xc81b('0x2e')][_0xc81b('0x34')]('nolimit')){_0x498e63[_0xc81b('0x17')]=qs['limit'](_0x58bc8c[_0xc81b('0x2e')][_0xc81b('0x17')]);_0x498e63['offset']=qs[_0xc81b('0x19')](_0x58bc8c[_0xc81b('0x2e')][_0xc81b('0x19')]);}return _0x3f18fd[_0xc81b('0x52')](_0x498e63);}})[_0xc81b('0x22')](function(_0x1cfbd1){if(_0x1cfbd1){return _0x1cfbd1?{'count':_0x4a5b4b,'rows':_0x1cfbd1}:null;}})['then'](respondWithResult(_0x28acc1,null))[_0xc81b('0x42')](handleError(_0x28acc1,null));};exports[_0xc81b('0x54')]=function(_0xa31287,_0xe766be,_0x2b5765){var _0xf89607={};var _0x2c4eaf={};var _0x145ae6;var _0x46e6b1;return db[_0xc81b('0x2a')][_0xc81b('0x53')]({'where':{'id':_0xa31287['params']['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0xe766be,null))['then'](function(_0x18f809){if(_0x18f809){_0x145ae6=_0x18f809;_0x2c4eaf[_0xc81b('0x2d')]=_[_0xc81b('0x2f')](db[_0xc81b('0x4f')][_0xc81b('0x44')]);_0x2c4eaf[_0xc81b('0x2e')]=_[_0xc81b('0x2f')](_0xa31287[_0xc81b('0x2e')]);_0x2c4eaf['filters']=_[_0xc81b('0x30')](_0x2c4eaf[_0xc81b('0x2d')],_0x2c4eaf['query']);_0xf89607[_0xc81b('0x31')]=_['intersection'](_0x2c4eaf[_0xc81b('0x2d')],qs['fields'](_0xa31287['query'][_0xc81b('0x32')]));_0xf89607[_0xc81b('0x31')]=_0xf89607[_0xc81b('0x31')][_0xc81b('0x33')]?_0xf89607['attributes']:_0x2c4eaf[_0xc81b('0x2d')];_0xf89607[_0xc81b('0x36')]=qs[_0xc81b('0x37')](_0xa31287[_0xc81b('0x2e')][_0xc81b('0x37')]);_0xf89607[_0xc81b('0x38')]=qs[_0xc81b('0x39')](_['pick'](_0xa31287[_0xc81b('0x2e')],_0x2c4eaf[_0xc81b('0x39')]));if(_0xa31287[_0xc81b('0x2e')][_0xc81b('0x3b')]){_0xf89607[_0xc81b('0x38')]=_[_0xc81b('0x3d')](_0xf89607[_0xc81b('0x38')],{'$or':_[_0xc81b('0x29')](_0xf89607[_0xc81b('0x31')],function(_0x41c8e3){var _0x378cb2={};_0x378cb2[_0x41c8e3]={'$like':'%'+_0xa31287[_0xc81b('0x2e')]['filter']+'%'};return _0x378cb2;})});}_0xf89607=_[_0xc81b('0x3d')]({},_0xf89607,_0xa31287[_0xc81b('0x3e')]);return _0x145ae6[_0xc81b('0x54')](_0xf89607);}})[_0xc81b('0x22')](function(_0xd40e44){if(_0xd40e44){_0x46e6b1=_0xd40e44[_0xc81b('0x33')];if(!_0xa31287[_0xc81b('0x2e')][_0xc81b('0x34')](_0xc81b('0x35'))){_0xf89607[_0xc81b('0x17')]=qs[_0xc81b('0x17')](_0xa31287[_0xc81b('0x2e')][_0xc81b('0x17')]);_0xf89607[_0xc81b('0x19')]=qs[_0xc81b('0x19')](_0xa31287[_0xc81b('0x2e')][_0xc81b('0x19')]);}return _0x145ae6['getAnyConditions'](_0xf89607);}})[_0xc81b('0x22')](function(_0x5c8cd2){if(_0x5c8cd2){return _0x5c8cd2?{'count':_0x46e6b1,'rows':_0x5c8cd2}:null;}})[_0xc81b('0x22')](respondWithResult(_0xe766be,null))[_0xc81b('0x42')](handleError(_0xe766be,null));};exports[_0xc81b('0x55')]=function(_0x14aa95,_0x312f9f,_0x221742){if(_0x14aa95[_0xc81b('0x46')]['id']){delete _0x14aa95[_0xc81b('0x46')]['id'];}return db[_0xc81b('0x2a')]['find']({'where':{'id':_0x14aa95['params']['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0x312f9f,null))[_0xc81b('0x22')](function(_0x15fde0){if(_0x15fde0){_0x14aa95[_0xc81b('0x46')][_0xc81b('0x56')]=_0x15fde0['id'];return db[_0xc81b('0x57')]['create'](_0x14aa95[_0xc81b('0x46')]);}})[_0xc81b('0x22')](respondWithResult(_0x312f9f,null))[_0xc81b('0x42')](handleError(_0x312f9f,null));};exports['getActions']=function(_0x437b43,_0x432f53,_0x43a8f1){var _0x5e6db7={};var _0x2982ed={};var _0xc97b0d;var _0x2ef92c;return db[_0xc81b('0x2a')]['findOne']({'where':{'id':_0x437b43['params']['id']}})[_0xc81b('0x22')](handleEntityNotFound(_0x432f53,null))['then'](function(_0x48f914){if(_0x48f914){_0xc97b0d=_0x48f914;_0x2982ed['model']=_['keys'](db[_0xc81b('0x57')]['rawAttributes']);_0x2982ed[_0xc81b('0x2e')]=_[_0xc81b('0x2f')](_0x437b43[_0xc81b('0x2e')]);_0x2982ed[_0xc81b('0x39')]=_[_0xc81b('0x30')](_0x2982ed[_0xc81b('0x2d')],_0x2982ed['query']);_0x5e6db7[_0xc81b('0x31')]=_['intersection'](_0x2982ed[_0xc81b('0x2d')],qs[_0xc81b('0x32')](_0x437b43[_0xc81b('0x2e')][_0xc81b('0x32')]));_0x5e6db7[_0xc81b('0x31')]=_0x5e6db7[_0xc81b('0x31')][_0xc81b('0x33')]?_0x5e6db7[_0xc81b('0x31')]:_0x2982ed[_0xc81b('0x2d')];_0x5e6db7[_0xc81b('0x36')]=qs['sort'](_0x437b43[_0xc81b('0x2e')][_0xc81b('0x37')]);_0x5e6db7[_0xc81b('0x38')]=qs['filters'](_['pick'](_0x437b43[_0xc81b('0x2e')],_0x2982ed['filters']));if(_0x437b43[_0xc81b('0x2e')][_0xc81b('0x3b')]){_0x5e6db7[_0xc81b('0x38')]=_[_0xc81b('0x3d')](_0x5e6db7[_0xc81b('0x38')],{'$or':_[_0xc81b('0x29')](_0x5e6db7[_0xc81b('0x31')],function(_0x432f3f){var _0x31c2ba={};_0x31c2ba[_0x432f3f]={'$like':'%'+_0x437b43[_0xc81b('0x2e')][_0xc81b('0x3b')]+'%'};return _0x31c2ba;})});}_0x5e6db7=_[_0xc81b('0x3d')]({},_0x5e6db7,_0x437b43['options']);return _0xc97b0d[_0xc81b('0x58')](_0x5e6db7);}})[_0xc81b('0x22')](function(_0x4ffde3){if(_0x4ffde3){_0x2ef92c=_0x4ffde3[_0xc81b('0x33')];if(!_0x437b43['query'][_0xc81b('0x34')](_0xc81b('0x35'))){_0x5e6db7[_0xc81b('0x17')]=qs[_0xc81b('0x17')](_0x437b43[_0xc81b('0x2e')][_0xc81b('0x17')]);_0x5e6db7[_0xc81b('0x19')]=qs['offset'](_0x437b43['query'][_0xc81b('0x19')]);}return _0xc97b0d['getActions'](_0x5e6db7);}})[_0xc81b('0x22')](function(_0x3a14b1){if(_0x3a14b1){return _0x3a14b1?{'count':_0x2ef92c,'rows':_0x3a14b1}:null;}})[_0xc81b('0x22')](respondWithResult(_0x432f53,null))[_0xc81b('0x42')](handleError(_0x432f53,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 9ef4cb3..15f06d4 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 _0xb6f1=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./trigger.attributes','exports','Trigger','tools_triggers'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xb6f1,0x118));var _0x1b6f=function(_0x7729b1,_0x468322){_0x7729b1=_0x7729b1-0x0;var _0x349504=_0xb6f1[_0x7729b1];return _0x349504;};'use strict';var _=require(_0x1b6f('0x0'));var util=require('util');var logger=require(_0x1b6f('0x1'))('api');var moment=require(_0x1b6f('0x2'));var BPromise=require(_0x1b6f('0x3'));var rp=require(_0x1b6f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1b6f('0x5'));var config=require('../../config/environment');var attributes=require(_0x1b6f('0x6'));module[_0x1b6f('0x7')]=function(_0xd4703b,_0x493c91){return _0xd4703b['define'](_0x1b6f('0x8'),attributes,{'tableName':_0x1b6f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc997=['bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports','define','tools_triggers','util','../../config/logger','api','moment'];(function(_0xe62262,_0x14f742){var _0x18b029=function(_0xd87ac1){while(--_0xd87ac1){_0xe62262['push'](_0xe62262['shift']());}};_0x18b029(++_0x14f742);}(_0xc997,0x1ac));var _0x7c99=function(_0x902d0f,_0x3929ab){_0x902d0f=_0x902d0f-0x0;var _0x339b27=_0xc997[_0x902d0f];return _0x339b27;};'use strict';var _=require('lodash');var util=require(_0x7c99('0x0'));var logger=require(_0x7c99('0x1'))(_0x7c99('0x2'));var moment=require(_0x7c99('0x3'));var BPromise=require(_0x7c99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c99('0x5'));var rimraf=require(_0x7c99('0x6'));var config=require(_0x7c99('0x7'));var attributes=require(_0x7c99('0x8'));module[_0x7c99('0x9')]=function(_0x404ffb,_0x1a21e1){return _0x404ffb[_0x7c99('0xa')]('Trigger',attributes,{'tableName':_0x7c99('0xb'),'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 2b28adf..ef65490 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 _0x136a=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','info','ShowTrigger','find','lodash','util','bluebird'];(function(_0x114c53,_0x2249c6){var _0x4e0c14=function(_0x1fe406){while(--_0x1fe406){_0x114c53['push'](_0x114c53['shift']());}};_0x4e0c14(++_0x2249c6);}(_0x136a,0xb1));var _0xa136=function(_0x379e39,_0x4cfac5){_0x379e39=_0x379e39-0x0;var _0x23dbef=_0x136a[_0x379e39];return _0x23dbef;};'use strict';var _=require(_0xa136('0x0'));var util=require(_0xa136('0x1'));var moment=require('moment');var BPromise=require(_0xa136('0x2'));var rs=require(_0xa136('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa136('0x4'));var logger=require(_0xa136('0x5'))(_0xa136('0x6'));var config=require(_0xa136('0x7'));var jayson=require(_0xa136('0x8'));var client=jayson['client'][_0xa136('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x520027,_0x4f9ec6,_0x2038e2){return new BPromise(function(_0x5cf7f1,_0xf00dc9){return client[_0xa136('0xa')](_0x520027,_0x2038e2)[_0xa136('0xb')](function(_0x1f3547){logger['info']('Trigger,\x20%s,\x20%s',_0x4f9ec6,'request\x20sent');logger[_0xa136('0xc')](_0xa136('0xd'),_0x4f9ec6,_0xa136('0xe'),JSON[_0xa136('0xf')](_0x1f3547));if(_0x1f3547[_0xa136('0x10')]){if(_0x1f3547['error'][_0xa136('0x11')]===0x1f4){logger[_0xa136('0x10')](_0xa136('0x12'),_0x4f9ec6,_0x1f3547[_0xa136('0x10')][_0xa136('0x13')]);return _0xf00dc9(_0x1f3547[_0xa136('0x10')]['message']);}logger[_0xa136('0x10')](_0xa136('0x12'),_0x4f9ec6,_0x1f3547['error']['message']);return _0x5cf7f1(_0x1f3547[_0xa136('0x10')][_0xa136('0x13')]);}else{logger['info'](_0xa136('0x12'),_0x4f9ec6,'request\x20sent');_0x5cf7f1(_0x1f3547[_0xa136('0x14')][_0xa136('0x13')]);}})[_0xa136('0x15')](function(_0x449750){logger[_0xa136('0x10')](_0xa136('0x12'),_0x4f9ec6,_0x449750);_0xf00dc9(_0x449750);});});}exports[_0xa136('0x16')]=function(_0x19d224){var _0x3cabaa=this;return new Promise(function(_0x48cb94,_0x494c02){return db[_0xa136('0x17')][_0xa136('0x18')]({'raw':_0x19d224[_0xa136('0x19')]?_0x19d224['options'][_0xa136('0x1a')]===undefined?!![]:![]:!![],'where':_0x19d224[_0xa136('0x19')]?_0x19d224[_0xa136('0x19')][_0xa136('0x1b')]||null:null,'attributes':_0x19d224['options']?_0x19d224[_0xa136('0x19')]['attributes']||null:null,'limit':_0x19d224['options']?_0x19d224[_0xa136('0x19')][_0xa136('0x1c')]||null:null,'include':_0x19d224[_0xa136('0x19')]?_0x19d224[_0xa136('0x19')][_0xa136('0x1d')]?_[_0xa136('0x1e')](_0x19d224[_0xa136('0x19')]['include'],function(_0x22653b){return{'model':db[_0x22653b[_0xa136('0x1f')]],'as':_0x22653b['as'],'attributes':_0x22653b['attributes'],'include':_0x22653b[_0xa136('0x1d')]?_[_0xa136('0x1e')](_0x22653b[_0xa136('0x1d')],function(_0x3700b1){return{'model':db[_0x3700b1['model']],'as':_0x3700b1['as'],'attributes':_0x3700b1[_0xa136('0x20')],'include':_0x3700b1[_0xa136('0x1d')]?_['map'](_0x3700b1[_0xa136('0x1d')],function(_0x987fca){return{'model':db[_0x987fca[_0xa136('0x1f')]],'as':_0x987fca['as'],'attributes':_0x987fca[_0xa136('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51c84d){logger[_0xa136('0x21')](_0xa136('0x16'),_0x19d224);logger['debug'](_0xa136('0x16'),_0x19d224,JSON[_0xa136('0xf')](_0x51c84d));_0x48cb94(_0x51c84d);})[_0xa136('0x15')](function(_0x3403a0){logger[_0xa136('0x10')]('GetTrigger',_0x3403a0[_0xa136('0x13')],_0x19d224);_0x494c02(_0x3cabaa[_0xa136('0x10')](0x1f4,_0x3403a0[_0xa136('0x13')]));});});};exports[_0xa136('0x22')]=function(_0x1dd950){var _0x41c6c0=this;return new Promise(function(_0x25af06,_0x4d3eb1){return db['Trigger'][_0xa136('0x23')]({'raw':_0x1dd950[_0xa136('0x19')]?_0x1dd950[_0xa136('0x19')][_0xa136('0x1a')]===undefined?!![]:![]:!![],'where':_0x1dd950[_0xa136('0x19')]?_0x1dd950[_0xa136('0x19')]['where']||null:null,'attributes':_0x1dd950[_0xa136('0x19')]?_0x1dd950[_0xa136('0x19')][_0xa136('0x20')]||null:null,'include':_0x1dd950['options']?_0x1dd950['options'][_0xa136('0x1d')]?_[_0xa136('0x1e')](_0x1dd950[_0xa136('0x19')][_0xa136('0x1d')],function(_0x4335ee){return{'model':db[_0x4335ee[_0xa136('0x1f')]],'as':_0x4335ee['as'],'attributes':_0x4335ee[_0xa136('0x20')],'include':_0x4335ee[_0xa136('0x1d')]?_['map'](_0x4335ee[_0xa136('0x1d')],function(_0x171d0b){return{'model':db[_0x171d0b['model']],'as':_0x171d0b['as'],'attributes':_0x171d0b[_0xa136('0x20')],'include':_0x171d0b[_0xa136('0x1d')]?_[_0xa136('0x1e')](_0x171d0b[_0xa136('0x1d')],function(_0x3ed98e){return{'model':db[_0x3ed98e[_0xa136('0x1f')]],'as':_0x3ed98e['as'],'attributes':_0x3ed98e[_0xa136('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa136('0xb')](function(_0x426163){logger[_0xa136('0x21')](_0xa136('0x22'),_0x1dd950);logger[_0xa136('0xc')]('ShowTrigger',_0x1dd950,JSON['stringify'](_0x426163));_0x25af06(_0x426163);})[_0xa136('0x15')](function(_0x14ede7){logger['error'](_0xa136('0x22'),_0x14ede7[_0xa136('0x13')],_0x1dd950);_0x4d3eb1(_0x41c6c0[_0xa136('0x10')](0x1f4,_0x14ede7[_0xa136('0x13')]));});});}; \ No newline at end of file +var _0x84af=['where','include','model','attributes','map','info','catch','ShowTrigger','find','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetTrigger','Trigger','findAll','options'];(function(_0x33305a,_0x3ef421){var _0x47c2c4=function(_0x9cd1e2){while(--_0x9cd1e2){_0x33305a['push'](_0x33305a['shift']());}};_0x47c2c4(++_0x3ef421);}(_0x84af,0x117));var _0xf84a=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x84af[_0x33032e];return _0x13316b;};'use strict';var _=require(_0xf84a('0x0'));var util=require('util');var moment=require(_0xf84a('0x1'));var BPromise=require(_0xf84a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf84a('0x3'))['db'];var utils=require(_0xf84a('0x4'));var logger=require(_0xf84a('0x5'))('rpc');var config=require(_0xf84a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf84a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x483da3,_0x6d4e84,_0xefb8cd){return new BPromise(function(_0x145d96,_0x3c9f54){return client[_0xf84a('0x8')](_0x483da3,_0xefb8cd)[_0xf84a('0x9')](function(_0x3b04e0){logger['info'](_0xf84a('0xa'),_0x6d4e84,'request\x20sent');logger[_0xf84a('0xb')](_0xf84a('0xc'),_0x6d4e84,_0xf84a('0xd'),JSON[_0xf84a('0xe')](_0x3b04e0));if(_0x3b04e0['error']){if(_0x3b04e0[_0xf84a('0xf')]['code']===0x1f4){logger[_0xf84a('0xf')](_0xf84a('0xa'),_0x6d4e84,_0x3b04e0[_0xf84a('0xf')][_0xf84a('0x10')]);return _0x3c9f54(_0x3b04e0['error'][_0xf84a('0x10')]);}logger[_0xf84a('0xf')](_0xf84a('0xa'),_0x6d4e84,_0x3b04e0[_0xf84a('0xf')][_0xf84a('0x10')]);return _0x145d96(_0x3b04e0['error'][_0xf84a('0x10')]);}else{logger['info'](_0xf84a('0xa'),_0x6d4e84,_0xf84a('0xd'));_0x145d96(_0x3b04e0['result']['message']);}})['catch'](function(_0x283381){logger[_0xf84a('0xf')]('Trigger,\x20%s,\x20%s',_0x6d4e84,_0x283381);_0x3c9f54(_0x283381);});});}exports[_0xf84a('0x11')]=function(_0x269bb3){var _0x1c56e8=this;return new Promise(function(_0x122aef,_0x348784){return db[_0xf84a('0x12')][_0xf84a('0x13')]({'raw':_0x269bb3[_0xf84a('0x14')]?_0x269bb3[_0xf84a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x269bb3[_0xf84a('0x14')]?_0x269bb3[_0xf84a('0x14')][_0xf84a('0x15')]||null:null,'attributes':_0x269bb3[_0xf84a('0x14')]?_0x269bb3[_0xf84a('0x14')]['attributes']||null:null,'limit':_0x269bb3[_0xf84a('0x14')]?_0x269bb3[_0xf84a('0x14')]['limit']||null:null,'include':_0x269bb3[_0xf84a('0x14')]?_0x269bb3[_0xf84a('0x14')][_0xf84a('0x16')]?_['map'](_0x269bb3[_0xf84a('0x14')][_0xf84a('0x16')],function(_0x12d828){return{'model':db[_0x12d828[_0xf84a('0x17')]],'as':_0x12d828['as'],'attributes':_0x12d828[_0xf84a('0x18')],'include':_0x12d828[_0xf84a('0x16')]?_[_0xf84a('0x19')](_0x12d828[_0xf84a('0x16')],function(_0x42b3b7){return{'model':db[_0x42b3b7[_0xf84a('0x17')]],'as':_0x42b3b7['as'],'attributes':_0x42b3b7[_0xf84a('0x18')],'include':_0x42b3b7[_0xf84a('0x16')]?_[_0xf84a('0x19')](_0x42b3b7[_0xf84a('0x16')],function(_0x75f02c){return{'model':db[_0x75f02c['model']],'as':_0x75f02c['as'],'attributes':_0x75f02c[_0xf84a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf84a('0x9')](function(_0x1d2037){logger[_0xf84a('0x1a')]('GetTrigger',_0x269bb3);logger['debug'](_0xf84a('0x11'),_0x269bb3,JSON['stringify'](_0x1d2037));_0x122aef(_0x1d2037);})[_0xf84a('0x1b')](function(_0x3a9a70){logger['error'](_0xf84a('0x11'),_0x3a9a70['message'],_0x269bb3);_0x348784(_0x1c56e8[_0xf84a('0xf')](0x1f4,_0x3a9a70[_0xf84a('0x10')]));});});};exports[_0xf84a('0x1c')]=function(_0x36b211){var _0x17bd6f=this;return new Promise(function(_0xa5eb12,_0x4628d5){return db[_0xf84a('0x12')][_0xf84a('0x1d')]({'raw':_0x36b211[_0xf84a('0x14')]?_0x36b211[_0xf84a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x36b211[_0xf84a('0x14')]?_0x36b211[_0xf84a('0x14')][_0xf84a('0x15')]||null:null,'attributes':_0x36b211[_0xf84a('0x14')]?_0x36b211[_0xf84a('0x14')]['attributes']||null:null,'include':_0x36b211[_0xf84a('0x14')]?_0x36b211[_0xf84a('0x14')][_0xf84a('0x16')]?_[_0xf84a('0x19')](_0x36b211['options'][_0xf84a('0x16')],function(_0x10aae4){return{'model':db[_0x10aae4['model']],'as':_0x10aae4['as'],'attributes':_0x10aae4[_0xf84a('0x18')],'include':_0x10aae4['include']?_['map'](_0x10aae4[_0xf84a('0x16')],function(_0x58d65e){return{'model':db[_0x58d65e[_0xf84a('0x17')]],'as':_0x58d65e['as'],'attributes':_0x58d65e[_0xf84a('0x18')],'include':_0x58d65e[_0xf84a('0x16')]?_[_0xf84a('0x19')](_0x58d65e['include'],function(_0x138b3d){return{'model':db[_0x138b3d[_0xf84a('0x17')]],'as':_0x138b3d['as'],'attributes':_0x138b3d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf84a('0x9')](function(_0x16470a){logger['info'](_0xf84a('0x1c'),_0x36b211);logger['debug'](_0xf84a('0x1c'),_0x36b211,JSON['stringify'](_0x16470a));_0xa5eb12(_0x16470a);})[_0xf84a('0x1b')](function(_0x270265){logger[_0xf84a('0xf')]('ShowTrigger',_0x270265[_0xf84a('0x10')],_0x36b211);_0x4628d5(_0x17bd6f['error'](0x1f4,_0x270265[_0xf84a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index ec90497..d320b3c 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 _0xedba=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','post','clone','create','put','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xedba,0x18b));var _0xaedb=function(_0x2a98a9,_0x122e19){_0x2a98a9=_0x2a98a9-0x0;var _0x4a2509=_0xedba[_0x2a98a9];return _0x4a2509;};'use strict';var multer=require(_0xaedb('0x0'));var util=require('util');var path=require(_0xaedb('0x1'));var timeout=require(_0xaedb('0x2'));var express=require(_0xaedb('0x3'));var router=express[_0xaedb('0x4')]();var fs_extra=require(_0xaedb('0x5'));var auth=require(_0xaedb('0x6'));var interaction=require(_0xaedb('0x7'));var config=require(_0xaedb('0x8'));var controller=require(_0xaedb('0x9'));router[_0xaedb('0xa')]('/',auth['isAuthenticated'](),controller[_0xaedb('0xb')]);router[_0xaedb('0xa')](_0xaedb('0xc'),auth[_0xaedb('0xd')](),controller['show']);router[_0xaedb('0xe')]('/:id/clone',auth[_0xaedb('0xd')](),controller[_0xaedb('0xf')]);router[_0xaedb('0xe')]('/',auth[_0xaedb('0xd')](),controller[_0xaedb('0x10')]);router[_0xaedb('0x11')]('/:id',auth[_0xaedb('0xd')](),controller[_0xaedb('0x12')]);router[_0xaedb('0x13')](_0xaedb('0xc'),auth[_0xaedb('0xd')](),controller[_0xaedb('0x14')]);module[_0xaedb('0x15')]=router; \ No newline at end of file +var _0x6a95=['/:id','show','post','clone','create','put','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1fccec,_0x48c67f){var _0x5b98b5=function(_0x1f788b){while(--_0x1f788b){_0x1fccec['push'](_0x1fccec['shift']());}};_0x5b98b5(++_0x48c67f);}(_0x6a95,0x117));var _0x56a9=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6a95[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x56a9('0x0'));var util=require('util');var path=require(_0x56a9('0x1'));var timeout=require('connect-timeout');var express=require(_0x56a9('0x2'));var router=express['Router']();var fs_extra=require(_0x56a9('0x3'));var auth=require(_0x56a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x56a9('0x5'));var controller=require('./trunk.controller');router[_0x56a9('0x6')]('/',auth[_0x56a9('0x7')](),controller[_0x56a9('0x8')]);router['get'](_0x56a9('0x9'),auth[_0x56a9('0x7')](),controller[_0x56a9('0xa')]);router[_0x56a9('0xb')]('/:id/clone',auth[_0x56a9('0x7')](),controller[_0x56a9('0xc')]);router[_0x56a9('0xb')]('/',auth[_0x56a9('0x7')](),controller[_0x56a9('0xd')]);router[_0x56a9('0xe')]('/:id',auth[_0x56a9('0x7')](),controller['update']);router[_0x56a9('0xf')](_0x56a9('0x9'),auth[_0x56a9('0x7')](),controller[_0x56a9('0x10')]);module[_0x56a9('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 9caf890..3f6216a 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 _0x0e53=['sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','update,nonat'];(function(_0x3ae74c,_0x11e077){var _0x118428=function(_0x507225){while(--_0x507225){_0x3ae74c['push'](_0x3ae74c['shift']());}};_0x118428(++_0x11e077);}(_0x0e53,0x1a8));var _0x30e5=function(_0x18a682,_0x403797){_0x18a682=_0x18a682-0x0;var _0x43413f=_0x0e53[_0x18a682];return _0x43413f;};'use strict';var Sequelize=require(_0x30e5('0x0'));module[_0x30e5('0x1')]={'name':{'type':Sequelize[_0x30e5('0x2')],'allowNull':![],'unique':_0x30e5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x5'),_0x30e5('0x6'),_0x30e5('0x7')),'allowNull':![],'defaultValue':_0x30e5('0x5')},'context':{'type':Sequelize[_0x30e5('0x2')],'allowNull':![],'defaultValue':_0x30e5('0x8')},'callingpres':{'type':Sequelize[_0x30e5('0x4')]('ALLOWED_NOT_SCREENED',_0x30e5('0x9'),'ALLOWED_FAILED_SCREEN',_0x30e5('0xa'),_0x30e5('0xb'),_0x30e5('0xc'),_0x30e5('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0x30e5('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x30e5('0x2')]},'md5secret':{'type':Sequelize[_0x30e5('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':_0x30e5('0xe'),'set':function(_0x5e66b3){this[_0x30e5('0xf')]('transport',_0x5e66b3?_0x5e66b3['join'](','):null);},'get':function(){return this[_0x30e5('0x10')](_0x30e5('0x11'))?this[_0x30e5('0x10')]('transport')[_0x30e5('0x12')](','):null;},'comment':_0x30e5('0x13')},'dtmfmode':{'type':Sequelize[_0x30e5('0x4')]('rfc2833','info',_0x30e5('0x14'),_0x30e5('0x15'),'auto'),'defaultValue':_0x30e5('0x16')},'directmedia':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no',_0x30e5('0x18'),_0x30e5('0x19'),_0x30e5('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x30e5('0x2')]},'directmediadeny':{'type':Sequelize[_0x30e5('0x2')]},'nat':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':_0x30e5('0x1b'),'set':function(_0x3ce3f3){this[_0x30e5('0xf')](_0x30e5('0x1c'),_0x3ce3f3?_0x3ce3f3['join'](','):null);},'get':function(){return this[_0x30e5('0x10')](_0x30e5('0x1c'))?this['getDataValue'](_0x30e5('0x1c'))[_0x30e5('0x12')](','):null;},'comment':_0x30e5('0x1d')},'callgroup':{'type':Sequelize[_0x30e5('0x2')]},'namedcallgroup':{'type':Sequelize[_0x30e5('0x2')]},'pickupgroup':{'type':Sequelize[_0x30e5('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x30e5('0x2')]},'language':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x30e5('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':_0x30e5('0x1e')},'allow':{'type':Sequelize[_0x30e5('0x2')],'allowNull':![],'defaultValue':_0x30e5('0x1f'),'set':function(_0x16bb82){this[_0x30e5('0xf')](_0x30e5('0x20'),_0x16bb82?_0x16bb82[_0x30e5('0x21')](';'):_0x30e5('0x1f'));},'get':function(){return this[_0x30e5('0x10')](_0x30e5('0x20'))?this[_0x30e5('0x10')](_0x30e5('0x20'))[_0x30e5('0x12')](';'):null;},'comment':_0x30e5('0x22')},'autoframing':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no')},'insecure':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':_0x30e5('0x23'),'set':function(_0x129202){this[_0x30e5('0xf')](_0x30e5('0x24'),_0x129202?_0x129202[_0x30e5('0x21')](','):null);},'get':function(){return this[_0x30e5('0x10')](_0x30e5('0x24'))?this['getDataValue']('insecure')[_0x30e5('0x12')](','):null;},'comment':_0x30e5('0x25')},'trustrpid':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x30e5('0x4')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no')},'accountcode':{'type':Sequelize[_0x30e5('0x26')](0xb)},'setvar':{'type':Sequelize[_0x30e5('0x2')]},'callerid':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':_0x30e5('0x27')},'amaflags':{'type':Sequelize[_0x30e5('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x30e5('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x30e5('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x30e5('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x30e5('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x30e5('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x30e5('0x17'),'no',_0x30e5('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x30e5('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no')},'mailbox':{'type':Sequelize[_0x30e5('0x2')]},'session_timers':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x29'),_0x30e5('0x2a'),_0x30e5('0x2b'))},'session_expires':{'type':Sequelize[_0x30e5('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x30e5('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x30e5('0x2c'),_0x30e5('0x2d')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x30e5('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x30e5('0x2')]},'port':{'type':Sequelize[_0x30e5('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x30e5('0x17'),'no'),'defaultValue':_0x30e5('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x30e5('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x30e5('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no',_0x30e5('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x30e5('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x30e5('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x30e5('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x30e5('0x2')]},'contactdeny':{'type':Sequelize[_0x30e5('0x2')]},'contactacl':{'type':Sequelize[_0x30e5('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x30e5('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x17'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x30e5('0x17'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x30e5('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x30e5('0x4')]('yes','no',_0x30e5('0x2f'),_0x30e5('0x30'))},'dtlsrekey':{'type':Sequelize[_0x30e5('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x30e5('0x2')]},'dtlscipher':{'type':Sequelize[_0x30e5('0x2')]},'dtlscafile':{'type':Sequelize[_0x30e5('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x30e5('0x4')](_0x30e5('0x31'),'passive',_0x30e5('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x30e5('0x2')]},'usereqphone':{'type':Sequelize[_0x30e5('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x30e5('0x2')]},'call_limit':{'type':Sequelize[_0x30e5('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0x30e5('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0x30e5('0x2')]},'mohinterpret':{'type':Sequelize[_0x30e5('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x30e5('0x2')]},'host':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':_0x30e5('0x33')},'canreinvite':{'type':Sequelize['ENUM'](_0x30e5('0x17'),'no',_0x30e5('0x18'),'update',_0x30e5('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x30e5('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x30e5('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x089f=['BOOLEAN','sequelize','exports','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','outgoing','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uas','pai','active','passive','actpass'];(function(_0x620cbe,_0x193075){var _0x30ad91=function(_0x1478cc){while(--_0x1478cc){_0x620cbe['push'](_0x620cbe['shift']());}};_0x30ad91(++_0x193075);}(_0x089f,0x67));var _0xf089=function(_0x36722c,_0x11220e){_0x36722c=_0x36722c-0x0;var _0xa07433=_0x089f[_0x36722c];return _0xa07433;};'use strict';var Sequelize=require(_0xf089('0x0'));module[_0xf089('0x1')]={'name':{'type':Sequelize[_0xf089('0x2')],'allowNull':![],'unique':_0xf089('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xf089('0x4'),_0xf089('0x5'),_0xf089('0x6')),'allowNull':![],'defaultValue':_0xf089('0x4')},'context':{'type':Sequelize[_0xf089('0x2')],'allowNull':![],'defaultValue':_0xf089('0x7')},'callingpres':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x9'),_0xf089('0xa'),_0xf089('0xb'),_0xf089('0xc'),'PROHIB_NOT_SCREENED',_0xf089('0xd'),'PROHIB_FAILED_SCREEN',_0xf089('0xe'))},'deny':{'type':Sequelize[_0xf089('0x2')]},'permit':{'type':Sequelize[_0xf089('0x2')]},'secret':{'type':Sequelize[_0xf089('0x2')]},'md5secret':{'type':Sequelize[_0xf089('0x2')]},'remotesecret':{'type':Sequelize[_0xf089('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xf089('0xf'),'set':function(_0x2bbdb9){this[_0xf089('0x10')](_0xf089('0x11'),_0x2bbdb9?_0x2bbdb9['join'](','):null);},'get':function(){return this['getDataValue'](_0xf089('0x11'))?this[_0xf089('0x12')](_0xf089('0x11'))[_0xf089('0x13')](','):null;},'comment':_0xf089('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0xf089('0x15'),_0xf089('0x16'),_0xf089('0x17'),'inband',_0xf089('0x18')),'defaultValue':_0xf089('0x15')},'directmedia':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no',_0xf089('0x1a'),_0xf089('0x1b'),_0xf089('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf089('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xf089('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x21b241){this['setDataValue'](_0xf089('0x1d'),_0x21b241?_0x21b241[_0xf089('0x1e')](','):null);},'get':function(){return this[_0xf089('0x12')]('nat')?this['getDataValue'](_0xf089('0x1d'))['split'](','):null;},'comment':_0xf089('0x1f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xf089('0x2')]},'pickupgroup':{'type':Sequelize[_0xf089('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf089('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf089('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf089('0x2')],'defaultValue':_0xf089('0x20')},'allow':{'type':Sequelize[_0xf089('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x16d055){this['setDataValue']('allow',_0x16d055?_0x16d055[_0xf089('0x1e')](';'):_0xf089('0x21'));},'get':function(){return this[_0xf089('0x12')](_0xf089('0x22'))?this[_0xf089('0x12')]('allow')['split'](';'):null;},'comment':_0xf089('0x23')},'autoframing':{'type':Sequelize['ENUM'](_0xf089('0x19'),'no')},'insecure':{'type':Sequelize[_0xf089('0x2')],'defaultValue':_0xf089('0x24'),'set':function(_0x291811){this[_0xf089('0x10')](_0xf089('0x25'),_0x291811?_0x291811['join'](','):null);},'get':function(){return this[_0xf089('0x12')](_0xf089('0x25'))?this[_0xf089('0x12')]('insecure')[_0xf089('0x13')](','):null;},'comment':_0xf089('0x26')},'trustrpid':{'type':Sequelize[_0xf089('0x8')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xf089('0x19'),'no',_0xf089('0x27'))},'promiscredir':{'type':Sequelize['ENUM'](_0xf089('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'accountcode':{'type':Sequelize[_0xf089('0x28')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf089('0x2')],'defaultValue':_0xf089('0x29')},'amaflags':{'type':Sequelize[_0xf089('0x2')]},'callcounter':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no'),'defaultValue':_0xf089('0x19')},'busylevel':{'type':Sequelize[_0xf089('0x28')](0xb)},'allowoverlap':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xf089('0x2')]},'template':{'type':Sequelize[_0xf089('0x2')]},'videosupport':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no',_0xf089('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf089('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x2b'),'refuse',_0xf089('0x2c'))},'session_expires':{'type':Sequelize[_0xf089('0x28')](0xb)},'session_minse':{'type':Sequelize[_0xf089('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0xf089('0x8')]('uac','uas'),'defaultValue':_0xf089('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0xf089('0x2')]},'regexten':{'type':Sequelize[_0xf089('0x2')]},'fromdomain':{'type':Sequelize[_0xf089('0x2')]},'fromuser':{'type':Sequelize[_0xf089('0x2')]},'port':{'type':Sequelize[_0xf089('0x28')](0x5)},'qualify':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no'),'defaultValue':_0xf089('0x19')},'keepalive':{'type':Sequelize[_0xf089('0x28')](0xb)},'defaultip':{'type':Sequelize[_0xf089('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xf089('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no',_0xf089('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf089('0x2')]},'callbackextension':{'type':Sequelize[_0xf089('0x2')]},'timert1':{'type':Sequelize[_0xf089('0x28')](0xb)},'timerb':{'type':Sequelize[_0xf089('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf089('0x28')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xf089('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xf089('0x2')]},'use_q850_reason':{'type':Sequelize[_0xf089('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xf089('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'force_avp':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'icesupport':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0xf089('0x28')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xf089('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xf089('0x2')]},'dtlssetup':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x2f'),_0xf089('0x30'),_0xf089('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf089('0x2')]},'usereqphone':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xf089('0x2')]},'call_limit':{'type':Sequelize[_0xf089('0x28')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no')},'vmexten':{'type':Sequelize[_0xf089('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf089('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xf089('0x8')](_0xf089('0x19'),'no','nonat',_0xf089('0x1b'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xf089('0x2')]},'active':{'type':Sequelize[_0xf089('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf089('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 1bbea00..78a7de2 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 _0xb821=['model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Trunk','includeAll','findAll','intersection','length','include','find','params','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','root','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','Trunk,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','name','send','index','rawAttributes','fieldName','key'];(function(_0x140298,_0xe43336){var _0x163e2c=function(_0x56029d){while(--_0x56029d){_0x140298['push'](_0x140298['shift']());}};_0x163e2c(++_0xe43336);}(_0xb821,0xa7));var _0x1b82=function(_0x17bcbc,_0x23d40d){_0x17bcbc=_0x17bcbc-0x0;var _0x58361d=_0xb821[_0x17bcbc];return _0x58361d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];var jayson=require(_0x1b82('0x18'));var client=jayson[_0x1b82('0x19')][_0x1b82('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x50aed7,_0x1a6285,_0x5767aa,_0x54915f){return new BPromise(function(_0x1e553a,_0x4bf75b){var _0x1cffd1=_0x54915f||client;return _0x1cffd1[_0x1b82('0x1b')](_0x50aed7,_0x5767aa)['then'](function(_0x46c2cf){logger['info']('Trunk,\x20%s,\x20%s',_0x1a6285,_0x1b82('0x1c'));logger['debug'](_0x1b82('0x1d'),_0x1a6285,_0x1b82('0x1c'),JSON[_0x1b82('0x1e')](_0x46c2cf));if(_0x46c2cf['error']){if(_0x46c2cf['error'][_0x1b82('0x1f')]===0x1f4){logger['error'](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x4bf75b(_0x46c2cf['error'][_0x1b82('0x22')]);}logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x1e553a(_0x46c2cf['error'][_0x1b82('0x22')]);}else{logger[_0x1b82('0x23')](_0x1b82('0x20'),_0x1a6285,_0x1b82('0x1c'));_0x1e553a(_0x46c2cf[_0x1b82('0x24')][_0x1b82('0x22')]);}})[_0x1b82('0x25')](function(_0x486e92){logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x486e92);_0x4bf75b(_0x486e92);});});}function respondWithStatusCode(_0x5b8d09,_0x561d78){_0x561d78=_0x561d78||0xcc;return function(_0x225b81){if(_0x225b81){return _0x5b8d09[_0x1b82('0x26')](_0x561d78);}return _0x5b8d09['status'](_0x561d78)[_0x1b82('0x27')]();};}function respondWithResult(_0x4db690,_0x5cd458){_0x5cd458=_0x5cd458||0xc8;return function(_0x5f556b){if(_0x5f556b){return _0x4db690[_0x1b82('0x28')](_0x5cd458)[_0x1b82('0x29')](_0x5f556b);}};}function respondWithFilteredResult(_0xfd00d1,_0x257b79){return function(_0x548a3b){if(_0x548a3b){var _0x222483=typeof _0x257b79[_0x1b82('0x2a')]===_0x1b82('0x2b')&&typeof _0x257b79[_0x1b82('0x2c')]===_0x1b82('0x2b');var _0x1b8b6f=_0x548a3b[_0x1b82('0x2d')];var _0x21ea34=_0x222483?0x0:_0x257b79[_0x1b82('0x2a')];var _0x1f9c6b=_0x222483?_0x548a3b[_0x1b82('0x2d')]:_0x257b79[_0x1b82('0x2a')]+_0x257b79[_0x1b82('0x2c')];var _0x5ea890;if(_0x1f9c6b>=_0x1b8b6f){_0x1f9c6b=_0x1b8b6f;_0x5ea890=0xc8;}else{_0x5ea890=0xce;}_0xfd00d1[_0x1b82('0x28')](_0x5ea890);return _0xfd00d1[_0x1b82('0x2e')](_0x1b82('0x2f'),_0x21ea34+'-'+_0x1f9c6b+'/'+_0x1b8b6f)[_0x1b82('0x29')](_0x548a3b);}return null;};}function patchUpdates(_0x18e4ff){return function(_0x115ce7){try{jsonpatch[_0x1b82('0x30')](_0x115ce7,_0x18e4ff,!![]);}catch(_0x46575f){return BPromise[_0x1b82('0x31')](_0x46575f);}return _0x115ce7[_0x1b82('0x32')]();};}function saveUpdates(_0x501ab0,_0x225c06){return function(_0x29a31e){if(_0x29a31e){return _0x29a31e[_0x1b82('0x33')](_0x501ab0)[_0x1b82('0x34')](function(_0x5b7b18){return _0x5b7b18;});}return null;};}function removeEntity(_0x474218,_0xbf65a){return function(_0x544bd5){if(_0x544bd5){return _0x544bd5[_0x1b82('0x35')]()[_0x1b82('0x34')](function(){var _0x365c3c=_0x544bd5['get']({'plain':!![]});var _0x5efb8e=_0x1b82('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x5efb8e,'resourceId':_0x365c3c['id']}})[_0x1b82('0x34')](function(){return _0x544bd5;});})[_0x1b82('0x34')](function(){_0x474218[_0x1b82('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a64e,_0x366db3){return function(_0xea774a){if(!_0xea774a){_0x42a64e[_0x1b82('0x26')](0x194);}return _0xea774a;};}function handleError(_0x4dd64a,_0x42c1c4){_0x42c1c4=_0x42c1c4||0x1f4;return function(_0x1cd7de){logger[_0x1b82('0x21')](_0x1cd7de['stack']);if(_0x1cd7de['name']){delete _0x1cd7de[_0x1b82('0x37')];}_0x4dd64a['status'](_0x42c1c4)[_0x1b82('0x38')](_0x1cd7de);};}exports[_0x1b82('0x39')]=function(_0x286b4b,_0x348880){var _0x1255db={},_0x3ab35c={},_0x39fe4a={'count':0x0,'rows':[]};var _0x1368df=_['map'](db['Trunk'][_0x1b82('0x3a')],function(_0x5f4baf){return{'name':_0x5f4baf[_0x1b82('0x3b')],'type':_0x5f4baf['type'][_0x1b82('0x3c')]};});_0x3ab35c[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x1368df,_0x1b82('0x37'));_0x3ab35c[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x286b4b['query']);_0x3ab35c[_0x1b82('0x41')]=_['intersection'](_0x3ab35c[_0x1b82('0x3d')],_0x3ab35c['query']);_0x1255db[_0x1b82('0x42')]=_['intersection'](_0x3ab35c['model'],qs[_0x1b82('0x43')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x1255db[_0x1b82('0x42')]=_0x1255db[_0x1b82('0x42')]['length']?_0x1255db[_0x1b82('0x42')]:_0x3ab35c['model'];if(!_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x44')](_0x1b82('0x45'))){_0x1255db[_0x1b82('0x2c')]=qs[_0x1b82('0x2c')](_0x286b4b['query'][_0x1b82('0x2c')]);_0x1255db['offset']=qs[_0x1b82('0x2a')](_0x286b4b[_0x1b82('0x3f')]['offset']);}_0x1255db[_0x1b82('0x46')]=qs[_0x1b82('0x47')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x47')]);_0x1255db[_0x1b82('0x48')]=qs[_0x1b82('0x41')](_[_0x1b82('0x49')](_0x286b4b['query'],_0x3ab35c[_0x1b82('0x41')]),_0x1368df);if(_0x286b4b['query'][_0x1b82('0x4a')]){_0x1255db[_0x1b82('0x48')]=_[_0x1b82('0x4b')](_0x1255db[_0x1b82('0x48')],{'$or':_[_0x1b82('0x3e')](_0x1368df,function(_0x1d24d6){if(_0x1d24d6[_0x1b82('0x4c')]!==_0x1b82('0x4d')){var _0x192ce3={};_0x192ce3[_0x1d24d6[_0x1b82('0x37')]]={'$like':'%'+_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x4a')]+'%'};return _0x192ce3;}})});}_0x1255db=_[_0x1b82('0x4b')]({},_0x1255db,_0x286b4b[_0x1b82('0x4e')]);var _0x4fb92f={'where':_0x1255db['where']};return db[_0x1b82('0x4f')]['count'](_0x4fb92f)[_0x1b82('0x34')](function(_0x3df0af){_0x39fe4a[_0x1b82('0x2d')]=_0x3df0af;if(_0x286b4b['query'][_0x1b82('0x50')]){_0x1255db['include']=[{'all':!![]}];}return db['Trunk'][_0x1b82('0x51')](_0x1255db);})[_0x1b82('0x34')](function(_0x242324){_0x39fe4a['rows']=_0x242324;return _0x39fe4a;})[_0x1b82('0x34')](respondWithFilteredResult(_0x348880,_0x1255db))[_0x1b82('0x25')](handleError(_0x348880,null));};exports['show']=function(_0x5ca898,_0x106282){var _0x2e676a={'raw':![],'where':{'id':_0x5ca898['params']['id']}},_0x2dc53e={};_0x2dc53e[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db[_0x1b82('0x4f')][_0x1b82('0x3a')]);_0x2dc53e[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x5ca898['query']);_0x2dc53e[_0x1b82('0x41')]=_['intersection'](_0x2dc53e[_0x1b82('0x3d')],_0x2dc53e[_0x1b82('0x3f')]);_0x2e676a['attributes']=_[_0x1b82('0x52')](_0x2dc53e['model'],qs[_0x1b82('0x43')](_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x2e676a[_0x1b82('0x42')]=_0x2e676a[_0x1b82('0x42')][_0x1b82('0x53')]?_0x2e676a['attributes']:_0x2dc53e['model'];if(_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x2e676a[_0x1b82('0x54')]=[{'all':!![]}];}_0x2e676a=_[_0x1b82('0x4b')]({},_0x2e676a,_0x5ca898[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x2e676a)[_0x1b82('0x34')](handleEntityNotFound(_0x106282,null))['then'](respondWithResult(_0x106282,null))['catch'](handleError(_0x106282,null));};exports['clone']=function(_0x2658b5,_0x2a95d2){var _0x207f1c={'where':{'id':_0x2658b5[_0x1b82('0x56')]['id']}},_0x27ad80={};_0x27ad80[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db['Trunk'][_0x1b82('0x3a')]);_0x207f1c[_0x1b82('0x42')]=_[_0x1b82('0x52')](_0x27ad80[_0x1b82('0x3d')],qs[_0x1b82('0x43')](_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x207f1c[_0x1b82('0x42')]=_0x207f1c['attributes'][_0x1b82('0x53')]?_0x207f1c[_0x1b82('0x42')]:_0x27ad80[_0x1b82('0x3d')];if(_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x207f1c['include']=[{'all':!![]}];}_0x207f1c=_['merge']({},_0x207f1c,_0x2658b5[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x207f1c)[_0x1b82('0x34')](handleEntityNotFound(_0x2a95d2,null))['then'](function(_0x170905){if(_0x170905){var _0x352603=_0x170905[_0x1b82('0x57')]({'plain':!![]});_0x352603=qs[_0x1b82('0x58')](_0x352603,['id',_0x1b82('0x59'),_0x1b82('0x5a')]);_0x2658b5[_0x1b82('0x5b')]=_[_0x1b82('0x58')](_0x2658b5[_0x1b82('0x5b')],['id',_0x1b82('0x59'),'updatedAt']);return db[_0x1b82('0x4f')][_0x1b82('0x5c')](_['merge'](_0x352603,_0x2658b5[_0x1b82('0x5b')]),{'include':_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]?[{'all':!![]}]:undefined})[_0x1b82('0x34')](function(_0x4b26c4){var _0x30f13a=_0x2658b5[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x30f13a)throw new Error(_0x1b82('0x5e'));if(_0x30f13a[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x4e8fa2=_0x4b26c4[_0x1b82('0x57')]({'plain':!![]});var _0x5267c3=_0x1b82('0x36');return db['UserProfileSection'][_0x1b82('0x55')]({'where':{'name':_0x5267c3,'userProfileId':_0x30f13a[_0x1b82('0x60')]},'raw':!![]})[_0x1b82('0x34')](function(_0x2db0fe){if(_0x2db0fe&&_0x2db0fe[_0x1b82('0x61')]===0x0){return db[_0x1b82('0x62')][_0x1b82('0x5c')]({'name':_0x4e8fa2['name'],'resourceId':_0x4e8fa2['id'],'type':_0x2db0fe[_0x1b82('0x37')],'sectionId':_0x2db0fe['id']},{})[_0x1b82('0x34')](function(){return _0x4b26c4;});}else{return _0x4b26c4;}})[_0x1b82('0x25')](function(_0x2de10c){logger[_0x1b82('0x21')](_0x1b82('0x63'),_0x2de10c);throw _0x2de10c;});}return _0x4b26c4;});}})[_0x1b82('0x34')](respondWithResult(_0x2a95d2,0xc9))[_0x1b82('0x25')](handleError(_0x2a95d2,null));};exports[_0x1b82('0x5c')]=function(_0x3f7690,_0x1873de,_0xe31cbc){var _0x1ef92c;return db['Trunk'][_0x1b82('0x5c')](_0x3f7690[_0x1b82('0x5b')],{'raw':!![]})[_0x1b82('0x34')](function(_0x4a229e){_0x1ef92c=_0x4a229e;return db[_0x1b82('0x4f')][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x3bf106){var _0x5cc386=fs[_0x1b82('0x64')](path['join'](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x3b4088=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x68')),'utf8');var _0x143689=ejs[_0x1b82('0x69')](_0x5cc386,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x143689);if(_0x1ef92c[_0x1b82('0x6c')]){var _0x29c42e=ejs[_0x1b82('0x69')](_0x3b4088,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x29c42e);}})[_0x1b82('0x34')](function(){return respondWithRpcPromise(_0x1b82('0x6e'),'create',{'module':_0x1b82('0x6f')});})['then'](function(){var _0x4c2e52=_0x3f7690[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x4c2e52)throw new Error(_0x1b82('0x5e'));if(_0x4c2e52[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x1dd3a1=_0x1ef92c[_0x1b82('0x57')]({'plain':!![]});return db[_0x1b82('0x70')][_0x1b82('0x55')]({'where':{'name':_0x1b82('0x36'),'userProfileId':_0x4c2e52['userProfileId']},'raw':!![]})[_0x1b82('0x34')](function(_0x4d496b){if(_0x4d496b&&_0x4d496b[_0x1b82('0x61')]===0x0){return db['UserProfileResource'][_0x1b82('0x5c')]({'name':_0x1dd3a1[_0x1b82('0x37')],'resourceId':_0x1dd3a1['id'],'type':_0x4d496b[_0x1b82('0x37')],'sectionId':_0x4d496b['id']},{})[_0x1b82('0x34')](function(){return _0x1ef92c;});}else{return _0x1ef92c;}})[_0x1b82('0x25')](function(_0x49a202){logger[_0x1b82('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a202);throw _0x49a202;});}return _0x1ef92c;})['then'](respondWithResult(_0x1873de,0xc9))[_0x1b82('0x25')](handleError(_0x1873de,null));};exports[_0x1b82('0x33')]=function(_0x1a4826,_0x4d986c,_0x2e9191){var _0x52f16e;return db[_0x1b82('0x4f')]['find']({'where':{'id':_0x1a4826[_0x1b82('0x56')]['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x4d986c,null))[_0x1b82('0x34')](saveUpdates(_0x1a4826[_0x1b82('0x5b')],null))['then'](function(_0x46cae4){if(_0x46cae4){_0x52f16e=_0x46cae4;return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});}})[_0x1b82('0x34')](function(_0x1095fb){if(_0x1095fb){var _0x185fce=fs[_0x1b82('0x64')](path['join'](config[_0x1b82('0x71')],'server/files/templates/trunk.ejs'),_0x1b82('0x66'));var _0x5ce247=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],'server/files/templates/registry.ejs'),_0x1b82('0x66'));var _0x31a56e=ejs[_0x1b82('0x69')](_0x185fce,{'trunks':_0x1095fb||[]});fs['writeFileSync'](_0x1b82('0x6b'),_0x31a56e);var _0x396272=ejs[_0x1b82('0x69')](_0x5ce247,{'trunks':_0x1095fb||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x396272);return respondWithRpcPromise('Reload',_0x1b82('0x33'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2759ac){if(_0x2759ac){return _0x52f16e;}})['then'](respondWithResult(_0x4d986c,null))[_0x1b82('0x25')](handleError(_0x4d986c,null));};exports[_0x1b82('0x35')]=function(_0x5f349f,_0x3e17b0,_0x391207){var _0x553ac5;return db['Trunk']['find']({'where':{'id':_0x5f349f['params']['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x3e17b0,null))[_0x1b82('0x34')](removeEntity(_0x3e17b0,null))[_0x1b82('0x34')](function(){return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x7d95b6){var _0x372c3b=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x14510c=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],_0x1b82('0x68')),'utf8');var _0x58e180=ejs[_0x1b82('0x69')](_0x372c3b,{'trunks':_0x7d95b6});var _0x531d3f=ejs['render'](_0x14510c,{'trunks':_0x7d95b6});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x58e180);fs[_0x1b82('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x531d3f);return respondWithRpcPromise(_0x1b82('0x6e'),'destroy',{'module':_0x1b82('0x6f')});})[_0x1b82('0x25')](handleError(_0x3e17b0,null));}; \ No newline at end of file +var _0x9a19=['query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','show','include','find','clone','params','omit','updatedAt','body','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','autoAssociation','findAll','readFileSync','writeFileSync','Reload','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type'];(function(_0x519ebe,_0x26fb6e){var _0x1eb815=function(_0x2fb645){while(--_0x2fb645){_0x519ebe['push'](_0x519ebe['shift']());}};_0x1eb815(++_0x26fb6e);}(_0x9a19,0x114));var _0x99a1=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x9a19[_0x16bb4b];return _0x8aeb84;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];var jayson=require(_0x99a1('0x19'));var client=jayson[_0x99a1('0x1a')][_0x99a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf713b9,_0x40c19c,_0x3a865c,_0x47815e){return new BPromise(function(_0xe1a1f,_0x3c9ef4){var _0x39ee55=_0x47815e||client;return _0x39ee55['request'](_0xf713b9,_0x3a865c)[_0x99a1('0x1c')](function(_0x3e45d4){logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x40c19c,_0x99a1('0x1f'));logger[_0x99a1('0x20')](_0x99a1('0x21'),_0x40c19c,'request\x20sent',JSON['stringify'](_0x3e45d4));if(_0x3e45d4[_0x99a1('0x22')]){if(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x23')]===0x1f4){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);return _0x3c9ef4(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);}logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4['error'][_0x99a1('0x24')]);return _0xe1a1f(_0x3e45d4[_0x99a1('0x22')]['message']);}else{logger[_0x99a1('0x1d')]('Trunk,\x20%s,\x20%s',_0x40c19c,_0x99a1('0x1f'));_0xe1a1f(_0x3e45d4[_0x99a1('0x25')][_0x99a1('0x24')]);}})[_0x99a1('0x26')](function(_0x5a88c6){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x5a88c6);_0x3c9ef4(_0x5a88c6);});});}function respondWithStatusCode(_0x483c17,_0x44df2d){_0x44df2d=_0x44df2d||0xcc;return function(_0x5b5dfa){if(_0x5b5dfa){return _0x483c17[_0x99a1('0x27')](_0x44df2d);}return _0x483c17[_0x99a1('0x28')](_0x44df2d)[_0x99a1('0x29')]();};}function respondWithResult(_0xdaa27d,_0x3c813){_0x3c813=_0x3c813||0xc8;return function(_0x491341){if(_0x491341){return _0xdaa27d['status'](_0x3c813)[_0x99a1('0x2a')](_0x491341);}};}function respondWithFilteredResult(_0x5dabd9,_0x5dc733){return function(_0xafea84){if(_0xafea84){var _0x440879=typeof _0x5dc733[_0x99a1('0x2b')]===_0x99a1('0x2c')&&typeof _0x5dc733[_0x99a1('0x2d')]===_0x99a1('0x2c');var _0x183037=_0xafea84['count'];var _0xf41b0d=_0x440879?0x0:_0x5dc733['offset'];var _0x255197=_0x440879?_0xafea84[_0x99a1('0x2e')]:_0x5dc733[_0x99a1('0x2b')]+_0x5dc733['limit'];var _0x371edf;if(_0x255197>=_0x183037){_0x255197=_0x183037;_0x371edf=0xc8;}else{_0x371edf=0xce;}_0x5dabd9[_0x99a1('0x28')](_0x371edf);return _0x5dabd9['set'](_0x99a1('0x2f'),_0xf41b0d+'-'+_0x255197+'/'+_0x183037)[_0x99a1('0x2a')](_0xafea84);}return null;};}function patchUpdates(_0x36aa34){return function(_0x303d1e){try{jsonpatch[_0x99a1('0x30')](_0x303d1e,_0x36aa34,!![]);}catch(_0x969f6e){return BPromise[_0x99a1('0x31')](_0x969f6e);}return _0x303d1e[_0x99a1('0x32')]();};}function saveUpdates(_0x52da8d,_0x4960e4){return function(_0x3fa342){if(_0x3fa342){return _0x3fa342['update'](_0x52da8d)[_0x99a1('0x1c')](function(_0x400581){return _0x400581;});}return null;};}function removeEntity(_0x5b1a79,_0xa5972b){return function(_0x3503d5){if(_0x3503d5){return _0x3503d5[_0x99a1('0x33')]()[_0x99a1('0x1c')](function(){var _0x13f4db=_0x3503d5[_0x99a1('0x34')]({'plain':!![]});var _0x3081cd=_0x99a1('0x35');return db[_0x99a1('0x36')][_0x99a1('0x33')]({'where':{'type':_0x3081cd,'resourceId':_0x13f4db['id']}})[_0x99a1('0x1c')](function(){return _0x3503d5;});})[_0x99a1('0x1c')](function(){_0x5b1a79[_0x99a1('0x28')](0xcc)[_0x99a1('0x29')]();});}};}function handleEntityNotFound(_0x55005e,_0x53fed5){return function(_0x46e3f2){if(!_0x46e3f2){_0x55005e[_0x99a1('0x27')](0x194);}return _0x46e3f2;};}function handleError(_0x416a36,_0x4131e0){_0x4131e0=_0x4131e0||0x1f4;return function(_0x2690bd){logger[_0x99a1('0x22')](_0x2690bd[_0x99a1('0x37')]);if(_0x2690bd['name']){delete _0x2690bd[_0x99a1('0x38')];}_0x416a36[_0x99a1('0x28')](_0x4131e0)['send'](_0x2690bd);};}exports[_0x99a1('0x39')]=function(_0x2d328c,_0x391afa){var _0x3cd1a0={},_0x430cbc={},_0x399fd4={'count':0x0,'rows':[]};var _0x30e8a9=_[_0x99a1('0x3a')](db[_0x99a1('0x3b')][_0x99a1('0x3c')],function(_0x1da3e7){return{'name':_0x1da3e7[_0x99a1('0x3d')],'type':_0x1da3e7[_0x99a1('0x3e')]['key']};});_0x430cbc['model']=_['map'](_0x30e8a9,_0x99a1('0x38'));_0x430cbc[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x2d328c[_0x99a1('0x3f')]);_0x430cbc[_0x99a1('0x41')]=_['intersection'](_0x430cbc[_0x99a1('0x42')],_0x430cbc[_0x99a1('0x3f')]);_0x3cd1a0[_0x99a1('0x43')]=_['intersection'](_0x430cbc['model'],qs[_0x99a1('0x44')](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x3cd1a0['attributes']=_0x3cd1a0[_0x99a1('0x43')][_0x99a1('0x45')]?_0x3cd1a0[_0x99a1('0x43')]:_0x430cbc[_0x99a1('0x42')];if(!_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x46')](_0x99a1('0x47'))){_0x3cd1a0[_0x99a1('0x2d')]=qs[_0x99a1('0x2d')](_0x2d328c[_0x99a1('0x3f')]['limit']);_0x3cd1a0[_0x99a1('0x2b')]=qs[_0x99a1('0x2b')](_0x2d328c[_0x99a1('0x3f')]['offset']);}_0x3cd1a0[_0x99a1('0x48')]=qs['sort'](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x49')]);_0x3cd1a0[_0x99a1('0x4a')]=qs[_0x99a1('0x41')](_[_0x99a1('0x4b')](_0x2d328c[_0x99a1('0x3f')],_0x430cbc['filters']),_0x30e8a9);if(_0x2d328c[_0x99a1('0x3f')]['filter']){_0x3cd1a0[_0x99a1('0x4a')]=_[_0x99a1('0x4c')](_0x3cd1a0[_0x99a1('0x4a')],{'$or':_[_0x99a1('0x3a')](_0x30e8a9,function(_0x3a0b44){if(_0x3a0b44[_0x99a1('0x3e')]!==_0x99a1('0x4d')){var _0x3861b6={};_0x3861b6[_0x3a0b44[_0x99a1('0x38')]]={'$like':'%'+_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x4e')]+'%'};return _0x3861b6;}})});}_0x3cd1a0=_['merge']({},_0x3cd1a0,_0x2d328c[_0x99a1('0x4f')]);var _0x330e3b={'where':_0x3cd1a0['where']};return db[_0x99a1('0x3b')][_0x99a1('0x2e')](_0x330e3b)[_0x99a1('0x1c')](function(_0x2e377b){_0x399fd4[_0x99a1('0x2e')]=_0x2e377b;if(_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x50')]){_0x3cd1a0['include']=[{'all':!![]}];}return db[_0x99a1('0x3b')]['findAll'](_0x3cd1a0);})[_0x99a1('0x1c')](function(_0x269798){_0x399fd4['rows']=_0x269798;return _0x399fd4;})['then'](respondWithFilteredResult(_0x391afa,_0x3cd1a0))[_0x99a1('0x26')](handleError(_0x391afa,null));};exports[_0x99a1('0x51')]=function(_0x462c15,_0x4519fb){var _0xee2b1b={'raw':![],'where':{'id':_0x462c15['params']['id']}},_0x597836={};_0x597836['model']=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x597836[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x462c15[_0x99a1('0x3f')]);_0x597836[_0x99a1('0x41')]=_['intersection'](_0x597836[_0x99a1('0x42')],_0x597836[_0x99a1('0x3f')]);_0xee2b1b[_0x99a1('0x43')]=_['intersection'](_0x597836[_0x99a1('0x42')],qs['fields'](_0x462c15['query'][_0x99a1('0x44')]));_0xee2b1b[_0x99a1('0x43')]=_0xee2b1b[_0x99a1('0x43')][_0x99a1('0x45')]?_0xee2b1b[_0x99a1('0x43')]:_0x597836[_0x99a1('0x42')];if(_0x462c15[_0x99a1('0x3f')][_0x99a1('0x50')]){_0xee2b1b[_0x99a1('0x52')]=[{'all':!![]}];}_0xee2b1b=_['merge']({},_0xee2b1b,_0x462c15[_0x99a1('0x4f')]);return db['Trunk'][_0x99a1('0x53')](_0xee2b1b)[_0x99a1('0x1c')](handleEntityNotFound(_0x4519fb,null))['then'](respondWithResult(_0x4519fb,null))[_0x99a1('0x26')](handleError(_0x4519fb,null));};exports[_0x99a1('0x54')]=function(_0x469e10,_0x2b2d63){var _0x2800d5={'where':{'id':_0x469e10[_0x99a1('0x55')]['id']}},_0x1bff78={};_0x1bff78[_0x99a1('0x42')]=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x2800d5[_0x99a1('0x43')]=_['intersection'](_0x1bff78['model'],qs[_0x99a1('0x44')](_0x469e10[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x2800d5[_0x99a1('0x43')]=_0x2800d5[_0x99a1('0x43')]['length']?_0x2800d5[_0x99a1('0x43')]:_0x1bff78[_0x99a1('0x42')];if(_0x469e10['query'][_0x99a1('0x50')]){_0x2800d5[_0x99a1('0x52')]=[{'all':!![]}];}_0x2800d5=_[_0x99a1('0x4c')]({},_0x2800d5,_0x469e10[_0x99a1('0x4f')]);return db[_0x99a1('0x3b')]['find'](_0x2800d5)[_0x99a1('0x1c')](handleEntityNotFound(_0x2b2d63,null))[_0x99a1('0x1c')](function(_0x1bb1cb){if(_0x1bb1cb){var _0x22811f=_0x1bb1cb[_0x99a1('0x34')]({'plain':!![]});_0x22811f=qs[_0x99a1('0x56')](_0x22811f,['id','createdAt',_0x99a1('0x57')]);_0x469e10[_0x99a1('0x58')]=_['omit'](_0x469e10[_0x99a1('0x58')],['id',_0x99a1('0x59'),_0x99a1('0x57')]);return db[_0x99a1('0x3b')][_0x99a1('0x5a')](_['merge'](_0x22811f,_0x469e10[_0x99a1('0x58')]),{'include':_0x469e10['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x38ce3c){var _0x3f7c16=_0x469e10['user']['get']({'plain':!![]});if(!_0x3f7c16)throw new Error(_0x99a1('0x5b'));if(_0x3f7c16['role']===_0x99a1('0x5c')){var _0x263db3=_0x38ce3c[_0x99a1('0x34')]({'plain':!![]});var _0x180c1e='Trunks';return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x180c1e,'userProfileId':_0x3f7c16[_0x99a1('0x5e')]},'raw':!![]})['then'](function(_0x3a62c6){if(_0x3a62c6&&_0x3a62c6['autoAssociation']===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x263db3[_0x99a1('0x38')],'resourceId':_0x263db3['id'],'type':_0x3a62c6[_0x99a1('0x38')],'sectionId':_0x3a62c6['id']},{})[_0x99a1('0x1c')](function(){return _0x38ce3c;});}else{return _0x38ce3c;}})['catch'](function(_0x4d37f8){logger['error'](_0x99a1('0x5f'),_0x4d37f8);throw _0x4d37f8;});}return _0x38ce3c;});}})[_0x99a1('0x1c')](respondWithResult(_0x2b2d63,0xc9))['catch'](handleError(_0x2b2d63,null));};exports['create']=function(_0x1fe7af,_0x2f5587,_0x401c8f){var _0x509d4f;return db['Trunk'][_0x99a1('0x5a')](_0x1fe7af['body'],{'raw':!![]})[_0x99a1('0x1c')](function(_0x129690){_0x509d4f=_0x129690;return db[_0x99a1('0x3b')]['findAll']({'raw':!![]});})[_0x99a1('0x1c')](function(_0x28c7d8){var _0x4ac99e=fs['readFileSync'](path[_0x99a1('0x60')](config['root'],_0x99a1('0x61')),_0x99a1('0x62'));var _0x30a0a5=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x3d0ff6=ejs['render'](_0x4ac99e,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x65'),_0x3d0ff6);if(_0x509d4f[_0x99a1('0x66')]){var _0x1750d5=ejs[_0x99a1('0x67')](_0x30a0a5,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x68'),_0x1750d5);}})['then'](function(){return respondWithRpcPromise('Reload',_0x99a1('0x5a'),{'module':_0x99a1('0x69')});})[_0x99a1('0x1c')](function(){var _0x525969=_0x1fe7af[_0x99a1('0x5c')][_0x99a1('0x34')]({'plain':!![]});if(!_0x525969)throw new Error(_0x99a1('0x5b'));if(_0x525969[_0x99a1('0x6a')]===_0x99a1('0x5c')){var _0x4ae313=_0x509d4f[_0x99a1('0x34')]({'plain':!![]});return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x99a1('0x35'),'userProfileId':_0x525969[_0x99a1('0x5e')]},'raw':!![]})[_0x99a1('0x1c')](function(_0x5e42be){if(_0x5e42be&&_0x5e42be[_0x99a1('0x6b')]===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x4ae313[_0x99a1('0x38')],'resourceId':_0x4ae313['id'],'type':_0x5e42be[_0x99a1('0x38')],'sectionId':_0x5e42be['id']},{})['then'](function(){return _0x509d4f;});}else{return _0x509d4f;}})[_0x99a1('0x26')](function(_0x68c944){logger[_0x99a1('0x22')](_0x99a1('0x5f'),_0x68c944);throw _0x68c944;});}return _0x509d4f;})[_0x99a1('0x1c')](respondWithResult(_0x2f5587,0xc9))[_0x99a1('0x26')](handleError(_0x2f5587,null));};exports['update']=function(_0xaa953e,_0x33d96b,_0x4a5617){var _0x56716a;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0xaa953e['params']['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x33d96b,null))[_0x99a1('0x1c')](saveUpdates(_0xaa953e[_0x99a1('0x58')],null))[_0x99a1('0x1c')](function(_0x43156f){if(_0x43156f){_0x56716a=_0x43156f;return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});}})[_0x99a1('0x1c')](function(_0x4260d7){if(_0x4260d7){var _0x3e099c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],'server/files/templates/trunk.ejs'),_0x99a1('0x62'));var _0x5a9a7d=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0xbbbe26=ejs[_0x99a1('0x67')](_0x3e099c,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0xbbbe26);var _0x361ce6=ejs['render'](_0x5a9a7d,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x68'),_0x361ce6);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x70'),{'module':_0x99a1('0x69')});}return null;})[_0x99a1('0x1c')](function(_0x6dab29){if(_0x6dab29){return _0x56716a;}})[_0x99a1('0x1c')](respondWithResult(_0x33d96b,null))['catch'](handleError(_0x33d96b,null));};exports['destroy']=function(_0x51c289,_0x2dd29b,_0x353f25){var _0x53cdb3;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0x51c289[_0x99a1('0x55')]['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x2dd29b,null))['then'](removeEntity(_0x2dd29b,null))[_0x99a1('0x1c')](function(){return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});})[_0x99a1('0x1c')](function(_0x4e9fe9){var _0x24aa05=fs['readFileSync'](path['join'](config['root'],_0x99a1('0x61')),'utf8');var _0xb7744c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x444e43=ejs['render'](_0x24aa05,{'trunks':_0x4e9fe9});var _0x4fcd65=ejs[_0x99a1('0x67')](_0xb7744c,{'trunks':_0x4e9fe9});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0x444e43);fs['writeFileSync'](_0x99a1('0x68'),_0x4fcd65);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x33'),{'module':'chan_sip.so'});})[_0x99a1('0x26')](handleError(_0x2dd29b,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index a60fce4..6ee9793 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 _0xe253=['path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x79b53e,_0x108f8d){var _0x2d4d6c=function(_0x256d7f){while(--_0x256d7f){_0x79b53e['push'](_0x79b53e['shift']());}};_0x2d4d6c(++_0x108f8d);}(_0xe253,0x1bb));var _0x3e25=function(_0x14dcf8,_0x551815){_0x14dcf8=_0x14dcf8-0x0;var _0x53698e=_0xe253[_0x14dcf8];return _0x53698e;};'use strict';var _=require(_0x3e25('0x0'));var util=require(_0x3e25('0x1'));var logger=require(_0x3e25('0x2'))(_0x3e25('0x3'));var moment=require(_0x3e25('0x4'));var BPromise=require(_0x3e25('0x5'));var rp=require(_0x3e25('0x6'));var fs=require('fs');var path=require(_0x3e25('0x7'));var rimraf=require(_0x3e25('0x8'));var config=require(_0x3e25('0x9'));var attributes=require(_0x3e25('0xa'));module[_0x3e25('0xb')]=function(_0x498429,_0xd9cce5){return _0x498429[_0x3e25('0xc')](_0x3e25('0xd'),attributes,{'tableName':_0x3e25('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00f0=['exports','define','tools_trunks','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x3d8e70,_0x551cbf){var _0x168f81=function(_0x44968b){while(--_0x44968b){_0x3d8e70['push'](_0x3d8e70['shift']());}};_0x168f81(++_0x551cbf);}(_0x00f0,0x1c6));var _0x000f=function(_0x490117,_0x5e3b9d){_0x490117=_0x490117-0x0;var _0x55713c=_0x00f0[_0x490117];return _0x55713c;};'use strict';var _=require(_0x000f('0x0'));var util=require('util');var logger=require(_0x000f('0x1'))(_0x000f('0x2'));var moment=require(_0x000f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x000f('0x4'));var rimraf=require(_0x000f('0x5'));var config=require(_0x000f('0x6'));var attributes=require(_0x000f('0x7'));module[_0x000f('0x8')]=function(_0x486b01,_0x18c280){return _0x486b01[_0x000f('0x9')]('Trunk',attributes,{'tableName':_0x000f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 27f3ee7..e314f33 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 _0xae5d=['message','result','catch','GetTrunk','Trunk','findAll','options','raw','attributes','include','map','model','ShowTrunk','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s'];(function(_0x28d175,_0x5449c6){var _0x1ad2b0=function(_0x2cd124){while(--_0x2cd124){_0x28d175['push'](_0x28d175['shift']());}};_0x1ad2b0(++_0x5449c6);}(_0xae5d,0x1bf));var _0xdae5=function(_0x528497,_0x147e87){_0x528497=_0x528497-0x0;var _0x392d59=_0xae5d[_0x528497];return _0x392d59;};'use strict';var _=require(_0xdae5('0x0'));var util=require(_0xdae5('0x1'));var moment=require(_0xdae5('0x2'));var BPromise=require(_0xdae5('0x3'));var rs=require(_0xdae5('0x4'));var fs=require('fs');var Redis=require(_0xdae5('0x5'));var db=require(_0xdae5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdae5('0x7'))(_0xdae5('0x8'));var config=require(_0xdae5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdae5('0xa')][_0xdae5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf0b042,_0x2d1152,_0x2de0cb){return new BPromise(function(_0x248d14,_0x477102){return client['request'](_0xf0b042,_0x2de0cb)[_0xdae5('0xc')](function(_0x331bc2){logger[_0xdae5('0xd')]('Trunk,\x20%s,\x20%s',_0x2d1152,_0xdae5('0xe'));logger[_0xdae5('0xf')](_0xdae5('0x10'),_0x2d1152,_0xdae5('0xe'),JSON[_0xdae5('0x11')](_0x331bc2));if(_0x331bc2[_0xdae5('0x12')]){if(_0x331bc2[_0xdae5('0x12')][_0xdae5('0x13')]===0x1f4){logger[_0xdae5('0x12')](_0xdae5('0x14'),_0x2d1152,_0x331bc2[_0xdae5('0x12')]['message']);return _0x477102(_0x331bc2[_0xdae5('0x12')][_0xdae5('0x15')]);}logger[_0xdae5('0x12')](_0xdae5('0x14'),_0x2d1152,_0x331bc2[_0xdae5('0x12')]['message']);return _0x248d14(_0x331bc2['error'][_0xdae5('0x15')]);}else{logger[_0xdae5('0xd')]('Trunk,\x20%s,\x20%s',_0x2d1152,_0xdae5('0xe'));_0x248d14(_0x331bc2[_0xdae5('0x16')][_0xdae5('0x15')]);}})[_0xdae5('0x17')](function(_0x355e0f){logger[_0xdae5('0x12')](_0xdae5('0x14'),_0x2d1152,_0x355e0f);_0x477102(_0x355e0f);});});}exports[_0xdae5('0x18')]=function(_0xe16b02){var _0xe12615=this;return new Promise(function(_0x1664ca,_0xb3c32e){return db[_0xdae5('0x19')][_0xdae5('0x1a')]({'raw':_0xe16b02[_0xdae5('0x1b')]?_0xe16b02[_0xdae5('0x1b')][_0xdae5('0x1c')]===undefined?!![]:![]:!![],'where':_0xe16b02[_0xdae5('0x1b')]?_0xe16b02[_0xdae5('0x1b')]['where']||null:null,'attributes':_0xe16b02[_0xdae5('0x1b')]?_0xe16b02[_0xdae5('0x1b')][_0xdae5('0x1d')]||null:null,'limit':_0xe16b02[_0xdae5('0x1b')]?_0xe16b02[_0xdae5('0x1b')]['limit']||null:null,'include':_0xe16b02[_0xdae5('0x1b')]?_0xe16b02[_0xdae5('0x1b')][_0xdae5('0x1e')]?_[_0xdae5('0x1f')](_0xe16b02[_0xdae5('0x1b')]['include'],function(_0x4b5aee){return{'model':db[_0x4b5aee[_0xdae5('0x20')]],'as':_0x4b5aee['as'],'attributes':_0x4b5aee[_0xdae5('0x1d')],'include':_0x4b5aee[_0xdae5('0x1e')]?_[_0xdae5('0x1f')](_0x4b5aee[_0xdae5('0x1e')],function(_0x17c4b7){return{'model':db[_0x17c4b7[_0xdae5('0x20')]],'as':_0x17c4b7['as'],'attributes':_0x17c4b7[_0xdae5('0x1d')],'include':_0x17c4b7[_0xdae5('0x1e')]?_['map'](_0x17c4b7[_0xdae5('0x1e')],function(_0x49fedd){return{'model':db[_0x49fedd[_0xdae5('0x20')]],'as':_0x49fedd['as'],'attributes':_0x49fedd[_0xdae5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdae5('0xc')](function(_0x11dfcb){logger[_0xdae5('0xd')]('GetTrunk',_0xe16b02);logger['debug'](_0xdae5('0x18'),_0xe16b02,JSON[_0xdae5('0x11')](_0x11dfcb));_0x1664ca(_0x11dfcb);})[_0xdae5('0x17')](function(_0x434d82){logger[_0xdae5('0x12')](_0xdae5('0x18'),_0x434d82['message'],_0xe16b02);_0xb3c32e(_0xe12615['error'](0x1f4,_0x434d82[_0xdae5('0x15')]));});});};exports[_0xdae5('0x21')]=function(_0xabd0ff){var _0x4a7a5d=this;return new Promise(function(_0x24f7e6,_0x573367){return db['Trunk'][_0xdae5('0x22')]({'raw':_0xabd0ff['options']?_0xabd0ff[_0xdae5('0x1b')][_0xdae5('0x1c')]===undefined?!![]:![]:!![],'where':_0xabd0ff[_0xdae5('0x1b')]?_0xabd0ff[_0xdae5('0x1b')][_0xdae5('0x23')]||null:null,'attributes':_0xabd0ff[_0xdae5('0x1b')]?_0xabd0ff[_0xdae5('0x1b')][_0xdae5('0x1d')]||null:null,'include':_0xabd0ff[_0xdae5('0x1b')]?_0xabd0ff['options'][_0xdae5('0x1e')]?_[_0xdae5('0x1f')](_0xabd0ff[_0xdae5('0x1b')][_0xdae5('0x1e')],function(_0x2651fa){return{'model':db[_0x2651fa[_0xdae5('0x20')]],'as':_0x2651fa['as'],'attributes':_0x2651fa[_0xdae5('0x1d')],'include':_0x2651fa[_0xdae5('0x1e')]?_[_0xdae5('0x1f')](_0x2651fa[_0xdae5('0x1e')],function(_0x22e8ad){return{'model':db[_0x22e8ad['model']],'as':_0x22e8ad['as'],'attributes':_0x22e8ad[_0xdae5('0x1d')],'include':_0x22e8ad[_0xdae5('0x1e')]?_['map'](_0x22e8ad[_0xdae5('0x1e')],function(_0x456455){return{'model':db[_0x456455[_0xdae5('0x20')]],'as':_0x456455['as'],'attributes':_0x456455[_0xdae5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4aeaa7){logger[_0xdae5('0xd')](_0xdae5('0x21'),_0xabd0ff);logger[_0xdae5('0xf')](_0xdae5('0x21'),_0xabd0ff,JSON[_0xdae5('0x11')](_0x4aeaa7));_0x24f7e6(_0x4aeaa7);})[_0xdae5('0x17')](function(_0x585a9a){logger['error']('ShowTrunk',_0x585a9a[_0xdae5('0x15')],_0xabd0ff);_0x573367(_0x4a7a5d[_0xdae5('0x12')](0x1f4,_0x585a9a['message']));});});}; \ No newline at end of file +var _0x0ec8=['Trunk,\x20%s,\x20%s','message','result','catch','findAll','options','where','attributes','limit','map','include','model','then','debug','GetTrunk','stringify','ShowTrunk','find','raw','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0ec8,0x167));var _0x80ec=function(_0x2b2be6,_0x341100){_0x2b2be6=_0x2b2be6-0x0;var _0x89e6e5=_0x0ec8[_0x2b2be6];return _0x89e6e5;};'use strict';var _=require(_0x80ec('0x0'));var util=require(_0x80ec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x80ec('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80ec('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x80ec('0x4'))(_0x80ec('0x5'));var config=require(_0x80ec('0x6'));var jayson=require(_0x80ec('0x7'));var client=jayson[_0x80ec('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32ce88,_0x29955b,_0x15ffbe){return new BPromise(function(_0xf3188,_0x14bce4){return client[_0x80ec('0x9')](_0x32ce88,_0x15ffbe)['then'](function(_0x3d9b1e){logger[_0x80ec('0xa')]('Trunk,\x20%s,\x20%s',_0x29955b,_0x80ec('0xb'));logger['debug'](_0x80ec('0xc'),_0x29955b,_0x80ec('0xb'),JSON['stringify'](_0x3d9b1e));if(_0x3d9b1e['error']){if(_0x3d9b1e[_0x80ec('0xd')][_0x80ec('0xe')]===0x1f4){logger[_0x80ec('0xd')](_0x80ec('0xf'),_0x29955b,_0x3d9b1e['error'][_0x80ec('0x10')]);return _0x14bce4(_0x3d9b1e[_0x80ec('0xd')]['message']);}logger[_0x80ec('0xd')](_0x80ec('0xf'),_0x29955b,_0x3d9b1e[_0x80ec('0xd')][_0x80ec('0x10')]);return _0xf3188(_0x3d9b1e[_0x80ec('0xd')][_0x80ec('0x10')]);}else{logger[_0x80ec('0xa')]('Trunk,\x20%s,\x20%s',_0x29955b,'request\x20sent');_0xf3188(_0x3d9b1e[_0x80ec('0x11')][_0x80ec('0x10')]);}})[_0x80ec('0x12')](function(_0x3659f1){logger[_0x80ec('0xd')](_0x80ec('0xf'),_0x29955b,_0x3659f1);_0x14bce4(_0x3659f1);});});}exports['GetTrunk']=function(_0x3f194d){var _0x14e95e=this;return new Promise(function(_0x3090db,_0x48e3bf){return db['Trunk'][_0x80ec('0x13')]({'raw':_0x3f194d[_0x80ec('0x14')]?_0x3f194d[_0x80ec('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x3f194d[_0x80ec('0x14')]?_0x3f194d['options'][_0x80ec('0x15')]||null:null,'attributes':_0x3f194d[_0x80ec('0x14')]?_0x3f194d[_0x80ec('0x14')][_0x80ec('0x16')]||null:null,'limit':_0x3f194d[_0x80ec('0x14')]?_0x3f194d['options'][_0x80ec('0x17')]||null:null,'include':_0x3f194d['options']?_0x3f194d[_0x80ec('0x14')]['include']?_[_0x80ec('0x18')](_0x3f194d['options']['include'],function(_0x196024){return{'model':db[_0x196024['model']],'as':_0x196024['as'],'attributes':_0x196024[_0x80ec('0x16')],'include':_0x196024['include']?_[_0x80ec('0x18')](_0x196024[_0x80ec('0x19')],function(_0xf4436a){return{'model':db[_0xf4436a[_0x80ec('0x1a')]],'as':_0xf4436a['as'],'attributes':_0xf4436a[_0x80ec('0x16')],'include':_0xf4436a[_0x80ec('0x19')]?_[_0x80ec('0x18')](_0xf4436a['include'],function(_0x327606){return{'model':db[_0x327606['model']],'as':_0x327606['as'],'attributes':_0x327606['attributes']};}):[]};}):[]};}):[]:[]})[_0x80ec('0x1b')](function(_0x2cfb7c){logger[_0x80ec('0xa')]('GetTrunk',_0x3f194d);logger[_0x80ec('0x1c')](_0x80ec('0x1d'),_0x3f194d,JSON[_0x80ec('0x1e')](_0x2cfb7c));_0x3090db(_0x2cfb7c);})[_0x80ec('0x12')](function(_0x4d0546){logger[_0x80ec('0xd')](_0x80ec('0x1d'),_0x4d0546[_0x80ec('0x10')],_0x3f194d);_0x48e3bf(_0x14e95e[_0x80ec('0xd')](0x1f4,_0x4d0546[_0x80ec('0x10')]));});});};exports[_0x80ec('0x1f')]=function(_0x5ecfca){var _0x127cef=this;return new Promise(function(_0xa9f0ac,_0x4a4235){return db['Trunk'][_0x80ec('0x20')]({'raw':_0x5ecfca[_0x80ec('0x14')]?_0x5ecfca[_0x80ec('0x14')][_0x80ec('0x21')]===undefined?!![]:![]:!![],'where':_0x5ecfca['options']?_0x5ecfca['options'][_0x80ec('0x15')]||null:null,'attributes':_0x5ecfca[_0x80ec('0x14')]?_0x5ecfca[_0x80ec('0x14')]['attributes']||null:null,'include':_0x5ecfca[_0x80ec('0x14')]?_0x5ecfca['options'][_0x80ec('0x19')]?_['map'](_0x5ecfca[_0x80ec('0x14')][_0x80ec('0x19')],function(_0x5a9b08){return{'model':db[_0x5a9b08[_0x80ec('0x1a')]],'as':_0x5a9b08['as'],'attributes':_0x5a9b08[_0x80ec('0x16')],'include':_0x5a9b08[_0x80ec('0x19')]?_[_0x80ec('0x18')](_0x5a9b08[_0x80ec('0x19')],function(_0x28780b){return{'model':db[_0x28780b[_0x80ec('0x1a')]],'as':_0x28780b['as'],'attributes':_0x28780b[_0x80ec('0x16')],'include':_0x28780b['include']?_[_0x80ec('0x18')](_0x28780b[_0x80ec('0x19')],function(_0x2adbd0){return{'model':db[_0x2adbd0[_0x80ec('0x1a')]],'as':_0x2adbd0['as'],'attributes':_0x2adbd0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x17cbe0){logger[_0x80ec('0xa')]('ShowTrunk',_0x5ecfca);logger[_0x80ec('0x1c')](_0x80ec('0x1f'),_0x5ecfca,JSON[_0x80ec('0x1e')](_0x17cbe0));_0xa9f0ac(_0x17cbe0);})['catch'](function(_0x32c5cc){logger[_0x80ec('0xd')](_0x80ec('0x1f'),_0x32c5cc[_0x80ec('0x10')],_0x5ecfca);_0x4a4235(_0x127cef[_0x80ec('0xd')](0x1f4,_0x32c5cc[_0x80ec('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index bd438f2..70f5086 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 _0x6acb=['/:id','update','exports','express','Router','../../components/auth/service','./user-setting.controller','put'];(function(_0x5b4be0,_0x437d4e){var _0x20d112=function(_0x34823b){while(--_0x34823b){_0x5b4be0['push'](_0x5b4be0['shift']());}};_0x20d112(++_0x437d4e);}(_0x6acb,0x1a3));var _0xb6ac=function(_0x539bde,_0x14b7db){_0x539bde=_0x539bde-0x0;var _0x1718d4=_0x6acb[_0x539bde];return _0x1718d4;};'use strict';var express=require(_0xb6ac('0x0'));var router=express[_0xb6ac('0x1')]();var auth=require(_0xb6ac('0x2'));var controller=require(_0xb6ac('0x3'));router[_0xb6ac('0x4')](_0xb6ac('0x5'),auth['isAuthenticated'](),controller[_0xb6ac('0x6')]);module[_0xb6ac('0x7')]=router; \ No newline at end of file +var _0x2ee5=['isAuthenticated','update','express','Router','./user-setting.controller','put','/:id'];(function(_0x59b1e7,_0x8b07a6){var _0x22d24f=function(_0x4131fa){while(--_0x4131fa){_0x59b1e7['push'](_0x59b1e7['shift']());}};_0x22d24f(++_0x8b07a6);}(_0x2ee5,0x14b));var _0x52ee=function(_0xd41ece,_0x241cdb){_0xd41ece=_0xd41ece-0x0;var _0x5e2da2=_0x2ee5[_0xd41ece];return _0x5e2da2;};'use strict';var express=require(_0x52ee('0x0'));var router=express[_0x52ee('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x52ee('0x2'));router[_0x52ee('0x3')](_0x52ee('0x4'),auth[_0x52ee('0x5')](),controller[_0x52ee('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 22f24a5..ba9fa2a 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 _0xbfec=['INTEGER','error','warning','info','exports','BOOLEAN','DATE'];(function(_0x59d12e,_0x1128ff){var _0x2f5ee4=function(_0x213beb){while(--_0x213beb){_0x59d12e['push'](_0x59d12e['shift']());}};_0x2f5ee4(++_0x1128ff);}(_0xbfec,0xc5));var _0xcbfe=function(_0x5e863d,_0x608db1){_0x5e863d=_0x5e863d-0x0;var _0x474f4a=_0xbfec[_0x5e863d];return _0x474f4a;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xcbfe('0x0'),_0xcbfe('0x1'),_0xcbfe('0x2'),'debug'];module[_0xcbfe('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xcbfe('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xcbfe('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xcbfe('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xcbfe('0x6')],'unique':'UserId'}}; \ No newline at end of file +var _0x716f=['UserId','error','warning','info','debug','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x716f,0xc7));var _0xf716=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x716f[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xf716('0x0'),_0xf716('0x1'),_0xf716('0x2'),_0xf716('0x3')];module[_0xf716('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xf716('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xf716('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xf716('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xf716('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xf716('0x9')],'unique':_0xf716('0xa')}}; \ 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 60b377e..1321942 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 _0xf874=['redis','register','defaults','localhost','status','then','sendStatus','stack','name','update','role','Unauthorized','params','UserSetting','find','body','catch','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xf874,0xed));var _0x4f87=function(_0x43cdb4,_0x275cc3){_0x43cdb4=_0x43cdb4-0x0;var _0x1ef622=_0xf874[_0x43cdb4];return _0x1ef622;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0x4f87('0x0'))(_0x4f87('0x1'));var config=require(_0x4f87('0x2'));var db=require(_0x4f87('0x3'))['db'];var socket=require(_0x4f87('0x4'))(new Redis(config[_0x4f87('0x5')]));require('./user-setting.socket')[_0x4f87('0x6')](socket);config[_0x4f87('0x5')]=_[_0x4f87('0x7')](config[_0x4f87('0x5')],{'host':_0x4f87('0x8'),'port':0x18eb});function respondWithResult(_0x44fea6,_0x4a0662){_0x4a0662=_0x4a0662||0xc8;return function(_0x3a89e3){if(_0x3a89e3){return _0x44fea6[_0x4f87('0x9')](_0x4a0662)['json'](_0x3a89e3);}};}function saveUpdates(_0x38991f){return function(_0x363642){if(_0x363642){return _0x363642['update'](_0x38991f)[_0x4f87('0xa')](function(_0x1bf29c){return _0x1bf29c;});}return null;};}function handleEntityNotFound(_0x3493fb){return function(_0xbdd68f){if(!_0xbdd68f){_0x3493fb[_0x4f87('0xb')](0x194);}return _0xbdd68f;};}function handleError(_0x1edfc1,_0xb63ffc){_0xb63ffc=_0xb63ffc||0x1f4;return function(_0x510063){logger['error'](_0x510063[_0x4f87('0xc')]);if(_0x510063[_0x4f87('0xd')]){delete _0x510063[_0x4f87('0xd')];}_0x1edfc1['status'](_0xb63ffc)['send'](_0x510063);};}exports[_0x4f87('0xe')]=function(_0x430bc4,_0x3c4afd){if(_0x430bc4['user'][_0x4f87('0xf')]!=='admin')throw new Error(_0x4f87('0x10'));if(isNaN(Number(_0x430bc4[_0x4f87('0x11')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x4f87('0x12')][_0x4f87('0x13')]({'where':{'id':_0x430bc4[_0x4f87('0x11')]['id']}})[_0x4f87('0xa')](handleEntityNotFound(_0x3c4afd,null))[_0x4f87('0xa')](saveUpdates(_0x430bc4[_0x4f87('0x14')],null))['then'](respondWithResult(_0x3c4afd,null))[_0x4f87('0x15')](handleError(_0x3c4afd,null));}; \ No newline at end of file +var _0xe739=['name','send','user','role','Unauthorized','params','UserSetting','find','lodash','../../config/logger','api','../../config/environment','./user-setting.socket','register','redis','defaults','localhost','status','json','update','then','error','stack'];(function(_0x459d34,_0x3c66f2){var _0x154781=function(_0x21c96d){while(--_0x21c96d){_0x459d34['push'](_0x459d34['shift']());}};_0x154781(++_0x3c66f2);}(_0xe739,0x105));var _0x9e73=function(_0x1a1d2f,_0x5d1d5d){_0x1a1d2f=_0x1a1d2f-0x0;var _0x4b9093=_0xe739[_0x1a1d2f];return _0x4b9093;};'use strict';var _=require(_0x9e73('0x0'));var Redis=require('ioredis');var logger=require(_0x9e73('0x1'))(_0x9e73('0x2'));var config=require(_0x9e73('0x3'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9e73('0x4'))[_0x9e73('0x5')](socket);config[_0x9e73('0x6')]=_[_0x9e73('0x7')](config['redis'],{'host':_0x9e73('0x8'),'port':0x18eb});function respondWithResult(_0x26cb5b,_0xb37872){_0xb37872=_0xb37872||0xc8;return function(_0x5e46e7){if(_0x5e46e7){return _0x26cb5b[_0x9e73('0x9')](_0xb37872)[_0x9e73('0xa')](_0x5e46e7);}};}function saveUpdates(_0x471872){return function(_0x274187){if(_0x274187){return _0x274187[_0x9e73('0xb')](_0x471872)[_0x9e73('0xc')](function(_0x52393d){return _0x52393d;});}return null;};}function handleEntityNotFound(_0x33ce2d){return function(_0x5f06cb){if(!_0x5f06cb){_0x33ce2d['sendStatus'](0x194);}return _0x5f06cb;};}function handleError(_0x145c76,_0x530e27){_0x530e27=_0x530e27||0x1f4;return function(_0x186b89){logger[_0x9e73('0xd')](_0x186b89[_0x9e73('0xe')]);if(_0x186b89['name']){delete _0x186b89[_0x9e73('0xf')];}_0x145c76[_0x9e73('0x9')](_0x530e27)[_0x9e73('0x10')](_0x186b89);};}exports[_0x9e73('0xb')]=function(_0x5c1c3b,_0x27c0ba){if(_0x5c1c3b[_0x9e73('0x11')][_0x9e73('0x12')]!=='admin')throw new Error(_0x9e73('0x13'));if(isNaN(Number(_0x5c1c3b[_0x9e73('0x14')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x9e73('0x15')][_0x9e73('0x16')]({'where':{'id':_0x5c1c3b[_0x9e73('0x14')]['id']}})['then'](handleEntityNotFound(_0x27c0ba,null))[_0x9e73('0xc')](saveUpdates(_0x5c1c3b['body'],null))[_0x9e73('0xc')](respondWithResult(_0x27c0ba,null))['catch'](handleError(_0x27c0ba,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 d634251..6672c69 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 _0xf5ca=['emit','hasOwnProperty','hook','events','UserSetting','save','remove'];(function(_0x2e2b9f,_0x889cc1){var _0x38cf60=function(_0x8b0ed1){while(--_0x8b0ed1){_0x2e2b9f['push'](_0x2e2b9f['shift']());}};_0x38cf60(++_0x889cc1);}(_0xf5ca,0x13e));var _0xaf5c=function(_0x56af5c,_0x29e3b7){_0x56af5c=_0x56af5c-0x0;var _0x449bba=_0xf5ca[_0x56af5c];return _0x449bba;};'use strict';var EventEmitter=require(_0xaf5c('0x0'));var UserSetting=require('../../mysqldb')['db'][_0xaf5c('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf5c('0x2'),'afterUpdate':'update','afterDestroy':_0xaf5c('0x3')};function emitEvent(_0x36f432){return function(_0x534f9c,_0x15c282,_0x5ddb23){UserSettingEvents[_0xaf5c('0x4')](_0x36f432+':'+_0x534f9c['id'],_0x534f9c);UserSettingEvents['emit'](_0x36f432,_0x534f9c);_0x5ddb23(null);};}for(var e in events){if(events[_0xaf5c('0x5')](e)){var event=events[e];UserSetting[_0xaf5c('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x9ee3=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners'];(function(_0xb89c1c,_0x54b4cb){var _0x2f0be3=function(_0x103ae4){while(--_0x103ae4){_0xb89c1c['push'](_0xb89c1c['shift']());}};_0x2f0be3(++_0x54b4cb);}(_0x9ee3,0xe2));var _0x39ee=function(_0x5d99d6,_0x573a21){_0x5d99d6=_0x5d99d6-0x0;var _0x1a5423=_0x9ee3[_0x5d99d6];return _0x1a5423;};'use strict';var EventEmitter=require(_0x39ee('0x0'));var UserSetting=require(_0x39ee('0x1'))['db'][_0x39ee('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x39ee('0x3')](0x0);var events={'afterCreate':_0x39ee('0x4'),'afterUpdate':_0x39ee('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2ee92b){return function(_0x414bea,_0x5f4750,_0x4c2c04){UserSettingEvents['emit'](_0x2ee92b+':'+_0x414bea['id'],_0x414bea);UserSettingEvents[_0x39ee('0x6')](_0x2ee92b,_0x414bea);_0x4c2c04(null);};}for(var e in events){if(events[_0x39ee('0x7')](e)){var event=events[e];UserSetting[_0x39ee('0x8')](e,emitEvent(event));}}module[_0x39ee('0x9')]=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 cc7469e..46289b3 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 _0xb74d=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','UserSetting'];(function(_0x1ba4bd,_0x2e3473){var _0x3e3d53=function(_0xf0f5fa){while(--_0xf0f5fa){_0x1ba4bd['push'](_0x1ba4bd['shift']());}};_0x3e3d53(++_0x2e3473);}(_0xb74d,0x16e));var _0xdb74=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0xb74d[_0x173113];return _0x3bea89;};'use strict';var attributes=require(_0xdb74('0x0'));module['exports']=function(_0x350d0d){return _0x350d0d['define'](_0xdb74('0x1'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ba155){if(!_0x1ba155[_0xdb74('0x2')])_0x1ba155[_0xdb74('0x3')]=null;else if(_0x1ba155['clientSideLoggingEnabledSince']===null)_0x1ba155[_0xdb74('0x3')]=new Date();}}});}; \ No newline at end of file +var _0xb9be=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x3bddcc,_0x15574f){var _0x10afc1=function(_0x510d0c){while(--_0x510d0c){_0x3bddcc['push'](_0x3bddcc['shift']());}};_0x10afc1(++_0x15574f);}(_0xb9be,0xc5));var _0xeb9b=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0xb9be[_0x3f3f40];return _0x403b7a;};'use strict';var attributes=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]=function(_0x314d6e){return _0x314d6e[_0xeb9b('0x2')](_0xeb9b('0x3'),attributes,{'tableName':_0xeb9b('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2fbcda){if(!_0x2fbcda[_0xeb9b('0x5')])_0x2fbcda[_0xeb9b('0x6')]=null;else if(_0x2fbcda['clientSideLoggingEnabledSince']===null)_0x2fbcda['clientSideLoggingEnabledSince']=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 10fabf0..334f122 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 _0xeae6=['user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','remove','emit','user-setting:update'];(function(_0x4a5c95,_0x31a29b){var _0x238e7c=function(_0x2ff156){while(--_0x2ff156){_0x4a5c95['push'](_0x4a5c95['shift']());}};_0x238e7c(++_0x31a29b);}(_0xeae6,0xe1));var _0x6eae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeae6[_0x20a584];return _0x4b41a8;};'use strict';var UserSettingEvents=require(_0x6eae('0x0'));var events=[_0x6eae('0x1'),_0x6eae('0x2'),'update'];function createListener(_0x3dc3b8,_0x219436){return function(_0x1a2c08){_0x219436[_0x6eae('0x3')](_0x3dc3b8,_0x1a2c08);if(_0x3dc3b8===_0x6eae('0x4')){_0x219436[_0x6eae('0x3')](_0x6eae('0x5')+_0x1a2c08[_0x6eae('0x6')],_0x1a2c08);}};}exports[_0x6eae('0x7')]=function(_0xdef88f){for(var _0x2ba6e7=0x0,_0x5ac310=events[_0x6eae('0x8')];_0x2ba6e7<_0x5ac310;_0x2ba6e7++){var _0x185756=events[_0x2ba6e7];var _0x17df66=createListener(_0x6eae('0x9')+_0x185756,_0xdef88f);UserSettingEvents['on'](_0x185756,_0x17df66);}}; \ No newline at end of file +var _0xafe2=['register','length','user-setting:','save','update','emit','user-setting:update','user-setting:update:user-','UserId'];(function(_0x353c48,_0x55343a){var _0x1a6fa0=function(_0x376918){while(--_0x376918){_0x353c48['push'](_0x353c48['shift']());}};_0x1a6fa0(++_0x55343a);}(_0xafe2,0x1e0));var _0x2afe=function(_0x2753b5,_0xb1d0b6){_0x2753b5=_0x2753b5-0x0;var _0x16d631=_0xafe2[_0x2753b5];return _0x16d631;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x2afe('0x0'),'remove',_0x2afe('0x1')];function createListener(_0x50a973,_0x1a1b63){return function(_0x268d6e){_0x1a1b63[_0x2afe('0x2')](_0x50a973,_0x268d6e);if(_0x50a973===_0x2afe('0x3')){_0x1a1b63[_0x2afe('0x2')](_0x2afe('0x4')+_0x268d6e[_0x2afe('0x5')],_0x268d6e);}};}exports[_0x2afe('0x6')]=function(_0x5491ff){for(var _0x250982=0x0,_0x18f1db=events[_0x2afe('0x7')];_0x250982<_0x18f1db;_0x250982++){var _0xeaab4b=events[_0x250982];var _0x207f34=createListener(_0x2afe('0x8')+_0xeaab4b,_0x5491ff);UserSettingEvents['on'](_0xeaab4b,_0x207f34);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 1df951e..5be5566 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 _0x9209=['removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeApiKey','/:id/messengerSoundNotification','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/open_tabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/agents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','diskStorage','join','server/files/images/','%s-%s','now','originalname','/:id/avatar','single','file','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','/:id/queues','removeQueues','delete','removeTeams','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions'];(function(_0xdd31c,_0x484018){var _0x11b6ce=function(_0x178aca){while(--_0x178aca){_0xdd31c['push'](_0xdd31c['shift']());}};_0x11b6ce(++_0x484018);}(_0x9209,0x1ba));var _0x9920=function(_0x53e700,_0x58b114){_0x53e700=_0x53e700-0x0;var _0x430235=_0x9209[_0x53e700];return _0x430235;};'use strict';var multer=require(_0x9920('0x0'));var util=require(_0x9920('0x1'));var path=require(_0x9920('0x2'));var timeout=require(_0x9920('0x3'));var express=require(_0x9920('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9920('0x5'));var interaction=require(_0x9920('0x6'));var config=require(_0x9920('0x7'));var controller=require(_0x9920('0x8'));router['get']('/',auth[_0x9920('0x9')](),controller[_0x9920('0xa')]);router[_0x9920('0xb')](_0x9920('0xc'),auth[_0x9920('0x9')](),controller[_0x9920('0xd')]);router[_0x9920('0xb')](_0x9920('0xe'),auth[_0x9920('0x9')](),controller[_0x9920('0xf')]);router['get'](_0x9920('0x10'),auth[_0x9920('0x9')](),controller[_0x9920('0x11')]);router[_0x9920('0xb')](_0x9920('0x12'),auth[_0x9920('0x9')](),controller['show']);router[_0x9920('0xb')]('/:id/avatar',controller['getAvatar']);router[_0x9920('0xb')](_0x9920('0x13'),auth['isAuthenticated'](),controller['getOpenTabs']);router[_0x9920('0xb')](_0x9920('0x14'),auth['isAuthenticated'](),controller[_0x9920('0x15')]);router['get']('/:id/queues',auth[_0x9920('0x9')](),controller[_0x9920('0x16')]);router[_0x9920('0xb')](_0x9920('0x17'),auth['isAuthenticated'](),controller[_0x9920('0x18')]);router[_0x9920('0xb')]('/:id/groups',auth[_0x9920('0x9')](),controller[_0x9920('0x19')]);router[_0x9920('0xb')](_0x9920('0x1a'),auth[_0x9920('0x9')](),controller['getRecordings']);router['get'](_0x9920('0x1b'),auth['isAuthenticated'](),controller[_0x9920('0x1c')]);router[_0x9920('0xb')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x9920('0x1d')]);router[_0x9920('0xb')]('/:id/openchannel/interactions',auth[_0x9920('0x9')](),controller[_0x9920('0x1e')]);router[_0x9920('0xb')](_0x9920('0x1f'),auth[_0x9920('0x9')](),controller[_0x9920('0x20')]);router[_0x9920('0xb')](_0x9920('0x21'),auth[_0x9920('0x9')](),controller['getSmsInteractions']);router['get'](_0x9920('0x22'),auth[_0x9920('0x9')](),controller[_0x9920('0x23')]);router[_0x9920('0xb')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x9920('0x24')]);router[_0x9920('0xb')](_0x9920('0x25'),auth[_0x9920('0x9')](),controller[_0x9920('0x26')]);router[_0x9920('0xb')]('/:id/lists',auth[_0x9920('0x9')](),controller['getLists']);router[_0x9920('0xb')](_0x9920('0x27'),auth[_0x9920('0x9')](),controller['getAgents']);router[_0x9920('0xb')]('/:id/prefixes',auth[_0x9920('0x9')](),controller[_0x9920('0x28')]);router['get'](_0x9920('0x29'),auth[_0x9920('0x9')](),controller['getFaxAccounts']);router['get'](_0x9920('0x2a'),auth[_0x9920('0x9')](),controller[_0x9920('0x2b')]);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x9920('0x2c')]);router[_0x9920('0xb')](_0x9920('0x2d'),auth[_0x9920('0x9')](),controller[_0x9920('0x2e')]);router[_0x9920('0xb')](_0x9920('0x2f'),auth[_0x9920('0x9')](),controller[_0x9920('0x30')]);router[_0x9920('0xb')](_0x9920('0x31'),auth['isAuthenticated'](),controller[_0x9920('0x32')]);router[_0x9920('0xb')](_0x9920('0x33'),auth[_0x9920('0x9')](),controller[_0x9920('0x34')]);router[_0x9920('0xb')](_0x9920('0x35'),auth['isAuthenticated'](),controller[_0x9920('0x36')]);router['post']('/:id/contacts',auth[_0x9920('0x9')](),controller[_0x9920('0x37')]);router[_0x9920('0x38')]('/',auth[_0x9920('0x9')](),controller[_0x9920('0x39')]);router[_0x9920('0x38')](_0x9920('0x3a'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x9920('0x38')]('/:id/queues',auth[_0x9920('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0x9920('0x3b')]({'destination':function(_0x337e91,_0x1b337f,_0x21ea8a){_0x21ea8a(null,path[_0x9920('0x3c')](config['root'],_0x9920('0x3d')));},'filename':function(_0x22dd34,_0x142cc9,_0x509efb){_0x509efb(null,util['format'](_0x9920('0x3e'),Date[_0x9920('0x3f')](),_0x142cc9[_0x9920('0x40')]));}})});router[_0x9920('0x38')](_0x9920('0x41'),upload[_0x9920('0x42')](_0x9920('0x43')),controller['addAvatar']);router['post'](_0x9920('0x44'),auth[_0x9920('0x9')](),controller['login']);router[_0x9920('0x38')](_0x9920('0x45'),auth['isAuthenticated'](),controller[_0x9920('0x46')]);router[_0x9920('0x38')](_0x9920('0x47'),auth[_0x9920('0x9')](),controller[_0x9920('0x48')]);router[_0x9920('0x38')](_0x9920('0x49'),auth['isAuthenticated'](),controller[_0x9920('0x4a')]);router['post'](_0x9920('0x25'),auth[_0x9920('0x9')](),controller[_0x9920('0x4b')]);router[_0x9920('0x38')](_0x9920('0x4c'),auth[_0x9920('0x9')](),controller[_0x9920('0x4d')]);router['post'](_0x9920('0x4e'),auth['isAuthenticated'](),controller[_0x9920('0x4f')]);router[_0x9920('0x38')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x9920('0x50')]);router[_0x9920('0x38')](_0x9920('0x51'),auth[_0x9920('0x9')](),controller[_0x9920('0x52')]);router[_0x9920('0x38')]('/:id/openchannel_interactions',auth[_0x9920('0x9')](),controller['addOpenchannelInteractions']);router[_0x9920('0x38')](_0x9920('0x53'),auth[_0x9920('0x9')](),controller['addWhatsappInteractions']);router[_0x9920('0x38')](_0x9920('0x29'),auth[_0x9920('0x9')](),controller[_0x9920('0x54')]);router['post'](_0x9920('0x2a'),auth[_0x9920('0x9')](),controller['addMailAccounts']);router[_0x9920('0x38')](_0x9920('0x55'),auth[_0x9920('0x9')](),controller[_0x9920('0x56')]);router[_0x9920('0x38')](_0x9920('0x2d'),auth[_0x9920('0x9')](),controller[_0x9920('0x57')]);router[_0x9920('0x38')](_0x9920('0x2f'),auth[_0x9920('0x9')](),controller[_0x9920('0x58')]);router[_0x9920('0x38')](_0x9920('0x31'),auth[_0x9920('0x9')](),controller[_0x9920('0x59')]);router[_0x9920('0x38')](_0x9920('0x35'),auth[_0x9920('0x9')](),controller[_0x9920('0x5a')]);router[_0x9920('0x5b')](_0x9920('0x12'),auth['isAuthenticated'](),controller[_0x9920('0x5c')]);router[_0x9920('0x5b')](_0x9920('0x5d'),auth[_0x9920('0x9')](),controller['changePassword']);router['delete'](_0x9920('0x5e'),auth['isAuthenticated'](),controller[_0x9920('0x5f')]);router[_0x9920('0x60')](_0x9920('0x25'),auth[_0x9920('0x9')](),controller[_0x9920('0x61')]);router[_0x9920('0x60')](_0x9920('0x12'),auth[_0x9920('0x9')](),controller['destroy']);router[_0x9920('0x60')](_0x9920('0x4c'),auth[_0x9920('0x9')](),controller['removeChatInteractions']);router['delete'](_0x9920('0x4e'),auth['isAuthenticated'](),controller[_0x9920('0x62')]);router[_0x9920('0x60')](_0x9920('0x63'),auth[_0x9920('0x9')](),controller[_0x9920('0x64')]);router['delete'](_0x9920('0x51'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router['delete']('/:id/openchannel_interactions',auth[_0x9920('0x9')](),controller[_0x9920('0x65')]);router[_0x9920('0x60')]('/:id/whatsapp_interactions',auth[_0x9920('0x9')](),controller[_0x9920('0x66')]);router[_0x9920('0x60')](_0x9920('0x29'),auth[_0x9920('0x9')](),controller[_0x9920('0x67')]);router[_0x9920('0x60')]('/:id/mail_accounts',auth[_0x9920('0x9')](),controller['removeMailAccounts']);router[_0x9920('0x60')]('/:id/openchannel_accounts',auth[_0x9920('0x9')](),controller[_0x9920('0x68')]);router[_0x9920('0x60')](_0x9920('0x2d'),auth[_0x9920('0x9')](),controller[_0x9920('0x69')]);router[_0x9920('0x60')](_0x9920('0x2f'),auth[_0x9920('0x9')](),controller['removeChatWebsites']);router[_0x9920('0x60')](_0x9920('0x31'),auth[_0x9920('0x9')](),controller['removeWhatsappAccounts']);router[_0x9920('0x60')](_0x9920('0x35'),auth['isAuthenticated'](),controller[_0x9920('0x6a')]);router['post'](_0x9920('0x6b'),auth[_0x9920('0x9')](),controller['messengerSoundNotification']);module[_0x9920('0x6c')]=router; \ No newline at end of file +var _0x1015=['changePassword','delete','removeTeams','/:id','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/create_many','bulkCreate','/:id/queues','diskStorage','root','format','%s-%s','originalname','/:id/avatar','single','file','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','update','put','/:id/password'];(function(_0x19d494,_0x33670c){var _0x3d71f3=function(_0xf23452){while(--_0xf23452){_0x19d494['push'](_0x19d494['shift']());}};_0x3d71f3(++_0x33670c);}(_0x1015,0x85));var _0x5101=function(_0x2cd4d5,_0x1e4426){_0x2cd4d5=_0x2cd4d5-0x0;var _0x6362b=_0x1015[_0x2cd4d5];return _0x6362b;};'use strict';var multer=require(_0x5101('0x0'));var util=require(_0x5101('0x1'));var path=require(_0x5101('0x2'));var timeout=require(_0x5101('0x3'));var express=require(_0x5101('0x4'));var router=express[_0x5101('0x5')]();var fs_extra=require(_0x5101('0x6'));var auth=require(_0x5101('0x7'));var interaction=require(_0x5101('0x8'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x5101('0x9')]('/',auth[_0x5101('0xa')](),controller[_0x5101('0xb')]);router[_0x5101('0x9')](_0x5101('0xc'),auth[_0x5101('0xa')](),controller[_0x5101('0xd')]);router[_0x5101('0x9')](_0x5101('0xe'),auth[_0x5101('0xa')](),controller[_0x5101('0xf')]);router[_0x5101('0x9')](_0x5101('0x10'),auth[_0x5101('0xa')](),controller[_0x5101('0x11')]);router[_0x5101('0x9')]('/:id',auth[_0x5101('0xa')](),controller[_0x5101('0x12')]);router['get']('/:id/avatar',controller[_0x5101('0x13')]);router[_0x5101('0x9')](_0x5101('0x14'),auth[_0x5101('0xa')](),controller[_0x5101('0x15')]);router[_0x5101('0x9')](_0x5101('0x16'),auth[_0x5101('0xa')](),controller[_0x5101('0x17')]);router[_0x5101('0x9')]('/:id/queues',auth['isAuthenticated'](),controller[_0x5101('0x18')]);router['get'](_0x5101('0x19'),auth[_0x5101('0xa')](),controller[_0x5101('0x1a')]);router['get'](_0x5101('0x1b'),auth['isAuthenticated'](),controller[_0x5101('0x1c')]);router[_0x5101('0x9')]('/:id/recordings',auth[_0x5101('0xa')](),controller[_0x5101('0x1d')]);router[_0x5101('0x9')](_0x5101('0x1e'),auth[_0x5101('0xa')](),controller['getScreenRecordings']);router[_0x5101('0x9')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x5101('0x1f')]);router[_0x5101('0x9')](_0x5101('0x20'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x5101('0x9')](_0x5101('0x21'),auth[_0x5101('0xa')](),controller[_0x5101('0x22')]);router[_0x5101('0x9')](_0x5101('0x23'),auth[_0x5101('0xa')](),controller[_0x5101('0x24')]);router[_0x5101('0x9')](_0x5101('0x25'),auth[_0x5101('0xa')](),controller[_0x5101('0x26')]);router[_0x5101('0x9')]('/:id/whatsapp/interactions',auth[_0x5101('0xa')](),controller['getWhatsappInteractions']);router[_0x5101('0x9')](_0x5101('0x27'),auth[_0x5101('0xa')](),controller[_0x5101('0x28')]);router[_0x5101('0x9')]('/:id/lists',auth[_0x5101('0xa')](),controller[_0x5101('0x29')]);router[_0x5101('0x9')](_0x5101('0x2a'),auth['isAuthenticated'](),controller[_0x5101('0x2b')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x5101('0x9')](_0x5101('0x2c'),auth[_0x5101('0xa')](),controller[_0x5101('0x2d')]);router[_0x5101('0x9')](_0x5101('0x2e'),auth[_0x5101('0xa')](),controller['getMailAccounts']);router[_0x5101('0x9')](_0x5101('0x2f'),auth[_0x5101('0xa')](),controller[_0x5101('0x30')]);router[_0x5101('0x9')](_0x5101('0x31'),auth['isAuthenticated'](),controller[_0x5101('0x32')]);router[_0x5101('0x9')](_0x5101('0x33'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x5101('0x9')](_0x5101('0x34'),auth[_0x5101('0xa')](),controller[_0x5101('0x35')]);router['get'](_0x5101('0x36'),auth[_0x5101('0xa')](),controller[_0x5101('0x37')]);router[_0x5101('0x9')](_0x5101('0x38'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x5101('0x39')](_0x5101('0x16'),auth[_0x5101('0xa')](),controller['addContacts']);router[_0x5101('0x39')]('/',auth[_0x5101('0xa')](),controller['create']);router['post'](_0x5101('0x3a'),auth['isAuthenticated'](),controller[_0x5101('0x3b')]);router[_0x5101('0x39')](_0x5101('0x3c'),auth[_0x5101('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x5101('0x3d')]({'destination':function(_0x568d4b,_0x2a374f,_0x15cefd){_0x15cefd(null,path['join'](config[_0x5101('0x3e')],'server/files/images/'));},'filename':function(_0x28b7aa,_0x2df414,_0x1790e0){_0x1790e0(null,util[_0x5101('0x3f')](_0x5101('0x40'),Date['now'](),_0x2df414[_0x5101('0x41')]));}})});router[_0x5101('0x39')](_0x5101('0x42'),upload[_0x5101('0x43')](_0x5101('0x44')),controller['addAvatar']);router['post']('/:id/login',auth[_0x5101('0xa')](),controller[_0x5101('0x45')]);router['post'](_0x5101('0x46'),auth['isAuthenticated'](),controller[_0x5101('0x47')]);router[_0x5101('0x39')](_0x5101('0x48'),auth['isAuthenticated'](),controller[_0x5101('0x49')]);router[_0x5101('0x39')](_0x5101('0x4a'),auth[_0x5101('0xa')](),controller[_0x5101('0x4b')]);router[_0x5101('0x39')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x5101('0x39')](_0x5101('0x4c'),auth['isAuthenticated'](),controller['addChatInteractions']);router['post'](_0x5101('0x4d'),auth[_0x5101('0xa')](),controller[_0x5101('0x4e')]);router[_0x5101('0x39')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x5101('0x4f')]);router['post'](_0x5101('0x50'),auth[_0x5101('0xa')](),controller['addSmsInteractions']);router[_0x5101('0x39')](_0x5101('0x51'),auth[_0x5101('0xa')](),controller[_0x5101('0x52')]);router[_0x5101('0x39')](_0x5101('0x53'),auth[_0x5101('0xa')](),controller['addWhatsappInteractions']);router[_0x5101('0x39')]('/:id/fax_accounts',auth[_0x5101('0xa')](),controller[_0x5101('0x54')]);router[_0x5101('0x39')](_0x5101('0x2e'),auth[_0x5101('0xa')](),controller[_0x5101('0x55')]);router[_0x5101('0x39')](_0x5101('0x2f'),auth[_0x5101('0xa')](),controller[_0x5101('0x56')]);router[_0x5101('0x39')]('/:id/sms_accounts',auth[_0x5101('0xa')](),controller['addSmsAccounts']);router[_0x5101('0x39')](_0x5101('0x33'),auth[_0x5101('0xa')](),controller[_0x5101('0x57')]);router[_0x5101('0x39')](_0x5101('0x34'),auth[_0x5101('0xa')](),controller[_0x5101('0x58')]);router[_0x5101('0x39')]('/:id/api_key',auth[_0x5101('0xa')](),controller[_0x5101('0x59')]);router['put']('/:id',auth[_0x5101('0xa')](),controller[_0x5101('0x5a')]);router[_0x5101('0x5b')](_0x5101('0x5c'),auth[_0x5101('0xa')](),controller[_0x5101('0x5d')]);router[_0x5101('0x5e')](_0x5101('0x3c'),auth['isAuthenticated'](),controller['removeQueues']);router[_0x5101('0x5e')](_0x5101('0x27'),auth[_0x5101('0xa')](),controller[_0x5101('0x5f')]);router[_0x5101('0x5e')](_0x5101('0x60'),auth['isAuthenticated'](),controller[_0x5101('0x61')]);router['delete'](_0x5101('0x4c'),auth[_0x5101('0xa')](),controller[_0x5101('0x62')]);router[_0x5101('0x5e')](_0x5101('0x4d'),auth[_0x5101('0xa')](),controller[_0x5101('0x63')]);router['delete'](_0x5101('0x64'),auth[_0x5101('0xa')](),controller[_0x5101('0x65')]);router[_0x5101('0x5e')]('/:id/sms_interactions',auth[_0x5101('0xa')](),controller[_0x5101('0x66')]);router['delete'](_0x5101('0x51'),auth[_0x5101('0xa')](),controller[_0x5101('0x67')]);router[_0x5101('0x5e')](_0x5101('0x53'),auth[_0x5101('0xa')](),controller['removeWhatsappInteractions']);router[_0x5101('0x5e')](_0x5101('0x2c'),auth[_0x5101('0xa')](),controller[_0x5101('0x68')]);router['delete'](_0x5101('0x2e'),auth['isAuthenticated'](),controller[_0x5101('0x69')]);router[_0x5101('0x5e')](_0x5101('0x2f'),auth['isAuthenticated'](),controller[_0x5101('0x6a')]);router[_0x5101('0x5e')](_0x5101('0x31'),auth[_0x5101('0xa')](),controller[_0x5101('0x6b')]);router['delete'](_0x5101('0x33'),auth[_0x5101('0xa')](),controller[_0x5101('0x6c')]);router['delete'](_0x5101('0x34'),auth['isAuthenticated'](),controller[_0x5101('0x6d')]);router[_0x5101('0x5e')](_0x5101('0x38'),auth['isAuthenticated'](),controller[_0x5101('0x6e')]);router[_0x5101('0x39')]('/:id/messengerSoundNotification',auth[_0x5101('0xa')](),controller[_0x5101('0x6f')]);module[_0x5101('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index a253599..0f4c52b 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 _0x248e=['info','inband','auto','yes','nonat','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','split','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','originate','uac','uas','active','passive','actpass','update','update,nonat','TEXT','transport','wss','encryption','avpf','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','icesupport','dtlsenable','dtlssetup','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','email','ENUM','admin','user','local','internal','accountcode','getDataValue','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','dynamic','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x248e,0x1e8));var _0xe248=function(_0x5c78ff,_0x3a219f){_0x5c78ff=_0x5c78ff-0x0;var _0x50a1fa=_0x248e[_0x5c78ff];return _0x50a1fa;};'use strict';var Sequelize=require(_0xe248('0x0'));var moment=require(_0xe248('0x1'));var util=require('util');var _=require(_0xe248('0x2'));module[_0xe248('0x3')]={'name':{'type':Sequelize[_0xe248('0x4')],'allowNull':![],'unique':_0xe248('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4a041b){this['setDataValue'](_0xe248('0x5'),_0x4a041b);this[_0xe248('0x6')](_0xe248('0x7'),_0x4a041b);},'comment':_0xe248('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x58fe76){this[_0xe248('0x6')](_0xe248('0x9'),_0x58fe76);this['setDataValue'](_0xe248('0xa'),util[_0xe248('0xb')](_0xe248('0xc'),_0x58fe76,this['getDataValue']('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xe248('0x4')],'allowNull':![],'unique':_0xe248('0xd'),'validate':{'isEmail':!![]},'set':function(_0xfd59b4){if(_0xfd59b4){this['setDataValue']('email',_0xfd59b4['toLowerCase']());}}},'role':{'type':Sequelize[_0xe248('0xe')](_0xe248('0xf'),_0xe248('0x10'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xe248('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe248('0x4')],'defaultValue':_0xe248('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xe248('0x12'),'set':function(_0x353a6c){this[_0xe248('0x6')](_0xe248('0x12'),_0x353a6c);this[_0xe248('0x6')](_0xe248('0x13'),_0x353a6c);this[_0xe248('0x6')](_0xe248('0xa'),util['format']('\x22%s\x22\x20<%s>',this[_0xe248('0x14')]('fullname'),_0x353a6c));}},'salt':{'type':Sequelize[_0xe248('0x4')]},'phone':{'type':Sequelize[_0xe248('0x4')]},'mobile':{'type':Sequelize[_0xe248('0x4')]},'address':{'type':Sequelize[_0xe248('0x4')]},'zipcode':{'type':Sequelize[_0xe248('0x4')]},'userpic':{'type':Sequelize[_0xe248('0x4')]},'city':{'type':Sequelize[_0xe248('0x4')]},'country':{'type':Sequelize[_0xe248('0x4')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xe248('0x15')]},'voicePause':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xe248('0x4')],'defaultValue':_0xe248('0x17')},'lastPauseAt':{'type':Sequelize[_0xe248('0x15')]},'chatCapacity':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xe248('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe248('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xe248('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![],'defaultValue':_0xe248('0x19')},'ipaddr':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0xe248('0x10'),_0xe248('0x1a')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![],'defaultValue':_0xe248('0x1b')},'callingpres':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x1c'),_0xe248('0x1d'),_0xe248('0x1e'),_0xe248('0x1f'),_0xe248('0x20'),_0xe248('0x21'),_0xe248('0x22'),_0xe248('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe248('0x24'),'set':function(_0x548d89){this[_0xe248('0x6')]('transport',_0x548d89?_0x548d89[_0xe248('0x25')](','):null);},'get':function(){return this[_0xe248('0x14')]('transport')?this[_0xe248('0x14')]('transport')['split'](','):null;},'comment':_0xe248('0x26')},'dtmfmode':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x27'),_0xe248('0x28'),'shortinfo',_0xe248('0x29'),_0xe248('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0xe248('0x2b'),'no',_0xe248('0x2c'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x29cf80){this[_0xe248('0x6')]('nat',_0x29cf80?_0x29cf80['join'](','):null);},'get':function(){return this['getDataValue'](_0xe248('0x2d'))?this['getDataValue'](_0xe248('0x2d'))['split'](','):null;},'comment':_0xe248('0x2e')},'callgroup':{'type':Sequelize[_0xe248('0x4')]},'namedcallgroup':{'type':Sequelize[_0xe248('0x4')]},'pickupgroup':{'type':Sequelize[_0xe248('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe248('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xe248('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x25ec9e){this[_0xe248('0x6')](_0xe248('0x2f'),_0x25ec9e?_0x25ec9e[_0xe248('0x25')](';'):_0xe248('0x30'));},'get':function(){return this[_0xe248('0x14')](_0xe248('0x2f'))?this[_0xe248('0x14')](_0xe248('0x2f'))[_0xe248('0x31')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xe248('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x4f3ed5){this[_0xe248('0x6')](_0xe248('0x32'),_0x4f3ed5?_0x4f3ed5[_0xe248('0x25')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xe248('0x14')](_0xe248('0x32'))['split'](','):null;},'comment':_0xe248('0x33')},'trustrpid':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe248('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no',_0xe248('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe248('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xe248('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xe248('0x2b')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xe248('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x36'),'refuse',_0xe248('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x38'),_0xe248('0x39')),'allowNull':!![],'defaultValue':_0xe248('0x39')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xe248('0x2b')},'keepalive':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xe248('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xe248('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xe248('0x3a'),_0xe248('0x3b'),_0xe248('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xe248('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xe248('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no','nonat',_0xe248('0x3d'),_0xe248('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe248('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xe248('0x15')]},'passwordResetAt':{'type':Sequelize[_0xe248('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xe248('0x3f')]},'showWebBar':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0,'set':function(_0x49588b){this['setDataValue']('showWebBar',_0x49588b);var _0x76ffe4=this['get']({'plain':!![]});switch(_0x49588b){case 0x0:case 0x1:var _0x3a3ea5=_0x76ffe4[_0xe248('0x40')]?_['isArray'](_0x76ffe4[_0xe248('0x40')])?_0x76ffe4[_0xe248('0x40')][_0xe248('0x25')]():_0x76ffe4[_0xe248('0x40')]:_0xe248('0x24');if(_0x3a3ea5===_0xe248('0x41')){_0x3a3ea5=_0xe248('0x24');}this[_0xe248('0x6')](_0xe248('0x40'),_0x3a3ea5);this[_0xe248('0x6')](_0xe248('0x42'),'no');this['setDataValue'](_0xe248('0x43'),null);this[_0xe248('0x6')]('force_avp',null);this[_0xe248('0x6')]('icesupport',null);this[_0xe248('0x6')]('dtlsenable',null);this[_0xe248('0x6')](_0xe248('0x44'),null);this['setDataValue']('dtlssetup',null);this[_0xe248('0x6')](_0xe248('0x45'),null);this[_0xe248('0x6')](_0xe248('0x46'),null);this[_0xe248('0x6')](_0xe248('0x47'),'no');break;case 0x2:this['setDataValue']('transport','wss');this['setDataValue'](_0xe248('0x42'),_0xe248('0x2b'));this[_0xe248('0x6')](_0xe248('0x43'),'yes');this['setDataValue'](_0xe248('0x48'),_0xe248('0x2b'));this[_0xe248('0x6')](_0xe248('0x49'),'yes');this[_0xe248('0x6')](_0xe248('0x4a'),_0xe248('0x2b'));this[_0xe248('0x6')](_0xe248('0x44'),'no');this[_0xe248('0x6')](_0xe248('0x4b'),_0xe248('0x3c'));this[_0xe248('0x6')](_0xe248('0x45'),_0x76ffe4['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0xe248('0x6')](_0xe248('0x46'),_0x76ffe4[_0xe248('0x46')]||_0xe248('0x4c'));this['setDataValue'](_0xe248('0x47'),_0xe248('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0xe248('0x3f')],'set':function(_0x1b9334){this['setDataValue'](_0xe248('0x4d'),_0x1b9334?_0x1b9334[_0xe248('0x25')](','):[]);},'get':function(){return this[_0xe248('0x14')]('permissions')?_[_0xe248('0x4e')](this[_0xe248('0x14')](_0xe248('0x4d'))[_0xe248('0x31')](','),function(_0x91f010){return parseInt(_0x91f010,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xe248('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xe248('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xe248('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xe248('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe248('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xe248('0xe')](_0xe248('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xe248('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xe248('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe248('0x4f')],'get':function(){return this[_0xe248('0x14')](_0xe248('0x50'))?this['getDataValue'](_0xe248('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xe248('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xe248('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3f6af8){if(typeof _0x3f6af8==='string'){var _0x3c814c=_0x3f6af8==='1'?!![]:_0x3f6af8==='0'?![]:_0x3f6af8===_0xe248('0x51')?!![]:_0x3f6af8===_0xe248('0x52')?![]:![];this[_0xe248('0x6')](_0xe248('0x53'),_0x3c814c);}else{this[_0xe248('0x6')]('screenrecording',_0x3f6af8);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x39c86e){this['setDataValue'](_0xe248('0x54'),_0x39c86e);if(_0x39c86e===!![]){this['setDataValue']('blockedAt',moment());this['setDataValue'](_0xe248('0x55'),0x0);}else{this[_0xe248('0x6')](_0xe248('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xe248('0x18')](0x5)[_0xe248('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xe248('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe248('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xe248('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xe248('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0xd30f=['user','agent','telephone','local','INTEGER','internal','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','rfc2833','yes','nonat','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas','certificate','active','passive','actpass','TEXT','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','email','ENUM','admin'];(function(_0x3a522d,_0x54e1d7){var _0x275450=function(_0x58b515){while(--_0x58b515){_0x3a522d['push'](_0x3a522d['shift']());}};_0x275450(++_0x54e1d7);}(_0xd30f,0xa9));var _0xfd30=function(_0x3f8160,_0x33d946){_0x3f8160=_0x3f8160-0x0;var _0x497b06=_0xd30f[_0x3f8160];return _0x497b06;};'use strict';var Sequelize=require(_0xfd30('0x0'));var moment=require(_0xfd30('0x1'));var util=require(_0xfd30('0x2'));var _=require(_0xfd30('0x3'));module[_0xfd30('0x4')]={'name':{'type':Sequelize[_0xfd30('0x5')],'allowNull':![],'unique':_0xfd30('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x7a89da){this[_0xfd30('0x7')]('name',_0x7a89da);this[_0xfd30('0x7')](_0xfd30('0x8'),_0x7a89da);},'comment':_0xfd30('0x9')},'fullname':{'type':Sequelize[_0xfd30('0x5')],'allowNull':![],'set':function(_0x1732f9){this[_0xfd30('0x7')](_0xfd30('0xa'),_0x1732f9);this['setDataValue'](_0xfd30('0xb'),util[_0xfd30('0xc')](_0xfd30('0xd'),_0x1732f9,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0xfd30('0x5')]},'email':{'type':Sequelize[_0xfd30('0x5')],'allowNull':![],'unique':_0xfd30('0xe'),'validate':{'isEmail':!![]},'set':function(_0x234221){if(_0x234221){this[_0xfd30('0x7')](_0xfd30('0xe'),_0x234221['toLowerCase']());}}},'role':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x10'),_0xfd30('0x11'),_0xfd30('0x12'),_0xfd30('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xfd30('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xfd30('0x5')],'defaultValue':_0xfd30('0x14')},'internal':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':![],'unique':'internal','set':function(_0x404d3f){this['setDataValue'](_0xfd30('0x16'),_0x404d3f);this[_0xfd30('0x7')]('accountcode',_0x404d3f);this[_0xfd30('0x7')](_0xfd30('0xb'),util[_0xfd30('0xc')](_0xfd30('0xd'),this[_0xfd30('0x17')](_0xfd30('0xa')),_0x404d3f));}},'salt':{'type':Sequelize[_0xfd30('0x5')]},'phone':{'type':Sequelize[_0xfd30('0x5')]},'mobile':{'type':Sequelize[_0xfd30('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xfd30('0x5')]},'userpic':{'type':Sequelize[_0xfd30('0x5')]},'city':{'type':Sequelize[_0xfd30('0x5')]},'country':{'type':Sequelize[_0xfd30('0x5')]},'online':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xfd30('0x19')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xfd30('0x5')],'defaultValue':_0xfd30('0x1a')},'lastPauseAt':{'type':Sequelize[_0xfd30('0x19')]},'chatCapacity':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xfd30('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xfd30('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xfd30('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x1b'),'user',_0xfd30('0x1c')),'allowNull':!![],'defaultValue':_0xfd30('0x1b')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xfd30('0x1d')},'callingpres':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x1e'),'ALLOWED_PASSED_SCREEN',_0xfd30('0x1f'),_0xfd30('0x20'),_0xfd30('0x21'),'PROHIB_PASSED_SCREEN',_0xfd30('0x22'),_0xfd30('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xfd30('0x24'),'set':function(_0xee5832){this[_0xfd30('0x7')]('transport',_0xee5832?_0xee5832[_0xfd30('0x25')](','):null);},'get':function(){return this[_0xfd30('0x17')](_0xfd30('0x26'))?this[_0xfd30('0x17')](_0xfd30('0x26'))[_0xfd30('0x27')](','):null;},'comment':_0xfd30('0x28')},'dtmfmode':{'type':Sequelize[_0xfd30('0xf')]('rfc2833',_0xfd30('0x29'),_0xfd30('0x2a'),'inband','auto'),'allowNull':!![],'defaultValue':_0xfd30('0x2b')},'directmedia':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no',_0xfd30('0x2d'),'update',_0xfd30('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xfd30('0x2f'),'set':function(_0x5dff4a){this[_0xfd30('0x7')](_0xfd30('0x30'),_0x5dff4a?_0x5dff4a[_0xfd30('0x25')](','):null);},'get':function(){return this[_0xfd30('0x17')](_0xfd30('0x30'))?this[_0xfd30('0x17')](_0xfd30('0x30'))[_0xfd30('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xfd30('0x5')]},'namedcallgroup':{'type':Sequelize[_0xfd30('0x5')]},'pickupgroup':{'type':Sequelize[_0xfd30('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xfd30('0x5')]},'language':{'type':Sequelize[_0xfd30('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xfd30('0x5')]},'disallow':{'type':Sequelize[_0xfd30('0x5')],'allowNull':![],'defaultValue':_0xfd30('0x31')},'allow':{'type':Sequelize[_0xfd30('0x5')],'allowNull':![],'defaultValue':_0xfd30('0x32'),'set':function(_0x1c49ff){this[_0xfd30('0x7')]('allow',_0x1c49ff?_0x1c49ff[_0xfd30('0x25')](';'):_0xfd30('0x32'));},'get':function(){return this[_0xfd30('0x17')]('allow')?this[_0xfd30('0x17')](_0xfd30('0x33'))[_0xfd30('0x27')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![],'set':function(_0x5ca79b){this[_0xfd30('0x7')]('insecure',_0x5ca79b?_0x5ca79b[_0xfd30('0x25')](','):null);},'get':function(){return this['getDataValue'](_0xfd30('0x34'))?this['getDataValue'](_0xfd30('0x34'))[_0xfd30('0x27')](','):null;},'comment':_0xfd30('0x35')},'trustrpid':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xfd30('0x2c'),'no',_0xfd30('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xfd30('0x37')},'amaflags':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0xfd30('0x2c')},'busylevel':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xfd30('0x2c'),'no',_0xfd30('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x39'),'refuse',_0xfd30('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x3b'),'uas'),'allowNull':!![],'defaultValue':_0xfd30('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0xfd30('0x2c')},'keepalive':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xfd30('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xfd30('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no','fingerprint',_0xfd30('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xfd30('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x3e'),_0xfd30('0x3f'),_0xfd30('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xfd30('0xf')](_0xfd30('0x2c'),'no',_0xfd30('0x2d'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xfd30('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xfd30('0x19')]},'passwordResetAt':{'type':Sequelize[_0xfd30('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xfd30('0x41')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x424e76){this[_0xfd30('0x7')](_0xfd30('0x42'),_0x424e76);var _0x49e101=this[_0xfd30('0x43')]({'plain':!![]});switch(_0x424e76){case 0x0:case 0x1:var _0xcaf46e=_0x49e101[_0xfd30('0x26')]?_[_0xfd30('0x44')](_0x49e101[_0xfd30('0x26')])?_0x49e101['transport'][_0xfd30('0x25')]():_0x49e101['transport']:'udp';if(_0xcaf46e===_0xfd30('0x45')){_0xcaf46e=_0xfd30('0x24');}this[_0xfd30('0x7')](_0xfd30('0x26'),_0xcaf46e);this[_0xfd30('0x7')](_0xfd30('0x46'),'no');this[_0xfd30('0x7')]('avpf',null);this[_0xfd30('0x7')](_0xfd30('0x47'),null);this['setDataValue'](_0xfd30('0x48'),null);this['setDataValue'](_0xfd30('0x49'),null);this[_0xfd30('0x7')](_0xfd30('0x4a'),null);this[_0xfd30('0x7')](_0xfd30('0x4b'),null);this[_0xfd30('0x7')](_0xfd30('0x4c'),null);this['setDataValue'](_0xfd30('0x4d'),null);this[_0xfd30('0x7')](_0xfd30('0x4e'),'no');break;case 0x2:this[_0xfd30('0x7')]('transport',_0xfd30('0x45'));this[_0xfd30('0x7')](_0xfd30('0x46'),_0xfd30('0x2c'));this[_0xfd30('0x7')](_0xfd30('0x4f'),'yes');this[_0xfd30('0x7')]('force_avp',_0xfd30('0x2c'));this[_0xfd30('0x7')](_0xfd30('0x48'),_0xfd30('0x2c'));this[_0xfd30('0x7')]('dtlsenable',_0xfd30('0x2c'));this['setDataValue'](_0xfd30('0x4a'),'no');this[_0xfd30('0x7')]('dtlssetup',_0xfd30('0x40'));this[_0xfd30('0x7')](_0xfd30('0x4c'),_0x49e101[_0xfd30('0x4c')]||_0xfd30('0x50'));this[_0xfd30('0x7')](_0xfd30('0x4d'),_0x49e101['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0xfd30('0x7')](_0xfd30('0x4e'),_0xfd30('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0xfd30('0x41')],'set':function(_0x4609d2){this[_0xfd30('0x7')](_0xfd30('0x51'),_0x4609d2?_0x4609d2['join'](','):[]);},'get':function(){return this['getDataValue'](_0xfd30('0x51'))?_[_0xfd30('0x52')](this[_0xfd30('0x17')](_0xfd30('0x51'))[_0xfd30('0x27')](','),function(_0x2abde4){return parseInt(_0x2abde4,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xfd30('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xfd30('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xfd30('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xfd30('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xfd30('0x53')],'get':function(){return this[_0xfd30('0x17')](_0xfd30('0x54'))?this['getDataValue'](_0xfd30('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0xfd30('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xfd30('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x57c57e){if(typeof _0x57c57e===_0xfd30('0x55')){var _0xadb835=_0x57c57e==='1'?!![]:_0x57c57e==='0'?![]:_0x57c57e===_0xfd30('0x56')?!![]:_0x57c57e===_0xfd30('0x57')?![]:![];this[_0xfd30('0x7')](_0xfd30('0x58'),_0xadb835);}else{this[_0xfd30('0x7')](_0xfd30('0x58'),_0x57c57e);}}},'blocked':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![],'set':function(_0x5077be){this[_0xfd30('0x7')](_0xfd30('0x59'),_0x5077be);if(_0x5077be===!![]){this[_0xfd30('0x7')](_0xfd30('0x5a'),moment());this['setDataValue'](_0xfd30('0x5b'),0x0);}else{this[_0xfd30('0x7')](_0xfd30('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0xfd30('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xfd30('0x15')](0x5)[_0xfd30('0x5c')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xfd30('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xfd30('0x18')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 995aadc..b436a5b 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 _0xc106=['removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','lastName','CmContact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','ringing','inbound','flatten','toString','col','asc','desc','substring','uniqBy','getRealtimeAgents','offline','pause','voiceStatus','unavailable','slice','charAt','toUpperCase','QueryTypes','select','field','ui.','ui.createdAt','user_has_','_interactions','OpenTabs','messengerSoundNotification','moment','util','path','lodash','squel','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','api','../../config/license/util','APIBadRequestError','APINotFoundError','../../errors/api','APIForbiddenrror','handleError','../../mysqldb','redis','./user.socket','register','defaults','localhost','http','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','code','message','result','update','agent','emit','userNotification:recalc:','destroy','get','role','admin','Users','user','Agents','Telephones','telephone','filter','ignore','map','value','name','UserProfileResource','stack','send','User','rawAttributes','fieldName','type','key','password','salt','previousPasswords','resetPasswordToken','md5secret','includes','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','rows','length','chat','dataValues','sms','fax','mail','openchannel','all','catch','show','params','merge','options','body','find','describe','addContacts','ids','Setting','securePassword','max','internal','isNil','min_internal','sequelize','SELECT','from','voicemail','mailbox','email','permissions','101','102','103','110','107','108','100','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','userProfileId','create','VoiceMail','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','Sequelize','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','updatePasswordsHistory','channel','online','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','format','upsert','remove','isArray','Queue:remove','UserVoiceQueueRt','userpic','filename','getAvatar','existsSync','join','root','server/files/images/','download','getOpenTabs','whatsapp','ChatOpenTabs','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','findOne','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','Tag','Tags','color','tag','model','keys','Queue','filters','intersection','fields','order','sort','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','pick','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','intrf','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','commit','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','loginInPause','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','bulkCreate','isMiddleware','resolve','PAUSE','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','openchannelPause','whatsappPause','lastPauseAt','unpause','Team','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','addAgent','TeamVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getDataValue','Voice','UserVoicePrefix','getLists','getVoiceQueues','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','omit','user_has_mail_interactions:save'];(function(_0x35478c,_0x560bcf){var _0x455468=function(_0x21cb2c){while(--_0x21cb2c){_0x35478c['push'](_0x35478c['shift']());}};_0x455468(++_0x560bcf);}(_0xc106,0x67));var _0x6c10=function(_0x5b6d1e,_0x8dd72c){_0x5b6d1e=_0x5b6d1e-0x0;var _0xc62d12=_0xc106[_0x5b6d1e];return _0xc62d12;};'use strict';var moment=require(_0x6c10('0x0'));var util=require(_0x6c10('0x1'));var path=require(_0x6c10('0x2'));var fs=require('fs');var _=require(_0x6c10('0x3'));var squel=require(_0x6c10('0x4'));var Redis=require('ioredis');var jayson=require(_0x6c10('0x5'));var authService=require(_0x6c10('0x6'));var contacts=require(_0x6c10('0x7'));var qs=require(_0x6c10('0x8'));var rta=require('../../components/realtime/agents');var logger=require('../../config/logger')(_0x6c10('0x9'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6c10('0xa'));var APIBadRequestError=require('../../errors/api')[_0x6c10('0xb')];var APINotFoundError=require('../../errors/api')[_0x6c10('0xc')];var APIForbiddenError=require(_0x6c10('0xd'))[_0x6c10('0xe')];var APIHandleError=require(_0x6c10('0xd'))[_0x6c10('0xf')];var db=require(_0x6c10('0x10'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x6c10('0x11')]));require(_0x6c10('0x12'))[_0x6c10('0x13')](socket);config['redis']=_[_0x6c10('0x14')](config[_0x6c10('0x11')],{'host':_0x6c10('0x15'),'port':0x18eb});var amiClient=jayson['client'][_0x6c10('0x16')]({'port':0x232a});var values;function respondWithStatusCode(_0x319c19,_0x2726ea){_0x2726ea=_0x2726ea||0xcc;return function(_0x5a9b1e){if(_0x5a9b1e){return _0x319c19[_0x6c10('0x17')](_0x2726ea);}return _0x319c19[_0x6c10('0x18')](_0x2726ea)[_0x6c10('0x19')]();};}function respondWithResult(_0xb41eb9,_0x1fa5cd){_0x1fa5cd=_0x1fa5cd||0xc8;return function(_0x2a7dc9){if(_0x2a7dc9){return _0xb41eb9[_0x6c10('0x18')](_0x1fa5cd)[_0x6c10('0x1a')](_0x2a7dc9);}};}function respondWithFilteredResult(_0x2ea094,_0x33af92){return function(_0x1fa391){if(_0x1fa391){var _0x390fcc=typeof _0x33af92[_0x6c10('0x1b')]===_0x6c10('0x1c')&&typeof _0x33af92[_0x6c10('0x1d')]===_0x6c10('0x1c');var _0x2ff896=_0x1fa391[_0x6c10('0x1e')];var _0x3ca76e=_0x390fcc?0x0:_0x33af92[_0x6c10('0x1b')];var _0x8d34aa=_0x390fcc?_0x1fa391[_0x6c10('0x1e')]:_0x33af92[_0x6c10('0x1b')]+_0x33af92[_0x6c10('0x1d')];var _0x5b31eb;if(_0x8d34aa>=_0x2ff896){_0x8d34aa=_0x2ff896;_0x5b31eb=0xc8;}else{_0x5b31eb=0xce;}_0x2ea094[_0x6c10('0x18')](_0x5b31eb);return _0x2ea094[_0x6c10('0x1f')](_0x6c10('0x20'),_0x3ca76e+'-'+_0x8d34aa+'/'+_0x2ff896)[_0x6c10('0x1a')](_0x1fa391);}return null;};}function respondWithRpcPromise(_0x41146b,_0x59a95e,_0x4389f5,_0x5d4335){return new Promise(function(_0x4be5ab,_0x228314){var _0x44fe97=_0x5d4335||amiClient;return _0x44fe97[_0x6c10('0x21')](_0x41146b,_0x4389f5)[_0x6c10('0x22')](function(_0x102ab7){logger[_0x6c10('0x23')](_0x6c10('0x24'),_0x59a95e,_0x6c10('0x25'));logger['debug'](_0x6c10('0x26'),_0x59a95e,'request\x20sent',JSON['stringify'](_0x102ab7));if(_0x102ab7[_0x6c10('0x27')]){if(_0x102ab7[_0x6c10('0x27')][_0x6c10('0x28')]===0x1f4){logger[_0x6c10('0x27')](_0x6c10('0x24'),_0x59a95e,_0x102ab7[_0x6c10('0x27')][_0x6c10('0x29')]);return _0x228314(_0x102ab7[_0x6c10('0x27')]['message']);}logger[_0x6c10('0x27')](_0x6c10('0x24'),_0x59a95e,_0x102ab7[_0x6c10('0x27')]['message']);return _0x4be5ab(_0x102ab7['error']['message']);}else{logger[_0x6c10('0x23')]('User,\x20%s,\x20%s',_0x59a95e,_0x6c10('0x25'));_0x4be5ab(_0x102ab7[_0x6c10('0x2a')]['message']);}})['catch'](function(_0x2cd9f6){logger[_0x6c10('0x27')](_0x6c10('0x24'),_0x59a95e,_0x2cd9f6);_0x228314(_0x2cd9f6);});});}function saveUpdates(_0x4c3334){return function(_0x21c6e3){if(_0x21c6e3){return _0x21c6e3[_0x6c10('0x2b')](_0x4c3334)['then'](function(_0x3eb037){if(_0x3eb037['role']===_0x6c10('0x2c')){socket[_0x6c10('0x2d')](_0x6c10('0x2e')+_0x3eb037['id'],_0x3eb037);}return _0x3eb037;});}return null;};}function removeEntity(_0x25c94a,_0x41ef11){return function(_0x11d9a3){if(_0x11d9a3){return _0x11d9a3[_0x6c10('0x2f')]({'transaction':_0x41ef11})['then'](function(){var _0x191ed7=_0x11d9a3[_0x6c10('0x30')]({'plain':!![]});if(_0x191ed7[_0x6c10('0x31')]===_0x6c10('0x32'))return;var _0x4464cc=[{'name':_0x6c10('0x33'),'value':_0x6c10('0x34'),'ignore':!![]},{'name':_0x6c10('0x35'),'value':_0x6c10('0x2c'),'ignore':![]},{'name':_0x6c10('0x36'),'value':_0x6c10('0x37'),'ignore':![]}];var _0x7c6a2c=_(_0x4464cc)[_0x6c10('0x38')](_0x6c10('0x39'))[_0x6c10('0x3a')](_0x6c10('0x3b'))[_0x6c10('0x3b')]();if(_['includes'](_0x7c6a2c,_0x191ed7[_0x6c10('0x31')])){return;}var _0x3b415a=_['find'](_0x4464cc,[_0x6c10('0x3b'),_0x191ed7[_0x6c10('0x31')]])[_0x6c10('0x3c')];return db[_0x6c10('0x3d')][_0x6c10('0x2f')]({'where':{'type':_0x3b415a,'resourceId':_0x191ed7['id']},'transaction':_0x41ef11})[_0x6c10('0x22')](function(){return _0x11d9a3;});})[_0x6c10('0x22')](function(){_0x25c94a[_0x6c10('0x18')](0xcc)[_0x6c10('0x19')]();});}};}function handleEntityNotFound(_0x3818f7){return function(_0x35e287){if(!_0x35e287){_0x3818f7[_0x6c10('0x17')](0x194);}return _0x35e287;};}function handleError(_0x189c0c,_0x28ee53){_0x28ee53=_0x28ee53||0x1f4;return function(_0x12a4a4){logger['error'](_0x12a4a4[_0x6c10('0x3e')]);if(_0x12a4a4['name']){delete _0x12a4a4[_0x6c10('0x3c')];}_0x189c0c[_0x6c10('0x18')](_0x28ee53)[_0x6c10('0x3f')](_0x12a4a4);};}function getUserAttributes(){return _(db[_0x6c10('0x40')][_0x6c10('0x41')])['map'](function(_0xd0ab7a){return{'name':_0xd0ab7a[_0x6c10('0x42')],'type':_0xd0ab7a[_0x6c10('0x43')][_0x6c10('0x44')]};})[_0x6c10('0x38')](function(_0x3eeee6){return![_0x6c10('0x45'),_0x6c10('0x46'),_0x6c10('0x47'),_0x6c10('0x48'),'resetPasswordExpires',_0x6c10('0x49')][_0x6c10('0x4a')](_0x3eeee6[_0x6c10('0x3c')]);})[_0x6c10('0x3b')]();}exports['index']=function(_0x341289,_0x6641f3){var _0x19f1e4={},_0x411ece={'count':0x0,'rows':[]};var _0x2e0707=getUserAttributes();_0x19f1e4=qs[_0x6c10('0x4b')](_0x2e0707,_0x341289);var _0x288906={'where':_0x19f1e4[_0x6c10('0x4c')]};return db['User']['count'](_0x288906)[_0x6c10('0x22')](function(_0x206285){_0x411ece[_0x6c10('0x1e')]=_0x206285;if(_0x341289[_0x6c10('0x4d')][_0x6c10('0x4e')]){_0x19f1e4[_0x6c10('0x4f')]=[{'all':!![]}];}if(_0x341289[_0x6c10('0x4d')][_0x6c10('0x50')]===_0x6c10('0x51')){_0x19f1e4[_0x6c10('0x4f')]=[{'model':db[_0x6c10('0x52')],'as':_0x6c10('0x50')}];}if(!_[_0x6c10('0x4a')](_0x19f1e4['attributes'],'id')){_0x19f1e4[_0x6c10('0x53')][_0x6c10('0x54')]('id');}return db['User'][_0x6c10('0x55')](_0x19f1e4);})['then'](function(_0x523bbf){_0x411ece[_0x6c10('0x56')]=_0x523bbf;if(_0x341289['query']['openTabs']===_0x6c10('0x51')){var _0x5a8a64=[];for(var _0x3a1376=0x0;_0x3a1376<_0x411ece[_0x6c10('0x56')][_0x6c10('0x57')];_0x3a1376++){_0x5a8a64[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x58'),_0x411ece['rows'][_0x3a1376][_0x6c10('0x59')]));_0x5a8a64[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5a'),_0x411ece[_0x6c10('0x56')][_0x3a1376][_0x6c10('0x59')]));_0x5a8a64['push'](get_open_tabs(_0x6c10('0x5b'),_0x411ece[_0x6c10('0x56')][_0x3a1376][_0x6c10('0x59')]));_0x5a8a64[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5c'),_0x411ece[_0x6c10('0x56')][_0x3a1376]['dataValues']));_0x5a8a64[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5d'),_0x411ece[_0x6c10('0x56')][_0x3a1376][_0x6c10('0x59')]));_0x5a8a64[_0x6c10('0x54')](get_open_tabs('whatsapp',_0x411ece['rows'][_0x3a1376][_0x6c10('0x59')]));}return Promise[_0x6c10('0x5e')](_0x5a8a64)['then'](function(){return _0x411ece;});}else{return _0x411ece;}})['then'](respondWithFilteredResult(_0x6641f3,_0x19f1e4))[_0x6c10('0x5f')](handleError(_0x6641f3,null));};exports[_0x6c10('0x60')]=function(_0x5c8107,_0x2313d3){var _0xb49a5c=getUserAttributes();_0x5c8107[_0x6c10('0x4d')]['id']=_0x5c8107[_0x6c10('0x61')]['id'];var _0x3528b3=qs['getOptions'](_0xb49a5c,_0x5c8107);if(_0x5c8107[_0x6c10('0x4d')][_0x6c10('0x4e')]){_0x3528b3['include']=[{'all':!![]}];}if(_0x5c8107[_0x6c10('0x4d')][_0x6c10('0x50')]===_0x6c10('0x51')){_0x3528b3[_0x6c10('0x4f')]=[{'model':db[_0x6c10('0x52')],'as':_0x6c10('0x50')}];}_0x3528b3=_[_0x6c10('0x62')]({},_0x3528b3,_0x5c8107[_0x6c10('0x63')]);if(!_[_0x6c10('0x4a')](_0x3528b3[_0x6c10('0x53')],'id')){_0x3528b3['attributes'][_0x6c10('0x54')]('id');}return db[_0x6c10('0x40')]['find'](_0x3528b3)[_0x6c10('0x22')](handleEntityNotFound(_0x2313d3,null))['then'](function(_0x1e4801){var _0x4f93fa=[];values=_0x1e4801;if(_0x5c8107['query']['openTabs']==='true'){_0x4f93fa['push'](get_open_tabs('chat',_0x1e4801[_0x6c10('0x59')]));_0x4f93fa[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5a'),_0x1e4801[_0x6c10('0x59')]));_0x4f93fa['push'](get_open_tabs(_0x6c10('0x5d'),_0x1e4801[_0x6c10('0x59')]));_0x4f93fa[_0x6c10('0x54')](get_open_tabs('whatsapp',_0x1e4801[_0x6c10('0x59')]));_0x4f93fa[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5b'),_0x1e4801[_0x6c10('0x59')]));_0x4f93fa[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5c'),_0x1e4801[_0x6c10('0x59')]));return Promise['all'](_0x4f93fa);}else{return values;}})[_0x6c10('0x22')](function(){return values;})[_0x6c10('0x22')](respondWithResult(_0x2313d3,null))[_0x6c10('0x5f')](handleError(_0x2313d3,null));};exports['update']=function(_0x2a98ac,_0x2103c6){if(_0x2a98ac[_0x6c10('0x64')]['id']){delete _0x2a98ac[_0x6c10('0x64')]['id'];}delete _0x2a98ac[_0x6c10('0x64')][_0x6c10('0x31')];return db['User'][_0x6c10('0x65')]({'where':{'id':_0x2a98ac[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x2103c6,null))[_0x6c10('0x22')](saveUpdates(_0x2a98ac[_0x6c10('0x64')],null))[_0x6c10('0x22')](respondWithResult(_0x2103c6,null))[_0x6c10('0x5f')](handleError(_0x2103c6,null));};exports[_0x6c10('0x66')]=function(_0x624f1d,_0x4872cb){return db[_0x6c10('0x40')]['describe']()['then'](respondWithResult(_0x4872cb,null))[_0x6c10('0x5f')](handleError(_0x4872cb,null));};exports[_0x6c10('0x67')]=function(_0x59843a,_0x462d50){return db['User']['find']({'where':{'id':_0x59843a[_0x6c10('0x61')]['id']}})['then'](handleEntityNotFound(_0x462d50,null))[_0x6c10('0x22')](function(_0x34183b){if(_0x34183b){return _0x34183b[_0x6c10('0x67')](_0x59843a[_0x6c10('0x64')][_0x6c10('0x68')],_['omit'](_0x59843a[_0x6c10('0x64')],[_0x6c10('0x68'),'id'])||{});}})[_0x6c10('0x22')](respondWithResult(_0x462d50,null))['catch'](handleError(_0x462d50,null));};function validateUser(_0x2780e0){return new Promise(function(_0x2bc5d6,_0x38b6a8){if(_0x2780e0['internal'])return _0x2bc5d6(_0x2780e0);return db[_0x6c10('0x69')]['findById'](0x1)[_0x6c10('0x22')](function(_0x56f2a1){if(_0x56f2a1[_0x6c10('0x6a')])authService['validatePasswordPattern'](_0x2780e0[_0x6c10('0x45')]);db[_0x6c10('0x40')][_0x6c10('0x6b')](_0x6c10('0x6c'))[_0x6c10('0x22')](function(_0x2b0fcb){if(_[_0x6c10('0x6d')](_0x2b0fcb)){_0x2780e0[_0x6c10('0x6c')]=_0x56f2a1[_0x6c10('0x6e')]||0x1;return;}if(_[_0x6c10('0x6d')](_0x56f2a1[_0x6c10('0x6e')])||_0x56f2a1[_0x6c10('0x6e')]===_0x2b0fcb){_0x2780e0[_0x6c10('0x6c')]=_0x2b0fcb+0x1;return;}if(_0x56f2a1[_0x6c10('0x6e')]>_0x2b0fcb){_0x2780e0[_0x6c10('0x6c')]=_0x56f2a1[_0x6c10('0x6e')];return;}return db[_0x6c10('0x6f')][_0x6c10('0x4d')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize']['QueryTypes'][_0x6c10('0x70')]})[_0x6c10('0x22')](function(_0x33b167){if(_0x33b167&&_0x33b167[_0x6c10('0x57')]){for(var _0x254912=0x0,_0x5816cf=_0x33b167[_0x6c10('0x57')];_0x254912<_0x5816cf&&_[_0x6c10('0x6d')](_0x2780e0[_0x6c10('0x6c')]);_0x254912++){if(_0x56f2a1[_0x6c10('0x6e')]<=_0x33b167[_0x254912][_0x6c10('0x71')]){_0x2780e0[_0x6c10('0x6c')]=_0x33b167[_0x254912][_0x6c10('0x71')];}else if(_0x56f2a1[_0x6c10('0x6e')]>_0x33b167[_0x254912][_0x6c10('0x71')]&&_0x56f2a1[_0x6c10('0x6e')]<=_0x33b167[_0x254912]['to']){_0x2780e0[_0x6c10('0x6c')]=_0x56f2a1[_0x6c10('0x6e')];}}}if(_[_0x6c10('0x6d')](_0x2780e0['internal'])){_0x2780e0[_0x6c10('0x6c')]=_0x2b0fcb+0x1;}return _0x2bc5d6(_0x2780e0);});});})['catch'](function(_0x2034f2){_0x38b6a8(_0x2034f2);});});}function updateUser(_0x1f0c28){return new Promise(function(_0x5cb9e2,_0x7b4ccd){try{if(_0x1f0c28[_0x6c10('0x72')]){_0x1f0c28[_0x6c10('0x73')]=_0x1f0c28[_0x6c10('0x6c')];_0x1f0c28['VoiceMail']={'mailbox':_0x1f0c28[_0x6c10('0x6c')],'password':_0x1f0c28[_0x6c10('0x45')],'fullname':_0x1f0c28['fullname'],'email':_0x1f0c28[_0x6c10('0x74')]};}if(_0x1f0c28['role']===_0x6c10('0x2c')){if(!_0x1f0c28[_0x6c10('0x75')])_0x1f0c28[_0x6c10('0x75')]=[_0x6c10('0x76'),_0x6c10('0x77'),_0x6c10('0x78'),'113',_0x6c10('0x79'),'104','105','106',_0x6c10('0x7a'),_0x6c10('0x7b'),'109',_0x6c10('0x7c'),'111','114','115'];}_0x5cb9e2(_0x1f0c28);}catch(_0x48dbc6){_0x7b4ccd(_0x48dbc6);}});}exports['create']=function(_0x90b59f,_0x10f875){if(_0x90b59f[_0x6c10('0x34')][_0x6c10('0x31')]===_0x6c10('0x2c'))throw new Error(_0x6c10('0x7d'));if(_0x90b59f['body']['role']===_0x6c10('0x34')&&_0x90b59f[_0x6c10('0x34')][_0x6c10('0x31')]!==_0x6c10('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x90b59f[_0x6c10('0x64')]['role']===_0x6c10('0x32')&&_0x90b59f[_0x6c10('0x34')][_0x6c10('0x31')]!==_0x6c10('0x32')){throw new Error(_0x6c10('0x7e'));}return licenseUtil[_0x6c10('0x7f')]([_0x90b59f[_0x6c10('0x64')]])[_0x6c10('0x22')](function(){return validateUser(_0x90b59f['body']);})['then'](function(_0x191218){return updateUser(_0x191218)[_0x6c10('0x22')](function(_0xe6d03){if(_0xe6d03[_0x6c10('0x31')]===_0x6c10('0x32')){_0xe6d03['settingsEnabled']=_0x90b59f[_0x6c10('0x34')]['settingsEnabled'];delete _0xe6d03[_0x6c10('0x80')];}return _0xe6d03;});})['then'](function(_0x317cd2){return db[_0x6c10('0x40')][_0x6c10('0x81')](_0x317cd2,{'include':[{'model':db[_0x6c10('0x82')],'as':_0x6c10('0x82')}]});})[_0x6c10('0x22')](function(_0x29056a){if(_0x90b59f['body']['role']==='user')return _0x29056a;if(_0x90b59f[_0x6c10('0x34')][_0x6c10('0x31')]!==_0x6c10('0x34'))return _0x29056a;return db[_0x6c10('0x83')][_0x6c10('0x65')]({'where':{'name':_0x29056a[_0x6c10('0x31')]===_0x6c10('0x2c')?_0x6c10('0x35'):_0x6c10('0x36'),'userProfileId':_0x90b59f[_0x6c10('0x34')]['userProfileId']},'raw':!![]})[_0x6c10('0x22')](function(_0x128b7a){if(!_0x128b7a||_0x128b7a[_0x6c10('0x84')]!=0x0)return _0x29056a;return db[_0x6c10('0x3d')][_0x6c10('0x81')]({'name':_0x29056a['name'],'resourceId':_0x29056a['id'],'type':_0x128b7a[_0x6c10('0x3c')],'sectionId':_0x128b7a['id']},{})[_0x6c10('0x22')](function(){return _0x29056a;});})['catch'](function(_0x3cb4fe){logger['error'](_0x6c10('0x85'),_0x3cb4fe);throw _0x3cb4fe;});})[_0x6c10('0x22')](respondWithResult(_0x10f875,0xc9))[_0x6c10('0x5f')](handleError(_0x10f875,null));};exports['bulkCreate']=function(_0x248232,_0x45fef9){var _0x713e3c=_0x248232[_0x6c10('0x64')];var _0x3deba7=[];if(_0x248232[_0x6c10('0x34')][_0x6c10('0x31')]===_0x6c10('0x2c'))throw new Error(_0x6c10('0x7d'));if(_[_0x6c10('0x86')](_0x713e3c,[_0x6c10('0x31'),_0x6c10('0x34')])&&_0x248232['user'][_0x6c10('0x31')]!==_0x6c10('0x32')){throw new Error(_0x6c10('0x87'));}if(_['some'](_0x713e3c,[_0x6c10('0x31'),_0x6c10('0x32')])&&_0x248232[_0x6c10('0x34')][_0x6c10('0x31')]!==_0x6c10('0x32')){throw new Error(_0x6c10('0x88'));}return licenseUtil['checkUserLimits'](_0x713e3c)[_0x6c10('0x22')](function(){return validateUser(_0x713e3c[0x0]);})[_0x6c10('0x22')](function(){for(var _0x5e203e=0x1;_0x5e203e<_0x713e3c['length'];_0x5e203e++){var _0x336978=_0x713e3c[_0x5e203e-0x1][_0x6c10('0x6c')];if(!_0x713e3c[_0x5e203e][_0x6c10('0x6c')])_0x713e3c[_0x5e203e]['internal']=_0x336978+0x1;_0x3deba7[_0x6c10('0x54')](validateUser(_0x713e3c[_0x5e203e]));}return Promise[_0x6c10('0x5e')](_0x3deba7);})['then'](function(){_0x3deba7=[];for(var _0x283aa2=0x0;_0x283aa2<_0x713e3c[_0x6c10('0x57')];_0x283aa2++){_0x3deba7['push'](updateUser(_0x713e3c[_0x283aa2]));}return Promise[_0x6c10('0x5e')](_0x3deba7);})['then'](function(){_0x3deba7=_0x713e3c[_0x6c10('0x3a')](function(_0x40684f){return db[_0x6c10('0x40')][_0x6c10('0x81')](_0x40684f,{'include':[{'model':db['VoiceMail'],'as':_0x6c10('0x82')}]})['then'](function(_0x508f1e){_0x40684f['id']=_0x508f1e['id'];return _0x40684f;});});return Promise['all'](_0x3deba7);})[_0x6c10('0x22')](function(_0x3d6cb5){if(_0x248232[_0x6c10('0x64')][_0x6c10('0x31')]===_0x6c10('0x34'))return _0x3d6cb5;if(_0x248232[_0x6c10('0x34')][_0x6c10('0x31')]!==_0x6c10('0x34'))return _0x3d6cb5;var _0x15a3e1=_[_0x6c10('0x86')](_0x3d6cb5,function(_0x4afd32){return _0x4afd32[_0x6c10('0x31')]===_0x6c10('0x2c')||_0x4afd32['role']===_0x6c10('0x37');});if(!_0x15a3e1)return _0x3d6cb5;return db[_0x6c10('0x83')]['findAll']({'where':{'name':{'$or':[_0x6c10('0x35'),_0x6c10('0x36')]},'userProfileId':_0x248232[_0x6c10('0x34')][_0x6c10('0x80')]},'raw':!![]})[_0x6c10('0x22')](function(_0x46cf8f){if(_['isEmpty'](_0x46cf8f)||!_['some'](_0x46cf8f,[_0x6c10('0x84'),0x0]))return _0x3d6cb5;_0x3deba7=[];var _0x13b5b3=_(_0x46cf8f)[_0x6c10('0x3a')](function(_0x939b10){if(_0x939b10[_0x6c10('0x84')]===0x1)return;return _0x939b10[_0x6c10('0x3c')]===_0x6c10('0x35')?'agent':_0x6c10('0x37');})[_0x6c10('0x89')]()[_0x6c10('0x3b')]();for(var _0x12260f=0x0;_0x12260f<_0x3d6cb5['length'];_0x12260f++){if(!_[_0x6c10('0x4a')](_0x13b5b3,_0x3d6cb5[_0x12260f]['role']))return;var _0x5813b4=_0x3d6cb5[_0x12260f][_0x6c10('0x31')]===_0x6c10('0x2c')?'Agents':'Telephones';_0x3deba7[_0x6c10('0x54')](db[_0x6c10('0x3d')]['create']({'name':_0x3d6cb5[_0x12260f]['name'],'resourceId':_0x3d6cb5[_0x12260f]['id'],'type':_0x5813b4,'sectionId':_[_0x6c10('0x65')](_0x46cf8f,['name',_0x5813b4])['id']},{}));}return Promise[_0x6c10('0x5e')](_0x3deba7);});})[_0x6c10('0x22')](respondWithResult(_0x45fef9,0xc9))['catch'](handleError(_0x45fef9,null));};exports[_0x6c10('0x8a')]=function(_0x48f445,_0x174fa1){if(_0x48f445['body']['id']){delete _0x48f445['body']['id'];}return db[_0x6c10('0x40')][_0x6c10('0x65')]({'where':{'id':_0x48f445[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](function(_0x3a7a59){if(!_0x3a7a59)return null;if(_0x3a7a59['id']===_0x48f445[_0x6c10('0x34')]['id']){if(!_0x48f445[_0x6c10('0x64')][_0x6c10('0x8b')]||!_0x48f445[_0x6c10('0x64')][_0x6c10('0x8c')]){throw new db['Sequelize'][(_0x6c10('0x8d'))](_0x6c10('0x8e'));}if(!_0x3a7a59['authenticate'](_0x48f445[_0x6c10('0x64')]['oldPassword'])){throw new db['Sequelize'][(_0x6c10('0x8d'))](_0x6c10('0x8f'));}if(_0x48f445['body'][_0x6c10('0x8b')]===_0x48f445['body'][_0x6c10('0x8c')]){throw new db[(_0x6c10('0x90'))][(_0x6c10('0x8d'))](_0x6c10('0x91'));}}else if(_0x48f445['user'][_0x6c10('0x31')]===_0x6c10('0x32')){if(!_0x48f445[_0x6c10('0x64')]['newPassword']){throw new db[(_0x6c10('0x90'))]['ValidationError'](_0x6c10('0x92'));}}else if(_0x48f445[_0x6c10('0x34')][_0x6c10('0x31')]===_0x6c10('0x34')){if(!_0x48f445['body']['newPassword']){throw new db[(_0x6c10('0x90'))][(_0x6c10('0x8d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x3a7a59['role']!==_0x6c10('0x2c')){throw new db[(_0x6c10('0x90'))][(_0x6c10('0x8d'))](_0x6c10('0x7d'));}}else{throw new db[(_0x6c10('0x90'))][(_0x6c10('0x8d'))](_0x6c10('0x7d'));}return _0x3a7a59;})[_0x6c10('0x22')](handleEntityNotFound(_0x174fa1,null))['then'](function(_0x4e9142){return db[_0x6c10('0x69')]['findOne']({'attributes':['id',_0x6c10('0x6a'),_0x6c10('0x93'),_0x6c10('0x94')]})[_0x6c10('0x22')](function(_0x4dee8d){if(_0x4dee8d[_0x6c10('0x6a')])authService[_0x6c10('0x95')](_0x48f445[_0x6c10('0x64')][_0x6c10('0x8c')]);if(!_0x4dee8d['enforcePasswordHistory']||!_0x4e9142[_0x6c10('0x47')])return _0x4e9142;authService[_0x6c10('0x96')](_0x48f445['body'][_0x6c10('0x8c')],_0x4e9142['previousPasswords'],_0x4dee8d['passwordHistoryLimit']);return _0x4e9142;})[_0x6c10('0x22')](saveUpdates({'password':_0x48f445[_0x6c10('0x64')][_0x6c10('0x8c')],'passwordResetAt':_0x48f445[_0x6c10('0x34')]['id']==_0x48f445['params']['id']?moment():null,'previousPasswords':authService[_0x6c10('0x97')](_0x48f445['body']['newPassword'],_0x4e9142[_0x6c10('0x47')])},null));})[_0x6c10('0x22')](respondWithResult(_0x174fa1,null))['catch'](handleError(_0x174fa1,null));};exports['addQueues']=function(_0x4e8fef,_0x528410){var _0x3eca88=_0x4e8fef[_0x6c10('0x64')][_0x6c10('0x98')];return db['User']['find']({'where':{'id':_0x4e8fef[_0x6c10('0x61')]['id']},'attributes':['id',_0x6c10('0x3c'),'role',_0x6c10('0x99'),'loginInPause',_0x6c10('0x9a'),_0x6c10('0x9b')]})[_0x6c10('0x22')](handleEntityNotFound(_0x528410,null))[_0x6c10('0x22')](function(_0x333c73){if(_0x333c73){if(!utils[_0x6c10('0x9c')](_0x3eca88)){throw new db[(_0x6c10('0x90'))]['ValidationError'](_0x6c10('0x9d'));}return _0x333c73[_0x6c10('0x9e')+_[_0x6c10('0x9f')](_0x3eca88[_0x6c10('0xa0')]())+_0x6c10('0xa1')](_0x4e8fef['body'][_0x6c10('0x68')],{'penalty':_0x4e8fef['body'][_0x6c10('0xa2')]||0x0})[_0x6c10('0xa3')](function(_0x51c207){for(var _0x49668a=0x0;_0x49668a<_0x4e8fef[_0x6c10('0x64')][_0x6c10('0x68')][_0x6c10('0x57')];_0x49668a+=0x1){var _0x275e2f={'UserId':Number(_0x4e8fef[_0x6c10('0x61')]['id'])};_0x275e2f[_[_0x6c10('0x9f')](_0x3eca88[_0x6c10('0xa0')]())+_0x6c10('0xa4')]=Number(_0x4e8fef['body']['ids'][_0x49668a]);socket[_0x6c10('0x2d')](_0x6c10('0x34')+_['capitalize'](_0x3eca88['toLowerCase']())+_0x6c10('0xa5'),_0x275e2f);}return _0x51c207;})[_0x6c10('0x22')](function(){if(_0x3eca88==='voice'){return db['VoiceQueue'][_0x6c10('0x55')]({'where':{'id':_0x4e8fef[_0x6c10('0x64')][_0x6c10('0x68')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x6c10('0x22')](function(_0x25442d){var _0x32321e=_0x333c73[_0x6c10('0x30')]({'plain':!![]});var _0x2742f4=[];if(_0x3eca88==='voice'&&_0x32321e[_0x6c10('0x31')]===_0x6c10('0x2c')&&_0x32321e['online']){for(let _0x133e14=0x0;_0x133e14<_0x25442d['length'];_0x133e14+=0x1){_0x2742f4[_0x6c10('0x54')]({'membername':_0x32321e[_0x6c10('0x3c')],'UserId':_0x32321e['id'],'queue_name':_0x25442d[_0x133e14][_0x6c10('0x3c')],'VoiceQueueId':_0x25442d[_0x133e14]['id'],'interface':_[_0x6c10('0x6d')](_0x32321e[_0x6c10('0x9b')])?util[_0x6c10('0xa6')]('SIP/%s',_0x32321e[_0x6c10('0x3c')]):_0x32321e[_0x6c10('0x9b')],'paused':_0x32321e['voicePause']||![],'penalty':_0x4e8fef[_0x6c10('0x64')]['penalty']||0x0});}return Promise[_0x6c10('0x5e')](_0x2742f4[_0x6c10('0x3a')](function(_0x250f62){return db['UserVoiceQueueRt'][_0x6c10('0xa7')](_0x250f62);}));}return _0x333c73;});}})['then'](respondWithStatusCode(_0x528410,null))['catch'](handleError(_0x528410,null));};exports['removeQueues']=function(_0x18449b,_0x384e4e){var _0x408c83,_0x6ca022;return db[_0x6c10('0x40')]['find']({'where':{'id':_0x18449b[_0x6c10('0x61')]['id']},'attributes':['id',_0x6c10('0x3c'),'role']})[_0x6c10('0x22')](handleEntityNotFound(_0x384e4e,null))[_0x6c10('0x22')](function(_0x380bbd){if(_0x380bbd){_0x408c83=_0x380bbd;if(!_0x18449b[_0x6c10('0x4d')][_0x6c10('0x98')]||!utils[_0x6c10('0x9c')](_0x18449b[_0x6c10('0x4d')]['channel'])){throw new db['Sequelize'][(_0x6c10('0x8d'))](_0x6c10('0x9d'));}return _0x380bbd[_0x6c10('0xa8')+_[_0x6c10('0x9f')](_0x18449b[_0x6c10('0x4d')]['channel']['toLowerCase']())+'Queues'](_0x18449b[_0x6c10('0x4d')]['ids']);}})[_0x6c10('0x22')](function(_0x3050b6){if(_[_0x6c10('0xa9')](_0x18449b[_0x6c10('0x4d')][_0x6c10('0x68')])){for(var _0x46246c=0x0;_0x46246c<_0x18449b[_0x6c10('0x4d')][_0x6c10('0x68')]['length'];_0x46246c+=0x1){_0x6ca022={'UserId':Number(_0x18449b[_0x6c10('0x61')]['id'])};_0x6ca022[_[_0x6c10('0x9f')](_0x18449b[_0x6c10('0x4d')][_0x6c10('0x98')][_0x6c10('0xa0')]())+_0x6c10('0xa4')]=Number(_0x18449b[_0x6c10('0x4d')]['ids'][_0x46246c]);socket[_0x6c10('0x2d')]('user'+_['capitalize'](_0x18449b[_0x6c10('0x4d')][_0x6c10('0x98')][_0x6c10('0xa0')]())+_0x6c10('0xaa'),_0x6ca022);}}else{_0x6ca022={'UserId':Number(_0x18449b['params']['id'])};_0x6ca022[_['capitalize'](_0x18449b[_0x6c10('0x4d')][_0x6c10('0x98')][_0x6c10('0xa0')]())+'QueueId']=Number(_0x18449b[_0x6c10('0x4d')][_0x6c10('0x68')]);socket[_0x6c10('0x2d')]('user'+_[_0x6c10('0x9f')](_0x18449b[_0x6c10('0x4d')][_0x6c10('0x98')]['toLowerCase']())+_0x6c10('0xaa'),_0x6ca022);}return _0x3050b6;})[_0x6c10('0x22')](function(){if(_0x18449b[_0x6c10('0x4d')][_0x6c10('0x98')]==='voice'){return db[_0x6c10('0xab')][_0x6c10('0x2f')]({'where':{'UserId':_0x18449b[_0x6c10('0x61')]['id'],'VoiceQueueId':_0x18449b['query'][_0x6c10('0x68')]},'individualHooks':!![]})[_0x6c10('0x22')](function(){return _0x408c83;});}return _0x408c83;})[_0x6c10('0x22')](respondWithStatusCode(_0x384e4e,null))[_0x6c10('0x5f')](handleError(_0x384e4e,null));};exports['addAvatar']=function(_0x31f5c7,_0x2c55fb){_0x31f5c7[_0x6c10('0x64')][_0x6c10('0xac')]=_0x31f5c7['file'][_0x6c10('0xad')];return db[_0x6c10('0x40')][_0x6c10('0x65')]({'where':{'id':_0x31f5c7[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x2c55fb,null))[_0x6c10('0x22')](saveUpdates(_0x31f5c7[_0x6c10('0x64')],null))[_0x6c10('0x22')](respondWithResult(_0x2c55fb,null))[_0x6c10('0x5f')](handleError(_0x2c55fb,null));};exports[_0x6c10('0xae')]=function(_0x4762de,_0x26fce6){var _0x1e0853=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db['User'][_0x6c10('0x65')]({'where':{'id':_0x4762de['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x6c10('0x22')](handleEntityNotFound(_0x26fce6,null))['then'](function(_0x5ee2b7){if(_0x5ee2b7){if(_['isNil'](_0x5ee2b7[_0x6c10('0xac')])){return _0x26fce6['download'](_0x1e0853);}else{if(!fs[_0x6c10('0xaf')](path[_0x6c10('0xb0')](config[_0x6c10('0xb1')],_0x6c10('0xb2'),_0x5ee2b7[_0x6c10('0xac')]))){return _0x26fce6['download'](_0x1e0853);}return _0x26fce6[_0x6c10('0xb3')](path[_0x6c10('0xb0')](config[_0x6c10('0xb1')],_0x6c10('0xb2'),_0x5ee2b7[_0x6c10('0xac')]));}}})['catch'](handleError(_0x26fce6,null));};exports[_0x6c10('0xb4')]=function(_0x50513b,_0x5d45e0){return db[_0x6c10('0x40')][_0x6c10('0x65')]({'where':{'id':_0x50513b[_0x6c10('0x61')]['id']},'attributes':['id']})[_0x6c10('0x22')](handleEntityNotFound(_0x5d45e0,null))[_0x6c10('0x22')](function(_0x2b10d8){var _0x135c37=[];values=_0x2b10d8[_0x6c10('0x59')];_0x135c37[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x58'),_0x2b10d8[_0x6c10('0x59')]));_0x135c37[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5a'),_0x2b10d8[_0x6c10('0x59')]));_0x135c37[_0x6c10('0x54')](get_open_tabs(_0x6c10('0x5d'),_0x2b10d8[_0x6c10('0x59')]));_0x135c37[_0x6c10('0x54')](get_open_tabs(_0x6c10('0xb5'),_0x2b10d8[_0x6c10('0x59')]));_0x135c37['push'](get_open_tabs(_0x6c10('0x5b'),_0x2b10d8['dataValues']));_0x135c37['push'](get_open_tabs(_0x6c10('0x5c'),_0x2b10d8['dataValues']));return Promise[_0x6c10('0x5e')](_0x135c37);})['then'](function(_0x3d04cc){if(_0x3d04cc){var _0x400ee3=_[_0x6c10('0x3a')](values[_0x6c10('0xb6')],function(_0x102126){return{'channel':'CHAT','id':_0x102126['id'],'createdAt':_0x102126[_0x6c10('0xb7')]};});var _0x361f53=_[_0x6c10('0x3a')](values[_0x6c10('0xb8')],function(_0x24acd6){return{'channel':_0x6c10('0xb9'),'id':_0x24acd6['id'],'createdAt':_0x24acd6['createdAt']};});var _0x1d3d33=_[_0x6c10('0x3a')](values['OpenchannelOpenTabs'],function(_0x11f48c){return{'channel':_0x6c10('0xba'),'id':_0x11f48c['id'],'createdAt':_0x11f48c[_0x6c10('0xb7')]};});var _0x549422=_[_0x6c10('0x3a')](values['MailOpenTabs'],function(_0x184c76){return{'channel':_0x6c10('0xbb'),'id':_0x184c76['id'],'createdAt':_0x184c76['createdAt']};});var _0x53c271=_[_0x6c10('0x3a')](values[_0x6c10('0xbc')],function(_0x53a607){return{'channel':_0x6c10('0xbd'),'id':_0x53a607['id'],'createdAt':_0x53a607[_0x6c10('0xb7')]};});var _0x4fbc3a=_['map'](values[_0x6c10('0xbe')],function(_0x2c68aa){return{'channel':_0x6c10('0xbf'),'id':_0x2c68aa['id'],'createdAt':_0x2c68aa[_0x6c10('0xb7')]};});var _0x4b1b1a=_[_0x6c10('0xc0')](_0x400ee3,_0x361f53,_0x1d3d33,_0x549422,_0x53c271,_0x4fbc3a);var _0x1dd0d3={'count':_0x4b1b1a[_0x6c10('0x57')],'rows':_0x4b1b1a};return _0x1dd0d3;}else return null;})[_0x6c10('0x22')](respondWithResult(_0x5d45e0,null))[_0x6c10('0x5f')](handleError(_0x5d45e0,null));};exports[_0x6c10('0xc1')]=function(_0x3596bb,_0x436ec5){var _0x46a65d={};return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x3596bb[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](function(_0x1d347e){if(!_0x1d347e){throw new APINotFoundError(util[_0x6c10('0xa6')](_0x6c10('0xc3'),_0x3596bb[_0x6c10('0x61')]['id']));}return contacts[_0x6c10('0x66')]();})[_0x6c10('0x22')](function(_0x2e8c85){_0x3596bb[_0x6c10('0x4d')][_0x6c10('0x40')]=_0x3596bb[_0x6c10('0x61')]['id'];_0x46a65d=qs[_0x6c10('0x4b')](_0x2e8c85,_0x3596bb);if(_0x3596bb['query'][_0x6c10('0xc4')](_0x6c10('0x4e'))){_0x46a65d[_0x6c10('0x4f')]=[{'model':db[_0x6c10('0xc5')],'as':'List','required':![]},{'model':db[_0x6c10('0xc6')],'as':_0x6c10('0xc7'),'attributes':['id',_0x6c10('0x3c'),_0x6c10('0xc8')],'where':_0x3596bb[_0x6c10('0x4d')][_0x6c10('0xc9')]?{'id':_0x3596bb[_0x6c10('0x4d')]['tag']}:undefined,'required':_0x3596bb[_0x6c10('0x4d')][_0x6c10('0xc9')]?!![]:![]}];}return contacts[_0x6c10('0x55')](_0x3596bb[_0x6c10('0x4d')],_0x3596bb[_0x6c10('0x34')],_0x46a65d,_0x2e8c85);})[_0x6c10('0x22')](respondWithFilteredResult(_0x436ec5,_0x46a65d))[_0x6c10('0x5f')](APIHandleError(_0x436ec5));};exports['getQueues']=function(_0x341c16,_0x581994){var _0x2d3b42;var _0x2c4f9a={};var _0x468306;return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x341c16['params']['id']},'attributes':['id',_0x6c10('0x3c'),_0x6c10('0x31')]})[_0x6c10('0x22')](handleEntityNotFound(_0x581994,null))[_0x6c10('0x22')](function(_0x32902c){if(!utils[_0x6c10('0x9c')](_0x341c16[_0x6c10('0x4d')][_0x6c10('0x98')])){throw new db[(_0x6c10('0x90'))][(_0x6c10('0x8d'))]('Unknown\x20channel');}_0x2d3b42=_0x32902c;var _0x45db34={};_0x45db34[_0x6c10('0xca')]=_[_0x6c10('0xcb')](db[_['capitalize'](_0x341c16[_0x6c10('0x4d')][_0x6c10('0x98')])+_0x6c10('0xcc')][_0x6c10('0x41')]);_0x45db34['query']=_[_0x6c10('0xcb')](_0x341c16[_0x6c10('0x4d')]);_0x45db34[_0x6c10('0xcd')]=_[_0x6c10('0xce')](_0x45db34[_0x6c10('0xca')],_0x45db34[_0x6c10('0x4d')]);_0x2c4f9a[_0x6c10('0x53')]=_['intersection'](_0x45db34['model'],qs[_0x6c10('0xcf')](_0x341c16['query'][_0x6c10('0xcf')]));_0x2c4f9a[_0x6c10('0x53')]=_0x2c4f9a[_0x6c10('0x53')][_0x6c10('0x57')]?_0x2c4f9a[_0x6c10('0x53')]:_0x45db34[_0x6c10('0xca')];_0x2c4f9a[_0x6c10('0xd0')]=qs[_0x6c10('0xd1')](_0x341c16[_0x6c10('0x4d')]['sort']);_0x2c4f9a[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_['pick'](_0x341c16[_0x6c10('0x4d')],_0x45db34[_0x6c10('0xcd')]));if(_0x341c16[_0x6c10('0x4d')][_0x6c10('0x38')]){_0x2c4f9a['where']=_[_0x6c10('0x62')](_0x2c4f9a[_0x6c10('0x4c')],{'$or':_[_0x6c10('0x3a')](_0x2c4f9a[_0x6c10('0x53')],function(_0x5673f4){var _0x379643={};_0x379643[_0x5673f4]={'$like':'%'+_0x341c16[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x379643;})});}_0x2c4f9a=_[_0x6c10('0x62')]({},_0x2c4f9a,_0x341c16[_0x6c10('0x63')]);switch(_0x2d3b42['role']){case'admin':return db[_[_0x6c10('0x9f')](_0x341c16[_0x6c10('0x4d')][_0x6c10('0x98')])+_0x6c10('0xcc')][_0x6c10('0x55')](_0x2c4f9a);case'user':case _0x6c10('0x2c'):return _0x2d3b42[_0x6c10('0x30')+_['capitalize'](_0x341c16[_0x6c10('0x4d')][_0x6c10('0x98')])+_0x6c10('0xa1')](_0x2c4f9a);default:throw new db['Sequelize'][(_0x6c10('0x8d'))](_0x6c10('0xd2'));}})[_0x6c10('0x22')](function(_0x469260){_0x468306=_0x469260[_0x6c10('0x57')];if(!_0x341c16[_0x6c10('0x4d')][_0x6c10('0xc4')](_0x6c10('0xd3'))){_0x2c4f9a[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x341c16[_0x6c10('0x4d')][_0x6c10('0x1d')]);_0x2c4f9a[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x341c16[_0x6c10('0x4d')][_0x6c10('0x1b')]);}switch(_0x2d3b42[_0x6c10('0x31')]){case'admin':return db[_[_0x6c10('0x9f')](_0x341c16[_0x6c10('0x4d')][_0x6c10('0x98')])+_0x6c10('0xcc')][_0x6c10('0x55')](_0x2c4f9a);case _0x6c10('0x34'):case _0x6c10('0x2c'):return _0x2d3b42['get'+_[_0x6c10('0x9f')](_0x341c16[_0x6c10('0x4d')]['channel'])+_0x6c10('0xa1')](_0x2c4f9a);}})['then'](function(_0x350ba8){return{'count':_0x468306,'rows':_0x350ba8};})[_0x6c10('0x22')](respondWithResult(_0x581994,null))['catch'](handleError(_0x581994,null));};exports[_0x6c10('0xd4')]=function(_0xe3ba50,_0x3aa02d){var _0x54094a={};var _0x55e7d3={};var _0xc9190e;var _0x17f34b;return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0xe3ba50[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x3aa02d,null))[_0x6c10('0x22')](function(_0x58c4ee){if(_0x58c4ee){_0xc9190e=_0x58c4ee;_0x55e7d3[_0x6c10('0xca')]=_[_0x6c10('0xcb')](db[_0x6c10('0xab')]['rawAttributes']);_0x55e7d3[_0x6c10('0x4d')]=_['keys'](_0xe3ba50[_0x6c10('0x4d')]);_0x55e7d3[_0x6c10('0xcd')]=_['intersection'](_0x55e7d3[_0x6c10('0xca')],_0x55e7d3['query']);_0x54094a[_0x6c10('0x53')]=_[_0x6c10('0xce')](_0x55e7d3['model'],qs['fields'](_0xe3ba50['query'][_0x6c10('0xcf')]));_0x54094a[_0x6c10('0x53')]=_0x54094a['attributes'][_0x6c10('0x57')]?_0x54094a[_0x6c10('0x53')]:_0x55e7d3[_0x6c10('0xca')];_0x54094a['order']=qs['sort'](_0xe3ba50['query']['sort']);_0x54094a[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_['pick'](_0xe3ba50[_0x6c10('0x4d')],_0x55e7d3['filters']));if(_0xe3ba50[_0x6c10('0x4d')]['filter']){_0x54094a['where']=_[_0x6c10('0x62')](_0x54094a['where'],{'$or':_[_0x6c10('0x3a')](_0x54094a[_0x6c10('0x53')],function(_0x2789fc){var _0x44dbc2={};_0x44dbc2[_0x2789fc]={'$like':'%'+_0xe3ba50[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x44dbc2;})});}_0x54094a=_[_0x6c10('0x62')]({},_0x54094a,_0xe3ba50[_0x6c10('0x63')]);return _0xc9190e[_0x6c10('0xd4')](_0x54094a);}})['then'](function(_0x559445){if(_0x559445){_0x17f34b=_0x559445['length'];if(!_0xe3ba50['query'][_0x6c10('0xc4')]('nolimit')){_0x54094a['limit']=qs[_0x6c10('0x1d')](_0xe3ba50['query'][_0x6c10('0x1d')]);_0x54094a[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0xe3ba50[_0x6c10('0x4d')][_0x6c10('0x1b')]);}return _0xc9190e[_0x6c10('0xd4')](_0x54094a);}})[_0x6c10('0x22')](function(_0x2ba9a5){if(_0x2ba9a5){return _0x2ba9a5?{'count':_0x17f34b,'rows':_0x2ba9a5}:null;}})['then'](respondWithResult(_0x3aa02d,null))[_0x6c10('0x5f')](handleError(_0x3aa02d,null));};exports[_0x6c10('0xd5')]=function(_0x338721,_0x2dbe59){var _0x475d88={};var _0x3bfe53={};var _0x47934a;var _0x284bc1;return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x338721[_0x6c10('0x61')]['id']}})['then'](handleEntityNotFound(_0x2dbe59,null))[_0x6c10('0x22')](function(_0x1b0d0c){if(_0x1b0d0c){_0x47934a=_0x1b0d0c;_0x3bfe53[_0x6c10('0xca')]=_['keys'](db[_0x6c10('0xd6')][_0x6c10('0x41')]);_0x3bfe53[_0x6c10('0x4d')]=_[_0x6c10('0xcb')](_0x338721[_0x6c10('0x4d')]);_0x3bfe53['filters']=_[_0x6c10('0xce')](_0x3bfe53['model'],_0x3bfe53[_0x6c10('0x4d')]);_0x475d88[_0x6c10('0x53')]=_[_0x6c10('0xce')](_0x3bfe53['model'],qs['fields'](_0x338721[_0x6c10('0x4d')][_0x6c10('0xcf')]));_0x475d88['attributes']=_0x475d88[_0x6c10('0x53')][_0x6c10('0x57')]?_0x475d88['attributes']:_0x3bfe53[_0x6c10('0xca')];_0x475d88[_0x6c10('0xd0')]=qs[_0x6c10('0xd1')](_0x338721[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x475d88[_0x6c10('0x4c')]=qs['filters'](_[_0x6c10('0xd7')](_0x338721['query'],_0x3bfe53[_0x6c10('0xcd')]));if(_0x338721[_0x6c10('0x4d')][_0x6c10('0x38')]){_0x475d88[_0x6c10('0x4c')]=_['merge'](_0x475d88['where'],{'$or':_['map'](_0x475d88['attributes'],function(_0x56acb0){var _0x1c58d9={};_0x1c58d9[_0x56acb0]={'$like':'%'+_0x338721[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x1c58d9;})});}_0x475d88=_[_0x6c10('0x62')]({},_0x475d88,_0x338721['options']);return _0x47934a[_0x6c10('0xd5')](_0x475d88);}})[_0x6c10('0x22')](function(_0x237db0){if(_0x237db0){_0x284bc1=_0x237db0['length'];if(!_0x338721[_0x6c10('0x4d')]['hasOwnProperty'](_0x6c10('0xd3'))){_0x475d88[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x338721[_0x6c10('0x4d')][_0x6c10('0x1d')]);_0x475d88[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x338721['query'][_0x6c10('0x1b')]);}return _0x47934a[_0x6c10('0xd5')](_0x475d88);}})[_0x6c10('0x22')](function(_0x1e2ea8){if(_0x1e2ea8){return _0x1e2ea8?{'count':_0x284bc1,'rows':_0x1e2ea8}:null;}})['then'](respondWithResult(_0x2dbe59,null))['catch'](handleError(_0x2dbe59,null));};exports[_0x6c10('0xd8')]=function(_0x2d1026,_0x2831ee){var _0x46f4e3={'raw':!![],'where':{}};var _0x1e6852={};var _0x186a31={'count':0x0,'rows':[]};return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x2d1026[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x2831ee,null))['then'](function(_0xbf1d88){if(_0xbf1d88){_0x1e6852['model']=_[_0x6c10('0xcb')](db[_0x6c10('0xd9')][_0x6c10('0x41')]);_0x1e6852['query']=_[_0x6c10('0xcb')](_0x2d1026[_0x6c10('0x4d')]);_0x1e6852[_0x6c10('0xcd')]=_[_0x6c10('0xce')](_0x1e6852[_0x6c10('0xca')],_0x1e6852[_0x6c10('0x4d')]);_0x46f4e3['attributes']=_[_0x6c10('0xce')](_0x1e6852[_0x6c10('0xca')],qs[_0x6c10('0xcf')](_0x2d1026['query'][_0x6c10('0xcf')]));_0x46f4e3['attributes']=_0x46f4e3[_0x6c10('0x53')]['length']?_0x46f4e3[_0x6c10('0x53')]:_0x1e6852[_0x6c10('0xca')];if(!_0x2d1026[_0x6c10('0x4d')][_0x6c10('0xc4')](_0x6c10('0xd3'))){_0x46f4e3[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x2d1026[_0x6c10('0x4d')][_0x6c10('0x1d')]);_0x46f4e3[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x2d1026[_0x6c10('0x4d')][_0x6c10('0x1b')]);}_0x46f4e3[_0x6c10('0xd0')]=qs['sort'](_0x2d1026['query'][_0x6c10('0xd1')]);_0x46f4e3[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_[_0x6c10('0xd7')](_0x2d1026[_0x6c10('0x4d')],_0x1e6852[_0x6c10('0xcd')]));_0x46f4e3[_0x6c10('0x4c')][_0x6c10('0xda')]=_0xbf1d88['id'];if(_0x2d1026['query'][_0x6c10('0x38')]){_0x46f4e3[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x46f4e3[_0x6c10('0x4c')],{'$or':_[_0x6c10('0x3a')](_0x46f4e3[_0x6c10('0x53')],function(_0x2990c0){var _0x28089d={};_0x28089d[_0x2990c0]={'$like':'%'+_0x2d1026[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x28089d;})});}_0x46f4e3=_['merge']({},_0x46f4e3,_0x2d1026[_0x6c10('0x63')]);return db[_0x6c10('0xd9')][_0x6c10('0x1e')]({'where':_0x46f4e3[_0x6c10('0x4c')]})[_0x6c10('0x22')](function(_0x17c05e){_0x186a31['count']=_0x17c05e;if(_0x2d1026['query'][_0x6c10('0x4e')]){_0x46f4e3[_0x6c10('0x4f')]=[{'all':!![]}];}return db[_0x6c10('0xd9')][_0x6c10('0x55')](_0x46f4e3);})['then'](function(_0x103eea){_0x186a31[_0x6c10('0x56')]=_0x103eea;return _0x186a31;});}})[_0x6c10('0x22')](respondWithFilteredResult(_0x2831ee,_0x46f4e3))[_0x6c10('0x5f')](handleError(_0x2831ee,null));};exports[_0x6c10('0xdb')]=function(_0xc4b789,_0xef2a0){var _0x47b44d={'raw':!![],'where':{}};var _0x333195={};var _0x4f2ecc={'count':0x0,'rows':[]};return db['User'][_0x6c10('0xc2')]({'where':{'id':_0xc4b789['params']['id']}})['then'](handleEntityNotFound(_0xef2a0,null))[_0x6c10('0x22')](function(_0x147fe5){if(_0x147fe5){_0x333195[_0x6c10('0xca')]=_['keys'](db[_0x6c10('0xdc')]['rawAttributes']);_0x333195[_0x6c10('0x4d')]=_['keys'](_0xc4b789[_0x6c10('0x4d')]);_0x333195['filters']=_['intersection'](_0x333195[_0x6c10('0xca')],_0x333195['query']);_0x47b44d[_0x6c10('0x53')]=_['intersection'](_0x333195[_0x6c10('0xca')],qs['fields'](_0xc4b789[_0x6c10('0x4d')][_0x6c10('0xcf')]));_0x47b44d[_0x6c10('0x53')]=_0x47b44d[_0x6c10('0x53')]['length']?_0x47b44d[_0x6c10('0x53')]:_0x333195['model'];if(!_0xc4b789[_0x6c10('0x4d')][_0x6c10('0xc4')](_0x6c10('0xd3'))){_0x47b44d[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0xc4b789['query'][_0x6c10('0x1d')]);_0x47b44d['offset']=qs[_0x6c10('0x1b')](_0xc4b789[_0x6c10('0x4d')][_0x6c10('0x1b')]);}_0x47b44d[_0x6c10('0xd0')]=qs[_0x6c10('0xd1')](_0xc4b789[_0x6c10('0x4d')]['sort']);_0x47b44d[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_[_0x6c10('0xd7')](_0xc4b789[_0x6c10('0x4d')],_0x333195[_0x6c10('0xcd')]));_0x47b44d['where'][_0x6c10('0xda')]=_0x147fe5['id'];if(_0xc4b789[_0x6c10('0x4d')]['filter']){_0x47b44d[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x47b44d[_0x6c10('0x4c')],{'$or':_[_0x6c10('0x3a')](_0x47b44d[_0x6c10('0x53')],function(_0x238a2e){var _0xd744f4={};_0xd744f4[_0x238a2e]={'$like':'%'+_0xc4b789[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0xd744f4;})});}_0x47b44d=_[_0x6c10('0x62')]({},_0x47b44d,_0xc4b789['options']);return db['ScreenRecording'][_0x6c10('0x1e')]({'where':_0x47b44d[_0x6c10('0x4c')]})[_0x6c10('0x22')](function(_0x3105a1){_0x4f2ecc[_0x6c10('0x1e')]=_0x3105a1;if(_0xc4b789[_0x6c10('0x4d')][_0x6c10('0x4e')]){_0x47b44d['include']=[{'all':!![]}];}return db[_0x6c10('0xdc')][_0x6c10('0x55')](_0x47b44d);})[_0x6c10('0x22')](function(_0x69d565){_0x4f2ecc[_0x6c10('0x56')]=_0x69d565;return _0x4f2ecc;});}})['then'](respondWithFilteredResult(_0xef2a0,_0x47b44d))[_0x6c10('0x5f')](handleError(_0xef2a0,null));};exports['getChatInteractions']=function(_0x1e8d83,_0x36c02c){var _0x28afb6={};var _0x1c5a05={};var _0xb4fc6f;var _0x599096;return db['User'][_0x6c10('0xc2')]({'where':{'id':_0x1e8d83['params']['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x36c02c,null))[_0x6c10('0x22')](function(_0x27d2f5){if(_0x27d2f5){_0xb4fc6f=_0x27d2f5;_0x1c5a05['model']=_[_0x6c10('0xcb')](db['ChatInteraction'][_0x6c10('0x41')]);_0x1c5a05[_0x6c10('0x4d')]=_[_0x6c10('0xcb')](_0x1e8d83['query']);_0x1c5a05[_0x6c10('0xcd')]=_[_0x6c10('0xce')](_0x1c5a05[_0x6c10('0xca')],_0x1c5a05[_0x6c10('0x4d')]);_0x28afb6[_0x6c10('0x53')]=_['intersection'](_0x1c5a05[_0x6c10('0xca')],qs[_0x6c10('0xcf')](_0x1e8d83[_0x6c10('0x4d')]['fields']));_0x28afb6[_0x6c10('0x53')]=_0x28afb6[_0x6c10('0x53')]['length']?_0x28afb6[_0x6c10('0x53')]:_0x1c5a05[_0x6c10('0xca')];_0x28afb6[_0x6c10('0xd0')]=qs[_0x6c10('0xd1')](_0x1e8d83[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x28afb6[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_['pick'](_0x1e8d83['query'],_0x1c5a05[_0x6c10('0xcd')]));if(_0x1e8d83['query'][_0x6c10('0x38')]){_0x28afb6['where']=_['merge'](_0x28afb6[_0x6c10('0x4c')],{'$or':_['map'](_0x28afb6[_0x6c10('0x53')],function(_0x4a688b){var _0x50ed5b={};_0x50ed5b[_0x4a688b]={'$like':'%'+_0x1e8d83[_0x6c10('0x4d')]['filter']+'%'};return _0x50ed5b;})});}_0x28afb6=_[_0x6c10('0x62')]({},_0x28afb6,_0x1e8d83[_0x6c10('0x63')]);return _0xb4fc6f[_0x6c10('0xdd')](_0x28afb6);}})[_0x6c10('0x22')](function(_0x28d04d){if(_0x28d04d){_0x599096=_0x28d04d[_0x6c10('0x57')];if(!_0x1e8d83[_0x6c10('0x4d')][_0x6c10('0xc4')](_0x6c10('0xd3'))){_0x28afb6[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x1e8d83[_0x6c10('0x4d')][_0x6c10('0x1d')]);_0x28afb6['offset']=qs[_0x6c10('0x1b')](_0x1e8d83['query']['offset']);}return _0xb4fc6f[_0x6c10('0xdd')](_0x28afb6);}})[_0x6c10('0x22')](function(_0x2f544f){if(_0x2f544f){return _0x2f544f?{'count':_0x599096,'rows':_0x2f544f}:null;}})[_0x6c10('0x22')](respondWithResult(_0x36c02c,null))['catch'](handleError(_0x36c02c,null));};exports['getOpenchannelInteractions']=function(_0x4772a6,_0x271147){var _0x29d1c8={};var _0x2e41b0={};var _0x1ed6c6;var _0x43b5c8;return db[_0x6c10('0x40')]['findOne']({'where':{'id':_0x4772a6[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x271147,null))['then'](function(_0x352255){if(_0x352255){_0x1ed6c6=_0x352255;_0x2e41b0[_0x6c10('0xca')]=_['keys'](db[_0x6c10('0xde')][_0x6c10('0x41')]);_0x2e41b0[_0x6c10('0x4d')]=_[_0x6c10('0xcb')](_0x4772a6['query']);_0x2e41b0[_0x6c10('0xcd')]=_['intersection'](_0x2e41b0['model'],_0x2e41b0[_0x6c10('0x4d')]);_0x29d1c8[_0x6c10('0x53')]=_[_0x6c10('0xce')](_0x2e41b0['model'],qs['fields'](_0x4772a6[_0x6c10('0x4d')][_0x6c10('0xcf')]));_0x29d1c8[_0x6c10('0x53')]=_0x29d1c8[_0x6c10('0x53')][_0x6c10('0x57')]?_0x29d1c8['attributes']:_0x2e41b0['model'];_0x29d1c8[_0x6c10('0xd0')]=qs['sort'](_0x4772a6[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x29d1c8[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_[_0x6c10('0xd7')](_0x4772a6[_0x6c10('0x4d')],_0x2e41b0['filters']));if(_0x4772a6[_0x6c10('0x4d')][_0x6c10('0x38')]){_0x29d1c8[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x29d1c8['where'],{'$or':_[_0x6c10('0x3a')](_0x29d1c8[_0x6c10('0x53')],function(_0x4e248c){var _0x4b25e5={};_0x4b25e5[_0x4e248c]={'$like':'%'+_0x4772a6[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x4b25e5;})});}_0x29d1c8=_[_0x6c10('0x62')]({},_0x29d1c8,_0x4772a6[_0x6c10('0x63')]);return _0x1ed6c6[_0x6c10('0xdf')](_0x29d1c8);}})[_0x6c10('0x22')](function(_0x128cb7){if(_0x128cb7){_0x43b5c8=_0x128cb7[_0x6c10('0x57')];if(!_0x4772a6['query']['hasOwnProperty'](_0x6c10('0xd3'))){_0x29d1c8[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x4772a6['query'][_0x6c10('0x1d')]);_0x29d1c8['offset']=qs[_0x6c10('0x1b')](_0x4772a6[_0x6c10('0x4d')][_0x6c10('0x1b')]);}return _0x1ed6c6[_0x6c10('0xdf')](_0x29d1c8);}})[_0x6c10('0x22')](function(_0x93a65){if(_0x93a65){return _0x93a65?{'count':_0x43b5c8,'rows':_0x93a65}:null;}})['then'](respondWithResult(_0x271147,null))[_0x6c10('0x5f')](handleError(_0x271147,null));};exports['getMailInteractions']=function(_0x368587,_0x3a5575){var _0x55e972={'raw':!![],'where':{}};var _0x3c9f48={};var _0xe70482={'count':0x0,'rows':[]};return db['User'][_0x6c10('0xc2')]({'where':{'id':_0x368587[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x3a5575,null))[_0x6c10('0x22')](function(_0x3b8d20){if(_0x3b8d20){_0x3c9f48[_0x6c10('0xca')]=_[_0x6c10('0xcb')](db['MailInteraction'][_0x6c10('0x41')]);_0x3c9f48[_0x6c10('0x4d')]=_['keys'](_0x368587['query']);_0x3c9f48[_0x6c10('0xcd')]=_['intersection'](_0x3c9f48[_0x6c10('0xca')],_0x3c9f48[_0x6c10('0x4d')]);_0x55e972[_0x6c10('0x53')]=_[_0x6c10('0xce')](_0x3c9f48['model'],qs[_0x6c10('0xcf')](_0x368587[_0x6c10('0x4d')][_0x6c10('0xcf')]));_0x55e972[_0x6c10('0x53')]=_0x55e972['attributes'][_0x6c10('0x57')]?_0x55e972[_0x6c10('0x53')]:_0x3c9f48[_0x6c10('0xca')];if(!_0x368587['query'][_0x6c10('0xc4')]('nolimit')){_0x55e972[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x368587[_0x6c10('0x4d')][_0x6c10('0x1d')]);_0x55e972[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x368587[_0x6c10('0x4d')][_0x6c10('0x1b')]);}_0x55e972['order']=qs[_0x6c10('0xd1')](_0x368587[_0x6c10('0x4d')]['sort']);_0x55e972[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_[_0x6c10('0xd7')](_0x368587['query'],_0x3c9f48[_0x6c10('0xcd')]));_0x55e972[_0x6c10('0x4c')]['UserId']=_0x3b8d20['id'];if(_0x368587[_0x6c10('0x4d')][_0x6c10('0x38')]){_0x55e972[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x55e972['where'],{'$or':_['map'](_0x55e972[_0x6c10('0x53')],function(_0x2c5d86){var _0x4452cb={};_0x4452cb[_0x2c5d86]={'$like':'%'+_0x368587['query'][_0x6c10('0x38')]+'%'};return _0x4452cb;})});}_0x55e972=_[_0x6c10('0x62')]({},_0x55e972,_0x368587[_0x6c10('0x63')]);return db[_0x6c10('0xe0')][_0x6c10('0x1e')]({'where':_0x55e972[_0x6c10('0x4c')]})[_0x6c10('0x22')](function(_0x17f33b){_0xe70482[_0x6c10('0x1e')]=_0x17f33b;if(_0x368587[_0x6c10('0x4d')][_0x6c10('0x4e')]){_0x55e972[_0x6c10('0x4f')]=[{'all':!![]}];}return db['MailInteraction'][_0x6c10('0x55')](_0x55e972);})[_0x6c10('0x22')](function(_0x264fd9){_0xe70482[_0x6c10('0x56')]=_0x264fd9;return _0xe70482;});}})['then'](respondWithFilteredResult(_0x3a5575,_0x55e972))[_0x6c10('0x5f')](handleError(_0x3a5575,null));};exports[_0x6c10('0xe1')]=function(_0x539ea0,_0x4add99){var _0x40521f={};var _0x470b99={};var _0x4cf1c5;var _0x6ad0;return db[_0x6c10('0x40')]['findOne']({'where':{'id':_0x539ea0[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x4add99,null))[_0x6c10('0x22')](function(_0x599ec9){if(_0x599ec9){_0x4cf1c5=_0x599ec9;_0x470b99[_0x6c10('0xca')]=_[_0x6c10('0xcb')](db[_0x6c10('0xe2')][_0x6c10('0x41')]);_0x470b99[_0x6c10('0x4d')]=_['keys'](_0x539ea0[_0x6c10('0x4d')]);_0x470b99[_0x6c10('0xcd')]=_[_0x6c10('0xce')](_0x470b99['model'],_0x470b99['query']);_0x40521f['attributes']=_['intersection'](_0x470b99[_0x6c10('0xca')],qs['fields'](_0x539ea0['query'][_0x6c10('0xcf')]));_0x40521f[_0x6c10('0x53')]=_0x40521f['attributes']['length']?_0x40521f[_0x6c10('0x53')]:_0x470b99['model'];_0x40521f[_0x6c10('0xd0')]=qs[_0x6c10('0xd1')](_0x539ea0[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x40521f['where']=qs[_0x6c10('0xcd')](_['pick'](_0x539ea0['query'],_0x470b99['filters']));if(_0x539ea0[_0x6c10('0x4d')][_0x6c10('0x38')]){_0x40521f['where']=_[_0x6c10('0x62')](_0x40521f[_0x6c10('0x4c')],{'$or':_[_0x6c10('0x3a')](_0x40521f[_0x6c10('0x53')],function(_0x2acf46){var _0x2dff73={};_0x2dff73[_0x2acf46]={'$like':'%'+_0x539ea0[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x2dff73;})});}_0x40521f=_['merge']({},_0x40521f,_0x539ea0[_0x6c10('0x63')]);return _0x4cf1c5['getSmsInteractions'](_0x40521f);}})[_0x6c10('0x22')](function(_0x1f7797){if(_0x1f7797){_0x6ad0=_0x1f7797[_0x6c10('0x57')];if(!_0x539ea0['query'][_0x6c10('0xc4')](_0x6c10('0xd3'))){_0x40521f[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x539ea0['query'][_0x6c10('0x1d')]);_0x40521f[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x539ea0[_0x6c10('0x4d')]['offset']);}return _0x4cf1c5[_0x6c10('0xe1')](_0x40521f);}})[_0x6c10('0x22')](function(_0x44865c){if(_0x44865c){return _0x44865c?{'count':_0x6ad0,'rows':_0x44865c}:null;}})[_0x6c10('0x22')](respondWithResult(_0x4add99,null))['catch'](handleError(_0x4add99,null));};exports[_0x6c10('0xe3')]=function(_0x4f2d9f,_0x7aa065){var _0x1e2520={};var _0x44caec={};var _0x21f6ac;var _0x44d931;return db['User'][_0x6c10('0xc2')]({'where':{'id':_0x4f2d9f['params']['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x7aa065,null))[_0x6c10('0x22')](function(_0x409f9a){if(_0x409f9a){_0x21f6ac=_0x409f9a;_0x44caec['model']=_['keys'](db[_0x6c10('0xe4')][_0x6c10('0x41')]);_0x44caec[_0x6c10('0x4d')]=_['keys'](_0x4f2d9f[_0x6c10('0x4d')]);_0x44caec['filters']=_[_0x6c10('0xce')](_0x44caec[_0x6c10('0xca')],_0x44caec[_0x6c10('0x4d')]);_0x1e2520[_0x6c10('0x53')]=_[_0x6c10('0xce')](_0x44caec[_0x6c10('0xca')],qs[_0x6c10('0xcf')](_0x4f2d9f[_0x6c10('0x4d')][_0x6c10('0xcf')]));_0x1e2520['attributes']=_0x1e2520[_0x6c10('0x53')]['length']?_0x1e2520[_0x6c10('0x53')]:_0x44caec[_0x6c10('0xca')];_0x1e2520[_0x6c10('0xd0')]=qs[_0x6c10('0xd1')](_0x4f2d9f[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x1e2520[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_['pick'](_0x4f2d9f[_0x6c10('0x4d')],_0x44caec['filters']));if(_0x4f2d9f['query'][_0x6c10('0x38')]){_0x1e2520[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x1e2520[_0x6c10('0x4c')],{'$or':_[_0x6c10('0x3a')](_0x1e2520['attributes'],function(_0x154067){var _0x5083cf={};_0x5083cf[_0x154067]={'$like':'%'+_0x4f2d9f['query'][_0x6c10('0x38')]+'%'};return _0x5083cf;})});}_0x1e2520=_[_0x6c10('0x62')]({},_0x1e2520,_0x4f2d9f[_0x6c10('0x63')]);return _0x21f6ac[_0x6c10('0xe3')](_0x1e2520);}})[_0x6c10('0x22')](function(_0x4735fb){if(_0x4735fb){_0x44d931=_0x4735fb[_0x6c10('0x57')];if(!_0x4f2d9f[_0x6c10('0x4d')][_0x6c10('0xc4')]('nolimit')){_0x1e2520['limit']=qs['limit'](_0x4f2d9f[_0x6c10('0x4d')][_0x6c10('0x1d')]);_0x1e2520[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x4f2d9f['query'][_0x6c10('0x1b')]);}return _0x21f6ac[_0x6c10('0xe3')](_0x1e2520);}})[_0x6c10('0x22')](function(_0x15552e){if(_0x15552e){return _0x15552e?{'count':_0x44d931,'rows':_0x15552e}:null;}})[_0x6c10('0x22')](respondWithResult(_0x7aa065,null))['catch'](handleError(_0x7aa065,null));};exports[_0x6c10('0xe5')]=function(_0x1ce8a9,_0x368bb3){var _0x3a0be5={};var _0x5a5b44={};var _0x2eca59;var _0x446331;return db[_0x6c10('0x40')]['findOne']({'where':{'id':_0x1ce8a9[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x368bb3,null))[_0x6c10('0x22')](function(_0x4b363d){if(_0x4b363d){_0x2eca59=_0x4b363d;_0x5a5b44[_0x6c10('0xca')]=_['keys'](db[_0x6c10('0xe6')][_0x6c10('0x41')]);_0x5a5b44[_0x6c10('0x4d')]=_[_0x6c10('0xcb')](_0x1ce8a9[_0x6c10('0x4d')]);_0x5a5b44['filters']=_['intersection'](_0x5a5b44[_0x6c10('0xca')],_0x5a5b44[_0x6c10('0x4d')]);_0x3a0be5['attributes']=_['intersection'](_0x5a5b44['model'],qs['fields'](_0x1ce8a9[_0x6c10('0x4d')]['fields']));_0x3a0be5[_0x6c10('0x53')]=_0x3a0be5[_0x6c10('0x53')][_0x6c10('0x57')]?_0x3a0be5[_0x6c10('0x53')]:_0x5a5b44[_0x6c10('0xca')];_0x3a0be5['order']=qs[_0x6c10('0xd1')](_0x1ce8a9[_0x6c10('0x4d')]['sort']);_0x3a0be5[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_[_0x6c10('0xd7')](_0x1ce8a9['query'],_0x5a5b44['filters']));if(_0x1ce8a9['query'][_0x6c10('0x38')]){_0x3a0be5[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x3a0be5[_0x6c10('0x4c')],{'$or':_['map'](_0x3a0be5['attributes'],function(_0x1621cb){var _0x34c7d6={};_0x34c7d6[_0x1621cb]={'$like':'%'+_0x1ce8a9[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x34c7d6;})});}_0x3a0be5=_[_0x6c10('0x62')]({},_0x3a0be5,_0x1ce8a9[_0x6c10('0x63')]);return _0x2eca59[_0x6c10('0xe5')](_0x3a0be5);}})[_0x6c10('0x22')](function(_0x411cd1){if(_0x411cd1){_0x446331=_0x411cd1[_0x6c10('0x57')];if(!_0x1ce8a9[_0x6c10('0x4d')][_0x6c10('0xc4')]('nolimit')){_0x3a0be5[_0x6c10('0x1d')]=qs[_0x6c10('0x1d')](_0x1ce8a9[_0x6c10('0x4d')][_0x6c10('0x1d')]);_0x3a0be5[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x1ce8a9[_0x6c10('0x4d')][_0x6c10('0x1b')]);}return _0x2eca59['getWhatsappInteractions'](_0x3a0be5);}})[_0x6c10('0x22')](function(_0xa665be){if(_0xa665be){return _0xa665be?{'count':_0x446331,'rows':_0xa665be}:null;}})[_0x6c10('0x22')](respondWithResult(_0x368bb3,null))[_0x6c10('0x5f')](handleError(_0x368bb3,null));};exports[_0x6c10('0xe7')]=function(_0x109d83,_0x125bc1,_0x217b9f){var _0x579a1e;var _0x44bc93;var _0x564f18;var _0x376068=!_[_0x6c10('0x6d')](_0x109d83[_0x6c10('0x61')]['id'])?_0x109d83[_0x6c10('0x61')]['id']:!_['isNil'](_0x109d83['user']['id'])?_0x109d83[_0x6c10('0x34')]['id']:null;return db[_0x6c10('0x40')]['find']({'where':{'id':_0x376068,'role':{'$or':[_0x6c10('0x32'),_0x6c10('0x34'),_0x6c10('0x2c')]}},'attributes':['id',_0x6c10('0x3c'),_0x6c10('0xe8'),_0x6c10('0xe9'),'role','internal','loginInPause']})[_0x6c10('0x22')](function(_0xfed740){if(_0xfed740){if(_0xfed740[_0x6c10('0x31')]==='agent'){_0x579a1e=_0xfed740;if(_0x109d83[_0x6c10('0x64')]['interface']){_0x564f18=util['format']('LOCAL/%s@from-sip/n',_0x579a1e[_0x109d83[_0x6c10('0x64')]['interface']]);}else if(_0x109d83['body'][_0x6c10('0xea')]){_0x564f18=util['format'](_0x6c10('0xeb'),_0x109d83[_0x6c10('0x64')][_0x6c10('0xea')]);}else{_0x564f18=util[_0x6c10('0xa6')]('SIP/%s',_0x579a1e['name']);}socket['to'](util['format'](_0x6c10('0xec'),_0x579a1e[_0x6c10('0x3c')]))['emit'](_0x6c10('0xed'),{'user':{'id':_0x579a1e['id'],'name':_0x579a1e[_0x6c10('0x3c')]},'ip':_0x109d83[_0x6c10('0xee')][_0x6c10('0xef')]||_0x109d83[_0x6c10('0xf0')][_0x6c10('0xf1')]||_0x109d83[_0x6c10('0xf2')][_0x6c10('0xf1')]||_0x109d83['connection'][_0x6c10('0xf2')][_0x6c10('0xf1')]});return new Promise(function(_0x4d2f49,_0x6bfca9){db[_0x6c10('0x6f')]['transaction']()['then'](_0x178baf=>{db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x579a1e[_0x6c10('0x3c')]},'individualHooks':!![]},{'transaction':_0x178baf})[_0x6c10('0x22')](function(){return _0x178baf[_0x6c10('0xf3')]();})[_0x6c10('0x22')](_0x4d2f49)[_0x6c10('0x5f')](_0x6bfca9);});});}}else{throw new db[(_0x6c10('0x90'))]['ValidationError'](_0x6c10('0xf4'));}})[_0x6c10('0x22')](function(){if(_0x579a1e){return _0x579a1e['getVoiceQueues']({'raw':!![]});}})[_0x6c10('0x22')](function(_0x1a1644){if(_0x579a1e){if(_0x1a1644){_0x44bc93=_0x1a1644;if(_0x44bc93[_0x6c10('0x57')]){var _0x3212bf=_0x44bc93['map'](function(_0x47af9c){return{'membername':_0x579a1e['name'],'UserId':_0x579a1e['id'],'queue_name':_0x47af9c[_0x6c10('0x3c')],'VoiceQueueId':_0x47af9c['id'],'interface':_0x564f18,'paused':_0x579a1e[_0x6c10('0xf5')]||![],'penalty':_0x47af9c[_0x6c10('0xf6')]||0x0};});return db[_0x6c10('0xab')]['bulkCreate'](_0x3212bf);}}}})[_0x6c10('0x22')](function(){if(_0x579a1e){return db[_0x6c10('0xf7')][_0x6c10('0x55')]({'where':{'membername':_0x579a1e[_0x6c10('0x3c')],'exitAt':null}});}})[_0x6c10('0x22')](function(_0x3c435e){if(_0x579a1e){var _0x12d7c2=[];_0x3c435e[_0x6c10('0xf8')](function(_0x114178){_0x12d7c2[_0x6c10('0x54')](_0x114178['update']({'exitAt':moment()[_0x6c10('0xa6')](_0x6c10('0xf9'))}));});return Promise[_0x6c10('0x5e')](_0x12d7c2);}})[_0x6c10('0x22')](function(){if(_0x579a1e){var _0x50162b=[];var _0x2a31e1=[];var _0x225b73=utils[_0x6c10('0xfa')]();var _0x45df1e={'membername':_0x579a1e[_0x6c10('0x3c')],'interface':_0x564f18,'enterAt':moment()[_0x6c10('0xa6')](_0x6c10('0xf9')),'role':_0x579a1e['role'],'internal':_0x579a1e[_0x6c10('0x6c')]};_0x225b73[_0x6c10('0xf8')](function(_0x12eb7d){_0x50162b['push'](_[_0x6c10('0x62')]({'channel':_0x12eb7d,'type':_0x6c10('0xfb'),'data1':_0x109d83[_0x6c10('0x64')][_0x6c10('0xfc')],'data2':_0x564f18},_0x45df1e));if(_0x579a1e['loginInPause']){_0x2a31e1[_0x6c10('0x54')](_[_0x6c10('0x62')]({'channel':_0x12eb7d,'type':'PAUSE','data1':'LOGININPAUSE'},_0x45df1e));}});return db[_0x6c10('0xf7')][_0x6c10('0xfd')](_0x50162b[_0x6c10('0xc0')](_0x2a31e1),{'individualHooks':!![]});}})[_0x6c10('0x22')](function(){if(_0x579a1e){return _0x579a1e[_0x6c10('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x6c10('0xa6')](_0x6c10('0xf9')),'voicePause':_0x579a1e[_0x6c10('0xf5')]||![],'mailPause':_0x579a1e['loginInPause']||![],'chatPause':_0x579a1e['loginInPause']||![],'faxPause':_0x579a1e['loginInPause']||![],'smsPause':_0x579a1e[_0x6c10('0xf5')]||![],'openchannelPause':_0x579a1e['loginInPause']||![],'whatsappPause':_0x579a1e['loginInPause']||![],'pauseType':_0x579a1e[_0x6c10('0xf5')]?'LOGININPAUSE':null,'interface':_0x564f18,'lastPauseAt':moment()['format'](_0x6c10('0xf9'))});}})[_0x6c10('0x22')](function(_0x29a300){if(_0x109d83[_0x6c10('0xfe')]){return _0x217b9f();}else{return Promise[_0x6c10('0xff')](_0x29a300)[_0x6c10('0x22')](respondWithResult(_0x125bc1,null));}})[_0x6c10('0x5f')](handleError(_0x125bc1,null));};exports['logout']=function(_0x500489,_0x4382b6){var _0x56f077;return db[_0x6c10('0x40')]['find']({'where':{'id':_0x500489[_0x6c10('0x61')]['id'],'role':'agent'},'attributes':['id',_0x6c10('0x3c'),_0x6c10('0x31')]})[_0x6c10('0x22')](handleEntityNotFound(_0x4382b6,null))[_0x6c10('0x22')](function(_0x4a9d9a){if(_0x4a9d9a){_0x56f077=_0x4a9d9a;return db[_0x6c10('0xab')][_0x6c10('0x2f')]({'where':{'membername':_0x56f077[_0x6c10('0x3c')]},'individualHooks':!![]});}})[_0x6c10('0x22')](function(){return db['MemberReport'][_0x6c10('0x55')]({'where':{'membername':_0x56f077[_0x6c10('0x3c')],'exitAt':null}});})[_0x6c10('0x22')](function(_0x14f862){var _0x14b9c5=[];_0x14f862[_0x6c10('0xf8')](function(_0x4bc0a7){_0x14b9c5[_0x6c10('0x54')](_0x4bc0a7[_0x6c10('0x2b')]({'exitAt':moment()[_0x6c10('0xa6')](_0x6c10('0xf9'))}));});return Promise[_0x6c10('0x5e')](_0x14b9c5);})[_0x6c10('0x22')](function(){return _0x56f077[_0x6c10('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6c10('0x22')](respondWithResult(_0x4382b6,null))[_0x6c10('0x5f')](handleError(_0x4382b6,null));};exports['pause']=function(_0xf15f57,_0x4d5ca5){var _0x4a58ad;return db[_0x6c10('0xab')]['update']({'paused':0x1},{'where':{'UserId':_0xf15f57['params']['id']},'individualHooks':!![]})[_0x6c10('0x22')](function(){return db[_0x6c10('0x40')][_0x6c10('0x65')]({'where':{'id':_0xf15f57[_0x6c10('0x61')]['id'],'role':_0x6c10('0x2c')},'attributes':['id',_0x6c10('0x3c'),'role',_0x6c10('0x6c'),'interface','online']});})[_0x6c10('0x22')](handleEntityNotFound(_0x4d5ca5,null))['then'](function(_0x3fa4f6){if(_0x3fa4f6){_0x4a58ad=_0x3fa4f6;return respondWithRpcPromise('QueuePause','pause',{'id':_0x4a58ad['id'],'name':_0x4a58ad[_0x6c10('0x3c')],'pause':!![]});}})[_0x6c10('0x22')](function(){if(_0x4a58ad){return db[_0x6c10('0xf7')][_0x6c10('0x55')]({'where':{'membername':_0x4a58ad[_0x6c10('0x3c')],'type':_0x6c10('0x100'),'exitAt':null}});}})[_0x6c10('0x22')](function(_0x46cd1e){if(_0x46cd1e[_0x6c10('0x57')]){var _0x429533=moment()[_0x6c10('0xa6')](_0x6c10('0xf9'));for(var _0x4c6963=0x0,_0x407003=_0x46cd1e[_0x6c10('0x57')];_0x4c6963<_0x407003;_0x4c6963++){_0x46cd1e[_0x4c6963]['updateAttributes']({'exitAt':_0x429533});}}})[_0x6c10('0x22')](function(){var _0x547df0=[];var _0x13ee5d=utils[_0x6c10('0xfa')]();_0x13ee5d[_0x6c10('0xf8')](function(_0x3cd329){_0x547df0[_0x6c10('0x54')]({'channel':_0x3cd329,'membername':_0x4a58ad[_0x6c10('0x3c')],'interface':_[_0x6c10('0x6d')](_0x4a58ad[_0x6c10('0x9b')])?util['format']('SIP/%s',_0x4a58ad[_0x6c10('0x3c')]):_0x4a58ad['interface'],'type':_0x6c10('0x100'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0xf15f57[_0x6c10('0x64')]['type']||_0x6c10('0x101'),'role':_0x4a58ad[_0x6c10('0x31')],'internal':_0x4a58ad[_0x6c10('0x6c')]});});return db[_0x6c10('0xf7')][_0x6c10('0xfd')](_0x547df0,{'individualHooks':!![]});})[_0x6c10('0x22')](function(){return _0x4a58ad[_0x6c10('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xf15f57[_0x6c10('0x64')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x6c10('0xa6')](_0x6c10('0xf9'))});})[_0x6c10('0x22')](respondWithResult(_0x4d5ca5,null))[_0x6c10('0x5f')](handleError(_0x4d5ca5,null));};exports['unpause']=function(_0x3baf43,_0xc86a8e){if(_0x3baf43[_0x6c10('0x64')][_0x6c10('0x98')]&&!utils[_0x6c10('0x9c')](_0x3baf43[_0x6c10('0x64')]['channel'])){throw new APIBadRequestError(util[_0x6c10('0xa6')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3baf43['body'][_0x6c10('0x98')]));}return db[_0x6c10('0x40')][_0x6c10('0x65')]({'where':{'id':_0x3baf43[_0x6c10('0x61')]['id']},'attributes':['id','name',_0x6c10('0x31'),_0x6c10('0x6c'),'interface',_0x6c10('0x99'),_0x6c10('0x9a'),_0x6c10('0x102'),_0x6c10('0x103'),_0x6c10('0x104'),_0x6c10('0x105'),'smsPause',_0x6c10('0x106'),'pauseType',_0x6c10('0x107')]})[_0x6c10('0x22')](function(_0x13efe6){if(!_0x13efe6){throw new APINotFoundError(util[_0x6c10('0xa6')](_0x6c10('0xc3'),_0x3baf43[_0x6c10('0x61')]['id']));}return _0x13efe6[_0x6c10('0x108')](_0x3baf43[_0x6c10('0x64')][_0x6c10('0x98')]);})[_0x6c10('0x22')](respondWithResult(_0xc86a8e,null))['catch'](APIHandleError(_0xc86a8e));};exports['getTeams']=function(_0x497042,_0xce73c7){var _0x4d49e9={};var _0x3c1e34={};var _0x1f9b14;var _0x1a0264;return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x497042[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0xce73c7,null))[_0x6c10('0x22')](function(_0x3a7abd){if(_0x3a7abd){_0x1f9b14=_0x3a7abd;_0x3c1e34['model']=_[_0x6c10('0xcb')](db[_0x6c10('0x109')][_0x6c10('0x41')]);_0x3c1e34[_0x6c10('0x4d')]=_[_0x6c10('0xcb')](_0x497042['query']);_0x3c1e34[_0x6c10('0xcd')]=_[_0x6c10('0xce')](_0x3c1e34[_0x6c10('0xca')],_0x3c1e34[_0x6c10('0x4d')]);_0x4d49e9[_0x6c10('0x53')]=_[_0x6c10('0xce')](_0x3c1e34[_0x6c10('0xca')],qs['fields'](_0x497042['query'][_0x6c10('0xcf')]));_0x4d49e9['attributes']=_0x4d49e9[_0x6c10('0x53')][_0x6c10('0x57')]?_0x4d49e9[_0x6c10('0x53')]:_0x3c1e34['model'];_0x4d49e9['order']=qs['sort'](_0x497042[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x4d49e9['where']=qs[_0x6c10('0xcd')](_[_0x6c10('0xd7')](_0x497042[_0x6c10('0x4d')],_0x3c1e34[_0x6c10('0xcd')]));if(_0x497042[_0x6c10('0x4d')][_0x6c10('0x38')]){_0x4d49e9[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x4d49e9['where'],{'$or':_[_0x6c10('0x3a')](_0x4d49e9[_0x6c10('0x53')],function(_0x2bf91e){var _0x27db11={};_0x27db11[_0x2bf91e]={'$like':'%'+_0x497042[_0x6c10('0x4d')][_0x6c10('0x38')]+'%'};return _0x27db11;})});}_0x4d49e9=_['merge']({},_0x4d49e9,_0x497042[_0x6c10('0x63')]);return _0x1f9b14[_0x6c10('0x10a')](_0x4d49e9);}})[_0x6c10('0x22')](function(_0x348ac2){if(_0x348ac2){_0x1a0264=_0x348ac2[_0x6c10('0x57')];if(!_0x497042[_0x6c10('0x4d')][_0x6c10('0xc4')](_0x6c10('0xd3'))){_0x4d49e9['limit']=qs['limit'](_0x497042['query'][_0x6c10('0x1d')]);_0x4d49e9[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x497042['query']['offset']);}return _0x1f9b14[_0x6c10('0x10a')](_0x4d49e9);}})[_0x6c10('0x22')](function(_0x1c2618){if(_0x1c2618){return _0x1c2618?{'count':_0x1a0264,'rows':_0x1c2618}:null;}})[_0x6c10('0x22')](respondWithResult(_0xce73c7,null))['catch'](handleError(_0xce73c7,null));};exports[_0x6c10('0x10b')]=function(_0x530fa9,_0x21ad67){var _0x1c182c=_0x530fa9['params']['id'];var _0x4735e1=_0x530fa9['body']?_0x530fa9[_0x6c10('0x64')][_0x6c10('0x68')]:null;var _0x3dd792=[];return Promise[_0x6c10('0xff')]()[_0x6c10('0x22')](function(){if(!_0x4735e1)throw new APIBadRequestError(_0x6c10('0x10c'));})['then'](function(){return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x1c182c}});})[_0x6c10('0x22')](function(_0x351a7a){if(!_0x351a7a)throw new APINotFoundError(util[_0x6c10('0xa6')](_0x6c10('0xc3'),_0x530fa9[_0x6c10('0x61')]['id']));return db['sequelize'][_0x6c10('0x10d')](function(_0x1851fb){return _0x351a7a['addTeams'](_0x4735e1,{'transaction':_0x1851fb})[_0x6c10('0x22')](function(){return db[_0x6c10('0x109')][_0x6c10('0x55')]({'where':{'id':{'$in':_0x4735e1}}});})[_0x6c10('0x22')](function(_0x52db9a){var _0x7dc052=_[_0x6c10('0x3a')](_0x52db9a,function(_0x5bd653){return _0x5bd653[_0x6c10('0x10e')]();});return Promise['all'](_0x7dc052);})[_0x6c10('0x22')](function(_0x1fafaf){_0x3dd792=_[_0x6c10('0x10f')](_0x1fafaf);var _0x22c47b=_[_0x6c10('0x3a')](_0x3dd792,function(_0x4ae744){return _0x4ae744[_0x6c10('0x110')](_0x351a7a['id'],{'transaction':_0x1851fb});});return Promise[_0x6c10('0x5e')](_0x22c47b);})[_0x6c10('0x22')](function(){if(!_0x351a7a[_0x6c10('0x99')])return;var _0x5b8bf2=_['filter'](_0x3dd792,function(_0x2c54db){return _0x2c54db['getDataValue'](_0x6c10('0x98'))==='Voice';});var _0x43e207=_[_0x6c10('0x3a')](_0x5b8bf2,function(_0x19e2e4){return db[_0x6c10('0xab')][_0x6c10('0xa7')]({'membername':_0x351a7a[_0x6c10('0x3c')],'UserId':_0x351a7a['id'],'queue_name':_0x19e2e4['name'],'VoiceQueueId':_0x19e2e4['id'],'interface':_[_0x6c10('0x6d')](_0x351a7a[_0x6c10('0x9b')])?util[_0x6c10('0xa6')](_0x6c10('0xeb'),_0x351a7a['name']):_0x351a7a[_0x6c10('0x9b')],'paused':_0x351a7a[_0x6c10('0x9a')]||![],'penalty':_0x351a7a['penalty']},{'transaction':_0x1851fb});});return Promise['all'](_0x43e207);})[_0x6c10('0x22')](function(){return db[_0x6c10('0x111')]['findAll']({'where':{'teamId':{'$in':_0x4735e1}}});})[_0x6c10('0x22')](function(_0x247baf){var _0x2f3876=_['map'](_0x247baf,function(_0x4b44f4){return db['UserVoicePrefix']['create']({'UserId':_0x351a7a['id'],'VoicePrefixId':_0x4b44f4[_0x6c10('0x112')]},{'transaction':_0x1851fb});});return Promise[_0x6c10('0x5e')](_0x2f3876);});});})[_0x6c10('0x22')](function(){for(var _0x484b20=0x0;_0x484b20<_0x3dd792[_0x6c10('0x57')];_0x484b20++){var _0x32f229=_0x3dd792[_0x484b20]['getDataValue']('channel');var _0x83e4c2=_0x32f229+'QueueId';socket['emit'](_0x6c10('0x34')+_0x32f229+_0x6c10('0xa5'),{'UserId':_0x1c182c,['queueField']:_0x3dd792[_0x484b20]['id']});}})['then'](respondWithStatusCode(_0x21ad67,null))[_0x6c10('0x5f')](APIHandleError(_0x21ad67));};exports[_0x6c10('0x113')]=function(_0x370950,_0x40956f){var _0x3211b6=_0x370950[_0x6c10('0x61')]['id'];var _0x14d403=null;if(_0x370950[_0x6c10('0x4d')][_0x6c10('0x68')]){_0x14d403=_[_0x6c10('0xa9')](_0x370950[_0x6c10('0x4d')]['ids'])?_0x370950['query'][_0x6c10('0x68')]:[_0x370950['query']['ids']];}var _0x3a1363=[];return Promise['resolve']()[_0x6c10('0x22')](function(){if(!_0x14d403)throw new APIBadRequestError(_0x6c10('0x114'));})[_0x6c10('0x22')](function(){return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x3211b6}});})[_0x6c10('0x22')](function(_0x1e83a7){if(!_0x1e83a7)throw new APINotFoundError(util[_0x6c10('0xa6')](_0x6c10('0xc3'),_0x370950[_0x6c10('0x61')]['id']));return db[_0x6c10('0x6f')][_0x6c10('0x10d')](function(_0x55e3a1){return _0x1e83a7[_0x6c10('0x113')](_0x14d403,{'transaction':_0x55e3a1})[_0x6c10('0x22')](function(){return db['Team'][_0x6c10('0x55')]({'where':{'id':{'$in':_0x14d403}}});})['then'](function(_0x400192){var _0x12503e=_[_0x6c10('0x3a')](_0x400192,function(_0x483310){return _0x483310['getAssociatedQueues']();});return Promise[_0x6c10('0x5e')](_0x12503e);})[_0x6c10('0x22')](function(_0x332049){_0x3a1363=_[_0x6c10('0x10f')](_0x332049);var _0x146427=_[_0x6c10('0x3a')](_0x3a1363,function(_0x5360af){return _0x5360af[_0x6c10('0x115')](_0x1e83a7['id'],{'transaction':_0x55e3a1});});return Promise['all'](_0x146427);})[_0x6c10('0x22')](function(){if(!_0x1e83a7['online'])return;var _0x3c9f84=_[_0x6c10('0x38')](_0x3a1363,function(_0x51dfe4){return _0x51dfe4[_0x6c10('0x116')]('channel')===_0x6c10('0x117');});var _0x4d05a5=_[_0x6c10('0x3a')](_0x3c9f84,function(_0x2c5c2e){return db[_0x6c10('0xab')][_0x6c10('0x2f')]({'where':{'VoiceQueueId':_0x2c5c2e['id'],'UserId':_0x1e83a7['id']},'transaction':_0x55e3a1});});return Promise[_0x6c10('0x5e')](_0x4d05a5);})['then'](function(){return db[_0x6c10('0x111')][_0x6c10('0x55')]({'where':{'teamId':{'$in':_0x14d403}}});})['then'](function(_0x2234ff){var _0x43969e=_['map'](_0x2234ff,function(_0x714908){return db[_0x6c10('0x118')][_0x6c10('0x2f')]({'where':{'UserId':_0x1e83a7['id'],'VoicePrefixId':_0x714908['VoicePrefixId']}},{'transaction':_0x55e3a1});});return Promise[_0x6c10('0x5e')](_0x43969e);});});})['then'](function(){for(var _0x5d71a1=0x0;_0x5d71a1<_0x3a1363[_0x6c10('0x57')];_0x5d71a1++){var _0x58628a=_0x3a1363[_0x5d71a1][_0x6c10('0x116')](_0x6c10('0x98'));var _0x367873=_0x58628a+_0x6c10('0xa4');socket[_0x6c10('0x2d')](_0x6c10('0x34')+_0x58628a+'Queue:remove',{'UserId':_0x3211b6,['queueField']:_0x3a1363[_0x5d71a1]['id']});}})[_0x6c10('0x22')](respondWithStatusCode(_0x40956f,null))[_0x6c10('0x5f')](APIHandleError(_0x40956f));};exports[_0x6c10('0x119')]=function(_0x295715,_0x3a4d18){var _0x4a7f93={};var _0x23712d={};var _0xe8f34e;var _0xcad7e9;return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x295715[_0x6c10('0x61')]['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x3a4d18,null))[_0x6c10('0x22')](function(_0x426c1c){if(_0x426c1c){_0xe8f34e=_0x426c1c;_0x23712d[_0x6c10('0xca')]=_[_0x6c10('0xcb')](db[_0x6c10('0xc5')][_0x6c10('0x41')]);_0x23712d[_0x6c10('0x4d')]=_[_0x6c10('0xcb')](_0x295715[_0x6c10('0x4d')]);_0x23712d['filters']=_['intersection'](_0x23712d['model'],_0x23712d[_0x6c10('0x4d')]);_0x4a7f93[_0x6c10('0x53')]=_[_0x6c10('0xce')](_0x23712d[_0x6c10('0xca')],qs['fields'](_0x295715['query']['fields']));_0x4a7f93['attributes']=_0x4a7f93[_0x6c10('0x53')]['length']?_0x4a7f93[_0x6c10('0x53')]:_0x23712d[_0x6c10('0xca')];_0x4a7f93[_0x6c10('0xd0')]=qs['sort'](_0x295715[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x4a7f93['where']=qs['filters'](_[_0x6c10('0xd7')](_0x295715[_0x6c10('0x4d')],_0x23712d[_0x6c10('0xcd')]));if(_0x295715[_0x6c10('0x4d')]['filter']){_0x4a7f93['where']=_[_0x6c10('0x62')](_0x4a7f93[_0x6c10('0x4c')],{'$or':_[_0x6c10('0x3a')](_0x4a7f93[_0x6c10('0x53')],function(_0x4cba0b){var _0xbe5372={};_0xbe5372[_0x4cba0b]={'$like':'%'+_0x295715['query'][_0x6c10('0x38')]+'%'};return _0xbe5372;})});}_0x4a7f93=_[_0x6c10('0x62')]({},_0x4a7f93,_0x295715[_0x6c10('0x63')]);return _0xe8f34e['getLists'](_0x4a7f93);}})[_0x6c10('0x22')](function(_0x4bfbb5){if(_0x4bfbb5){_0xcad7e9=_0x4bfbb5[_0x6c10('0x57')];if(!_0x295715[_0x6c10('0x4d')][_0x6c10('0xc4')]('nolimit')){_0x4a7f93[_0x6c10('0x1d')]=qs['limit'](_0x295715['query']['limit']);_0x4a7f93[_0x6c10('0x1b')]=qs[_0x6c10('0x1b')](_0x295715['query']['offset']);}return _0xe8f34e[_0x6c10('0x119')](_0x4a7f93);}})[_0x6c10('0x22')](function(_0x351764){if(_0x351764){return _0x351764?{'count':_0xcad7e9,'rows':_0x351764}:null;}})['then'](respondWithResult(_0x3a4d18,null))[_0x6c10('0x5f')](handleError(_0x3a4d18,null));};exports['getAgents']=function(_0x32a4c0,_0x180a83){var _0x1bff58={};var _0xa344df={};var _0x3b1eb5;return db[_0x6c10('0x40')][_0x6c10('0xc2')]({'where':{'id':_0x32a4c0['params']['id']}})[_0x6c10('0x22')](handleEntityNotFound(_0x180a83,null))[_0x6c10('0x22')](function(_0x3c66b7){if(_0x3c66b7){_0x3b1eb5=_0x3c66b7;_0xa344df['model']=_[_0x6c10('0xcb')](db[_0x6c10('0x40')]['rawAttributes']);_0xa344df['query']=_['keys'](_0x32a4c0['query']);_0xa344df[_0x6c10('0xcd')]=_[_0x6c10('0xce')](_0xa344df['model'],_0xa344df[_0x6c10('0x4d')]);_0x1bff58[_0x6c10('0x53')]=_['intersection'](_0xa344df[_0x6c10('0xca')],qs[_0x6c10('0xcf')](_0x32a4c0['query'][_0x6c10('0xcf')]));_0x1bff58[_0x6c10('0x53')]=_0x1bff58[_0x6c10('0x53')][_0x6c10('0x57')]?_0x1bff58[_0x6c10('0x53')]:_0xa344df[_0x6c10('0xca')];_0x1bff58[_0x6c10('0xd0')]=qs[_0x6c10('0xd1')](_0x32a4c0[_0x6c10('0x4d')][_0x6c10('0xd1')]);_0x1bff58[_0x6c10('0x4c')]=qs[_0x6c10('0xcd')](_[_0x6c10('0xd7')](_0x32a4c0[_0x6c10('0x4d')],_0xa344df[_0x6c10('0xcd')]));if(_0x32a4c0[_0x6c10('0x4d')][_0x6c10('0x38')]){_0x1bff58[_0x6c10('0x4c')]=_[_0x6c10('0x62')](_0x1bff58[_0x6c10('0x4c')],{'$or':_[_0x6c10('0x3a')](_0x1bff58['attributes'],function(_0x4df064){var _0x51c9a1={};_0x51c9a1[_0x4df064]={'$like':'%'+_0x32a4c0[_0x6c10('0x4d')]['filter']+'%'};return _0x51c9a1;})});}_0x1bff58[_0x6c10('0xca')]=db[_0x6c10('0x40')];_0x1bff58['as']=_0x6c10('0x35');_0x1bff58=_[_0x6c10('0x62')]({},_0x1bff58,_0x32a4c0[_0x6c10('0x63')]);return _0x3b1eb5[_0x6c10('0x11a')]({'include':[_0x1bff58]});}})['then'](function(_0x1b8d1a){if(_0x1b8d1a){var _0x15898d={},_0x4863f9=[];for(var _0x4b4409=0x0;_0x4b4409<_0x1b8d1a['length'];_0x4b4409+=0x1){for(var _0x579483=0x0,_0x415d6f;_0x579483<_0x1b8d1a[_0x4b4409]['Agents'][_0x6c10('0x57')];_0x579483+=0x1){_0x415d6f=_0x1b8d1a[_0x4b4409][_0x6c10('0x35')][_0x579483][_0x6c10('0x30')]({'plain':!![]});_0x15898d[_0x415d6f['id']]=_0x415d6f;}}_0x15898d=_[_0x6c10('0x11b')](_0x15898d);for(var _0x500c6a=qs[_0x6c10('0x1b')](_0x32a4c0[_0x6c10('0x4d')][_0x6c10('0x1b')]);_0x500c6a<_0x15898d[_0x6c10('0x57')]&&_0x4863f9[_0x6c10('0x57')]=_0x75a663){_0x15330d=_0x75a663;_0x434417=0xc8;}else{_0x434417=0xce;}_0x5da49b['status'](_0x434417);return _0x5da49b[_0x3df2('0x1e')]('Content-Range',_0xbd406f+'-'+_0x15330d+'/'+_0x75a663)[_0x3df2('0x19')](_0x3e6b02);}return null;};}function respondWithRpcPromise(_0x1611c4,_0x9d859c,_0x4338fd,_0x550b78){return new Promise(function(_0x55a318,_0x30fe39){var _0x484af2=_0x550b78||amiClient;return _0x484af2['request'](_0x1611c4,_0x4338fd)[_0x3df2('0x1f')](function(_0x45a2bc){logger[_0x3df2('0x20')](_0x3df2('0x21'),_0x9d859c,'request\x20sent');logger[_0x3df2('0x22')](_0x3df2('0x23'),_0x9d859c,_0x3df2('0x24'),JSON['stringify'](_0x45a2bc));if(_0x45a2bc[_0x3df2('0x25')]){if(_0x45a2bc[_0x3df2('0x25')][_0x3df2('0x26')]===0x1f4){logger[_0x3df2('0x25')](_0x3df2('0x21'),_0x9d859c,_0x45a2bc[_0x3df2('0x25')]['message']);return _0x30fe39(_0x45a2bc[_0x3df2('0x25')]['message']);}logger[_0x3df2('0x25')](_0x3df2('0x21'),_0x9d859c,_0x45a2bc[_0x3df2('0x25')][_0x3df2('0x27')]);return _0x55a318(_0x45a2bc['error'][_0x3df2('0x27')]);}else{logger['info'](_0x3df2('0x21'),_0x9d859c,_0x3df2('0x24'));_0x55a318(_0x45a2bc['result'][_0x3df2('0x27')]);}})['catch'](function(_0x5ad292){logger[_0x3df2('0x25')](_0x3df2('0x21'),_0x9d859c,_0x5ad292);_0x30fe39(_0x5ad292);});});}function saveUpdates(_0x2df084){return function(_0x1f0d74){if(_0x1f0d74){return _0x1f0d74[_0x3df2('0x28')](_0x2df084)['then'](function(_0x413db5){if(_0x413db5['role']===_0x3df2('0x29')){socket[_0x3df2('0x2a')]('userNotification:recalc:'+_0x413db5['id'],_0x413db5);}return _0x413db5;});}return null;};}function removeEntity(_0x4d5d25,_0x15ddff){return function(_0x5e563a){if(_0x5e563a){return _0x5e563a[_0x3df2('0x2b')]({'transaction':_0x15ddff})[_0x3df2('0x1f')](function(){var _0x2c057a=_0x5e563a[_0x3df2('0x2c')]({'plain':!![]});if(_0x2c057a[_0x3df2('0x2d')]==='admin')return;var _0x5ba4e2=[{'name':'Users','value':_0x3df2('0x2e'),'ignore':!![]},{'name':_0x3df2('0x2f'),'value':_0x3df2('0x29'),'ignore':![]},{'name':_0x3df2('0x30'),'value':_0x3df2('0x31'),'ignore':![]}];var _0x3f8f73=_(_0x5ba4e2)['filter'](_0x3df2('0x32'))[_0x3df2('0x33')](_0x3df2('0x34'))[_0x3df2('0x34')]();if(_[_0x3df2('0x35')](_0x3f8f73,_0x2c057a[_0x3df2('0x2d')])){return;}var _0x5afeb1=_['find'](_0x5ba4e2,[_0x3df2('0x34'),_0x2c057a[_0x3df2('0x2d')]])[_0x3df2('0x36')];return db[_0x3df2('0x37')][_0x3df2('0x2b')]({'where':{'type':_0x5afeb1,'resourceId':_0x2c057a['id']},'transaction':_0x15ddff})[_0x3df2('0x1f')](function(){return _0x5e563a;});})[_0x3df2('0x1f')](function(){_0x4d5d25[_0x3df2('0x17')](0xcc)[_0x3df2('0x18')]();});}};}function handleEntityNotFound(_0x3b5ec7){return function(_0x140b91){if(!_0x140b91){_0x3b5ec7[_0x3df2('0x16')](0x194);}return _0x140b91;};}function handleError(_0x294aad,_0x2650b2){_0x2650b2=_0x2650b2||0x1f4;return function(_0x3807d0){logger[_0x3df2('0x25')](_0x3807d0['stack']);if(_0x3807d0[_0x3df2('0x36')]){delete _0x3807d0[_0x3df2('0x36')];}_0x294aad[_0x3df2('0x17')](_0x2650b2)[_0x3df2('0x38')](_0x3807d0);};}function getUserAttributes(){return _(db[_0x3df2('0x39')][_0x3df2('0x3a')])[_0x3df2('0x33')](function(_0x39d37a){return{'name':_0x39d37a[_0x3df2('0x3b')],'type':_0x39d37a[_0x3df2('0x3c')]['key']};})[_0x3df2('0x3d')](function(_0x258057){return![_0x3df2('0x3e'),_0x3df2('0x3f'),_0x3df2('0x40'),_0x3df2('0x41'),_0x3df2('0x42'),_0x3df2('0x43')]['includes'](_0x258057[_0x3df2('0x36')]);})[_0x3df2('0x34')]();}exports[_0x3df2('0x44')]=function(_0x1455a0,_0x30bc6f){var _0x1cc6c5={},_0x26e42a={'count':0x0,'rows':[]};var _0x5e7c11=getUserAttributes();_0x1cc6c5=qs['getOptions'](_0x5e7c11,_0x1455a0);var _0x1fd6a4={'where':_0x1cc6c5[_0x3df2('0x45')]};return db['User'][_0x3df2('0x1d')](_0x1fd6a4)[_0x3df2('0x1f')](function(_0x4755e9){_0x26e42a[_0x3df2('0x1d')]=_0x4755e9;if(_0x1455a0[_0x3df2('0x46')][_0x3df2('0x47')]){_0x1cc6c5[_0x3df2('0x48')]=[{'all':!![]}];}if(_0x1455a0[_0x3df2('0x46')][_0x3df2('0x49')]===_0x3df2('0x4a')){_0x1cc6c5[_0x3df2('0x48')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_['includes'](_0x1cc6c5['attributes'],'id')){_0x1cc6c5[_0x3df2('0x4b')][_0x3df2('0x4c')]('id');}return db[_0x3df2('0x39')][_0x3df2('0x4d')](_0x1cc6c5);})[_0x3df2('0x1f')](function(_0x442596){_0x26e42a[_0x3df2('0x4e')]=_0x442596;if(_0x1455a0[_0x3df2('0x46')][_0x3df2('0x4f')]===_0x3df2('0x4a')){var _0x109be5=[];for(var _0x264570=0x0;_0x264570<_0x26e42a[_0x3df2('0x4e')][_0x3df2('0x50')];_0x264570++){_0x109be5[_0x3df2('0x4c')](get_open_tabs(_0x3df2('0x51'),_0x26e42a['rows'][_0x264570][_0x3df2('0x52')]));_0x109be5[_0x3df2('0x4c')](get_open_tabs(_0x3df2('0x53'),_0x26e42a[_0x3df2('0x4e')][_0x264570]['dataValues']));_0x109be5[_0x3df2('0x4c')](get_open_tabs(_0x3df2('0x54'),_0x26e42a['rows'][_0x264570][_0x3df2('0x52')]));_0x109be5[_0x3df2('0x4c')](get_open_tabs('mail',_0x26e42a[_0x3df2('0x4e')][_0x264570]['dataValues']));_0x109be5[_0x3df2('0x4c')](get_open_tabs('openchannel',_0x26e42a[_0x3df2('0x4e')][_0x264570][_0x3df2('0x52')]));_0x109be5[_0x3df2('0x4c')](get_open_tabs('whatsapp',_0x26e42a['rows'][_0x264570][_0x3df2('0x52')]));}return Promise[_0x3df2('0x55')](_0x109be5)['then'](function(){return _0x26e42a;});}else{return _0x26e42a;}})['then'](respondWithFilteredResult(_0x30bc6f,_0x1cc6c5))[_0x3df2('0x56')](handleError(_0x30bc6f,null));};exports[_0x3df2('0x57')]=function(_0x1562c8,_0x5e244a){var _0xeff8dc=getUserAttributes();_0x1562c8[_0x3df2('0x46')]['id']=_0x1562c8[_0x3df2('0x58')]['id'];var _0x44b585=qs[_0x3df2('0x59')](_0xeff8dc,_0x1562c8);if(_0x1562c8[_0x3df2('0x46')]['includeAll']){_0x44b585['include']=[{'all':!![]}];}if(_0x1562c8['query'][_0x3df2('0x49')]==='true'){_0x44b585['include']=[{'model':db['UserSetting'],'as':_0x3df2('0x49')}];}_0x44b585=_['merge']({},_0x44b585,_0x1562c8[_0x3df2('0x5a')]);if(!_[_0x3df2('0x35')](_0x44b585[_0x3df2('0x4b')],'id')){_0x44b585[_0x3df2('0x4b')][_0x3df2('0x4c')]('id');}return db[_0x3df2('0x39')][_0x3df2('0x5b')](_0x44b585)[_0x3df2('0x1f')](handleEntityNotFound(_0x5e244a,null))[_0x3df2('0x1f')](function(_0xc8ecd5){var _0x59761f=[];values=_0xc8ecd5;if(_0x1562c8[_0x3df2('0x46')][_0x3df2('0x4f')]===_0x3df2('0x4a')){_0x59761f['push'](get_open_tabs(_0x3df2('0x51'),_0xc8ecd5[_0x3df2('0x52')]));_0x59761f['push'](get_open_tabs(_0x3df2('0x53'),_0xc8ecd5[_0x3df2('0x52')]));_0x59761f[_0x3df2('0x4c')](get_open_tabs('openchannel',_0xc8ecd5[_0x3df2('0x52')]));_0x59761f['push'](get_open_tabs(_0x3df2('0x5c'),_0xc8ecd5[_0x3df2('0x52')]));_0x59761f[_0x3df2('0x4c')](get_open_tabs('fax',_0xc8ecd5[_0x3df2('0x52')]));_0x59761f['push'](get_open_tabs(_0x3df2('0x5d'),_0xc8ecd5[_0x3df2('0x52')]));return Promise[_0x3df2('0x55')](_0x59761f);}else{return values;}})[_0x3df2('0x1f')](function(){return values;})[_0x3df2('0x1f')](respondWithResult(_0x5e244a,null))['catch'](handleError(_0x5e244a,null));};exports[_0x3df2('0x28')]=function(_0x3dd685,_0x2743b3){if(_0x3dd685[_0x3df2('0x5e')]['id']){delete _0x3dd685[_0x3df2('0x5e')]['id'];}delete _0x3dd685[_0x3df2('0x5e')]['role'];return db[_0x3df2('0x39')][_0x3df2('0x5b')]({'where':{'id':_0x3dd685['params']['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x2743b3,null))['then'](saveUpdates(_0x3dd685[_0x3df2('0x5e')],null))[_0x3df2('0x1f')](respondWithResult(_0x2743b3,null))['catch'](handleError(_0x2743b3,null));};exports['describe']=function(_0x5a017a,_0x40f9fc){return db[_0x3df2('0x39')]['describe']()['then'](respondWithResult(_0x40f9fc,null))['catch'](handleError(_0x40f9fc,null));};exports['addContacts']=function(_0x4943b3,_0x3310d3){return db[_0x3df2('0x39')][_0x3df2('0x5b')]({'where':{'id':_0x4943b3['params']['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x3310d3,null))[_0x3df2('0x1f')](function(_0x372076){if(_0x372076){return _0x372076[_0x3df2('0x5f')](_0x4943b3[_0x3df2('0x5e')][_0x3df2('0x60')],_[_0x3df2('0x61')](_0x4943b3[_0x3df2('0x5e')],[_0x3df2('0x60'),'id'])||{});}})['then'](respondWithResult(_0x3310d3,null))[_0x3df2('0x56')](handleError(_0x3310d3,null));};function validateUser(_0x4ba81f){return new Promise(function(_0x2c9b27,_0x3db065){if(_0x4ba81f[_0x3df2('0x62')])return _0x2c9b27(_0x4ba81f);return db['Setting'][_0x3df2('0x63')](0x1)[_0x3df2('0x1f')](function(_0x4e47c8){if(_0x4e47c8[_0x3df2('0x64')])authService['validatePasswordPattern'](_0x4ba81f['password']);db['User'][_0x3df2('0x65')](_0x3df2('0x62'))[_0x3df2('0x1f')](function(_0x5d5074){if(_[_0x3df2('0x66')](_0x5d5074)){_0x4ba81f['internal']=_0x4e47c8['min_internal']||0x1;return;}if(_[_0x3df2('0x66')](_0x4e47c8[_0x3df2('0x67')])||_0x4e47c8[_0x3df2('0x67')]===_0x5d5074){_0x4ba81f[_0x3df2('0x62')]=_0x5d5074+0x1;return;}if(_0x4e47c8[_0x3df2('0x67')]>_0x5d5074){_0x4ba81f[_0x3df2('0x62')]=_0x4e47c8['min_internal'];return;}return db[_0x3df2('0x68')][_0x3df2('0x46')](_0x3df2('0x69'),{'type':db[_0x3df2('0x68')][_0x3df2('0x6a')][_0x3df2('0x6b')]})[_0x3df2('0x1f')](function(_0x22ba01){if(_0x22ba01&&_0x22ba01[_0x3df2('0x50')]){for(var _0xd92f98=0x0,_0x42c94e=_0x22ba01['length'];_0xd92f98<_0x42c94e&&_[_0x3df2('0x66')](_0x4ba81f[_0x3df2('0x62')]);_0xd92f98++){if(_0x4e47c8['min_internal']<=_0x22ba01[_0xd92f98][_0x3df2('0x6c')]){_0x4ba81f[_0x3df2('0x62')]=_0x22ba01[_0xd92f98]['from'];}else if(_0x4e47c8[_0x3df2('0x67')]>_0x22ba01[_0xd92f98][_0x3df2('0x6c')]&&_0x4e47c8[_0x3df2('0x67')]<=_0x22ba01[_0xd92f98]['to']){_0x4ba81f['internal']=_0x4e47c8[_0x3df2('0x67')];}}}if(_[_0x3df2('0x66')](_0x4ba81f['internal'])){_0x4ba81f[_0x3df2('0x62')]=_0x5d5074+0x1;}return _0x2c9b27(_0x4ba81f);});});})[_0x3df2('0x56')](function(_0x22c4cd){_0x3db065(_0x22c4cd);});});}function updateUser(_0x4c88a0){return new Promise(function(_0x5a586c,_0x148a87){try{if(_0x4c88a0[_0x3df2('0x6d')]){_0x4c88a0[_0x3df2('0x6e')]=_0x4c88a0[_0x3df2('0x62')];_0x4c88a0[_0x3df2('0x6f')]={'mailbox':_0x4c88a0[_0x3df2('0x62')],'password':_0x4c88a0[_0x3df2('0x3e')],'fullname':_0x4c88a0[_0x3df2('0x70')],'email':_0x4c88a0['email']};}if(_0x4c88a0[_0x3df2('0x2d')]==='agent'){if(!_0x4c88a0[_0x3df2('0x71')])_0x4c88a0['permissions']=[_0x3df2('0x72'),'102',_0x3df2('0x73'),'113','110',_0x3df2('0x74'),_0x3df2('0x75'),_0x3df2('0x76'),_0x3df2('0x77'),'108',_0x3df2('0x78'),'100',_0x3df2('0x79'),_0x3df2('0x7a'),'115'];}_0x5a586c(_0x4c88a0);}catch(_0x2f25d9){_0x148a87(_0x2f25d9);}});}exports[_0x3df2('0x7b')]=function(_0x76115f,_0xb736b){if(_0x76115f[_0x3df2('0x2e')]['role']==='agent')throw new Error('Unauthorized');if(_0x76115f[_0x3df2('0x5e')][_0x3df2('0x2d')]===_0x3df2('0x2e')&&_0x76115f[_0x3df2('0x2e')][_0x3df2('0x2d')]!==_0x3df2('0x7c')){throw new Error(_0x3df2('0x7d'));}if(_0x76115f[_0x3df2('0x5e')][_0x3df2('0x2d')]==='admin'&&_0x76115f['user'][_0x3df2('0x2d')]!==_0x3df2('0x7c')){throw new Error(_0x3df2('0x7e'));}return licenseUtil[_0x3df2('0x7f')]([_0x76115f['body']])[_0x3df2('0x1f')](function(){return validateUser(_0x76115f[_0x3df2('0x5e')]);})['then'](function(_0x51685c){return updateUser(_0x51685c)['then'](function(_0xa1c276){if(_0xa1c276[_0x3df2('0x2d')]===_0x3df2('0x7c')){_0xa1c276[_0x3df2('0x80')]=_0x76115f['user'][_0x3df2('0x80')];delete _0xa1c276[_0x3df2('0x81')];}return _0xa1c276;});})[_0x3df2('0x1f')](function(_0xf85b39){return db[_0x3df2('0x39')][_0x3df2('0x7b')](_0xf85b39,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0x3df2('0x1f')](function(_0x4390bb){if(_0x76115f['body'][_0x3df2('0x2d')]===_0x3df2('0x2e'))return _0x4390bb;if(_0x76115f[_0x3df2('0x2e')][_0x3df2('0x2d')]!=='user')return _0x4390bb;return db[_0x3df2('0x82')][_0x3df2('0x5b')]({'where':{'name':_0x4390bb[_0x3df2('0x2d')]===_0x3df2('0x29')?_0x3df2('0x2f'):_0x3df2('0x30'),'userProfileId':_0x76115f[_0x3df2('0x2e')]['userProfileId']},'raw':!![]})[_0x3df2('0x1f')](function(_0x3f3cbf){if(!_0x3f3cbf||_0x3f3cbf[_0x3df2('0x83')]!=0x0)return _0x4390bb;return db['UserProfileResource'][_0x3df2('0x7b')]({'name':_0x4390bb[_0x3df2('0x36')],'resourceId':_0x4390bb['id'],'type':_0x3f3cbf[_0x3df2('0x36')],'sectionId':_0x3f3cbf['id']},{})['then'](function(){return _0x4390bb;});})[_0x3df2('0x56')](function(_0x41b792){logger[_0x3df2('0x25')](_0x3df2('0x84'),_0x41b792);throw _0x41b792;});})[_0x3df2('0x1f')](respondWithResult(_0xb736b,0xc9))[_0x3df2('0x56')](handleError(_0xb736b,null));};exports[_0x3df2('0x85')]=function(_0x4a2f08,_0x3e3f45){var _0x4651a4=_0x4a2f08[_0x3df2('0x5e')];var _0x1c1e17=[];if(_0x4a2f08[_0x3df2('0x2e')]['role']===_0x3df2('0x29'))throw new Error(_0x3df2('0x86'));if(_['some'](_0x4651a4,['role',_0x3df2('0x2e')])&&_0x4a2f08[_0x3df2('0x2e')][_0x3df2('0x2d')]!=='admin'){throw new Error(_0x3df2('0x7d'));}if(_[_0x3df2('0x87')](_0x4651a4,[_0x3df2('0x2d'),_0x3df2('0x7c')])&&_0x4a2f08[_0x3df2('0x2e')][_0x3df2('0x2d')]!==_0x3df2('0x7c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x3df2('0x7f')](_0x4651a4)[_0x3df2('0x1f')](function(){return validateUser(_0x4651a4[0x0]);})[_0x3df2('0x1f')](function(){for(var _0x54f231=0x1;_0x54f231<_0x4651a4[_0x3df2('0x50')];_0x54f231++){var _0x510c41=_0x4651a4[_0x54f231-0x1][_0x3df2('0x62')];if(!_0x4651a4[_0x54f231]['internal'])_0x4651a4[_0x54f231]['internal']=_0x510c41+0x1;_0x1c1e17['push'](validateUser(_0x4651a4[_0x54f231]));}return Promise[_0x3df2('0x55')](_0x1c1e17);})[_0x3df2('0x1f')](function(){_0x1c1e17=[];for(var _0x39b89b=0x0;_0x39b89b<_0x4651a4[_0x3df2('0x50')];_0x39b89b++){_0x1c1e17['push'](updateUser(_0x4651a4[_0x39b89b]));}return Promise[_0x3df2('0x55')](_0x1c1e17);})[_0x3df2('0x1f')](function(){_0x1c1e17=_0x4651a4[_0x3df2('0x33')](function(_0x459e6d){return db['User']['create'](_0x459e6d,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})['then'](function(_0x2f4f89){_0x459e6d['id']=_0x2f4f89['id'];return _0x459e6d;});});return Promise[_0x3df2('0x55')](_0x1c1e17);})[_0x3df2('0x1f')](function(_0x49bd4f){if(_0x4a2f08[_0x3df2('0x5e')][_0x3df2('0x2d')]===_0x3df2('0x2e'))return _0x49bd4f;if(_0x4a2f08[_0x3df2('0x2e')][_0x3df2('0x2d')]!==_0x3df2('0x2e'))return _0x49bd4f;var _0x59c0c9=_['some'](_0x49bd4f,function(_0x2a31d9){return _0x2a31d9[_0x3df2('0x2d')]==='agent'||_0x2a31d9['role']==='telephone';});if(!_0x59c0c9)return _0x49bd4f;return db[_0x3df2('0x82')][_0x3df2('0x4d')]({'where':{'name':{'$or':[_0x3df2('0x2f'),_0x3df2('0x30')]},'userProfileId':_0x4a2f08[_0x3df2('0x2e')][_0x3df2('0x81')]},'raw':!![]})[_0x3df2('0x1f')](function(_0x3e1b07){if(_[_0x3df2('0x88')](_0x3e1b07)||!_['some'](_0x3e1b07,[_0x3df2('0x83'),0x0]))return _0x49bd4f;_0x1c1e17=[];var _0x1f6b34=_(_0x3e1b07)[_0x3df2('0x33')](function(_0x50c409){if(_0x50c409['autoAssociation']===0x1)return;return _0x50c409[_0x3df2('0x36')]===_0x3df2('0x2f')?_0x3df2('0x29'):_0x3df2('0x31');})[_0x3df2('0x89')]()[_0x3df2('0x34')]();for(var _0x355b84=0x0;_0x355b84<_0x49bd4f[_0x3df2('0x50')];_0x355b84++){if(!_['includes'](_0x1f6b34,_0x49bd4f[_0x355b84]['role']))return;var _0x3b396b=_0x49bd4f[_0x355b84]['role']===_0x3df2('0x29')?_0x3df2('0x2f'):_0x3df2('0x30');_0x1c1e17['push'](db['UserProfileResource'][_0x3df2('0x7b')]({'name':_0x49bd4f[_0x355b84][_0x3df2('0x36')],'resourceId':_0x49bd4f[_0x355b84]['id'],'type':_0x3b396b,'sectionId':_[_0x3df2('0x5b')](_0x3e1b07,[_0x3df2('0x36'),_0x3b396b])['id']},{}));}return Promise[_0x3df2('0x55')](_0x1c1e17);});})[_0x3df2('0x1f')](respondWithResult(_0x3e3f45,0xc9))[_0x3df2('0x56')](handleError(_0x3e3f45,null));};exports[_0x3df2('0x8a')]=function(_0x40d0f9,_0x221d67){if(_0x40d0f9[_0x3df2('0x5e')]['id']){delete _0x40d0f9[_0x3df2('0x5e')]['id'];}return db[_0x3df2('0x39')]['find']({'where':{'id':_0x40d0f9[_0x3df2('0x58')]['id']}})['then'](function(_0x5a9d8d){if(!_0x5a9d8d)return null;if(_0x5a9d8d['id']===_0x40d0f9[_0x3df2('0x2e')]['id']){if(!_0x40d0f9[_0x3df2('0x5e')][_0x3df2('0x8b')]||!_0x40d0f9['body'][_0x3df2('0x8c')]){throw new db['Sequelize'][(_0x3df2('0x8d'))](_0x3df2('0x8e'));}if(!_0x5a9d8d[_0x3df2('0x8f')](_0x40d0f9[_0x3df2('0x5e')][_0x3df2('0x8b')])){throw new db['Sequelize'][(_0x3df2('0x8d'))]('Wrong\x20credentials');}if(_0x40d0f9[_0x3df2('0x5e')][_0x3df2('0x8b')]===_0x40d0f9['body']['newPassword']){throw new db[(_0x3df2('0x90'))][(_0x3df2('0x8d'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x40d0f9[_0x3df2('0x2e')][_0x3df2('0x2d')]===_0x3df2('0x7c')){if(!_0x40d0f9[_0x3df2('0x5e')][_0x3df2('0x8c')]){throw new db[(_0x3df2('0x90'))][(_0x3df2('0x8d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x40d0f9[_0x3df2('0x2e')][_0x3df2('0x2d')]===_0x3df2('0x2e')){if(!_0x40d0f9[_0x3df2('0x5e')][_0x3df2('0x8c')]){throw new db[(_0x3df2('0x90'))][(_0x3df2('0x8d'))](_0x3df2('0x91'));}if(_0x5a9d8d[_0x3df2('0x2d')]!=='agent'){throw new db[(_0x3df2('0x90'))]['ValidationError'](_0x3df2('0x86'));}}else{throw new db[(_0x3df2('0x90'))][(_0x3df2('0x8d'))](_0x3df2('0x86'));}return _0x5a9d8d;})[_0x3df2('0x1f')](handleEntityNotFound(_0x221d67,null))[_0x3df2('0x1f')](function(_0x397389){return db[_0x3df2('0x92')][_0x3df2('0x93')]({'attributes':['id','securePassword',_0x3df2('0x94'),_0x3df2('0x95')]})['then'](function(_0x51ab8c){if(_0x51ab8c[_0x3df2('0x64')])authService['validatePasswordPattern'](_0x40d0f9[_0x3df2('0x5e')][_0x3df2('0x8c')]);if(!_0x51ab8c[_0x3df2('0x94')]||!_0x397389[_0x3df2('0x40')])return _0x397389;authService[_0x3df2('0x96')](_0x40d0f9['body'][_0x3df2('0x8c')],_0x397389[_0x3df2('0x40')],_0x51ab8c[_0x3df2('0x95')]);return _0x397389;})[_0x3df2('0x1f')](saveUpdates({'password':_0x40d0f9[_0x3df2('0x5e')][_0x3df2('0x8c')],'passwordResetAt':_0x40d0f9['user']['id']==_0x40d0f9[_0x3df2('0x58')]['id']?moment():null,'previousPasswords':authService[_0x3df2('0x97')](_0x40d0f9[_0x3df2('0x5e')]['newPassword'],_0x397389['previousPasswords'])},null));})['then'](respondWithResult(_0x221d67,null))[_0x3df2('0x56')](handleError(_0x221d67,null));};exports[_0x3df2('0x98')]=function(_0x185ab3,_0x35bd26){var _0x252398=_0x185ab3[_0x3df2('0x5e')][_0x3df2('0x99')];return db[_0x3df2('0x39')][_0x3df2('0x5b')]({'where':{'id':_0x185ab3[_0x3df2('0x58')]['id']},'attributes':['id',_0x3df2('0x36'),_0x3df2('0x2d'),'online',_0x3df2('0x9a'),_0x3df2('0x9b'),'interface']})['then'](handleEntityNotFound(_0x35bd26,null))[_0x3df2('0x1f')](function(_0x374f44){if(_0x374f44){if(!utils[_0x3df2('0x9c')](_0x252398)){throw new db[(_0x3df2('0x90'))][(_0x3df2('0x8d'))](_0x3df2('0x9d'));}return _0x374f44['add'+_['capitalize'](_0x252398[_0x3df2('0x9e')]())+_0x3df2('0x9f')](_0x185ab3['body'][_0x3df2('0x60')],{'penalty':_0x185ab3['body'][_0x3df2('0xa0')]||0x0})['spread'](function(_0x1718bb){for(var _0x847158=0x0;_0x847158<_0x185ab3['body'][_0x3df2('0x60')][_0x3df2('0x50')];_0x847158+=0x1){var _0x1e11ac={'UserId':Number(_0x185ab3[_0x3df2('0x58')]['id'])};_0x1e11ac[_[_0x3df2('0xa1')](_0x252398[_0x3df2('0x9e')]())+_0x3df2('0xa2')]=Number(_0x185ab3[_0x3df2('0x5e')][_0x3df2('0x60')][_0x847158]);socket[_0x3df2('0x2a')](_0x3df2('0x2e')+_[_0x3df2('0xa1')](_0x252398[_0x3df2('0x9e')]())+_0x3df2('0xa3'),_0x1e11ac);}return _0x1718bb;})[_0x3df2('0x1f')](function(){if(_0x252398===_0x3df2('0xa4')){return db[_0x3df2('0xa5')][_0x3df2('0x4d')]({'where':{'id':_0x185ab3[_0x3df2('0x5e')][_0x3df2('0x60')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x3df2('0x1f')](function(_0x2f1b14){var _0x3ab534=_0x374f44[_0x3df2('0x2c')]({'plain':!![]});var _0x543b7c=[];if(_0x252398===_0x3df2('0xa4')&&_0x3ab534['role']==='agent'&&_0x3ab534['online']){for(let _0x1776d3=0x0;_0x1776d3<_0x2f1b14[_0x3df2('0x50')];_0x1776d3+=0x1){_0x543b7c[_0x3df2('0x4c')]({'membername':_0x3ab534[_0x3df2('0x36')],'UserId':_0x3ab534['id'],'queue_name':_0x2f1b14[_0x1776d3][_0x3df2('0x36')],'VoiceQueueId':_0x2f1b14[_0x1776d3]['id'],'interface':_[_0x3df2('0x66')](_0x3ab534['interface'])?util['format'](_0x3df2('0xa6'),_0x3ab534[_0x3df2('0x36')]):_0x3ab534[_0x3df2('0xa7')],'paused':_0x3ab534[_0x3df2('0x9b')]||![],'penalty':_0x185ab3[_0x3df2('0x5e')][_0x3df2('0xa0')]||0x0});}return Promise[_0x3df2('0x55')](_0x543b7c[_0x3df2('0x33')](function(_0x32aced){return db[_0x3df2('0xa8')][_0x3df2('0xa9')](_0x32aced);}));}return _0x374f44;});}})[_0x3df2('0x1f')](respondWithStatusCode(_0x35bd26,null))['catch'](handleError(_0x35bd26,null));};exports['removeQueues']=function(_0x247079,_0x58b011){var _0xca71b9,_0x3df639;return db[_0x3df2('0x39')][_0x3df2('0x5b')]({'where':{'id':_0x247079['params']['id']},'attributes':['id','name',_0x3df2('0x2d')]})['then'](handleEntityNotFound(_0x58b011,null))[_0x3df2('0x1f')](function(_0x11c339){if(_0x11c339){_0xca71b9=_0x11c339;if(!_0x247079[_0x3df2('0x46')][_0x3df2('0x99')]||!utils[_0x3df2('0x9c')](_0x247079['query']['channel'])){throw new db[(_0x3df2('0x90'))][(_0x3df2('0x8d'))](_0x3df2('0x9d'));}return _0x11c339[_0x3df2('0xaa')+_[_0x3df2('0xa1')](_0x247079[_0x3df2('0x46')][_0x3df2('0x99')][_0x3df2('0x9e')]())+'Queues'](_0x247079['query'][_0x3df2('0x60')]);}})['then'](function(_0x4cb519){if(_[_0x3df2('0xab')](_0x247079[_0x3df2('0x46')][_0x3df2('0x60')])){for(var _0x2eb2cb=0x0;_0x2eb2cb<_0x247079[_0x3df2('0x46')][_0x3df2('0x60')][_0x3df2('0x50')];_0x2eb2cb+=0x1){_0x3df639={'UserId':Number(_0x247079[_0x3df2('0x58')]['id'])};_0x3df639[_[_0x3df2('0xa1')](_0x247079[_0x3df2('0x46')][_0x3df2('0x99')]['toLowerCase']())+_0x3df2('0xa2')]=Number(_0x247079[_0x3df2('0x46')]['ids'][_0x2eb2cb]);socket[_0x3df2('0x2a')]('user'+_['capitalize'](_0x247079[_0x3df2('0x46')][_0x3df2('0x99')][_0x3df2('0x9e')]())+_0x3df2('0xac'),_0x3df639);}}else{_0x3df639={'UserId':Number(_0x247079[_0x3df2('0x58')]['id'])};_0x3df639[_[_0x3df2('0xa1')](_0x247079[_0x3df2('0x46')][_0x3df2('0x99')][_0x3df2('0x9e')]())+_0x3df2('0xa2')]=Number(_0x247079[_0x3df2('0x46')][_0x3df2('0x60')]);socket[_0x3df2('0x2a')](_0x3df2('0x2e')+_[_0x3df2('0xa1')](_0x247079[_0x3df2('0x46')][_0x3df2('0x99')][_0x3df2('0x9e')]())+_0x3df2('0xac'),_0x3df639);}return _0x4cb519;})[_0x3df2('0x1f')](function(){if(_0x247079[_0x3df2('0x46')][_0x3df2('0x99')]==='voice'){return db['UserVoiceQueueRt'][_0x3df2('0x2b')]({'where':{'UserId':_0x247079[_0x3df2('0x58')]['id'],'VoiceQueueId':_0x247079[_0x3df2('0x46')]['ids']},'individualHooks':!![]})[_0x3df2('0x1f')](function(){return _0xca71b9;});}return _0xca71b9;})[_0x3df2('0x1f')](respondWithStatusCode(_0x58b011,null))[_0x3df2('0x56')](handleError(_0x58b011,null));};exports[_0x3df2('0xad')]=function(_0x1e4e2d,_0x544c9d){_0x1e4e2d[_0x3df2('0x5e')][_0x3df2('0xae')]=_0x1e4e2d[_0x3df2('0xaf')][_0x3df2('0xb0')];return db[_0x3df2('0x39')]['find']({'where':{'id':_0x1e4e2d[_0x3df2('0x58')]['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x544c9d,null))[_0x3df2('0x1f')](saveUpdates(_0x1e4e2d[_0x3df2('0x5e')],null))[_0x3df2('0x1f')](respondWithResult(_0x544c9d,null))['catch'](handleError(_0x544c9d,null));};exports[_0x3df2('0xb1')]=function(_0x57d998,_0x484173){var _0x1086a6=path['join'](config[_0x3df2('0xb2')],'server/files/images/logos/default_profile.png');return db[_0x3df2('0x39')][_0x3df2('0x5b')]({'where':{'id':_0x57d998[_0x3df2('0x58')]['id']},'attributes':['id',_0x3df2('0xae')],'raw':!![]})[_0x3df2('0x1f')](handleEntityNotFound(_0x484173,null))['then'](function(_0x109f78){if(_0x109f78){if(_['isNil'](_0x109f78[_0x3df2('0xae')])){return _0x484173['download'](_0x1086a6);}else{if(!fs['existsSync'](path[_0x3df2('0xb3')](config[_0x3df2('0xb2')],_0x3df2('0xb4'),_0x109f78[_0x3df2('0xae')]))){return _0x484173[_0x3df2('0xb5')](_0x1086a6);}return _0x484173[_0x3df2('0xb5')](path[_0x3df2('0xb3')](config[_0x3df2('0xb2')],'server/files/images/',_0x109f78[_0x3df2('0xae')]));}}})['catch'](handleError(_0x484173,null));};exports[_0x3df2('0xb6')]=function(_0x596a74,_0xb8881d){return db['User']['find']({'where':{'id':_0x596a74['params']['id']},'attributes':['id']})[_0x3df2('0x1f')](handleEntityNotFound(_0xb8881d,null))[_0x3df2('0x1f')](function(_0x2943d8){var _0xbeb913=[];values=_0x2943d8['dataValues'];_0xbeb913['push'](get_open_tabs(_0x3df2('0x51'),_0x2943d8[_0x3df2('0x52')]));_0xbeb913['push'](get_open_tabs(_0x3df2('0x53'),_0x2943d8['dataValues']));_0xbeb913['push'](get_open_tabs(_0x3df2('0xb7'),_0x2943d8[_0x3df2('0x52')]));_0xbeb913[_0x3df2('0x4c')](get_open_tabs(_0x3df2('0x5c'),_0x2943d8[_0x3df2('0x52')]));_0xbeb913['push'](get_open_tabs(_0x3df2('0x54'),_0x2943d8[_0x3df2('0x52')]));_0xbeb913['push'](get_open_tabs(_0x3df2('0x5d'),_0x2943d8[_0x3df2('0x52')]));return Promise[_0x3df2('0x55')](_0xbeb913);})['then'](function(_0x56ded1){if(_0x56ded1){var _0x17c25b=_[_0x3df2('0x33')](values[_0x3df2('0xb8')],function(_0x522e35){return{'channel':_0x3df2('0xb9'),'id':_0x522e35['id'],'createdAt':_0x522e35[_0x3df2('0xba')]};});var _0x48ee84=_['map'](values[_0x3df2('0xbb')],function(_0x3a5708){return{'channel':_0x3df2('0xbc'),'id':_0x3a5708['id'],'createdAt':_0x3a5708['createdAt']};});var _0x3cd629=_[_0x3df2('0x33')](values['OpenchannelOpenTabs'],function(_0x59737c){return{'channel':_0x3df2('0xbd'),'id':_0x59737c['id'],'createdAt':_0x59737c[_0x3df2('0xba')]};});var _0x4dbbee=_['map'](values[_0x3df2('0xbe')],function(_0xc0e911){return{'channel':_0x3df2('0xbf'),'id':_0xc0e911['id'],'createdAt':_0xc0e911['createdAt']};});var _0x2f498d=_[_0x3df2('0x33')](values[_0x3df2('0xc0')],function(_0x17ea40){return{'channel':'SMS','id':_0x17ea40['id'],'createdAt':_0x17ea40['createdAt']};});var _0x204dff=_['map'](values[_0x3df2('0xc1')],function(_0x2506cf){return{'channel':_0x3df2('0xc2'),'id':_0x2506cf['id'],'createdAt':_0x2506cf[_0x3df2('0xba')]};});var _0x41cc19=_[_0x3df2('0xc3')](_0x17c25b,_0x48ee84,_0x3cd629,_0x4dbbee,_0x2f498d,_0x204dff);var _0x2dae37={'count':_0x41cc19[_0x3df2('0x50')],'rows':_0x41cc19};return _0x2dae37;}else return null;})[_0x3df2('0x1f')](respondWithResult(_0xb8881d,null))[_0x3df2('0x56')](handleError(_0xb8881d,null));};exports[_0x3df2('0xc4')]=function(_0x58f152,_0x1f20f9){var _0x118edb={};return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0x58f152[_0x3df2('0x58')]['id']}})['then'](function(_0x1f4094){if(!_0x1f4094){throw new APINotFoundError(util['format'](_0x3df2('0xc5'),_0x58f152[_0x3df2('0x58')]['id']));}return contacts[_0x3df2('0xc6')]();})[_0x3df2('0x1f')](function(_0x14aee5){_0x58f152[_0x3df2('0x46')]['User']=_0x58f152[_0x3df2('0x58')]['id'];_0x118edb=qs[_0x3df2('0x59')](_0x14aee5,_0x58f152);if(_0x58f152[_0x3df2('0x46')]['hasOwnProperty'](_0x3df2('0x47'))){_0x118edb['include']=[{'model':db[_0x3df2('0xc7')],'as':_0x3df2('0xc8'),'required':![]},{'model':db[_0x3df2('0xc9')],'as':_0x3df2('0xca'),'attributes':['id',_0x3df2('0x36'),'color'],'where':_0x58f152[_0x3df2('0x46')]['tag']?{'id':_0x58f152[_0x3df2('0x46')][_0x3df2('0xcb')]}:undefined,'required':_0x58f152[_0x3df2('0x46')][_0x3df2('0xcb')]?!![]:![]}];}return contacts[_0x3df2('0x4d')](_0x58f152[_0x3df2('0x46')],_0x58f152[_0x3df2('0x2e')],_0x118edb,_0x14aee5);})[_0x3df2('0x1f')](respondWithFilteredResult(_0x1f20f9,_0x118edb))[_0x3df2('0x56')](APIHandleError(_0x1f20f9));};exports[_0x3df2('0xcc')]=function(_0x38db5b,_0xd5e36){var _0x559bdf;var _0x3d3820={};var _0x2ec743;return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0x38db5b[_0x3df2('0x58')]['id']},'attributes':['id',_0x3df2('0x36'),_0x3df2('0x2d')]})[_0x3df2('0x1f')](handleEntityNotFound(_0xd5e36,null))[_0x3df2('0x1f')](function(_0x1d0895){if(!utils[_0x3df2('0x9c')](_0x38db5b[_0x3df2('0x46')][_0x3df2('0x99')])){throw new db[(_0x3df2('0x90'))]['ValidationError'](_0x3df2('0x9d'));}_0x559bdf=_0x1d0895;var _0x1a3c39={};_0x1a3c39[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_[_0x3df2('0xa1')](_0x38db5b[_0x3df2('0x46')][_0x3df2('0x99')])+_0x3df2('0xcf')][_0x3df2('0x3a')]);_0x1a3c39[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x38db5b[_0x3df2('0x46')]);_0x1a3c39['filters']=_[_0x3df2('0xd0')](_0x1a3c39[_0x3df2('0xcd')],_0x1a3c39[_0x3df2('0x46')]);_0x3d3820[_0x3df2('0x4b')]=_[_0x3df2('0xd0')](_0x1a3c39[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x38db5b[_0x3df2('0x46')][_0x3df2('0xd1')]));_0x3d3820['attributes']=_0x3d3820[_0x3df2('0x4b')][_0x3df2('0x50')]?_0x3d3820['attributes']:_0x1a3c39[_0x3df2('0xcd')];_0x3d3820[_0x3df2('0xd2')]=qs[_0x3df2('0xd3')](_0x38db5b[_0x3df2('0x46')]['sort']);_0x3d3820[_0x3df2('0x45')]=qs['filters'](_[_0x3df2('0xd4')](_0x38db5b[_0x3df2('0x46')],_0x1a3c39[_0x3df2('0xd5')]));if(_0x38db5b[_0x3df2('0x46')][_0x3df2('0x3d')]){_0x3d3820[_0x3df2('0x45')]=_['merge'](_0x3d3820[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x3d3820[_0x3df2('0x4b')],function(_0x2dc1cf){var _0x999e6={};_0x999e6[_0x2dc1cf]={'$like':'%'+_0x38db5b[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0x999e6;})});}_0x3d3820=_[_0x3df2('0xd6')]({},_0x3d3820,_0x38db5b[_0x3df2('0x5a')]);switch(_0x559bdf['role']){case _0x3df2('0x7c'):return db[_[_0x3df2('0xa1')](_0x38db5b[_0x3df2('0x46')][_0x3df2('0x99')])+_0x3df2('0xcf')][_0x3df2('0x4d')](_0x3d3820);case _0x3df2('0x2e'):case _0x3df2('0x29'):return _0x559bdf[_0x3df2('0x2c')+_[_0x3df2('0xa1')](_0x38db5b[_0x3df2('0x46')][_0x3df2('0x99')])+'Queues'](_0x3d3820);default:throw new db[(_0x3df2('0x90'))][(_0x3df2('0x8d'))](_0x3df2('0xd7'));}})[_0x3df2('0x1f')](function(_0x1be815){_0x2ec743=_0x1be815['length'];if(!_0x38db5b['query'][_0x3df2('0xd8')](_0x3df2('0xd9'))){_0x3d3820['limit']=qs[_0x3df2('0x1c')](_0x38db5b['query'][_0x3df2('0x1c')]);_0x3d3820['offset']=qs[_0x3df2('0x1a')](_0x38db5b[_0x3df2('0x46')][_0x3df2('0x1a')]);}switch(_0x559bdf['role']){case _0x3df2('0x7c'):return db[_[_0x3df2('0xa1')](_0x38db5b['query'][_0x3df2('0x99')])+_0x3df2('0xcf')]['findAll'](_0x3d3820);case _0x3df2('0x2e'):case _0x3df2('0x29'):return _0x559bdf[_0x3df2('0x2c')+_[_0x3df2('0xa1')](_0x38db5b['query'][_0x3df2('0x99')])+_0x3df2('0x9f')](_0x3d3820);}})[_0x3df2('0x1f')](function(_0x3e863c){return{'count':_0x2ec743,'rows':_0x3e863c};})[_0x3df2('0x1f')](respondWithResult(_0xd5e36,null))[_0x3df2('0x56')](handleError(_0xd5e36,null));};exports[_0x3df2('0xda')]=function(_0x2cd29b,_0x4dbd71){var _0x16dd70={};var _0xfa6b8b={};var _0x589bf4;var _0x3f4a68;return db['User'][_0x3df2('0x93')]({'where':{'id':_0x2cd29b['params']['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x4dbd71,null))[_0x3df2('0x1f')](function(_0x187767){if(_0x187767){_0x589bf4=_0x187767;_0xfa6b8b[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_0x3df2('0xa8')]['rawAttributes']);_0xfa6b8b['query']=_[_0x3df2('0xce')](_0x2cd29b[_0x3df2('0x46')]);_0xfa6b8b[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0xfa6b8b[_0x3df2('0xcd')],_0xfa6b8b[_0x3df2('0x46')]);_0x16dd70[_0x3df2('0x4b')]=_[_0x3df2('0xd0')](_0xfa6b8b[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x2cd29b[_0x3df2('0x46')]['fields']));_0x16dd70[_0x3df2('0x4b')]=_0x16dd70[_0x3df2('0x4b')]['length']?_0x16dd70[_0x3df2('0x4b')]:_0xfa6b8b[_0x3df2('0xcd')];_0x16dd70['order']=qs[_0x3df2('0xd3')](_0x2cd29b[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x16dd70[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_[_0x3df2('0xd4')](_0x2cd29b['query'],_0xfa6b8b[_0x3df2('0xd5')]));if(_0x2cd29b['query'][_0x3df2('0x3d')]){_0x16dd70[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x16dd70['where'],{'$or':_[_0x3df2('0x33')](_0x16dd70['attributes'],function(_0x32813d){var _0x2846df={};_0x2846df[_0x32813d]={'$like':'%'+_0x2cd29b[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0x2846df;})});}_0x16dd70=_[_0x3df2('0xd6')]({},_0x16dd70,_0x2cd29b[_0x3df2('0x5a')]);return _0x589bf4['getVoiceQueuesRt'](_0x16dd70);}})['then'](function(_0x1570e3){if(_0x1570e3){_0x3f4a68=_0x1570e3[_0x3df2('0x50')];if(!_0x2cd29b[_0x3df2('0x46')]['hasOwnProperty'](_0x3df2('0xd9'))){_0x16dd70[_0x3df2('0x1c')]=qs['limit'](_0x2cd29b['query']['limit']);_0x16dd70[_0x3df2('0x1a')]=qs['offset'](_0x2cd29b['query']['offset']);}return _0x589bf4[_0x3df2('0xda')](_0x16dd70);}})[_0x3df2('0x1f')](function(_0x1c2169){if(_0x1c2169){return _0x1c2169?{'count':_0x3f4a68,'rows':_0x1c2169}:null;}})[_0x3df2('0x1f')](respondWithResult(_0x4dbd71,null))['catch'](handleError(_0x4dbd71,null));};exports[_0x3df2('0xdb')]=function(_0x49b726,_0x530f66){var _0x3e8630={};var _0x148ac0={};var _0x59b877;var _0x1eb355;return db['User'][_0x3df2('0x93')]({'where':{'id':_0x49b726['params']['id']}})['then'](handleEntityNotFound(_0x530f66,null))['then'](function(_0x13c706){if(_0x13c706){_0x59b877=_0x13c706;_0x148ac0[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_0x3df2('0xdc')][_0x3df2('0x3a')]);_0x148ac0[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x49b726[_0x3df2('0x46')]);_0x148ac0[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x148ac0['model'],_0x148ac0[_0x3df2('0x46')]);_0x3e8630[_0x3df2('0x4b')]=_[_0x3df2('0xd0')](_0x148ac0['model'],qs[_0x3df2('0xd1')](_0x49b726[_0x3df2('0x46')]['fields']));_0x3e8630['attributes']=_0x3e8630[_0x3df2('0x4b')]['length']?_0x3e8630[_0x3df2('0x4b')]:_0x148ac0[_0x3df2('0xcd')];_0x3e8630[_0x3df2('0xd2')]=qs[_0x3df2('0xd3')](_0x49b726[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x3e8630[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_['pick'](_0x49b726[_0x3df2('0x46')],_0x148ac0['filters']));if(_0x49b726[_0x3df2('0x46')]['filter']){_0x3e8630[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x3e8630['where'],{'$or':_[_0x3df2('0x33')](_0x3e8630[_0x3df2('0x4b')],function(_0x278054){var _0xebb941={};_0xebb941[_0x278054]={'$like':'%'+_0x49b726['query'][_0x3df2('0x3d')]+'%'};return _0xebb941;})});}_0x3e8630=_[_0x3df2('0xd6')]({},_0x3e8630,_0x49b726[_0x3df2('0x5a')]);return _0x59b877[_0x3df2('0xdb')](_0x3e8630);}})[_0x3df2('0x1f')](function(_0x13d845){if(_0x13d845){_0x1eb355=_0x13d845[_0x3df2('0x50')];if(!_0x49b726[_0x3df2('0x46')]['hasOwnProperty'](_0x3df2('0xd9'))){_0x3e8630[_0x3df2('0x1c')]=qs[_0x3df2('0x1c')](_0x49b726[_0x3df2('0x46')]['limit']);_0x3e8630[_0x3df2('0x1a')]=qs[_0x3df2('0x1a')](_0x49b726[_0x3df2('0x46')]['offset']);}return _0x59b877[_0x3df2('0xdb')](_0x3e8630);}})[_0x3df2('0x1f')](function(_0xe827fd){if(_0xe827fd){return _0xe827fd?{'count':_0x1eb355,'rows':_0xe827fd}:null;}})[_0x3df2('0x1f')](respondWithResult(_0x530f66,null))[_0x3df2('0x56')](handleError(_0x530f66,null));};exports[_0x3df2('0xdd')]=function(_0x2e185c,_0xddb90b){var _0x17e7cf={'raw':!![],'where':{}};var _0x506855={};var _0xeabae={'count':0x0,'rows':[]};return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0x2e185c[_0x3df2('0x58')]['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0xddb90b,null))['then'](function(_0x525c43){if(_0x525c43){_0x506855[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db['VoiceRecording'][_0x3df2('0x3a')]);_0x506855[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x2e185c['query']);_0x506855[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x506855[_0x3df2('0xcd')],_0x506855[_0x3df2('0x46')]);_0x17e7cf[_0x3df2('0x4b')]=_['intersection'](_0x506855[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x2e185c[_0x3df2('0x46')][_0x3df2('0xd1')]));_0x17e7cf[_0x3df2('0x4b')]=_0x17e7cf[_0x3df2('0x4b')][_0x3df2('0x50')]?_0x17e7cf['attributes']:_0x506855[_0x3df2('0xcd')];if(!_0x2e185c[_0x3df2('0x46')]['hasOwnProperty'](_0x3df2('0xd9'))){_0x17e7cf[_0x3df2('0x1c')]=qs[_0x3df2('0x1c')](_0x2e185c[_0x3df2('0x46')][_0x3df2('0x1c')]);_0x17e7cf['offset']=qs[_0x3df2('0x1a')](_0x2e185c['query'][_0x3df2('0x1a')]);}_0x17e7cf[_0x3df2('0xd2')]=qs['sort'](_0x2e185c[_0x3df2('0x46')]['sort']);_0x17e7cf['where']=qs['filters'](_[_0x3df2('0xd4')](_0x2e185c['query'],_0x506855[_0x3df2('0xd5')]));_0x17e7cf[_0x3df2('0x45')][_0x3df2('0xde')]=_0x525c43['id'];if(_0x2e185c[_0x3df2('0x46')][_0x3df2('0x3d')]){_0x17e7cf[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x17e7cf[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x17e7cf[_0x3df2('0x4b')],function(_0x5abd5e){var _0xd731d1={};_0xd731d1[_0x5abd5e]={'$like':'%'+_0x2e185c[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0xd731d1;})});}_0x17e7cf=_[_0x3df2('0xd6')]({},_0x17e7cf,_0x2e185c['options']);return db['VoiceRecording'][_0x3df2('0x1d')]({'where':_0x17e7cf[_0x3df2('0x45')]})[_0x3df2('0x1f')](function(_0x4cf712){_0xeabae[_0x3df2('0x1d')]=_0x4cf712;if(_0x2e185c['query'][_0x3df2('0x47')]){_0x17e7cf[_0x3df2('0x48')]=[{'all':!![]}];}return db[_0x3df2('0xdf')][_0x3df2('0x4d')](_0x17e7cf);})['then'](function(_0x3ba114){_0xeabae['rows']=_0x3ba114;return _0xeabae;});}})[_0x3df2('0x1f')](respondWithFilteredResult(_0xddb90b,_0x17e7cf))['catch'](handleError(_0xddb90b,null));};exports['getScreenRecordings']=function(_0x39a446,_0x3da848){var _0x3d1556={'raw':!![],'where':{}};var _0x14c282={};var _0x387ee0={'count':0x0,'rows':[]};return db['User'][_0x3df2('0x93')]({'where':{'id':_0x39a446['params']['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x3da848,null))['then'](function(_0x555e1d){if(_0x555e1d){_0x14c282[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db['ScreenRecording'][_0x3df2('0x3a')]);_0x14c282[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x39a446[_0x3df2('0x46')]);_0x14c282[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x14c282[_0x3df2('0xcd')],_0x14c282[_0x3df2('0x46')]);_0x3d1556['attributes']=_[_0x3df2('0xd0')](_0x14c282[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x39a446[_0x3df2('0x46')]['fields']));_0x3d1556[_0x3df2('0x4b')]=_0x3d1556['attributes'][_0x3df2('0x50')]?_0x3d1556[_0x3df2('0x4b')]:_0x14c282[_0x3df2('0xcd')];if(!_0x39a446[_0x3df2('0x46')][_0x3df2('0xd8')](_0x3df2('0xd9'))){_0x3d1556['limit']=qs[_0x3df2('0x1c')](_0x39a446['query'][_0x3df2('0x1c')]);_0x3d1556[_0x3df2('0x1a')]=qs[_0x3df2('0x1a')](_0x39a446[_0x3df2('0x46')]['offset']);}_0x3d1556[_0x3df2('0xd2')]=qs['sort'](_0x39a446[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x3d1556[_0x3df2('0x45')]=qs['filters'](_[_0x3df2('0xd4')](_0x39a446[_0x3df2('0x46')],_0x14c282[_0x3df2('0xd5')]));_0x3d1556[_0x3df2('0x45')][_0x3df2('0xde')]=_0x555e1d['id'];if(_0x39a446[_0x3df2('0x46')][_0x3df2('0x3d')]){_0x3d1556[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x3d1556[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x3d1556[_0x3df2('0x4b')],function(_0x36156c){var _0x56ed20={};_0x56ed20[_0x36156c]={'$like':'%'+_0x39a446[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0x56ed20;})});}_0x3d1556=_[_0x3df2('0xd6')]({},_0x3d1556,_0x39a446['options']);return db[_0x3df2('0xe0')][_0x3df2('0x1d')]({'where':_0x3d1556[_0x3df2('0x45')]})['then'](function(_0x4ebfae){_0x387ee0[_0x3df2('0x1d')]=_0x4ebfae;if(_0x39a446['query'][_0x3df2('0x47')]){_0x3d1556['include']=[{'all':!![]}];}return db[_0x3df2('0xe0')][_0x3df2('0x4d')](_0x3d1556);})[_0x3df2('0x1f')](function(_0x186dfd){_0x387ee0[_0x3df2('0x4e')]=_0x186dfd;return _0x387ee0;});}})[_0x3df2('0x1f')](respondWithFilteredResult(_0x3da848,_0x3d1556))[_0x3df2('0x56')](handleError(_0x3da848,null));};exports[_0x3df2('0xe1')]=function(_0x3862dd,_0x2cdc9e){var _0x4a7dd1={};var _0x3045af={};var _0x278166;var _0x188407;return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0x3862dd[_0x3df2('0x58')]['id']}})['then'](handleEntityNotFound(_0x2cdc9e,null))[_0x3df2('0x1f')](function(_0x1ec4e3){if(_0x1ec4e3){_0x278166=_0x1ec4e3;_0x3045af[_0x3df2('0xcd')]=_['keys'](db[_0x3df2('0xe2')][_0x3df2('0x3a')]);_0x3045af[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x3862dd[_0x3df2('0x46')]);_0x3045af[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x3045af['model'],_0x3045af[_0x3df2('0x46')]);_0x4a7dd1[_0x3df2('0x4b')]=_['intersection'](_0x3045af[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x3862dd[_0x3df2('0x46')][_0x3df2('0xd1')]));_0x4a7dd1[_0x3df2('0x4b')]=_0x4a7dd1[_0x3df2('0x4b')][_0x3df2('0x50')]?_0x4a7dd1['attributes']:_0x3045af[_0x3df2('0xcd')];_0x4a7dd1[_0x3df2('0xd2')]=qs[_0x3df2('0xd3')](_0x3862dd[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x4a7dd1[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_[_0x3df2('0xd4')](_0x3862dd[_0x3df2('0x46')],_0x3045af[_0x3df2('0xd5')]));if(_0x3862dd[_0x3df2('0x46')]['filter']){_0x4a7dd1[_0x3df2('0x45')]=_['merge'](_0x4a7dd1[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x4a7dd1[_0x3df2('0x4b')],function(_0x4e3cc8){var _0x3aecce={};_0x3aecce[_0x4e3cc8]={'$like':'%'+_0x3862dd[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0x3aecce;})});}_0x4a7dd1=_[_0x3df2('0xd6')]({},_0x4a7dd1,_0x3862dd['options']);return _0x278166['getChatInteractions'](_0x4a7dd1);}})[_0x3df2('0x1f')](function(_0x486a67){if(_0x486a67){_0x188407=_0x486a67['length'];if(!_0x3862dd[_0x3df2('0x46')][_0x3df2('0xd8')](_0x3df2('0xd9'))){_0x4a7dd1['limit']=qs[_0x3df2('0x1c')](_0x3862dd['query'][_0x3df2('0x1c')]);_0x4a7dd1[_0x3df2('0x1a')]=qs[_0x3df2('0x1a')](_0x3862dd[_0x3df2('0x46')][_0x3df2('0x1a')]);}return _0x278166['getChatInteractions'](_0x4a7dd1);}})[_0x3df2('0x1f')](function(_0x211344){if(_0x211344){return _0x211344?{'count':_0x188407,'rows':_0x211344}:null;}})[_0x3df2('0x1f')](respondWithResult(_0x2cdc9e,null))[_0x3df2('0x56')](handleError(_0x2cdc9e,null));};exports[_0x3df2('0xe3')]=function(_0x448edf,_0x2b7a3f){var _0x16cd5f={};var _0x512270={};var _0x5d3559;var _0x5a85f2;return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0x448edf['params']['id']}})['then'](handleEntityNotFound(_0x2b7a3f,null))['then'](function(_0x2e8bd3){if(_0x2e8bd3){_0x5d3559=_0x2e8bd3;_0x512270[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_0x3df2('0xe4')]['rawAttributes']);_0x512270[_0x3df2('0x46')]=_['keys'](_0x448edf[_0x3df2('0x46')]);_0x512270[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x512270['model'],_0x512270[_0x3df2('0x46')]);_0x16cd5f['attributes']=_['intersection'](_0x512270[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x448edf['query'][_0x3df2('0xd1')]));_0x16cd5f[_0x3df2('0x4b')]=_0x16cd5f[_0x3df2('0x4b')][_0x3df2('0x50')]?_0x16cd5f['attributes']:_0x512270[_0x3df2('0xcd')];_0x16cd5f[_0x3df2('0xd2')]=qs['sort'](_0x448edf[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x16cd5f['where']=qs[_0x3df2('0xd5')](_[_0x3df2('0xd4')](_0x448edf['query'],_0x512270['filters']));if(_0x448edf[_0x3df2('0x46')][_0x3df2('0x3d')]){_0x16cd5f['where']=_[_0x3df2('0xd6')](_0x16cd5f[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x16cd5f[_0x3df2('0x4b')],function(_0x6f8727){var _0xde5e32={};_0xde5e32[_0x6f8727]={'$like':'%'+_0x448edf[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0xde5e32;})});}_0x16cd5f=_[_0x3df2('0xd6')]({},_0x16cd5f,_0x448edf[_0x3df2('0x5a')]);return _0x5d3559[_0x3df2('0xe3')](_0x16cd5f);}})['then'](function(_0x44c0bd){if(_0x44c0bd){_0x5a85f2=_0x44c0bd[_0x3df2('0x50')];if(!_0x448edf[_0x3df2('0x46')]['hasOwnProperty']('nolimit')){_0x16cd5f[_0x3df2('0x1c')]=qs[_0x3df2('0x1c')](_0x448edf[_0x3df2('0x46')][_0x3df2('0x1c')]);_0x16cd5f['offset']=qs['offset'](_0x448edf[_0x3df2('0x46')]['offset']);}return _0x5d3559['getOpenchannelInteractions'](_0x16cd5f);}})[_0x3df2('0x1f')](function(_0x49c728){if(_0x49c728){return _0x49c728?{'count':_0x5a85f2,'rows':_0x49c728}:null;}})['then'](respondWithResult(_0x2b7a3f,null))['catch'](handleError(_0x2b7a3f,null));};exports[_0x3df2('0xe5')]=function(_0x27360f,_0x4f5da4){var _0x311ecd={'raw':!![],'where':{}};var _0x50c776={};var _0x1aaf19={'count':0x0,'rows':[]};return db['User'][_0x3df2('0x93')]({'where':{'id':_0x27360f[_0x3df2('0x58')]['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x4f5da4,null))[_0x3df2('0x1f')](function(_0x5b2104){if(_0x5b2104){_0x50c776[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_0x3df2('0xe6')][_0x3df2('0x3a')]);_0x50c776[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x27360f['query']);_0x50c776[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x50c776[_0x3df2('0xcd')],_0x50c776[_0x3df2('0x46')]);_0x311ecd[_0x3df2('0x4b')]=_[_0x3df2('0xd0')](_0x50c776[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x27360f[_0x3df2('0x46')][_0x3df2('0xd1')]));_0x311ecd[_0x3df2('0x4b')]=_0x311ecd[_0x3df2('0x4b')][_0x3df2('0x50')]?_0x311ecd[_0x3df2('0x4b')]:_0x50c776[_0x3df2('0xcd')];if(!_0x27360f[_0x3df2('0x46')]['hasOwnProperty'](_0x3df2('0xd9'))){_0x311ecd[_0x3df2('0x1c')]=qs[_0x3df2('0x1c')](_0x27360f['query'][_0x3df2('0x1c')]);_0x311ecd[_0x3df2('0x1a')]=qs[_0x3df2('0x1a')](_0x27360f[_0x3df2('0x46')][_0x3df2('0x1a')]);}_0x311ecd['order']=qs[_0x3df2('0xd3')](_0x27360f[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x311ecd[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_['pick'](_0x27360f['query'],_0x50c776[_0x3df2('0xd5')]));_0x311ecd['where'][_0x3df2('0xde')]=_0x5b2104['id'];if(_0x27360f[_0x3df2('0x46')]['filter']){_0x311ecd[_0x3df2('0x45')]=_['merge'](_0x311ecd[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x311ecd[_0x3df2('0x4b')],function(_0x328222){var _0x5e3cfc={};_0x5e3cfc[_0x328222]={'$like':'%'+_0x27360f[_0x3df2('0x46')]['filter']+'%'};return _0x5e3cfc;})});}_0x311ecd=_[_0x3df2('0xd6')]({},_0x311ecd,_0x27360f[_0x3df2('0x5a')]);return db[_0x3df2('0xe6')][_0x3df2('0x1d')]({'where':_0x311ecd[_0x3df2('0x45')]})['then'](function(_0x1d480f){_0x1aaf19[_0x3df2('0x1d')]=_0x1d480f;if(_0x27360f['query'][_0x3df2('0x47')]){_0x311ecd[_0x3df2('0x48')]=[{'all':!![]}];}return db[_0x3df2('0xe6')]['findAll'](_0x311ecd);})[_0x3df2('0x1f')](function(_0x51aa64){_0x1aaf19[_0x3df2('0x4e')]=_0x51aa64;return _0x1aaf19;});}})[_0x3df2('0x1f')](respondWithFilteredResult(_0x4f5da4,_0x311ecd))['catch'](handleError(_0x4f5da4,null));};exports[_0x3df2('0xe7')]=function(_0x47f5de,_0x369eec){var _0xc32c88={};var _0x507722={};var _0x188b1a;var _0x38a0e3;return db[_0x3df2('0x39')]['findOne']({'where':{'id':_0x47f5de[_0x3df2('0x58')]['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x369eec,null))[_0x3df2('0x1f')](function(_0x5c1e6b){if(_0x5c1e6b){_0x188b1a=_0x5c1e6b;_0x507722[_0x3df2('0xcd')]=_['keys'](db[_0x3df2('0xe8')][_0x3df2('0x3a')]);_0x507722[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x47f5de[_0x3df2('0x46')]);_0x507722[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x507722[_0x3df2('0xcd')],_0x507722[_0x3df2('0x46')]);_0xc32c88[_0x3df2('0x4b')]=_[_0x3df2('0xd0')](_0x507722[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x47f5de['query'][_0x3df2('0xd1')]));_0xc32c88[_0x3df2('0x4b')]=_0xc32c88['attributes'][_0x3df2('0x50')]?_0xc32c88[_0x3df2('0x4b')]:_0x507722[_0x3df2('0xcd')];_0xc32c88[_0x3df2('0xd2')]=qs[_0x3df2('0xd3')](_0x47f5de[_0x3df2('0x46')][_0x3df2('0xd3')]);_0xc32c88[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_[_0x3df2('0xd4')](_0x47f5de[_0x3df2('0x46')],_0x507722['filters']));if(_0x47f5de['query'][_0x3df2('0x3d')]){_0xc32c88['where']=_[_0x3df2('0xd6')](_0xc32c88[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0xc32c88[_0x3df2('0x4b')],function(_0x378012){var _0x18d35a={};_0x18d35a[_0x378012]={'$like':'%'+_0x47f5de['query'][_0x3df2('0x3d')]+'%'};return _0x18d35a;})});}_0xc32c88=_[_0x3df2('0xd6')]({},_0xc32c88,_0x47f5de[_0x3df2('0x5a')]);return _0x188b1a['getSmsInteractions'](_0xc32c88);}})['then'](function(_0x1721a4){if(_0x1721a4){_0x38a0e3=_0x1721a4[_0x3df2('0x50')];if(!_0x47f5de[_0x3df2('0x46')][_0x3df2('0xd8')](_0x3df2('0xd9'))){_0xc32c88['limit']=qs[_0x3df2('0x1c')](_0x47f5de[_0x3df2('0x46')][_0x3df2('0x1c')]);_0xc32c88[_0x3df2('0x1a')]=qs[_0x3df2('0x1a')](_0x47f5de['query']['offset']);}return _0x188b1a[_0x3df2('0xe7')](_0xc32c88);}})[_0x3df2('0x1f')](function(_0x1b0aed){if(_0x1b0aed){return _0x1b0aed?{'count':_0x38a0e3,'rows':_0x1b0aed}:null;}})[_0x3df2('0x1f')](respondWithResult(_0x369eec,null))[_0x3df2('0x56')](handleError(_0x369eec,null));};exports[_0x3df2('0xe9')]=function(_0xfeb611,_0x456313){var _0x160c7a={};var _0x1bc2ec={};var _0x5e0bb1;var _0x31cb2e;return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0xfeb611['params']['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x456313,null))[_0x3df2('0x1f')](function(_0x3eee83){if(_0x3eee83){_0x5e0bb1=_0x3eee83;_0x1bc2ec[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db['FaxInteraction']['rawAttributes']);_0x1bc2ec[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0xfeb611['query']);_0x1bc2ec['filters']=_[_0x3df2('0xd0')](_0x1bc2ec[_0x3df2('0xcd')],_0x1bc2ec[_0x3df2('0x46')]);_0x160c7a[_0x3df2('0x4b')]=_['intersection'](_0x1bc2ec[_0x3df2('0xcd')],qs['fields'](_0xfeb611[_0x3df2('0x46')]['fields']));_0x160c7a['attributes']=_0x160c7a[_0x3df2('0x4b')]['length']?_0x160c7a[_0x3df2('0x4b')]:_0x1bc2ec[_0x3df2('0xcd')];_0x160c7a['order']=qs[_0x3df2('0xd3')](_0xfeb611[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x160c7a[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_['pick'](_0xfeb611[_0x3df2('0x46')],_0x1bc2ec[_0x3df2('0xd5')]));if(_0xfeb611[_0x3df2('0x46')][_0x3df2('0x3d')]){_0x160c7a[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x160c7a[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x160c7a[_0x3df2('0x4b')],function(_0x3f9b1b){var _0x265502={};_0x265502[_0x3f9b1b]={'$like':'%'+_0xfeb611[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0x265502;})});}_0x160c7a=_[_0x3df2('0xd6')]({},_0x160c7a,_0xfeb611[_0x3df2('0x5a')]);return _0x5e0bb1['getFaxInteractions'](_0x160c7a);}})[_0x3df2('0x1f')](function(_0x499789){if(_0x499789){_0x31cb2e=_0x499789[_0x3df2('0x50')];if(!_0xfeb611[_0x3df2('0x46')][_0x3df2('0xd8')](_0x3df2('0xd9'))){_0x160c7a[_0x3df2('0x1c')]=qs[_0x3df2('0x1c')](_0xfeb611[_0x3df2('0x46')]['limit']);_0x160c7a['offset']=qs[_0x3df2('0x1a')](_0xfeb611[_0x3df2('0x46')][_0x3df2('0x1a')]);}return _0x5e0bb1['getFaxInteractions'](_0x160c7a);}})['then'](function(_0xeb2473){if(_0xeb2473){return _0xeb2473?{'count':_0x31cb2e,'rows':_0xeb2473}:null;}})['then'](respondWithResult(_0x456313,null))[_0x3df2('0x56')](handleError(_0x456313,null));};exports[_0x3df2('0xea')]=function(_0x352107,_0x3b7924){var _0x40665e={};var _0x1ef8d1={};var _0x21a7ba;var _0x1e5564;return db['User']['findOne']({'where':{'id':_0x352107['params']['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x3b7924,null))[_0x3df2('0x1f')](function(_0x237bd8){if(_0x237bd8){_0x21a7ba=_0x237bd8;_0x1ef8d1[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_0x3df2('0xeb')][_0x3df2('0x3a')]);_0x1ef8d1[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x352107[_0x3df2('0x46')]);_0x1ef8d1[_0x3df2('0xd5')]=_[_0x3df2('0xd0')](_0x1ef8d1[_0x3df2('0xcd')],_0x1ef8d1[_0x3df2('0x46')]);_0x40665e[_0x3df2('0x4b')]=_[_0x3df2('0xd0')](_0x1ef8d1[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x352107['query']['fields']));_0x40665e[_0x3df2('0x4b')]=_0x40665e[_0x3df2('0x4b')][_0x3df2('0x50')]?_0x40665e[_0x3df2('0x4b')]:_0x1ef8d1[_0x3df2('0xcd')];_0x40665e['order']=qs['sort'](_0x352107[_0x3df2('0x46')]['sort']);_0x40665e[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_[_0x3df2('0xd4')](_0x352107['query'],_0x1ef8d1['filters']));if(_0x352107[_0x3df2('0x46')][_0x3df2('0x3d')]){_0x40665e[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x40665e[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x40665e[_0x3df2('0x4b')],function(_0x5d5ad2){var _0x40c224={};_0x40c224[_0x5d5ad2]={'$like':'%'+_0x352107[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0x40c224;})});}_0x40665e=_['merge']({},_0x40665e,_0x352107[_0x3df2('0x5a')]);return _0x21a7ba['getWhatsappInteractions'](_0x40665e);}})[_0x3df2('0x1f')](function(_0x2342ae){if(_0x2342ae){_0x1e5564=_0x2342ae[_0x3df2('0x50')];if(!_0x352107[_0x3df2('0x46')][_0x3df2('0xd8')](_0x3df2('0xd9'))){_0x40665e['limit']=qs['limit'](_0x352107['query'][_0x3df2('0x1c')]);_0x40665e[_0x3df2('0x1a')]=qs[_0x3df2('0x1a')](_0x352107['query'][_0x3df2('0x1a')]);}return _0x21a7ba[_0x3df2('0xea')](_0x40665e);}})[_0x3df2('0x1f')](function(_0x37d20b){if(_0x37d20b){return _0x37d20b?{'count':_0x1e5564,'rows':_0x37d20b}:null;}})[_0x3df2('0x1f')](respondWithResult(_0x3b7924,null))[_0x3df2('0x56')](handleError(_0x3b7924,null));};exports[_0x3df2('0xec')]=function(_0x10b4c4,_0x4d37ad,_0x2e5552){var _0x46702a;var _0x38d0e0;var _0xf43077;var _0x5be3d8=!_[_0x3df2('0x66')](_0x10b4c4['params']['id'])?_0x10b4c4[_0x3df2('0x58')]['id']:!_[_0x3df2('0x66')](_0x10b4c4[_0x3df2('0x2e')]['id'])?_0x10b4c4[_0x3df2('0x2e')]['id']:null;return db[_0x3df2('0x39')][_0x3df2('0x5b')]({'where':{'id':_0x5be3d8,'role':{'$or':[_0x3df2('0x7c'),'user',_0x3df2('0x29')]}},'attributes':['id',_0x3df2('0x36'),_0x3df2('0xed'),_0x3df2('0xee'),_0x3df2('0x2d'),_0x3df2('0x62'),_0x3df2('0x9a')]})[_0x3df2('0x1f')](function(_0x44fffd){if(_0x44fffd){if(_0x44fffd['role']===_0x3df2('0x29')){_0x46702a=_0x44fffd;if(_0x10b4c4[_0x3df2('0x5e')][_0x3df2('0xa7')]){_0xf43077=util[_0x3df2('0xef')](_0x3df2('0xf0'),_0x46702a[_0x10b4c4[_0x3df2('0x5e')][_0x3df2('0xa7')]]);}else if(_0x10b4c4[_0x3df2('0x5e')][_0x3df2('0xf1')]){_0xf43077=util[_0x3df2('0xef')](_0x3df2('0xa6'),_0x10b4c4['body'][_0x3df2('0xf1')]);}else{_0xf43077=util[_0x3df2('0xef')](_0x3df2('0xa6'),_0x46702a['name']);}socket['to'](util[_0x3df2('0xef')](_0x3df2('0xf2'),_0x46702a[_0x3df2('0x36')]))['emit'](_0x3df2('0xf3'),{'user':{'id':_0x46702a['id'],'name':_0x46702a[_0x3df2('0x36')]},'ip':_0x10b4c4[_0x3df2('0xf4')][_0x3df2('0xf5')]||_0x10b4c4['connection'][_0x3df2('0xf6')]||_0x10b4c4[_0x3df2('0xf7')][_0x3df2('0xf6')]||_0x10b4c4[_0x3df2('0xf8')][_0x3df2('0xf7')][_0x3df2('0xf6')]});return new Promise(function(_0x2b5782,_0x3437b8){db['sequelize'][_0x3df2('0xf9')]()['then'](_0x319db4=>{db[_0x3df2('0xa8')][_0x3df2('0x2b')]({'where':{'membername':_0x46702a[_0x3df2('0x36')]},'individualHooks':!![]},{'transaction':_0x319db4})[_0x3df2('0x1f')](function(){return _0x319db4['commit']();})[_0x3df2('0x1f')](_0x2b5782)[_0x3df2('0x56')](_0x3437b8);});});}}else{throw new db[(_0x3df2('0x90'))]['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x46702a){return _0x46702a[_0x3df2('0xfa')]({'raw':!![]});}})[_0x3df2('0x1f')](function(_0x3706c7){if(_0x46702a){if(_0x3706c7){_0x38d0e0=_0x3706c7;if(_0x38d0e0[_0x3df2('0x50')]){var _0x597820=_0x38d0e0[_0x3df2('0x33')](function(_0x55d61f){return{'membername':_0x46702a[_0x3df2('0x36')],'UserId':_0x46702a['id'],'queue_name':_0x55d61f[_0x3df2('0x36')],'VoiceQueueId':_0x55d61f['id'],'interface':_0xf43077,'paused':_0x46702a[_0x3df2('0x9a')]||![],'penalty':_0x55d61f[_0x3df2('0xfb')]||0x0};});return db['UserVoiceQueueRt'][_0x3df2('0x85')](_0x597820);}}}})[_0x3df2('0x1f')](function(){if(_0x46702a){return db['MemberReport'][_0x3df2('0x4d')]({'where':{'membername':_0x46702a[_0x3df2('0x36')],'exitAt':null}});}})['then'](function(_0x2ce24b){if(_0x46702a){var _0x261fa4=[];_0x2ce24b[_0x3df2('0xfc')](function(_0x4f4bc8){_0x261fa4[_0x3df2('0x4c')](_0x4f4bc8[_0x3df2('0x28')]({'exitAt':moment()[_0x3df2('0xef')](_0x3df2('0xfd'))}));});return Promise[_0x3df2('0x55')](_0x261fa4);}})[_0x3df2('0x1f')](function(){if(_0x46702a){var _0x2ac95f=[];var _0x4a84f4=[];var _0x2f34f4=utils[_0x3df2('0xfe')]();var _0x5cd011={'membername':_0x46702a[_0x3df2('0x36')],'interface':_0xf43077,'enterAt':moment()[_0x3df2('0xef')](_0x3df2('0xfd')),'role':_0x46702a[_0x3df2('0x2d')],'internal':_0x46702a[_0x3df2('0x62')]};_0x2f34f4[_0x3df2('0xfc')](function(_0x327855){_0x2ac95f[_0x3df2('0x4c')](_[_0x3df2('0xd6')]({'channel':_0x327855,'type':'LOGIN','data1':_0x10b4c4['body'][_0x3df2('0xff')],'data2':_0xf43077},_0x5cd011));if(_0x46702a[_0x3df2('0x9a')]){_0x4a84f4[_0x3df2('0x4c')](_[_0x3df2('0xd6')]({'channel':_0x327855,'type':_0x3df2('0x100'),'data1':_0x3df2('0x101')},_0x5cd011));}});return db[_0x3df2('0x102')][_0x3df2('0x85')](_0x2ac95f[_0x3df2('0xc3')](_0x4a84f4),{'individualHooks':!![]});}})[_0x3df2('0x1f')](function(){if(_0x46702a){return _0x46702a[_0x3df2('0x28')]({'online':!![],'lastLoginAt':moment()[_0x3df2('0xef')](_0x3df2('0xfd')),'voicePause':_0x46702a['loginInPause']||![],'mailPause':_0x46702a['loginInPause']||![],'chatPause':_0x46702a[_0x3df2('0x9a')]||![],'faxPause':_0x46702a['loginInPause']||![],'smsPause':_0x46702a['loginInPause']||![],'openchannelPause':_0x46702a[_0x3df2('0x9a')]||![],'whatsappPause':_0x46702a[_0x3df2('0x9a')]||![],'pauseType':_0x46702a[_0x3df2('0x9a')]?_0x3df2('0x101'):null,'interface':_0xf43077,'lastPauseAt':moment()[_0x3df2('0xef')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x3df2('0x1f')](function(_0x1fa7e1){if(_0x10b4c4['isMiddleware']){return _0x2e5552();}else{return Promise['resolve'](_0x1fa7e1)[_0x3df2('0x1f')](respondWithResult(_0x4d37ad,null));}})[_0x3df2('0x56')](handleError(_0x4d37ad,null));};exports[_0x3df2('0x103')]=function(_0x33d85c,_0x1bc2aa){var _0x1280d4;return db['User'][_0x3df2('0x5b')]({'where':{'id':_0x33d85c[_0x3df2('0x58')]['id'],'role':_0x3df2('0x29')},'attributes':['id',_0x3df2('0x36'),_0x3df2('0x2d')]})[_0x3df2('0x1f')](handleEntityNotFound(_0x1bc2aa,null))[_0x3df2('0x1f')](function(_0x3785dd){if(_0x3785dd){_0x1280d4=_0x3785dd;return db['UserVoiceQueueRt'][_0x3df2('0x2b')]({'where':{'membername':_0x1280d4[_0x3df2('0x36')]},'individualHooks':!![]});}})['then'](function(){return db[_0x3df2('0x102')][_0x3df2('0x4d')]({'where':{'membername':_0x1280d4[_0x3df2('0x36')],'exitAt':null}});})['then'](function(_0x32fe34){var _0x2977ff=[];_0x32fe34['forEach'](function(_0x51c130){_0x2977ff[_0x3df2('0x4c')](_0x51c130[_0x3df2('0x28')]({'exitAt':moment()[_0x3df2('0xef')](_0x3df2('0xfd'))}));});return Promise[_0x3df2('0x55')](_0x2977ff);})[_0x3df2('0x1f')](function(){return _0x1280d4[_0x3df2('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3df2('0x1f')](respondWithResult(_0x1bc2aa,null))[_0x3df2('0x56')](handleError(_0x1bc2aa,null));};exports[_0x3df2('0x104')]=function(_0x2e7b06,_0x49c482){var _0x833c10;return db[_0x3df2('0xa8')][_0x3df2('0x28')]({'paused':0x1},{'where':{'UserId':_0x2e7b06[_0x3df2('0x58')]['id']},'individualHooks':!![]})[_0x3df2('0x1f')](function(){return db[_0x3df2('0x39')][_0x3df2('0x5b')]({'where':{'id':_0x2e7b06[_0x3df2('0x58')]['id'],'role':'agent'},'attributes':['id',_0x3df2('0x36'),'role',_0x3df2('0x62'),'interface','online']});})[_0x3df2('0x1f')](handleEntityNotFound(_0x49c482,null))[_0x3df2('0x1f')](function(_0x8f8358){if(_0x8f8358){_0x833c10=_0x8f8358;return respondWithRpcPromise(_0x3df2('0x105'),_0x3df2('0x104'),{'id':_0x833c10['id'],'name':_0x833c10[_0x3df2('0x36')],'pause':!![]});}})['then'](function(){if(_0x833c10){return db['MemberReport'][_0x3df2('0x4d')]({'where':{'membername':_0x833c10[_0x3df2('0x36')],'type':'PAUSE','exitAt':null}});}})[_0x3df2('0x1f')](function(_0x561e7f){if(_0x561e7f[_0x3df2('0x50')]){var _0x16a72f=moment()[_0x3df2('0xef')](_0x3df2('0xfd'));for(var _0x3d2e19=0x0,_0x3dc909=_0x561e7f[_0x3df2('0x50')];_0x3d2e19<_0x3dc909;_0x3d2e19++){_0x561e7f[_0x3d2e19]['updateAttributes']({'exitAt':_0x16a72f});}}})[_0x3df2('0x1f')](function(){var _0x1bb244=[];var _0x1f0548=utils['getChannels']();_0x1f0548['forEach'](function(_0x111243){_0x1bb244[_0x3df2('0x4c')]({'channel':_0x111243,'membername':_0x833c10[_0x3df2('0x36')],'interface':_[_0x3df2('0x66')](_0x833c10[_0x3df2('0xa7')])?util['format'](_0x3df2('0xa6'),_0x833c10[_0x3df2('0x36')]):_0x833c10['interface'],'type':_0x3df2('0x100'),'enterAt':moment()[_0x3df2('0xef')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2e7b06[_0x3df2('0x5e')][_0x3df2('0x3c')]||'DEFAULT\x20PAUSE','role':_0x833c10[_0x3df2('0x2d')],'internal':_0x833c10[_0x3df2('0x62')]});});return db[_0x3df2('0x102')][_0x3df2('0x85')](_0x1bb244,{'individualHooks':!![]});})[_0x3df2('0x1f')](function(){return _0x833c10[_0x3df2('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2e7b06['body'][_0x3df2('0x3c')]||_0x3df2('0x106'),'lastPauseAt':moment()[_0x3df2('0xef')](_0x3df2('0xfd'))});})['then'](respondWithResult(_0x49c482,null))[_0x3df2('0x56')](handleError(_0x49c482,null));};exports[_0x3df2('0x107')]=function(_0x3d717e,_0x1f510b){if(_0x3d717e[_0x3df2('0x5e')][_0x3df2('0x99')]&&!utils[_0x3df2('0x9c')](_0x3d717e[_0x3df2('0x5e')][_0x3df2('0x99')])){throw new APIBadRequestError(util[_0x3df2('0xef')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3d717e[_0x3df2('0x5e')][_0x3df2('0x99')]));}return db['User']['find']({'where':{'id':_0x3d717e['params']['id']},'attributes':['id','name',_0x3df2('0x2d'),_0x3df2('0x62'),_0x3df2('0xa7'),_0x3df2('0x108'),'voicePause','mailPause',_0x3df2('0x109'),_0x3df2('0x10a'),_0x3df2('0x10b'),_0x3df2('0x10c'),_0x3df2('0x10d'),_0x3df2('0x10e'),_0x3df2('0x10f')]})[_0x3df2('0x1f')](function(_0x18dea3){if(!_0x18dea3){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x3d717e[_0x3df2('0x58')]['id']));}return _0x18dea3[_0x3df2('0x107')](_0x3d717e[_0x3df2('0x5e')][_0x3df2('0x99')]);})['then'](respondWithResult(_0x1f510b,null))[_0x3df2('0x56')](APIHandleError(_0x1f510b));};exports['getTeams']=function(_0x5e0d8c,_0x484aa3){var _0x38e525={};var _0x45d657={};var _0x4edf5d;var _0x5009f8;return db[_0x3df2('0x39')]['findOne']({'where':{'id':_0x5e0d8c[_0x3df2('0x58')]['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x484aa3,null))[_0x3df2('0x1f')](function(_0x1f97aa){if(_0x1f97aa){_0x4edf5d=_0x1f97aa;_0x45d657[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_0x3df2('0x110')][_0x3df2('0x3a')]);_0x45d657['query']=_['keys'](_0x5e0d8c['query']);_0x45d657[_0x3df2('0xd5')]=_['intersection'](_0x45d657[_0x3df2('0xcd')],_0x45d657[_0x3df2('0x46')]);_0x38e525[_0x3df2('0x4b')]=_[_0x3df2('0xd0')](_0x45d657[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x5e0d8c['query'][_0x3df2('0xd1')]));_0x38e525['attributes']=_0x38e525[_0x3df2('0x4b')]['length']?_0x38e525['attributes']:_0x45d657[_0x3df2('0xcd')];_0x38e525[_0x3df2('0xd2')]=qs['sort'](_0x5e0d8c[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x38e525[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_['pick'](_0x5e0d8c[_0x3df2('0x46')],_0x45d657[_0x3df2('0xd5')]));if(_0x5e0d8c['query'][_0x3df2('0x3d')]){_0x38e525[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x38e525[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x38e525['attributes'],function(_0x4f4a03){var _0x266a2d={};_0x266a2d[_0x4f4a03]={'$like':'%'+_0x5e0d8c[_0x3df2('0x46')]['filter']+'%'};return _0x266a2d;})});}_0x38e525=_[_0x3df2('0xd6')]({},_0x38e525,_0x5e0d8c['options']);return _0x4edf5d['getTeams'](_0x38e525);}})[_0x3df2('0x1f')](function(_0x462adf){if(_0x462adf){_0x5009f8=_0x462adf['length'];if(!_0x5e0d8c[_0x3df2('0x46')][_0x3df2('0xd8')]('nolimit')){_0x38e525[_0x3df2('0x1c')]=qs['limit'](_0x5e0d8c[_0x3df2('0x46')]['limit']);_0x38e525[_0x3df2('0x1a')]=qs['offset'](_0x5e0d8c[_0x3df2('0x46')][_0x3df2('0x1a')]);}return _0x4edf5d[_0x3df2('0x111')](_0x38e525);}})[_0x3df2('0x1f')](function(_0x4d3c4f){if(_0x4d3c4f){return _0x4d3c4f?{'count':_0x5009f8,'rows':_0x4d3c4f}:null;}})[_0x3df2('0x1f')](respondWithResult(_0x484aa3,null))['catch'](handleError(_0x484aa3,null));};exports[_0x3df2('0x112')]=function(_0x3d7228,_0x1a79fd){var _0x29d930=_0x3d7228['params']['id'];var _0x15cb45=_0x3d7228[_0x3df2('0x5e')]?_0x3d7228['body'][_0x3df2('0x60')]:null;var _0x40d230=[];return Promise['resolve']()[_0x3df2('0x1f')](function(){if(!_0x15cb45)throw new APIBadRequestError(_0x3df2('0x113'));})['then'](function(){return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0x29d930}});})['then'](function(_0x4f2b0a){if(!_0x4f2b0a)throw new APINotFoundError(util['format'](_0x3df2('0xc5'),_0x3d7228[_0x3df2('0x58')]['id']));return db[_0x3df2('0x68')][_0x3df2('0xf9')](function(_0xbc9fba){return _0x4f2b0a['addTeams'](_0x15cb45,{'transaction':_0xbc9fba})['then'](function(){return db[_0x3df2('0x110')]['findAll']({'where':{'id':{'$in':_0x15cb45}}});})[_0x3df2('0x1f')](function(_0x13584a){var _0x5e6a4e=_[_0x3df2('0x33')](_0x13584a,function(_0x45b83d){return _0x45b83d['getAssociatedQueues']();});return Promise[_0x3df2('0x55')](_0x5e6a4e);})[_0x3df2('0x1f')](function(_0x1a9b6d){_0x40d230=_[_0x3df2('0x114')](_0x1a9b6d);var _0x401762=_['map'](_0x40d230,function(_0x16b404){return _0x16b404['addAgent'](_0x4f2b0a['id'],{'transaction':_0xbc9fba});});return Promise[_0x3df2('0x55')](_0x401762);})[_0x3df2('0x1f')](function(){if(!_0x4f2b0a['online'])return;var _0x310fbe=_[_0x3df2('0x3d')](_0x40d230,function(_0x109faf){return _0x109faf['getDataValue']('channel')===_0x3df2('0x115');});var _0x30bbb9=_[_0x3df2('0x33')](_0x310fbe,function(_0x34a347){return db[_0x3df2('0xa8')][_0x3df2('0xa9')]({'membername':_0x4f2b0a[_0x3df2('0x36')],'UserId':_0x4f2b0a['id'],'queue_name':_0x34a347[_0x3df2('0x36')],'VoiceQueueId':_0x34a347['id'],'interface':_[_0x3df2('0x66')](_0x4f2b0a['interface'])?util['format'](_0x3df2('0xa6'),_0x4f2b0a[_0x3df2('0x36')]):_0x4f2b0a[_0x3df2('0xa7')],'paused':_0x4f2b0a[_0x3df2('0x9b')]||![],'penalty':_0x4f2b0a[_0x3df2('0xa0')]},{'transaction':_0xbc9fba});});return Promise[_0x3df2('0x55')](_0x30bbb9);})[_0x3df2('0x1f')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x15cb45}}});})['then'](function(_0x2ab147){var _0x3f2708=_[_0x3df2('0x33')](_0x2ab147,function(_0x2904ca){return db['UserVoicePrefix']['create']({'UserId':_0x4f2b0a['id'],'VoicePrefixId':_0x2904ca[_0x3df2('0x116')]},{'transaction':_0xbc9fba});});return Promise[_0x3df2('0x55')](_0x3f2708);});});})[_0x3df2('0x1f')](function(){for(var _0xf54344=0x0;_0xf54344<_0x40d230['length'];_0xf54344++){var _0x1afe93=_0x40d230[_0xf54344][_0x3df2('0x117')]('channel');var _0x2c70d8=_0x1afe93+_0x3df2('0xa2');socket[_0x3df2('0x2a')](_0x3df2('0x2e')+_0x1afe93+_0x3df2('0xa3'),{'UserId':_0x29d930,['queueField']:_0x40d230[_0xf54344]['id']});}})[_0x3df2('0x1f')](respondWithStatusCode(_0x1a79fd,null))['catch'](APIHandleError(_0x1a79fd));};exports[_0x3df2('0x118')]=function(_0x25a5a5,_0x4aab7a){var _0x6c1846=_0x25a5a5[_0x3df2('0x58')]['id'];var _0x4b19b2=null;if(_0x25a5a5['query'][_0x3df2('0x60')]){_0x4b19b2=_[_0x3df2('0xab')](_0x25a5a5[_0x3df2('0x46')][_0x3df2('0x60')])?_0x25a5a5[_0x3df2('0x46')][_0x3df2('0x60')]:[_0x25a5a5[_0x3df2('0x46')]['ids']];}var _0x487e23=[];return Promise[_0x3df2('0x119')]()['then'](function(){if(!_0x4b19b2)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x3df2('0x1f')](function(){return db[_0x3df2('0x39')][_0x3df2('0x93')]({'where':{'id':_0x6c1846}});})[_0x3df2('0x1f')](function(_0x5c241d){if(!_0x5c241d)throw new APINotFoundError(util[_0x3df2('0xef')](_0x3df2('0xc5'),_0x25a5a5['params']['id']));return db[_0x3df2('0x68')][_0x3df2('0xf9')](function(_0x256060){return _0x5c241d[_0x3df2('0x118')](_0x4b19b2,{'transaction':_0x256060})[_0x3df2('0x1f')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x4b19b2}}});})[_0x3df2('0x1f')](function(_0x35af80){var _0x405718=_[_0x3df2('0x33')](_0x35af80,function(_0x16d1ee){return _0x16d1ee[_0x3df2('0x11a')]();});return Promise[_0x3df2('0x55')](_0x405718);})[_0x3df2('0x1f')](function(_0x35f849){_0x487e23=_[_0x3df2('0x114')](_0x35f849);var _0x365fa0=_['map'](_0x487e23,function(_0x170f41){return _0x170f41[_0x3df2('0x11b')](_0x5c241d['id'],{'transaction':_0x256060});});return Promise['all'](_0x365fa0);})[_0x3df2('0x1f')](function(){if(!_0x5c241d[_0x3df2('0x108')])return;var _0x37bc7d=_[_0x3df2('0x3d')](_0x487e23,function(_0x29cbb6){return _0x29cbb6[_0x3df2('0x117')](_0x3df2('0x99'))===_0x3df2('0x115');});var _0x37ec75=_[_0x3df2('0x33')](_0x37bc7d,function(_0x2efef9){return db[_0x3df2('0xa8')]['destroy']({'where':{'VoiceQueueId':_0x2efef9['id'],'UserId':_0x5c241d['id']},'transaction':_0x256060});});return Promise[_0x3df2('0x55')](_0x37ec75);})['then'](function(){return db[_0x3df2('0x11c')][_0x3df2('0x4d')]({'where':{'teamId':{'$in':_0x4b19b2}}});})['then'](function(_0x2751a3){var _0x2a5edd=_[_0x3df2('0x33')](_0x2751a3,function(_0x1fbb71){return db[_0x3df2('0x11d')][_0x3df2('0x2b')]({'where':{'UserId':_0x5c241d['id'],'VoicePrefixId':_0x1fbb71[_0x3df2('0x116')]}},{'transaction':_0x256060});});return Promise[_0x3df2('0x55')](_0x2a5edd);});});})[_0x3df2('0x1f')](function(){for(var _0x5c768d=0x0;_0x5c768d<_0x487e23['length'];_0x5c768d++){var _0x108c42=_0x487e23[_0x5c768d][_0x3df2('0x117')](_0x3df2('0x99'));var _0x3319f3=_0x108c42+_0x3df2('0xa2');socket[_0x3df2('0x2a')](_0x3df2('0x2e')+_0x108c42+_0x3df2('0xac'),{'UserId':_0x6c1846,['queueField']:_0x487e23[_0x5c768d]['id']});}})['then'](respondWithStatusCode(_0x4aab7a,null))['catch'](APIHandleError(_0x4aab7a));};exports[_0x3df2('0x11e')]=function(_0x2dd6ee,_0x622a40){var _0xfae129={};var _0x587f5c={};var _0x3083db;var _0x2aaf55;return db['User'][_0x3df2('0x93')]({'where':{'id':_0x2dd6ee[_0x3df2('0x58')]['id']}})[_0x3df2('0x1f')](handleEntityNotFound(_0x622a40,null))[_0x3df2('0x1f')](function(_0x5b236b){if(_0x5b236b){_0x3083db=_0x5b236b;_0x587f5c[_0x3df2('0xcd')]=_[_0x3df2('0xce')](db[_0x3df2('0xc7')][_0x3df2('0x3a')]);_0x587f5c[_0x3df2('0x46')]=_[_0x3df2('0xce')](_0x2dd6ee['query']);_0x587f5c[_0x3df2('0xd5')]=_['intersection'](_0x587f5c[_0x3df2('0xcd')],_0x587f5c[_0x3df2('0x46')]);_0xfae129[_0x3df2('0x4b')]=_['intersection'](_0x587f5c[_0x3df2('0xcd')],qs[_0x3df2('0xd1')](_0x2dd6ee[_0x3df2('0x46')][_0x3df2('0xd1')]));_0xfae129[_0x3df2('0x4b')]=_0xfae129[_0x3df2('0x4b')]['length']?_0xfae129[_0x3df2('0x4b')]:_0x587f5c[_0x3df2('0xcd')];_0xfae129[_0x3df2('0xd2')]=qs[_0x3df2('0xd3')](_0x2dd6ee[_0x3df2('0x46')][_0x3df2('0xd3')]);_0xfae129['where']=qs[_0x3df2('0xd5')](_[_0x3df2('0xd4')](_0x2dd6ee['query'],_0x587f5c[_0x3df2('0xd5')]));if(_0x2dd6ee[_0x3df2('0x46')]['filter']){_0xfae129[_0x3df2('0x45')]=_['merge'](_0xfae129[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0xfae129['attributes'],function(_0x5b775c){var _0x14b103={};_0x14b103[_0x5b775c]={'$like':'%'+_0x2dd6ee['query']['filter']+'%'};return _0x14b103;})});}_0xfae129=_[_0x3df2('0xd6')]({},_0xfae129,_0x2dd6ee['options']);return _0x3083db[_0x3df2('0x11e')](_0xfae129);}})['then'](function(_0x211b17){if(_0x211b17){_0x2aaf55=_0x211b17['length'];if(!_0x2dd6ee[_0x3df2('0x46')][_0x3df2('0xd8')](_0x3df2('0xd9'))){_0xfae129[_0x3df2('0x1c')]=qs[_0x3df2('0x1c')](_0x2dd6ee[_0x3df2('0x46')][_0x3df2('0x1c')]);_0xfae129[_0x3df2('0x1a')]=qs[_0x3df2('0x1a')](_0x2dd6ee[_0x3df2('0x46')][_0x3df2('0x1a')]);}return _0x3083db[_0x3df2('0x11e')](_0xfae129);}})[_0x3df2('0x1f')](function(_0x29ac72){if(_0x29ac72){return _0x29ac72?{'count':_0x2aaf55,'rows':_0x29ac72}:null;}})[_0x3df2('0x1f')](respondWithResult(_0x622a40,null))[_0x3df2('0x56')](handleError(_0x622a40,null));};exports[_0x3df2('0x11f')]=function(_0xf9d567,_0x1ace41){var _0x2dc34c={};var _0x2fc1c0={};var _0x5aa4ea;return db[_0x3df2('0x39')]['findOne']({'where':{'id':_0xf9d567['params']['id']}})['then'](handleEntityNotFound(_0x1ace41,null))[_0x3df2('0x1f')](function(_0x16710a){if(_0x16710a){_0x5aa4ea=_0x16710a;_0x2fc1c0['model']=_[_0x3df2('0xce')](db[_0x3df2('0x39')][_0x3df2('0x3a')]);_0x2fc1c0[_0x3df2('0x46')]=_['keys'](_0xf9d567[_0x3df2('0x46')]);_0x2fc1c0['filters']=_[_0x3df2('0xd0')](_0x2fc1c0['model'],_0x2fc1c0['query']);_0x2dc34c['attributes']=_[_0x3df2('0xd0')](_0x2fc1c0['model'],qs['fields'](_0xf9d567[_0x3df2('0x46')]['fields']));_0x2dc34c[_0x3df2('0x4b')]=_0x2dc34c[_0x3df2('0x4b')][_0x3df2('0x50')]?_0x2dc34c[_0x3df2('0x4b')]:_0x2fc1c0[_0x3df2('0xcd')];_0x2dc34c[_0x3df2('0xd2')]=qs['sort'](_0xf9d567[_0x3df2('0x46')][_0x3df2('0xd3')]);_0x2dc34c[_0x3df2('0x45')]=qs[_0x3df2('0xd5')](_[_0x3df2('0xd4')](_0xf9d567[_0x3df2('0x46')],_0x2fc1c0[_0x3df2('0xd5')]));if(_0xf9d567['query'][_0x3df2('0x3d')]){_0x2dc34c[_0x3df2('0x45')]=_[_0x3df2('0xd6')](_0x2dc34c[_0x3df2('0x45')],{'$or':_[_0x3df2('0x33')](_0x2dc34c[_0x3df2('0x4b')],function(_0x303766){var _0x47bf30={};_0x47bf30[_0x303766]={'$like':'%'+_0xf9d567[_0x3df2('0x46')][_0x3df2('0x3d')]+'%'};return _0x47bf30;})});}_0x2dc34c[_0x3df2('0xcd')]=db['User'];_0x2dc34c['as']=_0x3df2('0x2f');_0x2dc34c=_[_0x3df2('0xd6')]({},_0x2dc34c,_0xf9d567['options']);return _0x5aa4ea[_0x3df2('0xfa')]({'include':[_0x2dc34c]});}})[_0x3df2('0x1f')](function(_0x262420){if(_0x262420){var _0x464d0c={},_0x1b797f=[];for(var _0xe1a86a=0x0;_0xe1a86a<_0x262420[_0x3df2('0x50')];_0xe1a86a+=0x1){for(var _0x265d3f=0x0,_0x5e6cb8;_0x265d3f<_0x262420[_0xe1a86a][_0x3df2('0x2f')][_0x3df2('0x50')];_0x265d3f+=0x1){_0x5e6cb8=_0x262420[_0xe1a86a][_0x3df2('0x2f')][_0x265d3f][_0x3df2('0x2c')]({'plain':!![]});_0x464d0c[_0x5e6cb8['id']]=_0x5e6cb8;}}_0x464d0c=_[_0x3df2('0x120')](_0x464d0c);for(var _0x4b91d8=qs[_0x3df2('0x1a')](_0xf9d567[_0x3df2('0x46')][_0x3df2('0x1a')]);_0x4b91d8<_0x464d0c[_0x3df2('0x50')]&&_0x1b797f['length']=_0x3104aa[_0x1b77('0x4f')]){throw new Error(_0x1b77('0x50'));}})[_0x1b77('0x22')](function(){if(_0x3e0bf3){return db[_0x1b77('0x51')][_0x1b77('0x47')]({'where':{'membername':_0x3e0bf3['name']},'individualHooks':!![]});}})[_0x1b77('0x22')](function(){if(_0x3e0bf3){return _0x3e0bf3[_0x1b77('0x52')]({'raw':!![]});}})[_0x1b77('0x22')](function(_0x5ea78a){if(_0x3e0bf3){if(_0x5ea78a){var _0x1c2389=[];_0xa7297=_0x5ea78a;if(_0xa7297[_0x1b77('0x2a')]){for(var _0x4d44e4=0x0;_0x4d44e4<_0xa7297[_0x1b77('0x2a')];_0x4d44e4++){_0x1c2389['push'](db['UserVoiceQueueRt'][_0x1b77('0x53')]({'membername':_0x3e0bf3[_0x1b77('0x2f')],'UserId':_0x3e0bf3['id'],'queue_name':_0xa7297[_0x4d44e4]['name'],'VoiceQueueId':_0xa7297[_0x4d44e4]['id'],'interface':_0x64cc29,'paused':_0x3e0bf3['loginInPause']||![],'penalty':_0xa7297[_0x4d44e4][_0x1b77('0x54')]||0x0}));}return BPromise[_0x1b77('0x48')](_0x1c2389);}}}})[_0x1b77('0x22')](function(){if(_0x3e0bf3){return db[_0x1b77('0x27')][_0x1b77('0xe')]({'where':{'membername':_0x3e0bf3[_0x1b77('0x2f')],'exitAt':null}});}})[_0x1b77('0x22')](function(_0x2e0372){if(_0x3e0bf3){if(_0x2e0372&&_0x2e0372[_0x1b77('0x2a')]){var _0x28ed4e=[];_0x2e0372[_0x1b77('0x2d')](function(_0x3ac8b2){_0x28ed4e[_0x1b77('0x2e')](_0x3ac8b2['update']({'exitAt':moment()[_0x1b77('0x23')](_0x1b77('0x29'))}));});return BPromise[_0x1b77('0x48')](_0x28ed4e);}}})['then'](function(){if(_0x3e0bf3){var _0x32c3cc=[];var _0x38469d=[];var _0x3a1cfb=utils[_0x1b77('0x2c')]();var _0xa742a4={'membername':_0x3e0bf3['name'],'interface':_0x64cc29,'enterAt':moment()['format'](_0x1b77('0x29')),'role':_0x3e0bf3[_0x1b77('0x1f')],'internal':_0x3e0bf3[_0x1b77('0x20')]};_0x3a1cfb[_0x1b77('0x2d')](function(_0x13bbb1){_0x32c3cc[_0x1b77('0x2e')](_[_0x1b77('0x55')]({'channel':_0x13bbb1,'type':'LOGIN','data1':_0x1b77('0x56'),'data2':_0x64cc29},_0xa742a4));if(_0x3e0bf3['loginInPause']){_0x38469d[_0x1b77('0x2e')](_[_0x1b77('0x55')]({'channel':_0x13bbb1,'type':_0x1b77('0x28'),'data1':_0x1b77('0x57')},_0xa742a4));}});return db[_0x1b77('0x27')][_0x1b77('0x35')](_0x32c3cc[_0x1b77('0x58')](_0x38469d),{'individualHooks':!![]});}})['then'](function(){if(_0x3e0bf3){return _0x3e0bf3[_0x1b77('0x26')]({'online':!![],'lastLoginAt':moment()[_0x1b77('0x23')](_0x1b77('0x29')),'voicePause':_0x3e0bf3[_0x1b77('0x59')]||![],'mailPause':_0x3e0bf3[_0x1b77('0x59')]||![],'chatPause':_0x3e0bf3[_0x1b77('0x59')]||![],'faxPause':_0x3e0bf3['loginInPause']||![],'smsPause':_0x3e0bf3[_0x1b77('0x59')]||![],'openchannelPause':_0x3e0bf3[_0x1b77('0x59')]||![],'pauseType':_0x3e0bf3['loginInPause']?_0x1b77('0x57'):null,'lastPauseAt':moment()[_0x1b77('0x23')](_0x1b77('0x29')),'interface':_0x64cc29});}})[_0x1b77('0x22')](function(_0x2826a1){_0x31e6c8(_0x2826a1);})['catch'](function(_0x88ba48){_0x3ab49c(_0x3d1aef[_0x1b77('0x18')](0x1f4,_0x88ba48[_0x1b77('0x19')]));});});}; \ No newline at end of file +var _0x936c=['PAUSE','length','updateAttributes','getChannels','forEach','isNil','format','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','role','body','uniqueid','DEFAULT\x20PAUSE','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','unpause','system','LogoutUser','UserVoiceQueueRt','destroy','push','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','callysquare','LOGININPAUSE','concat','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','User','options','raw','attributes','limit','include','model','then','info','GetUser','debug','catch','error','message','ShowUser','find','where','map','stringify','PauseUser','name','internal','interface','User\x20with\x20id\x20%s\x20not\x20found','params','update','MemberReport','findAll'];(function(_0x468314,_0x2a102b){var _0x327016=function(_0x5cbabf){while(--_0x5cbabf){_0x468314['push'](_0x468314['shift']());}};_0x327016(++_0x2a102b);}(_0x936c,0xe7));var _0xc936=function(_0x16418d,_0x4e763d){_0x16418d=_0x16418d-0x0;var _0x411926=_0x936c[_0x16418d];return _0x411926;};'use strict';var _=require('lodash');var util=require(_0xc936('0x0'));var moment=require(_0xc936('0x1'));var BPromise=require(_0xc936('0x2'));var Redis=require(_0xc936('0x3'));var db=require(_0xc936('0x4'))['db'];var utils=require(_0xc936('0x5'));var logger=require('../../config/logger')(_0xc936('0x6'));var config=require(_0xc936('0x7'));config[_0xc936('0x8')]=_[_0xc936('0x9')](config[_0xc936('0x8')],{'host':_0xc936('0xa'),'port':0x18eb});var socket=require(_0xc936('0xb'))(new Redis(config[_0xc936('0x8')]));require(_0xc936('0xc'))[_0xc936('0xd')](socket);exports['GetUser']=function(_0x1c977c){var _0x826dcd=this;return new Promise(function(_0x47103b,_0x482b62){return db[_0xc936('0xe')]['findAll']({'raw':_0x1c977c[_0xc936('0xf')]?_0x1c977c[_0xc936('0xf')][_0xc936('0x10')]===undefined?!![]:![]:!![],'where':_0x1c977c[_0xc936('0xf')]?_0x1c977c['options']['where']||null:null,'attributes':_0x1c977c[_0xc936('0xf')]?_0x1c977c[_0xc936('0xf')][_0xc936('0x11')]||null:null,'limit':_0x1c977c[_0xc936('0xf')]?_0x1c977c[_0xc936('0xf')][_0xc936('0x12')]||null:null,'include':_0x1c977c[_0xc936('0xf')]?_0x1c977c[_0xc936('0xf')]['include']?_['map'](_0x1c977c[_0xc936('0xf')][_0xc936('0x13')],function(_0x4383a0){return{'model':db[_0x4383a0[_0xc936('0x14')]],'as':_0x4383a0['as'],'attributes':_0x4383a0[_0xc936('0x11')],'include':_0x4383a0[_0xc936('0x13')]?_['map'](_0x4383a0[_0xc936('0x13')],function(_0x31cec4){return{'model':db[_0x31cec4[_0xc936('0x14')]],'as':_0x31cec4['as'],'attributes':_0x31cec4[_0xc936('0x11')],'include':_0x31cec4[_0xc936('0x13')]?_['map'](_0x31cec4['include'],function(_0xcb278a){return{'model':db[_0xcb278a[_0xc936('0x14')]],'as':_0xcb278a['as'],'attributes':_0xcb278a[_0xc936('0x11')]};}):[]};}):[]};}):[]:[]})[_0xc936('0x15')](function(_0x395d5e){logger[_0xc936('0x16')](_0xc936('0x17'),_0x1c977c);logger[_0xc936('0x18')](_0xc936('0x17'),_0x1c977c,JSON['stringify'](_0x395d5e));_0x47103b(_0x395d5e);})[_0xc936('0x19')](function(_0x490d19){logger[_0xc936('0x1a')](_0xc936('0x17'),_0x490d19[_0xc936('0x1b')],_0x1c977c);_0x482b62(_0x826dcd[_0xc936('0x1a')](0x1f4,_0x490d19[_0xc936('0x1b')]));});});};exports[_0xc936('0x1c')]=function(_0x250330){var _0x3e91a5=this;return new Promise(function(_0x5d2d1d,_0x438ede){return db[_0xc936('0xe')][_0xc936('0x1d')]({'raw':_0x250330['options']?_0x250330['options'][_0xc936('0x10')]===undefined?!![]:![]:!![],'where':_0x250330[_0xc936('0xf')]?_0x250330[_0xc936('0xf')][_0xc936('0x1e')]||null:null,'attributes':_0x250330[_0xc936('0xf')]?_0x250330[_0xc936('0xf')][_0xc936('0x11')]||null:null,'include':_0x250330[_0xc936('0xf')]?_0x250330[_0xc936('0xf')]['include']?_[_0xc936('0x1f')](_0x250330[_0xc936('0xf')][_0xc936('0x13')],function(_0xeda106){return{'model':db[_0xeda106[_0xc936('0x14')]],'as':_0xeda106['as'],'attributes':_0xeda106[_0xc936('0x11')],'include':_0xeda106['include']?_[_0xc936('0x1f')](_0xeda106['include'],function(_0x51ace5){return{'model':db[_0x51ace5[_0xc936('0x14')]],'as':_0x51ace5['as'],'attributes':_0x51ace5[_0xc936('0x11')],'include':_0x51ace5[_0xc936('0x13')]?_[_0xc936('0x1f')](_0x51ace5[_0xc936('0x13')],function(_0x3bda30){return{'model':db[_0x3bda30[_0xc936('0x14')]],'as':_0x3bda30['as'],'attributes':_0x3bda30[_0xc936('0x11')]};}):[]};}):[]};}):[]:[]})[_0xc936('0x15')](function(_0x2819b2){logger[_0xc936('0x16')]('ShowUser',_0x250330);logger[_0xc936('0x18')](_0xc936('0x1c'),_0x250330,JSON[_0xc936('0x20')](_0x2819b2));_0x5d2d1d(_0x2819b2);})[_0xc936('0x19')](function(_0xbc874d){logger[_0xc936('0x1a')](_0xc936('0x1c'),_0xbc874d[_0xc936('0x1b')],_0x250330);_0x438ede(_0x3e91a5[_0xc936('0x1a')](0x1f4,_0xbc874d[_0xc936('0x1b')]));});});};exports[_0xc936('0x21')]=function(_0xe3475d){var _0x5eeb59;return db[_0xc936('0xe')]['find']({'where':_0xe3475d['options'][_0xc936('0x1e')]||{},'attributes':['id',_0xc936('0x22'),'role',_0xc936('0x23'),_0xc936('0x24')]})[_0xc936('0x15')](function(_0x1606e0){if(!_0x1606e0){throw new Error(util['format'](_0xc936('0x25'),_0xe3475d[_0xc936('0x26')]['id']));}_0x5eeb59=_0x1606e0;return db['UserVoiceQueueRt'][_0xc936('0x27')]({'paused':0x1},{'where':{'UserId':_0x5eeb59['id']},'individualHooks':!![]});})['then'](function(){return db[_0xc936('0x28')][_0xc936('0x29')]({'where':{'membername':_0x5eeb59['name'],'type':_0xc936('0x2a'),'exitAt':null}});})[_0xc936('0x15')](function(_0x459bbe){if(_0x459bbe&&_0x459bbe[_0xc936('0x2b')]){var _0x3b9359=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3e44d0=0x0,_0x21da8a=_0x459bbe[_0xc936('0x2b')];_0x3e44d0<_0x21da8a;_0x3e44d0++){_0x459bbe[_0x3e44d0][_0xc936('0x2c')]({'exitAt':_0x3b9359});}}})[_0xc936('0x15')](function(){var _0x19319b=[];var _0xb83b4d=utils[_0xc936('0x2d')]();_0xb83b4d[_0xc936('0x2e')](function(_0x3d9f0f){_0x19319b['push']({'channel':_0x3d9f0f,'membername':_0x5eeb59[_0xc936('0x22')],'interface':_[_0xc936('0x2f')](_0x5eeb59['interface'])?util[_0xc936('0x30')](_0xc936('0x31'),_0x5eeb59[_0xc936('0x22')]):_0x5eeb59[_0xc936('0x24')],'type':_0xc936('0x2a'),'enterAt':moment()[_0xc936('0x30')](_0xc936('0x32')),'data1':_0xe3475d['body']['type']||'DEFAULT\x20PAUSE','role':_0x5eeb59[_0xc936('0x33')],'internal':_0x5eeb59[_0xc936('0x23')],'uniqueid':_0xe3475d[_0xc936('0x34')][_0xc936('0x35')]||null});});return db['MemberReport']['bulkCreate'](_0x19319b,{'individualHooks':!![]});})[_0xc936('0x15')](function(){return _0x5eeb59['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xe3475d['body']['type']||_0xc936('0x36'),'lastPauseAt':moment()[_0xc936('0x30')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xc936('0x19')](function(_0x4c6954){throw _0x4c6954;});};exports['UnpauseUser']=function(_0x3f1ed6){return Promise[_0xc936('0x37')]()[_0xc936('0x15')](function(){if(_0x3f1ed6[_0xc936('0x34')][_0xc936('0x38')]&&!utils[_0xc936('0x39')](_0x3f1ed6[_0xc936('0x34')]['channel'])){throw new Error(util['format'](_0xc936('0x3a'),_0x3f1ed6['body'][_0xc936('0x38')]));}return db[_0xc936('0xe')][_0xc936('0x3b')]({'where':_0x3f1ed6[_0xc936('0xf')]['where']||{},'attributes':['id','name','role','internal',_0xc936('0x24'),_0xc936('0x3c'),_0xc936('0x3d'),_0xc936('0x3e'),_0xc936('0x3f'),'faxPause',_0xc936('0x40'),_0xc936('0x41'),_0xc936('0x42'),_0xc936('0x43'),'lastPauseAt']});})['then'](function(_0x2c6ee9){if(!_0x2c6ee9){throw new Error(util[_0xc936('0x30')](_0xc936('0x25'),_0x3f1ed6['params']['id']));}return _0x2c6ee9[_0xc936('0x44')](_0x3f1ed6['body'][_0xc936('0x38')],_0xc936('0x45'));})['catch'](function(_0xb97bdc){throw _0xb97bdc;});};exports[_0xc936('0x46')]=function(_0x21c5a9){var _0x50b7a7=this;return new Promise(function(_0x26c110,_0x26e674){var _0x2b0f73;return db[_0xc936('0xe')][_0xc936('0x3b')]({'where':_0x21c5a9[_0xc936('0xf')][_0xc936('0x1e')]||{},'attributes':['id',_0xc936('0x22')]})['then'](function(_0x5b333c){if(_0x5b333c){_0x2b0f73=_0x5b333c;return db[_0xc936('0x47')][_0xc936('0x48')]({'where':{'membername':_0x2b0f73[_0xc936('0x22')]},'individualHooks':!![]});}})[_0xc936('0x15')](function(){if(_0x2b0f73){return db[_0xc936('0x28')][_0xc936('0x29')]({'where':{'membername':_0x2b0f73['name'],'exitAt':null}});}})[_0xc936('0x15')](function(_0x1276b1){if(_0x2b0f73){if(_0x1276b1&&_0x1276b1[_0xc936('0x2b')]){var _0x451f50=[];_0x1276b1[_0xc936('0x2e')](function(_0xbe22d2){_0x451f50[_0xc936('0x49')](_0xbe22d2[_0xc936('0x27')]({'exitAt':moment()[_0xc936('0x30')](_0xc936('0x32'))}));});return BPromise[_0xc936('0x4a')](_0x451f50);}}})[_0xc936('0x15')](function(){if(_0x2b0f73){return _0x2b0f73[_0xc936('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xc936('0x15')](function(_0x22f86c){_0x26c110(_0x22f86c);})[_0xc936('0x19')](function(_0x2ee861){_0x26e674(_0x50b7a7['error'](0x1f4,_0x2ee861['message']));});});};exports[_0xc936('0x4b')]=function(_0xc80691){var _0x1cae00=this;return new Promise(function(_0x53a4cd,_0x2e961a){var _0x2a156a;var _0x1ede84;var _0x281f76;var _0x2287b6;return db['User'][_0xc936('0x3b')]({'where':_0xc80691[_0xc936('0xf')][_0xc936('0x1e')]||{},'attributes':['id',_0xc936('0x22'),_0xc936('0x33'),_0xc936('0x4c'),_0xc936('0x4d'),_0xc936('0x23'),_0xc936('0x4e'),_0xc936('0x24')]})['then'](function(_0x41df9d){if(_0x41df9d){_0x2a156a=_0x41df9d;_0x2287b6=_0xc80691[_0xc936('0x34')][_0xc936('0x24')]?_0xc80691[_0xc936('0x34')]['interface']:util[_0xc936('0x30')](_0xc936('0x31'),_0x2a156a[_0xc936('0x22')]);return db[_0xc936('0xe')][_0xc936('0x4f')]({'where':{'role':_0xc936('0x50'),'online':!![],'id':{'$ne':_0x2a156a['id']}}});}})['then'](function(_0x53d2d7){if(_0x53d2d7){_0x281f76=_0x53d2d7;return require(_0xc936('0x51'))[_0xc936('0x52')]();}})[_0xc936('0x15')](function(_0x2b9234){if(_0x2b9234&&_0x2b9234[_0xc936('0x53')]&&_0x281f76>=_0x2b9234[_0xc936('0x53')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x2a156a){return db['UserVoiceQueueRt'][_0xc936('0x48')]({'where':{'membername':_0x2a156a['name']},'individualHooks':!![]});}})[_0xc936('0x15')](function(){if(_0x2a156a){return _0x2a156a[_0xc936('0x54')]({'raw':!![]});}})['then'](function(_0x270aa1){if(_0x2a156a){if(_0x270aa1){var _0x374d66=[];_0x1ede84=_0x270aa1;if(_0x1ede84[_0xc936('0x2b')]){for(var _0x1f5135=0x0;_0x1f5135<_0x1ede84[_0xc936('0x2b')];_0x1f5135++){_0x374d66[_0xc936('0x49')](db[_0xc936('0x47')][_0xc936('0x55')]({'membername':_0x2a156a['name'],'UserId':_0x2a156a['id'],'queue_name':_0x1ede84[_0x1f5135][_0xc936('0x22')],'VoiceQueueId':_0x1ede84[_0x1f5135]['id'],'interface':_0x2287b6,'paused':_0x2a156a[_0xc936('0x4e')]||![],'penalty':_0x1ede84[_0x1f5135][_0xc936('0x56')]||0x0}));}return BPromise[_0xc936('0x4a')](_0x374d66);}}}})[_0xc936('0x15')](function(){if(_0x2a156a){return db[_0xc936('0x28')][_0xc936('0x29')]({'where':{'membername':_0x2a156a[_0xc936('0x22')],'exitAt':null}});}})[_0xc936('0x15')](function(_0x3f81b4){if(_0x2a156a){if(_0x3f81b4&&_0x3f81b4[_0xc936('0x2b')]){var _0x390da6=[];_0x3f81b4[_0xc936('0x2e')](function(_0x295a80){_0x390da6[_0xc936('0x49')](_0x295a80['update']({'exitAt':moment()[_0xc936('0x30')](_0xc936('0x32'))}));});return BPromise[_0xc936('0x4a')](_0x390da6);}}})[_0xc936('0x15')](function(){if(_0x2a156a){var _0x1666c8=[];var _0x22c98f=[];var _0x29d661=utils['getChannels']();var _0x333a49={'membername':_0x2a156a['name'],'interface':_0x2287b6,'enterAt':moment()[_0xc936('0x30')](_0xc936('0x32')),'role':_0x2a156a[_0xc936('0x33')],'internal':_0x2a156a[_0xc936('0x23')]};_0x29d661[_0xc936('0x2e')](function(_0x50e13a){_0x1666c8[_0xc936('0x49')](_[_0xc936('0x57')]({'channel':_0x50e13a,'type':'LOGIN','data1':_0xc936('0x58'),'data2':_0x2287b6},_0x333a49));if(_0x2a156a['loginInPause']){_0x22c98f[_0xc936('0x49')](_[_0xc936('0x57')]({'channel':_0x50e13a,'type':'PAUSE','data1':_0xc936('0x59')},_0x333a49));}});return db[_0xc936('0x28')]['bulkCreate'](_0x1666c8[_0xc936('0x5a')](_0x22c98f),{'individualHooks':!![]});}})[_0xc936('0x15')](function(){if(_0x2a156a){return _0x2a156a['update']({'online':!![],'lastLoginAt':moment()[_0xc936('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2a156a[_0xc936('0x4e')]||![],'mailPause':_0x2a156a[_0xc936('0x4e')]||![],'chatPause':_0x2a156a[_0xc936('0x4e')]||![],'faxPause':_0x2a156a[_0xc936('0x4e')]||![],'smsPause':_0x2a156a['loginInPause']||![],'openchannelPause':_0x2a156a[_0xc936('0x4e')]||![],'pauseType':_0x2a156a[_0xc936('0x4e')]?_0xc936('0x59'):null,'lastPauseAt':moment()[_0xc936('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2287b6});}})[_0xc936('0x15')](function(_0x34ab41){_0x53a4cd(_0x34ab41);})['catch'](function(_0x2036fd){_0x2e961a(_0x1cae00[_0xc936('0x1a')](0x1f4,_0x2036fd['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d7a3863..52be61d 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 _0x17f2=['emit','removeListener','register','length','user:','./user.events','save','remove','update'];(function(_0x384d39,_0xf060fc){var _0x13bf22=function(_0x5d83f2){while(--_0x5d83f2){_0x384d39['push'](_0x384d39['shift']());}};_0x13bf22(++_0xf060fc);}(_0x17f2,0x176));var _0x217f=function(_0x16a637,_0x5eb627){_0x16a637=_0x16a637-0x0;var _0x25126d=_0x17f2[_0x16a637];return _0x25126d;};'use strict';var UserEvents=require(_0x217f('0x0'));var events=[_0x217f('0x1'),_0x217f('0x2'),_0x217f('0x3')];function createListener(_0x152333,_0x234e51){return function(_0x7af6ef){_0x234e51[_0x217f('0x4')](_0x152333,_0x7af6ef);};}function removeListener(_0xb8ca66,_0x4bd44c){return function(){UserEvents[_0x217f('0x5')](_0xb8ca66,_0x4bd44c);};}exports[_0x217f('0x6')]=function(_0x24c184){for(var _0x1cade0=0x0,_0x4c918c=events[_0x217f('0x7')];_0x1cade0<_0x4c918c;_0x1cade0++){var _0x46714e=events[_0x1cade0];var _0x4f8130=createListener(_0x217f('0x8')+_0x46714e,_0x24c184);UserEvents['on'](_0x46714e,_0x4f8130);}}; \ No newline at end of file +var _0x37da=['save','remove','emit','removeListener','register','user:'];(function(_0x312ffc,_0x46faf9){var _0x4a65ba=function(_0x4d1fee){while(--_0x4d1fee){_0x312ffc['push'](_0x312ffc['shift']());}};_0x4a65ba(++_0x46faf9);}(_0x37da,0x84));var _0xa37d=function(_0x512062,_0xf6f822){_0x512062=_0x512062-0x0;var _0x2a43ca=_0x37da[_0x512062];return _0x2a43ca;};'use strict';var UserEvents=require('./user.events');var events=[_0xa37d('0x0'),_0xa37d('0x1'),'update'];function createListener(_0x561ea6,_0x2c8e28){return function(_0x59a476){_0x2c8e28[_0xa37d('0x2')](_0x561ea6,_0x59a476);};}function removeListener(_0x50bb0b,_0x5de6f1){return function(){UserEvents[_0xa37d('0x3')](_0x50bb0b,_0x5de6f1);};}exports[_0xa37d('0x4')]=function(_0x26d5f4){for(var _0xee0061=0x0,_0x24a473=events['length'];_0xee0061<_0x24a473;_0xee0061++){var _0x13b183=events[_0xee0061];var _0x4d71f9=createListener(_0xa37d('0x5')+_0x13b183,_0x26d5f4);UserEvents['on'](_0x13b183,_0x4d71f9);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 451b5e3..0380cb2 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3e1fe8,_0x223c26){var _0x55d8e5=function(_0x15cd31){while(--_0x15cd31){_0x3e1fe8['push'](_0x3e1fe8['shift']());}};_0x55d8e5(++_0x223c26);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xa8c8eb,_0x32d9d4){var _0x258214=function(_0x389c9e){while(--_0x389c9e){_0xa8c8eb['push'](_0xa8c8eb['shift']());}};_0x258214(++_0x32d9d4);}(_0xe706,0xa3));var _0x6e70=function(_0x549ffa,_0x4011d9){_0x549ffa=_0x549ffa-0x0;var _0x378324=_0xe706[_0x549ffa];return _0x378324;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 83fae4a..7976f5f 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 _0x61d0=['INTEGER','sequelize','exports'];(function(_0x34f7d1,_0x3495b5){var _0x4cdd94=function(_0xcbb513){while(--_0xcbb513){_0x34f7d1['push'](_0x34f7d1['shift']());}};_0x4cdd94(++_0x3495b5);}(_0x61d0,0x181));var _0x061d=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x61d0[_0xa6cc5c];return _0x44803d;};'use strict';var Sequelize=require(_0x061d('0x0'));module[_0x061d('0x1')]={'penalty':{'type':Sequelize[_0x061d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbc82=['sequelize'];(function(_0x2527cb,_0x9b8826){var _0x2cc454=function(_0x4ed195){while(--_0x4ed195){_0x2527cb['push'](_0x2527cb['shift']());}};_0x2cc454(++_0x9b8826);}(_0xbc82,0x13e));var _0x2bc8=function(_0x4f153b,_0x39818f){_0x4f153b=_0x4f153b-0x0;var _0x4e0cf8=_0xbc82[_0x4f153b];return _0x4e0cf8;};'use strict';var Sequelize=require(_0x2bc8('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 39ea591..f0e1fc4 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 _0x3e41=['util','api','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','lodash'];(function(_0x117276,_0x2c725e){var _0x51b05f=function(_0x3c933c){while(--_0x3c933c){_0x117276['push'](_0x117276['shift']());}};_0x51b05f(++_0x2c725e);}(_0x3e41,0x167));var _0x13e4=function(_0x1ed8a8,_0x2b9844){_0x1ed8a8=_0x1ed8a8-0x0;var _0x464835=_0x3e41[_0x1ed8a8];return _0x464835;};'use strict';var _=require(_0x13e4('0x0'));var util=require(_0x13e4('0x1'));var logger=require('../../config/logger')(_0x13e4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x13e4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x13e4('0x4'));var config=require(_0x13e4('0x5'));var attributes=require(_0x13e4('0x6'));module[_0x13e4('0x7')]=function(_0x5648c8,_0x4078cd){return _0x5648c8[_0x13e4('0x8')](_0x13e4('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69c8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api'];(function(_0x238c67,_0x4c409e){var _0x51d179=function(_0x24ab46){while(--_0x24ab46){_0x238c67['push'](_0x238c67['shift']());}};_0x51d179(++_0x4c409e);}(_0x69c8,0x7a));var _0x869c=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0x69c8[_0x2e41e2];return _0x2844d6;};'use strict';var _=require(_0x869c('0x0'));var util=require(_0x869c('0x1'));var logger=require(_0x869c('0x2'))(_0x869c('0x3'));var moment=require(_0x869c('0x4'));var BPromise=require(_0x869c('0x5'));var rp=require(_0x869c('0x6'));var fs=require('fs');var path=require(_0x869c('0x7'));var rimraf=require(_0x869c('0x8'));var config=require(_0x869c('0x9'));var attributes=require('./userChatQueue.attributes');module[_0x869c('0xa')]=function(_0x49d17e,_0x36e1ce){return _0x49d17e[_0x869c('0xb')](_0x869c('0xc'),attributes,{'tableName':_0x869c('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 bec4de5..bb9924d 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 _0xd124=['http','request','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client'];(function(_0x37b13b,_0x3afcd1){var _0x1b0adb=function(_0x3195e0){while(--_0x3195e0){_0x37b13b['push'](_0x37b13b['shift']());}};_0x1b0adb(++_0x3afcd1);}(_0xd124,0xc8));var _0x4d12=function(_0x1acb60,_0x38caf5){_0x1acb60=_0x1acb60-0x0;var _0xb3cb64=_0xd124[_0x1acb60];return _0xb3cb64;};'use strict';var _=require(_0x4d12('0x0'));var util=require(_0x4d12('0x1'));var moment=require(_0x4d12('0x2'));var BPromise=require(_0x4d12('0x3'));var rs=require(_0x4d12('0x4'));var fs=require('fs');var Redis=require(_0x4d12('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4d12('0x6'))(_0x4d12('0x7'));var config=require(_0x4d12('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d12('0x9')][_0x4d12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dc792,_0x367284,_0x3dfeb3){return new BPromise(function(_0x1e020a,_0x21f2ff){return client[_0x4d12('0xb')](_0x2dc792,_0x3dfeb3)['then'](function(_0x5a21c8){logger[_0x4d12('0xc')](_0x4d12('0xd'),_0x367284,'request\x20sent');logger[_0x4d12('0xe')](_0x4d12('0xf'),_0x367284,_0x4d12('0x10'),JSON['stringify'](_0x5a21c8));if(_0x5a21c8[_0x4d12('0x11')]){if(_0x5a21c8[_0x4d12('0x11')][_0x4d12('0x12')]===0x1f4){logger[_0x4d12('0x11')](_0x4d12('0xd'),_0x367284,_0x5a21c8[_0x4d12('0x11')][_0x4d12('0x13')]);return _0x21f2ff(_0x5a21c8[_0x4d12('0x11')][_0x4d12('0x13')]);}logger['error'](_0x4d12('0xd'),_0x367284,_0x5a21c8['error'][_0x4d12('0x13')]);return _0x1e020a(_0x5a21c8[_0x4d12('0x11')][_0x4d12('0x13')]);}else{logger[_0x4d12('0xc')](_0x4d12('0xd'),_0x367284,_0x4d12('0x10'));_0x1e020a(_0x5a21c8[_0x4d12('0x14')][_0x4d12('0x13')]);}})['catch'](function(_0x2e4390){logger[_0x4d12('0x11')](_0x4d12('0xd'),_0x367284,_0x2e4390);_0x21f2ff(_0x2e4390);});});} \ No newline at end of file +var _0x7b0d=['rpc','../../config/environment','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserChatQueue,\x20%s,\x20%s','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1e7ead,_0x7f6227){var _0x3912b2=function(_0x1eeb03){while(--_0x1eeb03){_0x1e7ead['push'](_0x1e7ead['shift']());}};_0x3912b2(++_0x7f6227);}(_0x7b0d,0x1c8));var _0xd7b0=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7b0d[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require(_0xd7b0('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd7b0('0x1'));var fs=require('fs');var Redis=require(_0xd7b0('0x2'));var db=require(_0xd7b0('0x3'))['db'];var utils=require(_0xd7b0('0x4'));var logger=require(_0xd7b0('0x5'))(_0xd7b0('0x6'));var config=require(_0xd7b0('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd7b0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe9cdea,_0x240c83,_0x53fdb0){return new BPromise(function(_0x48e7e0,_0x1fc9a7){return client[_0xd7b0('0x9')](_0xe9cdea,_0x53fdb0)[_0xd7b0('0xa')](function(_0x46bde8){logger[_0xd7b0('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x240c83,_0xd7b0('0xc'));logger[_0xd7b0('0xd')](_0xd7b0('0xe'),_0x240c83,_0xd7b0('0xc'),JSON[_0xd7b0('0xf')](_0x46bde8));if(_0x46bde8[_0xd7b0('0x10')]){if(_0x46bde8[_0xd7b0('0x10')][_0xd7b0('0x11')]===0x1f4){logger[_0xd7b0('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x240c83,_0x46bde8[_0xd7b0('0x10')][_0xd7b0('0x12')]);return _0x1fc9a7(_0x46bde8[_0xd7b0('0x10')]['message']);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x240c83,_0x46bde8['error']['message']);return _0x48e7e0(_0x46bde8[_0xd7b0('0x10')][_0xd7b0('0x12')]);}else{logger[_0xd7b0('0xb')](_0xd7b0('0x13'),_0x240c83,_0xd7b0('0xc'));_0x48e7e0(_0x46bde8['result']['message']);}})[_0xd7b0('0x14')](function(_0xcf9050){logger['error'](_0xd7b0('0x13'),_0x240c83,_0xcf9050);_0x1fc9a7(_0xcf9050);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index a0e0ea8..fc9f0ab 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(_0x36f2b2,_0x4dea08){var _0x4a0f99=function(_0x5442b9){while(--_0x5442b9){_0x36f2b2['push'](_0x36f2b2['shift']());}};_0x4a0f99(++_0x4dea08);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2629a2,_0xc206c9){var _0x199803=function(_0x248e5e){while(--_0x248e5e){_0x2629a2['push'](_0x2629a2['shift']());}};_0x199803(++_0xc206c9);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index f116344..706b73a 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 _0x07ae=['STRING','sequelize','exports','INTEGER'];(function(_0x57cc3f,_0x5da014){var _0xa3008c=function(_0x18b703){while(--_0x18b703){_0x57cc3f['push'](_0x57cc3f['shift']());}};_0xa3008c(++_0x5da014);}(_0x07ae,0xd9));var _0xe07a=function(_0x10c317,_0x36f012){_0x10c317=_0x10c317-0x0;var _0x556cb4=_0x07ae[_0x10c317];return _0x556cb4;};'use strict';var Sequelize=require(_0xe07a('0x0'));module[_0xe07a('0x1')]={'penalty':{'type':Sequelize[_0xe07a('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe07a('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xe07a('0x3')]}}; \ No newline at end of file +var _0x6ee8=['STRING','sequelize','exports','INTEGER'];(function(_0x5bc2b2,_0x1687cc){var _0x1e8a2d=function(_0x597806){while(--_0x597806){_0x5bc2b2['push'](_0x5bc2b2['shift']());}};_0x1e8a2d(++_0x1687cc);}(_0x6ee8,0x185));var _0x86ee=function(_0x2212d5,_0x375e95){_0x2212d5=_0x2212d5-0x0;var _0x407ca9=_0x6ee8[_0x2212d5];return _0x407ca9;};'use strict';var Sequelize=require(_0x86ee('0x0'));module[_0x86ee('0x1')]={'penalty':{'type':Sequelize[_0x86ee('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x86ee('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x86ee('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index b1a633e..1aca247 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 _0xc4ba=['user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./userFaxQueue.attributes','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc4ba,0xd9));var _0xac4b=function(_0x3f54e1,_0x2aac41){_0x3f54e1=_0x3f54e1-0x0;var _0x5a0d29=_0xc4ba[_0x3f54e1];return _0x5a0d29;};'use strict';var _=require(_0xac4b('0x0'));var util=require(_0xac4b('0x1'));var logger=require(_0xac4b('0x2'))(_0xac4b('0x3'));var moment=require(_0xac4b('0x4'));var BPromise=require(_0xac4b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac4b('0x6'));var rimraf=require(_0xac4b('0x7'));var config=require('../../config/environment');var attributes=require(_0xac4b('0x8'));module[_0xac4b('0x9')]=function(_0x5d3cb4,_0x306446){return _0x5d3cb4[_0xac4b('0xa')]('UserFaxQueue',attributes,{'tableName':_0xac4b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9de5=['user_has_fax_queues','api','moment','bluebird','rimraf','../../config/environment','define','UserFaxQueue'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x9de5,0x131));var _0x59de=function(_0x1824b7,_0x2346e3){_0x1824b7=_0x1824b7-0x0;var _0x574ace=_0x9de5[_0x1824b7];return _0x574ace;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x59de('0x0'));var moment=require(_0x59de('0x1'));var BPromise=require(_0x59de('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x59de('0x3'));var config=require(_0x59de('0x4'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x396370,_0x14592d){return _0x396370[_0x59de('0x5')](_0x59de('0x6'),attributes,{'tableName':_0x59de('0x7'),'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 305fd5b..d2f9552 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 _0x9bf0=['client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x40b981,_0x4e835e){var _0x24f9ee=function(_0x493484){while(--_0x493484){_0x40b981['push'](_0x40b981['shift']());}};_0x24f9ee(++_0x4e835e);}(_0x9bf0,0xc5));var _0x09bf=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x9bf0[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x09bf('0x0'));var util=require(_0x09bf('0x1'));var moment=require(_0x09bf('0x2'));var BPromise=require(_0x09bf('0x3'));var rs=require(_0x09bf('0x4'));var fs=require('fs');var Redis=require(_0x09bf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x09bf('0x6'));var logger=require(_0x09bf('0x7'))(_0x09bf('0x8'));var config=require(_0x09bf('0x9'));var jayson=require(_0x09bf('0xa'));var client=jayson[_0x09bf('0xb')][_0x09bf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15fb41,_0x204b53,_0x3b766c){return new BPromise(function(_0x413d67,_0x57959e){return client[_0x09bf('0xd')](_0x15fb41,_0x3b766c)[_0x09bf('0xe')](function(_0x22d052){logger[_0x09bf('0xf')](_0x09bf('0x10'),_0x204b53,_0x09bf('0x11'));logger[_0x09bf('0x12')](_0x09bf('0x13'),_0x204b53,_0x09bf('0x11'),JSON[_0x09bf('0x14')](_0x22d052));if(_0x22d052[_0x09bf('0x15')]){if(_0x22d052[_0x09bf('0x15')][_0x09bf('0x16')]===0x1f4){logger[_0x09bf('0x15')](_0x09bf('0x10'),_0x204b53,_0x22d052[_0x09bf('0x15')]['message']);return _0x57959e(_0x22d052['error']['message']);}logger['error'](_0x09bf('0x10'),_0x204b53,_0x22d052[_0x09bf('0x15')]['message']);return _0x413d67(_0x22d052[_0x09bf('0x15')][_0x09bf('0x17')]);}else{logger[_0x09bf('0xf')](_0x09bf('0x10'),_0x204b53,_0x09bf('0x11'));_0x413d67(_0x22d052[_0x09bf('0x18')][_0x09bf('0x17')]);}})[_0x09bf('0x19')](function(_0x495e70){logger[_0x09bf('0x15')](_0x09bf('0x10'),_0x204b53,_0x495e70);_0x57959e(_0x495e70);});});} \ No newline at end of file +var _0xe845=['code','message','UserFaxQueue,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe845,0x12a));var _0x5e84=function(_0x1ac60f,_0x54ef30){_0x1ac60f=_0x1ac60f-0x0;var _0x449b2e=_0xe845[_0x1ac60f];return _0x449b2e;};'use strict';var _=require(_0x5e84('0x0'));var util=require(_0x5e84('0x1'));var moment=require(_0x5e84('0x2'));var BPromise=require(_0x5e84('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e84('0x4'));var db=require(_0x5e84('0x5'))['db'];var utils=require(_0x5e84('0x6'));var logger=require(_0x5e84('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5e84('0x8')][_0x5e84('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x380b1a,_0xef117d,_0x6f52eb){return new BPromise(function(_0x5b953e,_0x45ba2b){return client['request'](_0x380b1a,_0x6f52eb)[_0x5e84('0xa')](function(_0x592261){logger[_0x5e84('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0xef117d,'request\x20sent');logger[_0x5e84('0xc')](_0x5e84('0xd'),_0xef117d,_0x5e84('0xe'),JSON[_0x5e84('0xf')](_0x592261));if(_0x592261[_0x5e84('0x10')]){if(_0x592261['error'][_0x5e84('0x11')]===0x1f4){logger[_0x5e84('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0xef117d,_0x592261[_0x5e84('0x10')][_0x5e84('0x12')]);return _0x45ba2b(_0x592261[_0x5e84('0x10')][_0x5e84('0x12')]);}logger['error'](_0x5e84('0x13'),_0xef117d,_0x592261[_0x5e84('0x10')][_0x5e84('0x12')]);return _0x5b953e(_0x592261[_0x5e84('0x10')][_0x5e84('0x12')]);}else{logger[_0x5e84('0xb')](_0x5e84('0x13'),_0xef117d,_0x5e84('0xe'));_0x5b953e(_0x592261[_0x5e84('0x14')]['message']);}})['catch'](function(_0x104020){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0xef117d,_0x104020);_0x45ba2b(_0x104020);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 452a01e..c9b15be 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x47eaa6,_0x4d264d){var _0x3e38ba=function(_0x3d66ad){while(--_0x3d66ad){_0x47eaa6['push'](_0x47eaa6['shift']());}};_0x3e38ba(++_0x4d264d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1ea5e2,_0x382cec){var _0x39380c=function(_0x27893b){while(--_0x27893b){_0x1ea5e2['push'](_0x1ea5e2['shift']());}};_0x39380c(++_0x382cec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index c9ebe29..e330e41 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 _0xb33d=['sequelize','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb33d,0x72));var _0xdb33=function(_0x18af13,_0x1a0693){_0x18af13=_0x18af13-0x0;var _0x37a567=_0xb33d[_0x18af13];return _0x37a567;};'use strict';var Sequelize=require(_0xdb33('0x0'));module[_0xdb33('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5a44=['exports'];(function(_0x214b8a,_0x4684e2){var _0x29729c=function(_0x21b69c){while(--_0x21b69c){_0x214b8a['push'](_0x214b8a['shift']());}};_0x29729c(++_0x4684e2);}(_0x5a44,0xdd));var _0x45a4=function(_0x4a5261,_0xd5582f){_0x4a5261=_0x4a5261-0x0;var _0x191590=_0x5a44[_0x4a5261];return _0x191590;};'use strict';var Sequelize=require('sequelize');module[_0x45a4('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 8713959..faad0a8 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 _0x88d4=['util','api','moment','request-promise','rimraf','../../config/environment','define','UserMailQueue','lodash'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x88d4,0x143));var _0x488d=function(_0x1540ce,_0x1814b0){_0x1540ce=_0x1540ce-0x0;var _0x1b6e26=_0x88d4[_0x1540ce];return _0x1b6e26;};'use strict';var _=require(_0x488d('0x0'));var util=require(_0x488d('0x1'));var logger=require('../../config/logger')(_0x488d('0x2'));var moment=require(_0x488d('0x3'));var BPromise=require('bluebird');var rp=require(_0x488d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x488d('0x5'));var config=require(_0x488d('0x6'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x1e7a51,_0x23d432){return _0x1e7a51[_0x488d('0x7')](_0x488d('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5323=['bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','lodash','util','../../config/logger','moment'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x5323,0xf8));var _0x3532=function(_0x578957,_0x3045f9){_0x578957=_0x578957-0x0;var _0x246d93=_0x5323[_0x578957];return _0x246d93;};'use strict';var _=require(_0x3532('0x0'));var util=require(_0x3532('0x1'));var logger=require(_0x3532('0x2'))('api');var moment=require(_0x3532('0x3'));var BPromise=require(_0x3532('0x4'));var rp=require(_0x3532('0x5'));var fs=require('fs');var path=require(_0x3532('0x6'));var rimraf=require(_0x3532('0x7'));var config=require(_0x3532('0x8'));var attributes=require(_0x3532('0x9'));module[_0x3532('0xa')]=function(_0x469630,_0x1dcf5d){return _0x469630['define'](_0x3532('0xb'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 1796a7a..669f3dd 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 _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3f749f,_0x110493){var _0x179d54=function(_0x53767d){while(--_0x53767d){_0x3f749f['push'](_0x3f749f['shift']());}};_0x179d54(++_0x110493);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x17b287,_0x4bed1c){_0x17b287=_0x17b287-0x0;var _0x177054=_0x7fbe[_0x17b287];return _0x177054;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4c8ad1,_0x1b3e74){var _0x162fad=function(_0x153bc0){while(--_0x153bc0){_0x4c8ad1['push'](_0x4c8ad1['shift']());}};_0x162fad(++_0x1b3e74);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x59dc02,_0x120477){_0x59dc02=_0x59dc02-0x0;var _0x556178=_0x7fbe[_0x59dc02];return _0x556178;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index ec8ddc1..89387d7 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 _0x9974=['../../config/environment','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2a1e27,_0x4b3603){var _0x369b9f=function(_0x46e93b){while(--_0x46e93b){_0x2a1e27['push'](_0x2a1e27['shift']());}};_0x369b9f(++_0x4b3603);}(_0x9974,0x157));var _0x4997=function(_0x1844ee,_0x2b3651){_0x1844ee=_0x1844ee-0x0;var _0x3acb93=_0x9974[_0x1844ee];return _0x3acb93;};'use strict';var multer=require(_0x4997('0x0'));var util=require('util');var path=require(_0x4997('0x1'));var timeout=require(_0x4997('0x2'));var express=require(_0x4997('0x3'));var router=express[_0x4997('0x4')]();var fs_extra=require(_0x4997('0x5'));var auth=require(_0x4997('0x6'));var interaction=require(_0x4997('0x7'));var config=require(_0x4997('0x8'));var controller=require('./userNotification.controller');router['post']('/',auth['isAuthenticated'](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0xad70=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./userNotification.controller','isAuthenticated','sendUserNotification','exports'];(function(_0xae29a9,_0x35230d){var _0x2edab8=function(_0x3a213e){while(--_0x3a213e){_0xae29a9['push'](_0xae29a9['shift']());}};_0x2edab8(++_0x35230d);}(_0xad70,0xfd));var _0x0ad7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad70[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0ad7('0x0'));var util=require(_0x0ad7('0x1'));var path=require(_0x0ad7('0x2'));var timeout=require(_0x0ad7('0x3'));var express=require(_0x0ad7('0x4'));var router=express[_0x0ad7('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0ad7('0x6'));var config=require('../../config/environment');var controller=require(_0x0ad7('0x7'));router['post']('/',auth[_0x0ad7('0x8')](),controller[_0x0ad7('0x9')]);module[_0x0ad7('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index e1a2cd1..7c0d2d8 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 _0x236b=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x4cd665,_0x44f698){var _0x3b3ab6=function(_0x3646a7){while(--_0x3646a7){_0x4cd665['push'](_0x4cd665['shift']());}};_0x3b3ab6(++_0x44f698);}(_0x236b,0x146));var _0xb236=function(_0x430a77,_0x613e38){_0x430a77=_0x430a77-0x0;var _0x2c19f2=_0x236b[_0x430a77];return _0x2c19f2;};'use strict';var Sequelize=require(_0xb236('0x0'));module[_0xb236('0x1')]={'body':{'type':Sequelize[_0xb236('0x2')]},'senderName':{'type':Sequelize[_0xb236('0x3')]},'recipientsId':{'type':Sequelize[_0xb236('0x2')]},'recipientsDescription':{'type':Sequelize[_0xb236('0x3')]},'beep':{'type':Sequelize[_0xb236('0x4')]}}; \ No newline at end of file +var _0x5cc5=['TEXT','STRING','sequelize','exports'];(function(_0x2127b9,_0x107f97){var _0x442e68=function(_0x909361){while(--_0x909361){_0x2127b9['push'](_0x2127b9['shift']());}};_0x442e68(++_0x107f97);}(_0x5cc5,0x186));var _0x55cc=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x5cc5[_0x725b8e];return _0x43ac45;};'use strict';var Sequelize=require(_0x55cc('0x0'));module[_0x55cc('0x1')]={'body':{'type':Sequelize[_0x55cc('0x2')]},'senderName':{'type':Sequelize[_0x55cc('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x55cc('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 1ad0736..dcdae5c 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 _0xb101=['destroy','error','name','sendUserNotification','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','transaction','UserNotification','create','forEach','recipient','emit','catch','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','toLowerCase','User','union','ids','queue','replace','push','all','findOne','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0xb101,0x95));var _0x1b10=function(_0x359dec,_0x1b6e69){_0x359dec=_0x359dec-0x0;var _0x3c8c12=_0xb101[_0x359dec];return _0x3c8c12;};'use strict';var emlformat=require(_0x1b10('0x0'));var rimraf=require(_0x1b10('0x1'));var zipdir=require(_0x1b10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b10('0x3'));var moment=require(_0x1b10('0x4'));var BPromise=require(_0x1b10('0x5'));var Mustache=require(_0x1b10('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1b10('0x7'));var csv=require(_0x1b10('0x8'));var ejs=require(_0x1b10('0x9'));var fs=require('fs');var fs_extra=require(_0x1b10('0xa'));var _=require(_0x1b10('0xb'));var squel=require(_0x1b10('0xc'));var crypto=require(_0x1b10('0xd'));var jsforce=require(_0x1b10('0xe'));var deskjs=require(_0x1b10('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1b10('0x10'));var Papa=require('papaparse');var Redis=require(_0x1b10('0x11'));var authService=require(_0x1b10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b10('0x13'));var logger=require('../../config/logger')(_0x1b10('0x14'));var utils=require(_0x1b10('0x15'));var config=require(_0x1b10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b10('0x17'))['db'];config[_0x1b10('0x18')]=_['defaults'](config[_0x1b10('0x18')],{'host':_0x1b10('0x19'),'port':0x18eb});var socket=require(_0x1b10('0x1a'))(new Redis(config[_0x1b10('0x18')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x9c3945,_0x4497da){_0x4497da=_0x4497da||0xcc;return function(_0x3cbde0){if(_0x3cbde0){return _0x9c3945[_0x1b10('0x1b')](_0x4497da);}return _0x9c3945[_0x1b10('0x1c')](_0x4497da)[_0x1b10('0x1d')]();};}function respondWithResult(_0x454601,_0x4e91c6){_0x4e91c6=_0x4e91c6||0xc8;return function(_0x15af5e){if(_0x15af5e){return _0x454601[_0x1b10('0x1c')](_0x4e91c6)['json'](_0x15af5e);}};}function respondWithFilteredResult(_0x5cdaea,_0x36a891){return function(_0x2f134c){if(_0x2f134c){var _0x3cc4f7=typeof _0x36a891[_0x1b10('0x1e')]===_0x1b10('0x1f')&&typeof _0x36a891['limit']==='undefined';var _0x1c68d5=_0x2f134c[_0x1b10('0x20')];var _0x433072=_0x3cc4f7?0x0:_0x36a891[_0x1b10('0x1e')];var _0x1b8ed4=_0x3cc4f7?_0x2f134c[_0x1b10('0x20')]:_0x36a891[_0x1b10('0x1e')]+_0x36a891[_0x1b10('0x21')];var _0x327a16;if(_0x1b8ed4>=_0x1c68d5){_0x1b8ed4=_0x1c68d5;_0x327a16=0xc8;}else{_0x327a16=0xce;}_0x5cdaea[_0x1b10('0x1c')](_0x327a16);return _0x5cdaea[_0x1b10('0x22')](_0x1b10('0x23'),_0x433072+'-'+_0x1b8ed4+'/'+_0x1c68d5)[_0x1b10('0x24')](_0x2f134c);}return null;};}function patchUpdates(_0x123bf5){return function(_0x40dd43){try{jsonpatch[_0x1b10('0x25')](_0x40dd43,_0x123bf5,!![]);}catch(_0x24134e){return BPromise[_0x1b10('0x26')](_0x24134e);}return _0x40dd43['save']();};}function saveUpdates(_0x549f62,_0x361490){return function(_0x553140){if(_0x553140){return _0x553140[_0x1b10('0x27')](_0x549f62)[_0x1b10('0x28')](function(_0x549b1d){return _0x549b1d;});}return null;};}function removeEntity(_0x2f5456,_0x23f1d2){return function(_0x5aaa5a){if(_0x5aaa5a){return _0x5aaa5a[_0x1b10('0x29')]()[_0x1b10('0x28')](function(){_0x2f5456[_0x1b10('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x602d9f,_0x8e8137){return function(_0x3a53b6){if(!_0x3a53b6){_0x602d9f[_0x1b10('0x1b')](0x194);}return _0x3a53b6;};}function handleError(_0x7b1560,_0x8614a0){_0x8614a0=_0x8614a0||0x1f4;return function(_0x1abf76){logger[_0x1b10('0x2a')](_0x1abf76['stack']);if(_0x1abf76[_0x1b10('0x2b')]){delete _0x1abf76[_0x1b10('0x2b')];}_0x7b1560['status'](_0x8614a0)['send'](_0x1abf76);};}exports[_0x1b10('0x2c')]=function(_0x32fdc6,_0x3187e6,_0x5b84f7){if(!_0x32fdc6['body'][_0x1b10('0x2d')](_0x1b10('0x2e'))&&!_0x32fdc6['body'][_0x1b10('0x2d')](_0x1b10('0x2f'))){throw new db[(_0x1b10('0x30'))][(_0x1b10('0x31'))](_0x1b10('0x32'));}else{if(_0x32fdc6[_0x1b10('0x33')][_0x1b10('0x2d')](_0x1b10('0x2f'))&&!_0x32fdc6[_0x1b10('0x33')][_0x1b10('0x2d')](_0x1b10('0x34'))){throw new db[(_0x1b10('0x30'))][(_0x1b10('0x31'))](_0x1b10('0x35'));}if(!_0x32fdc6[_0x1b10('0x33')][_0x1b10('0x2d')](_0x1b10('0x36'))){throw new db[(_0x1b10('0x30'))][(_0x1b10('0x31'))](_0x1b10('0x37'));}else{try{var _0x1dd174=JSON['parse'](_0x32fdc6[_0x1b10('0x33')]['recipients']);}catch(_0x331020){logger[_0x1b10('0x2a')](_0x331020);throw new db['Sequelize'][(_0x1b10('0x31'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x5bb1dc=['chatqueue','faxqueue',_0x1b10('0x38'),_0x1b10('0x39'),_0x1b10('0x3a'),_0x1b10('0x3b'),_0x1b10('0x3c'),_0x1b10('0x3d'),_0x1b10('0x3e')];if(_['some'](_0x1dd174,function(_0x590bfd){return!_[_0x1b10('0x3f')](_0x5bb1dc,_0x590bfd[_0x1b10('0x40')]['toLowerCase']());})){throw new db[(_0x1b10('0x30'))][(_0x1b10('0x31'))](_0x1b10('0x41'));}}}var _0xf8ae8={};_0xf8ae8[_0x1b10('0x42')]=_0x32fdc6['body'][_0x1b10('0x2d')](_0x1b10('0x42'))?_0x32fdc6[_0x1b10('0x33')][_0x1b10('0x42')]:_0x32fdc6['user'][_0x1b10('0x43')];_0xf8ae8[_0x1b10('0x44')]=_['isEmpty'](_0x32fdc6['body'][_0x1b10('0x44')])?null:_0x32fdc6[_0x1b10('0x33')][_0x1b10('0x44')];_0xf8ae8[_0x1b10('0x45')]=_0x32fdc6['body']['beep']||![];_0xf8ae8[_0x1b10('0x46')]=_0x32fdc6[_0x1b10('0x3e')]['id'];return getContent(_0x32fdc6[_0x1b10('0x33')])[_0x1b10('0x28')](function(_0x3cd002){_0xf8ae8[_0x1b10('0x33')]=_0x3cd002;return getRecipients(_0x1dd174);})[_0x1b10('0x28')](function(_0x2f6347){_0xf8ae8[_0x1b10('0x47')]=_[_0x1b10('0x48')](_0x2f6347)[_0x1b10('0x49')](',');return db['sequelize'][_0x1b10('0x4a')](function(_0x4ce980){return db[_0x1b10('0x4b')][_0x1b10('0x4c')](_0xf8ae8,{'raw':!![],'transaction':_0x4ce980})[_0x1b10('0x28')](function(_0x1e21df){var _0x5590df={'sender':_0xf8ae8['senderName'],'description':_0xf8ae8[_0x1b10('0x44')],'content':_0xf8ae8[_0x1b10('0x33')],'beep':_0xf8ae8[_0x1b10('0x45')]};_0x2f6347[_0x1b10('0x4d')](function(_0x23fd78){_0x5590df[_0x1b10('0x4e')]=_0x23fd78;socket[_0x1b10('0x4f')]('userNotification:send',_0x5590df);});return _0x1e21df;});});})[_0x1b10('0x28')](respondWithResult(_0x3187e6,0xc9))[_0x1b10('0x50')](handleError(_0x3187e6,null));};function getContent(_0x16a9d4){return new BPromise(function(_0x530d87,_0x35ec76){if(_0x16a9d4[_0x1b10('0x2e')]){_0x530d87(_0x16a9d4[_0x1b10('0x2e')]);return;}return db['Template']['findOne']({'attributes':[_0x1b10('0x51')],'where':{'id':_0x16a9d4['TemplateId']},'raw':!![]})[_0x1b10('0x28')](function(_0x11c3b0){if(!_0x11c3b0)throw new db[(_0x1b10('0x30'))][(_0x1b10('0x31'))](_0x1b10('0x52'));var _0x4b584a=Mustache[_0x1b10('0x53')](_0x11c3b0[_0x1b10('0x51')],_0x16a9d4['view']);_0x530d87(_0x4b584a);})['catch'](function(_0x333bfe){_0x35ec76(_0x333bfe);});});}function getRecipients(_0x1a4e3a){return new BPromise(function(_0x3760d5,_0x3c6de9){var _0x1115b7=[];var _0x289249=[];_0x1a4e3a['forEach'](function(_0x21d8b0){var _0x5bb92d=_['startCase'](_0x21d8b0[_0x1b10('0x40')][_0x1b10('0x54')]());if(_0x5bb92d===_0x1b10('0x55')){_0x1115b7=_[_0x1b10('0x56')](_0x1115b7,_0x21d8b0[_0x1b10('0x57')]);}else{if(_['includes'](_0x5bb92d,_0x1b10('0x58')))_0x5bb92d=_0x5bb92d[_0x1b10('0x59')]('queue','Queue');_0x21d8b0[_0x1b10('0x57')][_0x1b10('0x4d')](function(_0x5ec203){_0x289249[_0x1b10('0x5a')](getAgents(_0x5bb92d,_0x5ec203));});}});return BPromise[_0x1b10('0x5b')](_0x289249)[_0x1b10('0x28')](function(_0x20a740){_0x1115b7=_[_0x1b10('0x56')](_0x1115b7,_['flatten'](_0x20a740));_0x3760d5(_0x1115b7);})[_0x1b10('0x50')](function(_0x8d4f92){_0x3c6de9(_0x8d4f92);});});}function getAgents(_0x3ac750,_0x5d54a6){return new BPromise(function(_0x44e8b5,_0x207e7c){return db[_0x3ac750][_0x1b10('0x5c')]({'where':{'id':_0x5d54a6}})['then'](function(_0x554b20){return _0x554b20[_0x1b10('0x5d')]({'attributes':['id'],'raw':!![]})[_0x1b10('0x28')](function(_0xf68793){var _0x1325f2=_[_0x1b10('0x5e')](_0xf68793,'id');_0x44e8b5(_0x1325f2);});})[_0x1b10('0x50')](function(_0x30c401){_0x207e7c(_0x30c401);});});} \ No newline at end of file +var _0xf8c6=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','then','destroy','error','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','userNotification:send','catch','Template','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','model','User','ids','queue','replace','Queue','push','all','union','flatten','findOne','getAgents','map','eml-format'];(function(_0x171884,_0x6684db){var _0x5d5c1b=function(_0x42dca1){while(--_0x42dca1){_0x171884['push'](_0x171884['shift']());}};_0x5d5c1b(++_0x6684db);}(_0xf8c6,0xcb));var _0x6f8c=function(_0x3c7680,_0x1155b9){_0x3c7680=_0x3c7680-0x0;var _0x4f3f96=_0xf8c6[_0x3c7680];return _0x4f3f96;};'use strict';var emlformat=require(_0x6f8c('0x0'));var rimraf=require(_0x6f8c('0x1'));var zipdir=require(_0x6f8c('0x2'));var jsonpatch=require(_0x6f8c('0x3'));var rp=require(_0x6f8c('0x4'));var moment=require(_0x6f8c('0x5'));var BPromise=require(_0x6f8c('0x6'));var Mustache=require('mustache');var util=require(_0x6f8c('0x7'));var path=require(_0x6f8c('0x8'));var sox=require(_0x6f8c('0x9'));var csv=require(_0x6f8c('0xa'));var ejs=require(_0x6f8c('0xb'));var fs=require('fs');var fs_extra=require(_0x6f8c('0xc'));var _=require('lodash');var squel=require(_0x6f8c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6f8c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6f8c('0xf'));var Papa=require('papaparse');var Redis=require(_0x6f8c('0x10'));var authService=require(_0x6f8c('0x11'));var qs=require(_0x6f8c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f8c('0x13'));var logger=require('../../config/logger')(_0x6f8c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6f8c('0x15'));var db=require(_0x6f8c('0x16'))['db'];config[_0x6f8c('0x17')]=_[_0x6f8c('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6f8c('0x19'))(new Redis(config[_0x6f8c('0x17')]));require(_0x6f8c('0x1a'))[_0x6f8c('0x1b')](socket);function respondWithStatusCode(_0x2b83c1,_0x27f86c){_0x27f86c=_0x27f86c||0xcc;return function(_0xfa9b43){if(_0xfa9b43){return _0x2b83c1[_0x6f8c('0x1c')](_0x27f86c);}return _0x2b83c1['status'](_0x27f86c)[_0x6f8c('0x1d')]();};}function respondWithResult(_0x56cdf0,_0x57872e){_0x57872e=_0x57872e||0xc8;return function(_0x1b08d2){if(_0x1b08d2){return _0x56cdf0['status'](_0x57872e)[_0x6f8c('0x1e')](_0x1b08d2);}};}function respondWithFilteredResult(_0x7f9ecc,_0x340685){return function(_0x2c8bc4){if(_0x2c8bc4){var _0x4cb306=typeof _0x340685[_0x6f8c('0x1f')]===_0x6f8c('0x20')&&typeof _0x340685[_0x6f8c('0x21')]==='undefined';var _0xe632aa=_0x2c8bc4[_0x6f8c('0x22')];var _0x2d8ebe=_0x4cb306?0x0:_0x340685[_0x6f8c('0x1f')];var _0x21f2a9=_0x4cb306?_0x2c8bc4[_0x6f8c('0x22')]:_0x340685['offset']+_0x340685['limit'];var _0x11b1fb;if(_0x21f2a9>=_0xe632aa){_0x21f2a9=_0xe632aa;_0x11b1fb=0xc8;}else{_0x11b1fb=0xce;}_0x7f9ecc[_0x6f8c('0x23')](_0x11b1fb);return _0x7f9ecc[_0x6f8c('0x24')](_0x6f8c('0x25'),_0x2d8ebe+'-'+_0x21f2a9+'/'+_0xe632aa)[_0x6f8c('0x1e')](_0x2c8bc4);}return null;};}function patchUpdates(_0x5eca04){return function(_0x87bea4){try{jsonpatch[_0x6f8c('0x26')](_0x87bea4,_0x5eca04,!![]);}catch(_0x7bfc0e){return BPromise['reject'](_0x7bfc0e);}return _0x87bea4[_0x6f8c('0x27')]();};}function saveUpdates(_0x3556c7,_0x56dbe8){return function(_0x2e5647){if(_0x2e5647){return _0x2e5647['update'](_0x3556c7)[_0x6f8c('0x28')](function(_0x4344f0){return _0x4344f0;});}return null;};}function removeEntity(_0x2c585a,_0x18de53){return function(_0xf3f9d9){if(_0xf3f9d9){return _0xf3f9d9[_0x6f8c('0x29')]()['then'](function(){_0x2c585a[_0x6f8c('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cad51,_0x292b10){return function(_0x183b25){if(!_0x183b25){_0x2cad51[_0x6f8c('0x1c')](0x194);}return _0x183b25;};}function handleError(_0x146aff,_0x157630){_0x157630=_0x157630||0x1f4;return function(_0x366195){logger[_0x6f8c('0x2a')](_0x366195['stack']);if(_0x366195[_0x6f8c('0x2b')]){delete _0x366195['name'];}_0x146aff['status'](_0x157630)['send'](_0x366195);};}exports[_0x6f8c('0x2c')]=function(_0x4215fd,_0x300c2b,_0x250bd1){if(!_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x2e')](_0x6f8c('0x2f'))&&!_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x2e')](_0x6f8c('0x30'))){throw new db['Sequelize'][(_0x6f8c('0x31'))](_0x6f8c('0x32'));}else{if(_0x4215fd['body']['hasOwnProperty'](_0x6f8c('0x30'))&&!_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x2e')](_0x6f8c('0x33'))){throw new db[(_0x6f8c('0x34'))][(_0x6f8c('0x31'))](_0x6f8c('0x35'));}if(!_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x2e')](_0x6f8c('0x36'))){throw new db[(_0x6f8c('0x34'))]['ValidationError'](_0x6f8c('0x37'));}else{try{var _0x5105e8=JSON[_0x6f8c('0x38')](_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x36')]);}catch(_0x22c689){logger[_0x6f8c('0x2a')](_0x22c689);throw new db['Sequelize']['ValidationError'](_0x6f8c('0x39'));}var _0x2cf795=[_0x6f8c('0x3a'),'faxqueue',_0x6f8c('0x3b'),_0x6f8c('0x3c'),_0x6f8c('0x3d'),_0x6f8c('0x3e'),'whatsappqueue',_0x6f8c('0x3f'),_0x6f8c('0x40')];if(_['some'](_0x5105e8,function(_0x151707){return!_[_0x6f8c('0x41')](_0x2cf795,_0x151707['model'][_0x6f8c('0x42')]());})){throw new db['Sequelize'][(_0x6f8c('0x31'))](_0x6f8c('0x43'));}}}var _0x1ac3df={};_0x1ac3df[_0x6f8c('0x44')]=_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x2e')]('senderName')?_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x44')]:_0x4215fd[_0x6f8c('0x40')]['fullname'];_0x1ac3df[_0x6f8c('0x45')]=_[_0x6f8c('0x46')](_0x4215fd[_0x6f8c('0x2d')]['recipientsDescription'])?null:_0x4215fd[_0x6f8c('0x2d')][_0x6f8c('0x45')];_0x1ac3df[_0x6f8c('0x47')]=_0x4215fd[_0x6f8c('0x2d')]['beep']||![];_0x1ac3df[_0x6f8c('0x48')]=_0x4215fd[_0x6f8c('0x40')]['id'];return getContent(_0x4215fd['body'])[_0x6f8c('0x28')](function(_0xe06fc1){_0x1ac3df[_0x6f8c('0x2d')]=_0xe06fc1;return getRecipients(_0x5105e8);})['then'](function(_0x546de8){_0x1ac3df[_0x6f8c('0x49')]=_[_0x6f8c('0x4a')](_0x546de8)[_0x6f8c('0x4b')](',');return db[_0x6f8c('0x4c')][_0x6f8c('0x4d')](function(_0x9fdf3){return db['UserNotification'][_0x6f8c('0x4e')](_0x1ac3df,{'raw':!![],'transaction':_0x9fdf3})[_0x6f8c('0x28')](function(_0x9846fb){var _0x5963b7={'sender':_0x1ac3df['senderName'],'description':_0x1ac3df[_0x6f8c('0x45')],'content':_0x1ac3df[_0x6f8c('0x2d')],'beep':_0x1ac3df[_0x6f8c('0x47')]};_0x546de8[_0x6f8c('0x4f')](function(_0x35e4b5){_0x5963b7[_0x6f8c('0x50')]=_0x35e4b5;socket[_0x6f8c('0x51')](_0x6f8c('0x52'),_0x5963b7);});return _0x9846fb;});});})[_0x6f8c('0x28')](respondWithResult(_0x300c2b,0xc9))[_0x6f8c('0x53')](handleError(_0x300c2b,null));};function getContent(_0x224f34){return new BPromise(function(_0x3e13e8,_0x521cbd){if(_0x224f34[_0x6f8c('0x2f')]){_0x3e13e8(_0x224f34[_0x6f8c('0x2f')]);return;}return db[_0x6f8c('0x54')]['findOne']({'attributes':['html'],'where':{'id':_0x224f34[_0x6f8c('0x30')]},'raw':!![]})[_0x6f8c('0x28')](function(_0x25bb7d){if(!_0x25bb7d)throw new db[(_0x6f8c('0x34'))][(_0x6f8c('0x31'))](_0x6f8c('0x55'));var _0x5e4559=Mustache[_0x6f8c('0x56')](_0x25bb7d[_0x6f8c('0x57')],_0x224f34[_0x6f8c('0x33')]);_0x3e13e8(_0x5e4559);})[_0x6f8c('0x53')](function(_0x4844a3){_0x521cbd(_0x4844a3);});});}function getRecipients(_0x3ae68f){return new BPromise(function(_0x5ca169,_0x4d57b4){var _0x304401=[];var _0x228888=[];_0x3ae68f[_0x6f8c('0x4f')](function(_0x1e7488){var _0x5a5dfb=_[_0x6f8c('0x58')](_0x1e7488[_0x6f8c('0x59')][_0x6f8c('0x42')]());if(_0x5a5dfb===_0x6f8c('0x5a')){_0x304401=_['union'](_0x304401,_0x1e7488[_0x6f8c('0x5b')]);}else{if(_[_0x6f8c('0x41')](_0x5a5dfb,_0x6f8c('0x5c')))_0x5a5dfb=_0x5a5dfb[_0x6f8c('0x5d')]('queue',_0x6f8c('0x5e'));_0x1e7488[_0x6f8c('0x5b')][_0x6f8c('0x4f')](function(_0x378884){_0x228888[_0x6f8c('0x5f')](getAgents(_0x5a5dfb,_0x378884));});}});return BPromise[_0x6f8c('0x60')](_0x228888)[_0x6f8c('0x28')](function(_0x4d0754){_0x304401=_[_0x6f8c('0x61')](_0x304401,_[_0x6f8c('0x62')](_0x4d0754));_0x5ca169(_0x304401);})['catch'](function(_0x3f0017){_0x4d57b4(_0x3f0017);});});}function getAgents(_0x142ae3,_0x3fba4f){return new BPromise(function(_0x3b97dd,_0x561330){return db[_0x142ae3][_0x6f8c('0x63')]({'where':{'id':_0x3fba4f}})[_0x6f8c('0x28')](function(_0x538be3){return _0x538be3[_0x6f8c('0x64')]({'attributes':['id'],'raw':!![]})[_0x6f8c('0x28')](function(_0x5b3cc5){var _0x552647=_[_0x6f8c('0x65')](_0x5b3cc5,'id');_0x3b97dd(_0x552647);});})[_0x6f8c('0x53')](function(_0x4ba1ea){_0x561330(_0x4ba1ea);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 6c79454..a327b57 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 _0x1437=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2ceba7,_0x451ce4){var _0x5348eb=function(_0x3596fc){while(--_0x3596fc){_0x2ceba7['push'](_0x2ceba7['shift']());}};_0x5348eb(++_0x451ce4);}(_0x1437,0x16a));var _0x7143=function(_0x5c3df3,_0x3a87bf){_0x5c3df3=_0x5c3df3-0x0;var _0x30154e=_0x1437[_0x5c3df3];return _0x30154e;};'use strict';var EventEmitter=require(_0x7143('0x0'));var UserNotification=require(_0x7143('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x7143('0x2')](0x0);var events={'afterCreate':_0x7143('0x3'),'afterUpdate':_0x7143('0x4'),'afterDestroy':'remove'};function emitEvent(_0x485347){return function(_0x3fc626,_0x3f6420,_0xd47c7){UserNotificationEvents[_0x7143('0x5')](_0x485347+':'+_0x3fc626['id'],_0x3fc626);UserNotificationEvents[_0x7143('0x5')](_0x485347,_0x3fc626);_0xd47c7(null);};}for(var e in events){if(events[_0x7143('0x6')](e)){var event=events[e];UserNotification[_0x7143('0x7')](e,emitEvent(event));}}module[_0x7143('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xf419=['emit','exports','../../mysqldb','UserNotification','setMaxListeners','save'];(function(_0x3f121a,_0x140b43){var _0x20fc0f=function(_0x4bf18d){while(--_0x4bf18d){_0x3f121a['push'](_0x3f121a['shift']());}};_0x20fc0f(++_0x140b43);}(_0xf419,0x19a));var _0x9f41=function(_0xf00981,_0x5f0153){_0xf00981=_0xf00981-0x0;var _0x7bd842=_0xf419[_0xf00981];return _0x7bd842;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x9f41('0x0'))['db'][_0x9f41('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9f41('0x2')](0x0);var events={'afterCreate':_0x9f41('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x17e858){return function(_0x45492b,_0x5400bf,_0x5ac5ac){UserNotificationEvents['emit'](_0x17e858+':'+_0x45492b['id'],_0x45492b);UserNotificationEvents[_0x9f41('0x4')](_0x17e858,_0x45492b);_0x5ac5ac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x9f41('0x5')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 596869f..2d309b2 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 _0x3a49=['userNotifications','utf8mb4_unicode_ci','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2b6854,_0xf09496){var _0x3a17df=function(_0x580a7a){while(--_0x580a7a){_0x2b6854['push'](_0x2b6854['shift']());}};_0x3a17df(++_0xf09496);}(_0x3a49,0x1a0));var _0x93a4=function(_0x1b6a0f,_0x54ee7){_0x1b6a0f=_0x1b6a0f-0x0;var _0x62078f=_0x3a49[_0x1b6a0f];return _0x62078f;};'use strict';var _=require(_0x93a4('0x0'));var util=require(_0x93a4('0x1'));var logger=require('../../config/logger')(_0x93a4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x93a4('0x3'));var fs=require('fs');var path=require(_0x93a4('0x4'));var rimraf=require(_0x93a4('0x5'));var config=require(_0x93a4('0x6'));var attributes=require('./userNotification.attributes');module['exports']=function(_0xa57d1d,_0x430edb){return _0xa57d1d['define']('UserNotification',attributes,{'tableName':_0x93a4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x93a4('0x8')});}; \ No newline at end of file +var _0xbd16=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','utf8mb4_unicode_ci','lodash'];(function(_0x365caf,_0x383074){var _0x355070=function(_0x472bb2){while(--_0x472bb2){_0x365caf['push'](_0x365caf['shift']());}};_0x355070(++_0x383074);}(_0xbd16,0x1d8));var _0x6bd1=function(_0x57c3d1,_0x4589d7){_0x57c3d1=_0x57c3d1-0x0;var _0x5180a8=_0xbd16[_0x57c3d1];return _0x5180a8;};'use strict';var _=require(_0x6bd1('0x0'));var util=require(_0x6bd1('0x1'));var logger=require(_0x6bd1('0x2'))(_0x6bd1('0x3'));var moment=require('moment');var BPromise=require(_0x6bd1('0x4'));var rp=require(_0x6bd1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6bd1('0x6'));var config=require(_0x6bd1('0x7'));var attributes=require(_0x6bd1('0x8'));module[_0x6bd1('0x9')]=function(_0x284df4,_0x32ba0e){return _0x284df4['define']('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6bd1('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index b62182a..d4aef6c 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 _0xe7fe=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x149d65,_0x4e029f){var _0x4ae3f6=function(_0x3f0397){while(--_0x3f0397){_0x149d65['push'](_0x149d65['shift']());}};_0x4ae3f6(++_0x4e029f);}(_0xe7fe,0x1ea));var _0xee7f=function(_0x3455bd,_0x1a0fec){_0x3455bd=_0x3455bd-0x0;var _0x3148ce=_0xe7fe[_0x3455bd];return _0x3148ce;};'use strict';var _=require(_0xee7f('0x0'));var util=require(_0xee7f('0x1'));var moment=require(_0xee7f('0x2'));var BPromise=require(_0xee7f('0x3'));var rs=require(_0xee7f('0x4'));var fs=require('fs');var Redis=require(_0xee7f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xee7f('0x6'));var logger=require(_0xee7f('0x7'))('rpc');var config=require(_0xee7f('0x8'));var jayson=require(_0xee7f('0x9'));var client=jayson[_0xee7f('0xa')][_0xee7f('0xb')]({'port':0x232a});config[_0xee7f('0xc')]=_['defaults'](config['redis'],{'host':_0xee7f('0xd'),'port':0x18eb});var socket=require(_0xee7f('0xe'))(new Redis(config[_0xee7f('0xc')]));require(_0xee7f('0xf'))[_0xee7f('0x10')](socket);function respondWithRpcPromise(_0x1addbe,_0x1e7d6a,_0x409508){return new BPromise(function(_0x3c47f7,_0x58fa67){return client['request'](_0x1addbe,_0x409508)['then'](function(_0x136195){logger[_0xee7f('0x11')](_0xee7f('0x12'),_0x1e7d6a,_0xee7f('0x13'));logger[_0xee7f('0x14')](_0xee7f('0x15'),_0x1e7d6a,_0xee7f('0x13'),JSON[_0xee7f('0x16')](_0x136195));if(_0x136195[_0xee7f('0x17')]){if(_0x136195[_0xee7f('0x17')][_0xee7f('0x18')]===0x1f4){logger[_0xee7f('0x17')](_0xee7f('0x12'),_0x1e7d6a,_0x136195[_0xee7f('0x17')]['message']);return _0x58fa67(_0x136195[_0xee7f('0x17')][_0xee7f('0x19')]);}logger['error'](_0xee7f('0x12'),_0x1e7d6a,_0x136195[_0xee7f('0x17')][_0xee7f('0x19')]);return _0x3c47f7(_0x136195['error']['message']);}else{logger[_0xee7f('0x11')](_0xee7f('0x12'),_0x1e7d6a,_0xee7f('0x13'));_0x3c47f7(_0x136195[_0xee7f('0x1a')][_0xee7f('0x19')]);}})['catch'](function(_0x265c22){logger['error'](_0xee7f('0x12'),_0x1e7d6a,_0x265c22);_0x58fa67(_0x265c22);});});} \ No newline at end of file +var _0x984d=['register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x984d,0x7c));var _0xd984=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x984d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd984('0x0'));var util=require(_0xd984('0x1'));var moment=require('moment');var BPromise=require(_0xd984('0x2'));var rs=require(_0xd984('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd984('0x4'))['db'];var utils=require(_0xd984('0x5'));var logger=require(_0xd984('0x6'))(_0xd984('0x7'));var config=require(_0xd984('0x8'));var jayson=require(_0xd984('0x9'));var client=jayson[_0xd984('0xa')]['http']({'port':0x232a});config[_0xd984('0xb')]=_[_0xd984('0xc')](config[_0xd984('0xb')],{'host':_0xd984('0xd'),'port':0x18eb});var socket=require(_0xd984('0xe'))(new Redis(config[_0xd984('0xb')]));require(_0xd984('0xf'))[_0xd984('0x10')](socket);function respondWithRpcPromise(_0x230052,_0x250a6c,_0x1da25c){return new BPromise(function(_0x34a8d9,_0x40ccc8){return client[_0xd984('0x11')](_0x230052,_0x1da25c)[_0xd984('0x12')](function(_0x3c9daa){logger[_0xd984('0x13')](_0xd984('0x14'),_0x250a6c,_0xd984('0x15'));logger[_0xd984('0x16')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x250a6c,_0xd984('0x15'),JSON[_0xd984('0x17')](_0x3c9daa));if(_0x3c9daa[_0xd984('0x18')]){if(_0x3c9daa['error'][_0xd984('0x19')]===0x1f4){logger[_0xd984('0x18')](_0xd984('0x14'),_0x250a6c,_0x3c9daa[_0xd984('0x18')]['message']);return _0x40ccc8(_0x3c9daa[_0xd984('0x18')][_0xd984('0x1a')]);}logger[_0xd984('0x18')](_0xd984('0x14'),_0x250a6c,_0x3c9daa[_0xd984('0x18')][_0xd984('0x1a')]);return _0x34a8d9(_0x3c9daa[_0xd984('0x18')][_0xd984('0x1a')]);}else{logger[_0xd984('0x13')](_0xd984('0x14'),_0x250a6c,_0xd984('0x15'));_0x34a8d9(_0x3c9daa['result'][_0xd984('0x1a')]);}})[_0xd984('0x1b')](function(_0x5e1ac6){logger[_0xd984('0x18')]('UserNotification,\x20%s,\x20%s',_0x250a6c,_0x5e1ac6);_0x40ccc8(_0x5e1ac6);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 412d929..545037b 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 _0xfa17=['removeListener','userNotification:','./userNotification.events','save','remove','update'];(function(_0x174605,_0x3474e1){var _0xaa6a5b=function(_0x394500){while(--_0x394500){_0x174605['push'](_0x174605['shift']());}};_0xaa6a5b(++_0x3474e1);}(_0xfa17,0xce));var _0x7fa1=function(_0x12fc34,_0x342831){_0x12fc34=_0x12fc34-0x0;var _0x27a778=_0xfa17[_0x12fc34];return _0x27a778;};'use strict';var UserNotificationEvents=require(_0x7fa1('0x0'));var events=[_0x7fa1('0x1'),_0x7fa1('0x2'),_0x7fa1('0x3')];function createListener(_0x7b50aa,_0xacfbfd){return function(_0x3af81a){_0xacfbfd['emit'](_0x7b50aa,_0x3af81a);};}function removeListener(_0x1316b5,_0xaec72d){return function(){UserNotificationEvents[_0x7fa1('0x4')](_0x1316b5,_0xaec72d);};}exports['register']=function(_0x2f64cf){for(var _0x126b52=0x0,_0x57f0eb=events['length'];_0x126b52<_0x57f0eb;_0x126b52++){var _0x5738fc=events[_0x126b52];var _0x56069a=createListener(_0x7fa1('0x5')+_0x5738fc,_0x2f64cf);UserNotificationEvents['on'](_0x5738fc,_0x56069a);}}; \ No newline at end of file +var _0xac96=['update','emit','removeListener','save'];(function(_0x4375fd,_0x32ed49){var _0x438f43=function(_0x38bd05){while(--_0x38bd05){_0x4375fd['push'](_0x4375fd['shift']());}};_0x438f43(++_0x32ed49);}(_0xac96,0xbb));var _0x6ac9=function(_0x34373d,_0x53b6ac){_0x34373d=_0x34373d-0x0;var _0x125a53=_0xac96[_0x34373d];return _0x125a53;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x6ac9('0x0'),'remove',_0x6ac9('0x1')];function createListener(_0x1321f9,_0x357db0){return function(_0x579148){_0x357db0[_0x6ac9('0x2')](_0x1321f9,_0x579148);};}function removeListener(_0x1c8681,_0x592fd1){return function(){UserNotificationEvents[_0x6ac9('0x3')](_0x1c8681,_0x592fd1);};}exports['register']=function(_0x35c329){for(var _0x190a06=0x0,_0x55f709=events['length'];_0x190a06<_0x55f709;_0x190a06++){var _0x11d5ec=events[_0x190a06];var _0x38fc68=createListener('userNotification:'+_0x11d5ec,_0x35c329);UserNotificationEvents['on'](_0x11d5ec,_0x38fc68);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index cff68f4..cf384bc 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1eff59,_0x195aa6){var _0xa061cd=function(_0x5daf00){while(--_0x5daf00){_0x1eff59['push'](_0x1eff59['shift']());}};_0xa061cd(++_0x195aa6);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x56cc18,_0x3e73ec){var _0x1a672f=function(_0x362604){while(--_0x362604){_0x56cc18['push'](_0x56cc18['shift']());}};_0x1a672f(++_0x3e73ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e1b964b..dc939cf 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 _0x5e4b=['INTEGER','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5e4b,0x1ab));var _0xb5e4=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x5e4b[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0xb5e4('0x0'));module[_0xb5e4('0x1')]={'penalty':{'type':Sequelize[_0xb5e4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x24ca=['sequelize','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x24ca,0x1bc));var _0xa24c=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0x24ca[_0x1dc24d];return _0x5d7fb2;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa24c('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 cb5d588..9e0bfa4 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 _0x556b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues'];(function(_0x438693,_0x3f7d95){var _0x31efd2=function(_0x3e1560){while(--_0x3e1560){_0x438693['push'](_0x438693['shift']());}};_0x31efd2(++_0x3f7d95);}(_0x556b,0x1e1));var _0xb556=function(_0x5de8ca,_0x2dd6b1){_0x5de8ca=_0x5de8ca-0x0;var _0x3c3f5b=_0x556b[_0x5de8ca];return _0x3c3f5b;};'use strict';var _=require(_0xb556('0x0'));var util=require(_0xb556('0x1'));var logger=require(_0xb556('0x2'))(_0xb556('0x3'));var moment=require(_0xb556('0x4'));var BPromise=require(_0xb556('0x5'));var rp=require(_0xb556('0x6'));var fs=require('fs');var path=require(_0xb556('0x7'));var rimraf=require(_0xb556('0x8'));var config=require('../../config/environment');var attributes=require(_0xb556('0x9'));module[_0xb556('0xa')]=function(_0x32217b,_0x3f00a5){return _0x32217b[_0xb556('0xb')]('UserOpenchannelQueue',attributes,{'tableName':_0xb556('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1db6=['path','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xf9e31c,_0x195b1b){var _0x2df975=function(_0x2f7bf8){while(--_0x2f7bf8){_0xf9e31c['push'](_0xf9e31c['shift']());}};_0x2df975(++_0x195b1b);}(_0x1db6,0xaf));var _0x61db=function(_0x13fc84,_0x905ef){_0x13fc84=_0x13fc84-0x0;var _0x46d899=_0x1db6[_0x13fc84];return _0x46d899;};'use strict';var _=require(_0x61db('0x0'));var util=require(_0x61db('0x1'));var logger=require(_0x61db('0x2'))(_0x61db('0x3'));var moment=require(_0x61db('0x4'));var BPromise=require(_0x61db('0x5'));var rp=require(_0x61db('0x6'));var fs=require('fs');var path=require(_0x61db('0x7'));var rimraf=require('rimraf');var config=require(_0x61db('0x8'));var attributes=require(_0x61db('0x9'));module[_0x61db('0xa')]=function(_0x11a59a,_0x2c6319){return _0x11a59a[_0x61db('0xb')](_0x61db('0xc'),attributes,{'tableName':_0x61db('0xd'),'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 6f966f7..aeb02d9 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 _0x5b5f=['then','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x47abd8,_0x43a755){var _0x1fc84a=function(_0x1b552b){while(--_0x1b552b){_0x47abd8['push'](_0x47abd8['shift']());}};_0x1fc84a(++_0x43a755);}(_0x5b5f,0x1ac));var _0xf5b5=function(_0x22c08b,_0x5ef5f0){_0x22c08b=_0x22c08b-0x0;var _0x439d18=_0x5b5f[_0x22c08b];return _0x439d18;};'use strict';var _=require('lodash');var util=require(_0xf5b5('0x0'));var moment=require('moment');var BPromise=require(_0xf5b5('0x1'));var rs=require(_0xf5b5('0x2'));var fs=require('fs');var Redis=require(_0xf5b5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf5b5('0x4'));var logger=require('../../config/logger')(_0xf5b5('0x5'));var config=require(_0xf5b5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf5b5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45645b,_0x7e3422,_0x1530c3){return new BPromise(function(_0x1b4053,_0x18efb7){return client[_0xf5b5('0x8')](_0x45645b,_0x1530c3)[_0xf5b5('0x9')](function(_0x4b323c){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x7e3422,_0xf5b5('0xa'));logger['debug'](_0xf5b5('0xb'),_0x7e3422,'request\x20sent',JSON[_0xf5b5('0xc')](_0x4b323c));if(_0x4b323c[_0xf5b5('0xd')]){if(_0x4b323c[_0xf5b5('0xd')][_0xf5b5('0xe')]===0x1f4){logger[_0xf5b5('0xd')](_0xf5b5('0xf'),_0x7e3422,_0x4b323c[_0xf5b5('0xd')]['message']);return _0x18efb7(_0x4b323c[_0xf5b5('0xd')][_0xf5b5('0x10')]);}logger[_0xf5b5('0xd')](_0xf5b5('0xf'),_0x7e3422,_0x4b323c[_0xf5b5('0xd')][_0xf5b5('0x10')]);return _0x1b4053(_0x4b323c[_0xf5b5('0xd')][_0xf5b5('0x10')]);}else{logger['info'](_0xf5b5('0xf'),_0x7e3422,'request\x20sent');_0x1b4053(_0x4b323c[_0xf5b5('0x11')]['message']);}})[_0xf5b5('0x12')](function(_0x2b6218){logger[_0xf5b5('0xd')](_0xf5b5('0xf'),_0x7e3422,_0x2b6218);_0x18efb7(_0x2b6218);});});} \ No newline at end of file +var _0xb863=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment'];(function(_0x450732,_0x5d5426){var _0x15c0be=function(_0x25770e){while(--_0x25770e){_0x450732['push'](_0x450732['shift']());}};_0x15c0be(++_0x5d5426);}(_0xb863,0x1cc));var _0x3b86=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xb863[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x3b86('0x0'));var util=require('util');var moment=require(_0x3b86('0x1'));var BPromise=require(_0x3b86('0x2'));var rs=require(_0x3b86('0x3'));var fs=require('fs');var Redis=require(_0x3b86('0x4'));var db=require(_0x3b86('0x5'))['db'];var utils=require(_0x3b86('0x6'));var logger=require(_0x3b86('0x7'))(_0x3b86('0x8'));var config=require(_0x3b86('0x9'));var jayson=require(_0x3b86('0xa'));var client=jayson[_0x3b86('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56ce85,_0x4d6185,_0x4d3e81){return new BPromise(function(_0x312da5,_0x3c85cd){return client['request'](_0x56ce85,_0x4d3e81)[_0x3b86('0xc')](function(_0x26622d){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4d6185,'request\x20sent');logger['debug'](_0x3b86('0xd'),_0x4d6185,'request\x20sent',JSON[_0x3b86('0xe')](_0x26622d));if(_0x26622d[_0x3b86('0xf')]){if(_0x26622d['error'][_0x3b86('0x10')]===0x1f4){logger[_0x3b86('0xf')](_0x3b86('0x11'),_0x4d6185,_0x26622d[_0x3b86('0xf')]['message']);return _0x3c85cd(_0x26622d['error'][_0x3b86('0x12')]);}logger[_0x3b86('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4d6185,_0x26622d[_0x3b86('0xf')][_0x3b86('0x12')]);return _0x312da5(_0x26622d[_0x3b86('0xf')]['message']);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4d6185,_0x3b86('0x13'));_0x312da5(_0x26622d[_0x3b86('0x14')][_0x3b86('0x12')]);}})[_0x3b86('0x15')](function(_0x4e9633){logger[_0x3b86('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4d6185,_0x4e9633);_0x3c85cd(_0x4e9633);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 52ab261..5c048d7 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 _0xafa4=['fs-extra','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getResources','post','create','/:id/clone','clone','addSections','addResources','update','delete','destroy','removeSections','/:id/resources','removeResources','multer','util','path','connect-timeout','express','Router'];(function(_0x1a6c4b,_0x3842d9){var _0x3617be=function(_0x45d5c0){while(--_0x45d5c0){_0x1a6c4b['push'](_0x1a6c4b['shift']());}};_0x3617be(++_0x3842d9);}(_0xafa4,0x1ca));var _0x4afa=function(_0x1151c5,_0x3a81b1){_0x1151c5=_0x1151c5-0x0;var _0x2beb31=_0xafa4[_0x1151c5];return _0x2beb31;};'use strict';var multer=require(_0x4afa('0x0'));var util=require(_0x4afa('0x1'));var path=require(_0x4afa('0x2'));var timeout=require(_0x4afa('0x3'));var express=require(_0x4afa('0x4'));var router=express[_0x4afa('0x5')]();var fs_extra=require(_0x4afa('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4afa('0x7'));var config=require('../../config/environment');var controller=require(_0x4afa('0x8'));router[_0x4afa('0x9')]('/',auth[_0x4afa('0xa')](),controller[_0x4afa('0xb')]);router[_0x4afa('0x9')](_0x4afa('0xc'),auth['isAuthenticated'](),controller[_0x4afa('0xd')]);router[_0x4afa('0x9')](_0x4afa('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x4afa('0x9')](_0x4afa('0xf'),auth[_0x4afa('0xa')](),controller['getSections']);router[_0x4afa('0x9')]('/:id/resources',auth[_0x4afa('0xa')](),controller[_0x4afa('0x10')]);router[_0x4afa('0x11')]('/',auth['isAuthenticated'](),controller[_0x4afa('0x12')]);router['post'](_0x4afa('0x13'),auth['isAuthenticated'](),controller[_0x4afa('0x14')]);router[_0x4afa('0x11')]('/:id/sections',auth[_0x4afa('0xa')](),controller[_0x4afa('0x15')]);router[_0x4afa('0x11')]('/:id/resources',auth[_0x4afa('0xa')](),controller[_0x4afa('0x16')]);router['put'](_0x4afa('0xe'),auth[_0x4afa('0xa')](),controller[_0x4afa('0x17')]);router[_0x4afa('0x18')](_0x4afa('0xe'),auth['isAuthenticated'](),controller[_0x4afa('0x19')]);router['delete']('/:id/sections',auth[_0x4afa('0xa')](),controller[_0x4afa('0x1a')]);router[_0x4afa('0x18')](_0x4afa('0x1b'),auth[_0x4afa('0xa')](),controller[_0x4afa('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x33cc=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/:id/sections','/:id/resources','getResources','create','post','/:id/clone','clone','addSections','addResources','/:id','update','delete','destroy','removeSections','exports','multer'];(function(_0x4adfd3,_0x2b7785){var _0x4f3fba=function(_0x39ef95){while(--_0x39ef95){_0x4adfd3['push'](_0x4adfd3['shift']());}};_0x4f3fba(++_0x2b7785);}(_0x33cc,0x15b));var _0xc33c=function(_0x2a8033,_0x268312){_0x2a8033=_0x2a8033-0x0;var _0x208f48=_0x33cc[_0x2a8033];return _0x208f48;};'use strict';var multer=require(_0xc33c('0x0'));var util=require(_0xc33c('0x1'));var path=require(_0xc33c('0x2'));var timeout=require(_0xc33c('0x3'));var express=require(_0xc33c('0x4'));var router=express[_0xc33c('0x5')]();var fs_extra=require(_0xc33c('0x6'));var auth=require(_0xc33c('0x7'));var interaction=require(_0xc33c('0x8'));var config=require(_0xc33c('0x9'));var controller=require(_0xc33c('0xa'));router[_0xc33c('0xb')]('/',auth[_0xc33c('0xc')](),controller[_0xc33c('0xd')]);router['get']('/describe',auth[_0xc33c('0xc')](),controller['describe']);router['get']('/:id',auth[_0xc33c('0xc')](),controller['show']);router[_0xc33c('0xb')](_0xc33c('0xe'),auth['isAuthenticated'](),controller['getSections']);router[_0xc33c('0xb')](_0xc33c('0xf'),auth[_0xc33c('0xc')](),controller[_0xc33c('0x10')]);router['post']('/',auth[_0xc33c('0xc')](),controller[_0xc33c('0x11')]);router[_0xc33c('0x12')](_0xc33c('0x13'),auth[_0xc33c('0xc')](),controller[_0xc33c('0x14')]);router[_0xc33c('0x12')]('/:id/sections',auth['isAuthenticated'](),controller[_0xc33c('0x15')]);router[_0xc33c('0x12')](_0xc33c('0xf'),auth[_0xc33c('0xc')](),controller[_0xc33c('0x16')]);router['put'](_0xc33c('0x17'),auth[_0xc33c('0xc')](),controller[_0xc33c('0x18')]);router[_0xc33c('0x19')](_0xc33c('0x17'),auth[_0xc33c('0xc')](),controller[_0xc33c('0x1a')]);router['delete'](_0xc33c('0xe'),auth[_0xc33c('0xc')](),controller[_0xc33c('0x1b')]);router[_0xc33c('0x19')]('/:id/resources',auth[_0xc33c('0xc')](),controller['removeResources']);module[_0xc33c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 1f6a27a..7e66096 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 _0xadea=['exports','name','setDataValue','crudPermissions','join','getDataValue','split','STRING','BOOLEAN','sequelize'];(function(_0x3f5ec3,_0x455528){var _0x257bc5=function(_0x550451){while(--_0x550451){_0x3f5ec3['push'](_0x3f5ec3['shift']());}};_0x257bc5(++_0x455528);}(_0xadea,0x17b));var _0xaade=function(_0x39d6a8,_0xc9c91a){_0x39d6a8=_0x39d6a8-0x0;var _0x93f3db=_0xadea[_0x39d6a8];return _0x93f3db;};'use strict';var Sequelize=require(_0xaade('0x0'));module[_0xaade('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xaade('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x37744a){this[_0xaade('0x3')](_0xaade('0x4'),_0x37744a?_0x37744a[_0xaade('0x5')](''):[]);},'get':function(){return this[_0xaade('0x6')](_0xaade('0x4'))?this[_0xaade('0x6')](_0xaade('0x4'))[_0xaade('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xaade('0x8')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xaade('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xaade('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xaade('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xaade('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xaade('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xaade('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xaade('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3f95=['STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x598152,_0x4230ac){var _0x71af95=function(_0x59f1da){while(--_0x59f1da){_0x598152['push'](_0x598152['shift']());}};_0x71af95(++_0x4230ac);}(_0x3f95,0xdf));var _0x53f9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3f95[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x53f9('0x0'));module[_0x53f9('0x1')]={'name':{'type':Sequelize[_0x53f9('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x53f9('0x2')],'set':function(_0x4474ed){this[_0x53f9('0x3')](_0x53f9('0x4'),_0x4474ed?_0x4474ed[_0x53f9('0x5')](''):[]);},'get':function(){return this[_0x53f9('0x6')](_0x53f9('0x4'))?this[_0x53f9('0x6')](_0x53f9('0x4'))[_0x53f9('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x53f9('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x53f9('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x53f9('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x53f9('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x53f9('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x53f9('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x53f9('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index d81237e..1fa886b 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 _0x2602=['removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','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','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','json','update','then','destroy','end','error','stack','name','send','index','map','UserProfile','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','push','getSections','filter','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate'];(function(_0x19cb41,_0x29f528){var _0x4e8d7a=function(_0x5d2108){while(--_0x5d2108){_0x19cb41['push'](_0x19cb41['shift']());}};_0x4e8d7a(++_0x29f528);}(_0x2602,0x1ca));var _0x2260=function(_0x19dd4a,_0x4be76a){_0x19dd4a=_0x19dd4a-0x0;var _0x3b1a8f=_0x2602[_0x19dd4a];return _0x3b1a8f;};'use strict';var emlformat=require(_0x2260('0x0'));var rimraf=require(_0x2260('0x1'));var zipdir=require(_0x2260('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2260('0x3'));var BPromise=require(_0x2260('0x4'));var Mustache=require(_0x2260('0x5'));var util=require('util');var path=require(_0x2260('0x6'));var sox=require(_0x2260('0x7'));var csv=require('to-csv');var ejs=require(_0x2260('0x8'));var fs=require('fs');var fs_extra=require(_0x2260('0x9'));var _=require(_0x2260('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2260('0xb'));var querystring=require(_0x2260('0xc'));var Papa=require(_0x2260('0xd'));var Redis=require('ioredis');var authService=require(_0x2260('0xe'));var qs=require(_0x2260('0xf'));var as=require(_0x2260('0x10'));var hardwareService=require(_0x2260('0x11'));var logger=require(_0x2260('0x12'))(_0x2260('0x13'));var utils=require(_0x2260('0x14'));var config=require(_0x2260('0x15'));var licenseUtil=require(_0x2260('0x16'));var db=require(_0x2260('0x17'))['db'];config[_0x2260('0x18')]=_[_0x2260('0x19')](config[_0x2260('0x18')],{'host':_0x2260('0x1a'),'port':0x18eb});var socket=require(_0x2260('0x1b'))(new Redis(config[_0x2260('0x18')]));require(_0x2260('0x1c'))[_0x2260('0x1d')](socket);function respondWithStatusCode(_0x27812b,_0x49682b){_0x49682b=_0x49682b||0xcc;return function(_0x9c26ac){if(_0x9c26ac){return _0x27812b[_0x2260('0x1e')](_0x49682b);}return _0x27812b[_0x2260('0x1f')](_0x49682b)['end']();};}function respondWithResult(_0x46f519,_0x2cec33){_0x2cec33=_0x2cec33||0xc8;return function(_0x11a161){if(_0x11a161){return _0x46f519[_0x2260('0x1f')](_0x2cec33)['json'](_0x11a161);}};}function respondWithFilteredResult(_0x511e6c,_0x3a9cb8){return function(_0xc22355){if(_0xc22355){var _0x45767c=typeof _0x3a9cb8[_0x2260('0x20')]===_0x2260('0x21')&&typeof _0x3a9cb8[_0x2260('0x22')]===_0x2260('0x21');var _0xe13959=_0xc22355[_0x2260('0x23')];var _0x40c0e0=_0x45767c?0x0:_0x3a9cb8['offset'];var _0x1f42e9=_0x45767c?_0xc22355['count']:_0x3a9cb8[_0x2260('0x20')]+_0x3a9cb8[_0x2260('0x22')];var _0x3f714a;if(_0x1f42e9>=_0xe13959){_0x1f42e9=_0xe13959;_0x3f714a=0xc8;}else{_0x3f714a=0xce;}_0x511e6c[_0x2260('0x1f')](_0x3f714a);return _0x511e6c['set'](_0x2260('0x24'),_0x40c0e0+'-'+_0x1f42e9+'/'+_0xe13959)[_0x2260('0x25')](_0xc22355);}return null;};}function patchUpdates(_0x3fa978){return function(_0x2e88e4){try{jsonpatch['apply'](_0x2e88e4,_0x3fa978,!![]);}catch(_0x5e66de){return BPromise['reject'](_0x5e66de);}return _0x2e88e4['save']();};}function saveUpdates(_0x5edcc8,_0x2b4fc3){return function(_0x3fd978){if(_0x3fd978){return _0x3fd978[_0x2260('0x26')](_0x5edcc8)[_0x2260('0x27')](function(_0x5342b3){return _0x5342b3;});}return null;};}function removeEntity(_0x1c9f2e,_0x3bb8e1){return function(_0x1308d4){if(_0x1308d4){return _0x1308d4[_0x2260('0x28')]()[_0x2260('0x27')](function(){_0x1c9f2e[_0x2260('0x1f')](0xcc)[_0x2260('0x29')]();});}};}function handleEntityNotFound(_0x53b58a,_0x1f616a){return function(_0x11ac00){if(!_0x11ac00){_0x53b58a[_0x2260('0x1e')](0x194);}return _0x11ac00;};}function handleError(_0x4ff607,_0x34bd93){_0x34bd93=_0x34bd93||0x1f4;return function(_0x5b2df7){logger[_0x2260('0x2a')](_0x5b2df7[_0x2260('0x2b')]);if(_0x5b2df7[_0x2260('0x2c')]){delete _0x5b2df7['name'];}_0x4ff607[_0x2260('0x1f')](_0x34bd93)[_0x2260('0x2d')](_0x5b2df7);};}exports[_0x2260('0x2e')]=function(_0x533dda,_0x2f3d05){var _0x42c523={},_0xc69186={},_0x3c07fe={'count':0x0,'rows':[]};var _0x38c118=_[_0x2260('0x2f')](db[_0x2260('0x30')][_0x2260('0x31')],function(_0x2b10cc){return{'name':_0x2b10cc['fieldName'],'type':_0x2b10cc[_0x2260('0x32')][_0x2260('0x33')]};});_0xc69186['model']=_[_0x2260('0x2f')](_0x38c118,_0x2260('0x2c'));_0xc69186[_0x2260('0x34')]=_[_0x2260('0x35')](_0x533dda[_0x2260('0x34')]);_0xc69186[_0x2260('0x36')]=_['intersection'](_0xc69186[_0x2260('0x37')],_0xc69186['query']);_0x42c523[_0x2260('0x38')]=_[_0x2260('0x39')](_0xc69186['model'],qs[_0x2260('0x3a')](_0x533dda[_0x2260('0x34')][_0x2260('0x3a')]));_0x42c523[_0x2260('0x38')]=_0x42c523[_0x2260('0x38')][_0x2260('0x3b')]?_0x42c523[_0x2260('0x38')]:_0xc69186[_0x2260('0x37')];if(!_0x533dda[_0x2260('0x34')]['hasOwnProperty']('nolimit')){_0x42c523['limit']=qs[_0x2260('0x22')](_0x533dda[_0x2260('0x34')][_0x2260('0x22')]);_0x42c523['offset']=qs['offset'](_0x533dda[_0x2260('0x34')][_0x2260('0x20')]);}_0x42c523[_0x2260('0x3c')]=qs[_0x2260('0x3d')](_0x533dda[_0x2260('0x34')][_0x2260('0x3d')]);_0x42c523['where']=qs[_0x2260('0x36')](_[_0x2260('0x3e')](_0x533dda['query'],_0xc69186['filters']),_0x38c118);if(_0x533dda[_0x2260('0x34')]['filter']){_0x42c523[_0x2260('0x3f')]=_[_0x2260('0x40')](_0x42c523[_0x2260('0x3f')],{'$or':_['map'](_0x38c118,function(_0x5357f8){if(_0x5357f8['type']!==_0x2260('0x41')){var _0x3e8e17={};_0x3e8e17[_0x5357f8['name']]={'$like':'%'+_0x533dda[_0x2260('0x34')]['filter']+'%'};return _0x3e8e17;}})});}_0x42c523=_[_0x2260('0x40')]({},_0x42c523,_0x533dda[_0x2260('0x42')]);var _0x4d65d6={'where':_0x42c523['where']};return db[_0x2260('0x30')][_0x2260('0x23')](_0x4d65d6)['then'](function(_0x4c83f7){_0x3c07fe['count']=_0x4c83f7;if(_0x533dda['query'][_0x2260('0x43')]){_0x42c523[_0x2260('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0x2260('0x45')](_0x42c523);})[_0x2260('0x27')](function(_0x3db8f3){_0x3c07fe[_0x2260('0x46')]=_0x3db8f3;return _0x3c07fe;})[_0x2260('0x27')](respondWithFilteredResult(_0x2f3d05,_0x42c523))[_0x2260('0x47')](handleError(_0x2f3d05,null));};exports[_0x2260('0x48')]=function(_0x57de7f,_0x268dc8){var _0x5b1dd4={'raw':![],'where':{'id':_0x57de7f[_0x2260('0x49')]['id']}},_0x479569={};_0x479569['model']=_[_0x2260('0x35')](db[_0x2260('0x30')][_0x2260('0x31')]);_0x479569[_0x2260('0x34')]=_[_0x2260('0x35')](_0x57de7f[_0x2260('0x34')]);_0x479569['filters']=_[_0x2260('0x39')](_0x479569[_0x2260('0x37')],_0x479569[_0x2260('0x34')]);_0x5b1dd4[_0x2260('0x38')]=_['intersection'](_0x479569[_0x2260('0x37')],qs[_0x2260('0x3a')](_0x57de7f['query']['fields']));_0x5b1dd4[_0x2260('0x38')]=_0x5b1dd4[_0x2260('0x38')]['length']?_0x5b1dd4[_0x2260('0x38')]:_0x479569[_0x2260('0x37')];if(_0x57de7f[_0x2260('0x34')][_0x2260('0x43')]){_0x5b1dd4[_0x2260('0x44')]=[{'all':!![]}];}_0x5b1dd4=_[_0x2260('0x40')]({},_0x5b1dd4,_0x57de7f['options']);return db[_0x2260('0x30')]['find'](_0x5b1dd4)['then'](handleEntityNotFound(_0x268dc8,null))[_0x2260('0x27')](respondWithResult(_0x268dc8,null))[_0x2260('0x47')](handleError(_0x268dc8,null));};exports[_0x2260('0x4a')]=function(_0x2f7ea1,_0x21a39d){return db[_0x2260('0x30')][_0x2260('0x4a')](_0x2f7ea1[_0x2260('0x4b')],{})[_0x2260('0x27')](respondWithResult(_0x21a39d,0xc9))[_0x2260('0x47')](handleError(_0x21a39d,null));};exports['clone']=function(_0x4fc974,_0x427b30){var _0x96c720={'where':{'id':_0x4fc974['params']['id']}},_0x55e2bd={};_0x55e2bd[_0x2260('0x37')]=_[_0x2260('0x35')](db[_0x2260('0x30')]['rawAttributes']);_0x96c720['attributes']=_['intersection'](_0x55e2bd[_0x2260('0x37')],qs['fields'](_0x4fc974['query']['fields']));_0x96c720[_0x2260('0x38')]=_0x96c720[_0x2260('0x38')][_0x2260('0x3b')]?_0x96c720['attributes']:_0x55e2bd[_0x2260('0x37')];if(_0x4fc974['query']['includeAll']){_0x96c720['include']=[{'all':!![]}];}_0x96c720=_['merge']({},_0x96c720,_0x4fc974['options']);return db['UserProfile'][_0x2260('0x4c')](_0x96c720)['then'](handleEntityNotFound(_0x427b30,null))['then'](function(_0x13a3c5){if(_0x13a3c5){var _0x181136=_0x13a3c5[_0x2260('0x4d')]({'plain':!![]});_0x181136=qs[_0x2260('0x4e')](_0x181136,['id','createdAt',_0x2260('0x4f'),_0x2260('0x50')]);_0x4fc974['body']=_[_0x2260('0x4e')](_0x4fc974[_0x2260('0x4b')],['id',_0x2260('0x51'),_0x2260('0x4f')]);return db[_0x2260('0x52')][_0x2260('0x53')](function(_0x11d522){return db['UserProfile'][_0x2260('0x4a')](_['merge'](_0x181136,_0x4fc974['body']),{'include':_0x4fc974['query'][_0x2260('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x11d522})[_0x2260('0x27')](function(_0x4f42a4){var _0x4cb9ed=_0x4f42a4[_0x2260('0x4d')]({'plain':!![]});return db['UserProfileSection'][_0x2260('0x45')]({'where':{'userProfileId':_0x4fc974['params']['id']},'raw':!![]})[_0x2260('0x27')](function(_0x2ca46e){if(_0x2ca46e){return BPromise[_0x2260('0x54')](_0x2ca46e,function(_0x58dbc3){return new BPromise(function(_0x2f3745,_0x2e0662){if(_0x58dbc3[_0x2260('0x55')]===null||_0x58dbc3['autoAssociation']===0x1)_0x2f3745(null);return db[_0x2260('0x56')]['findAll']({'where':{'sectionId':_0x58dbc3['id']},'raw':!![]})['then'](function(_0x58fe21){var _0x41b025=_['map'](_0x58fe21,function(_0x41c382){return qs[_0x2260('0x4e')](_0x41c382,['id',_0x2260('0x51'),_0x2260('0x4f'),_0x2260('0x57')]);});_0x2f3745(_0x41b025);})[_0x2260('0x47')](function(_0x1418a9){_0x2e0662(_0x1418a9);});})[_0x2260('0x27')](function(_0x43354c){var _0x33105b=qs[_0x2260('0x4e')](_0x58dbc3,['id',_0x2260('0x51'),_0x2260('0x4f')]);_0x33105b[_0x2260('0x58')]=_0x4cb9ed['id'];if(_0x43354c)_0x33105b[_0x2260('0x59')]=_0x43354c;return _0x33105b;})[_0x2260('0x27')](function(_0x317c34){return db[_0x2260('0x5a')]['create'](_0x317c34,{'include':[{'model':db['UserProfileResource'],'as':_0x2260('0x59')}],'raw':!![],'transaction':_0x11d522});});})[_0x2260('0x27')](function(){return _0x4cb9ed;});}});});});}})['then'](respondWithResult(_0x427b30,0xc9))[_0x2260('0x47')](handleError(_0x427b30,null));};exports[_0x2260('0x26')]=function(_0x477266,_0x5b4fda){if(_0x477266[_0x2260('0x4b')]['id']){delete _0x477266[_0x2260('0x4b')]['id'];}return db[_0x2260('0x30')]['find']({'where':{'id':_0x477266[_0x2260('0x49')]['id']}})[_0x2260('0x27')](handleEntityNotFound(_0x5b4fda,null))[_0x2260('0x27')](saveUpdates(_0x477266[_0x2260('0x4b')],null))[_0x2260('0x27')](respondWithResult(_0x5b4fda,null))['catch'](handleError(_0x5b4fda,null));};exports['destroy']=function(_0xa23d8b,_0x17dc61){return db[_0x2260('0x30')][_0x2260('0x4c')]({'where':{'id':_0xa23d8b[_0x2260('0x49')]['id']}})['then'](handleEntityNotFound(_0x17dc61,null))['then'](removeEntity(_0x17dc61,null))[_0x2260('0x47')](handleError(_0x17dc61,null));};exports[_0x2260('0x5b')]=function(_0x58d892,_0x5bf334){return db[_0x2260('0x30')][_0x2260('0x5b')]()[_0x2260('0x27')](respondWithResult(_0x5bf334,null))[_0x2260('0x47')](handleError(_0x5bf334,null));};exports[_0x2260('0x5c')]=function(_0x3e086d,_0x16844f){var _0x42cf8f=_0x3e086d['body'];return db[_0x2260('0x30')]['find']({'where':{'id':_0x3e086d['params']['id']}})[_0x2260('0x27')](handleEntityNotFound(_0x16844f,null))[_0x2260('0x27')](function(_0x43f3f2){if(_0x43f3f2){return db[_0x2260('0x52')][_0x2260('0x53')](function(_0xbb77ac){return db['UserProfileSection'][_0x2260('0x28')]({'where':{'userProfileId':_0x3e086d[_0x2260('0x49')]['id'],'sectionId':_[_0x2260('0x2f')](_0x42cf8f,function(_0x28ec05){return _0x28ec05[_0x2260('0x57')];})},'transaction':_0xbb77ac})[_0x2260('0x27')](function(){var _0x23f474=_['map'](_0x42cf8f,function(_0x388a00){_0x388a00[_0x2260('0x58')]=_0x3e086d['params']['id'];return _0x388a00;});var _0x18b30f=[];return BPromise['each'](_0x23f474,function(_0x2f3585){return db[_0x2260('0x5a')][_0x2260('0x4a')](_0x2f3585,{'include':[{'model':db[_0x2260('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0xbb77ac})[_0x2260('0x27')](function(_0x986465){_0x18b30f[_0x2260('0x5d')](_0x986465['get']({'plain':!![]}));});})[_0x2260('0x27')](function(){return _0x18b30f;});});});}})[_0x2260('0x27')](function(_0x3005bc){return _0x3005bc;})[_0x2260('0x27')](respondWithResult(_0x16844f,null))[_0x2260('0x47')](handleError(_0x16844f,null));};exports['removeSections']=function(_0x47f69a,_0x5b9cfc){var _0x1db4a5;return db[_0x2260('0x30')][_0x2260('0x4c')]({'where':{'id':_0x47f69a['params']['id']},'attributes':['id',_0x2260('0x2c')]})['then'](handleEntityNotFound(_0x5b9cfc,null))[_0x2260('0x27')](function(_0x5c259d){if(_0x5c259d){_0x1db4a5=_0x5c259d;return db[_0x2260('0x5a')][_0x2260('0x28')]({'where':{'userProfileId':_0x47f69a[_0x2260('0x49')]['id'],'sectionId':_0x47f69a['query']['ids']}});}})[_0x2260('0x27')](function(){return _0x1db4a5;})['then'](respondWithStatusCode(_0x5b9cfc,null))[_0x2260('0x47')](handleError(_0x5b9cfc,null));};exports[_0x2260('0x5e')]=function(_0x443b70,_0x1d6b0a){var _0x19d94f=[];var _0x60939=[];return db[_0x2260('0x5a')][_0x2260('0x45')]({'where':{'userProfileId':_0x443b70[_0x2260('0x49')]['id']},'raw':!![]})[_0x2260('0x27')](function(_0x34ec2d){_0x19d94f=_[_0x2260('0x5f')](_0x34ec2d,function(_0x4c31bf){return _0x4c31bf[_0x2260('0x60')]===0x1||_[_0x2260('0x61')]([0x3eb,0x709],_0x4c31bf[_0x2260('0x57')]);});if(!_[_0x2260('0x62')](_0x19d94f)){return _['map'](_0x19d94f,function(_0xf66bda){return _0xf66bda[_0x2260('0x57')];});}else{return;}})[_0x2260('0x27')](function(_0x25ff74){if(_0x25ff74)_0x60939=_0x25ff74;if(_[_0x2260('0x61')](_0x60939,0x64)){var _0x142fc5=_[_0x2260('0x4c')](_0x19d94f,{'sectionId':0x64});return hasDefaultDashboard(_0x142fc5)[_0x2260('0x27')](function(_0x453a51){return _[_0x2260('0x2f')](_0x19d94f,function(_0x341632){if(_0x341632[_0x2260('0x57')]===0x64){_0x341632[_0x2260('0x63')]=_0x453a51;}return _0x341632;});});}else{return;}})[_0x2260('0x27')](function(_0x263e9b){if(_0x263e9b)_0x19d94f=_0x263e9b;if(_[_0x2260('0x61')](_0x60939,0x3eb)){var _0x18ede8=_[_0x2260('0x4c')](_0x19d94f,{'sectionId':0x3eb});return getCustomDashboards(_0x18ede8)[_0x2260('0x27')](function(_0x88509c){return _['map'](_0x19d94f,function(_0x136d25){if(_0x18ede8[_0x2260('0x60')]){if(_0x136d25[_0x2260('0x57')]===0x3eb){_0x136d25[_0x2260('0x63')]=_0x88509c;}}else{if(_0x136d25[_0x2260('0x57')]===0x64){if(!_0x136d25[_0x2260('0x63')]){_0x136d25[_0x2260('0x63')]=[];}_0x136d25[_0x2260('0x63')]=_0x136d25[_0x2260('0x63')]['concat'](_0x88509c);}}return _0x136d25;});});}else{return;}})['then'](function(_0x512e96){if(_0x512e96)_0x19d94f=_0x512e96;if(_[_0x2260('0x61')](_0x60939,0x709)){var _0x15764e=_[_0x2260('0x4c')](_0x19d94f,{'sectionId':0x709});return getPlugins(_0x15764e)[_0x2260('0x27')](function(_0x175320){if(_0x15764e[_0x2260('0x60')]){return _[_0x2260('0x2f')](_0x19d94f,function(_0x4ffa1c){if(_0x4ffa1c[_0x2260('0x57')]===0x709){_0x4ffa1c[_0x2260('0x63')]=_0x175320;}return _0x4ffa1c;});}else{var _0x14ec38={'sectionId':0x76c,'enabled':0x1,'subsections':_0x175320};var _0x617e9=_[_0x2260('0x2f')](_0x19d94f);_0x617e9[_0x2260('0x5d')](_0x14ec38);return _0x617e9;}});}else{return;}})['then'](function(_0x483029){if(_0x483029)_0x19d94f=_0x483029;return _[_0x2260('0x5f')](_0x19d94f,['enabled',0x1]);})[_0x2260('0x27')](respondWithResult(_0x1d6b0a,null))['catch'](handleError(_0x1d6b0a,null));};function hasDefaultDashboard(_0x2f90bf){var _0x1ed12d=[0x65];return new BPromise(function(_0x1c7659,_0x9b4447){try{if(_0x2f90bf[_0x2260('0x55')]){_0x1c7659(_0x1ed12d);}else{return db[_0x2260('0x56')][_0x2260('0x64')]({'where':{'sectionId':_0x2f90bf['id']},'raw':!![]})['then'](function(_0x3e4d88){_0x3e4d88?_0x1c7659(_0x1ed12d):_0x1c7659();});}}catch(_0x1a899a){_0x9b4447(_0x1a899a);}});}function getCustomDashboards(_0x486883){var _0x7f9a0f=[];return new BPromise(function(_0x393920,_0x5235da){try{if(_0x486883[_0x2260('0x55')]){return db[_0x2260('0x65')][_0x2260('0x45')]({'raw':!![]})[_0x2260('0x27')](function(_0x3151c1){_0x3151c1[_0x2260('0x66')](function(_0xa85066){_0x7f9a0f['push'](_0xa85066['id']+0x1869f);});_0x393920(_0x7f9a0f);});}else{return db[_0x2260('0x56')]['findAll']({'where':{'sectionId':_0x486883['id']},'raw':!![]})['then'](function(_0x4921b8){_0x4921b8[_0x2260('0x66')](function(_0x46558c){_0x7f9a0f['push'](_0x46558c[_0x2260('0x67')]+0x1869f);});_0x393920(_0x7f9a0f);});}}catch(_0x1eb9b6){_0x5235da(_0x1eb9b6);}});}function getPlugins(_0x118936){var _0xcde8da=[];return new BPromise(function(_0x307e68,_0x1297c3){try{if(_0x118936[_0x2260('0x55')]){return db[_0x2260('0x68')][_0x2260('0x45')]({'raw':!![]})['then'](function(_0xfa635e){_0xfa635e[_0x2260('0x66')](function(_0x634423){_0xcde8da[_0x2260('0x5d')](_0x634423['id']+0x15b38);});_0x307e68(_0xcde8da);});}else{return db[_0x2260('0x56')][_0x2260('0x45')]({'where':{'sectionId':_0x118936['id']},'raw':!![]})[_0x2260('0x27')](function(_0x1e3cd0){_0x1e3cd0[_0x2260('0x66')](function(_0x577625){_0xcde8da[_0x2260('0x5d')](_0x577625[_0x2260('0x67')]+0x15b38);});_0x307e68(_0xcde8da);});}}catch(_0xb5f25c){_0x1297c3(_0xb5f25c);}});}exports[_0x2260('0x69')]=function(_0x4bf7d2,_0x1d7f45){return db['UserProfile'][_0x2260('0x4c')]({'where':{'id':_0x4bf7d2[_0x2260('0x49')]['id']}})[_0x2260('0x27')](handleEntityNotFound(_0x1d7f45,null))[_0x2260('0x27')](function(_0x175d22){if(_0x175d22){return db[_0x2260('0x52')][_0x2260('0x53')](function(_0x10d4ff){return db[_0x2260('0x5a')]['findAll']({'where':{'userProfileId':_0x4bf7d2['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x33f7c9){if(_0x33f7c9){return db['UserProfileSection'][_0x2260('0x28')]({'where':{'userProfileId':_0x4bf7d2['params']['id'],'id':_[_0x2260('0x2f')](_0x33f7c9,function(_0x1b13e3){return _0x1b13e3['id'];})},'transaction':_0x10d4ff});}})[_0x2260('0x27')](function(_0x319fee){var _0xdb44f3=_[_0x2260('0x2f')](_0x4bf7d2[_0x2260('0x4b')],function(_0x5433c2){_0x5433c2[_0x2260('0x58')]=_0x4bf7d2[_0x2260('0x49')]['id'];return _0x5433c2;});return db[_0x2260('0x5a')]['bulkCreate'](_0xdb44f3,{'raw':!![],'transaction':_0x10d4ff});})[_0x2260('0x27')](function(_0x3214f6){var _0x4b55e7=_[_0x2260('0x5f')](_[_0x2260('0x2f')](_0x3214f6,function(_0x111cda){return _0x111cda[_0x2260('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x4b55e7){return db[_0x2260('0x5a')]['findAll']({'where':{'userProfileId':_0x4bf7d2[_0x2260('0x49')]['id'],'sectionId':_[_0x2260('0x2f')](_0x4b55e7,function(_0x1b35bf){return _0x1b35bf[_0x2260('0x57')];})},'attributes':['id',_0x2260('0x57')],'raw':!![]})[_0x2260('0x27')](function(_0x18f4be){var _0x55fbaa=_[_0x2260('0x2f')](_0x4bf7d2[_0x2260('0x4b')],function(_0x2b9988){_0x2b9988['userProfileId']=_0x4bf7d2[_0x2260('0x49')]['id'];return _0x2b9988;});return db[_0x2260('0x56')][_0x2260('0x6a')](_0x55fbaa,{'raw':!![],'transaction':_0x10d4ff});});}})[_0x2260('0x47')](handleError(_0x1d7f45,null));});}})['then'](function(_0x3652fb){var _0x1deb32=_['map'](_0x3652fb,function(_0x4469b2){return _0x4469b2[_0x2260('0x4d')]({'plain':!![]});});})[_0x2260('0x27')](respondWithResult(_0x1d7f45,null))[_0x2260('0x47')](handleError(_0x1d7f45,null));};exports[_0x2260('0x6b')]=function(_0x492d71,_0x1dcc16,_0x5434be){return db['UserProfile']['find']({'where':{'id':_0x492d71[_0x2260('0x49')]['id']}})[_0x2260('0x27')](handleEntityNotFound(_0x1dcc16,null))[_0x2260('0x27')](function(_0x1bc403){if(_0x1bc403){return _0x1bc403['removeResources'](_0x492d71[_0x2260('0x34')]['ids']);}})[_0x2260('0x27')](respondWithStatusCode(_0x1dcc16,null))[_0x2260('0x47')](handleError(_0x1dcc16,null));};exports[_0x2260('0x6c')]=function(_0x2a1e7d,_0x2736b4){var _0x51cd91={};if(!_0x2a1e7d[_0x2260('0x34')][_0x2260('0x6d')])throw new Error(_0x2260('0x6e'));if(!_0x2a1e7d[_0x2260('0x34')]['hasOwnProperty'](_0x2260('0x6f'))){_0x51cd91[_0x2260('0x22')]=qs[_0x2260('0x22')](_0x2a1e7d[_0x2260('0x34')][_0x2260('0x22')]);_0x51cd91[_0x2260('0x20')]=qs[_0x2260('0x20')](_0x2a1e7d[_0x2260('0x34')][_0x2260('0x20')]);}return db[_0x2260('0x30')]['find']({'where':{'id':_0x2a1e7d[_0x2260('0x49')]['id']}})['then'](function(_0x47af1f){if(!_0x47af1f)throw new Error(_0x2260('0x70')+_0x2a1e7d[_0x2260('0x49')]['id']);return db[_0x2260('0x30')][_0x2260('0x6c')](_0x2a1e7d);})[_0x2260('0x27')](respondWithFilteredResult(_0x2736b4,_0x51cd91))[_0x2260('0x47')](handleError(_0x2736b4,null));}; \ No newline at end of file +var _0x1c6e=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','clone','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','get','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','UserProfileResource','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','concat','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','getResources','eml-format','rimraf','zip-dir','fast-json-patch','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','offset','limit','undefined','count','apply','reject','save','update','destroy','then','end','name','map','UserProfile'];(function(_0x414f67,_0x861aed){var _0x338537=function(_0x4696fd){while(--_0x4696fd){_0x414f67['push'](_0x414f67['shift']());}};_0x338537(++_0x861aed);}(_0x1c6e,0xb7));var _0xe1c6=function(_0x17e771,_0x55fd17){_0x17e771=_0x17e771-0x0;var _0x1f3a6d=_0x1c6e[_0x17e771];return _0x1f3a6d;};'use strict';var emlformat=require(_0xe1c6('0x0'));var rimraf=require(_0xe1c6('0x1'));var zipdir=require(_0xe1c6('0x2'));var jsonpatch=require(_0xe1c6('0x3'));var rp=require('request-promise');var moment=require(_0xe1c6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe1c6('0x5'));var util=require('util');var path=require(_0xe1c6('0x6'));var sox=require(_0xe1c6('0x7'));var csv=require(_0xe1c6('0x8'));var ejs=require(_0xe1c6('0x9'));var fs=require('fs');var fs_extra=require(_0xe1c6('0xa'));var _=require(_0xe1c6('0xb'));var squel=require('squel');var crypto=require(_0xe1c6('0xc'));var jsforce=require(_0xe1c6('0xd'));var deskjs=require(_0xe1c6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe1c6('0xf'));var Papa=require(_0xe1c6('0x10'));var Redis=require(_0xe1c6('0x11'));var authService=require(_0xe1c6('0x12'));var qs=require(_0xe1c6('0x13'));var as=require(_0xe1c6('0x14'));var hardwareService=require(_0xe1c6('0x15'));var logger=require('../../config/logger')(_0xe1c6('0x16'));var utils=require(_0xe1c6('0x17'));var config=require(_0xe1c6('0x18'));var licenseUtil=require(_0xe1c6('0x19'));var db=require(_0xe1c6('0x1a'))['db'];config['redis']=_[_0xe1c6('0x1b')](config['redis'],{'host':_0xe1c6('0x1c'),'port':0x18eb});var socket=require(_0xe1c6('0x1d'))(new Redis(config['redis']));require(_0xe1c6('0x1e'))[_0xe1c6('0x1f')](socket);function respondWithStatusCode(_0x22364e,_0x34fdd9){_0x34fdd9=_0x34fdd9||0xcc;return function(_0x4f86db){if(_0x4f86db){return _0x22364e[_0xe1c6('0x20')](_0x34fdd9);}return _0x22364e[_0xe1c6('0x21')](_0x34fdd9)['end']();};}function respondWithResult(_0x1c3db6,_0x26c229){_0x26c229=_0x26c229||0xc8;return function(_0x43041b){if(_0x43041b){return _0x1c3db6[_0xe1c6('0x21')](_0x26c229)[_0xe1c6('0x22')](_0x43041b);}};}function respondWithFilteredResult(_0x43cbd1,_0x478ed8){return function(_0x6bad49){if(_0x6bad49){var _0x2699f0=typeof _0x478ed8[_0xe1c6('0x23')]==='undefined'&&typeof _0x478ed8[_0xe1c6('0x24')]===_0xe1c6('0x25');var _0x15df34=_0x6bad49[_0xe1c6('0x26')];var _0x58121c=_0x2699f0?0x0:_0x478ed8[_0xe1c6('0x23')];var _0x1f4a66=_0x2699f0?_0x6bad49[_0xe1c6('0x26')]:_0x478ed8[_0xe1c6('0x23')]+_0x478ed8[_0xe1c6('0x24')];var _0x2da305;if(_0x1f4a66>=_0x15df34){_0x1f4a66=_0x15df34;_0x2da305=0xc8;}else{_0x2da305=0xce;}_0x43cbd1['status'](_0x2da305);return _0x43cbd1['set']('Content-Range',_0x58121c+'-'+_0x1f4a66+'/'+_0x15df34)[_0xe1c6('0x22')](_0x6bad49);}return null;};}function patchUpdates(_0x177bc2){return function(_0x4438e1){try{jsonpatch[_0xe1c6('0x27')](_0x4438e1,_0x177bc2,!![]);}catch(_0x3aeaf8){return BPromise[_0xe1c6('0x28')](_0x3aeaf8);}return _0x4438e1[_0xe1c6('0x29')]();};}function saveUpdates(_0x109e2e,_0x4f31da){return function(_0x17f795){if(_0x17f795){return _0x17f795[_0xe1c6('0x2a')](_0x109e2e)['then'](function(_0x202961){return _0x202961;});}return null;};}function removeEntity(_0x5bea5c,_0x2482e6){return function(_0x5bde64){if(_0x5bde64){return _0x5bde64[_0xe1c6('0x2b')]()[_0xe1c6('0x2c')](function(){_0x5bea5c[_0xe1c6('0x21')](0xcc)[_0xe1c6('0x2d')]();});}};}function handleEntityNotFound(_0x5909ec,_0x35cba7){return function(_0x219272){if(!_0x219272){_0x5909ec[_0xe1c6('0x20')](0x194);}return _0x219272;};}function handleError(_0x29d8c9,_0x4bd33d){_0x4bd33d=_0x4bd33d||0x1f4;return function(_0x5bb559){logger['error'](_0x5bb559['stack']);if(_0x5bb559[_0xe1c6('0x2e')]){delete _0x5bb559[_0xe1c6('0x2e')];}_0x29d8c9['status'](_0x4bd33d)['send'](_0x5bb559);};}exports['index']=function(_0x30f484,_0x8379fc){var _0x2b043a={},_0x264752={},_0x781d52={'count':0x0,'rows':[]};var _0x5b42db=_[_0xe1c6('0x2f')](db[_0xe1c6('0x30')]['rawAttributes'],function(_0x701b84){return{'name':_0x701b84[_0xe1c6('0x31')],'type':_0x701b84[_0xe1c6('0x32')][_0xe1c6('0x33')]};});_0x264752[_0xe1c6('0x34')]=_[_0xe1c6('0x2f')](_0x5b42db,'name');_0x264752[_0xe1c6('0x35')]=_[_0xe1c6('0x36')](_0x30f484[_0xe1c6('0x35')]);_0x264752[_0xe1c6('0x37')]=_[_0xe1c6('0x38')](_0x264752['model'],_0x264752['query']);_0x2b043a[_0xe1c6('0x39')]=_['intersection'](_0x264752[_0xe1c6('0x34')],qs[_0xe1c6('0x3a')](_0x30f484[_0xe1c6('0x35')][_0xe1c6('0x3a')]));_0x2b043a['attributes']=_0x2b043a[_0xe1c6('0x39')][_0xe1c6('0x3b')]?_0x2b043a[_0xe1c6('0x39')]:_0x264752['model'];if(!_0x30f484[_0xe1c6('0x35')][_0xe1c6('0x3c')](_0xe1c6('0x3d'))){_0x2b043a[_0xe1c6('0x24')]=qs[_0xe1c6('0x24')](_0x30f484[_0xe1c6('0x35')][_0xe1c6('0x24')]);_0x2b043a['offset']=qs['offset'](_0x30f484['query'][_0xe1c6('0x23')]);}_0x2b043a[_0xe1c6('0x3e')]=qs[_0xe1c6('0x3f')](_0x30f484['query'][_0xe1c6('0x3f')]);_0x2b043a[_0xe1c6('0x40')]=qs[_0xe1c6('0x37')](_[_0xe1c6('0x41')](_0x30f484[_0xe1c6('0x35')],_0x264752['filters']),_0x5b42db);if(_0x30f484[_0xe1c6('0x35')][_0xe1c6('0x42')]){_0x2b043a[_0xe1c6('0x40')]=_['merge'](_0x2b043a[_0xe1c6('0x40')],{'$or':_[_0xe1c6('0x2f')](_0x5b42db,function(_0x267363){if(_0x267363['type']!==_0xe1c6('0x43')){var _0x4b30fc={};_0x4b30fc[_0x267363[_0xe1c6('0x2e')]]={'$like':'%'+_0x30f484[_0xe1c6('0x35')]['filter']+'%'};return _0x4b30fc;}})});}_0x2b043a=_['merge']({},_0x2b043a,_0x30f484[_0xe1c6('0x44')]);var _0x464371={'where':_0x2b043a[_0xe1c6('0x40')]};return db[_0xe1c6('0x30')][_0xe1c6('0x26')](_0x464371)[_0xe1c6('0x2c')](function(_0x21f28b){_0x781d52['count']=_0x21f28b;if(_0x30f484[_0xe1c6('0x35')][_0xe1c6('0x45')]){_0x2b043a[_0xe1c6('0x46')]=[{'all':!![]}];}return db['UserProfile'][_0xe1c6('0x47')](_0x2b043a);})[_0xe1c6('0x2c')](function(_0x2bc704){_0x781d52[_0xe1c6('0x48')]=_0x2bc704;return _0x781d52;})[_0xe1c6('0x2c')](respondWithFilteredResult(_0x8379fc,_0x2b043a))[_0xe1c6('0x49')](handleError(_0x8379fc,null));};exports[_0xe1c6('0x4a')]=function(_0x125bae,_0x42ada1){var _0x5d3f64={'raw':![],'where':{'id':_0x125bae[_0xe1c6('0x4b')]['id']}},_0x26a826={};_0x26a826['model']=_[_0xe1c6('0x36')](db['UserProfile'][_0xe1c6('0x4c')]);_0x26a826[_0xe1c6('0x35')]=_[_0xe1c6('0x36')](_0x125bae[_0xe1c6('0x35')]);_0x26a826[_0xe1c6('0x37')]=_[_0xe1c6('0x38')](_0x26a826['model'],_0x26a826['query']);_0x5d3f64[_0xe1c6('0x39')]=_['intersection'](_0x26a826[_0xe1c6('0x34')],qs[_0xe1c6('0x3a')](_0x125bae[_0xe1c6('0x35')][_0xe1c6('0x3a')]));_0x5d3f64[_0xe1c6('0x39')]=_0x5d3f64[_0xe1c6('0x39')][_0xe1c6('0x3b')]?_0x5d3f64[_0xe1c6('0x39')]:_0x26a826[_0xe1c6('0x34')];if(_0x125bae[_0xe1c6('0x35')][_0xe1c6('0x45')]){_0x5d3f64[_0xe1c6('0x46')]=[{'all':!![]}];}_0x5d3f64=_[_0xe1c6('0x4d')]({},_0x5d3f64,_0x125bae['options']);return db[_0xe1c6('0x30')][_0xe1c6('0x4e')](_0x5d3f64)[_0xe1c6('0x2c')](handleEntityNotFound(_0x42ada1,null))[_0xe1c6('0x2c')](respondWithResult(_0x42ada1,null))[_0xe1c6('0x49')](handleError(_0x42ada1,null));};exports[_0xe1c6('0x4f')]=function(_0x46df43,_0x146cc9){return db[_0xe1c6('0x30')]['create'](_0x46df43[_0xe1c6('0x50')],{})[_0xe1c6('0x2c')](respondWithResult(_0x146cc9,0xc9))['catch'](handleError(_0x146cc9,null));};exports[_0xe1c6('0x51')]=function(_0x321a6a,_0x3495dd){var _0x3c924f={'where':{'id':_0x321a6a[_0xe1c6('0x4b')]['id']}},_0x49e522={};_0x49e522[_0xe1c6('0x34')]=_[_0xe1c6('0x36')](db['UserProfile'][_0xe1c6('0x4c')]);_0x3c924f[_0xe1c6('0x39')]=_[_0xe1c6('0x38')](_0x49e522['model'],qs[_0xe1c6('0x3a')](_0x321a6a['query'][_0xe1c6('0x3a')]));_0x3c924f[_0xe1c6('0x39')]=_0x3c924f[_0xe1c6('0x39')]['length']?_0x3c924f['attributes']:_0x49e522[_0xe1c6('0x34')];if(_0x321a6a[_0xe1c6('0x35')]['includeAll']){_0x3c924f[_0xe1c6('0x46')]=[{'all':!![]}];}_0x3c924f=_[_0xe1c6('0x4d')]({},_0x3c924f,_0x321a6a[_0xe1c6('0x44')]);return db[_0xe1c6('0x30')][_0xe1c6('0x4e')](_0x3c924f)[_0xe1c6('0x2c')](handleEntityNotFound(_0x3495dd,null))[_0xe1c6('0x2c')](function(_0x250e7b){if(_0x250e7b){var _0x23a68e=_0x250e7b['get']({'plain':!![]});_0x23a68e=qs[_0xe1c6('0x52')](_0x23a68e,['id',_0xe1c6('0x53'),_0xe1c6('0x54'),_0xe1c6('0x55')]);_0x321a6a['body']=_['omit'](_0x321a6a[_0xe1c6('0x50')],['id','createdAt',_0xe1c6('0x54')]);return db[_0xe1c6('0x56')][_0xe1c6('0x57')](function(_0x1f60ce){return db[_0xe1c6('0x30')][_0xe1c6('0x4f')](_[_0xe1c6('0x4d')](_0x23a68e,_0x321a6a[_0xe1c6('0x50')]),{'include':_0x321a6a['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x1f60ce})['then'](function(_0x1a7e6c){var _0x29a28e=_0x1a7e6c[_0xe1c6('0x58')]({'plain':!![]});return db['UserProfileSection'][_0xe1c6('0x47')]({'where':{'userProfileId':_0x321a6a[_0xe1c6('0x4b')]['id']},'raw':!![]})[_0xe1c6('0x2c')](function(_0x105dc6){if(_0x105dc6){return BPromise[_0xe1c6('0x59')](_0x105dc6,function(_0x56bb94){return new BPromise(function(_0x1e9fe2,_0x516b34){if(_0x56bb94['autoAssociation']===null||_0x56bb94[_0xe1c6('0x5a')]===0x1)_0x1e9fe2(null);return db['UserProfileResource'][_0xe1c6('0x47')]({'where':{'sectionId':_0x56bb94['id']},'raw':!![]})[_0xe1c6('0x2c')](function(_0x515b55){var _0x163ad8=_['map'](_0x515b55,function(_0x953d68){return qs['omit'](_0x953d68,['id',_0xe1c6('0x53'),_0xe1c6('0x54'),_0xe1c6('0x5b')]);});_0x1e9fe2(_0x163ad8);})[_0xe1c6('0x49')](function(_0x24078d){_0x516b34(_0x24078d);});})['then'](function(_0x568c35){var _0x386240=qs[_0xe1c6('0x52')](_0x56bb94,['id','createdAt',_0xe1c6('0x54')]);_0x386240[_0xe1c6('0x5c')]=_0x29a28e['id'];if(_0x568c35)_0x386240[_0xe1c6('0x5d')]=_0x568c35;return _0x386240;})[_0xe1c6('0x2c')](function(_0x50515c){return db[_0xe1c6('0x5e')][_0xe1c6('0x4f')](_0x50515c,{'include':[{'model':db['UserProfileResource'],'as':_0xe1c6('0x5d')}],'raw':!![],'transaction':_0x1f60ce});});})['then'](function(){return _0x29a28e;});}});});});}})[_0xe1c6('0x2c')](respondWithResult(_0x3495dd,0xc9))['catch'](handleError(_0x3495dd,null));};exports[_0xe1c6('0x2a')]=function(_0xde7ef,_0x53fa58){if(_0xde7ef[_0xe1c6('0x50')]['id']){delete _0xde7ef[_0xe1c6('0x50')]['id'];}return db[_0xe1c6('0x30')][_0xe1c6('0x4e')]({'where':{'id':_0xde7ef[_0xe1c6('0x4b')]['id']}})[_0xe1c6('0x2c')](handleEntityNotFound(_0x53fa58,null))[_0xe1c6('0x2c')](saveUpdates(_0xde7ef[_0xe1c6('0x50')],null))[_0xe1c6('0x2c')](respondWithResult(_0x53fa58,null))[_0xe1c6('0x49')](handleError(_0x53fa58,null));};exports['destroy']=function(_0x4811b6,_0x116a78){return db[_0xe1c6('0x30')][_0xe1c6('0x4e')]({'where':{'id':_0x4811b6[_0xe1c6('0x4b')]['id']}})[_0xe1c6('0x2c')](handleEntityNotFound(_0x116a78,null))[_0xe1c6('0x2c')](removeEntity(_0x116a78,null))[_0xe1c6('0x49')](handleError(_0x116a78,null));};exports['describe']=function(_0x3e7abb,_0x3cb3d7){return db['UserProfile']['describe']()['then'](respondWithResult(_0x3cb3d7,null))[_0xe1c6('0x49')](handleError(_0x3cb3d7,null));};exports['addSections']=function(_0x2e497a,_0x25f761){var _0xd22314=_0x2e497a[_0xe1c6('0x50')];return db[_0xe1c6('0x30')][_0xe1c6('0x4e')]({'where':{'id':_0x2e497a['params']['id']}})[_0xe1c6('0x2c')](handleEntityNotFound(_0x25f761,null))[_0xe1c6('0x2c')](function(_0xa3746c){if(_0xa3746c){return db[_0xe1c6('0x56')][_0xe1c6('0x57')](function(_0x2ed146){return db[_0xe1c6('0x5e')][_0xe1c6('0x2b')]({'where':{'userProfileId':_0x2e497a['params']['id'],'sectionId':_[_0xe1c6('0x2f')](_0xd22314,function(_0x3803f0){return _0x3803f0[_0xe1c6('0x5b')];})},'transaction':_0x2ed146})[_0xe1c6('0x2c')](function(){var _0x2592c4=_['map'](_0xd22314,function(_0x26f448){_0x26f448['userProfileId']=_0x2e497a[_0xe1c6('0x4b')]['id'];return _0x26f448;});var _0x4810a0=[];return BPromise['each'](_0x2592c4,function(_0x6d8c9e){return db[_0xe1c6('0x5e')][_0xe1c6('0x4f')](_0x6d8c9e,{'include':[{'model':db[_0xe1c6('0x5f')],'as':'Resources'}],'raw':!![],'transaction':_0x2ed146})['then'](function(_0x119d4f){_0x4810a0[_0xe1c6('0x60')](_0x119d4f['get']({'plain':!![]}));});})[_0xe1c6('0x2c')](function(){return _0x4810a0;});});});}})[_0xe1c6('0x2c')](function(_0x424d41){return _0x424d41;})['then'](respondWithResult(_0x25f761,null))[_0xe1c6('0x49')](handleError(_0x25f761,null));};exports[_0xe1c6('0x61')]=function(_0x4ed0ed,_0x40cd78){var _0x46c281;return db['UserProfile']['find']({'where':{'id':_0x4ed0ed[_0xe1c6('0x4b')]['id']},'attributes':['id',_0xe1c6('0x2e')]})[_0xe1c6('0x2c')](handleEntityNotFound(_0x40cd78,null))[_0xe1c6('0x2c')](function(_0x126c5b){if(_0x126c5b){_0x46c281=_0x126c5b;return db[_0xe1c6('0x5e')][_0xe1c6('0x2b')]({'where':{'userProfileId':_0x4ed0ed['params']['id'],'sectionId':_0x4ed0ed[_0xe1c6('0x35')][_0xe1c6('0x62')]}});}})[_0xe1c6('0x2c')](function(){return _0x46c281;})[_0xe1c6('0x2c')](respondWithStatusCode(_0x40cd78,null))[_0xe1c6('0x49')](handleError(_0x40cd78,null));};exports[_0xe1c6('0x63')]=function(_0x108d9d,_0x4da977){var _0x29fc13=[];var _0x40ecc4=[];return db[_0xe1c6('0x5e')][_0xe1c6('0x47')]({'where':{'userProfileId':_0x108d9d[_0xe1c6('0x4b')]['id']},'raw':!![]})[_0xe1c6('0x2c')](function(_0xe727){_0x29fc13=_[_0xe1c6('0x42')](_0xe727,function(_0x57f246){return _0x57f246[_0xe1c6('0x64')]===0x1||_['includes']([0x3eb,0x709],_0x57f246[_0xe1c6('0x5b')]);});if(!_[_0xe1c6('0x65')](_0x29fc13)){return _['map'](_0x29fc13,function(_0x30e3f4){return _0x30e3f4[_0xe1c6('0x5b')];});}else{return;}})[_0xe1c6('0x2c')](function(_0x26bcad){if(_0x26bcad)_0x40ecc4=_0x26bcad;if(_[_0xe1c6('0x66')](_0x40ecc4,0x64)){var _0x23d2bb=_[_0xe1c6('0x4e')](_0x29fc13,{'sectionId':0x64});return hasDefaultDashboard(_0x23d2bb)[_0xe1c6('0x2c')](function(_0xabf05){return _[_0xe1c6('0x2f')](_0x29fc13,function(_0x512a49){if(_0x512a49[_0xe1c6('0x5b')]===0x64){_0x512a49['subsections']=_0xabf05;}return _0x512a49;});});}else{return;}})['then'](function(_0x4f8d0a){if(_0x4f8d0a)_0x29fc13=_0x4f8d0a;if(_[_0xe1c6('0x66')](_0x40ecc4,0x3eb)){var _0x336d97=_[_0xe1c6('0x4e')](_0x29fc13,{'sectionId':0x3eb});return getCustomDashboards(_0x336d97)['then'](function(_0x1f8c66){return _[_0xe1c6('0x2f')](_0x29fc13,function(_0x489feb){if(_0x336d97[_0xe1c6('0x64')]){if(_0x489feb[_0xe1c6('0x5b')]===0x3eb){_0x489feb[_0xe1c6('0x67')]=_0x1f8c66;}}else{if(_0x489feb[_0xe1c6('0x5b')]===0x64){if(!_0x489feb[_0xe1c6('0x67')]){_0x489feb[_0xe1c6('0x67')]=[];}_0x489feb[_0xe1c6('0x67')]=_0x489feb[_0xe1c6('0x67')][_0xe1c6('0x68')](_0x1f8c66);}}return _0x489feb;});});}else{return;}})[_0xe1c6('0x2c')](function(_0x4f37e3){if(_0x4f37e3)_0x29fc13=_0x4f37e3;if(_['includes'](_0x40ecc4,0x709)){var _0x175d99=_['find'](_0x29fc13,{'sectionId':0x709});return getPlugins(_0x175d99)[_0xe1c6('0x2c')](function(_0x5abe8d){if(_0x175d99[_0xe1c6('0x64')]){return _[_0xe1c6('0x2f')](_0x29fc13,function(_0x4df37a){if(_0x4df37a[_0xe1c6('0x5b')]===0x709){_0x4df37a[_0xe1c6('0x67')]=_0x5abe8d;}return _0x4df37a;});}else{var _0x28259c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5abe8d};var _0x56ced8=_[_0xe1c6('0x2f')](_0x29fc13);_0x56ced8[_0xe1c6('0x60')](_0x28259c);return _0x56ced8;}});}else{return;}})[_0xe1c6('0x2c')](function(_0x35fe78){if(_0x35fe78)_0x29fc13=_0x35fe78;return _[_0xe1c6('0x42')](_0x29fc13,[_0xe1c6('0x64'),0x1]);})['then'](respondWithResult(_0x4da977,null))[_0xe1c6('0x49')](handleError(_0x4da977,null));};function hasDefaultDashboard(_0x5bb188){var _0x52f3be=[0x65];return new BPromise(function(_0x4d3dca,_0x468d36){try{if(_0x5bb188['autoAssociation']){_0x4d3dca(_0x52f3be);}else{return db[_0xe1c6('0x5f')][_0xe1c6('0x69')]({'where':{'sectionId':_0x5bb188['id']},'raw':!![]})[_0xe1c6('0x2c')](function(_0x38d138){_0x38d138?_0x4d3dca(_0x52f3be):_0x4d3dca();});}}catch(_0x310e7b){_0x468d36(_0x310e7b);}});}function getCustomDashboards(_0x4383e3){var _0x289920=[];return new BPromise(function(_0x5b2354,_0x9ee15b){try{if(_0x4383e3[_0xe1c6('0x5a')]){return db[_0xe1c6('0x6a')][_0xe1c6('0x47')]({'raw':!![]})[_0xe1c6('0x2c')](function(_0x1739e6){_0x1739e6['forEach'](function(_0x25fafb){_0x289920[_0xe1c6('0x60')](_0x25fafb['id']+0x1869f);});_0x5b2354(_0x289920);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x4383e3['id']},'raw':!![]})[_0xe1c6('0x2c')](function(_0x31ea16){_0x31ea16[_0xe1c6('0x6b')](function(_0x407733){_0x289920['push'](_0x407733['resourceId']+0x1869f);});_0x5b2354(_0x289920);});}}catch(_0x28673e){_0x9ee15b(_0x28673e);}});}function getPlugins(_0x166a2a){var _0x3ab46a=[];return new BPromise(function(_0x575a0f,_0x4f1607){try{if(_0x166a2a[_0xe1c6('0x5a')]){return db[_0xe1c6('0x6c')]['findAll']({'raw':!![]})[_0xe1c6('0x2c')](function(_0x5a4eae){_0x5a4eae[_0xe1c6('0x6b')](function(_0x3a4752){_0x3ab46a['push'](_0x3a4752['id']+0x15b38);});_0x575a0f(_0x3ab46a);});}else{return db['UserProfileResource'][_0xe1c6('0x47')]({'where':{'sectionId':_0x166a2a['id']},'raw':!![]})['then'](function(_0x47fed5){_0x47fed5[_0xe1c6('0x6b')](function(_0x331218){_0x3ab46a[_0xe1c6('0x60')](_0x331218[_0xe1c6('0x6d')]+0x15b38);});_0x575a0f(_0x3ab46a);});}}catch(_0x52c835){_0x4f1607(_0x52c835);}});}exports[_0xe1c6('0x6e')]=function(_0x5c27b8,_0x1d753a){return db[_0xe1c6('0x30')][_0xe1c6('0x4e')]({'where':{'id':_0x5c27b8[_0xe1c6('0x4b')]['id']}})[_0xe1c6('0x2c')](handleEntityNotFound(_0x1d753a,null))['then'](function(_0x5a41ca){if(_0x5a41ca){return db[_0xe1c6('0x56')][_0xe1c6('0x57')](function(_0x4d38c8){return db[_0xe1c6('0x5e')][_0xe1c6('0x47')]({'where':{'userProfileId':_0x5c27b8[_0xe1c6('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0xe1c6('0x2c')](function(_0x520401){if(_0x520401){return db[_0xe1c6('0x5e')][_0xe1c6('0x2b')]({'where':{'userProfileId':_0x5c27b8[_0xe1c6('0x4b')]['id'],'id':_[_0xe1c6('0x2f')](_0x520401,function(_0x27c3bb){return _0x27c3bb['id'];})},'transaction':_0x4d38c8});}})[_0xe1c6('0x2c')](function(_0x8a47ca){var _0x47d67b=_[_0xe1c6('0x2f')](_0x5c27b8['body'],function(_0x731c7e){_0x731c7e[_0xe1c6('0x5c')]=_0x5c27b8['params']['id'];return _0x731c7e;});return db[_0xe1c6('0x5e')][_0xe1c6('0x6f')](_0x47d67b,{'raw':!![],'transaction':_0x4d38c8});})[_0xe1c6('0x2c')](function(_0x39f66a){var _0x1df2a4=_[_0xe1c6('0x42')](_['map'](_0x39f66a,function(_0x5b3347){return _0x5b3347[_0xe1c6('0x58')]({'plain':!![]});}),{'includeAll':![]});if(_0x1df2a4){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x5c27b8[_0xe1c6('0x4b')]['id'],'sectionId':_[_0xe1c6('0x2f')](_0x1df2a4,function(_0x46ca2d){return _0x46ca2d[_0xe1c6('0x5b')];})},'attributes':['id',_0xe1c6('0x5b')],'raw':!![]})[_0xe1c6('0x2c')](function(_0x7a5a6){var _0x2012ae=_[_0xe1c6('0x2f')](_0x5c27b8[_0xe1c6('0x50')],function(_0x1e26f9){_0x1e26f9[_0xe1c6('0x5c')]=_0x5c27b8[_0xe1c6('0x4b')]['id'];return _0x1e26f9;});return db[_0xe1c6('0x5f')][_0xe1c6('0x6f')](_0x2012ae,{'raw':!![],'transaction':_0x4d38c8});});}})[_0xe1c6('0x49')](handleError(_0x1d753a,null));});}})[_0xe1c6('0x2c')](function(_0x3a98f3){var _0x48662c=_[_0xe1c6('0x2f')](_0x3a98f3,function(_0x2207a9){return _0x2207a9['get']({'plain':!![]});});})['then'](respondWithResult(_0x1d753a,null))[_0xe1c6('0x49')](handleError(_0x1d753a,null));};exports['removeResources']=function(_0x4f5483,_0x1df171,_0x2148fd){return db[_0xe1c6('0x30')][_0xe1c6('0x4e')]({'where':{'id':_0x4f5483[_0xe1c6('0x4b')]['id']}})[_0xe1c6('0x2c')](handleEntityNotFound(_0x1df171,null))[_0xe1c6('0x2c')](function(_0x521ffd){if(_0x521ffd){return _0x521ffd[_0xe1c6('0x70')](_0x4f5483['query'][_0xe1c6('0x62')]);}})[_0xe1c6('0x2c')](respondWithStatusCode(_0x1df171,null))[_0xe1c6('0x49')](handleError(_0x1df171,null));};exports['getResources']=function(_0x550f78,_0x5c5934){var _0x1988a3={};if(!_0x550f78[_0xe1c6('0x35')][_0xe1c6('0x71')])throw new Error(_0xe1c6('0x72'));if(!_0x550f78['query'][_0xe1c6('0x3c')](_0xe1c6('0x3d'))){_0x1988a3[_0xe1c6('0x24')]=qs[_0xe1c6('0x24')](_0x550f78[_0xe1c6('0x35')][_0xe1c6('0x24')]);_0x1988a3[_0xe1c6('0x23')]=qs['offset'](_0x550f78[_0xe1c6('0x35')]['offset']);}return db[_0xe1c6('0x30')][_0xe1c6('0x4e')]({'where':{'id':_0x550f78[_0xe1c6('0x4b')]['id']}})[_0xe1c6('0x2c')](function(_0x447cda){if(!_0x447cda)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x550f78[_0xe1c6('0x4b')]['id']);return db['UserProfile'][_0xe1c6('0x73')](_0x550f78);})[_0xe1c6('0x2c')](respondWithFilteredResult(_0x5c5934,_0x1988a3))['catch'](handleError(_0x5c5934,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 8947f92..e61b394 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 _0xda81=['exports','events','../../mysqldb','UserProfile','save','update','remove','emit','hook'];(function(_0x45fc5b,_0x1e2464){var _0x4731ae=function(_0x4998af){while(--_0x4998af){_0x45fc5b['push'](_0x45fc5b['shift']());}};_0x4731ae(++_0x1e2464);}(_0xda81,0x1c3));var _0x1da8=function(_0x158169,_0x2b1193){_0x158169=_0x158169-0x0;var _0x16b5c2=_0xda81[_0x158169];return _0x16b5c2;};'use strict';var EventEmitter=require(_0x1da8('0x0'));var UserProfile=require(_0x1da8('0x1'))['db'][_0x1da8('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1da8('0x3'),'afterUpdate':_0x1da8('0x4'),'afterDestroy':_0x1da8('0x5')};function emitEvent(_0x177870){return function(_0x48421c,_0x3357ac,_0x2692c1){UserProfileEvents['emit'](_0x177870+':'+_0x48421c['id'],_0x48421c);UserProfileEvents[_0x1da8('0x6')](_0x177870,_0x48421c);_0x2692c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x1da8('0x7')](e,emitEvent(event));}}module[_0x1da8('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x8374=['hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x8374,0x174));var _0x4837=function(_0x3288e7,_0x1bad6a){_0x3288e7=_0x3288e7-0x0;var _0x2a0ef6=_0x8374[_0x3288e7];return _0x2a0ef6;};'use strict';var EventEmitter=require(_0x4837('0x0'));var UserProfile=require(_0x4837('0x1'))['db'][_0x4837('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4837('0x3')](0x0);var events={'afterCreate':_0x4837('0x4'),'afterUpdate':_0x4837('0x5'),'afterDestroy':_0x4837('0x6')};function emitEvent(_0x1d4017){return function(_0x149f91,_0x386e70,_0x188f7f){UserProfileEvents[_0x4837('0x7')](_0x1d4017+':'+_0x149f91['id'],_0x149f91);UserProfileEvents[_0x4837('0x7')](_0x1d4017,_0x149f91);_0x188f7f(null);};}for(var e in events){if(events[_0x4837('0x8')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x4837('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index b3e2b76..2b688f7 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 _0x7009=['ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','agent','queue','VoiceQueue','inbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','VoiceQueues','QueueCampaigns','users','agents','telephones','Users','admin','user','Telephones','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','Tag','Template','Trigger','trunks','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','select','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','ignore','isEmpty','union','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','autoAssociation','includeAll','include','forEach','default','custom','CustomReports','count','ids','customSorting','extraQueryConditions','Tags','color','tag','true','rows','chat','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','exports','models','filter','field','value','findAll','associatedResources','map','catch','model','then','name','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','SquareRecording','parentSections','projectName','projects','JscriptyProject','CmContact','ListId','lists','CmList','CmCompany','globalcustomfields','chatqueues'];(function(_0x316f6a,_0x1d27ff){var _0x26948a=function(_0x2a35ab){while(--_0x2a35ab){_0x316f6a['push'](_0x316f6a['shift']());}};_0x26948a(++_0x1d27ff);}(_0x7009,0x97));var _0x9700=function(_0x380c2d,_0x2f9ea1){_0x380c2d=_0x380c2d-0x0;var _0x5c5bde=_0x7009[_0x380c2d];return _0x5c5bde;};'use strict';var _=require(_0x9700('0x0'));var attributes=require(_0x9700('0x1'));var squel=require('squel');module[_0x9700('0x2')]=function(_0x5959ec){var _0x159cef=_0x5959ec[_0x9700('0x3')];function _0x1b64a9(_0x1b4ac9,_0x35a654){return new Promise(function(_0x445365,_0x42cb93){if(!_0x35a654)return _0x445365(null);var _0x3419f8=_0x35a654['filter']?{[_0x35a654[_0x9700('0x4')][_0x9700('0x5')]]:_0x35a654['filter'][_0x9700('0x6')]}:undefined;return _0x159cef[_0x1b4ac9][_0x9700('0x7')]({'where':_0x3419f8,'raw':!![]})['then'](function(_0x432ac5){_0x35a654[_0x9700('0x8')]=_[_0x9700('0x9')](_0x432ac5,'id');_0x445365(_0x35a654);})[_0x9700('0xa')](function(_0x3324a5){_0x42cb93(_0x3324a5);});});}function _0x4d7592(_0x32b5e9,_0x2e9b41){return new Promise(function(_0x5b7b40,_0xcf88db){var _0x4e208e=_0x32b5e9[_0x9700('0x4')]?{[_0x32b5e9[_0x9700('0x4')][_0x9700('0x5')]]:_0x32b5e9[_0x9700('0x4')][_0x9700('0x6')]}:undefined;return _0x159cef[_0x32b5e9[_0x9700('0xb')]][_0x9700('0x7')]({'where':_0x4e208e,'raw':!![]})[_0x9700('0xc')](function(_0x3eab69){_0x2e9b41['associatedResources']=_[_0x9700('0x9')](_0x3eab69,function(_0x59cbb8){return _0x59cbb8[_0x9700('0xd')];});_0x5b7b40(_0x2e9b41);})[_0x9700('0xa')](function(_0xa39b5c){_0xcf88db(_0xa39b5c);});});}function _0x29596e(_0x3499b2,_0x4d5f44,_0xbf952d){if(!_0x4d5f44)return Promise[_0x9700('0xe')](null);return new Promise(function(_0x3cf2dc,_0x4c1370){return _0x159cef[_0x9700('0xf')][_0x9700('0x7')]({'where':{'sectionId':_0x4d5f44['id']},'raw':!![]})[_0x9700('0xc')](function(_0x15890f){if(_0x3499b2[_0x9700('0x5')]&&_0x3499b2[_0x9700('0x5')]!=='id'){_0x4d5f44[_0x9700('0x8')]=_[_0x9700('0x9')](_0x15890f,function(_0x19f4a4){return _0x19f4a4[_0x3499b2['field']];});}else{if(_0xbf952d===_0x9700('0x10')){_0x4d5f44[_0x9700('0x8')]=_[_0x9700('0x9')](_0x15890f,function(_0x2e9c4a){return{'id':_0x2e9c4a['resourceId'],'type':_0x2e9c4a[_0x9700('0x11')]};});}else{_0x4d5f44[_0x9700('0x8')]=_['map'](_0x15890f,function(_0x5f26c9){return _0x5f26c9[_0x9700('0x12')];});}}_0x3cf2dc(_0x4d5f44);})['catch'](function(_0x1e675d){_0x4c1370(_0x1e675d);});});}function _0x50fb34(_0x1dd9d1,_0xf3e96){var _0x10e052={'parentSections':[]};switch(_0x1dd9d1[_0x9700('0x13')]()){case _0x9700('0x14'):_0x10e052[_0x9700('0x15')]='SquareProject';break;case _0x9700('0x16'):_0x10e052[_0x9700('0x15')]=_0x9700('0x17');break;case'squarerecordings':_0x10e052[_0x9700('0x15')]=_0x9700('0x18');_0x10e052[_0x9700('0x19')]=[{'name':'SquareProjects','field':_0x9700('0xd'),'foreignKey':_0x9700('0x1a')}];break;case _0x9700('0x1b'):_0x10e052[_0x9700('0x15')]=_0x9700('0x1c');break;case'contacts':_0x10e052[_0x9700('0x15')]=_0x9700('0x1d');_0x10e052[_0x9700('0x19')]=[{'name':'Lists','field':'id','foreignKey':_0x9700('0x1e')}];break;case _0x9700('0x1f'):_0x10e052[_0x9700('0x15')]=_0x9700('0x20');break;case'companies':_0x10e052['childModel']=_0x9700('0x21');break;case _0x9700('0x22'):_0x10e052[_0x9700('0x15')]='CmCustomField';break;case _0x9700('0x23'):_0x10e052[_0x9700('0x15')]=_0x9700('0x24');break;case _0x9700('0x25'):_0x10e052[_0x9700('0x15')]=_0x9700('0x26');break;case _0x9700('0x27'):_0x10e052['childModel']='FaxQueue';break;case _0x9700('0x28'):_0x10e052[_0x9700('0x15')]='FaxAccount';break;case'inboundroutes':case'internalroutes':case _0x9700('0x29'):_0x10e052[_0x9700('0x15')]=_0x9700('0x2a');break;case _0x9700('0x2b'):_0x10e052[_0x9700('0x15')]='VoiceContext';break;case _0x9700('0x2c'):_0x10e052[_0x9700('0x15')]=_0x9700('0x2d');break;case'voicerecordings':_0x10e052['childModel']=_0x9700('0x2e');_0x10e052[_0x9700('0x19')]=[{'name':_0x9700('0x2f'),'field':'name','foreignKey':_0x9700('0x30'),'model':_0x9700('0x31'),'filter':{'field':_0x9700('0x32'),'value':[_0x9700('0x33')]}},{'name':'Telephones','field':'name','foreignKey':'membername','model':'User','filter':{'field':_0x9700('0x32'),'value':['telephone']}},{'name':'VoiceQueues','field':'name','foreignKey':_0x9700('0x34'),'model':_0x9700('0x35'),'filter':{'field':_0x9700('0x11'),'value':[_0x9700('0x36')]}},{'name':'QueueCampaigns','field':'name','foreignKey':'queue','model':_0x9700('0x35'),'filter':{'field':_0x9700('0x11'),'value':['outbound']}}];break;case _0x9700('0x37'):_0x10e052[_0x9700('0x15')]=_0x9700('0x38');break;case _0x9700('0x39'):_0x10e052[_0x9700('0x15')]=_0x9700('0x3a');break;case'voiceprefixes':_0x10e052['childModel']='VoicePrefix';break;case _0x9700('0x3b'):_0x10e052['childModel']=_0x9700('0x3c');break;case _0x9700('0x3d'):_0x10e052[_0x9700('0x15')]=_0x9700('0x3e');break;case _0x9700('0x3f'):_0x10e052['childModel']=_0x9700('0x40');break;case'mailsubstatuses':_0x10e052['childModel']='MailSubstatus';break;case _0x9700('0x41'):_0x10e052[_0x9700('0x15')]=_0x9700('0x42');break;case _0x9700('0x43'):_0x10e052['childModel']=_0x9700('0x44');break;case _0x9700('0x45'):_0x10e052[_0x9700('0x15')]=_0x9700('0x46');break;case _0x9700('0x47'):_0x10e052[_0x9700('0x15')]=_0x9700('0x48');break;case _0x9700('0x49'):_0x10e052[_0x9700('0x15')]='WhatsappQueue';break;case _0x9700('0x4a'):_0x10e052['childModel']=_0x9700('0x4b');break;case'teams':_0x10e052[_0x9700('0x15')]=_0x9700('0x4c');break;case'voicequeues':case _0x9700('0x4d'):_0x10e052[_0x9700('0x15')]=_0x9700('0x35');if(_0xf3e96){_0x10e052[_0x9700('0x19')]=[{'name':_0x9700('0x4e')},{'name':_0x9700('0x4f')}];}break;case _0x9700('0x50'):case _0x9700('0x51'):case _0x9700('0x52'):_0x10e052['childModel']=_0x9700('0x31');if(_0xf3e96){_0x10e052[_0x9700('0x19')]=[{'name':_0x9700('0x53'),'filter':{'field':_0x9700('0x32'),'value':[_0x9700('0x54'),_0x9700('0x55')]},'ignore':!![]},{'name':'Agents'},{'name':_0x9700('0x56')}];}break;case'zendeskaccounts':_0x10e052[_0x9700('0x15')]=_0x9700('0x57');break;case'salesforceaccounts':_0x10e052[_0x9700('0x15')]=_0x9700('0x58');break;case _0x9700('0x59'):_0x10e052[_0x9700('0x15')]=_0x9700('0x5a');break;case _0x9700('0x5b'):_0x10e052['childModel']=_0x9700('0x5c');break;case _0x9700('0x5d'):_0x10e052['childModel']=_0x9700('0x5e');break;case'zohoaccounts':_0x10e052[_0x9700('0x15')]=_0x9700('0x5f');break;case'vtigeraccounts':_0x10e052[_0x9700('0x15')]=_0x9700('0x31');break;case _0x9700('0x60'):_0x10e052[_0x9700('0x15')]=_0x9700('0x61');break;case _0x9700('0x62'):_0x10e052['childModel']=_0x9700('0x63');break;case _0x9700('0x64'):_0x10e052[_0x9700('0x15')]=_0x9700('0x65');break;case _0x9700('0x66'):_0x10e052['childModel']=_0x9700('0x67');break;case _0x9700('0x68'):_0x10e052[_0x9700('0x15')]='Pause';break;case _0x9700('0x69'):_0x10e052[_0x9700('0x15')]=_0x9700('0x6a');break;case _0x9700('0x6b'):_0x10e052['childModel']=_0x9700('0x6c');break;case'tags':_0x10e052[_0x9700('0x15')]=_0x9700('0x6d');break;case'templates':_0x10e052[_0x9700('0x15')]=_0x9700('0x6e');break;case'triggers':_0x10e052[_0x9700('0x15')]=_0x9700('0x6f');break;case _0x9700('0x70'):_0x10e052['childModel']='Trunk';break;case'variables':_0x10e052[_0x9700('0x15')]=_0x9700('0x71');break;case _0x9700('0x72'):_0x10e052[_0x9700('0x15')]=_0x9700('0x73');break;case _0x9700('0x74'):_0x10e052[_0x9700('0x15')]=_0x9700('0x10');_0x10e052[_0x9700('0x19')]=[{'name':_0x9700('0x75'),'field':'id','foreignKey':_0x9700('0x76')}];break;case'metrics':_0x10e052[_0x9700('0x15')]=_0x9700('0x77');break;}return _0x10e052;}function _0x49f69e(_0x34f628,_0x4a6c1c){var _0x4e93e7=_0x34f628['charAt'](0x0)[_0x9700('0x78')]()+_0x34f628[_0x9700('0x79')](0x1);var _0x4c0c44={'type':_0x159cef[_0x9700('0x7a')][_0x9700('0x7b')]['SELECT'],'raw':!![]};return new Promise(function(_0x355781,_0x382ff3){var _0x287c3b=squel[_0x9700('0x7c')]()[_0x9700('0x5')]('ui.'+_0x4e93e7+'InteractionId','id')[_0x9700('0x5')]('ui.createdAt')['from'](_0x9700('0x7d')+_0x34f628+'_interactions','ui')[_0x9700('0x7e')](_0x9700('0x7f'),_0x4a6c1c['id']);return _0x159cef[_0x9700('0x80')][_0x9700('0x81')](_0x287c3b[_0x9700('0x82')](),_0x4c0c44)[_0x9700('0xc')](function(_0x11b1c9){_0x4a6c1c[_0x4e93e7+_0x9700('0x83')]=_0x11b1c9;_0x355781(_0x11b1c9);})[_0x9700('0xa')](function(_0x1e2ceb){_0x382ff3(_0x1e2ceb);});});}return _0x5959ec[_0x9700('0x84')](_0x9700('0x85'),attributes,{'tableName':_0x9700('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x45ceb7){var _0x5857c6=require(_0x9700('0x87'));var _0x207d16={'raw':_0x45ceb7[_0x9700('0x81')][_0x9700('0x88')],'where':{}};var _0x1de894={};var _0x2a4dd1={'count':0x0,'rows':[]};var _0x4987bb=_0x45ceb7['query'][_0x9700('0x89')];var _0x3e694c=_0x45ceb7[_0x9700('0x81')][_0x9700('0x8a')]||![];var _0x37cbff=_0x50fb34(_0x4987bb,_0x3e694c);if(!_0x37cbff[_0x9700('0x15')])throw new Error(_0x9700('0x8b')+_0x4987bb+'\x27');var _0x267266=[{'name':_0x4987bb}];if(!_['isEmpty'](_0x37cbff['parentSections']))_0x267266=_0x37cbff[_0x9700('0x19')];var _0x25d514=[];for(var _0x162958=0x0;_0x162958<_0x267266[_0x9700('0x8c')];_0x162958++){_0x25d514[_0x9700('0x8d')](_0x159cef[_0x9700('0x8e')][_0x9700('0x8f')]({'where':{'userProfileId':_0x45ceb7[_0x9700('0x90')]['id'],'name':_0x267266[_0x162958][_0x9700('0xd')]},'raw':!![]}));}return Promise[_0x9700('0x91')](_0x25d514)[_0x9700('0xc')](function(_0x5973eb){var _0x42aaaa=_[_0x9700('0x4')](_0x5973eb,function(_0x5dadd4){return _0x5dadd4?_0x5dadd4:undefined;});var _0x19b1c7=_['filter'](_0x267266,[_0x9700('0x92'),!![]]);var _0x3a74ce=_[_0x9700('0x93')](_0x42aaaa)&&_[_0x9700('0x93')](_0x19b1c7)?null:_[_0x9700('0x94')](_0x19b1c7,_0x42aaaa);if(!_0x3a74ce)return null;var _0x3426a5=[];for(var _0x9139b=0x0;_0x9139b<_0x3a74ce[_0x9700('0x8c')];_0x9139b++){var _0xcdfae7=_[_0x9700('0x8f')](_0x267266,function(_0x17e254){return _0x3a74ce[_0x9139b]?_0x17e254[_0x9700('0xd')]===_0x3a74ce[_0x9139b][_0x9700('0xd')]:null;});if(_0xcdfae7){if(_0x3a74ce[_0x9139b][_0x9700('0x92')]){_0x3426a5[_0x9700('0x8d')](_0x1b64a9(_0x37cbff['childModel'],_0x3a74ce[_0x9139b]));}else{if(!_0x3a74ce[_0x9139b]['autoAssociation']){_0x3426a5[_0x9700('0x8d')](_0x29596e(_0xcdfae7,_0x3a74ce[_0x9139b],_0x37cbff['childModel']));}else{if(_0xcdfae7[_0x9700('0xb')]){_0x3426a5[_0x9700('0x8d')](_0x4d7592(_0xcdfae7,_0x3a74ce[_0x9139b]));}}}}}return Promise[_0x9700('0x91')](_0x3426a5);})[_0x9700('0xc')](function(_0x1de75a){var _0x55dc70=_0x1de75a;var _0x81c797=null;if(_0x55dc70){_0x81c797=_0x55dc70[_0x9700('0x8c')]===0x1?_0x55dc70[0x0]:null;}if(!_0x81c797&&!_0x55dc70)return _0x2a4dd1;var _0x9ca2ce=_0x159cef[_0x37cbff[_0x9700('0x15')]][_0x9700('0x95')];_0x1de894[_0x9700('0xb')]=_[_0x9700('0x96')](_0x9ca2ce);_0x1de894[_0x9700('0x81')]=_[_0x9700('0x96')](_0x45ceb7[_0x9700('0x81')]);_0x1de894[_0x9700('0x97')]=_[_0x9700('0x98')](_0x1de894['model'],_0x1de894[_0x9700('0x81')]);_0x207d16[_0x9700('0x99')]=_[_0x9700('0x98')](_0x1de894[_0x9700('0xb')],_0x5857c6[_0x9700('0x9a')](_0x45ceb7[_0x9700('0x81')][_0x9700('0x9a')]));_0x207d16['attributes']=_0x207d16[_0x9700('0x99')][_0x9700('0x8c')]?_0x207d16[_0x9700('0x99')]:_0x1de894['model'];if(!_0x45ceb7[_0x9700('0x81')][_0x9700('0x9b')](_0x9700('0x9c'))){_0x207d16[_0x9700('0x9d')]=_0x5857c6['limit'](_0x45ceb7[_0x9700('0x81')][_0x9700('0x9d')]);_0x207d16['offset']=_0x5857c6['offset'](_0x45ceb7[_0x9700('0x81')][_0x9700('0x9e')]);}_0x207d16[_0x9700('0x9f')]=_0x5857c6[_0x9700('0xa0')](_0x45ceb7[_0x9700('0x81')][_0x9700('0xa0')]);_0x207d16[_0x9700('0x7e')]=_0x5857c6[_0x9700('0x97')](_[_0x9700('0xa1')](_0x45ceb7['query'],_0x1de894[_0x9700('0x97')]));if(_0x45ceb7[_0x9700('0x81')][_0x9700('0x4')]){_0x207d16[_0x9700('0x7e')]=_[_0x9700('0xa2')](_0x207d16[_0x9700('0x7e')],{'$or':_[_0x9700('0x9')](_0x9ca2ce,function(_0x56a5a5){if(_0x56a5a5[_0x9700('0x11')]['key']!==_0x9700('0xa3')){var _0x1bd7d1={};_0x1bd7d1[_0x56a5a5[_0x9700('0x5')]]={'$like':'%'+_0x45ceb7[_0x9700('0x81')][_0x9700('0x4')]+'%'};return _0x1bd7d1;}})});}var _0x311a26=[];var _0x40191e=null;var _0x527633={};if(_0x81c797){_0x40191e=_['find'](_0x267266,[_0x9700('0xd'),_0x81c797[_0x9700('0xd')]]);if(_0x40191e[_0x9700('0x5')]){_0x527633={};if(_0x37cbff[_0x9700('0x15')]==='AnalyticExtractedReport'){_0x527633[_0x40191e[_0x9700('0xa4')]]=_[_0x9700('0x9')](_0x81c797['associatedResources'],'id');}else{_0x527633[_0x40191e['foreignKey']]=_0x81c797[_0x9700('0x8')];}_0x311a26[_0x9700('0x8d')](_0x527633);}else{_0x207d16[_0x9700('0x7e')]['id']=_0x81c797[_0x9700('0x8')];}}else{for(var _0x48daba=0x0;_0x48daba<_0x55dc70[_0x9700('0x8c')];_0x48daba++){_0x40191e=_['find'](_0x267266,['name',_0x55dc70[_0x48daba][_0x9700('0xd')]]);if(_0x40191e[_0x9700('0x5')]){_0x527633={};_0x527633[_0x40191e[_0x9700('0xa4')]]=_0x55dc70[_0x48daba][_0x9700('0x8')];_0x311a26[_0x9700('0x8d')](_0x527633);}else{if(!_0x207d16[_0x9700('0x7e')]['id'])_0x207d16['where']['id']=[];_0x55dc70[_0x48daba]['associatedResources']['forEach'](function(_0x2700b6){_0x207d16[_0x9700('0x7e')]['id']['push'](_0x2700b6);});}}}if(!_[_0x9700('0x93')](_0x311a26)){_0x207d16[_0x9700('0x7e')]=_[_0x9700('0xa2')](_0x207d16['where'],{'$and':{'$or':_0x311a26}});}_0x207d16=_[_0x9700('0xa2')]({},_0x207d16,_0x45ceb7['options']);if(_0x81c797&&!_0x81c797[_0x9700('0xa5')]&&_0x37cbff[_0x9700('0x15')]===_0x9700('0x10')){if(_0x45ceb7[_0x9700('0x81')][_0x9700('0xa6')]){_0x207d16[_0x9700('0xa7')]=[{'all':!![]}];}return _0x159cef[_0x37cbff[_0x9700('0x15')]]['findAll'](_0x207d16)[_0x9700('0xc')](function(_0x21f8f9){var _0x1c158a=[];_0x21f8f9[_0x9700('0xa8')](function(_0xd5c9df){var _0x4afa6e;switch(_0xd5c9df['reportType']){case _0x9700('0xa9'):_0x4afa6e=_['find'](_0x81c797[_0x9700('0x8')],function(_0x21e6af){return _0x21e6af['id']===_0xd5c9df['reportId']&&_0x21e6af[_0x9700('0x11')]==='DefaultReports';});break;case _0x9700('0xaa'):_0x4afa6e=_['find'](_0x81c797['associatedResources'],function(_0x1bfc06){return _0x1bfc06['id']===_0xd5c9df['reportId']&&_0x1bfc06[_0x9700('0x11')]===_0x9700('0xab');});break;}if(_0x4afa6e)_0x1c158a[_0x9700('0x8d')](_0xd5c9df);});_0x2a4dd1[_0x9700('0xac')]=_0x1c158a[_0x9700('0x8c')];_0x2a4dd1['rows']=_0x1c158a;return _0x2a4dd1;});}else{if(!_['isEmpty'](_0x45ceb7[_0x9700('0x81')][_0x9700('0xad')])){_0x207d16[_0x9700('0x7e')]['id']=_0x207d16['where']['id']?_['intersection'](_0x207d16[_0x9700('0x7e')]['id'],_0x45ceb7[_0x9700('0x81')][_0x9700('0xad')]):_0x45ceb7[_0x9700('0x81')]['ids'];if(_0x45ceb7[_0x9700('0x81')][_0x9700('0xae')]){_0x207d16[_0x9700('0x9f')]=_0x45ceb7[_0x9700('0x81')][_0x9700('0xae')];}}if(_0x45ceb7[_0x9700('0x81')][_0x9700('0xaf')]){_0x207d16[_0x9700('0x7e')]=_[_0x9700('0xa2')](_0x207d16[_0x9700('0x7e')],{'$and':_0x45ceb7[_0x9700('0x81')][_0x9700('0xaf')]});}return _0x159cef[_0x37cbff['childModel']][_0x9700('0xac')]({'where':_0x207d16['where']})[_0x9700('0xc')](function(_0x327f6e){_0x2a4dd1[_0x9700('0xac')]=_0x327f6e;if(_0x45ceb7['query'][_0x9700('0xa6')]){if(_0x37cbff[_0x9700('0x15')]===_0x9700('0x1d')){_0x207d16[_0x9700('0xa7')]=[{'model':_0x159cef['Tag'],'as':_0x9700('0xb0'),'attributes':['id',_0x9700('0xd'),_0x9700('0xb1')],'required':_0x45ceb7[_0x9700('0x81')][_0x9700('0xb2')]?!![]:![]},{'model':_0x159cef[_0x9700('0x6d')],'as':'ThroughTags','attributes':['id',_0x9700('0xd'),'color'],'through':_0x45ceb7[_0x9700('0x81')][_0x9700('0xb2')]?{'attributes':[],'where':{'TagId':_0x45ceb7[_0x9700('0x81')][_0x9700('0xb2')]||undefined}}:{},'required':_0x45ceb7[_0x9700('0x81')]['tag']?!![]:![]}];}else{_0x207d16[_0x9700('0xa7')]=[{'all':!![]}];}}return _0x159cef[_0x37cbff[_0x9700('0x15')]]['findAll'](_0x207d16);})['then'](function(_0x108aff){_0x2a4dd1['rows']=_0x108aff;if(_0x4987bb===_0x9700('0x2f')&&_0x45ceb7[_0x9700('0x81')]['openTabs']===_0x9700('0xb3')){var _0x57d64c=[];for(var _0xb719e5=0x0;_0xb719e5<_0x2a4dd1[_0x9700('0xb4')][_0x9700('0x8c')];_0xb719e5++){_0x57d64c[_0x9700('0x8d')](_0x49f69e(_0x9700('0xb5'),_0x2a4dd1[_0x9700('0xb4')][_0xb719e5][_0x9700('0xb6')]));_0x57d64c[_0x9700('0x8d')](_0x49f69e(_0x9700('0xb7'),_0x2a4dd1[_0x9700('0xb4')][_0xb719e5]['dataValues']));_0x57d64c[_0x9700('0x8d')](_0x49f69e(_0x9700('0xb8'),_0x2a4dd1[_0x9700('0xb4')][_0xb719e5][_0x9700('0xb6')]));_0x57d64c[_0x9700('0x8d')](_0x49f69e(_0x9700('0xb9'),_0x2a4dd1[_0x9700('0xb4')][_0xb719e5][_0x9700('0xb6')]));_0x57d64c[_0x9700('0x8d')](_0x49f69e('openchannel',_0x2a4dd1['rows'][_0xb719e5][_0x9700('0xb6')]));_0x57d64c[_0x9700('0x8d')](_0x49f69e(_0x9700('0xba'),_0x2a4dd1[_0x9700('0xb4')][_0xb719e5]['dataValues']));}return Promise[_0x9700('0x91')](_0x57d64c)[_0x9700('0xc')](function(){return _0x2a4dd1;});}return _0x2a4dd1;});}});}}});}; \ No newline at end of file +var _0xe5dd=['limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','include','default','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','Tags','tag','ThroughTags','true','chat','dataValues','sms','fax','openchannel','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','model','name','resolve','UserProfileResource','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','projects','JscriptyProject','contacts','CmContact','parentSections','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','role','Telephones','membername','User','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','type','outbound','musiconholds','VoiceChanSpy','voiceprefixes','VoicePrefix','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','users','Users','admin','user','zendeskaccounts','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','Interval','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','trunks','Trunk','Variable','Plugin','AnalyticExtractedReport','reportId','metrics','AnalyticMetric','toUpperCase','QueryTypes','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','sequelize','query','OpenTabs','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','isEmpty','autoAssociation','rawAttributes','keys','filters','attributes','intersection','fields'];(function(_0x593893,_0x288a73){var _0x2ed926=function(_0x3886e1){while(--_0x3886e1){_0x593893['push'](_0x593893['shift']());}};_0x2ed926(++_0x288a73);}(_0xe5dd,0xd1));var _0xde5d=function(_0x1a6753,_0x42455d){_0x1a6753=_0x1a6753-0x0;var _0x404a8e=_0xe5dd[_0x1a6753];return _0x404a8e;};'use strict';var _=require(_0xde5d('0x0'));var attributes=require(_0xde5d('0x1'));var squel=require(_0xde5d('0x2'));module[_0xde5d('0x3')]=function(_0x46a1e6){var _0x500759=_0x46a1e6[_0xde5d('0x4')];function _0x5caa39(_0x419bbb,_0x27a63b){return new Promise(function(_0x2ae5f9,_0x59450a){if(!_0x27a63b)return _0x2ae5f9(null);var _0x3d2cb0=_0x27a63b['filter']?{[_0x27a63b[_0xde5d('0x5')][_0xde5d('0x6')]]:_0x27a63b[_0xde5d('0x5')][_0xde5d('0x7')]}:undefined;return _0x500759[_0x419bbb][_0xde5d('0x8')]({'where':_0x3d2cb0,'raw':!![]})[_0xde5d('0x9')](function(_0xbf442a){_0x27a63b[_0xde5d('0xa')]=_[_0xde5d('0xb')](_0xbf442a,'id');_0x2ae5f9(_0x27a63b);})[_0xde5d('0xc')](function(_0x45b5b1){_0x59450a(_0x45b5b1);});});}function _0x264086(_0x17ced3,_0x4152cb){return new Promise(function(_0xa8e3e3,_0x1da379){var _0x19f8ed=_0x17ced3['filter']?{[_0x17ced3['filter']['field']]:_0x17ced3[_0xde5d('0x5')][_0xde5d('0x7')]}:undefined;return _0x500759[_0x17ced3[_0xde5d('0xd')]]['findAll']({'where':_0x19f8ed,'raw':!![]})[_0xde5d('0x9')](function(_0x4a3371){_0x4152cb['associatedResources']=_['map'](_0x4a3371,function(_0x55df39){return _0x55df39[_0xde5d('0xe')];});_0xa8e3e3(_0x4152cb);})[_0xde5d('0xc')](function(_0x32aac5){_0x1da379(_0x32aac5);});});}function _0x5594b2(_0x1be44e,_0x2f0a61,_0x3f5caf){if(!_0x2f0a61)return Promise[_0xde5d('0xf')](null);return new Promise(function(_0x4e7469,_0xcc04de){return _0x500759[_0xde5d('0x10')][_0xde5d('0x8')]({'where':{'sectionId':_0x2f0a61['id']},'raw':!![]})[_0xde5d('0x9')](function(_0x52f578){if(_0x1be44e[_0xde5d('0x6')]&&_0x1be44e[_0xde5d('0x6')]!=='id'){_0x2f0a61['associatedResources']=_[_0xde5d('0xb')](_0x52f578,function(_0x593058){return _0x593058[_0x1be44e[_0xde5d('0x6')]];});}else{if(_0x3f5caf==='AnalyticExtractedReport'){_0x2f0a61[_0xde5d('0xa')]=_['map'](_0x52f578,function(_0x3ab403){return{'id':_0x3ab403['resourceId'],'type':_0x3ab403['type']};});}else{_0x2f0a61[_0xde5d('0xa')]=_[_0xde5d('0xb')](_0x52f578,function(_0x249008){return _0x249008[_0xde5d('0x11')];});}}_0x4e7469(_0x2f0a61);})[_0xde5d('0xc')](function(_0x3ffb46){_0xcc04de(_0x3ffb46);});});}function _0x560c96(_0x3fa2f3,_0x341cfe){var _0x5b3495={'parentSections':[]};switch(_0x3fa2f3[_0xde5d('0x12')]()){case _0xde5d('0x13'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x15');break;case _0xde5d('0x16'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x17');break;case'squarerecordings':_0x5b3495[_0xde5d('0x14')]='SquareRecording';_0x5b3495['parentSections']=[{'name':'SquareProjects','field':_0xde5d('0xe'),'foreignKey':'projectName'}];break;case _0xde5d('0x18'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x19');break;case _0xde5d('0x1a'):_0x5b3495['childModel']=_0xde5d('0x1b');_0x5b3495[_0xde5d('0x1c')]=[{'name':_0xde5d('0x1d'),'field':'id','foreignKey':_0xde5d('0x1e')}];break;case _0xde5d('0x1f'):_0x5b3495[_0xde5d('0x14')]='CmList';break;case _0xde5d('0x20'):_0x5b3495['childModel']=_0xde5d('0x21');break;case _0xde5d('0x22'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x23');break;case'chatqueues':_0x5b3495['childModel']=_0xde5d('0x24');break;case _0xde5d('0x25'):_0x5b3495['childModel']=_0xde5d('0x26');break;case _0xde5d('0x27'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x28');break;case'faxaccounts':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x29');break;case _0xde5d('0x2a'):case'internalroutes':case'outboundroutes':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x2b');break;case'contexts':_0x5b3495['childModel']=_0xde5d('0x2c');break;case _0xde5d('0x2d'):_0x5b3495['childModel']=_0xde5d('0x2e');break;case _0xde5d('0x2f'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x30');_0x5b3495[_0xde5d('0x1c')]=[{'name':_0xde5d('0x31'),'field':'name','foreignKey':'membername','model':'User','filter':{'field':_0xde5d('0x32'),'value':['agent']}},{'name':_0xde5d('0x33'),'field':_0xde5d('0xe'),'foreignKey':_0xde5d('0x34'),'model':_0xde5d('0x35'),'filter':{'field':_0xde5d('0x32'),'value':[_0xde5d('0x36')]}},{'name':_0xde5d('0x37'),'field':_0xde5d('0xe'),'foreignKey':_0xde5d('0x38'),'model':_0xde5d('0x39'),'filter':{'field':'type','value':['inbound']}},{'name':_0xde5d('0x3a'),'field':_0xde5d('0xe'),'foreignKey':_0xde5d('0x38'),'model':_0xde5d('0x39'),'filter':{'field':_0xde5d('0x3b'),'value':[_0xde5d('0x3c')]}}];break;case _0xde5d('0x3d'):_0x5b3495[_0xde5d('0x14')]='VoiceMusicOnHold';break;case'chanspies':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x3e');break;case _0xde5d('0x3f'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x40');break;case'ivrcampaigns':_0x5b3495['childModel']='Campaign';break;case _0xde5d('0x41'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x42');break;case _0xde5d('0x43'):_0x5b3495[_0xde5d('0x14')]='MailAccount';break;case _0xde5d('0x44'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x45');break;case _0xde5d('0x46'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x47');break;case _0xde5d('0x48'):_0x5b3495[_0xde5d('0x14')]='OpenchannelAccount';break;case _0xde5d('0x49'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x4a');break;case _0xde5d('0x4b'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x4c');break;case _0xde5d('0x4d'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x4e');break;case _0xde5d('0x4f'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x50');break;case'teams':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x51');break;case _0xde5d('0x52'):case _0xde5d('0x53'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x39');if(_0x341cfe){_0x5b3495[_0xde5d('0x1c')]=[{'name':'VoiceQueues'},{'name':_0xde5d('0x3a')}];}break;case _0xde5d('0x54'):case'agents':case'telephones':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x35');if(_0x341cfe){_0x5b3495[_0xde5d('0x1c')]=[{'name':_0xde5d('0x55'),'filter':{'field':'role','value':[_0xde5d('0x56'),_0xde5d('0x57')]},'ignore':!![]},{'name':'Agents'},{'name':_0xde5d('0x33')}];}break;case _0xde5d('0x58'):_0x5b3495[_0xde5d('0x14')]='ZendeskAccount';break;case _0xde5d('0x59'):_0x5b3495['childModel']='SalesforceAccount';break;case _0xde5d('0x5a'):_0x5b3495[_0xde5d('0x14')]='FreshdeskAccount';break;case _0xde5d('0x5b'):_0x5b3495['childModel']='SugarcrmAccount';break;case _0xde5d('0x5c'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x5d');break;case _0xde5d('0x5e'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x5f');break;case _0xde5d('0x60'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x35');break;case _0xde5d('0x61'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x62');break;case'dispositions':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x63');break;case _0xde5d('0x64'):_0x5b3495[_0xde5d('0x14')]='Dashboard';break;case _0xde5d('0x65'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x66');break;case'pauses':_0x5b3495[_0xde5d('0x14')]='Pause';break;case'scheduler':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x67');break;case _0xde5d('0x68'):_0x5b3495['childModel']=_0xde5d('0x69');break;case _0xde5d('0x6a'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x6b');break;case _0xde5d('0x6c'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x6d');break;case _0xde5d('0x6e'):_0x5b3495[_0xde5d('0x14')]='Trigger';break;case _0xde5d('0x6f'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x70');break;case'variables':_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x71');break;case'plugins':_0x5b3495['childModel']=_0xde5d('0x72');break;case'extractedreports':_0x5b3495['childModel']=_0xde5d('0x73');_0x5b3495[_0xde5d('0x1c')]=[{'name':'Reports','field':'id','foreignKey':_0xde5d('0x74')}];break;case _0xde5d('0x75'):_0x5b3495[_0xde5d('0x14')]=_0xde5d('0x76');break;}return _0x5b3495;}function _0x50928c(_0x4c314c,_0x38f8a0){var _0x404840=_0x4c314c['charAt'](0x0)[_0xde5d('0x77')]()+_0x4c314c['slice'](0x1);var _0x530458={'type':_0x500759['Sequelize'][_0xde5d('0x78')]['SELECT'],'raw':!![]};return new Promise(function(_0x4872a7,_0x250912){var _0x21fe19=squel[_0xde5d('0x79')]()[_0xde5d('0x6')](_0xde5d('0x7a')+_0x404840+_0xde5d('0x7b'),'id')['field'](_0xde5d('0x7c'))['from'](_0xde5d('0x7d')+_0x4c314c+_0xde5d('0x7e'),'ui')[_0xde5d('0x7f')]('ui.UserId\x20=\x20?',_0x38f8a0['id']);return _0x500759[_0xde5d('0x80')][_0xde5d('0x81')](_0x21fe19['toString'](),_0x530458)[_0xde5d('0x9')](function(_0x50f2bd){_0x38f8a0[_0x404840+_0xde5d('0x82')]=_0x50f2bd;_0x4872a7(_0x50f2bd);})[_0xde5d('0xc')](function(_0x170e03){_0x250912(_0x170e03);});});}return _0x46a1e6['define']('UserProfile',attributes,{'tableName':_0xde5d('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x50a1ec){var _0x3a978b=require(_0xde5d('0x84'));var _0x23caad={'raw':_0x50a1ec['query'][_0xde5d('0x85')],'where':{}};var _0x48ea19={};var _0x1dfbaa={'count':0x0,'rows':[]};var _0x31d8c1=_0x50a1ec[_0xde5d('0x81')][_0xde5d('0x86')];var _0x56f887=_0x50a1ec['query'][_0xde5d('0x87')]||![];var _0x4869ca=_0x560c96(_0x31d8c1,_0x56f887);if(!_0x4869ca['childModel'])throw new Error(_0xde5d('0x88')+_0x31d8c1+'\x27');var _0x243dcd=[{'name':_0x31d8c1}];if(!_['isEmpty'](_0x4869ca[_0xde5d('0x1c')]))_0x243dcd=_0x4869ca[_0xde5d('0x1c')];var _0x440faf=[];for(var _0xfd2e26=0x0;_0xfd2e26<_0x243dcd[_0xde5d('0x89')];_0xfd2e26++){_0x440faf[_0xde5d('0x8a')](_0x500759[_0xde5d('0x8b')][_0xde5d('0x8c')]({'where':{'userProfileId':_0x50a1ec[_0xde5d('0x8d')]['id'],'name':_0x243dcd[_0xfd2e26][_0xde5d('0xe')]},'raw':!![]}));}return Promise[_0xde5d('0x8e')](_0x440faf)[_0xde5d('0x9')](function(_0x358130){var _0x4fabee=_[_0xde5d('0x5')](_0x358130,function(_0x322aa5){return _0x322aa5?_0x322aa5:undefined;});var _0x43a707=_[_0xde5d('0x5')](_0x243dcd,['ignore',!![]]);var _0x5e3dd5=_[_0xde5d('0x8f')](_0x4fabee)&&_[_0xde5d('0x8f')](_0x43a707)?null:_['union'](_0x43a707,_0x4fabee);if(!_0x5e3dd5)return null;var _0x2d2bf9=[];for(var _0x1cfc90=0x0;_0x1cfc90<_0x5e3dd5[_0xde5d('0x89')];_0x1cfc90++){var _0xcac546=_[_0xde5d('0x8c')](_0x243dcd,function(_0x303a87){return _0x5e3dd5[_0x1cfc90]?_0x303a87['name']===_0x5e3dd5[_0x1cfc90][_0xde5d('0xe')]:null;});if(_0xcac546){if(_0x5e3dd5[_0x1cfc90]['ignore']){_0x2d2bf9[_0xde5d('0x8a')](_0x5caa39(_0x4869ca[_0xde5d('0x14')],_0x5e3dd5[_0x1cfc90]));}else{if(!_0x5e3dd5[_0x1cfc90][_0xde5d('0x90')]){_0x2d2bf9['push'](_0x5594b2(_0xcac546,_0x5e3dd5[_0x1cfc90],_0x4869ca['childModel']));}else{if(_0xcac546['model']){_0x2d2bf9[_0xde5d('0x8a')](_0x264086(_0xcac546,_0x5e3dd5[_0x1cfc90]));}}}}}return Promise[_0xde5d('0x8e')](_0x2d2bf9);})[_0xde5d('0x9')](function(_0x4866d9){var _0x241bf5=_0x4866d9;var _0x340503=null;if(_0x241bf5){_0x340503=_0x241bf5[_0xde5d('0x89')]===0x1?_0x241bf5[0x0]:null;}if(!_0x340503&&!_0x241bf5)return _0x1dfbaa;var _0x4ef289=_0x500759[_0x4869ca[_0xde5d('0x14')]][_0xde5d('0x91')];_0x48ea19[_0xde5d('0xd')]=_[_0xde5d('0x92')](_0x4ef289);_0x48ea19[_0xde5d('0x81')]=_[_0xde5d('0x92')](_0x50a1ec['query']);_0x48ea19[_0xde5d('0x93')]=_['intersection'](_0x48ea19[_0xde5d('0xd')],_0x48ea19[_0xde5d('0x81')]);_0x23caad[_0xde5d('0x94')]=_[_0xde5d('0x95')](_0x48ea19['model'],_0x3a978b['fields'](_0x50a1ec['query'][_0xde5d('0x96')]));_0x23caad['attributes']=_0x23caad['attributes'][_0xde5d('0x89')]?_0x23caad['attributes']:_0x48ea19[_0xde5d('0xd')];if(!_0x50a1ec[_0xde5d('0x81')]['hasOwnProperty']('nolimit')){_0x23caad[_0xde5d('0x97')]=_0x3a978b[_0xde5d('0x97')](_0x50a1ec[_0xde5d('0x81')][_0xde5d('0x97')]);_0x23caad[_0xde5d('0x98')]=_0x3a978b[_0xde5d('0x98')](_0x50a1ec[_0xde5d('0x81')]['offset']);}_0x23caad[_0xde5d('0x99')]=_0x3a978b[_0xde5d('0x9a')](_0x50a1ec[_0xde5d('0x81')]['sort']);_0x23caad['where']=_0x3a978b['filters'](_[_0xde5d('0x9b')](_0x50a1ec['query'],_0x48ea19['filters']));if(_0x50a1ec[_0xde5d('0x81')][_0xde5d('0x5')]){_0x23caad[_0xde5d('0x7f')]=_['merge'](_0x23caad[_0xde5d('0x7f')],{'$or':_[_0xde5d('0xb')](_0x4ef289,function(_0x3e4e9e){if(_0x3e4e9e[_0xde5d('0x3b')][_0xde5d('0x9c')]!==_0xde5d('0x9d')){var _0x48368a={};_0x48368a[_0x3e4e9e[_0xde5d('0x6')]]={'$like':'%'+_0x50a1ec['query']['filter']+'%'};return _0x48368a;}})});}var _0x5c0cad=[];var _0x2561a6=null;var _0x5e6b4c={};if(_0x340503){_0x2561a6=_[_0xde5d('0x8c')](_0x243dcd,[_0xde5d('0xe'),_0x340503[_0xde5d('0xe')]]);if(_0x2561a6[_0xde5d('0x6')]){_0x5e6b4c={};if(_0x4869ca['childModel']===_0xde5d('0x73')){_0x5e6b4c[_0x2561a6[_0xde5d('0x9e')]]=_[_0xde5d('0xb')](_0x340503[_0xde5d('0xa')],'id');}else{_0x5e6b4c[_0x2561a6[_0xde5d('0x9e')]]=_0x340503[_0xde5d('0xa')];}_0x5c0cad['push'](_0x5e6b4c);}else{_0x23caad[_0xde5d('0x7f')]['id']=_0x340503[_0xde5d('0xa')];}}else{for(var _0x77632d=0x0;_0x77632d<_0x241bf5['length'];_0x77632d++){_0x2561a6=_[_0xde5d('0x8c')](_0x243dcd,[_0xde5d('0xe'),_0x241bf5[_0x77632d]['name']]);if(_0x2561a6[_0xde5d('0x6')]){_0x5e6b4c={};_0x5e6b4c[_0x2561a6['foreignKey']]=_0x241bf5[_0x77632d][_0xde5d('0xa')];_0x5c0cad['push'](_0x5e6b4c);}else{if(!_0x23caad['where']['id'])_0x23caad['where']['id']=[];_0x241bf5[_0x77632d][_0xde5d('0xa')][_0xde5d('0x9f')](function(_0xc5ae0f){_0x23caad[_0xde5d('0x7f')]['id'][_0xde5d('0x8a')](_0xc5ae0f);});}}}if(!_[_0xde5d('0x8f')](_0x5c0cad)){_0x23caad['where']=_['merge'](_0x23caad[_0xde5d('0x7f')],{'$and':{'$or':_0x5c0cad}});}_0x23caad=_[_0xde5d('0xa0')]({},_0x23caad,_0x50a1ec['options']);if(_0x340503&&!_0x340503['autoAssociation']&&_0x4869ca[_0xde5d('0x14')]===_0xde5d('0x73')){if(_0x50a1ec['query']['includeAll']){_0x23caad[_0xde5d('0xa1')]=[{'all':!![]}];}return _0x500759[_0x4869ca['childModel']][_0xde5d('0x8')](_0x23caad)['then'](function(_0x27d476){var _0x115c0b=[];_0x27d476[_0xde5d('0x9f')](function(_0x374fed){var _0x3811e2;switch(_0x374fed['reportType']){case _0xde5d('0xa2'):_0x3811e2=_[_0xde5d('0x8c')](_0x340503[_0xde5d('0xa')],function(_0x1870d8){return _0x1870d8['id']===_0x374fed['reportId']&&_0x1870d8[_0xde5d('0x3b')]===_0xde5d('0xa3');});break;case _0xde5d('0xa4'):_0x3811e2=_[_0xde5d('0x8c')](_0x340503[_0xde5d('0xa')],function(_0x437a55){return _0x437a55['id']===_0x374fed[_0xde5d('0x74')]&&_0x437a55[_0xde5d('0x3b')]===_0xde5d('0xa5');});break;}if(_0x3811e2)_0x115c0b['push'](_0x374fed);});_0x1dfbaa['count']=_0x115c0b[_0xde5d('0x89')];_0x1dfbaa[_0xde5d('0xa6')]=_0x115c0b;return _0x1dfbaa;});}else{if(!_[_0xde5d('0x8f')](_0x50a1ec[_0xde5d('0x81')][_0xde5d('0xa7')])){_0x23caad[_0xde5d('0x7f')]['id']=_0x23caad[_0xde5d('0x7f')]['id']?_[_0xde5d('0x95')](_0x23caad[_0xde5d('0x7f')]['id'],_0x50a1ec[_0xde5d('0x81')]['ids']):_0x50a1ec['query'][_0xde5d('0xa7')];if(_0x50a1ec[_0xde5d('0x81')][_0xde5d('0xa8')]){_0x23caad['order']=_0x50a1ec['query']['customSorting'];}}if(_0x50a1ec[_0xde5d('0x81')]['extraQueryConditions']){_0x23caad['where']=_['merge'](_0x23caad[_0xde5d('0x7f')],{'$and':_0x50a1ec['query'][_0xde5d('0xa9')]});}return _0x500759[_0x4869ca['childModel']][_0xde5d('0xaa')]({'where':_0x23caad[_0xde5d('0x7f')]})[_0xde5d('0x9')](function(_0x27582b){_0x1dfbaa[_0xde5d('0xaa')]=_0x27582b;if(_0x50a1ec[_0xde5d('0x81')]['includeAll']){if(_0x4869ca[_0xde5d('0x14')]===_0xde5d('0x1b')){_0x23caad[_0xde5d('0xa1')]=[{'model':_0x500759['Tag'],'as':_0xde5d('0xab'),'attributes':['id',_0xde5d('0xe'),'color'],'required':_0x50a1ec[_0xde5d('0x81')][_0xde5d('0xac')]?!![]:![]},{'model':_0x500759[_0xde5d('0x6b')],'as':_0xde5d('0xad'),'attributes':['id',_0xde5d('0xe'),'color'],'through':_0x50a1ec['query'][_0xde5d('0xac')]?{'attributes':[],'where':{'TagId':_0x50a1ec[_0xde5d('0x81')][_0xde5d('0xac')]||undefined}}:{},'required':_0x50a1ec[_0xde5d('0x81')][_0xde5d('0xac')]?!![]:![]}];}else{_0x23caad[_0xde5d('0xa1')]=[{'all':!![]}];}}return _0x500759[_0x4869ca['childModel']][_0xde5d('0x8')](_0x23caad);})[_0xde5d('0x9')](function(_0x23b5b8){_0x1dfbaa[_0xde5d('0xa6')]=_0x23b5b8;if(_0x31d8c1===_0xde5d('0x31')&&_0x50a1ec['query']['openTabs']===_0xde5d('0xae')){var _0x5cbf19=[];for(var _0x36c9f8=0x0;_0x36c9f8<_0x1dfbaa[_0xde5d('0xa6')][_0xde5d('0x89')];_0x36c9f8++){_0x5cbf19[_0xde5d('0x8a')](_0x50928c(_0xde5d('0xaf'),_0x1dfbaa[_0xde5d('0xa6')][_0x36c9f8][_0xde5d('0xb0')]));_0x5cbf19[_0xde5d('0x8a')](_0x50928c(_0xde5d('0xb1'),_0x1dfbaa[_0xde5d('0xa6')][_0x36c9f8]['dataValues']));_0x5cbf19[_0xde5d('0x8a')](_0x50928c(_0xde5d('0xb2'),_0x1dfbaa[_0xde5d('0xa6')][_0x36c9f8][_0xde5d('0xb0')]));_0x5cbf19[_0xde5d('0x8a')](_0x50928c('mail',_0x1dfbaa['rows'][_0x36c9f8][_0xde5d('0xb0')]));_0x5cbf19[_0xde5d('0x8a')](_0x50928c(_0xde5d('0xb3'),_0x1dfbaa[_0xde5d('0xa6')][_0x36c9f8]['dataValues']));_0x5cbf19[_0xde5d('0x8a')](_0x50928c('whatsapp',_0x1dfbaa[_0xde5d('0xa6')][_0x36c9f8][_0xde5d('0xb0')]));}return Promise[_0xde5d('0x8e')](_0x5cbf19)[_0xde5d('0x9')](function(){return _0x1dfbaa;});}return _0x1dfbaa;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 917def4..81b3d32 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 _0x496e=['info','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x496e,0x1a0));var _0xe496=function(_0x32ba54,_0x2f21c9){_0x32ba54=_0x32ba54-0x0;var _0x309210=_0x496e[_0x32ba54];return _0x309210;};'use strict';var _=require('lodash');var util=require(_0xe496('0x0'));var moment=require(_0xe496('0x1'));var BPromise=require(_0xe496('0x2'));var rs=require(_0xe496('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe496('0x4'))('rpc');var config=require(_0xe496('0x5'));var jayson=require(_0xe496('0x6'));var client=jayson[_0xe496('0x7')][_0xe496('0x8')]({'port':0x232a});config[_0xe496('0x9')]=_[_0xe496('0xa')](config[_0xe496('0x9')],{'host':_0xe496('0xb'),'port':0x18eb});var socket=require(_0xe496('0xc'))(new Redis(config[_0xe496('0x9')]));require(_0xe496('0xd'))['register'](socket);function respondWithRpcPromise(_0x4a4caa,_0x37c55b,_0x5ca4d4){return new BPromise(function(_0x2e679b,_0x44936f){return client[_0xe496('0xe')](_0x4a4caa,_0x5ca4d4)[_0xe496('0xf')](function(_0x19d4fa){logger[_0xe496('0x10')]('UserProfile,\x20%s,\x20%s',_0x37c55b,'request\x20sent');logger[_0xe496('0x11')](_0xe496('0x12'),_0x37c55b,'request\x20sent',JSON[_0xe496('0x13')](_0x19d4fa));if(_0x19d4fa[_0xe496('0x14')]){if(_0x19d4fa[_0xe496('0x14')][_0xe496('0x15')]===0x1f4){logger['error'](_0xe496('0x16'),_0x37c55b,_0x19d4fa['error'][_0xe496('0x17')]);return _0x44936f(_0x19d4fa['error'][_0xe496('0x17')]);}logger[_0xe496('0x14')](_0xe496('0x16'),_0x37c55b,_0x19d4fa[_0xe496('0x14')]['message']);return _0x2e679b(_0x19d4fa[_0xe496('0x14')][_0xe496('0x17')]);}else{logger['info'](_0xe496('0x16'),_0x37c55b,_0xe496('0x18'));_0x2e679b(_0x19d4fa[_0xe496('0x19')][_0xe496('0x17')]);}})[_0xe496('0x1a')](function(_0x25e42d){logger[_0xe496('0x14')](_0xe496('0x16'),_0x37c55b,_0x25e42d);_0x44936f(_0x25e42d);});});} \ No newline at end of file +var _0xbd0a=['http','redis','localhost','socket.io-emitter','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x265d25,_0xb3f665){var _0x45a789=function(_0x4220bf){while(--_0x4220bf){_0x265d25['push'](_0x265d25['shift']());}};_0x45a789(++_0xb3f665);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x2bd50d,_0xd96baf){_0x2bd50d=_0x2bd50d-0x0;var _0x1d5957=_0xbd0a[_0x2bd50d];return _0x1d5957;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var moment=require(_0xabd0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabd0('0x2'))['db'];var utils=require(_0xabd0('0x3'));var logger=require(_0xabd0('0x4'))(_0xabd0('0x5'));var config=require(_0xabd0('0x6'));var jayson=require(_0xabd0('0x7'));var client=jayson[_0xabd0('0x8')][_0xabd0('0x9')]({'port':0x232a});config[_0xabd0('0xa')]=_['defaults'](config[_0xabd0('0xa')],{'host':_0xabd0('0xb'),'port':0x18eb});var socket=require(_0xabd0('0xc'))(new Redis(config['redis']));require(_0xabd0('0xd'))['register'](socket);function respondWithRpcPromise(_0x151048,_0x23d4e4,_0x2c31c9){return new BPromise(function(_0x3dc0ab,_0x50fc2d){return client[_0xabd0('0xe')](_0x151048,_0x2c31c9)['then'](function(_0x1b78e2){logger[_0xabd0('0xf')](_0xabd0('0x10'),_0x23d4e4,_0xabd0('0x11'));logger[_0xabd0('0x12')](_0xabd0('0x13'),_0x23d4e4,'request\x20sent',JSON[_0xabd0('0x14')](_0x1b78e2));if(_0x1b78e2['error']){if(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x16')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x23d4e4,_0x1b78e2['error']['message']);return _0x50fc2d(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);}logger[_0xabd0('0x15')](_0xabd0('0x10'),_0x23d4e4,_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);return _0x3dc0ab(_0x1b78e2[_0xabd0('0x15')][_0xabd0('0x17')]);}else{logger[_0xabd0('0xf')]('UserProfile,\x20%s,\x20%s',_0x23d4e4,_0xabd0('0x11'));_0x3dc0ab(_0x1b78e2['result']['message']);}})[_0xabd0('0x18')](function(_0x391988){logger[_0xabd0('0x15')](_0xabd0('0x10'),_0x23d4e4,_0x391988);_0x50fc2d(_0x391988);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e2294a8..beb5e6a 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 _0x7b13=['register','userProfile:','save','remove','emit','removeListener'];(function(_0x20525e,_0xe542d6){var _0x134d04=function(_0x4e562e){while(--_0x4e562e){_0x20525e['push'](_0x20525e['shift']());}};_0x134d04(++_0xe542d6);}(_0x7b13,0x98));var _0x37b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b13[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x37b1('0x0'),_0x37b1('0x1'),'update'];function createListener(_0x225443,_0x5978ee){return function(_0xd8fcf5){_0x5978ee[_0x37b1('0x2')](_0x225443,_0xd8fcf5);};}function removeListener(_0x96edc2,_0x424610){return function(){UserProfileEvents[_0x37b1('0x3')](_0x96edc2,_0x424610);};}exports[_0x37b1('0x4')]=function(_0x2d71c4){for(var _0x4b6343=0x0,_0x76623=events['length'];_0x4b6343<_0x76623;_0x4b6343++){var _0x2a5542=events[_0x4b6343];var _0x55b8ea=createListener(_0x37b1('0x5')+_0x2a5542,_0x2d71c4);UserProfileEvents['on'](_0x2a5542,_0x55b8ea);}}; \ No newline at end of file +var _0x16c6=['update','emit','register','length','userProfile:','./userProfile.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16c6,0x186));var _0x616c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x16c6[_0x4a9fb1];return _0x348672;};'use strict';var UserProfileEvents=require(_0x616c('0x0'));var events=[_0x616c('0x1'),'remove',_0x616c('0x2')];function createListener(_0x2a42c8,_0x19fbf2){return function(_0x1b6638){_0x19fbf2[_0x616c('0x3')](_0x2a42c8,_0x1b6638);};}function removeListener(_0xe644e8,_0x1e0e05){return function(){UserProfileEvents['removeListener'](_0xe644e8,_0x1e0e05);};}exports[_0x616c('0x4')]=function(_0x10c19c){for(var _0x4335e5=0x0,_0x5bb72e=events[_0x616c('0x5')];_0x4335e5<_0x5bb72e;_0x4335e5++){var _0x567be5=events[_0x4335e5];var _0x45d55b=createListener(_0x616c('0x6')+_0x567be5,_0x10c19c);UserProfileEvents['on'](_0x567be5,_0x45d55b);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 7d528ab..fe9418c 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 _0x62f0=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete','exports','path','connect-timeout'];(function(_0x277cc3,_0x57f209){var _0x254e9e=function(_0x25164b){while(--_0x25164b){_0x277cc3['push'](_0x277cc3['shift']());}};_0x254e9e(++_0x57f209);}(_0x62f0,0x1ae));var _0x062f=function(_0x3eec42,_0x192ed2){_0x3eec42=_0x3eec42-0x0;var _0x110bf0=_0x62f0[_0x3eec42];return _0x110bf0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x062f('0x0'));var timeout=require(_0x062f('0x1'));var express=require(_0x062f('0x2'));var router=express[_0x062f('0x3')]();var fs_extra=require(_0x062f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x062f('0x5'));var config=require(_0x062f('0x6'));var controller=require(_0x062f('0x7'));router[_0x062f('0x8')]('/',auth[_0x062f('0x9')](),controller['index']);router[_0x062f('0x8')]('/describe',auth[_0x062f('0x9')](),controller[_0x062f('0xa')]);router[_0x062f('0x8')](_0x062f('0xb'),auth[_0x062f('0x9')](),controller[_0x062f('0xc')]);router['post']('/',auth[_0x062f('0x9')](),controller[_0x062f('0xd')]);router[_0x062f('0xe')](_0x062f('0xb'),auth['isAuthenticated'](),controller[_0x062f('0xf')]);router[_0x062f('0x10')](_0x062f('0xb'),auth[_0x062f('0x9')](),controller['destroy']);module[_0x062f('0x11')]=router; \ No newline at end of file +var _0x8b3b=['show','post','create','put','update','destroy','exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x8b3b,0xfe));var _0xb8b3=function(_0x59ae80,_0x56b205){_0x59ae80=_0x59ae80-0x0;var _0x473bf9=_0x8b3b[_0x59ae80];return _0x473bf9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb8b3('0x0'));var timeout=require(_0xb8b3('0x1'));var express=require(_0xb8b3('0x2'));var router=express['Router']();var fs_extra=require(_0xb8b3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb8b3('0x4'));var config=require(_0xb8b3('0x5'));var controller=require(_0xb8b3('0x6'));router[_0xb8b3('0x7')]('/',auth['isAuthenticated'](),controller[_0xb8b3('0x8')]);router[_0xb8b3('0x7')]('/describe',auth[_0xb8b3('0x9')](),controller[_0xb8b3('0xa')]);router[_0xb8b3('0x7')](_0xb8b3('0xb'),auth['isAuthenticated'](),controller[_0xb8b3('0xc')]);router[_0xb8b3('0xd')]('/',auth['isAuthenticated'](),controller[_0xb8b3('0xe')]);router[_0xb8b3('0xf')](_0xb8b3('0xb'),auth['isAuthenticated'](),controller[_0xb8b3('0x10')]);router['delete']('/:id',auth[_0xb8b3('0x9')](),controller[_0xb8b3('0x11')]);module[_0xb8b3('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 8fae9ce..092d2f0 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 _0xe949=['sequelize','exports','STRING','INTEGER'];(function(_0xe85784,_0x29ae67){var _0x58c202=function(_0x21c96e){while(--_0x21c96e){_0xe85784['push'](_0xe85784['shift']());}};_0x58c202(++_0x29ae67);}(_0xe949,0x1bc));var _0x9e94=function(_0x4abe9f,_0x26c82f){_0x4abe9f=_0x4abe9f-0x0;var _0x38ca35=_0xe949[_0x4abe9f];return _0x38ca35;};'use strict';var Sequelize=require(_0x9e94('0x0'));module[_0x9e94('0x1')]={'name':{'type':Sequelize[_0x9e94('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9e94('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9e94('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdcfa=['STRING','sequelize'];(function(_0x1c5960,_0x456efb){var _0x5c9c93=function(_0xf820b1){while(--_0xf820b1){_0x1c5960['push'](_0x1c5960['shift']());}};_0x5c9c93(++_0x456efb);}(_0xdcfa,0xe7));var _0xadcf=function(_0x4a09a8,_0x4ed12d){_0x4a09a8=_0x4a09a8-0x0;var _0x7d30a9=_0xdcfa[_0x4a09a8];return _0x7d30a9;};'use strict';var Sequelize=require(_0xadcf('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xadcf('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 13c3118..adfa20c 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 _0xfcf0=['nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xfcf0,0x138));var _0x0fcf=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0xfcf0[_0x26b80e];return _0x84a8a8;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')](_0x1fb83d[_0x0fcf('0x47')],{})['then'](respondWithResult(_0x345188,0xc9))['catch'](handleError(_0x345188,null));};exports[_0x0fcf('0x23')]=function(_0x243699,_0x28d2f4){if(_0x243699[_0x0fcf('0x47')]['id']){delete _0x243699[_0x0fcf('0x47')]['id'];}return db[_0x0fcf('0x2b')]['find']({'where':{'id':_0x243699[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x28d2f4,null))['then'](saveUpdates(_0x243699[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x28d2f4,null))[_0x0fcf('0x42')](handleError(_0x28d2f4,null));};exports[_0x0fcf('0x25')]=function(_0x5435c0,_0xc514bf){return db[_0x0fcf('0x2b')][_0x0fcf('0x48')]({'where':{'id':_0x5435c0[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0xc514bf,null))[_0x0fcf('0x24')](removeEntity(_0xc514bf,null))[_0x0fcf('0x42')](handleError(_0xc514bf,null));};exports[_0x0fcf('0x49')]=function(_0x389d71,_0x3a473c){return db[_0x0fcf('0x2b')][_0x0fcf('0x49')]()[_0x0fcf('0x24')](respondWithResult(_0x3a473c,null))[_0x0fcf('0x42')](handleError(_0x3a473c,null));}; \ No newline at end of file +var _0x7880=['destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then'];(function(_0x56aa66,_0x1ddf52){var _0xeba9ff=function(_0x5467b5){while(--_0x5467b5){_0x56aa66['push'](_0x56aa66['shift']());}};_0xeba9ff(++_0x1ddf52);}(_0x7880,0x1f4));var _0x0788=function(_0x77b868,_0x45ea4b){_0x77b868=_0x77b868-0x0;var _0x1f54ea=_0x7880[_0x77b868];return _0x1f54ea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x240459,_0xa1f7dc){return function(_0x5f2dda){if(!_0x5f2dda){_0x240459['sendStatus'](0x194);}return _0x5f2dda;};}function handleError(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0x1f4;return function(_0x57fda1){logger[_0x0788('0x28')](_0x57fda1[_0x0788('0x29')]);if(_0x57fda1[_0x0788('0x2a')]){delete _0x57fda1[_0x0788('0x2a')];}_0x5a54a5[_0x0788('0x1a')](_0x44798c)[_0x0788('0x2b')](_0x57fda1);};}exports[_0x0788('0x2c')]=function(_0x3ffe4f,_0x5b7594){var _0x5a5178={},_0x3c5246={},_0x40d345={'count':0x0,'rows':[]};var _0x54979a=_['map'](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x20fcd8){return{'name':_0x20fcd8[_0x0788('0x2f')],'type':_0x20fcd8[_0x0788('0x30')][_0x0788('0x31')]};});_0x3c5246[_0x0788('0x32')]=_[_0x0788('0x33')](_0x54979a,_0x0788('0x2a'));_0x3c5246[_0x0788('0x34')]=_['keys'](_0x3ffe4f[_0x0788('0x34')]);_0x3c5246[_0x0788('0x35')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],_0x3c5246[_0x0788('0x34')]);_0x5a5178[_0x0788('0x37')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],qs[_0x0788('0x38')](_0x3ffe4f[_0x0788('0x34')]['fields']));_0x5a5178['attributes']=_0x5a5178['attributes']['length']?_0x5a5178['attributes']:_0x3c5246['model'];if(!_0x3ffe4f[_0x0788('0x34')][_0x0788('0x39')](_0x0788('0x3a'))){_0x5a5178['limit']=qs[_0x0788('0x1f')](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x1f')]);_0x5a5178[_0x0788('0x1c')]=qs['offset'](_0x3ffe4f[_0x0788('0x34')]['offset']);}_0x5a5178[_0x0788('0x3b')]=qs['sort'](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3c')]);_0x5a5178['where']=qs[_0x0788('0x35')](_[_0x0788('0x3d')](_0x3ffe4f['query'],_0x3c5246[_0x0788('0x35')]),_0x54979a);if(_0x3ffe4f['query'][_0x0788('0x3e')]){_0x5a5178['where']=_[_0x0788('0x3f')](_0x5a5178['where'],{'$or':_[_0x0788('0x33')](_0x54979a,function(_0x57fec9){if(_0x57fec9['type']!==_0x0788('0x40')){var _0x68d9d4={};_0x68d9d4[_0x57fec9[_0x0788('0x2a')]]={'$like':'%'+_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3e')]+'%'};return _0x68d9d4;}})});}_0x5a5178=_['merge']({},_0x5a5178,_0x3ffe4f['options']);var _0x530d83={'where':_0x5a5178['where']};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x530d83)[_0x0788('0x26')](function(_0x358a22){_0x40d345[_0x0788('0x1e')]=_0x358a22;if(_0x3ffe4f['query']['includeAll']){_0x5a5178[_0x0788('0x41')]=[{'all':!![]}];}return db[_0x0788('0x2d')][_0x0788('0x42')](_0x5a5178);})[_0x0788('0x26')](function(_0x236b63){_0x40d345[_0x0788('0x43')]=_0x236b63;return _0x40d345;})[_0x0788('0x26')](respondWithFilteredResult(_0x5b7594,_0x5a5178))[_0x0788('0x44')](handleError(_0x5b7594,null));};exports[_0x0788('0x45')]=function(_0x50e8f5,_0x5581e6){var _0x441aec={'raw':![],'where':{'id':_0x50e8f5[_0x0788('0x46')]['id']}},_0x1d579d={};_0x1d579d['model']=_['keys'](db['UserProfileResource'][_0x0788('0x2e')]);_0x1d579d[_0x0788('0x34')]=_[_0x0788('0x47')](_0x50e8f5[_0x0788('0x34')]);_0x1d579d[_0x0788('0x35')]=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],_0x1d579d[_0x0788('0x34')]);_0x441aec['attributes']=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],qs[_0x0788('0x38')](_0x50e8f5[_0x0788('0x34')]['fields']));_0x441aec[_0x0788('0x37')]=_0x441aec[_0x0788('0x37')]['length']?_0x441aec['attributes']:_0x1d579d['model'];if(_0x50e8f5[_0x0788('0x34')]['includeAll']){_0x441aec[_0x0788('0x41')]=[{'all':!![]}];}_0x441aec=_[_0x0788('0x3f')]({},_0x441aec,_0x50e8f5[_0x0788('0x48')]);return db[_0x0788('0x2d')][_0x0788('0x49')](_0x441aec)[_0x0788('0x26')](handleEntityNotFound(_0x5581e6,null))[_0x0788('0x26')](respondWithResult(_0x5581e6,null))[_0x0788('0x44')](handleError(_0x5581e6,null));};exports['create']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')](_0x4c6366['body'],{})[_0x0788('0x26')](respondWithResult(_0x39c3cc,0xc9))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x4563cd,_0x2395ad){if(_0x4563cd['body']['id']){delete _0x4563cd['body']['id'];}return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x4563cd['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x2395ad,null))['then'](saveUpdates(_0x4563cd[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x2395ad,null))[_0x0788('0x44')](handleError(_0x2395ad,null));};exports[_0x0788('0x27')]=function(_0x3c757a,_0x379928){return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x3c757a['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x379928,null))[_0x0788('0x26')](removeEntity(_0x379928,null))[_0x0788('0x44')](handleError(_0x379928,null));};exports['describe']=function(_0x1693d0,_0x5d32ae){return db['UserProfileResource'][_0x0788('0x4c')]()[_0x0788('0x26')](respondWithResult(_0x5d32ae,null))[_0x0788('0x44')](handleError(_0x5d32ae,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 7ab9cd0..39b074f 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 _0x1810=['user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','define'];(function(_0x51408a,_0x5002c0){var _0x147451=function(_0x18340b){while(--_0x18340b){_0x51408a['push'](_0x51408a['shift']());}};_0x147451(++_0x5002c0);}(_0x1810,0xf4));var _0x0181=function(_0x4102a1,_0x2baefd){_0x4102a1=_0x4102a1-0x0;var _0x443434=_0x1810[_0x4102a1];return _0x443434;};'use strict';var _=require(_0x0181('0x0'));var util=require(_0x0181('0x1'));var logger=require(_0x0181('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0181('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0181('0x4'));var rimraf=require(_0x0181('0x5'));var config=require(_0x0181('0x6'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x5d0f8a,_0x308a8a){return _0x5d0f8a[_0x0181('0x7')]('UserProfileResource',attributes,{'tableName':_0x0181('0x8'),'paranoid':![],'indexes':[{'name':_0x0181('0x9'),'fields':[_0x0181('0xa'),_0x0181('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4fa8=['resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','user_profile_has_resources'];(function(_0x5b1f36,_0x21d1bb){var _0x33a5fc=function(_0x3fffd3){while(--_0x3fffd3){_0x5b1f36['push'](_0x5b1f36['shift']());}};_0x33a5fc(++_0x21d1bb);}(_0x4fa8,0x1f0));var _0x84fa=function(_0x470926,_0x52239a){_0x470926=_0x470926-0x0;var _0x1a6cd0=_0x4fa8[_0x470926];return _0x1a6cd0;};'use strict';var _=require(_0x84fa('0x0'));var util=require('util');var logger=require(_0x84fa('0x1'))(_0x84fa('0x2'));var moment=require(_0x84fa('0x3'));var BPromise=require(_0x84fa('0x4'));var rp=require(_0x84fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84fa('0x6'));var config=require(_0x84fa('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x84fa('0x8')]=function(_0x2605de,_0x5b4a78){return _0x2605de[_0x84fa('0x9')]('UserProfileResource',attributes,{'tableName':_0x84fa('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x84fa('0xb'),_0x84fa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index adf9674..b0953f3 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 _0x649c=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x649c,0xc6));var _0xc649=function(_0x391310,_0x206430){_0x391310=_0x391310-0x0;var _0x542665=_0x649c[_0x391310];return _0x542665;};'use strict';var _=require(_0xc649('0x0'));var util=require('util');var moment=require(_0xc649('0x1'));var BPromise=require(_0xc649('0x2'));var rs=require(_0xc649('0x3'));var fs=require('fs');var Redis=require(_0xc649('0x4'));var db=require(_0xc649('0x5'))['db'];var utils=require(_0xc649('0x6'));var logger=require(_0xc649('0x7'))(_0xc649('0x8'));var config=require(_0xc649('0x9'));var jayson=require(_0xc649('0xa'));var client=jayson[_0xc649('0xb')][_0xc649('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8c6074,_0x3698ec,_0x1654fb){return new BPromise(function(_0x5f15f7,_0x512762){return client[_0xc649('0xd')](_0x8c6074,_0x1654fb)[_0xc649('0xe')](function(_0x249609){logger['info'](_0xc649('0xf'),_0x3698ec,_0xc649('0x10'));logger[_0xc649('0x11')](_0xc649('0x12'),_0x3698ec,_0xc649('0x10'),JSON[_0xc649('0x13')](_0x249609));if(_0x249609[_0xc649('0x14')]){if(_0x249609[_0xc649('0x14')][_0xc649('0x15')]===0x1f4){logger[_0xc649('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x3698ec,_0x249609[_0xc649('0x14')][_0xc649('0x16')]);return _0x512762(_0x249609[_0xc649('0x14')][_0xc649('0x16')]);}logger[_0xc649('0x14')](_0xc649('0xf'),_0x3698ec,_0x249609[_0xc649('0x14')][_0xc649('0x16')]);return _0x5f15f7(_0x249609[_0xc649('0x14')][_0xc649('0x16')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x3698ec,_0xc649('0x10'));_0x5f15f7(_0x249609['result']['message']);}})[_0xc649('0x17')](function(_0x9cf89a){logger[_0xc649('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x3698ec,_0x9cf89a);_0x512762(_0x9cf89a);});});} \ No newline at end of file +var _0x5de6=['http','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x215604,_0x578cf3){var _0x133626=function(_0x4de195){while(--_0x4de195){_0x215604['push'](_0x215604['shift']());}};_0x133626(++_0x578cf3);}(_0x5de6,0xd3));var _0x65de=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5de6[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x65de('0x0'));var rs=require(_0x65de('0x1'));var fs=require('fs');var Redis=require(_0x65de('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x65de('0x3'));var logger=require(_0x65de('0x4'))(_0x65de('0x5'));var config=require(_0x65de('0x6'));var jayson=require(_0x65de('0x7'));var client=jayson[_0x65de('0x8')][_0x65de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b8ef5,_0x2eb099,_0x8866ea){return new BPromise(function(_0xf6c199,_0x167a7b){return client['request'](_0x4b8ef5,_0x8866ea)[_0x65de('0xa')](function(_0x18c73c){logger[_0x65de('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x2eb099,_0x65de('0xc'));logger[_0x65de('0xd')](_0x65de('0xe'),_0x2eb099,'request\x20sent',JSON[_0x65de('0xf')](_0x18c73c));if(_0x18c73c[_0x65de('0x10')]){if(_0x18c73c['error'][_0x65de('0x11')]===0x1f4){logger['error'](_0x65de('0x12'),_0x2eb099,_0x18c73c[_0x65de('0x10')][_0x65de('0x13')]);return _0x167a7b(_0x18c73c[_0x65de('0x10')][_0x65de('0x13')]);}logger[_0x65de('0x10')](_0x65de('0x12'),_0x2eb099,_0x18c73c[_0x65de('0x10')][_0x65de('0x13')]);return _0xf6c199(_0x18c73c[_0x65de('0x10')]['message']);}else{logger[_0x65de('0xb')](_0x65de('0x12'),_0x2eb099,_0x65de('0xc'));_0xf6c199(_0x18c73c[_0x65de('0x14')][_0x65de('0x13')]);}})[_0x65de('0x15')](function(_0x21a0d8){logger[_0x65de('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x2eb099,_0x21a0d8);_0x167a7b(_0x21a0d8);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 475952e..9876eb9 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 _0x9614=['fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3d54bd,_0x4383d2){var _0x4a88ec=function(_0xdaf377){while(--_0xdaf377){_0x3d54bd['push'](_0x3d54bd['shift']());}};_0x4a88ec(++_0x4383d2);}(_0x9614,0xe1));var _0x4961=function(_0x1ff329,_0x33e086){_0x1ff329=_0x1ff329-0x0;var _0x28501d=_0x9614[_0x1ff329];return _0x28501d;};'use strict';var multer=require(_0x4961('0x0'));var util=require(_0x4961('0x1'));var path=require(_0x4961('0x2'));var timeout=require(_0x4961('0x3'));var express=require(_0x4961('0x4'));var router=express[_0x4961('0x5')]();var fs_extra=require(_0x4961('0x6'));var auth=require(_0x4961('0x7'));var interaction=require(_0x4961('0x8'));var config=require('../../config/environment');var controller=require(_0x4961('0x9'));router['get']('/',auth[_0x4961('0xa')](),controller[_0x4961('0xb')]);router[_0x4961('0xc')](_0x4961('0xd'),auth[_0x4961('0xa')](),controller[_0x4961('0xe')]);router[_0x4961('0xc')](_0x4961('0xf'),auth[_0x4961('0xa')](),controller['show']);router[_0x4961('0x10')]('/',auth[_0x4961('0xa')](),controller['create']);router[_0x4961('0x11')](_0x4961('0xf'),auth[_0x4961('0xa')](),controller[_0x4961('0x12')]);router[_0x4961('0x13')]('/:id',auth[_0x4961('0xa')](),controller['destroy']);module[_0x4961('0x14')]=router; \ No newline at end of file +var _0xa186=['show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x2e1be4,_0x8a5804){var _0x42a29d=function(_0x4f169f){while(--_0x4f169f){_0x2e1be4['push'](_0x2e1be4['shift']());}};_0x42a29d(++_0x8a5804);}(_0xa186,0x7e));var _0x6a18=function(_0x480a11,_0x2c6af2){_0x480a11=_0x480a11-0x0;var _0x438d83=_0xa186[_0x480a11];return _0x438d83;};'use strict';var multer=require(_0x6a18('0x0'));var util=require(_0x6a18('0x1'));var path=require(_0x6a18('0x2'));var timeout=require(_0x6a18('0x3'));var express=require(_0x6a18('0x4'));var router=express['Router']();var fs_extra=require(_0x6a18('0x5'));var auth=require(_0x6a18('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a18('0x7'));var controller=require(_0x6a18('0x8'));router['get']('/',auth[_0x6a18('0x9')](),controller[_0x6a18('0xa')]);router[_0x6a18('0xb')](_0x6a18('0xc'),auth[_0x6a18('0x9')](),controller['describe']);router['get'](_0x6a18('0xd'),auth['isAuthenticated'](),controller[_0x6a18('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6a18('0xf')]);router[_0x6a18('0x10')](_0x6a18('0xd'),auth[_0x6a18('0x9')](),controller[_0x6a18('0x11')]);router[_0x6a18('0x12')](_0x6a18('0xd'),auth['isAuthenticated'](),controller[_0x6a18('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 1e3bbcc..a7d876e 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 _0xbc9d=['sequelize','exports','STRING','INTEGER','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x4445a9,_0x4d7cc8){var _0x18d7f8=function(_0x232a8c){while(--_0x232a8c){_0x4445a9['push'](_0x4445a9['shift']());}};_0x18d7f8(++_0x4d7cc8);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x247161,_0x2578bc){_0x247161=_0x247161-0x0;var _0x4972d2=_0xbc9d[_0x247161];return _0x4972d2;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'name':{'type':Sequelize[_0xdbc9('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xdbc9('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xdbc9('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2aba48){this[_0xdbc9('0x4')](_0xdbc9('0x5'),_0x2aba48?_0x2aba48[_0xdbc9('0x6')](''):[]);},'get':function(){return this[_0xdbc9('0x7')](_0xdbc9('0x5'))?this[_0xdbc9('0x7')]('crudPermissions')[_0xdbc9('0x8')](''):[];}}}; \ No newline at end of file +var _0x7072=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split'];(function(_0x42bd12,_0x173a7f){var _0x4ae45c=function(_0xd6abb6){while(--_0xd6abb6){_0x42bd12['push'](_0x42bd12['shift']());}};_0x4ae45c(++_0x173a7f);}(_0x7072,0x138));var _0x2707=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x7072[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require('sequelize');module[_0x2707('0x0')]={'name':{'type':Sequelize[_0x2707('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x2707('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x2707('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x2707('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xfdfa7a){this['setDataValue'](_0x2707('0x4'),_0xfdfa7a?_0xfdfa7a[_0x2707('0x5')](''):[]);},'get':function(){return this[_0x2707('0x6')](_0x2707('0x4'))?this[_0x2707('0x6')](_0x2707('0x4'))[_0x2707('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index fd96da2..8cc858a 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 _0x7a4a=['show','params','rawAttributes','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x29274f,_0x28b52c){var _0x440b83=function(_0x11ae48){while(--_0x11ae48){_0x29274f['push'](_0x29274f['shift']());}};_0x440b83(++_0x28b52c);}(_0x7a4a,0x9a));var _0xa7a4=function(_0x1d9d12,_0x2c7d98){_0x1d9d12=_0x1d9d12-0x0;var _0x4f680e=_0x7a4a[_0x1d9d12];return _0x4f680e;};'use strict';var emlformat=require(_0xa7a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa7a4('0x1'));var jsonpatch=require(_0xa7a4('0x2'));var rp=require(_0xa7a4('0x3'));var moment=require(_0xa7a4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa7a4('0x5'));var util=require('util');var path=require(_0xa7a4('0x6'));var sox=require(_0xa7a4('0x7'));var csv=require(_0xa7a4('0x8'));var ejs=require(_0xa7a4('0x9'));var fs=require('fs');var fs_extra=require(_0xa7a4('0xa'));var _=require(_0xa7a4('0xb'));var squel=require(_0xa7a4('0xc'));var crypto=require(_0xa7a4('0xd'));var jsforce=require(_0xa7a4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa7a4('0x8'));var querystring=require('querystring');var Papa=require(_0xa7a4('0xf'));var Redis=require(_0xa7a4('0x10'));var authService=require(_0xa7a4('0x11'));var qs=require(_0xa7a4('0x12'));var as=require(_0xa7a4('0x13'));var hardwareService=require(_0xa7a4('0x14'));var logger=require(_0xa7a4('0x15'))(_0xa7a4('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa7a4('0x17'))['db'];function respondWithStatusCode(_0x40cc45,_0x34546c){_0x34546c=_0x34546c||0xcc;return function(_0x6f5ff0){if(_0x6f5ff0){return _0x40cc45[_0xa7a4('0x18')](_0x34546c);}return _0x40cc45[_0xa7a4('0x19')](_0x34546c)[_0xa7a4('0x1a')]();};}function respondWithResult(_0x589c83,_0x3d08b5){_0x3d08b5=_0x3d08b5||0xc8;return function(_0x3e6350){if(_0x3e6350){return _0x589c83[_0xa7a4('0x19')](_0x3d08b5)[_0xa7a4('0x1b')](_0x3e6350);}};}function respondWithFilteredResult(_0x292a2e,_0x54bf4f){return function(_0x1ae1b8){if(_0x1ae1b8){var _0x39053f=typeof _0x54bf4f[_0xa7a4('0x1c')]===_0xa7a4('0x1d')&&typeof _0x54bf4f[_0xa7a4('0x1e')]==='undefined';var _0x187af5=_0x1ae1b8['count'];var _0x5cecc0=_0x39053f?0x0:_0x54bf4f[_0xa7a4('0x1c')];var _0x28a79e=_0x39053f?_0x1ae1b8[_0xa7a4('0x1f')]:_0x54bf4f[_0xa7a4('0x1c')]+_0x54bf4f['limit'];var _0x3c19e8;if(_0x28a79e>=_0x187af5){_0x28a79e=_0x187af5;_0x3c19e8=0xc8;}else{_0x3c19e8=0xce;}_0x292a2e[_0xa7a4('0x19')](_0x3c19e8);return _0x292a2e[_0xa7a4('0x20')](_0xa7a4('0x21'),_0x5cecc0+'-'+_0x28a79e+'/'+_0x187af5)['json'](_0x1ae1b8);}return null;};}function patchUpdates(_0x4ad0d9){return function(_0x9d9836){try{jsonpatch[_0xa7a4('0x22')](_0x9d9836,_0x4ad0d9,!![]);}catch(_0x38e76c){return BPromise[_0xa7a4('0x23')](_0x38e76c);}return _0x9d9836['save']();};}function saveUpdates(_0x2dbb36,_0x55f645){return function(_0x526ac7){if(_0x526ac7){return _0x526ac7[_0xa7a4('0x24')](_0x2dbb36)[_0xa7a4('0x25')](function(_0x23893b){return _0x23893b;});}return null;};}function removeEntity(_0x507398,_0x148888){return function(_0x2c1680){if(_0x2c1680){return _0x2c1680[_0xa7a4('0x26')]()[_0xa7a4('0x25')](function(){_0x507398[_0xa7a4('0x19')](0xcc)[_0xa7a4('0x1a')]();});}};}function handleEntityNotFound(_0x349d2b,_0x113a62){return function(_0x49d40d){if(!_0x49d40d){_0x349d2b[_0xa7a4('0x18')](0x194);}return _0x49d40d;};}function handleError(_0x50fd98,_0x445eeb){_0x445eeb=_0x445eeb||0x1f4;return function(_0x1ca8c7){logger[_0xa7a4('0x27')](_0x1ca8c7[_0xa7a4('0x28')]);if(_0x1ca8c7['name']){delete _0x1ca8c7[_0xa7a4('0x29')];}_0x50fd98['status'](_0x445eeb)[_0xa7a4('0x2a')](_0x1ca8c7);};}exports[_0xa7a4('0x2b')]=function(_0x1ee614,_0x228eb2){var _0x476e66={},_0x3fbf5e={},_0x3c761e={'count':0x0,'rows':[]};var _0x9ca7c6=_[_0xa7a4('0x2c')](db[_0xa7a4('0x2d')]['rawAttributes'],function(_0x26e7ee){return{'name':_0x26e7ee[_0xa7a4('0x2e')],'type':_0x26e7ee[_0xa7a4('0x2f')][_0xa7a4('0x30')]};});_0x3fbf5e[_0xa7a4('0x31')]=_[_0xa7a4('0x2c')](_0x9ca7c6,'name');_0x3fbf5e[_0xa7a4('0x32')]=_[_0xa7a4('0x33')](_0x1ee614['query']);_0x3fbf5e[_0xa7a4('0x34')]=_[_0xa7a4('0x35')](_0x3fbf5e[_0xa7a4('0x31')],_0x3fbf5e[_0xa7a4('0x32')]);_0x476e66[_0xa7a4('0x36')]=_['intersection'](_0x3fbf5e[_0xa7a4('0x31')],qs[_0xa7a4('0x37')](_0x1ee614[_0xa7a4('0x32')]['fields']));_0x476e66[_0xa7a4('0x36')]=_0x476e66[_0xa7a4('0x36')]['length']?_0x476e66[_0xa7a4('0x36')]:_0x3fbf5e[_0xa7a4('0x31')];if(!_0x1ee614['query']['hasOwnProperty'](_0xa7a4('0x38'))){_0x476e66['limit']=qs[_0xa7a4('0x1e')](_0x1ee614['query']['limit']);_0x476e66[_0xa7a4('0x1c')]=qs[_0xa7a4('0x1c')](_0x1ee614[_0xa7a4('0x32')][_0xa7a4('0x1c')]);}_0x476e66['order']=qs[_0xa7a4('0x39')](_0x1ee614[_0xa7a4('0x32')]['sort']);_0x476e66[_0xa7a4('0x3a')]=qs[_0xa7a4('0x34')](_['pick'](_0x1ee614[_0xa7a4('0x32')],_0x3fbf5e[_0xa7a4('0x34')]),_0x9ca7c6);if(_0x1ee614[_0xa7a4('0x32')]['filter']){_0x476e66['where']=_[_0xa7a4('0x3b')](_0x476e66['where'],{'$or':_[_0xa7a4('0x2c')](_0x9ca7c6,function(_0x2a5230){if(_0x2a5230['type']!==_0xa7a4('0x3c')){var _0x1174e0={};_0x1174e0[_0x2a5230[_0xa7a4('0x29')]]={'$like':'%'+_0x1ee614['query']['filter']+'%'};return _0x1174e0;}})});}_0x476e66=_[_0xa7a4('0x3b')]({},_0x476e66,_0x1ee614[_0xa7a4('0x3d')]);var _0x5e6922={'where':_0x476e66[_0xa7a4('0x3a')]};return db[_0xa7a4('0x2d')][_0xa7a4('0x1f')](_0x5e6922)[_0xa7a4('0x25')](function(_0x32e534){_0x3c761e['count']=_0x32e534;if(_0x1ee614[_0xa7a4('0x32')][_0xa7a4('0x3e')]){_0x476e66[_0xa7a4('0x3f')]=[{'all':!![]}];}return db[_0xa7a4('0x2d')][_0xa7a4('0x40')](_0x476e66);})[_0xa7a4('0x25')](function(_0x19df6f){_0x3c761e['rows']=_0x19df6f;return _0x3c761e;})[_0xa7a4('0x25')](respondWithFilteredResult(_0x228eb2,_0x476e66))['catch'](handleError(_0x228eb2,null));};exports[_0xa7a4('0x41')]=function(_0x4f92e3,_0x2e1126){var _0x3935a5={'raw':![],'where':{'id':_0x4f92e3[_0xa7a4('0x42')]['id']}},_0x30e3ed={};_0x30e3ed[_0xa7a4('0x31')]=_[_0xa7a4('0x33')](db[_0xa7a4('0x2d')][_0xa7a4('0x43')]);_0x30e3ed['query']=_['keys'](_0x4f92e3[_0xa7a4('0x32')]);_0x30e3ed['filters']=_[_0xa7a4('0x35')](_0x30e3ed[_0xa7a4('0x31')],_0x30e3ed[_0xa7a4('0x32')]);_0x3935a5[_0xa7a4('0x36')]=_[_0xa7a4('0x35')](_0x30e3ed[_0xa7a4('0x31')],qs[_0xa7a4('0x37')](_0x4f92e3[_0xa7a4('0x32')][_0xa7a4('0x37')]));_0x3935a5[_0xa7a4('0x36')]=_0x3935a5['attributes']['length']?_0x3935a5['attributes']:_0x30e3ed['model'];if(_0x4f92e3[_0xa7a4('0x32')]['includeAll']){_0x3935a5[_0xa7a4('0x3f')]=[{'all':!![]}];}_0x3935a5=_[_0xa7a4('0x3b')]({},_0x3935a5,_0x4f92e3['options']);return db[_0xa7a4('0x2d')]['find'](_0x3935a5)[_0xa7a4('0x25')](handleEntityNotFound(_0x2e1126,null))[_0xa7a4('0x25')](respondWithResult(_0x2e1126,null))[_0xa7a4('0x44')](handleError(_0x2e1126,null));};exports[_0xa7a4('0x45')]=function(_0x54016a,_0x112767){return db['UserProfileSection']['create'](_0x54016a[_0xa7a4('0x46')],{})[_0xa7a4('0x25')](respondWithResult(_0x112767,0xc9))[_0xa7a4('0x44')](handleError(_0x112767,null));};exports['update']=function(_0x49b43d,_0x21c09e){if(_0x49b43d[_0xa7a4('0x46')]['id']){delete _0x49b43d['body']['id'];}return db[_0xa7a4('0x2d')]['find']({'where':{'id':_0x49b43d[_0xa7a4('0x42')]['id']}})['then'](handleEntityNotFound(_0x21c09e,null))[_0xa7a4('0x25')](saveUpdates(_0x49b43d[_0xa7a4('0x46')],null))[_0xa7a4('0x25')](respondWithResult(_0x21c09e,null))[_0xa7a4('0x44')](handleError(_0x21c09e,null));};exports['destroy']=function(_0xbba08d,_0x1597d7){return db[_0xa7a4('0x2d')][_0xa7a4('0x47')]({'where':{'id':_0xbba08d[_0xa7a4('0x42')]['id']}})[_0xa7a4('0x25')](handleEntityNotFound(_0x1597d7,null))[_0xa7a4('0x25')](removeEntity(_0x1597d7,null))['catch'](handleError(_0x1597d7,null));};exports['describe']=function(_0x258db7,_0x58f742){return db[_0xa7a4('0x2d')][_0xa7a4('0x48')]()[_0xa7a4('0x25')](respondWithResult(_0x58f742,null))['catch'](handleError(_0x58f742,null));}; \ No newline at end of file +var _0xee15=['sox','to-csv','fs-extra','lodash','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','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','error','stack','name','index','UserProfileSection','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','destroy','describe','eml-format','request-promise','moment','mustache','util','path'];(function(_0x17229e,_0x13aa23){var _0x4af8e6=function(_0x23e482){while(--_0x23e482){_0x17229e['push'](_0x17229e['shift']());}};_0x4af8e6(++_0x13aa23);}(_0xee15,0x126));var _0x5ee1=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xee15[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0x5ee1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ee1('0x1'));var moment=require(_0x5ee1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5ee1('0x3'));var util=require(_0x5ee1('0x4'));var path=require(_0x5ee1('0x5'));var sox=require(_0x5ee1('0x6'));var csv=require(_0x5ee1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ee1('0x8'));var _=require(_0x5ee1('0x9'));var squel=require(_0x5ee1('0xa'));var crypto=require(_0x5ee1('0xb'));var jsforce=require(_0x5ee1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5ee1('0x7'));var querystring=require(_0x5ee1('0xd'));var Papa=require(_0x5ee1('0xe'));var Redis=require(_0x5ee1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5ee1('0x10'));var as=require(_0x5ee1('0x11'));var hardwareService=require(_0x5ee1('0x12'));var logger=require(_0x5ee1('0x13'))(_0x5ee1('0x14'));var utils=require(_0x5ee1('0x15'));var config=require(_0x5ee1('0x16'));var licenseUtil=require(_0x5ee1('0x17'));var db=require(_0x5ee1('0x18'))['db'];function respondWithStatusCode(_0x6987c1,_0x4a8da6){_0x4a8da6=_0x4a8da6||0xcc;return function(_0x34162c){if(_0x34162c){return _0x6987c1[_0x5ee1('0x19')](_0x4a8da6);}return _0x6987c1['status'](_0x4a8da6)[_0x5ee1('0x1a')]();};}function respondWithResult(_0x2f69b7,_0x5d8ca6){_0x5d8ca6=_0x5d8ca6||0xc8;return function(_0x1defb9){if(_0x1defb9){return _0x2f69b7['status'](_0x5d8ca6)[_0x5ee1('0x1b')](_0x1defb9);}};}function respondWithFilteredResult(_0x58826c,_0x36ac08){return function(_0x5d9ce0){if(_0x5d9ce0){var _0x4af983=typeof _0x36ac08[_0x5ee1('0x1c')]===_0x5ee1('0x1d')&&typeof _0x36ac08[_0x5ee1('0x1e')]===_0x5ee1('0x1d');var _0x21070e=_0x5d9ce0[_0x5ee1('0x1f')];var _0x423c09=_0x4af983?0x0:_0x36ac08[_0x5ee1('0x1c')];var _0x2fc370=_0x4af983?_0x5d9ce0['count']:_0x36ac08[_0x5ee1('0x1c')]+_0x36ac08['limit'];var _0x3bfd75;if(_0x2fc370>=_0x21070e){_0x2fc370=_0x21070e;_0x3bfd75=0xc8;}else{_0x3bfd75=0xce;}_0x58826c[_0x5ee1('0x20')](_0x3bfd75);return _0x58826c['set']('Content-Range',_0x423c09+'-'+_0x2fc370+'/'+_0x21070e)[_0x5ee1('0x1b')](_0x5d9ce0);}return null;};}function patchUpdates(_0x5222f6){return function(_0x337ab8){try{jsonpatch[_0x5ee1('0x21')](_0x337ab8,_0x5222f6,!![]);}catch(_0x537dfa){return BPromise[_0x5ee1('0x22')](_0x537dfa);}return _0x337ab8[_0x5ee1('0x23')]();};}function saveUpdates(_0x5cca6f,_0xdbd96c){return function(_0x382272){if(_0x382272){return _0x382272[_0x5ee1('0x24')](_0x5cca6f)['then'](function(_0x58e515){return _0x58e515;});}return null;};}function removeEntity(_0x572e74,_0x211660){return function(_0x4637e8){if(_0x4637e8){return _0x4637e8['destroy']()['then'](function(){_0x572e74[_0x5ee1('0x20')](0xcc)[_0x5ee1('0x1a')]();});}};}function handleEntityNotFound(_0x150f79,_0x1e6026){return function(_0x4fb84d){if(!_0x4fb84d){_0x150f79[_0x5ee1('0x19')](0x194);}return _0x4fb84d;};}function handleError(_0x31eaf9,_0x2d0012){_0x2d0012=_0x2d0012||0x1f4;return function(_0x2dcd62){logger[_0x5ee1('0x25')](_0x2dcd62[_0x5ee1('0x26')]);if(_0x2dcd62[_0x5ee1('0x27')]){delete _0x2dcd62['name'];}_0x31eaf9['status'](_0x2d0012)['send'](_0x2dcd62);};}exports[_0x5ee1('0x28')]=function(_0x50747c,_0x375c67){var _0x3cc9fb={},_0x2b4ea5={},_0xb96e0a={'count':0x0,'rows':[]};var _0x449346=_['map'](db[_0x5ee1('0x29')]['rawAttributes'],function(_0x3355a0){return{'name':_0x3355a0['fieldName'],'type':_0x3355a0[_0x5ee1('0x2a')][_0x5ee1('0x2b')]};});_0x2b4ea5['model']=_[_0x5ee1('0x2c')](_0x449346,_0x5ee1('0x27'));_0x2b4ea5[_0x5ee1('0x2d')]=_[_0x5ee1('0x2e')](_0x50747c[_0x5ee1('0x2d')]);_0x2b4ea5[_0x5ee1('0x2f')]=_[_0x5ee1('0x30')](_0x2b4ea5[_0x5ee1('0x31')],_0x2b4ea5[_0x5ee1('0x2d')]);_0x3cc9fb['attributes']=_[_0x5ee1('0x30')](_0x2b4ea5[_0x5ee1('0x31')],qs[_0x5ee1('0x32')](_0x50747c['query'][_0x5ee1('0x32')]));_0x3cc9fb['attributes']=_0x3cc9fb[_0x5ee1('0x33')][_0x5ee1('0x34')]?_0x3cc9fb[_0x5ee1('0x33')]:_0x2b4ea5[_0x5ee1('0x31')];if(!_0x50747c['query']['hasOwnProperty'](_0x5ee1('0x35'))){_0x3cc9fb[_0x5ee1('0x1e')]=qs[_0x5ee1('0x1e')](_0x50747c[_0x5ee1('0x2d')][_0x5ee1('0x1e')]);_0x3cc9fb['offset']=qs[_0x5ee1('0x1c')](_0x50747c['query'][_0x5ee1('0x1c')]);}_0x3cc9fb[_0x5ee1('0x36')]=qs[_0x5ee1('0x37')](_0x50747c[_0x5ee1('0x2d')][_0x5ee1('0x37')]);_0x3cc9fb[_0x5ee1('0x38')]=qs[_0x5ee1('0x2f')](_[_0x5ee1('0x39')](_0x50747c[_0x5ee1('0x2d')],_0x2b4ea5[_0x5ee1('0x2f')]),_0x449346);if(_0x50747c[_0x5ee1('0x2d')][_0x5ee1('0x3a')]){_0x3cc9fb[_0x5ee1('0x38')]=_['merge'](_0x3cc9fb[_0x5ee1('0x38')],{'$or':_[_0x5ee1('0x2c')](_0x449346,function(_0x2fb9e8){if(_0x2fb9e8['type']!==_0x5ee1('0x3b')){var _0x4f6e5b={};_0x4f6e5b[_0x2fb9e8[_0x5ee1('0x27')]]={'$like':'%'+_0x50747c[_0x5ee1('0x2d')]['filter']+'%'};return _0x4f6e5b;}})});}_0x3cc9fb=_[_0x5ee1('0x3c')]({},_0x3cc9fb,_0x50747c[_0x5ee1('0x3d')]);var _0x1f54ca={'where':_0x3cc9fb['where']};return db['UserProfileSection'][_0x5ee1('0x1f')](_0x1f54ca)[_0x5ee1('0x3e')](function(_0x40ee52){_0xb96e0a[_0x5ee1('0x1f')]=_0x40ee52;if(_0x50747c[_0x5ee1('0x2d')][_0x5ee1('0x3f')]){_0x3cc9fb[_0x5ee1('0x40')]=[{'all':!![]}];}return db[_0x5ee1('0x29')][_0x5ee1('0x41')](_0x3cc9fb);})[_0x5ee1('0x3e')](function(_0x55a932){_0xb96e0a['rows']=_0x55a932;return _0xb96e0a;})[_0x5ee1('0x3e')](respondWithFilteredResult(_0x375c67,_0x3cc9fb))[_0x5ee1('0x42')](handleError(_0x375c67,null));};exports[_0x5ee1('0x43')]=function(_0x41af64,_0x336bf4){var _0x5a182f={'raw':![],'where':{'id':_0x41af64[_0x5ee1('0x44')]['id']}},_0x1df635={};_0x1df635[_0x5ee1('0x31')]=_[_0x5ee1('0x2e')](db[_0x5ee1('0x29')][_0x5ee1('0x45')]);_0x1df635['query']=_[_0x5ee1('0x2e')](_0x41af64[_0x5ee1('0x2d')]);_0x1df635['filters']=_[_0x5ee1('0x30')](_0x1df635['model'],_0x1df635['query']);_0x5a182f[_0x5ee1('0x33')]=_[_0x5ee1('0x30')](_0x1df635[_0x5ee1('0x31')],qs['fields'](_0x41af64[_0x5ee1('0x2d')][_0x5ee1('0x32')]));_0x5a182f[_0x5ee1('0x33')]=_0x5a182f[_0x5ee1('0x33')][_0x5ee1('0x34')]?_0x5a182f[_0x5ee1('0x33')]:_0x1df635['model'];if(_0x41af64[_0x5ee1('0x2d')][_0x5ee1('0x3f')]){_0x5a182f['include']=[{'all':!![]}];}_0x5a182f=_[_0x5ee1('0x3c')]({},_0x5a182f,_0x41af64[_0x5ee1('0x3d')]);return db[_0x5ee1('0x29')]['find'](_0x5a182f)[_0x5ee1('0x3e')](handleEntityNotFound(_0x336bf4,null))[_0x5ee1('0x3e')](respondWithResult(_0x336bf4,null))[_0x5ee1('0x42')](handleError(_0x336bf4,null));};exports[_0x5ee1('0x46')]=function(_0x290b83,_0x46e1c4){return db[_0x5ee1('0x29')][_0x5ee1('0x46')](_0x290b83[_0x5ee1('0x47')],{})[_0x5ee1('0x3e')](respondWithResult(_0x46e1c4,0xc9))[_0x5ee1('0x42')](handleError(_0x46e1c4,null));};exports[_0x5ee1('0x24')]=function(_0x252583,_0xffbfdb){if(_0x252583['body']['id']){delete _0x252583['body']['id'];}return db[_0x5ee1('0x29')][_0x5ee1('0x48')]({'where':{'id':_0x252583[_0x5ee1('0x44')]['id']}})[_0x5ee1('0x3e')](handleEntityNotFound(_0xffbfdb,null))[_0x5ee1('0x3e')](saveUpdates(_0x252583[_0x5ee1('0x47')],null))[_0x5ee1('0x3e')](respondWithResult(_0xffbfdb,null))['catch'](handleError(_0xffbfdb,null));};exports[_0x5ee1('0x49')]=function(_0x5022c4,_0x2c88bf){return db[_0x5ee1('0x29')][_0x5ee1('0x48')]({'where':{'id':_0x5022c4[_0x5ee1('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c88bf,null))[_0x5ee1('0x3e')](removeEntity(_0x2c88bf,null))['catch'](handleError(_0x2c88bf,null));};exports[_0x5ee1('0x4a')]=function(_0xc2f3a7,_0x164e32){return db[_0x5ee1('0x29')]['describe']()[_0x5ee1('0x3e')](respondWithResult(_0x164e32,null))[_0x5ee1('0x42')](handleError(_0x164e32,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index b897fb6..041bb3d 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 _0xa490=['path','rimraf','./userProfileSection.attributes','define','compositeIndex','sectionId','../../config/logger','api','moment','bluebird'];(function(_0x4bb419,_0x12ee51){var _0x102f88=function(_0x11965a){while(--_0x11965a){_0x4bb419['push'](_0x4bb419['shift']());}};_0x102f88(++_0x12ee51);}(_0xa490,0xce));var _0x0a49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa490[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0a49('0x0'))(_0x0a49('0x1'));var moment=require(_0x0a49('0x2'));var BPromise=require(_0x0a49('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a49('0x4'));var rimraf=require(_0x0a49('0x5'));var config=require('../../config/environment');var attributes=require(_0x0a49('0x6'));module['exports']=function(_0x449cf8,_0x1b2a55){return _0x449cf8[_0x0a49('0x7')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x0a49('0x8'),'fields':[_0x0a49('0x9'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ce2=['moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','api'];(function(_0x1da9a2,_0x38e471){var _0x34eabf=function(_0x314ea2){while(--_0x314ea2){_0x1da9a2['push'](_0x1da9a2['shift']());}};_0x34eabf(++_0x38e471);}(_0x5ce2,0x1e7));var _0x25ce=function(_0x10d405,_0x28d136){_0x10d405=_0x10d405-0x0;var _0x12bd98=_0x5ce2[_0x10d405];return _0x12bd98;};'use strict';var _=require(_0x25ce('0x0'));var util=require(_0x25ce('0x1'));var logger=require('../../config/logger')(_0x25ce('0x2'));var moment=require(_0x25ce('0x3'));var BPromise=require(_0x25ce('0x4'));var rp=require(_0x25ce('0x5'));var fs=require('fs');var path=require(_0x25ce('0x6'));var rimraf=require('rimraf');var config=require(_0x25ce('0x7'));var attributes=require(_0x25ce('0x8'));module[_0x25ce('0x9')]=function(_0xdc640d,_0x2ebefb){return _0xdc640d['define']('UserProfileSection',attributes,{'tableName':_0x25ce('0xa'),'paranoid':![],'indexes':[{'name':_0x25ce('0xb'),'fields':[_0x25ce('0xc'),_0x25ce('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 0cad2c1..96d8d5f 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 _0xd87f=['debug','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0xe11185,_0x301ca4){var _0x8d9deb=function(_0xd98940){while(--_0xd98940){_0xe11185['push'](_0xe11185['shift']());}};_0x8d9deb(++_0x301ca4);}(_0xd87f,0x137));var _0xfd87=function(_0x2906df,_0x1584f1){_0x2906df=_0x2906df-0x0;var _0x41d153=_0xd87f[_0x2906df];return _0x41d153;};'use strict';var _=require(_0xfd87('0x0'));var util=require(_0xfd87('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd87('0x2'));var fs=require('fs');var Redis=require(_0xfd87('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd87('0x4'));var logger=require(_0xfd87('0x5'))('rpc');var config=require(_0xfd87('0x6'));var jayson=require(_0xfd87('0x7'));var client=jayson[_0xfd87('0x8')][_0xfd87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c014a,_0x475dc0,_0x516112){return new BPromise(function(_0x533235,_0x150899){return client['request'](_0x5c014a,_0x516112)['then'](function(_0x38d3a4){logger[_0xfd87('0xa')](_0xfd87('0xb'),_0x475dc0,_0xfd87('0xc'));logger[_0xfd87('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x475dc0,_0xfd87('0xc'),JSON[_0xfd87('0xe')](_0x38d3a4));if(_0x38d3a4[_0xfd87('0xf')]){if(_0x38d3a4[_0xfd87('0xf')]['code']===0x1f4){logger[_0xfd87('0xf')](_0xfd87('0xb'),_0x475dc0,_0x38d3a4[_0xfd87('0xf')]['message']);return _0x150899(_0x38d3a4['error']['message']);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x475dc0,_0x38d3a4[_0xfd87('0xf')][_0xfd87('0x10')]);return _0x533235(_0x38d3a4[_0xfd87('0xf')]['message']);}else{logger[_0xfd87('0xa')](_0xfd87('0xb'),_0x475dc0,'request\x20sent');_0x533235(_0x38d3a4['result'][_0xfd87('0x10')]);}})[_0xfd87('0x11')](function(_0x14d58f){logger['error'](_0xfd87('0xb'),_0x475dc0,_0x14d58f);_0x150899(_0x14d58f);});});} \ No newline at end of file +var _0xf643=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','bluebird','ioredis'];(function(_0x2c1f4e,_0x190aa7){var _0x5be799=function(_0x1180a4){while(--_0x1180a4){_0x2c1f4e['push'](_0x2c1f4e['shift']());}};_0x5be799(++_0x190aa7);}(_0xf643,0xa7));var _0x3f64=function(_0xada38c,_0x550eb8){_0xada38c=_0xada38c-0x0;var _0x26545b=_0xf643[_0xada38c];return _0x26545b;};'use strict';var _=require(_0x3f64('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3f64('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f64('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f64('0x3'));var logger=require(_0x3f64('0x4'))('rpc');var config=require(_0x3f64('0x5'));var jayson=require(_0x3f64('0x6'));var client=jayson[_0x3f64('0x7')][_0x3f64('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f44b3,_0xf581fd,_0x3fa061){return new BPromise(function(_0x47d53b,_0x4f47bc){return client['request'](_0x5f44b3,_0x3fa061)[_0x3f64('0x9')](function(_0x1df8be){logger['info'](_0x3f64('0xa'),_0xf581fd,_0x3f64('0xb'));logger['debug'](_0x3f64('0xc'),_0xf581fd,'request\x20sent',JSON['stringify'](_0x1df8be));if(_0x1df8be[_0x3f64('0xd')]){if(_0x1df8be['error']['code']===0x1f4){logger[_0x3f64('0xd')]('UserProfileSection,\x20%s,\x20%s',_0xf581fd,_0x1df8be[_0x3f64('0xd')]['message']);return _0x4f47bc(_0x1df8be['error'][_0x3f64('0xe')]);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0xf581fd,_0x1df8be[_0x3f64('0xd')][_0x3f64('0xe')]);return _0x47d53b(_0x1df8be[_0x3f64('0xd')][_0x3f64('0xe')]);}else{logger[_0x3f64('0xf')]('UserProfileSection,\x20%s,\x20%s',_0xf581fd,_0x3f64('0xb'));_0x47d53b(_0x1df8be['result']['message']);}})[_0x3f64('0x10')](function(_0x4e1c53){logger[_0x3f64('0xd')](_0x3f64('0xa'),_0xf581fd,_0x4e1c53);_0x4f47bc(_0x4e1c53);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 9ecf836..879933d 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4da133,_0x44c50d){var _0x3420c7=function(_0x273b3c){while(--_0x273b3c){_0x4da133['push'](_0x4da133['shift']());}};_0x3420c7(++_0x44c50d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x340756,_0xad31ae){_0x340756=_0x340756-0x0;var _0x2ef745=_0xcb91[_0x340756];return _0x2ef745;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x300309,_0x1a8a6f){var _0x158e9a=function(_0x55e7c8){while(--_0x55e7c8){_0x300309['push'](_0x300309['shift']());}};_0x158e9a(++_0x1a8a6f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xcb91[_0x58547b];return _0x1d3fd2;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index fe6466a..8086e3e 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 _0x4111=['INTEGER','sequelize','exports'];(function(_0x5b812d,_0x4c1e61){var _0x8fc38a=function(_0x2a181e){while(--_0x2a181e){_0x5b812d['push'](_0x5b812d['shift']());}};_0x8fc38a(++_0x4c1e61);}(_0x4111,0x91));var _0x1411=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4111[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1411('0x0'));module[_0x1411('0x1')]={'penalty':{'type':Sequelize[_0x1411('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1574=['sequelize'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x1574,0x79));var _0x4157=function(_0x3a7c66,_0xf659e1){_0x3a7c66=_0x3a7c66-0x0;var _0x39f615=_0x1574[_0x3a7c66];return _0x39f615;};'use strict';var Sequelize=require(_0x4157('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 0aececf..db52a8c 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 _0x4975=['./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x124ac5,_0x4244b0){var _0x2344cb=function(_0x28f45f){while(--_0x28f45f){_0x124ac5['push'](_0x124ac5['shift']());}};_0x2344cb(++_0x4244b0);}(_0x4975,0x86));var _0x5497=function(_0x3ac1b3,_0x31e264){_0x3ac1b3=_0x3ac1b3-0x0;var _0x1c5006=_0x4975[_0x3ac1b3];return _0x1c5006;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf61e=['bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x24b185,_0x7e4e44){var _0x407e2f=function(_0x3c9c0e){while(--_0x3c9c0e){_0x24b185['push'](_0x24b185['shift']());}};_0x407e2f(++_0x7e4e44);}(_0xf61e,0x191));var _0xef61=function(_0x59921c,_0xdb547e){_0x59921c=_0x59921c-0x0;var _0x450419=_0xf61e[_0x59921c];return _0x450419;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('UserSmsQueue',attributes,{'tableName':_0xef61('0xd'),'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 3c550ef..46d1c3d 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 _0x5145=['jayson/promise','client','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x17e4a7,_0x390e95){var _0x4e2274=function(_0x2aa7f9){while(--_0x2aa7f9){_0x17e4a7['push'](_0x17e4a7['shift']());}};_0x4e2274(++_0x390e95);}(_0x5145,0x147));var _0x5514=function(_0x55f68a,_0x22ef41){_0x55f68a=_0x55f68a-0x0;var _0x3e62dc=_0x5145[_0x55f68a];return _0x3e62dc;};'use strict';var _=require(_0x5514('0x0'));var util=require('util');var moment=require(_0x5514('0x1'));var BPromise=require(_0x5514('0x2'));var rs=require(_0x5514('0x3'));var fs=require('fs');var Redis=require(_0x5514('0x4'));var db=require(_0x5514('0x5'))['db'];var utils=require(_0x5514('0x6'));var logger=require(_0x5514('0x7'))(_0x5514('0x8'));var config=require('../../config/environment');var jayson=require(_0x5514('0x9'));var client=jayson[_0x5514('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f9083,_0x583f1f,_0x46868f){return new BPromise(function(_0xae917,_0x5f0b8c){return client[_0x5514('0xb')](_0x3f9083,_0x46868f)[_0x5514('0xc')](function(_0xd3da46){logger[_0x5514('0xd')](_0x5514('0xe'),_0x583f1f,'request\x20sent');logger[_0x5514('0xf')](_0x5514('0x10'),_0x583f1f,_0x5514('0x11'),JSON[_0x5514('0x12')](_0xd3da46));if(_0xd3da46[_0x5514('0x13')]){if(_0xd3da46['error'][_0x5514('0x14')]===0x1f4){logger[_0x5514('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x583f1f,_0xd3da46['error']['message']);return _0x5f0b8c(_0xd3da46['error'][_0x5514('0x15')]);}logger[_0x5514('0x13')](_0x5514('0xe'),_0x583f1f,_0xd3da46[_0x5514('0x13')]['message']);return _0xae917(_0xd3da46[_0x5514('0x13')][_0x5514('0x15')]);}else{logger['info'](_0x5514('0xe'),_0x583f1f,_0x5514('0x11'));_0xae917(_0xd3da46[_0x5514('0x16')]['message']);}})[_0x5514('0x17')](function(_0x48415b){logger[_0x5514('0x13')](_0x5514('0xe'),_0x583f1f,_0x48415b);_0x5f0b8c(_0x48415b);});});} \ No newline at end of file +var _0x2f2d=['info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x403987,_0x55a50c){var _0x5be9ac=function(_0xc4dbb6){while(--_0xc4dbb6){_0x403987['push'](_0x403987['shift']());}};_0x5be9ac(++_0x55a50c);}(_0x2f2d,0x1d7));var _0xd2f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f2d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd2f2('0x0'));var util=require(_0xd2f2('0x1'));var moment=require('moment');var BPromise=require(_0xd2f2('0x2'));var rs=require(_0xd2f2('0x3'));var fs=require('fs');var Redis=require(_0xd2f2('0x4'));var db=require(_0xd2f2('0x5'))['db'];var utils=require(_0xd2f2('0x6'));var logger=require(_0xd2f2('0x7'))(_0xd2f2('0x8'));var config=require(_0xd2f2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd2f2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d688e,_0x4d3768,_0x2f81f4){return new BPromise(function(_0x2d9f23,_0x25bd3d){return client[_0xd2f2('0xb')](_0x4d688e,_0x2f81f4)[_0xd2f2('0xc')](function(_0x5771a6){logger[_0xd2f2('0xd')](_0xd2f2('0xe'),_0x4d3768,'request\x20sent');logger[_0xd2f2('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4d3768,_0xd2f2('0x10'),JSON['stringify'](_0x5771a6));if(_0x5771a6[_0xd2f2('0x11')]){if(_0x5771a6[_0xd2f2('0x11')][_0xd2f2('0x12')]===0x1f4){logger[_0xd2f2('0x11')](_0xd2f2('0xe'),_0x4d3768,_0x5771a6['error'][_0xd2f2('0x13')]);return _0x25bd3d(_0x5771a6[_0xd2f2('0x11')][_0xd2f2('0x13')]);}logger['error'](_0xd2f2('0xe'),_0x4d3768,_0x5771a6[_0xd2f2('0x11')][_0xd2f2('0x13')]);return _0x2d9f23(_0x5771a6[_0xd2f2('0x11')]['message']);}else{logger[_0xd2f2('0xd')](_0xd2f2('0xe'),_0x4d3768,_0xd2f2('0x10'));_0x2d9f23(_0x5771a6[_0xd2f2('0x14')][_0xd2f2('0x13')]);}})[_0xd2f2('0x15')](function(_0x4fd51a){logger[_0xd2f2('0x11')](_0xd2f2('0xe'),_0x4d3768,_0x4fd51a);_0x25bd3d(_0x4fd51a);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index b43ac24..e4747ac 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 _0xcd65=['INTEGER','sequelize','exports'];(function(_0x3ac30b,_0x40909e){var _0x2839da=function(_0x274954){while(--_0x274954){_0x3ac30b['push'](_0x3ac30b['shift']());}};_0x2839da(++_0x40909e);}(_0xcd65,0x70));var _0x5cd6=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0xcd65[_0x5c6994];return _0x1d5c84;};'use strict';var Sequelize=require(_0x5cd6('0x0'));module[_0x5cd6('0x1')]={'UserId':{'type':Sequelize[_0x5cd6('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x5cd6('0x2')]}}; \ No newline at end of file +var _0x9ab4=['sequelize','INTEGER'];(function(_0xd6c010,_0x5355e6){var _0x15893b=function(_0x1b0a5a){while(--_0x1b0a5a){_0xd6c010['push'](_0xd6c010['shift']());}};_0x15893b(++_0x5355e6);}(_0x9ab4,0x128));var _0x49ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ab4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x49ab('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x49ab('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x49ab('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 81eefa9..8457e88 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(_0x238cc3,_0x2701a4){var _0x5acbec=function(_0x21d742){while(--_0x21d742){_0x238cc3['push'](_0x238cc3['shift']());}};_0x5acbec(++_0x2701a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x43babe,_0x1438ca){var _0x23dec6=function(_0x2a8df6){while(--_0x2a8df6){_0x43babe['push'](_0x43babe['shift']());}};_0x23dec6(++_0x1438ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 4bf1ef5..22cbd7b 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x262a91,_0x4d3739){var _0x5dcb6b=function(_0x5df927){while(--_0x5df927){_0x262a91['push'](_0x262a91['shift']());}};_0x5dcb6b(++_0x4d3739);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x520d3b,_0x1e133e){var _0x28c120=function(_0x32c067){while(--_0x32c067){_0x520d3b['push'](_0x520d3b['shift']());}};_0x28c120(++_0x1e133e);}(_0x70e0,0x17b));var _0x070e=function(_0x157623,_0x43f8ee){_0x157623=_0x157623-0x0;var _0x1ef39c=_0x70e0[_0x157623];return _0x1ef39c;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 4e5e188..a8593c6 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 _0x20ef=['exports','INTEGER','sequelize'];(function(_0x73dcd,_0x482364){var _0x4949fa=function(_0x593f20){while(--_0x593f20){_0x73dcd['push'](_0x73dcd['shift']());}};_0x4949fa(++_0x482364);}(_0x20ef,0xe6));var _0xf20e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20ef[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf20e('0x0'));module[_0xf20e('0x1')]={'penalty':{'type':Sequelize[_0xf20e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x62f2=['sequelize','exports','INTEGER'];(function(_0x87d595,_0x2411c8){var _0x2a49e2=function(_0x3f2305){while(--_0x3f2305){_0x87d595['push'](_0x87d595['shift']());}};_0x2a49e2(++_0x2411c8);}(_0x62f2,0xff));var _0x262f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x62f2[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x262f('0x0'));module[_0x262f('0x1')]={'penalty':{'type':Sequelize[_0x262f('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 fa1a92b..84d21b2 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 _0x388e=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x388e,0x1b3));var _0xe388=function(_0x3fb07b,_0xd0a899){_0x3fb07b=_0x3fb07b-0x0;var _0x2ba88c=_0x388e[_0x3fb07b];return _0x2ba88c;};'use strict';var _=require(_0xe388('0x0'));var util=require(_0xe388('0x1'));var logger=require(_0xe388('0x2'))('api');var moment=require(_0xe388('0x3'));var BPromise=require(_0xe388('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe388('0x5'));var config=require(_0xe388('0x6'));var attributes=require(_0xe388('0x7'));module[_0xe388('0x8')]=function(_0x5c54fe,_0x3e4bdc){return _0x5c54fe[_0xe388('0x9')]('UserVoiceQueue',attributes,{'tableName':_0xe388('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x670f=['request-promise','rimraf','./userVoiceQueue.attributes','define','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x7fc086,_0x477809){var _0x251b2f=function(_0x16cd1a){while(--_0x16cd1a){_0x7fc086['push'](_0x7fc086['shift']());}};_0x251b2f(++_0x477809);}(_0x670f,0xcd));var _0xf670=function(_0x255f32,_0x228ad7){_0x255f32=_0x255f32-0x0;var _0x11664f=_0x670f[_0x255f32];return _0x11664f;};'use strict';var _=require(_0xf670('0x0'));var util=require(_0xf670('0x1'));var logger=require(_0xf670('0x2'))(_0xf670('0x3'));var moment=require('moment');var BPromise=require(_0xf670('0x4'));var rp=require(_0xf670('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf670('0x6'));var config=require('../../config/environment');var attributes=require(_0xf670('0x7'));module['exports']=function(_0x2a7c47,_0x2129a2){return _0x2a7c47[_0xf670('0x8')]('UserVoiceQueue',attributes,{'tableName':_0xf670('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 52afd42..91032b9 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 _0x9dae=['debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x370db5,_0x194270){var _0x297dc5=function(_0x59f402){while(--_0x59f402){_0x370db5['push'](_0x370db5['shift']());}};_0x297dc5(++_0x194270);}(_0x9dae,0x76));var _0xe9da=function(_0x1e8447,_0x3e1ae5){_0x1e8447=_0x1e8447-0x0;var _0x1ba6b0=_0x9dae[_0x1e8447];return _0x1ba6b0;};'use strict';var _=require(_0xe9da('0x0'));var util=require('util');var moment=require(_0xe9da('0x1'));var BPromise=require(_0xe9da('0x2'));var rs=require(_0xe9da('0x3'));var fs=require('fs');var Redis=require(_0xe9da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9da('0x5'));var logger=require(_0xe9da('0x6'))(_0xe9da('0x7'));var config=require(_0xe9da('0x8'));var jayson=require(_0xe9da('0x9'));var client=jayson['client'][_0xe9da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52d476,_0x3afcf6,_0x3fee26){return new BPromise(function(_0x150040,_0xde3ca4){return client[_0xe9da('0xb')](_0x52d476,_0x3fee26)[_0xe9da('0xc')](function(_0x12a530){logger[_0xe9da('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x3afcf6,'request\x20sent');logger[_0xe9da('0xe')](_0xe9da('0xf'),_0x3afcf6,_0xe9da('0x10'),JSON[_0xe9da('0x11')](_0x12a530));if(_0x12a530[_0xe9da('0x12')]){if(_0x12a530[_0xe9da('0x12')]['code']===0x1f4){logger['error'](_0xe9da('0x13'),_0x3afcf6,_0x12a530[_0xe9da('0x12')][_0xe9da('0x14')]);return _0xde3ca4(_0x12a530['error'][_0xe9da('0x14')]);}logger[_0xe9da('0x12')](_0xe9da('0x13'),_0x3afcf6,_0x12a530[_0xe9da('0x12')]['message']);return _0x150040(_0x12a530['error'][_0xe9da('0x14')]);}else{logger[_0xe9da('0xd')](_0xe9da('0x13'),_0x3afcf6,_0xe9da('0x10'));_0x150040(_0x12a530['result']['message']);}})[_0xe9da('0x15')](function(_0x305cf1){logger[_0xe9da('0x12')](_0xe9da('0x13'),_0x3afcf6,_0x305cf1);_0xde3ca4(_0x305cf1);});});} \ No newline at end of file +var _0x703f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','request\x20sent','debug','error','code','UserVoiceQueue,\x20%s,\x20%s','message','info','bluebird'];(function(_0x461844,_0x5ced95){var _0x5c3d01=function(_0x4be194){while(--_0x4be194){_0x461844['push'](_0x461844['shift']());}};_0x5c3d01(++_0x5ced95);}(_0x703f,0x197));var _0xf703=function(_0x5c6d5e,_0x576c0d){_0x5c6d5e=_0x5c6d5e-0x0;var _0x52e46c=_0x703f[_0x5c6d5e];return _0x52e46c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf703('0x0'));var rs=require(_0xf703('0x1'));var fs=require('fs');var Redis=require(_0xf703('0x2'));var db=require(_0xf703('0x3'))['db'];var utils=require(_0xf703('0x4'));var logger=require(_0xf703('0x5'))(_0xf703('0x6'));var config=require(_0xf703('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf703('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x167658,_0x398f16,_0x4bc723){return new BPromise(function(_0x16b96b,_0xfd6f56){return client[_0xf703('0x9')](_0x167658,_0x4bc723)['then'](function(_0x48dfc0){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x398f16,_0xf703('0xa'));logger[_0xf703('0xb')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x398f16,_0xf703('0xa'),JSON['stringify'](_0x48dfc0));if(_0x48dfc0[_0xf703('0xc')]){if(_0x48dfc0[_0xf703('0xc')][_0xf703('0xd')]===0x1f4){logger[_0xf703('0xc')](_0xf703('0xe'),_0x398f16,_0x48dfc0['error'][_0xf703('0xf')]);return _0xfd6f56(_0x48dfc0[_0xf703('0xc')][_0xf703('0xf')]);}logger[_0xf703('0xc')](_0xf703('0xe'),_0x398f16,_0x48dfc0[_0xf703('0xc')][_0xf703('0xf')]);return _0x16b96b(_0x48dfc0[_0xf703('0xc')][_0xf703('0xf')]);}else{logger[_0xf703('0x10')](_0xf703('0xe'),_0x398f16,_0xf703('0xa'));_0x16b96b(_0x48dfc0['result']['message']);}})['catch'](function(_0xc1d0bd){logger[_0xf703('0xc')](_0xf703('0xe'),_0x398f16,_0xc1d0bd);_0xfd6f56(_0xc1d0bd);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index ef83437..934e7e8 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x473097,_0x3268db){var _0x2c50e3=function(_0x14562f){while(--_0x14562f){_0x473097['push'](_0x473097['shift']());}};_0x2c50e3(++_0x3268db);}(_0x70e0,0x17b));var _0x070e=function(_0x4c1496,_0x4269f4){_0x4c1496=_0x4c1496-0x0;var _0x3918e9=_0x70e0[_0x4c1496];return _0x3918e9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x479462,_0x3137db){var _0x479e5f=function(_0x38839f){while(--_0x38839f){_0x479462['push'](_0x479462['shift']());}};_0x479e5f(++_0x3137db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 4ab6fc2..c1b1bfc 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 _0x67e2=['exports','Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface','sequelize'];(function(_0x589764,_0x4dd7f0){var _0x3847e6=function(_0x5c6c54){while(--_0x5c6c54){_0x589764['push'](_0x589764['shift']());}};_0x3847e6(++_0x4dd7f0);}(_0x67e2,0x16d));var _0x267e=function(_0x160ccd,_0x10f9f8){_0x160ccd=_0x160ccd-0x0;var _0x8668df=_0x67e2[_0x160ccd];return _0x8668df;};'use strict';var Sequelize=require(_0x267e('0x0'));module[_0x267e('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x267e('0x2')},'membername':{'type':Sequelize[_0x267e('0x3')],'allowNull':![],'comment':_0x267e('0x2')},'UserId':{'type':Sequelize[_0x267e('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x267e('0x3')],'allowNull':![],'unique':_0x267e('0x5'),'comment':_0x267e('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x267e('0x3')],'allowNull':![],'unique':_0x267e('0x5'),'comment':_0x267e('0x2')},'penalty':{'type':Sequelize[_0x267e('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x267e('0x4')](0xb),'defaultValue':0x0,'comment':_0x267e('0x2')}}; \ No newline at end of file +var _0x5041=['INTEGER','queue_interface','exports','Required\x20by\x20Asterisk','STRING'];(function(_0x502b7a,_0x580526){var _0x497698=function(_0x12e9e0){while(--_0x12e9e0){_0x502b7a['push'](_0x502b7a['shift']());}};_0x497698(++_0x580526);}(_0x5041,0x1ce));var _0x1504=function(_0x4bf675,_0x207936){_0x4bf675=_0x4bf675-0x0;var _0x49cb35=_0x5041[_0x4bf675];return _0x49cb35;};'use strict';var Sequelize=require('sequelize');module[_0x1504('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1504('0x1')},'membername':{'type':Sequelize[_0x1504('0x2')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x1504('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1504('0x2')],'allowNull':![],'unique':_0x1504('0x4'),'comment':_0x1504('0x1')},'VoiceQueueId':{'type':Sequelize[_0x1504('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x1504('0x2')],'allowNull':![],'unique':_0x1504('0x4'),'comment':_0x1504('0x1')},'penalty':{'type':Sequelize[_0x1504('0x3')](0xb),'defaultValue':0x0,'comment':_0x1504('0x1')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x1504('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 76b173a..a7edb5d 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 _0x023e=['emit','hasOwnProperty','hook','exports','../../mysqldb','save','update','remove'];(function(_0x21afd5,_0x57b9ba){var _0x59b71d=function(_0x4e4a15){while(--_0x4e4a15){_0x21afd5['push'](_0x21afd5['shift']());}};_0x59b71d(++_0x57b9ba);}(_0x023e,0x19c));var _0xe023=function(_0x3de328,_0x406810){_0x3de328=_0x3de328-0x0;var _0x54a585=_0x023e[_0x3de328];return _0x54a585;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xe023('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe023('0x1'),'afterUpdate':_0xe023('0x2'),'afterDestroy':_0xe023('0x3')};function emitEvent(_0x537107){return function(_0xbbad49,_0xff4c6b,_0x429d1a){UserVoiceQueueRtEvents[_0xe023('0x4')](_0x537107+':'+_0xbbad49['id'],_0xbbad49);UserVoiceQueueRtEvents[_0xe023('0x4')](_0x537107,_0xbbad49);_0x429d1a(null);};}for(var e in events){if(events[_0xe023('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xe023('0x6')](e,emitEvent(event));}}module[_0xe023('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x5eca=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x290201,_0x279632){var _0x3d5c08=function(_0x3d0f41){while(--_0x3d0f41){_0x290201['push'](_0x290201['shift']());}};_0x3d5c08(++_0x279632);}(_0x5eca,0x11d));var _0xa5ec=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5eca[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xa5ec('0x0'));var UserVoiceQueueRt=require(_0xa5ec('0x1'))['db'][_0xa5ec('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa5ec('0x3')](0x0);var events={'afterCreate':_0xa5ec('0x4'),'afterUpdate':_0xa5ec('0x5'),'afterDestroy':_0xa5ec('0x6')};function emitEvent(_0xa778c7){return function(_0xf7ba02,_0x2d9651,_0x4f38db){UserVoiceQueueRtEvents[_0xa5ec('0x7')](_0xa778c7+':'+_0xf7ba02['id'],_0xf7ba02);UserVoiceQueueRtEvents[_0xa5ec('0x7')](_0xa778c7,_0xf7ba02);_0x4f38db(null);};}for(var e in events){if(events[_0xa5ec('0x8')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xa5ec('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index f72d643..4f66254 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 _0x373f=['exports','UserVoiceQueueRt','user_has_voice_queues_rt','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x14c72b,_0x583726){var _0x5796b4=function(_0xca8165){while(--_0xca8165){_0x14c72b['push'](_0x14c72b['shift']());}};_0x5796b4(++_0x583726);}(_0x373f,0x108));var _0xf373=function(_0x116e3e,_0x3ad9ec){_0x116e3e=_0x116e3e-0x0;var _0x47b759=_0x373f[_0x116e3e];return _0x47b759;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf373('0x0'));var moment=require(_0xf373('0x1'));var BPromise=require('bluebird');var rp=require(_0xf373('0x2'));var fs=require('fs');var path=require(_0xf373('0x3'));var rimraf=require(_0xf373('0x4'));var config=require(_0xf373('0x5'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xf373('0x6')]=function(_0x32e9c9,_0x30c387){return _0x32e9c9['define'](_0xf373('0x7'),attributes,{'tableName':_0xf373('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa089=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger'];(function(_0x512f8c,_0x3545c1){var _0x2099f8=function(_0x5293eb){while(--_0x5293eb){_0x512f8c['push'](_0x512f8c['shift']());}};_0x2099f8(++_0x3545c1);}(_0xa089,0x8c));var _0x9a08=function(_0x5621c9,_0x3ddc3e){_0x5621c9=_0x5621c9-0x0;var _0x4cdb82=_0xa089[_0x5621c9];return _0x4cdb82;};'use strict';var _=require(_0x9a08('0x0'));var util=require(_0x9a08('0x1'));var logger=require(_0x9a08('0x2'))('api');var moment=require(_0x9a08('0x3'));var BPromise=require(_0x9a08('0x4'));var rp=require(_0x9a08('0x5'));var fs=require('fs');var path=require(_0x9a08('0x6'));var rimraf=require(_0x9a08('0x7'));var config=require(_0x9a08('0x8'));var attributes=require(_0x9a08('0x9'));module[_0x9a08('0xa')]=function(_0x2b08cf,_0x12d3f6){return _0x2b08cf['define'](_0x9a08('0xb'),attributes,{'tableName':_0x9a08('0xc'),'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 3f142e3..3293d50 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 _0xae3e=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x47f78f,_0x4ea0f3){var _0x5af099=function(_0x3a2722){while(--_0x3a2722){_0x47f78f['push'](_0x47f78f['shift']());}};_0x5af099(++_0x4ea0f3);}(_0xae3e,0x1d9));var _0xeae3=function(_0x20f08b,_0x646ea0){_0x20f08b=_0x20f08b-0x0;var _0x675062=_0xae3e[_0x20f08b];return _0x675062;};'use strict';var _=require(_0xeae3('0x0'));var util=require(_0xeae3('0x1'));var moment=require(_0xeae3('0x2'));var BPromise=require(_0xeae3('0x3'));var rs=require(_0xeae3('0x4'));var fs=require('fs');var Redis=require(_0xeae3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xeae3('0x6'));var logger=require('../../config/logger')(_0xeae3('0x7'));var config=require(_0xeae3('0x8'));var jayson=require(_0xeae3('0x9'));var client=jayson[_0xeae3('0xa')][_0xeae3('0xb')]({'port':0x232a});config[_0xeae3('0xc')]=_['defaults'](config[_0xeae3('0xc')],{'host':_0xeae3('0xd'),'port':0x18eb});var socket=require(_0xeae3('0xe'))(new Redis(config[_0xeae3('0xc')]));require('./userVoiceQueueRt.socket')[_0xeae3('0xf')](socket);function respondWithRpcPromise(_0x3399c0,_0x54add1,_0x3adc5f){return new BPromise(function(_0x505256,_0x17c1b6){return client[_0xeae3('0x10')](_0x3399c0,_0x3adc5f)[_0xeae3('0x11')](function(_0x4b6623){logger[_0xeae3('0x12')](_0xeae3('0x13'),_0x54add1,'request\x20sent');logger[_0xeae3('0x14')](_0xeae3('0x15'),_0x54add1,_0xeae3('0x16'),JSON[_0xeae3('0x17')](_0x4b6623));if(_0x4b6623[_0xeae3('0x18')]){if(_0x4b6623[_0xeae3('0x18')][_0xeae3('0x19')]===0x1f4){logger[_0xeae3('0x18')](_0xeae3('0x13'),_0x54add1,_0x4b6623['error'][_0xeae3('0x1a')]);return _0x17c1b6(_0x4b6623[_0xeae3('0x18')][_0xeae3('0x1a')]);}logger['error'](_0xeae3('0x13'),_0x54add1,_0x4b6623[_0xeae3('0x18')]['message']);return _0x505256(_0x4b6623['error'][_0xeae3('0x1a')]);}else{logger[_0xeae3('0x12')](_0xeae3('0x13'),_0x54add1,_0xeae3('0x16'));_0x505256(_0x4b6623[_0xeae3('0x1b')]['message']);}})[_0xeae3('0x1c')](function(_0x18283a){logger['error'](_0xeae3('0x13'),_0x54add1,_0x18283a);_0x17c1b6(_0x18283a);});});}exports[_0xeae3('0x1d')]=function(_0x233139){var _0x2ddf9c=this;return new Promise(function(_0x25b7bc,_0x4b91f6){return db[_0xeae3('0x1e')][_0xeae3('0x1f')]({'raw':_0x233139[_0xeae3('0x20')]?_0x233139['options'][_0xeae3('0x21')]===undefined?!![]:![]:!![],'where':_0x233139[_0xeae3('0x20')]?_0x233139[_0xeae3('0x20')][_0xeae3('0x22')]||null:null,'attributes':[[db[_0xeae3('0x23')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xeae3('0x24')]]})['then'](function(_0x5f22da){logger[_0xeae3('0x12')]('GetVoiceQueueRtPauses',_0x233139);logger['debug'](_0xeae3('0x1d'),_0x233139,JSON[_0xeae3('0x17')](_0x5f22da));_0x25b7bc(_0x5f22da);})['catch'](function(_0x4b45f3){logger[_0xeae3('0x18')](_0xeae3('0x1d'),_0x4b45f3['message'],_0x233139);_0x4b91f6(_0x2ddf9c[_0xeae3('0x18')](0x1f4,_0x4b45f3[_0xeae3('0x1a')]));});});}; \ No newline at end of file +var _0x5843=['UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','UserVoiceQueueRt,\x20%s,\x20%s','message','info','result','catch','findAll','options','raw','where','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','debug'];(function(_0xdd775e,_0x595f6b){var _0x3aba8=function(_0x51bc32){while(--_0x51bc32){_0xdd775e['push'](_0xdd775e['shift']());}};_0x3aba8(++_0x595f6b);}(_0x5843,0x1c2));var _0x3584=function(_0x3d8f5b,_0xe2d7e4){_0x3d8f5b=_0x3d8f5b-0x0;var _0x5e6317=_0x5843[_0x3d8f5b];return _0x5e6317;};'use strict';var _=require(_0x3584('0x0'));var util=require('util');var moment=require(_0x3584('0x1'));var BPromise=require('bluebird');var rs=require(_0x3584('0x2'));var fs=require('fs');var Redis=require(_0x3584('0x3'));var db=require(_0x3584('0x4'))['db'];var utils=require(_0x3584('0x5'));var logger=require('../../config/logger')(_0x3584('0x6'));var config=require('../../config/environment');var jayson=require(_0x3584('0x7'));var client=jayson[_0x3584('0x8')][_0x3584('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3584('0xa')],{'host':_0x3584('0xb'),'port':0x18eb});var socket=require(_0x3584('0xc'))(new Redis(config[_0x3584('0xa')]));require(_0x3584('0xd'))[_0x3584('0xe')](socket);function respondWithRpcPromise(_0x99188e,_0x5d1502,_0xe2a757){return new BPromise(function(_0x174c62,_0xdbbb25){return client[_0x3584('0xf')](_0x99188e,_0xe2a757)[_0x3584('0x10')](function(_0x284350){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5d1502,'request\x20sent');logger[_0x3584('0x11')](_0x3584('0x12'),_0x5d1502,_0x3584('0x13'),JSON['stringify'](_0x284350));if(_0x284350[_0x3584('0x14')]){if(_0x284350[_0x3584('0x14')]['code']===0x1f4){logger['error'](_0x3584('0x15'),_0x5d1502,_0x284350[_0x3584('0x14')][_0x3584('0x16')]);return _0xdbbb25(_0x284350['error'][_0x3584('0x16')]);}logger['error'](_0x3584('0x15'),_0x5d1502,_0x284350[_0x3584('0x14')][_0x3584('0x16')]);return _0x174c62(_0x284350[_0x3584('0x14')][_0x3584('0x16')]);}else{logger[_0x3584('0x17')](_0x3584('0x15'),_0x5d1502,_0x3584('0x13'));_0x174c62(_0x284350[_0x3584('0x18')]['message']);}})[_0x3584('0x19')](function(_0x1ff571){logger[_0x3584('0x14')](_0x3584('0x15'),_0x5d1502,_0x1ff571);_0xdbbb25(_0x1ff571);});});}exports['GetVoiceQueueRtPauses']=function(_0x13f7d9){var _0x439fd1=this;return new Promise(function(_0x3cc0f3,_0xad3360){return db['UserVoiceQueueRt'][_0x3584('0x1a')]({'raw':_0x13f7d9[_0x3584('0x1b')]?_0x13f7d9[_0x3584('0x1b')][_0x3584('0x1c')]===undefined?!![]:![]:!![],'where':_0x13f7d9['options']?_0x13f7d9['options'][_0x3584('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0x3584('0x1e'),db[_0x3584('0x1f')]['fn']('IF',db[_0x3584('0x1f')]['literal'](_0x3584('0x20')))),_0x3584('0x21')]]})['then'](function(_0x2b2cb6){logger[_0x3584('0x17')]('GetVoiceQueueRtPauses',_0x13f7d9);logger[_0x3584('0x11')](_0x3584('0x22'),_0x13f7d9,JSON[_0x3584('0x23')](_0x2b2cb6));_0x3cc0f3(_0x2b2cb6);})[_0x3584('0x19')](function(_0x2fb3d2){logger[_0x3584('0x14')](_0x3584('0x22'),_0x2fb3d2[_0x3584('0x16')],_0x13f7d9);_0xad3360(_0x439fd1[_0x3584('0x14')](0x1f4,_0x2fb3d2[_0x3584('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index b7ba984..5017b96 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 _0xd67b=['userVoiceQueueRt:','save','update','emit','register','length'];(function(_0x4a3a1f,_0xcbeee1){var _0x2f85b6=function(_0x3837a7){while(--_0x3837a7){_0x4a3a1f['push'](_0x4a3a1f['shift']());}};_0x2f85b6(++_0xcbeee1);}(_0xd67b,0x133));var _0xbd67=function(_0x3f6c31,_0x4ffb0e){_0x3f6c31=_0x3f6c31-0x0;var _0x2d0112=_0xd67b[_0x3f6c31];return _0x2d0112;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xbd67('0x0'),'remove',_0xbd67('0x1')];function createListener(_0x280954,_0x317e33){return function(_0x5e967b){_0x317e33[_0xbd67('0x2')](_0x280954,_0x5e967b);};}function removeListener(_0x50da5a,_0x1bf96){return function(){UserVoiceQueueRtEvents['removeListener'](_0x50da5a,_0x1bf96);};}exports[_0xbd67('0x3')]=function(_0xa5c384){for(var _0x2ad142=0x0,_0x27b016=events[_0xbd67('0x4')];_0x2ad142<_0x27b016;_0x2ad142++){var _0x72f9ac=events[_0x2ad142];var _0x2d4af6=createListener(_0xbd67('0x5')+_0x72f9ac,_0xa5c384);UserVoiceQueueRtEvents['on'](_0x72f9ac,_0x2d4af6);}}; \ No newline at end of file +var _0xc9b9=['remove','update','length'];(function(_0x36afd7,_0x1181dc){var _0x2e0da0=function(_0x2254e1){while(--_0x2254e1){_0x36afd7['push'](_0x36afd7['shift']());}};_0x2e0da0(++_0x1181dc);}(_0xc9b9,0x18f));var _0x9c9b=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0xc9b9[_0x56e4e7];return _0x383618;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x9c9b('0x0'),_0x9c9b('0x1')];function createListener(_0x3418ab,_0x4e2e8d){return function(_0x5ee8f8){_0x4e2e8d['emit'](_0x3418ab,_0x5ee8f8);};}function removeListener(_0x497d53,_0x38a64b){return function(){UserVoiceQueueRtEvents['removeListener'](_0x497d53,_0x38a64b);};}exports['register']=function(_0x51abae){for(var _0x1f29f3=0x0,_0x15d94b=events[_0x9c9b('0x2')];_0x1f29f3<_0x15d94b;_0x1f29f3++){var _0x193305=events[_0x1f29f3];var _0xbbd998=createListener('userVoiceQueueRt:'+_0x193305,_0x51abae);UserVoiceQueueRtEvents['on'](_0x193305,_0xbbd998);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index a66afc6..0371e56 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4a56d1,_0xfb2dc1){var _0x8d8656=function(_0x4b8c01){while(--_0x4b8c01){_0x4a56d1['push'](_0x4a56d1['shift']());}};_0x8d8656(++_0xfb2dc1);}(_0x70e0,0x17b));var _0x070e=function(_0x3d69c9,_0x129a38){_0x3d69c9=_0x3d69c9-0x0;var _0x53ffb3=_0x70e0[_0x3d69c9];return _0x53ffb3;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x58aa39,_0x1aa0a4){var _0x4f8e52=function(_0x1aa610){while(--_0x1aa610){_0x58aa39['push'](_0x58aa39['shift']());}};_0x4f8e52(++_0x1aa0a4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x325501,_0x5242f6){_0x325501=_0x325501-0x0;var _0x2c1626=_0xcb91[_0x325501];return _0x2c1626;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index e294c04..a7152ac 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 _0x9c5e=['INTEGER','exports'];(function(_0x3393a9,_0x451ff4){var _0x454585=function(_0x314e38){while(--_0x314e38){_0x3393a9['push'](_0x3393a9['shift']());}};_0x454585(++_0x451ff4);}(_0x9c5e,0x113));var _0xe9c5=function(_0x1ab170,_0x5197ff){_0x1ab170=_0x1ab170-0x0;var _0x431698=_0x9c5e[_0x1ab170];return _0x431698;};'use strict';var Sequelize=require('sequelize');module[_0xe9c5('0x0')]={'penalty':{'type':Sequelize[_0xe9c5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe67e=['exports','INTEGER'];(function(_0x1a8902,_0x8d7776){var _0x4585bd=function(_0x1e8824){while(--_0x1e8824){_0x1a8902['push'](_0x1a8902['shift']());}};_0x4585bd(++_0x8d7776);}(_0xe67e,0x142));var _0xee67=function(_0x23e8a1,_0x5e06ca){_0x23e8a1=_0x23e8a1-0x0;var _0x46ef5a=_0xe67e[_0x23e8a1];return _0x46ef5a;};'use strict';var Sequelize=require('sequelize');module[_0xee67('0x0')]={'penalty':{'type':Sequelize[_0xee67('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 9fed758..4914de4 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 _0xdf0d=['path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','util','api','moment','bluebird','request-promise'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xdf0d,0x1b7));var _0xddf0=function(_0x3054f8,_0x1e6528){_0x3054f8=_0x3054f8-0x0;var _0x45d366=_0xdf0d[_0x3054f8];return _0x45d366;};'use strict';var _=require('lodash');var util=require(_0xddf0('0x0'));var logger=require('../../config/logger')(_0xddf0('0x1'));var moment=require(_0xddf0('0x2'));var BPromise=require(_0xddf0('0x3'));var rp=require(_0xddf0('0x4'));var fs=require('fs');var path=require(_0xddf0('0x5'));var rimraf=require(_0xddf0('0x6'));var config=require(_0xddf0('0x7'));var attributes=require(_0xddf0('0x8'));module[_0xddf0('0x9')]=function(_0x59e321,_0x236449){return _0x59e321['define'](_0xddf0('0xa'),attributes,{'tableName':_0xddf0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbccb=['user_has_whatsapp_queues','lodash','util','api','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue'];(function(_0x12da97,_0x42a458){var _0x2d8ba3=function(_0x407ec3){while(--_0x407ec3){_0x12da97['push'](_0x12da97['shift']());}};_0x2d8ba3(++_0x42a458);}(_0xbccb,0xb1));var _0xbbcc=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0xbccb[_0x3c4f1f];return _0x19cb69;};'use strict';var _=require(_0xbbcc('0x0'));var util=require(_0xbbcc('0x1'));var logger=require('../../config/logger')(_0xbbcc('0x2'));var moment=require('moment');var BPromise=require(_0xbbcc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbcc('0x4'));var rimraf=require(_0xbbcc('0x5'));var config=require(_0xbbcc('0x6'));var attributes=require(_0xbbcc('0x7'));module[_0xbbcc('0x8')]=function(_0x86b5b0,_0x3b9358){return _0x86b5b0['define'](_0xbbcc('0x9'),attributes,{'tableName':_0xbbcc('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 8779012..6a718e2 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 _0xab29=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','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','lodash','util','moment','bluebird'];(function(_0x23c05f,_0x149b3a){var _0x232821=function(_0x4a1d48){while(--_0x4a1d48){_0x23c05f['push'](_0x23c05f['shift']());}};_0x232821(++_0x149b3a);}(_0xab29,0x11a));var _0x9ab2=function(_0x147dd1,_0x4f67d3){_0x147dd1=_0x147dd1-0x0;var _0x593952=_0xab29[_0x147dd1];return _0x593952;};'use strict';var _=require(_0x9ab2('0x0'));var util=require(_0x9ab2('0x1'));var moment=require(_0x9ab2('0x2'));var BPromise=require(_0x9ab2('0x3'));var rs=require(_0x9ab2('0x4'));var fs=require('fs');var Redis=require(_0x9ab2('0x5'));var db=require(_0x9ab2('0x6'))['db'];var utils=require(_0x9ab2('0x7'));var logger=require(_0x9ab2('0x8'))(_0x9ab2('0x9'));var config=require(_0x9ab2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9ab2('0xb')][_0x9ab2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x160312,_0x2278ed,_0x2daa80){return new BPromise(function(_0x1d2a4d,_0x34d794){return client[_0x9ab2('0xd')](_0x160312,_0x2daa80)[_0x9ab2('0xe')](function(_0x820ffe){logger['info'](_0x9ab2('0xf'),_0x2278ed,_0x9ab2('0x10'));logger[_0x9ab2('0x11')](_0x9ab2('0x12'),_0x2278ed,_0x9ab2('0x10'),JSON[_0x9ab2('0x13')](_0x820ffe));if(_0x820ffe[_0x9ab2('0x14')]){if(_0x820ffe['error'][_0x9ab2('0x15')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x2278ed,_0x820ffe['error']['message']);return _0x34d794(_0x820ffe[_0x9ab2('0x14')][_0x9ab2('0x16')]);}logger['error'](_0x9ab2('0xf'),_0x2278ed,_0x820ffe[_0x9ab2('0x14')][_0x9ab2('0x16')]);return _0x1d2a4d(_0x820ffe[_0x9ab2('0x14')][_0x9ab2('0x16')]);}else{logger[_0x9ab2('0x17')](_0x9ab2('0xf'),_0x2278ed,'request\x20sent');_0x1d2a4d(_0x820ffe[_0x9ab2('0x18')][_0x9ab2('0x16')]);}})[_0x9ab2('0x19')](function(_0x4f367e){logger[_0x9ab2('0x14')](_0x9ab2('0xf'),_0x2278ed,_0x4f367e);_0x34d794(_0x4f367e);});});} \ No newline at end of file +var _0x15cf=['error','message','UserWhatsappQueue,\x20%s,\x20%s','info','result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','request\x20sent','stringify'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x15cf,0xd2));var _0xf15c=function(_0x32d414,_0x4d23da){_0x32d414=_0x32d414-0x0;var _0x4e0bca=_0x15cf[_0x32d414];return _0x4e0bca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf15c('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf15c('0x1'));var db=require(_0xf15c('0x2'))['db'];var utils=require(_0xf15c('0x3'));var logger=require(_0xf15c('0x4'))('rpc');var config=require(_0xf15c('0x5'));var jayson=require(_0xf15c('0x6'));var client=jayson['client'][_0xf15c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1302e3,_0xbe39e4,_0x458a16){return new BPromise(function(_0x396909,_0x3116c1){return client[_0xf15c('0x8')](_0x1302e3,_0x458a16)['then'](function(_0x5a0801){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0xbe39e4,'request\x20sent');logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0xbe39e4,_0xf15c('0x9'),JSON[_0xf15c('0xa')](_0x5a0801));if(_0x5a0801[_0xf15c('0xb')]){if(_0x5a0801['error']['code']===0x1f4){logger[_0xf15c('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0xbe39e4,_0x5a0801[_0xf15c('0xb')][_0xf15c('0xc')]);return _0x3116c1(_0x5a0801[_0xf15c('0xb')][_0xf15c('0xc')]);}logger[_0xf15c('0xb')](_0xf15c('0xd'),_0xbe39e4,_0x5a0801[_0xf15c('0xb')]['message']);return _0x396909(_0x5a0801[_0xf15c('0xb')][_0xf15c('0xc')]);}else{logger[_0xf15c('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0xbe39e4,_0xf15c('0x9'));_0x396909(_0x5a0801[_0xf15c('0xf')][_0xf15c('0xc')]);}})[_0xf15c('0x10')](function(_0xe51add){logger[_0xf15c('0xb')](_0xf15c('0xd'),_0xbe39e4,_0xe51add);_0x3116c1(_0xe51add);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 2a7d4db..e91ef08 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 _0x616c=['/:id','post','put','destroy','util','path','express','Router','fs-extra','../../components/auth/service','./variable.controller','get','isAuthenticated','index'];(function(_0x5520f8,_0x3a53cb){var _0x4478ad=function(_0x13128a){while(--_0x13128a){_0x5520f8['push'](_0x5520f8['shift']());}};_0x4478ad(++_0x3a53cb);}(_0x616c,0x1b6));var _0xc616=function(_0x54f677,_0x3076eb){_0x54f677=_0x54f677-0x0;var _0x510d78=_0x616c[_0x54f677];return _0x510d78;};'use strict';var multer=require('multer');var util=require(_0xc616('0x0'));var path=require(_0xc616('0x1'));var timeout=require('connect-timeout');var express=require(_0xc616('0x2'));var router=express[_0xc616('0x3')]();var fs_extra=require(_0xc616('0x4'));var auth=require(_0xc616('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc616('0x6'));router[_0xc616('0x7')]('/',auth[_0xc616('0x8')](),controller[_0xc616('0x9')]);router[_0xc616('0x7')](_0xc616('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xc616('0xb')]('/',auth[_0xc616('0x8')](),controller['create']);router[_0xc616('0xc')]('/:id',auth[_0xc616('0x8')](),controller['update']);router['delete'](_0xc616('0xa'),auth[_0xc616('0x8')](),controller[_0xc616('0xd')]);module['exports']=router; \ No newline at end of file +var _0xe489=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./variable.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x35456d,_0x11a9aa){var _0x57b49d=function(_0x1743cd){while(--_0x1743cd){_0x35456d['push'](_0x35456d['shift']());}};_0x57b49d(++_0x11a9aa);}(_0xe489,0x9e));var _0x9e48=function(_0x4b879b,_0x3c6bc0){_0x4b879b=_0x4b879b-0x0;var _0x5030ee=_0xe489[_0x4b879b];return _0x5030ee;};'use strict';var multer=require(_0x9e48('0x0'));var util=require(_0x9e48('0x1'));var path=require('path');var timeout=require(_0x9e48('0x2'));var express=require(_0x9e48('0x3'));var router=express[_0x9e48('0x4')]();var fs_extra=require(_0x9e48('0x5'));var auth=require(_0x9e48('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e48('0x7'));router['get']('/',auth[_0x9e48('0x8')](),controller[_0x9e48('0x9')]);router[_0x9e48('0xa')](_0x9e48('0xb'),auth['isAuthenticated'](),controller[_0x9e48('0xc')]);router[_0x9e48('0xd')]('/',auth[_0x9e48('0x8')](),controller[_0x9e48('0xe')]);router[_0x9e48('0xf')]('/:id',auth[_0x9e48('0x8')](),controller[_0x9e48('0x10')]);router[_0x9e48('0x11')](_0x9e48('0xb'),auth['isAuthenticated'](),controller[_0x9e48('0x12')]);module[_0x9e48('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 16aa6ed..d72d4cd 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 _0xd50d=['name','sequelize','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd50d,0xc9));var _0xdd50=function(_0x2b5b14,_0x461015){_0x2b5b14=_0x2b5b14-0x0;var _0x1c6742=_0xd50d[_0x2b5b14];return _0x1c6742;};'use strict';var Sequelize=require(_0xdd50('0x0'));module[_0xdd50('0x1')]={'name':{'type':Sequelize[_0xdd50('0x2')],'unique':_0xdd50('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdd50('0x2')]}}; \ No newline at end of file +var _0xf45b=['STRING','name','sequelize','exports'];(function(_0x1f6b83,_0x5dd034){var _0x4d13e7=function(_0x4ec6c5){while(--_0x4ec6c5){_0x1f6b83['push'](_0x1f6b83['shift']());}};_0x4d13e7(++_0x5dd034);}(_0xf45b,0x13e));var _0xbf45=function(_0x23b106,_0x50acec){_0x23b106=_0x23b106-0x0;var _0x3c88e5=_0xf45b[_0x23b106];return _0x3c88e5;};'use strict';var Sequelize=require(_0xbf45('0x0'));module[_0xbf45('0x1')]={'name':{'type':Sequelize[_0xbf45('0x2')],'unique':_0xbf45('0x3'),'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 139a632..f5b8f6b 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 _0xb507=['findAll','rows','catch','show','params','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Variables','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','type','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x20350f,_0x3ff27a){var _0x5e5c9c=function(_0xc06fbd){while(--_0xc06fbd){_0x20350f['push'](_0x20350f['shift']());}};_0x5e5c9c(++_0x3ff27a);}(_0xb507,0x103));var _0x7b50=function(_0x448774,_0x45ddc7){_0x448774=_0x448774-0x0;var _0x46b2f6=_0xb507[_0x448774];return _0x46b2f6;};'use strict';var emlformat=require(_0x7b50('0x0'));var rimraf=require(_0x7b50('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b50('0x2'));var rp=require(_0x7b50('0x3'));var moment=require('moment');var BPromise=require(_0x7b50('0x4'));var Mustache=require(_0x7b50('0x5'));var util=require('util');var path=require(_0x7b50('0x6'));var sox=require(_0x7b50('0x7'));var csv=require(_0x7b50('0x8'));var ejs=require(_0x7b50('0x9'));var fs=require('fs');var fs_extra=require(_0x7b50('0xa'));var _=require(_0x7b50('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7b50('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7b50('0xd'));var Papa=require(_0x7b50('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7b50('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b50('0x10'));var logger=require(_0x7b50('0x11'))('api');var utils=require(_0x7b50('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e9151,_0x1acc6d){_0x1acc6d=_0x1acc6d||0xcc;return function(_0x1d93d9){if(_0x1d93d9){return _0x4e9151[_0x7b50('0x13')](_0x1acc6d);}return _0x4e9151[_0x7b50('0x14')](_0x1acc6d)[_0x7b50('0x15')]();};}function respondWithResult(_0x2525d4,_0x51556e){_0x51556e=_0x51556e||0xc8;return function(_0x14ea4c){if(_0x14ea4c){return _0x2525d4[_0x7b50('0x14')](_0x51556e)[_0x7b50('0x16')](_0x14ea4c);}};}function respondWithFilteredResult(_0x285a84,_0xc05353){return function(_0x1d7dc5){if(_0x1d7dc5){var _0x10e03b=typeof _0xc05353[_0x7b50('0x17')]===_0x7b50('0x18')&&typeof _0xc05353['limit']===_0x7b50('0x18');var _0x536ab3=_0x1d7dc5[_0x7b50('0x19')];var _0x2a26df=_0x10e03b?0x0:_0xc05353[_0x7b50('0x17')];var _0x31e8bc=_0x10e03b?_0x1d7dc5[_0x7b50('0x19')]:_0xc05353[_0x7b50('0x17')]+_0xc05353[_0x7b50('0x1a')];var _0x1818fe;if(_0x31e8bc>=_0x536ab3){_0x31e8bc=_0x536ab3;_0x1818fe=0xc8;}else{_0x1818fe=0xce;}_0x285a84[_0x7b50('0x14')](_0x1818fe);return _0x285a84[_0x7b50('0x1b')](_0x7b50('0x1c'),_0x2a26df+'-'+_0x31e8bc+'/'+_0x536ab3)[_0x7b50('0x16')](_0x1d7dc5);}return null;};}function patchUpdates(_0x26c076){return function(_0x5d0579){try{jsonpatch[_0x7b50('0x1d')](_0x5d0579,_0x26c076,!![]);}catch(_0x132b6a){return BPromise[_0x7b50('0x1e')](_0x132b6a);}return _0x5d0579[_0x7b50('0x1f')]();};}function saveUpdates(_0x23404c,_0xccd49c){return function(_0x3ea50e){if(_0x3ea50e){return _0x3ea50e['update'](_0x23404c)[_0x7b50('0x20')](function(_0x4ddc60){return _0x4ddc60;});}return null;};}function removeEntity(_0x4346f3,_0x42b1f6){return function(_0x5ea0c3){if(_0x5ea0c3){return _0x5ea0c3[_0x7b50('0x21')]()[_0x7b50('0x20')](function(){var _0x4bb96a=_0x5ea0c3[_0x7b50('0x22')]({'plain':!![]});var _0x1462fe='Variables';return db[_0x7b50('0x23')]['destroy']({'where':{'type':_0x1462fe,'resourceId':_0x4bb96a['id']}})[_0x7b50('0x20')](function(){return _0x5ea0c3;});})['then'](function(){_0x4346f3[_0x7b50('0x14')](0xcc)[_0x7b50('0x15')]();});}};}function handleEntityNotFound(_0x6c3510,_0x142fe9){return function(_0x2579ec){if(!_0x2579ec){_0x6c3510[_0x7b50('0x13')](0x194);}return _0x2579ec;};}function handleError(_0x3bec01,_0x590321){_0x590321=_0x590321||0x1f4;return function(_0x56813a){logger[_0x7b50('0x24')](_0x56813a[_0x7b50('0x25')]);if(_0x56813a[_0x7b50('0x26')]){delete _0x56813a[_0x7b50('0x26')];}_0x3bec01['status'](_0x590321)[_0x7b50('0x27')](_0x56813a);};}exports[_0x7b50('0x28')]=function(_0x1d3a57,_0x2bd89a){var _0x4919ea={},_0x15b819={},_0x1b03c0={'count':0x0,'rows':[]};var _0x1e8316=_[_0x7b50('0x29')](db[_0x7b50('0x2a')][_0x7b50('0x2b')],function(_0x53c5d9){return{'name':_0x53c5d9['fieldName'],'type':_0x53c5d9[_0x7b50('0x2c')]['key']};});_0x15b819['model']=_[_0x7b50('0x29')](_0x1e8316,'name');_0x15b819['query']=_[_0x7b50('0x2d')](_0x1d3a57['query']);_0x15b819[_0x7b50('0x2e')]=_[_0x7b50('0x2f')](_0x15b819['model'],_0x15b819[_0x7b50('0x30')]);_0x4919ea[_0x7b50('0x31')]=_[_0x7b50('0x2f')](_0x15b819[_0x7b50('0x32')],qs[_0x7b50('0x33')](_0x1d3a57[_0x7b50('0x30')][_0x7b50('0x33')]));_0x4919ea[_0x7b50('0x31')]=_0x4919ea['attributes'][_0x7b50('0x34')]?_0x4919ea[_0x7b50('0x31')]:_0x15b819[_0x7b50('0x32')];if(!_0x1d3a57[_0x7b50('0x30')][_0x7b50('0x35')](_0x7b50('0x36'))){_0x4919ea[_0x7b50('0x1a')]=qs[_0x7b50('0x1a')](_0x1d3a57[_0x7b50('0x30')][_0x7b50('0x1a')]);_0x4919ea['offset']=qs[_0x7b50('0x17')](_0x1d3a57[_0x7b50('0x30')]['offset']);}_0x4919ea[_0x7b50('0x37')]=qs[_0x7b50('0x38')](_0x1d3a57[_0x7b50('0x30')][_0x7b50('0x38')]);_0x4919ea['where']=qs['filters'](_[_0x7b50('0x39')](_0x1d3a57[_0x7b50('0x30')],_0x15b819[_0x7b50('0x2e')]),_0x1e8316);if(_0x1d3a57[_0x7b50('0x30')][_0x7b50('0x3a')]){_0x4919ea[_0x7b50('0x3b')]=_[_0x7b50('0x3c')](_0x4919ea[_0x7b50('0x3b')],{'$or':_[_0x7b50('0x29')](_0x1e8316,function(_0x1fae99){if(_0x1fae99[_0x7b50('0x2c')]!==_0x7b50('0x3d')){var _0xe6ba4f={};_0xe6ba4f[_0x1fae99[_0x7b50('0x26')]]={'$like':'%'+_0x1d3a57['query'][_0x7b50('0x3a')]+'%'};return _0xe6ba4f;}})});}_0x4919ea=_[_0x7b50('0x3c')]({},_0x4919ea,_0x1d3a57[_0x7b50('0x3e')]);var _0x20c8cf={'where':_0x4919ea[_0x7b50('0x3b')]};return db[_0x7b50('0x2a')][_0x7b50('0x19')](_0x20c8cf)['then'](function(_0x588e26){_0x1b03c0['count']=_0x588e26;if(_0x1d3a57[_0x7b50('0x30')][_0x7b50('0x3f')]){_0x4919ea[_0x7b50('0x40')]=[{'all':!![]}];}return db[_0x7b50('0x2a')][_0x7b50('0x41')](_0x4919ea);})[_0x7b50('0x20')](function(_0x895961){_0x1b03c0[_0x7b50('0x42')]=_0x895961;return _0x1b03c0;})['then'](respondWithFilteredResult(_0x2bd89a,_0x4919ea))[_0x7b50('0x43')](handleError(_0x2bd89a,null));};exports[_0x7b50('0x44')]=function(_0x42df60,_0xd20e84){var _0x273f7a={'raw':!![],'where':{'id':_0x42df60[_0x7b50('0x45')]['id']}},_0x29b924={};_0x29b924[_0x7b50('0x32')]=_[_0x7b50('0x2d')](db[_0x7b50('0x2a')][_0x7b50('0x2b')]);_0x29b924['query']=_[_0x7b50('0x2d')](_0x42df60[_0x7b50('0x30')]);_0x29b924[_0x7b50('0x2e')]=_[_0x7b50('0x2f')](_0x29b924[_0x7b50('0x32')],_0x29b924[_0x7b50('0x30')]);_0x273f7a[_0x7b50('0x31')]=_['intersection'](_0x29b924['model'],qs[_0x7b50('0x33')](_0x42df60[_0x7b50('0x30')][_0x7b50('0x33')]));_0x273f7a[_0x7b50('0x31')]=_0x273f7a['attributes']['length']?_0x273f7a[_0x7b50('0x31')]:_0x29b924[_0x7b50('0x32')];if(_0x42df60[_0x7b50('0x30')][_0x7b50('0x3f')]){_0x273f7a['include']=[{'all':!![]}];}_0x273f7a=_[_0x7b50('0x3c')]({},_0x273f7a,_0x42df60[_0x7b50('0x3e')]);return db[_0x7b50('0x2a')]['find'](_0x273f7a)['then'](handleEntityNotFound(_0xd20e84,null))[_0x7b50('0x20')](respondWithResult(_0xd20e84,null))['catch'](handleError(_0xd20e84,null));};exports['create']=function(_0x5477bb,_0x4d8591){return db['Variable']['create'](_0x5477bb[_0x7b50('0x46')],{})['then'](function(_0x3de4cc){var _0xf2ec72=_0x5477bb['user']['get']({'plain':!![]});if(!_0xf2ec72)throw new Error(_0x7b50('0x47'));if(_0xf2ec72[_0x7b50('0x48')]===_0x7b50('0x49')){var _0x414d56=_0x3de4cc[_0x7b50('0x22')]({'plain':!![]});var _0x3f6ea2=_0x7b50('0x4a');return db[_0x7b50('0x4b')][_0x7b50('0x4c')]({'where':{'name':_0x3f6ea2,'userProfileId':_0xf2ec72['userProfileId']},'raw':!![]})[_0x7b50('0x20')](function(_0x5029c1){if(_0x5029c1&&_0x5029c1[_0x7b50('0x4d')]===0x0){return db[_0x7b50('0x23')][_0x7b50('0x4e')]({'name':_0x414d56['name'],'resourceId':_0x414d56['id'],'type':_0x5029c1[_0x7b50('0x26')],'sectionId':_0x5029c1['id']},{})[_0x7b50('0x20')](function(){return _0x3de4cc;});}else{return _0x3de4cc;}})['catch'](function(_0x539a97){logger[_0x7b50('0x24')](_0x7b50('0x4f'),_0x539a97);throw _0x539a97;});}return _0x3de4cc;})['then'](respondWithResult(_0x4d8591,0xc9))[_0x7b50('0x43')](handleError(_0x4d8591,null));};exports[_0x7b50('0x50')]=function(_0x28c364,_0x19bd92){if(_0x28c364['body']['id']){delete _0x28c364[_0x7b50('0x46')]['id'];}return db[_0x7b50('0x2a')][_0x7b50('0x4c')]({'where':{'id':_0x28c364[_0x7b50('0x45')]['id']}})[_0x7b50('0x20')](handleEntityNotFound(_0x19bd92,null))['then'](saveUpdates(_0x28c364[_0x7b50('0x46')],null))[_0x7b50('0x20')](respondWithResult(_0x19bd92,null))[_0x7b50('0x43')](handleError(_0x19bd92,null));};exports['destroy']=function(_0x6feb6f,_0x523647){return db[_0x7b50('0x2a')]['find']({'where':{'id':_0x6feb6f[_0x7b50('0x45')]['id']}})[_0x7b50('0x20')](handleEntityNotFound(_0x523647,null))['then'](removeEntity(_0x523647,null))[_0x7b50('0x43')](handleError(_0x523647,null));}; \ No newline at end of file +var _0x2b02=['send','index','Variable','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','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/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name'];(function(_0x23a8b4,_0x2d005d){var _0x2c2e70=function(_0x3cf3ca){while(--_0x3cf3ca){_0x23a8b4['push'](_0x23a8b4['shift']());}};_0x2c2e70(++_0x2d005d);}(_0x2b02,0x177));var _0x22b0=function(_0xfb7376,_0x533f35){_0xfb7376=_0xfb7376-0x0;var _0x177286=_0x2b02[_0xfb7376];return _0x177286;};'use strict';var emlformat=require(_0x22b0('0x0'));var rimraf=require(_0x22b0('0x1'));var zipdir=require(_0x22b0('0x2'));var jsonpatch=require(_0x22b0('0x3'));var rp=require(_0x22b0('0x4'));var moment=require(_0x22b0('0x5'));var BPromise=require(_0x22b0('0x6'));var Mustache=require(_0x22b0('0x7'));var util=require(_0x22b0('0x8'));var path=require(_0x22b0('0x9'));var sox=require(_0x22b0('0xa'));var csv=require(_0x22b0('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22b0('0xc'));var _=require(_0x22b0('0xd'));var squel=require(_0x22b0('0xe'));var crypto=require(_0x22b0('0xf'));var jsforce=require(_0x22b0('0x10'));var deskjs=require(_0x22b0('0x11'));var toCsv=require(_0x22b0('0xb'));var querystring=require('querystring');var Papa=require(_0x22b0('0x12'));var Redis=require(_0x22b0('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x22b0('0x14'));var hardwareService=require(_0x22b0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x22b0('0x16'));var config=require(_0x22b0('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf6f798,_0x157d82){_0x157d82=_0x157d82||0xcc;return function(_0x3c0f17){if(_0x3c0f17){return _0xf6f798[_0x22b0('0x18')](_0x157d82);}return _0xf6f798['status'](_0x157d82)[_0x22b0('0x19')]();};}function respondWithResult(_0x758835,_0x4c47bf){_0x4c47bf=_0x4c47bf||0xc8;return function(_0x5e5c13){if(_0x5e5c13){return _0x758835[_0x22b0('0x1a')](_0x4c47bf)[_0x22b0('0x1b')](_0x5e5c13);}};}function respondWithFilteredResult(_0x3fd552,_0x45e99a){return function(_0x30a53a){if(_0x30a53a){var _0x3de6b3=typeof _0x45e99a['offset']==='undefined'&&typeof _0x45e99a[_0x22b0('0x1c')]===_0x22b0('0x1d');var _0x5c6554=_0x30a53a[_0x22b0('0x1e')];var _0x43af23=_0x3de6b3?0x0:_0x45e99a[_0x22b0('0x1f')];var _0x1797ef=_0x3de6b3?_0x30a53a[_0x22b0('0x1e')]:_0x45e99a[_0x22b0('0x1f')]+_0x45e99a[_0x22b0('0x1c')];var _0x324c43;if(_0x1797ef>=_0x5c6554){_0x1797ef=_0x5c6554;_0x324c43=0xc8;}else{_0x324c43=0xce;}_0x3fd552['status'](_0x324c43);return _0x3fd552['set'](_0x22b0('0x20'),_0x43af23+'-'+_0x1797ef+'/'+_0x5c6554)[_0x22b0('0x1b')](_0x30a53a);}return null;};}function patchUpdates(_0x89818b){return function(_0xd94a4b){try{jsonpatch[_0x22b0('0x21')](_0xd94a4b,_0x89818b,!![]);}catch(_0xf2f40b){return BPromise[_0x22b0('0x22')](_0xf2f40b);}return _0xd94a4b[_0x22b0('0x23')]();};}function saveUpdates(_0x2e5c63,_0x16574b){return function(_0x21a5c1){if(_0x21a5c1){return _0x21a5c1[_0x22b0('0x24')](_0x2e5c63)[_0x22b0('0x25')](function(_0x3b3a22){return _0x3b3a22;});}return null;};}function removeEntity(_0x373f1a,_0x233027){return function(_0x4e6f26){if(_0x4e6f26){return _0x4e6f26[_0x22b0('0x26')]()[_0x22b0('0x25')](function(){var _0x1e8351=_0x4e6f26[_0x22b0('0x27')]({'plain':!![]});var _0x36f3a7=_0x22b0('0x28');return db[_0x22b0('0x29')][_0x22b0('0x26')]({'where':{'type':_0x36f3a7,'resourceId':_0x1e8351['id']}})[_0x22b0('0x25')](function(){return _0x4e6f26;});})[_0x22b0('0x25')](function(){_0x373f1a['status'](0xcc)[_0x22b0('0x19')]();});}};}function handleEntityNotFound(_0x4ee591,_0x337134){return function(_0x3c7bb5){if(!_0x3c7bb5){_0x4ee591[_0x22b0('0x18')](0x194);}return _0x3c7bb5;};}function handleError(_0x2eff89,_0x34250e){_0x34250e=_0x34250e||0x1f4;return function(_0x379fcc){logger[_0x22b0('0x2a')](_0x379fcc[_0x22b0('0x2b')]);if(_0x379fcc[_0x22b0('0x2c')]){delete _0x379fcc[_0x22b0('0x2c')];}_0x2eff89[_0x22b0('0x1a')](_0x34250e)[_0x22b0('0x2d')](_0x379fcc);};}exports[_0x22b0('0x2e')]=function(_0x13420c,_0x4da144){var _0x196121={},_0x3f4628={},_0x25fb3d={'count':0x0,'rows':[]};var _0x4272f5=_['map'](db[_0x22b0('0x2f')][_0x22b0('0x30')],function(_0x2cecc9){return{'name':_0x2cecc9[_0x22b0('0x31')],'type':_0x2cecc9[_0x22b0('0x32')]['key']};});_0x3f4628[_0x22b0('0x33')]=_[_0x22b0('0x34')](_0x4272f5,_0x22b0('0x2c'));_0x3f4628[_0x22b0('0x35')]=_[_0x22b0('0x36')](_0x13420c['query']);_0x3f4628[_0x22b0('0x37')]=_[_0x22b0('0x38')](_0x3f4628[_0x22b0('0x33')],_0x3f4628[_0x22b0('0x35')]);_0x196121[_0x22b0('0x39')]=_[_0x22b0('0x38')](_0x3f4628[_0x22b0('0x33')],qs[_0x22b0('0x3a')](_0x13420c[_0x22b0('0x35')][_0x22b0('0x3a')]));_0x196121[_0x22b0('0x39')]=_0x196121[_0x22b0('0x39')]['length']?_0x196121[_0x22b0('0x39')]:_0x3f4628[_0x22b0('0x33')];if(!_0x13420c[_0x22b0('0x35')][_0x22b0('0x3b')](_0x22b0('0x3c'))){_0x196121['limit']=qs[_0x22b0('0x1c')](_0x13420c[_0x22b0('0x35')][_0x22b0('0x1c')]);_0x196121[_0x22b0('0x1f')]=qs[_0x22b0('0x1f')](_0x13420c[_0x22b0('0x35')][_0x22b0('0x1f')]);}_0x196121['order']=qs[_0x22b0('0x3d')](_0x13420c[_0x22b0('0x35')][_0x22b0('0x3d')]);_0x196121[_0x22b0('0x3e')]=qs[_0x22b0('0x37')](_[_0x22b0('0x3f')](_0x13420c[_0x22b0('0x35')],_0x3f4628['filters']),_0x4272f5);if(_0x13420c[_0x22b0('0x35')][_0x22b0('0x40')]){_0x196121[_0x22b0('0x3e')]=_[_0x22b0('0x41')](_0x196121[_0x22b0('0x3e')],{'$or':_[_0x22b0('0x34')](_0x4272f5,function(_0x40b55b){if(_0x40b55b[_0x22b0('0x32')]!==_0x22b0('0x42')){var _0x2a6e94={};_0x2a6e94[_0x40b55b[_0x22b0('0x2c')]]={'$like':'%'+_0x13420c[_0x22b0('0x35')]['filter']+'%'};return _0x2a6e94;}})});}_0x196121=_['merge']({},_0x196121,_0x13420c[_0x22b0('0x43')]);var _0xf3fc2c={'where':_0x196121[_0x22b0('0x3e')]};return db[_0x22b0('0x2f')]['count'](_0xf3fc2c)[_0x22b0('0x25')](function(_0x13b573){_0x25fb3d['count']=_0x13b573;if(_0x13420c[_0x22b0('0x35')]['includeAll']){_0x196121[_0x22b0('0x44')]=[{'all':!![]}];}return db[_0x22b0('0x2f')][_0x22b0('0x45')](_0x196121);})[_0x22b0('0x25')](function(_0x3a2327){_0x25fb3d[_0x22b0('0x46')]=_0x3a2327;return _0x25fb3d;})[_0x22b0('0x25')](respondWithFilteredResult(_0x4da144,_0x196121))[_0x22b0('0x47')](handleError(_0x4da144,null));};exports[_0x22b0('0x48')]=function(_0x20d557,_0x16d110){var _0x5eb7a3={'raw':!![],'where':{'id':_0x20d557['params']['id']}},_0x4855dd={};_0x4855dd[_0x22b0('0x33')]=_[_0x22b0('0x36')](db[_0x22b0('0x2f')]['rawAttributes']);_0x4855dd[_0x22b0('0x35')]=_[_0x22b0('0x36')](_0x20d557[_0x22b0('0x35')]);_0x4855dd[_0x22b0('0x37')]=_['intersection'](_0x4855dd[_0x22b0('0x33')],_0x4855dd[_0x22b0('0x35')]);_0x5eb7a3[_0x22b0('0x39')]=_[_0x22b0('0x38')](_0x4855dd[_0x22b0('0x33')],qs[_0x22b0('0x3a')](_0x20d557['query'][_0x22b0('0x3a')]));_0x5eb7a3[_0x22b0('0x39')]=_0x5eb7a3[_0x22b0('0x39')][_0x22b0('0x49')]?_0x5eb7a3['attributes']:_0x4855dd[_0x22b0('0x33')];if(_0x20d557[_0x22b0('0x35')][_0x22b0('0x4a')]){_0x5eb7a3['include']=[{'all':!![]}];}_0x5eb7a3=_['merge']({},_0x5eb7a3,_0x20d557[_0x22b0('0x43')]);return db[_0x22b0('0x2f')][_0x22b0('0x4b')](_0x5eb7a3)[_0x22b0('0x25')](handleEntityNotFound(_0x16d110,null))[_0x22b0('0x25')](respondWithResult(_0x16d110,null))[_0x22b0('0x47')](handleError(_0x16d110,null));};exports[_0x22b0('0x4c')]=function(_0x31c436,_0x4f13ea){return db[_0x22b0('0x2f')][_0x22b0('0x4c')](_0x31c436['body'],{})[_0x22b0('0x25')](function(_0x658579){var _0x1c64aa=_0x31c436[_0x22b0('0x4d')]['get']({'plain':!![]});if(!_0x1c64aa)throw new Error(_0x22b0('0x4e'));if(_0x1c64aa[_0x22b0('0x4f')]===_0x22b0('0x4d')){var _0x3ddd46=_0x658579[_0x22b0('0x27')]({'plain':!![]});var _0x3e8711='Variables';return db['UserProfileSection'][_0x22b0('0x4b')]({'where':{'name':_0x3e8711,'userProfileId':_0x1c64aa['userProfileId']},'raw':!![]})[_0x22b0('0x25')](function(_0x19aa7c){if(_0x19aa7c&&_0x19aa7c[_0x22b0('0x50')]===0x0){return db[_0x22b0('0x29')]['create']({'name':_0x3ddd46[_0x22b0('0x2c')],'resourceId':_0x3ddd46['id'],'type':_0x19aa7c[_0x22b0('0x2c')],'sectionId':_0x19aa7c['id']},{})[_0x22b0('0x25')](function(){return _0x658579;});}else{return _0x658579;}})[_0x22b0('0x47')](function(_0x45573f){logger['error'](_0x22b0('0x51'),_0x45573f);throw _0x45573f;});}return _0x658579;})[_0x22b0('0x25')](respondWithResult(_0x4f13ea,0xc9))['catch'](handleError(_0x4f13ea,null));};exports['update']=function(_0x2aac3a,_0x3fcf06){if(_0x2aac3a['body']['id']){delete _0x2aac3a['body']['id'];}return db[_0x22b0('0x2f')][_0x22b0('0x4b')]({'where':{'id':_0x2aac3a[_0x22b0('0x52')]['id']}})[_0x22b0('0x25')](handleEntityNotFound(_0x3fcf06,null))[_0x22b0('0x25')](saveUpdates(_0x2aac3a[_0x22b0('0x53')],null))[_0x22b0('0x25')](respondWithResult(_0x3fcf06,null))[_0x22b0('0x47')](handleError(_0x3fcf06,null));};exports[_0x22b0('0x26')]=function(_0x3379e8,_0x3fdee9){return db[_0x22b0('0x2f')]['find']({'where':{'id':_0x3379e8[_0x22b0('0x52')]['id']}})[_0x22b0('0x25')](handleEntityNotFound(_0x3fdee9,null))[_0x22b0('0x25')](removeEntity(_0x3fdee9,null))[_0x22b0('0x47')](handleError(_0x3fdee9,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index ad55cd0..2a96fa1 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 _0x4cef=['request-promise','path','../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash','../../config/logger','api','moment'];(function(_0x430022,_0x1a2433){var _0x1c1095=function(_0x188291){while(--_0x188291){_0x430022['push'](_0x430022['shift']());}};_0x1c1095(++_0x1a2433);}(_0x4cef,0x1e0));var _0xf4ce=function(_0x373daf,_0x18b9a8){_0x373daf=_0x373daf-0x0;var _0x1fa416=_0x4cef[_0x373daf];return _0x1fa416;};'use strict';var _=require(_0xf4ce('0x0'));var util=require('util');var logger=require(_0xf4ce('0x1'))(_0xf4ce('0x2'));var moment=require(_0xf4ce('0x3'));var BPromise=require('bluebird');var rp=require(_0xf4ce('0x4'));var fs=require('fs');var path=require(_0xf4ce('0x5'));var rimraf=require('rimraf');var config=require(_0xf4ce('0x6'));var attributes=require(_0xf4ce('0x7'));module[_0xf4ce('0x8')]=function(_0x376164,_0x43309a){return _0x376164['define'](_0xf4ce('0x9'),attributes,{'tableName':_0xf4ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98ae=['exports','Variable','lodash','util','api','moment','bluebird','path','../../config/environment','./variable.attributes'];(function(_0x10522f,_0x3d468b){var _0x5d0d4d=function(_0x20436e){while(--_0x20436e){_0x10522f['push'](_0x10522f['shift']());}};_0x5d0d4d(++_0x3d468b);}(_0x98ae,0x1ce));var _0xe98a=function(_0x41f4c8,_0x25d16d){_0x41f4c8=_0x41f4c8-0x0;var _0x1daa04=_0x98ae[_0x41f4c8];return _0x1daa04;};'use strict';var _=require(_0xe98a('0x0'));var util=require(_0xe98a('0x1'));var logger=require('../../config/logger')(_0xe98a('0x2'));var moment=require(_0xe98a('0x3'));var BPromise=require(_0xe98a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe98a('0x5'));var rimraf=require('rimraf');var config=require(_0xe98a('0x6'));var attributes=require(_0xe98a('0x7'));module[_0xe98a('0x8')]=function(_0x4adaa8,_0x774436){return _0x4adaa8['define'](_0xe98a('0x9'),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 50c783d..85c5bf4 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 _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x3ab4eb,_0x2088af){var _0x32b657=function(_0x319715){while(--_0x319715){_0x3ab4eb['push'](_0x3ab4eb['shift']());}};_0x32b657(++_0x2088af);}(_0x6aa7,0x178));var _0x76aa=function(_0xdba908,_0x3e2dca){_0xdba908=_0xdba908-0x0;var _0x4e6751=_0x6aa7[_0xdba908];return _0x4e6751;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ 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(_0x17d9ba,_0x4d980c){var _0x46185d=function(_0x1dce47){while(--_0x1dce47){_0x17d9ba['push'](_0x17d9ba['shift']());}};_0x46185d(++_0x4d980c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 f6cc4c1..26d70e1 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 _0x1989=['/restart','restart','/migrations','exports','express','Router','../../components/auth/service','get','index','isAuthenticated','canUpdate','reset','pull'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x1989,0x149));var _0x9198=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1989[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x9198('0x0'));var router=express[_0x9198('0x1')]();var auth=require(_0x9198('0x2'));var controller=require('./version.controller');router[_0x9198('0x3')]('/',controller[_0x9198('0x4')]);router[_0x9198('0x3')]('/fetch',auth[_0x9198('0x5')](),auth[_0x9198('0x6')](),controller['fetch']);router[_0x9198('0x3')]('/reset',auth[_0x9198('0x5')](),auth['canUpdate'](),controller[_0x9198('0x7')]);router[_0x9198('0x3')]('/pull',auth[_0x9198('0x5')](),auth[_0x9198('0x6')](),controller[_0x9198('0x8')]);router[_0x9198('0x3')](_0x9198('0x9'),auth['isAuthenticated'](),controller[_0x9198('0xa')]);router[_0x9198('0x3')](_0x9198('0xb'),controller['migrations']);module[_0x9198('0xc')]=router; \ No newline at end of file +var _0x9ca7=['/fetch','isAuthenticated','canUpdate','fetch','/pull','pull','/restart','restart','exports','Router','get','index'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x9ca7,0x1dd));var _0x79ca=function(_0x512fd6,_0x378b1d){_0x512fd6=_0x512fd6-0x0;var _0x176714=_0x9ca7[_0x512fd6];return _0x176714;};'use strict';var express=require('express');var router=express[_0x79ca('0x0')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x79ca('0x1')]('/',controller[_0x79ca('0x2')]);router['get'](_0x79ca('0x3'),auth[_0x79ca('0x4')](),auth[_0x79ca('0x5')](),controller[_0x79ca('0x6')]);router[_0x79ca('0x1')]('/reset',auth[_0x79ca('0x4')](),auth[_0x79ca('0x5')](),controller['reset']);router[_0x79ca('0x1')](_0x79ca('0x7'),auth[_0x79ca('0x4')](),auth[_0x79ca('0x5')](),controller[_0x79ca('0x8')]);router['get'](_0x79ca('0x9'),auth[_0x79ca('0x4')](),controller[_0x79ca('0xa')]);router[_0x79ca('0x1')]('/migrations',controller['migrations']);module[_0x79ca('0xb')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 92c5a37..98d2741 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 _0xc57f=['Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','child_process','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','tags','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','readdirSync','join','server','migrations','sort','sequelize','Migration','getQueryInterface','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError'];(function(_0x15b570,_0x480493){var _0x56250e=function(_0x4fe7b8){while(--_0x4fe7b8){_0x15b570['push'](_0x15b570['shift']());}};_0x56250e(++_0x480493);}(_0xc57f,0x9d));var _0xfc57=function(_0x363319,_0x4fa1a1){_0x363319=_0x363319-0x0;var _0x182a62=_0xc57f[_0x363319];return _0x182a62;};'use strict';var Umzug=require(_0xfc57('0x0'));var path=require(_0xfc57('0x1'));var fs=require('fs');var _=require(_0xfc57('0x2'));var pkginfo=require('pkginfo')(module,_0xfc57('0x3'));var compareVersions=require(_0xfc57('0x4'));var exec=require(_0xfc57('0x5'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0xfc57('0x6'));var pm2=require(_0xfc57('0x7'));var logger=require(_0xfc57('0x8'))(_0xfc57('0x9'));var git=require(_0xfc57('0xa'))(config[_0xfc57('0xb')]);exports[_0xfc57('0xc')]=function(_0x1bde6f,_0x351673){var _0x3596d1={'current':module[_0xfc57('0xd')][_0xfc57('0x3')],'phonebar':0x2};if(_0x1bde6f[_0xfc57('0xe')]&&_0x1bde6f[_0xfc57('0xe')][_0xfc57('0xf')]){return git['fetch']()[_0xfc57('0x10')](function(_0x549e4b,_0x362feb){_0x3596d1[_0xfc57('0xf')]=(_0x549e4b?module[_0xfc57('0xd')][_0xfc57('0x3')]:_0x362feb[_0xfc57('0xf')])||'2.0.0';return _0x351673[_0xfc57('0x11')](0xc8)[_0xfc57('0x12')](_0x3596d1);});}else{return _0x351673[_0xfc57('0x11')](0xc8)['json'](_0x3596d1);}};exports[_0xfc57('0x13')]=function(_0x5f4b2e,_0x3161ff){return git[_0xfc57('0x13')]([_0xfc57('0x14'),_0xfc57('0x15')],function(_0x9f56d1){if(_0x9f56d1){logger[_0xfc57('0x16')](_0x9f56d1);return _0x3161ff[_0xfc57('0x11')](0x1f4)[_0xfc57('0x12')](_0x9f56d1);}logger[_0xfc57('0x17')](_0xfc57('0x18'));return _0x3161ff[_0xfc57('0x11')](0xc8)[_0xfc57('0x12')]({'output':_0xfc57('0x19')});});};exports[_0xfc57('0x1a')]=function(_0x379b7e,_0xc77372){return git['reset']([_0xfc57('0x1b'),_0xfc57('0x1c')],function(_0x55e28a){if(_0x55e28a){logger[_0xfc57('0x16')](_0x55e28a);return _0xc77372['status'](0x1f4)['json'](_0x55e28a);}logger[_0xfc57('0x17')](_0xfc57('0x1d'));return _0xc77372[_0xfc57('0x11')](0xc8)[_0xfc57('0x12')]({'output':_0xfc57('0x1e')});});};exports[_0xfc57('0x1f')]=function(_0x3e3fdf,_0x56fdc3){exec(_0xfc57('0x20'),function(_0x5f5bac,_0x3626cd,_0x163acf){logger[_0xfc57('0x17')](_0x3626cd);logger[_0xfc57('0x17')](_0x163acf);if(_0x5f5bac){logger[_0xfc57('0x16')](_0x5f5bac);return _0x56fdc3[_0xfc57('0x11')](0x1f4)[_0xfc57('0x12')](_0x5f5bac);}return _0x56fdc3[_0xfc57('0x11')](0xc8)[_0xfc57('0x12')]({'output':_0x3626cd});});};exports[_0xfc57('0x21')]=function(_0x45f382,_0x353e91){return pm2['restart'](_0xfc57('0x22'))[_0xfc57('0x23')](function(_0xa6af74){logger['info'](_0xfc57('0x24'),_0xa6af74);return _0x353e91[_0xfc57('0x11')](0xc8)[_0xfc57('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xfc57('0x25')](function(_0x491558){logger[_0xfc57('0x16')](_0x491558);return _0x353e91['status'](0x1f4)[_0xfc57('0x12')](_0x491558);});};exports['migrations']=function(_0xfd7e6,_0x5494af){var _0x3953c3=fs[_0xfc57('0x26')](path[_0xfc57('0x27')](config[_0xfc57('0xb')],_0xfc57('0x28'),_0xfc57('0x29')));var _0x297c66=[];for(var _0x44a233=0x0;_0x44a233<_0x3953c3['length'];_0x44a233++){var _0x6275c3=_0x3953c3[_0x44a233]['replace']('.js','');if(compareVersions(module[_0xfc57('0xd')][_0xfc57('0x3')],_0x6275c3)===-0x1){_0x297c66['push'](_0x6275c3);}}if(_0x297c66['length']){var _0x35f193=_0x297c66[_0xfc57('0x2a')](compareVersions);var _0x550b97=new Umzug({'storage':_0xfc57('0x2b'),'storageOptions':{'model':db[_0xfc57('0x2c')],'modelName':_0xfc57('0x2c'),'columnName':_0xfc57('0x3')},'migrations':{'params':[db[_0xfc57('0x2b')][_0xfc57('0x2d')](),db[_0xfc57('0x2b')]['constructor'],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[_0xfc57('0x27')](config[_0xfc57('0xb')],_0xfc57('0x28'),_0xfc57('0x29')),'pattern':/\.js$/}});_0x550b97['up']({'migrations':_[_0xfc57('0x2e')](_0x35f193,function(_0x46efed){return _0x46efed+_0xfc57('0x2f');})})[_0xfc57('0x23')](function(){return _0x5494af['status'](0xc8)['json']({'output':_0xfc57('0x30')+module[_0xfc57('0xd')][_0xfc57('0x3')]+_0xfc57('0x31')+_['last'](_0x35f193),'migrations':_[_0xfc57('0x27')](_0x35f193)});})[_0xfc57('0x25')](function(_0x854dc4){if(_0x854dc4 instanceof db[_0xfc57('0x2b')][_0xfc57('0x32')]){return _0x5494af['status'](0xc8)['json']({'output':_0xfc57('0x33')});}else{return _0x5494af['status'](0x1f4)[_0xfc57('0x12')](_0x854dc4);}});}else{return _0x5494af[_0xfc57('0x11')](0xc8)[_0xfc57('0x12')]({'output':_0xfc57('0x33')});}}; \ No newline at end of file +var _0x318f=['../../config/environment','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','replace','.js','push','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb'];(function(_0x317b7b,_0xcc3504){var _0x2aff44=function(_0x548ad7){while(--_0x548ad7){_0x317b7b['push'](_0x317b7b['shift']());}};_0x2aff44(++_0xcc3504);}(_0x318f,0xcc));var _0xf318=function(_0x2af354,_0x5461d6){_0x2af354=_0x2af354-0x0;var _0x5c3864=_0x318f[_0x2af354];return _0x5c3864;};'use strict';var Umzug=require(_0xf318('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xf318('0x1'));var pkginfo=require(_0xf318('0x2'))(module,_0xf318('0x3'));var compareVersions=require(_0xf318('0x4'));var exec=require(_0xf318('0x5'))[_0xf318('0x6')];var db=require(_0xf318('0x7'))['db'];var config=require(_0xf318('0x8'));var pm2=require('../../config/pm2');var logger=require(_0xf318('0x9'))(_0xf318('0xa'));var git=require(_0xf318('0xb'))(config[_0xf318('0xc')]);exports[_0xf318('0xd')]=function(_0x37d264,_0x47490a){var _0x3bed2a={'current':module[_0xf318('0xe')][_0xf318('0x3')],'phonebar':0x2};if(_0x37d264[_0xf318('0xf')]&&_0x37d264['query'][_0xf318('0x10')]){return git[_0xf318('0x11')]()[_0xf318('0x12')](function(_0x18e1ac,_0x45e80e){_0x3bed2a[_0xf318('0x10')]=(_0x18e1ac?module[_0xf318('0xe')]['version']:_0x45e80e[_0xf318('0x10')])||'2.0.0';return _0x47490a[_0xf318('0x13')](0xc8)[_0xf318('0x14')](_0x3bed2a);});}else{return _0x47490a[_0xf318('0x13')](0xc8)[_0xf318('0x14')](_0x3bed2a);}};exports['fetch']=function(_0x24c06f,_0x1712e7){return git['fetch']([_0xf318('0x15'),_0xf318('0x16')],function(_0x243688){if(_0x243688){logger[_0xf318('0x17')](_0x243688);return _0x1712e7[_0xf318('0x13')](0x1f4)[_0xf318('0x14')](_0x243688);}logger['info'](_0xf318('0x18'));return _0x1712e7[_0xf318('0x13')](0xc8)[_0xf318('0x14')]({'output':_0xf318('0x19')});});};exports[_0xf318('0x1a')]=function(_0x4995ae,_0x139b23){return git[_0xf318('0x1a')]([_0xf318('0x1b'),_0xf318('0x1c')],function(_0x280918){if(_0x280918){logger[_0xf318('0x17')](_0x280918);return _0x139b23[_0xf318('0x13')](0x1f4)['json'](_0x280918);}logger[_0xf318('0x1d')](_0xf318('0x1e'));return _0x139b23[_0xf318('0x13')](0xc8)[_0xf318('0x14')]({'output':_0xf318('0x1f')});});};exports[_0xf318('0x20')]=function(_0x4d4b1d,_0x1f3c04){exec('npm\x20install\x20--production',function(_0x4662d5,_0x4e9a98,_0x575e41){logger[_0xf318('0x1d')](_0x4e9a98);logger[_0xf318('0x1d')](_0x575e41);if(_0x4662d5){logger[_0xf318('0x17')](_0x4662d5);return _0x1f3c04['status'](0x1f4)[_0xf318('0x14')](_0x4662d5);}return _0x1f3c04['status'](0xc8)[_0xf318('0x14')]({'output':_0x4e9a98});});};exports[_0xf318('0x21')]=function(_0x5b6071,_0x2aca43){return pm2[_0xf318('0x21')]('motion2')['then'](function(_0x3272b1){logger['info'](_0xf318('0x22'),_0x3272b1);return _0x2aca43['status'](0xc8)[_0xf318('0x14')]({'output':_0xf318('0x23')});})['catch'](function(_0x4d2392){logger[_0xf318('0x17')](_0x4d2392);return _0x2aca43[_0xf318('0x13')](0x1f4)[_0xf318('0x14')](_0x4d2392);});};exports[_0xf318('0x24')]=function(_0x2d73ea,_0x5d3014){var _0x4721b3=fs[_0xf318('0x25')](path[_0xf318('0x26')](config[_0xf318('0xc')],'server',_0xf318('0x24')));var _0x23688b=[];for(var _0x535472=0x0;_0x535472<_0x4721b3['length'];_0x535472++){var _0x385e3a=_0x4721b3[_0x535472][_0xf318('0x27')](_0xf318('0x28'),'');if(compareVersions(module[_0xf318('0xe')][_0xf318('0x3')],_0x385e3a)===-0x1){_0x23688b[_0xf318('0x29')](_0x385e3a);}}if(_0x23688b['length']){var _0x3347e8=_0x23688b['sort'](compareVersions);var _0x173c10=new Umzug({'storage':_0xf318('0x2a'),'storageOptions':{'model':db[_0xf318('0x2b')],'modelName':_0xf318('0x2b'),'columnName':_0xf318('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize'][_0xf318('0x2c')],function(){throw new Error(_0xf318('0x2d'));}],'path':path['join'](config[_0xf318('0xc')],_0xf318('0x2e'),_0xf318('0x24')),'pattern':/\.js$/}});_0x173c10['up']({'migrations':_['map'](_0x3347e8,function(_0x1f3d18){return _0x1f3d18+_0xf318('0x28');})})[_0xf318('0x2f')](function(){return _0x5d3014[_0xf318('0x13')](0xc8)[_0xf318('0x14')]({'output':_0xf318('0x30')+module[_0xf318('0xe')]['version']+_0xf318('0x31')+_[_0xf318('0x32')](_0x3347e8),'migrations':_[_0xf318('0x26')](_0x3347e8)});})['catch'](function(_0x50f70e){if(_0x50f70e instanceof db[_0xf318('0x2a')][_0xf318('0x33')]){return _0x5d3014[_0xf318('0x13')](0xc8)['json']({'output':_0xf318('0x34')});}else{return _0x5d3014[_0xf318('0x13')](0x1f4)[_0xf318('0x14')](_0x50f70e);}});}else{return _0x5d3014[_0xf318('0x13')](0xc8)[_0xf318('0x14')]({'output':_0xf318('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index b83d3b9..85aa59a 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 _0xb6dd=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x474b4f,_0x127edf){var _0x4c748c=function(_0x104478){while(--_0x104478){_0x474b4f['push'](_0x474b4f['shift']());}};_0x4c748c(++_0x127edf);}(_0xb6dd,0x94));var _0xdb6d=function(_0x6e1825,_0x1f4857){_0x6e1825=_0x6e1825-0x0;var _0x1a5733=_0xb6dd[_0x6e1825];return _0x1a5733;};'use strict';var multer=require(_0xdb6d('0x0'));var util=require(_0xdb6d('0x1'));var path=require(_0xdb6d('0x2'));var timeout=require(_0xdb6d('0x3'));var express=require(_0xdb6d('0x4'));var router=express['Router']();var fs_extra=require(_0xdb6d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdb6d('0x6'));var config=require('../../config/environment');var controller=require(_0xdb6d('0x7'));router[_0xdb6d('0x8')]('/',auth[_0xdb6d('0x9')](),controller[_0xdb6d('0xa')]);router[_0xdb6d('0x8')](_0xdb6d('0xb'),auth[_0xdb6d('0x9')](),controller['describe']);router[_0xdb6d('0x8')](_0xdb6d('0xc'),auth[_0xdb6d('0x9')](),controller[_0xdb6d('0xd')]);router[_0xdb6d('0xe')]('/',auth[_0xdb6d('0x9')](),controller[_0xdb6d('0xf')]);router[_0xdb6d('0x10')](_0xdb6d('0xc'),auth[_0xdb6d('0x9')](),controller[_0xdb6d('0x11')]);router[_0xdb6d('0x12')](_0xdb6d('0xc'),auth[_0xdb6d('0x9')](),controller[_0xdb6d('0x13')]);module[_0xdb6d('0x14')]=router; \ No newline at end of file +var _0x4917=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceAgentReport.controller','isAuthenticated','index','/describe','get','/:id','post','create','update','destroy','exports','multer'];(function(_0x373951,_0x2e37d1){var _0x2e9074=function(_0x35fba7){while(--_0x35fba7){_0x373951['push'](_0x373951['shift']());}};_0x2e9074(++_0x2e37d1);}(_0x4917,0x179));var _0x7491=function(_0x5ce826,_0x14e1c6){_0x5ce826=_0x5ce826-0x0;var _0x33a5b1=_0x4917[_0x5ce826];return _0x33a5b1;};'use strict';var multer=require(_0x7491('0x0'));var util=require('util');var path=require(_0x7491('0x1'));var timeout=require(_0x7491('0x2'));var express=require(_0x7491('0x3'));var router=express[_0x7491('0x4')]();var fs_extra=require(_0x7491('0x5'));var auth=require(_0x7491('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7491('0x7'));router['get']('/',auth[_0x7491('0x8')](),controller[_0x7491('0x9')]);router['get'](_0x7491('0xa'),auth[_0x7491('0x8')](),controller['describe']);router[_0x7491('0xb')](_0x7491('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7491('0xd')]('/',auth[_0x7491('0x8')](),controller[_0x7491('0xe')]);router['put'](_0x7491('0xc'),auth['isAuthenticated'](),controller[_0x7491('0xf')]);router['delete'](_0x7491('0xc'),auth[_0x7491('0x8')](),controller[_0x7491('0x10')]);module[_0x7491('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 35680c3..b0e342b 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 _0x8ed7=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x8ed7,0x8b));var _0x78ed=function(_0x38ec43,_0x46e019){_0x38ec43=_0x38ec43-0x0;var _0x26f816=_0x8ed7[_0x38ec43];return _0x26f816;};'use strict';var Sequelize=require('sequelize');module[_0x78ed('0x0')]={'type':{'type':Sequelize[_0x78ed('0x1')]},'uniqueid':{'type':Sequelize[_0x78ed('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x78ed('0x1')]},'interface':{'type':Sequelize[_0x78ed('0x1')]},'membername':{'type':Sequelize[_0x78ed('0x1')]},'agentcalledAt':{'type':Sequelize[_0x78ed('0x2')]},'agentconnectAt':{'type':Sequelize[_0x78ed('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x78ed('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x78ed('0x2')]},'agentdumpAt':{'type':Sequelize[_0x78ed('0x2')]},'holdtime':{'type':Sequelize[_0x78ed('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x78ed('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x78ed('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x78ed('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x78ed('0x1')]},'channelstate':{'type':Sequelize[_0x78ed('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x78ed('0x1')]},'connectedlinename':{'type':Sequelize[_0x78ed('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x78ed('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x78ed('0x1')]},'priority':{'type':Sequelize[_0x78ed('0x1')]},'destchannel':{'type':Sequelize[_0x78ed('0x1')]},'destchannelstate':{'type':Sequelize[_0x78ed('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x78ed('0x1')]},'destcalleridnum':{'type':Sequelize[_0x78ed('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x78ed('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x78ed('0x1')]},'destuniqueid':{'type':Sequelize[_0x78ed('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x78ed('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x78ed('0x1')]},'transfer':{'type':Sequelize[_0x78ed('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x78ed('0x1')],'comment':_0x78ed('0x5')},'transferexten':{'type':Sequelize[_0x78ed('0x1')]},'transferuniqueid':{'type':Sequelize[_0x78ed('0x1')]},'agententerreason':{'type':Sequelize[_0x78ed('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb6a6=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x3f386a,_0x33766c){var _0x5068ba=function(_0x2a1520){while(--_0x2a1520){_0x3f386a['push'](_0x3f386a['shift']());}};_0x5068ba(++_0x33766c);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0x5c5e5d,_0x252e62){_0x5c5e5d=_0x5c5e5d-0x0;var _0x7b3a19=_0xb6a6[_0x5c5e5d];return _0x7b3a19;};'use strict';var Sequelize=require(_0x6b6a('0x0'));module[_0x6b6a('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6b6a('0x2')]},'calleridname':{'type':Sequelize[_0x6b6a('0x2')]},'queue':{'type':Sequelize[_0x6b6a('0x2')]},'interface':{'type':Sequelize[_0x6b6a('0x2')]},'membername':{'type':Sequelize[_0x6b6a('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x6b6a('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x6b6a('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x6b6a('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x6b6a('0x4')]},'agentcomplete':{'type':Sequelize[_0x6b6a('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x6b6a('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x6b6a('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6b6a('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x6b6a('0x2')]},'channel':{'type':Sequelize[_0x6b6a('0x2')]},'channelstate':{'type':Sequelize[_0x6b6a('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x6b6a('0x2')]},'language':{'type':Sequelize[_0x6b6a('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6b6a('0x2')]},'priority':{'type':Sequelize[_0x6b6a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x6b6a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x6b6a('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x6b6a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x6b6a('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x6b6a('0x2')]},'destaccountcode':{'type':Sequelize[_0x6b6a('0x2')]},'destcontext':{'type':Sequelize[_0x6b6a('0x2')]},'destexten':{'type':Sequelize[_0x6b6a('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x6b6a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x6b6a('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x6b6a('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6b6a('0x2')],'comment':_0x6b6a('0x6')},'transferexten':{'type':Sequelize[_0x6b6a('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6b6a('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 d25422b..2868a42 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(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 afcfd76..9910322 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 _0x05bc=['exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','api','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x25200c,_0x1a1582){var _0x281816=function(_0x33e5c1){while(--_0x33e5c1){_0x25200c['push'](_0x25200c['shift']());}};_0x281816(++_0x1a1582);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc05b('0x0'));var logger=require('../../config/logger')(_0xc05b('0x1'));var moment=require(_0xc05b('0x2'));var BPromise=require('bluebird');var rp=require(_0xc05b('0x3'));var fs=require('fs');var path=require(_0xc05b('0x4'));var rimraf=require(_0xc05b('0x5'));var config=require(_0xc05b('0x6'));var attributes=require(_0xc05b('0x7'));module[_0xc05b('0x8')]=function(_0x2514a1,_0x22c8db){return _0x2514a1[_0xc05b('0x9')](_0xc05b('0xa'),attributes,{'tableName':_0xc05b('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc05b('0xc'),_0xc05b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb66c=['rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0xb66c,0x175));var _0xcb66=function(_0x5416f4,_0x4a0ca8){_0x5416f4=_0x5416f4-0x0;var _0xa14afe=_0xb66c[_0x5416f4];return _0xa14afe;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var logger=require(_0xcb66('0x1'))('api');var moment=require(_0xcb66('0x2'));var BPromise=require(_0xcb66('0x3'));var rp=require(_0xcb66('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb66('0x5'));var config=require(_0xcb66('0x6'));var attributes=require(_0xcb66('0x7'));module[_0xcb66('0x8')]=function(_0x5d766d,_0x518163){return _0x5d766d[_0xcb66('0x9')](_0xcb66('0xa'),attributes,{'tableName':_0xcb66('0xb'),'paranoid':![],'indexes':[{'fields':[_0xcb66('0xc'),_0xcb66('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 29a29f7..bd547dc 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 _0x5bca=['options','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body'];(function(_0x1ed21f,_0x51b067){var _0x3316d4=function(_0x23a48c){while(--_0x23a48c){_0x1ed21f['push'](_0x1ed21f['shift']());}};_0x3316d4(++_0x51b067);}(_0x5bca,0xd8));var _0xa5bc=function(_0x253d2b,_0x49a0fb){_0x253d2b=_0x253d2b-0x0;var _0x3ce8bd=_0x5bca[_0x253d2b];return _0x3ce8bd;};'use strict';var _=require(_0xa5bc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa5bc('0x1'));var rs=require(_0xa5bc('0x2'));var fs=require('fs');var Redis=require(_0xa5bc('0x3'));var db=require(_0xa5bc('0x4'))['db'];var utils=require(_0xa5bc('0x5'));var logger=require(_0xa5bc('0x6'))('rpc');var config=require(_0xa5bc('0x7'));var jayson=require(_0xa5bc('0x8'));var client=jayson['client'][_0xa5bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa9a6c4,_0x2ca338,_0x2aff17){return new BPromise(function(_0x429cbf,_0x112e02){return client['request'](_0xa9a6c4,_0x2aff17)[_0xa5bc('0xa')](function(_0x1d1482){logger['info'](_0xa5bc('0xb'),_0x2ca338,_0xa5bc('0xc'));logger[_0xa5bc('0xd')](_0xa5bc('0xe'),_0x2ca338,'request\x20sent',JSON[_0xa5bc('0xf')](_0x1d1482));if(_0x1d1482[_0xa5bc('0x10')]){if(_0x1d1482[_0xa5bc('0x10')]['code']===0x1f4){logger[_0xa5bc('0x10')](_0xa5bc('0xb'),_0x2ca338,_0x1d1482[_0xa5bc('0x10')][_0xa5bc('0x11')]);return _0x112e02(_0x1d1482['error'][_0xa5bc('0x11')]);}logger[_0xa5bc('0x10')](_0xa5bc('0xb'),_0x2ca338,_0x1d1482[_0xa5bc('0x10')][_0xa5bc('0x11')]);return _0x429cbf(_0x1d1482[_0xa5bc('0x10')][_0xa5bc('0x11')]);}else{logger[_0xa5bc('0x12')](_0xa5bc('0xb'),_0x2ca338,_0xa5bc('0xc'));_0x429cbf(_0x1d1482['result'][_0xa5bc('0x11')]);}})[_0xa5bc('0x13')](function(_0x2986dc){logger[_0xa5bc('0x10')](_0xa5bc('0xb'),_0x2ca338,_0x2986dc);_0x112e02(_0x2986dc);});});}exports[_0xa5bc('0x14')]=function(_0x1de44d){var _0x5e990e=this;return new Promise(function(_0x3586ea,_0x1060cd){return db[_0xa5bc('0x15')][_0xa5bc('0x16')](_0x1de44d[_0xa5bc('0x17')],{'raw':_0x1de44d[_0xa5bc('0x18')]?_0x1de44d['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x198ab9){logger[_0xa5bc('0x12')](_0xa5bc('0x14'),_0x1de44d);logger[_0xa5bc('0xd')](_0xa5bc('0x14'),_0x1de44d,JSON[_0xa5bc('0xf')](_0x198ab9));_0x3586ea(_0x198ab9);})['catch'](function(_0x3bf723){logger[_0xa5bc('0x10')]('CreateVoiceAgentReport',_0x3bf723[_0xa5bc('0x11')],_0x1de44d);_0x1060cd(_0x5e990e[_0xa5bc('0x10')](0x1f4,_0x3bf723[_0xa5bc('0x11')]));});});};exports[_0xa5bc('0x19')]=function(_0x4d3bd2){var _0x507e9e=this;return new Promise(function(_0x5f49fb,_0x43e5bb){return db[_0xa5bc('0x15')][_0xa5bc('0x1a')](_0x4d3bd2['body'],{'raw':_0x4d3bd2[_0xa5bc('0x18')]?_0x4d3bd2[_0xa5bc('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d3bd2[_0xa5bc('0x18')]?_0x4d3bd2[_0xa5bc('0x18')][_0xa5bc('0x1b')]||null:null,'attributes':_0x4d3bd2[_0xa5bc('0x18')]?_0x4d3bd2['options'][_0xa5bc('0x1c')]||null:null,'limit':_0x4d3bd2[_0xa5bc('0x18')]?_0x4d3bd2[_0xa5bc('0x18')][_0xa5bc('0x1d')]||null:null})[_0xa5bc('0xa')](function(_0x1fe49d){logger[_0xa5bc('0x12')](_0xa5bc('0x19'),_0x4d3bd2);logger['debug'](_0xa5bc('0x19'),_0x4d3bd2,JSON['stringify'](_0x1fe49d));_0x5f49fb(_0x1fe49d);})[_0xa5bc('0x13')](function(_0x453206){logger[_0xa5bc('0x10')]('UpdateVoiceAgentReport',_0x453206[_0xa5bc('0x11')],_0x4d3bd2);_0x43e5bb(_0x507e9e[_0xa5bc('0x10')](0x1f4,_0x453206[_0xa5bc('0x11')]));});});}; \ No newline at end of file +var _0xa901=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','VoiceAgentReport','create','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','body','where','attributes','limit','catch','lodash','util','moment','bluebird'];(function(_0x374f4,_0x1b7f3e){var _0x42d37c=function(_0x5eaad8){while(--_0x5eaad8){_0x374f4['push'](_0x374f4['shift']());}};_0x42d37c(++_0x1b7f3e);}(_0xa901,0xc2));var _0x1a90=function(_0x3a7f67,_0x12cd6b){_0x3a7f67=_0x3a7f67-0x0;var _0x263b0a=_0xa901[_0x3a7f67];return _0x263b0a;};'use strict';var _=require(_0x1a90('0x0'));var util=require(_0x1a90('0x1'));var moment=require(_0x1a90('0x2'));var BPromise=require(_0x1a90('0x3'));var rs=require(_0x1a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a90('0x5'))['db'];var utils=require(_0x1a90('0x6'));var logger=require('../../config/logger')(_0x1a90('0x7'));var config=require(_0x1a90('0x8'));var jayson=require(_0x1a90('0x9'));var client=jayson['client'][_0x1a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfe8eef,_0x133354,_0x9eae42){return new BPromise(function(_0x2f63d2,_0xcbd2ce){return client[_0x1a90('0xb')](_0xfe8eef,_0x9eae42)[_0x1a90('0xc')](function(_0xc81980){logger[_0x1a90('0xd')](_0x1a90('0xe'),_0x133354,_0x1a90('0xf'));logger[_0x1a90('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x133354,'request\x20sent',JSON[_0x1a90('0x11')](_0xc81980));if(_0xc81980['error']){if(_0xc81980['error']['code']===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x133354,_0xc81980[_0x1a90('0x12')]['message']);return _0xcbd2ce(_0xc81980[_0x1a90('0x12')]['message']);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x133354,_0xc81980[_0x1a90('0x12')][_0x1a90('0x13')]);return _0x2f63d2(_0xc81980[_0x1a90('0x12')][_0x1a90('0x13')]);}else{logger[_0x1a90('0xd')](_0x1a90('0xe'),_0x133354,_0x1a90('0xf'));_0x2f63d2(_0xc81980[_0x1a90('0x14')][_0x1a90('0x13')]);}})['catch'](function(_0x5e90c1){logger[_0x1a90('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x133354,_0x5e90c1);_0xcbd2ce(_0x5e90c1);});});}exports['CreateVoiceAgentReport']=function(_0x33d71f){var _0x24fb88=this;return new Promise(function(_0xfbf635,_0xd4d851){return db[_0x1a90('0x15')][_0x1a90('0x16')](_0x33d71f['body'],{'raw':_0x33d71f['options']?_0x33d71f[_0x1a90('0x17')][_0x1a90('0x18')]===undefined?!![]:![]:!![]})[_0x1a90('0xc')](function(_0x265d63){logger['info'](_0x1a90('0x19'),_0x33d71f);logger['debug'](_0x1a90('0x19'),_0x33d71f,JSON[_0x1a90('0x11')](_0x265d63));_0xfbf635(_0x265d63);})['catch'](function(_0x40fc34){logger[_0x1a90('0x12')]('CreateVoiceAgentReport',_0x40fc34[_0x1a90('0x13')],_0x33d71f);_0xd4d851(_0x24fb88['error'](0x1f4,_0x40fc34[_0x1a90('0x13')]));});});};exports[_0x1a90('0x1a')]=function(_0x1c9599){var _0x465424=this;return new Promise(function(_0x3c9774,_0x58f44d){return db[_0x1a90('0x15')][_0x1a90('0x1b')](_0x1c9599[_0x1a90('0x1c')],{'raw':_0x1c9599['options']?_0x1c9599[_0x1a90('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c9599[_0x1a90('0x17')]?_0x1c9599[_0x1a90('0x17')][_0x1a90('0x1d')]||null:null,'attributes':_0x1c9599[_0x1a90('0x17')]?_0x1c9599['options'][_0x1a90('0x1e')]||null:null,'limit':_0x1c9599[_0x1a90('0x17')]?_0x1c9599[_0x1a90('0x17')][_0x1a90('0x1f')]||null:null})[_0x1a90('0xc')](function(_0x22916a){logger[_0x1a90('0xd')](_0x1a90('0x1a'),_0x1c9599);logger['debug'](_0x1a90('0x1a'),_0x1c9599,JSON['stringify'](_0x22916a));_0x3c9774(_0x22916a);})[_0x1a90('0x20')](function(_0x4f5245){logger[_0x1a90('0x12')](_0x1a90('0x1a'),_0x4f5245[_0x1a90('0x13')],_0x1c9599);_0x58f44d(_0x465424[_0x1a90('0x12')](0x1f4,_0x4f5245['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index cffae76..780dedc 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 _0xea41=['Router','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','put','/with-retry/:id','updateWithRetry','delete','destroy','express'];(function(_0x54fb1c,_0x50e6ca){var _0x5478ef=function(_0x3d93cf){while(--_0x3d93cf){_0x54fb1c['push'](_0x54fb1c['shift']());}};_0x5478ef(++_0x50e6ca);}(_0xea41,0xcf));var _0x1ea4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xea41[_0x2d7f0e];return _0x110b07;};'use strict';var express=require(_0x1ea4('0x0'));var router=express[_0x1ea4('0x1')]();var auth=require('../../components/auth/service');var controller=require('./voiceCallReport.controller');router[_0x1ea4('0x2')]('/',auth[_0x1ea4('0x3')](),controller['index']);router[_0x1ea4('0x2')](_0x1ea4('0x4'),auth['isAuthenticated'](),controller[_0x1ea4('0x5')]);router['get'](_0x1ea4('0x6'),auth['isAuthenticated'](),controller[_0x1ea4('0x7')]);router[_0x1ea4('0x8')]('/',auth['isAuthenticated'](),controller[_0x1ea4('0x9')]);router['put'](_0x1ea4('0x6'),auth[_0x1ea4('0x3')](),controller[_0x1ea4('0xa')]);router[_0x1ea4('0xb')](_0x1ea4('0xc'),auth[_0x1ea4('0x3')](),controller[_0x1ea4('0xd')]);router[_0x1ea4('0xe')](_0x1ea4('0x6'),auth[_0x1ea4('0x3')](),controller[_0x1ea4('0xf')]);module['exports']=router; \ No newline at end of file +var _0xb51f=['/with-retry/:id','updateWithRetry','delete','destroy','exports','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb51f,0x16d));var _0xfb51=function(_0x277fda,_0x57df6e){_0x277fda=_0x277fda-0x0;var _0x34475a=_0xb51f[_0x277fda];return _0x34475a;};'use strict';var express=require(_0xfb51('0x0'));var router=express[_0xfb51('0x1')]();var auth=require(_0xfb51('0x2'));var controller=require(_0xfb51('0x3'));router[_0xfb51('0x4')]('/',auth[_0xfb51('0x5')](),controller['index']);router['get']('/describe',auth[_0xfb51('0x5')](),controller[_0xfb51('0x6')]);router[_0xfb51('0x4')](_0xfb51('0x7'),auth[_0xfb51('0x5')](),controller[_0xfb51('0x8')]);router[_0xfb51('0x9')]('/',auth[_0xfb51('0x5')](),controller[_0xfb51('0xa')]);router[_0xfb51('0xb')](_0xfb51('0x7'),auth[_0xfb51('0x5')](),controller[_0xfb51('0xc')]);router[_0xfb51('0xb')](_0xfb51('0xd'),auth[_0xfb51('0x5')](),controller[_0xfb51('0xe')]);router[_0xfb51('0xf')](_0xfb51('0x7'),auth['isAuthenticated'](),controller[_0xfb51('0x10')]);module[_0xfb51('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 7d385c1..38ded18 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 _0xdc9b=['DATE','INTEGER','sequelize','exports','STRING','inbound','internal','outbound-fax','dialer','TEXT'];(function(_0x4715b7,_0x4dedec){var _0x11d72a=function(_0x393699){while(--_0x393699){_0x4715b7['push'](_0x4715b7['shift']());}};_0x11d72a(++_0x4dedec);}(_0xdc9b,0x70));var _0xbdc9=function(_0x1a9f39,_0x419ff9){_0x1a9f39=_0x1a9f39-0x0;var _0x546996=_0xdc9b[_0x1a9f39];return _0x546996;};'use strict';var Sequelize=require(_0xbdc9('0x0'));module[_0xbdc9('0x1')]={'uniqueid':{'type':Sequelize[_0xbdc9('0x2')]},'type':{'type':Sequelize['ENUM'](_0xbdc9('0x3'),_0xbdc9('0x4'),'outbound','inbound-fax',_0xbdc9('0x5'),_0xbdc9('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbdc9('0x2')]},'source':{'type':Sequelize[_0xbdc9('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xbdc9('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbdc9('0x2')]},'destinationchannel':{'type':Sequelize[_0xbdc9('0x2')]},'lastapplication':{'type':Sequelize[_0xbdc9('0x2')]},'lastdata':{'type':Sequelize[_0xbdc9('0x7')]},'starttime':{'type':Sequelize[_0xbdc9('0x8')]},'systemanswertime':{'type':Sequelize[_0xbdc9('0x8')]},'answertime':{'type':Sequelize[_0xbdc9('0x8')]},'endtime':{'type':Sequelize[_0xbdc9('0x8')]},'duration':{'type':Sequelize[_0xbdc9('0x9')]},'billableseconds':{'type':Sequelize[_0xbdc9('0x9')]},'mohtime':{'type':Sequelize[_0xbdc9('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbdc9('0x2')]},'amaflags':{'type':Sequelize[_0xbdc9('0x2')]},'userfield':{'type':Sequelize[_0xbdc9('0x2')]},'userDisposition':{'type':Sequelize[_0xbdc9('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xbdc9('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xbdc9('0x2')]},'note':{'type':Sequelize[_0xbdc9('0x2')]},'prefix':{'type':Sequelize[_0xbdc9('0x2')]},'routeid':{'type':Sequelize[_0xbdc9('0x9')]},'sipcallid':{'type':Sequelize[_0xbdc9('0x2')]}}; \ No newline at end of file +var _0x1564=['outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','internal','outbound','inbound-fax'];(function(_0x442cf1,_0x2403f2){var _0x13ede0=function(_0x216653){while(--_0x216653){_0x442cf1['push'](_0x442cf1['shift']());}};_0x13ede0(++_0x2403f2);}(_0x1564,0x125));var _0x4156=function(_0x160d97,_0x5379be){_0x160d97=_0x160d97-0x0;var _0x3a3e8e=_0x1564[_0x160d97];return _0x3a3e8e;};'use strict';var Sequelize=require(_0x4156('0x0'));module[_0x4156('0x1')]={'uniqueid':{'type':Sequelize[_0x4156('0x2')]},'type':{'type':Sequelize[_0x4156('0x3')]('inbound',_0x4156('0x4'),_0x4156('0x5'),_0x4156('0x6'),_0x4156('0x7'),_0x4156('0x8'))},'tag':{'type':Sequelize[_0x4156('0x2')]},'accountcode':{'type':Sequelize[_0x4156('0x2')]},'source':{'type':Sequelize[_0x4156('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4156('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x4156('0x2')]},'lastdata':{'type':Sequelize[_0x4156('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x4156('0xa')]},'answertime':{'type':Sequelize[_0x4156('0xa')]},'endtime':{'type':Sequelize[_0x4156('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x4156('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4156('0x2')]},'amaflags':{'type':Sequelize[_0x4156('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x4156('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x4156('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x4156('0x2')]},'note':{'type':Sequelize[_0x4156('0x2')]},'prefix':{'type':Sequelize[_0x4156('0x2')]},'routeid':{'type':Sequelize[_0x4156('0xb')]},'sipcallid':{'type':Sequelize[_0x4156('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 7509d53..196a1d9 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 _0x0120=['count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','VoiceCallReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','then','include','fullname','alias','User','catch','show','includeAll','create','find','describe','params','user','body','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','promise-retry','status','json','offset','undefined','limit'];(function(_0x4f15c6,_0x3eb56a){var _0x5cd110=function(_0x8bd15e){while(--_0x8bd15e){_0x4f15c6['push'](_0x4f15c6['shift']());}};_0x5cd110(++_0x3eb56a);}(_0x0120,0x6f));var _0x0012=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x0120[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0012('0x0'));var qs=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var db=require(_0x0012('0x4'))['db'];const promiseRetry=require(_0x0012('0x5'));function respondWithResult(_0x214372,_0xeb175){_0xeb175=_0xeb175||0xc8;return function(_0x357f77){if(_0x357f77){return _0x214372[_0x0012('0x6')](_0xeb175)[_0x0012('0x7')](_0x357f77);}};}function respondWithFilteredResult(_0x3fcfbc,_0x4eaa5b){return function(_0x4b396c){if(_0x4b396c){var _0x59980a=typeof _0x4eaa5b[_0x0012('0x8')]===_0x0012('0x9')&&typeof _0x4eaa5b[_0x0012('0xa')]===_0x0012('0x9');var _0x33c82f=_0x4b396c['count'];var _0x14991f=_0x59980a?0x0:_0x4eaa5b[_0x0012('0x8')];var _0x1dc1b2=_0x59980a?_0x4b396c[_0x0012('0xb')]:_0x4eaa5b['offset']+_0x4eaa5b[_0x0012('0xa')];var _0x4b2068;if(_0x1dc1b2>=_0x33c82f){_0x1dc1b2=_0x33c82f;_0x4b2068=0xc8;}else{_0x4b2068=0xce;}_0x3fcfbc[_0x0012('0x6')](_0x4b2068);return _0x3fcfbc[_0x0012('0xc')](_0x0012('0xd'),_0x14991f+'-'+_0x1dc1b2+'/'+_0x33c82f)[_0x0012('0x7')](_0x4b396c);}return null;};}function saveUpdates(_0x2451b5){return function(_0x4d3e7a){if(_0x4d3e7a){return _0x4d3e7a[_0x0012('0xe')](_0x2451b5)['then'](function(_0x5bbd04){return _0x5bbd04;});}return null;};}function removeEntity(_0x5d845a){return function(_0x5563fc){if(_0x5563fc){return _0x5563fc[_0x0012('0xf')]()['then'](function(){_0x5d845a[_0x0012('0x6')](0xcc)[_0x0012('0x10')]();});}};}function handleEntityNotFound(_0x47a6ef){return function(_0x24f4ed){if(!_0x24f4ed){_0x47a6ef[_0x0012('0x11')](0x194);}return _0x24f4ed;};}function handleError(_0x348810,_0x3b8dfc){_0x3b8dfc=_0x3b8dfc||0x1f4;return function(_0x522e9b){logger['error'](_0x522e9b[_0x0012('0x12')]);if(_0x522e9b[_0x0012('0x13')]){delete _0x522e9b[_0x0012('0x13')];}_0x348810[_0x0012('0x6')](_0x3b8dfc)[_0x0012('0x14')](_0x522e9b);};}exports[_0x0012('0x15')]=function(_0x1e78ee,_0x2eb3fa){var _0x5b236f={},_0x226968={},_0x56b0e1={'count':0x0,'rows':[]};var _0x5797dd=_[_0x0012('0x16')](db[_0x0012('0x17')][_0x0012('0x18')],function(_0x2c837e){return{'name':_0x2c837e['fieldName'],'type':_0x2c837e['type'][_0x0012('0x19')]};});_0x226968[_0x0012('0x1a')]=_[_0x0012('0x16')](_0x5797dd,_0x0012('0x13'));_0x226968[_0x0012('0x1b')]=_[_0x0012('0x1c')](_0x1e78ee[_0x0012('0x1b')]);_0x226968[_0x0012('0x1d')]=_['intersection'](_0x226968[_0x0012('0x1a')],_0x226968[_0x0012('0x1b')]);_0x5b236f['attributes']=_[_0x0012('0x1e')](_0x226968[_0x0012('0x1a')],qs[_0x0012('0x1f')](_0x1e78ee[_0x0012('0x1b')][_0x0012('0x1f')]));_0x5b236f['attributes']=_0x5b236f[_0x0012('0x20')][_0x0012('0x21')]?_0x5b236f[_0x0012('0x20')]:_0x226968[_0x0012('0x1a')];if(!_0x1e78ee[_0x0012('0x1b')][_0x0012('0x22')](_0x0012('0x23'))){_0x5b236f[_0x0012('0xa')]=qs[_0x0012('0xa')](_0x1e78ee[_0x0012('0x1b')][_0x0012('0xa')]);_0x5b236f[_0x0012('0x8')]=qs[_0x0012('0x8')](_0x1e78ee[_0x0012('0x1b')][_0x0012('0x8')]);}_0x5b236f[_0x0012('0x24')]=qs[_0x0012('0x25')](_0x1e78ee[_0x0012('0x1b')][_0x0012('0x25')]);_0x5b236f[_0x0012('0x26')]=qs[_0x0012('0x1d')](_['pick'](_0x1e78ee[_0x0012('0x1b')],_0x226968[_0x0012('0x1d')]),_0x5797dd);if(_0x1e78ee['query'][_0x0012('0x27')]){_0x5b236f[_0x0012('0x26')]=_[_0x0012('0x28')](_0x5b236f[_0x0012('0x26')],{'$or':_[_0x0012('0x16')](_0x5797dd,function(_0x47d73b){if(_0x47d73b[_0x0012('0x29')]!==_0x0012('0x2a')){var _0x2e7487={};_0x2e7487[_0x47d73b['name']]={'$like':'%'+_0x1e78ee[_0x0012('0x1b')][_0x0012('0x27')]+'%'};return _0x2e7487;}})});}_0x5b236f=_[_0x0012('0x28')]({},_0x5b236f,_0x1e78ee[_0x0012('0x2b')]);var _0x46b600={'where':_0x5b236f[_0x0012('0x26')]};return db['VoiceCallReport'][_0x0012('0xb')](_0x46b600)[_0x0012('0x2c')](function(_0x4648ec){_0x56b0e1[_0x0012('0xb')]=_0x4648ec;if(_0x1e78ee['query']['includeAll']){_0x5b236f[_0x0012('0x2d')]=[{'attributes':['id',_0x0012('0x13'),_0x0012('0x2e'),_0x0012('0x2f')],'model':db[_0x0012('0x30')],'as':_0x0012('0x30')}];}return db[_0x0012('0x17')]['findAll'](_0x5b236f);})[_0x0012('0x2c')](function(_0xfdb3be){_0x56b0e1['rows']=_0xfdb3be;return _0x56b0e1;})[_0x0012('0x2c')](respondWithFilteredResult(_0x2eb3fa,_0x5b236f))[_0x0012('0x31')](handleError(_0x2eb3fa,null));};exports[_0x0012('0x32')]=function(_0x4786e8,_0x126381){var _0x1d078a={'raw':!![],'where':{'id':_0x4786e8['params']['id']}},_0x1b3e76={};_0x1b3e76[_0x0012('0x1a')]=_['keys'](db[_0x0012('0x17')]['rawAttributes']);_0x1b3e76['query']=_[_0x0012('0x1c')](_0x4786e8[_0x0012('0x1b')]);_0x1b3e76[_0x0012('0x1d')]=_['intersection'](_0x1b3e76[_0x0012('0x1a')],_0x1b3e76[_0x0012('0x1b')]);_0x1d078a[_0x0012('0x20')]=_[_0x0012('0x1e')](_0x1b3e76[_0x0012('0x1a')],qs[_0x0012('0x1f')](_0x4786e8[_0x0012('0x1b')][_0x0012('0x1f')]));_0x1d078a['attributes']=_0x1d078a[_0x0012('0x20')][_0x0012('0x21')]?_0x1d078a[_0x0012('0x20')]:_0x1b3e76[_0x0012('0x1a')];if(_0x4786e8[_0x0012('0x1b')][_0x0012('0x33')]){_0x1d078a[_0x0012('0x2d')]=[{'all':!![]}];}_0x1d078a=_['merge']({},_0x1d078a,_0x4786e8['options']);return db[_0x0012('0x17')]['find'](_0x1d078a)[_0x0012('0x2c')](handleEntityNotFound(_0x126381,null))[_0x0012('0x2c')](respondWithResult(_0x126381,null))[_0x0012('0x31')](handleError(_0x126381,null));};exports[_0x0012('0x34')]=function(_0x32c1f9,_0x5348a2){return db[_0x0012('0x17')][_0x0012('0x34')](_0x32c1f9['body'],{})[_0x0012('0x2c')](respondWithResult(_0x5348a2,0xc9))[_0x0012('0x31')](handleError(_0x5348a2,null));};exports[_0x0012('0xf')]=function(_0x207b61,_0x5259c2){return db['VoiceCallReport'][_0x0012('0x35')]({'where':{'id':_0x207b61['params']['id']}})[_0x0012('0x2c')](handleEntityNotFound(_0x5259c2,null))['then'](removeEntity(_0x5259c2,null))[_0x0012('0x31')](handleError(_0x5259c2,null));};exports[_0x0012('0x36')]=function(_0x3daefd,_0x364f8e){return db['VoiceCallReport'][_0x0012('0x36')]()['then'](respondWithResult(_0x364f8e,null))[_0x0012('0x31')](handleError(_0x364f8e,null));};function findForUpdate(_0x332f64){return db[_0x0012('0x17')][_0x0012('0x35')]({'where':{'uniqueid':_0x332f64[_0x0012('0x37')]['id'],'UserId':{'$or':[null,_0x332f64[_0x0012('0x38')]['id']]}}});}exports[_0x0012('0xe')]=function(_0x5b6c93,_0xf9318d){if(_0x5b6c93[_0x0012('0x39')][_0x0012('0x3a')]){delete _0x5b6c93[_0x0012('0x39')][_0x0012('0x3a')];}return findForUpdate(_0x5b6c93)[_0x0012('0x2c')](handleEntityNotFound(_0xf9318d,null))['then'](saveUpdates(_0x5b6c93['body'],null))['then'](respondWithResult(_0xf9318d,null))['catch'](handleError(_0xf9318d,null));};exports[_0x0012('0x3b')]=function(_0x4033ca,_0xf0ba10,_0x3b9c1d){if(_0x4033ca[_0x0012('0x39')]['uniqueid']){delete _0x4033ca[_0x0012('0x39')][_0x0012('0x3a')];}promiseRetry(function(_0x7d04c7){return findForUpdate(_0x4033ca)[_0x0012('0x2c')](function(_0x42beb1){if(_0x42beb1!==null){return _0x42beb1;}else{_0x7d04c7(new Error(_0x0012('0x3c')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x0012('0x2c')](function(_0x26fb2b){if(!_0x26fb2b){return new Promise(function(_0x2177a6){_0x2177a6(handleEntityNotFound(_0xf0ba10)());});}else{return _0x26fb2b[_0x0012('0xe')](_0x4033ca[_0x0012('0x39')])['then'](function(_0x2389cd){return respondWithResult(_0xf0ba10)(_0x2389cd);});}},function(){handleEntityNotFound(_0xf0ba10)();});}; \ No newline at end of file +var _0x18f3=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','alias','User','findAll','rows','catch','show','includeAll','include','options','find','create','describe','params','user','update','uniqueid','body','updateWithRetry','No\x20such\x20report','../../components/parsers/qs','../../config/logger','api','status','json','limit','count','offset','set','Content-Range','destroy','then','end','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','intersection','attributes','model'];(function(_0x3ad876,_0xa58edd){var _0x1b040e=function(_0x4326d4){while(--_0x4326d4){_0x3ad876['push'](_0x3ad876['shift']());}};_0x1b040e(++_0xa58edd);}(_0x18f3,0x19f));var _0x318f=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x18f3[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var qs=require(_0x318f('0x0'));var logger=require(_0x318f('0x1'))(_0x318f('0x2'));var db=require('../../mysqldb')['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x33375d,_0x4bfca0){_0x4bfca0=_0x4bfca0||0xc8;return function(_0x7d8e05){if(_0x7d8e05){return _0x33375d[_0x318f('0x3')](_0x4bfca0)[_0x318f('0x4')](_0x7d8e05);}};}function respondWithFilteredResult(_0x28d946,_0x52e7bc){return function(_0x5f7340){if(_0x5f7340){var _0x3579e8=typeof _0x52e7bc['offset']==='undefined'&&typeof _0x52e7bc[_0x318f('0x5')]==='undefined';var _0x42b163=_0x5f7340[_0x318f('0x6')];var _0x1479df=_0x3579e8?0x0:_0x52e7bc[_0x318f('0x7')];var _0x3dafce=_0x3579e8?_0x5f7340[_0x318f('0x6')]:_0x52e7bc[_0x318f('0x7')]+_0x52e7bc[_0x318f('0x5')];var _0x1e9916;if(_0x3dafce>=_0x42b163){_0x3dafce=_0x42b163;_0x1e9916=0xc8;}else{_0x1e9916=0xce;}_0x28d946[_0x318f('0x3')](_0x1e9916);return _0x28d946[_0x318f('0x8')](_0x318f('0x9'),_0x1479df+'-'+_0x3dafce+'/'+_0x42b163)[_0x318f('0x4')](_0x5f7340);}return null;};}function saveUpdates(_0x40c3f9){return function(_0x20b5c0){if(_0x20b5c0){return _0x20b5c0['update'](_0x40c3f9)['then'](function(_0x183b3a){return _0x183b3a;});}return null;};}function removeEntity(_0x407ef5){return function(_0x364071){if(_0x364071){return _0x364071[_0x318f('0xa')]()[_0x318f('0xb')](function(){_0x407ef5[_0x318f('0x3')](0xcc)[_0x318f('0xc')]();});}};}function handleEntityNotFound(_0x4e6b05){return function(_0x210758){if(!_0x210758){_0x4e6b05['sendStatus'](0x194);}return _0x210758;};}function handleError(_0x47cfdb,_0x2651ec){_0x2651ec=_0x2651ec||0x1f4;return function(_0x334d7d){logger['error'](_0x334d7d['stack']);if(_0x334d7d[_0x318f('0xd')]){delete _0x334d7d['name'];}_0x47cfdb[_0x318f('0x3')](_0x2651ec)[_0x318f('0xe')](_0x334d7d);};}exports[_0x318f('0xf')]=function(_0x386b33,_0x26e32b){var _0x52e52b={},_0x1ca109={},_0x1e4ca5={'count':0x0,'rows':[]};var _0x18e1b2=_[_0x318f('0x10')](db[_0x318f('0x11')][_0x318f('0x12')],function(_0x27dcd1){return{'name':_0x27dcd1[_0x318f('0x13')],'type':_0x27dcd1[_0x318f('0x14')]['key']};});_0x1ca109['model']=_[_0x318f('0x10')](_0x18e1b2,_0x318f('0xd'));_0x1ca109[_0x318f('0x15')]=_['keys'](_0x386b33[_0x318f('0x15')]);_0x1ca109['filters']=_[_0x318f('0x16')](_0x1ca109['model'],_0x1ca109[_0x318f('0x15')]);_0x52e52b[_0x318f('0x17')]=_[_0x318f('0x16')](_0x1ca109[_0x318f('0x18')],qs[_0x318f('0x19')](_0x386b33[_0x318f('0x15')][_0x318f('0x19')]));_0x52e52b[_0x318f('0x17')]=_0x52e52b[_0x318f('0x17')][_0x318f('0x1a')]?_0x52e52b[_0x318f('0x17')]:_0x1ca109[_0x318f('0x18')];if(!_0x386b33[_0x318f('0x15')][_0x318f('0x1b')](_0x318f('0x1c'))){_0x52e52b[_0x318f('0x5')]=qs[_0x318f('0x5')](_0x386b33[_0x318f('0x15')][_0x318f('0x5')]);_0x52e52b[_0x318f('0x7')]=qs[_0x318f('0x7')](_0x386b33[_0x318f('0x15')]['offset']);}_0x52e52b[_0x318f('0x1d')]=qs['sort'](_0x386b33[_0x318f('0x15')][_0x318f('0x1e')]);_0x52e52b[_0x318f('0x1f')]=qs[_0x318f('0x20')](_[_0x318f('0x21')](_0x386b33[_0x318f('0x15')],_0x1ca109[_0x318f('0x20')]),_0x18e1b2);if(_0x386b33[_0x318f('0x15')][_0x318f('0x22')]){_0x52e52b[_0x318f('0x1f')]=_[_0x318f('0x23')](_0x52e52b[_0x318f('0x1f')],{'$or':_[_0x318f('0x10')](_0x18e1b2,function(_0x4ffeff){if(_0x4ffeff[_0x318f('0x14')]!=='VIRTUAL'){var _0x15b577={};_0x15b577[_0x4ffeff['name']]={'$like':'%'+_0x386b33[_0x318f('0x15')][_0x318f('0x22')]+'%'};return _0x15b577;}})});}_0x52e52b=_[_0x318f('0x23')]({},_0x52e52b,_0x386b33['options']);var _0x23b77d={'where':_0x52e52b[_0x318f('0x1f')]};return db[_0x318f('0x11')]['count'](_0x23b77d)[_0x318f('0xb')](function(_0x53b98d){_0x1e4ca5[_0x318f('0x6')]=_0x53b98d;if(_0x386b33[_0x318f('0x15')]['includeAll']){_0x52e52b['include']=[{'attributes':['id',_0x318f('0xd'),'fullname',_0x318f('0x24')],'model':db[_0x318f('0x25')],'as':_0x318f('0x25')}];}return db[_0x318f('0x11')][_0x318f('0x26')](_0x52e52b);})[_0x318f('0xb')](function(_0x1024f4){_0x1e4ca5[_0x318f('0x27')]=_0x1024f4;return _0x1e4ca5;})[_0x318f('0xb')](respondWithFilteredResult(_0x26e32b,_0x52e52b))[_0x318f('0x28')](handleError(_0x26e32b,null));};exports[_0x318f('0x29')]=function(_0x384232,_0x72c66a){var _0x520744={'raw':!![],'where':{'id':_0x384232['params']['id']}},_0x51480c={};_0x51480c[_0x318f('0x18')]=_['keys'](db[_0x318f('0x11')]['rawAttributes']);_0x51480c[_0x318f('0x15')]=_['keys'](_0x384232[_0x318f('0x15')]);_0x51480c['filters']=_['intersection'](_0x51480c[_0x318f('0x18')],_0x51480c['query']);_0x520744[_0x318f('0x17')]=_['intersection'](_0x51480c[_0x318f('0x18')],qs[_0x318f('0x19')](_0x384232[_0x318f('0x15')][_0x318f('0x19')]));_0x520744['attributes']=_0x520744[_0x318f('0x17')][_0x318f('0x1a')]?_0x520744[_0x318f('0x17')]:_0x51480c[_0x318f('0x18')];if(_0x384232[_0x318f('0x15')][_0x318f('0x2a')]){_0x520744[_0x318f('0x2b')]=[{'all':!![]}];}_0x520744=_[_0x318f('0x23')]({},_0x520744,_0x384232[_0x318f('0x2c')]);return db[_0x318f('0x11')][_0x318f('0x2d')](_0x520744)[_0x318f('0xb')](handleEntityNotFound(_0x72c66a,null))['then'](respondWithResult(_0x72c66a,null))[_0x318f('0x28')](handleError(_0x72c66a,null));};exports[_0x318f('0x2e')]=function(_0x6035b1,_0xe22809){return db[_0x318f('0x11')]['create'](_0x6035b1['body'],{})[_0x318f('0xb')](respondWithResult(_0xe22809,0xc9))[_0x318f('0x28')](handleError(_0xe22809,null));};exports[_0x318f('0xa')]=function(_0x47fcbc,_0x221d80){return db[_0x318f('0x11')][_0x318f('0x2d')]({'where':{'id':_0x47fcbc['params']['id']}})['then'](handleEntityNotFound(_0x221d80,null))[_0x318f('0xb')](removeEntity(_0x221d80,null))[_0x318f('0x28')](handleError(_0x221d80,null));};exports[_0x318f('0x2f')]=function(_0x8d08e2,_0x3e25db){return db[_0x318f('0x11')][_0x318f('0x2f')]()[_0x318f('0xb')](respondWithResult(_0x3e25db,null))[_0x318f('0x28')](handleError(_0x3e25db,null));};function findForUpdate(_0x387acb){return db['VoiceCallReport'][_0x318f('0x2d')]({'where':{'uniqueid':_0x387acb[_0x318f('0x30')]['id'],'UserId':{'$or':[null,_0x387acb[_0x318f('0x31')]['id']]}}});}exports[_0x318f('0x32')]=function(_0x197a5a,_0xa9b81e){if(_0x197a5a['body'][_0x318f('0x33')]){delete _0x197a5a[_0x318f('0x34')][_0x318f('0x33')];}return findForUpdate(_0x197a5a)[_0x318f('0xb')](handleEntityNotFound(_0xa9b81e,null))[_0x318f('0xb')](saveUpdates(_0x197a5a['body'],null))[_0x318f('0xb')](respondWithResult(_0xa9b81e,null))[_0x318f('0x28')](handleError(_0xa9b81e,null));};exports[_0x318f('0x35')]=function(_0x57ed8d,_0x586186,_0x5db4f1){if(_0x57ed8d[_0x318f('0x34')]['uniqueid']){delete _0x57ed8d['body'][_0x318f('0x33')];}promiseRetry(function(_0x1c9322){return findForUpdate(_0x57ed8d)['then'](function(_0x1e6ac2){if(_0x1e6ac2!==null){return _0x1e6ac2;}else{_0x1c9322(new Error(_0x318f('0x36')));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x212c3a){if(!_0x212c3a){return new Promise(function(_0x33c948){_0x33c948(handleEntityNotFound(_0x586186)());});}else{return _0x212c3a[_0x318f('0x32')](_0x57ed8d[_0x318f('0x34')])[_0x318f('0xb')](function(_0x2cee3b){return respondWithResult(_0x586186)(_0x2cee3b);});}},function(){handleEntityNotFound(_0x586186)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index e34ca80..47dff0f 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 _0xa7eb=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','VoiceCallReport','report_call'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa7eb,0x1d5));var _0xba7e=function(_0x1fe275,_0x5b9103){_0x1fe275=_0x1fe275-0x0;var _0x43d865=_0xa7eb[_0x1fe275];return _0x43d865;};'use strict';var _=require(_0xba7e('0x0'));var util=require('util');var logger=require(_0xba7e('0x1'))(_0xba7e('0x2'));var moment=require(_0xba7e('0x3'));var BPromise=require(_0xba7e('0x4'));var rp=require(_0xba7e('0x5'));var fs=require('fs');var path=require(_0xba7e('0x6'));var rimraf=require(_0xba7e('0x7'));var config=require(_0xba7e('0x8'));var attributes=require(_0xba7e('0x9'));module['exports']=function(_0x3946f2,_0x1c1c6d){return _0x3946f2['define'](_0xba7e('0xa'),attributes,{'tableName':_0xba7e('0xb'),'paranoid':![],'indexes':[{'fields':[_0xba7e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b77=['define','VoiceCallReport','report_call','uniqueid','lodash','util','api','bluebird','request-promise','./voiceCallReport.attributes','exports'];(function(_0x48e645,_0x53cc57){var _0x2902f5=function(_0x2c3d4c){while(--_0x2c3d4c){_0x48e645['push'](_0x48e645['shift']());}};_0x2902f5(++_0x53cc57);}(_0x1b77,0x72));var _0x71b7=function(_0xc587ba,_0x5d4cf2){_0xc587ba=_0xc587ba-0x0;var _0x1549fa=_0x1b77[_0xc587ba];return _0x1549fa;};'use strict';var _=require(_0x71b7('0x0'));var util=require(_0x71b7('0x1'));var logger=require('../../config/logger')(_0x71b7('0x2'));var moment=require('moment');var BPromise=require(_0x71b7('0x3'));var rp=require(_0x71b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x71b7('0x5'));module[_0x71b7('0x6')]=function(_0x201664,_0x82e325){return _0x201664[_0x71b7('0x7')](_0x71b7('0x8'),attributes,{'tableName':_0x71b7('0x9'),'paranoid':![],'indexes':[{'fields':[_0x71b7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 4f77d8b..c24e164 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 _0x8aa0=['VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','include','map','model','debug','CreateVoiceCallReport','body','catch','UpdateVoiceCallReport','update','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8aa0,0x1d2));var _0x08aa=function(_0x2e5c60,_0x145aa0){_0x2e5c60=_0x2e5c60-0x0;var _0x50eeb9=_0x8aa0[_0x2e5c60];return _0x50eeb9;};'use strict';var _=require('lodash');var util=require(_0x08aa('0x0'));var moment=require(_0x08aa('0x1'));var BPromise=require(_0x08aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08aa('0x3'));var db=require(_0x08aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x08aa('0x5'))(_0x08aa('0x6'));var config=require(_0x08aa('0x7'));var jayson=require(_0x08aa('0x8'));var client=jayson[_0x08aa('0x9')][_0x08aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x441113,_0x50a4a6,_0x388efc){return new BPromise(function(_0x4b14f1,_0x262b73){return client[_0x08aa('0xb')](_0x441113,_0x388efc)[_0x08aa('0xc')](function(_0x2db55b){logger[_0x08aa('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x50a4a6,_0x08aa('0xe'));logger['debug'](_0x08aa('0xf'),_0x50a4a6,'request\x20sent',JSON[_0x08aa('0x10')](_0x2db55b));if(_0x2db55b[_0x08aa('0x11')]){if(_0x2db55b[_0x08aa('0x11')][_0x08aa('0x12')]===0x1f4){logger[_0x08aa('0x11')](_0x08aa('0x13'),_0x50a4a6,_0x2db55b[_0x08aa('0x11')][_0x08aa('0x14')]);return _0x262b73(_0x2db55b[_0x08aa('0x11')][_0x08aa('0x14')]);}logger[_0x08aa('0x11')](_0x08aa('0x13'),_0x50a4a6,_0x2db55b[_0x08aa('0x11')][_0x08aa('0x14')]);return _0x4b14f1(_0x2db55b[_0x08aa('0x11')]['message']);}else{logger['info'](_0x08aa('0x13'),_0x50a4a6,_0x08aa('0xe'));_0x4b14f1(_0x2db55b['result'][_0x08aa('0x14')]);}})['catch'](function(_0x373511){logger['error'](_0x08aa('0x13'),_0x50a4a6,_0x373511);_0x262b73(_0x373511);});});}exports[_0x08aa('0x15')]=function(_0x15667b){var _0xba973c=this;return new Promise(function(_0x1d97b9,_0x5efe53){return db[_0x08aa('0x16')][_0x08aa('0x17')]({'raw':_0x15667b[_0x08aa('0x18')]?_0x15667b[_0x08aa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x15667b[_0x08aa('0x18')]?_0x15667b[_0x08aa('0x18')][_0x08aa('0x19')]||null:null,'attributes':_0x15667b[_0x08aa('0x18')]?_0x15667b[_0x08aa('0x18')][_0x08aa('0x1a')]||null:null,'limit':_0x15667b[_0x08aa('0x18')]?_0x15667b[_0x08aa('0x18')]['limit']||null:null,'include':_0x15667b[_0x08aa('0x18')]?_0x15667b[_0x08aa('0x18')][_0x08aa('0x1b')]?_[_0x08aa('0x1c')](_0x15667b[_0x08aa('0x18')][_0x08aa('0x1b')],function(_0x30d88d){return{'model':db[_0x30d88d[_0x08aa('0x1d')]],'as':_0x30d88d['as'],'attributes':_0x30d88d[_0x08aa('0x1a')],'include':_0x30d88d[_0x08aa('0x1b')]?_[_0x08aa('0x1c')](_0x30d88d[_0x08aa('0x1b')],function(_0x32f1fd){return{'model':db[_0x32f1fd[_0x08aa('0x1d')]],'as':_0x32f1fd['as'],'attributes':_0x32f1fd[_0x08aa('0x1a')],'include':_0x32f1fd[_0x08aa('0x1b')]?_['map'](_0x32f1fd[_0x08aa('0x1b')],function(_0x1f33a8){return{'model':db[_0x1f33a8[_0x08aa('0x1d')]],'as':_0x1f33a8['as'],'attributes':_0x1f33a8['attributes']};}):[]};}):[]};}):[]:[]})[_0x08aa('0xc')](function(_0x5687bf){logger[_0x08aa('0xd')](_0x08aa('0x15'),_0x15667b);logger[_0x08aa('0x1e')](_0x08aa('0x15'),_0x15667b,JSON['stringify'](_0x5687bf));_0x1d97b9(_0x5687bf);})['catch'](function(_0x486e14){logger['error']('GetVoiceCallReport',_0x486e14['message'],_0x15667b);_0x5efe53(_0xba973c[_0x08aa('0x11')](0x1f4,_0x486e14['message']));});});};exports[_0x08aa('0x1f')]=function(_0x201292){var _0x5a2a9e=this;return new Promise(function(_0x2e4c52,_0x5627a2){return db[_0x08aa('0x16')]['create'](_0x201292[_0x08aa('0x20')],{'raw':_0x201292[_0x08aa('0x18')]?_0x201292['options']['raw']===undefined?!![]:![]:!![]})[_0x08aa('0xc')](function(_0x110350){logger[_0x08aa('0xd')](_0x08aa('0x1f'),_0x201292);logger[_0x08aa('0x1e')]('CreateVoiceCallReport',_0x201292,JSON[_0x08aa('0x10')](_0x110350));_0x2e4c52(_0x110350);})[_0x08aa('0x21')](function(_0x156e77){logger[_0x08aa('0x11')](_0x08aa('0x1f'),_0x156e77[_0x08aa('0x14')],_0x201292);_0x5627a2(_0x5a2a9e[_0x08aa('0x11')](0x1f4,_0x156e77[_0x08aa('0x14')]));});});};exports[_0x08aa('0x22')]=function(_0x580bec){var _0x3f0a73=this;return new Promise(function(_0x5e3343,_0x20d30a){return db[_0x08aa('0x16')][_0x08aa('0x23')](_0x580bec[_0x08aa('0x20')],{'raw':_0x580bec['options']?_0x580bec[_0x08aa('0x18')][_0x08aa('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x580bec[_0x08aa('0x18')]?_0x580bec[_0x08aa('0x18')][_0x08aa('0x19')]||null:null,'attributes':_0x580bec[_0x08aa('0x18')]?_0x580bec[_0x08aa('0x18')][_0x08aa('0x1a')]||null:null,'limit':_0x580bec[_0x08aa('0x18')]?_0x580bec[_0x08aa('0x18')]['limit']||null:null})[_0x08aa('0xc')](function(_0x5c373d){logger[_0x08aa('0xd')](_0x08aa('0x22'),_0x580bec);logger['debug'](_0x08aa('0x22'),_0x580bec,JSON[_0x08aa('0x10')](_0x5c373d));_0x5e3343(_0x5c373d);})['catch'](function(_0x14e3df){logger[_0x08aa('0x11')]('UpdateVoiceCallReport',_0x14e3df[_0x08aa('0x14')],_0x580bec);_0x20d30a(_0x3f0a73[_0x08aa('0x11')](0x1f4,_0x14e3df['message']));});});}; \ No newline at end of file +var _0x886d=['error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','limit','include','map','model','attributes','then','debug','create','CreateVoiceCallReport','UpdateVoiceCallReport','update','body','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2fd3da,_0x3df147){var _0x16d1e5=function(_0x1ad45b){while(--_0x1ad45b){_0x2fd3da['push'](_0x2fd3da['shift']());}};_0x16d1e5(++_0x3df147);}(_0x886d,0x1ea));var _0xd886=function(_0x46b295,_0x554b00){_0x46b295=_0x46b295-0x0;var _0x1c4c10=_0x886d[_0x46b295];return _0x1c4c10;};'use strict';var _=require(_0xd886('0x0'));var util=require(_0xd886('0x1'));var moment=require('moment');var BPromise=require(_0xd886('0x2'));var rs=require(_0xd886('0x3'));var fs=require('fs');var Redis=require(_0xd886('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd886('0x5'));var logger=require(_0xd886('0x6'))('rpc');var config=require(_0xd886('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd886('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x463370,_0x33399e,_0x1bbc7c){return new BPromise(function(_0x20037a,_0x285c46){return client[_0xd886('0x9')](_0x463370,_0x1bbc7c)['then'](function(_0x1034b1){logger[_0xd886('0xa')](_0xd886('0xb'),_0x33399e,_0xd886('0xc'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x33399e,_0xd886('0xc'),JSON[_0xd886('0xd')](_0x1034b1));if(_0x1034b1[_0xd886('0xe')]){if(_0x1034b1[_0xd886('0xe')][_0xd886('0xf')]===0x1f4){logger[_0xd886('0xe')](_0xd886('0xb'),_0x33399e,_0x1034b1[_0xd886('0xe')]['message']);return _0x285c46(_0x1034b1[_0xd886('0xe')][_0xd886('0x10')]);}logger[_0xd886('0xe')](_0xd886('0xb'),_0x33399e,_0x1034b1[_0xd886('0xe')][_0xd886('0x10')]);return _0x20037a(_0x1034b1[_0xd886('0xe')][_0xd886('0x10')]);}else{logger['info'](_0xd886('0xb'),_0x33399e,_0xd886('0xc'));_0x20037a(_0x1034b1[_0xd886('0x11')]['message']);}})[_0xd886('0x12')](function(_0x48f337){logger[_0xd886('0xe')](_0xd886('0xb'),_0x33399e,_0x48f337);_0x285c46(_0x48f337);});});}exports[_0xd886('0x13')]=function(_0x2804cf){var _0x1bd7b1=this;return new Promise(function(_0x4259ad,_0x5f03fc){return db[_0xd886('0x14')]['findAll']({'raw':_0x2804cf[_0xd886('0x15')]?_0x2804cf[_0xd886('0x15')][_0xd886('0x16')]===undefined?!![]:![]:!![],'where':_0x2804cf[_0xd886('0x15')]?_0x2804cf[_0xd886('0x15')][_0xd886('0x17')]||null:null,'attributes':_0x2804cf['options']?_0x2804cf[_0xd886('0x15')]['attributes']||null:null,'limit':_0x2804cf[_0xd886('0x15')]?_0x2804cf[_0xd886('0x15')][_0xd886('0x18')]||null:null,'include':_0x2804cf[_0xd886('0x15')]?_0x2804cf[_0xd886('0x15')][_0xd886('0x19')]?_[_0xd886('0x1a')](_0x2804cf[_0xd886('0x15')][_0xd886('0x19')],function(_0x3fa8fc){return{'model':db[_0x3fa8fc[_0xd886('0x1b')]],'as':_0x3fa8fc['as'],'attributes':_0x3fa8fc[_0xd886('0x1c')],'include':_0x3fa8fc[_0xd886('0x19')]?_[_0xd886('0x1a')](_0x3fa8fc[_0xd886('0x19')],function(_0x3be41c){return{'model':db[_0x3be41c[_0xd886('0x1b')]],'as':_0x3be41c['as'],'attributes':_0x3be41c[_0xd886('0x1c')],'include':_0x3be41c[_0xd886('0x19')]?_[_0xd886('0x1a')](_0x3be41c[_0xd886('0x19')],function(_0x14b689){return{'model':db[_0x14b689[_0xd886('0x1b')]],'as':_0x14b689['as'],'attributes':_0x14b689[_0xd886('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd886('0x1d')](function(_0xde1f4){logger[_0xd886('0xa')]('GetVoiceCallReport',_0x2804cf);logger[_0xd886('0x1e')](_0xd886('0x13'),_0x2804cf,JSON[_0xd886('0xd')](_0xde1f4));_0x4259ad(_0xde1f4);})[_0xd886('0x12')](function(_0xced56e){logger[_0xd886('0xe')]('GetVoiceCallReport',_0xced56e[_0xd886('0x10')],_0x2804cf);_0x5f03fc(_0x1bd7b1['error'](0x1f4,_0xced56e['message']));});});};exports['CreateVoiceCallReport']=function(_0x2959c4){var _0x5022d2=this;return new Promise(function(_0x48d1f0,_0x470af9){return db[_0xd886('0x14')][_0xd886('0x1f')](_0x2959c4['body'],{'raw':_0x2959c4[_0xd886('0x15')]?_0x2959c4[_0xd886('0x15')][_0xd886('0x16')]===undefined?!![]:![]:!![]})[_0xd886('0x1d')](function(_0x6c93e8){logger[_0xd886('0xa')]('CreateVoiceCallReport',_0x2959c4);logger[_0xd886('0x1e')](_0xd886('0x20'),_0x2959c4,JSON[_0xd886('0xd')](_0x6c93e8));_0x48d1f0(_0x6c93e8);})['catch'](function(_0x1e7713){logger[_0xd886('0xe')](_0xd886('0x20'),_0x1e7713[_0xd886('0x10')],_0x2959c4);_0x470af9(_0x5022d2[_0xd886('0xe')](0x1f4,_0x1e7713[_0xd886('0x10')]));});});};exports[_0xd886('0x21')]=function(_0x4f05a0){var _0x3fc6f9=this;return new Promise(function(_0x1eb732,_0x5d460a){return db['VoiceCallReport'][_0xd886('0x22')](_0x4f05a0[_0xd886('0x23')],{'raw':_0x4f05a0['options']?_0x4f05a0[_0xd886('0x15')][_0xd886('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f05a0[_0xd886('0x15')]?_0x4f05a0[_0xd886('0x15')]['where']||null:null,'attributes':_0x4f05a0[_0xd886('0x15')]?_0x4f05a0[_0xd886('0x15')]['attributes']||null:null,'limit':_0x4f05a0[_0xd886('0x15')]?_0x4f05a0['options'][_0xd886('0x18')]||null:null})[_0xd886('0x1d')](function(_0x1fa7d4){logger[_0xd886('0xa')]('UpdateVoiceCallReport',_0x4f05a0);logger[_0xd886('0x1e')](_0xd886('0x21'),_0x4f05a0,JSON[_0xd886('0xd')](_0x1fa7d4));_0x1eb732(_0x1fa7d4);})['catch'](function(_0x2caa0f){logger[_0xd886('0xe')](_0xd886('0x21'),_0x2caa0f['message'],_0x4f05a0);_0x5d460a(_0x3fc6f9[_0xd886('0xe')](0x1f4,_0x2caa0f[_0xd886('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 58aba9c..e1887a6 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 _0xd67c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','path'];(function(_0xea7085,_0x8f947e){var _0x5538a7=function(_0x352d64){while(--_0x352d64){_0xea7085['push'](_0xea7085['shift']());}};_0x5538a7(++_0x8f947e);}(_0xd67c,0x177));var _0xcd67=function(_0x450e22,_0x3ba125){_0x450e22=_0x450e22-0x0;var _0x5e3b1d=_0xd67c[_0x450e22];return _0x5e3b1d;};'use strict';var multer=require(_0xcd67('0x0'));var util=require(_0xcd67('0x1'));var path=require(_0xcd67('0x2'));var timeout=require(_0xcd67('0x3'));var express=require(_0xcd67('0x4'));var router=express[_0xcd67('0x5')]();var fs_extra=require(_0xcd67('0x6'));var auth=require(_0xcd67('0x7'));var interaction=require(_0xcd67('0x8'));var config=require(_0xcd67('0x9'));var controller=require(_0xcd67('0xa'));router[_0xcd67('0xb')]('/',auth[_0xcd67('0xc')](),controller[_0xcd67('0xd')]);router['get'](_0xcd67('0xe'),auth[_0xcd67('0xc')](),controller[_0xcd67('0xf')]);router[_0xcd67('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcd67('0x11')]('/:id',auth[_0xcd67('0xc')](),controller['update']);router[_0xcd67('0x12')]('/:id',auth[_0xcd67('0xc')](),controller[_0xcd67('0x13')]);module[_0xcd67('0x14')]=router; \ No newline at end of file +var _0xf4fe=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0xf4fe,0x84));var _0xef4f=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xf4fe[_0x174ef5];return _0x1cc379;};'use strict';var multer=require(_0xef4f('0x0'));var util=require(_0xef4f('0x1'));var path=require(_0xef4f('0x2'));var timeout=require(_0xef4f('0x3'));var express=require('express');var router=express[_0xef4f('0x4')]();var fs_extra=require(_0xef4f('0x5'));var auth=require(_0xef4f('0x6'));var interaction=require(_0xef4f('0x7'));var config=require(_0xef4f('0x8'));var controller=require(_0xef4f('0x9'));router[_0xef4f('0xa')]('/',auth[_0xef4f('0xb')](),controller['index']);router[_0xef4f('0xa')](_0xef4f('0xc'),auth[_0xef4f('0xb')](),controller[_0xef4f('0xd')]);router[_0xef4f('0xe')]('/',auth[_0xef4f('0xb')](),controller[_0xef4f('0xf')]);router[_0xef4f('0x10')](_0xef4f('0xc'),auth[_0xef4f('0xb')](),controller[_0xef4f('0x11')]);router[_0xef4f('0x12')](_0xef4f('0xc'),auth[_0xef4f('0xb')](),controller[_0xef4f('0x13')]);module[_0xef4f('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index a84a9b1..337a70e 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 _0x5d6e=['STRING','name','options','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x5d6e,0xce));var _0xe5d6=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x5d6e[_0x3239f5];return _0x3559c8;};'use strict';var Sequelize=require(_0xe5d6('0x0'));module[_0xe5d6('0x1')]={'name':{'type':Sequelize[_0xe5d6('0x2')]},'prefix':{'type':Sequelize[_0xe5d6('0x2')],'unique':_0xe5d6('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe5d6('0x2')],'set':function(_0x468a3c){this['setDataValue'](_0xe5d6('0x4'),_0x468a3c?_0x468a3c['join'](''):[]);},'get':function(){return this[_0xe5d6('0x5')](_0xe5d6('0x4'))?this[_0xe5d6('0x5')](_0xe5d6('0x4'))[_0xe5d6('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xe5d6('0x2')]},'record':{'type':Sequelize[_0xe5d6('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4f22=['setDataValue','options','getDataValue','sequelize','STRING','name'];(function(_0x8e45c7,_0x36a9b){var _0x41ca8d=function(_0x2ca9f8){while(--_0x2ca9f8){_0x8e45c7['push'](_0x8e45c7['shift']());}};_0x41ca8d(++_0x36a9b);}(_0x4f22,0xc3));var _0x24f2=function(_0x484187,_0x2ec490){_0x484187=_0x484187-0x0;var _0x6bfed3=_0x4f22[_0x484187];return _0x6bfed3;};'use strict';var Sequelize=require(_0x24f2('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x24f2('0x1')],'unique':_0x24f2('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x24f2('0x1')],'set':function(_0x35cfa3){this[_0x24f2('0x3')](_0x24f2('0x4'),_0x35cfa3?_0x35cfa3['join'](''):[]);},'get':function(){return this['getDataValue'](_0x24f2('0x4'))?this[_0x24f2('0x5')](_0x24f2('0x4'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x24f2('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x24f2('0x1')]},'description':{'type':Sequelize[_0x24f2('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 0d3cd69..8ecc6d3 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 _0xe630=['params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','apply','reject','update','then','destroy','ChanSpies','UserProfileResource','end','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','rows','catch','show','keys','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find'];(function(_0x5886a6,_0x2c9288){var _0x563a59=function(_0xbdebc1){while(--_0xbdebc1){_0x5886a6['push'](_0x5886a6['shift']());}};_0x563a59(++_0x2c9288);}(_0xe630,0x149));var _0x0e63=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0xe630[_0x4429e0];return _0x51a5b3;};'use strict';var emlformat=require(_0x0e63('0x0'));var rimraf=require(_0x0e63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e63('0x2'));var rp=require(_0x0e63('0x3'));var moment=require(_0x0e63('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0e63('0x5'));var util=require(_0x0e63('0x6'));var path=require(_0x0e63('0x7'));var sox=require('sox');var csv=require(_0x0e63('0x8'));var ejs=require(_0x0e63('0x9'));var fs=require('fs');var fs_extra=require(_0x0e63('0xa'));var _=require(_0x0e63('0xb'));var squel=require(_0x0e63('0xc'));var crypto=require('crypto');var jsforce=require(_0x0e63('0xd'));var deskjs=require(_0x0e63('0xe'));var toCsv=require(_0x0e63('0x8'));var querystring=require(_0x0e63('0xf'));var Papa=require(_0x0e63('0x10'));var Redis=require(_0x0e63('0x11'));var authService=require(_0x0e63('0x12'));var qs=require(_0x0e63('0x13'));var as=require(_0x0e63('0x14'));var hardwareService=require(_0x0e63('0x15'));var logger=require(_0x0e63('0x16'))('api');var utils=require(_0x0e63('0x17'));var config=require(_0x0e63('0x18'));var licenseUtil=require(_0x0e63('0x19'));var db=require(_0x0e63('0x1a'))['db'];function respondWithStatusCode(_0x34fd3c,_0x1e8200){_0x1e8200=_0x1e8200||0xcc;return function(_0x1282bc){if(_0x1282bc){return _0x34fd3c[_0x0e63('0x1b')](_0x1e8200);}return _0x34fd3c[_0x0e63('0x1c')](_0x1e8200)['end']();};}function respondWithResult(_0x486f8f,_0xf547b8){_0xf547b8=_0xf547b8||0xc8;return function(_0x29ff63){if(_0x29ff63){return _0x486f8f[_0x0e63('0x1c')](_0xf547b8)[_0x0e63('0x1d')](_0x29ff63);}};}function respondWithFilteredResult(_0x61c395,_0x35643c){return function(_0x47f3e2){if(_0x47f3e2){var _0x5d1f1e=typeof _0x35643c['offset']==='undefined'&&typeof _0x35643c[_0x0e63('0x1e')]===_0x0e63('0x1f');var _0x5c22ad=_0x47f3e2['count'];var _0x4dd1db=_0x5d1f1e?0x0:_0x35643c[_0x0e63('0x20')];var _0x5c01e0=_0x5d1f1e?_0x47f3e2['count']:_0x35643c[_0x0e63('0x20')]+_0x35643c['limit'];var _0xb01f46;if(_0x5c01e0>=_0x5c22ad){_0x5c01e0=_0x5c22ad;_0xb01f46=0xc8;}else{_0xb01f46=0xce;}_0x61c395[_0x0e63('0x1c')](_0xb01f46);return _0x61c395['set']('Content-Range',_0x4dd1db+'-'+_0x5c01e0+'/'+_0x5c22ad)[_0x0e63('0x1d')](_0x47f3e2);}return null;};}function patchUpdates(_0x1dfd60){return function(_0x16f166){try{jsonpatch[_0x0e63('0x21')](_0x16f166,_0x1dfd60,!![]);}catch(_0x305506){return BPromise[_0x0e63('0x22')](_0x305506);}return _0x16f166['save']();};}function saveUpdates(_0xb0d024,_0x23ed8c){return function(_0x2a4f55){if(_0x2a4f55){return _0x2a4f55[_0x0e63('0x23')](_0xb0d024)[_0x0e63('0x24')](function(_0x4ab310){return _0x4ab310;});}return null;};}function removeEntity(_0x51bb78,_0x437878){return function(_0x3aaea5){if(_0x3aaea5){return _0x3aaea5[_0x0e63('0x25')]()[_0x0e63('0x24')](function(){var _0x412500=_0x3aaea5['get']({'plain':!![]});var _0x22bdce=_0x0e63('0x26');return db[_0x0e63('0x27')][_0x0e63('0x25')]({'where':{'type':_0x22bdce,'resourceId':_0x412500['id']}})[_0x0e63('0x24')](function(){return _0x3aaea5;});})[_0x0e63('0x24')](function(){_0x51bb78[_0x0e63('0x1c')](0xcc)[_0x0e63('0x28')]();});}};}function handleEntityNotFound(_0x25e88e,_0x3b9fb6){return function(_0x46c864){if(!_0x46c864){_0x25e88e['sendStatus'](0x194);}return _0x46c864;};}function handleError(_0x4b026e,_0x595753){_0x595753=_0x595753||0x1f4;return function(_0x66a314){logger[_0x0e63('0x29')](_0x66a314[_0x0e63('0x2a')]);if(_0x66a314[_0x0e63('0x2b')]){delete _0x66a314[_0x0e63('0x2b')];}_0x4b026e[_0x0e63('0x1c')](_0x595753)[_0x0e63('0x2c')](_0x66a314);};}exports[_0x0e63('0x2d')]=function(_0x2ef997,_0x31fc3e){var _0x1069c7={},_0x319061={},_0x435990={'count':0x0,'rows':[]};var _0x19cde4=_[_0x0e63('0x2e')](db[_0x0e63('0x2f')][_0x0e63('0x30')],function(_0x5e34ae){return{'name':_0x5e34ae[_0x0e63('0x31')],'type':_0x5e34ae[_0x0e63('0x32')]['key']};});_0x319061[_0x0e63('0x33')]=_[_0x0e63('0x2e')](_0x19cde4,_0x0e63('0x2b'));_0x319061[_0x0e63('0x34')]=_['keys'](_0x2ef997[_0x0e63('0x34')]);_0x319061[_0x0e63('0x35')]=_[_0x0e63('0x36')](_0x319061[_0x0e63('0x33')],_0x319061[_0x0e63('0x34')]);_0x1069c7[_0x0e63('0x37')]=_['intersection'](_0x319061[_0x0e63('0x33')],qs[_0x0e63('0x38')](_0x2ef997[_0x0e63('0x34')][_0x0e63('0x38')]));_0x1069c7[_0x0e63('0x37')]=_0x1069c7[_0x0e63('0x37')]['length']?_0x1069c7[_0x0e63('0x37')]:_0x319061[_0x0e63('0x33')];if(!_0x2ef997[_0x0e63('0x34')][_0x0e63('0x39')](_0x0e63('0x3a'))){_0x1069c7[_0x0e63('0x1e')]=qs['limit'](_0x2ef997[_0x0e63('0x34')]['limit']);_0x1069c7[_0x0e63('0x20')]=qs[_0x0e63('0x20')](_0x2ef997[_0x0e63('0x34')][_0x0e63('0x20')]);}_0x1069c7[_0x0e63('0x3b')]=qs['sort'](_0x2ef997['query']['sort']);_0x1069c7[_0x0e63('0x3c')]=qs[_0x0e63('0x35')](_[_0x0e63('0x3d')](_0x2ef997[_0x0e63('0x34')],_0x319061[_0x0e63('0x35')]),_0x19cde4);if(_0x2ef997['query']['filter']){_0x1069c7[_0x0e63('0x3c')]=_['merge'](_0x1069c7[_0x0e63('0x3c')],{'$or':_['map'](_0x19cde4,function(_0xeb2a78){if(_0xeb2a78[_0x0e63('0x32')]!=='VIRTUAL'){var _0x198b04={};_0x198b04[_0xeb2a78[_0x0e63('0x2b')]]={'$like':'%'+_0x2ef997[_0x0e63('0x34')][_0x0e63('0x3e')]+'%'};return _0x198b04;}})});}_0x1069c7=_[_0x0e63('0x3f')]({},_0x1069c7,_0x2ef997[_0x0e63('0x40')]);var _0x2438c9={'where':_0x1069c7[_0x0e63('0x3c')]};return db[_0x0e63('0x2f')]['count'](_0x2438c9)['then'](function(_0x3ae899){_0x435990['count']=_0x3ae899;if(_0x2ef997[_0x0e63('0x34')][_0x0e63('0x41')]){_0x1069c7[_0x0e63('0x42')]=[{'all':!![]}];}return db[_0x0e63('0x2f')]['findAll'](_0x1069c7);})[_0x0e63('0x24')](function(_0x31da43){_0x435990[_0x0e63('0x43')]=_0x31da43;return _0x435990;})[_0x0e63('0x24')](respondWithFilteredResult(_0x31fc3e,_0x1069c7))[_0x0e63('0x44')](handleError(_0x31fc3e,null));};exports[_0x0e63('0x45')]=function(_0x32d6a5,_0x11935b){var _0x419cf8={'raw':![],'where':{'id':_0x32d6a5['params']['id']}},_0x18e754={};_0x18e754[_0x0e63('0x33')]=_[_0x0e63('0x46')](db[_0x0e63('0x2f')][_0x0e63('0x30')]);_0x18e754['query']=_[_0x0e63('0x46')](_0x32d6a5[_0x0e63('0x34')]);_0x18e754[_0x0e63('0x35')]=_['intersection'](_0x18e754[_0x0e63('0x33')],_0x18e754[_0x0e63('0x34')]);_0x419cf8[_0x0e63('0x37')]=_['intersection'](_0x18e754[_0x0e63('0x33')],qs[_0x0e63('0x38')](_0x32d6a5[_0x0e63('0x34')][_0x0e63('0x38')]));_0x419cf8['attributes']=_0x419cf8[_0x0e63('0x37')]['length']?_0x419cf8[_0x0e63('0x37')]:_0x18e754[_0x0e63('0x33')];if(_0x32d6a5[_0x0e63('0x34')][_0x0e63('0x41')]){_0x419cf8[_0x0e63('0x42')]=[{'all':!![]}];}_0x419cf8=_[_0x0e63('0x3f')]({},_0x419cf8,_0x32d6a5[_0x0e63('0x40')]);return db[_0x0e63('0x2f')]['find'](_0x419cf8)['then'](handleEntityNotFound(_0x11935b,null))['then'](respondWithResult(_0x11935b,null))[_0x0e63('0x44')](handleError(_0x11935b,null));};exports[_0x0e63('0x47')]=function(_0xe3f5b7,_0x478e74){return db[_0x0e63('0x2f')][_0x0e63('0x47')](_0xe3f5b7[_0x0e63('0x48')],{})[_0x0e63('0x24')](function(_0x5e2eab){var _0x4ccc73=_0xe3f5b7[_0x0e63('0x49')][_0x0e63('0x4a')]({'plain':!![]});if(!_0x4ccc73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ccc73[_0x0e63('0x4b')]===_0x0e63('0x49')){var _0x3f8dca=_0x5e2eab['get']({'plain':!![]});var _0x1c8e33=_0x0e63('0x26');return db[_0x0e63('0x4c')]['find']({'where':{'name':_0x1c8e33,'userProfileId':_0x4ccc73[_0x0e63('0x4d')]},'raw':!![]})[_0x0e63('0x24')](function(_0x452d76){if(_0x452d76&&_0x452d76[_0x0e63('0x4e')]===0x0){return db[_0x0e63('0x27')][_0x0e63('0x47')]({'name':_0x3f8dca[_0x0e63('0x2b')],'resourceId':_0x3f8dca['id'],'type':_0x452d76[_0x0e63('0x2b')],'sectionId':_0x452d76['id']},{})[_0x0e63('0x24')](function(){return _0x5e2eab;});}else{return _0x5e2eab;}})[_0x0e63('0x44')](function(_0x5a513d){logger[_0x0e63('0x29')](_0x0e63('0x4f'),_0x5a513d);throw _0x5a513d;});}return _0x5e2eab;})[_0x0e63('0x24')](respondWithResult(_0x478e74,0xc9))[_0x0e63('0x44')](handleError(_0x478e74,null));};exports[_0x0e63('0x23')]=function(_0x25d5bc,_0x3570f0){if(_0x25d5bc[_0x0e63('0x48')]['id']){delete _0x25d5bc['body']['id'];}return db[_0x0e63('0x2f')][_0x0e63('0x50')]({'where':{'id':_0x25d5bc[_0x0e63('0x51')]['id']}})[_0x0e63('0x24')](handleEntityNotFound(_0x3570f0,null))[_0x0e63('0x24')](saveUpdates(_0x25d5bc[_0x0e63('0x48')],null))[_0x0e63('0x24')](respondWithResult(_0x3570f0,null))[_0x0e63('0x44')](handleError(_0x3570f0,null));};exports[_0x0e63('0x25')]=function(_0x4266a1,_0x4351ff){return db[_0x0e63('0x2f')][_0x0e63('0x50')]({'where':{'id':_0x4266a1['params']['id']}})[_0x0e63('0x24')](handleEntityNotFound(_0x4351ff,null))[_0x0e63('0x24')](removeEntity(_0x4351ff,null))['catch'](handleError(_0x4351ff,null));}; \ No newline at end of file +var _0xd73a=['update','then','destroy','get','ChanSpies','UserProfileResource','name','send','map','VoiceChanSpy','rawAttributes','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0xf48d27,_0xc761af){var _0x172722=function(_0x4722d1){while(--_0x4722d1){_0xf48d27['push'](_0xf48d27['shift']());}};_0x172722(++_0xc761af);}(_0xd73a,0x171));var _0xad73=function(_0x1060ea,_0x4c7322){_0x1060ea=_0x1060ea-0x0;var _0x49ec59=_0xd73a[_0x1060ea];return _0x49ec59;};'use strict';var emlformat=require(_0xad73('0x0'));var rimraf=require(_0xad73('0x1'));var zipdir=require(_0xad73('0x2'));var jsonpatch=require(_0xad73('0x3'));var rp=require(_0xad73('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad73('0x5'));var util=require(_0xad73('0x6'));var path=require(_0xad73('0x7'));var sox=require(_0xad73('0x8'));var csv=require(_0xad73('0x9'));var ejs=require(_0xad73('0xa'));var fs=require('fs');var fs_extra=require(_0xad73('0xb'));var _=require(_0xad73('0xc'));var squel=require(_0xad73('0xd'));var crypto=require(_0xad73('0xe'));var jsforce=require(_0xad73('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xad73('0x9'));var querystring=require('querystring');var Papa=require(_0xad73('0x10'));var Redis=require(_0xad73('0x11'));var authService=require(_0xad73('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xad73('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad73('0x14'))('api');var utils=require(_0xad73('0x15'));var config=require(_0xad73('0x16'));var licenseUtil=require(_0xad73('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1045be,_0x241ff5){_0x241ff5=_0x241ff5||0xcc;return function(_0x488787){if(_0x488787){return _0x1045be[_0xad73('0x18')](_0x241ff5);}return _0x1045be[_0xad73('0x19')](_0x241ff5)[_0xad73('0x1a')]();};}function respondWithResult(_0x27a9d2,_0x15f72d){_0x15f72d=_0x15f72d||0xc8;return function(_0x82fe13){if(_0x82fe13){return _0x27a9d2['status'](_0x15f72d)[_0xad73('0x1b')](_0x82fe13);}};}function respondWithFilteredResult(_0x35c2c5,_0x4336fa){return function(_0x155548){if(_0x155548){var _0x2f0dcd=typeof _0x4336fa[_0xad73('0x1c')]===_0xad73('0x1d')&&typeof _0x4336fa[_0xad73('0x1e')]===_0xad73('0x1d');var _0xad072c=_0x155548['count'];var _0x47381a=_0x2f0dcd?0x0:_0x4336fa['offset'];var _0x5bd242=_0x2f0dcd?_0x155548[_0xad73('0x1f')]:_0x4336fa[_0xad73('0x1c')]+_0x4336fa[_0xad73('0x1e')];var _0x578068;if(_0x5bd242>=_0xad072c){_0x5bd242=_0xad072c;_0x578068=0xc8;}else{_0x578068=0xce;}_0x35c2c5[_0xad73('0x19')](_0x578068);return _0x35c2c5[_0xad73('0x20')]('Content-Range',_0x47381a+'-'+_0x5bd242+'/'+_0xad072c)[_0xad73('0x1b')](_0x155548);}return null;};}function patchUpdates(_0x4289df){return function(_0x3e02ed){try{jsonpatch[_0xad73('0x21')](_0x3e02ed,_0x4289df,!![]);}catch(_0x2e6cdb){return BPromise[_0xad73('0x22')](_0x2e6cdb);}return _0x3e02ed[_0xad73('0x23')]();};}function saveUpdates(_0x497c3d,_0xfe2758){return function(_0x31f5c4){if(_0x31f5c4){return _0x31f5c4[_0xad73('0x24')](_0x497c3d)[_0xad73('0x25')](function(_0xb3e0b0){return _0xb3e0b0;});}return null;};}function removeEntity(_0x2a1295,_0xbfb297){return function(_0x439f09){if(_0x439f09){return _0x439f09[_0xad73('0x26')]()[_0xad73('0x25')](function(){var _0x18e58b=_0x439f09[_0xad73('0x27')]({'plain':!![]});var _0x182805=_0xad73('0x28');return db[_0xad73('0x29')][_0xad73('0x26')]({'where':{'type':_0x182805,'resourceId':_0x18e58b['id']}})[_0xad73('0x25')](function(){return _0x439f09;});})[_0xad73('0x25')](function(){_0x2a1295[_0xad73('0x19')](0xcc)[_0xad73('0x1a')]();});}};}function handleEntityNotFound(_0x5bd387,_0x4e0855){return function(_0x5cd6a6){if(!_0x5cd6a6){_0x5bd387[_0xad73('0x18')](0x194);}return _0x5cd6a6;};}function handleError(_0x6e79c8,_0x4e435b){_0x4e435b=_0x4e435b||0x1f4;return function(_0x3f1f80){logger['error'](_0x3f1f80['stack']);if(_0x3f1f80[_0xad73('0x2a')]){delete _0x3f1f80[_0xad73('0x2a')];}_0x6e79c8[_0xad73('0x19')](_0x4e435b)[_0xad73('0x2b')](_0x3f1f80);};}exports['index']=function(_0xdf45e8,_0x3fab83){var _0x6d8b43={},_0x5939f3={},_0xca0215={'count':0x0,'rows':[]};var _0x1b488a=_[_0xad73('0x2c')](db[_0xad73('0x2d')][_0xad73('0x2e')],function(_0x53cd43){return{'name':_0x53cd43['fieldName'],'type':_0x53cd43['type'][_0xad73('0x2f')]};});_0x5939f3['model']=_[_0xad73('0x2c')](_0x1b488a,'name');_0x5939f3[_0xad73('0x30')]=_[_0xad73('0x31')](_0xdf45e8['query']);_0x5939f3['filters']=_[_0xad73('0x32')](_0x5939f3[_0xad73('0x33')],_0x5939f3['query']);_0x6d8b43['attributes']=_[_0xad73('0x32')](_0x5939f3['model'],qs[_0xad73('0x34')](_0xdf45e8[_0xad73('0x30')]['fields']));_0x6d8b43[_0xad73('0x35')]=_0x6d8b43['attributes'][_0xad73('0x36')]?_0x6d8b43[_0xad73('0x35')]:_0x5939f3[_0xad73('0x33')];if(!_0xdf45e8[_0xad73('0x30')][_0xad73('0x37')](_0xad73('0x38'))){_0x6d8b43[_0xad73('0x1e')]=qs[_0xad73('0x1e')](_0xdf45e8[_0xad73('0x30')]['limit']);_0x6d8b43[_0xad73('0x1c')]=qs[_0xad73('0x1c')](_0xdf45e8['query'][_0xad73('0x1c')]);}_0x6d8b43[_0xad73('0x39')]=qs[_0xad73('0x3a')](_0xdf45e8[_0xad73('0x30')][_0xad73('0x3a')]);_0x6d8b43[_0xad73('0x3b')]=qs[_0xad73('0x3c')](_[_0xad73('0x3d')](_0xdf45e8[_0xad73('0x30')],_0x5939f3['filters']),_0x1b488a);if(_0xdf45e8[_0xad73('0x30')][_0xad73('0x3e')]){_0x6d8b43[_0xad73('0x3b')]=_['merge'](_0x6d8b43['where'],{'$or':_[_0xad73('0x2c')](_0x1b488a,function(_0x4c1ba9){if(_0x4c1ba9['type']!==_0xad73('0x3f')){var _0x12a385={};_0x12a385[_0x4c1ba9[_0xad73('0x2a')]]={'$like':'%'+_0xdf45e8[_0xad73('0x30')]['filter']+'%'};return _0x12a385;}})});}_0x6d8b43=_[_0xad73('0x40')]({},_0x6d8b43,_0xdf45e8[_0xad73('0x41')]);var _0x486961={'where':_0x6d8b43[_0xad73('0x3b')]};return db[_0xad73('0x2d')]['count'](_0x486961)[_0xad73('0x25')](function(_0x46f3e8){_0xca0215[_0xad73('0x1f')]=_0x46f3e8;if(_0xdf45e8['query'][_0xad73('0x42')]){_0x6d8b43[_0xad73('0x43')]=[{'all':!![]}];}return db[_0xad73('0x2d')][_0xad73('0x44')](_0x6d8b43);})[_0xad73('0x25')](function(_0x4ee68d){_0xca0215['rows']=_0x4ee68d;return _0xca0215;})['then'](respondWithFilteredResult(_0x3fab83,_0x6d8b43))[_0xad73('0x45')](handleError(_0x3fab83,null));};exports[_0xad73('0x46')]=function(_0x11c951,_0xaf84e7){var _0x17bd79={'raw':![],'where':{'id':_0x11c951[_0xad73('0x47')]['id']}},_0x325fd0={};_0x325fd0['model']=_[_0xad73('0x31')](db[_0xad73('0x2d')]['rawAttributes']);_0x325fd0['query']=_[_0xad73('0x31')](_0x11c951[_0xad73('0x30')]);_0x325fd0[_0xad73('0x3c')]=_[_0xad73('0x32')](_0x325fd0['model'],_0x325fd0[_0xad73('0x30')]);_0x17bd79[_0xad73('0x35')]=_[_0xad73('0x32')](_0x325fd0['model'],qs[_0xad73('0x34')](_0x11c951[_0xad73('0x30')][_0xad73('0x34')]));_0x17bd79[_0xad73('0x35')]=_0x17bd79['attributes']['length']?_0x17bd79[_0xad73('0x35')]:_0x325fd0[_0xad73('0x33')];if(_0x11c951[_0xad73('0x30')][_0xad73('0x42')]){_0x17bd79[_0xad73('0x43')]=[{'all':!![]}];}_0x17bd79=_[_0xad73('0x40')]({},_0x17bd79,_0x11c951[_0xad73('0x41')]);return db[_0xad73('0x2d')][_0xad73('0x48')](_0x17bd79)['then'](handleEntityNotFound(_0xaf84e7,null))['then'](respondWithResult(_0xaf84e7,null))[_0xad73('0x45')](handleError(_0xaf84e7,null));};exports[_0xad73('0x49')]=function(_0xd5f21,_0x5b6e41){return db[_0xad73('0x2d')][_0xad73('0x49')](_0xd5f21[_0xad73('0x4a')],{})[_0xad73('0x25')](function(_0x51f88f){var _0xa28ea5=_0xd5f21[_0xad73('0x4b')][_0xad73('0x27')]({'plain':!![]});if(!_0xa28ea5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa28ea5[_0xad73('0x4c')]===_0xad73('0x4b')){var _0x3e884f=_0x51f88f[_0xad73('0x27')]({'plain':!![]});var _0x50706c='ChanSpies';return db[_0xad73('0x4d')][_0xad73('0x48')]({'where':{'name':_0x50706c,'userProfileId':_0xa28ea5[_0xad73('0x4e')]},'raw':!![]})['then'](function(_0x5ca8d3){if(_0x5ca8d3&&_0x5ca8d3[_0xad73('0x4f')]===0x0){return db[_0xad73('0x29')][_0xad73('0x49')]({'name':_0x3e884f[_0xad73('0x2a')],'resourceId':_0x3e884f['id'],'type':_0x5ca8d3[_0xad73('0x2a')],'sectionId':_0x5ca8d3['id']},{})[_0xad73('0x25')](function(){return _0x51f88f;});}else{return _0x51f88f;}})[_0xad73('0x45')](function(_0x49c661){logger[_0xad73('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49c661);throw _0x49c661;});}return _0x51f88f;})[_0xad73('0x25')](respondWithResult(_0x5b6e41,0xc9))['catch'](handleError(_0x5b6e41,null));};exports['update']=function(_0x23b016,_0x3f0e65){if(_0x23b016['body']['id']){delete _0x23b016[_0xad73('0x4a')]['id'];}return db[_0xad73('0x2d')][_0xad73('0x48')]({'where':{'id':_0x23b016[_0xad73('0x47')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x3f0e65,null))[_0xad73('0x25')](saveUpdates(_0x23b016[_0xad73('0x4a')],null))[_0xad73('0x25')](respondWithResult(_0x3f0e65,null))[_0xad73('0x45')](handleError(_0x3f0e65,null));};exports[_0xad73('0x26')]=function(_0x4e2e80,_0x10d264){return db['VoiceChanSpy'][_0xad73('0x48')]({'where':{'id':_0x4e2e80[_0xad73('0x47')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x10d264,null))[_0xad73('0x25')](removeEntity(_0x10d264,null))['catch'](handleError(_0x10d264,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 7a44e99..cd050ad 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 _0x58c2=['exports','models','define','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','prefix','system','push','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','format','SIP/%s,%s','name','options','StopMixMonitor','length','internal','concat','User','catch'];(function(_0x46556d,_0x4fc5e6){var _0x134a9a=function(_0x434f50){while(--_0x434f50){_0x46556d['push'](_0x46556d['shift']());}};_0x134a9a(++_0x4fc5e6);}(_0x58c2,0xc5));var _0x258c=function(_0x4e9e0d,_0xd86384){_0x4e9e0d=_0x4e9e0d-0x0;var _0x514622=_0x58c2[_0x4e9e0d];return _0x514622;};'use strict';var _=require(_0x258c('0x0'));var util=require(_0x258c('0x1'));var BPromise=require(_0x258c('0x2'));var attributes=require(_0x258c('0x3'));var getUserApplications=function(_0xf0fc4a,_0x35c4f1,_0x7100e9){var _0xfcbc4d=0x1;var _0x3b98ed=[];var _0x255f4e={'context':_0x35c4f1[_0x258c('0x4')]||_0x258c('0x5'),'exten':util['format']('%s%s',_0xf0fc4a[_0x258c('0x6')],_0x7100e9),'type':_0x258c('0x7'),'isApp':![],'ChanSpyId':_0xf0fc4a['id'],'UserId':_0x35c4f1['id']};_0x3b98ed[_0x258c('0x8')](_['merge']({'app':_0x258c('0x9'),'appdata':util['format'](_0x258c('0xa'),_0x258c('0xb')),'priority':_0xfcbc4d++},_0x255f4e));if(_0xf0fc4a[_0x258c('0xc')]){_0x3b98ed['push'](_[_0x258c('0xd')]({'app':_0x258c('0xe'),'appdata':util['format'](_0x258c('0xf'),_0xf0fc4a[_0x258c('0x10')]),'priority':_0xfcbc4d++},_0x255f4e));}if(_0xf0fc4a[_0x258c('0x11')]){_0x3b98ed['push'](_[_0x258c('0xd')]({'app':_0x258c('0x12'),'appdata':_0xf0fc4a[_0x258c('0x13')],'priority':_0xfcbc4d++},_0x255f4e));}_0x3b98ed[_0x258c('0x8')](_['merge']({'app':_0x258c('0x14'),'appdata':util[_0x258c('0x15')](_0x258c('0x16'),_0x35c4f1[_0x258c('0x17')],_0xf0fc4a['options']?_0xf0fc4a[_0x258c('0x18')]['join'](''):''),'priority':_0xfcbc4d++},_0x255f4e));if(_0xf0fc4a[_0x258c('0xc')]){_0x3b98ed[_0x258c('0x8')](_[_0x258c('0xd')]({'app':_0x258c('0x19'),'priority':_0xfcbc4d++},_0x255f4e));}return _0x3b98ed;};var getChanSpyApplications=function(_0x6f9c86,_0xb46eb1){var _0x2616ac=[];for(var _0x11c98b=0x0,_0x5d3f88=0x1;_0x11c98b<_0xb46eb1[_0x258c('0x1a')];_0x11c98b++,_0x5d3f88=0x1){_0x2616ac=_0x2616ac['concat'](getUserApplications(_0x6f9c86,_0xb46eb1[_0x11c98b],_0xb46eb1[_0x11c98b][_0x258c('0x1b')]));if(_0xb46eb1[_0x11c98b][_0x258c('0x1b')]!=_0xb46eb1[_0x11c98b][_0x258c('0x17')]){_0x2616ac=_0x2616ac[_0x258c('0x1c')](getUserApplications(_0x6f9c86,_0xb46eb1[_0x11c98b],_0xb46eb1[_0x11c98b][_0x258c('0x17')]));}}return _0x2616ac;};var getChanSpyPromise=function(_0x308ea8,_0x58c4bf){return new BPromise(function(_0x340e65,_0x8ce993){return _0x308ea8[_0x258c('0x1d')]['findAll']({'attributes':['id',_0x258c('0x17'),_0x258c('0x1b')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x50d7f2){if(_0x50d7f2){return _0x340e65(getChanSpyApplications(_0x58c4bf,_0x50d7f2));}return _0x340e65([]);})[_0x258c('0x1e')](function(_0x558f2d){_0x8ce993(_0x558f2d);});});};module[_0x258c('0x1f')]=function(_0x59daf3,_0x5d2472){var _0x46b0c2=_0x59daf3[_0x258c('0x20')];return _0x59daf3[_0x258c('0x21')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d3635,_0x39e4ae,_0x4859e5){return getChanSpyPromise(_0x46b0c2,_0x5d3635)[_0x258c('0x22')](function(_0x1d5c78){if(_0x1d5c78&&_0x1d5c78[_0x258c('0x1a')]){return _0x46b0c2[_0x258c('0x23')][_0x258c('0x24')](_0x1d5c78);}})[_0x258c('0x22')](function(){_0x4859e5();})[_0x258c('0x1e')](function(_0x5e7e95){_0x4859e5(_0x5e7e95);});},'afterUpdate':function(_0x54a76b,_0x2b4873,_0x50e12e){return _0x46b0c2[_0x258c('0x23')][_0x258c('0x25')]({'where':{'ChanSpyId':_0x54a76b['id']}})[_0x258c('0x22')](function(){return getChanSpyPromise(_0x46b0c2,_0x54a76b);})[_0x258c('0x22')](function(_0x19bdeb){if(_0x19bdeb&&_0x19bdeb[_0x258c('0x1a')]){return _0x46b0c2[_0x258c('0x23')][_0x258c('0x24')](_0x19bdeb);}})[_0x258c('0x22')](function(){_0x50e12e();})['catch'](function(_0x23f29b){_0x50e12e(_0x23f29b);});},'afterDestroy':function(_0x4d963a,_0x20bf9b,_0x89d4d2){return _0x46b0c2[_0x258c('0x23')][_0x258c('0x25')]({'where':{'ChanSpyId':_0x4d963a['id']}})['then'](function(){_0x89d4d2();})[_0x258c('0x1e')](function(_0x13f5cc){_0x89d4d2(_0x13f5cc);});}}});}; \ No newline at end of file +var _0x5042=['system','push','merge','Set','chanspy','MixMonitor','${UNIQUEID}.%s,a','Authenticate','password','name','options','join','record','StopMixMonitor','length','concat','internal','User','agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix'];(function(_0x971cc3,_0x5b8bce){var _0x2ce3f1=function(_0x532c9d){while(--_0x532c9d){_0x971cc3['push'](_0x971cc3['shift']());}};_0x2ce3f1(++_0x5b8bce);}(_0x5042,0x1c0));var _0x2504=function(_0x1af11f,_0x1ea9da){_0x1af11f=_0x1af11f-0x0;var _0x1a1b50=_0x5042[_0x1af11f];return _0x1a1b50;};'use strict';var _=require('lodash');var util=require(_0x2504('0x0'));var BPromise=require('bluebird');var attributes=require(_0x2504('0x1'));var getUserApplications=function(_0x36c8a4,_0x28661d,_0x54e367){var _0x298866=0x1;var _0x3b3347=[];var _0x224b2f={'context':_0x28661d[_0x2504('0x2')]||_0x2504('0x3'),'exten':util[_0x2504('0x4')](_0x2504('0x5'),_0x36c8a4[_0x2504('0x6')],_0x54e367),'type':_0x2504('0x7'),'isApp':![],'ChanSpyId':_0x36c8a4['id'],'UserId':_0x28661d['id']};_0x3b3347[_0x2504('0x8')](_[_0x2504('0x9')]({'app':_0x2504('0xa'),'appdata':util[_0x2504('0x4')]('CDR(type)=%s',_0x2504('0xb')),'priority':_0x298866++},_0x224b2f));if(_0x36c8a4['record']){_0x3b3347[_0x2504('0x8')](_[_0x2504('0x9')]({'app':_0x2504('0xc'),'appdata':util[_0x2504('0x4')](_0x2504('0xd'),_0x36c8a4['recordingFormat']),'priority':_0x298866++},_0x224b2f));}if(_0x36c8a4['auth']){_0x3b3347[_0x2504('0x8')](_['merge']({'app':_0x2504('0xe'),'appdata':_0x36c8a4[_0x2504('0xf')],'priority':_0x298866++},_0x224b2f));}_0x3b3347[_0x2504('0x8')](_[_0x2504('0x9')]({'app':'ChanSpy','appdata':util[_0x2504('0x4')]('SIP/%s,%s',_0x28661d[_0x2504('0x10')],_0x36c8a4[_0x2504('0x11')]?_0x36c8a4[_0x2504('0x11')][_0x2504('0x12')](''):''),'priority':_0x298866++},_0x224b2f));if(_0x36c8a4[_0x2504('0x13')]){_0x3b3347[_0x2504('0x8')](_[_0x2504('0x9')]({'app':_0x2504('0x14'),'priority':_0x298866++},_0x224b2f));}return _0x3b3347;};var getChanSpyApplications=function(_0xb6b9c7,_0xfb3a83){var _0x49157c=[];for(var _0x5a979f=0x0,_0x13f2e2=0x1;_0x5a979f<_0xfb3a83[_0x2504('0x15')];_0x5a979f++,_0x13f2e2=0x1){_0x49157c=_0x49157c[_0x2504('0x16')](getUserApplications(_0xb6b9c7,_0xfb3a83[_0x5a979f],_0xfb3a83[_0x5a979f][_0x2504('0x17')]));if(_0xfb3a83[_0x5a979f]['internal']!=_0xfb3a83[_0x5a979f][_0x2504('0x10')]){_0x49157c=_0x49157c[_0x2504('0x16')](getUserApplications(_0xb6b9c7,_0xfb3a83[_0x5a979f],_0xfb3a83[_0x5a979f][_0x2504('0x10')]));}}return _0x49157c;};var getChanSpyPromise=function(_0x562c6b,_0x621b66){return new BPromise(function(_0x130465,_0x338291){return _0x562c6b[_0x2504('0x18')]['findAll']({'attributes':['id',_0x2504('0x10'),'internal'],'where':{'role':_0x2504('0x19'),'chanspy':!![]},'raw':!![]})[_0x2504('0x1a')](function(_0x14636e){if(_0x14636e){return _0x130465(getChanSpyApplications(_0x621b66,_0x14636e));}return _0x130465([]);})[_0x2504('0x1b')](function(_0x3897a5){_0x338291(_0x3897a5);});});};module[_0x2504('0x1c')]=function(_0x196343,_0x482955){var _0x4be311=_0x196343['models'];return _0x196343[_0x2504('0x1d')](_0x2504('0x1e'),attributes,{'tableName':_0x2504('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x15053e,_0xf9ad9c,_0x49facc){return getChanSpyPromise(_0x4be311,_0x15053e)[_0x2504('0x1a')](function(_0x4b8067){if(_0x4b8067&&_0x4b8067[_0x2504('0x15')]){return _0x4be311[_0x2504('0x20')][_0x2504('0x21')](_0x4b8067);}})[_0x2504('0x1a')](function(){_0x49facc();})['catch'](function(_0x36a0ef){_0x49facc(_0x36a0ef);});},'afterUpdate':function(_0xee4751,_0x5a3aca,_0x331f69){return _0x4be311['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0xee4751['id']}})['then'](function(){return getChanSpyPromise(_0x4be311,_0xee4751);})[_0x2504('0x1a')](function(_0x25d72e){if(_0x25d72e&&_0x25d72e[_0x2504('0x15')]){return _0x4be311[_0x2504('0x20')][_0x2504('0x21')](_0x25d72e);}})[_0x2504('0x1a')](function(){_0x331f69();})[_0x2504('0x1b')](function(_0x53dd3b){_0x331f69(_0x53dd3b);});},'afterDestroy':function(_0x5db299,_0x432851,_0x3f8add){return _0x4be311[_0x2504('0x20')][_0x2504('0x22')]({'where':{'ChanSpyId':_0x5db299['id']}})['then'](function(){_0x3f8add();})[_0x2504('0x1b')](function(_0xb631a2){_0x3f8add(_0xb631a2);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 58f6731..ac26860 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 _0x263f=['client','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x290694,_0x281935){var _0x5a0f2e=function(_0x58d7d4){while(--_0x58d7d4){_0x290694['push'](_0x290694['shift']());}};_0x5a0f2e(++_0x281935);}(_0x263f,0x182));var _0xf263=function(_0x457c35,_0x284119){_0x457c35=_0x457c35-0x0;var _0x6a4733=_0x263f[_0x457c35];return _0x6a4733;};'use strict';var _=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var moment=require(_0xf263('0x2'));var BPromise=require(_0xf263('0x3'));var rs=require(_0xf263('0x4'));var fs=require('fs');var Redis=require(_0xf263('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf263('0x6'));var logger=require(_0xf263('0x7'))(_0xf263('0x8'));var config=require('../../config/environment');var jayson=require(_0xf263('0x9'));var client=jayson[_0xf263('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fded6,_0xa2b1b0,_0x9644ab){return new BPromise(function(_0xa2e77e,_0x16ff53){return client['request'](_0x4fded6,_0x9644ab)[_0xf263('0xb')](function(_0x26504c){logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));logger[_0xf263('0xf')](_0xf263('0x10'),_0xa2b1b0,'request\x20sent',JSON[_0xf263('0x11')](_0x26504c));if(_0x26504c['error']){if(_0x26504c[_0xf263('0x12')]['code']===0x1f4){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);return _0x16ff53(_0x26504c[_0xf263('0x12')][_0xf263('0x13')]);}logger[_0xf263('0x12')](_0xf263('0xd'),_0xa2b1b0,_0x26504c['error'][_0xf263('0x13')]);return _0xa2e77e(_0x26504c['error'][_0xf263('0x13')]);}else{logger[_0xf263('0xc')](_0xf263('0xd'),_0xa2b1b0,_0xf263('0xe'));_0xa2e77e(_0x26504c[_0xf263('0x14')][_0xf263('0x13')]);}})[_0xf263('0x15')](function(_0x57c655){logger['error'](_0xf263('0xd'),_0xa2b1b0,_0x57c655);_0x16ff53(_0x57c655);});});} \ No newline at end of file +var _0x049e=['then','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x2baca1,_0x2f3557){var _0x9aa62a=function(_0x5c47d5){while(--_0x5c47d5){_0x2baca1['push'](_0x2baca1['shift']());}};_0x9aa62a(++_0x2f3557);}(_0x049e,0x16a));var _0xe049=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0x049e[_0x5ad0d7];return _0xd83bd;};'use strict';var _=require(_0xe049('0x0'));var util=require(_0xe049('0x1'));var moment=require('moment');var BPromise=require(_0xe049('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe049('0x3'));var db=require(_0xe049('0x4'))['db'];var utils=require(_0xe049('0x5'));var logger=require(_0xe049('0x6'))(_0xe049('0x7'));var config=require('../../config/environment');var jayson=require(_0xe049('0x8'));var client=jayson[_0xe049('0x9')][_0xe049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x221a5f,_0x1d4fc6,_0x17945b){return new BPromise(function(_0x22abb2,_0x515823){return client[_0xe049('0xb')](_0x221a5f,_0x17945b)[_0xe049('0xc')](function(_0x6d04ed){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x1d4fc6,_0xe049('0xd'));logger[_0xe049('0xe')](_0xe049('0xf'),_0x1d4fc6,'request\x20sent',JSON['stringify'](_0x6d04ed));if(_0x6d04ed['error']){if(_0x6d04ed[_0xe049('0x10')][_0xe049('0x11')]===0x1f4){logger[_0xe049('0x10')](_0xe049('0x12'),_0x1d4fc6,_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);return _0x515823(_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);}logger['error'](_0xe049('0x12'),_0x1d4fc6,_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);return _0x22abb2(_0x6d04ed[_0xe049('0x10')]['message']);}else{logger[_0xe049('0x14')](_0xe049('0x12'),_0x1d4fc6,'request\x20sent');_0x22abb2(_0x6d04ed[_0xe049('0x15')][_0xe049('0x13')]);}})['catch'](function(_0x8b9bfe){logger[_0xe049('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x1d4fc6,_0x8b9bfe);_0x515823(_0x8b9bfe);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index b184d22..f9a4234 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 _0x407c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','delete','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x407c,0xdd));var _0xc407=function(_0x1379a2,_0x15525e){_0x1379a2=_0x1379a2-0x0;var _0x304ded=_0x407c[_0x1379a2];return _0x304ded;};'use strict';var multer=require(_0xc407('0x0'));var util=require(_0xc407('0x1'));var path=require(_0xc407('0x2'));var timeout=require(_0xc407('0x3'));var express=require(_0xc407('0x4'));var router=express[_0xc407('0x5')]();var fs_extra=require(_0xc407('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc407('0x7'));var config=require('../../config/environment');var controller=require(_0xc407('0x8'));router[_0xc407('0x9')]('/',auth[_0xc407('0xa')](),controller[_0xc407('0xb')]);router[_0xc407('0x9')](_0xc407('0xc'),auth[_0xc407('0xa')](),controller[_0xc407('0xd')]);router[_0xc407('0xe')]('/',auth[_0xc407('0xa')](),controller['create']);router['put'](_0xc407('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xc407('0xf')](_0xc407('0xc'),auth[_0xc407('0xa')](),controller['destroy']);module[_0xc407('0x10')]=router; \ No newline at end of file +var _0x1f85=['isAuthenticated','show','put','update','delete','/:id','destroy','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index'];(function(_0x2bce80,_0x1df713){var _0x235ce2=function(_0x588c23){while(--_0x588c23){_0x2bce80['push'](_0x2bce80['shift']());}};_0x235ce2(++_0x1df713);}(_0x1f85,0x77));var _0x51f8=function(_0x383143,_0x6cdee5){_0x383143=_0x383143-0x0;var _0x5a04d5=_0x1f85[_0x383143];return _0x5a04d5;};'use strict';var multer=require(_0x51f8('0x0'));var util=require(_0x51f8('0x1'));var path=require(_0x51f8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51f8('0x3'));var interaction=require(_0x51f8('0x4'));var config=require(_0x51f8('0x5'));var controller=require(_0x51f8('0x6'));router[_0x51f8('0x7')]('/',auth['isAuthenticated'](),controller[_0x51f8('0x8')]);router[_0x51f8('0x7')]('/:id',auth[_0x51f8('0x9')](),controller[_0x51f8('0xa')]);router['post']('/',auth[_0x51f8('0x9')](),controller['create']);router[_0x51f8('0xb')]('/:id',auth[_0x51f8('0x9')](),controller[_0x51f8('0xc')]);router[_0x51f8('0xd')](_0x51f8('0xe'),auth['isAuthenticated'](),controller[_0x51f8('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index cb01da7..ba93309 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 _0x322d=['exports','STRING','sequelize'];(function(_0x49bcb6,_0x59536c){var _0x4677bc=function(_0x28d5a9){while(--_0x28d5a9){_0x49bcb6['push'](_0x49bcb6['shift']());}};_0x4677bc(++_0x59536c);}(_0x322d,0xc2));var _0xd322=function(_0x2b8d9e,_0x38f52a){_0x2b8d9e=_0x2b8d9e-0x0;var _0x380e14=_0x322d[_0x2b8d9e];return _0x380e14;};'use strict';var Sequelize=require(_0xd322('0x0'));module[_0xd322('0x1')]={'name':{'type':Sequelize[_0xd322('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xd322('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1d9c=['name','STRING','BOOLEAN'];(function(_0x1ac4f1,_0x3aa8ad){var _0x359573=function(_0x33b54a){while(--_0x33b54a){_0x1ac4f1['push'](_0x1ac4f1['shift']());}};_0x359573(++_0x3aa8ad);}(_0x1d9c,0x171));var _0xc1d9=function(_0x247d01,_0x1851fb){_0x247d01=_0x247d01-0x0;var _0xf18e8=_0x1d9c[_0x247d01];return _0xf18e8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc1d9('0x0')},'description':{'type':Sequelize[_0xc1d9('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc1d9('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index beac3ae..b596283 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 _0x2ebe=['reject','update','destroy','UserProfileResource','stack','name','send','map','VoiceContext','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','merge','options','includeAll','include','findAll','rows','show','params','length','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','/etc/asterisk/extensions_xcally_contexts.conf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','undefined','limit','offset','count','set'];(function(_0x299bf3,_0x5c2955){var _0x13301e=function(_0x3fff22){while(--_0x3fff22){_0x299bf3['push'](_0x299bf3['shift']());}};_0x13301e(++_0x5c2955);}(_0x2ebe,0x174));var _0xe2eb=function(_0x378874,_0x4bfbf5){_0x378874=_0x378874-0x0;var _0xfe9bc4=_0x2ebe[_0x378874];return _0xfe9bc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2eb('0x0'));var zipdir=require(_0xe2eb('0x1'));var jsonpatch=require(_0xe2eb('0x2'));var rp=require(_0xe2eb('0x3'));var moment=require(_0xe2eb('0x4'));var BPromise=require(_0xe2eb('0x5'));var Mustache=require(_0xe2eb('0x6'));var util=require(_0xe2eb('0x7'));var path=require('path');var sox=require(_0xe2eb('0x8'));var csv=require(_0xe2eb('0x9'));var ejs=require(_0xe2eb('0xa'));var fs=require('fs');var fs_extra=require(_0xe2eb('0xb'));var _=require(_0xe2eb('0xc'));var squel=require('squel');var crypto=require(_0xe2eb('0xd'));var jsforce=require(_0xe2eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe2eb('0x9'));var querystring=require('querystring');var Papa=require(_0xe2eb('0xf'));var Redis=require(_0xe2eb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe2eb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe2eb('0x12'));var logger=require(_0xe2eb('0x13'))(_0xe2eb('0x14'));var utils=require('../../config/utils');var config=require(_0xe2eb('0x15'));var licenseUtil=require(_0xe2eb('0x16'));var db=require(_0xe2eb('0x17'))['db'];var jayson=require(_0xe2eb('0x18'));var client=jayson[_0xe2eb('0x19')][_0xe2eb('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x21054e,_0x5ca59e,_0x480156,_0x3ece71){return new BPromise(function(_0x21f182,_0x74cbc){var _0x6247eb=_0x3ece71||client;return _0x6247eb[_0xe2eb('0x1b')](_0x21054e,_0x480156)[_0xe2eb('0x1c')](function(_0x86af9b){logger[_0xe2eb('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x5ca59e,_0xe2eb('0x1e'));logger[_0xe2eb('0x1f')](_0xe2eb('0x20'),_0x5ca59e,_0xe2eb('0x1e'),JSON[_0xe2eb('0x21')](_0x86af9b));if(_0x86af9b['error']){if(_0x86af9b[_0xe2eb('0x22')][_0xe2eb('0x23')]===0x1f4){logger[_0xe2eb('0x22')](_0xe2eb('0x24'),_0x5ca59e,_0x86af9b[_0xe2eb('0x22')][_0xe2eb('0x25')]);return _0x74cbc(_0x86af9b[_0xe2eb('0x22')]['message']);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x5ca59e,_0x86af9b[_0xe2eb('0x22')]['message']);return _0x21f182(_0x86af9b[_0xe2eb('0x22')][_0xe2eb('0x25')]);}else{logger[_0xe2eb('0x1d')](_0xe2eb('0x24'),_0x5ca59e,_0xe2eb('0x1e'));_0x21f182(_0x86af9b['result'][_0xe2eb('0x25')]);}})[_0xe2eb('0x26')](function(_0x5b9cd5){logger['error'](_0xe2eb('0x24'),_0x5ca59e,_0x5b9cd5);_0x74cbc(_0x5b9cd5);});});}function respondWithStatusCode(_0x4435e2,_0x10560e){_0x10560e=_0x10560e||0xcc;return function(_0x502f96){if(_0x502f96){return _0x4435e2[_0xe2eb('0x27')](_0x10560e);}return _0x4435e2['status'](_0x10560e)[_0xe2eb('0x28')]();};}function respondWithResult(_0x4bbeb1,_0x3cfafd){_0x3cfafd=_0x3cfafd||0xc8;return function(_0x2fb6fb){if(_0x2fb6fb){return _0x4bbeb1[_0xe2eb('0x29')](_0x3cfafd)[_0xe2eb('0x2a')](_0x2fb6fb);}};}function respondWithFilteredResult(_0x37f0d8,_0x4c1827){return function(_0x16c5f7){if(_0x16c5f7){var _0x210453=typeof _0x4c1827['offset']===_0xe2eb('0x2b')&&typeof _0x4c1827[_0xe2eb('0x2c')]==='undefined';var _0x565d5f=_0x16c5f7['count'];var _0x561b91=_0x210453?0x0:_0x4c1827[_0xe2eb('0x2d')];var _0x192493=_0x210453?_0x16c5f7[_0xe2eb('0x2e')]:_0x4c1827[_0xe2eb('0x2d')]+_0x4c1827['limit'];var _0x282f31;if(_0x192493>=_0x565d5f){_0x192493=_0x565d5f;_0x282f31=0xc8;}else{_0x282f31=0xce;}_0x37f0d8[_0xe2eb('0x29')](_0x282f31);return _0x37f0d8[_0xe2eb('0x2f')]('Content-Range',_0x561b91+'-'+_0x192493+'/'+_0x565d5f)[_0xe2eb('0x2a')](_0x16c5f7);}return null;};}function patchUpdates(_0x298945){return function(_0xa0c3a5){try{jsonpatch['apply'](_0xa0c3a5,_0x298945,!![]);}catch(_0x3bba3b){return BPromise[_0xe2eb('0x30')](_0x3bba3b);}return _0xa0c3a5['save']();};}function saveUpdates(_0x219559,_0x279361){return function(_0x322170){if(_0x322170){return _0x322170[_0xe2eb('0x31')](_0x219559)[_0xe2eb('0x1c')](function(_0x46e234){return _0x46e234;});}return null;};}function removeEntity(_0xb1d298,_0x5cbf8d){return function(_0x11ec01){if(_0x11ec01){return _0x11ec01[_0xe2eb('0x32')]()[_0xe2eb('0x1c')](function(){var _0x2b21ab=_0x11ec01['get']({'plain':!![]});var _0x26e89d='Contexts';return db[_0xe2eb('0x33')]['destroy']({'where':{'type':_0x26e89d,'resourceId':_0x2b21ab['id']}})[_0xe2eb('0x1c')](function(){return _0x11ec01;});})[_0xe2eb('0x1c')](function(){_0xb1d298[_0xe2eb('0x29')](0xcc)[_0xe2eb('0x28')]();});}};}function handleEntityNotFound(_0x5759f8,_0x350234){return function(_0x2b0ff8){if(!_0x2b0ff8){_0x5759f8[_0xe2eb('0x27')](0x194);}return _0x2b0ff8;};}function handleError(_0x3fba90,_0x3416c6){_0x3416c6=_0x3416c6||0x1f4;return function(_0x2412ce){logger['error'](_0x2412ce[_0xe2eb('0x34')]);if(_0x2412ce[_0xe2eb('0x35')]){delete _0x2412ce[_0xe2eb('0x35')];}_0x3fba90['status'](_0x3416c6)[_0xe2eb('0x36')](_0x2412ce);};}exports['index']=function(_0x59b51d,_0x417d06){var _0x4b691b={},_0x1b7fcf={},_0x1c4351={'count':0x0,'rows':[]};var _0x414107=_[_0xe2eb('0x37')](db[_0xe2eb('0x38')][_0xe2eb('0x39')],function(_0x1bae11){return{'name':_0x1bae11[_0xe2eb('0x3a')],'type':_0x1bae11['type'][_0xe2eb('0x3b')]};});_0x1b7fcf[_0xe2eb('0x3c')]=_['map'](_0x414107,_0xe2eb('0x35'));_0x1b7fcf[_0xe2eb('0x3d')]=_[_0xe2eb('0x3e')](_0x59b51d[_0xe2eb('0x3d')]);_0x1b7fcf[_0xe2eb('0x3f')]=_[_0xe2eb('0x40')](_0x1b7fcf[_0xe2eb('0x3c')],_0x1b7fcf[_0xe2eb('0x3d')]);_0x4b691b[_0xe2eb('0x41')]=_['intersection'](_0x1b7fcf[_0xe2eb('0x3c')],qs[_0xe2eb('0x42')](_0x59b51d['query']['fields']));_0x4b691b['attributes']=_0x4b691b[_0xe2eb('0x41')]['length']?_0x4b691b['attributes']:_0x1b7fcf[_0xe2eb('0x3c')];if(!_0x59b51d[_0xe2eb('0x3d')][_0xe2eb('0x43')](_0xe2eb('0x44'))){_0x4b691b[_0xe2eb('0x2c')]=qs['limit'](_0x59b51d['query']['limit']);_0x4b691b[_0xe2eb('0x2d')]=qs[_0xe2eb('0x2d')](_0x59b51d['query'][_0xe2eb('0x2d')]);}_0x4b691b[_0xe2eb('0x45')]=qs[_0xe2eb('0x46')](_0x59b51d[_0xe2eb('0x3d')]['sort']);_0x4b691b[_0xe2eb('0x47')]=qs[_0xe2eb('0x3f')](_[_0xe2eb('0x48')](_0x59b51d[_0xe2eb('0x3d')],_0x1b7fcf[_0xe2eb('0x3f')]),_0x414107);if(_0x59b51d['query']['filter']){_0x4b691b[_0xe2eb('0x47')]=_['merge'](_0x4b691b[_0xe2eb('0x47')],{'$or':_['map'](_0x414107,function(_0x3dc890){if(_0x3dc890[_0xe2eb('0x49')]!=='VIRTUAL'){var _0x202a0d={};_0x202a0d[_0x3dc890[_0xe2eb('0x35')]]={'$like':'%'+_0x59b51d[_0xe2eb('0x3d')]['filter']+'%'};return _0x202a0d;}})});}_0x4b691b=_[_0xe2eb('0x4a')]({},_0x4b691b,_0x59b51d[_0xe2eb('0x4b')]);var _0x314927={'where':_0x4b691b[_0xe2eb('0x47')]};return db[_0xe2eb('0x38')]['count'](_0x314927)['then'](function(_0x3b729b){_0x1c4351[_0xe2eb('0x2e')]=_0x3b729b;if(_0x59b51d[_0xe2eb('0x3d')][_0xe2eb('0x4c')]){_0x4b691b[_0xe2eb('0x4d')]=[{'all':!![]}];}return db[_0xe2eb('0x38')][_0xe2eb('0x4e')](_0x4b691b);})[_0xe2eb('0x1c')](function(_0x2615c3){_0x1c4351[_0xe2eb('0x4f')]=_0x2615c3;return _0x1c4351;})[_0xe2eb('0x1c')](respondWithFilteredResult(_0x417d06,_0x4b691b))[_0xe2eb('0x26')](handleError(_0x417d06,null));};exports[_0xe2eb('0x50')]=function(_0x4c651b,_0x4f316b){var _0x1ff98e={'raw':![],'where':{'id':_0x4c651b[_0xe2eb('0x51')]['id']}},_0x25896f={};_0x25896f['model']=_[_0xe2eb('0x3e')](db['VoiceContext'][_0xe2eb('0x39')]);_0x25896f[_0xe2eb('0x3d')]=_[_0xe2eb('0x3e')](_0x4c651b[_0xe2eb('0x3d')]);_0x25896f[_0xe2eb('0x3f')]=_['intersection'](_0x25896f[_0xe2eb('0x3c')],_0x25896f['query']);_0x1ff98e[_0xe2eb('0x41')]=_[_0xe2eb('0x40')](_0x25896f[_0xe2eb('0x3c')],qs['fields'](_0x4c651b[_0xe2eb('0x3d')]['fields']));_0x1ff98e[_0xe2eb('0x41')]=_0x1ff98e[_0xe2eb('0x41')][_0xe2eb('0x52')]?_0x1ff98e['attributes']:_0x25896f[_0xe2eb('0x3c')];if(_0x4c651b[_0xe2eb('0x3d')][_0xe2eb('0x4c')]){_0x1ff98e[_0xe2eb('0x4d')]=[{'all':!![]}];}_0x1ff98e=_[_0xe2eb('0x4a')]({},_0x1ff98e,_0x4c651b[_0xe2eb('0x4b')]);return db[_0xe2eb('0x38')][_0xe2eb('0x53')](_0x1ff98e)[_0xe2eb('0x1c')](handleEntityNotFound(_0x4f316b,null))[_0xe2eb('0x1c')](respondWithResult(_0x4f316b,null))[_0xe2eb('0x26')](handleError(_0x4f316b,null));};exports[_0xe2eb('0x54')]=function(_0x24d1f7,_0x3fbb58,_0x3a373c){var _0x5a4bf0;return db[_0xe2eb('0x38')][_0xe2eb('0x54')](_0x24d1f7['body'],{'raw':!![]})['then'](function(_0x34158c){_0x5a4bf0=_0x34158c;return db[_0xe2eb('0x38')]['findAll']({'raw':!![]});})[_0xe2eb('0x1c')](function(_0x2b4b80){var _0xbde0a5=fs[_0xe2eb('0x55')](path[_0xe2eb('0x56')](config[_0xe2eb('0x57')],_0xe2eb('0x58')),_0xe2eb('0x59'));var _0xe89e5=ejs[_0xe2eb('0x5a')](_0xbde0a5,{'contexts':_0x2b4b80||[]});fs[_0xe2eb('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xe89e5);})[_0xe2eb('0x1c')](function(){return respondWithRpcPromise(_0xe2eb('0x5c'),_0xe2eb('0x54'),{'module':_0xe2eb('0x5d')});})[_0xe2eb('0x1c')](function(){var _0x3d746f=_0x24d1f7[_0xe2eb('0x5e')][_0xe2eb('0x5f')]({'plain':!![]});if(!_0x3d746f)throw new Error(_0xe2eb('0x60'));if(_0x3d746f[_0xe2eb('0x61')]===_0xe2eb('0x5e')){var _0xa0bca3=_0x5a4bf0[_0xe2eb('0x5f')]({'plain':!![]});return db[_0xe2eb('0x62')][_0xe2eb('0x53')]({'where':{'name':_0xe2eb('0x63'),'userProfileId':_0x3d746f[_0xe2eb('0x64')]},'raw':!![]})[_0xe2eb('0x1c')](function(_0x2abc8f){if(_0x2abc8f&&_0x2abc8f[_0xe2eb('0x65')]===0x0){return db[_0xe2eb('0x33')][_0xe2eb('0x54')]({'name':_0xa0bca3[_0xe2eb('0x35')],'resourceId':_0xa0bca3['id'],'type':_0x2abc8f[_0xe2eb('0x35')],'sectionId':_0x2abc8f['id']},{})[_0xe2eb('0x1c')](function(){return _0x5a4bf0;});}else{return _0x5a4bf0;}})['catch'](function(_0x594e81){logger['error'](_0xe2eb('0x66'),_0x594e81);throw _0x594e81;});}return _0x5a4bf0;})['then'](respondWithResult(_0x3fbb58,0xc9))[_0xe2eb('0x26')](handleError(_0x3fbb58,null));};exports[_0xe2eb('0x31')]=function(_0x48da52,_0x18073d,_0x857d8e){var _0x1a57fd;return db[_0xe2eb('0x38')][_0xe2eb('0x53')]({'where':{'id':_0x48da52['params']['id']}})[_0xe2eb('0x1c')](handleEntityNotFound(_0x18073d,null))[_0xe2eb('0x1c')](saveUpdates(_0x48da52[_0xe2eb('0x67')],null))[_0xe2eb('0x1c')](function(_0x4f4d23){if(_0x4f4d23){_0x1a57fd=_0x4f4d23;return db[_0xe2eb('0x38')][_0xe2eb('0x4e')]({'raw':!![]});}})[_0xe2eb('0x1c')](function(_0x1b11ac){var _0x24d75d=fs[_0xe2eb('0x55')](path[_0xe2eb('0x56')](config[_0xe2eb('0x57')],_0xe2eb('0x58')),_0xe2eb('0x59'));var _0x22ad67=ejs[_0xe2eb('0x5a')](_0x24d75d,{'contexts':_0x1b11ac||[]});fs['writeFileSync'](_0xe2eb('0x68'),_0x22ad67);})[_0xe2eb('0x1c')](function(){return respondWithRpcPromise(_0xe2eb('0x5c'),_0xe2eb('0x31'),{'module':_0xe2eb('0x5d')});})[_0xe2eb('0x1c')](function(){return _0x1a57fd;})[_0xe2eb('0x1c')](respondWithResult(_0x18073d,null))['catch'](handleError(_0x18073d,null));};exports[_0xe2eb('0x32')]=function(_0x4e3f52,_0x1c864e,_0x513dee){var _0x1890b8;return db[_0xe2eb('0x38')][_0xe2eb('0x53')]({'where':{'id':_0x4e3f52[_0xe2eb('0x51')]['id']}})['then'](handleEntityNotFound(_0x1c864e,null))[_0xe2eb('0x1c')](removeEntity(_0x1c864e,null))['then'](function(){return db[_0xe2eb('0x38')][_0xe2eb('0x4e')]({'raw':!![]});})[_0xe2eb('0x1c')](function(_0x432800){var _0x599967=fs[_0xe2eb('0x55')](path[_0xe2eb('0x56')](config[_0xe2eb('0x57')],'server/files/templates/context.ejs'),'utf8');var _0x2387b0=ejs[_0xe2eb('0x5a')](_0x599967,{'contexts':_0x432800});fs[_0xe2eb('0x5b')](_0xe2eb('0x68'),_0x2387b0);return respondWithRpcPromise('Reload',_0xe2eb('0x32'),{'module':_0xe2eb('0x5d')});})['catch'](handleError(_0x1c864e,null));}; \ No newline at end of file +var _0x244b=['keys','length','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Contexts','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params'];(function(_0x583fb9,_0x2fa17a){var _0x50c8f8=function(_0x3fb618){while(--_0x3fb618){_0x583fb9['push'](_0x583fb9['shift']());}};_0x50c8f8(++_0x2fa17a);}(_0x244b,0x1bb));var _0xb244=function(_0x56526a,_0x3e8a46){_0x56526a=_0x56526a-0x0;var _0x4bb94d=_0x244b[_0x56526a];return _0x4bb94d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb244('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb244('0x1'));var moment=require(_0xb244('0x2'));var BPromise=require(_0xb244('0x3'));var Mustache=require(_0xb244('0x4'));var util=require(_0xb244('0x5'));var path=require('path');var sox=require(_0xb244('0x6'));var csv=require(_0xb244('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb244('0x8'));var _=require('lodash');var squel=require(_0xb244('0x9'));var crypto=require(_0xb244('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb244('0xb'));var toCsv=require(_0xb244('0x7'));var querystring=require(_0xb244('0xc'));var Papa=require(_0xb244('0xd'));var Redis=require(_0xb244('0xe'));var authService=require(_0xb244('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb244('0x10'))(_0xb244('0x11'));var utils=require(_0xb244('0x12'));var config=require(_0xb244('0x13'));var licenseUtil=require(_0xb244('0x14'));var db=require(_0xb244('0x15'))['db'];var jayson=require(_0xb244('0x16'));var client=jayson[_0xb244('0x17')][_0xb244('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1cd6e1,_0x34442c,_0x59bd7b,_0x34c5e4){return new BPromise(function(_0x367aba,_0x24deb5){var _0x2d86f0=_0x34c5e4||client;return _0x2d86f0['request'](_0x1cd6e1,_0x59bd7b)['then'](function(_0x3bbaba){logger[_0xb244('0x19')](_0xb244('0x1a'),_0x34442c,_0xb244('0x1b'));logger[_0xb244('0x1c')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x34442c,_0xb244('0x1b'),JSON[_0xb244('0x1d')](_0x3bbaba));if(_0x3bbaba[_0xb244('0x1e')]){if(_0x3bbaba['error']['code']===0x1f4){logger['error'](_0xb244('0x1a'),_0x34442c,_0x3bbaba['error'][_0xb244('0x1f')]);return _0x24deb5(_0x3bbaba[_0xb244('0x1e')][_0xb244('0x1f')]);}logger[_0xb244('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x34442c,_0x3bbaba[_0xb244('0x1e')][_0xb244('0x1f')]);return _0x367aba(_0x3bbaba[_0xb244('0x1e')][_0xb244('0x1f')]);}else{logger[_0xb244('0x19')]('VoiceContext,\x20%s,\x20%s',_0x34442c,_0xb244('0x1b'));_0x367aba(_0x3bbaba[_0xb244('0x20')][_0xb244('0x1f')]);}})[_0xb244('0x21')](function(_0x1225c8){logger[_0xb244('0x1e')](_0xb244('0x1a'),_0x34442c,_0x1225c8);_0x24deb5(_0x1225c8);});});}function respondWithStatusCode(_0x252f58,_0x330e7a){_0x330e7a=_0x330e7a||0xcc;return function(_0x17da66){if(_0x17da66){return _0x252f58[_0xb244('0x22')](_0x330e7a);}return _0x252f58['status'](_0x330e7a)[_0xb244('0x23')]();};}function respondWithResult(_0x435e34,_0x14caa1){_0x14caa1=_0x14caa1||0xc8;return function(_0x3829bd){if(_0x3829bd){return _0x435e34[_0xb244('0x24')](_0x14caa1)[_0xb244('0x25')](_0x3829bd);}};}function respondWithFilteredResult(_0x397026,_0x18e327){return function(_0x42d27b){if(_0x42d27b){var _0x48ee32=typeof _0x18e327[_0xb244('0x26')]===_0xb244('0x27')&&typeof _0x18e327[_0xb244('0x28')]===_0xb244('0x27');var _0x5cae49=_0x42d27b[_0xb244('0x29')];var _0x15e6b8=_0x48ee32?0x0:_0x18e327['offset'];var _0x3a4fed=_0x48ee32?_0x42d27b['count']:_0x18e327[_0xb244('0x26')]+_0x18e327['limit'];var _0x43f1a6;if(_0x3a4fed>=_0x5cae49){_0x3a4fed=_0x5cae49;_0x43f1a6=0xc8;}else{_0x43f1a6=0xce;}_0x397026['status'](_0x43f1a6);return _0x397026[_0xb244('0x2a')](_0xb244('0x2b'),_0x15e6b8+'-'+_0x3a4fed+'/'+_0x5cae49)[_0xb244('0x25')](_0x42d27b);}return null;};}function patchUpdates(_0x1fb524){return function(_0x4f180b){try{jsonpatch[_0xb244('0x2c')](_0x4f180b,_0x1fb524,!![]);}catch(_0x11ca83){return BPromise[_0xb244('0x2d')](_0x11ca83);}return _0x4f180b[_0xb244('0x2e')]();};}function saveUpdates(_0x2b7f9c,_0x7287e3){return function(_0x58e499){if(_0x58e499){return _0x58e499[_0xb244('0x2f')](_0x2b7f9c)[_0xb244('0x30')](function(_0x341676){return _0x341676;});}return null;};}function removeEntity(_0x4c500d,_0x54224d){return function(_0xceea0a){if(_0xceea0a){return _0xceea0a[_0xb244('0x31')]()[_0xb244('0x30')](function(){var _0x308ade=_0xceea0a[_0xb244('0x32')]({'plain':!![]});var _0x225c2b=_0xb244('0x33');return db['UserProfileResource'][_0xb244('0x31')]({'where':{'type':_0x225c2b,'resourceId':_0x308ade['id']}})[_0xb244('0x30')](function(){return _0xceea0a;});})[_0xb244('0x30')](function(){_0x4c500d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5111fe,_0x2545fc){return function(_0xb6761){if(!_0xb6761){_0x5111fe['sendStatus'](0x194);}return _0xb6761;};}function handleError(_0x1d81c5,_0xef8e91){_0xef8e91=_0xef8e91||0x1f4;return function(_0x2953ba){logger[_0xb244('0x1e')](_0x2953ba[_0xb244('0x34')]);if(_0x2953ba['name']){delete _0x2953ba[_0xb244('0x35')];}_0x1d81c5[_0xb244('0x24')](_0xef8e91)[_0xb244('0x36')](_0x2953ba);};}exports[_0xb244('0x37')]=function(_0x1efc61,_0x2a0bd0){var _0x5748f3={},_0x33acba={},_0xd39cae={'count':0x0,'rows':[]};var _0x2d26da=_[_0xb244('0x38')](db[_0xb244('0x39')][_0xb244('0x3a')],function(_0x5503cc){return{'name':_0x5503cc[_0xb244('0x3b')],'type':_0x5503cc[_0xb244('0x3c')][_0xb244('0x3d')]};});_0x33acba[_0xb244('0x3e')]=_[_0xb244('0x38')](_0x2d26da,_0xb244('0x35'));_0x33acba[_0xb244('0x3f')]=_['keys'](_0x1efc61['query']);_0x33acba[_0xb244('0x40')]=_['intersection'](_0x33acba[_0xb244('0x3e')],_0x33acba[_0xb244('0x3f')]);_0x5748f3[_0xb244('0x41')]=_[_0xb244('0x42')](_0x33acba[_0xb244('0x3e')],qs['fields'](_0x1efc61[_0xb244('0x3f')][_0xb244('0x43')]));_0x5748f3['attributes']=_0x5748f3[_0xb244('0x41')]['length']?_0x5748f3[_0xb244('0x41')]:_0x33acba['model'];if(!_0x1efc61[_0xb244('0x3f')][_0xb244('0x44')]('nolimit')){_0x5748f3[_0xb244('0x28')]=qs[_0xb244('0x28')](_0x1efc61[_0xb244('0x3f')]['limit']);_0x5748f3['offset']=qs[_0xb244('0x26')](_0x1efc61[_0xb244('0x3f')]['offset']);}_0x5748f3[_0xb244('0x45')]=qs['sort'](_0x1efc61[_0xb244('0x3f')]['sort']);_0x5748f3[_0xb244('0x46')]=qs[_0xb244('0x40')](_[_0xb244('0x47')](_0x1efc61[_0xb244('0x3f')],_0x33acba[_0xb244('0x40')]),_0x2d26da);if(_0x1efc61[_0xb244('0x3f')][_0xb244('0x48')]){_0x5748f3['where']=_[_0xb244('0x49')](_0x5748f3['where'],{'$or':_[_0xb244('0x38')](_0x2d26da,function(_0x4db10d){if(_0x4db10d[_0xb244('0x3c')]!==_0xb244('0x4a')){var _0xa6ab81={};_0xa6ab81[_0x4db10d[_0xb244('0x35')]]={'$like':'%'+_0x1efc61[_0xb244('0x3f')][_0xb244('0x48')]+'%'};return _0xa6ab81;}})});}_0x5748f3=_[_0xb244('0x49')]({},_0x5748f3,_0x1efc61[_0xb244('0x4b')]);var _0x188603={'where':_0x5748f3[_0xb244('0x46')]};return db['VoiceContext'][_0xb244('0x29')](_0x188603)[_0xb244('0x30')](function(_0x130d69){_0xd39cae[_0xb244('0x29')]=_0x130d69;if(_0x1efc61['query'][_0xb244('0x4c')]){_0x5748f3[_0xb244('0x4d')]=[{'all':!![]}];}return db[_0xb244('0x39')][_0xb244('0x4e')](_0x5748f3);})[_0xb244('0x30')](function(_0x2d5b22){_0xd39cae[_0xb244('0x4f')]=_0x2d5b22;return _0xd39cae;})[_0xb244('0x30')](respondWithFilteredResult(_0x2a0bd0,_0x5748f3))[_0xb244('0x21')](handleError(_0x2a0bd0,null));};exports[_0xb244('0x50')]=function(_0x4d477d,_0x4964b1){var _0x461534={'raw':![],'where':{'id':_0x4d477d[_0xb244('0x51')]['id']}},_0x3a6b2b={};_0x3a6b2b[_0xb244('0x3e')]=_[_0xb244('0x52')](db[_0xb244('0x39')]['rawAttributes']);_0x3a6b2b[_0xb244('0x3f')]=_[_0xb244('0x52')](_0x4d477d[_0xb244('0x3f')]);_0x3a6b2b[_0xb244('0x40')]=_['intersection'](_0x3a6b2b[_0xb244('0x3e')],_0x3a6b2b[_0xb244('0x3f')]);_0x461534[_0xb244('0x41')]=_[_0xb244('0x42')](_0x3a6b2b[_0xb244('0x3e')],qs[_0xb244('0x43')](_0x4d477d[_0xb244('0x3f')]['fields']));_0x461534[_0xb244('0x41')]=_0x461534['attributes'][_0xb244('0x53')]?_0x461534[_0xb244('0x41')]:_0x3a6b2b[_0xb244('0x3e')];if(_0x4d477d[_0xb244('0x3f')][_0xb244('0x4c')]){_0x461534['include']=[{'all':!![]}];}_0x461534=_[_0xb244('0x49')]({},_0x461534,_0x4d477d['options']);return db['VoiceContext'][_0xb244('0x54')](_0x461534)[_0xb244('0x30')](handleEntityNotFound(_0x4964b1,null))[_0xb244('0x30')](respondWithResult(_0x4964b1,null))[_0xb244('0x21')](handleError(_0x4964b1,null));};exports[_0xb244('0x55')]=function(_0x45e17b,_0x2783c4,_0x32365e){var _0x230f9e;return db[_0xb244('0x39')][_0xb244('0x55')](_0x45e17b[_0xb244('0x56')],{'raw':!![]})[_0xb244('0x30')](function(_0x1504df){_0x230f9e=_0x1504df;return db[_0xb244('0x39')][_0xb244('0x4e')]({'raw':!![]});})['then'](function(_0x211ea0){var _0xf30c40=fs[_0xb244('0x57')](path[_0xb244('0x58')](config[_0xb244('0x59')],_0xb244('0x5a')),_0xb244('0x5b'));var _0x29f114=ejs[_0xb244('0x5c')](_0xf30c40,{'contexts':_0x211ea0||[]});fs[_0xb244('0x5d')](_0xb244('0x5e'),_0x29f114);})[_0xb244('0x30')](function(){return respondWithRpcPromise('Reload',_0xb244('0x55'),{'module':_0xb244('0x5f')});})[_0xb244('0x30')](function(){var _0x160368=_0x45e17b['user'][_0xb244('0x32')]({'plain':!![]});if(!_0x160368)throw new Error(_0xb244('0x60'));if(_0x160368[_0xb244('0x61')]===_0xb244('0x62')){var _0x2dccf2=_0x230f9e[_0xb244('0x32')]({'plain':!![]});return db[_0xb244('0x63')]['find']({'where':{'name':_0xb244('0x33'),'userProfileId':_0x160368[_0xb244('0x64')]},'raw':!![]})[_0xb244('0x30')](function(_0x1099ea){if(_0x1099ea&&_0x1099ea[_0xb244('0x65')]===0x0){return db[_0xb244('0x66')][_0xb244('0x55')]({'name':_0x2dccf2[_0xb244('0x35')],'resourceId':_0x2dccf2['id'],'type':_0x1099ea[_0xb244('0x35')],'sectionId':_0x1099ea['id']},{})['then'](function(){return _0x230f9e;});}else{return _0x230f9e;}})['catch'](function(_0x27e1de){logger[_0xb244('0x1e')](_0xb244('0x67'),_0x27e1de);throw _0x27e1de;});}return _0x230f9e;})[_0xb244('0x30')](respondWithResult(_0x2783c4,0xc9))[_0xb244('0x21')](handleError(_0x2783c4,null));};exports[_0xb244('0x2f')]=function(_0x1d6021,_0x3906a2,_0x4cfa1c){var _0x233268;return db[_0xb244('0x39')]['find']({'where':{'id':_0x1d6021[_0xb244('0x51')]['id']}})[_0xb244('0x30')](handleEntityNotFound(_0x3906a2,null))[_0xb244('0x30')](saveUpdates(_0x1d6021[_0xb244('0x56')],null))[_0xb244('0x30')](function(_0x5c4af6){if(_0x5c4af6){_0x233268=_0x5c4af6;return db[_0xb244('0x39')][_0xb244('0x4e')]({'raw':!![]});}})[_0xb244('0x30')](function(_0x50cdae){var _0x3363a9=fs[_0xb244('0x57')](path[_0xb244('0x58')](config['root'],_0xb244('0x5a')),_0xb244('0x5b'));var _0x5f1227=ejs[_0xb244('0x5c')](_0x3363a9,{'contexts':_0x50cdae||[]});fs['writeFileSync'](_0xb244('0x5e'),_0x5f1227);})[_0xb244('0x30')](function(){return respondWithRpcPromise(_0xb244('0x68'),_0xb244('0x2f'),{'module':_0xb244('0x5f')});})[_0xb244('0x30')](function(){return _0x233268;})[_0xb244('0x30')](respondWithResult(_0x3906a2,null))[_0xb244('0x21')](handleError(_0x3906a2,null));};exports[_0xb244('0x31')]=function(_0x2781f8,_0x1d1c66,_0x56d047){var _0x5882a7;return db[_0xb244('0x39')]['find']({'where':{'id':_0x2781f8[_0xb244('0x51')]['id']}})[_0xb244('0x30')](handleEntityNotFound(_0x1d1c66,null))['then'](removeEntity(_0x1d1c66,null))[_0xb244('0x30')](function(){return db[_0xb244('0x39')][_0xb244('0x4e')]({'raw':!![]});})['then'](function(_0x5f3cc4){var _0x4eaeb7=fs[_0xb244('0x57')](path['join'](config['root'],_0xb244('0x5a')),'utf8');var _0x2e31dd=ejs[_0xb244('0x5c')](_0x4eaeb7,{'contexts':_0x5f3cc4});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x2e31dd);return respondWithRpcPromise(_0xb244('0x68'),_0xb244('0x31'),{'module':_0xb244('0x5f')});})[_0xb244('0x21')](handleError(_0x1d1c66,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 7f6b877..70b5450 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 _0xf7b4=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts'];(function(_0x5efe72,_0x2e9777){var _0x831761=function(_0x6dc433){while(--_0x6dc433){_0x5efe72['push'](_0x5efe72['shift']());}};_0x831761(++_0x2e9777);}(_0xf7b4,0x12c));var _0x4f7b=function(_0x53efa4,_0x1e673b){_0x53efa4=_0x53efa4-0x0;var _0x276274=_0xf7b4[_0x53efa4];return _0x276274;};'use strict';var _=require(_0x4f7b('0x0'));var util=require(_0x4f7b('0x1'));var logger=require(_0x4f7b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4f7b('0x3'));var rp=require(_0x4f7b('0x4'));var fs=require('fs');var path=require(_0x4f7b('0x5'));var rimraf=require(_0x4f7b('0x6'));var config=require(_0x4f7b('0x7'));var attributes=require(_0x4f7b('0x8'));module[_0x4f7b('0x9')]=function(_0x273691,_0x303f67){return _0x273691['define'](_0x4f7b('0xa'),attributes,{'tableName':_0x4f7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f7c=['rimraf','../../config/environment','./voiceContext.attributes','exports','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4ad5e0,_0x454696){var _0x7fece7=function(_0x148aa2){while(--_0x148aa2){_0x4ad5e0['push'](_0x4ad5e0['shift']());}};_0x7fece7(++_0x454696);}(_0x4f7c,0x185));var _0xc4f7=function(_0x281303,_0x1a337f){_0x281303=_0x281303-0x0;var _0x32b93f=_0x4f7c[_0x281303];return _0x32b93f;};'use strict';var _=require('lodash');var util=require(_0xc4f7('0x0'));var logger=require(_0xc4f7('0x1'))(_0xc4f7('0x2'));var moment=require(_0xc4f7('0x3'));var BPromise=require(_0xc4f7('0x4'));var rp=require(_0xc4f7('0x5'));var fs=require('fs');var path=require(_0xc4f7('0x6'));var rimraf=require(_0xc4f7('0x7'));var config=require(_0xc4f7('0x8'));var attributes=require(_0xc4f7('0x9'));module[_0xc4f7('0xa')]=function(_0x593986,_0x3b61d3){return _0x593986['define']('VoiceContext',attributes,{'tableName':'voice_contexts','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 e34750b..077838c 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 _0xc48e=['VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xc48e,0xd7));var _0xec48=function(_0x4cf219,_0x9f5d35){_0x4cf219=_0x4cf219-0x0;var _0x188dd4=_0xc48e[_0x4cf219];return _0x188dd4;};'use strict';var _=require(_0xec48('0x0'));var util=require('util');var moment=require(_0xec48('0x1'));var BPromise=require('bluebird');var rs=require(_0xec48('0x2'));var fs=require('fs');var Redis=require(_0xec48('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec48('0x4'))(_0xec48('0x5'));var config=require(_0xec48('0x6'));var jayson=require(_0xec48('0x7'));var client=jayson[_0xec48('0x8')][_0xec48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e709e,_0x4f9a3b,_0x7e6ff7){return new BPromise(function(_0xa405a4,_0x391939){return client[_0xec48('0xa')](_0x5e709e,_0x7e6ff7)[_0xec48('0xb')](function(_0x3d869b){logger[_0xec48('0xc')](_0xec48('0xd'),_0x4f9a3b,_0xec48('0xe'));logger[_0xec48('0xf')](_0xec48('0x10'),_0x4f9a3b,'request\x20sent',JSON[_0xec48('0x11')](_0x3d869b));if(_0x3d869b[_0xec48('0x12')]){if(_0x3d869b[_0xec48('0x12')]['code']===0x1f4){logger[_0xec48('0x12')]('VoiceContext,\x20%s,\x20%s',_0x4f9a3b,_0x3d869b['error'][_0xec48('0x13')]);return _0x391939(_0x3d869b[_0xec48('0x12')][_0xec48('0x13')]);}logger[_0xec48('0x12')](_0xec48('0xd'),_0x4f9a3b,_0x3d869b[_0xec48('0x12')]['message']);return _0xa405a4(_0x3d869b[_0xec48('0x12')][_0xec48('0x13')]);}else{logger[_0xec48('0xc')](_0xec48('0xd'),_0x4f9a3b,'request\x20sent');_0xa405a4(_0x3d869b[_0xec48('0x14')]['message']);}})['catch'](function(_0x154876){logger[_0xec48('0x12')](_0xec48('0xd'),_0x4f9a3b,_0x154876);_0x391939(_0x154876);});});} \ No newline at end of file +var _0x7bf2=['../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x42001c,_0x22f5b4){var _0x16bc18=function(_0x263e8d){while(--_0x263e8d){_0x42001c['push'](_0x42001c['shift']());}};_0x16bc18(++_0x22f5b4);}(_0x7bf2,0xc8));var _0x27bf=function(_0x595a2d,_0x2ad01e){_0x595a2d=_0x595a2d-0x0;var _0xe5a375=_0x7bf2[_0x595a2d];return _0xe5a375;};'use strict';var _=require(_0x27bf('0x0'));var util=require(_0x27bf('0x1'));var moment=require('moment');var BPromise=require(_0x27bf('0x2'));var rs=require(_0x27bf('0x3'));var fs=require('fs');var Redis=require(_0x27bf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x27bf('0x5'));var logger=require('../../config/logger')(_0x27bf('0x6'));var config=require(_0x27bf('0x7'));var jayson=require(_0x27bf('0x8'));var client=jayson[_0x27bf('0x9')][_0x27bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x374acd,_0x2b48a7,_0x331a61){return new BPromise(function(_0x3ecf8e,_0x2f7254){return client[_0x27bf('0xb')](_0x374acd,_0x331a61)['then'](function(_0x4a5636){logger[_0x27bf('0xc')](_0x27bf('0xd'),_0x2b48a7,_0x27bf('0xe'));logger[_0x27bf('0xf')](_0x27bf('0x10'),_0x2b48a7,'request\x20sent',JSON[_0x27bf('0x11')](_0x4a5636));if(_0x4a5636[_0x27bf('0x12')]){if(_0x4a5636[_0x27bf('0x12')][_0x27bf('0x13')]===0x1f4){logger[_0x27bf('0x12')](_0x27bf('0xd'),_0x2b48a7,_0x4a5636['error'][_0x27bf('0x14')]);return _0x2f7254(_0x4a5636[_0x27bf('0x12')][_0x27bf('0x14')]);}logger['error'](_0x27bf('0xd'),_0x2b48a7,_0x4a5636[_0x27bf('0x12')][_0x27bf('0x14')]);return _0x3ecf8e(_0x4a5636[_0x27bf('0x12')][_0x27bf('0x14')]);}else{logger['info'](_0x27bf('0xd'),_0x2b48a7,'request\x20sent');_0x3ecf8e(_0x4a5636[_0x27bf('0x15')][_0x27bf('0x14')]);}})[_0x27bf('0x16')](function(_0x2793e6){logger[_0x27bf('0x12')](_0x27bf('0xd'),_0x2b48a7,_0x2793e6);_0x2f7254(_0x2793e6);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index cab2277..1fe8889 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 _0xd5be=['Router','fs-extra','../../components/auth/service','./voiceDialReport.controller','get','describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1bf8ab,_0x387079){var _0x258385=function(_0x306186){while(--_0x306186){_0x1bf8ab['push'](_0x1bf8ab['shift']());}};_0x258385(++_0x387079);}(_0xd5be,0x1b4));var _0xed5b=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0xd5be[_0x445c98];return _0x2fe913;};'use strict';var multer=require(_0xed5b('0x0'));var util=require(_0xed5b('0x1'));var path=require(_0xed5b('0x2'));var timeout=require(_0xed5b('0x3'));var express=require(_0xed5b('0x4'));var router=express[_0xed5b('0x5')]();var fs_extra=require(_0xed5b('0x6'));var auth=require(_0xed5b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xed5b('0x8'));router[_0xed5b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xed5b('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xed5b('0xa')]);router[_0xed5b('0x9')]('/:id',auth[_0xed5b('0xb')](),controller[_0xed5b('0xc')]);router[_0xed5b('0xd')]('/',auth['isAuthenticated'](),controller[_0xed5b('0xe')]);router[_0xed5b('0xf')](_0xed5b('0x10'),auth[_0xed5b('0xb')](),controller[_0xed5b('0x11')]);router[_0xed5b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xed5b('0x13')]);module[_0xed5b('0x14')]=router; \ No newline at end of file +var _0xbf99=['delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0xb161fc,_0x262d3e){var _0x5cb389=function(_0x1f91d9){while(--_0x1f91d9){_0xb161fc['push'](_0xb161fc['shift']());}};_0x5cb389(++_0x262d3e);}(_0xbf99,0x8e));var _0x9bf9=function(_0x552963,_0x232bbb){_0x552963=_0x552963-0x0;var _0xc973d5=_0xbf99[_0x552963];return _0xc973d5;};'use strict';var multer=require(_0x9bf9('0x0'));var util=require('util');var path=require(_0x9bf9('0x1'));var timeout=require('connect-timeout');var express=require(_0x9bf9('0x2'));var router=express[_0x9bf9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9bf9('0x4'));var interaction=require(_0x9bf9('0x5'));var config=require(_0x9bf9('0x6'));var controller=require(_0x9bf9('0x7'));router[_0x9bf9('0x8')]('/',auth[_0x9bf9('0x9')](),controller[_0x9bf9('0xa')]);router[_0x9bf9('0x8')](_0x9bf9('0xb'),auth[_0x9bf9('0x9')](),controller[_0x9bf9('0xc')]);router['get'](_0x9bf9('0xd'),auth[_0x9bf9('0x9')](),controller['show']);router[_0x9bf9('0xe')]('/',auth[_0x9bf9('0x9')](),controller[_0x9bf9('0xf')]);router[_0x9bf9('0x10')](_0x9bf9('0xd'),auth[_0x9bf9('0x9')](),controller[_0x9bf9('0x11')]);router[_0x9bf9('0x12')](_0x9bf9('0xd'),auth[_0x9bf9('0x9')](),controller[_0x9bf9('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index f62717e..7c41755 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(_0x384d71,_0x2a5fa9){var _0x110420=function(_0x135c32){while(--_0x135c32){_0x384d71['push'](_0x384d71['shift']());}};_0x110420(++_0x2a5fa9);}(_0x55ca,0x126));var _0xa55c=function(_0x2183ca,_0x3778a9){_0x2183ca=_0x2183ca-0x0;var _0x21d00e=_0x55ca[_0x2183ca];return _0x21d00e;};'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 _0x9f62=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x4a96d2,_0x689504){var _0x38af04=function(_0x3a67cd){while(--_0x3a67cd){_0x4a96d2['push'](_0x4a96d2['shift']());}};_0x38af04(++_0x689504);}(_0x9f62,0x154));var _0x29f6=function(_0x3d90cd,_0x361d4a){_0x3d90cd=_0x3d90cd-0x0;var _0x729d0a=_0x9f62[_0x3d90cd];return _0x729d0a;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x29f6('0x1')]},'channelstate':{'type':Sequelize[_0x29f6('0x2')]},'channelstatedesc':{'type':Sequelize[_0x29f6('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'connectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'language':{'type':Sequelize[_0x29f6('0x1')]},'accountcode':{'type':Sequelize[_0x29f6('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x29f6('0x1')]},'priority':{'type':Sequelize[_0x29f6('0x2')]},'uniqueid':{'type':Sequelize[_0x29f6('0x1')]},'linkedid':{'type':Sequelize[_0x29f6('0x1')]},'destchannel':{'type':Sequelize[_0x29f6('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x29f6('0x1')]},'destexten':{'type':Sequelize[_0x29f6('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x29f6('0x1')]},'destlinkedid':{'type':Sequelize[_0x29f6('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x29f6('0x3')]},'lastevent':{'type':Sequelize[_0x29f6('0x1')],'comment':_0x29f6('0x4')},'routeId':{'type':Sequelize[_0x29f6('0x2')]},'duration':{'type':Sequelize[_0x29f6('0x2')]},'holdtime':{'type':Sequelize[_0x29f6('0x2')]},'billableseconds':{'type':Sequelize[_0x29f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index dd5392f..69f61de 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 _0x6af5=['show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','apply','save','update','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','options','VoiceDialReport','includeAll','rows'];(function(_0x188330,_0x3e7b90){var _0x4a5598=function(_0x2c43f6){while(--_0x2c43f6){_0x188330['push'](_0x188330['shift']());}};_0x4a5598(++_0x3e7b90);}(_0x6af5,0x1b1));var _0x56af=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x6af5[_0x42bc91];return _0x3f5507;};'use strict';var emlformat=require(_0x56af('0x0'));var rimraf=require(_0x56af('0x1'));var zipdir=require(_0x56af('0x2'));var jsonpatch=require(_0x56af('0x3'));var rp=require(_0x56af('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x56af('0x5'));var util=require('util');var path=require(_0x56af('0x6'));var sox=require(_0x56af('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56af('0x8'));var _=require(_0x56af('0x9'));var squel=require(_0x56af('0xa'));var crypto=require('crypto');var jsforce=require(_0x56af('0xb'));var deskjs=require(_0x56af('0xc'));var toCsv=require(_0x56af('0xd'));var querystring=require(_0x56af('0xe'));var Papa=require(_0x56af('0xf'));var Redis=require('ioredis');var authService=require(_0x56af('0x10'));var qs=require(_0x56af('0x11'));var as=require(_0x56af('0x12'));var hardwareService=require(_0x56af('0x13'));var logger=require('../../config/logger')(_0x56af('0x14'));var utils=require(_0x56af('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x56af('0x16'));var db=require(_0x56af('0x17'))['db'];function respondWithStatusCode(_0x581f3d,_0xdac63d){_0xdac63d=_0xdac63d||0xcc;return function(_0xb1b0b3){if(_0xb1b0b3){return _0x581f3d[_0x56af('0x18')](_0xdac63d);}return _0x581f3d['status'](_0xdac63d)['end']();};}function respondWithResult(_0x27e95c,_0x4b0acc){_0x4b0acc=_0x4b0acc||0xc8;return function(_0x5abce8){if(_0x5abce8){return _0x27e95c['status'](_0x4b0acc)[_0x56af('0x19')](_0x5abce8);}};}function respondWithFilteredResult(_0x1f2dbe,_0x43fce8){return function(_0x2230b5){if(_0x2230b5){var _0x576ec9=typeof _0x43fce8[_0x56af('0x1a')]===_0x56af('0x1b')&&typeof _0x43fce8['limit']===_0x56af('0x1b');var _0x4fab67=_0x2230b5['count'];var _0x852b69=_0x576ec9?0x0:_0x43fce8[_0x56af('0x1a')];var _0x3a30fb=_0x576ec9?_0x2230b5[_0x56af('0x1c')]:_0x43fce8['offset']+_0x43fce8[_0x56af('0x1d')];var _0x2018b8;if(_0x3a30fb>=_0x4fab67){_0x3a30fb=_0x4fab67;_0x2018b8=0xc8;}else{_0x2018b8=0xce;}_0x1f2dbe[_0x56af('0x1e')](_0x2018b8);return _0x1f2dbe[_0x56af('0x1f')]('Content-Range',_0x852b69+'-'+_0x3a30fb+'/'+_0x4fab67)[_0x56af('0x19')](_0x2230b5);}return null;};}function patchUpdates(_0x31bd70){return function(_0x4e4bfe){try{jsonpatch[_0x56af('0x20')](_0x4e4bfe,_0x31bd70,!![]);}catch(_0x5727e7){return BPromise['reject'](_0x5727e7);}return _0x4e4bfe[_0x56af('0x21')]();};}function saveUpdates(_0x3d7a3c,_0x58df18){return function(_0x379d4a){if(_0x379d4a){return _0x379d4a[_0x56af('0x22')](_0x3d7a3c)[_0x56af('0x23')](function(_0x4aa5ff){return _0x4aa5ff;});}return null;};}function removeEntity(_0x4fd604,_0x2551c4){return function(_0x48e4ae){if(_0x48e4ae){return _0x48e4ae['destroy']()[_0x56af('0x23')](function(){_0x4fd604[_0x56af('0x1e')](0xcc)[_0x56af('0x24')]();});}};}function handleEntityNotFound(_0x2ce305,_0xab91cb){return function(_0x5a9285){if(!_0x5a9285){_0x2ce305[_0x56af('0x18')](0x194);}return _0x5a9285;};}function handleError(_0x2d2e55,_0x1d8742){_0x1d8742=_0x1d8742||0x1f4;return function(_0x2e2e65){logger[_0x56af('0x25')](_0x2e2e65[_0x56af('0x26')]);if(_0x2e2e65[_0x56af('0x27')]){delete _0x2e2e65['name'];}_0x2d2e55[_0x56af('0x1e')](_0x1d8742)['send'](_0x2e2e65);};}exports[_0x56af('0x28')]=function(_0x428d41,_0x4f3ca2){var _0x1a89f2={},_0xae7da0={},_0x4f39c6={'count':0x0,'rows':[]};var _0x48db9f=_[_0x56af('0x29')](db['VoiceDialReport'][_0x56af('0x2a')],function(_0x4c2892){return{'name':_0x4c2892[_0x56af('0x2b')],'type':_0x4c2892[_0x56af('0x2c')][_0x56af('0x2d')]};});_0xae7da0[_0x56af('0x2e')]=_[_0x56af('0x29')](_0x48db9f,_0x56af('0x27'));_0xae7da0[_0x56af('0x2f')]=_[_0x56af('0x30')](_0x428d41['query']);_0xae7da0[_0x56af('0x31')]=_[_0x56af('0x32')](_0xae7da0['model'],_0xae7da0[_0x56af('0x2f')]);_0x1a89f2['attributes']=_[_0x56af('0x32')](_0xae7da0[_0x56af('0x2e')],qs[_0x56af('0x33')](_0x428d41[_0x56af('0x2f')][_0x56af('0x33')]));_0x1a89f2[_0x56af('0x34')]=_0x1a89f2['attributes'][_0x56af('0x35')]?_0x1a89f2['attributes']:_0xae7da0[_0x56af('0x2e')];if(!_0x428d41['query']['hasOwnProperty']('nolimit')){_0x1a89f2[_0x56af('0x1d')]=qs[_0x56af('0x1d')](_0x428d41[_0x56af('0x2f')]['limit']);_0x1a89f2['offset']=qs['offset'](_0x428d41[_0x56af('0x2f')][_0x56af('0x1a')]);}_0x1a89f2[_0x56af('0x36')]=qs[_0x56af('0x37')](_0x428d41[_0x56af('0x2f')][_0x56af('0x37')]);_0x1a89f2[_0x56af('0x38')]=qs[_0x56af('0x31')](_[_0x56af('0x39')](_0x428d41[_0x56af('0x2f')],_0xae7da0['filters']),_0x48db9f);if(_0x428d41[_0x56af('0x2f')][_0x56af('0x3a')]){_0x1a89f2['where']=_[_0x56af('0x3b')](_0x1a89f2[_0x56af('0x38')],{'$or':_[_0x56af('0x29')](_0x48db9f,function(_0x606dc){if(_0x606dc[_0x56af('0x2c')]!=='VIRTUAL'){var _0xb0679a={};_0xb0679a[_0x606dc[_0x56af('0x27')]]={'$like':'%'+_0x428d41[_0x56af('0x2f')][_0x56af('0x3a')]+'%'};return _0xb0679a;}})});}_0x1a89f2=_[_0x56af('0x3b')]({},_0x1a89f2,_0x428d41[_0x56af('0x3c')]);var _0x55a529={'where':_0x1a89f2[_0x56af('0x38')]};return db[_0x56af('0x3d')][_0x56af('0x1c')](_0x55a529)[_0x56af('0x23')](function(_0x2d191d){_0x4f39c6[_0x56af('0x1c')]=_0x2d191d;if(_0x428d41[_0x56af('0x2f')][_0x56af('0x3e')]){_0x1a89f2['include']=[{'all':!![]}];}return db[_0x56af('0x3d')]['findAll'](_0x1a89f2);})[_0x56af('0x23')](function(_0xc2206){_0x4f39c6[_0x56af('0x3f')]=_0xc2206;return _0x4f39c6;})['then'](respondWithFilteredResult(_0x4f3ca2,_0x1a89f2))['catch'](handleError(_0x4f3ca2,null));};exports[_0x56af('0x40')]=function(_0x54ff28,_0x528da8){var _0x44a518={'raw':!![],'where':{'id':_0x54ff28[_0x56af('0x41')]['id']}},_0x222adc={};_0x222adc['model']=_['keys'](db[_0x56af('0x3d')][_0x56af('0x2a')]);_0x222adc[_0x56af('0x2f')]=_['keys'](_0x54ff28[_0x56af('0x2f')]);_0x222adc['filters']=_['intersection'](_0x222adc[_0x56af('0x2e')],_0x222adc['query']);_0x44a518['attributes']=_[_0x56af('0x32')](_0x222adc[_0x56af('0x2e')],qs['fields'](_0x54ff28['query']['fields']));_0x44a518[_0x56af('0x34')]=_0x44a518[_0x56af('0x34')][_0x56af('0x35')]?_0x44a518[_0x56af('0x34')]:_0x222adc[_0x56af('0x2e')];if(_0x54ff28[_0x56af('0x2f')][_0x56af('0x3e')]){_0x44a518['include']=[{'all':!![]}];}_0x44a518=_[_0x56af('0x3b')]({},_0x44a518,_0x54ff28[_0x56af('0x3c')]);return db[_0x56af('0x3d')][_0x56af('0x42')](_0x44a518)['then'](handleEntityNotFound(_0x528da8,null))[_0x56af('0x23')](respondWithResult(_0x528da8,null))[_0x56af('0x43')](handleError(_0x528da8,null));};exports['create']=function(_0x5da613,_0x756fc3){return db[_0x56af('0x3d')][_0x56af('0x44')](_0x5da613[_0x56af('0x45')],{})[_0x56af('0x23')](respondWithResult(_0x756fc3,0xc9))['catch'](handleError(_0x756fc3,null));};exports[_0x56af('0x22')]=function(_0x35f21e,_0x5332b5){if(_0x35f21e[_0x56af('0x45')]['id']){delete _0x35f21e['body']['id'];}return db[_0x56af('0x3d')][_0x56af('0x42')]({'where':{'id':_0x35f21e[_0x56af('0x41')]['id']}})[_0x56af('0x23')](handleEntityNotFound(_0x5332b5,null))[_0x56af('0x23')](saveUpdates(_0x35f21e[_0x56af('0x45')],null))[_0x56af('0x23')](respondWithResult(_0x5332b5,null))[_0x56af('0x43')](handleError(_0x5332b5,null));};exports['destroy']=function(_0x5bc573,_0x307234){return db[_0x56af('0x3d')][_0x56af('0x42')]({'where':{'id':_0x5bc573[_0x56af('0x41')]['id']}})[_0x56af('0x23')](handleEntityNotFound(_0x307234,null))['then'](removeEntity(_0x307234,null))['catch'](handleError(_0x307234,null));};exports[_0x56af('0x46')]=function(_0x583cda,_0x2de889){return db['VoiceDialReport']['describe']()['then'](respondWithResult(_0x2de889,null))[_0x56af('0x43')](handleError(_0x2de889,null));}; \ No newline at end of file +var _0xc113=['includeAll','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','count','offset','set','Content-Range','apply','save','update','then','end','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','intersection','attributes','query','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options'];(function(_0x4973c2,_0x31b306){var _0xabd31f=function(_0x22a7eb){while(--_0x22a7eb){_0x4973c2['push'](_0x4973c2['shift']());}};_0xabd31f(++_0x31b306);}(_0xc113,0x130));var _0x3c11=function(_0x58b795,_0x1f3e17){_0x58b795=_0x58b795-0x0;var _0x2d61ad=_0xc113[_0x58b795];return _0x2d61ad;};'use strict';var emlformat=require(_0x3c11('0x0'));var rimraf=require(_0x3c11('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3c11('0x2'));var moment=require(_0x3c11('0x3'));var BPromise=require(_0x3c11('0x4'));var Mustache=require(_0x3c11('0x5'));var util=require(_0x3c11('0x6'));var path=require(_0x3c11('0x7'));var sox=require(_0x3c11('0x8'));var csv=require(_0x3c11('0x9'));var ejs=require(_0x3c11('0xa'));var fs=require('fs');var fs_extra=require(_0x3c11('0xb'));var _=require('lodash');var squel=require(_0x3c11('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3c11('0xd'));var toCsv=require(_0x3c11('0x9'));var querystring=require(_0x3c11('0xe'));var Papa=require(_0x3c11('0xf'));var Redis=require(_0x3c11('0x10'));var authService=require(_0x3c11('0x11'));var qs=require(_0x3c11('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c11('0x13'))(_0x3c11('0x14'));var utils=require(_0x3c11('0x15'));var config=require(_0x3c11('0x16'));var licenseUtil=require(_0x3c11('0x17'));var db=require(_0x3c11('0x18'))['db'];function respondWithStatusCode(_0x4409b9,_0x172487){_0x172487=_0x172487||0xcc;return function(_0x2c3c7f){if(_0x2c3c7f){return _0x4409b9[_0x3c11('0x19')](_0x172487);}return _0x4409b9[_0x3c11('0x1a')](_0x172487)['end']();};}function respondWithResult(_0x325f1e,_0x15d4c8){_0x15d4c8=_0x15d4c8||0xc8;return function(_0x43f0b3){if(_0x43f0b3){return _0x325f1e[_0x3c11('0x1a')](_0x15d4c8)['json'](_0x43f0b3);}};}function respondWithFilteredResult(_0x53f649,_0x424ef4){return function(_0x3a229a){if(_0x3a229a){var _0x3e7b0c=typeof _0x424ef4['offset']==='undefined'&&typeof _0x424ef4[_0x3c11('0x1b')]==='undefined';var _0x1668cb=_0x3a229a[_0x3c11('0x1c')];var _0x1b1803=_0x3e7b0c?0x0:_0x424ef4['offset'];var _0x458117=_0x3e7b0c?_0x3a229a['count']:_0x424ef4[_0x3c11('0x1d')]+_0x424ef4[_0x3c11('0x1b')];var _0x846a58;if(_0x458117>=_0x1668cb){_0x458117=_0x1668cb;_0x846a58=0xc8;}else{_0x846a58=0xce;}_0x53f649[_0x3c11('0x1a')](_0x846a58);return _0x53f649[_0x3c11('0x1e')](_0x3c11('0x1f'),_0x1b1803+'-'+_0x458117+'/'+_0x1668cb)['json'](_0x3a229a);}return null;};}function patchUpdates(_0x38cb8e){return function(_0x1f1745){try{jsonpatch[_0x3c11('0x20')](_0x1f1745,_0x38cb8e,!![]);}catch(_0x21ddb3){return BPromise['reject'](_0x21ddb3);}return _0x1f1745[_0x3c11('0x21')]();};}function saveUpdates(_0x46c670,_0x580bca){return function(_0x4fbbdf){if(_0x4fbbdf){return _0x4fbbdf[_0x3c11('0x22')](_0x46c670)[_0x3c11('0x23')](function(_0x341968){return _0x341968;});}return null;};}function removeEntity(_0x586d85,_0xd7d78c){return function(_0x55d2ff){if(_0x55d2ff){return _0x55d2ff['destroy']()[_0x3c11('0x23')](function(){_0x586d85[_0x3c11('0x1a')](0xcc)[_0x3c11('0x24')]();});}};}function handleEntityNotFound(_0x4bfc96,_0x237771){return function(_0x28b923){if(!_0x28b923){_0x4bfc96['sendStatus'](0x194);}return _0x28b923;};}function handleError(_0x1fe371,_0x39a6e9){_0x39a6e9=_0x39a6e9||0x1f4;return function(_0x27aa2c){logger['error'](_0x27aa2c[_0x3c11('0x25')]);if(_0x27aa2c[_0x3c11('0x26')]){delete _0x27aa2c[_0x3c11('0x26')];}_0x1fe371[_0x3c11('0x1a')](_0x39a6e9)[_0x3c11('0x27')](_0x27aa2c);};}exports[_0x3c11('0x28')]=function(_0x5bcb4e,_0x135341){var _0x1790cc={},_0x25a4ed={},_0x11c909={'count':0x0,'rows':[]};var _0x318c7e=_[_0x3c11('0x29')](db[_0x3c11('0x2a')][_0x3c11('0x2b')],function(_0xd6344d){return{'name':_0xd6344d['fieldName'],'type':_0xd6344d[_0x3c11('0x2c')][_0x3c11('0x2d')]};});_0x25a4ed[_0x3c11('0x2e')]=_['map'](_0x318c7e,_0x3c11('0x26'));_0x25a4ed['query']=_['keys'](_0x5bcb4e['query']);_0x25a4ed['filters']=_[_0x3c11('0x2f')](_0x25a4ed[_0x3c11('0x2e')],_0x25a4ed['query']);_0x1790cc[_0x3c11('0x30')]=_['intersection'](_0x25a4ed['model'],qs['fields'](_0x5bcb4e[_0x3c11('0x31')][_0x3c11('0x32')]));_0x1790cc['attributes']=_0x1790cc[_0x3c11('0x30')][_0x3c11('0x33')]?_0x1790cc['attributes']:_0x25a4ed['model'];if(!_0x5bcb4e[_0x3c11('0x31')][_0x3c11('0x34')]('nolimit')){_0x1790cc[_0x3c11('0x1b')]=qs[_0x3c11('0x1b')](_0x5bcb4e[_0x3c11('0x31')][_0x3c11('0x1b')]);_0x1790cc[_0x3c11('0x1d')]=qs['offset'](_0x5bcb4e[_0x3c11('0x31')][_0x3c11('0x1d')]);}_0x1790cc[_0x3c11('0x35')]=qs[_0x3c11('0x36')](_0x5bcb4e['query'][_0x3c11('0x36')]);_0x1790cc[_0x3c11('0x37')]=qs[_0x3c11('0x38')](_['pick'](_0x5bcb4e[_0x3c11('0x31')],_0x25a4ed[_0x3c11('0x38')]),_0x318c7e);if(_0x5bcb4e[_0x3c11('0x31')][_0x3c11('0x39')]){_0x1790cc[_0x3c11('0x37')]=_['merge'](_0x1790cc[_0x3c11('0x37')],{'$or':_[_0x3c11('0x29')](_0x318c7e,function(_0x5c8e85){if(_0x5c8e85[_0x3c11('0x2c')]!==_0x3c11('0x3a')){var _0x379202={};_0x379202[_0x5c8e85[_0x3c11('0x26')]]={'$like':'%'+_0x5bcb4e[_0x3c11('0x31')]['filter']+'%'};return _0x379202;}})});}_0x1790cc=_[_0x3c11('0x3b')]({},_0x1790cc,_0x5bcb4e[_0x3c11('0x3c')]);var _0x30e8ef={'where':_0x1790cc[_0x3c11('0x37')]};return db[_0x3c11('0x2a')][_0x3c11('0x1c')](_0x30e8ef)['then'](function(_0x19388c){_0x11c909['count']=_0x19388c;if(_0x5bcb4e[_0x3c11('0x31')][_0x3c11('0x3d')]){_0x1790cc['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x3c11('0x3e')](_0x1790cc);})[_0x3c11('0x23')](function(_0x5d5345){_0x11c909[_0x3c11('0x3f')]=_0x5d5345;return _0x11c909;})[_0x3c11('0x23')](respondWithFilteredResult(_0x135341,_0x1790cc))[_0x3c11('0x40')](handleError(_0x135341,null));};exports[_0x3c11('0x41')]=function(_0x417a4e,_0x488854){var _0x573b3b={'raw':!![],'where':{'id':_0x417a4e[_0x3c11('0x42')]['id']}},_0x5d09b4={};_0x5d09b4[_0x3c11('0x2e')]=_[_0x3c11('0x43')](db[_0x3c11('0x2a')][_0x3c11('0x2b')]);_0x5d09b4['query']=_[_0x3c11('0x43')](_0x417a4e[_0x3c11('0x31')]);_0x5d09b4[_0x3c11('0x38')]=_[_0x3c11('0x2f')](_0x5d09b4[_0x3c11('0x2e')],_0x5d09b4['query']);_0x573b3b[_0x3c11('0x30')]=_['intersection'](_0x5d09b4[_0x3c11('0x2e')],qs['fields'](_0x417a4e[_0x3c11('0x31')][_0x3c11('0x32')]));_0x573b3b[_0x3c11('0x30')]=_0x573b3b[_0x3c11('0x30')][_0x3c11('0x33')]?_0x573b3b[_0x3c11('0x30')]:_0x5d09b4[_0x3c11('0x2e')];if(_0x417a4e['query'][_0x3c11('0x3d')]){_0x573b3b['include']=[{'all':!![]}];}_0x573b3b=_['merge']({},_0x573b3b,_0x417a4e[_0x3c11('0x3c')]);return db[_0x3c11('0x2a')][_0x3c11('0x44')](_0x573b3b)[_0x3c11('0x23')](handleEntityNotFound(_0x488854,null))[_0x3c11('0x23')](respondWithResult(_0x488854,null))[_0x3c11('0x40')](handleError(_0x488854,null));};exports[_0x3c11('0x45')]=function(_0x2dd42f,_0x103984){return db['VoiceDialReport'][_0x3c11('0x45')](_0x2dd42f[_0x3c11('0x46')],{})[_0x3c11('0x23')](respondWithResult(_0x103984,0xc9))['catch'](handleError(_0x103984,null));};exports[_0x3c11('0x22')]=function(_0x339f49,_0x3b72fe){if(_0x339f49[_0x3c11('0x46')]['id']){delete _0x339f49[_0x3c11('0x46')]['id'];}return db[_0x3c11('0x2a')][_0x3c11('0x44')]({'where':{'id':_0x339f49['params']['id']}})[_0x3c11('0x23')](handleEntityNotFound(_0x3b72fe,null))[_0x3c11('0x23')](saveUpdates(_0x339f49[_0x3c11('0x46')],null))[_0x3c11('0x23')](respondWithResult(_0x3b72fe,null))[_0x3c11('0x40')](handleError(_0x3b72fe,null));};exports[_0x3c11('0x47')]=function(_0xf7601b,_0xf3d85f){return db[_0x3c11('0x2a')]['find']({'where':{'id':_0xf7601b[_0x3c11('0x42')]['id']}})['then'](handleEntityNotFound(_0xf3d85f,null))[_0x3c11('0x23')](removeEntity(_0xf3d85f,null))[_0x3c11('0x40')](handleError(_0xf3d85f,null));};exports[_0x3c11('0x48')]=function(_0x4bc00b,_0x414531){return db[_0x3c11('0x2a')][_0x3c11('0x48')]()['then'](respondWithResult(_0x414531,null))[_0x3c11('0x40')](handleError(_0x414531,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 8dd2492..c9447da 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 _0xe5f6=['report_dial','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5f6,0xc2));var _0x6e5f=function(_0x2c6b3e,_0xbee7e7){_0x2c6b3e=_0x2c6b3e-0x0;var _0x5bf359=_0xe5f6[_0x2c6b3e];return _0x5bf359;};'use strict';var _=require(_0x6e5f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6e5f('0x1'));var moment=require(_0x6e5f('0x2'));var BPromise=require(_0x6e5f('0x3'));var rp=require(_0x6e5f('0x4'));var fs=require('fs');var path=require(_0x6e5f('0x5'));var rimraf=require(_0x6e5f('0x6'));var config=require(_0x6e5f('0x7'));var attributes=require(_0x6e5f('0x8'));module['exports']=function(_0x5a38aa,_0x2b43a8){return _0x5a38aa[_0x6e5f('0x9')]('VoiceDialReport',attributes,{'tableName':_0x6e5f('0xa'),'paranoid':![],'indexes':[{'fields':[_0x6e5f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2635=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2351f8,_0x4b1d1f){var _0x36a216=function(_0x383762){while(--_0x383762){_0x2351f8['push'](_0x2351f8['shift']());}};_0x36a216(++_0x4b1d1f);}(_0x2635,0x148));var _0x5263=function(_0x1d1b52,_0x15aec4){_0x1d1b52=_0x1d1b52-0x0;var _0x3c8734=_0x2635[_0x1d1b52];return _0x3c8734;};'use strict';var _=require(_0x5263('0x0'));var util=require(_0x5263('0x1'));var logger=require(_0x5263('0x2'))(_0x5263('0x3'));var moment=require(_0x5263('0x4'));var BPromise=require(_0x5263('0x5'));var rp=require(_0x5263('0x6'));var fs=require('fs');var path=require(_0x5263('0x7'));var rimraf=require(_0x5263('0x8'));var config=require(_0x5263('0x9'));var attributes=require(_0x5263('0xa'));module[_0x5263('0xb')]=function(_0x2afee5,_0x2edd24){return _0x2afee5[_0x5263('0xc')](_0x5263('0xd'),attributes,{'tableName':_0x5263('0xe'),'paranoid':![],'indexes':[{'fields':[_0x5263('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 89f37ba..5dfd07e 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 _0xa391=['options','raw','update','where','attributes','limit','UpdateVoiceDialReport','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','create','body'];(function(_0x1690dc,_0x1b0dd8){var _0x18fd2a=function(_0x349c7e){while(--_0x349c7e){_0x1690dc['push'](_0x1690dc['shift']());}};_0x18fd2a(++_0x1b0dd8);}(_0xa391,0x64));var _0x1a39=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xa391[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0x1a39('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1a39('0x1'));var fs=require('fs');var Redis=require(_0x1a39('0x2'));var db=require(_0x1a39('0x3'))['db'];var utils=require(_0x1a39('0x4'));var logger=require(_0x1a39('0x5'))(_0x1a39('0x6'));var config=require(_0x1a39('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1a39('0x8')][_0x1a39('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5dce6a,_0x2fbdcf,_0x3b0ace){return new BPromise(function(_0x5cdf74,_0x5b154d){return client['request'](_0x5dce6a,_0x3b0ace)[_0x1a39('0xa')](function(_0xfb1a6e){logger[_0x1a39('0xb')](_0x1a39('0xc'),_0x2fbdcf,'request\x20sent');logger[_0x1a39('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2fbdcf,_0x1a39('0xe'),JSON[_0x1a39('0xf')](_0xfb1a6e));if(_0xfb1a6e[_0x1a39('0x10')]){if(_0xfb1a6e[_0x1a39('0x10')][_0x1a39('0x11')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x2fbdcf,_0xfb1a6e[_0x1a39('0x10')][_0x1a39('0x12')]);return _0x5b154d(_0xfb1a6e['error'][_0x1a39('0x12')]);}logger['error'](_0x1a39('0xc'),_0x2fbdcf,_0xfb1a6e[_0x1a39('0x10')][_0x1a39('0x12')]);return _0x5cdf74(_0xfb1a6e[_0x1a39('0x10')][_0x1a39('0x12')]);}else{logger[_0x1a39('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x2fbdcf,_0x1a39('0xe'));_0x5cdf74(_0xfb1a6e[_0x1a39('0x13')][_0x1a39('0x12')]);}})[_0x1a39('0x14')](function(_0x4fa2a4){logger['error'](_0x1a39('0xc'),_0x2fbdcf,_0x4fa2a4);_0x5b154d(_0x4fa2a4);});});}exports[_0x1a39('0x15')]=function(_0xc8ce05){var _0x502a0a=this;return new Promise(function(_0x5dccb7,_0x13ae84){return db['VoiceDialReport'][_0x1a39('0x16')](_0xc8ce05[_0x1a39('0x17')],{'raw':_0xc8ce05[_0x1a39('0x18')]?_0xc8ce05[_0x1a39('0x18')][_0x1a39('0x19')]===undefined?!![]:![]:!![]})[_0x1a39('0xa')](function(_0x43c09d){logger[_0x1a39('0xb')](_0x1a39('0x15'),_0xc8ce05);logger[_0x1a39('0xd')]('CreateVoiceDialReport',_0xc8ce05,JSON[_0x1a39('0xf')](_0x43c09d));_0x5dccb7(_0x43c09d);})[_0x1a39('0x14')](function(_0x4dfd22){logger['error'](_0x1a39('0x15'),_0x4dfd22[_0x1a39('0x12')],_0xc8ce05);_0x13ae84(_0x502a0a[_0x1a39('0x10')](0x1f4,_0x4dfd22[_0x1a39('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x547d42){var _0x508219=this;return new Promise(function(_0x41a3ff,_0x3eefef){return db['VoiceDialReport'][_0x1a39('0x1a')](_0x547d42['body'],{'raw':_0x547d42[_0x1a39('0x18')]?_0x547d42[_0x1a39('0x18')][_0x1a39('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x547d42[_0x1a39('0x18')]?_0x547d42[_0x1a39('0x18')][_0x1a39('0x1b')]||null:null,'attributes':_0x547d42[_0x1a39('0x18')]?_0x547d42[_0x1a39('0x18')][_0x1a39('0x1c')]||null:null,'limit':_0x547d42[_0x1a39('0x18')]?_0x547d42[_0x1a39('0x18')][_0x1a39('0x1d')]||null:null})['then'](function(_0x24f060){logger[_0x1a39('0xb')](_0x1a39('0x1e'),_0x547d42);logger[_0x1a39('0xd')](_0x1a39('0x1e'),_0x547d42,JSON[_0x1a39('0xf')](_0x24f060));_0x41a3ff(_0x24f060);})[_0x1a39('0x14')](function(_0xfc9196){logger[_0x1a39('0x10')](_0x1a39('0x1e'),_0xfc9196[_0x1a39('0x12')],_0x547d42);_0x3eefef(_0x508219['error'](0x1f4,_0xfc9196['message']));});});}; \ No newline at end of file +var _0x3a5d=['request\x20sent','stringify','code','error','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','UpdateVoiceDialReport','update','body','where','limit','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x1cedf1,_0x18dcb4){var _0x4063ce=function(_0x1ee1ff){while(--_0x1ee1ff){_0x1cedf1['push'](_0x1cedf1['shift']());}};_0x4063ce(++_0x18dcb4);}(_0x3a5d,0x113));var _0xd3a5=function(_0xff1f9d,_0x59087c){_0xff1f9d=_0xff1f9d-0x0;var _0x4e9032=_0x3a5d[_0xff1f9d];return _0x4e9032;};'use strict';var _=require(_0xd3a5('0x0'));var util=require(_0xd3a5('0x1'));var moment=require(_0xd3a5('0x2'));var BPromise=require(_0xd3a5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3a5('0x4'));var db=require(_0xd3a5('0x5'))['db'];var utils=require(_0xd3a5('0x6'));var logger=require(_0xd3a5('0x7'))(_0xd3a5('0x8'));var config=require('../../config/environment');var jayson=require(_0xd3a5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47a2e3,_0x178b7f,_0x34b8e3){return new BPromise(function(_0x6eeed7,_0x5e185d){return client['request'](_0x47a2e3,_0x34b8e3)['then'](function(_0x3120d5){logger[_0xd3a5('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x178b7f,'request\x20sent');logger[_0xd3a5('0xb')](_0xd3a5('0xc'),_0x178b7f,_0xd3a5('0xd'),JSON[_0xd3a5('0xe')](_0x3120d5));if(_0x3120d5['error']){if(_0x3120d5['error'][_0xd3a5('0xf')]===0x1f4){logger[_0xd3a5('0x10')](_0xd3a5('0x11'),_0x178b7f,_0x3120d5[_0xd3a5('0x10')]['message']);return _0x5e185d(_0x3120d5[_0xd3a5('0x10')][_0xd3a5('0x12')]);}logger[_0xd3a5('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x178b7f,_0x3120d5[_0xd3a5('0x10')][_0xd3a5('0x12')]);return _0x6eeed7(_0x3120d5['error'][_0xd3a5('0x12')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x178b7f,_0xd3a5('0xd'));_0x6eeed7(_0x3120d5[_0xd3a5('0x13')][_0xd3a5('0x12')]);}})[_0xd3a5('0x14')](function(_0x3241a3){logger[_0xd3a5('0x10')](_0xd3a5('0x11'),_0x178b7f,_0x3241a3);_0x5e185d(_0x3241a3);});});}exports[_0xd3a5('0x15')]=function(_0x18978b){var _0x2325d0=this;return new Promise(function(_0x2cecb2,_0x2282ff){return db[_0xd3a5('0x16')][_0xd3a5('0x17')](_0x18978b['body'],{'raw':_0x18978b[_0xd3a5('0x18')]?_0x18978b['options'][_0xd3a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xdf7810){logger[_0xd3a5('0xa')]('CreateVoiceDialReport',_0x18978b);logger[_0xd3a5('0xb')](_0xd3a5('0x15'),_0x18978b,JSON[_0xd3a5('0xe')](_0xdf7810));_0x2cecb2(_0xdf7810);})[_0xd3a5('0x14')](function(_0x3fbb7e){logger['error'](_0xd3a5('0x15'),_0x3fbb7e[_0xd3a5('0x12')],_0x18978b);_0x2282ff(_0x2325d0[_0xd3a5('0x10')](0x1f4,_0x3fbb7e[_0xd3a5('0x12')]));});});};exports[_0xd3a5('0x1a')]=function(_0x535aa9){var _0x58df2d=this;return new Promise(function(_0x171178,_0x4aa6ad){return db[_0xd3a5('0x16')][_0xd3a5('0x1b')](_0x535aa9[_0xd3a5('0x1c')],{'raw':_0x535aa9[_0xd3a5('0x18')]?_0x535aa9['options'][_0xd3a5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x535aa9[_0xd3a5('0x18')]?_0x535aa9[_0xd3a5('0x18')][_0xd3a5('0x1d')]||null:null,'attributes':_0x535aa9[_0xd3a5('0x18')]?_0x535aa9['options']['attributes']||null:null,'limit':_0x535aa9[_0xd3a5('0x18')]?_0x535aa9['options'][_0xd3a5('0x1e')]||null:null})[_0xd3a5('0x1f')](function(_0x456ef3){logger['info'](_0xd3a5('0x1a'),_0x535aa9);logger[_0xd3a5('0xb')](_0xd3a5('0x1a'),_0x535aa9,JSON[_0xd3a5('0xe')](_0x456ef3));_0x171178(_0x456ef3);})['catch'](function(_0x23c150){logger[_0xd3a5('0x10')](_0xd3a5('0x1a'),_0x23c150['message'],_0x535aa9);_0x4aa6ad(_0x58df2d[_0xd3a5('0x10')](0x1f4,_0x23c150[_0xd3a5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index a9cb015..60bca60 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 _0x344e=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','create','post','/:id/applications','addApplications','put','/:id','update','delete','destroy'];(function(_0x373c4a,_0x9a82e7){var _0xbf1632=function(_0x2a685c){while(--_0x2a685c){_0x373c4a['push'](_0x373c4a['shift']());}};_0xbf1632(++_0x9a82e7);}(_0x344e,0xd9));var _0xe344=function(_0x16e650,_0x3fca3a){_0x16e650=_0x16e650-0x0;var _0x9baf5=_0x344e[_0x16e650];return _0x9baf5;};'use strict';var multer=require(_0xe344('0x0'));var util=require(_0xe344('0x1'));var path=require(_0xe344('0x2'));var timeout=require(_0xe344('0x3'));var express=require(_0xe344('0x4'));var router=express[_0xe344('0x5')]();var fs_extra=require(_0xe344('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe344('0x7'));var config=require(_0xe344('0x8'));var controller=require(_0xe344('0x9'));router[_0xe344('0xa')]('/',auth[_0xe344('0xb')](),controller[_0xe344('0xc')]);router[_0xe344('0xa')]('/:id',auth[_0xe344('0xb')](),controller[_0xe344('0xd')]);router['post']('/',auth[_0xe344('0xb')](),controller[_0xe344('0xe')]);router[_0xe344('0xf')](_0xe344('0x10'),auth[_0xe344('0xb')](),controller[_0xe344('0x11')]);router[_0xe344('0x12')](_0xe344('0x13'),auth[_0xe344('0xb')](),controller[_0xe344('0x14')]);router[_0xe344('0x15')](_0xe344('0x13'),auth[_0xe344('0xb')](),controller[_0xe344('0x16')]);module[_0xe344('0x17')]=router; \ No newline at end of file +var _0x7121=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','addApplications','update','delete','exports','multer','util','path'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0x7121,0x7b));var _0x1712=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x7121[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x1712('0x0'));var util=require(_0x1712('0x1'));var path=require(_0x1712('0x2'));var timeout=require(_0x1712('0x3'));var express=require(_0x1712('0x4'));var router=express[_0x1712('0x5')]();var fs_extra=require(_0x1712('0x6'));var auth=require(_0x1712('0x7'));var interaction=require(_0x1712('0x8'));var config=require(_0x1712('0x9'));var controller=require('./voiceExtension.controller');router[_0x1712('0xa')]('/',auth[_0x1712('0xb')](),controller[_0x1712('0xc')]);router[_0x1712('0xa')](_0x1712('0xd'),auth[_0x1712('0xb')](),controller[_0x1712('0xe')]);router[_0x1712('0xf')]('/',auth[_0x1712('0xb')](),controller[_0x1712('0x10')]);router[_0x1712('0xf')]('/:id/applications',auth[_0x1712('0xb')](),controller[_0x1712('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1712('0x12')]);router[_0x1712('0x13')]('/:id',auth[_0x1712('0xb')](),controller['destroy']);module[_0x1712('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index ad3ab86..7724ec4 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x19e206,_0x3e945d){var _0x531b21=function(_0x30ff2e){while(--_0x30ff2e){_0x19e206['push'](_0x19e206['shift']());}};_0x531b21(++_0x3e945d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x10a889,_0x220612){var _0x3b5ed3=function(_0x4f0137){while(--_0x4f0137){_0x10a889['push'](_0x10a889['shift']());}};_0x3b5ed3(++_0x220612);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index b9188c7..711671d 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 _0x56a0=['body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','createRouting','cast(priority\x20as\x20unsigned)','send','lodash','ioredis','../../config/logger','api','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','value','includes','type','find','name','UserProfileResource','destroy','end','error','stack','index','map','VoiceExtension','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x56a0,0x12b));var _0x056a=function(_0x2b9e3c,_0x385f13){_0x2b9e3c=_0x2b9e3c-0x0;var _0x481485=_0x56a0[_0x2b9e3c];return _0x481485;};'use strict';var _=require(_0x056a('0x0'));var Redis=require(_0x056a('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x056a('0x2'))(_0x056a('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x056a('0x4')]=_[_0x056a('0x5')](config[_0x056a('0x4')],{'host':_0x056a('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x056a('0x4')]));require('./voiceExtension.socket')[_0x056a('0x7')](socket);function respondWithStatusCode(_0x2fabc0,_0x60b098){_0x60b098=_0x60b098||0xcc;return function(_0x5f133c){if(_0x5f133c){return _0x2fabc0[_0x056a('0x8')](_0x60b098);}return _0x2fabc0[_0x056a('0x9')](_0x60b098)['end']();};}function respondWithResult(_0x53d19f,_0x5e77f7){_0x5e77f7=_0x5e77f7||0xc8;return function(_0x4fef58){if(_0x4fef58){return _0x53d19f[_0x056a('0x9')](_0x5e77f7)[_0x056a('0xa')](_0x4fef58);}};}function respondWithFilteredResult(_0x13a63b,_0xcd7a77){return function(_0x3f6348){if(_0x3f6348){var _0x4ef406=typeof _0xcd7a77[_0x056a('0xb')]===_0x056a('0xc')&&typeof _0xcd7a77['limit']===_0x056a('0xc');var _0x3a09cc=_0x3f6348[_0x056a('0xd')];var _0x3a32fc=_0x4ef406?0x0:_0xcd7a77[_0x056a('0xb')];var _0x53b76f=_0x4ef406?_0x3f6348[_0x056a('0xd')]:_0xcd7a77[_0x056a('0xb')]+_0xcd7a77[_0x056a('0xe')];var _0x5bc483;if(_0x53b76f>=_0x3a09cc){_0x53b76f=_0x3a09cc;_0x5bc483=0xc8;}else{_0x5bc483=0xce;}_0x13a63b[_0x056a('0x9')](_0x5bc483);return _0x13a63b['set'](_0x056a('0xf'),_0x3a32fc+'-'+_0x53b76f+'/'+_0x3a09cc)['json'](_0x3f6348);}return null;};}function removeEntity(_0x158df3){return function(_0x39866d){if(_0x39866d){return _0x39866d['destroy']()[_0x056a('0x10')](function(){var _0x1b91b7=_0x39866d[_0x056a('0x11')]({'plain':!![]});var _0x37556f=[{'name':'InboundRoutes','value':_0x056a('0x12'),'ignore':![]},{'name':_0x056a('0x13'),'value':_0x056a('0x14'),'ignore':![]},{'name':_0x056a('0x15'),'value':_0x056a('0x16'),'ignore':![]}];var _0x5c7afe=_(_0x37556f)['filter'](_0x056a('0x17'))['map'](_0x056a('0x18'))[_0x056a('0x18')]();if(_[_0x056a('0x19')](_0x5c7afe,_0x1b91b7[_0x056a('0x1a')])){return;}var _0x42032f=_[_0x056a('0x1b')](_0x37556f,[_0x056a('0x18'),_0x1b91b7[_0x056a('0x1a')]])[_0x056a('0x1c')];return db[_0x056a('0x1d')][_0x056a('0x1e')]({'where':{'type':_0x42032f,'resourceId':_0x1b91b7['id']}})[_0x056a('0x10')](function(){return _0x39866d;});})['then'](function(){_0x158df3[_0x056a('0x9')](0xcc)[_0x056a('0x1f')]();});}};}function handleEntityNotFound(_0x1817b3){return function(_0x594366){if(!_0x594366){_0x1817b3[_0x056a('0x8')](0x194);}return _0x594366;};}function handleError(_0x477a49,_0x30681b){_0x30681b=_0x30681b||0x1f4;return function(_0xfafddb){logger[_0x056a('0x20')](_0xfafddb[_0x056a('0x21')]);if(_0xfafddb[_0x056a('0x1c')]){delete _0xfafddb[_0x056a('0x1c')];}_0x477a49[_0x056a('0x9')](_0x30681b)['send'](_0xfafddb);};}exports[_0x056a('0x22')]=function(_0x418e66,_0x503538){var _0x53d392={},_0x343548={},_0x1d1a6b={'count':0x0,'rows':[]};var _0x786df=_[_0x056a('0x23')](db[_0x056a('0x24')][_0x056a('0x25')],function(_0x1a5d7a){return{'name':_0x1a5d7a[_0x056a('0x26')],'type':_0x1a5d7a[_0x056a('0x1a')][_0x056a('0x27')]};});_0x343548['model']=_['map'](_0x786df,_0x056a('0x1c'));_0x343548[_0x056a('0x28')]=_[_0x056a('0x29')](_0x418e66[_0x056a('0x28')]);_0x343548[_0x056a('0x2a')]=_[_0x056a('0x2b')](_0x343548[_0x056a('0x2c')],_0x343548[_0x056a('0x28')]);_0x53d392[_0x056a('0x2d')]=_['intersection'](_0x343548[_0x056a('0x2c')],qs[_0x056a('0x2e')](_0x418e66[_0x056a('0x28')][_0x056a('0x2e')]));_0x53d392[_0x056a('0x2d')]=_0x53d392[_0x056a('0x2d')]['length']?_0x53d392['attributes']:_0x343548[_0x056a('0x2c')];if(!_0x418e66[_0x056a('0x28')][_0x056a('0x2f')](_0x056a('0x30'))){_0x53d392[_0x056a('0xe')]=qs[_0x056a('0xe')](_0x418e66[_0x056a('0x28')][_0x056a('0xe')]);_0x53d392[_0x056a('0xb')]=qs[_0x056a('0xb')](_0x418e66[_0x056a('0x28')][_0x056a('0xb')]);}_0x53d392[_0x056a('0x31')]=qs[_0x056a('0x32')](_0x418e66[_0x056a('0x28')][_0x056a('0x32')]);_0x53d392['where']=qs[_0x056a('0x2a')](_['pick'](_0x418e66[_0x056a('0x28')],_0x343548[_0x056a('0x2a')]),_0x786df);if(_0x418e66[_0x056a('0x28')][_0x056a('0x33')]){_0x53d392[_0x056a('0x34')]=_[_0x056a('0x35')](_0x53d392['where'],{'$or':_[_0x056a('0x23')](_0x786df,function(_0x9df84){if(_0x9df84[_0x056a('0x1a')]!==_0x056a('0x36')){var _0xc04b97={};_0xc04b97[_0x9df84[_0x056a('0x1c')]]={'$like':'%'+_0x418e66[_0x056a('0x28')]['filter']+'%'};return _0xc04b97;}})});}_0x53d392=_[_0x056a('0x35')]({},_0x53d392,_0x418e66[_0x056a('0x37')]);var _0x4b5e6d={'where':_0x53d392[_0x056a('0x34')]};return db[_0x056a('0x24')][_0x056a('0xd')](_0x4b5e6d)[_0x056a('0x10')](function(_0x54d38a){_0x1d1a6b['count']=_0x54d38a;if(_0x418e66[_0x056a('0x28')][_0x056a('0x38')]){_0x53d392[_0x056a('0x39')]=[{'all':!![]}];}return db['VoiceExtension'][_0x056a('0x3a')](_0x53d392);})[_0x056a('0x10')](function(_0x48b54d){_0x1d1a6b[_0x056a('0x3b')]=_0x48b54d;return _0x1d1a6b;})['then'](respondWithFilteredResult(_0x503538,_0x53d392))[_0x056a('0x3c')](handleError(_0x503538,null));};exports[_0x056a('0x3d')]=function(_0x6875f1,_0x1ff76b){var _0xa29d9f={'raw':![],'where':{'id':_0x6875f1[_0x056a('0x3e')]['id']}},_0x549082={};_0x549082[_0x056a('0x2c')]=_[_0x056a('0x29')](db[_0x056a('0x24')][_0x056a('0x25')]);_0x549082[_0x056a('0x28')]=_[_0x056a('0x29')](_0x6875f1[_0x056a('0x28')]);_0x549082[_0x056a('0x2a')]=_[_0x056a('0x2b')](_0x549082[_0x056a('0x2c')],_0x549082['query']);_0xa29d9f[_0x056a('0x2d')]=_[_0x056a('0x2b')](_0x549082[_0x056a('0x2c')],qs[_0x056a('0x2e')](_0x6875f1[_0x056a('0x28')][_0x056a('0x2e')]));_0xa29d9f['attributes']=_0xa29d9f[_0x056a('0x2d')][_0x056a('0x3f')]?_0xa29d9f[_0x056a('0x2d')]:_0x549082['model'];if(_0x6875f1[_0x056a('0x28')][_0x056a('0x38')]){_0xa29d9f[_0x056a('0x39')]=[{'all':!![]}];}_0xa29d9f=_['merge']({},_0xa29d9f,_0x6875f1[_0x056a('0x37')]);return db[_0x056a('0x24')][_0x056a('0x1b')](_0xa29d9f)['then'](handleEntityNotFound(_0x1ff76b,null))[_0x056a('0x10')](respondWithResult(_0x1ff76b,null))[_0x056a('0x3c')](handleError(_0x1ff76b,null));};exports['destroy']=function(_0x1d54a9,_0x262903){return db[_0x056a('0x24')][_0x056a('0x1b')]({'where':{'id':_0x1d54a9[_0x056a('0x3e')]['id']}})[_0x056a('0x10')](handleEntityNotFound(_0x262903,null))[_0x056a('0x10')](removeEntity(_0x262903,null))['catch'](handleError(_0x262903,null));};exports[_0x056a('0x40')]=function(_0x29f7a9,_0x3c1a26){if(_0x29f7a9[_0x056a('0x41')][_0x056a('0x1a')]===_0x056a('0x14')&&!_[_0x056a('0x42')](_0x29f7a9[_0x056a('0x41')][_0x056a('0x43')],'_')){_0x29f7a9['body']['exten']='_'[_0x056a('0x44')](_0x29f7a9[_0x056a('0x41')][_0x056a('0x43')]);}return db[_0x056a('0x24')]['create'](_0x29f7a9[_0x056a('0x41')],{'raw':![]})[_0x056a('0x10')](function(_0x290c24){var _0x371ef1=_0x29f7a9[_0x056a('0x45')][_0x056a('0x11')]({'plain':!![]});if(!_0x371ef1)throw new Error(_0x056a('0x46'));if(_0x371ef1[_0x056a('0x47')]===_0x056a('0x45')){var _0x570554=_0x290c24[_0x056a('0x11')]({'plain':!![]});var _0x3d8eb2=[{'name':_0x056a('0x48'),'value':_0x056a('0x12')},{'name':'OutboundRoutes','value':_0x056a('0x14')},{'name':_0x056a('0x15'),'value':_0x056a('0x16')}];var _0x499f96=_[_0x056a('0x1b')](_0x3d8eb2,[_0x056a('0x18'),_0x570554[_0x056a('0x1a')]])[_0x056a('0x1c')];return db[_0x056a('0x49')][_0x056a('0x1b')]({'where':{'name':_0x499f96,'userProfileId':_0x371ef1['userProfileId']},'raw':!![]})[_0x056a('0x10')](function(_0x255dd8){if(_0x255dd8&&_0x255dd8[_0x056a('0x4a')]===0x0){return db[_0x056a('0x1d')][_0x056a('0x40')]({'name':_0x570554[_0x056a('0x1c')],'resourceId':_0x570554['id'],'type':_0x255dd8[_0x056a('0x1c')],'sectionId':_0x255dd8['id']},{})[_0x056a('0x10')](function(){return _0x290c24;});}else{return _0x290c24;}})['catch'](function(_0x279fc1){logger[_0x056a('0x20')](_0x056a('0x4b'),_0x279fc1);throw _0x279fc1;});}return _0x290c24;})[_0x056a('0x10')](respondWithResult(_0x3c1a26,0xc9))[_0x056a('0x3c')](handleError(_0x3c1a26,null));};exports[_0x056a('0x4c')]=function(_0xdc9be4,_0x4f6b81){if(_0xdc9be4['body']['id']){delete _0xdc9be4[_0x056a('0x41')]['id'];}return db[_0x056a('0x24')][_0x056a('0x1b')]({'where':{'id':_0xdc9be4[_0x056a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4f6b81,null))[_0x056a('0x10')](function(_0x2c1350){if(_0x2c1350){return db[_0x056a('0x24')][_0x056a('0x4c')](_[_0x056a('0x4d')](_0xdc9be4['body'],['exten','context','description',_0x056a('0x4e'),_0x056a('0x4f'),_0x056a('0x50'),_0x056a('0x51')]),{'where':{'context':_0x2c1350['context'],'exten':_0x2c1350[_0x056a('0x43')]},'individualHooks':!![]})[_0x056a('0x10')](function(_0xe248bb){return _0xe248bb;});}return null;})[_0x056a('0x10')](respondWithStatusCode(_0x4f6b81,null))[_0x056a('0x3c')](handleError(_0x4f6b81,null));};exports[_0x056a('0x52')]=function(_0x3d983e,_0x4f5ba2){var _0x103e97=_0x3d983e[_0x056a('0x3e')]['id'];var _0x146b25=_0x3d983e[_0x056a('0x41')];var _0x1e7b8b=0xc8;var _0x1e8ba3=null;return db[_0x056a('0x53')]['transaction']({'isolationLevel':db[_0x056a('0x53')][_0x056a('0x54')][_0x056a('0x55')][_0x056a('0x56')]},function(_0x58d243){return db[_0x056a('0x24')]['findOne']({'where':{'id':_0x103e97},'transaction':_0x58d243})[_0x056a('0x10')](function(_0x10fbf3){if(_0x10fbf3){return db[_0x056a('0x24')][_0x056a('0x1e')]({'where':{'VoiceExtensionId':_0x103e97},'transaction':_0x58d243})[_0x056a('0x10')](function(){var _0x259f3a=_[_0x056a('0x23')](_0x146b25,function(_0xb8fb62){_0xb8fb62[_0x056a('0x57')]=_0x103e97;_0xb8fb62['isApp']=!![];return _0xb8fb62;});return _0x10fbf3[_0x056a('0x58')](_0x259f3a);})[_0x056a('0x10')](function(_0x56acb7){return db[_0x056a('0x24')]['bulkCreate'](_0x56acb7,{'transaction':_0x58d243});});}else{_0x1e7b8b=0x194;_0x1e8ba3=[];}});})[_0x056a('0x10')](function(){if(_0x1e7b8b!==0x194){return db[_0x056a('0x24')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x103e97},'order':_0x056a('0x59')})[_0x056a('0x10')](function(_0x47f3cb){_0x1e8ba3=_0x47f3cb;});}})[_0x056a('0x3c')](function(_0xd99e98){_0x1e7b8b=0x1f4;logger['error'](_0xd99e98[_0x056a('0x21')]);if(_0xd99e98[_0x056a('0x1c')]){delete _0xd99e98['name'];}_0x1e8ba3=_0xd99e98;})['finally'](function(){if(_0x1e8ba3===null){_0x4f5ba2['sendStatus'](_0x1e7b8b);}else{if(_0x1e7b8b===0x1f4){_0x4f5ba2['status'](_0x1e7b8b)[_0x056a('0x5a')](_0x1e8ba3);}else{_0x4f5ba2[_0x056a('0x9')](_0x1e7b8b)[_0x056a('0xa')](_0x1e8ba3);}}});}; \ No newline at end of file +var _0xa5c4=['fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','VoiceExtension','includeAll','include','findAll','show','keys','options','params','catch','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','outbound','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','destroy','then','get','inbound','InternalRoutes','internal','ignore','value','includes','find','type','name','stack','send','index','rawAttributes','fieldName','map','intersection','query','attributes','model'];(function(_0x14c72c,_0x144c34){var _0x1b293c=function(_0x47f7f8){while(--_0x47f7f8){_0x14c72c['push'](_0x14c72c['shift']());}};_0x1b293c(++_0x144c34);}(_0xa5c4,0x18e));var _0x4a5c=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0xa5c4[_0x5ca5bc];return _0x26ca86;};'use strict';var _=require(_0x4a5c('0x0'));var Redis=require(_0x4a5c('0x1'));var qs=require(_0x4a5c('0x2'));var logger=require(_0x4a5c('0x3'))('api');var config=require(_0x4a5c('0x4'));var db=require(_0x4a5c('0x5'))['db'];config[_0x4a5c('0x6')]=_[_0x4a5c('0x7')](config[_0x4a5c('0x6')],{'host':_0x4a5c('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a5c('0x6')]));require(_0x4a5c('0x9'))[_0x4a5c('0xa')](socket);function respondWithStatusCode(_0x383687,_0x5c004f){_0x5c004f=_0x5c004f||0xcc;return function(_0x36d49d){if(_0x36d49d){return _0x383687[_0x4a5c('0xb')](_0x5c004f);}return _0x383687[_0x4a5c('0xc')](_0x5c004f)[_0x4a5c('0xd')]();};}function respondWithResult(_0x358c7f,_0x4a07d2){_0x4a07d2=_0x4a07d2||0xc8;return function(_0x43dc79){if(_0x43dc79){return _0x358c7f['status'](_0x4a07d2)['json'](_0x43dc79);}};}function respondWithFilteredResult(_0x10302f,_0x2bb0fc){return function(_0x3d5931){if(_0x3d5931){var _0x4c2f3b=typeof _0x2bb0fc[_0x4a5c('0xe')]===_0x4a5c('0xf')&&typeof _0x2bb0fc[_0x4a5c('0x10')]===_0x4a5c('0xf');var _0x4ecb5a=_0x3d5931[_0x4a5c('0x11')];var _0x257cad=_0x4c2f3b?0x0:_0x2bb0fc[_0x4a5c('0xe')];var _0x483e7a=_0x4c2f3b?_0x3d5931[_0x4a5c('0x11')]:_0x2bb0fc[_0x4a5c('0xe')]+_0x2bb0fc[_0x4a5c('0x10')];var _0x59664c;if(_0x483e7a>=_0x4ecb5a){_0x483e7a=_0x4ecb5a;_0x59664c=0xc8;}else{_0x59664c=0xce;}_0x10302f[_0x4a5c('0xc')](_0x59664c);return _0x10302f[_0x4a5c('0x12')]('Content-Range',_0x257cad+'-'+_0x483e7a+'/'+_0x4ecb5a)[_0x4a5c('0x13')](_0x3d5931);}return null;};}function removeEntity(_0x3096d8){return function(_0x258cce){if(_0x258cce){return _0x258cce[_0x4a5c('0x14')]()[_0x4a5c('0x15')](function(){var _0x2c36f0=_0x258cce[_0x4a5c('0x16')]({'plain':!![]});var _0x57289c=[{'name':'InboundRoutes','value':_0x4a5c('0x17'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0x4a5c('0x18'),'value':_0x4a5c('0x19'),'ignore':![]}];var _0x18b147=_(_0x57289c)['filter'](_0x4a5c('0x1a'))['map'](_0x4a5c('0x1b'))[_0x4a5c('0x1b')]();if(_[_0x4a5c('0x1c')](_0x18b147,_0x2c36f0['type'])){return;}var _0x5c9be8=_[_0x4a5c('0x1d')](_0x57289c,['value',_0x2c36f0[_0x4a5c('0x1e')]])[_0x4a5c('0x1f')];return db['UserProfileResource'][_0x4a5c('0x14')]({'where':{'type':_0x5c9be8,'resourceId':_0x2c36f0['id']}})[_0x4a5c('0x15')](function(){return _0x258cce;});})[_0x4a5c('0x15')](function(){_0x3096d8[_0x4a5c('0xc')](0xcc)[_0x4a5c('0xd')]();});}};}function handleEntityNotFound(_0x5e8040){return function(_0x3025ac){if(!_0x3025ac){_0x5e8040['sendStatus'](0x194);}return _0x3025ac;};}function handleError(_0x5dec75,_0x2ea6c8){_0x2ea6c8=_0x2ea6c8||0x1f4;return function(_0x3edfc8){logger['error'](_0x3edfc8[_0x4a5c('0x20')]);if(_0x3edfc8[_0x4a5c('0x1f')]){delete _0x3edfc8['name'];}_0x5dec75[_0x4a5c('0xc')](_0x2ea6c8)[_0x4a5c('0x21')](_0x3edfc8);};}exports[_0x4a5c('0x22')]=function(_0x559a71,_0x57cc83){var _0x1b8395={},_0x5ef0bb={},_0xba4c3e={'count':0x0,'rows':[]};var _0x197503=_['map'](db['VoiceExtension'][_0x4a5c('0x23')],function(_0xde474){return{'name':_0xde474[_0x4a5c('0x24')],'type':_0xde474['type']['key']};});_0x5ef0bb['model']=_[_0x4a5c('0x25')](_0x197503,_0x4a5c('0x1f'));_0x5ef0bb['query']=_['keys'](_0x559a71['query']);_0x5ef0bb['filters']=_[_0x4a5c('0x26')](_0x5ef0bb['model'],_0x5ef0bb[_0x4a5c('0x27')]);_0x1b8395[_0x4a5c('0x28')]=_[_0x4a5c('0x26')](_0x5ef0bb[_0x4a5c('0x29')],qs[_0x4a5c('0x2a')](_0x559a71['query'][_0x4a5c('0x2a')]));_0x1b8395[_0x4a5c('0x28')]=_0x1b8395['attributes']['length']?_0x1b8395[_0x4a5c('0x28')]:_0x5ef0bb[_0x4a5c('0x29')];if(!_0x559a71[_0x4a5c('0x27')][_0x4a5c('0x2b')](_0x4a5c('0x2c'))){_0x1b8395[_0x4a5c('0x10')]=qs[_0x4a5c('0x10')](_0x559a71[_0x4a5c('0x27')][_0x4a5c('0x10')]);_0x1b8395[_0x4a5c('0xe')]=qs[_0x4a5c('0xe')](_0x559a71[_0x4a5c('0x27')][_0x4a5c('0xe')]);}_0x1b8395['order']=qs[_0x4a5c('0x2d')](_0x559a71[_0x4a5c('0x27')][_0x4a5c('0x2d')]);_0x1b8395['where']=qs[_0x4a5c('0x2e')](_[_0x4a5c('0x2f')](_0x559a71[_0x4a5c('0x27')],_0x5ef0bb[_0x4a5c('0x2e')]),_0x197503);if(_0x559a71[_0x4a5c('0x27')][_0x4a5c('0x30')]){_0x1b8395[_0x4a5c('0x31')]=_['merge'](_0x1b8395['where'],{'$or':_['map'](_0x197503,function(_0x4d6567){if(_0x4d6567[_0x4a5c('0x1e')]!==_0x4a5c('0x32')){var _0x23777c={};_0x23777c[_0x4d6567[_0x4a5c('0x1f')]]={'$like':'%'+_0x559a71[_0x4a5c('0x27')][_0x4a5c('0x30')]+'%'};return _0x23777c;}})});}_0x1b8395=_[_0x4a5c('0x33')]({},_0x1b8395,_0x559a71['options']);var _0x40f101={'where':_0x1b8395[_0x4a5c('0x31')]};return db[_0x4a5c('0x34')][_0x4a5c('0x11')](_0x40f101)[_0x4a5c('0x15')](function(_0x3374bf){_0xba4c3e[_0x4a5c('0x11')]=_0x3374bf;if(_0x559a71[_0x4a5c('0x27')][_0x4a5c('0x35')]){_0x1b8395[_0x4a5c('0x36')]=[{'all':!![]}];}return db[_0x4a5c('0x34')][_0x4a5c('0x37')](_0x1b8395);})['then'](function(_0x1bbc33){_0xba4c3e['rows']=_0x1bbc33;return _0xba4c3e;})[_0x4a5c('0x15')](respondWithFilteredResult(_0x57cc83,_0x1b8395))['catch'](handleError(_0x57cc83,null));};exports[_0x4a5c('0x38')]=function(_0x8f6a82,_0x2037ff){var _0x3efea1={'raw':![],'where':{'id':_0x8f6a82['params']['id']}},_0x80122b={};_0x80122b[_0x4a5c('0x29')]=_['keys'](db[_0x4a5c('0x34')][_0x4a5c('0x23')]);_0x80122b['query']=_[_0x4a5c('0x39')](_0x8f6a82['query']);_0x80122b[_0x4a5c('0x2e')]=_[_0x4a5c('0x26')](_0x80122b[_0x4a5c('0x29')],_0x80122b[_0x4a5c('0x27')]);_0x3efea1[_0x4a5c('0x28')]=_[_0x4a5c('0x26')](_0x80122b['model'],qs[_0x4a5c('0x2a')](_0x8f6a82['query'][_0x4a5c('0x2a')]));_0x3efea1[_0x4a5c('0x28')]=_0x3efea1[_0x4a5c('0x28')]['length']?_0x3efea1['attributes']:_0x80122b[_0x4a5c('0x29')];if(_0x8f6a82['query'][_0x4a5c('0x35')]){_0x3efea1[_0x4a5c('0x36')]=[{'all':!![]}];}_0x3efea1=_[_0x4a5c('0x33')]({},_0x3efea1,_0x8f6a82[_0x4a5c('0x3a')]);return db[_0x4a5c('0x34')][_0x4a5c('0x1d')](_0x3efea1)[_0x4a5c('0x15')](handleEntityNotFound(_0x2037ff,null))[_0x4a5c('0x15')](respondWithResult(_0x2037ff,null))['catch'](handleError(_0x2037ff,null));};exports[_0x4a5c('0x14')]=function(_0x19b43e,_0x304719){return db[_0x4a5c('0x34')][_0x4a5c('0x1d')]({'where':{'id':_0x19b43e[_0x4a5c('0x3b')]['id']}})[_0x4a5c('0x15')](handleEntityNotFound(_0x304719,null))['then'](removeEntity(_0x304719,null))[_0x4a5c('0x3c')](handleError(_0x304719,null));};exports[_0x4a5c('0x3d')]=function(_0x57d883,_0x4164dc){if(_0x57d883[_0x4a5c('0x3e')]['type']==='outbound'&&!_[_0x4a5c('0x3f')](_0x57d883[_0x4a5c('0x3e')][_0x4a5c('0x40')],'_')){_0x57d883[_0x4a5c('0x3e')][_0x4a5c('0x40')]='_'['concat'](_0x57d883[_0x4a5c('0x3e')][_0x4a5c('0x40')]);}return db[_0x4a5c('0x34')][_0x4a5c('0x3d')](_0x57d883['body'],{'raw':![]})[_0x4a5c('0x15')](function(_0x113535){var _0x1c42ba=_0x57d883['user']['get']({'plain':!![]});if(!_0x1c42ba)throw new Error(_0x4a5c('0x41'));if(_0x1c42ba['role']==='user'){var _0x21868c=_0x113535[_0x4a5c('0x16')]({'plain':!![]});var _0x5c9553=[{'name':_0x4a5c('0x42'),'value':_0x4a5c('0x17')},{'name':'OutboundRoutes','value':_0x4a5c('0x43')},{'name':_0x4a5c('0x18'),'value':_0x4a5c('0x19')}];var _0x31c077=_[_0x4a5c('0x1d')](_0x5c9553,[_0x4a5c('0x1b'),_0x21868c[_0x4a5c('0x1e')]])[_0x4a5c('0x1f')];return db[_0x4a5c('0x44')][_0x4a5c('0x1d')]({'where':{'name':_0x31c077,'userProfileId':_0x1c42ba[_0x4a5c('0x45')]},'raw':!![]})['then'](function(_0x2441b2){if(_0x2441b2&&_0x2441b2['autoAssociation']===0x0){return db[_0x4a5c('0x46')][_0x4a5c('0x3d')]({'name':_0x21868c[_0x4a5c('0x1f')],'resourceId':_0x21868c['id'],'type':_0x2441b2['name'],'sectionId':_0x2441b2['id']},{})[_0x4a5c('0x15')](function(){return _0x113535;});}else{return _0x113535;}})[_0x4a5c('0x3c')](function(_0x354746){logger[_0x4a5c('0x47')](_0x4a5c('0x48'),_0x354746);throw _0x354746;});}return _0x113535;})[_0x4a5c('0x15')](respondWithResult(_0x4164dc,0xc9))[_0x4a5c('0x3c')](handleError(_0x4164dc,null));};exports[_0x4a5c('0x49')]=function(_0x4e6ac7,_0x951fac){if(_0x4e6ac7[_0x4a5c('0x3e')]['id']){delete _0x4e6ac7[_0x4a5c('0x3e')]['id'];}return db['VoiceExtension'][_0x4a5c('0x1d')]({'where':{'id':_0x4e6ac7[_0x4a5c('0x3b')]['id']}})[_0x4a5c('0x15')](handleEntityNotFound(_0x951fac,null))[_0x4a5c('0x15')](function(_0x35b52b){if(_0x35b52b){return db['VoiceExtension'][_0x4a5c('0x49')](_[_0x4a5c('0x2f')](_0x4e6ac7[_0x4a5c('0x3e')],[_0x4a5c('0x40'),_0x4a5c('0x4a'),_0x4a5c('0x4b'),_0x4a5c('0x4c'),'cutdigits',_0x4a5c('0x4d'),'alias']),{'where':{'context':_0x35b52b[_0x4a5c('0x4a')],'exten':_0x35b52b[_0x4a5c('0x40')]},'individualHooks':!![]})[_0x4a5c('0x15')](function(_0x368dee){return _0x368dee;});}return null;})[_0x4a5c('0x15')](respondWithStatusCode(_0x951fac,null))[_0x4a5c('0x3c')](handleError(_0x951fac,null));};exports[_0x4a5c('0x4e')]=function(_0x572c29,_0x22510e){var _0x5389f2=_0x572c29[_0x4a5c('0x3b')]['id'];var _0x1c863c=_0x572c29[_0x4a5c('0x3e')];var _0x1d095f=0xc8;var _0x3a9491=null;return db[_0x4a5c('0x4f')]['transaction']({'isolationLevel':db[_0x4a5c('0x4f')]['Transaction'][_0x4a5c('0x50')][_0x4a5c('0x51')]},function(_0x595240){return db['VoiceExtension'][_0x4a5c('0x52')]({'where':{'id':_0x5389f2},'transaction':_0x595240})[_0x4a5c('0x15')](function(_0x52a828){if(_0x52a828){return db[_0x4a5c('0x34')][_0x4a5c('0x14')]({'where':{'VoiceExtensionId':_0x5389f2},'transaction':_0x595240})[_0x4a5c('0x15')](function(){var _0x364713=_[_0x4a5c('0x25')](_0x1c863c,function(_0x11ecd9){_0x11ecd9[_0x4a5c('0x53')]=_0x5389f2;_0x11ecd9[_0x4a5c('0x54')]=!![];return _0x11ecd9;});return _0x52a828['createRouting'](_0x364713);})[_0x4a5c('0x15')](function(_0x1267e9){return db[_0x4a5c('0x34')][_0x4a5c('0x55')](_0x1267e9,{'transaction':_0x595240});});}else{_0x1d095f=0x194;_0x3a9491=[];}});})[_0x4a5c('0x15')](function(){if(_0x1d095f!==0x194){return db[_0x4a5c('0x34')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x5389f2},'order':_0x4a5c('0x56')})['then'](function(_0x5c52a8){_0x3a9491=_0x5c52a8;});}})[_0x4a5c('0x3c')](function(_0x16c282){_0x1d095f=0x1f4;logger[_0x4a5c('0x47')](_0x16c282[_0x4a5c('0x20')]);if(_0x16c282[_0x4a5c('0x1f')]){delete _0x16c282['name'];}_0x3a9491=_0x16c282;})[_0x4a5c('0x57')](function(){if(_0x3a9491===null){_0x22510e['sendStatus'](_0x1d095f);}else{if(_0x1d095f===0x1f4){_0x22510e[_0x4a5c('0xc')](_0x1d095f)[_0x4a5c('0x21')](_0x3a9491);}else{_0x22510e['status'](_0x1d095f)[_0x4a5c('0x13')](_0x3a9491);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index d41fa0e..6a95dbd 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 _0x6fdb=['emit','hook','events','VoiceExtension','setMaxListeners','remove'];(function(_0x11b6b9,_0x26c36e){var _0x856e08=function(_0x5ab1ec){while(--_0x5ab1ec){_0x11b6b9['push'](_0x11b6b9['shift']());}};_0x856e08(++_0x26c36e);}(_0x6fdb,0xce));var _0xb6fd=function(_0x3fbc51,_0x26fdd7){_0x3fbc51=_0x3fbc51-0x0;var _0x5833d3=_0x6fdb[_0x3fbc51];return _0x5833d3;};'use strict';var EventEmitter=require(_0xb6fd('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xb6fd('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb6fd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb6fd('0x3')};function emitEvent(_0x2f3227){return function(_0x239bf8,_0x118209,_0x1d83b7){VoiceExtensionEvents[_0xb6fd('0x4')](_0x2f3227+':'+_0x239bf8['id'],_0x239bf8);VoiceExtensionEvents[_0xb6fd('0x4')](_0x2f3227,_0x239bf8);_0x1d83b7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xb6fd('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x7248=['hasOwnProperty','hook','setMaxListeners','update','remove','emit'];(function(_0x4bb1b3,_0x446a44){var _0x6b3651=function(_0x1f0a7b){while(--_0x1f0a7b){_0x4bb1b3['push'](_0x4bb1b3['shift']());}};_0x6b3651(++_0x446a44);}(_0x7248,0x164));var _0x8724=function(_0x597bf3,_0x3a2bd8){_0x597bf3=_0x597bf3-0x0;var _0x4db0db=_0x7248[_0x597bf3];return _0x4db0db;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x8724('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8724('0x1'),'afterDestroy':_0x8724('0x2')};function emitEvent(_0x116f19){return function(_0x21fa72,_0xc79176,_0x49dd3e){VoiceExtensionEvents[_0x8724('0x3')](_0x116f19+':'+_0x21fa72['id'],_0x21fa72);VoiceExtensionEvents[_0x8724('0x3')](_0x116f19,_0x21fa72);_0x49dd3e(null);};}for(var e in events){if(events[_0x8724('0x4')](e)){var event=events[e];VoiceExtension[_0x8724('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index ffb4949..42838ce 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 _0x1f9c=['$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','appType','agi','priority','catch','VoiceExtension','voice_extensions','get','concat','Hangup','last','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','push','inbound','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','split','length','name','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','Interval','interval','IntervalId','then','*,*,*,*','intervals','map','filter','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','answer','queue','playback','includes','app','ExecIf','XCALLY-MOTION-ANSWER=1'];(function(_0x3ee827,_0x527aa4){var _0x1aa11c=function(_0x3fbc98){while(--_0x3fbc98){_0x3ee827['push'](_0x3ee827['shift']());}};_0x1aa11c(++_0x527aa4);}(_0x1f9c,0xad));var _0xc1f9=function(_0x43b9ea,_0x280d55){_0x43b9ea=_0x43b9ea-0x0;var _0x4a55ca=_0x1f9c[_0x43b9ea];return _0x4a55ca;};'use strict';var _=require(_0xc1f9('0x0'));var attributes=require(_0xc1f9('0x1'));module[_0xc1f9('0x2')]=function(_0x5efa1c){var _0x9f0756=_0x5efa1c[_0xc1f9('0x3')];function _0x5072ae(_0x2f6a2e){var _0x6abe08=0x2;var _0x17027b=[{'type':_0x2f6a2e[_0xc1f9('0x4')],'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0x6')+_0x2f6a2e[_0xc1f9('0x4')],'context':_0x2f6a2e[_0xc1f9('0x7')],'exten':_0x2f6a2e[_0xc1f9('0x8')],'priority':_0x6abe08++,'VoiceExtensionId':_0x2f6a2e['id']}];if(_0x2f6a2e['type']==='inbound'){_0x17027b[_0xc1f9('0x9')]({'type':_0xc1f9('0xa'),'app':_0xc1f9('0x5'),'appdata':'CDR(routeid)='+_0x2f6a2e['id'],'context':_0x2f6a2e[_0xc1f9('0x7')],'exten':_0x2f6a2e[_0xc1f9('0x8')],'priority':_0x6abe08++,'VoiceExtensionId':_0x2f6a2e['id']});}_0x17027b[_0xc1f9('0x9')]({'type':_0x2f6a2e[_0xc1f9('0x4')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2f6a2e[_0xc1f9('0x7')],'exten':_0x2f6a2e[_0xc1f9('0x8')],'priority':_0x6abe08++,'VoiceExtensionId':_0x2f6a2e['id']},{'type':_0x2f6a2e[_0xc1f9('0x4')],'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0xb'),'context':_0x2f6a2e[_0xc1f9('0x7')],'exten':_0x2f6a2e[_0xc1f9('0x8')],'priority':_0x6abe08++,'VoiceExtensionId':_0x2f6a2e['id']},{'type':_0x2f6a2e['type'],'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0xc'),'context':_0x2f6a2e['context'],'exten':_0x2f6a2e[_0xc1f9('0x8')],'priority':_0x6abe08++,'VoiceExtensionId':_0x2f6a2e['id']});return _0x17027b;}function _0x2704b7(_0x305a16){var _0x1d053e=0x2;var _0x484b1b=[{'type':_0xc1f9('0xd'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x305a16['context'],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':_0xc1f9('0x5'),'appdata':'CDR(destination)='+(_0x305a16[_0xc1f9('0xe')]?_0xc1f9('0xf')+_0x305a16[_0xc1f9('0xe')]+'}':_0xc1f9('0x10')),'context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0x11')+_0x305a16['id'],'context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16['exten'],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':'ExecIf','appdata':_0xc1f9('0x12')+(_0x1d053e+0x2)+'):Goto('+(_0x1d053e+0x1)+')','context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':_0xc1f9('0x5'),'appdata':_0x305a16[_0xc1f9('0xe')]?_0xc1f9('0x13')+_0x305a16['cutdigits']+'}':_0xc1f9('0x14'),'context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':'Set','appdata':_0xc1f9('0x15'),'context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0xb'),'context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':_0xc1f9('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':'Set','appdata':_0xc1f9('0x16')+_0x305a16['id'],'context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']}];if(_0x305a16['hasOwnProperty'](_0xc1f9('0x17'))&&_0x305a16[_0xc1f9('0x17')]!==_0xc1f9('0x18')){_0x484b1b[_0xc1f9('0x9')]({'type':_0xc1f9('0xd'),'app':_0xc1f9('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']},{'type':_0xc1f9('0xd'),'app':'Set','appdata':_0xc1f9('0x19')+_0x305a16[_0xc1f9('0x17')]||_0xc1f9('0x1a'),'context':_0x305a16[_0xc1f9('0x7')],'exten':_0x305a16[_0xc1f9('0x8')],'priority':_0x1d053e++,'VoiceExtensionId':_0x305a16['id']});}return _0x484b1b;}function _0x6d4b50(_0x51f3db,_0x484de6){var _0x5b2977=[{'name':_0xc1f9('0x1b'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xc1f9('0x1c'),'param':0x2},{'name':_0xc1f9('0x1d'),'param':0x3}];var _0x25d461={};var _0x4e5e87=_0x484de6[_0xc1f9('0x1e')](',');var _0x176a5d=[];for(var _0x1c220e=0x0;_0x1c220e<_0x5b2977[_0xc1f9('0x1f')];_0x1c220e++){switch(_0x5b2977[_0x1c220e][_0xc1f9('0x20')]){case'trunk':_0x25d461[_0xc1f9('0x1b')]=_0x4e5e87[_0x5b2977[_0x1c220e][_0xc1f9('0x21')]][_0xc1f9('0x1e')]('/')[0x1];_0x25d461[_0xc1f9('0x22')]=_0x4e5e87[_0x5b2977[_0x1c220e][_0xc1f9('0x21')]][_0xc1f9('0x1e')]('/')[0x2];_0x25d461['prefix']=_0x25d461['phone']?_0x25d461[_0xc1f9('0x22')][_0xc1f9('0x1e')]('$')[0x0]:undefined;_0x25d461[_0xc1f9('0x22')]=_0x51f3db['cutdigits']?(_0x25d461['prefix']||'')+_0xc1f9('0xf')+_0x51f3db[_0xc1f9('0xe')]+'}':(_0x25d461[_0xc1f9('0x23')]||'')+_0xc1f9('0x10');_0x176a5d[_0x5b2977[_0x1c220e][_0xc1f9('0x21')]]=[_0xc1f9('0x24'),_0x25d461[_0xc1f9('0x1b')],_0x25d461[_0xc1f9('0x22')]][_0xc1f9('0x25')]('/');break;case'options':_0x25d461['options']=_0x4e5e87[_0x5b2977[_0x1c220e][_0xc1f9('0x21')]];if(_0x51f3db[_0xc1f9('0x17')]!==_0xc1f9('0x18')){if(_0x25d461[_0xc1f9('0x1c')][_0xc1f9('0x26')](_0xc1f9('0x27'))<0x0){_0x25d461[_0xc1f9('0x1c')]+=_0xc1f9('0x27');}}else{_0x25d461[_0xc1f9('0x1c')]=_0x25d461[_0xc1f9('0x1c')]['replace'](_0xc1f9('0x27'),'');}_0x176a5d[_0x5b2977[_0x1c220e][_0xc1f9('0x21')]]=_0x25d461[_0xc1f9('0x1c')];break;default:_0x176a5d[_0x5b2977[_0x1c220e]['param']]=_0x4e5e87[_0x5b2977[_0x1c220e][_0xc1f9('0x21')]];}}return _0x176a5d[_0xc1f9('0x25')](',');}function _0x143b05(_0x2bdb45,_0x38e572,_0x2a7def){return new Promise(function(_0x514aaf,_0xb32737){var _0x4b5f29=[];if(_['isEmpty'](_0x38e572))return _0x514aaf(_0x4b5f29);_0x9f0756[_0xc1f9('0x28')]['findAll']({'attributes':['id',_0xc1f9('0x29'),_0xc1f9('0x2a')],'raw':!![]})[_0xc1f9('0x2b')](function(_0x1eb2ff){for(var _0xa9bdb6=0x0,_0x2ec3ad=0x0;_0xa9bdb6<_0x38e572[_0xc1f9('0x1f')];_0xa9bdb6++,_0x2ec3ad=0x0){var _0x522392=_0x38e572[_0xa9bdb6];var _0x1d487b=[];var _0x4d1776=[];delete _0x522392['id'];if(_0x522392['interval']!==_0xc1f9('0x2c')){_0x522392[_0xc1f9('0x2d')]=[_0x522392[_0xc1f9('0x29')]];}else{_0x522392[_0xc1f9('0x2d')]=_0x522392[_0xc1f9('0x2a')]?_[_0xc1f9('0x2e')](_[_0xc1f9('0x2f')](_0x1eb2ff,{'IntervalId':_0x522392[_0xc1f9('0x2a')]}),_0xc1f9('0x29')):[];}_0x522392[_0xc1f9('0x7')]=_0x2bdb45['context'];_0x522392[_0xc1f9('0x8')]=_0x2bdb45[_0xc1f9('0x8')];if(_0x522392[_0xc1f9('0x4')])_0x522392[_0xc1f9('0x4')]=_0x522392['type']['toLowerCase']();if(_0x2bdb45[_0xc1f9('0x4')]==='outbound'){if(_0x522392['hasOwnProperty'](_0xc1f9('0x30'))&&_0x522392[_0xc1f9('0x30')]&&_0x522392[_0xc1f9('0x30')]!=='--'){_0x1d487b[_0xc1f9('0x9')]({'type':_0x522392[_0xc1f9('0x4')][_0xc1f9('0x31')](),'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0x32')+_0x522392['tag'],'context':_0x2bdb45[_0xc1f9('0x7')],'exten':_0x2bdb45[_0xc1f9('0x8')],'priority':_0x522392['intervals']['length']+_0x2a7def+_0x2ec3ad++,'VoiceExtensionId':_0x2bdb45['id']});}_0x1d487b[_0xc1f9('0x9')]({'type':_0x522392[_0xc1f9('0x4')][_0xc1f9('0x31')](),'app':'ExecIf','appdata':_0xc1f9('0x33')+(_0x522392['callerID']?_0xc1f9('0x34')+_0x522392[_0xc1f9('0x35')]+')':'NoOp(No\x20number\x20available)'),'context':_0x2bdb45[_0xc1f9('0x7')],'exten':_0x2bdb45['exten'],'priority':_0x522392[_0xc1f9('0x2d')]['length']+_0x2a7def+_0x2ec3ad++,'VoiceExtensionId':_0x2bdb45['id']});}else{if(_0x522392['hasOwnProperty'](_0xc1f9('0x36'))){if([_0xc1f9('0x37'),_0xc1f9('0x38')][_0xc1f9('0x39')](_0x522392[_0xc1f9('0x3a')][_0xc1f9('0x31')]())&&_0x522392['appType']!=='custom'){if(_0x522392[_0xc1f9('0x36')]){_0x1d487b[_0xc1f9('0x9')]({'type':_0x522392[_0xc1f9('0x4')][_0xc1f9('0x31')](),'app':_0xc1f9('0x3b'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2bdb45['context'],'exten':_0x2bdb45['exten'],'priority':_0x522392[_0xc1f9('0x2d')][_0xc1f9('0x1f')]+_0x2a7def+_0x2ec3ad++,'VoiceExtensionId':_0x2bdb45['id']});_0x1d487b[_0xc1f9('0x9')]({'type':_0x522392[_0xc1f9('0x4')][_0xc1f9('0x31')](),'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0x3c'),'context':_0x2bdb45[_0xc1f9('0x7')],'exten':_0x2bdb45[_0xc1f9('0x8')],'priority':_0x522392[_0xc1f9('0x2d')][_0xc1f9('0x1f')]+_0x2a7def+_0x2ec3ad++,'VoiceExtensionId':_0x2bdb45['id']});}else{_0x1d487b['push']({'type':_0x522392[_0xc1f9('0x4')][_0xc1f9('0x31')](),'app':_0xc1f9('0x3b'),'appdata':_0xc1f9('0x3d'),'context':_0x2bdb45[_0xc1f9('0x7')],'exten':_0x2bdb45[_0xc1f9('0x8')],'priority':_0x522392[_0xc1f9('0x2d')][_0xc1f9('0x1f')]+_0x2a7def+_0x2ec3ad++,'VoiceExtensionId':_0x2bdb45['id']});_0x1d487b[_0xc1f9('0x9')]({'type':_0x522392[_0xc1f9('0x4')][_0xc1f9('0x31')](),'app':_0xc1f9('0x5'),'appdata':_0xc1f9('0x3e'),'context':_0x2bdb45[_0xc1f9('0x7')],'exten':_0x2bdb45[_0xc1f9('0x8')],'priority':_0x522392[_0xc1f9('0x2d')]['length']+_0x2a7def+_0x2ec3ad++,'VoiceExtensionId':_0x2bdb45['id']});}}}}for(var _0x5629f2=0x0;_0x5629f2<_0x522392['intervals'][_0xc1f9('0x1f')];_0x5629f2++){var _0x2aef56=_0x2a7def+_0x522392[_0xc1f9('0x2d')][_0xc1f9('0x1f')];var _0x3646c0=_0x5629f2===_0x522392[_0xc1f9('0x2d')][_0xc1f9('0x1f')]-0x1?_0x2a7def+_0x1d487b['length']+_0x4d1776[_0xc1f9('0x1f')]+0x2:_0x2a7def+_0x5629f2+0x1;_0x1d487b[_0xc1f9('0x3f')](_0x5629f2,0x0,{'type':_0x2bdb45[_0xc1f9('0x4')],'app':_0xc1f9('0x40'),'appdata':_0x522392[_0xc1f9('0x2d')][_0x5629f2]+'?'+_0x2bdb45[_0xc1f9('0x7')]+_0xc1f9('0x41')+_0x2aef56+':'+_0x2bdb45['context']+',${EXTEN},'+_0x3646c0,'exten':_0x2bdb45[_0xc1f9('0x8')],'context':_0x2bdb45[_0xc1f9('0x7')],'priority':_0x2a7def+_0x5629f2,'VoiceExtensionId':_0x2bdb45['id']});}if(_0x522392['appType']===_0xc1f9('0x42')){_0x522392[_0xc1f9('0x43')]=_0x6d4b50(_0x2bdb45,_0x522392[_0xc1f9('0x43')]);}if(_0x522392[_0xc1f9('0x44')]===_0xc1f9('0x45')){_0x1d487b[_0xc1f9('0x9')]({'type':_0x522392[_0xc1f9('0x4')][_0xc1f9('0x31')](),'app':_0xc1f9('0x5'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x2bdb45[_0xc1f9('0x7')],'exten':_0x2bdb45[_0xc1f9('0x8')],'priority':_0x522392[_0xc1f9('0x2d')][_0xc1f9('0x1f')]+_0x2a7def+_0x2ec3ad++,'VoiceExtensionId':_0x2bdb45['id']});}_0x522392['priority']=_0x1d487b[_0xc1f9('0x1f')]?_['last'](_0x1d487b)['priority']+0x1:_0x2a7def;_0x4b5f29=_['concat'](_0x4b5f29,_0x1d487b,[_0x522392],_0x4d1776);_0x2a7def=_['last'](_0x4b5f29)[_0xc1f9('0x46')]+0x1;}return _0x514aaf(_0x4b5f29);})[_0xc1f9('0x47')](function(_0x1bf40f){_0xb32737(_0x1bf40f);});});}return _0x5efa1c['define'](_0xc1f9('0x48'),attributes,{'tableName':_0xc1f9('0x49'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3b30b6){var _0x27cff2=this[_0xc1f9('0x4a')]({'plain':!![]});var _0x28d4dc=_0x27cff2[_0xc1f9('0x4')]===_0xc1f9('0xd')?_0x2704b7(_0x27cff2):_0x5072ae(_0x27cff2);return _0x143b05(_0x27cff2,_0x3b30b6,_['last'](_0x28d4dc)[_0xc1f9('0x46')]+0x1)['then'](function(_0x5e89e0){var _0x2e9e48=_[_0xc1f9('0x4b')](_0x28d4dc,_0x5e89e0);_0x2e9e48[_0xc1f9('0x9')]({'type':_0x27cff2[_0xc1f9('0x4')],'app':_0xc1f9('0x4c'),'exten':_0x27cff2[_0xc1f9('0x8')],'context':_0x27cff2[_0xc1f9('0x7')],'priority':_[_0xc1f9('0x4d')](_0x2e9e48)[_0xc1f9('0x46')]+0x1,'VoiceExtensionId':_0x27cff2['id']});return _0x2e9e48;});}}});}; \ No newline at end of file +var _0xd468=['splice','GotoIfTime',',${EXTEN},','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','catch','define','VoiceExtension','voice_extensions','get','last','Hangup','exports','models','type','Set','CDR(type)=','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','phone','param','prefix','${EXTEN}','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress'];(function(_0x3f36ed,_0x38124c){var _0x402a89=function(_0x4d8924){while(--_0x4d8924){_0x3f36ed['push'](_0x3f36ed['shift']());}};_0x402a89(++_0x38124c);}(_0xd468,0x1e7));var _0x8d46=function(_0x46d232,_0x5ac7e5){_0x46d232=_0x46d232-0x0;var _0x52da0f=_0xd468[_0x46d232];return _0x52da0f;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0x8d46('0x0')]=function(_0x30702c){var _0x5619bb=_0x30702c[_0x8d46('0x1')];function _0x26a02c(_0x532446){var _0x2b380a=0x2;var _0x1aa77b=[{'type':_0x532446[_0x8d46('0x2')],'app':_0x8d46('0x3'),'appdata':_0x8d46('0x4')+_0x532446[_0x8d46('0x2')],'context':_0x532446[_0x8d46('0x5')],'exten':_0x532446[_0x8d46('0x6')],'priority':_0x2b380a++,'VoiceExtensionId':_0x532446['id']}];if(_0x532446[_0x8d46('0x2')]===_0x8d46('0x7')){_0x1aa77b[_0x8d46('0x8')]({'type':'inbound','app':_0x8d46('0x3'),'appdata':_0x8d46('0x9')+_0x532446['id'],'context':_0x532446['context'],'exten':_0x532446[_0x8d46('0x6')],'priority':_0x2b380a++,'VoiceExtensionId':_0x532446['id']});}_0x1aa77b['push']({'type':_0x532446[_0x8d46('0x2')],'app':_0x8d46('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x532446[_0x8d46('0x5')],'exten':_0x532446[_0x8d46('0x6')],'priority':_0x2b380a++,'VoiceExtensionId':_0x532446['id']},{'type':_0x532446[_0x8d46('0x2')],'app':_0x8d46('0x3'),'appdata':_0x8d46('0xa'),'context':_0x532446[_0x8d46('0x5')],'exten':_0x532446[_0x8d46('0x6')],'priority':_0x2b380a++,'VoiceExtensionId':_0x532446['id']},{'type':_0x532446[_0x8d46('0x2')],'app':_0x8d46('0x3'),'appdata':_0x8d46('0xb'),'context':_0x532446[_0x8d46('0x5')],'exten':_0x532446[_0x8d46('0x6')],'priority':_0x2b380a++,'VoiceExtensionId':_0x532446['id']});return _0x1aa77b;}function _0x4e8483(_0xdde72b){var _0x2ca4e4=0x2;var _0x2bfe32=[{'type':_0x8d46('0xc'),'app':'Set','appdata':_0x8d46('0xd'),'context':_0xdde72b['context'],'exten':_0xdde72b['exten'],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':'Set','appdata':_0x8d46('0xe')+(_0xdde72b[_0x8d46('0xf')]?_0x8d46('0x10')+_0xdde72b[_0x8d46('0xf')]+'}':'${EXTEN}'),'context':_0xdde72b[_0x8d46('0x5')],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':_0x8d46('0x3'),'appdata':_0x8d46('0x9')+_0xdde72b['id'],'context':_0xdde72b[_0x8d46('0x5')],'exten':_0xdde72b['exten'],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':_0x8d46('0x11'),'appdata':_0x8d46('0x12')+(_0x2ca4e4+0x2)+_0x8d46('0x13')+(_0x2ca4e4+0x1)+')','context':_0xdde72b[_0x8d46('0x5')],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':_0x8d46('0x3'),'appdata':_0xdde72b[_0x8d46('0xf')]?'CDR(prefix)=${EXTEN:0:'+_0xdde72b[_0x8d46('0xf')]+'}':_0x8d46('0x14'),'context':_0xdde72b[_0x8d46('0x5')],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':_0x8d46('0x3'),'appdata':_0x8d46('0x15'),'context':_0xdde72b[_0x8d46('0x5')],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':_0x8d46('0x3'),'appdata':_0x8d46('0xa'),'context':_0xdde72b['context'],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':'outbound','app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0xdde72b[_0x8d46('0x5')],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':_0x8d46('0x3'),'appdata':'outboundrouteid='+_0xdde72b['id'],'context':_0xdde72b['context'],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']}];if(_0xdde72b[_0x8d46('0x16')](_0x8d46('0x17'))&&_0xdde72b[_0x8d46('0x17')]!==_0x8d46('0x18')){_0x2bfe32['push']({'type':_0x8d46('0xc'),'app':_0x8d46('0x3'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xdde72b['context'],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']},{'type':_0x8d46('0xc'),'app':_0x8d46('0x3'),'appdata':_0x8d46('0x19')+_0xdde72b[_0x8d46('0x17')]||_0x8d46('0x1a'),'context':_0xdde72b[_0x8d46('0x5')],'exten':_0xdde72b[_0x8d46('0x6')],'priority':_0x2ca4e4++,'VoiceExtensionId':_0xdde72b['id']});}return _0x2bfe32;}function _0x4a13b6(_0x4fde7b,_0x2527f7){var _0x4056cc=[{'name':_0x8d46('0x1b'),'param':0x0},{'name':_0x8d46('0x1c'),'param':0x1},{'name':_0x8d46('0x1d'),'param':0x2},{'name':_0x8d46('0x1e'),'param':0x3}];var _0x40d321={};var _0xbd9018=_0x2527f7[_0x8d46('0x1f')](',');var _0x2ddcaf=[];for(var _0x2ce922=0x0;_0x2ce922<_0x4056cc['length'];_0x2ce922++){switch(_0x4056cc[_0x2ce922]['name']){case _0x8d46('0x1b'):_0x40d321[_0x8d46('0x1b')]=_0xbd9018[_0x4056cc[_0x2ce922]['param']][_0x8d46('0x1f')]('/')[0x1];_0x40d321[_0x8d46('0x20')]=_0xbd9018[_0x4056cc[_0x2ce922][_0x8d46('0x21')]][_0x8d46('0x1f')]('/')[0x2];_0x40d321[_0x8d46('0x22')]=_0x40d321['phone']?_0x40d321[_0x8d46('0x20')][_0x8d46('0x1f')]('$')[0x0]:undefined;_0x40d321[_0x8d46('0x20')]=_0x4fde7b[_0x8d46('0xf')]?(_0x40d321[_0x8d46('0x22')]||'')+_0x8d46('0x10')+_0x4fde7b[_0x8d46('0xf')]+'}':(_0x40d321[_0x8d46('0x22')]||'')+_0x8d46('0x23');_0x2ddcaf[_0x4056cc[_0x2ce922]['param']]=[_0x8d46('0x24'),_0x40d321[_0x8d46('0x1b')],_0x40d321[_0x8d46('0x20')]]['join']('/');break;case _0x8d46('0x1d'):_0x40d321['options']=_0xbd9018[_0x4056cc[_0x2ce922][_0x8d46('0x21')]];if(_0x4fde7b[_0x8d46('0x17')]!==_0x8d46('0x18')){if(_0x40d321['options'][_0x8d46('0x25')]('U(xcally-mixmonitor-context)')<0x0){_0x40d321[_0x8d46('0x1d')]+=_0x8d46('0x26');}}else{_0x40d321['options']=_0x40d321[_0x8d46('0x1d')][_0x8d46('0x27')](_0x8d46('0x26'),'');}_0x2ddcaf[_0x4056cc[_0x2ce922][_0x8d46('0x21')]]=_0x40d321[_0x8d46('0x1d')];break;default:_0x2ddcaf[_0x4056cc[_0x2ce922][_0x8d46('0x21')]]=_0xbd9018[_0x4056cc[_0x2ce922]['param']];}}return _0x2ddcaf[_0x8d46('0x28')](',');}function _0x36821e(_0x547adf,_0x576129,_0xce0cb){return new Promise(function(_0x33e489,_0x104786){var _0x26baba=[];if(_['isEmpty'](_0x576129))return _0x33e489(_0x26baba);_0x5619bb[_0x8d46('0x29')][_0x8d46('0x2a')]({'attributes':['id',_0x8d46('0x2b'),_0x8d46('0x2c')],'raw':!![]})[_0x8d46('0x2d')](function(_0x22fc5b){for(var _0x50b6f8=0x0,_0x441a5c=0x0;_0x50b6f8<_0x576129[_0x8d46('0x2e')];_0x50b6f8++,_0x441a5c=0x0){var _0x46cdba=_0x576129[_0x50b6f8];var _0x39ae73=[];var _0x18d7a6=[];delete _0x46cdba['id'];if(_0x46cdba[_0x8d46('0x2b')]!==_0x8d46('0x2f')){_0x46cdba[_0x8d46('0x30')]=[_0x46cdba[_0x8d46('0x2b')]];}else{_0x46cdba['intervals']=_0x46cdba[_0x8d46('0x2c')]?_[_0x8d46('0x31')](_[_0x8d46('0x32')](_0x22fc5b,{'IntervalId':_0x46cdba[_0x8d46('0x2c')]}),'interval'):[];}_0x46cdba[_0x8d46('0x5')]=_0x547adf['context'];_0x46cdba[_0x8d46('0x6')]=_0x547adf['exten'];if(_0x46cdba['type'])_0x46cdba[_0x8d46('0x2')]=_0x46cdba[_0x8d46('0x2')]['toLowerCase']();if(_0x547adf[_0x8d46('0x2')]===_0x8d46('0xc')){if(_0x46cdba[_0x8d46('0x16')](_0x8d46('0x33'))&&_0x46cdba[_0x8d46('0x33')]&&_0x46cdba[_0x8d46('0x33')]!=='--'){_0x39ae73[_0x8d46('0x8')]({'type':_0x46cdba[_0x8d46('0x2')][_0x8d46('0x34')](),'app':'Set','appdata':_0x8d46('0x35')+_0x46cdba['tag'],'context':_0x547adf[_0x8d46('0x5')],'exten':_0x547adf['exten'],'priority':_0x46cdba[_0x8d46('0x30')][_0x8d46('0x2e')]+_0xce0cb+_0x441a5c++,'VoiceExtensionId':_0x547adf['id']});}_0x39ae73[_0x8d46('0x8')]({'type':_0x46cdba[_0x8d46('0x2')][_0x8d46('0x34')](),'app':_0x8d46('0x11'),'appdata':_0x8d46('0x36')+(_0x46cdba[_0x8d46('0x37')]?_0x8d46('0x38')+_0x46cdba['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x547adf['context'],'exten':_0x547adf[_0x8d46('0x6')],'priority':_0x46cdba[_0x8d46('0x30')]['length']+_0xce0cb+_0x441a5c++,'VoiceExtensionId':_0x547adf['id']});}else{if(_0x46cdba[_0x8d46('0x16')](_0x8d46('0x39'))){if([_0x8d46('0x3a'),_0x8d46('0x3b')][_0x8d46('0x3c')](_0x46cdba['app'][_0x8d46('0x34')]())&&_0x46cdba[_0x8d46('0x3d')]!==_0x8d46('0x3e')){if(_0x46cdba[_0x8d46('0x39')]){_0x39ae73['push']({'type':_0x46cdba[_0x8d46('0x2')][_0x8d46('0x34')](),'app':_0x8d46('0x11'),'appdata':_0x8d46('0x3f'),'context':_0x547adf[_0x8d46('0x5')],'exten':_0x547adf[_0x8d46('0x6')],'priority':_0x46cdba['intervals'][_0x8d46('0x2e')]+_0xce0cb+_0x441a5c++,'VoiceExtensionId':_0x547adf['id']});_0x39ae73[_0x8d46('0x8')]({'type':_0x46cdba[_0x8d46('0x2')][_0x8d46('0x34')](),'app':'Set','appdata':_0x8d46('0x40'),'context':_0x547adf[_0x8d46('0x5')],'exten':_0x547adf[_0x8d46('0x6')],'priority':_0x46cdba['intervals']['length']+_0xce0cb+_0x441a5c++,'VoiceExtensionId':_0x547adf['id']});}else{_0x39ae73[_0x8d46('0x8')]({'type':_0x46cdba['type'][_0x8d46('0x34')](),'app':_0x8d46('0x11'),'appdata':_0x8d46('0x41'),'context':_0x547adf['context'],'exten':_0x547adf['exten'],'priority':_0x46cdba[_0x8d46('0x30')][_0x8d46('0x2e')]+_0xce0cb+_0x441a5c++,'VoiceExtensionId':_0x547adf['id']});_0x39ae73['push']({'type':_0x46cdba[_0x8d46('0x2')][_0x8d46('0x34')](),'app':_0x8d46('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x547adf[_0x8d46('0x5')],'exten':_0x547adf[_0x8d46('0x6')],'priority':_0x46cdba['intervals']['length']+_0xce0cb+_0x441a5c++,'VoiceExtensionId':_0x547adf['id']});}}}}for(var _0x34a03d=0x0;_0x34a03d<_0x46cdba[_0x8d46('0x30')]['length'];_0x34a03d++){var _0x550909=_0xce0cb+_0x46cdba['intervals'][_0x8d46('0x2e')];var _0x4f5b44=_0x34a03d===_0x46cdba[_0x8d46('0x30')][_0x8d46('0x2e')]-0x1?_0xce0cb+_0x39ae73['length']+_0x18d7a6[_0x8d46('0x2e')]+0x2:_0xce0cb+_0x34a03d+0x1;_0x39ae73[_0x8d46('0x42')](_0x34a03d,0x0,{'type':_0x547adf[_0x8d46('0x2')],'app':_0x8d46('0x43'),'appdata':_0x46cdba[_0x8d46('0x30')][_0x34a03d]+'?'+_0x547adf['context']+_0x8d46('0x44')+_0x550909+':'+_0x547adf[_0x8d46('0x5')]+_0x8d46('0x44')+_0x4f5b44,'exten':_0x547adf['exten'],'context':_0x547adf[_0x8d46('0x5')],'priority':_0xce0cb+_0x34a03d,'VoiceExtensionId':_0x547adf['id']});}if(_0x46cdba['appType']==='outboundDial'){_0x46cdba['appdata']=_0x4a13b6(_0x547adf,_0x46cdba['appdata']);}if(_0x46cdba[_0x8d46('0x3d')]==='agi'){_0x39ae73[_0x8d46('0x8')]({'type':_0x46cdba['type'][_0x8d46('0x34')](),'app':_0x8d46('0x3'),'appdata':_0x8d46('0x45'),'context':_0x547adf[_0x8d46('0x5')],'exten':_0x547adf['exten'],'priority':_0x46cdba['intervals'][_0x8d46('0x2e')]+_0xce0cb+_0x441a5c++,'VoiceExtensionId':_0x547adf['id']});}_0x46cdba[_0x8d46('0x46')]=_0x39ae73[_0x8d46('0x2e')]?_['last'](_0x39ae73)[_0x8d46('0x46')]+0x1:_0xce0cb;_0x26baba=_[_0x8d46('0x47')](_0x26baba,_0x39ae73,[_0x46cdba],_0x18d7a6);_0xce0cb=_['last'](_0x26baba)[_0x8d46('0x46')]+0x1;}return _0x33e489(_0x26baba);})[_0x8d46('0x48')](function(_0x536cf2){_0x104786(_0x536cf2);});});}return _0x30702c[_0x8d46('0x49')](_0x8d46('0x4a'),attributes,{'tableName':_0x8d46('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5594d6){var _0x1fbffb=this[_0x8d46('0x4c')]({'plain':!![]});var _0xfd20a7=_0x1fbffb[_0x8d46('0x2')]===_0x8d46('0xc')?_0x4e8483(_0x1fbffb):_0x26a02c(_0x1fbffb);return _0x36821e(_0x1fbffb,_0x5594d6,_[_0x8d46('0x4d')](_0xfd20a7)['priority']+0x1)[_0x8d46('0x2d')](function(_0x43862b){var _0x59a2a3=_[_0x8d46('0x47')](_0xfd20a7,_0x43862b);_0x59a2a3[_0x8d46('0x8')]({'type':_0x1fbffb[_0x8d46('0x2')],'app':_0x8d46('0x4e'),'exten':_0x1fbffb[_0x8d46('0x6')],'context':_0x1fbffb[_0x8d46('0x5')],'priority':_[_0x8d46('0x4d')](_0x59a2a3)[_0x8d46('0x46')]+0x1,'VoiceExtensionId':_0x1fbffb['id']});return _0x59a2a3;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index decbe64..a29170e 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 _0x1115=['VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceExtension','findAll','options','raw','where','limit','include','map','attributes','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','socket.io-emitter','./voiceExtension.socket','register','then','info'];(function(_0x56957d,_0x56af12){var _0x2ca16b=function(_0x47cf8d){while(--_0x47cf8d){_0x56957d['push'](_0x56957d['shift']());}};_0x2ca16b(++_0x56af12);}(_0x1115,0x1b6));var _0x5111=function(_0x281efb,_0x16733d){_0x281efb=_0x281efb-0x0;var _0x5a990a=_0x1115[_0x281efb];return _0x5a990a;};'use strict';var _=require('lodash');var util=require(_0x5111('0x0'));var moment=require(_0x5111('0x1'));var BPromise=require(_0x5111('0x2'));var rs=require(_0x5111('0x3'));var fs=require('fs');var Redis=require(_0x5111('0x4'));var db=require(_0x5111('0x5'))['db'];var utils=require(_0x5111('0x6'));var logger=require(_0x5111('0x7'))(_0x5111('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5111('0x9')][_0x5111('0xa')]({'port':0x232a});config['redis']=_[_0x5111('0xb')](config[_0x5111('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5111('0xd'))(new Redis(config['redis']));require(_0x5111('0xe'))[_0x5111('0xf')](socket);function respondWithRpcPromise(_0x4ecb50,_0x5e12a7,_0x347d87){return new BPromise(function(_0x5a826a,_0x162624){return client['request'](_0x4ecb50,_0x347d87)[_0x5111('0x10')](function(_0x532984){logger[_0x5111('0x11')](_0x5111('0x12'),_0x5e12a7,_0x5111('0x13'));logger[_0x5111('0x14')](_0x5111('0x15'),_0x5e12a7,_0x5111('0x13'),JSON[_0x5111('0x16')](_0x532984));if(_0x532984[_0x5111('0x17')]){if(_0x532984[_0x5111('0x17')][_0x5111('0x18')]===0x1f4){logger[_0x5111('0x17')](_0x5111('0x12'),_0x5e12a7,_0x532984[_0x5111('0x17')][_0x5111('0x19')]);return _0x162624(_0x532984[_0x5111('0x17')][_0x5111('0x19')]);}logger['error'](_0x5111('0x12'),_0x5e12a7,_0x532984['error']['message']);return _0x5a826a(_0x532984[_0x5111('0x17')][_0x5111('0x19')]);}else{logger[_0x5111('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x5e12a7,_0x5111('0x13'));_0x5a826a(_0x532984[_0x5111('0x1a')]['message']);}})[_0x5111('0x1b')](function(_0x10110b){logger[_0x5111('0x17')](_0x5111('0x12'),_0x5e12a7,_0x10110b);_0x162624(_0x10110b);});});}exports['GetVoiceExtension']=function(_0x52d236){var _0x2a1840=this;return new Promise(function(_0x1b0e5c,_0x1b3136){return db[_0x5111('0x1c')][_0x5111('0x1d')]({'raw':_0x52d236[_0x5111('0x1e')]?_0x52d236[_0x5111('0x1e')][_0x5111('0x1f')]===undefined?!![]:![]:!![],'where':_0x52d236[_0x5111('0x1e')]?_0x52d236['options'][_0x5111('0x20')]||null:null,'attributes':_0x52d236[_0x5111('0x1e')]?_0x52d236[_0x5111('0x1e')]['attributes']||null:null,'limit':_0x52d236[_0x5111('0x1e')]?_0x52d236[_0x5111('0x1e')][_0x5111('0x21')]||null:null,'include':_0x52d236[_0x5111('0x1e')]?_0x52d236[_0x5111('0x1e')][_0x5111('0x22')]?_[_0x5111('0x23')](_0x52d236[_0x5111('0x1e')][_0x5111('0x22')],function(_0x1a5793){return{'model':db[_0x1a5793['model']],'as':_0x1a5793['as'],'attributes':_0x1a5793[_0x5111('0x24')],'include':_0x1a5793[_0x5111('0x22')]?_[_0x5111('0x23')](_0x1a5793[_0x5111('0x22')],function(_0x265149){return{'model':db[_0x265149[_0x5111('0x25')]],'as':_0x265149['as'],'attributes':_0x265149[_0x5111('0x24')],'include':_0x265149['include']?_[_0x5111('0x23')](_0x265149[_0x5111('0x22')],function(_0x25a75a){return{'model':db[_0x25a75a['model']],'as':_0x25a75a['as'],'attributes':_0x25a75a[_0x5111('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5111('0x10')](function(_0x16107a){logger['info']('GetVoiceExtension',_0x52d236);logger[_0x5111('0x14')]('GetVoiceExtension',_0x52d236,JSON[_0x5111('0x16')](_0x16107a));_0x1b0e5c(_0x16107a);})['catch'](function(_0x35ed41){logger['error']('GetVoiceExtension',_0x35ed41['message'],_0x52d236);_0x1b3136(_0x2a1840[_0x5111('0x17')](0x1f4,_0x35ed41[_0x5111('0x19')]));});});}; \ No newline at end of file +var _0x448a=['request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceExtension','findAll','options','raw','where','attributes','limit','include','model','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./voiceExtension.socket','register','then','VoiceExtension,\x20%s,\x20%s'];(function(_0x1b3773,_0x130c57){var _0x3e79db=function(_0x3c3557){while(--_0x3c3557){_0x1b3773['push'](_0x1b3773['shift']());}};_0x3e79db(++_0x130c57);}(_0x448a,0x1ef));var _0xa448=function(_0x1fb1c1,_0x10dbfe){_0x1fb1c1=_0x1fb1c1-0x0;var _0x48ad0b=_0x448a[_0x1fb1c1];return _0x48ad0b;};'use strict';var _=require('lodash');var util=require(_0xa448('0x0'));var moment=require(_0xa448('0x1'));var BPromise=require('bluebird');var rs=require(_0xa448('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa448('0x3'));var logger=require(_0xa448('0x4'))('rpc');var config=require(_0xa448('0x5'));var jayson=require(_0xa448('0x6'));var client=jayson[_0xa448('0x7')][_0xa448('0x8')]({'port':0x232a});config[_0xa448('0x9')]=_[_0xa448('0xa')](config[_0xa448('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa448('0x9')]));require(_0xa448('0xb'))[_0xa448('0xc')](socket);function respondWithRpcPromise(_0x13db02,_0x2e95bf,_0x81f261){return new BPromise(function(_0x1d8a87,_0x54a4c2){return client['request'](_0x13db02,_0x81f261)[_0xa448('0xd')](function(_0x183569){logger['info'](_0xa448('0xe'),_0x2e95bf,_0xa448('0xf'));logger[_0xa448('0x10')](_0xa448('0x11'),_0x2e95bf,_0xa448('0xf'),JSON[_0xa448('0x12')](_0x183569));if(_0x183569[_0xa448('0x13')]){if(_0x183569[_0xa448('0x13')][_0xa448('0x14')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x2e95bf,_0x183569[_0xa448('0x13')][_0xa448('0x15')]);return _0x54a4c2(_0x183569[_0xa448('0x13')][_0xa448('0x15')]);}logger[_0xa448('0x13')](_0xa448('0xe'),_0x2e95bf,_0x183569['error']['message']);return _0x1d8a87(_0x183569['error']['message']);}else{logger[_0xa448('0x16')](_0xa448('0xe'),_0x2e95bf,'request\x20sent');_0x1d8a87(_0x183569[_0xa448('0x17')][_0xa448('0x15')]);}})[_0xa448('0x18')](function(_0x38f0ac){logger[_0xa448('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x2e95bf,_0x38f0ac);_0x54a4c2(_0x38f0ac);});});}exports[_0xa448('0x19')]=function(_0x220fd5){var _0x77722=this;return new Promise(function(_0x28a80b,_0x1b6370){return db['VoiceExtension'][_0xa448('0x1a')]({'raw':_0x220fd5[_0xa448('0x1b')]?_0x220fd5[_0xa448('0x1b')][_0xa448('0x1c')]===undefined?!![]:![]:!![],'where':_0x220fd5[_0xa448('0x1b')]?_0x220fd5[_0xa448('0x1b')][_0xa448('0x1d')]||null:null,'attributes':_0x220fd5[_0xa448('0x1b')]?_0x220fd5[_0xa448('0x1b')][_0xa448('0x1e')]||null:null,'limit':_0x220fd5[_0xa448('0x1b')]?_0x220fd5['options'][_0xa448('0x1f')]||null:null,'include':_0x220fd5[_0xa448('0x1b')]?_0x220fd5[_0xa448('0x1b')][_0xa448('0x20')]?_['map'](_0x220fd5[_0xa448('0x1b')][_0xa448('0x20')],function(_0xc1af15){return{'model':db[_0xc1af15[_0xa448('0x21')]],'as':_0xc1af15['as'],'attributes':_0xc1af15['attributes'],'include':_0xc1af15[_0xa448('0x20')]?_['map'](_0xc1af15[_0xa448('0x20')],function(_0x3e6679){return{'model':db[_0x3e6679[_0xa448('0x21')]],'as':_0x3e6679['as'],'attributes':_0x3e6679[_0xa448('0x1e')],'include':_0x3e6679[_0xa448('0x20')]?_['map'](_0x3e6679[_0xa448('0x20')],function(_0x1d1c43){return{'model':db[_0x1d1c43[_0xa448('0x21')]],'as':_0x1d1c43['as'],'attributes':_0x1d1c43[_0xa448('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa448('0xd')](function(_0x2dc4f3){logger[_0xa448('0x16')](_0xa448('0x19'),_0x220fd5);logger[_0xa448('0x10')](_0xa448('0x19'),_0x220fd5,JSON[_0xa448('0x12')](_0x2dc4f3));_0x28a80b(_0x2dc4f3);})[_0xa448('0x18')](function(_0xe0461c){logger[_0xa448('0x13')]('GetVoiceExtension',_0xe0461c[_0xa448('0x15')],_0x220fd5);_0x1b6370(_0x77722[_0xa448('0x13')](0x1f4,_0xe0461c[_0xa448('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 7393b70..3c6264c 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x814b,0x1a2));var _0xb814=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0x814b[_0x199b1f];return _0x267ac9;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x5081a3,_0xe5ad13){var _0x3989fa=function(_0x1b8dc9){while(--_0x1b8dc9){_0x5081a3['push'](_0x5081a3['shift']());}};_0x3989fa(++_0xe5ad13);}(_0xabce,0x103));var _0xeabc=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xabce[_0x1d9aa0];return _0x226868;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 2da7118..ecdb3d1 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 _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','getMessages','post','create','put','delete','exports'];(function(_0x1dee0c,_0x13b016){var _0x12d97e=function(_0x32e84f){while(--_0x32e84f){_0x1dee0c['push'](_0x1dee0c['shift']());}};_0x12d97e(++_0x13b016);}(_0x326f,0xd1));var _0xf326=function(_0x34de92,_0x1f8c1b){_0x34de92=_0x34de92-0x0;var _0x13d952=_0x326f[_0x34de92];return _0x13d952;};'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/messages',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0x11e5=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','show','/:id/messages','getMessages','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x169a64,_0x5321d1){var _0x31dab5=function(_0x54f08f){while(--_0x54f08f){_0x169a64['push'](_0x169a64['shift']());}};_0x31dab5(++_0x5321d1);}(_0x11e5,0x8b));var _0x511e=function(_0x215797,_0x49d505){_0x215797=_0x215797-0x0;var _0x4a3697=_0x11e5[_0x215797];return _0x4a3697;};'use strict';var multer=require(_0x511e('0x0'));var util=require('util');var path=require(_0x511e('0x1'));var timeout=require(_0x511e('0x2'));var express=require('express');var router=express[_0x511e('0x3')]();var fs_extra=require(_0x511e('0x4'));var auth=require(_0x511e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x511e('0x6'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0x511e('0x7')](),controller[_0x511e('0x8')]);router[_0x511e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x511e('0xa')]);router[_0x511e('0x9')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xc')]);router[_0x511e('0xd')]('/',auth[_0x511e('0x7')](),controller[_0x511e('0xe')]);router[_0x511e('0xf')](_0x511e('0x10'),auth[_0x511e('0x7')](),controller['update']);router[_0x511e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x511e('0x12')]);module[_0x511e('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 51733be..7328633 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 _0x3801=['trim','central','yes','ENUM','TINYINT(4)','INTEGER','fullname','\x20-\x20','getDataValue','mailbox','STRING','contest_mailbox','setDataValue','email','string'];(function(_0x53c4f8,_0x44ccaf){var _0x416458=function(_0x2632aa){while(--_0x2632aa){_0x53c4f8['push'](_0x53c4f8['shift']());}};_0x416458(++_0x44ccaf);}(_0x3801,0xfa));var _0x1380=function(_0x56ce7d,_0x57d050){_0x56ce7d=_0x56ce7d-0x0;var _0x72a880=_0x3801[_0x56ce7d];return _0x72a880;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1380('0x0')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x1380('0x1')},'password':{'type':Sequelize[_0x1380('0x0')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1380('0x0')],'validate':{'isEmail':!![]},'set':function(_0xc11c82){this[_0x1380('0x2')](_0x1380('0x3'),typeof _0xc11c82===_0x1380('0x4')&&_0xc11c82[_0x1380('0x5')]()?_0xc11c82[_0x1380('0x5')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x1380('0x0')],'defaultValue':_0x1380('0x6')},'attach':{'type':Sequelize['ENUM'](_0x1380('0x7'),'no'),'defaultValue':_0x1380('0x7'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x1380('0x7'),'no'),'defaultValue':_0x1380('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x1380('0x0')]},'callback':{'type':Sequelize[_0x1380('0x0')]},'review':{'type':Sequelize['ENUM'](_0x1380('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1380('0x8')](_0x1380('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1380('0x8')](_0x1380('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1380('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1380('0x8')](_0x1380('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1380('0x8')](_0x1380('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1380('0x8')](_0x1380('0x7'),'no'),'defaultValue':_0x1380('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x1380('0x8')](_0x1380('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1380('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1380('0x8')](_0x1380('0x7'),'no'),'defaultValue':_0x1380('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x1380('0x0')]},'emailbody':{'type':Sequelize[_0x1380('0x0')]},'maxsecs':{'type':Sequelize[_0x1380('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x1380('0xb'))+_0x1380('0xc')+this[_0x1380('0xd')](_0x1380('0xe'));}}}; \ No newline at end of file +var _0xdfc9=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize'];(function(_0x4fc913,_0x2f0c5f){var _0x378efe=function(_0x2fbc1a){while(--_0x2fbc1a){_0x4fc913['push'](_0x4fc913['shift']());}};_0x378efe(++_0x2f0c5f);}(_0xdfc9,0x1db));var _0x9dfc=function(_0x3d85be,_0x53c96c){_0x3d85be=_0x3d85be-0x0;var _0x41242c=_0xdfc9[_0x3d85be];return _0x41242c;};'use strict';var Sequelize=require(_0x9dfc('0x0'));module[_0x9dfc('0x1')]={'customer_id':{'type':Sequelize[_0x9dfc('0x2')]},'context':{'type':Sequelize[_0x9dfc('0x2')],'defaultValue':_0x9dfc('0x3'),'unique':_0x9dfc('0x4')},'mailbox':{'type':Sequelize[_0x9dfc('0x2')],'defaultValue':'','allowNull':![],'unique':_0x9dfc('0x4')},'password':{'type':Sequelize[_0x9dfc('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9dfc('0x2')],'validate':{'isEmail':!![]},'set':function(_0x450418){this[_0x9dfc('0x5')](_0x9dfc('0x6'),typeof _0x450418==='string'&&_0x450418[_0x9dfc('0x7')]()?_0x450418['trim']():null);}},'pager':{'type':Sequelize[_0x9dfc('0x2')]},'tz':{'type':Sequelize[_0x9dfc('0x2')],'defaultValue':_0x9dfc('0x8')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':_0x9dfc('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x9dfc('0x2')]},'callback':{'type':Sequelize[_0x9dfc('0x2')]},'review':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9dfc('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9dfc('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':_0x9dfc('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x9dfc('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9dfc('0x9')](_0x9dfc('0xa'),'no'),'defaultValue':_0x9dfc('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x9dfc('0x2')]},'emailbody':{'type':Sequelize[_0x9dfc('0x2')]},'maxsecs':{'type':Sequelize[_0x9dfc('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9dfc('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9dfc('0xc')],'get':function(){return this[_0x9dfc('0xd')](_0x9dfc('0xe'))+_0x9dfc('0xf')+this[_0x9dfc('0xd')](_0x9dfc('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 95f8a91..5534070 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 _0x7af2=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','getMessages','findOne','VoiceMailMessage','rawAttributes','mailbox','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create'];(function(_0x5a354a,_0x52b415){var _0x422361=function(_0xb9763e){while(--_0xb9763e){_0x5a354a['push'](_0x5a354a['shift']());}};_0x422361(++_0x52b415);}(_0x7af2,0x119));var _0x27af=function(_0xcc55fc,_0x2ff129){_0xcc55fc=_0xcc55fc-0x0;var _0x3e01c3=_0x7af2[_0xcc55fc];return _0x3e01c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];function respondWithStatusCode(_0x49a883,_0x406340){_0x406340=_0x406340||0xcc;return function(_0x203501){if(_0x203501){return _0x49a883[_0x27af('0x17')](_0x406340);}return _0x49a883[_0x27af('0x18')](_0x406340)[_0x27af('0x19')]();};}function respondWithResult(_0x1edb50,_0x234825){_0x234825=_0x234825||0xc8;return function(_0x3da435){if(_0x3da435){return _0x1edb50[_0x27af('0x18')](_0x234825)[_0x27af('0x1a')](_0x3da435);}};}function respondWithFilteredResult(_0x30f675,_0x9c2d4b){return function(_0x2d7800){if(_0x2d7800){var _0x3102c4=typeof _0x9c2d4b[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x9c2d4b[_0x27af('0x1d')]===_0x27af('0x1c');var _0x58583a=_0x2d7800[_0x27af('0x1e')];var _0x31d702=_0x3102c4?0x0:_0x9c2d4b['offset'];var _0x4e6e2f=_0x3102c4?_0x2d7800[_0x27af('0x1e')]:_0x9c2d4b[_0x27af('0x1b')]+_0x9c2d4b[_0x27af('0x1d')];var _0x31573a;if(_0x4e6e2f>=_0x58583a){_0x4e6e2f=_0x58583a;_0x31573a=0xc8;}else{_0x31573a=0xce;}_0x30f675[_0x27af('0x18')](_0x31573a);return _0x30f675['set'](_0x27af('0x1f'),_0x31d702+'-'+_0x4e6e2f+'/'+_0x58583a)[_0x27af('0x1a')](_0x2d7800);}return null;};}function patchUpdates(_0xcb4b90){return function(_0x5e7c19){try{jsonpatch[_0x27af('0x20')](_0x5e7c19,_0xcb4b90,!![]);}catch(_0x2eec5f){return BPromise[_0x27af('0x21')](_0x2eec5f);}return _0x5e7c19['save']();};}function saveUpdates(_0x2dce2b,_0x2460f4){return function(_0x30720b){if(_0x30720b){return _0x30720b[_0x27af('0x22')](_0x2dce2b)[_0x27af('0x23')](function(_0x396156){return _0x396156;});}return null;};}function removeEntity(_0x43dd9e,_0x35b36d){return function(_0x2e1bb0){if(_0x2e1bb0){return _0x2e1bb0['destroy']()['then'](function(){var _0x4b8fe6=_0x2e1bb0[_0x27af('0x24')]({'plain':!![]});var _0x4feaf1=_0x27af('0x25');return db[_0x27af('0x26')]['destroy']({'where':{'type':_0x4feaf1,'resourceId':_0x4b8fe6['id']}})[_0x27af('0x23')](function(){return _0x2e1bb0;});})[_0x27af('0x23')](function(){_0x43dd9e[_0x27af('0x18')](0xcc)[_0x27af('0x19')]();});}};}function handleEntityNotFound(_0x39b8ee,_0x3ca40e){return function(_0x775d4e){if(!_0x775d4e){_0x39b8ee['sendStatus'](0x194);}return _0x775d4e;};}function handleError(_0x14d5fc,_0x250d5b){_0x250d5b=_0x250d5b||0x1f4;return function(_0xadd38e){logger[_0x27af('0x27')](_0xadd38e[_0x27af('0x28')]);if(_0xadd38e[_0x27af('0x29')]){delete _0xadd38e[_0x27af('0x29')];}_0x14d5fc[_0x27af('0x18')](_0x250d5b)[_0x27af('0x2a')](_0xadd38e);};}exports[_0x27af('0x2b')]=function(_0x205e41,_0x4f4955){var _0x15e867={},_0x14b2e7={},_0x3800a1={'count':0x0,'rows':[]};var _0x575887=_[_0x27af('0x2c')](db[_0x27af('0x2d')]['rawAttributes'],function(_0x51bc97){return{'name':_0x51bc97[_0x27af('0x2e')],'type':_0x51bc97[_0x27af('0x2f')]['key']};});_0x14b2e7[_0x27af('0x30')]=_[_0x27af('0x2c')](_0x575887,_0x27af('0x29'));_0x14b2e7[_0x27af('0x31')]=_[_0x27af('0x32')](_0x205e41[_0x27af('0x31')]);_0x14b2e7[_0x27af('0x33')]=_[_0x27af('0x34')](_0x14b2e7[_0x27af('0x30')],_0x14b2e7[_0x27af('0x31')]);_0x15e867[_0x27af('0x35')]=_['intersection'](_0x14b2e7['model'],qs[_0x27af('0x36')](_0x205e41[_0x27af('0x31')]['fields']));_0x15e867[_0x27af('0x35')]=_0x15e867[_0x27af('0x35')]['length']?_0x15e867[_0x27af('0x35')]:_0x14b2e7[_0x27af('0x30')];if(!_0x205e41[_0x27af('0x31')][_0x27af('0x37')](_0x27af('0x38'))){_0x15e867['limit']=qs[_0x27af('0x1d')](_0x205e41[_0x27af('0x31')]['limit']);_0x15e867['offset']=qs[_0x27af('0x1b')](_0x205e41[_0x27af('0x31')][_0x27af('0x1b')]);}_0x15e867[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x205e41[_0x27af('0x31')]['sort']);_0x15e867[_0x27af('0x3b')]=qs['filters'](_[_0x27af('0x3c')](_0x205e41[_0x27af('0x31')],_0x14b2e7[_0x27af('0x33')]),_0x575887);if(_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]){_0x15e867['where']=_[_0x27af('0x3e')](_0x15e867[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x575887,function(_0x3faebd){if(_0x3faebd[_0x27af('0x2f')]!==_0x27af('0x3f')){var _0x415d9f={};_0x415d9f[_0x3faebd[_0x27af('0x29')]]={'$like':'%'+_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x415d9f;}})});}_0x15e867=_[_0x27af('0x3e')]({},_0x15e867,_0x205e41[_0x27af('0x40')]);var _0x24ee9b={'where':_0x15e867[_0x27af('0x3b')]};return db['VoiceMail'][_0x27af('0x1e')](_0x24ee9b)[_0x27af('0x23')](function(_0x44534b){_0x3800a1[_0x27af('0x1e')]=_0x44534b;if(_0x205e41['query'][_0x27af('0x41')]){_0x15e867['include']=[{'all':!![]}];}return db['VoiceMail'][_0x27af('0x42')](_0x15e867);})[_0x27af('0x23')](function(_0x279f99){_0x3800a1[_0x27af('0x43')]=_0x279f99;return _0x3800a1;})[_0x27af('0x23')](respondWithFilteredResult(_0x4f4955,_0x15e867))[_0x27af('0x44')](handleError(_0x4f4955,null));};exports[_0x27af('0x45')]=function(_0x26eb28,_0x2269e8){var _0x100fcb={'raw':!![],'where':{'id':_0x26eb28[_0x27af('0x46')]['id']}},_0x1e3c35={};_0x1e3c35['model']=_[_0x27af('0x32')](db[_0x27af('0x2d')]['rawAttributes']);_0x1e3c35['query']=_[_0x27af('0x32')](_0x26eb28[_0x27af('0x31')]);_0x1e3c35[_0x27af('0x33')]=_[_0x27af('0x34')](_0x1e3c35[_0x27af('0x30')],_0x1e3c35['query']);_0x100fcb[_0x27af('0x35')]=_['intersection'](_0x1e3c35[_0x27af('0x30')],qs[_0x27af('0x36')](_0x26eb28[_0x27af('0x31')][_0x27af('0x36')]));_0x100fcb[_0x27af('0x35')]=_0x100fcb[_0x27af('0x35')][_0x27af('0x47')]?_0x100fcb['attributes']:_0x1e3c35['model'];if(_0x26eb28[_0x27af('0x31')]['includeAll']){_0x100fcb[_0x27af('0x48')]=[{'all':!![]}];}_0x100fcb=_[_0x27af('0x3e')]({},_0x100fcb,_0x26eb28[_0x27af('0x40')]);return db[_0x27af('0x2d')][_0x27af('0x49')](_0x100fcb)[_0x27af('0x23')](handleEntityNotFound(_0x2269e8,null))[_0x27af('0x23')](respondWithResult(_0x2269e8,null))['catch'](handleError(_0x2269e8,null));};exports[_0x27af('0x4a')]=function(_0xc7e2a8,_0x20e180){return db[_0x27af('0x2d')][_0x27af('0x4a')](_0xc7e2a8['body'],{})[_0x27af('0x23')](function(_0x25f960){var _0x28ba64=_0xc7e2a8['user']['get']({'plain':!![]});if(!_0x28ba64)throw new Error(_0x27af('0x4b'));if(_0x28ba64[_0x27af('0x4c')]===_0x27af('0x4d')){var _0x5be44f=_0x25f960['get']({'plain':!![]});var _0x2fad23='Voicemails';return db[_0x27af('0x4e')][_0x27af('0x49')]({'where':{'name':_0x2fad23,'userProfileId':_0x28ba64[_0x27af('0x4f')]},'raw':!![]})[_0x27af('0x23')](function(_0x38aa14){if(_0x38aa14&&_0x38aa14[_0x27af('0x50')]===0x0){return db[_0x27af('0x26')][_0x27af('0x4a')]({'name':_0x5be44f[_0x27af('0x29')],'resourceId':_0x5be44f['id'],'type':_0x38aa14[_0x27af('0x29')],'sectionId':_0x38aa14['id']},{})[_0x27af('0x23')](function(){return _0x25f960;});}else{return _0x25f960;}})['catch'](function(_0x76ed78){logger[_0x27af('0x27')](_0x27af('0x51'),_0x76ed78);throw _0x76ed78;});}return _0x25f960;})[_0x27af('0x23')](respondWithResult(_0x20e180,0xc9))[_0x27af('0x44')](handleError(_0x20e180,null));};exports[_0x27af('0x22')]=function(_0x20c155,_0x31eaa9){if(_0x20c155['body']['id']){delete _0x20c155[_0x27af('0x52')]['id'];}return db['VoiceMail'][_0x27af('0x49')]({'where':{'id':_0x20c155[_0x27af('0x46')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x31eaa9,null))['then'](saveUpdates(_0x20c155[_0x27af('0x52')],null))['then'](respondWithResult(_0x31eaa9,null))[_0x27af('0x44')](handleError(_0x31eaa9,null));};exports[_0x27af('0x53')]=function(_0x4769ff,_0x5bf8b0){return db[_0x27af('0x2d')]['find']({'where':{'id':_0x4769ff[_0x27af('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bf8b0,null))[_0x27af('0x23')](removeEntity(_0x5bf8b0,null))[_0x27af('0x44')](handleError(_0x5bf8b0,null));};exports[_0x27af('0x54')]=function(_0x571064,_0x4bc851,_0x5eab7d){return db[_0x27af('0x2d')][_0x27af('0x55')]({'where':{'id':_0x571064[_0x27af('0x46')]['id']}})['then'](handleEntityNotFound(_0x4bc851,null))[_0x27af('0x23')](function(_0x306c56){var _0x6761d4;var _0x34c855={},_0x299f63={};_0x299f63[_0x27af('0x30')]=_['keys'](db[_0x27af('0x56')][_0x27af('0x57')]);_0x299f63[_0x27af('0x31')]=_[_0x27af('0x32')](_0x571064['query']);_0x299f63[_0x27af('0x33')]=_['intersection'](_0x299f63[_0x27af('0x30')],_0x299f63[_0x27af('0x31')]);_0x34c855['attributes']=_[_0x27af('0x34')](_0x299f63[_0x27af('0x30')],qs['fields'](_0x571064['query'][_0x27af('0x36')]));_0x34c855[_0x27af('0x35')]=_0x34c855[_0x27af('0x35')]['length']?_0x34c855[_0x27af('0x35')]:_0x299f63[_0x27af('0x30')];if(!_0x571064['query'][_0x27af('0x37')](_0x27af('0x38'))){_0x34c855['limit']=qs['limit'](_0x571064[_0x27af('0x31')][_0x27af('0x1d')]);_0x34c855['offset']=qs['offset'](_0x571064[_0x27af('0x31')][_0x27af('0x1b')]);}_0x34c855[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x571064[_0x27af('0x31')][_0x27af('0x3a')]);_0x34c855[_0x27af('0x3b')]=qs['filters'](_['pick'](_0x571064[_0x27af('0x31')],_0x299f63[_0x27af('0x33')]));if(_0x571064[_0x27af('0x31')][_0x27af('0x3d')]){_0x34c855[_0x27af('0x3b')]=_[_0x27af('0x3e')](_0x34c855[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x34c855[_0x27af('0x35')],function(_0x13c9ff){var _0x444f21={};_0x444f21[_0x13c9ff]={'$like':'%'+_0x571064[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x444f21;})});}_0x34c855[_0x27af('0x3b')]=_[_0x27af('0x3e')](_0x34c855[_0x27af('0x3b')],{'mailboxuser':_0x306c56[_0x27af('0x58')]});_0x34c855=_['merge']({},_0x34c855,_0x571064[_0x27af('0x40')]);return db[_0x27af('0x56')]['findAndCountAll'](_0x34c855)[_0x27af('0x23')](respondWithFilteredResult(_0x4bc851,_0x34c855));})[_0x27af('0x44')](handleError(_0x4bc851,null));}; \ No newline at end of file +var _0xe605=['count','set','Content-Range','apply','save','update','then','destroy','Voicemails','UserProfileResource','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceMail','findAll','rows','show','params','intersection','find','catch','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x181613,_0x43258d){var _0x314e4e=function(_0x35d78e){while(--_0x35d78e){_0x181613['push'](_0x181613['shift']());}};_0x314e4e(++_0x43258d);}(_0xe605,0x92));var _0x5e60=function(_0x1819c9,_0x3614d3){_0x1819c9=_0x1819c9-0x0;var _0x1d407c=_0xe605[_0x1819c9];return _0x1d407c;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x371df7,_0x178782){_0x178782=_0x178782||0xcc;return function(_0x1f4e14){if(_0x1f4e14){return _0x371df7[_0x5e60('0x19')](_0x178782);}return _0x371df7[_0x5e60('0x1a')](_0x178782)[_0x5e60('0x1b')]();};}function respondWithResult(_0x4fd10e,_0x209adb){_0x209adb=_0x209adb||0xc8;return function(_0x45304f){if(_0x45304f){return _0x4fd10e[_0x5e60('0x1a')](_0x209adb)[_0x5e60('0x1c')](_0x45304f);}};}function respondWithFilteredResult(_0x5b028f,_0x20af5f){return function(_0x529ffe){if(_0x529ffe){var _0x1ffd77=typeof _0x20af5f[_0x5e60('0x1d')]==='undefined'&&typeof _0x20af5f[_0x5e60('0x1e')]===_0x5e60('0x1f');var _0xaa7d05=_0x529ffe[_0x5e60('0x20')];var _0x5c485d=_0x1ffd77?0x0:_0x20af5f[_0x5e60('0x1d')];var _0x22d718=_0x1ffd77?_0x529ffe['count']:_0x20af5f[_0x5e60('0x1d')]+_0x20af5f[_0x5e60('0x1e')];var _0x17c630;if(_0x22d718>=_0xaa7d05){_0x22d718=_0xaa7d05;_0x17c630=0xc8;}else{_0x17c630=0xce;}_0x5b028f[_0x5e60('0x1a')](_0x17c630);return _0x5b028f[_0x5e60('0x21')](_0x5e60('0x22'),_0x5c485d+'-'+_0x22d718+'/'+_0xaa7d05)[_0x5e60('0x1c')](_0x529ffe);}return null;};}function patchUpdates(_0x524c93){return function(_0x3282e4){try{jsonpatch[_0x5e60('0x23')](_0x3282e4,_0x524c93,!![]);}catch(_0x228f13){return BPromise['reject'](_0x228f13);}return _0x3282e4[_0x5e60('0x24')]();};}function saveUpdates(_0x5d77dd,_0x376069){return function(_0x1a44e5){if(_0x1a44e5){return _0x1a44e5[_0x5e60('0x25')](_0x5d77dd)[_0x5e60('0x26')](function(_0x34e98d){return _0x34e98d;});}return null;};}function removeEntity(_0x2a499e,_0x2636f1){return function(_0x5d2c03){if(_0x5d2c03){return _0x5d2c03[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){var _0x19f37b=_0x5d2c03['get']({'plain':!![]});var _0x45cb62=_0x5e60('0x28');return db[_0x5e60('0x29')][_0x5e60('0x27')]({'where':{'type':_0x45cb62,'resourceId':_0x19f37b['id']}})['then'](function(){return _0x5d2c03;});})[_0x5e60('0x26')](function(){_0x2a499e['status'](0xcc)[_0x5e60('0x1b')]();});}};}function handleEntityNotFound(_0x221322,_0x4ba727){return function(_0x46691f){if(!_0x46691f){_0x221322[_0x5e60('0x19')](0x194);}return _0x46691f;};}function handleError(_0x5b1b46,_0x1ee931){_0x1ee931=_0x1ee931||0x1f4;return function(_0xac9c7a){logger['error'](_0xac9c7a['stack']);if(_0xac9c7a['name']){delete _0xac9c7a[_0x5e60('0x2a')];}_0x5b1b46[_0x5e60('0x1a')](_0x1ee931)[_0x5e60('0x2b')](_0xac9c7a);};}exports[_0x5e60('0x2c')]=function(_0x3ccfee,_0x558197){var _0x168ce6={},_0x405461={},_0x4d4b55={'count':0x0,'rows':[]};var _0x11fc87=_['map'](db['VoiceMail'][_0x5e60('0x2d')],function(_0x3c4340){return{'name':_0x3c4340[_0x5e60('0x2e')],'type':_0x3c4340[_0x5e60('0x2f')][_0x5e60('0x30')]};});_0x405461[_0x5e60('0x31')]=_[_0x5e60('0x32')](_0x11fc87,_0x5e60('0x2a'));_0x405461[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x3ccfee['query']);_0x405461[_0x5e60('0x35')]=_['intersection'](_0x405461['model'],_0x405461[_0x5e60('0x33')]);_0x168ce6[_0x5e60('0x36')]=_['intersection'](_0x405461[_0x5e60('0x31')],qs['fields'](_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x37')]));_0x168ce6[_0x5e60('0x36')]=_0x168ce6[_0x5e60('0x36')][_0x5e60('0x38')]?_0x168ce6[_0x5e60('0x36')]:_0x405461[_0x5e60('0x31')];if(!_0x3ccfee[_0x5e60('0x33')]['hasOwnProperty'](_0x5e60('0x39'))){_0x168ce6[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x168ce6[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x3ccfee['query'][_0x5e60('0x1d')]);}_0x168ce6[_0x5e60('0x3a')]=qs['sort'](_0x3ccfee['query'][_0x5e60('0x3b')]);_0x168ce6[_0x5e60('0x3c')]=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x3ccfee[_0x5e60('0x33')],_0x405461['filters']),_0x11fc87);if(_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x168ce6[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x168ce6[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x32')](_0x11fc87,function(_0x2b635a){if(_0x2b635a['type']!==_0x5e60('0x40')){var _0x1f95b2={};_0x1f95b2[_0x2b635a['name']]={'$like':'%'+_0x3ccfee['query']['filter']+'%'};return _0x1f95b2;}})});}_0x168ce6=_[_0x5e60('0x3f')]({},_0x168ce6,_0x3ccfee[_0x5e60('0x41')]);var _0x2c6d5b={'where':_0x168ce6[_0x5e60('0x3c')]};return db['VoiceMail'][_0x5e60('0x20')](_0x2c6d5b)[_0x5e60('0x26')](function(_0x4b6192){_0x4d4b55['count']=_0x4b6192;if(_0x3ccfee[_0x5e60('0x33')][_0x5e60('0x42')]){_0x168ce6[_0x5e60('0x43')]=[{'all':!![]}];}return db[_0x5e60('0x44')][_0x5e60('0x45')](_0x168ce6);})[_0x5e60('0x26')](function(_0x2522d2){_0x4d4b55[_0x5e60('0x46')]=_0x2522d2;return _0x4d4b55;})[_0x5e60('0x26')](respondWithFilteredResult(_0x558197,_0x168ce6))['catch'](handleError(_0x558197,null));};exports[_0x5e60('0x47')]=function(_0x2bb154,_0x59a2eb){var _0x1b1567={'raw':!![],'where':{'id':_0x2bb154[_0x5e60('0x48')]['id']}},_0x4aac07={};_0x4aac07[_0x5e60('0x31')]=_[_0x5e60('0x34')](db['VoiceMail'][_0x5e60('0x2d')]);_0x4aac07[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x2bb154[_0x5e60('0x33')]);_0x4aac07['filters']=_['intersection'](_0x4aac07['model'],_0x4aac07[_0x5e60('0x33')]);_0x1b1567[_0x5e60('0x36')]=_[_0x5e60('0x49')](_0x4aac07[_0x5e60('0x31')],qs[_0x5e60('0x37')](_0x2bb154[_0x5e60('0x33')]['fields']));_0x1b1567[_0x5e60('0x36')]=_0x1b1567[_0x5e60('0x36')][_0x5e60('0x38')]?_0x1b1567[_0x5e60('0x36')]:_0x4aac07[_0x5e60('0x31')];if(_0x2bb154[_0x5e60('0x33')][_0x5e60('0x42')]){_0x1b1567['include']=[{'all':!![]}];}_0x1b1567=_[_0x5e60('0x3f')]({},_0x1b1567,_0x2bb154[_0x5e60('0x41')]);return db[_0x5e60('0x44')][_0x5e60('0x4a')](_0x1b1567)[_0x5e60('0x26')](handleEntityNotFound(_0x59a2eb,null))[_0x5e60('0x26')](respondWithResult(_0x59a2eb,null))[_0x5e60('0x4b')](handleError(_0x59a2eb,null));};exports[_0x5e60('0x4c')]=function(_0x1518bd,_0x350d6d){return db[_0x5e60('0x44')][_0x5e60('0x4c')](_0x1518bd[_0x5e60('0x4d')],{})[_0x5e60('0x26')](function(_0x1aa381){var _0x176ef3=_0x1518bd[_0x5e60('0x4e')][_0x5e60('0x4f')]({'plain':!![]});if(!_0x176ef3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x176ef3['role']===_0x5e60('0x4e')){var _0x4d3588=_0x1aa381[_0x5e60('0x4f')]({'plain':!![]});var _0x1d247e=_0x5e60('0x28');return db[_0x5e60('0x50')][_0x5e60('0x4a')]({'where':{'name':_0x1d247e,'userProfileId':_0x176ef3[_0x5e60('0x51')]},'raw':!![]})['then'](function(_0x48bea6){if(_0x48bea6&&_0x48bea6[_0x5e60('0x52')]===0x0){return db[_0x5e60('0x29')][_0x5e60('0x4c')]({'name':_0x4d3588['name'],'resourceId':_0x4d3588['id'],'type':_0x48bea6['name'],'sectionId':_0x48bea6['id']},{})[_0x5e60('0x26')](function(){return _0x1aa381;});}else{return _0x1aa381;}})[_0x5e60('0x4b')](function(_0x179cc6){logger['error'](_0x5e60('0x53'),_0x179cc6);throw _0x179cc6;});}return _0x1aa381;})[_0x5e60('0x26')](respondWithResult(_0x350d6d,0xc9))[_0x5e60('0x4b')](handleError(_0x350d6d,null));};exports[_0x5e60('0x25')]=function(_0x17d002,_0x148204){if(_0x17d002['body']['id']){delete _0x17d002[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x44')]['find']({'where':{'id':_0x17d002[_0x5e60('0x48')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x148204,null))[_0x5e60('0x26')](saveUpdates(_0x17d002['body'],null))[_0x5e60('0x26')](respondWithResult(_0x148204,null))[_0x5e60('0x4b')](handleError(_0x148204,null));};exports['destroy']=function(_0x26e129,_0x367208){return db[_0x5e60('0x44')][_0x5e60('0x4a')]({'where':{'id':_0x26e129['params']['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x367208,null))[_0x5e60('0x26')](removeEntity(_0x367208,null))['catch'](handleError(_0x367208,null));};exports[_0x5e60('0x54')]=function(_0x4cb322,_0x8d00b9,_0x5220fc){return db[_0x5e60('0x44')][_0x5e60('0x55')]({'where':{'id':_0x4cb322['params']['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x8d00b9,null))['then'](function(_0x1a2094){var _0x566fc7;var _0x157787={},_0x5b4daa={};_0x5b4daa[_0x5e60('0x31')]=_[_0x5e60('0x34')](db[_0x5e60('0x56')][_0x5e60('0x2d')]);_0x5b4daa[_0x5e60('0x33')]=_[_0x5e60('0x34')](_0x4cb322[_0x5e60('0x33')]);_0x5b4daa['filters']=_[_0x5e60('0x49')](_0x5b4daa[_0x5e60('0x31')],_0x5b4daa[_0x5e60('0x33')]);_0x157787[_0x5e60('0x36')]=_[_0x5e60('0x49')](_0x5b4daa[_0x5e60('0x31')],qs['fields'](_0x4cb322['query']['fields']));_0x157787[_0x5e60('0x36')]=_0x157787[_0x5e60('0x36')]['length']?_0x157787[_0x5e60('0x36')]:_0x5b4daa[_0x5e60('0x31')];if(!_0x4cb322['query'][_0x5e60('0x57')](_0x5e60('0x39'))){_0x157787[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x1e')]);_0x157787[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x1d')]);}_0x157787[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3b')]);_0x157787[_0x5e60('0x3c')]=qs[_0x5e60('0x35')](_[_0x5e60('0x3d')](_0x4cb322['query'],_0x5b4daa[_0x5e60('0x35')]));if(_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3e')]){_0x157787['where']=_[_0x5e60('0x3f')](_0x157787[_0x5e60('0x3c')],{'$or':_['map'](_0x157787[_0x5e60('0x36')],function(_0x6f4d2f){var _0x5bbaaf={};_0x5bbaaf[_0x6f4d2f]={'$like':'%'+_0x4cb322[_0x5e60('0x33')][_0x5e60('0x3e')]+'%'};return _0x5bbaaf;})});}_0x157787[_0x5e60('0x3c')]=_[_0x5e60('0x3f')](_0x157787[_0x5e60('0x3c')],{'mailboxuser':_0x1a2094[_0x5e60('0x58')]});_0x157787=_[_0x5e60('0x3f')]({},_0x157787,_0x4cb322[_0x5e60('0x41')]);return db[_0x5e60('0x56')]['findAndCountAll'](_0x157787)[_0x5e60('0x26')](respondWithFilteredResult(_0x8d00b9,_0x157787));})[_0x5e60('0x4b')](handleError(_0x8d00b9,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index be2ccf9..5950e30 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 _0xbb46=['../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox','context','util','../../config/logger','api','rimraf'];(function(_0x1e8762,_0x27f92b){var _0x2f0f17=function(_0x1f7ae1){while(--_0x1f7ae1){_0x1e8762['push'](_0x1e8762['shift']());}};_0x2f0f17(++_0x27f92b);}(_0xbb46,0xd8));var _0x6bb4=function(_0x1bd4ca,_0x342721){_0x1bd4ca=_0x1bd4ca-0x0;var _0x5c422b=_0xbb46[_0x1bd4ca];return _0x5c422b;};'use strict';var _=require('lodash');var util=require(_0x6bb4('0x0'));var logger=require(_0x6bb4('0x1'))(_0x6bb4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6bb4('0x3'));var config=require(_0x6bb4('0x4'));var attributes=require('./voiceMail.attributes');module[_0x6bb4('0x5')]=function(_0xbe076f,_0x540d6c){return _0xbe076f[_0x6bb4('0x6')](_0x6bb4('0x7'),attributes,{'tableName':_0x6bb4('0x8'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x6bb4('0x9'),_0x6bb4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1189=['VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','moment','path','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0x1189,0x101));var _0x9118=function(_0x485dda,_0x1f5548){_0x485dda=_0x485dda-0x0;var _0x46c2d3=_0x1189[_0x485dda];return _0x46c2d3;};'use strict';var _=require(_0x9118('0x0'));var util=require(_0x9118('0x1'));var logger=require(_0x9118('0x2'))('api');var moment=require(_0x9118('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9118('0x4'));var rimraf=require('rimraf');var config=require(_0x9118('0x5'));var attributes=require(_0x9118('0x6'));module[_0x9118('0x7')]=function(_0x53d156,_0x321df0){return _0x53d156[_0x9118('0x8')](_0x9118('0x9'),attributes,{'tableName':_0x9118('0xa'),'paranoid':![],'indexes':[{'name':_0x9118('0xb'),'fields':[_0x9118('0xc'),_0x9118('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index c30560b..8d94992 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 _0xf360=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x269e9f,_0x11953b){var _0xa8d008=function(_0x2721ad){while(--_0x2721ad){_0x269e9f['push'](_0x269e9f['shift']());}};_0xa8d008(++_0x11953b);}(_0xf360,0xb3));var _0x0f36=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf360[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x0f36('0x0'));var moment=require('moment');var BPromise=require(_0x0f36('0x1'));var rs=require(_0x0f36('0x2'));var fs=require('fs');var Redis=require(_0x0f36('0x3'));var db=require(_0x0f36('0x4'))['db'];var utils=require(_0x0f36('0x5'));var logger=require('../../config/logger')(_0x0f36('0x6'));var config=require(_0x0f36('0x7'));var jayson=require(_0x0f36('0x8'));var client=jayson['client'][_0x0f36('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8eac65,_0xac0138,_0x1fdefb){return new BPromise(function(_0x3f3e5a,_0x50a46b){return client[_0x0f36('0xa')](_0x8eac65,_0x1fdefb)[_0x0f36('0xb')](function(_0x5e9449){logger[_0x0f36('0xc')](_0x0f36('0xd'),_0xac0138,_0x0f36('0xe'));logger['debug'](_0x0f36('0xf'),_0xac0138,'request\x20sent',JSON[_0x0f36('0x10')](_0x5e9449));if(_0x5e9449[_0x0f36('0x11')]){if(_0x5e9449[_0x0f36('0x11')][_0x0f36('0x12')]===0x1f4){logger[_0x0f36('0x11')]('VoiceMail,\x20%s,\x20%s',_0xac0138,_0x5e9449[_0x0f36('0x11')]['message']);return _0x50a46b(_0x5e9449[_0x0f36('0x11')][_0x0f36('0x13')]);}logger[_0x0f36('0x11')](_0x0f36('0xd'),_0xac0138,_0x5e9449[_0x0f36('0x11')][_0x0f36('0x13')]);return _0x3f3e5a(_0x5e9449[_0x0f36('0x11')]['message']);}else{logger[_0x0f36('0xc')](_0x0f36('0xd'),_0xac0138,'request\x20sent');_0x3f3e5a(_0x5e9449[_0x0f36('0x14')][_0x0f36('0x13')]);}})[_0x0f36('0x15')](function(_0x4916d5){logger[_0x0f36('0x11')](_0x0f36('0xd'),_0xac0138,_0x4916d5);_0x50a46b(_0x4916d5);});});} \ No newline at end of file +var _0x1106=['http','request','then','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x32352e,_0x253a7e){var _0x5646df=function(_0x5d1831){while(--_0x5d1831){_0x32352e['push'](_0x32352e['shift']());}};_0x5646df(++_0x253a7e);}(_0x1106,0x1af));var _0x6110=function(_0x1b416e,_0xe6df76){_0x1b416e=_0x1b416e-0x0;var _0x4d4497=_0x1106[_0x1b416e];return _0x4d4497;};'use strict';var _=require(_0x6110('0x0'));var util=require('util');var moment=require(_0x6110('0x1'));var BPromise=require(_0x6110('0x2'));var rs=require(_0x6110('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6110('0x4'))['db'];var utils=require(_0x6110('0x5'));var logger=require(_0x6110('0x6'))(_0x6110('0x7'));var config=require(_0x6110('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6110('0x9')][_0x6110('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51f4af,_0x3ecd82,_0x5c675b){return new BPromise(function(_0x3fdf04,_0x499152){return client[_0x6110('0xb')](_0x51f4af,_0x5c675b)[_0x6110('0xc')](function(_0x3174f2){logger['info']('VoiceMail,\x20%s,\x20%s',_0x3ecd82,_0x6110('0xd'));logger[_0x6110('0xe')](_0x6110('0xf'),_0x3ecd82,'request\x20sent',JSON['stringify'](_0x3174f2));if(_0x3174f2[_0x6110('0x10')]){if(_0x3174f2[_0x6110('0x10')]['code']===0x1f4){logger[_0x6110('0x10')](_0x6110('0x11'),_0x3ecd82,_0x3174f2['error'][_0x6110('0x12')]);return _0x499152(_0x3174f2[_0x6110('0x10')]['message']);}logger[_0x6110('0x10')](_0x6110('0x11'),_0x3ecd82,_0x3174f2[_0x6110('0x10')][_0x6110('0x12')]);return _0x3fdf04(_0x3174f2[_0x6110('0x10')][_0x6110('0x12')]);}else{logger['info'](_0x6110('0x11'),_0x3ecd82,'request\x20sent');_0x3fdf04(_0x3174f2[_0x6110('0x13')]['message']);}})[_0x6110('0x14')](function(_0x4b6171){logger['error'](_0x6110('0x11'),_0x3ecd82,_0x4b6171);_0x499152(_0x4b6171);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 2cbe7be..82b18c6 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 _0x0166=['create','put','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','show','download','post','isAuthenticated'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0166,0xcb));var _0x6016=function(_0x5b56df,_0x2c20d9){_0x5b56df=_0x5b56df-0x0;var _0x4781ba=_0x0166[_0x5b56df];return _0x4781ba;};'use strict';var multer=require(_0x6016('0x0'));var util=require(_0x6016('0x1'));var path=require(_0x6016('0x2'));var timeout=require('connect-timeout');var express=require(_0x6016('0x3'));var router=express[_0x6016('0x4')]();var fs_extra=require(_0x6016('0x5'));var auth=require(_0x6016('0x6'));var interaction=require(_0x6016('0x7'));var config=require(_0x6016('0x8'));var controller=require(_0x6016('0x9'));router[_0x6016('0xa')]('/',auth['isAuthenticated'](),controller[_0x6016('0xb')]);router[_0x6016('0xa')](_0x6016('0xc'),auth['isAuthenticated'](),controller[_0x6016('0xd')]);router[_0x6016('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x6016('0xe')]);router[_0x6016('0xf')]('/',auth[_0x6016('0x10')](),controller[_0x6016('0x11')]);router[_0x6016('0x12')](_0x6016('0xc'),auth[_0x6016('0x10')](),controller['update']);router['delete'](_0x6016('0xc'),auth[_0x6016('0x10')](),controller[_0x6016('0x13')]);module['exports']=router; \ No newline at end of file +var _0x93b7=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','destroy','exports','multer','util'];(function(_0x1ca605,_0x379da4){var _0x44748d=function(_0x2c8438){while(--_0x2c8438){_0x1ca605['push'](_0x1ca605['shift']());}};_0x44748d(++_0x379da4);}(_0x93b7,0x8a));var _0x793b=function(_0x1b3287,_0x15c015){_0x1b3287=_0x1b3287-0x0;var _0x10b1bc=_0x93b7[_0x1b3287];return _0x10b1bc;};'use strict';var multer=require(_0x793b('0x0'));var util=require(_0x793b('0x1'));var path=require(_0x793b('0x2'));var timeout=require(_0x793b('0x3'));var express=require(_0x793b('0x4'));var router=express['Router']();var fs_extra=require(_0x793b('0x5'));var auth=require(_0x793b('0x6'));var interaction=require(_0x793b('0x7'));var config=require('../../config/environment');var controller=require(_0x793b('0x8'));router[_0x793b('0x9')]('/',auth[_0x793b('0xa')](),controller[_0x793b('0xb')]);router[_0x793b('0x9')](_0x793b('0xc'),auth['isAuthenticated'](),controller[_0x793b('0xd')]);router[_0x793b('0x9')]('/:id/download',auth[_0x793b('0xa')](),controller[_0x793b('0xe')]);router[_0x793b('0xf')]('/',auth[_0x793b('0xa')](),controller[_0x793b('0x10')]);router[_0x793b('0x11')]('/:id',auth[_0x793b('0xa')](),controller['update']);router['delete']('/:id',auth[_0x793b('0xa')](),controller[_0x793b('0x12')]);module[_0x793b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 2a3674e..3dabd74 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 _0x320f=['long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x320f,0x123));var _0xf320=function(_0x2cd889,_0x18857e){_0x2cd889=_0x2cd889-0x0;var _0x5c980f=_0x320f[_0x2cd889];return _0x5c980f;};'use strict';var Sequelize=require(_0xf320('0x0'));module[_0xf320('0x1')]={'name':{'type':Sequelize[_0xf320('0x2')],'get':function(_0x3cdca1){return this[_0xf320('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xf320('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xf320('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf320('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xf320('0x7')](_0xf320('0x8'))}}; \ No newline at end of file +var _0x02a6=['literal','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x5002be,_0x5c5ea0){var _0x20b151=function(_0x47747d){while(--_0x47747d){_0x5002be['push'](_0x5002be['shift']());}};_0x20b151(++_0x5c5ea0);}(_0x02a6,0xeb));var _0x602a=function(_0x30bcbf,_0x241d9e){_0x30bcbf=_0x30bcbf-0x0;var _0x3381b7=_0x02a6[_0x30bcbf];return _0x3381b7;};'use strict';var Sequelize=require(_0x602a('0x0'));module['exports']={'name':{'type':Sequelize[_0x602a('0x1')],'get':function(_0x1190e6){return this[_0x602a('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x602a('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x602a('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x602a('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x602a('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x602a('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x602a('0x5')](_0x602a('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x602a('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x602a('0x7'),'defaultValue':Sequelize[_0x602a('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index f367e69..472f9dd 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 _0xf099=['map','VIRTUAL','options','include','rows','show','params','includeAll','find','catch','create','body','update','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xf099,0x6e));var _0x9f09=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0xf099[_0x1f7839];return _0x36b42e;};'use strict';var emlformat=require(_0x9f09('0x0'));var rimraf=require(_0x9f09('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f09('0x2'));var rp=require(_0x9f09('0x3'));var moment=require(_0x9f09('0x4'));var BPromise=require(_0x9f09('0x5'));var Mustache=require(_0x9f09('0x6'));var util=require(_0x9f09('0x7'));var path=require(_0x9f09('0x8'));var sox=require(_0x9f09('0x9'));var csv=require('to-csv');var ejs=require(_0x9f09('0xa'));var fs=require('fs');var fs_extra=require(_0x9f09('0xb'));var _=require(_0x9f09('0xc'));var squel=require(_0x9f09('0xd'));var crypto=require(_0x9f09('0xe'));var jsforce=require(_0x9f09('0xf'));var deskjs=require(_0x9f09('0x10'));var toCsv=require(_0x9f09('0x11'));var querystring=require(_0x9f09('0x12'));var Papa=require(_0x9f09('0x13'));var Redis=require(_0x9f09('0x14'));var authService=require(_0x9f09('0x15'));var qs=require(_0x9f09('0x16'));var as=require(_0x9f09('0x17'));var hardwareService=require(_0x9f09('0x18'));var logger=require(_0x9f09('0x19'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9f09('0x1a'));var db=require(_0x9f09('0x1b'))['db'];function respondWithStatusCode(_0x5cc8b1,_0x496876){_0x496876=_0x496876||0xcc;return function(_0x262419){if(_0x262419){return _0x5cc8b1[_0x9f09('0x1c')](_0x496876);}return _0x5cc8b1[_0x9f09('0x1d')](_0x496876)[_0x9f09('0x1e')]();};}function respondWithResult(_0x2586da,_0x2198b9){_0x2198b9=_0x2198b9||0xc8;return function(_0x299734){if(_0x299734){return _0x2586da[_0x9f09('0x1d')](_0x2198b9)[_0x9f09('0x1f')](_0x299734);}};}function respondWithFilteredResult(_0x184fd5,_0x3ae924){return function(_0x3a738a){if(_0x3a738a){var _0xbd4a0=typeof _0x3ae924[_0x9f09('0x20')]===_0x9f09('0x21')&&typeof _0x3ae924[_0x9f09('0x22')]==='undefined';var _0x4ddd1d=_0x3a738a[_0x9f09('0x23')];var _0x299d59=_0xbd4a0?0x0:_0x3ae924['offset'];var _0x1832cf=_0xbd4a0?_0x3a738a[_0x9f09('0x23')]:_0x3ae924[_0x9f09('0x20')]+_0x3ae924['limit'];var _0x560839;if(_0x1832cf>=_0x4ddd1d){_0x1832cf=_0x4ddd1d;_0x560839=0xc8;}else{_0x560839=0xce;}_0x184fd5[_0x9f09('0x1d')](_0x560839);return _0x184fd5['set'](_0x9f09('0x24'),_0x299d59+'-'+_0x1832cf+'/'+_0x4ddd1d)['json'](_0x3a738a);}return null;};}function patchUpdates(_0x4064b9){return function(_0x47abff){try{jsonpatch[_0x9f09('0x25')](_0x47abff,_0x4064b9,!![]);}catch(_0x3a1353){return BPromise['reject'](_0x3a1353);}return _0x47abff[_0x9f09('0x26')]();};}function saveUpdates(_0x43a7c2,_0x56fc42){return function(_0xe9d8b2){if(_0xe9d8b2){return _0xe9d8b2['update'](_0x43a7c2)[_0x9f09('0x27')](function(_0x1004cb){return _0x1004cb;});}return null;};}function removeEntity(_0x2626f9,_0x34a413){return function(_0x5708a2){if(_0x5708a2){return _0x5708a2[_0x9f09('0x28')]()[_0x9f09('0x27')](function(){_0x2626f9['status'](0xcc)[_0x9f09('0x1e')]();});}};}function handleEntityNotFound(_0x34f6f1,_0x3165e5){return function(_0x1ac497){if(!_0x1ac497){_0x34f6f1['sendStatus'](0x194);}return _0x1ac497;};}function handleError(_0x2ba015,_0x31a9c6){_0x31a9c6=_0x31a9c6||0x1f4;return function(_0x1c9995){logger[_0x9f09('0x29')](_0x1c9995[_0x9f09('0x2a')]);if(_0x1c9995[_0x9f09('0x2b')]){delete _0x1c9995[_0x9f09('0x2b')];}_0x2ba015[_0x9f09('0x1d')](_0x31a9c6)[_0x9f09('0x2c')](_0x1c9995);};}exports[_0x9f09('0x2d')]=function(_0x292a46,_0x3ff4c6){var _0x5bc7ff={},_0x69ae5a={},_0x55a038={'count':0x0,'rows':[]};var _0x3365c6=_['map'](db[_0x9f09('0x2e')][_0x9f09('0x2f')],function(_0x39abcf){return{'name':_0x39abcf[_0x9f09('0x30')],'type':_0x39abcf[_0x9f09('0x31')][_0x9f09('0x32')]};});_0x69ae5a[_0x9f09('0x33')]=_['differenceBy'](_['map'](_0x3365c6,_0x9f09('0x2b')),[_0x9f09('0x2b')]);_0x69ae5a['query']=_[_0x9f09('0x34')](_0x292a46[_0x9f09('0x35')]);_0x69ae5a[_0x9f09('0x36')]=_['intersection'](_0x69ae5a['model'],_0x69ae5a['query']);_0x5bc7ff[_0x9f09('0x37')]=_[_0x9f09('0x38')](_0x69ae5a['model'],qs[_0x9f09('0x39')](_0x292a46['query']['fields']));_0x5bc7ff[_0x9f09('0x37')]=_0x5bc7ff[_0x9f09('0x37')][_0x9f09('0x3a')]?_0x5bc7ff[_0x9f09('0x37')]:_0x69ae5a['model'];if(!_0x292a46[_0x9f09('0x35')][_0x9f09('0x3b')](_0x9f09('0x3c'))){_0x5bc7ff[_0x9f09('0x22')]=qs[_0x9f09('0x22')](_0x292a46[_0x9f09('0x35')][_0x9f09('0x22')]);_0x5bc7ff['offset']=qs[_0x9f09('0x20')](_0x292a46[_0x9f09('0x35')][_0x9f09('0x20')]);}_0x5bc7ff['order']=qs[_0x9f09('0x3d')](_0x292a46[_0x9f09('0x35')][_0x9f09('0x3d')]);_0x5bc7ff['where']=qs['filters'](_[_0x9f09('0x3e')](_0x292a46['query'],_0x69ae5a[_0x9f09('0x36')]),_0x3365c6);if(_0x292a46[_0x9f09('0x35')][_0x9f09('0x3f')]){_0x5bc7ff[_0x9f09('0x40')]=_[_0x9f09('0x41')](_0x5bc7ff[_0x9f09('0x40')],{'$or':_[_0x9f09('0x42')](_0x3365c6,function(_0x48e6d0){if(_0x48e6d0['type']!==_0x9f09('0x43')){var _0x217be2={};_0x217be2[_0x48e6d0[_0x9f09('0x2b')]]={'$like':'%'+_0x292a46[_0x9f09('0x35')]['filter']+'%'};return _0x217be2;}})});}_0x5bc7ff=_['merge']({},_0x5bc7ff,_0x292a46[_0x9f09('0x44')]);var _0xecdf02={'where':_0x5bc7ff[_0x9f09('0x40')]};return db[_0x9f09('0x2e')][_0x9f09('0x23')](_0xecdf02)['then'](function(_0x48f0d2){_0x55a038['count']=_0x48f0d2;if(_0x292a46[_0x9f09('0x35')]['includeAll']){_0x5bc7ff[_0x9f09('0x45')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x5bc7ff);})[_0x9f09('0x27')](function(_0x16b1a0){_0x55a038[_0x9f09('0x46')]=_0x16b1a0;return _0x55a038;})[_0x9f09('0x27')](respondWithFilteredResult(_0x3ff4c6,_0x5bc7ff))['catch'](handleError(_0x3ff4c6,null));};exports[_0x9f09('0x47')]=function(_0x32d2b9,_0x2876bc){var _0x227993={'raw':!![],'where':{'id':_0x32d2b9[_0x9f09('0x48')]['id']}},_0x3ab46c={};_0x3ab46c[_0x9f09('0x33')]=_['keys'](db[_0x9f09('0x2e')][_0x9f09('0x2f')]);_0x3ab46c[_0x9f09('0x35')]=_[_0x9f09('0x34')](_0x32d2b9[_0x9f09('0x35')]);_0x3ab46c[_0x9f09('0x36')]=_[_0x9f09('0x38')](_0x3ab46c['model'],_0x3ab46c['query']);_0x227993['attributes']=_['intersection'](_0x3ab46c[_0x9f09('0x33')],qs[_0x9f09('0x39')](_0x32d2b9['query'][_0x9f09('0x39')]));_0x227993[_0x9f09('0x37')]=_0x227993[_0x9f09('0x37')][_0x9f09('0x3a')]?_0x227993[_0x9f09('0x37')]:_0x3ab46c[_0x9f09('0x33')];if(_0x32d2b9[_0x9f09('0x35')][_0x9f09('0x49')]){_0x227993[_0x9f09('0x45')]=[{'all':!![]}];}_0x227993=_[_0x9f09('0x41')]({},_0x227993,_0x32d2b9[_0x9f09('0x44')]);return db[_0x9f09('0x2e')][_0x9f09('0x4a')](_0x227993)[_0x9f09('0x27')](handleEntityNotFound(_0x2876bc,null))['then'](respondWithResult(_0x2876bc,null))[_0x9f09('0x4b')](handleError(_0x2876bc,null));};exports[_0x9f09('0x4c')]=function(_0x21a165,_0x34f564){return db[_0x9f09('0x2e')][_0x9f09('0x4c')](_0x21a165[_0x9f09('0x4d')],{})[_0x9f09('0x27')](respondWithResult(_0x34f564,0xc9))['catch'](handleError(_0x34f564,null));};exports[_0x9f09('0x4e')]=function(_0x3e8ab8,_0x555f54){if(_0x3e8ab8[_0x9f09('0x4d')]['id']){delete _0x3e8ab8[_0x9f09('0x4d')]['id'];}return db[_0x9f09('0x2e')]['find']({'where':{'id':_0x3e8ab8['params']['id']}})['then'](handleEntityNotFound(_0x555f54,null))[_0x9f09('0x27')](saveUpdates(_0x3e8ab8['body'],null))[_0x9f09('0x27')](respondWithResult(_0x555f54,null))[_0x9f09('0x4b')](handleError(_0x555f54,null));};exports[_0x9f09('0x28')]=function(_0x261361,_0x11e489){return db[_0x9f09('0x2e')]['find']({'where':{'id':_0x261361[_0x9f09('0x48')]['id']}})[_0x9f09('0x27')](handleEntityNotFound(_0x11e489,null))['then'](removeEntity(_0x11e489,null))[_0x9f09('0x4b')](handleError(_0x11e489,null));};exports[_0x9f09('0x4f')]=function(_0x50512f,_0x3a0acb,_0x213d66){return db[_0x9f09('0x2e')]['find']({'where':{'id':_0x50512f[_0x9f09('0x48')]['id']},'attributes':['id',_0x9f09('0x50'),_0x9f09('0x51')]})[_0x9f09('0x27')](handleEntityNotFound(_0x3a0acb,null))[_0x9f09('0x27')](function(_0x5ea174){if(_0x5ea174){if(!_0x5ea174[_0x9f09('0x50')]){throw new db['Sequelize'][(_0x9f09('0x52'))](_0x9f09('0x53'));}var _0x3a2f2c={'Content-Type':_0x9f09('0x54'),'Content-Disposition':_0x9f09('0x55')};if(_0x5ea174[_0x9f09('0x51')]){_0x3a2f2c[_0x9f09('0x56')]=_0x9f09('0x57')+_0x5ea174[_0x9f09('0x51')]+'.wav\x22';}_0x3a0acb['set'](_0x3a2f2c);return _0x3a0acb[_0x9f09('0x2c')](new Buffer(_0x5ea174['recording']));}})[_0x9f09('0x4b')](handleError(_0x3a0acb,null));}; \ No newline at end of file +var _0x14f7=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','stack','name','send','index','map','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','VoiceMailMessage','includeAll','rows','show','params','include','find','catch','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x56b222,_0x43f86e){var _0x341af1=function(_0x566c0a){while(--_0x566c0a){_0x56b222['push'](_0x56b222['shift']());}};_0x341af1(++_0x43f86e);}(_0x14f7,0xf4));var _0x714f=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x14f7[_0x122096];return _0x3d1966;};'use strict';var emlformat=require(_0x714f('0x0'));var rimraf=require(_0x714f('0x1'));var zipdir=require(_0x714f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x714f('0x3'));var moment=require(_0x714f('0x4'));var BPromise=require(_0x714f('0x5'));var Mustache=require(_0x714f('0x6'));var util=require(_0x714f('0x7'));var path=require(_0x714f('0x8'));var sox=require(_0x714f('0x9'));var csv=require(_0x714f('0xa'));var ejs=require(_0x714f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x714f('0xc'));var squel=require(_0x714f('0xd'));var crypto=require(_0x714f('0xe'));var jsforce=require(_0x714f('0xf'));var deskjs=require(_0x714f('0x10'));var toCsv=require(_0x714f('0xa'));var querystring=require(_0x714f('0x11'));var Papa=require(_0x714f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x714f('0x13'));var as=require(_0x714f('0x14'));var hardwareService=require(_0x714f('0x15'));var logger=require(_0x714f('0x16'))(_0x714f('0x17'));var utils=require(_0x714f('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e2192,_0x25dd85){_0x25dd85=_0x25dd85||0xcc;return function(_0x572090){if(_0x572090){return _0x2e2192[_0x714f('0x19')](_0x25dd85);}return _0x2e2192[_0x714f('0x1a')](_0x25dd85)[_0x714f('0x1b')]();};}function respondWithResult(_0x877bac,_0x280854){_0x280854=_0x280854||0xc8;return function(_0x54cf43){if(_0x54cf43){return _0x877bac[_0x714f('0x1a')](_0x280854)[_0x714f('0x1c')](_0x54cf43);}};}function respondWithFilteredResult(_0x4c37cc,_0x2e4293){return function(_0x497f9f){if(_0x497f9f){var _0x300fb8=typeof _0x2e4293[_0x714f('0x1d')]===_0x714f('0x1e')&&typeof _0x2e4293[_0x714f('0x1f')]===_0x714f('0x1e');var _0x58d6ee=_0x497f9f[_0x714f('0x20')];var _0x1cf59a=_0x300fb8?0x0:_0x2e4293[_0x714f('0x1d')];var _0x28ff66=_0x300fb8?_0x497f9f[_0x714f('0x20')]:_0x2e4293[_0x714f('0x1d')]+_0x2e4293[_0x714f('0x1f')];var _0x31d1cd;if(_0x28ff66>=_0x58d6ee){_0x28ff66=_0x58d6ee;_0x31d1cd=0xc8;}else{_0x31d1cd=0xce;}_0x4c37cc['status'](_0x31d1cd);return _0x4c37cc[_0x714f('0x21')](_0x714f('0x22'),_0x1cf59a+'-'+_0x28ff66+'/'+_0x58d6ee)[_0x714f('0x1c')](_0x497f9f);}return null;};}function patchUpdates(_0x1369dd){return function(_0x35664a){try{jsonpatch[_0x714f('0x23')](_0x35664a,_0x1369dd,!![]);}catch(_0x54b5fa){return BPromise['reject'](_0x54b5fa);}return _0x35664a['save']();};}function saveUpdates(_0x1e183a,_0x5af44f){return function(_0x450c49){if(_0x450c49){return _0x450c49[_0x714f('0x24')](_0x1e183a)['then'](function(_0x169351){return _0x169351;});}return null;};}function removeEntity(_0x1fd73a,_0x1e9d62){return function(_0x43d5a5){if(_0x43d5a5){return _0x43d5a5[_0x714f('0x25')]()[_0x714f('0x26')](function(){_0x1fd73a[_0x714f('0x1a')](0xcc)[_0x714f('0x1b')]();});}};}function handleEntityNotFound(_0x3a832c,_0x2979fb){return function(_0x4bee06){if(!_0x4bee06){_0x3a832c[_0x714f('0x19')](0x194);}return _0x4bee06;};}function handleError(_0x111b47,_0x2064c0){_0x2064c0=_0x2064c0||0x1f4;return function(_0x2be548){logger['error'](_0x2be548[_0x714f('0x27')]);if(_0x2be548[_0x714f('0x28')]){delete _0x2be548[_0x714f('0x28')];}_0x111b47[_0x714f('0x1a')](_0x2064c0)[_0x714f('0x29')](_0x2be548);};}exports[_0x714f('0x2a')]=function(_0x4379ae,_0x204ff7){var _0x5c7977={},_0x10e784={},_0x2b2c84={'count':0x0,'rows':[]};var _0x2a0cb1=_[_0x714f('0x2b')](db['VoiceMailMessage']['rawAttributes'],function(_0x2af2c3){return{'name':_0x2af2c3[_0x714f('0x2c')],'type':_0x2af2c3['type'][_0x714f('0x2d')]};});_0x10e784[_0x714f('0x2e')]=_[_0x714f('0x2f')](_[_0x714f('0x2b')](_0x2a0cb1,_0x714f('0x28')),['name']);_0x10e784[_0x714f('0x30')]=_[_0x714f('0x31')](_0x4379ae[_0x714f('0x30')]);_0x10e784[_0x714f('0x32')]=_[_0x714f('0x33')](_0x10e784['model'],_0x10e784[_0x714f('0x30')]);_0x5c7977[_0x714f('0x34')]=_[_0x714f('0x33')](_0x10e784[_0x714f('0x2e')],qs[_0x714f('0x35')](_0x4379ae[_0x714f('0x30')][_0x714f('0x35')]));_0x5c7977[_0x714f('0x34')]=_0x5c7977['attributes'][_0x714f('0x36')]?_0x5c7977['attributes']:_0x10e784['model'];if(!_0x4379ae[_0x714f('0x30')][_0x714f('0x37')](_0x714f('0x38'))){_0x5c7977[_0x714f('0x1f')]=qs[_0x714f('0x1f')](_0x4379ae['query'][_0x714f('0x1f')]);_0x5c7977[_0x714f('0x1d')]=qs[_0x714f('0x1d')](_0x4379ae[_0x714f('0x30')][_0x714f('0x1d')]);}_0x5c7977[_0x714f('0x39')]=qs[_0x714f('0x3a')](_0x4379ae[_0x714f('0x30')][_0x714f('0x3a')]);_0x5c7977['where']=qs[_0x714f('0x32')](_['pick'](_0x4379ae[_0x714f('0x30')],_0x10e784[_0x714f('0x32')]),_0x2a0cb1);if(_0x4379ae[_0x714f('0x30')][_0x714f('0x3b')]){_0x5c7977['where']=_[_0x714f('0x3c')](_0x5c7977[_0x714f('0x3d')],{'$or':_['map'](_0x2a0cb1,function(_0x3ab2f8){if(_0x3ab2f8[_0x714f('0x3e')]!==_0x714f('0x3f')){var _0x5cb4d9={};_0x5cb4d9[_0x3ab2f8[_0x714f('0x28')]]={'$like':'%'+_0x4379ae['query'][_0x714f('0x3b')]+'%'};return _0x5cb4d9;}})});}_0x5c7977=_[_0x714f('0x3c')]({},_0x5c7977,_0x4379ae[_0x714f('0x40')]);var _0x34eecc={'where':_0x5c7977[_0x714f('0x3d')]};return db[_0x714f('0x41')][_0x714f('0x20')](_0x34eecc)[_0x714f('0x26')](function(_0x5cb663){_0x2b2c84[_0x714f('0x20')]=_0x5cb663;if(_0x4379ae[_0x714f('0x30')][_0x714f('0x42')]){_0x5c7977['include']=[{'all':!![]}];}return db[_0x714f('0x41')]['findAll'](_0x5c7977);})[_0x714f('0x26')](function(_0x26d501){_0x2b2c84[_0x714f('0x43')]=_0x26d501;return _0x2b2c84;})[_0x714f('0x26')](respondWithFilteredResult(_0x204ff7,_0x5c7977))['catch'](handleError(_0x204ff7,null));};exports[_0x714f('0x44')]=function(_0x268bb1,_0x3c37e1){var _0x2cd639={'raw':!![],'where':{'id':_0x268bb1[_0x714f('0x45')]['id']}},_0x4c732f={};_0x4c732f[_0x714f('0x2e')]=_[_0x714f('0x31')](db[_0x714f('0x41')]['rawAttributes']);_0x4c732f[_0x714f('0x30')]=_['keys'](_0x268bb1['query']);_0x4c732f[_0x714f('0x32')]=_[_0x714f('0x33')](_0x4c732f[_0x714f('0x2e')],_0x4c732f[_0x714f('0x30')]);_0x2cd639['attributes']=_[_0x714f('0x33')](_0x4c732f[_0x714f('0x2e')],qs[_0x714f('0x35')](_0x268bb1[_0x714f('0x30')][_0x714f('0x35')]));_0x2cd639[_0x714f('0x34')]=_0x2cd639[_0x714f('0x34')][_0x714f('0x36')]?_0x2cd639[_0x714f('0x34')]:_0x4c732f[_0x714f('0x2e')];if(_0x268bb1[_0x714f('0x30')][_0x714f('0x42')]){_0x2cd639[_0x714f('0x46')]=[{'all':!![]}];}_0x2cd639=_[_0x714f('0x3c')]({},_0x2cd639,_0x268bb1[_0x714f('0x40')]);return db[_0x714f('0x41')][_0x714f('0x47')](_0x2cd639)[_0x714f('0x26')](handleEntityNotFound(_0x3c37e1,null))['then'](respondWithResult(_0x3c37e1,null))[_0x714f('0x48')](handleError(_0x3c37e1,null));};exports[_0x714f('0x49')]=function(_0x5b9343,_0x1c89bc){return db['VoiceMailMessage'][_0x714f('0x49')](_0x5b9343[_0x714f('0x4a')],{})[_0x714f('0x26')](respondWithResult(_0x1c89bc,0xc9))[_0x714f('0x48')](handleError(_0x1c89bc,null));};exports['update']=function(_0x256033,_0xceba7d){if(_0x256033[_0x714f('0x4a')]['id']){delete _0x256033[_0x714f('0x4a')]['id'];}return db[_0x714f('0x41')][_0x714f('0x47')]({'where':{'id':_0x256033[_0x714f('0x45')]['id']}})[_0x714f('0x26')](handleEntityNotFound(_0xceba7d,null))['then'](saveUpdates(_0x256033[_0x714f('0x4a')],null))[_0x714f('0x26')](respondWithResult(_0xceba7d,null))[_0x714f('0x48')](handleError(_0xceba7d,null));};exports[_0x714f('0x25')]=function(_0x135cc7,_0x468192){return db[_0x714f('0x41')]['find']({'where':{'id':_0x135cc7[_0x714f('0x45')]['id']}})[_0x714f('0x26')](handleEntityNotFound(_0x468192,null))['then'](removeEntity(_0x468192,null))[_0x714f('0x48')](handleError(_0x468192,null));};exports[_0x714f('0x4b')]=function(_0x1191cc,_0x1c26c1,_0x14de77){return db[_0x714f('0x41')]['find']({'where':{'id':_0x1191cc[_0x714f('0x45')]['id']},'attributes':['id',_0x714f('0x4c'),_0x714f('0x4d')]})[_0x714f('0x26')](handleEntityNotFound(_0x1c26c1,null))['then'](function(_0x4aba3c){if(_0x4aba3c){if(!_0x4aba3c[_0x714f('0x4c')]){throw new db[(_0x714f('0x4e'))][(_0x714f('0x4f'))](_0x714f('0x50'));}var _0x29e1d9={'Content-Type':_0x714f('0x51'),'Content-Disposition':_0x714f('0x52')};if(_0x4aba3c[_0x714f('0x4d')]){_0x29e1d9[_0x714f('0x53')]='attachment;\x20filename=\x22'+_0x4aba3c[_0x714f('0x4d')]+_0x714f('0x54');}_0x1c26c1['set'](_0x29e1d9);return _0x1c26c1[_0x714f('0x29')](new Buffer(_0x4aba3c[_0x714f('0x4c')]));}})['catch'](handleError(_0x1c26c1,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 8895957..51d3af1 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 _0x4a86=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','util'];(function(_0x4ea503,_0xde7a49){var _0x2d9b72=function(_0x173201){while(--_0x173201){_0x4ea503['push'](_0x4ea503['shift']());}};_0x2d9b72(++_0xde7a49);}(_0x4a86,0x143));var _0x64a8=function(_0x333073,_0x3c5e61){_0x333073=_0x333073-0x0;var _0x44019d=_0x4a86[_0x333073];return _0x44019d;};'use strict';var _=require('lodash');var util=require(_0x64a8('0x0'));var logger=require('../../config/logger')(_0x64a8('0x1'));var moment=require(_0x64a8('0x2'));var BPromise=require(_0x64a8('0x3'));var rp=require(_0x64a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x64a8('0x5'));var config=require(_0x64a8('0x6'));var attributes=require(_0x64a8('0x7'));module[_0x64a8('0x8')]=function(_0x579555,_0x1c82fd){return _0x579555['define'](_0x64a8('0x9'),attributes,{'tableName':_0x64a8('0xa'),'paranoid':![],'indexes':[{'name':_0x64a8('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xf4b3=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xf4b3,0x130));var _0x3f4b=function(_0x4106bd,_0x2ca0b0){_0x4106bd=_0x4106bd-0x0;var _0x13757f=_0xf4b3[_0x4106bd];return _0x13757f;};'use strict';var _=require(_0x3f4b('0x0'));var util=require(_0x3f4b('0x1'));var logger=require(_0x3f4b('0x2'))(_0x3f4b('0x3'));var moment=require(_0x3f4b('0x4'));var BPromise=require('bluebird');var rp=require(_0x3f4b('0x5'));var fs=require('fs');var path=require(_0x3f4b('0x6'));var rimraf=require('rimraf');var config=require(_0x3f4b('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0x3f4b('0x8')]=function(_0x53926d,_0x580aaa){return _0x53926d[_0x3f4b('0x9')](_0x3f4b('0xa'),attributes,{'tableName':_0x3f4b('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x3f4b('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 27783db..c51ab75 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 _0x0aa4=['stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x2d44d3,_0xd3391f){var _0x53d4ac=function(_0x5a7289){while(--_0x5a7289){_0x2d44d3['push'](_0x2d44d3['shift']());}};_0x53d4ac(++_0xd3391f);}(_0x0aa4,0x89));var _0x40aa=function(_0x5507b2,_0x407ac5){_0x5507b2=_0x5507b2-0x0;var _0x78698e=_0x0aa4[_0x5507b2];return _0x78698e;};'use strict';var _=require(_0x40aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x40aa('0x1'));var rs=require(_0x40aa('0x2'));var fs=require('fs');var Redis=require(_0x40aa('0x3'));var db=require(_0x40aa('0x4'))['db'];var utils=require(_0x40aa('0x5'));var logger=require(_0x40aa('0x6'))(_0x40aa('0x7'));var config=require(_0x40aa('0x8'));var jayson=require(_0x40aa('0x9'));var client=jayson['client'][_0x40aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46663c,_0x2799ec,_0x340f14){return new BPromise(function(_0x2baa67,_0x5dbae3){return client[_0x40aa('0xb')](_0x46663c,_0x340f14)[_0x40aa('0xc')](function(_0x5a2dd4){logger['info'](_0x40aa('0xd'),_0x2799ec,_0x40aa('0xe'));logger[_0x40aa('0xf')](_0x40aa('0x10'),_0x2799ec,_0x40aa('0xe'),JSON[_0x40aa('0x11')](_0x5a2dd4));if(_0x5a2dd4[_0x40aa('0x12')]){if(_0x5a2dd4['error']['code']===0x1f4){logger[_0x40aa('0x12')](_0x40aa('0xd'),_0x2799ec,_0x5a2dd4[_0x40aa('0x12')][_0x40aa('0x13')]);return _0x5dbae3(_0x5a2dd4['error'][_0x40aa('0x13')]);}logger[_0x40aa('0x12')](_0x40aa('0xd'),_0x2799ec,_0x5a2dd4[_0x40aa('0x12')][_0x40aa('0x13')]);return _0x2baa67(_0x5a2dd4[_0x40aa('0x12')][_0x40aa('0x13')]);}else{logger['info'](_0x40aa('0xd'),_0x2799ec,_0x40aa('0xe'));_0x2baa67(_0x5a2dd4[_0x40aa('0x14')][_0x40aa('0x13')]);}})[_0x40aa('0x15')](function(_0x3c59d8){logger[_0x40aa('0x12')](_0x40aa('0xd'),_0x2799ec,_0x3c59d8);_0x5dbae3(_0x3c59d8);});});} \ No newline at end of file +var _0x4d25=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x4d25,0xa3));var _0x54d2=function(_0x6cf5ec,_0x194d2e){_0x6cf5ec=_0x6cf5ec-0x0;var _0x271c4f=_0x4d25[_0x6cf5ec];return _0x271c4f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x54d2('0x0'));var BPromise=require('bluebird');var rs=require(_0x54d2('0x1'));var fs=require('fs');var Redis=require(_0x54d2('0x2'));var db=require(_0x54d2('0x3'))['db'];var utils=require(_0x54d2('0x4'));var logger=require(_0x54d2('0x5'))(_0x54d2('0x6'));var config=require(_0x54d2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x54d2('0x8')][_0x54d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53b44f,_0xc927a1,_0x3ddbdc){return new BPromise(function(_0x36d7d5,_0x17a15d){return client[_0x54d2('0xa')](_0x53b44f,_0x3ddbdc)[_0x54d2('0xb')](function(_0x319665){logger[_0x54d2('0xc')](_0x54d2('0xd'),_0xc927a1,_0x54d2('0xe'));logger[_0x54d2('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0xc927a1,_0x54d2('0xe'),JSON[_0x54d2('0x10')](_0x319665));if(_0x319665[_0x54d2('0x11')]){if(_0x319665[_0x54d2('0x11')]['code']===0x1f4){logger[_0x54d2('0x11')](_0x54d2('0xd'),_0xc927a1,_0x319665[_0x54d2('0x11')][_0x54d2('0x12')]);return _0x17a15d(_0x319665[_0x54d2('0x11')][_0x54d2('0x12')]);}logger[_0x54d2('0x11')](_0x54d2('0xd'),_0xc927a1,_0x319665[_0x54d2('0x11')]['message']);return _0x36d7d5(_0x319665[_0x54d2('0x11')][_0x54d2('0x12')]);}else{logger['info'](_0x54d2('0xd'),_0xc927a1,_0x54d2('0xe'));_0x36d7d5(_0x319665[_0x54d2('0x13')][_0x54d2('0x12')]);}})[_0x54d2('0x14')](function(_0x12d752){logger[_0x54d2('0x11')](_0x54d2('0xd'),_0xc927a1,_0x12d752);_0x17a15d(_0x12d752);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 05c057c..605501b 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 _0xa160=['util','express','Router','fs-extra','../../config/environment','./voiceMusicOnHold.controller','get','/:id','isAuthenticated','show','/:id/sounds','post','create','addSound','put','update','delete','destroy','removeSound','multer'];(function(_0xdb33f8,_0x4a17dc){var _0x545a90=function(_0x4f8334){while(--_0x4f8334){_0xdb33f8['push'](_0xdb33f8['shift']());}};_0x545a90(++_0x4a17dc);}(_0xa160,0x77));var _0x0a16=function(_0x1a8c41,_0xc1691c){_0x1a8c41=_0x1a8c41-0x0;var _0x12749d=_0xa160[_0x1a8c41];return _0x12749d;};'use strict';var multer=require(_0x0a16('0x0'));var util=require(_0x0a16('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a16('0x2'));var router=express[_0x0a16('0x3')]();var fs_extra=require(_0x0a16('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0a16('0x5'));var controller=require(_0x0a16('0x6'));router[_0x0a16('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0a16('0x8'),auth[_0x0a16('0x9')](),controller[_0x0a16('0xa')]);router['get'](_0x0a16('0xb'),auth[_0x0a16('0x9')](),controller['getSounds']);router[_0x0a16('0xc')]('/',auth[_0x0a16('0x9')](),controller[_0x0a16('0xd')]);router[_0x0a16('0xc')](_0x0a16('0xb'),auth[_0x0a16('0x9')](),controller[_0x0a16('0xe')]);router[_0x0a16('0xf')](_0x0a16('0x8'),auth[_0x0a16('0x9')](),controller[_0x0a16('0x10')]);router[_0x0a16('0x11')](_0x0a16('0x8'),auth[_0x0a16('0x9')](),controller[_0x0a16('0x12')]);router[_0x0a16('0x11')]('/:id/sounds/:id2',auth[_0x0a16('0x9')](),controller[_0x0a16('0x13')]);module['exports']=router; \ No newline at end of file +var _0x848d=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/sounds','getSounds','post','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x848d,0x165));var _0xd848=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x848d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd848('0x0'));var util=require(_0xd848('0x1'));var path=require(_0xd848('0x2'));var timeout=require('connect-timeout');var express=require(_0xd848('0x3'));var router=express[_0xd848('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd848('0x5'));var interaction=require(_0xd848('0x6'));var config=require(_0xd848('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0xd848('0x8')]('/',auth[_0xd848('0x9')](),controller['index']);router[_0xd848('0x8')](_0xd848('0xa'),auth[_0xd848('0x9')](),controller['show']);router[_0xd848('0x8')](_0xd848('0xb'),auth[_0xd848('0x9')](),controller[_0xd848('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd848('0xd')](_0xd848('0xb'),auth[_0xd848('0x9')](),controller['addSound']);router[_0xd848('0xe')]('/:id',auth[_0xd848('0x9')](),controller[_0xd848('0xf')]);router[_0xd848('0x10')]('/:id',auth[_0xd848('0x9')](),controller[_0xd848('0x11')]);router[_0xd848('0x10')](_0xd848('0x12'),auth[_0xd848('0x9')](),controller[_0xd848('0x13')]);module[_0xd848('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 85c3d14..c3e9d67 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 _0xa95b=['mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','sequelize','exports','STRING','name','ENUM'];(function(_0x2637a3,_0x22212f){var _0x3d644a=function(_0x534a8a){while(--_0x534a8a){_0x2637a3['push'](_0x2637a3['shift']());}};_0x3d644a(++_0x22212f);}(_0xa95b,0x181));var _0xba95=function(_0x3246b9,_0x2eda5b){_0x3246b9=_0x3246b9-0x0;var _0x272f7b=_0xa95b[_0x3246b9];return _0x272f7b;};'use strict';var Sequelize=require(_0xba95('0x0'));module[_0xba95('0x1')]={'name':{'type':Sequelize[_0xba95('0x2')],'allowNull':![],'unique':_0xba95('0x3')},'mode':{'type':Sequelize[_0xba95('0x4')]('custom','files',_0xba95('0x5'),_0xba95('0x6'),_0xba95('0x7'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xba95('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xba95('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xba95('0x2')],'allowNull':!![],'defaultValue':_0xba95('0x8')},'format':{'type':Sequelize[_0xba95('0x2')],'allowNull':!![]},'stamp':{'type':_0xba95('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0a6f=['BOOLEAN','sequelize','exports','STRING','ENUM','custom','files','mp3nb','quietmp3','alpha','TIMESTAMP'];(function(_0x528b7b,_0x11ec67){var _0x20dadf=function(_0x3cedb1){while(--_0x3cedb1){_0x528b7b['push'](_0x528b7b['shift']());}};_0x20dadf(++_0x11ec67);}(_0x0a6f,0x1cf));var _0xf0a6=function(_0x1f2f86,_0x57341c){_0x1f2f86=_0x1f2f86-0x0;var _0x43a6b3=_0x0a6f[_0x1f2f86];return _0x43a6b3;};'use strict';var Sequelize=require(_0xf0a6('0x0'));module[_0xf0a6('0x1')]={'name':{'type':Sequelize[_0xf0a6('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xf0a6('0x3')](_0xf0a6('0x4'),_0xf0a6('0x5'),_0xf0a6('0x6'),'quietmp3nb',_0xf0a6('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0xf0a6('0x5')},'directory':{'type':Sequelize[_0xf0a6('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xf0a6('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xf0a6('0x2')],'allowNull':!![],'defaultValue':_0xf0a6('0x8')},'format':{'type':Sequelize[_0xf0a6('0x2')],'allowNull':!![]},'stamp':{'type':_0xf0a6('0x9')},'defaultEntry':{'type':Sequelize[_0xf0a6('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index de294e2..397f473 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 _0x9496=['converted_format','createdAt','join','format','%s.%s','extname','Sequelize','removeSound','id2','getSounds','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','name','send','map','VoiceMusicOnHold','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','rawAttributes','includeAll','find','body','params','catch','create','sequelize','transaction','mode','files','directory','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound','findOne','save_name'];(function(_0x5ee447,_0x4ee2bf){var _0x656bfe=function(_0x45cad4){while(--_0x45cad4){_0x5ee447['push'](_0x5ee447['shift']());}};_0x656bfe(++_0x4ee2bf);}(_0x9496,0x1c7));var _0x6949=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x9496[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require(_0x6949('0x0'));var rimraf=require(_0x6949('0x1'));var zipdir=require(_0x6949('0x2'));var jsonpatch=require(_0x6949('0x3'));var rp=require(_0x6949('0x4'));var moment=require(_0x6949('0x5'));var BPromise=require(_0x6949('0x6'));var Mustache=require(_0x6949('0x7'));var util=require('util');var path=require(_0x6949('0x8'));var sox=require(_0x6949('0x9'));var csv=require(_0x6949('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6949('0xb'));var _=require(_0x6949('0xc'));var squel=require('squel');var crypto=require(_0x6949('0xd'));var jsforce=require(_0x6949('0xe'));var deskjs=require(_0x6949('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6949('0x10'));var Papa=require('papaparse');var Redis=require(_0x6949('0x11'));var authService=require(_0x6949('0x12'));var qs=require(_0x6949('0x13'));var as=require(_0x6949('0x14'));var hardwareService=require(_0x6949('0x15'));var logger=require(_0x6949('0x16'))(_0x6949('0x17'));var utils=require('../../config/utils');var config=require(_0x6949('0x18'));var licenseUtil=require(_0x6949('0x19'));var db=require(_0x6949('0x1a'))['db'];function respondWithStatusCode(_0x5de051,_0x366a9b){_0x366a9b=_0x366a9b||0xcc;return function(_0x23f81c){if(_0x23f81c){return _0x5de051[_0x6949('0x1b')](_0x366a9b);}return _0x5de051[_0x6949('0x1c')](_0x366a9b)[_0x6949('0x1d')]();};}function respondWithResult(_0x3981e7,_0x5639d4){_0x5639d4=_0x5639d4||0xc8;return function(_0x532074){if(_0x532074){return _0x3981e7[_0x6949('0x1c')](_0x5639d4)['json'](_0x532074);}};}function respondWithFilteredResult(_0x48aee8,_0x1a08c1){return function(_0x4f38ce){if(_0x4f38ce){var _0x29e32f=typeof _0x1a08c1['offset']===_0x6949('0x1e')&&typeof _0x1a08c1['limit']===_0x6949('0x1e');var _0x36a07c=_0x4f38ce[_0x6949('0x1f')];var _0x2123d8=_0x29e32f?0x0:_0x1a08c1[_0x6949('0x20')];var _0x3510af=_0x29e32f?_0x4f38ce[_0x6949('0x1f')]:_0x1a08c1['offset']+_0x1a08c1['limit'];var _0x3928b6;if(_0x3510af>=_0x36a07c){_0x3510af=_0x36a07c;_0x3928b6=0xc8;}else{_0x3928b6=0xce;}_0x48aee8[_0x6949('0x1c')](_0x3928b6);return _0x48aee8[_0x6949('0x21')](_0x6949('0x22'),_0x2123d8+'-'+_0x3510af+'/'+_0x36a07c)['json'](_0x4f38ce);}return null;};}function patchUpdates(_0x538c89){return function(_0x25552a){try{jsonpatch[_0x6949('0x23')](_0x25552a,_0x538c89,!![]);}catch(_0x2c6cba){return BPromise[_0x6949('0x24')](_0x2c6cba);}return _0x25552a['save']();};}function saveUpdates(_0x954c5e,_0x2ef44c){return function(_0x55b81c){if(_0x55b81c){return _0x55b81c[_0x6949('0x25')](_0x954c5e)[_0x6949('0x26')](function(_0x137e70){return _0x137e70;});}return null;};}function removeEntity(_0x2854f6,_0xd18e35){return function(_0x1594ec){if(_0x1594ec){return _0x1594ec[_0x6949('0x27')]()[_0x6949('0x26')](function(){var _0x97187=_0x1594ec[_0x6949('0x28')]({'plain':!![]});var _0x488e52='MusicOnHolds';return db[_0x6949('0x29')]['destroy']({'where':{'type':_0x488e52,'resourceId':_0x97187['id']}})['then'](function(){return _0x1594ec;});})[_0x6949('0x26')](function(){_0x2854f6[_0x6949('0x1c')](0xcc)[_0x6949('0x1d')]();});}};}function handleEntityNotFound(_0x2ebcf3,_0x29f955){return function(_0x20dac9){if(!_0x20dac9){_0x2ebcf3['sendStatus'](0x194);}return _0x20dac9;};}function handleError(_0x5d9bc3,_0x571c20){_0x571c20=_0x571c20||0x1f4;return function(_0x5c8f26){logger[_0x6949('0x2a')](_0x5c8f26['stack']);if(_0x5c8f26['name']){delete _0x5c8f26[_0x6949('0x2b')];}_0x5d9bc3[_0x6949('0x1c')](_0x571c20)[_0x6949('0x2c')](_0x5c8f26);};}exports['index']=function(_0x35e033,_0x3d9191){var _0x47ced4={},_0x18d516={},_0x15258e={'count':0x0,'rows':[]};var _0x258c84=_[_0x6949('0x2d')](db[_0x6949('0x2e')]['rawAttributes'],function(_0x16b9ee){return{'name':_0x16b9ee[_0x6949('0x2f')],'type':_0x16b9ee[_0x6949('0x30')][_0x6949('0x31')]};});_0x18d516[_0x6949('0x32')]=_[_0x6949('0x2d')](_0x258c84,_0x6949('0x2b'));_0x18d516[_0x6949('0x33')]=_[_0x6949('0x34')](_0x35e033[_0x6949('0x33')]);_0x18d516[_0x6949('0x35')]=_[_0x6949('0x36')](_0x18d516[_0x6949('0x32')],_0x18d516[_0x6949('0x33')]);_0x47ced4[_0x6949('0x37')]=_[_0x6949('0x36')](_0x18d516['model'],qs[_0x6949('0x38')](_0x35e033[_0x6949('0x33')][_0x6949('0x38')]));_0x47ced4[_0x6949('0x37')]=_0x47ced4[_0x6949('0x37')][_0x6949('0x39')]?_0x47ced4['attributes']:_0x18d516['model'];if(!_0x35e033['query'][_0x6949('0x3a')]('nolimit')){_0x47ced4[_0x6949('0x3b')]=qs['limit'](_0x35e033[_0x6949('0x33')][_0x6949('0x3b')]);_0x47ced4['offset']=qs[_0x6949('0x20')](_0x35e033[_0x6949('0x33')]['offset']);}_0x47ced4['order']=qs[_0x6949('0x3c')](_0x35e033[_0x6949('0x33')][_0x6949('0x3c')]);delete _0x35e033[_0x6949('0x33')][_0x6949('0x3c')];_0x47ced4[_0x6949('0x3d')]=qs['filters'](_[_0x6949('0x3e')](_0x35e033[_0x6949('0x33')],_0x18d516[_0x6949('0x35')]),_0x258c84);if(_0x35e033[_0x6949('0x33')][_0x6949('0x3f')]){_0x47ced4[_0x6949('0x3d')]=_[_0x6949('0x40')](_0x47ced4[_0x6949('0x3d')],{'$or':_['map'](_0x258c84,function(_0x335b04){if(_0x335b04[_0x6949('0x30')]!==_0x6949('0x41')){var _0x5bffcd={};_0x5bffcd[_0x335b04[_0x6949('0x2b')]]={'$like':'%'+_0x35e033[_0x6949('0x33')][_0x6949('0x3f')]+'%'};return _0x5bffcd;}})});}_0x47ced4=_['merge']({},_0x47ced4,_0x35e033[_0x6949('0x42')]);var _0x2d8189={'where':_0x47ced4[_0x6949('0x3d')]};return db[_0x6949('0x2e')][_0x6949('0x1f')](_0x2d8189)[_0x6949('0x26')](function(_0xc0c537){_0x15258e[_0x6949('0x1f')]=_0xc0c537;if(_0x35e033[_0x6949('0x33')]['includeAll']){_0x47ced4[_0x6949('0x43')]=[{'all':!![]}];}return db[_0x6949('0x2e')]['findAll'](_0x47ced4);})[_0x6949('0x26')](function(_0x52c00e){_0x15258e[_0x6949('0x44')]=_0x52c00e;return _0x15258e;})[_0x6949('0x26')](respondWithFilteredResult(_0x3d9191,_0x47ced4))['catch'](handleError(_0x3d9191,null));};exports['show']=function(_0x15f701,_0x222f04){var _0x5d4e99={'raw':![],'where':{'id':_0x15f701['params']['id']}},_0x29fab1={};_0x29fab1[_0x6949('0x32')]=_[_0x6949('0x34')](db[_0x6949('0x2e')][_0x6949('0x45')]);_0x29fab1['query']=_['keys'](_0x15f701[_0x6949('0x33')]);_0x29fab1[_0x6949('0x35')]=_['intersection'](_0x29fab1[_0x6949('0x32')],_0x29fab1[_0x6949('0x33')]);_0x5d4e99[_0x6949('0x37')]=_[_0x6949('0x36')](_0x29fab1['model'],qs['fields'](_0x15f701[_0x6949('0x33')][_0x6949('0x38')]));_0x5d4e99['attributes']=_0x5d4e99['attributes'][_0x6949('0x39')]?_0x5d4e99[_0x6949('0x37')]:_0x29fab1[_0x6949('0x32')];if(_0x15f701[_0x6949('0x33')][_0x6949('0x46')]){_0x5d4e99[_0x6949('0x43')]=[{'all':!![]}];}_0x5d4e99=_[_0x6949('0x40')]({},_0x5d4e99,_0x15f701[_0x6949('0x42')]);return db[_0x6949('0x2e')][_0x6949('0x47')](_0x5d4e99)['then'](handleEntityNotFound(_0x222f04,null))[_0x6949('0x26')](respondWithResult(_0x222f04,null))['catch'](handleError(_0x222f04,null));};exports[_0x6949('0x25')]=function(_0x2e0e20,_0x2e63e1){if(_0x2e0e20[_0x6949('0x48')]['id']){delete _0x2e0e20[_0x6949('0x48')]['id'];}return db[_0x6949('0x2e')][_0x6949('0x47')]({'where':{'id':_0x2e0e20[_0x6949('0x49')]['id']}})['then'](handleEntityNotFound(_0x2e63e1,null))[_0x6949('0x26')](saveUpdates(_0x2e0e20[_0x6949('0x48')],null))[_0x6949('0x26')](respondWithResult(_0x2e63e1,null))[_0x6949('0x4a')](handleError(_0x2e63e1,null));};exports[_0x6949('0x4b')]=function(_0xcc8b0a,_0x37719c,_0x33585e){return db[_0x6949('0x4c')][_0x6949('0x4d')](function(_0x3e77ed){if(_0xcc8b0a[_0x6949('0x48')][_0x6949('0x4e')]===_0x6949('0x4f')){_0xcc8b0a[_0x6949('0x48')][_0x6949('0x50')]=path['join'](config[_0x6949('0x51')],_0x6949('0x52'),_0xcc8b0a[_0x6949('0x48')]['name']);}return db[_0x6949('0x2e')][_0x6949('0x4b')](_0xcc8b0a['body'],{'transaction':_0x3e77ed})[_0x6949('0x26')](function(_0x51de74){if(_0xcc8b0a['body'][_0x6949('0x4e')]===_0x6949('0x4f')){fs['mkdirSync'](_0x51de74[_0x6949('0x50')],parseInt(_0x6949('0x53'),0x8));}var _0x2329f2=_0xcc8b0a[_0x6949('0x54')]['get']({'plain':!![]});if(!_0x2329f2)throw new Error(_0x6949('0x55'));if(_0x2329f2['role']===_0x6949('0x54')){var _0x172559=_0x51de74[_0x6949('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x6949('0x47')]({'where':{'name':_0x6949('0x56'),'userProfileId':_0x2329f2[_0x6949('0x57')]},'raw':!![]})[_0x6949('0x26')](function(_0x560b9f){if(_0x560b9f&&_0x560b9f[_0x6949('0x58')]===0x0){return db[_0x6949('0x29')][_0x6949('0x4b')]({'name':_0x172559[_0x6949('0x2b')],'resourceId':_0x172559['id'],'type':_0x560b9f[_0x6949('0x2b')],'sectionId':_0x560b9f['id']},{})[_0x6949('0x26')](function(){return _0x51de74;});}else{return _0x51de74;}})[_0x6949('0x4a')](function(_0x1739fa){logger[_0x6949('0x2a')](_0x6949('0x59'),_0x1739fa);});}return _0x51de74;});})[_0x6949('0x26')](respondWithResult(_0x37719c,0xc9))[_0x6949('0x4a')](handleError(_0x37719c,null));};exports[_0x6949('0x27')]=function(_0x1f4216,_0x5b3744,_0x256b3d){var _0x2f1670;return db['VoiceMusicOnHold'][_0x6949('0x47')]({'where':{'id':_0x1f4216[_0x6949('0x49')]['id']}})[_0x6949('0x26')](function(_0x554da2){if(_0x554da2){return db[_0x6949('0x4c')]['transaction'](function(_0x3c55aa){return _0x554da2[_0x6949('0x27')]({'transaction':_0x3c55aa,'raw':!![]})[_0x6949('0x26')](function(_0x1ce14b){if(_0x1ce14b[_0x6949('0x50')]){fs[_0x6949('0x5a')](_0x1ce14b[_0x6949('0x50')])[_0x6949('0x5b')](function(_0x1fb67f){fs[_0x6949('0x5c')](path['join'](_0x1ce14b[_0x6949('0x50')],_0x1fb67f));});fs[_0x6949('0x5d')](_0x1ce14b['directory']);}return _0x1ce14b;});})[_0x6949('0x4a')](function(_0x48eaee){throw new db['Sequelize'][(_0x6949('0x5e'))](_0x48eaee[_0x6949('0x5f')]);});}})['then'](handleEntityNotFound(_0x5b3744,null))[_0x6949('0x26')](removeEntity(_0x5b3744,null))[_0x6949('0x4a')](handleError(_0x5b3744,null));};exports[_0x6949('0x60')]=function(_0x5e46c2,_0x27e476,_0x3f2d26){return db[_0x6949('0x4c')][_0x6949('0x4d')](function(_0x587c04){var _0x34385d;return db['VoiceMusicOnHold'][_0x6949('0x47')]({'where':{'id':_0x5e46c2[_0x6949('0x49')]['id']}})[_0x6949('0x26')](function(_0x3a4766){if(_0x3a4766){_0x34385d=_0x3a4766;return _0x3a4766['addSound'](_0x5e46c2[_0x6949('0x48')]['id'],{'transaction':_0x587c04});}})[_0x6949('0x26')](function(_0x309260){if(_0x309260){return db[_0x6949('0x61')][_0x6949('0x62')]({'where':{'id':_0x5e46c2[_0x6949('0x48')]['id']},'attributes':['id',_0x6949('0x2b'),_0x6949('0x63'),_0x6949('0x64'),_0x6949('0x65')],'raw':!![]});}})[_0x6949('0x26')](function(_0x3ca038){if(_0x3ca038){var _0x5c5f9a=path[_0x6949('0x66')](config[_0x6949('0x51')],'server/files/sounds/converted',util[_0x6949('0x67')](_0x6949('0x68'),path['basename'](_0x3ca038['save_name'],path[_0x6949('0x69')](_0x3ca038[_0x6949('0x63')])),_0x3ca038[_0x6949('0x64')]));var _0x3f64c1=path['join'](config['root'],'server/files/moh',_0x34385d['name'],util[_0x6949('0x67')](_0x6949('0x68'),_0x3ca038['name'],_0x3ca038['converted_format']));fs['symlinkSync'](_0x5c5f9a,_0x3f64c1);return _0x3ca038;}})[_0x6949('0x4a')](function(_0x34ddd){throw new db[(_0x6949('0x6a'))][(_0x6949('0x5e'))](_0x34ddd[_0x6949('0x5f')]);});})[_0x6949('0x26')](handleEntityNotFound(_0x27e476,null))[_0x6949('0x26')](respondWithResult(_0x27e476,0xc9))['catch'](handleError(_0x27e476,null));};exports['removeSound']=function(_0x37f920,_0x3e9f4d,_0x535f78){return db['sequelize']['transaction'](function(_0x4a45be){var _0x38f3aa;return db['VoiceMusicOnHold'][_0x6949('0x62')]({'where':{'id':_0x37f920[_0x6949('0x49')]['id']}})[_0x6949('0x26')](handleEntityNotFound(_0x3e9f4d,null))[_0x6949('0x26')](function(_0xe568e9){if(_0xe568e9){_0x38f3aa=_0xe568e9;return _0xe568e9[_0x6949('0x6b')](_0x37f920['params'][_0x6949('0x6c')]);}})[_0x6949('0x26')](function(_0x4fb9e8){if(_0x4fb9e8){return db[_0x6949('0x61')][_0x6949('0x62')]({'where':{'id':_0x37f920[_0x6949('0x49')][_0x6949('0x6c')]},'attributes':['id',_0x6949('0x2b'),_0x6949('0x63'),_0x6949('0x64'),'createdAt'],'raw':!![]});}})[_0x6949('0x26')](function(_0x51f9cd){if(_0x51f9cd){fs[_0x6949('0x5c')](path['join'](_0x38f3aa[_0x6949('0x50')],util['format'](_0x6949('0x68'),_0x51f9cd['name'],_0x51f9cd[_0x6949('0x64')])));return _0x51f9cd;}})['catch'](function(_0x3d4496){throw new db['Sequelize'][(_0x6949('0x5e'))](_0x3d4496['message']);});})[_0x6949('0x26')](handleEntityNotFound(_0x3e9f4d,null))[_0x6949('0x26')](respondWithStatusCode(_0x3e9f4d,0xcc))['catch'](handleError(_0x3e9f4d,null));};exports[_0x6949('0x6d')]=function(_0x8511c6,_0x222017,_0x118669){var _0x69a953={};var _0x22b416={};var _0x1a9273;var _0x36ae02;return db[_0x6949('0x2e')]['findOne']({'where':{'id':_0x8511c6[_0x6949('0x49')]['id']}})[_0x6949('0x26')](handleEntityNotFound(_0x222017,null))[_0x6949('0x26')](function(_0x2e9641){if(_0x2e9641){_0x1a9273=_0x2e9641;_0x22b416[_0x6949('0x32')]=_[_0x6949('0x34')](db[_0x6949('0x61')]['rawAttributes']);_0x22b416[_0x6949('0x33')]=_[_0x6949('0x34')](_0x8511c6[_0x6949('0x33')]);_0x22b416[_0x6949('0x35')]=_['intersection'](_0x22b416['model'],_0x22b416[_0x6949('0x33')]);_0x69a953[_0x6949('0x37')]=_[_0x6949('0x36')](_0x22b416['model'],qs[_0x6949('0x38')](_0x8511c6[_0x6949('0x33')][_0x6949('0x38')]));_0x69a953[_0x6949('0x37')]=_0x69a953['attributes'][_0x6949('0x39')]?_0x69a953[_0x6949('0x37')]:_0x22b416[_0x6949('0x32')];_0x69a953['order']=qs['sort'](_0x8511c6[_0x6949('0x33')]['sort']);_0x69a953[_0x6949('0x3d')]=qs[_0x6949('0x35')](_[_0x6949('0x3e')](_0x8511c6[_0x6949('0x33')],_0x22b416[_0x6949('0x35')]));if(_0x8511c6['query']['filter']){_0x69a953['where']=_[_0x6949('0x40')](_0x69a953[_0x6949('0x3d')],{'$or':_['map'](_0x69a953[_0x6949('0x37')],function(_0x8783ea){var _0x50718b={};_0x50718b[_0x8783ea]={'$like':'%'+_0x8511c6[_0x6949('0x33')][_0x6949('0x3f')]+'%'};return _0x50718b;})});}_0x69a953=_[_0x6949('0x40')]({},_0x69a953,_0x8511c6[_0x6949('0x42')]);return _0x1a9273[_0x6949('0x6d')](_0x69a953);}})['then'](function(_0x2fb715){if(_0x2fb715){_0x36ae02=_0x2fb715[_0x6949('0x39')];if(!_0x8511c6[_0x6949('0x33')][_0x6949('0x3a')](_0x6949('0x6e'))){_0x69a953[_0x6949('0x3b')]=qs[_0x6949('0x3b')](_0x8511c6[_0x6949('0x33')][_0x6949('0x3b')]);_0x69a953[_0x6949('0x20')]=qs[_0x6949('0x20')](_0x8511c6[_0x6949('0x33')]['offset']);}return _0x1a9273['getSounds'](_0x69a953);}})[_0x6949('0x26')](function(_0x156930){if(_0x156930){return _0x156930?{'count':_0x36ae02,'rows':_0x156930}:null;}})[_0x6949('0x26')](respondWithResult(_0x222017,null))[_0x6949('0x4a')](handleError(_0x222017,null));}; \ No newline at end of file +var _0xa4c4=['sendStatus','end','json','offset','undefined','count','limit','status','set','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceMusicOnHold','includeAll','include','findAll','catch','params','length','find','body','sequelize','mode','files','directory','join','root','server/files/moh','create','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MusicOnHolds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','message','removeSound','id2','createdAt','getSounds','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util'];(function(_0x1e85b2,_0x2ee9ee){var _0x108bdb=function(_0x3436d8){while(--_0x3436d8){_0x1e85b2['push'](_0x1e85b2['shift']());}};_0x108bdb(++_0x2ee9ee);}(_0xa4c4,0x1a6));var _0x4a4c=function(_0x3dd6ab,_0xaa4566){_0x3dd6ab=_0x3dd6ab-0x0;var _0x1e97c1=_0xa4c4[_0x3dd6ab];return _0x1e97c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a4c('0x0'));var zipdir=require(_0x4a4c('0x1'));var jsonpatch=require(_0x4a4c('0x2'));var rp=require('request-promise');var moment=require(_0x4a4c('0x3'));var BPromise=require(_0x4a4c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4a4c('0x5'));var sox=require(_0x4a4c('0x6'));var csv=require(_0x4a4c('0x7'));var ejs=require(_0x4a4c('0x8'));var fs=require('fs');var fs_extra=require(_0x4a4c('0x9'));var _=require(_0x4a4c('0xa'));var squel=require(_0x4a4c('0xb'));var crypto=require(_0x4a4c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4a4c('0xd'));var toCsv=require(_0x4a4c('0x7'));var querystring=require(_0x4a4c('0xe'));var Papa=require(_0x4a4c('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4a4c('0x10'));var as=require(_0x4a4c('0x11'));var hardwareService=require(_0x4a4c('0x12'));var logger=require(_0x4a4c('0x13'))(_0x4a4c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4a4c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x537bf6,_0x126e1d){_0x126e1d=_0x126e1d||0xcc;return function(_0x4db003){if(_0x4db003){return _0x537bf6[_0x4a4c('0x16')](_0x126e1d);}return _0x537bf6['status'](_0x126e1d)[_0x4a4c('0x17')]();};}function respondWithResult(_0x90d3b3,_0x446d29){_0x446d29=_0x446d29||0xc8;return function(_0x18a19f){if(_0x18a19f){return _0x90d3b3['status'](_0x446d29)[_0x4a4c('0x18')](_0x18a19f);}};}function respondWithFilteredResult(_0x459cad,_0x18f454){return function(_0x3acd09){if(_0x3acd09){var _0x154659=typeof _0x18f454[_0x4a4c('0x19')]===_0x4a4c('0x1a')&&typeof _0x18f454['limit']==='undefined';var _0xc85b74=_0x3acd09[_0x4a4c('0x1b')];var _0x229e58=_0x154659?0x0:_0x18f454[_0x4a4c('0x19')];var _0x4159de=_0x154659?_0x3acd09[_0x4a4c('0x1b')]:_0x18f454[_0x4a4c('0x19')]+_0x18f454[_0x4a4c('0x1c')];var _0x468923;if(_0x4159de>=_0xc85b74){_0x4159de=_0xc85b74;_0x468923=0xc8;}else{_0x468923=0xce;}_0x459cad[_0x4a4c('0x1d')](_0x468923);return _0x459cad[_0x4a4c('0x1e')]('Content-Range',_0x229e58+'-'+_0x4159de+'/'+_0xc85b74)[_0x4a4c('0x18')](_0x3acd09);}return null;};}function patchUpdates(_0x3dd2ca){return function(_0x3a3727){try{jsonpatch[_0x4a4c('0x1f')](_0x3a3727,_0x3dd2ca,!![]);}catch(_0x582045){return BPromise['reject'](_0x582045);}return _0x3a3727[_0x4a4c('0x20')]();};}function saveUpdates(_0x432244,_0x42a4d4){return function(_0x48f86e){if(_0x48f86e){return _0x48f86e[_0x4a4c('0x21')](_0x432244)[_0x4a4c('0x22')](function(_0x4b6d2d){return _0x4b6d2d;});}return null;};}function removeEntity(_0x3660f9,_0x358029){return function(_0x162e89){if(_0x162e89){return _0x162e89[_0x4a4c('0x23')]()[_0x4a4c('0x22')](function(){var _0xa6567=_0x162e89[_0x4a4c('0x24')]({'plain':!![]});var _0x103eb4='MusicOnHolds';return db[_0x4a4c('0x25')]['destroy']({'where':{'type':_0x103eb4,'resourceId':_0xa6567['id']}})['then'](function(){return _0x162e89;});})['then'](function(){_0x3660f9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59b898,_0x36ed78){return function(_0x4f3465){if(!_0x4f3465){_0x59b898[_0x4a4c('0x16')](0x194);}return _0x4f3465;};}function handleError(_0x46c1b1,_0xde31db){_0xde31db=_0xde31db||0x1f4;return function(_0x11dda3){logger[_0x4a4c('0x26')](_0x11dda3[_0x4a4c('0x27')]);if(_0x11dda3[_0x4a4c('0x28')]){delete _0x11dda3['name'];}_0x46c1b1['status'](_0xde31db)[_0x4a4c('0x29')](_0x11dda3);};}exports[_0x4a4c('0x2a')]=function(_0x4baa84,_0x314120){var _0x4688c3={},_0x503201={},_0x3e8257={'count':0x0,'rows':[]};var _0x342edf=_['map'](db['VoiceMusicOnHold'][_0x4a4c('0x2b')],function(_0x12f315){return{'name':_0x12f315[_0x4a4c('0x2c')],'type':_0x12f315[_0x4a4c('0x2d')][_0x4a4c('0x2e')]};});_0x503201[_0x4a4c('0x2f')]=_[_0x4a4c('0x30')](_0x342edf,_0x4a4c('0x28'));_0x503201[_0x4a4c('0x31')]=_[_0x4a4c('0x32')](_0x4baa84[_0x4a4c('0x31')]);_0x503201[_0x4a4c('0x33')]=_[_0x4a4c('0x34')](_0x503201[_0x4a4c('0x2f')],_0x503201['query']);_0x4688c3[_0x4a4c('0x35')]=_[_0x4a4c('0x34')](_0x503201['model'],qs[_0x4a4c('0x36')](_0x4baa84[_0x4a4c('0x31')][_0x4a4c('0x36')]));_0x4688c3['attributes']=_0x4688c3[_0x4a4c('0x35')]['length']?_0x4688c3[_0x4a4c('0x35')]:_0x503201[_0x4a4c('0x2f')];if(!_0x4baa84[_0x4a4c('0x31')]['hasOwnProperty'](_0x4a4c('0x37'))){_0x4688c3[_0x4a4c('0x1c')]=qs[_0x4a4c('0x1c')](_0x4baa84[_0x4a4c('0x31')]['limit']);_0x4688c3['offset']=qs[_0x4a4c('0x19')](_0x4baa84[_0x4a4c('0x31')][_0x4a4c('0x19')]);}_0x4688c3[_0x4a4c('0x38')]=qs[_0x4a4c('0x39')](_0x4baa84[_0x4a4c('0x31')][_0x4a4c('0x39')]);delete _0x4baa84['query'][_0x4a4c('0x39')];_0x4688c3[_0x4a4c('0x3a')]=qs[_0x4a4c('0x33')](_[_0x4a4c('0x3b')](_0x4baa84[_0x4a4c('0x31')],_0x503201[_0x4a4c('0x33')]),_0x342edf);if(_0x4baa84[_0x4a4c('0x31')]['filter']){_0x4688c3[_0x4a4c('0x3a')]=_[_0x4a4c('0x3c')](_0x4688c3[_0x4a4c('0x3a')],{'$or':_['map'](_0x342edf,function(_0xd6cefc){if(_0xd6cefc[_0x4a4c('0x2d')]!==_0x4a4c('0x3d')){var _0x233c5f={};_0x233c5f[_0xd6cefc[_0x4a4c('0x28')]]={'$like':'%'+_0x4baa84[_0x4a4c('0x31')][_0x4a4c('0x3e')]+'%'};return _0x233c5f;}})});}_0x4688c3=_[_0x4a4c('0x3c')]({},_0x4688c3,_0x4baa84[_0x4a4c('0x3f')]);var _0x134e96={'where':_0x4688c3['where']};return db[_0x4a4c('0x40')][_0x4a4c('0x1b')](_0x134e96)['then'](function(_0xb574bf){_0x3e8257[_0x4a4c('0x1b')]=_0xb574bf;if(_0x4baa84[_0x4a4c('0x31')][_0x4a4c('0x41')]){_0x4688c3[_0x4a4c('0x42')]=[{'all':!![]}];}return db[_0x4a4c('0x40')][_0x4a4c('0x43')](_0x4688c3);})[_0x4a4c('0x22')](function(_0x142b5e){_0x3e8257['rows']=_0x142b5e;return _0x3e8257;})[_0x4a4c('0x22')](respondWithFilteredResult(_0x314120,_0x4688c3))[_0x4a4c('0x44')](handleError(_0x314120,null));};exports['show']=function(_0x5464e6,_0x28793e){var _0x4784ef={'raw':![],'where':{'id':_0x5464e6[_0x4a4c('0x45')]['id']}},_0x321d64={};_0x321d64[_0x4a4c('0x2f')]=_[_0x4a4c('0x32')](db[_0x4a4c('0x40')]['rawAttributes']);_0x321d64['query']=_[_0x4a4c('0x32')](_0x5464e6['query']);_0x321d64[_0x4a4c('0x33')]=_[_0x4a4c('0x34')](_0x321d64['model'],_0x321d64[_0x4a4c('0x31')]);_0x4784ef[_0x4a4c('0x35')]=_[_0x4a4c('0x34')](_0x321d64['model'],qs[_0x4a4c('0x36')](_0x5464e6[_0x4a4c('0x31')][_0x4a4c('0x36')]));_0x4784ef[_0x4a4c('0x35')]=_0x4784ef[_0x4a4c('0x35')][_0x4a4c('0x46')]?_0x4784ef['attributes']:_0x321d64[_0x4a4c('0x2f')];if(_0x5464e6[_0x4a4c('0x31')][_0x4a4c('0x41')]){_0x4784ef['include']=[{'all':!![]}];}_0x4784ef=_['merge']({},_0x4784ef,_0x5464e6[_0x4a4c('0x3f')]);return db[_0x4a4c('0x40')][_0x4a4c('0x47')](_0x4784ef)[_0x4a4c('0x22')](handleEntityNotFound(_0x28793e,null))[_0x4a4c('0x22')](respondWithResult(_0x28793e,null))['catch'](handleError(_0x28793e,null));};exports['update']=function(_0x40c50b,_0x11e2f2){if(_0x40c50b[_0x4a4c('0x48')]['id']){delete _0x40c50b[_0x4a4c('0x48')]['id'];}return db[_0x4a4c('0x40')][_0x4a4c('0x47')]({'where':{'id':_0x40c50b['params']['id']}})['then'](handleEntityNotFound(_0x11e2f2,null))[_0x4a4c('0x22')](saveUpdates(_0x40c50b[_0x4a4c('0x48')],null))['then'](respondWithResult(_0x11e2f2,null))[_0x4a4c('0x44')](handleError(_0x11e2f2,null));};exports['create']=function(_0x124750,_0x58a55a,_0x5ce127){return db[_0x4a4c('0x49')]['transaction'](function(_0x11084a){if(_0x124750['body'][_0x4a4c('0x4a')]===_0x4a4c('0x4b')){_0x124750[_0x4a4c('0x48')][_0x4a4c('0x4c')]=path[_0x4a4c('0x4d')](config[_0x4a4c('0x4e')],_0x4a4c('0x4f'),_0x124750['body'][_0x4a4c('0x28')]);}return db['VoiceMusicOnHold'][_0x4a4c('0x50')](_0x124750[_0x4a4c('0x48')],{'transaction':_0x11084a})[_0x4a4c('0x22')](function(_0x204d6c){if(_0x124750[_0x4a4c('0x48')][_0x4a4c('0x4a')]===_0x4a4c('0x4b')){fs[_0x4a4c('0x51')](_0x204d6c['directory'],parseInt(_0x4a4c('0x52'),0x8));}var _0x130006=_0x124750[_0x4a4c('0x53')][_0x4a4c('0x24')]({'plain':!![]});if(!_0x130006)throw new Error(_0x4a4c('0x54'));if(_0x130006[_0x4a4c('0x55')]==='user'){var _0x3adc72=_0x204d6c[_0x4a4c('0x24')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x4a4c('0x56'),'userProfileId':_0x130006['userProfileId']},'raw':!![]})['then'](function(_0x17ae64){if(_0x17ae64&&_0x17ae64[_0x4a4c('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x3adc72['name'],'resourceId':_0x3adc72['id'],'type':_0x17ae64[_0x4a4c('0x28')],'sectionId':_0x17ae64['id']},{})[_0x4a4c('0x22')](function(){return _0x204d6c;});}else{return _0x204d6c;}})[_0x4a4c('0x44')](function(_0x1a4cf8){logger[_0x4a4c('0x26')](_0x4a4c('0x58'),_0x1a4cf8);});}return _0x204d6c;});})[_0x4a4c('0x22')](respondWithResult(_0x58a55a,0xc9))[_0x4a4c('0x44')](handleError(_0x58a55a,null));};exports[_0x4a4c('0x23')]=function(_0x127259,_0x35f3a5,_0x382b66){var _0x3dfb84;return db[_0x4a4c('0x40')][_0x4a4c('0x47')]({'where':{'id':_0x127259[_0x4a4c('0x45')]['id']}})[_0x4a4c('0x22')](function(_0x34ddb6){if(_0x34ddb6){return db[_0x4a4c('0x49')][_0x4a4c('0x59')](function(_0x422e7e){return _0x34ddb6[_0x4a4c('0x23')]({'transaction':_0x422e7e,'raw':!![]})[_0x4a4c('0x22')](function(_0x30daae){if(_0x30daae[_0x4a4c('0x4c')]){fs['readdirSync'](_0x30daae[_0x4a4c('0x4c')])[_0x4a4c('0x5a')](function(_0x4d071b){fs[_0x4a4c('0x5b')](path[_0x4a4c('0x4d')](_0x30daae[_0x4a4c('0x4c')],_0x4d071b));});fs[_0x4a4c('0x5c')](_0x30daae[_0x4a4c('0x4c')]);}return _0x30daae;});})['catch'](function(_0x1c895a){throw new db[(_0x4a4c('0x5d'))][(_0x4a4c('0x5e'))](_0x1c895a['message']);});}})[_0x4a4c('0x22')](handleEntityNotFound(_0x35f3a5,null))['then'](removeEntity(_0x35f3a5,null))[_0x4a4c('0x44')](handleError(_0x35f3a5,null));};exports[_0x4a4c('0x5f')]=function(_0x5acb94,_0x5ad7cf,_0xd8cef5){return db[_0x4a4c('0x49')][_0x4a4c('0x59')](function(_0x5dcb2a){var _0x2f68d8;return db[_0x4a4c('0x40')]['find']({'where':{'id':_0x5acb94['params']['id']}})[_0x4a4c('0x22')](function(_0x63f719){if(_0x63f719){_0x2f68d8=_0x63f719;return _0x63f719['addSound'](_0x5acb94[_0x4a4c('0x48')]['id'],{'transaction':_0x5dcb2a});}})['then'](function(_0x1a908b){if(_0x1a908b){return db[_0x4a4c('0x60')][_0x4a4c('0x61')]({'where':{'id':_0x5acb94[_0x4a4c('0x48')]['id']},'attributes':['id','name',_0x4a4c('0x62'),_0x4a4c('0x63'),'createdAt'],'raw':!![]});}})[_0x4a4c('0x22')](function(_0x3e91cb){if(_0x3e91cb){var _0x2d0cc5=path['join'](config[_0x4a4c('0x4e')],_0x4a4c('0x64'),util[_0x4a4c('0x65')](_0x4a4c('0x66'),path[_0x4a4c('0x67')](_0x3e91cb['save_name'],path[_0x4a4c('0x68')](_0x3e91cb[_0x4a4c('0x62')])),_0x3e91cb[_0x4a4c('0x63')]));var _0x20c910=path[_0x4a4c('0x4d')](config[_0x4a4c('0x4e')],_0x4a4c('0x4f'),_0x2f68d8['name'],util['format'](_0x4a4c('0x66'),_0x3e91cb[_0x4a4c('0x28')],_0x3e91cb[_0x4a4c('0x63')]));fs[_0x4a4c('0x69')](_0x2d0cc5,_0x20c910);return _0x3e91cb;}})[_0x4a4c('0x44')](function(_0x46a63b){throw new db[(_0x4a4c('0x5d'))]['ValidationError'](_0x46a63b[_0x4a4c('0x6a')]);});})[_0x4a4c('0x22')](handleEntityNotFound(_0x5ad7cf,null))[_0x4a4c('0x22')](respondWithResult(_0x5ad7cf,0xc9))['catch'](handleError(_0x5ad7cf,null));};exports[_0x4a4c('0x6b')]=function(_0x1e9cde,_0x944945,_0x220aea){return db[_0x4a4c('0x49')][_0x4a4c('0x59')](function(_0x5ac666){var _0x58cebd;return db[_0x4a4c('0x40')][_0x4a4c('0x61')]({'where':{'id':_0x1e9cde[_0x4a4c('0x45')]['id']}})['then'](handleEntityNotFound(_0x944945,null))['then'](function(_0x2c1fde){if(_0x2c1fde){_0x58cebd=_0x2c1fde;return _0x2c1fde[_0x4a4c('0x6b')](_0x1e9cde[_0x4a4c('0x45')][_0x4a4c('0x6c')]);}})['then'](function(_0x57ebf7){if(_0x57ebf7){return db[_0x4a4c('0x60')]['findOne']({'where':{'id':_0x1e9cde[_0x4a4c('0x45')][_0x4a4c('0x6c')]},'attributes':['id',_0x4a4c('0x28'),_0x4a4c('0x62'),_0x4a4c('0x63'),_0x4a4c('0x6d')],'raw':!![]});}})[_0x4a4c('0x22')](function(_0x2a61d8){if(_0x2a61d8){fs[_0x4a4c('0x5b')](path[_0x4a4c('0x4d')](_0x58cebd[_0x4a4c('0x4c')],util['format']('%s.%s',_0x2a61d8[_0x4a4c('0x28')],_0x2a61d8[_0x4a4c('0x63')])));return _0x2a61d8;}})[_0x4a4c('0x44')](function(_0x198489){throw new db[(_0x4a4c('0x5d'))][(_0x4a4c('0x5e'))](_0x198489[_0x4a4c('0x6a')]);});})[_0x4a4c('0x22')](handleEntityNotFound(_0x944945,null))['then'](respondWithStatusCode(_0x944945,0xcc))['catch'](handleError(_0x944945,null));};exports[_0x4a4c('0x6e')]=function(_0xf769f,_0x57445f,_0xef0f61){var _0x21f6dc={};var _0x5353d5={};var _0x2dead5;var _0x997d80;return db[_0x4a4c('0x40')]['findOne']({'where':{'id':_0xf769f[_0x4a4c('0x45')]['id']}})[_0x4a4c('0x22')](handleEntityNotFound(_0x57445f,null))[_0x4a4c('0x22')](function(_0x333bb0){if(_0x333bb0){_0x2dead5=_0x333bb0;_0x5353d5[_0x4a4c('0x2f')]=_[_0x4a4c('0x32')](db['Sound'][_0x4a4c('0x2b')]);_0x5353d5[_0x4a4c('0x31')]=_[_0x4a4c('0x32')](_0xf769f[_0x4a4c('0x31')]);_0x5353d5[_0x4a4c('0x33')]=_['intersection'](_0x5353d5['model'],_0x5353d5['query']);_0x21f6dc[_0x4a4c('0x35')]=_[_0x4a4c('0x34')](_0x5353d5[_0x4a4c('0x2f')],qs['fields'](_0xf769f[_0x4a4c('0x31')][_0x4a4c('0x36')]));_0x21f6dc['attributes']=_0x21f6dc[_0x4a4c('0x35')][_0x4a4c('0x46')]?_0x21f6dc['attributes']:_0x5353d5[_0x4a4c('0x2f')];_0x21f6dc[_0x4a4c('0x38')]=qs[_0x4a4c('0x39')](_0xf769f[_0x4a4c('0x31')][_0x4a4c('0x39')]);_0x21f6dc['where']=qs[_0x4a4c('0x33')](_[_0x4a4c('0x3b')](_0xf769f[_0x4a4c('0x31')],_0x5353d5[_0x4a4c('0x33')]));if(_0xf769f[_0x4a4c('0x31')][_0x4a4c('0x3e')]){_0x21f6dc['where']=_[_0x4a4c('0x3c')](_0x21f6dc[_0x4a4c('0x3a')],{'$or':_[_0x4a4c('0x30')](_0x21f6dc[_0x4a4c('0x35')],function(_0x4d1696){var _0x1e2978={};_0x1e2978[_0x4d1696]={'$like':'%'+_0xf769f[_0x4a4c('0x31')]['filter']+'%'};return _0x1e2978;})});}_0x21f6dc=_[_0x4a4c('0x3c')]({},_0x21f6dc,_0xf769f['options']);return _0x2dead5[_0x4a4c('0x6e')](_0x21f6dc);}})[_0x4a4c('0x22')](function(_0x183581){if(_0x183581){_0x997d80=_0x183581[_0x4a4c('0x46')];if(!_0xf769f[_0x4a4c('0x31')]['hasOwnProperty'](_0x4a4c('0x37'))){_0x21f6dc[_0x4a4c('0x1c')]=qs[_0x4a4c('0x1c')](_0xf769f[_0x4a4c('0x31')][_0x4a4c('0x1c')]);_0x21f6dc[_0x4a4c('0x19')]=qs[_0x4a4c('0x19')](_0xf769f[_0x4a4c('0x31')][_0x4a4c('0x19')]);}return _0x2dead5[_0x4a4c('0x6e')](_0x21f6dc);}})[_0x4a4c('0x22')](function(_0x3107bc){if(_0x3107bc){return _0x3107bc?{'count':_0x997d80,'rows':_0x3107bc}:null;}})[_0x4a4c('0x22')](respondWithResult(_0x57445f,null))[_0x4a4c('0x44')](handleError(_0x57445f,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 94f9315..4f91d83 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 _0xbd16=['voice_musiconhold','lodash','../../config/logger','moment','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0xbd16,0x119));var _0x6bd1=function(_0x579ae4,_0x1cec71){_0x579ae4=_0x579ae4-0x0;var _0x441f23=_0xbd16[_0x579ae4];return _0x441f23;};'use strict';var _=require(_0x6bd1('0x0'));var util=require('util');var logger=require(_0x6bd1('0x1'))('api');var moment=require(_0x6bd1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6bd1('0x3'));var rimraf=require(_0x6bd1('0x4'));var config=require('../../config/environment');var attributes=require(_0x6bd1('0x5'));module[_0x6bd1('0x6')]=function(_0x5e397a,_0x779473){return _0x5e397a[_0x6bd1('0x7')](_0x6bd1('0x8'),attributes,{'tableName':_0x6bd1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x965a=['define','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird','path','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x35c48b,_0x55d8f0){var _0x30b87f=function(_0x550af6){while(--_0x550af6){_0x35c48b['push'](_0x35c48b['shift']());}};_0x30b87f(++_0x55d8f0);}(_0x965a,0x147));var _0xa965=function(_0x5ccefa,_0x427802){_0x5ccefa=_0x5ccefa-0x0;var _0x2bcf8e=_0x965a[_0x5ccefa];return _0x2bcf8e;};'use strict';var _=require(_0xa965('0x0'));var util=require(_0xa965('0x1'));var logger=require('../../config/logger')(_0xa965('0x2'));var moment=require(_0xa965('0x3'));var BPromise=require(_0xa965('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa965('0x5'));var rimraf=require('rimraf');var config=require(_0xa965('0x6'));var attributes=require(_0xa965('0x7'));module[_0xa965('0x8')]=function(_0x243e53,_0x4ecaa5){return _0x243e53[_0xa965('0x9')](_0xa965('0xa'),attributes,{'tableName':_0xa965('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 57437ff..98277d5 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 _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x140c43,_0x4b1bda){var _0x32678c=function(_0x2434e9){while(--_0x2434e9){_0x140c43['push'](_0x140c43['shift']());}};_0x32678c(++_0x4b1bda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x24212b,_0x19cd79){var _0x5319d7=function(_0x48a80c){while(--_0x48a80c){_0x24212b['push'](_0x24212b['shift']());}};_0x5319d7(++_0x19cd79);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0xcb91[_0x111e94];return _0x3de107;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index c57f3dc..7e7ac10 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 _0xae17=['../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5d0e61,_0x2e07bd){var _0x2bd01d=function(_0x3c33b3){while(--_0x3c33b3){_0x5d0e61['push'](_0x5d0e61['shift']());}};_0x2bd01d(++_0x2e07bd);}(_0xae17,0x171));var _0x7ae1=function(_0xabd73f,_0x42cda3){_0xabd73f=_0xabd73f-0x0;var _0x5276bc=_0xae17[_0xabd73f];return _0x5276bc;};'use strict';var multer=require(_0x7ae1('0x0'));var util=require(_0x7ae1('0x1'));var path=require(_0x7ae1('0x2'));var timeout=require(_0x7ae1('0x3'));var express=require(_0x7ae1('0x4'));var router=express['Router']();var fs_extra=require(_0x7ae1('0x5'));var auth=require(_0x7ae1('0x6'));var interaction=require(_0x7ae1('0x7'));var config=require(_0x7ae1('0x8'));var controller=require(_0x7ae1('0x9'));router[_0x7ae1('0xa')]('/',auth[_0x7ae1('0xb')](),controller[_0x7ae1('0xc')]);router[_0x7ae1('0xa')]('/describe',auth[_0x7ae1('0xb')](),controller[_0x7ae1('0xd')]);router[_0x7ae1('0xa')](_0x7ae1('0xe'),auth['isAuthenticated'](),controller[_0x7ae1('0xf')]);router[_0x7ae1('0xa')](_0x7ae1('0x10'),auth[_0x7ae1('0xb')](),controller[_0x7ae1('0x11')]);router[_0x7ae1('0xa')](_0x7ae1('0x12'),auth[_0x7ae1('0xb')](),controller[_0x7ae1('0x13')]);router[_0x7ae1('0x14')]('/',auth['isAuthenticated'](),controller[_0x7ae1('0x15')]);router[_0x7ae1('0x14')](_0x7ae1('0x10'),auth[_0x7ae1('0xb')](),controller[_0x7ae1('0x16')]);router['post']('/:id/teams',auth[_0x7ae1('0xb')](),controller[_0x7ae1('0x17')]);router[_0x7ae1('0x18')](_0x7ae1('0xe'),auth[_0x7ae1('0xb')](),controller[_0x7ae1('0x19')]);router['delete']('/:id',auth[_0x7ae1('0xb')](),controller['destroy']);router[_0x7ae1('0x1a')](_0x7ae1('0x10'),auth[_0x7ae1('0xb')](),controller['removeAgents']);router['delete']('/:id/teams',auth[_0x7ae1('0xb')](),controller[_0x7ae1('0x1b')]);module[_0x7ae1('0x1c')]=router; \ No newline at end of file +var _0x00bb=['describe','/:id','/:id/users','getAgents','create','post','addAgents','addTeams','delete','removeAgents','/:id/teams','removeTeams','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','/describe','isAuthenticated'];(function(_0x3527eb,_0x2a1ddc){var _0x449056=function(_0x3d5b6e){while(--_0x3d5b6e){_0x3527eb['push'](_0x3527eb['shift']());}};_0x449056(++_0x2a1ddc);}(_0x00bb,0x1d8));var _0xb00b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x00bb[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var fs_extra=require(_0xb00b('0x4'));var auth=require(_0xb00b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb00b('0x6'));var controller=require(_0xb00b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb00b('0x8')](_0xb00b('0x9'),auth[_0xb00b('0xa')](),controller[_0xb00b('0xb')]);router[_0xb00b('0x8')](_0xb00b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb00b('0x8')](_0xb00b('0xd'),auth[_0xb00b('0xa')](),controller[_0xb00b('0xe')]);router[_0xb00b('0x8')]('/:id/teams',auth[_0xb00b('0xa')](),controller['getTeams']);router['post']('/',auth['isAuthenticated'](),controller[_0xb00b('0xf')]);router[_0xb00b('0x10')](_0xb00b('0xd'),auth[_0xb00b('0xa')](),controller[_0xb00b('0x11')]);router[_0xb00b('0x10')]('/:id/teams',auth[_0xb00b('0xa')](),controller[_0xb00b('0x12')]);router['put'](_0xb00b('0xc'),auth[_0xb00b('0xa')](),controller['update']);router['delete'](_0xb00b('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0xb00b('0x13')](_0xb00b('0xd'),auth[_0xb00b('0xa')](),controller[_0xb00b('0x14')]);router['delete'](_0xb00b('0x15'),auth['isAuthenticated'](),controller[_0xb00b('0x16')]);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 6ffabbb..956882c 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 _0x6dd6=['VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','STRING','name'];(function(_0x47f4bc,_0x2aa83f){var _0x42a392=function(_0x2df63e){while(--_0x2df63e){_0x47f4bc['push'](_0x47f4bc['shift']());}};_0x42a392(++_0x2aa83f);}(_0x6dd6,0xec));var _0x66dd=function(_0x225a75,_0x43c1de){_0x225a75=_0x225a75-0x0;var _0xee995d=_0x6dd6[_0x225a75];return _0xee995d;};'use strict';var Sequelize=require(_0x66dd('0x0'));module[_0x66dd('0x1')]={'name':{'type':Sequelize[_0x66dd('0x2')],'allowNull':![],'unique':_0x66dd('0x3')},'prefix':{'type':Sequelize[_0x66dd('0x4')],'get':function(_0x112da5){return _0x66dd('0x5')+this[_0x66dd('0x6')](_0x66dd('0x3'))+'-';}},'description':{'type':Sequelize[_0x66dd('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x66dd('0x7')]}}; \ No newline at end of file +var _0x90e7=['exports','STRING','name','getDataValue','INTEGER'];(function(_0x57b236,_0x30614e){var _0x4feb29=function(_0x26d3e6){while(--_0x26d3e6){_0x57b236['push'](_0x57b236['shift']());}};_0x4feb29(++_0x30614e);}(_0x90e7,0xc8));var _0x790e=function(_0x5cd5df,_0x5d087c){_0x5cd5df=_0x5cd5df-0x0;var _0x596175=_0x90e7[_0x5cd5df];return _0x596175;};'use strict';var Sequelize=require('sequelize');module[_0x790e('0x0')]={'name':{'type':Sequelize[_0x790e('0x1')],'allowNull':![],'unique':_0x790e('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x34277d){return'system-'+this[_0x790e('0x3')](_0x790e('0x2'))+'-';}},'description':{'type':Sequelize[_0x790e('0x1')]},'callerIdAll':{'type':Sequelize[_0x790e('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x790e('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index c728e7e..56c2e89 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 _0xbbbc=['filters','filter','merge','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','params','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','system','priority','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','update','findById','addAgents','ids','omit','body','emit','userVoicePrefix:save','removeAgents','isArray','findOne','pick','getAgents','Team','getTeams','hasOwnProperty','addTeams','Agents','online','interface','flatMap','each','TeamVoicePrefix','findOrCreate','forEach','removeTeams','field','from','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userVoicePrefix:remove','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','status','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where'];(function(_0x2cd1dc,_0x1e3567){var _0x87efef=function(_0x4a1f78){while(--_0x4a1f78){_0x2cd1dc['push'](_0x2cd1dc['shift']());}};_0x87efef(++_0x1e3567);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x54727f,_0x81ee6f){_0x54727f=_0x54727f-0x0;var _0x5900df=_0xbbbc[_0x54727f];return _0x5900df;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];config['redis']=_[_0xcbbb('0x18')](config['redis'],{'host':_0xcbbb('0x19'),'port':0x18eb});var socket=require(_0xcbbb('0x1a'))(new Redis(config[_0xcbbb('0x1b')]));require('./voicePrefix.socket')[_0xcbbb('0x1c')](socket);function respondWithStatusCode(_0x3ff767,_0x8a325c){_0x8a325c=_0x8a325c||0xcc;return function(_0x273e13){if(_0x273e13){return _0x3ff767['sendStatus'](_0x8a325c);}return _0x3ff767['status'](_0x8a325c)[_0xcbbb('0x1d')]();};}function respondWithResult(_0x30297d,_0xf76038){_0xf76038=_0xf76038||0xc8;return function(_0x188698){if(_0x188698){return _0x30297d['status'](_0xf76038)[_0xcbbb('0x1e')](_0x188698);}};}function respondWithFilteredResult(_0x4ff973,_0x1fbfb1){return function(_0x3436af){if(_0x3436af){var _0x3572bb=typeof _0x1fbfb1['offset']==='undefined'&&typeof _0x1fbfb1['limit']===_0xcbbb('0x1f');var _0x3ae91b=_0x3436af[_0xcbbb('0x20')];var _0x25e92f=_0x3572bb?0x0:_0x1fbfb1[_0xcbbb('0x21')];var _0x1cca90=_0x3572bb?_0x3436af[_0xcbbb('0x20')]:_0x1fbfb1[_0xcbbb('0x21')]+_0x1fbfb1[_0xcbbb('0x22')];var _0x2d4335;if(_0x1cca90>=_0x3ae91b){_0x1cca90=_0x3ae91b;_0x2d4335=0xc8;}else{_0x2d4335=0xce;}_0x4ff973['status'](_0x2d4335);return _0x4ff973[_0xcbbb('0x23')](_0xcbbb('0x24'),_0x25e92f+'-'+_0x1cca90+'/'+_0x3ae91b)[_0xcbbb('0x1e')](_0x3436af);}return null;};}function patchUpdates(_0x42aaf1){return function(_0x258d1f){try{jsonpatch[_0xcbbb('0x25')](_0x258d1f,_0x42aaf1,!![]);}catch(_0x297eae){return BPromise[_0xcbbb('0x26')](_0x297eae);}return _0x258d1f[_0xcbbb('0x27')]();};}function saveUpdates(_0x5e3970,_0xf39ddd){return function(_0x4490c1){if(_0x4490c1){return _0x4490c1['update'](_0x5e3970)[_0xcbbb('0x28')](function(_0x4ffa80){return _0x4ffa80;});}return null;};}function removeEntity(_0x48dfc4,_0x575d56){return function(_0x32e070){if(_0x32e070){return _0x32e070['destroy']()['then'](function(){var _0x5499a1=_0x32e070[_0xcbbb('0x29')]({'plain':!![]});var _0x55e1d8='VoicePrefixes';return db[_0xcbbb('0x2a')][_0xcbbb('0x2b')]({'where':{'type':_0x55e1d8,'resourceId':_0x5499a1['id']}})[_0xcbbb('0x28')](function(){return _0x32e070;});})[_0xcbbb('0x28')](function(){_0x48dfc4[_0xcbbb('0x2c')](0xcc)[_0xcbbb('0x1d')]();});}};}function handleEntityNotFound(_0x3d4c0d,_0x1c986d){return function(_0x2a023f){if(!_0x2a023f){_0x3d4c0d[_0xcbbb('0x2d')](0x194);}return _0x2a023f;};}function handleError(_0x1c2ac9,_0xeb8cd8){_0xeb8cd8=_0xeb8cd8||0x1f4;return function(_0xfa973b){logger[_0xcbbb('0x2e')](_0xfa973b[_0xcbbb('0x2f')]);if(_0xfa973b[_0xcbbb('0x30')]){delete _0xfa973b[_0xcbbb('0x30')];}_0x1c2ac9[_0xcbbb('0x2c')](_0xeb8cd8)['send'](_0xfa973b);};}exports[_0xcbbb('0x31')]=function(_0x203a34,_0x5332f9){var _0xec2761={},_0x539dcf={},_0x2d37d3={'count':0x0,'rows':[]};var _0x1fb05e=_[_0xcbbb('0x32')](db['VoicePrefix'][_0xcbbb('0x33')],function(_0xa4743b){return{'name':_0xa4743b[_0xcbbb('0x34')],'type':_0xa4743b[_0xcbbb('0x35')][_0xcbbb('0x36')]};});_0x539dcf[_0xcbbb('0x37')]=_[_0xcbbb('0x32')](_0x1fb05e,_0xcbbb('0x30'));_0x539dcf[_0xcbbb('0x38')]=_[_0xcbbb('0x39')](_0x203a34['query']);_0x539dcf['filters']=_['intersection'](_0x539dcf['model'],_0x539dcf[_0xcbbb('0x38')]);_0xec2761[_0xcbbb('0x3a')]=_[_0xcbbb('0x3b')](_0x539dcf[_0xcbbb('0x37')],qs[_0xcbbb('0x3c')](_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0xec2761[_0xcbbb('0x3a')]=_0xec2761[_0xcbbb('0x3a')][_0xcbbb('0x3d')]?_0xec2761[_0xcbbb('0x3a')]:_0x539dcf[_0xcbbb('0x37')];if(!_0x203a34['query']['hasOwnProperty'](_0xcbbb('0x3e'))){_0xec2761['limit']=qs['limit'](_0x203a34['query'][_0xcbbb('0x22')]);_0xec2761[_0xcbbb('0x21')]=qs[_0xcbbb('0x21')](_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x21')]);}_0xec2761[_0xcbbb('0x3f')]=qs[_0xcbbb('0x40')](_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x40')]);_0xec2761[_0xcbbb('0x41')]=qs[_0xcbbb('0x42')](_['pick'](_0x203a34[_0xcbbb('0x38')],_0x539dcf['filters']),_0x1fb05e);if(_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x43')]){_0xec2761[_0xcbbb('0x41')]=_[_0xcbbb('0x44')](_0xec2761[_0xcbbb('0x41')],{'$or':_[_0xcbbb('0x32')](_0x1fb05e,function(_0x5651fd){if(_0x5651fd['type']!=='VIRTUAL'){var _0xda1973={};_0xda1973[_0x5651fd[_0xcbbb('0x30')]]={'$like':'%'+_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x43')]+'%'};return _0xda1973;}})});}_0xec2761=_[_0xcbbb('0x44')]({},_0xec2761,_0x203a34[_0xcbbb('0x45')]);var _0x2b45ee={'where':_0xec2761['where']};return db[_0xcbbb('0x46')][_0xcbbb('0x20')](_0x2b45ee)['then'](function(_0x15b3bc){_0x2d37d3[_0xcbbb('0x20')]=_0x15b3bc;if(_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x47')]){_0xec2761[_0xcbbb('0x48')]=[{'all':!![]}];}return db['VoicePrefix'][_0xcbbb('0x49')](_0xec2761);})['then'](function(_0x520448){_0x2d37d3[_0xcbbb('0x4a')]=_0x520448;return _0x2d37d3;})[_0xcbbb('0x28')](respondWithFilteredResult(_0x5332f9,_0xec2761))[_0xcbbb('0x4b')](handleError(_0x5332f9,null));};exports[_0xcbbb('0x4c')]=function(_0xb5391d,_0x406e1c){var _0x2040bf={'raw':![],'where':{'id':_0xb5391d[_0xcbbb('0x4d')]['id']}},_0x3ba75e={};_0x3ba75e[_0xcbbb('0x37')]=_[_0xcbbb('0x39')](db[_0xcbbb('0x46')][_0xcbbb('0x33')]);_0x3ba75e[_0xcbbb('0x38')]=_['keys'](_0xb5391d[_0xcbbb('0x38')]);_0x3ba75e[_0xcbbb('0x42')]=_[_0xcbbb('0x3b')](_0x3ba75e[_0xcbbb('0x37')],_0x3ba75e['query']);_0x2040bf['attributes']=_['intersection'](_0x3ba75e[_0xcbbb('0x37')],qs[_0xcbbb('0x3c')](_0xb5391d[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0x2040bf[_0xcbbb('0x3a')]=_0x2040bf[_0xcbbb('0x3a')][_0xcbbb('0x3d')]?_0x2040bf['attributes']:_0x3ba75e[_0xcbbb('0x37')];if(_0xb5391d[_0xcbbb('0x38')][_0xcbbb('0x47')]){_0x2040bf[_0xcbbb('0x48')]=[{'all':!![]}];}_0x2040bf=_['merge']({},_0x2040bf,_0xb5391d[_0xcbbb('0x45')]);return db[_0xcbbb('0x46')][_0xcbbb('0x4e')](_0x2040bf)[_0xcbbb('0x28')](handleEntityNotFound(_0x406e1c,null))['then'](respondWithResult(_0x406e1c,null))['catch'](handleError(_0x406e1c,null));};exports[_0xcbbb('0x2b')]=function(_0x421137,_0x3dc052){return db['VoicePrefix']['find']({'where':{'id':_0x421137['params']['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x3dc052,null))[_0xcbbb('0x28')](removeEntity(_0x3dc052,null))['catch'](handleError(_0x3dc052,null));};exports[_0xcbbb('0x4f')]=function(_0x35bb94,_0x2dc313){return db[_0xcbbb('0x46')]['describe']()[_0xcbbb('0x28')](respondWithResult(_0x2dc313,null))[_0xcbbb('0x4b')](handleError(_0x2dc313,null));};exports[_0xcbbb('0x50')]=function(_0x3526f5,_0xb267da){var _0x3679f4;return db[_0xcbbb('0x51')][_0xcbbb('0x52')](function(_0x2d3990){return db[_0xcbbb('0x46')][_0xcbbb('0x50')](_0x3526f5['body'],{'transaction':_0x2d3990})['then'](function(_0x3fb0bd){_0x3679f4=_0x3fb0bd[_0xcbbb('0x29')]({'plain':!![]});return db[_0xcbbb('0x53')]['find']({'where':{'id':_0x3679f4[_0xcbbb('0x54')]},'raw':!![]})['then'](function(_0x2a9958){return createVoicePrefixExtensions(_0x3679f4,_0x2a9958,_0x2d3990);});});})[_0xcbbb('0x28')](function(){var _0x317633=_0x3526f5[_0xcbbb('0x55')][_0xcbbb('0x29')]({'plain':!![]});if(!_0x317633)throw new Error(_0xcbbb('0x56'));if(_0x317633['role']==='user'){var _0x4cc098=_0x3679f4;return db[_0xcbbb('0x57')][_0xcbbb('0x4e')]({'where':{'name':_0xcbbb('0x58'),'userProfileId':_0x317633[_0xcbbb('0x59')]},'raw':!![]})[_0xcbbb('0x28')](function(_0x30bc24){if(_0x30bc24&&_0x30bc24[_0xcbbb('0x5a')]===0x0){return db[_0xcbbb('0x2a')][_0xcbbb('0x50')]({'name':_0x4cc098[_0xcbbb('0x30')],'resourceId':_0x4cc098['id'],'type':_0x30bc24[_0xcbbb('0x30')],'sectionId':_0x30bc24['id']},{})[_0xcbbb('0x28')](function(){return _0x3679f4;});}else{return _0x3679f4;}})[_0xcbbb('0x4b')](function(_0x48d295){logger[_0xcbbb('0x2e')](_0xcbbb('0x5b'),_0x48d295);throw _0x48d295;});}return _0x3679f4;})[_0xcbbb('0x28')](respondWithResult(_0xb267da,null))['catch'](handleError(_0xb267da,null));};function Extension(_0x17d714,_0x1dbf9b,_0x5501d5,_0x26f0e6){this['context']=_0xcbbb('0x5c');this[_0xcbbb('0x5d')]=_0x17d714;this['app']=_0x5501d5;this[_0xcbbb('0x35')]=_0xcbbb('0x5e');this['description']='Voice\x20Prefix\x20Extension';this[_0xcbbb('0x5f')]=_0x1dbf9b;this['appdata']=_0x26f0e6;}function createVoicePrefixExtensions(_0x411bc6,_0x4c56fe,_0xb68922){return new BPromise(function(_0x3849d8,_0x20aaa9){var _0x4b4bb7=new Extension(formatPrefixName(_0x411bc6['prefix']),0x1,_0xcbbb('0x60'),_0xcbbb('0x61'));_0x4b4bb7['VoicePrefixId']=_0x411bc6['id'];return db[_0xcbbb('0x53')][_0xcbbb('0x50')](_0x4b4bb7,{'transaction':_0xb68922})[_0xcbbb('0x28')](function(_0x556e48){var _0xe347c6=_0x556e48[_0xcbbb('0x29')]({'plain':!![]});var _0x12ef00=_[_0xcbbb('0x32')](addVoicePrefixExtensions(_0x411bc6,_0x4c56fe),function(_0xf13e52){_0xf13e52[_0xcbbb('0x54')]=_0xe347c6['id'];_0xf13e52[_0xcbbb('0x62')]=_0x411bc6['id'];return _0xf13e52;});return db['VoiceExtension']['bulkCreate'](_0x12ef00,{'transaction':_0xb68922})[_0xcbbb('0x28')](function(_0x2469e5){if(!_0x2469e5){return _0x20aaa9(_0xcbbb('0x63'));}else{return _0x3849d8(_0x2469e5);}})[_0xcbbb('0x4b')](function(_0x4bc7cc){return _0x20aaa9(_0x4bc7cc);});});;});};function addVoicePrefixExtensions(_0x5c6bf7,_0x3781df){var _0x4f6529=[];var _0x5ea915=formatPrefixName(_0x5c6bf7[_0xcbbb('0x64')]);_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x2,_0xcbbb('0x66'),_0xcbbb('0x67')+_0x5c6bf7[_0xcbbb('0x30')]));if(_0x5c6bf7[_0xcbbb('0x68')]){_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x3,'Set',_0xcbbb('0x69')+_0x5c6bf7['callerIdAll']));}else{_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x3,'NoOp',_0xcbbb('0x6a')));}_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x4,_0xcbbb('0x6b'),_0x3781df[_0xcbbb('0x6c')]+','+_0xcbbb('0x6d')+(0x8+_0x5c6bf7[_0xcbbb('0x30')][_0xcbbb('0x3d')])+'}'+','+0x1));return _0x4f6529;}function formatPrefixName(_0x619340){var _0x4ff7db='_';for(var _0x57d776=0x0;_0x57d776<_0x619340[_0xcbbb('0x3d')];_0x57d776++){if(_0x619340[_0xcbbb('0x6e')](_0x57d776)=='-'){_0x4ff7db+=_0x619340[_0xcbbb('0x6e')](_0x57d776);}else{_0x4ff7db+='['+_0x619340[_0xcbbb('0x6e')](_0x57d776)+']';}}_0x4ff7db+='.';return _0x4ff7db;}exports['update']=function(_0x583c33,_0x590fc6,_0x6060d){var _0x2f0db8=_0x583c33['body'];_0x2f0db8[_0xcbbb('0x64')]=_0xcbbb('0x6f')+_0x2f0db8['name']+'-';return db[_0xcbbb('0x51')][_0xcbbb('0x52')](function(_0x4e2198){return db[_0xcbbb('0x46')][_0xcbbb('0x70')](_0x2f0db8,{'where':{'id':_0x2f0db8['id']},'transaction':_0x4e2198})[_0xcbbb('0x28')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x2f0db8['id']},'transaction':_0x4e2198})[_0xcbbb('0x28')](function(){return db[_0xcbbb('0x53')][_0xcbbb('0x4e')]({'where':{'id':_0x2f0db8['VoiceExtensionId']},'raw':!![]})['then'](function(_0x128d79){return createVoicePrefixExtensions(_0x2f0db8,_0x128d79,_0x4e2198);});});});})[_0xcbbb('0x28')](function(){return db[_0xcbbb('0x46')][_0xcbbb('0x71')](_0x2f0db8['id']);})[_0xcbbb('0x28')](respondWithResult(_0x590fc6,null))[_0xcbbb('0x4b')](handleError(_0x590fc6,null));};exports[_0xcbbb('0x72')]=function(_0x194b4b,_0x3e401d,_0x305344){return db[_0xcbbb('0x46')]['find']({'where':{'id':_0x194b4b[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x3e401d,null))[_0xcbbb('0x28')](function(_0x3ad059){if(_0x3ad059){return _0x3ad059[_0xcbbb('0x72')](_0x194b4b['body'][_0xcbbb('0x73')],_[_0xcbbb('0x74')](_0x194b4b[_0xcbbb('0x75')],[_0xcbbb('0x73'),'id'])||{})['spread'](function(_0x264c34){for(var _0x22de60=0x0;_0x22de60<_0x194b4b[_0xcbbb('0x75')]['ids']['length'];_0x22de60+=0x1){socket[_0xcbbb('0x76')](_0xcbbb('0x77'),{'UserId':Number(_0x194b4b[_0xcbbb('0x75')][_0xcbbb('0x73')][_0x22de60]),'VoicePrefixId':Number(_0x194b4b['params']['id'])});}return _0x264c34;});}})[_0xcbbb('0x28')](respondWithResult(_0x3e401d,null))[_0xcbbb('0x4b')](handleError(_0x3e401d,null));};exports[_0xcbbb('0x78')]=function(_0x349674,_0x42a9d3,_0x5706e6){return db['VoicePrefix'][_0xcbbb('0x4e')]({'where':{'id':_0x349674[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x42a9d3,null))[_0xcbbb('0x28')](function(_0x14eaec){if(_0x14eaec){return _0x14eaec[_0xcbbb('0x78')](_0x349674['query'][_0xcbbb('0x73')])[_0xcbbb('0x28')](function(){if(_[_0xcbbb('0x79')](_0x349674[_0xcbbb('0x38')][_0xcbbb('0x73')])){for(var _0x2b1277=0x0;_0x2b1277<_0x349674[_0xcbbb('0x38')]['ids']['length'];_0x2b1277+=0x1){socket[_0xcbbb('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x349674['query'][_0xcbbb('0x73')][_0x2b1277]),'VoicePrefixId':Number(_0x349674['params']['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x349674[_0xcbbb('0x38')]['ids']),'VoicePrefixId':Number(_0x349674[_0xcbbb('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x42a9d3,null))['catch'](handleError(_0x42a9d3,null));};exports['getAgents']=function(_0x4de2dd,_0x1c9dd2,_0x14c60b){var _0x56b09b={};var _0x4bb903={};var _0x130f91;var _0x1bffe9;return db['VoicePrefix'][_0xcbbb('0x7a')]({'where':{'id':_0x4de2dd[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x1c9dd2,null))[_0xcbbb('0x28')](function(_0x24b949){if(_0x24b949){_0x130f91=_0x24b949;_0x4bb903[_0xcbbb('0x37')]=_[_0xcbbb('0x39')](db['User'][_0xcbbb('0x33')]);_0x4bb903[_0xcbbb('0x38')]=_['keys'](_0x4de2dd[_0xcbbb('0x38')]);_0x4bb903[_0xcbbb('0x42')]=_[_0xcbbb('0x3b')](_0x4bb903[_0xcbbb('0x37')],_0x4bb903[_0xcbbb('0x38')]);_0x56b09b[_0xcbbb('0x3a')]=_['intersection'](_0x4bb903['model'],qs[_0xcbbb('0x3c')](_0x4de2dd[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0x56b09b[_0xcbbb('0x3a')]=_0x56b09b[_0xcbbb('0x3a')]['length']?_0x56b09b[_0xcbbb('0x3a')]:_0x4bb903[_0xcbbb('0x37')];_0x56b09b[_0xcbbb('0x3f')]=qs[_0xcbbb('0x40')](_0x4de2dd[_0xcbbb('0x38')][_0xcbbb('0x40')]);_0x56b09b[_0xcbbb('0x41')]=qs[_0xcbbb('0x42')](_[_0xcbbb('0x7b')](_0x4de2dd[_0xcbbb('0x38')],_0x4bb903[_0xcbbb('0x42')]));if(_0x4de2dd['query']['filter']){_0x56b09b[_0xcbbb('0x41')]=_[_0xcbbb('0x44')](_0x56b09b[_0xcbbb('0x41')],{'$or':_[_0xcbbb('0x32')](_0x56b09b[_0xcbbb('0x3a')],function(_0x4a964b){var _0x1d7b6b={};_0x1d7b6b[_0x4a964b]={'$like':'%'+_0x4de2dd[_0xcbbb('0x38')]['filter']+'%'};return _0x1d7b6b;})});}_0x56b09b=_['merge']({},_0x56b09b,_0x4de2dd[_0xcbbb('0x45')]);return _0x130f91['getAgents'](_0x56b09b);}})[_0xcbbb('0x28')](function(_0x1a5dd3){if(_0x1a5dd3){_0x1bffe9=_0x1a5dd3[_0xcbbb('0x3d')];if(!_0x4de2dd[_0xcbbb('0x38')]['hasOwnProperty']('nolimit')){_0x56b09b[_0xcbbb('0x22')]=qs[_0xcbbb('0x22')](_0x4de2dd['query'][_0xcbbb('0x22')]);_0x56b09b[_0xcbbb('0x21')]=qs[_0xcbbb('0x21')](_0x4de2dd[_0xcbbb('0x38')][_0xcbbb('0x21')]);}return _0x130f91[_0xcbbb('0x7c')](_0x56b09b);}})[_0xcbbb('0x28')](function(_0x49f482){if(_0x49f482){return _0x49f482?{'count':_0x1bffe9,'rows':_0x49f482}:null;}})[_0xcbbb('0x28')](respondWithResult(_0x1c9dd2,null))[_0xcbbb('0x4b')](handleError(_0x1c9dd2,null));};exports['getTeams']=function(_0x10667e,_0x549d6c,_0x7a604f){var _0x10f932={};var _0x736484={};var _0x369b6f;var _0x4dc485;return db[_0xcbbb('0x46')][_0xcbbb('0x7a')]({'where':{'id':_0x10667e[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x549d6c,null))[_0xcbbb('0x28')](function(_0x4a5a59){if(_0x4a5a59){_0x369b6f=_0x4a5a59;_0x736484['model']=_[_0xcbbb('0x39')](db[_0xcbbb('0x7d')][_0xcbbb('0x33')]);_0x736484[_0xcbbb('0x38')]=_[_0xcbbb('0x39')](_0x10667e['query']);_0x736484['filters']=_[_0xcbbb('0x3b')](_0x736484[_0xcbbb('0x37')],_0x736484[_0xcbbb('0x38')]);_0x10f932[_0xcbbb('0x3a')]=_[_0xcbbb('0x3b')](_0x736484['model'],qs[_0xcbbb('0x3c')](_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0x10f932['attributes']=_0x10f932[_0xcbbb('0x3a')][_0xcbbb('0x3d')]?_0x10f932[_0xcbbb('0x3a')]:_0x736484[_0xcbbb('0x37')];_0x10f932[_0xcbbb('0x3f')]=qs[_0xcbbb('0x40')](_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x40')]);_0x10f932['where']=qs[_0xcbbb('0x42')](_['pick'](_0x10667e['query'],_0x736484['filters']));if(_0x10667e[_0xcbbb('0x38')]['filter']){_0x10f932[_0xcbbb('0x41')]=_[_0xcbbb('0x44')](_0x10f932['where'],{'$or':_[_0xcbbb('0x32')](_0x10f932[_0xcbbb('0x3a')],function(_0x4bf0b3){var _0x4314d3={};_0x4314d3[_0x4bf0b3]={'$like':'%'+_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x43')]+'%'};return _0x4314d3;})});}_0x10f932=_['merge']({},_0x10f932,_0x10667e[_0xcbbb('0x45')]);return _0x369b6f[_0xcbbb('0x7e')](_0x10f932);}})[_0xcbbb('0x28')](function(_0x2da472){if(_0x2da472){_0x4dc485=_0x2da472[_0xcbbb('0x3d')];if(!_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x7f')](_0xcbbb('0x3e'))){_0x10f932[_0xcbbb('0x22')]=qs['limit'](_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x22')]);_0x10f932[_0xcbbb('0x21')]=qs['offset'](_0x10667e['query'][_0xcbbb('0x21')]);}return _0x369b6f['getTeams'](_0x10f932);}})[_0xcbbb('0x28')](function(_0x198899){if(_0x198899){return _0x198899?{'count':_0x4dc485,'rows':_0x198899}:null;}})['then'](respondWithResult(_0x549d6c,null))[_0xcbbb('0x4b')](handleError(_0x549d6c,null));};exports[_0xcbbb('0x80')]=function(_0x59d833,_0x39951f,_0x283bc8){var _0x2754d1=_0x59d833[_0xcbbb('0x75')][_0xcbbb('0x73')];var _0x458b66;return db['Team'][_0xcbbb('0x49')]({'where':{'id':_0x2754d1},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcbbb('0x81'),'attributes':['id',_0xcbbb('0x30'),_0xcbbb('0x82'),'voicePause',_0xcbbb('0x83')],'raw':!![]}]})['then'](function(_0x32993d){if(_0x32993d){_0x458b66=_0x32993d;var _0x962f3f=_[_0xcbbb('0x84')](_0x32993d,function(_0x55ca6b){var _0x287b25=_0x55ca6b['get']({'plain':!![]});return _0x287b25[_0xcbbb('0x81')];});return db[_0xcbbb('0x46')][_0xcbbb('0x4e')]({'where':{'id':_0x59d833[_0xcbbb('0x4d')]['id']}})['then'](function(_0x16991b){return db['sequelize'][_0xcbbb('0x52')](function(_0xd01dff){return _0x16991b[_0xcbbb('0x80')](_0x2754d1,{'transaction':_0xd01dff})[_0xcbbb('0x28')](function(){return BPromise[_0xcbbb('0x85')](_0x458b66,function(_0x3ab011){return db[_0xcbbb('0x86')]['upsert']({'TeamId':_0x3ab011['id'],'VoicePrefixId':_0x59d833[_0xcbbb('0x4d')]['id']},{'transaction':_0xd01dff});});})[_0xcbbb('0x28')](function(){return BPromise[_0xcbbb('0x85')](_0x962f3f,function(_0x354314){return db['UserVoicePrefix'][_0xcbbb('0x87')]({'where':{'UserId':_0x354314['id'],'VoicePrefixId':_0x59d833[_0xcbbb('0x4d')]['id']},'transaction':_0xd01dff});});})[_0xcbbb('0x28')](function(){_0x962f3f[_0xcbbb('0x88')](function(_0x3fc8da){socket[_0xcbbb('0x76')]('userVoicePrefix:save',{'UserId':_0x3fc8da['id'],'VoicePrefixId':_0x16991b['id']});});});});});}})[_0xcbbb('0x28')](respondWithStatusCode(_0x39951f,null))[_0xcbbb('0x4b')](handleError(_0x39951f,null));};exports[_0xcbbb('0x89')]=function(_0x23bda8,_0x233c44,_0x26545e){return db[_0xcbbb('0x7d')][_0xcbbb('0x49')]({'where':{'id':_0x23bda8['query'][_0xcbbb('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcbbb('0x81'),'attributes':['id'],'raw':!![]}]})[_0xcbbb('0x28')](handleEntityNotFound(_0x233c44,null))[_0xcbbb('0x28')](function(_0x510bc9){var _0x1ce1c4=_[_0xcbbb('0x32')](_0x510bc9,'id');var _0x7fc4ea=[];var _0xde4f2b=[];var _0xabe61=squel['select']();_0xabe61[_0xcbbb('0x8a')]('tq.TeamId')[_0xcbbb('0x8b')]('team_has_voice_prefixes','tq')[_0xcbbb('0x8c')](_0xcbbb('0x8d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xcbbb('0x41')](_0xcbbb('0x8e'),_0x23bda8[_0xcbbb('0x4d')]['id']);for(var _0x3a3e73=0x0;_0x3a3e73<_0x510bc9[_0xcbbb('0x3d')];_0x3a3e73+=0x1){let _0x517af0=_0x510bc9[_0x3a3e73];for(var _0x4312c3=0x0;_0x4312c3<_0x517af0[_0xcbbb('0x81')][_0xcbbb('0x3d')];_0x4312c3+=0x1){let _0x1b34ac=_0x517af0[_0xcbbb('0x81')][_0x4312c3];var _0x402d10=_0xabe61[_0xcbbb('0x8f')]();_0x402d10[_0xcbbb('0x41')]('ut.UserId\x20=\x20?',_0x1b34ac['id']);_0xde4f2b['push'](db[_0xcbbb('0x51')]['query'](_0x402d10[_0xcbbb('0x90')](),{'type':db[_0xcbbb('0x51')][_0xcbbb('0x91')][_0xcbbb('0x92')]})[_0xcbbb('0x28')](function(_0x2129d8){if(_0x2129d8[_0xcbbb('0x3d')]===0x1){return _0x1b34ac['id'];}else{var _0x274e33=_[_0xcbbb('0x93')](_[_0xcbbb('0x32')](_0x2129d8,_0xcbbb('0x94')),function(_0x1c8981){return _[_0xcbbb('0x95')](_0x1ce1c4,_0x1c8981);});if(_0x274e33){return _0x1b34ac['id'];}}}));}}return BPromise[_0xcbbb('0x96')](_0xde4f2b)[_0xcbbb('0x28')](function(_0x4bcb5d){_0x7fc4ea=_(_0x7fc4ea)[_0xcbbb('0x97')](_0x4bcb5d)[_0xcbbb('0x98')]()[_0xcbbb('0x99')]();return db[_0xcbbb('0x46')]['find']({'where':{'id':_0x23bda8[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](function(_0x40fc06){return db[_0xcbbb('0x51')][_0xcbbb('0x52')](function(_0x357810){return _0x40fc06['removeTeams'](_0x23bda8[_0xcbbb('0x38')][_0xcbbb('0x73')],{'transaction':_0x357810})['then'](function(){if(!_[_0xcbbb('0x9a')](_0x7fc4ea)){return _0x40fc06[_0xcbbb('0x78')](_0x7fc4ea,{'transaction':_0x357810});}})[_0xcbbb('0x28')](function(){_0x7fc4ea[_0xcbbb('0x88')](function(_0x49e6e1){socket['emit'](_0xcbbb('0x9b'),{'UserId':_0x49e6e1,'VoicePrefixId':_0x40fc06['id']});});});});});});})[_0xcbbb('0x28')](respondWithStatusCode(_0x233c44,null))[_0xcbbb('0x4b')](handleError(_0x233c44,null));}; \ No newline at end of file +var _0x1c7c=['isArray','userVoicePrefix:remove','getAgents','findOne','keys','User','order','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VoicePrefix','includeAll','findAll','rows','catch','show','include','find','describe','sequelize','transaction','create','body','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','addAgents','params','omit','ids','emit','userVoicePrefix:save','removeAgents'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1c7c,0x164));var _0xc1c7=function(_0x4979f3,_0x4a0182){_0x4979f3=_0x4979f3-0x0;var _0x216d2c=_0x1c7c[_0x4979f3];return _0x216d2c;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];config[_0xc1c7('0x1b')]=_[_0xc1c7('0x1c')](config[_0xc1c7('0x1b')],{'host':_0xc1c7('0x1d'),'port':0x18eb});var socket=require(_0xc1c7('0x1e'))(new Redis(config[_0xc1c7('0x1b')]));require(_0xc1c7('0x1f'))[_0xc1c7('0x20')](socket);function respondWithStatusCode(_0x1b6905,_0x99b874){_0x99b874=_0x99b874||0xcc;return function(_0x34d392){if(_0x34d392){return _0x1b6905['sendStatus'](_0x99b874);}return _0x1b6905[_0xc1c7('0x21')](_0x99b874)[_0xc1c7('0x22')]();};}function respondWithResult(_0x21911c,_0x555b59){_0x555b59=_0x555b59||0xc8;return function(_0x94678a){if(_0x94678a){return _0x21911c[_0xc1c7('0x21')](_0x555b59)[_0xc1c7('0x23')](_0x94678a);}};}function respondWithFilteredResult(_0x39ac54,_0x20439e){return function(_0xb42702){if(_0xb42702){var _0x21758a=typeof _0x20439e[_0xc1c7('0x24')]==='undefined'&&typeof _0x20439e[_0xc1c7('0x25')]===_0xc1c7('0x26');var _0x3ec66a=_0xb42702[_0xc1c7('0x27')];var _0x4b706e=_0x21758a?0x0:_0x20439e[_0xc1c7('0x24')];var _0x4d6171=_0x21758a?_0xb42702[_0xc1c7('0x27')]:_0x20439e[_0xc1c7('0x24')]+_0x20439e['limit'];var _0x5846f0;if(_0x4d6171>=_0x3ec66a){_0x4d6171=_0x3ec66a;_0x5846f0=0xc8;}else{_0x5846f0=0xce;}_0x39ac54[_0xc1c7('0x21')](_0x5846f0);return _0x39ac54[_0xc1c7('0x28')](_0xc1c7('0x29'),_0x4b706e+'-'+_0x4d6171+'/'+_0x3ec66a)['json'](_0xb42702);}return null;};}function patchUpdates(_0x813853){return function(_0x341b41){try{jsonpatch[_0xc1c7('0x2a')](_0x341b41,_0x813853,!![]);}catch(_0x31a0e0){return BPromise[_0xc1c7('0x2b')](_0x31a0e0);}return _0x341b41[_0xc1c7('0x2c')]();};}function saveUpdates(_0x3180fd,_0x120168){return function(_0x22b654){if(_0x22b654){return _0x22b654[_0xc1c7('0x2d')](_0x3180fd)[_0xc1c7('0x2e')](function(_0x363fbc){return _0x363fbc;});}return null;};}function removeEntity(_0x33aac7,_0x260a3f){return function(_0xf1c405){if(_0xf1c405){return _0xf1c405[_0xc1c7('0x2f')]()['then'](function(){var _0xf0ab9c=_0xf1c405[_0xc1c7('0x30')]({'plain':!![]});var _0x4e1721='VoicePrefixes';return db[_0xc1c7('0x31')]['destroy']({'where':{'type':_0x4e1721,'resourceId':_0xf0ab9c['id']}})['then'](function(){return _0xf1c405;});})[_0xc1c7('0x2e')](function(){_0x33aac7[_0xc1c7('0x21')](0xcc)[_0xc1c7('0x22')]();});}};}function handleEntityNotFound(_0x243450,_0x461360){return function(_0x4adb81){if(!_0x4adb81){_0x243450['sendStatus'](0x194);}return _0x4adb81;};}function handleError(_0x1b6f97,_0x4275f9){_0x4275f9=_0x4275f9||0x1f4;return function(_0x9a0ab3){logger[_0xc1c7('0x32')](_0x9a0ab3[_0xc1c7('0x33')]);if(_0x9a0ab3['name']){delete _0x9a0ab3['name'];}_0x1b6f97[_0xc1c7('0x21')](_0x4275f9)[_0xc1c7('0x34')](_0x9a0ab3);};}exports['index']=function(_0x41b154,_0x3cf425){var _0x39b68c={},_0x1f9708={},_0x74b523={'count':0x0,'rows':[]};var _0x2d69d3=_[_0xc1c7('0x35')](db['VoicePrefix'][_0xc1c7('0x36')],function(_0xeac123){return{'name':_0xeac123[_0xc1c7('0x37')],'type':_0xeac123[_0xc1c7('0x38')][_0xc1c7('0x39')]};});_0x1f9708[_0xc1c7('0x3a')]=_[_0xc1c7('0x35')](_0x2d69d3,_0xc1c7('0x3b'));_0x1f9708[_0xc1c7('0x3c')]=_['keys'](_0x41b154['query']);_0x1f9708[_0xc1c7('0x3d')]=_[_0xc1c7('0x3e')](_0x1f9708[_0xc1c7('0x3a')],_0x1f9708[_0xc1c7('0x3c')]);_0x39b68c[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x1f9708[_0xc1c7('0x3a')],qs[_0xc1c7('0x40')](_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x40')]));_0x39b68c[_0xc1c7('0x3f')]=_0x39b68c[_0xc1c7('0x3f')][_0xc1c7('0x41')]?_0x39b68c[_0xc1c7('0x3f')]:_0x1f9708[_0xc1c7('0x3a')];if(!_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x42')](_0xc1c7('0x43'))){_0x39b68c[_0xc1c7('0x25')]=qs[_0xc1c7('0x25')](_0x41b154[_0xc1c7('0x3c')]['limit']);_0x39b68c['offset']=qs['offset'](_0x41b154[_0xc1c7('0x3c')]['offset']);}_0x39b68c['order']=qs[_0xc1c7('0x44')](_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x44')]);_0x39b68c[_0xc1c7('0x45')]=qs['filters'](_[_0xc1c7('0x46')](_0x41b154[_0xc1c7('0x3c')],_0x1f9708[_0xc1c7('0x3d')]),_0x2d69d3);if(_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x47')]){_0x39b68c[_0xc1c7('0x45')]=_[_0xc1c7('0x48')](_0x39b68c[_0xc1c7('0x45')],{'$or':_[_0xc1c7('0x35')](_0x2d69d3,function(_0x1810c7){if(_0x1810c7[_0xc1c7('0x38')]!==_0xc1c7('0x49')){var _0x23d0b2={};_0x23d0b2[_0x1810c7['name']]={'$like':'%'+_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x47')]+'%'};return _0x23d0b2;}})});}_0x39b68c=_['merge']({},_0x39b68c,_0x41b154[_0xc1c7('0x4a')]);var _0x23b10b={'where':_0x39b68c[_0xc1c7('0x45')]};return db[_0xc1c7('0x4b')][_0xc1c7('0x27')](_0x23b10b)[_0xc1c7('0x2e')](function(_0xd5e06a){_0x74b523[_0xc1c7('0x27')]=_0xd5e06a;if(_0x41b154[_0xc1c7('0x3c')][_0xc1c7('0x4c')]){_0x39b68c['include']=[{'all':!![]}];}return db[_0xc1c7('0x4b')][_0xc1c7('0x4d')](_0x39b68c);})['then'](function(_0x4c6834){_0x74b523[_0xc1c7('0x4e')]=_0x4c6834;return _0x74b523;})[_0xc1c7('0x2e')](respondWithFilteredResult(_0x3cf425,_0x39b68c))[_0xc1c7('0x4f')](handleError(_0x3cf425,null));};exports[_0xc1c7('0x50')]=function(_0x429221,_0x51a33f){var _0x1eca39={'raw':![],'where':{'id':_0x429221['params']['id']}},_0x805dac={};_0x805dac['model']=_['keys'](db[_0xc1c7('0x4b')][_0xc1c7('0x36')]);_0x805dac[_0xc1c7('0x3c')]=_['keys'](_0x429221[_0xc1c7('0x3c')]);_0x805dac[_0xc1c7('0x3d')]=_['intersection'](_0x805dac[_0xc1c7('0x3a')],_0x805dac[_0xc1c7('0x3c')]);_0x1eca39[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x805dac[_0xc1c7('0x3a')],qs[_0xc1c7('0x40')](_0x429221[_0xc1c7('0x3c')][_0xc1c7('0x40')]));_0x1eca39[_0xc1c7('0x3f')]=_0x1eca39[_0xc1c7('0x3f')][_0xc1c7('0x41')]?_0x1eca39[_0xc1c7('0x3f')]:_0x805dac[_0xc1c7('0x3a')];if(_0x429221[_0xc1c7('0x3c')][_0xc1c7('0x4c')]){_0x1eca39[_0xc1c7('0x51')]=[{'all':!![]}];}_0x1eca39=_[_0xc1c7('0x48')]({},_0x1eca39,_0x429221[_0xc1c7('0x4a')]);return db['VoicePrefix'][_0xc1c7('0x52')](_0x1eca39)['then'](handleEntityNotFound(_0x51a33f,null))[_0xc1c7('0x2e')](respondWithResult(_0x51a33f,null))[_0xc1c7('0x4f')](handleError(_0x51a33f,null));};exports[_0xc1c7('0x2f')]=function(_0x524088,_0x473e8d){return db[_0xc1c7('0x4b')]['find']({'where':{'id':_0x524088['params']['id']}})['then'](handleEntityNotFound(_0x473e8d,null))[_0xc1c7('0x2e')](removeEntity(_0x473e8d,null))[_0xc1c7('0x4f')](handleError(_0x473e8d,null));};exports['describe']=function(_0x49542,_0x12a1d2){return db[_0xc1c7('0x4b')][_0xc1c7('0x53')]()[_0xc1c7('0x2e')](respondWithResult(_0x12a1d2,null))[_0xc1c7('0x4f')](handleError(_0x12a1d2,null));};exports['create']=function(_0x259e55,_0x568377){var _0x307b5e;return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0x557cb6){return db[_0xc1c7('0x4b')][_0xc1c7('0x56')](_0x259e55[_0xc1c7('0x57')],{'transaction':_0x557cb6})[_0xc1c7('0x2e')](function(_0x1679c5){_0x307b5e=_0x1679c5[_0xc1c7('0x30')]({'plain':!![]});return db[_0xc1c7('0x58')][_0xc1c7('0x52')]({'where':{'id':_0x307b5e['VoiceExtensionId']},'raw':!![]})[_0xc1c7('0x2e')](function(_0x2a8664){return createVoicePrefixExtensions(_0x307b5e,_0x2a8664,_0x557cb6);});});})[_0xc1c7('0x2e')](function(){var _0x575fc5=_0x259e55['user'][_0xc1c7('0x30')]({'plain':!![]});if(!_0x575fc5)throw new Error(_0xc1c7('0x59'));if(_0x575fc5[_0xc1c7('0x5a')]==='user'){var _0x1c636c=_0x307b5e;return db['UserProfileSection'][_0xc1c7('0x52')]({'where':{'name':_0xc1c7('0x5b'),'userProfileId':_0x575fc5[_0xc1c7('0x5c')]},'raw':!![]})[_0xc1c7('0x2e')](function(_0x345a46){if(_0x345a46&&_0x345a46[_0xc1c7('0x5d')]===0x0){return db[_0xc1c7('0x31')]['create']({'name':_0x1c636c[_0xc1c7('0x3b')],'resourceId':_0x1c636c['id'],'type':_0x345a46[_0xc1c7('0x3b')],'sectionId':_0x345a46['id']},{})[_0xc1c7('0x2e')](function(){return _0x307b5e;});}else{return _0x307b5e;}})['catch'](function(_0x24fa71){logger['error'](_0xc1c7('0x5e'),_0x24fa71);throw _0x24fa71;});}return _0x307b5e;})['then'](respondWithResult(_0x568377,null))[_0xc1c7('0x4f')](handleError(_0x568377,null));};function Extension(_0x212d53,_0x314232,_0x3a94fb,_0x156d51){this['context']='from-sip';this['exten']=_0x212d53;this[_0xc1c7('0x5f')]=_0x3a94fb;this[_0xc1c7('0x38')]=_0xc1c7('0x60');this[_0xc1c7('0x61')]=_0xc1c7('0x62');this[_0xc1c7('0x63')]=_0x314232;this['appdata']=_0x156d51;}function createVoicePrefixExtensions(_0x19b8d7,_0xe5882,_0x1c010a){return new BPromise(function(_0x6e300e,_0x5f4f7a){var _0x2e4673=new Extension(formatPrefixName(_0x19b8d7[_0xc1c7('0x64')]),0x1,_0xc1c7('0x65'),'Voice\x20Prefix');_0x2e4673[_0xc1c7('0x66')]=_0x19b8d7['id'];return db[_0xc1c7('0x58')][_0xc1c7('0x56')](_0x2e4673,{'transaction':_0x1c010a})[_0xc1c7('0x2e')](function(_0x58b08b){var _0x552691=_0x58b08b[_0xc1c7('0x30')]({'plain':!![]});var _0x203790=_['map'](addVoicePrefixExtensions(_0x19b8d7,_0xe5882),function(_0x46dc1e){_0x46dc1e[_0xc1c7('0x67')]=_0x552691['id'];_0x46dc1e['VoicePrefixId']=_0x19b8d7['id'];return _0x46dc1e;});return db[_0xc1c7('0x58')][_0xc1c7('0x68')](_0x203790,{'transaction':_0x1c010a})['then'](function(_0x6b9337){if(!_0x6b9337){return _0x5f4f7a(_0xc1c7('0x69'));}else{return _0x6e300e(_0x6b9337);}})[_0xc1c7('0x4f')](function(_0x2b4db2){return _0x5f4f7a(_0x2b4db2);});});;});};function addVoicePrefixExtensions(_0x1087b2,_0x11c9d8){var _0x1ed9fc=[];var _0x33104e=formatPrefixName(_0x1087b2[_0xc1c7('0x64')]);_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x2,_0xc1c7('0x6b'),_0xc1c7('0x6c')+_0x1087b2[_0xc1c7('0x3b')]));if(_0x1087b2[_0xc1c7('0x6d')]){_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x3,_0xc1c7('0x6b'),_0xc1c7('0x6e')+_0x1087b2[_0xc1c7('0x6d')]));}else{_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x3,_0xc1c7('0x65'),_0xc1c7('0x6f')));}_0x1ed9fc[_0xc1c7('0x6a')](new Extension(_0x33104e,0x4,_0xc1c7('0x70'),_0x11c9d8[_0xc1c7('0x71')]+','+_0xc1c7('0x72')+(0x8+_0x1087b2[_0xc1c7('0x3b')][_0xc1c7('0x41')])+'}'+','+0x1));return _0x1ed9fc;}function formatPrefixName(_0x1448d8){var _0x47d58e='_';for(var _0x8c88c0=0x0;_0x8c88c0<_0x1448d8[_0xc1c7('0x41')];_0x8c88c0++){if(_0x1448d8[_0xc1c7('0x73')](_0x8c88c0)=='-'){_0x47d58e+=_0x1448d8[_0xc1c7('0x73')](_0x8c88c0);}else{_0x47d58e+='['+_0x1448d8[_0xc1c7('0x73')](_0x8c88c0)+']';}}_0x47d58e+='.';return _0x47d58e;}exports[_0xc1c7('0x2d')]=function(_0x1ccd7d,_0x29181f,_0x5f4f50){var _0xbbd4e3=_0x1ccd7d[_0xc1c7('0x57')];_0xbbd4e3[_0xc1c7('0x64')]=_0xc1c7('0x74')+_0xbbd4e3[_0xc1c7('0x3b')]+'-';return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0xa00af6){return db['VoicePrefix'][_0xc1c7('0x2d')](_0xbbd4e3,{'where':{'id':_0xbbd4e3['id']},'transaction':_0xa00af6})[_0xc1c7('0x2e')](function(){return db[_0xc1c7('0x58')][_0xc1c7('0x2f')]({'where':{'VoicePrefixId':_0xbbd4e3['id']},'transaction':_0xa00af6})[_0xc1c7('0x2e')](function(){return db[_0xc1c7('0x58')][_0xc1c7('0x52')]({'where':{'id':_0xbbd4e3[_0xc1c7('0x67')]},'raw':!![]})[_0xc1c7('0x2e')](function(_0x125270){return createVoicePrefixExtensions(_0xbbd4e3,_0x125270,_0xa00af6);});});});})[_0xc1c7('0x2e')](function(){return db[_0xc1c7('0x4b')]['findById'](_0xbbd4e3['id']);})['then'](respondWithResult(_0x29181f,null))[_0xc1c7('0x4f')](handleError(_0x29181f,null));};exports[_0xc1c7('0x75')]=function(_0xc16f09,_0x11fd01,_0x44a24b){return db[_0xc1c7('0x4b')][_0xc1c7('0x52')]({'where':{'id':_0xc16f09[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x11fd01,null))[_0xc1c7('0x2e')](function(_0x180607){if(_0x180607){return _0x180607[_0xc1c7('0x75')](_0xc16f09[_0xc1c7('0x57')]['ids'],_[_0xc1c7('0x77')](_0xc16f09[_0xc1c7('0x57')],[_0xc1c7('0x78'),'id'])||{})['spread'](function(_0x4de022){for(var _0x550c4a=0x0;_0x550c4a<_0xc16f09[_0xc1c7('0x57')][_0xc1c7('0x78')]['length'];_0x550c4a+=0x1){socket[_0xc1c7('0x79')](_0xc1c7('0x7a'),{'UserId':Number(_0xc16f09['body']['ids'][_0x550c4a]),'VoicePrefixId':Number(_0xc16f09['params']['id'])});}return _0x4de022;});}})[_0xc1c7('0x2e')](respondWithResult(_0x11fd01,null))['catch'](handleError(_0x11fd01,null));};exports[_0xc1c7('0x7b')]=function(_0x3bc3aa,_0xf899a,_0x4b7a34){return db[_0xc1c7('0x4b')]['find']({'where':{'id':_0x3bc3aa[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0xf899a,null))['then'](function(_0xf7b22e){if(_0xf7b22e){return _0xf7b22e[_0xc1c7('0x7b')](_0x3bc3aa[_0xc1c7('0x3c')][_0xc1c7('0x78')])[_0xc1c7('0x2e')](function(){if(_[_0xc1c7('0x7c')](_0x3bc3aa[_0xc1c7('0x3c')][_0xc1c7('0x78')])){for(var _0x425f3d=0x0;_0x425f3d<_0x3bc3aa[_0xc1c7('0x3c')]['ids'][_0xc1c7('0x41')];_0x425f3d+=0x1){socket[_0xc1c7('0x79')](_0xc1c7('0x7d'),{'UserId':Number(_0x3bc3aa[_0xc1c7('0x3c')]['ids'][_0x425f3d]),'VoicePrefixId':Number(_0x3bc3aa[_0xc1c7('0x76')]['id'])});}}else{socket[_0xc1c7('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x3bc3aa['query'][_0xc1c7('0x78')]),'VoicePrefixId':Number(_0x3bc3aa[_0xc1c7('0x76')]['id'])});}});}})[_0xc1c7('0x2e')](respondWithStatusCode(_0xf899a,null))[_0xc1c7('0x4f')](handleError(_0xf899a,null));};exports[_0xc1c7('0x7e')]=function(_0x176603,_0x48309e,_0x1f0c3f){var _0x2ad4f5={};var _0x5698e9={};var _0x65161e;var _0x32c26e;return db[_0xc1c7('0x4b')][_0xc1c7('0x7f')]({'where':{'id':_0x176603[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x48309e,null))[_0xc1c7('0x2e')](function(_0x175bba){if(_0x175bba){_0x65161e=_0x175bba;_0x5698e9[_0xc1c7('0x3a')]=_[_0xc1c7('0x80')](db[_0xc1c7('0x81')][_0xc1c7('0x36')]);_0x5698e9[_0xc1c7('0x3c')]=_[_0xc1c7('0x80')](_0x176603['query']);_0x5698e9[_0xc1c7('0x3d')]=_[_0xc1c7('0x3e')](_0x5698e9[_0xc1c7('0x3a')],_0x5698e9[_0xc1c7('0x3c')]);_0x2ad4f5[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x5698e9['model'],qs[_0xc1c7('0x40')](_0x176603[_0xc1c7('0x3c')]['fields']));_0x2ad4f5['attributes']=_0x2ad4f5[_0xc1c7('0x3f')][_0xc1c7('0x41')]?_0x2ad4f5[_0xc1c7('0x3f')]:_0x5698e9[_0xc1c7('0x3a')];_0x2ad4f5[_0xc1c7('0x82')]=qs[_0xc1c7('0x44')](_0x176603['query'][_0xc1c7('0x44')]);_0x2ad4f5[_0xc1c7('0x45')]=qs[_0xc1c7('0x3d')](_[_0xc1c7('0x46')](_0x176603['query'],_0x5698e9[_0xc1c7('0x3d')]));if(_0x176603['query'][_0xc1c7('0x47')]){_0x2ad4f5['where']=_[_0xc1c7('0x48')](_0x2ad4f5[_0xc1c7('0x45')],{'$or':_['map'](_0x2ad4f5[_0xc1c7('0x3f')],function(_0x30e6ca){var _0x44aee1={};_0x44aee1[_0x30e6ca]={'$like':'%'+_0x176603[_0xc1c7('0x3c')][_0xc1c7('0x47')]+'%'};return _0x44aee1;})});}_0x2ad4f5=_[_0xc1c7('0x48')]({},_0x2ad4f5,_0x176603[_0xc1c7('0x4a')]);return _0x65161e[_0xc1c7('0x7e')](_0x2ad4f5);}})[_0xc1c7('0x2e')](function(_0xe1e5dd){if(_0xe1e5dd){_0x32c26e=_0xe1e5dd[_0xc1c7('0x41')];if(!_0x176603[_0xc1c7('0x3c')][_0xc1c7('0x42')](_0xc1c7('0x43'))){_0x2ad4f5[_0xc1c7('0x25')]=qs[_0xc1c7('0x25')](_0x176603[_0xc1c7('0x3c')][_0xc1c7('0x25')]);_0x2ad4f5[_0xc1c7('0x24')]=qs['offset'](_0x176603['query']['offset']);}return _0x65161e[_0xc1c7('0x7e')](_0x2ad4f5);}})['then'](function(_0x49c29b){if(_0x49c29b){return _0x49c29b?{'count':_0x32c26e,'rows':_0x49c29b}:null;}})['then'](respondWithResult(_0x48309e,null))[_0xc1c7('0x4f')](handleError(_0x48309e,null));};exports[_0xc1c7('0x83')]=function(_0x56cd17,_0x5d60e8,_0x57b04b){var _0x238077={};var _0x454b0d={};var _0x20a948;var _0x18b20f;return db[_0xc1c7('0x4b')][_0xc1c7('0x7f')]({'where':{'id':_0x56cd17['params']['id']}})[_0xc1c7('0x2e')](handleEntityNotFound(_0x5d60e8,null))[_0xc1c7('0x2e')](function(_0x2b9cff){if(_0x2b9cff){_0x20a948=_0x2b9cff;_0x454b0d['model']=_[_0xc1c7('0x80')](db[_0xc1c7('0x84')][_0xc1c7('0x36')]);_0x454b0d['query']=_[_0xc1c7('0x80')](_0x56cd17[_0xc1c7('0x3c')]);_0x454b0d[_0xc1c7('0x3d')]=_[_0xc1c7('0x3e')](_0x454b0d[_0xc1c7('0x3a')],_0x454b0d[_0xc1c7('0x3c')]);_0x238077[_0xc1c7('0x3f')]=_[_0xc1c7('0x3e')](_0x454b0d['model'],qs['fields'](_0x56cd17[_0xc1c7('0x3c')][_0xc1c7('0x40')]));_0x238077[_0xc1c7('0x3f')]=_0x238077['attributes'][_0xc1c7('0x41')]?_0x238077[_0xc1c7('0x3f')]:_0x454b0d[_0xc1c7('0x3a')];_0x238077[_0xc1c7('0x82')]=qs[_0xc1c7('0x44')](_0x56cd17['query'][_0xc1c7('0x44')]);_0x238077[_0xc1c7('0x45')]=qs[_0xc1c7('0x3d')](_[_0xc1c7('0x46')](_0x56cd17[_0xc1c7('0x3c')],_0x454b0d[_0xc1c7('0x3d')]));if(_0x56cd17[_0xc1c7('0x3c')][_0xc1c7('0x47')]){_0x238077[_0xc1c7('0x45')]=_[_0xc1c7('0x48')](_0x238077[_0xc1c7('0x45')],{'$or':_[_0xc1c7('0x35')](_0x238077[_0xc1c7('0x3f')],function(_0x38e932){var _0x265a7a={};_0x265a7a[_0x38e932]={'$like':'%'+_0x56cd17['query'][_0xc1c7('0x47')]+'%'};return _0x265a7a;})});}_0x238077=_[_0xc1c7('0x48')]({},_0x238077,_0x56cd17[_0xc1c7('0x4a')]);return _0x20a948[_0xc1c7('0x83')](_0x238077);}})[_0xc1c7('0x2e')](function(_0x4855ba){if(_0x4855ba){_0x18b20f=_0x4855ba[_0xc1c7('0x41')];if(!_0x56cd17['query'][_0xc1c7('0x42')](_0xc1c7('0x43'))){_0x238077[_0xc1c7('0x25')]=qs[_0xc1c7('0x25')](_0x56cd17['query'][_0xc1c7('0x25')]);_0x238077['offset']=qs[_0xc1c7('0x24')](_0x56cd17[_0xc1c7('0x3c')]['offset']);}return _0x20a948[_0xc1c7('0x83')](_0x238077);}})[_0xc1c7('0x2e')](function(_0x324a87){if(_0x324a87){return _0x324a87?{'count':_0x18b20f,'rows':_0x324a87}:null;}})['then'](respondWithResult(_0x5d60e8,null))[_0xc1c7('0x4f')](handleError(_0x5d60e8,null));};exports[_0xc1c7('0x85')]=function(_0x2b4a14,_0x18e4c4,_0x27edc3){var _0x4bae45=_0x2b4a14[_0xc1c7('0x57')]['ids'];var _0x183c59;return db['Team'][_0xc1c7('0x4d')]({'where':{'id':_0x4bae45},'attributes':['id'],'include':[{'model':db[_0xc1c7('0x81')],'as':_0xc1c7('0x86'),'attributes':['id','name',_0xc1c7('0x87'),_0xc1c7('0x88'),_0xc1c7('0x89')],'raw':!![]}]})[_0xc1c7('0x2e')](function(_0x4ccff5){if(_0x4ccff5){_0x183c59=_0x4ccff5;var _0x287d57=_[_0xc1c7('0x8a')](_0x4ccff5,function(_0x1732a5){var _0x20dccd=_0x1732a5[_0xc1c7('0x30')]({'plain':!![]});return _0x20dccd[_0xc1c7('0x86')];});return db[_0xc1c7('0x4b')][_0xc1c7('0x52')]({'where':{'id':_0x2b4a14[_0xc1c7('0x76')]['id']}})[_0xc1c7('0x2e')](function(_0x45e974){return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0x4d78b8){return _0x45e974[_0xc1c7('0x85')](_0x4bae45,{'transaction':_0x4d78b8})[_0xc1c7('0x2e')](function(){return BPromise['each'](_0x183c59,function(_0x125085){return db[_0xc1c7('0x8b')][_0xc1c7('0x8c')]({'TeamId':_0x125085['id'],'VoicePrefixId':_0x2b4a14[_0xc1c7('0x76')]['id']},{'transaction':_0x4d78b8});});})[_0xc1c7('0x2e')](function(){return BPromise[_0xc1c7('0x8d')](_0x287d57,function(_0x846c80){return db['UserVoicePrefix'][_0xc1c7('0x8e')]({'where':{'UserId':_0x846c80['id'],'VoicePrefixId':_0x2b4a14[_0xc1c7('0x76')]['id']},'transaction':_0x4d78b8});});})[_0xc1c7('0x2e')](function(){_0x287d57[_0xc1c7('0x8f')](function(_0x2a5267){socket['emit'](_0xc1c7('0x7a'),{'UserId':_0x2a5267['id'],'VoicePrefixId':_0x45e974['id']});});});});});}})[_0xc1c7('0x2e')](respondWithStatusCode(_0x18e4c4,null))[_0xc1c7('0x4f')](handleError(_0x18e4c4,null));};exports[_0xc1c7('0x90')]=function(_0x1bed9e,_0x39997a,_0x1273ae){return db['Team'][_0xc1c7('0x4d')]({'where':{'id':_0x1bed9e[_0xc1c7('0x3c')][_0xc1c7('0x78')]},'attributes':['id'],'include':[{'model':db[_0xc1c7('0x81')],'as':_0xc1c7('0x86'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x39997a,null))[_0xc1c7('0x2e')](function(_0x1e7149){var _0x23d84c=_[_0xc1c7('0x35')](_0x1e7149,'id');var _0x22052c=[];var _0x2ca2c1=[];var _0x1f926a=squel[_0xc1c7('0x91')]();_0x1f926a['field'](_0xc1c7('0x92'))[_0xc1c7('0x93')](_0xc1c7('0x94'),'tq')['join'](_0xc1c7('0x95'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc1c7('0x45')](_0xc1c7('0x96'),_0x1bed9e[_0xc1c7('0x76')]['id']);for(var _0x146e74=0x0;_0x146e74<_0x1e7149[_0xc1c7('0x41')];_0x146e74+=0x1){let _0x3f10ac=_0x1e7149[_0x146e74];for(var _0x3a5abd=0x0;_0x3a5abd<_0x3f10ac[_0xc1c7('0x86')][_0xc1c7('0x41')];_0x3a5abd+=0x1){let _0x494ba4=_0x3f10ac[_0xc1c7('0x86')][_0x3a5abd];var _0x4fead5=_0x1f926a[_0xc1c7('0x97')]();_0x4fead5[_0xc1c7('0x45')](_0xc1c7('0x98'),_0x494ba4['id']);_0x2ca2c1[_0xc1c7('0x6a')](db[_0xc1c7('0x54')][_0xc1c7('0x3c')](_0x4fead5[_0xc1c7('0x99')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xc1c7('0x2e')](function(_0x198e78){if(_0x198e78[_0xc1c7('0x41')]===0x1){return _0x494ba4['id'];}else{var _0xde9a91=_[_0xc1c7('0x9a')](_['map'](_0x198e78,_0xc1c7('0x9b')),function(_0x3d6078){return _[_0xc1c7('0x9c')](_0x23d84c,_0x3d6078);});if(_0xde9a91){return _0x494ba4['id'];}}}));}}return BPromise[_0xc1c7('0x9d')](_0x2ca2c1)[_0xc1c7('0x2e')](function(_0x3f0e2c){_0x22052c=_(_0x22052c)[_0xc1c7('0x9e')](_0x3f0e2c)['compact']()[_0xc1c7('0x9f')]();return db[_0xc1c7('0x4b')]['find']({'where':{'id':_0x1bed9e['params']['id']}})[_0xc1c7('0x2e')](function(_0x2801fb){return db[_0xc1c7('0x54')][_0xc1c7('0x55')](function(_0x43c3c3){return _0x2801fb[_0xc1c7('0x90')](_0x1bed9e[_0xc1c7('0x3c')][_0xc1c7('0x78')],{'transaction':_0x43c3c3})[_0xc1c7('0x2e')](function(){if(!_['isEmpty'](_0x22052c)){return _0x2801fb['removeAgents'](_0x22052c,{'transaction':_0x43c3c3});}})[_0xc1c7('0x2e')](function(){_0x22052c['forEach'](function(_0x479d8a){socket[_0xc1c7('0x79')](_0xc1c7('0x7d'),{'UserId':_0x479d8a,'VoicePrefixId':_0x2801fb['id']});});});});});});})[_0xc1c7('0x2e')](respondWithStatusCode(_0x39997a,null))[_0xc1c7('0x4f')](handleError(_0x39997a,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 39dd7ec..d9f1820 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 _0x0f3d=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x4c3473,_0x5b3458){var _0x263098=function(_0x6436aa){while(--_0x6436aa){_0x4c3473['push'](_0x4c3473['shift']());}};_0x263098(++_0x5b3458);}(_0x0f3d,0x11f));var _0xd0f3=function(_0x166e8f,_0x571180){_0x166e8f=_0x166e8f-0x0;var _0x55e8f9=_0x0f3d[_0x166e8f];return _0x55e8f9;};'use strict';var EventEmitter=require(_0xd0f3('0x0'));var VoicePrefix=require(_0xd0f3('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd0f3('0x2')](0x0);var events={'afterCreate':_0xd0f3('0x3'),'afterUpdate':_0xd0f3('0x4'),'afterDestroy':_0xd0f3('0x5')};function emitEvent(_0xb8502d){return function(_0x3d2a64,_0x8f820d,_0x8787f9){VoicePrefixEvents[_0xd0f3('0x6')](_0xb8502d+':'+_0x3d2a64['id'],_0x3d2a64);VoicePrefixEvents[_0xd0f3('0x6')](_0xb8502d,_0x3d2a64);_0x8787f9(null);};}for(var e in events){if(events[_0xd0f3('0x7')](e)){var event=events[e];VoicePrefix[_0xd0f3('0x8')](e,emitEvent(event));}}module[_0xd0f3('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0xe19d=['exports','events','VoicePrefix','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x459240,_0x4c7c29){var _0x2b9388=function(_0x3706a5){while(--_0x3706a5){_0x459240['push'](_0x459240['shift']());}};_0x2b9388(++_0x4c7c29);}(_0xe19d,0x121));var _0xde19=function(_0x299089,_0x3cff81){_0x299089=_0x299089-0x0;var _0x11c91f=_0xe19d[_0x299089];return _0x11c91f;};'use strict';var EventEmitter=require(_0xde19('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xde19('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xde19('0x2')](0x0);var events={'afterCreate':_0xde19('0x3'),'afterUpdate':_0xde19('0x4'),'afterDestroy':'remove'};function emitEvent(_0x45e1c3){return function(_0x2dc41b,_0x256fb2,_0x317327){VoicePrefixEvents[_0xde19('0x5')](_0x45e1c3+':'+_0x2dc41b['id'],_0x2dc41b);VoicePrefixEvents[_0xde19('0x5')](_0x45e1c3,_0x2dc41b);_0x317327(null);};}for(var e in events){if(events[_0xde19('0x6')](e)){var event=events[e];VoicePrefix[_0xde19('0x7')](e,emitEvent(event));}}module[_0xde19('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 bb42bc4..99a08b0 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 _0x78e3=['voice_prefixes','lodash','util','api','moment','bluebird','rimraf','./voicePrefix.attributes','exports','VoicePrefix'];(function(_0x97e28c,_0xa64785){var _0x4c616c=function(_0x40da56){while(--_0x40da56){_0x97e28c['push'](_0x97e28c['shift']());}};_0x4c616c(++_0xa64785);}(_0x78e3,0x97));var _0x378e=function(_0x5d1cbb,_0x250758){_0x5d1cbb=_0x5d1cbb-0x0;var _0x4e5324=_0x78e3[_0x5d1cbb];return _0x4e5324;};'use strict';var _=require(_0x378e('0x0'));var util=require(_0x378e('0x1'));var logger=require('../../config/logger')(_0x378e('0x2'));var moment=require(_0x378e('0x3'));var BPromise=require(_0x378e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x378e('0x5'));var config=require('../../config/environment');var attributes=require(_0x378e('0x6'));module[_0x378e('0x7')]=function(_0x2d14fd,_0x5ad879){return _0x2d14fd['define'](_0x378e('0x8'),attributes,{'tableName':_0x378e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7df9=['VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','define'];(function(_0x1264d8,_0x1a30d2){var _0xdd1abc=function(_0x511b13){while(--_0x511b13){_0x1264d8['push'](_0x1264d8['shift']());}};_0xdd1abc(++_0x1a30d2);}(_0x7df9,0x14c));var _0x97df=function(_0x40b90c,_0x422cee){_0x40b90c=_0x40b90c-0x0;var _0x5d3e08=_0x7df9[_0x40b90c];return _0x5d3e08;};'use strict';var _=require(_0x97df('0x0'));var util=require(_0x97df('0x1'));var logger=require(_0x97df('0x2'))(_0x97df('0x3'));var moment=require(_0x97df('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x97df('0x5'));var rimraf=require(_0x97df('0x6'));var config=require(_0x97df('0x7'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x1906f1,_0x342d71){return _0x1906f1[_0x97df('0x8')](_0x97df('0x9'),attributes,{'tableName':_0x97df('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 55bcbfb..32a0759 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 _0x29b7=['info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x2c4d68,_0x2e0862){var _0x10e25e=function(_0x33d539){while(--_0x33d539){_0x2c4d68['push'](_0x2c4d68['shift']());}};_0x10e25e(++_0x2e0862);}(_0x29b7,0x17d));var _0x729b=function(_0xae3d10,_0x46bb25){_0xae3d10=_0xae3d10-0x0;var _0x2e0727=_0x29b7[_0xae3d10];return _0x2e0727;};'use strict';var _=require('lodash');var util=require(_0x729b('0x0'));var moment=require(_0x729b('0x1'));var BPromise=require(_0x729b('0x2'));var rs=require(_0x729b('0x3'));var fs=require('fs');var Redis=require(_0x729b('0x4'));var db=require(_0x729b('0x5'))['db'];var utils=require(_0x729b('0x6'));var logger=require(_0x729b('0x7'))('rpc');var config=require(_0x729b('0x8'));var jayson=require(_0x729b('0x9'));var client=jayson['client'][_0x729b('0xa')]({'port':0x232a});config[_0x729b('0xb')]=_[_0x729b('0xc')](config[_0x729b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x729b('0xd'))(new Redis(config[_0x729b('0xb')]));require(_0x729b('0xe'))[_0x729b('0xf')](socket);function respondWithRpcPromise(_0x91648d,_0x416342,_0x491541){return new BPromise(function(_0x16da45,_0x4bfdae){return client[_0x729b('0x10')](_0x91648d,_0x491541)[_0x729b('0x11')](function(_0xcc899d){logger['info'](_0x729b('0x12'),_0x416342,_0x729b('0x13'));logger[_0x729b('0x14')](_0x729b('0x15'),_0x416342,_0x729b('0x13'),JSON['stringify'](_0xcc899d));if(_0xcc899d[_0x729b('0x16')]){if(_0xcc899d[_0x729b('0x16')]['code']===0x1f4){logger[_0x729b('0x16')](_0x729b('0x12'),_0x416342,_0xcc899d[_0x729b('0x16')][_0x729b('0x17')]);return _0x4bfdae(_0xcc899d[_0x729b('0x16')]['message']);}logger['error'](_0x729b('0x12'),_0x416342,_0xcc899d[_0x729b('0x16')][_0x729b('0x17')]);return _0x16da45(_0xcc899d[_0x729b('0x16')]['message']);}else{logger[_0x729b('0x18')](_0x729b('0x12'),_0x416342,'request\x20sent');_0x16da45(_0xcc899d[_0x729b('0x19')][_0x729b('0x17')]);}})[_0x729b('0x1a')](function(_0x2b3a82){logger[_0x729b('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x416342,_0x2b3a82);_0x4bfdae(_0x2b3a82);});});} \ No newline at end of file +var _0x00b3=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0xb5dc8c,_0x1fea21){var _0xcbef5a=function(_0x4ed1dd){while(--_0x4ed1dd){_0xb5dc8c['push'](_0xb5dc8c['shift']());}};_0xcbef5a(++_0x1fea21);}(_0x00b3,0x157));var _0x300b=function(_0x156e26,_0x5b4641){_0x156e26=_0x156e26-0x0;var _0x503abb=_0x00b3[_0x156e26];return _0x503abb;};'use strict';var _=require(_0x300b('0x0'));var util=require(_0x300b('0x1'));var moment=require(_0x300b('0x2'));var BPromise=require(_0x300b('0x3'));var rs=require(_0x300b('0x4'));var fs=require('fs');var Redis=require(_0x300b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x300b('0x6'));var logger=require(_0x300b('0x7'))('rpc');var config=require(_0x300b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x300b('0x9')][_0x300b('0xa')]({'port':0x232a});config[_0x300b('0xb')]=_[_0x300b('0xc')](config[_0x300b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x300b('0xd'))(new Redis(config[_0x300b('0xb')]));require(_0x300b('0xe'))[_0x300b('0xf')](socket);function respondWithRpcPromise(_0x1a8749,_0x5d01e0,_0x5c1ded){return new BPromise(function(_0x25f1cc,_0x2272d5){return client['request'](_0x1a8749,_0x5c1ded)[_0x300b('0x10')](function(_0xfc3ee2){logger['info'](_0x300b('0x11'),_0x5d01e0,_0x300b('0x12'));logger[_0x300b('0x13')](_0x300b('0x14'),_0x5d01e0,_0x300b('0x12'),JSON[_0x300b('0x15')](_0xfc3ee2));if(_0xfc3ee2[_0x300b('0x16')]){if(_0xfc3ee2[_0x300b('0x16')][_0x300b('0x17')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x5d01e0,_0xfc3ee2[_0x300b('0x16')][_0x300b('0x18')]);return _0x2272d5(_0xfc3ee2['error']['message']);}logger[_0x300b('0x16')](_0x300b('0x11'),_0x5d01e0,_0xfc3ee2[_0x300b('0x16')][_0x300b('0x18')]);return _0x25f1cc(_0xfc3ee2[_0x300b('0x16')][_0x300b('0x18')]);}else{logger[_0x300b('0x19')](_0x300b('0x11'),_0x5d01e0,'request\x20sent');_0x25f1cc(_0xfc3ee2[_0x300b('0x1a')][_0x300b('0x18')]);}})[_0x300b('0x1b')](function(_0xe804e){logger[_0x300b('0x16')](_0x300b('0x11'),_0x5d01e0,_0xe804e);_0x2272d5(_0xe804e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7f27858..4babb5b 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 _0xa7b5=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','register'];(function(_0x1d2222,_0x1fb1e8){var _0xf9d7da=function(_0x550844){while(--_0x550844){_0x1d2222['push'](_0x1d2222['shift']());}};_0xf9d7da(++_0x1fb1e8);}(_0xa7b5,0x162));var _0x5a7b=function(_0x1a482d,_0x177348){_0x1a482d=_0x1a482d-0x0;var _0x1630ba=_0xa7b5[_0x1a482d];return _0x1630ba;};'use strict';var VoicePrefixEvents=require(_0x5a7b('0x0'));var events=[_0x5a7b('0x1'),_0x5a7b('0x2'),_0x5a7b('0x3')];function createListener(_0x2ca65f,_0x5026f5){return function(_0x1a25e1){_0x5026f5[_0x5a7b('0x4')](_0x2ca65f,_0x1a25e1);};}function removeListener(_0x13085a,_0x56b82d){return function(){VoicePrefixEvents['removeListener'](_0x13085a,_0x56b82d);};}exports[_0x5a7b('0x5')]=function(_0x204212){for(var _0x4899da=0x0,_0x38dac6=events[_0x5a7b('0x6')];_0x4899da<_0x38dac6;_0x4899da++){var _0x390a68=events[_0x4899da];var _0x265597=createListener(_0x5a7b('0x7')+_0x390a68,_0x204212);VoicePrefixEvents['on'](_0x390a68,_0x265597);}}; \ No newline at end of file +var _0x4584=['remove','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x35f83e,_0x30ec55){var _0x249b05=function(_0x2c2fcc){while(--_0x2c2fcc){_0x35f83e['push'](_0x35f83e['shift']());}};_0x249b05(++_0x30ec55);}(_0x4584,0x1cf));var _0x4458=function(_0x4766d1,_0x4c5fe6){_0x4766d1=_0x4766d1-0x0;var _0x42d22b=_0x4584[_0x4766d1];return _0x42d22b;};'use strict';var VoicePrefixEvents=require(_0x4458('0x0'));var events=['save',_0x4458('0x1'),_0x4458('0x2')];function createListener(_0x23b438,_0x5340f5){return function(_0x570b9c){_0x5340f5[_0x4458('0x3')](_0x23b438,_0x570b9c);};}function removeListener(_0xde5996,_0x37118c){return function(){VoicePrefixEvents[_0x4458('0x4')](_0xde5996,_0x37118c);};}exports[_0x4458('0x5')]=function(_0xbf85ca){for(var _0x175c2d=0x0,_0x215b2d=events[_0x4458('0x6')];_0x175c2d<_0x215b2d;_0x175c2d++){var _0x51da14=events[_0x175c2d];var _0x14bb0f=createListener(_0x4458('0x7')+_0x51da14,_0xbf85ca);VoicePrefixEvents['on'](_0x51da14,_0x14bb0f);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 96a1760..595b32d 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(_0x10e0ab,_0x29c3f9){var _0xce472b=function(_0x4d0005){while(--_0x4d0005){_0x10e0ab['push'](_0x10e0ab['shift']());}};_0xce472b(++_0x29c3f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0xf229ea,_0x5d3047){var _0x4b7dac=function(_0x9f3af){while(--_0x9f3af){_0xf229ea['push'](_0xf229ea['shift']());}};_0x4b7dac(++_0x5d3047);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index c9dbf33..af6418c 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 _0x8773=['BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','ENUM','inbound','default','leastrecent','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','type','getDataValue','preview','roundrobin','INTEGER','STRING','yes','all','join','periodic_announce','split','joinempty','leavewhenempty'];(function(_0x5e08ee,_0x45c038){var _0x3b1dcc=function(_0x533646){while(--_0x533646){_0x5e08ee['push'](_0x5e08ee['shift']());}};_0x3b1dcc(++_0x45c038);}(_0x8773,0x1a7));var _0x3877=function(_0x2c7bff,_0x2e79bb){_0x2c7bff=_0x2c7bff-0x0;var _0x107b8b=_0x8773[_0x2c7bff];return _0x107b8b;};'use strict';var Sequelize=require(_0x3877('0x0'));module[_0x3877('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x3877('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x3877('0x4')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x3877('0x2')]('rr','ringall',_0x3877('0x5'),'fewestcalls',_0x3877('0x6'),_0x3877('0x7'),_0x3877('0x8'),_0x3877('0x9'),_0x3877('0xa')),'allowNull':![],'defaultValue':_0x3877('0xb'),'set':function(_0x5418e4){this[_0x3877('0xc')](_0x3877('0xd'),_0x5418e4?_0x5418e4:_0x3877('0x7'));},'get':function(){var _0x488019=this['getDataValue'](_0x3877('0xe'));var _0x26d4c2=this[_0x3877('0xf')]('dialMethod');var _0x286752=this[_0x3877('0xf')](_0x3877('0xd'));if(_0x488019==='outbound'){if(_0x26d4c2===_0x3877('0x10')){return null;}if(_0x26d4c2==='booked'&&!['rrmemory',_0x3877('0x11')]['includes'](_0x286752)){this[_0x3877('0xc')](_0x3877('0xd'),_0x3877('0x7'));}}return _0x286752;}},'servicelevel':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x3877('0x12')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x3877('0x13')]},'weight':{'type':Sequelize[_0x3877('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x14'),'no'),'defaultValue':_0x3877('0x14')},'autopause':{'type':Sequelize[_0x3877('0x2')]('yes','no',_0x3877('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x3877('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x3877('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x3877('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x3877('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x3877('0x2')]('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[_0x3877('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x3877('0x2')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x14'),'no'),'defaultValue':_0x3877('0x14')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x3877('0x14'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x3877('0x13')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x3877('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x3877('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x3877('0x13')]},'queue_youarenext':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3877('0x13')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x3877('0x13')]},'queue_quantity1':{'type':Sequelize[_0x3877('0x13')]},'queue_quantity2':{'type':Sequelize[_0x3877('0x13')]},'queue_periodic_announce':{'type':Sequelize[_0x3877('0x13')]},'queue_less_than':{'type':Sequelize[_0x3877('0x13')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x6c7e59){this['setDataValue']('periodic_announce',_0x6c7e59?_0x6c7e59[_0x3877('0x16')](','):[]);},'get':function(){return this['getDataValue'](_0x3877('0x17'))?this['getDataValue'](_0x3877('0x17'))[_0x3877('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0x3877('0x13')],'defaultValue':_0x3877('0x14'),'set':function(_0x181fba){this[_0x3877('0xc')](_0x3877('0x19'),_0x181fba?_0x181fba[_0x3877('0x16')](','):undefined);},'get':function(){return this['getDataValue'](_0x3877('0x19'))?this[_0x3877('0xf')](_0x3877('0x19'))[_0x3877('0x18')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x3877('0x13')],'defaultValue':'no','set':function(_0x56ac33){this[_0x3877('0xc')](_0x3877('0x1a'),_0x56ac33?_0x56ac33[_0x3877('0x16')](','):undefined);},'get':function(){return this[_0x3877('0xf')](_0x3877('0x1a'))?this[_0x3877('0xf')]('leavewhenempty')[_0x3877('0x18')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x3877('0x13')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x3877('0x1b')],'defaultValue':0x0,'set':function(_0x3a5e8c){this[_0x3877('0xc')](_0x3877('0x1c'),_0x3a5e8c);if(_0x3a5e8c){if(this[_0x3877('0xf')](_0x3877('0x1d'))<0x2){this[_0x3877('0xc')](_0x3877('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x3877('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x3877('0x1b')],'defaultValue':0x0,'comment':_0x3877('0x1e')},'dialMethod':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x10'),_0x3877('0x1f'),_0x3877('0x20'),_0x3877('0x21'),_0x3877('0x22')),'defaultValue':'progressive','comment':_0x3877('0x23')},'dialLimitChannel':{'type':Sequelize[_0x3877('0x12')](0x4)[_0x3877('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3877('0x25')},'dialLimitQueue':{'type':Sequelize[_0x3877('0x12')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x3877('0x26')](0x2)[_0x3877('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x3877('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x28'),'dropRate'),'defaultValue':_0x3877('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x3877('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x3877('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3877('0x13')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3877('0x13')]},'dialOriginateTimeout':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3877('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x3877('0x13')],'defaultValue':'tTxX','comment':_0x3877('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3877('0x2e')},'dialQueueProject':{'type':Sequelize[_0x3877('0x13')],'comment':_0x3877('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3877('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3877('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3877('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3877('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3877('0x24')],'defaultValue':0x3,'comment':_0x3877('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3877('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3877('0x35')},'dialTimezone':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3877('0x13')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x3877('0x13')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x3877('0x36'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x3877('0x1b')],'defaultValue':0x0,'comment':_0x3877('0x37')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3877('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x3877('0x12')](0x9)[_0x3877('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3877('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3877('0x12')](0x9)[_0x3877('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3877('0x12')](0x9)[_0x3877('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3877('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x3877('0x12')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3877('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3877('0x12')](0x9)[_0x3877('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3877('0x12')](0x9)[_0x3877('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3877('0x3b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3877('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3877('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3877('0x3c')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x3877('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3877('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3877('0x2')](_0x3877('0x3e'),_0x3877('0x3f')),'defaultValue':_0x3877('0x3e')},'dialQueueProject2':{'type':Sequelize[_0x3877('0x13')],'comment':_0x3877('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x3877('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x3877('0x1b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3877('0x40')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x3877('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3877('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x41')},'dialDropMaxRetry':{'type':Sequelize[_0x3877('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3877('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0x3877('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3877('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3877('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3877('0x12')](0x5)[_0x3877('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0x3877('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3877('0x46')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3877('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3877('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3877('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3877('0x12')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3877('0x49'),'set':function(_0x4765da){if(!_0x4765da)this['setDataValue'](_0x3877('0x4a'),null);this[_0x3877('0xc')]('mandatoryDisposition',_0x4765da);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x3877('0x1b')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x3877('0x12')](0x3)[_0x3877('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe067=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\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)'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe067,0xf4));var _0x7e06=function(_0x400bd2,_0x50b43c){_0x400bd2=_0x400bd2-0x0;var _0x223cec=_0xe067[_0x400bd2];return _0x223cec;};'use strict';var Sequelize=require(_0x7e06('0x0'));module[_0x7e06('0x1')]={'name':{'type':Sequelize[_0x7e06('0x2')],'allowNull':![],'unique':_0x7e06('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x5'),_0x7e06('0x6')),'allowNull':![],'defaultValue':_0x7e06('0x5')},'musiconhold':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':_0x7e06('0x7')},'announce':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x7e06('0x4')]('rr','ringall',_0x7e06('0x8'),_0x7e06('0x9'),_0x7e06('0xa'),_0x7e06('0xb'),'linear',_0x7e06('0xc'),_0x7e06('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x3ca9d2){this[_0x7e06('0xe')](_0x7e06('0xf'),_0x3ca9d2?_0x3ca9d2:'rrmemory');},'get':function(){var _0x2dc0bb=this[_0x7e06('0x10')](_0x7e06('0x11'));var _0x518c57=this['getDataValue'](_0x7e06('0x12'));var _0x114187=this[_0x7e06('0x10')](_0x7e06('0xf'));if(_0x2dc0bb===_0x7e06('0x6')){if(_0x518c57===_0x7e06('0x13')){return null;}if(_0x518c57===_0x7e06('0x14')&&![_0x7e06('0xb'),_0x7e06('0x15')][_0x7e06('0x16')](_0x114187)){this[_0x7e06('0xe')]('strategy',_0x7e06('0xb'));}}return _0x114187;}},'servicelevel':{'type':Sequelize[_0x7e06('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x7e06('0x17')](0xb)},'timeout':{'type':Sequelize[_0x7e06('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x7e06('0x2')]},'weight':{'type':Sequelize[_0x7e06('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x7e06('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no'),'defaultValue':_0x7e06('0x18')},'autopause':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x7e06('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x7e06('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7e06('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x7e06('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x7e06('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x7e06('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x7e06('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x7e06('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no'),'defaultValue':_0x7e06('0x18')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x7e06('0x18'),'no',_0x7e06('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x7e06('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x7e06('0x2')]},'queue_youarenext':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x7e06('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x7e06('0x2')]},'queue_quantity1':{'type':Sequelize[_0x7e06('0x2')]},'queue_quantity2':{'type':Sequelize[_0x7e06('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x7e06('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x7e06('0x1a')],'set':function(_0x4e3fb1){this[_0x7e06('0xe')]('periodic_announce',_0x4e3fb1?_0x4e3fb1[_0x7e06('0x1b')](','):[]);},'get':function(){return this[_0x7e06('0x10')](_0x7e06('0x1c'))?this[_0x7e06('0x10')]('periodic_announce')[_0x7e06('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':'yes','set':function(_0x25846a){this[_0x7e06('0xe')]('joinempty',_0x25846a?_0x25846a[_0x7e06('0x1b')](','):undefined);},'get':function(){return this[_0x7e06('0x10')]('joinempty')?this[_0x7e06('0x10')](_0x7e06('0x1e'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x385313){this[_0x7e06('0xe')](_0x7e06('0x1f'),_0x385313?_0x385313['join'](','):undefined);},'get':function(){return this[_0x7e06('0x10')](_0x7e06('0x1f'))?this[_0x7e06('0x10')](_0x7e06('0x1f'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7e06('0x2')]},'description':{'type':Sequelize[_0x7e06('0x2')]},'acw':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':0x0,'set':function(_0x50f7dd){this[_0x7e06('0xe')]('acw',_0x50f7dd);if(_0x50f7dd){if(this[_0x7e06('0x10')](_0x7e06('0x21'))<0x2){this[_0x7e06('0xe')](_0x7e06('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x7e06('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':0x0,'comment':_0x7e06('0x22')},'dialMethod':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x13'),'progressive','power',_0x7e06('0x23'),_0x7e06('0x14')),'defaultValue':_0x7e06('0x24'),'comment':_0x7e06('0x25')},'dialLimitChannel':{'type':Sequelize[_0x7e06('0x17')](0x4)[_0x7e06('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7e06('0x27')},'dialLimitQueue':{'type':Sequelize[_0x7e06('0x17')](0x4)[_0x7e06('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x7e06('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7e06('0x29')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x7e06('0x2a'),_0x7e06('0x2b')),'defaultValue':_0x7e06('0x2b'),'comment':_0x7e06('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7e06('0x28')](0x2)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x7e06('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x7e06('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x7e06('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7e06('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e06('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':_0x7e06('0x2f'),'comment':_0x7e06('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e06('0x31')},'dialQueueProject':{'type':Sequelize[_0x7e06('0x2')],'comment':_0x7e06('0x32')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e06('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7e06('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e06('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x7e06('0x17')](0x5)[_0x7e06('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e06('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7e06('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7e06('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':_0x7e06('0x36')},'dialPrefix':{'type':Sequelize[_0x7e06('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x7e06('0x37'),_0x7e06('0x38'),'onlyIfOpen'),'defaultValue':_0x7e06('0x37')},'dialAMDActive':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':0x0,'comment':_0x7e06('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x7e06('0x17')](0x9)[_0x7e06('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7e06('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x7e06('0x17')](0x9)[_0x7e06('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7e06('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7e06('0x17')](0x9)[_0x7e06('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7e06('0x3b')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x7e06('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7e06('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7e06('0x17')](0x9)[_0x7e06('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7e06('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7e06('0x17')](0x9)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7e06('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7e06('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7e06('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7e06('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7e06('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x7e06('0x17')](0x5)[_0x7e06('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7e06('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':0x0,'comment':_0x7e06('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7e06('0x4')](_0x7e06('0x43'),_0x7e06('0x44')),'defaultValue':_0x7e06('0x43')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x7e06('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7e06('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7e06('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e06('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7e06('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e06('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x7e06('0x17')](0x5)[_0x7e06('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e06('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7e06('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7e06('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e06('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7e06('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e06('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7e06('0x17')](0x5)[_0x7e06('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e06('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7e06('0x17')],'allowNull':!![],'comment':_0x7e06('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':![],'comment':_0x7e06('0x4d'),'set':function(_0x49179e){if(!_0x49179e)this[_0x7e06('0xe')](_0x7e06('0x4e'),null);this['setDataValue'](_0x7e06('0x4f'),_0x49179e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x7e06('0x17')](0x3)[_0x7e06('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x7e06('0x20')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 4a1f0a2..54b6065 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 _0x4b84=['type','find','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','getHopperHistories','pick','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','forEach','penalty','transaction','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','upsert','format','SIP/%s','emit','ids','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','TeamId','all','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:save','online','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','into','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','NOW()','removeBlackLists','moment','bluebird','squel','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','undefined','count','offset','limit','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x47df54,_0x1aeb61){_0x47df54=_0x47df54-0x0;var _0x261b87=_0x4b84[_0x47df54];return _0x261b87;};'use strict';var moment=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0x44b8('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x44b8('0x3'))(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x44b8('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x44b8('0x7'))(new Redis(config['redis']));require(_0x44b8('0x8'))['register'](socket);function respondWithStatusCode(_0x5034b6,_0x41d515){_0x41d515=_0x41d515||0xcc;return function(_0x42319d){if(_0x42319d){return _0x5034b6[_0x44b8('0x9')](_0x41d515);}return _0x5034b6['status'](_0x41d515)[_0x44b8('0xa')]();};}function respondWithResult(_0x2cc74b,_0x4315f6){_0x4315f6=_0x4315f6||0xc8;return function(_0x9b6048){if(_0x9b6048){return _0x2cc74b[_0x44b8('0xb')](_0x4315f6)[_0x44b8('0xc')](_0x9b6048);}};}function respondWithFilteredResult(_0xe9a025,_0x4ae8a1){return function(_0x147529){if(_0x147529){var _0x4301a6=typeof _0x4ae8a1['offset']===_0x44b8('0xd')&&typeof _0x4ae8a1['limit']===_0x44b8('0xd');var _0x18d642=_0x147529['count'];var _0x63e8f6=_0x4301a6?0x0:_0x4ae8a1['offset'];var _0x54fa95=_0x4301a6?_0x147529[_0x44b8('0xe')]:_0x4ae8a1[_0x44b8('0xf')]+_0x4ae8a1[_0x44b8('0x10')];var _0x41ab46;if(_0x54fa95>=_0x18d642){_0x54fa95=_0x18d642;_0x41ab46=0xc8;}else{_0x41ab46=0xce;}_0xe9a025['status'](_0x41ab46);return _0xe9a025['set']('Content-Range',_0x63e8f6+'-'+_0x54fa95+'/'+_0x18d642)[_0x44b8('0xc')](_0x147529);}return null;};}function saveUpdates(_0x5b7803){return function(_0x28ef36){if(_0x28ef36){return _0x28ef36[_0x44b8('0x11')](_0x5b7803)['then'](function(_0x36743e){return _0x36743e;});}return null;};}function removeEntity(_0xe3de8f){return function(_0x5103f5){if(_0x5103f5){return _0x5103f5[_0x44b8('0x12')]()[_0x44b8('0x13')](function(){var _0x4b600f=_0x5103f5[_0x44b8('0x14')]({'plain':!![]});var _0x8b4301=[{'name':_0x44b8('0x15'),'value':_0x44b8('0x16'),'ignore':![]},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18'),'ignore':![]}];var _0x452f2f=_(_0x8b4301)[_0x44b8('0x19')](_0x44b8('0x1a'))[_0x44b8('0x1b')](_0x44b8('0x1c'))[_0x44b8('0x1c')]();if(_['includes'](_0x452f2f,_0x4b600f[_0x44b8('0x1d')])){return;}var _0x3a8aa4=_[_0x44b8('0x1e')](_0x8b4301,[_0x44b8('0x1c'),_0x4b600f[_0x44b8('0x1d')]])['name'];return db[_0x44b8('0x1f')]['destroy']({'where':{'type':_0x3a8aa4,'resourceId':_0x4b600f['id']}})[_0x44b8('0x13')](function(){return _0x5103f5;});})[_0x44b8('0x13')](function(){_0xe3de8f[_0x44b8('0xb')](0xcc)[_0x44b8('0xa')]();});}};}function handleEntityNotFound(_0x230a3d){return function(_0x59acbc){if(!_0x59acbc){_0x230a3d[_0x44b8('0x9')](0x194);}return _0x59acbc;};}function handleError(_0x502acf,_0x41d673){_0x41d673=_0x41d673||0x1f4;return function(_0x350482){logger['error'](_0x350482[_0x44b8('0x20')]);if(_0x350482[_0x44b8('0x21')]){delete _0x350482[_0x44b8('0x21')];}_0x502acf['status'](_0x41d673)[_0x44b8('0x22')](_0x350482);};}exports[_0x44b8('0x23')]=function(_0x53d9c7,_0x2e0174){var _0x4a182d={};var _0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['VoiceQueue'][_0x44b8('0x24')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x25')],'type':_0x29b18d[_0x44b8('0x1d')][_0x44b8('0x26')]};});_0x4a182d=qs[_0x44b8('0x27')](_0x5a544c,_0x53d9c7);var _0x2cf205={'where':_0x4a182d[_0x44b8('0x28')]};return db[_0x44b8('0x29')][_0x44b8('0xe')](_0x2cf205)[_0x44b8('0x13')](function(_0x417d81){_0xfb0028[_0x44b8('0xe')]=_0x417d81;_0x4a182d['include']=qs[_0x44b8('0x2a')](_0x53d9c7['query']);return db[_0x44b8('0x29')][_0x44b8('0x2b')](_0x4a182d);})[_0x44b8('0x13')](function(_0xb64609){_0xfb0028[_0x44b8('0x2c')]=_0xb64609;return _0xfb0028;})['then'](respondWithFilteredResult(_0x2e0174,_0x4a182d))[_0x44b8('0x2d')](handleError(_0x2e0174,null));};exports[_0x44b8('0x2e')]=function(_0x26265f,_0x339f0f){var _0x46b008={'raw':![],'where':{'id':_0x26265f[_0x44b8('0x2f')]['id']}},_0x5f541d={};_0x5f541d[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0x5f541d[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x26265f[_0x44b8('0x32')]);_0x5f541d[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],_0x5f541d[_0x44b8('0x32')]);_0x46b008[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x26265f[_0x44b8('0x32')][_0x44b8('0x36')]));_0x46b008[_0x44b8('0x35')]=_0x46b008[_0x44b8('0x35')][_0x44b8('0x37')]?_0x46b008[_0x44b8('0x35')]:_0x5f541d['model'];if(_0x26265f[_0x44b8('0x32')][_0x44b8('0x38')]){_0x46b008['include']=[{'all':!![]}];}_0x46b008=_[_0x44b8('0x39')]({},_0x46b008,_0x26265f[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0x46b008)['then'](handleEntityNotFound(_0x339f0f,null))[_0x44b8('0x13')](respondWithResult(_0x339f0f,null))[_0x44b8('0x2d')](handleError(_0x339f0f,null));};exports[_0x44b8('0x3b')]=function(_0x1ee3cc,_0x9cb2a){return db[_0x44b8('0x29')][_0x44b8('0x3b')](_0x1ee3cc[_0x44b8('0x3c')],{})[_0x44b8('0x13')](function(_0x3d1be1){var _0x1c9983=_0x1ee3cc[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x1c9983)throw new Error(_0x44b8('0x3e'));if(_0x1c9983[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x57d8c4=_0x3d1be1[_0x44b8('0x14')]({'plain':!![]});var _0x43e43a=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x229cc9=_['find'](_0x43e43a,[_0x44b8('0x1c'),_0x57d8c4[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db[_0x44b8('0x40')][_0x44b8('0x1e')]({'where':{'name':_0x229cc9,'userProfileId':_0x1c9983['userProfileId']},'raw':!![]})['then'](function(_0x215f7b){if(_0x215f7b&&_0x215f7b[_0x44b8('0x41')]===0x0){return db[_0x44b8('0x1f')][_0x44b8('0x3b')]({'name':_0x57d8c4[_0x44b8('0x21')],'resourceId':_0x57d8c4['id'],'type':_0x215f7b[_0x44b8('0x21')],'sectionId':_0x215f7b['id']},{})[_0x44b8('0x13')](function(){return _0x3d1be1;});}else{return _0x3d1be1;}})[_0x44b8('0x2d')](function(_0x455fd6){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x455fd6);throw _0x455fd6;});}return _0x3d1be1;})[_0x44b8('0x13')](respondWithResult(_0x9cb2a,0xc9))[_0x44b8('0x2d')](handleError(_0x9cb2a,null));};exports[_0x44b8('0x44')]=function(_0x149731,_0x60eeb2){var _0xce06dc={'where':{'id':_0x149731[_0x44b8('0x2f')]['id']}},_0x3b3d5d={};_0x3b3d5d['model']=_['keys'](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0xce06dc[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x3b3d5d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x149731[_0x44b8('0x32')]['fields']));_0xce06dc[_0x44b8('0x35')]=_0xce06dc['attributes'][_0x44b8('0x37')]?_0xce06dc[_0x44b8('0x35')]:_0x3b3d5d[_0x44b8('0x30')];if(_0x149731[_0x44b8('0x32')][_0x44b8('0x38')]){_0xce06dc[_0x44b8('0x2a')]=[{'all':!![]}];}_0xce06dc=_['merge']({},_0xce06dc,_0x149731[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0xce06dc)[_0x44b8('0x13')](handleEntityNotFound(_0x60eeb2,null))['then'](function(_0x4e4ed1){if(_0x4e4ed1){var _0x2f549d=_0x4e4ed1[_0x44b8('0x14')]({'plain':!![]});_0x2f549d=qs[_0x44b8('0x45')](_0x2f549d,['id',_0x44b8('0x46'),_0x44b8('0x47')]);_0x149731['body']=_[_0x44b8('0x45')](_0x149731[_0x44b8('0x3c')],['id',_0x44b8('0x46'),_0x44b8('0x47')]);return db[_0x44b8('0x29')]['create'](_['merge'](_0x2f549d,_0x149731[_0x44b8('0x3c')]),{'include':_0x149731['query'][_0x44b8('0x38')]?[{'all':!![]}]:undefined})['then'](function(_0x40164d){var _0x434d6a=_0x149731[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x434d6a)throw new Error(_0x44b8('0x3e'));if(_0x434d6a[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x533967=_0x40164d[_0x44b8('0x14')]({'plain':!![]});var _0x37b2c2=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x45f9a0=_[_0x44b8('0x1e')](_0x37b2c2,['value',_0x533967[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db['UserProfileSection'][_0x44b8('0x1e')]({'where':{'name':_0x45f9a0,'userProfileId':_0x434d6a[_0x44b8('0x48')]},'raw':!![]})[_0x44b8('0x13')](function(_0x3df6aa){if(_0x3df6aa&&_0x3df6aa[_0x44b8('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x533967[_0x44b8('0x21')],'resourceId':_0x533967['id'],'type':_0x3df6aa[_0x44b8('0x21')],'sectionId':_0x3df6aa['id']},{})[_0x44b8('0x13')](function(){return _0x40164d;});}else{return _0x40164d;}})[_0x44b8('0x2d')](function(_0x765e45){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x765e45);throw _0x765e45;});}return _0x40164d;});}})[_0x44b8('0x13')](respondWithResult(_0x60eeb2,0xc9))[_0x44b8('0x2d')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x11')]=function(_0x16c628,_0x3f7576){if(_0x16c628['body']['id']){delete _0x16c628[_0x44b8('0x3c')]['id'];}return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x16c628[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3f7576,null))[_0x44b8('0x13')](saveUpdates(_0x16c628[_0x44b8('0x3c')],null))[_0x44b8('0x13')](respondWithResult(_0x3f7576,null))[_0x44b8('0x2d')](handleError(_0x3f7576,null));};exports[_0x44b8('0x12')]=function(_0x2ecff9,_0x15bcba){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2ecff9[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x15bcba,null))[_0x44b8('0x13')](removeEntity(_0x15bcba,null))[_0x44b8('0x2d')](handleError(_0x15bcba,null));};exports['getHoppers']=function(_0x1ec516,_0x3aac51){var _0x10e519={'raw':![],'where':{}};var _0x2b37e={};var _0x51f763={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x1ec516['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3aac51,null))[_0x44b8('0x13')](function(_0x5df821){if(_0x5df821){_0x2b37e[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopper'][_0x44b8('0x24')]);_0x2b37e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1ec516['query']);_0x2b37e[_0x44b8('0x33')]=_['intersection'](_0x2b37e[_0x44b8('0x30')],_0x2b37e['query']);_0x10e519[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2b37e[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x36')]));_0x10e519['attributes']=_0x10e519[_0x44b8('0x35')]['length']?_0x10e519[_0x44b8('0x35')]:_0x2b37e[_0x44b8('0x30')];if(!_0x1ec516['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x10e519[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x10')]);_0x10e519[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x10e519[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x1ec516['query'][_0x44b8('0x4d')]);_0x10e519[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_['pick'](_0x1ec516[_0x44b8('0x32')],_0x2b37e[_0x44b8('0x33')]));_0x10e519['where'][_0x44b8('0x4e')]=_0x5df821['id'];if(_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]){_0x10e519[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x10e519['where'],{'$or':_[_0x44b8('0x1b')](_0x10e519[_0x44b8('0x35')],function(_0x279753){var _0x270224={};_0x270224[_0x279753]={'$like':'%'+_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x270224;})});}_0x10e519=_[_0x44b8('0x39')]({},_0x10e519,_0x1ec516[_0x44b8('0x3a')]);return db['CmHopper'][_0x44b8('0xe')]({'where':_0x10e519[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x3ce76e){_0x51f763['count']=_0x3ce76e;if(_0x1ec516['query']['includeAll']){_0x10e519[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x4f')][_0x44b8('0x2b')](_0x10e519);})[_0x44b8('0x13')](function(_0x32e630){_0x51f763['rows']=_0x32e630;return _0x51f763;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x3aac51,_0x10e519))['catch'](handleError(_0x3aac51,null));};exports[_0x44b8('0x50')]=function(_0x155bcf,_0xea2c3e){var _0x5da034={'raw':!![],'where':{}};var _0x4cac12={};var _0xb4c6dc={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x155bcf['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xea2c3e,null))[_0x44b8('0x13')](function(_0x1258c2){if(_0x1258c2){_0x4cac12[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopperHistory'][_0x44b8('0x24')]);_0x4cac12[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x155bcf[_0x44b8('0x32')]);_0x4cac12[_0x44b8('0x33')]=_['intersection'](_0x4cac12[_0x44b8('0x30')],_0x4cac12[_0x44b8('0x32')]);_0x5da034[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x4cac12[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x155bcf[_0x44b8('0x32')]['fields']));_0x5da034[_0x44b8('0x35')]=_0x5da034[_0x44b8('0x35')]['length']?_0x5da034[_0x44b8('0x35')]:_0x4cac12[_0x44b8('0x30')];if(!_0x155bcf['query'][_0x44b8('0x4a')]('nolimit')){_0x5da034['limit']=qs[_0x44b8('0x10')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x10')]);_0x5da034['offset']=qs['offset'](_0x155bcf['query'][_0x44b8('0xf')]);}_0x5da034[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x5da034[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x155bcf['query'],_0x4cac12[_0x44b8('0x33')]));_0x5da034['where']['VoiceQueueId']=_0x1258c2['id'];if(_0x155bcf['query'][_0x44b8('0x19')]){_0x5da034['where']=_[_0x44b8('0x39')](_0x5da034[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x5da034[_0x44b8('0x35')],function(_0x3a9780){var _0x245ba3={};_0x245ba3[_0x3a9780]={'$like':'%'+_0x155bcf[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x245ba3;})});}_0x5da034=_['merge']({},_0x5da034,_0x155bcf[_0x44b8('0x3a')]);return db[_0x44b8('0x52')][_0x44b8('0xe')]({'where':_0x5da034[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0xee44b3){_0xb4c6dc[_0x44b8('0xe')]=_0xee44b3;if(_0x155bcf[_0x44b8('0x32')][_0x44b8('0x38')]){_0x5da034['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x44b8('0x2b')](_0x5da034);})['then'](function(_0x531d65){_0xb4c6dc[_0x44b8('0x2c')]=_0x531d65;return _0xb4c6dc;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0xea2c3e,_0x5da034))['catch'](handleError(_0xea2c3e,null));};exports['getHopperFinals']=function(_0x4b22e7,_0x2e0289){var _0x4860af={'raw':!![],'where':{}};var _0x353ff1={};var _0x2812da={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x4b22e7[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2e0289,null))[_0x44b8('0x13')](function(_0x3a7229){if(_0x3a7229){_0x353ff1[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x53')][_0x44b8('0x24')]);_0x353ff1[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x4b22e7['query']);_0x353ff1[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],_0x353ff1[_0x44b8('0x32')]);_0x4860af[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x36')]));_0x4860af[_0x44b8('0x35')]=_0x4860af[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4860af['attributes']:_0x353ff1[_0x44b8('0x30')];if(!_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4860af['limit']=qs[_0x44b8('0x10')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4860af['offset']=qs[_0x44b8('0xf')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x4860af[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4860af[_0x44b8('0x28')]=qs['filters'](_[_0x44b8('0x51')](_0x4b22e7[_0x44b8('0x32')],_0x353ff1[_0x44b8('0x33')]));_0x4860af[_0x44b8('0x28')][_0x44b8('0x4e')]=_0x3a7229['id'];if(_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4860af['where']=_['merge'](_0x4860af['where'],{'$or':_[_0x44b8('0x1b')](_0x4860af[_0x44b8('0x35')],function(_0x2d74ee){var _0x312f4c={};_0x312f4c[_0x2d74ee]={'$like':'%'+_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x312f4c;})});}_0x4860af=_[_0x44b8('0x39')]({},_0x4860af,_0x4b22e7[_0x44b8('0x3a')]);return db[_0x44b8('0x53')]['count']({'where':_0x4860af[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x4b8036){_0x2812da['count']=_0x4b8036;if(_0x4b22e7[_0x44b8('0x32')]['includeAll']){_0x4860af[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x53')][_0x44b8('0x2b')](_0x4860af);})['then'](function(_0x3f4a2a){_0x2812da[_0x44b8('0x2c')]=_0x3f4a2a;return _0x2812da;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x2e0289,_0x4860af))[_0x44b8('0x2d')](handleError(_0x2e0289,null));};exports['getHopperBlacks']=function(_0x216030,_0x584ae3){var _0x38c0c5={'raw':!![],'where':{}};var _0x2f2923={};var _0x2d9d62={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x216030[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x584ae3,null))['then'](function(_0x4d3b82){if(_0x4d3b82){_0x2f2923['model']=_[_0x44b8('0x31')](db[_0x44b8('0x54')][_0x44b8('0x24')]);_0x2f2923[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x216030[_0x44b8('0x32')]);_0x2f2923[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],_0x2f2923[_0x44b8('0x32')]);_0x38c0c5[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x216030[_0x44b8('0x32')][_0x44b8('0x36')]));_0x38c0c5[_0x44b8('0x35')]=_0x38c0c5[_0x44b8('0x35')]['length']?_0x38c0c5[_0x44b8('0x35')]:_0x2f2923['model'];if(!_0x216030[_0x44b8('0x32')]['hasOwnProperty']('nolimit')){_0x38c0c5[_0x44b8('0x10')]=qs['limit'](_0x216030['query']['limit']);_0x38c0c5['offset']=qs['offset'](_0x216030[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x38c0c5[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x216030['query'][_0x44b8('0x4d')]);_0x38c0c5[_0x44b8('0x28')]=qs['filters'](_['pick'](_0x216030[_0x44b8('0x32')],_0x2f2923[_0x44b8('0x33')]));_0x38c0c5[_0x44b8('0x28')]['VoiceQueueId']=_0x4d3b82['id'];if(_0x216030[_0x44b8('0x32')][_0x44b8('0x19')]){_0x38c0c5[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x38c0c5[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x38c0c5[_0x44b8('0x35')],function(_0x16344b){var _0x21057f={};_0x21057f[_0x16344b]={'$like':'%'+_0x216030['query'][_0x44b8('0x19')]+'%'};return _0x21057f;})});}_0x38c0c5=_[_0x44b8('0x39')]({},_0x38c0c5,_0x216030['options']);return db[_0x44b8('0x54')][_0x44b8('0xe')]({'where':_0x38c0c5[_0x44b8('0x28')]})['then'](function(_0x3a09e4){_0x2d9d62['count']=_0x3a09e4;if(_0x216030[_0x44b8('0x32')][_0x44b8('0x38')]){_0x38c0c5['include']=[{'all':!![]}];}return db[_0x44b8('0x54')][_0x44b8('0x2b')](_0x38c0c5);})[_0x44b8('0x13')](function(_0x37871e){_0x2d9d62['rows']=_0x37871e;return _0x2d9d62;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x584ae3,_0x38c0c5))[_0x44b8('0x2d')](handleError(_0x584ae3,null));};exports[_0x44b8('0x55')]=function(_0x35d46c,_0x2d4a8a){var _0x1d666e={};var _0x10a66a={};var _0x1e608f;var _0x470f90;return db['VoiceQueue']['findOne']({'where':{'id':_0x35d46c[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2d4a8a,null))[_0x44b8('0x13')](function(_0x3539f9){if(_0x3539f9){_0x1e608f=_0x3539f9;_0x10a66a[_0x44b8('0x30')]=_['keys'](db[_0x44b8('0x56')]['rawAttributes']);_0x10a66a[_0x44b8('0x32')]=_['keys'](_0x35d46c[_0x44b8('0x32')]);_0x10a66a[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],_0x10a66a[_0x44b8('0x32')]);_0x1d666e[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x35d46c['query'][_0x44b8('0x36')]));_0x1d666e[_0x44b8('0x35')]=_0x1d666e[_0x44b8('0x35')][_0x44b8('0x37')]?_0x1d666e['attributes']:_0x10a66a['model'];_0x1d666e['order']=qs[_0x44b8('0x4d')](_0x35d46c['query']['sort']);_0x1d666e[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x35d46c[_0x44b8('0x32')],_0x10a66a[_0x44b8('0x33')]));if(_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]){_0x1d666e[_0x44b8('0x28')]=_['merge'](_0x1d666e[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x1d666e[_0x44b8('0x35')],function(_0x2594bf){var _0x5f0c0c={};_0x5f0c0c[_0x2594bf]={'$like':'%'+_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x5f0c0c;})});}_0x1d666e=_[_0x44b8('0x39')]({},_0x1d666e,_0x35d46c['options']);return _0x1e608f['getTeams'](_0x1d666e);}})[_0x44b8('0x13')](function(_0xae9b10){if(_0xae9b10){_0x470f90=_0xae9b10[_0x44b8('0x37')];if(!_0x35d46c[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x1d666e[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x35d46c['query'][_0x44b8('0x10')]);_0x1d666e[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x35d46c[_0x44b8('0x32')]['offset']);}return _0x1e608f[_0x44b8('0x55')](_0x1d666e);}})['then'](function(_0x4464d3){if(_0x4464d3){return _0x4464d3?{'count':_0x470f90,'rows':_0x4464d3}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2d4a8a,null))[_0x44b8('0x2d')](handleError(_0x2d4a8a,null));};exports[_0x44b8('0x57')]=function(_0x45ff62,_0x343c5c){var _0x3cb290=_0x45ff62[_0x44b8('0x3c')]['teams'];var _0x2d27bf=_[_0x44b8('0x1b')](_0x3cb290,'id');return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x2d27bf},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id','name','online',_0x44b8('0x5a'),_0x44b8('0x5b')],'raw':!![]}]})['then'](function(_0x41f732){if(_0x41f732){var _0x16074e=_['flatMap'](_0x41f732,function(_0x1ec23e){var _0x3208b4=_0x1ec23e[_0x44b8('0x14')]({'plain':!![]});_0x3208b4[_0x44b8('0x59')][_0x44b8('0x5c')](function(_0x43f416){_0x43f416[_0x44b8('0x5d')]=_[_0x44b8('0x1e')](_0x3cb290,{'id':_0x3208b4['id']})[_0x44b8('0x5d')];});return _0x3208b4[_0x44b8('0x59')];});return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x45ff62[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x15365d){return db['sequelize'][_0x44b8('0x5e')](function(_0x3d92a9){return _0x15365d[_0x44b8('0x57')](_0x2d27bf,{'transaction':_0x3d92a9})[_0x44b8('0x13')](function(){return BPromise['each'](_0x3cb290,function(_0x611876){return db[_0x44b8('0x5f')]['upsert']({'TeamId':_0x611876['id'],'VoiceQueueId':_0x45ff62[_0x44b8('0x2f')]['id'],'penalty':_0x611876['penalty']},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise[_0x44b8('0x60')](_0x16074e,function(_0x5a508f){return db[_0x44b8('0x61')]['findOrCreate']({'where':{'UserId':_0x5a508f['id'],'VoiceQueueId':_0x45ff62['params']['id']},'defaults':{'penalty':_0x5a508f[_0x44b8('0x5d')]},'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise['each'](_['filter'](_0x16074e,{'online':!![]}),function(_0x52af57){return db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x52af57[_0x44b8('0x21')],'UserId':_0x52af57['id'],'queue_name':_0x15365d['name'],'VoiceQueueId':_0x15365d['id'],'interface':_['isNil'](_0x52af57[_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x52af57[_0x44b8('0x21')]):_0x52af57[_0x44b8('0x5b')],'paused':_0x52af57[_0x44b8('0x5a')]||![],'penalty':_0x52af57[_0x44b8('0x5d')]},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){_0x16074e[_0x44b8('0x5c')](function(_0x4ed62f){socket[_0x44b8('0x66')]('userVoiceQueue:save',{'UserId':_0x4ed62f['id'],'VoiceQueueId':_0x15365d['id']});});});});});}})[_0x44b8('0x13')](respondWithStatusCode(_0x343c5c,null))['catch'](handleError(_0x343c5c,null));};exports['removeTeams']=function(_0x1fb070,_0x224071){return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x1fb070[_0x44b8('0x32')][_0x44b8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id'],'raw':!![]}]})[_0x44b8('0x13')](handleEntityNotFound(_0x224071,null))['then'](function(_0x1eb0a8){var _0x1e3b5f=_[_0x44b8('0x1b')](_0x1eb0a8,'id');var _0x536d1d=[];var _0x5bc747=[];var _0x3e44ea=squel['select']();_0x3e44ea[_0x44b8('0x68')]('tq.TeamId')[_0x44b8('0x69')]('team_has_voice_queues','tq')['join'](_0x44b8('0x6a'),'ut',_0x44b8('0x6b'))['where'](_0x44b8('0x6c'),_0x1fb070[_0x44b8('0x2f')]['id']);for(var _0x276dfc=0x0;_0x276dfc<_0x1eb0a8[_0x44b8('0x37')];_0x276dfc+=0x1){let _0x291617=_0x1eb0a8[_0x276dfc];for(var _0x57b73f=0x0;_0x57b73f<_0x291617[_0x44b8('0x59')]['length'];_0x57b73f+=0x1){let _0x595af5=_0x291617['Agents'][_0x57b73f];var _0x3015f9=_0x3e44ea[_0x44b8('0x44')]();_0x3015f9['where'](_0x44b8('0x6d'),_0x595af5['id']);_0x5bc747[_0x44b8('0x6e')](db['sequelize']['query'](_0x3015f9[_0x44b8('0x6f')](),{'type':db[_0x44b8('0x70')]['QueryTypes'][_0x44b8('0x71')]})[_0x44b8('0x13')](function(_0x5e2d3b){if(_0x5e2d3b[_0x44b8('0x37')]===0x1){return _0x595af5['id'];}else{var _0x97f4=_['every'](_[_0x44b8('0x1b')](_0x5e2d3b,_0x44b8('0x72')),function(_0xdb42f2){return _['includes'](_0x1e3b5f,_0xdb42f2);});if(_0x97f4){return _0x595af5['id'];}}}));}}return BPromise[_0x44b8('0x73')](_0x5bc747)['then'](function(_0x2ea49d){_0x536d1d=_(_0x536d1d)['union'](_0x2ea49d)['compact']()[_0x44b8('0x1c')]();return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x1fb070[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x1db2cf){return db[_0x44b8('0x70')][_0x44b8('0x5e')](function(_0x1b7826){return _0x1db2cf[_0x44b8('0x74')](_0x1fb070[_0x44b8('0x32')]['ids'],{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){if(!_[_0x44b8('0x75')](_0x536d1d)){return _0x1db2cf[_0x44b8('0x76')](_0x536d1d,{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){return db[_0x44b8('0x62')][_0x44b8('0x12')]({'where':{'VoiceQueueId':_0x1fb070[_0x44b8('0x2f')]['id'],'UserId':_0x536d1d},'transaction':_0x1b7826});});}})[_0x44b8('0x13')](function(){_0x536d1d['forEach'](function(_0x4234bc){socket[_0x44b8('0x66')]('userVoiceQueue:remove',{'UserId':_0x4234bc,'VoiceQueueId':_0x1db2cf['id']});});});});});});})[_0x44b8('0x13')](respondWithStatusCode(_0x224071,null))[_0x44b8('0x2d')](handleError(_0x224071,null));};exports[_0x44b8('0x77')]=function(_0x5596c0,_0x4b2b8f){var _0x18cd30,_0x133da8;return db['VoiceQueue']['find']({'where':{'id':_0x5596c0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x4b2b8f,null))[_0x44b8('0x13')](function(_0x2bccf9){if(_0x2bccf9){_0x133da8=_0x2bccf9;return _0x2bccf9[_0x44b8('0x77')](_0x5596c0['body'][_0x44b8('0x67')],_['omit'](_0x5596c0[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{})[_0x44b8('0x78')](function(_0x156a60){for(var _0x3cbec9=0x0;_0x3cbec9<_0x5596c0[_0x44b8('0x3c')]['ids'][_0x44b8('0x37')];_0x3cbec9+=0x1){socket['emit'](_0x44b8('0x79'),{'UserId':Number(_0x5596c0[_0x44b8('0x3c')]['ids'][_0x3cbec9]),'VoiceQueueId':Number(_0x5596c0[_0x44b8('0x2f')]['id'])});}return _0x156a60;});}})['then'](function(_0x42b0c9){_0x18cd30=_0x42b0c9||[];if(_0x133da8){return db[_0x44b8('0x58')][_0x44b8('0x2b')]({'where':{'id':_0x5596c0['body'][_0x44b8('0x67')]},'attributes':['id',_0x44b8('0x21'),'online',_0x44b8('0x5a'),'interface'],'raw':!![]});}})['then'](function(_0x4220b5){if(!_['isEmpty'](_0x4220b5)){var _0x336436=[];for(var _0x51add5=0x0;_0x51add5<_0x4220b5[_0x44b8('0x37')];_0x51add5++){if(_0x4220b5[_0x51add5][_0x44b8('0x7a')]){_0x336436['push'](db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x4220b5[_0x51add5]['name'],'UserId':_0x4220b5[_0x51add5]['id'],'queue_name':_0x133da8['name'],'VoiceQueueId':_0x133da8['id'],'interface':_[_0x44b8('0x7b')](_0x4220b5[_0x51add5][_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x4220b5[_0x51add5]['name']):_0x4220b5[_0x51add5][_0x44b8('0x5b')],'paused':_0x4220b5[_0x51add5][_0x44b8('0x5a')]||![],'penalty':_0x5596c0[_0x44b8('0x3c')][_0x44b8('0x5d')]||0x0}));}}return BPromise['all'](_0x336436);}})['then'](function(){return _0x18cd30;})[_0x44b8('0x13')](respondWithResult(_0x4b2b8f,null))[_0x44b8('0x2d')](handleError(_0x4b2b8f,null));};exports[_0x44b8('0x76')]=function(_0x4cf4a0,_0x1443bd){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4cf4a0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x1443bd,null))[_0x44b8('0x13')](function(_0x2cb698){if(_0x2cb698){return _0x2cb698[_0x44b8('0x76')](_0x4cf4a0[_0x44b8('0x32')]['ids'])['then'](function(){if(_[_0x44b8('0x7c')](_0x4cf4a0['query'][_0x44b8('0x67')])){for(var _0x4dc333=0x0;_0x4dc333<_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x44b8('0x37')];_0x4dc333+=0x1){socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x4dc333]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}}else{socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}});}})[_0x44b8('0x13')](function(_0x4026d7){return db[_0x44b8('0x62')]['destroy']({'where':{'VoiceQueueId':_0x4cf4a0[_0x44b8('0x2f')]['id'],'UserId':_0x4cf4a0['query'][_0x44b8('0x67')]}})[_0x44b8('0x13')](function(){return _0x4026d7;});})[_0x44b8('0x13')](respondWithStatusCode(_0x1443bd,null))[_0x44b8('0x2d')](handleError(_0x1443bd,null));};exports[_0x44b8('0x7e')]=function(_0x22e5ae,_0x2f3340){var _0x4d98de={};var _0x597139={};var _0x2fffd5;var _0x3c90c2;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x22e5ae[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2f3340,null))[_0x44b8('0x13')](function(_0x208c53){if(_0x208c53){_0x2fffd5=_0x208c53;_0x597139[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x58')][_0x44b8('0x24')]);_0x597139['query']=_[_0x44b8('0x31')](_0x22e5ae[_0x44b8('0x32')]);_0x597139[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],_0x597139['query']);_0x4d98de['attributes']=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],qs['fields'](_0x22e5ae['query'][_0x44b8('0x36')]));_0x4d98de['attributes']=_0x4d98de[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4d98de[_0x44b8('0x35')]:_0x597139[_0x44b8('0x30')];_0x4d98de[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4d98de['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x22e5ae[_0x44b8('0x32')],_0x597139['filters']));if(_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4d98de['where']=_['merge'](_0x4d98de['where'],{'$or':_['map'](_0x4d98de[_0x44b8('0x35')],function(_0x5e423c){var _0x48065d={};_0x48065d[_0x5e423c]={'$like':'%'+_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x48065d;})});}_0x4d98de=_[_0x44b8('0x39')]({},_0x4d98de,_0x22e5ae['options']);return _0x2fffd5[_0x44b8('0x7e')](_0x4d98de);}})['then'](function(_0x230407){if(_0x230407){_0x3c90c2=_0x230407[_0x44b8('0x37')];if(!_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4d98de[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4d98de['offset']=qs['offset'](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0x2fffd5['getAgents'](_0x4d98de);}})[_0x44b8('0x13')](function(_0x188744){if(_0x188744){return _0x188744?{'count':_0x3c90c2,'rows':_0x188744}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2f3340,null))[_0x44b8('0x2d')](handleError(_0x2f3340,null));};exports[_0x44b8('0x7f')]=function(_0x2da727,_0x319520){var _0x2f7550={};var _0x57d24f={};var _0x223e54;var _0x3e5fa8;return db[_0x44b8('0x29')]['findOne']({'where':{'id':_0x2da727[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x319520,null))[_0x44b8('0x13')](function(_0x5370a5){if(_0x5370a5){_0x223e54=_0x5370a5;_0x57d24f[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x62')][_0x44b8('0x24')]);_0x57d24f[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x2da727[_0x44b8('0x32')]);_0x57d24f[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x57d24f[_0x44b8('0x30')],_0x57d24f[_0x44b8('0x32')]);_0x2f7550[_0x44b8('0x35')]=_['intersection'](_0x57d24f[_0x44b8('0x30')],qs['fields'](_0x2da727[_0x44b8('0x32')]['fields']));_0x2f7550[_0x44b8('0x35')]=_0x2f7550[_0x44b8('0x35')][_0x44b8('0x37')]?_0x2f7550[_0x44b8('0x35')]:_0x57d24f[_0x44b8('0x30')];_0x2f7550[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x2da727['query'][_0x44b8('0x4d')]);_0x2f7550[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x2da727[_0x44b8('0x32')],_0x57d24f[_0x44b8('0x33')]));if(_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]){_0x2f7550[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x2f7550[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x2f7550[_0x44b8('0x35')],function(_0x4281a6){var _0x4bb399={};_0x4bb399[_0x4281a6]={'$like':'%'+_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x4bb399;})});}_0x2f7550=_['merge']({},_0x2f7550,_0x2da727[_0x44b8('0x3a')]);return _0x223e54[_0x44b8('0x7f')](_0x2f7550);}})[_0x44b8('0x13')](function(_0x1f389e){if(_0x1f389e){_0x3e5fa8=_0x1f389e[_0x44b8('0x37')];if(!_0x2da727['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x2f7550[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x2da727['query'][_0x44b8('0x10')]);_0x2f7550[_0x44b8('0xf')]=qs['offset'](_0x2da727['query']['offset']);}return _0x223e54['getMembers'](_0x2f7550);}})[_0x44b8('0x13')](function(_0x5824a8){return _0x5824a8?{'count':_0x3e5fa8,'rows':_0x5824a8}:null;})['then'](respondWithResult(_0x319520,null))[_0x44b8('0x2d')](handleError(_0x319520,null));};exports[_0x44b8('0x80')]=function(_0x87a38,_0x54adf9){var _0x44dc3d={};var _0x32dafb={};var _0x3c8e0c;var _0x21ea61;return db['VoiceQueue'][_0x44b8('0x49')]({'where':{'id':_0x87a38['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x54adf9,null))[_0x44b8('0x13')](function(_0x56cfa5){if(_0x56cfa5){_0x3c8e0c=_0x56cfa5;_0x32dafb[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x32dafb[_0x44b8('0x32')]=_['keys'](_0x87a38['query']);_0x32dafb[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],_0x32dafb[_0x44b8('0x32')]);_0x44dc3d[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x36')]));_0x44dc3d[_0x44b8('0x35')]=_0x44dc3d[_0x44b8('0x35')]['length']?_0x44dc3d['attributes']:_0x32dafb[_0x44b8('0x30')];_0x44dc3d['order']=qs[_0x44b8('0x4d')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x44dc3d['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x87a38[_0x44b8('0x32')],_0x32dafb[_0x44b8('0x33')]));if(_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]){_0x44dc3d['where']=_[_0x44b8('0x39')](_0x44dc3d[_0x44b8('0x28')],{'$or':_['map'](_0x44dc3d[_0x44b8('0x35')],function(_0x1ffa05){var _0x22edd7={};_0x22edd7[_0x1ffa05]={'$like':'%'+_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x22edd7;})});}_0x44dc3d=_['merge']({},_0x44dc3d,_0x87a38[_0x44b8('0x3a')]);return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})[_0x44b8('0x13')](function(_0x2fca1a){if(_0x2fca1a){_0x21ea61=_0x2fca1a[_0x44b8('0x37')];if(!_0x87a38[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x44dc3d[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x87a38['query'][_0x44b8('0x10')]);_0x44dc3d[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x87a38['query']['offset']);}return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})['then'](function(_0x9458fb){if(_0x9458fb){return _0x9458fb?{'count':_0x21ea61,'rows':_0x9458fb}:null;}})[_0x44b8('0x13')](respondWithResult(_0x54adf9,null))[_0x44b8('0x2d')](handleError(_0x54adf9,null));};exports[_0x44b8('0x82')]=function(_0x2eb6ce,_0x105ca0){var _0x25f364=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x77c009,_0x161362;return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2eb6ce[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x105ca0,null))['then'](function(_0x4d88a6){if(_0x4d88a6){_0x161362=_0x4d88a6;return _0x4d88a6[_0x44b8('0x82')](_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x67')],_[_0x44b8('0x45')](_0x2eb6ce[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x4b49df){var _0xbf96c1;_0x77c009=_0x4b49df||[];var _0x1f6244=[];if(_0x4b49df){for(var _0x96a3cd=0x0;_0x96a3cd<_0x4b49df['length'];_0x96a3cd+=0x1){var _0x16721d=_0x4b49df[_0x96a3cd][_0x44b8('0x14')]({'plain':!![]});_0x161362[_0x44b8('0x83')]=_0x2eb6ce[_0x44b8('0x3c')]['dialCheckDuplicateType']?_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x83')]:_0x161362[_0x44b8('0x83')];switch(_0x161362['dialCheckDuplicateType']){case'always':_0xbf96c1=squel['insert']()['into']('cm_hopper')[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x85'),'phone')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))[_0x44b8('0x68')](_0x16721d['CmListId'][_0x44b8('0x6f')](),'ListId')[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),'VoiceQueueId')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))['where'](_0x44b8('0x8b'))['where'](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e'))['where'](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x90'))[_0x44b8('0x69')](_0x44b8('0x91'))['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]()))[_0x44b8('0x28')]('phone\x20NOT\x20IN\x20(?)',squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x92'))[_0x44b8('0x69')](_0x44b8('0x93'))[_0x44b8('0x28')](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;case _0x44b8('0x94'):_0xbf96c1=squel[_0x44b8('0x95')]()['into'](_0x44b8('0x93'))[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),'ContactId',_0x44b8('0x88'),'VoiceQueueId',_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field'](_0x44b8('0x85'),_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id','ContactId')[_0x44b8('0x68')](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')]['toString']())['where'](_0x44b8('0x8e'))[_0x44b8('0x28')](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;default:_0xbf96c1=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper')[_0x44b8('0x84')](['phone',_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),'VoiceQueueId','createdAt',_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field']('phone',_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))['field'](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e')))[_0x44b8('0x6f')]();}_0x1f6244[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0xbf96c1));}return BPromise['all'](_0x1f6244);}})[_0x44b8('0x13')](function(){var _0x2ad4ab=[];var _0x196b4b=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper_additional_phones')[_0x44b8('0x84')]([_0x44b8('0x97'),_0x44b8('0x85'),_0x44b8('0x98'),_0x44b8('0x46'),_0x44b8('0x47')],squel['select']()[_0x44b8('0x68')](_0x44b8('0x99'))[_0x44b8('0x68')](_0x44b8('0x9a'))[_0x44b8('0x68')](_0x44b8('0x9b'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27','createdAt')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x9c'),'ci')['join'](_0x44b8('0x93'),'h','h.ContactId=ci.CmContactId')[_0x44b8('0x28')](_0x44b8('0x9d'),_0x25f364)[_0x44b8('0x28')](_0x44b8('0x9e'),'PHONE'))[_0x44b8('0x6f')]();_0x2ad4ab[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0x196b4b));return BPromise[_0x44b8('0x73')](_0x2ad4ab);})[_0x44b8('0x13')](function(){return _0x77c009;})[_0x44b8('0x13')](respondWithResult(_0x105ca0,null))[_0x44b8('0x2d')](handleError(_0x105ca0,null));};exports[_0x44b8('0x9f')]=function(_0x257702,_0x17560c){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x257702[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x17560c,null))[_0x44b8('0x13')](function(_0x4d11d5){if(_0x4d11d5){return _0x4d11d5[_0x44b8('0x9f')](_0x257702[_0x44b8('0x32')][_0x44b8('0x67')]);}})[_0x44b8('0x13')](function(_0xafca17){if(_0xafca17){return db['CmHopper']['destroy']({'where':{'ListId':_0x257702['query'][_0x44b8('0x67')],'VoiceQueueId':_0x257702[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(){return _0xafca17;});}})[_0x44b8('0x13')](respondWithStatusCode(_0x17560c,null))[_0x44b8('0x2d')](handleError(_0x17560c,null));};exports[_0x44b8('0xa0')]=function(_0x513302,_0xfdb408){var _0x119dda={};var _0x5834fe={};var _0xe5cc1e;var _0x4c55e6;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x513302['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xfdb408,null))[_0x44b8('0x13')](function(_0x537eab){if(_0x537eab){_0xe5cc1e=_0x537eab;_0x5834fe[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x5834fe['query']=_[_0x44b8('0x31')](_0x513302[_0x44b8('0x32')]);_0x5834fe[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5834fe[_0x44b8('0x30')],_0x5834fe[_0x44b8('0x32')]);_0x119dda[_0x44b8('0x35')]=_['intersection'](_0x5834fe[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x513302[_0x44b8('0x32')]['fields']));_0x119dda[_0x44b8('0x35')]=_0x119dda[_0x44b8('0x35')]['length']?_0x119dda[_0x44b8('0x35')]:_0x5834fe[_0x44b8('0x30')];_0x119dda[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x513302['query'][_0x44b8('0x4d')]);_0x119dda[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x513302[_0x44b8('0x32')],_0x5834fe['filters']));if(_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]){_0x119dda['where']=_[_0x44b8('0x39')](_0x119dda[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x119dda[_0x44b8('0x35')],function(_0x4e9376){var _0x25f31c={};_0x25f31c[_0x4e9376]={'$like':'%'+_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x25f31c;})});}_0x119dda=_[_0x44b8('0x39')]({},_0x119dda,_0x513302[_0x44b8('0x3a')]);return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x57e3c9){if(_0x57e3c9){_0x4c55e6=_0x57e3c9[_0x44b8('0x37')];if(!_0x513302[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x119dda['limit']=qs[_0x44b8('0x10')](_0x513302[_0x44b8('0x32')][_0x44b8('0x10')]);_0x119dda['offset']=qs['offset'](_0x513302[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x4a5916){if(_0x4a5916){return _0x4a5916?{'count':_0x4c55e6,'rows':_0x4a5916}:null;}})[_0x44b8('0x13')](respondWithResult(_0xfdb408,null))[_0x44b8('0x2d')](handleError(_0xfdb408,null));};exports['addBlackLists']=function(_0xd19a35,_0x2439f2){var _0x22a624;return db['VoiceQueue'][_0x44b8('0x1e')]({'where':{'id':_0xd19a35[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2439f2,null))[_0x44b8('0x13')](function(_0x14c021){if(_0x14c021){return _0x14c021['addBlackLists'](_0xd19a35[_0x44b8('0x3c')][_0x44b8('0x67')],_['omit'](_0xd19a35[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x3b9cd2){var _0xb6cadf;_0x22a624=_0x3b9cd2||[];var _0x2024eb=[];if(_0x3b9cd2){for(var _0x29af58=0x0;_0x29af58<_0x3b9cd2[_0x44b8('0x37')];_0x29af58+=0x1){var _0x3870a9=_0x3b9cd2[_0x29af58]['get']({'plain':!![]});_0xb6cadf=squel['insert']()['into']('cm_hopper_black')[_0x44b8('0x84')]([_0x44b8('0x85'),'ContactId',_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('phone',_0x44b8('0x85'))['field']('id','ContactId')[_0x44b8('0x68')](_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0xd19a35['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')](_0x44b8('0xa1'),_0x44b8('0x46'))[_0x44b8('0x68')](_0x44b8('0xa1'),'updatedAt')[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')]())[_0x44b8('0x28')](_0x44b8('0x8e')))[_0x44b8('0x6f')]();_0x2024eb[_0x44b8('0x6e')](db['sequelize'][_0x44b8('0x32')](_0xb6cadf));}return BPromise[_0x44b8('0x73')](_0x2024eb);}})[_0x44b8('0x13')](function(){return _0x22a624;})[_0x44b8('0x13')](respondWithResult(_0x2439f2,null))[_0x44b8('0x2d')](handleError(_0x2439f2,null));};exports[_0x44b8('0xa2')]=function(_0x4ec799,_0x3fa943){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4ec799[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3fa943,null))[_0x44b8('0x13')](function(_0x3b1643){if(_0x3b1643){return _0x3b1643['removeBlackLists'](_0x4ec799[_0x44b8('0x32')]['ids']);}})['then'](function(_0x9a5734){if(_0x9a5734){return db[_0x44b8('0x54')][_0x44b8('0x12')]({'where':{'ListId':_0x4ec799[_0x44b8('0x32')][_0x44b8('0x67')],'VoiceQueueId':_0x4ec799['params']['id']}})['then'](function(){return _0x9a5734;});}})['then'](respondWithStatusCode(_0x3fa943,null))[_0x44b8('0x2d')](handleError(_0x3fa943,null));}; \ No newline at end of file +var _0x8ef6=['select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','into','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','find','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','getOptions','include','query','findAll','rows','catch','show','model','keys','intersection','attributes','fields','length','merge','options','create','body','user','get','role','QueueCampaigns','UserProfileSection','userProfileId','clone','includeAll','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','findOne','CmHopper','filters','hasOwnProperty','order','sort','where','pick','filter','getHopperHistories','CmHopperHistory','nolimit','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids'];(function(_0x1d6441,_0x813592){var _0x2bcda6=function(_0x22dc93){while(--_0x22dc93){_0x1d6441['push'](_0x1d6441['shift']());}};_0x2bcda6(++_0x813592);}(_0x8ef6,0xf2));var _0x68ef=function(_0x422df7,_0x58ad68){_0x422df7=_0x422df7-0x0;var _0x562db2=_0x8ef6[_0x422df7];return _0x562db2;};'use strict';var moment=require(_0x68ef('0x0'));var BPromise=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var _=require(_0x68ef('0x3'));var squel=require(_0x68ef('0x4'));var Redis=require(_0x68ef('0x5'));var qs=require(_0x68ef('0x6'));var logger=require('../../config/logger')(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var db=require(_0x68ef('0x9'))['db'];config[_0x68ef('0xa')]=_['defaults'](config['redis'],{'host':_0x68ef('0xb'),'port':0x18eb});var socket=require(_0x68ef('0xc'))(new Redis(config[_0x68ef('0xa')]));require('./voiceQueue.socket')[_0x68ef('0xd')](socket);function respondWithStatusCode(_0x31007e,_0x1bee73){_0x1bee73=_0x1bee73||0xcc;return function(_0x22ae26){if(_0x22ae26){return _0x31007e[_0x68ef('0xe')](_0x1bee73);}return _0x31007e[_0x68ef('0xf')](_0x1bee73)[_0x68ef('0x10')]();};}function respondWithResult(_0x23da00,_0x1f6747){_0x1f6747=_0x1f6747||0xc8;return function(_0x255c85){if(_0x255c85){return _0x23da00[_0x68ef('0xf')](_0x1f6747)[_0x68ef('0x11')](_0x255c85);}};}function respondWithFilteredResult(_0x582a79,_0x1aa045){return function(_0x46356f){if(_0x46356f){var _0x1e117a=typeof _0x1aa045[_0x68ef('0x12')]===_0x68ef('0x13')&&typeof _0x1aa045[_0x68ef('0x14')]==='undefined';var _0x3b48dd=_0x46356f[_0x68ef('0x15')];var _0x2657c5=_0x1e117a?0x0:_0x1aa045['offset'];var _0x22fe96=_0x1e117a?_0x46356f[_0x68ef('0x15')]:_0x1aa045[_0x68ef('0x12')]+_0x1aa045['limit'];var _0x35493d;if(_0x22fe96>=_0x3b48dd){_0x22fe96=_0x3b48dd;_0x35493d=0xc8;}else{_0x35493d=0xce;}_0x582a79[_0x68ef('0xf')](_0x35493d);return _0x582a79[_0x68ef('0x16')](_0x68ef('0x17'),_0x2657c5+'-'+_0x22fe96+'/'+_0x3b48dd)['json'](_0x46356f);}return null;};}function saveUpdates(_0x2ada1c){return function(_0x54139e){if(_0x54139e){return _0x54139e['update'](_0x2ada1c)[_0x68ef('0x18')](function(_0x404870){return _0x404870;});}return null;};}function removeEntity(_0x4ade0d){return function(_0x527870){if(_0x527870){return _0x527870[_0x68ef('0x19')]()[_0x68ef('0x18')](function(){var _0x318514=_0x527870['get']({'plain':!![]});var _0x1dc49c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b'),'ignore':![]},{'name':'QueueCampaigns','value':_0x68ef('0x1c'),'ignore':![]}];var _0x3be4c0=_(_0x1dc49c)['filter'](_0x68ef('0x1d'))[_0x68ef('0x1e')](_0x68ef('0x1f'))['value']();if(_['includes'](_0x3be4c0,_0x318514['type'])){return;}var _0x26018d=_[_0x68ef('0x20')](_0x1dc49c,[_0x68ef('0x1f'),_0x318514[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x23')][_0x68ef('0x19')]({'where':{'type':_0x26018d,'resourceId':_0x318514['id']}})[_0x68ef('0x18')](function(){return _0x527870;});})[_0x68ef('0x18')](function(){_0x4ade0d[_0x68ef('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178460){return function(_0x57f9ee){if(!_0x57f9ee){_0x178460['sendStatus'](0x194);}return _0x57f9ee;};}function handleError(_0x55d8b0,_0x1a7ce1){_0x1a7ce1=_0x1a7ce1||0x1f4;return function(_0x268f32){logger[_0x68ef('0x24')](_0x268f32[_0x68ef('0x25')]);if(_0x268f32['name']){delete _0x268f32['name'];}_0x55d8b0[_0x68ef('0xf')](_0x1a7ce1)[_0x68ef('0x26')](_0x268f32);};}exports[_0x68ef('0x27')]=function(_0x263b30,_0x22ef25){var _0x201884={};var _0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x28')][_0x68ef('0x29')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x21')]['key']};});_0x201884=qs[_0x68ef('0x2a')](_0x4579cb,_0x263b30);var _0x17588a={'where':_0x201884['where']};return db['VoiceQueue'][_0x68ef('0x15')](_0x17588a)[_0x68ef('0x18')](function(_0x4b8fc8){_0x26288a[_0x68ef('0x15')]=_0x4b8fc8;_0x201884[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x263b30[_0x68ef('0x2c')]);return db['VoiceQueue'][_0x68ef('0x2d')](_0x201884);})[_0x68ef('0x18')](function(_0x5f137b){_0x26288a[_0x68ef('0x2e')]=_0x5f137b;return _0x26288a;})['then'](respondWithFilteredResult(_0x22ef25,_0x201884))[_0x68ef('0x2f')](handleError(_0x22ef25,null));};exports[_0x68ef('0x30')]=function(_0x4973c2,_0x24c2c9){var _0x4a0763={'raw':![],'where':{'id':_0x4973c2['params']['id']}},_0x38c2f8={};_0x38c2f8[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x28')]['rawAttributes']);_0x38c2f8[_0x68ef('0x2c')]=_['keys'](_0x4973c2[_0x68ef('0x2c')]);_0x38c2f8['filters']=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],_0x38c2f8[_0x68ef('0x2c')]);_0x4a0763[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],qs['fields'](_0x4973c2[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a0763[_0x68ef('0x34')]=_0x4a0763['attributes'][_0x68ef('0x36')]?_0x4a0763[_0x68ef('0x34')]:_0x38c2f8[_0x68ef('0x31')];if(_0x4973c2['query']['includeAll']){_0x4a0763[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4a0763=_[_0x68ef('0x37')]({},_0x4a0763,_0x4973c2[_0x68ef('0x38')]);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4a0763)[_0x68ef('0x18')](handleEntityNotFound(_0x24c2c9,null))[_0x68ef('0x18')](respondWithResult(_0x24c2c9,null))['catch'](handleError(_0x24c2c9,null));};exports[_0x68ef('0x39')]=function(_0xd7f9ca,_0x2f6ee0){return db[_0x68ef('0x28')]['create'](_0xd7f9ca[_0x68ef('0x3a')],{})[_0x68ef('0x18')](function(_0xcf595d){var _0x410c10=_0xd7f9ca[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0x410c10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410c10[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0xf5010c=_0xcf595d[_0x68ef('0x3c')]({'plain':!![]});var _0x449f3c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b')},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x531096=_[_0x68ef('0x20')](_0x449f3c,[_0x68ef('0x1f'),_0xf5010c[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x531096,'userProfileId':_0x410c10[_0x68ef('0x40')]},'raw':!![]})['then'](function(_0xb3d396){if(_0xb3d396&&_0xb3d396['autoAssociation']===0x0){return db[_0x68ef('0x23')][_0x68ef('0x39')]({'name':_0xf5010c[_0x68ef('0x22')],'resourceId':_0xf5010c['id'],'type':_0xb3d396[_0x68ef('0x22')],'sectionId':_0xb3d396['id']},{})['then'](function(){return _0xcf595d;});}else{return _0xcf595d;}})[_0x68ef('0x2f')](function(_0x5a8231){logger[_0x68ef('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a8231);throw _0x5a8231;});}return _0xcf595d;})[_0x68ef('0x18')](respondWithResult(_0x2f6ee0,0xc9))[_0x68ef('0x2f')](handleError(_0x2f6ee0,null));};exports[_0x68ef('0x41')]=function(_0x5c4a66,_0x59b148){var _0x4044d5={'where':{'id':_0x5c4a66['params']['id']}},_0x399055={};_0x399055['model']=_['keys'](db[_0x68ef('0x28')][_0x68ef('0x29')]);_0x4044d5[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x399055[_0x68ef('0x31')],qs['fields'](_0x5c4a66['query'][_0x68ef('0x35')]));_0x4044d5[_0x68ef('0x34')]=_0x4044d5[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4044d5['attributes']:_0x399055[_0x68ef('0x31')];if(_0x5c4a66[_0x68ef('0x2c')][_0x68ef('0x42')]){_0x4044d5[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4044d5=_['merge']({},_0x4044d5,_0x5c4a66['options']);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4044d5)['then'](handleEntityNotFound(_0x59b148,null))[_0x68ef('0x18')](function(_0x12fff3){if(_0x12fff3){var _0x3a82a0=_0x12fff3[_0x68ef('0x3c')]({'plain':!![]});_0x3a82a0=qs[_0x68ef('0x43')](_0x3a82a0,['id','createdAt',_0x68ef('0x44')]);_0x5c4a66[_0x68ef('0x3a')]=_[_0x68ef('0x43')](_0x5c4a66['body'],['id',_0x68ef('0x45'),_0x68ef('0x44')]);return db[_0x68ef('0x28')]['create'](_[_0x68ef('0x37')](_0x3a82a0,_0x5c4a66['body']),{'include':_0x5c4a66['query'][_0x68ef('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x39dd21){var _0xb33afd=_0x5c4a66[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0xb33afd)throw new Error(_0x68ef('0x46'));if(_0xb33afd[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0x1d1d6e=_0x39dd21[_0x68ef('0x3c')]({'plain':!![]});var _0x247915=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x317b79=_[_0x68ef('0x20')](_0x247915,[_0x68ef('0x1f'),_0x1d1d6e[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x317b79,'userProfileId':_0xb33afd['userProfileId']},'raw':!![]})['then'](function(_0x42a4b2){if(_0x42a4b2&&_0x42a4b2['autoAssociation']===0x0){return db[_0x68ef('0x23')]['create']({'name':_0x1d1d6e[_0x68ef('0x22')],'resourceId':_0x1d1d6e['id'],'type':_0x42a4b2[_0x68ef('0x22')],'sectionId':_0x42a4b2['id']},{})['then'](function(){return _0x39dd21;});}else{return _0x39dd21;}})[_0x68ef('0x2f')](function(_0x4e097e){logger[_0x68ef('0x24')](_0x68ef('0x47'),_0x4e097e);throw _0x4e097e;});}return _0x39dd21;});}})[_0x68ef('0x18')](respondWithResult(_0x59b148,0xc9))[_0x68ef('0x2f')](handleError(_0x59b148,null));};exports[_0x68ef('0x48')]=function(_0x3d81c8,_0x5c347c){if(_0x3d81c8[_0x68ef('0x3a')]['id']){delete _0x3d81c8[_0x68ef('0x3a')]['id'];}return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3d81c8[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5c347c,null))['then'](saveUpdates(_0x3d81c8[_0x68ef('0x3a')],null))[_0x68ef('0x18')](respondWithResult(_0x5c347c,null))['catch'](handleError(_0x5c347c,null));};exports[_0x68ef('0x19')]=function(_0x114d9f,_0x3d3087){return db['VoiceQueue'][_0x68ef('0x20')]({'where':{'id':_0x114d9f['params']['id']}})['then'](handleEntityNotFound(_0x3d3087,null))[_0x68ef('0x18')](removeEntity(_0x3d3087,null))['catch'](handleError(_0x3d3087,null));};exports[_0x68ef('0x4a')]=function(_0x47c1d5,_0x100a20){var _0x9e8554={'raw':![],'where':{}};var _0x304405={};var _0x3fbd39={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x47c1d5['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x100a20,null))['then'](function(_0x2cbd99){if(_0x2cbd99){_0x304405['model']=_[_0x68ef('0x32')](db[_0x68ef('0x4c')][_0x68ef('0x29')]);_0x304405[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x47c1d5[_0x68ef('0x2c')]);_0x304405[_0x68ef('0x4d')]=_['intersection'](_0x304405[_0x68ef('0x31')],_0x304405[_0x68ef('0x2c')]);_0x9e8554[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x304405[_0x68ef('0x31')],qs['fields'](_0x47c1d5[_0x68ef('0x2c')]['fields']));_0x9e8554[_0x68ef('0x34')]=_0x9e8554['attributes']['length']?_0x9e8554[_0x68ef('0x34')]:_0x304405[_0x68ef('0x31')];if(!_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x4e')]('nolimit')){_0x9e8554[_0x68ef('0x14')]=qs['limit'](_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x9e8554[_0x68ef('0x12')]=qs['offset'](_0x47c1d5['query'][_0x68ef('0x12')]);}_0x9e8554[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x47c1d5[_0x68ef('0x2c')]['sort']);_0x9e8554[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x47c1d5[_0x68ef('0x2c')],_0x304405['filters']));_0x9e8554[_0x68ef('0x51')]['VoiceQueueId']=_0x2cbd99['id'];if(_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x9e8554[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x9e8554[_0x68ef('0x51')],{'$or':_['map'](_0x9e8554[_0x68ef('0x34')],function(_0x2caed7){var _0x147695={};_0x147695[_0x2caed7]={'$like':'%'+_0x47c1d5['query'][_0x68ef('0x53')]+'%'};return _0x147695;})});}_0x9e8554=_['merge']({},_0x9e8554,_0x47c1d5[_0x68ef('0x38')]);return db['CmHopper']['count']({'where':_0x9e8554[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x38c117){_0x3fbd39[_0x68ef('0x15')]=_0x38c117;if(_0x47c1d5['query'][_0x68ef('0x42')]){_0x9e8554[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x4c')]['findAll'](_0x9e8554);})[_0x68ef('0x18')](function(_0x2db826){_0x3fbd39[_0x68ef('0x2e')]=_0x2db826;return _0x3fbd39;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x100a20,_0x9e8554))[_0x68ef('0x2f')](handleError(_0x100a20,null));};exports[_0x68ef('0x54')]=function(_0x139557,_0xfe72dc){var _0x156ce3={'raw':!![],'where':{}};var _0x11feff={};var _0x454999={'count':0x0,'rows':[]};return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x139557[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0xfe72dc,null))['then'](function(_0x513c69){if(_0x513c69){_0x11feff[_0x68ef('0x31')]=_['keys'](db[_0x68ef('0x55')][_0x68ef('0x29')]);_0x11feff['query']=_['keys'](_0x139557[_0x68ef('0x2c')]);_0x11feff['filters']=_[_0x68ef('0x33')](_0x11feff['model'],_0x11feff[_0x68ef('0x2c')]);_0x156ce3['attributes']=_[_0x68ef('0x33')](_0x11feff[_0x68ef('0x31')],qs['fields'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x156ce3[_0x68ef('0x34')]=_0x156ce3[_0x68ef('0x34')]['length']?_0x156ce3[_0x68ef('0x34')]:_0x11feff[_0x68ef('0x31')];if(!_0x139557['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x156ce3[_0x68ef('0x14')]=qs['limit'](_0x139557[_0x68ef('0x2c')]['limit']);_0x156ce3[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x139557['query']['offset']);}_0x156ce3['order']=qs['sort'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x156ce3[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x139557[_0x68ef('0x2c')],_0x11feff[_0x68ef('0x4d')]));_0x156ce3[_0x68ef('0x51')][_0x68ef('0x57')]=_0x513c69['id'];if(_0x139557[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x156ce3[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x156ce3['where'],{'$or':_[_0x68ef('0x1e')](_0x156ce3['attributes'],function(_0x791181){var _0x5b39a8={};_0x5b39a8[_0x791181]={'$like':'%'+_0x139557['query'][_0x68ef('0x53')]+'%'};return _0x5b39a8;})});}_0x156ce3=_[_0x68ef('0x37')]({},_0x156ce3,_0x139557[_0x68ef('0x38')]);return db[_0x68ef('0x55')]['count']({'where':_0x156ce3['where']})[_0x68ef('0x18')](function(_0x308997){_0x454999[_0x68ef('0x15')]=_0x308997;if(_0x139557['query'][_0x68ef('0x42')]){_0x156ce3[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x55')][_0x68ef('0x2d')](_0x156ce3);})['then'](function(_0x214e89){_0x454999[_0x68ef('0x2e')]=_0x214e89;return _0x454999;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0xfe72dc,_0x156ce3))[_0x68ef('0x2f')](handleError(_0xfe72dc,null));};exports[_0x68ef('0x58')]=function(_0x346049,_0x489ca6){var _0x2a72e8={'raw':!![],'where':{}};var _0x49844f={};var _0xea97f4={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x346049[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x489ca6,null))[_0x68ef('0x18')](function(_0x4c47ab){if(_0x4c47ab){_0x49844f[_0x68ef('0x31')]=_[_0x68ef('0x32')](db['CmHopperFinal']['rawAttributes']);_0x49844f[_0x68ef('0x2c')]=_['keys'](_0x346049[_0x68ef('0x2c')]);_0x49844f['filters']=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],_0x49844f[_0x68ef('0x2c')]);_0x2a72e8[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],qs['fields'](_0x346049[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x2a72e8[_0x68ef('0x34')]=_0x2a72e8[_0x68ef('0x34')][_0x68ef('0x36')]?_0x2a72e8[_0x68ef('0x34')]:_0x49844f[_0x68ef('0x31')];if(!_0x346049['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x2a72e8[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x346049[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x2a72e8[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x346049[_0x68ef('0x2c')]['offset']);}_0x2a72e8[_0x68ef('0x4f')]=qs['sort'](_0x346049['query']['sort']);_0x2a72e8[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x346049['query'],_0x49844f['filters']));_0x2a72e8['where'][_0x68ef('0x57')]=_0x4c47ab['id'];if(_0x346049[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x2a72e8[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x2a72e8[_0x68ef('0x51')],{'$or':_['map'](_0x2a72e8[_0x68ef('0x34')],function(_0x2c7f18){var _0x1bdacc={};_0x1bdacc[_0x2c7f18]={'$like':'%'+_0x346049[_0x68ef('0x2c')]['filter']+'%'};return _0x1bdacc;})});}_0x2a72e8=_[_0x68ef('0x37')]({},_0x2a72e8,_0x346049[_0x68ef('0x38')]);return db[_0x68ef('0x59')][_0x68ef('0x15')]({'where':_0x2a72e8[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x6ca6f4){_0xea97f4[_0x68ef('0x15')]=_0x6ca6f4;if(_0x346049['query'][_0x68ef('0x42')]){_0x2a72e8[_0x68ef('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x68ef('0x2d')](_0x2a72e8);})[_0x68ef('0x18')](function(_0x1b9028){_0xea97f4[_0x68ef('0x2e')]=_0x1b9028;return _0xea97f4;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x489ca6,_0x2a72e8))[_0x68ef('0x2f')](handleError(_0x489ca6,null));};exports[_0x68ef('0x5a')]=function(_0x2e626c,_0x3b1781){var _0x159169={'raw':!![],'where':{}};var _0x29522c={};var _0x37bf89={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x2e626c[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3b1781,null))[_0x68ef('0x18')](function(_0x24af15){if(_0x24af15){_0x29522c['model']=_[_0x68ef('0x32')](db[_0x68ef('0x5b')][_0x68ef('0x29')]);_0x29522c[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x2e626c['query']);_0x29522c[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x29522c['model'],_0x29522c[_0x68ef('0x2c')]);_0x159169['attributes']=_['intersection'](_0x29522c['model'],qs['fields'](_0x2e626c[_0x68ef('0x2c')]['fields']));_0x159169[_0x68ef('0x34')]=_0x159169['attributes']['length']?_0x159169['attributes']:_0x29522c[_0x68ef('0x31')];if(!_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x159169[_0x68ef('0x14')]=qs['limit'](_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x159169[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x2e626c['query'][_0x68ef('0x12')]);}_0x159169['order']=qs['sort'](_0x2e626c['query'][_0x68ef('0x50')]);_0x159169[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x2e626c[_0x68ef('0x2c')],_0x29522c[_0x68ef('0x4d')]));_0x159169[_0x68ef('0x51')][_0x68ef('0x57')]=_0x24af15['id'];if(_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x159169[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x159169['where'],{'$or':_['map'](_0x159169['attributes'],function(_0x25e698){var _0x1cad59={};_0x1cad59[_0x25e698]={'$like':'%'+_0x2e626c[_0x68ef('0x2c')]['filter']+'%'};return _0x1cad59;})});}_0x159169=_[_0x68ef('0x37')]({},_0x159169,_0x2e626c['options']);return db[_0x68ef('0x5b')][_0x68ef('0x15')]({'where':_0x159169[_0x68ef('0x51')]})['then'](function(_0x304260){_0x37bf89[_0x68ef('0x15')]=_0x304260;if(_0x2e626c['query'][_0x68ef('0x42')]){_0x159169[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x5b')][_0x68ef('0x2d')](_0x159169);})[_0x68ef('0x18')](function(_0x23126a){_0x37bf89[_0x68ef('0x2e')]=_0x23126a;return _0x37bf89;});}})['then'](respondWithFilteredResult(_0x3b1781,_0x159169))[_0x68ef('0x2f')](handleError(_0x3b1781,null));};exports[_0x68ef('0x5c')]=function(_0x5a262d,_0x28cad4){var _0x424e46={};var _0x46c87e={};var _0x20a131;var _0x1b8250;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5a262d['params']['id']}})['then'](handleEntityNotFound(_0x28cad4,null))[_0x68ef('0x18')](function(_0x4dcf9e){if(_0x4dcf9e){_0x20a131=_0x4dcf9e;_0x46c87e[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x5d')][_0x68ef('0x29')]);_0x46c87e[_0x68ef('0x2c')]=_['keys'](_0x5a262d[_0x68ef('0x2c')]);_0x46c87e[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],_0x46c87e['query']);_0x424e46['attributes']=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x424e46[_0x68ef('0x34')]=_0x424e46[_0x68ef('0x34')][_0x68ef('0x36')]?_0x424e46[_0x68ef('0x34')]:_0x46c87e[_0x68ef('0x31')];_0x424e46[_0x68ef('0x4f')]=qs['sort'](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x424e46[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x5a262d[_0x68ef('0x2c')],_0x46c87e[_0x68ef('0x4d')]));if(_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x424e46[_0x68ef('0x51')]=_['merge'](_0x424e46['where'],{'$or':_[_0x68ef('0x1e')](_0x424e46[_0x68ef('0x34')],function(_0x3ef9e2){var _0x12ef69={};_0x12ef69[_0x3ef9e2]={'$like':'%'+_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0x12ef69;})});}_0x424e46=_[_0x68ef('0x37')]({},_0x424e46,_0x5a262d['options']);return _0x20a131[_0x68ef('0x5c')](_0x424e46);}})[_0x68ef('0x18')](function(_0x11c717){if(_0x11c717){_0x1b8250=_0x11c717[_0x68ef('0x36')];if(!_0x5a262d['query'][_0x68ef('0x4e')]('nolimit')){_0x424e46[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5a262d[_0x68ef('0x2c')]['limit']);_0x424e46['offset']=qs[_0x68ef('0x12')](_0x5a262d['query'][_0x68ef('0x12')]);}return _0x20a131['getTeams'](_0x424e46);}})[_0x68ef('0x18')](function(_0x426274){if(_0x426274){return _0x426274?{'count':_0x1b8250,'rows':_0x426274}:null;}})['then'](respondWithResult(_0x28cad4,null))['catch'](handleError(_0x28cad4,null));};exports[_0x68ef('0x5e')]=function(_0x1d429a,_0x4d96a9){var _0xf9f2c4=_0x1d429a[_0x68ef('0x3a')][_0x68ef('0x5f')];var _0x4ae311=_['map'](_0xf9f2c4,'id');return db[_0x68ef('0x5d')]['findAll']({'where':{'id':_0x4ae311},'attributes':['id'],'include':[{'model':db[_0x68ef('0x60')],'as':_0x68ef('0x61'),'attributes':['id',_0x68ef('0x22'),_0x68ef('0x62'),_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]}]})['then'](function(_0x48f3f6){if(_0x48f3f6){var _0x453f91=_[_0x68ef('0x65')](_0x48f3f6,function(_0x8eb711){var _0x39ab6a=_0x8eb711[_0x68ef('0x3c')]({'plain':!![]});_0x39ab6a['Agents'][_0x68ef('0x66')](function(_0x428fd5){_0x428fd5[_0x68ef('0x67')]=_[_0x68ef('0x20')](_0xf9f2c4,{'id':_0x39ab6a['id']})[_0x68ef('0x67')];});return _0x39ab6a[_0x68ef('0x61')];});return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x1d429a['params']['id']}})[_0x68ef('0x18')](function(_0x261ce6){return db[_0x68ef('0x68')][_0x68ef('0x69')](function(_0x2138cd){return _0x261ce6[_0x68ef('0x5e')](_0x4ae311,{'transaction':_0x2138cd})['then'](function(){return BPromise[_0x68ef('0x6a')](_0xf9f2c4,function(_0x13fae2){return db[_0x68ef('0x6b')][_0x68ef('0x6c')]({'TeamId':_0x13fae2['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id'],'penalty':_0x13fae2['penalty']},{'transaction':_0x2138cd});});})[_0x68ef('0x18')](function(){return BPromise[_0x68ef('0x6a')](_0x453f91,function(_0x5d156e){return db['UserVoiceQueue'][_0x68ef('0x6d')]({'where':{'UserId':_0x5d156e['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id']},'defaults':{'penalty':_0x5d156e[_0x68ef('0x67')]},'transaction':_0x2138cd});});})['then'](function(){return BPromise['each'](_[_0x68ef('0x53')](_0x453f91,{'online':!![]}),function(_0x10a3f9){return db[_0x68ef('0x6e')][_0x68ef('0x6c')]({'membername':_0x10a3f9[_0x68ef('0x22')],'UserId':_0x10a3f9['id'],'queue_name':_0x261ce6[_0x68ef('0x22')],'VoiceQueueId':_0x261ce6['id'],'interface':_[_0x68ef('0x6f')](_0x10a3f9[_0x68ef('0x64')])?util[_0x68ef('0x70')](_0x68ef('0x71'),_0x10a3f9[_0x68ef('0x22')]):_0x10a3f9[_0x68ef('0x64')],'paused':_0x10a3f9[_0x68ef('0x63')]||![],'penalty':_0x10a3f9[_0x68ef('0x67')]},{'transaction':_0x2138cd});});})['then'](function(){_0x453f91['forEach'](function(_0x503219){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':_0x503219['id'],'VoiceQueueId':_0x261ce6['id']});});});});});}})[_0x68ef('0x18')](respondWithStatusCode(_0x4d96a9,null))['catch'](handleError(_0x4d96a9,null));};exports[_0x68ef('0x74')]=function(_0x3713e0,_0x5af5d0){return db['Team'][_0x68ef('0x2d')]({'where':{'id':_0x3713e0[_0x68ef('0x2c')][_0x68ef('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x68ef('0x61'),'attributes':['id'],'raw':!![]}]})[_0x68ef('0x18')](handleEntityNotFound(_0x5af5d0,null))[_0x68ef('0x18')](function(_0x48959f){var _0x1bb11f=_['map'](_0x48959f,'id');var _0x211d51=[];var _0x3e37e3=[];var _0x5168cd=squel[_0x68ef('0x76')]();_0x5168cd[_0x68ef('0x77')](_0x68ef('0x78'))[_0x68ef('0x79')](_0x68ef('0x7a'),'tq')[_0x68ef('0x7b')](_0x68ef('0x7c'),'ut',_0x68ef('0x7d'))[_0x68ef('0x51')]('VoiceQueueId\x20=\x20?',_0x3713e0[_0x68ef('0x49')]['id']);for(var _0x121a0f=0x0;_0x121a0f<_0x48959f[_0x68ef('0x36')];_0x121a0f+=0x1){let _0x465198=_0x48959f[_0x121a0f];for(var _0x3e3775=0x0;_0x3e3775<_0x465198[_0x68ef('0x61')][_0x68ef('0x36')];_0x3e3775+=0x1){let _0x4906d2=_0x465198['Agents'][_0x3e3775];var _0x1e8577=_0x5168cd['clone']();_0x1e8577[_0x68ef('0x51')](_0x68ef('0x7e'),_0x4906d2['id']);_0x3e37e3[_0x68ef('0x7f')](db[_0x68ef('0x68')]['query'](_0x1e8577[_0x68ef('0x80')](),{'type':db[_0x68ef('0x68')][_0x68ef('0x81')]['SELECT']})[_0x68ef('0x18')](function(_0xe82f3a){if(_0xe82f3a['length']===0x1){return _0x4906d2['id'];}else{var _0x3c3933=_[_0x68ef('0x82')](_['map'](_0xe82f3a,'TeamId'),function(_0x522ef7){return _[_0x68ef('0x83')](_0x1bb11f,_0x522ef7);});if(_0x3c3933){return _0x4906d2['id'];}}}));}}return BPromise[_0x68ef('0x84')](_0x3e37e3)[_0x68ef('0x18')](function(_0x3e92e0){_0x211d51=_(_0x211d51)[_0x68ef('0x85')](_0x3e92e0)[_0x68ef('0x86')]()[_0x68ef('0x1f')]();return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3713e0['params']['id']}})[_0x68ef('0x18')](function(_0x62a830){return db['sequelize'][_0x68ef('0x69')](function(_0x2374fa){return _0x62a830[_0x68ef('0x74')](_0x3713e0['query'][_0x68ef('0x75')],{'transaction':_0x2374fa})['then'](function(){if(!_[_0x68ef('0x87')](_0x211d51)){return _0x62a830[_0x68ef('0x88')](_0x211d51,{'transaction':_0x2374fa})[_0x68ef('0x18')](function(){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x3713e0[_0x68ef('0x49')]['id'],'UserId':_0x211d51},'transaction':_0x2374fa});});}})[_0x68ef('0x18')](function(){_0x211d51[_0x68ef('0x66')](function(_0x491464){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':_0x491464,'VoiceQueueId':_0x62a830['id']});});});});});});})['then'](respondWithStatusCode(_0x5af5d0,null))[_0x68ef('0x2f')](handleError(_0x5af5d0,null));};exports[_0x68ef('0x8a')]=function(_0x430ef5,_0x1d3499){var _0x2b1686,_0x51c52b;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x430ef5[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1d3499,null))[_0x68ef('0x18')](function(_0x5548b1){if(_0x5548b1){_0x51c52b=_0x5548b1;return _0x5548b1[_0x68ef('0x8a')](_0x430ef5['body']['ids'],_[_0x68ef('0x43')](_0x430ef5[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{})[_0x68ef('0x8b')](function(_0x32e1e3){for(var _0x150e0d=0x0;_0x150e0d<_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]['length'];_0x150e0d+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':Number(_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')][_0x150e0d]),'VoiceQueueId':Number(_0x430ef5[_0x68ef('0x49')]['id'])});}return _0x32e1e3;});}})[_0x68ef('0x18')](function(_0x39302e){_0x2b1686=_0x39302e||[];if(_0x51c52b){return db[_0x68ef('0x60')][_0x68ef('0x2d')]({'where':{'id':_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]},'attributes':['id',_0x68ef('0x22'),'online',_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]});}})[_0x68ef('0x18')](function(_0xe4c314){if(!_['isEmpty'](_0xe4c314)){var _0xc5163d=[];for(var _0xb342e5=0x0;_0xb342e5<_0xe4c314[_0x68ef('0x36')];_0xb342e5++){if(_0xe4c314[_0xb342e5]['online']){_0xc5163d[_0x68ef('0x7f')](db['UserVoiceQueueRt'][_0x68ef('0x6c')]({'membername':_0xe4c314[_0xb342e5][_0x68ef('0x22')],'UserId':_0xe4c314[_0xb342e5]['id'],'queue_name':_0x51c52b[_0x68ef('0x22')],'VoiceQueueId':_0x51c52b['id'],'interface':_[_0x68ef('0x6f')](_0xe4c314[_0xb342e5][_0x68ef('0x64')])?util['format']('SIP/%s',_0xe4c314[_0xb342e5]['name']):_0xe4c314[_0xb342e5][_0x68ef('0x64')],'paused':_0xe4c314[_0xb342e5][_0x68ef('0x63')]||![],'penalty':_0x430ef5['body'][_0x68ef('0x67')]||0x0}));}}return BPromise[_0x68ef('0x84')](_0xc5163d);}})[_0x68ef('0x18')](function(){return _0x2b1686;})[_0x68ef('0x18')](respondWithResult(_0x1d3499,null))[_0x68ef('0x2f')](handleError(_0x1d3499,null));};exports[_0x68ef('0x88')]=function(_0x34edc4,_0x1576ac){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x34edc4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1576ac,null))[_0x68ef('0x18')](function(_0x31b61d){if(_0x31b61d){return _0x31b61d[_0x68ef('0x88')](_0x34edc4[_0x68ef('0x2c')]['ids'])[_0x68ef('0x18')](function(){if(_[_0x68ef('0x8c')](_0x34edc4['query'][_0x68ef('0x75')])){for(var _0x1774a9=0x0;_0x1774a9<_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')][_0x68ef('0x36')];_0x1774a9+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':Number(_0x34edc4['query']['ids'][_0x1774a9]),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}}else{socket[_0x68ef('0x72')]('userVoiceQueue:remove',{'UserId':Number(_0x34edc4[_0x68ef('0x2c')]['ids']),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}});}})['then'](function(_0x3054e8){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x34edc4[_0x68ef('0x49')]['id'],'UserId':_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')]}})[_0x68ef('0x18')](function(){return _0x3054e8;});})[_0x68ef('0x18')](respondWithStatusCode(_0x1576ac,null))['catch'](handleError(_0x1576ac,null));};exports[_0x68ef('0x8d')]=function(_0x60a1e7,_0x3bd9f2){var _0x3dd5f7={};var _0x35eba3={};var _0x18e166;var _0x3a6e25;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x60a1e7['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3bd9f2,null))[_0x68ef('0x18')](function(_0x33ec8e){if(_0x33ec8e){_0x18e166=_0x33ec8e;_0x35eba3['model']=_[_0x68ef('0x32')](db[_0x68ef('0x60')][_0x68ef('0x29')]);_0x35eba3[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x60a1e7[_0x68ef('0x2c')]);_0x35eba3[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],_0x35eba3[_0x68ef('0x2c')]);_0x3dd5f7[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x60a1e7[_0x68ef('0x2c')]['fields']));_0x3dd5f7[_0x68ef('0x34')]=_0x3dd5f7[_0x68ef('0x34')]['length']?_0x3dd5f7[_0x68ef('0x34')]:_0x35eba3['model'];_0x3dd5f7[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x3dd5f7[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x60a1e7[_0x68ef('0x2c')],_0x35eba3[_0x68ef('0x4d')]));if(_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x3dd5f7[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x3dd5f7['where'],{'$or':_[_0x68ef('0x1e')](_0x3dd5f7[_0x68ef('0x34')],function(_0x2cf7d3){var _0x154c78={};_0x154c78[_0x2cf7d3]={'$like':'%'+_0x60a1e7['query'][_0x68ef('0x53')]+'%'};return _0x154c78;})});}_0x3dd5f7=_[_0x68ef('0x37')]({},_0x3dd5f7,_0x60a1e7[_0x68ef('0x38')]);return _0x18e166['getAgents'](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x225067){if(_0x225067){_0x3a6e25=_0x225067[_0x68ef('0x36')];if(!_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x3dd5f7[_0x68ef('0x14')]=qs['limit'](_0x60a1e7['query'][_0x68ef('0x14')]);_0x3dd5f7[_0x68ef('0x12')]=qs['offset'](_0x60a1e7['query'][_0x68ef('0x12')]);}return _0x18e166[_0x68ef('0x8d')](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x1e1738){if(_0x1e1738){return _0x1e1738?{'count':_0x3a6e25,'rows':_0x1e1738}:null;}})[_0x68ef('0x18')](respondWithResult(_0x3bd9f2,null))[_0x68ef('0x2f')](handleError(_0x3bd9f2,null));};exports[_0x68ef('0x8e')]=function(_0x13db31,_0x58800b){var _0x4cc80a={};var _0x3452d1={};var _0x1c5b4a;var _0x33dd03;return db['VoiceQueue'][_0x68ef('0x4b')]({'where':{'id':_0x13db31[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x58800b,null))[_0x68ef('0x18')](function(_0x535c5c){if(_0x535c5c){_0x1c5b4a=_0x535c5c;_0x3452d1['model']=_[_0x68ef('0x32')](db[_0x68ef('0x6e')][_0x68ef('0x29')]);_0x3452d1['query']=_[_0x68ef('0x32')](_0x13db31[_0x68ef('0x2c')]);_0x3452d1[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],_0x3452d1[_0x68ef('0x2c')]);_0x4cc80a[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],qs['fields'](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4cc80a['attributes']=_0x4cc80a[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4cc80a[_0x68ef('0x34')]:_0x3452d1[_0x68ef('0x31')];_0x4cc80a['order']=qs[_0x68ef('0x50')](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x4cc80a['where']=qs[_0x68ef('0x4d')](_['pick'](_0x13db31['query'],_0x3452d1['filters']));if(_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x4cc80a['where']=_[_0x68ef('0x37')](_0x4cc80a['where'],{'$or':_['map'](_0x4cc80a[_0x68ef('0x34')],function(_0x103585){var _0xa28738={};_0xa28738[_0x103585]={'$like':'%'+_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0xa28738;})});}_0x4cc80a=_[_0x68ef('0x37')]({},_0x4cc80a,_0x13db31[_0x68ef('0x38')]);return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0xcd5609){if(_0xcd5609){_0x33dd03=_0xcd5609[_0x68ef('0x36')];if(!_0x13db31['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4cc80a['limit']=qs[_0x68ef('0x14')](_0x13db31['query'][_0x68ef('0x14')]);_0x4cc80a[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x13db31['query'][_0x68ef('0x12')]);}return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0x799597){return _0x799597?{'count':_0x33dd03,'rows':_0x799597}:null;})[_0x68ef('0x18')](respondWithResult(_0x58800b,null))[_0x68ef('0x2f')](handleError(_0x58800b,null));};exports['getLists']=function(_0x5e4ec4,_0x40c6ec){var _0x4a45f9={};var _0x16ba3d={};var _0x405008;var _0x3ecec3;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5e4ec4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x40c6ec,null))[_0x68ef('0x18')](function(_0x4d4bfa){if(_0x4d4bfa){_0x405008=_0x4d4bfa;_0x16ba3d[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')]['rawAttributes']);_0x16ba3d[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x5e4ec4[_0x68ef('0x2c')]);_0x16ba3d[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x16ba3d[_0x68ef('0x31')],_0x16ba3d[_0x68ef('0x2c')]);_0x4a45f9[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x16ba3d['model'],qs['fields'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a45f9['attributes']=_0x4a45f9[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4a45f9['attributes']:_0x16ba3d['model'];_0x4a45f9['order']=qs['sort'](_0x5e4ec4[_0x68ef('0x2c')]['sort']);_0x4a45f9[_0x68ef('0x51')]=qs['filters'](_[_0x68ef('0x52')](_0x5e4ec4[_0x68ef('0x2c')],_0x16ba3d['filters']));if(_0x5e4ec4['query']['filter']){_0x4a45f9[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x4a45f9[_0x68ef('0x51')],{'$or':_['map'](_0x4a45f9[_0x68ef('0x34')],function(_0x4898ad){var _0x22a810={};_0x22a810[_0x4898ad]={'$like':'%'+_0x5e4ec4['query'][_0x68ef('0x53')]+'%'};return _0x22a810;})});}_0x4a45f9=_[_0x68ef('0x37')]({},_0x4a45f9,_0x5e4ec4[_0x68ef('0x38')]);return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x3f9113){if(_0x3f9113){_0x3ecec3=_0x3f9113[_0x68ef('0x36')];if(!_0x5e4ec4['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4a45f9[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x4a45f9[_0x68ef('0x12')]=qs['offset'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x12')]);}return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x2a93bf){if(_0x2a93bf){return _0x2a93bf?{'count':_0x3ecec3,'rows':_0x2a93bf}:null;}})[_0x68ef('0x18')](respondWithResult(_0x40c6ec,null))[_0x68ef('0x2f')](handleError(_0x40c6ec,null));};exports[_0x68ef('0x91')]=function(_0x2d0bf5,_0x40da26){var _0x202e78=moment()[_0x68ef('0x70')]('YYYY-MM-DD\x20HH:mm:ss');var _0x253b31,_0x14b845;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x2d0bf5['params']['id']}})['then'](handleEntityNotFound(_0x40da26,null))['then'](function(_0x2e6bcf){if(_0x2e6bcf){_0x14b845=_0x2e6bcf;return _0x2e6bcf[_0x68ef('0x91')](_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0x2d0bf5['body'],['ids','id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x12dbe5){var _0x547e6d;_0x253b31=_0x12dbe5||[];var _0x575f73=[];if(_0x12dbe5){for(var _0x6dc883=0x0;_0x6dc883<_0x12dbe5[_0x68ef('0x36')];_0x6dc883+=0x1){var _0x1dcc3e=_0x12dbe5[_0x6dc883][_0x68ef('0x3c')]({'plain':!![]});_0x14b845[_0x68ef('0x92')]=_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x92')]?_0x2d0bf5['body'][_0x68ef('0x92')]:_0x14b845[_0x68ef('0x92')];switch(_0x14b845[_0x68ef('0x92')]){case _0x68ef('0x93'):_0x547e6d=squel[_0x68ef('0x94')]()['into'](_0x68ef('0x95'))[_0x68ef('0x96')](['phone',_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),'createdAt',_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id','ContactId')['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')['field'](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa1'))[_0x68ef('0x79')]('cm_hopper_final')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]()))[_0x68ef('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x68ef('0x76')]()[_0x68ef('0x77')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x68ef('0x51')](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id']['toString']())))[_0x68ef('0x80')]();break;case'onlyIfOpen':_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0x95'))[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),_0x68ef('0x45'),_0x68ef('0x44')],squel[_0x68ef('0x76')]()['field'](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id',_0x68ef('0x98'))['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0x2d0bf5['params']['id']['toString'](),_0x68ef('0x57'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))[_0x68ef('0x79')](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa4'))[_0x68ef('0x79')]('cm_hopper')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]())))[_0x68ef('0x80')]();break;default:_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')]('cm_hopper')[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),'VoiceQueueId','createdAt',_0x68ef('0x44')],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))['field']('id','ContactId')[_0x68ef('0x77')](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')[_0x68ef('0x77')](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))['where'](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))[_0x68ef('0x80')]();}_0x575f73[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x547e6d));}return BPromise[_0x68ef('0x84')](_0x575f73);}})[_0x68ef('0x18')](function(){var _0x54b4cc=[];var _0x59637f=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xa5'))['fromQuery']([_0x68ef('0xa6'),_0x68ef('0x9a'),_0x68ef('0xa7'),'createdAt','updatedAt'],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa8'))[_0x68ef('0x77')](_0x68ef('0xa9'))[_0x68ef('0x77')]('ci.OrderBy+1')['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0xaa'),'ci')[_0x68ef('0x7b')](_0x68ef('0x95'),'h',_0x68ef('0xab'))[_0x68ef('0x51')]('h.scheduledat=?',_0x202e78)[_0x68ef('0x51')](_0x68ef('0xac'),_0x68ef('0xad')))['toString']();_0x54b4cc[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x59637f));return BPromise[_0x68ef('0x84')](_0x54b4cc);})[_0x68ef('0x18')](function(){return _0x253b31;})[_0x68ef('0x18')](respondWithResult(_0x40da26,null))[_0x68ef('0x2f')](handleError(_0x40da26,null));};exports[_0x68ef('0xae')]=function(_0x58d5da,_0x1873b5){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x58d5da[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x1873b5,null))[_0x68ef('0x18')](function(_0x351b99){if(_0x351b99){return _0x351b99[_0x68ef('0xae')](_0x58d5da[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x5b41f0){if(_0x5b41f0){return db[_0x68ef('0x4c')]['destroy']({'where':{'ListId':_0x58d5da['query'][_0x68ef('0x75')],'VoiceQueueId':_0x58d5da[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](function(){return _0x5b41f0;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x1873b5,null))[_0x68ef('0x2f')](handleError(_0x1873b5,null));};exports[_0x68ef('0xaf')]=function(_0x3ee069,_0x5f49e9){var _0x40cd91={};var _0x848118={};var _0x794d1e;var _0x266f6c;return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x3ee069[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5f49e9,null))[_0x68ef('0x18')](function(_0x2b5994){if(_0x2b5994){_0x794d1e=_0x2b5994;_0x848118[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')][_0x68ef('0x29')]);_0x848118['query']=_[_0x68ef('0x32')](_0x3ee069[_0x68ef('0x2c')]);_0x848118[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x848118[_0x68ef('0x31')],_0x848118[_0x68ef('0x2c')]);_0x40cd91[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x848118['model'],qs[_0x68ef('0x35')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x40cd91[_0x68ef('0x34')]=_0x40cd91[_0x68ef('0x34')]['length']?_0x40cd91[_0x68ef('0x34')]:_0x848118[_0x68ef('0x31')];_0x40cd91[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x40cd91[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x3ee069[_0x68ef('0x2c')],_0x848118[_0x68ef('0x4d')]));if(_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x40cd91['where']=_[_0x68ef('0x37')](_0x40cd91[_0x68ef('0x51')],{'$or':_[_0x68ef('0x1e')](_0x40cd91[_0x68ef('0x34')],function(_0x124eda){var _0x4b738d={};_0x4b738d[_0x124eda]={'$like':'%'+_0x3ee069[_0x68ef('0x2c')]['filter']+'%'};return _0x4b738d;})});}_0x40cd91=_['merge']({},_0x40cd91,_0x3ee069[_0x68ef('0x38')]);return _0x794d1e['getBlackLists'](_0x40cd91);}})['then'](function(_0x4210c0){if(_0x4210c0){_0x266f6c=_0x4210c0['length'];if(!_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x40cd91[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x40cd91[_0x68ef('0x12')]=qs['offset'](_0x3ee069['query'][_0x68ef('0x12')]);}return _0x794d1e[_0x68ef('0xaf')](_0x40cd91);}})[_0x68ef('0x18')](function(_0x23946d){if(_0x23946d){return _0x23946d?{'count':_0x266f6c,'rows':_0x23946d}:null;}})[_0x68ef('0x18')](respondWithResult(_0x5f49e9,null))[_0x68ef('0x2f')](handleError(_0x5f49e9,null));};exports[_0x68ef('0xb0')]=function(_0xcc1765,_0x29662c){var _0x1185bd;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0xcc1765['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x29662c,null))['then'](function(_0x30876d){if(_0x30876d){return _0x30876d[_0x68ef('0xb0')](_0xcc1765[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0xcc1765[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x295b66){var _0x3455b5;_0x1185bd=_0x295b66||[];var _0xbf2168=[];if(_0x295b66){for(var _0x4cf8b6=0x0;_0x4cf8b6<_0x295b66[_0x68ef('0x36')];_0x4cf8b6+=0x1){var _0x4e3f0a=_0x295b66[_0x4cf8b6][_0x68ef('0x3c')]({'plain':!![]});_0x3455b5=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xb1'))[_0x68ef('0x96')]([_0x68ef('0x9a'),'ContactId','ListId','VoiceQueueId',_0x68ef('0x45'),_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('id','ContactId')[_0x68ef('0x77')](_0x4e3f0a[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0xcc1765[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')](_0x68ef('0xb2'),'createdAt')[_0x68ef('0x77')](_0x68ef('0xb2'),_0x68ef('0x44'))[_0x68ef('0x79')]('cm_contacts')[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x4e3f0a['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))['toString']();_0xbf2168['push'](db['sequelize'][_0x68ef('0x2c')](_0x3455b5));}return BPromise['all'](_0xbf2168);}})['then'](function(){return _0x1185bd;})[_0x68ef('0x18')](respondWithResult(_0x29662c,null))['catch'](handleError(_0x29662c,null));};exports[_0x68ef('0xb3')]=function(_0x398899,_0x8dd212){return db[_0x68ef('0x28')]['find']({'where':{'id':_0x398899[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x8dd212,null))[_0x68ef('0x18')](function(_0x57d305){if(_0x57d305){return _0x57d305[_0x68ef('0xb3')](_0x398899[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x4c6756){if(_0x4c6756){return db[_0x68ef('0x5b')]['destroy']({'where':{'ListId':_0x398899[_0x68ef('0x2c')]['ids'],'VoiceQueueId':_0x398899['params']['id']}})['then'](function(){return _0x4c6756;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x8dd212,null))[_0x68ef('0x2f')](handleError(_0x8dd212,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index e362bd6..85b563b 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 _0xb272=['../../mysqldb','VoiceQueue','save','update','emit','hook','exports','events'];(function(_0x1443be,_0x31b17d){var _0x38823d=function(_0x2e57d7){while(--_0x2e57d7){_0x1443be['push'](_0x1443be['shift']());}};_0x38823d(++_0x31b17d);}(_0xb272,0x97));var _0x2b27=function(_0x5eb281,_0x2a46c1){_0x5eb281=_0x5eb281-0x0;var _0xde0b5d=_0xb272[_0x5eb281];return _0xde0b5d;};'use strict';var EventEmitter=require(_0x2b27('0x0'));var VoiceQueue=require(_0x2b27('0x1'))['db'][_0x2b27('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2b27('0x3'),'afterUpdate':_0x2b27('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3f9afa){return function(_0x4a072c,_0x21e81a,_0x1eb5ae){VoiceQueueEvents['emit'](_0x3f9afa+':'+_0x4a072c['id'],_0x4a072c);VoiceQueueEvents[_0x2b27('0x5')](_0x3f9afa,_0x4a072c);_0x1eb5ae(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x2b27('0x6')](e,emitEvent(event));}}module[_0x2b27('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x1293=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1a815d,_0x20cc04){var _0x4b6685=function(_0x41a58a){while(--_0x41a58a){_0x1a815d['push'](_0x1a815d['shift']());}};_0x4b6685(++_0x20cc04);}(_0x1293,0x1d0));var _0x3129=function(_0x5bf578,_0x52abff){_0x5bf578=_0x5bf578-0x0;var _0x2ac394=_0x1293[_0x5bf578];return _0x2ac394;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x3129('0x0'))['db'][_0x3129('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x3129('0x2')](0x0);var events={'afterCreate':_0x3129('0x3'),'afterUpdate':_0x3129('0x4'),'afterDestroy':'remove'};function emitEvent(_0x573106){return function(_0x2e5342,_0x16137b,_0x69f87f){VoiceQueueEvents['emit'](_0x573106+':'+_0x2e5342['id'],_0x2e5342);VoiceQueueEvents[_0x3129('0x5')](_0x573106,_0x2e5342);_0x69f87f(null);};}for(var e in events){if(events[_0x3129('0x6')](e)){var event=events[e];VoiceQueue[_0x3129('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 d3d9880..b8cb0f0 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x549a24,_0x35bca6){var _0x2a67c3=function(_0x108a24){while(--_0x108a24){_0x549a24['push'](_0x549a24['shift']());}};_0x2a67c3(++_0x35bca6);}(_0x70e0,0x17b));var _0x070e=function(_0x1391f4,_0x314cf6){_0x1391f4=_0x1391f4-0x0;var _0x31e8c7=_0x70e0[_0x1391f4];return _0x31e8c7;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x3003fc,_0x5ac5de){var _0x22cb43=function(_0x478661){while(--_0x478661){_0x3003fc['push'](_0x3003fc['shift']());}};_0x22cb43(++_0x5ac5de);}(_0x3e74,0x175));var _0x43e7=function(_0x236c8f,_0x808ff3){_0x236c8f=_0x236c8f-0x0;var _0x4366c9=_0x3e74[_0x236c8f];return _0x4366c9;};'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 6eb906d..44d7c3a 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 _0x3b3b=['./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueue','VoiceQueue','options','raw','where','limit','include','map','model','attributes','then','debug','catch','ShowVoiceQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x31d794,_0x160894){var _0x325661=function(_0x456ed2){while(--_0x456ed2){_0x31d794['push'](_0x31d794['shift']());}};_0x325661(++_0x160894);}(_0x3b3b,0x162));var _0xb3b3=function(_0x26306f,_0xce1ef9){_0x26306f=_0x26306f-0x0;var _0x21cae4=_0x3b3b[_0x26306f];return _0x21cae4;};'use strict';var _=require(_0xb3b3('0x0'));var util=require(_0xb3b3('0x1'));var moment=require('moment');var BPromise=require(_0xb3b3('0x2'));var rs=require(_0xb3b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3b3('0x4'))['db'];var utils=require(_0xb3b3('0x5'));var logger=require('../../config/logger')(_0xb3b3('0x6'));var config=require(_0xb3b3('0x7'));var jayson=require(_0xb3b3('0x8'));var client=jayson[_0xb3b3('0x9')][_0xb3b3('0xa')]({'port':0x232a});config[_0xb3b3('0xb')]=_[_0xb3b3('0xc')](config['redis'],{'host':_0xb3b3('0xd'),'port':0x18eb});var socket=require(_0xb3b3('0xe'))(new Redis(config['redis']));require(_0xb3b3('0xf'))[_0xb3b3('0x10')](socket);function respondWithRpcPromise(_0x39d4f4,_0x11c94a,_0x467b2e){return new BPromise(function(_0x4fcce4,_0x2d768e){return client[_0xb3b3('0x11')](_0x39d4f4,_0x467b2e)['then'](function(_0x11efb6){logger[_0xb3b3('0x12')](_0xb3b3('0x13'),_0x11c94a,_0xb3b3('0x14'));logger['debug'](_0xb3b3('0x15'),_0x11c94a,'request\x20sent',JSON['stringify'](_0x11efb6));if(_0x11efb6['error']){if(_0x11efb6[_0xb3b3('0x16')][_0xb3b3('0x17')]===0x1f4){logger[_0xb3b3('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x11c94a,_0x11efb6[_0xb3b3('0x16')][_0xb3b3('0x18')]);return _0x2d768e(_0x11efb6[_0xb3b3('0x16')]['message']);}logger['error'](_0xb3b3('0x13'),_0x11c94a,_0x11efb6[_0xb3b3('0x16')][_0xb3b3('0x18')]);return _0x4fcce4(_0x11efb6['error'][_0xb3b3('0x18')]);}else{logger[_0xb3b3('0x12')](_0xb3b3('0x13'),_0x11c94a,_0xb3b3('0x14'));_0x4fcce4(_0x11efb6[_0xb3b3('0x19')][_0xb3b3('0x18')]);}})['catch'](function(_0x406675){logger[_0xb3b3('0x16')](_0xb3b3('0x13'),_0x11c94a,_0x406675);_0x2d768e(_0x406675);});});}exports[_0xb3b3('0x1a')]=function(_0xc5a16e){var _0x5afc9d=this;return new Promise(function(_0x300362,_0x2c83fc){return db[_0xb3b3('0x1b')]['findAll']({'raw':_0xc5a16e[_0xb3b3('0x1c')]?_0xc5a16e[_0xb3b3('0x1c')][_0xb3b3('0x1d')]===undefined?!![]:![]:!![],'where':_0xc5a16e[_0xb3b3('0x1c')]?_0xc5a16e[_0xb3b3('0x1c')][_0xb3b3('0x1e')]||null:null,'attributes':_0xc5a16e[_0xb3b3('0x1c')]?_0xc5a16e[_0xb3b3('0x1c')]['attributes']||null:null,'limit':_0xc5a16e[_0xb3b3('0x1c')]?_0xc5a16e[_0xb3b3('0x1c')][_0xb3b3('0x1f')]||null:null,'include':_0xc5a16e[_0xb3b3('0x1c')]?_0xc5a16e[_0xb3b3('0x1c')][_0xb3b3('0x20')]?_[_0xb3b3('0x21')](_0xc5a16e['options']['include'],function(_0x48729e){return{'model':db[_0x48729e[_0xb3b3('0x22')]],'as':_0x48729e['as'],'attributes':_0x48729e[_0xb3b3('0x23')],'include':_0x48729e[_0xb3b3('0x20')]?_['map'](_0x48729e[_0xb3b3('0x20')],function(_0x1f244a){return{'model':db[_0x1f244a[_0xb3b3('0x22')]],'as':_0x1f244a['as'],'attributes':_0x1f244a['attributes'],'include':_0x1f244a[_0xb3b3('0x20')]?_[_0xb3b3('0x21')](_0x1f244a[_0xb3b3('0x20')],function(_0x5a440a){return{'model':db[_0x5a440a[_0xb3b3('0x22')]],'as':_0x5a440a['as'],'attributes':_0x5a440a[_0xb3b3('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb3b3('0x24')](function(_0x18120d){logger[_0xb3b3('0x12')](_0xb3b3('0x1a'),_0xc5a16e);logger[_0xb3b3('0x25')](_0xb3b3('0x1a'),_0xc5a16e,JSON['stringify'](_0x18120d));_0x300362(_0x18120d);})[_0xb3b3('0x26')](function(_0x5e6676){logger['error'](_0xb3b3('0x1a'),_0x5e6676[_0xb3b3('0x18')],_0xc5a16e);_0x2c83fc(_0x5afc9d[_0xb3b3('0x16')](0x1f4,_0x5e6676[_0xb3b3('0x18')]));});});};exports[_0xb3b3('0x27')]=function(_0x2412f1){var _0x2e9759=this;return new Promise(function(_0x265f0a,_0x112632){return db[_0xb3b3('0x1b')][_0xb3b3('0x28')]({'raw':_0x2412f1['options']?_0x2412f1[_0xb3b3('0x1c')][_0xb3b3('0x1d')]===undefined?!![]:![]:!![],'where':_0x2412f1[_0xb3b3('0x1c')]?_0x2412f1[_0xb3b3('0x1c')][_0xb3b3('0x1e')]||null:null,'attributes':_0x2412f1[_0xb3b3('0x1c')]?_0x2412f1[_0xb3b3('0x1c')]['attributes']||null:null,'include':_0x2412f1[_0xb3b3('0x1c')]?_0x2412f1[_0xb3b3('0x1c')]['include']?_[_0xb3b3('0x21')](_0x2412f1['options'][_0xb3b3('0x20')],function(_0x3740e7){return{'model':db[_0x3740e7[_0xb3b3('0x22')]],'as':_0x3740e7['as'],'attributes':_0x3740e7[_0xb3b3('0x23')],'include':_0x3740e7['include']?_['map'](_0x3740e7[_0xb3b3('0x20')],function(_0x595ca5){return{'model':db[_0x595ca5[_0xb3b3('0x22')]],'as':_0x595ca5['as'],'attributes':_0x595ca5[_0xb3b3('0x23')],'include':_0x595ca5[_0xb3b3('0x20')]?_[_0xb3b3('0x21')](_0x595ca5[_0xb3b3('0x20')],function(_0x3b7cde){return{'model':db[_0x3b7cde[_0xb3b3('0x22')]],'as':_0x3b7cde['as'],'attributes':_0x3b7cde[_0xb3b3('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb3b3('0x24')](function(_0x3cba94){logger[_0xb3b3('0x12')](_0xb3b3('0x27'),_0x2412f1);logger['debug'](_0xb3b3('0x27'),_0x2412f1,JSON['stringify'](_0x3cba94));_0x265f0a(_0x3cba94);})['catch'](function(_0x9eb66a){logger[_0xb3b3('0x16')](_0xb3b3('0x27'),_0x9eb66a[_0xb3b3('0x18')],_0x2412f1);_0x112632(_0x2e9759['error'](0x1f4,_0x9eb66a[_0xb3b3('0x18')]));});});}; \ No newline at end of file +var _0x7060=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','raw','options','where','attributes','limit','include','map','model','then','debug','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x6c1312,_0x4a6a7a){var _0x1f986c=function(_0x3367a5){while(--_0x3367a5){_0x6c1312['push'](_0x6c1312['shift']());}};_0x1f986c(++_0x4a6a7a);}(_0x7060,0xca));var _0x0706=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7060[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0706('0x0'));var util=require(_0x0706('0x1'));var moment=require(_0x0706('0x2'));var BPromise=require(_0x0706('0x3'));var rs=require(_0x0706('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0706('0x5'));var logger=require(_0x0706('0x6'))(_0x0706('0x7'));var config=require(_0x0706('0x8'));var jayson=require(_0x0706('0x9'));var client=jayson[_0x0706('0xa')][_0x0706('0xb')]({'port':0x232a});config[_0x0706('0xc')]=_[_0x0706('0xd')](config['redis'],{'host':_0x0706('0xe'),'port':0x18eb});var socket=require(_0x0706('0xf'))(new Redis(config[_0x0706('0xc')]));require(_0x0706('0x10'))[_0x0706('0x11')](socket);function respondWithRpcPromise(_0x13ae32,_0x197168,_0xb62272){return new BPromise(function(_0x5a6801,_0x3acae0){return client[_0x0706('0x12')](_0x13ae32,_0xb62272)['then'](function(_0x628ed1){logger[_0x0706('0x13')](_0x0706('0x14'),_0x197168,_0x0706('0x15'));logger['debug'](_0x0706('0x16'),_0x197168,_0x0706('0x15'),JSON[_0x0706('0x17')](_0x628ed1));if(_0x628ed1['error']){if(_0x628ed1[_0x0706('0x18')][_0x0706('0x19')]===0x1f4){logger[_0x0706('0x18')](_0x0706('0x14'),_0x197168,_0x628ed1[_0x0706('0x18')][_0x0706('0x1a')]);return _0x3acae0(_0x628ed1[_0x0706('0x18')]['message']);}logger['error'](_0x0706('0x14'),_0x197168,_0x628ed1[_0x0706('0x18')][_0x0706('0x1a')]);return _0x5a6801(_0x628ed1[_0x0706('0x18')][_0x0706('0x1a')]);}else{logger[_0x0706('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x197168,_0x0706('0x15'));_0x5a6801(_0x628ed1['result'][_0x0706('0x1a')]);}})[_0x0706('0x1b')](function(_0x193410){logger[_0x0706('0x18')](_0x0706('0x14'),_0x197168,_0x193410);_0x3acae0(_0x193410);});});}exports[_0x0706('0x1c')]=function(_0x410964){var _0x247547=this;return new Promise(function(_0x37f0d5,_0xbebca3){return db[_0x0706('0x1d')][_0x0706('0x1e')]({'raw':_0x410964['options']?_0x410964['options'][_0x0706('0x1f')]===undefined?!![]:![]:!![],'where':_0x410964[_0x0706('0x20')]?_0x410964[_0x0706('0x20')][_0x0706('0x21')]||null:null,'attributes':_0x410964[_0x0706('0x20')]?_0x410964[_0x0706('0x20')][_0x0706('0x22')]||null:null,'limit':_0x410964['options']?_0x410964[_0x0706('0x20')][_0x0706('0x23')]||null:null,'include':_0x410964[_0x0706('0x20')]?_0x410964[_0x0706('0x20')][_0x0706('0x24')]?_[_0x0706('0x25')](_0x410964[_0x0706('0x20')][_0x0706('0x24')],function(_0x3212dc){return{'model':db[_0x3212dc[_0x0706('0x26')]],'as':_0x3212dc['as'],'attributes':_0x3212dc[_0x0706('0x22')],'include':_0x3212dc[_0x0706('0x24')]?_[_0x0706('0x25')](_0x3212dc[_0x0706('0x24')],function(_0x7c2bdd){return{'model':db[_0x7c2bdd['model']],'as':_0x7c2bdd['as'],'attributes':_0x7c2bdd[_0x0706('0x22')],'include':_0x7c2bdd[_0x0706('0x24')]?_['map'](_0x7c2bdd[_0x0706('0x24')],function(_0x349d55){return{'model':db[_0x349d55['model']],'as':_0x349d55['as'],'attributes':_0x349d55[_0x0706('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0706('0x27')](function(_0x4add49){logger[_0x0706('0x13')](_0x0706('0x1c'),_0x410964);logger[_0x0706('0x28')](_0x0706('0x1c'),_0x410964,JSON[_0x0706('0x17')](_0x4add49));_0x37f0d5(_0x4add49);})[_0x0706('0x1b')](function(_0x5582d6){logger[_0x0706('0x18')](_0x0706('0x1c'),_0x5582d6[_0x0706('0x1a')],_0x410964);_0xbebca3(_0x247547[_0x0706('0x18')](0x1f4,_0x5582d6['message']));});});};exports[_0x0706('0x29')]=function(_0x4bc2f4){var _0x404b11=this;return new Promise(function(_0x21baaf,_0x71e9d){return db['VoiceQueue']['find']({'raw':_0x4bc2f4[_0x0706('0x20')]?_0x4bc2f4[_0x0706('0x20')][_0x0706('0x1f')]===undefined?!![]:![]:!![],'where':_0x4bc2f4[_0x0706('0x20')]?_0x4bc2f4[_0x0706('0x20')]['where']||null:null,'attributes':_0x4bc2f4[_0x0706('0x20')]?_0x4bc2f4[_0x0706('0x20')][_0x0706('0x22')]||null:null,'include':_0x4bc2f4[_0x0706('0x20')]?_0x4bc2f4['options'][_0x0706('0x24')]?_['map'](_0x4bc2f4['options'][_0x0706('0x24')],function(_0x681680){return{'model':db[_0x681680[_0x0706('0x26')]],'as':_0x681680['as'],'attributes':_0x681680[_0x0706('0x22')],'include':_0x681680[_0x0706('0x24')]?_[_0x0706('0x25')](_0x681680[_0x0706('0x24')],function(_0x5bce5e){return{'model':db[_0x5bce5e['model']],'as':_0x5bce5e['as'],'attributes':_0x5bce5e['attributes'],'include':_0x5bce5e['include']?_[_0x0706('0x25')](_0x5bce5e[_0x0706('0x24')],function(_0x2a8b45){return{'model':db[_0x2a8b45[_0x0706('0x26')]],'as':_0x2a8b45['as'],'attributes':_0x2a8b45[_0x0706('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0706('0x27')](function(_0x8a698c){logger[_0x0706('0x13')](_0x0706('0x29'),_0x4bc2f4);logger[_0x0706('0x28')](_0x0706('0x29'),_0x4bc2f4,JSON[_0x0706('0x17')](_0x8a698c));_0x21baaf(_0x8a698c);})[_0x0706('0x1b')](function(_0xa1f777){logger['error'](_0x0706('0x29'),_0xa1f777[_0x0706('0x1a')],_0x4bc2f4);_0x71e9d(_0x404b11['error'](0x1f4,_0xa1f777[_0x0706('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 27d9814..2ca255f 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 _0x7be0=['./voiceQueue.events','save','update','removeListener','length','voiceQueue:'];(function(_0x35c4ca,_0x363dc5){var _0x17c529=function(_0x3a47e5){while(--_0x3a47e5){_0x35c4ca['push'](_0x35c4ca['shift']());}};_0x17c529(++_0x363dc5);}(_0x7be0,0x126));var _0x07be=function(_0x55ec78,_0x146f50){_0x55ec78=_0x55ec78-0x0;var _0x1accc7=_0x7be0[_0x55ec78];return _0x1accc7;};'use strict';var VoiceQueueEvents=require(_0x07be('0x0'));var events=[_0x07be('0x1'),'remove',_0x07be('0x2')];function createListener(_0x13f097,_0x315645){return function(_0x2579e4){_0x315645['emit'](_0x13f097,_0x2579e4);};}function removeListener(_0x1ab336,_0x59f652){return function(){VoiceQueueEvents[_0x07be('0x3')](_0x1ab336,_0x59f652);};}exports['register']=function(_0x1bfb1f){for(var _0x47a20b=0x0,_0x337bf5=events[_0x07be('0x4')];_0x47a20b<_0x337bf5;_0x47a20b++){var _0x188fe0=events[_0x47a20b];var _0x16fbfb=createListener(_0x07be('0x5')+_0x188fe0,_0x1bfb1f);VoiceQueueEvents['on'](_0x188fe0,_0x16fbfb);}}; \ No newline at end of file +var _0x473c=['voiceQueue:','./voiceQueue.events','remove','update','emit','removeListener','register','length'];(function(_0x47a84b,_0x1cdcc2){var _0x293309=function(_0x355be4){while(--_0x355be4){_0x47a84b['push'](_0x47a84b['shift']());}};_0x293309(++_0x1cdcc2);}(_0x473c,0x169));var _0xc473=function(_0x628ff8,_0x22f348){_0x628ff8=_0x628ff8-0x0;var _0x35ea03=_0x473c[_0x628ff8];return _0x35ea03;};'use strict';var VoiceQueueEvents=require(_0xc473('0x0'));var events=['save',_0xc473('0x1'),_0xc473('0x2')];function createListener(_0x5aad81,_0x374e08){return function(_0x377736){_0x374e08[_0xc473('0x3')](_0x5aad81,_0x377736);};}function removeListener(_0x338cd1,_0x52fd34){return function(){VoiceQueueEvents[_0xc473('0x4')](_0x338cd1,_0x52fd34);};}exports[_0xc473('0x5')]=function(_0x339d1d){for(var _0x505679=0x0,_0x3653b7=events[_0xc473('0x6')];_0x505679<_0x3653b7;_0x505679++){var _0x21622c=events[_0x505679];var _0x80fc1=createListener(_0xc473('0x7')+_0x21622c,_0x339d1d);VoiceQueueEvents['on'](_0x21622c,_0x80fc1);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 528a5c2..91862a5 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 _0x24f8=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','/index','/:id','show','post','create','put','update','delete','multer','util'];(function(_0x2bc5f9,_0x3a16dd){var _0x496108=function(_0x1c6cc8){while(--_0x1c6cc8){_0x2bc5f9['push'](_0x2bc5f9['shift']());}};_0x496108(++_0x3a16dd);}(_0x24f8,0x7c));var _0x824f=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0x24f8[_0x301dab];return _0x2500a2;};'use strict';var multer=require(_0x824f('0x0'));var util=require(_0x824f('0x1'));var path=require('path');var timeout=require(_0x824f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x824f('0x3'));var auth=require(_0x824f('0x4'));var interaction=require(_0x824f('0x5'));var config=require(_0x824f('0x6'));var controller=require(_0x824f('0x7'));router['get']('/',auth[_0x824f('0x8')](),controller[_0x824f('0x9')]);router[_0x824f('0xa')](_0x824f('0xb'),auth[_0x824f('0x8')](),controller[_0x824f('0xc')]);router[_0x824f('0xa')](_0x824f('0xd'),auth[_0x824f('0x8')](),controller['getVoiceQueuesReport']);router['get'](_0x824f('0xe'),auth[_0x824f('0x8')](),controller[_0x824f('0xf')]);router[_0x824f('0x10')]('/',auth[_0x824f('0x8')](),controller[_0x824f('0x11')]);router[_0x824f('0x12')](_0x824f('0xe'),auth[_0x824f('0x8')](),controller[_0x824f('0x13')]);router[_0x824f('0x14')](_0x824f('0xe'),auth[_0x824f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbb9f=['./voiceQueueReport.controller','isAuthenticated','index','get','/describe','/index','getVoiceQueuesReport','/:id','show','post','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1820f1,_0x1403e7){var _0x167aed=function(_0x4c89f5){while(--_0x4c89f5){_0x1820f1['push'](_0x1820f1['shift']());}};_0x167aed(++_0x1403e7);}(_0xbb9f,0x116));var _0xfbb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb9f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfbb9('0x0'));var util=require(_0xfbb9('0x1'));var path=require(_0xfbb9('0x2'));var timeout=require('connect-timeout');var express=require(_0xfbb9('0x3'));var router=express[_0xfbb9('0x4')]();var fs_extra=require(_0xfbb9('0x5'));var auth=require(_0xfbb9('0x6'));var interaction=require(_0xfbb9('0x7'));var config=require('../../config/environment');var controller=require(_0xfbb9('0x8'));router['get']('/',auth[_0xfbb9('0x9')](),controller[_0xfbb9('0xa')]);router[_0xfbb9('0xb')](_0xfbb9('0xc'),auth[_0xfbb9('0x9')](),controller['describe']);router[_0xfbb9('0xb')](_0xfbb9('0xd'),auth[_0xfbb9('0x9')](),controller[_0xfbb9('0xe')]);router[_0xfbb9('0xb')](_0xfbb9('0xf'),auth[_0xfbb9('0x9')](),controller[_0xfbb9('0x10')]);router[_0xfbb9('0x11')]('/',auth[_0xfbb9('0x9')](),controller['create']);router[_0xfbb9('0x12')](_0xfbb9('0xf'),auth['isAuthenticated'](),controller[_0xfbb9('0x13')]);router['delete'](_0xfbb9('0xf'),auth[_0xfbb9('0x9')](),controller[_0xfbb9('0x14')]);module[_0xfbb9('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 fd2f27c..043cdb7 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 _0x3fa7=['getDataValue','format','diff','seconds','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE'];(function(_0x1ff26f,_0x24704d){var _0x2fed9b=function(_0x4ea6e0){while(--_0x4ea6e0){_0x1ff26f['push'](_0x1ff26f['shift']());}};_0x2fed9b(++_0x24704d);}(_0x3fa7,0x1d7));var _0x73fa=function(_0x1e4994,_0x48d00c){_0x1e4994=_0x1e4994-0x0;var _0x33aa9a=_0x3fa7[_0x1e4994];return _0x33aa9a;};'use strict';var Sequelize=require(_0x73fa('0x0'));var moment=require(_0x73fa('0x1'));module[_0x73fa('0x2')]={'type':{'type':Sequelize[_0x73fa('0x3')]},'uniqueid':{'type':Sequelize[_0x73fa('0x3')]},'calleridnum':{'type':Sequelize[_0x73fa('0x3')]},'calleridname':{'type':Sequelize[_0x73fa('0x3')]},'queue':{'type':Sequelize[_0x73fa('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x73fa('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x30b244){var _0x3ab615=moment(_0x30b244);var _0x2507bf=moment(this[_0x73fa('0x5')]('queuecallerjoinAt'))[_0x73fa('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x349b49=_0x3ab615[_0x73fa('0x7')](_0x2507bf,_0x73fa('0x8'));this['setDataValue']('queuecallerleaveAt',_0x30b244);this['setDataValue'](_0x73fa('0x9'),_0x349b49||null);}},'position':{'type':Sequelize[_0x73fa('0xa')]},'count':{'type':Sequelize[_0x73fa('0xa')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x73fa('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x73fa('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x73fa('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x73fa('0x3')],'comment':_0x73fa('0xc')},'originalposition':{'type':Sequelize[_0x73fa('0xa')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x73fa('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x73fa('0x3')]},'context':{'type':Sequelize[_0x73fa('0x3')]},'exten':{'type':Sequelize[_0x73fa('0x3')]},'priority':{'type':Sequelize[_0x73fa('0x3')]},'holdtime':{'type':Sequelize[_0x73fa('0xa')]},'mohtime':{'type':Sequelize[_0x73fa('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x73fa('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x73fa('0x3')]},'transfer':{'type':Sequelize[_0x73fa('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x73fa('0x3')],'comment':_0x73fa('0xd')},'transferexten':{'type':Sequelize[_0x73fa('0x3')]},'transferuniqueid':{'type':Sequelize[_0x73fa('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x73fa('0x3')]},'thirdDisposition':{'type':Sequelize[_0x73fa('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x73fa('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0x73fa('0x3')]}}; \ No newline at end of file +var _0x267c=['seconds','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x2b0022,_0x321794){var _0x20bea6=function(_0x52c81b){while(--_0x52c81b){_0x2b0022['push'](_0x2b0022['shift']());}};_0x20bea6(++_0x321794);}(_0x267c,0x1b7));var _0xc267=function(_0x3c726f,_0xecdc2d){_0x3c726f=_0x3c726f-0x0;var _0x203ce8=_0x267c[_0x3c726f];return _0x203ce8;};'use strict';var Sequelize=require(_0xc267('0x0'));var moment=require(_0xc267('0x1'));module[_0xc267('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc267('0x3')]},'calleridnum':{'type':Sequelize[_0xc267('0x3')]},'calleridname':{'type':Sequelize[_0xc267('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xc267('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xc267('0x4')],'set':function(_0x20803a){var _0x4db88d=moment(_0x20803a);var _0x2d5a09=moment(this[_0xc267('0x5')]('queuecallerjoinAt'))[_0xc267('0x6')](_0xc267('0x7'));var _0x23b42d=_0x4db88d[_0xc267('0x8')](_0x2d5a09,_0xc267('0x9'));this[_0xc267('0xa')]('queuecallerleaveAt',_0x20803a);this[_0xc267('0xa')]('holdtime',_0x23b42d||null);}},'position':{'type':Sequelize[_0xc267('0xb')]},'count':{'type':Sequelize[_0xc267('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xc267('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc267('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xc267('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xc267('0xd')},'originalposition':{'type':Sequelize[_0xc267('0xb')]},'channel':{'type':Sequelize[_0xc267('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xc267('0x3')]},'accountcode':{'type':Sequelize[_0xc267('0x3')]},'context':{'type':Sequelize[_0xc267('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xc267('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc267('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xc267('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc267('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xc267('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xc267('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xc267('0xb')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 013eb6a..38d9460 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 _0xb327=['./voiceQueueReport.socket','register','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VoiceQueueReport','includeAll','findAll','catch','show','params','include','create','body','describe','getVoiceQueuesReport','hasOwnProperty','pick','rows','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults'];(function(_0x5db129,_0x151303){var _0x5ec143=function(_0x245b33){while(--_0x245b33){_0x5db129['push'](_0x5db129['shift']());}};_0x5ec143(++_0x151303);}(_0xb327,0x1db));var _0x7b32=function(_0x30153b,_0x4b4a33){_0x30153b=_0x30153b-0x0;var _0x2401a2=_0xb327[_0x30153b];return _0x2401a2;};'use strict';var emlformat=require(_0x7b32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b32('0x1'));var jsonpatch=require(_0x7b32('0x2'));var rp=require(_0x7b32('0x3'));var moment=require(_0x7b32('0x4'));var BPromise=require(_0x7b32('0x5'));var Mustache=require(_0x7b32('0x6'));var util=require(_0x7b32('0x7'));var path=require('path');var sox=require(_0x7b32('0x8'));var csv=require('to-csv');var ejs=require(_0x7b32('0x9'));var fs=require('fs');var fs_extra=require(_0x7b32('0xa'));var _=require(_0x7b32('0xb'));var squel=require(_0x7b32('0xc'));var crypto=require(_0x7b32('0xd'));var jsforce=require(_0x7b32('0xe'));var deskjs=require(_0x7b32('0xf'));var toCsv=require(_0x7b32('0x10'));var querystring=require(_0x7b32('0x11'));var Papa=require(_0x7b32('0x12'));var Redis=require(_0x7b32('0x13'));var authService=require(_0x7b32('0x14'));var qs=require(_0x7b32('0x15'));var as=require(_0x7b32('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b32('0x17'))(_0x7b32('0x18'));var utils=require(_0x7b32('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7b32('0x1a'))['db'];config[_0x7b32('0x1b')]=_[_0x7b32('0x1c')](config[_0x7b32('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b32('0x1b')]));require(_0x7b32('0x1d'))[_0x7b32('0x1e')](socket);function respondWithStatusCode(_0x1c38a7,_0x139e35){_0x139e35=_0x139e35||0xcc;return function(_0x1ebf46){if(_0x1ebf46){return _0x1c38a7['sendStatus'](_0x139e35);}return _0x1c38a7[_0x7b32('0x1f')](_0x139e35)['end']();};}function respondWithResult(_0x167830,_0x2e6395){_0x2e6395=_0x2e6395||0xc8;return function(_0x34f55c){if(_0x34f55c){return _0x167830[_0x7b32('0x1f')](_0x2e6395)[_0x7b32('0x20')](_0x34f55c);}};}function respondWithFilteredResult(_0x44d365,_0x58e767){return function(_0xc0659e){if(_0xc0659e){var _0xdfdcd5=typeof _0x58e767[_0x7b32('0x21')]===_0x7b32('0x22')&&typeof _0x58e767['limit']===_0x7b32('0x22');var _0x518747=_0xc0659e[_0x7b32('0x23')];var _0x5538c0=_0xdfdcd5?0x0:_0x58e767['offset'];var _0x52ee32=_0xdfdcd5?_0xc0659e[_0x7b32('0x23')]:_0x58e767[_0x7b32('0x21')]+_0x58e767[_0x7b32('0x24')];var _0x3d7797;if(_0x52ee32>=_0x518747){_0x52ee32=_0x518747;_0x3d7797=0xc8;}else{_0x3d7797=0xce;}_0x44d365[_0x7b32('0x1f')](_0x3d7797);return _0x44d365['set'](_0x7b32('0x25'),_0x5538c0+'-'+_0x52ee32+'/'+_0x518747)['json'](_0xc0659e);}return null;};}function patchUpdates(_0x381eb6){return function(_0x217667){try{jsonpatch[_0x7b32('0x26')](_0x217667,_0x381eb6,!![]);}catch(_0x55a4ea){return BPromise[_0x7b32('0x27')](_0x55a4ea);}return _0x217667[_0x7b32('0x28')]();};}function saveUpdates(_0x4a661a,_0x1157ae){return function(_0x35b3d8){if(_0x35b3d8){return _0x35b3d8[_0x7b32('0x29')](_0x4a661a)['then'](function(_0x269af4){return _0x269af4;});}return null;};}function removeEntity(_0x47ba08,_0x1196b0){return function(_0x5a9d82){if(_0x5a9d82){return _0x5a9d82[_0x7b32('0x2a')]()[_0x7b32('0x2b')](function(){_0x47ba08[_0x7b32('0x1f')](0xcc)[_0x7b32('0x2c')]();});}};}function handleEntityNotFound(_0x4b3c1c,_0x2d572f){return function(_0x566577){if(!_0x566577){_0x4b3c1c[_0x7b32('0x2d')](0x194);}return _0x566577;};}function handleError(_0x1dada9,_0x2c9a72){_0x2c9a72=_0x2c9a72||0x1f4;return function(_0x3169c){logger[_0x7b32('0x2e')](_0x3169c[_0x7b32('0x2f')]);if(_0x3169c[_0x7b32('0x30')]){delete _0x3169c['name'];}_0x1dada9['status'](_0x2c9a72)[_0x7b32('0x31')](_0x3169c);};}exports[_0x7b32('0x32')]=function(_0x846539,_0x474966){var _0xbc240a={},_0x4324fc={},_0x520c2e={'count':0x0,'rows':[]};var _0x5b093d=_[_0x7b32('0x33')](db['VoiceQueueReport'][_0x7b32('0x34')],function(_0x1c422b){return{'name':_0x1c422b[_0x7b32('0x35')],'type':_0x1c422b[_0x7b32('0x36')][_0x7b32('0x37')]};});_0x4324fc[_0x7b32('0x38')]=_[_0x7b32('0x33')](_0x5b093d,_0x7b32('0x30'));_0x4324fc[_0x7b32('0x39')]=_[_0x7b32('0x3a')](_0x846539[_0x7b32('0x39')]);_0x4324fc[_0x7b32('0x3b')]=_[_0x7b32('0x3c')](_0x4324fc[_0x7b32('0x38')],_0x4324fc[_0x7b32('0x39')]);_0xbc240a[_0x7b32('0x3d')]=_[_0x7b32('0x3c')](_0x4324fc[_0x7b32('0x38')],qs[_0x7b32('0x3e')](_0x846539['query'][_0x7b32('0x3e')]));_0xbc240a[_0x7b32('0x3d')]=_0xbc240a[_0x7b32('0x3d')][_0x7b32('0x3f')]?_0xbc240a[_0x7b32('0x3d')]:_0x4324fc['model'];if(!_0x846539[_0x7b32('0x39')]['hasOwnProperty'](_0x7b32('0x40'))){_0xbc240a[_0x7b32('0x24')]=qs[_0x7b32('0x24')](_0x846539[_0x7b32('0x39')][_0x7b32('0x24')]);_0xbc240a[_0x7b32('0x21')]=qs[_0x7b32('0x21')](_0x846539['query'][_0x7b32('0x21')]);}_0xbc240a[_0x7b32('0x41')]=qs[_0x7b32('0x42')](_0x846539['query']['sort']);_0xbc240a[_0x7b32('0x43')]=qs[_0x7b32('0x3b')](_['pick'](_0x846539[_0x7b32('0x39')],_0x4324fc['filters']),_0x5b093d);if(_0x846539[_0x7b32('0x39')][_0x7b32('0x44')]){_0xbc240a[_0x7b32('0x43')]=_[_0x7b32('0x45')](_0xbc240a[_0x7b32('0x43')],{'$or':_['map'](_0x5b093d,function(_0x4b82a3){if(_0x4b82a3['type']!=='VIRTUAL'){var _0xcdc45a={};_0xcdc45a[_0x4b82a3[_0x7b32('0x30')]]={'$like':'%'+_0x846539[_0x7b32('0x39')]['filter']+'%'};return _0xcdc45a;}})});}_0xbc240a=_[_0x7b32('0x45')]({},_0xbc240a,_0x846539['options']);var _0x3a05fa={'where':_0xbc240a[_0x7b32('0x43')]};return db[_0x7b32('0x46')][_0x7b32('0x23')](_0x3a05fa)['then'](function(_0x1ffff1){_0x520c2e['count']=_0x1ffff1;if(_0x846539['query'][_0x7b32('0x47')]){_0xbc240a['include']=[{'all':!![]}];}return db[_0x7b32('0x46')][_0x7b32('0x48')](_0xbc240a);})['then'](function(_0x2e18b2){_0x520c2e['rows']=_0x2e18b2;return _0x520c2e;})[_0x7b32('0x2b')](respondWithFilteredResult(_0x474966,_0xbc240a))[_0x7b32('0x49')](handleError(_0x474966,null));};exports[_0x7b32('0x4a')]=function(_0x5bf1cb,_0x31c4c9){var _0x42e028={'raw':![],'where':{'id':_0x5bf1cb[_0x7b32('0x4b')]['id']}},_0x1556c1={};_0x1556c1[_0x7b32('0x38')]=_[_0x7b32('0x3a')](db[_0x7b32('0x46')]['rawAttributes']);_0x1556c1[_0x7b32('0x39')]=_[_0x7b32('0x3a')](_0x5bf1cb[_0x7b32('0x39')]);_0x1556c1[_0x7b32('0x3b')]=_[_0x7b32('0x3c')](_0x1556c1[_0x7b32('0x38')],_0x1556c1[_0x7b32('0x39')]);_0x42e028['attributes']=_['intersection'](_0x1556c1[_0x7b32('0x38')],qs[_0x7b32('0x3e')](_0x5bf1cb[_0x7b32('0x39')]['fields']));_0x42e028[_0x7b32('0x3d')]=_0x42e028[_0x7b32('0x3d')][_0x7b32('0x3f')]?_0x42e028['attributes']:_0x1556c1['model'];if(_0x5bf1cb[_0x7b32('0x39')][_0x7b32('0x47')]){_0x42e028[_0x7b32('0x4c')]=[{'all':!![]}];}_0x42e028=_[_0x7b32('0x45')]({},_0x42e028,_0x5bf1cb['options']);return db[_0x7b32('0x46')]['find'](_0x42e028)[_0x7b32('0x2b')](handleEntityNotFound(_0x31c4c9,null))['then'](respondWithResult(_0x31c4c9,null))[_0x7b32('0x49')](handleError(_0x31c4c9,null));};exports['create']=function(_0x5150cd,_0x227427){return db[_0x7b32('0x46')][_0x7b32('0x4d')](_0x5150cd[_0x7b32('0x4e')],{})['then'](respondWithResult(_0x227427,0xc9))['catch'](handleError(_0x227427,null));};exports[_0x7b32('0x29')]=function(_0x15c142,_0x3b63fb){if(_0x15c142[_0x7b32('0x4e')]['id']){delete _0x15c142[_0x7b32('0x4e')]['id'];}return db[_0x7b32('0x46')]['find']({'where':{'id':_0x15c142[_0x7b32('0x4b')]['id']}})[_0x7b32('0x2b')](handleEntityNotFound(_0x3b63fb,null))[_0x7b32('0x2b')](saveUpdates(_0x15c142['body'],null))[_0x7b32('0x2b')](respondWithResult(_0x3b63fb,null))[_0x7b32('0x49')](handleError(_0x3b63fb,null));};exports['destroy']=function(_0x38089b,_0x1c465d){return db[_0x7b32('0x46')]['find']({'where':{'id':_0x38089b['params']['id']}})[_0x7b32('0x2b')](handleEntityNotFound(_0x1c465d,null))['then'](removeEntity(_0x1c465d,null))['catch'](handleError(_0x1c465d,null));};exports['describe']=function(_0x4541db,_0xc8f8b3){return db[_0x7b32('0x46')][_0x7b32('0x4f')]()[_0x7b32('0x2b')](respondWithResult(_0xc8f8b3,null))[_0x7b32('0x49')](handleError(_0xc8f8b3,null));};exports[_0x7b32('0x50')]=function(_0x31bc2f,_0x1e4b21){var _0x5e9568={},_0x2453b3={},_0x363504={'count':0x0,'rows':[]};_0x2453b3['model']=_[_0x7b32('0x3a')](db[_0x7b32('0x46')][_0x7b32('0x34')]);_0x2453b3[_0x7b32('0x39')]=_[_0x7b32('0x3a')](_0x31bc2f[_0x7b32('0x39')]);_0x2453b3[_0x7b32('0x3b')]=_['intersection'](_0x2453b3['model'],_0x2453b3[_0x7b32('0x39')]);_0x5e9568['attributes']=_['intersection'](_0x2453b3[_0x7b32('0x38')],qs['fields'](_0x31bc2f['query'][_0x7b32('0x3e')]));_0x5e9568[_0x7b32('0x3d')]=_0x5e9568['attributes'][_0x7b32('0x3f')]?_0x5e9568[_0x7b32('0x3d')]:_0x2453b3[_0x7b32('0x38')];if(!_0x31bc2f[_0x7b32('0x39')][_0x7b32('0x51')]('nolimit')){_0x5e9568[_0x7b32('0x24')]=qs['limit'](_0x31bc2f[_0x7b32('0x39')][_0x7b32('0x24')]);_0x5e9568[_0x7b32('0x21')]=qs[_0x7b32('0x21')](_0x31bc2f[_0x7b32('0x39')][_0x7b32('0x21')]);}_0x5e9568['order']=qs[_0x7b32('0x42')](_0x31bc2f['query']['sort']);_0x5e9568[_0x7b32('0x43')]=qs[_0x7b32('0x3b')](_[_0x7b32('0x52')](_0x31bc2f[_0x7b32('0x39')],_0x2453b3['filters']));if(_0x31bc2f[_0x7b32('0x39')][_0x7b32('0x44')]){_0x5e9568['where']=_[_0x7b32('0x45')](_0x5e9568[_0x7b32('0x43')],{'$or':_['map'](_0x5e9568[_0x7b32('0x3d')],function(_0x175ee8){var _0x4b0de0={};_0x4b0de0[_0x175ee8]={'$like':'%'+_0x31bc2f[_0x7b32('0x39')][_0x7b32('0x44')]+'%'};return _0x4b0de0;})});}_0x5e9568=_[_0x7b32('0x45')]({},_0x5e9568,_0x31bc2f['options']);var _0xf500cf={'where':_0x5e9568[_0x7b32('0x43')]};return db[_0x7b32('0x46')][_0x7b32('0x23')](_0xf500cf)[_0x7b32('0x2b')](function(_0x3a7680){_0x363504['count']=_0x3a7680;if(_0x31bc2f[_0x7b32('0x39')]['includeAll']){_0x5e9568['include']=[{'all':!![]}];}return db[_0x7b32('0x46')][_0x7b32('0x48')](_0x5e9568);})[_0x7b32('0x2b')](function(_0x19ca06){_0x363504[_0x7b32('0x53')]=_0x19ca06;return _0x363504;})[_0x7b32('0x2b')](respondWithFilteredResult(_0x1e4b21,_0x5e9568,'getVoiceQueuesReport'))[_0x7b32('0x49')](handleError(_0x1e4b21,null,_0x7b32('0x50')));}; \ No newline at end of file +var _0x4a5e=['hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','fields','includeAll','find','create','body','describe','getVoiceQueuesReport','order','eml-format','zip-dir','fast-json-patch','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/license/hardware','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4a5e,0x1c1));var _0xe4a5=function(_0x4c4a8b,_0x402020){_0x4c4a8b=_0x4c4a8b-0x0;var _0x20fa14=_0x4a5e[_0x4c4a8b];return _0x20fa14;};'use strict';var emlformat=require(_0xe4a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4a5('0x1'));var jsonpatch=require(_0xe4a5('0x2'));var rp=require('request-promise');var moment=require(_0xe4a5('0x3'));var BPromise=require(_0xe4a5('0x4'));var Mustache=require(_0xe4a5('0x5'));var util=require(_0xe4a5('0x6'));var path=require(_0xe4a5('0x7'));var sox=require(_0xe4a5('0x8'));var csv=require(_0xe4a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4a5('0xa'));var _=require(_0xe4a5('0xb'));var squel=require(_0xe4a5('0xc'));var crypto=require(_0xe4a5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe4a5('0xe'));var toCsv=require(_0xe4a5('0x9'));var querystring=require(_0xe4a5('0xf'));var Papa=require(_0xe4a5('0x10'));var Redis=require(_0xe4a5('0x11'));var authService=require(_0xe4a5('0x12'));var qs=require(_0xe4a5('0x13'));var as=require(_0xe4a5('0x14'));var hardwareService=require(_0xe4a5('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe4a5('0x16'));var db=require(_0xe4a5('0x17'))['db'];config['redis']=_[_0xe4a5('0x18')](config[_0xe4a5('0x19')],{'host':_0xe4a5('0x1a'),'port':0x18eb});var socket=require(_0xe4a5('0x1b'))(new Redis(config[_0xe4a5('0x19')]));require(_0xe4a5('0x1c'))[_0xe4a5('0x1d')](socket);function respondWithStatusCode(_0x9f018f,_0x56730e){_0x56730e=_0x56730e||0xcc;return function(_0xf61105){if(_0xf61105){return _0x9f018f[_0xe4a5('0x1e')](_0x56730e);}return _0x9f018f[_0xe4a5('0x1f')](_0x56730e)[_0xe4a5('0x20')]();};}function respondWithResult(_0x777c4e,_0x8146e2){_0x8146e2=_0x8146e2||0xc8;return function(_0x37a3ae){if(_0x37a3ae){return _0x777c4e[_0xe4a5('0x1f')](_0x8146e2)['json'](_0x37a3ae);}};}function respondWithFilteredResult(_0x3104be,_0x7db340){return function(_0x1886b2){if(_0x1886b2){var _0x3b04bf=typeof _0x7db340[_0xe4a5('0x21')]===_0xe4a5('0x22')&&typeof _0x7db340[_0xe4a5('0x23')]===_0xe4a5('0x22');var _0x591d14=_0x1886b2[_0xe4a5('0x24')];var _0x456d2d=_0x3b04bf?0x0:_0x7db340[_0xe4a5('0x21')];var _0x25594f=_0x3b04bf?_0x1886b2[_0xe4a5('0x24')]:_0x7db340[_0xe4a5('0x21')]+_0x7db340[_0xe4a5('0x23')];var _0x56c39e;if(_0x25594f>=_0x591d14){_0x25594f=_0x591d14;_0x56c39e=0xc8;}else{_0x56c39e=0xce;}_0x3104be[_0xe4a5('0x1f')](_0x56c39e);return _0x3104be[_0xe4a5('0x25')](_0xe4a5('0x26'),_0x456d2d+'-'+_0x25594f+'/'+_0x591d14)[_0xe4a5('0x27')](_0x1886b2);}return null;};}function patchUpdates(_0x471490){return function(_0x3d6034){try{jsonpatch['apply'](_0x3d6034,_0x471490,!![]);}catch(_0x520fc2){return BPromise[_0xe4a5('0x28')](_0x520fc2);}return _0x3d6034[_0xe4a5('0x29')]();};}function saveUpdates(_0x355948,_0x17a09c){return function(_0x2fcd57){if(_0x2fcd57){return _0x2fcd57[_0xe4a5('0x2a')](_0x355948)[_0xe4a5('0x2b')](function(_0x376300){return _0x376300;});}return null;};}function removeEntity(_0xec2f37,_0x5ac0c6){return function(_0x5a1e7b){if(_0x5a1e7b){return _0x5a1e7b[_0xe4a5('0x2c')]()['then'](function(){_0xec2f37[_0xe4a5('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fbb02,_0xd273c1){return function(_0x148dbd){if(!_0x148dbd){_0x2fbb02[_0xe4a5('0x1e')](0x194);}return _0x148dbd;};}function handleError(_0x27307a,_0xd5db7b){_0xd5db7b=_0xd5db7b||0x1f4;return function(_0x5b8f56){logger[_0xe4a5('0x2d')](_0x5b8f56[_0xe4a5('0x2e')]);if(_0x5b8f56['name']){delete _0x5b8f56[_0xe4a5('0x2f')];}_0x27307a[_0xe4a5('0x1f')](_0xd5db7b)[_0xe4a5('0x30')](_0x5b8f56);};}exports[_0xe4a5('0x31')]=function(_0x4744ed,_0x955bd5){var _0x33690a={},_0x30ad00={},_0x33be67={'count':0x0,'rows':[]};var _0x8bef10=_[_0xe4a5('0x32')](db[_0xe4a5('0x33')][_0xe4a5('0x34')],function(_0x5745c7){return{'name':_0x5745c7[_0xe4a5('0x35')],'type':_0x5745c7[_0xe4a5('0x36')][_0xe4a5('0x37')]};});_0x30ad00[_0xe4a5('0x38')]=_[_0xe4a5('0x32')](_0x8bef10,_0xe4a5('0x2f'));_0x30ad00[_0xe4a5('0x39')]=_['keys'](_0x4744ed[_0xe4a5('0x39')]);_0x30ad00['filters']=_['intersection'](_0x30ad00[_0xe4a5('0x38')],_0x30ad00['query']);_0x33690a['attributes']=_[_0xe4a5('0x3a')](_0x30ad00[_0xe4a5('0x38')],qs['fields'](_0x4744ed['query']['fields']));_0x33690a[_0xe4a5('0x3b')]=_0x33690a['attributes'][_0xe4a5('0x3c')]?_0x33690a['attributes']:_0x30ad00['model'];if(!_0x4744ed[_0xe4a5('0x39')][_0xe4a5('0x3d')](_0xe4a5('0x3e'))){_0x33690a['limit']=qs[_0xe4a5('0x23')](_0x4744ed[_0xe4a5('0x39')]['limit']);_0x33690a['offset']=qs[_0xe4a5('0x21')](_0x4744ed[_0xe4a5('0x39')][_0xe4a5('0x21')]);}_0x33690a['order']=qs[_0xe4a5('0x3f')](_0x4744ed[_0xe4a5('0x39')][_0xe4a5('0x3f')]);_0x33690a[_0xe4a5('0x40')]=qs['filters'](_[_0xe4a5('0x41')](_0x4744ed['query'],_0x30ad00[_0xe4a5('0x42')]),_0x8bef10);if(_0x4744ed[_0xe4a5('0x39')][_0xe4a5('0x43')]){_0x33690a[_0xe4a5('0x40')]=_[_0xe4a5('0x44')](_0x33690a['where'],{'$or':_[_0xe4a5('0x32')](_0x8bef10,function(_0x3beb2b){if(_0x3beb2b[_0xe4a5('0x36')]!==_0xe4a5('0x45')){var _0x37adcb={};_0x37adcb[_0x3beb2b[_0xe4a5('0x2f')]]={'$like':'%'+_0x4744ed[_0xe4a5('0x39')][_0xe4a5('0x43')]+'%'};return _0x37adcb;}})});}_0x33690a=_[_0xe4a5('0x44')]({},_0x33690a,_0x4744ed[_0xe4a5('0x46')]);var _0xa83884={'where':_0x33690a[_0xe4a5('0x40')]};return db[_0xe4a5('0x33')]['count'](_0xa83884)['then'](function(_0x15660c){_0x33be67['count']=_0x15660c;if(_0x4744ed[_0xe4a5('0x39')]['includeAll']){_0x33690a[_0xe4a5('0x47')]=[{'all':!![]}];}return db[_0xe4a5('0x33')][_0xe4a5('0x48')](_0x33690a);})['then'](function(_0x13e464){_0x33be67[_0xe4a5('0x49')]=_0x13e464;return _0x33be67;})[_0xe4a5('0x2b')](respondWithFilteredResult(_0x955bd5,_0x33690a))[_0xe4a5('0x4a')](handleError(_0x955bd5,null));};exports['show']=function(_0x479d4d,_0x440ae4){var _0xaf650a={'raw':![],'where':{'id':_0x479d4d[_0xe4a5('0x4b')]['id']}},_0x53fa97={};_0x53fa97[_0xe4a5('0x38')]=_['keys'](db['VoiceQueueReport'][_0xe4a5('0x34')]);_0x53fa97[_0xe4a5('0x39')]=_[_0xe4a5('0x4c')](_0x479d4d['query']);_0x53fa97[_0xe4a5('0x42')]=_[_0xe4a5('0x3a')](_0x53fa97[_0xe4a5('0x38')],_0x53fa97[_0xe4a5('0x39')]);_0xaf650a[_0xe4a5('0x3b')]=_[_0xe4a5('0x3a')](_0x53fa97[_0xe4a5('0x38')],qs[_0xe4a5('0x4d')](_0x479d4d[_0xe4a5('0x39')]['fields']));_0xaf650a[_0xe4a5('0x3b')]=_0xaf650a[_0xe4a5('0x3b')][_0xe4a5('0x3c')]?_0xaf650a['attributes']:_0x53fa97[_0xe4a5('0x38')];if(_0x479d4d[_0xe4a5('0x39')][_0xe4a5('0x4e')]){_0xaf650a[_0xe4a5('0x47')]=[{'all':!![]}];}_0xaf650a=_[_0xe4a5('0x44')]({},_0xaf650a,_0x479d4d[_0xe4a5('0x46')]);return db[_0xe4a5('0x33')][_0xe4a5('0x4f')](_0xaf650a)[_0xe4a5('0x2b')](handleEntityNotFound(_0x440ae4,null))[_0xe4a5('0x2b')](respondWithResult(_0x440ae4,null))[_0xe4a5('0x4a')](handleError(_0x440ae4,null));};exports[_0xe4a5('0x50')]=function(_0x136423,_0x137be7){return db[_0xe4a5('0x33')]['create'](_0x136423[_0xe4a5('0x51')],{})[_0xe4a5('0x2b')](respondWithResult(_0x137be7,0xc9))[_0xe4a5('0x4a')](handleError(_0x137be7,null));};exports[_0xe4a5('0x2a')]=function(_0x8a1c5e,_0x34ef56){if(_0x8a1c5e['body']['id']){delete _0x8a1c5e[_0xe4a5('0x51')]['id'];}return db[_0xe4a5('0x33')]['find']({'where':{'id':_0x8a1c5e['params']['id']}})[_0xe4a5('0x2b')](handleEntityNotFound(_0x34ef56,null))[_0xe4a5('0x2b')](saveUpdates(_0x8a1c5e['body'],null))[_0xe4a5('0x2b')](respondWithResult(_0x34ef56,null))[_0xe4a5('0x4a')](handleError(_0x34ef56,null));};exports[_0xe4a5('0x2c')]=function(_0x253add,_0x30bd6f){return db['VoiceQueueReport']['find']({'where':{'id':_0x253add['params']['id']}})[_0xe4a5('0x2b')](handleEntityNotFound(_0x30bd6f,null))[_0xe4a5('0x2b')](removeEntity(_0x30bd6f,null))[_0xe4a5('0x4a')](handleError(_0x30bd6f,null));};exports[_0xe4a5('0x52')]=function(_0x4048ff,_0x27d88e){return db[_0xe4a5('0x33')]['describe']()[_0xe4a5('0x2b')](respondWithResult(_0x27d88e,null))['catch'](handleError(_0x27d88e,null));};exports[_0xe4a5('0x53')]=function(_0x5a06f3,_0x1f3a50){var _0x3fd3ee={},_0x383e62={},_0x577d66={'count':0x0,'rows':[]};_0x383e62[_0xe4a5('0x38')]=_[_0xe4a5('0x4c')](db[_0xe4a5('0x33')][_0xe4a5('0x34')]);_0x383e62[_0xe4a5('0x39')]=_[_0xe4a5('0x4c')](_0x5a06f3[_0xe4a5('0x39')]);_0x383e62[_0xe4a5('0x42')]=_[_0xe4a5('0x3a')](_0x383e62[_0xe4a5('0x38')],_0x383e62[_0xe4a5('0x39')]);_0x3fd3ee['attributes']=_[_0xe4a5('0x3a')](_0x383e62[_0xe4a5('0x38')],qs[_0xe4a5('0x4d')](_0x5a06f3[_0xe4a5('0x39')][_0xe4a5('0x4d')]));_0x3fd3ee[_0xe4a5('0x3b')]=_0x3fd3ee[_0xe4a5('0x3b')][_0xe4a5('0x3c')]?_0x3fd3ee[_0xe4a5('0x3b')]:_0x383e62[_0xe4a5('0x38')];if(!_0x5a06f3['query'][_0xe4a5('0x3d')](_0xe4a5('0x3e'))){_0x3fd3ee[_0xe4a5('0x23')]=qs[_0xe4a5('0x23')](_0x5a06f3[_0xe4a5('0x39')][_0xe4a5('0x23')]);_0x3fd3ee[_0xe4a5('0x21')]=qs[_0xe4a5('0x21')](_0x5a06f3[_0xe4a5('0x39')][_0xe4a5('0x21')]);}_0x3fd3ee[_0xe4a5('0x54')]=qs[_0xe4a5('0x3f')](_0x5a06f3[_0xe4a5('0x39')][_0xe4a5('0x3f')]);_0x3fd3ee[_0xe4a5('0x40')]=qs[_0xe4a5('0x42')](_[_0xe4a5('0x41')](_0x5a06f3[_0xe4a5('0x39')],_0x383e62[_0xe4a5('0x42')]));if(_0x5a06f3[_0xe4a5('0x39')][_0xe4a5('0x43')]){_0x3fd3ee[_0xe4a5('0x40')]=_['merge'](_0x3fd3ee[_0xe4a5('0x40')],{'$or':_[_0xe4a5('0x32')](_0x3fd3ee[_0xe4a5('0x3b')],function(_0x3cf6bd){var _0x211302={};_0x211302[_0x3cf6bd]={'$like':'%'+_0x5a06f3[_0xe4a5('0x39')][_0xe4a5('0x43')]+'%'};return _0x211302;})});}_0x3fd3ee=_[_0xe4a5('0x44')]({},_0x3fd3ee,_0x5a06f3['options']);var _0x1415a4={'where':_0x3fd3ee[_0xe4a5('0x40')]};return db[_0xe4a5('0x33')]['count'](_0x1415a4)[_0xe4a5('0x2b')](function(_0x2a4539){_0x577d66[_0xe4a5('0x24')]=_0x2a4539;if(_0x5a06f3[_0xe4a5('0x39')][_0xe4a5('0x4e')]){_0x3fd3ee['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xe4a5('0x48')](_0x3fd3ee);})[_0xe4a5('0x2b')](function(_0x333309){_0x577d66[_0xe4a5('0x49')]=_0x333309;return _0x577d66;})['then'](respondWithFilteredResult(_0x1f3a50,_0x3fd3ee,_0xe4a5('0x53')))[_0xe4a5('0x4a')](handleError(_0x1f3a50,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 6b7160e..bbd465c 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 _0x2441=['hasOwnProperty','hook','exports','events','VoiceQueueReport','save','update','remove','emit'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x2441,0xae));var _0x1244=function(_0x2d9349,_0x3f6837){_0x2d9349=_0x2d9349-0x0;var _0x5e149b=_0x2441[_0x2d9349];return _0x5e149b;};'use strict';var EventEmitter=require(_0x1244('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x1244('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1244('0x2'),'afterUpdate':_0x1244('0x3'),'afterDestroy':_0x1244('0x4')};function emitEvent(_0x3fd6c8){return function(_0xf7712d,_0x9921e7,_0x514781){VoiceQueueReportEvents[_0x1244('0x5')](_0x3fd6c8+':'+_0xf7712d['id'],_0xf7712d);VoiceQueueReportEvents[_0x1244('0x5')](_0x3fd6c8,_0xf7712d);_0x514781(null);};}for(var e in events){if(events[_0x1244('0x6')](e)){var event=events[e];VoiceQueueReport[_0x1244('0x7')](e,emitEvent(event));}}module[_0x1244('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xf295=['setMaxListeners','remove','hook','events','../../mysqldb'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf295,0x12a));var _0x5f29=function(_0x5cad77,_0x184741){_0x5cad77=_0x5cad77-0x0;var _0x58bbc4=_0xf295[_0x5cad77];return _0x58bbc4;};'use strict';var EventEmitter=require(_0x5f29('0x0'));var VoiceQueueReport=require(_0x5f29('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x5f29('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5f29('0x3')};function emitEvent(_0x23709c){return function(_0x1fe2fc,_0x71b445,_0x58cc8d){VoiceQueueReportEvents['emit'](_0x23709c+':'+_0x1fe2fc['id'],_0x1fe2fc);VoiceQueueReportEvents['emit'](_0x23709c,_0x1fe2fc);_0x58cc8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x5f29('0x4')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index b03a05b..07652be 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 _0x823d=['moment','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger'];(function(_0x36f4be,_0x5c4784){var _0x102cb4=function(_0x24f51f){while(--_0x24f51f){_0x36f4be['push'](_0x36f4be['shift']());}};_0x102cb4(++_0x5c4784);}(_0x823d,0x166));var _0xd823=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x823d[_0x55c1f0];return _0x1530fa;};'use strict';var _=require('lodash');var util=require(_0xd823('0x0'));var logger=require(_0xd823('0x1'))('api');var moment=require(_0xd823('0x2'));var BPromise=require(_0xd823('0x3'));var rp=require(_0xd823('0x4'));var fs=require('fs');var path=require(_0xd823('0x5'));var rimraf=require(_0xd823('0x6'));var config=require('../../config/environment');var attributes=require(_0xd823('0x7'));module['exports']=function(_0x5f2875,_0x5d5ad0){return _0x5f2875['define'](_0xd823('0x8'),attributes,{'tableName':_0xd823('0x9'),'paranoid':![],'indexes':[{'fields':[_0xd823('0xa')]},{'fields':[_0xd823('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a8b=['calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueueReport'];(function(_0x489a71,_0xb29047){var _0xaf28ac=function(_0x32b3dc){while(--_0x32b3dc){_0x489a71['push'](_0x489a71['shift']());}};_0xaf28ac(++_0xb29047);}(_0x5a8b,0x16d));var _0xb5a8=function(_0x1975a4,_0x278f3c){_0x1975a4=_0x1975a4-0x0;var _0x2c1651=_0x5a8b[_0x1975a4];return _0x2c1651;};'use strict';var _=require('lodash');var util=require(_0xb5a8('0x0'));var logger=require(_0xb5a8('0x1'))(_0xb5a8('0x2'));var moment=require(_0xb5a8('0x3'));var BPromise=require(_0xb5a8('0x4'));var rp=require(_0xb5a8('0x5'));var fs=require('fs');var path=require(_0xb5a8('0x6'));var rimraf=require(_0xb5a8('0x7'));var config=require(_0xb5a8('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0xb5a8('0x9')]=function(_0x1c104c,_0x1b46d3){return _0x1c104c[_0xb5a8('0xa')](_0xb5a8('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xb5a8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 0f51730..6bfd7af 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 _0x5952=['CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','findAll','options','raw','where','limit','include','attributes','map','model','then','GetVoiceQueueReport'];(function(_0x25060e,_0x4bfedd){var _0x318f58=function(_0x5ebb3d){while(--_0x5ebb3d){_0x25060e['push'](_0x25060e['shift']());}};_0x318f58(++_0x4bfedd);}(_0x5952,0x8b));var _0x2595=function(_0x34f6b3,_0x253355){_0x34f6b3=_0x34f6b3-0x0;var _0x4f0e52=_0x5952[_0x34f6b3];return _0x4f0e52;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2595('0x0'));var BPromise=require(_0x2595('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2595('0x2'));var db=require(_0x2595('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2595('0x4'))(_0x2595('0x5'));var config=require('../../config/environment');var jayson=require(_0x2595('0x6'));var client=jayson[_0x2595('0x7')][_0x2595('0x8')]({'port':0x232a});config[_0x2595('0x9')]=_[_0x2595('0xa')](config[_0x2595('0x9')],{'host':_0x2595('0xb'),'port':0x18eb});var socket=require(_0x2595('0xc'))(new Redis(config['redis']));require(_0x2595('0xd'))[_0x2595('0xe')](socket);function respondWithRpcPromise(_0x1dcb1c,_0x743785,_0x424ea9){return new BPromise(function(_0x113759,_0x309e95){return client[_0x2595('0xf')](_0x1dcb1c,_0x424ea9)['then'](function(_0x201a79){logger[_0x2595('0x10')](_0x2595('0x11'),_0x743785,'request\x20sent');logger[_0x2595('0x12')](_0x2595('0x13'),_0x743785,'request\x20sent',JSON[_0x2595('0x14')](_0x201a79));if(_0x201a79[_0x2595('0x15')]){if(_0x201a79[_0x2595('0x15')][_0x2595('0x16')]===0x1f4){logger[_0x2595('0x15')](_0x2595('0x11'),_0x743785,_0x201a79[_0x2595('0x15')][_0x2595('0x17')]);return _0x309e95(_0x201a79[_0x2595('0x15')][_0x2595('0x17')]);}logger[_0x2595('0x15')](_0x2595('0x11'),_0x743785,_0x201a79['error'][_0x2595('0x17')]);return _0x113759(_0x201a79[_0x2595('0x15')][_0x2595('0x17')]);}else{logger[_0x2595('0x10')](_0x2595('0x11'),_0x743785,_0x2595('0x18'));_0x113759(_0x201a79[_0x2595('0x19')][_0x2595('0x17')]);}})['catch'](function(_0x33146c){logger[_0x2595('0x15')](_0x2595('0x11'),_0x743785,_0x33146c);_0x309e95(_0x33146c);});});}exports['GetVoiceQueueReport']=function(_0x16f458){var _0x30aa01=this;return new Promise(function(_0x21d362,_0x324b21){return db['VoiceQueueReport'][_0x2595('0x1a')]({'raw':_0x16f458[_0x2595('0x1b')]?_0x16f458[_0x2595('0x1b')][_0x2595('0x1c')]===undefined?!![]:![]:!![],'where':_0x16f458['options']?_0x16f458[_0x2595('0x1b')][_0x2595('0x1d')]||null:null,'attributes':_0x16f458[_0x2595('0x1b')]?_0x16f458[_0x2595('0x1b')]['attributes']||null:null,'limit':_0x16f458[_0x2595('0x1b')]?_0x16f458[_0x2595('0x1b')][_0x2595('0x1e')]||null:null,'include':_0x16f458[_0x2595('0x1b')]?_0x16f458[_0x2595('0x1b')][_0x2595('0x1f')]?_['map'](_0x16f458[_0x2595('0x1b')][_0x2595('0x1f')],function(_0x2dad27){return{'model':db[_0x2dad27['model']],'as':_0x2dad27['as'],'attributes':_0x2dad27[_0x2595('0x20')],'include':_0x2dad27['include']?_[_0x2595('0x21')](_0x2dad27[_0x2595('0x1f')],function(_0x24b585){return{'model':db[_0x24b585[_0x2595('0x22')]],'as':_0x24b585['as'],'attributes':_0x24b585[_0x2595('0x20')],'include':_0x24b585[_0x2595('0x1f')]?_[_0x2595('0x21')](_0x24b585['include'],function(_0x141f14){return{'model':db[_0x141f14[_0x2595('0x22')]],'as':_0x141f14['as'],'attributes':_0x141f14[_0x2595('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2595('0x23')](function(_0x22869e){logger[_0x2595('0x10')](_0x2595('0x24'),_0x16f458);logger[_0x2595('0x12')](_0x2595('0x24'),_0x16f458,JSON[_0x2595('0x14')](_0x22869e));_0x21d362(_0x22869e);})['catch'](function(_0x106b38){logger[_0x2595('0x15')](_0x2595('0x24'),_0x106b38[_0x2595('0x17')],_0x16f458);_0x324b21(_0x30aa01[_0x2595('0x15')](0x1f4,_0x106b38[_0x2595('0x17')]));});});};exports[_0x2595('0x25')]=function(_0x4be8e8){var _0x1adec1=this;return new Promise(function(_0x2db77e,_0x30b75a){return db[_0x2595('0x26')][_0x2595('0x27')](_0x4be8e8[_0x2595('0x28')],{'raw':_0x4be8e8[_0x2595('0x1b')]?_0x4be8e8[_0x2595('0x1b')][_0x2595('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x26cad3){logger[_0x2595('0x10')](_0x2595('0x25'),_0x4be8e8);logger[_0x2595('0x12')](_0x2595('0x25'),_0x4be8e8,JSON['stringify'](_0x26cad3));_0x2db77e(_0x26cad3);})['catch'](function(_0x2120c8){logger[_0x2595('0x15')](_0x2595('0x25'),_0x2120c8[_0x2595('0x17')],_0x4be8e8);_0x30b75a(_0x1adec1['error'](0x1f4,_0x2120c8['message']));});});};exports[_0x2595('0x29')]=function(_0x5be546){var _0x5a88e2=this;return new Promise(function(_0x5ade42,_0x11c7ed){return db[_0x2595('0x26')][_0x2595('0x2a')](_0x5be546[_0x2595('0x28')],{'raw':_0x5be546[_0x2595('0x1b')]?_0x5be546[_0x2595('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5be546[_0x2595('0x1b')]?_0x5be546[_0x2595('0x1b')]['where']||null:null,'attributes':_0x5be546['options']?_0x5be546['options']['attributes']||null:null,'limit':_0x5be546[_0x2595('0x1b')]?_0x5be546[_0x2595('0x1b')][_0x2595('0x1e')]||null:null})[_0x2595('0x23')](function(_0x1ddd70){logger['info']('UpdateVoiceQueueReport',_0x5be546);logger[_0x2595('0x12')](_0x2595('0x29'),_0x5be546,JSON['stringify'](_0x1ddd70));_0x5ade42(_0x1ddd70);})[_0x2595('0x2b')](function(_0x56a4f0){logger[_0x2595('0x15')](_0x2595('0x29'),_0x56a4f0[_0x2595('0x17')],_0x5be546);_0x11c7ed(_0x5a88e2[_0x2595('0x15')](0x1f4,_0x56a4f0[_0x2595('0x17')]));});});}; \ No newline at end of file +var _0x35ac=['CreateVoiceQueueReport','create','raw','UpdateVoiceQueueReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','request\x20sent','debug','error','code','VoiceQueueReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','model','map','stringify'];(function(_0x1c8e50,_0x519d58){var _0x3c402d=function(_0x476aff){while(--_0x476aff){_0x1c8e50['push'](_0x1c8e50['shift']());}};_0x3c402d(++_0x519d58);}(_0x35ac,0x1c8));var _0xc35a=function(_0xa63df9,_0x3d91ed){_0xa63df9=_0xa63df9-0x0;var _0x3428ff=_0x35ac[_0xa63df9];return _0x3428ff;};'use strict';var _=require(_0xc35a('0x0'));var util=require(_0xc35a('0x1'));var moment=require(_0xc35a('0x2'));var BPromise=require(_0xc35a('0x3'));var rs=require(_0xc35a('0x4'));var fs=require('fs');var Redis=require(_0xc35a('0x5'));var db=require(_0xc35a('0x6'))['db'];var utils=require(_0xc35a('0x7'));var logger=require('../../config/logger')(_0xc35a('0x8'));var config=require(_0xc35a('0x9'));var jayson=require(_0xc35a('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xc35a('0xb')]=_[_0xc35a('0xc')](config[_0xc35a('0xb')],{'host':_0xc35a('0xd'),'port':0x18eb});var socket=require(_0xc35a('0xe'))(new Redis(config['redis']));require(_0xc35a('0xf'))[_0xc35a('0x10')](socket);function respondWithRpcPromise(_0x260f60,_0x5334a9,_0x2245f1){return new BPromise(function(_0x454711,_0x45b0fd){return client[_0xc35a('0x11')](_0x260f60,_0x2245f1)[_0xc35a('0x12')](function(_0x17e9bb){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x5334a9,_0xc35a('0x13'));logger[_0xc35a('0x14')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x5334a9,'request\x20sent',JSON['stringify'](_0x17e9bb));if(_0x17e9bb['error']){if(_0x17e9bb[_0xc35a('0x15')][_0xc35a('0x16')]===0x1f4){logger[_0xc35a('0x15')](_0xc35a('0x17'),_0x5334a9,_0x17e9bb[_0xc35a('0x15')][_0xc35a('0x18')]);return _0x45b0fd(_0x17e9bb[_0xc35a('0x15')][_0xc35a('0x18')]);}logger[_0xc35a('0x15')](_0xc35a('0x17'),_0x5334a9,_0x17e9bb[_0xc35a('0x15')][_0xc35a('0x18')]);return _0x454711(_0x17e9bb[_0xc35a('0x15')][_0xc35a('0x18')]);}else{logger[_0xc35a('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x5334a9,'request\x20sent');_0x454711(_0x17e9bb[_0xc35a('0x1a')][_0xc35a('0x18')]);}})[_0xc35a('0x1b')](function(_0x4590bd){logger['error'](_0xc35a('0x17'),_0x5334a9,_0x4590bd);_0x45b0fd(_0x4590bd);});});}exports[_0xc35a('0x1c')]=function(_0x1b7712){var _0x33a226=this;return new Promise(function(_0x2744e0,_0x56d353){return db[_0xc35a('0x1d')][_0xc35a('0x1e')]({'raw':_0x1b7712['options']?_0x1b7712['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b7712['options']?_0x1b7712[_0xc35a('0x1f')][_0xc35a('0x20')]||null:null,'attributes':_0x1b7712[_0xc35a('0x1f')]?_0x1b7712[_0xc35a('0x1f')][_0xc35a('0x21')]||null:null,'limit':_0x1b7712[_0xc35a('0x1f')]?_0x1b7712[_0xc35a('0x1f')][_0xc35a('0x22')]||null:null,'include':_0x1b7712[_0xc35a('0x1f')]?_0x1b7712['options'][_0xc35a('0x23')]?_['map'](_0x1b7712[_0xc35a('0x1f')][_0xc35a('0x23')],function(_0x5c9ab4){return{'model':db[_0x5c9ab4[_0xc35a('0x24')]],'as':_0x5c9ab4['as'],'attributes':_0x5c9ab4[_0xc35a('0x21')],'include':_0x5c9ab4[_0xc35a('0x23')]?_[_0xc35a('0x25')](_0x5c9ab4[_0xc35a('0x23')],function(_0x575da9){return{'model':db[_0x575da9[_0xc35a('0x24')]],'as':_0x575da9['as'],'attributes':_0x575da9['attributes'],'include':_0x575da9[_0xc35a('0x23')]?_[_0xc35a('0x25')](_0x575da9['include'],function(_0x4c0427){return{'model':db[_0x4c0427[_0xc35a('0x24')]],'as':_0x4c0427['as'],'attributes':_0x4c0427['attributes']};}):[]};}):[]};}):[]:[]})[_0xc35a('0x12')](function(_0x26990c){logger[_0xc35a('0x19')](_0xc35a('0x1c'),_0x1b7712);logger[_0xc35a('0x14')](_0xc35a('0x1c'),_0x1b7712,JSON[_0xc35a('0x26')](_0x26990c));_0x2744e0(_0x26990c);})[_0xc35a('0x1b')](function(_0x38a992){logger[_0xc35a('0x15')](_0xc35a('0x1c'),_0x38a992['message'],_0x1b7712);_0x56d353(_0x33a226['error'](0x1f4,_0x38a992[_0xc35a('0x18')]));});});};exports[_0xc35a('0x27')]=function(_0xa55716){var _0x11ee8d=this;return new Promise(function(_0x2b4735,_0x5a5202){return db[_0xc35a('0x1d')][_0xc35a('0x28')](_0xa55716['body'],{'raw':_0xa55716[_0xc35a('0x1f')]?_0xa55716[_0xc35a('0x1f')][_0xc35a('0x29')]===undefined?!![]:![]:!![]})[_0xc35a('0x12')](function(_0x610bf0){logger[_0xc35a('0x19')](_0xc35a('0x27'),_0xa55716);logger[_0xc35a('0x14')]('CreateVoiceQueueReport',_0xa55716,JSON[_0xc35a('0x26')](_0x610bf0));_0x2b4735(_0x610bf0);})[_0xc35a('0x1b')](function(_0x1572a3){logger[_0xc35a('0x15')](_0xc35a('0x27'),_0x1572a3[_0xc35a('0x18')],_0xa55716);_0x5a5202(_0x11ee8d[_0xc35a('0x15')](0x1f4,_0x1572a3['message']));});});};exports[_0xc35a('0x2a')]=function(_0x5d3180){var _0x540919=this;return new Promise(function(_0x331f19,_0x132958){return db[_0xc35a('0x1d')][_0xc35a('0x2b')](_0x5d3180[_0xc35a('0x2c')],{'raw':_0x5d3180[_0xc35a('0x1f')]?_0x5d3180['options'][_0xc35a('0x29')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d3180['options']?_0x5d3180[_0xc35a('0x1f')][_0xc35a('0x20')]||null:null,'attributes':_0x5d3180['options']?_0x5d3180[_0xc35a('0x1f')][_0xc35a('0x21')]||null:null,'limit':_0x5d3180[_0xc35a('0x1f')]?_0x5d3180['options'][_0xc35a('0x22')]||null:null})[_0xc35a('0x12')](function(_0x5888b1){logger['info'](_0xc35a('0x2a'),_0x5d3180);logger[_0xc35a('0x14')]('UpdateVoiceQueueReport',_0x5d3180,JSON[_0xc35a('0x26')](_0x5888b1));_0x331f19(_0x5888b1);})[_0xc35a('0x1b')](function(_0x3ed3ca){logger[_0xc35a('0x15')](_0xc35a('0x2a'),_0x3ed3ca[_0xc35a('0x18')],_0x5d3180);_0x132958(_0x540919[_0xc35a('0x15')](0x1f4,_0x3ed3ca[_0xc35a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index a7a4ac9..db03d1a 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 _0x87cb=['register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','removeListener'];(function(_0x2db520,_0x5adb82){var _0x45fd3a=function(_0x3317f2){while(--_0x3317f2){_0x2db520['push'](_0x2db520['shift']());}};_0x45fd3a(++_0x5adb82);}(_0x87cb,0xaa));var _0xb87c=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x87cb[_0x2c7618];return _0x5ce3f0;};'use strict';var VoiceQueueReportEvents=require(_0xb87c('0x0'));var events=[_0xb87c('0x1'),_0xb87c('0x2'),_0xb87c('0x3')];function createListener(_0x8a4460,_0x146528){return function(_0x491ca6){_0x146528['emit'](_0x8a4460,_0x491ca6);};}function removeListener(_0x430a68,_0x33bfc1){return function(){VoiceQueueReportEvents[_0xb87c('0x4')](_0x430a68,_0x33bfc1);};}exports[_0xb87c('0x5')]=function(_0x46377b){for(var _0x211d93=0x0,_0x49db0f=events['length'];_0x211d93<_0x49db0f;_0x211d93++){var _0xe3d2f4=events[_0x211d93];var _0x465e3d=createListener(_0xb87c('0x6')+_0xe3d2f4,_0x46377b);VoiceQueueReportEvents['on'](_0xe3d2f4,_0x465e3d);}}; \ No newline at end of file +var _0x8743=['removeListener','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x49de88,_0x3030f2){var _0x4cc5dd=function(_0x24668c){while(--_0x24668c){_0x49de88['push'](_0x49de88['shift']());}};_0x4cc5dd(++_0x3030f2);}(_0x8743,0x7a));var _0x3874=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x8743[_0x5447fd];return _0x15b28a;};'use strict';var VoiceQueueReportEvents=require(_0x3874('0x0'));var events=[_0x3874('0x1'),_0x3874('0x2'),'update'];function createListener(_0x12c858,_0x2c398d){return function(_0x4bc542){_0x2c398d['emit'](_0x12c858,_0x4bc542);};}function removeListener(_0x35cd1b,_0x230e06){return function(){VoiceQueueReportEvents[_0x3874('0x3')](_0x35cd1b,_0x230e06);};}exports['register']=function(_0x597a79){for(var _0x4b242a=0x0,_0x8f890a=events['length'];_0x4b242a<_0x8f890a;_0x4b242a++){var _0x2dee29=events[_0x4b242a];var _0x3ecd70=createListener(_0x3874('0x4')+_0x2dee29,_0x597a79);VoiceQueueReportEvents['on'](_0x2dee29,_0x3ecd70);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index d1392b3..a121117 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 _0xa4f2=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','create','put'];(function(_0x54927d,_0x24b59f){var _0x1afb67=function(_0x1e3665){while(--_0x1e3665){_0x54927d['push'](_0x54927d['shift']());}};_0x1afb67(++_0x24b59f);}(_0xa4f2,0x1d3));var _0x2a4f=function(_0x511a19,_0x417e36){_0x511a19=_0x511a19-0x0;var _0x499aa6=_0xa4f2[_0x511a19];return _0x499aa6;};'use strict';var multer=require(_0x2a4f('0x0'));var util=require(_0x2a4f('0x1'));var path=require(_0x2a4f('0x2'));var timeout=require('connect-timeout');var express=require(_0x2a4f('0x3'));var router=express[_0x2a4f('0x4')]();var fs_extra=require(_0x2a4f('0x5'));var auth=require(_0x2a4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2a4f('0x7'));var controller=require(_0x2a4f('0x8'));router[_0x2a4f('0x9')]('/',auth[_0x2a4f('0xa')](),controller['index']);router['get']('/:id',auth[_0x2a4f('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2a4f('0xb')]);router[_0x2a4f('0xc')]('/:id',auth[_0x2a4f('0xa')](),controller['update']);router[_0x2a4f('0xd')]('/:id',auth[_0x2a4f('0xa')](),controller[_0x2a4f('0xe')]);module['exports']=router; \ No newline at end of file +var _0x4092=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x4092,0x1af));var _0x2409=function(_0x179d86,_0x139c2c){_0x179d86=_0x179d86-0x0;var _0x437ec7=_0x4092[_0x179d86];return _0x437ec7;};'use strict';var multer=require('multer');var util=require(_0x2409('0x0'));var path=require(_0x2409('0x1'));var timeout=require(_0x2409('0x2'));var express=require(_0x2409('0x3'));var router=express[_0x2409('0x4')]();var fs_extra=require(_0x2409('0x5'));var auth=require(_0x2409('0x6'));var interaction=require(_0x2409('0x7'));var config=require(_0x2409('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0x2409('0x9')]('/',auth[_0x2409('0xa')](),controller[_0x2409('0xb')]);router['get'](_0x2409('0xc'),auth[_0x2409('0xa')](),controller[_0x2409('0xd')]);router[_0x2409('0xe')]('/',auth[_0x2409('0xa')](),controller[_0x2409('0xf')]);router[_0x2409('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2409('0x11')]);router[_0x2409('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2409('0x13')]);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 833b9ab..18a1f17 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 _0x44b6=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','STRING','DATE','literal'];(function(_0x3077e2,_0x2fed5f){var _0x5d597e=function(_0x3530a){while(--_0x3530a){_0x3077e2['push'](_0x3077e2['shift']());}};_0x5d597e(++_0x2fed5f);}(_0x44b6,0xdf));var _0x644b=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x44b6[_0x59bcb1];return _0x4a737f;};'use strict';var Sequelize=require(_0x644b('0x0'));var moment=require(_0x644b('0x1'));module['exports']={'time':{'type':Sequelize[_0x644b('0x2')]},'callid':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x644b('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x644b('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x644b('0x4')](_0x644b('0x5'))}}; \ No newline at end of file +var _0x12f4=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING'];(function(_0x567b28,_0x5a080b){var _0xee2e3a=function(_0x54d966){while(--_0x54d966){_0x567b28['push'](_0x567b28['shift']());}};_0xee2e3a(++_0x5a080b);}(_0x12f4,0x199));var _0x412f=function(_0x1b9e9f,_0x332f73){_0x1b9e9f=_0x1b9e9f-0x0;var _0x245c99=_0x12f4[_0x1b9e9f];return _0x245c99;};'use strict';var Sequelize=require(_0x412f('0x0'));var moment=require(_0x412f('0x1'));module[_0x412f('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x412f('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x412f('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x412f('0x5')](_0x412f('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index bfb4654..6c4ec74 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 _0x84b6=['fields','query','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceQueuesLog','includeAll','findAll','rows','show','params','include','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','index','rawAttributes','type','key','map','keys','filters','intersection','attributes','model'];(function(_0x3b16c6,_0x34abf5){var _0x48dcb6=function(_0x47b565){while(--_0x47b565){_0x3b16c6['push'](_0x3b16c6['shift']());}};_0x48dcb6(++_0x34abf5);}(_0x84b6,0x12e));var _0x684b=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x84b6[_0x9aada2];return _0x196dff;};'use strict';var emlformat=require(_0x684b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x684b('0x1'));var jsonpatch=require(_0x684b('0x2'));var rp=require('request-promise');var moment=require(_0x684b('0x3'));var BPromise=require(_0x684b('0x4'));var Mustache=require(_0x684b('0x5'));var util=require('util');var path=require(_0x684b('0x6'));var sox=require(_0x684b('0x7'));var csv=require('to-csv');var ejs=require(_0x684b('0x8'));var fs=require('fs');var fs_extra=require(_0x684b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x684b('0xa'));var deskjs=require(_0x684b('0xb'));var toCsv=require('to-csv');var querystring=require(_0x684b('0xc'));var Papa=require('papaparse');var Redis=require(_0x684b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x684b('0xe'));var as=require(_0x684b('0xf'));var hardwareService=require(_0x684b('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x684b('0x11'));var licenseUtil=require(_0x684b('0x12'));var db=require(_0x684b('0x13'))['db'];function respondWithStatusCode(_0x467ba7,_0x1a08d3){_0x1a08d3=_0x1a08d3||0xcc;return function(_0x34738a){if(_0x34738a){return _0x467ba7[_0x684b('0x14')](_0x1a08d3);}return _0x467ba7[_0x684b('0x15')](_0x1a08d3)[_0x684b('0x16')]();};}function respondWithResult(_0x11007d,_0x4d5a97){_0x4d5a97=_0x4d5a97||0xc8;return function(_0x26a3e9){if(_0x26a3e9){return _0x11007d[_0x684b('0x15')](_0x4d5a97)[_0x684b('0x17')](_0x26a3e9);}};}function respondWithFilteredResult(_0x1a32ce,_0x33edd9){return function(_0x227ee4){if(_0x227ee4){var _0x25549a=typeof _0x33edd9[_0x684b('0x18')]===_0x684b('0x19')&&typeof _0x33edd9[_0x684b('0x1a')]===_0x684b('0x19');var _0x2e0f8c=_0x227ee4[_0x684b('0x1b')];var _0x5f5731=_0x25549a?0x0:_0x33edd9[_0x684b('0x18')];var _0x55d7e3=_0x25549a?_0x227ee4[_0x684b('0x1b')]:_0x33edd9['offset']+_0x33edd9[_0x684b('0x1a')];var _0x34e2e9;if(_0x55d7e3>=_0x2e0f8c){_0x55d7e3=_0x2e0f8c;_0x34e2e9=0xc8;}else{_0x34e2e9=0xce;}_0x1a32ce['status'](_0x34e2e9);return _0x1a32ce[_0x684b('0x1c')](_0x684b('0x1d'),_0x5f5731+'-'+_0x55d7e3+'/'+_0x2e0f8c)[_0x684b('0x17')](_0x227ee4);}return null;};}function patchUpdates(_0x32d27e){return function(_0x20c851){try{jsonpatch[_0x684b('0x1e')](_0x20c851,_0x32d27e,!![]);}catch(_0x59fcb2){return BPromise[_0x684b('0x1f')](_0x59fcb2);}return _0x20c851[_0x684b('0x20')]();};}function saveUpdates(_0x3d9781,_0x36c90b){return function(_0x1de5c5){if(_0x1de5c5){return _0x1de5c5[_0x684b('0x21')](_0x3d9781)['then'](function(_0x57eafc){return _0x57eafc;});}return null;};}function removeEntity(_0x119917,_0x40bd4d){return function(_0x2d09e6){if(_0x2d09e6){return _0x2d09e6[_0x684b('0x22')]()[_0x684b('0x23')](function(){_0x119917[_0x684b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cb49c,_0xa23076){return function(_0x3aefcd){if(!_0x3aefcd){_0x1cb49c[_0x684b('0x14')](0x194);}return _0x3aefcd;};}function handleError(_0x41bb8f,_0x285cda){_0x285cda=_0x285cda||0x1f4;return function(_0x1000b3){logger[_0x684b('0x24')](_0x1000b3['stack']);if(_0x1000b3[_0x684b('0x25')]){delete _0x1000b3[_0x684b('0x25')];}_0x41bb8f[_0x684b('0x15')](_0x285cda)['send'](_0x1000b3);};}exports[_0x684b('0x26')]=function(_0x355210,_0x24eb16){var _0x26de49={},_0x132b35={},_0x3e8227={'count':0x0,'rows':[]};var _0x1d1e6a=_['map'](db['VoiceQueuesLog'][_0x684b('0x27')],function(_0x1fb29a){return{'name':_0x1fb29a['fieldName'],'type':_0x1fb29a[_0x684b('0x28')][_0x684b('0x29')]};});_0x132b35['model']=_[_0x684b('0x2a')](_0x1d1e6a,_0x684b('0x25'));_0x132b35['query']=_[_0x684b('0x2b')](_0x355210['query']);_0x132b35[_0x684b('0x2c')]=_[_0x684b('0x2d')](_0x132b35['model'],_0x132b35['query']);_0x26de49[_0x684b('0x2e')]=_[_0x684b('0x2d')](_0x132b35[_0x684b('0x2f')],qs[_0x684b('0x30')](_0x355210[_0x684b('0x31')][_0x684b('0x30')]));_0x26de49[_0x684b('0x2e')]=_0x26de49['attributes'][_0x684b('0x32')]?_0x26de49[_0x684b('0x2e')]:_0x132b35[_0x684b('0x2f')];if(!_0x355210[_0x684b('0x31')][_0x684b('0x33')](_0x684b('0x34'))){_0x26de49['limit']=qs['limit'](_0x355210['query']['limit']);_0x26de49[_0x684b('0x18')]=qs['offset'](_0x355210[_0x684b('0x31')]['offset']);}_0x26de49['order']=qs[_0x684b('0x35')](_0x355210['query'][_0x684b('0x35')]);_0x26de49[_0x684b('0x36')]=qs[_0x684b('0x2c')](_['pick'](_0x355210[_0x684b('0x31')],_0x132b35[_0x684b('0x2c')]),_0x1d1e6a);if(_0x355210['query'][_0x684b('0x37')]){_0x26de49[_0x684b('0x36')]=_[_0x684b('0x38')](_0x26de49[_0x684b('0x36')],{'$or':_['map'](_0x1d1e6a,function(_0x18a9e8){if(_0x18a9e8[_0x684b('0x28')]!==_0x684b('0x39')){var _0x59c844={};_0x59c844[_0x18a9e8['name']]={'$like':'%'+_0x355210[_0x684b('0x31')][_0x684b('0x37')]+'%'};return _0x59c844;}})});}_0x26de49=_['merge']({},_0x26de49,_0x355210[_0x684b('0x3a')]);var _0x163bd1={'where':_0x26de49[_0x684b('0x36')]};return db[_0x684b('0x3b')][_0x684b('0x1b')](_0x163bd1)[_0x684b('0x23')](function(_0x48741c){_0x3e8227[_0x684b('0x1b')]=_0x48741c;if(_0x355210[_0x684b('0x31')][_0x684b('0x3c')]){_0x26de49['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x684b('0x3d')](_0x26de49);})[_0x684b('0x23')](function(_0x315183){_0x3e8227[_0x684b('0x3e')]=_0x315183;return _0x3e8227;})[_0x684b('0x23')](respondWithFilteredResult(_0x24eb16,_0x26de49))['catch'](handleError(_0x24eb16,null));};exports[_0x684b('0x3f')]=function(_0x1ecb22,_0x3d7bc8){var _0x52fed5={'raw':!![],'where':{'id':_0x1ecb22[_0x684b('0x40')]['id']}},_0x22030b={};_0x22030b[_0x684b('0x2f')]=_[_0x684b('0x2b')](db['VoiceQueuesLog'][_0x684b('0x27')]);_0x22030b['query']=_[_0x684b('0x2b')](_0x1ecb22['query']);_0x22030b[_0x684b('0x2c')]=_[_0x684b('0x2d')](_0x22030b[_0x684b('0x2f')],_0x22030b[_0x684b('0x31')]);_0x52fed5['attributes']=_[_0x684b('0x2d')](_0x22030b['model'],qs[_0x684b('0x30')](_0x1ecb22[_0x684b('0x31')]['fields']));_0x52fed5[_0x684b('0x2e')]=_0x52fed5[_0x684b('0x2e')][_0x684b('0x32')]?_0x52fed5[_0x684b('0x2e')]:_0x22030b[_0x684b('0x2f')];if(_0x1ecb22[_0x684b('0x31')][_0x684b('0x3c')]){_0x52fed5[_0x684b('0x41')]=[{'all':!![]}];}_0x52fed5=_[_0x684b('0x38')]({},_0x52fed5,_0x1ecb22[_0x684b('0x3a')]);return db[_0x684b('0x3b')][_0x684b('0x42')](_0x52fed5)['then'](handleEntityNotFound(_0x3d7bc8,null))[_0x684b('0x23')](respondWithResult(_0x3d7bc8,null))[_0x684b('0x43')](handleError(_0x3d7bc8,null));};exports[_0x684b('0x44')]=function(_0x513b1a,_0x571269){return db['VoiceQueuesLog'][_0x684b('0x44')](_0x513b1a[_0x684b('0x45')],{})['then'](respondWithResult(_0x571269,0xc9))[_0x684b('0x43')](handleError(_0x571269,null));};exports[_0x684b('0x21')]=function(_0x16240a,_0x423f17){if(_0x16240a[_0x684b('0x45')]['id']){delete _0x16240a[_0x684b('0x45')]['id'];}return db[_0x684b('0x3b')]['find']({'where':{'id':_0x16240a[_0x684b('0x40')]['id']}})[_0x684b('0x23')](handleEntityNotFound(_0x423f17,null))[_0x684b('0x23')](saveUpdates(_0x16240a['body'],null))[_0x684b('0x23')](respondWithResult(_0x423f17,null))[_0x684b('0x43')](handleError(_0x423f17,null));};exports[_0x684b('0x22')]=function(_0x25b87d,_0x590487){return db[_0x684b('0x3b')][_0x684b('0x42')]({'where':{'id':_0x25b87d['params']['id']}})['then'](handleEntityNotFound(_0x590487,null))[_0x684b('0x23')](removeEntity(_0x590487,null))[_0x684b('0x43')](handleError(_0x590487,null));}; \ No newline at end of file +var _0xbab3=['update','then','sendStatus','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x2dee2f,_0x19572f){var _0x327c18=function(_0x130ec0){while(--_0x130ec0){_0x2dee2f['push'](_0x2dee2f['shift']());}};_0x327c18(++_0x19572f);}(_0xbab3,0x1ae));var _0x3bab=function(_0x2e334b,_0x426b6e){_0x2e334b=_0x2e334b-0x0;var _0x390570=_0xbab3[_0x2e334b];return _0x390570;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bab('0x0'));var zipdir=require(_0x3bab('0x1'));var jsonpatch=require(_0x3bab('0x2'));var rp=require(_0x3bab('0x3'));var moment=require(_0x3bab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3bab('0x5'));var util=require(_0x3bab('0x6'));var path=require('path');var sox=require(_0x3bab('0x7'));var csv=require(_0x3bab('0x8'));var ejs=require(_0x3bab('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bab('0xa'));var squel=require(_0x3bab('0xb'));var crypto=require(_0x3bab('0xc'));var jsforce=require(_0x3bab('0xd'));var deskjs=require(_0x3bab('0xe'));var toCsv=require(_0x3bab('0x8'));var querystring=require(_0x3bab('0xf'));var Papa=require(_0x3bab('0x10'));var Redis=require(_0x3bab('0x11'));var authService=require(_0x3bab('0x12'));var qs=require(_0x3bab('0x13'));var as=require(_0x3bab('0x14'));var hardwareService=require(_0x3bab('0x15'));var logger=require(_0x3bab('0x16'))(_0x3bab('0x17'));var utils=require('../../config/utils');var config=require(_0x3bab('0x18'));var licenseUtil=require(_0x3bab('0x19'));var db=require(_0x3bab('0x1a'))['db'];function respondWithStatusCode(_0xec370c,_0x3b0fc3){_0x3b0fc3=_0x3b0fc3||0xcc;return function(_0x1a441a){if(_0x1a441a){return _0xec370c['sendStatus'](_0x3b0fc3);}return _0xec370c['status'](_0x3b0fc3)[_0x3bab('0x1b')]();};}function respondWithResult(_0xdcaefa,_0x108c09){_0x108c09=_0x108c09||0xc8;return function(_0x2bedc9){if(_0x2bedc9){return _0xdcaefa[_0x3bab('0x1c')](_0x108c09)[_0x3bab('0x1d')](_0x2bedc9);}};}function respondWithFilteredResult(_0x3b5cb6,_0x15cc62){return function(_0x52b9b2){if(_0x52b9b2){var _0x4deaa5=typeof _0x15cc62['offset']===_0x3bab('0x1e')&&typeof _0x15cc62[_0x3bab('0x1f')]==='undefined';var _0x437773=_0x52b9b2[_0x3bab('0x20')];var _0x3ae92d=_0x4deaa5?0x0:_0x15cc62['offset'];var _0x1c46f6=_0x4deaa5?_0x52b9b2['count']:_0x15cc62['offset']+_0x15cc62[_0x3bab('0x1f')];var _0x59d206;if(_0x1c46f6>=_0x437773){_0x1c46f6=_0x437773;_0x59d206=0xc8;}else{_0x59d206=0xce;}_0x3b5cb6[_0x3bab('0x1c')](_0x59d206);return _0x3b5cb6[_0x3bab('0x21')](_0x3bab('0x22'),_0x3ae92d+'-'+_0x1c46f6+'/'+_0x437773)[_0x3bab('0x1d')](_0x52b9b2);}return null;};}function patchUpdates(_0x384681){return function(_0x50d529){try{jsonpatch[_0x3bab('0x23')](_0x50d529,_0x384681,!![]);}catch(_0x34b43e){return BPromise[_0x3bab('0x24')](_0x34b43e);}return _0x50d529[_0x3bab('0x25')]();};}function saveUpdates(_0x277220,_0x51d1d6){return function(_0x3a46c7){if(_0x3a46c7){return _0x3a46c7[_0x3bab('0x26')](_0x277220)[_0x3bab('0x27')](function(_0x4c0e76){return _0x4c0e76;});}return null;};}function removeEntity(_0x24d5a4,_0x2fab37){return function(_0x2a7815){if(_0x2a7815){return _0x2a7815['destroy']()[_0x3bab('0x27')](function(){_0x24d5a4[_0x3bab('0x1c')](0xcc)[_0x3bab('0x1b')]();});}};}function handleEntityNotFound(_0x4fc1f0,_0x4c16b1){return function(_0x4aea7c){if(!_0x4aea7c){_0x4fc1f0[_0x3bab('0x28')](0x194);}return _0x4aea7c;};}function handleError(_0x3dc54d,_0x3cdb50){_0x3cdb50=_0x3cdb50||0x1f4;return function(_0x2eedac){logger[_0x3bab('0x29')](_0x2eedac[_0x3bab('0x2a')]);if(_0x2eedac[_0x3bab('0x2b')]){delete _0x2eedac[_0x3bab('0x2b')];}_0x3dc54d[_0x3bab('0x1c')](_0x3cdb50)[_0x3bab('0x2c')](_0x2eedac);};}exports['index']=function(_0x13eec0,_0x135421){var _0x5897aa={},_0x1fff29={},_0x4283c8={'count':0x0,'rows':[]};var _0x248aeb=_[_0x3bab('0x2d')](db[_0x3bab('0x2e')][_0x3bab('0x2f')],function(_0x27fed5){return{'name':_0x27fed5[_0x3bab('0x30')],'type':_0x27fed5[_0x3bab('0x31')][_0x3bab('0x32')]};});_0x1fff29[_0x3bab('0x33')]=_[_0x3bab('0x2d')](_0x248aeb,_0x3bab('0x2b'));_0x1fff29[_0x3bab('0x34')]=_[_0x3bab('0x35')](_0x13eec0[_0x3bab('0x34')]);_0x1fff29[_0x3bab('0x36')]=_[_0x3bab('0x37')](_0x1fff29['model'],_0x1fff29[_0x3bab('0x34')]);_0x5897aa[_0x3bab('0x38')]=_[_0x3bab('0x37')](_0x1fff29[_0x3bab('0x33')],qs['fields'](_0x13eec0[_0x3bab('0x34')][_0x3bab('0x39')]));_0x5897aa['attributes']=_0x5897aa[_0x3bab('0x38')][_0x3bab('0x3a')]?_0x5897aa[_0x3bab('0x38')]:_0x1fff29['model'];if(!_0x13eec0[_0x3bab('0x34')][_0x3bab('0x3b')](_0x3bab('0x3c'))){_0x5897aa[_0x3bab('0x1f')]=qs[_0x3bab('0x1f')](_0x13eec0[_0x3bab('0x34')]['limit']);_0x5897aa['offset']=qs[_0x3bab('0x3d')](_0x13eec0['query']['offset']);}_0x5897aa[_0x3bab('0x3e')]=qs['sort'](_0x13eec0[_0x3bab('0x34')][_0x3bab('0x3f')]);_0x5897aa['where']=qs['filters'](_[_0x3bab('0x40')](_0x13eec0[_0x3bab('0x34')],_0x1fff29[_0x3bab('0x36')]),_0x248aeb);if(_0x13eec0[_0x3bab('0x34')][_0x3bab('0x41')]){_0x5897aa[_0x3bab('0x42')]=_[_0x3bab('0x43')](_0x5897aa[_0x3bab('0x42')],{'$or':_[_0x3bab('0x2d')](_0x248aeb,function(_0x2d6d80){if(_0x2d6d80['type']!=='VIRTUAL'){var _0x46d4cf={};_0x46d4cf[_0x2d6d80[_0x3bab('0x2b')]]={'$like':'%'+_0x13eec0[_0x3bab('0x34')][_0x3bab('0x41')]+'%'};return _0x46d4cf;}})});}_0x5897aa=_[_0x3bab('0x43')]({},_0x5897aa,_0x13eec0[_0x3bab('0x44')]);var _0x5421ef={'where':_0x5897aa[_0x3bab('0x42')]};return db['VoiceQueuesLog'][_0x3bab('0x20')](_0x5421ef)[_0x3bab('0x27')](function(_0xcabac3){_0x4283c8[_0x3bab('0x20')]=_0xcabac3;if(_0x13eec0['query'][_0x3bab('0x45')]){_0x5897aa[_0x3bab('0x46')]=[{'all':!![]}];}return db[_0x3bab('0x2e')]['findAll'](_0x5897aa);})['then'](function(_0x586c1d){_0x4283c8[_0x3bab('0x47')]=_0x586c1d;return _0x4283c8;})[_0x3bab('0x27')](respondWithFilteredResult(_0x135421,_0x5897aa))[_0x3bab('0x48')](handleError(_0x135421,null));};exports[_0x3bab('0x49')]=function(_0x928974,_0x5e4d7a){var _0x43e102={'raw':!![],'where':{'id':_0x928974['params']['id']}},_0x366aff={};_0x366aff['model']=_['keys'](db[_0x3bab('0x2e')][_0x3bab('0x2f')]);_0x366aff[_0x3bab('0x34')]=_[_0x3bab('0x35')](_0x928974['query']);_0x366aff[_0x3bab('0x36')]=_[_0x3bab('0x37')](_0x366aff[_0x3bab('0x33')],_0x366aff[_0x3bab('0x34')]);_0x43e102[_0x3bab('0x38')]=_[_0x3bab('0x37')](_0x366aff[_0x3bab('0x33')],qs['fields'](_0x928974['query'][_0x3bab('0x39')]));_0x43e102['attributes']=_0x43e102[_0x3bab('0x38')]['length']?_0x43e102['attributes']:_0x366aff[_0x3bab('0x33')];if(_0x928974[_0x3bab('0x34')][_0x3bab('0x45')]){_0x43e102['include']=[{'all':!![]}];}_0x43e102=_[_0x3bab('0x43')]({},_0x43e102,_0x928974['options']);return db[_0x3bab('0x2e')][_0x3bab('0x4a')](_0x43e102)[_0x3bab('0x27')](handleEntityNotFound(_0x5e4d7a,null))['then'](respondWithResult(_0x5e4d7a,null))[_0x3bab('0x48')](handleError(_0x5e4d7a,null));};exports[_0x3bab('0x4b')]=function(_0x3b0501,_0x358fa4){return db[_0x3bab('0x2e')]['create'](_0x3b0501[_0x3bab('0x4c')],{})[_0x3bab('0x27')](respondWithResult(_0x358fa4,0xc9))[_0x3bab('0x48')](handleError(_0x358fa4,null));};exports[_0x3bab('0x26')]=function(_0x549841,_0x138175){if(_0x549841[_0x3bab('0x4c')]['id']){delete _0x549841[_0x3bab('0x4c')]['id'];}return db[_0x3bab('0x2e')]['find']({'where':{'id':_0x549841['params']['id']}})['then'](handleEntityNotFound(_0x138175,null))['then'](saveUpdates(_0x549841[_0x3bab('0x4c')],null))[_0x3bab('0x27')](respondWithResult(_0x138175,null))[_0x3bab('0x48')](handleError(_0x138175,null));};exports[_0x3bab('0x4d')]=function(_0x1ebc33,_0x581bb5){return db[_0x3bab('0x2e')][_0x3bab('0x4a')]({'where':{'id':_0x1ebc33['params']['id']}})[_0x3bab('0x27')](handleEntityNotFound(_0x581bb5,null))['then'](removeEntity(_0x581bb5,null))[_0x3bab('0x48')](handleError(_0x581bb5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c944f4c..cef5fa8 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 _0xa85d=['define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x3afd82,_0x47a234){var _0x414ce0=function(_0x1ad2bf){while(--_0x1ad2bf){_0x3afd82['push'](_0x3afd82['shift']());}};_0x414ce0(++_0x47a234);}(_0xa85d,0x68));var _0xda85=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xa85d[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xda85('0x0'));var util=require(_0xda85('0x1'));var logger=require(_0xda85('0x2'))('api');var moment=require(_0xda85('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xda85('0x4'));var config=require(_0xda85('0x5'));var attributes=require(_0xda85('0x6'));module[_0xda85('0x7')]=function(_0x1149d3,_0x26dac6){return _0x1149d3[_0xda85('0x8')](_0xda85('0x9'),attributes,{'tableName':_0xda85('0xa'),'paranoid':![],'indexes':[{'name':_0xda85('0xb'),'fields':[_0xda85('0xc'),_0xda85('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x253c=['VoiceQueuesLog','voice_queues_log','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x2c8d31,_0x50c07f){var _0x3cc5db=function(_0x3fa7db){while(--_0x3fa7db){_0x2c8d31['push'](_0x2c8d31['shift']());}};_0x3cc5db(++_0x50c07f);}(_0x253c,0x13f));var _0xc253=function(_0x45c5f9,_0x1ad8c9){_0x45c5f9=_0x45c5f9-0x0;var _0x22cc60=_0x253c[_0x45c5f9];return _0x22cc60;};'use strict';var _=require(_0xc253('0x0'));var util=require(_0xc253('0x1'));var logger=require(_0xc253('0x2'))(_0xc253('0x3'));var moment=require(_0xc253('0x4'));var BPromise=require(_0xc253('0x5'));var rp=require(_0xc253('0x6'));var fs=require('fs');var path=require(_0xc253('0x7'));var rimraf=require(_0xc253('0x8'));var config=require(_0xc253('0x9'));var attributes=require(_0xc253('0xa'));module['exports']=function(_0xfc59d7,_0x10ef82){return _0xfc59d7['define'](_0xc253('0xb'),attributes,{'tableName':_0xc253('0xc'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xc253('0xd'),_0xc253('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 8713398..4f4e5f7 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 _0xe0b2=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x549cb4,_0x599177){var _0x463765=function(_0x423f01){while(--_0x423f01){_0x549cb4['push'](_0x549cb4['shift']());}};_0x463765(++_0x599177);}(_0xe0b2,0xec));var _0x2e0b=function(_0x13250c,_0x1576bb){_0x13250c=_0x13250c-0x0;var _0x283976=_0xe0b2[_0x13250c];return _0x283976;};'use strict';var _=require('lodash');var util=require(_0x2e0b('0x0'));var moment=require(_0x2e0b('0x1'));var BPromise=require(_0x2e0b('0x2'));var rs=require(_0x2e0b('0x3'));var fs=require('fs');var Redis=require(_0x2e0b('0x4'));var db=require(_0x2e0b('0x5'))['db'];var utils=require(_0x2e0b('0x6'));var logger=require('../../config/logger')(_0x2e0b('0x7'));var config=require(_0x2e0b('0x8'));var jayson=require(_0x2e0b('0x9'));var client=jayson[_0x2e0b('0xa')][_0x2e0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x264319,_0x4b62b7,_0x2e1e40){return new BPromise(function(_0x504ea6,_0x1afd43){return client[_0x2e0b('0xc')](_0x264319,_0x2e1e40)[_0x2e0b('0xd')](function(_0x3078eb){logger[_0x2e0b('0xe')](_0x2e0b('0xf'),_0x4b62b7,_0x2e0b('0x10'));logger[_0x2e0b('0x11')](_0x2e0b('0x12'),_0x4b62b7,'request\x20sent',JSON[_0x2e0b('0x13')](_0x3078eb));if(_0x3078eb[_0x2e0b('0x14')]){if(_0x3078eb['error']['code']===0x1f4){logger[_0x2e0b('0x14')](_0x2e0b('0xf'),_0x4b62b7,_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);return _0x1afd43(_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);}logger[_0x2e0b('0x14')](_0x2e0b('0xf'),_0x4b62b7,_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);return _0x504ea6(_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x4b62b7,'request\x20sent');_0x504ea6(_0x3078eb[_0x2e0b('0x16')]['message']);}})[_0x2e0b('0x17')](function(_0x426879){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x4b62b7,_0x426879);_0x1afd43(_0x426879);});});} \ No newline at end of file +var _0xc8de=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util'];(function(_0x423e15,_0x12b2b2){var _0x184279=function(_0x445a68){while(--_0x445a68){_0x423e15['push'](_0x423e15['shift']());}};_0x184279(++_0x12b2b2);}(_0xc8de,0x167));var _0xec8d=function(_0x3849fa,_0x2b6858){_0x3849fa=_0x3849fa-0x0;var _0x570d35=_0xc8de[_0x3849fa];return _0x570d35;};'use strict';var _=require('lodash');var util=require(_0xec8d('0x0'));var moment=require(_0xec8d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec8d('0x2'));var db=require(_0xec8d('0x3'))['db'];var utils=require(_0xec8d('0x4'));var logger=require(_0xec8d('0x5'))(_0xec8d('0x6'));var config=require(_0xec8d('0x7'));var jayson=require(_0xec8d('0x8'));var client=jayson['client'][_0xec8d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55e36c,_0x11308b,_0x596921){return new BPromise(function(_0x37de69,_0x597c70){return client[_0xec8d('0xa')](_0x55e36c,_0x596921)['then'](function(_0x2e028d){logger[_0xec8d('0xb')](_0xec8d('0xc'),_0x11308b,_0xec8d('0xd'));logger[_0xec8d('0xe')](_0xec8d('0xf'),_0x11308b,_0xec8d('0xd'),JSON[_0xec8d('0x10')](_0x2e028d));if(_0x2e028d[_0xec8d('0x11')]){if(_0x2e028d[_0xec8d('0x11')]['code']===0x1f4){logger[_0xec8d('0x11')](_0xec8d('0xc'),_0x11308b,_0x2e028d[_0xec8d('0x11')][_0xec8d('0x12')]);return _0x597c70(_0x2e028d[_0xec8d('0x11')][_0xec8d('0x12')]);}logger[_0xec8d('0x11')](_0xec8d('0xc'),_0x11308b,_0x2e028d[_0xec8d('0x11')][_0xec8d('0x12')]);return _0x37de69(_0x2e028d[_0xec8d('0x11')][_0xec8d('0x12')]);}else{logger['info'](_0xec8d('0xc'),_0x11308b,_0xec8d('0xd'));_0x37de69(_0x2e028d[_0xec8d('0x13')][_0xec8d('0x12')]);}})['catch'](function(_0x2fb24f){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x11308b,_0x2fb24f);_0x597c70(_0x2fb24f);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 8ecd1af..e80928c 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 _0x6f32=['Router','fs-extra','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','downloads','post','/:id/transcribe','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x40f998,_0x3b3149){var _0x305564=function(_0x2ba791){while(--_0x2ba791){_0x40f998['push'](_0x40f998['shift']());}};_0x305564(++_0x3b3149);}(_0x6f32,0xf6));var _0x26f3=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x6f32[_0x46d0c9];return _0x174506;};'use strict';var multer=require(_0x26f3('0x0'));var util=require(_0x26f3('0x1'));var path=require(_0x26f3('0x2'));var timeout=require('connect-timeout');var express=require(_0x26f3('0x3'));var router=express[_0x26f3('0x4')]();var fs_extra=require(_0x26f3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x26f3('0x6'));var controller=require(_0x26f3('0x7'));router[_0x26f3('0x8')]('/',auth[_0x26f3('0x9')](),controller[_0x26f3('0xa')]);router[_0x26f3('0x8')](_0x26f3('0xb'),auth['isAuthenticated'](),controller[_0x26f3('0xc')]);router[_0x26f3('0x8')](_0x26f3('0xd'),auth[_0x26f3('0x9')](),controller[_0x26f3('0xe')]);router[_0x26f3('0x8')](_0x26f3('0xf'),auth[_0x26f3('0x9')](),controller[_0x26f3('0x10')]);router[_0x26f3('0x8')]('/:id/downloads',controller[_0x26f3('0x11')]);router[_0x26f3('0x8')]('/:id/transcribe',auth[_0x26f3('0x9')](),controller['downloadTranscribe']);router[_0x26f3('0x12')]('/',auth[_0x26f3('0x9')](),controller['create']);router[_0x26f3('0x12')](_0x26f3('0x13'),auth[_0x26f3('0x9')](),controller['runTranscribe']);router[_0x26f3('0x14')](_0x26f3('0xd'),auth[_0x26f3('0x9')](),controller[_0x26f3('0x15')]);router[_0x26f3('0x16')](_0x26f3('0xd'),auth[_0x26f3('0x9')](),controller[_0x26f3('0x17')]);module[_0x26f3('0x18')]=router; \ No newline at end of file +var _0x40b2=['/:id','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./voiceRecording.controller','get','isAuthenticated','describe'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x40b2,0xf1));var _0x240b=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x40b2[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require(_0x240b('0x0'));var util=require(_0x240b('0x1'));var path=require(_0x240b('0x2'));var timeout=require(_0x240b('0x3'));var express=require(_0x240b('0x4'));var router=express[_0x240b('0x5')]();var fs_extra=require(_0x240b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x240b('0x7'));router[_0x240b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x240b('0x8')]('/describe',auth[_0x240b('0x9')](),controller[_0x240b('0xa')]);router[_0x240b('0x8')](_0x240b('0xb'),auth[_0x240b('0x9')](),controller['show']);router[_0x240b('0x8')](_0x240b('0xc'),auth[_0x240b('0x9')](),controller['download']);router[_0x240b('0x8')](_0x240b('0xd'),controller[_0x240b('0xe')]);router['get'](_0x240b('0xf'),auth[_0x240b('0x9')](),controller[_0x240b('0x10')]);router[_0x240b('0x11')]('/',auth['isAuthenticated'](),controller[_0x240b('0x12')]);router[_0x240b('0x11')]('/:id/transcribe',auth[_0x240b('0x9')](),controller[_0x240b('0x13')]);router['put'](_0x240b('0xb'),auth[_0x240b('0x9')](),controller['update']);router['delete'](_0x240b('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x240b('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index c28c3d2..36ad799 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(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 e81dbfb..1259b25 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 _0x1bb3=['Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','secrets','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','language','Transcribe\x20not\x20configured','sentiment','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','IN_PROGRESS','runSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','destroy','error','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','map','format','query','keys','filters','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','options','then','includeAll','include','rows','catch','show','params','intersection','attributes','merge','find','create','body','update','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','sequelize','col','token','$and','push','existsSync','recording','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)'];(function(_0x5123f3,_0x21763d){var _0x1df5de=function(_0x2f084e){while(--_0x2f084e){_0x5123f3['push'](_0x5123f3['shift']());}};_0x1df5de(++_0x21763d);}(_0x1bb3,0xc2));var _0x31bb=function(_0x4148fd,_0x1d63e5){_0x4148fd=_0x4148fd-0x0;var _0x3ffb7d=_0x1bb3[_0x4148fd];return _0x3ffb7d;};'use strict';var emlformat=require(_0x31bb('0x0'));var rimraf=require(_0x31bb('0x1'));var zipdir=require(_0x31bb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x31bb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x31bb('0x4'));var util=require(_0x31bb('0x5'));var path=require(_0x31bb('0x6'));var sox=require(_0x31bb('0x7'));var csv=require(_0x31bb('0x8'));var ejs=require(_0x31bb('0x9'));var fs=require('fs');var fs_extra=require(_0x31bb('0xa'));var _=require(_0x31bb('0xb'));var squel=require(_0x31bb('0xc'));var crypto=require(_0x31bb('0xd'));var jsforce=require(_0x31bb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x31bb('0x8'));var querystring=require(_0x31bb('0xf'));var Papa=require(_0x31bb('0x10'));var AWS=require(_0x31bb('0x11'));var uuidv4=require(_0x31bb('0x12'));var Redis=require(_0x31bb('0x13'));var authService=require(_0x31bb('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x31bb('0x15'));var hardwareService=require(_0x31bb('0x16'));var logger=require(_0x31bb('0x17'))(_0x31bb('0x18'));var utils=require(_0x31bb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x31bb('0x1a'));var db=require(_0x31bb('0x1b'))['db'];function respondWithStatusCode(_0x413f48,_0x5b1eb9){_0x5b1eb9=_0x5b1eb9||0xcc;return function(_0x1fc017){if(_0x1fc017){return _0x413f48[_0x31bb('0x1c')](_0x5b1eb9);}return _0x413f48[_0x31bb('0x1d')](_0x5b1eb9)[_0x31bb('0x1e')]();};}function respondWithResult(_0x1019de,_0x106917){_0x106917=_0x106917||0xc8;return function(_0x3acf3a){if(_0x3acf3a){return _0x1019de[_0x31bb('0x1d')](_0x106917)[_0x31bb('0x1f')](_0x3acf3a);}};}function respondWithFilteredResult(_0x106414,_0x1f7fb7){return function(_0x7413c6){if(_0x7413c6){var _0xfc997a=typeof _0x1f7fb7[_0x31bb('0x20')]==='undefined'&&typeof _0x1f7fb7['limit']==='undefined';var _0xd067b0=_0x7413c6['count'];var _0x552540=_0xfc997a?0x0:_0x1f7fb7['offset'];var _0x1ec93d=_0xfc997a?_0x7413c6[_0x31bb('0x21')]:_0x1f7fb7[_0x31bb('0x20')]+_0x1f7fb7[_0x31bb('0x22')];var _0x1abd36;if(_0x1ec93d>=_0xd067b0){_0x1ec93d=_0xd067b0;_0x1abd36=0xc8;}else{_0x1abd36=0xce;}_0x106414[_0x31bb('0x1d')](_0x1abd36);return _0x106414[_0x31bb('0x23')](_0x31bb('0x24'),_0x552540+'-'+_0x1ec93d+'/'+_0xd067b0)[_0x31bb('0x1f')](_0x7413c6);}return null;};}function patchUpdates(_0x253955){return function(_0x1a57d4){try{jsonpatch[_0x31bb('0x25')](_0x1a57d4,_0x253955,!![]);}catch(_0xc93ef3){return BPromise[_0x31bb('0x26')](_0xc93ef3);}return _0x1a57d4[_0x31bb('0x27')]();};}function saveUpdates(_0x12b35e,_0x3657c4){return function(_0x5732d9){if(_0x5732d9){return _0x5732d9['update'](_0x12b35e)['then'](function(_0x4dce10){return _0x4dce10;});}return null;};}function removeEntity(_0x911e7d,_0x2f0784){return function(_0x1b860e){if(_0x1b860e){return _0x1b860e[_0x31bb('0x28')]()['then'](function(){_0x911e7d[_0x31bb('0x1d')](0xcc)[_0x31bb('0x1e')]();});}};}function handleEntityNotFound(_0x335162,_0x2f5ea0){return function(_0x2d8cc6){if(!_0x2d8cc6){_0x335162[_0x31bb('0x1c')](0x194);}return _0x2d8cc6;};}function handleError(_0x38b5a5,_0x56bcd9){_0x56bcd9=_0x56bcd9||0x1f4;return function(_0x179cc0){logger[_0x31bb('0x29')](_0x179cc0['stack']);if(_0x179cc0[_0x31bb('0x2a')]){delete _0x179cc0['name'];}_0x38b5a5[_0x31bb('0x1d')](_0x56bcd9)[_0x31bb('0x2b')](_0x179cc0);};}exports[_0x31bb('0x2c')]=function(_0x110e8e,_0x26ee26){var _0x4d271b={},_0x33bb0a={},_0x210af9={'count':0x0,'rows':[]};var _0x1cdbc5=_['map'](db[_0x31bb('0x2d')][_0x31bb('0x2e')],function(_0x3efa04){return{'name':_0x3efa04[_0x31bb('0x2f')],'type':_0x3efa04[_0x31bb('0x30')][_0x31bb('0x31')]};});_0x33bb0a[_0x31bb('0x32')]=_[_0x31bb('0x33')](_[_0x31bb('0x34')](_0x1cdbc5,_0x31bb('0x2a')),[_0x31bb('0x35')]);_0x33bb0a[_0x31bb('0x36')]=_[_0x31bb('0x37')](_0x110e8e['query']);_0x33bb0a[_0x31bb('0x38')]=_['intersection'](_0x33bb0a['model'],_0x33bb0a['query']);_0x4d271b['attributes']=_['intersection'](_0x33bb0a[_0x31bb('0x32')],qs[_0x31bb('0x39')](_0x110e8e[_0x31bb('0x36')][_0x31bb('0x39')]));_0x4d271b['attributes']=_0x4d271b['attributes'][_0x31bb('0x3a')]?_0x4d271b['attributes']:_0x33bb0a[_0x31bb('0x32')];if(!_0x110e8e['query']['hasOwnProperty'](_0x31bb('0x3b'))){_0x4d271b[_0x31bb('0x22')]=qs['limit'](_0x110e8e[_0x31bb('0x36')][_0x31bb('0x22')]);_0x4d271b['offset']=qs[_0x31bb('0x20')](_0x110e8e[_0x31bb('0x36')]['offset']);}_0x4d271b[_0x31bb('0x3c')]=qs[_0x31bb('0x3d')](_0x110e8e[_0x31bb('0x36')][_0x31bb('0x3d')]);_0x4d271b['where']=qs[_0x31bb('0x38')](_[_0x31bb('0x3e')](_0x110e8e[_0x31bb('0x36')],_0x33bb0a[_0x31bb('0x38')]),_0x1cdbc5);if(_0x110e8e['query']['filter']){_0x4d271b[_0x31bb('0x3f')]=_['merge'](_0x4d271b[_0x31bb('0x3f')],{'$or':_['map'](_0x1cdbc5,function(_0x49efe6){if(_0x49efe6[_0x31bb('0x30')]!==_0x31bb('0x40')){var _0x16bb2c={};_0x16bb2c[_0x49efe6[_0x31bb('0x2a')]]={'$like':'%'+_0x110e8e[_0x31bb('0x36')][_0x31bb('0x41')]+'%'};return _0x16bb2c;}})});}_0x4d271b=_['merge']({},_0x4d271b,_0x110e8e[_0x31bb('0x42')]);var _0x5610a9={'where':_0x4d271b[_0x31bb('0x3f')]};return db['VoiceRecording']['count'](_0x5610a9)[_0x31bb('0x43')](function(_0x43691b){_0x210af9[_0x31bb('0x21')]=_0x43691b;if(_0x110e8e['query'][_0x31bb('0x44')]){_0x4d271b[_0x31bb('0x45')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x4d271b);})[_0x31bb('0x43')](function(_0x25dbff){_0x210af9[_0x31bb('0x46')]=_0x25dbff;return _0x210af9;})['then'](respondWithFilteredResult(_0x26ee26,_0x4d271b))[_0x31bb('0x47')](handleError(_0x26ee26,null));};exports[_0x31bb('0x48')]=function(_0x2610df,_0x14e004){var _0x59473e={'raw':![],'where':{'id':_0x2610df[_0x31bb('0x49')]['id']}},_0x22b8df={};_0x22b8df['model']=_[_0x31bb('0x37')](db[_0x31bb('0x2d')][_0x31bb('0x2e')]);_0x22b8df[_0x31bb('0x36')]=_[_0x31bb('0x37')](_0x2610df['query']);_0x22b8df['filters']=_[_0x31bb('0x4a')](_0x22b8df[_0x31bb('0x32')],_0x22b8df[_0x31bb('0x36')]);_0x59473e[_0x31bb('0x4b')]=_['intersection'](_0x22b8df[_0x31bb('0x32')],qs[_0x31bb('0x39')](_0x2610df['query']['fields']));_0x59473e[_0x31bb('0x4b')]=_0x59473e['attributes'][_0x31bb('0x3a')]?_0x59473e[_0x31bb('0x4b')]:_0x22b8df[_0x31bb('0x32')];if(_0x2610df[_0x31bb('0x36')]['includeAll']){_0x59473e[_0x31bb('0x45')]=[{'all':!![]}];}_0x59473e=_[_0x31bb('0x4c')]({},_0x59473e,_0x2610df[_0x31bb('0x42')]);return db[_0x31bb('0x2d')][_0x31bb('0x4d')](_0x59473e)['then'](handleEntityNotFound(_0x14e004,null))[_0x31bb('0x43')](respondWithResult(_0x14e004,null))[_0x31bb('0x47')](handleError(_0x14e004,null));};exports['create']=function(_0x349978,_0x186255){return db[_0x31bb('0x2d')][_0x31bb('0x4e')](_0x349978[_0x31bb('0x4f')],{})[_0x31bb('0x43')](respondWithResult(_0x186255,0xc9))[_0x31bb('0x47')](handleError(_0x186255,null));};exports[_0x31bb('0x50')]=function(_0x491445,_0x3a473e){if(_0x491445[_0x31bb('0x4f')]['id']){delete _0x491445['body']['id'];}return db[_0x31bb('0x2d')][_0x31bb('0x4d')]({'where':{'id':_0x491445[_0x31bb('0x49')]['id']}})[_0x31bb('0x43')](handleEntityNotFound(_0x3a473e,null))[_0x31bb('0x43')](saveUpdates(_0x491445[_0x31bb('0x4f')],null))[_0x31bb('0x43')](respondWithResult(_0x3a473e,null))[_0x31bb('0x47')](handleError(_0x3a473e,null));};exports['describe']=function(_0xef27bc,_0x2ef455){return db['VoiceRecording'][_0x31bb('0x51')]()[_0x31bb('0x43')](respondWithResult(_0x2ef455,null))[_0x31bb('0x47')](handleError(_0x2ef455,null));};exports[_0x31bb('0x52')]=function(_0x21d455,_0xfdf8eb,_0xef2511){var _0x115a54=require(_0x31bb('0x53'));var _0x42d817=![];var _0x214c79={};if(_0x21d455[_0x31bb('0x36')]['type']&&_0x21d455[_0x31bb('0x36')][_0x31bb('0x30')]===_0x31bb('0x54')){_0x214c79[_0x31bb('0x54')]=_0x21d455[_0x31bb('0x49')]['id'];}else{_0x214c79['id']=_0x21d455[_0x31bb('0x49')]['id'];}return db[_0x31bb('0x2d')][_0x31bb('0x4d')]({'where':_0x214c79,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0xfdf8eb,null))[_0x31bb('0x43')](function(_0x387184){if(_0x387184){var _0x458c3b=_0x387184[_0x31bb('0x55')];var _0x4f1ae1=util[_0x31bb('0x35')](_0x31bb('0x56'),_0x458c3b);if(fs['existsSync'](_0x4f1ae1)){_0x42d817=!![];return _0x115a54[_0x31bb('0x57')](_0x4f1ae1,_0x458c3b,config['secrets']['recording'])['then'](function(){return _0x387184;});}return _0x387184;}})['then'](function(_0x42a52a){if(_0x42a52a){var _0x5646c8=_0x42a52a[_0x31bb('0x55')];if(!fs['existsSync'](_0x5646c8)){throw new db[(_0x31bb('0x58'))][(_0x31bb('0x59'))](_0x31bb('0x5a'));}if(_0x42a52a['filename']){return _0xfdf8eb[_0x31bb('0x52')](_0x5646c8,_0x42a52a[_0x31bb('0x5b')]+path['extname'](_0x5646c8),function(){if(_0x42d817){fs[_0x31bb('0x5c')](_0x5646c8);}});}else{return _0xfdf8eb['download'](_0x5646c8,function(_0x13747b){if(_0x42d817){fs[_0x31bb('0x5c')](_0x5646c8);}});}}})[_0x31bb('0x47')](function(_0x47b97a){if(_0x47b97a[_0x31bb('0x5d')]===_0x31bb('0x5a')){_0xfdf8eb[_0x31bb('0x1d')](0x194)['send'](_0x31bb('0x5e'));}else{return handleError(_0xfdf8eb,null);}});};exports['downloads']=function(_0x96b02b,_0x3d9650,_0x9447b3){var _0x101c6b=require(_0x31bb('0x53'));var _0x2ca46b=![];var _0x5a3359={'$and':[db[_0x31bb('0x5f')]['where'](db[_0x31bb('0x5f')]['fn']('MD5',db['sequelize'][_0x31bb('0x60')]('uniqueid')),_0x96b02b[_0x31bb('0x36')][_0x31bb('0x61')])]};if(_0x96b02b[_0x31bb('0x36')][_0x31bb('0x30')]&&_0x96b02b[_0x31bb('0x36')][_0x31bb('0x30')]==='uniqueid'){_0x5a3359[_0x31bb('0x62')][_0x31bb('0x63')]({'uniqueid':_0x96b02b[_0x31bb('0x49')]['id']});}else{_0x5a3359[_0x31bb('0x62')]['push']({'id':_0x96b02b[_0x31bb('0x49')]['id']});}return db[_0x31bb('0x2d')]['find']({'where':_0x5a3359,'attributes':['id','value'],'raw':!![]})[_0x31bb('0x43')](handleEntityNotFound(_0x3d9650,null))[_0x31bb('0x43')](function(_0x2dc44a){if(_0x2dc44a){var _0x1a8758=util[_0x31bb('0x35')](_0x31bb('0x56'),_0x2dc44a[_0x31bb('0x55')]);if(fs[_0x31bb('0x64')](_0x1a8758)){_0x2ca46b=!![];return _0x101c6b[_0x31bb('0x57')](_0x1a8758,_0x2dc44a[_0x31bb('0x55')],config['secrets'][_0x31bb('0x65')])[_0x31bb('0x43')](function(){return _0x2dc44a;});}return _0x2dc44a;}})[_0x31bb('0x43')](function(_0x5a4772){if(_0x5a4772){if(!fs['existsSync'](_0x5a4772[_0x31bb('0x55')])){throw new db[(_0x31bb('0x58'))][(_0x31bb('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x5a4772['filename']){return _0x3d9650['download'](_0x5a4772['value'],_0x5a4772[_0x31bb('0x5b')]+path['extname'](_0x5a4772[_0x31bb('0x55')]),function(){if(_0x2ca46b){fs[_0x31bb('0x5c')](_0x5a4772['value']);}});}else{return _0x3d9650['download'](_0x5a4772['value'],function(_0x2fa57b){if(_0x2ca46b){fs[_0x31bb('0x5c')](_0x5a4772[_0x31bb('0x55')]);}});}}})[_0x31bb('0x47')](handleError(_0x3d9650,null));};exports[_0x31bb('0x28')]=function(_0x47f605,_0x598436){return db[_0x31bb('0x2d')][_0x31bb('0x4d')]({'where':{'id':_0x47f605[_0x31bb('0x49')]['id']}})[_0x31bb('0x43')](function(_0x1d2c89){if(_[_0x31bb('0x66')](_0x1d2c89)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1d2c89;})[_0x31bb('0x43')](function(_0x2d0826){var _0x23451a=_0x2d0826[_0x31bb('0x55')];logger[_0x31bb('0x67')]('cancellazione\x20fisica\x20documento\x20%s',_0x23451a);if(!_[_0x31bb('0x66')](_0x2d0826['value'])&&fs[_0x31bb('0x64')](_0x23451a)){logger[_0x31bb('0x67')](_0x31bb('0x68')+_0x23451a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x31bb('0x69')](_0x23451a);}_0x23451a=_0x23451a+_0x31bb('0x6a');if(!_['isNil'](_0x2d0826['value'])&&fs[_0x31bb('0x64')](_0x23451a)){logger[_0x31bb('0x67')]('File:\x20\x22'+_0x23451a+_0x31bb('0x6b'));fs[_0x31bb('0x69')](_0x23451a);}return _0x2d0826;})[_0x31bb('0x43')](function(_0x17153f){if(!_0x17153f)throw new InternalError();return _0x17153f[_0x31bb('0x28')]();})[_0x31bb('0x43')](function(){_0x598436[_0x31bb('0x1d')](0xcc)[_0x31bb('0x1e')]();})[_0x31bb('0x47')](handleError(_0x598436,null));};function getBucketslist(_0x5a1eb9,_0x2c36de,_0x1e9887){return new Promise(function(_0x49d6ca,_0x59122f){var _0x37ee3a=new AWS['S3']({'accessKeyId':_0x2c36de,'secretAccessKey':_0x5a1eb9,'region':_0x1e9887});_0x37ee3a[_0x31bb('0x6c')]({},function(_0x23e2d7,_0x38d7b1){if(_0x23e2d7){return _0x59122f(_0x23e2d7);}else{return _0x49d6ca(_0x38d7b1);}});});}function createBucket(_0x564147,_0x4f82ac,_0x4bbd5f,_0x4575a5){return new Promise(function(_0x4ef6ab,_0x5a10c3){var _0x2c371e=new AWS['S3']({'accessKeyId':_0x4f82ac,'secretAccessKey':_0x564147,'region':_0x4bbd5f});_0x2c371e[_0x31bb('0x6d')]({'Bucket':_0x4575a5},function(_0x7a3ca9,_0x48f9a2){if(_0x7a3ca9){return _0x5a10c3(_0x7a3ca9);}else{return _0x4ef6ab(_0x48f9a2);}});});}function uploadFile(_0x2f534d,_0x22d524,_0x5b2b39,_0x4767f4,_0x1a81b4,_0x299252){return new Promise(function(_0xe7b99e,_0x3f6aa1){var _0x441b6b=new AWS['S3']({'accessKeyId':_0x22d524,'secretAccessKey':_0x2f534d,'region':_0x5b2b39});_0x441b6b['upload']({'Bucket':_0x4767f4,'Key':_0x1a81b4,'Body':_0x299252},function(_0xcda364,_0x427410){if(_0xcda364){return _0x3f6aa1(_0xcda364);}else{return _0xe7b99e(_0x427410);}});});}function startTranscribe(_0x24cbc8,_0x4d9dbd,_0x9df47a,_0x49bb36,_0x373172,_0x3f74ad){return new Promise(function(_0x4d07d6,_0x10c8f2){var _0x5e44dc=new AWS[(_0x31bb('0x6e'))]({'accessKeyId':_0x4d9dbd,'secretAccessKey':_0x24cbc8,'region':_0x9df47a});_0x5e44dc[_0x31bb('0x6f')]({'TranscriptionJobName':_0x49bb36,'LanguageCode':_0x373172,'Media':{'MediaFileUri':_0x3f74ad}},function(_0x1e9251,_0x33289b){if(_0x1e9251){return _0x10c8f2(_0x1e9251);}else{return _0x4d07d6(_0x33289b);}});});}function transcribe(_0x2692e9,_0x12866c,_0x5ad131,_0x1aaaec,_0x141c8e,_0x5bce1f,_0x480887){return new Promise(function(_0xd36f96,_0x4c317c){var _0x441326={};logger[_0x31bb('0x67')](util[_0x31bb('0x35')](_0x31bb('0x70'),_0x2692e9,_0x141c8e));return uploadFile(_0x12866c,_0x5ad131,_0x1aaaec,_0x141c8e,path[_0x31bb('0x71')](_0x5bce1f),fs[_0x31bb('0x72')](_0x5bce1f))[_0x31bb('0x43')](function(_0x4e450b){logger[_0x31bb('0x67')](util[_0x31bb('0x35')](_0x31bb('0x73'),_0x2692e9,_0x141c8e,_0x4e450b[_0x31bb('0x74')]));_0x441326[_0x31bb('0x75')]=_0x4e450b[_0x31bb('0x76')];_0x441326['location']=_0x4e450b['Location'];logger[_0x31bb('0x67')](util[_0x31bb('0x35')](_0x31bb('0x77'),_0x2692e9));return startTranscribe(_0x12866c,_0x5ad131,_0x1aaaec,uuidv4(),_0x480887,_0x4e450b['Location']);})[_0x31bb('0x43')](function(_0x4dd6c9){logger[_0x31bb('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x2692e9,_0x4dd6c9[_0x31bb('0x78')][_0x31bb('0x79')]));_0x441326[_0x31bb('0x7a')]=_0x4dd6c9['TranscriptionJob'][_0x31bb('0x79')];_0x441326['transcribeStatus']=_0x4dd6c9[_0x31bb('0x78')][_0x31bb('0x7b')];return _0xd36f96(_0x441326);})['catch'](function(_0x309ffb){return _0x4c317c(_0x309ffb);});});}exports[_0x31bb('0x7c')]=function(_0x44887e,_0xbc7a5a,_0x54cf2c){var _0x10e7c2;var _0x521c52;var _0x695b5d;var _0x5e725c=require('../../components/encryptor');return db[_0x31bb('0x2d')][_0x31bb('0x7d')]({'where':{'id':_0x44887e['params']['id']}})[_0x31bb('0x43')](function(_0x371c74){if(_0x371c74){var _0x2cf760=util[_0x31bb('0x35')](_0x31bb('0x56'),_0x371c74[_0x31bb('0x55')]);if(fs[_0x31bb('0x64')](_0x2cf760)){cypher=!![];return _0x5e725c[_0x31bb('0x57')](_0x2cf760,_0x371c74['value'],config[_0x31bb('0x7e')]['recording'])[_0x31bb('0x43')](function(){return _0x371c74;});}return _0x371c74;}})[_0x31bb('0x43')](function(_0x361d4a){if(!_0x361d4a){throw new db[(_0x31bb('0x58'))]['ValidationError'](_0x31bb('0x7f'));}_0x521c52=_0x361d4a;return db[_0x31bb('0x80')][_0x31bb('0x7d')]({'where':{'id':0x1}});})[_0x31bb('0x43')](handleEntityNotFound(_0xbc7a5a,null))['then'](function(_0x1220c2){if(_0x1220c2){_0x10e7c2=_0x1220c2;if(!_0x10e7c2['transcribe']||!_0x10e7c2[_0x31bb('0x81')]||!_0x10e7c2['transcribeRegion']||!_0x10e7c2[_0x31bb('0x82')]||!_0x10e7c2[_0x31bb('0x75')]){throw new db[(_0x31bb('0x58'))][(_0x31bb('0x59'))](_0x31bb('0x83'));}if(_0x44887e[_0x31bb('0x4f')]['runSentiment']&&(!_0x10e7c2[_0x31bb('0x84')]||!_0x10e7c2['sentimentAccountId']||!_0x10e7c2['sentimentRegion']||!_0x10e7c2[_0x31bb('0x82')]||!_0x10e7c2[_0x31bb('0x75')])){throw new db[(_0x31bb('0x58'))]['ValidationError'](_0x31bb('0x85'));}return db[_0x31bb('0x86')][_0x31bb('0x7d')]({'where':{'id':_0x10e7c2['transcribeAccountId']}});}})[_0x31bb('0x43')](function(_0x181539){if(!_0x181539){throw new db[(_0x31bb('0x58'))][(_0x31bb('0x59'))](_0x31bb('0x87'));}if(!_0x181539[_0x31bb('0x88')]||!_0x181539[_0x31bb('0x89')]){throw new db[(_0x31bb('0x58'))][(_0x31bb('0x59'))](_0x31bb('0x8a'));}_0x695b5d=_0x181539;return getBucketslist(_0x695b5d[_0x31bb('0x88')],_0x695b5d['data2'],_0x10e7c2[_0x31bb('0x8b')]);})[_0x31bb('0x43')](function(_0x52957a){if(_0x52957a&&_0x52957a[_0x31bb('0x8c')]){var _0x95c49b=_[_0x31bb('0x4d')](_0x52957a[_0x31bb('0x8c')],function(_0x165853){return _0x165853[_0x31bb('0x8d')]===_0x10e7c2[_0x31bb('0x75')];});if(!_0x95c49b){logger[_0x31bb('0x67')](util['format'](_0x31bb('0x8e'),_0x44887e[_0x31bb('0x49')]['id'],_0x10e7c2['bucket']));return createBucket(_0x695b5d[_0x31bb('0x88')],_0x695b5d['data2'],_0x10e7c2[_0x31bb('0x8b')],_0x10e7c2[_0x31bb('0x75')]);}logger[_0x31bb('0x67')](util['format'](_0x31bb('0x8f'),_0x44887e[_0x31bb('0x49')]['id'],_0x10e7c2[_0x31bb('0x75')]));return;}})[_0x31bb('0x43')](function(_0x26e1d7){if(_0x521c52[_0x31bb('0x90')]===_0x31bb('0x91')){return transcribe(_0x44887e[_0x31bb('0x49')]['id'],_0x695b5d['data1'],_0x695b5d[_0x31bb('0x89')],_0x10e7c2['transcribeRegion'],_0x10e7c2[_0x31bb('0x75')],_0x521c52[_0x31bb('0x55')],_0x10e7c2['language']);}else{logger[_0x31bb('0x67')](util[_0x31bb('0x35')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x44887e[_0x31bb('0x49')]['id']));return{'transcribeStatus':_0x31bb('0x92')};}})[_0x31bb('0x43')](function(_0x338cd7){if(_0x338cd7){_0x338cd7['tempSentiment']=_0x44887e[_0x31bb('0x4f')][_0x31bb('0x93')];return _0x521c52['updateAttributes'](_0x338cd7);}})[_0x31bb('0x43')](respondWithResult(_0xbc7a5a,null))[_0x31bb('0x47')](handleError(_0xbc7a5a,null));};function writeFile(_0x5a32da,_0x8c5bc){return new Promise(function(_0x12a1df,_0x48aa61){fs[_0x31bb('0x94')](_0x8c5bc,_0x5a32da,function(_0x521989,_0x5b053b){if(_0x521989){return _0x48aa61(_0x521989);}else{return _0x12a1df(_0x5b053b);}});});}exports[_0x31bb('0x95')]=function(_0x17f125,_0x35c012,_0x39df64){return db[_0x31bb('0x2d')][_0x31bb('0x7d')]({'where':{'id':_0x17f125[_0x31bb('0x49')]['id']}})[_0x31bb('0x43')](handleEntityNotFound(_0x35c012))['then'](function(_0x246318){if(_0x246318&&_0x246318[_0x31bb('0x96')]){var _0x599dda=_0x246318['fileText'];var _0xa5c2c2=config[_0x31bb('0x97')]+_0x31bb('0x98')+_0x246318['id']+_0x31bb('0x99');if(fs[_0x31bb('0x64')](_0xa5c2c2)){return _0xa5c2c2;}return writeFile(_0x599dda,_0xa5c2c2)[_0x31bb('0x43')](function(){return _0xa5c2c2;});}else{throw new db[(_0x31bb('0x58'))][(_0x31bb('0x59'))](_0x31bb('0x9a'));}})[_0x31bb('0x43')](function(_0x433022){return _0x35c012[_0x31bb('0x52')](_0x433022);})[_0x31bb('0x47')](handleError(_0x35c012));}; \ No newline at end of file +var _0x3f81=['[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','bucket','Transcribe\x20not\x20configured','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','name','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','download','../../components/encryptor','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','sequelize','MD5','col','uniqueid','$and','push','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob'];(function(_0x38ee89,_0x569ee2){var _0x23c725=function(_0x1644c4){while(--_0x1644c4){_0x38ee89['push'](_0x38ee89['shift']());}};_0x23c725(++_0x569ee2);}(_0x3f81,0xc9));var _0x13f8=function(_0x23e604,_0x4832e9){_0x23e604=_0x23e604-0x0;var _0x3facac=_0x3f81[_0x23e604];return _0x3facac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13f8('0x0'));var zipdir=require(_0x13f8('0x1'));var jsonpatch=require(_0x13f8('0x2'));var rp=require('request-promise');var moment=require(_0x13f8('0x3'));var BPromise=require(_0x13f8('0x4'));var Mustache=require(_0x13f8('0x5'));var util=require(_0x13f8('0x6'));var path=require(_0x13f8('0x7'));var sox=require('sox');var csv=require(_0x13f8('0x8'));var ejs=require(_0x13f8('0x9'));var fs=require('fs');var fs_extra=require(_0x13f8('0xa'));var _=require(_0x13f8('0xb'));var squel=require(_0x13f8('0xc'));var crypto=require('crypto');var jsforce=require(_0x13f8('0xd'));var deskjs=require(_0x13f8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x13f8('0xf'));var Papa=require('papaparse');var AWS=require(_0x13f8('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0x13f8('0x11'));var authService=require(_0x13f8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x13f8('0x13'));var hardwareService=require(_0x13f8('0x14'));var logger=require(_0x13f8('0x15'))(_0x13f8('0x16'));var utils=require(_0x13f8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x13f8('0x18'));var db=require(_0x13f8('0x19'))['db'];function respondWithStatusCode(_0x7fd826,_0x1c39b6){_0x1c39b6=_0x1c39b6||0xcc;return function(_0x574ff9){if(_0x574ff9){return _0x7fd826[_0x13f8('0x1a')](_0x1c39b6);}return _0x7fd826[_0x13f8('0x1b')](_0x1c39b6)[_0x13f8('0x1c')]();};}function respondWithResult(_0x42ab1c,_0x59b845){_0x59b845=_0x59b845||0xc8;return function(_0x85eec8){if(_0x85eec8){return _0x42ab1c['status'](_0x59b845)[_0x13f8('0x1d')](_0x85eec8);}};}function respondWithFilteredResult(_0x425f8e,_0x267296){return function(_0x564c25){if(_0x564c25){var _0x242a83=typeof _0x267296[_0x13f8('0x1e')]===_0x13f8('0x1f')&&typeof _0x267296[_0x13f8('0x20')]===_0x13f8('0x1f');var _0x2461ce=_0x564c25[_0x13f8('0x21')];var _0x303a47=_0x242a83?0x0:_0x267296[_0x13f8('0x1e')];var _0x5430ca=_0x242a83?_0x564c25[_0x13f8('0x21')]:_0x267296[_0x13f8('0x1e')]+_0x267296[_0x13f8('0x20')];var _0x423911;if(_0x5430ca>=_0x2461ce){_0x5430ca=_0x2461ce;_0x423911=0xc8;}else{_0x423911=0xce;}_0x425f8e[_0x13f8('0x1b')](_0x423911);return _0x425f8e['set'](_0x13f8('0x22'),_0x303a47+'-'+_0x5430ca+'/'+_0x2461ce)['json'](_0x564c25);}return null;};}function patchUpdates(_0x31fcc3){return function(_0xe5c10c){try{jsonpatch['apply'](_0xe5c10c,_0x31fcc3,!![]);}catch(_0x2adc0c){return BPromise[_0x13f8('0x23')](_0x2adc0c);}return _0xe5c10c['save']();};}function saveUpdates(_0x1b194,_0x297675){return function(_0x5f1919){if(_0x5f1919){return _0x5f1919[_0x13f8('0x24')](_0x1b194)[_0x13f8('0x25')](function(_0x23b98d){return _0x23b98d;});}return null;};}function removeEntity(_0x4ee52b,_0x1a14d9){return function(_0x54cd93){if(_0x54cd93){return _0x54cd93[_0x13f8('0x26')]()['then'](function(){_0x4ee52b['status'](0xcc)[_0x13f8('0x1c')]();});}};}function handleEntityNotFound(_0x5b1962,_0x5b1935){return function(_0x257453){if(!_0x257453){_0x5b1962[_0x13f8('0x1a')](0x194);}return _0x257453;};}function handleError(_0x381b24,_0x49a7c2){_0x49a7c2=_0x49a7c2||0x1f4;return function(_0x551a99){logger[_0x13f8('0x27')](_0x551a99['stack']);if(_0x551a99[_0x13f8('0x28')]){delete _0x551a99[_0x13f8('0x28')];}_0x381b24[_0x13f8('0x1b')](_0x49a7c2)['send'](_0x551a99);};}exports[_0x13f8('0x29')]=function(_0x1616f9,_0xe16481){var _0x36fc58={},_0x1a7e44={},_0xf8e458={'count':0x0,'rows':[]};var _0xc96b9=_[_0x13f8('0x2a')](db[_0x13f8('0x2b')][_0x13f8('0x2c')],function(_0x1ece35){return{'name':_0x1ece35[_0x13f8('0x2d')],'type':_0x1ece35[_0x13f8('0x2e')]['key']};});_0x1a7e44[_0x13f8('0x2f')]=_[_0x13f8('0x30')](_[_0x13f8('0x2a')](_0xc96b9,_0x13f8('0x28')),[_0x13f8('0x31')]);_0x1a7e44[_0x13f8('0x32')]=_[_0x13f8('0x33')](_0x1616f9['query']);_0x1a7e44[_0x13f8('0x34')]=_[_0x13f8('0x35')](_0x1a7e44[_0x13f8('0x2f')],_0x1a7e44['query']);_0x36fc58[_0x13f8('0x36')]=_[_0x13f8('0x35')](_0x1a7e44[_0x13f8('0x2f')],qs[_0x13f8('0x37')](_0x1616f9[_0x13f8('0x32')][_0x13f8('0x37')]));_0x36fc58[_0x13f8('0x36')]=_0x36fc58[_0x13f8('0x36')]['length']?_0x36fc58[_0x13f8('0x36')]:_0x1a7e44[_0x13f8('0x2f')];if(!_0x1616f9[_0x13f8('0x32')][_0x13f8('0x38')]('nolimit')){_0x36fc58[_0x13f8('0x20')]=qs[_0x13f8('0x20')](_0x1616f9['query'][_0x13f8('0x20')]);_0x36fc58[_0x13f8('0x1e')]=qs[_0x13f8('0x1e')](_0x1616f9[_0x13f8('0x32')]['offset']);}_0x36fc58[_0x13f8('0x39')]=qs[_0x13f8('0x3a')](_0x1616f9[_0x13f8('0x32')]['sort']);_0x36fc58[_0x13f8('0x3b')]=qs[_0x13f8('0x34')](_[_0x13f8('0x3c')](_0x1616f9['query'],_0x1a7e44[_0x13f8('0x34')]),_0xc96b9);if(_0x1616f9['query']['filter']){_0x36fc58[_0x13f8('0x3b')]=_['merge'](_0x36fc58['where'],{'$or':_['map'](_0xc96b9,function(_0x464a0d){if(_0x464a0d[_0x13f8('0x2e')]!==_0x13f8('0x3d')){var _0x3901b1={};_0x3901b1[_0x464a0d[_0x13f8('0x28')]]={'$like':'%'+_0x1616f9[_0x13f8('0x32')][_0x13f8('0x3e')]+'%'};return _0x3901b1;}})});}_0x36fc58=_[_0x13f8('0x3f')]({},_0x36fc58,_0x1616f9[_0x13f8('0x40')]);var _0x526f5c={'where':_0x36fc58[_0x13f8('0x3b')]};return db[_0x13f8('0x2b')]['count'](_0x526f5c)[_0x13f8('0x25')](function(_0x3b9308){_0xf8e458[_0x13f8('0x21')]=_0x3b9308;if(_0x1616f9[_0x13f8('0x32')][_0x13f8('0x41')]){_0x36fc58[_0x13f8('0x42')]=[{'all':!![]}];}return db[_0x13f8('0x2b')][_0x13f8('0x43')](_0x36fc58);})[_0x13f8('0x25')](function(_0x41954e){_0xf8e458[_0x13f8('0x44')]=_0x41954e;return _0xf8e458;})['then'](respondWithFilteredResult(_0xe16481,_0x36fc58))[_0x13f8('0x45')](handleError(_0xe16481,null));};exports[_0x13f8('0x46')]=function(_0x5f4207,_0x66e4f6){var _0x15d657={'raw':![],'where':{'id':_0x5f4207['params']['id']}},_0x501499={};_0x501499[_0x13f8('0x2f')]=_['keys'](db[_0x13f8('0x2b')][_0x13f8('0x2c')]);_0x501499[_0x13f8('0x32')]=_[_0x13f8('0x33')](_0x5f4207[_0x13f8('0x32')]);_0x501499[_0x13f8('0x34')]=_[_0x13f8('0x35')](_0x501499[_0x13f8('0x2f')],_0x501499[_0x13f8('0x32')]);_0x15d657[_0x13f8('0x36')]=_[_0x13f8('0x35')](_0x501499['model'],qs[_0x13f8('0x37')](_0x5f4207[_0x13f8('0x32')][_0x13f8('0x37')]));_0x15d657['attributes']=_0x15d657['attributes']['length']?_0x15d657['attributes']:_0x501499[_0x13f8('0x2f')];if(_0x5f4207[_0x13f8('0x32')][_0x13f8('0x41')]){_0x15d657[_0x13f8('0x42')]=[{'all':!![]}];}_0x15d657=_[_0x13f8('0x3f')]({},_0x15d657,_0x5f4207['options']);return db[_0x13f8('0x2b')]['find'](_0x15d657)['then'](handleEntityNotFound(_0x66e4f6,null))[_0x13f8('0x25')](respondWithResult(_0x66e4f6,null))[_0x13f8('0x45')](handleError(_0x66e4f6,null));};exports[_0x13f8('0x47')]=function(_0x380efa,_0x26a617){return db[_0x13f8('0x2b')][_0x13f8('0x47')](_0x380efa['body'],{})[_0x13f8('0x25')](respondWithResult(_0x26a617,0xc9))['catch'](handleError(_0x26a617,null));};exports[_0x13f8('0x24')]=function(_0x2c8189,_0x59f4aa){if(_0x2c8189[_0x13f8('0x48')]['id']){delete _0x2c8189[_0x13f8('0x48')]['id'];}return db[_0x13f8('0x2b')][_0x13f8('0x49')]({'where':{'id':_0x2c8189[_0x13f8('0x4a')]['id']}})[_0x13f8('0x25')](handleEntityNotFound(_0x59f4aa,null))[_0x13f8('0x25')](saveUpdates(_0x2c8189[_0x13f8('0x48')],null))['then'](respondWithResult(_0x59f4aa,null))[_0x13f8('0x45')](handleError(_0x59f4aa,null));};exports[_0x13f8('0x4b')]=function(_0x349c69,_0x34fd7d){return db['VoiceRecording'][_0x13f8('0x4b')]()[_0x13f8('0x25')](respondWithResult(_0x34fd7d,null))['catch'](handleError(_0x34fd7d,null));};exports[_0x13f8('0x4c')]=function(_0x2e4646,_0x5aad9b,_0x7205f7){var _0x5be62f=require(_0x13f8('0x4d'));var _0x18aeab=![];var _0x4818d4={};if(_0x2e4646[_0x13f8('0x32')]['type']&&_0x2e4646[_0x13f8('0x32')]['type']==='uniqueid'){_0x4818d4['uniqueid']=_0x2e4646[_0x13f8('0x4a')]['id'];}else{_0x4818d4['id']=_0x2e4646[_0x13f8('0x4a')]['id'];}return db[_0x13f8('0x2b')][_0x13f8('0x49')]({'where':_0x4818d4,'attributes':['id',_0x13f8('0x4e')],'raw':!![]})[_0x13f8('0x25')](handleEntityNotFound(_0x5aad9b,null))[_0x13f8('0x25')](function(_0x4ed4b3){if(_0x4ed4b3){var _0x47cb4e=_0x4ed4b3[_0x13f8('0x4e')];var _0x3de7d9=util[_0x13f8('0x31')](_0x13f8('0x4f'),_0x47cb4e);if(fs[_0x13f8('0x50')](_0x3de7d9)){_0x18aeab=!![];return _0x5be62f[_0x13f8('0x51')](_0x3de7d9,_0x47cb4e,config[_0x13f8('0x52')][_0x13f8('0x53')])['then'](function(){return _0x4ed4b3;});}return _0x4ed4b3;}})[_0x13f8('0x25')](function(_0x58a8ff){if(_0x58a8ff){var _0x3bf231=_0x58a8ff['value'];if(!fs['existsSync'](_0x3bf231)){throw new db['Sequelize'][(_0x13f8('0x54'))]('VoiceRecording\x20not\x20found');}if(_0x58a8ff[_0x13f8('0x55')]){return _0x5aad9b[_0x13f8('0x4c')](_0x3bf231,_0x58a8ff['filename']+path[_0x13f8('0x56')](_0x3bf231),function(){if(_0x18aeab){fs[_0x13f8('0x57')](_0x3bf231);}});}else{return _0x5aad9b['download'](_0x3bf231,function(_0x59f1f8){if(_0x18aeab){fs['unlink'](_0x3bf231);}});}}})['catch'](function(_0x1214df){if(_0x1214df[_0x13f8('0x58')]===_0x13f8('0x59')){_0x5aad9b['status'](0x194)[_0x13f8('0x5a')](_0x13f8('0x5b'));}else{return handleError(_0x5aad9b,null);}});};exports[_0x13f8('0x5c')]=function(_0xae1d4e,_0x197892,_0x4303c6){var _0x2b3261=require('../../components/encryptor');var _0x4a5b02=![];var _0x5876eb={'$and':[db[_0x13f8('0x5d')][_0x13f8('0x3b')](db[_0x13f8('0x5d')]['fn'](_0x13f8('0x5e'),db[_0x13f8('0x5d')][_0x13f8('0x5f')](_0x13f8('0x60'))),_0xae1d4e['query']['token'])]};if(_0xae1d4e[_0x13f8('0x32')][_0x13f8('0x2e')]&&_0xae1d4e[_0x13f8('0x32')][_0x13f8('0x2e')]===_0x13f8('0x60')){_0x5876eb[_0x13f8('0x61')][_0x13f8('0x62')]({'uniqueid':_0xae1d4e['params']['id']});}else{_0x5876eb[_0x13f8('0x61')]['push']({'id':_0xae1d4e[_0x13f8('0x4a')]['id']});}return db[_0x13f8('0x2b')][_0x13f8('0x49')]({'where':_0x5876eb,'attributes':['id',_0x13f8('0x4e')],'raw':!![]})[_0x13f8('0x25')](handleEntityNotFound(_0x197892,null))[_0x13f8('0x25')](function(_0x1f0ac6){if(_0x1f0ac6){var _0x20c22e=util[_0x13f8('0x31')](_0x13f8('0x4f'),_0x1f0ac6[_0x13f8('0x4e')]);if(fs[_0x13f8('0x50')](_0x20c22e)){_0x4a5b02=!![];return _0x2b3261[_0x13f8('0x51')](_0x20c22e,_0x1f0ac6[_0x13f8('0x4e')],config[_0x13f8('0x52')]['recording'])['then'](function(){return _0x1f0ac6;});}return _0x1f0ac6;}})[_0x13f8('0x25')](function(_0x1c03f3){if(_0x1c03f3){if(!fs['existsSync'](_0x1c03f3[_0x13f8('0x4e')])){throw new db['Sequelize']['ValidationError'](_0x13f8('0x59'));}if(_0x1c03f3[_0x13f8('0x55')]){return _0x197892[_0x13f8('0x4c')](_0x1c03f3[_0x13f8('0x4e')],_0x1c03f3[_0x13f8('0x55')]+path['extname'](_0x1c03f3[_0x13f8('0x4e')]),function(){if(_0x4a5b02){fs[_0x13f8('0x57')](_0x1c03f3[_0x13f8('0x4e')]);}});}else{return _0x197892[_0x13f8('0x4c')](_0x1c03f3[_0x13f8('0x4e')],function(_0x21a444){if(_0x4a5b02){fs[_0x13f8('0x57')](_0x1c03f3[_0x13f8('0x4e')]);}});}}})[_0x13f8('0x45')](handleError(_0x197892,null));};exports[_0x13f8('0x26')]=function(_0x38da56,_0x2b66c7){return db[_0x13f8('0x2b')][_0x13f8('0x49')]({'where':{'id':_0x38da56['params']['id']}})[_0x13f8('0x25')](function(_0x9bdd31){if(_[_0x13f8('0x63')](_0x9bdd31)){throw new ReferenceError('Entity\x20not\x20found');}return _0x9bdd31;})['then'](function(_0x3b6bca){var _0x244a04=_0x3b6bca[_0x13f8('0x4e')];logger[_0x13f8('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x244a04);if(!_[_0x13f8('0x63')](_0x3b6bca['value'])&&fs[_0x13f8('0x50')](_0x244a04)){logger[_0x13f8('0x64')](_0x13f8('0x65')+_0x244a04+_0x13f8('0x66'));fs['unlinkSync'](_0x244a04);}_0x244a04=_0x244a04+_0x13f8('0x67');if(!_[_0x13f8('0x63')](_0x3b6bca[_0x13f8('0x4e')])&&fs['existsSync'](_0x244a04)){logger[_0x13f8('0x64')](_0x13f8('0x65')+_0x244a04+_0x13f8('0x66'));fs[_0x13f8('0x68')](_0x244a04);}return _0x3b6bca;})['then'](function(_0x166cd1){if(!_0x166cd1)throw new InternalError();return _0x166cd1[_0x13f8('0x26')]();})['then'](function(){_0x2b66c7[_0x13f8('0x1b')](0xcc)[_0x13f8('0x1c')]();})[_0x13f8('0x45')](handleError(_0x2b66c7,null));};function getBucketslist(_0xa44fc8,_0x151cec,_0x1007e4){return new Promise(function(_0x5a0071,_0x1f6da1){var _0x3fb5e4=new AWS['S3']({'accessKeyId':_0x151cec,'secretAccessKey':_0xa44fc8,'region':_0x1007e4});_0x3fb5e4[_0x13f8('0x69')]({},function(_0x29cca3,_0x52cb34){if(_0x29cca3){return _0x1f6da1(_0x29cca3);}else{return _0x5a0071(_0x52cb34);}});});}function createBucket(_0x45bb94,_0x2b65d0,_0xca7819,_0x1c6dd4){return new Promise(function(_0x268a19,_0x5023b0){var _0x519a2c=new AWS['S3']({'accessKeyId':_0x2b65d0,'secretAccessKey':_0x45bb94,'region':_0xca7819});_0x519a2c['createBucket']({'Bucket':_0x1c6dd4},function(_0x4e900c,_0x51fe4b){if(_0x4e900c){return _0x5023b0(_0x4e900c);}else{return _0x268a19(_0x51fe4b);}});});}function uploadFile(_0x56a97f,_0x52ed7a,_0x184608,_0x20406c,_0x4e9160,_0x92963){return new Promise(function(_0x11da7a,_0x1d90e1){var _0x2c0820=new AWS['S3']({'accessKeyId':_0x52ed7a,'secretAccessKey':_0x56a97f,'region':_0x184608});_0x2c0820[_0x13f8('0x6a')]({'Bucket':_0x20406c,'Key':_0x4e9160,'Body':_0x92963},function(_0x498df2,_0x19de05){if(_0x498df2){return _0x1d90e1(_0x498df2);}else{return _0x11da7a(_0x19de05);}});});}function startTranscribe(_0x3f227a,_0x261f5f,_0x523eac,_0xceb377,_0x44c11f,_0x5a0e6){return new Promise(function(_0xc7c468,_0x27c32c){var _0x9f1aad=new AWS[(_0x13f8('0x6b'))]({'accessKeyId':_0x261f5f,'secretAccessKey':_0x3f227a,'region':_0x523eac});_0x9f1aad[_0x13f8('0x6c')]({'TranscriptionJobName':_0xceb377,'LanguageCode':_0x44c11f,'Media':{'MediaFileUri':_0x5a0e6}},function(_0x153859,_0xe4e21){if(_0x153859){return _0x27c32c(_0x153859);}else{return _0xc7c468(_0xe4e21);}});});}function transcribe(_0x13560b,_0x323267,_0x1d4d2b,_0xb95c30,_0x547d6e,_0x53c56e,_0x5a7672){return new Promise(function(_0x54350b,_0x1c956c){var _0xfa17c7={};logger[_0x13f8('0x64')](util[_0x13f8('0x31')](_0x13f8('0x6d'),_0x13560b,_0x547d6e));return uploadFile(_0x323267,_0x1d4d2b,_0xb95c30,_0x547d6e,path[_0x13f8('0x6e')](_0x53c56e),fs[_0x13f8('0x6f')](_0x53c56e))[_0x13f8('0x25')](function(_0x208b14){logger[_0x13f8('0x64')](util[_0x13f8('0x31')](_0x13f8('0x70'),_0x13560b,_0x547d6e,_0x208b14[_0x13f8('0x71')]));_0xfa17c7['bucket']=_0x208b14[_0x13f8('0x72')];_0xfa17c7[_0x13f8('0x73')]=_0x208b14['Location'];logger[_0x13f8('0x64')](util[_0x13f8('0x31')](_0x13f8('0x74'),_0x13560b));return startTranscribe(_0x323267,_0x1d4d2b,_0xb95c30,uuidv4(),_0x5a7672,_0x208b14[_0x13f8('0x71')]);})['then'](function(_0x4595bf){logger[_0x13f8('0x64')](util[_0x13f8('0x31')](_0x13f8('0x75'),_0x13560b,_0x4595bf['TranscriptionJob'][_0x13f8('0x76')]));_0xfa17c7[_0x13f8('0x77')]=_0x4595bf[_0x13f8('0x78')][_0x13f8('0x76')];_0xfa17c7[_0x13f8('0x79')]=_0x4595bf[_0x13f8('0x78')][_0x13f8('0x7a')];return _0x54350b(_0xfa17c7);})[_0x13f8('0x45')](function(_0x1208db){return _0x1c956c(_0x1208db);});});}exports[_0x13f8('0x7b')]=function(_0x573ebf,_0x3e52f4,_0x4b106a){var _0x45d5fa;var _0x5a0baf;var _0x5ea45e;var _0x22eacd=require(_0x13f8('0x4d'));return db[_0x13f8('0x2b')][_0x13f8('0x7c')]({'where':{'id':_0x573ebf[_0x13f8('0x4a')]['id']}})['then'](function(_0x30ab79){if(_0x30ab79){var _0x51d45b=util[_0x13f8('0x31')]('%s.cypher',_0x30ab79['value']);if(fs[_0x13f8('0x50')](_0x51d45b)){cypher=!![];return _0x22eacd['decryptFile'](_0x51d45b,_0x30ab79[_0x13f8('0x4e')],config['secrets'][_0x13f8('0x53')])[_0x13f8('0x25')](function(){return _0x30ab79;});}return _0x30ab79;}})[_0x13f8('0x25')](function(_0x2a4787){if(!_0x2a4787){throw new db[(_0x13f8('0x7d'))][(_0x13f8('0x54'))](_0x13f8('0x7e'));}_0x5a0baf=_0x2a4787;return db[_0x13f8('0x7f')]['findOne']({'where':{'id':0x1}});})[_0x13f8('0x25')](handleEntityNotFound(_0x3e52f4,null))[_0x13f8('0x25')](function(_0xd885fc){if(_0xd885fc){_0x45d5fa=_0xd885fc;if(!_0x45d5fa['transcribe']||!_0x45d5fa['transcribeAccountId']||!_0x45d5fa[_0x13f8('0x80')]||!_0x45d5fa['language']||!_0x45d5fa[_0x13f8('0x81')]){throw new db[(_0x13f8('0x7d'))][(_0x13f8('0x54'))](_0x13f8('0x82'));}if(_0x573ebf[_0x13f8('0x48')]['runSentiment']&&(!_0x45d5fa['sentiment']||!_0x45d5fa[_0x13f8('0x83')]||!_0x45d5fa['sentimentRegion']||!_0x45d5fa[_0x13f8('0x84')]||!_0x45d5fa['bucket'])){throw new db['Sequelize'][(_0x13f8('0x54'))](_0x13f8('0x85'));}return db[_0x13f8('0x86')][_0x13f8('0x7c')]({'where':{'id':_0x45d5fa[_0x13f8('0x87')]}});}})[_0x13f8('0x25')](function(_0x321ffc){if(!_0x321ffc){throw new db[(_0x13f8('0x7d'))][(_0x13f8('0x54'))](_0x13f8('0x88'));}if(!_0x321ffc['data1']||!_0x321ffc[_0x13f8('0x89')]){throw new db[(_0x13f8('0x7d'))][(_0x13f8('0x54'))](_0x13f8('0x8a'));}_0x5ea45e=_0x321ffc;return getBucketslist(_0x5ea45e['data1'],_0x5ea45e[_0x13f8('0x89')],_0x45d5fa[_0x13f8('0x80')]);})[_0x13f8('0x25')](function(_0x7853ba){if(_0x7853ba&&_0x7853ba['Buckets']){var _0x46cd38=_[_0x13f8('0x49')](_0x7853ba[_0x13f8('0x8b')],function(_0xb708dd){return _0xb708dd[_0x13f8('0x8c')]===_0x45d5fa['bucket'];});if(!_0x46cd38){logger[_0x13f8('0x64')](util['format'](_0x13f8('0x8d'),_0x573ebf[_0x13f8('0x4a')]['id'],_0x45d5fa[_0x13f8('0x81')]));return createBucket(_0x5ea45e[_0x13f8('0x8e')],_0x5ea45e[_0x13f8('0x89')],_0x45d5fa[_0x13f8('0x80')],_0x45d5fa['bucket']);}logger[_0x13f8('0x64')](util[_0x13f8('0x31')](_0x13f8('0x8f'),_0x573ebf[_0x13f8('0x4a')]['id'],_0x45d5fa['bucket']));return;}})[_0x13f8('0x25')](function(_0x47b6e9){if(_0x5a0baf[_0x13f8('0x79')]===_0x13f8('0x90')){return transcribe(_0x573ebf[_0x13f8('0x4a')]['id'],_0x5ea45e['data1'],_0x5ea45e[_0x13f8('0x89')],_0x45d5fa[_0x13f8('0x80')],_0x45d5fa[_0x13f8('0x81')],_0x5a0baf[_0x13f8('0x4e')],_0x45d5fa[_0x13f8('0x84')]);}else{logger[_0x13f8('0x64')](util[_0x13f8('0x31')](_0x13f8('0x91'),_0x573ebf[_0x13f8('0x4a')]['id']));return{'transcribeStatus':_0x13f8('0x92')};}})['then'](function(_0x3b6fe4){if(_0x3b6fe4){_0x3b6fe4[_0x13f8('0x93')]=_0x573ebf[_0x13f8('0x48')]['runSentiment'];return _0x5a0baf[_0x13f8('0x94')](_0x3b6fe4);}})[_0x13f8('0x25')](respondWithResult(_0x3e52f4,null))['catch'](handleError(_0x3e52f4,null));};function writeFile(_0x42d0e7,_0x2a6525){return new Promise(function(_0x41f924,_0x341087){fs[_0x13f8('0x95')](_0x2a6525,_0x42d0e7,function(_0x46d403,_0x40e05a){if(_0x46d403){return _0x341087(_0x46d403);}else{return _0x41f924(_0x40e05a);}});});}exports[_0x13f8('0x96')]=function(_0x5ba60e,_0x14d892,_0x4c6cbe){return db[_0x13f8('0x2b')][_0x13f8('0x7c')]({'where':{'id':_0x5ba60e['params']['id']}})[_0x13f8('0x25')](handleEntityNotFound(_0x14d892))[_0x13f8('0x25')](function(_0x219d9d){if(_0x219d9d&&_0x219d9d[_0x13f8('0x97')]){var _0x20f32f=_0x219d9d[_0x13f8('0x97')];var _0xb4a635=config[_0x13f8('0x98')]+'/server/files/transcribes/transcribe_'+_0x219d9d['id']+_0x13f8('0x99');if(fs['existsSync'](_0xb4a635)){return _0xb4a635;}return writeFile(_0x20f32f,_0xb4a635)[_0x13f8('0x25')](function(){return _0xb4a635;});}else{throw new db[(_0x13f8('0x7d'))][(_0x13f8('0x54'))](_0x13f8('0x9a'));}})['then'](function(_0x247b18){return _0x14d892['download'](_0x247b18);})[_0x13f8('0x45')](handleError(_0x14d892));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 8e67709..114adf9 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 _0x9b9b=['exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x1ca5ea,_0x3f0586){var _0xef620e=function(_0x2b3afe){while(--_0x2b3afe){_0x1ca5ea['push'](_0x1ca5ea['shift']());}};_0xef620e(++_0x3f0586);}(_0x9b9b,0x114));var _0xb9b9=function(_0x44b5d9,_0xe28bb1){_0x44b5d9=_0x44b5d9-0x0;var _0x25d599=_0x9b9b[_0x44b5d9];return _0x25d599;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0xb9b9('0x0')]=function(_0x4980d7,_0x5010f5){return _0x4980d7[_0xb9b9('0x1')](_0xb9b9('0x2'),attributes,{'tableName':_0xb9b9('0x3'),'paranoid':![],'indexes':[{'name':_0xb9b9('0x4'),'fields':[_0xb9b9('0x4')]},{'name':_0xb9b9('0x5'),'fields':[_0xb9b9('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb30=['define','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xfb30,0x88));var _0x0fb3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfb30[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0x0fb3('0x0'));module[_0x0fb3('0x1')]=function(_0x5959c9,_0x49d250){return _0x5959c9[_0x0fb3('0x2')]('VoiceRecording',attributes,{'tableName':_0x0fb3('0x3'),'paranoid':![],'indexes':[{'name':_0x0fb3('0x4'),'fields':[_0x0fb3('0x4')]},{'name':_0x0fb3('0x5'),'fields':[_0x0fb3('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 7c002cb..6a35ebc 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 _0xcaf2=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','recording','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','VoiceRecording','body','options','raw','where','attributes','limit','UpdateVoiceRecording','stringify','catch'];(function(_0x51a10b,_0x48dfd2){var _0x5a4349=function(_0x4038e5){while(--_0x4038e5){_0x51a10b['push'](_0x51a10b['shift']());}};_0x5a4349(++_0x48dfd2);}(_0xcaf2,0x8a));var _0x2caf=function(_0x4b366e,_0x479e1f){_0x4b366e=_0x4b366e-0x0;var _0x464dff=_0xcaf2[_0x4b366e];return _0x464dff;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc44e4e,_0x314486,_0x4667c6){return new BPromise(function(_0x34e792,_0x5611aa){return client[_0x2caf('0x9')](_0xc44e4e,_0x4667c6)[_0x2caf('0xa')](function(_0x45e520){logger[_0x2caf('0xb')](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));logger[_0x2caf('0xe')](_0x2caf('0xf'),_0x314486,_0x2caf('0xd'),JSON['stringify'](_0x45e520));if(_0x45e520[_0x2caf('0x10')]){if(_0x45e520[_0x2caf('0x10')][_0x2caf('0x11')]===0x1f4){logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520[_0x2caf('0x10')][_0x2caf('0x12')]);return _0x5611aa(_0x45e520[_0x2caf('0x10')]['message']);}logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520['error']['message']);return _0x34e792(_0x45e520['error'][_0x2caf('0x12')]);}else{logger['info'](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));_0x34e792(_0x45e520[_0x2caf('0x13')][_0x2caf('0x12')]);}})['catch'](function(_0x184355){logger['error'](_0x2caf('0xc'),_0x314486,_0x184355);_0x5611aa(_0x184355);});});}exports['UpdateVoiceRecording']=function(_0x4a33fc){var _0x3e975f=this;return new Promise(function(_0x58047b,_0xe72440){return db[_0x2caf('0x14')]['update'](_0x4a33fc[_0x2caf('0x15')],{'raw':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc['options'][_0x2caf('0x18')]||null:null,'attributes':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x19')]||null:null,'limit':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x1a')]||null:null})[_0x2caf('0xa')](function(_0x3332b1){logger[_0x2caf('0xb')](_0x2caf('0x1b'),_0x4a33fc);logger['debug'](_0x2caf('0x1b'),_0x4a33fc,JSON[_0x2caf('0x1c')](_0x3332b1));_0x58047b(_0x3332b1);})[_0x2caf('0x1d')](function(_0x401ea2){logger[_0x2caf('0x10')](_0x2caf('0x1b'),_0x401ea2[_0x2caf('0x12')],_0x4a33fc);_0xe72440(_0x3e975f[_0x2caf('0x10')](0x1f4,_0x401ea2[_0x2caf('0x12')]));});});};exports[_0x2caf('0x1e')]=function(_0x5ad211){var _0x6a32ac=this;return new Promise(function(_0x325eda,_0xbefce6){var _0x37b08f=require(_0x2caf('0x1f'));var _0x17d3c6;return db[_0x2caf('0x20')][_0x2caf('0x21')]({'attributes':['id',_0x2caf('0x22')],'where':{'id':0x1},'raw':!![]})[_0x2caf('0xa')](function(_0x30da75){_0x17d3c6=_0x30da75;return db[_0x2caf('0x14')][_0x2caf('0x23')](_0x5ad211['body']);})[_0x2caf('0xa')](function(_0xda0ec5){if(_0x17d3c6[_0x2caf('0x22')]&&fs[_0x2caf('0x24')](_0xda0ec5[_0x2caf('0x25')])){var _0x1f52bf=util[_0x2caf('0x26')]('%s.cypher',_0xda0ec5[_0x2caf('0x25')]);return _0x37b08f[_0x2caf('0x27')](_0xda0ec5['value'],_0x1f52bf,config[_0x2caf('0x28')][_0x2caf('0x29')])[_0x2caf('0xa')](function(){fs['unlink'](_0xda0ec5[_0x2caf('0x25')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0xda0ec5;});}return _0xda0ec5;})[_0x2caf('0xa')](function(_0x28b715){logger[_0x2caf('0xb')](_0x2caf('0x1e'),_0x5ad211);logger[_0x2caf('0xe')](_0x2caf('0x1e'),_0x5ad211,JSON[_0x2caf('0x1c')](_0x28b715));_0x325eda(_0x28b715);})[_0x2caf('0x1d')](function(_0x20818e){logger['error'](_0x2caf('0x1e'),_0x20818e[_0x2caf('0x12')],_0x5ad211);_0xbefce6(_0x6a32ac[_0x2caf('0x10')](0x1f4,_0x20818e[_0x2caf('0x12')]));});});}; \ No newline at end of file +var _0x5430=['info','request\x20sent','debug','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','UpdateVoiceRecording','VoiceRecording','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','format','%s.cypher','value','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x2b904e,_0x38631c){var _0x27bba0=function(_0x1b0195){while(--_0x1b0195){_0x2b904e['push'](_0x2b904e['shift']());}};_0x27bba0(++_0x38631c);}(_0x5430,0x10c));var _0x0543=function(_0x953c45,_0x16a9a0){_0x953c45=_0x953c45-0x0;var _0x10ea03=_0x5430[_0x953c45];return _0x10ea03;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['update'](_0x20b396['body'],{'raw':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b396['options']?_0x20b396[_0x0543('0x17')]['where']||null:null,'attributes':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')]['attributes']||null:null,'limit':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x19')]||null:null})[_0x0543('0xb')](function(_0x37347e){logger[_0x0543('0xc')]('UpdateVoiceRecording',_0x20b396);logger['debug']('UpdateVoiceRecording',_0x20b396,JSON[_0x0543('0xf')](_0x37347e));_0x577cf0(_0x37347e);})[_0x0543('0x1a')](function(_0x15ebeb){logger[_0x0543('0x10')](_0x0543('0x15'),_0x15ebeb[_0x0543('0x13')],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x15ebeb[_0x0543('0x13')]));});});};exports[_0x0543('0x1b')]=function(_0xf1eccf){var _0x40a261=this;return new Promise(function(_0x21fc63,_0x547a88){var _0x25e6f1=require(_0x0543('0x1c'));var _0x30ad9e;return db['Setting'][_0x0543('0x1d')]({'attributes':['id',_0x0543('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0543('0xb')](function(_0x10b881){_0x30ad9e=_0x10b881;return db['VoiceRecording'][_0x0543('0x1f')](_0xf1eccf[_0x0543('0x20')]);})['then'](function(_0x576084){if(_0x30ad9e[_0x0543('0x1e')]&&fs[_0x0543('0x21')](_0x576084['value'])){var _0x3b879b=util[_0x0543('0x22')](_0x0543('0x23'),_0x576084[_0x0543('0x24')]);return _0x25e6f1[_0x0543('0x25')](_0x576084[_0x0543('0x24')],_0x3b879b,config[_0x0543('0x26')]['recording'])[_0x0543('0xb')](function(){fs['unlink'](_0x576084[_0x0543('0x24')]);logger[_0x0543('0xc')](_0x0543('0x27'));return _0x576084;});}return _0x576084;})[_0x0543('0xb')](function(_0x28307f){logger['info'](_0x0543('0x1b'),_0xf1eccf);logger['debug'](_0x0543('0x1b'),_0xf1eccf,JSON[_0x0543('0xf')](_0x28307f));_0x21fc63(_0x28307f);})[_0x0543('0x1a')](function(_0x327027){logger['error'](_0x0543('0x1b'),_0x327027['message'],_0xf1eccf);_0x547a88(_0x40a261[_0x0543('0x10')](0x1f4,_0x327027[_0x0543('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 58eb9f6..0a64cc3 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 _0x3ee9=['index','/describe','describe','get','/:id','show','post','put','update','delete','destroy','exports','path','express','Router','fs-extra','isAuthenticated'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0x3ee9,0xfa));var _0x93ee=function(_0x48845d,_0x4338c2){_0x48845d=_0x48845d-0x0;var _0x5bad7d=_0x3ee9[_0x48845d];return _0x5bad7d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x93ee('0x0'));var timeout=require('connect-timeout');var express=require(_0x93ee('0x1'));var router=express[_0x93ee('0x2')]();var fs_extra=require(_0x93ee('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0x93ee('0x4')](),controller[_0x93ee('0x5')]);router['get'](_0x93ee('0x6'),auth['isAuthenticated'](),controller[_0x93ee('0x7')]);router[_0x93ee('0x8')](_0x93ee('0x9'),auth[_0x93ee('0x4')](),controller[_0x93ee('0xa')]);router[_0x93ee('0xb')]('/',auth[_0x93ee('0x4')](),controller['create']);router[_0x93ee('0xc')](_0x93ee('0x9'),auth[_0x93ee('0x4')](),controller[_0x93ee('0xd')]);router[_0x93ee('0xe')](_0x93ee('0x9'),auth['isAuthenticated'](),controller[_0x93ee('0xf')]);module[_0x93ee('0x10')]=router; \ No newline at end of file +var _0xeb45=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x22773f,_0x1ea73e){var _0x428a21=function(_0x423ea9){while(--_0x423ea9){_0x22773f['push'](_0x22773f['shift']());}};_0x428a21(++_0x1ea73e);}(_0xeb45,0xe4));var _0x5eb4=function(_0xc94e4,_0x462e59){_0xc94e4=_0xc94e4-0x0;var _0x4c4785=_0xeb45[_0xc94e4];return _0x4c4785;};'use strict';var multer=require('multer');var util=require(_0x5eb4('0x0'));var path=require(_0x5eb4('0x1'));var timeout=require(_0x5eb4('0x2'));var express=require(_0x5eb4('0x3'));var router=express[_0x5eb4('0x4')]();var fs_extra=require(_0x5eb4('0x5'));var auth=require(_0x5eb4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5eb4('0x7'));var controller=require(_0x5eb4('0x8'));router[_0x5eb4('0x9')]('/',auth[_0x5eb4('0xa')](),controller[_0x5eb4('0xb')]);router[_0x5eb4('0x9')](_0x5eb4('0xc'),auth[_0x5eb4('0xa')](),controller['describe']);router[_0x5eb4('0x9')](_0x5eb4('0xd'),auth[_0x5eb4('0xa')](),controller[_0x5eb4('0xe')]);router[_0x5eb4('0xf')]('/',auth[_0x5eb4('0xa')](),controller[_0x5eb4('0x10')]);router[_0x5eb4('0x11')](_0x5eb4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5eb4('0x12')](_0x5eb4('0xd'),auth[_0x5eb4('0xa')](),controller[_0x5eb4('0x13')]);module[_0x5eb4('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b293d8d..6ee84fd 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 _0x9bb4=['ENUM','blind','attended','STRING','Yes','sequelize','moment','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9bb4,0xd5));var _0x49bb=function(_0x51885c,_0x1c9186){_0x51885c=_0x51885c-0x0;var _0x101cab=_0x9bb4[_0x51885c];return _0x101cab;};'use strict';var Sequelize=require(_0x49bb('0x0'));var moment=require(_0x49bb('0x1'));module[_0x49bb('0x2')]={'type':{'type':Sequelize[_0x49bb('0x3')](_0x49bb('0x4'),_0x49bb('0x5'))},'result':{'type':Sequelize[_0x49bb('0x6')]},'transfererchannel':{'type':Sequelize[_0x49bb('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x49bb('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x49bb('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x49bb('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x49bb('0x6')]},'transferercontext':{'type':Sequelize[_0x49bb('0x6')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x49bb('0x6')]},'transfereechannel':{'type':Sequelize[_0x49bb('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x49bb('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x49bb('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x49bb('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x49bb('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x49bb('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x49bb('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0x49bb('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfc78=['blind','STRING','Yes','sequelize','exports','ENUM'];(function(_0x1e2bdd,_0xab0204){var _0x525b17=function(_0x797897){while(--_0x797897){_0x1e2bdd['push'](_0x1e2bdd['shift']());}};_0x525b17(++_0xab0204);}(_0xfc78,0xc3));var _0x8fc7=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xfc78[_0x1da04e];return _0xdd8c41;};'use strict';var Sequelize=require(_0x8fc7('0x0'));var moment=require('moment');module[_0x8fc7('0x1')]={'type':{'type':Sequelize[_0x8fc7('0x2')](_0x8fc7('0x3'),'attended')},'result':{'type':Sequelize[_0x8fc7('0x4')]},'transfererchannel':{'type':Sequelize[_0x8fc7('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x8fc7('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x8fc7('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x8fc7('0x4')]},'transfereechannel':{'type':Sequelize[_0x8fc7('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x8fc7('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x8fc7('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8fc7('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x8fc7('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x8fc7('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x8fc7('0x4')]},'isexternal':{'type':Sequelize[_0x8fc7('0x2')](_0x8fc7('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8fc7('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 13de152..887d5a7 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 _0xb8d4=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x380498,_0x51b6ae){var _0x2e0dfe=function(_0x172e97){while(--_0x172e97){_0x380498['push'](_0x380498['shift']());}};_0x2e0dfe(++_0x51b6ae);}(_0xb8d4,0x1b4));var _0x4b8d=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb8d4[_0x342700];return _0x53406f;};'use strict';var emlformat=require(_0x4b8d('0x0'));var rimraf=require(_0x4b8d('0x1'));var zipdir=require(_0x4b8d('0x2'));var jsonpatch=require(_0x4b8d('0x3'));var rp=require(_0x4b8d('0x4'));var moment=require(_0x4b8d('0x5'));var BPromise=require(_0x4b8d('0x6'));var Mustache=require(_0x4b8d('0x7'));var util=require(_0x4b8d('0x8'));var path=require(_0x4b8d('0x9'));var sox=require(_0x4b8d('0xa'));var csv=require(_0x4b8d('0xb'));var ejs=require(_0x4b8d('0xc'));var fs=require('fs');var fs_extra=require(_0x4b8d('0xd'));var _=require(_0x4b8d('0xe'));var squel=require(_0x4b8d('0xf'));var crypto=require(_0x4b8d('0x10'));var jsforce=require(_0x4b8d('0x11'));var deskjs=require(_0x4b8d('0x12'));var toCsv=require(_0x4b8d('0xb'));var querystring=require(_0x4b8d('0x13'));var Papa=require('papaparse');var Redis=require(_0x4b8d('0x14'));var authService=require(_0x4b8d('0x15'));var qs=require(_0x4b8d('0x16'));var as=require(_0x4b8d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4b8d('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b8d('0x19'))['db'];function respondWithStatusCode(_0x41cafd,_0x1c19c3){_0x1c19c3=_0x1c19c3||0xcc;return function(_0x38cc09){if(_0x38cc09){return _0x41cafd['sendStatus'](_0x1c19c3);}return _0x41cafd[_0x4b8d('0x1a')](_0x1c19c3)[_0x4b8d('0x1b')]();};}function respondWithResult(_0x2eb2da,_0xd5a8b1){_0xd5a8b1=_0xd5a8b1||0xc8;return function(_0x58b0ee){if(_0x58b0ee){return _0x2eb2da[_0x4b8d('0x1a')](_0xd5a8b1)[_0x4b8d('0x1c')](_0x58b0ee);}};}function respondWithFilteredResult(_0x47f561,_0x13ca52){return function(_0x380298){if(_0x380298){var _0x393b20=typeof _0x13ca52[_0x4b8d('0x1d')]===_0x4b8d('0x1e')&&typeof _0x13ca52[_0x4b8d('0x1f')]===_0x4b8d('0x1e');var _0x2fd14e=_0x380298[_0x4b8d('0x20')];var _0x3becea=_0x393b20?0x0:_0x13ca52[_0x4b8d('0x1d')];var _0x2271c3=_0x393b20?_0x380298[_0x4b8d('0x20')]:_0x13ca52[_0x4b8d('0x1d')]+_0x13ca52[_0x4b8d('0x1f')];var _0x22b593;if(_0x2271c3>=_0x2fd14e){_0x2271c3=_0x2fd14e;_0x22b593=0xc8;}else{_0x22b593=0xce;}_0x47f561[_0x4b8d('0x1a')](_0x22b593);return _0x47f561[_0x4b8d('0x21')]('Content-Range',_0x3becea+'-'+_0x2271c3+'/'+_0x2fd14e)[_0x4b8d('0x1c')](_0x380298);}return null;};}function patchUpdates(_0x791181){return function(_0x18261b){try{jsonpatch[_0x4b8d('0x22')](_0x18261b,_0x791181,!![]);}catch(_0x552060){return BPromise['reject'](_0x552060);}return _0x18261b[_0x4b8d('0x23')]();};}function saveUpdates(_0x3799b9,_0x7911db){return function(_0x3f3676){if(_0x3f3676){return _0x3f3676[_0x4b8d('0x24')](_0x3799b9)[_0x4b8d('0x25')](function(_0x53896a){return _0x53896a;});}return null;};}function removeEntity(_0x2f68fc,_0x5df5c2){return function(_0x2f3a80){if(_0x2f3a80){return _0x2f3a80[_0x4b8d('0x26')]()[_0x4b8d('0x25')](function(){_0x2f68fc[_0x4b8d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5add57,_0x4094ac){return function(_0x17f8d3){if(!_0x17f8d3){_0x5add57[_0x4b8d('0x27')](0x194);}return _0x17f8d3;};}function handleError(_0x47bc00,_0x2dd675){_0x2dd675=_0x2dd675||0x1f4;return function(_0x49db0d){logger[_0x4b8d('0x28')](_0x49db0d['stack']);if(_0x49db0d[_0x4b8d('0x29')]){delete _0x49db0d[_0x4b8d('0x29')];}_0x47bc00[_0x4b8d('0x1a')](_0x2dd675)[_0x4b8d('0x2a')](_0x49db0d);};}exports[_0x4b8d('0x2b')]=function(_0xc4576e,_0x4fbd54){var _0x59a27d={},_0x300267={},_0x2007b7={'count':0x0,'rows':[]};var _0x1e018e=_['map'](db[_0x4b8d('0x2c')][_0x4b8d('0x2d')],function(_0x2579bc){return{'name':_0x2579bc[_0x4b8d('0x2e')],'type':_0x2579bc[_0x4b8d('0x2f')]['key']};});_0x300267[_0x4b8d('0x30')]=_[_0x4b8d('0x31')](_0x1e018e,_0x4b8d('0x29'));_0x300267[_0x4b8d('0x32')]=_[_0x4b8d('0x33')](_0xc4576e[_0x4b8d('0x32')]);_0x300267[_0x4b8d('0x34')]=_[_0x4b8d('0x35')](_0x300267[_0x4b8d('0x30')],_0x300267[_0x4b8d('0x32')]);_0x59a27d[_0x4b8d('0x36')]=_['intersection'](_0x300267['model'],qs['fields'](_0xc4576e[_0x4b8d('0x32')][_0x4b8d('0x37')]));_0x59a27d[_0x4b8d('0x36')]=_0x59a27d[_0x4b8d('0x36')]['length']?_0x59a27d[_0x4b8d('0x36')]:_0x300267['model'];if(!_0xc4576e['query']['hasOwnProperty'](_0x4b8d('0x38'))){_0x59a27d[_0x4b8d('0x1f')]=qs[_0x4b8d('0x1f')](_0xc4576e['query'][_0x4b8d('0x1f')]);_0x59a27d[_0x4b8d('0x1d')]=qs['offset'](_0xc4576e[_0x4b8d('0x32')]['offset']);}_0x59a27d[_0x4b8d('0x39')]=qs[_0x4b8d('0x3a')](_0xc4576e['query'][_0x4b8d('0x3a')]);_0x59a27d[_0x4b8d('0x3b')]=qs[_0x4b8d('0x34')](_['pick'](_0xc4576e[_0x4b8d('0x32')],_0x300267[_0x4b8d('0x34')]),_0x1e018e);if(_0xc4576e[_0x4b8d('0x32')][_0x4b8d('0x3c')]){_0x59a27d[_0x4b8d('0x3b')]=_[_0x4b8d('0x3d')](_0x59a27d['where'],{'$or':_[_0x4b8d('0x31')](_0x1e018e,function(_0x18e5f0){if(_0x18e5f0[_0x4b8d('0x2f')]!==_0x4b8d('0x3e')){var _0x203e16={};_0x203e16[_0x18e5f0['name']]={'$like':'%'+_0xc4576e[_0x4b8d('0x32')][_0x4b8d('0x3c')]+'%'};return _0x203e16;}})});}_0x59a27d=_[_0x4b8d('0x3d')]({},_0x59a27d,_0xc4576e['options']);var _0x240bea={'where':_0x59a27d[_0x4b8d('0x3b')]};return db[_0x4b8d('0x2c')][_0x4b8d('0x20')](_0x240bea)[_0x4b8d('0x25')](function(_0x6e1ba8){_0x2007b7[_0x4b8d('0x20')]=_0x6e1ba8;if(_0xc4576e['query'][_0x4b8d('0x3f')]){_0x59a27d[_0x4b8d('0x40')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x4b8d('0x41')](_0x59a27d);})[_0x4b8d('0x25')](function(_0x20781a){_0x2007b7[_0x4b8d('0x42')]=_0x20781a;return _0x2007b7;})[_0x4b8d('0x25')](respondWithFilteredResult(_0x4fbd54,_0x59a27d))[_0x4b8d('0x43')](handleError(_0x4fbd54,null));};exports[_0x4b8d('0x44')]=function(_0x1ee512,_0x21c223){var _0x451280={'raw':!![],'where':{'id':_0x1ee512[_0x4b8d('0x45')]['id']}},_0x57684c={};_0x57684c[_0x4b8d('0x30')]=_['keys'](db['VoiceTransferReport'][_0x4b8d('0x2d')]);_0x57684c[_0x4b8d('0x32')]=_[_0x4b8d('0x33')](_0x1ee512[_0x4b8d('0x32')]);_0x57684c[_0x4b8d('0x34')]=_['intersection'](_0x57684c[_0x4b8d('0x30')],_0x57684c[_0x4b8d('0x32')]);_0x451280['attributes']=_[_0x4b8d('0x35')](_0x57684c[_0x4b8d('0x30')],qs[_0x4b8d('0x37')](_0x1ee512[_0x4b8d('0x32')][_0x4b8d('0x37')]));_0x451280[_0x4b8d('0x36')]=_0x451280['attributes']['length']?_0x451280['attributes']:_0x57684c['model'];if(_0x1ee512['query']['includeAll']){_0x451280[_0x4b8d('0x40')]=[{'all':!![]}];}_0x451280=_[_0x4b8d('0x3d')]({},_0x451280,_0x1ee512[_0x4b8d('0x46')]);return db[_0x4b8d('0x2c')][_0x4b8d('0x47')](_0x451280)[_0x4b8d('0x25')](handleEntityNotFound(_0x21c223,null))[_0x4b8d('0x25')](respondWithResult(_0x21c223,null))[_0x4b8d('0x43')](handleError(_0x21c223,null));};exports[_0x4b8d('0x48')]=function(_0x277357,_0x17c62f){return db[_0x4b8d('0x2c')][_0x4b8d('0x48')](_0x277357['body'],{})[_0x4b8d('0x25')](respondWithResult(_0x17c62f,0xc9))[_0x4b8d('0x43')](handleError(_0x17c62f,null));};exports[_0x4b8d('0x24')]=function(_0x3fc2f8,_0x988bf){if(_0x3fc2f8[_0x4b8d('0x49')]['id']){delete _0x3fc2f8[_0x4b8d('0x49')]['id'];}return db[_0x4b8d('0x2c')][_0x4b8d('0x47')]({'where':{'id':_0x3fc2f8['params']['id']}})[_0x4b8d('0x25')](handleEntityNotFound(_0x988bf,null))[_0x4b8d('0x25')](saveUpdates(_0x3fc2f8[_0x4b8d('0x49')],null))[_0x4b8d('0x25')](respondWithResult(_0x988bf,null))[_0x4b8d('0x43')](handleError(_0x988bf,null));};exports[_0x4b8d('0x26')]=function(_0x55dd8b,_0x24c841){return db[_0x4b8d('0x2c')][_0x4b8d('0x47')]({'where':{'id':_0x55dd8b[_0x4b8d('0x45')]['id']}})['then'](handleEntityNotFound(_0x24c841,null))[_0x4b8d('0x25')](removeEntity(_0x24c841,null))['catch'](handleError(_0x24c841,null));};exports[_0x4b8d('0x4a')]=function(_0x2d7151,_0x5ef716){return db['VoiceTransferReport'][_0x4b8d('0x4a')]()[_0x4b8d('0x25')](respondWithResult(_0x5ef716,null))[_0x4b8d('0x43')](handleError(_0x5ef716,null));}; \ No newline at end of file +var _0x8877=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','key','keys','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0xd98ca3,_0x38fbd9){var _0x35960d=function(_0x52e8ee){while(--_0x52e8ee){_0xd98ca3['push'](_0xd98ca3['shift']());}};_0x35960d(++_0x38fbd9);}(_0x8877,0x98));var _0x7887=function(_0x5f3df5,_0x1fb80b){_0x5f3df5=_0x5f3df5-0x0;var _0xbd71c0=_0x8877[_0x5f3df5];return _0xbd71c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7887('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7887('0x1'));var rp=require(_0x7887('0x2'));var moment=require(_0x7887('0x3'));var BPromise=require(_0x7887('0x4'));var Mustache=require('mustache');var util=require(_0x7887('0x5'));var path=require(_0x7887('0x6'));var sox=require(_0x7887('0x7'));var csv=require(_0x7887('0x8'));var ejs=require(_0x7887('0x9'));var fs=require('fs');var fs_extra=require(_0x7887('0xa'));var _=require('lodash');var squel=require(_0x7887('0xb'));var crypto=require(_0x7887('0xc'));var jsforce=require(_0x7887('0xd'));var deskjs=require(_0x7887('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7887('0xf'));var Papa=require('papaparse');var Redis=require(_0x7887('0x10'));var authService=require(_0x7887('0x11'));var qs=require(_0x7887('0x12'));var as=require(_0x7887('0x13'));var hardwareService=require(_0x7887('0x14'));var logger=require(_0x7887('0x15'))(_0x7887('0x16'));var utils=require(_0x7887('0x17'));var config=require(_0x7887('0x18'));var licenseUtil=require(_0x7887('0x19'));var db=require(_0x7887('0x1a'))['db'];function respondWithStatusCode(_0x4c3b65,_0x39c10a){_0x39c10a=_0x39c10a||0xcc;return function(_0x43748b){if(_0x43748b){return _0x4c3b65[_0x7887('0x1b')](_0x39c10a);}return _0x4c3b65[_0x7887('0x1c')](_0x39c10a)[_0x7887('0x1d')]();};}function respondWithResult(_0x432ac0,_0x31c1d5){_0x31c1d5=_0x31c1d5||0xc8;return function(_0x78f039){if(_0x78f039){return _0x432ac0['status'](_0x31c1d5)[_0x7887('0x1e')](_0x78f039);}};}function respondWithFilteredResult(_0x2980a4,_0x4a4f99){return function(_0x327d95){if(_0x327d95){var _0x4aa091=typeof _0x4a4f99[_0x7887('0x1f')]===_0x7887('0x20')&&typeof _0x4a4f99['limit']==='undefined';var _0x454f15=_0x327d95[_0x7887('0x21')];var _0xf5bf8d=_0x4aa091?0x0:_0x4a4f99[_0x7887('0x1f')];var _0x1e261a=_0x4aa091?_0x327d95['count']:_0x4a4f99['offset']+_0x4a4f99[_0x7887('0x22')];var _0x2d7000;if(_0x1e261a>=_0x454f15){_0x1e261a=_0x454f15;_0x2d7000=0xc8;}else{_0x2d7000=0xce;}_0x2980a4[_0x7887('0x1c')](_0x2d7000);return _0x2980a4[_0x7887('0x23')](_0x7887('0x24'),_0xf5bf8d+'-'+_0x1e261a+'/'+_0x454f15)[_0x7887('0x1e')](_0x327d95);}return null;};}function patchUpdates(_0x372a27){return function(_0x12cbe6){try{jsonpatch[_0x7887('0x25')](_0x12cbe6,_0x372a27,!![]);}catch(_0x1ac8a3){return BPromise[_0x7887('0x26')](_0x1ac8a3);}return _0x12cbe6[_0x7887('0x27')]();};}function saveUpdates(_0x4eb38,_0xa3230e){return function(_0x584e26){if(_0x584e26){return _0x584e26[_0x7887('0x28')](_0x4eb38)[_0x7887('0x29')](function(_0x110832){return _0x110832;});}return null;};}function removeEntity(_0x4d80c1,_0x1afbbc){return function(_0x724f7c){if(_0x724f7c){return _0x724f7c[_0x7887('0x2a')]()[_0x7887('0x29')](function(){_0x4d80c1[_0x7887('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15c06f,_0x3a7fac){return function(_0xd64d46){if(!_0xd64d46){_0x15c06f[_0x7887('0x1b')](0x194);}return _0xd64d46;};}function handleError(_0x30d51f,_0x3796ed){_0x3796ed=_0x3796ed||0x1f4;return function(_0x286126){logger[_0x7887('0x2b')](_0x286126[_0x7887('0x2c')]);if(_0x286126['name']){delete _0x286126[_0x7887('0x2d')];}_0x30d51f[_0x7887('0x1c')](_0x3796ed)[_0x7887('0x2e')](_0x286126);};}exports[_0x7887('0x2f')]=function(_0x4dc07f,_0x3901b4){var _0x267aae={},_0x4481ca={},_0x1a18dd={'count':0x0,'rows':[]};var _0x297b2a=_[_0x7887('0x30')](db[_0x7887('0x31')][_0x7887('0x32')],function(_0xa0036){return{'name':_0xa0036['fieldName'],'type':_0xa0036['type'][_0x7887('0x33')]};});_0x4481ca['model']=_[_0x7887('0x30')](_0x297b2a,'name');_0x4481ca['query']=_[_0x7887('0x34')](_0x4dc07f[_0x7887('0x35')]);_0x4481ca[_0x7887('0x36')]=_['intersection'](_0x4481ca[_0x7887('0x37')],_0x4481ca[_0x7887('0x35')]);_0x267aae['attributes']=_[_0x7887('0x38')](_0x4481ca[_0x7887('0x37')],qs['fields'](_0x4dc07f[_0x7887('0x35')][_0x7887('0x39')]));_0x267aae[_0x7887('0x3a')]=_0x267aae[_0x7887('0x3a')]['length']?_0x267aae[_0x7887('0x3a')]:_0x4481ca[_0x7887('0x37')];if(!_0x4dc07f[_0x7887('0x35')][_0x7887('0x3b')](_0x7887('0x3c'))){_0x267aae[_0x7887('0x22')]=qs[_0x7887('0x22')](_0x4dc07f[_0x7887('0x35')][_0x7887('0x22')]);_0x267aae[_0x7887('0x1f')]=qs['offset'](_0x4dc07f[_0x7887('0x35')][_0x7887('0x1f')]);}_0x267aae[_0x7887('0x3d')]=qs[_0x7887('0x3e')](_0x4dc07f[_0x7887('0x35')]['sort']);_0x267aae['where']=qs['filters'](_[_0x7887('0x3f')](_0x4dc07f[_0x7887('0x35')],_0x4481ca[_0x7887('0x36')]),_0x297b2a);if(_0x4dc07f[_0x7887('0x35')][_0x7887('0x40')]){_0x267aae[_0x7887('0x41')]=_[_0x7887('0x42')](_0x267aae['where'],{'$or':_['map'](_0x297b2a,function(_0x13233a){if(_0x13233a[_0x7887('0x43')]!==_0x7887('0x44')){var _0xa05826={};_0xa05826[_0x13233a[_0x7887('0x2d')]]={'$like':'%'+_0x4dc07f['query'][_0x7887('0x40')]+'%'};return _0xa05826;}})});}_0x267aae=_[_0x7887('0x42')]({},_0x267aae,_0x4dc07f[_0x7887('0x45')]);var _0x1a4481={'where':_0x267aae[_0x7887('0x41')]};return db[_0x7887('0x31')]['count'](_0x1a4481)[_0x7887('0x29')](function(_0x23b61b){_0x1a18dd['count']=_0x23b61b;if(_0x4dc07f[_0x7887('0x35')][_0x7887('0x46')]){_0x267aae[_0x7887('0x47')]=[{'all':!![]}];}return db[_0x7887('0x31')][_0x7887('0x48')](_0x267aae);})['then'](function(_0x52d1d6){_0x1a18dd[_0x7887('0x49')]=_0x52d1d6;return _0x1a18dd;})[_0x7887('0x29')](respondWithFilteredResult(_0x3901b4,_0x267aae))[_0x7887('0x4a')](handleError(_0x3901b4,null));};exports['show']=function(_0x4ba9a2,_0xcee516){var _0x426677={'raw':!![],'where':{'id':_0x4ba9a2[_0x7887('0x4b')]['id']}},_0x10fa6a={};_0x10fa6a[_0x7887('0x37')]=_[_0x7887('0x34')](db[_0x7887('0x31')][_0x7887('0x32')]);_0x10fa6a[_0x7887('0x35')]=_[_0x7887('0x34')](_0x4ba9a2[_0x7887('0x35')]);_0x10fa6a['filters']=_['intersection'](_0x10fa6a['model'],_0x10fa6a[_0x7887('0x35')]);_0x426677[_0x7887('0x3a')]=_[_0x7887('0x38')](_0x10fa6a[_0x7887('0x37')],qs[_0x7887('0x39')](_0x4ba9a2[_0x7887('0x35')][_0x7887('0x39')]));_0x426677[_0x7887('0x3a')]=_0x426677[_0x7887('0x3a')][_0x7887('0x4c')]?_0x426677[_0x7887('0x3a')]:_0x10fa6a[_0x7887('0x37')];if(_0x4ba9a2['query'][_0x7887('0x46')]){_0x426677['include']=[{'all':!![]}];}_0x426677=_['merge']({},_0x426677,_0x4ba9a2[_0x7887('0x45')]);return db[_0x7887('0x31')][_0x7887('0x4d')](_0x426677)[_0x7887('0x29')](handleEntityNotFound(_0xcee516,null))[_0x7887('0x29')](respondWithResult(_0xcee516,null))['catch'](handleError(_0xcee516,null));};exports['create']=function(_0x222642,_0x5764ad){return db[_0x7887('0x31')]['create'](_0x222642['body'],{})['then'](respondWithResult(_0x5764ad,0xc9))[_0x7887('0x4a')](handleError(_0x5764ad,null));};exports['update']=function(_0x40eaf5,_0x273bd2){if(_0x40eaf5[_0x7887('0x4e')]['id']){delete _0x40eaf5[_0x7887('0x4e')]['id'];}return db[_0x7887('0x31')][_0x7887('0x4d')]({'where':{'id':_0x40eaf5[_0x7887('0x4b')]['id']}})[_0x7887('0x29')](handleEntityNotFound(_0x273bd2,null))[_0x7887('0x29')](saveUpdates(_0x40eaf5[_0x7887('0x4e')],null))[_0x7887('0x29')](respondWithResult(_0x273bd2,null))[_0x7887('0x4a')](handleError(_0x273bd2,null));};exports[_0x7887('0x2a')]=function(_0x343e89,_0xb2e4cf){return db['VoiceTransferReport'][_0x7887('0x4d')]({'where':{'id':_0x343e89[_0x7887('0x4b')]['id']}})[_0x7887('0x29')](handleEntityNotFound(_0xb2e4cf,null))['then'](removeEntity(_0xb2e4cf,null))[_0x7887('0x4a')](handleError(_0xb2e4cf,null));};exports[_0x7887('0x4f')]=function(_0x7e820c,_0x319d6b){return db[_0x7887('0x31')][_0x7887('0x4f')]()[_0x7887('0x29')](respondWithResult(_0x319d6b,null))[_0x7887('0x4a')](handleError(_0x319d6b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 5b90b70..4e6d49b 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 _0x9078=['bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','define','report_call_transfer','../../config/logger','api','moment'];(function(_0x3da7ab,_0x2e00dc){var _0x4819ed=function(_0x484ce3){while(--_0x484ce3){_0x3da7ab['push'](_0x3da7ab['shift']());}};_0x4819ed(++_0x2e00dc);}(_0x9078,0x1f1));var _0x8907=function(_0x319ecf,_0x22a155){_0x319ecf=_0x319ecf-0x0;var _0x2066c0=_0x9078[_0x319ecf];return _0x2066c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8907('0x0'))(_0x8907('0x1'));var moment=require(_0x8907('0x2'));var BPromise=require(_0x8907('0x3'));var rp=require(_0x8907('0x4'));var fs=require('fs');var path=require(_0x8907('0x5'));var rimraf=require(_0x8907('0x6'));var config=require('../../config/environment');var attributes=require(_0x8907('0x7'));module['exports']=function(_0x513d3a,_0x54293c){return _0x513d3a[_0x8907('0x8')]('VoiceTransferReport',attributes,{'tableName':_0x8907('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b51=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x1b51,0x1d9));var _0x11b5=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1b51[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x11b5('0x0'))(_0x11b5('0x1'));var moment=require('moment');var BPromise=require(_0x11b5('0x2'));var rp=require(_0x11b5('0x3'));var fs=require('fs');var path=require(_0x11b5('0x4'));var rimraf=require(_0x11b5('0x5'));var config=require(_0x11b5('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0x11b5('0x7')]=function(_0x5df773,_0x140438){return _0x5df773[_0x11b5('0x8')](_0x11b5('0x9'),attributes,{'tableName':_0x11b5('0xa'),'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 729a5ea..06c40a0 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 _0x4ce3=['request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x165096,_0x292628){var _0x4d1d63=function(_0x3b2477){while(--_0x3b2477){_0x165096['push'](_0x165096['shift']());}};_0x4d1d63(++_0x292628);}(_0x4ce3,0xa3));var _0x34ce=function(_0x69fb6a,_0x46ec8d){_0x69fb6a=_0x69fb6a-0x0;var _0x2faee2=_0x4ce3[_0x69fb6a];return _0x2faee2;};'use strict';var _=require('lodash');var util=require(_0x34ce('0x0'));var moment=require(_0x34ce('0x1'));var BPromise=require(_0x34ce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ce('0x3'));var db=require(_0x34ce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x34ce('0x5'))(_0x34ce('0x6'));var config=require(_0x34ce('0x7'));var jayson=require(_0x34ce('0x8'));var client=jayson[_0x34ce('0x9')][_0x34ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ee9a,_0x3f38ff,_0x1e7171){return new BPromise(function(_0x6d8de9,_0x47301a){return client[_0x34ce('0xb')](_0x57ee9a,_0x1e7171)[_0x34ce('0xc')](function(_0x54b396){logger[_0x34ce('0xd')](_0x34ce('0xe'),_0x3f38ff,'request\x20sent');logger[_0x34ce('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x3f38ff,_0x34ce('0x10'),JSON[_0x34ce('0x11')](_0x54b396));if(_0x54b396[_0x34ce('0x12')]){if(_0x54b396[_0x34ce('0x12')][_0x34ce('0x13')]===0x1f4){logger[_0x34ce('0x12')](_0x34ce('0xe'),_0x3f38ff,_0x54b396[_0x34ce('0x12')][_0x34ce('0x14')]);return _0x47301a(_0x54b396[_0x34ce('0x12')][_0x34ce('0x14')]);}logger[_0x34ce('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x3f38ff,_0x54b396[_0x34ce('0x12')][_0x34ce('0x14')]);return _0x6d8de9(_0x54b396[_0x34ce('0x12')]['message']);}else{logger[_0x34ce('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x3f38ff,_0x34ce('0x10'));_0x6d8de9(_0x54b396[_0x34ce('0x15')][_0x34ce('0x14')]);}})['catch'](function(_0x348bc1){logger[_0x34ce('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x3f38ff,_0x348bc1);_0x47301a(_0x348bc1);});});}exports[_0x34ce('0x16')]=function(_0x1d959c){var _0x7307a7=this;return new Promise(function(_0x768d18,_0x445b3c){return db[_0x34ce('0x17')][_0x34ce('0x18')](_0x1d959c[_0x34ce('0x19')],{'raw':_0x1d959c[_0x34ce('0x1a')]?_0x1d959c['options'][_0x34ce('0x1b')]===undefined?!![]:![]:!![]})[_0x34ce('0xc')](function(_0x172fce){logger[_0x34ce('0xd')](_0x34ce('0x16'),_0x1d959c);logger[_0x34ce('0xf')]('CreateVoiceTransferReport',_0x1d959c,JSON[_0x34ce('0x11')](_0x172fce));_0x768d18(_0x172fce);})[_0x34ce('0x1c')](function(_0x2dadd3){logger['error']('CreateVoiceTransferReport',_0x2dadd3[_0x34ce('0x14')],_0x1d959c);_0x445b3c(_0x7307a7['error'](0x1f4,_0x2dadd3['message']));});});}; \ No newline at end of file +var _0x8987=['util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8987,0x9c));var _0x7898=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x8987[_0x1265ed];return _0x5ac459;};'use strict';var _=require('lodash');var util=require(_0x7898('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7898('0x1'));var fs=require('fs');var Redis=require(_0x7898('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7898('0x3'))(_0x7898('0x4'));var config=require('../../config/environment');var jayson=require(_0x7898('0x5'));var client=jayson[_0x7898('0x6')][_0x7898('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2530f7,_0xe9a684,_0x4b9ed8){return new BPromise(function(_0x1e0c73,_0x31e787){return client[_0x7898('0x8')](_0x2530f7,_0x4b9ed8)['then'](function(_0x3f2405){logger['info'](_0x7898('0x9'),_0xe9a684,'request\x20sent');logger[_0x7898('0xa')](_0x7898('0xb'),_0xe9a684,_0x7898('0xc'),JSON[_0x7898('0xd')](_0x3f2405));if(_0x3f2405['error']){if(_0x3f2405[_0x7898('0xe')][_0x7898('0xf')]===0x1f4){logger['error'](_0x7898('0x9'),_0xe9a684,_0x3f2405['error'][_0x7898('0x10')]);return _0x31e787(_0x3f2405[_0x7898('0xe')][_0x7898('0x10')]);}logger[_0x7898('0xe')](_0x7898('0x9'),_0xe9a684,_0x3f2405[_0x7898('0xe')][_0x7898('0x10')]);return _0x1e0c73(_0x3f2405['error'][_0x7898('0x10')]);}else{logger[_0x7898('0x11')](_0x7898('0x9'),_0xe9a684,_0x7898('0xc'));_0x1e0c73(_0x3f2405['result'][_0x7898('0x10')]);}})[_0x7898('0x12')](function(_0x329c97){logger[_0x7898('0xe')](_0x7898('0x9'),_0xe9a684,_0x329c97);_0x31e787(_0x329c97);});});}exports[_0x7898('0x13')]=function(_0x3bc1a1){var _0x27413e=this;return new Promise(function(_0x20f9a5,_0x48f8d8){return db[_0x7898('0x14')][_0x7898('0x15')](_0x3bc1a1[_0x7898('0x16')],{'raw':_0x3bc1a1[_0x7898('0x17')]?_0x3bc1a1[_0x7898('0x17')][_0x7898('0x18')]===undefined?!![]:![]:!![]})[_0x7898('0x19')](function(_0x8cc876){logger[_0x7898('0x11')](_0x7898('0x13'),_0x3bc1a1);logger['debug'](_0x7898('0x13'),_0x3bc1a1,JSON['stringify'](_0x8cc876));_0x20f9a5(_0x8cc876);})['catch'](function(_0x2b39a8){logger['error'](_0x7898('0x13'),_0x2b39a8[_0x7898('0x10')],_0x3bc1a1);_0x48f8d8(_0x27413e['error'](0x1f4,_0x2b39a8[_0x7898('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 624f9a1..c412bea 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 _0xf4eb=['/hangup','isAuthenticated','isWebrtcLicence','hangup','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','/originate','originate','post'];(function(_0x16a094,_0x2df5e5){var _0x2b1665=function(_0x19ab84){while(--_0x19ab84){_0x16a094['push'](_0x16a094['shift']());}};_0x2b1665(++_0x2df5e5);}(_0xf4eb,0xec));var _0xbf4e=function(_0x37cb00,_0x1d67d8){_0x37cb00=_0x37cb00-0x0;var _0x4ef369=_0xf4eb[_0x37cb00];return _0x4ef369;};'use strict';var express=require(_0xbf4e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0xbf4e('0x1'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0x2')]);router[_0xbf4e('0x3')](_0xbf4e('0x4'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x3')]('/answer',auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xbf4e('0x3')](_0xbf4e('0x8'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x3')](_0xbf4e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xb')]);router['post'](_0xbf4e('0xc'),auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xd')]);router['post']('/transfer',auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xe')]);module[_0xbf4e('0xf')]=router; \ No newline at end of file +var _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x25fded,_0x34216e){var _0x269156=function(_0x190fe0){while(--_0x190fe0){_0x25fded['push'](_0x25fded['shift']());}};_0x269156(++_0x34216e);}(_0x91a7,0xe7));var _0x791a=function(_0x2178ad,_0x337cbc){_0x2178ad=_0x2178ad-0x0;var _0x5b30af=_0x91a7[_0x2178ad];return _0x5b30af;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index d15f05b..f60ca6c 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 _0x132c=['entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','calls','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','info','emit','log','stack','name','status','send','NotFound','request','then','error','code','message','result','catch','findOne','agent','VoiceChannels','all','filter','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','userId','callNumber','callbackUrl'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x132c,0x159));var _0xc132=function(_0x385acc,_0x24fde3){_0x385acc=_0x385acc-0x0;var _0x128205=_0x132c[_0x385acc];return _0x128205;};'use strict';var path=require(_0xc132('0x0'));var fs=require('fs');var _=require(_0xc132('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xc132('0x2'));var util=require('util');var BPromise=require(_0xc132('0x3'));var jayson=require(_0xc132('0x4'));var amiClient=jayson[_0xc132('0x5')][_0xc132('0x6')]({'port':0x232a});var logger=require(_0xc132('0x7'))(_0xc132('0x8'));var Redis=require('ioredis');config[_0xc132('0x9')]=_[_0xc132('0xa')](config[_0xc132('0x9')],{'host':_0xc132('0xb'),'port':0x18eb});var io=require(_0xc132('0xc'))(new Redis(config[_0xc132('0x9')]));var Schema=require(_0xc132('0xd'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc132('0xe')]},'callNumber':{'type':_0xc132('0xf'),'required':[!![],_0xc132('0x10')]},'callerId':{'type':_0xc132('0xf')},'callbackUrl':{'type':_0xc132('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xc132('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc132('0x11'),'required':[!![],_0xc132('0xe')]},'sessionId':{'type':_0xc132('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc132('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xc132('0xf'),'required':[!![],_0xc132('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xc132('0x11'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc132('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xc132('0x11'),'required':[!![],_0xc132('0xe')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xc132('0x11'),'required':[!![],_0xc132('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xc132('0x11'),'required':[!![],_0xc132('0xe')]}});function emit(_0x177bb8,_0x51e00f,_0x3ac727){logger[_0xc132('0x13')](_0x177bb8,_0x51e00f,JSON['stringify'](_0x3ac727));io['to'](_0x177bb8)[_0xc132('0x14')](_0x51e00f,_0x3ac727);}function handleError(_0x8d2069){return function(_0x2a6230){console[_0xc132('0x15')]('handleError:',_0x2a6230,_0x2a6230 instanceof RangeError);logger['error'](_0x2a6230[_0xc132('0x16')]);if(_0x2a6230 instanceof RangeError){if(_0x2a6230[_0xc132('0x17')]){delete _0x2a6230[_0xc132('0x17')];}_0x8d2069[_0xc132('0x18')](0x194)[_0xc132('0x19')](_0x2a6230);}else{if(_0x2a6230[_0xc132('0x17')]){delete _0x2a6230['name'];}_0x8d2069[_0xc132('0x18')](0x1f4)[_0xc132('0x19')](_0x2a6230);}};}function checkError(){return function(_0x10ffa7){if(!_0x10ffa7){throw new RangeError(_0xc132('0x1a'));}return _0x10ffa7;};}function respondWithRpcPromise(_0x39e974,_0x22d11d){return new BPromise(function(_0x57bce1,_0x958dd){var _0x1421ff=amiClient;return _0x1421ff[_0xc132('0x1b')](_0x39e974,_0x22d11d)[_0xc132('0x1c')](function(_0x4043f8){if(_0x4043f8[_0xc132('0x1d')]){if(_0x4043f8[_0xc132('0x1d')][_0xc132('0x1e')]===0x1f4){return _0x958dd(_0x4043f8['error']['message']);}return _0x57bce1(_0x4043f8[_0xc132('0x1d')][_0xc132('0x1f')]);}else{_0x57bce1(_0x4043f8[_0xc132('0x20')]);}})[_0xc132('0x21')](function(_0x1c026b){_0x958dd(_0x1c026b);});});}function getAgent(_0x3f6ab8){return db['User'][_0xc132('0x22')]({'where':{'id':_0x3f6ab8,'role':_0xc132('0x23')}})[_0xc132('0x1c')](checkError());}function getAgentCheckSession(_0x8f8e46,_0x28b56e){return new BPromise(function(_0x55a9f2,_0x571e6f){var _0x6531ee=respondWithRpcPromise(_0xc132('0x24'));var _0x49eb14=getAgent(_0x8f8e46);Promise[_0xc132('0x25')]([_0x6531ee,_0x49eb14])[_0xc132('0x1c')](function(_0x3c7024){var _0x3e0d34=_0x3c7024[0x0];var _0x2bf5d0=_0x3c7024[0x1];var _0x3bad5a=_[_0xc132('0x26')](_0x3e0d34['rows'],function(_0x45ea5c){return _0x45ea5c[_0xc132('0x27')]==_0x2bf5d0['id']&&_0x45ea5c[_0xc132('0x28')]==_0x28b56e;});if(_0x3bad5a['length']==0x1){_0x55a9f2(_0x2bf5d0);}else{_0x571e6f(new RangeError(_0xc132('0x29')+_0x28b56e+_0xc132('0x2a')));}});});}exports[_0xc132('0x2b')]=function(_0x52d0b4,_0x2fc7c5){logger[_0xc132('0x13')](_0xc132('0x2c'),_0x52d0b4[_0xc132('0x2d')]);var _0x57dc8f=originateValidation[_0xc132('0xd')](_0x52d0b4['body']);if(_0x57dc8f[_0xc132('0x2e')]>0x0){return _0x2fc7c5[_0xc132('0x18')](0x190)['json'](_0x57dc8f);}var _0x41779e=_0x52d0b4['body'][_0xc132('0x2f')];var _0x60d416=_0x52d0b4[_0xc132('0x2d')][_0xc132('0x30')];var _0x5dcb7e=_0x52d0b4[_0xc132('0x2d')]['callerId'];var _0xad5fcc=_0x52d0b4[_0xc132('0x2d')][_0xc132('0x31')];return getAgent(_0x41779e)['then'](function(_0x3f49bf){logger[_0xc132('0x13')](_0xc132('0x32'),_0x3f49bf[_0xc132('0x17')]);emit(util[_0xc132('0x33')](_0xc132('0x34'),_0x3f49bf[_0xc132('0x17')]),_0xc132('0x35'),{'callNumber':_0x60d416,'callerId':_0x5dcb7e,'callbackUrl':_0xad5fcc});return _0x2fc7c5[_0xc132('0x18')](0xc8)[_0xc132('0x36')]({'error':![],'message':_0xc132('0x37')});})[_0xc132('0x21')](handleError(_0x2fc7c5));};exports[_0xc132('0x38')]=function(_0x2799c1,_0x5cac31){logger[_0xc132('0x13')](_0xc132('0x39'),_0x2799c1['body']);var _0x15c939=hangupValidation[_0xc132('0xd')](_0x2799c1['body']);if(_0x15c939[_0xc132('0x2e')]>0x0){return _0x5cac31['status'](0x190)[_0xc132('0x36')](_0x15c939);}var _0x49fde3=_0x2799c1[_0xc132('0x2d')][_0xc132('0x2f')];var _0xb19733=_0x2799c1[_0xc132('0x2d')][_0xc132('0x28')];return getAgent(_0x49fde3)[_0xc132('0x1c')](function(_0x17556a){logger['info'](_0xc132('0x32'),_0x17556a[_0xc132('0x17')]);emit(util[_0xc132('0x33')](_0xc132('0x34'),_0x17556a[_0xc132('0x17')]),_0xc132('0x3a'),{'sessionId':_0xb19733});return _0x5cac31['status'](0xc8)['json']({'error':![],'message':_0xc132('0x3b')});})[_0xc132('0x21')](handleError(_0x5cac31));};exports[_0xc132('0x3c')]=function(_0x164aaa,_0x2ac86b){logger[_0xc132('0x13')](_0xc132('0x3d'),_0x164aaa[_0xc132('0x2d')]);var _0x4ce896=answerValidation['validate'](_0x164aaa[_0xc132('0x2d')]);if(_0x4ce896[_0xc132('0x2e')]>0x0){return _0x2ac86b[_0xc132('0x18')](0x190)[_0xc132('0x36')](_0x4ce896);}var _0x54b034=_0x164aaa[_0xc132('0x2d')][_0xc132('0x2f')];var _0x1b5d21=_0x164aaa[_0xc132('0x2d')][_0xc132('0x28')];return getAgent(_0x54b034)[_0xc132('0x1c')](function(_0x13af00){logger['info']('entityFound:',_0x13af00[_0xc132('0x17')]);emit(util[_0xc132('0x33')](_0xc132('0x34'),_0x13af00[_0xc132('0x17')]),_0xc132('0x3e'),{'sessionId':_0x1b5d21});return _0x2ac86b[_0xc132('0x18')](0xc8)[_0xc132('0x36')]({'error':![],'message':'answer\x20executed!'});})[_0xc132('0x21')](handleError(_0x2ac86b));};exports[_0xc132('0x3f')]=function(_0x11c766,_0x3b2cc9){logger[_0xc132('0x13')](_0xc132('0x40'),_0x11c766[_0xc132('0x2d')]);var _0x298b49=holdValidation[_0xc132('0xd')](_0x11c766[_0xc132('0x2d')]);if(_0x298b49[_0xc132('0x2e')]>0x0){return _0x3b2cc9[_0xc132('0x18')](0x190)['json'](_0x298b49);}var _0x20e1d3=_0x11c766[_0xc132('0x2d')][_0xc132('0x2f')];var _0x23af8e=_0x11c766[_0xc132('0x2d')]['sessionId'];return getAgent(_0x20e1d3)[_0xc132('0x1c')](function(_0x2f6380){logger[_0xc132('0x13')](_0xc132('0x32'),_0x2f6380['name']);emit(util[_0xc132('0x33')](_0xc132('0x34'),_0x2f6380[_0xc132('0x17')]),_0xc132('0x41'),{'sessionId':_0x23af8e});return _0x3b2cc9[_0xc132('0x18')](0xc8)[_0xc132('0x36')]({'error':![],'message':_0xc132('0x42')});})['catch'](handleError(_0x3b2cc9));};exports['unhold']=function(_0x262334,_0x4ad895){logger['info'](_0xc132('0x43'),_0x262334['body']);var _0x2b7527=unholdValidation[_0xc132('0xd')](_0x262334[_0xc132('0x2d')]);if(_0x2b7527[_0xc132('0x2e')]>0x0){return _0x4ad895[_0xc132('0x18')](0x190)[_0xc132('0x36')](_0x2b7527);}var _0x138f42=_0x262334[_0xc132('0x2d')][_0xc132('0x2f')];var _0xac9291=_0x262334[_0xc132('0x2d')]['sessionId'];return getAgent(_0x138f42)['then'](function(_0x31e75e){logger[_0xc132('0x13')](_0xc132('0x32'),_0x31e75e[_0xc132('0x17')]);emit(util[_0xc132('0x33')](_0xc132('0x34'),_0x31e75e[_0xc132('0x17')]),_0xc132('0x44'),{'sessionId':_0xac9291});return _0x4ad895[_0xc132('0x18')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0xc132('0x21')](handleError(_0x4ad895));};exports[_0xc132('0x45')]=function(_0x467586,_0x51661f){logger[_0xc132('0x13')]('calls\x20fired:',_0x51661f[_0xc132('0x2d')]);var _0x4ee5eb=callsValidation['validate'](_0x467586[_0xc132('0x2d')]);if(_0x4ee5eb[_0xc132('0x2e')]>0x0){return _0x51661f[_0xc132('0x18')](0x190)[_0xc132('0x36')](_0x4ee5eb);}var _0x10d882=_0x467586[_0xc132('0x2d')][_0xc132('0x2f')];var _0x4fc9b3=respondWithRpcPromise(_0xc132('0x24'));var _0x2838d4=getAgent(_0x10d882);return Promise[_0xc132('0x25')]([_0x4fc9b3,_0x2838d4])[_0xc132('0x1c')](function(_0x401043){var _0x557771=_0x401043[0x0];var _0x290d61=_0x401043[0x1];var _0x5a5b96=_[_0xc132('0x26')](_0x557771[_0xc132('0x46')],function(_0x56f375){return _0x56f375['UserId']==_0x290d61['id'];});return _0x51661f[_0xc132('0x18')](0xc8)[_0xc132('0x36')]({'count':_0x5a5b96['length'],'rows':_0x5a5b96});})[_0xc132('0x21')](handleError(_0x51661f));};exports[_0xc132('0x47')]=function(_0x476d79,_0x2538cb){logger['info'](_0xc132('0x48'),_0x476d79[_0xc132('0x2d')]);var _0x2d22b2=conferenceValidation[_0xc132('0xd')](_0x476d79['body']);if(_0x2d22b2[_0xc132('0x2e')]>0x0){return _0x2538cb[_0xc132('0x18')](0x190)[_0xc132('0x36')](_0x2d22b2);}var _0x43a3a2=_0x476d79[_0xc132('0x2d')][_0xc132('0x2f')];return getAgent(_0x43a3a2)[_0xc132('0x1c')](function(_0x3388bd){logger[_0xc132('0x13')](_0xc132('0x32'),_0x3388bd[_0xc132('0x17')]);emit(util[_0xc132('0x33')](_0xc132('0x34'),_0x3388bd[_0xc132('0x17')]),_0xc132('0x49'));return _0x2538cb['status'](0xc8)[_0xc132('0x36')]({'error':![],'message':_0xc132('0x4a')});})['catch'](handleError(_0x2538cb));};exports[_0xc132('0x4b')]=function(_0x4a60ec,_0x3da01e){logger['info'](_0xc132('0x4c'),_0x4a60ec[_0xc132('0x2d')]);var _0x412a0e=transferValidation[_0xc132('0xd')](_0x4a60ec['body']);if(_0x412a0e[_0xc132('0x2e')]>0x0){return _0x3da01e[_0xc132('0x18')](0x190)[_0xc132('0x36')](_0x412a0e);}var _0xc653e=_0x4a60ec[_0xc132('0x2d')]['userId'];var _0x50be17=_0x4a60ec[_0xc132('0x2d')]['sessionId'];var _0x2aff0b=_0x4a60ec['body'][_0xc132('0x4d')];return getAgent(_0xc653e)[_0xc132('0x1c')](function(_0x192a65){logger[_0xc132('0x13')](_0xc132('0x32'),_0x192a65[_0xc132('0x17')]);emit(util[_0xc132('0x33')]('user:%s',_0x192a65[_0xc132('0x17')]),'webbar:transfer',{'sessionId':_0x50be17,'transferNumber':_0x2aff0b});return _0x3da01e[_0xc132('0x18')](0xc8)[_0xc132('0x36')]({'error':![],'message':_0xc132('0x4e')});})[_0xc132('0x21')](handleError(_0x3da01e));}; \ No newline at end of file +var _0x5fff=['originate','body','length','json','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','validate','userId','format','user:%s','webbar:hangup','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','calls','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','client','http','ioredis','redis','defaults','localhost','socket.io-emitter','number','string','userId\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','send','status','NotFound','request','then','message','result','catch','User','findOne','agent','VoiceChannels','all','rows','sessionId','sessionId\x20','\x20not\x20found!'];(function(_0x35aea3,_0x10de27){var _0x4082ad=function(_0x501260){while(--_0x501260){_0x35aea3['push'](_0x35aea3['shift']());}};_0x4082ad(++_0x10de27);}(_0x5fff,0x194));var _0xf5ff=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x5fff[_0x1deb03];return _0x189fe7;};'use strict';var path=require(_0xf5ff('0x0'));var fs=require('fs');var _=require(_0xf5ff('0x1'));var db=require(_0xf5ff('0x2'))['db'];var config=require(_0xf5ff('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0xf5ff('0x4')][_0xf5ff('0x5')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0xf5ff('0x6'));config[_0xf5ff('0x7')]=_[_0xf5ff('0x8')](config['redis'],{'host':_0xf5ff('0x9'),'port':0x18eb});var io=require(_0xf5ff('0xa'))(new Redis(config[_0xf5ff('0x7')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xf5ff('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xf5ff('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0xf5ff('0xb'),'required':[!![],_0xf5ff('0xd')]},'sessionId':{'type':_0xf5ff('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf5ff('0xb'),'required':[!![],_0xf5ff('0xd')]},'sessionId':{'type':_0xf5ff('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf5ff('0xb'),'required':[!![],_0xf5ff('0xd')]},'sessionId':{'type':_0xf5ff('0xc'),'required':[!![],_0xf5ff('0xe')]},'transferNumber':{'type':_0xf5ff('0xc'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf5ff('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf5ff('0xd')]},'sessionId':{'type':_0xf5ff('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf5ff('0xb'),'required':[!![],_0xf5ff('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf5ff('0xd')]}});function emit(_0x2f6003,_0x4699a1,_0x1959d3){logger[_0xf5ff('0xf')](_0x2f6003,_0x4699a1,JSON[_0xf5ff('0x10')](_0x1959d3));io['to'](_0x2f6003)[_0xf5ff('0x11')](_0x4699a1,_0x1959d3);}function handleError(_0x150412){return function(_0x5bf469){console[_0xf5ff('0x12')](_0xf5ff('0x13'),_0x5bf469,_0x5bf469 instanceof RangeError);logger[_0xf5ff('0x14')](_0x5bf469[_0xf5ff('0x15')]);if(_0x5bf469 instanceof RangeError){if(_0x5bf469[_0xf5ff('0x16')]){delete _0x5bf469[_0xf5ff('0x16')];}_0x150412['status'](0x194)[_0xf5ff('0x17')](_0x5bf469);}else{if(_0x5bf469[_0xf5ff('0x16')]){delete _0x5bf469[_0xf5ff('0x16')];}_0x150412[_0xf5ff('0x18')](0x1f4)[_0xf5ff('0x17')](_0x5bf469);}};}function checkError(){return function(_0x2849ac){if(!_0x2849ac){throw new RangeError(_0xf5ff('0x19'));}return _0x2849ac;};}function respondWithRpcPromise(_0x42183c,_0x2cd5b7){return new BPromise(function(_0x4ec677,_0x4da404){var _0x4fbb55=amiClient;return _0x4fbb55[_0xf5ff('0x1a')](_0x42183c,_0x2cd5b7)[_0xf5ff('0x1b')](function(_0x328bee){if(_0x328bee[_0xf5ff('0x14')]){if(_0x328bee[_0xf5ff('0x14')]['code']===0x1f4){return _0x4da404(_0x328bee[_0xf5ff('0x14')][_0xf5ff('0x1c')]);}return _0x4ec677(_0x328bee[_0xf5ff('0x14')]['message']);}else{_0x4ec677(_0x328bee[_0xf5ff('0x1d')]);}})[_0xf5ff('0x1e')](function(_0x132f27){_0x4da404(_0x132f27);});});}function getAgent(_0x38af5a){return db[_0xf5ff('0x1f')][_0xf5ff('0x20')]({'where':{'id':_0x38af5a,'role':_0xf5ff('0x21')}})[_0xf5ff('0x1b')](checkError());}function getAgentCheckSession(_0xe8d9a4,_0x43b05a){return new BPromise(function(_0x2240f5,_0x3bec59){var _0x5cc736=respondWithRpcPromise(_0xf5ff('0x22'));var _0x176e9b=getAgent(_0xe8d9a4);Promise[_0xf5ff('0x23')]([_0x5cc736,_0x176e9b])[_0xf5ff('0x1b')](function(_0x22a13d){var _0x915f2b=_0x22a13d[0x0];var _0x2b3926=_0x22a13d[0x1];var _0x393036=_['filter'](_0x915f2b[_0xf5ff('0x24')],function(_0x310150){return _0x310150['UserId']==_0x2b3926['id']&&_0x310150[_0xf5ff('0x25')]==_0x43b05a;});if(_0x393036['length']==0x1){_0x2240f5(_0x2b3926);}else{_0x3bec59(new RangeError(_0xf5ff('0x26')+_0x43b05a+_0xf5ff('0x27')));}});});}exports[_0xf5ff('0x28')]=function(_0x332487,_0x46d118){logger[_0xf5ff('0xf')]('originate\x20fired:',_0x332487[_0xf5ff('0x29')]);var _0x14bd94=originateValidation['validate'](_0x332487[_0xf5ff('0x29')]);if(_0x14bd94[_0xf5ff('0x2a')]>0x0){return _0x46d118[_0xf5ff('0x18')](0x190)[_0xf5ff('0x2b')](_0x14bd94);}var _0x21481d=_0x332487[_0xf5ff('0x29')]['userId'];var _0x45c843=_0x332487['body'][_0xf5ff('0x2c')];var _0x2207f0=_0x332487['body'][_0xf5ff('0x2d')];var _0x5a7f1d=_0x332487[_0xf5ff('0x29')][_0xf5ff('0x2e')];return getAgent(_0x21481d)[_0xf5ff('0x1b')](function(_0xe5b008){logger['info'](_0xf5ff('0x2f'),_0xe5b008['name']);emit(util['format']('user:%s',_0xe5b008[_0xf5ff('0x16')]),_0xf5ff('0x30'),{'callNumber':_0x45c843,'callerId':_0x2207f0,'callbackUrl':_0x5a7f1d});return _0x46d118[_0xf5ff('0x18')](0xc8)[_0xf5ff('0x2b')]({'error':![],'message':_0xf5ff('0x31')});})[_0xf5ff('0x1e')](handleError(_0x46d118));};exports[_0xf5ff('0x32')]=function(_0x2ab22f,_0x2f5f24){logger[_0xf5ff('0xf')](_0xf5ff('0x33'),_0x2ab22f[_0xf5ff('0x29')]);var _0x58fd54=hangupValidation[_0xf5ff('0x34')](_0x2ab22f[_0xf5ff('0x29')]);if(_0x58fd54[_0xf5ff('0x2a')]>0x0){return _0x2f5f24[_0xf5ff('0x18')](0x190)[_0xf5ff('0x2b')](_0x58fd54);}var _0x5a8de4=_0x2ab22f[_0xf5ff('0x29')][_0xf5ff('0x35')];var _0x26f043=_0x2ab22f[_0xf5ff('0x29')][_0xf5ff('0x25')];return getAgent(_0x5a8de4)[_0xf5ff('0x1b')](function(_0xbf30b0){logger[_0xf5ff('0xf')]('entityFound:',_0xbf30b0[_0xf5ff('0x16')]);emit(util[_0xf5ff('0x36')](_0xf5ff('0x37'),_0xbf30b0[_0xf5ff('0x16')]),_0xf5ff('0x38'),{'sessionId':_0x26f043});return _0x2f5f24[_0xf5ff('0x18')](0xc8)[_0xf5ff('0x2b')]({'error':![],'message':'hangup\x20executed!'});})[_0xf5ff('0x1e')](handleError(_0x2f5f24));};exports['answer']=function(_0x2a9715,_0x5b7778){logger[_0xf5ff('0xf')](_0xf5ff('0x39'),_0x2a9715['body']);var _0x53a0be=answerValidation[_0xf5ff('0x34')](_0x2a9715[_0xf5ff('0x29')]);if(_0x53a0be[_0xf5ff('0x2a')]>0x0){return _0x5b7778[_0xf5ff('0x18')](0x190)['json'](_0x53a0be);}var _0x5be3ea=_0x2a9715[_0xf5ff('0x29')]['userId'];var _0x58e535=_0x2a9715[_0xf5ff('0x29')][_0xf5ff('0x25')];return getAgent(_0x5be3ea)[_0xf5ff('0x1b')](function(_0xa4608){logger[_0xf5ff('0xf')](_0xf5ff('0x2f'),_0xa4608[_0xf5ff('0x16')]);emit(util['format']('user:%s',_0xa4608[_0xf5ff('0x16')]),_0xf5ff('0x3a'),{'sessionId':_0x58e535});return _0x5b7778[_0xf5ff('0x18')](0xc8)[_0xf5ff('0x2b')]({'error':![],'message':_0xf5ff('0x3b')});})[_0xf5ff('0x1e')](handleError(_0x5b7778));};exports[_0xf5ff('0x3c')]=function(_0xe0f793,_0x338b5c){logger['info']('hold\x20fired:',_0xe0f793[_0xf5ff('0x29')]);var _0x29adc8=holdValidation[_0xf5ff('0x34')](_0xe0f793[_0xf5ff('0x29')]);if(_0x29adc8['length']>0x0){return _0x338b5c[_0xf5ff('0x18')](0x190)[_0xf5ff('0x2b')](_0x29adc8);}var _0x5a8721=_0xe0f793[_0xf5ff('0x29')]['userId'];var _0x46a48d=_0xe0f793[_0xf5ff('0x29')][_0xf5ff('0x25')];return getAgent(_0x5a8721)[_0xf5ff('0x1b')](function(_0x255233){logger[_0xf5ff('0xf')](_0xf5ff('0x2f'),_0x255233['name']);emit(util['format'](_0xf5ff('0x37'),_0x255233[_0xf5ff('0x16')]),_0xf5ff('0x3d'),{'sessionId':_0x46a48d});return _0x338b5c[_0xf5ff('0x18')](0xc8)[_0xf5ff('0x2b')]({'error':![],'message':_0xf5ff('0x3e')});})[_0xf5ff('0x1e')](handleError(_0x338b5c));};exports[_0xf5ff('0x3f')]=function(_0x558846,_0x507478){logger[_0xf5ff('0xf')]('unhold\x20fired:',_0x558846['body']);var _0x27e7fa=unholdValidation['validate'](_0x558846['body']);if(_0x27e7fa[_0xf5ff('0x2a')]>0x0){return _0x507478[_0xf5ff('0x18')](0x190)[_0xf5ff('0x2b')](_0x27e7fa);}var _0x513688=_0x558846[_0xf5ff('0x29')][_0xf5ff('0x35')];var _0x413a1c=_0x558846['body'][_0xf5ff('0x25')];return getAgent(_0x513688)['then'](function(_0x1e675c){logger['info']('entityFound:',_0x1e675c[_0xf5ff('0x16')]);emit(util[_0xf5ff('0x36')](_0xf5ff('0x37'),_0x1e675c[_0xf5ff('0x16')]),'webbar:unhold',{'sessionId':_0x413a1c});return _0x507478[_0xf5ff('0x18')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x507478));};exports[_0xf5ff('0x40')]=function(_0x2fc6fc,_0x4eb687){logger[_0xf5ff('0xf')]('calls\x20fired:',_0x4eb687['body']);var _0x288fba=callsValidation[_0xf5ff('0x34')](_0x2fc6fc[_0xf5ff('0x29')]);if(_0x288fba[_0xf5ff('0x2a')]>0x0){return _0x4eb687[_0xf5ff('0x18')](0x190)[_0xf5ff('0x2b')](_0x288fba);}var _0x9e8975=_0x2fc6fc[_0xf5ff('0x29')][_0xf5ff('0x35')];var _0x14b293=respondWithRpcPromise(_0xf5ff('0x22'));var _0x1bacb9=getAgent(_0x9e8975);return Promise[_0xf5ff('0x23')]([_0x14b293,_0x1bacb9])[_0xf5ff('0x1b')](function(_0x3de657){var _0x5b0977=_0x3de657[0x0];var _0x1b32d5=_0x3de657[0x1];var _0x520731=_['filter'](_0x5b0977[_0xf5ff('0x24')],function(_0x576903){return _0x576903[_0xf5ff('0x41')]==_0x1b32d5['id'];});return _0x4eb687[_0xf5ff('0x18')](0xc8)[_0xf5ff('0x2b')]({'count':_0x520731['length'],'rows':_0x520731});})['catch'](handleError(_0x4eb687));};exports[_0xf5ff('0x42')]=function(_0x38a2b6,_0x4f86f6){logger[_0xf5ff('0xf')](_0xf5ff('0x43'),_0x38a2b6[_0xf5ff('0x29')]);var _0x5bd112=conferenceValidation['validate'](_0x38a2b6['body']);if(_0x5bd112['length']>0x0){return _0x4f86f6[_0xf5ff('0x18')](0x190)[_0xf5ff('0x2b')](_0x5bd112);}var _0xe50f67=_0x38a2b6[_0xf5ff('0x29')]['userId'];return getAgent(_0xe50f67)[_0xf5ff('0x1b')](function(_0x139dce){logger[_0xf5ff('0xf')]('entityFound:',_0x139dce[_0xf5ff('0x16')]);emit(util[_0xf5ff('0x36')](_0xf5ff('0x37'),_0x139dce[_0xf5ff('0x16')]),_0xf5ff('0x44'));return _0x4f86f6[_0xf5ff('0x18')](0xc8)[_0xf5ff('0x2b')]({'error':![],'message':_0xf5ff('0x45')});})[_0xf5ff('0x1e')](handleError(_0x4f86f6));};exports[_0xf5ff('0x46')]=function(_0x403dae,_0x1c6504){logger[_0xf5ff('0xf')](_0xf5ff('0x47'),_0x403dae[_0xf5ff('0x29')]);var _0x365a82=transferValidation[_0xf5ff('0x34')](_0x403dae[_0xf5ff('0x29')]);if(_0x365a82[_0xf5ff('0x2a')]>0x0){return _0x1c6504[_0xf5ff('0x18')](0x190)['json'](_0x365a82);}var _0x2d9108=_0x403dae[_0xf5ff('0x29')][_0xf5ff('0x35')];var _0x453c2d=_0x403dae['body'][_0xf5ff('0x25')];var _0x564cc2=_0x403dae[_0xf5ff('0x29')][_0xf5ff('0x48')];return getAgent(_0x2d9108)[_0xf5ff('0x1b')](function(_0x1b9555){logger[_0xf5ff('0xf')](_0xf5ff('0x2f'),_0x1b9555[_0xf5ff('0x16')]);emit(util[_0xf5ff('0x36')]('user:%s',_0x1b9555['name']),'webbar:transfer',{'sessionId':_0x453c2d,'transferNumber':_0x564cc2});return _0x1c6504[_0xf5ff('0x18')](0xc8)[_0xf5ff('0x2b')]({'error':![],'message':_0xf5ff('0x49')});})['catch'](handleError(_0x1c6504));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index a395e40..2240898 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 _0xbeb1=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','/:id/notify','notify','send','put','update','delete','removeAnswers','removeAgents','exports','multer','util'];(function(_0x29e40e,_0x53d1c0){var _0x13936a=function(_0x28f2fb){while(--_0x28f2fb){_0x29e40e['push'](_0x29e40e['shift']());}};_0x13936a(++_0x53d1c0);}(_0xbeb1,0x154));var _0x1beb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbeb1[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x1beb('0x0'));var util=require(_0x1beb('0x1'));var path=require(_0x1beb('0x2'));var timeout=require(_0x1beb('0x3'));var express=require(_0x1beb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1beb('0x5'));var interaction=require(_0x1beb('0x6'));var config=require(_0x1beb('0x7'));var controller=require(_0x1beb('0x8'));router['get']('/',auth[_0x1beb('0x9')](),controller[_0x1beb('0xa')]);router[_0x1beb('0xb')]('/describe',auth[_0x1beb('0x9')](),controller[_0x1beb('0xc')]);router[_0x1beb('0xb')](_0x1beb('0xd'),auth[_0x1beb('0x9')](),controller[_0x1beb('0xe')]);router[_0x1beb('0xb')](_0x1beb('0xf'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x10')]);router[_0x1beb('0xb')](_0x1beb('0x11'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x12')]);router['get'](_0x1beb('0x13'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x14')]);router[_0x1beb('0xb')]('/:id/applications',auth[_0x1beb('0x9')](),controller[_0x1beb('0x15')]);router[_0x1beb('0x16')]('/',auth[_0x1beb('0x9')](),controller[_0x1beb('0x17')]);router[_0x1beb('0x16')](_0x1beb('0xf'),auth['isAuthenticated'](),controller[_0x1beb('0x18')]);router[_0x1beb('0x16')](_0x1beb('0x11'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x19')]);router[_0x1beb('0x16')](_0x1beb('0x13'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x1a')]);router[_0x1beb('0x16')](_0x1beb('0x1b'),auth['isAuthenticated'](),controller[_0x1beb('0x1c')]);router[_0x1beb('0x16')](_0x1beb('0x1d'),controller[_0x1beb('0x1e')]);router[_0x1beb('0x16')]('/:id/send',auth[_0x1beb('0x9')](),controller[_0x1beb('0x1f')]);router[_0x1beb('0x20')](_0x1beb('0xd'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x21')]);router['delete'](_0x1beb('0xd'),auth[_0x1beb('0x9')](),controller['destroy']);router[_0x1beb('0x22')](_0x1beb('0xf'),auth[_0x1beb('0x9')](),controller['removeDispositions']);router[_0x1beb('0x22')](_0x1beb('0x11'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x23')]);router['delete'](_0x1beb('0x13'),auth[_0x1beb('0x9')](),controller[_0x1beb('0x24')]);module[_0x1beb('0x25')]=router; \ No newline at end of file +var _0x12ae=['/describe','describe','/:id','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','exports','util','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index'];(function(_0x4d1e5c,_0x573b42){var _0x2bb572=function(_0xe8f1ab){while(--_0xe8f1ab){_0x4d1e5c['push'](_0x4d1e5c['shift']());}};_0x2bb572(++_0x573b42);}(_0x12ae,0x15f));var _0xe12a=function(_0x2ac986,_0x1c34e2){_0x2ac986=_0x2ac986-0x0;var _0x28f5fa=_0x12ae[_0x2ac986];return _0x28f5fa;};'use strict';var multer=require('multer');var util=require(_0xe12a('0x0'));var path=require(_0xe12a('0x1'));var timeout=require('connect-timeout');var express=require(_0xe12a('0x2'));var router=express[_0xe12a('0x3')]();var fs_extra=require(_0xe12a('0x4'));var auth=require(_0xe12a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0xe12a('0x6')]('/',auth[_0xe12a('0x7')](),controller[_0xe12a('0x8')]);router[_0xe12a('0x6')](_0xe12a('0x9'),auth[_0xe12a('0x7')](),controller[_0xe12a('0xa')]);router['get'](_0xe12a('0xb'),auth[_0xe12a('0x7')](),controller['show']);router['get']('/:id/dispositions',auth[_0xe12a('0x7')](),controller[_0xe12a('0xc')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xe12a('0xd')]);router['get'](_0xe12a('0xe'),auth[_0xe12a('0x7')](),controller[_0xe12a('0xf')]);router[_0xe12a('0x6')](_0xe12a('0x10'),auth['isAuthenticated'](),controller[_0xe12a('0x11')]);router[_0xe12a('0x12')]('/',auth[_0xe12a('0x7')](),controller[_0xe12a('0x13')]);router[_0xe12a('0x12')](_0xe12a('0x14'),auth[_0xe12a('0x7')](),controller[_0xe12a('0x15')]);router[_0xe12a('0x12')](_0xe12a('0x16'),auth[_0xe12a('0x7')](),controller[_0xe12a('0x17')]);router[_0xe12a('0x12')]('/:id/users',auth[_0xe12a('0x7')](),controller[_0xe12a('0x18')]);router[_0xe12a('0x12')](_0xe12a('0x10'),auth[_0xe12a('0x7')](),controller[_0xe12a('0x19')]);router[_0xe12a('0x12')](_0xe12a('0x1a'),controller[_0xe12a('0x1b')]);router[_0xe12a('0x12')](_0xe12a('0x1c'),auth[_0xe12a('0x7')](),controller[_0xe12a('0x1d')]);router[_0xe12a('0x1e')](_0xe12a('0xb'),auth['isAuthenticated'](),controller[_0xe12a('0x1f')]);router[_0xe12a('0x20')](_0xe12a('0xb'),auth[_0xe12a('0x7')](),controller[_0xe12a('0x21')]);router[_0xe12a('0x20')](_0xe12a('0x14'),auth[_0xe12a('0x7')](),controller[_0xe12a('0x22')]);router[_0xe12a('0x20')](_0xe12a('0x16'),auth[_0xe12a('0x7')](),controller['removeAnswers']);router['delete'](_0xe12a('0xe'),auth[_0xe12a('0x7')](),controller['removeAgents']);module[_0xe12a('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 235cd61..054b9a0 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 _0xc4dd=['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','mandatoryDisposition','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT'];(function(_0x4d1d2c,_0x44f4d8){var _0x2c4cb9=function(_0x4b0c5f){while(--_0x4b0c5f){_0x4d1d2c['push'](_0x4d1d2c['shift']());}};_0x2c4cb9(++_0x44f4d8);}(_0xc4dd,0x198));var _0xdc4d=function(_0x8385db,_0x4b8dba){_0x8385db=_0x8385db-0x0;var _0x5d6df1=_0xc4dd[_0x8385db];return _0x5d6df1;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xdc4d('0x0')]={'name':{'type':Sequelize[_0xdc4d('0x1')],'unique':_0xdc4d('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xdc4d('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xdc4d('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xdc4d('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdc4d('0x4')](_0xdc4d('0x5'),_0xdc4d('0x6'))},'accountSid':{'type':Sequelize[_0xdc4d('0x1')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xdc4d('0x1')]},'notificationTemplate':{'type':Sequelize[_0xdc4d('0x7')],'defaultValue':function(){return _0xdc4d('0x8');}},'notificationSound':{'type':Sequelize[_0xdc4d('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xdc4d('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdc4d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdc4d('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdc4d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdc4d('0xa')],'comment':_0xdc4d('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xdc4d('0x9')],'defaultValue':![],'comment':_0xdc4d('0xc'),'set':function(_0x1d9334){if(!_0x1d9334){this[_0xdc4d('0xd')](_0xdc4d('0xe'),null);}this['setDataValue'](_0xdc4d('0xf'),_0x1d9334);}},'description':{'type':Sequelize[_0xdc4d('0x1')]}}; \ No newline at end of file +var _0xed08=['mandatoryDisposition','randomstring','exports','STRING','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'];(function(_0x2b948f,_0x398e62){var _0x1237bc=function(_0x3c1843){while(--_0x3c1843){_0x2b948f['push'](_0x2b948f['shift']());}};_0x1237bc(++_0x398e62);}(_0xed08,0x67));var _0x8ed0=function(_0x4157d8,_0x418891){_0x4157d8=_0x4157d8-0x0;var _0x28ed08=_0xed08[_0x4157d8];return _0x28ed08;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8ed0('0x0'));module[_0x8ed0('0x1')]={'name':{'type':Sequelize[_0x8ed0('0x2')],'unique':_0x8ed0('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x8ed0('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x8ed0('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x8ed0('0x2')],'defaultValue':function(){return rs[_0x8ed0('0x4')]();}},'phone':{'type':Sequelize[_0x8ed0('0x2')]},'type':{'type':Sequelize[_0x8ed0('0x5')](_0x8ed0('0x6'),_0x8ed0('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x8ed0('0x2')]},'authToken':{'type':Sequelize[_0x8ed0('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8ed0('0x8')],'defaultValue':function(){return _0x8ed0('0x9');}},'notificationSound':{'type':Sequelize[_0x8ed0('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x8ed0('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8ed0('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8ed0('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8ed0('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8ed0('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8ed0('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8ed0('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x8ed0('0xa')],'defaultValue':![],'comment':_0x8ed0('0xd'),'set':function(_0x3a48ff){if(!_0x3a48ff){this[_0x8ed0('0xe')](_0x8ed0('0xf'),null);}this[_0x8ed0('0xe')](_0x8ed0('0x10'),_0x3a48ff);}},'description':{'type':Sequelize[_0x8ed0('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 6c96e3e..17fed22 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 _0x0c99=['defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','WhatsappAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','type','options','include','findAll','rows','show','params','includeAll','merge','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','order','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','applications','close','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','WhatsappQueue','queueId','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','stringify','Content-Type','text/xml','to\x20is\x20mandatory','CmList','List','out','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x81aa14,_0x283f55){var _0x403a23=function(_0x3d983c){while(--_0x3d983c){_0x81aa14['push'](_0x81aa14['shift']());}};_0x403a23(++_0x283f55);}(_0x0c99,0xac));var _0x90c9=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x0c99[_0x1ebce2];return _0x4a330c;};'use strict';var emlformat=require(_0x90c9('0x0'));var rimraf=require(_0x90c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90c9('0x2'));var rp=require(_0x90c9('0x3'));var moment=require(_0x90c9('0x4'));var BPromise=require(_0x90c9('0x5'));var Mustache=require('mustache');var util=require(_0x90c9('0x6'));var path=require('path');var sox=require(_0x90c9('0x7'));var csv=require(_0x90c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x90c9('0x9'));var _=require(_0x90c9('0xa'));var squel=require(_0x90c9('0xb'));var crypto=require(_0x90c9('0xc'));var jsforce=require(_0x90c9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x90c9('0x8'));var querystring=require(_0x90c9('0xe'));var Papa=require('papaparse');var Redis=require(_0x90c9('0xf'));var authService=require(_0x90c9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x90c9('0x11'));var hardwareService=require(_0x90c9('0x12'));var logger=require(_0x90c9('0x13'))(_0x90c9('0x14'));var utils=require(_0x90c9('0x15'));var config=require(_0x90c9('0x16'));var licenseUtil=require(_0x90c9('0x17'));var db=require(_0x90c9('0x18'))['db'];config[_0x90c9('0x19')]=_[_0x90c9('0x1a')](config[_0x90c9('0x19')],{'host':_0x90c9('0x1b'),'port':0x18eb});var socket=require(_0x90c9('0x1c'))(new Redis(config[_0x90c9('0x19')]));require(_0x90c9('0x1d'))['register'](socket);var jayson=require(_0x90c9('0x1e'));var client=jayson[_0x90c9('0x1f')][_0x90c9('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x3096f9,_0x578380,_0x4c9e9b,_0x515fdd){return new BPromise(function(_0x46e2be,_0x4f9718){var _0x298e3c=_0x515fdd||client;return _0x298e3c[_0x90c9('0x21')](_0x3096f9,_0x4c9e9b)[_0x90c9('0x22')](function(_0x17d145){logger[_0x90c9('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x578380,_0x90c9('0x24'));logger[_0x90c9('0x25')](_0x90c9('0x26'),_0x578380,'request\x20sent',JSON['stringify'](_0x17d145));if(_0x17d145[_0x90c9('0x27')]){if(_0x17d145['error'][_0x90c9('0x28')]===0x1f4){logger[_0x90c9('0x27')](_0x90c9('0x29'),_0x578380,_0x17d145[_0x90c9('0x27')][_0x90c9('0x2a')]);return _0x4f9718(_0x17d145[_0x90c9('0x27')]['message']);}logger[_0x90c9('0x27')](_0x90c9('0x29'),_0x578380,_0x17d145[_0x90c9('0x27')][_0x90c9('0x2a')]);return _0x46e2be(_0x17d145[_0x90c9('0x27')][_0x90c9('0x2a')]);}else{logger[_0x90c9('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x578380,_0x90c9('0x24'));_0x46e2be(_0x17d145[_0x90c9('0x2b')][_0x90c9('0x2a')]);}})[_0x90c9('0x2c')](function(_0x50d575){logger[_0x90c9('0x27')](_0x90c9('0x29'),_0x578380,_0x50d575);_0x4f9718(_0x50d575);});});}function respondWithStatusCode(_0x1703c6,_0x47d4e7){_0x47d4e7=_0x47d4e7||0xcc;return function(_0x5b7266){if(_0x5b7266){return _0x1703c6[_0x90c9('0x2d')](_0x47d4e7);}return _0x1703c6['status'](_0x47d4e7)[_0x90c9('0x2e')]();};}function respondWithResult(_0x1a562a,_0x36d867){_0x36d867=_0x36d867||0xc8;return function(_0x205348){if(_0x205348){return _0x1a562a[_0x90c9('0x2f')](_0x36d867)[_0x90c9('0x30')](_0x205348);}};}function respondWithFilteredResult(_0x1d3131,_0x34f39d){return function(_0x241b72){if(_0x241b72){var _0x41a6ed=typeof _0x34f39d['offset']==='undefined'&&typeof _0x34f39d['limit']===_0x90c9('0x31');var _0x4906c5=_0x241b72['count'];var _0x3146de=_0x41a6ed?0x0:_0x34f39d[_0x90c9('0x32')];var _0x333019=_0x41a6ed?_0x241b72[_0x90c9('0x33')]:_0x34f39d['offset']+_0x34f39d[_0x90c9('0x34')];var _0x13bfa7;if(_0x333019>=_0x4906c5){_0x333019=_0x4906c5;_0x13bfa7=0xc8;}else{_0x13bfa7=0xce;}_0x1d3131[_0x90c9('0x2f')](_0x13bfa7);return _0x1d3131[_0x90c9('0x35')](_0x90c9('0x36'),_0x3146de+'-'+_0x333019+'/'+_0x4906c5)[_0x90c9('0x30')](_0x241b72);}return null;};}function patchUpdates(_0x4ab85a){return function(_0xcc690d){try{jsonpatch[_0x90c9('0x37')](_0xcc690d,_0x4ab85a,!![]);}catch(_0x5a8d09){return BPromise[_0x90c9('0x38')](_0x5a8d09);}return _0xcc690d[_0x90c9('0x39')]();};}function saveUpdates(_0x2935ad,_0x1d6b28){return function(_0xc515fd){if(_0xc515fd){return _0xc515fd[_0x90c9('0x3a')](_0x2935ad)[_0x90c9('0x22')](function(_0x2ba901){return _0x2ba901;});}return null;};}function removeEntity(_0x1013c1,_0x21a975){return function(_0x295dc4){if(_0x295dc4){return _0x295dc4[_0x90c9('0x3b')]()[_0x90c9('0x22')](function(){var _0x38155a=_0x295dc4['get']({'plain':!![]});var _0xb345d9=_0x90c9('0x3c');return db['UserProfileResource'][_0x90c9('0x3b')]({'where':{'type':_0xb345d9,'resourceId':_0x38155a['id']}})[_0x90c9('0x22')](function(){return _0x295dc4;});})['then'](function(){_0x1013c1['status'](0xcc)[_0x90c9('0x2e')]();});}};}function handleEntityNotFound(_0x47b904,_0x3d1811){return function(_0x4fc61c){if(!_0x4fc61c){_0x47b904[_0x90c9('0x2d')](0x194);}return _0x4fc61c;};}function handleError(_0x3ccdc0,_0x780e41){_0x780e41=_0x780e41||0x1f4;return function(_0x2d7075){logger[_0x90c9('0x27')](_0x2d7075[_0x90c9('0x3d')]);if(_0x2d7075[_0x90c9('0x3e')]){delete _0x2d7075[_0x90c9('0x3e')];}_0x3ccdc0[_0x90c9('0x2f')](_0x780e41)[_0x90c9('0x3f')](_0x2d7075);};}exports[_0x90c9('0x40')]=function(_0x41b7bf,_0x41aff3){var _0x34cc31={'include':[{'model':db[_0x90c9('0x41')],'as':_0x90c9('0x42')}]},_0x51787e={},_0x103d16={'count':0x0,'rows':[]};var _0x31c6a7=_[_0x90c9('0x43')](db[_0x90c9('0x44')][_0x90c9('0x45')],function(_0x4d70f3){return{'name':_0x4d70f3[_0x90c9('0x46')],'type':_0x4d70f3['type'][_0x90c9('0x47')]};});_0x51787e[_0x90c9('0x48')]=_[_0x90c9('0x43')](_0x31c6a7,'name');_0x51787e[_0x90c9('0x49')]=_[_0x90c9('0x4a')](_0x41b7bf['query']);_0x51787e['filters']=_[_0x90c9('0x4b')](_0x51787e[_0x90c9('0x48')],_0x51787e[_0x90c9('0x49')]);_0x34cc31[_0x90c9('0x4c')]=_[_0x90c9('0x4b')](_0x51787e[_0x90c9('0x48')],qs['fields'](_0x41b7bf[_0x90c9('0x49')][_0x90c9('0x4d')]));_0x34cc31[_0x90c9('0x4c')]=_0x34cc31[_0x90c9('0x4c')][_0x90c9('0x4e')]?_0x34cc31['attributes']:_0x51787e[_0x90c9('0x48')];if(!_0x41b7bf['query'][_0x90c9('0x4f')](_0x90c9('0x50'))){_0x34cc31[_0x90c9('0x34')]=qs['limit'](_0x41b7bf[_0x90c9('0x49')][_0x90c9('0x34')]);_0x34cc31[_0x90c9('0x32')]=qs[_0x90c9('0x32')](_0x41b7bf[_0x90c9('0x49')][_0x90c9('0x32')]);}_0x34cc31['order']=qs[_0x90c9('0x51')](_0x41b7bf[_0x90c9('0x49')][_0x90c9('0x51')]);_0x34cc31[_0x90c9('0x52')]=qs[_0x90c9('0x53')](_[_0x90c9('0x54')](_0x41b7bf[_0x90c9('0x49')],_0x51787e['filters']),_0x31c6a7);if(_0x41b7bf['query'][_0x90c9('0x55')]){_0x34cc31[_0x90c9('0x52')]=_['merge'](_0x34cc31['where'],{'$or':_[_0x90c9('0x43')](_0x31c6a7,function(_0x50fc6b){if(_0x50fc6b[_0x90c9('0x56')]!=='VIRTUAL'){var _0x3a6eea={};_0x3a6eea[_0x50fc6b[_0x90c9('0x3e')]]={'$like':'%'+_0x41b7bf[_0x90c9('0x49')][_0x90c9('0x55')]+'%'};return _0x3a6eea;}})});}_0x34cc31=_['merge']({},_0x34cc31,_0x41b7bf[_0x90c9('0x57')]);var _0x302591={'where':_0x34cc31['where']};return db['WhatsappAccount'][_0x90c9('0x33')](_0x302591)['then'](function(_0x1e578c){_0x103d16[_0x90c9('0x33')]=_0x1e578c;if(_0x41b7bf[_0x90c9('0x49')]['includeAll']){_0x34cc31[_0x90c9('0x58')]=[{'all':!![]}];}return db[_0x90c9('0x44')][_0x90c9('0x59')](_0x34cc31);})[_0x90c9('0x22')](function(_0x573277){_0x103d16[_0x90c9('0x5a')]=_0x573277;return _0x103d16;})[_0x90c9('0x22')](respondWithFilteredResult(_0x41aff3,_0x34cc31))[_0x90c9('0x2c')](handleError(_0x41aff3,null));};exports[_0x90c9('0x5b')]=function(_0x16a66a,_0x372802){var _0x46d5a4={'raw':![],'where':{'id':_0x16a66a[_0x90c9('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x90c9('0x42')}]},_0x5e2af4={};_0x5e2af4[_0x90c9('0x48')]=_[_0x90c9('0x4a')](db[_0x90c9('0x44')][_0x90c9('0x45')]);_0x5e2af4[_0x90c9('0x49')]=_[_0x90c9('0x4a')](_0x16a66a[_0x90c9('0x49')]);_0x5e2af4[_0x90c9('0x53')]=_['intersection'](_0x5e2af4['model'],_0x5e2af4[_0x90c9('0x49')]);_0x46d5a4['attributes']=_[_0x90c9('0x4b')](_0x5e2af4[_0x90c9('0x48')],qs[_0x90c9('0x4d')](_0x16a66a[_0x90c9('0x49')]['fields']));_0x46d5a4[_0x90c9('0x4c')]=_0x46d5a4[_0x90c9('0x4c')][_0x90c9('0x4e')]?_0x46d5a4[_0x90c9('0x4c')]:_0x5e2af4[_0x90c9('0x48')];if(_0x16a66a[_0x90c9('0x49')][_0x90c9('0x5d')]){_0x46d5a4[_0x90c9('0x58')]=[{'all':!![]}];}_0x46d5a4=_[_0x90c9('0x5e')]({},_0x46d5a4,_0x16a66a[_0x90c9('0x57')]);return db[_0x90c9('0x44')][_0x90c9('0x5f')](_0x46d5a4)[_0x90c9('0x22')](handleEntityNotFound(_0x372802,null))[_0x90c9('0x22')](respondWithResult(_0x372802,null))[_0x90c9('0x2c')](handleError(_0x372802,null));};exports[_0x90c9('0x60')]=function(_0x14cf4e,_0x17ce9d){return db[_0x90c9('0x44')][_0x90c9('0x60')](_0x14cf4e['body'],{})[_0x90c9('0x22')](function(_0xa70a3b){var _0x22a60e=_0x14cf4e[_0x90c9('0x61')][_0x90c9('0x62')]({'plain':!![]});if(!_0x22a60e)throw new Error(_0x90c9('0x63'));if(_0x22a60e[_0x90c9('0x64')]===_0x90c9('0x61')){var _0x4d5415=_0xa70a3b[_0x90c9('0x62')]({'plain':!![]});var _0x4a77b3='WhatsappAccounts';return db['UserProfileSection'][_0x90c9('0x5f')]({'where':{'name':_0x4a77b3,'userProfileId':_0x22a60e[_0x90c9('0x65')]},'raw':!![]})[_0x90c9('0x22')](function(_0x287225){if(_0x287225&&_0x287225[_0x90c9('0x66')]===0x0){return db[_0x90c9('0x67')]['create']({'name':_0x4d5415[_0x90c9('0x3e')],'resourceId':_0x4d5415['id'],'type':_0x287225[_0x90c9('0x3e')],'sectionId':_0x287225['id']},{})['then'](function(){return _0xa70a3b;});}else{return _0xa70a3b;}})[_0x90c9('0x2c')](function(_0x33cf61){logger[_0x90c9('0x27')](_0x90c9('0x68'),_0x33cf61);throw _0x33cf61;});}return _0xa70a3b;})[_0x90c9('0x22')](respondWithResult(_0x17ce9d,0xc9))[_0x90c9('0x2c')](handleError(_0x17ce9d,null));};exports['update']=function(_0x25dceb,_0x445e12){if(_0x25dceb[_0x90c9('0x69')]['id']){delete _0x25dceb[_0x90c9('0x69')]['id'];}return db[_0x90c9('0x44')][_0x90c9('0x5f')]({'where':{'id':_0x25dceb[_0x90c9('0x5c')]['id']},'include':[{'model':db[_0x90c9('0x41')],'as':_0x90c9('0x42')}]})['then'](handleEntityNotFound(_0x445e12,null))[_0x90c9('0x22')](saveUpdates(_0x25dceb['body'],null))['then'](respondWithResult(_0x445e12,null))[_0x90c9('0x2c')](handleError(_0x445e12,null));};exports['destroy']=function(_0x4725f6,_0xb11931){return db[_0x90c9('0x44')][_0x90c9('0x5f')]({'where':{'id':_0x4725f6['params']['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0xb11931,null))['then'](removeEntity(_0xb11931,null))[_0x90c9('0x2c')](handleError(_0xb11931,null));};exports['describe']=function(_0x4bd474,_0x23cf18){return db['WhatsappAccount'][_0x90c9('0x6a')]()[_0x90c9('0x22')](respondWithResult(_0x23cf18,null))[_0x90c9('0x2c')](handleError(_0x23cf18,null));};exports[_0x90c9('0x6b')]=function(_0x2bc0b8,_0x2c2cb9,_0x51ac10){if(_0x2bc0b8[_0x90c9('0x69')]['id']){delete _0x2bc0b8[_0x90c9('0x69')]['id'];}return db[_0x90c9('0x44')]['find']({'where':{'id':_0x2bc0b8['params']['id']}})['then'](handleEntityNotFound(_0x2c2cb9,null))[_0x90c9('0x22')](function(_0x14dadf){if(_0x14dadf){_0x2bc0b8[_0x90c9('0x69')][_0x90c9('0x6c')]=_0x14dadf['id'];return db['Disposition'][_0x90c9('0x60')](_0x2bc0b8[_0x90c9('0x69')]);}})[_0x90c9('0x22')](respondWithResult(_0x2c2cb9,null))[_0x90c9('0x2c')](handleError(_0x2c2cb9,null));};exports[_0x90c9('0x6d')]=function(_0x5d0462,_0x1358fb,_0x402ea8){var _0x1afed5={'raw':![],'where':{}};var _0x3ffddb={};var _0x4fd59c={'count':0x0,'rows':[]};return db[_0x90c9('0x44')][_0x90c9('0x6e')]({'where':{'id':_0x5d0462[_0x90c9('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1358fb,null))[_0x90c9('0x22')](function(_0x424281){if(_0x424281){_0x3ffddb['model']=_['keys'](db[_0x90c9('0x6f')][_0x90c9('0x45')]);_0x3ffddb[_0x90c9('0x49')]=_[_0x90c9('0x4a')](_0x5d0462['query']);_0x3ffddb[_0x90c9('0x53')]=_[_0x90c9('0x4b')](_0x3ffddb[_0x90c9('0x48')],_0x3ffddb[_0x90c9('0x49')]);_0x1afed5[_0x90c9('0x4c')]=_[_0x90c9('0x4b')](_0x3ffddb['model'],qs[_0x90c9('0x4d')](_0x5d0462['query'][_0x90c9('0x4d')]));_0x1afed5['attributes']=_0x1afed5[_0x90c9('0x4c')][_0x90c9('0x4e')]?_0x1afed5[_0x90c9('0x4c')]:_0x3ffddb[_0x90c9('0x48')];if(!_0x5d0462[_0x90c9('0x49')][_0x90c9('0x4f')](_0x90c9('0x50'))){_0x1afed5[_0x90c9('0x34')]=qs[_0x90c9('0x34')](_0x5d0462['query'][_0x90c9('0x34')]);_0x1afed5['offset']=qs['offset'](_0x5d0462[_0x90c9('0x49')][_0x90c9('0x32')]);}_0x1afed5[_0x90c9('0x70')]=qs[_0x90c9('0x51')](_0x5d0462['query'][_0x90c9('0x51')]);_0x1afed5[_0x90c9('0x52')]=qs[_0x90c9('0x53')](_[_0x90c9('0x54')](_0x5d0462[_0x90c9('0x49')],_0x3ffddb['filters']));_0x1afed5[_0x90c9('0x52')][_0x90c9('0x6c')]=_0x424281['id'];if(_0x5d0462[_0x90c9('0x49')]['filter']){_0x1afed5[_0x90c9('0x52')]=_[_0x90c9('0x5e')](_0x1afed5[_0x90c9('0x52')],{'$or':_[_0x90c9('0x43')](_0x1afed5[_0x90c9('0x4c')],function(_0x2f2c88){var _0x44231c={};_0x44231c[_0x2f2c88]={'$like':'%'+_0x5d0462['query'][_0x90c9('0x55')]+'%'};return _0x44231c;})});}_0x1afed5=_[_0x90c9('0x5e')]({},_0x1afed5,_0x5d0462['options']);return db[_0x90c9('0x6f')][_0x90c9('0x33')]({'where':_0x1afed5[_0x90c9('0x52')]})['then'](function(_0x24db1e){_0x4fd59c[_0x90c9('0x33')]=_0x24db1e;if(_0x5d0462[_0x90c9('0x49')][_0x90c9('0x5d')]){_0x1afed5[_0x90c9('0x58')]=[{'all':!![]}];}return db[_0x90c9('0x6f')]['findAll'](_0x1afed5);})[_0x90c9('0x22')](function(_0x563885){_0x4fd59c[_0x90c9('0x5a')]=_0x563885;return _0x4fd59c;});}})[_0x90c9('0x22')](respondWithFilteredResult(_0x1358fb,_0x1afed5))['catch'](handleError(_0x1358fb,null));};exports[_0x90c9('0x71')]=function(_0x21c9c9,_0x3e5321,_0x481f16){return db['WhatsappAccount'][_0x90c9('0x5f')]({'where':{'id':_0x21c9c9[_0x90c9('0x5c')]['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0x3e5321,null))[_0x90c9('0x22')](function(_0x3569a1){if(_0x3569a1){return _0x3569a1[_0x90c9('0x71')](_0x21c9c9[_0x90c9('0x49')][_0x90c9('0x72')]);}})[_0x90c9('0x22')](respondWithStatusCode(_0x3e5321,null))[_0x90c9('0x2c')](handleError(_0x3e5321,null));};exports[_0x90c9('0x73')]=function(_0x3cdd4b,_0x4be6cf,_0x40efad){if(_0x3cdd4b['body']['id']){delete _0x3cdd4b[_0x90c9('0x69')]['id'];}return db[_0x90c9('0x44')]['find']({'where':{'id':_0x3cdd4b['params']['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0x4be6cf,null))[_0x90c9('0x22')](function(_0x5f2363){if(_0x5f2363){_0x3cdd4b[_0x90c9('0x69')]['WhatsappAccountId']=_0x5f2363['id'];return db['CannedAnswer']['create'](_0x3cdd4b[_0x90c9('0x69')]);}})[_0x90c9('0x22')](respondWithResult(_0x4be6cf,null))[_0x90c9('0x2c')](handleError(_0x4be6cf,null));};exports[_0x90c9('0x74')]=function(_0x476745,_0x224194,_0x59d551){var _0x20f1ee={'raw':![],'where':{}};var _0x39a26c={};var _0x5acbc2={'count':0x0,'rows':[]};return db[_0x90c9('0x44')][_0x90c9('0x6e')]({'where':{'id':_0x476745['params']['id']}})['then'](handleEntityNotFound(_0x224194,null))[_0x90c9('0x22')](function(_0x3729ce){if(_0x3729ce){_0x39a26c[_0x90c9('0x48')]=_['keys'](db[_0x90c9('0x75')][_0x90c9('0x45')]);_0x39a26c[_0x90c9('0x49')]=_[_0x90c9('0x4a')](_0x476745[_0x90c9('0x49')]);_0x39a26c[_0x90c9('0x53')]=_[_0x90c9('0x4b')](_0x39a26c['model'],_0x39a26c[_0x90c9('0x49')]);_0x20f1ee[_0x90c9('0x4c')]=_[_0x90c9('0x4b')](_0x39a26c[_0x90c9('0x48')],qs['fields'](_0x476745[_0x90c9('0x49')]['fields']));_0x20f1ee[_0x90c9('0x4c')]=_0x20f1ee[_0x90c9('0x4c')][_0x90c9('0x4e')]?_0x20f1ee[_0x90c9('0x4c')]:_0x39a26c[_0x90c9('0x48')];if(!_0x476745[_0x90c9('0x49')]['hasOwnProperty'](_0x90c9('0x50'))){_0x20f1ee['limit']=qs[_0x90c9('0x34')](_0x476745[_0x90c9('0x49')][_0x90c9('0x34')]);_0x20f1ee[_0x90c9('0x32')]=qs['offset'](_0x476745[_0x90c9('0x49')][_0x90c9('0x32')]);}_0x20f1ee[_0x90c9('0x70')]=qs[_0x90c9('0x51')](_0x476745['query'][_0x90c9('0x51')]);_0x20f1ee[_0x90c9('0x52')]=qs[_0x90c9('0x53')](_['pick'](_0x476745[_0x90c9('0x49')],_0x39a26c[_0x90c9('0x53')]));_0x20f1ee[_0x90c9('0x52')][_0x90c9('0x6c')]=_0x3729ce['id'];if(_0x476745[_0x90c9('0x49')]['filter']){_0x20f1ee[_0x90c9('0x52')]=_['merge'](_0x20f1ee[_0x90c9('0x52')],{'$or':_['map'](_0x20f1ee[_0x90c9('0x4c')],function(_0x3fc7c2){var _0x5069e2={};_0x5069e2[_0x3fc7c2]={'$like':'%'+_0x476745['query'][_0x90c9('0x55')]+'%'};return _0x5069e2;})});}_0x20f1ee=_[_0x90c9('0x5e')]({},_0x20f1ee,_0x476745[_0x90c9('0x57')]);return db['CannedAnswer'][_0x90c9('0x33')]({'where':_0x20f1ee[_0x90c9('0x52')]})[_0x90c9('0x22')](function(_0x542512){_0x5acbc2[_0x90c9('0x33')]=_0x542512;if(_0x476745[_0x90c9('0x49')][_0x90c9('0x5d')]){_0x20f1ee[_0x90c9('0x58')]=[{'all':!![]}];}return db[_0x90c9('0x75')][_0x90c9('0x59')](_0x20f1ee);})[_0x90c9('0x22')](function(_0x4b5e56){_0x5acbc2[_0x90c9('0x5a')]=_0x4b5e56;return _0x5acbc2;});}})['then'](respondWithFilteredResult(_0x224194,_0x20f1ee))[_0x90c9('0x2c')](handleError(_0x224194,null));};exports['removeAnswers']=function(_0x3939d6,_0x473257,_0x416708){return db['WhatsappAccount']['find']({'where':{'id':_0x3939d6[_0x90c9('0x5c')]['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0x473257,null))[_0x90c9('0x22')](function(_0xf5aa4b){if(_0xf5aa4b){return _0xf5aa4b['removeAnswers'](_0x3939d6[_0x90c9('0x49')][_0x90c9('0x72')]);}})[_0x90c9('0x22')](respondWithStatusCode(_0x473257,null))[_0x90c9('0x2c')](handleError(_0x473257,null));};exports['addAgents']=function(_0x2ed926,_0x122eb6,_0x150ece){return db['WhatsappAccount'][_0x90c9('0x5f')]({'where':{'id':_0x2ed926[_0x90c9('0x5c')]['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0x122eb6,null))[_0x90c9('0x22')](function(_0x35ab1b){if(_0x35ab1b){return _0x35ab1b[_0x90c9('0x76')](_0x2ed926[_0x90c9('0x69')][_0x90c9('0x72')],_[_0x90c9('0x77')](_0x2ed926[_0x90c9('0x69')],[_0x90c9('0x72'),'id'])||{})[_0x90c9('0x78')](function(_0xa8d4ec){for(var _0xbcc6d2=0x0;_0xbcc6d2<_0x2ed926[_0x90c9('0x69')][_0x90c9('0x72')][_0x90c9('0x4e')];_0xbcc6d2+=0x1){socket[_0x90c9('0x79')]('userWhatsappAccount:save',{'UserId':Number(_0x2ed926[_0x90c9('0x69')][_0x90c9('0x72')][_0xbcc6d2]),'WhatsappAccountId':Number(_0x2ed926[_0x90c9('0x5c')]['id'])});}return _0xa8d4ec;});}})[_0x90c9('0x22')](respondWithResult(_0x122eb6,null))['catch'](handleError(_0x122eb6,null));};exports[_0x90c9('0x7a')]=function(_0x4e0e0c,_0x1b39d5,_0x2c289c){return db['WhatsappAccount'][_0x90c9('0x5f')]({'where':{'id':_0x4e0e0c[_0x90c9('0x5c')]['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0x1b39d5,null))[_0x90c9('0x22')](function(_0x4d8fe2){if(_0x4d8fe2){return _0x4d8fe2[_0x90c9('0x7a')](_0x4e0e0c[_0x90c9('0x49')][_0x90c9('0x72')])[_0x90c9('0x22')](function(){if(_['isArray'](_0x4e0e0c[_0x90c9('0x49')][_0x90c9('0x72')])){for(var _0x47937a=0x0;_0x47937a<_0x4e0e0c[_0x90c9('0x49')][_0x90c9('0x72')][_0x90c9('0x4e')];_0x47937a+=0x1){socket[_0x90c9('0x79')](_0x90c9('0x7b'),{'UserId':Number(_0x4e0e0c[_0x90c9('0x49')][_0x90c9('0x72')][_0x47937a]),'WhatsappAccountId':Number(_0x4e0e0c[_0x90c9('0x5c')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x4e0e0c[_0x90c9('0x49')][_0x90c9('0x72')]),'WhatsappAccountId':Number(_0x4e0e0c[_0x90c9('0x5c')]['id'])});}});}})[_0x90c9('0x22')](respondWithStatusCode(_0x1b39d5,null))[_0x90c9('0x2c')](handleError(_0x1b39d5,null));};exports[_0x90c9('0x7c')]=function(_0x3be792,_0x3b0d9a,_0x279da3){var _0x42bc3d={};var _0x4d233c={};var _0xfb08d;var _0x585c5a;return db[_0x90c9('0x44')][_0x90c9('0x6e')]({'where':{'id':_0x3be792[_0x90c9('0x5c')]['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0x3b0d9a,null))[_0x90c9('0x22')](function(_0x2bd00a){if(_0x2bd00a){_0xfb08d=_0x2bd00a;_0x4d233c[_0x90c9('0x48')]=_[_0x90c9('0x4a')](db[_0x90c9('0x7d')][_0x90c9('0x45')]);_0x4d233c['query']=_[_0x90c9('0x4a')](_0x3be792[_0x90c9('0x49')]);_0x4d233c['filters']=_[_0x90c9('0x4b')](_0x4d233c[_0x90c9('0x48')],_0x4d233c[_0x90c9('0x49')]);_0x42bc3d[_0x90c9('0x4c')]=_['intersection'](_0x4d233c[_0x90c9('0x48')],qs[_0x90c9('0x4d')](_0x3be792[_0x90c9('0x49')][_0x90c9('0x4d')]));_0x42bc3d[_0x90c9('0x4c')]=_0x42bc3d[_0x90c9('0x4c')][_0x90c9('0x4e')]?_0x42bc3d[_0x90c9('0x4c')]:_0x4d233c[_0x90c9('0x48')];_0x42bc3d[_0x90c9('0x70')]=qs[_0x90c9('0x51')](_0x3be792['query'][_0x90c9('0x51')]);_0x42bc3d[_0x90c9('0x52')]=qs[_0x90c9('0x53')](_[_0x90c9('0x54')](_0x3be792[_0x90c9('0x49')],_0x4d233c[_0x90c9('0x53')]));if(_0x3be792[_0x90c9('0x49')]['filter']){_0x42bc3d[_0x90c9('0x52')]=_[_0x90c9('0x5e')](_0x42bc3d['where'],{'$or':_[_0x90c9('0x43')](_0x42bc3d['attributes'],function(_0x4e1505){var _0x1989ee={};_0x1989ee[_0x4e1505]={'$like':'%'+_0x3be792[_0x90c9('0x49')][_0x90c9('0x55')]+'%'};return _0x1989ee;})});}_0x42bc3d=_[_0x90c9('0x5e')]({},_0x42bc3d,_0x3be792['options']);return _0xfb08d[_0x90c9('0x7c')](_0x42bc3d);}})[_0x90c9('0x22')](function(_0x3654b3){if(_0x3654b3){_0x585c5a=_0x3654b3[_0x90c9('0x4e')];if(!_0x3be792[_0x90c9('0x49')]['hasOwnProperty'](_0x90c9('0x50'))){_0x42bc3d[_0x90c9('0x34')]=qs['limit'](_0x3be792[_0x90c9('0x49')][_0x90c9('0x34')]);_0x42bc3d[_0x90c9('0x32')]=qs[_0x90c9('0x32')](_0x3be792[_0x90c9('0x49')][_0x90c9('0x32')]);}return _0xfb08d[_0x90c9('0x7c')](_0x42bc3d);}})[_0x90c9('0x22')](function(_0x180d78){if(_0x180d78){return _0x180d78?{'count':_0x585c5a,'rows':_0x180d78}:null;}})['then'](respondWithResult(_0x3b0d9a,null))[_0x90c9('0x2c')](handleError(_0x3b0d9a,null));};exports[_0x90c9('0x7e')]=function(_0x1efb87,_0x1c3e1f){var _0xbab46c=_0x1efb87[_0x90c9('0x5c')]['id'];var _0x43e4ba=_0x1efb87[_0x90c9('0x69')];var _0xeb5b0=0xc8;var _0x50dbbf=null;return db[_0x90c9('0x7f')][_0x90c9('0x80')]({'isolationLevel':db['sequelize'][_0x90c9('0x81')]['ISOLATION_LEVELS'][_0x90c9('0x82')]},function(_0x3cfd4a){return db[_0x90c9('0x44')][_0x90c9('0x6e')]({'where':{'id':_0xbab46c},'transaction':_0x3cfd4a})['then'](function(_0x201c23){if(_0x201c23){return db[_0x90c9('0x83')][_0x90c9('0x3b')]({'where':{'WhatsappAccountId':_0xbab46c},'transaction':_0x3cfd4a})[_0x90c9('0x22')](function(){var _0x27cec1=_[_0x90c9('0x43')](_0x43e4ba,function(_0x7f5625){_0x7f5625[_0x90c9('0x6c')]=_0xbab46c;return _0x7f5625;});return db[_0x90c9('0x83')]['bulkCreate'](_0x27cec1,{'transaction':_0x3cfd4a});});}else{_0xeb5b0=0x194;_0x50dbbf=[];}});})[_0x90c9('0x22')](function(){if(_0xeb5b0!==0x194){return db['WhatsappApplication'][_0x90c9('0x84')]({'where':{'WhatsappAccountId':_0xbab46c},'order':_0x90c9('0x85')})[_0x90c9('0x22')](function(_0x2169f4){_0x50dbbf=_0x2169f4;});}})['catch'](function(_0x5b81af){_0xeb5b0=0x1f4;logger[_0x90c9('0x27')](_0x5b81af['stack']);if(_0x5b81af[_0x90c9('0x3e')]){delete _0x5b81af[_0x90c9('0x3e')];}_0x50dbbf=_0x5b81af;})[_0x90c9('0x86')](function(){if(_0x50dbbf===null){_0x1c3e1f[_0x90c9('0x2d')](_0xeb5b0);}else{if(_0xeb5b0===0x1f4){_0x1c3e1f[_0x90c9('0x2f')](_0xeb5b0)[_0x90c9('0x3f')](_0x50dbbf);}else{_0x1c3e1f[_0x90c9('0x2f')](_0xeb5b0)['json'](_0x50dbbf);}}});};exports[_0x90c9('0x87')]=function(_0xaaedf3,_0x2695e2,_0x5d11f8){var _0x16ffd0={};var _0x32617c={};var _0x509035;var _0x1515b3;return db[_0x90c9('0x44')][_0x90c9('0x6e')]({'where':{'id':_0xaaedf3['params']['id']}})[_0x90c9('0x22')](handleEntityNotFound(_0x2695e2,null))[_0x90c9('0x22')](function(_0x56acb1){if(_0x56acb1){_0x509035=_0x56acb1;_0x32617c[_0x90c9('0x48')]=_[_0x90c9('0x4a')](db[_0x90c9('0x83')][_0x90c9('0x45')]);_0x32617c[_0x90c9('0x49')]=_[_0x90c9('0x4a')](_0xaaedf3[_0x90c9('0x49')]);_0x32617c['filters']=_[_0x90c9('0x4b')](_0x32617c['model'],_0x32617c[_0x90c9('0x49')]);_0x16ffd0[_0x90c9('0x4c')]=_['intersection'](_0x32617c[_0x90c9('0x48')],qs[_0x90c9('0x4d')](_0xaaedf3[_0x90c9('0x49')][_0x90c9('0x4d')]));_0x16ffd0[_0x90c9('0x4c')]=_0x16ffd0[_0x90c9('0x4c')][_0x90c9('0x4e')]?_0x16ffd0['attributes']:_0x32617c[_0x90c9('0x48')];_0x16ffd0['order']=qs[_0x90c9('0x51')](_0xaaedf3['query'][_0x90c9('0x51')]);_0x16ffd0[_0x90c9('0x52')]=qs['filters'](_['pick'](_0xaaedf3[_0x90c9('0x49')],_0x32617c['filters']));if(_0xaaedf3[_0x90c9('0x49')]['filter']){_0x16ffd0[_0x90c9('0x52')]=_['merge'](_0x16ffd0[_0x90c9('0x52')],{'$or':_['map'](_0x16ffd0[_0x90c9('0x4c')],function(_0x898e0a){var _0x4bfe83={};_0x4bfe83[_0x898e0a]={'$like':'%'+_0xaaedf3[_0x90c9('0x49')][_0x90c9('0x55')]+'%'};return _0x4bfe83;})});}_0x16ffd0=_['merge']({},_0x16ffd0,_0xaaedf3[_0x90c9('0x57')]);return _0x509035[_0x90c9('0x87')](_0x16ffd0);}})[_0x90c9('0x22')](function(_0xafc62e){if(_0xafc62e){_0x1515b3=_0xafc62e['length'];if(!_0xaaedf3[_0x90c9('0x49')][_0x90c9('0x4f')](_0x90c9('0x50'))){_0x16ffd0[_0x90c9('0x34')]=qs[_0x90c9('0x34')](_0xaaedf3[_0x90c9('0x49')][_0x90c9('0x34')]);_0x16ffd0[_0x90c9('0x32')]=qs[_0x90c9('0x32')](_0xaaedf3[_0x90c9('0x49')][_0x90c9('0x32')]);}return _0x509035[_0x90c9('0x87')](_0x16ffd0);}})[_0x90c9('0x22')](function(_0x56f1dd){if(_0x56f1dd){return _0x56f1dd?{'count':_0x1515b3,'rows':_0x56f1dd}:null;}})['then'](respondWithResult(_0x2695e2,null))[_0x90c9('0x2c')](handleError(_0x2695e2,null));};exports[_0x90c9('0x88')]=function(_0x498be2,_0x513aa8,_0x213e6c){var _0x3986c6={'channel':_0x90c9('0x89')};var _0x345e49=[];var _0x1b55e3=[];var _0x56d46c={};return db[_0x90c9('0x44')][_0x90c9('0x5f')]({'where':{'id':_0x498be2[_0x90c9('0x5c')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x90c9('0x8a')}]})['then'](handleEntityNotFound(_0x513aa8,null))[_0x90c9('0x22')](function(_0x589ae6){_0x3986c6[_0x90c9('0x8b')]=_0x589ae6;if(_0x3986c6[_0x90c9('0x8b')]&&_0x3986c6[_0x90c9('0x8b')][_0x90c9('0x56')]==='sinch'&&_0x498be2[_0x90c9('0x69')]['statuses']){if(_0x498be2['body'][_0x90c9('0x8c')][_0x90c9('0x4e')]===0x0)return;if(_0x498be2['body'][_0x90c9('0x8c')][0x0][_0x90c9('0x8d')]!==_0x90c9('0x8e'))return;return db[_0x90c9('0x8f')][_0x90c9('0x3a')]({'read':!![],'readAt':_0x498be2[_0x90c9('0x69')][_0x90c9('0x8c')][0x0]['timestamp']},{'where':{'messageId':_0x498be2[_0x90c9('0x69')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0x90c9('0x22')](function(_0x19c179){return _0x513aa8[_0x90c9('0x2f')](0xc8)[_0x90c9('0x30')](_0x19c179);});}_0x3986c6['applications']=_['orderBy'](_0x589ae6[_0x90c9('0x8a')],[_0x90c9('0x85')],['asc']);if(_0x3986c6['account'][_0x90c9('0x8a')]){delete _0x3986c6[_0x90c9('0x8b')]['Applications'];}return db[_0x90c9('0x90')][_0x90c9('0x6a')]()[_0x90c9('0x22')](function(_0x18de2a){if(!_0x18de2a){throw new db[(_0x90c9('0x91'))][(_0x90c9('0x92'))](_0x90c9('0x93'));}_0x345e49=_[_0x90c9('0x94')](_[_0x90c9('0x4a')](_0x18de2a),[_0x90c9('0x95'),_0x90c9('0x96')]);_0x1b55e3=_[_0x90c9('0x94')](_['keys'](_0x18de2a),[_0x90c9('0x95'),'updatedAt',_0x90c9('0x97'),_0x90c9('0x98')]);_0x3986c6[_0x90c9('0x69')]={'mapKey':'mobile'};if(_0x3986c6[_0x90c9('0x8b')]&&_0x3986c6['account'][_0x90c9('0x56')]===_0x90c9('0x99')){_0x3986c6[_0x90c9('0x69')][_0x90c9('0x9a')]=_0x498be2[_0x90c9('0x69')][_0x90c9('0x9b')][_0x90c9('0x9c')](_0x90c9('0x9d'),'');_0x3986c6[_0x90c9('0x69')][_0x90c9('0x69')]=_0x498be2['body'][_0x90c9('0x9e')];_0x3986c6[_0x90c9('0x69')][_0x90c9('0x9f')]=_0x498be2[_0x90c9('0x69')][_0x90c9('0xa0')];}if(_0x3986c6[_0x90c9('0x8b')]&&_0x3986c6[_0x90c9('0x8b')][_0x90c9('0x56')]==='sinch'){_0x3986c6[_0x90c9('0x69')][_0x90c9('0x9a')]=_0x498be2[_0x90c9('0x69')][_0x90c9('0xa1')][0x0]['from'];_0x3986c6[_0x90c9('0x69')][_0x90c9('0x69')]=_0x498be2[_0x90c9('0x69')][_0x90c9('0xa1')][0x0]['message']['body'];_0x3986c6[_0x90c9('0x69')]['messageId']=_0x498be2[_0x90c9('0x69')][_0x90c9('0xa1')][0x0][_0x90c9('0xa2')];}if(_0x3986c6[_0x90c9('0x69')]['id']){delete _0x3986c6[_0x90c9('0x69')]['id'];}if(_[_0x90c9('0xa3')](_0x3986c6[_0x90c9('0x69')][_0x90c9('0x9a')])){throw new db['Sequelize']['ValidationError'](_0x90c9('0xa4'));}if(_[_0x90c9('0xa3')](_0x3986c6[_0x90c9('0x69')][_0x90c9('0x69')])||_0x3986c6[_0x90c9('0x69')][_0x90c9('0x69')]===''){throw new db[(_0x90c9('0x91'))][(_0x90c9('0x92'))](_0x90c9('0xa5'));}if(_['isNil'](_0x3986c6['body'][_0x90c9('0xa6')])){throw new db['Sequelize'][(_0x90c9('0x92'))](_0x90c9('0xa7')+_0x1b55e3);}if(!_['includes'](_0x1b55e3,_0x3986c6[_0x90c9('0x69')][_0x90c9('0xa6')])){throw new db[(_0x90c9('0x91'))][(_0x90c9('0x92'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1b55e3);}_0x56d46c[_0x3986c6[_0x90c9('0x69')][_0x90c9('0xa6')]]=_0x3986c6['body'][_0x90c9('0x9a')];return db['CmList']['find']({'where':{'id':_0x3986c6['account']['ListId']},'include':[{'model':db[_0x90c9('0x90')],'as':'Contacts','where':_0x56d46c,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x513aa8,null))[_0x90c9('0x22')](function(_0x59cd60){if(_0x59cd60){_0x3986c6[_0x90c9('0xa8')]=_['omit'](_0x59cd60,['Contacts']);if(_0x59cd60[_0x90c9('0xa9')]['length']){return _0x59cd60['Contacts'][0x0];}var _0x5f50ec=_['defaults'](_0x3986c6['body'],{'firstName':_0x3986c6['body'][_0x90c9('0x9a')],'ListId':_0x59cd60['id']});_0x5f50ec[_0x3986c6[_0x90c9('0x69')][_0x90c9('0xa6')]]=_0x3986c6[_0x90c9('0x69')][_0x90c9('0x9a')];return db[_0x90c9('0x90')][_0x90c9('0x60')](_0x5f50ec,{'fields':_0x345e49,'raw':!![]});}})[_0x90c9('0x22')](handleEntityNotFound(_0x513aa8,null))['then'](function(_0xaf097c){if(_0xaf097c){_0x3986c6[_0x90c9('0xaa')]=_0xaf097c;var _0x151934={'ContactId':_0xaf097c['id'],'phone':_0x3986c6['body']['from'],'WhatsappAccountId':_0x498be2[_0x90c9('0x5c')]['id']};var _0xb1b327={'ContactId':_0xaf097c['id'],'WhatsappAccountId':_0x498be2['params']['id'],'closed':![]};return db[_0x90c9('0xab')][_0x90c9('0x5f')]({'where':_0xb1b327})[_0x90c9('0x22')](function(_0x420d47){if(_0x420d47){return[_0x420d47,![]];}return db[_0x90c9('0xab')]['create'](_0x151934)[_0x90c9('0x22')](function(_0x48c2f3){return[_0x48c2f3,!![]];});});}})[_0x90c9('0x78')](function(_0xd210ba,_0x243595){_0x3986c6['interaction']=_0xd210ba[_0x90c9('0x62')]({'plain':!![]});_0x3986c6[_0x90c9('0xac')][_0x90c9('0xad')]=![];if(_0x243595){if(_0x3986c6[_0x90c9('0x8b')][_0x90c9('0xae')]){_0x3986c6['applications'][_0x90c9('0xaf')]({'id':0x0,'priority':_0x3986c6[_0x90c9('0xb0')][_0x90c9('0x4e')]+0x1,'app':_0x90c9('0xb1'),'appdata':'unmanaged','interval':_0x90c9('0xb2')});}_0x3986c6[_0x90c9('0xac')]['created']=!![];}return db[_0x90c9('0x8f')][_0x90c9('0x60')]({'phone':_0x3986c6[_0x90c9('0x69')][_0x90c9('0x9a')],'messageId':_0x3986c6[_0x90c9('0x69')][_0x90c9('0x9f')],'body':_0x3986c6[_0x90c9('0x69')][_0x90c9('0x69')],'WhatsappAccountId':_0x498be2[_0x90c9('0x5c')]['id'],'WhatsappInteractionId':_0xd210ba['id'],'direction':'in','ContactId':_0xd210ba[_0x90c9('0xb3')],'AttachmentId':_0x3986c6[_0x90c9('0x69')][_0x90c9('0xb4')]});})[_0x90c9('0x22')](function(_0x40b7d3){_0x3986c6[_0x90c9('0x2a')]=_0x40b7d3;if(!_0x3986c6[_0x90c9('0xac')][_0x90c9('0xb5')])return;return db[_0x90c9('0x7d')][_0x90c9('0x5f')]({'attributes':['id',_0x90c9('0x3e')],'where':{'id':_0x3986c6[_0x90c9('0xac')][_0x90c9('0xb5')]}});})[_0x90c9('0x22')](function(_0x24c8db){if(_0x24c8db){_0x3986c6[_0x90c9('0xb0')][_0x90c9('0xb6')]({'id':0x0,'priority':0x0,'app':_0x90c9('0xb7'),'appdata':_0x24c8db['name']+','+(_0x3986c6['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x3986c6[_0x90c9('0xac')]['queueId'])return;return db[_0x90c9('0xb8')][_0x90c9('0x5f')]({'attributes':['id',_0x90c9('0x3e')],'where':{'id':_0x3986c6[_0x90c9('0xac')][_0x90c9('0xb9')]}});})['then'](function(_0xcaa838){if(_0xcaa838){_0x3986c6[_0x90c9('0xb0')][_0x90c9('0xb6')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0xcaa838[_0x90c9('0x3e')]+','+(_0x3986c6[_0x90c9('0x8b')][_0x90c9('0xba')]||0x12c),'interval':_0x90c9('0xb2')});}return respondWithRpcPromise('Start',_0x90c9('0xbb'),_0x3986c6);})['then'](function(_0x5b347f){if(_0x5b347f){var _0x185e2e=0xc8;var _0x5bae1e=_0x90c9('0xbc');logger[_0x90c9('0x23')](_0x90c9('0x26'),_0x5bae1e,_0x185e2e,_0x90c9('0xbd'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5bae1e,_0x185e2e,_0x90c9('0xbd'),JSON[_0x90c9('0xbe')](_0x5b347f));if(_0x3986c6['account']['type']==='twilio'){return _0x513aa8[_0x90c9('0x2f')](_0x185e2e)[_0x90c9('0x35')](_0x90c9('0xbf'),_0x90c9('0xc0'))[_0x90c9('0x3f')]('\x0a');}else{return _0x513aa8[_0x90c9('0x2f')](_0x185e2e)[_0x90c9('0x30')](_0x5b347f);}}});})[_0x90c9('0x2c')](handleError(_0x513aa8,null));};exports['send']=function(_0x22ddbd,_0x1a2a0b,_0x4b3271){var _0x5f55dc,_0x9da413,_0x2559de;if(_[_0x90c9('0xa3')](_0x22ddbd[_0x90c9('0x69')][_0x90c9('0x69')])||_0x22ddbd[_0x90c9('0x69')]['body']===''){throw new db[(_0x90c9('0x91'))][(_0x90c9('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x90c9('0xa3')](_0x22ddbd[_0x90c9('0x69')]['to'])){throw new db[(_0x90c9('0x91'))][(_0x90c9('0x92'))](_0x90c9('0xc1'));}_0x5f55dc=_0x22ddbd[_0x90c9('0x69')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x22ddbd[_0x90c9('0x5c')]['id']},'include':[{'model':db[_0x90c9('0xc2')],'as':_0x90c9('0xc3'),'include':[{'model':db[_0x90c9('0x90')],'as':'Contacts','where':{'mobile':_0x5f55dc},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x90c9('0x22')](handleEntityNotFound(_0x1a2a0b,null))['then'](function(_0x2ce83d){if(_0x2ce83d&&_0x2ce83d[_0x90c9('0xc3')]){_0x9da413=_0x2ce83d['get']({'plain':!![]});if(_0x9da413[_0x90c9('0xc3')]&&_0x9da413[_0x90c9('0xc3')][_0x90c9('0xa9')][_0x90c9('0x4e')]){return _0x9da413[_0x90c9('0xc3')][_0x90c9('0xa9')][0x0];}return db['CmContact'][_0x90c9('0x60')](_[_0x90c9('0x1a')](_0x22ddbd[_0x90c9('0x69')],{'firstName':_0x5f55dc,'mobile':_0x5f55dc,'phone':_0x5f55dc,'ListId':_0x9da413[_0x90c9('0x98')]}));}})['then'](handleEntityNotFound(_0x1a2a0b,null))['then'](function(_0x59c190){if(_0x59c190){_0x2559de=_0x59c190;return db[_0x90c9('0xab')][_0x90c9('0x5f')]({'where':{'ContactId':_0x2559de['id'],'closed':![],'WhatsappAccountId':_0x9da413['id']}})['then'](function(_0x2c4f97){if(_0x2c4f97){return[_0x2c4f97,![]];}return db[_0x90c9('0xab')][_0x90c9('0x60')]({'UserId':_0x22ddbd[_0x90c9('0x61')]['id'],'ContactId':_0x2559de['id'],'WhatsappAccountId':_0x9da413['id'],'phone':_0x5f55dc,'firstMsgDirection':_0x90c9('0xc4'),'Messages':[_[_0x90c9('0x5e')](_0x22ddbd[_0x90c9('0x69')],{'read':![],'body':_0x22ddbd['body'][_0x90c9('0x69')],'phone':_0x5f55dc,'WhatsappAccountId':_0x9da413['id'],'UserId':_0x22ddbd[_0x90c9('0x61')]['id'],'ContactId':_0x2559de['id']})]},{'include':[{'model':db[_0x90c9('0x8f')],'as':'Messages'}]})[_0x90c9('0x22')](function(_0x5b47dd){return[_0x5b47dd,!![]];});});}})['spread'](function(_0x4f4beb,_0x386af4){if(_0x386af4){return _0x4f4beb;}return db['WhatsappMessage'][_0x90c9('0x60')](_['merge'](_0x22ddbd[_0x90c9('0x69')],{'read':![],'body':_0x22ddbd[_0x90c9('0x69')]['body'],'phone':_0x5f55dc,'WhatsappAccountId':_0x9da413['id'],'WhatsappInteractionId':_0x4f4beb['id'],'UserId':_0x22ddbd['user']['id'],'ContactId':_0x2559de['id']}))[_0x90c9('0x22')](function(_0x12949a){_0x4f4beb['dataValues']['Messages']=[];_0x4f4beb['dataValues']['Messages'][_0x90c9('0xaf')](_0x12949a[_0x90c9('0xc5')]);return _0x4f4beb;});})[_0x90c9('0x22')](respondWithResult(_0x1a2a0b,null))[_0x90c9('0x2c')](handleError(_0x1a2a0b,null));}; \ No newline at end of file +var _0x6426=['Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','name','send','Pause','WhatsappAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','rows','show','mandatoryDispositionPause','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','pick','findAll','removeDispositions','ids','getAnswers','findOne','CannedAnswer','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','notify','Applications','account','statuses','state','WhatsappMessage','message_id','applications','orderBy','asc','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','mobile','from','From','replace','MessageSid','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','DESC','list','omit','defaults','contact','WhatsappInteraction','interaction','autoclose','unmanaged','*,*,*,*','created','ContactId','UserId','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','unshift','queue','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','twilio','Content-Type','CmList','List','ListId','out','Messages','dataValues','push','eml-format','rimraf','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','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set'];(function(_0x5abdcb,_0x448754){var _0x260614=function(_0x2cd054){while(--_0x2cd054){_0x5abdcb['push'](_0x5abdcb['shift']());}};_0x260614(++_0x448754);}(_0x6426,0x15b));var _0x6642=function(_0xbd5190,_0x380f7f){_0xbd5190=_0xbd5190-0x0;var _0xcb49ab=_0x6426[_0xbd5190];return _0xcb49ab;};'use strict';var emlformat=require(_0x6642('0x0'));var rimraf=require(_0x6642('0x1'));var zipdir=require(_0x6642('0x2'));var jsonpatch=require(_0x6642('0x3'));var rp=require(_0x6642('0x4'));var moment=require('moment');var BPromise=require(_0x6642('0x5'));var Mustache=require(_0x6642('0x6'));var util=require('util');var path=require(_0x6642('0x7'));var sox=require(_0x6642('0x8'));var csv=require(_0x6642('0x9'));var ejs=require(_0x6642('0xa'));var fs=require('fs');var fs_extra=require(_0x6642('0xb'));var _=require(_0x6642('0xc'));var squel=require('squel');var crypto=require(_0x6642('0xd'));var jsforce=require(_0x6642('0xe'));var deskjs=require(_0x6642('0xf'));var toCsv=require(_0x6642('0x9'));var querystring=require(_0x6642('0x10'));var Papa=require(_0x6642('0x11'));var Redis=require(_0x6642('0x12'));var authService=require(_0x6642('0x13'));var qs=require(_0x6642('0x14'));var as=require(_0x6642('0x15'));var hardwareService=require(_0x6642('0x16'));var logger=require(_0x6642('0x17'))(_0x6642('0x18'));var utils=require('../../config/utils');var config=require(_0x6642('0x19'));var licenseUtil=require(_0x6642('0x1a'));var db=require(_0x6642('0x1b'))['db'];config['redis']=_['defaults'](config[_0x6642('0x1c')],{'host':_0x6642('0x1d'),'port':0x18eb});var socket=require(_0x6642('0x1e'))(new Redis(config[_0x6642('0x1c')]));require(_0x6642('0x1f'))[_0x6642('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6642('0x21')][_0x6642('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x40421f,_0x7371df,_0x76ea55,_0x4679e1){return new BPromise(function(_0x5c15f8,_0x3146e5){var _0x1fba71=_0x4679e1||client;return _0x1fba71[_0x6642('0x23')](_0x40421f,_0x76ea55)[_0x6642('0x24')](function(_0x4e4f9e){logger[_0x6642('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x7371df,_0x6642('0x26'));logger[_0x6642('0x27')](_0x6642('0x28'),_0x7371df,_0x6642('0x26'),JSON['stringify'](_0x4e4f9e));if(_0x4e4f9e[_0x6642('0x29')]){if(_0x4e4f9e['error']['code']===0x1f4){logger[_0x6642('0x29')]('WhatsappAccount,\x20%s,\x20%s',_0x7371df,_0x4e4f9e['error']['message']);return _0x3146e5(_0x4e4f9e['error']['message']);}logger[_0x6642('0x29')](_0x6642('0x2a'),_0x7371df,_0x4e4f9e[_0x6642('0x29')][_0x6642('0x2b')]);return _0x5c15f8(_0x4e4f9e[_0x6642('0x29')][_0x6642('0x2b')]);}else{logger[_0x6642('0x25')](_0x6642('0x2a'),_0x7371df,_0x6642('0x26'));_0x5c15f8(_0x4e4f9e[_0x6642('0x2c')][_0x6642('0x2b')]);}})[_0x6642('0x2d')](function(_0x4187c9){logger[_0x6642('0x29')]('WhatsappAccount,\x20%s,\x20%s',_0x7371df,_0x4187c9);_0x3146e5(_0x4187c9);});});}function respondWithStatusCode(_0x2fc6d5,_0xd129fd){_0xd129fd=_0xd129fd||0xcc;return function(_0x354410){if(_0x354410){return _0x2fc6d5[_0x6642('0x2e')](_0xd129fd);}return _0x2fc6d5['status'](_0xd129fd)[_0x6642('0x2f')]();};}function respondWithResult(_0x56fa6f,_0x1ff1fd){_0x1ff1fd=_0x1ff1fd||0xc8;return function(_0x4ecd4c){if(_0x4ecd4c){return _0x56fa6f[_0x6642('0x30')](_0x1ff1fd)[_0x6642('0x31')](_0x4ecd4c);}};}function respondWithFilteredResult(_0x5b8a22,_0x16c096){return function(_0x54406c){if(_0x54406c){var _0x31b623=typeof _0x16c096['offset']===_0x6642('0x32')&&typeof _0x16c096[_0x6642('0x33')]===_0x6642('0x32');var _0x54728f=_0x54406c[_0x6642('0x34')];var _0x5b3216=_0x31b623?0x0:_0x16c096['offset'];var _0x17b098=_0x31b623?_0x54406c['count']:_0x16c096[_0x6642('0x35')]+_0x16c096[_0x6642('0x33')];var _0x1d020c;if(_0x17b098>=_0x54728f){_0x17b098=_0x54728f;_0x1d020c=0xc8;}else{_0x1d020c=0xce;}_0x5b8a22[_0x6642('0x30')](_0x1d020c);return _0x5b8a22[_0x6642('0x36')](_0x6642('0x37'),_0x5b3216+'-'+_0x17b098+'/'+_0x54728f)[_0x6642('0x31')](_0x54406c);}return null;};}function patchUpdates(_0x1b4fdd){return function(_0x2cb478){try{jsonpatch[_0x6642('0x38')](_0x2cb478,_0x1b4fdd,!![]);}catch(_0x4a8148){return BPromise[_0x6642('0x39')](_0x4a8148);}return _0x2cb478[_0x6642('0x3a')]();};}function saveUpdates(_0x27c8d2,_0x40f6bd){return function(_0xf285b8){if(_0xf285b8){return _0xf285b8[_0x6642('0x3b')](_0x27c8d2)[_0x6642('0x24')](function(_0x40a050){return _0x40a050;});}return null;};}function removeEntity(_0x34351b,_0x17d38d){return function(_0x350b1c){if(_0x350b1c){return _0x350b1c[_0x6642('0x3c')]()[_0x6642('0x24')](function(){var _0x3e4c31=_0x350b1c[_0x6642('0x3d')]({'plain':!![]});var _0x50f5af=_0x6642('0x3e');return db[_0x6642('0x3f')][_0x6642('0x3c')]({'where':{'type':_0x50f5af,'resourceId':_0x3e4c31['id']}})['then'](function(){return _0x350b1c;});})[_0x6642('0x24')](function(){_0x34351b[_0x6642('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32493e,_0x43a1ff){return function(_0x55f9c6){if(!_0x55f9c6){_0x32493e[_0x6642('0x2e')](0x194);}return _0x55f9c6;};}function handleError(_0x289290,_0x45c147){_0x45c147=_0x45c147||0x1f4;return function(_0x1aba04){logger[_0x6642('0x29')](_0x1aba04['stack']);if(_0x1aba04['name']){delete _0x1aba04[_0x6642('0x40')];}_0x289290['status'](_0x45c147)[_0x6642('0x41')](_0x1aba04);};}exports['index']=function(_0x9789f9,_0x4983a5){var _0x129eff={'include':[{'model':db[_0x6642('0x42')],'as':'mandatoryDispositionPause'}]},_0x4e8077={},_0x4b9ba5={'count':0x0,'rows':[]};var _0x300377=_['map'](db[_0x6642('0x43')][_0x6642('0x44')],function(_0x108eb7){return{'name':_0x108eb7[_0x6642('0x45')],'type':_0x108eb7[_0x6642('0x46')]['key']};});_0x4e8077[_0x6642('0x47')]=_[_0x6642('0x48')](_0x300377,_0x6642('0x40'));_0x4e8077[_0x6642('0x49')]=_[_0x6642('0x4a')](_0x9789f9['query']);_0x4e8077[_0x6642('0x4b')]=_['intersection'](_0x4e8077[_0x6642('0x47')],_0x4e8077[_0x6642('0x49')]);_0x129eff[_0x6642('0x4c')]=_[_0x6642('0x4d')](_0x4e8077['model'],qs['fields'](_0x9789f9[_0x6642('0x49')][_0x6642('0x4e')]));_0x129eff['attributes']=_0x129eff[_0x6642('0x4c')]['length']?_0x129eff[_0x6642('0x4c')]:_0x4e8077[_0x6642('0x47')];if(!_0x9789f9['query'][_0x6642('0x4f')](_0x6642('0x50'))){_0x129eff[_0x6642('0x33')]=qs[_0x6642('0x33')](_0x9789f9[_0x6642('0x49')]['limit']);_0x129eff[_0x6642('0x35')]=qs[_0x6642('0x35')](_0x9789f9[_0x6642('0x49')][_0x6642('0x35')]);}_0x129eff[_0x6642('0x51')]=qs[_0x6642('0x52')](_0x9789f9['query'][_0x6642('0x52')]);_0x129eff[_0x6642('0x53')]=qs[_0x6642('0x4b')](_['pick'](_0x9789f9[_0x6642('0x49')],_0x4e8077[_0x6642('0x4b')]),_0x300377);if(_0x9789f9[_0x6642('0x49')][_0x6642('0x54')]){_0x129eff['where']=_['merge'](_0x129eff['where'],{'$or':_[_0x6642('0x48')](_0x300377,function(_0x1d7591){if(_0x1d7591[_0x6642('0x46')]!=='VIRTUAL'){var _0x5e635f={};_0x5e635f[_0x1d7591['name']]={'$like':'%'+_0x9789f9[_0x6642('0x49')]['filter']+'%'};return _0x5e635f;}})});}_0x129eff=_[_0x6642('0x55')]({},_0x129eff,_0x9789f9['options']);var _0x5ace28={'where':_0x129eff[_0x6642('0x53')]};return db[_0x6642('0x43')][_0x6642('0x34')](_0x5ace28)[_0x6642('0x24')](function(_0x1a1a67){_0x4b9ba5[_0x6642('0x34')]=_0x1a1a67;if(_0x9789f9['query'][_0x6642('0x56')]){_0x129eff[_0x6642('0x57')]=[{'all':!![]}];}return db[_0x6642('0x43')]['findAll'](_0x129eff);})[_0x6642('0x24')](function(_0x6d47b){_0x4b9ba5[_0x6642('0x58')]=_0x6d47b;return _0x4b9ba5;})[_0x6642('0x24')](respondWithFilteredResult(_0x4983a5,_0x129eff))[_0x6642('0x2d')](handleError(_0x4983a5,null));};exports[_0x6642('0x59')]=function(_0x598451,_0x50f3){var _0x19fee0={'raw':![],'where':{'id':_0x598451['params']['id']},'include':[{'model':db[_0x6642('0x42')],'as':_0x6642('0x5a')}]},_0x3d0dc4={};_0x3d0dc4[_0x6642('0x47')]=_[_0x6642('0x4a')](db[_0x6642('0x43')][_0x6642('0x44')]);_0x3d0dc4[_0x6642('0x49')]=_[_0x6642('0x4a')](_0x598451[_0x6642('0x49')]);_0x3d0dc4[_0x6642('0x4b')]=_[_0x6642('0x4d')](_0x3d0dc4[_0x6642('0x47')],_0x3d0dc4[_0x6642('0x49')]);_0x19fee0[_0x6642('0x4c')]=_[_0x6642('0x4d')](_0x3d0dc4[_0x6642('0x47')],qs[_0x6642('0x4e')](_0x598451[_0x6642('0x49')][_0x6642('0x4e')]));_0x19fee0[_0x6642('0x4c')]=_0x19fee0[_0x6642('0x4c')][_0x6642('0x5b')]?_0x19fee0[_0x6642('0x4c')]:_0x3d0dc4[_0x6642('0x47')];if(_0x598451['query'][_0x6642('0x56')]){_0x19fee0[_0x6642('0x57')]=[{'all':!![]}];}_0x19fee0=_[_0x6642('0x55')]({},_0x19fee0,_0x598451[_0x6642('0x5c')]);return db[_0x6642('0x43')][_0x6642('0x5d')](_0x19fee0)[_0x6642('0x24')](handleEntityNotFound(_0x50f3,null))[_0x6642('0x24')](respondWithResult(_0x50f3,null))['catch'](handleError(_0x50f3,null));};exports['create']=function(_0x4c47a0,_0x5a268e){return db[_0x6642('0x43')][_0x6642('0x5e')](_0x4c47a0['body'],{})[_0x6642('0x24')](function(_0x252c1c){var _0x14a261=_0x4c47a0[_0x6642('0x5f')][_0x6642('0x3d')]({'plain':!![]});if(!_0x14a261)throw new Error(_0x6642('0x60'));if(_0x14a261[_0x6642('0x61')]===_0x6642('0x5f')){var _0x25c734=_0x252c1c[_0x6642('0x3d')]({'plain':!![]});var _0x4d03d7=_0x6642('0x3e');return db[_0x6642('0x62')][_0x6642('0x5d')]({'where':{'name':_0x4d03d7,'userProfileId':_0x14a261[_0x6642('0x63')]},'raw':!![]})[_0x6642('0x24')](function(_0x5283f1){if(_0x5283f1&&_0x5283f1['autoAssociation']===0x0){return db[_0x6642('0x3f')]['create']({'name':_0x25c734[_0x6642('0x40')],'resourceId':_0x25c734['id'],'type':_0x5283f1[_0x6642('0x40')],'sectionId':_0x5283f1['id']},{})[_0x6642('0x24')](function(){return _0x252c1c;});}else{return _0x252c1c;}})[_0x6642('0x2d')](function(_0x53f9f0){logger[_0x6642('0x29')](_0x6642('0x64'),_0x53f9f0);throw _0x53f9f0;});}return _0x252c1c;})['then'](respondWithResult(_0x5a268e,0xc9))[_0x6642('0x2d')](handleError(_0x5a268e,null));};exports[_0x6642('0x3b')]=function(_0x138bed,_0x2f9d07){if(_0x138bed[_0x6642('0x65')]['id']){delete _0x138bed[_0x6642('0x65')]['id'];}return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0x138bed[_0x6642('0x66')]['id']},'include':[{'model':db[_0x6642('0x42')],'as':_0x6642('0x5a')}]})[_0x6642('0x24')](handleEntityNotFound(_0x2f9d07,null))[_0x6642('0x24')](saveUpdates(_0x138bed[_0x6642('0x65')],null))[_0x6642('0x24')](respondWithResult(_0x2f9d07,null))['catch'](handleError(_0x2f9d07,null));};exports[_0x6642('0x3c')]=function(_0x24e682,_0x2375ce){return db['WhatsappAccount'][_0x6642('0x5d')]({'where':{'id':_0x24e682[_0x6642('0x66')]['id']}})[_0x6642('0x24')](handleEntityNotFound(_0x2375ce,null))['then'](removeEntity(_0x2375ce,null))[_0x6642('0x2d')](handleError(_0x2375ce,null));};exports['describe']=function(_0x52d679,_0x1226ca){return db[_0x6642('0x43')][_0x6642('0x67')]()[_0x6642('0x24')](respondWithResult(_0x1226ca,null))[_0x6642('0x2d')](handleError(_0x1226ca,null));};exports[_0x6642('0x68')]=function(_0x27a59e,_0x5570be,_0x17abbb){if(_0x27a59e[_0x6642('0x65')]['id']){delete _0x27a59e[_0x6642('0x65')]['id'];}return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0x27a59e[_0x6642('0x66')]['id']}})[_0x6642('0x24')](handleEntityNotFound(_0x5570be,null))['then'](function(_0x11fe86){if(_0x11fe86){_0x27a59e[_0x6642('0x65')][_0x6642('0x69')]=_0x11fe86['id'];return db[_0x6642('0x6a')][_0x6642('0x5e')](_0x27a59e[_0x6642('0x65')]);}})[_0x6642('0x24')](respondWithResult(_0x5570be,null))['catch'](handleError(_0x5570be,null));};exports[_0x6642('0x6b')]=function(_0x3c127f,_0x2e4a5d,_0x5666eb){var _0x2bd50a={'raw':![],'where':{}};var _0x25ed44={};var _0x449d92={'count':0x0,'rows':[]};return db[_0x6642('0x43')]['findOne']({'where':{'id':_0x3c127f[_0x6642('0x66')]['id']}})[_0x6642('0x24')](handleEntityNotFound(_0x2e4a5d,null))[_0x6642('0x24')](function(_0x257a73){if(_0x257a73){_0x25ed44[_0x6642('0x47')]=_['keys'](db[_0x6642('0x6a')][_0x6642('0x44')]);_0x25ed44[_0x6642('0x49')]=_[_0x6642('0x4a')](_0x3c127f[_0x6642('0x49')]);_0x25ed44[_0x6642('0x4b')]=_['intersection'](_0x25ed44[_0x6642('0x47')],_0x25ed44['query']);_0x2bd50a[_0x6642('0x4c')]=_['intersection'](_0x25ed44[_0x6642('0x47')],qs['fields'](_0x3c127f[_0x6642('0x49')]['fields']));_0x2bd50a[_0x6642('0x4c')]=_0x2bd50a[_0x6642('0x4c')][_0x6642('0x5b')]?_0x2bd50a[_0x6642('0x4c')]:_0x25ed44[_0x6642('0x47')];if(!_0x3c127f[_0x6642('0x49')][_0x6642('0x4f')](_0x6642('0x50'))){_0x2bd50a[_0x6642('0x33')]=qs[_0x6642('0x33')](_0x3c127f[_0x6642('0x49')][_0x6642('0x33')]);_0x2bd50a[_0x6642('0x35')]=qs[_0x6642('0x35')](_0x3c127f[_0x6642('0x49')][_0x6642('0x35')]);}_0x2bd50a[_0x6642('0x51')]=qs[_0x6642('0x52')](_0x3c127f[_0x6642('0x49')][_0x6642('0x52')]);_0x2bd50a[_0x6642('0x53')]=qs[_0x6642('0x4b')](_[_0x6642('0x6c')](_0x3c127f[_0x6642('0x49')],_0x25ed44[_0x6642('0x4b')]));_0x2bd50a['where']['WhatsappAccountId']=_0x257a73['id'];if(_0x3c127f[_0x6642('0x49')][_0x6642('0x54')]){_0x2bd50a[_0x6642('0x53')]=_[_0x6642('0x55')](_0x2bd50a[_0x6642('0x53')],{'$or':_[_0x6642('0x48')](_0x2bd50a[_0x6642('0x4c')],function(_0x3e59bc){var _0x3bb545={};_0x3bb545[_0x3e59bc]={'$like':'%'+_0x3c127f[_0x6642('0x49')][_0x6642('0x54')]+'%'};return _0x3bb545;})});}_0x2bd50a=_[_0x6642('0x55')]({},_0x2bd50a,_0x3c127f['options']);return db[_0x6642('0x6a')][_0x6642('0x34')]({'where':_0x2bd50a[_0x6642('0x53')]})[_0x6642('0x24')](function(_0x5c469a){_0x449d92[_0x6642('0x34')]=_0x5c469a;if(_0x3c127f[_0x6642('0x49')][_0x6642('0x56')]){_0x2bd50a['include']=[{'all':!![]}];}return db[_0x6642('0x6a')][_0x6642('0x6d')](_0x2bd50a);})[_0x6642('0x24')](function(_0x14fca1){_0x449d92[_0x6642('0x58')]=_0x14fca1;return _0x449d92;});}})['then'](respondWithFilteredResult(_0x2e4a5d,_0x2bd50a))[_0x6642('0x2d')](handleError(_0x2e4a5d,null));};exports[_0x6642('0x6e')]=function(_0x5e8b21,_0xac7f36,_0x53a5d2){return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0x5e8b21[_0x6642('0x66')]['id']}})[_0x6642('0x24')](handleEntityNotFound(_0xac7f36,null))[_0x6642('0x24')](function(_0x10657a){if(_0x10657a){return _0x10657a[_0x6642('0x6e')](_0x5e8b21[_0x6642('0x49')][_0x6642('0x6f')]);}})['then'](respondWithStatusCode(_0xac7f36,null))[_0x6642('0x2d')](handleError(_0xac7f36,null));};exports['addAnswer']=function(_0x33451a,_0x28e1b9,_0x2c12f7){if(_0x33451a['body']['id']){delete _0x33451a[_0x6642('0x65')]['id'];}return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0x33451a[_0x6642('0x66')]['id']}})[_0x6642('0x24')](handleEntityNotFound(_0x28e1b9,null))[_0x6642('0x24')](function(_0x1ee5f1){if(_0x1ee5f1){_0x33451a[_0x6642('0x65')]['WhatsappAccountId']=_0x1ee5f1['id'];return db['CannedAnswer'][_0x6642('0x5e')](_0x33451a[_0x6642('0x65')]);}})[_0x6642('0x24')](respondWithResult(_0x28e1b9,null))[_0x6642('0x2d')](handleError(_0x28e1b9,null));};exports[_0x6642('0x70')]=function(_0x4895a,_0x3df5fa,_0xf2e650){var _0x5ac1ab={'raw':![],'where':{}};var _0xbc27f={};var _0x433767={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x6642('0x71')]({'where':{'id':_0x4895a[_0x6642('0x66')]['id']}})[_0x6642('0x24')](handleEntityNotFound(_0x3df5fa,null))[_0x6642('0x24')](function(_0x1a9ac2){if(_0x1a9ac2){_0xbc27f[_0x6642('0x47')]=_[_0x6642('0x4a')](db[_0x6642('0x72')][_0x6642('0x44')]);_0xbc27f[_0x6642('0x49')]=_[_0x6642('0x4a')](_0x4895a['query']);_0xbc27f[_0x6642('0x4b')]=_['intersection'](_0xbc27f[_0x6642('0x47')],_0xbc27f['query']);_0x5ac1ab[_0x6642('0x4c')]=_['intersection'](_0xbc27f['model'],qs['fields'](_0x4895a['query']['fields']));_0x5ac1ab[_0x6642('0x4c')]=_0x5ac1ab[_0x6642('0x4c')][_0x6642('0x5b')]?_0x5ac1ab[_0x6642('0x4c')]:_0xbc27f[_0x6642('0x47')];if(!_0x4895a[_0x6642('0x49')][_0x6642('0x4f')]('nolimit')){_0x5ac1ab[_0x6642('0x33')]=qs[_0x6642('0x33')](_0x4895a[_0x6642('0x49')][_0x6642('0x33')]);_0x5ac1ab['offset']=qs[_0x6642('0x35')](_0x4895a[_0x6642('0x49')]['offset']);}_0x5ac1ab['order']=qs['sort'](_0x4895a[_0x6642('0x49')][_0x6642('0x52')]);_0x5ac1ab[_0x6642('0x53')]=qs[_0x6642('0x4b')](_[_0x6642('0x6c')](_0x4895a[_0x6642('0x49')],_0xbc27f[_0x6642('0x4b')]));_0x5ac1ab[_0x6642('0x53')][_0x6642('0x69')]=_0x1a9ac2['id'];if(_0x4895a['query'][_0x6642('0x54')]){_0x5ac1ab[_0x6642('0x53')]=_[_0x6642('0x55')](_0x5ac1ab['where'],{'$or':_[_0x6642('0x48')](_0x5ac1ab['attributes'],function(_0x4777aa){var _0x269a6c={};_0x269a6c[_0x4777aa]={'$like':'%'+_0x4895a[_0x6642('0x49')][_0x6642('0x54')]+'%'};return _0x269a6c;})});}_0x5ac1ab=_['merge']({},_0x5ac1ab,_0x4895a[_0x6642('0x5c')]);return db[_0x6642('0x72')][_0x6642('0x34')]({'where':_0x5ac1ab[_0x6642('0x53')]})[_0x6642('0x24')](function(_0x2b2071){_0x433767['count']=_0x2b2071;if(_0x4895a['query'][_0x6642('0x56')]){_0x5ac1ab[_0x6642('0x57')]=[{'all':!![]}];}return db[_0x6642('0x72')][_0x6642('0x6d')](_0x5ac1ab);})[_0x6642('0x24')](function(_0x5c4ceb){_0x433767[_0x6642('0x58')]=_0x5c4ceb;return _0x433767;});}})[_0x6642('0x24')](respondWithFilteredResult(_0x3df5fa,_0x5ac1ab))[_0x6642('0x2d')](handleError(_0x3df5fa,null));};exports[_0x6642('0x73')]=function(_0xd2bf75,_0x2a5ab6,_0x54751d){return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0xd2bf75[_0x6642('0x66')]['id']}})['then'](handleEntityNotFound(_0x2a5ab6,null))[_0x6642('0x24')](function(_0x1b106c){if(_0x1b106c){return _0x1b106c[_0x6642('0x73')](_0xd2bf75[_0x6642('0x49')]['ids']);}})['then'](respondWithStatusCode(_0x2a5ab6,null))['catch'](handleError(_0x2a5ab6,null));};exports[_0x6642('0x74')]=function(_0x10db83,_0x905827,_0x56ac5e){return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0x10db83[_0x6642('0x66')]['id']}})['then'](handleEntityNotFound(_0x905827,null))['then'](function(_0x4f46cb){if(_0x4f46cb){return _0x4f46cb[_0x6642('0x74')](_0x10db83[_0x6642('0x65')][_0x6642('0x6f')],_['omit'](_0x10db83[_0x6642('0x65')],[_0x6642('0x6f'),'id'])||{})[_0x6642('0x75')](function(_0x4c98b7){for(var _0x5898a6=0x0;_0x5898a6<_0x10db83[_0x6642('0x65')][_0x6642('0x6f')]['length'];_0x5898a6+=0x1){socket[_0x6642('0x76')](_0x6642('0x77'),{'UserId':Number(_0x10db83[_0x6642('0x65')][_0x6642('0x6f')][_0x5898a6]),'WhatsappAccountId':Number(_0x10db83['params']['id'])});}return _0x4c98b7;});}})[_0x6642('0x24')](respondWithResult(_0x905827,null))[_0x6642('0x2d')](handleError(_0x905827,null));};exports['removeAgents']=function(_0x18430e,_0x647d45,_0x4d3ff2){return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0x18430e['params']['id']}})['then'](handleEntityNotFound(_0x647d45,null))[_0x6642('0x24')](function(_0x23c373){if(_0x23c373){return _0x23c373['removeAgents'](_0x18430e[_0x6642('0x49')][_0x6642('0x6f')])[_0x6642('0x24')](function(){if(_[_0x6642('0x78')](_0x18430e[_0x6642('0x49')]['ids'])){for(var _0x969f3b=0x0;_0x969f3b<_0x18430e['query'][_0x6642('0x6f')][_0x6642('0x5b')];_0x969f3b+=0x1){socket[_0x6642('0x76')](_0x6642('0x79'),{'UserId':Number(_0x18430e[_0x6642('0x49')]['ids'][_0x969f3b]),'WhatsappAccountId':Number(_0x18430e[_0x6642('0x66')]['id'])});}}else{socket[_0x6642('0x76')](_0x6642('0x79'),{'UserId':Number(_0x18430e[_0x6642('0x49')][_0x6642('0x6f')]),'WhatsappAccountId':Number(_0x18430e[_0x6642('0x66')]['id'])});}});}})[_0x6642('0x24')](respondWithStatusCode(_0x647d45,null))[_0x6642('0x2d')](handleError(_0x647d45,null));};exports['getAgents']=function(_0x5646d1,_0x5f909d,_0x3c0873){var _0x17b1c7={};var _0x1c0c89={};var _0xe7e8f8;var _0x5aa560;return db[_0x6642('0x43')][_0x6642('0x71')]({'where':{'id':_0x5646d1[_0x6642('0x66')]['id']}})[_0x6642('0x24')](handleEntityNotFound(_0x5f909d,null))[_0x6642('0x24')](function(_0x2e9ac6){if(_0x2e9ac6){_0xe7e8f8=_0x2e9ac6;_0x1c0c89[_0x6642('0x47')]=_[_0x6642('0x4a')](db[_0x6642('0x7a')][_0x6642('0x44')]);_0x1c0c89[_0x6642('0x49')]=_[_0x6642('0x4a')](_0x5646d1[_0x6642('0x49')]);_0x1c0c89[_0x6642('0x4b')]=_['intersection'](_0x1c0c89['model'],_0x1c0c89['query']);_0x17b1c7['attributes']=_['intersection'](_0x1c0c89['model'],qs[_0x6642('0x4e')](_0x5646d1['query']['fields']));_0x17b1c7['attributes']=_0x17b1c7['attributes']['length']?_0x17b1c7[_0x6642('0x4c')]:_0x1c0c89[_0x6642('0x47')];_0x17b1c7['order']=qs[_0x6642('0x52')](_0x5646d1[_0x6642('0x49')][_0x6642('0x52')]);_0x17b1c7[_0x6642('0x53')]=qs['filters'](_[_0x6642('0x6c')](_0x5646d1[_0x6642('0x49')],_0x1c0c89['filters']));if(_0x5646d1[_0x6642('0x49')][_0x6642('0x54')]){_0x17b1c7[_0x6642('0x53')]=_[_0x6642('0x55')](_0x17b1c7['where'],{'$or':_['map'](_0x17b1c7[_0x6642('0x4c')],function(_0x3dc261){var _0x59f363={};_0x59f363[_0x3dc261]={'$like':'%'+_0x5646d1['query'][_0x6642('0x54')]+'%'};return _0x59f363;})});}_0x17b1c7=_[_0x6642('0x55')]({},_0x17b1c7,_0x5646d1[_0x6642('0x5c')]);return _0xe7e8f8['getAgents'](_0x17b1c7);}})['then'](function(_0x895bd5){if(_0x895bd5){_0x5aa560=_0x895bd5[_0x6642('0x5b')];if(!_0x5646d1[_0x6642('0x49')][_0x6642('0x4f')](_0x6642('0x50'))){_0x17b1c7[_0x6642('0x33')]=qs[_0x6642('0x33')](_0x5646d1[_0x6642('0x49')]['limit']);_0x17b1c7[_0x6642('0x35')]=qs['offset'](_0x5646d1['query']['offset']);}return _0xe7e8f8[_0x6642('0x7b')](_0x17b1c7);}})[_0x6642('0x24')](function(_0x591cb9){if(_0x591cb9){return _0x591cb9?{'count':_0x5aa560,'rows':_0x591cb9}:null;}})[_0x6642('0x24')](respondWithResult(_0x5f909d,null))['catch'](handleError(_0x5f909d,null));};exports[_0x6642('0x7c')]=function(_0x595282,_0x3a7bf5){var _0x41578c=_0x595282[_0x6642('0x66')]['id'];var _0x5e44d3=_0x595282[_0x6642('0x65')];var _0x52c9a0=0xc8;var _0x4b2531=null;return db[_0x6642('0x7d')][_0x6642('0x7e')]({'isolationLevel':db[_0x6642('0x7d')][_0x6642('0x7f')][_0x6642('0x80')][_0x6642('0x81')]},function(_0x30c640){return db['WhatsappAccount'][_0x6642('0x71')]({'where':{'id':_0x41578c},'transaction':_0x30c640})[_0x6642('0x24')](function(_0x4869e4){if(_0x4869e4){return db[_0x6642('0x82')]['destroy']({'where':{'WhatsappAccountId':_0x41578c},'transaction':_0x30c640})['then'](function(){var _0xf28585=_[_0x6642('0x48')](_0x5e44d3,function(_0x302623){_0x302623['WhatsappAccountId']=_0x41578c;return _0x302623;});return db['WhatsappApplication'][_0x6642('0x83')](_0xf28585,{'transaction':_0x30c640});});}else{_0x52c9a0=0x194;_0x4b2531=[];}});})[_0x6642('0x24')](function(){if(_0x52c9a0!==0x194){return db[_0x6642('0x82')][_0x6642('0x84')]({'where':{'WhatsappAccountId':_0x41578c},'order':_0x6642('0x85')})[_0x6642('0x24')](function(_0x5f12d9){_0x4b2531=_0x5f12d9;});}})[_0x6642('0x2d')](function(_0x903fa5){_0x52c9a0=0x1f4;logger['error'](_0x903fa5[_0x6642('0x86')]);if(_0x903fa5[_0x6642('0x40')]){delete _0x903fa5[_0x6642('0x40')];}_0x4b2531=_0x903fa5;})[_0x6642('0x87')](function(){if(_0x4b2531===null){_0x3a7bf5[_0x6642('0x2e')](_0x52c9a0);}else{if(_0x52c9a0===0x1f4){_0x3a7bf5[_0x6642('0x30')](_0x52c9a0)[_0x6642('0x41')](_0x4b2531);}else{_0x3a7bf5['status'](_0x52c9a0)[_0x6642('0x31')](_0x4b2531);}}});};exports['getApplications']=function(_0x3c5ce8,_0x344925,_0x20afa1){var _0x55d11a={};var _0x367039={};var _0x100b40;var _0x28c264;return db[_0x6642('0x43')]['findOne']({'where':{'id':_0x3c5ce8[_0x6642('0x66')]['id']}})['then'](handleEntityNotFound(_0x344925,null))[_0x6642('0x24')](function(_0x167b96){if(_0x167b96){_0x100b40=_0x167b96;_0x367039[_0x6642('0x47')]=_[_0x6642('0x4a')](db[_0x6642('0x82')][_0x6642('0x44')]);_0x367039[_0x6642('0x49')]=_[_0x6642('0x4a')](_0x3c5ce8[_0x6642('0x49')]);_0x367039[_0x6642('0x4b')]=_['intersection'](_0x367039[_0x6642('0x47')],_0x367039[_0x6642('0x49')]);_0x55d11a['attributes']=_[_0x6642('0x4d')](_0x367039[_0x6642('0x47')],qs['fields'](_0x3c5ce8[_0x6642('0x49')][_0x6642('0x4e')]));_0x55d11a['attributes']=_0x55d11a[_0x6642('0x4c')][_0x6642('0x5b')]?_0x55d11a['attributes']:_0x367039['model'];_0x55d11a[_0x6642('0x51')]=qs[_0x6642('0x52')](_0x3c5ce8[_0x6642('0x49')][_0x6642('0x52')]);_0x55d11a[_0x6642('0x53')]=qs[_0x6642('0x4b')](_[_0x6642('0x6c')](_0x3c5ce8[_0x6642('0x49')],_0x367039[_0x6642('0x4b')]));if(_0x3c5ce8[_0x6642('0x49')][_0x6642('0x54')]){_0x55d11a[_0x6642('0x53')]=_[_0x6642('0x55')](_0x55d11a[_0x6642('0x53')],{'$or':_['map'](_0x55d11a[_0x6642('0x4c')],function(_0x28fb7c){var _0x46233d={};_0x46233d[_0x28fb7c]={'$like':'%'+_0x3c5ce8[_0x6642('0x49')][_0x6642('0x54')]+'%'};return _0x46233d;})});}_0x55d11a=_[_0x6642('0x55')]({},_0x55d11a,_0x3c5ce8['options']);return _0x100b40[_0x6642('0x88')](_0x55d11a);}})[_0x6642('0x24')](function(_0x162b62){if(_0x162b62){_0x28c264=_0x162b62[_0x6642('0x5b')];if(!_0x3c5ce8[_0x6642('0x49')][_0x6642('0x4f')](_0x6642('0x50'))){_0x55d11a['limit']=qs['limit'](_0x3c5ce8['query']['limit']);_0x55d11a[_0x6642('0x35')]=qs['offset'](_0x3c5ce8[_0x6642('0x49')][_0x6642('0x35')]);}return _0x100b40[_0x6642('0x88')](_0x55d11a);}})[_0x6642('0x24')](function(_0x4e824d){if(_0x4e824d){return _0x4e824d?{'count':_0x28c264,'rows':_0x4e824d}:null;}})[_0x6642('0x24')](respondWithResult(_0x344925,null))[_0x6642('0x2d')](handleError(_0x344925,null));};exports[_0x6642('0x89')]=function(_0x5ab151,_0x21c306,_0x22f7ec){var _0x4727b4={'channel':'whatsapp'};var _0x85c56a=[];var _0x180c78=[];var _0x5c3616={};return db['WhatsappAccount'][_0x6642('0x5d')]({'where':{'id':_0x5ab151[_0x6642('0x66')]['id']},'include':[{'model':db[_0x6642('0x82')],'as':_0x6642('0x8a')}]})[_0x6642('0x24')](handleEntityNotFound(_0x21c306,null))[_0x6642('0x24')](function(_0xb80e7e){_0x4727b4['account']=_0xb80e7e;if(_0x4727b4[_0x6642('0x8b')]&&_0x4727b4['account'][_0x6642('0x46')]==='sinch'&&_0x5ab151[_0x6642('0x65')][_0x6642('0x8c')]){if(_0x5ab151['body'][_0x6642('0x8c')][_0x6642('0x5b')]===0x0)return;if(_0x5ab151['body']['statuses'][0x0][_0x6642('0x8d')]!=='read')return;return db[_0x6642('0x8e')][_0x6642('0x3b')]({'read':!![],'readAt':_0x5ab151[_0x6642('0x65')][_0x6642('0x8c')][0x0]['timestamp']},{'where':{'messageId':_0x5ab151[_0x6642('0x65')][_0x6642('0x8c')][0x0][_0x6642('0x8f')]},'individualHooks':!![]})[_0x6642('0x24')](function(_0x44e4d5){return _0x21c306[_0x6642('0x30')](0xc8)[_0x6642('0x31')](_0x44e4d5);});}_0x4727b4[_0x6642('0x90')]=_[_0x6642('0x91')](_0xb80e7e['Applications'],[_0x6642('0x85')],[_0x6642('0x92')]);if(_0x4727b4[_0x6642('0x8b')][_0x6642('0x8a')]){delete _0x4727b4[_0x6642('0x8b')]['Applications'];}return db['CmContact'][_0x6642('0x67')]()[_0x6642('0x24')](function(_0x5867cd){if(!_0x5867cd){throw new db[(_0x6642('0x93'))][(_0x6642('0x94'))]('no\x20available\x20attributes');}_0x85c56a=_['difference'](_[_0x6642('0x4a')](_0x5867cd),[_0x6642('0x95'),_0x6642('0x96')]);_0x180c78=_[_0x6642('0x97')](_['keys'](_0x5867cd),[_0x6642('0x95'),_0x6642('0x96'),_0x6642('0x98'),'ListId']);_0x4727b4[_0x6642('0x65')]={'mapKey':_0x6642('0x99')};if(_0x4727b4['account']&&_0x4727b4[_0x6642('0x8b')]['type']==='twilio'){_0x4727b4[_0x6642('0x65')][_0x6642('0x9a')]=_0x5ab151[_0x6642('0x65')][_0x6642('0x9b')][_0x6642('0x9c')]('whatsapp:','');_0x4727b4[_0x6642('0x65')][_0x6642('0x65')]=_0x5ab151[_0x6642('0x65')]['Body'];_0x4727b4[_0x6642('0x65')]['messageId']=_0x5ab151[_0x6642('0x65')][_0x6642('0x9d')];}if(_0x4727b4[_0x6642('0x8b')]&&_0x4727b4[_0x6642('0x8b')][_0x6642('0x46')]==='sinch'){_0x4727b4[_0x6642('0x65')][_0x6642('0x9a')]=_0x5ab151[_0x6642('0x65')][_0x6642('0x9e')][0x0][_0x6642('0x9a')];_0x4727b4['body'][_0x6642('0x65')]=_0x5ab151[_0x6642('0x65')][_0x6642('0x9e')][0x0][_0x6642('0x2b')][_0x6642('0x65')];_0x4727b4[_0x6642('0x65')][_0x6642('0x9f')]=_0x5ab151[_0x6642('0x65')]['notifications'][0x0][_0x6642('0x8f')];}if(_0x4727b4[_0x6642('0x65')]['id']){delete _0x4727b4[_0x6642('0x65')]['id'];}if(_[_0x6642('0xa0')](_0x4727b4[_0x6642('0x65')][_0x6642('0x9a')])){throw new db['Sequelize'][(_0x6642('0x94'))](_0x6642('0xa1'));}if(_[_0x6642('0xa0')](_0x4727b4['body']['body'])||_0x4727b4['body'][_0x6642('0x65')]===''){throw new db[(_0x6642('0x93'))][(_0x6642('0x94'))](_0x6642('0xa2'));}if(_['isNil'](_0x4727b4['body'][_0x6642('0xa3')])){throw new db[(_0x6642('0x93'))][(_0x6642('0x94'))](_0x6642('0xa4')+_0x180c78);}if(!_[_0x6642('0xa5')](_0x180c78,_0x4727b4[_0x6642('0x65')][_0x6642('0xa3')])){throw new db[(_0x6642('0x93'))][(_0x6642('0x94'))](_0x6642('0xa6')+_0x180c78);}_0x5c3616[_0x4727b4[_0x6642('0x65')]['mapKey']]=_0x4727b4[_0x6642('0x65')][_0x6642('0x9a')];return db['CmList'][_0x6642('0x5d')]({'where':{'id':_0x4727b4[_0x6642('0x8b')]['ListId']},'include':[{'model':db[_0x6642('0xa7')],'as':_0x6642('0xa8'),'where':_0x5c3616,'limit':0x1,'order':[['updatedAt',_0x6642('0xa9')]]}]});})['then'](handleEntityNotFound(_0x21c306,null))['then'](function(_0x413ed9){if(_0x413ed9){_0x4727b4[_0x6642('0xaa')]=_[_0x6642('0xab')](_0x413ed9,[_0x6642('0xa8')]);if(_0x413ed9[_0x6642('0xa8')][_0x6642('0x5b')]){return _0x413ed9[_0x6642('0xa8')][0x0];}var _0x127947=_[_0x6642('0xac')](_0x4727b4['body'],{'firstName':_0x4727b4[_0x6642('0x65')]['from'],'ListId':_0x413ed9['id']});_0x127947[_0x4727b4[_0x6642('0x65')][_0x6642('0xa3')]]=_0x4727b4['body'][_0x6642('0x9a')];return db['CmContact']['create'](_0x127947,{'fields':_0x85c56a,'raw':!![]});}})[_0x6642('0x24')](handleEntityNotFound(_0x21c306,null))[_0x6642('0x24')](function(_0x5756cb){if(_0x5756cb){_0x4727b4[_0x6642('0xad')]=_0x5756cb;var _0x20eeed={'ContactId':_0x5756cb['id'],'phone':_0x4727b4['body'][_0x6642('0x9a')],'WhatsappAccountId':_0x5ab151[_0x6642('0x66')]['id']};var _0x29c6f={'ContactId':_0x5756cb['id'],'WhatsappAccountId':_0x5ab151[_0x6642('0x66')]['id'],'closed':![]};return db[_0x6642('0xae')][_0x6642('0x5d')]({'where':_0x29c6f})[_0x6642('0x24')](function(_0x31c5b6){if(_0x31c5b6){return[_0x31c5b6,![]];}return db[_0x6642('0xae')]['create'](_0x20eeed)[_0x6642('0x24')](function(_0x5e98de){return[_0x5e98de,!![]];});});}})[_0x6642('0x75')](function(_0x5a4703,_0x134ec8){_0x4727b4[_0x6642('0xaf')]=_0x5a4703[_0x6642('0x3d')]({'plain':!![]});_0x4727b4[_0x6642('0xaf')]['created']=![];if(_0x134ec8){if(_0x4727b4['account'][_0x6642('0xb0')]){_0x4727b4[_0x6642('0x90')]['push']({'id':0x0,'priority':_0x4727b4['applications'][_0x6642('0x5b')]+0x1,'app':'close','appdata':_0x6642('0xb1'),'interval':_0x6642('0xb2')});}_0x4727b4[_0x6642('0xaf')][_0x6642('0xb3')]=!![];}return db[_0x6642('0x8e')]['create']({'phone':_0x4727b4[_0x6642('0x65')][_0x6642('0x9a')],'messageId':_0x4727b4['body']['messageId'],'body':_0x4727b4['body'][_0x6642('0x65')],'WhatsappAccountId':_0x5ab151[_0x6642('0x66')]['id'],'WhatsappInteractionId':_0x5a4703['id'],'direction':'in','ContactId':_0x5a4703[_0x6642('0xb4')],'AttachmentId':_0x4727b4[_0x6642('0x65')]['AttachmentId']});})[_0x6642('0x24')](function(_0x38d8f2){_0x4727b4[_0x6642('0x2b')]=_0x38d8f2;if(!_0x4727b4[_0x6642('0xaf')][_0x6642('0xb5')])return;return db['User'][_0x6642('0x5d')]({'attributes':['id',_0x6642('0x40')],'where':{'id':_0x4727b4[_0x6642('0xaf')]['UserId']}});})[_0x6642('0x24')](function(_0x473827){if(_0x473827){_0x4727b4['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x6642('0xb6'),'appdata':_0x473827[_0x6642('0x40')]+','+(_0x4727b4['account'][_0x6642('0xb7')]||0xa),'interval':_0x6642('0xb2')});}if(!_0x4727b4['interaction'][_0x6642('0xb8')])return;return db[_0x6642('0xb9')][_0x6642('0x5d')]({'attributes':['id','name'],'where':{'id':_0x4727b4[_0x6642('0xaf')]['queueId']}});})['then'](function(_0x42bcb3){if(_0x42bcb3){_0x4727b4['applications'][_0x6642('0xba')]({'id':0x0,'priority':0x1,'app':_0x6642('0xbb'),'appdata':_0x42bcb3[_0x6642('0x40')]+','+(_0x4727b4[_0x6642('0x8b')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x4727b4);})[_0x6642('0x24')](function(_0xab32df){if(_0xab32df){var _0x266673=0xc8;var _0x1432a3=_0x6642('0xbc');logger[_0x6642('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1432a3,_0x266673,'entity\x20found');logger['debug'](_0x6642('0xbd'),_0x1432a3,_0x266673,_0x6642('0xbe'),JSON[_0x6642('0xbf')](_0xab32df));if(_0x4727b4[_0x6642('0x8b')]['type']===_0x6642('0xc0')){return _0x21c306[_0x6642('0x30')](_0x266673)['set'](_0x6642('0xc1'),'text/xml')[_0x6642('0x41')]('\x0a');}else{return _0x21c306[_0x6642('0x30')](_0x266673)[_0x6642('0x31')](_0xab32df);}}});})[_0x6642('0x2d')](handleError(_0x21c306,null));};exports[_0x6642('0x41')]=function(_0x4998c0,_0x3847ae,_0x5c5fb7){var _0x48991e,_0x3ebb10,_0x1bcb18;if(_['isNil'](_0x4998c0['body']['body'])||_0x4998c0[_0x6642('0x65')][_0x6642('0x65')]===''){throw new db[(_0x6642('0x93'))][(_0x6642('0x94'))](_0x6642('0xa2'));}if(_['isNil'](_0x4998c0['body']['to'])){throw new db[(_0x6642('0x93'))][(_0x6642('0x94'))]('to\x20is\x20mandatory');}_0x48991e=_0x4998c0['body']['to'];return db[_0x6642('0x43')][_0x6642('0x5d')]({'where':{'id':_0x4998c0['params']['id']},'include':[{'model':db[_0x6642('0xc2')],'as':_0x6642('0xc3'),'include':[{'model':db['CmContact'],'as':_0x6642('0xa8'),'where':{'mobile':_0x48991e},'limit':0x1,'order':[[_0x6642('0x96'),'DESC']]}]}]})[_0x6642('0x24')](handleEntityNotFound(_0x3847ae,null))[_0x6642('0x24')](function(_0x356408){if(_0x356408&&_0x356408[_0x6642('0xc3')]){_0x3ebb10=_0x356408[_0x6642('0x3d')]({'plain':!![]});if(_0x3ebb10[_0x6642('0xc3')]&&_0x3ebb10[_0x6642('0xc3')][_0x6642('0xa8')][_0x6642('0x5b')]){return _0x3ebb10['List'][_0x6642('0xa8')][0x0];}return db['CmContact']['create'](_[_0x6642('0xac')](_0x4998c0[_0x6642('0x65')],{'firstName':_0x48991e,'mobile':_0x48991e,'phone':_0x48991e,'ListId':_0x3ebb10[_0x6642('0xc4')]}));}})[_0x6642('0x24')](handleEntityNotFound(_0x3847ae,null))[_0x6642('0x24')](function(_0x4d0e71){if(_0x4d0e71){_0x1bcb18=_0x4d0e71;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x1bcb18['id'],'closed':![],'WhatsappAccountId':_0x3ebb10['id']}})['then'](function(_0x372f51){if(_0x372f51){return[_0x372f51,![]];}return db[_0x6642('0xae')][_0x6642('0x5e')]({'UserId':_0x4998c0[_0x6642('0x5f')]['id'],'ContactId':_0x1bcb18['id'],'WhatsappAccountId':_0x3ebb10['id'],'phone':_0x48991e,'firstMsgDirection':_0x6642('0xc5'),'Messages':[_['merge'](_0x4998c0['body'],{'read':![],'body':_0x4998c0[_0x6642('0x65')][_0x6642('0x65')],'phone':_0x48991e,'WhatsappAccountId':_0x3ebb10['id'],'UserId':_0x4998c0[_0x6642('0x5f')]['id'],'ContactId':_0x1bcb18['id']})]},{'include':[{'model':db[_0x6642('0x8e')],'as':_0x6642('0xc6')}]})['then'](function(_0x243c41){return[_0x243c41,!![]];});});}})[_0x6642('0x75')](function(_0x1424e5,_0x198583){if(_0x198583){return _0x1424e5;}return db[_0x6642('0x8e')][_0x6642('0x5e')](_['merge'](_0x4998c0[_0x6642('0x65')],{'read':![],'body':_0x4998c0['body']['body'],'phone':_0x48991e,'WhatsappAccountId':_0x3ebb10['id'],'WhatsappInteractionId':_0x1424e5['id'],'UserId':_0x4998c0['user']['id'],'ContactId':_0x1bcb18['id']}))[_0x6642('0x24')](function(_0x480cca){_0x1424e5[_0x6642('0xc7')]['Messages']=[];_0x1424e5[_0x6642('0xc7')][_0x6642('0xc6')][_0x6642('0xc8')](_0x480cca['dataValues']);return _0x1424e5;});})[_0x6642('0x24')](respondWithResult(_0x3847ae,null))['catch'](handleError(_0x3847ae,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index f62e0a8..3c2a0bf 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 _0x6343=['WhatsappAccount','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x2feea2,_0x45f989){var _0x572a30=function(_0x455672){while(--_0x455672){_0x2feea2['push'](_0x2feea2['shift']());}};_0x572a30(++_0x45f989);}(_0x6343,0x1f2));var _0x3634=function(_0x806ddb,_0xa7a13){_0x806ddb=_0x806ddb-0x0;var _0x59634f=_0x6343[_0x806ddb];return _0x59634f;};'use strict';var EventEmitter=require(_0x3634('0x0'));var WhatsappAccount=require(_0x3634('0x1'))['db'][_0x3634('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x3634('0x3')](0x0);var events={'afterCreate':_0x3634('0x4'),'afterUpdate':_0x3634('0x5'),'afterDestroy':_0x3634('0x6')};function emitEvent(_0x549b5e){return function(_0x3d66d4,_0x1f25a3,_0x4c9241){WhatsappAccountEvents[_0x3634('0x7')](_0x549b5e+':'+_0x3d66d4['id'],_0x3d66d4);WhatsappAccountEvents['emit'](_0x549b5e,_0x3d66d4);_0x4c9241(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x3634('0x8')](e,emitEvent(event));}}module[_0x3634('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x9fe5=['WhatsappAccount','setMaxListeners','remove','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2bf6be,_0x5b23f1){var _0x532ef4=function(_0x3760df){while(--_0x3760df){_0x2bf6be['push'](_0x2bf6be['shift']());}};_0x532ef4(++_0x5b23f1);}(_0x9fe5,0x1bf));var _0x59fe=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9fe5[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x59fe('0x0'))['db'][_0x59fe('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x59fe('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x59fe('0x3')};function emitEvent(_0x22b547){return function(_0x279a56,_0x21230b,_0xbd6033){WhatsappAccountEvents['emit'](_0x22b547+':'+_0x279a56['id'],_0x279a56);WhatsappAccountEvents['emit'](_0x22b547,_0x279a56);_0xbd6033(null);};}for(var e in events){if(events[_0x59fe('0x4')](e)){var event=events[e];WhatsappAccount[_0x59fe('0x5')](e,emitEvent(event));}}module[_0x59fe('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index a7738b0..8a5fabf 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 _0x1f27=['path','../../config/environment','exports','define','whatsapp_accounts','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3a9dfa,_0x1a0dc7){var _0x2f857e=function(_0x5197d3){while(--_0x5197d3){_0x3a9dfa['push'](_0x3a9dfa['shift']());}};_0x2f857e(++_0x1a0dc7);}(_0x1f27,0x163));var _0x71f2=function(_0x62fc16,_0x1c8dca){_0x62fc16=_0x62fc16-0x0;var _0x1c9e27=_0x1f27[_0x62fc16];return _0x1c9e27;};'use strict';var _=require('lodash');var util=require(_0x71f2('0x0'));var logger=require(_0x71f2('0x1'))('api');var moment=require(_0x71f2('0x2'));var BPromise=require(_0x71f2('0x3'));var rp=require(_0x71f2('0x4'));var fs=require('fs');var path=require(_0x71f2('0x5'));var rimraf=require('rimraf');var config=require(_0x71f2('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0x71f2('0x7')]=function(_0x3a298b,_0x14b07b){return _0x3a298b[_0x71f2('0x8')]('WhatsappAccount',attributes,{'tableName':_0x71f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ed0=['../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7ed0,0x1a9));var _0x07ed=function(_0x1540e7,_0x516f93){_0x1540e7=_0x1540e7-0x0;var _0xa80081=_0x7ed0[_0x1540e7];return _0xa80081;};'use strict';var _=require(_0x07ed('0x0'));var util=require('util');var logger=require(_0x07ed('0x1'))('api');var moment=require(_0x07ed('0x2'));var BPromise=require(_0x07ed('0x3'));var rp=require(_0x07ed('0x4'));var fs=require('fs');var path=require(_0x07ed('0x5'));var rimraf=require(_0x07ed('0x6'));var config=require(_0x07ed('0x7'));var attributes=require(_0x07ed('0x8'));module[_0x07ed('0x9')]=function(_0x3583d1,_0x1cb2fb){return _0x3583d1[_0x07ed('0xa')]('WhatsappAccount',attributes,{'tableName':_0x07ed('0xb'),'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 0305bb6..c7dbdac 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 _0xff28=['WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','WhatsappAccount','find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then'];(function(_0x1da759,_0x1321fb){var _0x481830=function(_0x22c671){while(--_0x22c671){_0x1da759['push'](_0x1da759['shift']());}};_0x481830(++_0x1321fb);}(_0xff28,0x8f));var _0x8ff2=function(_0x3050ca,_0x3e36b0){_0x3050ca=_0x3050ca-0x0;var _0x1eed1d=_0xff28[_0x3050ca];return _0x1eed1d;};'use strict';var _=require(_0x8ff2('0x0'));var util=require(_0x8ff2('0x1'));var moment=require(_0x8ff2('0x2'));var BPromise=require(_0x8ff2('0x3'));var rs=require(_0x8ff2('0x4'));var fs=require('fs');var Redis=require(_0x8ff2('0x5'));var db=require(_0x8ff2('0x6'))['db'];var utils=require(_0x8ff2('0x7'));var logger=require(_0x8ff2('0x8'))(_0x8ff2('0x9'));var config=require(_0x8ff2('0xa'));var jayson=require(_0x8ff2('0xb'));var client=jayson[_0x8ff2('0xc')][_0x8ff2('0xd')]({'port':0x232a});config['redis']=_[_0x8ff2('0xe')](config[_0x8ff2('0xf')],{'host':_0x8ff2('0x10'),'port':0x18eb});var socket=require(_0x8ff2('0x11'))(new Redis(config[_0x8ff2('0xf')]));require(_0x8ff2('0x12'))[_0x8ff2('0x13')](socket);function respondWithRpcPromise(_0x2684f8,_0x4cdc0d,_0x50e13b){return new BPromise(function(_0x27140a,_0x46acfb){return client['request'](_0x2684f8,_0x50e13b)[_0x8ff2('0x14')](function(_0x2bb929){logger['info'](_0x8ff2('0x15'),_0x4cdc0d,_0x8ff2('0x16'));logger[_0x8ff2('0x17')](_0x8ff2('0x18'),_0x4cdc0d,_0x8ff2('0x16'),JSON[_0x8ff2('0x19')](_0x2bb929));if(_0x2bb929['error']){if(_0x2bb929[_0x8ff2('0x1a')][_0x8ff2('0x1b')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4cdc0d,_0x2bb929[_0x8ff2('0x1a')][_0x8ff2('0x1c')]);return _0x46acfb(_0x2bb929[_0x8ff2('0x1a')][_0x8ff2('0x1c')]);}logger[_0x8ff2('0x1a')]('WhatsappAccount,\x20%s,\x20%s',_0x4cdc0d,_0x2bb929[_0x8ff2('0x1a')][_0x8ff2('0x1c')]);return _0x27140a(_0x2bb929['error'][_0x8ff2('0x1c')]);}else{logger[_0x8ff2('0x1d')](_0x8ff2('0x15'),_0x4cdc0d,_0x8ff2('0x16'));_0x27140a(_0x2bb929['result']['message']);}})[_0x8ff2('0x1e')](function(_0x196fb8){logger['error'](_0x8ff2('0x15'),_0x4cdc0d,_0x196fb8);_0x46acfb(_0x196fb8);});});}exports['ShowWhatsappAccount']=function(_0x47d05f){var _0x2f0a4b=this;return new Promise(function(_0x4abe16,_0x22ace5){return db[_0x8ff2('0x1f')][_0x8ff2('0x20')]({'raw':_0x47d05f['options']?_0x47d05f[_0x8ff2('0x21')][_0x8ff2('0x22')]===undefined?!![]:![]:!![],'where':_0x47d05f[_0x8ff2('0x21')]?_0x47d05f[_0x8ff2('0x21')][_0x8ff2('0x23')]||null:null,'attributes':_0x47d05f[_0x8ff2('0x21')]?_0x47d05f['options'][_0x8ff2('0x24')]||null:null,'include':_0x47d05f[_0x8ff2('0x21')]?_0x47d05f[_0x8ff2('0x21')][_0x8ff2('0x25')]?_[_0x8ff2('0x26')](_0x47d05f['options'][_0x8ff2('0x25')],function(_0x3a8f71){return{'model':db[_0x3a8f71[_0x8ff2('0x27')]],'as':_0x3a8f71['as'],'attributes':_0x3a8f71[_0x8ff2('0x24')],'include':_0x3a8f71[_0x8ff2('0x25')]?_['map'](_0x3a8f71[_0x8ff2('0x25')],function(_0x5bafac){return{'model':db[_0x5bafac[_0x8ff2('0x27')]],'as':_0x5bafac['as'],'attributes':_0x5bafac[_0x8ff2('0x24')],'include':_0x5bafac[_0x8ff2('0x25')]?_[_0x8ff2('0x26')](_0x5bafac[_0x8ff2('0x25')],function(_0x4be6a4){return{'model':db[_0x4be6a4['model']],'as':_0x4be6a4['as'],'attributes':_0x4be6a4[_0x8ff2('0x24')]};}):[]};}):[]};}):[]:[]})[_0x8ff2('0x14')](function(_0x2c95f7){logger[_0x8ff2('0x1d')](_0x8ff2('0x28'),_0x47d05f);logger[_0x8ff2('0x17')](_0x8ff2('0x28'),_0x47d05f,JSON['stringify'](_0x2c95f7));_0x4abe16(_0x2c95f7);})['catch'](function(_0x7ef353){logger[_0x8ff2('0x1a')]('ShowWhatsappAccount',_0x7ef353['message'],_0x47d05f);_0x22ace5(_0x2f0a4b[_0x8ff2('0x1a')](0x1f4,_0x7ef353[_0x8ff2('0x1c')]));});});}; \ No newline at end of file +var _0x1126=['where','attributes','include','model','map','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw'];(function(_0x53f608,_0x256def){var _0x495b7d=function(_0x467eab){while(--_0x467eab){_0x53f608['push'](_0x53f608['shift']());}};_0x495b7d(++_0x256def);}(_0x1126,0x177));var _0x6112=function(_0x5e295c,_0x4a2c73){_0x5e295c=_0x5e295c-0x0;var _0x5899aa=_0x1126[_0x5e295c];return _0x5899aa;};'use strict';var _=require(_0x6112('0x0'));var util=require(_0x6112('0x1'));var moment=require(_0x6112('0x2'));var BPromise=require(_0x6112('0x3'));var rs=require(_0x6112('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6112('0x5'))['db'];var utils=require(_0x6112('0x6'));var logger=require(_0x6112('0x7'))(_0x6112('0x8'));var config=require(_0x6112('0x9'));var jayson=require(_0x6112('0xa'));var client=jayson[_0x6112('0xb')][_0x6112('0xc')]({'port':0x232a});config['redis']=_[_0x6112('0xd')](config[_0x6112('0xe')],{'host':_0x6112('0xf'),'port':0x18eb});var socket=require(_0x6112('0x10'))(new Redis(config[_0x6112('0xe')]));require(_0x6112('0x11'))[_0x6112('0x12')](socket);function respondWithRpcPromise(_0x3e07c7,_0x581b93,_0x373142){return new BPromise(function(_0x5a6a69,_0x520d4c){return client[_0x6112('0x13')](_0x3e07c7,_0x373142)['then'](function(_0x316c4d){logger[_0x6112('0x14')](_0x6112('0x15'),_0x581b93,_0x6112('0x16'));logger[_0x6112('0x17')](_0x6112('0x18'),_0x581b93,'request\x20sent',JSON[_0x6112('0x19')](_0x316c4d));if(_0x316c4d[_0x6112('0x1a')]){if(_0x316c4d[_0x6112('0x1a')][_0x6112('0x1b')]===0x1f4){logger['error'](_0x6112('0x15'),_0x581b93,_0x316c4d['error'][_0x6112('0x1c')]);return _0x520d4c(_0x316c4d[_0x6112('0x1a')][_0x6112('0x1c')]);}logger[_0x6112('0x1a')](_0x6112('0x15'),_0x581b93,_0x316c4d[_0x6112('0x1a')]['message']);return _0x5a6a69(_0x316c4d[_0x6112('0x1a')][_0x6112('0x1c')]);}else{logger[_0x6112('0x14')](_0x6112('0x15'),_0x581b93,'request\x20sent');_0x5a6a69(_0x316c4d[_0x6112('0x1d')][_0x6112('0x1c')]);}})['catch'](function(_0x48525a){logger['error'](_0x6112('0x15'),_0x581b93,_0x48525a);_0x520d4c(_0x48525a);});});}exports[_0x6112('0x1e')]=function(_0x4e7fd7){var _0x2cd7ef=this;return new Promise(function(_0x5c142e,_0x205f19){return db[_0x6112('0x1f')][_0x6112('0x20')]({'raw':_0x4e7fd7[_0x6112('0x21')]?_0x4e7fd7[_0x6112('0x21')][_0x6112('0x22')]===undefined?!![]:![]:!![],'where':_0x4e7fd7[_0x6112('0x21')]?_0x4e7fd7[_0x6112('0x21')][_0x6112('0x23')]||null:null,'attributes':_0x4e7fd7[_0x6112('0x21')]?_0x4e7fd7['options'][_0x6112('0x24')]||null:null,'include':_0x4e7fd7['options']?_0x4e7fd7[_0x6112('0x21')][_0x6112('0x25')]?_['map'](_0x4e7fd7[_0x6112('0x21')][_0x6112('0x25')],function(_0x1d12ac){return{'model':db[_0x1d12ac[_0x6112('0x26')]],'as':_0x1d12ac['as'],'attributes':_0x1d12ac[_0x6112('0x24')],'include':_0x1d12ac[_0x6112('0x25')]?_[_0x6112('0x27')](_0x1d12ac[_0x6112('0x25')],function(_0x590924){return{'model':db[_0x590924[_0x6112('0x26')]],'as':_0x590924['as'],'attributes':_0x590924[_0x6112('0x24')],'include':_0x590924['include']?_['map'](_0x590924[_0x6112('0x25')],function(_0x2396db){return{'model':db[_0x2396db[_0x6112('0x26')]],'as':_0x2396db['as'],'attributes':_0x2396db['attributes']};}):[]};}):[]};}):[]:[]})[_0x6112('0x28')](function(_0x1df2fb){logger[_0x6112('0x14')](_0x6112('0x1e'),_0x4e7fd7);logger[_0x6112('0x17')](_0x6112('0x1e'),_0x4e7fd7,JSON[_0x6112('0x19')](_0x1df2fb));_0x5c142e(_0x1df2fb);})['catch'](function(_0x4271e9){logger[_0x6112('0x1a')]('ShowWhatsappAccount',_0x4271e9[_0x6112('0x1c')],_0x4e7fd7);_0x205f19(_0x2cd7ef['error'](0x1f4,_0x4271e9[_0x6112('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 8cec4e6..b4a6c57 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 _0x1cd5=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener'];(function(_0x3fc1c4,_0x1fd30b){var _0x246db3=function(_0x53ee80){while(--_0x53ee80){_0x3fc1c4['push'](_0x3fc1c4['shift']());}};_0x246db3(++_0x1fd30b);}(_0x1cd5,0x132));var _0x51cd=function(_0xf062aa,_0x1d9f72){_0xf062aa=_0xf062aa-0x0;var _0x372b3b=_0x1cd5[_0xf062aa];return _0x372b3b;};'use strict';var WhatsappAccountEvents=require(_0x51cd('0x0'));var events=[_0x51cd('0x1'),_0x51cd('0x2'),_0x51cd('0x3')];function createListener(_0x131437,_0x204243){return function(_0x4f2054){_0x204243[_0x51cd('0x4')](_0x131437,_0x4f2054);};}function removeListener(_0x50cb53,_0x522b20){return function(){WhatsappAccountEvents[_0x51cd('0x5')](_0x50cb53,_0x522b20);};}exports['register']=function(_0x3405f9){for(var _0x2f1491=0x0,_0x554f0a=events[_0x51cd('0x6')];_0x2f1491<_0x554f0a;_0x2f1491++){var _0x22ea64=events[_0x2f1491];var _0x49b26a=createListener(_0x51cd('0x7')+_0x22ea64,_0x3405f9);WhatsappAccountEvents['on'](_0x22ea64,_0x49b26a);}}; \ No newline at end of file +var _0xc5db=['removeListener','register','whatsappAccount:','save','remove'];(function(_0x2f8f44,_0x4989a4){var _0x547293=function(_0x2373f6){while(--_0x2373f6){_0x2f8f44['push'](_0x2f8f44['shift']());}};_0x547293(++_0x4989a4);}(_0xc5db,0x10c));var _0xbc5d=function(_0x3825de,_0x5e8189){_0x3825de=_0x3825de-0x0;var _0xc87bd8=_0xc5db[_0x3825de];return _0xc87bd8;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xbc5d('0x0'),_0xbc5d('0x1'),'update'];function createListener(_0x3bff0e,_0x4929c1){return function(_0x5df61e){_0x4929c1['emit'](_0x3bff0e,_0x5df61e);};}function removeListener(_0x1114d0,_0x129267){return function(){WhatsappAccountEvents[_0xbc5d('0x2')](_0x1114d0,_0x129267);};}exports[_0xbc5d('0x3')]=function(_0x5084aa){for(var _0xedc85e=0x0,_0x5a7d35=events['length'];_0xedc85e<_0x5a7d35;_0xedc85e++){var _0x1dc0f6=events[_0xedc85e];var _0x420935=createListener(_0xbc5d('0x4')+_0x1dc0f6,_0x5084aa);WhatsappAccountEvents['on'](_0x1dc0f6,_0x420935);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 7ee4fd5..85be9db 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 _0x008d=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','get','/:id','create','update','delete','destroy','exports'];(function(_0x2f965f,_0x100aca){var _0x73f2b9=function(_0x25705d){while(--_0x25705d){_0x2f965f['push'](_0x2f965f['shift']());}};_0x73f2b9(++_0x100aca);}(_0x008d,0x154));var _0xd008=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x008d[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xd008('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd008('0x1'));var express=require(_0xd008('0x2'));var router=express[_0xd008('0x3')]();var fs_extra=require(_0xd008('0x4'));var auth=require(_0xd008('0x5'));var interaction=require(_0xd008('0x6'));var config=require(_0xd008('0x7'));var controller=require(_0xd008('0x8'));router['get']('/',auth[_0xd008('0x9')](),controller['index']);router[_0xd008('0xa')](_0xd008('0xb'),auth[_0xd008('0x9')](),controller['show']);router['post']('/',auth[_0xd008('0x9')](),controller[_0xd008('0xc')]);router['put']('/:id',auth[_0xd008('0x9')](),controller[_0xd008('0xd')]);router[_0xd008('0xe')](_0xd008('0xb'),auth[_0xd008('0x9')](),controller[_0xd008('0xf')]);module[_0xd008('0x10')]=router; \ No newline at end of file +var _0x4c17=['delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','update'];(function(_0xf3c843,_0x8ff24e){var _0x3191c6=function(_0x2f1ef7){while(--_0x2f1ef7){_0xf3c843['push'](_0xf3c843['shift']());}};_0x3191c6(++_0x8ff24e);}(_0x4c17,0x152));var _0x74c1=function(_0x572c81,_0x415049){_0x572c81=_0x572c81-0x0;var _0x5bd14a=_0x4c17[_0x572c81];return _0x5bd14a;};'use strict';var multer=require(_0x74c1('0x0'));var util=require(_0x74c1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x74c1('0x2')]();var fs_extra=require(_0x74c1('0x3'));var auth=require(_0x74c1('0x4'));var interaction=require(_0x74c1('0x5'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x74c1('0x6')]('/',auth[_0x74c1('0x7')](),controller[_0x74c1('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x74c1('0x9')]);router[_0x74c1('0xa')]('/',auth[_0x74c1('0x7')](),controller['create']);router[_0x74c1('0xb')](_0x74c1('0xc'),auth[_0x74c1('0x7')](),controller[_0x74c1('0xd')]);router[_0x74c1('0xe')](_0x74c1('0xc'),auth[_0x74c1('0x7')](),controller['destroy']);module[_0x74c1('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 2f35857..d3864f8 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 _0x189e=['noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x104b35,_0x13f218){var _0x55584d=function(_0x2bbb71){while(--_0x2bbb71){_0x104b35['push'](_0x104b35['shift']());}};_0x55584d(++_0x13f218);}(_0x189e,0x126));var _0xe189=function(_0xf8f29f,_0x487c16){_0xf8f29f=_0xf8f29f-0x0;var _0x5e99a6=_0x189e[_0xf8f29f];return _0x5e99a6;};'use strict';var Sequelize=require(_0xe189('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe189('0x1')},'appdata':{'type':Sequelize[_0xe189('0x2')]()},'description':{'type':Sequelize[_0xe189('0x3')]},'interval':{'type':Sequelize[_0xe189('0x3')],'defaultValue':_0xe189('0x4')}}; \ No newline at end of file +var _0x6d5e=['STRING','*,*,*,*','exports','noop','TEXT'];(function(_0x2f3f09,_0x69d41b){var _0x5df518=function(_0x124516){while(--_0x124516){_0x2f3f09['push'](_0x2f3f09['shift']());}};_0x5df518(++_0x69d41b);}(_0x6d5e,0x7f));var _0xe6d5=function(_0x345896,_0x5a639b){_0x345896=_0x345896-0x0;var _0x4e9b8e=_0x6d5e[_0x345896];return _0x4e9b8e;};'use strict';var Sequelize=require('sequelize');module[_0xe6d5('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe6d5('0x1')},'appdata':{'type':Sequelize[_0xe6d5('0x2')]()},'description':{'type':Sequelize[_0xe6d5('0x3')]},'interval':{'type':Sequelize[_0xe6d5('0x3')],'defaultValue':_0xe6d5('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 7fb572c..74ee973 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 _0x202a=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','then','destroy','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','moment','path','sox','fs-extra','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util'];(function(_0x3c75bf,_0xfa1998){var _0x17ef87=function(_0x26be3b){while(--_0x26be3b){_0x3c75bf['push'](_0x3c75bf['shift']());}};_0x17ef87(++_0xfa1998);}(_0x202a,0xc0));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa202('0x0'));var zipdir=require(_0xa202('0x1'));var jsonpatch=require(_0xa202('0x2'));var rp=require('request-promise');var moment=require(_0xa202('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa202('0x4'));var sox=require(_0xa202('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa202('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa202('0x7'));var deskjs=require(_0xa202('0x8'));var toCsv=require(_0xa202('0x9'));var querystring=require(_0xa202('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa202('0xb'));var qs=require(_0xa202('0xc'));var as=require(_0xa202('0xd'));var hardwareService=require(_0xa202('0xe'));var logger=require('../../config/logger')(_0xa202('0xf'));var utils=require('../../config/utils');var config=require(_0xa202('0x10'));var licenseUtil=require(_0xa202('0x11'));var db=require(_0xa202('0x12'))['db'];function respondWithStatusCode(_0x5bef49,_0x16164b){_0x16164b=_0x16164b||0xcc;return function(_0xdd992){if(_0xdd992){return _0x5bef49[_0xa202('0x13')](_0x16164b);}return _0x5bef49[_0xa202('0x14')](_0x16164b)[_0xa202('0x15')]();};}function respondWithResult(_0x29969e,_0x598d8e){_0x598d8e=_0x598d8e||0xc8;return function(_0x13510c){if(_0x13510c){return _0x29969e[_0xa202('0x14')](_0x598d8e)[_0xa202('0x16')](_0x13510c);}};}function respondWithFilteredResult(_0x28953b,_0x2e1790){return function(_0x5dc065){if(_0x5dc065){var _0x331df8=typeof _0x2e1790[_0xa202('0x17')]===_0xa202('0x18')&&typeof _0x2e1790[_0xa202('0x19')]===_0xa202('0x18');var _0x214a08=_0x5dc065['count'];var _0x44a1b6=_0x331df8?0x0:_0x2e1790['offset'];var _0x130df2=_0x331df8?_0x5dc065['count']:_0x2e1790[_0xa202('0x17')]+_0x2e1790[_0xa202('0x19')];var _0x130c45;if(_0x130df2>=_0x214a08){_0x130df2=_0x214a08;_0x130c45=0xc8;}else{_0x130c45=0xce;}_0x28953b[_0xa202('0x14')](_0x130c45);return _0x28953b[_0xa202('0x1a')]('Content-Range',_0x44a1b6+'-'+_0x130df2+'/'+_0x214a08)[_0xa202('0x16')](_0x5dc065);}return null;};}function patchUpdates(_0x6132f1){return function(_0x353440){try{jsonpatch[_0xa202('0x1b')](_0x353440,_0x6132f1,!![]);}catch(_0x188195){return BPromise['reject'](_0x188195);}return _0x353440[_0xa202('0x1c')]();};}function saveUpdates(_0x7b47e5,_0x46cfa4){return function(_0x44801a){if(_0x44801a){return _0x44801a['update'](_0x7b47e5)[_0xa202('0x1d')](function(_0x192d3c){return _0x192d3c;});}return null;};}function removeEntity(_0x5b764d,_0x565685){return function(_0x7991c7){if(_0x7991c7){return _0x7991c7[_0xa202('0x1e')]()['then'](function(){_0x5b764d[_0xa202('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5373b6,_0x72fe3e){return function(_0x268ee9){if(!_0x268ee9){_0x5373b6[_0xa202('0x13')](0x194);}return _0x268ee9;};}function handleError(_0x2f0779,_0xf13878){_0xf13878=_0xf13878||0x1f4;return function(_0x1d6704){logger['error'](_0x1d6704['stack']);if(_0x1d6704['name']){delete _0x1d6704['name'];}_0x2f0779[_0xa202('0x14')](_0xf13878)[_0xa202('0x1f')](_0x1d6704);};}exports[_0xa202('0x20')]=function(_0x57f049,_0x35ae40){var _0x390633={},_0xf73ab4={},_0x2cc2af={'count':0x0,'rows':[]};var _0x3eed2c=_[_0xa202('0x21')](db[_0xa202('0x22')][_0xa202('0x23')],function(_0x22ba67){return{'name':_0x22ba67[_0xa202('0x24')],'type':_0x22ba67[_0xa202('0x25')][_0xa202('0x26')]};});_0xf73ab4[_0xa202('0x27')]=_[_0xa202('0x21')](_0x3eed2c,_0xa202('0x28'));_0xf73ab4[_0xa202('0x29')]=_['keys'](_0x57f049[_0xa202('0x29')]);_0xf73ab4[_0xa202('0x2a')]=_[_0xa202('0x2b')](_0xf73ab4[_0xa202('0x27')],_0xf73ab4[_0xa202('0x29')]);_0x390633[_0xa202('0x2c')]=_['intersection'](_0xf73ab4[_0xa202('0x27')],qs[_0xa202('0x2d')](_0x57f049['query'][_0xa202('0x2d')]));_0x390633[_0xa202('0x2c')]=_0x390633['attributes']['length']?_0x390633['attributes']:_0xf73ab4[_0xa202('0x27')];if(!_0x57f049[_0xa202('0x29')][_0xa202('0x2e')](_0xa202('0x2f'))){_0x390633[_0xa202('0x19')]=qs['limit'](_0x57f049[_0xa202('0x29')]['limit']);_0x390633[_0xa202('0x17')]=qs[_0xa202('0x17')](_0x57f049[_0xa202('0x29')]['offset']);}_0x390633[_0xa202('0x30')]=qs['sort'](_0x57f049['query'][_0xa202('0x31')]);_0x390633[_0xa202('0x32')]=qs['filters'](_[_0xa202('0x33')](_0x57f049['query'],_0xf73ab4['filters']),_0x3eed2c);if(_0x57f049[_0xa202('0x29')][_0xa202('0x34')]){_0x390633['where']=_[_0xa202('0x35')](_0x390633[_0xa202('0x32')],{'$or':_[_0xa202('0x21')](_0x3eed2c,function(_0x527921){if(_0x527921[_0xa202('0x25')]!==_0xa202('0x36')){var _0x34ba33={};_0x34ba33[_0x527921[_0xa202('0x28')]]={'$like':'%'+_0x57f049[_0xa202('0x29')][_0xa202('0x34')]+'%'};return _0x34ba33;}})});}_0x390633=_[_0xa202('0x35')]({},_0x390633,_0x57f049[_0xa202('0x37')]);var _0x226863={'where':_0x390633[_0xa202('0x32')]};return db[_0xa202('0x22')][_0xa202('0x38')](_0x226863)['then'](function(_0x5bd528){_0x2cc2af[_0xa202('0x38')]=_0x5bd528;if(_0x57f049[_0xa202('0x29')][_0xa202('0x39')]){_0x390633[_0xa202('0x3a')]=[{'all':!![]}];}return db[_0xa202('0x22')][_0xa202('0x3b')](_0x390633);})[_0xa202('0x1d')](function(_0x3bca66){_0x2cc2af[_0xa202('0x3c')]=_0x3bca66;return _0x2cc2af;})[_0xa202('0x1d')](respondWithFilteredResult(_0x35ae40,_0x390633))['catch'](handleError(_0x35ae40,null));};exports[_0xa202('0x3d')]=function(_0x9879fe,_0x51c551){var _0x48a546={'raw':!![],'where':{'id':_0x9879fe[_0xa202('0x3e')]['id']}},_0x4f783c={};_0x4f783c[_0xa202('0x27')]=_[_0xa202('0x3f')](db[_0xa202('0x22')]['rawAttributes']);_0x4f783c[_0xa202('0x29')]=_[_0xa202('0x3f')](_0x9879fe[_0xa202('0x29')]);_0x4f783c[_0xa202('0x2a')]=_['intersection'](_0x4f783c[_0xa202('0x27')],_0x4f783c[_0xa202('0x29')]);_0x48a546[_0xa202('0x2c')]=_['intersection'](_0x4f783c[_0xa202('0x27')],qs[_0xa202('0x2d')](_0x9879fe[_0xa202('0x29')][_0xa202('0x2d')]));_0x48a546[_0xa202('0x2c')]=_0x48a546[_0xa202('0x2c')][_0xa202('0x40')]?_0x48a546[_0xa202('0x2c')]:_0x4f783c[_0xa202('0x27')];if(_0x9879fe[_0xa202('0x29')][_0xa202('0x39')]){_0x48a546[_0xa202('0x3a')]=[{'all':!![]}];}_0x48a546=_['merge']({},_0x48a546,_0x9879fe[_0xa202('0x37')]);return db[_0xa202('0x22')][_0xa202('0x41')](_0x48a546)[_0xa202('0x1d')](handleEntityNotFound(_0x51c551,null))[_0xa202('0x1d')](respondWithResult(_0x51c551,null))[_0xa202('0x42')](handleError(_0x51c551,null));};exports[_0xa202('0x43')]=function(_0x77626c,_0x5979cd){return db[_0xa202('0x22')][_0xa202('0x43')](_0x77626c[_0xa202('0x44')],{})['then'](respondWithResult(_0x5979cd,0xc9))[_0xa202('0x42')](handleError(_0x5979cd,null));};exports[_0xa202('0x45')]=function(_0xc72f62,_0x55cfc5){if(_0xc72f62[_0xa202('0x44')]['id']){delete _0xc72f62[_0xa202('0x44')]['id'];}return db[_0xa202('0x22')][_0xa202('0x41')]({'where':{'id':_0xc72f62[_0xa202('0x3e')]['id']}})[_0xa202('0x1d')](handleEntityNotFound(_0x55cfc5,null))[_0xa202('0x1d')](saveUpdates(_0xc72f62[_0xa202('0x44')],null))[_0xa202('0x1d')](respondWithResult(_0x55cfc5,null))[_0xa202('0x42')](handleError(_0x55cfc5,null));};exports[_0xa202('0x1e')]=function(_0x4cb0a5,_0x38e236){return db[_0xa202('0x22')][_0xa202('0x41')]({'where':{'id':_0x4cb0a5['params']['id']}})['then'](handleEntityNotFound(_0x38e236,null))[_0xa202('0x1d')](removeEntity(_0x38e236,null))[_0xa202('0x42')](handleError(_0x38e236,null));}; \ No newline at end of file +var _0x81cb=['model','attributes','fields','length','order','sort','where','pick','filter','merge','options','WhatsappApplication','count','findAll','rows','show','params','includeAll','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x192b0c,_0x38bc7e){var _0x1694d5=function(_0x20aa04){while(--_0x20aa04){_0x192b0c['push'](_0x192b0c['shift']());}};_0x1694d5(++_0x38bc7e);}(_0x81cb,0xaa));var _0xb81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81cb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb81c('0x0'));var rimraf=require(_0xb81c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb81c('0x2'));var rp=require(_0xb81c('0x3'));var moment=require('moment');var BPromise=require(_0xb81c('0x4'));var Mustache=require(_0xb81c('0x5'));var util=require(_0xb81c('0x6'));var path=require(_0xb81c('0x7'));var sox=require('sox');var csv=require(_0xb81c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb81c('0x9'));var squel=require(_0xb81c('0xa'));var crypto=require(_0xb81c('0xb'));var jsforce=require(_0xb81c('0xc'));var deskjs=require(_0xb81c('0xd'));var toCsv=require(_0xb81c('0x8'));var querystring=require(_0xb81c('0xe'));var Papa=require(_0xb81c('0xf'));var Redis=require(_0xb81c('0x10'));var authService=require(_0xb81c('0x11'));var qs=require(_0xb81c('0x12'));var as=require(_0xb81c('0x13'));var hardwareService=require(_0xb81c('0x14'));var logger=require(_0xb81c('0x15'))('api');var utils=require(_0xb81c('0x16'));var config=require(_0xb81c('0x17'));var licenseUtil=require(_0xb81c('0x18'));var db=require(_0xb81c('0x19'))['db'];function respondWithStatusCode(_0x2e8242,_0x4b1d98){_0x4b1d98=_0x4b1d98||0xcc;return function(_0x9c3214){if(_0x9c3214){return _0x2e8242['sendStatus'](_0x4b1d98);}return _0x2e8242[_0xb81c('0x1a')](_0x4b1d98)[_0xb81c('0x1b')]();};}function respondWithResult(_0x572945,_0x1bb255){_0x1bb255=_0x1bb255||0xc8;return function(_0x2f50d3){if(_0x2f50d3){return _0x572945['status'](_0x1bb255)[_0xb81c('0x1c')](_0x2f50d3);}};}function respondWithFilteredResult(_0x3942dc,_0x3462bd){return function(_0x56eb92){if(_0x56eb92){var _0x393e11=typeof _0x3462bd[_0xb81c('0x1d')]==='undefined'&&typeof _0x3462bd[_0xb81c('0x1e')]===_0xb81c('0x1f');var _0x32916b=_0x56eb92['count'];var _0x37341d=_0x393e11?0x0:_0x3462bd[_0xb81c('0x1d')];var _0xbcf806=_0x393e11?_0x56eb92['count']:_0x3462bd[_0xb81c('0x1d')]+_0x3462bd[_0xb81c('0x1e')];var _0xfab47b;if(_0xbcf806>=_0x32916b){_0xbcf806=_0x32916b;_0xfab47b=0xc8;}else{_0xfab47b=0xce;}_0x3942dc[_0xb81c('0x1a')](_0xfab47b);return _0x3942dc[_0xb81c('0x20')](_0xb81c('0x21'),_0x37341d+'-'+_0xbcf806+'/'+_0x32916b)[_0xb81c('0x1c')](_0x56eb92);}return null;};}function patchUpdates(_0x4f09d7){return function(_0xc2ba68){try{jsonpatch[_0xb81c('0x22')](_0xc2ba68,_0x4f09d7,!![]);}catch(_0x1aa39a){return BPromise[_0xb81c('0x23')](_0x1aa39a);}return _0xc2ba68['save']();};}function saveUpdates(_0x11a5d3,_0x597547){return function(_0x449ad7){if(_0x449ad7){return _0x449ad7[_0xb81c('0x24')](_0x11a5d3)[_0xb81c('0x25')](function(_0x14650e){return _0x14650e;});}return null;};}function removeEntity(_0x554cc0,_0x5de2ac){return function(_0x12798b){if(_0x12798b){return _0x12798b[_0xb81c('0x26')]()[_0xb81c('0x25')](function(){_0x554cc0[_0xb81c('0x1a')](0xcc)[_0xb81c('0x1b')]();});}};}function handleEntityNotFound(_0x17d176,_0x45dbe5){return function(_0xc1fadb){if(!_0xc1fadb){_0x17d176[_0xb81c('0x27')](0x194);}return _0xc1fadb;};}function handleError(_0x2143ba,_0x253333){_0x253333=_0x253333||0x1f4;return function(_0x132080){logger[_0xb81c('0x28')](_0x132080[_0xb81c('0x29')]);if(_0x132080[_0xb81c('0x2a')]){delete _0x132080[_0xb81c('0x2a')];}_0x2143ba[_0xb81c('0x1a')](_0x253333)['send'](_0x132080);};}exports['index']=function(_0x15f86e,_0x1bb0e5){var _0x5470d3={},_0x3b690b={},_0x331692={'count':0x0,'rows':[]};var _0x545530=_[_0xb81c('0x2b')](db['WhatsappApplication'][_0xb81c('0x2c')],function(_0x5df2df){return{'name':_0x5df2df[_0xb81c('0x2d')],'type':_0x5df2df[_0xb81c('0x2e')][_0xb81c('0x2f')]};});_0x3b690b['model']=_[_0xb81c('0x2b')](_0x545530,'name');_0x3b690b[_0xb81c('0x30')]=_[_0xb81c('0x31')](_0x15f86e['query']);_0x3b690b[_0xb81c('0x32')]=_[_0xb81c('0x33')](_0x3b690b[_0xb81c('0x34')],_0x3b690b['query']);_0x5470d3[_0xb81c('0x35')]=_[_0xb81c('0x33')](_0x3b690b[_0xb81c('0x34')],qs[_0xb81c('0x36')](_0x15f86e[_0xb81c('0x30')][_0xb81c('0x36')]));_0x5470d3[_0xb81c('0x35')]=_0x5470d3[_0xb81c('0x35')][_0xb81c('0x37')]?_0x5470d3[_0xb81c('0x35')]:_0x3b690b['model'];if(!_0x15f86e[_0xb81c('0x30')]['hasOwnProperty']('nolimit')){_0x5470d3[_0xb81c('0x1e')]=qs['limit'](_0x15f86e[_0xb81c('0x30')]['limit']);_0x5470d3[_0xb81c('0x1d')]=qs[_0xb81c('0x1d')](_0x15f86e['query'][_0xb81c('0x1d')]);}_0x5470d3[_0xb81c('0x38')]=qs[_0xb81c('0x39')](_0x15f86e['query'][_0xb81c('0x39')]);_0x5470d3[_0xb81c('0x3a')]=qs[_0xb81c('0x32')](_[_0xb81c('0x3b')](_0x15f86e['query'],_0x3b690b[_0xb81c('0x32')]),_0x545530);if(_0x15f86e[_0xb81c('0x30')][_0xb81c('0x3c')]){_0x5470d3[_0xb81c('0x3a')]=_[_0xb81c('0x3d')](_0x5470d3[_0xb81c('0x3a')],{'$or':_[_0xb81c('0x2b')](_0x545530,function(_0x3284c6){if(_0x3284c6['type']!=='VIRTUAL'){var _0x4962ff={};_0x4962ff[_0x3284c6['name']]={'$like':'%'+_0x15f86e['query'][_0xb81c('0x3c')]+'%'};return _0x4962ff;}})});}_0x5470d3=_['merge']({},_0x5470d3,_0x15f86e[_0xb81c('0x3e')]);var _0x8fced9={'where':_0x5470d3[_0xb81c('0x3a')]};return db[_0xb81c('0x3f')][_0xb81c('0x40')](_0x8fced9)['then'](function(_0x458e22){_0x331692[_0xb81c('0x40')]=_0x458e22;if(_0x15f86e['query']['includeAll']){_0x5470d3['include']=[{'all':!![]}];}return db[_0xb81c('0x3f')][_0xb81c('0x41')](_0x5470d3);})[_0xb81c('0x25')](function(_0x1dff58){_0x331692[_0xb81c('0x42')]=_0x1dff58;return _0x331692;})[_0xb81c('0x25')](respondWithFilteredResult(_0x1bb0e5,_0x5470d3))['catch'](handleError(_0x1bb0e5,null));};exports[_0xb81c('0x43')]=function(_0x5513d0,_0x17dde0){var _0x8ac731={'raw':!![],'where':{'id':_0x5513d0[_0xb81c('0x44')]['id']}},_0x19b752={};_0x19b752['model']=_[_0xb81c('0x31')](db['WhatsappApplication'][_0xb81c('0x2c')]);_0x19b752['query']=_[_0xb81c('0x31')](_0x5513d0[_0xb81c('0x30')]);_0x19b752[_0xb81c('0x32')]=_['intersection'](_0x19b752[_0xb81c('0x34')],_0x19b752['query']);_0x8ac731[_0xb81c('0x35')]=_[_0xb81c('0x33')](_0x19b752[_0xb81c('0x34')],qs['fields'](_0x5513d0[_0xb81c('0x30')][_0xb81c('0x36')]));_0x8ac731[_0xb81c('0x35')]=_0x8ac731[_0xb81c('0x35')][_0xb81c('0x37')]?_0x8ac731[_0xb81c('0x35')]:_0x19b752[_0xb81c('0x34')];if(_0x5513d0[_0xb81c('0x30')][_0xb81c('0x45')]){_0x8ac731['include']=[{'all':!![]}];}_0x8ac731=_[_0xb81c('0x3d')]({},_0x8ac731,_0x5513d0[_0xb81c('0x3e')]);return db[_0xb81c('0x3f')][_0xb81c('0x46')](_0x8ac731)[_0xb81c('0x25')](handleEntityNotFound(_0x17dde0,null))['then'](respondWithResult(_0x17dde0,null))[_0xb81c('0x47')](handleError(_0x17dde0,null));};exports['create']=function(_0x187ec1,_0x4089b0){return db[_0xb81c('0x3f')][_0xb81c('0x48')](_0x187ec1[_0xb81c('0x49')],{})[_0xb81c('0x25')](respondWithResult(_0x4089b0,0xc9))[_0xb81c('0x47')](handleError(_0x4089b0,null));};exports['update']=function(_0x40fbf6,_0x200464){if(_0x40fbf6['body']['id']){delete _0x40fbf6['body']['id'];}return db[_0xb81c('0x3f')][_0xb81c('0x46')]({'where':{'id':_0x40fbf6[_0xb81c('0x44')]['id']}})[_0xb81c('0x25')](handleEntityNotFound(_0x200464,null))[_0xb81c('0x25')](saveUpdates(_0x40fbf6[_0xb81c('0x49')],null))[_0xb81c('0x25')](respondWithResult(_0x200464,null))[_0xb81c('0x47')](handleError(_0x200464,null));};exports[_0xb81c('0x26')]=function(_0x2e43a1,_0x512b3b){return db['WhatsappApplication'][_0xb81c('0x46')]({'where':{'id':_0x2e43a1['params']['id']}})[_0xb81c('0x25')](handleEntityNotFound(_0x512b3b,null))[_0xb81c('0x25')](removeEntity(_0x512b3b,null))[_0xb81c('0x47')](handleError(_0x512b3b,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 8323323..5889106 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 _0xd67b=['../../config/environment','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','path'];(function(_0x33b7a4,_0xa23d49){var _0x54af75=function(_0x21cbb1){while(--_0x21cbb1){_0x33b7a4['push'](_0x33b7a4['shift']());}};_0x54af75(++_0xa23d49);}(_0xd67b,0x133));var _0xbd67=function(_0x25f01c,_0x4092d2){_0x25f01c=_0x25f01c-0x0;var _0x42d647=_0xd67b[_0x25f01c];return _0x42d647;};'use strict';var _=require('lodash');var util=require(_0xbd67('0x0'));var logger=require('../../config/logger')(_0xbd67('0x1'));var moment=require(_0xbd67('0x2'));var BPromise=require(_0xbd67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd67('0x4'));var rimraf=require('rimraf');var config=require(_0xbd67('0x5'));var attributes=require('./whatsappApplication.attributes');module[_0xbd67('0x6')]=function(_0xa5c384,_0x2ad142){return _0xa5c384[_0xbd67('0x7')](_0xbd67('0x8'),attributes,{'tableName':_0xbd67('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbd67('0xa'),'collate':_0xbd67('0xb')});}; \ No newline at end of file +var _0x3435=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','WhatsappApplication'];(function(_0x15f19d,_0x1217ba){var _0x4b9e66=function(_0x423301){while(--_0x423301){_0x15f19d['push'](_0x15f19d['shift']());}};_0x4b9e66(++_0x1217ba);}(_0x3435,0xfa));var _0x5343=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x3435[_0x5eef05];return _0x56d4b8;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var logger=require(_0x5343('0x2'))(_0x5343('0x3'));var moment=require(_0x5343('0x4'));var BPromise=require(_0x5343('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5343('0x6'));var rimraf=require(_0x5343('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0x5343('0x8')]=function(_0x28f0f3,_0x4d26b5){return _0x28f0f3['define'](_0x5343('0x9'),attributes,{'tableName':_0x5343('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5343('0xb'),'collate':_0x5343('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index a695ea8..a3be5e3 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 _0x9bde=['code','message','WhatsappApplication,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x80dac1,_0x42bc1a){var _0x453e7a=function(_0x155262){while(--_0x155262){_0x80dac1['push'](_0x80dac1['shift']());}};_0x453e7a(++_0x42bc1a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x21ad7c,_0x1be30c){_0x21ad7c=_0x21ad7c-0x0;var _0x2d0811=_0x9bde[_0x21ad7c];return _0x2d0811;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0x6f0d=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x3d3e1e,_0x4f5d23){var _0x5115dd=function(_0x7e6041){while(--_0x7e6041){_0x3d3e1e['push'](_0x3d3e1e['shift']());}};_0x5115dd(++_0x4f5d23);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4bd4b5,_0xe3ced7){_0x4bd4b5=_0x4bd4b5-0x0;var _0x5a5cb1=_0x6f0d[_0x4bd4b5];return _0x5a5cb1;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index ede680e..999fc75 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 _0x5162=['whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','removeTags','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp'];(function(_0x31dba6,_0x5109ee){var _0xb903f2=function(_0x4ad34c){while(--_0x4ad34c){_0x31dba6['push'](_0x31dba6['shift']());}};_0xb903f2(++_0x5109ee);}(_0x5162,0x103));var _0x2516=function(_0x56922c,_0x347c88){_0x56922c=_0x56922c-0x0;var _0xf896d7=_0x5162[_0x56922c];return _0xf896d7;};'use strict';var multer=require(_0x2516('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2516('0x1')]();var fs_extra=require(_0x2516('0x2'));var auth=require(_0x2516('0x3'));var interaction=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var controller=require(_0x2516('0x6'));router[_0x2516('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2516('0x8'),auth[_0x2516('0x9')](),controller[_0x2516('0xa')]);router[_0x2516('0x7')](_0x2516('0xb'),auth[_0x2516('0x9')](),controller[_0x2516('0xc')]);router['get'](_0x2516('0xd'),auth[_0x2516('0x9')](),controller[_0x2516('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x2516('0xf')]('/',auth[_0x2516('0x9')](),controller[_0x2516('0x10')]);router[_0x2516('0xf')]('/:id/messages',auth[_0x2516('0x9')](),controller[_0x2516('0x11')]);router[_0x2516('0xf')](_0x2516('0x12'),auth[_0x2516('0x9')](),interaction[_0x2516('0x13')](_0x2516('0x14'),_0x2516('0x15')),controller[_0x2516('0x16')]);router[_0x2516('0x17')](_0x2516('0xb'),auth[_0x2516('0x9')](),interaction[_0x2516('0x13')](_0x2516('0x14'),_0x2516('0x18')),controller['update']);router[_0x2516('0x19')](_0x2516('0xb'),auth[_0x2516('0x9')](),interaction['tracked'](_0x2516('0x14'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x2516('0x19')](_0x2516('0x12'),auth[_0x2516('0x9')](),controller[_0x2516('0x1a')]);module[_0x2516('0x1b')]=router; \ No newline at end of file +var _0xd8b1=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','index','/describe','isAuthenticated','describe','get','show','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','/:id','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','exports'];(function(_0xdc02cf,_0x5714cc){var _0x5c1d7d=function(_0x5afd63){while(--_0x5afd63){_0xdc02cf['push'](_0xdc02cf['shift']());}};_0x5c1d7d(++_0x5714cc);}(_0xd8b1,0x105));var _0x1d8b=function(_0x5bd946,_0x3874b0){_0x5bd946=_0x5bd946-0x0;var _0x95b3a4=_0xd8b1[_0x5bd946];return _0x95b3a4;};'use strict';var multer=require(_0x1d8b('0x0'));var util=require(_0x1d8b('0x1'));var path=require(_0x1d8b('0x2'));var timeout=require(_0x1d8b('0x3'));var express=require(_0x1d8b('0x4'));var router=express['Router']();var fs_extra=require(_0x1d8b('0x5'));var auth=require(_0x1d8b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1d8b('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1d8b('0x8')]);router['get'](_0x1d8b('0x9'),auth[_0x1d8b('0xa')](),controller[_0x1d8b('0xb')]);router[_0x1d8b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1d8b('0xd')]);router['get']('/:id/messages',auth[_0x1d8b('0xa')](),controller['getMessages']);router[_0x1d8b('0xc')]('/:id/download',auth[_0x1d8b('0xa')](),controller[_0x1d8b('0xe')]);router[_0x1d8b('0xf')]('/',auth[_0x1d8b('0xa')](),controller[_0x1d8b('0x10')]);router[_0x1d8b('0xf')]('/:id/messages',auth[_0x1d8b('0xa')](),controller[_0x1d8b('0x11')]);router[_0x1d8b('0xf')](_0x1d8b('0x12'),auth[_0x1d8b('0xa')](),interaction[_0x1d8b('0x13')](_0x1d8b('0x14'),_0x1d8b('0x15')),controller['addTags']);router[_0x1d8b('0x16')](_0x1d8b('0x17'),auth[_0x1d8b('0xa')](),interaction[_0x1d8b('0x13')](_0x1d8b('0x14'),_0x1d8b('0x18')),controller[_0x1d8b('0x19')]);router['delete']('/:id',auth[_0x1d8b('0xa')](),interaction[_0x1d8b('0x13')](_0x1d8b('0x14'),_0x1d8b('0x1a')),controller[_0x1d8b('0x1b')]);router['delete'](_0x1d8b('0x12'),auth[_0x1d8b('0xa')](),controller['removeTags']);module[_0x1d8b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 78011b4..26843d9 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 _0x79d7=['ENUM','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x164b8a,_0x17a129){var _0x4c2bd9=function(_0x21507b){while(--_0x21507b){_0x164b8a['push'](_0x164b8a['shift']());}};_0x4c2bd9(++_0x17a129);}(_0x79d7,0x9c));var _0x779d=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x79d7[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0x779d('0x0'));var moment=require('moment');module[_0x779d('0x1')]={'closed':{'type':Sequelize[_0x779d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x779d('0x3')]},'disposition':{'type':Sequelize[_0x779d('0x4')]},'secondDisposition':{'type':Sequelize[_0x779d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x779d('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x779d('0x4')]},'read1stAt':{'type':Sequelize[_0x779d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x779d('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x779d('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x779d('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x779d('0x6')]}}; \ No newline at end of file +var _0x689b=['BOOLEAN','INTEGER','sequelize','exports','STRING','DATE','ENUM','out'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x689b,0x142));var _0xb689=function(_0x3c7af1,_0xa3c89b){_0x3c7af1=_0x3c7af1-0x0;var _0x29c450=_0x689b[_0x3c7af1];return _0x29c450;};'use strict';var Sequelize=require(_0xb689('0x0'));var moment=require('moment');module[_0xb689('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb689('0x2')]},'secondDisposition':{'type':Sequelize[_0xb689('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb689('0x2')]},'note':{'type':Sequelize[_0xb689('0x2')]},'phone':{'type':Sequelize[_0xb689('0x2')]},'read1stAt':{'type':Sequelize[_0xb689('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb689('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb689('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb689('0x4')]('in',_0xb689('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb689('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb689('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 795401d..d7c96eb 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 _0xd897=['map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','user','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','create','body','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','length','hasOwnProperty','order','sort','pick','where','WhatsappInteractionId','filter','$gte','split','format','addTags','spread','Tag','whatsappInteractionTags:save','removeTags','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','User','CmContact','firstName','lastName','Attachment','direction','WhatsappAccount','Account','Owner','get','Whatsapp','fullname','N.A.','createdAt','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','Messages','basename','existsSync','createReadStream','out','System','Contact','secret','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','moment','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','redis','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','then','error','name','send','index'];(function(_0x4920e8,_0x58e4fd){var _0x197211=function(_0x2ae3f4){while(--_0x2ae3f4){_0x4920e8['push'](_0x4920e8['shift']());}};_0x197211(++_0x58e4fd);}(_0xd897,0xd5));var _0x7d89=function(_0xa3ca0f,_0x456a23){_0xa3ca0f=_0xa3ca0f-0x0;var _0x529ee7=_0xd897[_0xa3ca0f];return _0x529ee7;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x7d89('0x0'));var moment=require(_0x7d89('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x7d89('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x7d89('0x3'));var interaction=require(_0x7d89('0x4'));var qs=require(_0x7d89('0x5'));var pdf=require(_0x7d89('0x6'));var logger=require(_0x7d89('0x7'))(_0x7d89('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x7d89('0x9')]=_['defaults'](config[_0x7d89('0x9')],{'host':_0x7d89('0xa'),'port':0x18eb});var socket=require(_0x7d89('0xb'))(new Redis(config[_0x7d89('0x9')]));require('./whatsappInteraction.socket')[_0x7d89('0xc')](socket);function respondWithStatusCode(_0x41523a,_0x4d211b){_0x4d211b=_0x4d211b||0xcc;return function(_0x359178){if(_0x359178){return _0x41523a[_0x7d89('0xd')](_0x4d211b);}return _0x41523a['status'](_0x4d211b)[_0x7d89('0xe')]();};}function respondWithResult(_0x37a8d3,_0x2e2f08){_0x2e2f08=_0x2e2f08||0xc8;return function(_0x4f1b58){if(_0x4f1b58){return _0x37a8d3['status'](_0x2e2f08)[_0x7d89('0xf')](_0x4f1b58);}};}function respondWithFilteredResult(_0x588a70,_0x464f77){return function(_0x5cd7d6){if(_0x5cd7d6){var _0x424aab=typeof _0x464f77[_0x7d89('0x10')]===_0x7d89('0x11')&&typeof _0x464f77[_0x7d89('0x12')]===_0x7d89('0x11');var _0x84135a=_0x5cd7d6[_0x7d89('0x13')];var _0x2ae675=_0x424aab?0x0:_0x464f77[_0x7d89('0x10')];var _0xc07aba=_0x424aab?_0x5cd7d6[_0x7d89('0x13')]:_0x464f77[_0x7d89('0x10')]+_0x464f77['limit'];var _0x22594a;if(_0xc07aba>=_0x84135a){_0xc07aba=_0x84135a;_0x22594a=0xc8;}else{_0x22594a=0xce;}_0x588a70[_0x7d89('0x14')](_0x22594a);return _0x588a70[_0x7d89('0x15')](_0x7d89('0x16'),_0x2ae675+'-'+_0xc07aba+'/'+_0x84135a)[_0x7d89('0xf')](_0x5cd7d6);}return null;};}function saveUpdates(_0x4a48bf){return function(_0x4fa7c4){if(_0x4fa7c4){return _0x4fa7c4[_0x7d89('0x17')](_0x4a48bf)[_0x7d89('0x18')](function(_0x1043ec){return _0x1043ec;});}return null;};}function removeEntity(_0x4e3315){return function(_0x93493c){if(_0x93493c){return _0x93493c['destroy']()[_0x7d89('0x18')](function(){_0x4e3315['status'](0xcc)[_0x7d89('0xe')]();});}};}function handleEntityNotFound(_0x5a37c2){return function(_0x1778fb){if(!_0x1778fb){_0x5a37c2[_0x7d89('0xd')](0x194);}return _0x1778fb;};}function handleError(_0x1111d7,_0x21c945){_0x21c945=_0x21c945||0x1f4;return function(_0x2a497b){logger[_0x7d89('0x19')](_0x2a497b['stack']);if(_0x2a497b[_0x7d89('0x1a')]){delete _0x2a497b[_0x7d89('0x1a')];}_0x1111d7[_0x7d89('0x14')](_0x21c945)[_0x7d89('0x1b')](_0x2a497b);};}exports[_0x7d89('0x1c')]=function(_0x358c00,_0x4feda4){var _0x137dfa={};var _0x11e6fd=_[_0x7d89('0x1d')](db[_0x7d89('0x1e')][_0x7d89('0x1f')],function(_0x1cf46f){return{'name':_0x1cf46f[_0x7d89('0x20')],'type':_0x1cf46f['type'][_0x7d89('0x21')]};});_0x137dfa=qs[_0x7d89('0x22')](_0x11e6fd,_0x358c00);return interaction[_0x7d89('0x23')](_0x7d89('0x24'),_0x358c00[_0x7d89('0x25')],_0x358c00[_0x7d89('0x26')],_0x137dfa,_0x11e6fd)[_0x7d89('0x18')](respondWithFilteredResult(_0x4feda4,_0x137dfa))['catch'](handleError(_0x4feda4,null));};exports['show']=function(_0x27c910,_0xe85176){var _0x2f3675={'raw':![],'where':{'id':_0x27c910['params']['id']}},_0x2c504c={};_0x2c504c[_0x7d89('0x27')]=_[_0x7d89('0x28')](db[_0x7d89('0x1e')][_0x7d89('0x1f')]);_0x2c504c[_0x7d89('0x25')]=_[_0x7d89('0x28')](_0x27c910[_0x7d89('0x25')]);_0x2c504c[_0x7d89('0x29')]=_[_0x7d89('0x2a')](_0x2c504c[_0x7d89('0x27')],_0x2c504c[_0x7d89('0x25')]);_0x2f3675[_0x7d89('0x2b')]=_[_0x7d89('0x2a')](_0x2c504c[_0x7d89('0x27')],qs['fields'](_0x27c910[_0x7d89('0x25')][_0x7d89('0x2c')]));_0x2f3675['attributes']=_0x2f3675[_0x7d89('0x2b')]['length']?_0x2f3675[_0x7d89('0x2b')]:_0x2c504c[_0x7d89('0x27')];if(_0x27c910['query'][_0x7d89('0x2d')]){_0x2f3675[_0x7d89('0x2e')]=[{'all':!![]}];}_0x2f3675=_[_0x7d89('0x2f')]({},_0x2f3675,_0x27c910[_0x7d89('0x30')]);return db['WhatsappInteraction'][_0x7d89('0x31')](_0x2f3675)[_0x7d89('0x18')](handleEntityNotFound(_0xe85176,null))['then'](respondWithResult(_0xe85176,null))[_0x7d89('0x32')](handleError(_0xe85176,null));};exports[_0x7d89('0x33')]=function(_0x17d135,_0x1ddd83){return db['WhatsappInteraction'][_0x7d89('0x33')](_0x17d135[_0x7d89('0x34')],{})['then'](respondWithResult(_0x1ddd83,0xc9))[_0x7d89('0x32')](handleError(_0x1ddd83,null));};exports[_0x7d89('0x17')]=function(_0x6c1fbe,_0xa1de7c){if(_0x6c1fbe[_0x7d89('0x34')]['id']){delete _0x6c1fbe['body']['id'];}return db[_0x7d89('0x1e')]['find']({'where':{'id':_0x6c1fbe['params']['id']}})[_0x7d89('0x18')](handleEntityNotFound(_0xa1de7c,null))[_0x7d89('0x18')](saveUpdates(_0x6c1fbe[_0x7d89('0x34')],null))[_0x7d89('0x18')](respondWithResult(_0xa1de7c,null))[_0x7d89('0x32')](handleError(_0xa1de7c,null));};exports['destroy']=function(_0x170fa5,_0x48a43e){return db[_0x7d89('0x1e')][_0x7d89('0x31')]({'where':{'id':_0x170fa5[_0x7d89('0x35')]['id']}})[_0x7d89('0x18')](handleEntityNotFound(_0x48a43e,null))['then'](removeEntity(_0x48a43e,null))[_0x7d89('0x32')](handleError(_0x48a43e,null));};exports[_0x7d89('0x36')]=function(_0x23c342,_0x4f7425){return db[_0x7d89('0x1e')][_0x7d89('0x36')]()[_0x7d89('0x18')](respondWithResult(_0x4f7425,null))[_0x7d89('0x32')](handleError(_0x4f7425,null));};exports[_0x7d89('0x37')]=function(_0x401ea1,_0x17c5de){return db[_0x7d89('0x38')][_0x7d89('0x31')]({'where':{'id':_0x401ea1['params']['id']}})[_0x7d89('0x18')](handleEntityNotFound(_0x17c5de,null))['then'](function(_0x3e0025){if(_0x3e0025){return _0x3e0025[_0x7d89('0x37')](_0x401ea1[_0x7d89('0x34')][_0x7d89('0x39')],_[_0x7d89('0x3a')](_0x401ea1['body'],[_0x7d89('0x39'),'id'])||{});}})[_0x7d89('0x18')](respondWithResult(_0x17c5de,null))['catch'](handleError(_0x17c5de,null));};exports[_0x7d89('0x3b')]=function(_0x55bee4,_0x38f19e){var _0x13752e={'raw':![],'where':{}};var _0x41a01e={};var _0x438ef7={'count':0x0,'rows':[]};return db[_0x7d89('0x1e')]['findOne']({'where':{'id':_0x55bee4['params']['id']}})[_0x7d89('0x18')](handleEntityNotFound(_0x38f19e,null))[_0x7d89('0x18')](function(_0x58ea04){if(_0x58ea04){_0x41a01e[_0x7d89('0x27')]=_[_0x7d89('0x28')](db[_0x7d89('0x38')][_0x7d89('0x1f')]);_0x41a01e[_0x7d89('0x25')]=_[_0x7d89('0x28')](_0x55bee4['query']);_0x41a01e['filters']=_[_0x7d89('0x2a')](_0x41a01e[_0x7d89('0x27')],_0x41a01e[_0x7d89('0x25')]);_0x13752e[_0x7d89('0x2b')]=_[_0x7d89('0x2a')](_0x41a01e['model'],qs[_0x7d89('0x2c')](_0x55bee4[_0x7d89('0x25')][_0x7d89('0x2c')]));_0x13752e[_0x7d89('0x2b')]=_0x13752e[_0x7d89('0x2b')][_0x7d89('0x3c')]?_0x13752e[_0x7d89('0x2b')]:_0x41a01e[_0x7d89('0x27')];if(!_0x55bee4[_0x7d89('0x25')][_0x7d89('0x3d')]('nolimit')){_0x13752e['limit']=qs[_0x7d89('0x12')](_0x55bee4['query'][_0x7d89('0x12')]);_0x13752e[_0x7d89('0x10')]=qs['offset'](_0x55bee4[_0x7d89('0x25')][_0x7d89('0x10')]);}_0x13752e[_0x7d89('0x3e')]=qs[_0x7d89('0x3f')](_0x55bee4[_0x7d89('0x25')][_0x7d89('0x3f')]);_0x13752e['where']=qs['filters'](_[_0x7d89('0x40')](_0x55bee4[_0x7d89('0x25')],_0x41a01e[_0x7d89('0x29')]));_0x13752e[_0x7d89('0x41')][_0x7d89('0x42')]=_0x58ea04['id'];if(_0x55bee4[_0x7d89('0x25')][_0x7d89('0x43')]){_0x13752e[_0x7d89('0x41')]=_['merge'](_0x13752e[_0x7d89('0x41')],{'$or':_[_0x7d89('0x1d')](_0x13752e[_0x7d89('0x2b')],function(_0x453804){var _0x329da3={};_0x329da3[_0x453804]={'$like':'%'+_0x55bee4[_0x7d89('0x25')]['filter']+'%'};return _0x329da3;})});}if(_0x55bee4[_0x7d89('0x25')][_0x7d89('0x44')]){var _0x18f01a=_0x55bee4['query'][_0x7d89('0x44')][_0x7d89('0x45')](',');var _0x625a94={};_0x625a94[_0x18f01a[0x0]]={'$gte':moment(_0x18f01a[0x1])[_0x7d89('0x46')]('YYYY-MM-DD\x20HH:mm:ss')};_0x13752e[_0x7d89('0x41')]=_[_0x7d89('0x2f')](_0x13752e[_0x7d89('0x41')],_0x625a94);}_0x13752e=_[_0x7d89('0x2f')]({},_0x13752e,_0x55bee4[_0x7d89('0x30')]);return db[_0x7d89('0x38')]['count']({'where':_0x13752e[_0x7d89('0x41')]})[_0x7d89('0x18')](function(_0x5e2a64){_0x438ef7[_0x7d89('0x13')]=_0x5e2a64;if(_0x55bee4[_0x7d89('0x25')][_0x7d89('0x2d')]){_0x13752e[_0x7d89('0x2e')]=[{'all':!![]}];}return db[_0x7d89('0x38')][_0x7d89('0x23')](_0x13752e);})[_0x7d89('0x18')](function(_0x48eedd){_0x438ef7['rows']=_0x48eedd;return _0x438ef7;});}})[_0x7d89('0x18')](respondWithFilteredResult(_0x38f19e,_0x13752e))[_0x7d89('0x32')](handleError(_0x38f19e,null));};exports[_0x7d89('0x47')]=function(_0x16f8dc,_0x3179c3){return db[_0x7d89('0x1e')][_0x7d89('0x31')]({'where':{'id':_0x16f8dc[_0x7d89('0x35')]['id']}})['then'](handleEntityNotFound(_0x3179c3,null))[_0x7d89('0x18')](function(_0x425146){if(_0x425146){return _0x425146['setTags'](_0x16f8dc[_0x7d89('0x34')][_0x7d89('0x39')],_[_0x7d89('0x3a')](_0x16f8dc[_0x7d89('0x34')],[_0x7d89('0x39'),'id'])||{})[_0x7d89('0x48')](function(){return db[_0x7d89('0x49')]['findAll']({'attributes':['id',_0x7d89('0x1a'),'color'],'where':{'id':_0x16f8dc[_0x7d89('0x34')][_0x7d89('0x39')]}});})[_0x7d89('0x18')](function(_0x2300d1){socket['emit'](_0x7d89('0x4a'),{'id':Number(_0x16f8dc[_0x7d89('0x35')]['id']),'tags':_0x2300d1||[]});return{'id':Number(_0x16f8dc['params']['id']),'tags':_0x2300d1||[]};});}})[_0x7d89('0x18')](respondWithResult(_0x3179c3,null))[_0x7d89('0x32')](handleError(_0x3179c3,null));};exports[_0x7d89('0x4b')]=function(_0x4780d1,_0x24749a){return db[_0x7d89('0x1e')][_0x7d89('0x31')]({'where':{'id':_0x4780d1[_0x7d89('0x35')]['id']}})[_0x7d89('0x18')](handleEntityNotFound(_0x24749a,null))[_0x7d89('0x18')](function(_0x587278){if(_0x587278){return _0x587278[_0x7d89('0x4b')](_0x4780d1[_0x7d89('0x25')][_0x7d89('0x39')]);}})['then'](respondWithStatusCode(_0x24749a,null))[_0x7d89('0x32')](handleError(_0x24749a,null));};exports['download']=function(_0x1c062e,_0x192c10){var _0x117131=moment()[_0x7d89('0x4c')]()[_0x7d89('0x4d')]();var _0x286037=path[_0x7d89('0x4e')](config[_0x7d89('0x4f')],'server',_0x7d89('0x50'),_0x7d89('0x51'));var _0x4e4714=path[_0x7d89('0x4e')](config[_0x7d89('0x4f')],_0x7d89('0x52'),_0x7d89('0x50'),_0x7d89('0x53'));var _0x3c819e=path[_0x7d89('0x4e')](_0x286037,_0x117131);var _0x3075c1=util[_0x7d89('0x46')](_0x7d89('0x54'),_0x1c062e[_0x7d89('0x35')]['id'],_0x117131);var _0x4604e6=path[_0x7d89('0x4e')](_0x286037,_0x3075c1);var _0x1a8f75=[];_0x1a8f75[_0x7d89('0x55')]({'model':db[_0x7d89('0x56')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1a8f75[_0x7d89('0x55')]({'model':db[_0x7d89('0x57')],'as':'Contact','attributes':['id',_0x7d89('0x58'),_0x7d89('0x59')],'raw':!![]});if(_0x1c062e[_0x7d89('0x25')]['attachments']){_0x1a8f75[_0x7d89('0x55')]({'model':db[_0x7d89('0x5a')],'as':'Attachment','raw':!![]});}var _0x1a87d1=[{'model':db[_0x7d89('0x38')],'as':'Messages','attributes':['id',_0x7d89('0x34'),'createdAt',_0x7d89('0x5b'),'secret','read'],'include':_0x1a8f75}];_0x1a87d1[_0x7d89('0x55')]({'model':db[_0x7d89('0x5c')],'as':_0x7d89('0x5d'),'attributes':['id',_0x7d89('0x1a')]});_0x1a87d1['push']({'model':db[_0x7d89('0x56')],'as':_0x7d89('0x5e'),'attributes':['id','fullname']});return db['WhatsappInteraction']['find']({'where':{'id':_0x1c062e[_0x7d89('0x35')]['id']},'include':_0x1a87d1})[_0x7d89('0x18')](handleEntityNotFound(_0x192c10,null))[_0x7d89('0x18')](function(_0x37af8d){if(_0x37af8d){var _0x1c8bf4=_0x37af8d[_0x7d89('0x5f')]({'plain':!![]});fs['mkdirSync'](_0x3c819e);var _0x2f4bde={'channel':_0x7d89('0x60'),'account':_0x1c8bf4[_0x7d89('0x5d')][_0x7d89('0x1a')],'agent':_0x1c8bf4['Owner']?_0x1c8bf4[_0x7d89('0x5e')][_0x7d89('0x61')]:_0x7d89('0x62'),'createdAt':moment(_0x1c8bf4[_0x7d89('0x63')])[_0x7d89('0x46')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1c8bf4[_0x7d89('0x64')]?moment(_0x1c8bf4[_0x7d89('0x65')])[_0x7d89('0x46')](_0x7d89('0x66'))[_0x7d89('0x4d')]():'','disposition':_0x1c8bf4['disposition'],'messages':_(_0x1c8bf4[_0x7d89('0x67')])[_0x7d89('0x43')]({'secret':![]})['map'](function(_0x33f3c2){if(_0x33f3c2['Attachment']){var _0x4f3c1c=path[_0x7d89('0x4e')](_0x4e4714,_0x33f3c2['Attachment'][_0x7d89('0x68')]);if(fs[_0x7d89('0x69')](_0x4f3c1c)){fs[_0x7d89('0x6a')](_0x4f3c1c)['pipe'](fs['createWriteStream'](path[_0x7d89('0x4e')](_0x3c819e,_0x33f3c2['Attachment'][_0x7d89('0x68')])));}}return{'date':moment(_0x33f3c2[_0x7d89('0x63')])[_0x7d89('0x46')](_0x7d89('0x66'))[_0x7d89('0x4d')](),'sender':_0x33f3c2['direction']===_0x7d89('0x6b')?_0x33f3c2[_0x7d89('0x56')]?_0x33f3c2[_0x7d89('0x56')]['fullname']:_0x7d89('0x6c'):_0x33f3c2['Contact'][_0x7d89('0x58')]+(_0x33f3c2[_0x7d89('0x6d')][_0x7d89('0x59')]?'\x20'+_0x33f3c2['Contact'][_0x7d89('0x59')]:''),'body':_0x33f3c2[_0x7d89('0x5a')]?_0x33f3c2['Attachment']['basename']:_0x33f3c2['body'],'direction':_0x33f3c2[_0x7d89('0x5b')]===_0x7d89('0x6b')?'A':'C','secret':_0x33f3c2[_0x7d89('0x6e')],'read':_0x33f3c2[_0x7d89('0x6f')],'attachment':_0x33f3c2[_0x7d89('0x5a')]};})[_0x7d89('0x70')]()};return ejs[_0x7d89('0x71')](path[_0x7d89('0x4e')](config['root'],_0x7d89('0x52'),_0x7d89('0x72'),_0x7d89('0x73')),{'interaction':_0x2f4bde})[_0x7d89('0x18')](function(_0x24dc8d){var _0x20dce5=path[_0x7d89('0x4e')](_0x3c819e,_0x7d89('0x74')+_0x1c8bf4['id']+'-'+_0x117131+_0x7d89('0x75'));var _0x129bb7={'path':_0x20dce5,'channel':_0x7d89('0x60'),'interactionId':_0x1c8bf4['id']};return pdf[_0x7d89('0x76')](_0x24dc8d,_0x129bb7);})['then'](function(){return new BPromise(function(_0x54ab4d,_0x3ec2fc){zipdir(_0x3c819e,{'saveTo':_0x4604e6},function(_0x2ae601,_0x3e95eb){if(_0x2ae601)return _0x3ec2fc(_0x2ae601);return _0x54ab4d(_0x3e95eb);});})[_0x7d89('0x18')](function(){return new BPromise(function(_0x4ac250,_0x55fb1a){rimraf(_0x3c819e,function(_0x548dcc){if(_0x548dcc)_0x55fb1a(_0x548dcc);return _0x4ac250();});});})[_0x7d89('0x18')](function(){return _0x192c10['download'](_0x4604e6,_0x3075c1,function(_0x4faa68){if(_0x4faa68){console['log'](_0x7d89('0x77'),_0x4faa68);}else{fs[_0x7d89('0x78')](_0x4604e6);}});});});}else{return _0x192c10[_0x7d89('0xd')](0xc8);}})[_0x7d89('0x32')](handleError(_0x192c10,null));}; \ No newline at end of file +var _0xeeb2=['Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','Owner','Whatsapp','N.A.','closed','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','json','offset','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','findAll','query','show','params','model','keys','WhatsappInteraction','attributes','intersection','fields','length','include','merge','options','find','create','catch','describe','addMessage','WhatsappMessage','body','omit','ids','getMessages','findOne','filters','hasOwnProperty','sort','pick','where','WhatsappInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','spread','Tag','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName'];(function(_0x571c47,_0x438835){var _0x3b2953=function(_0x5802b9){while(--_0x5802b9){_0x571c47['push'](_0x571c47['shift']());}};_0x3b2953(++_0x438835);}(_0xeeb2,0x117));var _0x2eeb=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0xeeb2[_0x1e2080];return _0x260111;};'use strict';var rimraf=require(_0x2eeb('0x0'));var zipdir=require(_0x2eeb('0x1'));var moment=require(_0x2eeb('0x2'));var BPromise=require('bluebird');var util=require(_0x2eeb('0x3'));var path=require(_0x2eeb('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2eeb('0x5'));var Redis=require(_0x2eeb('0x6'));var interaction=require(_0x2eeb('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x2eeb('0x8'));var logger=require('../../config/logger')('api');var config=require(_0x2eeb('0x9'));var db=require(_0x2eeb('0xa'))['db'];config['redis']=_[_0x2eeb('0xb')](config[_0x2eeb('0xc')],{'host':_0x2eeb('0xd'),'port':0x18eb});var socket=require(_0x2eeb('0xe'))(new Redis(config[_0x2eeb('0xc')]));require(_0x2eeb('0xf'))[_0x2eeb('0x10')](socket);function respondWithStatusCode(_0x2a8258,_0x1fbd95){_0x1fbd95=_0x1fbd95||0xcc;return function(_0x1a5ac3){if(_0x1a5ac3){return _0x2a8258[_0x2eeb('0x11')](_0x1fbd95);}return _0x2a8258['status'](_0x1fbd95)[_0x2eeb('0x12')]();};}function respondWithResult(_0x31453a,_0x41aac3){_0x41aac3=_0x41aac3||0xc8;return function(_0xd6bf32){if(_0xd6bf32){return _0x31453a[_0x2eeb('0x13')](_0x41aac3)[_0x2eeb('0x14')](_0xd6bf32);}};}function respondWithFilteredResult(_0x2d7c0c,_0x22f80e){return function(_0x1fa850){if(_0x1fa850){var _0x420722=typeof _0x22f80e[_0x2eeb('0x15')]==='undefined'&&typeof _0x22f80e['limit']==='undefined';var _0x3a6c73=_0x1fa850[_0x2eeb('0x16')];var _0x263b04=_0x420722?0x0:_0x22f80e['offset'];var _0x3a2634=_0x420722?_0x1fa850[_0x2eeb('0x16')]:_0x22f80e[_0x2eeb('0x15')]+_0x22f80e[_0x2eeb('0x17')];var _0x4110cf;if(_0x3a2634>=_0x3a6c73){_0x3a2634=_0x3a6c73;_0x4110cf=0xc8;}else{_0x4110cf=0xce;}_0x2d7c0c['status'](_0x4110cf);return _0x2d7c0c[_0x2eeb('0x18')](_0x2eeb('0x19'),_0x263b04+'-'+_0x3a2634+'/'+_0x3a6c73)['json'](_0x1fa850);}return null;};}function saveUpdates(_0x2d585e){return function(_0x391871){if(_0x391871){return _0x391871[_0x2eeb('0x1a')](_0x2d585e)[_0x2eeb('0x1b')](function(_0x59ce1f){return _0x59ce1f;});}return null;};}function removeEntity(_0x17165c){return function(_0x5b93e3){if(_0x5b93e3){return _0x5b93e3[_0x2eeb('0x1c')]()[_0x2eeb('0x1b')](function(){_0x17165c[_0x2eeb('0x13')](0xcc)[_0x2eeb('0x12')]();});}};}function handleEntityNotFound(_0xc4784e){return function(_0x1dc9f9){if(!_0x1dc9f9){_0xc4784e[_0x2eeb('0x11')](0x194);}return _0x1dc9f9;};}function handleError(_0x4784d9,_0x52180d){_0x52180d=_0x52180d||0x1f4;return function(_0x4bf9e6){logger[_0x2eeb('0x1d')](_0x4bf9e6[_0x2eeb('0x1e')]);if(_0x4bf9e6[_0x2eeb('0x1f')]){delete _0x4bf9e6[_0x2eeb('0x1f')];}_0x4784d9[_0x2eeb('0x13')](_0x52180d)[_0x2eeb('0x20')](_0x4bf9e6);};}exports[_0x2eeb('0x21')]=function(_0x346c45,_0x15a714){var _0x21f038={};var _0x13d9a1=_[_0x2eeb('0x22')](db['WhatsappInteraction'][_0x2eeb('0x23')],function(_0x415a37){return{'name':_0x415a37[_0x2eeb('0x24')],'type':_0x415a37['type'][_0x2eeb('0x25')]};});_0x21f038=qs[_0x2eeb('0x26')](_0x13d9a1,_0x346c45);return interaction[_0x2eeb('0x27')]('whatsapp',_0x346c45[_0x2eeb('0x28')],_0x346c45['user'],_0x21f038,_0x13d9a1)[_0x2eeb('0x1b')](respondWithFilteredResult(_0x15a714,_0x21f038))['catch'](handleError(_0x15a714,null));};exports[_0x2eeb('0x29')]=function(_0x230688,_0x50e78){var _0x43defa={'raw':![],'where':{'id':_0x230688[_0x2eeb('0x2a')]['id']}},_0x4f908c={};_0x4f908c[_0x2eeb('0x2b')]=_[_0x2eeb('0x2c')](db[_0x2eeb('0x2d')][_0x2eeb('0x23')]);_0x4f908c[_0x2eeb('0x28')]=_[_0x2eeb('0x2c')](_0x230688[_0x2eeb('0x28')]);_0x4f908c['filters']=_['intersection'](_0x4f908c['model'],_0x4f908c[_0x2eeb('0x28')]);_0x43defa[_0x2eeb('0x2e')]=_[_0x2eeb('0x2f')](_0x4f908c[_0x2eeb('0x2b')],qs[_0x2eeb('0x30')](_0x230688[_0x2eeb('0x28')][_0x2eeb('0x30')]));_0x43defa['attributes']=_0x43defa[_0x2eeb('0x2e')][_0x2eeb('0x31')]?_0x43defa[_0x2eeb('0x2e')]:_0x4f908c['model'];if(_0x230688[_0x2eeb('0x28')]['includeAll']){_0x43defa[_0x2eeb('0x32')]=[{'all':!![]}];}_0x43defa=_[_0x2eeb('0x33')]({},_0x43defa,_0x230688[_0x2eeb('0x34')]);return db[_0x2eeb('0x2d')][_0x2eeb('0x35')](_0x43defa)[_0x2eeb('0x1b')](handleEntityNotFound(_0x50e78,null))[_0x2eeb('0x1b')](respondWithResult(_0x50e78,null))['catch'](handleError(_0x50e78,null));};exports[_0x2eeb('0x36')]=function(_0x5e368b,_0x39c9ae){return db[_0x2eeb('0x2d')]['create'](_0x5e368b['body'],{})[_0x2eeb('0x1b')](respondWithResult(_0x39c9ae,0xc9))[_0x2eeb('0x37')](handleError(_0x39c9ae,null));};exports['update']=function(_0x32a4bb,_0x1fbffe){if(_0x32a4bb['body']['id']){delete _0x32a4bb['body']['id'];}return db['WhatsappInteraction'][_0x2eeb('0x35')]({'where':{'id':_0x32a4bb[_0x2eeb('0x2a')]['id']}})[_0x2eeb('0x1b')](handleEntityNotFound(_0x1fbffe,null))['then'](saveUpdates(_0x32a4bb['body'],null))[_0x2eeb('0x1b')](respondWithResult(_0x1fbffe,null))['catch'](handleError(_0x1fbffe,null));};exports['destroy']=function(_0x2de5af,_0x386632){return db['WhatsappInteraction'][_0x2eeb('0x35')]({'where':{'id':_0x2de5af['params']['id']}})['then'](handleEntityNotFound(_0x386632,null))[_0x2eeb('0x1b')](removeEntity(_0x386632,null))[_0x2eeb('0x37')](handleError(_0x386632,null));};exports[_0x2eeb('0x38')]=function(_0x5276b,_0x1a65b9){return db[_0x2eeb('0x2d')][_0x2eeb('0x38')]()[_0x2eeb('0x1b')](respondWithResult(_0x1a65b9,null))['catch'](handleError(_0x1a65b9,null));};exports[_0x2eeb('0x39')]=function(_0x4f8953,_0x8f10fa){return db[_0x2eeb('0x3a')][_0x2eeb('0x35')]({'where':{'id':_0x4f8953['params']['id']}})[_0x2eeb('0x1b')](handleEntityNotFound(_0x8f10fa,null))[_0x2eeb('0x1b')](function(_0x1043d4){if(_0x1043d4){return _0x1043d4[_0x2eeb('0x39')](_0x4f8953[_0x2eeb('0x3b')]['ids'],_[_0x2eeb('0x3c')](_0x4f8953[_0x2eeb('0x3b')],[_0x2eeb('0x3d'),'id'])||{});}})[_0x2eeb('0x1b')](respondWithResult(_0x8f10fa,null))[_0x2eeb('0x37')](handleError(_0x8f10fa,null));};exports[_0x2eeb('0x3e')]=function(_0x4e8f5b,_0x5d5530){var _0x7cc699={'raw':![],'where':{}};var _0x38dbc3={};var _0x561572={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x2eeb('0x3f')]({'where':{'id':_0x4e8f5b[_0x2eeb('0x2a')]['id']}})[_0x2eeb('0x1b')](handleEntityNotFound(_0x5d5530,null))['then'](function(_0x229dad){if(_0x229dad){_0x38dbc3[_0x2eeb('0x2b')]=_[_0x2eeb('0x2c')](db['WhatsappMessage'][_0x2eeb('0x23')]);_0x38dbc3['query']=_[_0x2eeb('0x2c')](_0x4e8f5b[_0x2eeb('0x28')]);_0x38dbc3[_0x2eeb('0x40')]=_[_0x2eeb('0x2f')](_0x38dbc3[_0x2eeb('0x2b')],_0x38dbc3[_0x2eeb('0x28')]);_0x7cc699[_0x2eeb('0x2e')]=_[_0x2eeb('0x2f')](_0x38dbc3[_0x2eeb('0x2b')],qs[_0x2eeb('0x30')](_0x4e8f5b[_0x2eeb('0x28')]['fields']));_0x7cc699['attributes']=_0x7cc699[_0x2eeb('0x2e')]['length']?_0x7cc699['attributes']:_0x38dbc3[_0x2eeb('0x2b')];if(!_0x4e8f5b[_0x2eeb('0x28')][_0x2eeb('0x41')]('nolimit')){_0x7cc699['limit']=qs[_0x2eeb('0x17')](_0x4e8f5b[_0x2eeb('0x28')][_0x2eeb('0x17')]);_0x7cc699[_0x2eeb('0x15')]=qs[_0x2eeb('0x15')](_0x4e8f5b['query'][_0x2eeb('0x15')]);}_0x7cc699['order']=qs[_0x2eeb('0x42')](_0x4e8f5b[_0x2eeb('0x28')][_0x2eeb('0x42')]);_0x7cc699['where']=qs[_0x2eeb('0x40')](_[_0x2eeb('0x43')](_0x4e8f5b[_0x2eeb('0x28')],_0x38dbc3[_0x2eeb('0x40')]));_0x7cc699[_0x2eeb('0x44')][_0x2eeb('0x45')]=_0x229dad['id'];if(_0x4e8f5b[_0x2eeb('0x28')][_0x2eeb('0x46')]){_0x7cc699[_0x2eeb('0x44')]=_[_0x2eeb('0x33')](_0x7cc699[_0x2eeb('0x44')],{'$or':_[_0x2eeb('0x22')](_0x7cc699[_0x2eeb('0x2e')],function(_0x24d17a){var _0x49b906={};_0x49b906[_0x24d17a]={'$like':'%'+_0x4e8f5b[_0x2eeb('0x28')][_0x2eeb('0x46')]+'%'};return _0x49b906;})});}if(_0x4e8f5b['query'][_0x2eeb('0x47')]){var _0x29cff1=_0x4e8f5b[_0x2eeb('0x28')][_0x2eeb('0x47')]['split'](',');var _0xfdb1b5={};_0xfdb1b5[_0x29cff1[0x0]]={'$gte':moment(_0x29cff1[0x1])[_0x2eeb('0x48')](_0x2eeb('0x49'))};_0x7cc699[_0x2eeb('0x44')]=_[_0x2eeb('0x33')](_0x7cc699[_0x2eeb('0x44')],_0xfdb1b5);}_0x7cc699=_[_0x2eeb('0x33')]({},_0x7cc699,_0x4e8f5b[_0x2eeb('0x34')]);return db[_0x2eeb('0x3a')][_0x2eeb('0x16')]({'where':_0x7cc699[_0x2eeb('0x44')]})['then'](function(_0x9daaa6){_0x561572[_0x2eeb('0x16')]=_0x9daaa6;if(_0x4e8f5b['query'][_0x2eeb('0x4a')]){_0x7cc699['include']=[{'all':!![]}];}return db[_0x2eeb('0x3a')][_0x2eeb('0x27')](_0x7cc699);})['then'](function(_0x13f336){_0x561572[_0x2eeb('0x4b')]=_0x13f336;return _0x561572;});}})[_0x2eeb('0x1b')](respondWithFilteredResult(_0x5d5530,_0x7cc699))[_0x2eeb('0x37')](handleError(_0x5d5530,null));};exports[_0x2eeb('0x4c')]=function(_0x3b2285,_0xc7eee6){return db[_0x2eeb('0x2d')]['find']({'where':{'id':_0x3b2285[_0x2eeb('0x2a')]['id']}})[_0x2eeb('0x1b')](handleEntityNotFound(_0xc7eee6,null))['then'](function(_0x391e5d){if(_0x391e5d){return _0x391e5d['setTags'](_0x3b2285[_0x2eeb('0x3b')][_0x2eeb('0x3d')],_['omit'](_0x3b2285[_0x2eeb('0x3b')],[_0x2eeb('0x3d'),'id'])||{})[_0x2eeb('0x4d')](function(){return db[_0x2eeb('0x4e')][_0x2eeb('0x27')]({'attributes':['id',_0x2eeb('0x1f'),'color'],'where':{'id':_0x3b2285[_0x2eeb('0x3b')][_0x2eeb('0x3d')]}});})[_0x2eeb('0x1b')](function(_0x255643){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x3b2285[_0x2eeb('0x2a')]['id']),'tags':_0x255643||[]});return{'id':Number(_0x3b2285[_0x2eeb('0x2a')]['id']),'tags':_0x255643||[]};});}})[_0x2eeb('0x1b')](respondWithResult(_0xc7eee6,null))['catch'](handleError(_0xc7eee6,null));};exports[_0x2eeb('0x4f')]=function(_0x70c0c,_0xb23128){return db['WhatsappInteraction'][_0x2eeb('0x35')]({'where':{'id':_0x70c0c[_0x2eeb('0x2a')]['id']}})[_0x2eeb('0x1b')](handleEntityNotFound(_0xb23128,null))[_0x2eeb('0x1b')](function(_0x1e5bd5){if(_0x1e5bd5){return _0x1e5bd5[_0x2eeb('0x4f')](_0x70c0c['query']['ids']);}})['then'](respondWithStatusCode(_0xb23128,null))[_0x2eeb('0x37')](handleError(_0xb23128,null));};exports[_0x2eeb('0x50')]=function(_0x5965d6,_0x21dd7e){var _0x41aa3b=moment()[_0x2eeb('0x51')]()[_0x2eeb('0x52')]();var _0x8315a1=path[_0x2eeb('0x53')](config[_0x2eeb('0x54')],_0x2eeb('0x55'),_0x2eeb('0x56'),_0x2eeb('0x57'));var _0x17ec2d=path[_0x2eeb('0x53')](config[_0x2eeb('0x54')],'server',_0x2eeb('0x56'),_0x2eeb('0x58'));var _0x32f8f9=path[_0x2eeb('0x53')](_0x8315a1,_0x41aa3b);var _0x312ce7=util['format'](_0x2eeb('0x59'),_0x5965d6['params']['id'],_0x41aa3b);var _0x2bdd27=path[_0x2eeb('0x53')](_0x8315a1,_0x312ce7);var _0x1ce072=[];_0x1ce072[_0x2eeb('0x5a')]({'model':db[_0x2eeb('0x5b')],'as':_0x2eeb('0x5b'),'attributes':['id',_0x2eeb('0x5c')],'raw':!![]});_0x1ce072[_0x2eeb('0x5a')]({'model':db['CmContact'],'as':_0x2eeb('0x5d'),'attributes':['id',_0x2eeb('0x5e'),_0x2eeb('0x5f')],'raw':!![]});if(_0x5965d6[_0x2eeb('0x28')]['attachments']){_0x1ce072[_0x2eeb('0x5a')]({'model':db[_0x2eeb('0x60')],'as':'Attachment','raw':!![]});}var _0x20d318=[{'model':db[_0x2eeb('0x3a')],'as':_0x2eeb('0x61'),'attributes':['id','body',_0x2eeb('0x62'),_0x2eeb('0x63'),_0x2eeb('0x64'),'read'],'include':_0x1ce072}];_0x20d318[_0x2eeb('0x5a')]({'model':db[_0x2eeb('0x65')],'as':_0x2eeb('0x66'),'attributes':['id',_0x2eeb('0x1f')]});_0x20d318[_0x2eeb('0x5a')]({'model':db[_0x2eeb('0x5b')],'as':_0x2eeb('0x67'),'attributes':['id',_0x2eeb('0x5c')]});return db[_0x2eeb('0x2d')][_0x2eeb('0x35')]({'where':{'id':_0x5965d6[_0x2eeb('0x2a')]['id']},'include':_0x20d318})[_0x2eeb('0x1b')](handleEntityNotFound(_0x21dd7e,null))[_0x2eeb('0x1b')](function(_0x236086){if(_0x236086){var _0x318387=_0x236086['get']({'plain':!![]});fs['mkdirSync'](_0x32f8f9);var _0x49dd3c={'channel':_0x2eeb('0x68'),'account':_0x318387[_0x2eeb('0x66')][_0x2eeb('0x1f')],'agent':_0x318387[_0x2eeb('0x67')]?_0x318387[_0x2eeb('0x67')][_0x2eeb('0x5c')]:_0x2eeb('0x69'),'createdAt':moment(_0x318387[_0x2eeb('0x62')])[_0x2eeb('0x48')](_0x2eeb('0x49'))[_0x2eeb('0x52')](),'closedAt':_0x318387[_0x2eeb('0x6a')]?moment(_0x318387['closedAt'])[_0x2eeb('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2eeb('0x52')]():'','disposition':_0x318387[_0x2eeb('0x6b')],'messages':_(_0x318387[_0x2eeb('0x61')])['filter']({'secret':![]})[_0x2eeb('0x22')](function(_0x1740ac){if(_0x1740ac[_0x2eeb('0x60')]){var _0x5f5d58=path[_0x2eeb('0x53')](_0x17ec2d,_0x1740ac[_0x2eeb('0x60')][_0x2eeb('0x6c')]);if(fs[_0x2eeb('0x6d')](_0x5f5d58)){fs[_0x2eeb('0x6e')](_0x5f5d58)[_0x2eeb('0x6f')](fs[_0x2eeb('0x70')](path[_0x2eeb('0x53')](_0x32f8f9,_0x1740ac[_0x2eeb('0x60')][_0x2eeb('0x6c')])));}}return{'date':moment(_0x1740ac[_0x2eeb('0x62')])[_0x2eeb('0x48')](_0x2eeb('0x49'))[_0x2eeb('0x52')](),'sender':_0x1740ac[_0x2eeb('0x63')]===_0x2eeb('0x71')?_0x1740ac['User']?_0x1740ac['User'][_0x2eeb('0x5c')]:_0x2eeb('0x72'):_0x1740ac[_0x2eeb('0x5d')][_0x2eeb('0x5e')]+(_0x1740ac[_0x2eeb('0x5d')][_0x2eeb('0x5f')]?'\x20'+_0x1740ac[_0x2eeb('0x5d')][_0x2eeb('0x5f')]:''),'body':_0x1740ac[_0x2eeb('0x60')]?_0x1740ac['Attachment'][_0x2eeb('0x6c')]:_0x1740ac[_0x2eeb('0x3b')],'direction':_0x1740ac['direction']===_0x2eeb('0x71')?'A':'C','secret':_0x1740ac[_0x2eeb('0x64')],'read':_0x1740ac[_0x2eeb('0x73')],'attachment':_0x1740ac[_0x2eeb('0x60')]};})[_0x2eeb('0x74')]()};return ejs[_0x2eeb('0x75')](path[_0x2eeb('0x53')](config['root'],_0x2eeb('0x55'),_0x2eeb('0x76'),_0x2eeb('0x77')),{'interaction':_0x49dd3c})['then'](function(_0x4d505f){var _0x5ae9ac=path[_0x2eeb('0x53')](_0x32f8f9,_0x2eeb('0x78')+_0x318387['id']+'-'+_0x41aa3b+_0x2eeb('0x79'));var _0x53d4aa={'path':_0x5ae9ac,'channel':'Whatsapp','interactionId':_0x318387['id']};return pdf['createPdfFromHTML'](_0x4d505f,_0x53d4aa);})[_0x2eeb('0x1b')](function(){return new BPromise(function(_0x319dee,_0x2699fd){zipdir(_0x32f8f9,{'saveTo':_0x2bdd27},function(_0x5798a5,_0x25bbea){if(_0x5798a5)return _0x2699fd(_0x5798a5);return _0x319dee(_0x25bbea);});})[_0x2eeb('0x1b')](function(){return new BPromise(function(_0x20db43,_0x59c550){rimraf(_0x32f8f9,function(_0x4a08d4){if(_0x4a08d4)_0x59c550(_0x4a08d4);return _0x20db43();});});})['then'](function(){return _0x21dd7e[_0x2eeb('0x50')](_0x2bdd27,_0x312ce7,function(_0x570598){if(_0x570598){console[_0x2eeb('0x7a')](_0x2eeb('0x7b'),_0x570598);}else{fs[_0x2eeb('0x7c')](_0x2bdd27);}});});});}else{return _0x21dd7e[_0x2eeb('0x11')](0xc8);}})[_0x2eeb('0x37')](handleError(_0x21dd7e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index f698738..38e90b8 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 _0x1a83=['map','findAll','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x8be0ba,_0x55202e){var _0x6c4076=function(_0x2e4659){while(--_0x2e4659){_0x8be0ba['push'](_0x8be0ba['shift']());}};_0x6c4076(++_0x55202e);}(_0x1a83,0x1c0));var _0x31a8=function(_0x460b5f,_0xbd2fb3){_0x460b5f=_0x460b5f-0x0;var _0x11f109=_0x1a83[_0x460b5f];return _0x11f109;};'use strict';var EventEmitter=require(_0x31a8('0x0'));var WhatsappInteraction=require(_0x31a8('0x1'))['db'][_0x31a8('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x31a8('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x31a8('0x4'),'afterUpdate':_0x31a8('0x5'),'afterDestroy':_0x31a8('0x6')};function emitEvent(_0x26aa71){return function(_0x4f18c3,_0x5e07ea,_0xde01e8){_0x4f18c3[_0x31a8('0x7')]({'attributes':['id'],'raw':!![]})[_0x31a8('0x8')](function(_0x2c4b45){_0x4f18c3[_0x31a8('0x9')](_0x31a8('0xa'),_0x2c4b45[_0x31a8('0xb')](function(_0x12e5c8){return{'id':_0x12e5c8['id']};}));return WhatsappMessage[_0x31a8('0xc')]({'where':{'WhatsappInteractionId':_0x4f18c3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x31a8('0x8')](function(_0x4f1881){_0x4f18c3[_0x31a8('0x9')]('unreadMessages',_0x4f1881['length']);WhatsappInteractionEvents[_0x31a8('0xd')](_0x26aa71+':'+_0x4f18c3['id'],_0x4f18c3);WhatsappInteractionEvents[_0x31a8('0xd')](_0x26aa71,_0x4f18c3);_0xde01e8(null);})['catch'](_0xde01e8(null));};}for(var e in events){if(events[_0x31a8('0xe')](e)){var event=events[e];WhatsappInteraction[_0x31a8('0xf')](e,emitEvent(event));}}module[_0x31a8('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x342b=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','getUsers','then','setDataValue'];(function(_0x23f8c8,_0xb536b9){var _0x3dc718=function(_0x25d719){while(--_0x25d719){_0x23f8c8['push'](_0x23f8c8['shift']());}};_0x3dc718(++_0xb536b9);}(_0x342b,0xbc));var _0xb342=function(_0x2c1e2d,_0x2b32f8){_0x2c1e2d=_0x2c1e2d-0x0;var _0x5e699e=_0x342b[_0x2c1e2d];return _0x5e699e;};'use strict';var EventEmitter=require(_0xb342('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xb342('0x1')];var WhatsappMessage=require(_0xb342('0x2'))['db'][_0xb342('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b1604){return function(_0x1ae838,_0x617dea,_0x28bca8){_0x1ae838[_0xb342('0x4')]({'attributes':['id'],'raw':!![]})[_0xb342('0x5')](function(_0x30106f){_0x1ae838[_0xb342('0x6')]('Users',_0x30106f['map'](function(_0x320a07){return{'id':_0x320a07['id']};}));return WhatsappMessage[_0xb342('0x7')]({'where':{'WhatsappInteractionId':_0x1ae838['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x578e36){_0x1ae838[_0xb342('0x6')](_0xb342('0x8'),_0x578e36[_0xb342('0x9')]);WhatsappInteractionEvents[_0xb342('0xa')](_0x1b1604+':'+_0x1ae838['id'],_0x1ae838);WhatsappInteractionEvents[_0xb342('0xa')](_0x1b1604,_0x1ae838);_0x28bca8(null);})[_0xb342('0xb')](_0x28bca8(null));};}for(var e in events){if(events[_0xb342('0xc')](e)){var event=events[e];WhatsappInteraction[_0xb342('0xd')](e,emitEvent(event));}}module[_0xb342('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 da90a27..18b5b9c 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 _0xb046=['moment','bluebird','request-promise','path','exports','define','WhatsappInteraction','changed','closed','lodash','util','../../config/logger'];(function(_0x268ad9,_0x12130e){var _0x20c687=function(_0x22827e){while(--_0x22827e){_0x268ad9['push'](_0x268ad9['shift']());}};_0x20c687(++_0x12130e);}(_0xb046,0x1a1));var _0x6b04=function(_0x388b47,_0x5cdac5){_0x388b47=_0x388b47-0x0;var _0x4859df=_0xb046[_0x388b47];return _0x4859df;};'use strict';var _=require(_0x6b04('0x0'));var util=require(_0x6b04('0x1'));var logger=require(_0x6b04('0x2'))('api');var moment=require(_0x6b04('0x3'));var BPromise=require(_0x6b04('0x4'));var rp=require(_0x6b04('0x5'));var fs=require('fs');var path=require(_0x6b04('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x6b04('0x7')]=function(_0x4f97cf,_0x389dc0){return _0x4f97cf[_0x6b04('0x8')](_0x6b04('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x414a80,_0xef9069,_0x1693aa){if(_0x414a80[_0x6b04('0xa')](_0x6b04('0xb'))){_0x414a80['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1693aa(null,_0x414a80);}}});}; \ No newline at end of file +var _0x205d=['changed','closed','closedAt','format','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0x2170cf,_0x20b2e9){var _0x3313d0=function(_0x9cb692){while(--_0x9cb692){_0x2170cf['push'](_0x2170cf['shift']());}};_0x3313d0(++_0x20b2e9);}(_0x205d,0x1f1));var _0xd205=function(_0x4f7a97,_0x14f986){_0x4f7a97=_0x4f7a97-0x0;var _0x2d97cb=_0x205d[_0x4f7a97];return _0x2d97cb;};'use strict';var _=require('lodash');var util=require(_0xd205('0x0'));var logger=require(_0xd205('0x1'))(_0xd205('0x2'));var moment=require('moment');var BPromise=require(_0xd205('0x3'));var rp=require(_0xd205('0x4'));var fs=require('fs');var path=require(_0xd205('0x5'));var rimraf=require(_0xd205('0x6'));var config=require(_0xd205('0x7'));var attributes=require(_0xd205('0x8'));module[_0xd205('0x9')]=function(_0x3c5535,_0x1387d1){return _0x3c5535[_0xd205('0xa')](_0xd205('0xb'),attributes,{'tableName':_0xd205('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31f437,_0xa373da,_0x8b19fe){if(_0x31f437[_0xd205('0xd')](_0xd205('0xe'))){_0x31f437[_0xd205('0xf')]=moment()[_0xd205('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x8b19fe(null,_0x31f437);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index af8160e..83b7a4e 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 _0x00ce=['defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToWhatsappInteraction','addTags','ids','AddTags','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x30c997,_0x1f4e7a){var _0x5c31fb=function(_0x45f316){while(--_0x45f316){_0x30c997['push'](_0x30c997['shift']());}};_0x5c31fb(++_0x1f4e7a);}(_0x00ce,0x72));var _0xe00c=function(_0x37166f,_0x201e4b){_0x37166f=_0x37166f-0x0;var _0x4167e1=_0x00ce[_0x37166f];return _0x4167e1;};'use strict';var _=require(_0xe00c('0x0'));var util=require(_0xe00c('0x1'));var moment=require('moment');var BPromise=require(_0xe00c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe00c('0x3'))['db'];var utils=require(_0xe00c('0x4'));var logger=require(_0xe00c('0x5'))(_0xe00c('0x6'));var config=require(_0xe00c('0x7'));var jayson=require(_0xe00c('0x8'));var client=jayson[_0xe00c('0x9')][_0xe00c('0xa')]({'port':0x232a});config[_0xe00c('0xb')]=_[_0xe00c('0xc')](config[_0xe00c('0xb')],{'host':_0xe00c('0xd'),'port':0x18eb});var socket=require(_0xe00c('0xe'))(new Redis(config['redis']));require(_0xe00c('0xf'))[_0xe00c('0x10')](socket);function respondWithRpcPromise(_0x310881,_0x15415a,_0x3fe8d3){return new BPromise(function(_0x2e34d5,_0x5742dd){return client[_0xe00c('0x11')](_0x310881,_0x3fe8d3)[_0xe00c('0x12')](function(_0x5ac4a6){logger[_0xe00c('0x13')](_0xe00c('0x14'),_0x15415a,_0xe00c('0x15'));logger[_0xe00c('0x16')](_0xe00c('0x17'),_0x15415a,_0xe00c('0x15'),JSON['stringify'](_0x5ac4a6));if(_0x5ac4a6[_0xe00c('0x18')]){if(_0x5ac4a6[_0xe00c('0x18')][_0xe00c('0x19')]===0x1f4){logger[_0xe00c('0x18')](_0xe00c('0x14'),_0x15415a,_0x5ac4a6[_0xe00c('0x18')][_0xe00c('0x1a')]);return _0x5742dd(_0x5ac4a6[_0xe00c('0x18')][_0xe00c('0x1a')]);}logger['error'](_0xe00c('0x14'),_0x15415a,_0x5ac4a6['error'][_0xe00c('0x1a')]);return _0x2e34d5(_0x5ac4a6['error'][_0xe00c('0x1a')]);}else{logger[_0xe00c('0x13')](_0xe00c('0x14'),_0x15415a,'request\x20sent');_0x2e34d5(_0x5ac4a6['result'][_0xe00c('0x1a')]);}})[_0xe00c('0x1b')](function(_0x52d959){logger[_0xe00c('0x18')](_0xe00c('0x14'),_0x15415a,_0x52d959);_0x5742dd(_0x52d959);});});}exports[_0xe00c('0x1c')]=function(_0x27d9ae){var _0x1bcd6f=this;return new Promise(function(_0x131289,_0x15e5c8){return db[_0xe00c('0x1d')][_0xe00c('0x1e')](_0x27d9ae[_0xe00c('0x1f')],{'raw':_0x27d9ae[_0xe00c('0x20')]?_0x27d9ae[_0xe00c('0x20')][_0xe00c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27d9ae[_0xe00c('0x20')]?_0x27d9ae[_0xe00c('0x20')][_0xe00c('0x22')]||null:null,'attributes':_0x27d9ae[_0xe00c('0x20')]?_0x27d9ae[_0xe00c('0x20')][_0xe00c('0x23')]||null:null,'limit':_0x27d9ae[_0xe00c('0x20')]?_0x27d9ae[_0xe00c('0x20')][_0xe00c('0x24')]||null:null})[_0xe00c('0x12')](function(_0x2a65c2){logger[_0xe00c('0x13')](_0xe00c('0x1c'),_0x27d9ae);logger[_0xe00c('0x16')](_0xe00c('0x1c'),_0x27d9ae,JSON[_0xe00c('0x25')](_0x2a65c2));_0x131289(_0x2a65c2);})['catch'](function(_0x4964d4){logger['error'](_0xe00c('0x1c'),_0x4964d4[_0xe00c('0x1a')],_0x27d9ae);_0x15e5c8(_0x1bcd6f[_0xe00c('0x18')](0x1f4,_0x4964d4[_0xe00c('0x1a')]));});});};exports[_0xe00c('0x26')]=function(_0x35df91){return new Promise(function(_0x197b6c,_0x3ac600){return db['WhatsappInteraction']['find']({'where':_0x35df91['options']?_0x35df91[_0xe00c('0x20')]['where']||null:null})['then'](function(_0x1e81fe){if(_0x1e81fe){return _0x1e81fe[_0xe00c('0x27')](_0x35df91[_0xe00c('0x1f')][_0xe00c('0x28')],_['omit'](_0x35df91[_0xe00c('0x1f')],[_0xe00c('0x28'),'id'])||{});}})['spread'](function(_0x8117d3){logger['info'](_0xe00c('0x29'),_0x35df91);logger[_0xe00c('0x16')](_0xe00c('0x29'),_0x35df91,JSON[_0xe00c('0x25')](_0x8117d3));_0x197b6c(_0x8117d3);})['catch'](function(_0x1841dd){logger[_0xe00c('0x18')](_0xe00c('0x29'),_0x1841dd[_0xe00c('0x1a')],_0x35df91);_0x3ac600(_this[_0xe00c('0x18')](0x1f4,_0x1841dd[_0xe00c('0x1a')]));});});}; \ No newline at end of file +var _0xaef2=['ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','attributes','find','where','addTags'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0xaef2,0x14c));var _0x2aef=function(_0xba21d1,_0x5ea074){_0xba21d1=_0xba21d1-0x0;var _0xad42b6=_0xaef2[_0xba21d1];return _0xad42b6;};'use strict';var _=require(_0x2aef('0x0'));var util=require(_0x2aef('0x1'));var moment=require(_0x2aef('0x2'));var BPromise=require(_0x2aef('0x3'));var rs=require(_0x2aef('0x4'));var fs=require('fs');var Redis=require(_0x2aef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2aef('0x6'));var logger=require('../../config/logger')(_0x2aef('0x7'));var config=require(_0x2aef('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2aef('0x9')]({'port':0x232a});config[_0x2aef('0xa')]=_[_0x2aef('0xb')](config[_0x2aef('0xa')],{'host':_0x2aef('0xc'),'port':0x18eb});var socket=require(_0x2aef('0xd'))(new Redis(config[_0x2aef('0xa')]));require(_0x2aef('0xe'))[_0x2aef('0xf')](socket);function respondWithRpcPromise(_0x3158fe,_0x299738,_0x312841){return new BPromise(function(_0x4c2708,_0x8960f9){return client[_0x2aef('0x10')](_0x3158fe,_0x312841)[_0x2aef('0x11')](function(_0xad2580){logger[_0x2aef('0x12')](_0x2aef('0x13'),_0x299738,'request\x20sent');logger[_0x2aef('0x14')](_0x2aef('0x15'),_0x299738,'request\x20sent',JSON[_0x2aef('0x16')](_0xad2580));if(_0xad2580['error']){if(_0xad2580[_0x2aef('0x17')][_0x2aef('0x18')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x299738,_0xad2580['error'][_0x2aef('0x19')]);return _0x8960f9(_0xad2580['error'][_0x2aef('0x19')]);}logger[_0x2aef('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x299738,_0xad2580[_0x2aef('0x17')]['message']);return _0x4c2708(_0xad2580['error'][_0x2aef('0x19')]);}else{logger[_0x2aef('0x12')](_0x2aef('0x13'),_0x299738,'request\x20sent');_0x4c2708(_0xad2580[_0x2aef('0x1a')][_0x2aef('0x19')]);}})[_0x2aef('0x1b')](function(_0x29bd77){logger[_0x2aef('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x299738,_0x29bd77);_0x8960f9(_0x29bd77);});});}exports[_0x2aef('0x1c')]=function(_0xa35ead){var _0x4b7aef=this;return new Promise(function(_0x2d6e54,_0x5a1f03){return db[_0x2aef('0x1d')][_0x2aef('0x1e')](_0xa35ead[_0x2aef('0x1f')],{'raw':_0xa35ead['options']?_0xa35ead[_0x2aef('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa35ead[_0x2aef('0x20')]?_0xa35ead[_0x2aef('0x20')]['where']||null:null,'attributes':_0xa35ead['options']?_0xa35ead[_0x2aef('0x20')][_0x2aef('0x21')]||null:null,'limit':_0xa35ead['options']?_0xa35ead[_0x2aef('0x20')]['limit']||null:null})[_0x2aef('0x11')](function(_0x24da54){logger[_0x2aef('0x12')](_0x2aef('0x1c'),_0xa35ead);logger[_0x2aef('0x14')](_0x2aef('0x1c'),_0xa35ead,JSON[_0x2aef('0x16')](_0x24da54));_0x2d6e54(_0x24da54);})['catch'](function(_0x2eb0a1){logger[_0x2aef('0x17')](_0x2aef('0x1c'),_0x2eb0a1[_0x2aef('0x19')],_0xa35ead);_0x5a1f03(_0x4b7aef['error'](0x1f4,_0x2eb0a1[_0x2aef('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x41a0ad){return new Promise(function(_0x3e7f26,_0x384605){return db[_0x2aef('0x1d')][_0x2aef('0x22')]({'where':_0x41a0ad[_0x2aef('0x20')]?_0x41a0ad[_0x2aef('0x20')][_0x2aef('0x23')]||null:null})[_0x2aef('0x11')](function(_0x4a377e){if(_0x4a377e){return _0x4a377e[_0x2aef('0x24')](_0x41a0ad[_0x2aef('0x1f')][_0x2aef('0x25')],_[_0x2aef('0x26')](_0x41a0ad[_0x2aef('0x1f')],['ids','id'])||{});}})[_0x2aef('0x27')](function(_0x833e6d){logger[_0x2aef('0x12')](_0x2aef('0x28'),_0x41a0ad);logger[_0x2aef('0x14')](_0x2aef('0x28'),_0x41a0ad,JSON[_0x2aef('0x16')](_0x833e6d));_0x3e7f26(_0x833e6d);})[_0x2aef('0x1b')](function(_0x1f3230){logger[_0x2aef('0x17')](_0x2aef('0x28'),_0x1f3230[_0x2aef('0x19')],_0x41a0ad);_0x384605(_this[_0x2aef('0x17')](0x1f4,_0x1f3230[_0x2aef('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d71f50b..755cbcb 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 _0xff85=['remove','update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xff85,0x1db));var _0x5ff8=function(_0x58eab5,_0x4a82dd){_0x58eab5=_0x58eab5-0x0;var _0x3cae2b=_0xff85[_0x58eab5];return _0x3cae2b;};'use strict';var WhatsappInteractionEvents=require(_0x5ff8('0x0'));var events=[_0x5ff8('0x1'),_0x5ff8('0x2'),_0x5ff8('0x3')];function createListener(_0x1f902c,_0x52f1e4){return function(_0x121124){_0x52f1e4[_0x5ff8('0x4')](_0x1f902c,_0x121124);};}function removeListener(_0x10bbaf,_0x187e6f){return function(){WhatsappInteractionEvents[_0x5ff8('0x5')](_0x10bbaf,_0x187e6f);};}exports[_0x5ff8('0x6')]=function(_0x24b2e7){for(var _0x176d66=0x0,_0x503d5c=events[_0x5ff8('0x7')];_0x176d66<_0x503d5c;_0x176d66++){var _0x4c7942=events[_0x176d66];var _0x46962d=createListener(_0x5ff8('0x8')+_0x4c7942,_0x24b2e7);WhatsappInteractionEvents['on'](_0x4c7942,_0x46962d);}}; \ No newline at end of file +var _0xa364=['whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3d85b3,_0xdf9751){var _0x1e720f=function(_0x199e1c){while(--_0x199e1c){_0x3d85b3['push'](_0x3d85b3['shift']());}};_0x1e720f(++_0xdf9751);}(_0xa364,0x9a));var _0x4a36=function(_0x21ef7d,_0x525e75){_0x21ef7d=_0x21ef7d-0x0;var _0xdf120=_0xa364[_0x21ef7d];return _0xdf120;};'use strict';var WhatsappInteractionEvents=require(_0x4a36('0x0'));var events=[_0x4a36('0x1'),_0x4a36('0x2'),_0x4a36('0x3')];function createListener(_0x314d85,_0x5bd121){return function(_0x4d295f){_0x5bd121[_0x4a36('0x4')](_0x314d85,_0x4d295f);};}function removeListener(_0x5972cf,_0x15b316){return function(){WhatsappInteractionEvents[_0x4a36('0x5')](_0x5972cf,_0x15b316);};}exports[_0x4a36('0x6')]=function(_0x12c66c){for(var _0x12a005=0x0,_0xc536e1=events[_0x4a36('0x7')];_0x12a005<_0xc536e1;_0x12a005++){var _0x1e3e67=events[_0x12a005];var _0x234994=createListener(_0x4a36('0x8')+_0x1e3e67,_0x12c66c);WhatsappInteractionEvents['on'](_0x1e3e67,_0x234994);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 792b5c3..976b19a 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 _0xb054=['show','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb054,0x67));var _0x4b05=function(_0x1877d0,_0x4fc2ec){_0x1877d0=_0x1877d0-0x0;var _0x5d5778=_0xb054[_0x1877d0];return _0x5d5778;};'use strict';var multer=require(_0x4b05('0x0'));var util=require(_0x4b05('0x1'));var path=require(_0x4b05('0x2'));var timeout=require(_0x4b05('0x3'));var express=require(_0x4b05('0x4'));var router=express[_0x4b05('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4b05('0x6'));var config=require(_0x4b05('0x7'));var controller=require('./whatsappMessage.controller');router[_0x4b05('0x8')]('/',auth[_0x4b05('0x9')](),controller[_0x4b05('0xa')]);router[_0x4b05('0x8')]('/describe',auth[_0x4b05('0x9')](),controller[_0x4b05('0xb')]);router[_0x4b05('0x8')](_0x4b05('0xc'),auth[_0x4b05('0x9')](),controller[_0x4b05('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x4b05('0xe')](_0x4b05('0xf'),_0x4b05('0x10')),controller[_0x4b05('0x11')]);router[_0x4b05('0x12')](_0x4b05('0x13'),controller[_0x4b05('0x14')]);router[_0x4b05('0x15')](_0x4b05('0xc'),auth[_0x4b05('0x9')](),controller[_0x4b05('0x16')]);router[_0x4b05('0x15')](_0x4b05('0x17'),auth[_0x4b05('0x9')](),controller[_0x4b05('0x18')]);router[_0x4b05('0x15')](_0x4b05('0x19'),auth[_0x4b05('0x9')](),controller[_0x4b05('0x1a')]);router[_0x4b05('0x1b')](_0x4b05('0xc'),auth[_0x4b05('0x9')](),controller[_0x4b05('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x3744=['/:id','show','post','tracked','whatsapp','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3744,0x10a));var _0x4374=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3744[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x4374('0x0'));var util=require(_0x4374('0x1'));var path=require(_0x4374('0x2'));var timeout=require(_0x4374('0x3'));var express=require(_0x4374('0x4'));var router=express[_0x4374('0x5')]();var fs_extra=require(_0x4374('0x6'));var auth=require(_0x4374('0x7'));var interaction=require(_0x4374('0x8'));var config=require(_0x4374('0x9'));var controller=require('./whatsappMessage.controller');router[_0x4374('0xa')]('/',auth['isAuthenticated'](),controller[_0x4374('0xb')]);router[_0x4374('0xa')]('/describe',auth[_0x4374('0xc')](),controller[_0x4374('0xd')]);router[_0x4374('0xa')](_0x4374('0xe'),auth[_0x4374('0xc')](),controller[_0x4374('0xf')]);router[_0x4374('0x10')]('/',auth[_0x4374('0xc')](),interaction[_0x4374('0x11')](_0x4374('0x12'),'whatsappmessage:create'),controller[_0x4374('0x13')]);router[_0x4374('0x10')](_0x4374('0x14'),controller[_0x4374('0x15')]);router[_0x4374('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x4374('0x17')]);router[_0x4374('0x16')](_0x4374('0x18'),auth[_0x4374('0xc')](),controller[_0x4374('0x19')]);router['put'](_0x4374('0x1a'),auth[_0x4374('0xc')](),controller['reject']);router[_0x4374('0x1b')](_0x4374('0xe'),auth[_0x4374('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 5b6801f..a050b13 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 _0x34ab=['out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x111d76,_0x483b46){var _0x531fff=function(_0x46ffe0){while(--_0x46ffe0){_0x111d76['push'](_0x111d76['shift']());}};_0x531fff(++_0x483b46);}(_0x34ab,0xf1));var _0xb34a=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0x34ab[_0x215dc8];return _0x583ea3;};'use strict';var Sequelize=require(_0xb34a('0x0'));module[_0xb34a('0x1')]={'body':{'type':Sequelize[_0xb34a('0x2')](_0xb34a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb34a('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xb34a('0x5')](0xbe)},'phone':{'type':Sequelize[_0xb34a('0x5')]},'readAt':{'type':Sequelize[_0xb34a('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb34a('0x5')]},'providerResponse':{'type':Sequelize[_0xb34a('0x2')]}}; \ No newline at end of file +var _0xda9d=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x4ae70a,_0x394fec){var _0x4caed5=function(_0xf40532){while(--_0xf40532){_0x4ae70a['push'](_0x4ae70a['shift']());}};_0x4caed5(++_0x394fec);}(_0xda9d,0x85));var _0xdda9=function(_0xc753c8,_0x5627ff){_0xc753c8=_0xc753c8-0x0;var _0xd02f5c=_0xda9d[_0xc753c8];return _0xd02f5c;};'use strict';var Sequelize=require('sequelize');module[_0xdda9('0x0')]={'body':{'type':Sequelize[_0xdda9('0x1')](_0xdda9('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdda9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdda9('0x4')]('in','out'),'defaultValue':_0xdda9('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xdda9('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xdda9('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index d74510c..8fc384c 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 _0x2bc0=['localhost','socket.io-emitter','redis','./whatsappMessage.socket','register','jayson/promise','http','whatsapp-interactions','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','status','offset','limit','undefined','count','Content-Range','destroy','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','describe','accept','whatsapp','reject','UserId','user','agent','get','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','params','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x2fd135,_0x319183){var _0x8ab5da=function(_0x149953){while(--_0x149953){_0x2fd135['push'](_0x2fd135['shift']());}};_0x8ab5da(++_0x319183);}(_0x2bc0,0x6a));var _0x02bc=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2bc0[_0x502c7d];return _0x30b7ed;};'use strict';var util=require('util');var _=require('lodash');var Redis=require(_0x02bc('0x0'));var interactionService=require('../../components/interaction/service');var qs=require(_0x02bc('0x1'));var logger=require(_0x02bc('0x2'))('api');var config=require(_0x02bc('0x3'));var db=require(_0x02bc('0x4'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x02bc('0x5'),'port':0x18eb});var socket=require(_0x02bc('0x6'))(new Redis(config[_0x02bc('0x7')]));require(_0x02bc('0x8'))[_0x02bc('0x9')](socket);var jayson=require(_0x02bc('0xa'));var client=jayson['client'][_0x02bc('0xb')]({'port':0x232c});var client9002=jayson['client'][_0x02bc('0xb')]({'port':0x232a});var interaction_log=require(_0x02bc('0x2'))(_0x02bc('0xc'));function respondWithRpcPromise(_0x2e39b9,_0x2fdbaa,_0x2027c7,_0x2e2397){return new Promise(function(_0x226eb5,_0x1727c7){var _0x1f2122=_0x2e2397||client;return _0x1f2122[_0x02bc('0xd')](_0x2e39b9,_0x2027c7)[_0x02bc('0xe')](function(_0x1b952c){logger[_0x02bc('0xf')](_0x02bc('0x10'),_0x2fdbaa,_0x02bc('0x11'));logger[_0x02bc('0x12')](_0x02bc('0x13'),_0x2fdbaa,_0x02bc('0x11'),JSON['stringify'](_0x1b952c));if(_0x1b952c[_0x02bc('0x14')]){if(_0x1b952c[_0x02bc('0x14')][_0x02bc('0x15')]===0x1f4){logger[_0x02bc('0x14')](_0x02bc('0x10'),_0x2fdbaa,_0x1b952c['error'][_0x02bc('0x16')]);return _0x1727c7(_0x1b952c[_0x02bc('0x14')][_0x02bc('0x16')]);}logger['error'](_0x02bc('0x10'),_0x2fdbaa,_0x1b952c[_0x02bc('0x14')][_0x02bc('0x16')]);return _0x226eb5(_0x1b952c['error'][_0x02bc('0x16')]);}else{logger[_0x02bc('0xf')](_0x02bc('0x10'),_0x2fdbaa,'request\x20sent');_0x226eb5(_0x1b952c[_0x02bc('0x17')][_0x02bc('0x16')]);}})['catch'](function(_0x5b034c){logger[_0x02bc('0x14')](_0x02bc('0x10'),_0x2fdbaa,_0x5b034c);_0x1727c7(_0x5b034c);});});}function respondWithResult(_0x3c2540,_0xbce8ba){_0xbce8ba=_0xbce8ba||0xc8;return function(_0xde4c74){if(_0xde4c74){return _0x3c2540[_0x02bc('0x18')](_0xbce8ba)['json'](_0xde4c74);}};}function respondWithFilteredResult(_0x1e1807,_0x5786c1){return function(_0x8d62f9){if(_0x8d62f9){var _0x270a69=typeof _0x5786c1[_0x02bc('0x19')]==='undefined'&&typeof _0x5786c1[_0x02bc('0x1a')]===_0x02bc('0x1b');var _0x172303=_0x8d62f9[_0x02bc('0x1c')];var _0x5476e0=_0x270a69?0x0:_0x5786c1[_0x02bc('0x19')];var _0x5dd022=_0x270a69?_0x8d62f9[_0x02bc('0x1c')]:_0x5786c1[_0x02bc('0x19')]+_0x5786c1['limit'];var _0x515243;if(_0x5dd022>=_0x172303){_0x5dd022=_0x172303;_0x515243=0xc8;}else{_0x515243=0xce;}_0x1e1807[_0x02bc('0x18')](_0x515243);return _0x1e1807['set'](_0x02bc('0x1d'),_0x5476e0+'-'+_0x5dd022+'/'+_0x172303)['json'](_0x8d62f9);}return null;};}function saveUpdates(_0x2baacb){return function(_0x51923e){if(_0x51923e){return _0x51923e['update'](_0x2baacb)[_0x02bc('0xe')](function(_0x358911){return _0x358911;});}return null;};}function removeEntity(_0x4e2ced){return function(_0x15a3ae){if(_0x15a3ae){return _0x15a3ae[_0x02bc('0x1e')]()[_0x02bc('0xe')](function(){_0x4e2ced[_0x02bc('0x18')](0xcc)[_0x02bc('0x1f')]();});}};}function handleEntityNotFound(_0x2e197f){return function(_0x8b1e09){if(!_0x8b1e09){_0x2e197f['sendStatus'](0x194);}return _0x8b1e09;};}function handleError(_0x55a76f,_0x233a2c){_0x233a2c=_0x233a2c||0x1f4;return function(_0x493359){logger[_0x02bc('0x14')](_0x493359[_0x02bc('0x20')]);if(_0x493359[_0x02bc('0x21')]){delete _0x493359[_0x02bc('0x21')];}_0x55a76f[_0x02bc('0x18')](_0x233a2c)[_0x02bc('0x22')](_0x493359);};}exports[_0x02bc('0x23')]=function(_0xe5bef4,_0x40b8d6){var _0x3515b2={},_0x558bd7={},_0x23067d={'count':0x0,'rows':[]};var _0x213b92=_[_0x02bc('0x24')](db[_0x02bc('0x25')][_0x02bc('0x26')],function(_0x2dc800){return{'name':_0x2dc800['fieldName'],'type':_0x2dc800[_0x02bc('0x27')][_0x02bc('0x28')]};});_0x558bd7['model']=_[_0x02bc('0x24')](_0x213b92,_0x02bc('0x21'));_0x558bd7[_0x02bc('0x29')]=_[_0x02bc('0x2a')](_0xe5bef4[_0x02bc('0x29')]);_0x558bd7[_0x02bc('0x2b')]=_[_0x02bc('0x2c')](_0x558bd7[_0x02bc('0x2d')],_0x558bd7[_0x02bc('0x29')]);_0x3515b2[_0x02bc('0x2e')]=_[_0x02bc('0x2c')](_0x558bd7[_0x02bc('0x2d')],qs[_0x02bc('0x2f')](_0xe5bef4[_0x02bc('0x29')][_0x02bc('0x2f')]));_0x3515b2[_0x02bc('0x2e')]=_0x3515b2[_0x02bc('0x2e')][_0x02bc('0x30')]?_0x3515b2[_0x02bc('0x2e')]:_0x558bd7[_0x02bc('0x2d')];if(!_0xe5bef4[_0x02bc('0x29')]['hasOwnProperty'](_0x02bc('0x31'))){_0x3515b2[_0x02bc('0x1a')]=qs[_0x02bc('0x1a')](_0xe5bef4[_0x02bc('0x29')][_0x02bc('0x1a')]);_0x3515b2[_0x02bc('0x19')]=qs[_0x02bc('0x19')](_0xe5bef4[_0x02bc('0x29')][_0x02bc('0x19')]);}_0x3515b2[_0x02bc('0x32')]=qs[_0x02bc('0x33')](_0xe5bef4[_0x02bc('0x29')][_0x02bc('0x33')]);_0x3515b2[_0x02bc('0x34')]=qs[_0x02bc('0x2b')](_[_0x02bc('0x35')](_0xe5bef4[_0x02bc('0x29')],_0x558bd7[_0x02bc('0x2b')]),_0x213b92);if(_0xe5bef4['query'][_0x02bc('0x36')]){_0x3515b2['where']=_[_0x02bc('0x37')](_0x3515b2[_0x02bc('0x34')],{'$or':_[_0x02bc('0x24')](_0x213b92,function(_0x45fb26){if(_0x45fb26['type']!==_0x02bc('0x38')){var _0x528273={};_0x528273[_0x45fb26[_0x02bc('0x21')]]={'$like':'%'+_0xe5bef4[_0x02bc('0x29')][_0x02bc('0x36')]+'%'};return _0x528273;}})});}_0x3515b2=_[_0x02bc('0x37')]({},_0x3515b2,_0xe5bef4[_0x02bc('0x39')]);var _0x19328c={'where':_0x3515b2[_0x02bc('0x34')]};return db['WhatsappMessage']['count'](_0x19328c)[_0x02bc('0xe')](function(_0x5e6986){_0x23067d[_0x02bc('0x1c')]=_0x5e6986;if(_0xe5bef4[_0x02bc('0x29')][_0x02bc('0x3a')]){_0x3515b2[_0x02bc('0x3b')]=[{'all':!![]}];}return db[_0x02bc('0x25')][_0x02bc('0x3c')](_0x3515b2);})['then'](function(_0x239e6b){_0x23067d[_0x02bc('0x3d')]=_0x239e6b;return _0x23067d;})[_0x02bc('0xe')](respondWithFilteredResult(_0x40b8d6,_0x3515b2))[_0x02bc('0x3e')](handleError(_0x40b8d6,null));};exports[_0x02bc('0x3f')]=function(_0x42c268,_0x42adab){var _0x112d53={'raw':!![],'where':{'id':_0x42c268['params']['id']}},_0x5115b5={};_0x5115b5[_0x02bc('0x2d')]=_[_0x02bc('0x2a')](db[_0x02bc('0x25')][_0x02bc('0x26')]);_0x5115b5[_0x02bc('0x29')]=_[_0x02bc('0x2a')](_0x42c268[_0x02bc('0x29')]);_0x5115b5[_0x02bc('0x2b')]=_['intersection'](_0x5115b5[_0x02bc('0x2d')],_0x5115b5[_0x02bc('0x29')]);_0x112d53[_0x02bc('0x2e')]=_[_0x02bc('0x2c')](_0x5115b5['model'],qs['fields'](_0x42c268[_0x02bc('0x29')][_0x02bc('0x2f')]));_0x112d53[_0x02bc('0x2e')]=_0x112d53[_0x02bc('0x2e')][_0x02bc('0x30')]?_0x112d53[_0x02bc('0x2e')]:_0x5115b5[_0x02bc('0x2d')];if(_0x42c268[_0x02bc('0x29')][_0x02bc('0x3a')]){_0x112d53[_0x02bc('0x3b')]=[{'all':!![]}];}_0x112d53=_[_0x02bc('0x37')]({},_0x112d53,_0x42c268[_0x02bc('0x39')]);return db[_0x02bc('0x25')][_0x02bc('0x40')](_0x112d53)[_0x02bc('0xe')](handleEntityNotFound(_0x42adab,null))[_0x02bc('0xe')](respondWithResult(_0x42adab,null))[_0x02bc('0x3e')](handleError(_0x42adab,null));};exports['create']=function(_0x5726d3,_0x45b906){return db[_0x02bc('0x25')][_0x02bc('0x41')](_0x5726d3[_0x02bc('0x42')],{})[_0x02bc('0xe')](respondWithResult(_0x45b906,0xc9))[_0x02bc('0x3e')](handleError(_0x45b906,null));};exports[_0x02bc('0x43')]=function(_0x11a419,_0x5889c1){if(_0x11a419[_0x02bc('0x42')]['id']){delete _0x11a419[_0x02bc('0x42')]['id'];}return db[_0x02bc('0x25')][_0x02bc('0x40')]({'where':{'id':_0x11a419['params']['id']}})[_0x02bc('0xe')](handleEntityNotFound(_0x5889c1,null))[_0x02bc('0xe')](saveUpdates(_0x11a419[_0x02bc('0x42')],null))['then'](respondWithResult(_0x5889c1,null))[_0x02bc('0x3e')](handleError(_0x5889c1,null));};exports[_0x02bc('0x1e')]=function(_0x36379a,_0x3769c8){return db[_0x02bc('0x25')][_0x02bc('0x40')]({'where':{'id':_0x36379a['params']['id']}})[_0x02bc('0xe')](handleEntityNotFound(_0x3769c8,null))[_0x02bc('0xe')](removeEntity(_0x3769c8,null))[_0x02bc('0x3e')](handleError(_0x3769c8,null));};exports[_0x02bc('0x44')]=function(_0x104c41,_0x1695f0){return db[_0x02bc('0x25')][_0x02bc('0x44')]()['then'](respondWithResult(_0x1695f0,null))[_0x02bc('0x3e')](handleError(_0x1695f0,null));};exports[_0x02bc('0x45')]=function(_0x48dd74,_0x5291c9){var _0x31226e=_0x02bc('0x46');return interactionService['acceptMessage'](_0x48dd74,_0x31226e)[_0x02bc('0xe')](respondWithResult(_0x5291c9,null))[_0x02bc('0x3e')](handleError(_0x5291c9,null));};exports[_0x02bc('0x47')]=function(_0x718f7b,_0x39daf0){var _0x4eb41b={'agent':{},'channel':_0x02bc('0x46')};if(_0x718f7b[_0x02bc('0x42')]['id']){delete _0x718f7b[_0x02bc('0x42')]['id'];}_0x718f7b[_0x02bc('0x42')][_0x02bc('0x48')]=_0x718f7b['body'][_0x02bc('0x48')]||_0x718f7b[_0x02bc('0x49')]['id'];_0x4eb41b[_0x02bc('0x4a')]['id']=_0x718f7b[_0x02bc('0x42')][_0x02bc('0x48')];return db['WhatsappMessage'][_0x02bc('0x40')]({'where':{'id':_0x718f7b['params']['id'],'UserId':null}})[_0x02bc('0xe')](handleEntityNotFound(_0x39daf0,null))[_0x02bc('0xe')](function(_0x251879){if(_0x251879){_0x4eb41b[_0x02bc('0x16')]=_0x251879[_0x02bc('0x4b')]({'plain':!![]});return db['WhatsappInteraction'][_0x02bc('0x40')]({'where':{'id':_0x251879[_0x02bc('0x4c')]}});}return null;})[_0x02bc('0xe')](handleEntityNotFound(_0x39daf0,null))[_0x02bc('0xe')](function(_0x59f3f3){if(_0x59f3f3){_0x4eb41b[_0x02bc('0x4d')]=_0x59f3f3[_0x02bc('0x4b')]({'plain':!![]});interaction_log[_0x02bc('0xf')](_0x02bc('0x4e'),_0x718f7b[_0x02bc('0x49')]['id'],_0x718f7b[_0x02bc('0x49')][_0x02bc('0x21')],_0x718f7b[_0x02bc('0x49')][_0x02bc('0x4f')],_0x4eb41b['interaction']['id'],_0x718f7b[_0x02bc('0x42')]?JSON[_0x02bc('0x50')](_0x718f7b[_0x02bc('0x42')]):_0x02bc('0x51'));return respondWithRpcPromise(_0x02bc('0x52'),_0x02bc('0x53'),_0x4eb41b);}return null;})[_0x02bc('0xe')](function(_0x2a9388){var _0x178519=_0x02bc('0x54')+_0x2a9388[_0x02bc('0x16')][_0x02bc('0x55')];return db[_0x02bc('0x56')]['query'](_0x178519,{'type':db[_0x02bc('0x57')][_0x02bc('0x58')][_0x02bc('0x59')],'raw':!![]})[_0x02bc('0xe')](function(_0x501fc3){return _0x501fc3;});})['then'](function(_0x4e30da){if(_0x4e30da){_0x4eb41b[_0x02bc('0x16')]['contact']=_0x4e30da[0x0];if(!_0x718f7b[_0x02bc('0x42')][_0x02bc('0x48')])return;return db[_0x02bc('0x5a')]['find']({'where':{'id':_0x718f7b[_0x02bc('0x42')][_0x02bc('0x48')],'role':_0x02bc('0x4a')},'attributes':['id',_0x02bc('0x21'),_0x02bc('0x5b'),'email',_0x02bc('0x5c')],'raw':!![]});}return null;})['then'](function(_0x31cd70){if(!_0x31cd70)return null;_0x4eb41b[_0x02bc('0x16')][_0x02bc('0x4a')]=_0x31cd70;return _0x4eb41b;})['then'](function(_0x35398a){if(_0x35398a){_0x35398a[_0x02bc('0x16')]['interface']=util[_0x02bc('0x5d')](_0x02bc('0x5e'),_0x718f7b['user']['name']);_0x35398a[_0x02bc('0x16')][_0x02bc('0x5f')]=_0x4eb41b[_0x02bc('0x5f')];_0x35398a[_0x02bc('0x16')][_0x02bc('0x60')]=_0x4eb41b[_0x02bc('0x5f')];_0x35398a['message'][_0x02bc('0x61')]=_0x02bc('0x47');respondWithRpcPromise('EventManager',_0x02bc('0x62'),{'event':_0x02bc('0x63'),'message':_0x35398a[_0x02bc('0x16')]},client9002);return _0x4eb41b;}return null;})[_0x02bc('0xe')](respondWithResult(_0x39daf0,null))['catch'](handleError(_0x39daf0,null));};exports[_0x02bc('0x18')]=function(_0x5b97a4,_0x48cd7c){if(_0x5b97a4[_0x02bc('0x42')]['id']){delete _0x5b97a4[_0x02bc('0x42')]['id'];}var _0x57aeab;return db['WhatsappMessage']['find']({'where':{'id':_0x5b97a4[_0x02bc('0x64')]['id']}})[_0x02bc('0xe')](handleEntityNotFound(_0x48cd7c,null))[_0x02bc('0xe')](function(_0x2cf5bf){if(_0x2cf5bf){_0x57aeab=_0x2cf5bf;return db[_0x02bc('0x65')][_0x02bc('0x40')]({'where':{'id':_0x2cf5bf[_0x02bc('0x66')]}});}})[_0x02bc('0xe')](handleEntityNotFound(_0x48cd7c,null))[_0x02bc('0xe')](function(_0x3c030f){if(_0x3c030f){logger[_0x02bc('0x12')](_0x02bc('0x67'),_0x02bc('0x18'),_0x02bc('0x68'),_0x3c030f[_0x02bc('0x27')],util['inspect'](_0x5b97a4[_0x02bc('0x42')],{'showHidden':![],'depth':null}));switch(_0x3c030f[_0x02bc('0x27')]){case'twilio':if(_0x5b97a4['body'][_0x02bc('0x69')]&&_0x5b97a4[_0x02bc('0x42')][_0x02bc('0x69')]===_0x57aeab[_0x02bc('0x6a')]&&_0x5b97a4['body'][_0x02bc('0x6b')]&&_0x5b97a4['body']['MessageStatus']==='read'){return _0x57aeab[_0x02bc('0x43')]({'read':!![]});}else{logger[_0x02bc('0x14')](_0x02bc('0x6c'),_0x02bc('0x18'),_0x02bc('0x6d'),util[_0x02bc('0x6e')](_0x5b97a4[_0x02bc('0x42')],{'showHidden':![],'depth':null}));}break;}return _0x57aeab;}})['then'](respondWithResult(_0x48cd7c,null))[_0x02bc('0x3e')](handleError(_0x48cd7c,null));}; \ No newline at end of file +var _0x17f7=['stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','name','send','index','map','fieldName','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','WhatsappMessage','includeAll','include','findAll','params','rawAttributes','intersection','find','create','body','describe','accept','whatsapp','acceptMessage','UserId','agent','get','WhatsappInteraction','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','format','SIP/%s','channel','event','reject','EventManager','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','whatsapp-interactions','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x17f7,0x198));var _0x717f=function(_0x29bd3d,_0x295cdf){_0x29bd3d=_0x29bd3d-0x0;var _0x2fda8f=_0x17f7[_0x29bd3d];return _0x2fda8f;};'use strict';var util=require(_0x717f('0x0'));var _=require(_0x717f('0x1'));var Redis=require('ioredis');var interactionService=require(_0x717f('0x2'));var qs=require(_0x717f('0x3'));var logger=require(_0x717f('0x4'))('api');var config=require(_0x717f('0x5'));var db=require(_0x717f('0x6'))['db'];config[_0x717f('0x7')]=_[_0x717f('0x8')](config[_0x717f('0x7')],{'host':_0x717f('0x9'),'port':0x18eb});var socket=require(_0x717f('0xa'))(new Redis(config['redis']));require(_0x717f('0xb'))[_0x717f('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0x717f('0xd')]['http']({'port':0x232c});var client9002=jayson[_0x717f('0xd')][_0x717f('0xe')]({'port':0x232a});var interaction_log=require(_0x717f('0x4'))(_0x717f('0xf'));function respondWithRpcPromise(_0x399ae8,_0x526475,_0x49aa91,_0x2a9811){return new Promise(function(_0x2c8aaa,_0x28ac37){var _0x2c7963=_0x2a9811||client;return _0x2c7963['request'](_0x399ae8,_0x49aa91)[_0x717f('0x10')](function(_0x571075){logger[_0x717f('0x11')](_0x717f('0x12'),_0x526475,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x526475,_0x717f('0x13'),JSON[_0x717f('0x14')](_0x571075));if(_0x571075['error']){if(_0x571075[_0x717f('0x15')]['code']===0x1f4){logger[_0x717f('0x15')](_0x717f('0x12'),_0x526475,_0x571075[_0x717f('0x15')][_0x717f('0x16')]);return _0x28ac37(_0x571075['error'][_0x717f('0x16')]);}logger[_0x717f('0x15')](_0x717f('0x12'),_0x526475,_0x571075[_0x717f('0x15')][_0x717f('0x16')]);return _0x2c8aaa(_0x571075[_0x717f('0x15')][_0x717f('0x16')]);}else{logger[_0x717f('0x11')](_0x717f('0x12'),_0x526475,'request\x20sent');_0x2c8aaa(_0x571075[_0x717f('0x17')][_0x717f('0x16')]);}})[_0x717f('0x18')](function(_0x26994b){logger['error'](_0x717f('0x12'),_0x526475,_0x26994b);_0x28ac37(_0x26994b);});});}function respondWithResult(_0x387f12,_0x3758f4){_0x3758f4=_0x3758f4||0xc8;return function(_0x2fe72e){if(_0x2fe72e){return _0x387f12[_0x717f('0x19')](_0x3758f4)[_0x717f('0x1a')](_0x2fe72e);}};}function respondWithFilteredResult(_0x334c05,_0xdf868a){return function(_0x38bd32){if(_0x38bd32){var _0x22e9bf=typeof _0xdf868a[_0x717f('0x1b')]===_0x717f('0x1c')&&typeof _0xdf868a[_0x717f('0x1d')]===_0x717f('0x1c');var _0x572e87=_0x38bd32['count'];var _0x1e1e68=_0x22e9bf?0x0:_0xdf868a[_0x717f('0x1b')];var _0x353ab5=_0x22e9bf?_0x38bd32[_0x717f('0x1e')]:_0xdf868a[_0x717f('0x1b')]+_0xdf868a[_0x717f('0x1d')];var _0xbf00de;if(_0x353ab5>=_0x572e87){_0x353ab5=_0x572e87;_0xbf00de=0xc8;}else{_0xbf00de=0xce;}_0x334c05['status'](_0xbf00de);return _0x334c05[_0x717f('0x1f')](_0x717f('0x20'),_0x1e1e68+'-'+_0x353ab5+'/'+_0x572e87)[_0x717f('0x1a')](_0x38bd32);}return null;};}function saveUpdates(_0x40a32d){return function(_0x1bcd54){if(_0x1bcd54){return _0x1bcd54[_0x717f('0x21')](_0x40a32d)['then'](function(_0x165551){return _0x165551;});}return null;};}function removeEntity(_0x18509c){return function(_0x2605a9){if(_0x2605a9){return _0x2605a9[_0x717f('0x22')]()[_0x717f('0x10')](function(){_0x18509c[_0x717f('0x19')](0xcc)[_0x717f('0x23')]();});}};}function handleEntityNotFound(_0x3cdd4d){return function(_0x132024){if(!_0x132024){_0x3cdd4d[_0x717f('0x24')](0x194);}return _0x132024;};}function handleError(_0x7404ae,_0x4cd270){_0x4cd270=_0x4cd270||0x1f4;return function(_0x9fee60){logger[_0x717f('0x15')](_0x9fee60['stack']);if(_0x9fee60[_0x717f('0x25')]){delete _0x9fee60['name'];}_0x7404ae[_0x717f('0x19')](_0x4cd270)[_0x717f('0x26')](_0x9fee60);};}exports[_0x717f('0x27')]=function(_0x10d3cd,_0x368b55){var _0x2ad681={},_0x395d51={},_0x2b3e6f={'count':0x0,'rows':[]};var _0x1223f3=_[_0x717f('0x28')](db['WhatsappMessage']['rawAttributes'],function(_0x1f8727){return{'name':_0x1f8727[_0x717f('0x29')],'type':_0x1f8727['type']['key']};});_0x395d51[_0x717f('0x2a')]=_[_0x717f('0x28')](_0x1223f3,_0x717f('0x25'));_0x395d51[_0x717f('0x2b')]=_[_0x717f('0x2c')](_0x10d3cd[_0x717f('0x2b')]);_0x395d51['filters']=_['intersection'](_0x395d51[_0x717f('0x2a')],_0x395d51[_0x717f('0x2b')]);_0x2ad681[_0x717f('0x2d')]=_['intersection'](_0x395d51[_0x717f('0x2a')],qs[_0x717f('0x2e')](_0x10d3cd[_0x717f('0x2b')][_0x717f('0x2e')]));_0x2ad681[_0x717f('0x2d')]=_0x2ad681[_0x717f('0x2d')][_0x717f('0x2f')]?_0x2ad681[_0x717f('0x2d')]:_0x395d51['model'];if(!_0x10d3cd[_0x717f('0x2b')][_0x717f('0x30')](_0x717f('0x31'))){_0x2ad681[_0x717f('0x1d')]=qs[_0x717f('0x1d')](_0x10d3cd['query'][_0x717f('0x1d')]);_0x2ad681[_0x717f('0x1b')]=qs[_0x717f('0x1b')](_0x10d3cd[_0x717f('0x2b')][_0x717f('0x1b')]);}_0x2ad681[_0x717f('0x32')]=qs['sort'](_0x10d3cd[_0x717f('0x2b')][_0x717f('0x33')]);_0x2ad681[_0x717f('0x34')]=qs[_0x717f('0x35')](_[_0x717f('0x36')](_0x10d3cd[_0x717f('0x2b')],_0x395d51[_0x717f('0x35')]),_0x1223f3);if(_0x10d3cd[_0x717f('0x2b')][_0x717f('0x37')]){_0x2ad681[_0x717f('0x34')]=_[_0x717f('0x38')](_0x2ad681['where'],{'$or':_[_0x717f('0x28')](_0x1223f3,function(_0x3aaf5a){if(_0x3aaf5a[_0x717f('0x39')]!==_0x717f('0x3a')){var _0x5ef633={};_0x5ef633[_0x3aaf5a[_0x717f('0x25')]]={'$like':'%'+_0x10d3cd[_0x717f('0x2b')]['filter']+'%'};return _0x5ef633;}})});}_0x2ad681=_[_0x717f('0x38')]({},_0x2ad681,_0x10d3cd[_0x717f('0x3b')]);var _0x1d4d55={'where':_0x2ad681['where']};return db[_0x717f('0x3c')][_0x717f('0x1e')](_0x1d4d55)['then'](function(_0x4db714){_0x2b3e6f[_0x717f('0x1e')]=_0x4db714;if(_0x10d3cd['query'][_0x717f('0x3d')]){_0x2ad681[_0x717f('0x3e')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x717f('0x3f')](_0x2ad681);})[_0x717f('0x10')](function(_0xfbff5f){_0x2b3e6f['rows']=_0xfbff5f;return _0x2b3e6f;})['then'](respondWithFilteredResult(_0x368b55,_0x2ad681))[_0x717f('0x18')](handleError(_0x368b55,null));};exports['show']=function(_0x24eea4,_0x541e66){var _0x1dd5a7={'raw':!![],'where':{'id':_0x24eea4[_0x717f('0x40')]['id']}},_0x183177={};_0x183177[_0x717f('0x2a')]=_[_0x717f('0x2c')](db[_0x717f('0x3c')][_0x717f('0x41')]);_0x183177[_0x717f('0x2b')]=_[_0x717f('0x2c')](_0x24eea4['query']);_0x183177[_0x717f('0x35')]=_[_0x717f('0x42')](_0x183177[_0x717f('0x2a')],_0x183177['query']);_0x1dd5a7[_0x717f('0x2d')]=_[_0x717f('0x42')](_0x183177['model'],qs[_0x717f('0x2e')](_0x24eea4[_0x717f('0x2b')][_0x717f('0x2e')]));_0x1dd5a7[_0x717f('0x2d')]=_0x1dd5a7[_0x717f('0x2d')][_0x717f('0x2f')]?_0x1dd5a7[_0x717f('0x2d')]:_0x183177[_0x717f('0x2a')];if(_0x24eea4[_0x717f('0x2b')][_0x717f('0x3d')]){_0x1dd5a7[_0x717f('0x3e')]=[{'all':!![]}];}_0x1dd5a7=_[_0x717f('0x38')]({},_0x1dd5a7,_0x24eea4['options']);return db[_0x717f('0x3c')][_0x717f('0x43')](_0x1dd5a7)[_0x717f('0x10')](handleEntityNotFound(_0x541e66,null))['then'](respondWithResult(_0x541e66,null))[_0x717f('0x18')](handleError(_0x541e66,null));};exports['create']=function(_0x10997a,_0x2b3c3c){return db[_0x717f('0x3c')][_0x717f('0x44')](_0x10997a[_0x717f('0x45')],{})[_0x717f('0x10')](respondWithResult(_0x2b3c3c,0xc9))[_0x717f('0x18')](handleError(_0x2b3c3c,null));};exports['update']=function(_0x1043c2,_0x265cf6){if(_0x1043c2[_0x717f('0x45')]['id']){delete _0x1043c2[_0x717f('0x45')]['id'];}return db[_0x717f('0x3c')][_0x717f('0x43')]({'where':{'id':_0x1043c2[_0x717f('0x40')]['id']}})['then'](handleEntityNotFound(_0x265cf6,null))[_0x717f('0x10')](saveUpdates(_0x1043c2[_0x717f('0x45')],null))[_0x717f('0x10')](respondWithResult(_0x265cf6,null))[_0x717f('0x18')](handleError(_0x265cf6,null));};exports[_0x717f('0x22')]=function(_0x3830e8,_0x2e7fe7){return db[_0x717f('0x3c')]['find']({'where':{'id':_0x3830e8[_0x717f('0x40')]['id']}})[_0x717f('0x10')](handleEntityNotFound(_0x2e7fe7,null))[_0x717f('0x10')](removeEntity(_0x2e7fe7,null))[_0x717f('0x18')](handleError(_0x2e7fe7,null));};exports[_0x717f('0x46')]=function(_0x59a337,_0x5c95f2){return db[_0x717f('0x3c')][_0x717f('0x46')]()['then'](respondWithResult(_0x5c95f2,null))[_0x717f('0x18')](handleError(_0x5c95f2,null));};exports[_0x717f('0x47')]=function(_0x5561da,_0x9c3698){var _0x25dfdd=_0x717f('0x48');return interactionService[_0x717f('0x49')](_0x5561da,_0x25dfdd)[_0x717f('0x10')](respondWithResult(_0x9c3698,null))[_0x717f('0x18')](handleError(_0x9c3698,null));};exports['reject']=function(_0x1a7d29,_0x545f71){var _0x32cdcc={'agent':{},'channel':_0x717f('0x48')};if(_0x1a7d29['body']['id']){delete _0x1a7d29[_0x717f('0x45')]['id'];}_0x1a7d29[_0x717f('0x45')][_0x717f('0x4a')]=_0x1a7d29[_0x717f('0x45')][_0x717f('0x4a')]||_0x1a7d29['user']['id'];_0x32cdcc[_0x717f('0x4b')]['id']=_0x1a7d29[_0x717f('0x45')][_0x717f('0x4a')];return db[_0x717f('0x3c')]['find']({'where':{'id':_0x1a7d29[_0x717f('0x40')]['id'],'UserId':null}})[_0x717f('0x10')](handleEntityNotFound(_0x545f71,null))[_0x717f('0x10')](function(_0x311dbd){if(_0x311dbd){_0x32cdcc[_0x717f('0x16')]=_0x311dbd[_0x717f('0x4c')]({'plain':!![]});return db[_0x717f('0x4d')][_0x717f('0x43')]({'where':{'id':_0x311dbd['WhatsappInteractionId']}});}return null;})[_0x717f('0x10')](handleEntityNotFound(_0x545f71,null))[_0x717f('0x10')](function(_0x479dab){if(_0x479dab){_0x32cdcc[_0x717f('0x4e')]=_0x479dab[_0x717f('0x4c')]({'plain':!![]});interaction_log[_0x717f('0x11')](_0x717f('0x4f'),_0x1a7d29['user']['id'],_0x1a7d29[_0x717f('0x50')][_0x717f('0x25')],_0x1a7d29[_0x717f('0x50')][_0x717f('0x51')],_0x32cdcc[_0x717f('0x4e')]['id'],_0x1a7d29[_0x717f('0x45')]?JSON[_0x717f('0x14')](_0x1a7d29[_0x717f('0x45')]):_0x717f('0x52'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x32cdcc);}return null;})['then'](function(_0x1c9a93){var _0x8d075e=_0x717f('0x53')+_0x1c9a93[_0x717f('0x16')][_0x717f('0x54')];return db['sequelize'][_0x717f('0x2b')](_0x8d075e,{'type':db[_0x717f('0x55')][_0x717f('0x56')][_0x717f('0x57')],'raw':!![]})[_0x717f('0x10')](function(_0x41bcdb){return _0x41bcdb;});})[_0x717f('0x10')](function(_0x65b16){if(_0x65b16){_0x32cdcc['message']['contact']=_0x65b16[0x0];if(!_0x1a7d29[_0x717f('0x45')]['UserId'])return;return db[_0x717f('0x58')][_0x717f('0x43')]({'where':{'id':_0x1a7d29[_0x717f('0x45')]['UserId'],'role':_0x717f('0x4b')},'attributes':['id',_0x717f('0x25'),_0x717f('0x59'),_0x717f('0x5a'),_0x717f('0x5b')],'raw':!![]});}return null;})['then'](function(_0x38057b){if(!_0x38057b)return null;_0x32cdcc[_0x717f('0x16')][_0x717f('0x4b')]=_0x38057b;return _0x32cdcc;})[_0x717f('0x10')](function(_0x58c40b){if(_0x58c40b){_0x58c40b[_0x717f('0x16')]['interface']=util[_0x717f('0x5c')](_0x717f('0x5d'),_0x1a7d29[_0x717f('0x50')]['name']);_0x58c40b[_0x717f('0x16')][_0x717f('0x5e')]=_0x32cdcc[_0x717f('0x5e')];_0x58c40b[_0x717f('0x16')]['motionChannel']=_0x32cdcc[_0x717f('0x5e')];_0x58c40b[_0x717f('0x16')][_0x717f('0x5f')]=_0x717f('0x60');respondWithRpcPromise(_0x717f('0x61'),_0x717f('0x61'),{'event':_0x717f('0x62'),'message':_0x58c40b['message']},client9002);return _0x32cdcc;}return null;})[_0x717f('0x10')](respondWithResult(_0x545f71,null))['catch'](handleError(_0x545f71,null));};exports['status']=function(_0x12863a,_0x219f4b){if(_0x12863a['body']['id']){delete _0x12863a['body']['id'];}var _0xb8c07e;return db[_0x717f('0x3c')][_0x717f('0x43')]({'where':{'id':_0x12863a['params']['id']}})[_0x717f('0x10')](handleEntityNotFound(_0x219f4b,null))[_0x717f('0x10')](function(_0x49007d){if(_0x49007d){_0xb8c07e=_0x49007d;return db[_0x717f('0x63')]['find']({'where':{'id':_0x49007d['WhatsappAccountId']}});}})[_0x717f('0x10')](handleEntityNotFound(_0x219f4b,null))[_0x717f('0x10')](function(_0x3dd48d){if(_0x3dd48d){logger['debug'](_0x717f('0x64'),_0x717f('0x19'),_0x717f('0x65'),_0x3dd48d['type'],util[_0x717f('0x66')](_0x12863a['body'],{'showHidden':![],'depth':null}));switch(_0x3dd48d[_0x717f('0x39')]){case _0x717f('0x67'):if(_0x12863a['body']['MessageSid']&&_0x12863a[_0x717f('0x45')]['MessageSid']===_0xb8c07e[_0x717f('0x68')]&&_0x12863a[_0x717f('0x45')][_0x717f('0x69')]&&_0x12863a[_0x717f('0x45')][_0x717f('0x69')]==='read'){return _0xb8c07e['update']({'read':!![]});}else{logger[_0x717f('0x15')](_0x717f('0x6a'),_0x717f('0x19'),_0x717f('0x67'),util[_0x717f('0x66')](_0x12863a[_0x717f('0x45')],{'showHidden':![],'depth':null}));}break;}return _0xb8c07e;}})[_0x717f('0x10')](respondWithResult(_0x219f4b,null))['catch'](handleError(_0x219f4b,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 5904d1d..2fa85e6 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 _0xf4eb=['hook','events','update','emit','hasOwnProperty'];(function(_0x5a5126,_0x2283f6){var _0xe7c5b1=function(_0x1f9a5e){while(--_0x1f9a5e){_0x5a5126['push'](_0x5a5126['shift']());}};_0xe7c5b1(++_0x2283f6);}(_0xf4eb,0xec));var _0xbf4e=function(_0x550683,_0x55d647){_0x550683=_0x550683-0x0;var _0xf43d8b=_0xf4eb[_0x550683];return _0xf43d8b;};'use strict';var EventEmitter=require(_0xbf4e('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf4e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4e7fa7){return function(_0x2e3070,_0x1c7606,_0x32d1d7){WhatsappMessageEvents[_0xbf4e('0x2')](_0x4e7fa7+':'+_0x2e3070['id'],_0x2e3070);WhatsappMessageEvents[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070);_0x32d1d7(null);};}for(var e in events){if(events[_0xbf4e('0x3')](e)){var event=events[e];WhatsappMessage[_0xbf4e('0x4')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x80df=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','update'];(function(_0x2b5d44,_0x2c2aa5){var _0x381b98=function(_0x4d50b6){while(--_0x4d50b6){_0x2b5d44['push'](_0x2b5d44['shift']());}};_0x381b98(++_0x2c2aa5);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xf80d('0x0'));var WhatsappMessage=require(_0xf80d('0x1'))['db'][_0xf80d('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf80d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf80d('0x4'),'afterDestroy':_0xf80d('0x5')};function emitEvent(_0xfd239e){return function(_0x21365c,_0x15d302,_0xa6b1bb){WhatsappMessageEvents[_0xf80d('0x6')](_0xfd239e+':'+_0x21365c['id'],_0x21365c);WhatsappMessageEvents[_0xf80d('0x6')](_0xfd239e,_0x21365c);_0xa6b1bb(null);};}for(var e in events){if(events[_0xf80d('0x7')](e)){var event=events[e];WhatsappMessage[_0xf80d('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 93ce194..c603a25 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 _0x2068=['out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','twilio','authToken','phone','accountSid','messages','whatsapp:','remote','/api/whatsapp/messages/','token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase'];(function(_0x4ba2d2,_0x9f2ef){var _0x179cc9=function(_0x89e18f){while(--_0x89e18f){_0x4ba2d2['push'](_0x4ba2d2['shift']());}};_0x179cc9(++_0x9f2ef);}(_0x2068,0x6a));var _0x8206=function(_0x5670ad,_0x300b24){_0x5670ad=_0x5670ad-0x0;var _0x583792=_0x2068[_0x5670ad];return _0x583792;};'use strict';var _=require(_0x8206('0x0'));var util=require(_0x8206('0x1'));var logger=require('../../config/logger')(_0x8206('0x2'));var moment=require(_0x8206('0x3'));var BPromise=require(_0x8206('0x4'));var rp=require(_0x8206('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x8206('0x6'));var rimraf=require('rimraf');var config=require(_0x8206('0x7'));var attributes=require(_0x8206('0x8'));module[_0x8206('0x9')]=function(_0x4bb800,_0x2cc0e8){return _0x4bb800[_0x8206('0xa')](_0x8206('0xb'),attributes,{'tableName':_0x8206('0xc'),'paranoid':![],'indexes':[{'name':_0x8206('0xd'),'fields':[_0x8206('0xd')]},{'name':_0x8206('0xe'),'fields':[_0x8206('0xf')],'type':_0x8206('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x6fc7e,_0x55b90f,_0x57c6f4){var _0x4d5912=_0x4bb800[_0x8206('0x11')];var _0x23ef34=_0x6fc7e['get']({'plain':!![]});if(_0x23ef34[_0x8206('0x12')][_0x8206('0x13')]()==='in'||_0x23ef34[_0x8206('0x12')][_0x8206('0x13')]()===_0x8206('0x14')&&!_0x23ef34[_0x8206('0x15')]&&!_[_0x8206('0x16')](_0x23ef34[_0x8206('0x17')])){_0x4d5912[_0x8206('0x18')][_0x8206('0x19')]({'where':{'id':_0x23ef34[_0x8206('0x1a')]}})[_0x8206('0x1b')](function(_0x3aff7f){if(_0x3aff7f){_0x3aff7f[_0x8206('0x1c')]({'lastMsgAt':_0x23ef34[_0x8206('0x1d')],'lastMsgDirection':_0x23ef34['direction'][_0x8206('0x13')]()});}})[_0x8206('0x1e')](function(_0x399add){console[_0x8206('0x1f')](_0x399add);});}if(_0x23ef34[_0x8206('0x12')]===_0x8206('0x14')&&!_0x23ef34[_0x8206('0x15')]){var _0x4caccb;_0x4d5912[_0x8206('0x20')][_0x8206('0x21')]({'where':{'id':_0x23ef34[_0x8206('0x22')]},'raw':!![]})[_0x8206('0x1b')](function(_0x1e2085){_0x4caccb=_0x1e2085;if(_0x4caccb&&_0x4caccb['type']){switch(_0x4caccb['type']){case _0x8206('0x23'):var _0x357de1=require(_0x8206('0x23'));if(_0x4caccb['accountSid']&&_0x4caccb[_0x8206('0x24')]&&_0x4caccb[_0x8206('0x25')]){var _0x2917c8=new _0x357de1(_0x4caccb[_0x8206('0x26')],_0x4caccb[_0x8206('0x24')]);_0x2917c8[_0x8206('0x27')]['create']({'body':_0x23ef34[_0x8206('0xf')],'to':_0x8206('0x28')+_0x23ef34['phone'],'from':'whatsapp:'+_0x4caccb['phone'],'statusCallback':_0x4caccb[_0x8206('0x29')]+_0x8206('0x2a')+_0x23ef34['id']+'/status?token='+_0x4caccb[_0x8206('0x2b')]})[_0x8206('0x1b')](function(_0x2de4f8){if(_0x2de4f8[_0x8206('0x2c')]){return _0x6fc7e[_0x8206('0x1c')]({'messageId':_0x2de4f8[_0x8206('0x2c')]});}})[_0x8206('0x1e')](function(_0x2fa3ed){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x8206('0x2d'),_0x8206('0x23'),util[_0x8206('0x2e')](_0x2fa3ed,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8206('0x2f'),_0x8206('0x2d'),_0x8206('0x23'),_0x8206('0x30'));}break;case _0x8206('0x31'):var _0x3fc591=_0x4caccb['accountSid'];var _0x333545=_0x4caccb[_0x8206('0x24')];var _0x519135=_0x4caccb[_0x8206('0x32')]+_0x8206('0x33')+_0x3fc591+_0x8206('0x34');var _0xeeb2c2={'to':[_0x23ef34[_0x8206('0x25')]],'message':{'type':'text','text':_0x23ef34[_0x8206('0xf')]}};var _0x4abb21={'method':_0x8206('0x35'),'uri':_0x519135,'headers':{'Authorization':_0x8206('0x36')+_0x333545,'Content-Type':_0x8206('0x37')},'body':_0xeeb2c2,'json':!![]};rp(_0x4abb21)[_0x8206('0x1b')](function(_0x250fb5){if(_0x250fb5[_0x8206('0x38')][0x0][_0x8206('0x39')]){return _0x6fc7e[_0x8206('0x1c')]({'messageId':_0x250fb5[_0x8206('0x38')][0x0][_0x8206('0x39')]});}})[_0x8206('0x1e')](function(_0x383165){logger[_0x8206('0x3a')](_0x8206('0x3b'),_0x383165);});break;}}})[_0x8206('0x3c')](function(){_0x57c6f4();});}else{_0x57c6f4();}}},'charset':_0x8206('0x3d'),'collate':_0x8206('0x3e')});}; \ No newline at end of file +var _0x493d=['secret','isNil','WhatsappInteraction','then','update','createdAt','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','body','Bearer\x20','statuses','message_id','catch','err','WhatsappMessage,\x20%s','finally','utf8mb4','util','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','get','direction','toLowerCase','out'];(function(_0x211c61,_0x5e559e){var _0x20f400=function(_0x12aafb){while(--_0x12aafb){_0x211c61['push'](_0x211c61['shift']());}};_0x20f400(++_0x5e559e);}(_0x493d,0xcd));var _0xd493=function(_0x3ff9bc,_0x51778d){_0x3ff9bc=_0x3ff9bc-0x0;var _0x4017d6=_0x493d[_0x3ff9bc];return _0x4017d6;};'use strict';var _=require('lodash');var util=require(_0xd493('0x0'));var logger=require('../../config/logger')(_0xd493('0x1'));var moment=require(_0xd493('0x2'));var BPromise=require(_0xd493('0x3'));var rp=require(_0xd493('0x4'));var fetch=require(_0xd493('0x5'));var fs=require('fs');var path=require(_0xd493('0x6'));var rimraf=require(_0xd493('0x7'));var config=require(_0xd493('0x8'));var attributes=require(_0xd493('0x9'));module['exports']=function(_0x2ed96a,_0x2c5984){return _0x2ed96a[_0xd493('0xa')](_0xd493('0xb'),attributes,{'tableName':_0xd493('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd493('0xd')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0xd493('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e4cf4,_0x216e5e,_0x4cd7b6){var _0x2fcb18=_0x2ed96a['models'];var _0x2671cd=_0x5e4cf4[_0xd493('0xf')]({'plain':!![]});if(_0x2671cd[_0xd493('0x10')][_0xd493('0x11')]()==='in'||_0x2671cd[_0xd493('0x10')]['toLowerCase']()===_0xd493('0x12')&&!_0x2671cd[_0xd493('0x13')]&&!_[_0xd493('0x14')](_0x2671cd['UserId'])){_0x2fcb18[_0xd493('0x15')]['findOne']({'where':{'id':_0x2671cd['WhatsappInteractionId']}})[_0xd493('0x16')](function(_0x6ea456){if(_0x6ea456){_0x6ea456[_0xd493('0x17')]({'lastMsgAt':_0x2671cd[_0xd493('0x18')],'lastMsgDirection':_0x2671cd[_0xd493('0x10')][_0xd493('0x11')]()});}})['catch'](function(_0x1add45){console['error'](_0x1add45);});}if(_0x2671cd[_0xd493('0x10')]===_0xd493('0x12')&&!_0x2671cd[_0xd493('0x13')]){var _0x29709b;_0x2fcb18['WhatsappAccount'][_0xd493('0x19')]({'where':{'id':_0x2671cd[_0xd493('0x1a')]},'raw':!![]})[_0xd493('0x16')](function(_0x516a75){_0x29709b=_0x516a75;if(_0x29709b&&_0x29709b['type']){switch(_0x29709b[_0xd493('0x1b')]){case _0xd493('0x1c'):var _0x5b49e6=require(_0xd493('0x1c'));if(_0x29709b['accountSid']&&_0x29709b[_0xd493('0x1d')]&&_0x29709b[_0xd493('0x1e')]){var _0x54db13=new _0x5b49e6(_0x29709b[_0xd493('0x1f')],_0x29709b['authToken']);_0x54db13[_0xd493('0x20')][_0xd493('0x21')]({'body':_0x2671cd['body'],'to':_0xd493('0x22')+_0x2671cd[_0xd493('0x1e')],'from':_0xd493('0x22')+_0x29709b['phone'],'statusCallback':_0x29709b['remote']+'/api/whatsapp/messages/'+_0x2671cd['id']+_0xd493('0x23')+_0x29709b[_0xd493('0x24')]})[_0xd493('0x16')](function(_0x18c64a){if(_0x18c64a['sid']){return _0x5e4cf4[_0xd493('0x17')]({'messageId':_0x18c64a[_0xd493('0x25')]});}})['catch'](function(_0x40a47c){logger[_0xd493('0x26')](_0xd493('0x27'),_0xd493('0x28'),_0xd493('0x1c'),util['inspect'](_0x40a47c,{'showHidden':![],'depth':null}));});}else{logger[_0xd493('0x26')](_0xd493('0x27'),_0xd493('0x28'),_0xd493('0x1c'),_0xd493('0x29'));}break;case _0xd493('0x2a'):var _0x594132=_0x29709b[_0xd493('0x1f')];var _0x5a6a28=_0x29709b[_0xd493('0x1d')];var _0x4eb4da=_0x29709b[_0xd493('0x2b')]+_0xd493('0x2c')+_0x594132+_0xd493('0x2d');var _0x717289={'to':[_0x2671cd[_0xd493('0x1e')]],'message':{'type':_0xd493('0x2e'),'text':_0x2671cd[_0xd493('0x2f')]}};var _0xce27af={'method':'POST','uri':_0x4eb4da,'headers':{'Authorization':_0xd493('0x30')+_0x5a6a28,'Content-Type':'application/json'},'body':_0x717289,'json':!![]};rp(_0xce27af)[_0xd493('0x16')](function(_0x5c369d){if(_0x5c369d[_0xd493('0x31')][0x0][_0xd493('0x32')]){return _0x5e4cf4[_0xd493('0x17')]({'messageId':_0x5c369d[_0xd493('0x31')][0x0]['message_id']});}})[_0xd493('0x33')](function(_0x35c5c3){logger[_0xd493('0x34')](_0xd493('0x35'),_0x35c5c3);});break;}}})[_0xd493('0x36')](function(){_0x4cd7b6();});}else{_0x4cd7b6();}}},'charset':_0xd493('0x37'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index bf88749..1e6801e 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 _0xfcf4=['CreateWhatsappMessage','create','body','options','raw','debug','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','info','catch'];(function(_0x5959c9,_0x2ed153){var _0x4ffcbc=function(_0x459b7a){while(--_0x459b7a){_0x5959c9['push'](_0x5959c9['shift']());}};_0x4ffcbc(++_0x2ed153);}(_0xfcf4,0x1a6));var _0x4fcf=function(_0x25907f,_0xa59ed7){_0x25907f=_0x25907f-0x0;var _0x3a4911=_0xfcf4[_0x25907f];return _0x3a4911;};'use strict';var _=require('lodash');var util=require(_0x4fcf('0x0'));var moment=require(_0x4fcf('0x1'));var BPromise=require(_0x4fcf('0x2'));var rs=require(_0x4fcf('0x3'));var fs=require('fs');var Redis=require(_0x4fcf('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4fcf('0x5'))(_0x4fcf('0x6'));var config=require('../../config/environment');var jayson=require(_0x4fcf('0x7'));var client=jayson[_0x4fcf('0x8')][_0x4fcf('0x9')]({'port':0x232a});config[_0x4fcf('0xa')]=_[_0x4fcf('0xb')](config[_0x4fcf('0xa')],{'host':_0x4fcf('0xc'),'port':0x18eb});var socket=require(_0x4fcf('0xd'))(new Redis(config['redis']));require(_0x4fcf('0xe'))[_0x4fcf('0xf')](socket);function respondWithRpcPromise(_0x5db7ab,_0x4759ef,_0x37e134){return new BPromise(function(_0x5cf2c2,_0x4fc427){return client[_0x4fcf('0x10')](_0x5db7ab,_0x37e134)[_0x4fcf('0x11')](function(_0x5d36b6){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4759ef,_0x4fcf('0x12'));logger['debug'](_0x4fcf('0x13'),_0x4759ef,'request\x20sent',JSON[_0x4fcf('0x14')](_0x5d36b6));if(_0x5d36b6[_0x4fcf('0x15')]){if(_0x5d36b6['error']['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4759ef,_0x5d36b6[_0x4fcf('0x15')]['message']);return _0x4fc427(_0x5d36b6['error']['message']);}logger['error'](_0x4fcf('0x16'),_0x4759ef,_0x5d36b6['error'][_0x4fcf('0x17')]);return _0x5cf2c2(_0x5d36b6[_0x4fcf('0x15')][_0x4fcf('0x17')]);}else{logger[_0x4fcf('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x4759ef,_0x4fcf('0x12'));_0x5cf2c2(_0x5d36b6['result'][_0x4fcf('0x17')]);}})[_0x4fcf('0x19')](function(_0x251f51){logger[_0x4fcf('0x15')](_0x4fcf('0x16'),_0x4759ef,_0x251f51);_0x4fc427(_0x251f51);});});}exports[_0x4fcf('0x1a')]=function(_0xefc33e){var _0x32de92=this;return new Promise(function(_0x235555,_0x4dcb18){return db['WhatsappMessage'][_0x4fcf('0x1b')](_0xefc33e[_0x4fcf('0x1c')],{'raw':_0xefc33e['options']?_0xefc33e[_0x4fcf('0x1d')][_0x4fcf('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x481de6){logger[_0x4fcf('0x18')]('CreateWhatsappMessage',_0xefc33e);logger[_0x4fcf('0x1f')](_0x4fcf('0x1a'),_0xefc33e,JSON[_0x4fcf('0x14')](_0x481de6));_0x235555(_0x481de6);})['catch'](function(_0x77e932){logger['error'](_0x4fcf('0x1a'),_0x77e932['message'],_0xefc33e);_0x4dcb18(_0x32de92['error'](0x1f4,_0x77e932['message']));});});}; \ No newline at end of file +var _0x1b8a=['WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateWhatsappMessage','create','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info'];(function(_0x13b7fd,_0x4eaf7f){var _0x32a74a=function(_0x2c5d80){while(--_0x2c5d80){_0x13b7fd['push'](_0x13b7fd['shift']());}};_0x32a74a(++_0x4eaf7f);}(_0x1b8a,0xcd));var _0xa1b8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1b8a[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xa1b8('0x0'));var util=require(_0xa1b8('0x1'));var moment=require(_0xa1b8('0x2'));var BPromise=require(_0xa1b8('0x3'));var rs=require(_0xa1b8('0x4'));var fs=require('fs');var Redis=require(_0xa1b8('0x5'));var db=require(_0xa1b8('0x6'))['db'];var utils=require(_0xa1b8('0x7'));var logger=require('../../config/logger')(_0xa1b8('0x8'));var config=require(_0xa1b8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa1b8('0xa')][_0xa1b8('0xb')]({'port':0x232a});config[_0xa1b8('0xc')]=_['defaults'](config[_0xa1b8('0xc')],{'host':_0xa1b8('0xd'),'port':0x18eb});var socket=require(_0xa1b8('0xe'))(new Redis(config[_0xa1b8('0xc')]));require(_0xa1b8('0xf'))[_0xa1b8('0x10')](socket);function respondWithRpcPromise(_0x42e12b,_0x5afae8,_0x300000){return new BPromise(function(_0xb982be,_0x36371b){return client['request'](_0x42e12b,_0x300000)[_0xa1b8('0x11')](function(_0x7224d3){logger[_0xa1b8('0x12')](_0xa1b8('0x13'),_0x5afae8,_0xa1b8('0x14'));logger[_0xa1b8('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5afae8,_0xa1b8('0x14'),JSON[_0xa1b8('0x16')](_0x7224d3));if(_0x7224d3[_0xa1b8('0x17')]){if(_0x7224d3[_0xa1b8('0x17')][_0xa1b8('0x18')]===0x1f4){logger[_0xa1b8('0x17')](_0xa1b8('0x13'),_0x5afae8,_0x7224d3[_0xa1b8('0x17')][_0xa1b8('0x19')]);return _0x36371b(_0x7224d3[_0xa1b8('0x17')][_0xa1b8('0x19')]);}logger[_0xa1b8('0x17')](_0xa1b8('0x13'),_0x5afae8,_0x7224d3[_0xa1b8('0x17')][_0xa1b8('0x19')]);return _0xb982be(_0x7224d3['error'][_0xa1b8('0x19')]);}else{logger[_0xa1b8('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x5afae8,'request\x20sent');_0xb982be(_0x7224d3[_0xa1b8('0x1a')]['message']);}})['catch'](function(_0x1782c5){logger[_0xa1b8('0x17')](_0xa1b8('0x13'),_0x5afae8,_0x1782c5);_0x36371b(_0x1782c5);});});}exports[_0xa1b8('0x1b')]=function(_0x3f5bfd){var _0x360903=this;return new Promise(function(_0x362931,_0x590623){return db['WhatsappMessage'][_0xa1b8('0x1c')](_0x3f5bfd['body'],{'raw':_0x3f5bfd['options']?_0x3f5bfd[_0xa1b8('0x1d')][_0xa1b8('0x1e')]===undefined?!![]:![]:!![]})[_0xa1b8('0x11')](function(_0x4492fe){logger[_0xa1b8('0x12')](_0xa1b8('0x1b'),_0x3f5bfd);logger[_0xa1b8('0x15')](_0xa1b8('0x1b'),_0x3f5bfd,JSON[_0xa1b8('0x16')](_0x4492fe));_0x362931(_0x4492fe);})[_0xa1b8('0x1f')](function(_0x5e6cda){logger['error'](_0xa1b8('0x1b'),_0x5e6cda['message'],_0x3f5bfd);_0x590623(_0x360903[_0xa1b8('0x17')](0x1f4,_0x5e6cda[_0xa1b8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 1f45d0b..c44a548 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 _0xb19e=['emit','register','length','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x3a2793,_0xa70bb0){var _0xecec9b=function(_0x9927ce){while(--_0x9927ce){_0x3a2793['push'](_0x3a2793['shift']());}};_0xecec9b(++_0xa70bb0);}(_0xb19e,0x100));var _0xeb19=function(_0x239dba,_0x309e95){_0x239dba=_0x239dba-0x0;var _0x1ceb11=_0xb19e[_0x239dba];return _0x1ceb11;};'use strict';var WhatsappMessageEvents=require(_0xeb19('0x0'));var events=[_0xeb19('0x1'),_0xeb19('0x2'),'update'];function createListener(_0x3dfd71,_0x814f43){return function(_0x42b2d3){_0x814f43[_0xeb19('0x3')](_0x3dfd71,_0x42b2d3);};}function removeListener(_0x271e51,_0x59b9b0){return function(){WhatsappMessageEvents['removeListener'](_0x271e51,_0x59b9b0);};}exports[_0xeb19('0x4')]=function(_0x15c62a){for(var _0x2956ec=0x0,_0x5438a0=events[_0xeb19('0x5')];_0x2956ec<_0x5438a0;_0x2956ec++){var _0x419641=events[_0x2956ec];var _0x36e2bf=createListener(_0xeb19('0x6')+_0x419641,_0x15c62a);WhatsappMessageEvents['on'](_0x419641,_0x36e2bf);}}; \ No newline at end of file +var _0xa5b6=['length','whatsappMessage:','./whatsappMessage.events','emit','removeListener','register'];(function(_0x398cb9,_0x248897){var _0x1ada14=function(_0xeb5c5a){while(--_0xeb5c5a){_0x398cb9['push'](_0x398cb9['shift']());}};_0x1ada14(++_0x248897);}(_0xa5b6,0x146));var _0x6a5b=function(_0x1073ad,_0x44bf0b){_0x1073ad=_0x1073ad-0x0;var _0x528474=_0xa5b6[_0x1073ad];return _0x528474;};'use strict';var WhatsappMessageEvents=require(_0x6a5b('0x0'));var events=['save','remove','update'];function createListener(_0x2226e6,_0x3afad5){return function(_0x44d9b4){_0x3afad5[_0x6a5b('0x1')](_0x2226e6,_0x44d9b4);};}function removeListener(_0x2de51d,_0x826a8d){return function(){WhatsappMessageEvents[_0x6a5b('0x2')](_0x2de51d,_0x826a8d);};}exports[_0x6a5b('0x3')]=function(_0x3531e3){for(var _0x53a918=0x0,_0x531222=events[_0x6a5b('0x4')];_0x53a918<_0x531222;_0x53a918++){var _0x52f9a1=events[_0x53a918];var _0x16fe01=createListener(_0x6a5b('0x5')+_0x52f9a1,_0x3531e3);WhatsappMessageEvents['on'](_0x52f9a1,_0x16fe01);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e230e84..9104c3c 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 _0x5e6b=['multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5e6b,0x16c));var _0xb5e6=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x5e6b[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require(_0xb5e6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb5e6('0x1'));var router=express[_0xb5e6('0x2')]();var fs_extra=require(_0xb5e6('0x3'));var auth=require(_0xb5e6('0x4'));var interaction=require(_0xb5e6('0x5'));var config=require(_0xb5e6('0x6'));var controller=require(_0xb5e6('0x7'));router['get']('/',auth[_0xb5e6('0x8')](),controller[_0xb5e6('0x9')]);router[_0xb5e6('0xa')](_0xb5e6('0xb'),auth['isAuthenticated'](),controller[_0xb5e6('0xc')]);router[_0xb5e6('0xa')](_0xb5e6('0xd'),auth[_0xb5e6('0x8')](),controller[_0xb5e6('0xe')]);router[_0xb5e6('0xa')](_0xb5e6('0xf'),auth['isAuthenticated'](),controller[_0xb5e6('0x10')]);router[_0xb5e6('0xa')](_0xb5e6('0x11'),auth[_0xb5e6('0x8')](),controller['getTeams']);router['get']('/:id/users',auth[_0xb5e6('0x8')](),controller[_0xb5e6('0x12')]);router[_0xb5e6('0x13')]('/',auth[_0xb5e6('0x8')](),controller[_0xb5e6('0x14')]);router[_0xb5e6('0x13')](_0xb5e6('0x11'),auth[_0xb5e6('0x8')](),controller[_0xb5e6('0x15')]);router[_0xb5e6('0x13')](_0xb5e6('0x16'),auth[_0xb5e6('0x8')](),controller[_0xb5e6('0x17')]);router[_0xb5e6('0x18')](_0xb5e6('0xd'),auth[_0xb5e6('0x8')](),controller['update']);router[_0xb5e6('0x19')](_0xb5e6('0xd'),auth[_0xb5e6('0x8')](),controller[_0xb5e6('0x1a')]);router[_0xb5e6('0x19')](_0xb5e6('0x11'),auth['isAuthenticated'](),controller[_0xb5e6('0x1b')]);router[_0xb5e6('0x19')](_0xb5e6('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x09be=['index','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','destroy','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated'];(function(_0x7dbc76,_0x64f22d){var _0x3c0ec7=function(_0x4bf00c){while(--_0x4bf00c){_0x7dbc76['push'](_0x7dbc76['shift']());}};_0x3c0ec7(++_0x64f22d);}(_0x09be,0x1cb));var _0xe09b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x09be[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe09b('0x0'));var timeout=require(_0xe09b('0x1'));var express=require(_0xe09b('0x2'));var router=express[_0xe09b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe09b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe09b('0x5'));var controller=require(_0xe09b('0x6'));router[_0xe09b('0x7')]('/',auth[_0xe09b('0x8')](),controller[_0xe09b('0x9')]);router['get'](_0xe09b('0xa'),auth['isAuthenticated'](),controller[_0xe09b('0xb')]);router['get'](_0xe09b('0xc'),auth[_0xe09b('0x8')](),controller['show']);router[_0xe09b('0x7')](_0xe09b('0xd'),auth[_0xe09b('0x8')](),controller['getMembers']);router['get'](_0xe09b('0xe'),auth[_0xe09b('0x8')](),controller[_0xe09b('0xf')]);router[_0xe09b('0x7')](_0xe09b('0x10'),auth[_0xe09b('0x8')](),controller[_0xe09b('0x11')]);router[_0xe09b('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe09b('0x12')](_0xe09b('0xe'),auth[_0xe09b('0x8')](),controller[_0xe09b('0x13')]);router['post'](_0xe09b('0x10'),auth[_0xe09b('0x8')](),controller[_0xe09b('0x14')]);router['put'](_0xe09b('0xc'),auth[_0xe09b('0x8')](),controller[_0xe09b('0x15')]);router[_0xe09b('0x16')](_0xe09b('0xc'),auth[_0xe09b('0x8')](),controller[_0xe09b('0x17')]);router[_0xe09b('0x16')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xe09b('0x16')](_0xe09b('0x10'),auth['isAuthenticated'](),controller[_0xe09b('0x18')]);module[_0xe09b('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index d776ccf..9ab881d 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 _0x3299=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x588186,_0x4de763){var _0xa0adff=function(_0x2fce62){while(--_0x2fce62){_0x588186['push'](_0x588186['shift']());}};_0xa0adff(++_0x4de763);}(_0x3299,0x1bc));var _0x9329=function(_0x3bbf2c,_0xa9a6bb){_0x3bbf2c=_0x3bbf2c-0x0;var _0x39be41=_0x3299[_0x3bbf2c];return _0x39be41;};'use strict';var Sequelize=require('sequelize');module[_0x9329('0x0')]={'name':{'type':Sequelize[_0x9329('0x1')],'unique':_0x9329('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9329('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9329('0x4')](_0x9329('0x5'),_0x9329('0x6'),_0x9329('0x7'))},'description':{'type':Sequelize[_0x9329('0x1')]}}; \ No newline at end of file +var _0xf874=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x1f3b7d,_0x36b4d1){var _0x1d356b=function(_0x329898){while(--_0x329898){_0x1f3b7d['push'](_0x1f3b7d['shift']());}};_0x1d356b(++_0x36b4d1);}(_0xf874,0x177));var _0x4f87=function(_0x558686,_0x57bd81){_0x558686=_0x558686-0x0;var _0x4b0393=_0xf874[_0x558686];return _0x4b0393;};'use strict';var Sequelize=require(_0x4f87('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f87('0x1')],'unique':_0x4f87('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x4f87('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4f87('0x4')](_0x4f87('0x5'),_0x4f87('0x6'),_0x4f87('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 2d0dc72..c0697c1 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 _0xad4c=['redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','limit','set','Content-Range','then','destroy','UserProfileResource','end','error','name','send','index','rawAttributes','fieldName','type','key','getOptions','where','count','include','WhatsappQueue','findAll','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','catch','update','params','describe','getMembers','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','filter','options','findAndCountAll','map','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','whatsappPause','findOne','Team','pick','getTeams','ids','User','Agents','online','sequelize','transaction','each','findOrCreate','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','QueryTypes','SELECT','TeamId','all','union','compact','isEmpty','forEach','emit','userWhatsappQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb'];(function(_0x20494e,_0x274e71){var _0x28f4ae=function(_0x357f33){while(--_0x357f33){_0x20494e['push'](_0x20494e['shift']());}};_0x28f4ae(++_0x274e71);}(_0xad4c,0x15f));var _0xcad4=function(_0x47e8b4,_0x29cb6d){_0x47e8b4=_0x47e8b4-0x0;var _0x87a99f=_0xad4c[_0x47e8b4];return _0x87a99f;};'use strict';var BPromise=require(_0xcad4('0x0'));var util=require(_0xcad4('0x1'));var _=require(_0xcad4('0x2'));var squel=require(_0xcad4('0x3'));var Redis=require(_0xcad4('0x4'));var qs=require(_0xcad4('0x5'));var logger=require(_0xcad4('0x6'))(_0xcad4('0x7'));var config=require('../../config/environment');var db=require(_0xcad4('0x8'))['db'];config[_0xcad4('0x9')]=_[_0xcad4('0xa')](config[_0xcad4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xcad4('0xb'))(new Redis(config[_0xcad4('0x9')]));require('./whatsappQueue.socket')[_0xcad4('0xc')](socket);function respondWithStatusCode(_0x44c319,_0x2e10bd){_0x2e10bd=_0x2e10bd||0xcc;return function(_0x2ae015){if(_0x2ae015){return _0x44c319[_0xcad4('0xd')](_0x2e10bd);}return _0x44c319[_0xcad4('0xe')](_0x2e10bd)['end']();};}function respondWithResult(_0x479c5f,_0x14220e){_0x14220e=_0x14220e||0xc8;return function(_0x231eb2){if(_0x231eb2){return _0x479c5f['status'](_0x14220e)[_0xcad4('0xf')](_0x231eb2);}};}function respondWithFilteredResult(_0x337956,_0x47941b){return function(_0x713edc){if(_0x713edc){var _0x4df6a8=typeof _0x47941b[_0xcad4('0x10')]==='undefined'&&typeof _0x47941b['limit']==='undefined';var _0x31d91a=_0x713edc['count'];var _0xcfa937=_0x4df6a8?0x0:_0x47941b['offset'];var _0x2f4c50=_0x4df6a8?_0x713edc['count']:_0x47941b[_0xcad4('0x10')]+_0x47941b[_0xcad4('0x11')];var _0x5ec4f4;if(_0x2f4c50>=_0x31d91a){_0x2f4c50=_0x31d91a;_0x5ec4f4=0xc8;}else{_0x5ec4f4=0xce;}_0x337956[_0xcad4('0xe')](_0x5ec4f4);return _0x337956[_0xcad4('0x12')](_0xcad4('0x13'),_0xcfa937+'-'+_0x2f4c50+'/'+_0x31d91a)['json'](_0x713edc);}return null;};}function saveUpdates(_0x2116de){return function(_0x50783b){if(_0x50783b){return _0x50783b['update'](_0x2116de)[_0xcad4('0x14')](function(_0x18609d){return _0x18609d;});}return null;};}function removeEntity(_0x4f4f2e){return function(_0xe294ca){if(_0xe294ca){return _0xe294ca[_0xcad4('0x15')]()[_0xcad4('0x14')](function(){var _0x5246e0=_0xe294ca['get']({'plain':!![]});var _0x112c1f='WhatsappQueues';return db[_0xcad4('0x16')][_0xcad4('0x15')]({'where':{'type':_0x112c1f,'resourceId':_0x5246e0['id']}})['then'](function(){return _0xe294ca;});})['then'](function(){_0x4f4f2e[_0xcad4('0xe')](0xcc)[_0xcad4('0x17')]();});}};}function handleEntityNotFound(_0x1d6cda){return function(_0x39b455){if(!_0x39b455){_0x1d6cda[_0xcad4('0xd')](0x194);}return _0x39b455;};}function handleError(_0x126e74,_0x388c93){_0x388c93=_0x388c93||0x1f4;return function(_0xc9c85e){logger[_0xcad4('0x18')](_0xc9c85e['stack']);if(_0xc9c85e[_0xcad4('0x19')]){delete _0xc9c85e['name'];}_0x126e74[_0xcad4('0xe')](_0x388c93)[_0xcad4('0x1a')](_0xc9c85e);};}exports[_0xcad4('0x1b')]=function(_0x11f9bc,_0x3872eb){var _0x2ad512={};var _0x3ed465={'count':0x0,'rows':[]};var _0x39a3a0=_['map'](db['WhatsappQueue'][_0xcad4('0x1c')],function(_0x50653e){return{'name':_0x50653e[_0xcad4('0x1d')],'type':_0x50653e[_0xcad4('0x1e')][_0xcad4('0x1f')]};});_0x2ad512=qs[_0xcad4('0x20')](_0x39a3a0,_0x11f9bc);var _0x45bc47={'where':_0x2ad512[_0xcad4('0x21')]};return db['WhatsappQueue'][_0xcad4('0x22')](_0x45bc47)[_0xcad4('0x14')](function(_0x5a0eef){_0x3ed465[_0xcad4('0x22')]=_0x5a0eef;_0x2ad512[_0xcad4('0x23')]=qs[_0xcad4('0x23')](_0x11f9bc['query']);return db[_0xcad4('0x24')][_0xcad4('0x25')](_0x2ad512);})[_0xcad4('0x14')](function(_0xf54775){_0x3ed465['rows']=_0xf54775;return _0x3ed465;})[_0xcad4('0x14')](respondWithFilteredResult(_0x3872eb,_0x2ad512))['catch'](handleError(_0x3872eb,null));};exports[_0xcad4('0x26')]=function(_0x16767c,_0x5ac4e0){var _0x13d4a3={'raw':!![],'where':{'id':_0x16767c['params']['id']}},_0x7c0e6e={};_0x7c0e6e['model']=_[_0xcad4('0x27')](db['WhatsappQueue'][_0xcad4('0x1c')]);_0x7c0e6e[_0xcad4('0x28')]=_[_0xcad4('0x27')](_0x16767c[_0xcad4('0x28')]);_0x7c0e6e[_0xcad4('0x29')]=_[_0xcad4('0x2a')](_0x7c0e6e[_0xcad4('0x2b')],_0x7c0e6e[_0xcad4('0x28')]);_0x13d4a3[_0xcad4('0x2c')]=_[_0xcad4('0x2a')](_0x7c0e6e[_0xcad4('0x2b')],qs['fields'](_0x16767c['query'][_0xcad4('0x2d')]));_0x13d4a3[_0xcad4('0x2c')]=_0x13d4a3[_0xcad4('0x2c')][_0xcad4('0x2e')]?_0x13d4a3[_0xcad4('0x2c')]:_0x7c0e6e[_0xcad4('0x2b')];if(_0x16767c[_0xcad4('0x28')][_0xcad4('0x2f')]){_0x13d4a3[_0xcad4('0x23')]=[{'all':!![]}];}_0x13d4a3=_[_0xcad4('0x30')]({},_0x13d4a3,_0x16767c['options']);return db[_0xcad4('0x24')][_0xcad4('0x31')](_0x13d4a3)['then'](handleEntityNotFound(_0x5ac4e0,null))[_0xcad4('0x14')](respondWithResult(_0x5ac4e0,null))['catch'](handleError(_0x5ac4e0,null));};exports[_0xcad4('0x32')]=function(_0x21454c,_0x1b063e){return db['WhatsappQueue'][_0xcad4('0x32')](_0x21454c[_0xcad4('0x33')],{})[_0xcad4('0x14')](function(_0x57eacf){var _0x20514d=_0x21454c[_0xcad4('0x34')][_0xcad4('0x35')]({'plain':!![]});if(!_0x20514d)throw new Error(_0xcad4('0x36'));if(_0x20514d[_0xcad4('0x37')]===_0xcad4('0x34')){var _0x1bdb62=_0x57eacf[_0xcad4('0x35')]({'plain':!![]});var _0x1b4db9=_0xcad4('0x38');return db[_0xcad4('0x39')][_0xcad4('0x31')]({'where':{'name':_0x1b4db9,'userProfileId':_0x20514d[_0xcad4('0x3a')]},'raw':!![]})[_0xcad4('0x14')](function(_0x32fefc){if(_0x32fefc&&_0x32fefc[_0xcad4('0x3b')]===0x0){return db[_0xcad4('0x16')]['create']({'name':_0x1bdb62[_0xcad4('0x19')],'resourceId':_0x1bdb62['id'],'type':_0x32fefc[_0xcad4('0x19')],'sectionId':_0x32fefc['id']},{})[_0xcad4('0x14')](function(){return _0x57eacf;});}else{return _0x57eacf;}})[_0xcad4('0x3c')](function(_0x317c01){logger[_0xcad4('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x317c01);throw _0x317c01;});}return _0x57eacf;})[_0xcad4('0x14')](respondWithResult(_0x1b063e,0xc9))['catch'](handleError(_0x1b063e,null));};exports[_0xcad4('0x3d')]=function(_0x1e6540,_0x293e31){if(_0x1e6540['body']['id']){delete _0x1e6540[_0xcad4('0x33')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x1e6540[_0xcad4('0x3e')]['id']}})[_0xcad4('0x14')](handleEntityNotFound(_0x293e31,null))[_0xcad4('0x14')](saveUpdates(_0x1e6540[_0xcad4('0x33')],null))[_0xcad4('0x14')](respondWithResult(_0x293e31,null))[_0xcad4('0x3c')](handleError(_0x293e31,null));};exports['destroy']=function(_0x5b2978,_0x2015b8){return db[_0xcad4('0x24')][_0xcad4('0x31')]({'where':{'id':_0x5b2978['params']['id']}})[_0xcad4('0x14')](handleEntityNotFound(_0x2015b8,null))['then'](removeEntity(_0x2015b8,null))[_0xcad4('0x3c')](handleError(_0x2015b8,null));};exports[_0xcad4('0x3f')]=function(_0x329ae2,_0xd7616d){return db['WhatsappQueue'][_0xcad4('0x3f')]()[_0xcad4('0x14')](respondWithResult(_0xd7616d,null))[_0xcad4('0x3c')](handleError(_0xd7616d,null));};exports[_0xcad4('0x40')]=function(_0x4f4a1f,_0x51a98d){var _0x18c2d8={'raw':!![],'where':{}},_0x41efc3={},_0x25d9ff;return db[_0xcad4('0x24')]['findOne']({'where':{'id':_0x4f4a1f[_0xcad4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x51a98d,null))[_0xcad4('0x14')](function(_0x5e8759){if(_0x5e8759){_0x25d9ff=_0x5e8759[_0xcad4('0x35')]({'plain':!![]});_0x41efc3[_0xcad4('0x2b')]=_[_0xcad4('0x27')](db[_0xcad4('0x41')]['rawAttributes']);_0x41efc3[_0xcad4('0x28')]=_['keys'](_0x4f4a1f['query']);_0x41efc3[_0xcad4('0x29')]=_[_0xcad4('0x2a')](_0x41efc3[_0xcad4('0x2b')],_0x41efc3[_0xcad4('0x28')]);_0x18c2d8[_0xcad4('0x2c')]=_[_0xcad4('0x2a')](_0x41efc3[_0xcad4('0x2b')],qs[_0xcad4('0x2d')](_0x4f4a1f[_0xcad4('0x28')]['fields']));_0x18c2d8[_0xcad4('0x2c')]=_0x18c2d8['attributes'][_0xcad4('0x2e')]?_0x18c2d8[_0xcad4('0x2c')]:_0x41efc3['model'];if(!_0x4f4a1f[_0xcad4('0x28')][_0xcad4('0x42')](_0xcad4('0x43'))){_0x18c2d8[_0xcad4('0x11')]=qs['limit'](_0x4f4a1f[_0xcad4('0x28')][_0xcad4('0x11')]);_0x18c2d8[_0xcad4('0x10')]=qs[_0xcad4('0x10')](_0x4f4a1f[_0xcad4('0x28')][_0xcad4('0x10')]);}_0x18c2d8[_0xcad4('0x44')]=qs[_0xcad4('0x45')](_0x4f4a1f[_0xcad4('0x28')][_0xcad4('0x45')]);_0x18c2d8[_0xcad4('0x21')]=qs[_0xcad4('0x29')](_['pick'](_0x4f4a1f[_0xcad4('0x28')],_0x41efc3[_0xcad4('0x29')]));_0x18c2d8[_0xcad4('0x21')]['WhatsappQueueId']=_0x5e8759['id'];if(_0x4f4a1f[_0xcad4('0x28')][_0xcad4('0x46')]){_0x18c2d8['where']=_[_0xcad4('0x30')](_0x18c2d8[_0xcad4('0x21')],{'$or':_['map'](_0x18c2d8[_0xcad4('0x2c')],function(_0x4ee33f){var _0x2e98db={};_0x2e98db[_0x4ee33f]={'$like':'%'+_0x4f4a1f[_0xcad4('0x28')][_0xcad4('0x46')]+'%'};return _0x2e98db;})});}_0x18c2d8=_[_0xcad4('0x30')]({},_0x18c2d8,_0x4f4a1f[_0xcad4('0x47')]);return db[_0xcad4('0x41')][_0xcad4('0x25')](_0x18c2d8);}})[_0xcad4('0x14')](function(_0x4c07cd){if(_0x4c07cd){return db['User'][_0xcad4('0x48')]({'where':{'id':_[_0xcad4('0x49')](_0x4c07cd,_0xcad4('0x4a')),'role':_0xcad4('0x4b')},'attributes':['id','name','whatsappPause',_0xcad4('0x4c'),_0xcad4('0x4d')]});}})[_0xcad4('0x14')](function(_0x1fc244){if(_0x1fc244){return{'count':_0x1fc244['count'],'rows':_[_0xcad4('0x49')](_0x1fc244[_0xcad4('0x4e')],function(_0xb5dd50){return{'membername':_0xb5dd50[_0xcad4('0x19')],'UserId':_0xb5dd50['id'],'queue_name':_0x25d9ff[_0xcad4('0x19')],'WhatsappQueueId':_0x25d9ff['id'],'interface':util[_0xcad4('0x4f')](_0xcad4('0x50'),'SIP',_0xb5dd50['name']),'penalty':0x0,'paused':_0xb5dd50[_0xcad4('0x51')],'createdAt':_0xb5dd50['createdAt'],'updatedAt':_0xb5dd50[_0xcad4('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcad4('0x14')](respondWithFilteredResult(_0x51a98d,_0x18c2d8))['catch'](handleError(_0x51a98d,null));};exports['getTeams']=function(_0x11c884,_0x371345){var _0x3e7b9d={};var _0x5e79cf={};var _0x2345d9;var _0x2d9e91;return db[_0xcad4('0x24')][_0xcad4('0x52')]({'where':{'id':_0x11c884['params']['id']}})['then'](handleEntityNotFound(_0x371345,null))['then'](function(_0x53a2bd){if(_0x53a2bd){_0x2345d9=_0x53a2bd;_0x5e79cf[_0xcad4('0x2b')]=_[_0xcad4('0x27')](db[_0xcad4('0x53')][_0xcad4('0x1c')]);_0x5e79cf[_0xcad4('0x28')]=_['keys'](_0x11c884[_0xcad4('0x28')]);_0x5e79cf['filters']=_[_0xcad4('0x2a')](_0x5e79cf[_0xcad4('0x2b')],_0x5e79cf['query']);_0x3e7b9d[_0xcad4('0x2c')]=_[_0xcad4('0x2a')](_0x5e79cf[_0xcad4('0x2b')],qs[_0xcad4('0x2d')](_0x11c884['query'][_0xcad4('0x2d')]));_0x3e7b9d['attributes']=_0x3e7b9d[_0xcad4('0x2c')]['length']?_0x3e7b9d[_0xcad4('0x2c')]:_0x5e79cf[_0xcad4('0x2b')];_0x3e7b9d['order']=qs[_0xcad4('0x45')](_0x11c884[_0xcad4('0x28')][_0xcad4('0x45')]);_0x3e7b9d[_0xcad4('0x21')]=qs[_0xcad4('0x29')](_[_0xcad4('0x54')](_0x11c884[_0xcad4('0x28')],_0x5e79cf[_0xcad4('0x29')]));if(_0x11c884[_0xcad4('0x28')][_0xcad4('0x46')]){_0x3e7b9d[_0xcad4('0x21')]=_[_0xcad4('0x30')](_0x3e7b9d[_0xcad4('0x21')],{'$or':_[_0xcad4('0x49')](_0x3e7b9d[_0xcad4('0x2c')],function(_0x567b36){var _0x243183={};_0x243183[_0x567b36]={'$like':'%'+_0x11c884[_0xcad4('0x28')][_0xcad4('0x46')]+'%'};return _0x243183;})});}_0x3e7b9d=_[_0xcad4('0x30')]({},_0x3e7b9d,_0x11c884['options']);return _0x2345d9[_0xcad4('0x55')](_0x3e7b9d);}})[_0xcad4('0x14')](function(_0x56e69d){if(_0x56e69d){_0x2d9e91=_0x56e69d[_0xcad4('0x2e')];if(!_0x11c884[_0xcad4('0x28')][_0xcad4('0x42')]('nolimit')){_0x3e7b9d[_0xcad4('0x11')]=qs['limit'](_0x11c884[_0xcad4('0x28')]['limit']);_0x3e7b9d[_0xcad4('0x10')]=qs[_0xcad4('0x10')](_0x11c884[_0xcad4('0x28')]['offset']);}return _0x2345d9[_0xcad4('0x55')](_0x3e7b9d);}})[_0xcad4('0x14')](function(_0x5912a9){if(_0x5912a9){return _0x5912a9?{'count':_0x2d9e91,'rows':_0x5912a9}:null;}})[_0xcad4('0x14')](respondWithResult(_0x371345,null))[_0xcad4('0x3c')](handleError(_0x371345,null));};exports['addTeams']=function(_0x47828f,_0x11d47f){var _0x344cd6=_0x47828f[_0xcad4('0x33')][_0xcad4('0x56')];return db[_0xcad4('0x53')][_0xcad4('0x25')]({'where':{'id':_0x344cd6},'attributes':['id'],'include':[{'model':db[_0xcad4('0x57')],'as':_0xcad4('0x58'),'attributes':['id',_0xcad4('0x19'),_0xcad4('0x59'),'voicePause','interface'],'raw':!![]}]})[_0xcad4('0x14')](function(_0x376c45){if(_0x376c45){var _0x3938fc=_['flatMap'](_0x376c45,function(_0x5bcb54){var _0x570def=_0x5bcb54[_0xcad4('0x35')]({'plain':!![]});return _0x570def['Agents'];});return db[_0xcad4('0x24')][_0xcad4('0x31')]({'where':{'id':_0x47828f['params']['id']}})[_0xcad4('0x14')](function(_0x97b33d){return db[_0xcad4('0x5a')][_0xcad4('0x5b')](function(_0x4f442b){return _0x97b33d['addTeams'](_0x344cd6,{'transaction':_0x4f442b})[_0xcad4('0x14')](function(){return BPromise[_0xcad4('0x5c')](_0x3938fc,function(_0x1a7ea0){return db['UserWhatsappQueue'][_0xcad4('0x5d')]({'where':{'UserId':_0x1a7ea0['id'],'WhatsappQueueId':_0x47828f[_0xcad4('0x3e')]['id']},'transaction':_0x4f442b});});})['then'](function(){_0x3938fc['forEach'](function(_0xcba9f9){socket['emit'](_0xcad4('0x5e'),{'UserId':_0xcba9f9['id'],'WhatsappQueueId':_0x97b33d['id']});});});});});}})['then'](respondWithStatusCode(_0x11d47f,null))['catch'](handleError(_0x11d47f,null));};exports[_0xcad4('0x5f')]=function(_0x4fce10,_0x68bf2){return db[_0xcad4('0x53')][_0xcad4('0x25')]({'where':{'id':_0x4fce10['query'][_0xcad4('0x56')]},'attributes':['id'],'include':[{'model':db[_0xcad4('0x57')],'as':_0xcad4('0x58'),'attributes':['id'],'raw':!![]}]})[_0xcad4('0x14')](handleEntityNotFound(_0x68bf2,null))[_0xcad4('0x14')](function(_0x10196b){var _0x4e2a0b=_[_0xcad4('0x49')](_0x10196b,'id');var _0x462d61=[];var _0x37936c=[];var _0x398585=squel[_0xcad4('0x60')]();_0x398585['field'](_0xcad4('0x61'))[_0xcad4('0x62')](_0xcad4('0x63'),'tq')[_0xcad4('0x64')](_0xcad4('0x65'),'ut',_0xcad4('0x66'))[_0xcad4('0x21')](_0xcad4('0x67'),_0x4fce10[_0xcad4('0x3e')]['id']);for(var _0x446183=0x0;_0x446183<_0x10196b[_0xcad4('0x2e')];_0x446183+=0x1){let _0x28da9b=_0x10196b[_0x446183];for(var _0x2a2139=0x0;_0x2a2139<_0x28da9b[_0xcad4('0x58')][_0xcad4('0x2e')];_0x2a2139+=0x1){let _0x49d164=_0x28da9b[_0xcad4('0x58')][_0x2a2139];var _0x5b2323=_0x398585[_0xcad4('0x68')]();_0x5b2323['where']('ut.UserId\x20=\x20?',_0x49d164['id']);_0x37936c['push'](db[_0xcad4('0x5a')][_0xcad4('0x28')](_0x5b2323['toString'](),{'type':db['sequelize'][_0xcad4('0x69')][_0xcad4('0x6a')]})['then'](function(_0xd03d7){if(_0xd03d7[_0xcad4('0x2e')]===0x1){return _0x49d164['id'];}else{var _0x133210=_['every'](_[_0xcad4('0x49')](_0xd03d7,_0xcad4('0x6b')),function(_0x2aae66){return _['includes'](_0x4e2a0b,_0x2aae66);});if(_0x133210){return _0x49d164['id'];}}}));}}return BPromise[_0xcad4('0x6c')](_0x37936c)[_0xcad4('0x14')](function(_0x449ce0){_0x462d61=_(_0x462d61)[_0xcad4('0x6d')](_0x449ce0)[_0xcad4('0x6e')]()['value']();return db[_0xcad4('0x24')]['find']({'where':{'id':_0x4fce10[_0xcad4('0x3e')]['id']}})[_0xcad4('0x14')](function(_0x5b9a14){return db[_0xcad4('0x5a')][_0xcad4('0x5b')](function(_0xa4fce7){return _0x5b9a14[_0xcad4('0x5f')](_0x4fce10[_0xcad4('0x28')][_0xcad4('0x56')],{'transaction':_0xa4fce7})[_0xcad4('0x14')](function(){if(!_[_0xcad4('0x6f')](_0x462d61)){return _0x5b9a14['removeAgents'](_0x462d61,{'transaction':_0xa4fce7});}})['then'](function(){_0x462d61[_0xcad4('0x70')](function(_0xaddf7c){socket[_0xcad4('0x71')](_0xcad4('0x72'),{'UserId':_0xaddf7c,'WhatsappQueueId':_0x5b9a14['id']});});});});});});})[_0xcad4('0x14')](respondWithStatusCode(_0x68bf2,null))[_0xcad4('0x3c')](handleError(_0x68bf2,null));};exports[_0xcad4('0x73')]=function(_0xa68e4c,_0x522be8){return db['WhatsappQueue'][_0xcad4('0x31')]({'where':{'id':_0xa68e4c[_0xcad4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x522be8,null))['then'](function(_0x207fd9){if(_0x207fd9){return _0x207fd9[_0xcad4('0x73')](_0xa68e4c['body'][_0xcad4('0x56')],_[_0xcad4('0x74')](_0xa68e4c['body'],['ids','id'])||{})['spread'](function(_0x55798a){for(var _0x2c111f=0x0;_0x2c111f<_0xa68e4c['body'][_0xcad4('0x56')][_0xcad4('0x2e')];_0x2c111f+=0x1){socket[_0xcad4('0x71')](_0xcad4('0x5e'),{'UserId':Number(_0xa68e4c[_0xcad4('0x33')][_0xcad4('0x56')][_0x2c111f]),'WhatsappQueueId':Number(_0xa68e4c[_0xcad4('0x3e')]['id'])});}return _0x55798a;});}})[_0xcad4('0x14')](respondWithResult(_0x522be8,null))[_0xcad4('0x3c')](handleError(_0x522be8,null));};exports[_0xcad4('0x75')]=function(_0x30b853,_0x552859){return db['WhatsappQueue'][_0xcad4('0x31')]({'where':{'id':_0x30b853[_0xcad4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x552859,null))['then'](function(_0x102915){if(_0x102915){return _0x102915['removeAgents'](_0x30b853[_0xcad4('0x28')][_0xcad4('0x56')])[_0xcad4('0x14')](function(){if(_[_0xcad4('0x76')](_0x30b853[_0xcad4('0x28')][_0xcad4('0x56')])){for(var _0x1b251a=0x0;_0x1b251a<_0x30b853[_0xcad4('0x28')]['ids'][_0xcad4('0x2e')];_0x1b251a+=0x1){socket[_0xcad4('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x30b853['query']['ids'][_0x1b251a]),'WhatsappQueueId':Number(_0x30b853[_0xcad4('0x3e')]['id'])});}}else{socket[_0xcad4('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x30b853['query'][_0xcad4('0x56')]),'WhatsappQueueId':Number(_0x30b853[_0xcad4('0x3e')]['id'])});}});}})[_0xcad4('0x14')](respondWithStatusCode(_0x552859,null))[_0xcad4('0x3c')](handleError(_0x552859,null));};exports[_0xcad4('0x77')]=function(_0x30b342,_0x2daafa){var _0x2f0718={};var _0x110058={};var _0x591dc8;var _0x5d659b;return db['WhatsappQueue']['findOne']({'where':{'id':_0x30b342[_0xcad4('0x3e')]['id']}})[_0xcad4('0x14')](handleEntityNotFound(_0x2daafa,null))['then'](function(_0x3d096e){if(_0x3d096e){_0x591dc8=_0x3d096e;_0x110058['model']=_[_0xcad4('0x27')](db['User'][_0xcad4('0x1c')]);_0x110058[_0xcad4('0x28')]=_[_0xcad4('0x27')](_0x30b342[_0xcad4('0x28')]);_0x110058['filters']=_[_0xcad4('0x2a')](_0x110058[_0xcad4('0x2b')],_0x110058[_0xcad4('0x28')]);_0x2f0718[_0xcad4('0x2c')]=_[_0xcad4('0x2a')](_0x110058[_0xcad4('0x2b')],qs[_0xcad4('0x2d')](_0x30b342[_0xcad4('0x28')]['fields']));_0x2f0718[_0xcad4('0x2c')]=_0x2f0718[_0xcad4('0x2c')]['length']?_0x2f0718[_0xcad4('0x2c')]:_0x110058[_0xcad4('0x2b')];_0x2f0718[_0xcad4('0x44')]=qs['sort'](_0x30b342['query'][_0xcad4('0x45')]);_0x2f0718[_0xcad4('0x21')]=qs[_0xcad4('0x29')](_[_0xcad4('0x54')](_0x30b342[_0xcad4('0x28')],_0x110058['filters']));if(_0x30b342[_0xcad4('0x28')][_0xcad4('0x46')]){_0x2f0718['where']=_[_0xcad4('0x30')](_0x2f0718[_0xcad4('0x21')],{'$or':_[_0xcad4('0x49')](_0x2f0718['attributes'],function(_0xdd9499){var _0x33a471={};_0x33a471[_0xdd9499]={'$like':'%'+_0x30b342[_0xcad4('0x28')][_0xcad4('0x46')]+'%'};return _0x33a471;})});}_0x2f0718=_[_0xcad4('0x30')]({},_0x2f0718,_0x30b342[_0xcad4('0x47')]);return _0x591dc8[_0xcad4('0x77')](_0x2f0718);}})[_0xcad4('0x14')](function(_0x1d4e01){if(_0x1d4e01){_0x5d659b=_0x1d4e01[_0xcad4('0x2e')];if(!_0x30b342['query'][_0xcad4('0x42')]('nolimit')){_0x2f0718[_0xcad4('0x11')]=qs[_0xcad4('0x11')](_0x30b342['query'][_0xcad4('0x11')]);_0x2f0718[_0xcad4('0x10')]=qs[_0xcad4('0x10')](_0x30b342[_0xcad4('0x28')][_0xcad4('0x10')]);}return _0x591dc8[_0xcad4('0x77')](_0x2f0718);}})[_0xcad4('0x14')](function(_0xf6c85e){if(_0xf6c85e){return _0xf6c85e?{'count':_0x5d659b,'rows':_0xf6c85e}:null;}})[_0xcad4('0x14')](respondWithResult(_0x2daafa,null))['catch'](handleError(_0x2daafa,null));}; \ No newline at end of file +var _0x7fda=['Content-Range','then','destroy','get','WhatsappQueues','sendStatus','stack','name','index','map','WhatsappQueue','fieldName','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','rawAttributes','filters','model','attributes','intersection','fields','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','User','findAndCountAll','agent','createdAt','format','%s/%s','whatsappPause','pick','filter','getTeams','length','addTeams','ids','Team','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','end','status','json','offset','undefined','limit','count','set'];(function(_0x21f089,_0x5ebacd){var _0x59c5e7=function(_0x2af336){while(--_0x2af336){_0x21f089['push'](_0x21f089['shift']());}};_0x59c5e7(++_0x5ebacd);}(_0x7fda,0xdb));var _0xa7fd=function(_0x20e33d,_0x524edd){_0x20e33d=_0x20e33d-0x0;var _0x444e99=_0x7fda[_0x20e33d];return _0x444e99;};'use strict';var BPromise=require(_0xa7fd('0x0'));var util=require(_0xa7fd('0x1'));var _=require(_0xa7fd('0x2'));var squel=require('squel');var Redis=require(_0xa7fd('0x3'));var qs=require(_0xa7fd('0x4'));var logger=require(_0xa7fd('0x5'))(_0xa7fd('0x6'));var config=require(_0xa7fd('0x7'));var db=require(_0xa7fd('0x8'))['db'];config[_0xa7fd('0x9')]=_['defaults'](config[_0xa7fd('0x9')],{'host':_0xa7fd('0xa'),'port':0x18eb});var socket=require(_0xa7fd('0xb'))(new Redis(config[_0xa7fd('0x9')]));require(_0xa7fd('0xc'))['register'](socket);function respondWithStatusCode(_0x50203b,_0x1001c5){_0x1001c5=_0x1001c5||0xcc;return function(_0xf9c08d){if(_0xf9c08d){return _0x50203b['sendStatus'](_0x1001c5);}return _0x50203b['status'](_0x1001c5)[_0xa7fd('0xd')]();};}function respondWithResult(_0x21f5eb,_0x20e761){_0x20e761=_0x20e761||0xc8;return function(_0x379709){if(_0x379709){return _0x21f5eb[_0xa7fd('0xe')](_0x20e761)[_0xa7fd('0xf')](_0x379709);}};}function respondWithFilteredResult(_0x17e73c,_0x32bab3){return function(_0x6381e7){if(_0x6381e7){var _0x5553dd=typeof _0x32bab3[_0xa7fd('0x10')]===_0xa7fd('0x11')&&typeof _0x32bab3[_0xa7fd('0x12')]===_0xa7fd('0x11');var _0x2af927=_0x6381e7[_0xa7fd('0x13')];var _0x42dbd8=_0x5553dd?0x0:_0x32bab3[_0xa7fd('0x10')];var _0x217f58=_0x5553dd?_0x6381e7[_0xa7fd('0x13')]:_0x32bab3['offset']+_0x32bab3[_0xa7fd('0x12')];var _0x11b472;if(_0x217f58>=_0x2af927){_0x217f58=_0x2af927;_0x11b472=0xc8;}else{_0x11b472=0xce;}_0x17e73c['status'](_0x11b472);return _0x17e73c[_0xa7fd('0x14')](_0xa7fd('0x15'),_0x42dbd8+'-'+_0x217f58+'/'+_0x2af927)[_0xa7fd('0xf')](_0x6381e7);}return null;};}function saveUpdates(_0x489a00){return function(_0x36557f){if(_0x36557f){return _0x36557f['update'](_0x489a00)[_0xa7fd('0x16')](function(_0x40f206){return _0x40f206;});}return null;};}function removeEntity(_0x5588c0){return function(_0x371e9c){if(_0x371e9c){return _0x371e9c[_0xa7fd('0x17')]()[_0xa7fd('0x16')](function(){var _0x13cf01=_0x371e9c[_0xa7fd('0x18')]({'plain':!![]});var _0x19c040=_0xa7fd('0x19');return db['UserProfileResource'][_0xa7fd('0x17')]({'where':{'type':_0x19c040,'resourceId':_0x13cf01['id']}})[_0xa7fd('0x16')](function(){return _0x371e9c;});})[_0xa7fd('0x16')](function(){_0x5588c0[_0xa7fd('0xe')](0xcc)[_0xa7fd('0xd')]();});}};}function handleEntityNotFound(_0x182c2d){return function(_0x599508){if(!_0x599508){_0x182c2d[_0xa7fd('0x1a')](0x194);}return _0x599508;};}function handleError(_0x9b15bb,_0x3e0457){_0x3e0457=_0x3e0457||0x1f4;return function(_0x2deb51){logger['error'](_0x2deb51[_0xa7fd('0x1b')]);if(_0x2deb51[_0xa7fd('0x1c')]){delete _0x2deb51[_0xa7fd('0x1c')];}_0x9b15bb[_0xa7fd('0xe')](_0x3e0457)['send'](_0x2deb51);};}exports[_0xa7fd('0x1d')]=function(_0x343d32,_0x130fd5){var _0x1fc833={};var _0x402af1={'count':0x0,'rows':[]};var _0x46ed7b=_[_0xa7fd('0x1e')](db[_0xa7fd('0x1f')]['rawAttributes'],function(_0x3f303a){return{'name':_0x3f303a[_0xa7fd('0x20')],'type':_0x3f303a['type'][_0xa7fd('0x21')]};});_0x1fc833=qs[_0xa7fd('0x22')](_0x46ed7b,_0x343d32);var _0x1cee3b={'where':_0x1fc833[_0xa7fd('0x23')]};return db[_0xa7fd('0x1f')][_0xa7fd('0x13')](_0x1cee3b)[_0xa7fd('0x16')](function(_0x102963){_0x402af1[_0xa7fd('0x13')]=_0x102963;_0x1fc833[_0xa7fd('0x24')]=qs[_0xa7fd('0x24')](_0x343d32[_0xa7fd('0x25')]);return db[_0xa7fd('0x1f')][_0xa7fd('0x26')](_0x1fc833);})[_0xa7fd('0x16')](function(_0x59c099){_0x402af1[_0xa7fd('0x27')]=_0x59c099;return _0x402af1;})['then'](respondWithFilteredResult(_0x130fd5,_0x1fc833))[_0xa7fd('0x28')](handleError(_0x130fd5,null));};exports[_0xa7fd('0x29')]=function(_0x562f39,_0x1b5909){var _0x1265d5={'raw':!![],'where':{'id':_0x562f39[_0xa7fd('0x2a')]['id']}},_0xd9eff={};_0xd9eff['model']=_[_0xa7fd('0x2b')](db[_0xa7fd('0x1f')][_0xa7fd('0x2c')]);_0xd9eff[_0xa7fd('0x25')]=_[_0xa7fd('0x2b')](_0x562f39[_0xa7fd('0x25')]);_0xd9eff[_0xa7fd('0x2d')]=_['intersection'](_0xd9eff[_0xa7fd('0x2e')],_0xd9eff['query']);_0x1265d5[_0xa7fd('0x2f')]=_[_0xa7fd('0x30')](_0xd9eff[_0xa7fd('0x2e')],qs['fields'](_0x562f39['query'][_0xa7fd('0x31')]));_0x1265d5['attributes']=_0x1265d5[_0xa7fd('0x2f')]['length']?_0x1265d5['attributes']:_0xd9eff[_0xa7fd('0x2e')];if(_0x562f39['query']['includeAll']){_0x1265d5[_0xa7fd('0x24')]=[{'all':!![]}];}_0x1265d5=_[_0xa7fd('0x32')]({},_0x1265d5,_0x562f39[_0xa7fd('0x33')]);return db[_0xa7fd('0x1f')]['find'](_0x1265d5)[_0xa7fd('0x16')](handleEntityNotFound(_0x1b5909,null))['then'](respondWithResult(_0x1b5909,null))['catch'](handleError(_0x1b5909,null));};exports['create']=function(_0x3fc782,_0x4cb902){return db[_0xa7fd('0x1f')][_0xa7fd('0x34')](_0x3fc782[_0xa7fd('0x35')],{})[_0xa7fd('0x16')](function(_0x1b0d16){var _0x463e2c=_0x3fc782[_0xa7fd('0x36')][_0xa7fd('0x18')]({'plain':!![]});if(!_0x463e2c)throw new Error(_0xa7fd('0x37'));if(_0x463e2c[_0xa7fd('0x38')]===_0xa7fd('0x36')){var _0x5cded9=_0x1b0d16['get']({'plain':!![]});var _0x10bc5a='WhatsappQueues';return db[_0xa7fd('0x39')][_0xa7fd('0x3a')]({'where':{'name':_0x10bc5a,'userProfileId':_0x463e2c[_0xa7fd('0x3b')]},'raw':!![]})[_0xa7fd('0x16')](function(_0xdbcad1){if(_0xdbcad1&&_0xdbcad1[_0xa7fd('0x3c')]===0x0){return db[_0xa7fd('0x3d')][_0xa7fd('0x34')]({'name':_0x5cded9['name'],'resourceId':_0x5cded9['id'],'type':_0xdbcad1[_0xa7fd('0x1c')],'sectionId':_0xdbcad1['id']},{})[_0xa7fd('0x16')](function(){return _0x1b0d16;});}else{return _0x1b0d16;}})['catch'](function(_0x45be97){logger['error'](_0xa7fd('0x3e'),_0x45be97);throw _0x45be97;});}return _0x1b0d16;})[_0xa7fd('0x16')](respondWithResult(_0x4cb902,0xc9))[_0xa7fd('0x28')](handleError(_0x4cb902,null));};exports[_0xa7fd('0x3f')]=function(_0x37c434,_0xd03501){if(_0x37c434[_0xa7fd('0x35')]['id']){delete _0x37c434[_0xa7fd('0x35')]['id'];}return db[_0xa7fd('0x1f')]['find']({'where':{'id':_0x37c434[_0xa7fd('0x2a')]['id']}})['then'](handleEntityNotFound(_0xd03501,null))[_0xa7fd('0x16')](saveUpdates(_0x37c434[_0xa7fd('0x35')],null))[_0xa7fd('0x16')](respondWithResult(_0xd03501,null))[_0xa7fd('0x28')](handleError(_0xd03501,null));};exports[_0xa7fd('0x17')]=function(_0xac5c27,_0x56d3f5){return db[_0xa7fd('0x1f')][_0xa7fd('0x3a')]({'where':{'id':_0xac5c27[_0xa7fd('0x2a')]['id']}})[_0xa7fd('0x16')](handleEntityNotFound(_0x56d3f5,null))['then'](removeEntity(_0x56d3f5,null))[_0xa7fd('0x28')](handleError(_0x56d3f5,null));};exports[_0xa7fd('0x40')]=function(_0x19bac2,_0x35d63b){return db[_0xa7fd('0x1f')][_0xa7fd('0x40')]()[_0xa7fd('0x16')](respondWithResult(_0x35d63b,null))[_0xa7fd('0x28')](handleError(_0x35d63b,null));};exports[_0xa7fd('0x41')]=function(_0xb78172,_0x586ba5){var _0x3dd152={'raw':!![],'where':{}},_0x1b27fb={},_0x3573d3;return db[_0xa7fd('0x1f')][_0xa7fd('0x42')]({'where':{'id':_0xb78172[_0xa7fd('0x2a')]['id']}})[_0xa7fd('0x16')](handleEntityNotFound(_0x586ba5,null))[_0xa7fd('0x16')](function(_0x3424ca){if(_0x3424ca){_0x3573d3=_0x3424ca[_0xa7fd('0x18')]({'plain':!![]});_0x1b27fb[_0xa7fd('0x2e')]=_[_0xa7fd('0x2b')](db[_0xa7fd('0x43')]['rawAttributes']);_0x1b27fb[_0xa7fd('0x25')]=_[_0xa7fd('0x2b')](_0xb78172[_0xa7fd('0x25')]);_0x1b27fb[_0xa7fd('0x2d')]=_[_0xa7fd('0x30')](_0x1b27fb[_0xa7fd('0x2e')],_0x1b27fb[_0xa7fd('0x25')]);_0x3dd152[_0xa7fd('0x2f')]=_[_0xa7fd('0x30')](_0x1b27fb['model'],qs[_0xa7fd('0x31')](_0xb78172[_0xa7fd('0x25')][_0xa7fd('0x31')]));_0x3dd152[_0xa7fd('0x2f')]=_0x3dd152[_0xa7fd('0x2f')]['length']?_0x3dd152[_0xa7fd('0x2f')]:_0x1b27fb[_0xa7fd('0x2e')];if(!_0xb78172[_0xa7fd('0x25')][_0xa7fd('0x44')](_0xa7fd('0x45'))){_0x3dd152[_0xa7fd('0x12')]=qs['limit'](_0xb78172[_0xa7fd('0x25')][_0xa7fd('0x12')]);_0x3dd152[_0xa7fd('0x10')]=qs[_0xa7fd('0x10')](_0xb78172[_0xa7fd('0x25')][_0xa7fd('0x10')]);}_0x3dd152[_0xa7fd('0x46')]=qs[_0xa7fd('0x47')](_0xb78172[_0xa7fd('0x25')][_0xa7fd('0x47')]);_0x3dd152[_0xa7fd('0x23')]=qs[_0xa7fd('0x2d')](_['pick'](_0xb78172[_0xa7fd('0x25')],_0x1b27fb[_0xa7fd('0x2d')]));_0x3dd152[_0xa7fd('0x23')]['WhatsappQueueId']=_0x3424ca['id'];if(_0xb78172[_0xa7fd('0x25')]['filter']){_0x3dd152['where']=_[_0xa7fd('0x32')](_0x3dd152[_0xa7fd('0x23')],{'$or':_[_0xa7fd('0x1e')](_0x3dd152[_0xa7fd('0x2f')],function(_0x10f9a8){var _0x276127={};_0x276127[_0x10f9a8]={'$like':'%'+_0xb78172[_0xa7fd('0x25')]['filter']+'%'};return _0x276127;})});}_0x3dd152=_['merge']({},_0x3dd152,_0xb78172[_0xa7fd('0x33')]);return db[_0xa7fd('0x43')][_0xa7fd('0x26')](_0x3dd152);}})[_0xa7fd('0x16')](function(_0x1fc74e){if(_0x1fc74e){return db[_0xa7fd('0x48')][_0xa7fd('0x49')]({'where':{'id':_[_0xa7fd('0x1e')](_0x1fc74e,'UserId'),'role':_0xa7fd('0x4a')},'attributes':['id','name','whatsappPause','updatedAt',_0xa7fd('0x4b')]});}})[_0xa7fd('0x16')](function(_0x1942f0){if(_0x1942f0){return{'count':_0x1942f0[_0xa7fd('0x13')],'rows':_[_0xa7fd('0x1e')](_0x1942f0[_0xa7fd('0x27')],function(_0xf4a1b7){return{'membername':_0xf4a1b7[_0xa7fd('0x1c')],'UserId':_0xf4a1b7['id'],'queue_name':_0x3573d3[_0xa7fd('0x1c')],'WhatsappQueueId':_0x3573d3['id'],'interface':util[_0xa7fd('0x4c')](_0xa7fd('0x4d'),'SIP',_0xf4a1b7[_0xa7fd('0x1c')]),'penalty':0x0,'paused':_0xf4a1b7[_0xa7fd('0x4e')],'createdAt':_0xf4a1b7[_0xa7fd('0x4b')],'updatedAt':_0xf4a1b7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa7fd('0x16')](respondWithFilteredResult(_0x586ba5,_0x3dd152))[_0xa7fd('0x28')](handleError(_0x586ba5,null));};exports['getTeams']=function(_0x38b913,_0x45b8d9){var _0xb997f8={};var _0x2c68aa={};var _0x14e7b5;var _0x34b047;return db['WhatsappQueue'][_0xa7fd('0x42')]({'where':{'id':_0x38b913['params']['id']}})[_0xa7fd('0x16')](handleEntityNotFound(_0x45b8d9,null))[_0xa7fd('0x16')](function(_0x337775){if(_0x337775){_0x14e7b5=_0x337775;_0x2c68aa[_0xa7fd('0x2e')]=_[_0xa7fd('0x2b')](db['Team'][_0xa7fd('0x2c')]);_0x2c68aa[_0xa7fd('0x25')]=_['keys'](_0x38b913[_0xa7fd('0x25')]);_0x2c68aa['filters']=_[_0xa7fd('0x30')](_0x2c68aa['model'],_0x2c68aa[_0xa7fd('0x25')]);_0xb997f8['attributes']=_[_0xa7fd('0x30')](_0x2c68aa['model'],qs[_0xa7fd('0x31')](_0x38b913[_0xa7fd('0x25')][_0xa7fd('0x31')]));_0xb997f8['attributes']=_0xb997f8['attributes']['length']?_0xb997f8['attributes']:_0x2c68aa[_0xa7fd('0x2e')];_0xb997f8[_0xa7fd('0x46')]=qs['sort'](_0x38b913[_0xa7fd('0x25')]['sort']);_0xb997f8['where']=qs[_0xa7fd('0x2d')](_[_0xa7fd('0x4f')](_0x38b913[_0xa7fd('0x25')],_0x2c68aa[_0xa7fd('0x2d')]));if(_0x38b913[_0xa7fd('0x25')][_0xa7fd('0x50')]){_0xb997f8[_0xa7fd('0x23')]=_[_0xa7fd('0x32')](_0xb997f8[_0xa7fd('0x23')],{'$or':_[_0xa7fd('0x1e')](_0xb997f8[_0xa7fd('0x2f')],function(_0x322a09){var _0x39a30e={};_0x39a30e[_0x322a09]={'$like':'%'+_0x38b913[_0xa7fd('0x25')][_0xa7fd('0x50')]+'%'};return _0x39a30e;})});}_0xb997f8=_[_0xa7fd('0x32')]({},_0xb997f8,_0x38b913[_0xa7fd('0x33')]);return _0x14e7b5[_0xa7fd('0x51')](_0xb997f8);}})[_0xa7fd('0x16')](function(_0x10183e){if(_0x10183e){_0x34b047=_0x10183e[_0xa7fd('0x52')];if(!_0x38b913[_0xa7fd('0x25')][_0xa7fd('0x44')]('nolimit')){_0xb997f8[_0xa7fd('0x12')]=qs[_0xa7fd('0x12')](_0x38b913[_0xa7fd('0x25')][_0xa7fd('0x12')]);_0xb997f8[_0xa7fd('0x10')]=qs[_0xa7fd('0x10')](_0x38b913[_0xa7fd('0x25')][_0xa7fd('0x10')]);}return _0x14e7b5[_0xa7fd('0x51')](_0xb997f8);}})['then'](function(_0x58d7ba){if(_0x58d7ba){return _0x58d7ba?{'count':_0x34b047,'rows':_0x58d7ba}:null;}})[_0xa7fd('0x16')](respondWithResult(_0x45b8d9,null))[_0xa7fd('0x28')](handleError(_0x45b8d9,null));};exports[_0xa7fd('0x53')]=function(_0x594eb1,_0x772ab8){var _0x3c1a9f=_0x594eb1['body'][_0xa7fd('0x54')];return db[_0xa7fd('0x55')][_0xa7fd('0x26')]({'where':{'id':_0x3c1a9f},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa7fd('0x56'),'attributes':['id',_0xa7fd('0x1c'),'online',_0xa7fd('0x57'),_0xa7fd('0x58')],'raw':!![]}]})[_0xa7fd('0x16')](function(_0xd25803){if(_0xd25803){var _0x4b196f=_['flatMap'](_0xd25803,function(_0x193c25){var _0x130409=_0x193c25[_0xa7fd('0x18')]({'plain':!![]});return _0x130409[_0xa7fd('0x56')];});return db[_0xa7fd('0x1f')][_0xa7fd('0x3a')]({'where':{'id':_0x594eb1[_0xa7fd('0x2a')]['id']}})[_0xa7fd('0x16')](function(_0x31f480){return db[_0xa7fd('0x59')][_0xa7fd('0x5a')](function(_0x45b08a){return _0x31f480[_0xa7fd('0x53')](_0x3c1a9f,{'transaction':_0x45b08a})[_0xa7fd('0x16')](function(){return BPromise[_0xa7fd('0x5b')](_0x4b196f,function(_0x34cc3d){return db[_0xa7fd('0x43')][_0xa7fd('0x5c')]({'where':{'UserId':_0x34cc3d['id'],'WhatsappQueueId':_0x594eb1[_0xa7fd('0x2a')]['id']},'transaction':_0x45b08a});});})[_0xa7fd('0x16')](function(){_0x4b196f['forEach'](function(_0x5c986f){socket[_0xa7fd('0x5d')](_0xa7fd('0x5e'),{'UserId':_0x5c986f['id'],'WhatsappQueueId':_0x31f480['id']});});});});});}})['then'](respondWithStatusCode(_0x772ab8,null))[_0xa7fd('0x28')](handleError(_0x772ab8,null));};exports[_0xa7fd('0x5f')]=function(_0x580a5c,_0x21e971){return db[_0xa7fd('0x55')][_0xa7fd('0x26')]({'where':{'id':_0x580a5c['query'][_0xa7fd('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa7fd('0x56'),'attributes':['id'],'raw':!![]}]})[_0xa7fd('0x16')](handleEntityNotFound(_0x21e971,null))['then'](function(_0x345b10){var _0x18f1de=_[_0xa7fd('0x1e')](_0x345b10,'id');var _0x2114f9=[];var _0x39a64f=[];var _0x4fc58a=squel[_0xa7fd('0x60')]();_0x4fc58a['field']('tq.TeamId')[_0xa7fd('0x61')](_0xa7fd('0x62'),'tq')[_0xa7fd('0x63')](_0xa7fd('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa7fd('0x23')](_0xa7fd('0x65'),_0x580a5c['params']['id']);for(var _0x2ecdbe=0x0;_0x2ecdbe<_0x345b10['length'];_0x2ecdbe+=0x1){let _0x5f5823=_0x345b10[_0x2ecdbe];for(var _0x4d929a=0x0;_0x4d929a<_0x5f5823[_0xa7fd('0x56')][_0xa7fd('0x52')];_0x4d929a+=0x1){let _0x5471e1=_0x5f5823[_0xa7fd('0x56')][_0x4d929a];var _0x1891eb=_0x4fc58a[_0xa7fd('0x66')]();_0x1891eb['where'](_0xa7fd('0x67'),_0x5471e1['id']);_0x39a64f['push'](db[_0xa7fd('0x59')][_0xa7fd('0x25')](_0x1891eb['toString'](),{'type':db[_0xa7fd('0x59')]['QueryTypes'][_0xa7fd('0x68')]})[_0xa7fd('0x16')](function(_0x5b3eb1){if(_0x5b3eb1[_0xa7fd('0x52')]===0x1){return _0x5471e1['id'];}else{var _0x441850=_[_0xa7fd('0x69')](_[_0xa7fd('0x1e')](_0x5b3eb1,_0xa7fd('0x6a')),function(_0x33f651){return _[_0xa7fd('0x6b')](_0x18f1de,_0x33f651);});if(_0x441850){return _0x5471e1['id'];}}}));}}return BPromise[_0xa7fd('0x6c')](_0x39a64f)[_0xa7fd('0x16')](function(_0x39732c){_0x2114f9=_(_0x2114f9)['union'](_0x39732c)[_0xa7fd('0x6d')]()[_0xa7fd('0x6e')]();return db[_0xa7fd('0x1f')]['find']({'where':{'id':_0x580a5c[_0xa7fd('0x2a')]['id']}})[_0xa7fd('0x16')](function(_0x89e36e){return db['sequelize']['transaction'](function(_0x562e42){return _0x89e36e[_0xa7fd('0x5f')](_0x580a5c[_0xa7fd('0x25')][_0xa7fd('0x54')],{'transaction':_0x562e42})['then'](function(){if(!_[_0xa7fd('0x6f')](_0x2114f9)){return _0x89e36e[_0xa7fd('0x70')](_0x2114f9,{'transaction':_0x562e42});}})[_0xa7fd('0x16')](function(){_0x2114f9[_0xa7fd('0x71')](function(_0xc85e5b){socket['emit'](_0xa7fd('0x72'),{'UserId':_0xc85e5b,'WhatsappQueueId':_0x89e36e['id']});});});});});});})[_0xa7fd('0x16')](respondWithStatusCode(_0x21e971,null))[_0xa7fd('0x28')](handleError(_0x21e971,null));};exports[_0xa7fd('0x73')]=function(_0x59128f,_0x2bb824){return db[_0xa7fd('0x1f')][_0xa7fd('0x3a')]({'where':{'id':_0x59128f['params']['id']}})[_0xa7fd('0x16')](handleEntityNotFound(_0x2bb824,null))['then'](function(_0x41d09e){if(_0x41d09e){return _0x41d09e['addAgents'](_0x59128f[_0xa7fd('0x35')]['ids'],_[_0xa7fd('0x74')](_0x59128f[_0xa7fd('0x35')],[_0xa7fd('0x54'),'id'])||{})[_0xa7fd('0x75')](function(_0x4e4390){for(var _0xc8357=0x0;_0xc8357<_0x59128f[_0xa7fd('0x35')][_0xa7fd('0x54')][_0xa7fd('0x52')];_0xc8357+=0x1){socket[_0xa7fd('0x5d')]('userWhatsappQueue:save',{'UserId':Number(_0x59128f[_0xa7fd('0x35')]['ids'][_0xc8357]),'WhatsappQueueId':Number(_0x59128f[_0xa7fd('0x2a')]['id'])});}return _0x4e4390;});}})[_0xa7fd('0x16')](respondWithResult(_0x2bb824,null))[_0xa7fd('0x28')](handleError(_0x2bb824,null));};exports['removeAgents']=function(_0x3e7e18,_0x159c88){return db[_0xa7fd('0x1f')]['find']({'where':{'id':_0x3e7e18['params']['id']}})['then'](handleEntityNotFound(_0x159c88,null))['then'](function(_0x282c1a){if(_0x282c1a){return _0x282c1a[_0xa7fd('0x70')](_0x3e7e18[_0xa7fd('0x25')][_0xa7fd('0x54')])[_0xa7fd('0x16')](function(){if(_[_0xa7fd('0x76')](_0x3e7e18[_0xa7fd('0x25')][_0xa7fd('0x54')])){for(var _0x2b7f5d=0x0;_0x2b7f5d<_0x3e7e18[_0xa7fd('0x25')][_0xa7fd('0x54')]['length'];_0x2b7f5d+=0x1){socket[_0xa7fd('0x5d')]('userWhatsappQueue:remove',{'UserId':Number(_0x3e7e18['query'][_0xa7fd('0x54')][_0x2b7f5d]),'WhatsappQueueId':Number(_0x3e7e18[_0xa7fd('0x2a')]['id'])});}}else{socket[_0xa7fd('0x5d')](_0xa7fd('0x72'),{'UserId':Number(_0x3e7e18[_0xa7fd('0x25')][_0xa7fd('0x54')]),'WhatsappQueueId':Number(_0x3e7e18[_0xa7fd('0x2a')]['id'])});}});}})[_0xa7fd('0x16')](respondWithStatusCode(_0x159c88,null))[_0xa7fd('0x28')](handleError(_0x159c88,null));};exports['getAgents']=function(_0x357f50,_0x30dfc8){var _0x4111c2={};var _0x256727={};var _0x503c6c;var _0xae42bc;return db[_0xa7fd('0x1f')][_0xa7fd('0x42')]({'where':{'id':_0x357f50[_0xa7fd('0x2a')]['id']}})[_0xa7fd('0x16')](handleEntityNotFound(_0x30dfc8,null))[_0xa7fd('0x16')](function(_0x4734a0){if(_0x4734a0){_0x503c6c=_0x4734a0;_0x256727[_0xa7fd('0x2e')]=_[_0xa7fd('0x2b')](db['User'][_0xa7fd('0x2c')]);_0x256727[_0xa7fd('0x25')]=_['keys'](_0x357f50['query']);_0x256727[_0xa7fd('0x2d')]=_[_0xa7fd('0x30')](_0x256727[_0xa7fd('0x2e')],_0x256727[_0xa7fd('0x25')]);_0x4111c2[_0xa7fd('0x2f')]=_['intersection'](_0x256727['model'],qs[_0xa7fd('0x31')](_0x357f50['query'][_0xa7fd('0x31')]));_0x4111c2[_0xa7fd('0x2f')]=_0x4111c2[_0xa7fd('0x2f')][_0xa7fd('0x52')]?_0x4111c2[_0xa7fd('0x2f')]:_0x256727[_0xa7fd('0x2e')];_0x4111c2[_0xa7fd('0x46')]=qs['sort'](_0x357f50['query'][_0xa7fd('0x47')]);_0x4111c2['where']=qs[_0xa7fd('0x2d')](_[_0xa7fd('0x4f')](_0x357f50[_0xa7fd('0x25')],_0x256727['filters']));if(_0x357f50['query'][_0xa7fd('0x50')]){_0x4111c2[_0xa7fd('0x23')]=_[_0xa7fd('0x32')](_0x4111c2['where'],{'$or':_[_0xa7fd('0x1e')](_0x4111c2[_0xa7fd('0x2f')],function(_0x4e5286){var _0xc27b13={};_0xc27b13[_0x4e5286]={'$like':'%'+_0x357f50['query'][_0xa7fd('0x50')]+'%'};return _0xc27b13;})});}_0x4111c2=_['merge']({},_0x4111c2,_0x357f50[_0xa7fd('0x33')]);return _0x503c6c[_0xa7fd('0x77')](_0x4111c2);}})[_0xa7fd('0x16')](function(_0x1f9618){if(_0x1f9618){_0xae42bc=_0x1f9618[_0xa7fd('0x52')];if(!_0x357f50[_0xa7fd('0x25')][_0xa7fd('0x44')](_0xa7fd('0x45'))){_0x4111c2[_0xa7fd('0x12')]=qs[_0xa7fd('0x12')](_0x357f50[_0xa7fd('0x25')]['limit']);_0x4111c2[_0xa7fd('0x10')]=qs['offset'](_0x357f50[_0xa7fd('0x25')][_0xa7fd('0x10')]);}return _0x503c6c[_0xa7fd('0x77')](_0x4111c2);}})[_0xa7fd('0x16')](function(_0x5a931e){if(_0x5a931e){return _0x5a931e?{'count':_0xae42bc,'rows':_0x5a931e}:null;}})['then'](respondWithResult(_0x30dfc8,null))['catch'](handleError(_0x30dfc8,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 9c75486..8553412 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 _0x70fe=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x70fe,0xfa));var _0xe70f=function(_0x323c4b,_0x281826){_0x323c4b=_0x323c4b-0x0;var _0x5264dd=_0x70fe[_0x323c4b];return _0x5264dd;};'use strict';var EventEmitter=require(_0xe70f('0x0'));var WhatsappQueue=require(_0xe70f('0x1'))['db'][_0xe70f('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xe70f('0x3')](0x0);var events={'afterCreate':_0xe70f('0x4'),'afterUpdate':_0xe70f('0x5'),'afterDestroy':_0xe70f('0x6')};function emitEvent(_0x25c59f){return function(_0x48702f,_0x57ff8b,_0x268f2c){WhatsappQueueEvents[_0xe70f('0x7')](_0x25c59f+':'+_0x48702f['id'],_0x48702f);WhatsappQueueEvents[_0xe70f('0x7')](_0x25c59f,_0x48702f);_0x268f2c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xe70f('0x8')](e,emitEvent(event));}}module[_0xe70f('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa5ab=['events','../../mysqldb','update','remove','emit','hook'];(function(_0x113bd2,_0x135386){var _0x271ceb=function(_0x4c175c){while(--_0x4c175c){_0x113bd2['push'](_0x113bd2['shift']());}};_0x271ceb(++_0x135386);}(_0xa5ab,0x66));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xba5a('0x0'));var WhatsappQueue=require(_0xba5a('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xba5a('0x2'),'afterDestroy':_0xba5a('0x3')};function emitEvent(_0x4a85d8){return function(_0x46ae3d,_0x4235b4,_0x304503){WhatsappQueueEvents[_0xba5a('0x4')](_0x4a85d8+':'+_0x46ae3d['id'],_0x46ae3d);WhatsappQueueEvents[_0xba5a('0x4')](_0x4a85d8,_0x46ae3d);_0x304503(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xba5a('0x5')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 02a17cb..8b1066b 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 _0x81a2=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81a2,0x1ab));var _0x281a=function(_0xf158db,_0x337fab){_0xf158db=_0xf158db-0x0;var _0x396bfe=_0x81a2[_0xf158db];return _0x396bfe;};'use strict';var _=require(_0x281a('0x0'));var util=require(_0x281a('0x1'));var logger=require(_0x281a('0x2'))(_0x281a('0x3'));var moment=require(_0x281a('0x4'));var BPromise=require(_0x281a('0x5'));var rp=require(_0x281a('0x6'));var fs=require('fs');var path=require(_0x281a('0x7'));var rimraf=require(_0x281a('0x8'));var config=require(_0x281a('0x9'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x444807,_0x24ae89){return _0x444807[_0x281a('0xa')](_0x281a('0xb'),attributes,{'tableName':_0x281a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x884d=['lodash','../../config/logger','bluebird','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x50db32,_0x32612b){var _0x169007=function(_0x3d8ce1){while(--_0x3d8ce1){_0x50db32['push'](_0x50db32['shift']());}};_0x169007(++_0x32612b);}(_0x884d,0xb8));var _0xd884=function(_0x1d6de3,_0x14df34){_0x1d6de3=_0x1d6de3-0x0;var _0x4fac0a=_0x884d[_0x1d6de3];return _0x4fac0a;};'use strict';var _=require(_0xd884('0x0'));var util=require('util');var logger=require(_0xd884('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd884('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd884('0x3'));var config=require('../../config/environment');var attributes=require(_0xd884('0x4'));module[_0xd884('0x5')]=function(_0x317e43,_0x115965){return _0x317e43[_0xd884('0x6')](_0xd884('0x7'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index cf888fe..a039cb9 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 _0x9a9c=['map','model','catch','ShowWhatsappQueue','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','GetWhatsappQueue','WhatsappQueue','findAll','options','attributes','limit','include'];(function(_0xc6d0b1,_0x1b949f){var _0x3d76f4=function(_0x15b325){while(--_0x15b325){_0xc6d0b1['push'](_0xc6d0b1['shift']());}};_0x3d76f4(++_0x1b949f);}(_0x9a9c,0x177));var _0xc9a9=function(_0x2e7b83,_0x4b81f4){_0x2e7b83=_0x2e7b83-0x0;var _0x330d68=_0x9a9c[_0x2e7b83];return _0x330d68;};'use strict';var _=require(_0xc9a9('0x0'));var util=require(_0xc9a9('0x1'));var moment=require(_0xc9a9('0x2'));var BPromise=require('bluebird');var rs=require(_0xc9a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9a9('0x4'))['db'];var utils=require(_0xc9a9('0x5'));var logger=require(_0xc9a9('0x6'))(_0xc9a9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc9a9('0x8')][_0xc9a9('0x9')]({'port':0x232a});config[_0xc9a9('0xa')]=_[_0xc9a9('0xb')](config[_0xc9a9('0xa')],{'host':_0xc9a9('0xc'),'port':0x18eb});var socket=require(_0xc9a9('0xd'))(new Redis(config[_0xc9a9('0xa')]));require(_0xc9a9('0xe'))['register'](socket);function respondWithRpcPromise(_0x55ce4f,_0x4035d9,_0x517690){return new BPromise(function(_0x50f230,_0x480b28){return client[_0xc9a9('0xf')](_0x55ce4f,_0x517690)[_0xc9a9('0x10')](function(_0x106486){logger['info'](_0xc9a9('0x11'),_0x4035d9,'request\x20sent');logger[_0xc9a9('0x12')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4035d9,_0xc9a9('0x13'),JSON[_0xc9a9('0x14')](_0x106486));if(_0x106486[_0xc9a9('0x15')]){if(_0x106486[_0xc9a9('0x15')][_0xc9a9('0x16')]===0x1f4){logger[_0xc9a9('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x4035d9,_0x106486['error'][_0xc9a9('0x17')]);return _0x480b28(_0x106486[_0xc9a9('0x15')]['message']);}logger['error'](_0xc9a9('0x11'),_0x4035d9,_0x106486[_0xc9a9('0x15')]['message']);return _0x50f230(_0x106486[_0xc9a9('0x15')][_0xc9a9('0x17')]);}else{logger[_0xc9a9('0x18')](_0xc9a9('0x11'),_0x4035d9,'request\x20sent');_0x50f230(_0x106486['result'][_0xc9a9('0x17')]);}})['catch'](function(_0x477012){logger[_0xc9a9('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x4035d9,_0x477012);_0x480b28(_0x477012);});});}exports[_0xc9a9('0x19')]=function(_0xee953c){var _0x1844e6=this;return new Promise(function(_0x4f5efc,_0x1d7fc0){return db[_0xc9a9('0x1a')][_0xc9a9('0x1b')]({'raw':_0xee953c[_0xc9a9('0x1c')]?_0xee953c['options']['raw']===undefined?!![]:![]:!![],'where':_0xee953c[_0xc9a9('0x1c')]?_0xee953c[_0xc9a9('0x1c')]['where']||null:null,'attributes':_0xee953c[_0xc9a9('0x1c')]?_0xee953c[_0xc9a9('0x1c')][_0xc9a9('0x1d')]||null:null,'limit':_0xee953c['options']?_0xee953c[_0xc9a9('0x1c')][_0xc9a9('0x1e')]||null:null,'include':_0xee953c['options']?_0xee953c[_0xc9a9('0x1c')][_0xc9a9('0x1f')]?_[_0xc9a9('0x20')](_0xee953c[_0xc9a9('0x1c')]['include'],function(_0x113ec0){return{'model':db[_0x113ec0['model']],'as':_0x113ec0['as'],'attributes':_0x113ec0['attributes'],'include':_0x113ec0[_0xc9a9('0x1f')]?_[_0xc9a9('0x20')](_0x113ec0[_0xc9a9('0x1f')],function(_0x247b50){return{'model':db[_0x247b50[_0xc9a9('0x21')]],'as':_0x247b50['as'],'attributes':_0x247b50[_0xc9a9('0x1d')],'include':_0x247b50[_0xc9a9('0x1f')]?_['map'](_0x247b50[_0xc9a9('0x1f')],function(_0x2a320d){return{'model':db[_0x2a320d[_0xc9a9('0x21')]],'as':_0x2a320d['as'],'attributes':_0x2a320d[_0xc9a9('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x255599){logger[_0xc9a9('0x18')](_0xc9a9('0x19'),_0xee953c);logger[_0xc9a9('0x12')](_0xc9a9('0x19'),_0xee953c,JSON[_0xc9a9('0x14')](_0x255599));_0x4f5efc(_0x255599);})[_0xc9a9('0x22')](function(_0x26522b){logger[_0xc9a9('0x15')](_0xc9a9('0x19'),_0x26522b[_0xc9a9('0x17')],_0xee953c);_0x1d7fc0(_0x1844e6['error'](0x1f4,_0x26522b['message']));});});};exports[_0xc9a9('0x23')]=function(_0x1ee2c9){var _0x1eb6a9=this;return new Promise(function(_0x34aa13,_0x5d3834){return db[_0xc9a9('0x1a')]['find']({'raw':_0x1ee2c9[_0xc9a9('0x1c')]?_0x1ee2c9[_0xc9a9('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1ee2c9[_0xc9a9('0x1c')]?_0x1ee2c9[_0xc9a9('0x1c')][_0xc9a9('0x24')]||null:null,'attributes':_0x1ee2c9[_0xc9a9('0x1c')]?_0x1ee2c9[_0xc9a9('0x1c')][_0xc9a9('0x1d')]||null:null,'include':_0x1ee2c9['options']?_0x1ee2c9[_0xc9a9('0x1c')]['include']?_[_0xc9a9('0x20')](_0x1ee2c9['options'][_0xc9a9('0x1f')],function(_0x5d0dd1){return{'model':db[_0x5d0dd1[_0xc9a9('0x21')]],'as':_0x5d0dd1['as'],'attributes':_0x5d0dd1[_0xc9a9('0x1d')],'include':_0x5d0dd1[_0xc9a9('0x1f')]?_[_0xc9a9('0x20')](_0x5d0dd1[_0xc9a9('0x1f')],function(_0x235e6b){return{'model':db[_0x235e6b[_0xc9a9('0x21')]],'as':_0x235e6b['as'],'attributes':_0x235e6b[_0xc9a9('0x1d')],'include':_0x235e6b['include']?_[_0xc9a9('0x20')](_0x235e6b[_0xc9a9('0x1f')],function(_0x2f92c0){return{'model':db[_0x2f92c0[_0xc9a9('0x21')]],'as':_0x2f92c0['as'],'attributes':_0x2f92c0[_0xc9a9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc9a9('0x10')](function(_0x25daf4){logger[_0xc9a9('0x18')](_0xc9a9('0x23'),_0x1ee2c9);logger['debug'](_0xc9a9('0x23'),_0x1ee2c9,JSON[_0xc9a9('0x14')](_0x25daf4));_0x34aa13(_0x25daf4);})[_0xc9a9('0x22')](function(_0x21d657){logger[_0xc9a9('0x15')](_0xc9a9('0x23'),_0x21d657[_0xc9a9('0x17')],_0x1ee2c9);_0x5d3834(_0x1eb6a9[_0xc9a9('0x15')](0x1f4,_0x21d657[_0xc9a9('0x17')]));});});}; \ No newline at end of file +var _0x3b5d=['code','message','result','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','include','map','model','catch','ShowWhatsappQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x240b66,_0x5d6ac4){var _0x158df9=function(_0x93d82d){while(--_0x93d82d){_0x240b66['push'](_0x240b66['shift']());}};_0x158df9(++_0x5d6ac4);}(_0x3b5d,0x195));var _0xd3b5=function(_0x36fe9b,_0x518d1b){_0x36fe9b=_0x36fe9b-0x0;var _0x113065=_0x3b5d[_0x36fe9b];return _0x113065;};'use strict';var _=require(_0xd3b5('0x0'));var util=require(_0xd3b5('0x1'));var moment=require('moment');var BPromise=require(_0xd3b5('0x2'));var rs=require(_0xd3b5('0x3'));var fs=require('fs');var Redis=require(_0xd3b5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd3b5('0x5'));var logger=require(_0xd3b5('0x6'))('rpc');var config=require(_0xd3b5('0x7'));var jayson=require(_0xd3b5('0x8'));var client=jayson[_0xd3b5('0x9')][_0xd3b5('0xa')]({'port':0x232a});config[_0xd3b5('0xb')]=_['defaults'](config[_0xd3b5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd3b5('0xc'))(new Redis(config[_0xd3b5('0xb')]));require(_0xd3b5('0xd'))[_0xd3b5('0xe')](socket);function respondWithRpcPromise(_0x339709,_0x4d65e9,_0x48f195){return new BPromise(function(_0x578ee9,_0x263cab){return client[_0xd3b5('0xf')](_0x339709,_0x48f195)[_0xd3b5('0x10')](function(_0x433279){logger[_0xd3b5('0x11')](_0xd3b5('0x12'),_0x4d65e9,_0xd3b5('0x13'));logger[_0xd3b5('0x14')](_0xd3b5('0x15'),_0x4d65e9,_0xd3b5('0x13'),JSON[_0xd3b5('0x16')](_0x433279));if(_0x433279[_0xd3b5('0x17')]){if(_0x433279[_0xd3b5('0x17')][_0xd3b5('0x18')]===0x1f4){logger[_0xd3b5('0x17')](_0xd3b5('0x12'),_0x4d65e9,_0x433279['error'][_0xd3b5('0x19')]);return _0x263cab(_0x433279[_0xd3b5('0x17')][_0xd3b5('0x19')]);}logger[_0xd3b5('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x4d65e9,_0x433279['error'][_0xd3b5('0x19')]);return _0x578ee9(_0x433279['error'][_0xd3b5('0x19')]);}else{logger[_0xd3b5('0x11')](_0xd3b5('0x12'),_0x4d65e9,_0xd3b5('0x13'));_0x578ee9(_0x433279[_0xd3b5('0x1a')][_0xd3b5('0x19')]);}})['catch'](function(_0x45183c){logger[_0xd3b5('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x4d65e9,_0x45183c);_0x263cab(_0x45183c);});});}exports[_0xd3b5('0x1b')]=function(_0x5ef351){var _0x2c836d=this;return new Promise(function(_0x51d120,_0x59cbd4){return db[_0xd3b5('0x1c')]['findAll']({'raw':_0x5ef351['options']?_0x5ef351[_0xd3b5('0x1d')][_0xd3b5('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ef351[_0xd3b5('0x1d')]?_0x5ef351[_0xd3b5('0x1d')][_0xd3b5('0x1f')]||null:null,'attributes':_0x5ef351[_0xd3b5('0x1d')]?_0x5ef351[_0xd3b5('0x1d')][_0xd3b5('0x20')]||null:null,'limit':_0x5ef351[_0xd3b5('0x1d')]?_0x5ef351[_0xd3b5('0x1d')]['limit']||null:null,'include':_0x5ef351[_0xd3b5('0x1d')]?_0x5ef351[_0xd3b5('0x1d')][_0xd3b5('0x21')]?_[_0xd3b5('0x22')](_0x5ef351[_0xd3b5('0x1d')]['include'],function(_0xd6fcd9){return{'model':db[_0xd6fcd9[_0xd3b5('0x23')]],'as':_0xd6fcd9['as'],'attributes':_0xd6fcd9[_0xd3b5('0x20')],'include':_0xd6fcd9[_0xd3b5('0x21')]?_[_0xd3b5('0x22')](_0xd6fcd9['include'],function(_0x550bb3){return{'model':db[_0x550bb3['model']],'as':_0x550bb3['as'],'attributes':_0x550bb3[_0xd3b5('0x20')],'include':_0x550bb3['include']?_[_0xd3b5('0x22')](_0x550bb3[_0xd3b5('0x21')],function(_0x237827){return{'model':db[_0x237827['model']],'as':_0x237827['as'],'attributes':_0x237827[_0xd3b5('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd3b5('0x10')](function(_0x2e352c){logger[_0xd3b5('0x11')](_0xd3b5('0x1b'),_0x5ef351);logger[_0xd3b5('0x14')](_0xd3b5('0x1b'),_0x5ef351,JSON[_0xd3b5('0x16')](_0x2e352c));_0x51d120(_0x2e352c);})[_0xd3b5('0x24')](function(_0x2441ab){logger[_0xd3b5('0x17')](_0xd3b5('0x1b'),_0x2441ab[_0xd3b5('0x19')],_0x5ef351);_0x59cbd4(_0x2c836d[_0xd3b5('0x17')](0x1f4,_0x2441ab[_0xd3b5('0x19')]));});});};exports[_0xd3b5('0x25')]=function(_0x5c5fe2){var _0x5c864f=this;return new Promise(function(_0x309395,_0x1c6652){return db[_0xd3b5('0x1c')][_0xd3b5('0x26')]({'raw':_0x5c5fe2['options']?_0x5c5fe2[_0xd3b5('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5c5fe2[_0xd3b5('0x1d')]?_0x5c5fe2[_0xd3b5('0x1d')][_0xd3b5('0x1f')]||null:null,'attributes':_0x5c5fe2[_0xd3b5('0x1d')]?_0x5c5fe2[_0xd3b5('0x1d')][_0xd3b5('0x20')]||null:null,'include':_0x5c5fe2[_0xd3b5('0x1d')]?_0x5c5fe2[_0xd3b5('0x1d')]['include']?_['map'](_0x5c5fe2[_0xd3b5('0x1d')]['include'],function(_0x5234cd){return{'model':db[_0x5234cd['model']],'as':_0x5234cd['as'],'attributes':_0x5234cd[_0xd3b5('0x20')],'include':_0x5234cd['include']?_[_0xd3b5('0x22')](_0x5234cd[_0xd3b5('0x21')],function(_0x289333){return{'model':db[_0x289333['model']],'as':_0x289333['as'],'attributes':_0x289333['attributes'],'include':_0x289333[_0xd3b5('0x21')]?_[_0xd3b5('0x22')](_0x289333[_0xd3b5('0x21')],function(_0x42359a){return{'model':db[_0x42359a['model']],'as':_0x42359a['as'],'attributes':_0x42359a[_0xd3b5('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd3b5('0x10')](function(_0x56538d){logger['info'](_0xd3b5('0x25'),_0x5c5fe2);logger[_0xd3b5('0x14')](_0xd3b5('0x25'),_0x5c5fe2,JSON['stringify'](_0x56538d));_0x309395(_0x56538d);})[_0xd3b5('0x24')](function(_0x5e281c){logger[_0xd3b5('0x17')]('ShowWhatsappQueue',_0x5e281c[_0xd3b5('0x19')],_0x5c5fe2);_0x1c6652(_0x5c864f['error'](0x1f4,_0x5e281c[_0xd3b5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 3a733d5..cfd39d9 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 _0xc2e3=['save','update','removeListener','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xc2e3,0x6b));var _0x3c2e=function(_0x3b6f2e,_0x591608){_0x3b6f2e=_0x3b6f2e-0x0;var _0x543b1=_0xc2e3[_0x3b6f2e];return _0x543b1;};'use strict';var WhatsappQueueEvents=require(_0x3c2e('0x0'));var events=[_0x3c2e('0x1'),'remove',_0x3c2e('0x2')];function createListener(_0x3329e3,_0x2c0b4a){return function(_0x362fb7){_0x2c0b4a['emit'](_0x3329e3,_0x362fb7);};}function removeListener(_0x8bf792,_0x1a53d8){return function(){WhatsappQueueEvents[_0x3c2e('0x3')](_0x8bf792,_0x1a53d8);};}exports['register']=function(_0x1cecbd){for(var _0x57e5ff=0x0,_0x5aa17d=events[_0x3c2e('0x4')];_0x57e5ff<_0x5aa17d;_0x57e5ff++){var _0x338b6e=events[_0x57e5ff];var _0x5e1f17=createListener(_0x3c2e('0x5')+_0x338b6e,_0x1cecbd);WhatsappQueueEvents['on'](_0x338b6e,_0x5e1f17);}}; \ No newline at end of file +var _0xd970=['./whatsappQueue.events','save','remove','update','removeListener','register'];(function(_0x5cd552,_0xab7028){var _0x22af69=function(_0xc2ee38){while(--_0xc2ee38){_0x5cd552['push'](_0x5cd552['shift']());}};_0x22af69(++_0xab7028);}(_0xd970,0x12c));var _0x0d97=function(_0x5d89b6,_0x4393bb){_0x5d89b6=_0x5d89b6-0x0;var _0x513786=_0xd970[_0x5d89b6];return _0x513786;};'use strict';var WhatsappQueueEvents=require(_0x0d97('0x0'));var events=[_0x0d97('0x1'),_0x0d97('0x2'),_0x0d97('0x3')];function createListener(_0x483c1c,_0x5604d4){return function(_0x149a29){_0x5604d4['emit'](_0x483c1c,_0x149a29);};}function removeListener(_0x5a5295,_0x177326){return function(){WhatsappQueueEvents[_0x0d97('0x4')](_0x5a5295,_0x177326);};}exports[_0x0d97('0x5')]=function(_0x10b9b8){for(var _0x233f5e=0x0,_0x20472b=events['length'];_0x233f5e<_0x20472b;_0x233f5e++){var _0x2cbb52=events[_0x233f5e];var _0x11275e=createListener('whatsappQueue:'+_0x2cbb52,_0x10b9b8);WhatsappQueueEvents['on'](_0x2cbb52,_0x11275e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 457723b..a968554 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 _0x6dbb=['create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','isAuthenticated','describe'];(function(_0xb4793c,_0x16833c){var _0x225101=function(_0x34138f){while(--_0x34138f){_0xb4793c['push'](_0xb4793c['shift']());}};_0x225101(++_0x16833c);}(_0x6dbb,0x12c));var _0xb6db=function(_0xa23e82,_0x2cefa5){_0xa23e82=_0xa23e82-0x0;var _0x135e60=_0x6dbb[_0xa23e82];return _0x135e60;};'use strict';var multer=require(_0xb6db('0x0'));var util=require(_0xb6db('0x1'));var path=require(_0xb6db('0x2'));var timeout=require(_0xb6db('0x3'));var express=require(_0xb6db('0x4'));var router=express[_0xb6db('0x5')]();var fs_extra=require(_0xb6db('0x6'));var auth=require(_0xb6db('0x7'));var interaction=require(_0xb6db('0x8'));var config=require(_0xb6db('0x9'));var controller=require(_0xb6db('0xa'));router[_0xb6db('0xb')]('/',auth['isAuthenticated'](),controller[_0xb6db('0xc')]);router['get']('/describe',auth[_0xb6db('0xd')](),controller[_0xb6db('0xe')]);router[_0xb6db('0xb')]('/:id',auth[_0xb6db('0xd')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xb6db('0xf')]);router['put'](_0xb6db('0x10'),auth[_0xb6db('0xd')](),controller[_0xb6db('0x11')]);router[_0xb6db('0x12')](_0xb6db('0x10'),auth['isAuthenticated'](),controller[_0xb6db('0x13')]);module[_0xb6db('0x14')]=router; \ No newline at end of file +var _0xe7c3=['update','/:id','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','describe','create'];(function(_0x9fbfb7,_0x2b628e){var _0x116172=function(_0x5aeda1){while(--_0x5aeda1){_0x9fbfb7['push'](_0x9fbfb7['shift']());}};_0x116172(++_0x2b628e);}(_0xe7c3,0x1a8));var _0x3e7c=function(_0x590a78,_0x2b9403){_0x590a78=_0x590a78-0x0;var _0x3bd390=_0xe7c3[_0x590a78];return _0x3bd390;};'use strict';var multer=require(_0x3e7c('0x0'));var util=require(_0x3e7c('0x1'));var path=require(_0x3e7c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3e7c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3e7c('0x4'));var config=require(_0x3e7c('0x5'));var controller=require(_0x3e7c('0x6'));router[_0x3e7c('0x7')]('/',auth[_0x3e7c('0x8')](),controller['index']);router['get']('/describe',auth[_0x3e7c('0x8')](),controller[_0x3e7c('0x9')]);router[_0x3e7c('0x7')]('/:id',auth[_0x3e7c('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3e7c('0xa')]);router['put']('/:id',auth[_0x3e7c('0x8')](),controller[_0x3e7c('0xb')]);router['delete'](_0x3e7c('0xc'),auth[_0x3e7c('0x8')](),controller[_0x3e7c('0xd')]);module[_0x3e7c('0xe')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 01efa6e..ea75e6a 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(_0x3df526,_0x533870){var _0x2875f8=function(_0xe56b2b){while(--_0xe56b2b){_0x3df526['push'](_0x3df526['shift']());}};_0x2875f8(++_0x533870);}(_0x7a54,0x106));var _0x47a5=function(_0x50eadf,_0x1540cb){_0x50eadf=_0x50eadf-0x0;var _0xeb8d0e=_0x7a54[_0x50eadf];return _0xeb8d0e;};'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(_0xae6a93,_0x29c305){var _0x3d56cd=function(_0x5341fc){while(--_0x5341fc){_0xae6a93['push'](_0xae6a93['shift']());}};_0x3d56cd(++_0x29c305);}(_0x7a54,0x106));var _0x47a5=function(_0x273b13,_0x18f356){_0x273b13=_0x273b13-0x0;var _0x2b9a1a=_0x7a54[_0x273b13];return _0x2b9a1a;};'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 557b0a6..45b888a 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 _0x5423=['params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','then','rows','catch','show','WhatsappQueueReport','find','create','body','update'];(function(_0x6ef26d,_0x4250c7){var _0x15579f=function(_0x14e47c){while(--_0x14e47c){_0x6ef26d['push'](_0x6ef26d['shift']());}};_0x15579f(++_0x4250c7);}(_0x5423,0xe3));var _0x3542=function(_0x576af9,_0x4ac436){_0x576af9=_0x576af9-0x0;var _0x5d0e59=_0x5423[_0x576af9];return _0x5d0e59;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];function respondWithStatusCode(_0x1cf710,_0x43e977){_0x43e977=_0x43e977||0xcc;return function(_0x4ee86){if(_0x4ee86){return _0x1cf710[_0x3542('0x18')](_0x43e977);}return _0x1cf710[_0x3542('0x19')](_0x43e977)[_0x3542('0x1a')]();};}function respondWithResult(_0x15863d,_0x4bac5b){_0x4bac5b=_0x4bac5b||0xc8;return function(_0x14fe57){if(_0x14fe57){return _0x15863d['status'](_0x4bac5b)[_0x3542('0x1b')](_0x14fe57);}};}function respondWithFilteredResult(_0x13fe0b,_0xc33d42){return function(_0x546fbd){if(_0x546fbd){var _0x270312=typeof _0xc33d42[_0x3542('0x1c')]===_0x3542('0x1d')&&typeof _0xc33d42['limit']===_0x3542('0x1d');var _0x23b0de=_0x546fbd[_0x3542('0x1e')];var _0x3d5199=_0x270312?0x0:_0xc33d42['offset'];var _0x32df3f=_0x270312?_0x546fbd['count']:_0xc33d42[_0x3542('0x1c')]+_0xc33d42[_0x3542('0x1f')];var _0x4d93bc;if(_0x32df3f>=_0x23b0de){_0x32df3f=_0x23b0de;_0x4d93bc=0xc8;}else{_0x4d93bc=0xce;}_0x13fe0b[_0x3542('0x19')](_0x4d93bc);return _0x13fe0b[_0x3542('0x20')](_0x3542('0x21'),_0x3d5199+'-'+_0x32df3f+'/'+_0x23b0de)[_0x3542('0x1b')](_0x546fbd);}return null;};}function patchUpdates(_0x212950){return function(_0x4a7695){try{jsonpatch['apply'](_0x4a7695,_0x212950,!![]);}catch(_0x4c58f1){return BPromise[_0x3542('0x22')](_0x4c58f1);}return _0x4a7695['save']();};}function saveUpdates(_0x1d5488,_0x551645){return function(_0x1d5f1e){if(_0x1d5f1e){return _0x1d5f1e['update'](_0x1d5488)['then'](function(_0x3eacd0){return _0x3eacd0;});}return null;};}function removeEntity(_0xe3f983,_0x5ae097){return function(_0x5d05b2){if(_0x5d05b2){return _0x5d05b2[_0x3542('0x23')]()['then'](function(){_0xe3f983[_0x3542('0x19')](0xcc)[_0x3542('0x1a')]();});}};}function handleEntityNotFound(_0x1e0723,_0x2f2e63){return function(_0x298763){if(!_0x298763){_0x1e0723[_0x3542('0x18')](0x194);}return _0x298763;};}function handleError(_0x412184,_0x1e156e){_0x1e156e=_0x1e156e||0x1f4;return function(_0x18dc6c){logger[_0x3542('0x24')](_0x18dc6c[_0x3542('0x25')]);if(_0x18dc6c[_0x3542('0x26')]){delete _0x18dc6c[_0x3542('0x26')];}_0x412184[_0x3542('0x19')](_0x1e156e)[_0x3542('0x27')](_0x18dc6c);};}exports[_0x3542('0x28')]=function(_0x303412,_0x20eda1){var _0x3bd666={},_0x5590a2={},_0x31ad47={'count':0x0,'rows':[]};var _0x35bbc9=_[_0x3542('0x29')](db['WhatsappQueueReport'][_0x3542('0x2a')],function(_0xc6f23b){return{'name':_0xc6f23b[_0x3542('0x2b')],'type':_0xc6f23b[_0x3542('0x2c')]['key']};});_0x5590a2['model']=_[_0x3542('0x29')](_0x35bbc9,_0x3542('0x26'));_0x5590a2[_0x3542('0x2d')]=_[_0x3542('0x2e')](_0x303412[_0x3542('0x2d')]);_0x5590a2[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x5590a2['model'],_0x5590a2['query']);_0x3bd666[_0x3542('0x31')]=_['intersection'](_0x5590a2['model'],qs[_0x3542('0x32')](_0x303412['query']['fields']));_0x3bd666[_0x3542('0x31')]=_0x3bd666[_0x3542('0x31')][_0x3542('0x33')]?_0x3bd666['attributes']:_0x5590a2[_0x3542('0x34')];if(!_0x303412['query'][_0x3542('0x35')](_0x3542('0x36'))){_0x3bd666['limit']=qs[_0x3542('0x1f')](_0x303412['query'][_0x3542('0x1f')]);_0x3bd666[_0x3542('0x1c')]=qs[_0x3542('0x1c')](_0x303412['query'][_0x3542('0x1c')]);}_0x3bd666['order']=qs[_0x3542('0x37')](_0x303412[_0x3542('0x2d')][_0x3542('0x37')]);_0x3bd666[_0x3542('0x38')]=qs[_0x3542('0x2f')](_[_0x3542('0x39')](_0x303412[_0x3542('0x2d')],_0x5590a2[_0x3542('0x2f')]),_0x35bbc9);if(_0x303412[_0x3542('0x2d')][_0x3542('0x3a')]){_0x3bd666[_0x3542('0x38')]=_[_0x3542('0x3b')](_0x3bd666[_0x3542('0x38')],{'$or':_['map'](_0x35bbc9,function(_0x62429){if(_0x62429['type']!=='VIRTUAL'){var _0x2782f2={};_0x2782f2[_0x62429[_0x3542('0x26')]]={'$like':'%'+_0x303412[_0x3542('0x2d')][_0x3542('0x3a')]+'%'};return _0x2782f2;}})});}_0x3bd666=_[_0x3542('0x3b')]({},_0x3bd666,_0x303412[_0x3542('0x3c')]);var _0xc7f13c={'where':_0x3bd666[_0x3542('0x38')]};return db['WhatsappQueueReport'][_0x3542('0x1e')](_0xc7f13c)['then'](function(_0x1c8855){_0x31ad47[_0x3542('0x1e')]=_0x1c8855;if(_0x303412['query'][_0x3542('0x3d')]){_0x3bd666[_0x3542('0x3e')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x3542('0x3f')](_0x3bd666);})[_0x3542('0x40')](function(_0x5e1b29){_0x31ad47[_0x3542('0x41')]=_0x5e1b29;return _0x31ad47;})[_0x3542('0x40')](respondWithFilteredResult(_0x20eda1,_0x3bd666))[_0x3542('0x42')](handleError(_0x20eda1,null));};exports[_0x3542('0x43')]=function(_0x290c7c,_0xb12441){var _0x2b54b9={'raw':!![],'where':{'id':_0x290c7c['params']['id']}},_0x4bf45a={};_0x4bf45a[_0x3542('0x34')]=_[_0x3542('0x2e')](db[_0x3542('0x44')][_0x3542('0x2a')]);_0x4bf45a[_0x3542('0x2d')]=_['keys'](_0x290c7c[_0x3542('0x2d')]);_0x4bf45a['filters']=_[_0x3542('0x30')](_0x4bf45a[_0x3542('0x34')],_0x4bf45a[_0x3542('0x2d')]);_0x2b54b9['attributes']=_[_0x3542('0x30')](_0x4bf45a[_0x3542('0x34')],qs['fields'](_0x290c7c[_0x3542('0x2d')][_0x3542('0x32')]));_0x2b54b9[_0x3542('0x31')]=_0x2b54b9[_0x3542('0x31')][_0x3542('0x33')]?_0x2b54b9[_0x3542('0x31')]:_0x4bf45a[_0x3542('0x34')];if(_0x290c7c[_0x3542('0x2d')]['includeAll']){_0x2b54b9['include']=[{'all':!![]}];}_0x2b54b9=_['merge']({},_0x2b54b9,_0x290c7c[_0x3542('0x3c')]);return db[_0x3542('0x44')][_0x3542('0x45')](_0x2b54b9)[_0x3542('0x40')](handleEntityNotFound(_0xb12441,null))[_0x3542('0x40')](respondWithResult(_0xb12441,null))[_0x3542('0x42')](handleError(_0xb12441,null));};exports[_0x3542('0x46')]=function(_0x5adf34,_0x157683){return db[_0x3542('0x44')][_0x3542('0x46')](_0x5adf34[_0x3542('0x47')],{})['then'](respondWithResult(_0x157683,0xc9))[_0x3542('0x42')](handleError(_0x157683,null));};exports[_0x3542('0x48')]=function(_0x55b43a,_0x528f8c){if(_0x55b43a[_0x3542('0x47')]['id']){delete _0x55b43a[_0x3542('0x47')]['id'];}return db[_0x3542('0x44')][_0x3542('0x45')]({'where':{'id':_0x55b43a[_0x3542('0x49')]['id']}})[_0x3542('0x40')](handleEntityNotFound(_0x528f8c,null))[_0x3542('0x40')](saveUpdates(_0x55b43a['body'],null))[_0x3542('0x40')](respondWithResult(_0x528f8c,null))[_0x3542('0x42')](handleError(_0x528f8c,null));};exports[_0x3542('0x23')]=function(_0x392c6e,_0x1ebc82){return db[_0x3542('0x44')][_0x3542('0x45')]({'where':{'id':_0x392c6e[_0x3542('0x49')]['id']}})[_0x3542('0x40')](handleEntityNotFound(_0x1ebc82,null))['then'](removeEntity(_0x1ebc82,null))['catch'](handleError(_0x1ebc82,null));};exports[_0x3542('0x4a')]=function(_0x4b406b,_0x5a798a){return db['WhatsappQueueReport'][_0x3542('0x4a')]()[_0x3542('0x40')](respondWithResult(_0x5a798a,null))[_0x3542('0x42')](handleError(_0x5a798a,null));}; \ No newline at end of file +var _0x14a0=['mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x14a0,0x8e));var _0x014a=function(_0x47aa0e,_0x1598aa){_0x47aa0e=_0x47aa0e-0x0;var _0x3ee41d=_0x14a0[_0x47aa0e];return _0x3ee41d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];function respondWithStatusCode(_0x43bfeb,_0x1bcd1){_0x1bcd1=_0x1bcd1||0xcc;return function(_0x20cb56){if(_0x20cb56){return _0x43bfeb[_0x014a('0x14')](_0x1bcd1);}return _0x43bfeb[_0x014a('0x15')](_0x1bcd1)[_0x014a('0x16')]();};}function respondWithResult(_0x71535d,_0x45cd80){_0x45cd80=_0x45cd80||0xc8;return function(_0x3c54c8){if(_0x3c54c8){return _0x71535d['status'](_0x45cd80)[_0x014a('0x17')](_0x3c54c8);}};}function respondWithFilteredResult(_0x3cf92f,_0x59f207){return function(_0x3a836f){if(_0x3a836f){var _0x128c46=typeof _0x59f207['offset']===_0x014a('0x18')&&typeof _0x59f207[_0x014a('0x19')]===_0x014a('0x18');var _0x12da95=_0x3a836f[_0x014a('0x1a')];var _0x12d339=_0x128c46?0x0:_0x59f207[_0x014a('0x1b')];var _0x263b07=_0x128c46?_0x3a836f[_0x014a('0x1a')]:_0x59f207[_0x014a('0x1b')]+_0x59f207[_0x014a('0x19')];var _0x89e132;if(_0x263b07>=_0x12da95){_0x263b07=_0x12da95;_0x89e132=0xc8;}else{_0x89e132=0xce;}_0x3cf92f[_0x014a('0x15')](_0x89e132);return _0x3cf92f[_0x014a('0x1c')]('Content-Range',_0x12d339+'-'+_0x263b07+'/'+_0x12da95)[_0x014a('0x17')](_0x3a836f);}return null;};}function patchUpdates(_0x109a9c){return function(_0x11065f){try{jsonpatch[_0x014a('0x1d')](_0x11065f,_0x109a9c,!![]);}catch(_0xc9a563){return BPromise[_0x014a('0x1e')](_0xc9a563);}return _0x11065f[_0x014a('0x1f')]();};}function saveUpdates(_0x3dd2d0,_0x290b86){return function(_0x486e66){if(_0x486e66){return _0x486e66[_0x014a('0x20')](_0x3dd2d0)['then'](function(_0x1a1318){return _0x1a1318;});}return null;};}function removeEntity(_0x26718b,_0x44d921){return function(_0x36d52b){if(_0x36d52b){return _0x36d52b[_0x014a('0x21')]()[_0x014a('0x22')](function(){_0x26718b[_0x014a('0x15')](0xcc)[_0x014a('0x16')]();});}};}function handleEntityNotFound(_0x165a42,_0x4c2627){return function(_0x3b4b92){if(!_0x3b4b92){_0x165a42['sendStatus'](0x194);}return _0x3b4b92;};}function handleError(_0x39a432,_0x28701e){_0x28701e=_0x28701e||0x1f4;return function(_0x4f1c44){logger['error'](_0x4f1c44[_0x014a('0x23')]);if(_0x4f1c44[_0x014a('0x24')]){delete _0x4f1c44[_0x014a('0x24')];}_0x39a432['status'](_0x28701e)[_0x014a('0x25')](_0x4f1c44);};}exports[_0x014a('0x26')]=function(_0x598179,_0x31dc95){var _0x2560a6={},_0x496040={},_0x4f9c1c={'count':0x0,'rows':[]};var _0x397850=_[_0x014a('0x27')](db[_0x014a('0x28')][_0x014a('0x29')],function(_0x4ea00c){return{'name':_0x4ea00c[_0x014a('0x2a')],'type':_0x4ea00c[_0x014a('0x2b')][_0x014a('0x2c')]};});_0x496040[_0x014a('0x2d')]=_[_0x014a('0x27')](_0x397850,_0x014a('0x24'));_0x496040[_0x014a('0x2e')]=_[_0x014a('0x2f')](_0x598179[_0x014a('0x2e')]);_0x496040[_0x014a('0x30')]=_[_0x014a('0x31')](_0x496040['model'],_0x496040[_0x014a('0x2e')]);_0x2560a6[_0x014a('0x32')]=_[_0x014a('0x31')](_0x496040[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x598179[_0x014a('0x2e')][_0x014a('0x33')]));_0x2560a6['attributes']=_0x2560a6[_0x014a('0x32')][_0x014a('0x34')]?_0x2560a6['attributes']:_0x496040[_0x014a('0x2d')];if(!_0x598179[_0x014a('0x2e')][_0x014a('0x35')](_0x014a('0x36'))){_0x2560a6[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x598179[_0x014a('0x2e')][_0x014a('0x19')]);_0x2560a6['offset']=qs[_0x014a('0x1b')](_0x598179[_0x014a('0x2e')][_0x014a('0x1b')]);}_0x2560a6[_0x014a('0x37')]=qs['sort'](_0x598179[_0x014a('0x2e')][_0x014a('0x38')]);_0x2560a6[_0x014a('0x39')]=qs[_0x014a('0x30')](_[_0x014a('0x3a')](_0x598179[_0x014a('0x2e')],_0x496040[_0x014a('0x30')]),_0x397850);if(_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]){_0x2560a6['where']=_[_0x014a('0x3c')](_0x2560a6['where'],{'$or':_[_0x014a('0x27')](_0x397850,function(_0xc11492){if(_0xc11492[_0x014a('0x2b')]!==_0x014a('0x3d')){var _0x43376c={};_0x43376c[_0xc11492['name']]={'$like':'%'+_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]+'%'};return _0x43376c;}})});}_0x2560a6=_['merge']({},_0x2560a6,_0x598179[_0x014a('0x3e')]);var _0x2990df={'where':_0x2560a6[_0x014a('0x39')]};return db[_0x014a('0x28')][_0x014a('0x1a')](_0x2990df)[_0x014a('0x22')](function(_0x17b1b6){_0x4f9c1c[_0x014a('0x1a')]=_0x17b1b6;if(_0x598179[_0x014a('0x2e')]['includeAll']){_0x2560a6[_0x014a('0x3f')]=[{'all':!![]}];}return db[_0x014a('0x28')][_0x014a('0x40')](_0x2560a6);})[_0x014a('0x22')](function(_0x5f1a91){_0x4f9c1c[_0x014a('0x41')]=_0x5f1a91;return _0x4f9c1c;})[_0x014a('0x22')](respondWithFilteredResult(_0x31dc95,_0x2560a6))[_0x014a('0x42')](handleError(_0x31dc95,null));};exports[_0x014a('0x43')]=function(_0x1dc647,_0x430a56){var _0x5f2969={'raw':!![],'where':{'id':_0x1dc647[_0x014a('0x44')]['id']}},_0x361866={};_0x361866['model']=_[_0x014a('0x2f')](db[_0x014a('0x28')][_0x014a('0x29')]);_0x361866['query']=_[_0x014a('0x2f')](_0x1dc647['query']);_0x361866['filters']=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],_0x361866['query']);_0x5f2969[_0x014a('0x32')]=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x1dc647[_0x014a('0x2e')][_0x014a('0x33')]));_0x5f2969['attributes']=_0x5f2969[_0x014a('0x32')][_0x014a('0x34')]?_0x5f2969[_0x014a('0x32')]:_0x361866['model'];if(_0x1dc647['query'][_0x014a('0x45')]){_0x5f2969['include']=[{'all':!![]}];}_0x5f2969=_['merge']({},_0x5f2969,_0x1dc647[_0x014a('0x3e')]);return db['WhatsappQueueReport'][_0x014a('0x46')](_0x5f2969)[_0x014a('0x22')](handleEntityNotFound(_0x430a56,null))[_0x014a('0x22')](respondWithResult(_0x430a56,null))['catch'](handleError(_0x430a56,null));};exports[_0x014a('0x47')]=function(_0x23be18,_0x12cd9b){return db[_0x014a('0x28')][_0x014a('0x47')](_0x23be18[_0x014a('0x48')],{})['then'](respondWithResult(_0x12cd9b,0xc9))[_0x014a('0x42')](handleError(_0x12cd9b,null));};exports[_0x014a('0x20')]=function(_0x5a861c,_0x1a4df9){if(_0x5a861c[_0x014a('0x48')]['id']){delete _0x5a861c[_0x014a('0x48')]['id'];}return db[_0x014a('0x28')][_0x014a('0x46')]({'where':{'id':_0x5a861c[_0x014a('0x44')]['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x1a4df9,null))[_0x014a('0x22')](saveUpdates(_0x5a861c['body'],null))[_0x014a('0x22')](respondWithResult(_0x1a4df9,null))[_0x014a('0x42')](handleError(_0x1a4df9,null));};exports[_0x014a('0x21')]=function(_0x135e7e,_0x312c7a){return db['WhatsappQueueReport'][_0x014a('0x46')]({'where':{'id':_0x135e7e['params']['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x312c7a,null))[_0x014a('0x22')](removeEntity(_0x312c7a,null))[_0x014a('0x42')](handleError(_0x312c7a,null));};exports[_0x014a('0x49')]=function(_0x3caa6e,_0x4f8547){return db['WhatsappQueueReport']['describe']()['then'](respondWithResult(_0x4f8547,null))[_0x014a('0x42')](handleError(_0x4f8547,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c252d26..87db273 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 _0x0ed3=['exports','define','report_whatsapp_queue','uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x313b2a,_0x5a490f){var _0x53eb6f=function(_0x4eaead){while(--_0x4eaead){_0x313b2a['push'](_0x313b2a['shift']());}};_0x53eb6f(++_0x5a490f);}(_0x0ed3,0x70));var _0x30ed=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0ed3[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x30ed('0x0'))(_0x30ed('0x1'));var moment=require('moment');var BPromise=require(_0x30ed('0x2'));var rp=require(_0x30ed('0x3'));var fs=require('fs');var path=require(_0x30ed('0x4'));var rimraf=require(_0x30ed('0x5'));var config=require(_0x30ed('0x6'));var attributes=require(_0x30ed('0x7'));module[_0x30ed('0x8')]=function(_0x281e81,_0x59e0b0){return _0x281e81[_0x30ed('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x30ed('0xa'),'paranoid':![],'indexes':[{'name':_0x30ed('0xb'),'fields':[_0x30ed('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb046=['./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f628b,_0x893c50){var _0x4676ad=function(_0x189c71){while(--_0x189c71){_0x2f628b['push'](_0x2f628b['shift']());}};_0x4676ad(++_0x893c50);}(_0xb046,0x1de));var _0x6b04=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0xb046[_0x480bc8];return _0x28c245;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6b04('0x0'));var moment=require('moment');var BPromise=require(_0x6b04('0x1'));var rp=require(_0x6b04('0x2'));var fs=require('fs');var path=require(_0x6b04('0x3'));var rimraf=require(_0x6b04('0x4'));var config=require(_0x6b04('0x5'));var attributes=require(_0x6b04('0x6'));module[_0x6b04('0x7')]=function(_0x66afbd,_0x28e09e){return _0x66afbd[_0x6b04('0x8')](_0x6b04('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6b04('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 258ab9a..ed949df 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 _0x8048=['UpdateWhatsappQueueReport','update','options','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','WhatsappQueueReport','create','body','raw','CreateWhatsappQueueReport','debug'];(function(_0x2e6ab8,_0x4ea85c){var _0x16cba0=function(_0x4b3776){while(--_0x4b3776){_0x2e6ab8['push'](_0x2e6ab8['shift']());}};_0x16cba0(++_0x4ea85c);}(_0x8048,0x166));var _0x8804=function(_0x205ed2,_0x248ed0){_0x205ed2=_0x205ed2-0x0;var _0x540c3b=_0x8048[_0x205ed2];return _0x540c3b;};'use strict';var _=require('lodash');var util=require(_0x8804('0x0'));var moment=require(_0x8804('0x1'));var BPromise=require(_0x8804('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8804('0x3'));var db=require(_0x8804('0x4'))['db'];var utils=require(_0x8804('0x5'));var logger=require(_0x8804('0x6'))('rpc');var config=require(_0x8804('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8804('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ef2ee,_0x1373e2,_0x2ce8a6){return new BPromise(function(_0x35eb20,_0x37d836){return client[_0x8804('0x9')](_0x5ef2ee,_0x2ce8a6)[_0x8804('0xa')](function(_0x317c4d){logger[_0x8804('0xb')](_0x8804('0xc'),_0x1373e2,_0x8804('0xd'));logger['debug'](_0x8804('0xe'),_0x1373e2,'request\x20sent',JSON[_0x8804('0xf')](_0x317c4d));if(_0x317c4d[_0x8804('0x10')]){if(_0x317c4d[_0x8804('0x10')]['code']===0x1f4){logger[_0x8804('0x10')](_0x8804('0xc'),_0x1373e2,_0x317c4d['error'][_0x8804('0x11')]);return _0x37d836(_0x317c4d[_0x8804('0x10')][_0x8804('0x11')]);}logger[_0x8804('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1373e2,_0x317c4d[_0x8804('0x10')][_0x8804('0x11')]);return _0x35eb20(_0x317c4d[_0x8804('0x10')][_0x8804('0x11')]);}else{logger[_0x8804('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1373e2,'request\x20sent');_0x35eb20(_0x317c4d[_0x8804('0x12')][_0x8804('0x11')]);}})[_0x8804('0x13')](function(_0x52caa4){logger[_0x8804('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1373e2,_0x52caa4);_0x37d836(_0x52caa4);});});}exports['CreateWhatsappQueueReport']=function(_0x41dcc4){var _0x587168=this;return new Promise(function(_0x44e478,_0x51a86d){return db[_0x8804('0x14')][_0x8804('0x15')](_0x41dcc4[_0x8804('0x16')],{'raw':_0x41dcc4['options']?_0x41dcc4['options'][_0x8804('0x17')]===undefined?!![]:![]:!![]})[_0x8804('0xa')](function(_0x1f45dd){logger['info'](_0x8804('0x18'),_0x41dcc4);logger[_0x8804('0x19')]('CreateWhatsappQueueReport',_0x41dcc4,JSON['stringify'](_0x1f45dd));_0x44e478(_0x1f45dd);})['catch'](function(_0x2b259c){logger[_0x8804('0x10')]('CreateWhatsappQueueReport',_0x2b259c[_0x8804('0x11')],_0x41dcc4);_0x51a86d(_0x587168[_0x8804('0x10')](0x1f4,_0x2b259c['message']));});});};exports[_0x8804('0x1a')]=function(_0x35e4c2){var _0x165e16=this;return new Promise(function(_0x24728f,_0x23456c){return db[_0x8804('0x14')][_0x8804('0x1b')](_0x35e4c2[_0x8804('0x16')],{'raw':_0x35e4c2[_0x8804('0x1c')]?_0x35e4c2[_0x8804('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35e4c2['options']?_0x35e4c2[_0x8804('0x1c')][_0x8804('0x1d')]||null:null,'attributes':_0x35e4c2[_0x8804('0x1c')]?_0x35e4c2[_0x8804('0x1c')][_0x8804('0x1e')]||null:null,'limit':_0x35e4c2[_0x8804('0x1c')]?_0x35e4c2[_0x8804('0x1c')][_0x8804('0x1f')]||null:null})[_0x8804('0xa')](function(_0x32b4a8){logger[_0x8804('0xb')](_0x8804('0x1a'),_0x35e4c2);logger[_0x8804('0x19')](_0x8804('0x1a'),_0x35e4c2,JSON['stringify'](_0x32b4a8));_0x24728f(_0x32b4a8);})[_0x8804('0x13')](function(_0x3fe3e4){logger[_0x8804('0x10')](_0x8804('0x1a'),_0x3fe3e4[_0x8804('0x11')],_0x35e4c2);_0x23456c(_0x165e16['error'](0x1f4,_0x3fe3e4[_0x8804('0x11')]));});});}; \ No newline at end of file +var _0xa973=['UpdateWhatsappQueueReport','update','body','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','create','options','raw','then','CreateWhatsappQueueReport','debug'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa973,0x1ef));var _0x3a97=function(_0x9572ff,_0x188aba){_0x9572ff=_0x9572ff-0x0;var _0x398c8a=_0xa973[_0x9572ff];return _0x398c8a;};'use strict';var _=require(_0x3a97('0x0'));var util=require(_0x3a97('0x1'));var moment=require(_0x3a97('0x2'));var BPromise=require(_0x3a97('0x3'));var rs=require(_0x3a97('0x4'));var fs=require('fs');var Redis=require(_0x3a97('0x5'));var db=require(_0x3a97('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a97('0x7'))(_0x3a97('0x8'));var config=require(_0x3a97('0x9'));var jayson=require(_0x3a97('0xa'));var client=jayson[_0x3a97('0xb')][_0x3a97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x167392,_0x3bad8a,_0x33f689){return new BPromise(function(_0x8ce879,_0xb5423d){return client['request'](_0x167392,_0x33f689)['then'](function(_0x71a4c5){logger[_0x3a97('0xd')](_0x3a97('0xe'),_0x3bad8a,_0x3a97('0xf'));logger['debug'](_0x3a97('0x10'),_0x3bad8a,_0x3a97('0xf'),JSON[_0x3a97('0x11')](_0x71a4c5));if(_0x71a4c5[_0x3a97('0x12')]){if(_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x13')]===0x1f4){logger['error'](_0x3a97('0xe'),_0x3bad8a,_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x14')]);return _0xb5423d(_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x14')]);}logger[_0x3a97('0x12')](_0x3a97('0xe'),_0x3bad8a,_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x14')]);return _0x8ce879(_0x71a4c5[_0x3a97('0x12')][_0x3a97('0x14')]);}else{logger[_0x3a97('0xd')](_0x3a97('0xe'),_0x3bad8a,_0x3a97('0xf'));_0x8ce879(_0x71a4c5[_0x3a97('0x15')][_0x3a97('0x14')]);}})[_0x3a97('0x16')](function(_0xb3d645){logger[_0x3a97('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3bad8a,_0xb3d645);_0xb5423d(_0xb3d645);});});}exports['CreateWhatsappQueueReport']=function(_0x4fffac){var _0x446344=this;return new Promise(function(_0x28b340,_0x2eaefd){return db[_0x3a97('0x17')][_0x3a97('0x18')](_0x4fffac['body'],{'raw':_0x4fffac[_0x3a97('0x19')]?_0x4fffac[_0x3a97('0x19')][_0x3a97('0x1a')]===undefined?!![]:![]:!![]})[_0x3a97('0x1b')](function(_0xdfe1da){logger[_0x3a97('0xd')](_0x3a97('0x1c'),_0x4fffac);logger[_0x3a97('0x1d')](_0x3a97('0x1c'),_0x4fffac,JSON[_0x3a97('0x11')](_0xdfe1da));_0x28b340(_0xdfe1da);})[_0x3a97('0x16')](function(_0x5b4a0c){logger['error'](_0x3a97('0x1c'),_0x5b4a0c[_0x3a97('0x14')],_0x4fffac);_0x2eaefd(_0x446344[_0x3a97('0x12')](0x1f4,_0x5b4a0c[_0x3a97('0x14')]));});});};exports[_0x3a97('0x1e')]=function(_0x5da384){var _0x42d094=this;return new Promise(function(_0x40aed7,_0x2a58bc){return db[_0x3a97('0x17')][_0x3a97('0x1f')](_0x5da384[_0x3a97('0x20')],{'raw':_0x5da384[_0x3a97('0x19')]?_0x5da384['options'][_0x3a97('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5da384[_0x3a97('0x19')]?_0x5da384[_0x3a97('0x19')][_0x3a97('0x21')]||null:null,'attributes':_0x5da384[_0x3a97('0x19')]?_0x5da384[_0x3a97('0x19')][_0x3a97('0x22')]||null:null,'limit':_0x5da384[_0x3a97('0x19')]?_0x5da384['options']['limit']||null:null})[_0x3a97('0x1b')](function(_0x4e6c50){logger[_0x3a97('0xd')](_0x3a97('0x1e'),_0x5da384);logger[_0x3a97('0x1d')](_0x3a97('0x1e'),_0x5da384,JSON[_0x3a97('0x11')](_0x4e6c50));_0x40aed7(_0x4e6c50);})[_0x3a97('0x16')](function(_0x42e550){logger[_0x3a97('0x12')](_0x3a97('0x1e'),_0x42e550[_0x3a97('0x14')],_0x5da384);_0x2a58bc(_0x42d094[_0x3a97('0x12')](0x1f4,_0x42e550[_0x3a97('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index e4f2462..7518eb9 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 _0x8f2e=['isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x4c4cfb,_0xd38b7f){var _0x537d4f=function(_0x581428){while(--_0x581428){_0x4c4cfb['push'](_0x4c4cfb['shift']());}};_0x537d4f(++_0xd38b7f);}(_0x8f2e,0x174));var _0xe8f2=function(_0x49f9aa,_0x529ea8){_0x49f9aa=_0x49f9aa-0x0;var _0x59a6fa=_0x8f2e[_0x49f9aa];return _0x59a6fa;};'use strict';var multer=require(_0xe8f2('0x0'));var util=require('util');var path=require(_0xe8f2('0x1'));var timeout=require(_0xe8f2('0x2'));var express=require('express');var router=express[_0xe8f2('0x3')]();var fs_extra=require(_0xe8f2('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe8f2('0x5'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0xe8f2('0x6')](),controller['index']);router['get']('/describe',auth[_0xe8f2('0x6')](),controller[_0xe8f2('0x7')]);router[_0xe8f2('0x8')](_0xe8f2('0x9'),auth[_0xe8f2('0x6')](),controller[_0xe8f2('0xa')]);router[_0xe8f2('0xb')]('/',auth[_0xe8f2('0x6')](),controller[_0xe8f2('0xc')]);router[_0xe8f2('0xd')](_0xe8f2('0x9'),auth['isAuthenticated'](),controller[_0xe8f2('0xe')]);router[_0xe8f2('0xf')](_0xe8f2('0x9'),auth['isAuthenticated'](),controller[_0xe8f2('0x10')]);module[_0xe8f2('0x11')]=router; \ No newline at end of file +var _0xad82=['fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x1eca4d,_0x586c37){var _0x3344db=function(_0x13a510){while(--_0x13a510){_0x1eca4d['push'](_0x1eca4d['shift']());}};_0x3344db(++_0x586c37);}(_0xad82,0x19f));var _0x2ad8=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xad82[_0x3430aa];return _0x2ac5c;};'use strict';var multer=require(_0x2ad8('0x0'));var util=require(_0x2ad8('0x1'));var path=require('path');var timeout=require(_0x2ad8('0x2'));var express=require(_0x2ad8('0x3'));var router=express[_0x2ad8('0x4')]();var fs_extra=require(_0x2ad8('0x5'));var auth=require(_0x2ad8('0x6'));var interaction=require(_0x2ad8('0x7'));var config=require('../../config/environment');var controller=require(_0x2ad8('0x8'));router[_0x2ad8('0x9')]('/',auth[_0x2ad8('0xa')](),controller[_0x2ad8('0xb')]);router[_0x2ad8('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2ad8('0x9')](_0x2ad8('0xc'),auth[_0x2ad8('0xa')](),controller[_0x2ad8('0xd')]);router[_0x2ad8('0xe')]('/',auth[_0x2ad8('0xa')](),controller[_0x2ad8('0xf')]);router[_0x2ad8('0x10')](_0x2ad8('0xc'),auth[_0x2ad8('0xa')](),controller[_0x2ad8('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2ad8('0x12')]);module[_0x2ad8('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 61be5a6..390df94 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 _0xb7e7=['queue','sequelize','STRING','account'];(function(_0x5b5ff3,_0x438f3a){var _0xbd7f3b=function(_0x175a40){while(--_0x175a40){_0x5b5ff3['push'](_0x5b5ff3['shift']());}};_0xbd7f3b(++_0x438f3a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xb7e7[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x2'),'agent',_0x7b7e('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x79d7=['queue','DATE','sequelize','STRING','ENUM','account','agent'];(function(_0x2e8cf6,_0x3352f8){var _0x203430=function(_0x2b8d81){while(--_0x2b8d81){_0x2e8cf6['push'](_0x2e8cf6['shift']());}};_0x203430(++_0x3352f8);}(_0x79d7,0x9c));var _0x779d=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x79d7[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require(_0x779d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x779d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x779d('0x2')](_0x779d('0x3'),_0x779d('0x4'),_0x779d('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x779d('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index bbbff29..24fc02f 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 _0x06fb=['name','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','create','body','find','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack'];(function(_0x1d1963,_0x32cc0e){var _0x3f58bb=function(_0x514823){while(--_0x514823){_0x1d1963['push'](_0x1d1963['shift']());}};_0x3f58bb(++_0x32cc0e);}(_0x06fb,0x190));var _0xb06f=function(_0x33cd42,_0x37725a){_0x33cd42=_0x33cd42-0x0;var _0x234c55=_0x06fb[_0x33cd42];return _0x234c55;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb06f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb06f('0x1'));var rp=require(_0xb06f('0x2'));var moment=require(_0xb06f('0x3'));var BPromise=require(_0xb06f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb06f('0x5'));var csv=require(_0xb06f('0x6'));var ejs=require(_0xb06f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb06f('0x8'));var squel=require(_0xb06f('0x9'));var crypto=require(_0xb06f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb06f('0xb'));var toCsv=require(_0xb06f('0x6'));var querystring=require(_0xb06f('0xc'));var Papa=require(_0xb06f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb06f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb06f('0xf'))(_0xb06f('0x10'));var utils=require(_0xb06f('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xb06f('0x12'));var db=require(_0xb06f('0x13'))['db'];function respondWithStatusCode(_0x1112a6,_0x276d71){_0x276d71=_0x276d71||0xcc;return function(_0x2718e5){if(_0x2718e5){return _0x1112a6[_0xb06f('0x14')](_0x276d71);}return _0x1112a6[_0xb06f('0x15')](_0x276d71)[_0xb06f('0x16')]();};}function respondWithResult(_0x1df133,_0x6c3e27){_0x6c3e27=_0x6c3e27||0xc8;return function(_0x2a8c5d){if(_0x2a8c5d){return _0x1df133[_0xb06f('0x15')](_0x6c3e27)[_0xb06f('0x17')](_0x2a8c5d);}};}function respondWithFilteredResult(_0x324fa8,_0x4eb34b){return function(_0x5df55e){if(_0x5df55e){var _0x591a9f=typeof _0x4eb34b[_0xb06f('0x18')]===_0xb06f('0x19')&&typeof _0x4eb34b['limit']===_0xb06f('0x19');var _0x3efc2d=_0x5df55e['count'];var _0x2bac5e=_0x591a9f?0x0:_0x4eb34b['offset'];var _0x34214b=_0x591a9f?_0x5df55e[_0xb06f('0x1a')]:_0x4eb34b[_0xb06f('0x18')]+_0x4eb34b[_0xb06f('0x1b')];var _0x5bc3db;if(_0x34214b>=_0x3efc2d){_0x34214b=_0x3efc2d;_0x5bc3db=0xc8;}else{_0x5bc3db=0xce;}_0x324fa8[_0xb06f('0x15')](_0x5bc3db);return _0x324fa8[_0xb06f('0x1c')](_0xb06f('0x1d'),_0x2bac5e+'-'+_0x34214b+'/'+_0x3efc2d)[_0xb06f('0x17')](_0x5df55e);}return null;};}function patchUpdates(_0x3ee12a){return function(_0x3b81b9){try{jsonpatch[_0xb06f('0x1e')](_0x3b81b9,_0x3ee12a,!![]);}catch(_0xdc2c3b){return BPromise[_0xb06f('0x1f')](_0xdc2c3b);}return _0x3b81b9[_0xb06f('0x20')]();};}function saveUpdates(_0x42ae61,_0x20a23e){return function(_0x4ea5c6){if(_0x4ea5c6){return _0x4ea5c6[_0xb06f('0x21')](_0x42ae61)['then'](function(_0x3ad61e){return _0x3ad61e;});}return null;};}function removeEntity(_0x38a8b3,_0x2f35a1){return function(_0xef23f2){if(_0xef23f2){return _0xef23f2[_0xb06f('0x22')]()[_0xb06f('0x23')](function(){_0x38a8b3[_0xb06f('0x15')](0xcc)[_0xb06f('0x16')]();});}};}function handleEntityNotFound(_0x1d9524,_0x50892d){return function(_0x1d4c7a){if(!_0x1d4c7a){_0x1d9524[_0xb06f('0x14')](0x194);}return _0x1d4c7a;};}function handleError(_0x359ed0,_0x1e1bc2){_0x1e1bc2=_0x1e1bc2||0x1f4;return function(_0x441192){logger[_0xb06f('0x24')](_0x441192[_0xb06f('0x25')]);if(_0x441192[_0xb06f('0x26')]){delete _0x441192['name'];}_0x359ed0[_0xb06f('0x15')](_0x1e1bc2)['send'](_0x441192);};}exports[_0xb06f('0x27')]=function(_0x4bee19,_0x50f323){var _0x1785e3={},_0x4c92b4={},_0x3a5979={'count':0x0,'rows':[]};var _0x480f21=_[_0xb06f('0x28')](db[_0xb06f('0x29')][_0xb06f('0x2a')],function(_0x3da2cf){return{'name':_0x3da2cf[_0xb06f('0x2b')],'type':_0x3da2cf['type'][_0xb06f('0x2c')]};});_0x4c92b4[_0xb06f('0x2d')]=_[_0xb06f('0x28')](_0x480f21,_0xb06f('0x26'));_0x4c92b4[_0xb06f('0x2e')]=_[_0xb06f('0x2f')](_0x4bee19[_0xb06f('0x2e')]);_0x4c92b4[_0xb06f('0x30')]=_[_0xb06f('0x31')](_0x4c92b4[_0xb06f('0x2d')],_0x4c92b4['query']);_0x1785e3[_0xb06f('0x32')]=_[_0xb06f('0x31')](_0x4c92b4['model'],qs[_0xb06f('0x33')](_0x4bee19['query'][_0xb06f('0x33')]));_0x1785e3[_0xb06f('0x32')]=_0x1785e3[_0xb06f('0x32')][_0xb06f('0x34')]?_0x1785e3['attributes']:_0x4c92b4[_0xb06f('0x2d')];if(!_0x4bee19[_0xb06f('0x2e')][_0xb06f('0x35')](_0xb06f('0x36'))){_0x1785e3[_0xb06f('0x1b')]=qs[_0xb06f('0x1b')](_0x4bee19['query'][_0xb06f('0x1b')]);_0x1785e3['offset']=qs['offset'](_0x4bee19[_0xb06f('0x2e')][_0xb06f('0x18')]);}_0x1785e3[_0xb06f('0x37')]=qs['sort'](_0x4bee19[_0xb06f('0x2e')][_0xb06f('0x38')]);_0x1785e3[_0xb06f('0x39')]=qs[_0xb06f('0x30')](_[_0xb06f('0x3a')](_0x4bee19['query'],_0x4c92b4['filters']),_0x480f21);if(_0x4bee19[_0xb06f('0x2e')][_0xb06f('0x3b')]){_0x1785e3[_0xb06f('0x39')]=_[_0xb06f('0x3c')](_0x1785e3['where'],{'$or':_[_0xb06f('0x28')](_0x480f21,function(_0x2bfc40){if(_0x2bfc40[_0xb06f('0x3d')]!==_0xb06f('0x3e')){var _0x1d4c71={};_0x1d4c71[_0x2bfc40[_0xb06f('0x26')]]={'$like':'%'+_0x4bee19[_0xb06f('0x2e')][_0xb06f('0x3b')]+'%'};return _0x1d4c71;}})});}_0x1785e3=_[_0xb06f('0x3c')]({},_0x1785e3,_0x4bee19['options']);var _0x5f3dcf={'where':_0x1785e3[_0xb06f('0x39')]};return db[_0xb06f('0x29')][_0xb06f('0x1a')](_0x5f3dcf)[_0xb06f('0x23')](function(_0x1a5151){_0x3a5979[_0xb06f('0x1a')]=_0x1a5151;if(_0x4bee19['query'][_0xb06f('0x3f')]){_0x1785e3[_0xb06f('0x40')]=[{'all':!![]}];}return db[_0xb06f('0x29')]['findAll'](_0x1785e3);})[_0xb06f('0x23')](function(_0xee889){_0x3a5979[_0xb06f('0x41')]=_0xee889;return _0x3a5979;})[_0xb06f('0x23')](respondWithFilteredResult(_0x50f323,_0x1785e3))[_0xb06f('0x42')](handleError(_0x50f323,null));};exports[_0xb06f('0x43')]=function(_0x21a50e,_0xc9c312){var _0x3d9d1b={'raw':!![],'where':{'id':_0x21a50e['params']['id']}},_0x449a0c={};_0x449a0c[_0xb06f('0x2d')]=_[_0xb06f('0x2f')](db['WhatsappTransferReport'][_0xb06f('0x2a')]);_0x449a0c[_0xb06f('0x2e')]=_[_0xb06f('0x2f')](_0x21a50e[_0xb06f('0x2e')]);_0x449a0c[_0xb06f('0x30')]=_[_0xb06f('0x31')](_0x449a0c['model'],_0x449a0c[_0xb06f('0x2e')]);_0x3d9d1b[_0xb06f('0x32')]=_[_0xb06f('0x31')](_0x449a0c[_0xb06f('0x2d')],qs[_0xb06f('0x33')](_0x21a50e[_0xb06f('0x2e')]['fields']));_0x3d9d1b[_0xb06f('0x32')]=_0x3d9d1b[_0xb06f('0x32')][_0xb06f('0x34')]?_0x3d9d1b['attributes']:_0x449a0c['model'];if(_0x21a50e['query']['includeAll']){_0x3d9d1b[_0xb06f('0x40')]=[{'all':!![]}];}_0x3d9d1b=_[_0xb06f('0x3c')]({},_0x3d9d1b,_0x21a50e['options']);return db[_0xb06f('0x29')]['find'](_0x3d9d1b)[_0xb06f('0x23')](handleEntityNotFound(_0xc9c312,null))['then'](respondWithResult(_0xc9c312,null))[_0xb06f('0x42')](handleError(_0xc9c312,null));};exports[_0xb06f('0x44')]=function(_0x317db2,_0x11240b){return db[_0xb06f('0x29')][_0xb06f('0x44')](_0x317db2[_0xb06f('0x45')],{})['then'](respondWithResult(_0x11240b,0xc9))['catch'](handleError(_0x11240b,null));};exports[_0xb06f('0x21')]=function(_0x57d168,_0x31b56b){if(_0x57d168[_0xb06f('0x45')]['id']){delete _0x57d168[_0xb06f('0x45')]['id'];}return db[_0xb06f('0x29')][_0xb06f('0x46')]({'where':{'id':_0x57d168['params']['id']}})[_0xb06f('0x23')](handleEntityNotFound(_0x31b56b,null))['then'](saveUpdates(_0x57d168[_0xb06f('0x45')],null))['then'](respondWithResult(_0x31b56b,null))[_0xb06f('0x42')](handleError(_0x31b56b,null));};exports[_0xb06f('0x22')]=function(_0x1bea2a,_0x4a1e21){return db[_0xb06f('0x29')][_0xb06f('0x46')]({'where':{'id':_0x1bea2a[_0xb06f('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a1e21,null))[_0xb06f('0x23')](removeEntity(_0x4a1e21,null))[_0xb06f('0x42')](handleError(_0x4a1e21,null));};exports[_0xb06f('0x48')]=function(_0x562996,_0x27155a){return db[_0xb06f('0x29')]['describe']()[_0xb06f('0x23')](respondWithResult(_0x27155a,null))[_0xb06f('0x42')](handleError(_0x27155a,null));}; \ No newline at end of file +var _0xe2cf=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','offset','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe2cf,0x14e));var _0xfe2c=function(_0x1ef48d,_0x19781c){_0x1ef48d=_0x1ef48d-0x0;var _0x25776c=_0xe2cf[_0x1ef48d];return _0x25776c;};'use strict';var emlformat=require(_0xfe2c('0x0'));var rimraf=require(_0xfe2c('0x1'));var zipdir=require(_0xfe2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe2c('0x3'));var moment=require(_0xfe2c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfe2c('0x5'));var util=require(_0xfe2c('0x6'));var path=require('path');var sox=require(_0xfe2c('0x7'));var csv=require(_0xfe2c('0x8'));var ejs=require(_0xfe2c('0x9'));var fs=require('fs');var fs_extra=require(_0xfe2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfe2c('0xb'));var jsforce=require(_0xfe2c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfe2c('0xd'));var Papa=require(_0xfe2c('0xe'));var Redis=require('ioredis');var authService=require(_0xfe2c('0xf'));var qs=require(_0xfe2c('0x10'));var as=require(_0xfe2c('0x11'));var hardwareService=require(_0xfe2c('0x12'));var logger=require(_0xfe2c('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xfe2c('0x14'));var licenseUtil=require(_0xfe2c('0x15'));var db=require(_0xfe2c('0x16'))['db'];function respondWithStatusCode(_0x3a89ee,_0x279cab){_0x279cab=_0x279cab||0xcc;return function(_0x2ab263){if(_0x2ab263){return _0x3a89ee[_0xfe2c('0x17')](_0x279cab);}return _0x3a89ee[_0xfe2c('0x18')](_0x279cab)[_0xfe2c('0x19')]();};}function respondWithResult(_0x152b7b,_0x5db79b){_0x5db79b=_0x5db79b||0xc8;return function(_0x53fb79){if(_0x53fb79){return _0x152b7b[_0xfe2c('0x18')](_0x5db79b)[_0xfe2c('0x1a')](_0x53fb79);}};}function respondWithFilteredResult(_0x351bba,_0x94160c){return function(_0x66cb88){if(_0x66cb88){var _0x10cfac=typeof _0x94160c['offset']===_0xfe2c('0x1b')&&typeof _0x94160c[_0xfe2c('0x1c')]==='undefined';var _0x1f82c7=_0x66cb88[_0xfe2c('0x1d')];var _0x193a8a=_0x10cfac?0x0:_0x94160c['offset'];var _0x39e893=_0x10cfac?_0x66cb88[_0xfe2c('0x1d')]:_0x94160c['offset']+_0x94160c['limit'];var _0x54d7df;if(_0x39e893>=_0x1f82c7){_0x39e893=_0x1f82c7;_0x54d7df=0xc8;}else{_0x54d7df=0xce;}_0x351bba['status'](_0x54d7df);return _0x351bba[_0xfe2c('0x1e')](_0xfe2c('0x1f'),_0x193a8a+'-'+_0x39e893+'/'+_0x1f82c7)[_0xfe2c('0x1a')](_0x66cb88);}return null;};}function patchUpdates(_0x39b0fd){return function(_0xfe94){try{jsonpatch['apply'](_0xfe94,_0x39b0fd,!![]);}catch(_0x4ae58b){return BPromise[_0xfe2c('0x20')](_0x4ae58b);}return _0xfe94['save']();};}function saveUpdates(_0x206264,_0x53d2d0){return function(_0x33c169){if(_0x33c169){return _0x33c169[_0xfe2c('0x21')](_0x206264)[_0xfe2c('0x22')](function(_0x562928){return _0x562928;});}return null;};}function removeEntity(_0x310177,_0x11cc12){return function(_0x42ccfa){if(_0x42ccfa){return _0x42ccfa[_0xfe2c('0x23')]()[_0xfe2c('0x22')](function(){_0x310177['status'](0xcc)[_0xfe2c('0x19')]();});}};}function handleEntityNotFound(_0x3ec655,_0x4d5bc6){return function(_0x236be7){if(!_0x236be7){_0x3ec655[_0xfe2c('0x17')](0x194);}return _0x236be7;};}function handleError(_0x308618,_0x309285){_0x309285=_0x309285||0x1f4;return function(_0x507a5f){logger[_0xfe2c('0x24')](_0x507a5f[_0xfe2c('0x25')]);if(_0x507a5f['name']){delete _0x507a5f[_0xfe2c('0x26')];}_0x308618[_0xfe2c('0x18')](_0x309285)['send'](_0x507a5f);};}exports[_0xfe2c('0x27')]=function(_0x2f08c1,_0x48329e){var _0x57b344={},_0x2ade07={},_0x5b4cff={'count':0x0,'rows':[]};var _0x1098f8=_[_0xfe2c('0x28')](db[_0xfe2c('0x29')][_0xfe2c('0x2a')],function(_0x37a2bd){return{'name':_0x37a2bd[_0xfe2c('0x2b')],'type':_0x37a2bd[_0xfe2c('0x2c')]['key']};});_0x2ade07[_0xfe2c('0x2d')]=_['map'](_0x1098f8,_0xfe2c('0x26'));_0x2ade07['query']=_[_0xfe2c('0x2e')](_0x2f08c1[_0xfe2c('0x2f')]);_0x2ade07['filters']=_[_0xfe2c('0x30')](_0x2ade07[_0xfe2c('0x2d')],_0x2ade07[_0xfe2c('0x2f')]);_0x57b344['attributes']=_[_0xfe2c('0x30')](_0x2ade07[_0xfe2c('0x2d')],qs['fields'](_0x2f08c1[_0xfe2c('0x2f')][_0xfe2c('0x31')]));_0x57b344['attributes']=_0x57b344[_0xfe2c('0x32')][_0xfe2c('0x33')]?_0x57b344[_0xfe2c('0x32')]:_0x2ade07[_0xfe2c('0x2d')];if(!_0x2f08c1['query'][_0xfe2c('0x34')]('nolimit')){_0x57b344['limit']=qs['limit'](_0x2f08c1[_0xfe2c('0x2f')][_0xfe2c('0x1c')]);_0x57b344[_0xfe2c('0x35')]=qs[_0xfe2c('0x35')](_0x2f08c1['query'][_0xfe2c('0x35')]);}_0x57b344['order']=qs[_0xfe2c('0x36')](_0x2f08c1[_0xfe2c('0x2f')][_0xfe2c('0x36')]);_0x57b344['where']=qs[_0xfe2c('0x37')](_[_0xfe2c('0x38')](_0x2f08c1['query'],_0x2ade07[_0xfe2c('0x37')]),_0x1098f8);if(_0x2f08c1['query'][_0xfe2c('0x39')]){_0x57b344[_0xfe2c('0x3a')]=_[_0xfe2c('0x3b')](_0x57b344[_0xfe2c('0x3a')],{'$or':_[_0xfe2c('0x28')](_0x1098f8,function(_0x1a6328){if(_0x1a6328[_0xfe2c('0x2c')]!==_0xfe2c('0x3c')){var _0x52d745={};_0x52d745[_0x1a6328[_0xfe2c('0x26')]]={'$like':'%'+_0x2f08c1[_0xfe2c('0x2f')][_0xfe2c('0x39')]+'%'};return _0x52d745;}})});}_0x57b344=_[_0xfe2c('0x3b')]({},_0x57b344,_0x2f08c1[_0xfe2c('0x3d')]);var _0x10b9c4={'where':_0x57b344[_0xfe2c('0x3a')]};return db[_0xfe2c('0x29')][_0xfe2c('0x1d')](_0x10b9c4)[_0xfe2c('0x22')](function(_0x1b5679){_0x5b4cff['count']=_0x1b5679;if(_0x2f08c1[_0xfe2c('0x2f')][_0xfe2c('0x3e')]){_0x57b344[_0xfe2c('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x57b344);})[_0xfe2c('0x22')](function(_0x15e8be){_0x5b4cff[_0xfe2c('0x40')]=_0x15e8be;return _0x5b4cff;})['then'](respondWithFilteredResult(_0x48329e,_0x57b344))[_0xfe2c('0x41')](handleError(_0x48329e,null));};exports[_0xfe2c('0x42')]=function(_0x682254,_0x4b1af8){var _0x4cc1bd={'raw':!![],'where':{'id':_0x682254[_0xfe2c('0x43')]['id']}},_0x34d0d7={};_0x34d0d7[_0xfe2c('0x2d')]=_[_0xfe2c('0x2e')](db[_0xfe2c('0x29')]['rawAttributes']);_0x34d0d7[_0xfe2c('0x2f')]=_[_0xfe2c('0x2e')](_0x682254['query']);_0x34d0d7[_0xfe2c('0x37')]=_[_0xfe2c('0x30')](_0x34d0d7[_0xfe2c('0x2d')],_0x34d0d7[_0xfe2c('0x2f')]);_0x4cc1bd[_0xfe2c('0x32')]=_[_0xfe2c('0x30')](_0x34d0d7[_0xfe2c('0x2d')],qs['fields'](_0x682254[_0xfe2c('0x2f')][_0xfe2c('0x31')]));_0x4cc1bd['attributes']=_0x4cc1bd[_0xfe2c('0x32')][_0xfe2c('0x33')]?_0x4cc1bd[_0xfe2c('0x32')]:_0x34d0d7[_0xfe2c('0x2d')];if(_0x682254[_0xfe2c('0x2f')]['includeAll']){_0x4cc1bd[_0xfe2c('0x3f')]=[{'all':!![]}];}_0x4cc1bd=_[_0xfe2c('0x3b')]({},_0x4cc1bd,_0x682254['options']);return db[_0xfe2c('0x29')][_0xfe2c('0x44')](_0x4cc1bd)['then'](handleEntityNotFound(_0x4b1af8,null))[_0xfe2c('0x22')](respondWithResult(_0x4b1af8,null))[_0xfe2c('0x41')](handleError(_0x4b1af8,null));};exports['create']=function(_0x40556f,_0x2b3cdd){return db[_0xfe2c('0x29')]['create'](_0x40556f[_0xfe2c('0x45')],{})[_0xfe2c('0x22')](respondWithResult(_0x2b3cdd,0xc9))[_0xfe2c('0x41')](handleError(_0x2b3cdd,null));};exports['update']=function(_0x5de8a8,_0x17d5a4){if(_0x5de8a8['body']['id']){delete _0x5de8a8[_0xfe2c('0x45')]['id'];}return db[_0xfe2c('0x29')][_0xfe2c('0x44')]({'where':{'id':_0x5de8a8[_0xfe2c('0x43')]['id']}})[_0xfe2c('0x22')](handleEntityNotFound(_0x17d5a4,null))[_0xfe2c('0x22')](saveUpdates(_0x5de8a8['body'],null))[_0xfe2c('0x22')](respondWithResult(_0x17d5a4,null))[_0xfe2c('0x41')](handleError(_0x17d5a4,null));};exports[_0xfe2c('0x23')]=function(_0x52a802,_0x589e4c){return db['WhatsappTransferReport'][_0xfe2c('0x44')]({'where':{'id':_0x52a802['params']['id']}})[_0xfe2c('0x22')](handleEntityNotFound(_0x589e4c,null))[_0xfe2c('0x22')](removeEntity(_0x589e4c,null))[_0xfe2c('0x41')](handleError(_0x589e4c,null));};exports[_0xfe2c('0x46')]=function(_0x5e8e2f,_0x35e053){return db[_0xfe2c('0x29')][_0xfe2c('0x46')]()[_0xfe2c('0x22')](respondWithResult(_0x35e053,null))['catch'](handleError(_0x35e053,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 99e2ca4..0e4c9d5 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 _0xc9ef=['util','api','moment','bluebird','request-promise','rimraf','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid'];(function(_0x10370c,_0x393069){var _0x5c3a2e=function(_0x3e2601){while(--_0x3e2601){_0x10370c['push'](_0x10370c['shift']());}};_0x5c3a2e(++_0x393069);}(_0xc9ef,0x18c));var _0xfc9e=function(_0x5afa3d,_0x54f4a3){_0x5afa3d=_0x5afa3d-0x0;var _0x539628=_0xc9ef[_0x5afa3d];return _0x539628;};'use strict';var _=require('lodash');var util=require(_0xfc9e('0x0'));var logger=require('../../config/logger')(_0xfc9e('0x1'));var moment=require(_0xfc9e('0x2'));var BPromise=require(_0xfc9e('0x3'));var rp=require(_0xfc9e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc9e('0x5'));var config=require('../../config/environment');var attributes=require(_0xfc9e('0x6'));module[_0xfc9e('0x7')]=function(_0x2fcbdf,_0x119db9){return _0x2fcbdf[_0xfc9e('0x8')]('WhatsappTransferReport',attributes,{'tableName':_0xfc9e('0x9'),'paranoid':![],'indexes':[{'name':_0xfc9e('0xa'),'fields':[_0xfc9e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x92aa=['report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x92aa,0xfe));var _0xa92a=function(_0x4a2973,_0x53ec5a){_0x4a2973=_0x4a2973-0x0;var _0x25fc8b=_0x92aa[_0x4a2973];return _0x25fc8b;};'use strict';var _=require(_0xa92a('0x0'));var util=require(_0xa92a('0x1'));var logger=require(_0xa92a('0x2'))(_0xa92a('0x3'));var moment=require(_0xa92a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa92a('0x5'));var rimraf=require('rimraf');var config=require(_0xa92a('0x6'));var attributes=require(_0xa92a('0x7'));module[_0xa92a('0x8')]=function(_0x2b2356,_0x5e4700){return _0x2b2356['define'](_0xa92a('0x9'),attributes,{'tableName':_0xa92a('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa92a('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 d5d91a4..9ae9f37 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 _0xf4b2=['WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x134516,_0x53f184){var _0x1300e1=function(_0x5d58b3){while(--_0x5d58b3){_0x134516['push'](_0x134516['shift']());}};_0x1300e1(++_0x53f184);}(_0xf4b2,0x12a));var _0x2f4b=function(_0x36f010,_0x3289b5){_0x36f010=_0x36f010-0x0;var _0x46a894=_0xf4b2[_0x36f010];return _0x46a894;};'use strict';var _=require(_0x2f4b('0x0'));var util=require(_0x2f4b('0x1'));var moment=require(_0x2f4b('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f4b('0x3'));var fs=require('fs');var Redis=require(_0x2f4b('0x4'));var db=require(_0x2f4b('0x5'))['db'];var utils=require(_0x2f4b('0x6'));var logger=require(_0x2f4b('0x7'))(_0x2f4b('0x8'));var config=require(_0x2f4b('0x9'));var jayson=require(_0x2f4b('0xa'));var client=jayson[_0x2f4b('0xb')][_0x2f4b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1889c0,_0x3f9e31,_0x3888ea){return new BPromise(function(_0x5da77b,_0x419c0b){return client[_0x2f4b('0xd')](_0x1889c0,_0x3888ea)['then'](function(_0x512001){logger['info'](_0x2f4b('0xe'),_0x3f9e31,_0x2f4b('0xf'));logger[_0x2f4b('0x10')](_0x2f4b('0x11'),_0x3f9e31,_0x2f4b('0xf'),JSON[_0x2f4b('0x12')](_0x512001));if(_0x512001[_0x2f4b('0x13')]){if(_0x512001[_0x2f4b('0x13')][_0x2f4b('0x14')]===0x1f4){logger['error'](_0x2f4b('0xe'),_0x3f9e31,_0x512001[_0x2f4b('0x13')][_0x2f4b('0x15')]);return _0x419c0b(_0x512001['error']['message']);}logger[_0x2f4b('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3f9e31,_0x512001[_0x2f4b('0x13')][_0x2f4b('0x15')]);return _0x5da77b(_0x512001['error'][_0x2f4b('0x15')]);}else{logger['info'](_0x2f4b('0xe'),_0x3f9e31,_0x2f4b('0xf'));_0x5da77b(_0x512001[_0x2f4b('0x16')][_0x2f4b('0x15')]);}})[_0x2f4b('0x17')](function(_0x151cff){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x3f9e31,_0x151cff);_0x419c0b(_0x151cff);});});} \ No newline at end of file +var _0xa8ce=['stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x5d9fae,_0x172774){var _0x35bd5f=function(_0x5b8d92){while(--_0x5b8d92){_0x5d9fae['push'](_0x5d9fae['shift']());}};_0x35bd5f(++_0x172774);}(_0xa8ce,0x1e8));var _0xea8c=function(_0x27da10,_0x56f876){_0x27da10=_0x27da10-0x0;var _0x47904a=_0xa8ce[_0x27da10];return _0x47904a;};'use strict';var _=require(_0xea8c('0x0'));var util=require(_0xea8c('0x1'));var moment=require(_0xea8c('0x2'));var BPromise=require('bluebird');var rs=require(_0xea8c('0x3'));var fs=require('fs');var Redis=require(_0xea8c('0x4'));var db=require(_0xea8c('0x5'))['db'];var utils=require(_0xea8c('0x6'));var logger=require('../../config/logger')(_0xea8c('0x7'));var config=require(_0xea8c('0x8'));var jayson=require(_0xea8c('0x9'));var client=jayson[_0xea8c('0xa')][_0xea8c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x395a2d,_0x1c4e9a,_0x1e0ac3){return new BPromise(function(_0x113fc0,_0x1557f2){return client[_0xea8c('0xc')](_0x395a2d,_0x1e0ac3)['then'](function(_0x4dcc7c){logger[_0xea8c('0xd')](_0xea8c('0xe'),_0x1c4e9a,_0xea8c('0xf'));logger[_0xea8c('0x10')](_0xea8c('0x11'),_0x1c4e9a,_0xea8c('0xf'),JSON[_0xea8c('0x12')](_0x4dcc7c));if(_0x4dcc7c[_0xea8c('0x13')]){if(_0x4dcc7c[_0xea8c('0x13')]['code']===0x1f4){logger[_0xea8c('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1c4e9a,_0x4dcc7c['error'][_0xea8c('0x14')]);return _0x1557f2(_0x4dcc7c[_0xea8c('0x13')][_0xea8c('0x14')]);}logger[_0xea8c('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1c4e9a,_0x4dcc7c[_0xea8c('0x13')]['message']);return _0x113fc0(_0x4dcc7c['error'][_0xea8c('0x14')]);}else{logger[_0xea8c('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1c4e9a,_0xea8c('0xf'));_0x113fc0(_0x4dcc7c['result'][_0xea8c('0x14')]);}})[_0xea8c('0x15')](function(_0xb777b3){logger[_0xea8c('0x13')](_0xea8c('0xe'),_0x1c4e9a,_0xb777b3);_0x1557f2(_0xb777b3);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 6ef23d4..4546d39 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9a8=['lodash','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','listen','info','start','filter','exitCode','number','length','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit'];(function(_0x2fa451,_0x1a8f13){var _0x4e2e51=function(_0x146070){while(--_0x146070){_0x2fa451['push'](_0x2fa451['shift']());}};_0x4e2e51(++_0x1a8f13);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x187132,_0x204ea5){_0x187132=_0x187132-0x0;var _0x5b4f24=_0xd9a8[_0x187132];return _0x5b4f24;};'use strict';var _=require(_0x8d9a('0x0'));var db=require(_0x8d9a('0x1'))['db'];var seedDb=require(_0x8d9a('0x2'));var checkLicense=require('./config/license');var rpc=require(_0x8d9a('0x3'));var config=require(_0x8d9a('0x4'));var logger=require('./config/logger')('app');var pm2=require(_0x8d9a('0x5'));var pm2Config=require(_0x8d9a('0x6'));var schedule=require(_0x8d9a('0x7'));var chat=require(_0x8d9a('0x8'));var whatsapp=require(_0x8d9a('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x8d9a('0xa'));function main(){return db[_0x8d9a('0xb')][_0x8d9a('0xc')]()['then'](function(){if(config[_0x8d9a('0xd')]){return seedDb[_0x8d9a('0xe')]();}})[_0x8d9a('0xf')](function(){return checkLicense['default']();})[_0x8d9a('0xf')](function(){return rpc[_0x8d9a('0x10')]();})[_0x8d9a('0xf')](function(_0x5ae57a){logger[_0x8d9a('0x11')](_0x5ae57a);return chat['start']();})[_0x8d9a('0xf')](function(){return whatsapp[_0x8d9a('0x12')]();})['then'](function(){return schedule[_0x8d9a('0x12')]();})[_0x8d9a('0xf')](function(){return transcribe['start']();})[_0x8d9a('0xf')](function(){return provider[_0x8d9a('0x12')]();})[_0x8d9a('0xf')](function(_0x34f89d){logger[_0x8d9a('0x11')](_0x34f89d);return pm2[_0x8d9a('0x12')](pm2Config);})[_0x8d9a('0xf')](function(_0x29ceeb){var _0x5cd106=_0x29ceeb[_0x8d9a('0x13')](function(_0x36fd8c){return typeof _0x36fd8c[_0x8d9a('0x14')]===_0x8d9a('0x15')&&_0x36fd8c[_0x8d9a('0x14')]>=0x0;});if(_0x5cd106[_0x8d9a('0x16')]>0x0){throw new Error(_0x5cd106['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x8d9a('0x17')](_0x5cd106,function(_0x49202a){return'\x22'+_0x49202a[_0x8d9a('0x18')][_0x8d9a('0x19')]+'\x22';}));}logger['info'](_0x8d9a('0x1a'),_[_0x8d9a('0x17')](_[_0x8d9a('0x13')](_0x29ceeb,{'status':_0x8d9a('0x1b')}),'name')[_0x8d9a('0x1c')]());logger[_0x8d9a('0x11')](_0x8d9a('0x1d'),_[_0x8d9a('0x17')](_['filter'](_0x29ceeb,function(_0x30c0f7){return _0x30c0f7[_0x8d9a('0x1e')]!==_0x8d9a('0x1b');}),'name')[_0x8d9a('0x1c')]()||_0x8d9a('0x1f'));console[_0x8d9a('0x20')](_0x8d9a('0x21'));})[_0x8d9a('0x22')](function(_0x443af3){console[_0x8d9a('0x20')](_0x8d9a('0x23'),_0x443af3);logger[_0x8d9a('0x24')](_0x8d9a('0x25'),_0x443af3);process[_0x8d9a('0x26')](0x1);});}main(); \ No newline at end of file +var _0xd45e=['then','seedDB','default','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','filter','online','name','Offline\x20apps:','status','join','None','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./rpc','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sequelize'];(function(_0x11f310,_0x566f6f){var _0x49012b=function(_0x34b5e5){while(--_0x34b5e5){_0x11f310['push'](_0x11f310['shift']());}};_0x49012b(++_0x566f6f);}(_0xd45e,0x182));var _0xed45=function(_0x1d7f83,_0x3dcb34){_0x1d7f83=_0x1d7f83-0x0;var _0x499360=_0xd45e[_0x1d7f83];return _0x499360;};'use strict';var _=require('lodash');var db=require(_0xed45('0x0'))['db'];var seedDb=require(_0xed45('0x1'));var checkLicense=require('./config/license');var rpc=require(_0xed45('0x2'));var config=require('./config/environment');var logger=require(_0xed45('0x3'))(_0xed45('0x4'));var pm2=require(_0xed45('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xed45('0x6'));var chat=require(_0xed45('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0xed45('0x8'));function main(){return db[_0xed45('0x9')]['sync']()[_0xed45('0xa')](function(){if(config[_0xed45('0xb')]){return seedDb[_0xed45('0xc')]();}})[_0xed45('0xa')](function(){return checkLicense[_0xed45('0xc')]();})[_0xed45('0xa')](function(){return rpc['listen']();})[_0xed45('0xa')](function(_0xded80e){logger[_0xed45('0xd')](_0xded80e);return chat[_0xed45('0xe')]();})[_0xed45('0xa')](function(){return whatsapp[_0xed45('0xe')]();})[_0xed45('0xa')](function(){return schedule['start']();})[_0xed45('0xa')](function(){return transcribe[_0xed45('0xe')]();})[_0xed45('0xa')](function(){return provider[_0xed45('0xe')]();})['then'](function(_0x3f35ef){logger['info'](_0x3f35ef);return pm2[_0xed45('0xe')](pm2Config);})[_0xed45('0xa')](function(_0xd6dcbb){var _0x112873=_0xd6dcbb['filter'](function(_0x292aef){return typeof _0x292aef[_0xed45('0xf')]===_0xed45('0x10')&&_0x292aef['exitCode']>=0x0;});if(_0x112873[_0xed45('0x11')]>0x0){throw new Error(_0x112873['length']+_0xed45('0x12')+_[_0xed45('0x13')](_0x112873,function(_0x3bb5ef){return'\x22'+_0x3bb5ef[_0xed45('0x14')]['name']+'\x22';}));}logger[_0xed45('0xd')]('Online\x20apps:',_['map'](_[_0xed45('0x15')](_0xd6dcbb,{'status':_0xed45('0x16')}),_0xed45('0x17'))['join']());logger['info'](_0xed45('0x18'),_[_0xed45('0x13')](_['filter'](_0xd6dcbb,function(_0x542459){return _0x542459[_0xed45('0x19')]!==_0xed45('0x16');}),_0xed45('0x17'))[_0xed45('0x1a')]()||_0xed45('0x1b'));console[_0xed45('0x1c')]('App\x20Ready!');})['catch'](function(_0x57c103){console['log'](_0xed45('0x1d'),_0x57c103);logger[_0xed45('0x1e')](_0xed45('0x1f'),_0x57c103);process[_0xed45('0x20')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 833982d..a3eb7c8 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 _0xe615=['../../config/environment','../../config/license/util','../encryptor','jsonwebtoken','composable-middleware','basic-auth','crypto','moment','secrets','session','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','then','query','json','unmanaged','Unmanaged.','Forbidden.','headers','authorization','startsWith','User','find','name','authenticate','pass','catch','Bearer','status','Unknown\x20authorization\x20format','apikey','getUuid','sub','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','user','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','cookie','redirect','send','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','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','ValidationError','length','splice','unshift','encryptString','promisify','sign','options','verify','randomBytes','toString','hex','floor','HS512'];(function(_0x1fb1e3,_0x3e0a0d){var _0x23d5d0=function(_0x17ccab){while(--_0x17ccab){_0x1fb1e3['push'](_0x1fb1e3['shift']());}};_0x23d5d0(++_0x3e0a0d);}(_0xe615,0x83));var _0x5e61=function(_0x7c13ed,_0x4d9dd5){_0x7c13ed=_0x7c13ed-0x0;var _0x4cad66=_0xe615[_0x7c13ed];return _0x4cad66;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x5e61('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x5e61('0x1'));var encryptor=require(_0x5e61('0x2'));var _=require('lodash');var jwt=require(_0x5e61('0x3'));var expressJwt=require('express-jwt');var compose=require(_0x5e61('0x4'));var basicAuth=require(_0x5e61('0x5'));var crypto=require(_0x5e61('0x6'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0x5e61('0x7'));var validateJwt=expressJwt({'secret':config[_0x5e61('0x8')][_0x5e61('0x9')]});var userAttributes=['id',_0x5e61('0xa'),_0x5e61('0xb'),'name',_0x5e61('0xc'),_0x5e61('0xd'),_0x5e61('0xe'),_0x5e61('0xf'),_0x5e61('0x10'),_0x5e61('0x11'),_0x5e61('0x12'),_0x5e61('0x13'),'faxPause',_0x5e61('0x14'),_0x5e61('0x15'),_0x5e61('0x16'),_0x5e61('0x17'),'lastLoginAt',_0x5e61('0x18'),'crudPermissions',_0x5e61('0x19'),_0x5e61('0x1a'),'alias',_0x5e61('0x1b'),_0x5e61('0x1c'),_0x5e61('0x1d'),_0x5e61('0x1e'),_0x5e61('0x1f'),_0x5e61('0x20'),_0x5e61('0x21'),_0x5e61('0x22'),'phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId',_0x5e61('0x23'),'settingsEnabled',_0x5e61('0x24'),_0x5e61('0x25'),_0x5e61('0x26'),'downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign',_0x5e61('0x27'),_0x5e61('0x28'),_0x5e61('0x29'),'emailAutoanswerDelay',_0x5e61('0x2a'),_0x5e61('0x2b'),_0x5e61('0x2c'),_0x5e61('0x2d'),_0x5e61('0x2e'),_0x5e61('0x2f'),_0x5e61('0x30'),_0x5e61('0x31'),_0x5e61('0x32')];exports[_0x5e61('0x33')]=function(){return this[_0x5e61('0x34')](!![])[_0x5e61('0x35')](function(_0x51524f,_0x4ac720,_0x1ee2f9){if(_0x51524f['user']){_0x1ee2f9();}else{return db[_0x5e61('0x36')][_0x5e61('0x37')]({'where':{'id':_0x51524f[_0x5e61('0x38')]['id']},'attributes':['id',_0x5e61('0x39'),_0x5e61('0x3a')],'raw':!![]})[_0x5e61('0x3b')](function(_0x34babc){if(_0x34babc&&_0x34babc[_0x5e61('0x39')]&&!_0x51524f[_0x5e61('0x3c')]['forceDownload']){return _0x4ac720['status'](_0x34babc[_0x5e61('0x3a')]==='unmanaged'?0x195:0x193)[_0x5e61('0x3d')]({'message':_0x34babc['disposition']===_0x5e61('0x3e')?_0x5e61('0x3f'):_0x5e61('0x40')});}else{_0x1ee2f9();}})['catch'](function(_0x2cc000){_0x1ee2f9(_0x2cc000);});}});};exports[_0x5e61('0x34')]=function isAuthenticated(_0x3c0cc1){return compose()['use'](function(_0x3a1d10,_0x42b573,_0x3c684b){var _0x4c8667;if(_0x3a1d10[_0x5e61('0x41')][_0x5e61('0x42')]){if(_[_0x5e61('0x43')](_0x3a1d10[_0x5e61('0x41')][_0x5e61('0x42')],'Basic')){var _0x56bb48=basicAuth(_0x3a1d10);db[_0x5e61('0x44')][_0x5e61('0x45')]({'where':{'name':_0x56bb48[_0x5e61('0x46')]}})[_0x5e61('0x3b')](function(_0x3ec3a5){if(!_0x3ec3a5||!_0x3ec3a5[_0x5e61('0x47')](_0x56bb48[_0x5e61('0x48')])){return _0x42b573['status'](0x191)[_0x5e61('0x3d')]({'message':'Wrong\x20credentials.'});}_0x3a1d10['user']={'id':_0x3ec3a5['id']};_0x3c684b();})[_0x5e61('0x49')](function(_0x5777d9){_0x3c684b(_0x5777d9);});}else if(_[_0x5e61('0x43')](_0x3a1d10[_0x5e61('0x41')]['authorization'],_0x5e61('0x4a'))){validateJwt(_0x3a1d10,_0x42b573,_0x3c684b);}else{if(_0x3c0cc1){_0x3c684b();}else{return _0x42b573[_0x5e61('0x4b')](0x193)[_0x5e61('0x3d')]({'message':_0x5e61('0x4c')});}}}else if(_0x3a1d10[_0x5e61('0x3c')][_0x5e61('0x4d')]){try{var _0x504d56={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5e61('0x4e')]()};verifyJwt(_0x3a1d10[_0x5e61('0x3c')]['apikey'],_0x504d56)[_0x5e61('0x3b')](function(_0x5e3d60){return db['User']['find']({'where':{'id':_0x5e3d60[_0x5e61('0x4f')]}})[_0x5e61('0x3b')](function(_0x43392c){_0x4c8667=_0x43392c;return db['Setting'][_0x5e61('0x37')]({'where':{'id':0x1},'attributes':[_0x5e61('0x50'),_0x5e61('0x51')],'raw':!![]});})[_0x5e61('0x3b')](function(_0x24df3f){if(!_0x4c8667||!_[_0x5e61('0x52')](_0x4c8667[_0x5e61('0x53')],_0x5e3d60[_0x5e61('0x54')])){return _0x42b573[_0x5e61('0x4b')](0x191)[_0x5e61('0x3d')]({'message':_0x5e61('0x55')});}if(_0x4c8667[_0x5e61('0x56')]){return _0x42b573['status'](0x191)[_0x5e61('0x3d')]({'message':_0x5e61('0x57')});}if(_0x4c8667[_0x5e61('0x58')]){if(_0x24df3f[_0x5e61('0x51')]>0x0){if(moment(_0x4c8667[_0x5e61('0x59')])[_0x5e61('0x5a')](_0x24df3f[_0x5e61('0x51')],_0x5e61('0x5b'))>moment()){return _0x42b573['status'](0x191)[_0x5e61('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x42b573[_0x5e61('0x4b')](0x191)[_0x5e61('0x3d')]({'message':_0x5e61('0x57')});}}_0x3a1d10[_0x5e61('0x5c')]={'id':_0x4c8667['id']};_0x3c684b();});})[_0x5e61('0x49')](function(){return _0x42b573['status'](0x191)[_0x5e61('0x3d')]({'message':_0x5e61('0x57')});});}catch(_0x16aaf4){_0x3c684b(_0x16aaf4);}}else if(_0x3c0cc1){_0x3c684b();}else{return _0x42b573[_0x5e61('0x4b')](0x193)[_0x5e61('0x3d')]({'message':_0x5e61('0x4c')});}})[_0x5e61('0x35')](function(_0x1660c1,_0x1bd2a8,_0x36a83){if(_0x1660c1[_0x5e61('0x5c')]){db[_0x5e61('0x44')][_0x5e61('0x45')]({'where':{'id':_0x1660c1[_0x5e61('0x5c')]['id']},'attributes':userAttributes})['then'](function(_0x1cfd2c){if(!_0x1cfd2c){return _0x1bd2a8[_0x5e61('0x4b')](0x194)[_0x5e61('0x3d')]({'message':_0x5e61('0x5d')});}_0x1660c1['user']=_0x1cfd2c;_0x36a83();})[_0x5e61('0x49')](function(_0x52058a){_0x36a83(_0x52058a);});}else if(_0x3c0cc1){_0x36a83();}else{return _0x1bd2a8[_0x5e61('0x4b')](0x194)['json']({'message':_0x5e61('0x5e')});}});};exports[_0x5e61('0x5f')]=function canUpdate(){return compose()['use'](function(_0x414caa,_0x5afad1,_0x356589){return licenseUtil[_0x5e61('0x60')]()[_0x5e61('0x3b')](function(_0x1ec85f){if(_0x1ec85f['update']){_0x356589();}else{return _0x5afad1[_0x5e61('0x4b')](0x193)['json']({'message':_0x5e61('0x61')});}})['catch'](function(_0x45befb){_0x356589(_0x45befb);});});};exports[_0x5e61('0x62')]=function isWebrtcLicence(){return compose()['use'](function(_0x3fb1b3,_0x12e7c4,_0x5f1620){return licenseUtil[_0x5e61('0x60')]()[_0x5e61('0x3b')](function(_0x35d7a2){if(_0x35d7a2[_0x5e61('0x63')]){_0x5f1620();}else{return _0x12e7c4[_0x5e61('0x4b')](0x193)[_0x5e61('0x3d')]({'message':_0x5e61('0x61')});}})['catch'](function(_0x286295){_0x5f1620(_0x286295);});});};exports[_0x5e61('0x64')]=function(_0x5e4a55,_0x121054,_0x12d20d){_0x5e4a55[_0x5e61('0x64')]=!![];return _0x12d20d();};exports[_0x5e61('0x65')]=function signToken(_0x450b30){return signJwt(_0x450b30);};exports[_0x5e61('0x66')]=function(_0x496632,_0x4008e1){if(!_0x496632[_0x5e61('0x5c')]){return _0x4008e1[_0x5e61('0x4b')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x341141={'payload':{'id':_0x496632[_0x5e61('0x5c')]['id'],'role':_0x496632[_0x5e61('0x5c')][_0x5e61('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x341141)[_0x5e61('0x3b')](function(_0x2bcd46){_0x4008e1[_0x5e61('0x67')]('motion.token',_0x2bcd46);_0x4008e1[_0x5e61('0x68')]('/dashboards/general');})[_0x5e61('0x49')](function(_0x19b97f){return _0x4008e1['status'](0x1f4)[_0x5e61('0x69')](_0x19b97f);});};exports['retrieveApiKey']=function(_0x3e52e6){if(_[_0x5e61('0x6a')](_0x3e52e6['apiKeyNonce'])||_[_0x5e61('0x6a')](_0x3e52e6[_0x5e61('0x6b')])){return null;}else{return createJwt(_0x3e52e6);}};exports['generateApiKey']=function(_0x4811f4){_0x4811f4[_0x5e61('0x53')]=generateNonce();_0x4811f4['apiKeyIat']=generateIssuedAt();return createJwt(_0x4811f4);};exports[_0x5e61('0x6c')]=function(_0x267c26,_0x46ed84){var _0x286ad9=_0x267c26[_0x5e61('0x3c')][_0x5e61('0x4d')];if(_0x286ad9){var _0x39ee91={'nonce':_0x46ed84[_0x5e61('0x53')],'iat':_0x46ed84[_0x5e61('0x6b')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5e61('0x4e')]()};return verifyJwt(_0x286ad9,_0x39ee91)[_0x5e61('0x3b')](function(){return generateApiKey(_0x46ed84);});}else{throw{'message':_0x5e61('0x6d')};}};exports[_0x5e61('0x6e')]=function(_0x452e70){var _0x93fbfb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x93fbfb['test'](_0x452e70))throw new db[(_0x5e61('0x6f'))]['ValidationError'](_0x5e61('0x70'));return;};exports[_0x5e61('0x71')]=function(_0x3d1086,_0x5c4dd4,_0x6d4082){var _0x384b3a=encryptor[_0x5e61('0x72')](_0x5c4dd4)[_0x5e61('0x73')](',');for(var _0x1ffef0=0x0;_0x1ffef0<_0x6d4082;_0x1ffef0++){if(!_0x384b3a[_0x1ffef0])break;if(_0x3d1086['toLowerCase']()===_0x384b3a[_0x1ffef0][_0x5e61('0x74')]()){var _0x266c5d=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x6d4082);if(_0x6d4082===0x1){_0x266c5d='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x5e61('0x6f'))][(_0x5e61('0x75'))](_0x266c5d);}}return;};exports['updatePasswordsHistory']=function(_0xb60cd3,_0x5debe3){var _0x577c10=_0x5debe3?encryptor[_0x5e61('0x72')](_0x5debe3)[_0x5e61('0x73')](','):[];if(_0x577c10[_0x5e61('0x76')]===0x5){_0x577c10[_0x5e61('0x77')](-0x1,0x1);}_0x577c10[_0x5e61('0x78')](_0xb60cd3);return encryptor[_0x5e61('0x79')](_0x577c10['join'](','));};function signJwt(_0x155cb4){var _0x552294=BPromise[_0x5e61('0x7a')](jwt[_0x5e61('0x7b')],{'context':jwt});var _0x51eaba=_0x155cb4['secret']||config['secrets'][_0x5e61('0x9')];return new BPromise(function(_0x24d8a7,_0x346b82){_0x552294(_0x155cb4['payload'],_0x51eaba,_0x155cb4[_0x5e61('0x7c')])[_0x5e61('0x3b')](function(_0x89d47c){_0x24d8a7(_0x89d47c);})[_0x5e61('0x49')](function(_0x110aa6){_0x346b82(_0x110aa6);});});}function verifyJwt(_0x262610,_0x3ad0e4,_0x39e2c1){var _0x5ce4e0=BPromise[_0x5e61('0x7a')](jwt[_0x5e61('0x7d')],{'context':jwt});var _0x4381a3=_0x39e2c1||config[_0x5e61('0x8')][_0x5e61('0x9')];return new BPromise(function(_0x4b4efc,_0xa5e7ae){_0x5ce4e0(_0x262610,_0x4381a3,_0x3ad0e4)[_0x5e61('0x3b')](function(_0xa6cd17){_0x4b4efc(_0xa6cd17);})[_0x5e61('0x49')](function(_0x526b77){_0xa5e7ae(_0x526b77);});});}function generateNonce(){return crypto[_0x5e61('0x7e')](0x10)[_0x5e61('0x7f')](_0x5e61('0x80'));}function generateIssuedAt(){return Math[_0x5e61('0x81')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x4259c2){var _0x4ddbf6={'payload':{'iat':_0x4259c2['apiKeyIat'],'nonce':_0x4259c2[_0x5e61('0x53')]},'options':{'algorithm':_0x5e61('0x82'),'subject':_0x4259c2['id'][_0x5e61('0x7f')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x4ddbf6)[_0x5e61('0x3b')](function(_0x417173){return{'iat':_0x4259c2[_0x5e61('0x6b')],'nonce':_0x4259c2[_0x5e61('0x53')],'token':_0x417173};});} \ No newline at end of file +var _0x63be=['headers','authorization','startsWith','Basic','find','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','blockDuration','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','generateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','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.','Sequelize','updatePasswordsHistory','length','encryptString','promisify','sign','secret','secrets','payload','options','verify','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','util','moment','session','role','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','downloadVoiceRecordings','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','forceDownload','status','unmanaged','json','Forbidden.','catch'];(function(_0x364034,_0x1c91a2){var _0xda68aa=function(_0xa021ae){while(--_0xa021ae){_0x364034['push'](_0x364034['shift']());}};_0xda68aa(++_0x1c91a2);}(_0x63be,0x1dd));var _0xe63b=function(_0x42bde3,_0x5197bc){_0x42bde3=_0x42bde3-0x0;var _0x20355d=_0x63be[_0x42bde3];return _0x20355d;};'use strict';var db=require(_0xe63b('0x0'))['db'];var config=require(_0xe63b('0x1'));var hardwareConf=require(_0xe63b('0x2'));var licenseUtil=require(_0xe63b('0x3'));var encryptor=require(_0xe63b('0x4'));var _=require(_0xe63b('0x5'));var jwt=require(_0xe63b('0x6'));var expressJwt=require(_0xe63b('0x7'));var compose=require(_0xe63b('0x8'));var basicAuth=require('basic-auth');var crypto=require(_0xe63b('0x9'));var BPromise=require('bluebird');var util=require(_0xe63b('0xa'));var moment=require(_0xe63b('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0xe63b('0xc')]});var userAttributes=['id',_0xe63b('0xd'),_0xe63b('0xe'),_0xe63b('0xf'),'internal',_0xe63b('0x10'),_0xe63b('0x11'),_0xe63b('0x12'),_0xe63b('0x13'),_0xe63b('0x14'),_0xe63b('0x15'),_0xe63b('0x16'),_0xe63b('0x17'),_0xe63b('0x18'),_0xe63b('0x19'),'pauseType','showWebBar',_0xe63b('0x1a'),_0xe63b('0x1b'),_0xe63b('0x1c'),_0xe63b('0x1d'),'passwordResetAt','alias',_0xe63b('0x1e'),_0xe63b('0x1f'),_0xe63b('0x20'),_0xe63b('0x21'),_0xe63b('0x22'),'phoneBarEnableSettings',_0xe63b('0x23'),_0xe63b('0x24'),'phoneBarRemoteControl',_0xe63b('0x25'),_0xe63b('0x26'),_0xe63b('0x27'),_0xe63b('0x28'),_0xe63b('0x29'),'settingsEnabled','wssPort',_0xe63b('0x2a'),'downloadOmnichannelInteractions','downloadAttachments',_0xe63b('0x2b'),_0xe63b('0x2c'),'chatAutoanswer',_0xe63b('0x2d'),_0xe63b('0x2e'),_0xe63b('0x2f'),_0xe63b('0x30'),_0xe63b('0x31'),_0xe63b('0x32'),'openchannelAutoanswerDelay','faxAutoanswer',_0xe63b('0x33'),_0xe63b('0x34'),_0xe63b('0x35'),_0xe63b('0x36')];exports[_0xe63b('0x37')]=function(){return this[_0xe63b('0x38')](!![])[_0xe63b('0x39')](function(_0x2a4f5c,_0x3cee2d,_0x196364){if(_0x2a4f5c[_0xe63b('0x3a')]){_0x196364();}else{return db[_0xe63b('0x3b')][_0xe63b('0x3c')]({'where':{'id':_0x2a4f5c[_0xe63b('0x3d')]['id']},'attributes':['id',_0xe63b('0x3e'),_0xe63b('0x3f')],'raw':!![]})[_0xe63b('0x40')](function(_0x22be26){if(_0x22be26&&_0x22be26[_0xe63b('0x3e')]&&!_0x2a4f5c['query'][_0xe63b('0x41')]){return _0x3cee2d[_0xe63b('0x42')](_0x22be26[_0xe63b('0x3f')]===_0xe63b('0x43')?0x195:0x193)[_0xe63b('0x44')]({'message':_0x22be26[_0xe63b('0x3f')]==='unmanaged'?'Unmanaged.':_0xe63b('0x45')});}else{_0x196364();}})[_0xe63b('0x46')](function(_0x1c83f8){_0x196364(_0x1c83f8);});}});};exports[_0xe63b('0x38')]=function isAuthenticated(_0x52c17b){return compose()[_0xe63b('0x39')](function(_0xbb423b,_0x3fffb3,_0x2b8a02){var _0x46698d;if(_0xbb423b[_0xe63b('0x47')][_0xe63b('0x48')]){if(_[_0xe63b('0x49')](_0xbb423b[_0xe63b('0x47')][_0xe63b('0x48')],_0xe63b('0x4a'))){var _0x1420f6=basicAuth(_0xbb423b);db['User'][_0xe63b('0x4b')]({'where':{'name':_0x1420f6[_0xe63b('0xf')]}})[_0xe63b('0x40')](function(_0x257529){if(!_0x257529||!_0x257529[_0xe63b('0x4c')](_0x1420f6[_0xe63b('0x4d')])){return _0x3fffb3[_0xe63b('0x42')](0x191)[_0xe63b('0x44')]({'message':_0xe63b('0x4e')});}_0xbb423b['user']={'id':_0x257529['id']};_0x2b8a02();})[_0xe63b('0x46')](function(_0x105eb3){_0x2b8a02(_0x105eb3);});}else if(_[_0xe63b('0x49')](_0xbb423b[_0xe63b('0x47')][_0xe63b('0x48')],_0xe63b('0x4f'))){validateJwt(_0xbb423b,_0x3fffb3,_0x2b8a02);}else{if(_0x52c17b){_0x2b8a02();}else{return _0x3fffb3['status'](0x193)['json']({'message':_0xe63b('0x50')});}}}else if(_0xbb423b[_0xe63b('0x51')][_0xe63b('0x52')]){try{var _0x23108f={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xe63b('0x53')]()};verifyJwt(_0xbb423b[_0xe63b('0x51')][_0xe63b('0x52')],_0x23108f)[_0xe63b('0x40')](function(_0x1a072f){return db[_0xe63b('0x54')]['find']({'where':{'id':_0x1a072f[_0xe63b('0x55')]}})[_0xe63b('0x40')](function(_0x397d6a){_0x46698d=_0x397d6a;return db['Setting'][_0xe63b('0x3c')]({'where':{'id':0x1},'attributes':[_0xe63b('0x56'),'blockDuration'],'raw':!![]});})[_0xe63b('0x40')](function(_0x109b8d){if(!_0x46698d||!_[_0xe63b('0x57')](_0x46698d[_0xe63b('0x58')],_0x1a072f[_0xe63b('0x59')])){return _0x3fffb3[_0xe63b('0x42')](0x191)[_0xe63b('0x44')]({'message':_0xe63b('0x5a')});}if(_0x46698d[_0xe63b('0x5b')]){return _0x3fffb3[_0xe63b('0x42')](0x191)['json']({'message':_0xe63b('0x5c')});}if(_0x46698d[_0xe63b('0x5d')]){if(_0x109b8d['blockDuration']>0x0){if(moment(_0x46698d[_0xe63b('0x5e')])['add'](_0x109b8d[_0xe63b('0x5f')],'minutes')>moment()){return _0x3fffb3[_0xe63b('0x42')](0x191)[_0xe63b('0x44')]({'message':_0xe63b('0x5c')});}}else{return _0x3fffb3['status'](0x191)[_0xe63b('0x44')]({'message':_0xe63b('0x5c')});}}_0xbb423b[_0xe63b('0x3a')]={'id':_0x46698d['id']};_0x2b8a02();});})[_0xe63b('0x46')](function(){return _0x3fffb3['status'](0x191)[_0xe63b('0x44')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x2f562e){_0x2b8a02(_0x2f562e);}}else if(_0x52c17b){_0x2b8a02();}else{return _0x3fffb3[_0xe63b('0x42')](0x193)['json']({'message':_0xe63b('0x50')});}})[_0xe63b('0x39')](function(_0x1bc4a7,_0x3f07e2,_0x59ed9f){if(_0x1bc4a7[_0xe63b('0x3a')]){db[_0xe63b('0x54')][_0xe63b('0x4b')]({'where':{'id':_0x1bc4a7[_0xe63b('0x3a')]['id']},'attributes':userAttributes})['then'](function(_0x2ca11b){if(!_0x2ca11b){return _0x3f07e2[_0xe63b('0x42')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x1bc4a7[_0xe63b('0x3a')]=_0x2ca11b;_0x59ed9f();})[_0xe63b('0x46')](function(_0x2b0eab){_0x59ed9f(_0x2b0eab);});}else if(_0x52c17b){_0x59ed9f();}else{return _0x3f07e2['status'](0x194)[_0xe63b('0x44')]({'message':_0xe63b('0x60')});}});};exports[_0xe63b('0x61')]=function canUpdate(){return compose()[_0xe63b('0x39')](function(_0x5e6d1c,_0x4600fe,_0x44213b){return licenseUtil[_0xe63b('0x62')]()[_0xe63b('0x40')](function(_0x194594){if(_0x194594[_0xe63b('0x63')]){_0x44213b();}else{return _0x4600fe[_0xe63b('0x42')](0x193)[_0xe63b('0x44')]({'message':_0xe63b('0x64')});}})['catch'](function(_0x28cbb7){_0x44213b(_0x28cbb7);});});};exports[_0xe63b('0x65')]=function isWebrtcLicence(){return compose()[_0xe63b('0x39')](function(_0x39462e,_0x58216a,_0x23b822){return licenseUtil[_0xe63b('0x62')]()['then'](function(_0x5986c6){if(_0x5986c6['webrtc']){_0x23b822();}else{return _0x58216a[_0xe63b('0x42')](0x193)[_0xe63b('0x44')]({'message':_0xe63b('0x64')});}})[_0xe63b('0x46')](function(_0x58745c){_0x23b822(_0x58745c);});});};exports[_0xe63b('0x66')]=function(_0x3dd723,_0x31d270,_0x120c62){_0x3dd723[_0xe63b('0x66')]=!![];return _0x120c62();};exports['signToken']=function signToken(_0x5bdd29){return signJwt(_0x5bdd29);};exports[_0xe63b('0x67')]=function(_0x342e7d,_0x49f741){if(!_0x342e7d[_0xe63b('0x3a')]){return _0x49f741[_0xe63b('0x42')](0x194)[_0xe63b('0x44')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x1fe0f0={'payload':{'id':_0x342e7d[_0xe63b('0x3a')]['id'],'role':_0x342e7d['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x1fe0f0)[_0xe63b('0x40')](function(_0x4140e7){_0x49f741[_0xe63b('0x68')](_0xe63b('0x69'),_0x4140e7);_0x49f741[_0xe63b('0x6a')](_0xe63b('0x6b'));})['catch'](function(_0x22fb3d){return _0x49f741[_0xe63b('0x42')](0x1f4)['send'](_0x22fb3d);});};exports[_0xe63b('0x6c')]=function(_0x3f127b){if(_['isNil'](_0x3f127b[_0xe63b('0x58')])||_['isNil'](_0x3f127b['apiKeyIat'])){return null;}else{return createJwt(_0x3f127b);}};exports[_0xe63b('0x6d')]=function(_0x8268db){_0x8268db[_0xe63b('0x58')]=generateNonce();_0x8268db['apiKeyIat']=generateIssuedAt();return createJwt(_0x8268db);};exports['regenerateApiKey']=function(_0x5224c3,_0x5dac60){var _0xa0d2f8=_0x5224c3[_0xe63b('0x51')][_0xe63b('0x52')];if(_0xa0d2f8){var _0x2946e8={'nonce':_0x5dac60[_0xe63b('0x58')],'iat':_0x5dac60[_0xe63b('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0xa0d2f8,_0x2946e8)['then'](function(){return generateApiKey(_0x5dac60);});}else{throw{'message':_0xe63b('0x6f')};}};exports['validatePasswordPattern']=function(_0x3f645f){var _0x227d30=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x227d30[_0xe63b('0x70')](_0x3f645f))throw new db['Sequelize'][(_0xe63b('0x71'))](_0xe63b('0x72'));return;};exports['validatePasswordHistory']=function(_0x3fa93a,_0x5e51fe,_0x455387){var _0x3edf8c=encryptor[_0xe63b('0x73')](_0x5e51fe)[_0xe63b('0x74')](',');for(var _0x285e18=0x0;_0x285e18<_0x455387;_0x285e18++){if(!_0x3edf8c[_0x285e18])break;if(_0x3fa93a[_0xe63b('0x75')]()===_0x3edf8c[_0x285e18]['toLowerCase']()){var _0x5509b3=util[_0xe63b('0x76')](_0xe63b('0x77'),_0x455387);if(_0x455387===0x1){_0x5509b3=_0xe63b('0x78');}throw new db[(_0xe63b('0x79'))][(_0xe63b('0x71'))](_0x5509b3);}}return;};exports[_0xe63b('0x7a')]=function(_0x5d8183,_0x21ae77){var _0x32be92=_0x21ae77?encryptor[_0xe63b('0x73')](_0x21ae77)['split'](','):[];if(_0x32be92[_0xe63b('0x7b')]===0x5){_0x32be92['splice'](-0x1,0x1);}_0x32be92['unshift'](_0x5d8183);return encryptor[_0xe63b('0x7c')](_0x32be92['join'](','));};function signJwt(_0x5e1a5b){var _0x157bb9=BPromise[_0xe63b('0x7d')](jwt[_0xe63b('0x7e')],{'context':jwt});var _0x1f6119=_0x5e1a5b[_0xe63b('0x7f')]||config[_0xe63b('0x80')][_0xe63b('0xc')];return new BPromise(function(_0x2d120b,_0x5e479d){_0x157bb9(_0x5e1a5b[_0xe63b('0x81')],_0x1f6119,_0x5e1a5b[_0xe63b('0x82')])['then'](function(_0x38c5c9){_0x2d120b(_0x38c5c9);})[_0xe63b('0x46')](function(_0x268b64){_0x5e479d(_0x268b64);});});}function verifyJwt(_0x1619f6,_0x5823a8,_0xb52536){var _0x437a02=BPromise[_0xe63b('0x7d')](jwt[_0xe63b('0x83')],{'context':jwt});var _0x96d1d0=_0xb52536||config[_0xe63b('0x80')][_0xe63b('0xc')];return new BPromise(function(_0xea4e09,_0x2b2736){_0x437a02(_0x1619f6,_0x96d1d0,_0x5823a8)[_0xe63b('0x40')](function(_0xcd8010){_0xea4e09(_0xcd8010);})['catch'](function(_0x128178){_0x2b2736(_0x128178);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xe63b('0x84')](_0xe63b('0x85'));}function generateIssuedAt(){return Math[_0xe63b('0x86')](Date[_0xe63b('0x87')]()/0x3e8)[_0xe63b('0x84')]();}function createJwt(_0xb157ce){var _0x33e134={'payload':{'iat':_0xb157ce['apiKeyIat'],'nonce':_0xb157ce[_0xe63b('0x58')]},'options':{'algorithm':_0xe63b('0x88'),'subject':_0xb157ce['id'][_0xe63b('0x84')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xe63b('0x53')]()}};return signJwt(_0x33e134)[_0xe63b('0x40')](function(_0x1f2e47){return{'iat':_0xb157ce[_0xe63b('0x6e')],'nonce':_0xb157ce['apiKeyNonce'],'token':_0x1f2e47};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index c7ca1c6..e0d4c51 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 _0xca27=['parseQueryParameters','where','default','fields','filter','user','clause','tags','checkListsRestrictions','search','ids','tag','countFilteredContacts','count','getFilteredContacts','describe','CmContact','keys','startsWith','cf_','CmCustomField','findOne','slice','type','map','catch','../../mysqldb','findAll','skipContactsQuery','getContactsSubquery','resolve','then','parseAdvancedSearchFilter'];(function(_0x2a5203,_0x102f93){var _0xf5c646=function(_0x170a09){while(--_0x170a09){_0x2a5203['push'](_0x2a5203['shift']());}};_0xf5c646(++_0x102f93);}(_0xca27,0x164));var _0x7ca2=function(_0x42b584,_0x90bbc2){_0x42b584=_0x42b584-0x0;var _0x46498f=_0xca27[_0x42b584];return _0x46498f;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var db=require(_0x7ca2('0x0'))['db'];exports[_0x7ca2('0x1')]=function(_0x817840,_0x1c874e,_0x51b263,_0x5e512a){var _0x19dba9={'count':0x0,'rows':[]};var _0x4657f7=sqlUtils[_0x7ca2('0x2')](_0x1c874e,_0x817840);if(_0x4657f7){return Promise['resolve'](_0x19dba9);}var _0x428023=sqlUtils[_0x7ca2('0x3')]();var _0x113b49={};var _0x52f162=![];var _0x231fe0=![];return Promise[_0x7ca2('0x4')]()[_0x7ca2('0x5')](function(){if(_0x817840['search']){return sqlUtils[_0x7ca2('0x6')](_0x817840['search'],_0x5e512a);}else{return sqlUtils[_0x7ca2('0x7')](_0x817840,_0x5e512a);}})[_0x7ca2('0x5')](function(_0x100e21){_0x428023[_0x7ca2('0x8')](_0x100e21[_0x7ca2('0x9')]);_0x428023[_0x7ca2('0x8')](_0x100e21[_0x7ca2('0xa')]);_0x428023[_0x7ca2('0x8')](_0x100e21[_0x7ca2('0xb')]);_0x428023[_0x7ca2('0x8')](_0x100e21[_0x7ca2('0xc')][_0x7ca2('0xd')]);_0x113b49=_0x100e21[_0x7ca2('0xe')];_0x231fe0=_0x100e21['user']['skip'];return sqlUtils[_0x7ca2('0xf')](_0x1c874e,_0x817840,_0x231fe0);})[_0x7ca2('0x5')](function(_0x3777fd){_0x428023[_0x7ca2('0x8')](_0x3777fd);var _0x34a0bd=_0x817840[_0x7ca2('0x10')]?_0x113b49[_0x7ca2('0x11')]:_0x817840[_0x7ca2('0x12')];_0x52f162=_0x34a0bd?!![]:![];return sqlUtils[_0x7ca2('0x13')](_0x428023,_0x34a0bd);})['then'](function(_0x19bdd1){_0x19dba9[_0x7ca2('0x14')]=_0x19bdd1;if(_0x19dba9[_0x7ca2('0x14')]===0x0){return;}if(_0x817840['User']){_0x231fe0=!![];}return sqlUtils['buildContactsQuery'](_0x428023,_0x817840[_0x7ca2('0xa')],_0x51b263,_0x52f162,_0x113b49[_0x7ca2('0xd')],_0x231fe0);})[_0x7ca2('0x5')](function(_0x1b942b){if(!_0x1b942b){return[];}return sqlUtils[_0x7ca2('0x15')](_0x1b942b,_0x817840,_0x51b263);})[_0x7ca2('0x5')](function(_0x2a60b1){_0x19dba9['rows']=_0x2a60b1;return _0x19dba9;})['catch'](function(_0x4093b7){throw _0x4093b7;});};exports[_0x7ca2('0x16')]=function(){var _0x526bea={};var _0x298e7e=[];return db[_0x7ca2('0x17')][_0x7ca2('0x16')]()[_0x7ca2('0x5')](function(_0x10ca37){_0x526bea=_0x10ca37;var _0xc93e89=Object[_0x7ca2('0x18')](_0x526bea)[_0x7ca2('0xb')](function(_0x2389d4){return _[_0x7ca2('0x19')](_0x2389d4,_0x7ca2('0x1a'))?_0x2389d4:undefined;});var _0x501bff=_0xc93e89['map'](function(_0x3caf7e){return db[_0x7ca2('0x1b')][_0x7ca2('0x1c')]({'where':{'id':_0x3caf7e[_0x7ca2('0x1d')](0x3)},'raw':!![]});});return Promise['all'](_0x501bff);})['then'](function(_0x5cd614){for(var _0x44e2ac=0x0;_0x44e2ac<_0x5cd614['length'];_0x44e2ac++){if(_0x5cd614[_0x44e2ac]){var _0x1d4106=_0x7ca2('0x1a')+_0x5cd614[_0x44e2ac]['id'];_0x526bea[_0x1d4106]['fieldType']=_0x5cd614[_0x44e2ac][_0x7ca2('0x1e')];}}_0x298e7e=_[_0x7ca2('0x1f')](Object[_0x7ca2('0x18')](_0x526bea),function(_0x114140){return{'name':_0x114140,'type':_0x526bea[_0x114140][_0x7ca2('0x1e')]};});return _0x298e7e;})[_0x7ca2('0x20')](function(_0x14f850){throw _0x14f850;});}; \ No newline at end of file +var _0xe92f=['map','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','user','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','clause','rows','catch','describe','CmContact','keys','filter','startsWith','cf_','CmCustomField','findOne','all','fieldType','type'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0xe92f,0x91));var _0xfe92=function(_0x5f4ce8,_0x49c119){_0x5f4ce8=_0x5f4ce8-0x0;var _0x1a9f59=_0xe92f[_0x5f4ce8];return _0x1a9f59;};'use strict';var _=require(_0xfe92('0x0'));var sqlUtils=require(_0xfe92('0x1'));var db=require(_0xfe92('0x2'))['db'];exports[_0xfe92('0x3')]=function(_0x5dc5f2,_0x310d6a,_0x17cbe6,_0x1ea13b){var _0x5aaeaf={'count':0x0,'rows':[]};var _0x75cf54=sqlUtils[_0xfe92('0x4')](_0x310d6a,_0x5dc5f2);if(_0x75cf54){return Promise[_0xfe92('0x5')](_0x5aaeaf);}var _0x351572=sqlUtils['getContactsSubquery']();var _0x253a31={};var _0x1029da=![];var _0x107cae=![];return Promise['resolve']()[_0xfe92('0x6')](function(){if(_0x5dc5f2[_0xfe92('0x7')]){return sqlUtils[_0xfe92('0x8')](_0x5dc5f2[_0xfe92('0x7')],_0x1ea13b);}else{return sqlUtils[_0xfe92('0x9')](_0x5dc5f2,_0x1ea13b);}})[_0xfe92('0x6')](function(_0x55091b){_0x351572['where'](_0x55091b[_0xfe92('0xa')]);_0x351572[_0xfe92('0xb')](_0x55091b[_0xfe92('0xc')]);_0x351572[_0xfe92('0xb')](_0x55091b['filter']);_0x351572[_0xfe92('0xb')](_0x55091b[_0xfe92('0xd')]['clause']);_0x253a31=_0x55091b['tags'];_0x107cae=_0x55091b[_0xfe92('0xd')][_0xfe92('0xe')];return sqlUtils[_0xfe92('0xf')](_0x310d6a,_0x5dc5f2,_0x107cae);})[_0xfe92('0x6')](function(_0x121c95){_0x351572[_0xfe92('0xb')](_0x121c95);var _0xacc545=_0x5dc5f2['search']?_0x253a31[_0xfe92('0x10')]:_0x5dc5f2[_0xfe92('0x11')];_0x1029da=_0xacc545?!![]:![];return sqlUtils[_0xfe92('0x12')](_0x351572,_0xacc545);})[_0xfe92('0x6')](function(_0x446761){_0x5aaeaf[_0xfe92('0x13')]=_0x446761;if(_0x5aaeaf[_0xfe92('0x13')]===0x0){return;}if(_0x5dc5f2['User']){_0x107cae=!![];}return sqlUtils[_0xfe92('0x14')](_0x351572,_0x5dc5f2[_0xfe92('0xc')],_0x17cbe6,_0x1029da,_0x253a31[_0xfe92('0x15')],_0x107cae);})[_0xfe92('0x6')](function(_0x2e6fae){if(!_0x2e6fae){return[];}return sqlUtils['getFilteredContacts'](_0x2e6fae,_0x5dc5f2,_0x17cbe6);})[_0xfe92('0x6')](function(_0x4c1587){_0x5aaeaf[_0xfe92('0x16')]=_0x4c1587;return _0x5aaeaf;})[_0xfe92('0x17')](function(_0x51cc03){throw _0x51cc03;});};exports[_0xfe92('0x18')]=function(){var _0x2b59f8={};var _0x5b0c77=[];return db[_0xfe92('0x19')][_0xfe92('0x18')]()[_0xfe92('0x6')](function(_0x3f49da){_0x2b59f8=_0x3f49da;var _0x4ea6f1=Object[_0xfe92('0x1a')](_0x2b59f8)[_0xfe92('0x1b')](function(_0x38b666){return _[_0xfe92('0x1c')](_0x38b666,_0xfe92('0x1d'))?_0x38b666:undefined;});var _0x5071c7=_0x4ea6f1['map'](function(_0xeddb2f){return db[_0xfe92('0x1e')][_0xfe92('0x1f')]({'where':{'id':_0xeddb2f['slice'](0x3)},'raw':!![]});});return Promise[_0xfe92('0x20')](_0x5071c7);})[_0xfe92('0x6')](function(_0xb4ed84){for(var _0x9b8010=0x0;_0x9b8010<_0xb4ed84['length'];_0x9b8010++){if(_0xb4ed84[_0x9b8010]){var _0x28d854=_0xfe92('0x1d')+_0xb4ed84[_0x9b8010]['id'];_0x2b59f8[_0x28d854][_0xfe92('0x21')]=_0xb4ed84[_0x9b8010][_0xfe92('0x22')];}}_0x5b0c77=_[_0xfe92('0x23')](Object[_0xfe92('0x1a')](_0x2b59f8),function(_0x1166ce){return{'name':_0x1166ce,'type':_0x2b59f8[_0x1166ce][_0xfe92('0x22')]};});return _0x5b0c77;})['catch'](function(_0x4543cd){throw _0x4543cd;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 110e68b..3039216 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 _0x483a=['SELECT','query','Tags','clone','t.id\x20IN\x20?','sequelize','toString','COUNT(*)','exports','lodash','squel','../parsers/qs','../../mysqldb','role','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','firstName','lastName','phone','fax','email','CompanyId','createdAt','deletedAt','includes','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','text','start','value','end','split','map','and','User','user','clause','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?','tag','then','tags','filter','resolve','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','Tag','findAll','color','keyBy','Sequelize','QueryTypes'];(function(_0x1c27d2,_0xdd70df){var _0x50f8df=function(_0x5ac89f){while(--_0x5ac89f){_0x1c27d2['push'](_0x1c27d2['shift']());}};_0x50f8df(++_0xdd70df);}(_0x483a,0x156));var _0xa483=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x483a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa483('0x0'));var squel=require(_0xa483('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xa483('0x2'));var utils=require('../interaction/utils');var db=require(_0xa483('0x3'))['db'];function skipContactsQuery(_0x28a053,_0x3676ff){var _0x7641f2=![];if(_0x28a053[_0xa483('0x4')]==='agent'&&!_0x3676ff[_0xa483('0x5')]&&!_0x3676ff[_0xa483('0x6')]&&_0x3676ff[_0xa483('0x7')]!==_0xa483('0x8')){_0x7641f2=!![];}return _0x7641f2;}function getContactsSubquery(){return squel[_0xa483('0x9')]()[_0xa483('0xa')](_0xa483('0xb'),'c')[_0xa483('0xc')](_0xa483('0xd'));}function applyJoinClauses(_0xc010d1,_0x280436){var _0x59e691=_0x280436?'c':_0xa483('0xe');_0xc010d1[_0xa483('0xf')]('cm_user_has_contacts','uc',_0xa483('0x10')+_0x59e691+_0xa483('0x11'))[_0xa483('0xf')](_0xa483('0x12'),'ct',_0xa483('0x13')+_0x59e691+_0xa483('0x11'))[_0xa483('0xf')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0xc010d1;}function addFieldsToQuery(_0x11a864,_0x32b7cb,_0xb422f5,_0x4077b5,_0x3da9e0){var _0x296d79=_0x3da9e0?'c':_0xa483('0xe');if(!_0x32b7cb){_0x32b7cb=['id',_0xa483('0x14'),_0xa483('0x15'),_0xa483('0x16'),'mobile',_0xa483('0x17'),_0xa483('0x18'),_0xa483('0x6'),_0xa483('0x19'),_0xa483('0x1a'),'updatedAt',_0xa483('0x1b'),'TagIds'];}else if(!_0x32b7cb[_0xa483('0x1c')]('id')){_0x32b7cb[_0xa483('0x1d')]('id');}var _0x306b71=_0xb422f5&&_0x3da9e0||!_0xb422f5&&!_0x3da9e0;if(_0x4077b5){_0x306b71=_0x4077b5&&_0x3da9e0||!_0x4077b5&&!_0x3da9e0;}_0x32b7cb[_0xa483('0x1e')](function(_0x18ac58){if(_0x18ac58===_0xa483('0x1f')){if(_0x306b71){_0x11a864[_0xa483('0x20')](_0xa483('0x21'),_0x18ac58);}else if(_0xb422f5||_0x4077b5){_0x11a864[_0xa483('0x20')](_0x296d79+'.'+_0x18ac58);}}else{_0x11a864[_0xa483('0x20')](_0x296d79+'.'+_0x18ac58);}});return _0x11a864;}function getSqlClauses(){var _0x31da12={'default':squel[_0xa483('0x22')](),'fields':squel['expr'](),'filter':squel[_0xa483('0x22')](),'tags':{'clause':squel[_0xa483('0x22')](),'ids':null},'user':{'clause':squel[_0xa483('0x22')](),'skip':![]}};return _0x31da12;}function parseTagParameter(_0x3ec5e2){var _0x18949a=squel[_0xa483('0x22')]();if(_0x3ec5e2){var _0x455ea0=utils[_0xa483('0x23')](_0x3ec5e2);_0x455ea0[_0xa483('0x1e')](function(_0x125ec2){_0x18949a['or'](_0xa483('0x24'),'%,'+_0x125ec2+',%');});}return _0x18949a;}function parseSearchFilter(_0x44800f){var _0x299465=squel['expr']();if(_0x44800f){var _0x39ffbf=_0x44800f['replace']('\x5c','\x5c\x5c')[_0xa483('0x25')](/'/g,'\x27\x27');var _0x18e0cd=qs[_0xa483('0x26')](_0x39ffbf);if(_0x39ffbf['split']('\x20')[_0xa483('0x27')]>0x1){_0x299465['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa483('0x28')](_0x39ffbf,!![]),null);}else{if(qs[_0xa483('0x29')](_0x39ffbf)){_0x299465['or'](_0xa483('0x2a'),_0x18e0cd+'%');_0x299465['or'](_0xa483('0x2b'),_0x18e0cd+'%');_0x299465['or'](_0xa483('0x2c'),_0x18e0cd+'%');_0x299465['or'](_0xa483('0x2d'),_0x18e0cd+'%');}else if(qs[_0xa483('0x2e')](_0x39ffbf)){_0x299465['or'](_0xa483('0x2f'),_0x18e0cd+'%');}else{_0x299465['or'](_0xa483('0x30'),'%'+_0x18e0cd+'%');_0x299465['or'](_0xa483('0x31'),'%'+_0x18e0cd+'%');_0x299465['or']('c.email\x20LIKE\x20?','%'+_0x18e0cd+'%');}}}return _0x299465;}function parseAdvancedSearchFilter(_0xdf25,_0x80116d){var _0x38ec56=getSqlClauses();var _0x330ebf=as[_0xa483('0x32')](_0xdf25);var _0x3a5220=_0x330ebf[_0xa483('0x33')];for(var _0x1d9e22=0x0;_0x1d9e22<_0x330ebf[_0xa483('0x34')][_0xa483('0x27')];_0x1d9e22++){var _0x79356=_0x330ebf[_0xa483('0x34')][_0x1d9e22];var _0x4ee436='c';var _0x421147=_['find'](_0x80116d,[_0xa483('0x35'),_0x79356[_0xa483('0x20')]]);if(_0x421147){if(_0x79356[_0xa483('0x20')]===_0xa483('0x36')||_0x421147[_0xa483('0x37')]===_0xa483('0x38')){_0x79356[_0xa483('0x39')]=_0xa483('0x3a');}var _0x2ecc28=as[_0xa483('0x3b')](_0x4ee436,_0x421147[_0xa483('0x3c')],_0x79356);_0x38ec56['default'][_0x3a5220](_0x2ecc28[_0xa483('0x3d')],_0x2ecc28['value'][_0xa483('0x3e')],_0x2ecc28[_0xa483('0x3f')][_0xa483('0x40')]);}else{if(_0x79356[_0xa483('0x20')]==='Tag'){var _0x3c93f2=_0x79356[_0xa483('0x3f')][_0xa483('0x41')](',')[_0xa483('0x42')](function(_0x478ea7){return Number(_0x478ea7);});var _0x81d4db=parseTagParameter(_0x3c93f2);_0x38ec56['tags']['clause'][_0xa483('0x43')](_0x81d4db);_0x38ec56['tags']['ids']=_0x3c93f2;}else if(_0x79356[_0xa483('0x20')]===_0xa483('0x44')){_0x38ec56[_0xa483('0x45')][_0xa483('0x46')][_0xa483('0x43')](_0xa483('0x47'),_0x79356[_0xa483('0x3f')]);_0x38ec56['user'][_0xa483('0x48')]=!![];}}}return _0x38ec56;}function parseModelFields(_0x32b2d8,_0x1b6fb7){var _0x34106f=squel[_0xa483('0x22')]();var _0x357e1a=_(_0x32b2d8)[_0xa483('0x49')]()[_0xa483('0x42')](function(_0x599881){return _[_0xa483('0x4a')](_0x1b6fb7,[_0xa483('0x35'),_0x599881])?_0x599881:undefined;})[_0xa483('0x4b')]()[_0xa483('0x3f')]();if(_0x32b2d8[_0xa483('0x4c')]){_0x357e1a[_0xa483('0x1d')](_0xa483('0x4c'));}if(_0x32b2d8[_0xa483('0x44')]){_0x357e1a['push'](_0xa483('0x44'));}if(_0x357e1a[_0xa483('0x27')]>0x0){_0x357e1a[_0xa483('0x1e')](function(_0x53203f){if(_0x53203f===_0xa483('0x6')){_0x34106f['and'](_0xa483('0x4d'),[][_0xa483('0x4e')](_0x32b2d8[_0x53203f]));}else if(_0x53203f==='Contact'){var _0x503ae8='%'+_0x32b2d8[_0x53203f]+'%';_0x34106f[_0xa483('0x43')](_0xa483('0x4f'),_0x503ae8);}else if(_0x53203f===_0xa483('0x44')){_0x34106f[_0xa483('0x43')](_0xa483('0x47'),_0x32b2d8[_0x53203f]);}else{_0x34106f[_0xa483('0x43')]('c.'+_0x53203f+_0xa483('0x50'),_0x32b2d8[_0x53203f]);}});}return _0x34106f;}function parseQueryParameters(_0x47a9a4,_0xcf3439){var _0x1a746f=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x47a9a4,_0xcf3439);})['then'](function(_0x411a89){_0x1a746f['fields'][_0xa483('0x43')](_0x411a89);return parseTagParameter(_0x47a9a4[_0xa483('0x51')]);})[_0xa483('0x52')](function(_0x2353a3){_0x1a746f[_0xa483('0x53')][_0xa483('0x46')][_0xa483('0x43')](_0x2353a3);return parseSearchFilter(_0x47a9a4[_0xa483('0x54')]);})[_0xa483('0x52')](function(_0x1c1de2){_0x1a746f[_0xa483('0x54')]=_0x1c1de2;return _0x1a746f;});}function checkListsRestrictions(_0x910b77,_0x564ee3,_0x1a048a){var _0x2aa359=squel[_0xa483('0x22')]();return Promise[_0xa483('0x55')]()[_0xa483('0x52')](function(){if(_0x564ee3[_0xa483('0x5')]&&_0x910b77[_0xa483('0x4')]==='agent'&&!_0x1a048a){return _0x910b77['getLists']({'attributes':['id'],'raw':!![]});}})[_0xa483('0x52')](function(_0x57ec1d){if(_0x57ec1d){if(_0x57ec1d[_0xa483('0x27')]===0x0){_0x2aa359[_0xa483('0x43')]('c.ListId\x20IS\x20NULL');}else{_0x2aa359['and']('c.ListId\x20IN\x20?',_['map'](_0x57ec1d,'id'));}}})[_0xa483('0x52')](function(){return _0x2aa359;});}function buildContactsQuery(_0x52b7b5,_0x23d914,_0x14d527,_0x1a9b94,_0x3a4e24,_0x23b7b7){if(_0x23d914){_0x23d914=_0x14d527[_0xa483('0x56')];}_0x52b7b5=addFieldsToQuery(_0x52b7b5,_0x23d914,_0x1a9b94,_0x23b7b7,!![]);var _0x27130a=squel[_0xa483('0x9')]();_0x27130a=addFieldsToQuery(_0x27130a,_0x23d914,_0x1a9b94,_0x23b7b7,![]);if(_0x1a9b94||_0x23b7b7){_0x52b7b5=applyJoinClauses(_0x52b7b5,!![]);_0x52b7b5[_0xa483('0x57')](_0xa483('0x58'));if(_0x14d527[_0xa483('0x59')]){_0x27130a[_0xa483('0x59')](_0x14d527[_0xa483('0x59')]);}if(_0x14d527[_0xa483('0x5a')]){_0x27130a[_0xa483('0x5a')](_0x14d527[_0xa483('0x5a')]);}}else{_0x27130a=applyJoinClauses(_0x27130a,![]);_0x27130a[_0xa483('0x57')](_0xa483('0x5b'));if(_0x14d527['limit']){_0x52b7b5['limit'](_0x14d527[_0xa483('0x59')]);}if(_0x14d527[_0xa483('0x5a')]){_0x52b7b5[_0xa483('0x5a')](_0x14d527[_0xa483('0x5a')]);}}_0x27130a[_0xa483('0x5c')](_0x3a4e24);if(_0x14d527['order']){_0x14d527[_0xa483('0x5d')][_0xa483('0x1e')](function(_0xd26a75){_0x52b7b5[_0xa483('0x5d')]('c.'+_0xd26a75[0x0],_0xd26a75[0x1]===_0xa483('0x5e')?![]:!![]);_0x27130a[_0xa483('0x5d')](_0xa483('0x5f')+_0xd26a75[0x0],_0xd26a75[0x1]==='DESC'?![]:!![]);});}_0x27130a['from'](_0x52b7b5,_0xa483('0xe'));return _0x27130a;}function getFilteredContacts(_0x510396){var _0x4403b0=[];return db[_0xa483('0x60')][_0xa483('0x61')]({'attributes':['id',_0xa483('0x35'),_0xa483('0x62')],'raw':!![]})[_0xa483('0x52')](function(_0x5cfad9){_0x4403b0=_[_0xa483('0x63')](_0x5cfad9,'id');var _0x2865a9={'type':db[_0xa483('0x64')][_0xa483('0x65')][_0xa483('0x66')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xa483('0x67')](_0x510396['toString'](),_0x2865a9);})[_0xa483('0x52')](function(_0x1b42ee){_0x1b42ee[_0xa483('0x1e')](function(_0x1cc02b){if(_0x1cc02b[_0xa483('0x1f')]){_0x1cc02b['Tags']=[];_0x1cc02b[_0xa483('0x1f')][_0xa483('0x41')](',')[_0xa483('0x1e')](function(_0x773567){_0x1cc02b[_0xa483('0x68')]['push'](_0x4403b0[_0x773567]);});}delete _0x1cc02b[_0xa483('0x1f')];});return _0x1b42ee;});}function countFilteredContacts(_0x247db7,_0x2d90cc){var _0x214af1=_0x247db7[_0xa483('0x69')]();_0x214af1[_0xa483('0x20')]('COUNT(*)');_0x214af1=applyJoinClauses(_0x214af1,!![]);_0x247db7[_0xa483('0x57')]('c.id');var _0x305770=utils[_0xa483('0x23')](_0x2d90cc);if(!_['isEmpty'](_0x305770)){_0x214af1['where'](_0xa483('0x6a'),_0x305770);}var _0x32bf60={'type':db[_0xa483('0x64')][_0xa483('0x65')][_0xa483('0x66')],'raw':!![]};return db[_0xa483('0x6b')][_0xa483('0x67')](_0x214af1[_0xa483('0x6c')](),_0x32bf60)[_0xa483('0x52')](function(_0x5ebf65){return _0x5ebf65[0x0][_0xa483('0x6d')];});}module[_0xa483('0x6e')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x8780=['updatedAt','deletedAt','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','replace','escapeLIKESpecialChars','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','datetime','castTo','buildExpression','type','default','text','value','start','end','Tag','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','\x20=\x20?','resolve','then','tag','filter','role','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','order','DESC','color','Sequelize','SELECT','CmContact','sequelize','Tags','COUNT(*)','c.id','isEmpty','t.id\x20IN\x20?','QueryTypes','query','toString','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','cm_user_has_contacts','uc.CmContactId\x20=\x20','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','subqry','firstName','lastName','phone','mobile','fax','email','createdAt'];(function(_0x4477ba,_0xb8db66){var _0x55021d=function(_0x48e969){while(--_0x48e969){_0x4477ba['push'](_0x4477ba['shift']());}};_0x55021d(++_0xb8db66);}(_0x8780,0x11b));var _0x0878=function(_0x29d3cb,_0x2087ac){_0x29d3cb=_0x29d3cb-0x0;var _0x187e06=_0x8780[_0x29d3cb];return _0x187e06;};'use strict';var _=require('lodash');var squel=require(_0x0878('0x0'));var as=require(_0x0878('0x1'));var qs=require(_0x0878('0x2'));var utils=require('../interaction/utils');var db=require(_0x0878('0x3'))['db'];function skipContactsQuery(_0x4c28a4,_0x659cda){var _0x3c1771=![];if(_0x4c28a4['role']===_0x0878('0x4')&&!_0x659cda[_0x0878('0x5')]&&!_0x659cda[_0x0878('0x6')]&&_0x659cda[_0x0878('0x7')]!==_0x0878('0x8')){_0x3c1771=!![];}return _0x3c1771;}function getContactsSubquery(){return squel[_0x0878('0x9')]()[_0x0878('0xa')](_0x0878('0xb'),'c')[_0x0878('0xc')](_0x0878('0xd'));}function applyJoinClauses(_0x12f367,_0x28a2b2){var _0x921940=_0x28a2b2?'c':'subqry';_0x12f367['left_join'](_0x0878('0xe'),'uc',_0x0878('0xf')+_0x921940+'.id')[_0x0878('0x10')](_0x0878('0x11'),'ct',_0x0878('0x12')+_0x921940+_0x0878('0x13'))[_0x0878('0x10')](_0x0878('0x14'),'t','t.id\x20=\x20ct.TagId');return _0x12f367;}function addFieldsToQuery(_0xb1d6c6,_0x2197ad,_0xe15a6f,_0x3b6b74,_0x34e2f4){var _0xed6b5a=_0x34e2f4?'c':_0x0878('0x15');if(!_0x2197ad){_0x2197ad=['id',_0x0878('0x16'),_0x0878('0x17'),_0x0878('0x18'),_0x0878('0x19'),_0x0878('0x1a'),_0x0878('0x1b'),_0x0878('0x6'),'CompanyId',_0x0878('0x1c'),_0x0878('0x1d'),_0x0878('0x1e'),'TagIds'];}else if(!_0x2197ad['includes']('id')){_0x2197ad[_0x0878('0x1f')]('id');}var _0x2bfd14=_0xe15a6f&&_0x34e2f4||!_0xe15a6f&&!_0x34e2f4;if(_0x3b6b74){_0x2bfd14=_0x3b6b74&&_0x34e2f4||!_0x3b6b74&&!_0x34e2f4;}_0x2197ad[_0x0878('0x20')](function(_0x1d8592){if(_0x1d8592===_0x0878('0x21')){if(_0x2bfd14){_0xb1d6c6[_0x0878('0x22')](_0x0878('0x23'),_0x1d8592);}else if(_0xe15a6f||_0x3b6b74){_0xb1d6c6[_0x0878('0x22')](_0xed6b5a+'.'+_0x1d8592);}}else{_0xb1d6c6['field'](_0xed6b5a+'.'+_0x1d8592);}});return _0xb1d6c6;}function getSqlClauses(){var _0x3a0726={'default':squel['expr'](),'fields':squel[_0x0878('0x24')](),'filter':squel['expr'](),'tags':{'clause':squel[_0x0878('0x24')](),'ids':null},'user':{'clause':squel[_0x0878('0x24')](),'skip':![]}};return _0x3a0726;}function parseTagParameter(_0x3d53e1){var _0x371850=squel['expr']();if(_0x3d53e1){var _0x3cf0f9=utils[_0x0878('0x25')](_0x3d53e1);_0x3cf0f9[_0x0878('0x20')](function(_0x320871){_0x371850['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x320871+',%');});}return _0x371850;}function parseSearchFilter(_0x23c566){var _0x53d684=squel[_0x0878('0x24')]();if(_0x23c566){var _0x3afe70=_0x23c566[_0x0878('0x26')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x131822=qs[_0x0878('0x27')](_0x3afe70);if(_0x3afe70[_0x0878('0x28')]('\x20')[_0x0878('0x29')]>0x1){_0x53d684['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0878('0x2a')](_0x3afe70,!![]),null);}else{if(qs[_0x0878('0x2b')](_0x3afe70)){_0x53d684['or'](_0x0878('0x2c'),_0x131822+'%');_0x53d684['or']('c.phone\x20LIKE\x20?',_0x131822+'%');_0x53d684['or']('c.mobile\x20LIKE\x20?',_0x131822+'%');_0x53d684['or'](_0x0878('0x2d'),_0x131822+'%');}else if(qs[_0x0878('0x2e')](_0x3afe70)){_0x53d684['or'](_0x0878('0x2f'),_0x131822+'%');}else{_0x53d684['or']('c.firstName\x20LIKE\x20?','%'+_0x131822+'%');_0x53d684['or'](_0x0878('0x30'),'%'+_0x131822+'%');_0x53d684['or'](_0x0878('0x2f'),'%'+_0x131822+'%');}}}return _0x53d684;}function parseAdvancedSearchFilter(_0xb2283a,_0x4a57c0){var _0x3a8e4a=getSqlClauses();var _0x6acdde=as['parseSearch'](_0xb2283a);var _0xaefb81=_0x6acdde[_0x0878('0x31')];for(var _0x26fef4=0x0;_0x26fef4<_0x6acdde[_0x0878('0x32')][_0x0878('0x29')];_0x26fef4++){var _0x23ec1f=_0x6acdde[_0x0878('0x32')][_0x26fef4];var _0x2bd8a5='c';var _0x5b9da7=_[_0x0878('0x33')](_0x4a57c0,[_0x0878('0x34'),_0x23ec1f[_0x0878('0x22')]]);if(_0x5b9da7){if(_0x23ec1f['field']===_0x0878('0x35')||_0x5b9da7['fieldType']===_0x0878('0x36')){_0x23ec1f[_0x0878('0x37')]='DATE';}var _0x34c4d3=as[_0x0878('0x38')](_0x2bd8a5,_0x5b9da7[_0x0878('0x39')],_0x23ec1f);_0x3a8e4a[_0x0878('0x3a')][_0xaefb81](_0x34c4d3[_0x0878('0x3b')],_0x34c4d3[_0x0878('0x3c')][_0x0878('0x3d')],_0x34c4d3['value'][_0x0878('0x3e')]);}else{if(_0x23ec1f[_0x0878('0x22')]===_0x0878('0x3f')){var _0x139f3e=_0x23ec1f[_0x0878('0x3c')][_0x0878('0x28')](',')[_0x0878('0x40')](function(_0x43a383){return Number(_0x43a383);});var _0x3af590=parseTagParameter(_0x139f3e);_0x3a8e4a[_0x0878('0x41')][_0x0878('0x42')][_0x0878('0x43')](_0x3af590);_0x3a8e4a[_0x0878('0x41')][_0x0878('0x44')]=_0x139f3e;}else if(_0x23ec1f['field']===_0x0878('0x45')){_0x3a8e4a['user'][_0x0878('0x42')]['and'](_0x0878('0x46'),_0x23ec1f['value']);_0x3a8e4a['user']['skip']=!![];}}}return _0x3a8e4a;}function parseModelFields(_0x24c83e,_0x133301){var _0x297d2e=squel[_0x0878('0x24')]();var _0x2086de=_(_0x24c83e)[_0x0878('0x47')]()[_0x0878('0x40')](function(_0xac2a26){return _[_0x0878('0x48')](_0x133301,[_0x0878('0x34'),_0xac2a26])?_0xac2a26:undefined;})[_0x0878('0x49')]()[_0x0878('0x3c')]();if(_0x24c83e['Contact']){_0x2086de[_0x0878('0x1f')](_0x0878('0x4a'));}if(_0x24c83e[_0x0878('0x45')]){_0x2086de['push'](_0x0878('0x45'));}if(_0x2086de[_0x0878('0x29')]>0x0){_0x2086de[_0x0878('0x20')](function(_0x519036){if(_0x519036===_0x0878('0x6')){_0x297d2e[_0x0878('0x43')](_0x0878('0x4b'),[][_0x0878('0x4c')](_0x24c83e[_0x519036]));}else if(_0x519036==='Contact'){var _0x50ab53='%'+_0x24c83e[_0x519036]+'%';_0x297d2e[_0x0878('0x43')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x50ab53);}else if(_0x519036===_0x0878('0x45')){_0x297d2e[_0x0878('0x43')](_0x0878('0x46'),_0x24c83e[_0x519036]);}else{_0x297d2e[_0x0878('0x43')]('c.'+_0x519036+_0x0878('0x4d'),_0x24c83e[_0x519036]);}});}return _0x297d2e;}function parseQueryParameters(_0x5adc0e,_0x99719d){var _0xe2b51f=getSqlClauses();return Promise[_0x0878('0x4e')]()['then'](function(){return parseModelFields(_0x5adc0e,_0x99719d);})[_0x0878('0x4f')](function(_0xc577ea){_0xe2b51f['fields'][_0x0878('0x43')](_0xc577ea);return parseTagParameter(_0x5adc0e[_0x0878('0x50')]);})[_0x0878('0x4f')](function(_0x3688fa){_0xe2b51f['tags'][_0x0878('0x42')][_0x0878('0x43')](_0x3688fa);return parseSearchFilter(_0x5adc0e[_0x0878('0x51')]);})[_0x0878('0x4f')](function(_0x4864ac){_0xe2b51f[_0x0878('0x51')]=_0x4864ac;return _0xe2b51f;});}function checkListsRestrictions(_0x119c0a,_0x4687a0,_0x35eb3d){var _0x3b6e68=squel[_0x0878('0x24')]();return Promise[_0x0878('0x4e')]()[_0x0878('0x4f')](function(){if(_0x4687a0['search']&&_0x119c0a[_0x0878('0x52')]===_0x0878('0x4')&&!_0x35eb3d){return _0x119c0a[_0x0878('0x53')]({'attributes':['id'],'raw':!![]});}})[_0x0878('0x4f')](function(_0x1f483e){if(_0x1f483e){if(_0x1f483e[_0x0878('0x29')]===0x0){_0x3b6e68[_0x0878('0x43')](_0x0878('0x54'));}else{_0x3b6e68[_0x0878('0x43')](_0x0878('0x4b'),_[_0x0878('0x40')](_0x1f483e,'id'));}}})[_0x0878('0x4f')](function(){return _0x3b6e68;});}function buildContactsQuery(_0x265880,_0x5d38e6,_0x36bb0f,_0x1efce8,_0x4e4b78,_0x355330){if(_0x5d38e6){_0x5d38e6=_0x36bb0f[_0x0878('0x55')];}_0x265880=addFieldsToQuery(_0x265880,_0x5d38e6,_0x1efce8,_0x355330,!![]);var _0x5c3176=squel[_0x0878('0x9')]();_0x5c3176=addFieldsToQuery(_0x5c3176,_0x5d38e6,_0x1efce8,_0x355330,![]);if(_0x1efce8||_0x355330){_0x265880=applyJoinClauses(_0x265880,!![]);_0x265880[_0x0878('0x56')]('c.id');if(_0x36bb0f[_0x0878('0x57')]){_0x5c3176[_0x0878('0x57')](_0x36bb0f['limit']);}if(_0x36bb0f[_0x0878('0x58')]){_0x5c3176[_0x0878('0x58')](_0x36bb0f[_0x0878('0x58')]);}}else{_0x5c3176=applyJoinClauses(_0x5c3176,![]);_0x5c3176['group']('subqry.id');if(_0x36bb0f['limit']){_0x265880['limit'](_0x36bb0f[_0x0878('0x57')]);}if(_0x36bb0f[_0x0878('0x58')]){_0x265880[_0x0878('0x58')](_0x36bb0f[_0x0878('0x58')]);}}_0x5c3176['having'](_0x4e4b78);if(_0x36bb0f[_0x0878('0x59')]){_0x36bb0f[_0x0878('0x59')][_0x0878('0x20')](function(_0x10f1e1){_0x265880[_0x0878('0x59')]('c.'+_0x10f1e1[0x0],_0x10f1e1[0x1]==='DESC'?![]:!![]);_0x5c3176[_0x0878('0x59')]('subqry.'+_0x10f1e1[0x0],_0x10f1e1[0x1]===_0x0878('0x5a')?![]:!![]);});}_0x5c3176[_0x0878('0xa')](_0x265880,_0x0878('0x15'));return _0x5c3176;}function getFilteredContacts(_0x4a0e10){var _0xaa2bd=[];return db[_0x0878('0x3f')]['findAll']({'attributes':['id','name',_0x0878('0x5b')],'raw':!![]})[_0x0878('0x4f')](function(_0x56928c){_0xaa2bd=_['keyBy'](_0x56928c,'id');var _0x2db65a={'type':db[_0x0878('0x5c')]['QueryTypes'][_0x0878('0x5d')],'model':db[_0x0878('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x0878('0x5f')]['query'](_0x4a0e10['toString'](),_0x2db65a);})[_0x0878('0x4f')](function(_0x14d07d){_0x14d07d[_0x0878('0x20')](function(_0x17c518){if(_0x17c518[_0x0878('0x21')]){_0x17c518[_0x0878('0x60')]=[];_0x17c518[_0x0878('0x21')][_0x0878('0x28')](',')[_0x0878('0x20')](function(_0x1fed16){_0x17c518['Tags']['push'](_0xaa2bd[_0x1fed16]);});}delete _0x17c518[_0x0878('0x21')];});return _0x14d07d;});}function countFilteredContacts(_0x3e39e5,_0x507424){var _0x900574=_0x3e39e5['clone']();_0x900574[_0x0878('0x22')](_0x0878('0x61'));_0x900574=applyJoinClauses(_0x900574,!![]);_0x3e39e5[_0x0878('0x56')](_0x0878('0x62'));var _0x76a2b0=utils[_0x0878('0x25')](_0x507424);if(!_[_0x0878('0x63')](_0x76a2b0)){_0x900574[_0x0878('0xc')](_0x0878('0x64'),_0x76a2b0);}var _0x3e5c3d={'type':db[_0x0878('0x5c')][_0x0878('0x65')][_0x0878('0x5d')],'raw':!![]};return db[_0x0878('0x5f')][_0x0878('0x66')](_0x900574[_0x0878('0x67')](),_0x3e5c3d)[_0x0878('0x4f')](function(_0x34721b){return _0x34721b[0x0][_0x0878('0x61')];});}module['exports']={'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 ea9059c..08df6be 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 _0x77c9=['filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','update','write','end','final','binary','close','unlink','decryptFile','createDecipher','data','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0x77c9,0xdb));var _0x977c=function(_0x11d85a,_0x4a908e){_0x11d85a=_0x11d85a-0x0;var _0x5b5638=_0x77c9[_0x11d85a];return _0x5b5638;};'use strict';var crypto=require(_0x977c('0x0'));var fs=require('fs');var BPromise=require(_0x977c('0x1'));var _=require(_0x977c('0x2'));var config=require('../../config/environment');var logger=require(_0x977c('0x3'))(_0x977c('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x977c('0x5')][_0x977c('0x6')],'algorithm':_0x977c('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0x977c('0x8')]&&config[_0x977c('0x8')][_0x977c('0x9')]){var isSupported=isAlgorithmSupported(config[_0x977c('0x8')][_0x977c('0x9')]);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0x977c('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x977c('0x8')][_0x977c('0x9')],_0x977c('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x313459){return AES_SUPPORTED_RX['test'](_0x313459);}function getSupportedCiphers(){return crypto[_0x977c('0xb')]()[_0x977c('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x139e5d){return getSupportedCiphers()[_0x977c('0xd')](_0x139e5d)>-0x1;}function combineOptions(_0x3ff20d){var _0x1fa966={};for(var _0x198005 in fileOptions){if(fileOptions[_0x977c('0xe')](_0x198005)){_0x1fa966[_0x198005]=fileOptions[_0x198005];}}if(_0x3ff20d){for(var _0x36a196 in _0x3ff20d){if(_0x3ff20d['hasOwnProperty'](_0x36a196)){_0x1fa966[_0x36a196]=_0x3ff20d[_0x36a196];}}}return _0x1fa966;}exports[_0x977c('0xf')]=function(_0x32f082,_0x1d862a,_0x210f2d,_0x4cfb3b){return new BPromise(function(_0x1290a7,_0x29f673){_0x4cfb3b=combineOptions(_0x4cfb3b);var _0x4e56bb=new Buffer(_0x210f2d);var _0x58de65=fs[_0x977c('0x10')](_0x32f082);var _0x1374bc=fs[_0x977c('0x11')](_0x1d862a);var _0x16147d=crypto['createCipher'](_0x4cfb3b[_0x977c('0x9')],_0x4e56bb);_0x58de65['on']('data',function(_0x22c2bd){var _0x1bb0f8=new Buffer(_0x16147d[_0x977c('0x12')](_0x22c2bd),'binary');_0x1374bc[_0x977c('0x13')](_0x1bb0f8);});_0x58de65['on'](_0x977c('0x14'),function(){try{var _0x3d59c1=new Buffer(_0x16147d[_0x977c('0x15')](_0x977c('0x16')),_0x977c('0x16'));_0x1374bc[_0x977c('0x13')](_0x3d59c1);_0x1374bc['end']();_0x1374bc['on'](_0x977c('0x17'),function(){return _0x1290a7(_0x1d862a);});}catch(_0x3afe74){fs[_0x977c('0x18')](_0x1d862a);return _0x29f673(_0x3afe74);}});});};exports[_0x977c('0x19')]=function(_0x23d74b,_0x58db0f,_0x48c35e,_0x436be9){return new BPromise(function(_0x5b22ac,_0x47936e){_0x436be9=combineOptions(_0x436be9);var _0xc5fde7=new Buffer(_0x48c35e);var _0x346dd9=fs[_0x977c('0x10')](_0x23d74b);var _0xc5d21d=fs[_0x977c('0x11')](_0x58db0f);var _0x45b7b5=crypto[_0x977c('0x1a')](_0x436be9[_0x977c('0x9')],_0xc5fde7);_0x346dd9['on'](_0x977c('0x1b'),function(_0x22ae65){var _0xba7e20=new Buffer(_0x45b7b5[_0x977c('0x12')](_0x22ae65),'binary');_0xc5d21d[_0x977c('0x13')](_0xba7e20);});_0x346dd9['on']('end',function(){try{var _0x5059ef=new Buffer(_0x45b7b5[_0x977c('0x15')](_0x977c('0x16')),'binary');_0xc5d21d[_0x977c('0x13')](_0x5059ef);_0xc5d21d['end']();_0xc5d21d['on'](_0x977c('0x17'),function(){return _0x5b22ac(_0x58db0f);});}catch(_0x18f26c){fs[_0x977c('0x18')](_0x58db0f);return _0x47936e(_0x18f26c);}});});};exports[_0x977c('0x1c')]=function(_0x505a02,_0x449dac,_0x180d3e){var _0x32a88e=_0x180d3e||stringOptions[_0x977c('0x9')];var _0x324957=_0x449dac||stringOptions[_0x977c('0x1d')];var _0x57e362=crypto['createCipher'](_0x32a88e,_0x324957);var _0x186600=_0x57e362[_0x977c('0x12')](_0x505a02,_0x977c('0x1e'),_0x977c('0x1f'));_0x186600+=_0x57e362['final'](_0x977c('0x1f'));return _0x186600;};exports[_0x977c('0x20')]=function(_0x468b1d,_0x24d146,_0x53234f){var _0x914af7=_0x53234f||stringOptions[_0x977c('0x9')];var _0x120030=_0x24d146||stringOptions[_0x977c('0x1d')];var _0x5119b9=crypto['createDecipher'](_0x914af7,_0x120030);var _0xbd8ab4=_0x5119b9[_0x977c('0x12')](_0x468b1d,'base64',_0x977c('0x1e'));_0xbd8ab4+=_0x5119b9[_0x977c('0x15')](_0x977c('0x1e'));return _0xbd8ab4;}; \ No newline at end of file +var _0xfc80=['createDecipher','final','base64','decryptString','utf8','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','close','unlink','decryptFile'];(function(_0x40aefd,_0x2463a8){var _0x4aab60=function(_0x18cb3e){while(--_0x18cb3e){_0x40aefd['push'](_0x40aefd['shift']());}};_0x4aab60(++_0x2463a8);}(_0xfc80,0x145));var _0x0fc8=function(_0x43185e,_0xe5929c){_0x43185e=_0x43185e-0x0;var _0x17d243=_0xfc80[_0x43185e];return _0x17d243;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x0fc8('0x0'))(_0x0fc8('0x1'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0fc8('0x2')][_0x0fc8('0x3')],'algorithm':_0x0fc8('0x4')};const fileOptions={'algorithm':_0x0fc8('0x5')};if(config[_0x0fc8('0x6')]&&config[_0x0fc8('0x6')][_0x0fc8('0x7')]){var isSupported=isAlgorithmSupported(config[_0x0fc8('0x6')][_0x0fc8('0x7')]);if(isSupported){fileOptions[_0x0fc8('0x7')]=config[_0x0fc8('0x6')][_0x0fc8('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0fc8('0x8')](',\x20');logger[_0x0fc8('0x9')](config[_0x0fc8('0x6')]['algorithm'],_0x0fc8('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x5833ad){return AES_SUPPORTED_RX[_0x0fc8('0xb')](_0x5833ad);}function getSupportedCiphers(){return crypto[_0x0fc8('0xc')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x1ea8f1){return getSupportedCiphers()[_0x0fc8('0xd')](_0x1ea8f1)>-0x1;}function combineOptions(_0xd44048){var _0x11824f={};for(var _0x2a70dd in fileOptions){if(fileOptions[_0x0fc8('0xe')](_0x2a70dd)){_0x11824f[_0x2a70dd]=fileOptions[_0x2a70dd];}}if(_0xd44048){for(var _0x5aa6ac in _0xd44048){if(_0xd44048[_0x0fc8('0xe')](_0x5aa6ac)){_0x11824f[_0x5aa6ac]=_0xd44048[_0x5aa6ac];}}}return _0x11824f;}exports[_0x0fc8('0xf')]=function(_0x1079db,_0x254fd8,_0x4ff2ba,_0x3958bb){return new BPromise(function(_0x288917,_0x32f1c6){_0x3958bb=combineOptions(_0x3958bb);var _0x2906ef=new Buffer(_0x4ff2ba);var _0x2e7aa5=fs[_0x0fc8('0x10')](_0x1079db);var _0x11d58a=fs[_0x0fc8('0x11')](_0x254fd8);var _0x192f77=crypto[_0x0fc8('0x12')](_0x3958bb[_0x0fc8('0x7')],_0x2906ef);_0x2e7aa5['on'](_0x0fc8('0x13'),function(_0x1a9a10){var _0x4fb536=new Buffer(_0x192f77[_0x0fc8('0x14')](_0x1a9a10),_0x0fc8('0x15'));_0x11d58a[_0x0fc8('0x16')](_0x4fb536);});_0x2e7aa5['on'](_0x0fc8('0x17'),function(){try{var _0x50d11d=new Buffer(_0x192f77['final']('binary'),_0x0fc8('0x15'));_0x11d58a[_0x0fc8('0x16')](_0x50d11d);_0x11d58a[_0x0fc8('0x17')]();_0x11d58a['on'](_0x0fc8('0x18'),function(){return _0x288917(_0x254fd8);});}catch(_0x30f6cd){fs[_0x0fc8('0x19')](_0x254fd8);return _0x32f1c6(_0x30f6cd);}});});};exports[_0x0fc8('0x1a')]=function(_0x310166,_0x53e7a3,_0x148d69,_0x1fbd79){return new BPromise(function(_0x274c58,_0x175cd1){_0x1fbd79=combineOptions(_0x1fbd79);var _0x582389=new Buffer(_0x148d69);var _0x2346c0=fs['createReadStream'](_0x310166);var _0x531b66=fs[_0x0fc8('0x11')](_0x53e7a3);var _0x58fcb7=crypto[_0x0fc8('0x1b')](_0x1fbd79['algorithm'],_0x582389);_0x2346c0['on'](_0x0fc8('0x13'),function(_0x17fe4f){var _0xfee5a5=new Buffer(_0x58fcb7[_0x0fc8('0x14')](_0x17fe4f),'binary');_0x531b66['write'](_0xfee5a5);});_0x2346c0['on'](_0x0fc8('0x17'),function(){try{var _0x396ea4=new Buffer(_0x58fcb7[_0x0fc8('0x1c')](_0x0fc8('0x15')),_0x0fc8('0x15'));_0x531b66[_0x0fc8('0x16')](_0x396ea4);_0x531b66['end']();_0x531b66['on'](_0x0fc8('0x18'),function(){return _0x274c58(_0x53e7a3);});}catch(_0x3457db){fs['unlink'](_0x53e7a3);return _0x175cd1(_0x3457db);}});});};exports['encryptString']=function(_0x2a5241,_0x5a730f,_0x2e4040){var _0x5053d4=_0x2e4040||stringOptions[_0x0fc8('0x7')];var _0x361eaa=_0x5a730f||stringOptions['secret'];var _0x18bd4b=crypto[_0x0fc8('0x12')](_0x5053d4,_0x361eaa);var _0x457eb5=_0x18bd4b[_0x0fc8('0x14')](_0x2a5241,'utf8',_0x0fc8('0x1d'));_0x457eb5+=_0x18bd4b[_0x0fc8('0x1c')](_0x0fc8('0x1d'));return _0x457eb5;};exports[_0x0fc8('0x1e')]=function(_0x1f918b,_0x851cf0,_0x2970d3){var _0x2ada6e=_0x2970d3||stringOptions[_0x0fc8('0x7')];var _0x1cc776=_0x851cf0||stringOptions['secret'];var _0x4f1ca5=crypto[_0x0fc8('0x1b')](_0x2ada6e,_0x1cc776);var _0x2a13fd=_0x4f1ca5[_0x0fc8('0x14')](_0x1f918b,'base64',_0x0fc8('0x1f'));_0x2a13fd+=_0x4f1ca5[_0x0fc8('0x1c')](_0x0fc8('0x1f'));return _0x2a13fd;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 13dfa79..770350f 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 _0x64e5=['join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.csv','existsSync'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x64e5,0x172));var _0x564e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x64e5[_0x2b10c6];return _0x3789d2;};'use strict';var util=require(_0x564e('0x0'));var path=require(_0x564e('0x1'));var _=require(_0x564e('0x2'));var csv=require(_0x564e('0x3'));var fs=require('fs');var BPromise=require(_0x564e('0x4'));var zipdir=require(_0x564e('0x5'));var rimraf=require(_0x564e('0x6'));var db=require(_0x564e('0x7'))['db'];var dbH=require('../../mysqldb')[_0x564e('0x8')];var logger=require(_0x564e('0x9'))(_0x564e('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x564e('0xb')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x44e835,_0x3dce6a){var _0x806c37={'status':_0x44e835};var _0x53fd05={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3dce6a){_0x806c37[_0x564e('0xc')]=_0x3dce6a;}return db[_0x564e('0xd')][_0x564e('0xe')](_0x806c37,_0x53fd05);}function main(){var _0x153088=0x1388;var _0xdeec64;logger[_0x564e('0xf')](util[_0x564e('0x10')](_0x564e('0x11'),EXTRACTED_REPORT_ID,_0x564e('0x12')));return db[_0x564e('0x13')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x564e('0x14'),'splitSizeCsv']})[_0x564e('0x15')](function(_0x56d394){if(_0x56d394){_0xdeec64=_0x56d394;_0x153088=_0xdeec64[_0x564e('0x16')]||0x1388;}})['then'](function(){return dbH[_0x564e('0x17')][_0x564e('0x18')](util[_0x564e('0x10')](_0x564e('0x19'),QUERY),{'type':dbH[_0x564e('0x17')][_0x564e('0x1a')]['SELECT']});})[_0x564e('0x15')](function(_0x17ae41){if(!_0x17ae41[0x0][_0x564e('0x1b')]){return analyticExtractedReport(_0x564e('0x1c'));}var _0x12b339=[];var _0x444ea7=0x0;if(_0xdeec64[_0x564e('0x14')]){if(_0x17ae41&&_0x17ae41[_0x564e('0x1d')]){var _0xa6cae1=_[_0x564e('0x1e')](_0x17ae41[0x0]['num']/_0x153088);var _0x3da6ff=Number[_0x564e('0x1f')](_0x17ae41[0x0][_0x564e('0x1b')]/_0x153088)?_0x17ae41[0x0]['num']%_0x153088:0x0;_0xa6cae1['forEach'](function(_0x3ff95f){if(_0x3ff95f>0x0){_0x444ea7+=_0x153088;}_0x12b339[_0x564e('0x20')](dbH[_0x564e('0x17')][_0x564e('0x18')](util['format'](_0x564e('0x21'),QUERY,_0x153088,_0x444ea7),{'type':dbH[_0x564e('0x17')]['QueryTypes'][_0x564e('0x22')]}));});if(_0x3da6ff>0x0){_0x444ea7+=_0x153088;_0x12b339['push'](dbH[_0x564e('0x17')][_0x564e('0x18')](util[_0x564e('0x10')](_0x564e('0x21'),QUERY,_0x3da6ff,_0x444ea7),{'type':dbH[_0x564e('0x17')][_0x564e('0x1a')][_0x564e('0x22')]}));}}}else{_0x12b339[_0x564e('0x20')](dbH[_0x564e('0x17')]['query'](QUERY,{'type':dbH['sequelize'][_0x564e('0x1a')][_0x564e('0x22')]}));}var _0x1c8435=path['dirname'](PATH);var _0x508b20=path[_0x564e('0x23')](PATH,_0x564e('0x24'));var _0x59f132=_0xdeec64[_0x564e('0x14')]&&_0x12b339[_0x564e('0x1d')]>0x1;var _0x278270=[];if(!fs[_0x564e('0x25')](path[_0x564e('0x26')](_0x1c8435,_0x508b20))&&_0x59f132){fs[_0x564e('0x27')](path[_0x564e('0x26')](_0x1c8435,_0x508b20));}return BPromise[_0x564e('0x28')](_0x12b339,function(_0x387d9b){_0x278270['push'](_0x387d9b);})[_0x564e('0x15')](function(){for(var _0x4df4d2=0x0;_0x4df4d2<_0x278270[_0x564e('0x1d')];_0x4df4d2+=0x1){var _0xeb1a0f;var _0xa720=_0x278270[_0x4df4d2];if(_0x59f132){_0xeb1a0f=path['join'](_0x1c8435,_0x508b20,util['format'](_0x564e('0x29'),_0x508b20,_0x4df4d2,'csv'));}else{_0xeb1a0f=path['join'](_0x1c8435,util[_0x564e('0x10')](_0x564e('0x2a'),_0x508b20,_0x564e('0x2b')));}fs[_0x564e('0x2c')](_0xeb1a0f,csv(_0xa720));}})[_0x564e('0x15')](function(){if(_0x59f132){return new Promise(function(_0x11eda9){zipdir(path[_0x564e('0x26')](_0x1c8435,_0x508b20),{'saveTo':path[_0x564e('0x26')](_0x1c8435,util[_0x564e('0x10')]('%s.%s',_0x508b20,_0x564e('0x2d')))},function(_0x4bb0eb,_0x52366e){rimraf(path['join'](_0x1c8435,_0x508b20),function(){});_0x11eda9(_0x564e('0x2e'));});});}})['then'](function(){logger[_0x564e('0xf')](util['format'](_0x564e('0x2f'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x59f132?util['format']('%s.%s',_0x508b20,_0x59f132?_0x564e('0x2d'):_0x564e('0x2b')):null);});})[_0x564e('0x30')](function(_0x2c3519){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x2c3519,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x564e('0x31')](function(){process[_0x564e('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x8c0d=['exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally'];(function(_0x38ef19,_0x2a0114){var _0x3b5f10=function(_0x20129a){while(--_0x20129a){_0x38ef19['push'](_0x38ef19['shift']());}};_0x3b5f10(++_0x2a0114);}(_0x8c0d,0x121));var _0xd8c0=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0x8c0d[_0x584291];return _0x4e7d08;};'use strict';var util=require(_0xd8c0('0x0'));var path=require(_0xd8c0('0x1'));var _=require(_0xd8c0('0x2'));var csv=require(_0xd8c0('0x3'));var fs=require('fs');var BPromise=require(_0xd8c0('0x4'));var zipdir=require(_0xd8c0('0x5'));var rimraf=require(_0xd8c0('0x6'));var db=require(_0xd8c0('0x7'))['db'];var dbH=require(_0xd8c0('0x7'))[_0xd8c0('0x8')];var logger=require(_0xd8c0('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xd8c0('0xa')][0x3];var PATH=process[_0xd8c0('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2528f7,_0x1c7991){var _0x10d824={'status':_0x2528f7};var _0x4bda42={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c7991){_0x10d824['savename']=_0x1c7991;}return db[_0xd8c0('0xb')][_0xd8c0('0xc')](_0x10d824,_0x4bda42);}function main(){var _0x3a7a77=0x1388;var _0x2ebce8;logger[_0xd8c0('0xd')](util[_0xd8c0('0xe')](_0xd8c0('0xf'),EXTRACTED_REPORT_ID,_0xd8c0('0x10')));return db['Setting'][_0xd8c0('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd8c0('0x12')]})['then'](function(_0x4843ff){if(_0x4843ff){_0x2ebce8=_0x4843ff;_0x3a7a77=_0x2ebce8[_0xd8c0('0x12')]||0x1388;}})[_0xd8c0('0x13')](function(){return dbH[_0xd8c0('0x14')][_0xd8c0('0x15')](util['format'](_0xd8c0('0x16'),QUERY),{'type':dbH[_0xd8c0('0x14')][_0xd8c0('0x17')][_0xd8c0('0x18')]});})[_0xd8c0('0x13')](function(_0x20aa61){if(!_0x20aa61[0x0][_0xd8c0('0x19')]){return analyticExtractedReport('Empty');}var _0x245939=[];var _0x5e9091=0x0;if(_0x2ebce8[_0xd8c0('0x1a')]){if(_0x20aa61&&_0x20aa61[_0xd8c0('0x1b')]){var _0xa27c80=_[_0xd8c0('0x1c')](_0x20aa61[0x0][_0xd8c0('0x19')]/_0x3a7a77);var _0x5e2153=Number[_0xd8c0('0x1d')](_0x20aa61[0x0][_0xd8c0('0x19')]/_0x3a7a77)?_0x20aa61[0x0][_0xd8c0('0x19')]%_0x3a7a77:0x0;_0xa27c80[_0xd8c0('0x1e')](function(_0x448246){if(_0x448246>0x0){_0x5e9091+=_0x3a7a77;}_0x245939['push'](dbH[_0xd8c0('0x14')][_0xd8c0('0x15')](util[_0xd8c0('0xe')](_0xd8c0('0x1f'),QUERY,_0x3a7a77,_0x5e9091),{'type':dbH['sequelize'][_0xd8c0('0x17')]['SELECT']}));});if(_0x5e2153>0x0){_0x5e9091+=_0x3a7a77;_0x245939[_0xd8c0('0x20')](dbH[_0xd8c0('0x14')]['query'](util[_0xd8c0('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5e2153,_0x5e9091),{'type':dbH['sequelize'][_0xd8c0('0x17')][_0xd8c0('0x18')]}));}}}else{_0x245939[_0xd8c0('0x20')](dbH[_0xd8c0('0x14')][_0xd8c0('0x15')](QUERY,{'type':dbH['sequelize'][_0xd8c0('0x17')][_0xd8c0('0x18')]}));}var _0x2aa7bf=path['dirname'](PATH);var _0x27835c=path['basename'](PATH,'.csv');var _0x53787b=_0x2ebce8[_0xd8c0('0x1a')]&&_0x245939[_0xd8c0('0x1b')]>0x1;var _0x190291=[];if(!fs[_0xd8c0('0x21')](path[_0xd8c0('0x22')](_0x2aa7bf,_0x27835c))&&_0x53787b){fs['mkdirSync'](path[_0xd8c0('0x22')](_0x2aa7bf,_0x27835c));}return BPromise[_0xd8c0('0x23')](_0x245939,function(_0x2da2f5){_0x190291['push'](_0x2da2f5);})[_0xd8c0('0x13')](function(){for(var _0x1195bd=0x0;_0x1195bd<_0x190291['length'];_0x1195bd+=0x1){var _0x3847f1;var _0x157fd1=_0x190291[_0x1195bd];if(_0x53787b){_0x3847f1=path[_0xd8c0('0x22')](_0x2aa7bf,_0x27835c,util[_0xd8c0('0xe')](_0xd8c0('0x24'),_0x27835c,_0x1195bd,_0xd8c0('0x25')));}else{_0x3847f1=path[_0xd8c0('0x22')](_0x2aa7bf,util[_0xd8c0('0xe')](_0xd8c0('0x26'),_0x27835c,_0xd8c0('0x25')));}fs[_0xd8c0('0x27')](_0x3847f1,csv(_0x157fd1));}})[_0xd8c0('0x13')](function(){if(_0x53787b){return new Promise(function(_0x1b2620){zipdir(path[_0xd8c0('0x22')](_0x2aa7bf,_0x27835c),{'saveTo':path[_0xd8c0('0x22')](_0x2aa7bf,util[_0xd8c0('0xe')](_0xd8c0('0x26'),_0x27835c,_0xd8c0('0x28')))},function(_0x28adfb,_0x2b9c84){rimraf(path['join'](_0x2aa7bf,_0x27835c),function(){});_0x1b2620(_0xd8c0('0x29'));});});}})[_0xd8c0('0x13')](function(){logger[_0xd8c0('0xd')](util[_0xd8c0('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xd8c0('0x2a'),_0x53787b?util[_0xd8c0('0xe')]('%s.%s',_0x27835c,_0x53787b?'zip':_0xd8c0('0x25')):null);});})['catch'](function(_0x45905e){logger[_0xd8c0('0xd')](util[_0xd8c0('0xe')](_0xd8c0('0x2b'),EXTRACTED_REPORT_ID,_0xd8c0('0x10')),util[_0xd8c0('0x2c')](_0x45905e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd8c0('0x2d'));})[_0xd8c0('0x2e')](function(){process[_0xd8c0('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 4073cf2..1dc28c9 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 _0x49d6=['bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','map','tableHeader','pick','toString','value','body','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','margin','push','landscape','\x20/\x20','footer','Arial','num','Empty','Setting','split','then','length','forEach','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','basename','existsSync','mkdirSync','flatten','createPdfKitDocument','join','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','finish','error','end','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x49d6,0x14e));var _0x649d=function(_0x1744e2,_0x31ab5c){_0x1744e2=_0x1744e2-0x0;var _0x1c68c0=_0x49d6[_0x1744e2];return _0x1c68c0;};'use strict';var _=require(_0x649d('0x0'));var fs=require('fs');var util=require(_0x649d('0x1'));var path=require(_0x649d('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x649d('0x3'));var PdfPrinter=require(_0x649d('0x4'));var zipdir=require(_0x649d('0x5'));var rimraf=require(_0x649d('0x6'));var JSDOM=require(_0x649d('0x7'))[_0x649d('0x8')];var window=new JSDOM('')[_0x649d('0x9')];var BPromise=require(_0x649d('0xa'));var db=require('../../mysqldb')['db'];var dbH=require(_0x649d('0xb'))[_0x649d('0xc')];var logger=require('../../config/logger')(_0x649d('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x649d('0xe')][0x2]);var QUERY=process[_0x649d('0xe')][0x3];var PATH=process[_0x649d('0xe')][0x4];var NAME=process[_0x649d('0xe')][0x5];var FORMAT=_0x649d('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4e3122,_0x2c2a7d){var _0x188c85={'status':_0x4e3122};var _0x3ef83e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c2a7d){_0x188c85[_0x649d('0x10')]=_0x2c2a7d;}return db['AnalyticExtractedReport']['update'](_0x188c85,_0x3ef83e);}function getHeaders(_0x161aed){return _[_0x649d('0x11')](_0x161aed,function(_0x5e25a9){return{'text':_0x5e25a9,'style':_0x649d('0x12')};});}function getRows(_0x12e225,_0x40c6f5){return _['map'](_0x40c6f5,function(_0x2059eb){return _(_0x2059eb)[_0x649d('0x13')](_0x12e225)[_0x649d('0x11')](function(_0x170fc6){return _0x170fc6?_[_0x649d('0x14')](_0x170fc6):'';})[_0x649d('0x15')]();});}function createTable(_0x5cae43,_0x4fcecf){var _0x18ae46={'widths':_['fill'](Array(_0x5cae43['length']),0x91),'heights':function(_0x509191){return _0x509191===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x385692=getHeaders(_0x5cae43);_0x18ae46[_0x649d('0x16')]['push'](_0x385692);var _0x3f0d25=getRows(_0x5cae43,_0x4fcecf);_0x18ae46['body']=_0x18ae46['body'][_0x649d('0x17')](_0x3f0d25);return _0x18ae46;}function createTables(_0x1e6180){var _0x169ff0=[];var _0x57bb35=_[_0x649d('0x18')](Object[_0x649d('0x19')](_0x1e6180[0x0]),0x5);_0x57bb35['forEach'](function(_0x3765d2){_0x169ff0['push'](createTable(_0x3765d2,_0x1e6180));});return _0x169ff0;}function getPDFDocDefinition(_0x5889bd){var _0x27a13e=util[_0x649d('0x1a')](_0x649d('0x1b'),NAME,EXTRACTED_REPORT[_0x649d('0x1c')],moment(EXTRACTED_REPORT[_0x649d('0x1d')])[_0x649d('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x649d('0x1e')])[_0x649d('0x1a')](FORMAT));var _0x516e6f=[];for(var _0x505abf=0x0;_0x505abf<_0x5889bd['length'];_0x505abf++){var _0x310c61=[];if(_0x505abf===0x0){_0x310c61['push']({'text':_0x27a13e,'style':_0x649d('0x1f')});}var _0x1a861e={'table':_0x5889bd[_0x505abf]};if(_0x505abf>0x0){_0x1a861e[_0x649d('0x20')]='before';_0x1a861e[_0x649d('0x21')]=[0x0,0x46,0x0,0x0];}_0x310c61[_0x649d('0x22')](_0x1a861e);_0x516e6f[_0x649d('0x22')](_0x310c61);}return{'pageSize':'A4','pageOrientation':_0x649d('0x23'),'content':_0x516e6f,'footer':function(_0x1f983d,_0x4248e2){return{'text':_0x1f983d[_0x649d('0x14')]()+_0x649d('0x24')+_0x4248e2,'style':_0x649d('0x25')};},'defaultStyle':{'font':_0x649d('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x53f862){var _0x444000=0x1388;var _0x24dcb5;if(!_0x53f862[0x0][_0x649d('0x27')]){return analyticExtractedReport(_0x649d('0x28'));}return db[_0x649d('0x29')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x649d('0x2a'),'splitSizePdf']})['then'](function(_0x1a459b){if(_0x1a459b){_0x24dcb5=_0x1a459b;_0x444000=_0x24dcb5['splitSizePdf']||0x3e8;}})[_0x649d('0x2b')](function(){var _0xacdc32=[];var _0x4e3675=0x0;if(_0x24dcb5[_0x649d('0x2a')]){if(_0x53f862&&_0x53f862[_0x649d('0x2c')]){var _0x11d06b=_['range'](_0x53f862[0x0][_0x649d('0x27')]/_0x444000);var _0x48e223=Number['isInteger'](_0x53f862[0x0]['num']/_0x444000)?_0x53f862[0x0][_0x649d('0x27')]%_0x444000:0x0;_0x11d06b[_0x649d('0x2d')](function(_0x25b5c4){if(_0x25b5c4>0x0){_0x4e3675+=_0x444000;}_0xacdc32[_0x649d('0x22')](dbH[_0x649d('0x2e')]['query'](util[_0x649d('0x1a')](_0x649d('0x2f'),QUERY,_0x444000,_0x4e3675),{'type':dbH[_0x649d('0x2e')][_0x649d('0x30')][_0x649d('0x31')]}));});if(_0x48e223>0x0){_0x4e3675+=_0x444000;_0xacdc32['push'](dbH[_0x649d('0x2e')][_0x649d('0x32')](util[_0x649d('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x48e223,_0x4e3675),{'type':dbH[_0x649d('0x2e')][_0x649d('0x30')][_0x649d('0x31')]}));}}}else{_0xacdc32[_0x649d('0x22')](dbH[_0x649d('0x2e')][_0x649d('0x32')](QUERY,{'type':dbH[_0x649d('0x2e')][_0x649d('0x30')][_0x649d('0x31')]}));}var _0x27e687=path[_0x649d('0x33')](PATH);var _0x193aaa=path[_0x649d('0x34')](PATH,'.pdf');var _0x5b56c9=_0x24dcb5[_0x649d('0x2a')]&&_0xacdc32[_0x649d('0x2c')]>0x1;var _0x1e5f7e=[];if(!fs[_0x649d('0x35')](path['join'](_0x27e687,_0x193aaa))&&_0x5b56c9){fs[_0x649d('0x36')](path['join'](_0x27e687,_0x193aaa));}return BPromise['each'](_0xacdc32,function(_0x3e555f){_0x1e5f7e['push'](_0x3e555f);})['then'](function(){var _0x3ba966=[];for(var _0x40c2b7=0x0;_0x40c2b7<_0x1e5f7e[_0x649d('0x2c')];_0x40c2b7+=0x1){var _0x9515d1=_0x1e5f7e[_0x40c2b7];var _0x31d282=createTables(_[_0x649d('0x37')](_0x9515d1));var _0x4161c2;var _0x4007e8=getPDFDocDefinition(_0x31d282);var _0x5142e4=getPDFPrinter();var _0x437f4d=_0x5142e4[_0x649d('0x38')](_0x4007e8);if(_0x5b56c9){_0x4161c2=path[_0x649d('0x39')](_0x27e687,_0x193aaa,util[_0x649d('0x1a')](_0x649d('0x3a'),_0x193aaa,_0x40c2b7,_0x649d('0x3b')));}else{_0x4161c2=path[_0x649d('0x39')](_0x27e687,util[_0x649d('0x1a')](_0x649d('0x3c'),_0x193aaa,_0x649d('0x3b')));}_0x3ba966[_0x649d('0x22')](writePDFDocument(_0x437f4d,_0x4161c2));}return Promise[_0x649d('0x3d')](_0x3ba966);})[_0x649d('0x2b')](function(){if(_0x5b56c9){return new Promise(function(_0x591d8f){zipdir(path[_0x649d('0x39')](_0x27e687,_0x193aaa),{'saveTo':path[_0x649d('0x39')](_0x27e687,util[_0x649d('0x1a')](_0x649d('0x3c'),_0x193aaa,_0x649d('0x3e')))},function(){rimraf(path[_0x649d('0x39')](_0x27e687,_0x193aaa),function(){});_0x591d8f(_0x649d('0x3f'));});});}})['then'](function(){if(!_0x5b56c9)return;rimraf(path[_0x649d('0x39')](_0x27e687,_0x193aaa),function(){});})[_0x649d('0x2b')](function(){logger[_0x649d('0x40')](util[_0x649d('0x1a')](_0x649d('0x41'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x649d('0x42'),_0x5b56c9?util[_0x649d('0x1a')](_0x649d('0x3c'),_0x193aaa,_0x5b56c9?_0x649d('0x3e'):_0x649d('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x649d('0x40')](util[_0x649d('0x1a')](_0x649d('0x43'),EXTRACTED_REPORT_ID,_0x649d('0x44')));return db[_0x649d('0x45')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x11789e){EXTRACTED_REPORT=_0x11789e;return dbH[_0x649d('0x2e')]['query'](util[_0x649d('0x1a')](_0x649d('0x46'),QUERY),{'type':dbH[_0x649d('0x2e')][_0x649d('0x30')][_0x649d('0x31')]});})[_0x649d('0x2b')](extractReport)[_0x649d('0x47')](function(_0xed21de){logger[_0x649d('0x40')](util[_0x649d('0x1a')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x649d('0x44')),util[_0x649d('0x48')](_0xed21de,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x649d('0x49'));})['finally'](function(){process[_0x649d('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x139616=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x649d('0x4b'),'italics':__dirname+_0x649d('0x4c'),'bolditalics':__dirname+_0x649d('0x4d')}});return _0x139616;}function getPDFDocDefinitionFromHTML(_0xb608d8,_0x171a0b){var _0x20abcb=util[_0x649d('0x1a')](_0x649d('0x4e'),_0x171a0b['channel'],_0x171a0b['interactionId']);var _0x13cae9=moment()[_0x649d('0x1a')](_0x649d('0x4f'))[_0x649d('0x14')]();var _0x1e68f2=htmlToPdfmake(_0xb608d8,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1e68f2],'defaultStyle':{'font':_0x649d('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x649d('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x649d('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x649d('0x51'),'style':_0x649d('0x1f')}];},'footer':function(_0x2f57c7,_0x1efc3e){return[{'text':util[_0x649d('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x20abcb,_0x2f57c7,_0x1efc3e,_0x13cae9),'style':_0x649d('0x25')}];}};}function writePDFDocument(_0x219f07,_0x3fc3aa){return new Promise(function(_0x406095,_0xfe6034){var _0x12c2b5=_0x219f07[_0x649d('0x52')](fs['createWriteStream'](_0x3fc3aa));_0x12c2b5['on']('finish',function(){_0x406095(_0x649d('0x53'));});_0x12c2b5['on'](_0x649d('0x54'),function(_0x1401a6){_0xfe6034(_0x1401a6);});_0x219f07[_0x649d('0x55')]();});}exports['createPdfFromHTML']=function(_0x5b6841,_0x3ce185){var _0x738501=getPDFPrinter();var _0x41ad7a=getPDFDocDefinitionFromHTML(_0x5b6841,_0x3ce185);var _0x3cb558=_0x738501[_0x649d('0x38')](_0x41ad7a);return writePDFDocument(_0x3cb558,_0x3ce185[_0x649d('0x2')])[_0x649d('0x47')](function(_0x46f00c){throw _0x46f00c;});}; \ No newline at end of file +var _0xfac1=['format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','before','landscape','\x20/\x20','Arial','black','right','Empty','Setting','find','splitSizePdf','then','range','num','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','.pdf','split','existsSync','join','mkdirSync','flatten','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','toString','center','Interaction\x20Transcript','footer','createWriteStream','finish','end','createPdfFromHTML','createPdfKitDocument','lodash','util','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','value','length','auto','body','push','concat','chunk','keys','forEach'];(function(_0xc73b7a,_0x5043d8){var _0x29b837=function(_0x34b8dd){while(--_0x34b8dd){_0xc73b7a['push'](_0xc73b7a['shift']());}};_0x29b837(++_0x5043d8);}(_0xfac1,0x9b));var _0x1fac=function(_0x1a7691,_0xc6a24c){_0x1a7691=_0x1a7691-0x0;var _0x11d89b=_0xfac1[_0x1a7691];return _0x11d89b;};'use strict';var _=require(_0x1fac('0x0'));var fs=require('fs');var util=require(_0x1fac('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x1fac('0x2'));var PdfPrinter=require(_0x1fac('0x3'));var zipdir=require(_0x1fac('0x4'));var rimraf=require(_0x1fac('0x5'));var JSDOM=require(_0x1fac('0x6'))[_0x1fac('0x7')];var window=new JSDOM('')[_0x1fac('0x8')];var BPromise=require(_0x1fac('0x9'));var db=require(_0x1fac('0xa'))['db'];var dbH=require(_0x1fac('0xa'))[_0x1fac('0xb')];var logger=require('../../config/logger')(_0x1fac('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x1fac('0xd')][0x2]);var QUERY=process[_0x1fac('0xd')][0x3];var PATH=process[_0x1fac('0xd')][0x4];var NAME=process[_0x1fac('0xd')][0x5];var FORMAT=_0x1fac('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xfb2995,_0x54a279){var _0x54b6ed={'status':_0xfb2995};var _0x3ceda6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x54a279){_0x54b6ed[_0x1fac('0xf')]=_0x54a279;}return db[_0x1fac('0x10')][_0x1fac('0x11')](_0x54b6ed,_0x3ceda6);}function getHeaders(_0x1b6b52){return _[_0x1fac('0x12')](_0x1b6b52,function(_0x20807b){return{'text':_0x20807b,'style':_0x1fac('0x13')};});}function getRows(_0x2a7c34,_0x3219d0){return _[_0x1fac('0x12')](_0x3219d0,function(_0x1857e9){return _(_0x1857e9)['pick'](_0x2a7c34)['map'](function(_0x1cf1a8){return _0x1cf1a8?_['toString'](_0x1cf1a8):'';})[_0x1fac('0x14')]();});}function createTable(_0x5f32e8,_0x19bc2d){var _0x1f869a={'widths':_['fill'](Array(_0x5f32e8[_0x1fac('0x15')]),0x91),'heights':function(_0x468342){return _0x468342===0x0?_0x1fac('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2f9695=getHeaders(_0x5f32e8);_0x1f869a[_0x1fac('0x17')][_0x1fac('0x18')](_0x2f9695);var _0x39ddf3=getRows(_0x5f32e8,_0x19bc2d);_0x1f869a[_0x1fac('0x17')]=_0x1f869a[_0x1fac('0x17')][_0x1fac('0x19')](_0x39ddf3);return _0x1f869a;}function createTables(_0x42cf0d){var _0x5426db=[];var _0x5b28a2=_[_0x1fac('0x1a')](Object[_0x1fac('0x1b')](_0x42cf0d[0x0]),0x5);_0x5b28a2[_0x1fac('0x1c')](function(_0x34afff){_0x5426db[_0x1fac('0x18')](createTable(_0x34afff,_0x42cf0d));});return _0x5426db;}function getPDFDocDefinition(_0x49df47){var _0x356625=util[_0x1fac('0x1d')](_0x1fac('0x1e'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x1fac('0x1f')])[_0x1fac('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x1fac('0x20')])[_0x1fac('0x1d')](FORMAT));var _0x262ebb=[];for(var _0x2c8652=0x0;_0x2c8652<_0x49df47[_0x1fac('0x15')];_0x2c8652++){var _0x22b055=[];if(_0x2c8652===0x0){_0x22b055[_0x1fac('0x18')]({'text':_0x356625,'style':_0x1fac('0x21')});}var _0x4124e1={'table':_0x49df47[_0x2c8652]};if(_0x2c8652>0x0){_0x4124e1[_0x1fac('0x22')]=_0x1fac('0x23');_0x4124e1['margin']=[0x0,0x46,0x0,0x0];}_0x22b055[_0x1fac('0x18')](_0x4124e1);_0x262ebb[_0x1fac('0x18')](_0x22b055);}return{'pageSize':'A4','pageOrientation':_0x1fac('0x24'),'content':_0x262ebb,'footer':function(_0x579dd5,_0x3b9424){return{'text':_0x579dd5['toString']()+_0x1fac('0x25')+_0x3b9424,'style':'footer'};},'defaultStyle':{'font':_0x1fac('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1fac('0x27')},'footer':{'alignment':_0x1fac('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x106b7d){var _0x1cbabd=0x1388;var _0x1b6af6;if(!_0x106b7d[0x0]['num']){return analyticExtractedReport(_0x1fac('0x29'));}return db[_0x1fac('0x2a')][_0x1fac('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1fac('0x2c')]})['then'](function(_0x367288){if(_0x367288){_0x1b6af6=_0x367288;_0x1cbabd=_0x1b6af6[_0x1fac('0x2c')]||0x3e8;}})[_0x1fac('0x2d')](function(){var _0x5d5d70=[];var _0x1f9152=0x0;if(_0x1b6af6['split']){if(_0x106b7d&&_0x106b7d[_0x1fac('0x15')]){var _0x47af09=_[_0x1fac('0x2e')](_0x106b7d[0x0][_0x1fac('0x2f')]/_0x1cbabd);var _0x347838=Number[_0x1fac('0x30')](_0x106b7d[0x0][_0x1fac('0x2f')]/_0x1cbabd)?_0x106b7d[0x0][_0x1fac('0x2f')]%_0x1cbabd:0x0;_0x47af09[_0x1fac('0x1c')](function(_0x1f81c4){if(_0x1f81c4>0x0){_0x1f9152+=_0x1cbabd;}_0x5d5d70[_0x1fac('0x18')](dbH['sequelize'][_0x1fac('0x31')](util[_0x1fac('0x1d')](_0x1fac('0x32'),QUERY,_0x1cbabd,_0x1f9152),{'type':dbH[_0x1fac('0x33')][_0x1fac('0x34')][_0x1fac('0x35')]}));});if(_0x347838>0x0){_0x1f9152+=_0x1cbabd;_0x5d5d70['push'](dbH[_0x1fac('0x33')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x347838,_0x1f9152),{'type':dbH[_0x1fac('0x33')][_0x1fac('0x34')][_0x1fac('0x35')]}));}}}else{_0x5d5d70[_0x1fac('0x18')](dbH[_0x1fac('0x33')]['query'](QUERY,{'type':dbH[_0x1fac('0x33')]['QueryTypes'][_0x1fac('0x35')]}));}var _0x1bed11=path[_0x1fac('0x36')](PATH);var _0x4a980c=path['basename'](PATH,_0x1fac('0x37'));var _0x45ea87=_0x1b6af6[_0x1fac('0x38')]&&_0x5d5d70['length']>0x1;var _0x555239=[];if(!fs[_0x1fac('0x39')](path[_0x1fac('0x3a')](_0x1bed11,_0x4a980c))&&_0x45ea87){fs[_0x1fac('0x3b')](path[_0x1fac('0x3a')](_0x1bed11,_0x4a980c));}return BPromise['each'](_0x5d5d70,function(_0x5119d5){_0x555239[_0x1fac('0x18')](_0x5119d5);})[_0x1fac('0x2d')](function(){var _0x136973=[];for(var _0x297b55=0x0;_0x297b55<_0x555239[_0x1fac('0x15')];_0x297b55+=0x1){var _0x26b839=_0x555239[_0x297b55];var _0x598242=createTables(_[_0x1fac('0x3c')](_0x26b839));var _0x27659c;var _0x3db554=getPDFDocDefinition(_0x598242);var _0x538c44=getPDFPrinter();var _0x302416=_0x538c44['createPdfKitDocument'](_0x3db554);if(_0x45ea87){_0x27659c=path['join'](_0x1bed11,_0x4a980c,util[_0x1fac('0x1d')](_0x1fac('0x3d'),_0x4a980c,_0x297b55,_0x1fac('0x3e')));}else{_0x27659c=path[_0x1fac('0x3a')](_0x1bed11,util['format']('%s.%s',_0x4a980c,_0x1fac('0x3e')));}_0x136973[_0x1fac('0x18')](writePDFDocument(_0x302416,_0x27659c));}return Promise[_0x1fac('0x3f')](_0x136973);})['then'](function(){if(_0x45ea87){return new Promise(function(_0x8c207f){zipdir(path[_0x1fac('0x3a')](_0x1bed11,_0x4a980c),{'saveTo':path[_0x1fac('0x3a')](_0x1bed11,util['format'](_0x1fac('0x40'),_0x4a980c,_0x1fac('0x41')))},function(){rimraf(path['join'](_0x1bed11,_0x4a980c),function(){});_0x8c207f(_0x1fac('0x42'));});});}})[_0x1fac('0x2d')](function(){if(!_0x45ea87)return;rimraf(path[_0x1fac('0x3a')](_0x1bed11,_0x4a980c),function(){});})[_0x1fac('0x2d')](function(){logger[_0x1fac('0x43')](util[_0x1fac('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1fac('0x44')));return analyticExtractedReport(_0x1fac('0x45'),_0x45ea87?util[_0x1fac('0x1d')](_0x1fac('0x40'),_0x4a980c,_0x45ea87?'zip':_0x1fac('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1fac('0x43')](util[_0x1fac('0x1d')](_0x1fac('0x46'),EXTRACTED_REPORT_ID,_0x1fac('0x44')));return db['AnalyticExtractedReport'][_0x1fac('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1fac('0x2d')](function(_0x307e0e){EXTRACTED_REPORT=_0x307e0e;return dbH[_0x1fac('0x33')][_0x1fac('0x31')](util[_0x1fac('0x1d')](_0x1fac('0x48'),QUERY),{'type':dbH[_0x1fac('0x33')][_0x1fac('0x34')][_0x1fac('0x35')]});})[_0x1fac('0x2d')](extractReport)[_0x1fac('0x49')](function(_0x15ea05){logger[_0x1fac('0x43')](util[_0x1fac('0x1d')](_0x1fac('0x4a'),EXTRACTED_REPORT_ID,_0x1fac('0x44')),util[_0x1fac('0x4b')](_0x15ea05,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1fac('0x4c'));})[_0x1fac('0x4d')](function(){process[_0x1fac('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xb5c73c=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x1fac('0x4f'),'bolditalics':__dirname+_0x1fac('0x50')}});return _0xb5c73c;}function getPDFDocDefinitionFromHTML(_0x488df9,_0x33ae6c){var _0x178ccb=util['format']('%s\x20#%d',_0x33ae6c['channel'],_0x33ae6c[_0x1fac('0x51')]);var _0x3c5a60=moment()[_0x1fac('0x1d')](_0x1fac('0x52'))[_0x1fac('0x53')]();var _0x1633c7=htmlToPdfmake(_0x488df9,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1633c7],'defaultStyle':{'font':_0x1fac('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1fac('0x54'),'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':_0x1fac('0x54')}},'header':function(){return[{'text':_0x1fac('0x55'),'style':'header'}];},'footer':function(_0x4546b8,_0xb64822){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x178ccb,_0x4546b8,_0xb64822,_0x3c5a60),'style':_0x1fac('0x56')}];}};}function writePDFDocument(_0x57c73b,_0x3cd0a4){return new Promise(function(_0x12b06f,_0x36fad1){var _0x1b912e=_0x57c73b['pipe'](fs[_0x1fac('0x57')](_0x3cd0a4));_0x1b912e['on']('finish',function(){_0x12b06f(_0x1fac('0x58'));});_0x1b912e['on']('error',function(_0x47cf83){_0x36fad1(_0x47cf83);});_0x57c73b[_0x1fac('0x59')]();});}exports[_0x1fac('0x5a')]=function(_0x54519e,_0x4ec2a6){var _0x2b5c51=getPDFPrinter();var _0x170d64=getPDFDocDefinitionFromHTML(_0x54519e,_0x4ec2a6);var _0x110337=_0x2b5c51[_0x1fac('0x5b')](_0x170d64);return writePDFDocument(_0x110337,_0x4ec2a6['path'])[_0x1fac('0x49')](function(_0x3b93f6){throw _0x3b93f6;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 69f01c0..98f6e2d 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 _0xdb90=['json2xls','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','mkdirSync','each','then','join','%s.%s','xlsx','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','util','path'];(function(_0x433b0,_0x29a601){var _0x4bbc96=function(_0x19615e){while(--_0x19615e){_0x433b0['push'](_0x433b0['shift']());}};_0x4bbc96(++_0x29a601);}(_0xdb90,0xf8));var _0x0db9=function(_0x3c8c80,_0x4d47cc){_0x3c8c80=_0x3c8c80-0x0;var _0x479a99=_0xdb90[_0x3c8c80];return _0x479a99;};'use strict';var util=require(_0x0db9('0x0'));var path=require(_0x0db9('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x0db9('0x2'));var BPromise=require(_0x0db9('0x3'));var zipdir=require(_0x0db9('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x0db9('0x5'))['dbH'];var logger=require(_0x0db9('0x6'))(_0x0db9('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x0db9('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x0db9('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3ed6f3,_0x429d6b){var _0x1386ed={'status':_0x3ed6f3};var _0x4f973d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x429d6b){_0x1386ed[_0x0db9('0x9')]=_0x429d6b;}return db['AnalyticExtractedReport'][_0x0db9('0xa')](_0x1386ed,_0x4f973d);}function main(){var _0x5a1901=0x1388;var _0x3a7e35;logger[_0x0db9('0xb')](util[_0x0db9('0xc')](_0x0db9('0xd'),EXTRACTED_REPORT_ID,_0x0db9('0xe')));return db[_0x0db9('0xf')][_0x0db9('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0db9('0x11'),'splitSizeXlsx']})['then'](function(_0x1ae3a3){if(_0x1ae3a3){_0x3a7e35=_0x1ae3a3;_0x5a1901=_0x3a7e35[_0x0db9('0x12')]||0x1388;}})['then'](function(){return dbH[_0x0db9('0x13')][_0x0db9('0x14')](util[_0x0db9('0xc')](_0x0db9('0x15'),QUERY),{'type':dbH[_0x0db9('0x13')][_0x0db9('0x16')][_0x0db9('0x17')]});})['then'](function(_0x3ca00f){if(!_0x3ca00f[0x0][_0x0db9('0x18')]){return analyticExtractedReport(_0x0db9('0x19'));}var _0x193b09=[];var _0x5beddc=0x0;if(_0x3a7e35['split']){if(_0x3ca00f&&_0x3ca00f[_0x0db9('0x1a')]){var _0x2f946d=_[_0x0db9('0x1b')](_0x3ca00f[0x0][_0x0db9('0x18')]/_0x5a1901);var _0x3b2e75=Number['isInteger'](_0x3ca00f[0x0]['num']/_0x5a1901)?_0x3ca00f[0x0]['num']%_0x5a1901:0x0;_0x2f946d[_0x0db9('0x1c')](function(_0x47eb85){if(_0x47eb85>0x0){_0x5beddc+=_0x5a1901;}_0x193b09[_0x0db9('0x1d')](dbH[_0x0db9('0x13')][_0x0db9('0x14')](util[_0x0db9('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5a1901,_0x5beddc),{'type':dbH[_0x0db9('0x13')][_0x0db9('0x16')][_0x0db9('0x17')]}));});if(_0x3b2e75>0x0){_0x5beddc+=_0x5a1901;_0x193b09[_0x0db9('0x1d')](dbH[_0x0db9('0x13')][_0x0db9('0x14')](util[_0x0db9('0xc')](_0x0db9('0x1e'),QUERY,_0x3b2e75,_0x5beddc),{'type':dbH[_0x0db9('0x13')][_0x0db9('0x16')][_0x0db9('0x17')]}));}}}else{_0x193b09[_0x0db9('0x1d')](dbH[_0x0db9('0x13')]['query'](QUERY,{'type':dbH[_0x0db9('0x13')][_0x0db9('0x16')][_0x0db9('0x17')]}));}var _0x63680e=path[_0x0db9('0x1f')](PATH);var _0x2ad3e8=path[_0x0db9('0x20')](PATH,_0x0db9('0x21'));var _0x33c220=_0x3a7e35[_0x0db9('0x11')]&&_0x193b09['length']>0x1;var _0x216dd1=[];if(!fs[_0x0db9('0x22')](path['join'](_0x63680e,_0x2ad3e8))&&_0x33c220){fs[_0x0db9('0x23')](path['join'](_0x63680e,_0x2ad3e8));}return BPromise[_0x0db9('0x24')](_0x193b09,function(_0x2e3062){_0x216dd1[_0x0db9('0x1d')](_0x2e3062);})[_0x0db9('0x25')](function(){for(var _0x47b783=0x0;_0x47b783<_0x216dd1[_0x0db9('0x1a')];_0x47b783+=0x1){var _0xea5d3f;var _0x44b2dc=_0x216dd1[_0x47b783];if(_0x33c220){_0xea5d3f=path[_0x0db9('0x26')](_0x63680e,_0x2ad3e8,util[_0x0db9('0xc')]('%s%d.%s',_0x2ad3e8,_0x47b783,'xlsx'));}else{_0xea5d3f=path[_0x0db9('0x26')](_0x63680e,util[_0x0db9('0xc')](_0x0db9('0x27'),_0x2ad3e8,_0x0db9('0x28')));}fs[_0x0db9('0x29')](_0xea5d3f,json2xls(_0x44b2dc),'binary');}})[_0x0db9('0x25')](function(){if(_0x33c220){return new Promise(function(_0x15f78c){zipdir(path['join'](_0x63680e,_0x2ad3e8),{'saveTo':path[_0x0db9('0x26')](_0x63680e,util['format'](_0x0db9('0x27'),_0x2ad3e8,_0x0db9('0x2a')))},function(_0x5a7187,_0x1eef63){rimraf(path[_0x0db9('0x26')](_0x63680e,_0x2ad3e8),function(){});_0x15f78c(_0x0db9('0x2b'));});});}})['then'](function(){logger[_0x0db9('0xb')](util[_0x0db9('0xc')](_0x0db9('0x2c'),EXTRACTED_REPORT_ID,_0x0db9('0xe')));return analyticExtractedReport(_0x0db9('0x2d'),_0x33c220?util[_0x0db9('0xc')](_0x0db9('0x27'),_0x2ad3e8,_0x33c220?_0x0db9('0x2a'):_0x0db9('0x28')):null);});})[_0x0db9('0x2e')](function(_0x58eefe){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0db9('0xe')),util[_0x0db9('0x2f')](_0x58eefe,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0db9('0x30'));})[_0x0db9('0x31')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xc50c=['QueryTypes','SELECT','num','Empty','length','range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','join','mkdirSync','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x1a36b5,_0xd16a33){var _0x48fd2a=function(_0x53d5fe){while(--_0x53d5fe){_0x1a36b5['push'](_0x1a36b5['shift']());}};_0x48fd2a(++_0xd16a33);}(_0xc50c,0x11d));var _0xcc50=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xc50c[_0x12fc8d];return _0x3f9d04;};'use strict';var util=require(_0xcc50('0x0'));var path=require(_0xcc50('0x1'));var _=require(_0xcc50('0x2'));var fs=require('fs');var json2xls=require(_0xcc50('0x3'));var BPromise=require(_0xcc50('0x4'));var zipdir=require(_0xcc50('0x5'));var rimraf=require(_0xcc50('0x6'));var db=require(_0xcc50('0x7'))['db'];var dbH=require(_0xcc50('0x7'))[_0xcc50('0x8')];var logger=require(_0xcc50('0x9'))(_0xcc50('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xcc50('0xb')][0x3];var PATH=process[_0xcc50('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3fd3fb,_0x3175d1){var _0x42e947={'status':_0x3fd3fb};var _0x5a2c2d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3175d1){_0x42e947[_0xcc50('0xc')]=_0x3175d1;}return db[_0xcc50('0xd')][_0xcc50('0xe')](_0x42e947,_0x5a2c2d);}function main(){var _0xf35f35=0x1388;var _0x1af43a;logger[_0xcc50('0xf')](util['format'](_0xcc50('0x10'),EXTRACTED_REPORT_ID,_0xcc50('0x11')));return db[_0xcc50('0x12')][_0xcc50('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcc50('0x14'),_0xcc50('0x15')]})[_0xcc50('0x16')](function(_0x4697f9){if(_0x4697f9){_0x1af43a=_0x4697f9;_0xf35f35=_0x1af43a[_0xcc50('0x15')]||0x1388;}})[_0xcc50('0x16')](function(){return dbH[_0xcc50('0x17')][_0xcc50('0x18')](util[_0xcc50('0x19')](_0xcc50('0x1a'),QUERY),{'type':dbH['sequelize'][_0xcc50('0x1b')][_0xcc50('0x1c')]});})[_0xcc50('0x16')](function(_0x409ca3){if(!_0x409ca3[0x0][_0xcc50('0x1d')]){return analyticExtractedReport(_0xcc50('0x1e'));}var _0x542d16=[];var _0x2df03e=0x0;if(_0x1af43a[_0xcc50('0x14')]){if(_0x409ca3&&_0x409ca3[_0xcc50('0x1f')]){var _0x19f43a=_[_0xcc50('0x20')](_0x409ca3[0x0][_0xcc50('0x1d')]/_0xf35f35);var _0x58cc63=Number['isInteger'](_0x409ca3[0x0][_0xcc50('0x1d')]/_0xf35f35)?_0x409ca3[0x0][_0xcc50('0x1d')]%_0xf35f35:0x0;_0x19f43a[_0xcc50('0x21')](function(_0x4cb566){if(_0x4cb566>0x0){_0x2df03e+=_0xf35f35;}_0x542d16['push'](dbH[_0xcc50('0x17')][_0xcc50('0x18')](util['format'](_0xcc50('0x22'),QUERY,_0xf35f35,_0x2df03e),{'type':dbH[_0xcc50('0x17')][_0xcc50('0x1b')][_0xcc50('0x1c')]}));});if(_0x58cc63>0x0){_0x2df03e+=_0xf35f35;_0x542d16[_0xcc50('0x23')](dbH['sequelize'][_0xcc50('0x18')](util[_0xcc50('0x19')](_0xcc50('0x22'),QUERY,_0x58cc63,_0x2df03e),{'type':dbH['sequelize'][_0xcc50('0x1b')][_0xcc50('0x1c')]}));}}}else{_0x542d16['push'](dbH[_0xcc50('0x17')][_0xcc50('0x18')](QUERY,{'type':dbH[_0xcc50('0x17')][_0xcc50('0x1b')]['SELECT']}));}var _0x41f290=path[_0xcc50('0x24')](PATH);var _0x1e433c=path[_0xcc50('0x25')](PATH,_0xcc50('0x26'));var _0x58afe8=_0x1af43a[_0xcc50('0x14')]&&_0x542d16[_0xcc50('0x1f')]>0x1;var _0x40e731=[];if(!fs['existsSync'](path[_0xcc50('0x27')](_0x41f290,_0x1e433c))&&_0x58afe8){fs[_0xcc50('0x28')](path['join'](_0x41f290,_0x1e433c));}return BPromise['each'](_0x542d16,function(_0x2106c9){_0x40e731[_0xcc50('0x23')](_0x2106c9);})[_0xcc50('0x16')](function(){for(var _0x1f0ead=0x0;_0x1f0ead<_0x40e731[_0xcc50('0x1f')];_0x1f0ead+=0x1){var _0x517c4b;var _0x3e5593=_0x40e731[_0x1f0ead];if(_0x58afe8){_0x517c4b=path[_0xcc50('0x27')](_0x41f290,_0x1e433c,util[_0xcc50('0x19')](_0xcc50('0x29'),_0x1e433c,_0x1f0ead,_0xcc50('0x2a')));}else{_0x517c4b=path[_0xcc50('0x27')](_0x41f290,util[_0xcc50('0x19')](_0xcc50('0x2b'),_0x1e433c,_0xcc50('0x2a')));}fs[_0xcc50('0x2c')](_0x517c4b,json2xls(_0x3e5593),_0xcc50('0x2d'));}})['then'](function(){if(_0x58afe8){return new Promise(function(_0x3ffccb){zipdir(path[_0xcc50('0x27')](_0x41f290,_0x1e433c),{'saveTo':path['join'](_0x41f290,util[_0xcc50('0x19')](_0xcc50('0x2b'),_0x1e433c,_0xcc50('0x2e')))},function(_0x3d5c09,_0x409996){rimraf(path[_0xcc50('0x27')](_0x41f290,_0x1e433c),function(){});_0x3ffccb('zip\x20finished');});});}})['then'](function(){logger[_0xcc50('0xf')](util['format'](_0xcc50('0x2f'),EXTRACTED_REPORT_ID,_0xcc50('0x11')));return analyticExtractedReport(_0xcc50('0x30'),_0x58afe8?util[_0xcc50('0x19')](_0xcc50('0x2b'),_0x1e433c,_0x58afe8?_0xcc50('0x2e'):_0xcc50('0x2a')):null);});})[_0xcc50('0x31')](function(_0x218ff0){logger['info'](util[_0xcc50('0x19')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xcc50('0x11')),util[_0xcc50('0x32')](_0x218ff0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xcc50('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 7fa5f2b..ba0899c 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 _0x022d=['):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','intervals','hasOwnProperty','tag','CDR(tag)=','length','callerID','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','sortBy','catch','error','rewrite','lodash','util','Interval','findAll','models','VoiceExtension','IntervalId','then','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','queue','extensions','extension','find','push','type','Set','format','priority','VoiceExtensionId','inbound','CDR(routeid)=','context','outbound','CDR(destination)=','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x022d,0x191));var _0xd022=function(_0x59e199,_0xced8dc){_0x59e199=_0x59e199-0x0;var _0x53361c=_0x022d[_0x59e199];return _0x53361c;};'use strict';var _=require(_0xd022('0x0'));var util=require(_0xd022('0x1'));function rewrite(_0x4e1dd2,_0x20c0dc){var _0x504fe3=this;return _0x4e1dd2['models'][_0xd022('0x2')][_0xd022('0x3')]({'raw':!![]})['then'](function(_0x3dfec1){_0x504fe3['intervals']=_0x3dfec1;return _0x4e1dd2[_0xd022('0x4')][_0xd022('0x5')][_0xd022('0x3')]({'where':{'IntervalId':_0x20c0dc[_0xd022('0x6')]},'raw':!![]});})[_0xd022('0x7')](function(_0x3ab0ae){return _0x4e1dd2[_0xd022('0x4')][_0xd022('0x5')][_0xd022('0x3')]({'where':{'exten':{'$in':_[_0xd022('0x8')](_[_0xd022('0x9')](_0x3ab0ae,'exten'))}},'order':[{'raw':_0xd022('0xa')}],'raw':!![]});})[_0xd022('0x7')](function(_0x17241e){var _0x17de55=_[_0xd022('0xb')](_0x17241e,{'priority':'1'});var _0x153c19=_[_0xd022('0xb')](_0x17241e,{'isApp':0x1});var _0xee84e8=_['groupBy'](_0x153c19,_0xd022('0xc'));var _0x3f4051=[_0xd022('0xd'),'playback'];var _0x501ef4=[];var _0x1afaf1=[];for(var _0x52d4fe in _0xee84e8){if(_0xee84e8['hasOwnProperty'](_0x52d4fe)){_0x504fe3['priority']=0x2;_0x504fe3[_0xd022('0xe')]=[];_0x504fe3[_0xd022('0xf')]=_[_0xd022('0x10')](_0x17de55,{'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')]});_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':_0xd022('0x13'),'appdata':util[_0xd022('0x14')]('CDR(type)=%s',_0xee84e8[_0x52d4fe][0x0]['type']),'context':_0xee84e8[_0x52d4fe][0x0]['context'],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x504fe3[_0xd022('0x15')]++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});if(_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')]===_0xd022('0x17')){_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0]['type'],'app':_0xd022('0x13'),'appdata':_0xd022('0x18')+_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')],'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0]['exten'],'priority':_0x504fe3[_0xd022('0x15')]++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});}else if(_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')]===_0xd022('0x1a')){if(_0x504fe3['extension']){_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':_0xd022('0x13'),'appdata':_0xd022('0x1b')+(_0x504fe3[_0xd022('0xf')]['cutdigits']?_0xd022('0x1c')+_0x504fe3[_0xd022('0xf')]['cutdigits']+'}':'${EXTEN}'),'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x504fe3[_0xd022('0x15')]++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});}_0x504fe3['extensions']['push']({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':'Set','appdata':_0xd022('0x18')+_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')],'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0]['exten'],'priority':_0x504fe3[_0xd022('0x15')]++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});var _0x5ad0d3=_0x504fe3[_0xd022('0x15')]++;_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':_0xd022('0x1d'),'appdata':_0xd022('0x1e')+(_0x5ad0d3+0x2)+_0xd022('0x1f')+(_0x5ad0d3+0x1)+')','context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x5ad0d3,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});if(_0x504fe3[_0xd022('0xf')]){_0x504fe3['extensions'][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':'Set','appdata':_0x504fe3['extension'][_0xd022('0x20')]?_0xd022('0x21')+_0x504fe3[_0xd022('0xf')]['cutdigits']+'}':_0xd022('0x22'),'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x504fe3['priority']++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});}_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':_0xd022('0x13'),'appdata':'outboundrouteid='+_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')],'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x504fe3['priority']++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});if(_0x504fe3[_0xd022('0xf')]&&_0x504fe3['extension']['hasOwnProperty'](_0xd022('0x23'))&&_0x504fe3[_0xd022('0xf')]['recordingFormat']!==_0xd022('0x24')){_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':'Set','appdata':_0xd022('0x25'),'context':_0xee84e8[_0x52d4fe][0x0]['context'],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x504fe3[_0xd022('0x15')]++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});_0x504fe3[_0xd022('0xe')]['push']({'type':_0xee84e8[_0x52d4fe][0x0]['type'],'app':'Set','appdata':_0xd022('0x26')+_0x504fe3[_0xd022('0xf')][_0xd022('0x23')]||_0xd022('0x27'),'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0]['exten'],'priority':_0x504fe3['priority']++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0]['VoiceExtensionId']});}}_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':_0xd022('0x13'),'appdata':_0xd022('0x28'),'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0]['exten'],'priority':_0x504fe3[_0xd022('0x15')]++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xee84e8[_0x52d4fe][0x0]['context'],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x504fe3['priority']++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0]['VoiceExtensionId']});_0x504fe3[_0xd022('0xe')][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':_0xd022('0x13'),'appdata':_0xd022('0x29'),'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'priority':_0x504fe3[_0xd022('0x15')]++,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0]['VoiceExtensionId']});for(var _0x3d4106=0x0,_0x595852=0x0;_0x3d4106<_0xee84e8[_0x52d4fe]['length'];_0x3d4106+=0x1,_0x595852=0x0){var _0x8c0698=_0xee84e8[_0x52d4fe][_0x3d4106];if(_0x8c0698['type']){_0x8c0698[_0xd022('0x12')]=_0x8c0698[_0xd022('0x12')][_0xd022('0x2a')]();}var _0x31849c=[];var _0x382c13=[];delete _0x8c0698['id'];delete _0x8c0698[_0xd022('0x2b')];delete _0x8c0698[_0xd022('0x2c')];var _0x4d0bcf=_0x8c0698['interval']!=='*,*,*,*'?[_0x8c0698[_0xd022('0x2d')]]:_0x8c0698[_0xd022('0x6')]?_['map'](_[_0xd022('0xb')](_0x504fe3[_0xd022('0x2e')],{'IntervalId':_0x8c0698[_0xd022('0x6')]}),_0xd022('0x2d')):[];if(_0x8c0698[_0xd022('0x2f')](_0xd022('0x30'))){if(_0x8c0698[_0xd022('0x30')]&&_0x8c0698[_0xd022('0x30')]!=='--'){_0x31849c['push']({'type':_0x8c0698[_0xd022('0x12')],'app':_0xd022('0x13'),'appdata':_0xd022('0x31')+_0x8c0698['tag'],'context':_0x8c0698[_0xd022('0x19')],'exten':_0x8c0698[_0xd022('0xc')],'priority':_0x4d0bcf[_0xd022('0x32')]+_0x504fe3['priority']+_0x595852++,'VoiceExtensionId':_0x8c0698[_0xd022('0x16')]});}}if(_0x8c0698[_0xd022('0x12')]===_0xd022('0x1a')&&_0x8c0698['hasOwnProperty']('callerID')){if(_0x8c0698[_0xd022('0x33')]){_0x31849c[_0xd022('0x11')]({'type':_0x8c0698[_0xd022('0x12')],'app':_0xd022('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x8c0698[_0xd022('0x33')]+')','context':_0x8c0698[_0xd022('0x19')],'exten':_0x8c0698[_0xd022('0xc')],'priority':_0x4d0bcf[_0xd022('0x32')]+_0x504fe3[_0xd022('0x15')]+_0x595852++,'VoiceExtensionId':_0x8c0698[_0xd022('0x16')]});}else{_0x31849c[_0xd022('0x11')]({'type':_0x8c0698['type'],'app':_0xd022('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x8c0698[_0xd022('0x19')],'exten':_0x8c0698[_0xd022('0xc')],'priority':_0x4d0bcf[_0xd022('0x32')]+_0x504fe3['priority']+_0x595852++,'VoiceExtensionId':_0x8c0698[_0xd022('0x16')]});}}if(_0x8c0698[_0xd022('0x2f')]('answer')){if(_0x3f4051[_0xd022('0x34')](_0x8c0698[_0xd022('0x35')][_0xd022('0x2a')]())>=0x0&&_0x8c0698[_0xd022('0x36')]!==_0xd022('0x37')){if(_0x8c0698[_0xd022('0x38')]){_0x31849c[_0xd022('0x11')]({'type':_0x8c0698[_0xd022('0x12')],'app':_0xd022('0x1d'),'appdata':_0xd022('0x39'),'context':_0x8c0698[_0xd022('0x19')],'exten':_0x8c0698['exten'],'priority':_0x4d0bcf[_0xd022('0x32')]+_0x504fe3[_0xd022('0x15')]+_0x595852++,'VoiceExtensionId':_0x8c0698[_0xd022('0x16')]});_0x31849c['push']({'type':_0x8c0698[_0xd022('0x12')],'app':'Set','appdata':_0xd022('0x3a'),'context':_0x8c0698['context'],'exten':_0x8c0698[_0xd022('0xc')],'priority':_0x4d0bcf[_0xd022('0x32')]+_0x504fe3[_0xd022('0x15')]+_0x595852++,'VoiceExtensionId':_0x8c0698[_0xd022('0x16')]});}else{_0x31849c[_0xd022('0x11')]({'type':_0x8c0698['type'],'app':'ExecIf','appdata':_0xd022('0x3b'),'context':_0x8c0698[_0xd022('0x19')],'exten':_0x8c0698[_0xd022('0xc')],'priority':_0x4d0bcf['length']+_0x504fe3[_0xd022('0x15')]+_0x595852++,'VoiceExtensionId':_0x8c0698[_0xd022('0x16')]});_0x31849c[_0xd022('0x11')]({'type':_0x8c0698[_0xd022('0x12')],'app':_0xd022('0x13'),'appdata':_0xd022('0x3c'),'context':_0x8c0698[_0xd022('0x19')],'exten':_0x8c0698[_0xd022('0xc')],'priority':_0x4d0bcf[_0xd022('0x32')]+_0x504fe3[_0xd022('0x15')]+_0x595852++,'VoiceExtensionId':_0x8c0698[_0xd022('0x16')]});}}}for(var _0x3817a9=0x0;_0x3817a9<_0x4d0bcf[_0xd022('0x32')];_0x3817a9+=0x1){var _0x23b6ab=_0x504fe3[_0xd022('0x15')]+_0x4d0bcf[_0xd022('0x32')];var _0x5ed973=_0x3817a9===_0x4d0bcf[_0xd022('0x32')]-0x1?_0x504fe3['priority']+_0x31849c[_0xd022('0x32')]+_0x382c13[_0xd022('0x32')]+0x2:_0x504fe3['priority']+_0x3817a9+0x1;_0x31849c[_0xd022('0x3d')](_0x3817a9,0x0,{'type':_0x8c0698['type'],'app':_0xd022('0x3e'),'appdata':_0x4d0bcf[_0x3817a9]+'?'+_0x8c0698[_0xd022('0x19')]+_0xd022('0x3f')+_0x23b6ab+':'+_0x8c0698['context']+',${EXTEN},'+_0x5ed973,'exten':_0x8c0698[_0xd022('0xc')],'context':_0x8c0698['context'],'priority':_0x504fe3[_0xd022('0x15')]+_0x3817a9,'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});}_0x8c0698[_0xd022('0x15')]=_0x31849c[_0xd022('0x32')]?_[_0xd022('0x40')](_0x31849c)[_0xd022('0x15')]+0x1:_0x504fe3[_0xd022('0x15')];_0x504fe3['priority']=(_0x382c13[_0xd022('0x32')]?_[_0xd022('0x40')](_0x382c13)[_0xd022('0x15')]:_0x8c0698[_0xd022('0x15')])+0x1;_0x504fe3[_0xd022('0xe')]=_[_0xd022('0x41')](_0x504fe3[_0xd022('0xe')],_0x31849c,[_0x8c0698],_0x382c13);}_0x504fe3['extensions'][_0xd022('0x11')]({'type':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x12')],'app':'Hangup','exten':_0xee84e8[_0x52d4fe][0x0][_0xd022('0xc')],'context':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x19')],'priority':_0x504fe3['priority'],'VoiceExtensionId':_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]});_0x501ef4['push'](_0xee84e8[_0x52d4fe][0x0][_0xd022('0x16')]);_0x1afaf1=_[_0xd022('0x41')](_0x1afaf1,_0x504fe3[_0xd022('0xe')]);}}return _0x4e1dd2[_0xd022('0x42')](function(_0xcc6094){return _0x4e1dd2[_0xd022('0x4')][_0xd022('0x5')][_0xd022('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x501ef4}},'transaction':_0xcc6094})[_0xd022('0x7')](function(_0x2c7a45){return _0x4e1dd2[_0xd022('0x4')][_0xd022('0x5')]['bulkCreate'](_[_0xd022('0x44')](_0x1afaf1,'priority'),{'transaction':_0xcc6094});});});})[_0xd022('0x45')](function(_0x35238a){console[_0xd022('0x46')](_0x35238a);});}exports[_0xd022('0x47')]=rewrite; \ No newline at end of file +var _0xf910=['last','Hangup','concat','transaction','VoiceExtension','destroy','sortBy','error','util','findAll','models','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','hasOwnProperty','find','extensions','push','type','format','context','priority','Set','CDR(routeid)=','VoiceExtensionId','outbound','cutdigits','${EXTEN:','ExecIf','):Goto(','extension','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},'];(function(_0x577160,_0x5e857b){var _0x5558fc=function(_0x395a8d){while(--_0x395a8d){_0x577160['push'](_0x577160['shift']());}};_0x5558fc(++_0x5e857b);}(_0xf910,0x114));var _0x0f91=function(_0x188e1e,_0x274da7){_0x188e1e=_0x188e1e-0x0;var _0x3c67e1=_0xf910[_0x188e1e];return _0x3c67e1;};'use strict';var _=require('lodash');var util=require(_0x0f91('0x0'));function rewrite(_0x4c0c5f,_0x59c323){var _0x4873dd=this;return _0x4c0c5f['models']['Interval'][_0x0f91('0x1')]({'raw':!![]})['then'](function(_0x4a6338){_0x4873dd['intervals']=_0x4a6338;return _0x4c0c5f[_0x0f91('0x2')]['VoiceExtension'][_0x0f91('0x1')]({'where':{'IntervalId':_0x59c323[_0x0f91('0x3')]},'raw':!![]});})[_0x0f91('0x4')](function(_0x1320b1){return _0x4c0c5f[_0x0f91('0x2')]['VoiceExtension'][_0x0f91('0x1')]({'where':{'exten':{'$in':_[_0x0f91('0x5')](_[_0x0f91('0x6')](_0x1320b1,_0x0f91('0x7')))}},'order':[{'raw':_0x0f91('0x8')}],'raw':!![]});})['then'](function(_0x100e53){var _0x7edeab=_[_0x0f91('0x9')](_0x100e53,{'priority':'1'});var _0x3ad86b=_[_0x0f91('0x9')](_0x100e53,{'isApp':0x1});var _0x134183=_['groupBy'](_0x3ad86b,_0x0f91('0x7'));var _0x3b086f=['queue',_0x0f91('0xa')];var _0x3ce059=[];var _0x5bf0e7=[];for(var _0x40f6e4 in _0x134183){if(_0x134183[_0x0f91('0xb')](_0x40f6e4)){_0x4873dd['priority']=0x2;_0x4873dd['extensions']=[];_0x4873dd['extension']=_[_0x0f91('0xc')](_0x7edeab,{'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')]});_0x4873dd[_0x0f91('0xd')][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':'Set','appdata':util[_0x0f91('0x10')]('CDR(type)=%s',_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')]),'context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd[_0x0f91('0x12')]++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0]['VoiceExtensionId']});if(_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')]==='inbound'){_0x4873dd[_0x0f91('0xd')]['push']({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':_0x0f91('0x14')+_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')],'context':_0x134183[_0x40f6e4][0x0]['context'],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd['priority']++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});}else if(_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')]===_0x0f91('0x16')){if(_0x4873dd['extension']){_0x4873dd[_0x0f91('0xd')][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':'CDR(destination)='+(_0x4873dd['extension'][_0x0f91('0x17')]?_0x0f91('0x18')+_0x4873dd['extension'][_0x0f91('0x17')]+'}':'${EXTEN}'),'context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd[_0x0f91('0x12')]++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});}_0x4873dd[_0x0f91('0xd')][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':_0x0f91('0x14')+_0x134183[_0x40f6e4][0x0]['VoiceExtensionId'],'context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd[_0x0f91('0x12')]++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});var _0x20b17e=_0x4873dd[_0x0f91('0x12')]++;_0x4873dd[_0x0f91('0xd')][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x19'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x20b17e+0x2)+_0x0f91('0x1a')+(_0x20b17e+0x1)+')','context':_0x134183[_0x40f6e4][0x0]['context'],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x20b17e,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});if(_0x4873dd[_0x0f91('0x1b')]){_0x4873dd[_0x0f91('0xd')][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':_0x4873dd['extension'][_0x0f91('0x17')]?_0x0f91('0x1c')+_0x4873dd[_0x0f91('0x1b')]['cutdigits']+'}':_0x0f91('0x1d'),'context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd['priority']++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});}_0x4873dd[_0x0f91('0xd')][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0]['type'],'app':_0x0f91('0x13'),'appdata':_0x0f91('0x1e')+_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')],'context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0]['exten'],'priority':_0x4873dd['priority']++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});if(_0x4873dd['extension']&&_0x4873dd[_0x0f91('0x1b')][_0x0f91('0xb')](_0x0f91('0x1f'))&&_0x4873dd[_0x0f91('0x1b')][_0x0f91('0x1f')]!==_0x0f91('0x20')){_0x4873dd['extensions'][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':_0x0f91('0x21'),'context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd[_0x0f91('0x12')]++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});_0x4873dd['extensions']['push']({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':_0x0f91('0x22')+_0x4873dd[_0x0f91('0x1b')][_0x0f91('0x1f')]||'wav','context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd['priority']++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});}}_0x4873dd[_0x0f91('0xd')]['push']({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':'Set','appdata':_0x0f91('0x23'),'context':_0x134183[_0x40f6e4][0x0]['context'],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd[_0x0f91('0x12')]++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0]['VoiceExtensionId']});_0x4873dd[_0x0f91('0xd')][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':_0x0f91('0x24'),'context':_0x134183[_0x40f6e4][0x0]['context'],'exten':_0x134183[_0x40f6e4][0x0]['exten'],'priority':_0x4873dd['priority']++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});_0x4873dd['extensions'][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'priority':_0x4873dd['priority']++,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0]['VoiceExtensionId']});for(var _0x163088=0x0,_0x38bc89=0x0;_0x163088<_0x134183[_0x40f6e4]['length'];_0x163088+=0x1,_0x38bc89=0x0){var _0x3d209c=_0x134183[_0x40f6e4][_0x163088];if(_0x3d209c[_0x0f91('0xf')]){_0x3d209c[_0x0f91('0xf')]=_0x3d209c[_0x0f91('0xf')][_0x0f91('0x25')]();}var _0x1ea43c=[];var _0xf4a659=[];delete _0x3d209c['id'];delete _0x3d209c[_0x0f91('0x26')];delete _0x3d209c[_0x0f91('0x27')];var _0x3edc87=_0x3d209c['interval']!==_0x0f91('0x28')?[_0x3d209c['interval']]:_0x3d209c['IntervalId']?_[_0x0f91('0x6')](_[_0x0f91('0x9')](_0x4873dd['intervals'],{'IntervalId':_0x3d209c['IntervalId']}),_0x0f91('0x29')):[];if(_0x3d209c[_0x0f91('0xb')](_0x0f91('0x2a'))){if(_0x3d209c[_0x0f91('0x2a')]&&_0x3d209c[_0x0f91('0x2a')]!=='--'){_0x1ea43c[_0x0f91('0xe')]({'type':_0x3d209c[_0x0f91('0xf')],'app':'Set','appdata':_0x0f91('0x2b')+_0x3d209c[_0x0f91('0x2a')],'context':_0x3d209c[_0x0f91('0x11')],'exten':_0x3d209c[_0x0f91('0x7')],'priority':_0x3edc87[_0x0f91('0x2c')]+_0x4873dd[_0x0f91('0x12')]+_0x38bc89++,'VoiceExtensionId':_0x3d209c[_0x0f91('0x15')]});}}if(_0x3d209c[_0x0f91('0xf')]===_0x0f91('0x16')&&_0x3d209c['hasOwnProperty']('callerID')){if(_0x3d209c[_0x0f91('0x2d')]){_0x1ea43c['push']({'type':_0x3d209c[_0x0f91('0xf')],'app':'ExecIf','appdata':_0x0f91('0x2e')+_0x3d209c[_0x0f91('0x2d')]+')','context':_0x3d209c[_0x0f91('0x11')],'exten':_0x3d209c[_0x0f91('0x7')],'priority':_0x3edc87[_0x0f91('0x2c')]+_0x4873dd[_0x0f91('0x12')]+_0x38bc89++,'VoiceExtensionId':_0x3d209c[_0x0f91('0x15')]});}else{_0x1ea43c[_0x0f91('0xe')]({'type':_0x3d209c[_0x0f91('0xf')],'app':_0x0f91('0x19'),'appdata':_0x0f91('0x2f'),'context':_0x3d209c[_0x0f91('0x11')],'exten':_0x3d209c[_0x0f91('0x7')],'priority':_0x3edc87[_0x0f91('0x2c')]+_0x4873dd['priority']+_0x38bc89++,'VoiceExtensionId':_0x3d209c[_0x0f91('0x15')]});}}if(_0x3d209c[_0x0f91('0xb')](_0x0f91('0x30'))){if(_0x3b086f[_0x0f91('0x31')](_0x3d209c[_0x0f91('0x32')][_0x0f91('0x25')]())>=0x0&&_0x3d209c[_0x0f91('0x33')]!==_0x0f91('0x34')){if(_0x3d209c['answer']){_0x1ea43c[_0x0f91('0xe')]({'type':_0x3d209c['type'],'app':_0x0f91('0x19'),'appdata':_0x0f91('0x35'),'context':_0x3d209c[_0x0f91('0x11')],'exten':_0x3d209c[_0x0f91('0x7')],'priority':_0x3edc87[_0x0f91('0x2c')]+_0x4873dd['priority']+_0x38bc89++,'VoiceExtensionId':_0x3d209c[_0x0f91('0x15')]});_0x1ea43c['push']({'type':_0x3d209c[_0x0f91('0xf')],'app':'Set','appdata':_0x0f91('0x36'),'context':_0x3d209c[_0x0f91('0x11')],'exten':_0x3d209c['exten'],'priority':_0x3edc87[_0x0f91('0x2c')]+_0x4873dd[_0x0f91('0x12')]+_0x38bc89++,'VoiceExtensionId':_0x3d209c['VoiceExtensionId']});}else{_0x1ea43c['push']({'type':_0x3d209c[_0x0f91('0xf')],'app':'ExecIf','appdata':_0x0f91('0x37'),'context':_0x3d209c['context'],'exten':_0x3d209c['exten'],'priority':_0x3edc87['length']+_0x4873dd[_0x0f91('0x12')]+_0x38bc89++,'VoiceExtensionId':_0x3d209c[_0x0f91('0x15')]});_0x1ea43c[_0x0f91('0xe')]({'type':_0x3d209c[_0x0f91('0xf')],'app':_0x0f91('0x13'),'appdata':_0x0f91('0x38'),'context':_0x3d209c[_0x0f91('0x11')],'exten':_0x3d209c['exten'],'priority':_0x3edc87[_0x0f91('0x2c')]+_0x4873dd[_0x0f91('0x12')]+_0x38bc89++,'VoiceExtensionId':_0x3d209c[_0x0f91('0x15')]});}}}for(var _0x543c41=0x0;_0x543c41<_0x3edc87[_0x0f91('0x2c')];_0x543c41+=0x1){var _0x2bd546=_0x4873dd[_0x0f91('0x12')]+_0x3edc87[_0x0f91('0x2c')];var _0x6f1dec=_0x543c41===_0x3edc87[_0x0f91('0x2c')]-0x1?_0x4873dd['priority']+_0x1ea43c[_0x0f91('0x2c')]+_0xf4a659[_0x0f91('0x2c')]+0x2:_0x4873dd['priority']+_0x543c41+0x1;_0x1ea43c[_0x0f91('0x39')](_0x543c41,0x0,{'type':_0x3d209c[_0x0f91('0xf')],'app':'GotoIfTime','appdata':_0x3edc87[_0x543c41]+'?'+_0x3d209c['context']+_0x0f91('0x3a')+_0x2bd546+':'+_0x3d209c[_0x0f91('0x11')]+_0x0f91('0x3a')+_0x6f1dec,'exten':_0x3d209c[_0x0f91('0x7')],'context':_0x3d209c[_0x0f91('0x11')],'priority':_0x4873dd[_0x0f91('0x12')]+_0x543c41,'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});}_0x3d209c['priority']=_0x1ea43c[_0x0f91('0x2c')]?_[_0x0f91('0x3b')](_0x1ea43c)[_0x0f91('0x12')]+0x1:_0x4873dd[_0x0f91('0x12')];_0x4873dd[_0x0f91('0x12')]=(_0xf4a659[_0x0f91('0x2c')]?_['last'](_0xf4a659)[_0x0f91('0x12')]:_0x3d209c[_0x0f91('0x12')])+0x1;_0x4873dd[_0x0f91('0xd')]=_['concat'](_0x4873dd['extensions'],_0x1ea43c,[_0x3d209c],_0xf4a659);}_0x4873dd['extensions'][_0x0f91('0xe')]({'type':_0x134183[_0x40f6e4][0x0][_0x0f91('0xf')],'app':_0x0f91('0x3c'),'exten':_0x134183[_0x40f6e4][0x0][_0x0f91('0x7')],'context':_0x134183[_0x40f6e4][0x0][_0x0f91('0x11')],'priority':_0x4873dd[_0x0f91('0x12')],'VoiceExtensionId':_0x134183[_0x40f6e4][0x0][_0x0f91('0x15')]});_0x3ce059[_0x0f91('0xe')](_0x134183[_0x40f6e4][0x0]['VoiceExtensionId']);_0x5bf0e7=_[_0x0f91('0x3d')](_0x5bf0e7,_0x4873dd[_0x0f91('0xd')]);}}return _0x4c0c5f[_0x0f91('0x3e')](function(_0x4d9c2b){return _0x4c0c5f[_0x0f91('0x2')][_0x0f91('0x3f')][_0x0f91('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x3ce059}},'transaction':_0x4d9c2b})[_0x0f91('0x4')](function(_0x4c7ed1){return _0x4c0c5f[_0x0f91('0x2')][_0x0f91('0x3f')]['bulkCreate'](_[_0x0f91('0x41')](_0x5bf0e7,_0x0f91('0x12')),{'transaction':_0x4d9c2b});});});})['catch'](function(_0x144e16){console[_0x0f91('0x42')](_0x144e16);});}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 13751be..1925aff 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 _0xc65c=['Error\x20while\x20creating\x20contact:\x20','checkHopper','inspect','insert','cm_hopper','scheduledAt','createdAt','updatedAt','select','field','NOW()','ContactId','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','from','\x20=\x20?','into','ListId\x20=\x20?','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','fromQuery','VoiceQueue','findAll','outbound','Lists','get','dialCheckDuplicateType','push','sequelize','VoiceQueueId','query','CmList','BlackLists','all','always','CampaignId','cmContact,\x20%s,\x20%s','finally','contact:csv_','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','stringify','bluebird','util','lodash','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','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!','error','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','CmContact','create','keys','then','pick','catch'];(function(_0x477243,_0x11bcb7){var _0xd13863=function(_0x19c56f){while(--_0x19c56f){_0x477243['push'](_0x477243['shift']());}};_0xd13863(++_0x11bcb7);}(_0xc65c,0x17c));var _0xcc65=function(_0x51bf25,_0x515b49){_0x51bf25=_0x51bf25-0x0;var _0x20ecca=_0xc65c[_0x51bf25];return _0x20ecca;};'use strict';var BPromise=require(_0xcc65('0x0'));var util=require(_0xcc65('0x1'));var _=require(_0xcc65('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xcc65('0x3'));var Redis=require(_0xcc65('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xcc65('0x5'));var logger=require(_0xcc65('0x6'))(_0xcc65('0x7'));config[_0xcc65('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcc65('0x9'))(new Redis(config['redis']));require(_0xcc65('0xa'))[_0xcc65('0xb')](socket);try{if(!process[_0xcc65('0xc')][0x2]||process[_0xcc65('0xc')][0x2]===_0xcc65('0xd')||process[_0xcc65('0xc')][0x2]===_0xcc65('0xe')){throw new Error(_0xcc65('0xf'));}var FILEPATH=process['argv'][0x2];if(!process[_0xcc65('0xc')][0x3]||process[_0xcc65('0xc')][0x3]===_0xcc65('0xd')||process[_0xcc65('0xc')][0x3]===_0xcc65('0xe')||!process[_0xcc65('0xc')][0x4]||process[_0xcc65('0xc')][0x4]===_0xcc65('0xd')||process['argv'][0x4]===_0xcc65('0xe')){throw new Error(_0xcc65('0x10'));}var FIELDS=_[_0xcc65('0x11')](process[_0xcc65('0xc')][0x3][_0xcc65('0x12')](','),process[_0xcc65('0xc')][0x4][_0xcc65('0x12')](','));if(!process['argv'][0x5]||process[_0xcc65('0xc')][0x5]===_0xcc65('0xd')||process['argv'][0x5]==='null'){throw new Error(_0xcc65('0x13'));}var LISTID=process[_0xcc65('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xcc65('0xc')][0x6]!=='undefined'&&process['argv'][0x6]!==_0xcc65('0xe')?process[_0xcc65('0xc')][0x6]:null;var DUPLICATES=process[_0xcc65('0xc')][0x7]&&process[_0xcc65('0xc')][0x7]!=='undefined'&&process['argv'][0x7]!==_0xcc65('0xe')?process[_0xcc65('0xc')][0x7]:null;if(!process['argv'][0x8]||process[_0xcc65('0xc')][0x8]===_0xcc65('0xd')||process[_0xcc65('0xc')][0x8]==='null'){throw new Error(_0xcc65('0x14'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x94ff7e){logger[_0xcc65('0x15')](_0x94ff7e);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(_0x3d9159,_0x504fb3,_0x23d088,_0x8c8479){var _0x137487={'message':_0x504fb3};_0x137487[_0x3d9159]=!![];if(_0x23d088){_0x137487['contact']=_0x23d088;}if(_0x8c8479){_0x137487[_0xcc65('0x16')]=_0x8c8479;}return _0x137487;}function isEmail(_0x59b116){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))*$/[_0xcc65('0x17')](_0x59b116);}function checkRow(_0x10e404,_0x2fb73f,_0x4f8ac6){return new BPromise(function(_0x285e5d,_0x299c19){if(_['isNil'](_0x10e404)){return _0x299c19(handleCheckRowError('error',_0xcc65('0x18'),null,_0x4f8ac6));}if(_0x10e404[_0xcc65('0x19')]&&_0x10e404[_0xcc65('0x19')][_0xcc65('0x1a')]){var _0x3dfc86=_[_0xcc65('0x1b')](_0x10e404[_0xcc65('0x19')],_0xcc65('0x1c'))['join'](';');return _0x299c19(handleCheckRowError('error',_0x3dfc86,null,_0x4f8ac6));}var _0x3f10ff={};for(var _0x5c9ac5 in FIELDS){if(FIELDS[_0xcc65('0x1d')](_0x5c9ac5)&&FIELDS[_0x5c9ac5]){_0x3f10ff[_0x5c9ac5]=_0x10e404[_0xcc65('0x1e')][0x0][FIELDS[_0x5c9ac5]]||_0x10e404[_0xcc65('0x1e')][0x0]['\ufeff'+FIELDS[_0x5c9ac5]];}}if(!_0x3f10ff[_0xcc65('0x1f')]){return _0x299c19(handleCheckRowError(_0xcc65('0x15'),'firstName\x20not\x20specified!',null,_0x4f8ac6));}if(!_0x3f10ff[_0xcc65('0x20')]){return _0x299c19(handleCheckRowError(_0xcc65('0x15'),'phone\x20not\x20specified!',null,_0x4f8ac6));}if(_0x3f10ff[_0xcc65('0x21')]){var _0x8547ea=moment(_0x3f10ff[_0xcc65('0x21')],_0xcc65('0x22'));if(!_0x8547ea[_0xcc65('0x23')]()){return _0x299c19(handleCheckRowError(_0xcc65('0x15'),_0xcc65('0x24'),null,_0x4f8ac6));}}if(_0x3f10ff['email']){if(!isEmail(_0x3f10ff[_0xcc65('0x25')])){return _0x299c19(handleCheckRowError(_0xcc65('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x4f8ac6));}}_0x3f10ff[_0xcc65('0x26')]=LISTID;_0x3f10ff[_0xcc65('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xcc65('0x1a')]&&_0x2fb73f){var _0x24e90b={};for(var _0x51eeec=0x0,_0x2f2a41=DUPLICATES[_0xcc65('0x1a')];_0x51eeec<_0x2f2a41;_0x51eeec+=0x1){_0x24e90b[DUPLICATES[_0x51eeec]]=_0x3f10ff[DUPLICATES[_0x51eeec]];}var _0x23aa00=_[_0xcc65('0x28')](_0x2fb73f,_0x24e90b);if(_0x23aa00){return _0x299c19(handleCheckRowError(_0xcc65('0x29'),'Duplicate\x20Contact',_0x23aa00,_0x4f8ac6));}}return db[_0xcc65('0x2a')][_0xcc65('0x2b')](_0x3f10ff,{'raw':!![],'hooks':![],'fields':_[_0xcc65('0x2c')](_0x3f10ff)})[_0xcc65('0x2d')](function(_0x42aba5){if(DUPLICATES&&DUPLICATES[_0xcc65('0x1a')]&&_0x2fb73f){_0x2fb73f['push'](_[_0xcc65('0x2e')](_0x3f10ff,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x42aba5['id'];return _0x285e5d();})[_0xcc65('0x2f')](function(_0x2d3904){return _0x299c19(handleCheckRowError('error',_0xcc65('0x30')+(_0x2d3904[_0xcc65('0x1c')]||JSON['stringify'](_0x2d3904)),null,_0x4f8ac6));});});}function checkHopper(){function _0x459f58(){return function(_0xfd15e){logger[_0xcc65('0x15')]('cmContact',_0xcc65('0x31'),util[_0xcc65('0x32')](_0xfd15e,{'showHidden':![],'depth':null}));};}var _0xbedf8b=function(_0xf08aa,_0x5cbbd6){var _0x3182cf=squel[_0xcc65('0x33')]()['into'](_0xcc65('0x34'))['fromQuery']([_0xcc65('0x20'),_0xcc65('0x35'),'ContactId',_0xcc65('0x26'),_0x5cbbd6,_0xcc65('0x36'),_0xcc65('0x37')],squel[_0xcc65('0x38')]()[_0xcc65('0x39')](_0xcc65('0x20'),_0xcc65('0x20'))[_0xcc65('0x39')](_0xcc65('0x3a'),_0xcc65('0x35'))['field']('id',_0xcc65('0x3b'))[_0xcc65('0x39')](LISTID[_0xcc65('0x3c')](),_0xcc65('0x26'))[_0xcc65('0x39')](_0xf08aa['id']['toString'](),_0x5cbbd6)[_0xcc65('0x39')](_0xcc65('0x3a'),'createdAt')[_0xcc65('0x39')]('NOW()',_0xcc65('0x37'))['from'](_0xcc65('0x3d'))[_0xcc65('0x3e')](_0xcc65('0x3f'))[_0xcc65('0x3e')]('ListId\x20=\x20?',LISTID[_0xcc65('0x3c')]())[_0xcc65('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xcc65('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xcc65('0x39')](_0xcc65('0x20'))[_0xcc65('0x40')](_0xcc65('0x34'))[_0xcc65('0x3e')](_0x5cbbd6+_0xcc65('0x41'),_0xf08aa['id'][_0xcc65('0x3c')]())))['toString']();return _0x3182cf;};var _0x3b21a9=function(_0x4626cb,_0x41976d){var _0x300302=squel['insert']()[_0xcc65('0x42')](_0xcc65('0x34'))['fromQuery']([_0xcc65('0x20'),_0xcc65('0x35'),_0xcc65('0x3b'),_0xcc65('0x26'),_0x41976d,_0xcc65('0x36'),_0xcc65('0x37')],squel['select']()[_0xcc65('0x39')](_0xcc65('0x20'),_0xcc65('0x20'))[_0xcc65('0x39')](_0xcc65('0x3a'),_0xcc65('0x35'))[_0xcc65('0x39')]('id',_0xcc65('0x3b'))[_0xcc65('0x39')](LISTID[_0xcc65('0x3c')](),_0xcc65('0x26'))[_0xcc65('0x39')](_0x4626cb['id'][_0xcc65('0x3c')](),_0x41976d)[_0xcc65('0x39')]('NOW()',_0xcc65('0x36'))[_0xcc65('0x39')](_0xcc65('0x3a'),_0xcc65('0x37'))[_0xcc65('0x40')]('cm_contacts')['where'](_0xcc65('0x3f'))['where'](_0xcc65('0x43'),LISTID['toString']())[_0xcc65('0x3e')]('id\x20IN\x20?',squel[_0xcc65('0x44')](hopperContacts))['where'](_0xcc65('0x45'))[_0xcc65('0x3e')](_0xcc65('0x46'),squel[_0xcc65('0x38')]()[_0xcc65('0x39')](_0xcc65('0x47'))['from'](_0xcc65('0x48'))[_0xcc65('0x3e')](_0x41976d+'\x20=\x20?',_0x4626cb['id'][_0xcc65('0x3c')]()))[_0xcc65('0x3e')](_0xcc65('0x46'),squel[_0xcc65('0x38')]()[_0xcc65('0x39')](_0xcc65('0x20'))[_0xcc65('0x40')](_0xcc65('0x34'))[_0xcc65('0x3e')](_0x41976d+_0xcc65('0x41'),_0x4626cb['id']['toString']())))[_0xcc65('0x3c')]();return _0x300302;};function _0x40a0a2(_0x241f49,_0x2aaa7f){var _0x422b91=squel[_0xcc65('0x33')]()['into']('cm_hopper')['fromQuery'](['phone',_0xcc65('0x35'),_0xcc65('0x3b'),_0xcc65('0x26'),_0x2aaa7f,'createdAt',_0xcc65('0x37')],squel['select']()[_0xcc65('0x39')](_0xcc65('0x20'),'phone')[_0xcc65('0x39')](_0xcc65('0x3a'),_0xcc65('0x35'))[_0xcc65('0x39')]('id',_0xcc65('0x3b'))[_0xcc65('0x39')](LISTID[_0xcc65('0x3c')](),_0xcc65('0x26'))[_0xcc65('0x39')](_0x241f49['id']['toString'](),_0x2aaa7f)[_0xcc65('0x39')](_0xcc65('0x3a'),_0xcc65('0x36'))['field'](_0xcc65('0x3a'),_0xcc65('0x37'))[_0xcc65('0x40')](_0xcc65('0x3d'))[_0xcc65('0x3e')](_0xcc65('0x3f'))[_0xcc65('0x3e')](_0xcc65('0x43'),LISTID[_0xcc65('0x3c')]())[_0xcc65('0x3e')](_0xcc65('0x49'),squel[_0xcc65('0x44')](hopperContacts))[_0xcc65('0x3e')](_0xcc65('0x45')))[_0xcc65('0x3c')]();return _0x422b91;}function _0x21ece3(_0x8a4b74,_0x1884a6){var _0x3d8102=squel[_0xcc65('0x33')]()[_0xcc65('0x42')](_0xcc65('0x4a'))[_0xcc65('0x4b')](['phone','ContactId',_0xcc65('0x26'),_0x1884a6,'createdAt',_0xcc65('0x37')],squel[_0xcc65('0x38')]()[_0xcc65('0x39')]('phone',_0xcc65('0x20'))[_0xcc65('0x39')]('id',_0xcc65('0x3b'))[_0xcc65('0x39')](LISTID[_0xcc65('0x3c')](),_0xcc65('0x26'))[_0xcc65('0x39')](_0x8a4b74['id'][_0xcc65('0x3c')](),_0x1884a6)[_0xcc65('0x39')](_0xcc65('0x3a'),_0xcc65('0x36'))['field'](_0xcc65('0x3a'),_0xcc65('0x37'))[_0xcc65('0x40')](_0xcc65('0x3d'))[_0xcc65('0x3e')]('deletedAt\x20IS\x20NULL')['where'](_0xcc65('0x43'),LISTID[_0xcc65('0x3c')]())[_0xcc65('0x3e')](_0xcc65('0x49'),squel['str'](hopperContacts))['where'](_0xcc65('0x45')))[_0xcc65('0x3c')]();return _0x3d8102;}return db[_0xcc65('0x4c')][_0xcc65('0x4d')]({'where':{'type':_0xcc65('0x4e')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0xcc65('0x4f'),'where':{'id':LISTID}}]})[_0xcc65('0x2d')](function(_0x342651){var _0x1c5429=[];if(_0x342651){var _0x5ebe2e;for(var _0x1ee652=0x0,_0x97b92;_0x1ee652<_0x342651[_0xcc65('0x1a')];_0x1ee652+=0x1){_0x97b92=_0x342651[_0x1ee652][_0xcc65('0x50')]({'plain':!![]});switch(_0x97b92[_0xcc65('0x51')]){case'always':_0x1c5429[_0xcc65('0x52')](db[_0xcc65('0x53')]['query'](_0x3b21a9(_0x97b92,_0xcc65('0x54')))[_0xcc65('0x2d')](function(){})[_0xcc65('0x2f')](_0x459f58()));break;case'onlyIfOpen':_0x1c5429[_0xcc65('0x52')](db[_0xcc65('0x53')][_0xcc65('0x55')](_0xbedf8b(_0x97b92,_0xcc65('0x54')))[_0xcc65('0x2d')](function(){})[_0xcc65('0x2f')](_0x459f58()));break;default:_0x1c5429[_0xcc65('0x52')](db[_0xcc65('0x53')][_0xcc65('0x55')](_0x40a0a2(_0x97b92,'VoiceQueueId'))[_0xcc65('0x2d')](function(){})['catch'](_0x459f58()));}}}return _0x1c5429;})['all']()[_0xcc65('0x2d')](function(){return db[_0xcc65('0x4c')][_0xcc65('0x4d')]({'where':{'type':_0xcc65('0x4e')},'attributes':['id'],'include':[{'model':db[_0xcc65('0x56')],'as':_0xcc65('0x57'),'where':{'id':LISTID}}]})[_0xcc65('0x2d')](function(_0x121902){var _0x2544d5=[];if(_0x121902){var _0xf510a6;for(var _0x1b762=0x0,_0x29d055;_0x1b762<_0x121902[_0xcc65('0x1a')];_0x1b762+=0x1){_0x29d055=_0x121902[_0x1b762][_0xcc65('0x50')]({'plain':!![]});_0x2544d5['push'](db[_0xcc65('0x53')]['query'](_0x21ece3(_0x29d055,_0xcc65('0x54')))[_0xcc65('0x2d')](function(){})[_0xcc65('0x2f')](_0x459f58()));}}return _0x2544d5;})[_0xcc65('0x58')]();})['then'](function(){return db['Campaign'][_0xcc65('0x4d')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xcc65('0x56')],'as':_0xcc65('0x4f'),'where':{'id':LISTID}}]})[_0xcc65('0x2d')](function(_0x4a6507){var _0x479fa6=[];if(_0x4a6507){for(var _0x4f77fe=0x0,_0x2c2c2e;_0x4f77fe<_0x4a6507[_0xcc65('0x1a')];_0x4f77fe+=0x1){_0x2c2c2e=_0x4a6507[_0x4f77fe][_0xcc65('0x50')]({'plain':!![]});switch(_0x2c2c2e['dialCheckDuplicateType']){case _0xcc65('0x59'):_0x479fa6[_0xcc65('0x52')](db['sequelize']['query'](_0x3b21a9(_0x2c2c2e,'CampaignId'))['then'](function(){})[_0xcc65('0x2f')](_0x459f58()));break;case'onlyIfOpen':_0x479fa6[_0xcc65('0x52')](db[_0xcc65('0x53')]['query'](_0xbedf8b(_0x2c2c2e,_0xcc65('0x5a')))[_0xcc65('0x2d')](function(){})['catch'](_0x459f58()));break;default:_0x479fa6[_0xcc65('0x52')](db[_0xcc65('0x53')][_0xcc65('0x55')](_0x40a0a2(_0x2c2c2e,_0xcc65('0x5a')))['then'](function(){})[_0xcc65('0x2f')](_0x459f58()));}}}return _0x479fa6;})['all']();})['then'](function(){return db['Campaign'][_0xcc65('0x4d')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xcc65('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x2102c4){var _0x279e31=[];if(_0x2102c4){for(var _0x554555=0x0,_0x27e415;_0x554555<_0x2102c4['length'];_0x554555+=0x1){_0x27e415=_0x2102c4[_0x554555][_0xcc65('0x50')]({'plain':!![]});_0x279e31[_0xcc65('0x52')](db[_0xcc65('0x53')]['query'](_0x21ece3(_0x27e415,_0xcc65('0x5a')))[_0xcc65('0x2d')](function(){})[_0xcc65('0x2f')](_0x459f58()));}}return _0x279e31;})[_0xcc65('0x58')]();})['catch'](function(_0x3c8298){logger[_0xcc65('0x15')](_0xcc65('0x5b'),'generalCheckHopper',_0x3c8298['message']);});}var processPromises=function(_0x376ec){return BPromise[_0xcc65('0x58')](promises)['then'](function(_0xc95fee){})[_0xcc65('0x2f')](function(_0x131478){logger[_0xcc65('0x15')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x131478));})[_0xcc65('0x5c')](function(){socket['emit'](_0xcc65('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x376ec){return _0x376ec['resume']();}});};var endCsv=function(){return BPromise[_0xcc65('0x5e')]()[_0xcc65('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0xcc65('0x2d')](function(){socket[_0xcc65('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x2371fc){logger[_0xcc65('0x15')](_0xcc65('0x60'),JSON['stringify'](_0x2371fc));}finally{process[_0xcc65('0x61')](0x0);}});};process['on'](_0xcc65('0x62'),function(){logger[_0xcc65('0x63')](_0xcc65('0x64'));endCsv();});function main(){return BPromise[_0xcc65('0x5e')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xcc65('0x12')](',');return db[_0xcc65('0x2a')][_0xcc65('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xcc65('0x2d')](function(_0xa71c24){var _0xb2d90b=fs[_0xcc65('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0xb2d90b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2337b4,_0x4f4045){total+=0x1;var _0x36d50f=total;promises[_0xcc65('0x52')](checkRow(_0x2337b4,_0xa71c24,_0x36d50f)[_0xcc65('0x2d')](function(){success+=0x1;})[_0xcc65('0x2f')](function(_0x45877d){if(_0x45877d[_0xcc65('0x15')]){errors+=0x1;delete _0x45877d[_0xcc65('0x15')];}else if(_0x45877d[_0xcc65('0x29')]){duplicates+=0x1;delete _0x45877d['duplicate'];}rows[_0xcc65('0x52')](_0x45877d);}));if(total%0xc8===0x0){_0x4f4045[_0xcc65('0x66')]();return processPromises(_0x4f4045);}},'complete':function(){return processPromises()['then'](function(){logger[_0xcc65('0x63')](_0xcc65('0x67'));endCsv();});},'error':function(_0x22bc9d,_0x3ddf8a){logger[_0xcc65('0x63')](_0xcc65('0x68'),JSON['stringify'](_0x22bc9d));endCsv();}});})['catch'](function(_0x192c3d){logger[_0xcc65('0x15')](_0xcc65('0x69'),JSON[_0xcc65('0x6a')](_0x192c3d));});}main(); \ No newline at end of file +var _0x08b8=['CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper','toString','insert','str','calleridnum','cm_hopper_final','\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','BlackLists','all','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','pause'];(function(_0x1f2fc3,_0x1f32b2){var _0x1fa293=function(_0x117f76){while(--_0x117f76){_0x1f2fc3['push'](_0x1f2fc3['shift']());}};_0x1fa293(++_0x1f32b2);}(_0x08b8,0xe7));var _0x808b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x08b8[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x808b('0x0'));var util=require(_0x808b('0x1'));var _=require(_0x808b('0x2'));var fs=require('fs');var squel=require(_0x808b('0x3'));var Papa=require(_0x808b('0x4'));var Redis=require('ioredis');var db=require(_0x808b('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('api');config[_0x808b('0x6')]=_[_0x808b('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x808b('0x8'))(new Redis(config[_0x808b('0x6')]));require(_0x808b('0x9'))[_0x808b('0xa')](socket);try{if(!process[_0x808b('0xb')][0x2]||process[_0x808b('0xb')][0x2]==='undefined'||process[_0x808b('0xb')][0x2]===_0x808b('0xc')){throw new Error(_0x808b('0xd'));}var FILEPATH=process[_0x808b('0xb')][0x2];if(!process[_0x808b('0xb')][0x3]||process['argv'][0x3]===_0x808b('0xe')||process[_0x808b('0xb')][0x3]==='null'||!process[_0x808b('0xb')][0x4]||process['argv'][0x4]===_0x808b('0xe')||process[_0x808b('0xb')][0x4]===_0x808b('0xc')){throw new Error(_0x808b('0xf'));}var FIELDS=_[_0x808b('0x10')](process['argv'][0x3][_0x808b('0x11')](','),process[_0x808b('0xb')][0x4][_0x808b('0x11')](','));if(!process[_0x808b('0xb')][0x5]||process[_0x808b('0xb')][0x5]==='undefined'||process['argv'][0x5]===_0x808b('0xc')){throw new Error(_0x808b('0x12'));}var LISTID=process[_0x808b('0xb')][0x5];var COMPANYID=process[_0x808b('0xb')][0x6]&&process[_0x808b('0xb')][0x6]!==_0x808b('0xe')&&process[_0x808b('0xb')][0x6]!==_0x808b('0xc')?process[_0x808b('0xb')][0x6]:null;var DUPLICATES=process[_0x808b('0xb')][0x7]&&process[_0x808b('0xb')][0x7]!==_0x808b('0xe')&&process[_0x808b('0xb')][0x7]!==_0x808b('0xc')?process['argv'][0x7]:null;if(!process[_0x808b('0xb')][0x8]||process[_0x808b('0xb')][0x8]===_0x808b('0xe')||process[_0x808b('0xb')][0x8]===_0x808b('0xc')){throw new Error(_0x808b('0x13'));}var SOCKET_TIMESTAMP=process[_0x808b('0xb')][0x8];}catch(_0x12d033){logger[_0x808b('0x14')](_0x12d033);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(_0x1f50e4,_0x5d7a43,_0x42cd49,_0x35fb89){var _0x4e092b={'message':_0x5d7a43};_0x4e092b[_0x1f50e4]=!![];if(_0x42cd49){_0x4e092b[_0x808b('0x15')]=_0x42cd49;}if(_0x35fb89){_0x4e092b[_0x808b('0x16')]=_0x35fb89;}return _0x4e092b;}function isEmail(_0x5166e6){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))*$/[_0x808b('0x17')](_0x5166e6);}function checkRow(_0x24e569,_0x50e27f,_0x2c9684){return new BPromise(function(_0x3f5144,_0x3a51b2){if(_[_0x808b('0x18')](_0x24e569)){return _0x3a51b2(handleCheckRowError('error',_0x808b('0x19'),null,_0x2c9684));}if(_0x24e569['errors']&&_0x24e569[_0x808b('0x1a')]['length']){var _0xf3c34=_[_0x808b('0x1b')](_0x24e569[_0x808b('0x1a')],_0x808b('0x1c'))[_0x808b('0x1d')](';');return _0x3a51b2(handleCheckRowError(_0x808b('0x14'),_0xf3c34,null,_0x2c9684));}var _0x41ff88={};for(var _0x48b9a4 in FIELDS){if(FIELDS[_0x808b('0x1e')](_0x48b9a4)&&FIELDS[_0x48b9a4]){_0x41ff88[_0x48b9a4]=_0x24e569['data'][0x0][FIELDS[_0x48b9a4]]||_0x24e569[_0x808b('0x1f')][0x0]['\ufeff'+FIELDS[_0x48b9a4]];}}if(!_0x41ff88[_0x808b('0x20')]){return _0x3a51b2(handleCheckRowError(_0x808b('0x14'),_0x808b('0x21'),null,_0x2c9684));}if(!_0x41ff88['phone']){return _0x3a51b2(handleCheckRowError(_0x808b('0x14'),_0x808b('0x22'),null,_0x2c9684));}if(_0x41ff88['birthDate']){var _0x1f3c7a=moment(_0x41ff88['birthDate'],'YYYY-MM-DD');if(!_0x1f3c7a[_0x808b('0x23')]()){return _0x3a51b2(handleCheckRowError('error',_0x808b('0x24'),null,_0x2c9684));}}if(_0x41ff88[_0x808b('0x25')]){if(!isEmail(_0x41ff88[_0x808b('0x25')])){return _0x3a51b2(handleCheckRowError(_0x808b('0x14'),_0x808b('0x26'),null,_0x2c9684));}}_0x41ff88[_0x808b('0x27')]=LISTID;_0x41ff88[_0x808b('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x808b('0x29')]&&_0x50e27f){var _0x254db3={};for(var _0x28d150=0x0,_0x5ba725=DUPLICATES['length'];_0x28d150<_0x5ba725;_0x28d150+=0x1){_0x254db3[DUPLICATES[_0x28d150]]=_0x41ff88[DUPLICATES[_0x28d150]];}var _0x4a2fbe=_[_0x808b('0x2a')](_0x50e27f,_0x254db3);if(_0x4a2fbe){return _0x3a51b2(handleCheckRowError(_0x808b('0x2b'),_0x808b('0x2c'),_0x4a2fbe,_0x2c9684));}}return db['CmContact']['create'](_0x41ff88,{'raw':!![],'hooks':![],'fields':_[_0x808b('0x2d')](_0x41ff88)})[_0x808b('0x2e')](function(_0x46dfa6){if(DUPLICATES&&DUPLICATES['length']&&_0x50e27f){_0x50e27f[_0x808b('0x2f')](_[_0x808b('0x30')](_0x41ff88,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x46dfa6['id'];return _0x3f5144();})[_0x808b('0x31')](function(_0x4aefb6){return _0x3a51b2(handleCheckRowError(_0x808b('0x14'),_0x808b('0x32')+(_0x4aefb6['message']||JSON[_0x808b('0x33')](_0x4aefb6)),null,_0x2c9684));});});}function checkHopper(){function _0x3bf4ab(){return function(_0x258771){logger[_0x808b('0x14')](_0x808b('0x34'),_0x808b('0x35'),util[_0x808b('0x36')](_0x258771,{'showHidden':![],'depth':null}));};}var _0x264544=function(_0x3874cd,_0x37f2ab){var _0x87bb09=squel['insert']()[_0x808b('0x37')]('cm_hopper')[_0x808b('0x38')]([_0x808b('0x39'),_0x808b('0x3a'),_0x808b('0x3b'),'ListId',_0x37f2ab,_0x808b('0x3c'),_0x808b('0x3d')],squel[_0x808b('0x3e')]()[_0x808b('0x3f')]('phone',_0x808b('0x39'))[_0x808b('0x3f')](_0x808b('0x40'),_0x808b('0x3a'))[_0x808b('0x3f')]('id','ContactId')[_0x808b('0x3f')](LISTID['toString'](),_0x808b('0x27'))[_0x808b('0x3f')](_0x3874cd['id']['toString'](),_0x37f2ab)[_0x808b('0x3f')](_0x808b('0x40'),_0x808b('0x3c'))['field']('NOW()',_0x808b('0x3d'))['from'](_0x808b('0x41'))[_0x808b('0x42')]('deletedAt\x20IS\x20NULL')[_0x808b('0x42')](_0x808b('0x43'),LISTID['toString']())[_0x808b('0x42')](_0x808b('0x44'))['where'](_0x808b('0x45'),squel['select']()[_0x808b('0x3f')](_0x808b('0x39'))[_0x808b('0x46')](_0x808b('0x47'))[_0x808b('0x42')](_0x37f2ab+'\x20=\x20?',_0x3874cd['id'][_0x808b('0x48')]())))[_0x808b('0x48')]();return _0x87bb09;};var _0xb33688=function(_0x5927fd,_0x690081){var _0x23176c=squel[_0x808b('0x49')]()[_0x808b('0x37')]('cm_hopper')[_0x808b('0x38')]([_0x808b('0x39'),_0x808b('0x3a'),'ContactId',_0x808b('0x27'),_0x690081,_0x808b('0x3c'),_0x808b('0x3d')],squel['select']()['field'](_0x808b('0x39'),_0x808b('0x39'))[_0x808b('0x3f')]('NOW()',_0x808b('0x3a'))[_0x808b('0x3f')]('id','ContactId')['field'](LISTID[_0x808b('0x48')](),_0x808b('0x27'))[_0x808b('0x3f')](_0x5927fd['id'][_0x808b('0x48')](),_0x690081)[_0x808b('0x3f')](_0x808b('0x40'),_0x808b('0x3c'))[_0x808b('0x3f')](_0x808b('0x40'),_0x808b('0x3d'))[_0x808b('0x46')](_0x808b('0x41'))[_0x808b('0x42')]('deletedAt\x20IS\x20NULL')[_0x808b('0x42')](_0x808b('0x43'),LISTID[_0x808b('0x48')]())[_0x808b('0x42')]('id\x20IN\x20?',squel[_0x808b('0x4a')](hopperContacts))[_0x808b('0x42')](_0x808b('0x44'))[_0x808b('0x42')](_0x808b('0x45'),squel['select']()[_0x808b('0x3f')](_0x808b('0x4b'))[_0x808b('0x46')](_0x808b('0x4c'))[_0x808b('0x42')](_0x690081+'\x20=\x20?',_0x5927fd['id'][_0x808b('0x48')]()))[_0x808b('0x42')](_0x808b('0x45'),squel['select']()[_0x808b('0x3f')](_0x808b('0x39'))[_0x808b('0x46')](_0x808b('0x47'))[_0x808b('0x42')](_0x690081+_0x808b('0x4d'),_0x5927fd['id'][_0x808b('0x48')]())))[_0x808b('0x48')]();return _0x23176c;};function _0x7a749a(_0x31621a,_0x5cf472){var _0x139202=squel[_0x808b('0x49')]()[_0x808b('0x37')](_0x808b('0x47'))[_0x808b('0x38')]([_0x808b('0x39'),'scheduledAt',_0x808b('0x3b'),'ListId',_0x5cf472,_0x808b('0x3c'),'updatedAt'],squel[_0x808b('0x3e')]()[_0x808b('0x3f')]('phone','phone')[_0x808b('0x3f')](_0x808b('0x40'),_0x808b('0x3a'))[_0x808b('0x3f')]('id',_0x808b('0x3b'))[_0x808b('0x3f')](LISTID['toString'](),_0x808b('0x27'))['field'](_0x31621a['id'][_0x808b('0x48')](),_0x5cf472)[_0x808b('0x3f')]('NOW()',_0x808b('0x3c'))[_0x808b('0x3f')](_0x808b('0x40'),_0x808b('0x3d'))[_0x808b('0x46')](_0x808b('0x41'))[_0x808b('0x42')](_0x808b('0x4e'))['where'](_0x808b('0x43'),LISTID[_0x808b('0x48')]())[_0x808b('0x42')](_0x808b('0x4f'),squel[_0x808b('0x4a')](hopperContacts))[_0x808b('0x42')](_0x808b('0x44')))[_0x808b('0x48')]();return _0x139202;}function _0x1ab81c(_0x382ee2,_0x348f36){var _0x39d501=squel[_0x808b('0x49')]()['into'](_0x808b('0x50'))[_0x808b('0x38')]([_0x808b('0x39'),'ContactId','ListId',_0x348f36,'createdAt',_0x808b('0x3d')],squel['select']()['field'](_0x808b('0x39'),_0x808b('0x39'))['field']('id',_0x808b('0x3b'))[_0x808b('0x3f')](LISTID[_0x808b('0x48')](),'ListId')[_0x808b('0x3f')](_0x382ee2['id']['toString'](),_0x348f36)[_0x808b('0x3f')]('NOW()',_0x808b('0x3c'))[_0x808b('0x3f')](_0x808b('0x40'),_0x808b('0x3d'))['from'](_0x808b('0x41'))['where']('deletedAt\x20IS\x20NULL')[_0x808b('0x42')]('ListId\x20=\x20?',LISTID['toString']())[_0x808b('0x42')]('id\x20IN\x20?',squel['str'](hopperContacts))['where'](_0x808b('0x44')))[_0x808b('0x48')]();return _0x39d501;}return db[_0x808b('0x51')][_0x808b('0x52')]({'where':{'type':_0x808b('0x53')},'attributes':['id',_0x808b('0x54')],'include':[{'model':db[_0x808b('0x55')],'as':'Lists','where':{'id':LISTID}}]})[_0x808b('0x2e')](function(_0x54d5f3){var _0x1909c1=[];if(_0x54d5f3){var _0x5e6124;for(var _0x475e68=0x0,_0x1033e3;_0x475e68<_0x54d5f3[_0x808b('0x29')];_0x475e68+=0x1){_0x1033e3=_0x54d5f3[_0x475e68][_0x808b('0x56')]({'plain':!![]});switch(_0x1033e3['dialCheckDuplicateType']){case _0x808b('0x57'):_0x1909c1[_0x808b('0x2f')](db[_0x808b('0x58')]['query'](_0xb33688(_0x1033e3,_0x808b('0x59')))[_0x808b('0x2e')](function(){})['catch'](_0x3bf4ab()));break;case _0x808b('0x5a'):_0x1909c1[_0x808b('0x2f')](db[_0x808b('0x58')][_0x808b('0x5b')](_0x264544(_0x1033e3,_0x808b('0x59')))[_0x808b('0x2e')](function(){})[_0x808b('0x31')](_0x3bf4ab()));break;default:_0x1909c1[_0x808b('0x2f')](db[_0x808b('0x58')][_0x808b('0x5b')](_0x7a749a(_0x1033e3,'VoiceQueueId'))[_0x808b('0x2e')](function(){})['catch'](_0x3bf4ab()));}}}return _0x1909c1;})['all']()[_0x808b('0x2e')](function(){return db[_0x808b('0x51')][_0x808b('0x52')]({'where':{'type':_0x808b('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x808b('0x5c'),'where':{'id':LISTID}}]})[_0x808b('0x2e')](function(_0x9cf4b4){var _0x54980e=[];if(_0x9cf4b4){var _0x44a82d;for(var _0x408c52=0x0,_0x37dca5;_0x408c52<_0x9cf4b4[_0x808b('0x29')];_0x408c52+=0x1){_0x37dca5=_0x9cf4b4[_0x408c52][_0x808b('0x56')]({'plain':!![]});_0x54980e[_0x808b('0x2f')](db[_0x808b('0x58')][_0x808b('0x5b')](_0x1ab81c(_0x37dca5,'VoiceQueueId'))[_0x808b('0x2e')](function(){})['catch'](_0x3bf4ab()));}}return _0x54980e;})[_0x808b('0x5d')]();})[_0x808b('0x2e')](function(){return db[_0x808b('0x5e')][_0x808b('0x52')]({'attributes':['id',_0x808b('0x54')],'include':[{'model':db[_0x808b('0x55')],'as':_0x808b('0x5f'),'where':{'id':LISTID}}]})[_0x808b('0x2e')](function(_0x453bf4){var _0x14a728=[];if(_0x453bf4){for(var _0xaa083d=0x0,_0x45694a;_0xaa083d<_0x453bf4['length'];_0xaa083d+=0x1){_0x45694a=_0x453bf4[_0xaa083d][_0x808b('0x56')]({'plain':!![]});switch(_0x45694a[_0x808b('0x54')]){case'always':_0x14a728['push'](db[_0x808b('0x58')][_0x808b('0x5b')](_0xb33688(_0x45694a,_0x808b('0x60')))[_0x808b('0x2e')](function(){})['catch'](_0x3bf4ab()));break;case _0x808b('0x5a'):_0x14a728[_0x808b('0x2f')](db[_0x808b('0x58')][_0x808b('0x5b')](_0x264544(_0x45694a,_0x808b('0x60')))[_0x808b('0x2e')](function(){})[_0x808b('0x31')](_0x3bf4ab()));break;default:_0x14a728[_0x808b('0x2f')](db['sequelize'][_0x808b('0x5b')](_0x7a749a(_0x45694a,_0x808b('0x60')))[_0x808b('0x2e')](function(){})['catch'](_0x3bf4ab()));}}}return _0x14a728;})[_0x808b('0x5d')]();})[_0x808b('0x2e')](function(){return db[_0x808b('0x5e')][_0x808b('0x52')]({'attributes':['id'],'include':[{'model':db[_0x808b('0x55')],'as':_0x808b('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x9a384e){var _0x107b2e=[];if(_0x9a384e){for(var _0x378743=0x0,_0x123312;_0x378743<_0x9a384e['length'];_0x378743+=0x1){_0x123312=_0x9a384e[_0x378743][_0x808b('0x56')]({'plain':!![]});_0x107b2e[_0x808b('0x2f')](db['sequelize'][_0x808b('0x5b')](_0x1ab81c(_0x123312,'CampaignId'))['then'](function(){})[_0x808b('0x31')](_0x3bf4ab()));}}return _0x107b2e;})[_0x808b('0x5d')]();})[_0x808b('0x31')](function(_0x6bfeda){logger[_0x808b('0x14')](_0x808b('0x61'),'generalCheckHopper',_0x6bfeda[_0x808b('0x1c')]);});}var processPromises=function(_0x4b0e1a){return BPromise['all'](promises)[_0x808b('0x2e')](function(_0x6513ca){})[_0x808b('0x31')](function(_0x228a67){logger[_0x808b('0x14')](_0x808b('0x62'),JSON[_0x808b('0x33')](_0x228a67));})[_0x808b('0x63')](function(){socket[_0x808b('0x64')](_0x808b('0x65')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4b0e1a){return _0x4b0e1a[_0x808b('0x66')]();}});};var endCsv=function(){return BPromise[_0x808b('0x67')]()[_0x808b('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0x808b('0x2e')](function(){socket[_0x808b('0x64')](_0x808b('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x143cb3){logger[_0x808b('0x14')](_0x808b('0x68'),JSON[_0x808b('0x33')](_0x143cb3));}finally{process[_0x808b('0x69')](0x0);}});};process['on'](_0x808b('0x6a'),function(){logger[_0x808b('0x6b')](_0x808b('0x6c'));endCsv();});function main(){return BPromise['resolve']()[_0x808b('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x808b('0x6d')][_0x808b('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x808b('0x2e')](function(_0x265ec3){var _0x517240=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x517240,{'header':!![],'skipEmptyLines':!![],'step':function(_0x17653c,_0x3c3446){total+=0x1;var _0x23cc1f=total;promises[_0x808b('0x2f')](checkRow(_0x17653c,_0x265ec3,_0x23cc1f)['then'](function(){success+=0x1;})[_0x808b('0x31')](function(_0x60f5ba){if(_0x60f5ba[_0x808b('0x14')]){errors+=0x1;delete _0x60f5ba[_0x808b('0x14')];}else if(_0x60f5ba['duplicate']){duplicates+=0x1;delete _0x60f5ba[_0x808b('0x2b')];}rows['push'](_0x60f5ba);}));if(total%0xc8===0x0){_0x3c3446[_0x808b('0x6e')]();return processPromises(_0x3c3446);}},'complete':function(){return processPromises()[_0x808b('0x2e')](function(){logger[_0x808b('0x6b')](_0x808b('0x6f'));endCsv();});},'error':function(_0x4f53bd,_0x1f84dd){logger['info'](_0x808b('0x70'),JSON[_0x808b('0x33')](_0x4f53bd));endCsv();}});})[_0x808b('0x31')](function(_0x377e78){logger[_0x808b('0x14')](_0x808b('0x71'),JSON[_0x808b('0x33')](_0x377e78));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 54fb9eb..2823c1d 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 _0x6767=['CmContactHasItem','findOne','update','create','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','join','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.updatedAt','cm_hopper_black','updatedAt','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','scheduledat','cm_contacts.id','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','errors','query','spread','campaigns.id','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','catch','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','set','offset','main','stringify','start','binding','socket_timestamp','root','.csv','includes','name','header','writeFileSync','parse','createReadStream','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','YYYY-MM-DD','utcOffset','firstName','\x20not\x20specified','data','itemTypeId','description','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','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',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','affectedRows','complete','argv','server/files/tmp','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','bluebird','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','then','length','push','all','split','isNil','filter'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0x6767,0x1e8));var _0x7676=function(_0x1702c0,_0x2252af){_0x1702c0=_0x1702c0-0x0;var _0x2bda1d=_0x6767[_0x1702c0];return _0x2bda1d;};'use strict';var fs=require('fs');var path=require(_0x7676('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x7676('0x1'));var moment=require('moment');var squel=require(_0x7676('0x2'));var Redis=require('ioredis');var db=require(_0x7676('0x3'))['db'];var config=require(_0x7676('0x4'));var shared=require(_0x7676('0x5'));var logger=require(_0x7676('0x6'))(_0x7676('0x7'));config[_0x7676('0x8')]=_[_0x7676('0x9')](config[_0x7676('0x8')],{'host':_0x7676('0xa'),'port':0x18eb});var socket=require(_0x7676('0xb'))(new Redis(config[_0x7676('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x7676('0xc')](_0x7676('0xd'));function isEmail(_0xfc1014){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))*$/[_0x7676('0xe')](_0xfc1014);}function selectNotIn(_0x2744f7,_0x402420,_0x1b385a,_0x3feb11,_0x19760e){return squel[_0x7676('0xf')]()[_0x7676('0x10')](_0x7676('0x11'))['from'](_0x3feb11)['join'](_0x402420,null,_0x402420+_0x7676('0x12')+_0x3feb11+'.'+_0x1b385a)[_0x7676('0x13')](_0x3feb11+'.'+_0x1b385a+_0x7676('0x14')+_0x2744f7+'.'+_0x1b385a)[_0x7676('0x13')](_0x402420+_0x7676('0x15')+_0x19760e['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x648129,_0x5d7601){promisesAdditionalPhones=[];return db[_0x7676('0x16')]['findAll']({'raw':!![],'attributes':['id',_0x7676('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x7676('0x18')](function(_0x153599){if(_0x153599!==null){var _0x5c1dde=[];for(var _0x1077be=0x0;_0x1077be<_0x153599[_0x7676('0x19')];_0x1077be++){var _0x4b135a=_0x153599[_0x1077be];_0x5c1dde[_0x7676('0x1a')](insertAdditionalPhones(_0x4b135a));}}Promise[_0x7676('0x1b')](_0x5c1dde)[_0x7676('0x18')](function(){_0x648129({'val':0x1});});});});}function insertAdditionalPhones(_0x3bb73f){return new Promise(function(_0x323cb3,_0x10870a){var _0xf6eb57=_0x3bb73f[_0x7676('0x17')];var _0x2cf78a=_0xf6eb57[_0x7676('0x1c')](';');var _0x501601=[];orderBy=0x0;for(var _0x310322=0x0;_0x310322<_0x2cf78a['length'];_0x310322++){_0x501601[_0x7676('0x1a')](splitAdditionalPhone(_0x3bb73f['id'],_0x2cf78a[_0x310322]));}Promise[_0x7676('0x1b')](_0x501601)[_0x7676('0x18')](function(){_0x323cb3({'val':_0x2cf78a[_0x7676('0x19')]});});});}function splitAdditionalPhone(_0x308e80,_0x320a75){return new Promise(function(_0x284093,_0x5a346b){var _0x5577c6=_0x320a75[_0x7676('0x1c')](':');var _0x420f60=_0x5577c6[0x0];var _0x3d1b85=_0x5577c6[0x1];if(!_[_0x7676('0x1d')](_0x3d1b85)){var _0x4e738a=_0x3d1b85['split']('|');var _0x57a399=[];for(var _0x1c4633=0x0;_0x1c4633<_0x4e738a['length'];_0x1c4633++){if(_0x4e738a[_0x1c4633]!==''){var _0x11b749=_[_0x7676('0x1e')](promisesAdditionalPhones,{'contactId':_0x308e80,'phone':_0x4e738a[_0x1c4633]});if(_0x11b749['length']==0x0){orderBy++;promisesAdditionalPhones[_0x7676('0x1a')]({'contactId':_0x308e80,'contactTypeId':_0x420f60,'phone':_0x4e738a[_0x1c4633],'orderBy':orderBy});}}}_0x284093({'ok':0x1});}else _0x284093({'res':0x0});});}function createAdditionalPhone(_0x23a2b0,_0x5a6a4a,_0x4fd0e3,_0x15b812){var _0x2440a0='';var _0x297d43='';var _0x258d64=_0x4fd0e3[_0x7676('0x1c')]('§');_0x2440a0=_0x258d64[0x0];if(_0x258d64[_0x7676('0x19')]==0x2)_0x297d43=_0x258d64[0x1];return new Promise(function(_0x3e6a35,_0x3cad66){return db[_0x7676('0x1f')][_0x7676('0x20')]({'where':{'CmContactId':_0x23a2b0,'item':_0x2440a0}})[_0x7676('0x18')](function(_0xcf40ee){if(_0xcf40ee){return db[_0x7676('0x1f')][_0x7676('0x21')]({'ItemTypeId':_0x5a6a4a,'description':_0x297d43,'OrderBy':_0x15b812},{'where':{'CmContactId':_0x23a2b0,'item':_0x2440a0}})[_0x7676('0x18')](function(_0x3792cb){_0x3e6a35({'res':'updated'});});}else{return db[_0x7676('0x1f')][_0x7676('0x22')]({'CmContactId':_0x23a2b0,'item':_0x2440a0,'description':_0x297d43,'ItemTypeId':_0x5a6a4a,'OrderBy':_0x15b812,'ItemClass':_0x7676('0x23')})[_0x7676('0x18')](function(_0x4b2eb3){_0x3e6a35({'res':_0x7676('0x24')});});}});});}function insertCmHopper(_0x42eec7,_0x1528e0,_0x58b732,_0x2519a0,_0x140e58){var _0x5efb54=['cm_contacts.phone',_0x7676('0x25'),'cm_contacts.id',_0x7676('0x26'),_0x1528e0+'.'+_0x2519a0,_0x7676('0x27'),'cm_contacts.updatedAt','cm_contacts.priority',_0x7676('0x28'),'\x22'+_0x140e58+'\x22'];return squel[_0x7676('0x29')]()[_0x7676('0x2a')](_0x7676('0x2b'))[_0x7676('0x2c')]([_0x7676('0x11'),'scheduledat',_0x7676('0x2d'),_0x7676('0x2e'),_0x2519a0,_0x7676('0x2f'),'updatedAt',_0x7676('0x30'),_0x7676('0x31'),_0x7676('0x32')],squel['select']()[_0x7676('0x33')](_0x5efb54)[_0x7676('0x34')](_0x1528e0)['join'](_0x7676('0x35'),null,_0x7676('0x36')+_0x1528e0+_0x7676('0x37'))[_0x7676('0x38')](_0x58b732,null,_0x58b732+_0x7676('0x12')+_0x1528e0+'.'+_0x2519a0)['where'](_0x1528e0+_0x7676('0x39'),_0x42eec7)[_0x7676('0x13')](_0x7676('0x3a'),NOW)['where'](_0x7676('0x3b'),selectNotIn(_0x1528e0,_0x58b732,_0x2519a0,'cm_hopper',[_0x7676('0x3c'),_0x7676('0x3d')]))[_0x7676('0x13')](_0x7676('0x3b'),selectNotIn(_0x1528e0,_0x58b732,_0x2519a0,_0x7676('0x2b'),[_0x7676('0x3c')])))[_0x7676('0x3e')]();}function insertCmHopperBlack(_0x44f947,_0x58b379,_0x363f49,_0x89d3d4){var _0x24b7ad=[_0x7676('0x3f'),'cm_contacts.id',_0x7676('0x26'),_0x58b379+'.'+_0x89d3d4,_0x7676('0x27'),_0x7676('0x40')];return squel[_0x7676('0x29')]()['into'](_0x7676('0x41'))[_0x7676('0x2c')](['phone',_0x7676('0x2d'),_0x7676('0x2e'),_0x89d3d4,'createdAt',_0x7676('0x42')],squel[_0x7676('0xf')]()[_0x7676('0x33')](_0x24b7ad)['from'](_0x58b379)['join'](_0x7676('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x58b379+_0x7676('0x37'))[_0x7676('0x38')](_0x363f49,null,_0x363f49+'.id\x20=\x20'+_0x58b379+'.'+_0x89d3d4)[_0x7676('0x13')](_0x58b379+'.CmListId\x20=\x20?',_0x44f947)[_0x7676('0x13')](_0x7676('0x3a'),NOW)[_0x7676('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')[_0x7676('0x34')](_0x7676('0x41'))[_0x7676('0x13')](_0x7676('0x43'),_0x44f947)[_0x7676('0x13')](_0x89d3d4+_0x7676('0x14')+_0x58b379+'.'+_0x89d3d4)))[_0x7676('0x3e')]();}function insertTzCmHopper(_0x4c4c54,_0x232e1a,_0x2626a2,_0x1aadb5,_0x5cf43c,_0x439155){var _0x427e29=[_0x7676('0x3f'),_0x7676('0x44')+_0x439155+_0x7676('0x45'),'cm_contacts.id',_0x7676('0x26'),_0x232e1a+'.'+_0x1aadb5,_0x7676('0x27'),_0x7676('0x40'),_0x7676('0x46'),_0x7676('0x28'),'\x22'+_0x5cf43c+'\x22'];var _0xb574d7=squel['insert']()['into'](_0x7676('0x2b'))[_0x7676('0x2c')]([_0x7676('0x11'),_0x7676('0x47'),_0x7676('0x2d'),'ListId',_0x1aadb5,_0x7676('0x2f'),_0x7676('0x42'),_0x7676('0x30'),_0x7676('0x31'),'recallme'],squel[_0x7676('0xf')]()['fields'](_0x427e29)[_0x7676('0x34')](_0x232e1a)[_0x7676('0x38')]('cm_contacts',null,_0x7676('0x36')+_0x232e1a+_0x7676('0x37'))[_0x7676('0x38')](_0x2626a2,null,_0x2626a2+'.id\x20=\x20'+_0x232e1a+'.'+_0x1aadb5)['join'](_0x439155,null,_0x439155+'.id\x20=\x20'+_0x232e1a+'.'+_0x1aadb5)[_0x7676('0x13')](_0x232e1a+_0x7676('0x39'),_0x4c4c54)[_0x7676('0x13')](_0x7676('0x3a'),NOW)[_0x7676('0x13')](_0x7676('0x3b'),selectNotIn(_0x232e1a,_0x2626a2,_0x1aadb5,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))[_0x7676('0x13')](_0x7676('0x3b'),selectNotIn(_0x232e1a,_0x2626a2,_0x1aadb5,'cm_hopper',['\x22always\x22'])))[_0x7676('0x3e')]();return _0xb574d7;}function insertTzCmHopperBlack(_0x4f6044,_0x48dd06,_0x502b79,_0x2cb0c6){var _0x4358b3=[_0x7676('0x3f'),_0x7676('0x48'),_0x7676('0x26'),_0x48dd06+'.'+_0x2cb0c6,_0x7676('0x27'),_0x7676('0x40')];return squel[_0x7676('0x29')]()[_0x7676('0x2a')]('cm_hopper_black')[_0x7676('0x2c')]([_0x7676('0x11'),_0x7676('0x2d'),'ListId',_0x2cb0c6,'createdAt','updatedAt'],squel[_0x7676('0xf')]()[_0x7676('0x33')](_0x4358b3)[_0x7676('0x34')](_0x48dd06)[_0x7676('0x38')](_0x7676('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x48dd06+_0x7676('0x37'))[_0x7676('0x38')](_0x502b79,null,_0x502b79+_0x7676('0x12')+_0x48dd06+'.'+_0x2cb0c6)['where'](_0x48dd06+_0x7676('0x39'),_0x4f6044)['where'](_0x7676('0x3a'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7676('0xf')]()[_0x7676('0x10')](_0x7676('0x11'))['from'](_0x7676('0x41'))[_0x7676('0x13')](_0x7676('0x43'),_0x4f6044)[_0x7676('0x13')](_0x2cb0c6+'\x20=\x20'+_0x48dd06+'.'+_0x2cb0c6)))[_0x7676('0x3e')]();}function insertCmHopperAdditionalPhones(_0x3343c5){var _0x2514b2=['cm_hopper.id','cm_contact_has_items.item',_0x7676('0x49'),'cm_contact_has_items.createdAt',_0x7676('0x4a')];return squel[_0x7676('0x29')]()['into'](_0x7676('0x4b'))['fromQuery']([_0x7676('0x4c'),_0x7676('0x11'),_0x7676('0x4d'),_0x7676('0x2f'),'updatedAt'],squel[_0x7676('0xf')]()['fields'](_0x2514b2)['from'](_0x7676('0x2b'))['join'](_0x7676('0x35'),null,_0x7676('0x4e'))[_0x7676('0x38')]('cm_contact_has_items',null,_0x7676('0x4f'))[_0x7676('0x13')](_0x7676('0x50'),_0x3343c5)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x7676('0x3e')]();}function insertCmContact(_0xec04a8,_0x53c721,_0x3cc91f,_0x2f16b3){var _0x27d1bc=_[_0x7676('0x51')](_[_0x7676('0x52')](_0x2f16b3),[_0x7676('0x2e'),'CompanyId',_0x7676('0x2f'),'updatedAt',_0x7676('0x53')]);return squel[_0x7676('0x29')]()[_0x7676('0x2a')](_0x7676('0x35'))[_0x7676('0x2c')](_0x27d1bc,squel[_0x7676('0xf')]()[_0x7676('0x33')](_0x27d1bc)[_0x7676('0x34')](_0x53c721)[_0x7676('0x13')]('('+_0x3cc91f[_0x7676('0x38')](',')+')\x20NOT\x20IN\x20?',squel[_0x7676('0xf')]()['fields'](_0x3cc91f)[_0x7676('0x34')](_0x7676('0x35'))['where']('ListId\x20=\x20?',_0xec04a8)[_0x7676('0x13')](_0x7676('0x54')))[_0x7676('0x13')](_0x7676('0x55'),squel[_0x7676('0xf')]()['field'](_0x7676('0x56'),_0x7676('0x57'))['from'](_0x53c721)[_0x7676('0x58')](_0x3cc91f[_0x7676('0x38')](','))))['toString']();}function handleStop(){logger[_0x7676('0x59')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2e54c5){logger[_0x7676('0x5a')](_0x2e54c5[_0x7676('0x5b')]);process[_0x7676('0x5c')](0x1);}function handleError(_0x218b78,_0x59079b){stats[_0x7676('0x5d')][_0x7676('0x1a')]({'name':_0x59079b['code'],'message':_0x59079b[_0x7676('0x5b')],'row':_0x218b78});}function handleQuery(_0x2857de){logger[_0x7676('0x59')](_0x2857de);return db['sequelize'][_0x7676('0x5e')](_0x2857de)[_0x7676('0x5f')](function(_0x403041){results['push'](_0x403041);})['catch'](function(_0x448ca){logger['error'](_0x448ca['message']);});}function updateTzCampaigns(_0x2fd896){return new Promise(function(_0xc35535,_0x3609fa){var _0x1eec6e=squel[_0x7676('0xf')]()[_0x7676('0x33')]([_0x7676('0x60'),'campaigns.dialTimezone'])[_0x7676('0x34')](_0x7676('0x61'))['join']('campaigns_has_cm_lists',null,_0x7676('0x62'))['where']('campaigns_has_cm_lists.CmListId='+_0x2fd896);db[_0x7676('0x63')]['query'](_0x1eec6e[_0x7676('0x3e')]())[_0x7676('0x5f')](function(_0x1800e7){var _0x568764=[];for(var _0x82aa1b=0x0;_0x82aa1b<_0x1800e7[_0x7676('0x19')];_0x82aa1b++){_0x568764[_0x7676('0x1a')](getTimezoneData(_0x1800e7[_0x82aa1b],tmp_campaigns));}BPromise[_0x7676('0x1b')](_0x568764)[_0x7676('0x18')](function(){_0xc35535({'val':0x1});});})[_0x7676('0x64')](function(_0x3f6b55){logger[_0x7676('0x5a')](_0x3f6b55[_0x7676('0x5b')]);_0xc35535({'val':0x0});});});}function updateTzVoiceQueues(_0x3a6ce0){return new Promise(function(_0x399e86,_0x914bfb){var _0x49bbfb=squel[_0x7676('0xf')]()['fields']([_0x7676('0x65'),'voice_queues.dialTimezone'])[_0x7676('0x34')](_0x7676('0x66'))['join'](_0x7676('0x67'),null,_0x7676('0x68'))['where']('voice_queues_has_cm_lists.CmListId='+_0x3a6ce0);db[_0x7676('0x63')]['query'](_0x49bbfb[_0x7676('0x3e')]())['spread'](function(_0x466a0a){var _0x16e9ce=[];for(var _0x37e563=0x0;_0x37e563<_0x466a0a[_0x7676('0x19')];_0x37e563++){_0x16e9ce[_0x7676('0x1a')](getTimezoneData(_0x466a0a[_0x37e563],tmp_voice_queues));}BPromise[_0x7676('0x1b')](_0x16e9ce)[_0x7676('0x18')](function(){_0x399e86({'val':0x1});});})[_0x7676('0x64')](function(_0xb181e2){logger[_0x7676('0x5a')](_0xb181e2['message']);_0x399e86({'val':0x0});});});}function getTimezoneData(_0x5cf0a1,_0x384d70){return new Promise(function(_0x46ea6e,_0x42931b){var _0x376e6d=shared[_0x7676('0x69')];var _0x2839a8=_0x376e6d[_0x5cf0a1[_0x7676('0x6a')]];if(_[_0x7676('0x1d')](_0x2839a8)){_0x46ea6e({'ret':0x1});}else{var _0x520221=_0x2839a8['utcOffset'];var _0x51f38f=squel[_0x7676('0x29')]()[_0x7676('0x2a')](_0x384d70)['set']('id',_0x5cf0a1['id'])[_0x7676('0x6b')](_0x7676('0x6c'),_0x520221)[_0x7676('0x6b')]('dialTimezone',_0x5cf0a1[_0x7676('0x6a')])[_0x7676('0x3e')]();return db['sequelize'][_0x7676('0x5e')](_0x51f38f)[_0x7676('0x5f')](function(_0x2ce8ae){_0x46ea6e({'ret':0x1});})[_0x7676('0x64')](function(_0x42e767){logger[_0x7676('0x5a')](_0x42e767[_0x7676('0x5b')]);_0x42931b({'ret':0x1});});}});}function handleTZQuery(_0x57a08b){logger['info'](_0x57a08b);return db[_0x7676('0x63')][_0x7676('0x5e')](_0x57a08b)[_0x7676('0x5f')](function(_0x523937){})[_0x7676('0x64')](function(_0x76ab39){logger[_0x7676('0x5a')](_0x76ab39['message']);});}function main(_0x40ae89,_0x1b8f25,_0x2c19d5,_0x18ae9a){logger['info'](_0x7676('0x6d'),_0x40ae89,JSON[_0x7676('0x6e')](_0x1b8f25));process['send'](_0x7676('0x6f'));var _0x2b7aab=_0x1b8f25[_0x7676('0x70')];var _0x27ca02=_['clone'](_0x2b7aab);var _0x452574=_0x1b8f25[_0x7676('0x71')];var _0x2ee6f8=path[_0x7676('0x38')](config[_0x7676('0x72')],'server/files/tmp',_0x452574+_0x7676('0x73'));hasTZ=_[_0x7676('0x52')](_0x2b7aab)[_0x7676('0x74')](_0x7676('0x6a'));var _0x5d78c9=_['keys'](_0x2b7aab)[_0x7676('0x38')]();logger[_0x7676('0x59')]('header',_0x5d78c9);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x7676('0x75')]})[_0x7676('0x18')](function(_0x32d948){for(var _0x3a3578=0x0;_0x3a3578<_0x32d948[_0x7676('0x19')];_0x3a3578++){if(_0x32d948[_0x3a3578][_0x7676('0x75')]in _0x2b7aab){contactItemTypes[_0x7676('0x1a')](_0x32d948[_0x3a3578]);delete _0x27ca02[_0x32d948[_0x3a3578][_0x7676('0x75')]];hasAdditionalPhones=!![];}for(var _0x32329c in _0x2b7aab){if(_0x32d948[_0x3a3578][_0x7676('0x75')]+'_description'===_0x32329c){phoneDescriptions['push']({'itemTypeId':_0x32d948[_0x3a3578]['id'],'description':_0x32329c});delete _0x27ca02[_0x32329c];}}}if(hasAdditionalPhones)_0x27ca02[_0x7676('0x17')]='';var _0x5409ed=_['keys'](_0x27ca02)['join']();logger[_0x7676('0x59')](_0x7676('0x76'),_0x5409ed);fs[_0x7676('0x77')](_0x2ee6f8,_0x5409ed+'\x0a');Papa[_0x7676('0x78')](fs[_0x7676('0x79')](_0x40ae89),{'header':!![],'skipEmptyLines':!![],'step':function(_0x21b530,_0x4ca16e){try{for(var _0x2dd8d6=0x0,_0x2bf1ae=[];_0x2dd8d6<_0x21b530['data'][_0x7676('0x19')];_0x2dd8d6++){stats['rows']+=0x1;if(_0x21b530['errors'][_0x2dd8d6]){handleError(_0x21b530['data'][_0x2dd8d6],_0x21b530[_0x7676('0x5d')][_0x2dd8d6]);}else{var _0x578442=[];var _0x55d274=[];var _0x5704a0={};for(var _0x5ded6f in _0x2b7aab){let _0x240305=contactItemTypes[_0x7676('0x7a')](_0x366d77=>_0x366d77[_0x7676('0x75')]===_0x5ded6f);let _0x12ab03=contactItemTypes[_0x7676('0x7a')](_0x411dc0=>_0x411dc0[_0x7676('0x75')]+'_description'===_0x5ded6f);if(_['isNil'](_0x240305)&&_[_0x7676('0x1d')](_0x12ab03)){if(_0x2b7aab[_0x7676('0x7b')](_0x5ded6f)){if(_0x21b530['data'][_0x2dd8d6][_0x2b7aab[_0x5ded6f]]){var _0x4066f8=_[_0x7676('0x7c')](_0x21b530['data'][_0x2dd8d6][_0x2b7aab[_0x5ded6f]][_0x7676('0x7d')](/"/g,'\x27'));switch(_0x5ded6f){case'scheduledat':var _0x3323ae=moment(_0x4066f8,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3323ae[_0x7676('0x7e')]()){_0x2bf1ae[_0x7676('0x1a')]('\x22'+_0x4066f8+'\x22');}else{_0x578442[_0x7676('0x1a')](_0x7676('0x7f'));}break;case'priority':var _0x348031=parseInt(_0x4066f8);_0x4066f8=_['isNaN'](_0x348031)||_0x348031<0x0||_0x348031>0x4?_0x18ae9a?0x3:0x2:_0x348031;_0x2bf1ae[_0x7676('0x1a')]('\x22'+_0x4066f8+'\x22');break;case _0x7676('0x31'):var _0x481129=parseInt(_0x4066f8);if(_[_0x7676('0x80')](_0x481129)&&_['includes'](_0x2c19d5,_0x481129)){_0x2bf1ae[_0x7676('0x1a')]('\x22'+_0x481129+'\x22');}else{_0x578442['push'](_0x7676('0x81'));}break;case _0x7676('0x82'):if(isEmail(_0x4066f8)){_0x2bf1ae['push']('\x22'+_0x4066f8+'\x22');}else{_0x578442[_0x7676('0x1a')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x2331f7=moment(_0x4066f8,_0x7676('0x83'),!![]);if(_0x2331f7[_0x7676('0x7e')]()){_0x2bf1ae[_0x7676('0x1a')]('\x22'+_0x4066f8+'\x22');}else{_0x578442['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x7676('0x6a'):var _0x9e143c=shared[_0x7676('0x69')];var _0x1e1308=_0x9e143c[_0x4066f8];if(!_[_0x7676('0x1d')](_0x1e1308)){var _0x3768a6=_0x1e1308[_0x7676('0x84')];_0x2bf1ae[_0x7676('0x1a')]('\x22'+_0x4066f8+'\x22');_0x2bf1ae['push']('\x22'+_0x3768a6+'\x22');}break;default:_0x2bf1ae[_0x7676('0x1a')]('\x22'+_0x4066f8+'\x22');}}else{switch(_0x5ded6f){case _0x7676('0x85'):case _0x7676('0x11'):_0x578442['push'](_0x5ded6f+_0x7676('0x86'));break;default:_0x2bf1ae[_0x7676('0x1a')]('\x22\x22');}}}}else{var _0x54bb1d='';if(!_[_0x7676('0x1d')](_0x240305)){if(!_0x5704a0[_0x7676('0x7b')](_0x240305['id'])){if(!_['isNil'](_0x21b530[_0x7676('0x87')][_0x2dd8d6][_0x2b7aab[_0x5ded6f]])){var _0x4066f8=_[_0x7676('0x7c')](_0x21b530['data'][_0x2dd8d6][_0x2b7aab[_0x5ded6f]][_0x7676('0x7d')](/"/g,'\x27'));var _0x5f2484=phoneDescriptions[_0x7676('0x7a')](_0x45c4af=>_0x45c4af[_0x7676('0x88')]===_0x240305['id']);if(!_[_0x7676('0x1d')](_0x5f2484)){var _0xb440ba=_[_0x7676('0x7c')](_0x21b530['data'][_0x2dd8d6][_0x2b7aab[_0x5f2484[_0x7676('0x89')]]][_0x7676('0x7d')](/"/g,'\x27'));if(!_[_0x7676('0x1d')](_0xb440ba))_0x4066f8=_0x4066f8+'§'+_0xb440ba;}if(_0x54bb1d=='')_0x54bb1d=_0x4066f8;else _0x54bb1d+='|'+_0x4066f8;}_0x55d274[_0x7676('0x1a')](_0x240305['id']+':'+_0x54bb1d);_0x5704a0[_0x240305['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2bf1ae[_0x7676('0x1a')]('\x22'+_0x55d274['join'](';')+'\x22');}if(_0x578442[_0x7676('0x19')]){handleError(_0x21b530[_0x7676('0x87')][_0x2dd8d6],{'code':_0x7676('0x8a'),'message':_0x578442[_0x7676('0x38')]()});}else{fs[_0x7676('0x8b')](_0x2ee6f8,_0x2bf1ae['join']()+'\x0a');}_0x2bf1ae=[];}if(!(stats[_0x7676('0x8c')]%0xc8)){socket[_0x7676('0x8d')](_0x7676('0x8e')+_0x452574,stats);stats[_0x7676('0x5d')]=[];}}if(stopped){logger[_0x7676('0x59')](_0x7676('0x8f'));_0x4ca16e['abort']();}}catch(_0x4d364f){handleError(_0x21b530[_0x7676('0x87')][_0x2dd8d6],{'code':_0x7676('0x90'),'message':_0x4d364f['message']});logger[_0x7676('0x5a')](_0x7676('0x91'),_0x4d364f['message']);}},'complete':function(){try{var _0x58b7dd=[];var _0x441b14=[];var _0x4ec377='cm_contacts';if(_0x1b8f25['duplicates']&&_0x1b8f25[_0x7676('0x92')]['length']){_0x4ec377=_0x7676('0x93')+_0x452574;_0x58b7dd['push'](_0x7676('0x94')+_0x4ec377+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x7676('0x95')+_0x452574;tmp_voice_queues=_0x7676('0x96')+_0x452574;_0x441b14[_0x7676('0x1a')](_0x7676('0x94')+tmp_campaigns+_0x7676('0x97'));_0x441b14['push'](_0x7676('0x94')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x441b14,handleTZQuery)[_0x7676('0x18')](function(_0x3147c2){updateTzCampaigns(_0x1b8f25['ListId'])[_0x7676('0x18')](function(_0x7c413e){updateTzVoiceQueues(_0x1b8f25['ListId'])[_0x7676('0x18')](function(_0x3e8420){if(hasTZ)_0x5409ed=_0x5409ed['replace'](_0x7676('0x6a'),_0x7676('0x98'));var _0x178b97=util[_0x7676('0xc')](_0x7676('0x99'),_0x2ee6f8,_0x4ec377,_0x5409ed,_0x1b8f25[_0x7676('0x2e')],_0x1b8f25[_0x7676('0x9a')]||null,NOW,NOW);if(_[_0x7676('0x1d')](_0x2b7aab[_0x7676('0x47')])){_0x178b97+=_0x7676('0x9b');}_0x58b7dd['push'](_0x178b97);if(_0x1b8f25[_0x7676('0x92')]&&_0x1b8f25[_0x7676('0x92')]['length']){_0x58b7dd[_0x7676('0x1a')](insertCmContact(_0x1b8f25['ListId'],_0x4ec377,_0x1b8f25[_0x7676('0x92')],_0x2b7aab));_0x58b7dd[_0x7676('0x1a')](_0x7676('0x9c')+_0x4ec377+';');}BPromise[_0x7676('0x9d')](_0x58b7dd,handleQuery)['then'](function(_0x115fdf){BPromise['all']([handleAdditionalPhones()])[_0x7676('0x18')](function(){_0x58b7dd=[];for(var _0x335b47=0x0;_0x335b47\x20\x20');}var _0x5c25b6=path['join'](config[_0x7676('0x72')],_0x7676('0xa9'),process[_0x7676('0xa8')][0x2]);if(!fs['existsSync'](_0x5c25b6)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x555e53={};try{_0x555e53=JSON[_0x7676('0x78')](process[_0x7676('0xa8')][0x3]);if(!_0x555e53['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x555e53[_0x7676('0x70')][_0x7676('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x555e53[_0x7676('0x70')][_0x7676('0x85')]){throw new Error('firstName\x20is\x20mandatory');}var _0x1860fa=0x0;if(_0x555e53[_0x7676('0x70')]['UserId']){_0x1860fa=0x1;}if(!_0x555e53[_0x7676('0x2e')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x1ae9f1){throw new Error(_0x7676('0xaa'));}var _0x3c8ada=[];try{_0x3c8ada=_['map'](JSON['parse'](process[_0x7676('0xa8')][0x4]),'id');}catch(_0x2712a8){logger[_0x7676('0x59')](_0x7676('0xab'));}main(_0x5c25b6,_0x555e53,_0x3c8ada,_0x1860fa);}validate();process['on']('SIGINT',handleStop);process['on'](_0x7676('0xac'),handleUncaughtException); \ No newline at end of file +var _0x285d=['voice_queues_has_cm_lists.CmListId=','timezones','utcOffset','set','dialTimezone','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','includes','name','_description','parse','createReadStream','data','rows','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','find','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns','affectedRows','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','papaparse','util','bluebird','moment','squel','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','then','AdditionalPhones','split','length','push','all','isNil','filter','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','from','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.ListId','cm_contacts.updatedAt','cm_hopper_black','cm_contacts.ListId\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','createdAt','ListId\x20=\x20?','\x20=\x20','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','CmHopperId','OrderBy','cm_contacts','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId'];(function(_0x1fbfd5,_0x4018cc){var _0xf4a988=function(_0x2e885c){while(--_0x2e885c){_0x1fbfd5['push'](_0x1fbfd5['shift']());}};_0xf4a988(++_0x4018cc);}(_0x285d,0x1b7));var _0xd285=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x285d[_0x5c351c];return _0x26f3b3;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xd285('0x0'));var util=require(_0xd285('0x1'));var BPromise=require(_0xd285('0x2'));var moment=require(_0xd285('0x3'));var squel=require(_0xd285('0x4'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xd285('0x5'));var shared=require(_0xd285('0x6'));var logger=require(_0xd285('0x7'))(_0xd285('0x8'));config[_0xd285('0x9')]=_['defaults'](config[_0xd285('0x9')],{'host':_0xd285('0xa'),'port':0x18eb});var socket=require(_0xd285('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xd285('0xc')](_0xd285('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xd285('0xc')](_0xd285('0xd'));function isEmail(_0x22e395){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'](_0x22e395);}function selectNotIn(_0x36e769,_0x30edc9,_0x3ede5a,_0x4d2982,_0x4da73e){return squel[_0xd285('0xe')]()[_0xd285('0xf')](_0xd285('0x10'))['from'](_0x4d2982)['join'](_0x30edc9,null,_0x30edc9+_0xd285('0x11')+_0x4d2982+'.'+_0x3ede5a)[_0xd285('0x12')](_0x4d2982+'.'+_0x3ede5a+'\x20=\x20'+_0x36e769+'.'+_0x3ede5a)[_0xd285('0x12')](_0x30edc9+_0xd285('0x13')+_0x4da73e[_0xd285('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3df6c9,_0x4f2ad0){promisesAdditionalPhones=[];return db[_0xd285('0x15')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xd285('0x16')](function(_0x3c90c2){if(_0x3c90c2!==null){var _0x5a46a8=[];for(var _0x4e0dbf=0x0;_0x4e0dbf<_0x3c90c2['length'];_0x4e0dbf++){var _0x14f5b6=_0x3c90c2[_0x4e0dbf];_0x5a46a8['push'](insertAdditionalPhones(_0x14f5b6));}}Promise['all'](_0x5a46a8)['then'](function(){_0x3df6c9({'val':0x1});});});});}function insertAdditionalPhones(_0x4c642b){return new Promise(function(_0x26b22f,_0x62da3b){var _0x21d5df=_0x4c642b[_0xd285('0x17')];var _0x179ecc=_0x21d5df[_0xd285('0x18')](';');var _0x1132d5=[];orderBy=0x0;for(var _0x5624f7=0x0;_0x5624f7<_0x179ecc[_0xd285('0x19')];_0x5624f7++){_0x1132d5[_0xd285('0x1a')](splitAdditionalPhone(_0x4c642b['id'],_0x179ecc[_0x5624f7]));}Promise[_0xd285('0x1b')](_0x1132d5)['then'](function(){_0x26b22f({'val':_0x179ecc[_0xd285('0x19')]});});});}function splitAdditionalPhone(_0x3297e4,_0x49b476){return new Promise(function(_0x577d0b,_0x51ef30){var _0x6ba1a3=_0x49b476[_0xd285('0x18')](':');var _0x30abd6=_0x6ba1a3[0x0];var _0x5ba7c8=_0x6ba1a3[0x1];if(!_[_0xd285('0x1c')](_0x5ba7c8)){var _0x5c4006=_0x5ba7c8['split']('|');var _0xe3dabc=[];for(var _0x27f54f=0x0;_0x27f54f<_0x5c4006[_0xd285('0x19')];_0x27f54f++){if(_0x5c4006[_0x27f54f]!==''){var _0x19b85a=_[_0xd285('0x1d')](promisesAdditionalPhones,{'contactId':_0x3297e4,'phone':_0x5c4006[_0x27f54f]});if(_0x19b85a[_0xd285('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0xd285('0x1a')]({'contactId':_0x3297e4,'contactTypeId':_0x30abd6,'phone':_0x5c4006[_0x27f54f],'orderBy':orderBy});}}}_0x577d0b({'ok':0x1});}else _0x577d0b({'res':0x0});});}function createAdditionalPhone(_0x498b46,_0x2acc31,_0x12e968,_0x29fda2){var _0x451eb6='';var _0x1c4120='';var _0x3c148e=_0x12e968[_0xd285('0x18')]('§');_0x451eb6=_0x3c148e[0x0];if(_0x3c148e[_0xd285('0x19')]==0x2)_0x1c4120=_0x3c148e[0x1];return new Promise(function(_0x344a36,_0x258b13){return db[_0xd285('0x1e')]['findOne']({'where':{'CmContactId':_0x498b46,'item':_0x451eb6}})[_0xd285('0x16')](function(_0x524a3c){if(_0x524a3c){return db[_0xd285('0x1e')][_0xd285('0x1f')]({'ItemTypeId':_0x2acc31,'description':_0x1c4120,'OrderBy':_0x29fda2},{'where':{'CmContactId':_0x498b46,'item':_0x451eb6}})[_0xd285('0x16')](function(_0x5882e0){_0x344a36({'res':_0xd285('0x20')});});}else{return db['CmContactHasItem'][_0xd285('0x21')]({'CmContactId':_0x498b46,'item':_0x451eb6,'description':_0x1c4120,'ItemTypeId':_0x2acc31,'OrderBy':_0x29fda2,'ItemClass':_0xd285('0x22')})['then'](function(_0x14741a){_0x344a36({'res':_0xd285('0x23')});});}});});}function insertCmHopper(_0xa61df6,_0xfe3a3f,_0x3be22f,_0x33c4b7,_0x1346d6){var _0x225a09=[_0xd285('0x24'),_0xd285('0x25'),_0xd285('0x26'),'cm_contacts.ListId',_0xfe3a3f+'.'+_0x33c4b7,_0xd285('0x27'),'cm_contacts.updatedAt',_0xd285('0x28'),_0xd285('0x29'),'\x22'+_0x1346d6+'\x22'];return squel[_0xd285('0x2a')]()[_0xd285('0x2b')](_0xd285('0x2c'))[_0xd285('0x2d')]([_0xd285('0x10'),'scheduledat',_0xd285('0x2e'),_0xd285('0x2f'),_0x33c4b7,'createdAt',_0xd285('0x30'),_0xd285('0x31'),_0xd285('0x32'),_0xd285('0x33')],squel[_0xd285('0xe')]()[_0xd285('0x34')](_0x225a09)[_0xd285('0x35')](_0xfe3a3f)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0xfe3a3f+_0xd285('0x36'))['join'](_0x3be22f,null,_0x3be22f+_0xd285('0x11')+_0xfe3a3f+'.'+_0x33c4b7)[_0xd285('0x12')](_0xfe3a3f+_0xd285('0x37'),_0xa61df6)[_0xd285('0x12')](_0xd285('0x38'),NOW)[_0xd285('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xfe3a3f,_0x3be22f,_0x33c4b7,'cm_hopper',[_0xd285('0x39'),_0xd285('0x3a')]))[_0xd285('0x12')](_0xd285('0x3b'),selectNotIn(_0xfe3a3f,_0x3be22f,_0x33c4b7,_0xd285('0x2c'),['\x22always\x22'])))[_0xd285('0x3c')]();}function insertCmHopperBlack(_0x12d45f,_0x3afe9f,_0x4babfc,_0x2dd434){var _0x89b96b=[_0xd285('0x24'),'cm_contacts.id',_0xd285('0x3d'),_0x3afe9f+'.'+_0x2dd434,_0xd285('0x27'),_0xd285('0x3e')];return squel['insert']()[_0xd285('0x2b')](_0xd285('0x3f'))['fromQuery'](['phone',_0xd285('0x2e'),_0xd285('0x2f'),_0x2dd434,'createdAt',_0xd285('0x30')],squel['select']()[_0xd285('0x34')](_0x89b96b)['from'](_0x3afe9f)[_0xd285('0x14')]('cm_contacts',null,_0xd285('0x40')+_0x3afe9f+_0xd285('0x36'))['join'](_0x4babfc,null,_0x4babfc+'.id\x20=\x20'+_0x3afe9f+'.'+_0x2dd434)[_0xd285('0x12')](_0x3afe9f+_0xd285('0x37'),_0x12d45f)[_0xd285('0x12')](_0xd285('0x38'),NOW)[_0xd285('0x12')](_0xd285('0x3b'),squel[_0xd285('0xe')]()[_0xd285('0xf')]('phone')['from'](_0xd285('0x3f'))[_0xd285('0x12')]('ListId\x20=\x20?',_0x12d45f)[_0xd285('0x12')](_0x2dd434+'\x20=\x20'+_0x3afe9f+'.'+_0x2dd434)))[_0xd285('0x3c')]();}function insertTzCmHopper(_0x55f399,_0x860d46,_0x3d010c,_0x390ef9,_0x1c9d7e,_0x20291b){var _0x26761b=[_0xd285('0x24'),_0xd285('0x41')+_0x20291b+_0xd285('0x42'),_0xd285('0x26'),'cm_contacts.ListId',_0x860d46+'.'+_0x390ef9,_0xd285('0x27'),_0xd285('0x3e'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x1c9d7e+'\x22'];var _0x3d6389=squel[_0xd285('0x2a')]()[_0xd285('0x2b')](_0xd285('0x2c'))[_0xd285('0x2d')]([_0xd285('0x10'),_0xd285('0x43'),'ContactId',_0xd285('0x2f'),_0x390ef9,'createdAt',_0xd285('0x30'),_0xd285('0x31'),_0xd285('0x32'),_0xd285('0x33')],squel[_0xd285('0xe')]()[_0xd285('0x34')](_0x26761b)[_0xd285('0x35')](_0x860d46)[_0xd285('0x14')]('cm_contacts',null,_0xd285('0x40')+_0x860d46+_0xd285('0x36'))['join'](_0x3d010c,null,_0x3d010c+_0xd285('0x11')+_0x860d46+'.'+_0x390ef9)[_0xd285('0x14')](_0x20291b,null,_0x20291b+_0xd285('0x11')+_0x860d46+'.'+_0x390ef9)[_0xd285('0x12')](_0x860d46+_0xd285('0x37'),_0x55f399)[_0xd285('0x12')](_0xd285('0x38'),NOW)['where'](_0xd285('0x3b'),selectNotIn(_0x860d46,_0x3d010c,_0x390ef9,_0xd285('0x2c'),[_0xd285('0x39'),'\x22onlyIfOpen\x22']))[_0xd285('0x12')](_0xd285('0x3b'),selectNotIn(_0x860d46,_0x3d010c,_0x390ef9,_0xd285('0x2c'),[_0xd285('0x39')])))['toString']();return _0x3d6389;}function insertTzCmHopperBlack(_0xfef1ef,_0x2ff288,_0x2d7c60,_0x821e90){var _0x295fcb=[_0xd285('0x24'),_0xd285('0x26'),_0xd285('0x3d'),_0x2ff288+'.'+_0x821e90,_0xd285('0x27'),_0xd285('0x3e')];return squel[_0xd285('0x2a')]()[_0xd285('0x2b')](_0xd285('0x3f'))['fromQuery']([_0xd285('0x10'),_0xd285('0x2e'),_0xd285('0x2f'),_0x821e90,_0xd285('0x44'),_0xd285('0x30')],squel[_0xd285('0xe')]()[_0xd285('0x34')](_0x295fcb)['from'](_0x2ff288)['join']('cm_contacts',null,_0xd285('0x40')+_0x2ff288+_0xd285('0x36'))[_0xd285('0x14')](_0x2d7c60,null,_0x2d7c60+_0xd285('0x11')+_0x2ff288+'.'+_0x821e90)[_0xd285('0x12')](_0x2ff288+_0xd285('0x37'),_0xfef1ef)[_0xd285('0x12')](_0xd285('0x38'),NOW)[_0xd285('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xd285('0xe')]()[_0xd285('0xf')]('phone')['from']('cm_hopper_black')[_0xd285('0x12')](_0xd285('0x45'),_0xfef1ef)[_0xd285('0x12')](_0x821e90+_0xd285('0x46')+_0x2ff288+'.'+_0x821e90)))['toString']();}function insertCmHopperAdditionalPhones(_0x373662){var _0x5c9b66=[_0xd285('0x47'),_0xd285('0x48'),'cm_contact_has_items.OrderBy',_0xd285('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0xd285('0x2a')]()['into']('cm_hopper_additional_phones')[_0xd285('0x2d')]([_0xd285('0x4a'),_0xd285('0x10'),_0xd285('0x4b'),'createdAt',_0xd285('0x30')],squel[_0xd285('0xe')]()[_0xd285('0x34')](_0x5c9b66)[_0xd285('0x35')]('cm_hopper')['join'](_0xd285('0x4c'),null,_0xd285('0x4d'))['join'](_0xd285('0x4e'),null,_0xd285('0x4f'))[_0xd285('0x12')]('cm_hopper.ListId\x20=\x20?',_0x373662)[_0xd285('0x12')](_0xd285('0x38'),NOW))[_0xd285('0x3c')]();}function insertCmContact(_0x15c8c6,_0x543c27,_0x10931c,_0x3ab8b7){var _0x3756cc=_[_0xd285('0x50')](_[_0xd285('0x51')](_0x3ab8b7),['ListId',_0xd285('0x52'),_0xd285('0x44'),_0xd285('0x30'),_0xd285('0x53')]);return squel[_0xd285('0x2a')]()[_0xd285('0x2b')](_0xd285('0x4c'))[_0xd285('0x2d')](_0x3756cc,squel['select']()['fields'](_0x3756cc)[_0xd285('0x35')](_0x543c27)[_0xd285('0x12')]('('+_0x10931c[_0xd285('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0xd285('0xe')]()['fields'](_0x10931c)['from'](_0xd285('0x4c'))[_0xd285('0x12')](_0xd285('0x45'),_0x15c8c6)['where'](_0xd285('0x54')))[_0xd285('0x12')](_0xd285('0x55'),squel[_0xd285('0xe')]()[_0xd285('0xf')](_0xd285('0x56'),_0xd285('0x57'))['from'](_0x543c27)[_0xd285('0x58')](_0x10931c[_0xd285('0x14')](','))))[_0xd285('0x3c')]();}function handleStop(){logger[_0xd285('0x59')](_0xd285('0x5a'));stopped=!![];}function handleUncaughtException(_0x14b52d){logger[_0xd285('0x5b')](_0x14b52d[_0xd285('0x5c')]);process[_0xd285('0x5d')](0x1);}function handleError(_0x4520a2,_0x200dd1){stats[_0xd285('0x5e')][_0xd285('0x1a')]({'name':_0x200dd1[_0xd285('0x5f')],'message':_0x200dd1[_0xd285('0x5c')],'row':_0x4520a2});}function handleQuery(_0x25aae0){logger[_0xd285('0x59')](_0x25aae0);return db[_0xd285('0x60')][_0xd285('0x61')](_0x25aae0)[_0xd285('0x62')](function(_0x316019){results[_0xd285('0x1a')](_0x316019);})[_0xd285('0x63')](function(_0x511b1a){logger[_0xd285('0x5b')](_0x511b1a['message']);});}function updateTzCampaigns(_0x4f3396){return new Promise(function(_0x5198c6,_0xa36aee){var _0x138cf8=squel['select']()[_0xd285('0x34')]([_0xd285('0x64'),_0xd285('0x65')])['from']('campaigns')[_0xd285('0x14')](_0xd285('0x66'),null,_0xd285('0x67'))[_0xd285('0x12')](_0xd285('0x68')+_0x4f3396);db[_0xd285('0x60')][_0xd285('0x61')](_0x138cf8[_0xd285('0x3c')]())[_0xd285('0x62')](function(_0xc8dfb8){var _0x5b35a3=[];for(var _0x1e7e17=0x0;_0x1e7e17<_0xc8dfb8[_0xd285('0x19')];_0x1e7e17++){_0x5b35a3[_0xd285('0x1a')](getTimezoneData(_0xc8dfb8[_0x1e7e17],tmp_campaigns));}BPromise[_0xd285('0x1b')](_0x5b35a3)[_0xd285('0x16')](function(){_0x5198c6({'val':0x1});});})['catch'](function(_0x11d922){logger[_0xd285('0x5b')](_0x11d922['message']);_0x5198c6({'val':0x0});});});}function updateTzVoiceQueues(_0x55ad17){return new Promise(function(_0x1e48a4,_0xacf21f){var _0x1953e9=squel[_0xd285('0xe')]()[_0xd285('0x34')]([_0xd285('0x69'),_0xd285('0x6a')])['from'](_0xd285('0x6b'))[_0xd285('0x14')](_0xd285('0x6c'),null,_0xd285('0x6d'))[_0xd285('0x12')](_0xd285('0x6e')+_0x55ad17);db[_0xd285('0x60')]['query'](_0x1953e9[_0xd285('0x3c')]())['spread'](function(_0x573ec3){var _0x52e32d=[];for(var _0x378239=0x0;_0x378239<_0x573ec3[_0xd285('0x19')];_0x378239++){_0x52e32d[_0xd285('0x1a')](getTimezoneData(_0x573ec3[_0x378239],tmp_voice_queues));}BPromise[_0xd285('0x1b')](_0x52e32d)[_0xd285('0x16')](function(){_0x1e48a4({'val':0x1});});})['catch'](function(_0x118a99){logger[_0xd285('0x5b')](_0x118a99[_0xd285('0x5c')]);_0x1e48a4({'val':0x0});});});}function getTimezoneData(_0x463593,_0x4bb1a6){return new Promise(function(_0x2cbd87,_0x5ee33c){var _0x21930c=shared[_0xd285('0x6f')];var _0x477bec=_0x21930c[_0x463593['dialTimezone']];if(_[_0xd285('0x1c')](_0x477bec)){_0x2cbd87({'ret':0x1});}else{var _0xc1bc48=_0x477bec[_0xd285('0x70')];var _0x46b188=squel[_0xd285('0x2a')]()[_0xd285('0x2b')](_0x4bb1a6)[_0xd285('0x71')]('id',_0x463593['id'])['set']('offset',_0xc1bc48)[_0xd285('0x71')](_0xd285('0x72'),_0x463593[_0xd285('0x72')])[_0xd285('0x3c')]();return db[_0xd285('0x60')][_0xd285('0x61')](_0x46b188)[_0xd285('0x62')](function(_0x2e056b){_0x2cbd87({'ret':0x1});})[_0xd285('0x63')](function(_0x35ea86){logger[_0xd285('0x5b')](_0x35ea86[_0xd285('0x5c')]);_0x5ee33c({'ret':0x1});});}});}function handleTZQuery(_0x5d960a){logger['info'](_0x5d960a);return db[_0xd285('0x60')][_0xd285('0x61')](_0x5d960a)[_0xd285('0x62')](function(_0x2286f7){})[_0xd285('0x63')](function(_0x8d2b4a){logger[_0xd285('0x5b')](_0x8d2b4a[_0xd285('0x5c')]);});}function main(_0x525fa6,_0xbe900a,_0x289c0d,_0x4709d7){logger[_0xd285('0x59')](_0xd285('0x73'),_0x525fa6,JSON[_0xd285('0x74')](_0xbe900a));process[_0xd285('0x75')](_0xd285('0x76'));var _0x27777e=_0xbe900a[_0xd285('0x77')];var _0x9ead39=_[_0xd285('0x78')](_0x27777e);var _0x14e80c=_0xbe900a[_0xd285('0x79')];var _0x551c8b=path['join'](config[_0xd285('0x7a')],_0xd285('0x7b'),_0x14e80c+'.csv');hasTZ=_[_0xd285('0x51')](_0x27777e)[_0xd285('0x7c')]('dialTimezone');var _0x1eef75=_['keys'](_0x27777e)[_0xd285('0x14')]();logger[_0xd285('0x59')]('header',_0x1eef75);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id','name']})[_0xd285('0x16')](function(_0x1283db){for(var _0x39068d=0x0;_0x39068d<_0x1283db[_0xd285('0x19')];_0x39068d++){if(_0x1283db[_0x39068d][_0xd285('0x7d')]in _0x27777e){contactItemTypes[_0xd285('0x1a')](_0x1283db[_0x39068d]);delete _0x9ead39[_0x1283db[_0x39068d][_0xd285('0x7d')]];hasAdditionalPhones=!![];}for(var _0x174a4e in _0x27777e){if(_0x1283db[_0x39068d][_0xd285('0x7d')]+_0xd285('0x7e')===_0x174a4e){phoneDescriptions[_0xd285('0x1a')]({'itemTypeId':_0x1283db[_0x39068d]['id'],'description':_0x174a4e});delete _0x9ead39[_0x174a4e];}}}if(hasAdditionalPhones)_0x9ead39[_0xd285('0x17')]='';var _0x32f30a=_[_0xd285('0x51')](_0x9ead39)[_0xd285('0x14')]();logger['info']('header',_0x32f30a);fs['writeFileSync'](_0x551c8b,_0x32f30a+'\x0a');Papa[_0xd285('0x7f')](fs[_0xd285('0x80')](_0x525fa6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5ddcdd,_0x384e2e){try{for(var _0x3fb7a7=0x0,_0x1d5539=[];_0x3fb7a7<_0x5ddcdd[_0xd285('0x81')][_0xd285('0x19')];_0x3fb7a7++){stats[_0xd285('0x82')]+=0x1;if(_0x5ddcdd[_0xd285('0x5e')][_0x3fb7a7]){handleError(_0x5ddcdd[_0xd285('0x81')][_0x3fb7a7],_0x5ddcdd[_0xd285('0x5e')][_0x3fb7a7]);}else{var _0x30f101=[];var _0x37ae80=[];var _0x160f7d={};for(var _0x376c9a in _0x27777e){let _0x557cb4=contactItemTypes['find'](_0x532ceb=>_0x532ceb[_0xd285('0x7d')]===_0x376c9a);let _0x55a8f8=contactItemTypes['find'](_0x12791b=>_0x12791b[_0xd285('0x7d')]+_0xd285('0x7e')===_0x376c9a);if(_[_0xd285('0x1c')](_0x557cb4)&&_[_0xd285('0x1c')](_0x55a8f8)){if(_0x27777e['hasOwnProperty'](_0x376c9a)){if(_0x5ddcdd[_0xd285('0x81')][_0x3fb7a7][_0x27777e[_0x376c9a]]){var _0x2ef8b7=_[_0xd285('0x83')](_0x5ddcdd[_0xd285('0x81')][_0x3fb7a7][_0x27777e[_0x376c9a]][_0xd285('0x84')](/"/g,'\x27'));switch(_0x376c9a){case _0xd285('0x43'):var _0x5a1dbd=moment(_0x2ef8b7,_0xd285('0xd'),!![]);if(_0x5a1dbd[_0xd285('0x85')]()){_0x1d5539[_0xd285('0x1a')]('\x22'+_0x2ef8b7+'\x22');}else{_0x30f101[_0xd285('0x1a')](_0xd285('0x86'));}break;case _0xd285('0x31'):var _0x4278f3=parseInt(_0x2ef8b7);_0x2ef8b7=_[_0xd285('0x87')](_0x4278f3)||_0x4278f3<0x0||_0x4278f3>0x4?_0x4709d7?0x3:0x2:_0x4278f3;_0x1d5539[_0xd285('0x1a')]('\x22'+_0x2ef8b7+'\x22');break;case _0xd285('0x32'):var _0x4285f0=parseInt(_0x2ef8b7);if(_[_0xd285('0x88')](_0x4285f0)&&_[_0xd285('0x7c')](_0x289c0d,_0x4285f0)){_0x1d5539[_0xd285('0x1a')]('\x22'+_0x4285f0+'\x22');}else{_0x30f101['push'](_0xd285('0x89'));}break;case _0xd285('0x8a'):if(isEmail(_0x2ef8b7)){_0x1d5539[_0xd285('0x1a')]('\x22'+_0x2ef8b7+'\x22');}else{_0x30f101[_0xd285('0x1a')]('email\x20wrong\x20format');}break;case _0xd285('0x8b'):var _0x4f8dc5=moment(_0x2ef8b7,'YYYY-MM-DD',!![]);if(_0x4f8dc5[_0xd285('0x85')]()){_0x1d5539[_0xd285('0x1a')]('\x22'+_0x2ef8b7+'\x22');}else{_0x30f101[_0xd285('0x1a')](_0xd285('0x8c'));}break;case _0xd285('0x72'):var _0x416e33=shared[_0xd285('0x6f')];var _0x43878f=_0x416e33[_0x2ef8b7];if(!_[_0xd285('0x1c')](_0x43878f)){var _0x2b0872=_0x43878f[_0xd285('0x70')];_0x1d5539['push']('\x22'+_0x2ef8b7+'\x22');_0x1d5539[_0xd285('0x1a')]('\x22'+_0x2b0872+'\x22');}break;default:_0x1d5539[_0xd285('0x1a')]('\x22'+_0x2ef8b7+'\x22');}}else{switch(_0x376c9a){case'firstName':case _0xd285('0x10'):_0x30f101['push'](_0x376c9a+_0xd285('0x8d'));break;default:_0x1d5539[_0xd285('0x1a')]('\x22\x22');}}}}else{var _0x267ff3='';if(!_[_0xd285('0x1c')](_0x557cb4)){if(!_0x160f7d['hasOwnProperty'](_0x557cb4['id'])){if(!_[_0xd285('0x1c')](_0x5ddcdd[_0xd285('0x81')][_0x3fb7a7][_0x27777e[_0x376c9a]])){var _0x2ef8b7=_[_0xd285('0x83')](_0x5ddcdd[_0xd285('0x81')][_0x3fb7a7][_0x27777e[_0x376c9a]][_0xd285('0x84')](/"/g,'\x27'));var _0x2a9b39=phoneDescriptions[_0xd285('0x8e')](_0x19394e=>_0x19394e['itemTypeId']===_0x557cb4['id']);if(!_[_0xd285('0x1c')](_0x2a9b39)){var _0x5bdab4=_['trim'](_0x5ddcdd[_0xd285('0x81')][_0x3fb7a7][_0x27777e[_0x2a9b39[_0xd285('0x8f')]]][_0xd285('0x84')](/"/g,'\x27'));if(!_['isNil'](_0x5bdab4))_0x2ef8b7=_0x2ef8b7+'§'+_0x5bdab4;}if(_0x267ff3=='')_0x267ff3=_0x2ef8b7;else _0x267ff3+='|'+_0x2ef8b7;}_0x37ae80['push'](_0x557cb4['id']+':'+_0x267ff3);_0x160f7d[_0x557cb4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1d5539[_0xd285('0x1a')]('\x22'+_0x37ae80[_0xd285('0x14')](';')+'\x22');}if(_0x30f101[_0xd285('0x19')]){handleError(_0x5ddcdd['data'][_0x3fb7a7],{'code':_0xd285('0x90'),'message':_0x30f101[_0xd285('0x14')]()});}else{fs[_0xd285('0x91')](_0x551c8b,_0x1d5539[_0xd285('0x14')]()+'\x0a');}_0x1d5539=[];}if(!(stats[_0xd285('0x82')]%0xc8)){socket[_0xd285('0x92')](_0xd285('0x93')+_0x14e80c,stats);stats['errors']=[];}}if(stopped){logger['info'](_0xd285('0x94'));_0x384e2e[_0xd285('0x95')]();}}catch(_0x4612d5){handleError(_0x5ddcdd[_0xd285('0x81')][_0x3fb7a7],{'code':_0xd285('0x96'),'message':_0x4612d5['message']});logger[_0xd285('0x5b')](_0xd285('0x97'),_0x4612d5['message']);}},'complete':function(){try{var _0x253a7c=[];var _0x14aa54=[];var _0x56fdff=_0xd285('0x4c');if(_0xbe900a[_0xd285('0x98')]&&_0xbe900a[_0xd285('0x98')][_0xd285('0x19')]){_0x56fdff=_0xd285('0x99')+_0x14e80c;_0x253a7c[_0xd285('0x1a')]('CREATE\x20TABLE\x20'+_0x56fdff+_0xd285('0x9a'));}tmp_campaigns=_0xd285('0x9b')+_0x14e80c;tmp_voice_queues=_0xd285('0x9c')+_0x14e80c;_0x14aa54['push'](_0xd285('0x9d')+tmp_campaigns+_0xd285('0x9e'));_0x14aa54['push'](_0xd285('0x9d')+tmp_voice_queues+_0xd285('0x9e'));BPromise[_0xd285('0x9f')](_0x14aa54,handleTZQuery)[_0xd285('0x16')](function(_0x497e12){updateTzCampaigns(_0xbe900a[_0xd285('0x2f')])[_0xd285('0x16')](function(_0xcdb8e8){updateTzVoiceQueues(_0xbe900a[_0xd285('0x2f')])['then'](function(_0x1d8f86){if(hasTZ)_0x32f30a=_0x32f30a[_0xd285('0x84')]('dialTimezone',_0xd285('0xa0'));var _0xaf4642=util[_0xd285('0xc')]('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',_0x551c8b,_0x56fdff,_0x32f30a,_0xbe900a[_0xd285('0x2f')],_0xbe900a[_0xd285('0x52')]||null,NOW,NOW);if(_[_0xd285('0x1c')](_0x27777e['scheduledat'])){_0xaf4642+=_0xd285('0xa1');}_0x253a7c['push'](_0xaf4642);if(_0xbe900a[_0xd285('0x98')]&&_0xbe900a[_0xd285('0x98')]['length']){_0x253a7c[_0xd285('0x1a')](insertCmContact(_0xbe900a['ListId'],_0x56fdff,_0xbe900a[_0xd285('0x98')],_0x27777e));_0x253a7c['push'](_0xd285('0xa2')+_0x56fdff+';');}BPromise[_0xd285('0x9f')](_0x253a7c,handleQuery)[_0xd285('0x16')](function(_0x1d6c31){BPromise[_0xd285('0x1b')]([handleAdditionalPhones()])[_0xd285('0x16')](function(){_0x253a7c=[];for(var _0x44a7bd=0x0;_0x44a7bd\x20\x20','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','length','isNil','push','then','catch','message','AdditionalPhones','split','filter','CmContactHasItem','update','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','createdAt','updatedAt','priority','UserId','recallme','fields'];(function(_0x2abe1e,_0x4d6eae){var _0x4fc59e=function(_0x578610){while(--_0x578610){_0x2abe1e['push'](_0x2abe1e['shift']());}};_0x4fc59e(++_0x4d6eae);}(_0x9c00,0x1a0));var _0x09c0=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0x9c00[_0x4382bc];return _0x13c82a;};'use strict';var fs=require('fs');var path=require(_0x09c0('0x0'));var _=require(_0x09c0('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var squel=require('squel');var Redis=require(_0x09c0('0x4'));var db=require(_0x09c0('0x5'))['db'];var config=require(_0x09c0('0x6'));var logger=require(_0x09c0('0x7'))(_0x09c0('0x8'));config['redis']=_['defaults'](config[_0x09c0('0x9')],{'host':_0x09c0('0xa'),'port':0x18eb});var socket=require(_0x09c0('0xb'))(new Redis(config[_0x09c0('0x9')]));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()[_0x09c0('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x09c0('0xd')+moment()[_0x09c0('0xc')](_0x09c0('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1feb1d){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))*$/[_0x09c0('0xf')](_0x1feb1d);}function selectNotIn(_0x1e16f4,_0x1fec4f,_0x36f26d,_0x278f8b,_0x4523ea){return squel[_0x09c0('0x10')]()[_0x09c0('0x11')](_0x09c0('0x12'))[_0x09c0('0x13')](_0x278f8b)[_0x09c0('0x14')](_0x1fec4f,null,_0x1fec4f+_0x09c0('0x15')+_0x278f8b+'.'+_0x36f26d)[_0x09c0('0x16')](_0x278f8b+'.'+_0x36f26d+_0x09c0('0x17')+_0x1e16f4+'.'+_0x36f26d)[_0x09c0('0x16')](_0x1fec4f+_0x09c0('0x18')+_0x4523ea[_0x09c0('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x254598,_0x152140){promisesAdditionalPhones=[];promisesContact=[];return db[_0x09c0('0x19')][_0x09c0('0x1a')](_0x09c0('0x1b')+tempTableName)['spread'](function(_0x590129){if(_0x590129!==null){var _0x558b4f=[];for(var _0x42030d=0x0;_0x42030d<_0x590129[_0x09c0('0x1c')];_0x42030d++){var _0x3991c6=_0x590129[_0x42030d];if(!_[_0x09c0('0x1d')](_0x3991c6['phone'])){if(!_[_0x09c0('0x1d')](_0x3991c6['AdditionalPhones']))_0x558b4f['push'](insertAdditionalPhones(_0x3991c6));promisesContact[_0x09c0('0x1e')]({'contact':_0x3991c6});}}}Promise['all'](_0x558b4f)[_0x09c0('0x1f')](function(){_0x254598({'val':0x1});});})[_0x09c0('0x20')](function(_0x2da257){logger['error'](_0x2da257[_0x09c0('0x21')]);});});}function insertAdditionalPhones(_0x44f714){return new Promise(function(_0x8ad645,_0x3447c5){var _0x12bba7=_0x44f714[_0x09c0('0x22')];if(_[_0x09c0('0x1d')](_0x12bba7))_0x3447c5({'val':0x0});else{var _0x5d5391=_0x12bba7[_0x09c0('0x23')](';');var _0x46f171=[];orderBy=0x0;for(var _0x473fbd=0x0;_0x473fbd<_0x5d5391[_0x09c0('0x1c')];_0x473fbd++){_0x46f171['push'](splitAdditionalPhone(_0x44f714['id'],_0x5d5391[_0x473fbd]));}Promise['all'](_0x46f171)[_0x09c0('0x1f')](function(){_0x8ad645({'val':_0x5d5391[_0x09c0('0x1c')]});});}});}function splitAdditionalPhone(_0x1e8a1c,_0x3a5370){return new Promise(function(_0x491e6f,_0x42ebfc){var _0x120418=_0x3a5370['split'](':');var _0x2c7202=_0x120418[0x0];var _0x163a59=_0x120418[0x1];if(_0x163a59!==''){var _0x2e3d4d=_0x163a59[_0x09c0('0x23')]('|');var _0x1f8131=[];for(var _0x1d2d9d=0x0;_0x1d2d9d<_0x2e3d4d[_0x09c0('0x1c')];_0x1d2d9d++){if(_0x2e3d4d[_0x1d2d9d]!==''){var _0x35b61c=_[_0x09c0('0x24')](promisesAdditionalPhones,{'contactId':_0x1e8a1c,'phone':_0x2e3d4d[_0x1d2d9d]});if(_0x35b61c[_0x09c0('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x09c0('0x1e')]({'contactId':_0x1e8a1c,'contactTypeId':_0x2c7202,'phone':_0x2e3d4d[_0x1d2d9d],'orderBy':orderBy});}}}_0x491e6f({'ok':0x1});}else _0x491e6f({'res':0x0});});}function createAdditionalPhone(_0x5e53ac,_0x15a667,_0x1bdde9,_0x53a7b8){var _0x1d09e0='';var _0x5aa0b9='';var _0x3f5b10=_0x1bdde9['split']('§');_0x1d09e0=_0x3f5b10[0x0];if(_0x3f5b10[_0x09c0('0x1c')]==0x2)_0x5aa0b9=_0x3f5b10[0x1];return new Promise(function(_0x24e371,_0x108409){return db[_0x09c0('0x25')]['findOne']({'where':{'CmContactId':_0x5e53ac,'item':_0x1d09e0}})['then'](function(_0x17c374){if(_0x17c374){return db[_0x09c0('0x25')][_0x09c0('0x26')]({'ItemTypeId':_0x15a667,'description':_0x5aa0b9,'OrderBy':_0x53a7b8},{'where':{'CmContactId':_0x5e53ac,'item':_0x1d09e0}})['then'](function(_0x321ee6){_0x24e371({'res':'updated'});});}else{return db[_0x09c0('0x25')][_0x09c0('0x27')]({'CmContactId':_0x5e53ac,'item':_0x1d09e0,'ItemTypeId':_0x15a667,'description':_0x5aa0b9,'OrderBy':_0x53a7b8,'ItemClass':_0x09c0('0x28')})['then'](function(_0x1b170d){_0x24e371({'res':_0x09c0('0x29')});});}});});}function updateContact(_0xbb7685){return new Promise(function(_0x184c0b,_0x234f07){var _0xaabbb6=_0xbb7685['id'];delete _0xbb7685['id'];return db[_0x09c0('0x2a')]['update'](_0xbb7685,{'where':{'id':_0xaabbb6}})[_0x09c0('0x1f')](function(_0x2c19be){updatedRows+=0x1;return db[_0x09c0('0x2b')][_0x09c0('0x26')]({'phone':_0xbb7685[_0x09c0('0x12')]},{'where':{'ContactId':_0xaabbb6}})['then'](function(_0x920e2c){_0x184c0b({'ret':'OK'});});});});}function insertCmHopper(_0x20349e,_0xca8ae9,_0x12358f,_0x353454,_0x541d0a){var _0x149684=[_0x09c0('0x2c'),_0x09c0('0x2d'),_0x09c0('0x2e'),_0x09c0('0x2f'),_0xca8ae9+'.'+_0x353454,_0x09c0('0x30'),_0x09c0('0x31'),'cm_contacts.priority',_0x09c0('0x32'),'\x22'+_0x541d0a+'\x22'];return squel[_0x09c0('0x33')]()[_0x09c0('0x34')](_0x09c0('0x35'))[_0x09c0('0x36')](['phone','scheduledat','ContactId','ListId',_0x353454,_0x09c0('0x37'),_0x09c0('0x38'),_0x09c0('0x39'),_0x09c0('0x3a'),_0x09c0('0x3b')],squel['select']()[_0x09c0('0x3c')](_0x149684)[_0x09c0('0x13')](_0xca8ae9)['join'](_0x09c0('0x3d'),null,'cm_contacts.ListId\x20=\x20'+_0xca8ae9+_0x09c0('0x3e'))['join'](_0x12358f,null,_0x12358f+_0x09c0('0x15')+_0xca8ae9+'.'+_0x353454)[_0x09c0('0x16')](_0xca8ae9+'.CmListId\x20=\x20?',_0x20349e)[_0x09c0('0x16')](_0x09c0('0x3f'),NOW)['where'](_0x09c0('0x40'),selectNotIn(_0xca8ae9,_0x12358f,_0x353454,_0x09c0('0x35'),[_0x09c0('0x41'),_0x09c0('0x42')]))[_0x09c0('0x16')](_0x09c0('0x40'),selectNotIn(_0xca8ae9,_0x12358f,_0x353454,'cm_hopper',[_0x09c0('0x41')])))[_0x09c0('0x43')]();}function insertCmHopperBlack(_0x2d6344,_0x57835c,_0x193ed2,_0x30c0c5){var _0x447224=['cm_contacts.phone',_0x09c0('0x2e'),_0x09c0('0x2f'),_0x57835c+'.'+_0x30c0c5,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x09c0('0x33')]()[_0x09c0('0x34')]('cm_hopper_black')[_0x09c0('0x36')]([_0x09c0('0x12'),'ContactId',_0x09c0('0x44'),_0x30c0c5,_0x09c0('0x37'),_0x09c0('0x38')],squel[_0x09c0('0x10')]()[_0x09c0('0x3c')](_0x447224)['from'](_0x57835c)[_0x09c0('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x57835c+_0x09c0('0x3e'))[_0x09c0('0x14')](_0x193ed2,null,_0x193ed2+_0x09c0('0x15')+_0x57835c+'.'+_0x30c0c5)[_0x09c0('0x16')](_0x57835c+_0x09c0('0x45'),_0x2d6344)[_0x09c0('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x09c0('0x10')]()[_0x09c0('0x11')](_0x09c0('0x12'))['from'](_0x09c0('0x46'))[_0x09c0('0x16')](_0x09c0('0x47'),_0x2d6344)[_0x09c0('0x16')](_0x30c0c5+_0x09c0('0x48'),_0x57835c+'.'+_0x30c0c5)))[_0x09c0('0x43')]();}function insertCmHopperAdditionalPhones(_0x298ab4){var _0x2b3c56=[_0x09c0('0x49'),_0x09c0('0x4a'),_0x09c0('0x4b'),_0x09c0('0x4c'),_0x09c0('0x4d')];return squel[_0x09c0('0x33')]()[_0x09c0('0x34')](_0x09c0('0x4e'))[_0x09c0('0x36')]([_0x09c0('0x4f'),_0x09c0('0x12'),_0x09c0('0x50'),'createdAt',_0x09c0('0x38')],squel[_0x09c0('0x10')]()[_0x09c0('0x3c')](_0x2b3c56)[_0x09c0('0x13')](_0x09c0('0x35'))['join'](_0x09c0('0x3d'),null,_0x09c0('0x51'))[_0x09c0('0x14')]('cm_contact_has_items',null,_0x09c0('0x52'))[_0x09c0('0x16')](_0x09c0('0x53'),_0x298ab4)[_0x09c0('0x16')](_0x09c0('0x3f'),NOW))[_0x09c0('0x43')]();}function insertCmContact(_0x45ecd0,_0x499905,_0x1285f8,_0x42a16c){var _0x12f881=_[_0x09c0('0x54')](_[_0x09c0('0x55')](_0x42a16c),[_0x09c0('0x44'),_0x09c0('0x56'),'createdAt','updatedAt']);return squel[_0x09c0('0x33')]()[_0x09c0('0x34')](_0x09c0('0x3d'))['fromQuery'](_0x12f881,squel[_0x09c0('0x10')]()['fields'](_0x12f881)[_0x09c0('0x13')](_0x499905)[_0x09c0('0x16')]('('+_0x1285f8[_0x09c0('0x14')](',')+_0x09c0('0x57'),squel[_0x09c0('0x10')]()[_0x09c0('0x3c')](_0x1285f8)[_0x09c0('0x13')]('cm_contacts')[_0x09c0('0x16')](_0x09c0('0x47'),_0x45ecd0))[_0x09c0('0x16')](_0x09c0('0x58'),squel[_0x09c0('0x10')]()[_0x09c0('0x11')](_0x09c0('0x59'),_0x09c0('0x5a'))[_0x09c0('0x13')](_0x499905)[_0x09c0('0x5b')](_0x1285f8[_0x09c0('0x14')](','))))['toString']();}function handleStop(){logger[_0x09c0('0x5c')](_0x09c0('0x5d'));stopped=!![];}function handleUncaughtException(_0x26dc22){logger[_0x09c0('0x5e')](_0x26dc22['message']);process[_0x09c0('0x5f')](0x1);}function handleError(_0x48dae0,_0x29205f){stats[_0x09c0('0x60')][_0x09c0('0x1e')]({'name':_0x29205f['code'],'message':_0x29205f['message'],'row':_0x48dae0});}function handleQuery(_0x3fe5fd){logger[_0x09c0('0x5c')](_0x3fe5fd);return db[_0x09c0('0x19')][_0x09c0('0x1a')](_0x3fe5fd)['spread'](function(_0x247c3d){results[_0x09c0('0x1e')](_0x247c3d);})['catch'](function(_0x372320){logger[_0x09c0('0x5e')](_0x372320[_0x09c0('0x21')]);});}function main(_0x296d16,_0x51b598,_0x8d27a5,_0x24f23b){logger[_0x09c0('0x5c')](_0x09c0('0x61'),_0x296d16,JSON[_0x09c0('0x62')](_0x51b598));process[_0x09c0('0x63')](_0x09c0('0x64'));var _0x63dda8=_0x51b598[_0x09c0('0x65')];var _0x2722fb=_[_0x09c0('0x66')](_0x63dda8);var _0x2906cb=_0x51b598[_0x09c0('0x67')];var _0x484df5=path[_0x09c0('0x14')](config[_0x09c0('0x68')],_0x09c0('0x69'),_0x2906cb+_0x09c0('0x6a'));logger[_0x09c0('0x5c')]('body',_0x51b598);db[_0x09c0('0x6b')][_0x09c0('0x6c')]({'raw':!![],'attributes':['id',_0x09c0('0x6d')]})[_0x09c0('0x1f')](function(_0x5c88f1){for(var _0x1d395e=0x0;_0x1d395e<_0x5c88f1[_0x09c0('0x1c')];_0x1d395e++){if(_0x5c88f1[_0x1d395e]['name']in _0x63dda8){contactItemTypes[_0x09c0('0x1e')](_0x5c88f1[_0x1d395e]);delete _0x2722fb[_0x5c88f1[_0x1d395e][_0x09c0('0x6d')]];hasAdditionalPhones=!![];}for(var _0x20dd29 in _0x63dda8){if(_0x5c88f1[_0x1d395e][_0x09c0('0x6d')]+_0x09c0('0x6e')===_0x20dd29){phoneDescriptions['push']({'itemTypeId':_0x5c88f1[_0x1d395e]['id'],'description':_0x20dd29});delete _0x2722fb[_0x20dd29];}}}if(hasAdditionalPhones)_0x2722fb[_0x09c0('0x22')]='';var _0x302c81=_[_0x09c0('0x55')](_0x2722fb)[_0x09c0('0x14')]();logger[_0x09c0('0x5c')]('header',_0x302c81);fs[_0x09c0('0x6f')](_0x484df5,_0x302c81+'\x0a');Papa[_0x09c0('0x70')](fs[_0x09c0('0x71')](_0x296d16),{'header':!![],'skipEmptyLines':!![],'step':function(_0x34c250,_0x63cd5c){try{for(var _0x31d14e=0x0,_0x59c57a=[];_0x31d14e<_0x34c250['data']['length'];_0x31d14e++){stats['rows']+=0x1;if(_0x34c250[_0x09c0('0x60')][_0x31d14e]){handleError(_0x34c250[_0x09c0('0x72')][_0x31d14e],_0x34c250[_0x09c0('0x60')][_0x31d14e]);}else{var _0x5095d6=[];var _0x3306b9=[];var _0x595b73={};for(var _0x368108 in _0x63dda8){let _0x14872e=contactItemTypes['find'](_0x3998ec=>_0x3998ec['name']===_0x368108);let _0x4a42c4=contactItemTypes[_0x09c0('0x73')](_0x111647=>_0x111647[_0x09c0('0x6d')]+_0x09c0('0x6e')===_0x368108);if(_[_0x09c0('0x1d')](_0x14872e)&&_[_0x09c0('0x1d')](_0x4a42c4)){if(_0x63dda8[_0x09c0('0x74')](_0x368108)){if(_0x34c250[_0x09c0('0x72')][_0x31d14e][_0x63dda8[_0x368108]]){var _0x97cc44=_[_0x09c0('0x75')](_0x34c250['data'][_0x31d14e][_0x63dda8[_0x368108]][_0x09c0('0x76')](/"/g,'\x27'));switch(_0x368108){case _0x09c0('0x77'):var _0x580498=moment(_0x97cc44,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x580498[_0x09c0('0x78')]()){_0x59c57a[_0x09c0('0x1e')]('\x22'+_0x97cc44+'\x22');}else{_0x5095d6[_0x09c0('0x1e')](_0x09c0('0x79'));}break;case _0x09c0('0x39'):var _0x3083ad=parseInt(_0x97cc44);_0x97cc44=_[_0x09c0('0x7a')](_0x3083ad)||_0x3083ad<0x0||_0x3083ad>0x4?_0x24f23b?0x3:0x2:_0x3083ad;_0x59c57a['push']('\x22'+_0x97cc44+'\x22');break;case _0x09c0('0x3a'):var _0x56b94b=parseInt(_0x97cc44);if(_[_0x09c0('0x7b')](_0x56b94b)&&_[_0x09c0('0x7c')](_0x8d27a5,_0x56b94b)){_0x59c57a[_0x09c0('0x1e')]('\x22'+_0x56b94b+'\x22');}else{_0x5095d6[_0x09c0('0x1e')](_0x09c0('0x7d'));}break;case'email':if(isEmail(_0x97cc44)){_0x59c57a[_0x09c0('0x1e')]('\x22'+_0x97cc44+'\x22');}else{_0x5095d6['push'](_0x09c0('0x7e'));}break;case'dateOfBirth':var _0x35c446=moment(_0x97cc44,_0x09c0('0x7f'),!![]);if(_0x35c446[_0x09c0('0x78')]()){_0x59c57a[_0x09c0('0x1e')]('\x22'+_0x97cc44+'\x22');}else{_0x5095d6[_0x09c0('0x1e')](_0x09c0('0x80'));}break;default:_0x59c57a[_0x09c0('0x1e')]('\x22'+_0x97cc44+'\x22');}}else{switch(_0x368108){case'firstName':case'phone':_0x5095d6[_0x09c0('0x1e')](_0x368108+_0x09c0('0x81'));break;default:_0x59c57a[_0x09c0('0x1e')]('\x22\x22');}}}}else{var _0x309d0a='';if(!_[_0x09c0('0x1d')](_0x14872e)){if(!_0x595b73[_0x09c0('0x74')](_0x14872e['id'])){for(var _0x4060bb=0x0;_0x4060bb<_0x63dda8[_0x368108][_0x09c0('0x1c')];_0x4060bb++){var _0x97cc44=_[_0x09c0('0x75')](_0x34c250['data'][_0x31d14e][_0x63dda8[_0x368108][_0x4060bb]]['replace'](/"/g,'\x27'));var _0x4e6ca0=phoneDescriptions[_0x09c0('0x73')](_0x6d2ac2=>_0x6d2ac2[_0x09c0('0x82')]===_0x14872e['id']);if(!_['isNil'](_0x4e6ca0)){var _0x5f1857=_[_0x09c0('0x75')](_0x34c250['data'][_0x31d14e][_0x63dda8[_0x4e6ca0[_0x09c0('0x83')]][0x0]][_0x09c0('0x76')](/"/g,'\x27'));if(!_['isNil'](_0x5f1857))_0x97cc44=_0x97cc44+'§'+_0x5f1857;}if(_0x309d0a=='')_0x309d0a=_0x97cc44;else _0x309d0a+='|'+_0x97cc44;}_0x3306b9[_0x09c0('0x1e')](_0x14872e['id']+':'+_0x309d0a);_0x595b73[_0x14872e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x59c57a['push']('\x22'+_0x3306b9[_0x09c0('0x14')](';')+'\x22');}if(_0x5095d6[_0x09c0('0x1c')]){handleError(_0x34c250[_0x09c0('0x72')][_0x31d14e],{'code':'SystemRow','message':_0x5095d6[_0x09c0('0x14')]()});}else{fs[_0x09c0('0x84')](_0x484df5,_0x59c57a[_0x09c0('0x14')]()+'\x0a');}_0x59c57a=[];}if(!(stats[_0x09c0('0x85')]%0xc8)){socket[_0x09c0('0x86')](_0x09c0('0x87')+_0x2906cb,stats);stats[_0x09c0('0x60')]=[];}}if(stopped){logger[_0x09c0('0x5c')](_0x09c0('0x88'));_0x63cd5c[_0x09c0('0x89')]();}}catch(_0x22efe8){handleError(_0x34c250[_0x09c0('0x72')][_0x31d14e],{'code':'SystemError','message':_0x22efe8[_0x09c0('0x21')]});logger[_0x09c0('0x5e')](_0x09c0('0x8a'),_0x22efe8[_0x09c0('0x21')]);}},'complete':function(){try{var _0x45233b=[];var _0x51729a=tempTableName;_0x45233b[_0x09c0('0x1e')]('CREATE\x20TABLE\x20'+_0x51729a+'\x20LIKE\x20cm_contacts;');logger[_0x09c0('0x5c')](_0x09c0('0x8b'),contactItemTypes[_0x09c0('0x1c')]);var _0x49c16e=util[_0x09c0('0xc')](_0x09c0('0x8c'),_0x484df5,_0x51729a,_0x302c81,_0x51b598[_0x09c0('0x44')],_0x51b598[_0x09c0('0x56')]||null,NOW,NOW);if(_[_0x09c0('0x1d')](_0x63dda8[_0x09c0('0x77')])){_0x49c16e+=',\x20scheduledAt\x20=\x20NOW()';}_0x45233b[_0x09c0('0x1e')](_0x49c16e);BPromise[_0x09c0('0x8d')](_0x45233b,handleQuery)['then'](function(_0x7d7b3a){BPromise[_0x09c0('0x8e')]([handleAdditionalPhones()])['then'](function(){_0x45233b=[];for(var _0x474053=0x0;_0x474053\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format'];(function(_0x51ccab,_0x2cfc15){var _0x2af691=function(_0x1cf9de){while(--_0x1cf9de){_0x51ccab['push'](_0x51ccab['shift']());}};_0x2af691(++_0x2cfc15);}(_0xdf5d,0x126));var _0xddf5=function(_0x3a146c,_0x49d661){_0x3a146c=_0x3a146c-0x0;var _0x53d06f=_0xdf5d[_0x3a146c];return _0x53d06f;};'use strict';var fs=require('fs');var path=require(_0xddf5('0x0'));var _=require(_0xddf5('0x1'));var Papa=require(_0xddf5('0x2'));var util=require(_0xddf5('0x3'));var BPromise=require(_0xddf5('0x4'));var moment=require(_0xddf5('0x5'));var squel=require(_0xddf5('0x6'));var Redis=require(_0xddf5('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0xddf5('0x8'));var logger=require(_0xddf5('0x9'))(_0xddf5('0xa'));config[_0xddf5('0xb')]=_[_0xddf5('0xc')](config[_0xddf5('0xb')],{'host':_0xddf5('0xd'),'port':0x18eb});var socket=require(_0xddf5('0xe'))(new Redis(config[_0xddf5('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()[_0xddf5('0xf')](_0xddf5('0x10'));var tempTableName=_0xddf5('0x11')+moment()[_0xddf5('0xf')](_0xddf5('0x12'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x10191b){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))*$/[_0xddf5('0x13')](_0x10191b);}function selectNotIn(_0x5a4f45,_0x161973,_0x3d3fc3,_0x72f146,_0x10245f){return squel[_0xddf5('0x14')]()[_0xddf5('0x15')](_0xddf5('0x16'))[_0xddf5('0x17')](_0x72f146)['join'](_0x161973,null,_0x161973+'.id\x20=\x20'+_0x72f146+'.'+_0x3d3fc3)[_0xddf5('0x18')](_0x72f146+'.'+_0x3d3fc3+_0xddf5('0x19')+_0x5a4f45+'.'+_0x3d3fc3)[_0xddf5('0x18')](_0x161973+_0xddf5('0x1a')+_0x10245f[_0xddf5('0x1b')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x149fef,_0x2ecea5){promisesAdditionalPhones=[];promisesContact=[];return db[_0xddf5('0x1c')]['query'](_0xddf5('0x1d')+tempTableName)[_0xddf5('0x1e')](function(_0x3dd408){if(_0x3dd408!==null){var _0x1c0c30=[];for(var _0x19a039=0x0;_0x19a039<_0x3dd408['length'];_0x19a039++){var _0x3a9263=_0x3dd408[_0x19a039];if(!_['isNil'](_0x3a9263[_0xddf5('0x16')])){if(!_['isNil'](_0x3a9263[_0xddf5('0x1f')]))_0x1c0c30[_0xddf5('0x20')](insertAdditionalPhones(_0x3a9263));promisesContact[_0xddf5('0x20')]({'contact':_0x3a9263});}}}Promise[_0xddf5('0x21')](_0x1c0c30)['then'](function(){_0x149fef({'val':0x1});});})['catch'](function(_0x1b085b){logger[_0xddf5('0x22')](_0x1b085b[_0xddf5('0x23')]);});});}function insertAdditionalPhones(_0x1abfb2){return new Promise(function(_0x5e5537,_0x52ecdb){var _0x3f3194=_0x1abfb2[_0xddf5('0x1f')];if(_[_0xddf5('0x24')](_0x3f3194))_0x52ecdb({'val':0x0});else{var _0x497805=_0x3f3194[_0xddf5('0x25')](';');var _0x39212c=[];orderBy=0x0;for(var _0x21c68b=0x0;_0x21c68b<_0x497805[_0xddf5('0x26')];_0x21c68b++){_0x39212c['push'](splitAdditionalPhone(_0x1abfb2['id'],_0x497805[_0x21c68b]));}Promise[_0xddf5('0x21')](_0x39212c)[_0xddf5('0x27')](function(){_0x5e5537({'val':_0x497805['length']});});}});}function splitAdditionalPhone(_0x300923,_0x4267aa){return new Promise(function(_0x34539e,_0x12ece7){var _0x49c381=_0x4267aa[_0xddf5('0x25')](':');var _0xc75eb8=_0x49c381[0x0];var _0x256ff0=_0x49c381[0x1];if(_0x256ff0!==''){var _0x1eca6a=_0x256ff0[_0xddf5('0x25')]('|');var _0x4caa12=[];for(var _0x2caa8f=0x0;_0x2caa8f<_0x1eca6a[_0xddf5('0x26')];_0x2caa8f++){if(_0x1eca6a[_0x2caa8f]!==''){var _0x5c0451=_['filter'](promisesAdditionalPhones,{'contactId':_0x300923,'phone':_0x1eca6a[_0x2caa8f]});if(_0x5c0451[_0xddf5('0x26')]==0x0){orderBy++;promisesAdditionalPhones[_0xddf5('0x20')]({'contactId':_0x300923,'contactTypeId':_0xc75eb8,'phone':_0x1eca6a[_0x2caa8f],'orderBy':orderBy});}}}_0x34539e({'ok':0x1});}else _0x34539e({'res':0x0});});}function createAdditionalPhone(_0x1d493e,_0x174cd7,_0x3be6f4,_0x1a476d){var _0x5a3548='';var _0x26f43c='';var _0x228073=_0x3be6f4['split']('§');_0x5a3548=_0x228073[0x0];if(_0x228073[_0xddf5('0x26')]==0x2)_0x26f43c=_0x228073[0x1];return new Promise(function(_0x3ac1e8,_0x281307){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x1d493e,'item':_0x5a3548}})['then'](function(_0xdc764b){if(_0xdc764b){return db[_0xddf5('0x28')][_0xddf5('0x29')]({'ItemTypeId':_0x174cd7,'description':_0x26f43c,'OrderBy':_0x1a476d},{'where':{'CmContactId':_0x1d493e,'item':_0x5a3548}})['then'](function(_0x3d1c7a){_0x3ac1e8({'res':'updated'});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x1d493e,'item':_0x5a3548,'ItemTypeId':_0x174cd7,'description':_0x26f43c,'OrderBy':_0x1a476d,'ItemClass':_0xddf5('0x2a')})[_0xddf5('0x27')](function(_0x2a4b2e){_0x3ac1e8({'res':_0xddf5('0x2b')});});}});});}function updateContact(_0x11cee5){return new Promise(function(_0x49e5a9,_0x1eca4e){var _0x53e916=_0x11cee5['id'];delete _0x11cee5['id'];return db[_0xddf5('0x2c')][_0xddf5('0x29')](_0x11cee5,{'where':{'id':_0x53e916}})['then'](function(_0xf355f4){updatedRows+=0x1;return db[_0xddf5('0x2d')][_0xddf5('0x29')]({'phone':_0x11cee5[_0xddf5('0x16')]},{'where':{'ContactId':_0x53e916}})[_0xddf5('0x27')](function(_0x4e0b6f){_0x49e5a9({'ret':'OK'});});});});}function insertCmHopper(_0x873d16,_0x5478cf,_0x2874f8,_0x45a373,_0x50240c){var _0x1be090=['cm_contacts.phone',_0xddf5('0x2e'),'cm_contacts.id','cm_contacts.ListId',_0x5478cf+'.'+_0x45a373,_0xddf5('0x2f'),'cm_contacts.updatedAt',_0xddf5('0x30'),_0xddf5('0x31'),'\x22'+_0x50240c+'\x22'];return squel[_0xddf5('0x32')]()[_0xddf5('0x33')](_0xddf5('0x34'))[_0xddf5('0x35')]([_0xddf5('0x16'),_0xddf5('0x36'),_0xddf5('0x37'),_0xddf5('0x38'),_0x45a373,_0xddf5('0x39'),_0xddf5('0x3a'),_0xddf5('0x3b'),_0xddf5('0x3c'),_0xddf5('0x3d')],squel[_0xddf5('0x14')]()[_0xddf5('0x3e')](_0x1be090)[_0xddf5('0x17')](_0x5478cf)['join'](_0xddf5('0x3f'),null,_0xddf5('0x40')+_0x5478cf+_0xddf5('0x41'))[_0xddf5('0x1b')](_0x2874f8,null,_0x2874f8+_0xddf5('0x42')+_0x5478cf+'.'+_0x45a373)['where'](_0x5478cf+'.CmListId\x20=\x20?',_0x873d16)['where'](_0xddf5('0x43'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5478cf,_0x2874f8,_0x45a373,_0xddf5('0x34'),[_0xddf5('0x44'),_0xddf5('0x45')]))[_0xddf5('0x18')](_0xddf5('0x46'),selectNotIn(_0x5478cf,_0x2874f8,_0x45a373,_0xddf5('0x34'),[_0xddf5('0x44')])))[_0xddf5('0x47')]();}function insertCmHopperBlack(_0x490a14,_0xd5c63d,_0x5b4817,_0x5654c2){var _0x2858f3=[_0xddf5('0x48'),'cm_contacts.id','cm_contacts.ListId',_0xd5c63d+'.'+_0x5654c2,_0xddf5('0x2f'),_0xddf5('0x49')];return squel[_0xddf5('0x32')]()[_0xddf5('0x33')]('cm_hopper_black')['fromQuery']([_0xddf5('0x16'),_0xddf5('0x37'),'ListId',_0x5654c2,_0xddf5('0x39'),_0xddf5('0x3a')],squel['select']()[_0xddf5('0x3e')](_0x2858f3)['from'](_0xd5c63d)[_0xddf5('0x1b')](_0xddf5('0x3f'),null,_0xddf5('0x40')+_0xd5c63d+'.CmListId')[_0xddf5('0x1b')](_0x5b4817,null,_0x5b4817+_0xddf5('0x42')+_0xd5c63d+'.'+_0x5654c2)[_0xddf5('0x18')](_0xd5c63d+_0xddf5('0x4a'),_0x490a14)[_0xddf5('0x18')](_0xddf5('0x43'),NOW)['where'](_0xddf5('0x46'),squel[_0xddf5('0x14')]()[_0xddf5('0x15')](_0xddf5('0x16'))['from'](_0xddf5('0x4b'))[_0xddf5('0x18')](_0xddf5('0x4c'),_0x490a14)[_0xddf5('0x18')](_0x5654c2+'\x20=\x20?',_0xd5c63d+'.'+_0x5654c2)))[_0xddf5('0x47')]();}function insertCmHopperAdditionalPhones(_0x50fe){var _0x549404=[_0xddf5('0x4d'),'cm_contact_has_items.item',_0xddf5('0x4e'),_0xddf5('0x4f'),_0xddf5('0x50')];return squel[_0xddf5('0x32')]()['into'](_0xddf5('0x51'))[_0xddf5('0x35')](['CmHopperId',_0xddf5('0x16'),'OrderBy','createdAt',_0xddf5('0x3a')],squel[_0xddf5('0x14')]()[_0xddf5('0x3e')](_0x549404)[_0xddf5('0x17')](_0xddf5('0x34'))[_0xddf5('0x1b')]('cm_contacts',null,_0xddf5('0x52'))[_0xddf5('0x1b')](_0xddf5('0x53'),null,_0xddf5('0x54'))['where'](_0xddf5('0x55'),_0x50fe)[_0xddf5('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xddf5('0x47')]();}function insertCmContact(_0x2ae7dd,_0x4af9f5,_0x28dc81,_0x5be225){var _0x1aa19e=_['concat'](_['keys'](_0x5be225),['ListId',_0xddf5('0x56'),_0xddf5('0x39'),_0xddf5('0x3a')]);return squel[_0xddf5('0x32')]()[_0xddf5('0x33')](_0xddf5('0x3f'))[_0xddf5('0x35')](_0x1aa19e,squel[_0xddf5('0x14')]()[_0xddf5('0x3e')](_0x1aa19e)[_0xddf5('0x17')](_0x4af9f5)['where']('('+_0x28dc81[_0xddf5('0x1b')](',')+_0xddf5('0x57'),squel[_0xddf5('0x14')]()[_0xddf5('0x3e')](_0x28dc81)[_0xddf5('0x17')]('cm_contacts')[_0xddf5('0x18')]('ListId\x20=\x20?',_0x2ae7dd))[_0xddf5('0x18')](_0xddf5('0x58'),squel['select']()[_0xddf5('0x15')]('MIN(id)',_0xddf5('0x59'))['from'](_0x4af9f5)['group'](_0x28dc81[_0xddf5('0x1b')](','))))[_0xddf5('0x47')]();}function handleStop(){logger[_0xddf5('0x5a')](_0xddf5('0x5b'));stopped=!![];}function handleUncaughtException(_0xb62de0){logger[_0xddf5('0x22')](_0xb62de0['message']);process[_0xddf5('0x5c')](0x1);}function handleError(_0x9d3d33,_0x120ba8){stats[_0xddf5('0x5d')]['push']({'name':_0x120ba8[_0xddf5('0x5e')],'message':_0x120ba8[_0xddf5('0x23')],'row':_0x9d3d33});}function handleQuery(_0x24cc45){logger['info'](_0x24cc45);return db[_0xddf5('0x1c')][_0xddf5('0x5f')](_0x24cc45)[_0xddf5('0x1e')](function(_0x3e256c){results[_0xddf5('0x20')](_0x3e256c);})[_0xddf5('0x60')](function(_0x1d6ed0){logger[_0xddf5('0x22')](_0x1d6ed0[_0xddf5('0x23')]);});}function main(_0x337186,_0x320afb,_0x46bbd7,_0xb7ed5c){logger['info'](_0xddf5('0x61'),_0x337186,JSON['stringify'](_0x320afb));process[_0xddf5('0x62')](_0xddf5('0x63'));var _0xdbce2a=_0x320afb[_0xddf5('0x64')];var _0x59df27=_[_0xddf5('0x65')](_0xdbce2a);var _0x4c3aa9=_0x320afb[_0xddf5('0x66')];var _0x22018e=path[_0xddf5('0x1b')](config[_0xddf5('0x67')],_0xddf5('0x68'),_0x4c3aa9+'.csv');logger['info'](_0xddf5('0x69'),_0x320afb);db[_0xddf5('0x6a')][_0xddf5('0x6b')]({'raw':!![],'attributes':['id',_0xddf5('0x6c')]})['then'](function(_0x50c8c8){for(var _0x20bea2=0x0;_0x20bea2<_0x50c8c8[_0xddf5('0x26')];_0x20bea2++){if(_0x50c8c8[_0x20bea2][_0xddf5('0x6c')]in _0xdbce2a){contactItemTypes[_0xddf5('0x20')](_0x50c8c8[_0x20bea2]);delete _0x59df27[_0x50c8c8[_0x20bea2][_0xddf5('0x6c')]];hasAdditionalPhones=!![];}for(var _0x1a006d in _0xdbce2a){if(_0x50c8c8[_0x20bea2][_0xddf5('0x6c')]+'_description'===_0x1a006d){phoneDescriptions['push']({'itemTypeId':_0x50c8c8[_0x20bea2]['id'],'description':_0x1a006d});delete _0x59df27[_0x1a006d];}}}if(hasAdditionalPhones)_0x59df27['AdditionalPhones']='';var _0x200ab4=_[_0xddf5('0x6d')](_0x59df27)[_0xddf5('0x1b')]();logger[_0xddf5('0x5a')](_0xddf5('0x6e'),_0x200ab4);fs[_0xddf5('0x6f')](_0x22018e,_0x200ab4+'\x0a');Papa[_0xddf5('0x70')](fs['createReadStream'](_0x337186),{'header':!![],'skipEmptyLines':!![],'step':function(_0x43a461,_0x30c640){try{for(var _0x5d50c2=0x0,_0x3e2f87=[];_0x5d50c2<_0x43a461[_0xddf5('0x71')][_0xddf5('0x26')];_0x5d50c2++){stats[_0xddf5('0x72')]+=0x1;if(_0x43a461['errors'][_0x5d50c2]){handleError(_0x43a461[_0xddf5('0x71')][_0x5d50c2],_0x43a461[_0xddf5('0x5d')][_0x5d50c2]);}else{var _0x10c4ad=[];var _0xf9d67=[];var _0x22463b={};for(var _0x3f7c95 in _0xdbce2a){let _0x551666=contactItemTypes[_0xddf5('0x73')](_0x5151f6=>_0x5151f6['name']===_0x3f7c95);let _0x2f064b=contactItemTypes['find'](_0x372026=>_0x372026[_0xddf5('0x6c')]+_0xddf5('0x74')===_0x3f7c95);if(_[_0xddf5('0x24')](_0x551666)&&_['isNil'](_0x2f064b)){if(_0xdbce2a[_0xddf5('0x75')](_0x3f7c95)){if(_0x43a461[_0xddf5('0x71')][_0x5d50c2][_0xdbce2a[_0x3f7c95]]){var _0x1244ec=_[_0xddf5('0x76')](_0x43a461['data'][_0x5d50c2][_0xdbce2a[_0x3f7c95]][_0xddf5('0x77')](/"/g,'\x27'));switch(_0x3f7c95){case'scheduledat':var _0x38ae00=moment(_0x1244ec,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x38ae00[_0xddf5('0x78')]()){_0x3e2f87[_0xddf5('0x20')]('\x22'+_0x1244ec+'\x22');}else{_0x10c4ad[_0xddf5('0x20')](_0xddf5('0x79'));}break;case'priority':var _0x5bae97=parseInt(_0x1244ec);_0x1244ec=_['isNaN'](_0x5bae97)||_0x5bae97<0x0||_0x5bae97>0x4?_0xb7ed5c?0x3:0x2:_0x5bae97;_0x3e2f87[_0xddf5('0x20')]('\x22'+_0x1244ec+'\x22');break;case _0xddf5('0x3c'):var _0x12c23a=parseInt(_0x1244ec);if(_[_0xddf5('0x7a')](_0x12c23a)&&_[_0xddf5('0x7b')](_0x46bbd7,_0x12c23a)){_0x3e2f87[_0xddf5('0x20')]('\x22'+_0x12c23a+'\x22');}else{_0x10c4ad[_0xddf5('0x20')]('agent\x20not\x20exists');}break;case _0xddf5('0x7c'):if(isEmail(_0x1244ec)){_0x3e2f87[_0xddf5('0x20')]('\x22'+_0x1244ec+'\x22');}else{_0x10c4ad['push'](_0xddf5('0x7d'));}break;case _0xddf5('0x7e'):var _0x673df9=moment(_0x1244ec,_0xddf5('0x7f'),!![]);if(_0x673df9['isValid']()){_0x3e2f87['push']('\x22'+_0x1244ec+'\x22');}else{_0x10c4ad['push'](_0xddf5('0x80'));}break;default:_0x3e2f87['push']('\x22'+_0x1244ec+'\x22');}}else{switch(_0x3f7c95){case'firstName':case _0xddf5('0x16'):_0x10c4ad[_0xddf5('0x20')](_0x3f7c95+_0xddf5('0x81'));break;default:_0x3e2f87[_0xddf5('0x20')]('\x22\x22');}}}}else{var _0x1ff22e='';if(!_[_0xddf5('0x24')](_0x551666)){if(!_0x22463b[_0xddf5('0x75')](_0x551666['id'])){for(var _0x480dee=0x0;_0x480dee<_0xdbce2a[_0x3f7c95]['length'];_0x480dee++){var _0x1244ec=_[_0xddf5('0x76')](_0x43a461['data'][_0x5d50c2][_0xdbce2a[_0x3f7c95][_0x480dee]][_0xddf5('0x77')](/"/g,'\x27'));var _0x5962b4=phoneDescriptions[_0xddf5('0x73')](_0x3bf028=>_0x3bf028['itemTypeId']===_0x551666['id']);if(!_['isNil'](_0x5962b4)){var _0x2ab5c3=_[_0xddf5('0x76')](_0x43a461[_0xddf5('0x71')][_0x5d50c2][_0xdbce2a[_0x5962b4[_0xddf5('0x82')]][0x0]][_0xddf5('0x77')](/"/g,'\x27'));if(!_[_0xddf5('0x24')](_0x2ab5c3))_0x1244ec=_0x1244ec+'§'+_0x2ab5c3;}if(_0x1ff22e=='')_0x1ff22e=_0x1244ec;else _0x1ff22e+='|'+_0x1244ec;}_0xf9d67[_0xddf5('0x20')](_0x551666['id']+':'+_0x1ff22e);_0x22463b[_0x551666['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3e2f87['push']('\x22'+_0xf9d67[_0xddf5('0x1b')](';')+'\x22');}if(_0x10c4ad[_0xddf5('0x26')]){handleError(_0x43a461[_0xddf5('0x71')][_0x5d50c2],{'code':'SystemRow','message':_0x10c4ad['join']()});}else{fs['appendFileSync'](_0x22018e,_0x3e2f87['join']()+'\x0a');}_0x3e2f87=[];}if(!(stats[_0xddf5('0x72')]%0xc8)){socket[_0xddf5('0x83')]('contact:import:'+_0x4c3aa9,stats);stats[_0xddf5('0x5d')]=[];}}if(stopped){logger[_0xddf5('0x5a')]('Abort\x20parser');_0x30c640[_0xddf5('0x84')]();}}catch(_0xedf2d){handleError(_0x43a461[_0xddf5('0x71')][_0x5d50c2],{'code':'SystemError','message':_0xedf2d[_0xddf5('0x23')]});logger[_0xddf5('0x22')]('step',_0xedf2d[_0xddf5('0x23')]);}},'complete':function(){try{var _0x2af6a4=[];var _0x44c26e=tempTableName;_0x2af6a4[_0xddf5('0x20')](_0xddf5('0x85')+_0x44c26e+'\x20LIKE\x20cm_contacts;');logger[_0xddf5('0x5a')](_0xddf5('0x86'),contactItemTypes[_0xddf5('0x26')]);var _0x386a5c=util[_0xddf5('0xf')]('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\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x22018e,_0x44c26e,_0x200ab4,_0x320afb[_0xddf5('0x38')],_0x320afb['CompanyId']||null,NOW,NOW);if(_[_0xddf5('0x24')](_0xdbce2a[_0xddf5('0x36')])){_0x386a5c+=_0xddf5('0x87');}_0x2af6a4[_0xddf5('0x20')](_0x386a5c);BPromise[_0xddf5('0x88')](_0x2af6a4,handleQuery)[_0xddf5('0x27')](function(_0x4427dd){BPromise[_0xddf5('0x21')]([handleAdditionalPhones()])[_0xddf5('0x27')](function(){_0x2af6a4=[];for(var _0x1798f3=0x0;_0x1798f3\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','Setting','findOne','enableEmailPreview','clone','COUNT(*)','isEmpty','SELECT','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','search','select','name','field','color','tools_tags','getInteractionFK','_interactions','u.fullname','from','left_join','u.id\x20=\x20ui.UserId','where','ui.','\x20IN\x20?','map','getInteractionsTables','interactions','users','o.id\x20=\x20i.UserId','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.from\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','default','text','value','end','read','and','Contact','$substring','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','buildExpression','type','Tag','tags','User','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','start','body','plainBody','keys','some','compact','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','then','tag','clause','filter','get','capitalize','chat','Websites','Accounts','resolve','agent','length','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','closed','i.substatus','shift','join','Interaction','Sequelize'];(function(_0x22589f,_0x3f33b7){var _0x4b1e54=function(_0x301401){while(--_0x301401){_0x22589f['push'](_0x22589f['shift']());}};_0x4b1e54(++_0x3f33b7);}(_0x2c14,0xe7));var _0x42c1=function(_0x71bea5,_0x5818b2){_0x71bea5=_0x71bea5-0x0;var _0x281d31=_0x2c14[_0x71bea5];return _0x281d31;};'use strict';var _=require(_0x42c1('0x0'));var squel=require(_0x42c1('0x1'));var as=require(_0x42c1('0x2'));var qs=require(_0x42c1('0x3'));var updateInteraction=require(_0x42c1('0x4'))[_0x42c1('0x5')];var utils=require(_0x42c1('0x6'));var db=require(_0x42c1('0x7'))['db'];function skipInteractionsQuery(_0x4055ed,_0x2ce8b6,_0x13f2c7){var _0x59fe01=![];var _0x4d2d93=utils[_0x42c1('0x8')](_0x4055ed);if(_0x2ce8b6[_0x42c1('0x9')]==='agent'&&!_0x13f2c7[_0x42c1('0xa')]&&!_0x13f2c7[_0x4d2d93]){_0x59fe01=!![];}return _0x59fe01;}function getTagsQuery(){return squel[_0x42c1('0xb')]()['field']('id')['field'](_0x42c1('0xc'))[_0x42c1('0xd')](_0x42c1('0xe'))['from'](_0x42c1('0xf'));}function getUsersQuery(_0x1576dd,_0x31b4f7){var _0xe253d2=utils[_0x42c1('0x10')](_0x1576dd);var _0x130473='user_has_'+_0x1576dd+_0x42c1('0x11');var _0x149ce3=squel[_0x42c1('0xb')]()['field']('u.id')['field'](_0x42c1('0x12'))['field']('ui.'+_0xe253d2)[_0x42c1('0x13')](_0x130473,'ui')[_0x42c1('0x14')]('users','u',_0x42c1('0x15'));if(_0x31b4f7['length']>0x0){_0x149ce3[_0x42c1('0x16')](_0x42c1('0x17')+_0xe253d2+_0x42c1('0x18'),_[_0x42c1('0x19')](_0x31b4f7,'id'));}return _0x149ce3;}function getInteractionsQuery(_0x200887){var _0x3d7519=utils[_0x42c1('0x1a')](_0x200887);var _0x35c5f0=utils['getAccountFK'](_0x200887);var _0x31a106=utils[_0x42c1('0x10')](_0x200887);return squel['select']()[_0x42c1('0x13')](_0x3d7519[_0x42c1('0x1b')],'i')[_0x42c1('0x14')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x42c1('0x14')](_0x42c1('0x1c'),'o',_0x42c1('0x1d'))['left_join'](_0x3d7519['accounts'],'a','a.id\x20=\x20i.'+_0x35c5f0)[_0x42c1('0x14')](_0x3d7519[_0x42c1('0x1e')],'me',_0x42c1('0x1f')+_0x31a106+_0x42c1('0x20'))[_0x42c1('0x14')](_0x3d7519[_0x42c1('0x21')],'it',_0x42c1('0x22')+_0x31a106+_0x42c1('0x20'))[_0x42c1('0x14')]('tools_tags','t',_0x42c1('0x23'));}function getSqlClauses(){var _0xbe9f91={'body':squel[_0x42c1('0x24')](),'contact':squel[_0x42c1('0x24')](),'default':squel[_0x42c1('0x24')](),'fields':squel[_0x42c1('0x24')](),'filter':squel[_0x42c1('0x24')](),'read':squel['expr'](),'tags':{'clause':squel[_0x42c1('0x24')](),'ids':null},'user':squel[_0x42c1('0x24')]()};return _0xbe9f91;}function parseTagParameter(_0xfb5e87){var _0x51bcda=squel['expr']();if(_0xfb5e87){var _0x14ab50=utils[_0x42c1('0x25')](_0xfb5e87);_0x14ab50[_0x42c1('0x26')](function(_0x47cc19){_0x51bcda['or'](_0x42c1('0x27'),'%,'+_0x47cc19+',%');});}return _0x51bcda;}function parseReadParameter(_0x481b31){var _0x2e5f1f='';if(_0x481b31){_0x2e5f1f=_0x42c1('0x28');if(_0x481b31==='1'){_0x2e5f1f=_0x2e5f1f[_0x42c1('0x29')]('{OPERATOR}','=');}else{_0x2e5f1f=_0x2e5f1f[_0x42c1('0x29')]('{OPERATOR}','>');}}return _0x2e5f1f;}function parseSearchFilter(_0x20648d,_0x8e6a49){var _0x5ea74c=squel[_0x42c1('0x24')]();if(_0x8e6a49){var _0x4c2fba=_0x8e6a49[_0x42c1('0x29')]('\x5c','\x5c\x5c')[_0x42c1('0x29')](/'/g,'\x27\x27');var _0x42f559=qs[_0x42c1('0x2a')](_0x4c2fba);if(qs[_0x42c1('0x2b')](_0x4c2fba)){_0x5ea74c['or'](_0x42c1('0x2c'),_0x42f559+'%');if([_0x42c1('0x2d'),_0x42c1('0x2e')][_0x42c1('0x2f')](_0x20648d)){_0x5ea74c['or'](_0x42c1('0x30'),_0x42f559+'%');}else if(_0x20648d===_0x42c1('0x31')){_0x5ea74c['or']('i.fax\x20LIKE\x20?',_0x42f559+'%');}else if(_0x20648d==='openchannel'){_0x5ea74c['or'](_0x42c1('0x32'),_0x42f559+'%');}}else if(_0x20648d===_0x42c1('0x33')&&qs['isEmail'](_0x4c2fba)){_0x5ea74c['or'](_0x42c1('0x34'),_0x42f559+'%');}else{if(_0x20648d===_0x42c1('0x33')){_0x5ea74c['or'](_0x42c1('0x35'),qs[_0x42c1('0x36')](_0x4c2fba,!![]))['or'](_0x42c1('0x37'),qs[_0x42c1('0x36')](_0x4c2fba));}else if(_0x20648d!==_0x42c1('0x31')){_0x5ea74c['or'](_0x42c1('0x38'),qs[_0x42c1('0x36')](_0x4c2fba));}_0x5ea74c['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x42c1('0x36')](_0x4c2fba,!![]),null);}}return _0x5ea74c;}function parseAdvancedSearchFilter(_0x114686,_0x394aab){var _0x4a9faa=getSqlClauses();var _0x3c449d=as[_0x42c1('0x39')](_0x114686);var _0x4fca70=_0x3c449d[_0x42c1('0x3a')];for(var _0xcb6463=0x0;_0xcb6463<_0x3c449d[_0x42c1('0x3b')]['length'];_0xcb6463++){var _0x36c8fb=_0x3c449d[_0x42c1('0x3b')][_0xcb6463];var _0x632fc1='i';var _0x5aa401=_[_0x42c1('0x3c')](_0x394aab,[_0x42c1('0xc'),_0x36c8fb[_0x42c1('0xd')]]);if(_0x5aa401){var _0x32140f=as['buildExpression'](_0x632fc1,_0x5aa401['type'],_0x36c8fb);_0x4a9faa[_0x42c1('0x3d')][_0x4fca70](_0x32140f[_0x42c1('0x3e')],_0x32140f[_0x42c1('0x3f')]['start'],_0x32140f[_0x42c1('0x3f')][_0x42c1('0x40')]);}else{switch(_0x36c8fb[_0x42c1('0xd')]){case'unreadMessages':var _0x29741d=parseReadParameter(_0x36c8fb[_0x42c1('0x3f')]);_0x4a9faa[_0x42c1('0x41')][_0x42c1('0x42')](_0x29741d);break;case _0x42c1('0x43'):if(_0x36c8fb['operator']===_0x42c1('0x44')){if(_0x36c8fb['value'][_0x42c1('0x45')]('\x20')['length']>0x1){_0x4a9faa[_0x42c1('0x46')][_0x4fca70](_0x42c1('0x47'),qs[_0x42c1('0x36')](_0x36c8fb[_0x42c1('0x3f')],!![]),null);}else{var _0x2d7c8f='%'+_0x36c8fb[_0x42c1('0x3f')]+'%';_0x4a9faa[_0x42c1('0x46')][_0x4fca70](_0x42c1('0x48'),_0x2d7c8f,_0x2d7c8f,_0x2d7c8f);}}else{_0x5aa401=_[_0x42c1('0x3c')](_0x394aab,['name','ContactId']);_0x36c8fb[_0x42c1('0xd')]=_0x42c1('0x49');_0x32140f=as[_0x42c1('0x4a')](_0x632fc1,_0x5aa401[_0x42c1('0x4b')],_0x36c8fb);_0x4a9faa['contact'][_0x4fca70](_0x32140f[_0x42c1('0x3e')],_0x32140f[_0x42c1('0x3f')]['start'],_0x32140f[_0x42c1('0x3f')][_0x42c1('0x40')]);}break;case _0x42c1('0x4c'):var _0x16df6e=_0x36c8fb[_0x42c1('0x3f')][_0x42c1('0x45')](',')[_0x42c1('0x19')](function(_0x3dd5db){return Number(_0x3dd5db);});var _0x42d5e4=parseTagParameter(_0x16df6e);_0x4a9faa[_0x42c1('0x4d')]['clause'][_0x42c1('0x42')](_0x42d5e4);_0x4a9faa['tags']['ids']=_0x16df6e;break;case _0x42c1('0x4e'):if(_0x36c8fb[_0x42c1('0x4f')]===_0x42c1('0x44')){_0x4a9faa[_0x42c1('0x50')][_0x4fca70](_0x42c1('0x51'),'%'+_0x36c8fb[_0x42c1('0x3f')]+'%',null);}else{_0x5aa401=_['find'](_0x394aab,[_0x42c1('0xc'),'UserId']);_0x36c8fb['field']=_0x42c1('0x52');_0x32140f=as[_0x42c1('0x4a')](_0x632fc1,_0x5aa401[_0x42c1('0x4b')],_0x36c8fb);_0x4a9faa['user'][_0x4fca70](_0x32140f['text'],_0x32140f[_0x42c1('0x3f')][_0x42c1('0x53')],_0x32140f[_0x42c1('0x3f')]['end']);}break;case _0x42c1('0x54'):case _0x42c1('0x55'):_0x32140f=as[_0x42c1('0x4a')]('me',null,_0x36c8fb);_0x4a9faa[_0x42c1('0x54')][_0x4fca70](_0x32140f[_0x42c1('0x3e')],_0x32140f['value'][_0x42c1('0x53')],_0x32140f[_0x42c1('0x3f')]['end']);break;}}}return _0x4a9faa;}function parseModelFields(_0x72a710,_0x334115,_0x3b62b3){var _0x40bda1=utils['getAccountFK'](_0x72a710);var _0x2e387d=squel[_0x42c1('0x24')]();var _0x2e7fb5=_(_0x334115)[_0x42c1('0x56')]()[_0x42c1('0x19')](function(_0xe2037d){return _[_0x42c1('0x57')](_0x3b62b3,[_0x42c1('0xc'),_0xe2037d])?_0xe2037d:undefined;})[_0x42c1('0x58')]()[_0x42c1('0x3f')]();if(_0x2e7fb5['length']>0x0){_0x2e7fb5[_0x42c1('0x26')](function(_0x272000){if(_0x272000===_0x40bda1){_0x2e387d[_0x42c1('0x42')]('i.'+_0x40bda1+_0x42c1('0x18'),[]['concat'](_0x334115[_0x272000]));}else if(_0x272000==='createdAt'){var _0xe99b02=JSON[_0x42c1('0x59')](_0x334115[_0x272000])['$gte'];var _0x43d775=JSON[_0x42c1('0x59')](_0x334115[_0x272000])[_0x42c1('0x5a')];_0x2e387d[_0x42c1('0x42')](_0x42c1('0x5b'),_0xe99b02,_0x43d775);}else{if(_0x334115[_0x272000]===_0x42c1('0x5c')){_0x2e387d[_0x42c1('0x42')]('i.'+_0x272000+'\x20IS\x20NULL');}else{_0x2e387d['and']('i.'+_0x272000+_0x42c1('0x5d'),_0x334115[_0x272000]);}}});}return _0x2e387d;}function parseQueryParameters(_0x1c719f,_0x902bc7,_0x2362e3){var _0x1e20a4=getSqlClauses();return Promise['resolve']()[_0x42c1('0x5e')](function(){return parseModelFields(_0x1c719f,_0x902bc7,_0x2362e3);})[_0x42c1('0x5e')](function(_0x5f569f){_0x1e20a4['fields'][_0x42c1('0x42')](_0x5f569f);return parseReadParameter(_0x902bc7['read']);})[_0x42c1('0x5e')](function(_0x5396a9){_0x1e20a4[_0x42c1('0x41')][_0x42c1('0x42')](_0x5396a9);return parseTagParameter(_0x902bc7[_0x42c1('0x5f')]);})[_0x42c1('0x5e')](function(_0xb16fff){_0x1e20a4[_0x42c1('0x4d')][_0x42c1('0x60')][_0x42c1('0x42')](_0xb16fff);return parseSearchFilter(_0x1c719f,_0x902bc7[_0x42c1('0x61')]);})[_0x42c1('0x5e')](function(_0x40504f){_0x1e20a4[_0x42c1('0x61')]=_0x40504f;return _0x1e20a4;});}function checkAccountsRestrictions(_0x5c31e6,_0x2317b8,_0x377b59){var _0x370189=utils[_0x42c1('0x8')](_0x5c31e6);var _0x55c6df=_0x42c1('0x62')+_[_0x42c1('0x63')](_0x5c31e6)+(_0x5c31e6===_0x42c1('0x64')?_0x42c1('0x65'):_0x42c1('0x66'));var _0x12a283=squel[_0x42c1('0x24')]();return Promise[_0x42c1('0x67')]()['then'](function(){if(_0x377b59['search']&&_0x2317b8[_0x42c1('0x9')]===_0x42c1('0x68')){return _0x2317b8[_0x55c6df]({'attributes':['id'],'raw':!![]});}})[_0x42c1('0x5e')](function(_0xcb658c){if(_0xcb658c){if(_0xcb658c[_0x42c1('0x69')]===0x0){_0x12a283[_0x42c1('0x42')]('i.'+_0x370189+_0x42c1('0x6a'));}else{_0x12a283[_0x42c1('0x42')]('i.'+_0x370189+_0x42c1('0x18'),_[_0x42c1('0x19')](_0xcb658c,'id'));}}else if(!_0x377b59[_0x370189]){_0x12a283[_0x42c1('0x42')]('i.'+_0x370189+_0x42c1('0x6b'));}})[_0x42c1('0x5e')](function(){return _0x12a283;});}function getClosedOrderClause(_0x438ea8,_0x2a5ed7){var _0xbbdf83='';var _0x545df2=[_0x42c1('0x6c'),'i.secondDisposition','i.disposition'];if(_0x438ea8===_0x42c1('0x33')){_0x545df2['unshift']('i.substatus');}if(_0x2a5ed7[_0x42c1('0x6d')]==='0'&&_0x438ea8==='mail'){_0xbbdf83=_0x42c1('0x6e');}else{if(_0x2a5ed7[_0x42c1('0x6d')]==='1'){_0x545df2[_0x42c1('0x6f')]();}_0xbbdf83='CONCAT_WS(\x27\x27,\x20'+_0x545df2[_0x42c1('0x70')](',\x20')+')';}return _0xbbdf83;}function getFilteredInteractions(_0x2461fd,_0x2d4454,_0x27ba7d,_0x5cc02b){var _0x34c448=utils['getInteractionFK'](_0x2461fd);var _0x11ec95=_[_0x42c1('0x63')](_0x2461fd)+_0x42c1('0x71');var _0x21f308=[];var _0x22ff56=getTagsQuery();var _0x57417f={'type':db[_0x42c1('0x72')][_0x42c1('0x73')]['SELECT'],'raw':!![]};var _0x2619ad=[];var _0x1b0851=[];return db[_0x42c1('0x74')][_0x42c1('0x75')](_0x22ff56[_0x42c1('0x76')](),_0x57417f)[_0x42c1('0x5e')](function(_0x46a4f1){_0x21f308=_['keyBy'](_0x46a4f1,'id');_0x57417f=_['merge'](_0x57417f,{'model':db[_0x11ec95],'mapToModel':!![],'nest':!![]});if(_0x27ba7d[_0x42c1('0x77')]){_0x5cc02b[_0x42c1('0x78')][_0x42c1('0x26')](function(_0xe90d5){_0x2d4454['field']('i.'+_0xe90d5);});}else{_0x2d4454[_0x42c1('0xd')](_0x42c1('0x79'),_0x42c1('0x7a'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x7b'),_0x42c1('0x7c'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x7d'),_0x42c1('0x7e'));if(_0x2461fd===_0x42c1('0x33')){_0x2d4454[_0x42c1('0xd')](_0x42c1('0x7f'),_0x42c1('0x80'));_0x2d4454['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','contactName');_0x2d4454[_0x42c1('0xd')]('i.id');_0x2d4454[_0x42c1('0xd')]('i.createdAt');_0x2d4454['field'](_0x42c1('0x81'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x82'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x83'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x84'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x85'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x86'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x87'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x88'));_0x2d4454['field'](_0x42c1('0x89'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x6c'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x6e'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x8a'));_0x2d4454['field'](_0x42c1('0x8b'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x8c'));_0x2d4454['field'](_0x42c1('0x8d'));}else if(_0x2461fd===_0x42c1('0x8e')){_0x2d4454['field'](_0x42c1('0x8f'),_0x42c1('0x90'));}else{_0x2d4454[_0x42c1('0xd')](_0x42c1('0x91'),_0x42c1('0x90'));}if(_0x2461fd!==_0x42c1('0x33')){_0x2d4454[_0x42c1('0xd')](_0x42c1('0x92'));}_0x2d4454['field'](_0x42c1('0x93'),_0x42c1('0x94'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x95'),_0x42c1('0x96'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x97'),_0x42c1('0x98'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x99'),_0x42c1('0x9a'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x9b'),_0x42c1('0x9c'));_0x2d4454['field'](_0x42c1('0x9d'),_0x42c1('0x9e'));_0x2d4454[_0x42c1('0xd')](_0x42c1('0x9f'),_0x42c1('0xa0'));_0x2d4454[_0x42c1('0xd')]('o.internal','Owner.internal');_0x2d4454[_0x42c1('0xd')](_0x42c1('0xa1'),_0x42c1('0xa2'));}if(_0x5cc02b[_0x42c1('0xa3')]){_0x2d4454['limit'](_0x5cc02b[_0x42c1('0xa3')]);}if(_0x5cc02b[_0x42c1('0xa4')]){_0x2d4454['offset'](_0x5cc02b[_0x42c1('0xa4')]);}return db['sequelize']['query'](_0x2d4454['toString'](),_0x57417f);})[_0x42c1('0x5e')](function(_0x594582){_0x2619ad=_0x594582;var _0x30dcd7=getUsersQuery(_0x2461fd,_0x2619ad);return db[_0x42c1('0x74')][_0x42c1('0x75')](_0x30dcd7[_0x42c1('0x76')](),_0x57417f);})[_0x42c1('0x5e')](function(_0x17231f){_0x1b0851=_['groupBy'](_0x17231f,_0x34c448);if(_0x2461fd==='mail'){return db[_0x42c1('0xa5')][_0x42c1('0xa6')]({'attributes':[_0x42c1('0xa7')],'raw':!![]});}})[_0x42c1('0x5e')](function(_0x3074fd){var _0x2996f2=_0x3074fd?_0x3074fd[_0x42c1('0xa7')]:undefined;var _0x4f0f91=_0x2619ad[_0x42c1('0x19')](function(_0x546850){return updateInteraction(_0x546850,_0x21f308,_0x1b0851,_0x2996f2);});return Promise['all'](_0x4f0f91);});}function countFilteredInteractions(_0x2f1e00,_0x33af8f){var _0x3a71ee=_0x2f1e00[_0x42c1('0xa8')]();_0x3a71ee[_0x42c1('0xd')](_0x42c1('0xa9'));_0x3a71ee[_0x42c1('0xd')](_0x42c1('0x79'),_0x42c1('0x7a'));var _0xd3afca=utils['getSelectedTags'](_0x33af8f);if(!_[_0x42c1('0xaa')](_0xd3afca)){_0x3a71ee['where']('t.id\x20IN\x20?',_0xd3afca);}var _0x373ab3={'type':db[_0x42c1('0x72')][_0x42c1('0x73')][_0x42c1('0xab')],'raw':!![]};return db[_0x42c1('0x74')][_0x42c1('0x75')](_0x3a71ee[_0x42c1('0x76')](),_0x373ab3);}module[_0x42c1('0xac')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x67f3=['i.lastMsgDirection','i.subject','i.to','i.ContactId','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','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','all','clone','where','t.id\x20IN\x20?','Sequelize','QueryTypes','lodash','squel','../parsers/advancedSearch','updateInteraction','./utils','getAccountFK','role','agent','search','select','field','name','color','getInteractionFK','user_has_','_interactions','u.id','u.fullname','from','left_join','users','u.id\x20=\x20ui.UserId','length','ui.','\x20IN\x20?','map','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','messages','interactionsTags','it.','\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','whatsapp','includes','fax','i.fax\x20LIKE\x20?','openchannel','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','type','default','text','value','start','end','unreadMessages','read','and','Contact','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','buildExpression','plainBody','body','some','compact','createdAt','parse','$gte','$lte','null','resolve','then','fields','tag','tags','clause','filter','get','Websites','Accounts','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','Interaction','SELECT','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','contactName','i.id','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt'];(function(_0x1cbbeb,_0x4a8586){var _0x23320a=function(_0x5c0436){while(--_0x5c0436){_0x1cbbeb['push'](_0x1cbbeb['shift']());}};_0x23320a(++_0x4a8586);}(_0x67f3,0xc4));var _0x367f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x67f3[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x367f('0x0'));var squel=require(_0x367f('0x1'));var as=require(_0x367f('0x2'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0x367f('0x3')];var utils=require(_0x367f('0x4'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x517b87,_0x26dbf2,_0x155bc9){var _0x2c2d57=![];var _0x83fd72=utils[_0x367f('0x5')](_0x517b87);if(_0x26dbf2[_0x367f('0x6')]===_0x367f('0x7')&&!_0x155bc9[_0x367f('0x8')]&&!_0x155bc9[_0x83fd72]){_0x2c2d57=!![];}return _0x2c2d57;}function getTagsQuery(){return squel[_0x367f('0x9')]()[_0x367f('0xa')]('id')[_0x367f('0xa')](_0x367f('0xb'))[_0x367f('0xa')](_0x367f('0xc'))['from']('tools_tags');}function getUsersQuery(_0x2b50b3,_0x4e42cb){var _0xe66f5e=utils[_0x367f('0xd')](_0x2b50b3);var _0x54751b=_0x367f('0xe')+_0x2b50b3+_0x367f('0xf');var _0x16441d=squel['select']()['field'](_0x367f('0x10'))[_0x367f('0xa')](_0x367f('0x11'))['field']('ui.'+_0xe66f5e)[_0x367f('0x12')](_0x54751b,'ui')[_0x367f('0x13')](_0x367f('0x14'),'u',_0x367f('0x15'));if(_0x4e42cb[_0x367f('0x16')]>0x0){_0x16441d['where'](_0x367f('0x17')+_0xe66f5e+_0x367f('0x18'),_[_0x367f('0x19')](_0x4e42cb,'id'));}return _0x16441d;}function getInteractionsQuery(_0x386885){var _0x1ad94=utils[_0x367f('0x1a')](_0x386885);var _0x1fbb32=utils[_0x367f('0x5')](_0x386885);var _0x2c49c7=utils[_0x367f('0xd')](_0x386885);return squel[_0x367f('0x9')]()[_0x367f('0x12')](_0x1ad94[_0x367f('0x1b')],'i')['left_join']('cm_contacts','c',_0x367f('0x1c'))[_0x367f('0x13')]('users','o','o.id\x20=\x20i.UserId')[_0x367f('0x13')](_0x1ad94[_0x367f('0x1d')],'a',_0x367f('0x1e')+_0x1fbb32)[_0x367f('0x13')](_0x1ad94[_0x367f('0x1f')],'me','me.'+_0x2c49c7+'\x20=\x20i.id')[_0x367f('0x13')](_0x1ad94[_0x367f('0x20')],'it',_0x367f('0x21')+_0x2c49c7+_0x367f('0x22'))[_0x367f('0x13')](_0x367f('0x23'),'t',_0x367f('0x24'));}function getSqlClauses(){var _0x2ce71f={'body':squel[_0x367f('0x25')](),'contact':squel[_0x367f('0x25')](),'default':squel['expr'](),'fields':squel[_0x367f('0x25')](),'filter':squel['expr'](),'read':squel[_0x367f('0x25')](),'tags':{'clause':squel[_0x367f('0x25')](),'ids':null},'user':squel[_0x367f('0x25')]()};return _0x2ce71f;}function parseTagParameter(_0x428319){var _0x352e68=squel[_0x367f('0x25')]();if(_0x428319){var _0x5e4db6=utils[_0x367f('0x26')](_0x428319);_0x5e4db6[_0x367f('0x27')](function(_0x23e7a1){_0x352e68['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x23e7a1+',%');});}return _0x352e68;}function parseReadParameter(_0x383f78){var _0x3f7ded='';if(_0x383f78){_0x3f7ded=_0x367f('0x28');if(_0x383f78==='1'){_0x3f7ded=_0x3f7ded[_0x367f('0x29')](_0x367f('0x2a'),'=');}else{_0x3f7ded=_0x3f7ded['replace']('{OPERATOR}','>');}}return _0x3f7ded;}function parseSearchFilter(_0x306e9a,_0x447853){var _0x18c398=squel[_0x367f('0x25')]();if(_0x447853){var _0x4dd32c=_0x447853[_0x367f('0x29')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x3970c4=qs['escapeLIKESpecialChars'](_0x4dd32c);if(qs['isNumeric'](_0x4dd32c)){_0x18c398['or'](_0x367f('0x2b'),_0x3970c4+'%');if(['sms',_0x367f('0x2c')][_0x367f('0x2d')](_0x306e9a)){_0x18c398['or']('i.phone\x20LIKE\x20?',_0x3970c4+'%');}else if(_0x306e9a===_0x367f('0x2e')){_0x18c398['or'](_0x367f('0x2f'),_0x3970c4+'%');}else if(_0x306e9a===_0x367f('0x30')){_0x18c398['or']('i.from\x20LIKE\x20?',_0x3970c4+'%');}}else if(_0x306e9a===_0x367f('0x31')&&qs[_0x367f('0x32')](_0x4dd32c)){_0x18c398['or'](_0x367f('0x33'),_0x3970c4+'%');}else{if(_0x306e9a===_0x367f('0x31')){_0x18c398['or'](_0x367f('0x34'),qs[_0x367f('0x35')](_0x4dd32c,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x367f('0x35')](_0x4dd32c));}else if(_0x306e9a!==_0x367f('0x2e')){_0x18c398['or'](_0x367f('0x36'),qs[_0x367f('0x35')](_0x4dd32c));}_0x18c398['or'](_0x367f('0x37'),qs['getFullTextValue'](_0x4dd32c,!![]),null);}}return _0x18c398;}function parseAdvancedSearchFilter(_0x45a8ad,_0x3d2940){var _0xa2fe7b=getSqlClauses();var _0x4f441c=as[_0x367f('0x38')](_0x45a8ad);var _0x285a78=_0x4f441c[_0x367f('0x39')];for(var _0x4c4e18=0x0;_0x4c4e18<_0x4f441c[_0x367f('0x3a')][_0x367f('0x16')];_0x4c4e18++){var _0x2ca5b8=_0x4f441c[_0x367f('0x3a')][_0x4c4e18];var _0x3537d6='i';var _0x46e639=_[_0x367f('0x3b')](_0x3d2940,['name',_0x2ca5b8[_0x367f('0xa')]]);if(_0x46e639){var _0x27db48=as['buildExpression'](_0x3537d6,_0x46e639[_0x367f('0x3c')],_0x2ca5b8);_0xa2fe7b[_0x367f('0x3d')][_0x285a78](_0x27db48[_0x367f('0x3e')],_0x27db48[_0x367f('0x3f')][_0x367f('0x40')],_0x27db48[_0x367f('0x3f')][_0x367f('0x41')]);}else{switch(_0x2ca5b8[_0x367f('0xa')]){case _0x367f('0x42'):var _0x1b21d9=parseReadParameter(_0x2ca5b8[_0x367f('0x3f')]);_0xa2fe7b[_0x367f('0x43')][_0x367f('0x44')](_0x1b21d9);break;case _0x367f('0x45'):if(_0x2ca5b8['operator']===_0x367f('0x46')){if(_0x2ca5b8['value'][_0x367f('0x47')]('\x20')[_0x367f('0x16')]>0x1){_0xa2fe7b[_0x367f('0x48')][_0x285a78]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2ca5b8[_0x367f('0x3f')],!![]),null);}else{var _0x49b927='%'+_0x2ca5b8[_0x367f('0x3f')]+'%';_0xa2fe7b[_0x367f('0x48')][_0x285a78](_0x367f('0x49'),_0x49b927,_0x49b927,_0x49b927);}}else{_0x46e639=_[_0x367f('0x3b')](_0x3d2940,['name',_0x367f('0x4a')]);_0x2ca5b8[_0x367f('0xa')]=_0x367f('0x4a');_0x27db48=as['buildExpression'](_0x3537d6,_0x46e639[_0x367f('0x3c')],_0x2ca5b8);_0xa2fe7b[_0x367f('0x48')][_0x285a78](_0x27db48[_0x367f('0x3e')],_0x27db48[_0x367f('0x3f')]['start'],_0x27db48[_0x367f('0x3f')][_0x367f('0x41')]);}break;case _0x367f('0x4b'):var _0x3a173=_0x2ca5b8[_0x367f('0x3f')][_0x367f('0x47')](',')['map'](function(_0x3549f1){return Number(_0x3549f1);});var _0x2b8af4=parseTagParameter(_0x3a173);_0xa2fe7b['tags']['clause'][_0x367f('0x44')](_0x2b8af4);_0xa2fe7b['tags'][_0x367f('0x4c')]=_0x3a173;break;case _0x367f('0x4d'):if(_0x2ca5b8['operator']===_0x367f('0x46')){_0xa2fe7b[_0x367f('0x4e')][_0x285a78](_0x367f('0x4f'),'%'+_0x2ca5b8[_0x367f('0x3f')]+'%',null);}else{_0x46e639=_[_0x367f('0x3b')](_0x3d2940,['name',_0x367f('0x50')]);_0x2ca5b8[_0x367f('0xa')]='UserId';_0x27db48=as[_0x367f('0x51')](_0x3537d6,_0x46e639[_0x367f('0x3c')],_0x2ca5b8);_0xa2fe7b[_0x367f('0x4e')][_0x285a78](_0x27db48[_0x367f('0x3e')],_0x27db48[_0x367f('0x3f')]['start'],_0x27db48[_0x367f('0x3f')]['end']);}break;case'body':case _0x367f('0x52'):_0x27db48=as['buildExpression']('me',null,_0x2ca5b8);_0xa2fe7b[_0x367f('0x53')][_0x285a78](_0x27db48[_0x367f('0x3e')],_0x27db48['value']['start'],_0x27db48['value'][_0x367f('0x41')]);break;}}}return _0xa2fe7b;}function parseModelFields(_0x8b1187,_0x40e070,_0x21a4bc){var _0x288cbc=utils['getAccountFK'](_0x8b1187);var _0x33dca5=squel[_0x367f('0x25')]();var _0x4564f8=_(_0x40e070)['keys']()[_0x367f('0x19')](function(_0x25e543){return _[_0x367f('0x54')](_0x21a4bc,[_0x367f('0xb'),_0x25e543])?_0x25e543:undefined;})[_0x367f('0x55')]()[_0x367f('0x3f')]();if(_0x4564f8[_0x367f('0x16')]>0x0){_0x4564f8[_0x367f('0x27')](function(_0x87f153){if(_0x87f153===_0x288cbc){_0x33dca5[_0x367f('0x44')]('i.'+_0x288cbc+_0x367f('0x18'),[]['concat'](_0x40e070[_0x87f153]));}else if(_0x87f153===_0x367f('0x56')){var _0x36a35e=JSON[_0x367f('0x57')](_0x40e070[_0x87f153])[_0x367f('0x58')];var _0x648ee2=JSON[_0x367f('0x57')](_0x40e070[_0x87f153])[_0x367f('0x59')];_0x33dca5[_0x367f('0x44')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x36a35e,_0x648ee2);}else{if(_0x40e070[_0x87f153]===_0x367f('0x5a')){_0x33dca5[_0x367f('0x44')]('i.'+_0x87f153+'\x20IS\x20NULL');}else{_0x33dca5[_0x367f('0x44')]('i.'+_0x87f153+'\x20=\x20?',_0x40e070[_0x87f153]);}}});}return _0x33dca5;}function parseQueryParameters(_0x5d220f,_0x1a95d5,_0x1ca482){var _0x2e0265=getSqlClauses();return Promise[_0x367f('0x5b')]()['then'](function(){return parseModelFields(_0x5d220f,_0x1a95d5,_0x1ca482);})[_0x367f('0x5c')](function(_0x4ba10c){_0x2e0265[_0x367f('0x5d')]['and'](_0x4ba10c);return parseReadParameter(_0x1a95d5[_0x367f('0x43')]);})['then'](function(_0x27b0fb){_0x2e0265[_0x367f('0x43')]['and'](_0x27b0fb);return parseTagParameter(_0x1a95d5[_0x367f('0x5e')]);})[_0x367f('0x5c')](function(_0x518f22){_0x2e0265[_0x367f('0x5f')][_0x367f('0x60')][_0x367f('0x44')](_0x518f22);return parseSearchFilter(_0x5d220f,_0x1a95d5[_0x367f('0x61')]);})[_0x367f('0x5c')](function(_0x50b128){_0x2e0265[_0x367f('0x61')]=_0x50b128;return _0x2e0265;});}function checkAccountsRestrictions(_0x4a1122,_0x3fd545,_0x319ee0){var _0x34d21e=utils[_0x367f('0x5')](_0x4a1122);var _0x255a9b=_0x367f('0x62')+_['capitalize'](_0x4a1122)+(_0x4a1122==='chat'?_0x367f('0x63'):_0x367f('0x64'));var _0x4110ad=squel['expr']();return Promise[_0x367f('0x5b')]()[_0x367f('0x5c')](function(){if(_0x319ee0[_0x367f('0x8')]&&_0x3fd545['role']===_0x367f('0x7')){return _0x3fd545[_0x255a9b]({'attributes':['id'],'raw':!![]});}})[_0x367f('0x5c')](function(_0x1c0fd6){if(_0x1c0fd6){if(_0x1c0fd6[_0x367f('0x16')]===0x0){_0x4110ad[_0x367f('0x44')]('i.'+_0x34d21e+_0x367f('0x65'));}else{_0x4110ad[_0x367f('0x44')]('i.'+_0x34d21e+_0x367f('0x18'),_[_0x367f('0x19')](_0x1c0fd6,'id'));}}else if(!_0x319ee0[_0x34d21e]){_0x4110ad['and']('i.'+_0x34d21e+_0x367f('0x66'));}})[_0x367f('0x5c')](function(){return _0x4110ad;});}function getClosedOrderClause(_0x50c16b,_0x5d4537){var _0x163c61='';var _0x448045=['i.thirdDisposition',_0x367f('0x67'),_0x367f('0x68')];if(_0x50c16b==='mail'){_0x448045[_0x367f('0x69')]('i.substatus');}if(_0x5d4537['closed']==='0'&&_0x50c16b===_0x367f('0x31')){_0x163c61=_0x367f('0x6a');}else{if(_0x5d4537[_0x367f('0x6b')]==='1'){_0x448045['shift']();}_0x163c61=_0x367f('0x6c')+_0x448045[_0x367f('0x6d')](',\x20')+')';}return _0x163c61;}function getFilteredInteractions(_0x2ea4c1,_0x3185b9,_0x1ee5c4,_0x1aa33f){var _0x3ae070=utils[_0x367f('0xd')](_0x2ea4c1);var _0x2354a8=_['capitalize'](_0x2ea4c1)+_0x367f('0x6e');var _0x50e18d=[];var _0x5ee61c=getTagsQuery();var _0x130ba6={'type':db['Sequelize']['QueryTypes'][_0x367f('0x6f')],'raw':!![]};var _0x40a082=[];var _0x11822f=[];return db[_0x367f('0x70')][_0x367f('0x71')](_0x5ee61c[_0x367f('0x72')](),_0x130ba6)[_0x367f('0x5c')](function(_0x454010){_0x50e18d=_[_0x367f('0x73')](_0x454010,'id');_0x130ba6=_[_0x367f('0x74')](_0x130ba6,{'model':db[_0x2354a8],'mapToModel':!![],'nest':!![]});if(_0x1ee5c4['fields']){_0x1aa33f['attributes']['forEach'](function(_0x370925){_0x3185b9[_0x367f('0xa')]('i.'+_0x370925);});}else{_0x3185b9[_0x367f('0xa')](_0x367f('0x75'),_0x367f('0x42'));_0x3185b9[_0x367f('0xa')]('a.key',_0x367f('0x76'));_0x3185b9[_0x367f('0xa')](_0x367f('0x77'),_0x367f('0x78'));if(_0x2ea4c1===_0x367f('0x31')){_0x3185b9[_0x367f('0xa')](_0x367f('0x79'),_0x367f('0x7a'));_0x3185b9['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',_0x367f('0x7b'));_0x3185b9[_0x367f('0xa')](_0x367f('0x7c'));_0x3185b9['field'](_0x367f('0x7d'));_0x3185b9['field']('i.updatedAt');_0x3185b9[_0x367f('0xa')](_0x367f('0x7e'));_0x3185b9[_0x367f('0xa')](_0x367f('0x7f'));_0x3185b9[_0x367f('0xa')](_0x367f('0x80'));_0x3185b9['field'](_0x367f('0x81'));_0x3185b9[_0x367f('0xa')](_0x367f('0x82'));_0x3185b9[_0x367f('0xa')](_0x367f('0x83'));_0x3185b9[_0x367f('0xa')]('i.disposition');_0x3185b9[_0x367f('0xa')](_0x367f('0x67'));_0x3185b9['field']('i.thirdDisposition');_0x3185b9[_0x367f('0xa')]('i.substatus');_0x3185b9[_0x367f('0xa')](_0x367f('0x84'));_0x3185b9['field'](_0x367f('0x85'));_0x3185b9[_0x367f('0xa')]('i.MailAccountId');_0x3185b9[_0x367f('0xa')](_0x367f('0x86'));}else if(_0x2ea4c1===_0x367f('0x30')){_0x3185b9[_0x367f('0xa')](_0x367f('0x87'),'contactName');}else{_0x3185b9[_0x367f('0xa')](_0x367f('0x88'),_0x367f('0x7b'));}if(_0x2ea4c1!==_0x367f('0x31')){_0x3185b9[_0x367f('0xa')](_0x367f('0x89'));}_0x3185b9['field'](_0x367f('0x8a'),_0x367f('0x8b'));_0x3185b9['field']('c.lastName',_0x367f('0x8c'));_0x3185b9[_0x367f('0xa')](_0x367f('0x8d'),'Contact.email');_0x3185b9[_0x367f('0xa')](_0x367f('0x8e'),_0x367f('0x8f'));_0x3185b9['field']('c.mobile',_0x367f('0x90'));_0x3185b9[_0x367f('0xa')](_0x367f('0x91'),_0x367f('0x92'));_0x3185b9[_0x367f('0xa')](_0x367f('0x93'),_0x367f('0x94'));_0x3185b9['field'](_0x367f('0x95'),_0x367f('0x96'));_0x3185b9[_0x367f('0xa')](_0x367f('0x97'),_0x367f('0x98'));}if(_0x1aa33f[_0x367f('0x99')]){_0x3185b9[_0x367f('0x99')](_0x1aa33f[_0x367f('0x99')]);}if(_0x1aa33f[_0x367f('0x9a')]){_0x3185b9[_0x367f('0x9a')](_0x1aa33f[_0x367f('0x9a')]);}return db[_0x367f('0x70')][_0x367f('0x71')](_0x3185b9[_0x367f('0x72')](),_0x130ba6);})['then'](function(_0x335e6f){_0x40a082=_0x335e6f;var _0x1086c4=getUsersQuery(_0x2ea4c1,_0x40a082);return db[_0x367f('0x70')]['query'](_0x1086c4['toString'](),_0x130ba6);})[_0x367f('0x5c')](function(_0x1dfaa3){_0x11822f=_[_0x367f('0x9b')](_0x1dfaa3,_0x3ae070);if(_0x2ea4c1==='mail'){return db[_0x367f('0x9c')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]});}})['then'](function(_0x59890e){var _0x56b12d=_0x59890e?_0x59890e['enableEmailPreview']:undefined;var _0xf2bd6d=_0x40a082[_0x367f('0x19')](function(_0x1bf8a0){return updateInteraction(_0x1bf8a0,_0x50e18d,_0x11822f,_0x56b12d);});return Promise[_0x367f('0x9d')](_0xf2bd6d);});}function countFilteredInteractions(_0x15d230,_0x138c39){var _0x9938d0=_0x15d230[_0x367f('0x9e')]();_0x9938d0[_0x367f('0xa')]('COUNT(*)');_0x9938d0[_0x367f('0xa')](_0x367f('0x75'),'unreadMessages');var _0x2b9923=utils[_0x367f('0x26')](_0x138c39);if(!_['isEmpty'](_0x2b9923)){_0x9938d0[_0x367f('0x9f')](_0x367f('0xa0'),_0x2b9923);}var _0x31c945={'type':db[_0x367f('0xa1')][_0x367f('0xa2')]['SELECT'],'raw':!![]};return db[_0x367f('0x70')]['query'](_0x9938d0[_0x367f('0x72')](),_0x31c945);}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 749b141..de5414c 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 _0xc3ba=['lodash','../../mysqldb','fullname','split','forEach','waiting','talking','answered','unmanaged','abandoned','total','disposition','UserId','MailMessage','findOne','out','-id','then','plainBody','trimStart','updateInteraction','Tags','TagIds','catch'];(function(_0x135ce4,_0x2b2438){var _0x3c1a2b=function(_0x5ede44){while(--_0x5ede44){_0x135ce4['push'](_0x135ce4['shift']());}};_0x3c1a2b(++_0x2b2438);}(_0xc3ba,0x1e0));var _0xac3b=function(_0x4eaca5,_0x1697dc){_0x4eaca5=_0x4eaca5-0x0;var _0x14eba7=_0xc3ba[_0x4eaca5];return _0x14eba7;};'use strict';var _=require(_0xac3b('0x0'));var db=require(_0xac3b('0x1'))['db'];function getInteractionUsers(_0x3c2e4e,_0x2c38ee){return new Promise(function(_0x4cb2c9,_0xa72a90){try{var _0x1e91b9=[];if(_0x2c38ee[_0x3c2e4e]){_0x1e91b9=_0x2c38ee[_0x3c2e4e]['map'](function(_0x5604c3){return{'id':_0x5604c3['id'],'fullname':_0x5604c3[_0xac3b('0x2')]};});}return _0x4cb2c9(_0x1e91b9);}catch(_0x5027ff){_0xa72a90(_0x5027ff);}});}function getInteractionTags(_0x2c5b12,_0x2f616d){var _0x1d2d6d=[];if(_0x2c5b12){_0x2c5b12[_0xac3b('0x3')](',')[_0xac3b('0x4')](function(_0x458e44){_0x1d2d6d['push'](_0x2f616d[_0x458e44]);});}return _0x1d2d6d;}function updateWaitingCounter(_0x198053){if(_0x198053['waiting']){_0x198053[_0xac3b('0x5')]-=0x1;}}function updateInteractionCounters(_0xf7f4fb){_0xf7f4fb['waiting']=0x0;_0xf7f4fb[_0xac3b('0x6')]=0x0;_0xf7f4fb[_0xac3b('0x7')]=0x0;_0xf7f4fb[_0xac3b('0x8')]=0x0;_0xf7f4fb[_0xac3b('0x9')]=0x0;_0xf7f4fb[_0xac3b('0xa')]=0x0;if(_0xf7f4fb['closed']){if(_0xf7f4fb[_0xac3b('0xb')]===_0xac3b('0x9')){_0xf7f4fb[_0xac3b('0x9')]+=0x1;updateWaitingCounter(_0xf7f4fb);}if(_0xf7f4fb[_0xac3b('0xc')]){_0xf7f4fb[_0xac3b('0x7')]+=0x1;if(_0xf7f4fb[_0xac3b('0x6')]){_0xf7f4fb['talking']-=0x1;}}else{if(_0xf7f4fb[_0xac3b('0xb')]){_0xf7f4fb[_0xac3b('0x8')]+=0x1;updateWaitingCounter(_0xf7f4fb);}}}else{if(!_0xf7f4fb['UserId']){_0xf7f4fb[_0xac3b('0x5')]+=0x1;}if(_0xf7f4fb[_0xac3b('0xc')]){_0xf7f4fb['talking']+=0x1;updateWaitingCounter(_0xf7f4fb);}}_0xf7f4fb['total']+=0x1;return _0xf7f4fb;}function getLastMessageText(_0x6171ea){return db[_0xac3b('0xd')][_0xac3b('0xe')]({'where':{'$and':[{'MailInteractionId':_0x6171ea['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xac3b('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xac3b('0x10'),'raw':!![]})[_0xac3b('0x11')](function(_0x1c17c6){if(_0x1c17c6&&_0x1c17c6[_0xac3b('0x12')]){_0x6171ea['lastMsgText']=_[_0xac3b('0x13')](_0x1c17c6['plainBody']);}return _0x6171ea;})['catch'](function(_0x54ac85){throw _0x54ac85;});}exports[_0xac3b('0x14')]=function(_0x5baca1,_0x3a8fbd,_0x4a6cd6,_0x37b7df){return new Promise(function(_0x1a34cf,_0x2a9232){return getInteractionUsers(_0x5baca1['id'],_0x4a6cd6)['then'](function(_0x44c46a){_0x5baca1['Users']=_0x44c46a;return getInteractionTags(_0x5baca1['TagIds'],_0x3a8fbd);})[_0xac3b('0x11')](function(_0x1194c5){_0x5baca1[_0xac3b('0x15')]=_0x1194c5;delete _0x5baca1[_0xac3b('0x16')];return updateInteractionCounters(_0x5baca1);})['then'](function(_0x1158e6){if(_0x37b7df){return getLastMessageText(_0x1158e6);}else{return _0x1158e6;}})[_0xac3b('0x11')](function(_0x4aaaf2){_0x1a34cf(_0x4aaaf2);})[_0xac3b('0x17')](function(_0x282911){_0x2a9232(_0x282911);});});}; \ No newline at end of file +var _0x1167=['Users','TagIds','Tags','catch','lodash','../../mysqldb','map','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','-id','then','lastMsgText','trimStart','plainBody','updateInteraction'];(function(_0x39442c,_0x5da9ad){var _0x200a0c=function(_0x1a79c1){while(--_0x1a79c1){_0x39442c['push'](_0x39442c['shift']());}};_0x200a0c(++_0x5da9ad);}(_0x1167,0x199));var _0x7116=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1167[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7116('0x0'));var db=require(_0x7116('0x1'))['db'];function getInteractionUsers(_0x13b369,_0x36fd62){return new Promise(function(_0x2aed6b,_0x5b5368){try{var _0x5ae153=[];if(_0x36fd62[_0x13b369]){_0x5ae153=_0x36fd62[_0x13b369][_0x7116('0x2')](function(_0x1c7781){return{'id':_0x1c7781['id'],'fullname':_0x1c7781['fullname']};});}return _0x2aed6b(_0x5ae153);}catch(_0x231ff7){_0x5b5368(_0x231ff7);}});}function getInteractionTags(_0x4d5825,_0x239a4d){var _0x1ae84c=[];if(_0x4d5825){_0x4d5825[_0x7116('0x3')](',')[_0x7116('0x4')](function(_0x3edf2c){_0x1ae84c[_0x7116('0x5')](_0x239a4d[_0x3edf2c]);});}return _0x1ae84c;}function updateWaitingCounter(_0x2fa2b4){if(_0x2fa2b4[_0x7116('0x6')]){_0x2fa2b4[_0x7116('0x6')]-=0x1;}}function updateInteractionCounters(_0x11e4e4){_0x11e4e4[_0x7116('0x6')]=0x0;_0x11e4e4[_0x7116('0x7')]=0x0;_0x11e4e4[_0x7116('0x8')]=0x0;_0x11e4e4[_0x7116('0x9')]=0x0;_0x11e4e4[_0x7116('0xa')]=0x0;_0x11e4e4[_0x7116('0xb')]=0x0;if(_0x11e4e4[_0x7116('0xc')]){if(_0x11e4e4[_0x7116('0xd')]===_0x7116('0xa')){_0x11e4e4[_0x7116('0xa')]+=0x1;updateWaitingCounter(_0x11e4e4);}if(_0x11e4e4[_0x7116('0xe')]){_0x11e4e4[_0x7116('0x8')]+=0x1;if(_0x11e4e4[_0x7116('0x7')]){_0x11e4e4['talking']-=0x1;}}else{if(_0x11e4e4[_0x7116('0xd')]){_0x11e4e4[_0x7116('0x9')]+=0x1;updateWaitingCounter(_0x11e4e4);}}}else{if(!_0x11e4e4[_0x7116('0xe')]){_0x11e4e4['waiting']+=0x1;}if(_0x11e4e4[_0x7116('0xe')]){_0x11e4e4[_0x7116('0x7')]+=0x1;updateWaitingCounter(_0x11e4e4);}}_0x11e4e4[_0x7116('0xb')]+=0x1;return _0x11e4e4;}function getLastMessageText(_0x53fbd3){return db[_0x7116('0xf')][_0x7116('0x10')]({'where':{'$and':[{'MailInteractionId':_0x53fbd3['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x7116('0x11'),'raw':!![]})[_0x7116('0x12')](function(_0x577a8d){if(_0x577a8d&&_0x577a8d['plainBody']){_0x53fbd3[_0x7116('0x13')]=_[_0x7116('0x14')](_0x577a8d[_0x7116('0x15')]);}return _0x53fbd3;})['catch'](function(_0x532495){throw _0x532495;});}exports[_0x7116('0x16')]=function(_0x385aa4,_0xbb83e6,_0x4637d2,_0x5270f8){return new Promise(function(_0xb2b3db,_0x170ba6){return getInteractionUsers(_0x385aa4['id'],_0x4637d2)[_0x7116('0x12')](function(_0x34083c){_0x385aa4[_0x7116('0x17')]=_0x34083c;return getInteractionTags(_0x385aa4[_0x7116('0x18')],_0xbb83e6);})['then'](function(_0x3afec6){_0x385aa4[_0x7116('0x19')]=_0x3afec6;delete _0x385aa4[_0x7116('0x18')];return updateInteractionCounters(_0x385aa4);})['then'](function(_0x3f64fe){if(_0x5270f8){return getLastMessageText(_0x3f64fe);}else{return _0x3f64fe;}})[_0x7116('0x12')](function(_0x4d9928){_0xb2b3db(_0x4d9928);})[_0x7116('0x1a')](function(_0x5a4333){_0x170ba6(_0x5a4333);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 09725e9..c3062ba 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 _0xddfc=['Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','then','update','info','catch','error','toLowerCase','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20role=','\x20interaction=','\x20body=','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website'];(function(_0x280598,_0x4675ef){var _0x4d7c9f=function(_0x1ffb24){while(--_0x1ffb24){_0x280598['push'](_0x280598['shift']());}};_0x4d7c9f(++_0x4675ef);}(_0xddfc,0x6f));var _0xcddf=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xddfc[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xcddf('0x0'));var db=require(_0xcddf('0x1'))['db'];var loggers={'openchannel':require(_0xcddf('0x2'))(_0xcddf('0x3')),'mail':require(_0xcddf('0x2'))(_0xcddf('0x4')),'fax':require(_0xcddf('0x2'))(_0xcddf('0x5')),'sms':require(_0xcddf('0x2'))(_0xcddf('0x6')),'chat':require(_0xcddf('0x2'))(_0xcddf('0x7')),'whatsapp':require(_0xcddf('0x2'))(_0xcddf('0x8'))};function getAccountFK(_0x366fe9){return _[_0xcddf('0x9')](_0x366fe9)+(_0x366fe9===_0xcddf('0xa')?_0xcddf('0xb'):_0xcddf('0xc'))+'Id';}function getInteractionFK(_0x21b75f){return _[_0xcddf('0x9')](_0x21b75f)+_0xcddf('0xd');}function getInteractionId(_0x3c5dcc,_0x3376f8,_0x10a0fd){if(_0x3c5dcc&&_0x3c5dcc[_[_0xcddf('0xe')](_0x10a0fd)+_0xcddf('0xd')]){return _0x3c5dcc[_[_0xcddf('0xe')](_0x10a0fd)+_0xcddf('0xd')];}else if(_0x3c5dcc&&_0x3c5dcc['id']){return _0x3c5dcc['id'];}else if(_0x3376f8&&_0x3376f8['id']){return _0x3376f8['id'];}else{return _0xcddf('0xf');}}function getInteractionsTables(_0x3a8eab){return{'accounts':_0x3a8eab+'_'+(_0x3a8eab===_0xcddf('0xa')?_0xcddf('0x10'):_0xcddf('0x11')),'interactions':_0x3a8eab+_0xcddf('0x12'),'interactionsTags':_0x3a8eab+_0xcddf('0x13'),'messages':_0x3a8eab+_0xcddf('0x14'),'userInteractions':_0xcddf('0x15')+_0x3a8eab+'_interactions'};}function getSelectedTags(_0x20fd8e){var _0x1d7001=[];if(_0x20fd8e){_0x1d7001=Array[_0xcddf('0x16')](_0x20fd8e)?_0x20fd8e:[_0x20fd8e];}return _0x1d7001;}function log(_0x1c179a,_0x5e4809,_0x51da0f,_0x34f24f,_0x23fee9,_0x3309ad){loggers[_0x23fee9['toLowerCase']()][_0x1c179a](_0xcddf('0x17'),_0x3309ad[_0xcddf('0x18')](),_0x5e4809?_0x5e4809['id']:null,_0x5e4809?_0x5e4809[_0xcddf('0x19')]:null,_0x5e4809?_0x5e4809[_0xcddf('0x1a')]:null,getInteractionId(_0x51da0f,_0x34f24f,_0x23fee9),_0x51da0f?JSON[_0xcddf('0x1b')](_0x51da0f):_0xcddf('0x1c'));}function updateUser(_0x4aa714,_0x5658a6,_0x5e6036,_0x595f7c,_0x5469eb){db[_['upperFirst'](_0x595f7c)+_0xcddf('0x1d')]['findOne']({'where':{'id':getInteractionId(_0x5658a6,_0x5e6036,_0x595f7c)}})[_0xcddf('0x1e')](function(_0x4754cf){if(_0x4754cf){return _0x4754cf[_0xcddf('0x1f')]({'UserId':_0x4aa714?_0x4aa714['id']:null});}})[_0xcddf('0x1e')](function(_0xa0b804){if(_0xa0b804){log(_0xcddf('0x20'),_0x4aa714,_0x5658a6,_0x5e6036,_0x595f7c,_0x5469eb);}})[_0xcddf('0x21')](function(){log(_0xcddf('0x22'),_0x4aa714,_0x5658a6,_0x5e6036,_0x595f7c,_0x5469eb);});}function logAcceptMessage(_0x42e1b2,_0x1e4554,_0x133f59,_0x4cfd91){var _0x1a9c9e=loggers[_0x42e1b2[_0xcddf('0x23')]()];var _0x722da4=_0x1e4554['id'];var _0x4cb385=_0x1e4554[_0xcddf('0x19')];var _0xe4e3d4=_0x1e4554[_0xcddf('0x1a')];var _0x24e9b1=JSON['stringify'](_0x4cfd91||null);_0x1a9c9e['info']('['+_0x42e1b2[_0xcddf('0x18')]()+_0xcddf('0x24')+_0x722da4+_0xcddf('0x25')+_0x4cb385+_0xcddf('0x26')+_0xe4e3d4+_0xcddf('0x27')+_0x133f59+_0xcddf('0x28')+_0x24e9b1);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0x7f9c=['Interaction','findOne','then','update','info','error','name','stringify','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20role=','\x20body=','lodash','../../mysqldb','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','isArray','toLowerCase','toUpperCase','role','null'];(function(_0x51b973,_0x26c0f6){var _0x37ac06=function(_0x221ab6){while(--_0x221ab6){_0x51b973['push'](_0x51b973['shift']());}};_0x37ac06(++_0x26c0f6);}(_0x7f9c,0x174));var _0xc7f9=function(_0x1f1c27,_0x3d5a0b){_0x1f1c27=_0x1f1c27-0x0;var _0x334749=_0x7f9c[_0x1f1c27];return _0x334749;};'use strict';var _=require(_0xc7f9('0x0'));var db=require(_0xc7f9('0x1'))['db'];var loggers={'openchannel':require(_0xc7f9('0x2'))('openchannel-interactions'),'mail':require(_0xc7f9('0x2'))('mail-interactions'),'fax':require(_0xc7f9('0x2'))(_0xc7f9('0x3')),'sms':require(_0xc7f9('0x2'))(_0xc7f9('0x4')),'chat':require(_0xc7f9('0x2'))(_0xc7f9('0x5')),'whatsapp':require(_0xc7f9('0x2'))(_0xc7f9('0x6'))};function getAccountFK(_0x59ba28){return _[_0xc7f9('0x7')](_0x59ba28)+(_0x59ba28===_0xc7f9('0x8')?_0xc7f9('0x9'):_0xc7f9('0xa'))+'Id';}function getInteractionFK(_0x427253){return _[_0xc7f9('0x7')](_0x427253)+'InteractionId';}function getInteractionId(_0x51ca8f,_0x501fe8,_0x53c227){if(_0x51ca8f&&_0x51ca8f[_[_0xc7f9('0xb')](_0x53c227)+_0xc7f9('0xc')]){return _0x51ca8f[_[_0xc7f9('0xb')](_0x53c227)+'InteractionId'];}else if(_0x51ca8f&&_0x51ca8f['id']){return _0x51ca8f['id'];}else if(_0x501fe8&&_0x501fe8['id']){return _0x501fe8['id'];}else{return _0xc7f9('0xd');}}function getInteractionsTables(_0xf86771){return{'accounts':_0xf86771+'_'+(_0xf86771===_0xc7f9('0x8')?_0xc7f9('0xe'):_0xc7f9('0xf')),'interactions':_0xf86771+_0xc7f9('0x10'),'interactionsTags':_0xf86771+_0xc7f9('0x11'),'messages':_0xf86771+_0xc7f9('0x12'),'userInteractions':'user_has_'+_0xf86771+_0xc7f9('0x10')};}function getSelectedTags(_0x1b0d79){var _0x11a7ed=[];if(_0x1b0d79){_0x11a7ed=Array[_0xc7f9('0x13')](_0x1b0d79)?_0x1b0d79:[_0x1b0d79];}return _0x11a7ed;}function log(_0x50022a,_0x45ec8c,_0x603246,_0x5a3006,_0x3372dd,_0x4650cc){loggers[_0x3372dd[_0xc7f9('0x14')]()][_0x50022a]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4650cc[_0xc7f9('0x15')](),_0x45ec8c?_0x45ec8c['id']:null,_0x45ec8c?_0x45ec8c['name']:null,_0x45ec8c?_0x45ec8c[_0xc7f9('0x16')]:null,getInteractionId(_0x603246,_0x5a3006,_0x3372dd),_0x603246?JSON['stringify'](_0x603246):_0xc7f9('0x17'));}function updateUser(_0x2e32ec,_0x58ca53,_0x343e42,_0x5de9e8,_0x1db7d7){db[_[_0xc7f9('0xb')](_0x5de9e8)+_0xc7f9('0x18')][_0xc7f9('0x19')]({'where':{'id':getInteractionId(_0x58ca53,_0x343e42,_0x5de9e8)}})[_0xc7f9('0x1a')](function(_0x5348e6){if(_0x5348e6){return _0x5348e6[_0xc7f9('0x1b')]({'UserId':_0x2e32ec?_0x2e32ec['id']:null});}})[_0xc7f9('0x1a')](function(_0x4d37cb){if(_0x4d37cb){log(_0xc7f9('0x1c'),_0x2e32ec,_0x58ca53,_0x343e42,_0x5de9e8,_0x1db7d7);}})['catch'](function(){log(_0xc7f9('0x1d'),_0x2e32ec,_0x58ca53,_0x343e42,_0x5de9e8,_0x1db7d7);});}function logAcceptMessage(_0x2de59a,_0x46c8e4,_0x5b7643,_0x4253bc){var _0x5d3083=loggers[_0x2de59a[_0xc7f9('0x14')]()];var _0x57cccb=_0x46c8e4['id'];var _0x1f6244=_0x46c8e4[_0xc7f9('0x1e')];var _0x10e6dd=_0x46c8e4['role'];var _0x2a20fb=JSON[_0xc7f9('0x1f')](_0x4253bc||null);_0x5d3083['info']('['+_0x2de59a[_0xc7f9('0x15')]()+_0xc7f9('0x20')+_0x57cccb+_0xc7f9('0x21')+_0x1f6244+_0xc7f9('0x22')+_0x10e6dd+'\x20interaction='+_0x5b7643+_0xc7f9('0x23')+_0x2a20fb);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 386584b..7c4ff45 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 _0x8cc7=['aes-256-ctr','format','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','json','admin','user','isUserLimit','crypto','util','../../config/environment','data1','license','split','createDecipher'];(function(_0xa398c3,_0x115f87){var _0x53d3e0=function(_0xf0d186){while(--_0xf0d186){_0xa398c3['push'](_0xa398c3['shift']());}};_0x53d3e0(++_0x115f87);}(_0x8cc7,0x1f1));var _0x78cc=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8cc7[_0xa1e3e3];return _0xc980e9;};'use strict';var crypto=require(_0x78cc('0x0'));var util=require(_0x78cc('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x78cc('0x2'));function getValueFromLicense(_0x1d0e02,_0x3db261){if(_0x1d0e02&&_0x3db261){if(_0x3db261[_0x78cc('0x3')]&&_0x3db261[_0x78cc('0x4')]){var _0x1b6eda=_0x3db261[_0x78cc('0x3')];var _0x33b654=_0x3db261['license'];var _0xf994f9=_0x1b6eda[_0x78cc('0x5')]('-')[0x4];var _0x8b4e76=_0x1b6eda[_0x78cc('0x5')]('-')[0x0];var _0x557e03=crypto[_0x78cc('0x6')](_0x78cc('0x7'),util[_0x78cc('0x8')]('%s:%s:%s',_0xf994f9,_0x1b6eda,_0x8b4e76));var _0x553194=_0x557e03[_0x78cc('0x9')](_0x33b654,_0x78cc('0xa'),_0x78cc('0xb'));_0x553194+=_0x557e03[_0x78cc('0xc')](_0x78cc('0xb'));var _0x3ce926=JSON[_0x78cc('0xd')](_0x553194);return _0x3ce926[_0x78cc('0xe')](_0x1d0e02)?_0x3ce926[_0x1d0e02]:null;}}return null;}function isLimit(_0x31bfdb,_0x1d874a,_0x3dae4,_0x462dd5){var _0x531547=_0x1d874a;return compose()[_0x78cc('0xf')](function(_0x4b81a3,_0xbf9cb2,_0xb0485){return db[_0x78cc('0x10')][_0x78cc('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x5e420d){var _0x4b027c=getValueFromLicense(_0x31bfdb,_0x5e420d);return _0x4b027c?_0x4b027c:_0x531547;})[_0x78cc('0x12')](function(_0x430c92){_0x531547=_0x430c92;return _0x3dae4[_0x78cc('0x13')](_0x462dd5);})[_0x78cc('0x12')](function(_0x2dc668){if(_0x2dc668>=_0x531547){return _0xbf9cb2['status'](0x193)[_0x78cc('0x14')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x31bfdb)});}_0xb0485();})['catch'](function(_0x26ee10){_0xb0485(_0x26ee10);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0x78cc('0x15')},{'role':_0x78cc('0x16')}]}});}exports[_0x78cc('0x17')]=isUserLimit; \ No newline at end of file +var _0xcd06=['admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','update','base64','final','utf8','parse','hasOwnProperty','use','License','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users'];(function(_0x1f3ff7,_0x59ce30){var _0x4b41ff=function(_0x5857d9){while(--_0x5857d9){_0x1f3ff7['push'](_0x1f3ff7['shift']());}};_0x4b41ff(++_0x59ce30);}(_0xcd06,0x1b3));var _0x6cd0=function(_0x4a040f,_0x26c250){_0x4a040f=_0x4a040f-0x0;var _0xa67cb0=_0xcd06[_0x4a040f];return _0xa67cb0;};'use strict';var crypto=require(_0x6cd0('0x0'));var util=require(_0x6cd0('0x1'));var compose=require(_0x6cd0('0x2'));var db=require(_0x6cd0('0x3'))['db'];var config=require(_0x6cd0('0x4'));function getValueFromLicense(_0x35f0cc,_0xe8d48c){if(_0x35f0cc&&_0xe8d48c){if(_0xe8d48c[_0x6cd0('0x5')]&&_0xe8d48c['license']){var _0x1b4268=_0xe8d48c[_0x6cd0('0x5')];var _0x48d8c6=_0xe8d48c[_0x6cd0('0x6')];var _0x523419=_0x1b4268[_0x6cd0('0x7')]('-')[0x4];var _0x50cb97=_0x1b4268[_0x6cd0('0x7')]('-')[0x0];var _0x41b131=crypto[_0x6cd0('0x8')]('aes-256-ctr',util[_0x6cd0('0x9')](_0x6cd0('0xa'),_0x523419,_0x1b4268,_0x50cb97));var _0x1bad23=_0x41b131[_0x6cd0('0xb')](_0x48d8c6,_0x6cd0('0xc'),'utf8');_0x1bad23+=_0x41b131[_0x6cd0('0xd')](_0x6cd0('0xe'));var _0x306dd8=JSON[_0x6cd0('0xf')](_0x1bad23);return _0x306dd8[_0x6cd0('0x10')](_0x35f0cc)?_0x306dd8[_0x35f0cc]:null;}}return null;}function isLimit(_0x4456e6,_0x4d2318,_0xc8ed39,_0x7621fe){var _0x517c8f=_0x4d2318;return compose()[_0x6cd0('0x11')](function(_0x6164a5,_0x4319c8,_0x21a3b0){return db[_0x6cd0('0x12')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1ce821){var _0x1ddab0=getValueFromLicense(_0x4456e6,_0x1ce821);return _0x1ddab0?_0x1ddab0:_0x517c8f;})[_0x6cd0('0x13')](function(_0x4929bf){_0x517c8f=_0x4929bf;return _0xc8ed39[_0x6cd0('0x14')](_0x7621fe);})[_0x6cd0('0x13')](function(_0x3cfd0d){if(_0x3cfd0d>=_0x517c8f){return _0x4319c8['status'](0x193)['json']({'message':util[_0x6cd0('0x9')](_0x6cd0('0x15'),_0x4456e6)});}_0x21a3b0();})[_0x6cd0('0x16')](function(_0x11c4f5){_0x21a3b0(_0x11c4f5);});});}function isUserLimit(){return isLimit(_0x6cd0('0x17'),0x1,db['User'],{'where':{'$or':[{'role':_0x6cd0('0x18')},{'role':_0x6cd0('0x19')}]}});}exports[_0x6cd0('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 822d1dd..ad06bbb 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 _0x1a32=['push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','format','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','slice','forEach','shift','match','filter','indexOf','map'];(function(_0x1213ce,_0x3a7c6a){var _0x432b07=function(_0x1a20e0){while(--_0x1a20e0){_0x1213ce['push'](_0x1213ce['shift']());}};_0x432b07(++_0x3a7c6a);}(_0x1a32,0xda));var _0x21a3=function(_0x261931,_0x5b654a){_0x261931=_0x261931-0x0;var _0x11083a=_0x1a32[_0x261931];return _0x11083a;};'use strict';var _=require(_0x21a3('0x0'));var moment=require(_0x21a3('0x1'));exports[_0x21a3('0x2')]=function(_0x3c051e){var _0x12c71e={'conditions':[]};_0x12c71e[_0x21a3('0x3')]=_[_0x21a3('0x4')](_0x3c051e,_0x21a3('0x5'))?'or':_0x21a3('0x6');var _0x1a8cad=_0x3c051e['replace'](_0x21a3('0x7'),'')[_0x21a3('0x8')](_0x21a3('0x5'),'')[_0x21a3('0x9')]('||');for(var _0x1519c9=0x0;_0x1519c9<_0x1a8cad[_0x21a3('0xa')];_0x1519c9++){var _0x2291f0=_0x1a8cad[_0x1519c9][_0x21a3('0x9')](':=');var _0x1029df=_0x2291f0[0x0];var _0x49111c=_0x2291f0[_0x21a3('0xb')](0x1);_0x49111c[_0x21a3('0xc')](function(_0x39ac40){var _0x5a6b7d=_0x39ac40[_0x21a3('0x9')]('[')[_0x21a3('0xd')]();var _0x46a7d9=_0x39ac40[_0x21a3('0xe')](/\[(.*?)\]/g);_0x46a7d9['forEach'](function(_0x57824f){var _0x3bd6d4=_0x57824f[_0x21a3('0x9')]('[')[_0x21a3('0xf')](function(_0x8e49d9){return _0x8e49d9[_0x21a3('0x10')](']')>-0x1;})[_0x21a3('0x11')](function(_0x154211){return _0x154211[_0x21a3('0x9')](']')[0x0];})[0x0];_0x12c71e['conditions'][_0x21a3('0x12')]({'field':_0x1029df,'operator':_0x5a6b7d,'value':_0x3bd6d4});});});}return _0x12c71e;};exports[_0x21a3('0x13')]=function(_0x22df3c,_0x7927aa,_0x571506){var _0x1d6b7e={};if(_0x7927aa===_0x21a3('0x14')){if(_0x571506[_0x21a3('0x15')]===_0x21a3('0x16')){_0x571506[_0x21a3('0x15')]=_0x21a3('0x17');_0x571506[_0x21a3('0x18')]+=','+_0x571506[_0x21a3('0x18')];}else if(_[_0x21a3('0x19')]([_0x21a3('0x1a'),_0x21a3('0x1b')],_0x571506[_0x21a3('0x15')])){_0x571506['value']=moment(_0x571506['value'])[_0x21a3('0x1c')](0x1,_0x21a3('0x1d'))['format'](_0x21a3('0x1e'));}}if(_0x571506[_0x21a3('0x1f')]){_0x7927aa=_0x571506[_0x21a3('0x1f')];_0x1d6b7e[_0x21a3('0x20')]=_0x21a3('0x21')+_0x22df3c+'.'+_0x571506[_0x21a3('0x22')]+'\x20AS\x20'+_0x571506['castTo']+')\x20'+parseOperator(_0x571506[_0x21a3('0x15')]);}else{_0x1d6b7e[_0x21a3('0x20')]=_0x22df3c+'.'+_0x571506[_0x21a3('0x22')]+'\x20'+parseOperator(_0x571506[_0x21a3('0x15')]);}if(_[_0x21a3('0x19')]([_0x21a3('0x23'),_0x21a3('0x24')],_0x571506[_0x21a3('0x15')]))_0x1d6b7e['text']='('+_0x1d6b7e[_0x21a3('0x20')]+_0x21a3('0x25')+_0x22df3c+'.'+_0x571506[_0x21a3('0x22')]+_0x21a3('0x26');_0x1d6b7e[_0x21a3('0x18')]=parseValue(_0x7927aa,_0x571506[_0x21a3('0x15')],_0x571506[_0x21a3('0x18')]);return _0x1d6b7e;};function parseOperator(_0x581563){var _0x42eef0;switch(_0x581563){case _0x21a3('0x27'):_0x42eef0=_0x21a3('0x28');break;case _0x21a3('0x24'):_0x42eef0=_0x21a3('0x29');break;case'$eq':_0x42eef0=_0x21a3('0x2a');break;case'$ne':_0x42eef0=_0x21a3('0x2b');break;case'$substring':case _0x21a3('0x2c'):case _0x21a3('0x2d'):_0x42eef0='LIKE\x20?';break;case'$lt':_0x42eef0=_0x21a3('0x2e');break;case _0x21a3('0x1a'):_0x42eef0=_0x21a3('0x2f');break;case _0x21a3('0x1b'):_0x42eef0=_0x21a3('0x30');break;case _0x21a3('0x31'):_0x42eef0=_0x21a3('0x32');break;case _0x21a3('0x17'):_0x42eef0=_0x21a3('0x33');break;}return _0x42eef0;}function parseValue(_0x25134f,_0xa510b3,_0x177e91){var _0x43867f={'start':undefined,'end':undefined};switch(_0xa510b3){case _0x21a3('0x27'):case _0x21a3('0x24'):_0x43867f[_0x21a3('0x34')]=_0x177e91[_0x21a3('0x9')](',');break;case _0x21a3('0x35'):_0x43867f['start']='%'+_0x177e91+'%';break;case _0x21a3('0x2c'):_0x43867f[_0x21a3('0x34')]=_0x177e91+'%';break;case'$endsWith':_0x43867f['start']='%'+_0x177e91;break;case'$between':var _0x3c7a89=_0x177e91[_0x21a3('0x9')](',');var _0x177e91=_0x3c7a89[_0x21a3('0xd')]();var _0x24d3b3=_0x3c7a89['pop']();if(_0x25134f==='DATE'){_0x177e91=moment(_0x177e91)['utcOffset'](0x0,!![])[_0x21a3('0x36')]();_0x24d3b3=moment(_0x24d3b3)[_0x21a3('0x37')](0x0,!![])[_0x21a3('0x1c')](0x17,_0x21a3('0x38'))[_0x21a3('0x1c')](0x3b,_0x21a3('0x39'))[_0x21a3('0x1c')](0x3b,_0x21a3('0x3a'))['format']();}_0x43867f={'start':_0x177e91,'end':_0x24d3b3};break;default:_0x43867f['start']=_0x177e91;break;}return _0x43867f;} \ No newline at end of file +var _0xc19f=['split','slice','shift','match','forEach','indexOf','map','conditions','push','buildExpression','DATE','$eq','$between','value','includes','operator','add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','$lte','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]'];(function(_0x308cdf,_0xfbdffe){var _0x1619fd=function(_0x25dc02){while(--_0x25dc02){_0x308cdf['push'](_0x308cdf['shift']());}};_0x1619fd(++_0xfbdffe);}(_0xc19f,0x110));var _0xfc19=function(_0x2d17ec,_0x54eb4d){_0x2d17ec=_0x2d17ec-0x0;var _0x162002=_0xc19f[_0x2d17ec];return _0x162002;};'use strict';var _=require(_0xfc19('0x0'));var moment=require(_0xfc19('0x1'));exports['parseSearch']=function(_0x199cf4){var _0x57997b={'conditions':[]};_0x57997b[_0xfc19('0x2')]=_[_0xfc19('0x3')](_0x199cf4,_0xfc19('0x4'))?'or':_0xfc19('0x5');var _0x219d82=_0x199cf4[_0xfc19('0x6')](_0xfc19('0x7'),'')['replace'](_0xfc19('0x4'),'')[_0xfc19('0x8')]('||');for(var _0x4e50e9=0x0;_0x4e50e9<_0x219d82['length'];_0x4e50e9++){var _0x54453b=_0x219d82[_0x4e50e9][_0xfc19('0x8')](':=');var _0x2fc6c8=_0x54453b[0x0];var _0x1b232d=_0x54453b[_0xfc19('0x9')](0x1);_0x1b232d['forEach'](function(_0x450f6f){var _0x31b943=_0x450f6f[_0xfc19('0x8')]('[')[_0xfc19('0xa')]();var _0x45caeb=_0x450f6f[_0xfc19('0xb')](/\[(.*?)\]/g);_0x45caeb[_0xfc19('0xc')](function(_0x5666c3){var _0x3a7f12=_0x5666c3[_0xfc19('0x8')]('[')['filter'](function(_0x8853c5){return _0x8853c5[_0xfc19('0xd')](']')>-0x1;})[_0xfc19('0xe')](function(_0x1d3ec2){return _0x1d3ec2[_0xfc19('0x8')](']')[0x0];})[0x0];_0x57997b[_0xfc19('0xf')][_0xfc19('0x10')]({'field':_0x2fc6c8,'operator':_0x31b943,'value':_0x3a7f12});});});}return _0x57997b;};exports[_0xfc19('0x11')]=function(_0x7c5354,_0x13a9a2,_0x1ebdd4){var _0x78a6c6={};if(_0x13a9a2===_0xfc19('0x12')){if(_0x1ebdd4['operator']===_0xfc19('0x13')){_0x1ebdd4['operator']=_0xfc19('0x14');_0x1ebdd4[_0xfc19('0x15')]+=','+_0x1ebdd4[_0xfc19('0x15')];}else if(_[_0xfc19('0x16')](['$gt','$lte'],_0x1ebdd4[_0xfc19('0x17')])){_0x1ebdd4['value']=moment(_0x1ebdd4[_0xfc19('0x15')])[_0xfc19('0x18')](0x1,'days')[_0xfc19('0x19')](_0xfc19('0x1a'));}}if(_0x1ebdd4[_0xfc19('0x1b')]){_0x13a9a2=_0x1ebdd4[_0xfc19('0x1b')];_0x78a6c6[_0xfc19('0x1c')]=_0xfc19('0x1d')+_0x7c5354+'.'+_0x1ebdd4[_0xfc19('0x1e')]+_0xfc19('0x1f')+_0x1ebdd4[_0xfc19('0x1b')]+')\x20'+parseOperator(_0x1ebdd4[_0xfc19('0x17')]);}else{_0x78a6c6[_0xfc19('0x1c')]=_0x7c5354+'.'+_0x1ebdd4[_0xfc19('0x1e')]+'\x20'+parseOperator(_0x1ebdd4[_0xfc19('0x17')]);}if(_[_0xfc19('0x16')]([_0xfc19('0x20'),_0xfc19('0x21')],_0x1ebdd4[_0xfc19('0x17')]))_0x78a6c6[_0xfc19('0x1c')]='('+_0x78a6c6[_0xfc19('0x1c')]+_0xfc19('0x22')+_0x7c5354+'.'+_0x1ebdd4[_0xfc19('0x1e')]+_0xfc19('0x23');_0x78a6c6['value']=parseValue(_0x13a9a2,_0x1ebdd4[_0xfc19('0x17')],_0x1ebdd4[_0xfc19('0x15')]);return _0x78a6c6;};function parseOperator(_0x2b3a54){var _0x66e0ac;switch(_0x2b3a54){case _0xfc19('0x24'):_0x66e0ac=_0xfc19('0x25');break;case _0xfc19('0x21'):_0x66e0ac='NOT\x20IN\x20?';break;case'$eq':_0x66e0ac=_0xfc19('0x26');break;case'$ne':_0x66e0ac=_0xfc19('0x27');break;case _0xfc19('0x28'):case _0xfc19('0x29'):case _0xfc19('0x2a'):_0x66e0ac=_0xfc19('0x2b');break;case _0xfc19('0x2c'):_0x66e0ac=_0xfc19('0x2d');break;case _0xfc19('0x2e'):_0x66e0ac=_0xfc19('0x2f');break;case _0xfc19('0x30'):_0x66e0ac='<=\x20?';break;case _0xfc19('0x31'):_0x66e0ac=_0xfc19('0x32');break;case _0xfc19('0x14'):_0x66e0ac=_0xfc19('0x33');break;}return _0x66e0ac;}function parseValue(_0x47adb3,_0x446ebe,_0x42aaa8){var _0x362e0e={'start':undefined,'end':undefined};switch(_0x446ebe){case'$in':case _0xfc19('0x21'):_0x362e0e['start']=_0x42aaa8[_0xfc19('0x8')](',');break;case'$substring':_0x362e0e[_0xfc19('0x34')]='%'+_0x42aaa8+'%';break;case _0xfc19('0x29'):_0x362e0e[_0xfc19('0x34')]=_0x42aaa8+'%';break;case'$endsWith':_0x362e0e['start']='%'+_0x42aaa8;break;case _0xfc19('0x14'):var _0x104a5f=_0x42aaa8[_0xfc19('0x8')](',');var _0x42aaa8=_0x104a5f[_0xfc19('0xa')]();var _0x390d1d=_0x104a5f[_0xfc19('0x35')]();if(_0x47adb3===_0xfc19('0x12')){_0x42aaa8=moment(_0x42aaa8)[_0xfc19('0x36')](0x0,!![])[_0xfc19('0x19')]();_0x390d1d=moment(_0x390d1d)[_0xfc19('0x36')](0x0,!![])[_0xfc19('0x18')](0x17,_0xfc19('0x37'))[_0xfc19('0x18')](0x3b,'minutes')['add'](0x3b,'seconds')['format']();}_0x362e0e={'start':_0x42aaa8,'end':_0x390d1d};break;default:_0x362e0e['start']=_0x42aaa8;break;}return _0x362e0e;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 99256bf..63cd69f 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 _0x4415=['format','utc','$lte','YYYY-MM-DD','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','substr','DESC','unsigned','ASC','omit','isEmpty','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','trim','forEach','push','join','getOptions','query','$id','filters','intersection','attributes','nolimit','order','pick','filter','object','columns','where','lower','merge','options','include','lodash','parse','keys','includes','model','fields','raw','split','forOwn','type','isPlainObject','$gte'];(function(_0x3dc8ed,_0x1e88e6){var _0x36c02a=function(_0x14b964){while(--_0x14b964){_0x3dc8ed['push'](_0x3dc8ed['shift']());}};_0x36c02a(++_0x1e88e6);}(_0x4415,0x13e));var _0x5441=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x4415[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x5441('0x0'));var sequelize=require('sequelize');var moment=require('moment');var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1bb600){var _0x13c64c=['ne'];try{var _0xd88819=JSON[_0x5441('0x1')](_0x1bb600);var _0x2d2065=Object[_0x5441('0x2')](_0xd88819)[0x0];return _0x13c64c[_0x5441('0x3')](_0x2d2065);}catch(_0xec1fe9){return![];}}function getOperatorValue(_0x192f31){var _0x8bc4c6=JSON[_0x5441('0x1')](_0x192f31);var _0x2622bd=Object[_0x5441('0x2')](_0x8bc4c6)[0x0];var _0x4ae388=_0x8bc4c6[_0x2622bd];return{['$'+_0x2622bd]:_0x4ae388};}function parseIncludeModel(_0x3d26f0){var _0x4d9343=JSON['parse'](_0x3d26f0);return{'model':db[_0x4d9343[_0x5441('0x4')]],'as':_0x4d9343['alias'],'attributes':_0x4d9343[_0x5441('0x5')],'raw':_0x4d9343[_0x5441('0x6')]};}exports['fields']=function(_0x141dcc){var _0x4c2e90=null;if(_0x141dcc){_0x4c2e90=_0x141dcc[_0x5441('0x7')](',');}return _0x4c2e90;};exports['filters']=function(_0xeba2de,_0x409e62){var _0x405d71={};if(!_['isEmpty'](_0xeba2de)){_[_0x5441('0x8')](_0xeba2de,function(_0x38e9ae,_0x41cb1b){try{if(_0x409e62){var _0x216511=_['find'](_0x409e62,{'name':_0x41cb1b})||{};if(hasSequelizeOperator(_0x38e9ae)){_0x405d71[_0x41cb1b]=getOperatorValue(_0x38e9ae);}else if(_0x216511[_0x5441('0x9')]==='DATE'&&_[_0x5441('0xa')](_0x38e9ae)){var _0x447422=JSON[_0x5441('0x1')](_0x38e9ae);var _0x136d52={'$gte':moment(moment(_0x447422[_0x5441('0xb')])[_0x5441('0xc')]('YYYY-MM-DD'))[_0x5441('0xd')]()[_0x5441('0xc')](),'$lte':moment(moment(_0x447422[_0x5441('0xe')])[_0x5441('0xc')](_0x5441('0xf')))[_0x5441('0xd')]()['subtract'](0x1,'s')[_0x5441('0xc')]()};_0x405d71[_0x41cb1b]=_0x136d52;}else if(_0x216511[_0x5441('0x10')]===_0x5441('0x11')){_0x405d71[_0x41cb1b]=_0x38e9ae;}else{_0x405d71[_0x41cb1b]=_['isArray'](_0x38e9ae)?_0x38e9ae:JSON[_0x5441('0x1')](_0x38e9ae);}}else{_0x405d71[_0x41cb1b]=_[_0x5441('0x12')](_0x38e9ae)?_0x38e9ae:JSON['parse'](_0x38e9ae);}}catch(_0x4eabe7){_0x405d71[_0x41cb1b]=_0x38e9ae[_0x5441('0x7')](',');}});}return _0x405d71;};exports[_0x5441('0x13')]=function(_0x3ec8c6){_0x3ec8c6=parseInt(_0x3ec8c6,0xa);if(!_0x3ec8c6||_0x3ec8c6<0x0){_0x3ec8c6=LIMIT_VALUE;}return _0x3ec8c6;};exports[_0x5441('0x14')]=function(_0xf51629){_0xf51629=parseInt(_0xf51629,0xa);if(!_0xf51629||_0xf51629<0x0){_0xf51629=0x0;}return _0xf51629;};exports[_0x5441('0x15')]=function(_0x2d20e4){var _0x5dcb1e,_0x52aa3f=null;if(_0x2d20e4){_0x5dcb1e=_0x2d20e4['split'](',');_0x52aa3f=_[_0x5441('0x16')](_0x5dcb1e,function(_0x578e5d){if(_0x578e5d[_0x5441('0x17')]('-')===0x0){return[_0x578e5d===_0x5441('0x18')?sequelize[_0x5441('0x19')](sequelize[_0x5441('0x1a')](_0x5441('0x18')),'unsigned'):_0x578e5d[_0x5441('0x1b')](0x1),_0x5441('0x1c')];}else{return[_0x578e5d==='priority'?sequelize[_0x5441('0x19')](sequelize[_0x5441('0x1a')]('priority'),_0x5441('0x1d')):_0x578e5d,_0x5441('0x1e')];}});}return _0x52aa3f;};exports[_0x5441('0x1f')]=function(_0x3c542e,_0x23e7db){if(_[_0x5441('0x20')](_0x3c542e)){return _0x3c542e;}if(_[_0x5441('0x12')](_0x3c542e)){for(var _0x19393c=0x0;_0x19393c<_0x3c542e[_0x5441('0x21')];_0x19393c+=0x1){_0x3c542e[_0x19393c]=this[_0x5441('0x1f')](_0x3c542e[_0x19393c],_0x23e7db);}return _0x3c542e;}if(!_[_0x5441('0x22')](_0x3c542e)){return _0x3c542e;}if(_[_0x5441('0x23')](_0x23e7db)){_0x23e7db=[_0x23e7db];}if(!_['isArray'](_0x23e7db)){return _0x3c542e;}for(var _0x40d285=0x0;_0x40d285<_0x23e7db[_0x5441('0x21')];_0x40d285+=0x1){_['unset'](_0x3c542e,_0x23e7db[_0x40d285]);}for(var _0x17a24a in _0x3c542e){if(_0x3c542e[_0x5441('0x24')](_0x17a24a)){_0x3c542e[_0x17a24a]=this[_0x5441('0x1f')](_0x3c542e[_0x17a24a],_0x23e7db);}}return _0x3c542e;};exports[_0x5441('0x25')]=function(_0x3aab3a){return _0x3aab3a[_0x5441('0x26')](RegExp(_0x5441('0x27')))?!![]:![];};exports[_0x5441('0x28')]=function(_0xdda69c){return _0xdda69c[_0x5441('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x5441('0x29')]=function(_0x3fa852,_0x360af1){var _0xf0d636=[];var _0x11771d=/([^:]")"+/g;var _0x2874ea=/[*<>~@-]/g;var _0x13bdb4=/[ `!@#$%^&*()_\-?~<>]/;var _0x6eefde=/[ ,]+/;var _0x130548=_0x360af1?_0x5441('0x2a'):_0x5441('0x2b');if(_0x360af1){_0x3fa852=_0x3fa852[_0x5441('0x2c')](_0x2874ea,'\x20')[_0x5441('0x2d')]();}_0x3fa852[_0x5441('0x7')](_0x6eefde)[_0x5441('0x2e')](function(_0x4f2674){_0x4f2674=_0x4f2674[_0x5441('0x2c')](_0x11771d,'$1');_0x4f2674='+'+_0x4f2674+'*';var _0x4e13c3=_0x4f2674[_0x5441('0x26')](_0x13bdb4);if(_0x4e13c3){_0x4f2674='\x22'+_0x4f2674+'\x22';}_0xf0d636[_0x5441('0x2f')](_0x4f2674);});_0x130548=_0x130548[_0x5441('0x2c')](_0x5441('0x2b'),_0xf0d636[_0x5441('0x30')]('\x20'));return _0x130548;};exports[_0x5441('0x31')]=function(_0x27876c,_0x148d44,_0x183e72){var _0x470b1c={},_0x97c359={};if(_0x148d44[_0x5441('0x32')][_0x5441('0x33')]){_0x148d44[_0x5441('0x32')]['id']=_0x148d44['query']['$id'];delete _0x148d44[_0x5441('0x32')]['$id'];}_0x470b1c['model']=_['map'](_0x27876c,_0x5441('0x10'));_0x470b1c['query']=_[_0x5441('0x2')](_0x148d44[_0x5441('0x32')]);_0x470b1c[_0x5441('0x34')]=_[_0x5441('0x35')](_0x470b1c[_0x5441('0x4')],_0x470b1c[_0x5441('0x32')]);_0x97c359[_0x5441('0x36')]=_[_0x5441('0x35')](_0x470b1c[_0x5441('0x4')],this[_0x5441('0x5')](_0x148d44[_0x5441('0x32')][_0x5441('0x5')]));_0x97c359['attributes']=_0x97c359[_0x5441('0x36')][_0x5441('0x21')]?_0x97c359[_0x5441('0x36')]:_0x470b1c[_0x5441('0x4')];if(!_0x148d44[_0x5441('0x32')][_0x5441('0x24')](_0x5441('0x37'))){_0x97c359[_0x5441('0x13')]=this[_0x5441('0x13')](_0x148d44[_0x5441('0x32')]['limit']);_0x97c359['offset']=this[_0x5441('0x14')](_0x148d44['query'][_0x5441('0x14')]);}_0x97c359[_0x5441('0x38')]=this[_0x5441('0x15')](_0x148d44[_0x5441('0x32')][_0x5441('0x15')]);_0x97c359['where']=this[_0x5441('0x34')](_[_0x5441('0x39')](_0x148d44[_0x5441('0x32')],_0x470b1c['filters']),_0x27876c);if(_0x148d44[_0x5441('0x32')][_0x5441('0x3a')]){var _0x1379f2=_0x27876c;var _0x37b550=_0x148d44[_0x5441('0x32')]['filter'];if(typeof _0x37b550===_0x5441('0x3b')){_0x1379f2=_[_0x5441('0x3a')](_0x27876c,function(_0x51ff70){return _[_0x5441('0x3')](_0x37b550[_0x5441('0x3c')],_0x51ff70[_0x5441('0x10')]);});_0x37b550=_0x37b550['value'];}_0x97c359[_0x5441('0x3d')]=_['merge'](_0x97c359['where'],{'$or':_[_0x5441('0x16')](_0x1379f2,function(_0x43ba5d){if(_0x43ba5d[_0x5441('0x9')]!=='VIRTUAL'){if(_0x183e72){return sequelize[_0x5441('0x3d')](sequelize['fn'](_0x5441('0x3e'),sequelize[_0x5441('0x1a')](_0x43ba5d['name'])),{'$like':sequelize['fn'](_0x5441('0x3e'),'%'+_0x148d44[_0x5441('0x32')][_0x5441('0x3a')]+'%')});}else{var _0x3aa27e={};_0x3aa27e[_0x43ba5d['name']]={'$like':'%'+_0x148d44[_0x5441('0x32')][_0x5441('0x3a')]+'%'};return _0x3aa27e;}}})});}_0x97c359=_[_0x5441('0x3f')]({},_0x97c359,_0x148d44[_0x5441('0x40')]);return _0x97c359;};exports[_0x5441('0x41')]=function(_0x4927d8){var _0x59998e=[];if(_0x4927d8['includeAll']){_0x59998e['push']({'all':!![]});}else if(_0x4927d8[_0x5441('0x41')]){if(Array['isArray'](_0x4927d8[_0x5441('0x41')])){_0x59998e=Object[_0x5441('0x2')](_0x4927d8[_0x5441('0x41')])[_0x5441('0x16')](function(_0x258df3){return parseIncludeModel(_0x4927d8[_0x5441('0x41')][_0x258df3]);});}else{var _0x23be51=parseIncludeModel(_0x4927d8['include']);_0x59998e[_0x5441('0x2f')](_0x23be51);}}return _0x59998e;};exports['escapeLIKESpecialChars']=function(_0x36d870){return _0x36d870[_0x5441('0x2c')](/[%_^-]/g,function(_0x51b5d4){return'\x5c'+_0x51b5d4;});}; \ No newline at end of file +var _0xe431=['forOwn','find','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','cast','col','priority','DESC','unsigned','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','replace','trim','forEach','{EXPR}','query','$id','intersection','attributes','nolimit','order','pick','filter','object','columns','value','where','merge','lower','options','include','push','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','model','alias','fields','split','filters','isEmpty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe431,0x147));var _0x1e43=function(_0x2fa0d4,_0x3b971e){_0x2fa0d4=_0x2fa0d4-0x0;var _0x512f3d=_0xe431[_0x2fa0d4];return _0x512f3d;};'use strict';var _=require(_0x1e43('0x0'));var sequelize=require(_0x1e43('0x1'));var moment=require(_0x1e43('0x2'));var db=require(_0x1e43('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x14b374){var _0x309216=['ne'];try{var _0x2bfdd0=JSON[_0x1e43('0x4')](_0x14b374);var _0x1640f2=Object[_0x1e43('0x5')](_0x2bfdd0)[0x0];return _0x309216[_0x1e43('0x6')](_0x1640f2);}catch(_0x5dc4fa){return![];}}function getOperatorValue(_0x3b71be){var _0x4564d5=JSON[_0x1e43('0x4')](_0x3b71be);var _0x8608f5=Object[_0x1e43('0x5')](_0x4564d5)[0x0];var _0x2f5d69=_0x4564d5[_0x8608f5];return{['$'+_0x8608f5]:_0x2f5d69};}function parseIncludeModel(_0x2f8aab){var _0x4c0156=JSON['parse'](_0x2f8aab);return{'model':db[_0x4c0156[_0x1e43('0x7')]],'as':_0x4c0156[_0x1e43('0x8')],'attributes':_0x4c0156[_0x1e43('0x9')],'raw':_0x4c0156['raw']};}exports[_0x1e43('0x9')]=function(_0x394280){var _0x3002c1=null;if(_0x394280){_0x3002c1=_0x394280[_0x1e43('0xa')](',');}return _0x3002c1;};exports[_0x1e43('0xb')]=function(_0xa6d403,_0x7dd702){var _0xd11836={};if(!_[_0x1e43('0xc')](_0xa6d403)){_[_0x1e43('0xd')](_0xa6d403,function(_0x5cea1c,_0x57e34f){try{if(_0x7dd702){var _0x45b538=_[_0x1e43('0xe')](_0x7dd702,{'name':_0x57e34f})||{};if(hasSequelizeOperator(_0x5cea1c)){_0xd11836[_0x57e34f]=getOperatorValue(_0x5cea1c);}else if(_0x45b538['type']==='DATE'&&_[_0x1e43('0xf')](_0x5cea1c)){var _0x1a4746=JSON['parse'](_0x5cea1c);var _0xdefb96={'$gte':moment(moment(_0x1a4746[_0x1e43('0x10')])[_0x1e43('0x11')](_0x1e43('0x12')))['utc']()[_0x1e43('0x11')](),'$lte':moment(moment(_0x1a4746['$lte'])['format']('YYYY-MM-DD'))[_0x1e43('0x13')]()[_0x1e43('0x14')](0x1,'s')[_0x1e43('0x11')]()};_0xd11836[_0x57e34f]=_0xdefb96;}else if(_0x45b538[_0x1e43('0x15')]===_0x1e43('0x16')){_0xd11836[_0x57e34f]=_0x5cea1c;}else{_0xd11836[_0x57e34f]=_[_0x1e43('0x17')](_0x5cea1c)?_0x5cea1c:JSON['parse'](_0x5cea1c);}}else{_0xd11836[_0x57e34f]=_[_0x1e43('0x17')](_0x5cea1c)?_0x5cea1c:JSON['parse'](_0x5cea1c);}}catch(_0xfd5ece){_0xd11836[_0x57e34f]=_0x5cea1c[_0x1e43('0xa')](',');}});}return _0xd11836;};exports[_0x1e43('0x18')]=function(_0x338766){_0x338766=parseInt(_0x338766,0xa);if(!_0x338766||_0x338766<0x0){_0x338766=LIMIT_VALUE;}return _0x338766;};exports[_0x1e43('0x19')]=function(_0x5b6f57){_0x5b6f57=parseInt(_0x5b6f57,0xa);if(!_0x5b6f57||_0x5b6f57<0x0){_0x5b6f57=0x0;}return _0x5b6f57;};exports[_0x1e43('0x1a')]=function(_0x13a6b2){var _0x2fdc82,_0x3a7908=null;if(_0x13a6b2){_0x2fdc82=_0x13a6b2[_0x1e43('0xa')](',');_0x3a7908=_[_0x1e43('0x1b')](_0x2fdc82,function(_0x571188){if(_0x571188[_0x1e43('0x1c')]('-')===0x0){return[_0x571188==='priority'?sequelize[_0x1e43('0x1d')](sequelize[_0x1e43('0x1e')](_0x1e43('0x1f')),'unsigned'):_0x571188['substr'](0x1),_0x1e43('0x20')];}else{return[_0x571188===_0x1e43('0x1f')?sequelize[_0x1e43('0x1d')](sequelize[_0x1e43('0x1e')]('priority'),_0x1e43('0x21')):_0x571188,_0x1e43('0x22')];}});}return _0x3a7908;};exports[_0x1e43('0x23')]=function(_0x51531f,_0xa5d944){if(_[_0x1e43('0xc')](_0x51531f)){return _0x51531f;}if(_[_0x1e43('0x17')](_0x51531f)){for(var _0xf63005=0x0;_0xf63005<_0x51531f[_0x1e43('0x24')];_0xf63005+=0x1){_0x51531f[_0xf63005]=this[_0x1e43('0x23')](_0x51531f[_0xf63005],_0xa5d944);}return _0x51531f;}if(!_[_0x1e43('0x25')](_0x51531f)){return _0x51531f;}if(_[_0x1e43('0x26')](_0xa5d944)){_0xa5d944=[_0xa5d944];}if(!_[_0x1e43('0x17')](_0xa5d944)){return _0x51531f;}for(var _0x519e22=0x0;_0x519e22<_0xa5d944[_0x1e43('0x24')];_0x519e22+=0x1){_[_0x1e43('0x27')](_0x51531f,_0xa5d944[_0x519e22]);}for(var _0x2a9d6a in _0x51531f){if(_0x51531f[_0x1e43('0x28')](_0x2a9d6a)){_0x51531f[_0x2a9d6a]=this[_0x1e43('0x23')](_0x51531f[_0x2a9d6a],_0xa5d944);}}return _0x51531f;};exports[_0x1e43('0x29')]=function(_0x1d33fb){return _0x1d33fb[_0x1e43('0x2a')](RegExp(_0x1e43('0x2b')))?!![]:![];};exports[_0x1e43('0x2c')]=function(_0x437f14){return _0x437f14[_0x1e43('0x2a')](/^\S+@\S+$/)?!![]:![];};exports[_0x1e43('0x2d')]=function(_0x355b90,_0x3219d8){var _0x5772de=[];var _0x1c0d87=/([^:]")"+/g;var _0x26ec9c=/[*<>~@-]/g;var _0x118a5e=/[ `!@#$%^&*()_\-?~<>]/;var _0x4904ea=/[ ,]+/;var _0x1c3e87=_0x3219d8?_0x1e43('0x2e'):'{EXPR}';if(_0x3219d8){_0x355b90=_0x355b90[_0x1e43('0x2f')](_0x26ec9c,'\x20')[_0x1e43('0x30')]();}_0x355b90['split'](_0x4904ea)[_0x1e43('0x31')](function(_0x381c0a){_0x381c0a=_0x381c0a[_0x1e43('0x2f')](_0x1c0d87,'$1');_0x381c0a='+'+_0x381c0a+'*';var _0x120a48=_0x381c0a[_0x1e43('0x2a')](_0x118a5e);if(_0x120a48){_0x381c0a='\x22'+_0x381c0a+'\x22';}_0x5772de['push'](_0x381c0a);});_0x1c3e87=_0x1c3e87[_0x1e43('0x2f')](_0x1e43('0x32'),_0x5772de['join']('\x20'));return _0x1c3e87;};exports['getOptions']=function(_0x3a0386,_0x31ebfe,_0x152073){var _0x47fb1c={},_0x195800={};if(_0x31ebfe[_0x1e43('0x33')][_0x1e43('0x34')]){_0x31ebfe[_0x1e43('0x33')]['id']=_0x31ebfe[_0x1e43('0x33')][_0x1e43('0x34')];delete _0x31ebfe['query'][_0x1e43('0x34')];}_0x47fb1c['model']=_['map'](_0x3a0386,_0x1e43('0x15'));_0x47fb1c[_0x1e43('0x33')]=_['keys'](_0x31ebfe['query']);_0x47fb1c['filters']=_[_0x1e43('0x35')](_0x47fb1c[_0x1e43('0x7')],_0x47fb1c[_0x1e43('0x33')]);_0x195800[_0x1e43('0x36')]=_[_0x1e43('0x35')](_0x47fb1c[_0x1e43('0x7')],this[_0x1e43('0x9')](_0x31ebfe[_0x1e43('0x33')][_0x1e43('0x9')]));_0x195800['attributes']=_0x195800['attributes'][_0x1e43('0x24')]?_0x195800[_0x1e43('0x36')]:_0x47fb1c[_0x1e43('0x7')];if(!_0x31ebfe[_0x1e43('0x33')]['hasOwnProperty'](_0x1e43('0x37'))){_0x195800[_0x1e43('0x18')]=this['limit'](_0x31ebfe[_0x1e43('0x33')]['limit']);_0x195800[_0x1e43('0x19')]=this['offset'](_0x31ebfe[_0x1e43('0x33')][_0x1e43('0x19')]);}_0x195800[_0x1e43('0x38')]=this['sort'](_0x31ebfe[_0x1e43('0x33')]['sort']);_0x195800['where']=this[_0x1e43('0xb')](_[_0x1e43('0x39')](_0x31ebfe[_0x1e43('0x33')],_0x47fb1c[_0x1e43('0xb')]),_0x3a0386);if(_0x31ebfe[_0x1e43('0x33')][_0x1e43('0x3a')]){var _0x4f38f2=_0x3a0386;var _0x186cf9=_0x31ebfe[_0x1e43('0x33')]['filter'];if(typeof _0x186cf9===_0x1e43('0x3b')){_0x4f38f2=_['filter'](_0x3a0386,function(_0x2eb0d8){return _[_0x1e43('0x6')](_0x186cf9[_0x1e43('0x3c')],_0x2eb0d8[_0x1e43('0x15')]);});_0x186cf9=_0x186cf9[_0x1e43('0x3d')];}_0x195800[_0x1e43('0x3e')]=_[_0x1e43('0x3f')](_0x195800['where'],{'$or':_[_0x1e43('0x1b')](_0x4f38f2,function(_0x234d60){if(_0x234d60['type']!=='VIRTUAL'){if(_0x152073){return sequelize[_0x1e43('0x3e')](sequelize['fn'](_0x1e43('0x40'),sequelize[_0x1e43('0x1e')](_0x234d60[_0x1e43('0x15')])),{'$like':sequelize['fn'](_0x1e43('0x40'),'%'+_0x31ebfe[_0x1e43('0x33')][_0x1e43('0x3a')]+'%')});}else{var _0x4e8b0c={};_0x4e8b0c[_0x234d60[_0x1e43('0x15')]]={'$like':'%'+_0x31ebfe['query'][_0x1e43('0x3a')]+'%'};return _0x4e8b0c;}}})});}_0x195800=_['merge']({},_0x195800,_0x31ebfe[_0x1e43('0x41')]);return _0x195800;};exports[_0x1e43('0x42')]=function(_0xca502e){var _0x1a08d9=[];if(_0xca502e['includeAll']){_0x1a08d9[_0x1e43('0x43')]({'all':!![]});}else if(_0xca502e[_0x1e43('0x42')]){if(Array[_0x1e43('0x17')](_0xca502e[_0x1e43('0x42')])){_0x1a08d9=Object['keys'](_0xca502e['include'])[_0x1e43('0x1b')](function(_0x4d066b){return parseIncludeModel(_0xca502e[_0x1e43('0x42')][_0x4d066b]);});}else{var _0x279c31=parseIncludeModel(_0xca502e[_0x1e43('0x42')]);_0x1a08d9[_0x1e43('0x43')](_0x279c31);}}return _0x1a08d9;};exports['escapeLIKESpecialChars']=function(_0x175abe){return _0x175abe[_0x1e43('0x2f')](/[%_^-]/g,function(_0x161af2){return'\x5c'+_0x161af2;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 6623b4a..d2d76e6 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 _0xa880=['catch','*pause','busy','getAgentStatus','isArray','Queue','findOne','getAgents','getAgentIdsByQueues','length','map','getAgentIdsByStatus','includes','User','findAll','name','fullname','faxPause','whatsappPause','pauseType','find','globalStatus','split','fields','order','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','indexOf','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','pick','filterAgentAttributes','role','lastLoginAt','whatsappStatus','faxCurrentCapacity','whatsappCurrentCapacity','destconnectedlinenum','onhold','screenrecording','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','mailPause','openchannelPause','smsPause','voicePause','every','filter','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','request','Agents','then','error','result','merge'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xa880,0x106));var _0x0a88=function(_0x2b12b0,_0x4480ce){_0x2b12b0=_0x2b12b0-0x0;var _0x221d21=_0xa880[_0x2b12b0];return _0x221d21;};'use strict';var _=require(_0x0a88('0x0'));var jayson=require(_0x0a88('0x1'));var db=require(_0x0a88('0x2'))['db'];var amiClient=jayson[_0x0a88('0x3')][_0x0a88('0x4')]({'port':0x232a});var routingClient=jayson[_0x0a88('0x3')][_0x0a88('0x4')]({'port':0x232c});function isAgentPaused(_0x321ae4,_0x552e9d){var _0x4091c4=[_0x321ae4[_0x0a88('0x5')],_0x321ae4['faxPause'],_0x321ae4[_0x0a88('0x6')],_0x321ae4[_0x0a88('0x7')],_0x321ae4[_0x0a88('0x8')],_0x321ae4[_0x0a88('0x9')],_0x321ae4['whatsappPause']];if(!_0x552e9d)return _[_0x0a88('0xa')](_0x4091c4);var _0x62b055=_[_0x0a88('0xb')](_0x4091c4);return _0x62b055['length']>0x0&&_0x62b055['length']<_0x4091c4['length']?!![]:![];}function isIdle(_0x317042){return _0x317042===_0x0a88('0xc')||_0x317042===_0x0a88('0xd')||_0x317042===_0x0a88('0xe')||_0x317042===_0x0a88('0xf')||_[_0x0a88('0x10')](_0x317042);}function isAgentIdle(_0x3a53be){if(_0x3a53be[_0x0a88('0x11')]!==_0x0a88('0xc')&&_0x3a53be[_0x0a88('0x9')]){_0x3a53be['voiceStatus']=_0x0a88('0x12');return![];}return _[_0x0a88('0xa')]([_0x3a53be[_0x0a88('0x13')],_0x3a53be[_0x0a88('0x14')],_0x3a53be['mailStatus'],_0x3a53be[_0x0a88('0x15')],_0x3a53be[_0x0a88('0x16')],_0x3a53be[_0x0a88('0x11')],_0x3a53be['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x0a88('0x17')](_0x0a88('0x18'),{})[_0x0a88('0x19')](function(_0x371834){if(_0x371834[_0x0a88('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x42e3e8=_0x371834[_0x0a88('0x1b')];return routingClient[_0x0a88('0x17')]('Agents',{})[_0x0a88('0x19')](function(_0x3da111){if(_0x3da111[_0x0a88('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0xce5d6e=_0x3da111[_0x0a88('0x1b')];return _[_0x0a88('0x1c')]({},_0x42e3e8,_0xce5d6e);});})[_0x0a88('0x1d')](function(_0x239ec7){throw _0x239ec7;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x32593e){var _0x238af8=_0x0a88('0xd');if(isAgentPaused(_0x32593e))_0x238af8=_0x0a88('0x12');else if(isAgentPaused(_0x32593e,!![]))_0x238af8=_0x0a88('0x1e');else if(isAgentIdle(_0x32593e))_0x238af8=_0x0a88('0xc');else _0x238af8=_0x0a88('0x1f');return _0x238af8;}exports[_0x0a88('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x412bde,_0x3f7ec0){var _0xf9fe78=_[_0x0a88('0x21')](_0x412bde)?_0x412bde:[_0x412bde];var _0xe59c31=_['startCase'](_0x3f7ec0)+_0x0a88('0x22');var _0x3a296f=_['map'](_0xf9fe78,function(_0x423e28){return db[_0xe59c31][_0x0a88('0x23')]({'where':{'id':_0x423e28}})[_0x0a88('0x19')](function(_0x43c848){if(!_0x43c848)return[];return _0x43c848[_0x0a88('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x3a296f)['then'](function(_0x177b73){var _0x4f5add=_(_0x177b73)['flatten']()['map']('id')['uniq']()['value']();return _0x4f5add;});}exports[_0x0a88('0x25')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x330ed7,_0x5cee64,_0x21e4d4){try{if(_0x5cee64[_0x0a88('0x26')]>0x0){_0x330ed7=_0x330ed7['filter'](function(_0xf29ba5){return _0x5cee64['includes'](_0xf29ba5['id']);});}var _0x4d8044=_0x330ed7[_0x0a88('0xb')](function(_0x5656b0){var _0x342713='busy';if(isAgentIdle(_0x5656b0)){_0x342713='idle';}return _0x342713===_0x21e4d4;});return _[_0x0a88('0x27')](_0x4d8044,'id');}catch(_0x28a8f3){throw _0x28a8f3;}}exports[_0x0a88('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x6cdf8,_0x310844,_0x41f517){return Promise['resolve']()['then'](function(){if(_0x310844[_0x0a88('0x26')]>0x0){_0x6cdf8=_0x6cdf8[_0x0a88('0xb')](function(_0x44e449){return _0x310844[_0x0a88('0x29')](_0x44e449['id']);});}return _0x6cdf8;})[_0x0a88('0x19')](function(){return db[_0x0a88('0x2a')][_0x0a88('0x2b')]({'attributes':['id',_0x0a88('0x2c'),_0x0a88('0x2d'),_0x0a88('0x5'),_0x0a88('0x2e'),'mailPause',_0x0a88('0x7'),'smsPause',_0x0a88('0x9'),_0x0a88('0x2f'),_0x0a88('0x30')],'where':{'id':{'$in':_[_0x0a88('0x27')](_0x6cdf8,'id')}},'raw':!![]});})[_0x0a88('0x19')](function(_0x4653ef){return _0x4653ef[_0x0a88('0x27')](function(_0x9b3eb6){var _0x36a94f=_[_0x0a88('0x31')](_0x6cdf8,['id',_0x9b3eb6['id']]);var _0x57233a=filterAgentAttributes(_0x36a94f);_[_0x0a88('0x1c')](_0x9b3eb6,_0x57233a);_0x9b3eb6[_0x0a88('0x32')]=getAgentStatus(_0x9b3eb6);return _0x9b3eb6;});})[_0x0a88('0x19')](function(_0x440cc2){var _0x376514=sortAgentsByStatus(_0x440cc2,_0x41f517);return _['map'](_0x376514,'id');})[_0x0a88('0x1d')](function(_0x3b2ae4){throw _0x3b2ae4;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4223ff){var _0x581fb4={'fields':[],'order':null};var _0x1e01bf=_0x4223ff[_0x0a88('0x33')](',');_0x581fb4[_0x0a88('0x34')]=_[_0x0a88('0xb')](_0x1e01bf,function(_0x4454be){if(!_0x4454be[_0x0a88('0x29')](_0x0a88('0x32'))){return!![];}_0x581fb4[_0x0a88('0x35')]=_['startsWith'](_0x4454be,'-')?_0x0a88('0x36'):_0x0a88('0x37');return![];});return _0x581fb4;}exports[_0x0a88('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x5bdc7b){if(!_0x5bdc7b){_0x5bdc7b=_0x0a88('0x39');}if(_0x5bdc7b[_0x0a88('0x29')](_0x0a88('0x2d'))&&!_0x5bdc7b[_0x0a88('0x29')](_0x0a88('0x3a'))){var _0x228fa7=_0x5bdc7b['substring'](0x0,_0x5bdc7b[_0x0a88('0x3b')]('fullname'));_0x5bdc7b+=','+_0x228fa7+_0x0a88('0x3a');}return _0x5bdc7b;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x7f49e5,_0x2ae97d){var _0x35f3a1=_0x7f49e5[_0x0a88('0x3c')](function(_0x1c0f7c,_0x1dcba2){if(_0x1c0f7c[_0x0a88('0x32')]===_0x1dcba2[_0x0a88('0x32')]){if(_0x1c0f7c[_0x0a88('0x32')]===_0x0a88('0x12')){if(_0x2ae97d===_0x0a88('0x36')){return(_0x1c0f7c[_0x0a88('0x30')]||'')<(_0x1dcba2[_0x0a88('0x30')]||'')||_0x1c0f7c[_0x0a88('0x2d')][_0x0a88('0x3d')]()>_0x1dcba2['fullname'][_0x0a88('0x3d')]()?0x1:-0x1;}else{return(_0x1c0f7c[_0x0a88('0x30')]||'')<(_0x1dcba2['pauseType']||'')||_0x1c0f7c[_0x0a88('0x2d')][_0x0a88('0x3d')]()>_0x1dcba2['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x2ae97d==='DESC'){return _0x1c0f7c[_0x0a88('0x2d')][_0x0a88('0x3d')]()<_0x1dcba2[_0x0a88('0x2d')]['toLowerCase']()?0x1:-0x1;}else{return _0x1c0f7c[_0x0a88('0x2d')][_0x0a88('0x3d')]()<_0x1dcba2[_0x0a88('0x2d')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x2ae97d==='DESC'){return _0x1c0f7c[_0x0a88('0x32')]<_0x1dcba2[_0x0a88('0x32')]?0x1:-0x1;}else{return _0x1c0f7c[_0x0a88('0x32')]<_0x1dcba2[_0x0a88('0x32')]?-0x1:0x1;}}});return _0x35f3a1;}exports[_0x0a88('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x3ee008){var _0x1af4af=[_0x0a88('0x3f'),_0x0a88('0x40'),'lastLoginAt',_0x0a88('0x41'),_0x0a88('0x30'),_0x0a88('0x41'),_0x0a88('0x3a'),_0x0a88('0x42'),'chatPause','openchannelPause',_0x0a88('0x6'),_0x0a88('0x8'),_0x0a88('0x2f'),'faxPause',_0x0a88('0x9'),_0x0a88('0x43'),_0x0a88('0x44'),_0x0a88('0x45'),'smsCapacity',_0x0a88('0x46'),_0x0a88('0x47'),_0x0a88('0x48'),_0x0a88('0x49'),'mailCurrentCapacity',_0x0a88('0x4a'),'whatsappCurrentCapacity','faxCurrentCapacity','chatStatus',_0x0a88('0x15'),_0x0a88('0x4b'),_0x0a88('0x16'),'whatsappStatus','faxStatus',_0x0a88('0x11'),_0x0a88('0x4c'),_0x0a88('0x4d'),_0x0a88('0x4e'),_0x0a88('0x4f'),_0x0a88('0x50'),_0x0a88('0x51'),_0x0a88('0x52'),_0x0a88('0x53'),'destconnectedlinenum','screenrecording',_0x0a88('0x54'),_0x0a88('0x55')];var _0x5a3269=[_0x0a88('0x5'),_0x0a88('0x7'),'mailPause',_0x0a88('0x8'),_0x0a88('0x2f'),_0x0a88('0x2e'),_0x0a88('0x9'),_0x0a88('0x40')];var _0x2e90e5=_(_0x3ee008)['omit'](_0x5a3269)[_0x0a88('0x56')](_0x1af4af)['value']();return _0x2e90e5;}exports[_0x0a88('0x57')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x0a88('0x2c'),'fullname',_0x0a88('0x58'),'internal',_0x0a88('0x40'),_0x0a88('0x32'),_0x0a88('0x3f'),_0x0a88('0x59'),'pauseType','lastPauseAt',_0x0a88('0x2e'),_0x0a88('0x5'),_0x0a88('0x6'),_0x0a88('0x7'),'smsPause','voicePause',_0x0a88('0x2f'),'chatStatus',_0x0a88('0x14'),_0x0a88('0x4b'),_0x0a88('0x15'),'smsStatus',_0x0a88('0x11'),_0x0a88('0x5a'),_0x0a88('0x4c'),_0x0a88('0x51'),_0x0a88('0x4e'),_0x0a88('0x4d'),_0x0a88('0x4f'),_0x0a88('0x52'),_0x0a88('0x50'),_0x0a88('0x43'),_0x0a88('0x47'),_0x0a88('0x45'),'openchannelCapacity','smsCapacity',_0x0a88('0x46'),_0x0a88('0x48'),_0x0a88('0x5b'),'mailCurrentCapacity',_0x0a88('0x49'),_0x0a88('0x4a'),_0x0a88('0x5c'),'phoneBarEnableScreenRecordingByAgent',_0x0a88('0x55'),_0x0a88('0x5d'),_0x0a88('0x5e'),_0x0a88('0x53'),_0x0a88('0x5f')];}exports[_0x0a88('0x60')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xf9e5=['sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','openchannelPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','openchannelStatus','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','filterAgentAttributes','role','faxCurrentCapacity','whatsappCurrentCapacity','lodash','jayson/promise','../../mysqldb','client','http','faxPause','smsPause','voicePause','every','length','unknown','unavailable','ringing','isNil','idle','voiceStatus','pause','chatStatus','faxStatus','smsStatus','whatsappStatus','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','*pause','busy','getAgentStatus','startCase','map','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','findAll','name','fullname','chatPause','mailPause','whatsappPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','fields','startsWith','ASC','getUpdatedSortOptions','fullname,internal','internal','indexOf','validateSortParameter'];(function(_0x4b2037,_0x41055c){var _0x48599b=function(_0x251da3){while(--_0x251da3){_0x4b2037['push'](_0x4b2037['shift']());}};_0x48599b(++_0x41055c);}(_0xf9e5,0x89));var _0x5f9e=function(_0x1e8ced,_0x3bea5f){_0x1e8ced=_0x1e8ced-0x0;var _0x1b596a=_0xf9e5[_0x1e8ced];return _0x1b596a;};'use strict';var _=require(_0x5f9e('0x0'));var jayson=require(_0x5f9e('0x1'));var db=require(_0x5f9e('0x2'))['db'];var amiClient=jayson[_0x5f9e('0x3')][_0x5f9e('0x4')]({'port':0x232a});var routingClient=jayson[_0x5f9e('0x3')][_0x5f9e('0x4')]({'port':0x232c});function isAgentPaused(_0x4e7665,_0x15b4ed){var _0x25c34c=[_0x4e7665['chatPause'],_0x4e7665[_0x5f9e('0x5')],_0x4e7665['mailPause'],_0x4e7665['openchannelPause'],_0x4e7665[_0x5f9e('0x6')],_0x4e7665[_0x5f9e('0x7')],_0x4e7665['whatsappPause']];if(!_0x15b4ed)return _[_0x5f9e('0x8')](_0x25c34c);var _0x3cebf5=_['filter'](_0x25c34c);return _0x3cebf5['length']>0x0&&_0x3cebf5['length']<_0x25c34c[_0x5f9e('0x9')]?!![]:![];}function isIdle(_0x25ad8f){return _0x25ad8f==='idle'||_0x25ad8f===_0x5f9e('0xa')||_0x25ad8f===_0x5f9e('0xb')||_0x25ad8f===_0x5f9e('0xc')||_[_0x5f9e('0xd')](_0x25ad8f);}function isAgentIdle(_0x303828){if(_0x303828['voiceStatus']!==_0x5f9e('0xe')&&_0x303828[_0x5f9e('0x7')]){_0x303828[_0x5f9e('0xf')]=_0x5f9e('0x10');return![];}return _['every']([_0x303828[_0x5f9e('0x11')],_0x303828[_0x5f9e('0x12')],_0x303828['mailStatus'],_0x303828['openchannelStatus'],_0x303828[_0x5f9e('0x13')],_0x303828[_0x5f9e('0xf')],_0x303828[_0x5f9e('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x5f9e('0x15'),{})[_0x5f9e('0x16')](function(_0x395d9a){if(_0x395d9a[_0x5f9e('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x449b52=_0x395d9a[_0x5f9e('0x18')];return routingClient['request']('Agents',{})[_0x5f9e('0x16')](function(_0x5891a2){if(_0x5891a2['error']){throw new Error(_0x5f9e('0x19'));}var _0x816c4c=_0x5891a2['result'];return _[_0x5f9e('0x1a')]({},_0x449b52,_0x816c4c);});})['catch'](function(_0x26a26d){throw _0x26a26d;});}exports[_0x5f9e('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x53a2f2){var _0xc2786f=_0x5f9e('0xa');if(isAgentPaused(_0x53a2f2))_0xc2786f=_0x5f9e('0x10');else if(isAgentPaused(_0x53a2f2,!![]))_0xc2786f=_0x5f9e('0x1c');else if(isAgentIdle(_0x53a2f2))_0xc2786f=_0x5f9e('0xe');else _0xc2786f=_0x5f9e('0x1d');return _0xc2786f;}exports[_0x5f9e('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x496bf3,_0x3d0cca){var _0x2465ae=_['isArray'](_0x496bf3)?_0x496bf3:[_0x496bf3];var _0x54c375=_[_0x5f9e('0x1f')](_0x3d0cca)+'Queue';var _0x346732=_[_0x5f9e('0x20')](_0x2465ae,function(_0x4c91cf){return db[_0x54c375]['findOne']({'where':{'id':_0x4c91cf}})['then'](function(_0x4aebea){if(!_0x4aebea)return[];return _0x4aebea[_0x5f9e('0x21')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x5f9e('0x22')](_0x346732)['then'](function(_0x53557e){var _0x4102a5=_(_0x53557e)[_0x5f9e('0x23')]()[_0x5f9e('0x20')]('id')[_0x5f9e('0x24')]()[_0x5f9e('0x25')]();return _0x4102a5;});}exports[_0x5f9e('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0xfde2d4,_0x5e53bd,_0x2ec2b8){try{if(_0x5e53bd[_0x5f9e('0x9')]>0x0){_0xfde2d4=_0xfde2d4[_0x5f9e('0x27')](function(_0x10e8bf){return _0x5e53bd[_0x5f9e('0x28')](_0x10e8bf['id']);});}var _0x420525=_0xfde2d4['filter'](function(_0x4bde22){var _0x14a762='busy';if(isAgentIdle(_0x4bde22)){_0x14a762='idle';}return _0x14a762===_0x2ec2b8;});return _[_0x5f9e('0x20')](_0x420525,'id');}catch(_0x5a7594){throw _0x5a7594;}}exports[_0x5f9e('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1d51bf,_0x5d35a5,_0x1dd402){return Promise[_0x5f9e('0x2a')]()[_0x5f9e('0x16')](function(){if(_0x5d35a5['length']>0x0){_0x1d51bf=_0x1d51bf[_0x5f9e('0x27')](function(_0x51155c){return _0x5d35a5[_0x5f9e('0x28')](_0x51155c['id']);});}return _0x1d51bf;})[_0x5f9e('0x16')](function(){return db['User'][_0x5f9e('0x2b')]({'attributes':['id',_0x5f9e('0x2c'),_0x5f9e('0x2d'),_0x5f9e('0x2e'),_0x5f9e('0x5'),_0x5f9e('0x2f'),'openchannelPause',_0x5f9e('0x6'),_0x5f9e('0x7'),_0x5f9e('0x30'),_0x5f9e('0x31')],'where':{'id':{'$in':_[_0x5f9e('0x20')](_0x1d51bf,'id')}},'raw':!![]});})['then'](function(_0x38210d){return _0x38210d[_0x5f9e('0x20')](function(_0x4a1071){var _0x99afda=_[_0x5f9e('0x32')](_0x1d51bf,['id',_0x4a1071['id']]);var _0x425217=filterAgentAttributes(_0x99afda);_[_0x5f9e('0x1a')](_0x4a1071,_0x425217);_0x4a1071[_0x5f9e('0x33')]=getAgentStatus(_0x4a1071);return _0x4a1071;});})[_0x5f9e('0x16')](function(_0x4968ec){var _0x207a57=sortAgentsByStatus(_0x4968ec,_0x1dd402);return _[_0x5f9e('0x20')](_0x207a57,'id');})['catch'](function(_0x2ca1a7){throw _0x2ca1a7;});}exports[_0x5f9e('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x6be9e0){var _0x2facfc={'fields':[],'order':null};var _0x21981d=_0x6be9e0['split'](',');_0x2facfc[_0x5f9e('0x35')]=_[_0x5f9e('0x27')](_0x21981d,function(_0x3c5002){if(!_0x3c5002['includes'](_0x5f9e('0x33'))){return!![];}_0x2facfc['order']=_[_0x5f9e('0x36')](_0x3c5002,'-')?'DESC':_0x5f9e('0x37');return![];});return _0x2facfc;}exports[_0x5f9e('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x43ee1d){if(!_0x43ee1d){_0x43ee1d=_0x5f9e('0x39');}if(_0x43ee1d[_0x5f9e('0x28')](_0x5f9e('0x2d'))&&!_0x43ee1d[_0x5f9e('0x28')](_0x5f9e('0x3a'))){var _0x3d0a92=_0x43ee1d['substring'](0x0,_0x43ee1d[_0x5f9e('0x3b')](_0x5f9e('0x2d')));_0x43ee1d+=','+_0x3d0a92+_0x5f9e('0x3a');}return _0x43ee1d;}exports[_0x5f9e('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0xae055,_0xc500c3){var _0x2d2b28=_0xae055[_0x5f9e('0x3d')](function(_0x55f677,_0x22df8c){if(_0x55f677[_0x5f9e('0x33')]===_0x22df8c[_0x5f9e('0x33')]){if(_0x55f677['globalStatus']===_0x5f9e('0x10')){if(_0xc500c3===_0x5f9e('0x3e')){return(_0x55f677[_0x5f9e('0x31')]||'')<(_0x22df8c['pauseType']||'')||_0x55f677['fullname'][_0x5f9e('0x3f')]()>_0x22df8c['fullname'][_0x5f9e('0x3f')]()?0x1:-0x1;}else{return(_0x55f677[_0x5f9e('0x31')]||'')<(_0x22df8c[_0x5f9e('0x31')]||'')||_0x55f677[_0x5f9e('0x2d')]['toLowerCase']()>_0x22df8c[_0x5f9e('0x2d')][_0x5f9e('0x3f')]()?-0x1:0x1;}}else{if(_0xc500c3==='DESC'){return _0x55f677[_0x5f9e('0x2d')][_0x5f9e('0x3f')]()<_0x22df8c[_0x5f9e('0x2d')]['toLowerCase']()?0x1:-0x1;}else{return _0x55f677[_0x5f9e('0x2d')]['toLowerCase']()<_0x22df8c[_0x5f9e('0x2d')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0xc500c3===_0x5f9e('0x3e')){return _0x55f677[_0x5f9e('0x33')]<_0x22df8c['globalStatus']?0x1:-0x1;}else{return _0x55f677[_0x5f9e('0x33')]<_0x22df8c[_0x5f9e('0x33')]?-0x1:0x1;}}});return _0x2d2b28;}exports[_0x5f9e('0x40')]=sortAgentsByStatus;function filterAgentAttributes(_0x5e9146){var _0x4a8e8f=[_0x5f9e('0x41'),_0x5f9e('0x42'),_0x5f9e('0x43'),_0x5f9e('0x44'),_0x5f9e('0x31'),_0x5f9e('0x44'),_0x5f9e('0x3a'),_0x5f9e('0x45'),_0x5f9e('0x2e'),_0x5f9e('0x46'),'mailPause','smsPause','whatsappPause','faxPause',_0x5f9e('0x7'),_0x5f9e('0x47'),_0x5f9e('0x48'),_0x5f9e('0x49'),_0x5f9e('0x4a'),_0x5f9e('0x4b'),_0x5f9e('0x4c'),_0x5f9e('0x4d'),_0x5f9e('0x4e'),_0x5f9e('0x4f'),_0x5f9e('0x50'),'whatsappCurrentCapacity','faxCurrentCapacity',_0x5f9e('0x11'),_0x5f9e('0x51'),_0x5f9e('0x52'),_0x5f9e('0x13'),'whatsappStatus',_0x5f9e('0x12'),_0x5f9e('0xf'),_0x5f9e('0x53'),_0x5f9e('0x54'),_0x5f9e('0x55'),_0x5f9e('0x56'),_0x5f9e('0x57'),_0x5f9e('0x58'),'voiceStatusTime',_0x5f9e('0x59'),_0x5f9e('0x5a'),_0x5f9e('0x5b'),_0x5f9e('0x5c'),_0x5f9e('0x5d')];var _0x2fdb00=[_0x5f9e('0x2e'),_0x5f9e('0x46'),'mailPause','smsPause',_0x5f9e('0x30'),_0x5f9e('0x5'),_0x5f9e('0x7'),_0x5f9e('0x42')];var _0x6537f5=_(_0x5e9146)[_0x5f9e('0x5e')](_0x2fdb00)['pick'](_0x4a8e8f)[_0x5f9e('0x25')]();return _0x6537f5;}exports[_0x5f9e('0x5f')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x5f9e('0x2d'),_0x5f9e('0x60'),_0x5f9e('0x3a'),'online','globalStatus','userpic',_0x5f9e('0x43'),_0x5f9e('0x31'),_0x5f9e('0x44'),_0x5f9e('0x5'),_0x5f9e('0x2e'),_0x5f9e('0x2f'),'openchannelPause',_0x5f9e('0x6'),_0x5f9e('0x7'),_0x5f9e('0x30'),_0x5f9e('0x11'),_0x5f9e('0x12'),_0x5f9e('0x52'),_0x5f9e('0x51'),_0x5f9e('0x13'),_0x5f9e('0xf'),_0x5f9e('0x14'),_0x5f9e('0x53'),_0x5f9e('0x58'),'mailStatusTime',_0x5f9e('0x54'),_0x5f9e('0x56'),'voiceStatusTime','whatsappStatusTime',_0x5f9e('0x47'),'faxCapacity',_0x5f9e('0x49'),_0x5f9e('0x48'),'smsCapacity',_0x5f9e('0x4b'),'chatCurrentCapacity',_0x5f9e('0x61'),_0x5f9e('0x4f'),_0x5f9e('0x4e'),_0x5f9e('0x50'),_0x5f9e('0x62'),_0x5f9e('0x5c'),'phoneBarEnableAutomaticScreenRecording',_0x5f9e('0x5a'),'onhold',_0x5f9e('0x59'),_0x5f9e('0x5b')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 0acacad..180a5cb 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x116b=['pTalking','message','statusMessage','dialMethod','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','startCase','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','map','get','available','outbound','originated','find','merge','pick','jayson/promise','util','client','http','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking'];(function(_0x474a0d,_0x2a602f){var _0x444448=function(_0x420c29){while(--_0x420c29){_0x474a0d['push'](_0x474a0d['shift']());}};_0x444448(++_0x2a602f);}(_0x116b,0x1ee));var _0xb116=function(_0x50749b,_0x24bf72){_0x50749b=_0x50749b-0x0;var _0x4c1298=_0x116b[_0x50749b];return _0x4c1298;};'use strict';var _=require('lodash');var jayson=require(_0xb116('0x0'));var util=require(_0xb116('0x1'));var amiClient=jayson[_0xb116('0x2')]['http']({'port':0x232a});var routingClient=jayson['client'][_0xb116('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0xb116('0x4'),_0xb116('0x5'),_0xb116('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0xb116('0x7'),_0xb116('0x8'),_0xb116('0x9'),_0xb116('0xa'),_0xb116('0xb'),_0xb116('0xc'),_0xb116('0xd'),_0xb116('0xe'),_0xb116('0xf'),'unavailable','unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xb116('0x10'),'originated',_0xb116('0x11'),_0xb116('0x12'),'dialActive',_0xb116('0x13'),'Trunk',_0xb116('0x14'),_0xb116('0x15'),'erlangCalls',_0xb116('0x16'),_0xb116('0x17'),_0xb116('0x18'),_0xb116('0x19'),_0xb116('0x1a'),_0xb116('0x1b'),_0xb116('0x1c'),_0xb116('0x1d'),_0xb116('0x1e'),_0xb116('0x1f'),_0xb116('0x20'),_0xb116('0x21'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x28319c,_0xe96d31){var _0xa9b902=_0xe96d31===_0xb116('0x22')?amiClient:routingClient;return _0xa9b902[_0xb116('0x23')](_[_0xb116('0x24')](_0xe96d31)+_0xb116('0x25'),_0x28319c)['then'](function(_0x4703df){if(_0x4703df['error'])throw new Error(util['format'](_0xb116('0x26'),_0xe96d31));return _0x4703df[_0xb116('0x27')];})[_0xb116('0x28')](function(_0x45a5a8){throw _0x45a5a8;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x45d0e8,_0x2a34ad,_0x16f371,_0x1942ee){var _0x5b4c9a=DEFAULT_QUEUE_ATTRIBUTES;if(_0x16f371===_0xb116('0x22')){if(_0x1942ee===_0xb116('0x29')){_0x5b4c9a=_0x5b4c9a[_0xb116('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1942ee==='outbound'){_0x5b4c9a=_0x5b4c9a[_0xb116('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x45d0e8[_0xb116('0x2b')](function(_0x80d097){var _0x4702ac=_0x80d097[_0xb116('0x2c')]({'plain':!![]});_0x4702ac[_0xb116('0x5')]=0x0;_0x4702ac[_0xb116('0xa')]=0x0;_0x4702ac[_0xb116('0x4')]=0x0;_0x4702ac[_0xb116('0x2d')]=0x0;_0x4702ac[_0xb116('0x6')]=0x0;if(_0x16f371===_0xb116('0x22')){_0x4702ac[_0xb116('0xf')]=0x0;_0x4702ac[_0xb116('0x7')]=0x0;if(_0x1942ee===_0xb116('0x2e')){_0x4702ac[_0xb116('0x10')]=0x0;_0x4702ac[_0xb116('0x2f')]=0x0;}}var _0x386ff9=_[_0xb116('0x30')](_0x2a34ad,['id',_0x4702ac['id']]);if(_0x386ff9){_[_0xb116('0x31')](_0x4702ac,_[_0xb116('0x32')](_0x386ff9,_0x5b4c9a));}return _0x4702ac;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x50b5=['loggedIn','paused','waiting','busy','loggedInDb','notInUse','onHold','ringing','ringInUse','unknown','originated','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','request','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','voice','concat','outbound','get','talking','merge','lodash','jayson/promise','util','client','http','available'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x50b5,0x143));var _0x550b=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x50b5[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0x550b('0x0'));var jayson=require(_0x550b('0x1'));var util=require(_0x550b('0x2'));var amiClient=jayson[_0x550b('0x3')][_0x550b('0x4')]({'port':0x232a});var routingClient=jayson[_0x550b('0x3')][_0x550b('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x550b('0x5'),_0x550b('0x6'),_0x550b('0x7'),_0x550b('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x550b('0x9'),'inUse','invalid',_0x550b('0xa'),_0x550b('0xb'),_0x550b('0xc'),_0x550b('0xd'),_0x550b('0xe'),'talking','unavailable',_0x550b('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x550b('0x10'),'message',_0x550b('0x11'),_0x550b('0x12'),_0x550b('0x13'),_0x550b('0x14'),_0x550b('0x15'),_0x550b('0x16'),_0x550b('0x17'),_0x550b('0x18'),'erlangAbandonmentRate','erlangBusyFactor',_0x550b('0x19'),'dialPredictiveIntervalMaxThreshold',_0x550b('0x1a'),_0x550b('0x1b'),'predictiveIntervalTotalCalls',_0x550b('0x1c'),_0x550b('0x1d'),_0x550b('0x1e'),_0x550b('0x1f'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x3726de,_0x3fae37){var _0x31bbb0=_0x3fae37==='voice'?amiClient:routingClient;return _0x31bbb0[_0x550b('0x20')](_[_0x550b('0x21')](_0x3fae37)+_0x550b('0x22'),_0x3726de)[_0x550b('0x23')](function(_0x2fc476){if(_0x2fc476['error'])throw new Error(util[_0x550b('0x24')](_0x550b('0x25'),_0x3fae37));return _0x2fc476[_0x550b('0x26')];})[_0x550b('0x27')](function(_0x57827a){throw _0x57827a;});}exports[_0x550b('0x28')]=getRealtimeQueues;function initializeQueues(_0x1b45a8,_0x12aa8b,_0x595e8e,_0x34a8b9){var _0x26bed0=DEFAULT_QUEUE_ATTRIBUTES;if(_0x595e8e===_0x550b('0x29')){if(_0x34a8b9==='inbound'){_0x26bed0=_0x26bed0[_0x550b('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x34a8b9===_0x550b('0x2b')){_0x26bed0=_0x26bed0['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1b45a8['map'](function(_0x2cb720){var _0x52f002=_0x2cb720[_0x550b('0x2c')]({'plain':!![]});_0x52f002[_0x550b('0x7')]=0x0;_0x52f002[_0x550b('0xa')]=0x0;_0x52f002['loggedIn']=0x0;_0x52f002[_0x550b('0x5')]=0x0;_0x52f002[_0x550b('0x8')]=0x0;if(_0x595e8e===_0x550b('0x29')){_0x52f002[_0x550b('0x2d')]=0x0;_0x52f002[_0x550b('0x9')]=0x0;if(_0x34a8b9===_0x550b('0x2b')){_0x52f002['pTalking']=0x0;_0x52f002['originated']=0x0;}}var _0x78f4e2=_['find'](_0x12aa8b,['id',_0x52f002['id']]);if(_0x78f4e2){_[_0x550b('0x2e')](_0x52f002,_['pick'](_0x78f4e2,_0x26bed0));}return _0x52f002;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index f81ebcc..d4a0840 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(_0x4f6864,_0xdb09cc){var _0xcd9bd1=function(_0xb3ac37){while(--_0xb3ac37){_0x4f6864['push'](_0x4f6864['shift']());}};_0xcd9bd1(++_0xdb09cc);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x527228,_0x2bf9d1){var _0x18fc82=function(_0x301e4f){while(--_0x301e4f){_0x527228['push'](_0x527228['shift']());}};_0x18fc82(++_0x2bf9d1);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 39e1050..39c7852 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 _0x4510=['getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','00:00:00:00:00:00','127.0.0.1','getFirstInterface','cpus','model','join','createHash','md5','update','digest'];(function(_0x1629eb,_0x305130){var _0x230f76=function(_0x343461){while(--_0x343461){_0x1629eb['push'](_0x1629eb['shift']());}};_0x230f76(++_0x305130);}(_0x4510,0x1bc));var _0x0451=function(_0x3185ad,_0x5e5ca2){_0x3185ad=_0x3185ad-0x0;var _0x4f77fb=_0x4510[_0x3185ad];return _0x4f77fb;};'use strict';var _=require(_0x0451('0x0'));var os=require('os');var crypto=require(_0x0451('0x1'));var machine=require(_0x0451('0x2'));var exec=require('child_process')['execSync'];var config=require(_0x0451('0x3'));function getInterfaces(){var _0x2d8091=[];var _0x39db70=os[_0x0451('0x4')]();var _0x3c3e85=_[_0x0451('0x5')](_[_0x0451('0x6')](_0x39db70));for(var _0x55ce96=0x0;_0x55ce96<_0x3c3e85[_0x0451('0x7')];_0x55ce96++){var _0x37d1c3=_0x39db70[_0x3c3e85[_0x55ce96]][_0x0451('0x8')](function(_0x3f76a2){return _0x3f76a2[_0x0451('0x9')]===_0x0451('0xa')&&_0x3f76a2[_0x0451('0xb')]===![];});_0x2d8091=_0x2d8091[_0x0451('0xc')](_0x37d1c3);}return _0x2d8091;}function getFirstInterface(){var _0x42a042=_[_0x0451('0xd')](getInterfaces());return{'macAddress':_0x42a042&&_0x42a042['mac']?_0x42a042['mac']:_0x0451('0xe'),'ipAddress':_0x42a042&&_0x42a042['address']?_0x42a042['address']:_0x0451('0xf')};}exports[_0x0451('0x10')]=getFirstInterface;function getCPUhash(){var _0x512fbe=_[_0x0451('0x5')](os[_0x0451('0x11')]()['map'](function(_0x9b9f69){return _0x9b9f69[_0x0451('0x12')];}))[_0x0451('0x13')](':');return crypto[_0x0451('0x14')](_0x0451('0x15'))[_0x0451('0x16')](_0x512fbe)[_0x0451('0x17')]('hex');}exports[_0x0451('0x18')]=function(){var _0x580ddf=os[_0x0451('0x19')]();var _0x59185c=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x59185c['test'](config[_0x0451('0x1a')])){return config[_0x0451('0x1a')];}else if(_0x580ddf===_0x0451('0x1b')){return exec(_0x0451('0x1c'),{'encoding':_0x0451('0x1d')})[_0x0451('0x1e')]('\x0d\x0a','');}else{var _0x4c8bb1=getFirstInterface();var _0x1d45e5=getCPUhash();var _0x58fd1d=_0x1d45e5+'|'+os[_0x0451('0x1f')]()+'|'+_0x4c8bb1[_0x0451('0x20')]+'|'+_0x4c8bb1[_0x0451('0x21')];var _0x5c70b5=crypto['createHash']('md5')['update'](_0x58fd1d)['digest'](_0x0451('0x22'));return _0x5c70b5['substring'](0x0,0x8)+'-'+_0x5c70b5[_0x0451('0x23')](0x8,0xc)+'-'+_0x5c70b5[_0x0451('0x23')](0xc,0x10)+'-'+_0x5c70b5['substring'](0x10,0x14)+'-'+_0x5c70b5[_0x0451('0x23')](0x14);}}; \ No newline at end of file +var _0x1edb=['update','digest','hex','getUuid','platform','licenseToken','win32','replace','hostname','ipAddress','substring','crypto','child_process','execSync','../environment','networkInterfaces','keys','length','filter','IPv4','internal','concat','head','mac','address','getFirstInterface','orderBy','map','model','md5'];(function(_0x34b610,_0x48191b){var _0x1b9864=function(_0x43e7c3){while(--_0x43e7c3){_0x34b610['push'](_0x34b610['shift']());}};_0x1b9864(++_0x48191b);}(_0x1edb,0x119));var _0xb1ed=function(_0x3ca57f,_0x33a1e5){_0x3ca57f=_0x3ca57f-0x0;var _0x32c24b=_0x1edb[_0x3ca57f];return _0x32c24b;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xb1ed('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0xb1ed('0x1'))[_0xb1ed('0x2')];var config=require(_0xb1ed('0x3'));function getInterfaces(){var _0x138388=[];var _0x36d72b=os[_0xb1ed('0x4')]();var _0x8c1f7d=_['orderBy'](_[_0xb1ed('0x5')](_0x36d72b));for(var _0x324099=0x0;_0x324099<_0x8c1f7d[_0xb1ed('0x6')];_0x324099++){var _0x455abb=_0x36d72b[_0x8c1f7d[_0x324099]][_0xb1ed('0x7')](function(_0x2ac358){return _0x2ac358['family']===_0xb1ed('0x8')&&_0x2ac358[_0xb1ed('0x9')]===![];});_0x138388=_0x138388[_0xb1ed('0xa')](_0x455abb);}return _0x138388;}function getFirstInterface(){var _0x291b7d=_[_0xb1ed('0xb')](getInterfaces());return{'macAddress':_0x291b7d&&_0x291b7d[_0xb1ed('0xc')]?_0x291b7d[_0xb1ed('0xc')]:'00:00:00:00:00:00','ipAddress':_0x291b7d&&_0x291b7d['address']?_0x291b7d[_0xb1ed('0xd')]:'127.0.0.1'};}exports[_0xb1ed('0xe')]=getFirstInterface;function getCPUhash(){var _0x2d02ba=_[_0xb1ed('0xf')](os['cpus']()[_0xb1ed('0x10')](function(_0x24257b){return _0x24257b[_0xb1ed('0x11')];}))['join'](':');return crypto['createHash'](_0xb1ed('0x12'))[_0xb1ed('0x13')](_0x2d02ba)[_0xb1ed('0x14')](_0xb1ed('0x15'));}exports[_0xb1ed('0x16')]=function(){var _0x1896a7=os[_0xb1ed('0x17')]();var _0x12a99e=/[0-9a-f-]{36}/;if(config[_0xb1ed('0x18')]&&_0x12a99e['test'](config[_0xb1ed('0x18')])){return config[_0xb1ed('0x18')];}else if(_0x1896a7===_0xb1ed('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xb1ed('0x1a')]('\x0d\x0a','');}else{var _0x5bcd37=getFirstInterface();var _0x3e974a=getCPUhash();var _0xa5b535=_0x3e974a+'|'+os[_0xb1ed('0x1b')]()+'|'+_0x5bcd37['macAddress']+'|'+_0x5bcd37[_0xb1ed('0x1c')];var _0x2c7fec=crypto['createHash'](_0xb1ed('0x12'))[_0xb1ed('0x13')](_0xa5b535)[_0xb1ed('0x14')](_0xb1ed('0x15'));return _0x2c7fec[_0xb1ed('0x1d')](0x0,0x8)+'-'+_0x2c7fec[_0xb1ed('0x1d')](0x8,0xc)+'-'+_0x2c7fec['substring'](0xc,0x10)+'-'+_0x2c7fec[_0xb1ed('0x1d')](0x10,0x14)+'-'+_0x2c7fec['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index adbeed7..73e31a1 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 _0xedec=['license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','util','moment','request-promise','bluebird','version','./hardware','../logger'];(function(_0xc39411,_0x458ec2){var _0x2f7a69=function(_0x5c0bf5){while(--_0x5c0bf5){_0xc39411['push'](_0xc39411['shift']());}};_0x2f7a69(++_0x458ec2);}(_0xedec,0x16b));var _0xcede=function(_0x3ceb6c,_0x554602){_0x3ceb6c=_0x3ceb6c-0x0;var _0x256814=_0xedec[_0x3ceb6c];return _0x256814;};'use strict';var util=require(_0xcede('0x0'));var moment=require(_0xcede('0x1'));var rp=require(_0xcede('0x2'));var BPromise=require(_0xcede('0x3'));var pkginfo=require('pkginfo')(module,_0xcede('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xcede('0x5'));var logger=require(_0xcede('0x6'))(_0xcede('0x7'));var HOST=_0xcede('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4d30a7){return new BPromise(function(_0x324eb1,_0x527239){var _0x3be894=util[_0xcede('0x9')](_0xcede('0xa'),HOST,_0x4d30a7,module[_0xcede('0xb')]['version']);if(oldToken){_0x3be894=util[_0xcede('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x4d30a7,module[_0xcede('0xb')][_0xcede('0x4')],oldToken);}var _0x57fa95={'uri':_0x3be894,'method':_0xcede('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x57fa95)[_0xcede('0xd')](function(_0x4a1f1a){_0x324eb1(_0x4a1f1a);})[_0xcede('0xe')](function(_0x51a3af){_0x527239(_0x51a3af);});});}function manageLicense(_0xfe6472,_0xa5b2d){var _0x4ef7b2=_0xa5b2d['get']({'plain':!![]});if(!isOldTokenSent&&_0x4ef7b2[_0xcede('0xf')]!==_0xfe6472&&!_0x4ef7b2[_0xcede('0x10')]){oldToken=_0x4ef7b2[_0xcede('0xf')];}httpRequest(_0xfe6472)['then'](function(_0x1b8dab){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1b8dab[_0xcede('0x11')]){isOldTokenSent=![];if(!_0x4ef7b2[_0xcede('0x7')]&&_0x4ef7b2['license']!=_0x1b8dab['license']||_0x4ef7b2[_0xcede('0x7')]&&_0x4ef7b2[_0xcede('0x10')]){logger[_0xcede('0x12')](_0xcede('0x13'));}if(_0x4ef7b2[_0xcede('0x7')]&&!_0x4ef7b2[_0xcede('0x10')]&&_0x4ef7b2[_0xcede('0x7')]!=_0x1b8dab[_0xcede('0x7')]){logger[_0xcede('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x4ef7b2[_0xcede('0x7')]&&!_0x4ef7b2[_0xcede('0x10')]&&_0x4ef7b2[_0xcede('0x7')]==_0x1b8dab[_0xcede('0x7')]){return _0xa5b2d;}return _0xa5b2d[_0xcede('0x14')]({'data1':_0xfe6472,'data2':null,'license':_0x1b8dab[_0xcede('0x7')]});}else{if(_0x1b8dab[_0xcede('0x7')]||_0x4ef7b2[_0xcede('0x7')]){if(!_0x4ef7b2[_0xcede('0x10')]){if(_0x4ef7b2['data1']==_0xfe6472){GRAY_PERIOD_REASON=_0xcede('0x15');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xcede('0x16');logger[_0xcede('0x12')](_0xcede('0x17'),_0x4ef7b2[_0xcede('0xf')],_0xfe6472);}logger[_0xcede('0x12')](_0xcede('0x18'),GRAY_PERIOD_REASON[_0xcede('0x19')](),moment()[_0xcede('0x9')](_0xcede('0x1a')));return _0xa5b2d[_0xcede('0x14')]({'data2':encryptor[_0xcede('0x1b')](moment()[_0xcede('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xcede('0x1c')](encryptor['decryptString'](_0x4ef7b2[_0xcede('0x10')]),_0xcede('0x1d'))>DAYS){logger['info'](_0xcede('0x1e'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0xa5b2d['update']({'data1':_0xfe6472,'data2':null,'license':null});}}}else{if(_0x4ef7b2['data1']!=_0xfe6472){logger[_0xcede('0x12')](_0xcede('0x17'),_0x4ef7b2['data1'],_0xfe6472);return _0xa5b2d[_0xcede('0x14')]({'data1':_0xfe6472,'data2':null,'license':null});}}}return _0xa5b2d;})[_0xcede('0xd')](function(_0x242de6){_0xa5b2d=_0x242de6;})[_0xcede('0xe')](function(_0x905c6){logger['error'](_0x905c6['message']);})[_0xcede('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0xcede('0x20')](),_0xa5b2d);},TIME);});}function defaultLicense(){var _0x388137=hardware[_0xcede('0x20')]();if(_0x388137){return db['License'][_0xcede('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x388137}})['spread'](function(_0x3704b6,_0x5f2ac7){logger[_0xcede('0x12')](_0xcede('0x22'),_0x388137);manageLicense(_0x388137,_0x3704b6);})[_0xcede('0xe')](function(_0x5af018){logger[_0xcede('0x23')](_0x5af018[_0xcede('0x24')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x3424=['License','findOrCreate','spread','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data2','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','encryptString','YYYY-MM-DD\x20HH:mm','diff','days','error','message','finally','getUuid'];(function(_0x348048,_0x1acb73){var _0x2eb2c8=function(_0x304761){while(--_0x304761){_0x348048['push'](_0x348048['shift']());}};_0x2eb2c8(++_0x1acb73);}(_0x3424,0x79));var _0x4342=function(_0x434e88,_0x1b52ed){_0x434e88=_0x434e88-0x0;var _0xeebdb1=_0x3424[_0x434e88];return _0xeebdb1;};'use strict';var util=require(_0x4342('0x0'));var moment=require(_0x4342('0x1'));var rp=require(_0x4342('0x2'));var BPromise=require(_0x4342('0x3'));var pkginfo=require(_0x4342('0x4'))(module,_0x4342('0x5'));var db=require(_0x4342('0x6'))['db'];var encryptor=require(_0x4342('0x7'));var hardware=require(_0x4342('0x8'));var logger=require(_0x4342('0x9'))(_0x4342('0xa'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x44fee7){return new BPromise(function(_0x18f91c,_0x528756){var _0x3071bc=util[_0x4342('0xb')](_0x4342('0xc'),HOST,_0x44fee7,module[_0x4342('0xd')][_0x4342('0x5')]);if(oldToken){_0x3071bc=util['format'](_0x4342('0xe'),HOST,_0x44fee7,module[_0x4342('0xd')]['version'],oldToken);}var _0x25a4db={'uri':_0x3071bc,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x25a4db)[_0x4342('0xf')](function(_0x2b7366){_0x18f91c(_0x2b7366);})[_0x4342('0x10')](function(_0x127c67){_0x528756(_0x127c67);});});}function manageLicense(_0x50e00d,_0x531b56){var _0x271d0f=_0x531b56[_0x4342('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x271d0f['data1']!==_0x50e00d&&!_0x271d0f[_0x4342('0x12')]){oldToken=_0x271d0f[_0x4342('0x13')];}httpRequest(_0x50e00d)['then'](function(_0x310ba0){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x310ba0[_0x4342('0x14')]){isOldTokenSent=![];if(!_0x271d0f[_0x4342('0xa')]&&_0x271d0f[_0x4342('0xa')]!=_0x310ba0[_0x4342('0xa')]||_0x271d0f[_0x4342('0xa')]&&_0x271d0f['data2']){logger['info'](_0x4342('0x15'));}if(_0x271d0f[_0x4342('0xa')]&&!_0x271d0f['data2']&&_0x271d0f['license']!=_0x310ba0[_0x4342('0xa')]){logger[_0x4342('0x16')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x271d0f[_0x4342('0xa')]&&!_0x271d0f[_0x4342('0x12')]&&_0x271d0f['license']==_0x310ba0['license']){return _0x531b56;}return _0x531b56[_0x4342('0x17')]({'data1':_0x50e00d,'data2':null,'license':_0x310ba0[_0x4342('0xa')]});}else{if(_0x310ba0[_0x4342('0xa')]||_0x271d0f['license']){if(!_0x271d0f['data2']){if(_0x271d0f[_0x4342('0x13')]==_0x50e00d){GRAY_PERIOD_REASON=_0x4342('0x18');logger[_0x4342('0x16')](_0x4342('0x19'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x4342('0x16')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x271d0f[_0x4342('0x13')],_0x50e00d);}logger[_0x4342('0x16')](_0x4342('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x531b56[_0x4342('0x17')]({'data2':encryptor[_0x4342('0x1b')](moment()[_0x4342('0xb')](_0x4342('0x1c')))});}else{if(moment()[_0x4342('0x1d')](encryptor['decryptString'](_0x271d0f[_0x4342('0x12')]),_0x4342('0x1e'))>DAYS){logger[_0x4342('0x16')]('DEMO\x20START\x20AT\x20%s',moment()[_0x4342('0xb')](_0x4342('0x1c')));isOldTokenSent=![];return _0x531b56[_0x4342('0x17')]({'data1':_0x50e00d,'data2':null,'license':null});}}}else{if(_0x271d0f[_0x4342('0x13')]!=_0x50e00d){logger[_0x4342('0x16')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x271d0f[_0x4342('0x13')],_0x50e00d);return _0x531b56[_0x4342('0x17')]({'data1':_0x50e00d,'data2':null,'license':null});}}}return _0x531b56;})[_0x4342('0xf')](function(_0x238d3f){_0x531b56=_0x238d3f;})['catch'](function(_0x66b5e9){logger[_0x4342('0x1f')](_0x66b5e9[_0x4342('0x20')]);})[_0x4342('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x4342('0x22')](),_0x531b56);},TIME);});}function defaultLicense(){var _0x135c2b=hardware[_0x4342('0x22')]();if(_0x135c2b){return db[_0x4342('0x23')][_0x4342('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x135c2b}})[_0x4342('0x25')](function(_0x16ebba,_0xc84ef1){logger[_0x4342('0x16')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x135c2b);manageLicense(_0x135c2b,_0x16ebba);})['catch'](function(_0x5cab4a){logger[_0x4342('0x1f')](_0x5cab4a['message']);});}}exports[_0x4342('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 370c106..2914cec 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 _0x25b5=['lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','uuid','data1','license','isEmpty','data2','split','decryptString','format','parse','demo','gray','deadline','add','days','grayReason','machineUuid','changed','disabled','message','User','findAll','sequelize','col','role','count','users','telephones','forEach','admin','user','catch','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util'];(function(_0x32ee61,_0x3f1b2d){var _0x226c2f=function(_0x46ac3a){while(--_0x46ac3a){_0x32ee61['push'](_0x32ee61['shift']());}};_0x226c2f(++_0x3f1b2d);}(_0x25b5,0xef));var _0x525b=function(_0x62f5fa,_0x554f6e){_0x62f5fa=_0x62f5fa-0x0;var _0x4aaa91=_0x25b5[_0x62f5fa];return _0x4aaa91;};'use strict';var util=require(_0x525b('0x0'));var _=require(_0x525b('0x1'));var moment=require('moment');var BPromise=require(_0x525b('0x2'));var hardware=require(_0x525b('0x3'));var encryptor=require(_0x525b('0x4'));var db=require(_0x525b('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x525b('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x525b('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x525b('0x8'),'machineUuid':hardware[_0x525b('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x352227){return new BPromise(function(_0x2efc9f,_0x1ce49){return db[_0x525b('0x9')][_0x525b('0xa')](_[_0x525b('0xb')](_0x352227,{'raw':!![],'where':{'id':0x1}}))[_0x525b('0xc')](function(_0x515cdb){return checkLicense(_0x515cdb,null);})[_0x525b('0xc')](function(_0xd857f7){_0x2efc9f(_0xd857f7);return;})['catch'](function(_0x1f40f2){_0x1ce49(_0x1f40f2);});});}function checkLicense(_0x1aae13,_0x32d5a1){if(!_0x1aae13){demoLicense[_0x525b('0xd')]=_0x1aae13[_0x525b('0xe')];return demoLicense;}try{var _0x2ff10f=_0x32d5a1||_0x1aae13[_0x525b('0xf')];if(_[_0x525b('0x10')](_0x2ff10f)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x211a73=_0x1aae13[_0x525b('0xe')];var _0x57b217=_0x1aae13[_0x525b('0x11')];var _0x5588c4=_0x211a73[_0x525b('0x12')]('-')[0x4];var _0x4f01ec=_0x211a73[_0x525b('0x12')]('-')[0x0];var _0x3973bf=encryptor[_0x525b('0x13')](_0x2ff10f,util[_0x525b('0x14')]('%s:%s:%s',_0x5588c4,_0x211a73,_0x4f01ec));var _0x581ff5=JSON[_0x525b('0x15')](_0x3973bf);_0x581ff5[_0x525b('0x16')]=![];_0x581ff5[_0x525b('0xd')]=_0x211a73;_0x581ff5['machineUuid']=hardware[_0x525b('0x7')]();if(_0x57b217){var _0x2b95d5=encryptor[_0x525b('0x13')](_0x57b217);_0x581ff5[_0x525b('0x17')]=_0x2b95d5;_0x581ff5[_0x525b('0x18')]=moment(_0x2b95d5)[_0x525b('0x19')](0x7,_0x525b('0x1a'))[_0x525b('0x14')]();_0x581ff5[_0x525b('0x1b')]=_0x581ff5['uuid']!=_0x581ff5[_0x525b('0x1c')]?_0x525b('0x1d'):_0x525b('0x1e');}return _0x581ff5;}catch(_0x3015b7){breakingLicense[_0x525b('0xd')]=_0x1aae13[_0x525b('0xe')];breakingLicense['message']=_0x3015b7[_0x525b('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xf5f521,_0x594e72){getLicense()[_0x525b('0xc')](function(_0x5d1873){return db[_0x525b('0x20')][_0x525b('0x21')]({'attributes':['role',[db[_0x525b('0x22')]['fn']('COUNT',db[_0x525b('0x22')][_0x525b('0x23')](_0x525b('0x24'))),_0x525b('0x25')]],'group':'role','where':{'role':{'$or':['admin','user','telephone']}},'raw':!![]})[_0x525b('0xc')](function(_0x342c83){var _0x587679={'user':_0x5d1873[_0x525b('0x26')]||0x0,'telephone':_0x5d1873[_0x525b('0x27')]||0x0};_0x342c83[_0x525b('0x28')](function(_0x3718a4){var _0x511fde=_0x3718a4[_0x525b('0x24')]===_0x525b('0x29')?_0x525b('0x2a'):_0x3718a4['role'];_0x587679[_0x511fde]-=_0x3718a4['count'];if(_0x587679[_0x511fde]<0x0)_0x587679[_0x511fde]=0x0;});_0xf5f521(_0x587679);return;});})[_0x525b('0x2b')](function(_0x4cca71){_0x594e72(_0x4cca71);});});}function checkUserLimits(_0x1cb992){return new BPromise(function(_0x5af6e4,_0x3aba3c){getLimits()['then'](function(_0x41f328){var _0x29260f=_['pick'](_[_0x525b('0x2c')](_0x1cb992,'role'),[_0x525b('0x29'),_0x525b('0x2a'),_0x525b('0x2d')]);var _0xbbdc93=(_0x29260f[_0x525b('0x29')]||0x0)+(_0x29260f[_0x525b('0x2a')]||0x0);var _0x37838b=_0x29260f[_0x525b('0x2d')]||0x0;if(_0xbbdc93>_0x41f328['user'])return _0x3aba3c(_0x525b('0x2e'));if(_0x37838b>_0x41f328[_0x525b('0x2d')])return _0x3aba3c(_0x525b('0x2f'));return _0x5af6e4();})[_0x525b('0x2b')](function(_0x34948b){_0x3aba3c(_0x34948b);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x8742=['User','role','sequelize','COUNT','count','telephone','users','telephones','forEach','admin','user','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','%s:%s:%s','parse','machineUuid','decryptString','gray','deadline','add','grayReason','disabled','message'];(function(_0x5f58da,_0x1f9d4a){var _0x4f667c=function(_0x195c41){while(--_0x195c41){_0x5f58da['push'](_0x5f58da['shift']());}};_0x4f667c(++_0x1f9d4a);}(_0x8742,0x1e6));var _0x2874=function(_0x280bec,_0x3278b1){_0x280bec=_0x280bec-0x0;var _0x4c5ec7=_0x8742[_0x280bec];return _0x4c5ec7;};'use strict';var util=require(_0x2874('0x0'));var _=require(_0x2874('0x1'));var moment=require(_0x2874('0x2'));var BPromise=require(_0x2874('0x3'));var hardware=require(_0x2874('0x4'));var encryptor=require(_0x2874('0x5'));var db=require(_0x2874('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2874('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x2874('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2874('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x2874('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x40bf5d){return new BPromise(function(_0x257058,_0xb4e3c0){return db['License'][_0x2874('0xa')](_[_0x2874('0xb')](_0x40bf5d,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x4eaa0c){return checkLicense(_0x4eaa0c,null);})[_0x2874('0xc')](function(_0x3262a4){_0x257058(_0x3262a4);return;})[_0x2874('0xd')](function(_0x561061){_0xb4e3c0(_0x561061);});});}function checkLicense(_0x2d7b39,_0x2d3be2){if(!_0x2d7b39){demoLicense[_0x2874('0xe')]=_0x2d7b39[_0x2874('0xf')];return demoLicense;}try{var _0x1426cc=_0x2d3be2||_0x2d7b39[_0x2874('0x10')];if(_[_0x2874('0x11')](_0x1426cc)){throw new Error(_0x2874('0x12'));}var _0x205015=_0x2d7b39[_0x2874('0xf')];var _0x577b2b=_0x2d7b39[_0x2874('0x13')];var _0x5f8cc3=_0x205015['split']('-')[0x4];var _0xc58c6b=_0x205015[_0x2874('0x14')]('-')[0x0];var _0x1ce701=encryptor['decryptString'](_0x1426cc,util['format'](_0x2874('0x15'),_0x5f8cc3,_0x205015,_0xc58c6b));var _0x4e2ccd=JSON[_0x2874('0x16')](_0x1ce701);_0x4e2ccd['demo']=![];_0x4e2ccd[_0x2874('0xe')]=_0x205015;_0x4e2ccd[_0x2874('0x17')]=hardware['getUuid']();if(_0x577b2b){var _0x4e9444=encryptor[_0x2874('0x18')](_0x577b2b);_0x4e2ccd[_0x2874('0x19')]=_0x4e9444;_0x4e2ccd[_0x2874('0x1a')]=moment(_0x4e9444)[_0x2874('0x1b')](0x7,'days')['format']();_0x4e2ccd[_0x2874('0x1c')]=_0x4e2ccd[_0x2874('0xe')]!=_0x4e2ccd[_0x2874('0x17')]?'changed':_0x2874('0x1d');}return _0x4e2ccd;}catch(_0x1d80f1){breakingLicense[_0x2874('0xe')]=_0x2d7b39[_0x2874('0xf')];breakingLicense[_0x2874('0x1e')]=_0x1d80f1[_0x2874('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4e9b2a,_0x5c1873){getLicense()[_0x2874('0xc')](function(_0x172564){return db[_0x2874('0x1f')]['findAll']({'attributes':[_0x2874('0x20'),[db[_0x2874('0x21')]['fn'](_0x2874('0x22'),db[_0x2874('0x21')]['col'](_0x2874('0x20'))),_0x2874('0x23')]],'group':_0x2874('0x20'),'where':{'role':{'$or':['admin','user',_0x2874('0x24')]}},'raw':!![]})[_0x2874('0xc')](function(_0x150e4c){var _0x4811ce={'user':_0x172564[_0x2874('0x25')]||0x0,'telephone':_0x172564[_0x2874('0x26')]||0x0};_0x150e4c[_0x2874('0x27')](function(_0x22a624){var _0x47546a=_0x22a624[_0x2874('0x20')]===_0x2874('0x28')?_0x2874('0x29'):_0x22a624[_0x2874('0x20')];_0x4811ce[_0x47546a]-=_0x22a624[_0x2874('0x23')];if(_0x4811ce[_0x47546a]<0x0)_0x4811ce[_0x47546a]=0x0;});_0x4e9b2a(_0x4811ce);return;});})[_0x2874('0xd')](function(_0x83aa78){_0x5c1873(_0x83aa78);});});}function checkUserLimits(_0x5cd2ca){return new BPromise(function(_0x5ee776,_0x2fb2c9){getLimits()[_0x2874('0xc')](function(_0x1ee6d5){var _0x1e7865=_[_0x2874('0x2a')](_[_0x2874('0x2b')](_0x5cd2ca,'role'),['admin','user',_0x2874('0x24')]);var _0x1aea8a=(_0x1e7865[_0x2874('0x28')]||0x0)+(_0x1e7865['user']||0x0);var _0x5e0f29=_0x1e7865[_0x2874('0x24')]||0x0;if(_0x1aea8a>_0x1ee6d5[_0x2874('0x29')])return _0x2fb2c9(_0x2874('0x2c'));if(_0x5e0f29>_0x1ee6d5[_0x2874('0x24')])return _0x2fb2c9(_0x2874('0x2d'));return _0x5ee776();})['catch'](function(_0x3dc8ee){_0x2fb2c9(_0x3dc8ee);});});}module[_0x2874('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 61c893a..4755e26 100644 --- a/server/config/local.env.js +++ b/server/config/local.env.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['app-id','secret','exports','myappanuglar-secret'];(function(_0x2d7b9a,_0x4aef37){var _0x461a27=function(_0x1b243d){while(--_0x1b243d){_0x2d7b9a['push'](_0x2d7b9a['shift']());}};_0x461a27(++_0x4aef37);}(_0xb10b,0x12a));var _0xbb10=function(_0x47a41f,_0x48d92b){_0x47a41f=_0x47a41f-0x0;var _0x2411f5=_0xb10b[_0x47a41f];return _0x2411f5;};'use strict';module[_0xbb10('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xbb10('0x1'),'GOOGLE_ID':_0xbb10('0x2'),'GOOGLE_SECRET':_0xbb10('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xbbbc=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x1eed28,_0x15a59b){var _0x55e0f5=function(_0x29787a){while(--_0x29787a){_0x1eed28['push'](_0x1eed28['shift']());}};_0x55e0f5(++_0x15a59b);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x295df8,_0x1f9924){_0x295df8=_0x295df8-0x0;var _0x1c4b61=_0xbbbc[_0x295df8];return _0x1c4b61;};'use strict';module[_0xcbbb('0x0')]={'DOMAIN':_0xcbbb('0x1'),'SESSION_SECRET':_0xcbbb('0x2'),'GOOGLE_ID':_0xcbbb('0x3'),'GOOGLE_SECRET':_0xcbbb('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 0260c1b..97dbb7e 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeaa1=['exports','fileLogger'];(function(_0x53fd59,_0x18e8a4){var _0x288282=function(_0x524776){while(--_0x524776){_0x53fd59['push'](_0x53fd59['shift']());}};_0x288282(++_0x18e8a4);}(_0xeaa1,0xf9));var _0x1eaa=function(_0x5a9e99,_0x296c39){_0x5a9e99=_0x5a9e99-0x0;var _0x257e1a=_0xeaa1[_0x5a9e99];return _0x257e1a;};'use strict';var fileLogger=require('../utils/loggers')[_0x1eaa('0x0')];module[_0x1eaa('0x1')]=fileLogger; \ No newline at end of file +var _0x7636=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7636,0x11d));var _0x6763=function(_0x434543,_0x2fd498){_0x434543=_0x434543-0x0;var _0x3e6749=_0x7636[_0x434543];return _0x3e6749;};'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module[_0x6763('0x0')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 7715171..9e017b1 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 _0x39e8=['legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','join','root'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0x39e8,0x1be));var _0x839e=function(_0x188d3b,_0x423af5){_0x188d3b=_0x188d3b-0x0;var _0xdae5b6=_0x39e8[_0x188d3b];return _0xdae5b6;};'use strict';var path=require(_0x839e('0x0'));var cfg=require(_0x839e('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x839e('0x2')](cfg[_0x839e('0x3')],_0x839e('0x4')))};var pm2config={'apps':[{'name':_0x839e('0x5'),'script':path[_0x839e('0x2')](__dirname,_0x839e('0x6')),'env':env},{'name':_0x839e('0x7'),'script':path[_0x839e('0x2')](__dirname,_0x839e('0x8')),'env':env},{'name':_0x839e('0x9'),'script':path[_0x839e('0x2')](__dirname,_0x839e('0xa')),'env':env},{'name':_0x839e('0xb'),'script':path[_0x839e('0x2')](__dirname,_0x839e('0xc')),'env':env},{'name':_0x839e('0xd'),'script':path[_0x839e('0x2')](__dirname,_0x839e('0xe')),'env':env},{'name':_0x839e('0xf'),'script':path[_0x839e('0x2')](__dirname,_0x839e('0x10')),'env':env}]};module[_0x839e('0x11')]=pm2config; \ No newline at end of file +var _0xfde2=['xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js'];(function(_0x340e5f,_0x5b5642){var _0x40974c=function(_0xf25a32){while(--_0xf25a32){_0x340e5f['push'](_0x340e5f['shift']());}};_0x40974c(++_0x5b5642);}(_0xfde2,0x69));var _0x2fde=function(_0x35731c,_0x5ab1d1){_0x35731c=_0x35731c-0x0;var _0x2f2957=_0xfde2[_0x35731c];return _0x2f2957;};'use strict';var path=require(_0x2fde('0x0'));var cfg=require(_0x2fde('0x1'));var env={'NODE_PATH':path[_0x2fde('0x2')](path[_0x2fde('0x3')](cfg[_0x2fde('0x4')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x2fde('0x5'),'script':path[_0x2fde('0x3')](__dirname,_0x2fde('0x6')),'env':env},{'name':_0x2fde('0x7'),'script':path[_0x2fde('0x3')](__dirname,_0x2fde('0x8')),'env':env},{'name':_0x2fde('0x9'),'script':path['join'](__dirname,_0x2fde('0xa')),'env':env},{'name':_0x2fde('0xb'),'script':path[_0x2fde('0x3')](__dirname,_0x2fde('0xc')),'env':env},{'name':'routing','script':path[_0x2fde('0x3')](__dirname,_0x2fde('0xd')),'env':env},{'name':_0x2fde('0xe'),'script':path[_0x2fde('0x3')](__dirname,_0x2fde('0xf')),'env':env}]};module[_0x2fde('0x10')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 6b1cbad..a537935 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 _0x0d10=['connected','start','disconnect','then','stop','restart','list','describe','delete','dump','pm2','bluebird','./config','connect'];(function(_0x46d811,_0x2bde59){var _0x144840=function(_0x14ef02){while(--_0x14ef02){_0x46d811['push'](_0x46d811['shift']());}};_0x144840(++_0x2bde59);}(_0x0d10,0xb2));var _0x00d1=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0x0d10[_0x2bbc07];return _0x6879e4;};'use strict';var pm2=require(_0x00d1('0x0'));var BPromise=require(_0x00d1('0x1'));var config=require(_0x00d1('0x2'));function connect(){return new BPromise(function(_0xdefcfe,_0x5a43db){return pm2[_0x00d1('0x3')](function(_0x29e678){if(_0x29e678){return _0x5a43db(_0x29e678);}return _0xdefcfe(_0x00d1('0x4'));});});};exports[_0x00d1('0x5')]=function(_0x3081c4){return connect()['then'](function(){return new BPromise(function(_0x29dcb8,_0x556806){return pm2[_0x00d1('0x5')](_0x3081c4,function(_0x13cc5c,_0x5313e1){if(_0x13cc5c){return _0x556806(_0x13cc5c);}pm2[_0x00d1('0x6')]();return _0x29dcb8(_0x5313e1);});});});};exports['stop']=function(_0x29a9ac){return connect()[_0x00d1('0x7')](function(){return new BPromise(function(_0x2e537c,_0x4c0f7f){return pm2[_0x00d1('0x8')](_0x29a9ac,function(_0x73023f,_0x227426){if(_0x73023f){return _0x4c0f7f(_0x73023f);}pm2[_0x00d1('0x6')]();return _0x2e537c(_0x227426);});});});};exports['restart']=function(_0x398301){return connect()[_0x00d1('0x7')](function(){return new BPromise(function(_0x2634de,_0x85497a){return pm2[_0x00d1('0x9')](_0x398301,function(_0x9fcca9,_0x2eb178){if(_0x9fcca9){return _0x85497a(_0x9fcca9);}pm2['disconnect']();return _0x2634de(_0x2eb178);});});});};exports[_0x00d1('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x524b18,_0x4caa6){return pm2[_0x00d1('0xa')](function(_0x3a7cab,_0x3becbe){if(_0x3a7cab){return _0x4caa6(_0x3a7cab);}pm2[_0x00d1('0x6')]();return _0x524b18(_0x3becbe);});});});};exports[_0x00d1('0xb')]=function(_0x3f75cf){return connect()[_0x00d1('0x7')](function(){return new BPromise(function(_0x387683,_0x5eada3){return pm2[_0x00d1('0xb')](_0x3f75cf,function(_0x263b8e,_0x359779){if(_0x263b8e){return _0x5eada3(_0x263b8e);}pm2['disconnect']();return _0x387683(_0x359779);});});});};exports['delete']=function(_0x218af0){return connect()['then'](function(){return new BPromise(function(_0x57f98d,_0x3a8ea3){return pm2[_0x00d1('0xc')](_0x218af0,function(_0x36640b,_0x477fa9){if(_0x36640b){return _0x3a8ea3(_0x36640b);}pm2[_0x00d1('0x6')]();return _0x57f98d(_0x477fa9);});});});};exports[_0x00d1('0xd')]=function(){return connect()[_0x00d1('0x7')](function(){return new BPromise(function(_0xe1d836,_0x2c9ab2){return pm2['dump'](function(_0x5e63e4){if(_0x5e63e4){return _0x2c9ab2(_0x5e63e4);}return _0xe1d836('saved');});});});}; \ No newline at end of file +var _0xc325=['connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0xc325,0x1a2));var _0x5c32=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc325[_0x501510];return _0x1e6ee5;};'use strict';var pm2=require(_0x5c32('0x0'));var BPromise=require('bluebird');var config=require(_0x5c32('0x1'));function connect(){return new BPromise(function(_0x137003,_0x3db1f1){return pm2[_0x5c32('0x2')](function(_0x5bd5af){if(_0x5bd5af){return _0x3db1f1(_0x5bd5af);}return _0x137003(_0x5c32('0x3'));});});};exports[_0x5c32('0x4')]=function(_0x230626){return connect()[_0x5c32('0x5')](function(){return new BPromise(function(_0x2adf39,_0x282596){return pm2[_0x5c32('0x4')](_0x230626,function(_0x488345,_0x256792){if(_0x488345){return _0x282596(_0x488345);}pm2[_0x5c32('0x6')]();return _0x2adf39(_0x256792);});});});};exports[_0x5c32('0x7')]=function(_0x1955ac){return connect()[_0x5c32('0x5')](function(){return new BPromise(function(_0x1c2d40,_0x3d6cff){return pm2[_0x5c32('0x7')](_0x1955ac,function(_0x32a895,_0xc1cb74){if(_0x32a895){return _0x3d6cff(_0x32a895);}pm2[_0x5c32('0x6')]();return _0x1c2d40(_0xc1cb74);});});});};exports[_0x5c32('0x8')]=function(_0x11db00){return connect()[_0x5c32('0x5')](function(){return new BPromise(function(_0x3c55c7,_0x57e6fe){return pm2[_0x5c32('0x8')](_0x11db00,function(_0x4894c7,_0x2d5630){if(_0x4894c7){return _0x57e6fe(_0x4894c7);}pm2['disconnect']();return _0x3c55c7(_0x2d5630);});});});};exports[_0x5c32('0x9')]=function(){return connect()[_0x5c32('0x5')](function(){return new BPromise(function(_0x301d9c,_0x39288e){return pm2['list'](function(_0x246ef4,_0x5a5d28){if(_0x246ef4){return _0x39288e(_0x246ef4);}pm2[_0x5c32('0x6')]();return _0x301d9c(_0x5a5d28);});});});};exports[_0x5c32('0xa')]=function(_0x583888){return connect()[_0x5c32('0x5')](function(){return new BPromise(function(_0x5821af,_0x4081ce){return pm2[_0x5c32('0xa')](_0x583888,function(_0x5be43d,_0xda5e7d){if(_0x5be43d){return _0x4081ce(_0x5be43d);}pm2[_0x5c32('0x6')]();return _0x5821af(_0xda5e7d);});});});};exports[_0x5c32('0xb')]=function(_0x30484e){return connect()[_0x5c32('0x5')](function(){return new BPromise(function(_0x1dc8c4,_0x1f0e8b){return pm2['delete'](_0x30484e,function(_0x5bdd0a,_0x2ec9df){if(_0x5bdd0a){return _0x1f0e8b(_0x5bdd0a);}pm2[_0x5c32('0x6')]();return _0x1dc8c4(_0x2ec9df);});});});};exports[_0x5c32('0xc')]=function(){return connect()[_0x5c32('0x5')](function(){return new BPromise(function(_0x3803d5,_0x246851){return pm2[_0x5c32('0xc')](function(_0xd6aa78){if(_0xd6aa78){return _0x246851(_0xd6aa78);}return _0x3803d5(_0x5c32('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 7385422..7f62523 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 _0x8ff4=['../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../config/environment'];(function(_0x247cb6,_0x136177){var _0x554363=function(_0x5c981f){while(--_0x5c981f){_0x247cb6['push'](_0x247cb6['shift']());}};_0x554363(++_0x136177);}(_0x8ff4,0xeb));var _0x48ff=function(_0x1d8d9e,_0x20b77b){_0x1d8d9e=_0x1d8d9e-0x0;var _0x151b9d=_0x8ff4[_0x1d8d9e];return _0x151b9d;};'use strict';var _=require(_0x48ff('0x0'));var moment=require(_0x48ff('0x1'));var Redis=require(_0x48ff('0x2'));var util=require(_0x48ff('0x3'));var config=require(_0x48ff('0x4'));var db=require(_0x48ff('0x5'))['db'];var logger=require(_0x48ff('0x6'))(_0x48ff('0x7'));config[_0x48ff('0x8')]=_[_0x48ff('0x9')](config[_0x48ff('0x8')],{'host':_0x48ff('0xa'),'port':0x18eb});var io=require(_0x48ff('0xb'))(new Redis(config[_0x48ff('0x8')]));function closeInteractions(){var _0x5485be=0x0;var _0x2b4828=[];return db[_0x48ff('0xc')]['find']({'raw':!![],'attributes':['id',_0x48ff('0xd')],'where':{'id':0x1}})[_0x48ff('0xe')](function(_0x43a33e){_0x5485be=_0x43a33e[_0x48ff('0xd')];if(_0x5485be){return db[_0x48ff('0xf')]['findAll']({'raw':!![],'attributes':['id',_0x48ff('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x48ff('0x11')](_0x43a33e[_0x48ff('0xd')],'minutes')}}});}else{return[];}})[_0x48ff('0xe')](function(_0x56fde2){if(_0x56fde2&&_0x56fde2[_0x48ff('0x12')]){_0x2b4828=_[_0x48ff('0x13')](_0x56fde2||[],'id');logger[_0x48ff('0x14')](_0x48ff('0x15'),_0x2b4828[_0x48ff('0x16')]());return db[_0x48ff('0xf')][_0x48ff('0x17')]({'closeReason':_0x48ff('0x18'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x48ff('0x19')](_0x48ff('0x1a'))},{'where':{'id':_0x2b4828}});}})[_0x48ff('0xe')](function(){if(_0x2b4828&&_0x2b4828[_0x48ff('0x12')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2b4828[_0x48ff('0x16')]());for(var _0x449334=0x0;_0x449334<_0x2b4828[_0x48ff('0x12')];_0x449334++){io['emit'](_0x48ff('0x1b'),{'id':_0x2b4828[_0x449334],'closed':!![]});}}})['catch'](function(_0x2e8c28){logger[_0x48ff('0x1c')](_0x48ff('0x1d'),_0x2e8c28?util['inspect'](_0x2e8c28,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd7da=['YYYY-MM-DD\x20HH:mm:ss','info','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xd7da,0xc7));var _0xad7d=function(_0x509d2e,_0x307fde){_0x509d2e=_0x509d2e-0x0;var _0x292a85=_0xd7da[_0x509d2e];return _0x292a85;};'use strict';var _=require('lodash');var moment=require(_0xad7d('0x0'));var Redis=require(_0xad7d('0x1'));var util=require(_0xad7d('0x2'));var config=require(_0xad7d('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xad7d('0x4'));config['redis']=_[_0xad7d('0x5')](config[_0xad7d('0x6')],{'host':_0xad7d('0x7'),'port':0x18eb});var io=require(_0xad7d('0x8'))(new Redis(config[_0xad7d('0x6')]));function closeInteractions(){var _0x128638=0x0;var _0x2b481d=[];return db[_0xad7d('0x9')][_0xad7d('0xa')]({'raw':!![],'attributes':['id',_0xad7d('0xb')],'where':{'id':0x1}})[_0xad7d('0xc')](function(_0xe852a7){_0x128638=_0xe852a7[_0xad7d('0xb')];if(_0x128638){return db[_0xad7d('0xd')][_0xad7d('0xe')]({'raw':!![],'attributes':['id',_0xad7d('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xad7d('0x10')](_0xe852a7[_0xad7d('0xb')],_0xad7d('0x11'))}}});}else{return[];}})['then'](function(_0x1af9a4){if(_0x1af9a4&&_0x1af9a4[_0xad7d('0x12')]){_0x2b481d=_[_0xad7d('0x13')](_0x1af9a4||[],'id');logger['info'](_0xad7d('0x14'),_0x2b481d[_0xad7d('0x15')]());return db['ChatInteraction'][_0xad7d('0x16')]({'closeReason':'system','disposition':_0xad7d('0x17'),'closed':!![],'closedAt':moment()[_0xad7d('0x18')](_0xad7d('0x19'))},{'where':{'id':_0x2b481d}});}})[_0xad7d('0xc')](function(){if(_0x2b481d&&_0x2b481d[_0xad7d('0x12')]){logger[_0xad7d('0x1a')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2b481d[_0xad7d('0x15')]());for(var _0x456519=0x0;_0x456519<_0x2b481d['length'];_0x456519++){io['emit'](_0xad7d('0x1b'),{'id':_0x2b481d[_0x456519],'closed':!![]});}}})['catch'](function(_0x136903){logger[_0xad7d('0x1c')](_0xad7d('0x1d'),_0x136903?util[_0xad7d('0x1e')](_0x136903,{'showHidden':![],'depth':null}):'');});}exports[_0xad7d('0x1f')]=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 c7bf76b..83c218a 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 _0xae4b=['exports'];(function(_0x4fed27,_0x1176c8){var _0xd02ec4=function(_0xd7db1c){while(--_0xd7db1c){_0x4fed27['push'](_0x4fed27['shift']());}};_0xd02ec4(++_0x1176c8);}(_0xae4b,0x113));var _0xbae4=function(_0x214752,_0x584ace){_0x214752=_0x214752-0x0;var _0x37d7b9=_0xae4b[_0x214752];return _0x37d7b9;};'use strict';function start(){var _0x131a2a=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x131a2a['startAllRefreshIntervals']();}module[_0xbae4('0x0')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x15e6=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x8d1a10,_0x543d92){var _0x53661e=function(_0x357374){while(--_0x357374){_0x8d1a10['push'](_0x8d1a10['shift']());}};_0x53661e(++_0x543d92);}(_0x15e6,0xf6));var _0x615e=function(_0x4f7418,_0x1755cc){_0x4f7418=_0x4f7418-0x0;var _0x4afe7e=_0x15e6[_0x4f7418];return _0x4afe7e;};'use strict';function start(){var _0x29ae57=require(_0x615e('0x0'));return _0x29ae57['startAllRefreshIntervals']();}module[_0x615e('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 5dd2c96..4ba4ffe 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 _0x74e3=['extname','zip','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Sent','text','empty\x20file,\x20email\x20not\x20sent','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','email\x20sent','catch','error\x20mail','case\x20loading','currentAttempt','retryOptions','job','data','stop','operation','still\x20loading','case\x20completed','case\x20empty','case\x20failed','dataValues','attempt','Job\x20ID\x20','sendMail','email','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','Schedule','findAll','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','run','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','number','AnalyticExtractedReport','findOne','then','error','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x74e3,0xb4));var _0x374e=function(_0x1f5bdf,_0x3a25ea){_0x1f5bdf=_0x1f5bdf-0x0;var _0x4ca8f1=_0x74e3[_0x1f5bdf];return _0x4ca8f1;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x374e('0x0'));var _=require(_0x374e('0x1'));var moment=require('moment');var CronJobManager=require(_0x374e('0x2'));var jayson=require(_0x374e('0x3'));var BPromise=require(_0x374e('0x4'));var logger=require(_0x374e('0x5'))(_0x374e('0x6'));var db=require(_0x374e('0x7'))['db'];const retry=require(_0x374e('0x8'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x374e('0x9'));var client=jayson['client'][_0x374e('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x182a67){const _0x2342be={};if(typeof _0x182a67===_0x374e('0xb')){_0x2342be['id']=_0x182a67;}return db[_0x374e('0xc')][_0x374e('0xd')]({'where':_0x2342be})[_0x374e('0xe')](function(_0x465e7e){return _0x465e7e;})['catch'](function(_0x2930b9){logger[_0x374e('0xf')](_0x2930b9);});}function handleSendEmail(_0x28d97e,_0x5f155a){logger[_0x374e('0x10')](_0x374e('0x11'),_0x28d97e['email']);var _0x4d39dd=!![];var _0x3548f6=_0x28d97e[_0x374e('0x12')][_0x374e('0x13')]();var _0x1104cf={'account':_0x3548f6,'message':{'from':util[_0x374e('0x14')](_0x374e('0x15'),_0x28d97e[_0x374e('0x12')][_0x374e('0x16')],_0x28d97e[_0x374e('0x12')]['email']||_0x28d97e[_0x374e('0x12')][_0x374e('0x17')]['user']),'to':_0x28d97e['email'],'cc':_0x28d97e['cc'],'bcc':_0x28d97e[_0x374e('0x18')],'subject':util[_0x374e('0x14')]('Report\x20%s\x20last\x20%s\x20%s',_0x5f155a['name'],_0x28d97e[_0x374e('0x19')],_0x28d97e[_0x374e('0x1a')])}};var _0x521c03=path[_0x374e('0x1b')](__dirname,_0x374e('0x1c'));var _0x5070da=_0x5f155a[_0x374e('0x1d')];var _0x46b920=util[_0x374e('0x14')](_0x374e('0x1e'),path[_0x374e('0x1f')](_0x5f155a[_0x374e('0x1d')],path[_0x374e('0x20')](_0x5f155a[_0x374e('0x1d')])),_0x374e('0x21'));var _0x28e339=path[_0x374e('0x1b')](_0x521c03,_0x5070da);var _0xc469d=path['join'](_0x521c03,_0x46b920);if(fs['existsSync'](_0x28e339)){_0x5f155a[_0x374e('0x22')]='Sent';_0x1104cf[_0x374e('0x23')][_0x374e('0x24')]=[{'filename':_0x5070da,'path':_0x28e339}];_0x1104cf[_0x374e('0x23')]['text']=util['format'](_0x374e('0x25'),JSON[_0x374e('0x26')](_0x5f155a,null,0x2));}else if(fs[_0x374e('0x27')](_0xc469d)){_0x5f155a['status']=_0x374e('0x28');_0x1104cf['message'][_0x374e('0x24')]=[{'filename':_0x46b920,'path':_0xc469d}];}else{if(_0x5f155a[_0x374e('0x22')]==='Empty'){_0x1104cf[_0x374e('0x23')][_0x374e('0x29')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x28d97e['sendIfEmpty']){_0x4d39dd=![];logger[_0x374e('0x10')](_0x374e('0x2a'));}}else if(_0x5f155a[_0x374e('0x22')]==='Loading'){_0x1104cf['message'][_0x374e('0x29')]=_0x374e('0x2b');}else if(_0x5f155a[_0x374e('0x22')]===_0x374e('0x2c')){_0x1104cf[_0x374e('0x23')][_0x374e('0x29')]=_0x374e('0x2d');}else if(_0x5f155a['status']===_0x374e('0x2e')){_0x1104cf[_0x374e('0x23')][_0x374e('0x29')]=_0x374e('0x2f');}else{logger[_0x374e('0xf')](_0x374e('0x30'),_0x5f155a[_0x374e('0x22')]);}}if(_0x4d39dd){return client[_0x374e('0x31')](_0x374e('0x32'),_0x1104cf)['then'](function(_0x2ab176){if(_0x2ab176[_0x374e('0xf')]){return logger['error']('error\x20mail',JSON[_0x374e('0x26')](_0x2ab176));}return logger[_0x374e('0x10')](_0x374e('0x33'));})[_0x374e('0x34')](function(_0x4a0cb2){return logger[_0x374e('0xf')](_0x374e('0x35'),JSON['stringify'](_0x4a0cb2));});}}function handleError(){return function(_0x5052f1){return logger[_0x374e('0xf')](JSON[_0x374e('0x26')](_0x5052f1));};}function loading(_0x479c99){logger[_0x374e('0x10')](_0x374e('0x36'));if(_0x479c99[_0x374e('0x37')]===_0x479c99[_0x374e('0x38')]['retries']){handleSendEmail(_0x479c99[_0x374e('0x39')],_0x479c99[_0x374e('0x3a')]);_0x479c99['operation'][_0x374e('0x3b')]();}else{_0x479c99[_0x374e('0x3c')][_0x374e('0x8')](_0x374e('0x3d'));}}function completed(_0x2f53d2){logger[_0x374e('0x10')](_0x374e('0x3e'));handleSendEmail(_0x2f53d2[_0x374e('0x39')],_0x2f53d2['data']);_0x2f53d2[_0x374e('0x3c')][_0x374e('0x3b')]();}function empty(_0x4348e7){logger[_0x374e('0x10')](_0x374e('0x3f'));handleSendEmail(_0x4348e7[_0x374e('0x39')],_0x4348e7[_0x374e('0x3a')]);_0x4348e7[_0x374e('0x3c')][_0x374e('0x3b')]();}function failed(_0x2e3690){logger['info'](_0x374e('0x40'));handleSendEmail(_0x2e3690[_0x374e('0x39')],_0x2e3690[_0x374e('0x3a')]);_0x2e3690['operation'][_0x374e('0x3b')]();}function urecognized(_0x226fce){logger[_0x374e('0xf')]('Unrecognized\x20status:',_0x226fce['entity'][_0x374e('0x41')][_0x374e('0x22')]);_0x226fce[_0x374e('0x3c')][_0x374e('0x3b')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x1f66a1,_0x1da698){const _0x200046={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x376de2=retry[_0x374e('0x3c')](_0x200046);_0x376de2[_0x374e('0x42')](_0x442161=>{logger[_0x374e('0x10')](_0x374e('0x43')+_0x1f66a1['id']+'\x20Attempt\x20#:'+_0x442161);try{getReportData(_0x1da698['id'])[_0x374e('0xe')](function(_0x567bef){_0x1da698=_0x567bef;logger[_0x374e('0x10')]('report\x20status:',_0x567bef[_0x374e('0x41')][_0x374e('0x22')]);if(!reportStatusStrategies[_0x567bef[_0x374e('0x41')][_0x374e('0x22')]]){logger['error']('report\x20status:',_0x567bef[_0x374e('0x41')][_0x374e('0x22')]);_0x376de2[_0x374e('0x8')]();}reportStatusStrategies[_0x567bef[_0x374e('0x41')]['status']]({'operation':_0x376de2,'currentAttempt':_0x442161,'retryOptions':_0x200046,'job':_0x1f66a1,'data':_0x1da698,'entity':_0x567bef});});}catch(_0x50a29e){_0x376de2[_0x374e('0x8')](_0x50a29e);}});}function handleResult(_0x3d6fbe){return function(_0x3711c4){if(_0x3d6fbe[_0x374e('0x44')]&&_0x3d6fbe[_0x374e('0x12')]&&_0x3d6fbe[_0x374e('0x12')][_0x374e('0x17')]&&!_['isNil'](_0x3d6fbe[_0x374e('0x45')])){retryer(_0x3d6fbe,_0x3711c4);}};}function handleJob(_0x369c00){return function(){try{if(_[_0x374e('0x46')](_0x369c00['subtractNumber'])){return logger['info'](_0x374e('0x47'));}if(_[_0x374e('0x46')](_0x369c00['subtractUnit'])){return logger[_0x374e('0x10')](_0x374e('0x48'));}var _0x3ce58f={'startDate':moment()[_0x374e('0x49')](_0x369c00[_0x374e('0x19')],_0x369c00['subtractUnit'])[_0x374e('0x14')](_0x374e('0x4a')),'endDate':moment()[_0x374e('0x14')](_0x374e('0x4a')),'type':_0x374e('0x4b'),'output':_0x369c00[_0x374e('0x4c')],'name':_0x369c00[_0x374e('0x16')]};if(!_[_0x374e('0x46')](_0x369c00['DefaultReportId'])){logger[_0x374e('0x10')](_0x374e('0x4d'),_0x369c00[_0x374e('0x4e')]);return analyticDefaultReportController[_0x374e('0x4f')]({'id':_0x369c00['DefaultReportId']},_0x3ce58f)[_0x374e('0xe')](handleResult(_0x369c00))['catch'](handleError());}if(!_[_0x374e('0x46')](_0x369c00[_0x374e('0x50')])){logger[_0x374e('0x10')]('exec\x20custom\x20report\x20id:%s',_0x369c00[_0x374e('0x50')]);return analyticCustomReportController[_0x374e('0x4f')]({'id':_0x369c00[_0x374e('0x50')]},_0x3ce58f)[_0x374e('0xe')](handleResult(_0x369c00))[_0x374e('0x34')](handleError());}}catch(_0x4e541d){logger[_0x374e('0xf')](JSON['stringify'](_0x4e541d));}return logger[_0x374e('0x10')]('no\x20report\x20id');};}function getJobs(_0x4ac67f){var _0x55632e={};if(_0x4ac67f){_0x55632e['id']=_0x4ac67f;}return db[_0x374e('0x51')][_0x374e('0x52')]({'where':_0x55632e,'include':[{'model':db['MailAccount'],'attributes':['id',_0x374e('0x16'),_0x374e('0x45')],'include':[{'model':db['MailServerOut'],'as':_0x374e('0x17'),'include':[{'model':db[_0x374e('0x53')],'as':_0x374e('0x53')}]}]}]})[_0x374e('0xe')](function(_0x22a1b5){var _0xaf466b=_[_0x374e('0x54')](manager[_0x374e('0x55')]);var _0x4fa058=_[_0x374e('0x56')](_0x22a1b5,function(_0x13b67c){return _0x13b67c['id'][_0x374e('0x57')]();});var _0xa72db6=_[_0x374e('0x58')](_0x22a1b5,function(_0x4d7e3d){return _0x4d7e3d['id']['toString']();});var _0x238649=_0x4ac67f?_0x4fa058:_[_0x374e('0x59')](_0x4fa058,_0xaf466b);var _0x2f61f4=_[_0x374e('0x5a')](_0x4fa058,_0xaf466b);var _0x55a265=_[_0x374e('0x59')](_0xaf466b,_0x4fa058);var _0x15c9c4;var _0x45a644;for(_0x15c9c4=0x0;_0x15c9c4<_0x55a265[_0x374e('0x5b')]&&!_0x4ac67f;_0x15c9c4+=0x1){_0x45a644=_0x55a265[_0x15c9c4][_0x374e('0x57')]();if(manager[_0x374e('0x5c')](_0x45a644)){manager['stop'](_0x45a644);manager[_0x374e('0x5d')](_0x45a644);logger[_0x374e('0x10')](_0x374e('0x5e'),_0x45a644);}}logger[_0x374e('0x10')](_0x374e('0x5f'),JSON['stringify'](_0x238649));for(_0x15c9c4=0x0;_0x15c9c4<_0x238649[_0x374e('0x5b')];_0x15c9c4+=0x1){_0x45a644=_0x238649[_0x15c9c4][_0x374e('0x57')]();if(_0x4ac67f){logger[_0x374e('0x10')](JSON[_0x374e('0x26')](_0xa72db6[_0x45a644]));BPromise['resolve']()[_0x374e('0xe')](handleJob(_0xa72db6[_0x45a644]));logger[_0x374e('0x10')]('run\x20job',_0xa72db6[_0x45a644]['name'],_0xa72db6[_0x45a644][_0x374e('0x60')]);}else if(_0xa72db6[_0x45a644]['cron']&&_0xa72db6[_0x45a644][_0x374e('0x61')]&&moment()[_0x374e('0x62')](_0xa72db6[_0x45a644][_0x374e('0x63')],_0xa72db6[_0x45a644][_0x374e('0x64')])){manager[_0x374e('0x65')](_0x45a644,_0xa72db6[_0x45a644][_0x374e('0x60')],handleJob(_0xa72db6[_0x45a644]));manager[_0x374e('0x66')](_0x45a644);logger['info'](_0x374e('0x67'),_0xa72db6[_0x45a644][_0x374e('0x16')],_0xa72db6[_0x45a644][_0x374e('0x60')]);}else if(manager[_0x374e('0x5c')](_0x45a644)){manager['stop'](_0x45a644);manager[_0x374e('0x5d')](_0x45a644);logger[_0x374e('0x10')](_0x374e('0x68'),_0xa72db6[_0x45a644][_0x374e('0x16')],_0xa72db6[_0x45a644][_0x374e('0x60')]);}}for(_0x15c9c4=0x0,_0x45a644;_0x15c9c4<_0x2f61f4['length']&&!_0x4ac67f;_0x15c9c4+=0x1){_0x45a644=_0x2f61f4[_0x15c9c4][_0x374e('0x57')]();if(manager[_0x374e('0x5c')](_0x45a644)){if(_0xa72db6[_0x45a644]['cron']&&_0xa72db6[_0x45a644][_0x374e('0x61')]&&moment()[_0x374e('0x62')](_0xa72db6[_0x45a644][_0x374e('0x63')],_0xa72db6[_0x45a644][_0x374e('0x64')])){manager['update'](_0x45a644,_0xa72db6[_0x45a644][_0x374e('0x60')],handleJob(_0xa72db6[_0x45a644]));logger[_0x374e('0x10')]('update\x20cron',_0xa72db6[_0x45a644]['name'],_0xa72db6[_0x45a644]['cron']);}else{manager[_0x374e('0x3b')](_0x45a644);manager['deleteJob'](_0x45a644);logger[_0x374e('0x10')](_0x374e('0x68'),_0xa72db6[_0x45a644][_0x374e('0x16')],_0xa72db6[_0x45a644]['cron']);}}}})[_0x374e('0x34')](function(_0x5d8af2){logger[_0x374e('0xf')](JSON[_0x374e('0x26')](_0x5d8af2));});}exports[_0x374e('0x69')]=function(_0x2cb072){return getJobs(_0x2cb072);};exports[_0x374e('0x66')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xa6e7=['request','SendMail','email\x20sent','case\x20loading','currentAttempt','retryOptions','retries','job','data','stop','operation','still\x20loading','case\x20completed','case\x20failed','Unrecognized\x20status:','entity','dataValues','attempt','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','run\x20job','cron','active','isBetween','endAt','add','add\x20cron','stop\x20cron','startAt','update','update\x20cron','run','util','path','lodash','moment','bluebird','../logger','schedule','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','findOne','then','catch','error','info','MailAccount','getSmtpOptions','format','name','email','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','status','Sent','attachments','message','stringify','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','text','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa6e7,0x191));var _0x7a6e=function(_0x1c709d,_0x5ec06f){_0x1c709d=_0x1c709d-0x0;var _0x4976a4=_0xa6e7[_0x1c709d];return _0x4976a4;};'use strict';var fs=require('fs');var util=require(_0x7a6e('0x0'));var path=require(_0x7a6e('0x1'));var _=require(_0x7a6e('0x2'));var moment=require(_0x7a6e('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0x7a6e('0x4'));var logger=require(_0x7a6e('0x5'))(_0x7a6e('0x6'));var db=require('../../mysqldb')['db'];const retry=require(_0x7a6e('0x7'));var analyticCustomReportController=require(_0x7a6e('0x8'));var analyticDefaultReportController=require(_0x7a6e('0x9'));var client=jayson[_0x7a6e('0xa')][_0x7a6e('0xb')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x55c353){const _0x46ecaa={};if(typeof _0x55c353===_0x7a6e('0xc')){_0x46ecaa['id']=_0x55c353;}return db['AnalyticExtractedReport'][_0x7a6e('0xd')]({'where':_0x46ecaa})[_0x7a6e('0xe')](function(_0x455d9d){return _0x455d9d;})[_0x7a6e('0xf')](function(_0x510716){logger[_0x7a6e('0x10')](_0x510716);});}function handleSendEmail(_0x169e1e,_0x3cf480){logger[_0x7a6e('0x11')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x169e1e['email']);var _0x2fc5aa=!![];var _0x5162bf=_0x169e1e[_0x7a6e('0x12')][_0x7a6e('0x13')]();var _0x4c8f34={'account':_0x5162bf,'message':{'from':util[_0x7a6e('0x14')]('\x22%s\x22\x20<%s>',_0x169e1e[_0x7a6e('0x12')][_0x7a6e('0x15')],_0x169e1e[_0x7a6e('0x12')][_0x7a6e('0x16')]||_0x169e1e['MailAccount'][_0x7a6e('0x17')][_0x7a6e('0x18')]),'to':_0x169e1e[_0x7a6e('0x16')],'cc':_0x169e1e['cc'],'bcc':_0x169e1e[_0x7a6e('0x19')],'subject':util[_0x7a6e('0x14')](_0x7a6e('0x1a'),_0x3cf480[_0x7a6e('0x15')],_0x169e1e[_0x7a6e('0x1b')],_0x169e1e[_0x7a6e('0x1c')])}};var _0x4e26e4=path[_0x7a6e('0x1d')](__dirname,_0x7a6e('0x1e'));var _0x31dbc7=_0x3cf480[_0x7a6e('0x1f')];var _0x4ffcac=util[_0x7a6e('0x14')](_0x7a6e('0x20'),path[_0x7a6e('0x21')](_0x3cf480['savename'],path[_0x7a6e('0x22')](_0x3cf480[_0x7a6e('0x1f')])),'zip');var _0x583ec2=path[_0x7a6e('0x1d')](_0x4e26e4,_0x31dbc7);var _0x597945=path[_0x7a6e('0x1d')](_0x4e26e4,_0x4ffcac);if(fs[_0x7a6e('0x23')](_0x583ec2)){_0x3cf480[_0x7a6e('0x24')]=_0x7a6e('0x25');_0x4c8f34['message'][_0x7a6e('0x26')]=[{'filename':_0x31dbc7,'path':_0x583ec2}];_0x4c8f34[_0x7a6e('0x27')]['text']=util[_0x7a6e('0x14')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x7a6e('0x28')](_0x3cf480,null,0x2));}else if(fs[_0x7a6e('0x23')](_0x597945)){_0x3cf480[_0x7a6e('0x24')]=_0x7a6e('0x25');_0x4c8f34['message'][_0x7a6e('0x26')]=[{'filename':_0x4ffcac,'path':_0x597945}];}else{if(_0x3cf480['status']===_0x7a6e('0x29')){_0x4c8f34[_0x7a6e('0x27')]['text']=_0x7a6e('0x2a');if(!_0x169e1e[_0x7a6e('0x2b')]){_0x2fc5aa=![];logger['info'](_0x7a6e('0x2c'));}}else if(_0x3cf480['status']===_0x7a6e('0x2d')){_0x4c8f34[_0x7a6e('0x27')][_0x7a6e('0x2e')]=_0x7a6e('0x2f');}else if(_0x3cf480['status']===_0x7a6e('0x30')){_0x4c8f34[_0x7a6e('0x27')][_0x7a6e('0x2e')]=_0x7a6e('0x31');}else if(_0x3cf480[_0x7a6e('0x24')]==='Failed'){_0x4c8f34['message'][_0x7a6e('0x2e')]=_0x7a6e('0x32');}else{logger[_0x7a6e('0x10')]('[handleSendEmail]\x20Unrecognized\x20status:',_0x3cf480['status']);}}if(_0x2fc5aa){return client[_0x7a6e('0x33')](_0x7a6e('0x34'),_0x4c8f34)[_0x7a6e('0xe')](function(_0x387685){if(_0x387685[_0x7a6e('0x10')]){return logger[_0x7a6e('0x10')]('error\x20mail',JSON['stringify'](_0x387685));}return logger[_0x7a6e('0x11')](_0x7a6e('0x35'));})[_0x7a6e('0xf')](function(_0x3e1adc){return logger[_0x7a6e('0x10')]('error\x20mail',JSON[_0x7a6e('0x28')](_0x3e1adc));});}}function handleError(){return function(_0x1ed41d){return logger[_0x7a6e('0x10')](JSON[_0x7a6e('0x28')](_0x1ed41d));};}function loading(_0x26cdd2){logger['info'](_0x7a6e('0x36'));if(_0x26cdd2[_0x7a6e('0x37')]===_0x26cdd2[_0x7a6e('0x38')][_0x7a6e('0x39')]){handleSendEmail(_0x26cdd2[_0x7a6e('0x3a')],_0x26cdd2[_0x7a6e('0x3b')]);_0x26cdd2['operation'][_0x7a6e('0x3c')]();}else{_0x26cdd2[_0x7a6e('0x3d')][_0x7a6e('0x7')](_0x7a6e('0x3e'));}}function completed(_0x3da072){logger['info'](_0x7a6e('0x3f'));handleSendEmail(_0x3da072[_0x7a6e('0x3a')],_0x3da072[_0x7a6e('0x3b')]);_0x3da072[_0x7a6e('0x3d')]['stop']();}function empty(_0x5b745c){logger['info']('case\x20empty');handleSendEmail(_0x5b745c[_0x7a6e('0x3a')],_0x5b745c[_0x7a6e('0x3b')]);_0x5b745c['operation'][_0x7a6e('0x3c')]();}function failed(_0x551972){logger[_0x7a6e('0x11')](_0x7a6e('0x40'));handleSendEmail(_0x551972[_0x7a6e('0x3a')],_0x551972[_0x7a6e('0x3b')]);_0x551972[_0x7a6e('0x3d')]['stop']();}function urecognized(_0xf3ed30){logger['error'](_0x7a6e('0x41'),_0xf3ed30[_0x7a6e('0x42')][_0x7a6e('0x43')][_0x7a6e('0x24')]);_0xf3ed30['operation'][_0x7a6e('0x3c')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x5d1c6a,_0x23a353){const _0x52b1dc={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x5a3737=retry['operation'](_0x52b1dc);_0x5a3737[_0x7a6e('0x44')](_0x2f506c=>{logger[_0x7a6e('0x11')](_0x7a6e('0x45')+_0x5d1c6a['id']+_0x7a6e('0x46')+_0x2f506c);try{getReportData(_0x23a353['id'])[_0x7a6e('0xe')](function(_0x401fe8){_0x23a353=_0x401fe8;logger[_0x7a6e('0x11')](_0x7a6e('0x47'),_0x401fe8['dataValues'][_0x7a6e('0x24')]);if(!reportStatusStrategies[_0x401fe8[_0x7a6e('0x43')][_0x7a6e('0x24')]]){logger['error']('report\x20status:',_0x401fe8['dataValues'][_0x7a6e('0x24')]);_0x5a3737[_0x7a6e('0x7')]();}reportStatusStrategies[_0x401fe8[_0x7a6e('0x43')]['status']]({'operation':_0x5a3737,'currentAttempt':_0x2f506c,'retryOptions':_0x52b1dc,'job':_0x5d1c6a,'data':_0x23a353,'entity':_0x401fe8});});}catch(_0x14ced8){_0x5a3737[_0x7a6e('0x7')](_0x14ced8);}});}function handleResult(_0x40b157){return function(_0x5d3da4){if(_0x40b157[_0x7a6e('0x48')]&&_0x40b157['MailAccount']&&_0x40b157[_0x7a6e('0x12')][_0x7a6e('0x17')]&&!_['isNil'](_0x40b157[_0x7a6e('0x16')])){retryer(_0x40b157,_0x5d3da4);}};}function handleJob(_0x1ff71d){return function(){try{if(_[_0x7a6e('0x49')](_0x1ff71d['subtractNumber'])){return logger[_0x7a6e('0x11')](_0x7a6e('0x4a'));}if(_[_0x7a6e('0x49')](_0x1ff71d[_0x7a6e('0x1c')])){return logger[_0x7a6e('0x11')](_0x7a6e('0x4b'));}var _0x50a628={'startDate':moment()[_0x7a6e('0x4c')](_0x1ff71d['subtractNumber'],_0x1ff71d[_0x7a6e('0x1c')])[_0x7a6e('0x14')](_0x7a6e('0x4d')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x7a6e('0x4e'),'output':_0x1ff71d[_0x7a6e('0x4f')],'name':_0x1ff71d['name']};if(!_[_0x7a6e('0x49')](_0x1ff71d['DefaultReportId'])){logger[_0x7a6e('0x11')](_0x7a6e('0x50'),_0x1ff71d[_0x7a6e('0x51')]);return analyticDefaultReportController[_0x7a6e('0x52')]({'id':_0x1ff71d['DefaultReportId']},_0x50a628)['then'](handleResult(_0x1ff71d))[_0x7a6e('0xf')](handleError());}if(!_[_0x7a6e('0x49')](_0x1ff71d[_0x7a6e('0x53')])){logger['info'](_0x7a6e('0x54'),_0x1ff71d[_0x7a6e('0x53')]);return analyticCustomReportController['runReport']({'id':_0x1ff71d[_0x7a6e('0x53')]},_0x50a628)[_0x7a6e('0xe')](handleResult(_0x1ff71d))[_0x7a6e('0xf')](handleError());}}catch(_0xef5757){logger[_0x7a6e('0x10')](JSON[_0x7a6e('0x28')](_0xef5757));}return logger[_0x7a6e('0x11')](_0x7a6e('0x55'));};}function getJobs(_0x4844ad){var _0x5307ca={};if(_0x4844ad){_0x5307ca['id']=_0x4844ad;}return db[_0x7a6e('0x56')][_0x7a6e('0x57')]({'where':_0x5307ca,'include':[{'model':db[_0x7a6e('0x12')],'attributes':['id','name',_0x7a6e('0x16')],'include':[{'model':db[_0x7a6e('0x58')],'as':_0x7a6e('0x17'),'include':[{'model':db['CloudProvider'],'as':_0x7a6e('0x59')}]}]}]})[_0x7a6e('0xe')](function(_0x5718e1){var _0x4820b7=_['keys'](manager[_0x7a6e('0x5a')]);var _0x424323=_[_0x7a6e('0x5b')](_0x5718e1,function(_0x364d94){return _0x364d94['id'][_0x7a6e('0x5c')]();});var _0x44c71e=_[_0x7a6e('0x5d')](_0x5718e1,function(_0x211c0b){return _0x211c0b['id'][_0x7a6e('0x5c')]();});var _0x391cae=_0x4844ad?_0x424323:_[_0x7a6e('0x5e')](_0x424323,_0x4820b7);var _0x9f3fa6=_[_0x7a6e('0x5f')](_0x424323,_0x4820b7);var _0x57d24f=_['difference'](_0x4820b7,_0x424323);var _0x1c3e56;var _0x3c51ad;for(_0x1c3e56=0x0;_0x1c3e56<_0x57d24f[_0x7a6e('0x60')]&&!_0x4844ad;_0x1c3e56+=0x1){_0x3c51ad=_0x57d24f[_0x1c3e56][_0x7a6e('0x5c')]();if(manager[_0x7a6e('0x61')](_0x3c51ad)){manager[_0x7a6e('0x3c')](_0x3c51ad);manager[_0x7a6e('0x62')](_0x3c51ad);logger['info'](_0x7a6e('0x63'),_0x3c51ad);}}logger[_0x7a6e('0x11')](_0x7a6e('0x64'),JSON[_0x7a6e('0x28')](_0x391cae));for(_0x1c3e56=0x0;_0x1c3e56<_0x391cae['length'];_0x1c3e56+=0x1){_0x3c51ad=_0x391cae[_0x1c3e56]['toString']();if(_0x4844ad){logger[_0x7a6e('0x11')](JSON[_0x7a6e('0x28')](_0x44c71e[_0x3c51ad]));BPromise['resolve']()[_0x7a6e('0xe')](handleJob(_0x44c71e[_0x3c51ad]));logger[_0x7a6e('0x11')](_0x7a6e('0x65'),_0x44c71e[_0x3c51ad][_0x7a6e('0x15')],_0x44c71e[_0x3c51ad][_0x7a6e('0x66')]);}else if(_0x44c71e[_0x3c51ad][_0x7a6e('0x66')]&&_0x44c71e[_0x3c51ad][_0x7a6e('0x67')]&&moment()[_0x7a6e('0x68')](_0x44c71e[_0x3c51ad]['startAt'],_0x44c71e[_0x3c51ad][_0x7a6e('0x69')])){manager[_0x7a6e('0x6a')](_0x3c51ad,_0x44c71e[_0x3c51ad][_0x7a6e('0x66')],handleJob(_0x44c71e[_0x3c51ad]));manager['start'](_0x3c51ad);logger['info'](_0x7a6e('0x6b'),_0x44c71e[_0x3c51ad][_0x7a6e('0x15')],_0x44c71e[_0x3c51ad][_0x7a6e('0x66')]);}else if(manager[_0x7a6e('0x61')](_0x3c51ad)){manager[_0x7a6e('0x3c')](_0x3c51ad);manager[_0x7a6e('0x62')](_0x3c51ad);logger[_0x7a6e('0x11')](_0x7a6e('0x6c'),_0x44c71e[_0x3c51ad][_0x7a6e('0x15')],_0x44c71e[_0x3c51ad][_0x7a6e('0x66')]);}}for(_0x1c3e56=0x0,_0x3c51ad;_0x1c3e56<_0x9f3fa6[_0x7a6e('0x60')]&&!_0x4844ad;_0x1c3e56+=0x1){_0x3c51ad=_0x9f3fa6[_0x1c3e56][_0x7a6e('0x5c')]();if(manager[_0x7a6e('0x61')](_0x3c51ad)){if(_0x44c71e[_0x3c51ad][_0x7a6e('0x66')]&&_0x44c71e[_0x3c51ad]['active']&&moment()[_0x7a6e('0x68')](_0x44c71e[_0x3c51ad][_0x7a6e('0x6d')],_0x44c71e[_0x3c51ad][_0x7a6e('0x69')])){manager[_0x7a6e('0x6e')](_0x3c51ad,_0x44c71e[_0x3c51ad][_0x7a6e('0x66')],handleJob(_0x44c71e[_0x3c51ad]));logger[_0x7a6e('0x11')](_0x7a6e('0x6f'),_0x44c71e[_0x3c51ad][_0x7a6e('0x15')],_0x44c71e[_0x3c51ad][_0x7a6e('0x66')]);}else{manager[_0x7a6e('0x3c')](_0x3c51ad);manager[_0x7a6e('0x62')](_0x3c51ad);logger[_0x7a6e('0x11')](_0x7a6e('0x6c'),_0x44c71e[_0x3c51ad][_0x7a6e('0x15')],_0x44c71e[_0x3c51ad][_0x7a6e('0x66')]);}}}})[_0x7a6e('0xf')](function(_0x23f3df){logger[_0x7a6e('0x10')](JSON[_0x7a6e('0x28')](_0x23f3df));});}exports[_0x7a6e('0x70')]=function(_0x74c143){return getJobs(_0x74c143);};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 8e5d24e..2e652b1 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 _0x9354=['SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','FAILED','FailureReason','resolve','tempSentiment','sentimentAccountId','Mixed','Neutral','catch','name'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x9354,0x96));var _0x4935=function(_0x466e57,_0x21b819){_0x466e57=_0x466e57-0x0;var _0x34df42=_0x9354[_0x466e57];return _0x34df42;};var _=require('lodash');var AWS=require(_0x4935('0x0'));var rp=require(_0x4935('0x1'));var util=require('util');var BPromise=require(_0x4935('0x2'));var db=require(_0x4935('0x3'))['db'];var logger=require(_0x4935('0x4'))(_0x4935('0x5'));function getTranscriptionJob(_0x5327fc,_0x46c7f9,_0x2d509b,_0x127226){return new Promise(function(_0x2d518a,_0x263864){var _0x2e47bd=new AWS[(_0x4935('0x6'))]({'accessKeyId':_0x46c7f9,'secretAccessKey':_0x5327fc,'region':_0x2d509b});_0x2e47bd[_0x4935('0x7')]({'TranscriptionJobName':_0x127226},function(_0x10793e,_0x4c9902){if(_0x10793e){return _0x263864(_0x10793e);}else{return _0x2d518a(_0x4c9902);}});});}function sentiment(_0x30c8b9,_0x47a44f,_0x2aac9a,_0x38de96,_0xd5b117){return new Promise(function(_0x22a83f,_0x261462){var _0x319b72=new AWS['Comprehend']({'accessKeyId':_0x47a44f,'secretAccessKey':_0x30c8b9,'region':_0x2aac9a});_0x319b72['detectSentiment']({'Text':_0x38de96,'LanguageCode':_0xd5b117[_0x4935('0x8')](0x0,0x2)},function(_0x53fa58,_0x4823d0){if(_0x53fa58){return _0x261462(_0x53fa58);}else{return _0x22a83f(_0x4823d0);}});});}function checkTranscribeJob(_0x3f6eef,_0x32916f,_0x3bb388){var _0x1c6c22;return new BPromise(function(_0x3b246a,_0x2bf1b3){logger[_0x4935('0x9')](util[_0x4935('0xa')](_0x4935('0xb'),_0x3f6eef['id'],_0x3f6eef[_0x4935('0xc')]));return getTranscriptionJob(_0x3bb388[_0x4935('0xd')],_0x3bb388[_0x4935('0xe')],_0x32916f[_0x4935('0xf')],_0x3f6eef[_0x4935('0xc')])[_0x4935('0x10')](function(_0x395a43){logger['info'](util[_0x4935('0xa')](_0x4935('0x11'),_0x3f6eef['id'],_0x3f6eef[_0x4935('0xc')],_0x395a43[_0x4935('0x12')][_0x4935('0x13')]));if(!_0x3f6eef[_0x4935('0x14')]){switch(_0x395a43['TranscriptionJob'][_0x4935('0x13')]){case _0x4935('0x15'):var _0x4fe356={'transcribeStatus':_0x395a43[_0x4935('0x12')][_0x4935('0x13')],'fileUri':_0x395a43[_0x4935('0x12')]['Transcript']['TranscriptFileUri']};logger[_0x4935('0x9')](util[_0x4935('0xa')](_0x4935('0x16'),_0x3f6eef['id']));return rp({'uri':_0x395a43[_0x4935('0x12')][_0x4935('0x17')][_0x4935('0x18')],'json':!![]})[_0x4935('0x10')](function(_0xe482a5){logger['info'](util[_0x4935('0xa')](_0x4935('0x19'),_0x3f6eef['id']));if(_0xe482a5&&_0xe482a5[_0x4935('0x1a')]&&_0xe482a5[_0x4935('0x1a')][_0x4935('0x1b')]&&_0xe482a5['results']['transcripts'][_0x4935('0x1c')]){_0x4fe356[_0x4935('0x14')]='';for(var _0x3786ff=0x0;_0x3786ff<_0xe482a5[_0x4935('0x1a')][_0x4935('0x1b')][_0x4935('0x1c')];_0x3786ff++){_0x4fe356[_0x4935('0x14')]+=_0xe482a5[_0x4935('0x1a')][_0x4935('0x1b')][_0x3786ff][_0x4935('0x1d')]+'';}}return _0x3f6eef[_0x4935('0x1e')](_0x4fe356);})[_0x4935('0x10')](function(){logger[_0x4935('0x9')](util[_0x4935('0xa')](_0x4935('0x1f'),_0x3f6eef['id']));if(!_0x3f6eef['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0x4935('0x20'));}if(!_0x32916f[_0x4935('0x21')]||!_0x32916f['sentimentAccountId']||!_0x32916f[_0x4935('0x22')]||!_0x32916f[_0x4935('0x23')]||!_0x32916f[_0x4935('0x24')]){throw new db[(_0x4935('0x25'))][(_0x4935('0x26'))](_0x4935('0x27'));}if(!_0x4fe356[_0x4935('0x14')]){throw new Error(_0x4935('0x28'));}if(_0x32916f['sentimentAccountId']===_0x3bb388['id']){return _0x3bb388;}else{return db[_0x4935('0x29')][_0x4935('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x3a504d){if(!_0x3a504d){throw new db['Sequelize'][(_0x4935('0x26'))](_0x4935('0x2b'));}if(!_0x3a504d[_0x4935('0xd')]||!_0x3a504d['data2']){throw new db['Sequelize'][(_0x4935('0x26'))](_0x4935('0x2c'));}_0x1c6c22=_0x3a504d;logger['info'](util[_0x4935('0xa')](_0x4935('0x2d'),_0x3f6eef['id']));return sentiment(_0x1c6c22[_0x4935('0xd')],_0x1c6c22[_0x4935('0xe')],_0x32916f[_0x4935('0x22')],_0x4fe356['fileText'],_0x32916f['language']);})[_0x4935('0x10')](function(_0x1016cc){logger['info'](util['format'](_0x4935('0x2e'),_0x3f6eef['id']));return _0x3f6eef['update']({'sentiment':_0x1016cc[_0x4935('0x2f')],'sPositive':_0x1016cc[_0x4935('0x30')][_0x4935('0x31')],'sNegative':_0x1016cc[_0x4935('0x30')][_0x4935('0x32')],'sMixed':_0x1016cc[_0x4935('0x30')]['Mixed'],'sNeutral':_0x1016cc[_0x4935('0x30')]['Neutral']});})[_0x4935('0x10')](function(){logger['info'](util[_0x4935('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3f6eef['id']));_0x3b246a();});case _0x4935('0x33'):return _0x3f6eef[_0x4935('0x1e')]({'transcribeStatus':_0x4935('0x33'),'failureReason':_0x395a43[_0x4935('0x12')][_0x4935('0x34')]})[_0x4935('0x10')](function(){logger[_0x4935('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3f6eef['id']));_0x3b246a();});default:logger[_0x4935('0x9')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x3f6eef['id']));break;}}else{return BPromise[_0x4935('0x35')]()['then'](function(){if(!_0x3f6eef[_0x4935('0x36')]){throw new db[(_0x4935('0x25'))][(_0x4935('0x26'))](_0x4935('0x20'));}if(!_0x32916f[_0x4935('0x21')]||!_0x32916f['sentimentAccountId']||!_0x32916f['sentimentRegion']||!_0x32916f[_0x4935('0x23')]||!_0x32916f[_0x4935('0x24')]){throw new db[(_0x4935('0x25'))][(_0x4935('0x26'))](_0x4935('0x27'));}if(!_0x3f6eef[_0x4935('0x14')]){throw new Error(_0x4935('0x28'));}if(_0x32916f[_0x4935('0x37')]===_0x3bb388['id']){return _0x3bb388;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x4935('0x37')]}});}})[_0x4935('0x10')](function(_0x493588){if(!_0x493588){throw new db[(_0x4935('0x25'))][(_0x4935('0x26'))](_0x4935('0x2b'));}if(!_0x493588[_0x4935('0xd')]||!_0x493588['data2']){throw new db['Sequelize'][(_0x4935('0x26'))](_0x4935('0x2c'));}_0x1c6c22=_0x493588;logger['info'](util[_0x4935('0xa')](_0x4935('0x2d'),_0x3f6eef['id']));return sentiment(_0x1c6c22[_0x4935('0xd')],_0x1c6c22['data2'],_0x32916f[_0x4935('0x22')],_0x3f6eef[_0x4935('0x14')],_0x32916f[_0x4935('0x23')]);})[_0x4935('0x10')](function(_0x2a4de2){logger[_0x4935('0x9')](util[_0x4935('0xa')](_0x4935('0x2e'),_0x3f6eef['id']));return _0x3f6eef[_0x4935('0x1e')]({'sentiment':_0x2a4de2[_0x4935('0x2f')],'sPositive':_0x2a4de2[_0x4935('0x30')][_0x4935('0x31')],'sNegative':_0x2a4de2[_0x4935('0x30')][_0x4935('0x32')],'sMixed':_0x2a4de2[_0x4935('0x30')][_0x4935('0x38')],'sNeutral':_0x2a4de2[_0x4935('0x30')][_0x4935('0x39')],'transcribeStatus':'COMPLETED'});})[_0x4935('0x10')](function(){logger['info'](util[_0x4935('0xa')](_0x4935('0x1f'),_0x3f6eef['id']));_0x3b246a();});}})[_0x4935('0x3a')](function(_0x33e94a){if(_0x33e94a){if(!_0x33e94a['name']||_0x33e94a[_0x4935('0x3b')]!==_0x4935('0x3c')){logger[_0x4935('0x3d')](util[_0x4935('0xa')](_0x4935('0x3e'),_0x3f6eef['id']),util[_0x4935('0x3f')](_0x33e94a,{'showHidden':![],'depth':null}));}}_0x3b246a();});});}function checkTranscribe(){var _0x1c42bb;var _0x31d137;var _0x29b932;return db[_0x4935('0x40')]['findAll']({'where':{'transcribeStatus':_0x4935('0x41')}})[_0x4935('0x10')](function(_0x5e0942){if(!_0x5e0942||!_0x5e0942[_0x4935('0x1c')]){throw new db[(_0x4935('0x25'))][(_0x4935('0x26'))](_0x4935('0x42'));}_0x1c42bb=_0x5e0942;return db[_0x4935('0x43')][_0x4935('0x2a')]({'where':{'id':0x1}});})[_0x4935('0x10')](function(_0x471fb1){if(!_0x471fb1){throw new db['Sequelize'][(_0x4935('0x26'))]('Settings\x20not\x20available');}_0x31d137=_0x471fb1;if(!_0x31d137['transcribe']||!_0x31d137[_0x4935('0x44')]||!_0x31d137[_0x4935('0xf')]||!_0x31d137[_0x4935('0x23')]||!_0x31d137[_0x4935('0x24')]){throw new db[(_0x4935('0x25'))]['ValidationError'](_0x4935('0x45'));}return db[_0x4935('0x29')][_0x4935('0x2a')]({'where':{'id':_0x31d137[_0x4935('0x44')]}});})[_0x4935('0x10')](function(_0x8196b4){if(!_0x8196b4){throw new db[(_0x4935('0x25'))][(_0x4935('0x26'))](_0x4935('0x2b'));}if(!_0x8196b4[_0x4935('0xd')]||!_0x8196b4['data2']){throw new db[(_0x4935('0x25'))]['ValidationError'](_0x4935('0x2c'));}_0x29b932=_0x8196b4;var _0xe08e62=[];_0x1c42bb['forEach'](function(_0x3daccd){_0xe08e62['push'](checkTranscribeJob(_0x3daccd,_0x31d137,_0x29b932));});return BPromise['all'](_0xe08e62);})['catch'](function(_0x126f53){if(_0x126f53){if(!_0x126f53[_0x4935('0x3b')]||_0x126f53[_0x4935('0x3b')]!==_0x4935('0x3c')){logger[_0x4935('0x3d')](util['inspect'](_0x126f53,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x9189=['forEach','push','catch','error','inspect','start','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentiment','language','ValidationError','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Sentiment\x20Analysis\x20not\x20configured','Mixed','name','SequelizeValidationError','VoiceRecording','Setting','Settings\x20not\x20available','transcribeAccountId','bucket','Transcribe\x20not\x20configured'];(function(_0x19c66d,_0xe8b995){var _0x481b75=function(_0x4b7674){while(--_0x4b7674){_0x19c66d['push'](_0x19c66d['shift']());}};_0x481b75(++_0xe8b995);}(_0x9189,0x1b0));var _0x9918=function(_0x364f11,_0x29e4f9){_0x364f11=_0x364f11-0x0;var _0x572994=_0x9189[_0x364f11];return _0x572994;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x9918('0x0'));var util=require(_0x9918('0x1'));var BPromise=require(_0x9918('0x2'));var db=require(_0x9918('0x3'))['db'];var logger=require('../../config/logger')(_0x9918('0x4'));function getTranscriptionJob(_0x568567,_0x4cb5a2,_0xfd91d2,_0x325957){return new Promise(function(_0x4a47d4,_0x3ba4a8){var _0x3cb556=new AWS[(_0x9918('0x5'))]({'accessKeyId':_0x4cb5a2,'secretAccessKey':_0x568567,'region':_0xfd91d2});_0x3cb556['getTranscriptionJob']({'TranscriptionJobName':_0x325957},function(_0x5a0552,_0x50a534){if(_0x5a0552){return _0x3ba4a8(_0x5a0552);}else{return _0x4a47d4(_0x50a534);}});});}function sentiment(_0x46bef9,_0x29daaa,_0x553c75,_0x21f0ff,_0x5c5853){return new Promise(function(_0xdf3f27,_0x1a3395){var _0x107c89=new AWS[(_0x9918('0x6'))]({'accessKeyId':_0x29daaa,'secretAccessKey':_0x46bef9,'region':_0x553c75});_0x107c89[_0x9918('0x7')]({'Text':_0x21f0ff,'LanguageCode':_0x5c5853[_0x9918('0x8')](0x0,0x2)},function(_0x911a98,_0x5175b1){if(_0x911a98){return _0x1a3395(_0x911a98);}else{return _0xdf3f27(_0x5175b1);}});});}function checkTranscribeJob(_0x334b55,_0x1a8f69,_0x548f67){var _0x511a2c;return new BPromise(function(_0x43fc75,_0x4b1833){logger['info'](util[_0x9918('0x9')](_0x9918('0xa'),_0x334b55['id'],_0x334b55['transcribeName']));return getTranscriptionJob(_0x548f67[_0x9918('0xb')],_0x548f67['data2'],_0x1a8f69[_0x9918('0xc')],_0x334b55[_0x9918('0xd')])[_0x9918('0xe')](function(_0x420db0){logger[_0x9918('0xf')](util[_0x9918('0x9')](_0x9918('0x10'),_0x334b55['id'],_0x334b55[_0x9918('0xd')],_0x420db0[_0x9918('0x11')][_0x9918('0x12')]));if(!_0x334b55[_0x9918('0x13')]){switch(_0x420db0[_0x9918('0x11')][_0x9918('0x12')]){case _0x9918('0x14'):var _0x1b6ea2={'transcribeStatus':_0x420db0[_0x9918('0x11')][_0x9918('0x12')],'fileUri':_0x420db0[_0x9918('0x11')][_0x9918('0x15')][_0x9918('0x16')]};logger[_0x9918('0xf')](util[_0x9918('0x9')](_0x9918('0x17'),_0x334b55['id']));return rp({'uri':_0x420db0[_0x9918('0x11')][_0x9918('0x15')][_0x9918('0x16')],'json':!![]})['then'](function(_0x2dc468){logger[_0x9918('0xf')](util[_0x9918('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x334b55['id']));if(_0x2dc468&&_0x2dc468[_0x9918('0x18')]&&_0x2dc468[_0x9918('0x18')][_0x9918('0x19')]&&_0x2dc468[_0x9918('0x18')][_0x9918('0x19')][_0x9918('0x1a')]){_0x1b6ea2[_0x9918('0x13')]='';for(var _0x216cc1=0x0;_0x216cc1<_0x2dc468[_0x9918('0x18')][_0x9918('0x19')][_0x9918('0x1a')];_0x216cc1++){_0x1b6ea2[_0x9918('0x13')]+=_0x2dc468[_0x9918('0x18')]['transcripts'][_0x216cc1][_0x9918('0x1b')]+'';}}return _0x334b55[_0x9918('0x1c')](_0x1b6ea2);})[_0x9918('0xe')](function(){logger[_0x9918('0xf')](util[_0x9918('0x9')](_0x9918('0x1d'),_0x334b55['id']));if(!_0x334b55[_0x9918('0x1e')]){throw new db[(_0x9918('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1a8f69[_0x9918('0x20')]||!_0x1a8f69['sentimentAccountId']||!_0x1a8f69['sentimentRegion']||!_0x1a8f69[_0x9918('0x21')]||!_0x1a8f69['bucket']){throw new db[(_0x9918('0x1f'))][(_0x9918('0x22'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1b6ea2['fileText']){throw new Error(_0x9918('0x23'));}if(_0x1a8f69[_0x9918('0x24')]===_0x548f67['id']){return _0x548f67;}else{return db[_0x9918('0x25')][_0x9918('0x26')]({'where':{'id':_settings[_0x9918('0x24')]}});}})['then'](function(_0x11d053){if(!_0x11d053){throw new db[(_0x9918('0x1f'))][(_0x9918('0x22'))](_0x9918('0x27'));}if(!_0x11d053[_0x9918('0xb')]||!_0x11d053['data2']){throw new db[(_0x9918('0x1f'))]['ValidationError'](_0x9918('0x28'));}_0x511a2c=_0x11d053;logger['info'](util[_0x9918('0x9')](_0x9918('0x29'),_0x334b55['id']));return sentiment(_0x511a2c[_0x9918('0xb')],_0x511a2c[_0x9918('0x2a')],_0x1a8f69[_0x9918('0x2b')],_0x1b6ea2[_0x9918('0x13')],_0x1a8f69[_0x9918('0x21')]);})[_0x9918('0xe')](function(_0x287459){logger['info'](util[_0x9918('0x9')](_0x9918('0x2c'),_0x334b55['id']));return _0x334b55[_0x9918('0x1c')]({'sentiment':_0x287459[_0x9918('0x2d')],'sPositive':_0x287459[_0x9918('0x2e')][_0x9918('0x2f')],'sNegative':_0x287459[_0x9918('0x2e')][_0x9918('0x30')],'sMixed':_0x287459['SentimentScore']['Mixed'],'sNeutral':_0x287459[_0x9918('0x2e')][_0x9918('0x31')]});})[_0x9918('0xe')](function(){logger[_0x9918('0xf')](util['format'](_0x9918('0x1d'),_0x334b55['id']));_0x43fc75();});case'FAILED':return _0x334b55[_0x9918('0x1c')]({'transcribeStatus':_0x9918('0x32'),'failureReason':_0x420db0[_0x9918('0x11')][_0x9918('0x33')]})['then'](function(){logger['info'](util[_0x9918('0x9')](_0x9918('0x1d'),_0x334b55['id']));_0x43fc75();});default:logger['info'](util[_0x9918('0x9')](_0x9918('0x34'),_0x334b55['id']));break;}}else{return BPromise[_0x9918('0x35')]()[_0x9918('0xe')](function(){if(!_0x334b55[_0x9918('0x1e')]){throw new db['Sequelize'][(_0x9918('0x22'))](_0x9918('0x36'));}if(!_0x1a8f69[_0x9918('0x20')]||!_0x1a8f69[_0x9918('0x24')]||!_0x1a8f69[_0x9918('0x2b')]||!_0x1a8f69[_0x9918('0x21')]||!_0x1a8f69['bucket']){throw new db[(_0x9918('0x1f'))][(_0x9918('0x22'))](_0x9918('0x37'));}if(!_0x334b55[_0x9918('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x1a8f69[_0x9918('0x24')]===_0x548f67['id']){return _0x548f67;}else{return db[_0x9918('0x25')][_0x9918('0x26')]({'where':{'id':_settings[_0x9918('0x24')]}});}})['then'](function(_0x852651){if(!_0x852651){throw new db['Sequelize'][(_0x9918('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x852651[_0x9918('0xb')]||!_0x852651[_0x9918('0x2a')]){throw new db['Sequelize'][(_0x9918('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x511a2c=_0x852651;logger[_0x9918('0xf')](util[_0x9918('0x9')](_0x9918('0x29'),_0x334b55['id']));return sentiment(_0x511a2c[_0x9918('0xb')],_0x511a2c[_0x9918('0x2a')],_0x1a8f69[_0x9918('0x2b')],_0x334b55['fileText'],_0x1a8f69[_0x9918('0x21')]);})[_0x9918('0xe')](function(_0x4db569){logger[_0x9918('0xf')](util[_0x9918('0x9')](_0x9918('0x2c'),_0x334b55['id']));return _0x334b55[_0x9918('0x1c')]({'sentiment':_0x4db569[_0x9918('0x2d')],'sPositive':_0x4db569['SentimentScore'][_0x9918('0x2f')],'sNegative':_0x4db569[_0x9918('0x2e')][_0x9918('0x30')],'sMixed':_0x4db569[_0x9918('0x2e')][_0x9918('0x38')],'sNeutral':_0x4db569[_0x9918('0x2e')][_0x9918('0x31')],'transcribeStatus':_0x9918('0x14')});})['then'](function(){logger[_0x9918('0xf')](util[_0x9918('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x334b55['id']));_0x43fc75();});}})['catch'](function(_0x49086c){if(_0x49086c){if(!_0x49086c[_0x9918('0x39')]||_0x49086c[_0x9918('0x39')]!==_0x9918('0x3a')){logger['error'](util[_0x9918('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x334b55['id']),util['inspect'](_0x49086c,{'showHidden':![],'depth':null}));}}_0x43fc75();});});}function checkTranscribe(){var _0xbb3800;var _0x5209a7;var _0x5ca79e;return db[_0x9918('0x3b')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x9918('0xe')](function(_0x3f94bf){if(!_0x3f94bf||!_0x3f94bf[_0x9918('0x1a')]){throw new db['Sequelize']['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0xbb3800=_0x3f94bf;return db[_0x9918('0x3c')][_0x9918('0x26')]({'where':{'id':0x1}});})[_0x9918('0xe')](function(_0x3a1106){if(!_0x3a1106){throw new db[(_0x9918('0x1f'))][(_0x9918('0x22'))](_0x9918('0x3d'));}_0x5209a7=_0x3a1106;if(!_0x5209a7[_0x9918('0x4')]||!_0x5209a7[_0x9918('0x3e')]||!_0x5209a7[_0x9918('0xc')]||!_0x5209a7[_0x9918('0x21')]||!_0x5209a7[_0x9918('0x3f')]){throw new db['Sequelize'][(_0x9918('0x22'))](_0x9918('0x40'));}return db[_0x9918('0x25')]['findOne']({'where':{'id':_0x5209a7[_0x9918('0x3e')]}});})[_0x9918('0xe')](function(_0x458c00){if(!_0x458c00){throw new db[(_0x9918('0x1f'))][(_0x9918('0x22'))](_0x9918('0x27'));}if(!_0x458c00[_0x9918('0xb')]||!_0x458c00['data2']){throw new db['Sequelize'][(_0x9918('0x22'))](_0x9918('0x28'));}_0x5ca79e=_0x458c00;var _0x4ee8dd=[];_0xbb3800[_0x9918('0x41')](function(_0x401abf){_0x4ee8dd[_0x9918('0x42')](checkTranscribeJob(_0x401abf,_0x5209a7,_0x5ca79e));});return BPromise['all'](_0x4ee8dd);})[_0x9918('0x43')](function(_0x1ec4f0){if(_0x1ec4f0){if(!_0x1ec4f0[_0x9918('0x39')]||_0x1ec4f0[_0x9918('0x39')]!=='SequelizeValidationError'){logger[_0x9918('0x44')](util[_0x9918('0x45')](_0x1ec4f0,{'showHidden':![],'depth':null}));}}});}exports[_0x9918('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 3cc505b..ca5cc9c 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 _0x9003=['hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','YYYY-MM-DD\x20HH:mm:ss','length','emit','whatsappInteraction:update','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt'];(function(_0xeda4ba,_0x4215d5){var _0x121c71=function(_0x43b17f){while(--_0x43b17f){_0xeda4ba['push'](_0xeda4ba['shift']());}};_0x121c71(++_0x4215d5);}(_0x9003,0x195));var _0x3900=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x9003[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x3900('0x0'));var moment=require('moment');var Redis=require(_0x3900('0x1'));var util=require(_0x3900('0x2'));var config=require('../../config/environment');var db=require(_0x3900('0x3'))['db'];var logger=require(_0x3900('0x4'))(_0x3900('0x5'));config[_0x3900('0x6')]=_['defaults'](config[_0x3900('0x6')],{'host':_0x3900('0x7'),'port':0x18eb});var io=require(_0x3900('0x8'))(new Redis(config[_0x3900('0x6')]));function closeInteractions(){var _0x49d3ec=[];return db[_0x3900('0x9')]['findAll']({'raw':!![],'attributes':['id',_0x3900('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x3900('0xb'))}}})[_0x3900('0xc')](function(_0x5cd685){if(_0x5cd685&&_0x5cd685['length']){_0x49d3ec=_[_0x3900('0xd')](_0x5cd685||[],'id');logger[_0x3900('0xe')](_0x3900('0xf'),_0x49d3ec[_0x3900('0x10')]());return db['WhatsappInteraction']['update']({'closeReason':_0x3900('0x11'),'disposition':_0x3900('0x12'),'closed':!![],'closedAt':moment()['format'](_0x3900('0x13'))},{'where':{'id':_0x49d3ec}});}})[_0x3900('0xc')](function(){if(_0x49d3ec&&_0x49d3ec['length']){logger[_0x3900('0xe')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x49d3ec[_0x3900('0x10')]());for(var _0x4edded=0x0;_0x4edded<_0x49d3ec[_0x3900('0x14')];_0x4edded++){io[_0x3900('0x15')](_0x3900('0x16'),{'id':_0x49d3ec[_0x4edded],'closed':!![]});}}})['catch'](function(_0x10086c){logger['error'](_0x3900('0x17'),_0x10086c?util[_0x3900('0x18')](_0x10086c,{'showHidden':![],'depth':null}):'');});}exports[_0x3900('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf893=['error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','socket.io-emitter','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','catch'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf893,0xf3));var _0x3f89=function(_0x289e5c,_0x2a08fb){_0x289e5c=_0x289e5c-0x0;var _0x464cb8=_0xf893[_0x289e5c];return _0x464cb8;};'use strict';var _=require(_0x3f89('0x0'));var moment=require(_0x3f89('0x1'));var Redis=require(_0x3f89('0x2'));var util=require(_0x3f89('0x3'));var config=require(_0x3f89('0x4'));var db=require(_0x3f89('0x5'))['db'];var logger=require(_0x3f89('0x6'))(_0x3f89('0x7'));config['redis']=_[_0x3f89('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3f89('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x117f1c=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x3f89('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x3f89('0xb')](0x18,_0x3f89('0xc'))}}})[_0x3f89('0xd')](function(_0x1c6cae){if(_0x1c6cae&&_0x1c6cae[_0x3f89('0xe')]){_0x117f1c=_[_0x3f89('0xf')](_0x1c6cae||[],'id');logger[_0x3f89('0x10')](_0x3f89('0x11'),_0x117f1c[_0x3f89('0x12')]());return db[_0x3f89('0x13')]['update']({'closeReason':_0x3f89('0x14'),'disposition':_0x3f89('0x15'),'closed':!![],'closedAt':moment()[_0x3f89('0x16')](_0x3f89('0x17'))},{'where':{'id':_0x117f1c}});}})[_0x3f89('0xd')](function(){if(_0x117f1c&&_0x117f1c['length']){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x117f1c[_0x3f89('0x12')]());for(var _0x3de146=0x0;_0x3de146<_0x117f1c['length'];_0x3de146++){io[_0x3f89('0x18')](_0x3f89('0x19'),{'id':_0x117f1c[_0x3de146],'closed':!![]});}}})[_0x3f89('0x1a')](function(_0x152799){logger[_0x3f89('0x1b')](_0x3f89('0x1c'),_0x152799?util[_0x3f89('0x1d')](_0x152799,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 3044de1..a52bade 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdae7=['Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','bulkCreate','log','CmHopper','hopper1','finished\x20populating','hopper2','catch','util','../mysqldb','push'];(function(_0x53d359,_0x1b3b59){var _0x2bb5af=function(_0x4a3297){while(--_0x4a3297){_0x53d359['push'](_0x53d359['shift']());}};_0x2bb5af(++_0x1b3b59);}(_0xdae7,0xf9));var _0x7dae=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0xdae7[_0xb83ec2];return _0x4d2fbf;};'use strict';var util=require(_0x7dae('0x0'));var db=require(_0x7dae('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7dae('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x7dae('0x3')+i,'phone':0xf879fb460+i,'email':_0x7dae('0x4')+i+_0x7dae('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7dae('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7dae('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7dae('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x7dae('0x7')+i,'lastName':_0x7dae('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7dae('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7dae('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7dae('0x6')](),'updatedAt':Date[_0x7dae('0x6')]()});}db[_0x7dae('0x8')][_0x7dae('0x9')]({'where':{}})[_0x7dae('0xa')](function(){return db['CmContact'][_0x7dae('0xb')](contacts);})[_0x7dae('0xa')](function(){console[_0x7dae('0xc')]('finished\x20populating','contacts1');return db[_0x7dae('0xd')][_0x7dae('0x9')]({'where':{}});})[_0x7dae('0xa')](function(){return db['CmHopper'][_0x7dae('0xb')](hopper);})[_0x7dae('0xa')](function(){console[_0x7dae('0xc')]('finished\x20populating',_0x7dae('0xe'));return db[_0x7dae('0x8')][_0x7dae('0xb')](contacts2);})['then'](function(){console[_0x7dae('0xc')](_0x7dae('0xf'),'contacts2');return db[_0x7dae('0xd')][_0x7dae('0xb')](hopper2);})['then'](function(){console[_0x7dae('0xc')](_0x7dae('0xf'),_0x7dae('0x10'));})[_0x7dae('0x11')](function(_0x3d4a81){console[_0x7dae('0xc')](_0x3d4a81);}); \ No newline at end of file +var _0x54ae=['@xcally.com','now','Biondo','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1','contacts2','catch','util','push','Innocenzo','innocenzo.biondo'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x54ae,0xf8));var _0xe54a=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x54ae[_0x1147ab];return _0x55cb5a;};'use strict';var util=require(_0xe54a('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe54a('0x1')]({'id':i,'firstName':_0xe54a('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xe54a('0x3')+i+_0xe54a('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe54a('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xe54a('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe54a('0x5')](),'updatedAt':Date[_0xe54a('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe54a('0x1')]({'id':i,'firstName':_0xe54a('0x2')+i,'lastName':_0xe54a('0x6')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xe54a('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xe54a('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe54a('0x5')](),'updatedAt':Date['now']()});}db[_0xe54a('0x7')][_0xe54a('0x8')]({'where':{}})[_0xe54a('0x9')](function(){return db[_0xe54a('0x7')][_0xe54a('0xa')](contacts);})['then'](function(){console['log'](_0xe54a('0xb'),_0xe54a('0xc'));return db[_0xe54a('0xd')][_0xe54a('0x8')]({'where':{}});})[_0xe54a('0x9')](function(){return db[_0xe54a('0xd')][_0xe54a('0xa')](hopper);})['then'](function(){console[_0xe54a('0xe')](_0xe54a('0xb'),_0xe54a('0xf'));return db['CmContact'][_0xe54a('0xa')](contacts2);})[_0xe54a('0x9')](function(){console[_0xe54a('0xe')]('finished\x20populating',_0xe54a('0x10'));return db['CmHopper'][_0xe54a('0xa')](hopper2);})['then'](function(){console[_0xe54a('0xe')](_0xe54a('0xb'),'hopper2');})[_0xe54a('0x11')](function(_0x5f55fa){console[_0xe54a('0xe')](_0x5f55fa);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index a7259d4..9a5bced 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83f3=['wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','friend','udp'];(function(_0x583315,_0x28e213){var _0x30ce64=function(_0x5ad172){while(--_0x5ad172){_0x583315['push'](_0x583315['shift']());}};_0x30ce64(++_0x28e213);}(_0x83f3,0x1ef));var _0x383f=function(_0x127fec,_0x188a0b){_0x127fec=_0x127fec-0x0;var _0x3b00bd=_0x83f3[_0x127fec];return _0x3b00bd;};'use strict';var util=require(_0x383f('0x0'));var db=require(_0x383f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x383f('0x2')]({'name':util[_0x383f('0x3')](_0x383f('0x4'),'agent',i),'fullname':util['format'](_0x383f('0x4'),_0x383f('0x5'),i),'email':util['format'](_0x383f('0x6'),_0x383f('0x5'),i),'role':_0x383f('0x5'),'password':'password','internal':0xfa0+i,'type':_0x383f('0x7'),'transport':[_0x383f('0x8'),'ws',_0x383f('0x9')],'disallow':[_0x383f('0xa')],'allow':[_0x383f('0xb')],'defaultuser':util['format'](_0x383f('0x4'),_0x383f('0x5'),i),'encryption':_0x383f('0xc'),'avpf':_0x383f('0xc'),'force_avp':_0x383f('0xc'),'icesupport':_0x383f('0xc'),'dtlsenable':_0x383f('0xc'),'dtlsverify':'no','dtlscertfile':_0x383f('0xd'),'dtlsprivatekey':_0x383f('0xe'),'dtlssetup':'actpass','callerid':util['format'](_0x383f('0xf'),util['format'](_0x383f('0x4'),_0x383f('0x5'),i),0xfa0+i)});}db['User'][_0x383f('0x10')](users)[_0x383f('0x11')](function(){console[_0x383f('0x12')](_0x383f('0x13'));})[_0x383f('0x14')](function(_0x168d91){console[_0x383f('0x12')](_0x168d91);}); \ No newline at end of file +var _0xc364=['add\x20user','util','push','format','%s%s','agent','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xc364,0x86));var _0x4c36=function(_0x1a69df,_0xaad1db){_0x1a69df=_0x1a69df-0x0;var _0xb82082=_0xc364[_0x1a69df];return _0xb82082;};'use strict';var util=require(_0x4c36('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x4c36('0x1')]({'name':util[_0x4c36('0x2')](_0x4c36('0x3'),'agent',i),'fullname':util[_0x4c36('0x2')]('%s%s',_0x4c36('0x4'),i),'email':util[_0x4c36('0x2')]('%s%s@xcally.com','agent',i),'role':_0x4c36('0x4'),'password':_0x4c36('0x5'),'internal':0xfa0+i,'type':_0x4c36('0x6'),'transport':[_0x4c36('0x7'),'ws',_0x4c36('0x8')],'disallow':['all'],'allow':[_0x4c36('0x9')],'defaultuser':util[_0x4c36('0x2')]('%s%s','agent',i),'encryption':_0x4c36('0xa'),'avpf':_0x4c36('0xa'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0x4c36('0xa'),'dtlsverify':'no','dtlscertfile':_0x4c36('0xb'),'dtlsprivatekey':_0x4c36('0xc'),'dtlssetup':_0x4c36('0xd'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x4c36('0x2')](_0x4c36('0x3'),_0x4c36('0x4'),i),0xfa0+i)});}db[_0x4c36('0xe')][_0x4c36('0xf')](users)[_0x4c36('0x10')](function(){console[_0x4c36('0x11')](_0x4c36('0x12'));})['catch'](function(_0x3530c7){console['log'](_0x3530c7);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 67c4779..34d032c 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x434b=['remoteAddress','connectedAt','log','SocketIO\x20','nsp','disconnect','CONNECTED','bluebird','../mysqldb','name','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','SmsQueues','MailQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','Campaign','format','%s:queue:%s','Agents','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteractions','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','ChatQueues','ChatQueue','FaxQueues','OpenchannelQueues','WhatsappQueues','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','openchannel','whatsapp','trunk:%s','leave','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','default','connection','setMaxListeners','address','request'];(function(_0x402012,_0x50336a){var _0x3c656a=function(_0x566ead){while(--_0x566ead){_0x402012['push'](_0x402012['shift']());}};_0x3c656a(++_0x50336a);}(_0x434b,0x17f));var _0xb434=function(_0x29e3ec,_0x138a18){_0x29e3ec=_0x29e3ec-0x0;var _0x25727e=_0x434b[_0x29e3ec];return _0x25727e;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xb434('0x0'));var db=require(_0xb434('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xb434('0x2')],'include':[{'as':'Agents','model':db[_0xb434('0x3')],'attributes':['id',_0xb434('0x2'),_0xb434('0x4')],'raw':!![],'where':{'role':_0xb434('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb434('0x2')],'where':{'role':_0xb434('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb434('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0xb434('0x2')],'where':{'role':_0xb434('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xb434('0x7')],'where':{'type':_0xb434('0x8')}};function getAssociatedResources(_0x443e5c,_0x1cd406,_0x26a2a3){return db[_0xb434('0x9')][_0xb434('0xa')]({'where':{'name':_0x443e5c,'userProfileId':_0x1cd406},'raw':!![]})['then'](function(_0x56262e){if(_0x56262e){if(_0x56262e[_0xb434('0xb')]){switch(_0x443e5c){case _0xb434('0xc'):case'ChatQueues':case'FaxQueues':case _0xb434('0xd'):case _0xb434('0xe'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x26a2a3][_0xb434('0xf')](queryQueues);case _0xb434('0x10'):return db[_0x26a2a3]['findAll'](queryTelephones);case _0xb434('0x11'):return db[_0x26a2a3][_0xb434('0xf')](queryTrunks);case _0xb434('0x12'):return db[_0x26a2a3][_0xb434('0xf')](queryCampaigns);}}else{return db[_0xb434('0x13')][_0xb434('0xf')]({'attributes':[_0xb434('0x14')],'where':{'sectionId':_0x56262e['id']},'raw':!![]})[_0xb434('0x15')](function(_0x589140){if(_0x589140){var _0x3b13a1={'where':{'id':_[_0xb434('0x16')](_0x589140,_0xb434('0x14'))},'raw':!![]};switch(_0x26a2a3){case _0xb434('0x3'):_0x3b13a1[_0xb434('0x17')][_0xb434('0x4')]=_0xb434('0x6');break;case _0xb434('0x18'):_0x3b13a1['where']['type']='ivr';break;}return db[_0x26a2a3]['findAll'](_0x3b13a1);}else{return[];}});}}else{return[];}})[_0xb434('0x15')](function(_0x1c3ef5){return _0x1c3ef5;});}function joinOrLeaveQueues(_0x5d86d9,_0x4260f5,_0x5e2494,_0x12d22d){_0x5d86d9[_0x4260f5](util[_0xb434('0x19')](_0xb434('0x1a'),_0x5e2494,_0x12d22d[_0xb434('0x2')]));if(_0x12d22d[_0xb434('0x1b')]){for(var _0x321871=0x0;_0x321871<_0x12d22d[_0xb434('0x1b')][_0xb434('0x1c')];_0x321871+=0x1){_0x5d86d9[_0x4260f5](util[_0xb434('0x19')](_0xb434('0x1d'),_0x12d22d[_0xb434('0x1b')][_0x321871]['name']));}}}function joinOrLeave(_0xd030aa,_0x515921,_0x3ea18e){var _0x13a8a6;if(_0xd030aa[_0xb434('0x1e')][_0xb434('0x1f')]['id']){db[_0xb434('0x3')][_0xb434('0x20')]({'attributes':['id',_0xb434('0x2'),_0xb434('0x4'),_0xb434('0x21')],'where':{'id':_0xd030aa['handshake'][_0xb434('0x1f')]['id']},'include':[{'model':db[_0xb434('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xb434('0x23'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xb434('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb434('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb434('0x26')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xb434('0x27'),'attributes':['id'],'raw':!![]}]})[_0xb434('0x15')](function(_0x296a66){if(_0x296a66){_0x13a8a6=_0x296a66;_0xd030aa[_0x515921](util['format'](_0xb434('0x1d'),_0x296a66['name']));var _0x3b1bd9=[];switch(_0x296a66[_0xb434('0x4')]){case _0xb434('0x28'):_0xd030aa[_0x515921](_0xb434('0x29'));_0xd030aa[_0x515921](_0xb434('0x2a'));if(queryQueues['hasOwnProperty'](_0xb434('0x2b'))){delete queryQueues[_0xb434('0x2b')];}_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x2d')][_0xb434('0xf')](queryQueues));_0x3b1bd9['push'](db['ChatQueue']['findAll'](queryQueues));_0x3b1bd9['push'](db[_0xb434('0x2e')]['findAll'](queryQueues));_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x2f')][_0xb434('0xf')](queryQueues));_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x30')][_0xb434('0xf')](queryQueues));_0x3b1bd9['push'](db[_0xb434('0x31')]['findAll'](queryQueues));_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x32')][_0xb434('0xf')](queryQueues));_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x3')][_0xb434('0xf')](queryTelephones));_0x3b1bd9[_0xb434('0x2c')](db['Trunk'][_0xb434('0xf')](queryTrunks));_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x18')][_0xb434('0xf')](queryCampaigns));_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x3')][_0xb434('0xf')](queryAgents));break;case'user':_0xd030aa[_0x515921](_0xb434('0x29'));_0xd030aa[_0x515921]('voice:outbound');_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0xc'),_0x296a66['userProfileId'],_0xb434('0x2d')));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0x33'),_0x296a66[_0xb434('0x21')],_0xb434('0x34')));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0x35'),_0x296a66[_0xb434('0x21')],_0xb434('0x2e')));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0xd'),_0x296a66[_0xb434('0x21')],_0xb434('0x2f')));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0xe'),_0x296a66[_0xb434('0x21')],_0xb434('0x30')));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0x36'),_0x296a66[_0xb434('0x21')],_0xb434('0x31')));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0x37'),_0x296a66[_0xb434('0x21')],'WhatsappQueue'));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0x10'),_0x296a66[_0xb434('0x21')],_0xb434('0x3')));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0x11'),_0x296a66[_0xb434('0x21')],'Trunk'));_0x3b1bd9[_0xb434('0x2c')](getAssociatedResources(_0xb434('0x12'),_0x296a66[_0xb434('0x21')],_0xb434('0x18')));_0x3b1bd9[_0xb434('0x2c')](db[_0xb434('0x3')][_0xb434('0xf')](queryAgents));break;case _0xb434('0x5'):_0xd030aa[_0x515921](_0xb434('0x29'));_0xd030aa[_0x515921](_0xb434('0x2a'));_0x3b1bd9[_0xb434('0x2c')](_0x296a66[_0xb434('0x38')]({'attributes':['id',_0xb434('0x2')]}));_0x3b1bd9['push'](_0x296a66[_0xb434('0x39')]({'attributes':['id','name']}));_0x3b1bd9[_0xb434('0x2c')](_0x296a66['getFaxQueues']({'attributes':['id',_0xb434('0x2')]}));_0x3b1bd9[_0xb434('0x2c')](_0x296a66[_0xb434('0x3a')]({'attributes':['id',_0xb434('0x2')]}));_0x3b1bd9[_0xb434('0x2c')](_0x296a66['getMailQueues']({'attributes':['id',_0xb434('0x2')]}));_0x3b1bd9['push'](_0x296a66[_0xb434('0x3b')]({'attributes':['id',_0xb434('0x2')]}));_0x3b1bd9[_0xb434('0x2c')](_0x296a66[_0xb434('0x3c')]({'attributes':['id',_0xb434('0x2')]}));break;}return BPromise[_0xb434('0x3d')](_0x3b1bd9);}})[_0xb434('0x15')](function(_0x33e279){if(_0x33e279&&_0x33e279[_0xb434('0x1c')]){for(var _0x297d02=0x0;_0x297d02<_0x33e279['length'];_0x297d02+=0x1){for(var _0x172a65=0x0;_0x172a65<_0x33e279[_0x297d02][_0xb434('0x1c')];_0x172a65+=0x1){switch(_0x297d02){case 0x0:joinOrLeaveQueues(_0xd030aa,_0x515921,_0xb434('0x3e'),_0x33e279[_0x297d02][_0x172a65]);break;case 0x1:joinOrLeaveQueues(_0xd030aa,_0x515921,_0xb434('0x3f'),_0x33e279[_0x297d02][_0x172a65]);break;case 0x2:joinOrLeaveQueues(_0xd030aa,_0x515921,'fax',_0x33e279[_0x297d02][_0x172a65]);break;case 0x3:joinOrLeaveQueues(_0xd030aa,_0x515921,_0xb434('0x40'),_0x33e279[_0x297d02][_0x172a65]);break;case 0x4:joinOrLeaveQueues(_0xd030aa,_0x515921,'mail',_0x33e279[_0x297d02][_0x172a65]);break;case 0x5:joinOrLeaveQueues(_0xd030aa,_0x515921,_0xb434('0x41'),_0x33e279[_0x297d02][_0x172a65]);break;case 0x6:joinOrLeaveQueues(_0xd030aa,_0x515921,_0xb434('0x42'),_0x33e279[_0x297d02][_0x172a65]);break;case 0x7:if(_0x13a8a6[_0xb434('0x4')]!=='agent')_0xd030aa[_0x515921](util[_0xb434('0x19')]('telephone:%s',_0x33e279[_0x297d02][_0x172a65][_0xb434('0x2')]));break;case 0x8:if(_0x13a8a6['role']!==_0xb434('0x5'))_0xd030aa[_0x515921](util['format'](_0xb434('0x43'),_0x33e279[_0x297d02][_0x172a65][_0xb434('0x2')]));break;case 0x9:if(_0x13a8a6[_0xb434('0x4')]!==_0xb434('0x5'))_0xd030aa[_0x515921](util['format']('campaign:%s:%s',_0x33e279[_0x297d02][_0x172a65][_0xb434('0x7')],_0x33e279[_0x297d02][_0x172a65][_0xb434('0x2')]));break;case 0xa:_0xd030aa[_0x515921](util['format'](_0xb434('0x1d'),_0x33e279[_0x297d02][_0x172a65]['name']));break;}}}}})[_0xb434('0x15')](function(){if(_0x515921===_0xb434('0x44')){var _0x23b7e7=_['map'](_0x13a8a6['ChatInteractions'],'id');return _0x13a8a6[_0xb434('0x45')](_0x23b7e7)[_0xb434('0x15')](function(){for(var _0x4f5452=0x0;_0x4f5452<_0x23b7e7['length'];_0x4f5452+=0x1){_0x3ea18e[_0xb434('0x46')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x23b7e7[_0x4f5452]),'UserId':Number(_0x13a8a6['id'])});}});}})['then'](function(){if(_0x515921===_0xb434('0x44')){var _0x3c8f17=_[_0xb434('0x16')](_0x13a8a6[_0xb434('0x23')],'id');return _0x13a8a6[_0xb434('0x47')](_0x3c8f17)[_0xb434('0x15')](function(){for(var _0x11ea3d=0x0;_0x11ea3d<_0x3c8f17[_0xb434('0x1c')];_0x11ea3d+=0x1){_0x3ea18e[_0xb434('0x46')](_0xb434('0x48'),{'MailInteractionId':Number(_0x3c8f17[_0x11ea3d]),'UserId':Number(_0x13a8a6['id'])});}});}})[_0xb434('0x15')](function(){if(_0x515921===_0xb434('0x44')){var _0x535a05=_[_0xb434('0x16')](_0x13a8a6[_0xb434('0x24')],'id');return _0x13a8a6['removeFaxInteractions'](_0x535a05)[_0xb434('0x15')](function(){for(var _0x2db9bf=0x0;_0x2db9bf<_0x535a05[_0xb434('0x1c')];_0x2db9bf+=0x1){_0x3ea18e[_0xb434('0x46')](_0xb434('0x49'),{'FaxInteractionId':Number(_0x535a05[_0x2db9bf]),'UserId':Number(_0x13a8a6['id'])});}});}})[_0xb434('0x15')](function(){if(_0x515921==='leave'){var _0x3b55c7=_[_0xb434('0x16')](_0x13a8a6[_0xb434('0x4a')],'id');return _0x13a8a6['removeSmsInteractions'](_0x3b55c7)[_0xb434('0x15')](function(){for(var _0x27f5cb=0x0;_0x27f5cb<_0x3b55c7[_0xb434('0x1c')];_0x27f5cb+=0x1){_0x3ea18e[_0xb434('0x46')](_0xb434('0x4b'),{'SmsInteractionId':Number(_0x3b55c7[_0x27f5cb]),'UserId':Number(_0x13a8a6['id'])});}});}})[_0xb434('0x15')](function(){if(_0x515921===_0xb434('0x44')){var _0x3071d3=_[_0xb434('0x16')](_0x13a8a6[_0xb434('0x4c')],'id');return _0x13a8a6[_0xb434('0x4d')](_0x3071d3)[_0xb434('0x15')](function(){for(var _0x4ad5ba=0x0;_0x4ad5ba<_0x3071d3['length'];_0x4ad5ba+=0x1){_0x3ea18e[_0xb434('0x46')](_0xb434('0x4e'),{'OpenchannelInteractionId':Number(_0x3071d3[_0x4ad5ba]),'UserId':Number(_0x13a8a6['id'])});}});}})['then'](function(){if(_0x515921===_0xb434('0x44')){var _0x34cf2a=_['map'](_0x13a8a6[_0xb434('0x27')],'id');return _0x13a8a6[_0xb434('0x4f')](_0x34cf2a)['then'](function(){for(var _0x4d9171=0x0;_0x4d9171<_0x34cf2a['length'];_0x4d9171+=0x1){_0x3ea18e[_0xb434('0x46')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x34cf2a[_0x4d9171]),'UserId':Number(_0x13a8a6['id'])});}});}})[_0xb434('0x50')](function(_0x5e6d14){_0xd030aa['log'](_0x5e6d14);});}}function onDisconnect(_0x53de42,_0x5e1ece){joinOrLeave(_0x53de42,_0xb434('0x44'),_0x5e1ece);}function onConnect(_0x30c20e){joinOrLeave(_0x30c20e,_0xb434('0x51'));}exports[_0xb434('0x52')]=function(_0xfe35f9){_0xfe35f9['on'](_0xb434('0x53'),function(_0x54eb63){_0x54eb63[_0xb434('0x54')](0x0);_0x54eb63[_0xb434('0x55')]=_0x54eb63[_0xb434('0x56')][_0xb434('0x53')][_0xb434('0x57')]+':'+_0x54eb63[_0xb434('0x56')][_0xb434('0x53')]['remotePort'];_0x54eb63[_0xb434('0x58')]=new Date();_0x54eb63[_0xb434('0x59')]=function(_0x24f31f){console[_0xb434('0x59')](_0xb434('0x5a')+_0x54eb63[_0xb434('0x5b')]['name']+'['+_0x54eb63[_0xb434('0x55')]+']',_0x24f31f);};_0x54eb63['on'](_0xb434('0x5c'),function(){onDisconnect(_0x54eb63,_0xfe35f9);_0x54eb63[_0xb434('0x59')]('DISCONNECTED');});onConnect(_0x54eb63);_0x54eb63[_0xb434('0x59')](_0xb434('0x5d'));});}; \ No newline at end of file +var _0x00b3=['whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','user_has_chat_interactions:remove','MailInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','remoteAddress','request','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','agent','telephone','ivr','UserProfileSection','autoAssociation','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','role','Campaign','type','then','format','%s:queue:%s','Agents','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','Trunk','user','VoiceQueues','MailQueue','OpenchannelQueue','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','voice','sms','mail','openchannel'];(function(_0x13c0c2,_0x3195f6){var _0x4bb6f9=function(_0x55bdac){while(--_0x55bdac){_0x13c0c2['push'](_0x13c0c2['shift']());}};_0x4bb6f9(++_0x3195f6);}(_0x00b3,0x157));var _0x300b=function(_0xe4184a,_0x4393fc){_0xe4184a=_0xe4184a-0x0;var _0x1a318a=_0x00b3[_0xe4184a];return _0x1a318a;};'use strict';var _=require(_0x300b('0x0'));var util=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var db=require(_0x300b('0x3'))['db'];var config=require(_0x300b('0x4'));var queryQueues={'attributes':['id',_0x300b('0x5')],'include':[{'as':'Agents','model':db[_0x300b('0x6')],'attributes':['id',_0x300b('0x5'),'role'],'raw':!![],'where':{'role':_0x300b('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x300b('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x300b('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x300b('0x5')],'where':{'role':_0x300b('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x300b('0x5'),'type'],'where':{'type':_0x300b('0x9')}};function getAssociatedResources(_0x2646db,_0x4379cd,_0xe6e730){return db[_0x300b('0xa')]['findOne']({'where':{'name':_0x2646db,'userProfileId':_0x4379cd},'raw':!![]})['then'](function(_0x25f1cc){if(_0x25f1cc){if(_0x25f1cc[_0x300b('0xb')]){switch(_0x2646db){case'VoiceQueues':case _0x300b('0xc'):case _0x300b('0xd'):case'SmsQueues':case _0x300b('0xe'):case _0x300b('0xf'):case _0x300b('0x10'):return db[_0xe6e730][_0x300b('0x11')](queryQueues);case _0x300b('0x12'):return db[_0xe6e730][_0x300b('0x11')](queryTelephones);case _0x300b('0x13'):return db[_0xe6e730][_0x300b('0x11')](queryTrunks);case _0x300b('0x14'):return db[_0xe6e730]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0x300b('0x11')]({'attributes':[_0x300b('0x15')],'where':{'sectionId':_0x25f1cc['id']},'raw':!![]})['then'](function(_0x4c0cac){if(_0x4c0cac){var _0x2958ac={'where':{'id':_[_0x300b('0x16')](_0x4c0cac,_0x300b('0x15'))},'raw':!![]};switch(_0xe6e730){case _0x300b('0x6'):_0x2958ac[_0x300b('0x17')][_0x300b('0x18')]=_0x300b('0x8');break;case _0x300b('0x19'):_0x2958ac['where'][_0x300b('0x1a')]=_0x300b('0x9');break;}return db[_0xe6e730][_0x300b('0x11')](_0x2958ac);}else{return[];}});}}else{return[];}})[_0x300b('0x1b')](function(_0x310b2c){return _0x310b2c;});}function joinOrLeaveQueues(_0x333916,_0x5e02ad,_0x585113,_0x4831c5){_0x333916[_0x5e02ad](util[_0x300b('0x1c')](_0x300b('0x1d'),_0x585113,_0x4831c5['name']));if(_0x4831c5[_0x300b('0x1e')]){for(var _0x5e1895=0x0;_0x5e1895<_0x4831c5[_0x300b('0x1e')]['length'];_0x5e1895+=0x1){_0x333916[_0x5e02ad](util[_0x300b('0x1c')](_0x300b('0x1f'),_0x4831c5['Agents'][_0x5e1895][_0x300b('0x5')]));}}}function joinOrLeave(_0x3bcbee,_0x532980,_0x6c122c){var _0x516c25;if(_0x3bcbee[_0x300b('0x20')][_0x300b('0x21')]['id']){db[_0x300b('0x6')][_0x300b('0x22')]({'attributes':['id',_0x300b('0x5'),_0x300b('0x18'),_0x300b('0x23')],'where':{'id':_0x3bcbee['handshake'][_0x300b('0x21')]['id']},'include':[{'model':db[_0x300b('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x300b('0x25')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x300b('0x26')],'as':_0x300b('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x300b('0x28')],'as':_0x300b('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x300b('0x2a')],'as':_0x300b('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x300b('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x300b('0x1b')](function(_0x395066){if(_0x395066){_0x516c25=_0x395066;_0x3bcbee[_0x532980](util[_0x300b('0x1c')](_0x300b('0x1f'),_0x395066[_0x300b('0x5')]));var _0x3475b6=[];switch(_0x395066['role']){case _0x300b('0x2d'):_0x3bcbee[_0x532980](_0x300b('0x2e'));_0x3bcbee[_0x532980](_0x300b('0x2f'));if(queryQueues[_0x300b('0x30')](_0x300b('0x31'))){delete queryQueues['include'];}_0x3475b6[_0x300b('0x32')](db[_0x300b('0x33')][_0x300b('0x11')](queryQueues));_0x3475b6[_0x300b('0x32')](db[_0x300b('0x34')]['findAll'](queryQueues));_0x3475b6[_0x300b('0x32')](db[_0x300b('0x35')][_0x300b('0x11')](queryQueues));_0x3475b6[_0x300b('0x32')](db[_0x300b('0x36')][_0x300b('0x11')](queryQueues));_0x3475b6[_0x300b('0x32')](db['MailQueue']['findAll'](queryQueues));_0x3475b6[_0x300b('0x32')](db['OpenchannelQueue'][_0x300b('0x11')](queryQueues));_0x3475b6['push'](db['WhatsappQueue'][_0x300b('0x11')](queryQueues));_0x3475b6[_0x300b('0x32')](db['User'][_0x300b('0x11')](queryTelephones));_0x3475b6['push'](db[_0x300b('0x37')][_0x300b('0x11')](queryTrunks));_0x3475b6['push'](db[_0x300b('0x19')]['findAll'](queryCampaigns));_0x3475b6['push'](db[_0x300b('0x6')]['findAll'](queryAgents));break;case _0x300b('0x38'):_0x3bcbee[_0x532980](_0x300b('0x2e'));_0x3bcbee[_0x532980](_0x300b('0x2f'));_0x3475b6[_0x300b('0x32')](getAssociatedResources(_0x300b('0x39'),_0x395066['userProfileId'],_0x300b('0x33')));_0x3475b6['push'](getAssociatedResources(_0x300b('0xc'),_0x395066['userProfileId'],_0x300b('0x34')));_0x3475b6[_0x300b('0x32')](getAssociatedResources('FaxQueues',_0x395066[_0x300b('0x23')],_0x300b('0x35')));_0x3475b6['push'](getAssociatedResources('SmsQueues',_0x395066[_0x300b('0x23')],_0x300b('0x36')));_0x3475b6[_0x300b('0x32')](getAssociatedResources('MailQueues',_0x395066[_0x300b('0x23')],_0x300b('0x3a')));_0x3475b6[_0x300b('0x32')](getAssociatedResources(_0x300b('0xf'),_0x395066['userProfileId'],_0x300b('0x3b')));_0x3475b6['push'](getAssociatedResources(_0x300b('0x10'),_0x395066[_0x300b('0x23')],_0x300b('0x3c')));_0x3475b6[_0x300b('0x32')](getAssociatedResources(_0x300b('0x12'),_0x395066[_0x300b('0x23')],'User'));_0x3475b6[_0x300b('0x32')](getAssociatedResources(_0x300b('0x13'),_0x395066[_0x300b('0x23')],_0x300b('0x37')));_0x3475b6[_0x300b('0x32')](getAssociatedResources('IvrCampaigns',_0x395066[_0x300b('0x23')],_0x300b('0x19')));_0x3475b6[_0x300b('0x32')](db['User'][_0x300b('0x11')](queryAgents));break;case _0x300b('0x7'):_0x3bcbee[_0x532980](_0x300b('0x2e'));_0x3bcbee[_0x532980](_0x300b('0x2f'));_0x3475b6['push'](_0x395066[_0x300b('0x3d')]({'attributes':['id','name']}));_0x3475b6[_0x300b('0x32')](_0x395066[_0x300b('0x3e')]({'attributes':['id',_0x300b('0x5')]}));_0x3475b6[_0x300b('0x32')](_0x395066[_0x300b('0x3f')]({'attributes':['id',_0x300b('0x5')]}));_0x3475b6[_0x300b('0x32')](_0x395066[_0x300b('0x40')]({'attributes':['id',_0x300b('0x5')]}));_0x3475b6['push'](_0x395066[_0x300b('0x41')]({'attributes':['id',_0x300b('0x5')]}));_0x3475b6[_0x300b('0x32')](_0x395066['getOpenchannelQueues']({'attributes':['id','name']}));_0x3475b6[_0x300b('0x32')](_0x395066[_0x300b('0x42')]({'attributes':['id',_0x300b('0x5')]}));break;}return BPromise[_0x300b('0x43')](_0x3475b6);}})[_0x300b('0x1b')](function(_0x284d11){if(_0x284d11&&_0x284d11[_0x300b('0x44')]){for(var _0x2ba658=0x0;_0x2ba658<_0x284d11['length'];_0x2ba658+=0x1){for(var _0x1c401d=0x0;_0x1c401d<_0x284d11[_0x2ba658][_0x300b('0x44')];_0x1c401d+=0x1){switch(_0x2ba658){case 0x0:joinOrLeaveQueues(_0x3bcbee,_0x532980,_0x300b('0x45'),_0x284d11[_0x2ba658][_0x1c401d]);break;case 0x1:joinOrLeaveQueues(_0x3bcbee,_0x532980,'chat',_0x284d11[_0x2ba658][_0x1c401d]);break;case 0x2:joinOrLeaveQueues(_0x3bcbee,_0x532980,'fax',_0x284d11[_0x2ba658][_0x1c401d]);break;case 0x3:joinOrLeaveQueues(_0x3bcbee,_0x532980,_0x300b('0x46'),_0x284d11[_0x2ba658][_0x1c401d]);break;case 0x4:joinOrLeaveQueues(_0x3bcbee,_0x532980,_0x300b('0x47'),_0x284d11[_0x2ba658][_0x1c401d]);break;case 0x5:joinOrLeaveQueues(_0x3bcbee,_0x532980,_0x300b('0x48'),_0x284d11[_0x2ba658][_0x1c401d]);break;case 0x6:joinOrLeaveQueues(_0x3bcbee,_0x532980,_0x300b('0x49'),_0x284d11[_0x2ba658][_0x1c401d]);break;case 0x7:if(_0x516c25[_0x300b('0x18')]!==_0x300b('0x7'))_0x3bcbee[_0x532980](util['format'](_0x300b('0x4a'),_0x284d11[_0x2ba658][_0x1c401d][_0x300b('0x5')]));break;case 0x8:if(_0x516c25[_0x300b('0x18')]!==_0x300b('0x7'))_0x3bcbee[_0x532980](util[_0x300b('0x1c')](_0x300b('0x4b'),_0x284d11[_0x2ba658][_0x1c401d][_0x300b('0x5')]));break;case 0x9:if(_0x516c25[_0x300b('0x18')]!==_0x300b('0x7'))_0x3bcbee[_0x532980](util[_0x300b('0x1c')](_0x300b('0x4c'),_0x284d11[_0x2ba658][_0x1c401d]['type'],_0x284d11[_0x2ba658][_0x1c401d][_0x300b('0x5')]));break;case 0xa:_0x3bcbee[_0x532980](util[_0x300b('0x1c')](_0x300b('0x1f'),_0x284d11[_0x2ba658][_0x1c401d][_0x300b('0x5')]));break;}}}}})[_0x300b('0x1b')](function(){if(_0x532980===_0x300b('0x4d')){var _0x2847bc=_[_0x300b('0x16')](_0x516c25[_0x300b('0x4e')],'id');return _0x516c25['removeChatInteractions'](_0x2847bc)[_0x300b('0x1b')](function(){for(var _0x40ec3d=0x0;_0x40ec3d<_0x2847bc[_0x300b('0x44')];_0x40ec3d+=0x1){_0x6c122c['emit'](_0x300b('0x4f'),{'ChatInteractionId':Number(_0x2847bc[_0x40ec3d]),'UserId':Number(_0x516c25['id'])});}});}})[_0x300b('0x1b')](function(){if(_0x532980===_0x300b('0x4d')){var _0x2865a7=_[_0x300b('0x16')](_0x516c25[_0x300b('0x50')],'id');return _0x516c25['removeMailInteractions'](_0x2865a7)[_0x300b('0x1b')](function(){for(var _0xa414be=0x0;_0xa414be<_0x2865a7[_0x300b('0x44')];_0xa414be+=0x1){_0x6c122c[_0x300b('0x51')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x2865a7[_0xa414be]),'UserId':Number(_0x516c25['id'])});}});}})[_0x300b('0x1b')](function(){if(_0x532980==='leave'){var _0x4b0ffb=_[_0x300b('0x16')](_0x516c25[_0x300b('0x27')],'id');return _0x516c25['removeFaxInteractions'](_0x4b0ffb)[_0x300b('0x1b')](function(){for(var _0xcbb9b7=0x0;_0xcbb9b7<_0x4b0ffb[_0x300b('0x44')];_0xcbb9b7+=0x1){_0x6c122c['emit'](_0x300b('0x52'),{'FaxInteractionId':Number(_0x4b0ffb[_0xcbb9b7]),'UserId':Number(_0x516c25['id'])});}});}})[_0x300b('0x1b')](function(){if(_0x532980===_0x300b('0x4d')){var _0x1ee1e6=_[_0x300b('0x16')](_0x516c25[_0x300b('0x29')],'id');return _0x516c25[_0x300b('0x53')](_0x1ee1e6)[_0x300b('0x1b')](function(){for(var _0x240693=0x0;_0x240693<_0x1ee1e6['length'];_0x240693+=0x1){_0x6c122c[_0x300b('0x51')](_0x300b('0x54'),{'SmsInteractionId':Number(_0x1ee1e6[_0x240693]),'UserId':Number(_0x516c25['id'])});}});}})[_0x300b('0x1b')](function(){if(_0x532980===_0x300b('0x4d')){var _0x30ad1c=_[_0x300b('0x16')](_0x516c25[_0x300b('0x2b')],'id');return _0x516c25[_0x300b('0x55')](_0x30ad1c)[_0x300b('0x1b')](function(){for(var _0x123820=0x0;_0x123820<_0x30ad1c[_0x300b('0x44')];_0x123820+=0x1){_0x6c122c[_0x300b('0x51')](_0x300b('0x56'),{'OpenchannelInteractionId':Number(_0x30ad1c[_0x123820]),'UserId':Number(_0x516c25['id'])});}});}})[_0x300b('0x1b')](function(){if(_0x532980==='leave'){var _0x59a501=_[_0x300b('0x16')](_0x516c25[_0x300b('0x57')],'id');return _0x516c25[_0x300b('0x58')](_0x59a501)['then'](function(){for(var _0x10ad48=0x0;_0x10ad48<_0x59a501[_0x300b('0x44')];_0x10ad48+=0x1){_0x6c122c[_0x300b('0x51')](_0x300b('0x59'),{'WhatsappInteractionId':Number(_0x59a501[_0x10ad48]),'UserId':Number(_0x516c25['id'])});}});}})[_0x300b('0x5a')](function(_0x41ff87){_0x3bcbee['log'](_0x41ff87);});}}function onDisconnect(_0x57e597,_0x2f0920){joinOrLeave(_0x57e597,'leave',_0x2f0920);}function onConnect(_0x771380){joinOrLeave(_0x771380,_0x300b('0x5b'));}exports[_0x300b('0x5c')]=function(_0x1f7952){_0x1f7952['on'](_0x300b('0x5d'),function(_0x458df4){_0x458df4[_0x300b('0x5e')](0x0);_0x458df4[_0x300b('0x5f')]=_0x458df4['request'][_0x300b('0x5d')][_0x300b('0x60')]+':'+_0x458df4[_0x300b('0x61')][_0x300b('0x5d')]['remotePort'];_0x458df4['connectedAt']=new Date();_0x458df4[_0x300b('0x62')]=function(_0x9bbcec){console[_0x300b('0x62')](_0x300b('0x63')+_0x458df4[_0x300b('0x64')][_0x300b('0x5')]+'['+_0x458df4[_0x300b('0x5f')]+']',_0x9bbcec);};_0x458df4['on'](_0x300b('0x65'),function(){onDisconnect(_0x458df4,_0x1f7952);_0x458df4[_0x300b('0x62')](_0x300b('0x66'));});onConnect(_0x458df4);_0x458df4[_0x300b('0x62')](_0x300b('0x67'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 32032bf..28a02da 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 _0x63d2=['catch','get','channel','motionChannel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','SELECT','contact','UserId','format','SIP/%s','name','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','agent','changed','closed','substatus','interface','AfterUpdate','User','fullname','email','default','length','model','hook','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','SmsInteraction','Sms','WhatsappInteraction','Whatsapp','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','afterUpdate','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','code','Trigger,\x20%s'];(function(_0x1aa35f,_0x300b6f){var _0x3a4086=function(_0x3659ae){while(--_0x3659ae){_0x1aa35f['push'](_0x1aa35f['shift']());}};_0x3a4086(++_0x300b6f);}(_0x63d2,0x1e8));var _0x263d=function(_0xb4ea7a,_0x594d6c){_0xb4ea7a=_0xb4ea7a-0x0;var _0x22015c=_0x63d2[_0xb4ea7a];return _0x22015c;};'use strict';var util=require(_0x263d('0x0'));var db=require(_0x263d('0x1'))['db'];var jayson=require(_0x263d('0x2'));var logger=require(_0x263d('0x3'))(_0x263d('0x4'));var client=jayson[_0x263d('0x5')][_0x263d('0x6')]({'port':0x232a});var triggers=[{'channel':_0x263d('0x7'),'model':_0x263d('0x8'),'event':_0x263d('0x9'),'condition':_0x263d('0xa'),'callback':afterCreate},{'channel':'Chat','model':_0x263d('0x8'),'event':'afterUpdate','condition':_0x263d('0xb'),'callback':afterUpdate},{'channel':_0x263d('0x7'),'model':_0x263d('0xc'),'event':'afterCreate','condition':_0x263d('0xd'),'callback':afterCreateMessage},{'channel':_0x263d('0x7'),'model':_0x263d('0xe'),'event':_0x263d('0x9'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x263d('0xf'),'event':_0x263d('0x9'),'condition':_0x263d('0xa'),'callback':afterCreate},{'channel':_0x263d('0x10'),'model':_0x263d('0xf'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x263d('0x10'),'model':'SmsMessage','event':_0x263d('0x9'),'condition':_0x263d('0xd'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x263d('0x11'),'event':_0x263d('0x9'),'condition':_0x263d('0xa'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x263d('0x11'),'event':'afterUpdate','condition':_0x263d('0xb'),'callback':afterUpdate},{'channel':_0x263d('0x12'),'model':_0x263d('0x13'),'event':_0x263d('0x9'),'condition':_0x263d('0xd'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x263d('0x14'),'event':_0x263d('0x9'),'condition':_0x263d('0xa'),'callback':afterCreate},{'channel':_0x263d('0x15'),'model':'FaxInteraction','event':'afterUpdate','condition':_0x263d('0xb'),'callback':afterUpdate},{'channel':_0x263d('0x15'),'model':_0x263d('0x16'),'event':_0x263d('0x9'),'condition':_0x263d('0xd'),'callback':afterCreateMessage},{'channel':_0x263d('0x17'),'model':_0x263d('0x18'),'event':_0x263d('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x263d('0x17'),'model':'MailInteraction','event':_0x263d('0x19'),'condition':_0x263d('0xb'),'callback':afterUpdate},{'channel':_0x263d('0x17'),'model':_0x263d('0x1a'),'event':_0x263d('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x263d('0x1b'),'model':_0x263d('0x1c'),'event':_0x263d('0x9'),'condition':_0x263d('0xa'),'callback':afterCreate},{'channel':_0x263d('0x1b'),'model':_0x263d('0x1c'),'event':_0x263d('0x19'),'condition':_0x263d('0xb'),'callback':afterUpdate},{'channel':_0x263d('0x1b'),'model':_0x263d('0x1d'),'event':'afterCreate','condition':_0x263d('0xd'),'callback':afterCreateMessage}];function request(_0x18f81d){return client[_0x263d('0x1e')](_0x263d('0x1f'),_0x18f81d)[_0x263d('0x20')](function(_0x5812b5){logger[_0x263d('0x21')]('Trigger,\x20%s',_0x263d('0x1f'),_0x5812b5);if(_0x5812b5[_0x263d('0x22')]){if(_0x5812b5[_0x263d('0x22')][_0x263d('0x23')]===0x1f4){logger[_0x263d('0x22')](_0x263d('0x24'),_0x263d('0x1f'),_0x5812b5['error']);}}})[_0x263d('0x25')](function(_0x4c1ab4){logger['error']('Trigger,\x20%s',_0x263d('0x1f'),_0x4c1ab4);});}function afterCreateMessage(_0x2d4676){return function(_0x53526c){_0x53526c=_0x53526c[_0x263d('0x26')]({'plain':!![]});_0x53526c[_0x263d('0x27')]=_0x2d4676;_0x53526c[_0x263d('0x28')]=_0x2d4676;_0x53526c[_0x263d('0x29')]=_0x53526c[_0x263d('0x2a')];Promise['resolve']()[_0x263d('0x20')](function(){if(typeof _0x53526c[_0x263d('0x2b')]===_0x263d('0x2c'))return null;var _0x2810cb=_0x263d('0x2d')+_0x53526c[_0x263d('0x2b')];return db[_0x263d('0x2e')][_0x263d('0x2f')](_0x2810cb,{'type':db[_0x263d('0x30')]['QueryTypes'][_0x263d('0x31')],'raw':!![]});})[_0x263d('0x20')](function(_0xfb85b9){if(_0xfb85b9){_0x53526c[_0x263d('0x32')]=_0xfb85b9[0x0];}if(typeof _0x53526c[_0x263d('0x33')]==='undefined')return;return getAgent(_0x53526c[_0x263d('0x33')]);})['then'](function(_0x16c773){if(_0x16c773){_0x53526c['interface']=util[_0x263d('0x34')](_0x263d('0x35'),_0x16c773[_0x263d('0x36')]);_0x53526c['agent']=_0x16c773;_0x53526c[_0x263d('0x27')]=_0x2d4676;return request({'event':_0x263d('0x37'),'message':_0x53526c});}else{return request({'event':_0x263d('0x38'),'message':_0x53526c});}})[_0x263d('0x25')](function(_0x108398){logger[_0x263d('0x22')]('Trigger,\x20%s',_0x263d('0x39'),_0x108398);});};}function afterCreateOfflineMessage(_0x4f771f){return function(_0x1ccad7){_0x1ccad7=_0x1ccad7['get']({'plain':!![]});_0x1ccad7[_0x263d('0x27')]=_0x4f771f;_0x1ccad7[_0x263d('0x28')]=_0x4f771f;_0x1ccad7[_0x263d('0x29')]=_0x263d('0x3a');return request({'event':_0x1ccad7[_0x263d('0x29')],'message':_0x1ccad7});};}function afterCreate(_0x57b493,_0x1bd69b){return function(_0x1d4cc2){var _0x5477e4=_0x1d4cc2[_0x263d('0x26')]({'plain':!![]});_0x5477e4[_0x263d('0x27')]=_0x57b493;_0x5477e4[_0x263d('0x28')]=_0x57b493;_0x5477e4[_0x263d('0x29')]=_0x263d('0x3b');Promise['resolve']()[_0x263d('0x20')](function(){var _0xce9b33=_0x263d('0x2d')+_0x5477e4[_0x263d('0x2b')];return db['sequelize'][_0x263d('0x2f')](_0xce9b33,{'type':db[_0x263d('0x30')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x263d('0x20')](function(_0x362599){if(_0x362599){_0x5477e4[_0x263d('0x32')]=_0x362599[0x0];}if(_0x5477e4[_0x263d('0x33')]){return getAgent(_0x5477e4['UserId']);}return;})[_0x263d('0x20')](function(_0x1f66fb){if(_0x1f66fb){_0x5477e4['interface']=util[_0x263d('0x34')](_0x263d('0x35'),_0x1f66fb['name']);_0x5477e4[_0x263d('0x3c')]=_0x1f66fb;}return request({'event':_0x1bd69b,'message':_0x5477e4});})[_0x263d('0x25')](function(_0x18561f){logger[_0x263d('0x22')](_0x263d('0x24'),'AfterCreate',_0x18561f);});};}function afterUpdate(_0x3e7baf){return function(_0x480982){var _0x3d1095=_0x480982[_0x263d('0x3d')]('closed')&&_0x480982[_0x263d('0x3e')];var _0x529e38=_0x480982[_0x263d('0x3d')]('substatus');if(_0x3d1095||_0x529e38){var _0x704afc=_0x3d1095?_0x263d('0xb'):_0x263d('0x3f');var _0x5e9e67=_0x480982[_0x263d('0x26')]({'plain':!![]});_0x5e9e67[_0x263d('0x27')]=_0x3e7baf;_0x5e9e67[_0x263d('0x28')]=_0x3e7baf;_0x5e9e67['event']=_0x3d1095?'closed':'substatus';var _0x52310b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5e9e67[_0x263d('0x2b')];return db[_0x263d('0x2e')][_0x263d('0x2f')](_0x52310b,{'type':db['Sequelize']['QueryTypes'][_0x263d('0x31')],'raw':!![]})['then'](function(_0x2b3cc7){if(_0x2b3cc7){_0x5e9e67['contact']=_0x2b3cc7[0x0];}if(typeof _0x5e9e67[_0x263d('0x33')]===_0x263d('0x2c'))return;return getAgent(_0x5e9e67[_0x263d('0x33')]);})[_0x263d('0x20')](function(_0x153591){if(_0x153591){_0x5e9e67[_0x263d('0x40')]=util[_0x263d('0x34')](_0x263d('0x35'),_0x153591[_0x263d('0x36')]);_0x5e9e67[_0x263d('0x3c')]=_0x153591;}return request({'event':_0x704afc,'message':_0x5e9e67});})[_0x263d('0x25')](function(_0x1b5c4d){logger[_0x263d('0x22')](_0x263d('0x24'),_0x263d('0x41'),_0x1b5c4d);});}};}function getAgent(_0xff561b){return db[_0x263d('0x42')]['find']({'where':{'id':_0xff561b},'attributes':['id','name',_0x263d('0x43'),_0x263d('0x44'),'internal'],'raw':!![]})[_0x263d('0x20')](function(_0x23717b){return _0x23717b;});}exports[_0x263d('0x45')]=function(){for(var _0x14e476=0x0;_0x14e476=_0x5a104c['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x68da2d(_0x37daca);})['catch'](function(_0xffe4e5){_0x3d277f(_0xffe4e5);});});}; \ No newline at end of file +var _0xff1e=['getLicense','role','agent','User','count','then','agents','catch','lodash','bluebird','../mysqldb','./license/util','mail','fax','sms','whatsapp','getChannels','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xff1e,0x17e));var _0xeff1=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xff1e[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0xeff1('0x0'));var BPromise=require(_0xeff1('0x1'));var db=require(_0xeff1('0x2'))['db'];var util=require(_0xeff1('0x3'));var channels=['voice',_0xeff1('0x4'),'chat',_0xeff1('0x5'),_0xeff1('0x6'),_0xeff1('0x7'),'openchannel'];exports[_0xeff1('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x14fbad){_0x14fbad=_0x14fbad[_0xeff1('0x9')]();return _[_0xeff1('0xa')](channels,_0x14fbad);};exports[_0xeff1('0xb')]=function(_0x5ec624,_0xd51fbd,_0x3f5212,_0xb84495){var _0x309d94={'loginAttempts':_0xd51fbd,'blocked':_0x3f5212};if(!_[_0xeff1('0xc')](_0xb84495)){_0x309d94[_0xeff1('0xd')]=_0xb84495;}return _0x5ec624['updateAttributes'](_0x309d94);};exports[_0xeff1('0xe')]=function(_0x515ee2){return new BPromise(function(_0x13b7d9,_0x1bd9df){var _0x29449=0x0;if(_0x515ee2[_0xeff1('0xf')]!==_0xeff1('0x10')){_0x13b7d9(_0x515ee2);}db[_0xeff1('0x11')][_0xeff1('0x12')]({'where':{'role':_0xeff1('0x10'),'online':!![],'id':{'$ne':_0x515ee2['id']}}})[_0xeff1('0x13')](function(_0x72aea5){_0x29449=_0x72aea5;return util[_0xeff1('0xe')]();})[_0xeff1('0x13')](function(_0x264ea9){if(_0x264ea9&&_0x264ea9[_0xeff1('0x14')]&&_0x29449>=_0x264ea9[_0xeff1('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x13b7d9(_0x515ee2);})[_0xeff1('0x15')](function(_0x191e0d){_0x1bd9df(_0x191e0d);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 53938e9..396768c 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06ff=['error','stack','statusMessage','status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Forbidden','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','details','Conflict'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x06ff,0xe2));var _0xf06f=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x06ff[_0x4e676e];return _0x336a3c;};'use strict';var util=require('util');var logger=require(_0xf06f('0x0'))(_0xf06f('0x1'));var APIError=function(_0x1d9f2f,_0x26593e){this[_0xf06f('0x2')]=_0x1d9f2f||_0xf06f('0x3');this[_0xf06f('0x4')]=_0x26593e||_0xf06f('0x5');util[_0xf06f('0x6')](APIError,Error);};var APIBadRequestError=function(_0x30411b){this['message']=_0x30411b||'Bad\x20Request';this[_0xf06f('0x4')]=_0xf06f('0x7');util[_0xf06f('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x25c5f6){this[_0xf06f('0x2')]=_0x25c5f6||_0xf06f('0x8');this['name']=_0xf06f('0x8');util[_0xf06f('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x41b398){this[_0xf06f('0x2')]=_0x41b398||'Entity\x20not\x20found';this['name']=_0xf06f('0x9');util[_0xf06f('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x1a668f){this[_0xf06f('0x2')]=_0x1a668f||_0xf06f('0xa');this[_0xf06f('0x4')]=_0xf06f('0xb');this['code']=0x193;this[_0xf06f('0xc')]={'type':'OutOfInterval'};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x1aa011){this[_0xf06f('0x2')]=_0x1aa011||'Resource\x20Conflict';this[_0xf06f('0x4')]=_0xf06f('0xd');util[_0xf06f('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x552278){switch(_0x552278){case _0xf06f('0x7'):return 0x190;case _0xf06f('0x8'),_0xf06f('0xb'):return 0x193;case'Not\x20Found':return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x3f00ed){if(_0x3f00ed===_0xf06f('0xb'))return _0x3f00ed;return null;}function handleError(_0x4e6d51){return function(_0x35500a){logger[_0xf06f('0xe')](_0x35500a[_0xf06f('0xf')]);var _0x1acc00=getStatusCode(_0x35500a[_0xf06f('0x4')]);var _0x10661d=getCustomStatusMessage(_0x35500a[_0xf06f('0x4')]);if(_0x35500a[_0xf06f('0x4')]){delete _0x35500a[_0xf06f('0x4')];}if(_0x10661d){_0x4e6d51[_0xf06f('0x10')]=_0x10661d;}return _0x4e6d51[_0xf06f('0x11')](_0x1acc00)[_0xf06f('0x12')](_0x35500a);};}module[_0xf06f('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xf36e=['Message\x20sent\x20outside\x20a\x20valid\x20interval','details','OutOfInterval','Resource\x20Conflict','Conflict','error','stack','statusMessage','status','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found'];(function(_0x5c3f56,_0x22971d){var _0x2d3405=function(_0x24ebad){while(--_0x24ebad){_0x5c3f56['push'](_0x5c3f56['shift']());}};_0x2d3405(++_0x22971d);}(_0xf36e,0xfd));var _0xef36=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf36e[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0xef36('0x0'));var logger=require(_0xef36('0x1'))(_0xef36('0x2'));var APIError=function(_0x4ada6a,_0x18e7a8){this[_0xef36('0x3')]=_0x4ada6a||_0xef36('0x4');this[_0xef36('0x5')]=_0x18e7a8||'Error';util[_0xef36('0x6')](APIError,Error);};var APIBadRequestError=function(_0x1d200a){this[_0xef36('0x3')]=_0x1d200a||_0xef36('0x7');this[_0xef36('0x5')]=_0xef36('0x7');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x3b1556){this[_0xef36('0x3')]=_0x3b1556||_0xef36('0x8');this[_0xef36('0x5')]=_0xef36('0x8');util[_0xef36('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x335d3d){this[_0xef36('0x3')]=_0x335d3d||_0xef36('0x9');this[_0xef36('0x5')]=_0xef36('0xa');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x1d1dc1){this[_0xef36('0x3')]=_0x1d1dc1||_0xef36('0xb');this[_0xef36('0x5')]='Out\x20Of\x20Interval';this['code']=0x193;this[_0xef36('0xc')]={'type':_0xef36('0xd')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0xde56fb){this[_0xef36('0x3')]=_0xde56fb||_0xef36('0xe');this['name']=_0xef36('0xf');util[_0xef36('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x3cd83e){switch(_0x3cd83e){case _0xef36('0x7'):return 0x190;case _0xef36('0x8'),'Out\x20Of\x20Interval':return 0x193;case _0xef36('0xa'):return 0x194;case _0xef36('0xf'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x104f73){if(_0x104f73==='Out\x20Of\x20Interval')return _0x104f73;return null;}function handleError(_0x12201a){return function(_0x408c4f){logger[_0xef36('0x10')](_0x408c4f[_0xef36('0x11')]);var _0x1be44d=getStatusCode(_0x408c4f[_0xef36('0x5')]);var _0x22755b=getCustomStatusMessage(_0x408c4f[_0xef36('0x5')]);if(_0x408c4f[_0xef36('0x5')]){delete _0x408c4f[_0xef36('0x5')];}if(_0x22755b){_0x12201a[_0xef36('0x12')]=_0x22755b;}return _0x12201a[_0xef36('0x13')](_0x1be44d)[_0xef36('0x14')](_0x408c4f);};}module[_0xef36('0x15')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index de8c379..f6534d4 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7915=['404','status','render','json','send','exports'];(function(_0x407b07,_0x525c69){var _0x2c9b12=function(_0x54b368){while(--_0x54b368){_0x407b07['push'](_0x407b07['shift']());}};_0x2c9b12(++_0x525c69);}(_0x7915,0x1a9));var _0x5791=function(_0x5e9628,_0x30b22c){_0x5e9628=_0x5e9628-0x0;var _0x5cfb79=_0x7915[_0x5e9628];return _0x5cfb79;};'use strict';module[_0x5791('0x0')][0x194]=function pageNotFound(_0x314ddd,_0x2921fd){var _0x3e53dc=_0x5791('0x1');var _0x5e7203=0x194;var _0x5cee46={'status':_0x5e7203};_0x2921fd[_0x5791('0x2')](_0x5cee46[_0x5791('0x2')]);_0x2921fd[_0x5791('0x3')](_0x3e53dc,{},function(_0x46d7b4,_0x4f48f4){if(_0x46d7b4){return _0x2921fd[_0x5791('0x2')](_0x5cee46[_0x5791('0x2')])[_0x5791('0x4')](_0x5cee46);}_0x2921fd[_0x5791('0x5')](_0x4f48f4);});}; \ No newline at end of file +var _0xc715=['send','exports','status','json'];(function(_0x2b459a,_0x85add){var _0x2676d2=function(_0x3f4e75){while(--_0x3f4e75){_0x2b459a['push'](_0x2b459a['shift']());}};_0x2676d2(++_0x85add);}(_0xc715,0x1a5));var _0x5c71=function(_0x42f2f9,_0x5d1cfb){_0x42f2f9=_0x42f2f9-0x0;var _0x306b0a=_0xc715[_0x42f2f9];return _0x306b0a;};'use strict';module[_0x5c71('0x0')][0x194]=function pageNotFound(_0x3c88b4,_0x5f4251){var _0x3ae5c2='404';var _0x225019=0x194;var _0xc4d6d={'status':_0x225019};_0x5f4251[_0x5c71('0x1')](_0xc4d6d[_0x5c71('0x1')]);_0x5f4251['render'](_0x3ae5c2,{},function(_0x35f16a,_0x455001){if(_0x35f16a){return _0x5f4251[_0x5c71('0x1')](_0xc4d6d[_0x5c71('0x1')])[_0x5c71('0x2')](_0xc4d6d);}_0x5f4251[_0x5c71('0x3')](_0x455001);});}; \ No newline at end of file diff --git a/server/migrations/2.6.34.js b/server/migrations/2.6.34.js new file mode 100644 index 0000000..a59425a --- /dev/null +++ b/server/migrations/2.6.34.js @@ -0,0 +1,169 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); +var logger = require('../config/logger')('migration'); +var Sequence = function() {}; + +Sequence.prototype.enqueue = function(fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function(queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function() { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addColumn(table, column, type) + .then(function() { + logger.info('Added column %s to %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function(table) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .dropTable(table, { + force: true, + }) + .then(function() { + logger.info('table dropped %s', table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function(table, column, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName, + }) + .then(function() { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function(table, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function() { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function(sql) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface.sequelize + .query(sql) + .then(function() { + logger.info('query %s', sql); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function(table, column) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeColumn(table, column) + .then(function() { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function() { + logger.info( + 'Renamed column from %s to %s on %s', + oldColumn, + newColumn, + table + ); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.final = function(resolve) { + this.sequence.enqueue(function() { + return resolve(); + }); +}; + +module.exports = { + up: function(queryInterface /*, Sequelize */) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + // Add your migration code here + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function( /* queryInterface, Sequelize */ ) { + // var migration = new Migration(queryInterface); + }, +}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index f46837e..3d39204 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91a0=['../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','../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','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','CmHopper','CmHopperBlack','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','Sound','../api/sound/sound.model','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/template/template.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','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','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','MailInteractionHasTag','User','hasOne','cascade','UserId','userSetting','Recordings','hasMany','VoiceQueuesRt','HopperFinals','ReportAgentPreview','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','SenderId','SET\x20NULL','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','SmsInteraction','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','SmsQueue','SmsQueues','OpenchannelQueues','FaxAccounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','JscriptySessionReport','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','uniqueid','VoiceCallReport','Contact','ContactId','MailServerIn','MailAccountId','restrict','MailServerOut','CloudProviderId','Imap','Smtp','Dispositions','Answers','MailMessage','List','ListId','Template','TemplateId','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','ChatOfflineMessageId','TagId','Items','FaxAccountId','user_has_fax_accounts','fax_interaction_has_tags','user_has_fax_interactions','FaxInteractionId','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','Interactions','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','Teams','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','Contacts','CompanyId','MailInteractions','Company','cm_contact_has_tags','CmHopperId','CampaignId','OwnerId','OneAll','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','CmContactId','AllConditions','AllCondition','Trigger','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','Field','SugarcrmConfiguration','DeskConfiguration','DeskField','VariableId','int_zendesk_configuration_has_tags','FreshdeskField','VtigerConfiguration','VtigerField','ServicenowAccount','FreshsalesConfiguration','FromId','SessionId','ProjectId','JscriptyQuestionReport','ChatQueues','FaxQueues','team_has_whatsapp_queues','HopperBlacks','TrunkId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','FromAgent','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSection','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording'];(function(_0x3a8dc1,_0x2f03b8){var _0x4b3595=function(_0x1c19e7){while(--_0x1c19e7){_0x3a8dc1['push'](_0x3a8dc1['shift']());}};_0x4b3595(++_0x2f03b8);}(_0x91a0,0x1df));var _0x091a=function(_0x1aac60,_0x2e5ce5){_0x1aac60=_0x1aac60-0x0;var _0x186adf=_0x91a0[_0x1aac60];return _0x186adf;};'use strict';var config=require(_0x091a('0x0'));var Sequelize=require('sequelize');var _=require(_0x091a('0x1'));var jstz=require(_0x091a('0x2'));var timezone=jstz[_0x091a('0x3')]();config[_0x091a('0x4')]=_[_0x091a('0x5')](config[_0x091a('0x4')],{'database':_0x091a('0x6'),'username':_0x091a('0x7'),'password':_0x091a('0x8'),'options':{'host':_0x091a('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x091a('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x091a('0xb'),'collate':_0x091a('0xc')}}});config[_0x091a('0xd')]=_['defaultsDeep'](config[_0x091a('0xd')],{'database':_0x091a('0x6'),'username':_0x091a('0x7'),'password':_0x091a('0x8'),'options':{'host':_0x091a('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x091a('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x091a('0xb'),'collate':_0x091a('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x091a('0xe')],config[_0x091a('0x4')][_0x091a('0xf')],config[_0x091a('0x4')][_0x091a('0x10')],config[_0x091a('0x4')][_0x091a('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x091a('0xd')][_0x091a('0xe')],config[_0x091a('0xd')][_0x091a('0xf')],config['sequelizeHistory'][_0x091a('0x10')],config[_0x091a('0xd')][_0x091a('0x11')])};db['User']=db['sequelize'][_0x091a('0x12')](_0x091a('0x13'));db[_0x091a('0x14')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x091a('0x15')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x16'));db[_0x091a('0x17')]=db['sequelize']['import']('../api/voiceExtension/voiceExtension.model');db[_0x091a('0x18')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x091a('0x19')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x1a'));db[_0x091a('0x1b')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x1c'));db[_0x091a('0x1d')]=db['sequelize']['import'](_0x091a('0x1e'));db[_0x091a('0x1f')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x20'));db['VoiceMailMessage']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x21'));db['VoiceCallReport']=db[_0x091a('0x4')]['import'](_0x091a('0x22'));db[_0x091a('0x23')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x24'));db[_0x091a('0x25')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x26'));db[_0x091a('0x27')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x28'));db[_0x091a('0x29')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x2a'));db[_0x091a('0x2b')]=db[_0x091a('0x4')]['import']('../api/trunk/trunk.model');db[_0x091a('0x2c')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x2d'));db[_0x091a('0x2e')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x2f'));db[_0x091a('0x30')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x31'));db[_0x091a('0x32')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x33'));db[_0x091a('0x34')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x35'));db[_0x091a('0x36')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x37'));db[_0x091a('0x38')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x091a('0x39')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x091a('0x3a')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x3b'));db['MailServerIn']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x3c'));db['MailServerOut']=db[_0x091a('0x4')]['import'](_0x091a('0x3d'));db[_0x091a('0x3e')]=db[_0x091a('0x4')]['import'](_0x091a('0x3f'));db[_0x091a('0x40')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x41'));db[_0x091a('0x42')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x43'));db['MailMessage']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x44'));db[_0x091a('0x45')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/mailApplication/mailApplication.model');db[_0x091a('0x46')]=db[_0x091a('0x4')]['import'](_0x091a('0x47'));db[_0x091a('0x48')]=db['sequelize'][_0x091a('0x12')]('../api/dashboard/dashboard.model');db[_0x091a('0x49')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x4a'));db[_0x091a('0x4b')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x4c'));db[_0x091a('0x4d')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/faxApplication/faxApplication.model');db[_0x091a('0x4e')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x4f'));db[_0x091a('0x50')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x51'));db[_0x091a('0x52')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x53'));db['FaxQueueReport']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x54'));db[_0x091a('0x55')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x56'));db[_0x091a('0x57')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x58'));db['SmsInteraction']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x59'));db[_0x091a('0x5a')]=db['sequelize']['import'](_0x091a('0x5b'));db['SmsQueue']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x5c'));db[_0x091a('0x5d')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x5e'));db[_0x091a('0x5f')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x60'));db[_0x091a('0x61')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x62'));db[_0x091a('0x63')]=db[_0x091a('0x4')]['import'](_0x091a('0x64'));db[_0x091a('0x65')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0x091a('0x66')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x67'));db[_0x091a('0x68')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x69'));db[_0x091a('0x6a')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x6b'));db[_0x091a('0x6c')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x6d'));db[_0x091a('0x6e')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x6f'));db[_0x091a('0x70')]=db['sequelize'][_0x091a('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x091a('0x71')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x72'));db['ChatGroup']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x73'));db[_0x091a('0x74')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x75'));db[_0x091a('0x76')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/cmCompany/cmCompany.model');db[_0x091a('0x77')]=db[_0x091a('0x4')]['import']('../api/cmContact/cmContact.model');db[_0x091a('0x78')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/cmHopper/cmHopper.model');db[_0x091a('0x79')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x091a('0x7a')]=db[_0x091a('0x4')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x091a('0x7b')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x7c'));db['ReportAgentPreview']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x7d'));db[_0x091a('0x7e')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x091a('0x7f')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x80'));db[_0x091a('0x81')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x82'));db[_0x091a('0x83')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x84'));db[_0x091a('0x85')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x86'));db[_0x091a('0x87')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x88'));db[_0x091a('0x89')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x8a'));db['Pause']=db[_0x091a('0x4')]['import'](_0x091a('0x8b'));db[_0x091a('0x8c')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x8d'));db[_0x091a('0x8e')]=db['sequelize'][_0x091a('0x12')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x091a('0x8f')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/schedule/schedule.model');db[_0x091a('0x90')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x91'));db['Tag']=db[_0x091a('0x4')]['import']('../api/tag/tag.model');db['ContactItemType']=db['sequelize'][_0x091a('0x12')](_0x091a('0x92'));db[_0x091a('0x93')]=db[_0x091a('0x4')]['import'](_0x091a('0x94'));db[_0x091a('0x95')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db['Template']=db[_0x091a('0x4')]['import'](_0x091a('0x96'));db['Trigger']=db['sequelize'][_0x091a('0x12')]('../api/trigger/trigger.model');db[_0x091a('0x97')]=db[_0x091a('0x4')]['import'](_0x091a('0x98'));db['Integration']=db['sequelize'][_0x091a('0x12')](_0x091a('0x99'));db[_0x091a('0x9a')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x9b'));db['AnalyticCustomReport']=db['sequelize'][_0x091a('0x12')](_0x091a('0x9c'));db[_0x091a('0x9d')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x9e'));db['AnalyticExtractedReport']=db[_0x091a('0x4')]['import'](_0x091a('0x9f'));db[_0x091a('0xa0')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xa1'));db[_0x091a('0xa2')]=db[_0x091a('0x4')]['import'](_0x091a('0xa3'));db[_0x091a('0xa4')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x091a('0xa5')]=db[_0x091a('0x4')]['import'](_0x091a('0xa6'));db[_0x091a('0xa7')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xa8'));db[_0x091a('0xa9')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xaa'));db[_0x091a('0xab')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xac'));db[_0x091a('0xad')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xae'));db[_0x091a('0xaf')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0x091a('0x4')]['import'](_0x091a('0xb0'));db['DeskField']=db[_0x091a('0x4')]['import'](_0x091a('0xb1'));db[_0x091a('0xb2')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xb3'));db[_0x091a('0xb4')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xb5'));db[_0x091a('0xb6')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xb7'));db[_0x091a('0xb8')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xb9'));db[_0x091a('0xba')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x091a('0xbb')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xbc'));db[_0x091a('0xbd')]=db['sequelize'][_0x091a('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x091a('0xbe')]=db[_0x091a('0x4')]['import'](_0x091a('0xbf'));db['FreshdeskField']=db[_0x091a('0x4')]['import'](_0x091a('0xc0'));db[_0x091a('0xc1')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xc2'));db['VtigerConfiguration']=db['sequelize'][_0x091a('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db['sequelize']['import'](_0x091a('0xc3'));db['ServicenowAccount']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xc4'));db[_0x091a('0xc5')]=db[_0x091a('0x4')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x091a('0xc6')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xc7'));db[_0x091a('0xc8')]=db[_0x091a('0x4')]['import'](_0x091a('0xc9'));db[_0x091a('0xca')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xcb'));db[_0x091a('0xcc')]=db[_0x091a('0x4')]['import'](_0x091a('0xcd'));db[_0x091a('0xce')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xcf'));db['FreshsalesConfiguration']=db[_0x091a('0x4')][_0x091a('0x12')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x091a('0xd0')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xd1'));db[_0x091a('0xd2')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/integration/integration.model');db['Network']=db[_0x091a('0x4')][_0x091a('0x12')]('../api/network/network.model');db[_0x091a('0xd3')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/chatQueueReport/chatQueueReport.model');db[_0x091a('0xd4')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xd5'));db[_0x091a('0xd6')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xd7'));db['JscriptyQuestionReport']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xd8'));db['JscriptySessionReport']=db[_0x091a('0x4')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x091a('0xd9')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xda'));db[_0x091a('0xdb')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xdc'));db[_0x091a('0xdd')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xde'));db[_0x091a('0xdf')]=db['sequelize']['import'](_0x091a('0xe0'));db[_0x091a('0xe1')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/setting/setting.model');db['SquareOdbc']=db[_0x091a('0x4')][_0x091a('0x12')]('../api/squareOdbc/squareOdbc.model');db[_0x091a('0xe2')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xe3'));db[_0x091a('0xe4')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/squareRecording/squareRecording.model');db[_0x091a('0xe5')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/squareMessage/squareMessage.model');db[_0x091a('0xe6')]=db[_0x091a('0x4')]['import'](_0x091a('0xe7'));db['License']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xe8'));db[_0x091a('0xe9')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xea'));db['Migration']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xeb'));db['Attachment']=db[_0x091a('0x4')]['import']('../api/attachment/attachment.model');db['Plugin']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xec'));db[_0x091a('0xed')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x091a('0xee')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/chatTransferReport/chatTransferReport.model');db[_0x091a('0xef')]=db['sequelize']['import'](_0x091a('0xf0'));db[_0x091a('0xf1')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xf2'));db['SmsTransferReport']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xf3'));db[_0x091a('0xf4')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xf5'));db[_0x091a('0xf6')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xf7'));db[_0x091a('0xf8')]=db[_0x091a('0x4')]['import'](_0x091a('0xf9'));db['UserProfileSection']=db['sequelize'][_0x091a('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x091a('0xfa')]=db[_0x091a('0x4')]['import'](_0x091a('0xfb'));db[_0x091a('0xfc')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0xfd'));db[_0x091a('0xfe')]=db['sequelize'][_0x091a('0x12')](_0x091a('0xff'));db[_0x091a('0x100')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x091a('0x101')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x102'));db['WhatsappQueueReport']=db[_0x091a('0x4')][_0x091a('0x12')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x091a('0x103')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x104'));db[_0x091a('0x105')]=db['sequelize']['import'](_0x091a('0x106'));db[_0x091a('0x107')]=db['sequelize'][_0x091a('0x12')](_0x091a('0x108'));db[_0x091a('0x109')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x10a'));db[_0x091a('0x10b')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x10c'));db[_0x091a('0x10d')]=db[_0x091a('0x4')][_0x091a('0x12')](_0x091a('0x10e'));db[_0x091a('0x10f')]=db[_0x091a('0x4')][_0x091a('0x12')]('../api/user-setting/user-setting.model');db[_0x091a('0x110')]=db[_0x091a('0x4')]['import']('../api/mailInteractionHasTag/mailInteractionHasTag.model');db[_0x091a('0x111')][_0x091a('0x112')](db[_0x091a('0x1f')],{'as':_0x091a('0x1f'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x112')](db[_0x091a('0x10f')],{'as':_0x091a('0x115'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x111')]['hasMany'](db[_0x091a('0x1b')],{'as':_0x091a('0x116'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x117')](db['UserVoiceQueueRt'],{'as':_0x091a('0x118'),'foreignKey':'UserId'});db[_0x091a('0x111')][_0x091a('0x117')](db[_0x091a('0x17')],{'as':'Extensions','onDelete':_0x091a('0x113'),'hooks':!![]});db[_0x091a('0x111')][_0x091a('0x117')](db[_0x091a('0x7a')],{'as':_0x091a('0x119'),'foreignKey':_0x091a('0x114')});db['User'][_0x091a('0x117')](db[_0x091a('0x7b')],{'as':'HopperHistory','foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x117')](db[_0x091a('0x11a')],{'as':_0x091a('0x11a'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x117')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x117')](db[_0x091a('0x6c')],{'as':_0x091a('0x11b'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x117')](db['SmsInteraction'],{'as':_0x091a('0x11c'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x117')](db[_0x091a('0x4e')],{'as':_0x091a('0x11d'),'foreignKey':_0x091a('0x114')});db['User'][_0x091a('0x117')](db[_0x091a('0x11e')],{'as':'MailInteractions','foreignKey':_0x091a('0x114')});db[_0x091a('0x111')][_0x091a('0x117')](db[_0x091a('0x100')],{'as':'WhatsappInteractions','foreignKey':_0x091a('0x114')});db[_0x091a('0x111')]['hasMany'](db[_0x091a('0xfc')],{'as':'UserNotifications','foreignKey':_0x091a('0x11f')});db[_0x091a('0x111')][_0x091a('0x117')](db[_0x091a('0x78')],{'as':'Hoppers','foreignKey':'UserId','onDelete':_0x091a('0x120')});db['User'][_0x091a('0x121')](db[_0x091a('0xf8')],{'as':_0x091a('0xf8'),'foreignKey':_0x091a('0x122')});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x124')],{'as':_0x091a('0x125'),'through':_0x091a('0x126')});db[_0x091a('0x111')][_0x091a('0x123')](db['CmContact'],{'as':'Contacts','through':_0x091a('0x127')});db['User'][_0x091a('0x123')](db['CmList'],{'as':'Lists','through':_0x091a('0x128')});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0xe6')],{'through':_0x091a('0x129')});db[_0x091a('0x111')][_0x091a('0x123')](db['MailInteraction'],{'as':'MailInteractions','through':_0x091a('0x12a')});db[_0x091a('0x111')]['belongsToMany'](db[_0x091a('0x6c')],{'as':_0x091a('0x11b'),'through':_0x091a('0x12b')});db[_0x091a('0x111')][_0x091a('0x123')](db['FaxInteraction'],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x12c')],{'as':_0x091a('0x11c'),'through':_0x091a('0x12d')});db['User'][_0x091a('0x123')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x100')],{'as':'WhatsappInteractions','through':_0x091a('0x12e')});db[_0x091a('0x111')][_0x091a('0x123')](db['VoiceQueue'],{'as':_0x091a('0x12f'),'through':_0x091a('0x30'),'required':![]});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0xf6')],{'as':_0x091a('0x130'),'through':'UserVoicePrefix','required':![]});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x40')],{'as':_0x091a('0x131'),'through':_0x091a('0x34'),'required':![]});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x71')],{'as':'ChatQueues','through':_0x091a('0x32'),'required':![],'hooks':!![]});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x52')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x132')],{'as':_0x091a('0x133'),'through':_0x091a('0x38'),'required':![]});db['User']['belongsToMany'](db[_0x091a('0x65')],{'as':_0x091a('0x134'),'through':_0x091a('0x39'),'required':![]});db['User'][_0x091a('0x123')](db[_0x091a('0x105')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0xf4')],{'through':_0x091a('0x128')});db['User'][_0x091a('0x123')](db[_0x091a('0x66')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db['User'][_0x091a('0x123')](db[_0x091a('0x4b')],{'as':_0x091a('0x135'),'through':'user_has_fax_accounts'});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x3e')],{'as':_0x091a('0x136'),'through':'user_has_mail_accounts'});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x5d')],{'as':_0x091a('0x137'),'through':_0x091a('0x138')});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x55')],{'as':_0x091a('0x139'),'through':_0x091a('0x13a')});db[_0x091a('0x111')][_0x091a('0x123')](db[_0x091a('0x13b')],{'as':_0x091a('0x13c'),'through':_0x091a('0x13d')});db['VoiceChanSpy']['hasMany'](db[_0x091a('0x17')],{'as':_0x091a('0x13e'),'onDelete':'cascade','foreignKey':_0x091a('0x13f')});db[_0x091a('0x15')][_0x091a('0x117')](db[_0x091a('0x17')],{'onDelete':_0x091a('0x113')});db[_0x091a('0x17')]['hasMany'](db[_0x091a('0x17')],{'as':_0x091a('0x140'),'onDelete':_0x091a('0x113')});db[_0x091a('0x18')][_0x091a('0x123')](db[_0x091a('0x90')],{'as':_0x091a('0x141'),'through':_0x091a('0x142')});db[_0x091a('0x19')][_0x091a('0x117')](db[_0x091a('0x2e')],{'as':'Members','foreignKey':_0x091a('0x143')});db[_0x091a('0x19')][_0x091a('0x117')](db[_0x091a('0x78')],{'as':_0x091a('0x144'),'foreignKey':_0x091a('0x143')});db['VoiceQueue'][_0x091a('0x117')](db[_0x091a('0x7a')],{'as':_0x091a('0x119'),'foreignKey':'VoiceQueueId'});db[_0x091a('0x19')]['hasMany'](db['CmHopperHistory'],{'as':_0x091a('0x145'),'foreignKey':_0x091a('0x143')});db[_0x091a('0x19')][_0x091a('0x117')](db[_0x091a('0x11a')],{'as':'ReportAgentPreview','foreignKey':_0x091a('0x143')});db['VoiceQueue'][_0x091a('0x117')](db[_0x091a('0x79')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x091a('0x19')][_0x091a('0x117')](db[_0x091a('0x146')],{'as':_0x091a('0x147'),'foreignKey':_0x091a('0x143')});db[_0x091a('0x19')][_0x091a('0x121')](db[_0x091a('0x2b')],{'as':_0x091a('0x2b'),'foreignKey':'TrunkId'});db[_0x091a('0x19')]['belongsTo'](db[_0x091a('0x2b')],{'as':_0x091a('0x148'),'foreignKey':_0x091a('0x149')});db[_0x091a('0x19')][_0x091a('0x121')](db[_0x091a('0x89')],{'as':_0x091a('0x89'),'foreignKey':_0x091a('0x14a')});db['VoiceQueue'][_0x091a('0x121')](db[_0x091a('0x14b')],{'as':_0x091a('0x14c'),'foreignKey':_0x091a('0x14d')});db[_0x091a('0x19')][_0x091a('0x123')](db['CmList'],{'as':_0x091a('0x14e'),'through':_0x091a('0x14f')});db[_0x091a('0x19')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':_0x091a('0x30')});db[_0x091a('0x19')][_0x091a('0x123')](db[_0x091a('0xe6')],{'as':'Teams','through':_0x091a('0x109')});db[_0x091a('0x19')]['belongsToMany'](db[_0x091a('0xf4')],{'as':_0x091a('0x151'),'through':_0x091a('0x152')});db[_0x091a('0x1b')][_0x091a('0x121')](db['User'],{'as':_0x091a('0x111'),'foreignKey':'UserId'});db[_0x091a('0x1d')]['belongsTo'](db[_0x091a('0x111')],{'as':_0x091a('0x111'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x1f')]['hasMany'](db[_0x091a('0x153')],{'as':_0x091a('0x154'),'onDelete':'cascade','foreignKey':_0x091a('0x155'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0x091a('0x121')](db[_0x091a('0x1f')],{'foreignKey':'mailboxuser','targetKey':_0x091a('0x156')});db['VoiceCallReport'][_0x091a('0x117')](db[_0x091a('0x27')],{'as':'QueueCalls','foreignKey':_0x091a('0x157'),'constraints':![]});db['VoiceCallReport'][_0x091a('0x117')](db[_0x091a('0x25')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x091a('0x158')][_0x091a('0x121')](db[_0x091a('0x111')],{'as':'User','foreignKey':_0x091a('0x114')});db['VoiceCallReport'][_0x091a('0x121')](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db[_0x091a('0x15b')][_0x091a('0x121')](db[_0x091a('0x3e')],{'as':_0x091a('0x3e'),'foreignKey':_0x091a('0x15c')});db['MailServerIn'][_0x091a('0x121')](db[_0x091a('0x107')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0x091a('0x15d')});db['MailServerOut']['belongsTo'](db['MailAccount'],{'as':_0x091a('0x3e'),'foreignKey':_0x091a('0x15c')});db[_0x091a('0x15e')]['belongsTo'](db[_0x091a('0x107')],{'as':'CloudProvider','foreignKey':_0x091a('0x15f'),'onDelete':'restrict'});db['MailAccount'][_0x091a('0x112')](db[_0x091a('0x15b')],{'as':_0x091a('0x160'),'onDelete':_0x091a('0x113')});db[_0x091a('0x3e')][_0x091a('0x112')](db[_0x091a('0x15e')],{'as':_0x091a('0x161'),'onDelete':_0x091a('0x113')});db[_0x091a('0x3e')][_0x091a('0x117')](db[_0x091a('0x85')],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x15c'),'onDelete':_0x091a('0x113')});db[_0x091a('0x3e')][_0x091a('0x117')](db['CannedAnswer'],{'as':_0x091a('0x163'),'foreignKey':_0x091a('0x15c')});db[_0x091a('0x3e')][_0x091a('0x117')](db[_0x091a('0x164')],{'as':'Messages','foreignKey':_0x091a('0x15c')});db['MailAccount'][_0x091a('0x117')](db['MailInteraction'],{'as':'Interactions'});db[_0x091a('0x3e')][_0x091a('0x117')](db[_0x091a('0x45')],{'as':_0x091a('0x140'),'foreignKey':'MailAccountId','onDelete':_0x091a('0x113')});db[_0x091a('0x3e')][_0x091a('0x121')](db['CmList'],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166')});db[_0x091a('0x3e')][_0x091a('0x121')](db[_0x091a('0x167')],{'as':_0x091a('0x167'),'foreignKey':_0x091a('0x168')});db[_0x091a('0x3e')][_0x091a('0x121')](db['Pause'],{'as':_0x091a('0x14c'),'foreignKey':_0x091a('0x14d')});db['MailAccount'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':_0x091a('0x169')});db[_0x091a('0x40')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':'Agents','through':_0x091a('0x34')});db[_0x091a('0x40')][_0x091a('0x123')](db[_0x091a('0xe6')],{'through':_0x091a('0x16a'),'as':'Teams'});db[_0x091a('0x11e')]['hasMany'](db[_0x091a('0x164')],{'as':_0x091a('0x154'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x16b')});db[_0x091a('0x11e')]['belongsTo'](db[_0x091a('0x3e')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x15c')});db[_0x091a('0x11e')]['belongsTo'](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db['MailInteraction']['belongsTo'](db[_0x091a('0x111')],{'as':_0x091a('0x16d'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x11e')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x16f'),'as':_0x091a('0x170')});db[_0x091a('0x11e')][_0x091a('0x123')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x091a('0x171')});db[_0x091a('0x11e')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x172'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x091a('0x164')][_0x091a('0x117')](db[_0x091a('0x173')],{'as':_0x091a('0x174'),'onDelete':_0x091a('0x113')});db['MailMessage'][_0x091a('0x121')](db[_0x091a('0x111')],{'as':_0x091a('0x111')});db[_0x091a('0x164')]['belongsTo'](db[_0x091a('0x77')],{'onDelete':_0x091a('0x113'),'as':_0x091a('0x159')});db[_0x091a('0x164')]['belongsTo'](db[_0x091a('0x11e')],{'as':_0x091a('0x175'),'foreignKey':_0x091a('0x16b')});db[_0x091a('0x164')][_0x091a('0x121')](db['MailAccount'],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x15c')});db[_0x091a('0x164')][_0x091a('0x121')](db['ChatWebsite'],{'as':_0x091a('0x66'),'foreignKey':'ChatWebsiteId'});db[_0x091a('0x164')][_0x091a('0x121')](db['ChatOfflineMessage'],{'as':_0x091a('0x70'),'foreignKey':_0x091a('0x176')});db[_0x091a('0x45')]['belongsTo'](db[_0x091a('0x111')],{'onDelete':_0x091a('0x15d')});db['MailApplication']['belongsTo'](db[_0x091a('0x40')],{'onDelete':_0x091a('0x15d')});db['MailApplication'][_0x091a('0x121')](db[_0x091a('0x3e')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0x45')][_0x091a('0x121')](db[_0x091a('0x89')],{'onDelete':_0x091a('0x15d'),'foreignKey':'IntervalId'});db[_0x091a('0x45')]['belongsTo'](db[_0x091a('0x16e')],{'onDelete':_0x091a('0x15d'),'foreignKey':_0x091a('0x177')});db[_0x091a('0x46')][_0x091a('0x121')](db[_0x091a('0x3e')],{});db[_0x091a('0x46')]['belongsTo'](db[_0x091a('0xf4')],{'as':'List','foreignKey':_0x091a('0x166')});db[_0x091a('0x46')][_0x091a('0x121')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x091a('0x46')][_0x091a('0x121')](db[_0x091a('0x11e')],{});db[_0x091a('0x46')][_0x091a('0x121')](db[_0x091a('0x164')],{});db[_0x091a('0x46')][_0x091a('0x121')](db['User'],{});db['MailQueueReport'][_0x091a('0x121')](db[_0x091a('0x40')],{});db[_0x091a('0x48')][_0x091a('0x117')](db[_0x091a('0x49')],{'as':_0x091a('0x178'),'onDelete':_0x091a('0x113')});db[_0x091a('0x4b')][_0x091a('0x117')](db[_0x091a('0x85')],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x179'),'onDelete':_0x091a('0x113')});db[_0x091a('0x4b')][_0x091a('0x117')](db[_0x091a('0x83')],{'as':'Answers','foreignKey':_0x091a('0x179')});db[_0x091a('0x4b')][_0x091a('0x117')](db['FaxInteraction'],{'as':'Interactions'});db[_0x091a('0x4b')][_0x091a('0x117')](db[_0x091a('0x4d')],{'as':'Applications','foreignKey':'FaxAccountId','onDelete':_0x091a('0x113')});db[_0x091a('0x4b')][_0x091a('0x117')](db[_0x091a('0x17')],{'as':'Exntensions','onDelete':_0x091a('0x113')});db['FaxAccount']['hasMany'](db[_0x091a('0x50')],{'as':_0x091a('0x154')});db[_0x091a('0x4b')]['belongsTo'](db[_0x091a('0x2b')],{'as':_0x091a('0x2b')});db[_0x091a('0x4b')][_0x091a('0x121')](db['CmList'],{'as':'List','foreignKey':_0x091a('0x166')});db[_0x091a('0x4b')][_0x091a('0x121')](db[_0x091a('0x14b')],{'as':_0x091a('0x14c'),'foreignKey':_0x091a('0x14d')});db[_0x091a('0x4b')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':_0x091a('0x17a')});db['FaxApplication'][_0x091a('0x121')](db[_0x091a('0x111')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0x4d')]['belongsTo'](db[_0x091a('0x52')],{'onDelete':'restrict'});db[_0x091a('0x4d')][_0x091a('0x121')](db[_0x091a('0x4b')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0x4d')][_0x091a('0x121')](db[_0x091a('0x16e')],{'onDelete':'restrict','foreignKey':_0x091a('0x177')});db[_0x091a('0x4e')][_0x091a('0x117')](db[_0x091a('0x50')],{'as':'Messages','onDelete':_0x091a('0x113'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0x091a('0x121')](db[_0x091a('0x4b')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x179')});db[_0x091a('0x4e')][_0x091a('0x121')](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db[_0x091a('0x4e')][_0x091a('0x121')](db[_0x091a('0x111')],{'as':_0x091a('0x16d'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x4e')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x17b'),'as':_0x091a('0x170')});db[_0x091a('0x4e')]['belongsToMany'](db[_0x091a('0x16e')],{'through':'fax_interaction_has_tags','as':_0x091a('0x171')});db['FaxInteraction']['belongsToMany'](db['User'],{'as':_0x091a('0x172'),'through':_0x091a('0x17c'),'foreignKey':_0x091a('0x17d')});db[_0x091a('0x50')][_0x091a('0x121')](db[_0x091a('0x111')],{'onDelete':_0x091a('0x113'),'as':_0x091a('0x111')});db[_0x091a('0x50')]['belongsTo'](db[_0x091a('0x4e')],{'as':_0x091a('0x175'),'foreignKey':_0x091a('0x17d')});db[_0x091a('0x50')][_0x091a('0x121')](db[_0x091a('0x77')],{'onDelete':_0x091a('0x113'),'as':_0x091a('0x159')});db[_0x091a('0x50')][_0x091a('0x121')](db['Attachment'],{'as':_0x091a('0x173'),'foreignKey':_0x091a('0x17e')});db['FaxMessage'][_0x091a('0x121')](db[_0x091a('0x4b')],{'as':'Account','foreignKey':_0x091a('0x179')});db[_0x091a('0x52')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':'Agents','through':_0x091a('0x36')});db[_0x091a('0x52')][_0x091a('0x123')](db['Team'],{'through':_0x091a('0x17f'),'as':'Teams'});db[_0x091a('0x180')][_0x091a('0x121')](db[_0x091a('0x4b')],{});db[_0x091a('0x180')][_0x091a('0x121')](db['CmList'],{'as':'List','foreignKey':_0x091a('0x166')});db[_0x091a('0x180')][_0x091a('0x121')](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db[_0x091a('0x180')][_0x091a('0x121')](db[_0x091a('0x4e')],{});db[_0x091a('0x180')]['belongsTo'](db['FaxMessage'],{});db[_0x091a('0x180')]['belongsTo'](db['User'],{});db[_0x091a('0x180')][_0x091a('0x121')](db['FaxQueue'],{});db[_0x091a('0x55')][_0x091a('0x117')](db['Disposition'],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x181'),'onDelete':_0x091a('0x113')});db[_0x091a('0x55')][_0x091a('0x117')](db[_0x091a('0x83')],{'as':_0x091a('0x163'),'foreignKey':_0x091a('0x181')});db[_0x091a('0x55')][_0x091a('0x117')](db[_0x091a('0x5a')],{'as':_0x091a('0x154'),'foreignKey':_0x091a('0x181')});db['SmsAccount']['hasMany'](db[_0x091a('0x12c')],{'as':_0x091a('0x182')});db[_0x091a('0x55')][_0x091a('0x117')](db['SmsApplication'],{'as':_0x091a('0x140'),'foreignKey':_0x091a('0x181'),'onDelete':_0x091a('0x113')});db[_0x091a('0x55')]['belongsTo'](db['CmList'],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166')});db[_0x091a('0x55')][_0x091a('0x121')](db[_0x091a('0x14b')],{'as':_0x091a('0x14c'),'foreignKey':_0x091a('0x14d')});db[_0x091a('0x55')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':'user_has_sms_accounts'});db[_0x091a('0x57')][_0x091a('0x121')](db[_0x091a('0x111')],{'onDelete':'restrict'});db[_0x091a('0x57')][_0x091a('0x121')](db[_0x091a('0x132')],{'onDelete':'restrict'});db[_0x091a('0x57')][_0x091a('0x121')](db[_0x091a('0x55')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0x57')][_0x091a('0x121')](db[_0x091a('0x89')],{'onDelete':'restrict','foreignKey':_0x091a('0x14a')});db[_0x091a('0x57')][_0x091a('0x121')](db[_0x091a('0x16e')],{'onDelete':_0x091a('0x15d'),'foreignKey':_0x091a('0x177')});db[_0x091a('0x12c')][_0x091a('0x117')](db['SmsMessage'],{'as':_0x091a('0x154'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x183')});db[_0x091a('0x12c')][_0x091a('0x121')](db[_0x091a('0x55')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x181')});db[_0x091a('0x12c')][_0x091a('0x121')](db[_0x091a('0x77')],{'as':'Contact','foreignKey':'ContactId'});db['SmsInteraction']['belongsTo'](db[_0x091a('0x111')],{'as':_0x091a('0x16d'),'foreignKey':'UserId'});db['SmsInteraction'][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x184'),'as':_0x091a('0x170')});db[_0x091a('0x12c')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x184'),'as':_0x091a('0x171')});db[_0x091a('0x12c')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x172'),'through':'user_has_sms_interactions','foreignKey':_0x091a('0x183')});db['SmsMessage'][_0x091a('0x121')](db[_0x091a('0x111')],{'as':_0x091a('0x111')});db[_0x091a('0x5a')]['belongsTo'](db[_0x091a('0x77')],{'onDelete':'cascade','as':_0x091a('0x159')});db['SmsMessage'][_0x091a('0x121')](db['SmsInteraction'],{'onDelete':_0x091a('0x113'),'as':_0x091a('0x175'),'foreignKey':_0x091a('0x183')});db['SmsMessage'][_0x091a('0x121')](db[_0x091a('0x55')],{'as':_0x091a('0x16c'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':_0x091a('0x38'),'foreignKey':_0x091a('0x185')});db[_0x091a('0x132')][_0x091a('0x123')](db[_0x091a('0xe6')],{'through':_0x091a('0x186'),'as':_0x091a('0x187')});db[_0x091a('0x5d')][_0x091a('0x117')](db[_0x091a('0x85')],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x188'),'onDelete':'cascade'});db['OpenchannelAccount']['hasMany'](db[_0x091a('0x83')],{'as':_0x091a('0x163'),'foreignKey':_0x091a('0x188')});db['OpenchannelAccount'][_0x091a('0x117')](db[_0x091a('0x61')],{'as':_0x091a('0x182'),'foreignKey':_0x091a('0x188')});db[_0x091a('0x5d')][_0x091a('0x117')](db[_0x091a('0x63')],{'as':_0x091a('0x154'),'foreignKey':_0x091a('0x188')});db[_0x091a('0x5d')][_0x091a('0x117')](db[_0x091a('0x5f')],{'as':_0x091a('0x140'),'foreignKey':_0x091a('0x188'),'onDelete':_0x091a('0x113')});db[_0x091a('0x5d')][_0x091a('0x121')](db[_0x091a('0xf4')],{'as':'List','foreignKey':_0x091a('0x166')});db[_0x091a('0x5d')][_0x091a('0x121')](db[_0x091a('0x14b')],{'as':_0x091a('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':_0x091a('0x138')});db['OpenchannelApplication'][_0x091a('0x121')](db[_0x091a('0x111')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0x5f')][_0x091a('0x121')](db[_0x091a('0x65')],{'onDelete':'restrict','foreignKey':_0x091a('0x189')});db['OpenchannelApplication']['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x091a('0x15d'),'foreignKey':_0x091a('0x188')});db['OpenchannelApplication'][_0x091a('0x121')](db[_0x091a('0x89')],{'onDelete':_0x091a('0x15d'),'foreignKey':'IntervalId'});db[_0x091a('0x5f')][_0x091a('0x121')](db['Tag'],{'onDelete':_0x091a('0x15d'),'foreignKey':_0x091a('0x177')});db[_0x091a('0x61')][_0x091a('0x117')](db['OpenchannelMessage'],{'as':_0x091a('0x154'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0x091a('0x61')]['belongsTo'](db[_0x091a('0x5d')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x188')});db[_0x091a('0x61')]['belongsTo'](db[_0x091a('0x77')],{'as':'Contact','foreignKey':_0x091a('0x15a')});db[_0x091a('0x61')]['belongsTo'](db[_0x091a('0x111')],{'as':'Owner','foreignKey':_0x091a('0x114')});db['OpenchannelInteraction']['belongsToMany'](db[_0x091a('0x16e')],{'through':'openchannel_interaction_has_tags','as':_0x091a('0x170')});db[_0x091a('0x61')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x18a'),'as':'ThroughTags'});db['OpenchannelInteraction'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x172'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x091a('0x63')][_0x091a('0x121')](db[_0x091a('0x111')],{'onDelete':_0x091a('0x113'),'as':_0x091a('0x111')});db[_0x091a('0x63')][_0x091a('0x121')](db[_0x091a('0x77')],{'onDelete':_0x091a('0x113'),'as':'Contact'});db[_0x091a('0x63')][_0x091a('0x121')](db[_0x091a('0x61')],{'onDelete':_0x091a('0x113'),'as':'Interaction','foreignKey':_0x091a('0x18b')});db[_0x091a('0x63')][_0x091a('0x121')](db[_0x091a('0x173')],{'as':'Attachment','foreignKey':_0x091a('0x17e')});db[_0x091a('0x63')]['belongsTo'](db[_0x091a('0x5d')],{'as':'Account','foreignKey':_0x091a('0x188')});db[_0x091a('0x65')][_0x091a('0x123')](db['User'],{'as':_0x091a('0x150'),'through':'UserOpenchannelQueue','foreignKey':_0x091a('0x189')});db[_0x091a('0x65')][_0x091a('0x123')](db[_0x091a('0xe6')],{'through':_0x091a('0x18c'),'as':_0x091a('0x187')});db[_0x091a('0x66')]['hasMany'](db[_0x091a('0x85')],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x18d'),'onDelete':_0x091a('0x113')});db['ChatWebsite']['hasMany'](db[_0x091a('0x83')],{'as':_0x091a('0x163'),'foreignKey':_0x091a('0x18d')});db[_0x091a('0x66')][_0x091a('0x117')](db['ChatProactiveAction'],{'as':_0x091a('0x18e')});db[_0x091a('0x66')][_0x091a('0x117')](db[_0x091a('0x6c')],{'as':_0x091a('0x182')});db['ChatWebsite'][_0x091a('0x117')](db[_0x091a('0x6a')],{'as':_0x091a('0x140'),'foreignKey':'ChatWebsiteId','onDelete':_0x091a('0x113')});db[_0x091a('0x66')]['hasMany'](db[_0x091a('0x6e')],{'as':_0x091a('0x154')});db[_0x091a('0x66')][_0x091a('0x121')](db[_0x091a('0xf4')],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166')});db['ChatWebsite'][_0x091a('0x121')](db[_0x091a('0x89')],{'as':_0x091a('0x89'),'foreignKey':'IntervalId'});db[_0x091a('0x66')][_0x091a('0x121')](db['MailAccount'],{'as':_0x091a('0x3e'),'foreignKey':'MailAccountId'});db[_0x091a('0x66')][_0x091a('0x121')](db['Pause'],{'as':_0x091a('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':'Agents','through':'user_has_chat_websites'});db[_0x091a('0x68')][_0x091a('0x121')](db[_0x091a('0x5d')],{});db[_0x091a('0x68')]['belongsTo'](db['CmList'],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166')});db[_0x091a('0x68')]['belongsTo'](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db[_0x091a('0x68')][_0x091a('0x121')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x091a('0x121')](db['User'],{});db[_0x091a('0x68')][_0x091a('0x121')](db[_0x091a('0x65')],{});db[_0x091a('0x6a')][_0x091a('0x121')](db[_0x091a('0x111')],{'as':_0x091a('0x18f'),'foreignKey':_0x091a('0x114'),'onDelete':_0x091a('0x15d')});db['ChatApplication'][_0x091a('0x121')](db[_0x091a('0x71')],{'as':_0x091a('0x190'),'foreignKey':_0x091a('0x191'),'onDelete':_0x091a('0x15d')});db[_0x091a('0x6a')][_0x091a('0x121')](db[_0x091a('0x66')],{'as':_0x091a('0x192'),'foreignKey':_0x091a('0x18d'),'onDelete':'restrict'});db[_0x091a('0x6a')][_0x091a('0x121')](db[_0x091a('0x16e')],{'onDelete':_0x091a('0x15d'),'foreignKey':'TagId'});db[_0x091a('0x6c')]['hasMany'](db[_0x091a('0x6e')],{'as':_0x091a('0x154'),'onDelete':_0x091a('0x113'),'foreignKey':'ChatInteractionId'});db[_0x091a('0x6c')][_0x091a('0x121')](db[_0x091a('0x66')],{'as':_0x091a('0x16c'),'foreignKey':'ChatWebsiteId'});db[_0x091a('0x6c')][_0x091a('0x121')](db['CmContact'],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db['ChatInteraction'][_0x091a('0x121')](db[_0x091a('0x111')],{'as':_0x091a('0x16d'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x6c')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x193'),'as':_0x091a('0x170')});db['ChatInteraction'][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x193'),'as':_0x091a('0x171')});db[_0x091a('0x6c')][_0x091a('0x123')](db['User'],{'as':'Users','through':_0x091a('0x12b'),'foreignKey':_0x091a('0x194')});db['ChatMessage'][_0x091a('0x121')](db[_0x091a('0x111')],{'onDelete':_0x091a('0x113'),'as':_0x091a('0x111')});db[_0x091a('0x6e')]['belongsTo'](db['CmContact'],{'onDelete':_0x091a('0x113'),'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db['ChatMessage'][_0x091a('0x121')](db[_0x091a('0x6c')],{'onDelete':'cascade','as':_0x091a('0x175'),'foreignKey':_0x091a('0x194')});db[_0x091a('0x6e')][_0x091a('0x121')](db[_0x091a('0x173')],{'as':_0x091a('0x173'),'foreignKey':_0x091a('0x17e')});db[_0x091a('0x6e')][_0x091a('0x121')](db[_0x091a('0x66')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x18d')});db[_0x091a('0x70')]['hasMany'](db['Attachment'],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage'][_0x091a('0x121')](db['CmContact'],{'onDelete':'cascade','as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db[_0x091a('0x70')][_0x091a('0x121')](db[_0x091a('0x66')],{'as':'Account','foreignKey':_0x091a('0x18d')});db['ChatQueue'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x091a('0x71')][_0x091a('0x123')](db[_0x091a('0xe6')],{'through':_0x091a('0x195'),'as':_0x091a('0x187')});db[_0x091a('0x124')][_0x091a('0x117')](db[_0x091a('0xd4')],{'as':_0x091a('0x154'),'foreignKey':'ChatGroupId','onDelete':_0x091a('0x113')});db[_0x091a('0x124')][_0x091a('0x123')](db['User'],{'as':'Members','through':_0x091a('0x126')});db[_0x091a('0x74')][_0x091a('0x121')](db['ChatWebsite'],{'as':_0x091a('0x192'),'foreignKey':_0x091a('0x18d')});db['CmCompany'][_0x091a('0x117')](db[_0x091a('0x77')],{'as':_0x091a('0x196'),'foreignKey':_0x091a('0x197')});db[_0x091a('0x77')][_0x091a('0x117')](db[_0x091a('0x93')],{'as':'Phones','foreignKey':'CmContactId'});db[_0x091a('0x77')][_0x091a('0x117')](db[_0x091a('0x78')],{'as':'Hoppers','foreignKey':_0x091a('0x15a')});db[_0x091a('0x77')]['hasMany'](db[_0x091a('0x7a')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0x091a('0x77')]['hasMany'](db[_0x091a('0x7b')],{'as':_0x091a('0x145'),'foreignKey':_0x091a('0x15a')});db['CmContact']['hasMany'](db[_0x091a('0x11a')],{'as':_0x091a('0x11a'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0x091a('0x146')],{'as':_0x091a('0x147'),'foreignKey':_0x091a('0x15a')});db[_0x091a('0x77')][_0x091a('0x117')](db[_0x091a('0x61')],{'as':'OpenchannelInteractions','foreignKey':_0x091a('0x15a'),'onDelete':_0x091a('0x15d')});db[_0x091a('0x77')]['hasMany'](db[_0x091a('0x6c')],{'as':_0x091a('0x11b'),'foreignKey':'ContactId','onDelete':_0x091a('0x15d')});db['CmContact'][_0x091a('0x117')](db[_0x091a('0x12c')],{'as':'SmsInteractions','foreignKey':_0x091a('0x15a'),'onDelete':_0x091a('0x15d')});db[_0x091a('0x77')][_0x091a('0x117')](db[_0x091a('0x4e')],{'as':'FaxInteractions','foreignKey':_0x091a('0x15a'),'onDelete':_0x091a('0x15d')});db[_0x091a('0x77')][_0x091a('0x117')](db[_0x091a('0x11e')],{'as':_0x091a('0x198'),'foreignKey':_0x091a('0x15a'),'onDelete':_0x091a('0x15d')});db[_0x091a('0x77')][_0x091a('0x121')](db[_0x091a('0x76')],{'as':_0x091a('0x199'),'foreignKey':_0x091a('0x197')});db[_0x091a('0x77')][_0x091a('0x121')](db[_0x091a('0xf4')],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166'),'onDelete':_0x091a('0x113')});db[_0x091a('0x77')][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x172'),'through':'cm_user_has_contacts'});db[_0x091a('0x77')]['belongsToMany'](db['Tag'],{'as':_0x091a('0x170'),'through':_0x091a('0x19a')});db['CmContact'][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x19a'),'as':_0x091a('0x171')});db['CmHopper']['hasMany'](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0x091a('0x19b')});db['CmHopper']['belongsTo'](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a'),'onDelete':_0x091a('0x113')});db['CmHopper'][_0x091a('0x121')](db['CmList'],{'as':'List','foreignKey':_0x091a('0x166'),'onDelete':_0x091a('0x113')});db[_0x091a('0x78')]['belongsTo'](db[_0x091a('0x111')],{'as':'Agent','foreignKey':_0x091a('0x114')});db[_0x091a('0x78')][_0x091a('0x121')](db[_0x091a('0x19')],{'as':'Queue','foreignKey':_0x091a('0x143'),'onDelete':'cascade'});db[_0x091a('0x78')]['belongsTo'](db[_0x091a('0xe9')],{'as':_0x091a('0xe9'),'foreignKey':_0x091a('0x19c'),'onDelete':_0x091a('0x113')});db[_0x091a('0x78')][_0x091a('0x121')](db['User'],{'as':_0x091a('0x16d'),'foreignKey':_0x091a('0x19d')});db[_0x091a('0x79')][_0x091a('0x121')](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a'),'onDelete':_0x091a('0x113')});db[_0x091a('0x79')][_0x091a('0x121')](db['CmList'],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166'),'onDelete':'cascade'});db[_0x091a('0x79')][_0x091a('0x121')](db[_0x091a('0x19')],{'as':_0x091a('0x190'),'foreignKey':'VoiceQueueId','onDelete':_0x091a('0x113')});db[_0x091a('0x79')][_0x091a('0x121')](db[_0x091a('0xe9')],{'as':'Campaign','foreignKey':_0x091a('0x19c'),'onDelete':_0x091a('0x113')});db[_0x091a('0x81')]['hasMany'](db['Condition'],{'as':{'plural':'All','singular':_0x091a('0x19e')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db['Automation'][_0x091a('0x117')](db[_0x091a('0x87')],{'as':{'plural':'Any','singular':_0x091a('0x19f')},'foreignKey':_0x091a('0x1a0'),'onDelete':_0x091a('0x113'),'hooks':!![]});db[_0x091a('0x81')][_0x091a('0x117')](db[_0x091a('0x7f')],{'as':_0x091a('0x1a1'),'foreignKey':_0x091a('0x1a2'),'onDelete':'cascade','hooks':!![]});db[_0x091a('0x85')][_0x091a('0x117')](db[_0x091a('0x85')],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x1a3'),'onDelete':_0x091a('0x113')});db[_0x091a('0x89')][_0x091a('0x117')](db[_0x091a('0x89')],{'as':_0x091a('0x1a4'),'foreignKey':'IntervalId','onDelete':_0x091a('0x113'),'hooks':!![],'required':![]});db[_0x091a('0x89')]['hasMany'](db[_0x091a('0x17')],{'as':_0x091a('0x1a5'),'foreignKey':'IntervalId','onDelete':_0x091a('0x15d')});db[_0x091a('0x89')][_0x091a('0x117')](db['MailApplication'],{'as':_0x091a('0x1a6'),'foreignKey':'IntervalId'});db['Interval'][_0x091a('0x117')](db['ChatApplication'],{'as':_0x091a('0x1a7'),'foreignKey':_0x091a('0x14a')});db['Interval']['hasMany'](db[_0x091a('0x4d')],{'as':_0x091a('0x1a8'),'foreignKey':_0x091a('0x14a')});db[_0x091a('0x89')][_0x091a('0x117')](db[_0x091a('0x57')],{'as':'SmsApplications','foreignKey':_0x091a('0x14a')});db[_0x091a('0x8f')][_0x091a('0x121')](db[_0x091a('0x3e')],{});db[_0x091a('0x8f')][_0x091a('0x121')](db[_0x091a('0x9d')],{'foreignKey':_0x091a('0x1a9')});db[_0x091a('0x8f')][_0x091a('0x121')](db[_0x091a('0x1aa')],{'foreignKey':_0x091a('0x1ab')});db[_0x091a('0x90')][_0x091a('0x123')](db[_0x091a('0x18')],{'as':_0x091a('0x1ac'),'through':_0x091a('0x142'),'onDelete':_0x091a('0x15d')});db[_0x091a('0x16e')][_0x091a('0x123')](db['CmContact'],{'through':_0x091a('0x19a')});db[_0x091a('0x16e')][_0x091a('0x123')](db[_0x091a('0x6c')],{'through':'chat_interaction_has_tags'});db[_0x091a('0x16e')][_0x091a('0x123')](db[_0x091a('0x11e')],{'through':_0x091a('0x16f')});db[_0x091a('0x16e')][_0x091a('0x123')](db[_0x091a('0x12c')],{'through':_0x091a('0x184')});db[_0x091a('0x16e')][_0x091a('0x123')](db[_0x091a('0x4e')],{'through':_0x091a('0x17b')});db[_0x091a('0x16e')]['belongsToMany'](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x091a('0x16e')][_0x091a('0x123')](db[_0x091a('0x100')],{'through':_0x091a('0x1ad')});db[_0x091a('0x93')][_0x091a('0x121')](db[_0x091a('0x1ae')],{'as':_0x091a('0x1af'),'foreignKey':_0x091a('0x1b0')});db[_0x091a('0x95')]['belongsTo'](db[_0x091a('0x78')],{'as':'Hopper','foreignKey':_0x091a('0x19b')});db[_0x091a('0x93')][_0x091a('0x121')](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x1b1')});db['Trigger'][_0x091a('0x117')](db['Condition'],{'as':{'plural':_0x091a('0x1b2'),'singular':_0x091a('0x1b3')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x091a('0x1b4')][_0x091a('0x117')](db['Condition'],{'as':{'plural':_0x091a('0x1b5'),'singular':_0x091a('0x1b6')},'foreignKey':'TriggerAnyId','onDelete':_0x091a('0x113'),'hooks':!![]});db[_0x091a('0x1b4')]['hasMany'](db[_0x091a('0x7f')],{'as':_0x091a('0x1a1'),'foreignKey':_0x091a('0x1b7'),'onDelete':_0x091a('0x113'),'hooks':!![]});db[_0x091a('0x1aa')][_0x091a('0x117')](db[_0x091a('0xa2')],{'as':'Fields','onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1ab'),'hooks':!![]});db[_0x091a('0x9d')][_0x091a('0x117')](db[_0x091a('0xa2')],{'as':_0x091a('0x1b8'),'onDelete':_0x091a('0x113'),'foreignKey':'DefaultReportId'});db[_0x091a('0xa0')]['hasMany'](db[_0x091a('0xa2')],{'as':'Fields','onDelete':_0x091a('0x113'),'foreignKey':'MetricId'});db[_0x091a('0xa2')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x091a('0x1b9')});db[_0x091a('0xa5')][_0x091a('0x117')](db[_0x091a('0xa7')],{'as':_0x091a('0x1ba'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x091a('0xa7')][_0x091a('0x117')](db[_0x091a('0xa9')],{'as':_0x091a('0x1bb'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1bc')});db['SalesforceConfiguration'][_0x091a('0x117')](db[_0x091a('0xa9')],{'as':_0x091a('0x1bd'),'onDelete':'cascade','foreignKey':_0x091a('0x1be')});db['SalesforceConfiguration'][_0x091a('0x117')](db[_0x091a('0xa9')],{'as':_0x091a('0x1b8'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1bf')});db[_0x091a('0xa7')][_0x091a('0x121')](db['SalesforceAccount'],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x1c0')});db[_0x091a('0xa9')][_0x091a('0x117')](db[_0x091a('0xa9')],{'as':_0x091a('0x1c1'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0xa9')]['hasMany'](db['SalesforceField'],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db['SalesforceField'][_0x091a('0x117')](db['SalesforceField'],{'as':_0x091a('0x1c3'),'foreignKey':_0x091a('0x1bf')});db['SalesforceField'][_0x091a('0x121')](db['Variable'],{'as':_0x091a('0x97'),'foreignKey':'VariableId'});db[_0x091a('0xab')][_0x091a('0x117')](db[_0x091a('0x1c4')],{'as':_0x091a('0x1ba'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1c0')});db[_0x091a('0x1c4')]['hasMany'](db['SugarcrmField'],{'as':_0x091a('0x1bb'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0x1c4')][_0x091a('0x117')](db['SugarcrmField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x091a('0x1c4')][_0x091a('0x117')](db[_0x091a('0xad')],{'as':_0x091a('0x1b8'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1bf')});db[_0x091a('0x1c4')][_0x091a('0x121')](db[_0x091a('0xab')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x1c0')});db[_0x091a('0xad')][_0x091a('0x117')](db[_0x091a('0xad')],{'as':_0x091a('0x1c1'),'foreignKey':'SubjectId'});db[_0x091a('0xad')][_0x091a('0x117')](db[_0x091a('0xad')],{'as':_0x091a('0x1c2'),'foreignKey':'DescriptionId'});db[_0x091a('0xad')][_0x091a('0x117')](db[_0x091a('0xad')],{'as':_0x091a('0x1c3'),'foreignKey':_0x091a('0x1bf')});db[_0x091a('0xad')][_0x091a('0x121')](db[_0x091a('0x97')],{'as':_0x091a('0x97'),'foreignKey':'VariableId'});db['DeskAccount'][_0x091a('0x117')](db[_0x091a('0x1c5')],{'as':_0x091a('0x1ba'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1c0')});db['DeskConfiguration'][_0x091a('0x117')](db[_0x091a('0x1c6')],{'as':_0x091a('0x1bb'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0x1c5')]['hasMany'](db[_0x091a('0x1c6')],{'as':_0x091a('0x1bd'),'onDelete':'cascade','foreignKey':_0x091a('0x1be')});db['DeskConfiguration'][_0x091a('0x117')](db[_0x091a('0x1c6')],{'as':_0x091a('0x1b8'),'onDelete':_0x091a('0x113'),'foreignKey':'FieldId'});db[_0x091a('0x1c5')]['belongsTo'](db[_0x091a('0xaf')],{'as':_0x091a('0x16c'),'foreignKey':'AccountId'});db[_0x091a('0x1c5')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':'int_desk_configuration_has_tags'});db[_0x091a('0x1c6')][_0x091a('0x117')](db[_0x091a('0x1c6')],{'as':_0x091a('0x1c1'),'foreignKey':_0x091a('0x1bc')});db['DeskField'][_0x091a('0x117')](db[_0x091a('0x1c6')],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db[_0x091a('0x1c6')][_0x091a('0x117')](db[_0x091a('0x1c6')],{'as':_0x091a('0x1c3'),'foreignKey':_0x091a('0x1bf')});db['DeskField'][_0x091a('0x121')](db[_0x091a('0x97')],{'as':'Variable','foreignKey':_0x091a('0x1c7')});db[_0x091a('0xb2')][_0x091a('0x117')](db[_0x091a('0xb4')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x091a('0xb4')]['hasMany'](db['ZohoField'],{'as':'Subjects','onDelete':_0x091a('0x113'),'foreignKey':'SubjectId'});db[_0x091a('0xb4')][_0x091a('0x117')](db['ZohoField'],{'as':_0x091a('0x1bd'),'onDelete':_0x091a('0x113'),'foreignKey':'DescriptionId'});db[_0x091a('0xb4')][_0x091a('0x117')](db[_0x091a('0xb6')],{'as':_0x091a('0x1b8'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1bf')});db[_0x091a('0xb4')][_0x091a('0x121')](db['ZohoAccount'],{'as':'Account','foreignKey':_0x091a('0x1c0')});db[_0x091a('0xb6')][_0x091a('0x117')](db[_0x091a('0xb6')],{'as':_0x091a('0x1c1'),'foreignKey':'SubjectId'});db[_0x091a('0xb6')][_0x091a('0x117')](db['ZohoField'],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db[_0x091a('0xb6')]['hasMany'](db[_0x091a('0xb6')],{'as':_0x091a('0x1c3'),'foreignKey':'FieldId'});db[_0x091a('0xb6')][_0x091a('0x121')](db['Variable'],{'as':'Variable','foreignKey':_0x091a('0x1c7')});db['ZendeskAccount'][_0x091a('0x117')](db[_0x091a('0xba')],{'as':_0x091a('0x1ba'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1c0')});db[_0x091a('0xba')][_0x091a('0x117')](db[_0x091a('0xbb')],{'as':_0x091a('0x1bb'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0xba')][_0x091a('0x117')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x091a('0x1be')});db['ZendeskConfiguration']['hasMany'](db[_0x091a('0xbb')],{'as':'Fields','foreignKey':_0x091a('0x1bf')});db[_0x091a('0xba')]['belongsTo'](db[_0x091a('0xb8')],{'as':'Account','foreignKey':'AccountId'});db[_0x091a('0xba')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x1c8')});db[_0x091a('0xbb')][_0x091a('0x117')](db[_0x091a('0xbb')],{'as':_0x091a('0x1c1'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0xbb')][_0x091a('0x117')](db[_0x091a('0xbb')],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db['ZendeskField'][_0x091a('0x117')](db['ZendeskField'],{'as':_0x091a('0x1c3'),'foreignKey':_0x091a('0x1bf')});db['ZendeskField'][_0x091a('0x121')](db[_0x091a('0x97')],{'as':_0x091a('0x97'),'foreignKey':'VariableId'});db[_0x091a('0xbd')][_0x091a('0x117')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1c0')});db['FreshdeskConfiguration'][_0x091a('0x117')](db[_0x091a('0x1c9')],{'as':_0x091a('0x1bb'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1bc')});db['FreshdeskConfiguration'][_0x091a('0x117')](db[_0x091a('0x1c9')],{'as':'Descriptions','onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1be')});db[_0x091a('0xbe')][_0x091a('0x117')](db[_0x091a('0x1c9')],{'as':_0x091a('0x1b8'),'onDelete':'cascade','foreignKey':_0x091a('0x1bf')});db['FreshdeskConfiguration'][_0x091a('0x121')](db[_0x091a('0xbd')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x1c0')});db['FreshdeskConfiguration'][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x091a('0x1c9')][_0x091a('0x117')](db['FreshdeskField'],{'as':_0x091a('0x1c1'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0x1c9')][_0x091a('0x117')](db[_0x091a('0x1c9')],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db['FreshdeskField'][_0x091a('0x117')](db['FreshdeskField'],{'as':'Field','foreignKey':'FieldId'});db['FreshdeskField'][_0x091a('0x121')](db[_0x091a('0x97')],{'as':_0x091a('0x97'),'foreignKey':_0x091a('0x1c7')});db['VtigerAccount'][_0x091a('0x117')](db[_0x091a('0x1ca')],{'as':_0x091a('0x1ba'),'onDelete':'cascade','foreignKey':_0x091a('0x1c0')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':'Subjects','foreignKey':_0x091a('0x1bc')});db[_0x091a('0x1ca')][_0x091a('0x117')](db[_0x091a('0x1cb')],{'as':_0x091a('0x1bd'),'foreignKey':_0x091a('0x1be')});db[_0x091a('0x1ca')]['hasMany'](db[_0x091a('0x1cb')],{'as':_0x091a('0x1b8'),'foreignKey':'FieldId'});db[_0x091a('0x1ca')][_0x091a('0x121')](db[_0x091a('0xc1')],{'as':'Account','foreignKey':_0x091a('0x1c0')});db[_0x091a('0x1cb')]['hasMany'](db[_0x091a('0x1cb')],{'as':_0x091a('0x1c1'),'foreignKey':'SubjectId'});db[_0x091a('0x1cb')]['hasMany'](db[_0x091a('0x1cb')],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db[_0x091a('0x1cb')][_0x091a('0x117')](db[_0x091a('0x1cb')],{'as':'Field','foreignKey':'FieldId'});db[_0x091a('0x1cb')][_0x091a('0x121')](db[_0x091a('0x97')],{'as':'Variable','foreignKey':_0x091a('0x1c7')});db[_0x091a('0x1cc')][_0x091a('0x117')](db[_0x091a('0xc5')],{'as':_0x091a('0x1ba'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1c0')});db[_0x091a('0xc5')]['hasMany'](db[_0x091a('0xc6')],{'as':_0x091a('0x1bb'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0xc5')][_0x091a('0x117')](db['ServicenowField'],{'as':_0x091a('0x1bd'),'foreignKey':_0x091a('0x1be')});db[_0x091a('0xc5')][_0x091a('0x117')](db[_0x091a('0xc6')],{'as':_0x091a('0x1b8'),'foreignKey':_0x091a('0x1bf')});db[_0x091a('0xc5')][_0x091a('0x121')](db[_0x091a('0x1cc')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x1c0')});db['ServicenowField'][_0x091a('0x117')](db['ServicenowField'],{'as':_0x091a('0x1c1'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0xc6')][_0x091a('0x117')](db[_0x091a('0xc6')],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db[_0x091a('0xc6')][_0x091a('0x117')](db['ServicenowField'],{'as':_0x091a('0x1c3'),'foreignKey':_0x091a('0x1bf')});db['ServicenowField'][_0x091a('0x121')](db[_0x091a('0x97')],{'as':_0x091a('0x97'),'foreignKey':'VariableId'});db[_0x091a('0xc8')][_0x091a('0x117')](db[_0x091a('0xca')],{'as':_0x091a('0x1ba'),'onDelete':'cascade','foreignKey':_0x091a('0x1c0')});db[_0x091a('0xc8')][_0x091a('0x121')](db[_0x091a('0x107')],{'as':_0x091a('0x107'),'foreignKey':_0x091a('0x15f')});db[_0x091a('0xca')][_0x091a('0x117')](db[_0x091a('0xcc')],{'as':_0x091a('0x1bb'),'onDelete':_0x091a('0x113'),'foreignKey':'SubjectId'});db[_0x091a('0xca')][_0x091a('0x117')](db[_0x091a('0xcc')],{'as':_0x091a('0x1bd'),'onDelete':'cascade','foreignKey':_0x091a('0x1be')});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0x091a('0x1b8'),'onDelete':_0x091a('0x113'),'foreignKey':'FieldId'});db[_0x091a('0xca')][_0x091a('0x121')](db['Dynamics365Account'],{'as':_0x091a('0x16c'),'foreignKey':'AccountId'});db[_0x091a('0xcc')][_0x091a('0x117')](db[_0x091a('0xcc')],{'as':_0x091a('0x1c1'),'foreignKey':_0x091a('0x1bc')});db[_0x091a('0xcc')][_0x091a('0x117')](db[_0x091a('0xcc')],{'as':_0x091a('0x1c2'),'foreignKey':_0x091a('0x1be')});db['Dynamics365Field'][_0x091a('0x117')](db[_0x091a('0xcc')],{'as':_0x091a('0x1c3'),'foreignKey':'FieldId'});db[_0x091a('0xcc')]['belongsTo'](db[_0x091a('0x97')],{'as':_0x091a('0x97'),'foreignKey':_0x091a('0x1c7')});db['FreshsalesAccount'][_0x091a('0x117')](db[_0x091a('0x1cd')],{'as':_0x091a('0x1ba'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x1c0')});db[_0x091a('0x1cd')][_0x091a('0x117')](db[_0x091a('0xd0')],{'as':_0x091a('0x1bb'),'foreignKey':'SubjectId'});db[_0x091a('0x1cd')]['hasMany'](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0x091a('0x1be')});db[_0x091a('0x1cd')]['hasMany'](db[_0x091a('0xd0')],{'as':_0x091a('0x1b8'),'foreignKey':_0x091a('0x1bf')});db['FreshsalesConfiguration'][_0x091a('0x121')](db[_0x091a('0xce')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x1c0')});db[_0x091a('0xd0')][_0x091a('0x117')](db[_0x091a('0xd0')],{'as':'Subject','foreignKey':_0x091a('0x1bc')});db[_0x091a('0xd0')][_0x091a('0x117')](db[_0x091a('0xd0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x091a('0xd0')][_0x091a('0x117')](db[_0x091a('0xd0')],{'as':_0x091a('0x1c3'),'foreignKey':_0x091a('0x1bf')});db[_0x091a('0xd0')][_0x091a('0x121')](db['Variable'],{'as':_0x091a('0x97'),'foreignKey':_0x091a('0x1c7')});db[_0x091a('0xd3')]['belongsTo'](db[_0x091a('0x66')],{});db[_0x091a('0xd3')][_0x091a('0x121')](db[_0x091a('0xf4')],{'as':_0x091a('0x165'),'foreignKey':'ListId'});db['ChatQueueReport'][_0x091a('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0x091a('0x15a')});db['ChatQueueReport'][_0x091a('0x121')](db[_0x091a('0x6c')],{});db[_0x091a('0xd3')][_0x091a('0x121')](db[_0x091a('0x6e')],{});db['ChatQueueReport']['belongsTo'](db['User'],{});db[_0x091a('0xd3')][_0x091a('0x121')](db[_0x091a('0x71')],{});db[_0x091a('0xd4')][_0x091a('0x121')](db[_0x091a('0x111')],{'onDelete':'cascade','foreignKey':_0x091a('0x1ce')});db[_0x091a('0xd4')]['belongsTo'](db[_0x091a('0x111')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x091a('0x146')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x091a('0x1cf'),'onDelete':_0x091a('0x113')});db[_0x091a('0x146')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x091a('0x1cf'),'onDelete':_0x091a('0x113')});db[_0x091a('0xd9')]['belongsTo'](db[_0x091a('0x55')],{});db[_0x091a('0xd9')][_0x091a('0x121')](db[_0x091a('0xf4')],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166')});db[_0x091a('0xd9')][_0x091a('0x121')](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':_0x091a('0x15a')});db['SmsQueueReport'][_0x091a('0x121')](db[_0x091a('0x12c')],{});db[_0x091a('0xd9')][_0x091a('0x121')](db[_0x091a('0x5a')],{});db[_0x091a('0xd9')][_0x091a('0x121')](db[_0x091a('0x111')],{});db[_0x091a('0xd9')][_0x091a('0x121')](db[_0x091a('0x132')],{});db[_0x091a('0xdf')][_0x091a('0x117')](db[_0x091a('0x146')],{'foreignKey':_0x091a('0x1d0')});db[_0x091a('0xdf')][_0x091a('0x117')](db[_0x091a('0x1d1')],{'foreignKey':'ProjectId'});db[_0x091a('0xdf')][_0x091a('0x117')](db[_0x091a('0xd6')],{'foreignKey':_0x091a('0x1d0')});db['Team'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':_0x091a('0x129')});db[_0x091a('0xe6')][_0x091a('0x123')](db['VoiceQueue'],{'through':_0x091a('0x109'),'as':_0x091a('0x12f')});db['Team'][_0x091a('0x123')](db['MailQueue'],{'through':_0x091a('0x16a'),'as':_0x091a('0x131')});db['Team'][_0x091a('0x123')](db['ChatQueue'],{'through':_0x091a('0x195'),'as':_0x091a('0x1d2')});db[_0x091a('0xe6')][_0x091a('0x123')](db[_0x091a('0x52')],{'through':_0x091a('0x17f'),'as':_0x091a('0x1d3')});db[_0x091a('0xe6')][_0x091a('0x123')](db['SmsQueue'],{'through':_0x091a('0x186'),'as':_0x091a('0x133')});db['Team'][_0x091a('0x123')](db[_0x091a('0x65')],{'through':_0x091a('0x18c'),'as':_0x091a('0x134')});db[_0x091a('0xe6')][_0x091a('0x123')](db[_0x091a('0x105')],{'through':_0x091a('0x1d4'),'as':'WhatsappQueues'});db[_0x091a('0xe6')]['belongsToMany'](db[_0x091a('0xf6')],{'through':_0x091a('0x10b'),'as':_0x091a('0x130')});db[_0x091a('0xe9')][_0x091a('0x117')](db[_0x091a('0x78')],{'as':_0x091a('0x144'),'foreignKey':'CampaignId'});db[_0x091a('0xe9')][_0x091a('0x117')](db[_0x091a('0x7a')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0x091a('0xe9')][_0x091a('0x117')](db[_0x091a('0x7b')],{'as':_0x091a('0x145'),'foreignKey':'CampaignId'});db[_0x091a('0xe9')][_0x091a('0x117')](db[_0x091a('0x79')],{'as':_0x091a('0x1d5'),'foreignKey':_0x091a('0x19c')});db[_0x091a('0xe9')][_0x091a('0x121')](db['Trunk'],{'as':_0x091a('0x2b'),'foreignKey':_0x091a('0x1d6')});db['Campaign'][_0x091a('0x121')](db['Trunk'],{'as':_0x091a('0x148'),'foreignKey':_0x091a('0x149')});db[_0x091a('0xe9')][_0x091a('0x121')](db['Interval'],{'as':_0x091a('0x89'),'foreignKey':_0x091a('0x14a')});db[_0x091a('0xe9')][_0x091a('0x121')](db['SquareProject'],{'as':_0x091a('0xe2'),'foreignKey':_0x091a('0x1d7')});db[_0x091a('0xe9')][_0x091a('0x123')](db[_0x091a('0xf4')],{'as':_0x091a('0x14e'),'through':_0x091a('0x1d8')});db[_0x091a('0xe9')]['belongsToMany'](db[_0x091a('0xf4')],{'as':_0x091a('0x151'),'through':_0x091a('0x1d9')});db[_0x091a('0x173')]['belongsTo'](db[_0x091a('0x70')],{'as':_0x091a('0x70'),'foreignKey':_0x091a('0x176')});db[_0x091a('0xed')]['belongsTo'](db[_0x091a('0x164')],{});db[_0x091a('0xed')][_0x091a('0x121')](db[_0x091a('0x11e')],{});db['MailTransferReport']['belongsTo'](db[_0x091a('0x3e')],{'foreignKey':_0x091a('0x1da'),'as':'FromAccount'});db[_0x091a('0xed')][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1db'),'as':'FromAgent'});db[_0x091a('0xed')][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1dc'),'as':_0x091a('0x1dd')});db[_0x091a('0xed')]['belongsTo'](db[_0x091a('0x40')],{'foreignKey':_0x091a('0x1de'),'as':_0x091a('0x1df')});db[_0x091a('0xed')][_0x091a('0x121')](db['MailAccount'],{'foreignKey':_0x091a('0x1e0'),'as':_0x091a('0x1e1')});db[_0x091a('0xee')][_0x091a('0x121')](db['ChatMessage'],{});db[_0x091a('0xee')][_0x091a('0x121')](db[_0x091a('0x6c')],{});db[_0x091a('0xee')][_0x091a('0x121')](db[_0x091a('0x66')],{'foreignKey':_0x091a('0x1e2'),'as':_0x091a('0x1e3')});db[_0x091a('0xee')][_0x091a('0x121')](db['User'],{'foreignKey':'FromUserId','as':_0x091a('0x1e4')});db['ChatTransferReport'][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1dc'),'as':_0x091a('0x1dd')});db['ChatTransferReport']['belongsTo'](db[_0x091a('0x71')],{'foreignKey':_0x091a('0x1e5'),'as':_0x091a('0x1df')});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x091a('0x1e6'),'as':_0x091a('0x1e1')});db[_0x091a('0xef')][_0x091a('0x121')](db[_0x091a('0x50')],{});db[_0x091a('0xef')]['belongsTo'](db[_0x091a('0x4e')],{});db[_0x091a('0xef')][_0x091a('0x121')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0x091a('0x1e3')});db[_0x091a('0xef')][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1db'),'as':_0x091a('0x1e4')});db[_0x091a('0xef')][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1dc'),'as':'ToAgent'});db[_0x091a('0xef')][_0x091a('0x121')](db[_0x091a('0x52')],{'foreignKey':_0x091a('0x1e7'),'as':'ToQueue'});db[_0x091a('0xef')][_0x091a('0x121')](db[_0x091a('0x4b')],{'foreignKey':_0x091a('0x1e8'),'as':'ToAccount'});db[_0x091a('0xf1')][_0x091a('0x121')](db[_0x091a('0x63')],{});db[_0x091a('0xf1')][_0x091a('0x121')](db[_0x091a('0x61')],{});db[_0x091a('0xf1')][_0x091a('0x121')](db[_0x091a('0x5d')],{'foreignKey':'FromOpenchannelAccountId','as':_0x091a('0x1e3')});db[_0x091a('0xf1')][_0x091a('0x121')](db['User'],{'foreignKey':_0x091a('0x1db'),'as':'FromAgent'});db['OpenchannelTransferReport'][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1dc'),'as':_0x091a('0x1dd')});db[_0x091a('0xf1')][_0x091a('0x121')](db['OpenchannelQueue'],{'foreignKey':_0x091a('0x1e9'),'as':_0x091a('0x1df')});db[_0x091a('0xf1')][_0x091a('0x121')](db['OpenchannelAccount'],{'foreignKey':_0x091a('0x1ea'),'as':'ToAccount'});db[_0x091a('0x1eb')]['belongsTo'](db[_0x091a('0x5a')],{});db['SmsTransferReport'][_0x091a('0x121')](db[_0x091a('0x12c')],{});db[_0x091a('0x1eb')][_0x091a('0x121')](db[_0x091a('0x55')],{'foreignKey':_0x091a('0x1ec'),'as':'FromAccount'});db[_0x091a('0x1eb')][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':'FromUserId','as':_0x091a('0x1e4')});db[_0x091a('0x1eb')][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1dc'),'as':_0x091a('0x1dd')});db[_0x091a('0x1eb')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x091a('0x1df')});db[_0x091a('0x1eb')][_0x091a('0x121')](db['SmsAccount'],{'foreignKey':_0x091a('0x1ed'),'as':_0x091a('0x1e1')});db[_0x091a('0xf4')][_0x091a('0x117')](db['Disposition'],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x166'),'onDelete':_0x091a('0x113')});db[_0x091a('0xf4')][_0x091a('0x117')](db['CmCustomField'],{'as':_0x091a('0x1ee'),'foreignKey':_0x091a('0x166')});db[_0x091a('0xf4')][_0x091a('0x117')](db['CmContact'],{'as':_0x091a('0x196'),'onDelete':_0x091a('0x113'),'foreignKey':_0x091a('0x166')});db[_0x091a('0xf4')][_0x091a('0x117')](db[_0x091a('0x7a')],{'as':_0x091a('0x119'),'foreignKey':_0x091a('0x166')});db['CmList']['hasMany'](db[_0x091a('0x7b')],{'as':_0x091a('0x1ef'),'foreignKey':_0x091a('0x166')});db[_0x091a('0xf4')]['hasMany'](db[_0x091a('0x11a')],{'as':_0x091a('0x11a'),'foreignKey':'ListId'});db[_0x091a('0xf4')][_0x091a('0x123')](db[_0x091a('0x19')],{'as':_0x091a('0x1f0'),'through':'voice_queues_has_cm_lists'});db[_0x091a('0xf4')]['belongsToMany'](db['User'],{'as':_0x091a('0x150'),'through':_0x091a('0x128')});db[_0x091a('0xf6')][_0x091a('0x117')](db[_0x091a('0x17')],{'as':_0x091a('0x1a5'),'onDelete':_0x091a('0x113')});db['VoicePrefix'][_0x091a('0x123')](db[_0x091a('0x111')],{'as':_0x091a('0x150'),'through':'UserVoicePrefix'});db[_0x091a('0xf6')][_0x091a('0x123')](db['Team'],{'through':_0x091a('0x10b'),'as':_0x091a('0x187')});db['UserProfile']['hasMany'](db[_0x091a('0x111')],{'as':'Users','foreignKey':_0x091a('0x122')});db[_0x091a('0xf8')]['hasMany'](db[_0x091a('0x1f1')],{'as':'UserProfileSections','foreignKey':_0x091a('0x122'),'onDelete':_0x091a('0x113')});db[_0x091a('0x1f1')][_0x091a('0x117')](db['UserProfileResource'],{'as':_0x091a('0x1f2'),'foreignKey':_0x091a('0x1f3'),'onDelete':_0x091a('0x113')});db['WhatsappAccount'][_0x091a('0x117')](db[_0x091a('0x85')],{'as':_0x091a('0x162'),'foreignKey':_0x091a('0x1f4'),'onDelete':_0x091a('0x113')});db['WhatsappAccount'][_0x091a('0x117')](db[_0x091a('0x83')],{'as':_0x091a('0x163'),'foreignKey':'WhatsappAccountId'});db[_0x091a('0x13b')][_0x091a('0x117')](db[_0x091a('0x101')],{'as':'Messages','foreignKey':_0x091a('0x1f4')});db['WhatsappAccount'][_0x091a('0x117')](db[_0x091a('0x100')],{'as':_0x091a('0x182')});db[_0x091a('0x13b')][_0x091a('0x117')](db['WhatsappApplication'],{'as':_0x091a('0x140'),'foreignKey':_0x091a('0x1f4'),'onDelete':'cascade'});db['WhatsappAccount'][_0x091a('0x121')](db['CmList'],{'as':_0x091a('0x165'),'foreignKey':'ListId'});db[_0x091a('0x13b')][_0x091a('0x121')](db[_0x091a('0x14b')],{'as':_0x091a('0x14c'),'foreignKey':_0x091a('0x14d')});db[_0x091a('0x13b')][_0x091a('0x123')](db['User'],{'as':_0x091a('0x150'),'through':_0x091a('0x13d')});db['WhatsappApplication']['belongsTo'](db[_0x091a('0x111')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0xfe')][_0x091a('0x121')](db[_0x091a('0x105')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0xfe')][_0x091a('0x121')](db[_0x091a('0x13b')],{'onDelete':_0x091a('0x15d')});db[_0x091a('0xfe')]['belongsTo'](db[_0x091a('0x89')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x091a('0xfe')][_0x091a('0x121')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x091a('0x177')});db[_0x091a('0x100')][_0x091a('0x117')](db[_0x091a('0x101')],{'as':_0x091a('0x154'),'onDelete':'cascade','foreignKey':_0x091a('0x1f5')});db['WhatsappInteraction'][_0x091a('0x121')](db[_0x091a('0x13b')],{'as':_0x091a('0x16c'),'foreignKey':_0x091a('0x1f4')});db[_0x091a('0x100')]['belongsTo'](db[_0x091a('0x77')],{'as':_0x091a('0x159'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0x091a('0x121')](db['User'],{'as':_0x091a('0x16d'),'foreignKey':_0x091a('0x114')});db[_0x091a('0x100')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':_0x091a('0x1ad'),'as':_0x091a('0x170')});db[_0x091a('0x100')][_0x091a('0x123')](db[_0x091a('0x16e')],{'through':'whatsapp_interaction_has_tags','as':_0x091a('0x171')});db[_0x091a('0x100')]['belongsToMany'](db[_0x091a('0x111')],{'as':_0x091a('0x172'),'through':_0x091a('0x12e'),'foreignKey':_0x091a('0x1f5')});db[_0x091a('0x101')][_0x091a('0x121')](db[_0x091a('0x111')],{'as':_0x091a('0x111')});db['WhatsappMessage'][_0x091a('0x121')](db[_0x091a('0x77')],{'onDelete':_0x091a('0x113'),'as':'Contact'});db[_0x091a('0x101')][_0x091a('0x121')](db[_0x091a('0x100')],{'onDelete':'cascade','as':_0x091a('0x175'),'foreignKey':_0x091a('0x1f5')});db[_0x091a('0x101')][_0x091a('0x121')](db[_0x091a('0x13b')],{'as':'Account','foreignKey':_0x091a('0x1f4')});db[_0x091a('0x1f6')][_0x091a('0x121')](db['WhatsappAccount'],{});db[_0x091a('0x1f6')]['belongsTo'](db[_0x091a('0xf4')],{'as':_0x091a('0x165'),'foreignKey':_0x091a('0x166')});db[_0x091a('0x1f6')][_0x091a('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0x091a('0x15a')});db[_0x091a('0x1f6')][_0x091a('0x121')](db[_0x091a('0x100')],{});db[_0x091a('0x1f6')][_0x091a('0x121')](db[_0x091a('0x105')],{});db[_0x091a('0x1f6')]['belongsTo'](db[_0x091a('0x101')],{});db[_0x091a('0x1f6')]['belongsTo'](db[_0x091a('0x111')],{});db[_0x091a('0x103')][_0x091a('0x121')](db[_0x091a('0x101')],{});db[_0x091a('0x103')][_0x091a('0x121')](db[_0x091a('0x100')],{});db[_0x091a('0x103')][_0x091a('0x121')](db[_0x091a('0x13b')],{'foreignKey':_0x091a('0x1f7'),'as':_0x091a('0x1e3')});db[_0x091a('0x103')][_0x091a('0x121')](db[_0x091a('0x13b')],{'foreignKey':'ToWhatsappAccountId','as':_0x091a('0x1e1')});db[_0x091a('0x103')][_0x091a('0x121')](db[_0x091a('0x105')],{'foreignKey':_0x091a('0x1f8'),'as':_0x091a('0x1df')});db[_0x091a('0x103')][_0x091a('0x121')](db['User'],{'foreignKey':_0x091a('0x1db'),'as':'FromAgent'});db['WhatsappTransferReport'][_0x091a('0x121')](db[_0x091a('0x111')],{'foreignKey':_0x091a('0x1dc'),'as':_0x091a('0x1dd')});db['WhatsappQueue']['belongsToMany'](db[_0x091a('0x111')],{'as':'Agents','through':_0x091a('0x3a'),'foreignKey':_0x091a('0x1f9')});db['WhatsappQueue'][_0x091a('0x123')](db[_0x091a('0xe6')],{'through':_0x091a('0x1d4'),'as':_0x091a('0x187')});db['UserSetting'][_0x091a('0x121')](db[_0x091a('0x111')],{'as':'user','foreignKey':_0x091a('0x114'),'onDelete':'cascade','hooks':!![]});db[_0x091a('0x107')][_0x091a('0x112')](db[_0x091a('0xc8')],{'as':_0x091a('0xc8'),'onDelete':'restrict'});db[_0x091a('0x107')]['hasOne'](db['MailServerIn'],{'as':_0x091a('0x160'),'onDelete':_0x091a('0x15d')});db['CloudProvider'][_0x091a('0x112')](db['MailServerOut'],{'as':_0x091a('0x161'),'onDelete':'restrict'});module[_0x091a('0x1fa')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x4a95=['ChatOfflineMessageId','TagId','ListId','Items','Dispositions','FaxAccountId','Interactions','FaxApplication','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','ThroughTags','Users','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','user_has_sms_accounts','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatWebsiteId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Members','ChatProactiveAction','CompanyId','Phones','CmContactId','CmHopperHistory','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','OwnerId','Automation','All','OneAny','Actions','AutomationId','Intervals','Extensions','DefaultReportId','CustomReportId','ContactItemType','ItemType','ItemTypeId','Hopper','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','SubjectId','SalesforceField','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','SugarcrmField','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerAccount','ServicenowAccount','ServicenowField','Dynamics365Account','FreshsalesField','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','VoiceQueues','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','CampaignId','SquareProject','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsQueueId','CustomFields','Queues','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','sequelize','lodash','jstz','determine','defaultsDeep','motion2','mysql','utf8mb4','name','utf8','sequelizeHistory','127.0.0.1','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','userSetting','cascade','UserId','hasMany','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','MailQueues','UserMailQueue','ChatQueues','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','UserWhatsappQueue','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','VoiceCallReport','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Answers','List','TemplateId','team_has_mail_queues','Account','Owner','mail_interaction_has_tags','Tags','user_has_mail_interactions','Attachments','Interaction','MailInteractionId'];(function(_0x5486e7,_0x580d02){var _0xa9ec8f=function(_0x46852c){while(--_0x46852c){_0x5486e7['push'](_0x5486e7['shift']());}};_0xa9ec8f(++_0x580d02);}(_0x4a95,0x91));var _0x54a9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4a95[_0x3947c9];return _0x2e7871;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x54a9('0x0'));var _=require(_0x54a9('0x1'));var jstz=require(_0x54a9('0x2'));var timezone=jstz[_0x54a9('0x3')]();config['sequelize']=_[_0x54a9('0x4')](config[_0x54a9('0x0')],{'database':_0x54a9('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x54a9('0x6'),'dialectOptions':{'charset':_0x54a9('0x7')},'logging':![],'timezone':timezone[_0x54a9('0x8')](),'define':{'charset':_0x54a9('0x9'),'collate':'utf8_general_ci'}}});config[_0x54a9('0xa')]=_[_0x54a9('0x4')](config[_0x54a9('0xa')],{'database':_0x54a9('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x54a9('0xb'),'port':0xcea,'dialect':_0x54a9('0x6'),'dialectOptions':{'charset':_0x54a9('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x54a9('0x9'),'collate':_0x54a9('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x54a9('0x0')][_0x54a9('0xd')],config['sequelize'][_0x54a9('0xe')],config[_0x54a9('0x0')][_0x54a9('0xf')],config[_0x54a9('0x0')][_0x54a9('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x54a9('0xd')],config[_0x54a9('0xa')]['username'],config[_0x54a9('0xa')][_0x54a9('0xf')],config['sequelizeHistory'][_0x54a9('0x10')])};db[_0x54a9('0x11')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x13'));db['VoiceChanSpy']=db[_0x54a9('0x0')]['import'](_0x54a9('0x14'));db['VoiceContext']=db[_0x54a9('0x0')]['import']('../api/voiceContext/voiceContext.model');db[_0x54a9('0x15')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x16'));db[_0x54a9('0x17')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x18'));db[_0x54a9('0x19')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x1a'));db[_0x54a9('0x1b')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x1c'));db[_0x54a9('0x1d')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x1e'));db[_0x54a9('0x1f')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x20'));db['VoiceDialReport']=db[_0x54a9('0x0')]['import'](_0x54a9('0x21'));db[_0x54a9('0x22')]=db[_0x54a9('0x0')]['import'](_0x54a9('0x23'));db[_0x54a9('0x24')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x25'));db[_0x54a9('0x26')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/memberReport/memberReport.model');db[_0x54a9('0x27')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x28'));db['VoiceTransferReport']=db['sequelize']['import'](_0x54a9('0x29'));db[_0x54a9('0x2a')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x2b'));db[_0x54a9('0x2c')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x54a9('0x2d')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x2e'));db['UserMailQueue']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x2f'));db[_0x54a9('0x30')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/userFaxQueue/userFaxQueue.model');db[_0x54a9('0x31')]=db[_0x54a9('0x0')]['import']('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x32'));db['UserWhatsappQueue']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x54a9('0x33')]=db['sequelize']['import']('../api/mailServerIn/mailServerIn.model');db[_0x54a9('0x34')]=db[_0x54a9('0x0')]['import']('../api/mailServerOut/mailServerOut.model');db[_0x54a9('0x35')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x36'));db[_0x54a9('0x37')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x38'));db[_0x54a9('0x39')]=db[_0x54a9('0x0')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0x54a9('0x3a')]=db[_0x54a9('0x0')]['import']('../api/mailInteraction/mailInteraction.model');db[_0x54a9('0x3b')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x3c'));db[_0x54a9('0x3d')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x3e'));db[_0x54a9('0x3f')]=db['sequelize']['import'](_0x54a9('0x40'));db[_0x54a9('0x41')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x42'));db['DashboardItem']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/dashboardItem/dashboardItem.model');db[_0x54a9('0x43')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x44'));db['FaxApplication']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x45'));db[_0x54a9('0x46')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x47'));db[_0x54a9('0x48')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/faxMessage/faxMessage.model');db[_0x54a9('0x49')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x4a'));db[_0x54a9('0x4b')]=db[_0x54a9('0x0')]['import'](_0x54a9('0x4c'));db[_0x54a9('0x4d')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x4e'));db['SmsApplication']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/smsApplication/smsApplication.model');db[_0x54a9('0x4f')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x50'));db['SmsMessage']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/smsMessage/smsMessage.model');db[_0x54a9('0x51')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/smsQueue/smsQueue.model');db[_0x54a9('0x52')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x53'));db[_0x54a9('0x54')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/openchannelApplication/openchannelApplication.model');db[_0x54a9('0x55')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x56'));db[_0x54a9('0x57')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/openchannelMessage/openchannelMessage.model');db[_0x54a9('0x58')]=db['sequelize'][_0x54a9('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0x54a9('0x59')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x5a'));db[_0x54a9('0x5b')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x5c'));db['ChatApplication']=db[_0x54a9('0x0')]['import'](_0x54a9('0x5d'));db[_0x54a9('0x5e')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/chatInteraction/chatInteraction.model');db[_0x54a9('0x5f')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/chatMessage/chatMessage.model');db[_0x54a9('0x60')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x61'));db[_0x54a9('0x62')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x63'));db[_0x54a9('0x64')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x65'));db['ChatProactiveAction']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x66'));db[_0x54a9('0x67')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x68'));db['CmContact']=db[_0x54a9('0x0')]['import'](_0x54a9('0x69'));db[_0x54a9('0x6a')]=db[_0x54a9('0x0')]['import']('../api/cmHopper/cmHopper.model');db[_0x54a9('0x6b')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x6c'));db[_0x54a9('0x6d')]=db[_0x54a9('0x0')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x6e'));db[_0x54a9('0x6f')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x70'));db[_0x54a9('0x71')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x72'));db[_0x54a9('0x73')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x74'));db['Automation']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x75'));db[_0x54a9('0x76')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x77'));db[_0x54a9('0x78')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x79'));db[_0x54a9('0x7a')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x7b'));db[_0x54a9('0x7c')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x7d'));db['Pause']=db[_0x54a9('0x0')]['import'](_0x54a9('0x7e'));db[_0x54a9('0x7f')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x80'));db['VoiceQueuesLog']=db[_0x54a9('0x0')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x54a9('0x81')]=db[_0x54a9('0x0')]['import'](_0x54a9('0x82'));db[_0x54a9('0x83')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x84'));db[_0x54a9('0x85')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x86'));db['ContactItemType']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/contactItemType/contactItemType.model');db[_0x54a9('0x87')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x88'));db[_0x54a9('0x89')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x54a9('0x8a')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/template/template.model');db[_0x54a9('0x8b')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/trigger/trigger.model');db[_0x54a9('0x8c')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x8d'));db[_0x54a9('0x8e')]=db[_0x54a9('0x0')]['import'](_0x54a9('0x8f'));db['IntegrationReport']=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x90'));db[_0x54a9('0x91')]=db[_0x54a9('0x0')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x54a9('0x92')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x54a9('0x93')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x94'));db[_0x54a9('0x95')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x96'));db[_0x54a9('0x97')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x98'));db[_0x54a9('0x99')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x9a'));db['SalesforceAccount']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x9b'));db[_0x54a9('0x9c')]=db[_0x54a9('0x0')]['import'](_0x54a9('0x9d'));db['SalesforceField']=db['sequelize']['import']('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x54a9('0x0')]['import'](_0x54a9('0x9e'));db[_0x54a9('0x9f')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xa0'));db['SugarcrmField']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xa1'));db[_0x54a9('0xa2')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xa3'));db['DeskConfiguration']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x54a9('0xa4')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xa5'));db['ZohoAccount']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xa6'));db['ZohoConfiguration']=db[_0x54a9('0x0')]['import'](_0x54a9('0xa7'));db[_0x54a9('0xa8')]=db[_0x54a9('0x0')]['import'](_0x54a9('0xa9'));db[_0x54a9('0xaa')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xab'));db[_0x54a9('0xac')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db['sequelize']['import'](_0x54a9('0xad'));db[_0x54a9('0xae')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xaf'));db[_0x54a9('0xb0')]=db[_0x54a9('0x0')]['import'](_0x54a9('0xb1'));db[_0x54a9('0xb2')]=db['sequelize'][_0x54a9('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xb3'));db['VtigerConfiguration']=db[_0x54a9('0x0')]['import'](_0x54a9('0xb4'));db[_0x54a9('0xb5')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xb6'));db['ServicenowAccount']=db['sequelize'][_0x54a9('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x54a9('0xb7')]=db['sequelize']['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db['sequelize'][_0x54a9('0x12')]('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xb8'));db[_0x54a9('0xb9')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xba'));db[_0x54a9('0xbb')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xbc'));db[_0x54a9('0xbd')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xbe'));db[_0x54a9('0xbf')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xc0'));db['FreshsalesField']=db['sequelize']['import']('../api/intFreshsalesField/intFreshsalesField.model');db[_0x54a9('0x8e')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0x8f'));db[_0x54a9('0xc1')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xc2'));db[_0x54a9('0xc3')]=db[_0x54a9('0x0')]['import'](_0x54a9('0xc4'));db['ChatInternalMessage']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xc5'));db[_0x54a9('0xc6')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xc7'));db['JscriptyQuestionReport']=db[_0x54a9('0x0')]['import'](_0x54a9('0xc8'));db[_0x54a9('0xc9')]=db[_0x54a9('0x0')]['import'](_0x54a9('0xca'));db[_0x54a9('0xcb')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0xcc'));db[_0x54a9('0xcd')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xce'));db[_0x54a9('0xcf')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xd0'));db[_0x54a9('0xd1')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xd2'));db[_0x54a9('0xd3')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xd4'));db['SquareOdbc']=db['sequelize'][_0x54a9('0x12')](_0x54a9('0xd5'));db['SquareProject']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0x54a9('0x0')]['import']('../api/squareRecording/squareRecording.model');db[_0x54a9('0xd6')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xd7'));db[_0x54a9('0xd8')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xd9'));db[_0x54a9('0xda')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xdb'));db[_0x54a9('0xdc')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xdd'));db['Migration']=db[_0x54a9('0x0')]['import']('../api/migration/migration.model');db[_0x54a9('0xde')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xdf'));db['Plugin']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/plugin/plugin.model');db[_0x54a9('0xe0')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0xe1'));db[_0x54a9('0xe2')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xe3'));db[_0x54a9('0xe4')]=db['sequelize']['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x54a9('0xe5')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0xe6'));db['SmsTransferReport']=db['sequelize'][_0x54a9('0x12')](_0x54a9('0xe7'));db[_0x54a9('0xe8')]=db[_0x54a9('0x0')]['import'](_0x54a9('0xe9'));db[_0x54a9('0xea')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x54a9('0xeb')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xec'));db['UserProfileSection']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x54a9('0xed')]=db[_0x54a9('0x0')]['import'](_0x54a9('0xee'));db[_0x54a9('0xef')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xf0'));db[_0x54a9('0xf1')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xf2'));db[_0x54a9('0xf3')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xf4'));db['WhatsappInteraction']=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x54a9('0xf5')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xf6'));db[_0x54a9('0xf7')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0x54a9('0x0')]['import'](_0x54a9('0xf8'));db[_0x54a9('0xf9')]=db['sequelize'][_0x54a9('0x12')]('../api/whatsappQueue/whatsappQueue.model');db[_0x54a9('0xfa')]=db['sequelize']['import'](_0x54a9('0xfb'));db['TeamVoiceQueue']=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xfc'));db[_0x54a9('0xfd')]=db[_0x54a9('0x0')][_0x54a9('0x12')](_0x54a9('0xfe'));db[_0x54a9('0xff')]=db[_0x54a9('0x0')][_0x54a9('0x12')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x54a9('0x100')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x101'));db[_0x54a9('0x102')]=db['sequelize'][_0x54a9('0x12')](_0x54a9('0x103'));db[_0x54a9('0x11')]['hasOne'](db[_0x54a9('0x1d')],{'as':_0x54a9('0x1d'),'onDelete':'cascade','foreignKey':'UserId'});db['User'][_0x54a9('0x104')](db['UserSetting'],{'as':_0x54a9('0x105'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x11')][_0x54a9('0x108')](db[_0x54a9('0x1b')],{'as':'Recordings','foreignKey':_0x54a9('0x107')});db['User'][_0x54a9('0x108')](db[_0x54a9('0x2a')],{'as':_0x54a9('0x109'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x11')][_0x54a9('0x108')](db[_0x54a9('0x15')],{'as':'Extensions','onDelete':_0x54a9('0x106'),'hooks':!![]});db['User'][_0x54a9('0x108')](db[_0x54a9('0x6d')],{'as':_0x54a9('0x10a'),'foreignKey':'UserId'});db['User'][_0x54a9('0x108')](db['CmHopperHistory'],{'as':_0x54a9('0x10b'),'foreignKey':_0x54a9('0x107')});db['User'][_0x54a9('0x108')](db[_0x54a9('0x6f')],{'as':_0x54a9('0x6f'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x11')][_0x54a9('0x108')](db[_0x54a9('0x55')],{'as':_0x54a9('0x10c'),'foreignKey':'UserId'});db[_0x54a9('0x11')][_0x54a9('0x108')](db[_0x54a9('0x5e')],{'as':_0x54a9('0x10d'),'foreignKey':_0x54a9('0x107')});db['User'][_0x54a9('0x108')](db[_0x54a9('0x4f')],{'as':_0x54a9('0x10e'),'foreignKey':_0x54a9('0x107')});db['User'][_0x54a9('0x108')](db[_0x54a9('0x46')],{'as':_0x54a9('0x10f'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x11')]['hasMany'](db[_0x54a9('0x3a')],{'as':_0x54a9('0x110'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x11')][_0x54a9('0x108')](db[_0x54a9('0x111')],{'as':_0x54a9('0x112'),'foreignKey':_0x54a9('0x107')});db['User'][_0x54a9('0x108')](db[_0x54a9('0xef')],{'as':_0x54a9('0x113'),'foreignKey':'SenderId'});db[_0x54a9('0x11')][_0x54a9('0x108')](db[_0x54a9('0x6a')],{'as':_0x54a9('0x114'),'foreignKey':_0x54a9('0x107'),'onDelete':_0x54a9('0x115')});db['User'][_0x54a9('0x116')](db['UserProfile'],{'as':_0x54a9('0xeb'),'foreignKey':_0x54a9('0x117')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x64')],{'as':_0x54a9('0x119'),'through':_0x54a9('0x11a')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x11b')],{'as':_0x54a9('0x11c'),'through':_0x54a9('0x11d')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0xe8')],{'as':'Lists','through':_0x54a9('0x11e')});db['User']['belongsToMany'](db['Team'],{'through':_0x54a9('0x11f')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x3a')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x5e')],{'as':'ChatInteractions','through':_0x54a9('0x120')});db[_0x54a9('0x11')]['belongsToMany'](db[_0x54a9('0x46')],{'as':_0x54a9('0x10f'),'through':'user_has_fax_interactions'});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x4f')],{'as':_0x54a9('0x10e'),'through':_0x54a9('0x121')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x55')],{'as':'OpenchannelInteractions','through':_0x54a9('0x122')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x111')],{'as':_0x54a9('0x112'),'through':_0x54a9('0x123')});db[_0x54a9('0x11')]['belongsToMany'](db[_0x54a9('0x19')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0xea')],{'as':_0x54a9('0x124'),'through':'UserVoicePrefix','required':![]});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x37')],{'as':_0x54a9('0x125'),'through':_0x54a9('0x126'),'required':![]});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x62')],{'as':_0x54a9('0x127'),'through':_0x54a9('0x2d'),'required':![],'hooks':!![]});db[_0x54a9('0x11')]['belongsToMany'](db[_0x54a9('0x49')],{'as':'FaxQueues','through':_0x54a9('0x30'),'required':![]});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x51')],{'as':_0x54a9('0x128'),'through':_0x54a9('0x31'),'required':![]});db[_0x54a9('0x11')]['belongsToMany'](db[_0x54a9('0x58')],{'as':_0x54a9('0x129'),'through':_0x54a9('0x12a'),'required':![]});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0xf9')],{'as':_0x54a9('0x12b'),'through':_0x54a9('0x12c'),'required':![]});db[_0x54a9('0x11')][_0x54a9('0x118')](db['CmList'],{'through':'cm_user_has_lists'});db['User'][_0x54a9('0x118')](db[_0x54a9('0x59')],{'as':_0x54a9('0x12d'),'through':_0x54a9('0x12e')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x43')],{'as':_0x54a9('0x12f'),'through':'user_has_fax_accounts'});db['User'][_0x54a9('0x118')](db[_0x54a9('0x35')],{'as':_0x54a9('0x130'),'through':'user_has_mail_accounts'});db[_0x54a9('0x11')][_0x54a9('0x118')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x54a9('0x131')});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0x4d')],{'as':_0x54a9('0x132'),'through':'user_has_sms_accounts'});db[_0x54a9('0x11')][_0x54a9('0x118')](db[_0x54a9('0xf1')],{'as':_0x54a9('0x133'),'through':'user_has_whatsapp_accounts'});db['VoiceChanSpy'][_0x54a9('0x108')](db[_0x54a9('0x15')],{'as':_0x54a9('0x134'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x135')});db['VoiceContext'][_0x54a9('0x108')](db[_0x54a9('0x15')],{'onDelete':'cascade'});db[_0x54a9('0x15')][_0x54a9('0x108')](db['VoiceExtension'],{'as':_0x54a9('0x136'),'onDelete':_0x54a9('0x106')});db['VoiceMusicOnHold'][_0x54a9('0x118')](db[_0x54a9('0x83')],{'as':_0x54a9('0x137'),'through':_0x54a9('0x138')});db[_0x54a9('0x19')]['hasMany'](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x54a9('0x19')][_0x54a9('0x108')](db[_0x54a9('0x6a')],{'as':_0x54a9('0x114'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x54a9('0x6d')],{'as':_0x54a9('0x10a'),'foreignKey':_0x54a9('0x139')});db['VoiceQueue'][_0x54a9('0x108')](db['CmHopperHistory'],{'as':_0x54a9('0x13a'),'foreignKey':_0x54a9('0x139')});db[_0x54a9('0x19')][_0x54a9('0x108')](db['ReportAgentPreview'],{'as':_0x54a9('0x6f'),'foreignKey':_0x54a9('0x139')});db[_0x54a9('0x19')][_0x54a9('0x108')](db[_0x54a9('0x6b')],{'as':_0x54a9('0x13b'),'foreignKey':_0x54a9('0x139')});db['VoiceQueue'][_0x54a9('0x108')](db['JscriptySessionReport'],{'as':_0x54a9('0x13c'),'foreignKey':_0x54a9('0x139')});db[_0x54a9('0x19')][_0x54a9('0x116')](db[_0x54a9('0x27')],{'as':'Trunk','foreignKey':_0x54a9('0x13d')});db['VoiceQueue']['belongsTo'](db[_0x54a9('0x27')],{'as':_0x54a9('0x13e'),'foreignKey':_0x54a9('0x13f')});db['VoiceQueue']['belongsTo'](db[_0x54a9('0x7c')],{'as':_0x54a9('0x7c'),'foreignKey':_0x54a9('0x140')});db[_0x54a9('0x19')][_0x54a9('0x116')](db[_0x54a9('0x141')],{'as':_0x54a9('0x142'),'foreignKey':_0x54a9('0x143')});db[_0x54a9('0x19')][_0x54a9('0x118')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x144'),'through':_0x54a9('0x145')});db[_0x54a9('0x19')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x2c')});db[_0x54a9('0x19')][_0x54a9('0x118')](db[_0x54a9('0xd8')],{'as':_0x54a9('0x147'),'through':_0x54a9('0x148')});db['VoiceQueue'][_0x54a9('0x118')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x149'),'through':_0x54a9('0x14a')});db[_0x54a9('0x1b')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x11'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x14b')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x11'),'foreignKey':'UserId'});db[_0x54a9('0x1d')][_0x54a9('0x108')](db['VoiceMailMessage'],{'as':_0x54a9('0x14c'),'onDelete':_0x54a9('0x106'),'foreignKey':'mailboxuser','sourceKey':_0x54a9('0x14d')});db[_0x54a9('0x1f')][_0x54a9('0x116')](db['VoiceMail'],{'foreignKey':_0x54a9('0x14e'),'targetKey':_0x54a9('0x14d')});db['VoiceCallReport'][_0x54a9('0x108')](db['VoiceQueueReport'],{'as':_0x54a9('0x14f'),'foreignKey':_0x54a9('0x150'),'constraints':![]});db[_0x54a9('0x151')]['hasMany'](db['VoiceAgentReport'],{'as':_0x54a9('0x152'),'foreignKey':_0x54a9('0x150'),'constraints':![]});db[_0x54a9('0x151')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':'User','foreignKey':_0x54a9('0x107')});db['VoiceCallReport']['belongsTo'](db[_0x54a9('0x11b')],{'as':_0x54a9('0x153'),'foreignKey':_0x54a9('0x154')});db[_0x54a9('0x33')]['belongsTo'](db[_0x54a9('0x35')],{'as':_0x54a9('0x35'),'foreignKey':_0x54a9('0x155')});db[_0x54a9('0x33')][_0x54a9('0x116')](db[_0x54a9('0xfa')],{'as':'CloudProvider','foreignKey':_0x54a9('0x156'),'onDelete':'restrict'});db[_0x54a9('0x34')][_0x54a9('0x116')](db['MailAccount'],{'as':_0x54a9('0x35'),'foreignKey':_0x54a9('0x155')});db[_0x54a9('0x34')][_0x54a9('0x116')](db[_0x54a9('0xfa')],{'as':_0x54a9('0xfa'),'foreignKey':'CloudProviderId','onDelete':_0x54a9('0x157')});db[_0x54a9('0x35')][_0x54a9('0x104')](db[_0x54a9('0x33')],{'as':_0x54a9('0x158'),'onDelete':'cascade'});db[_0x54a9('0x35')][_0x54a9('0x104')](db[_0x54a9('0x34')],{'as':_0x54a9('0x159'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x35')]['hasMany'](db[_0x54a9('0x78')],{'as':'Dispositions','foreignKey':_0x54a9('0x155'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x35')]['hasMany'](db[_0x54a9('0x76')],{'as':_0x54a9('0x15a'),'foreignKey':_0x54a9('0x155')});db[_0x54a9('0x35')][_0x54a9('0x108')](db[_0x54a9('0x3b')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x54a9('0x35')][_0x54a9('0x108')](db[_0x54a9('0x3a')],{'as':'Interactions'});db[_0x54a9('0x35')][_0x54a9('0x108')](db[_0x54a9('0x3d')],{'as':_0x54a9('0x136'),'foreignKey':'MailAccountId','onDelete':_0x54a9('0x106')});db[_0x54a9('0x35')][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':'ListId'});db['MailAccount'][_0x54a9('0x116')](db[_0x54a9('0x8a')],{'as':_0x54a9('0x8a'),'foreignKey':_0x54a9('0x15c')});db[_0x54a9('0x35')][_0x54a9('0x116')](db[_0x54a9('0x141')],{'as':_0x54a9('0x142'),'foreignKey':_0x54a9('0x143')});db[_0x54a9('0x35')]['belongsToMany'](db['User'],{'as':_0x54a9('0x146'),'through':'user_has_mail_accounts'});db[_0x54a9('0x37')][_0x54a9('0x118')](db['User'],{'as':_0x54a9('0x146'),'through':_0x54a9('0x126')});db[_0x54a9('0x37')][_0x54a9('0x118')](db[_0x54a9('0xd8')],{'through':_0x54a9('0x15d'),'as':_0x54a9('0x147')});db[_0x54a9('0x3a')]['hasMany'](db['MailMessage'],{'as':_0x54a9('0x14c'),'onDelete':_0x54a9('0x106'),'foreignKey':'MailInteractionId'});db[_0x54a9('0x3a')][_0x54a9('0x116')](db['MailAccount'],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x155')});db[_0x54a9('0x3a')][_0x54a9('0x116')](db['CmContact'],{'as':'Contact','foreignKey':_0x54a9('0x154')});db[_0x54a9('0x3a')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x15f'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x3a')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x160'),'as':_0x54a9('0x161')});db[_0x54a9('0x3a')]['belongsToMany'](db[_0x54a9('0x85')],{'through':_0x54a9('0x160'),'as':'ThroughTags'});db['MailInteraction'][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':'Users','through':_0x54a9('0x162'),'foreignKey':'MailInteractionId'});db[_0x54a9('0x3b')][_0x54a9('0x108')](db[_0x54a9('0xde')],{'as':_0x54a9('0x163'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x3b')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x11')});db['MailMessage'][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x153')});db['MailMessage'][_0x54a9('0x116')](db['MailInteraction'],{'as':_0x54a9('0x164'),'foreignKey':_0x54a9('0x165')});db[_0x54a9('0x3b')][_0x54a9('0x116')](db[_0x54a9('0x35')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x155')});db[_0x54a9('0x3b')][_0x54a9('0x116')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0x54a9('0x3b')][_0x54a9('0x116')](db[_0x54a9('0x60')],{'as':_0x54a9('0x60'),'foreignKey':_0x54a9('0x166')});db[_0x54a9('0x3d')][_0x54a9('0x116')](db['User'],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0x3d')][_0x54a9('0x116')](db[_0x54a9('0x37')],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0x3d')][_0x54a9('0x116')](db[_0x54a9('0x35')],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0x3d')][_0x54a9('0x116')](db[_0x54a9('0x7c')],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x140')});db['MailApplication'][_0x54a9('0x116')](db[_0x54a9('0x85')],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x167')});db[_0x54a9('0x3f')]['belongsTo'](db[_0x54a9('0x35')],{});db[_0x54a9('0x3f')][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db['MailQueueReport'][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':_0x54a9('0x153'),'foreignKey':'ContactId'});db[_0x54a9('0x3f')][_0x54a9('0x116')](db['MailInteraction'],{});db[_0x54a9('0x3f')][_0x54a9('0x116')](db['MailMessage'],{});db[_0x54a9('0x3f')]['belongsTo'](db[_0x54a9('0x11')],{});db['MailQueueReport']['belongsTo'](db[_0x54a9('0x37')],{});db['Dashboard']['hasMany'](db['DashboardItem'],{'as':_0x54a9('0x169'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x43')][_0x54a9('0x108')](db[_0x54a9('0x78')],{'as':_0x54a9('0x16a'),'foreignKey':_0x54a9('0x16b'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x43')][_0x54a9('0x108')](db[_0x54a9('0x76')],{'as':_0x54a9('0x15a'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0x54a9('0x108')](db['FaxInteraction'],{'as':_0x54a9('0x16c')});db[_0x54a9('0x43')][_0x54a9('0x108')](db[_0x54a9('0x16d')],{'as':'Applications','foreignKey':_0x54a9('0x16b'),'onDelete':'cascade'});db[_0x54a9('0x43')][_0x54a9('0x108')](db['VoiceExtension'],{'as':_0x54a9('0x16e'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x43')][_0x54a9('0x108')](db[_0x54a9('0x48')],{'as':_0x54a9('0x14c')});db[_0x54a9('0x43')][_0x54a9('0x116')](db['Trunk'],{'as':_0x54a9('0x27')});db['FaxAccount'][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db['FaxAccount'][_0x54a9('0x116')](db[_0x54a9('0x141')],{'as':'mandatoryDispositionPause','foreignKey':_0x54a9('0x143')});db[_0x54a9('0x43')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':'Agents','through':_0x54a9('0x16f')});db[_0x54a9('0x16d')]['belongsTo'](db['User'],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0x16d')]['belongsTo'](db[_0x54a9('0x49')],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0x16d')][_0x54a9('0x116')](db[_0x54a9('0x43')],{'onDelete':_0x54a9('0x157')});db['FaxApplication'][_0x54a9('0x116')](db[_0x54a9('0x85')],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x167')});db['FaxInteraction']['hasMany'](db['FaxMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x54a9('0x170')});db[_0x54a9('0x46')][_0x54a9('0x116')](db[_0x54a9('0x43')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x16b')});db[_0x54a9('0x46')][_0x54a9('0x116')](db['CmContact'],{'as':'Contact','foreignKey':_0x54a9('0x154')});db[_0x54a9('0x46')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x15f'),'foreignKey':'UserId'});db[_0x54a9('0x46')][_0x54a9('0x118')](db['Tag'],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0x54a9('0x46')]['belongsToMany'](db[_0x54a9('0x85')],{'through':_0x54a9('0x171'),'as':_0x54a9('0x172')});db[_0x54a9('0x46')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x173'),'through':_0x54a9('0x174'),'foreignKey':_0x54a9('0x170')});db[_0x54a9('0x48')][_0x54a9('0x116')](db['User'],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x11')});db[_0x54a9('0x48')][_0x54a9('0x116')](db[_0x54a9('0x46')],{'as':_0x54a9('0x164'),'foreignKey':_0x54a9('0x170')});db[_0x54a9('0x48')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x153')});db['FaxMessage'][_0x54a9('0x116')](db[_0x54a9('0xde')],{'as':_0x54a9('0xde'),'foreignKey':_0x54a9('0x175')});db[_0x54a9('0x48')][_0x54a9('0x116')](db[_0x54a9('0x43')],{'as':_0x54a9('0x15e'),'foreignKey':'FaxAccountId'});db[_0x54a9('0x49')]['belongsToMany'](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x30')});db[_0x54a9('0x49')][_0x54a9('0x118')](db[_0x54a9('0xd8')],{'through':_0x54a9('0x176'),'as':'Teams'});db['FaxQueueReport'][_0x54a9('0x116')](db[_0x54a9('0x43')],{});db[_0x54a9('0x4b')][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db[_0x54a9('0x4b')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':'Contact','foreignKey':_0x54a9('0x154')});db[_0x54a9('0x4b')][_0x54a9('0x116')](db[_0x54a9('0x46')],{});db[_0x54a9('0x4b')][_0x54a9('0x116')](db[_0x54a9('0x48')],{});db[_0x54a9('0x4b')][_0x54a9('0x116')](db[_0x54a9('0x11')],{});db['FaxQueueReport']['belongsTo'](db[_0x54a9('0x49')],{});db['SmsAccount'][_0x54a9('0x108')](db[_0x54a9('0x78')],{'as':_0x54a9('0x16a'),'foreignKey':_0x54a9('0x177'),'onDelete':'cascade'});db[_0x54a9('0x4d')]['hasMany'](db[_0x54a9('0x76')],{'as':'Answers','foreignKey':_0x54a9('0x177')});db[_0x54a9('0x4d')]['hasMany'](db['SmsMessage'],{'as':'Messages','foreignKey':_0x54a9('0x177')});db['SmsAccount'][_0x54a9('0x108')](db[_0x54a9('0x4f')],{'as':_0x54a9('0x16c')});db['SmsAccount']['hasMany'](db[_0x54a9('0x178')],{'as':_0x54a9('0x136'),'foreignKey':_0x54a9('0x177'),'onDelete':'cascade'});db[_0x54a9('0x4d')]['belongsTo'](db[_0x54a9('0xe8')],{'as':'List','foreignKey':_0x54a9('0x168')});db[_0x54a9('0x4d')][_0x54a9('0x116')](db[_0x54a9('0x141')],{'as':_0x54a9('0x142'),'foreignKey':_0x54a9('0x143')});db['SmsAccount'][_0x54a9('0x118')](db['User'],{'as':'Agents','through':_0x54a9('0x179')});db['SmsApplication'][_0x54a9('0x116')](db[_0x54a9('0x11')],{'onDelete':'restrict'});db[_0x54a9('0x178')][_0x54a9('0x116')](db['SmsQueue'],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0x178')][_0x54a9('0x116')](db['SmsAccount'],{'onDelete':_0x54a9('0x157')});db['SmsApplication'][_0x54a9('0x116')](db[_0x54a9('0x7c')],{'onDelete':'restrict','foreignKey':_0x54a9('0x140')});db[_0x54a9('0x178')][_0x54a9('0x116')](db[_0x54a9('0x85')],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x167')});db[_0x54a9('0x4f')]['hasMany'](db[_0x54a9('0x17a')],{'as':_0x54a9('0x14c'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x17b')});db[_0x54a9('0x4f')][_0x54a9('0x116')](db['SmsAccount'],{'as':'Account','foreignKey':_0x54a9('0x177')});db[_0x54a9('0x4f')]['belongsTo'](db[_0x54a9('0x11b')],{'as':_0x54a9('0x153'),'foreignKey':'ContactId'});db[_0x54a9('0x4f')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':'Owner','foreignKey':'UserId'});db[_0x54a9('0x4f')]['belongsToMany'](db[_0x54a9('0x85')],{'through':_0x54a9('0x17c'),'as':_0x54a9('0x161')});db[_0x54a9('0x4f')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x17c'),'as':_0x54a9('0x172')});db[_0x54a9('0x4f')]['belongsToMany'](db[_0x54a9('0x11')],{'as':_0x54a9('0x173'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x11')});db['SmsMessage'][_0x54a9('0x116')](db['CmContact'],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x153')});db[_0x54a9('0x17a')][_0x54a9('0x116')](db[_0x54a9('0x4f')],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x164'),'foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db['SmsAccount'],{'as':_0x54a9('0x15e'),'foreignKey':'SmsAccountId'});db[_0x54a9('0x51')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0x54a9('0x17d')});db[_0x54a9('0x51')]['belongsToMany'](db['Team'],{'through':_0x54a9('0x17e'),'as':'Teams'});db[_0x54a9('0x52')]['hasMany'](db[_0x54a9('0x78')],{'as':_0x54a9('0x16a'),'foreignKey':'OpenchannelAccountId','onDelete':_0x54a9('0x106')});db[_0x54a9('0x52')][_0x54a9('0x108')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x54a9('0x17f')});db['OpenchannelAccount']['hasMany'](db[_0x54a9('0x55')],{'as':'Interactions','foreignKey':_0x54a9('0x17f')});db[_0x54a9('0x52')][_0x54a9('0x108')](db[_0x54a9('0x57')],{'as':_0x54a9('0x14c'),'foreignKey':_0x54a9('0x17f')});db[_0x54a9('0x52')]['hasMany'](db[_0x54a9('0x54')],{'as':_0x54a9('0x136'),'foreignKey':_0x54a9('0x17f'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x52')][_0x54a9('0x116')](db['CmList'],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db[_0x54a9('0x52')][_0x54a9('0x116')](db[_0x54a9('0x141')],{'as':_0x54a9('0x142'),'foreignKey':_0x54a9('0x143')});db['OpenchannelAccount'][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x131')});db['OpenchannelApplication']['belongsTo'](db[_0x54a9('0x11')],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0x54')]['belongsTo'](db[_0x54a9('0x58')],{'onDelete':'restrict','foreignKey':_0x54a9('0x180')});db[_0x54a9('0x54')][_0x54a9('0x116')](db['OpenchannelAccount'],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x17f')});db[_0x54a9('0x54')][_0x54a9('0x116')](db[_0x54a9('0x7c')],{'onDelete':_0x54a9('0x157'),'foreignKey':'IntervalId'});db[_0x54a9('0x54')][_0x54a9('0x116')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x54a9('0x167')});db['OpenchannelInteraction']['hasMany'](db[_0x54a9('0x57')],{'as':_0x54a9('0x14c'),'onDelete':_0x54a9('0x106'),'foreignKey':'OpenchannelInteractionId'});db[_0x54a9('0x55')][_0x54a9('0x116')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x54a9('0x17f')});db[_0x54a9('0x55')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':'Contact','foreignKey':_0x54a9('0x154')});db[_0x54a9('0x55')]['belongsTo'](db[_0x54a9('0x11')],{'as':_0x54a9('0x15f'),'foreignKey':_0x54a9('0x107')});db[_0x54a9('0x55')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':'openchannel_interaction_has_tags','as':_0x54a9('0x161')});db['OpenchannelInteraction']['belongsToMany'](db['Tag'],{'through':_0x54a9('0x181'),'as':_0x54a9('0x172')});db[_0x54a9('0x55')][_0x54a9('0x118')](db['User'],{'as':_0x54a9('0x173'),'through':_0x54a9('0x122'),'foreignKey':_0x54a9('0x182')});db[_0x54a9('0x57')]['belongsTo'](db[_0x54a9('0x11')],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x11')});db[_0x54a9('0x57')][_0x54a9('0x116')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0x54a9('0x57')][_0x54a9('0x116')](db[_0x54a9('0x55')],{'onDelete':'cascade','as':_0x54a9('0x164'),'foreignKey':_0x54a9('0x182')});db[_0x54a9('0x57')][_0x54a9('0x116')](db[_0x54a9('0xde')],{'as':_0x54a9('0xde'),'foreignKey':'AttachmentId'});db[_0x54a9('0x57')][_0x54a9('0x116')](db[_0x54a9('0x52')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x17f')});db[_0x54a9('0x58')][_0x54a9('0x118')](db['User'],{'as':_0x54a9('0x146'),'through':'UserOpenchannelQueue','foreignKey':_0x54a9('0x180')});db['OpenchannelQueue'][_0x54a9('0x118')](db[_0x54a9('0xd8')],{'through':'team_has_openchannel_queues','as':_0x54a9('0x147')});db[_0x54a9('0x59')][_0x54a9('0x108')](db[_0x54a9('0x78')],{'as':_0x54a9('0x16a'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0x54a9('0x59')][_0x54a9('0x108')](db[_0x54a9('0x76')],{'as':_0x54a9('0x15a'),'foreignKey':'ChatWebsiteId'});db[_0x54a9('0x59')][_0x54a9('0x108')](db['ChatProactiveAction'],{'as':_0x54a9('0x183')});db[_0x54a9('0x59')]['hasMany'](db['ChatInteraction'],{'as':_0x54a9('0x16c')});db[_0x54a9('0x59')]['hasMany'](db['ChatApplication'],{'as':'Applications','foreignKey':'ChatWebsiteId','onDelete':_0x54a9('0x106')});db[_0x54a9('0x59')][_0x54a9('0x108')](db[_0x54a9('0x5f')],{'as':_0x54a9('0x14c')});db[_0x54a9('0x59')][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db['ChatWebsite'][_0x54a9('0x116')](db['Interval'],{'as':_0x54a9('0x7c'),'foreignKey':_0x54a9('0x140')});db['ChatWebsite'][_0x54a9('0x116')](db[_0x54a9('0x35')],{'as':_0x54a9('0x35'),'foreignKey':_0x54a9('0x155')});db[_0x54a9('0x59')][_0x54a9('0x116')](db['Pause'],{'as':_0x54a9('0x142'),'foreignKey':_0x54a9('0x143')});db[_0x54a9('0x59')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x12e')});db[_0x54a9('0x5b')][_0x54a9('0x116')](db['OpenchannelAccount'],{});db[_0x54a9('0x5b')]['belongsTo'](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':'ListId'});db[_0x54a9('0x5b')]['belongsTo'](db['CmContact'],{'as':_0x54a9('0x153'),'foreignKey':_0x54a9('0x154')});db[_0x54a9('0x5b')][_0x54a9('0x116')](db[_0x54a9('0x55')],{});db[_0x54a9('0x5b')][_0x54a9('0x116')](db['OpenchannelMessage'],{});db[_0x54a9('0x5b')]['belongsTo'](db[_0x54a9('0x11')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x54a9('0x58')],{});db[_0x54a9('0x184')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x185'),'foreignKey':_0x54a9('0x107'),'onDelete':_0x54a9('0x157')});db['ChatApplication'][_0x54a9('0x116')](db[_0x54a9('0x62')],{'as':_0x54a9('0x186'),'foreignKey':_0x54a9('0x187'),'onDelete':'restrict'});db[_0x54a9('0x184')][_0x54a9('0x116')](db['ChatWebsite'],{'as':_0x54a9('0x188'),'foreignKey':_0x54a9('0x189'),'onDelete':'restrict'});db[_0x54a9('0x184')]['belongsTo'](db[_0x54a9('0x85')],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x167')});db[_0x54a9('0x5e')]['hasMany'](db[_0x54a9('0x5f')],{'as':_0x54a9('0x14c'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x18a')});db['ChatInteraction'][_0x54a9('0x116')](db[_0x54a9('0x59')],{'as':'Account','foreignKey':_0x54a9('0x189')});db[_0x54a9('0x5e')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':'Contact','foreignKey':'ContactId'});db['ChatInteraction'][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x15f'),'foreignKey':'UserId'});db[_0x54a9('0x5e')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x18b'),'as':_0x54a9('0x161')});db[_0x54a9('0x5e')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x18b'),'as':'ThroughTags'});db[_0x54a9('0x5e')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x173'),'through':_0x54a9('0x120'),'foreignKey':_0x54a9('0x18a')});db[_0x54a9('0x5f')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x11')});db[_0x54a9('0x5f')][_0x54a9('0x116')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':_0x54a9('0x154')});db['ChatMessage'][_0x54a9('0x116')](db[_0x54a9('0x5e')],{'onDelete':_0x54a9('0x106'),'as':'Interaction','foreignKey':_0x54a9('0x18a')});db[_0x54a9('0x5f')][_0x54a9('0x116')](db[_0x54a9('0xde')],{'as':'Attachment','foreignKey':_0x54a9('0x175')});db['ChatMessage']['belongsTo'](db['ChatWebsite'],{'as':_0x54a9('0x15e'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x54a9('0x108')](db[_0x54a9('0xde')],{'as':'Attachments','foreignKey':_0x54a9('0x166'),'onDelete':_0x54a9('0x106'),'hooks':!![]});db[_0x54a9('0x60')]['belongsTo'](db[_0x54a9('0x11b')],{'onDelete':_0x54a9('0x106'),'as':_0x54a9('0x153'),'foreignKey':_0x54a9('0x154')});db[_0x54a9('0x60')][_0x54a9('0x116')](db[_0x54a9('0x59')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x54a9('0x62')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x2d'),'hooks':!![]});db[_0x54a9('0x62')][_0x54a9('0x118')](db['Team'],{'through':_0x54a9('0x18c'),'as':_0x54a9('0x147')});db['ChatGroup']['hasMany'](db[_0x54a9('0x18d')],{'as':_0x54a9('0x14c'),'foreignKey':_0x54a9('0x18e'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x64')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x18f'),'through':_0x54a9('0x11a')});db[_0x54a9('0x190')][_0x54a9('0x116')](db[_0x54a9('0x59')],{'as':'Website','foreignKey':_0x54a9('0x189')});db[_0x54a9('0x67')][_0x54a9('0x108')](db[_0x54a9('0x11b')],{'as':_0x54a9('0x11c'),'foreignKey':_0x54a9('0x191')});db['CmContact'][_0x54a9('0x108')](db[_0x54a9('0x87')],{'as':_0x54a9('0x192'),'foreignKey':_0x54a9('0x193')});db[_0x54a9('0x11b')][_0x54a9('0x108')](db[_0x54a9('0x6a')],{'as':_0x54a9('0x114'),'foreignKey':_0x54a9('0x154')});db[_0x54a9('0x11b')][_0x54a9('0x108')](db[_0x54a9('0x6d')],{'as':_0x54a9('0x10a'),'foreignKey':'ContactId'});db[_0x54a9('0x11b')]['hasMany'](db[_0x54a9('0x194')],{'as':_0x54a9('0x13a'),'foreignKey':_0x54a9('0x154')});db[_0x54a9('0x11b')][_0x54a9('0x108')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0x54a9('0x11b')][_0x54a9('0x108')](db[_0x54a9('0xc9')],{'as':_0x54a9('0x13c'),'foreignKey':_0x54a9('0x154')});db[_0x54a9('0x11b')]['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x54a9('0x11b')][_0x54a9('0x108')](db[_0x54a9('0x5e')],{'as':_0x54a9('0x10d'),'foreignKey':_0x54a9('0x154'),'onDelete':'restrict'});db[_0x54a9('0x11b')][_0x54a9('0x108')](db['SmsInteraction'],{'as':_0x54a9('0x10e'),'foreignKey':_0x54a9('0x154'),'onDelete':_0x54a9('0x157')});db[_0x54a9('0x11b')]['hasMany'](db[_0x54a9('0x46')],{'as':_0x54a9('0x10f'),'foreignKey':'ContactId','onDelete':_0x54a9('0x157')});db['CmContact']['hasMany'](db['MailInteraction'],{'as':_0x54a9('0x110'),'foreignKey':_0x54a9('0x154'),'onDelete':_0x54a9('0x157')});db[_0x54a9('0x11b')][_0x54a9('0x116')](db[_0x54a9('0x67')],{'as':_0x54a9('0x195'),'foreignKey':'CompanyId'});db[_0x54a9('0x11b')][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168'),'onDelete':_0x54a9('0x106')});db['CmContact'][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':'Users','through':_0x54a9('0x11d')});db[_0x54a9('0x11b')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'as':'Tags','through':_0x54a9('0x196')});db[_0x54a9('0x11b')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x196'),'as':_0x54a9('0x172')});db[_0x54a9('0x6a')][_0x54a9('0x108')](db[_0x54a9('0x89')],{'as':_0x54a9('0x197'),'foreignKey':_0x54a9('0x198')});db[_0x54a9('0x6a')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':'Contact','foreignKey':_0x54a9('0x154'),'onDelete':_0x54a9('0x106')});db['CmHopper']['belongsTo'](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168'),'onDelete':'cascade'});db[_0x54a9('0x6a')]['belongsTo'](db['User'],{'as':'Agent','foreignKey':_0x54a9('0x107')});db[_0x54a9('0x6a')][_0x54a9('0x116')](db[_0x54a9('0x19')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x54a9('0x106')});db[_0x54a9('0x6a')][_0x54a9('0x116')](db[_0x54a9('0xdc')],{'as':_0x54a9('0xdc'),'foreignKey':'CampaignId','onDelete':_0x54a9('0x106')});db[_0x54a9('0x6a')]['belongsTo'](db[_0x54a9('0x11')],{'as':_0x54a9('0x15f'),'foreignKey':_0x54a9('0x199')});db[_0x54a9('0x6b')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':_0x54a9('0x153'),'foreignKey':_0x54a9('0x154'),'onDelete':'cascade'});db[_0x54a9('0x6b')][_0x54a9('0x116')](db['CmList'],{'as':'List','foreignKey':_0x54a9('0x168'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0x6b')][_0x54a9('0x116')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x54a9('0x139'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0x54a9('0xdc')],{'as':_0x54a9('0xdc'),'foreignKey':'CampaignId','onDelete':_0x54a9('0x106')});db[_0x54a9('0x19a')][_0x54a9('0x108')](db['Condition'],{'as':{'plural':_0x54a9('0x19b'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db['Automation']['hasMany'](db['Condition'],{'as':{'plural':'Any','singular':_0x54a9('0x19c')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x54a9('0x19a')]['hasMany'](db[_0x54a9('0x73')],{'as':_0x54a9('0x19d'),'foreignKey':_0x54a9('0x19e'),'onDelete':'cascade','hooks':!![]});db[_0x54a9('0x78')]['hasMany'](db[_0x54a9('0x78')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0x54a9('0x106')});db[_0x54a9('0x7c')][_0x54a9('0x108')](db[_0x54a9('0x7c')],{'as':_0x54a9('0x19f'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0x54a9('0x7c')][_0x54a9('0x108')](db['VoiceExtension'],{'as':_0x54a9('0x1a0'),'foreignKey':_0x54a9('0x140'),'onDelete':_0x54a9('0x157')});db[_0x54a9('0x7c')][_0x54a9('0x108')](db[_0x54a9('0x3d')],{'as':'MailApplications','foreignKey':_0x54a9('0x140')});db[_0x54a9('0x7c')][_0x54a9('0x108')](db[_0x54a9('0x184')],{'as':'ChatApplications','foreignKey':_0x54a9('0x140')});db[_0x54a9('0x7c')][_0x54a9('0x108')](db[_0x54a9('0x16d')],{'as':'FaxApplications','foreignKey':_0x54a9('0x140')});db[_0x54a9('0x7c')][_0x54a9('0x108')](db[_0x54a9('0x178')],{'as':'SmsApplications','foreignKey':_0x54a9('0x140')});db['Schedule']['belongsTo'](db['MailAccount'],{});db[_0x54a9('0x81')]['belongsTo'](db[_0x54a9('0x92')],{'foreignKey':_0x54a9('0x1a1')});db[_0x54a9('0x81')][_0x54a9('0x116')](db[_0x54a9('0x91')],{'foreignKey':_0x54a9('0x1a2')});db['Sound']['belongsToMany'](db[_0x54a9('0x17')],{'as':'Mohs','through':_0x54a9('0x138'),'onDelete':'restrict'});db[_0x54a9('0x85')][_0x54a9('0x118')](db[_0x54a9('0x11b')],{'through':_0x54a9('0x196')});db[_0x54a9('0x85')][_0x54a9('0x118')](db[_0x54a9('0x5e')],{'through':_0x54a9('0x18b')});db[_0x54a9('0x85')][_0x54a9('0x118')](db[_0x54a9('0x3a')],{'through':_0x54a9('0x160')});db[_0x54a9('0x85')][_0x54a9('0x118')](db[_0x54a9('0x4f')],{'through':'sms_interaction_has_tags'});db[_0x54a9('0x85')][_0x54a9('0x118')](db[_0x54a9('0x46')],{'through':_0x54a9('0x171')});db['Tag'][_0x54a9('0x118')](db[_0x54a9('0x55')],{'through':_0x54a9('0x181')});db['Tag'][_0x54a9('0x118')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db['CmContactHasItem']['belongsTo'](db[_0x54a9('0x1a3')],{'as':_0x54a9('0x1a4'),'foreignKey':_0x54a9('0x1a5')});db['CmHopperAdditionalPhone'][_0x54a9('0x116')](db[_0x54a9('0x6a')],{'as':_0x54a9('0x1a6'),'foreignKey':_0x54a9('0x198')});db[_0x54a9('0x87')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':_0x54a9('0x153'),'foreignKey':'CmContactId'});db[_0x54a9('0x8b')][_0x54a9('0x108')](db[_0x54a9('0x7a')],{'as':{'plural':'AllConditions','singular':_0x54a9('0x1a7')},'foreignKey':_0x54a9('0x1a8'),'onDelete':_0x54a9('0x106'),'hooks':!![]});db[_0x54a9('0x8b')][_0x54a9('0x108')](db[_0x54a9('0x7a')],{'as':{'plural':_0x54a9('0x1a9'),'singular':'AnyCondition'},'foreignKey':_0x54a9('0x1aa'),'onDelete':_0x54a9('0x106'),'hooks':!![]});db[_0x54a9('0x8b')][_0x54a9('0x108')](db[_0x54a9('0x73')],{'as':_0x54a9('0x19d'),'foreignKey':_0x54a9('0x1ab'),'onDelete':_0x54a9('0x106'),'hooks':!![]});db['AnalyticCustomReport'][_0x54a9('0x108')](db[_0x54a9('0x97')],{'as':_0x54a9('0x1ac'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1a2'),'hooks':!![]});db[_0x54a9('0x92')][_0x54a9('0x108')](db['AnalyticFieldReport'],{'as':_0x54a9('0x1ac'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1a1')});db[_0x54a9('0x95')][_0x54a9('0x108')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x54a9('0x1ad')});db[_0x54a9('0x97')][_0x54a9('0x116')](db['AnalyticMetric'],{'foreignKey':_0x54a9('0x1ad')});db[_0x54a9('0x1ae')][_0x54a9('0x108')](db['SalesforceConfiguration'],{'as':_0x54a9('0x1af'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0x9c')][_0x54a9('0x108')](db['SalesforceField'],{'as':_0x54a9('0x1b1'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x9c')][_0x54a9('0x108')](db[_0x54a9('0x1b3')],{'as':_0x54a9('0x1b4'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0x9c')][_0x54a9('0x108')](db[_0x54a9('0x1b3')],{'as':_0x54a9('0x1ac'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0x9c')][_0x54a9('0x116')](db[_0x54a9('0x1ae')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0x1b3')]['hasMany'](db[_0x54a9('0x1b3')],{'as':_0x54a9('0x1b7'),'foreignKey':_0x54a9('0x1b2')});db['SalesforceField'][_0x54a9('0x108')](db['SalesforceField'],{'as':_0x54a9('0x1b8'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0x1b3')][_0x54a9('0x108')](db[_0x54a9('0x1b3')],{'as':_0x54a9('0x1b9'),'foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0x1b3')][_0x54a9('0x116')](db[_0x54a9('0x8c')],{'as':_0x54a9('0x8c'),'foreignKey':_0x54a9('0x1ba')});db[_0x54a9('0x1bb')][_0x54a9('0x108')](db[_0x54a9('0x9f')],{'as':_0x54a9('0x1af'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0x9f')]['hasMany'](db['SugarcrmField'],{'as':_0x54a9('0x1b1'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b2')});db['SugarcrmConfiguration'][_0x54a9('0x108')](db[_0x54a9('0x1bc')],{'as':_0x54a9('0x1b4'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0x9f')][_0x54a9('0x108')](db['SugarcrmField'],{'as':_0x54a9('0x1ac'),'onDelete':'cascade','foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0x9f')][_0x54a9('0x116')](db[_0x54a9('0x1bb')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x1b0')});db['SugarcrmField'][_0x54a9('0x108')](db[_0x54a9('0x1bc')],{'as':'Subject','foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x1bc')][_0x54a9('0x108')](db['SugarcrmField'],{'as':'Description','foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0x1bc')]['hasMany'](db[_0x54a9('0x1bc')],{'as':'Field','foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0x1bc')]['belongsTo'](db['Variable'],{'as':_0x54a9('0x8c'),'foreignKey':_0x54a9('0x1ba')});db[_0x54a9('0xa2')][_0x54a9('0x108')](db[_0x54a9('0x1bd')],{'as':_0x54a9('0x1af'),'onDelete':_0x54a9('0x106'),'foreignKey':'AccountId'});db[_0x54a9('0x1bd')]['hasMany'](db[_0x54a9('0xa4')],{'as':_0x54a9('0x1b1'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x1bd')][_0x54a9('0x108')](db['DeskField'],{'as':_0x54a9('0x1b4'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0x1bd')]['hasMany'](db[_0x54a9('0xa4')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0x1bd')][_0x54a9('0x116')](db[_0x54a9('0xa2')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0x1bd')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x1be')});db[_0x54a9('0xa4')][_0x54a9('0x108')](db[_0x54a9('0xa4')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x54a9('0xa4')]['hasMany'](db[_0x54a9('0xa4')],{'as':_0x54a9('0x1b8'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0xa4')][_0x54a9('0x108')](db[_0x54a9('0xa4')],{'as':'Field','foreignKey':_0x54a9('0x1b6')});db['DeskField'][_0x54a9('0x116')](db['Variable'],{'as':_0x54a9('0x8c'),'foreignKey':'VariableId'});db[_0x54a9('0x1bf')][_0x54a9('0x108')](db['ZohoConfiguration'],{'as':_0x54a9('0x1af'),'onDelete':'cascade','foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0x1c0')][_0x54a9('0x108')](db['ZohoField'],{'as':_0x54a9('0x1b1'),'onDelete':'cascade','foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x1c0')][_0x54a9('0x108')](db[_0x54a9('0xa8')],{'as':_0x54a9('0x1b4'),'onDelete':_0x54a9('0x106'),'foreignKey':'DescriptionId'});db[_0x54a9('0x1c0')][_0x54a9('0x108')](db['ZohoField'],{'as':_0x54a9('0x1ac'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b6')});db['ZohoConfiguration'][_0x54a9('0x116')](db[_0x54a9('0x1bf')],{'as':'Account','foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0xa8')]['hasMany'](db[_0x54a9('0xa8')],{'as':_0x54a9('0x1b7'),'foreignKey':_0x54a9('0x1b2')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0x54a9('0x1b8'),'foreignKey':_0x54a9('0x1b5')});db['ZohoField'][_0x54a9('0x108')](db[_0x54a9('0xa8')],{'as':'Field','foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0xa8')]['belongsTo'](db[_0x54a9('0x8c')],{'as':'Variable','foreignKey':_0x54a9('0x1ba')});db['ZendeskAccount']['hasMany'](db['ZendeskConfiguration'],{'as':_0x54a9('0x1af'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0xac')]['hasMany'](db[_0x54a9('0x1c1')],{'as':'Subjects','foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0xac')][_0x54a9('0x108')](db[_0x54a9('0x1c1')],{'as':_0x54a9('0x1b4'),'foreignKey':_0x54a9('0x1b5')});db['ZendeskConfiguration']['hasMany'](db[_0x54a9('0x1c1')],{'as':'Fields','foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x54a9('0x116')](db[_0x54a9('0xaa')],{'as':'Account','foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0xac')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x1c2')});db[_0x54a9('0x1c1')]['hasMany'](db[_0x54a9('0x1c1')],{'as':_0x54a9('0x1b7'),'foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x1c1')][_0x54a9('0x108')](db[_0x54a9('0x1c1')],{'as':_0x54a9('0x1b8'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0x1c1')][_0x54a9('0x108')](db['ZendeskField'],{'as':'Field','foreignKey':_0x54a9('0x1b6')});db['ZendeskField'][_0x54a9('0x116')](db[_0x54a9('0x8c')],{'as':'Variable','foreignKey':_0x54a9('0x1ba')});db[_0x54a9('0xae')]['hasMany'](db[_0x54a9('0xb0')],{'as':_0x54a9('0x1af'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b0')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0x54a9('0x1b1'),'onDelete':_0x54a9('0x106'),'foreignKey':'SubjectId'});db[_0x54a9('0xb0')]['hasMany'](db[_0x54a9('0xb2')],{'as':_0x54a9('0x1b4'),'onDelete':'cascade','foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0xb0')][_0x54a9('0x108')](db[_0x54a9('0xb2')],{'as':_0x54a9('0x1ac'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x54a9('0xb0')][_0x54a9('0x116')](db[_0x54a9('0xae')],{'as':'Account','foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0xb0')][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x1c3')});db[_0x54a9('0xb2')][_0x54a9('0x108')](db[_0x54a9('0xb2')],{'as':_0x54a9('0x1b7'),'foreignKey':_0x54a9('0x1b2')});db['FreshdeskField'][_0x54a9('0x108')](db[_0x54a9('0xb2')],{'as':'Description','foreignKey':_0x54a9('0x1b5')});db['FreshdeskField']['hasMany'](db[_0x54a9('0xb2')],{'as':'Field','foreignKey':'FieldId'});db[_0x54a9('0xb2')][_0x54a9('0x116')](db[_0x54a9('0x8c')],{'as':_0x54a9('0x8c'),'foreignKey':_0x54a9('0x1ba')});db['VtigerAccount']['hasMany'](db['VtigerConfiguration'],{'as':_0x54a9('0x1af'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0x1c4')]['hasMany'](db[_0x54a9('0xb5')],{'as':_0x54a9('0x1b1'),'foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x1c4')][_0x54a9('0x108')](db[_0x54a9('0xb5')],{'as':'Descriptions','foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0x1c4')]['hasMany'](db['VtigerField'],{'as':_0x54a9('0x1ac'),'foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0x1c4')][_0x54a9('0x116')](db[_0x54a9('0x1c5')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0xb5')][_0x54a9('0x108')](db[_0x54a9('0xb5')],{'as':'Subject','foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0xb5')][_0x54a9('0x108')](db[_0x54a9('0xb5')],{'as':_0x54a9('0x1b8'),'foreignKey':_0x54a9('0x1b5')});db['VtigerField'][_0x54a9('0x108')](db[_0x54a9('0xb5')],{'as':_0x54a9('0x1b9'),'foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0xb5')][_0x54a9('0x116')](db[_0x54a9('0x8c')],{'as':_0x54a9('0x8c'),'foreignKey':_0x54a9('0x1ba')});db[_0x54a9('0x1c6')][_0x54a9('0x108')](db['ServicenowConfiguration'],{'as':_0x54a9('0x1af'),'onDelete':_0x54a9('0x106'),'foreignKey':'AccountId'});db[_0x54a9('0xb7')][_0x54a9('0x108')](db[_0x54a9('0x1c7')],{'as':_0x54a9('0x1b1'),'foreignKey':'SubjectId'});db[_0x54a9('0xb7')][_0x54a9('0x108')](db[_0x54a9('0x1c7')],{'as':_0x54a9('0x1b4'),'foreignKey':'DescriptionId'});db[_0x54a9('0xb7')][_0x54a9('0x108')](db[_0x54a9('0x1c7')],{'as':_0x54a9('0x1ac'),'foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0xb7')][_0x54a9('0x116')](db[_0x54a9('0x1c6')],{'as':'Account','foreignKey':'AccountId'});db[_0x54a9('0x1c7')][_0x54a9('0x108')](db['ServicenowField'],{'as':_0x54a9('0x1b7'),'foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x1c7')][_0x54a9('0x108')](db[_0x54a9('0x1c7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x54a9('0x1c7')][_0x54a9('0x108')](db[_0x54a9('0x1c7')],{'as':_0x54a9('0x1b9'),'foreignKey':_0x54a9('0x1b6')});db['ServicenowField'][_0x54a9('0x116')](db['Variable'],{'as':_0x54a9('0x8c'),'foreignKey':_0x54a9('0x1ba')});db[_0x54a9('0x1c8')][_0x54a9('0x108')](db[_0x54a9('0xb9')],{'as':'Configurations','onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b0')});db['Dynamics365Account']['belongsTo'](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x54a9('0x156')});db[_0x54a9('0xb9')]['hasMany'](db[_0x54a9('0xbb')],{'as':_0x54a9('0x1b1'),'onDelete':'cascade','foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0xb9')]['hasMany'](db[_0x54a9('0xbb')],{'as':_0x54a9('0x1b4'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b5')});db['Dynamics365Configuration'][_0x54a9('0x108')](db['Dynamics365Field'],{'as':_0x54a9('0x1ac'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0xb9')][_0x54a9('0x116')](db[_0x54a9('0x1c8')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0xbb')]['hasMany'](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0xbb')][_0x54a9('0x108')](db[_0x54a9('0xbb')],{'as':_0x54a9('0x1b8'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0xbb')][_0x54a9('0x108')](db[_0x54a9('0xbb')],{'as':_0x54a9('0x1b9'),'foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0xbb')][_0x54a9('0x116')](db[_0x54a9('0x8c')],{'as':_0x54a9('0x8c'),'foreignKey':'VariableId'});db[_0x54a9('0xbd')][_0x54a9('0x108')](db[_0x54a9('0xbf')],{'as':_0x54a9('0x1af'),'onDelete':'cascade','foreignKey':_0x54a9('0x1b0')});db['FreshsalesConfiguration'][_0x54a9('0x108')](db[_0x54a9('0x1c9')],{'as':'Subjects','foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0xbf')][_0x54a9('0x108')](db[_0x54a9('0x1c9')],{'as':_0x54a9('0x1b4'),'foreignKey':_0x54a9('0x1b5')});db[_0x54a9('0xbf')][_0x54a9('0x108')](db[_0x54a9('0x1c9')],{'as':'Fields','foreignKey':'FieldId'});db[_0x54a9('0xbf')][_0x54a9('0x116')](db[_0x54a9('0xbd')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x1b0')});db[_0x54a9('0x1c9')][_0x54a9('0x108')](db[_0x54a9('0x1c9')],{'as':_0x54a9('0x1b7'),'foreignKey':_0x54a9('0x1b2')});db[_0x54a9('0x1c9')][_0x54a9('0x108')](db['FreshsalesField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x54a9('0x1c9')][_0x54a9('0x108')](db[_0x54a9('0x1c9')],{'as':'Field','foreignKey':_0x54a9('0x1b6')});db[_0x54a9('0x1c9')][_0x54a9('0x116')](db[_0x54a9('0x8c')],{'as':'Variable','foreignKey':'VariableId'});db[_0x54a9('0xc3')][_0x54a9('0x116')](db[_0x54a9('0x59')],{});db[_0x54a9('0xc3')][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db[_0x54a9('0xc3')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':'Contact','foreignKey':_0x54a9('0x154')});db[_0x54a9('0xc3')][_0x54a9('0x116')](db[_0x54a9('0x5e')],{});db[_0x54a9('0xc3')][_0x54a9('0x116')](db[_0x54a9('0x5f')],{});db[_0x54a9('0xc3')]['belongsTo'](db[_0x54a9('0x11')],{});db[_0x54a9('0xc3')][_0x54a9('0x116')](db[_0x54a9('0x62')],{});db[_0x54a9('0x18d')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'onDelete':'cascade','foreignKey':_0x54a9('0x1ca')});db[_0x54a9('0x18d')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1cb')});db[_0x54a9('0xc9')]['hasMany'](db[_0x54a9('0x1cc')],{'foreignKey':'SessionId','onDelete':_0x54a9('0x106')});db[_0x54a9('0xc9')][_0x54a9('0x108')](db[_0x54a9('0xc6')],{'foreignKey':_0x54a9('0x1cd'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0xcb')]['belongsTo'](db['SmsAccount'],{});db[_0x54a9('0xcb')][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db[_0x54a9('0xcb')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':'Contact','foreignKey':_0x54a9('0x154')});db['SmsQueueReport']['belongsTo'](db[_0x54a9('0x4f')],{});db[_0x54a9('0xcb')][_0x54a9('0x116')](db[_0x54a9('0x17a')],{});db[_0x54a9('0xcb')][_0x54a9('0x116')](db[_0x54a9('0x11')],{});db['SmsQueueReport'][_0x54a9('0x116')](db['SmsQueue'],{});db[_0x54a9('0xd1')][_0x54a9('0x108')](db[_0x54a9('0xc9')],{'foreignKey':_0x54a9('0x1ce')});db[_0x54a9('0xd1')][_0x54a9('0x108')](db[_0x54a9('0x1cc')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x54a9('0x108')](db[_0x54a9('0xc6')],{'foreignKey':_0x54a9('0x1ce')});db[_0x54a9('0xd8')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x11f')});db[_0x54a9('0xd8')]['belongsToMany'](db[_0x54a9('0x19')],{'through':_0x54a9('0x148'),'as':_0x54a9('0x1cf')});db[_0x54a9('0xd8')][_0x54a9('0x118')](db[_0x54a9('0x37')],{'through':_0x54a9('0x15d'),'as':_0x54a9('0x125')});db[_0x54a9('0xd8')]['belongsToMany'](db[_0x54a9('0x62')],{'through':'team_has_chat_queues','as':_0x54a9('0x127')});db[_0x54a9('0xd8')][_0x54a9('0x118')](db[_0x54a9('0x49')],{'through':'team_has_fax_queues','as':_0x54a9('0x1d0')});db[_0x54a9('0xd8')][_0x54a9('0x118')](db[_0x54a9('0x51')],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0x54a9('0xd8')]['belongsToMany'](db['OpenchannelQueue'],{'through':_0x54a9('0x1d1'),'as':_0x54a9('0x129')});db[_0x54a9('0xd8')]['belongsToMany'](db[_0x54a9('0xf9')],{'through':_0x54a9('0x1d2'),'as':_0x54a9('0x12b')});db[_0x54a9('0xd8')][_0x54a9('0x118')](db[_0x54a9('0xea')],{'through':_0x54a9('0xfd'),'as':_0x54a9('0x124')});db[_0x54a9('0xdc')][_0x54a9('0x108')](db[_0x54a9('0x6a')],{'as':_0x54a9('0x114'),'foreignKey':_0x54a9('0x1d3')});db[_0x54a9('0xdc')][_0x54a9('0x108')](db['CmHopperFinal'],{'as':_0x54a9('0x10a'),'foreignKey':'CampaignId'});db[_0x54a9('0xdc')][_0x54a9('0x108')](db[_0x54a9('0x194')],{'as':_0x54a9('0x13a'),'foreignKey':_0x54a9('0x1d3')});db[_0x54a9('0xdc')][_0x54a9('0x108')](db[_0x54a9('0x6b')],{'as':_0x54a9('0x13b'),'foreignKey':_0x54a9('0x1d3')});db[_0x54a9('0xdc')]['belongsTo'](db[_0x54a9('0x27')],{'as':_0x54a9('0x27'),'foreignKey':_0x54a9('0x13d')});db[_0x54a9('0xdc')][_0x54a9('0x116')](db[_0x54a9('0x27')],{'as':_0x54a9('0x13e'),'foreignKey':_0x54a9('0x13f')});db['Campaign'][_0x54a9('0x116')](db['Interval'],{'as':_0x54a9('0x7c'),'foreignKey':'IntervalId'});db['Campaign']['belongsTo'](db[_0x54a9('0x1d4')],{'as':_0x54a9('0x1d4'),'foreignKey':'SquareProjectId'});db[_0x54a9('0xdc')][_0x54a9('0x118')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x144'),'through':'campaigns_has_cm_lists'});db[_0x54a9('0xdc')]['belongsToMany'](db[_0x54a9('0xe8')],{'as':_0x54a9('0x149'),'through':_0x54a9('0x1d5')});db['Attachment'][_0x54a9('0x116')](db[_0x54a9('0x60')],{'as':_0x54a9('0x60'),'foreignKey':_0x54a9('0x166')});db[_0x54a9('0xe0')][_0x54a9('0x116')](db['MailMessage'],{});db[_0x54a9('0xe0')]['belongsTo'](db[_0x54a9('0x3a')],{});db[_0x54a9('0xe0')]['belongsTo'](db[_0x54a9('0x35')],{'foreignKey':_0x54a9('0x1d6'),'as':_0x54a9('0x1d7')});db['MailTransferReport']['belongsTo'](db[_0x54a9('0x11')],{'foreignKey':'FromUserId','as':_0x54a9('0x1d8')});db['MailTransferReport'][_0x54a9('0x116')](db[_0x54a9('0x11')],{'foreignKey':_0x54a9('0x1d9'),'as':_0x54a9('0x1da')});db[_0x54a9('0xe0')][_0x54a9('0x116')](db[_0x54a9('0x37')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db['MailTransferReport'][_0x54a9('0x116')](db[_0x54a9('0x35')],{'foreignKey':_0x54a9('0x1db'),'as':_0x54a9('0x1dc')});db[_0x54a9('0xe2')][_0x54a9('0x116')](db['ChatMessage'],{});db['ChatTransferReport']['belongsTo'](db[_0x54a9('0x5e')],{});db[_0x54a9('0xe2')]['belongsTo'](db[_0x54a9('0x59')],{'foreignKey':_0x54a9('0x1dd'),'as':_0x54a9('0x1d7')});db[_0x54a9('0xe2')]['belongsTo'](db['User'],{'foreignKey':_0x54a9('0x1de'),'as':_0x54a9('0x1d8')});db[_0x54a9('0xe2')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'foreignKey':_0x54a9('0x1d9'),'as':'ToAgent'});db[_0x54a9('0xe2')][_0x54a9('0x116')](db[_0x54a9('0x62')],{'foreignKey':_0x54a9('0x1df'),'as':'ToQueue'});db[_0x54a9('0xe2')][_0x54a9('0x116')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0x54a9('0x1dc')});db[_0x54a9('0xe4')]['belongsTo'](db[_0x54a9('0x48')],{});db[_0x54a9('0xe4')][_0x54a9('0x116')](db['FaxInteraction'],{});db[_0x54a9('0xe4')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x54a9('0x1e0'),'as':_0x54a9('0x1d7')});db[_0x54a9('0xe4')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'foreignKey':'FromUserId','as':_0x54a9('0x1d8')});db['FaxTransferReport'][_0x54a9('0x116')](db[_0x54a9('0x11')],{'foreignKey':_0x54a9('0x1d9'),'as':_0x54a9('0x1da')});db[_0x54a9('0xe4')]['belongsTo'](db[_0x54a9('0x49')],{'foreignKey':_0x54a9('0x1e1'),'as':_0x54a9('0x1e2')});db[_0x54a9('0xe4')][_0x54a9('0x116')](db[_0x54a9('0x43')],{'foreignKey':'ToFaxAccountId','as':_0x54a9('0x1dc')});db[_0x54a9('0xe5')]['belongsTo'](db[_0x54a9('0x57')],{});db[_0x54a9('0xe5')][_0x54a9('0x116')](db[_0x54a9('0x55')],{});db['OpenchannelTransferReport'][_0x54a9('0x116')](db[_0x54a9('0x52')],{'foreignKey':_0x54a9('0x1e3'),'as':_0x54a9('0x1d7')});db['OpenchannelTransferReport']['belongsTo'](db[_0x54a9('0x11')],{'foreignKey':_0x54a9('0x1de'),'as':_0x54a9('0x1d8')});db[_0x54a9('0xe5')]['belongsTo'](db['User'],{'foreignKey':_0x54a9('0x1d9'),'as':_0x54a9('0x1da')});db['OpenchannelTransferReport'][_0x54a9('0x116')](db[_0x54a9('0x58')],{'foreignKey':_0x54a9('0x1e4'),'as':_0x54a9('0x1e2')});db[_0x54a9('0xe5')]['belongsTo'](db[_0x54a9('0x52')],{'foreignKey':_0x54a9('0x1e5'),'as':'ToAccount'});db[_0x54a9('0x1e6')][_0x54a9('0x116')](db[_0x54a9('0x17a')],{});db['SmsTransferReport'][_0x54a9('0x116')](db[_0x54a9('0x4f')],{});db[_0x54a9('0x1e6')][_0x54a9('0x116')](db[_0x54a9('0x4d')],{'foreignKey':'FromSmsAccountId','as':_0x54a9('0x1d7')});db[_0x54a9('0x1e6')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'foreignKey':_0x54a9('0x1de'),'as':_0x54a9('0x1d8')});db[_0x54a9('0x1e6')][_0x54a9('0x116')](db['User'],{'foreignKey':_0x54a9('0x1d9'),'as':_0x54a9('0x1da')});db['SmsTransferReport']['belongsTo'](db[_0x54a9('0x51')],{'foreignKey':_0x54a9('0x1e7'),'as':_0x54a9('0x1e2')});db[_0x54a9('0x1e6')][_0x54a9('0x116')](db[_0x54a9('0x4d')],{'foreignKey':'ToSmsAccountId','as':_0x54a9('0x1dc')});db[_0x54a9('0xe8')][_0x54a9('0x108')](db[_0x54a9('0x78')],{'as':_0x54a9('0x16a'),'foreignKey':'ListId','onDelete':_0x54a9('0x106')});db[_0x54a9('0xe8')][_0x54a9('0x108')](db[_0x54a9('0x71')],{'as':_0x54a9('0x1e8'),'foreignKey':_0x54a9('0x168')});db[_0x54a9('0xe8')]['hasMany'](db[_0x54a9('0x11b')],{'as':_0x54a9('0x11c'),'onDelete':'cascade','foreignKey':_0x54a9('0x168')});db[_0x54a9('0xe8')][_0x54a9('0x108')](db[_0x54a9('0x6d')],{'as':_0x54a9('0x10a'),'foreignKey':_0x54a9('0x168')});db['CmList'][_0x54a9('0x108')](db['CmHopperHistory'],{'as':_0x54a9('0x10b'),'foreignKey':'ListId'});db[_0x54a9('0xe8')][_0x54a9('0x108')](db[_0x54a9('0x6f')],{'as':_0x54a9('0x6f'),'foreignKey':'ListId'});db[_0x54a9('0xe8')]['belongsToMany'](db[_0x54a9('0x19')],{'as':_0x54a9('0x1e9'),'through':_0x54a9('0x145')});db['CmList']['belongsToMany'](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x11e')});db[_0x54a9('0xea')][_0x54a9('0x108')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x54a9('0x106')});db[_0x54a9('0xea')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0xff')});db[_0x54a9('0xea')][_0x54a9('0x118')](db[_0x54a9('0xd8')],{'through':_0x54a9('0xfd'),'as':_0x54a9('0x147')});db['UserProfile']['hasMany'](db[_0x54a9('0x11')],{'as':_0x54a9('0x173'),'foreignKey':_0x54a9('0x117')});db[_0x54a9('0xeb')][_0x54a9('0x108')](db[_0x54a9('0x1ea')],{'as':_0x54a9('0x1eb'),'foreignKey':_0x54a9('0x117'),'onDelete':_0x54a9('0x106')});db['UserProfileSection'][_0x54a9('0x108')](db[_0x54a9('0xed')],{'as':_0x54a9('0x1ec'),'foreignKey':_0x54a9('0x1ed'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0xf1')][_0x54a9('0x108')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x54a9('0x1ee'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0xf1')][_0x54a9('0x108')](db['CannedAnswer'],{'as':_0x54a9('0x15a'),'foreignKey':_0x54a9('0x1ee')});db['WhatsappAccount'][_0x54a9('0x108')](db[_0x54a9('0xf5')],{'as':_0x54a9('0x14c'),'foreignKey':_0x54a9('0x1ee')});db[_0x54a9('0xf1')][_0x54a9('0x108')](db[_0x54a9('0x111')],{'as':_0x54a9('0x16c')});db[_0x54a9('0xf1')]['hasMany'](db[_0x54a9('0xf3')],{'as':_0x54a9('0x136'),'foreignKey':_0x54a9('0x1ee'),'onDelete':_0x54a9('0x106')});db[_0x54a9('0xf1')][_0x54a9('0x116')](db['CmList'],{'as':_0x54a9('0x15b'),'foreignKey':_0x54a9('0x168')});db['WhatsappAccount'][_0x54a9('0x116')](db[_0x54a9('0x141')],{'as':'mandatoryDispositionPause','foreignKey':_0x54a9('0x143')});db[_0x54a9('0xf1')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':'user_has_whatsapp_accounts'});db[_0x54a9('0xf3')]['belongsTo'](db[_0x54a9('0x11')],{'onDelete':'restrict'});db[_0x54a9('0xf3')][_0x54a9('0x116')](db[_0x54a9('0xf9')],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0xf3')][_0x54a9('0x116')](db['WhatsappAccount'],{'onDelete':_0x54a9('0x157')});db[_0x54a9('0xf3')][_0x54a9('0x116')](db['Interval'],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x140')});db[_0x54a9('0xf3')][_0x54a9('0x116')](db[_0x54a9('0x85')],{'onDelete':_0x54a9('0x157'),'foreignKey':_0x54a9('0x167')});db[_0x54a9('0x111')][_0x54a9('0x108')](db[_0x54a9('0xf5')],{'as':_0x54a9('0x14c'),'onDelete':_0x54a9('0x106'),'foreignKey':_0x54a9('0x1ef')});db['WhatsappInteraction']['belongsTo'](db[_0x54a9('0xf1')],{'as':'Account','foreignKey':_0x54a9('0x1ee')});db[_0x54a9('0x111')][_0x54a9('0x116')](db['CmContact'],{'as':_0x54a9('0x153'),'foreignKey':_0x54a9('0x154')});db[_0x54a9('0x111')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':'Owner','foreignKey':_0x54a9('0x107')});db['WhatsappInteraction'][_0x54a9('0x118')](db[_0x54a9('0x85')],{'through':_0x54a9('0x1f0'),'as':'Tags'});db[_0x54a9('0x111')]['belongsToMany'](db[_0x54a9('0x85')],{'through':_0x54a9('0x1f0'),'as':_0x54a9('0x172')});db[_0x54a9('0x111')][_0x54a9('0x118')](db['User'],{'as':'Users','through':_0x54a9('0x123'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x54a9('0x116')](db['User'],{'as':_0x54a9('0x11')});db[_0x54a9('0xf5')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'onDelete':_0x54a9('0x106'),'as':'Contact'});db[_0x54a9('0xf5')][_0x54a9('0x116')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x54a9('0x164'),'foreignKey':'WhatsappInteractionId'});db[_0x54a9('0xf5')][_0x54a9('0x116')](db[_0x54a9('0xf1')],{'as':_0x54a9('0x15e'),'foreignKey':_0x54a9('0x1ee')});db[_0x54a9('0xf7')]['belongsTo'](db[_0x54a9('0xf1')],{});db['WhatsappQueueReport'][_0x54a9('0x116')](db[_0x54a9('0xe8')],{'as':_0x54a9('0x15b'),'foreignKey':'ListId'});db[_0x54a9('0xf7')][_0x54a9('0x116')](db[_0x54a9('0x11b')],{'as':'Contact','foreignKey':'ContactId'});db[_0x54a9('0xf7')][_0x54a9('0x116')](db['WhatsappInteraction'],{});db[_0x54a9('0xf7')][_0x54a9('0x116')](db[_0x54a9('0xf9')],{});db[_0x54a9('0xf7')][_0x54a9('0x116')](db[_0x54a9('0xf5')],{});db[_0x54a9('0xf7')][_0x54a9('0x116')](db[_0x54a9('0x11')],{});db[_0x54a9('0x1f1')][_0x54a9('0x116')](db[_0x54a9('0xf5')],{});db[_0x54a9('0x1f1')]['belongsTo'](db[_0x54a9('0x111')],{});db['WhatsappTransferReport'][_0x54a9('0x116')](db[_0x54a9('0xf1')],{'foreignKey':_0x54a9('0x1f2'),'as':'FromAccount'});db[_0x54a9('0x1f1')]['belongsTo'](db[_0x54a9('0xf1')],{'foreignKey':_0x54a9('0x1f3'),'as':_0x54a9('0x1dc')});db[_0x54a9('0x1f1')][_0x54a9('0x116')](db[_0x54a9('0xf9')],{'foreignKey':_0x54a9('0x1f4'),'as':_0x54a9('0x1e2')});db['WhatsappTransferReport'][_0x54a9('0x116')](db[_0x54a9('0x11')],{'foreignKey':_0x54a9('0x1de'),'as':_0x54a9('0x1d8')});db[_0x54a9('0x1f1')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'foreignKey':_0x54a9('0x1d9'),'as':_0x54a9('0x1da')});db[_0x54a9('0xf9')][_0x54a9('0x118')](db[_0x54a9('0x11')],{'as':_0x54a9('0x146'),'through':_0x54a9('0x12c'),'foreignKey':_0x54a9('0x1f5')});db[_0x54a9('0xf9')][_0x54a9('0x118')](db[_0x54a9('0xd8')],{'through':_0x54a9('0x1d2'),'as':_0x54a9('0x147')});db[_0x54a9('0x100')][_0x54a9('0x116')](db[_0x54a9('0x11')],{'as':_0x54a9('0x1f6'),'foreignKey':_0x54a9('0x107'),'onDelete':'cascade','hooks':!![]});db['CloudProvider'][_0x54a9('0x104')](db[_0x54a9('0x1c8')],{'as':_0x54a9('0x1c8'),'onDelete':'restrict'});db[_0x54a9('0xfa')][_0x54a9('0x104')](db['MailServerIn'],{'as':_0x54a9('0x158'),'onDelete':_0x54a9('0x157')});db[_0x54a9('0xfa')][_0x54a9('0x104')](db[_0x54a9('0x34')],{'as':_0x54a9('0x159'),'onDelete':_0x54a9('0x157')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 17081e8..064925c 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb145=['/api/canned_answers','/api/dispositions','./api/disposition','/api/intervals','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/system','/api/pm2','/apidoc','join','/www','static','root','/demo','/snippet','snippet','3.13.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/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/voice/queues/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','./api/smsAccount','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation'];(function(_0x1359c9,_0x5b4e08){var _0x11873e=function(_0x842904){while(--_0x842904){_0x1359c9['push'](_0x1359c9['shift']());}};_0x11873e(++_0x5b4e08);}(_0xb145,0xa3));var _0x5b14=function(_0x129cc2,_0xbf4323){_0x129cc2=_0x129cc2-0x0;var _0x1c3d7e=_0xb145[_0x129cc2];return _0x1c3d7e;};'use strict';var path=require('path');var express=require(_0x5b14('0x0'));var errors=require(_0x5b14('0x1'));var config=require(_0x5b14('0x2'));var setupLoggers=require(_0x5b14('0x3'))[_0x5b14('0x4')];var clientSideLogs=require(_0x5b14('0x5'));exports[_0x5b14('0x6')]=function(_0x34b4cd){return setupLoggers(_0x34b4cd)['then'](function(){_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x8'),require(_0x5b14('0x9')));_0x34b4cd[_0x5b14('0x7')]('/api/voice/chanspy',require(_0x5b14('0xa')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xb'),require(_0x5b14('0xc')));_0x34b4cd[_0x5b14('0x7')]('/api/voice/extensions',require(_0x5b14('0xd')));_0x34b4cd[_0x5b14('0x7')]('/api/voice/mohs',require(_0x5b14('0xe')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xf'),require(_0x5b14('0x10')));_0x34b4cd[_0x5b14('0x7')]('/api/voice/recordings',require(_0x5b14('0x11')));_0x34b4cd['use'](_0x5b14('0x12'),require(_0x5b14('0x13')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x14'),require(_0x5b14('0x15')));_0x34b4cd[_0x5b14('0x7')]('/api/voice/mails/messages',require(_0x5b14('0x16')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x17'),require(_0x5b14('0x18')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x19'),require(_0x5b14('0x1a')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x1b'),require(_0x5b14('0x1c')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x1d'),require('./api/voiceQueueReport'));_0x34b4cd[_0x5b14('0x7')]('/api/members/reports',require('./api/memberReport'));_0x34b4cd['use'](_0x5b14('0x1e'),require(_0x5b14('0x1f')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x20'),require(_0x5b14('0x21')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x22'),require('./api/mailServerOut'));_0x34b4cd['use']('/api/mail/accounts',require(_0x5b14('0x23')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x24'),require(_0x5b14('0x25')));_0x34b4cd['use'](_0x5b14('0x26'),require(_0x5b14('0x27')));_0x34b4cd['use'](_0x5b14('0x28'),require(_0x5b14('0x29')));_0x34b4cd['use'](_0x5b14('0x2a'),require('./api/mailMessage'));_0x34b4cd['use']('/api/mail/applications',require('./api/mailApplication'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x2b'),require(_0x5b14('0x2c')));_0x34b4cd['use'](_0x5b14('0x2d'),require(_0x5b14('0x2e')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x2f'),require(_0x5b14('0x30')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x31'),require(_0x5b14('0x32')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x33'),require(_0x5b14('0x34')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x35'),require(_0x5b14('0x36')));_0x34b4cd['use'](_0x5b14('0x37'),require(_0x5b14('0x38')));_0x34b4cd['use']('/api/fax/queues',require(_0x5b14('0x39')));_0x34b4cd[_0x5b14('0x7')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x34b4cd[_0x5b14('0x7')]('/api/sms/accounts',require(_0x5b14('0x3a')));_0x34b4cd[_0x5b14('0x7')]('/api/sms/applications',require('./api/smsApplication'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x3b'),require(_0x5b14('0x3c')));_0x34b4cd['use'](_0x5b14('0x3d'),require('./api/smsMessage'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x3e'),require(_0x5b14('0x3f')));_0x34b4cd[_0x5b14('0x7')]('/api/openchannel/accounts',require(_0x5b14('0x40')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x41'),require(_0x5b14('0x42')));_0x34b4cd['use'](_0x5b14('0x43'),require(_0x5b14('0x44')));_0x34b4cd[_0x5b14('0x7')]('/api/openchannel/messages',require(_0x5b14('0x45')));_0x34b4cd['use'](_0x5b14('0x46'),require(_0x5b14('0x47')));_0x34b4cd['use'](_0x5b14('0x48'),require(_0x5b14('0x49')));_0x34b4cd['use'](_0x5b14('0x4a'),require('./api/openchannelQueueReport'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x4b'),require(_0x5b14('0x4c')));_0x34b4cd[_0x5b14('0x7')]('/api/chat/interactions',require(_0x5b14('0x4d')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x4e'),require(_0x5b14('0x4f')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x50'),require(_0x5b14('0x51')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x52'),require(_0x5b14('0x53')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x54'),require(_0x5b14('0x55')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x56'),require(_0x5b14('0x57')));_0x34b4cd['use'](_0x5b14('0x58'),require('./api/cmCompany'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x59'),require('./api/cmContact'));_0x34b4cd['use']('/api/cm/hopper',require(_0x5b14('0x5a')));_0x34b4cd[_0x5b14('0x7')]('/api/cm/hopper_black',require(_0x5b14('0x5b')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x5c'),require(_0x5b14('0x5d')));_0x34b4cd[_0x5b14('0x7')]('/api/cm/hopper_history',require(_0x5b14('0x5e')));_0x34b4cd[_0x5b14('0x7')]('/api/cm/custom_fields',require(_0x5b14('0x5f')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x60'),require(_0x5b14('0x61')));_0x34b4cd['use'](_0x5b14('0x62'),require(_0x5b14('0x63')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x64'),require('./api/cannedAnswer'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x65'),require(_0x5b14('0x66')));_0x34b4cd[_0x5b14('0x7')]('/api/conditions',require('./api/condition'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x67'),require('./api/interval'));_0x34b4cd[_0x5b14('0x7')]('/api/pauses',require(_0x5b14('0x68')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x69'),require(_0x5b14('0x6a')));_0x34b4cd[_0x5b14('0x7')]('/api/voiceQueuesLog',require(_0x5b14('0x6b')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x6c'),require(_0x5b14('0x6d')));_0x34b4cd[_0x5b14('0x7')]('/api/sounds',require('./api/sound'));_0x34b4cd[_0x5b14('0x7')]('/api/tags',require('./api/tag'));_0x34b4cd['use'](_0x5b14('0x6e'),require(_0x5b14('0x6f')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x70'),require(_0x5b14('0x71')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x72'),require('./api/cmHopperAdditionalPhone'));_0x34b4cd['use']('/api/templates',require('./api/template'));_0x34b4cd['use'](_0x5b14('0x73'),require(_0x5b14('0x74')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x75'),require(_0x5b14('0x76')));_0x34b4cd['use']('/api/integrations',require(_0x5b14('0x77')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/reports',require(_0x5b14('0x78')));_0x34b4cd[_0x5b14('0x7')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x79'),require(_0x5b14('0x7a')));_0x34b4cd['use'](_0x5b14('0x7b'),require(_0x5b14('0x7c')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x7d'),require(_0x5b14('0x7e')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x7f'),require('./api/analyticFieldReport'));_0x34b4cd[_0x5b14('0x7')]('/api/analytics/tree_reports',require(_0x5b14('0x80')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x81'),require(_0x5b14('0x82')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x83'),require(_0x5b14('0x84')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x85'),require(_0x5b14('0x86')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x87'),require('./api/intSugarcrmAccount'));_0x34b4cd['use']('/api/integrations/sugarcrm/configurations',require(_0x5b14('0x88')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x89'),require(_0x5b14('0x8a')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x8b'),require(_0x5b14('0x8c')));_0x34b4cd['use'](_0x5b14('0x8d'),require(_0x5b14('0x8e')));_0x34b4cd['use']('/api/integrations/desk/fields',require(_0x5b14('0x8f')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x90'),require(_0x5b14('0x91')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x92'),require('./api/intZohoConfiguration'));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/zoho/fields',require(_0x5b14('0x93')));_0x34b4cd['use'](_0x5b14('0x94'),require(_0x5b14('0x95')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/zendesk/configurations',require(_0x5b14('0x96')));_0x34b4cd['use'](_0x5b14('0x97'),require(_0x5b14('0x98')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/freshdesk/accounts',require(_0x5b14('0x99')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x9a'),require(_0x5b14('0x9b')));_0x34b4cd['use'](_0x5b14('0x9c'),require('./api/intFreshdeskField'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0x9d'),require('./api/intVtigerAccount'));_0x34b4cd['use'](_0x5b14('0x9e'),require(_0x5b14('0x9f')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/vtiger/fields',require(_0x5b14('0xa0')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/servicenow/accounts',require(_0x5b14('0xa1')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xa2'),require(_0x5b14('0xa3')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/servicenow/fields',require(_0x5b14('0xa4')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xa5'),require('./api/intDynamics365Configuration'));_0x34b4cd['use'](_0x5b14('0xa6'),require(_0x5b14('0xa7')));_0x34b4cd[_0x5b14('0x7')]('/api/integrations/freshsales/accounts',require(_0x5b14('0xa8')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xa9'),require('./api/intFreshsalesConfiguration'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xaa'),require(_0x5b14('0xab')));_0x34b4cd['use'](_0x5b14('0xac'),require(_0x5b14('0xad')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xae'),require(_0x5b14('0xaf')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xb0'),require('./api/chatInternalMessage'));_0x34b4cd['use']('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xb1'),require(_0x5b14('0xb2')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xb3'),require('./api/jscriptySessionReport'));_0x34b4cd['use'](_0x5b14('0xb4'),require(_0x5b14('0xb5')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xb6'),require(_0x5b14('0xb7')));_0x34b4cd['use']('/api/square/details/reports',require(_0x5b14('0xb8')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xb9'),require(_0x5b14('0xba')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xbb'),require(_0x5b14('0xbc')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xbd'),require('./api/squareOdbc'));_0x34b4cd[_0x5b14('0x7')]('/api/square/projects',require(_0x5b14('0xbe')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xbf'),require(_0x5b14('0xc0')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xc1'),require(_0x5b14('0xc2')));_0x34b4cd['use']('/api/teams',require(_0x5b14('0xc3')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xc4'),require(_0x5b14('0xc5')));_0x34b4cd[_0x5b14('0x7')]('/api/campaigns',require(_0x5b14('0xc6')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xc7'),require(_0x5b14('0xc8')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xc9'),require(_0x5b14('0xca')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xcb'),require(_0x5b14('0xcc')));_0x34b4cd['use']('/api/mail/reports/transfer',require(_0x5b14('0xcd')));_0x34b4cd[_0x5b14('0x7')]('/api/chat/reports/transfer',require(_0x5b14('0xce')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xcf'),require(_0x5b14('0xd0')));_0x34b4cd['use'](_0x5b14('0xd1'),require(_0x5b14('0xd2')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xd3'),require(_0x5b14('0xd4')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xd5'),require('./api/cmList'));_0x34b4cd['use']('/api/voice/prefixes',require(_0x5b14('0xd6')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xd7'),require(_0x5b14('0xd8')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xd9'),require(_0x5b14('0xda')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xdb'),require(_0x5b14('0xdc')));_0x34b4cd[_0x5b14('0x7')]('/api/userNotifications',require(_0x5b14('0xdd')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xde'),require(_0x5b14('0xdf')));_0x34b4cd['use'](_0x5b14('0xe0'),require(_0x5b14('0xe1')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xe2'),require(_0x5b14('0xe3')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xe4'),require(_0x5b14('0xe5')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xe6'),require(_0x5b14('0xe7')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xe8'),require(_0x5b14('0xe9')));_0x34b4cd[_0x5b14('0x7')]('/api/whatsapp/queues',require(_0x5b14('0xea')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xeb'),require(_0x5b14('0xec')));_0x34b4cd[_0x5b14('0x7')]('/api/realtime',require('./api/realtime'));_0x34b4cd[_0x5b14('0x7')]('/api/user-settings',require(_0x5b14('0xed')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xee'),require(_0x5b14('0xef')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xf0'),require('./api/authLocal'));_0x34b4cd[_0x5b14('0x7')]('/api/auth/google',require('./api/authGoogle'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xf1'),require(_0x5b14('0xf2')));_0x34b4cd['use']('/api/jira',require('./api/jira'));_0x34b4cd['use'](_0x5b14('0xf3'),require(_0x5b14('0xf4')));_0x34b4cd[_0x5b14('0x7')]('/api/version',require('./api/version'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xf5'),require('./api/system'));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xf6'),require('./api/pm2'));_0x34b4cd['use']('/api/webbar',require('./api/webbar'));_0x34b4cd[_0x5b14('0x7')]('/api/logs',clientSideLogs);_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xf7'),express['static'](path[_0x5b14('0xf8')](config['root'],_0x5b14('0xf7'))));_0x34b4cd['use'](_0x5b14('0xf9'),express[_0x5b14('0xfa')](path['join'](config[_0x5b14('0xfb')],_0x5b14('0xf9'))));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xfc'),express['static'](path[_0x5b14('0xf8')](config[_0x5b14('0xfb')],'/demo')));_0x34b4cd[_0x5b14('0x7')](_0x5b14('0xfd'),express[_0x5b14('0xfa')](path['join'](config[_0x5b14('0xfb')],_0x5b14('0xfe'),_0x5b14('0xff'))));_0x34b4cd['use'](_0x5b14('0x100'),express['static'](path[_0x5b14('0xf8')](config['root'],_0x5b14('0x101'))));_0x34b4cd[_0x5b14('0x102')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x5b14('0x103')](errors[0x194]);_0x34b4cd['route']('/*')[_0x5b14('0x103')](function(_0x891dee,_0x411d37){_0x411d37[_0x5b14('0x104')](path[_0x5b14('0x105')](_0x34b4cd['get']('appPath')+_0x5b14('0x106')));});return _0x34b4cd;});}; \ No newline at end of file +var _0x77d4=['/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/canned_answers','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','./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/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/fields','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/configurations','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareMessage','/api/teams','./api/team','/api/license','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/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.13.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','resolve','get','appPath','/index.html','express','./config/environment','setupLoggers','./api/client-side-logs','then','use','/api/users','./api/user','/api/voice/chanspy'];(function(_0x255ba3,_0x122f02){var _0xc0ba9b=function(_0x147de6){while(--_0x147de6){_0x255ba3['push'](_0x255ba3['shift']());}};_0xc0ba9b(++_0x122f02);}(_0x77d4,0x108));var _0x477d=function(_0x41d3e0,_0x3e52a7){_0x41d3e0=_0x41d3e0-0x0;var _0x5c058c=_0x77d4[_0x41d3e0];return _0x5c058c;};'use strict';var path=require('path');var express=require(_0x477d('0x0'));var errors=require('./errors');var config=require(_0x477d('0x1'));var setupLoggers=require('./utils/client-side-logger')[_0x477d('0x2')];var clientSideLogs=require(_0x477d('0x3'));exports['default']=function(_0x53e1b8){return setupLoggers(_0x53e1b8)[_0x477d('0x4')](function(){_0x53e1b8[_0x477d('0x5')](_0x477d('0x6'),require(_0x477d('0x7')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x8'),require('./api/voiceChanSpy'));_0x53e1b8['use'](_0x477d('0x9'),require('./api/voiceContext'));_0x53e1b8['use'](_0x477d('0xa'),require(_0x477d('0xb')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xc'),require(_0x477d('0xd')));_0x53e1b8['use'](_0x477d('0xe'),require('./api/voiceQueue'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xf'),require('./api/voiceRecording'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x10'),require('./api/screenRecording'));_0x53e1b8['use'](_0x477d('0x11'),require(_0x477d('0x12')));_0x53e1b8['use'](_0x477d('0x13'),require(_0x477d('0x14')));_0x53e1b8['use']('/api/voice/calls/reports',require(_0x477d('0x15')));_0x53e1b8['use'](_0x477d('0x16'),require(_0x477d('0x17')));_0x53e1b8[_0x477d('0x5')]('/api/voice/agents/reports',require(_0x477d('0x18')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x19'),require(_0x477d('0x1a')));_0x53e1b8['use'](_0x477d('0x1b'),require('./api/memberReport'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x1c'),require(_0x477d('0x1d')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x1e'),require(_0x477d('0x1f')));_0x53e1b8['use'](_0x477d('0x20'),require('./api/mailServerOut'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x21'),require(_0x477d('0x22')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x23'),require(_0x477d('0x24')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x25'),require(_0x477d('0x26')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x27'),require(_0x477d('0x28')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x29'),require('./api/mailMessage'));_0x53e1b8[_0x477d('0x5')]('/api/mail/applications',require(_0x477d('0x2a')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x2b'),require(_0x477d('0x2c')));_0x53e1b8['use'](_0x477d('0x2d'),require(_0x477d('0x2e')));_0x53e1b8[_0x477d('0x5')]('/api/dashboards/items',require('./api/dashboardItem'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x2f'),require(_0x477d('0x30')));_0x53e1b8['use'](_0x477d('0x31'),require(_0x477d('0x32')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x33'),require(_0x477d('0x34')));_0x53e1b8['use'](_0x477d('0x35'),require(_0x477d('0x36')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x37'),require(_0x477d('0x38')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x39'),require(_0x477d('0x3a')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x3b'),require(_0x477d('0x3c')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x3d'),require(_0x477d('0x3e')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x3f'),require(_0x477d('0x40')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x41'),require(_0x477d('0x42')));_0x53e1b8['use'](_0x477d('0x43'),require('./api/smsQueue'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x44'),require(_0x477d('0x45')));_0x53e1b8['use'](_0x477d('0x46'),require(_0x477d('0x47')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x48'),require(_0x477d('0x49')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x4a'),require(_0x477d('0x4b')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x4c'),require('./api/openchannelQueue'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x4d'),require(_0x477d('0x4e')));_0x53e1b8['use'](_0x477d('0x4f'),require(_0x477d('0x50')));_0x53e1b8[_0x477d('0x5')]('/api/chat/applications',require('./api/chatApplication'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x51'),require(_0x477d('0x52')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x53'),require('./api/chatMessage'));_0x53e1b8[_0x477d('0x5')]('/api/chat/offline_messages',require(_0x477d('0x54')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x55'),require('./api/chatQueue'));_0x53e1b8['use'](_0x477d('0x56'),require(_0x477d('0x57')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x58'),require('./api/chatProactiveAction'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x59'),require(_0x477d('0x5a')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x5b'),require('./api/cmContact'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x5c'),require('./api/cmHopper'));_0x53e1b8[_0x477d('0x5')]('/api/cm/hopper_black',require(_0x477d('0x5d')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x5e'),require(_0x477d('0x5f')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x60'),require(_0x477d('0x61')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x62'),require('./api/cmCustomField'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x63'),require(_0x477d('0x64')));_0x53e1b8[_0x477d('0x5')]('/api/automations',require('./api/automation'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x65'),require('./api/cannedAnswer'));_0x53e1b8[_0x477d('0x5')]('/api/dispositions',require('./api/disposition'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x66'),require(_0x477d('0x67')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x68'),require(_0x477d('0x69')));_0x53e1b8['use'](_0x477d('0x6a'),require(_0x477d('0x6b')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x6c'),require(_0x477d('0x6d')));_0x53e1b8['use']('/api/voiceQueuesLog',require(_0x477d('0x6e')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x6f'),require('./api/schedule'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x70'),require(_0x477d('0x71')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x72'),require(_0x477d('0x73')));_0x53e1b8[_0x477d('0x5')]('/api/contact_item_types',require(_0x477d('0x74')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x75'),require(_0x477d('0x76')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x77'),require(_0x477d('0x78')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x79'),require(_0x477d('0x7a')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x7b'),require(_0x477d('0x7c')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x7d'),require('./api/variable'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x7e'),require('./api/integration'));_0x53e1b8['use']('/api/integrations/reports',require(_0x477d('0x7f')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x80'),require(_0x477d('0x81')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x82'),require(_0x477d('0x83')));_0x53e1b8[_0x477d('0x5')]('/api/analytics/extracted_reports',require(_0x477d('0x84')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x85'),require(_0x477d('0x86')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x87'),require(_0x477d('0x88')));_0x53e1b8[_0x477d('0x5')]('/api/analytics/tree_reports',require(_0x477d('0x89')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x8a'),require(_0x477d('0x8b')));_0x53e1b8[_0x477d('0x5')]('/api/integrations/salesforce/configurations',require(_0x477d('0x8c')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x8d'),require(_0x477d('0x8e')));_0x53e1b8[_0x477d('0x5')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x8f'),require(_0x477d('0x90')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x91'),require(_0x477d('0x92')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x93'),require('./api/intDeskAccount'));_0x53e1b8['use']('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x53e1b8['use'](_0x477d('0x94'),require('./api/intDeskField'));_0x53e1b8[_0x477d('0x5')]('/api/integrations/zoho/accounts',require(_0x477d('0x95')));_0x53e1b8[_0x477d('0x5')]('/api/integrations/zoho/configurations',require(_0x477d('0x96')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x97'),require(_0x477d('0x98')));_0x53e1b8[_0x477d('0x5')]('/api/integrations/zendesk/accounts',require(_0x477d('0x99')));_0x53e1b8[_0x477d('0x5')]('/api/integrations/zendesk/configurations',require(_0x477d('0x9a')));_0x53e1b8[_0x477d('0x5')](_0x477d('0x9b'),require(_0x477d('0x9c')));_0x53e1b8[_0x477d('0x5')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x9d'),require('./api/intFreshdeskConfiguration'));_0x53e1b8[_0x477d('0x5')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x53e1b8[_0x477d('0x5')](_0x477d('0x9e'),require(_0x477d('0x9f')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xa0'),require('./api/intVtigerConfiguration'));_0x53e1b8['use'](_0x477d('0xa1'),require(_0x477d('0xa2')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xa3'),require(_0x477d('0xa4')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xa5'),require(_0x477d('0xa6')));_0x53e1b8[_0x477d('0x5')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x53e1b8[_0x477d('0x5')]('/api/integrations/dynamics365/accounts',require(_0x477d('0xa7')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xa8'),require('./api/intDynamics365Configuration'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xa9'),require('./api/intDynamics365Field'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xaa'),require(_0x477d('0xab')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xac'),require(_0x477d('0xad')));_0x53e1b8['use'](_0x477d('0xae'),require(_0x477d('0xaf')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xb0'),require('./api/network'));_0x53e1b8[_0x477d('0x5')]('/api/chat/reports/queue',require(_0x477d('0xb1')));_0x53e1b8[_0x477d('0x5')]('/api/chat/internal/messages',require(_0x477d('0xb2')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xb3'),require('./api/jscriptyAnswerReport'));_0x53e1b8['use'](_0x477d('0xb4'),require(_0x477d('0xb5')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xb6'),require('./api/jscriptySessionReport'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xb7'),require('./api/smsQueueReport'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xb8'),require(_0x477d('0xb9')));_0x53e1b8['use'](_0x477d('0xba'),require(_0x477d('0xbb')));_0x53e1b8[_0x477d('0x5')]('/api/jscripty/projects',require(_0x477d('0xbc')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xbd'),require(_0x477d('0xbe')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xbf'),require(_0x477d('0xc0')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xc1'),require('./api/squareProject'));_0x53e1b8['use'](_0x477d('0xc2'),require('./api/squareRecording'));_0x53e1b8[_0x477d('0x5')]('/api/square/messages',require(_0x477d('0xc3')));_0x53e1b8['use'](_0x477d('0xc4'),require(_0x477d('0xc5')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xc6'),require('./api/license'));_0x53e1b8['use']('/api/campaigns',require('./api/campaign'));_0x53e1b8['use'](_0x477d('0xc7'),require(_0x477d('0xc8')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xc9'),require(_0x477d('0xca')));_0x53e1b8[_0x477d('0x5')]('/api/plugins',require(_0x477d('0xcb')));_0x53e1b8['use']('/api/mail/reports/transfer',require(_0x477d('0xcc')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xcd'),require(_0x477d('0xce')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xcf'),require('./api/faxTransferReport'));_0x53e1b8['use'](_0x477d('0xd0'),require(_0x477d('0xd1')));_0x53e1b8[_0x477d('0x5')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xd2'),require(_0x477d('0xd3')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xd4'),require(_0x477d('0xd5')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xd6'),require(_0x477d('0xd7')));_0x53e1b8['use'](_0x477d('0xd8'),require(_0x477d('0xd9')));_0x53e1b8['use'](_0x477d('0xda'),require(_0x477d('0xdb')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xdc'),require(_0x477d('0xdd')));_0x53e1b8['use'](_0x477d('0xde'),require('./api/whatsappAccount'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xdf'),require('./api/whatsappApplication'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xe0'),require('./api/whatsappInteraction'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xe1'),require('./api/whatsappMessage'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xe2'),require(_0x477d('0xe3')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xe4'),require(_0x477d('0xe5')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xe6'),require(_0x477d('0xe7')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xe8'),require(_0x477d('0xe9')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xea'),require(_0x477d('0xeb')));_0x53e1b8['use'](_0x477d('0xec'),require('./api/user-setting'));_0x53e1b8['use'](_0x477d('0xed'),require(_0x477d('0xee')));_0x53e1b8['use'](_0x477d('0xef'),require(_0x477d('0xf0')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xf1'),require(_0x477d('0xf2')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xf3'),require('./api/authActiveDirectory'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xf4'),require('./api/jira'));_0x53e1b8[_0x477d('0x5')](_0x477d('0xf5'),require(_0x477d('0xf6')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xf7'),require(_0x477d('0xf8')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xf9'),require(_0x477d('0xfa')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xfb'),require(_0x477d('0xfc')));_0x53e1b8[_0x477d('0x5')](_0x477d('0xfd'),require(_0x477d('0xfe')));_0x53e1b8[_0x477d('0x5')]('/api/logs',clientSideLogs);_0x53e1b8['use'](_0x477d('0xff'),express['static'](path['join'](config['root'],_0x477d('0xff'))));_0x53e1b8[_0x477d('0x5')]('/www',express[_0x477d('0x100')](path[_0x477d('0x101')](config[_0x477d('0x102')],_0x477d('0x103'))));_0x53e1b8[_0x477d('0x5')]('/demo',express['static'](path[_0x477d('0x101')](config[_0x477d('0x102')],_0x477d('0x104'))));_0x53e1b8[_0x477d('0x5')](_0x477d('0x105'),express['static'](path['join'](config['root'],_0x477d('0x106'),_0x477d('0x107'))));_0x53e1b8['use'](_0x477d('0x108'),express[_0x477d('0x100')](path[_0x477d('0x101')](config[_0x477d('0x102')],_0x477d('0x109'))));_0x53e1b8[_0x477d('0x10a')](_0x477d('0x10b'))['get'](errors[0x194]);_0x53e1b8[_0x477d('0x10a')]('/*')['get'](function(_0x43d598,_0xae98cc){_0xae98cc[_0x477d('0x10c')](path[_0x477d('0x10d')](_0x53e1b8[_0x477d('0x10e')](_0x477d('0x10f'))+_0x477d('0x110')));});return _0x53e1b8;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index ee5411e..0ec98ff 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b18=['../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.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','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc'];(function(_0x31711a,_0x10590e){var _0x3b407f=function(_0x2f552c){while(--_0x2f552c){_0x31711a['push'](_0x31711a['shift']());}};_0x3b407f(++_0x10590e);}(_0x2b18,0x11e));var _0x82b1=function(_0x787615,_0x90378f){_0x787615=_0x787615-0x0;var _0x5d0c88=_0x2b18[_0x787615];return _0x5d0c88;};'use strict';var jayson=require(_0x82b1('0x0'));var _=require(_0x82b1('0x1'));var config=require(_0x82b1('0x2'));exports['listen']=function(){return new Promise(function(_0x588211,_0x2c44c2){var _0x4c16bd={};_0x4c16bd=_['merge'](_0x4c16bd,require('../api/user/user.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/voiceExtension/voiceExtension.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/voiceQueue/voiceQueue.rpc'));_0x4c16bd=_['merge'](_0x4c16bd,require('../api/voiceRecording/voiceRecording.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x4')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x5')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x6')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x7')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x8')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x9')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0xa')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0xb')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0xc')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0xd')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0xe')));_0x4c16bd=_['merge'](_0x4c16bd,require('../api/mailInteraction/mailInteraction.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0xf')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x10')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x11')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x12')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x13')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x14')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x15')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/faxQueue/faxQueue.rpc'));_0x4c16bd=_['merge'](_0x4c16bd,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x16')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x17')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x18')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x19')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x1a')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x1b')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x1c')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x1d')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x1e')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x1f')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x20')));_0x4c16bd=_['merge'](_0x4c16bd,require('../api/cmHopper/cmHopper.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x21')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x22')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x23')));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x24')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x25')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x26')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x27')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x28')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x29')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x2a')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x2b')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x2c')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x2d')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x2e')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x2f')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x30')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x31')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x32')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/setting/setting.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/squareOdbc/squareOdbc.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x33')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x34')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x35')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/campaign/campaign.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x36')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x37')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x4c16bd=_['merge'](_0x4c16bd,require(_0x82b1('0x38')));_0x4c16bd=_['merge'](_0x4c16bd,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require(_0x82b1('0x39')));_0x4c16bd=_[_0x82b1('0x3')](_0x4c16bd,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x1bd85d=jayson['server'](_0x4c16bd)[_0x82b1('0x3a')]();var _0xc4dfa3=config['rpc']['port']||config['port']+0x1;var _0x5101f7=config[_0x82b1('0x3b')]['ip']||_0x82b1('0x3c');_0x1bd85d['on'](_0x82b1('0x3d'),function(_0x4addba){return _0x2c44c2(_0x4addba);});_0x1bd85d[_0x82b1('0x3e')](_0xc4dfa3,_0x5101f7,function(){console['log'](_0x82b1('0x3f'),_0x5101f7,_0xc4dfa3);require(_0x82b1('0x40'))[_0x82b1('0x41')]();return _0x588211(_0x82b1('0x42')+_0x5101f7+':'+_0xc4dfa3);});});}; \ No newline at end of file +var _0xaa37=['../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc'];(function(_0x5b2b34,_0xe14d30){var _0x31db59=function(_0xfdb941){while(--_0xfdb941){_0x5b2b34['push'](_0x5b2b34['shift']());}};_0x31db59(++_0xe14d30);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xaa37[_0x422905];return _0x33dc6c;};'use strict';var jayson=require(_0x7aa3('0x0'));var _=require(_0x7aa3('0x1'));var config=require(_0x7aa3('0x2'));exports[_0x7aa3('0x3')]=function(){return new Promise(function(_0x4dcf7a,_0xa0e7e9){var _0x27adcf={};_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x5')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x6')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/voiceQueue/voiceQueue.rpc'));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x7')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x8')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x9')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0xa')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0xb')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0xc')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/trunk/trunk.rpc'));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0xd')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0xe')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/mailServerIn/mailServerIn.rpc'));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0xf')));_0x27adcf=_['merge'](_0x27adcf,require('../api/mailQueue/mailQueue.rpc'));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x10')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x11')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x12')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x13')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x14')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/faxApplication/faxApplication.rpc'));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x15')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x16')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/faxQueue/faxQueue.rpc'));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x17')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x18')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/smsInteraction/smsInteraction.rpc'));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x19')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x1a')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x1b')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x1c')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x1d')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x1e')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x1f')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x20')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x21')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x22')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x23')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x24')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x25')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x26')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x27')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x28')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/interval/interval.rpc'));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x29')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/sound/sound.rpc'));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x2a')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x2b')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x2c')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x2d')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x2e')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x2f')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x30')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x31')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x32')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x33')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x34')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x35')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x36')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x37')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x38')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x39')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x3a')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x3b')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x3c')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x3d')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x3e')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x3f')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x40')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x41')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x42')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require('../api/plugin/plugin.rpc'));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x43')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x44')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x45')));_0x27adcf=_['merge'](_0x27adcf,require(_0x7aa3('0x46')));_0x27adcf=_[_0x7aa3('0x4')](_0x27adcf,require(_0x7aa3('0x47')));var _0x1177b4=jayson[_0x7aa3('0x48')](_0x27adcf)[_0x7aa3('0x49')]();var _0x123031=config[_0x7aa3('0x4a')][_0x7aa3('0x4b')]||config[_0x7aa3('0x4b')]+0x1;var _0x5ee53c=config[_0x7aa3('0x4a')]['ip']||_0x7aa3('0x4c');_0x1177b4['on'](_0x7aa3('0x4d'),function(_0x11111a){return _0xa0e7e9(_0x11111a);});_0x1177b4[_0x7aa3('0x3')](_0x123031,_0x5ee53c,function(){console[_0x7aa3('0x4e')](_0x7aa3('0x4f'),_0x5ee53c,_0x123031);require(_0x7aa3('0x50'))[_0x7aa3('0x51')]();return _0x4dcf7a(_0x7aa3('0x52')+_0x5ee53c+':'+_0x123031);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 4994b6b..3c20fc9 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 _0x0b91=['isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','getVariable','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','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','exports','lodash','events','./reply','./error','call','setEncoding','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','replace','result=','indexOf','substr','startsWith','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable'];(function(_0x1fab0d,_0x328063){var _0x511354=function(_0xa99621){while(--_0xa99621){_0x1fab0d['push'](_0x1fab0d['shift']());}};_0x511354(++_0x328063);}(_0x0b91,0xae));var _0x10b9=function(_0x200c9f,_0x5e3986){_0x200c9f=_0x200c9f-0x0;var _0x4b5088=_0x0b91[_0x200c9f];return _0x4b5088;};'use strict';var util=require('util');var _=require(_0x10b9('0x0'));var EventEmitter=require(_0x10b9('0x1'))['EventEmitter'];var AGIReply=require(_0x10b9('0x2'));var AGIError=require(_0x10b9('0x3'));function AGIChannel(_0x3ecefd){var _0x59acf6=this,_0x48c86c=new AGIReply(),_0x423d83=![],_0xb0e1c2={};EventEmitter[_0x10b9('0x4')](_0x59acf6);_0x3ecefd[_0x10b9('0x5')]('utf8');_0x3ecefd[_0x10b9('0x6')](0x8*0x3c*0x3c*0x3e8);_0x48c86c['setEncoding']('utf8');_0x48c86c['on'](_0x10b9('0x7'),function(_0x528fb0){for(var _0x3d6b74 in _0x528fb0){_0x59acf6[_0x3d6b74]=_0x528fb0[_0x3d6b74];}_0x59acf6[_0x10b9('0x8')](_0x10b9('0x9'));});_0x48c86c['on'](_0x10b9('0xa'),function(_0x4a1989){if(_0x4a1989[_0x10b9('0xb')]()==_0x10b9('0xc')){_0x59acf6[_0x10b9('0x8')](_0x10b9('0xc'));return;}if(_0x4a1989[_0x10b9('0xd')](0x0,0xb)==_0x10b9('0xe')){_0x423d83=!![];}if(_0x423d83){_0xb0e1c2['rx']+=_0x4a1989+'\x0a';if(_0x4a1989[_0x10b9('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0x423d83=![];}}else{_0xb0e1c2['rx']=_0x4a1989;}if(_0x423d83){return;}if(typeof _0xb0e1c2['cb']==_0x10b9('0x10')){var _0x176db4=_0xb0e1c2['rx'][_0x10b9('0xd')](0x0,0x3),_0x1a2dc7=null,_0x4354c5=null;_0x176db4=parseInt(_0x176db4);if(isNaN(_0x176db4)){_0xb0e1c2['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x176db4!=0xc8){_0xb0e1c2['cb'](null,{'code':_0x176db4,'result':-0x1,'extra':'KO'});return;}_0x1a2dc7=_0xb0e1c2['rx'][_0x10b9('0xd')](0x4)[_0x10b9('0x11')](_0x10b9('0x12'),'');if(_0x1a2dc7[_0x10b9('0x13')]('\x20')!=-0x1){_0x1a2dc7=_0x1a2dc7[_0x10b9('0x14')](0x0,_0x1a2dc7[_0x10b9('0x13')]('\x20'));}if(_[_0x10b9('0x15')](_0x1a2dc7,'-1')){_0x1a2dc7=parseInt(_0x1a2dc7);}_0x4354c5=_0xb0e1c2['rx']['split']('\x20');if(_0x4354c5[_0x10b9('0x16')]==0x3){_0x4354c5=_0x4354c5[0x2]['substring'](0x1,_0x4354c5[0x2][_0x10b9('0x16')]-0x1);}else if(_0x4354c5[_0x10b9('0x16')]>0x3){var _0x189296=/\((.+)\)/;var _0x4c6743=_0xb0e1c2['rx']['match'](_0x189296);if(_0x4c6743){_0x4354c5=_0x4c6743[0x1];}else{_0x4354c5=null;}}else{_0x4354c5=null;}_0xb0e1c2['cb'](null,{'code':_0x176db4,'result':_0x1a2dc7,'extra':_0x4354c5});}});_0x3ecefd['on'](_0x10b9('0x17'),function(_0x5ab380){_0x59acf6[_0x10b9('0x8')](_0x10b9('0x17'),new AGIError('E_AGI_SOCKET_ERROR',_0x5ab380[_0x10b9('0x18')]));});_0x3ecefd['on'](_0x10b9('0x19'),function(){_0x59acf6[_0x10b9('0x8')](_0x10b9('0x19'),new AGIError(_0x10b9('0x1a')));});_0x3ecefd['on'](_0x10b9('0x1b'),function(){_0x59acf6['emit'](_0x10b9('0x1b'),new AGIError(_0x10b9('0x1c')));_0x3ecefd[_0x10b9('0x1d')]();});_0x3ecefd[_0x10b9('0x1e')](_0x48c86c);this[_0x10b9('0x1f')]=function(_0x4bd89c,_0x258e77){var _0x4bd89c=_0x4bd89c||'',_0x258e77=typeof _0x258e77==_0x10b9('0x10')?_0x258e77:new Function();_0xb0e1c2={'tx':_0x4bd89c,'rx':'','cb':_0x258e77};_0x3ecefd[_0x10b9('0x20')](_0x4bd89c+'\x0a');},this[_0x10b9('0x19')]=function(){_0x3ecefd[_0x10b9('0x1d')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x10b9('0x21')][_0x10b9('0x22')]=function(_0x5efbe1){return this[_0x10b9('0x1f')][_0x10b9('0x23')](this,_0x5efbe1);};AGIChannel['prototype'][_0x10b9('0x24')]=function(){return this[_0x10b9('0x22')](_0x10b9('0x25'));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x26')]=function(_0x3037ae,_0x157805,_0x11d9f0){_0x3037ae=_0x3037ae===undefined?_0x10b9('0x27'):_0x3037ae;_0x157805=_0x157805===undefined?'5':_0x157805;_0x11d9f0=_0x11d9f0===undefined?'1':_0x11d9f0;return this[_0x10b9('0x22')](util[_0x10b9('0x28')](_0x10b9('0x29'),_0x3037ae,_0x157805*0x3e8,_0x11d9f0));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x2a')]=function(_0x25f9fe){_0x25f9fe=_0x25f9fe||_0x10b9('0x2b');return this[_0x10b9('0x22')](util[_0x10b9('0x28')](_0x10b9('0x2c'),_0x25f9fe));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x2d')]=function(_0x3b975c,_0x34dbec){if(_['isArray'](_0x34dbec)){return this[_0x10b9('0x22')](util['format']('EXEC\x20%s\x20%s',_0x3b975c,_0x34dbec[_0x10b9('0x2e')](',')));}return this[_0x10b9('0x22')](util[_0x10b9('0x28')](_0x10b9('0x2f'),_0x3b975c,_0x34dbec));};AGIChannel[_0x10b9('0x21')]['setContext']=function(_0x5f4c10){return this[_0x10b9('0x22')](util[_0x10b9('0x28')](_0x10b9('0x30'),_0x5f4c10));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x31')]=function(_0xa6f761){return this['sendRequest'](util[_0x10b9('0x28')](_0x10b9('0x32'),_0xa6f761));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x33')]=function(_0x55f184){return this[_0x10b9('0x22')](util[_0x10b9('0x28')]('SET\x20PRIORITY\x20%s',_0x55f184));};AGIChannel[_0x10b9('0x21')][_0x10b9('0xc')]=function(){return this[_0x10b9('0x22')](_0x10b9('0x34'));};AGIChannel['prototype'][_0x10b9('0x35')]=function(_0x58ef50,_0x496a61){var _0x3c8961=_[_0x10b9('0x36')](_0x496a61)||_['isNumber'](_0x496a61)?_0x496a61[_0x10b9('0x37')]():_0x496a61;return this['sendRequest'](util[_0x10b9('0x28')](_0x10b9('0x38'),_0x58ef50,_0x3c8961?_0x3c8961['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x39')]=function(_0x4236e2,_0xd99ecc){return this['sendRequest'](util[_0x10b9('0x28')](_0x10b9('0x3a'),_0x4236e2,_0xd99ecc));};AGIChannel['prototype'][_0x10b9('0x3b')]=function(_0x5a3d12,_0x4da588){return this[_0x10b9('0x22')](util[_0x10b9('0x28')](_0x10b9('0x3c'),_0x5a3d12,_0x4da588));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x3d')]=function(_0x35f59d,_0xecb0c0){return this[_0x10b9('0x22')](util[_0x10b9('0x28')](_0x10b9('0x3e'),_0x35f59d,_0xecb0c0));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x3f')]=function(_0x12aa95,_0x5cca13,_0x5527f5){_0x5cca13=_0x5cca13||this['extension'];_0x5527f5=_0x5527f5||0x1;this[_0x10b9('0x40')](_0x12aa95);this[_0x10b9('0x31')](_0x5cca13);this[_0x10b9('0x33')](_0x5527f5);return this[_0x10b9('0x2a')](util[_0x10b9('0x28')]('GOTO\x20%s\x20%s\x20%s',_0x12aa95,_0x5cca13,_0x5527f5));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x41')]=function(_0x5609e0){return this[_0x10b9('0x22')](util['format'](_0x10b9('0x42'),_0x5609e0));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x43')]=function(_0x2abd93,_0x214950,_0x4eb333,_0x507c4c,_0x34384d,_0x51ff77){_0x214950=_0x214950||_0x10b9('0x44');_0x4eb333=_0x4eb333||'';_0x507c4c=_0x507c4c===undefined?-0x1:_0x507c4c==='-1'?-0x1:_0x507c4c*0x3e8;_0x34384d=_0x34384d===undefined?'':'s='+_0x34384d;_0x51ff77=_0x51ff77?_0x10b9('0x45'):'';return this['sendRequest'](util[_0x10b9('0x28')](_0x10b9('0x46'),_0x2abd93,_0x214950,_0x4eb333,_0x507c4c,_0x51ff77,_0x34384d));};AGIChannel[_0x10b9('0x21')]['streamFile']=function(_0x5ee62e,_0x1529f0){_0x1529f0=_0x1529f0||'';return this[_0x10b9('0x22')](util[_0x10b9('0x28')](_0x10b9('0x47'),_0x5ee62e,_0x1529f0));};AGIChannel[_0x10b9('0x21')][_0x10b9('0x48')]=function(_0x59f7a4){return this[_0x10b9('0x2d')](_0x10b9('0x49'),_0x59f7a4);};AGIChannel[_0x10b9('0x21')]['wait']=function(_0x52a1bf){return this[_0x10b9('0x2d')](_0x10b9('0x4a'),_0x52a1bf);};AGIChannel[_0x10b9('0x21')][_0x10b9('0x17')]=function(_0x5a24af,_0x51e1cc){this['noop'](util[_0x10b9('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x5a24af['id'],_0x5a24af['label'],_0x51e1cc));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x10b9('0x4b')]=AGIChannel; \ No newline at end of file +var _0xe3da=['function','no\x20code','replace','result=','indexOf','startsWith','split','length','match','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','wait','WAIT','error','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','emit','substring','search','520\x20End\x20of\x20proper'];(function(_0x149731,_0x54c49a){var _0x4fd34c=function(_0x103533){while(--_0x103533){_0x149731['push'](_0x149731['shift']());}};_0x4fd34c(++_0x54c49a);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var util=require(_0xae3d('0x0'));var _=require(_0xae3d('0x1'));var EventEmitter=require(_0xae3d('0x2'))[_0xae3d('0x3')];var AGIReply=require(_0xae3d('0x4'));var AGIError=require(_0xae3d('0x5'));function AGIChannel(_0x109dca){var _0x17952f=this,_0xb2dfd3=new AGIReply(),_0x22bacf=![],_0x1b9397={};EventEmitter[_0xae3d('0x6')](_0x17952f);_0x109dca[_0xae3d('0x7')](_0xae3d('0x8'));_0x109dca[_0xae3d('0x9')](0x8*0x3c*0x3c*0x3e8);_0xb2dfd3[_0xae3d('0x7')]('utf8');_0xb2dfd3['on'](_0xae3d('0xa'),function(_0x3d6650){for(var _0x5544fa in _0x3d6650){_0x17952f[_0x5544fa]=_0x3d6650[_0x5544fa];}_0x17952f['emit'](_0xae3d('0xb'));});_0xb2dfd3['on'](_0xae3d('0xc'),function(_0x420e28){if(_0x420e28[_0xae3d('0xd')]()==_0xae3d('0xe')){_0x17952f[_0xae3d('0xf')]('hangup');return;}if(_0x420e28[_0xae3d('0x10')](0x0,0xb)=='520-Invalid'){_0x22bacf=!![];}if(_0x22bacf){_0x1b9397['rx']+=_0x420e28+'\x0a';if(_0x420e28[_0xae3d('0x11')](_0xae3d('0x12'))!=-0x1){_0x22bacf=![];}}else{_0x1b9397['rx']=_0x420e28;}if(_0x22bacf){return;}if(typeof _0x1b9397['cb']==_0xae3d('0x13')){var _0x172f7a=_0x1b9397['rx'][_0xae3d('0x10')](0x0,0x3),_0x48aa74=null,_0xfb7869=null;_0x172f7a=parseInt(_0x172f7a);if(isNaN(_0x172f7a)){_0x1b9397['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xae3d('0x14')});return;}if(_0x172f7a!=0xc8){_0x1b9397['cb'](null,{'code':_0x172f7a,'result':-0x1,'extra':'KO'});return;}_0x48aa74=_0x1b9397['rx'][_0xae3d('0x10')](0x4)[_0xae3d('0x15')](_0xae3d('0x16'),'');if(_0x48aa74[_0xae3d('0x17')]('\x20')!=-0x1){_0x48aa74=_0x48aa74['substr'](0x0,_0x48aa74[_0xae3d('0x17')]('\x20'));}if(_[_0xae3d('0x18')](_0x48aa74,'-1')){_0x48aa74=parseInt(_0x48aa74);}_0xfb7869=_0x1b9397['rx'][_0xae3d('0x19')]('\x20');if(_0xfb7869[_0xae3d('0x1a')]==0x3){_0xfb7869=_0xfb7869[0x2][_0xae3d('0x10')](0x1,_0xfb7869[0x2][_0xae3d('0x1a')]-0x1);}else if(_0xfb7869['length']>0x3){var _0xe925fd=/\((.+)\)/;var _0x33449a=_0x1b9397['rx'][_0xae3d('0x1b')](_0xe925fd);if(_0x33449a){_0xfb7869=_0x33449a[0x1];}else{_0xfb7869=null;}}else{_0xfb7869=null;}_0x1b9397['cb'](null,{'code':_0x172f7a,'result':_0x48aa74,'extra':_0xfb7869});}});_0x109dca['on']('error',function(_0x3f8cf9){_0x17952f[_0xae3d('0xf')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x3f8cf9[_0xae3d('0x1c')]));});_0x109dca['on'](_0xae3d('0x1d'),function(){_0x17952f[_0xae3d('0xf')](_0xae3d('0x1d'),new AGIError(_0xae3d('0x1e')));});_0x109dca['on']('timeout',function(){_0x17952f[_0xae3d('0xf')]('timeout',new AGIError(_0xae3d('0x1f')));_0x109dca[_0xae3d('0x20')]();});_0x109dca[_0xae3d('0x21')](_0xb2dfd3);this[_0xae3d('0x22')]=function(_0x1facc1,_0x3e7afc){var _0x1facc1=_0x1facc1||'',_0x3e7afc=typeof _0x3e7afc==_0xae3d('0x13')?_0x3e7afc:new Function();_0x1b9397={'tx':_0x1facc1,'rx':'','cb':_0x3e7afc};_0x109dca[_0xae3d('0x23')](_0x1facc1+'\x0a');},this[_0xae3d('0x1d')]=function(){_0x109dca[_0xae3d('0x20')]();};}util[_0xae3d('0x24')](AGIChannel,EventEmitter);AGIChannel[_0xae3d('0x25')][_0xae3d('0x26')]=function(_0x1fe90f){return this[_0xae3d('0x22')][_0xae3d('0x27')](this,_0x1fe90f);};AGIChannel[_0xae3d('0x25')][_0xae3d('0x28')]=function(){return this['sendRequest'](_0xae3d('0x29'));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x2a')]=function(_0x52df0f,_0x256bd0,_0x4391db){_0x52df0f=_0x52df0f===undefined?_0xae3d('0x2b'):_0x52df0f;_0x256bd0=_0x256bd0===undefined?'5':_0x256bd0;_0x4391db=_0x4391db===undefined?'1':_0x4391db;return this['sendRequest'](util['format'](_0xae3d('0x2c'),_0x52df0f,_0x256bd0*0x3e8,_0x4391db));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x2d')]=function(_0x3114f9){_0x3114f9=_0x3114f9||_0xae3d('0x2e');return this['sendRequest'](util[_0xae3d('0x2f')](_0xae3d('0x30'),_0x3114f9));};AGIChannel['prototype'][_0xae3d('0x31')]=function(_0x323715,_0x2cf750){if(_[_0xae3d('0x32')](_0x2cf750)){return this[_0xae3d('0x26')](util[_0xae3d('0x2f')]('EXEC\x20%s\x20%s',_0x323715,_0x2cf750['join'](',')));}return this['sendRequest'](util[_0xae3d('0x2f')](_0xae3d('0x33'),_0x323715,_0x2cf750));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x34')]=function(_0x54a75c){return this[_0xae3d('0x26')](util[_0xae3d('0x2f')](_0xae3d('0x35'),_0x54a75c));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x36')]=function(_0x166631){return this[_0xae3d('0x26')](util['format'](_0xae3d('0x37'),_0x166631));};AGIChannel['prototype']['setPriority']=function(_0x1cd957){return this['sendRequest'](util[_0xae3d('0x2f')]('SET\x20PRIORITY\x20%s',_0x1cd957));};AGIChannel['prototype'][_0xae3d('0xe')]=function(){return this[_0xae3d('0x26')](_0xae3d('0x38'));};AGIChannel['prototype'][_0xae3d('0x39')]=function(_0x58ea2f,_0xce647f){var _0x136ab5=_[_0xae3d('0x3a')](_0xce647f)||_[_0xae3d('0x3b')](_0xce647f)?_0xce647f[_0xae3d('0x3c')]():_0xce647f;return this[_0xae3d('0x26')](util[_0xae3d('0x2f')](_0xae3d('0x3d'),_0x58ea2f,_0x136ab5?_0x136ab5[_0xae3d('0x3c')]()[_0xae3d('0x15')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xae3d('0x25')]['sayNumber']=function(_0x544269,_0x3992eb){return this['sendRequest'](util[_0xae3d('0x2f')](_0xae3d('0x3e'),_0x544269,_0x3992eb));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x3f')]=function(_0x2c2892,_0x35db44){return this[_0xae3d('0x26')](util[_0xae3d('0x2f')](_0xae3d('0x40'),_0x2c2892,_0x35db44));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x41')]=function(_0x549db8,_0xa09b64){return this[_0xae3d('0x26')](util[_0xae3d('0x2f')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x549db8,_0xa09b64));};AGIChannel['prototype'][_0xae3d('0x42')]=function(_0x190dd4,_0x524cf2,_0x308c2f){_0x524cf2=_0x524cf2||this[_0xae3d('0x43')];_0x308c2f=_0x308c2f||0x1;this[_0xae3d('0x34')](_0x190dd4);this[_0xae3d('0x36')](_0x524cf2);this[_0xae3d('0x44')](_0x308c2f);return this[_0xae3d('0x2d')](util['format'](_0xae3d('0x45'),_0x190dd4,_0x524cf2,_0x308c2f));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x46')]=function(_0x938811){return this[_0xae3d('0x26')](util['format'](_0xae3d('0x47'),_0x938811));};AGIChannel['prototype'][_0xae3d('0x48')]=function(_0x38e966,_0x599d1a,_0x1fc88f,_0x5e31d4,_0x52da45,_0x5e924b){_0x599d1a=_0x599d1a||_0xae3d('0x49');_0x1fc88f=_0x1fc88f||'';_0x5e31d4=_0x5e31d4===undefined?-0x1:_0x5e31d4==='-1'?-0x1:_0x5e31d4*0x3e8;_0x52da45=_0x52da45===undefined?'':'s='+_0x52da45;_0x5e924b=_0x5e924b?_0xae3d('0x4a'):'';return this['sendRequest'](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x38e966,_0x599d1a,_0x1fc88f,_0x5e31d4,_0x5e924b,_0x52da45));};AGIChannel[_0xae3d('0x25')][_0xae3d('0x4b')]=function(_0x394ad0,_0x1d410e){_0x1d410e=_0x1d410e||'';return this[_0xae3d('0x26')](util[_0xae3d('0x2f')](_0xae3d('0x4c'),_0x394ad0,_0x1d410e));};AGIChannel['prototype']['agi']=function(_0x560f66){return this[_0xae3d('0x31')]('AGI',_0x560f66);};AGIChannel[_0xae3d('0x25')][_0xae3d('0x4d')]=function(_0x41cb63){return this[_0xae3d('0x31')](_0xae3d('0x4e'),_0x41cb63);};AGIChannel[_0xae3d('0x25')][_0xae3d('0x4f')]=function(_0x2a00b1,_0x38f92d){this[_0xae3d('0x2d')](util[_0xae3d('0x2f')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x2a00b1['id'],_0x2a00b1['label'],_0x38f92d));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 5f1ecb5..697d361 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 _0x0fd0=['util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','message','name'];(function(_0x4de4ea,_0x1570e3){var _0x2e3c45=function(_0x4521a8){while(--_0x4521a8){_0x4de4ea['push'](_0x4de4ea['shift']());}};_0x2e3c45(++_0x1570e3);}(_0x0fd0,0x90));var _0x00fd=function(_0x1c966e,_0x127a90){_0x1c966e=_0x1c966e-0x0;var _0x35d922=_0x0fd0[_0x1c966e];return _0x35d922;};'use strict';var util=require(_0x00fd('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x00fd('0x1'),'E_AGI_SERVER_ERROR':_0x00fd('0x2'),'E_AGI_SERVER_CLOSE':_0x00fd('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x00fd('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x00fd('0x5'),'E_AGI_SOCKET_CLOSE':_0x00fd('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x00fd('0x7'),'E_AGI_COMMAND_EMPTY':_0x00fd('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x00fd('0x9'),'E_AGI_IVR_ENTRY':_0x00fd('0xa')};function AGIError(_0x3e8b65){var _0x3e8b65=_0x3e8b65||null,_0x52faf6=_0x52faf6||[],_0x4d40d1=0x1,_0x5540b5='';if(!error[_0x3e8b65]){_0x3e8b65=_0x00fd('0xb');}_0x52faf6['push'](error[_0x3e8b65]);while(arguments[_0x4d40d1]){_0x52faf6['push'](arguments[_0x4d40d1]);_0x4d40d1++;}_0x5540b5=util[_0x00fd('0xc')][_0x00fd('0xd')](util,_0x52faf6);this[_0x00fd('0xe')]=_0x5540b5;this[_0x00fd('0xf')]=_0x3e8b65;}module['exports']=AGIError; \ No newline at end of file +var _0x911c=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x5a2ccb,_0x4e11be){var _0x3c0045=function(_0xe182af){while(--_0xe182af){_0x5a2ccb['push'](_0x5a2ccb['shift']());}};_0x3c0045(++_0x4e11be);}(_0x911c,0x139));var _0xc911=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0x911c[_0x5b64a1];return _0x4b6f55;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xc911('0x0'),'E_AGI_ARGUMENT_PORT':_0xc911('0x1'),'E_AGI_SERVER_ERROR':_0xc911('0x2'),'E_AGI_SERVER_CLOSE':_0xc911('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xc911('0x4'),'E_AGI_SOCKET_ERROR':_0xc911('0x5'),'E_AGI_SOCKET_CLOSE':_0xc911('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xc911('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc911('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x49e8ec){var _0x49e8ec=_0x49e8ec||null,_0x127af4=_0x127af4||[],_0x5e2019=0x1,_0x5e9cd2='';if(!error[_0x49e8ec]){_0x49e8ec=_0xc911('0x9');}_0x127af4[_0xc911('0xa')](error[_0x49e8ec]);while(arguments[_0x5e2019]){_0x127af4[_0xc911('0xa')](arguments[_0x5e2019]);_0x5e2019++;}_0x5e9cd2=util['format'][_0xc911('0xb')](util,_0x127af4);this[_0xc911('0xc')]=_0x5e9cd2;this[_0xc911('0xd')]=_0x49e8ec;}module[_0xc911('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index c2d3d07..3652a06 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 _0xf6ac=['ioredis','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error','message','parse','projectUpdate','exports','EventEmitter'];(function(_0x2d1a2c,_0x911703){var _0x122ceb=function(_0x3ee888){while(--_0x3ee888){_0x2d1a2c['push'](_0x2d1a2c['shift']());}};_0x122ceb(++_0x911703);}(_0xf6ac,0xb5));var _0xcf6a=function(_0x8cfd08,_0x656b39){_0x8cfd08=_0x8cfd08-0x0;var _0x1c6452=_0xf6ac[_0x8cfd08];return _0x1c6452;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0xcf6a('0x0')];var Redis=require(_0xcf6a('0x1'));var AGIError=require('./error');var config=require(_0xcf6a('0x2'));config[_0xcf6a('0x3')]=_[_0xcf6a('0x4')](config['redis'],{'host':_0xcf6a('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0xcf6a('0x6')](_0xcf6a('0x7'),function(_0x2592d2){if(_0x2592d2)return eventEmitter[_0xcf6a('0x8')](_0xcf6a('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x2592d2));});sub['on'](_0xcf6a('0xa'),function(_0x222245,_0x112905){if(_0x222245!==_0xcf6a('0x7'))return;try{var _0x54a8ca=JSON[_0xcf6a('0xb')](_0x112905);eventEmitter['emit'](_0xcf6a('0xc'),_0x54a8ca);}catch(_0x964f7){eventEmitter['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0x964f7));}});module[_0xcf6a('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xfae6=['defaults','localhost','subscribe','agi','emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','EventEmitter','ioredis','redis'];(function(_0x8fcd9,_0x45135d){var _0x17ea74=function(_0x2e224b){while(--_0x2e224b){_0x8fcd9['push'](_0x8fcd9['shift']());}};_0x17ea74(++_0x45135d);}(_0xfae6,0x1eb));var _0x6fae=function(_0x5d269d,_0x3c8fc9){_0x5d269d=_0x5d269d-0x0;var _0x2e25c7=_0xfae6[_0x5d269d];return _0x2e25c7;};'use strict';var _=require(_0x6fae('0x0'));var EventEmitter=require('events')[_0x6fae('0x1')];var Redis=require(_0x6fae('0x2'));var AGIError=require('./error');var config=require('../../config/environment');config[_0x6fae('0x3')]=_[_0x6fae('0x4')](config[_0x6fae('0x3')],{'host':_0x6fae('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x6fae('0x3')]);sub[_0x6fae('0x6')](_0x6fae('0x7'),function(_0x3bb40d){if(_0x3bb40d)return eventEmitter[_0x6fae('0x8')](_0x6fae('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x3bb40d));});sub['on'](_0x6fae('0xa'),function(_0x3bb838,_0x2702a5){if(_0x3bb838!=='agi')return;try{var _0x27a47e=JSON[_0x6fae('0xb')](_0x2702a5);eventEmitter[_0x6fae('0x8')](_0x6fae('0xc'),_0x27a47e);}catch(_0xa715e2){eventEmitter['emit']('error',new AGIError(_0x6fae('0xd'),_0xa715e2));}});module[_0x6fae('0xe')]={'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 7db467a..9959b42 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 _0x5169=['no\x20edge/s\x20available','condition','split','vswitch','target','length','default\x20on\x20switch\x20not\x20found','includes','agicommand','max\x20retry\x20reach','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','getVertex','traverseBFS','info','stop\x20traverse'];(function(_0x1df803,_0x25192d){var _0x20ef12=function(_0xfc0101){while(--_0xfc0101){_0x1df803['push'](_0x1df803['shift']());}};_0x20ef12(++_0x25192d);}(_0x5169,0x110));var _0x9516=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5169[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x9516('0x0'));var logger=require(_0x9516('0x1'))(_0x9516('0x2'));var verticesWithRetry=[_0x9516('0x3'),_0x9516('0x4'),_0x9516('0x5')];var Graph=function(){this[_0x9516('0x6')]={};this[_0x9516('0x7')]={};this[_0x9516('0x8')]=0x0;};Graph[_0x9516('0x9')][_0x9516('0xa')]=function(_0x4d1052){this['vertices'][_0x4d1052['id']]=_0x4d1052;this[_0x9516('0x7')][_0x4d1052['id']]=[];};Graph[_0x9516('0x9')][_0x9516('0xb')]=function(_0x390a7f,_0x51f923,_0x418364){this[_0x9516('0x7')][_0x390a7f][_0x9516('0xc')]({'target':_0x51f923,'condition':_0x418364});this['numberOfEdges']+=0x1;};Graph['prototype'][_0x9516('0xd')]=function(){return _[_0x9516('0xd')](this[_0x9516('0x6')]);};Graph['prototype']['relations']=function(){return this['numberOfEdges'];};Graph[_0x9516('0x9')][_0x9516('0xe')]=function(_0x3e0137){return this[_0x9516('0x6')][_0x3e0137];};Graph[_0x9516('0x9')][_0x9516('0xf')]=function(_0x274626,_0x42a560){if(!this[_0x9516('0x6')][_0x274626]){return logger[_0x9516('0x10')]('no\x20vertex\x20found');}var _0x1132d0=_0x42a560(this[_0x9516('0x6')][_0x274626]);if(!_0x1132d0){return logger[_0x9516('0x10')](_0x9516('0x11'));}if(this['edges'][_0x274626]['length']===0x0){return logger[_0x9516('0x10')](_0x9516('0x12'));}for(var _0x1fd3d9=0x0,_0x1192b7=[],_0x5cf46b=![];_0x1fd3d9\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','createSquareReport','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify'];(function(_0x3c1f11,_0x57bb89){var _0x567fa5=function(_0x3f5419){while(--_0x3f5419){_0x3c1f11['push'](_0x3c1f11['shift']());}};_0x567fa5(++_0x57bb89);}(_0x2322,0x1a0));var _0x2232=function(_0x4cf860,_0x1c1ed7){_0x4cf860=_0x4cf860-0x0;var _0xdcae5b=_0x2322[_0x4cf860];return _0xdcae5b;};'use strict';var _=require('lodash');var syncho=require(_0x2232('0x0'));var util=require('util');var config=require(_0x2232('0x1'));var logger=require(_0x2232('0x2'))(_0x2232('0x3'));var utilLicense=require(_0x2232('0x4'));var rpc=require('./rpc');var Project=require(_0x2232('0x5'));var AGIEmitter=require(_0x2232('0x6'))[_0x2232('0x7')];var projects=[];config[_0x2232('0x3')]=_['defaults'](config[_0x2232('0x3')],{'ip':_0x2232('0x8'),'port':0x11dd});AGIEmitter['on'](_0x2232('0x9'),projectUpdateHandler);function connectionHandler(_0x183fa1){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x183fa1);agiHandler(_0x183fa1);}catch(_0x23fe6e){logger[_0x2232('0xa')](_0x23fe6e[_0x2232('0xb')]);}});});}function projectUpdateHandler(_0x216466){try{var _0xabf68f=_[_0x2232('0xc')](projects,['id',_0x216466['id']]);if(_0xabf68f>-0x1){if(_0x216466['deleted']===!![]){projects[_0x2232('0xd')](_0xabf68f,0x1);}else{projects[_0xabf68f]=_0x216466;}}else{projects[_0x2232('0xe')](_0x216466);}}catch(_0x40dceb){logger[_0x2232('0xa')](_0x40dceb[_0x2232('0xb')]);}}function listeningHandler(){var _0xa52bbe=config[_0x2232('0xf')]==='production'||![];console[_0x2232('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x2232('0x3')]['port']);logger[_0x2232('0x11')](util[_0x2232('0x12')](_0x2232('0x13'),_0xa52bbe?config[_0x2232('0x3')]['ip']:_0x2232('0x14'),config[_0x2232('0x3')][_0x2232('0x15')]));}function errorHandler(_0x3a394f){if(_0x3a394f&&_0x3a394f[_0x2232('0x16')]&&_0x3a394f['message']){logger[_0x2232('0xa')](util[_0x2232('0x12')](_0x2232('0x17'),_0x3a394f[_0x2232('0x16')],_0x3a394f['message']));}else{logger[_0x2232('0xa')](util['format']('[ERROR]\x20%s',_0x3a394f[_0x2232('0xb')]));}}function closeHandler(){logger['info'](util[_0x2232('0x12')](_0x2232('0x18'),this[_0x2232('0x19')],this[_0x2232('0x1a')],this[_0x2232('0x1b')],this['dnid'],this[_0x2232('0x1c')]));try{createSquareReport(this);}catch(_0x5aff97){logger['error'](_0x5aff97[_0x2232('0xb')]);}}function timeoutHandler(){logger[_0x2232('0x11')](util[_0x2232('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x2232('0x19')],this[_0x2232('0x1a')],this[_0x2232('0x1b')],this['dnid'],this[_0x2232('0x1c')]));}function hangupHandler(){logger[_0x2232('0x11')](util[_0x2232('0x12')](_0x2232('0x1d'),this[_0x2232('0x19')],this[_0x2232('0x1a')],this[_0x2232('0x1b')],this[_0x2232('0x1e')],this[_0x2232('0x1c')]));this['evtHangup']=!![];}function createSquareReport(_0x5a9215,_0x46124b){rpc[_0x2232('0x1f')](_0x5a9215)['then'](function(_0x73e58b){if(_0x46124b){_0x46124b(null,_0x73e58b);}})[_0x2232('0x20')](function(_0x48fb7c){if(_0x46124b){_0x46124b(null,_0x48fb7c);}});}function setChannelVariables(_0x5506f3){for(var _0x50bdc7 in _0x5506f3){if(_0x5506f3[_0x2232('0x21')](_0x50bdc7)){if(_0x50bdc7[_0x2232('0x22')](_0x2232('0x23'))===0x0){_0x5506f3[_0x50bdc7[_0x2232('0x24')](0x4)]=_0x5506f3[_0x50bdc7];delete _0x5506f3[_0x50bdc7];}}}}function agiHandler(_0x1c390f){logger[_0x2232('0x25')](_0x2232('0x26'),JSON[_0x2232('0x27')](_0x1c390f,null,0x2));logger['info'](util[_0x2232('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1c390f[_0x2232('0x19')],_0x1c390f['calleridname'],_0x1c390f['callerid'],_0x1c390f['dnid'],_0x1c390f['uniqueid']));_0x1c390f['on'](_0x2232('0xa'),errorHandler);_0x1c390f['on'](_0x2232('0x28'),closeHandler);_0x1c390f['on'](_0x2232('0x29'),timeoutHandler);_0x1c390f['evtHangup']=![];_0x1c390f['on'](_0x2232('0x2a'),hangupHandler);var _0x3c27c8=_[_0x2232('0x2b')](projects,[_0x2232('0x16'),_0x1c390f['arg_1']]);if(!_0x3c27c8)return Project[_0x2232('0x2c')](_0x1c390f);if(!_0x3c27c8[_0x2232('0x2d')])return Project[_0x2232('0x2e')](_0x1c390f);return Project[_0x2232('0x2f')](_0x3c27c8,_0x1c390f);}function main(){var _0x11e9f9;return utilLicense[_0x2232('0x30')]()[_0x2232('0x31')](function(_0x5ab72f){if(!_0x5ab72f)return;if(_0x5ab72f[_0x2232('0x32')]){if(_0x5ab72f[_0x2232('0x33')]&&_0x5ab72f[_0x2232('0x33')]>0x0){logger['info'](util[_0x2232('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x5ab72f[_0x2232('0x33')]));_0x11e9f9=_0x5ab72f['callysquare'];}else{logger['info'](_0x2232('0x34'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x11e9f9=-0x1;}})['then'](function(){return Project[_0x2232('0x35')]();})['then'](function(_0x5a944e){projects=_0x5a944e;return;})['catch'](function(_0x2a4cb5){logger[_0x2232('0xa')](_0x2232('0x36'),_0x2a4cb5['stack']);})[_0x2232('0x37')](function(){var _0x274140=require('./server')(config['agi']['port'],config[_0x2232('0x3')]['ip'],_0x11e9f9);_0x274140['on'](_0x2232('0xa'),errorHandler);_0x274140['on'](_0x2232('0x38'),listeningHandler);_0x274140['on']('connection',connectionHandler);_0x274140['on'](_0x2232('0x28'),closeHandler);});}main(); \ No newline at end of file +var _0x8eab=['log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','host.docker.internal','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','indexOf','agi_','debug','close','timeout','hangup','find','handleNotFound','handleUnpublished','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','lodash','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','findIndex','deleted','splice','push','error','stack','env','production'];(function(_0x56039b,_0x3de8d8){var _0xc90792=function(_0x300c35){while(--_0x300c35){_0x56039b['push'](_0x56039b['shift']());}};_0xc90792(++_0x3de8d8);}(_0x8eab,0x95));var _0xb8ea=function(_0x591758,_0x4f8d57){_0x591758=_0x591758-0x0;var _0x4be23f=_0x8eab[_0x591758];return _0x4be23f;};'use strict';var _=require(_0xb8ea('0x0'));var syncho=require(_0xb8ea('0x1'));var util=require('util');var config=require(_0xb8ea('0x2'));var logger=require(_0xb8ea('0x3'))(_0xb8ea('0x4'));var utilLicense=require(_0xb8ea('0x5'));var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require(_0xb8ea('0x6'))[_0xb8ea('0x7')];var projects=[];config[_0xb8ea('0x4')]=_[_0xb8ea('0x8')](config[_0xb8ea('0x4')],{'ip':_0xb8ea('0x9'),'port':0x11dd});AGIEmitter['on'](_0xb8ea('0xa'),projectUpdateHandler);function connectionHandler(_0x538e9b){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x538e9b);agiHandler(_0x538e9b);}catch(_0x1a3792){logger['error'](_0x1a3792['stack']);}});});}function projectUpdateHandler(_0x1b76b7){try{var _0x2eb46c=_[_0xb8ea('0xb')](projects,['id',_0x1b76b7['id']]);if(_0x2eb46c>-0x1){if(_0x1b76b7[_0xb8ea('0xc')]===!![]){projects[_0xb8ea('0xd')](_0x2eb46c,0x1);}else{projects[_0x2eb46c]=_0x1b76b7;}}else{projects[_0xb8ea('0xe')](_0x1b76b7);}}catch(_0x305c32){logger[_0xb8ea('0xf')](_0x305c32[_0xb8ea('0x10')]);}}function listeningHandler(){var _0x485699=config[_0xb8ea('0x11')]===_0xb8ea('0x12')||![];console[_0xb8ea('0x13')](_0xb8ea('0x14'),config['agi'][_0xb8ea('0x15')]);logger[_0xb8ea('0x16')](util[_0xb8ea('0x17')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',_0x485699?config['agi']['ip']:_0xb8ea('0x18'),config[_0xb8ea('0x4')]['port']));}function errorHandler(_0xed20a1){if(_0xed20a1&&_0xed20a1[_0xb8ea('0x19')]&&_0xed20a1[_0xb8ea('0x1a')]){logger[_0xb8ea('0xf')](util[_0xb8ea('0x17')]('[%s]\x20%s',_0xed20a1[_0xb8ea('0x19')],_0xed20a1['message']));}else{logger[_0xb8ea('0xf')](util[_0xb8ea('0x17')](_0xb8ea('0x1b'),_0xed20a1['stack']));}}function closeHandler(){logger[_0xb8ea('0x16')](util[_0xb8ea('0x17')](_0xb8ea('0x1c'),this[_0xb8ea('0x1d')],this[_0xb8ea('0x1e')],this[_0xb8ea('0x1f')],this['dnid'],this[_0xb8ea('0x20')]));try{createSquareReport(this);}catch(_0x46a8e5){logger[_0xb8ea('0xf')](_0x46a8e5[_0xb8ea('0x10')]);}}function timeoutHandler(){logger['info'](util[_0xb8ea('0x17')](_0xb8ea('0x21'),this[_0xb8ea('0x1d')],this[_0xb8ea('0x1e')],this[_0xb8ea('0x1f')],this[_0xb8ea('0x22')],this[_0xb8ea('0x20')]));}function hangupHandler(){logger['info'](util[_0xb8ea('0x17')](_0xb8ea('0x23'),this[_0xb8ea('0x1d')],this[_0xb8ea('0x1e')],this[_0xb8ea('0x1f')],this[_0xb8ea('0x22')],this[_0xb8ea('0x20')]));this[_0xb8ea('0x24')]=!![];}function createSquareReport(_0x1169e6,_0x1b584c){rpc[_0xb8ea('0x25')](_0x1169e6)[_0xb8ea('0x26')](function(_0x2cf13a){if(_0x1b584c){_0x1b584c(null,_0x2cf13a);}})[_0xb8ea('0x27')](function(_0xab4a96){if(_0x1b584c){_0x1b584c(null,_0xab4a96);}});}function setChannelVariables(_0xd8039d){for(var _0x507845 in _0xd8039d){if(_0xd8039d['hasOwnProperty'](_0x507845)){if(_0x507845[_0xb8ea('0x28')](_0xb8ea('0x29'))===0x0){_0xd8039d[_0x507845['substring'](0x4)]=_0xd8039d[_0x507845];delete _0xd8039d[_0x507845];}}}}function agiHandler(_0xc1a5f9){logger[_0xb8ea('0x2a')]('variables',JSON['stringify'](_0xc1a5f9,null,0x2));logger[_0xb8ea('0x16')](util[_0xb8ea('0x17')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xc1a5f9[_0xb8ea('0x1d')],_0xc1a5f9['calleridname'],_0xc1a5f9['callerid'],_0xc1a5f9[_0xb8ea('0x22')],_0xc1a5f9[_0xb8ea('0x20')]));_0xc1a5f9['on'](_0xb8ea('0xf'),errorHandler);_0xc1a5f9['on'](_0xb8ea('0x2b'),closeHandler);_0xc1a5f9['on'](_0xb8ea('0x2c'),timeoutHandler);_0xc1a5f9[_0xb8ea('0x24')]=![];_0xc1a5f9['on'](_0xb8ea('0x2d'),hangupHandler);var _0x54d8ae=_[_0xb8ea('0x2e')](projects,[_0xb8ea('0x19'),_0xc1a5f9[_0xb8ea('0x1d')]]);if(!_0x54d8ae)return Project[_0xb8ea('0x2f')](_0xc1a5f9);if(!_0x54d8ae[_0xb8ea('0x12')])return Project[_0xb8ea('0x30')](_0xc1a5f9);return Project['initialize'](_0x54d8ae,_0xc1a5f9);}function main(){var _0x372a26;return utilLicense['getLicense']()[_0xb8ea('0x26')](function(_0x2f2de9){if(!_0x2f2de9)return;if(_0x2f2de9['voice']){if(_0x2f2de9[_0xb8ea('0x31')]&&_0x2f2de9['callysquare']>0x0){logger[_0xb8ea('0x16')](util[_0xb8ea('0x17')](_0xb8ea('0x32'),_0x2f2de9[_0xb8ea('0x31')]));_0x372a26=_0x2f2de9[_0xb8ea('0x31')];}else{logger[_0xb8ea('0x16')](_0xb8ea('0x33'));}}else{logger[_0xb8ea('0x16')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x372a26=-0x1;}})[_0xb8ea('0x26')](function(){return Project['getAll']();})[_0xb8ea('0x26')](function(_0x3e2fca){projects=_0x3e2fca;return;})['catch'](function(_0x344a66){logger[_0xb8ea('0xf')](_0xb8ea('0x34'),_0x344a66[_0xb8ea('0x10')]);})['finally'](function(){var _0x1a59e5=require(_0xb8ea('0x35'))(config[_0xb8ea('0x4')]['port'],config[_0xb8ea('0x4')]['ip'],_0x372a26);_0x1a59e5['on'](_0xb8ea('0xf'),errorHandler);_0x1a59e5['on'](_0xb8ea('0x36'),listeningHandler);_0x1a59e5['on'](_0xb8ea('0x37'),connectionHandler);_0x1a59e5['on'](_0xb8ea('0x2b'),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 fcf7061..099b95d 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 _0x2cf1=['jayson/promise','client','http','then','error','message','result','catch','sendMailMessage','bluebird'];(function(_0x48057d,_0x438d71){var _0x50d017=function(_0x40c1e3){while(--_0x40c1e3){_0x48057d['push'](_0x48057d['shift']());}};_0x50d017(++_0x438d71);}(_0x2cf1,0x171));var _0x12cf=function(_0x2eec13,_0x53eff5){_0x2eec13=_0x2eec13-0x0;var _0x2a469f=_0x2cf1[_0x2eec13];return _0x2a469f;};'use strict';var BPromise=require(_0x12cf('0x0'));var jayson=require(_0x12cf('0x1'));var client=jayson[_0x12cf('0x2')][_0x12cf('0x3')]({'port':0x232b});function request(_0x3227b3,_0x272235){return new BPromise(function(_0x56edd5,_0x569565){return client['request'](_0x3227b3,_0x272235)[_0x12cf('0x4')](function(_0x3cfd65){if(_0x3cfd65['error']){return _0x569565(_0x3cfd65[_0x12cf('0x5')][_0x12cf('0x6')]);}else{return _0x56edd5(_0x3cfd65[_0x12cf('0x7')]);}})[_0x12cf('0x8')](function(_0x4a0de4){return _0x569565(_0x4a0de4);});});}exports[_0x12cf('0x9')]=function(_0x44ad05,_0x2a13cb){return request('SendMail',{'account':_0x44ad05,'message':_0x2a13cb});}; \ No newline at end of file +var _0x4f1a=['message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','request','then','error'];(function(_0x2a47e4,_0x1e728a){var _0x513b94=function(_0x3ade7e){while(--_0x3ade7e){_0x2a47e4['push'](_0x2a47e4['shift']());}};_0x513b94(++_0x1e728a);}(_0x4f1a,0xa5));var _0xa4f1=function(_0x2627c5,_0x3a0394){_0x2627c5=_0x2627c5-0x0;var _0x4f11fd=_0x4f1a[_0x2627c5];return _0x4f11fd;};'use strict';var BPromise=require(_0xa4f1('0x0'));var jayson=require(_0xa4f1('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x5af28f,_0x52fd87){return new BPromise(function(_0x4db40b,_0x5a45e0){return client[_0xa4f1('0x2')](_0x5af28f,_0x52fd87)[_0xa4f1('0x3')](function(_0x3941ee){if(_0x3941ee[_0xa4f1('0x4')]){return _0x5a45e0(_0x3941ee[_0xa4f1('0x4')][_0xa4f1('0x5')]);}else{return _0x4db40b(_0x3941ee[_0xa4f1('0x6')]);}})[_0xa4f1('0x7')](function(_0x4b94db){return _0x5a45e0(_0x4b94db);});});}exports[_0xa4f1('0x8')]=function(_0x15206a,_0x249d61){return request(_0xa4f1('0x9'),{'account':_0x15206a,'message':_0x249d61});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index f490f09..97066bf 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 _0x06fc=['toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','../../config/logger','agi','./rpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','mxCell','length','target','addEdge','source','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','context','extension','priority','evtHangup','response','isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x06fc,0x139));var _0xc06f=function(_0x2dadff,_0x302ef5){_0x2dadff=_0x2dadff-0x0;var _0x4be2a9=_0x06fc[_0x2dadff];return _0x4be2a9;};'use strict';var _=require(_0xc06f('0x0'));var moment=require(_0xc06f('0x1'));var parser=require(_0xc06f('0x2'));var util=require('util');var logger=require(_0xc06f('0x3'))(_0xc06f('0x4'));var rpc=require(_0xc06f('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0xc06f('0x6'));var Vertices=require(_0xc06f('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xc06f('0x8')](function(_0x1cbfc9){logger[_0xc06f('0x9')](_0xc06f('0xa'),_0x1cbfc9[_0xc06f('0xb')]);return[];});}function addVertex(_0x5d5daf,_0x334454,_0x22eee6){_0x334454[_0xc06f('0xc')]=_0x22eee6;if(_0x334454[_0xc06f('0xd')](_0xc06f('0xe'))){_0x334454[_0xc06f('0xf')]=parseInt(_0x334454[_0xc06f('0xe')],0xa);}_0x5d5daf['addVertex'](_['omit'](_0x334454,_0xc06f('0x10')));}function initGraph(_0x348ee7,_0x531ab3){var _0x567ab9=new Graph();for(var _0x11e2f8 in _0x348ee7){if(_0x348ee7['hasOwnProperty'](_0x11e2f8)){if(_['isArray'](_0x348ee7[_0x11e2f8])){for(var _0x57643b=0x0;_0x57643b<_0x348ee7[_0x11e2f8][_0xc06f('0x11')];_0x57643b+=0x1){addVertex(_0x567ab9,_0x348ee7[_0x11e2f8][_0x57643b],_0x11e2f8);}}else{addVertex(_0x567ab9,_0x348ee7[_0x11e2f8],_0x11e2f8);}}}for(var _0x27a173=0x0;_0x27a173<_0x531ab3[_0xc06f('0x11')];_0x27a173+=0x1){if(_0x531ab3[_0x27a173]['source']&&_0x531ab3[_0x27a173][_0xc06f('0x12')]){_0x567ab9[_0xc06f('0x13')](_0x531ab3[_0x27a173][_0xc06f('0x14')],_0x531ab3[_0x27a173][_0xc06f('0x12')],_0x531ab3[_0x27a173][_0xc06f('0x15')]);}}return _0x567ab9;}function getRoot(_0x35ee69){return parser[_0xc06f('0x16')](_0x35ee69,{'object':!![]})[_0xc06f('0x17')][_0xc06f('0x18')];}function inspect(_0x10b93a){return util[_0xc06f('0x19')](_0x10b93a,{'showHidden':![],'depth':null});}function initialize(_0x302474,_0x25a904){var _0x2577bf=getRoot(_0x302474[_0xc06f('0x1a')]);if(!_0x2577bf||!_0x2577bf[_0xc06f('0x1b')])return;var _0x5a1b03,_0x4ee764,_0x3c6a3c;logger[_0xc06f('0x1c')](_0xc06f('0x18'),JSON[_0xc06f('0x1d')](_0x2577bf,null,0x2));_0x25a904['joinAt']=moment()[_0xc06f('0x1e')](_0xc06f('0x1f'));_0x5a1b03=initGraph(_['omit'](_0x2577bf,_0xc06f('0x10')),_0x2577bf[_0xc06f('0x10')]);_0x4ee764=new Vertices(_0x25a904,rpc,mailRpc);logger[_0xc06f('0x20')](util[_0xc06f('0x1e')](_0xc06f('0x21'),_0x25a904[_0xc06f('0x22')],_0x25a904[_0xc06f('0x23')],_0x25a904['callerid'],_0x25a904[_0xc06f('0x24')],_0x25a904[_0xc06f('0x25')]));_0x5a1b03[_0xc06f('0x26')](_0x2577bf['start']['id'],function(_0x562eaa){try{_0x562eaa=_0x4ee764[_0xc06f('0x27')](_0x562eaa);logger[_0xc06f('0x1c')](_0xc06f('0x28'),JSON[_0xc06f('0x1d')](_0x562eaa,null,0x2));if(_0x562eaa[_0xc06f('0xc')]===_0xc06f('0x29')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x25a904['context']=_0x562eaa['context']||_0x25a904[_0xc06f('0x2a')];_0x25a904[_0xc06f('0x2b')]=_0x562eaa[_0xc06f('0x2b')];_0x25a904[_0xc06f('0x2c')]=_0x562eaa[_0xc06f('0x2c')]?_0x562eaa[_0xc06f('0x2c')]-0x1:0x1;return null;}else if(_0x562eaa&&_0x4ee764[_0x562eaa[_0xc06f('0xc')]]){_0x3c6a3c=_0x4ee764[_0x562eaa['agicommand']](_0x562eaa);logger[_0xc06f('0x20')]('response',JSON[_0xc06f('0x1d')](_0x3c6a3c,null,0x2));if(_0x3c6a3c&&_0x3c6a3c['code']===AGI_CODE_SUCCESS&&_0x3c6a3c['result']!==AGI_RESULT_ERROR&&!_0x25a904[_0xc06f('0x2d')]){logger[_0xc06f('0x1c')](_0xc06f('0x2e'),inspect(_0x3c6a3c));return _[_0xc06f('0x2f')](_0x3c6a3c['result'])?null:_0x3c6a3c[_0xc06f('0x30')]['toString']();}else{logger[_0xc06f('0x9')]('response',inspect(_0x3c6a3c));return null;}}else{logger[_0xc06f('0x9')](_0xc06f('0x31'));return null;}}catch(_0x2133e7){logger[_0xc06f('0x9')](_0x2133e7['stack']);return null;}});if(_0x2577bf[_0xc06f('0x32')]){logger[_0xc06f('0x20')](util['format'](_0xc06f('0x33'),_0x25a904['arg_1'],_0x25a904[_0xc06f('0x23')],_0x25a904[_0xc06f('0x34')],_0x25a904[_0xc06f('0x24')],_0x25a904['uniqueid']));_0x5a1b03['traverseBFS'](_0x2577bf[_0xc06f('0x32')]['id'],function(_0x4989c6){try{_0x4989c6=_0x4ee764[_0xc06f('0x27')](_0x4989c6);logger['debug']('vertex',JSON[_0xc06f('0x1d')](_0x4989c6,null,0x2));if(_0x4989c6&&_0x4ee764[_0x4989c6[_0xc06f('0xc')]]){_0x3c6a3c=_0x4ee764[_0x4989c6[_0xc06f('0xc')]](_0x4989c6);if(_0x3c6a3c){logger['debug'](_0xc06f('0x2e'),inspect(_0x3c6a3c));return _[_0xc06f('0x2f')](_0x3c6a3c['result'])?null:_0x3c6a3c[_0xc06f('0x30')][_0xc06f('0x35')]();}else{logger[_0xc06f('0x9')](_0xc06f('0x2e'),inspect(_0x3c6a3c));return null;}}else{logger['error'](_0xc06f('0x31'));return null;}}catch(_0x27e861){logger[_0xc06f('0x9')](_0x27e861['stack']);return null;}});}logger[_0xc06f('0x20')](util[_0xc06f('0x1e')](_0xc06f('0x36'),_0x25a904[_0xc06f('0x22')],_0x25a904[_0xc06f('0x23')],_0x25a904['callerid'],_0x25a904[_0xc06f('0x24')],_0x25a904['uniqueid']));logger[_0xc06f('0x20')](util[_0xc06f('0x1e')](_0xc06f('0x37'),_0x25a904[_0xc06f('0x2a')],_0x25a904['extension'],parseInt(_0x25a904[_0xc06f('0x2c')],0xa)+0x1));_0x25a904[_0xc06f('0x38')](_0x25a904['context'],_0x25a904['extension'],parseInt(_0x25a904[_0xc06f('0x2c')],0xa)+0x1);_0x25a904['close']();}function handleNotFound(_0x337e6e){logger[_0xc06f('0x9')](util[_0xc06f('0x1e')](_0xc06f('0x39'),_0x337e6e['arg_1']));_0x337e6e[_0xc06f('0x38')](_0x337e6e['context'],_0x337e6e['extension'],parseInt(_0x337e6e[_0xc06f('0x2c')],0xa)+0x1);_0x337e6e[_0xc06f('0x3a')]();}function handleUnpublished(_0x48febc){logger[_0xc06f('0x9')](util[_0xc06f('0x1e')](_0xc06f('0x3b'),_0x48febc[_0xc06f('0x22')]));_0x48febc[_0xc06f('0x38')](_0x48febc[_0xc06f('0x2a')],_0x48febc['extension'],parseInt(_0x48febc[_0xc06f('0x2c')],0xa)+0x1);_0x48febc[_0xc06f('0x3a')]();}module[_0xc06f('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x1f82=['gotoc','info','context','extension','priority','result','response','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','lodash','moment','util','../../config/logger','agi','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','value','toJson','mxGraphModel','root','inspect','start','debug','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','[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','traverseBFS','clear','vertex','stringify'];(function(_0xf4a280,_0xdeedbc){var _0x15cbcc=function(_0x2d367b){while(--_0x2d367b){_0xf4a280['push'](_0xf4a280['shift']());}};_0x15cbcc(++_0xdeedbc);}(_0x1f82,0x179));var _0x21f8=function(_0x58b5d7,_0x79ca8a){_0x58b5d7=_0x58b5d7-0x0;var _0x817269=_0x1f82[_0x58b5d7];return _0x817269;};'use strict';var _=require(_0x21f8('0x0'));var moment=require(_0x21f8('0x1'));var parser=require('xml2json');var util=require(_0x21f8('0x2'));var logger=require(_0x21f8('0x3'))(_0x21f8('0x4'));var rpc=require('./rpc');var mailRpc=require(_0x21f8('0x5'));var Graph=require(_0x21f8('0x6'));var Vertices=require(_0x21f8('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x21f8('0x8')]()[_0x21f8('0x9')](function(_0x3a25fa){logger[_0x21f8('0xa')](_0x21f8('0xb'),_0x3a25fa[_0x21f8('0xc')]);return[];});}function addVertex(_0x531a38,_0x2ec946,_0x4ac0e4){_0x2ec946[_0x21f8('0xd')]=_0x4ac0e4;if(_0x2ec946[_0x21f8('0xe')](_0x21f8('0xf'))){_0x2ec946[_0x21f8('0x10')]=parseInt(_0x2ec946['retry'],0xa);}_0x531a38[_0x21f8('0x11')](_['omit'](_0x2ec946,_0x21f8('0x12')));}function initGraph(_0x121c51,_0x1d7073){var _0x2924fb=new Graph();for(var _0x532f0a in _0x121c51){if(_0x121c51[_0x21f8('0xe')](_0x532f0a)){if(_[_0x21f8('0x13')](_0x121c51[_0x532f0a])){for(var _0x2cc5fc=0x0;_0x2cc5fc<_0x121c51[_0x532f0a][_0x21f8('0x14')];_0x2cc5fc+=0x1){addVertex(_0x2924fb,_0x121c51[_0x532f0a][_0x2cc5fc],_0x532f0a);}}else{addVertex(_0x2924fb,_0x121c51[_0x532f0a],_0x532f0a);}}}for(var _0xd2760e=0x0;_0xd2760e<_0x1d7073[_0x21f8('0x14')];_0xd2760e+=0x1){if(_0x1d7073[_0xd2760e][_0x21f8('0x15')]&&_0x1d7073[_0xd2760e][_0x21f8('0x16')]){_0x2924fb['addEdge'](_0x1d7073[_0xd2760e][_0x21f8('0x15')],_0x1d7073[_0xd2760e]['target'],_0x1d7073[_0xd2760e][_0x21f8('0x17')]);}}return _0x2924fb;}function getRoot(_0x51f196){return parser[_0x21f8('0x18')](_0x51f196,{'object':!![]})[_0x21f8('0x19')][_0x21f8('0x1a')];}function inspect(_0x473f49){return util[_0x21f8('0x1b')](_0x473f49,{'showHidden':![],'depth':null});}function initialize(_0x14ef1a,_0x39a598){var _0x5e8e64=getRoot(_0x14ef1a['production']);if(!_0x5e8e64||!_0x5e8e64[_0x21f8('0x1c')])return;var _0x421f12,_0x3cd2c6,_0x32f061;logger[_0x21f8('0x1d')](_0x21f8('0x1a'),JSON['stringify'](_0x5e8e64,null,0x2));_0x39a598[_0x21f8('0x1e')]=moment()[_0x21f8('0x1f')](_0x21f8('0x20'));_0x421f12=initGraph(_[_0x21f8('0x21')](_0x5e8e64,_0x21f8('0x12')),_0x5e8e64['mxCell']);_0x3cd2c6=new Vertices(_0x39a598,rpc,mailRpc);logger['info'](util[_0x21f8('0x1f')](_0x21f8('0x22'),_0x39a598[_0x21f8('0x23')],_0x39a598[_0x21f8('0x24')],_0x39a598[_0x21f8('0x25')],_0x39a598[_0x21f8('0x26')],_0x39a598['uniqueid']));_0x421f12[_0x21f8('0x27')](_0x5e8e64[_0x21f8('0x1c')]['id'],function(_0x5a0411){try{_0x5a0411=_0x3cd2c6[_0x21f8('0x28')](_0x5a0411);logger[_0x21f8('0x1d')](_0x21f8('0x29'),JSON[_0x21f8('0x2a')](_0x5a0411,null,0x2));if(_0x5a0411[_0x21f8('0xd')]===_0x21f8('0x2b')){logger[_0x21f8('0x2c')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x39a598[_0x21f8('0x2d')]=_0x5a0411[_0x21f8('0x2d')]||_0x39a598['context'];_0x39a598['extension']=_0x5a0411[_0x21f8('0x2e')];_0x39a598[_0x21f8('0x2f')]=_0x5a0411[_0x21f8('0x2f')]?_0x5a0411[_0x21f8('0x2f')]-0x1:0x1;return null;}else if(_0x5a0411&&_0x3cd2c6[_0x5a0411['agicommand']]){_0x32f061=_0x3cd2c6[_0x5a0411[_0x21f8('0xd')]](_0x5a0411);logger[_0x21f8('0x2c')]('response',JSON[_0x21f8('0x2a')](_0x32f061,null,0x2));if(_0x32f061&&_0x32f061['code']===AGI_CODE_SUCCESS&&_0x32f061[_0x21f8('0x30')]!==AGI_RESULT_ERROR&&!_0x39a598['evtHangup']){logger[_0x21f8('0x1d')](_0x21f8('0x31'),inspect(_0x32f061));return _['isUndefined'](_0x32f061[_0x21f8('0x30')])?null:_0x32f061[_0x21f8('0x30')]['toString']();}else{logger['error'](_0x21f8('0x31'),inspect(_0x32f061));return null;}}else{logger[_0x21f8('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x47439d){logger['error'](_0x47439d[_0x21f8('0xc')]);return null;}});if(_0x5e8e64['finally']){logger[_0x21f8('0x2c')](util[_0x21f8('0x1f')](_0x21f8('0x32'),_0x39a598[_0x21f8('0x23')],_0x39a598[_0x21f8('0x24')],_0x39a598[_0x21f8('0x25')],_0x39a598['dnid'],_0x39a598['uniqueid']));_0x421f12[_0x21f8('0x27')](_0x5e8e64['finally']['id'],function(_0xa0d474){try{_0xa0d474=_0x3cd2c6[_0x21f8('0x28')](_0xa0d474);logger[_0x21f8('0x1d')](_0x21f8('0x29'),JSON[_0x21f8('0x2a')](_0xa0d474,null,0x2));if(_0xa0d474&&_0x3cd2c6[_0xa0d474[_0x21f8('0xd')]]){_0x32f061=_0x3cd2c6[_0xa0d474[_0x21f8('0xd')]](_0xa0d474);if(_0x32f061){logger[_0x21f8('0x1d')]('response',inspect(_0x32f061));return _[_0x21f8('0x33')](_0x32f061[_0x21f8('0x30')])?null:_0x32f061[_0x21f8('0x30')][_0x21f8('0x34')]();}else{logger[_0x21f8('0xa')](_0x21f8('0x31'),inspect(_0x32f061));return null;}}else{logger['error'](_0x21f8('0x35'));return null;}}catch(_0x3a8570){logger[_0x21f8('0xa')](_0x3a8570['stack']);return null;}});}logger[_0x21f8('0x2c')](util['format'](_0x21f8('0x36'),_0x39a598[_0x21f8('0x23')],_0x39a598['calleridname'],_0x39a598['callerid'],_0x39a598['dnid'],_0x39a598['uniqueid']));logger[_0x21f8('0x2c')](util[_0x21f8('0x1f')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x39a598[_0x21f8('0x2d')],_0x39a598[_0x21f8('0x2e')],parseInt(_0x39a598[_0x21f8('0x2f')],0xa)+0x1));_0x39a598['continueAt'](_0x39a598[_0x21f8('0x2d')],_0x39a598[_0x21f8('0x2e')],parseInt(_0x39a598['priority'],0xa)+0x1);_0x39a598[_0x21f8('0x37')]();}function handleNotFound(_0x4a9c2a){logger[_0x21f8('0xa')](util[_0x21f8('0x1f')](_0x21f8('0x38'),_0x4a9c2a[_0x21f8('0x23')]));_0x4a9c2a[_0x21f8('0x39')](_0x4a9c2a['context'],_0x4a9c2a[_0x21f8('0x2e')],parseInt(_0x4a9c2a['priority'],0xa)+0x1);_0x4a9c2a[_0x21f8('0x37')]();}function handleUnpublished(_0x4b2412){logger[_0x21f8('0xa')](util[_0x21f8('0x1f')](_0x21f8('0x3a'),_0x4b2412[_0x21f8('0x23')]));_0x4b2412[_0x21f8('0x39')](_0x4b2412[_0x21f8('0x2d')],_0x4b2412['extension'],parseInt(_0x4b2412[_0x21f8('0x2f')],0xa)+0x1);_0x4b2412[_0x21f8('0x37')]();}module[_0x21f8('0x3b')]={'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 899496d..41f85ed 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 _0x8e44=['\x0d\x0a\x0d\x0a','toString','indexOf','substring','slice','trim','length','emit','util','stream','Transform','_localBuffer','_inBody','inherits','prototype'];(function(_0x2307dd,_0x4fa566){var _0x3e2f14=function(_0xcf8fee){while(--_0xcf8fee){_0x2307dd['push'](_0x2307dd['shift']());}};_0x3e2f14(++_0x4fa566);}(_0x8e44,0x1ac));var _0x48e4=function(_0x460358,_0x45d45e){_0x460358=_0x460358-0x0;var _0x2e6a60=_0x8e44[_0x460358];return _0x2e6a60;};'use strict';var util=require(_0x48e4('0x0'));var Transform=require(_0x48e4('0x1'))[_0x48e4('0x2')];function AGIReply(_0x573dab){Transform['call'](this,_0x573dab);this[_0x48e4('0x3')]='';this[_0x48e4('0x4')]=![];}util[_0x48e4('0x5')](AGIReply,Transform);AGIReply[_0x48e4('0x6')]['_transform']=function(_0x8881d6,_0xd6e0b8,_0x27d37f){var _0x4dffab='\x0a',_0x4e2c12=['\x0a\x0a',_0x48e4('0x7')],_0x26c5de=-0x1,_0xfd30df=-0x1,_0x552cb1='',_0x1ae7a7=0x0,_0x1727fc='',_0x8849db='';this[_0x48e4('0x3')]+=_0x8881d6[_0x48e4('0x8')]();_0x1727fc=this['_localBuffer'];if(!this[_0x48e4('0x4')]){_0x1ae7a7=0x0;while(_0x4e2c12[_0x1ae7a7]){while((_0xfd30df=_0x1727fc[_0x48e4('0x9')](_0x4e2c12[_0x1ae7a7]))!=-0x1){_0x552cb1=_0x4e2c12[_0x1ae7a7];_0x8849db=_0x1727fc[_0x48e4('0xa')](0x0,_0xfd30df);_0x1727fc=_0x1727fc['substring'](_0xfd30df+_0x552cb1['length']);var _0x325bee=_0x8849db['split'](_0x4dffab),_0x2d34df=0x0,_0x2373ae={},_0x13c61c='',_0x55a9ab='',_0x28c15a=-0x1;while(_0x325bee[_0x2d34df]){_0x28c15a=_0x325bee[_0x2d34df][_0x48e4('0x9')](':');if(_0x28c15a!=-0x1){_0x13c61c=_0x325bee[_0x2d34df][_0x48e4('0xb')](0x0,_0x28c15a)[_0x48e4('0xc')]();_0x55a9ab=_0x325bee[_0x2d34df][_0x48e4('0xb')](_0x28c15a+0x1)[_0x48e4('0xc')]();if(_0x13c61c[_0x48e4('0xd')]>0x0){_0x2373ae[_0x13c61c]=_0x55a9ab;}}else{}_0x2d34df++;}this[_0x48e4('0xe')]('headers',_0x2373ae);this[_0x48e4('0x4')]=!![];}_0x1ae7a7++;}this[_0x48e4('0x3')]=_0x1727fc;}else{while((_0x26c5de=_0x1727fc['indexOf'](_0x4dffab))!=-0x1){_0x8849db=_0x1727fc[_0x48e4('0xa')](0x0,_0x26c5de);this[_0x48e4('0xe')]('line',_0x8849db);_0x1727fc=_0x1727fc[_0x48e4('0xa')](_0x26c5de+_0x4dffab[_0x48e4('0xd')]);}this[_0x48e4('0x3')]=_0x1727fc;}_0x27d37f();};module['exports']=AGIReply; \ No newline at end of file +var _0x4f20=['indexOf','substring','length','slice','trim','emit','headers','exports','stream','Transform','call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_localBuffer'];(function(_0x4aeb9a,_0x7c223d){var _0x3113ee=function(_0x119ad5){while(--_0x119ad5){_0x4aeb9a['push'](_0x4aeb9a['shift']());}};_0x3113ee(++_0x7c223d);}(_0x4f20,0x86));var _0x04f2=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x4f20[_0x618414];return _0x21c19a;};'use strict';var util=require('util');var Transform=require(_0x04f2('0x0'))[_0x04f2('0x1')];function AGIReply(_0x45ff97){Transform[_0x04f2('0x2')](this,_0x45ff97);this['_localBuffer']='';this[_0x04f2('0x3')]=![];}util[_0x04f2('0x4')](AGIReply,Transform);AGIReply[_0x04f2('0x5')][_0x04f2('0x6')]=function(_0x20de45,_0x194568,_0x4ea8e0){var _0x2436b4='\x0a',_0xbd87f=['\x0a\x0a',_0x04f2('0x7')],_0xf9f124=-0x1,_0x586a0d=-0x1,_0x3d2827='',_0x5e8cb2=0x0,_0x52cde6='',_0x410a75='';this['_localBuffer']+=_0x20de45[_0x04f2('0x8')]();_0x52cde6=this[_0x04f2('0x9')];if(!this[_0x04f2('0x3')]){_0x5e8cb2=0x0;while(_0xbd87f[_0x5e8cb2]){while((_0x586a0d=_0x52cde6[_0x04f2('0xa')](_0xbd87f[_0x5e8cb2]))!=-0x1){_0x3d2827=_0xbd87f[_0x5e8cb2];_0x410a75=_0x52cde6[_0x04f2('0xb')](0x0,_0x586a0d);_0x52cde6=_0x52cde6['substring'](_0x586a0d+_0x3d2827[_0x04f2('0xc')]);var _0x4fa248=_0x410a75['split'](_0x2436b4),_0x484db0=0x0,_0x461bc2={},_0x2207cc='',_0x5c20b2='',_0x560a34=-0x1;while(_0x4fa248[_0x484db0]){_0x560a34=_0x4fa248[_0x484db0][_0x04f2('0xa')](':');if(_0x560a34!=-0x1){_0x2207cc=_0x4fa248[_0x484db0][_0x04f2('0xd')](0x0,_0x560a34)['trim']();_0x5c20b2=_0x4fa248[_0x484db0][_0x04f2('0xd')](_0x560a34+0x1)[_0x04f2('0xe')]();if(_0x2207cc['length']>0x0){_0x461bc2[_0x2207cc]=_0x5c20b2;}}else{}_0x484db0++;}this[_0x04f2('0xf')](_0x04f2('0x10'),_0x461bc2);this[_0x04f2('0x3')]=!![];}_0x5e8cb2++;}this['_localBuffer']=_0x52cde6;}else{while((_0xf9f124=_0x52cde6[_0x04f2('0xa')](_0x2436b4))!=-0x1){_0x410a75=_0x52cde6['substring'](0x0,_0xf9f124);this[_0x04f2('0xf')]('line',_0x410a75);_0x52cde6=_0x52cde6[_0x04f2('0xb')](_0xf9f124+_0x2436b4['length']);}this[_0x04f2('0x9')]=_0x52cde6;}_0x4ea8e0();};module[_0x04f2('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 1b95c28..026b64c 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 _0x207c=['getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','Smtp','CloudProvider','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','agentLogout','LogoutUser','moment','jayson/promise','client','http','request','error','message','result'];(function(_0x329235,_0x3724ef){var _0x43d9a0=function(_0xd804e5){while(--_0xd804e5){_0x329235['push'](_0x329235['shift']());}};_0x43d9a0(++_0x3724ef);}(_0x207c,0x1e8));var _0xc207=function(_0x2d05fa,_0x372364){_0x2d05fa=_0x2d05fa-0x0;var _0x10ae61=_0x207c[_0x2d05fa];return _0x10ae61;};'use strict';var _=require('lodash');var moment=require(_0xc207('0x0'));var jayson=require(_0xc207('0x1'));var client=jayson[_0xc207('0x2')][_0xc207('0x3')]({'port':0x2329});function request(_0x2b40be,_0x12f1f2){return new Promise(function(_0x1dd107,_0x4b9daa){return client[_0xc207('0x4')](_0x2b40be,_0x12f1f2)['then'](function(_0x5a727b){if(_0x5a727b['error']){return _0x4b9daa(_0x5a727b[_0xc207('0x5')][_0xc207('0x6')]);}else{return _0x1dd107(_0x5a727b[_0xc207('0x7')]);}})['catch'](function(_0x25cb97){return _0x4b9daa(_0x25cb97);});});}exports[_0xc207('0x8')]=function(){return request(_0xc207('0x9'),{'options':{'raw':![],'attributes':['id','name',_0xc207('0xa')]}});};exports[_0xc207('0xb')]=function(_0x216e14){return request(_0xc207('0xc'),{'options':{'raw':![],'where':{'name':_0x216e14},'attributes':[_0xc207('0xa')]}});};exports[_0xc207('0xd')]=function(_0x487d95){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x487d95},'include':[{'model':'MailServerOut','as':_0xc207('0xe'),'include':[{'model':'CloudProvider','as':_0xc207('0xf')}]}],'attributes':['id',_0xc207('0x10'),'email'],'smtp':!![]}});};exports[_0xc207('0x11')]=function(_0xb86b06){return request(_0xc207('0xc'),{'options':{'where':{'id':_0xb86b06},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x12')]=function(_0x51e967){return request(_0xc207('0x13'),{'options':{'where':{'id':_0x51e967},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x14')]=function(_0x4031ad){return request('ShowVariable',{'options':{'where':{'id':_0x4031ad},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x1cebfa){return request(_0xc207('0x15'),{'options':{'where':{'id':_0x1cebfa},'attributes':[_0xc207('0x16')]}});};exports[_0xc207('0x17')]=function(_0x4b8f44){return request(_0xc207('0x18'),{'options':{'where':{'id':_0x4b8f44},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x19')]=function(_0x5f288e){return request(_0xc207('0x1a'),{'options':{'where':{'phone':_0x5f288e['phone']},'attributes':['id']}});};exports[_0xc207('0x1b')]=function(_0x33ddb1){return request(_0xc207('0x1c'),{'options':{'where':{'id':_0x33ddb1},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x1d')]=function(_0x2caec5){return request(_0xc207('0x1e'),{'options':{'where':{'id':_0x2caec5},'attributes':[_0xc207('0x1f')]}});};exports[_0xc207('0x20')]=function(_0x2bd2eb){return request(_0xc207('0x21'),{'options':{'raw':![],'where':{'id':_0x2bd2eb},'include':[{'model':_0xc207('0x22'),'as':_0xc207('0x23')}]}});};exports['getSmsAccountById']=function(_0x163b36){return request('ShowSmsAccount',{'options':{'where':{'id':_0x163b36},'attributes':['id',_0xc207('0x10')]}});};exports[_0xc207('0x24')]=function(_0x1eabe8){return request(_0xc207('0x25'),{'body':_0x1eabe8});};exports[_0xc207('0x26')]=function(_0xd209ac){return request(_0xc207('0x27'),{'body':_0xd209ac});};exports[_0xc207('0x28')]=function(_0xa52138){return request(_0xc207('0x29'),{'body':_[_0xc207('0x2a')](_0xa52138,{'project_name':_0xa52138[_0xc207('0x2b')],'prev_project_name':_0xa52138[_0xc207('0x2c')]||'','is_subproject':_0xa52138[_0xc207('0x2c')]?!![]:![],'leaveAt':moment()[_0xc207('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xc207('0x2e')]=function(_0x5e0bd1){return request('CreateSquareRecording',{'body':_0x5e0bd1});};exports[_0xc207('0x2f')]=function(_0x3a05f3){return request(_0xc207('0x30'),{'body':_0x3a05f3});};exports[_0xc207('0x31')]=function(_0x6a653d){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x6a653d[_0xc207('0x32')],'ListId':_0x6a653d[_0xc207('0x33')]}}})[_0xc207('0x34')](function(_0x1bec3f){if(_0x1bec3f){return _0x1bec3f;}return request(_0xc207('0x35'),{'body':_0x6a653d});});};exports[_0xc207('0x36')]=function(_0x2e6a3e){return request(_0xc207('0x37'),{'options':{'where':{'id':_0x2e6a3e},'attributes':[_0xc207('0x10')]}});};exports[_0xc207('0x38')]=function(_0x2043cf,_0xaa1b54){return request(_0xc207('0x39'),{'body':{'interface':_0xaa1b54},'options':{'where':_0x2043cf}});};exports['agentPause']=function(_0x1cc799,_0xc6f834,_0x1c4027){return request(_0xc207('0x3a'),{'body':{'type':_0xc6f834,'uniqueid':_0x1c4027},'options':{'where':_0x1cc799}});};exports[_0xc207('0x3b')]=function(_0x2ce133){return request('UnpauseUser',{'body':{},'options':{'where':_0x2ce133}});};exports[_0xc207('0x3c')]=function(_0x3b3d23){return request(_0xc207('0x3d'),{'body':{},'options':{'where':_0x3b3d23}});}; \ No newline at end of file +var _0x6f0d=['client','http','request','then','error','message','result','catch','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','ShowInterval','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise'];(function(_0x46904f,_0x21ffea){var _0x1d7c03=function(_0x402cfc){while(--_0x402cfc){_0x46904f['push'](_0x46904f['shift']());}};_0x1d7c03(++_0x21ffea);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x5debbd,_0x4c0b8e){_0x5debbd=_0x5debbd-0x0;var _0x1014d2=_0x6f0d[_0x5debbd];return _0x1014d2;};'use strict';var _=require('lodash');var moment=require(_0xd6f0('0x0'));var jayson=require(_0xd6f0('0x1'));var client=jayson[_0xd6f0('0x2')][_0xd6f0('0x3')]({'port':0x2329});function request(_0x573473,_0x275230){return new Promise(function(_0x135a93,_0x2f78fb){return client[_0xd6f0('0x4')](_0x573473,_0x275230)[_0xd6f0('0x5')](function(_0x59f5d2){if(_0x59f5d2[_0xd6f0('0x6')]){return _0x2f78fb(_0x59f5d2['error'][_0xd6f0('0x7')]);}else{return _0x135a93(_0x59f5d2[_0xd6f0('0x8')]);}})[_0xd6f0('0x9')](function(_0x1a48a0){return _0x2f78fb(_0x1a48a0);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xd6f0('0xa'),_0xd6f0('0xb')]}});};exports[_0xd6f0('0xc')]=function(_0x382a2e){return request(_0xd6f0('0xd'),{'options':{'raw':![],'where':{'name':_0x382a2e},'attributes':['production']}});};exports[_0xd6f0('0xe')]=function(_0xee144c){return request(_0xd6f0('0xf'),{'options':{'raw':![],'where':{'id':_0xee144c},'include':[{'model':_0xd6f0('0x10'),'as':'Smtp','include':[{'model':_0xd6f0('0x11'),'as':_0xd6f0('0x11')}]}],'attributes':['id',_0xd6f0('0xa'),_0xd6f0('0x12')],'smtp':!![]}});};exports[_0xd6f0('0x13')]=function(_0x409549){return request(_0xd6f0('0xd'),{'options':{'where':{'id':_0x409549},'attributes':[_0xd6f0('0xa')]}});};exports[_0xd6f0('0x14')]=function(_0x4ab979){return request(_0xd6f0('0x15'),{'options':{'where':{'id':_0x4ab979},'attributes':[_0xd6f0('0xa')]}});};exports['getVariableById']=function(_0x419b7e){return request('ShowVariable',{'options':{'where':{'id':_0x419b7e},'attributes':[_0xd6f0('0xa')]}});};exports[_0xd6f0('0x16')]=function(_0x41bd99){return request(_0xd6f0('0x17'),{'options':{'where':{'id':_0x41bd99},'attributes':[_0xd6f0('0x18')]}});};exports[_0xd6f0('0x19')]=function(_0x25da0c){return request(_0xd6f0('0x1a'),{'options':{'where':{'id':_0x25da0c},'attributes':[_0xd6f0('0xa')]}});};exports[_0xd6f0('0x1b')]=function(_0x23ab6c){return request(_0xd6f0('0x1c'),{'options':{'where':{'phone':_0x23ab6c[_0xd6f0('0x1d')]},'attributes':['id']}});};exports[_0xd6f0('0x1e')]=function(_0x1f43d7){return request(_0xd6f0('0x1f'),{'options':{'where':{'id':_0x1f43d7},'attributes':['name']}});};exports['getSoundById']=function(_0x3939aa){return request(_0xd6f0('0x20'),{'options':{'where':{'id':_0x3939aa},'attributes':[_0xd6f0('0x21')]}});};exports['getIntervalById']=function(_0x67afa7){return request(_0xd6f0('0x22'),{'options':{'raw':![],'where':{'id':_0x67afa7},'include':[{'model':'Interval','as':_0xd6f0('0x23')}]}});};exports['getSmsAccountById']=function(_0x1ee584){return request(_0xd6f0('0x24'),{'options':{'where':{'id':_0x1ee584},'attributes':['id','name']}});};exports[_0xd6f0('0x25')]=function(_0x45e99c){return request('CreateSmsMessage',{'body':_0x45e99c});};exports[_0xd6f0('0x26')]=function(_0x402070){return request(_0xd6f0('0x27'),{'body':_0x402070});};exports['createSquareReport']=function(_0x2ca8bb){return request(_0xd6f0('0x28'),{'body':_['merge'](_0x2ca8bb,{'project_name':_0x2ca8bb[_0xd6f0('0x29')],'prev_project_name':_0x2ca8bb['arg_2']||'','is_subproject':_0x2ca8bb[_0xd6f0('0x2a')]?!![]:![],'leaveAt':moment()[_0xd6f0('0x2b')](_0xd6f0('0x2c'))})});};exports[_0xd6f0('0x2d')]=function(_0x4101bd){return request(_0xd6f0('0x2e'),{'body':_0x4101bd});};exports[_0xd6f0('0x2f')]=function(_0x26799c){return request('CreateSquareMessage',{'body':_0x26799c});};exports[_0xd6f0('0x30')]=function(_0x1982d3){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x1982d3[_0xd6f0('0x1d')],'ListId':_0x1982d3[_0xd6f0('0x31')]}}})[_0xd6f0('0x5')](function(_0xb61222){if(_0xb61222){return _0xb61222;}return request(_0xd6f0('0x32'),{'body':_0x1982d3});});};exports[_0xd6f0('0x33')]=function(_0x351fda){return request(_0xd6f0('0x34'),{'options':{'where':{'id':_0x351fda},'attributes':[_0xd6f0('0xa')]}});};exports[_0xd6f0('0x35')]=function(_0x1dff9b,_0x3e913a){return request(_0xd6f0('0x36'),{'body':{'interface':_0x3e913a},'options':{'where':_0x1dff9b}});};exports[_0xd6f0('0x37')]=function(_0xbdd223,_0x2d7c90,_0x31c493){return request(_0xd6f0('0x38'),{'body':{'type':_0x2d7c90,'uniqueid':_0x31c493},'options':{'where':_0xbdd223}});};exports[_0xd6f0('0x39')]=function(_0x180e5f){return request(_0xd6f0('0x3a'),{'body':{},'options':{'where':_0x180e5f}});};exports[_0xd6f0('0x3b')]=function(_0x4a8ebe){return request(_0xd6f0('0x3c'),{'body':{},'options':{'where':_0x4a8ebe}});}; \ 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 8eea2c7..e4c2357 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 _0x3cd8=['./polly','./lex','exports'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0x3cd8,0x150));var _0x83cd=function(_0x207db1,_0x19c38c){_0x207db1=_0x207db1-0x0;var _0x3744e1=_0x3cd8[_0x207db1];return _0x3744e1;};var polly=require(_0x83cd('0x0'));var lex=require(_0x83cd('0x1'));module[_0x83cd('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x9b69=['exports','./polly','./lex'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b69,0xa3));var _0x99b6=function(_0x1dd1cc,_0x159da6){_0x1dd1cc=_0x1dd1cc-0x0;var _0x4c9599=_0x9b69[_0x1dd1cc];return _0x4c9599;};var polly=require(_0x99b6('0x0'));var lex=require(_0x99b6('0x1'));module[_0x99b6('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 016b183..c791b9f 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 _0x4483=['exports','./lib/api'];(function(_0x7db81,_0x45f1df){var _0x4877d8=function(_0x231edb){while(--_0x231edb){_0x7db81['push'](_0x7db81['shift']());}};_0x4877d8(++_0x45f1df);}(_0x4483,0x1a3));var _0x3448=function(_0x36b6bf,_0x18f1d1){_0x36b6bf=_0x36b6bf-0x0;var _0x55e46d=_0x4483[_0x36b6bf];return _0x55e46d;};'use strict';var lex=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178){return lex(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178);}; \ No newline at end of file +var _0x6324=['./lib/api','exports'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x6324,0x142));var _0x4632=function(_0x1d1722,_0x759c36){_0x1d1722=_0x1d1722-0x0;var _0x100055=_0x6324[_0x1d1722];return _0x100055;};'use strict';var lex=require(_0x4632('0x0'));module[_0x4632('0x1')]=function(_0xb0927d,_0x2fc528,_0x551054,_0x1805c5,_0x48e508,_0x3bea40){return lex(_0xb0927d,_0x2fc528,_0x551054,_0x1805c5,_0x48e508,_0x3bea40);}; \ 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 dfd8524..78be8b7 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(_0xea2c85,_0x440d69){var _0x401d02=function(_0x4d8b06){while(--_0x4d8b06){_0xea2c85['push'](_0xea2c85['shift']());}};_0x401d02(++_0x440d69);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0xbd201,_0x2d26d0){var _0x103c69=function(_0x1dc5c6){while(--_0x1dc5c6){_0xbd201['push'](_0xbd201['shift']());}};_0x103c69(++_0x2d26d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 ed080cf..06963c8 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 _0xf502=['exports','./lib/api'];(function(_0x54d461,_0x477366){var _0x148f5e=function(_0x5532ef){while(--_0x5532ef){_0x54d461['push'](_0x54d461['shift']());}};_0x148f5e(++_0x477366);}(_0xf502,0xa7));var _0x2f50=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0xf502[_0x2e7a43];return _0x52e9e1;};'use strict';var polly=require(_0x2f50('0x0'));module[_0x2f50('0x1')]=function(_0x237166,_0x224b77,_0x3ef987,_0x1c0762,_0x20391d,_0x4be45f,_0x48787a){return polly(_0x237166,_0x224b77,_0x3ef987,_0x1c0762,_0x20391d,_0x4be45f,_0x48787a);}; \ No newline at end of file +var _0xd4c4=['./lib/api','exports'];(function(_0x471b24,_0x1e00b1){var _0x16e841=function(_0x295677){while(--_0x295677){_0x471b24['push'](_0x471b24['shift']());}};_0x16e841(++_0x1e00b1);}(_0xd4c4,0xf8));var _0x4d4c=function(_0x533676,_0x2be01c){_0x533676=_0x533676-0x0;var _0x32f7bd=_0xd4c4[_0x533676];return _0x32f7bd;};'use strict';var polly=require(_0x4d4c('0x0'));module[_0x4d4c('0x1')]=function(_0xa34732,_0x1d1d05,_0xfea337,_0x5d5341,_0x2f3ef2,_0x3ead3e,_0x388342){return polly(_0xa34732,_0x1d1d05,_0xfea337,_0x5d5341,_0x2f3ef2,_0x3ead3e,_0x388342);}; \ 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 91fa8db..7d49a17 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 _0xc2ad=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x108c6c,_0x4a7e7d){var _0x4d8c4d=function(_0x5cddeb){while(--_0x5cddeb){_0x108c6c['push'](_0x108c6c['shift']());}};_0x4d8c4d(++_0x4a7e7d);}(_0xc2ad,0x163));var _0xdc2a=function(_0x242602,_0x4d52bc){_0x242602=_0x242602-0x0;var _0xb8602a=_0xc2ad[_0x242602];return _0xb8602a;};'use strict';var fs=require('fs');var path=require(_0xdc2a('0x0'));var BPromise=require(_0xdc2a('0x1'));var rs=require('randomstring');var AWS=require(_0xdc2a('0x2'));function pollyResult(_0xaee372,_0x319e1c,_0x58392f){return new BPromise(function(_0x5a093b,_0x542914){_0xaee372[_0xdc2a('0x3')](_0x319e1c,function(_0x93a471,_0x38ee77){if(_0x93a471){_0x542914(_0x93a471);}else if(_0x38ee77){if(_0x38ee77[_0xdc2a('0x4')]instanceof Buffer){fs[_0xdc2a('0x5')](_0x58392f,_0x38ee77['AudioStream'],function(_0x5b7ef6){if(_0x5b7ef6){_0x542914(_0x5b7ef6);}else{_0x5a093b();}});}else{_0x542914(new Error(_0xdc2a('0x6')));}}else{_0x542914(new Error(_0xdc2a('0x7')));}});});}module['exports']=function(_0xdea80b,_0x34a768,_0x12174f,_0x203822,_0x1323f1,_0x23fb79,_0x5b464f){var _0x55bfef=new AWS[(_0xdc2a('0x8'))]({'accessKeyId':_0xdea80b,'secretAccessKey':_0x34a768,'region':_0x12174f});var _0x2c4575={'Text':_0x1323f1,'TextType':_0x23fb79||'text','OutputFormat':_0xdc2a('0x9'),'VoiceId':_0x203822};return pollyResult(_0x55bfef,_0x2c4575,_0x5b464f);}; \ No newline at end of file +var _0x9684=['mp3','path','bluebird','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x1655a4,_0x4f4e0a){var _0x4f9faf=function(_0x1679ab){while(--_0x1679ab){_0x1655a4['push'](_0x1655a4['shift']());}};_0x4f9faf(++_0x4f4e0a);}(_0x9684,0x12a));var _0x4968=function(_0x53d0cd,_0xb4a9b4){_0x53d0cd=_0x53d0cd-0x0;var _0x24e01f=_0x9684[_0x53d0cd];return _0x24e01f;};'use strict';var fs=require('fs');var path=require(_0x4968('0x0'));var BPromise=require(_0x4968('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x1b862f,_0x283912,_0x893b17){return new BPromise(function(_0x48a8ae,_0x53a320){_0x1b862f[_0x4968('0x2')](_0x283912,function(_0x4d607a,_0x4c774c){if(_0x4d607a){_0x53a320(_0x4d607a);}else if(_0x4c774c){if(_0x4c774c[_0x4968('0x3')]instanceof Buffer){fs[_0x4968('0x4')](_0x893b17,_0x4c774c['AudioStream'],function(_0x12080b){if(_0x12080b){_0x53a320(_0x12080b);}else{_0x48a8ae();}});}else{_0x53a320(new Error(_0x4968('0x5')));}}else{_0x53a320(new Error(_0x4968('0x6')));}});});}module[_0x4968('0x7')]=function(_0xed3f6,_0x379e9f,_0x2336ea,_0x22361e,_0x30dec6,_0x465a6e,_0x35b7ca){var _0x109b4b=new AWS[(_0x4968('0x8'))]({'accessKeyId':_0xed3f6,'secretAccessKey':_0x379e9f,'region':_0x2336ea});var _0x554a82={'Text':_0x30dec6,'TextType':_0x465a6e||_0x4968('0x9'),'OutputFormat':_0x4968('0xa'),'VoiceId':_0x22361e};return pollyResult(_0x109b4b,_0x554a82,_0x35b7ca);}; \ 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 7d5839c..3fe7a35 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0xbb709d,_0x271364,_0x19868c,_0x2c931b){return asr(_0xbb709d,_0x271364,_0x19868c);}; \ No newline at end of file +var _0xd549=['./lib/api','exports'];(function(_0x4d0df6,_0x4634f3){var _0x4e2615=function(_0x5285e2){while(--_0x5285e2){_0x4d0df6['push'](_0x4d0df6['shift']());}};_0x4e2615(++_0x4634f3);}(_0xd549,0x142));var _0x9d54=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xd549[_0x1d1779];return _0x2377e9;};'use strict';var asr=require(_0x9d54('0x0'));module[_0x9d54('0x1')]=function(_0x95aa4c,_0x4c1c02,_0x11a11e,_0x55348d){return asr(_0x95aa4c,_0x4c1c02,_0x11a11e);}; \ 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 f76e12c..6eb7d13 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 _0xd87e=['bluebird','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','length','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url'];(function(_0x87c537,_0x3073b8){var _0x4469f6=function(_0x22e49a){while(--_0x22e49a){_0x87c537['push'](_0x87c537['shift']());}};_0x4469f6(++_0x3073b8);}(_0xd87e,0x1bf));var _0xed87=function(_0xec1043,_0x2a0be1){_0xec1043=_0xec1043-0x0;var _0x2bbb3e=_0xd87e[_0xec1043];return _0x2bbb3e;};'use strict';var url=require(_0xed87('0x0'));var BPromise=require(_0xed87('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xed87('0x2')]=function(_0x189fdd,_0x16509b,_0x5901be){return new BPromise(function(_0xbbee79,_0x5e960f){var _0x11a5d9;if(typeof _0x189fdd!==_0xed87('0x3')||_0x189fdd['length']===0x0){return _0x5e960f(_0xed87('0x4'));}if(typeof _0x16509b!=='string'||_0x16509b['length']===0x0){return _0x5e960f(_0xed87('0x5'));}if(typeof _0x5901be!==_0xed87('0x6')&&(typeof _0x5901be!==_0xed87('0x3')||_0x5901be[_0xed87('0x7')]===0x0)){return _0x5e960f('lang\x20should\x20be\x20a\x20string');}try{_0x11a5d9=fs[_0xed87('0x8')](_0x189fdd)[_0xed87('0x9')](_0xed87('0xa'));}catch(_0x3c9a3c){return _0x5e960f(_0x3c9a3c);}return _0xbbee79({'method':_0xed87('0xb'),'uri':host+_0xed87('0xc')+_0x16509b,'body':{'config':{'encoding':_0xed87('0xd'),'sampleRateHertz':'8000','languageCode':_0x5901be},'audio':{'content':_0x11a5d9}},'json':!![]});});}; \ No newline at end of file +var _0xc6d8=['lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x4be730,_0x341fe4){_0x4be730=_0x4be730-0x0;var _0x54bbe5=_0xc6d8[_0x4be730];return _0x54bbe5;};'use strict';var url=require(_0x8c6d('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x8c6d('0x1');module['exports']=function(_0x3b88d1,_0x5974d3,_0x292852){return new BPromise(function(_0x4fa8a4,_0x5b6b04){var _0x352b8c;if(typeof _0x3b88d1!==_0x8c6d('0x2')||_0x3b88d1[_0x8c6d('0x3')]===0x0){return _0x5b6b04(_0x8c6d('0x4'));}if(typeof _0x5974d3!==_0x8c6d('0x2')||_0x5974d3[_0x8c6d('0x3')]===0x0){return _0x5b6b04(_0x8c6d('0x5'));}if(typeof _0x292852!=='undefined'&&(typeof _0x292852!==_0x8c6d('0x2')||_0x292852[_0x8c6d('0x3')]===0x0)){return _0x5b6b04(_0x8c6d('0x6'));}try{_0x352b8c=fs['readFileSync'](_0x3b88d1)[_0x8c6d('0x7')](_0x8c6d('0x8'));}catch(_0x45e50e){return _0x5b6b04(_0x45e50e);}return _0x4fa8a4({'method':_0x8c6d('0x9'),'uri':host+_0x8c6d('0xa')+_0x5974d3,'body':{'config':{'encoding':_0x8c6d('0xb'),'sampleRateHertz':_0x8c6d('0xc'),'languageCode':_0x292852},'audio':{'content':_0x352b8c}},'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 a5c5a2c..90c2cd4 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 _0xa21e=['./asr'];(function(_0x47223b,_0xb0fecd){var _0x3884c8=function(_0x3dfdca){while(--_0x3dfdca){_0x47223b['push'](_0x47223b['shift']());}};_0x3884c8(++_0xb0fecd);}(_0xa21e,0x115));var _0xea21=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xa21e[_0x1a72f3];return _0x57ef47;};var asr=require(_0xea21('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x6035=['./asr'];(function(_0x15d2e7,_0x575e70){var _0x2341c8=function(_0x2b0e62){while(--_0x2b0e62){_0x15d2e7['push'](_0x15d2e7['shift']());}};_0x2341c8(++_0x575e70);}(_0x6035,0xad));var _0x5603=function(_0x49abd5,_0x177adb){_0x49abd5=_0x49abd5-0x0;var _0x1a2a58=_0x6035[_0x49abd5];return _0x1a2a58;};var asr=require(_0x5603('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index bd74f5b..e4ea39e 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 _0x79f7=['resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','endConversation','metadata','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','name','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','bluebird','http','https','md5','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','close','unlink','pipe','end','https:','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','then','info','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','googleDialogflow','source','result'];(function(_0x3f19b3,_0x3f0849){var _0xd61898=function(_0x3ca685){while(--_0x3ca685){_0x3f19b3['push'](_0x3f19b3['shift']());}};_0xd61898(++_0x3f0849);}(_0x79f7,0xb7));var _0x779f=function(_0x151a0f,_0x37a3e8){_0x151a0f=_0x151a0f-0x0;var _0xd12329=_0x79f7[_0x151a0f];return _0xd12329;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x779f('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x779f('0x1'));var https=require(_0x779f('0x2'));var md5=require(_0x779f('0x3'));var path=require(_0x779f('0x4'));var querystring=require(_0x779f('0x5'));var rp=require(_0x779f('0x6'));var rs=require('randomstring');var sox=require(_0x779f('0x7'));var tts=require(_0x779f('0x8'));var urlParse=require(_0x779f('0x9'))[_0x779f('0xa')];var util=require(_0x779f('0xb'));var aws=require('./aws');var google=require(_0x779f('0xc'));var sestek=require(_0x779f('0xd'));var tilde=require('./tilde');var logger=require(_0x779f('0xe'))(_0x779f('0xf'));var ISPEECH_API=_0x779f('0x10');function downloadFile(_0x34f157,_0x22cd08){return new BPromise(function(_0x5b5bf7,_0xa3c894){var _0x1c58c7=urlParse(_0x34f157);var _0x452f92=_0x1c58c7[_0x779f('0x11')]==='https:'?https:http;var _0x56834f={'host':_0x1c58c7[_0x779f('0x12')],'path':_0x1c58c7[_0x779f('0x4')],'headers':{'user-agent':_0x779f('0x13')}};_0x452f92[_0x779f('0x14')](_0x56834f,function(_0x4ee433){if(_0x4ee433[_0x779f('0x15')]!==0xc8){logger[_0x779f('0x16')](_0x779f('0x17')+_0x34f157+_0x779f('0x18')+_0x4ee433[_0x779f('0x15')]+'\x20('+_0x4ee433[_0x779f('0x19')]+')');_0xa3c894(new Error(_0x779f('0x17')+_0x34f157+'\x20failed,\x20status\x20code\x20=\x20'+_0x4ee433[_0x779f('0x15')]+'\x20('+_0x4ee433['statusMessage']+')'));return;}var _0x32d157=fs[_0x779f('0x1a')](_0x22cd08);_0x32d157['on'](_0x779f('0x1b'),function(){logger['info']('finish\x20download\x20file');_0x32d157[_0x779f('0x1c')](_0x5b5bf7);});_0x32d157['on'](_0x779f('0x16'),function(_0x2ab43b){fs[_0x779f('0x1d')](_0x22cd08);logger[_0x779f('0x16')]('download\x20error',_0x2ab43b);_0xa3c894(_0x2ab43b);});_0x4ee433[_0x779f('0x1e')](_0x32d157);})['on'](_0x779f('0x16'),function(_0x5b7e99){logger['error'](_0x5b7e99);_0xa3c894(_0x5b7e99);})[_0x779f('0x1f')]();});}function uploadFile(_0x572ee1){return new BPromise(function(_0x33dd44,_0x2bfab0){var _0x53f796=urlParse(_0x572ee1);var _0x299154=_0x53f796[_0x779f('0x11')]===_0x779f('0x20')?https:http;var _0x43457a={'host':_0x53f796[_0x779f('0x12')],'path':_0x53f796['path'],'headers':{'user-agent':_0x779f('0x13')}};_0x299154[_0x779f('0x14')](_0x43457a,function(_0x112219){if(_0x112219[_0x779f('0x15')]!==0xc8){_0x2bfab0(new Error('request\x20to\x20'+_0x572ee1+_0x779f('0x18')+_0x112219[_0x779f('0x15')]+'\x20('+_0x112219[_0x779f('0x19')]+')'));return;}var _0x3b97c3='';_0x112219['on']('data',function(_0x428e66){_0x3b97c3+=_0x428e66;});_0x112219['on'](_0x779f('0x1f'),function(){_0x33dd44(_0x3b97c3);});})['on'](_0x779f('0x16'),function(_0x17fa41){_0x2bfab0(_0x17fa41);})[_0x779f('0x1f')]();});}function convertFile(_0x256147,_0x3b4e33){return new BPromise(function(_0x3bf131,_0x5cf35b){var _0x12e326=sox[_0x779f('0x21')](_0x256147,_0x3b4e33,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x12e326['on'](_0x779f('0x16'),function(_0x327df5){logger[_0x779f('0x16')](_0x779f('0x22'),_0x327df5);_0x5cf35b(_0x327df5);});_0x12e326['on']('end',function(){logger['info'](_0x779f('0x23'));_0x3bf131();});_0x12e326[_0x779f('0x24')]();});}function base64Decode(_0x2b0ff2,_0x5867cf){var _0x14c66f=path[_0x779f('0x25')](__dirname,_0x779f('0x26'),rs[_0x779f('0x27')](0x4)+_0x779f('0x28'));fs[_0x779f('0x29')](_0x14c66f,_0x2b0ff2,_0x779f('0x2a'));return convertFile(_0x14c66f,_0x5867cf)['then'](function(){try{fs['unlink'](_0x14c66f);fs[_0x779f('0x2b')](_0x5867cf,_0x779f('0x2c'));}catch(_0x5e97fd){logger[_0x779f('0x16')](_0x5e97fd);}return _0x5867cf[_0x779f('0x2d')]('.')[0x0];});}function base64Encode(_0x59ac87){var _0x3bb22a=fs[_0x779f('0x2e')](_0x59ac87);return new Buffer(_0x3bb22a)[_0x779f('0x2f')](_0x779f('0x2a'));}exports[_0x779f('0x30')]=function(_0x284d54,_0x24cda1,_0x24b000,_0x230845,_0x55a345,_0x585ac4){var _0x47c959,_0x2eba24;var _0x2c7412=_0x779f('0x31');var _0x420647=_0x779f('0x32')+_0x284d54;var _0x361b9e={};if(_0x24cda1==='ssml'){_0x361b9e[_0x779f('0x33')]={'ssml':_0x24b000};}else{_0x361b9e[_0x779f('0x33')]={'text':_0x24b000};};_0x361b9e[_0x779f('0x34')]={'languageCode':_0x230845,'ssmlGender':_0x55a345};_0x361b9e[_0x779f('0x35')]={'audioEncoding':_0x779f('0x36'),'sampleRateHertz':0x1f40};var _0x2e3752={'url':_0x2c7412+_0x779f('0x37')+_0x420647,'method':_0x779f('0x38'),'json':!![],'body':_0x361b9e};return rp(_0x2e3752)['then'](function(_0x54039b){return new BPromise(function(_0xdee130,_0x1323d4){_0x47c959=path[_0x779f('0x25')](__dirname,_0x779f('0x26'),rs['generate'](0x4)+_0x779f('0x39'));var _0x306052=Buffer[_0x779f('0x3a')](_0x54039b[_0x779f('0x3b')],_0x779f('0x2a'));return fs['writeFile'](_0x47c959,_0x306052,function(_0x1b44b3){_0x1323d4(_0x1b44b3);},function(_0x5dd228){fs[_0x779f('0x2b')](_0x47c959,_0x779f('0x2c'));_0xdee130(_0x5dd228);});});})[_0x779f('0x3c')](function(_0x32dfbc){_0x2eba24=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x779f('0x28'));return convertFile(_0x47c959,_0x2eba24);})[_0x779f('0x3c')](function(){try{fs[_0x779f('0x1d')](_0x47c959);fs[_0x779f('0x2b')](_0x2eba24,_0x779f('0x2c'));}catch(_0x80f674){logger[_0x779f('0x16')](_0x80f674);}logger[_0x779f('0x3d')]('googleCloudTTS\x20path',_0x2eba24[_0x779f('0x2d')]('.')[0x0]);return _0x2eba24[_0x779f('0x2d')]('.')[0x0];});};exports['googleTTS']=function(_0x38a0c7,_0x2c268b){var _0x1bb71b=_0x779f('0x3e');var _0x4610a8,_0x4d818a;var _0x69a00d;var _0xcfd5d9={'encoding':_0x779f('0x3f'),'method':_0x779f('0x38'),'timeout':0x2710,'url':_0x1bb71b,'headers':{'Content-Type':_0x779f('0x40')},'body':_0x779f('0x41')+encodeURIComponent(JSON[_0x779f('0x42')]([[[_0x779f('0x43'),JSON[_0x779f('0x42')]([_0x38a0c7,_0x2c268b||'en',![],_0x779f('0x44')]),null,'generic']]]))};return rp(_0xcfd5d9)['then'](function(_0xc6b889){try{_0x69a00d=eval(_0xc6b889['slice'](0x5))[0x0][0x2];}catch(_0x2eab85){throw new Error(_0x779f('0x45')+_0xc6b889[_0x779f('0x46')]);}if(!_0x69a00d){if(_0x38a0c7[_0x779f('0x47')]>0xc8){throw new Error(_0x779f('0x48'));}else{throw new Error(_0x779f('0x49')+_0x2c268b+_0x779f('0x4a'));}}try{_0x69a00d=eval(_0x69a00d)[0x0];}catch(_0x284dd9){throw new Error(_0x779f('0x45')+res[_0x779f('0x46')]);}const _0x26472e=_0x69a00d;_0x4610a8=path[_0x779f('0x25')](__dirname,_0x779f('0x26'),rs[_0x779f('0x27')](0x4)+'.mp3');fs[_0x779f('0x29')](_0x4610a8,_0x69a00d,{'encoding':_0x779f('0x2a')});_0x4d818a=path['resolve'](__dirname,_0x779f('0x26'),rs[_0x779f('0x27')](0x4)+_0x779f('0x28'));return convertFile(_0x4610a8,_0x4d818a);})['then'](function(){try{fs['unlink'](_0x4610a8);fs[_0x779f('0x2b')](_0x4d818a,'777');}catch(_0xb2ee8a){logger[_0x779f('0x16')](_0xb2ee8a);}logger['info']('goggleTTS\x20path',_0x4d818a['split']('.')[0x0]);return _0x4d818a[_0x779f('0x2d')]('.')[0x0];});};exports[_0x779f('0x4b')]=function(_0x2ff073,_0x448037,_0x560165){return google[_0x779f('0x4c')](_0x2ff073,_0x448037,_0x560165)[_0x779f('0x3c')](function(_0x43bd7d){logger[_0x779f('0x3d')](_0x43bd7d[_0x779f('0x4d')]);return rp(_0x43bd7d);})[_0x779f('0x3c')](function(_0x389c40){var _0xeb87dd='';var _0x339645=0x0;try{fs[_0x779f('0x1d')](_0x2ff073);}catch(_0x487279){logger[_0x779f('0x16')](_0x487279);}if(_0x389c40&&_0x389c40[_0x779f('0x4e')]){_0xeb87dd=_0x389c40['results']['map'](function(_0x117f64){return _0x117f64&&_0x117f64[_0x779f('0x4f')][0x0]&&_0x117f64['alternatives'][0x0][_0x779f('0x50')]?_0x117f64[_0x779f('0x4f')][0x0][_0x779f('0x50')]:'';})[_0x779f('0x51')]('\x0a');_0x339645=_0x389c40[_0x779f('0x4e')][_0x779f('0x52')](function(_0x3e13bc){return _0x3e13bc&&_0x3e13bc[_0x779f('0x4f')][0x0]&&_0x3e13bc[_0x779f('0x4f')][0x0][_0x779f('0x53')]?_0x3e13bc[_0x779f('0x4f')][0x0][_0x779f('0x53')]:0x0;})[_0x779f('0x51')]('\x0a');}logger[_0x779f('0x3d')](_0x779f('0x54'),_0xeb87dd);logger[_0x779f('0x3d')](_0x779f('0x55'),_0x339645);return{'transcript':_0xeb87dd,'confidence':_0x339645};})[_0x779f('0x56')](function(_0xd3ce98){logger['error'](_0x779f('0x57'),_0xd3ce98[_0x779f('0x15')],_0xd3ce98['name'],_0xd3ce98['message']);});};exports[_0x779f('0x58')]=function(_0x773427,_0x3c0772,_0x3641b0,_0x2ab863){var _0x413bab=apiai(_0x3c0772,{'language':_0x2ab863||'en'});return _0x413bab['textRequest'](_0x3641b0,{'sessionId':md5(_0x773427)})[_0x779f('0x3c')](function(_0x5a21b9){logger[_0x779f('0x3d')](JSON[_0x779f('0x42')](_0x5a21b9));return{'source':_0x5a21b9['result'][_0x779f('0x59')],'resolvedQuery':_0x5a21b9[_0x779f('0x5a')][_0x779f('0x5b')],'action':_0x5a21b9[_0x779f('0x5a')]['action'],'actionIncomplete':_0x5a21b9[_0x779f('0x5a')][_0x779f('0x5c')],'speech':_0x5a21b9['result'][_0x779f('0x5d')][_0x779f('0x5e')],'score':_0x5a21b9[_0x779f('0x5a')][_0x779f('0x5f')],'statusCode':_0x5a21b9[_0x779f('0x60')][_0x779f('0x61')],'endConversation':_0x5a21b9['result']['metadata'][_0x779f('0x62')]||![],'isFallbackIntent':_0x5a21b9[_0x779f('0x5a')][_0x779f('0x63')]['isFallbackIntent']};});};exports[_0x779f('0x64')]=function(_0xa0a0d9,_0x4613e3,_0x180751,_0x314478,_0x1ab1dd,_0x38b1dc){var _0x33ed75=_0x314478[_0x779f('0x65')](/\\n/g,'\x0a');var _0x3e5fe2={'credentials':{'private_key':_0x33ed75,'client_email':_0x180751}};var _0x76af71=new dialogflow['SessionsClient'](_0x3e5fe2);var _0x426c44=_0x76af71[_0x779f('0x66')](_0x4613e3,md5(_0xa0a0d9));var _0x4d7256={'session':_0x426c44,'queryInput':{'text':{'text':_0x1ab1dd,'languageCode':_0x38b1dc}}};return _0x76af71[_0x779f('0x67')](_0x4d7256)['then'](function(_0xc096d6){if(_0xc096d6&&_0xc096d6[_0x779f('0x47')]){logger[_0x779f('0x3d')](_0x779f('0x68'),JSON['stringify'](_0xc096d6));var _0x14c088=_0xc096d6[0x0];if(_0x14c088){var _0x13084d={'action':_0x14c088[_0x779f('0x69')][_0x779f('0x6a')],'allRequiredParamsPresent':_0x14c088[_0x779f('0x69')]['allRequiredParamsPresent'],'endConversation':_0x14c088[_0x779f('0x69')][_0x779f('0x6b')]&&_0x14c088[_0x779f('0x69')][_0x779f('0x6b')]['fields']?_0x14c088[_0x779f('0x69')][_0x779f('0x6b')]['fields'][_0x779f('0x6c')][_0x779f('0x6d')]:![],'fulfillmentText':_0x14c088[_0x779f('0x69')][_0x779f('0x6e')],'intentName':_0x14c088[_0x779f('0x69')][_0x779f('0x6f')][_0x779f('0x70')],'intentDisplayName':_0x14c088['queryResult']['intent'][_0x779f('0x71')],'isFallbackIntent':_0x14c088[_0x779f('0x69')][_0x779f('0x6f')][_0x779f('0x72')],'languageCode':_0x14c088['queryResult'][_0x779f('0x73')],'queryText':_0x14c088[_0x779f('0x69')][_0x779f('0x74')],'responseId':_0x14c088[_0x779f('0x75')],'score':_0x14c088['queryResult'][_0x779f('0x76')],'speech':_0x14c088[_0x779f('0x69')][_0x779f('0x6e')],'providerResponse':JSON[_0x779f('0x42')](_0xc096d6)};return _0x13084d;}}});};exports[_0x779f('0x77')]=function(_0x59b7a3,_0x3e62ff,_0x15ed3e,_0xc96bd){return tilde[_0x779f('0x4c')](_0x59b7a3,_0x3e62ff,_0x15ed3e,_0xc96bd)[_0x779f('0x3c')](function(_0x57f077){try{fs[_0x779f('0x1d')](_0x59b7a3);}catch(_0x225cc9){logger['error'](_0x225cc9);}logger['info'](_0x779f('0x78'),_0x57f077[_0x779f('0x50')]);logger[_0x779f('0x3d')]('Tilde\x20ASR\x20confidence',_0x57f077[_0x779f('0x53')]);return _0x57f077;});};exports[_0x779f('0x79')]=function(_0x900e9d,_0x1e4b14,_0x25b259,_0x5c1f95,_0x421ef3,_0x56b54d){var _0x50095e=path[_0x779f('0x25')](__dirname,_0x779f('0x26'),rs[_0x779f('0x27')](0x4)+_0x779f('0x39'));var _0x49b996;return aws[_0x779f('0x7a')](_0x900e9d,_0x1e4b14,_0x25b259,_0x5c1f95,_0x421ef3,_0x56b54d,_0x50095e)['then'](function(){_0x49b996=path['resolve'](__dirname,_0x779f('0x26'),rs[_0x779f('0x27')](0x4)+'.wav');return convertFile(_0x50095e,_0x49b996);})[_0x779f('0x3c')](function(){try{fs[_0x779f('0x1d')](_0x50095e);fs[_0x779f('0x2b')](_0x49b996,_0x779f('0x2c'));}catch(_0x30cf6c){logger[_0x779f('0x16')](_0x30cf6c);}return _0x49b996['split']('.')[0x0];});};exports[_0x779f('0x7b')]=function(_0x5bfd54,_0x36b8dd,_0x313613,_0x15d5d0,_0xe0ded2,_0x28703d){return aws[_0x779f('0x7c')](_0x5bfd54,_0x36b8dd,_0x313613,_0x15d5d0,_0xe0ded2,_0x28703d)['then'](function(_0x3d7985){logger[_0x779f('0x3d')](JSON[_0x779f('0x42')](_0x3d7985));return _0x3d7985;});};exports[_0x779f('0x7d')]=function(_0xf5dbf6,_0x310628,_0xb1be34,_0x10859f){var _0x3b59ac=util[_0x779f('0x7e')](_0x779f('0x7f'),ISPEECH_API,_0xf5dbf6,encodeURIComponent(_0x310628),_0xb1be34,_0x10859f);var _0x23c165=path[_0x779f('0x25')](__dirname,'tmp',rs[_0x779f('0x27')](0x4)+_0x779f('0x39'));var _0x2f2d40;return downloadFile(_0x3b59ac,_0x23c165)[_0x779f('0x3c')](function(){_0x2f2d40=path[_0x779f('0x25')](__dirname,_0x779f('0x26'),rs['generate'](0x4)+_0x779f('0x28'));return convertFile(_0x23c165,_0x2f2d40);})[_0x779f('0x3c')](function(){try{fs[_0x779f('0x1d')](_0x23c165);fs[_0x779f('0x2b')](_0x2f2d40,_0x779f('0x2c'));}catch(_0x534dd9){logger[_0x779f('0x16')](_0x534dd9);}return _0x2f2d40[_0x779f('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x47707b,_0xdf6c20,_0x11fbe5,_0x23ede9){var _0x2b0374=util[_0x779f('0x7e')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0xdf6c20,_0x11fbe5,base64Encode(_0x47707b),_0x23ede9?util[_0x779f('0x7e')](_0x779f('0x80'),encodeURIComponent(_0x23ede9)):_0x779f('0x81'));return uploadFile(_0x2b0374)[_0x779f('0x3c')](function(_0x52e849){return querystring[_0x779f('0xa')](_0x52e849);});};exports['sestekNDA']=function(_0x37a9fc,_0x512510){return sestek[_0x779f('0x82')](_0x37a9fc,_0x512510)[_0x779f('0x3c')](function(_0x142f74){logger['info'](JSON[_0x779f('0x42')](_0x142f74));var _0x47a7ab={'speech':_0x142f74[_0x779f('0x83')],'action':_0x142f74[_0x779f('0x84')]?_0x142f74[_0x779f('0x84')][_0x779f('0x85')]:undefined,'actiondata':_0x142f74['channelData']?_0x142f74[_0x779f('0x84')][_0x779f('0x86')]:undefined};if(_0x142f74[_0x779f('0x84')]&&_0x142f74['channelData'][_0x779f('0x87')]){return base64Decode(_0x142f74[_0x779f('0x84')][_0x779f('0x87')]['Data'],path[_0x779f('0x25')](__dirname,_0x779f('0x26'),rs[_0x779f('0x27')](0x4)+_0x779f('0x28')))[_0x779f('0x3c')](function(_0x524a3c){_0x47a7ab[_0x779f('0x88')]=_0x524a3c;return _0x47a7ab;});}return _0x47a7ab;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xdf2e=['agi','https://api.ispeech.org/api/rest','protocol','host','path','WHAT_EVER','get','statusCode','request\x20to\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','error','download\x20error','pipe','end','https:','\x20failed,\x20status\x20code\x20=\x20','data','transcode','error\x20convert','finish\x20to\x20convert','resolve','generate','.wav','writeFileSync','base64','then','unlink','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','writeFile','chmodSync','tmp','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','catch','googleDialogflow','textRequest','result','resolvedQuery','actionIncomplete','fulfillment','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','name','intent','displayName','isFallback','languageCode','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','awsPolly','polly','lex','ispeechTTS','format','ispeechASR','model=%s','freeform=3','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','randomstring','sox','google-tts-api','parse','util','./aws','./google','./sestek'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xdf2e,0xf5));var _0xedf2=function(_0x537501,_0x1509e4){_0x537501=_0x537501-0x0;var _0x54bfc2=_0xdf2e[_0x537501];return _0x54bfc2;};'use strict';var apiai=require(_0xedf2('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xedf2('0x1'));var fs=require('fs');var http=require(_0xedf2('0x2'));var https=require(_0xedf2('0x3'));var md5=require(_0xedf2('0x4'));var path=require('path');var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0xedf2('0x5'));var sox=require(_0xedf2('0x6'));var tts=require(_0xedf2('0x7'));var urlParse=require('url')[_0xedf2('0x8')];var util=require(_0xedf2('0x9'));var aws=require(_0xedf2('0xa'));var google=require(_0xedf2('0xb'));var sestek=require(_0xedf2('0xc'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0xedf2('0xd'));var ISPEECH_API=_0xedf2('0xe');function downloadFile(_0x4f6ac6,_0x3ddb30){return new BPromise(function(_0x206721,_0x14ccea){var _0x119700=urlParse(_0x4f6ac6);var _0x77a867=_0x119700[_0xedf2('0xf')]==='https:'?https:http;var _0x4e3a10={'host':_0x119700[_0xedf2('0x10')],'path':_0x119700[_0xedf2('0x11')],'headers':{'user-agent':_0xedf2('0x12')}};_0x77a867[_0xedf2('0x13')](_0x4e3a10,function(_0x13ffe3){if(_0x13ffe3[_0xedf2('0x14')]!==0xc8){logger['error'](_0xedf2('0x15')+_0x4f6ac6+'\x20failed,\x20status\x20code\x20=\x20'+_0x13ffe3['statusCode']+'\x20('+_0x13ffe3[_0xedf2('0x16')]+')');_0x14ccea(new Error(_0xedf2('0x15')+_0x4f6ac6+'\x20failed,\x20status\x20code\x20=\x20'+_0x13ffe3[_0xedf2('0x14')]+'\x20('+_0x13ffe3[_0xedf2('0x16')]+')'));return;}var _0x1241fd=fs[_0xedf2('0x17')](_0x3ddb30);_0x1241fd['on'](_0xedf2('0x18'),function(){logger[_0xedf2('0x19')](_0xedf2('0x1a'));_0x1241fd['close'](_0x206721);});_0x1241fd['on']('error',function(_0x27fed1){fs['unlink'](_0x3ddb30);logger[_0xedf2('0x1b')](_0xedf2('0x1c'),_0x27fed1);_0x14ccea(_0x27fed1);});_0x13ffe3[_0xedf2('0x1d')](_0x1241fd);})['on'](_0xedf2('0x1b'),function(_0x26a164){logger[_0xedf2('0x1b')](_0x26a164);_0x14ccea(_0x26a164);})[_0xedf2('0x1e')]();});}function uploadFile(_0xb94639){return new BPromise(function(_0x4c600e,_0x5dd15d){var _0x15ea59=urlParse(_0xb94639);var _0x3bed7a=_0x15ea59[_0xedf2('0xf')]===_0xedf2('0x1f')?https:http;var _0x57c8ac={'host':_0x15ea59['host'],'path':_0x15ea59['path'],'headers':{'user-agent':_0xedf2('0x12')}};_0x3bed7a[_0xedf2('0x13')](_0x57c8ac,function(_0x425c79){if(_0x425c79['statusCode']!==0xc8){_0x5dd15d(new Error(_0xedf2('0x15')+_0xb94639+_0xedf2('0x20')+_0x425c79['statusCode']+'\x20('+_0x425c79['statusMessage']+')'));return;}var _0xb959cf='';_0x425c79['on'](_0xedf2('0x21'),function(_0x31529a){_0xb959cf+=_0x31529a;});_0x425c79['on']('end',function(){_0x4c600e(_0xb959cf);});})['on'](_0xedf2('0x1b'),function(_0x470847){_0x5dd15d(_0x470847);})[_0xedf2('0x1e')]();});}function convertFile(_0x364584,_0x15cb35){return new BPromise(function(_0xf2c2b9,_0x4a2c22){var _0x21153f=sox[_0xedf2('0x22')](_0x364584,_0x15cb35,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x21153f['on'](_0xedf2('0x1b'),function(_0x47d1dc){logger[_0xedf2('0x1b')](_0xedf2('0x23'),_0x47d1dc);_0x4a2c22(_0x47d1dc);});_0x21153f['on'](_0xedf2('0x1e'),function(){logger[_0xedf2('0x19')](_0xedf2('0x24'));_0xf2c2b9();});_0x21153f['start']();});}function base64Decode(_0x35ed5f,_0x350814){var _0x506d54=path[_0xedf2('0x25')](__dirname,'tmp',rs[_0xedf2('0x26')](0x4)+_0xedf2('0x27'));fs[_0xedf2('0x28')](_0x506d54,_0x35ed5f,_0xedf2('0x29'));return convertFile(_0x506d54,_0x350814)[_0xedf2('0x2a')](function(){try{fs[_0xedf2('0x2b')](_0x506d54);fs['chmodSync'](_0x350814,_0xedf2('0x2c'));}catch(_0x8db4ff){logger[_0xedf2('0x1b')](_0x8db4ff);}return _0x350814[_0xedf2('0x2d')]('.')[0x0];});}function base64Encode(_0x4edfd1){var _0x2a8f41=fs['readFileSync'](_0x4edfd1);return new Buffer(_0x2a8f41)[_0xedf2('0x2e')]('base64');}exports[_0xedf2('0x2f')]=function(_0x1f769a,_0x2f7f76,_0x169e7d,_0x34a799,_0x270f89,_0x492081){var _0x349c40,_0xe3ea81;var _0xa0034b=_0xedf2('0x30');var _0x2157cc=_0xedf2('0x31')+_0x1f769a;var _0x2483ae={};if(_0x2f7f76==='ssml'){_0x2483ae[_0xedf2('0x32')]={'ssml':_0x169e7d};}else{_0x2483ae[_0xedf2('0x32')]={'text':_0x169e7d};};_0x2483ae[_0xedf2('0x33')]={'languageCode':_0x34a799,'ssmlGender':_0x270f89};_0x2483ae[_0xedf2('0x34')]={'audioEncoding':_0xedf2('0x35'),'sampleRateHertz':0x1f40};var _0x2a1cb1={'url':_0xa0034b+_0xedf2('0x36')+_0x2157cc,'method':_0xedf2('0x37'),'json':!![],'body':_0x2483ae};return rp(_0x2a1cb1)[_0xedf2('0x2a')](function(_0x19cf4f){return new BPromise(function(_0x2833e3,_0x4a327d){_0x349c40=path['resolve'](__dirname,'tmp',rs[_0xedf2('0x26')](0x4)+_0xedf2('0x38'));var _0x3e1075=Buffer[_0xedf2('0x39')](_0x19cf4f['audioContent'],_0xedf2('0x29'));return fs[_0xedf2('0x3a')](_0x349c40,_0x3e1075,function(_0x3a13d6){_0x4a327d(_0x3a13d6);},function(_0x1178b9){fs[_0xedf2('0x3b')](_0x349c40,_0xedf2('0x2c'));_0x2833e3(_0x1178b9);});});})['then'](function(_0x1d1528){_0xe3ea81=path[_0xedf2('0x25')](__dirname,_0xedf2('0x3c'),rs[_0xedf2('0x26')](0x4)+_0xedf2('0x27'));return convertFile(_0x349c40,_0xe3ea81);})[_0xedf2('0x2a')](function(){try{fs[_0xedf2('0x2b')](_0x349c40);fs[_0xedf2('0x3b')](_0xe3ea81,_0xedf2('0x2c'));}catch(_0x50c074){logger[_0xedf2('0x1b')](_0x50c074);}logger[_0xedf2('0x19')](_0xedf2('0x3d'),_0xe3ea81[_0xedf2('0x2d')]('.')[0x0]);return _0xe3ea81[_0xedf2('0x2d')]('.')[0x0];});};exports['googleTTS']=function(_0x3cd215,_0x5193c7){var _0x5d1948=_0xedf2('0x3e');var _0x358a6c,_0x3f858b;var _0x30ef7c;var _0x1120a2={'encoding':_0xedf2('0x3f'),'method':_0xedf2('0x37'),'timeout':0x2710,'url':_0x5d1948,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0xedf2('0x40')]([[[_0xedf2('0x41'),JSON[_0xedf2('0x40')]([_0x3cd215,_0x5193c7||'en',![],_0xedf2('0x42')]),null,_0xedf2('0x43')]]]))};return rp(_0x1120a2)[_0xedf2('0x2a')](function(_0x1751c7){try{_0x30ef7c=eval(_0x1751c7[_0xedf2('0x44')](0x5))[0x0][0x2];}catch(_0x56b573){throw new Error(_0xedf2('0x45')+_0x1751c7[_0xedf2('0x21')]);}if(!_0x30ef7c){if(_0x3cd215[_0xedf2('0x46')]>0xc8){throw new Error(_0xedf2('0x47'));}else{throw new Error(_0xedf2('0x48')+_0x5193c7+'\x22\x20might\x20not\x20exist');}}try{_0x30ef7c=eval(_0x30ef7c)[0x0];}catch(_0xb29229){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xedf2('0x21')]);}const _0x277b07=_0x30ef7c;_0x358a6c=path[_0xedf2('0x25')](__dirname,_0xedf2('0x3c'),rs[_0xedf2('0x26')](0x4)+_0xedf2('0x38'));fs[_0xedf2('0x28')](_0x358a6c,_0x30ef7c,{'encoding':'base64'});_0x3f858b=path['resolve'](__dirname,_0xedf2('0x3c'),rs[_0xedf2('0x26')](0x4)+_0xedf2('0x27'));return convertFile(_0x358a6c,_0x3f858b);})[_0xedf2('0x2a')](function(){try{fs['unlink'](_0x358a6c);fs[_0xedf2('0x3b')](_0x3f858b,_0xedf2('0x2c'));}catch(_0x66f531){logger['error'](_0x66f531);}logger[_0xedf2('0x19')](_0xedf2('0x49'),_0x3f858b[_0xedf2('0x2d')]('.')[0x0]);return _0x3f858b['split']('.')[0x0];});};exports['googleASR']=function(_0x87ece6,_0x3067ce,_0x30cc82){return google['asr'](_0x87ece6,_0x3067ce,_0x30cc82)['then'](function(_0x44f488){logger[_0xedf2('0x19')](_0x44f488[_0xedf2('0x4a')]);return rp(_0x44f488);})[_0xedf2('0x2a')](function(_0x2eb2e8){var _0x1085b2='';var _0x4a1ee7=0x0;try{fs['unlink'](_0x87ece6);}catch(_0x35d6a4){logger['error'](_0x35d6a4);}if(_0x2eb2e8&&_0x2eb2e8[_0xedf2('0x4b')]){_0x1085b2=_0x2eb2e8[_0xedf2('0x4b')][_0xedf2('0x4c')](function(_0x21dc5c){return _0x21dc5c&&_0x21dc5c[_0xedf2('0x4d')][0x0]&&_0x21dc5c[_0xedf2('0x4d')][0x0]['transcript']?_0x21dc5c['alternatives'][0x0][_0xedf2('0x4e')]:'';})['join']('\x0a');_0x4a1ee7=_0x2eb2e8[_0xedf2('0x4b')][_0xedf2('0x4c')](function(_0x27a194){return _0x27a194&&_0x27a194['alternatives'][0x0]&&_0x27a194[_0xedf2('0x4d')][0x0][_0xedf2('0x4f')]?_0x27a194['alternatives'][0x0][_0xedf2('0x4f')]:0x0;})[_0xedf2('0x50')]('\x0a');}logger[_0xedf2('0x19')](_0xedf2('0x51'),_0x1085b2);logger['info']('googleASR\x20confidence',_0x4a1ee7);return{'transcript':_0x1085b2,'confidence':_0x4a1ee7};})[_0xedf2('0x52')](function(_0x6fc7f6){logger[_0xedf2('0x1b')]('[%s]\x20%s:%s',_0x6fc7f6[_0xedf2('0x14')],_0x6fc7f6['name'],_0x6fc7f6['message']);});};exports[_0xedf2('0x53')]=function(_0x1c54e1,_0x23585a,_0x2cf6cd,_0x3b82dd){var _0x481509=apiai(_0x23585a,{'language':_0x3b82dd||'en'});return _0x481509[_0xedf2('0x54')](_0x2cf6cd,{'sessionId':md5(_0x1c54e1)})[_0xedf2('0x2a')](function(_0x47b00b){logger[_0xedf2('0x19')](JSON[_0xedf2('0x40')](_0x47b00b));return{'source':_0x47b00b[_0xedf2('0x55')]['source'],'resolvedQuery':_0x47b00b[_0xedf2('0x55')][_0xedf2('0x56')],'action':_0x47b00b[_0xedf2('0x55')]['action'],'actionIncomplete':_0x47b00b[_0xedf2('0x55')][_0xedf2('0x57')],'speech':_0x47b00b[_0xedf2('0x55')][_0xedf2('0x58')]['speech'],'score':_0x47b00b[_0xedf2('0x55')][_0xedf2('0x59')],'statusCode':_0x47b00b[_0xedf2('0x5a')][_0xedf2('0x5b')],'endConversation':_0x47b00b[_0xedf2('0x55')][_0xedf2('0x5c')]['endConversation']||![],'isFallbackIntent':_0x47b00b[_0xedf2('0x55')][_0xedf2('0x5c')][_0xedf2('0x5d')]};});};exports[_0xedf2('0x5e')]=function(_0x12cd94,_0x76b3f5,_0xd1377b,_0x2b29d,_0x231977,_0x724640){var _0x4ac967=_0x2b29d[_0xedf2('0x5f')](/\\n/g,'\x0a');var _0x146498={'credentials':{'private_key':_0x4ac967,'client_email':_0xd1377b}};var _0x209824=new dialogflow[(_0xedf2('0x60'))](_0x146498);var _0x54d95a=_0x209824[_0xedf2('0x61')](_0x76b3f5,md5(_0x12cd94));var _0x3bf078={'session':_0x54d95a,'queryInput':{'text':{'text':_0x231977,'languageCode':_0x724640}}};return _0x209824[_0xedf2('0x62')](_0x3bf078)[_0xedf2('0x2a')](function(_0x4f57a0){if(_0x4f57a0&&_0x4f57a0['length']){logger['info'](_0xedf2('0x63'),JSON[_0xedf2('0x40')](_0x4f57a0));var _0x40c433=_0x4f57a0[0x0];if(_0x40c433){var _0x42b7cc={'action':_0x40c433[_0xedf2('0x64')]['action'],'allRequiredParamsPresent':_0x40c433['queryResult'][_0xedf2('0x65')],'endConversation':_0x40c433['queryResult'][_0xedf2('0x66')]&&_0x40c433['queryResult'][_0xedf2('0x66')][_0xedf2('0x67')]?_0x40c433[_0xedf2('0x64')][_0xedf2('0x66')][_0xedf2('0x67')]['end_conversation'][_0xedf2('0x68')]:![],'fulfillmentText':_0x40c433[_0xedf2('0x64')][_0xedf2('0x69')],'intentName':_0x40c433['queryResult']['intent'][_0xedf2('0x6a')],'intentDisplayName':_0x40c433[_0xedf2('0x64')][_0xedf2('0x6b')][_0xedf2('0x6c')],'isFallbackIntent':_0x40c433[_0xedf2('0x64')][_0xedf2('0x6b')][_0xedf2('0x6d')],'languageCode':_0x40c433[_0xedf2('0x64')][_0xedf2('0x6e')],'queryText':_0x40c433['queryResult']['queryText'],'responseId':_0x40c433['responseId'],'score':_0x40c433[_0xedf2('0x64')][_0xedf2('0x6f')],'speech':_0x40c433[_0xedf2('0x64')][_0xedf2('0x69')],'providerResponse':JSON['stringify'](_0x4f57a0)};return _0x42b7cc;}}});};exports[_0xedf2('0x70')]=function(_0x340b53,_0x1a0746,_0x3a4ca9,_0x412052){return tilde[_0xedf2('0x71')](_0x340b53,_0x1a0746,_0x3a4ca9,_0x412052)[_0xedf2('0x2a')](function(_0x339751){try{fs['unlink'](_0x340b53);}catch(_0x35fd5f){logger[_0xedf2('0x1b')](_0x35fd5f);}logger[_0xedf2('0x19')](_0xedf2('0x72'),_0x339751[_0xedf2('0x4e')]);logger[_0xedf2('0x19')]('Tilde\x20ASR\x20confidence',_0x339751['confidence']);return _0x339751;});};exports[_0xedf2('0x73')]=function(_0x228339,_0x1301d4,_0x266517,_0x5a1033,_0xb34b77,_0x257f8f){var _0x2ca0e0=path[_0xedf2('0x25')](__dirname,_0xedf2('0x3c'),rs['generate'](0x4)+_0xedf2('0x38'));var _0x596d8d;return aws[_0xedf2('0x74')](_0x228339,_0x1301d4,_0x266517,_0x5a1033,_0xb34b77,_0x257f8f,_0x2ca0e0)[_0xedf2('0x2a')](function(){_0x596d8d=path[_0xedf2('0x25')](__dirname,'tmp',rs[_0xedf2('0x26')](0x4)+_0xedf2('0x27'));return convertFile(_0x2ca0e0,_0x596d8d);})[_0xedf2('0x2a')](function(){try{fs[_0xedf2('0x2b')](_0x2ca0e0);fs[_0xedf2('0x3b')](_0x596d8d,_0xedf2('0x2c'));}catch(_0x53778d){logger[_0xedf2('0x1b')](_0x53778d);}return _0x596d8d['split']('.')[0x0];});};exports['awsLex']=function(_0x5ce888,_0x206723,_0xecb2b2,_0x520532,_0x500e72,_0x23b855){return aws[_0xedf2('0x75')](_0x5ce888,_0x206723,_0xecb2b2,_0x520532,_0x500e72,_0x23b855)['then'](function(_0xf36d18){logger['info'](JSON[_0xedf2('0x40')](_0xf36d18));return _0xf36d18;});};exports[_0xedf2('0x76')]=function(_0x24798b,_0x3f1620,_0x447994,_0x3eb919){var _0x4875f7=util[_0xedf2('0x77')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x24798b,encodeURIComponent(_0x3f1620),_0x447994,_0x3eb919);var _0x35db3f=path[_0xedf2('0x25')](__dirname,_0xedf2('0x3c'),rs[_0xedf2('0x26')](0x4)+'.mp3');var _0xcd314e;return downloadFile(_0x4875f7,_0x35db3f)[_0xedf2('0x2a')](function(){_0xcd314e=path[_0xedf2('0x25')](__dirname,_0xedf2('0x3c'),rs[_0xedf2('0x26')](0x4)+_0xedf2('0x27'));return convertFile(_0x35db3f,_0xcd314e);})['then'](function(){try{fs[_0xedf2('0x2b')](_0x35db3f);fs[_0xedf2('0x3b')](_0xcd314e,_0xedf2('0x2c'));}catch(_0xad692a){logger[_0xedf2('0x1b')](_0xad692a);}return _0xcd314e[_0xedf2('0x2d')]('.')[0x0];});};exports[_0xedf2('0x78')]=function(_0x56b660,_0x14ab2a,_0x3ea724,_0x2af5bd){var _0x3c4cde=util[_0xedf2('0x77')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x14ab2a,_0x3ea724,base64Encode(_0x56b660),_0x2af5bd?util['format'](_0xedf2('0x79'),encodeURIComponent(_0x2af5bd)):_0xedf2('0x7a'));return uploadFile(_0x3c4cde)['then'](function(_0x243781){return querystring['parse'](_0x243781);});};exports['sestekNDA']=function(_0x574137,_0x5ece8b){return sestek['nda'](_0x574137,_0x5ece8b)[_0xedf2('0x2a')](function(_0x33a315){logger[_0xedf2('0x19')](JSON[_0xedf2('0x40')](_0x33a315));var _0x32d1e9={'speech':_0x33a315['text'],'action':_0x33a315[_0xedf2('0x7b')]?_0x33a315['channelData']['CustomAction']:undefined,'actiondata':_0x33a315[_0xedf2('0x7b')]?_0x33a315[_0xedf2('0x7b')][_0xedf2('0x7c')]:undefined};if(_0x33a315['channelData']&&_0x33a315[_0xedf2('0x7b')][_0xedf2('0x7d')]){return base64Decode(_0x33a315['channelData']['AudioFromTts'][_0xedf2('0x7e')],path[_0xedf2('0x25')](__dirname,_0xedf2('0x3c'),rs['generate'](0x4)+_0xedf2('0x27')))['then'](function(_0x23e70c){_0x32d1e9[_0xedf2('0x7f')]=_0x23e70c;return _0x32d1e9;});}return _0x32d1e9;});};exports[_0xedf2('0x80')]=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 03c230b..30a885a 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 _0x278f=['./nda'];(function(_0x80c71b,_0x43054e){var _0x4ef3c1=function(_0x7ee341){while(--_0x7ee341){_0x80c71b['push'](_0x80c71b['shift']());}};_0x4ef3c1(++_0x43054e);}(_0x278f,0x134));var _0xf278=function(_0x3a036e,_0x7e6b8c){_0x3a036e=_0x3a036e-0x0;var _0x44e5e5=_0x278f[_0x3a036e];return _0x44e5e5;};var nda=require(_0xf278('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x8abb=['./nda','exports'];(function(_0x3db212,_0xf526ed){var _0x27a933=function(_0x20b9e4){while(--_0x20b9e4){_0x3db212['push'](_0x3db212['shift']());}};_0x27a933(++_0xf526ed);}(_0x8abb,0x118));var _0xb8ab=function(_0x2b7dc8,_0x1f71d9){_0x2b7dc8=_0x2b7dc8-0x0;var _0x3a4d7f=_0x8abb[_0x2b7dc8];return _0x3a4d7f;};var nda=require(_0xb8ab('0x0'));module[_0xb8ab('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 6ea8b1d..142bf00 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 _0x67da=['POST','resolve','ndauth_url','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','Bearer\x20','access_token','channelData','project','AudioOutputSettings','custom_action','body','CustomAction','CustomActionData','info','stringify','url','../../../../../config/logger','agi','exports'];(function(_0x210851,_0x4efa30){var _0x190e2a=function(_0x55cfbb){while(--_0x55cfbb){_0x210851['push'](_0x210851['shift']());}};_0x190e2a(++_0x4efa30);}(_0x67da,0x192));var _0xa67d=function(_0x42fea5,_0x30589){_0x42fea5=_0x42fea5-0x0;var _0xd45d3e=_0x67da[_0x42fea5];return _0xd45d3e;};'use strict';var rp=require('request-promise');var url=require(_0xa67d('0x0'));var logger=require(_0xa67d('0x1'))(_0xa67d('0x2'));module[_0xa67d('0x3')]=function(_0x472755,_0x3633a0){var _0x1f58c8={'method':_0xa67d('0x4'),'uri':url[_0xa67d('0x5')](_0x3633a0[_0xa67d('0x6')],'/token'),'form':{'grant_type':'password','username':_0x3633a0[_0xa67d('0x7')],'password':_0x3633a0['password']},'json':!![]};return rp(_0x1f58c8)[_0xa67d('0x8')](function(_0x2346f4){var _0x10f89a={'method':_0xa67d('0x4'),'uri':url[_0xa67d('0x5')](_0x3633a0[_0xa67d('0x9')],_0xa67d('0xa')),'body':{'type':_0x3633a0[_0xa67d('0xb')]||_0xa67d('0xc'),'channelId':_0xa67d('0xd'),'conversation':{'id':_0x472755['uniqueid']},'from':{'id':_0x472755[_0xa67d('0xe')],'name':_0x472755[_0xa67d('0xf')]},'recipient':{'id':_0x472755[_0xa67d('0x10')],'name':_0x472755[_0xa67d('0x11')]},'text':_0x3633a0['text'],'channelData':{}},'headers':{'Authorization':_0xa67d('0x12')+_0x2346f4[_0xa67d('0x13')]},'json':!![]};if(_0x3633a0['project']){_0x10f89a['body'][_0xa67d('0x14')]['ProjectName']=_0x3633a0[_0xa67d('0x15')];}if(_0x3633a0['ndagenerate_audio']=='1'){_0x10f89a['body'][_0xa67d('0x14')][_0xa67d('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3633a0[_0xa67d('0x17')]){_0x10f89a[_0xa67d('0x18')][_0xa67d('0x14')][_0xa67d('0x19')]=_0x3633a0['custom_action'];if(_0x3633a0['custom_action_data']){_0x10f89a['body']['channelData'][_0xa67d('0x1a')]=_0x3633a0['custom_action_data'];}}logger[_0xa67d('0x1b')](JSON[_0xa67d('0x1c')](_0x10f89a));return rp(_0x10f89a);});}; \ No newline at end of file +var _0x9090=['Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','/token','password','username','then','ndassistant_url','ndaactivity_type'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9090,0x17f));var _0x0909=function(_0x51b8c0,_0x28c15a){_0x51b8c0=_0x51b8c0-0x0;var _0x7f853c=_0x9090[_0x51b8c0];return _0x7f853c;};'use strict';var rp=require(_0x0909('0x0'));var url=require(_0x0909('0x1'));var logger=require(_0x0909('0x2'))(_0x0909('0x3'));module[_0x0909('0x4')]=function(_0x5466c8,_0x51923f){var _0x2c02f0={'method':_0x0909('0x5'),'uri':url[_0x0909('0x6')](_0x51923f['ndauth_url'],_0x0909('0x7')),'form':{'grant_type':_0x0909('0x8'),'username':_0x51923f[_0x0909('0x9')],'password':_0x51923f[_0x0909('0x8')]},'json':!![]};return rp(_0x2c02f0)[_0x0909('0xa')](function(_0x32bf48){var _0x1755ee={'method':'POST','uri':url[_0x0909('0x6')](_0x51923f[_0x0909('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x51923f[_0x0909('0xc')]||'message','channelId':_0x0909('0xd'),'conversation':{'id':_0x5466c8[_0x0909('0xe')]},'from':{'id':_0x5466c8[_0x0909('0xf')],'name':_0x5466c8[_0x0909('0x10')]},'recipient':{'id':_0x5466c8['dnid'],'name':_0x5466c8[_0x0909('0x11')]},'text':_0x51923f[_0x0909('0x12')],'channelData':{}},'headers':{'Authorization':_0x0909('0x13')+_0x32bf48[_0x0909('0x14')]},'json':!![]};if(_0x51923f['project']){_0x1755ee[_0x0909('0x15')][_0x0909('0x16')][_0x0909('0x17')]=_0x51923f[_0x0909('0x18')];}if(_0x51923f[_0x0909('0x19')]=='1'){_0x1755ee[_0x0909('0x15')][_0x0909('0x16')][_0x0909('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0909('0x1b')};}if(_0x51923f[_0x0909('0x1c')]){_0x1755ee['body'][_0x0909('0x16')][_0x0909('0x1d')]=_0x51923f[_0x0909('0x1c')];if(_0x51923f[_0x0909('0x1e')]){_0x1755ee[_0x0909('0x15')][_0x0909('0x16')][_0x0909('0x1f')]=_0x51923f[_0x0909('0x1e')];}}logger['info'](JSON[_0x0909('0x20')](_0x1755ee));return rp(_0x1755ee);});}; \ 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 888179d..a83db4f 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 _0x7840=['./lib/api'];(function(_0x28ba21,_0x1da2c6){var _0x104bfb=function(_0x2b7b44){while(--_0x2b7b44){_0x28ba21['push'](_0x28ba21['shift']());}};_0x104bfb(++_0x1da2c6);}(_0x7840,0x1e3));var _0x0784=function(_0x4fec5d,_0x29c543){_0x4fec5d=_0x4fec5d-0x0;var _0x3d301e=_0x7840[_0x4fec5d];return _0x3d301e;};'use strict';var asr=require(_0x0784('0x0'));module['exports']=function(_0x497bbb,_0x50ff5e,_0x32255a,_0x6cc9c4){return asr(_0x497bbb,_0x50ff5e,_0x32255a,_0x6cc9c4);}; \ No newline at end of file +var _0x8d7f=['exports','./lib/api'];(function(_0x1ce9ea,_0x32e6f4){var _0x2a95b9=function(_0x1a0496){while(--_0x1a0496){_0x1ce9ea['push'](_0x1ce9ea['shift']());}};_0x2a95b9(++_0x32e6f4);}(_0x8d7f,0x1cb));var _0xf8d7=function(_0x28d09d,_0x525b43){_0x28d09d=_0x28d09d-0x0;var _0x2c49e3=_0x8d7f[_0x28d09d];return _0x2c49e3;};'use strict';var asr=require(_0xf8d7('0x0'));module[_0xf8d7('0x1')]=function(_0x38d578,_0x28c820,_0x47a18e,_0x1b984d){return asr(_0x38d578,_0x28c820,_0x47a18e,_0x1b984d);}; \ 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 2a049cf..6201065 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 _0x5c58=['Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','close','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','send','createReadStream','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error'];(function(_0x1d88db,_0x26213f){var _0x1df256=function(_0x1bb1e7){while(--_0x1bb1e7){_0x1d88db['push'](_0x1d88db['shift']());}};_0x1df256(++_0x26213f);}(_0x5c58,0x108));var _0x85c5=function(_0x290f9f,_0x377ba5){_0x290f9f=_0x290f9f-0x0;var _0x35b4ab=_0x5c58[_0x290f9f];return _0x35b4ab;};'use strict';var BPromise=require(_0x85c5('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x85c5('0x1'));var crypto=require(_0x85c5('0x2'));var logger=require(_0x85c5('0x3'))(_0x85c5('0x4'));module[_0x85c5('0x5')]=function(_0x1574cd,_0x5a7cb0,_0x3c2143,_0x5df0af){return new BPromise(function(_0x5baa36,_0x5a66d8){logger[_0x85c5('0x6')](_0x85c5('0x7'),_0x5df0af||_0x85c5('0x8'));var _0x5b13dc=new WebSocket(_0x5df0af||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x371035='';var _0x19355b='0';var _0x59c476='1';var _0x4ae3b5=_0x85c5('0x9');function _0x539a8d(_0x427dfd){var _0xbde111=crypto['createHash'](_0x85c5('0xa'));_0xbde111[_0x85c5('0xb')](_0x427dfd);return _0xbde111[_0x85c5('0xc')]('hex');}function _0x3e1922(){try{logger[_0x85c5('0x6')](_0x85c5('0xd'));var _0x1cd5a3=moment()['unix']();var _0x32f80d=_0x539a8d(_0x1cd5a3+_0x5a7cb0+_0x3c2143);_0x5b13dc[_0x85c5('0xe')](JSON['stringify']({'appID':_0x5a7cb0,'timestamp':_0x1cd5a3,'appKey':_0x32f80d}));var _0x30f51b=fs[_0x85c5('0xf')](_0x1574cd);_0x30f51b['on']('data',function(_0xe5f38a){_0x5b13dc[_0x85c5('0xe')](_0xe5f38a);});_0x30f51b['on']('close',function(){_0x5b13dc[_0x85c5('0xe')]('EOS');});}catch(_0xc42573){logger[_0x85c5('0x10')](_0x85c5('0x11'),JSON[_0x85c5('0x12')](_0xc42573));_0x5b13dc[_0x85c5('0x13')]();}}function _0x1f3f61(_0x3d4968){try{if(_0x3d4968){var _0x20bb4e=JSON['parse'](_0x3d4968);switch(_0x20bb4e[_0x85c5('0x14')]){case 0x0:if(_0x20bb4e['result']){if(_0x20bb4e[_0x85c5('0x15')][_0x85c5('0x16')]){logger['info'](_0x85c5('0x17'),JSON['stringify'](_0x20bb4e[_0x85c5('0x15')][_0x85c5('0x18')]));_0x371035=_0x20bb4e['result'][_0x85c5('0x18')][0x0][_0x85c5('0x19')];_0x19355b=_0x20bb4e[_0x85c5('0x15')][_0x85c5('0x18')][0x0]['likelihood'];_0x59c476='0';_0x4ae3b5=_0x85c5('0x1a');_0x5b13dc[_0x85c5('0x13')]();}}break;case 0x1:logger[_0x85c5('0x6')](_0x85c5('0x9'));_0x59c476='1';_0x4ae3b5=_0x85c5('0x9');break;case 0x2:logger[_0x85c5('0x6')](_0x85c5('0x1b'));_0x59c476='2';_0x4ae3b5=_0x85c5('0x1b');break;case 0x9:logger[_0x85c5('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x59c476='9';_0x4ae3b5=_0x85c5('0x1c');break;case 0xa:logger[_0x85c5('0x6')](_0x85c5('0x1d'));_0x59c476='10';_0x4ae3b5='Authentication\x20failed.';break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x59c476='11';_0x4ae3b5=_0x85c5('0x1e');}}}catch(_0x919ab9){logger[_0x85c5('0x10')](_0x85c5('0x1f'),JSON[_0x85c5('0x12')](_0x919ab9));_0x5b13dc['terminate']();}}function _0x2fe585(){logger[_0x85c5('0x6')](_0x85c5('0x20'));_0x5baa36({'transcript':_0x371035,'confidence':_0x19355b,'status':_0x59c476,'status_message':_0x4ae3b5});}function _0x21554a(_0x17dbe2){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x85c5('0x21')](_0x17dbe2)){logger[_0x85c5('0x10')](_[_0x85c5('0x22')](_0x17dbe2)?JSON[_0x85c5('0x12')](_0x17dbe2):_0x17dbe2);}}_0x5b13dc['on'](_0x85c5('0x23'),_0x3e1922);_0x5b13dc['on']('message',_0x1f3f61);_0x5b13dc['on'](_0x85c5('0x24'),_0x2fe585);_0x5b13dc['on'](_0x85c5('0x10'),_0x21554a);});}; \ No newline at end of file +var _0x714f=['stringify','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','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','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send'];(function(_0x2267fa,_0x3dcf1b){var _0x4d1788=function(_0x3b7ebc){while(--_0x3b7ebc){_0x2267fa['push'](_0x2267fa['shift']());}};_0x4d1788(++_0x3dcf1b);}(_0x714f,0x1c6));var _0xf714=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0x714f[_0xf168d3];return _0x17fb54;};'use strict';var BPromise=require(_0xf714('0x0'));var _=require(_0xf714('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf714('0x2'));var crypto=require(_0xf714('0x3'));var logger=require(_0xf714('0x4'))('agi');module['exports']=function(_0x532578,_0x337db0,_0x4d2c79,_0x3d3e12){return new BPromise(function(_0x20d61,_0x53b84e){logger['info']('Tilde\x20URI',_0x3d3e12||_0xf714('0x5'));var _0x21f65a=new WebSocket(_0x3d3e12||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x4d78a4='';var _0x2d27ec='0';var _0x36bdf9='1';var _0x2af467=_0xf714('0x6');function _0x3d7881(_0x329866){var _0x5e5055=crypto[_0xf714('0x7')](_0xf714('0x8'));_0x5e5055['update'](_0x329866);return _0x5e5055['digest'](_0xf714('0x9'));}function _0x1c1100(){try{logger[_0xf714('0xa')](_0xf714('0xb'));var _0x249938=moment()[_0xf714('0xc')]();var _0x1db008=_0x3d7881(_0x249938+_0x337db0+_0x4d2c79);_0x21f65a[_0xf714('0xd')](JSON[_0xf714('0xe')]({'appID':_0x337db0,'timestamp':_0x249938,'appKey':_0x1db008}));var _0x21339f=fs['createReadStream'](_0x532578);_0x21339f['on']('data',function(_0x12fc79){_0x21f65a[_0xf714('0xd')](_0x12fc79);});_0x21339f['on']('close',function(){_0x21f65a[_0xf714('0xd')]('EOS');});}catch(_0x5a711b){logger[_0xf714('0xf')](_0xf714('0x10'),JSON[_0xf714('0xe')](_0x5a711b));_0x21f65a[_0xf714('0x11')]();}}function _0x5401ab(_0x1e1237){try{if(_0x1e1237){var _0x31718c=JSON['parse'](_0x1e1237);switch(_0x31718c[_0xf714('0x12')]){case 0x0:if(_0x31718c[_0xf714('0x13')]){if(_0x31718c[_0xf714('0x13')][_0xf714('0x14')]){logger[_0xf714('0xa')](_0xf714('0x15'),JSON[_0xf714('0xe')](_0x31718c['result']['hypotheses']));_0x4d78a4=_0x31718c[_0xf714('0x13')][_0xf714('0x16')][0x0][_0xf714('0x17')];_0x2d27ec=_0x31718c[_0xf714('0x13')]['hypotheses'][0x0][_0xf714('0x18')];_0x36bdf9='0';_0x2af467=_0xf714('0x19');_0x21f65a[_0xf714('0x11')]();}}break;case 0x1:logger['info'](_0xf714('0x6'));_0x36bdf9='1';_0x2af467='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xf714('0xa')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x36bdf9='2';_0x2af467=_0xf714('0x1a');break;case 0x9:logger[_0xf714('0xa')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x36bdf9='9';_0x2af467=_0xf714('0x1b');break;case 0xa:logger[_0xf714('0xa')](_0xf714('0x1c'));_0x36bdf9='10';_0x2af467=_0xf714('0x1c');break;case 0xb:logger[_0xf714('0xa')](_0xf714('0x1d'));_0x36bdf9='11';_0x2af467=_0xf714('0x1d');}}}catch(_0x332046){logger['error'](_0xf714('0x1e'),JSON[_0xf714('0xe')](_0x332046));_0x21f65a['terminate']();}}function _0x1287ce(){logger[_0xf714('0xa')](_0xf714('0x1f'));_0x20d61({'transcript':_0x4d78a4,'confidence':_0x2d27ec,'status':_0x36bdf9,'status_message':_0x2af467});}function _0x531aab(_0x3d8f94){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xf714('0x20')](_0x3d8f94)){logger[_0xf714('0xf')](_[_0xf714('0x21')](_0x3d8f94)?JSON['stringify'](_0x3d8f94):_0x3d8f94);}}_0x21f65a['on'](_0xf714('0x22'),_0x1c1100);_0x21f65a['on']('message',_0x5401ab);_0x21f65a['on'](_0xf714('0x23'),_0x1287ce);_0x21f65a['on'](_0xf714('0xf'),_0x531aab);});}; \ 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 2f87675..cfe97da 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 _0xc953=['exports','./asr'];(function(_0x91384,_0x545eef){var _0x44daa0=function(_0x5a0cc5){while(--_0x5a0cc5){_0x91384['push'](_0x91384['shift']());}};_0x44daa0(++_0x545eef);}(_0xc953,0x87));var _0x3c95=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xc953[_0x1ddedd];return _0xa3e1ac;};var asr=require(_0x3c95('0x0'));module[_0x3c95('0x1')]={'asr':asr}; \ No newline at end of file +var _0x3967=['exports','./asr'];(function(_0xc67563,_0x5d40fb){var _0x420434=function(_0x5ec1e2){while(--_0x5ec1e2){_0xc67563['push'](_0xc67563['shift']());}};_0x420434(++_0x5d40fb);}(_0x3967,0x91));var _0x7396=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0x3967[_0x1344d6];return _0xf45b24;};var asr=require(_0x7396('0x0'));module[_0x7396('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 6bcc542..711e7e2 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(_0x3ef8f7,_0x35359a){var _0x3b097e=function(_0x189c92){while(--_0x189c92){_0x3ef8f7['push'](_0x3ef8f7['shift']());}};_0x3b097e(++_0x35359a);}(_0xe706,0xa3));var _0x6e70=function(_0x1ff527,_0x54b6d2){_0x1ff527=_0x1ff527-0x0;var _0x51cc75=_0xe706[_0x1ff527];return _0x51cc75;};'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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 9800dc2..9aa6bf4 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 _0xb647=['providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','hiddendigitsnum','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','%s/recordings/%s','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','condition','no\x20condition\x20configured','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','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','no\x20find\x20by\x20configured','math','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%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:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','replace','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','subject','template_id','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','getVariableById','then','name','catch','prototype','getVoiceQueueById','rpc','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','googleCloudTTS','google_cloud_tts_text_type','text','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','headers','stringify','body','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','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','clear','clone','isString','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isArray','length','isPlainObject','saveRestApiResult','%s.%s','setVariable','split','replaceAll','toString','getVariable','result','extra','maxRetry','createSquareDetailsReport','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s'];(function(_0x1843b3,_0x10995a){var _0x3c7de0=function(_0xe28643){while(--_0xe28643){_0x1843b3['push'](_0x1843b3['shift']());}};_0x3c7de0(++_0x10995a);}(_0xb647,0xdb));var _0x7b64=function(_0x5f1e8d,_0x5873d1){_0x5f1e8d=_0x5f1e8d-0x0;var _0x339ca2=_0xb647[_0x5f1e8d];return _0x339ca2;};'use strict';var fs=require('fs');var util=require(_0x7b64('0x0'));var _=require(_0x7b64('0x1'));var sh=require(_0x7b64('0x2'));var odbc=require(_0x7b64('0x3'))();var rs=require(_0x7b64('0x4'));var moment=require(_0x7b64('0x5'));var Mustache=require(_0x7b64('0x6'));var rp=require(_0x7b64('0x7'));var logger=require('../../config/logger')(_0x7b64('0x8'));var config=require('../../config/environment');var scripts=require(_0x7b64('0x9'));var FILES_PATH=_0x7b64('0xa');var recursiveMapAttributes=[_0x7b64('0xb'),_0x7b64('0xc')];var verticesWithRetry=[_0x7b64('0xd'),_0x7b64('0xe'),_0x7b64('0xf')];var AGIVertices=function(_0x2ff650,_0x432ced,_0x5784fb){this[_0x7b64('0x10')]=_0x2ff650;this['rpc']=_0x432ced;this[_0x7b64('0x11')]=_0x5784fb;};AGIVertices['prototype']['getVariable']=function(_0x35ed61,_0xa72761){this['rpc'][_0x7b64('0x12')](_0x35ed61)[_0x7b64('0x13')](function(_0xd9e5ca){_0xa72761(null,_0xd9e5ca?_0xd9e5ca[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x432626){_0xa72761(_0x432626);});};AGIVertices[_0x7b64('0x16')]['getVoiceQueue']=function(_0x212438,_0x56899c){this['rpc'][_0x7b64('0x17')](_0x212438)[_0x7b64('0x13')](function(_0x1d256d){_0x56899c(null,_0x1d256d?_0x1d256d[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x437ddc){_0x56899c(_0x437ddc);});};AGIVertices[_0x7b64('0x16')]['getSquareProject']=function(_0xca026a,_0x40066b){this[_0x7b64('0x18')][_0x7b64('0x19')](_0xca026a)[_0x7b64('0x13')](function(_0x4aa38d){_0x40066b(null,_0x4aa38d?_0x4aa38d[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x58517e){_0x40066b(_0x58517e);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1a')]=function(_0x5ef53f,_0x23845e){this[_0x7b64('0x18')][_0x7b64('0x1b')](_0x5ef53f)[_0x7b64('0x13')](function(_0x47cef5){_0x23845e(null,_0x47cef5?_0x47cef5[_0x7b64('0x1c')]:![]);})[_0x7b64('0x15')](function(_0x4a7549){_0x23845e(_0x4a7549);});};AGIVertices[_0x7b64('0x16')]['getUser']=function(_0x2d2d9a,_0x587da6){this[_0x7b64('0x18')][_0x7b64('0x1d')](_0x2d2d9a)[_0x7b64('0x13')](function(_0x379e90){_0x587da6(null,_0x379e90?_0x379e90[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x215ea9){_0x587da6(_0x215ea9);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1e')]=function(_0x78a6d1,_0xec557c){this[_0x7b64('0x18')][_0x7b64('0x1f')](_0x78a6d1)[_0x7b64('0x13')](function(_0x50d06c){_0xec557c(null,_0x50d06c?_0x50d06c[_0x7b64('0x14')]:![]);})['catch'](function(_0x1580d0){_0xec557c(_0x1580d0);});};AGIVertices[_0x7b64('0x16')]['getSound']=function(_0x5acdb3,_0x38738c){var _0x1e1ba7=this;this[_0x7b64('0x18')][_0x7b64('0x20')](_0x5acdb3)[_0x7b64('0x13')](function(_0x3c9fad){_0x38738c(null,_0x3c9fad?_0x1e1ba7[_0x7b64('0x21')](_0x3c9fad[_0x7b64('0x22')]):![]);})['catch'](function(_0x1616c9){_0x38738c(_0x1616c9);});};AGIVertices[_0x7b64('0x16')]['getMailAccount']=function(_0x6b1d0,_0x2bcefa){this[_0x7b64('0x18')][_0x7b64('0x23')](_0x6b1d0)[_0x7b64('0x13')](function(_0x38a059){_0x2bcefa(null,_0x38a059?_0x38a059:![]);})['catch'](function(_0x5bf639){_0x2bcefa(_0x5bf639);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x24')]=function(_0x49e402,_0x508c6d,_0x345664){this['mailRpc'][_0x7b64('0x24')](_0x49e402,_0x508c6d)['then'](function(){_0x345664(null);})['catch'](function(_0x5a80b2){_0x345664(_0x5a80b2);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x25')]=function(_0x120a84,_0x58ffdb){this[_0x7b64('0x18')]['getIntervalById'](_0x120a84)[_0x7b64('0x13')](function(_0x7e1083){if(_0x7e1083){if(_0x7e1083[_0x7b64('0x26')]){_0x58ffdb(null,[_0x7e1083[_0x7b64('0x27')]]);}else{_0x58ffdb(null,_[_0x7b64('0x28')](_0x7e1083['Intervals'],_0x7b64('0x27')));}}else{_0x58ffdb(null,![]);}})[_0x7b64('0x15')](function(_0x2d0e9){_0x58ffdb(_0x2d0e9);});};AGIVertices[_0x7b64('0x16')]['getSoundPath']=function(_0x1855c5){return util[_0x7b64('0x29')](_0x7b64('0x2a'),FILES_PATH,_0x1855c5);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x2b')]=function(_0x27e008,_0x1c0be6,_0x526389){odbc['open'](_0x27e008,function(_0xe9eac){if(_0xe9eac){logger[_0x7b64('0x2c')](_0x7b64('0x2d'),_0xe9eac);_0x526389(_0xe9eac);}else{logger[_0x7b64('0x2e')](_0x7b64('0x2f'));odbc[_0x7b64('0x30')](_0x1c0be6,function(_0x36c606,_0x3c3d77){if(_0x36c606){logger[_0x7b64('0x2e')]('Error\x20executing\x20query\x20%s',_0x1c0be6);_0x526389(_0x36c606);}else{logger[_0x7b64('0x2e')](_0x7b64('0x31'),_0x1c0be6);odbc[_0x7b64('0x32')](function(_0x40787f){if(_0x40787f){logger[_0x7b64('0x2c')](_0x7b64('0x33'),_0x40787f);}_0x526389(null,_0x3c3d77);});}});}});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x34')]=function(_0x3c4467,_0x47012c){this[_0x7b64('0x18')][_0x7b64('0x35')](_0x3c4467)[_0x7b64('0x13')](function(_0x36cfce){_0x47012c(null,_0x36cfce?_0x36cfce:![]);})[_0x7b64('0x15')](function(_0x42cc06){_0x47012c(_0x42cc06);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x36')]=function(_0x8739ec,_0x355e8a){this['rpc'][_0x7b64('0x36')](_0x8739ec)[_0x7b64('0x13')](function(_0x163580){_0x355e8a(null,_0x163580);})['catch'](function(_0x11abbc){_0x355e8a(_0x11abbc);});};AGIVertices[_0x7b64('0x16')]['createSquareDetailsReport']=function(_0x216c58,_0xf0d4a1,_0x54d7d2){this[_0x7b64('0x18')]['createSquareDetailsReport']({'uniqueid':this[_0x7b64('0x10')][_0x7b64('0x37')],'node':_0x216c58[_0x7b64('0x38')],'application':_0x216c58['agicommand'],'data':_0xf0d4a1||null,'project_name':this[_0x7b64('0x10')][_0x7b64('0x39')],'callerid':this[_0x7b64('0x10')][_0x7b64('0x3a')]})[_0x7b64('0x13')](function(_0x284e1a){if(_0x54d7d2){_0x54d7d2(null,_0x284e1a);}})['catch'](function(_0x20accc){if(_0x54d7d2){_0x54d7d2(_0x20accc);}});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x3b')]=function(_0x1dd7a9,_0xdcca4e,_0x54e89a,_0x531354){this['rpc']['createSquareRecording']({'uniqueid':this[_0x7b64('0x10')][_0x7b64('0x37')],'callerid':this[_0x7b64('0x10')][_0x7b64('0x3a')],'calleridname':this[_0x7b64('0x10')][_0x7b64('0x3c')],'context':this[_0x7b64('0x10')][_0x7b64('0x3d')],'extension':this[_0x7b64('0x10')][_0x7b64('0x3e')],'priority':this[_0x7b64('0x10')][_0x7b64('0x3f')],'accountcode':this['channel']['accountcode'],'dnid':this[_0x7b64('0x10')][_0x7b64('0x40')],'projectName':this[_0x7b64('0x10')][_0x7b64('0x39')],'saveName':_0xdcca4e,'filename':_0x1dd7a9[_0x7b64('0x41')]||_0xdcca4e,'savePath':_0x54e89a})['then'](function(_0x3e5321){_0x531354(null,_0x3e5321);})[_0x7b64('0x15')](function(_0x476890){_0x531354(_0x476890);});};AGIVertices['prototype'][_0x7b64('0x42')]=function(_0x214a45,_0x27c9f9,_0x64b24a,_0x18c5b0,_0x572713){this[_0x7b64('0x18')][_0x7b64('0x42')]({'uniqueid':this['channel'][_0x7b64('0x37')],'body':_0x214a45,'direction':_0x27c9f9,'providerName':_0x64b24a,'providerResponse':_0x18c5b0})[_0x7b64('0x13')](function(_0x5ed33c){if(_0x572713){_0x572713(null,_0x5ed33c);}})[_0x7b64('0x15')](function(_0x2c6d00){if(_0x572713){_0x572713(_0x2c6d00);}});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x43')]=function(_0x383190,_0x79cbc9){this[_0x7b64('0x18')][_0x7b64('0x43')]({'firstName':_[_0x7b64('0x44')](_0x383190[_0x7b64('0x14')])||_[_0x7b64('0x45')](_0x383190[_0x7b64('0x14')])?_0x7b64('0x46')+Math[_0x7b64('0x47')]():_0x383190[_0x7b64('0x14')],'lastName':_[_0x7b64('0x44')](_0x383190[_0x7b64('0x48')])||_[_0x7b64('0x45')](_0x383190['lastName'])?null:_0x383190[_0x7b64('0x48')],'phone':_0x383190['phone'],'ListId':_0x383190[_0x7b64('0x49')],'scheduledat':_0x383190[_0x7b64('0x4a')],'callbackUniqueid':this[_0x7b64('0x10')]['uniqueid'],'tags':'callback','description':_0x7b64('0x4b')+_0x383190['scheduledAt']['toString'](),'priority':_0x383190[_0x7b64('0x4c')]})[_0x7b64('0x13')](function(_0x1e1cd3){_0x79cbc9(null,_0x1e1cd3);})['catch'](function(_0x1fd98a){_0x79cbc9(_0x1fd98a);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x4d')]=function(_0x32ba5d,_0x3724a7){this['rpc']['getPauseById'](_0x32ba5d)[_0x7b64('0x13')](function(_0xe47998){_0x3724a7(null,_0xe47998?_0xe47998[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x59df96){_0x3724a7(_0x59df96);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x4e')]=function(_0x18ef41,_0x1049da,_0x4999c3){var _0x463433={'role':'agent'};_0x463433[_0x18ef41]=this[_0x7b64('0x10')]['callerid'];this['rpc']['agentPause'](_0x463433,_0x1049da,this['channel'][_0x7b64('0x37')])[_0x7b64('0x13')](function(_0x5c9a7e){_0x4999c3(null,_[_0x7b64('0x45')](_0x5c9a7e)?![]:!![]);})[_0x7b64('0x15')](function(_0x3dd757){logger['error'](_0x3dd757);_0x4999c3(null,![]);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x4f')]=function(_0x5e6f02,_0x51b944){var _0x1c2bdf={'role':'agent'};_0x1c2bdf[_0x5e6f02]=this['channel'][_0x7b64('0x3a')];this[_0x7b64('0x18')]['agentUnpause'](_0x1c2bdf)['then'](function(_0x28002e){_0x51b944(null,_[_0x7b64('0x45')](_0x28002e)?![]:!![]);})['catch'](function(_0x86ddde){logger['error'](_0x86ddde);_0x51b944(null,![]);});};AGIVertices[_0x7b64('0x16')]['agentLogout']=function(_0x117d52,_0x293e73){var _0x2ad554={'role':_0x7b64('0x50')};_0x2ad554[_0x117d52]=this[_0x7b64('0x10')]['callerid'];this[_0x7b64('0x18')][_0x7b64('0x51')](_0x2ad554)[_0x7b64('0x13')](function(_0x201d1b){_0x293e73(null,_['isNil'](_0x201d1b)?![]:!![]);})[_0x7b64('0x15')](function(_0x323c06){logger[_0x7b64('0x2c')](_0x323c06);_0x293e73(null,![]);});};AGIVertices['prototype'][_0x7b64('0x52')]=function(_0x4e7764,_0x1996f9){var _0x2dc0ea={'role':'agent'};_0x2dc0ea[_0x4e7764]=this['channel'][_0x7b64('0x3a')];var _0x5f1706=_0x4e7764!=_0x7b64('0x53')?util[_0x7b64('0x29')](_0x7b64('0x54'),_0x7b64('0x55'),this[_0x7b64('0x10')][_0x7b64('0x3a')]):undefined;this[_0x7b64('0x18')][_0x7b64('0x52')](_0x2dc0ea,_0x5f1706)['then'](function(_0x37239c){_0x1996f9(null,_[_0x7b64('0x45')](_0x37239c)?![]:!![]);})['catch'](function(_0x5f127c){logger[_0x7b64('0x2c')](_0x5f127c);_0x1996f9(null,![]);});};AGIVertices[_0x7b64('0x16')]['shellCommand']=function(_0x17f511,_0x2a7d8a){sh['exec'](_[_0x7b64('0x56')](_0x17f511),function(_0xb02c35,_0x4962bf){var _0x47c76e=_0x4962bf['replace'](/(\r\n|\n|\r)/gm,'');_0x2a7d8a(null,_0x47c76e);});};AGIVertices[_0x7b64('0x16')]['googleCloudTTS']=function(_0x1c170e,_0x12bf8a){scripts[_0x7b64('0x57')](_0x1c170e['apiKey'],_0x1c170e[_0x7b64('0x58')]||_0x7b64('0x59'),_0x1c170e[_0x7b64('0x59')],_0x1c170e['languageCode']||'en-US',_0x1c170e[_0x7b64('0x5a')]||_0x7b64('0x5b'),_0x1c170e['audioEncoding']||_0x7b64('0x5c'))[_0x7b64('0x13')](function(_0x47b3bc){_0x12bf8a(null,_0x47b3bc);})[_0x7b64('0x15')](function(_0x2e92a5){_0x12bf8a(_0x2e92a5);});};AGIVertices['prototype'][_0x7b64('0x5d')]=function(_0x8941d9,_0x2e7053){scripts[_0x7b64('0x5d')](_0x8941d9[_0x7b64('0x59')],_0x8941d9[_0x7b64('0x5e')]||'en',0x1)['then'](function(_0x4ac9b9){_0x2e7053(null,_0x4ac9b9);})[_0x7b64('0x15')](function(_0x622a7f){_0x2e7053(_0x622a7f);});};AGIVertices['prototype'][_0x7b64('0x5f')]=function(_0x13e09a,_0x26d94d){var _0x511816={'uri':_0x13e09a[_0x7b64('0x60')],'method':_0x13e09a[_0x7b64('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x13e09a['timeout'])===_0x7b64('0x62')&&parseInt(_0x13e09a['timeout'])>=0x1?parseInt(_0x13e09a[_0x7b64('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x7b64('0x64'),_0x7b64('0x65')],_0x511816['method'][_0x7b64('0x66')]())){try{_0x511816['body']=_0x13e09a[_0x7b64('0xc')]?JSON[_0x7b64('0x67')](_0x13e09a['rawBody']):{};}catch(_0x433ec0){logger[_0x7b64('0x2c')](_0x7b64('0x68'),_0x433ec0);}}try{_0x511816['headers']=_0x13e09a[_0x7b64('0xb')]?JSON['parse'](_0x13e09a['rawHeaders']):{};}catch(_0x4c9a99){logger[_0x7b64('0x2c')](_0x7b64('0x69'),_0x4c9a99);}if(_0x13e09a[_0x7b64('0x6a')]){try{var _0x648cbc=require(_0x13e09a[_0x7b64('0x6a')])['sync'](this,_0x511816);_0x511816['uri']=Mustache[_0x7b64('0x6b')](_0x13e09a[_0x7b64('0x60')],_0x648cbc,{},['$$','$$']);if(_0x511816[_0x7b64('0x6c')]){_0x511816[_0x7b64('0x6c')]=JSON[_0x7b64('0x67')](Mustache['render'](JSON[_0x7b64('0x6d')](_0x511816['headers']),_0x648cbc,{},['$$','$$']));}if(_0x511816[_0x7b64('0x6e')]){_0x511816[_0x7b64('0x6e')]=JSON[_0x7b64('0x67')](Mustache['render'](JSON[_0x7b64('0x6d')](_0x511816['body']),_0x648cbc,{},['$$','$$']));}}catch(_0x36e460){logger[_0x7b64('0x2c')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x36e460);}}rp(_0x511816)[_0x7b64('0x13')](function(_0x2d0dbd){var _0x360a6b={'statusCode':_0x2d0dbd[_0x7b64('0x6f')]||0xc8,'statusMessage':_0x2d0dbd[_0x7b64('0x70')]||'OK','headers':_0x2d0dbd[_0x7b64('0x6c')]||{},'body':_0x2d0dbd[_0x7b64('0x6e')]||{}};_0x26d94d(null,_0x360a6b);})['catch'](function(_0x41819b){var _0x5d75ae={'statusCode':_0x41819b[_0x7b64('0x6f')]||0x1f4,'statusMessage':_0x41819b[_0x7b64('0x71')]||_0x7b64('0x72'),'headers':_0x41819b[_0x7b64('0x73')][_0x7b64('0x6c')]||{},'body':_0x41819b[_0x7b64('0x73')][_0x7b64('0x6e')]||{}};_0x26d94d(null,_0x5d75ae);});};AGIVertices['prototype']['googleDialogflow']=function(_0x1cadbf,_0x1aeeec){scripts[_0x7b64('0x74')](this[_0x7b64('0x10')][_0x7b64('0x37')],_0x1cadbf[_0x7b64('0x75')],_0x1cadbf[_0x7b64('0x59')],_0x1cadbf[_0x7b64('0x76')]||'en')[_0x7b64('0x13')](function(_0x502b8a){_0x1aeeec(null,_0x502b8a);})[_0x7b64('0x15')](function(_0x1b4cf8){_0x1aeeec(_0x1b4cf8);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x77')]=function(_0x5c1e4f,_0x212723){scripts[_0x7b64('0x77')](this[_0x7b64('0x10')]['uniqueid'],_0x5c1e4f[_0x7b64('0x78')],_0x5c1e4f[_0x7b64('0x79')],_0x5c1e4f['private_key'],_0x5c1e4f[_0x7b64('0x59')],_0x5c1e4f[_0x7b64('0x7a')]||'en')[_0x7b64('0x13')](function(_0x3cf3e4){_0x212723(null,_0x3cf3e4);})[_0x7b64('0x15')](function(_0x4dbb60){_0x212723(_0x4dbb60);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x7b')]=function(_0x58fb41,_0x4627e4){scripts[_0x7b64('0x7b')](this[_0x7b64('0x10')],_0x58fb41)[_0x7b64('0x13')](function(_0x5e2e1b){_0x4627e4(null,_0x5e2e1b);})[_0x7b64('0x15')](function(_0x14dfc1){_0x4627e4(_0x14dfc1);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x7c')]=function(_0x1180b2,_0x217a13){scripts[_0x7b64('0x7c')](_0x1180b2[_0x7b64('0x75')],_0x1180b2['text'],_0x1180b2[_0x7b64('0x7d')]||_0x7b64('0x7e'),_0x1180b2[_0x7b64('0x7f')])[_0x7b64('0x13')](function(_0x533ce1){_0x217a13(null,_0x533ce1);})[_0x7b64('0x15')](function(_0x4efbc2){_0x217a13(_0x4efbc2);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x80')]=function(_0x35fbce,_0x556031,_0x59d017){scripts[_0x7b64('0x80')](_0x556031,_0x35fbce[_0x7b64('0x75')],_0x35fbce[_0x7b64('0x81')]||_0x7b64('0x7e'),this[_0x7b64('0x82')](_0x35fbce[_0x7b64('0x83')])?_0x35fbce['model']:undefined)[_0x7b64('0x13')](function(_0x503a65){_0x59d017(null,_0x503a65);})[_0x7b64('0x15')](function(_0x5d8cea){_0x59d017(_0x5d8cea);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x84')]=function(_0xb5cae6,_0xb3d6e9){scripts['awsPolly'](_0xb5cae6[_0x7b64('0x85')],_0xb5cae6[_0x7b64('0x86')],_0xb5cae6[_0x7b64('0x87')],_0xb5cae6[_0x7b64('0x88')]||_0x7b64('0x89'),_0xb5cae6[_0x7b64('0x59')],_0xb5cae6[_0x7b64('0x8a')]||_0x7b64('0x59'))[_0x7b64('0x13')](function(_0x40d118){_0xb3d6e9(null,_0x40d118);})[_0x7b64('0x15')](function(_0x4d089c){_0xb3d6e9(_0x4d089c);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x8b')]=function(_0x411eb1,_0x41269d){scripts[_0x7b64('0x8b')](this[_0x7b64('0x10')][_0x7b64('0x37')],_0x411eb1['aws_access_key_id'],_0x411eb1[_0x7b64('0x86')],_0x411eb1[_0x7b64('0x8c')],_0x411eb1[_0x7b64('0x59')],_0x411eb1[_0x7b64('0x8d')])[_0x7b64('0x13')](function(_0x3e06da){_0x41269d(null,_0x3e06da);})['catch'](function(_0x453ca8){_0x41269d(_0x453ca8);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x8e')]=function(_0x268c57,_0x3c96c9,_0x170321){scripts[_0x7b64('0x8e')](_0x3c96c9,_0x268c57['key'],_0x268c57[_0x7b64('0x8f')]||_0x7b64('0x7e'))[_0x7b64('0x13')](function(_0x4e8350){_0x170321(null,_0x4e8350);})[_0x7b64('0x15')](function(_0x1c0861){_0x170321(_0x1c0861);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x90')]=function(_0x32533b,_0x1363c2,_0x369d6d){scripts['tildeASR'](_0x1363c2,_0x32533b[_0x7b64('0x91')],_0x32533b['appsecret'],_0x32533b[_0x7b64('0x92')])[_0x7b64('0x13')](function(_0x1012d7){_0x369d6d(null,_0x1012d7);})[_0x7b64('0x15')](function(_0xa66a6a){_0x369d6d(_0xa66a6a);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x93')]=function(_0x54790a){var _0x385691=_['includes'](verticesWithRetry,_0x54790a['agicommand'])?_0x54790a:_[_0x7b64('0x94')](_0x54790a);for(var _0x119cf2 in _0x385691){if(_0x385691['hasOwnProperty'](_0x119cf2)){if(_0x385691[_0x119cf2]&&_[_0x7b64('0x95')](_0x385691[_0x119cf2])){if(_[_0x7b64('0x96')](recursiveMapAttributes,_0x119cf2)){_0x385691[_0x119cf2]=this[_0x7b64('0x97')](_0x385691[_0x119cf2]);}else{_0x385691[_0x119cf2]=this[_0x7b64('0x98')](_0x385691[_0x119cf2]);}}}}return _0x385691;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x99')]=function(_0x46c88c){for(var _0x2b8547 in _0x46c88c){if(_0x46c88c[_0x7b64('0x9a')](_0x2b8547)){if(_['isPlainObject'](_0x46c88c[_0x2b8547])){this[_0x7b64('0x99')](_0x46c88c[_0x2b8547]);}else if(_[_0x7b64('0x9b')](_0x46c88c[_0x2b8547])){for(var _0x563e09=0x0;_0x563e09<_0x46c88c[_0x2b8547][_0x7b64('0x9c')];_0x563e09++){this['recursiveNodeIndex'](_0x46c88c[_0x2b8547][_0x563e09]);}}else if(_[_0x7b64('0x95')](_0x46c88c[_0x2b8547])){_0x46c88c[_0x2b8547]=this['replaceAllVariables'](_0x46c88c[_0x2b8547]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0xabb851,_0x1d6d27){for(var _0x370cda in _0xabb851){if(_0xabb851[_0x7b64('0x9a')](_0x370cda)){if(_[_0x7b64('0x9d')](_0xabb851[_0x370cda])){if(!_['isEmpty'](_0xabb851[_0x370cda])){this[_0x7b64('0x9e')](_0xabb851[_0x370cda],util['format'](_0x7b64('0x9f'),_0x1d6d27,_0x370cda));}}else if(_[_0x7b64('0x9b')](_0xabb851[_0x370cda])){for(var _0x1480b0=0x0;_0x1480b0<_0xabb851[_0x370cda]['length'];_0x1480b0++){this[_0x7b64('0x9e')](_0xabb851[_0x370cda][_0x1480b0],util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x1d6d27,_0x370cda+'['+_0x1480b0+']'));}}else{if(!_[_0x7b64('0x45')](_0xabb851[_0x370cda])){this[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x1d6d27,_0x370cda),_0xabb851[_0x370cda]);}}}}};AGIVertices[_0x7b64('0x16')]['replaceObjectAllVariables']=function(_0x41e506){try{var _0x1761a9=JSON[_0x7b64('0x67')](_0x41e506);this['recursiveNodeIndex'](_0x1761a9);return JSON['stringify'](_0x1761a9);}catch(_0x40c378){return this[_0x7b64('0x98')](_0x41e506);}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x98')]=function(_0x8bc40f){var _0x5d06ce=_0x8bc40f[_0x7b64('0xa1')]('{');for(var _0x21c02e=0x1;_0x21c02e<_0x5d06ce[_0x7b64('0x9c')];_0x21c02e+=0x1){var _0x5c2b0f=_0x5d06ce[_0x21c02e][_0x7b64('0xa1')]('}');if(_0x5c2b0f[_0x7b64('0x9c')]>0x1){_0x8bc40f=_0x8bc40f[_0x7b64('0xa2')]('{'+_0x5c2b0f[0x0]+'}',this[_0x7b64('0x10')]['getVariable'](_0x5c2b0f[0x0])['extra']||_0x5c2b0f[0x0]);}}if(_0x5d06ce[_0x7b64('0x9c')]===0x1){return _0x8bc40f[_0x7b64('0xa3')]();}return this[_0x7b64('0x98')](_0x8bc40f);};AGIVertices['prototype']['getAndSetVariable']=function(_0x160708,_0x4d1a8b){var _0x5a0575=this[_0x7b64('0x10')][_0x7b64('0xa4')](_0x160708);if(_0x5a0575[_0x7b64('0xa5')]===-0x1){return _0x5a0575;}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x4d1a8b,_0x5a0575[_0x7b64('0xa6')]));return this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x4d1a8b,_0x5a0575[_0x7b64('0xa6')]);};AGIVertices[_0x7b64('0x16')]['isConfigured']=function(_0x381c1a){return _0x381c1a&&_0x381c1a!=='0'&&_0x381c1a!=='-1'&&_0x381c1a!=='';};AGIVertices[_0x7b64('0x16')][_0x7b64('0xa7')]=function(_0x71f120){this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x71f120,'-');_0x71f120[_0x7b64('0xaa')]=_0x71f120[_0x7b64('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7b64('0x16')][_0x7b64('0xab')]=function(_0x39bc65){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xac'),_0x39bc65['label']));if(!this[_0x7b64('0x82')](_0x39bc65[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}var _0x108d1a='\x22'+_0x39bc65[_0x7b64('0x59')]+'\x22';if(this[_0x7b64('0x82')](_0x39bc65[_0x7b64('0x73')])){_0x108d1a+=','+_0x39bc65[_0x7b64('0x73')];}var _0x1a4e3b=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb0'),_0x108d1a);if(_0x1a4e3b[_0x7b64('0xa5')]===-0x1){return _0x1a4e3b;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0xb1'),_0x108d1a));};AGIVertices[_0x7b64('0x16')]['mrcprecog']=function(_0x57153f){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xb2'),_0x57153f[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x57153f['grammar'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xb3'));}var _0x548847=_0x57153f[_0x7b64('0xb4')];if(this[_0x7b64('0x82')](_0x57153f[_0x7b64('0x73')])){_0x548847+=','+_0x57153f[_0x7b64('0x73')];}var _0x4f4fe8=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb5'),_0x548847);if(_0x4f4fe8[_0x7b64('0xa5')]===-0x1){return _0x4f4fe8;}var _0x438ea3=this[_0x7b64('0xb6')](_0x7b64('0xb7'),_0x7b64('0xb8'));if(_0x438ea3[_0x7b64('0xa5')]===-0x1){return _0x438ea3;}var _0x1e1568=this[_0x7b64('0xb6')](_0x7b64('0xb9'),'MRCP_RECOG_TRANSCRIPT');if(_0x1e1568[_0x7b64('0xa5')]===-0x1){return _0x1e1568;}var _0x4c0c6c=this[_0x7b64('0xb6')](_0x7b64('0xba'),'MRCP_RECOG_INSTANCE');if(_0x4c0c6c[_0x7b64('0xa5')]===-0x1){return _0x4c0c6c;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x548847));};AGIVertices[_0x7b64('0x16')]['agi']=function(_0x49f84e){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x49f84e[_0x7b64('0x38')]));return this[_0x7b64('0x10')]['agi']([_0x49f84e['command'],_0x49f84e['args']]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0xbb')]=function(_0x23b248){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0xbc'),_0x23b248['label']));if(this[_0x7b64('0x82')](_0x23b248['timeout'])){logger['info'](util['format'](_0x7b64('0xbd'),_0x23b248[_0x7b64('0x63')]));var _0x9a093=this[_0x7b64('0x10')][_0x7b64('0xbe')](_0x23b248[_0x7b64('0x63')]);if(_0x9a093[_0x7b64('0xa5')]===-0x1){return _0x9a093;}}return this['channel'][_0x7b64('0xbb')]();};AGIVertices[_0x7b64('0x16')][_0x7b64('0xbf')]=function(_0x4a5159){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xc0'),_0x4a5159[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4a5159[_0x7b64('0x49')])){return this[_0x7b64('0x10')]['error'](_0x4a5159,'no\x20list\x20selected');}_0x4a5159[_0x7b64('0x4a')]=moment();if(this[_0x7b64('0x82')](_0x4a5159[_0x7b64('0xc1')])){_0x4a5159[_0x7b64('0x4a')]=moment()[_0x7b64('0xc2')](_0x4a5159['delay'],_0x7b64('0xc3'));}if(!this[_0x7b64('0x82')](_0x4a5159[_0x7b64('0x4c')])){_0x4a5159['callback_priority']=0x2;}this['createCmContact']['sync'](this,_0x4a5159);return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xc4'),_0x4a5159['phone'],_0x4a5159['list_id'],_0x4a5159[_0x7b64('0x4a')]));};AGIVertices['prototype']['custom_app']=function(_0x33f819){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xc5'),_0x33f819[_0x7b64('0x38')]));var _0x2bcdb8=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x33f819[_0x7b64('0xc6')],_0x33f819[_0x7b64('0x73')]);if(_0x2bcdb8['result']===-0x1){return _0x2bcdb8;}return this['channel'][_0x7b64('0xad')](util['format'](_0x7b64('0xc7'),_0x33f819['application'],_0x33f819['options']));};AGIVertices[_0x7b64('0x16')]['lumenvoxtts']=function(_0x14f871){logger['info'](util[_0x7b64('0x29')](_0x7b64('0xc8'),_0x14f871[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x14f871['text'])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xae'));}var _0x5e4226='\x22'+_0x14f871['text']+'\x22';if(this[_0x7b64('0x82')](_0x14f871['options'])){_0x5e4226+=','+_0x14f871['options'];}var _0x3b7409=this['channel']['exec'](_0x7b64('0xb0'),_0x5e4226);if(_0x3b7409[_0x7b64('0xa5')]===-0x1){return _0x3b7409;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xb1'),_0x5e4226));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xc9')]=function(_0x1e9710){logger['info'](util[_0x7b64('0x29')](_0x7b64('0xca'),_0x1e9710[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x1e9710['text'])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20text\x20configured');}var _0xdf5026='\x22'+_0x1e9710['text']+'\x22';if(this[_0x7b64('0x82')](_0x1e9710[_0x7b64('0x73')])){_0xdf5026+=','+_0x1e9710[_0x7b64('0x73')];}var _0x44c450=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb0'),_0xdf5026);if(_0x44c450[_0x7b64('0xa5')]===-0x1){return _0x44c450;}return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0xdf5026));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xcb')]=function(_0x539aec){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x539aec[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x539aec[_0x7b64('0xb4')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xb3'));}var _0xbc6155=_0x539aec['grammar'];if(this[_0x7b64('0x82')](_0x539aec['options'])){_0xbc6155+=','+_0x539aec['options'];}var _0xb94da1=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb5'),_0xbc6155);if(_0xb94da1[_0x7b64('0xa5')]===-0x1){return _0xb94da1;}var _0x7fc3e4=this[_0x7b64('0xb6')](_0x7b64('0xb7'),_0x7b64('0xcc'));if(_0x7fc3e4[_0x7b64('0xa5')]===-0x1){return _0x7fc3e4;}var _0x48efbc=this['getAndSetVariable'](_0x7b64('0xb9'),_0x7b64('0xcd'));if(_0x48efbc[_0x7b64('0xa5')]===-0x1){return _0x48efbc;}var _0x5633bf=this[_0x7b64('0xb6')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x5633bf[_0x7b64('0xa5')]===-0x1){return _0x5633bf;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0xce'),_0xbc6155));};AGIVertices['prototype'][_0x7b64('0xcf')]=function(_0x3f8728){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xd0'),_0x3f8728[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x3f8728[_0x7b64('0xb4')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xb3'));}var _0x5e1aa9=_0x3f8728['grammar'];if(this['isConfigured'](_0x3f8728[_0x7b64('0x73')])){_0x5e1aa9+=','+_0x3f8728[_0x7b64('0x73')];}var _0x1fa92a=this[_0x7b64('0x10')][_0x7b64('0xaf')]('MRCPRecog',_0x5e1aa9);if(_0x1fa92a[_0x7b64('0xa5')]===-0x1){return _0x1fa92a;}var _0x5948fa=this[_0x7b64('0xb6')](_0x7b64('0xb7'),_0x7b64('0xd1'));if(_0x5948fa['result']===-0x1){return _0x5948fa;}var _0x2ab919=this[_0x7b64('0xb6')](_0x7b64('0xb9'),_0x7b64('0xd2'));if(_0x2ab919[_0x7b64('0xa5')]===-0x1){return _0x2ab919;}var _0x41a860=this['getAndSetVariable'](_0x7b64('0xba'),'SESTEK_ASR_INSTANCE');if(_0x41a860[_0x7b64('0xa5')]===-0x1){return _0x41a860;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xce'),_0x5e1aa9));};AGIVertices['prototype'][_0x7b64('0xd3')]=function(_0x5648f4){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xd4'),_0x5648f4[_0x7b64('0x38')]));if(!this['isConfigured'](_0x5648f4[_0x7b64('0xd5')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5648f4,_0x7b64('0xd6'));}var _0x2b4570=this['getSquareOdbc'][_0x7b64('0xa9')](this,_0x5648f4[_0x7b64('0xd5')]);if(!_0x2b4570){return this[_0x7b64('0x10')]['error'](_0x5648f4,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x5648f4[_0x7b64('0x30')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5648f4,_0x7b64('0xd7'));}var _0x5eddd8=_0x5648f4['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0xd8'),_0x5eddd8));var _0x3455e2=this[_0x7b64('0x2b')][_0x7b64('0xa9')](this,_0x2b4570,_0x5eddd8);this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x5648f4,_0x5eddd8);if(!this[_0x7b64('0x82')](_0x5648f4[_0x7b64('0xd9')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xda'));}var _0x48c575=this['getVariable'][_0x7b64('0xa9')](this,_0x5648f4['variable_id']);if(!_0x48c575){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5648f4,_0x7b64('0xdb'));}var _0x16b023=this;_0x3455e2[_0x7b64('0xdc')](function(_0x5b7091,_0x5c2235){Object[_0x7b64('0xdd')](_0x5b7091)[_0x7b64('0xdc')](function(_0x53fd8c){_0x16b023[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0xde'),_0x48c575,_0x5c2235,_0x53fd8c),_0x5b7091[_0x53fd8c]);});});this[_0x7b64('0x10')]['setVariable'](util[_0x7b64('0x29')]('%s_ROWS_COUNT',_0x48c575),_0x3455e2[_0x7b64('0x9c')]);return this['channel']['noop'](util[_0x7b64('0x29')](_0x7b64('0xdf'),_0x48c575));};AGIVertices['prototype']['dial']=function(_0xc9fe3f){logger[_0x7b64('0xe0')](util[_0x7b64('0x29')](_0x7b64('0xe1'),_0xc9fe3f[_0x7b64('0x38')]));if(!this['isConfigured'](_0xc9fe3f[_0x7b64('0xe2')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0xc9fe3f,_0x7b64('0xe3'));}var _0x32d040=this[_0x7b64('0xe4')][_0x7b64('0xa9')](this,_0xc9fe3f[_0x7b64('0xe2')]);if(!_0x32d040){return this[_0x7b64('0x10')]['error'](_0xc9fe3f,'no\x20user\x20found');}var _0x52c8b8=this[_0x7b64('0x10')]['exec'](_0x7b64('0xe5'),[util[_0x7b64('0x29')](_0x7b64('0xe6'),_0x32d040),_0xc9fe3f[_0x7b64('0x63')],_0xc9fe3f[_0x7b64('0xe7')],_0xc9fe3f['url']]);if(_0x52c8b8[_0x7b64('0xa5')]===-0x1){return _0x52c8b8;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xe8'),'DIAL'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xe9')]=function(_0x8fc78a){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xea'),_0x8fc78a[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x8fc78a[_0x7b64('0x75')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xeb'));}if(!this[_0x7b64('0x82')](_0x8fc78a[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this['createSquareDetailsReport'](_0x8fc78a);this[_0x7b64('0x42')](_0x8fc78a[_0x7b64('0x59')],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0xed'),_0x8fc78a['text']));var _0x4a7a44=this['googleDialogflow']['sync'](this,_0x8fc78a);if(_0x4a7a44){for(var _0x2e46a3 in _0x4a7a44){if(_0x4a7a44['hasOwnProperty'](_0x2e46a3)){this[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0xee'),_0x2e46a3[_0x7b64('0x66')]()),_0x4a7a44[_0x2e46a3]);}}this[_0x7b64('0x42')](_0x4a7a44[_0x7b64('0xef')],'out',_0x7b64('0xe9'),'');return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xf0'),_0x4a7a44['speech']));}return this['channel']['error'](_0x8fc78a,_0x7b64('0xf1'));};AGIVertices['prototype'][_0x7b64('0xf2')]=function(_0x4f76d7){logger['info'](util[_0x7b64('0x29')](_0x7b64('0xf3'),_0x4f76d7[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4f76d7['dialogflowV2_project_id'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xf4'));}if(!this[_0x7b64('0x82')](_0x4f76d7[_0x7b64('0x79')])){return this['channel']['noop'](_0x7b64('0xf5'));}if(!this['isConfigured'](_0x4f76d7[_0x7b64('0xf6')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xf7'));}if(!this[_0x7b64('0x82')](_0x4f76d7[_0x7b64('0x7a')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xf8'));}if(!this[_0x7b64('0x82')](_0x4f76d7['text'])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20text\x20configured');}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this[_0x7b64('0xa8')](_0x4f76d7);this[_0x7b64('0x42')](_0x4f76d7['text'],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xf9'),_0x4f76d7[_0x7b64('0x59')]));var _0x165312=this['googleDialogflowV2'][_0x7b64('0xa9')](this,_0x4f76d7);if(_0x165312){for(var _0x148356 in _0x165312){if(_0x165312[_0x7b64('0x9a')](_0x148356)){if(_0x148356!==_0x7b64('0xfa')){this['channel']['setVariable'](util[_0x7b64('0x29')]('DIALOGFLOW_%s',_0x148356['toUpperCase']()),_0x165312[_0x148356]);}}}this[_0x7b64('0x42')](_0x165312['speech'],_0x7b64('0xfb'),'dialogflowV2',_0x165312[_0x7b64('0xfa')]);return this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0xfc'),_0x165312[_0x7b64('0xef')]));}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4f76d7,_0x7b64('0xfd'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xfe')]=function(_0x2ae65){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x2ae65['label']));if(!this[_0x7b64('0x82')](_0x2ae65['ndauth_url'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xff'));}if(!this[_0x7b64('0x82')](_0x2ae65[_0x7b64('0x100')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x101'));}if(!this[_0x7b64('0x82')](_0x2ae65[_0x7b64('0x102')])){return this['channel'][_0x7b64('0xad')]('no\x20password\x20configured');}if(!this[_0x7b64('0x82')](_0x2ae65[_0x7b64('0x103')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this['createSquareDetailsReport'](_0x2ae65);this[_0x7b64('0x42')](_0x2ae65[_0x7b64('0x59')],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('Trying\x20SestekNDA:\x20%s',_0x2ae65[_0x7b64('0x59')]));var _0x4383c7=this['sestekNDA'][_0x7b64('0xa9')](this,_0x2ae65);if(_0x4383c7){for(var _0x308483 in _0x4383c7){if(_0x4383c7[_0x7b64('0x9a')](_0x308483)){this[_0x7b64('0x10')][_0x7b64('0xa0')](util['format']('SESTEK_NDA_%s',_0x308483[_0x7b64('0x66')]()),_0x4383c7[_0x308483]);}}this[_0x7b64('0x42')](_0x4383c7[_0x7b64('0xef')],'out',_0x7b64('0xfe'),'');if(_0x4383c7['audiofile']){this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x104'),_0x4383c7[_0x7b64('0x105')]));var _0x59b911=this[_0x7b64('0x10')]['streamFile'](_0x4383c7[_0x7b64('0x105')]);try{fs[_0x7b64('0x106')](_0x4383c7[_0x7b64('0x105')]+_0x7b64('0x107'));}catch(_0xecfee2){logger[_0x7b64('0x2c')](_0xecfee2);}return _0x59b911;}else{return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x108'),_0x4383c7['speech']));}}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x2ae65,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x7b64('0x16')]['end']=function(_0x5089c1){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x109'),_0x5089c1[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x10a'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x10b')]=function(_0x4a2250){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x4a2250['label']));var _0x54d2a2='';if(_0x4a2250['trunk_id']){if(!this['isConfigured'](_0x4a2250[_0x7b64('0x10c')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4a2250,_0x7b64('0x10d'));}else{var _0x166b40=parseInt(_0x4a2250[_0x7b64('0x10c')],0xa);if(isNaN(_0x166b40)){_0x54d2a2=_0x4a2250['trunk_id'];}else{_0x54d2a2=this[_0x7b64('0x1e')]['sync'](this,_0x4a2250[_0x7b64('0x10c')]);if(!_0x54d2a2){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4a2250,_0x7b64('0x10e'));}}}}else if(_0x4a2250['trunk_name']){_0x54d2a2=_0x4a2250[_0x7b64('0x10f')];}else{return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4a2250,_0x7b64('0x10d'));}var _0x155146=this[_0x7b64('0x10')][_0x7b64('0xaf')]('DIAL',[util[_0x7b64('0x29')](_0x7b64('0x110'),_0x54d2a2,_0x4a2250['phone']),_0x4a2250[_0x7b64('0x63')],_0x4a2250[_0x7b64('0xe7')],_0x4a2250[_0x7b64('0x60')]]);if(_0x155146[_0x7b64('0xa5')]===-0x1){return _0x155146;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0xe8'),_0x7b64('0xe5')));};AGIVertices[_0x7b64('0x16')]['finally']=function(_0x491c5a){logger[_0x7b64('0x2e')](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x491c5a[_0x7b64('0x38')]));return this['channel'][_0x7b64('0xad')](_0x7b64('0x111'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xe')]=function(_0x12274f){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x112'),_0x12274f['label']));if(_0x12274f[_0x7b64('0xaa')]===0x0){return this[_0x7b64('0xa7')](_0x12274f);}_0x12274f[_0x7b64('0xaa')]-=0x1;if(!this[_0x7b64('0x82')](_0x12274f[_0x7b64('0x113')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x12274f,_0x7b64('0x114'));}var _0x3a1911=this['getSound']['sync'](this,_0x12274f[_0x7b64('0x113')]);if(!_0x3a1911){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x12274f,_0x7b64('0x115'));}if(!this[_0x7b64('0x82')](_0x12274f[_0x7b64('0xd9')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x7b64('0xda'));}var _0x104b5e=this[_0x7b64('0x10')][_0x7b64('0x116')](_0x3a1911,_0x12274f[_0x7b64('0x117')],_0x12274f['maxdigit']);var _0x132d2a=_0x104b5e[_0x7b64('0xa5')]?_0x104b5e[_0x7b64('0xa5')][_0x7b64('0xa3')]():'';logger[_0x7b64('0x2e')](_0x7b64('0x118'),JSON[_0x7b64('0x6d')](_0x104b5e));if(_0x104b5e['result']===-0x1){this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x12274f,_0x132d2a);return _0x104b5e;}else if(_0x104b5e[_0x7b64('0xa6')]===_0x7b64('0x63')){_0x104b5e[_0x7b64('0xa5')]=_0x132d2a['length']>=parseInt(_0x12274f[_0x7b64('0x119')])?'x':'i';}else{_0x104b5e['result']=_0x132d2a[_0x7b64('0x9c')]>=parseInt(_0x12274f[_0x7b64('0x119')])&&_0x132d2a['length']<=parseInt(_0x12274f['maxdigit'])?'x':'i';}var _0x5c92dd=this['getVariable'][_0x7b64('0xa9')](this,_0x12274f[_0x7b64('0xd9')]);if(!_0x5c92dd){return this['channel'][_0x7b64('0x2c')](_0x12274f,_0x7b64('0xdb'));}this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x5c92dd,_0x132d2a);if(this[_0x7b64('0x82')](_0x12274f[_0x7b64('0x11a')])){var _0x14690d=parseInt(_0x12274f[_0x7b64('0x11a')],0xa);var _0xebdeda=rs['generate']({'charset':'*','length':_0x14690d});var _0x29cab3=_0x132d2a[_0x7b64('0x9c')];if(_0x29cab3>0x0){if(_0x29cab3>_0x14690d){this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x12274f,_0x12274f['hiddendigitspos']==='first'?_0xebdeda+_0x132d2a[_0x7b64('0x11b')](_0x14690d):_0x132d2a['substr'](0x0,_0x29cab3-_0x14690d)+_0xebdeda);}else{this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0x12274f,rs[_0x7b64('0x11c')]({'charset':'*','length':_0x29cab3}));}}else{this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x12274f,'');}}else{this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0x12274f,_0x132d2a);}return _0x104b5e;};AGIVertices[_0x7b64('0x16')]['getsecretdigits']=function(_0x535aba){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x11d'),_0x535aba[_0x7b64('0x38')]));return this[_0x7b64('0xe')](_0x535aba);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x11e')]=function(_0x4e5824){logger[_0x7b64('0x2e')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4e5824[_0x7b64('0x38')]));this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x4e5824,_0x4e5824[_0x7b64('0x11f')]);return this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x120'),_0x4e5824[_0x7b64('0x11f')]));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x121')]=function(_0x19cb0d){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x122'),_0x19cb0d['label']));if(!this[_0x7b64('0x82')](_0x19cb0d[_0x7b64('0x85')])||!this['isConfigured'](_0x19cb0d[_0x7b64('0x86')])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x7b64('0x82')](_0x19cb0d[_0x7b64('0x59')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x123'),_0x19cb0d['text']));var _0x5eb4b2=this[_0x7b64('0x84')][_0x7b64('0xa9')](this,_0x19cb0d);if(_0x5eb4b2){this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x5eb4b2));var _0x4a6a20=this[_0x7b64('0x10')][_0x7b64('0x124')](_0x5eb4b2);try{fs[_0x7b64('0x106')](_0x5eb4b2+_0x7b64('0x107'));}catch(_0x479ffb){logger['error'](_0x479ffb);}return _0x4a6a20;}return this['channel'][_0x7b64('0x2c')](_0x19cb0d,_0x7b64('0x125'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x126')]=function(_0x6bd02f){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x127'),_0x6bd02f[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x6bd02f['aws_access_key_id'])||!this['isConfigured'](_0x6bd02f[_0x7b64('0x86')])){return this['channel']['noop'](_0x7b64('0x128'));}if(!this['isConfigured'](_0x6bd02f[_0x7b64('0x8d')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x129'));}if(!this['isConfigured'](_0x6bd02f[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20text\x20configured');}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this[_0x7b64('0xa8')](_0x6bd02f);this['createSquareMessage'](_0x6bd02f[_0x7b64('0x59')],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x12a'),_0x6bd02f['text']));var _0x533940=this[_0x7b64('0x8b')][_0x7b64('0xa9')](this,_0x6bd02f);if(_0x533940){for(var _0x40e194 in _0x533940){if(_0x533940['hasOwnProperty'](_0x40e194)&&_[_0x7b64('0x95')](_0x533940[_0x40e194])){this[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0x12b'),_0x40e194['toUpperCase']()),_0x533940[_0x40e194]);}}if(_['isNil'](_0x533940[_0x7b64('0x71')])){return this[_0x7b64('0x10')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x7b64('0x42')](_0x533940[_0x7b64('0x71')],_0x7b64('0xfb'),'amazonlex','');return this[_0x7b64('0x10')]['noop'](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x533940[_0x7b64('0x71')]));}}return this[_0x7b64('0x10')]['error'](_0x6bd02f,_0x7b64('0x12c'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x12d')]=function(_0x134981){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x134981[_0x7b64('0x38')],_0x134981[_0x7b64('0x63')]));if(!this['isConfigured'](_0x134981['key'])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20key\x20configured');}var _0x4d8d69=_0x7b64('0x12e');var _0x2ce963=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1eed06=util['format'](_0x7b64('0x9f'),_0x2ce963,_0x4d8d69);var _0x32b3b6=!![];if(_0x134981[_0x7b64('0x12f')]===_0x7b64('0x130')){_0x32b3b6=![];}var _0x33dfe3=this['channel'][_0x7b64('0x131')](_0x2ce963,_0x4d8d69,_0x134981[_0x7b64('0x132')],_0x134981[_0x7b64('0x63')],undefined,_0x32b3b6);if(_0x33dfe3[_0x7b64('0xa5')]!==-0x1){this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x133'),_0x1eed06));var _0x2e6d30=this[_0x7b64('0x8e')]['sync'](this,_0x134981,_0x1eed06);if(_0x2e6d30){for(var _0x5a3e3b in _0x2e6d30){if(_0x2e6d30[_0x7b64('0x9a')](_0x5a3e3b)){this[_0x7b64('0x10')]['setVariable'](util[_0x7b64('0x29')]('GOOGLE_ASR_%s',_0x5a3e3b[_0x7b64('0x66')]()),_0x2e6d30[_0x5a3e3b]);}}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x134'),JSON[_0x7b64('0x6d')](_0x2e6d30)));}}return _0x33dfe3;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x135')]=function(_0x1b0a69){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x136'),_0x1b0a69['label']));if(!this[_0x7b64('0x82')](_0x1b0a69[_0x7b64('0x91')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x137'));}if(!this[_0x7b64('0x82')](_0x1b0a69[_0x7b64('0x138')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x139'));}var _0x342a12=_0x7b64('0x12e');var _0x4916dc=util[_0x7b64('0x29')](_0x7b64('0x13a'),FILES_PATH,rs[_0x7b64('0x11c')](0x4));var _0x36ab58=util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x4916dc,_0x342a12);var _0x4f9da6=!![];if(_0x1b0a69[_0x7b64('0x12f')]===_0x7b64('0x130')){_0x4f9da6=![];}var _0x120a65=this[_0x7b64('0x10')][_0x7b64('0x131')](_0x4916dc,_0x342a12,_0x1b0a69[_0x7b64('0x132')],_0x1b0a69[_0x7b64('0x63')],undefined,_0x4f9da6);if(_0x120a65[_0x7b64('0xa5')]!==-0x1){this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x13b'),_0x36ab58));var _0x2e8f75=this[_0x7b64('0x90')][_0x7b64('0xa9')](this,_0x1b0a69,_0x36ab58);if(_0x2e8f75){for(var _0x21b575 in _0x2e8f75){if(_0x2e8f75['hasOwnProperty'](_0x21b575)){this['channel'][_0x7b64('0xa0')](util['format'](_0x7b64('0x13c'),_0x21b575[_0x7b64('0x66')]()),_0x2e8f75[_0x21b575]);}}return this['channel']['noop'](util[_0x7b64('0x29')](_0x7b64('0x13d'),JSON[_0x7b64('0x6d')](_0x2e8f75)));}}return _0x120a65;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x13e')]=function(_0x1d65da){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x13f'),_0x1d65da[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0x140')](_0x1d65da[_0x7b64('0x3d')],_0x1d65da[_0x7b64('0x3e')],_0x1d65da[_0x7b64('0x3f')]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x141')]=function(_0x4341ed){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x142'),_0x4341ed[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4341ed[_0x7b64('0x143')])){return this[_0x7b64('0x10')]['error'](_0x4341ed,_0x7b64('0x144'));}try{var _0x5181f0=eval(_0x4341ed['condition'])?'true':'false';this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4341ed['condition'],_0x5181f0));return{'code':0xc8,'result':_0x5181f0};}catch(_0x5d22fd){return{'code':0xc8,'result':_0x7b64('0x145')};}};AGIVertices[_0x7b64('0x16')]['gotoiftime']=function(_0x4ad1a8){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x146'),_0x4ad1a8[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4ad1a8[_0x7b64('0x147')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4ad1a8,_0x7b64('0x148'));}var _0x137900=this[_0x7b64('0x25')][_0x7b64('0xa9')](this,_0x4ad1a8[_0x7b64('0x147')]);if(!_0x137900){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4ad1a8,'no\x20intervals\x20found');}for(var _0x45516b=0x0;_0x45516b<_0x137900[_0x7b64('0x9c')];_0x45516b+=0x1){var _0x2331a4=this[_0x7b64('0x10')][_0x7b64('0xa4')](util['format'](_0x7b64('0x149'),_0x137900[_0x45516b]));if(_0x2331a4[_0x7b64('0xa5')]===-0x1){return _0x2331a4;}logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x137900[_0x45516b],_0x2331a4[_0x7b64('0xa6')]));if(_0x2331a4[_0x7b64('0xa6')]===_0x7b64('0x14a')){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],_0x7b64('0x14a')));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],_0x7b64('0x14a')));return{'code':0xc8,'result':_0x7b64('0x14a')};}else{logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],'false'));this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],_0x7b64('0x145')));}}return{'code':0xc8,'result':_0x7b64('0x145')};};AGIVertices[_0x7b64('0x16')][_0x7b64('0x14c')]=function(_0x58aa62){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14d'),_0x58aa62['label']));return this['channel']['hangup']();};AGIVertices[_0x7b64('0x16')][_0x7b64('0x14e')]=function(_0x4ee634){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14f'),_0x4ee634[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4ee634[_0x7b64('0x75')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xeb'));}var _0x2a13f9=_0x7b64('0x12e');var _0x21752f=util[_0x7b64('0x29')](_0x7b64('0x13a'),FILES_PATH,rs['generate'](0x4));var _0x31dcd2=util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x21752f,_0x2a13f9);var _0x44e0ae=!![];if(_0x4ee634[_0x7b64('0x12f')]===_0x7b64('0x130')){_0x44e0ae=![];}var _0x28ab50=this[_0x7b64('0x10')][_0x7b64('0x131')](_0x21752f,_0x2a13f9,_0x4ee634[_0x7b64('0x132')],_0x4ee634[_0x7b64('0x63')],undefined,_0x44e0ae);if(_0x28ab50[_0x7b64('0xa5')]!==-0x1){this['channel']['noop'](util['format'](_0x7b64('0x150'),_0x31dcd2));var _0x1340e6=this[_0x7b64('0x80')][_0x7b64('0xa9')](this,_0x4ee634,_0x31dcd2);if(_0x1340e6){for(var _0x5134f3 in _0x1340e6){if(_0x1340e6[_0x7b64('0x9a')](_0x5134f3)){this[_0x7b64('0x10')]['setVariable'](util[_0x7b64('0x29')]('ISPEECH_ASR_%s',_0x5134f3[_0x7b64('0x66')]()),_0x1340e6[_0x5134f3]);}}return this[_0x7b64('0x10')][_0x7b64('0xad')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x7b64('0x6d')](_0x1340e6)));}}return _0x28ab50;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x151')]=function(_0x19c83a){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x152'),_0x19c83a[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x19c83a[_0x7b64('0x75')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xeb'));}if(!this['isConfigured'](_0x19c83a[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x153'),_0x19c83a[_0x7b64('0x59')]));var _0x1f7e21=this[_0x7b64('0x7c')][_0x7b64('0xa9')](this,_0x19c83a);if(_0x1f7e21){this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')]('ispeech\x20%s\x20file\x20created',_0x1f7e21));var _0x36ec06=this['channel'][_0x7b64('0x124')](_0x1f7e21,_0x19c83a['intKey']);try{fs[_0x7b64('0x106')](_0x1f7e21+'.wav');}catch(_0x1fb44b){logger['error'](_0x1fb44b);}return _0x36ec06;}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x19c83a,_0x7b64('0x154'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x155')]=function(_0x32cb74){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x156'),_0x32cb74[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x32cb74['findBy'])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x32cb74,'no\x20find\x20by\x20configured');}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x157'),this[_0x7b64('0x10')]['callerid'],_0x32cb74[_0x7b64('0x158')]));var _0xa3c52=this[_0x7b64('0x52')][_0x7b64('0xa9')](this,_0x32cb74['findBy']);if(_0xa3c52){logger['info'](util['format'](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74['findBy']));this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15a')};}else{logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74[_0x7b64('0x158')]));this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15c')};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x15d')]=function(_0x44146d){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x15e'),_0x44146d[_0x7b64('0x38')]));if(!this['isConfigured'](_0x44146d[_0x7b64('0x158')])){return this[_0x7b64('0x10')]['error'](_0x44146d,_0x7b64('0x15f'));}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x157'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x44146d[_0x7b64('0x158')]));var _0x237891=this[_0x7b64('0x51')][_0x7b64('0xa9')](this,_0x44146d['findBy']);if(_0x237891){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x159'),this[_0x7b64('0x10')]['callerid'],_0x44146d[_0x7b64('0x158')]));this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x44146d['findBy']));return{'code':0xc8,'result':_0x7b64('0x15a')};}else{logger['info'](util[_0x7b64('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7b64('0x10')]['callerid'],_0x44146d['findBy']));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x44146d['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x160')]=function(_0x560152){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x560152['label']));if(!this[_0x7b64('0x82')](_0x560152[_0x7b64('0x161')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x560152,'no\x20operation\x20configured');}this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x162'),_0x560152[_0x7b64('0x161')]));var _0x517a79=eval(_0x560152[_0x7b64('0x161')]);if(!this[_0x7b64('0x82')](_0x560152[_0x7b64('0xd9')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xda'));}var _0xdb98f3=this['getVariable'][_0x7b64('0xa9')](this,_0x560152[_0x7b64('0xd9')]);if(!_0xdb98f3){return this['channel'][_0x7b64('0x2c')](_0x560152,_0x7b64('0xdb'));}if(_[_0x7b64('0x9b')](_0x517a79)){var _0x54ff27=this;_0x517a79[_0x7b64('0xdc')](function(_0x4dfed7,_0x325235){_0x54ff27['channel'][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0x163'),_0xdb98f3,_0x325235),_0x4dfed7);});return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x164'),_0xdb98f3));}else{return this[_0x7b64('0x10')][_0x7b64('0xa0')](_0xdb98f3,_0x517a79);}};AGIVertices[_0x7b64('0x16')][_0x7b64('0xd')]=function(_0x40d0cc){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x165'),_0x40d0cc[_0x7b64('0x38')]));if(_0x40d0cc[_0x7b64('0xaa')]===0x0){return this[_0x7b64('0xa7')](_0x40d0cc);}_0x40d0cc[_0x7b64('0xaa')]-=0x1;if(!this['isConfigured'](_0x40d0cc[_0x7b64('0x113')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x40d0cc,_0x7b64('0x114'));}var _0x35aa14=this[_0x7b64('0x166')][_0x7b64('0xa9')](this,_0x40d0cc[_0x7b64('0x113')]);if(!_0x35aa14){return this['channel'][_0x7b64('0x2c')](_0x40d0cc,'no\x20file\x20audio\x20found');}var _0x82915b=this[_0x7b64('0x10')][_0x7b64('0x116')](_0x35aa14,_0x40d0cc[_0x7b64('0x117')],_0x40d0cc[_0x7b64('0x167')]);var _0xe51ed8=_0x82915b['result'];if(_0x82915b[_0x7b64('0xa5')]===-0x1){this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0x40d0cc,'-1');return _0x82915b;}else if(_0x82915b['extra']===_0x7b64('0x63')){_0x82915b[_0x7b64('0xa5')]=_0x82915b[_0x7b64('0xa5')][_0x7b64('0x9c')]>0x0?_0x82915b[_0x7b64('0xa5')]:'t';}else if(_[_0x7b64('0x44')](_0x82915b[_0x7b64('0xa5')])){_0x82915b[_0x7b64('0xa5')]='#';_0xe51ed8='#';}if(!this[_0x7b64('0x82')](_0x40d0cc['variable_id'])){this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x43a841=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x40d0cc[_0x7b64('0xd9')]);if(!_0x43a841){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x40d0cc,_0x7b64('0xdb'));}this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x43a841,_0xe51ed8);}this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x40d0cc,_0xe51ed8);return _0x82915b;};AGIVertices[_0x7b64('0x16')]['noop']=function(_0x360e5e){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x360e5e[_0x7b64('0x38')]));return this[_0x7b64('0x10')]['noop'](_0x360e5e[_0x7b64('0x168')]||_0x360e5e[_0x7b64('0x38')]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x169')]=function(_0x3b0d67){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x16a'),_0x3b0d67[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x3b0d67['findBy'])){return this[_0x7b64('0x10')]['error'](_0x3b0d67,_0x7b64('0x15f'));}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x157'),this[_0x7b64('0x10')]['callerid'],_0x3b0d67['findBy']));var _0x453cc6=this[_0x7b64('0x4d')]['sync'](this,_0x3b0d67[_0x7b64('0x16b')]);var _0x406309=this[_0x7b64('0x4e')][_0x7b64('0xa9')](this,_0x3b0d67[_0x7b64('0x158')],_0x453cc6);if(_0x406309){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x3b0d67[_0x7b64('0x158')]));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x3b0d67[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15a')};}else{logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x3b0d67[_0x7b64('0x158')]));this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x159'),this['channel'][_0x7b64('0x3a')],_0x3b0d67['findBy']));return{'code':0xc8,'result':_0x7b64('0x15c')};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x16c')]=function(_0x3f32ff){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3f32ff['label']));if(!this[_0x7b64('0x82')](_0x3f32ff[_0x7b64('0x113')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x3f32ff,_0x7b64('0x114'));}var _0x2031b7=this[_0x7b64('0x166')][_0x7b64('0xa9')](this,_0x3f32ff[_0x7b64('0x113')]);if(!_0x2031b7){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x3f32ff,_0x7b64('0x115'));}var _0x521030=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0x16d'),[_0x2031b7,_0x3f32ff[_0x7b64('0xe7')]]);if(_0x521030['result']===-0x1){return _0x521030;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x2031b7));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x16e')]=function(_0x845e8d){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x16f'),_0x845e8d[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x845e8d[_0x7b64('0x170')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x845e8d,_0x7b64('0x171'));}var _0x3f18dd='';var _0x393591=parseInt(_0x845e8d['queue_id'],0xa);if(isNaN(_0x393591)){_0x3f18dd=_0x845e8d[_0x7b64('0x170')];}else{_0x3f18dd=this[_0x7b64('0x172')]['sync'](this,_0x845e8d[_0x7b64('0x170')]);if(!_0x3f18dd){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x845e8d,_0x7b64('0x173'));}}var _0x1437a7='';if(this[_0x7b64('0x82')](_0x845e8d[_0x7b64('0x113')])){var _0x376a55=this[_0x7b64('0x166')]['sync'](this,_0x845e8d[_0x7b64('0x113')]);if(_0x376a55){_0x1437a7=_0x376a55;}}this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x845e8d,_0x3f18dd);if(_0x845e8d[_0x7b64('0xe7')][_0x7b64('0x174')]('x')<0x0){_0x845e8d[_0x7b64('0xe7')]+='x';}if(_0x845e8d[_0x7b64('0xe7')][_0x7b64('0x174')]('X')<0x0){_0x845e8d[_0x7b64('0xe7')]+='X';}this[_0x7b64('0x10')][_0x7b64('0xa0')]('XMCS-QUEUE',_0x3f18dd?_0x3f18dd[_0x7b64('0x175')]():'');var _0x1b7471=this[_0x7b64('0x10')]['exec'](_0x7b64('0x176'),[_0x3f18dd,_0x845e8d[_0x7b64('0xe7')],_0x845e8d[_0x7b64('0x60')],_0x1437a7,_0x845e8d[_0x7b64('0x63')],_0x845e8d[_0x7b64('0x8')],_0x845e8d[_0x7b64('0x177')],_0x845e8d[_0x7b64('0x178')],'',_0x845e8d[_0x7b64('0x179')]]);if(_0x1b7471[_0x7b64('0xa5')]===-0x1){return _0x1b7471;}return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20%s\x20%s',_0x7b64('0x176'),_0x3f18dd));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x17a')]=function(_0x4943e1){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4943e1['label']));var _0x408f5c=_0x4943e1[_0x7b64('0x17b')]||_0x7b64('0x12e');var _0x5d17e8=util[_0x7b64('0x29')](_0x7b64('0x17c'),this[_0x7b64('0x10')][_0x7b64('0x37')],rs[_0x7b64('0x11c')](0x5));var _0xfab296=util[_0x7b64('0x29')]('%s/recordings/%s.%s',FILES_PATH,_0x5d17e8,_0x408f5c);var _0x698637=util[_0x7b64('0x29')]('%s/recordings/%s',FILES_PATH,_0x5d17e8);this[_0x7b64('0x3b')]['sync'](this,_0x4943e1,_0x5d17e8,_0xfab296);this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x7b64('0x17d'),_0x5d17e8);logger[_0x7b64('0x2e')](_0x7b64('0x17e'),_0x698637,_0x408f5c,_0x4943e1[_0x7b64('0x17f')],_0x4943e1['timeout']);return this[_0x7b64('0x10')][_0x7b64('0x131')](_0x698637,_0x408f5c,_0x4943e1['escape_digits'],_0x4943e1[_0x7b64('0x63')],undefined,!![]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x180')]=function(_0x1e9b5b){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x181'),_0x1e9b5b[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x1e9b5b['url'])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0x182'));}var _0x3cd531=this['restAPI'][_0x7b64('0xa9')](this,_0x1e9b5b);logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x183'),util[_0x7b64('0x184')](_0x3cd531,{'showHidden':![],'depth':null})));if(!this[_0x7b64('0x82')](_0x1e9b5b[_0x7b64('0xd9')])){return this['channel'][_0x7b64('0xad')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x5a7fcb=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x1e9b5b['variable_id']);if(!_0x5a7fcb){return this[_0x7b64('0x10')]['error'](_0x1e9b5b,_0x7b64('0xdb'));}this['channel']['setVariable'](util[_0x7b64('0x29')](_0x7b64('0x185'),_0x5a7fcb),_0x3cd531['statusCode']?_0x3cd531['statusCode']:_0x7b64('0x186'));this[_0x7b64('0x10')][_0x7b64('0xa0')](util['format'](_0x7b64('0x187'),_0x5a7fcb),_0x3cd531[_0x7b64('0x70')]?_0x3cd531[_0x7b64('0x70')]:'OK');if(_0x3cd531[_0x7b64('0x6e')]){try{this[_0x7b64('0x9e')](_0x3cd531[_0x7b64('0x6e')],_0x5a7fcb);}catch(_0x4f0f42){logger[_0x7b64('0x2c')](util[_0x7b64('0x29')](_0x7b64('0x188'),_0x5a7fcb));}}return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xdf'),_0x5a7fcb));};AGIVertices[_0x7b64('0x16')]['saydigits']=function(_0x48db34){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x189'),_0x48db34[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0x18a')](_0x48db34[_0x7b64('0x18b')][_0x7b64('0x18c')](/\s+/g,''),_0x48db34['escape_digits']);};AGIVertices[_0x7b64('0x16')]['saynumber']=function(_0x3b8844){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x18d'),_0x3b8844['label']));return this[_0x7b64('0x10')][_0x7b64('0x18e')](_0x3b8844[_0x7b64('0x62')][_0x7b64('0x18c')](/\s+/g,''),_0x3b8844['escape_digits']);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x18f')]=function(_0x1ad60b){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x190'),_0x1ad60b['label']));return this[_0x7b64('0x10')][_0x7b64('0x191')](_0x1ad60b['text'],_0x1ad60b[_0x7b64('0x17f')]);};AGIVertices['prototype']['sendMail']=function(_0x380903){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x192'),_0x380903[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x380903[_0x7b64('0x193')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0x194'));}var _0x971ca9=this[_0x7b64('0x195')]['sync'](this,_0x380903[_0x7b64('0x193')]);if(!_0x971ca9||!_0x971ca9[_0x7b64('0x196')]){return this['channel'][_0x7b64('0x2c')](_0x380903,_0x7b64('0x197'));}var _0x22aa57={'from':util[_0x7b64('0x29')](_0x7b64('0x198'),_0x971ca9[_0x7b64('0x14')],_0x971ca9['email']||_0x971ca9[_0x7b64('0x196')][_0x7b64('0x199')]),'to':_0x380903['to']||'','cc':_0x380903['cc']||'','bcc':_0x380903['bcc']||'','subject':_0x380903[_0x7b64('0x19a')],'html':_0x380903[_0x7b64('0x59')],'text':_0x380903[_0x7b64('0x59')]};if(this[_0x7b64('0x82')](_0x380903[_0x7b64('0x19b')])){}logger['debug'](_0x7b64('0x19c'),JSON[_0x7b64('0x6d')](_0x22aa57));this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x380903,_0x380903[_0x7b64('0x193')]);this[_0x7b64('0x10')]['noop'](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x971ca9[_0x7b64('0x14')]));this['sendMailMessage'][_0x7b64('0xa9')](this,_0x971ca9[_0x7b64('0x19d')],_0x22aa57);return this[_0x7b64('0x10')]['noop'](_0x7b64('0x19e'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x19f')]=function(_0x5b9df1){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1a0'),_0x5b9df1[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0xad')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1a1')]=function(_0xc953c2){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1a2'),_0xc953c2['label']));if(!this[_0x7b64('0x82')](_0xc953c2[_0x7b64('0x1a3')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x1a4'));}var _0xf3729f=this[_0x7b64('0x34')][_0x7b64('0xa9')](this,_0xc953c2['sms_account_id']);if(!_0xf3729f){return this['channel'][_0x7b64('0x2c')](_0xc953c2,_0x7b64('0x1a5'));}var _0xb68e0b={'body':_0xc953c2[_0x7b64('0x1a6')],'phone':_0xc953c2['to']||'','SmsAccountId':_0xf3729f['id']};logger['debug'](_0x7b64('0x1a7'),JSON[_0x7b64('0x6d')](_0xb68e0b));this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0xc953c2,_0xc953c2[_0x7b64('0x1a3')]);this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1a8'),_0xf3729f[_0x7b64('0x14')]));this[_0x7b64('0x36')][_0x7b64('0xa9')](this,_0xb68e0b);return this[_0x7b64('0x10')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x7b64('0x1a9')]=function(_0xb1e261){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1aa'),_0xb1e261['label']));if(!this['isConfigured'](_0xb1e261[_0x7b64('0xd9')])){return this['channel']['error'](_0xb1e261,_0x7b64('0x1ab'));}var _0x316ecd=this['getVariable'][_0x7b64('0xa9')](this,_0xb1e261[_0x7b64('0xd9')]);if(!_0x316ecd){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0xb1e261,_0x7b64('0xdb'));}return this[_0x7b64('0x10')]['setVariable'](_0x316ecd,_0xb1e261['variable_value']);};AGIVertices[_0x7b64('0x16')]['start']=function(_0x2441d7){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1ac'),_0x2441d7[_0x7b64('0x38')]));this['channel'][_0x7b64('0xad')](_0x7b64('0x1ad'));var _0x5d4e46=this['channel'][_0x7b64('0xa4')](_0x7b64('0x1ae'));if(!_[_0x7b64('0x44')](_0x5d4e46[_0x7b64('0xa6')])){this['channel'][_0x7b64('0x37')]=_0x5d4e46[_0x7b64('0xa6')];}if(_0x2441d7['answer']==='yes'){this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x1af'));return this[_0x7b64('0x10')]['answer']();}return this['channel'][_0x7b64('0xad')](_0x7b64('0x1b0'));};AGIVertices[_0x7b64('0x16')]['subproject']=function(_0x7d47c8){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x1b1'),_0x7d47c8[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x7d47c8[_0x7b64('0x1b2')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x7d47c8,_0x7b64('0x1b3'));}var _0x3dce90=this[_0x7b64('0x1b4')][_0x7b64('0xa9')](this,_0x7d47c8['project_id']);if(!this['isConfigured'](_0x3dce90)){return this['channel'][_0x7b64('0x2c')](_0x7d47c8,util[_0x7b64('0x29')](_0x7b64('0x1b5'),_0x7d47c8['project_id']));}if(_0x3dce90===this['channel'][_0x7b64('0x39')]){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x7d47c8,_0x7b64('0x1b6'));}this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x7d47c8,_0x3dce90);var _0x15a1e2=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0x1b7'),util[_0x7b64('0x29')](_0x7b64('0x1b8'),config['agi'][_0x7b64('0x1b9')]||_0x7b64('0x1ba'),_0x3dce90,this[_0x7b64('0x10')]['arg_1']));if(_0x15a1e2[_0x7b64('0xa5')]===-0x1){return _0x15a1e2;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')]('Executed\x20command\x20%s\x20%s',_0x7b64('0x1b7'),_0x3dce90));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1bb')]=function(_0x9ab405){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1bc'),_0x9ab405['label']));var _0x4d7d11=this[_0x7b64('0x1bd')][_0x7b64('0xa9')](this,_0x9ab405[_0x7b64('0x1be')]);this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x9ab405,_0x9ab405[_0x7b64('0x1be')]);if(this[_0x7b64('0x82')](_0x9ab405[_0x7b64('0xd9')])){var _0x2ce64f=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x9ab405['variable_id']);if(_0x2ce64f){this['channel'][_0x7b64('0xa0')](_0x2ce64f,_0x4d7d11);return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1bf'),_0x9ab405[_0x7b64('0x1be')],_0x2ce64f));}}return this[_0x7b64('0x10')][_0x7b64('0xad')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x9ab405[_0x7b64('0x1be')]));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1c0')]=function(_0x3d7cd0){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3d7cd0[_0x7b64('0x38')]));_0x3d7cd0['text']=_0x3d7cd0[_0x7b64('0x59')][_0x7b64('0x18c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3d7cd0[_0x7b64('0x1c1')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0x1c2'));}if(!this['isConfigured'](_0x3d7cd0['text'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1c3'),_0x3d7cd0[_0x7b64('0x59')]));var _0x490e67=this['googleCloudTTS']['sync'](this,_0x3d7cd0);if(_0x490e67){this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1c4'),_0x490e67));var _0x308d80=this[_0x7b64('0x10')][_0x7b64('0x124')](_0x490e67);try{fs['unlink'](_0x490e67+'.wav');}catch(_0x31d4f8){logger[_0x7b64('0x2c')](_0x31d4f8);}return _0x308d80;}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x3d7cd0,_0x7b64('0x1c5'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1c6')]=function(_0x5abe72){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1c7'),_0x5abe72[_0x7b64('0x38')]));_0x5abe72[_0x7b64('0x59')]=_0x5abe72[_0x7b64('0x59')][_0x7b64('0x18c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5abe72[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this['channel'][_0x7b64('0xad')](util['format'](_0x7b64('0x1c8'),_0x5abe72['text']));var _0x5e3627=this[_0x7b64('0x5d')][_0x7b64('0xa9')](this,_0x5abe72);if(_0x5e3627){this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x1c9'),_0x5e3627));var _0x31ab17=this[_0x7b64('0x10')][_0x7b64('0x124')](_0x5e3627);try{fs[_0x7b64('0x106')](_0x5e3627+'.wav');}catch(_0x2562df){logger['error'](_0x2562df);}return _0x31ab17;}return this[_0x7b64('0x10')]['error'](_0x5abe72,_0x7b64('0x1ca'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1cb')]=function(_0x5c7ca4){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x1cc'),_0x5c7ca4['label']));if(!this[_0x7b64('0x82')](_0x5c7ca4['findBy'])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5c7ca4,_0x7b64('0x15f'));}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));var _0x374ad3=this[_0x7b64('0x4f')]['sync'](this,_0x5c7ca4[_0x7b64('0x158')]);if(_0x374ad3){logger[_0x7b64('0x2e')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15c')};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1cd')]=function(_0x1029a5){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1ce'),_0x1029a5[_0x7b64('0x38')]));var _0x1cf004=this[_0x7b64('0x10')]['exec'](_0x7b64('0x1cf'),[_0x1029a5[_0x7b64('0x1d0')],_0x1029a5['options']]);if(_0x1cf004['result']===-0x1){return _0x1cf004;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xc7'),_0x7b64('0x1cf'),_0x1029a5[_0x7b64('0x1d0')]));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1d1')]=function(_0x5e6351){logger['info'](util['format'](_0x7b64('0x1d2'),_0x5e6351[_0x7b64('0x38')]));if(!this['isConfigured'](_0x5e6351[_0x7b64('0xd9')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5e6351,'no\x20variable\x20selected');}var _0x4c6b93=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x5e6351[_0x7b64('0xd9')]);if(!_0x4c6b93){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5e6351,_0x7b64('0xdb'));}var _0x1e2749=this[_0x7b64('0x10')][_0x7b64('0xa4')](_0x4c6b93);return{'code':0xc8,'result':_0x1e2749[_0x7b64('0xa6')]?_0x1e2749['extra']:'-'};};String[_0x7b64('0x16')][_0x7b64('0xa2')]=function(_0x2f5db3,_0x54d4d2){return this['split'](_0x2f5db3)[_0x7b64('0x1d3')](_0x54d4d2);};module[_0x7b64('0x1d4')]=AGIVertices; \ No newline at end of file +var _0xf3cd=['SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','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','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','%s/recordings/%s','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','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','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','IntervalId','Intervals','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','agentPause','agentUnpause','agent','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','MP3','googleTTS','google_tts_language','url','timeout','number','POST','method','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','aws_polly_voice','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','agicommand','hasOwnProperty','isString','replaceAllVariables','isPlainObject','isArray','length','saveRestApiResult','setVariable','%s.%s','replaceObjectAllVariables','recursiveNodeIndex','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','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','delay','add','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','sestekasr'];(function(_0x41a7f9,_0x195088){var _0x4def25=function(_0x19bdf8){while(--_0x19bdf8){_0x41a7f9['push'](_0x41a7f9['shift']());}};_0x4def25(++_0x195088);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf3cd[_0x3947c9];return _0x2e7871;};'use strict';var fs=require('fs');var util=require(_0xdf3c('0x0'));var _=require(_0xdf3c('0x1'));var sh=require(_0xdf3c('0x2'));var odbc=require(_0xdf3c('0x3'))();var rs=require(_0xdf3c('0x4'));var moment=require(_0xdf3c('0x5'));var Mustache=require('mustache');var rp=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var scripts=require(_0xdf3c('0x9'));var FILES_PATH=_0xdf3c('0xa');var recursiveMapAttributes=[_0xdf3c('0xb'),_0xdf3c('0xc')];var verticesWithRetry=[_0xdf3c('0xd'),_0xdf3c('0xe'),'getsecretdigits'];var AGIVertices=function(_0x15705d,_0x52cf30,_0x52f855){this[_0xdf3c('0xf')]=_0x15705d;this[_0xdf3c('0x10')]=_0x52cf30;this['mailRpc']=_0x52f855;};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x12')]=function(_0x2d420c,_0x21a6e5){this[_0xdf3c('0x10')][_0xdf3c('0x13')](_0x2d420c)[_0xdf3c('0x14')](function(_0x32d2db){_0x21a6e5(null,_0x32d2db?_0x32d2db['name']:![]);})[_0xdf3c('0x15')](function(_0x166ae5){_0x21a6e5(_0x166ae5);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x16')]=function(_0x59e431,_0x2ae4ad){this[_0xdf3c('0x10')][_0xdf3c('0x17')](_0x59e431)['then'](function(_0x18aafa){_0x2ae4ad(null,_0x18aafa?_0x18aafa[_0xdf3c('0x18')]:![]);})[_0xdf3c('0x15')](function(_0x4274fd){_0x2ae4ad(_0x4274fd);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x19')]=function(_0x305ea5,_0x92008b){this[_0xdf3c('0x10')][_0xdf3c('0x1a')](_0x305ea5)['then'](function(_0x13b0e6){_0x92008b(null,_0x13b0e6?_0x13b0e6[_0xdf3c('0x18')]:![]);})[_0xdf3c('0x15')](function(_0x18d4ec){_0x92008b(_0x18d4ec);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1b')]=function(_0x16b02b,_0x3ee0af){this[_0xdf3c('0x10')][_0xdf3c('0x1c')](_0x16b02b)[_0xdf3c('0x14')](function(_0x3d14cc){_0x3ee0af(null,_0x3d14cc?_0x3d14cc[_0xdf3c('0x1d')]:![]);})['catch'](function(_0x4d620f){_0x3ee0af(_0x4d620f);});};AGIVertices[_0xdf3c('0x11')]['getUser']=function(_0x15776c,_0x40e7ec){this[_0xdf3c('0x10')][_0xdf3c('0x1e')](_0x15776c)[_0xdf3c('0x14')](function(_0x36ba1c){_0x40e7ec(null,_0x36ba1c?_0x36ba1c['name']:![]);})[_0xdf3c('0x15')](function(_0x213d75){_0x40e7ec(_0x213d75);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1f')]=function(_0x40032a,_0x3b5371){this[_0xdf3c('0x10')][_0xdf3c('0x20')](_0x40032a)[_0xdf3c('0x14')](function(_0x1adee4){_0x3b5371(null,_0x1adee4?_0x1adee4['name']:![]);})[_0xdf3c('0x15')](function(_0x153daa){_0x3b5371(_0x153daa);});};AGIVertices['prototype'][_0xdf3c('0x21')]=function(_0x59659e,_0x4eaced){var _0x508be9=this;this[_0xdf3c('0x10')][_0xdf3c('0x22')](_0x59659e)['then'](function(_0x5c3b5a){_0x4eaced(null,_0x5c3b5a?_0x508be9[_0xdf3c('0x23')](_0x5c3b5a[_0xdf3c('0x24')]):![]);})[_0xdf3c('0x15')](function(_0x1ccdd4){_0x4eaced(_0x1ccdd4);});};AGIVertices['prototype'][_0xdf3c('0x25')]=function(_0x2a2d94,_0x5386bf){this['rpc'][_0xdf3c('0x26')](_0x2a2d94)[_0xdf3c('0x14')](function(_0x36937e){_0x5386bf(null,_0x36937e?_0x36937e:![]);})['catch'](function(_0x2355f6){_0x5386bf(_0x2355f6);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x27')]=function(_0x10099e,_0x575ae1,_0xda0de0){this[_0xdf3c('0x28')]['sendMailMessage'](_0x10099e,_0x575ae1)[_0xdf3c('0x14')](function(){_0xda0de0(null);})[_0xdf3c('0x15')](function(_0x217a65){_0xda0de0(_0x217a65);});};AGIVertices[_0xdf3c('0x11')]['getIntervals']=function(_0x33632f,_0x360d5c){this[_0xdf3c('0x10')][_0xdf3c('0x29')](_0x33632f)['then'](function(_0x474564){if(_0x474564){if(_0x474564[_0xdf3c('0x2a')]){_0x360d5c(null,[_0x474564['interval']]);}else{_0x360d5c(null,_['map'](_0x474564[_0xdf3c('0x2b')],'interval'));}}else{_0x360d5c(null,![]);}})[_0xdf3c('0x15')](function(_0x5e8130){_0x360d5c(_0x5e8130);});};AGIVertices['prototype']['getSoundPath']=function(_0x44a478){return util[_0xdf3c('0x2c')](_0xdf3c('0x2d'),FILES_PATH,_0x44a478);};AGIVertices[_0xdf3c('0x11')]['getQueryOdbc']=function(_0x49f147,_0x3d8557,_0x49d0f0){odbc[_0xdf3c('0x2e')](_0x49f147,function(_0x17b502){if(_0x17b502){logger[_0xdf3c('0x2f')](_0xdf3c('0x30'),_0x17b502);_0x49d0f0(_0x17b502);}else{logger[_0xdf3c('0x31')](_0xdf3c('0x32'));odbc[_0xdf3c('0x33')](_0x3d8557,function(_0x809f3d,_0x398c76){if(_0x809f3d){logger['info'](_0xdf3c('0x34'),_0x3d8557);_0x49d0f0(_0x809f3d);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x3d8557);odbc[_0xdf3c('0x35')](function(_0x47f760){if(_0x47f760){logger[_0xdf3c('0x2f')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x47f760);}_0x49d0f0(null,_0x398c76);});}});}});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x36')]=function(_0x1c6dee,_0x1349a4){this[_0xdf3c('0x10')][_0xdf3c('0x37')](_0x1c6dee)[_0xdf3c('0x14')](function(_0x3d47fb){_0x1349a4(null,_0x3d47fb?_0x3d47fb:![]);})[_0xdf3c('0x15')](function(_0xa65478){_0x1349a4(_0xa65478);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x38')]=function(_0x57e0ab,_0x5be92d){this[_0xdf3c('0x10')]['createSmsMessage'](_0x57e0ab)[_0xdf3c('0x14')](function(_0x14d8e1){_0x5be92d(null,_0x14d8e1);})[_0xdf3c('0x15')](function(_0x328b18){_0x5be92d(_0x328b18);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x335c1b,_0x33edab,_0x106975){this['rpc'][_0xdf3c('0x39')]({'uniqueid':this[_0xdf3c('0xf')][_0xdf3c('0x3a')],'node':_0x335c1b[_0xdf3c('0x3b')],'application':_0x335c1b['agicommand'],'data':_0x33edab||null,'project_name':this[_0xdf3c('0xf')][_0xdf3c('0x3c')],'callerid':this[_0xdf3c('0xf')][_0xdf3c('0x3d')]})[_0xdf3c('0x14')](function(_0x55849e){if(_0x106975){_0x106975(null,_0x55849e);}})[_0xdf3c('0x15')](function(_0x286b72){if(_0x106975){_0x106975(_0x286b72);}});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x3e')]=function(_0x36962d,_0x344f1e,_0x555389,_0x4d6349){this[_0xdf3c('0x10')][_0xdf3c('0x3e')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0xdf3c('0xf')][_0xdf3c('0x3d')],'calleridname':this[_0xdf3c('0xf')][_0xdf3c('0x3f')],'context':this[_0xdf3c('0xf')][_0xdf3c('0x40')],'extension':this[_0xdf3c('0xf')][_0xdf3c('0x41')],'priority':this[_0xdf3c('0xf')]['priority'],'accountcode':this[_0xdf3c('0xf')][_0xdf3c('0x42')],'dnid':this[_0xdf3c('0xf')][_0xdf3c('0x43')],'projectName':this[_0xdf3c('0xf')][_0xdf3c('0x3c')],'saveName':_0x344f1e,'filename':_0x36962d[_0xdf3c('0x44')]||_0x344f1e,'savePath':_0x555389})['then'](function(_0x1751a8){_0x4d6349(null,_0x1751a8);})['catch'](function(_0xa4e137){_0x4d6349(_0xa4e137);});};AGIVertices['prototype'][_0xdf3c('0x45')]=function(_0x28144f,_0x2ec575,_0x94c5b9,_0x5eef94,_0x55da0f){this['rpc'][_0xdf3c('0x45')]({'uniqueid':this['channel'][_0xdf3c('0x3a')],'body':_0x28144f,'direction':_0x2ec575,'providerName':_0x94c5b9,'providerResponse':_0x5eef94})[_0xdf3c('0x14')](function(_0x446713){if(_0x55da0f){_0x55da0f(null,_0x446713);}})[_0xdf3c('0x15')](function(_0x3b17d9){if(_0x55da0f){_0x55da0f(_0x3b17d9);}});};AGIVertices['prototype']['createCmContact']=function(_0x2371aa,_0x27a541){this['rpc'][_0xdf3c('0x46')]({'firstName':_[_0xdf3c('0x47')](_0x2371aa[_0xdf3c('0x18')])||_[_0xdf3c('0x48')](_0x2371aa[_0xdf3c('0x18')])?_0xdf3c('0x49')+Math[_0xdf3c('0x4a')]():_0x2371aa['name'],'lastName':_['isEmpty'](_0x2371aa[_0xdf3c('0x4b')])||_[_0xdf3c('0x48')](_0x2371aa[_0xdf3c('0x4b')])?null:_0x2371aa[_0xdf3c('0x4b')],'phone':_0x2371aa[_0xdf3c('0x4c')],'ListId':_0x2371aa[_0xdf3c('0x4d')],'scheduledat':_0x2371aa[_0xdf3c('0x4e')],'callbackUniqueid':this[_0xdf3c('0xf')][_0xdf3c('0x3a')],'tags':_0xdf3c('0x4f'),'description':_0xdf3c('0x50')+_0x2371aa['scheduledAt'][_0xdf3c('0x51')](),'priority':_0x2371aa['callback_priority']})['then'](function(_0x5052d5){_0x27a541(null,_0x5052d5);})['catch'](function(_0x541c57){_0x27a541(_0x541c57);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x52')]=function(_0x5c53cd,_0x4257c4){this[_0xdf3c('0x10')]['getPauseById'](_0x5c53cd)[_0xdf3c('0x14')](function(_0x28f935){_0x4257c4(null,_0x28f935?_0x28f935[_0xdf3c('0x18')]:![]);})[_0xdf3c('0x15')](function(_0x396461){_0x4257c4(_0x396461);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x53')]=function(_0xdc859,_0x42efa2,_0xa05518){var _0x55e29b={'role':'agent'};_0x55e29b[_0xdc859]=this[_0xdf3c('0xf')][_0xdf3c('0x3d')];this[_0xdf3c('0x10')]['agentPause'](_0x55e29b,_0x42efa2,this[_0xdf3c('0xf')][_0xdf3c('0x3a')])[_0xdf3c('0x14')](function(_0x552264){_0xa05518(null,_[_0xdf3c('0x48')](_0x552264)?![]:!![]);})[_0xdf3c('0x15')](function(_0x5ca218){logger[_0xdf3c('0x2f')](_0x5ca218);_0xa05518(null,![]);});};AGIVertices['prototype'][_0xdf3c('0x54')]=function(_0x1b03e7,_0x163adc){var _0x3de07e={'role':_0xdf3c('0x55')};_0x3de07e[_0x1b03e7]=this[_0xdf3c('0xf')][_0xdf3c('0x3d')];this[_0xdf3c('0x10')][_0xdf3c('0x54')](_0x3de07e)[_0xdf3c('0x14')](function(_0x283be2){_0x163adc(null,_[_0xdf3c('0x48')](_0x283be2)?![]:!![]);})[_0xdf3c('0x15')](function(_0x206a18){logger[_0xdf3c('0x2f')](_0x206a18);_0x163adc(null,![]);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x56')]=function(_0x510538,_0x4dade5){var _0x2e8511={'role':_0xdf3c('0x55')};_0x2e8511[_0x510538]=this[_0xdf3c('0xf')]['callerid'];this[_0xdf3c('0x10')]['agentLogout'](_0x2e8511)['then'](function(_0x184952){_0x4dade5(null,_[_0xdf3c('0x48')](_0x184952)?![]:!![]);})[_0xdf3c('0x15')](function(_0x373a3e){logger[_0xdf3c('0x2f')](_0x373a3e);_0x4dade5(null,![]);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x57')]=function(_0x3ec03a,_0x3dbf6e){var _0x17b9b6={'role':_0xdf3c('0x55')};_0x17b9b6[_0x3ec03a]=this[_0xdf3c('0xf')][_0xdf3c('0x3d')];var _0x4be79a=_0x3ec03a!=_0xdf3c('0x58')?util[_0xdf3c('0x2c')](_0xdf3c('0x59'),_0xdf3c('0x5a'),this[_0xdf3c('0xf')]['callerid']):undefined;this[_0xdf3c('0x10')][_0xdf3c('0x57')](_0x17b9b6,_0x4be79a)[_0xdf3c('0x14')](function(_0x12d791){_0x3dbf6e(null,_[_0xdf3c('0x48')](_0x12d791)?![]:!![]);})[_0xdf3c('0x15')](function(_0x3c0a8d){logger[_0xdf3c('0x2f')](_0x3c0a8d);_0x3dbf6e(null,![]);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x5b')]=function(_0x55010b,_0xb867a1){sh[_0xdf3c('0x5c')](_[_0xdf3c('0x5d')](_0x55010b),function(_0x1de114,_0x165afb){var _0x128187=_0x165afb[_0xdf3c('0x5e')](/(\r\n|\n|\r)/gm,'');_0xb867a1(null,_0x128187);});};AGIVertices['prototype'][_0xdf3c('0x5f')]=function(_0x662fd5,_0x4e1b77){scripts['googleCloudTTS'](_0x662fd5[_0xdf3c('0x60')],_0x662fd5[_0xdf3c('0x61')]||_0xdf3c('0x62'),_0x662fd5[_0xdf3c('0x62')],_0x662fd5[_0xdf3c('0x63')]||_0xdf3c('0x64'),_0x662fd5[_0xdf3c('0x65')]||_0xdf3c('0x66'),_0x662fd5['audioEncoding']||_0xdf3c('0x67'))[_0xdf3c('0x14')](function(_0x41ab61){_0x4e1b77(null,_0x41ab61);})['catch'](function(_0x44a249){_0x4e1b77(_0x44a249);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x68')]=function(_0x4ff52a,_0x11c5a5){scripts[_0xdf3c('0x68')](_0x4ff52a[_0xdf3c('0x62')],_0x4ff52a[_0xdf3c('0x69')]||'en',0x1)[_0xdf3c('0x14')](function(_0x12f737){_0x11c5a5(null,_0x12f737);})['catch'](function(_0x50753f){_0x11c5a5(_0x50753f);});};AGIVertices['prototype']['restAPI']=function(_0x59c505,_0x2a4e4c){var _0x3f43a0={'uri':_0x59c505[_0xdf3c('0x6a')],'method':_0x59c505['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x59c505[_0xdf3c('0x6b')])===_0xdf3c('0x6c')&&parseInt(_0x59c505[_0xdf3c('0x6b')])>=0x1?parseInt(_0x59c505['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xdf3c('0x6d'),'PUT'],_0x3f43a0[_0xdf3c('0x6e')]['toUpperCase']())){try{_0x3f43a0[_0xdf3c('0x6f')]=_0x59c505[_0xdf3c('0xc')]?JSON[_0xdf3c('0x70')](_0x59c505[_0xdf3c('0xc')]):{};}catch(_0x5316ef){logger['error'](_0xdf3c('0x71'),_0x5316ef);}}try{_0x3f43a0[_0xdf3c('0x72')]=_0x59c505[_0xdf3c('0xb')]?JSON[_0xdf3c('0x70')](_0x59c505[_0xdf3c('0xb')]):{};}catch(_0xa5773a){logger['error'](_0xdf3c('0x73'),_0xa5773a);}if(_0x59c505['computedVariables']){try{var _0x40c8fc=require(_0x59c505[_0xdf3c('0x74')])[_0xdf3c('0x75')](this,_0x3f43a0);_0x3f43a0[_0xdf3c('0x76')]=Mustache[_0xdf3c('0x77')](_0x59c505['url'],_0x40c8fc,{},['$$','$$']);if(_0x3f43a0[_0xdf3c('0x72')]){_0x3f43a0[_0xdf3c('0x72')]=JSON[_0xdf3c('0x70')](Mustache['render'](JSON['stringify'](_0x3f43a0['headers']),_0x40c8fc,{},['$$','$$']));}if(_0x3f43a0['body']){_0x3f43a0[_0xdf3c('0x6f')]=JSON[_0xdf3c('0x70')](Mustache[_0xdf3c('0x77')](JSON[_0xdf3c('0x78')](_0x3f43a0[_0xdf3c('0x6f')]),_0x40c8fc,{},['$$','$$']));}}catch(_0x32573c){logger['error'](_0xdf3c('0x79'),_0x32573c);}}rp(_0x3f43a0)['then'](function(_0x42df23){var _0x389708={'statusCode':_0x42df23[_0xdf3c('0x7a')]||0xc8,'statusMessage':_0x42df23[_0xdf3c('0x7b')]||'OK','headers':_0x42df23[_0xdf3c('0x72')]||{},'body':_0x42df23[_0xdf3c('0x6f')]||{}};_0x2a4e4c(null,_0x389708);})[_0xdf3c('0x15')](function(_0x3eece1){var _0x32d09d={'statusCode':_0x3eece1[_0xdf3c('0x7a')]||0x1f4,'statusMessage':_0x3eece1[_0xdf3c('0x7c')]||_0xdf3c('0x7d'),'headers':_0x3eece1[_0xdf3c('0x7e')][_0xdf3c('0x72')]||{},'body':_0x3eece1['options'][_0xdf3c('0x6f')]||{}};_0x2a4e4c(null,_0x32d09d);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x7f')]=function(_0x137d9a,_0x5bbe5c){scripts[_0xdf3c('0x7f')](this[_0xdf3c('0xf')]['uniqueid'],_0x137d9a['key'],_0x137d9a[_0xdf3c('0x62')],_0x137d9a[_0xdf3c('0x80')]||'en')[_0xdf3c('0x14')](function(_0x1aaf8b){_0x5bbe5c(null,_0x1aaf8b);})[_0xdf3c('0x15')](function(_0x56fc77){_0x5bbe5c(_0x56fc77);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x81')]=function(_0x620c5f,_0x2b6d2b){scripts[_0xdf3c('0x81')](this[_0xdf3c('0xf')]['uniqueid'],_0x620c5f[_0xdf3c('0x82')],_0x620c5f[_0xdf3c('0x83')],_0x620c5f[_0xdf3c('0x84')],_0x620c5f[_0xdf3c('0x62')],_0x620c5f[_0xdf3c('0x85')]||'en')['then'](function(_0x4bedde){_0x2b6d2b(null,_0x4bedde);})['catch'](function(_0x3ff479){_0x2b6d2b(_0x3ff479);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x86')]=function(_0x3de4e6,_0x115f11){scripts[_0xdf3c('0x86')](this[_0xdf3c('0xf')],_0x3de4e6)[_0xdf3c('0x14')](function(_0x5c52e2){_0x115f11(null,_0x5c52e2);})[_0xdf3c('0x15')](function(_0x3eaddd){_0x115f11(_0x3eaddd);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x87')]=function(_0xf04b92,_0x46dd4e){scripts['ispeechTTS'](_0xf04b92[_0xdf3c('0x88')],_0xf04b92[_0xdf3c('0x62')],_0xf04b92['ispeech_tts_language']||'en-US',_0xf04b92[_0xdf3c('0x89')])['then'](function(_0x404e6e){_0x46dd4e(null,_0x404e6e);})[_0xdf3c('0x15')](function(_0x4e917f){_0x46dd4e(_0x4e917f);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x8a')]=function(_0x296fc0,_0x73d18a,_0xa326c9){scripts[_0xdf3c('0x8a')](_0x73d18a,_0x296fc0['key'],_0x296fc0[_0xdf3c('0x8b')]||_0xdf3c('0x64'),this[_0xdf3c('0x8c')](_0x296fc0[_0xdf3c('0x8d')])?_0x296fc0[_0xdf3c('0x8d')]:undefined)[_0xdf3c('0x14')](function(_0x3deacb){_0xa326c9(null,_0x3deacb);})['catch'](function(_0x5b1d3d){_0xa326c9(_0x5b1d3d);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x8e')]=function(_0x1f6f9b,_0x5b6419){scripts[_0xdf3c('0x8e')](_0x1f6f9b['aws_access_key_id'],_0x1f6f9b['aws_secret_access_key'],_0x1f6f9b[_0xdf3c('0x8f')],_0x1f6f9b[_0xdf3c('0x90')]||'Amy',_0x1f6f9b[_0xdf3c('0x62')],_0x1f6f9b['aws_text_type']||_0xdf3c('0x62'))['then'](function(_0x12b135){_0x5b6419(null,_0x12b135);})[_0xdf3c('0x15')](function(_0x284635){_0x5b6419(_0x284635);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x91')]=function(_0x87e942,_0x2790cd){scripts[_0xdf3c('0x91')](this[_0xdf3c('0xf')][_0xdf3c('0x3a')],_0x87e942[_0xdf3c('0x92')],_0x87e942[_0xdf3c('0x93')],_0x87e942[_0xdf3c('0x94')],_0x87e942[_0xdf3c('0x62')],_0x87e942['aws_bot_name'])[_0xdf3c('0x14')](function(_0x22bacf){_0x2790cd(null,_0x22bacf);})[_0xdf3c('0x15')](function(_0x5b959b){_0x2790cd(_0x5b959b);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x95')]=function(_0x32cd2f,_0x6e1899,_0x3da55b){scripts[_0xdf3c('0x95')](_0x6e1899,_0x32cd2f[_0xdf3c('0x88')],_0x32cd2f[_0xdf3c('0x96')]||_0xdf3c('0x64'))[_0xdf3c('0x14')](function(_0x258578){_0x3da55b(null,_0x258578);})['catch'](function(_0x3bc3c9){_0x3da55b(_0x3bc3c9);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x97')]=function(_0x9777ae,_0x70370c,_0x50b0f1){scripts[_0xdf3c('0x97')](_0x70370c,_0x9777ae[_0xdf3c('0x98')],_0x9777ae[_0xdf3c('0x99')],_0x9777ae[_0xdf3c('0x76')])[_0xdf3c('0x14')](function(_0xbe4411){_0x50b0f1(null,_0xbe4411);})['catch'](function(_0x6627){_0x50b0f1(_0x6627);});};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x9a')]=function(_0x23aa73){var _0x310f21=_[_0xdf3c('0x9b')](verticesWithRetry,_0x23aa73[_0xdf3c('0x9c')])?_0x23aa73:_['clone'](_0x23aa73);for(var _0x396b19 in _0x310f21){if(_0x310f21[_0xdf3c('0x9d')](_0x396b19)){if(_0x310f21[_0x396b19]&&_[_0xdf3c('0x9e')](_0x310f21[_0x396b19])){if(_[_0xdf3c('0x9b')](recursiveMapAttributes,_0x396b19)){_0x310f21[_0x396b19]=this['replaceObjectAllVariables'](_0x310f21[_0x396b19]);}else{_0x310f21[_0x396b19]=this[_0xdf3c('0x9f')](_0x310f21[_0x396b19]);}}}}return _0x310f21;};AGIVertices[_0xdf3c('0x11')]['recursiveNodeIndex']=function(_0x33c2ad){for(var _0x4a1bc4 in _0x33c2ad){if(_0x33c2ad[_0xdf3c('0x9d')](_0x4a1bc4)){if(_[_0xdf3c('0xa0')](_0x33c2ad[_0x4a1bc4])){this['recursiveNodeIndex'](_0x33c2ad[_0x4a1bc4]);}else if(_[_0xdf3c('0xa1')](_0x33c2ad[_0x4a1bc4])){for(var _0x106d32=0x0;_0x106d32<_0x33c2ad[_0x4a1bc4][_0xdf3c('0xa2')];_0x106d32++){this['recursiveNodeIndex'](_0x33c2ad[_0x4a1bc4][_0x106d32]);}}else if(_['isString'](_0x33c2ad[_0x4a1bc4])){_0x33c2ad[_0x4a1bc4]=this[_0xdf3c('0x9f')](_0x33c2ad[_0x4a1bc4]);}}}};AGIVertices['prototype'][_0xdf3c('0xa3')]=function(_0x82225d,_0x161604){for(var _0x91dd6e in _0x82225d){if(_0x82225d['hasOwnProperty'](_0x91dd6e)){if(_[_0xdf3c('0xa0')](_0x82225d[_0x91dd6e])){if(!_[_0xdf3c('0x47')](_0x82225d[_0x91dd6e])){this['saveRestApiResult'](_0x82225d[_0x91dd6e],util[_0xdf3c('0x2c')]('%s.%s',_0x161604,_0x91dd6e));}}else if(_[_0xdf3c('0xa1')](_0x82225d[_0x91dd6e])){for(var _0x1f1f09=0x0;_0x1f1f09<_0x82225d[_0x91dd6e]['length'];_0x1f1f09++){this['saveRestApiResult'](_0x82225d[_0x91dd6e][_0x1f1f09],util[_0xdf3c('0x2c')]('%s.%s',_0x161604,_0x91dd6e+'['+_0x1f1f09+']'));}}else{if(!_[_0xdf3c('0x48')](_0x82225d[_0x91dd6e])){this[_0xdf3c('0xf')][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')](_0xdf3c('0xa5'),_0x161604,_0x91dd6e),_0x82225d[_0x91dd6e]);}}}}};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xa6')]=function(_0x1d95d9){try{var _0x42ae0a=JSON[_0xdf3c('0x70')](_0x1d95d9);this[_0xdf3c('0xa7')](_0x42ae0a);return JSON['stringify'](_0x42ae0a);}catch(_0x4299d1){return this[_0xdf3c('0x9f')](_0x1d95d9);}};AGIVertices['prototype'][_0xdf3c('0x9f')]=function(_0x367e4d){var _0x21c508=_0x367e4d[_0xdf3c('0xa8')]('{');for(var _0x7e5769=0x1;_0x7e5769<_0x21c508[_0xdf3c('0xa2')];_0x7e5769+=0x1){var _0x5e92f0=_0x21c508[_0x7e5769][_0xdf3c('0xa8')]('}');if(_0x5e92f0['length']>0x1){_0x367e4d=_0x367e4d[_0xdf3c('0xa9')]('{'+_0x5e92f0[0x0]+'}',this[_0xdf3c('0xf')][_0xdf3c('0x12')](_0x5e92f0[0x0])[_0xdf3c('0xaa')]||_0x5e92f0[0x0]);}}if(_0x21c508[_0xdf3c('0xa2')]===0x1){return _0x367e4d[_0xdf3c('0x51')]();}return this['replaceAllVariables'](_0x367e4d);};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xab')]=function(_0x5b4e32,_0x2ad761){var _0x2501e4=this[_0xdf3c('0xf')][_0xdf3c('0x12')](_0x5b4e32);if(_0x2501e4[_0xdf3c('0xac')]===-0x1){return _0x2501e4;}logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0xad'),_0x2ad761,_0x2501e4['extra']));return this['channel'][_0xdf3c('0xa4')](_0x2ad761,_0x2501e4[_0xdf3c('0xaa')]);};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x8c')]=function(_0x47afe4){return _0x47afe4&&_0x47afe4!=='0'&&_0x47afe4!=='-1'&&_0x47afe4!=='';};AGIVertices['prototype'][_0xdf3c('0xae')]=function(_0x5c15d3){this[_0xdf3c('0x39')]['sync'](this,_0x5c15d3,'-');_0x5c15d3[_0xdf3c('0xaf')]=_0x5c15d3[_0xdf3c('0xae')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xdf3c('0x11')]['mrcpsynth']=function(_0x292798){logger[_0xdf3c('0x31')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x292798[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x292798[_0xdf3c('0x62')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xb1'));}var _0x1d76ed='\x22'+_0x292798['text']+'\x22';if(this['isConfigured'](_0x292798[_0xdf3c('0x7e')])){_0x1d76ed+=','+_0x292798[_0xdf3c('0x7e')];}var _0x2efe5b=this[_0xdf3c('0xf')][_0xdf3c('0x5c')](_0xdf3c('0xb2'),_0x1d76ed);if(_0x2efe5b[_0xdf3c('0xac')]===-0x1){return _0x2efe5b;}return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xb3'),_0x1d76ed));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xb4')]=function(_0x42a160){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0xb5'),_0x42a160[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x42a160['grammar'])){return this['channel'][_0xdf3c('0xb0')]('no\x20grammar\x20configured');}var _0x4c3df3=_0x42a160[_0xdf3c('0xb6')];if(this['isConfigured'](_0x42a160[_0xdf3c('0x7e')])){_0x4c3df3+=','+_0x42a160[_0xdf3c('0x7e')];}var _0x5e1366=this['channel']['exec'](_0xdf3c('0xb7'),_0x4c3df3);if(_0x5e1366[_0xdf3c('0xac')]===-0x1){return _0x5e1366;}var _0x11de00=this['getAndSetVariable'](_0xdf3c('0xb8'),'MRCP_RECOG_CONFIDENCE');if(_0x11de00[_0xdf3c('0xac')]===-0x1){return _0x11de00;}var _0x4ba88f=this['getAndSetVariable'](_0xdf3c('0xb9'),_0xdf3c('0xba'));if(_0x4ba88f[_0xdf3c('0xac')]===-0x1){return _0x4ba88f;}var _0x1aa490=this[_0xdf3c('0xab')](_0xdf3c('0xbb'),'MRCP_RECOG_INSTANCE');if(_0x1aa490['result']===-0x1){return _0x1aa490;}return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0xbc'),_0x4c3df3));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x8')]=function(_0x2d3f44){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x2d3f44['label']));return this[_0xdf3c('0xf')][_0xdf3c('0x8')]([_0x2d3f44[_0xdf3c('0xbd')],_0x2d3f44[_0xdf3c('0xbe')]]);};AGIVertices['prototype'][_0xdf3c('0xbf')]=function(_0x364b5e){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0xc0'),_0x364b5e[_0xdf3c('0x3b')]));if(this['isConfigured'](_0x364b5e[_0xdf3c('0x6b')])){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0xc1'),_0x364b5e[_0xdf3c('0x6b')]));var _0xe5f939=this['channel'][_0xdf3c('0xc2')](_0x364b5e[_0xdf3c('0x6b')]);if(_0xe5f939[_0xdf3c('0xac')]===-0x1){return _0xe5f939;}}return this[_0xdf3c('0xf')][_0xdf3c('0xbf')]();};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x4f')]=function(_0x12ffd3){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0xc3'),_0x12ffd3['label']));if(!this[_0xdf3c('0x8c')](_0x12ffd3[_0xdf3c('0x4d')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x12ffd3,_0xdf3c('0xc4'));}_0x12ffd3[_0xdf3c('0x4e')]=moment();if(this[_0xdf3c('0x8c')](_0x12ffd3[_0xdf3c('0xc5')])){_0x12ffd3[_0xdf3c('0x4e')]=moment()[_0xdf3c('0xc6')](_0x12ffd3[_0xdf3c('0xc5')],'minutes');}if(!this[_0xdf3c('0x8c')](_0x12ffd3[_0xdf3c('0xc7')])){_0x12ffd3['callback_priority']=0x2;}this[_0xdf3c('0x46')][_0xdf3c('0x75')](this,_0x12ffd3);return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util['format'](_0xdf3c('0xc8'),_0x12ffd3[_0xdf3c('0x4c')],_0x12ffd3[_0xdf3c('0x4d')],_0x12ffd3['scheduledAt']));};AGIVertices['prototype']['custom_app']=function(_0x157b7a){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0xc9'),_0x157b7a[_0xdf3c('0x3b')]));var _0x33132b=this[_0xdf3c('0xf')][_0xdf3c('0x5c')](_0x157b7a['application'],_0x157b7a[_0xdf3c('0x7e')]);if(_0x33132b['result']===-0x1){return _0x33132b;}return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xca'),_0x157b7a[_0xdf3c('0xcb')],_0x157b7a[_0xdf3c('0x7e')]));};AGIVertices['prototype'][_0xdf3c('0xcc')]=function(_0x116ac9){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0xcd'),_0x116ac9[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x116ac9['text'])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0xb1'));}var _0x138797='\x22'+_0x116ac9[_0xdf3c('0x62')]+'\x22';if(this[_0xdf3c('0x8c')](_0x116ac9[_0xdf3c('0x7e')])){_0x138797+=','+_0x116ac9[_0xdf3c('0x7e')];}var _0x5be97e=this['channel']['exec'](_0xdf3c('0xb2'),_0x138797);if(_0x5be97e[_0xdf3c('0xac')]===-0x1){return _0x5be97e;}return this['channel']['noop'](util[_0xdf3c('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x138797));};AGIVertices['prototype']['sestektts']=function(_0x3d8d41){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3d8d41[_0xdf3c('0x3b')]));if(!this['isConfigured'](_0x3d8d41[_0xdf3c('0x62')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xb1'));}var _0x119e04='\x22'+_0x3d8d41[_0xdf3c('0x62')]+'\x22';if(this[_0xdf3c('0x8c')](_0x3d8d41[_0xdf3c('0x7e')])){_0x119e04+=','+_0x3d8d41[_0xdf3c('0x7e')];}var _0x5a527a=this[_0xdf3c('0xf')][_0xdf3c('0x5c')]('MRCPSynth',_0x119e04);if(_0x5a527a[_0xdf3c('0xac')]===-0x1){return _0x5a527a;}return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x119e04));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xce')]=function(_0x3ea47d){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0xcf'),_0x3ea47d[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x3ea47d[_0xdf3c('0xb6')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xd0'));}var _0x2a4dbf=_0x3ea47d[_0xdf3c('0xb6')];if(this[_0xdf3c('0x8c')](_0x3ea47d[_0xdf3c('0x7e')])){_0x2a4dbf+=','+_0x3ea47d['options'];}var _0x3176cd=this[_0xdf3c('0xf')]['exec'](_0xdf3c('0xb7'),_0x2a4dbf);if(_0x3176cd[_0xdf3c('0xac')]===-0x1){return _0x3176cd;}var _0x162d56=this[_0xdf3c('0xab')]('RECOG_CONFIDENCE()',_0xdf3c('0xd1'));if(_0x162d56[_0xdf3c('0xac')]===-0x1){return _0x162d56;}var _0x5b25d7=this[_0xdf3c('0xab')](_0xdf3c('0xb9'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x5b25d7['result']===-0x1){return _0x5b25d7;}var _0x14b70a=this[_0xdf3c('0xab')](_0xdf3c('0xbb'),'LUMENVOX_ASR_INSTANCE');if(_0x14b70a[_0xdf3c('0xac')]===-0x1){return _0x14b70a;}return this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xbc'),_0x2a4dbf));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xd2')]=function(_0x27f90e){logger['info'](util[_0xdf3c('0x2c')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x27f90e[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x27f90e[_0xdf3c('0xb6')])){return this['channel'][_0xdf3c('0xb0')]('no\x20grammar\x20configured');}var _0x3cba40=_0x27f90e[_0xdf3c('0xb6')];if(this['isConfigured'](_0x27f90e[_0xdf3c('0x7e')])){_0x3cba40+=','+_0x27f90e[_0xdf3c('0x7e')];}var _0x2c3655=this[_0xdf3c('0xf')]['exec'](_0xdf3c('0xb7'),_0x3cba40);if(_0x2c3655[_0xdf3c('0xac')]===-0x1){return _0x2c3655;}var _0xa61c3f=this[_0xdf3c('0xab')](_0xdf3c('0xb8'),_0xdf3c('0xd3'));if(_0xa61c3f[_0xdf3c('0xac')]===-0x1){return _0xa61c3f;}var _0x5a0ad8=this[_0xdf3c('0xab')](_0xdf3c('0xb9'),_0xdf3c('0xd4'));if(_0x5a0ad8[_0xdf3c('0xac')]===-0x1){return _0x5a0ad8;}var _0x16d755=this[_0xdf3c('0xab')](_0xdf3c('0xbb'),_0xdf3c('0xd5'));if(_0x16d755[_0xdf3c('0xac')]===-0x1){return _0x16d755;}return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util['format'](_0xdf3c('0xbc'),_0x3cba40));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xd6')]=function(_0x4e822b){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0xd7'),_0x4e822b[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x4e822b['odbc_id'])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x4e822b,'no\x20database\x20selected');}var _0x2a0943=this[_0xdf3c('0x1b')][_0xdf3c('0x75')](this,_0x4e822b[_0xdf3c('0xd8')]);if(!_0x2a0943){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x4e822b,_0xdf3c('0xd9'));}if(!this[_0xdf3c('0x8c')](_0x4e822b[_0xdf3c('0x33')])){return this['channel'][_0xdf3c('0x2f')](_0x4e822b,_0xdf3c('0xda'));}var _0x4fcb83=_0x4e822b[_0xdf3c('0x33')][_0xdf3c('0x5e')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0xdb'),_0x4fcb83));var _0x2c6ae1=this[_0xdf3c('0xdc')][_0xdf3c('0x75')](this,_0x2a0943,_0x4fcb83);this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x4e822b,_0x4fcb83);if(!this[_0xdf3c('0x8c')](_0x4e822b['variable_id'])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xdd'));}var _0x28bc25=this['getVariable'][_0xdf3c('0x75')](this,_0x4e822b[_0xdf3c('0xde')]);if(!_0x28bc25){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x4e822b,'no\x20variable\x20found');}var _0x42d291=this;_0x2c6ae1[_0xdf3c('0xdf')](function(_0x1c3c6d,_0x58bc3a){Object['keys'](_0x1c3c6d)[_0xdf3c('0xdf')](function(_0xcaea00){_0x42d291[_0xdf3c('0xf')]['setVariable'](util[_0xdf3c('0x2c')](_0xdf3c('0xe0'),_0x28bc25,_0x58bc3a,_0xcaea00),_0x1c3c6d[_0xcaea00]);});});this[_0xdf3c('0xf')][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')]('%s_ROWS_COUNT',_0x28bc25),_0x2c6ae1['length']);return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0xe1'),_0x28bc25));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xe2')]=function(_0x3b55c2){logger[_0xdf3c('0xe3')](util['format'](_0xdf3c('0xe4'),_0x3b55c2[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x3b55c2[_0xdf3c('0xe5')])){return this['channel'][_0xdf3c('0x2f')](_0x3b55c2,_0xdf3c('0xe6'));}var _0x234c08=this['getUser']['sync'](this,_0x3b55c2[_0xdf3c('0xe5')]);if(!_0x234c08){return this[_0xdf3c('0xf')]['error'](_0x3b55c2,_0xdf3c('0xe7'));}var _0x5eebe3=this[_0xdf3c('0xf')][_0xdf3c('0x5c')](_0xdf3c('0xe8'),[util[_0xdf3c('0x2c')](_0xdf3c('0xe9'),_0x234c08),_0x3b55c2[_0xdf3c('0x6b')],_0x3b55c2['opts'],_0x3b55c2[_0xdf3c('0x6a')]]);if(_0x5eebe3[_0xdf3c('0xac')]===-0x1){return _0x5eebe3;}return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xea'),_0xdf3c('0xe8')));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xeb')]=function(_0x127bfb){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0xec'),_0x127bfb[_0xdf3c('0x3b')]));if(!this['isConfigured'](_0x127bfb[_0xdf3c('0x88')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xed'));}if(!this[_0xdf3c('0x8c')](_0x127bfb['text'])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xb1'));}this[_0xdf3c('0xf')][_0xdf3c('0xee')]=!![];this[_0xdf3c('0x39')](_0x127bfb);this[_0xdf3c('0x45')](_0x127bfb[_0xdf3c('0x62')],'in','','');this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xef'),_0x127bfb[_0xdf3c('0x62')]));var _0x4c7e12=this[_0xdf3c('0x7f')][_0xdf3c('0x75')](this,_0x127bfb);if(_0x4c7e12){for(var _0x5a1c3a in _0x4c7e12){if(_0x4c7e12[_0xdf3c('0x9d')](_0x5a1c3a)){this[_0xdf3c('0xf')][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')](_0xdf3c('0xf0'),_0x5a1c3a[_0xdf3c('0xf1')]()),_0x4c7e12[_0x5a1c3a]);}}this[_0xdf3c('0x45')](_0x4c7e12[_0xdf3c('0xf2')],_0xdf3c('0xf3'),_0xdf3c('0xeb'),'');return this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')]('Dialogflow\x20Result\x20%s',_0x4c7e12[_0xdf3c('0xf2')]));}return this['channel'][_0xdf3c('0x2f')](_0x127bfb,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xdf3c('0x11')]['dialogflowV2']=function(_0x474b7f){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0xf4'),_0x474b7f[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x474b7f[_0xdf3c('0x82')])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0xf5'));}if(!this[_0xdf3c('0x8c')](_0x474b7f[_0xdf3c('0x83')])){return this['channel'][_0xdf3c('0xb0')](_0xdf3c('0xf6'));}if(!this[_0xdf3c('0x8c')](_0x474b7f[_0xdf3c('0x84')])){return this['channel']['noop']('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x474b7f[_0xdf3c('0x85')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xf7'));}if(!this[_0xdf3c('0x8c')](_0x474b7f[_0xdf3c('0x62')])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0xb1'));}this['channel'][_0xdf3c('0xee')]=!![];this[_0xdf3c('0x39')](_0x474b7f);this[_0xdf3c('0x45')](_0x474b7f[_0xdf3c('0x62')],'in','','');this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xf8'),_0x474b7f['text']));var _0xc2698=this[_0xdf3c('0x81')][_0xdf3c('0x75')](this,_0x474b7f);if(_0xc2698){for(var _0x75285d in _0xc2698){if(_0xc2698[_0xdf3c('0x9d')](_0x75285d)){if(_0x75285d!=='providerResponse'){this['channel'][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')](_0xdf3c('0xf0'),_0x75285d[_0xdf3c('0xf1')]()),_0xc2698[_0x75285d]);}}}this[_0xdf3c('0x45')](_0xc2698[_0xdf3c('0xf2')],_0xdf3c('0xf3'),_0xdf3c('0xf9'),_0xc2698[_0xdf3c('0xfa')]);return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util['format'](_0xdf3c('0xfb'),_0xc2698[_0xdf3c('0xf2')]));}return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x474b7f,_0xdf3c('0xfc'));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xfd')]=function(_0x4e8ad8){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0xfe'),_0x4e8ad8['label']));if(!this[_0xdf3c('0x8c')](_0x4e8ad8[_0xdf3c('0xff')])){return this['channel']['noop'](_0xdf3c('0x100'));}if(!this[_0xdf3c('0x8c')](_0x4e8ad8[_0xdf3c('0x101')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')]('no\x20username\x20configured');}if(!this[_0xdf3c('0x8c')](_0x4e8ad8[_0xdf3c('0x102')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0x103'));}if(!this['isConfigured'](_0x4e8ad8[_0xdf3c('0x104')])){return this['channel'][_0xdf3c('0xb0')]('no\x20text\x20configured');}this['channel'][_0xdf3c('0xee')]=!![];this[_0xdf3c('0x39')](_0x4e8ad8);this[_0xdf3c('0x45')](_0x4e8ad8[_0xdf3c('0x62')],'in','','');this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0x105'),_0x4e8ad8['text']));var _0xc68c84=this[_0xdf3c('0x86')][_0xdf3c('0x75')](this,_0x4e8ad8);if(_0xc68c84){for(var _0x386a3b in _0xc68c84){if(_0xc68c84[_0xdf3c('0x9d')](_0x386a3b)){this['channel'][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')](_0xdf3c('0x106'),_0x386a3b[_0xdf3c('0xf1')]()),_0xc68c84[_0x386a3b]);}}this[_0xdf3c('0x45')](_0xc68c84['speech'],_0xdf3c('0xf3'),_0xdf3c('0xfd'),'');if(_0xc68c84[_0xdf3c('0x107')]){this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x108'),_0xc68c84[_0xdf3c('0x107')]));var _0xb2e933=this[_0xdf3c('0xf')][_0xdf3c('0x109')](_0xc68c84[_0xdf3c('0x107')]);try{fs[_0xdf3c('0x10a')](_0xc68c84[_0xdf3c('0x107')]+_0xdf3c('0x10b'));}catch(_0x2be6c7){logger[_0xdf3c('0x2f')](_0x2be6c7);}return _0xb2e933;}else{return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0x10c'),_0xc68c84[_0xdf3c('0xf2')]));}}return this['channel'][_0xdf3c('0x2f')](_0x4e8ad8,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xdf3c('0x11')]['end']=function(_0x425ddb){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x10d'),_0x425ddb[_0xdf3c('0x3b')]));return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0x10e'));};AGIVertices[_0xdf3c('0x11')]['ext_dial']=function(_0x3ef6db){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x10f'),_0x3ef6db['label']));var _0x5d5945='';if(_0x3ef6db[_0xdf3c('0x110')]){if(!this[_0xdf3c('0x8c')](_0x3ef6db[_0xdf3c('0x110')])){return this[_0xdf3c('0xf')]['error'](_0x3ef6db,_0xdf3c('0x111'));}else{var _0x5bc20a=parseInt(_0x3ef6db['trunk_id'],0xa);if(isNaN(_0x5bc20a)){_0x5d5945=_0x3ef6db[_0xdf3c('0x110')];}else{_0x5d5945=this[_0xdf3c('0x1f')]['sync'](this,_0x3ef6db[_0xdf3c('0x110')]);if(!_0x5d5945){return this[_0xdf3c('0xf')]['error'](_0x3ef6db,_0xdf3c('0x112'));}}}}else if(_0x3ef6db[_0xdf3c('0x113')]){_0x5d5945=_0x3ef6db['trunk_name'];}else{return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x3ef6db,_0xdf3c('0x111'));}var _0x41796d=this[_0xdf3c('0xf')][_0xdf3c('0x5c')]('DIAL',[util['format'](_0xdf3c('0x114'),_0x5d5945,_0x3ef6db[_0xdf3c('0x4c')]),_0x3ef6db[_0xdf3c('0x6b')],_0x3ef6db[_0xdf3c('0x115')],_0x3ef6db[_0xdf3c('0x6a')]]);if(_0x41796d[_0xdf3c('0xac')]===-0x1){return _0x41796d;}return this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xea'),_0xdf3c('0xe8')));};AGIVertices['prototype'][_0xdf3c('0x116')]=function(_0x324940){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x117'),_0x324940[_0xdf3c('0x3b')]));return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0x116'));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xe')]=function(_0x216d47){logger['info'](util['format'](_0xdf3c('0x118'),_0x216d47[_0xdf3c('0x3b')]));if(_0x216d47[_0xdf3c('0xaf')]===0x0){return this[_0xdf3c('0xae')](_0x216d47);}_0x216d47[_0xdf3c('0xaf')]-=0x1;if(!this[_0xdf3c('0x8c')](_0x216d47[_0xdf3c('0x119')])){return this[_0xdf3c('0xf')]['error'](_0x216d47,_0xdf3c('0x11a'));}var _0x4765d2=this['getSound'][_0xdf3c('0x75')](this,_0x216d47[_0xdf3c('0x119')]);if(!_0x4765d2){return this['channel'][_0xdf3c('0x2f')](_0x216d47,'no\x20file\x20audio\x20found');}if(!this[_0xdf3c('0x8c')](_0x216d47[_0xdf3c('0xde')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4ae409=this['channel'][_0xdf3c('0x11b')](_0x4765d2,_0x216d47[_0xdf3c('0x11c')],_0x216d47[_0xdf3c('0x11d')]);var _0x22cb17=_0x4ae409[_0xdf3c('0xac')]?_0x4ae409[_0xdf3c('0xac')][_0xdf3c('0x51')]():'';logger['info'](_0xdf3c('0x11e'),JSON[_0xdf3c('0x78')](_0x4ae409));if(_0x4ae409['result']===-0x1){this[_0xdf3c('0x39')]['sync'](this,_0x216d47,_0x22cb17);return _0x4ae409;}else if(_0x4ae409[_0xdf3c('0xaa')]===_0xdf3c('0x6b')){_0x4ae409[_0xdf3c('0xac')]=_0x22cb17['length']>=parseInt(_0x216d47[_0xdf3c('0x11f')])?'x':'i';}else{_0x4ae409[_0xdf3c('0xac')]=_0x22cb17[_0xdf3c('0xa2')]>=parseInt(_0x216d47[_0xdf3c('0x11f')])&&_0x22cb17[_0xdf3c('0xa2')]<=parseInt(_0x216d47['maxdigit'])?'x':'i';}var _0xa16b7f=this[_0xdf3c('0x12')][_0xdf3c('0x75')](this,_0x216d47[_0xdf3c('0xde')]);if(!_0xa16b7f){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x216d47,_0xdf3c('0x120'));}this['channel'][_0xdf3c('0xa4')](_0xa16b7f,_0x22cb17);if(this[_0xdf3c('0x8c')](_0x216d47[_0xdf3c('0x121')])){var _0x4ecd66=parseInt(_0x216d47[_0xdf3c('0x121')],0xa);var _0x58dd62=rs[_0xdf3c('0x122')]({'charset':'*','length':_0x4ecd66});var _0x42d103=_0x22cb17['length'];if(_0x42d103>0x0){if(_0x42d103>_0x4ecd66){this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x216d47,_0x216d47[_0xdf3c('0x123')]===_0xdf3c('0x124')?_0x58dd62+_0x22cb17[_0xdf3c('0x125')](_0x4ecd66):_0x22cb17[_0xdf3c('0x125')](0x0,_0x42d103-_0x4ecd66)+_0x58dd62);}else{this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x216d47,rs[_0xdf3c('0x122')]({'charset':'*','length':_0x42d103}));}}else{this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x216d47,'');}}else{this[_0xdf3c('0x39')]['sync'](this,_0x216d47,_0x22cb17);}return _0x4ae409;};AGIVertices[_0xdf3c('0x11')]['getsecretdigits']=function(_0x57e693){logger['info'](util['format'](_0xdf3c('0x126'),_0x57e693[_0xdf3c('0x3b')]));return this[_0xdf3c('0xe')](_0x57e693);};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x127')]=function(_0x3f44b7){logger['info'](util[_0xdf3c('0x2c')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x3f44b7[_0xdf3c('0x3b')]));this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x3f44b7,_0x3f44b7[_0xdf3c('0x128')]);return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x129'),_0x3f44b7[_0xdf3c('0x128')]));};AGIVertices['prototype'][_0xdf3c('0x12a')]=function(_0x258b2d){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x258b2d['label']));if(!this[_0xdf3c('0x8c')](_0x258b2d[_0xdf3c('0x92')])||!this[_0xdf3c('0x8c')](_0x258b2d[_0xdf3c('0x93')])){return this['channel'][_0xdf3c('0xb0')](_0xdf3c('0x12b'));}if(!this[_0xdf3c('0x8c')](_0x258b2d[_0xdf3c('0x62')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xb1'));}this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x12c'),_0x258b2d[_0xdf3c('0x62')]));var _0x367df9=this[_0xdf3c('0x8e')]['sync'](this,_0x258b2d);if(_0x367df9){this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x12d'),_0x367df9));var _0x1b2961=this[_0xdf3c('0xf')]['streamFile'](_0x367df9);try{fs[_0xdf3c('0x10a')](_0x367df9+_0xdf3c('0x10b'));}catch(_0x376002){logger[_0xdf3c('0x2f')](_0x376002);}return _0x1b2961;}return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x258b2d,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x12e')]=function(_0x5eb960){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0x12f'),_0x5eb960[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x5eb960[_0xdf3c('0x92')])||!this['isConfigured'](_0x5eb960['aws_secret_access_key'])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0x12b'));}if(!this[_0xdf3c('0x8c')](_0x5eb960[_0xdf3c('0x130')])){return this['channel'][_0xdf3c('0xb0')](_0xdf3c('0x131'));}if(!this[_0xdf3c('0x8c')](_0x5eb960[_0xdf3c('0x62')])){return this['channel']['noop'](_0xdf3c('0xb1'));}this['channel'][_0xdf3c('0xee')]=!![];this[_0xdf3c('0x39')](_0x5eb960);this[_0xdf3c('0x45')](_0x5eb960[_0xdf3c('0x62')],'in','','');this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0x132'),_0x5eb960[_0xdf3c('0x62')]));var _0x5a44f1=this[_0xdf3c('0x91')][_0xdf3c('0x75')](this,_0x5eb960);if(_0x5a44f1){for(var _0x8f769e in _0x5a44f1){if(_0x5a44f1[_0xdf3c('0x9d')](_0x8f769e)&&_[_0xdf3c('0x9e')](_0x5a44f1[_0x8f769e])){this[_0xdf3c('0xf')][_0xdf3c('0xa4')](util['format']('AWS_LEX_%s',_0x8f769e[_0xdf3c('0xf1')]()),_0x5a44f1[_0x8f769e]);}}if(_['isNil'](_0x5a44f1[_0xdf3c('0x7c')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0x133'));}else{this['createSquareMessage'](_0x5a44f1[_0xdf3c('0x7c')],'out',_0xdf3c('0x134'),'');return this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x135'),_0x5a44f1[_0xdf3c('0x7c')]));}}return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x5eb960,_0xdf3c('0x136'));};AGIVertices['prototype'][_0xdf3c('0x137')]=function(_0x42f305){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x42f305[_0xdf3c('0x3b')],_0x42f305[_0xdf3c('0x6b')]));if(!this[_0xdf3c('0x8c')](_0x42f305[_0xdf3c('0x88')])){return this[_0xdf3c('0xf')]['noop']('no\x20key\x20configured');}var _0x54a06b=_0xdf3c('0x138');var _0x47bef6=util[_0xdf3c('0x2c')]('%s/recordings/%s',FILES_PATH,rs[_0xdf3c('0x122')](0x4));var _0x2160ff=util[_0xdf3c('0x2c')]('%s.%s',_0x47bef6,_0x54a06b);var _0x47d44e=!![];if(_0x42f305['beep']===_0xdf3c('0x139')){_0x47d44e=![];}var _0xeecefd=this['channel'][_0xdf3c('0x13a')](_0x47bef6,_0x54a06b,_0x42f305[_0xdf3c('0x13b')],_0x42f305[_0xdf3c('0x6b')],undefined,_0x47d44e);if(_0xeecefd[_0xdf3c('0xac')]!==-0x1){this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x13c'),_0x2160ff));var _0x5797ff=this[_0xdf3c('0x95')][_0xdf3c('0x75')](this,_0x42f305,_0x2160ff);if(_0x5797ff){for(var _0x37e578 in _0x5797ff){if(_0x5797ff[_0xdf3c('0x9d')](_0x37e578)){this[_0xdf3c('0xf')]['setVariable'](util[_0xdf3c('0x2c')](_0xdf3c('0x13d'),_0x37e578[_0xdf3c('0xf1')]()),_0x5797ff[_0x37e578]);}}return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')]('GoogleASR\x20Result\x20%s',JSON[_0xdf3c('0x78')](_0x5797ff)));}}return _0xeecefd;};AGIVertices['prototype'][_0xdf3c('0x13e')]=function(_0x418d6b){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x13f'),_0x418d6b[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x418d6b[_0xdf3c('0x98')])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0x140'));}if(!this[_0xdf3c('0x8c')](_0x418d6b[_0xdf3c('0x99')])){return this['channel'][_0xdf3c('0xb0')]('no\x20appsecret\x20configured');}var _0xddf03e=_0xdf3c('0x138');var _0x22b00b=util[_0xdf3c('0x2c')](_0xdf3c('0x141'),FILES_PATH,rs[_0xdf3c('0x122')](0x4));var _0x311098=util[_0xdf3c('0x2c')](_0xdf3c('0xa5'),_0x22b00b,_0xddf03e);var _0x33230c=!![];if(_0x418d6b[_0xdf3c('0x142')]===_0xdf3c('0x139')){_0x33230c=![];}var _0x597a56=this['channel']['recordFile'](_0x22b00b,_0xddf03e,_0x418d6b[_0xdf3c('0x13b')],_0x418d6b[_0xdf3c('0x6b')],undefined,_0x33230c);if(_0x597a56[_0xdf3c('0xac')]!==-0x1){this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x143'),_0x311098));var _0x46f737=this[_0xdf3c('0x97')][_0xdf3c('0x75')](this,_0x418d6b,_0x311098);if(_0x46f737){for(var _0x38aedd in _0x46f737){if(_0x46f737[_0xdf3c('0x9d')](_0x38aedd)){this[_0xdf3c('0xf')]['setVariable'](util['format'](_0xdf3c('0x144'),_0x38aedd[_0xdf3c('0xf1')]()),_0x46f737[_0x38aedd]);}}return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')]('TildeASR\x20Result\x20%s',JSON[_0xdf3c('0x78')](_0x46f737)));}}return _0x597a56;};AGIVertices[_0xdf3c('0x11')]['gotoc']=function(_0xabf05c){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x145'),_0xabf05c[_0xdf3c('0x3b')]));return this[_0xdf3c('0xf')][_0xdf3c('0x146')](_0xabf05c[_0xdf3c('0x40')],_0xabf05c['extension'],_0xabf05c[_0xdf3c('0x147')]);};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x148')]=function(_0x458e39){logger['info'](util['format'](_0xdf3c('0x149'),_0x458e39[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x458e39[_0xdf3c('0x14a')])){return this['channel']['error'](_0x458e39,_0xdf3c('0x14b'));}try{var _0x1b0ad5=eval(_0x458e39[_0xdf3c('0x14a')])?'true':_0xdf3c('0x14c');this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x14d'),_0x458e39['condition'],_0x1b0ad5));return{'code':0xc8,'result':_0x1b0ad5};}catch(_0x5ef9d0){return{'code':0xc8,'result':_0xdf3c('0x14c')};}};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x14e')]=function(_0x539721){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x539721[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x539721[_0xdf3c('0x14f')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x539721,_0xdf3c('0x150'));}var _0x1d61c5=this[_0xdf3c('0x151')][_0xdf3c('0x75')](this,_0x539721[_0xdf3c('0x14f')]);if(!_0x1d61c5){return this[_0xdf3c('0xf')]['error'](_0x539721,_0xdf3c('0x152'));}for(var _0x176fe=0x0;_0x176fe<_0x1d61c5[_0xdf3c('0xa2')];_0x176fe+=0x1){var _0x4b9541=this[_0xdf3c('0xf')][_0xdf3c('0x12')](util[_0xdf3c('0x2c')](_0xdf3c('0x153'),_0x1d61c5[_0x176fe]));if(_0x4b9541['result']===-0x1){return _0x4b9541;}logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x154'),_0x1d61c5[_0x176fe],_0x4b9541[_0xdf3c('0xaa')]));if(_0x4b9541[_0xdf3c('0xaa')]===_0xdf3c('0x155')){logger['info'](util[_0xdf3c('0x2c')]('IFTIME\x20%s\x20%s',_0x1d61c5[_0x176fe],_0xdf3c('0x155')));this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x154'),_0x1d61c5[_0x176fe],_0xdf3c('0x155')));return{'code':0xc8,'result':_0xdf3c('0x155')};}else{logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0x154'),_0x1d61c5[_0x176fe],'false'));this[_0xdf3c('0xf')]['noop'](util['format'](_0xdf3c('0x154'),_0x1d61c5[_0x176fe],_0xdf3c('0x14c')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xdf3c('0x11')]['hangup']=function(_0x5e1d8b){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x156'),_0x5e1d8b[_0xdf3c('0x3b')]));return this[_0xdf3c('0xf')][_0xdf3c('0x157')]();};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x158')]=function(_0x4c82c4){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x159'),_0x4c82c4[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x4c82c4[_0xdf3c('0x88')])){return this['channel'][_0xdf3c('0xb0')](_0xdf3c('0xed'));}var _0x178d3e=_0xdf3c('0x138');var _0x5857e7=util['format'](_0xdf3c('0x141'),FILES_PATH,rs['generate'](0x4));var _0x7f3f0b=util['format'](_0xdf3c('0xa5'),_0x5857e7,_0x178d3e);var _0x209c4f=!![];if(_0x4c82c4['beep']===_0xdf3c('0x139')){_0x209c4f=![];}var _0x2a37bc=this[_0xdf3c('0xf')][_0xdf3c('0x13a')](_0x5857e7,_0x178d3e,_0x4c82c4[_0xdf3c('0x13b')],_0x4c82c4[_0xdf3c('0x6b')],undefined,_0x209c4f);if(_0x2a37bc['result']!==-0x1){this['channel'][_0xdf3c('0xb0')](util['format'](_0xdf3c('0x15a'),_0x7f3f0b));var _0x1af97a=this[_0xdf3c('0x8a')][_0xdf3c('0x75')](this,_0x4c82c4,_0x7f3f0b);if(_0x1af97a){for(var _0x1263bf in _0x1af97a){if(_0x1af97a[_0xdf3c('0x9d')](_0x1263bf)){this['channel']['setVariable'](util['format'](_0xdf3c('0x15b'),_0x1263bf['toUpperCase']()),_0x1af97a[_0x1263bf]);}}return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util['format'](_0xdf3c('0x15c'),JSON[_0xdf3c('0x78')](_0x1af97a)));}}return _0x2a37bc;};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x15d')]=function(_0x2beff1){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x15e'),_0x2beff1['label']));if(!this[_0xdf3c('0x8c')](_0x2beff1[_0xdf3c('0x88')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xed'));}if(!this[_0xdf3c('0x8c')](_0x2beff1[_0xdf3c('0x62')])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xb1'));}this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x15f'),_0x2beff1[_0xdf3c('0x62')]));var _0x516aa3=this[_0xdf3c('0x87')]['sync'](this,_0x2beff1);if(_0x516aa3){this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util['format'](_0xdf3c('0x15a'),_0x516aa3));var _0x23fad4=this['channel'][_0xdf3c('0x109')](_0x516aa3,_0x2beff1[_0xdf3c('0x13b')]);try{fs[_0xdf3c('0x10a')](_0x516aa3+_0xdf3c('0x10b'));}catch(_0x5add00){logger['error'](_0x5add00);}return _0x23fad4;}return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x2beff1,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x160')]=function(_0x78ff07){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x161'),_0x78ff07[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x78ff07['findBy'])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x78ff07,_0xdf3c('0x162'));}logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x163'),this[_0xdf3c('0xf')]['callerid'],_0x78ff07[_0xdf3c('0x164')]));var _0x118a21=this[_0xdf3c('0x57')][_0xdf3c('0x75')](this,_0x78ff07[_0xdf3c('0x164')]);if(_0x118a21){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x165'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x78ff07['findBy']));this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x165'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x78ff07[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x166')};}else{logger['info'](util['format'](_0xdf3c('0x167'),this['channel'][_0xdf3c('0x3d')],_0x78ff07[_0xdf3c('0x164')]));this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x78ff07[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x168')};}};AGIVertices[_0xdf3c('0x11')]['logout']=function(_0x4fcf64){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x169'),_0x4fcf64[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x4fcf64[_0xdf3c('0x164')])){return this['channel'][_0xdf3c('0x2f')](_0x4fcf64,_0xdf3c('0x162'));}logger[_0xdf3c('0x31')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xdf3c('0xf')]['callerid'],_0x4fcf64['findBy']));var _0x136935=this[_0xdf3c('0x56')]['sync'](this,_0x4fcf64[_0xdf3c('0x164')]);if(_0x136935){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x165'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x4fcf64[_0xdf3c('0x164')]));this['channel']['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0x165'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x4fcf64[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x166')};}else{logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x167'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x4fcf64[_0xdf3c('0x164')]));this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x167'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x4fcf64[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x168')};}};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x16a')]=function(_0x243447){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x16b'),_0x243447[_0xdf3c('0x3b')]));if(!this['isConfigured'](_0x243447[_0xdf3c('0x16c')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x243447,_0xdf3c('0x16d'));}this['channel'][_0xdf3c('0xb0')](util['format'](_0xdf3c('0x16e'),_0x243447[_0xdf3c('0x16c')]));var _0x4a9157=eval(_0x243447[_0xdf3c('0x16c')]);if(!this[_0xdf3c('0x8c')](_0x243447[_0xdf3c('0xde')])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0xdd'));}var _0x172b7c=this['getVariable'][_0xdf3c('0x75')](this,_0x243447['variable_id']);if(!_0x172b7c){return this[_0xdf3c('0xf')]['error'](_0x243447,_0xdf3c('0x120'));}if(_[_0xdf3c('0xa1')](_0x4a9157)){var _0x56d4db=this;_0x4a9157[_0xdf3c('0xdf')](function(_0x5c8dcc,_0x399564){_0x56d4db[_0xdf3c('0xf')][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')](_0xdf3c('0x16f'),_0x172b7c,_0x399564),_0x5c8dcc);});return this[_0xdf3c('0xf')]['noop'](util['format'](_0xdf3c('0x170'),_0x172b7c));}else{return this['channel'][_0xdf3c('0xa4')](_0x172b7c,_0x4a9157);}};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0xd')]=function(_0x53ccf7){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x53ccf7['label']));if(_0x53ccf7[_0xdf3c('0xaf')]===0x0){return this['maxRetry'](_0x53ccf7);}_0x53ccf7[_0xdf3c('0xaf')]-=0x1;if(!this[_0xdf3c('0x8c')](_0x53ccf7[_0xdf3c('0x119')])){return this[_0xdf3c('0xf')]['error'](_0x53ccf7,'no\x20file\x20audio\x20selected');}var _0xc7732c=this[_0xdf3c('0x21')][_0xdf3c('0x75')](this,_0x53ccf7[_0xdf3c('0x119')]);if(!_0xc7732c){return this[_0xdf3c('0xf')]['error'](_0x53ccf7,_0xdf3c('0x171'));}var _0x242fc1=this[_0xdf3c('0xf')][_0xdf3c('0x11b')](_0xc7732c,_0x53ccf7[_0xdf3c('0x11c')],_0x53ccf7[_0xdf3c('0x172')]);var _0x5c0853=_0x242fc1[_0xdf3c('0xac')];if(_0x242fc1['result']===-0x1){this[_0xdf3c('0x39')]['sync'](this,_0x53ccf7,'-1');return _0x242fc1;}else if(_0x242fc1[_0xdf3c('0xaa')]===_0xdf3c('0x6b')){_0x242fc1['result']=_0x242fc1[_0xdf3c('0xac')]['length']>0x0?_0x242fc1[_0xdf3c('0xac')]:'t';}else if(_[_0xdf3c('0x47')](_0x242fc1[_0xdf3c('0xac')])){_0x242fc1[_0xdf3c('0xac')]='#';_0x5c0853='#';}if(!this[_0xdf3c('0x8c')](_0x53ccf7[_0xdf3c('0xde')])){this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xdd'));}else{var _0xfa1485=this[_0xdf3c('0x12')][_0xdf3c('0x75')](this,_0x53ccf7[_0xdf3c('0xde')]);if(!_0xfa1485){return this['channel'][_0xdf3c('0x2f')](_0x53ccf7,_0xdf3c('0x120'));}this[_0xdf3c('0xf')][_0xdf3c('0xa4')](_0xfa1485,_0x5c0853);}this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x53ccf7,_0x5c0853);return _0x242fc1;};AGIVertices['prototype']['noop']=function(_0x3c98b1){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x173'),_0x3c98b1['label']));return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0x3c98b1[_0xdf3c('0x174')]||_0x3c98b1['label']);};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x175')]=function(_0x353039){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x176'),_0x353039[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x353039[_0xdf3c('0x164')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x353039,'no\x20find\x20by\x20configured');}logger[_0xdf3c('0x31')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x353039[_0xdf3c('0x164')]));var _0x193f32=this[_0xdf3c('0x52')][_0xdf3c('0x75')](this,_0x353039['pause_id']);var _0xa1c12d=this['agentPause'][_0xdf3c('0x75')](this,_0x353039[_0xdf3c('0x164')],_0x193f32);if(_0xa1c12d){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x165'),this[_0xdf3c('0xf')]['callerid'],_0x353039[_0xdf3c('0x164')]));this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x165'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x353039[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x166')};}else{logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x167'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x353039[_0xdf3c('0x164')]));this[_0xdf3c('0xf')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x353039[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x168')};}};AGIVertices['prototype'][_0xdf3c('0x177')]=function(_0x337ffb){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x178'),_0x337ffb[_0xdf3c('0x3b')]));if(!this['isConfigured'](_0x337ffb[_0xdf3c('0x119')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x337ffb,'no\x20file\x20audio\x20selected');}var _0x37915a=this['getSound']['sync'](this,_0x337ffb[_0xdf3c('0x119')]);if(!_0x37915a){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x337ffb,_0xdf3c('0x171'));}var _0x396ef2=this[_0xdf3c('0xf')][_0xdf3c('0x5c')](_0xdf3c('0x179'),[_0x37915a,_0x337ffb[_0xdf3c('0x115')]]);if(_0x396ef2['result']===-0x1){return _0x396ef2;}return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0xca'),_0xdf3c('0x179'),_0x37915a));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x17a')]=function(_0xeeba72){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x17b'),_0xeeba72[_0xdf3c('0x3b')]));if(!this['isConfigured'](_0xeeba72[_0xdf3c('0x17c')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0xeeba72,_0xdf3c('0x17d'));}var _0xb0062b='';var _0x29c058=parseInt(_0xeeba72[_0xdf3c('0x17c')],0xa);if(isNaN(_0x29c058)){_0xb0062b=_0xeeba72[_0xdf3c('0x17c')];}else{_0xb0062b=this[_0xdf3c('0x16')][_0xdf3c('0x75')](this,_0xeeba72['queue_id']);if(!_0xb0062b){return this[_0xdf3c('0xf')]['error'](_0xeeba72,_0xdf3c('0x17e'));}}var _0x5199cc='';if(this[_0xdf3c('0x8c')](_0xeeba72['file_id'])){var _0x36fc26=this['getSound'][_0xdf3c('0x75')](this,_0xeeba72['file_id']);if(_0x36fc26){_0x5199cc=_0x36fc26;}}this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0xeeba72,_0xb0062b);if(_0xeeba72[_0xdf3c('0x115')]['indexOf']('x')<0x0){_0xeeba72[_0xdf3c('0x115')]+='x';}if(_0xeeba72['opts'][_0xdf3c('0x17f')]('X')<0x0){_0xeeba72[_0xdf3c('0x115')]+='X';}this[_0xdf3c('0xf')][_0xdf3c('0xa4')](_0xdf3c('0x180'),_0xb0062b?_0xb0062b[_0xdf3c('0x181')]():'');var _0x159cb2=this[_0xdf3c('0xf')][_0xdf3c('0x5c')](_0xdf3c('0x182'),[_0xb0062b,_0xeeba72[_0xdf3c('0x115')],_0xeeba72[_0xdf3c('0x6a')],_0x5199cc,_0xeeba72[_0xdf3c('0x6b')],_0xeeba72[_0xdf3c('0x8')],_0xeeba72[_0xdf3c('0x183')],_0xeeba72[_0xdf3c('0x184')],'',_0xeeba72['position']]);if(_0x159cb2[_0xdf3c('0xac')]===-0x1){return _0x159cb2;}return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0xca'),'QUEUE',_0xb0062b));};AGIVertices['prototype'][_0xdf3c('0x185')]=function(_0x2bf18c){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x2bf18c[_0xdf3c('0x3b')]));var _0x7a9747=_0x2bf18c['recordingFormat']||'wav';var _0x58465d=util['format'](_0xdf3c('0x186'),this[_0xdf3c('0xf')]['uniqueid'],rs[_0xdf3c('0x122')](0x5));var _0x4c3e3d=util[_0xdf3c('0x2c')](_0xdf3c('0x187'),FILES_PATH,_0x58465d,_0x7a9747);var _0x5b0483=util[_0xdf3c('0x2c')](_0xdf3c('0x141'),FILES_PATH,_0x58465d);this['createSquareRecording'][_0xdf3c('0x75')](this,_0x2bf18c,_0x58465d,_0x4c3e3d);this[_0xdf3c('0xf')]['setVariable'](_0xdf3c('0x188'),_0x58465d);logger[_0xdf3c('0x31')](_0xdf3c('0x189'),_0x5b0483,_0x7a9747,_0x2bf18c[_0xdf3c('0x18a')],_0x2bf18c[_0xdf3c('0x6b')]);return this[_0xdf3c('0xf')][_0xdf3c('0x13a')](_0x5b0483,_0x7a9747,_0x2bf18c[_0xdf3c('0x18a')],_0x2bf18c['timeout'],undefined,!![]);};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x18b')]=function(_0x1009c6){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x18c'),_0x1009c6[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x1009c6['url'])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0x18d'));}var _0x4fb97e=this['restAPI'][_0xdf3c('0x75')](this,_0x1009c6);logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x18e'),util['inspect'](_0x4fb97e,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x1009c6['variable_id'])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0x18f'));}var _0x517e73=this['getVariable'][_0xdf3c('0x75')](this,_0x1009c6['variable_id']);if(!_0x517e73){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x1009c6,'no\x20variable\x20found');}this[_0xdf3c('0xf')][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')](_0xdf3c('0x190'),_0x517e73),_0x4fb97e[_0xdf3c('0x7a')]?_0x4fb97e['statusCode']:_0xdf3c('0x191'));this[_0xdf3c('0xf')][_0xdf3c('0xa4')](util[_0xdf3c('0x2c')](_0xdf3c('0x192'),_0x517e73),_0x4fb97e[_0xdf3c('0x7b')]?_0x4fb97e[_0xdf3c('0x7b')]:'OK');if(_0x4fb97e['body']){try{this['saveRestApiResult'](_0x4fb97e[_0xdf3c('0x6f')],_0x517e73);}catch(_0x439d2e){logger[_0xdf3c('0x2f')](util[_0xdf3c('0x2c')](_0xdf3c('0x193'),_0x517e73));}}return this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xe1'),_0x517e73));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x194')]=function(_0x3696b8){logger['info'](util['format'](_0xdf3c('0x195'),_0x3696b8[_0xdf3c('0x3b')]));return this[_0xdf3c('0xf')]['sayDigits'](_0x3696b8[_0xdf3c('0x196')][_0xdf3c('0x5e')](/\s+/g,''),_0x3696b8[_0xdf3c('0x18a')]);};AGIVertices['prototype'][_0xdf3c('0x197')]=function(_0x1c56e0){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0x198'),_0x1c56e0[_0xdf3c('0x3b')]));return this[_0xdf3c('0xf')][_0xdf3c('0x199')](_0x1c56e0[_0xdf3c('0x6c')][_0xdf3c('0x5e')](/\s+/g,''),_0x1c56e0[_0xdf3c('0x18a')]);};AGIVertices['prototype'][_0xdf3c('0x19a')]=function(_0x4ec4cd){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x19b'),_0x4ec4cd[_0xdf3c('0x3b')]));return this['channel']['sayPhonetic'](_0x4ec4cd['text'],_0x4ec4cd[_0xdf3c('0x18a')]);};AGIVertices['prototype'][_0xdf3c('0x19c')]=function(_0x5120ed){logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x19d'),_0x5120ed[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x5120ed[_0xdf3c('0x19e')])){return this['channel'][_0xdf3c('0xb0')](_0xdf3c('0x19f'));}var _0xff480=this['getMailAccount']['sync'](this,_0x5120ed['account_id']);if(!_0xff480||!_0xff480['Smtp']){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x5120ed,'no\x20mail\x20account\x20found');}var _0x53a9c2={'from':util['format'](_0xdf3c('0x1a0'),_0xff480[_0xdf3c('0x18')],_0xff480[_0xdf3c('0x1a1')]||_0xff480[_0xdf3c('0x1a2')][_0xdf3c('0x1a3')]),'to':_0x5120ed['to']||'','cc':_0x5120ed['cc']||'','bcc':_0x5120ed[_0xdf3c('0x1a4')]||'','subject':_0x5120ed[_0xdf3c('0x1a5')],'html':_0x5120ed['text'],'text':_0x5120ed[_0xdf3c('0x62')]};if(this[_0xdf3c('0x8c')](_0x5120ed[_0xdf3c('0x1a6')])){}logger[_0xdf3c('0xe3')](_0xdf3c('0x1a7'),JSON[_0xdf3c('0x78')](_0x53a9c2));this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x5120ed,_0x5120ed['account_id']);this['channel']['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0x1a8'),_0xff480[_0xdf3c('0x18')]));this['sendMailMessage'][_0xdf3c('0x75')](this,_0xff480[_0xdf3c('0x1a9')],_0x53a9c2);return this[_0xdf3c('0xf')][_0xdf3c('0xb0')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1aa')]=function(_0x3a2c6a){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x1ab'),_0x3a2c6a[_0xdf3c('0x3b')]));return this['channel']['noop'](_0xdf3c('0x1ac'));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1ad')]=function(_0x5420de){logger[_0xdf3c('0x31')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x5420de[_0xdf3c('0x3b')]));if(!this['isConfigured'](_0x5420de[_0xdf3c('0x1ae')])){return this['channel'][_0xdf3c('0xb0')]('no\x20sms\x20account\x20configured');}var _0x5a5def=this[_0xdf3c('0x36')][_0xdf3c('0x75')](this,_0x5420de[_0xdf3c('0x1ae')]);if(!_0x5a5def){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x5420de,_0xdf3c('0x1af'));}var _0x2c4484={'body':_0x5420de['sms_text'],'phone':_0x5420de['to']||'','SmsAccountId':_0x5a5def['id']};logger['debug'](_0xdf3c('0x1b0'),JSON['stringify'](_0x2c4484));this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x5420de,_0x5420de[_0xdf3c('0x1ae')]);this['channel']['noop'](util['format'](_0xdf3c('0x1b1'),_0x5a5def['name']));this[_0xdf3c('0x38')][_0xdf3c('0x75')](this,_0x2c4484);return this['channel'][_0xdf3c('0xb0')](_0xdf3c('0x1b2'));};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1b3')]=function(_0x56807d){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')](_0xdf3c('0x1b4'),_0x56807d['label']));if(!this['isConfigured'](_0x56807d[_0xdf3c('0xde')])){return this['channel'][_0xdf3c('0x2f')](_0x56807d,'no\x20variable\x20selected');}var _0x452f92=this[_0xdf3c('0x12')][_0xdf3c('0x75')](this,_0x56807d[_0xdf3c('0xde')]);if(!_0x452f92){return this[_0xdf3c('0xf')]['error'](_0x56807d,_0xdf3c('0x120'));}return this[_0xdf3c('0xf')][_0xdf3c('0xa4')](_0x452f92,_0x56807d[_0xdf3c('0x1b5')]);};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1b6')]=function(_0x2401a0){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20START\x20(%s)\x20block',_0x2401a0['label']));this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0x1b7'));var _0x32b937=this[_0xdf3c('0xf')]['getVariable'](_0xdf3c('0x1b8'));if(!_[_0xdf3c('0x47')](_0x32b937[_0xdf3c('0xaa')])){this[_0xdf3c('0xf')]['uniqueid']=_0x32b937[_0xdf3c('0xaa')];}if(_0x2401a0[_0xdf3c('0xbf')]===_0xdf3c('0x1b9')){this[_0xdf3c('0xf')][_0xdf3c('0xb0')]('Answer');return this['channel'][_0xdf3c('0xbf')]();}return this[_0xdf3c('0xf')]['noop']('Skipped\x20Answer');};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1ba')]=function(_0x5074e0){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0x1bb'),_0x5074e0['label']));if(!this[_0xdf3c('0x8c')](_0x5074e0['project_id'])){return this['channel'][_0xdf3c('0x2f')](_0x5074e0,'no\x20subproject\x20selected');}var _0x29b827=this[_0xdf3c('0x19')]['sync'](this,_0x5074e0['project_id']);if(!this[_0xdf3c('0x8c')](_0x29b827)){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x5074e0,util[_0xdf3c('0x2c')](_0xdf3c('0x1bc'),_0x5074e0['project_id']));}if(_0x29b827===this[_0xdf3c('0xf')]['arg_1']){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x5074e0,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xdf3c('0x39')][_0xdf3c('0x75')](this,_0x5074e0,_0x29b827);var _0x1dd6bb=this[_0xdf3c('0xf')]['exec'](_0xdf3c('0x1bd'),util[_0xdf3c('0x2c')](_0xdf3c('0x1be'),config[_0xdf3c('0x8')][_0xdf3c('0x1bf')]||_0xdf3c('0x1c0'),_0x29b827,this[_0xdf3c('0xf')][_0xdf3c('0x3c')]));if(_0x1dd6bb[_0xdf3c('0xac')]===-0x1){return _0x1dd6bb;}return this['channel'][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0xca'),_0xdf3c('0x1bd'),_0x29b827));};AGIVertices['prototype'][_0xdf3c('0x1c1')]=function(_0x3344b8){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x3344b8[_0xdf3c('0x3b')]));var _0x36fa48=this[_0xdf3c('0x5b')]['sync'](this,_0x3344b8[_0xdf3c('0xbd')]);this['createSquareDetailsReport'][_0xdf3c('0x75')](this,_0x3344b8,_0x3344b8[_0xdf3c('0xbd')]);if(this[_0xdf3c('0x8c')](_0x3344b8[_0xdf3c('0xde')])){var _0x3c669f=this[_0xdf3c('0x12')]['sync'](this,_0x3344b8[_0xdf3c('0xde')]);if(_0x3c669f){this[_0xdf3c('0xf')][_0xdf3c('0xa4')](_0x3c669f,_0x36fa48);return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util['format'](_0xdf3c('0x1c2'),_0x3344b8[_0xdf3c('0xbd')],_0x3c669f));}}return this[_0xdf3c('0xf')]['noop'](util[_0xdf3c('0x2c')](_0xdf3c('0x1c3'),_0x3344b8[_0xdf3c('0xbd')]));};AGIVertices['prototype'][_0xdf3c('0x1c4')]=function(_0xbd6cd8){logger['info'](util[_0xdf3c('0x2c')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0xbd6cd8[_0xdf3c('0x3b')]));_0xbd6cd8['text']=_0xbd6cd8[_0xdf3c('0x62')][_0xdf3c('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xdf3c('0x8c')](_0xbd6cd8[_0xdf3c('0x60')])){return this[_0xdf3c('0xf')]['noop'](_0xdf3c('0x1c5'));}if(!this['isConfigured'](_0xbd6cd8['text'])){return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](_0xdf3c('0xb1'));}this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x1c6'),_0xbd6cd8['text']));var _0x247aea=this['googleCloudTTS'][_0xdf3c('0x75')](this,_0xbd6cd8);if(_0x247aea){this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x1c7'),_0x247aea));var _0xca74ea=this['channel'][_0xdf3c('0x109')](_0x247aea);try{fs[_0xdf3c('0x10a')](_0x247aea+'.wav');}catch(_0x2d3153){logger[_0xdf3c('0x2f')](_0x2d3153);}return _0xca74ea;}return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0xbd6cd8,_0xdf3c('0x1c8'));};AGIVertices['prototype']['tts']=function(_0x1db828){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x1db828[_0xdf3c('0x3b')]));_0x1db828[_0xdf3c('0x62')]=_0x1db828[_0xdf3c('0x62')][_0xdf3c('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1db828[_0xdf3c('0x62')])){return this[_0xdf3c('0xf')]['noop']('no\x20text\x20configured');}this['channel']['noop'](util[_0xdf3c('0x2c')]('Trying\x20Google\x20TTS\x20%s',_0x1db828[_0xdf3c('0x62')]));var _0x2cf3a1=this['googleTTS']['sync'](this,_0x1db828);if(_0x2cf3a1){this[_0xdf3c('0xf')]['noop'](util['format'](_0xdf3c('0x1c9'),_0x2cf3a1));var _0x4b8c41=this['channel']['streamFile'](_0x2cf3a1);try{fs[_0xdf3c('0x10a')](_0x2cf3a1+'.wav');}catch(_0xc6f51f){logger[_0xdf3c('0x2f')](_0xc6f51f);}return _0x4b8c41;}return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x1db828,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1ca')]=function(_0x2a6deb){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0x1cb'),_0x2a6deb['label']));if(!this[_0xdf3c('0x8c')](_0x2a6deb[_0xdf3c('0x164')])){return this['channel'][_0xdf3c('0x2f')](_0x2a6deb,_0xdf3c('0x162'));}logger['info'](util[_0xdf3c('0x2c')](_0xdf3c('0x163'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x2a6deb[_0xdf3c('0x164')]));var _0x33c73e=this[_0xdf3c('0x54')][_0xdf3c('0x75')](this,_0x2a6deb['findBy']);if(_0x33c73e){logger['info'](util[_0xdf3c('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x2a6deb['findBy']));this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x165'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x2a6deb[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x166')};}else{logger[_0xdf3c('0x31')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xdf3c('0x3d')],_0x2a6deb[_0xdf3c('0x164')]));this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util[_0xdf3c('0x2c')](_0xdf3c('0x167'),this[_0xdf3c('0xf')][_0xdf3c('0x3d')],_0x2a6deb[_0xdf3c('0x164')]));return{'code':0xc8,'result':_0xdf3c('0x168')};}};AGIVertices[_0xdf3c('0x11')][_0xdf3c('0x1cc')]=function(_0x9ba122){logger[_0xdf3c('0x31')](util[_0xdf3c('0x2c')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x9ba122[_0xdf3c('0x3b')]));var _0x56d351=this[_0xdf3c('0xf')][_0xdf3c('0x5c')]('VOICEMAIL',[_0x9ba122[_0xdf3c('0x1cd')],_0x9ba122[_0xdf3c('0x7e')]]);if(_0x56d351[_0xdf3c('0xac')]===-0x1){return _0x56d351;}return this[_0xdf3c('0xf')][_0xdf3c('0xb0')](util['format'](_0xdf3c('0xca'),_0xdf3c('0x1ce'),_0x9ba122['mailbox']));};AGIVertices[_0xdf3c('0x11')]['vswitch']=function(_0x47b291){logger[_0xdf3c('0x31')](util['format'](_0xdf3c('0x1cf'),_0x47b291[_0xdf3c('0x3b')]));if(!this[_0xdf3c('0x8c')](_0x47b291[_0xdf3c('0xde')])){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x47b291,_0xdf3c('0x1d0'));}var _0x134616=this[_0xdf3c('0x12')][_0xdf3c('0x75')](this,_0x47b291[_0xdf3c('0xde')]);if(!_0x134616){return this[_0xdf3c('0xf')][_0xdf3c('0x2f')](_0x47b291,'no\x20variable\x20found');}var _0x282c92=this['channel'][_0xdf3c('0x12')](_0x134616);return{'code':0xc8,'result':_0x282c92[_0xdf3c('0xaa')]?_0x282c92['extra']:'-'};};String[_0xdf3c('0x11')][_0xdf3c('0xa9')]=function(_0x13d361,_0x3559e9){return this[_0xdf3c('0xa8')](_0x13d361)['join'](_0x3559e9);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 41e532a..601372c 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 _0xda36=['[ACW][syncAgentConnectPreview]\x20%s','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','deleteChannelAfterTimeout','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','lodash','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','prototype','lastPauseAt','timer','update','uniqueid','then','info','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','updateAcw','finally','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview'];(function(_0x533de9,_0x55626e){var _0x562c3c=function(_0x337860){while(--_0x337860){_0x533de9['push'](_0x533de9['shift']());}};_0x562c3c(++_0x55626e);}(_0xda36,0xbb));var _0x6da3=function(_0x286058,_0x49e249){_0x286058=_0x286058-0x0;var _0x5c4410=_0xda36[_0x286058];return _0x5c4410;};'use strict';var _=require(_0x6da3('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x6da3('0x1'))(_0x6da3('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x6da3('0x3'));function Acw(_0x30d346){this[_0x6da3('0x4')]=_0x30d346['voiceQueues'];this[_0x6da3('0x5')]=_0x30d346[_0x6da3('0x5')];this[_0x6da3('0x6')]=_0x30d346[_0x6da3('0x6')];this['channels']={};ami['on'](_0x6da3('0x7'),this[_0x6da3('0x8')]['bind'](this));ami['on']('hanguprequest',this[_0x6da3('0x9')][_0x6da3('0xa')](this));ami['on'](_0x6da3('0xb'),this[_0x6da3('0xc')]['bind'](this));ami['on'](_0x6da3('0xd'),this[_0x6da3('0xe')][_0x6da3('0xa')](this));ami['on']('attendedtransfer',this[_0x6da3('0xf')][_0x6da3('0xa')](this));ami['on'](_0x6da3('0x10'),this[_0x6da3('0x11')][_0x6da3('0xa')](this));ami['on'](_0x6da3('0x12'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x18d4f7){var _0x8eed26=moment()[_0x6da3('0x13')](0x0);var _0x43b689=moment(_0x18d4f7)[_0x6da3('0x13')](0x0);return _0x8eed26['diff'](_0x43b689,_0x6da3('0x14'));}Acw[_0x6da3('0x15')]['updateAcw']=function(_0x494dd8,_0x4fb3c2){var _0x18db23=this;var _0x404d4d=getDiff(_0x18db23[_0x6da3('0x6')][_0x494dd8][_0x6da3('0x16')]);clearTimeout(_0x18db23['timers'][_0x494dd8][_0x6da3('0x17')]);_0x18db23['timers'][_0x494dd8][_0x6da3('0x17')]=![];return RpcVoiceAgentReport[_0x6da3('0x18')]({'acwtime':_0x404d4d},_0x18db23[_0x6da3('0x6')][_0x494dd8][_0x6da3('0x19')],_0x494dd8)[_0x6da3('0x1a')](function(_0x362c70){logger[_0x6da3('0x1b')]('[%s][UPDATE][ACWTIME:%s]',_0x4fb3c2,_0x404d4d,_0x362c70);})[_0x6da3('0x1c')](function(_0x1dde25){logger[_0x6da3('0x1d')](_0x6da3('0x1e'),_0x4fb3c2,_0x1dde25);})['finally'](function(){delete _0x18db23['timers'][_0x494dd8];});};Acw['prototype'][_0x6da3('0x1f')]=function(_0x2ea81e){try{var _0x2e1a1e=this;var _0x3a9aef=this[_0x6da3('0x20')][_0x2ea81e][_0x6da3('0x21')];var _0x5910fb=this[_0x6da3('0x20')][_0x2ea81e][_0x6da3('0x22')];var _0x3f8cd2=this[_0x6da3('0x4')][_0x5910fb];var _0x20e2a0=![];var _0xe7cadb=_0x6da3('0x23');if(_0x3f8cd2[_0x6da3('0x24')]&&_0x3f8cd2[_0x6da3('0x25')][_0x6da3('0x26')]){_0x20e2a0=!![];_0xe7cadb=_0x3f8cd2[_0x6da3('0x25')][_0x6da3('0x26')];}return ami['Action']({'action':_0x6da3('0x27'),'interface':_0x3a9aef,'paused':!![],'reason':_0xe7cadb})['then'](function(){if(_0x2e1a1e[_0x6da3('0x5')][_0x3a9aef]){return RpcUser[_0x6da3('0x28')](_0x2e1a1e['agents'][_0x3a9aef]['id'])[_0x6da3('0x1a')](function(_0x546f70){if(!_0x546f70||_0x546f70[_0x6da3('0x29')]){logger[_0x6da3('0x1b')](_0x6da3('0x2a'),_0x2ea81e,_0x3a9aef,_0x5910fb);return;}logger['info'](_0x6da3('0x2b'),_0x2ea81e,_0x3a9aef,_0x5910fb);var _0x24499a=_0x2e1a1e[_0x6da3('0x20')][_0x2ea81e][_0x6da3('0x2c')]&&_0x2e1a1e[_0x6da3('0x20')][_0x2ea81e]['destlinkedid']?_0x2e1a1e[_0x6da3('0x20')][_0x2ea81e][_0x6da3('0x2d')]:_0x2ea81e;return RpcUser[_0x6da3('0x2e')](_0x2e1a1e[_0x6da3('0x5')][_0x3a9aef],_0xe7cadb,_0x24499a)[_0x6da3('0x1a')](function(_0x2526fc){_0x2e1a1e[_0x6da3('0x4')][_0x5910fb][_0x6da3('0x2f')]-=0x1;_0x2e1a1e[_0x6da3('0x4')][_0x5910fb][_0x6da3('0x30')]+=0x1;return _0x2526fc;});})[_0x6da3('0x1a')](function(_0x8779c5){if(_0x20e2a0||!_0x8779c5){return;}_0x2e1a1e['timers'][_0x3a9aef]={};logger[_0x6da3('0x1b')](_0x6da3('0x31'),_0x2ea81e,_0x2e1a1e[_0x6da3('0x4')][_0x5910fb][_0x6da3('0x32')],_0x3a9aef,_0x5910fb);_0x2e1a1e[_0x6da3('0x6')][_0x3a9aef][_0x6da3('0x17')]=setTimeout(_0x2e1a1e[_0x6da3('0x33')][_0x6da3('0xa')](_0x2e1a1e,_0x3a9aef),_0x2e1a1e[_0x6da3('0x4')][_0x5910fb][_0x6da3('0x32')]*0x3e8);_0x2e1a1e[_0x6da3('0x6')][_0x3a9aef][_0x6da3('0x16')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2e1a1e[_0x6da3('0x6')][_0x3a9aef][_0x6da3('0x19')]=_0x2ea81e;_0x2e1a1e['timers'][_0x3a9aef][_0x6da3('0x22')]=_0x5910fb;_0x2e1a1e[_0x6da3('0x6')][_0x3a9aef]['updateAcw']=_0x2e1a1e[_0x6da3('0x34')][_0x6da3('0xa')](_0x2e1a1e,_0x3a9aef,_0x2ea81e);});}})['catch'](function(){logger[_0x6da3('0x1d')](_0x6da3('0x31'),_0x2ea81e,_0x2e1a1e[_0x6da3('0x4')][_0x5910fb]['acwTimeout'],_0x3a9aef,_0x5910fb);})[_0x6da3('0x35')](function(){delete _0x2e1a1e['channels'][_0x2ea81e];});}catch(_0x3efa23){logger['error']('[ACW][START]\x20%s',_0x3efa23[_0x6da3('0x36')]);}};Acw['prototype'][_0x6da3('0x33')]=function(_0x47d191){try{var _0x59d48a=this;if(_0x59d48a[_0x6da3('0x6')][_0x47d191]){_0x59d48a[_0x6da3('0x6')][_0x47d191]['timer']=![];var _0x1edbd9=_0x59d48a['timers'][_0x47d191][_0x6da3('0x19')];var _0x1ce3c7=_0x59d48a[_0x6da3('0x6')][_0x47d191][_0x6da3('0x22')];var _0x362d0f=_0x59d48a[_0x6da3('0x4')][_0x1ce3c7][_0x6da3('0x32')];logger[_0x6da3('0x1b')](_0x6da3('0x37'),_0x1edbd9,_0x47d191);RpcUser['getAgent'](this[_0x6da3('0x5')][_0x47d191]['id'])[_0x6da3('0x1a')](function(_0x36287b){if(_0x36287b[_0x6da3('0x38')]===_0x6da3('0x23')){return RpcUser['saveUnpause'](_0x59d48a[_0x6da3('0x5')][_0x47d191]);}});RpcVoiceAgentReport[_0x6da3('0x18')]({'acwtime':_0x362d0f,'agentacw':!![]},_0x1edbd9,_0x47d191)[_0x6da3('0x1a')](function(_0x2c940a){logger[_0x6da3('0x1b')]('[%s][UPDATE][ACWTIME:%s]',_0x1edbd9,_0x362d0f,_0x2c940a);})[_0x6da3('0x1c')](function(_0x1aa563){logger[_0x6da3('0x1d')](_0x6da3('0x1e'),_0x1edbd9,_0x1aa563);});}else{logger[_0x6da3('0x1d')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x47d191);if(_0x59d48a[_0x6da3('0x6')]){logger[_0x6da3('0x1b')](_0x6da3('0x39'),JSON[_0x6da3('0x3a')](_0x59d48a[_0x6da3('0x6')]));}}}catch(_0x8de069){logger[_0x6da3('0x1d')](_0x6da3('0x3b'),_0x8de069[_0x6da3('0x36')]);}};Acw[_0x6da3('0x15')][_0x6da3('0x8')]=function(_0x11bf0d){try{if(this[_0x6da3('0x4')][_0x11bf0d[_0x6da3('0x22')]]&&(this[_0x6da3('0x4')][_0x11bf0d[_0x6da3('0x22')]][_0x6da3('0x2')]||this['voiceQueues'][_0x11bf0d[_0x6da3('0x22')]][_0x6da3('0x24')])){if(this[_0x6da3('0x5')][_0x11bf0d[_0x6da3('0x21')]]){this[_0x6da3('0x20')][_0x11bf0d[_0x6da3('0x19')]]={'queue':_0x11bf0d[_0x6da3('0x22')],'interface':_0x11bf0d[_0x6da3('0x21')],'destlinkedid':_0x11bf0d['destlinkedid']};}}}catch(_0x192f53){logger[_0x6da3('0x1d')](_0x6da3('0x3c'),_0x192f53[_0x6da3('0x36')]);}};Acw[_0x6da3('0x15')][_0x6da3('0x3d')]=function(_0x34e1cc){try{if(this[_0x6da3('0x4')][_0x34e1cc[_0x6da3('0x22')]]&&(this[_0x6da3('0x4')][_0x34e1cc[_0x6da3('0x22')]][_0x6da3('0x2')]||this[_0x6da3('0x4')][_0x34e1cc[_0x6da3('0x22')]][_0x6da3('0x24')])){if(this[_0x6da3('0x5')][_0x34e1cc[_0x6da3('0x21')]]){this[_0x6da3('0x20')][_0x34e1cc[_0x6da3('0x19')]]={'queue':_0x34e1cc[_0x6da3('0x22')],'interface':_0x34e1cc['interface']};}}}catch(_0x2e7487){logger[_0x6da3('0x1d')](_0x6da3('0x3e'),_0x2e7487['message']);}};Acw['prototype'][_0x6da3('0x9')]=function(_0x4867b3){try{if(this['channels'][_0x4867b3[_0x6da3('0x19')]]&&_['isUndefined'](this[_0x6da3('0x20')][_0x4867b3[_0x6da3('0x19')]][_0x6da3('0x2c')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x4867b3['uniqueid']);this[_0x6da3('0x1f')](_0x4867b3['uniqueid']);}else if(this['channels'][_0x4867b3[_0x6da3('0x3f')]]&&_[_0x6da3('0x40')](this[_0x6da3('0x20')][_0x4867b3[_0x6da3('0x3f')]][_0x6da3('0x2c')])){logger[_0x6da3('0x1b')](_0x6da3('0x41'),_0x4867b3[_0x6da3('0x3f')]);this[_0x6da3('0x1f')](_0x4867b3[_0x6da3('0x3f')]);}}catch(_0x458567){logger[_0x6da3('0x1d')]('[ACW][syncHangupRequest]\x20%s',_0x458567[_0x6da3('0x36')]);}};Acw['prototype']['syncHangup']=function(_0x5887ee){try{if(this[_0x6da3('0x20')][_0x5887ee[_0x6da3('0x19')]]&&this[_0x6da3('0x20')][_0x5887ee[_0x6da3('0x19')]]['attended']){logger[_0x6da3('0x1b')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5887ee[_0x6da3('0x19')]);this[_0x6da3('0x1f')](_0x5887ee[_0x6da3('0x19')]);}else if(this['channels'][_0x5887ee[_0x6da3('0x3f')]]&&this[_0x6da3('0x20')][_0x5887ee[_0x6da3('0x3f')]]['attended']){logger['info'](_0x6da3('0x42'),_0x5887ee[_0x6da3('0x3f')]);this[_0x6da3('0x1f')](_0x5887ee[_0x6da3('0x3f')]);}}catch(_0x459776){logger[_0x6da3('0x1d')](_0x6da3('0x43'),_0x459776['message']);}};Acw[_0x6da3('0x15')]['syncAttendedTransfer']=function(_0x374704){try{if(!_[_0x6da3('0x44')](this[_0x6da3('0x20')][_0x374704[_0x6da3('0x45')]])){this[_0x6da3('0x1f')](_0x374704[_0x6da3('0x45')]);if(this[_0x6da3('0x20')][_0x374704[_0x6da3('0x46')]]){this[_0x6da3('0x20')][_0x374704['secondtransfereruniqueid']][_0x6da3('0x2c')]=!![];this[_0x6da3('0x20')][_0x374704['transfertargetuniqueid']]=this[_0x6da3('0x20')][_0x374704[_0x6da3('0x46')]];this[_0x6da3('0x47')](_0x374704[_0x6da3('0x46')]);}}else if(!_['isNil'](this[_0x6da3('0x20')][_0x374704[_0x6da3('0x48')]])){this[_0x6da3('0x1f')](_0x374704[_0x6da3('0x48')]);if(this[_0x6da3('0x20')][_0x374704[_0x6da3('0x49')]]){this['channels'][_0x374704['origtransfereruniqueid']][_0x6da3('0x2c')]=!![];this[_0x6da3('0x20')][_0x374704['transfereeuniqueid']]=this[_0x6da3('0x20')][_0x374704[_0x6da3('0x49')]];this[_0x6da3('0x47')](_0x374704[_0x6da3('0x49')]);}}}catch(_0x4295ce){logger[_0x6da3('0x1d')](_0x6da3('0x4a'),_0x4295ce[_0x6da3('0x36')]);}};Acw['prototype'][_0x6da3('0x11')]=function(_0x2a2af3){try{if(this[_0x6da3('0x20')][_0x2a2af3['transfereruniqueid']]){logger['info'](_0x6da3('0x4b'),JSON[_0x6da3('0x3a')](_0x2a2af3[_0x6da3('0x4c')]));this[_0x6da3('0x1f')](_0x2a2af3[_0x6da3('0x4c')]);}else if(this[_0x6da3('0x20')][_0x2a2af3[_0x6da3('0x4d')]]){logger[_0x6da3('0x1b')](_0x6da3('0x4e'),JSON['stringify'](_0x2a2af3[_0x6da3('0x4d')]));this[_0x6da3('0x1f')](_0x2a2af3['transfererlinkedid']);}}catch(_0x1bcfd4){logger[_0x6da3('0x1d')](_0x6da3('0x4f'),_0x1bcfd4[_0x6da3('0x36')]);}};Acw[_0x6da3('0x15')][_0x6da3('0xe')]=function(_0x22c624){try{if(this[_0x6da3('0x4')][_0x22c624[_0x6da3('0x22')]]&&this[_0x6da3('0x4')][_0x22c624['queue']][_0x6da3('0x50')]==='all'){if(this[_0x6da3('0x5')][_0x22c624[_0x6da3('0x21')]]){logger[_0x6da3('0x1b')](_0x6da3('0x51'),_0x22c624[_0x6da3('0x19')],_0x22c624[_0x6da3('0x21')],_0x22c624[_0x6da3('0x22')]);return RpcUser[_0x6da3('0x2e')](this[_0x6da3('0x5')][_0x22c624[_0x6da3('0x21')]],_0x6da3('0x52'),_0x22c624[_0x6da3('0x19')]);}}}catch(_0x2f42c7){logger[_0x6da3('0x1d')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x2f42c7[_0x6da3('0x36')]);}};Acw[_0x6da3('0x15')][_0x6da3('0x47')]=function(_0x28ace7,_0x13cb31=0x2710){if(this[_0x6da3('0x20')][_0x28ace7]){setTimeout(()=>{delete this[_0x6da3('0x20')][_0x28ace7];},_0x13cb31);}};module['exports']=Acw; \ No newline at end of file +var _0x13e9=['lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','lastPauseAt','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','startAcw','channels','interface','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','available','paused','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports'];(function(_0x7432bd,_0x152fd5){var _0x4ad91c=function(_0xf686f5){while(--_0xf686f5){_0x7432bd['push'](_0x7432bd['shift']());}};_0x4ad91c(++_0x152fd5);}(_0x13e9,0xc0));var _0x913e=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x13e9[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x913e('0x0'));var moment=require(_0x913e('0x1'));var ami=require(_0x913e('0x2'));var logger=require(_0x913e('0x3'))('acw');var RpcUser=require(_0x913e('0x4'));var RpcVoiceAgentReport=require(_0x913e('0x5'));function Acw(_0x3dc3c9){this['voiceQueues']=_0x3dc3c9[_0x913e('0x6')];this[_0x913e('0x7')]=_0x3dc3c9['agents'];this[_0x913e('0x8')]=_0x3dc3c9[_0x913e('0x8')];this['channels']={};ami['on']('agentconnect',this[_0x913e('0x9')][_0x913e('0xa')](this));ami['on'](_0x913e('0xb'),this['syncHangupRequest'][_0x913e('0xa')](this));ami['on'](_0x913e('0xc'),this[_0x913e('0xd')][_0x913e('0xa')](this));ami['on'](_0x913e('0xe'),this[_0x913e('0xf')][_0x913e('0xa')](this));ami['on'](_0x913e('0x10'),this[_0x913e('0x11')][_0x913e('0xa')](this));ami['on'](_0x913e('0x12'),this[_0x913e('0x13')][_0x913e('0xa')](this));ami['on'](_0x913e('0x14'),this[_0x913e('0x15')][_0x913e('0xa')](this));}function getDiff(_0x3d5b4e){var _0x4e5d2d=moment()[_0x913e('0x16')](0x0);var _0x1fc91f=moment(_0x3d5b4e)[_0x913e('0x16')](0x0);return _0x4e5d2d[_0x913e('0x17')](_0x1fc91f,_0x913e('0x18'));}Acw[_0x913e('0x19')]['updateAcw']=function(_0x3c16d8,_0x27d8ea){var _0xa1f50e=this;var _0x23e0a0=getDiff(_0xa1f50e['timers'][_0x3c16d8][_0x913e('0x1a')]);clearTimeout(_0xa1f50e[_0x913e('0x8')][_0x3c16d8]['timer']);_0xa1f50e['timers'][_0x3c16d8][_0x913e('0x1b')]=![];return RpcVoiceAgentReport[_0x913e('0x1c')]({'acwtime':_0x23e0a0},_0xa1f50e[_0x913e('0x8')][_0x3c16d8][_0x913e('0x1d')],_0x3c16d8)['then'](function(_0x4f1fd5){logger[_0x913e('0x1e')](_0x913e('0x1f'),_0x27d8ea,_0x23e0a0,_0x4f1fd5);})[_0x913e('0x20')](function(_0x59800f){logger['error'](_0x913e('0x21'),_0x27d8ea,_0x59800f);})['finally'](function(){delete _0xa1f50e[_0x913e('0x8')][_0x3c16d8];});};Acw['prototype'][_0x913e('0x22')]=function(_0x7b56e7){try{var _0xe0245c=this;var _0x7f9231=this[_0x913e('0x23')][_0x7b56e7][_0x913e('0x24')];var _0xc27aa5=this[_0x913e('0x23')][_0x7b56e7][_0x913e('0x25')];var _0x3cbea7=this[_0x913e('0x6')][_0xc27aa5];var _0xd19205=![];var _0x8cc39a=_0x913e('0x26');if(_0x3cbea7['mandatoryDisposition']&&_0x3cbea7[_0x913e('0x27')][_0x913e('0x28')]){_0xd19205=!![];_0x8cc39a=_0x3cbea7[_0x913e('0x27')]['name'];}return ami[_0x913e('0x29')]({'action':_0x913e('0x2a'),'interface':_0x7f9231,'paused':!![],'reason':_0x8cc39a})[_0x913e('0x2b')](function(){if(_0xe0245c['agents'][_0x7f9231]){return RpcUser[_0x913e('0x2c')](_0xe0245c[_0x913e('0x7')][_0x7f9231]['id'])[_0x913e('0x2b')](function(_0x3bd4c2){if(!_0x3bd4c2||_0x3bd4c2[_0x913e('0x2d')]){logger['info'](_0x913e('0x2e'),_0x7b56e7,_0x7f9231,_0xc27aa5);return;}logger[_0x913e('0x1e')](_0x913e('0x2f'),_0x7b56e7,_0x7f9231,_0xc27aa5);var _0x54896b=_0xe0245c[_0x913e('0x23')][_0x7b56e7]['attended']&&_0xe0245c[_0x913e('0x23')][_0x7b56e7]['destlinkedid']?_0xe0245c[_0x913e('0x23')][_0x7b56e7][_0x913e('0x30')]:_0x7b56e7;return RpcUser[_0x913e('0x31')](_0xe0245c[_0x913e('0x7')][_0x7f9231],_0x8cc39a,_0x54896b)[_0x913e('0x2b')](function(_0x15ce4f){_0xe0245c[_0x913e('0x6')][_0xc27aa5][_0x913e('0x32')]-=0x1;_0xe0245c[_0x913e('0x6')][_0xc27aa5][_0x913e('0x33')]+=0x1;return _0x15ce4f;});})[_0x913e('0x2b')](function(_0x3a9b6b){if(_0xd19205||!_0x3a9b6b){return;}_0xe0245c['timers'][_0x7f9231]={};logger[_0x913e('0x1e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x7b56e7,_0xe0245c[_0x913e('0x6')][_0xc27aa5][_0x913e('0x34')],_0x7f9231,_0xc27aa5);_0xe0245c[_0x913e('0x8')][_0x7f9231]['timer']=setTimeout(_0xe0245c[_0x913e('0x35')][_0x913e('0xa')](_0xe0245c,_0x7f9231),_0xe0245c[_0x913e('0x6')][_0xc27aa5][_0x913e('0x34')]*0x3e8);_0xe0245c[_0x913e('0x8')][_0x7f9231][_0x913e('0x1a')]=moment()[_0x913e('0x36')](_0x913e('0x37'));_0xe0245c[_0x913e('0x8')][_0x7f9231]['uniqueid']=_0x7b56e7;_0xe0245c[_0x913e('0x8')][_0x7f9231]['queue']=_0xc27aa5;_0xe0245c['timers'][_0x7f9231][_0x913e('0x38')]=_0xe0245c['updateAcw'][_0x913e('0xa')](_0xe0245c,_0x7f9231,_0x7b56e7);});}})[_0x913e('0x20')](function(){logger['error'](_0x913e('0x39'),_0x7b56e7,_0xe0245c['voiceQueues'][_0xc27aa5][_0x913e('0x34')],_0x7f9231,_0xc27aa5);})['finally'](function(){delete _0xe0245c[_0x913e('0x23')][_0x7b56e7];});}catch(_0x3a0ee6){logger[_0x913e('0x3a')](_0x913e('0x3b'),_0x3a0ee6[_0x913e('0x3c')]);}};Acw[_0x913e('0x19')]['stopAcw']=function(_0x5b39ed){try{var _0x16bf39=this;if(_0x16bf39[_0x913e('0x8')][_0x5b39ed]){_0x16bf39['timers'][_0x5b39ed][_0x913e('0x1b')]=![];var _0xca45ac=_0x16bf39[_0x913e('0x8')][_0x5b39ed][_0x913e('0x1d')];var _0x3117da=_0x16bf39[_0x913e('0x8')][_0x5b39ed][_0x913e('0x25')];var _0x4558fd=_0x16bf39[_0x913e('0x6')][_0x3117da][_0x913e('0x34')];logger[_0x913e('0x1e')](_0x913e('0x3d'),_0xca45ac,_0x5b39ed);RpcUser['getAgent'](this[_0x913e('0x7')][_0x5b39ed]['id'])['then'](function(_0x1b983b){if(_0x1b983b['pauseType']===_0x913e('0x26')){return RpcUser[_0x913e('0x3e')](_0x16bf39[_0x913e('0x7')][_0x5b39ed]);}});RpcVoiceAgentReport[_0x913e('0x1c')]({'acwtime':_0x4558fd,'agentacw':!![]},_0xca45ac,_0x5b39ed)['then'](function(_0x4f30a1){logger[_0x913e('0x1e')](_0x913e('0x1f'),_0xca45ac,_0x4558fd,_0x4f30a1);})[_0x913e('0x20')](function(_0x457d11){logger[_0x913e('0x3a')](_0x913e('0x21'),_0xca45ac,_0x457d11);});}else{logger[_0x913e('0x3a')](_0x913e('0x3f'),_0x5b39ed);if(_0x16bf39['timers']){logger[_0x913e('0x1e')](_0x913e('0x40'),JSON[_0x913e('0x41')](_0x16bf39[_0x913e('0x8')]));}}}catch(_0x2df025){logger[_0x913e('0x3a')]('[ACW][STOP]\x20%s',_0x2df025['message']);}};Acw[_0x913e('0x19')][_0x913e('0x9')]=function(_0x4f7723){try{if(this[_0x913e('0x6')][_0x4f7723[_0x913e('0x25')]]&&(this[_0x913e('0x6')][_0x4f7723[_0x913e('0x25')]]['acw']||this[_0x913e('0x6')][_0x4f7723['queue']][_0x913e('0x42')])){if(this[_0x913e('0x7')][_0x4f7723['interface']]){this[_0x913e('0x23')][_0x4f7723[_0x913e('0x1d')]]={'queue':_0x4f7723[_0x913e('0x25')],'interface':_0x4f7723['interface'],'destlinkedid':_0x4f7723['destlinkedid']};}}}catch(_0x397fe9){logger['error'](_0x913e('0x43'),_0x397fe9[_0x913e('0x3c')]);}};Acw[_0x913e('0x19')][_0x913e('0x15')]=function(_0x5620f6){try{if(this[_0x913e('0x6')][_0x5620f6[_0x913e('0x25')]]&&(this['voiceQueues'][_0x5620f6[_0x913e('0x25')]]['acw']||this['voiceQueues'][_0x5620f6[_0x913e('0x25')]][_0x913e('0x42')])){if(this['agents'][_0x5620f6['interface']]){this[_0x913e('0x23')][_0x5620f6[_0x913e('0x1d')]]={'queue':_0x5620f6['queue'],'interface':_0x5620f6[_0x913e('0x24')]};}}}catch(_0x1f85d0){logger[_0x913e('0x3a')](_0x913e('0x44'),_0x1f85d0['message']);}};Acw[_0x913e('0x19')][_0x913e('0x45')]=function(_0x4e9ffb){try{if(this[_0x913e('0x23')][_0x4e9ffb['uniqueid']]&&_['isUndefined'](this[_0x913e('0x23')][_0x4e9ffb[_0x913e('0x1d')]]['attended'])){logger[_0x913e('0x1e')](_0x913e('0x46'),_0x4e9ffb[_0x913e('0x1d')]);this[_0x913e('0x22')](_0x4e9ffb['uniqueid']);}else if(this[_0x913e('0x23')][_0x4e9ffb[_0x913e('0x47')]]&&_[_0x913e('0x48')](this[_0x913e('0x23')][_0x4e9ffb[_0x913e('0x47')]][_0x913e('0x49')])){logger[_0x913e('0x1e')](_0x913e('0x4a'),_0x4e9ffb[_0x913e('0x47')]);this[_0x913e('0x22')](_0x4e9ffb[_0x913e('0x47')]);}}catch(_0x352442){logger[_0x913e('0x3a')](_0x913e('0x4b'),_0x352442['message']);}};Acw['prototype'][_0x913e('0xd')]=function(_0x271d0a){try{if(this[_0x913e('0x23')][_0x271d0a[_0x913e('0x1d')]]&&this[_0x913e('0x23')][_0x271d0a[_0x913e('0x1d')]]['attended']){logger[_0x913e('0x1e')](_0x913e('0x4c'),_0x271d0a[_0x913e('0x1d')]);this[_0x913e('0x22')](_0x271d0a[_0x913e('0x1d')]);}else if(this[_0x913e('0x23')][_0x271d0a[_0x913e('0x47')]]&&this[_0x913e('0x23')][_0x271d0a[_0x913e('0x47')]][_0x913e('0x49')]){logger['info'](_0x913e('0x4d'),_0x271d0a[_0x913e('0x47')]);this[_0x913e('0x22')](_0x271d0a[_0x913e('0x47')]);}}catch(_0x99a2da){logger[_0x913e('0x3a')]('[ACW][syncHangup]\x20%s',_0x99a2da[_0x913e('0x3c')]);}};Acw[_0x913e('0x19')]['syncAttendedTransfer']=function(_0x523d74){try{if(!_['isNil'](this[_0x913e('0x23')][_0x523d74[_0x913e('0x4e')]])){this[_0x913e('0x22')](_0x523d74[_0x913e('0x4e')]);if(this[_0x913e('0x23')][_0x523d74['secondtransfereruniqueid']]){this[_0x913e('0x23')][_0x523d74[_0x913e('0x4f')]][_0x913e('0x49')]=!![];this[_0x913e('0x23')][_0x523d74[_0x913e('0x50')]]=this['channels'][_0x523d74['secondtransfereruniqueid']];this[_0x913e('0x51')](_0x523d74[_0x913e('0x4f')]);}}else if(!_[_0x913e('0x52')](this[_0x913e('0x23')][_0x523d74[_0x913e('0x50')]])){this[_0x913e('0x22')](_0x523d74[_0x913e('0x50')]);if(this['channels'][_0x523d74[_0x913e('0x53')]]){this[_0x913e('0x23')][_0x523d74[_0x913e('0x53')]][_0x913e('0x49')]=!![];this[_0x913e('0x23')][_0x523d74['transfereeuniqueid']]=this[_0x913e('0x23')][_0x523d74[_0x913e('0x53')]];this[_0x913e('0x51')](_0x523d74[_0x913e('0x53')]);}}}catch(_0x23fd2f){logger['error'](_0x913e('0x54'),_0x23fd2f[_0x913e('0x3c')]);}};Acw[_0x913e('0x19')]['syncBlindTransfer']=function(_0x4d3753){try{if(this[_0x913e('0x23')][_0x4d3753[_0x913e('0x55')]]){logger[_0x913e('0x1e')](_0x913e('0x56'),JSON[_0x913e('0x41')](_0x4d3753[_0x913e('0x55')]));this['startAcw'](_0x4d3753[_0x913e('0x55')]);}else if(this[_0x913e('0x23')][_0x4d3753['transfererlinkedid']]){logger['info'](_0x913e('0x57'),JSON[_0x913e('0x41')](_0x4d3753[_0x913e('0x58')]));this[_0x913e('0x22')](_0x4d3753[_0x913e('0x58')]);}}catch(_0x9aa2d3){logger[_0x913e('0x3a')](_0x913e('0x59'),_0x9aa2d3[_0x913e('0x3c')]);}};Acw[_0x913e('0x19')][_0x913e('0xf')]=function(_0x35b4be){try{if(this[_0x913e('0x6')][_0x35b4be[_0x913e('0x25')]]&&this['voiceQueues'][_0x35b4be[_0x913e('0x25')]][_0x913e('0x5a')]===_0x913e('0x5b')){if(this['agents'][_0x35b4be['interface']]){logger[_0x913e('0x1e')](_0x913e('0x5c'),_0x35b4be[_0x913e('0x1d')],_0x35b4be[_0x913e('0x24')],_0x35b4be[_0x913e('0x25')]);return RpcUser[_0x913e('0x31')](this[_0x913e('0x7')][_0x35b4be[_0x913e('0x24')]],_0x913e('0x5d'),_0x35b4be[_0x913e('0x1d')]);}}}catch(_0x3c06ba){logger[_0x913e('0x3a')](_0x913e('0x5e'),_0x3c06ba[_0x913e('0x3c')]);}};Acw[_0x913e('0x19')][_0x913e('0x51')]=function(_0x2e2ae5,_0x4d13b5=0x2710){if(this[_0x913e('0x23')][_0x2e2ae5]){setTimeout(()=>{delete this[_0x913e('0x23')][_0x2e2ae5];},_0x4d13b5);}};module[_0x913e('0x5f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index e2c59f1..01797bd 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 _0xa7d3=['error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','resolve','then','actionSipShowRegistry','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','asterisk','port','password','keepConnected','action','format','username','inspect'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7d3,0x103));var _0x3a7d=function(_0x464432,_0x57ce42){_0x464432=_0x464432-0x0;var _0x56fddb=_0xa7d3[_0x464432];return _0x56fddb;};'use strict';var Manager=require(_0x3a7d('0x0'));var BPromise=require(_0x3a7d('0x1'));var util=require(_0x3a7d('0x2'));var logger=require(_0x3a7d('0x3'))(_0x3a7d('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x3a7d('0x5')][_0x3a7d('0x6')],config[_0x3a7d('0x5')]['ip'],config[_0x3a7d('0x5')]['username'],config['asterisk'][_0x3a7d('0x7')],!![]);ami[_0x3a7d('0x8')]();ami['Action']=BPromise['promisify'](ami[_0x3a7d('0x9')]);function error(_0x188427){logger['error'](util[_0x3a7d('0xa')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x3a7d('0x5')][_0x3a7d('0xb')],config[_0x3a7d('0x5')]['ip'],config[_0x3a7d('0x5')][_0x3a7d('0x6')],util[_0x3a7d('0xc')](_0x188427,![],null)));}function close(){logger[_0x3a7d('0xd')](util['format'](_0x3a7d('0xe'),config[_0x3a7d('0x5')][_0x3a7d('0xb')],config[_0x3a7d('0x5')]['ip'],config[_0x3a7d('0x5')][_0x3a7d('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x3a7d('0xf')]({'action':_0x3a7d('0x10')});};};ami[_0x3a7d('0x11')]=function(){return function(){return ami[_0x3a7d('0xf')]({'action':_0x3a7d('0x12')});};};ami[_0x3a7d('0x13')]=function(){return function(){return ami[_0x3a7d('0xf')]({'action':_0x3a7d('0x14')});};};ami[_0x3a7d('0x15')]=function(){return function(){return ami[_0x3a7d('0xf')]({'action':_0x3a7d('0x16')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x3a7d('0xf')]({'action':_0x3a7d('0x17')});};};function connect(){logger[_0x3a7d('0x18')](util[_0x3a7d('0xa')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x3a7d('0xb')],config['asterisk']['ip'],config['asterisk'][_0x3a7d('0x6')]));ami[_0x3a7d('0x19')](_0x3a7d('0xd'),error);ami['once'](_0x3a7d('0x1a'),close);}ami['on'](_0x3a7d('0x1b'),connect);ami['on']('shutdown',function(_0x523e6f){logger[_0x3a7d('0x18')](util[_0x3a7d('0xa')](_0x3a7d('0x1c'),config[_0x3a7d('0x5')][_0x3a7d('0xb')],config['asterisk']['ip'],config[_0x3a7d('0x5')][_0x3a7d('0x6')],util[_0x3a7d('0xc')](_0x523e6f,![],null)));});ami['on']('fullybooted',function(){logger[_0x3a7d('0x18')](util[_0x3a7d('0xa')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0x3a7d('0xb')],config[_0x3a7d('0x5')]['ip'],config[_0x3a7d('0x5')][_0x3a7d('0x6')]));return Promise[_0x3a7d('0x1d')]()[_0x3a7d('0x1e')](ami[_0x3a7d('0x1f')]())[_0x3a7d('0x1e')](ami[_0x3a7d('0x11')]())[_0x3a7d('0x1e')](ami[_0x3a7d('0x13')]())['then'](ami[_0x3a7d('0x15')]())[_0x3a7d('0x1e')](ami['actionCoreShowChannels']())['catch'](function(_0x19047e){logger['error'](_0x3a7d('0x20'),util[_0x3a7d('0xc')](_0x19047e,{'showHidden':![],'depth':null}));});});ami[_0x3a7d('0x19')](_0x3a7d('0xd'),error);ami[_0x3a7d('0x19')]('close',close);module[_0x3a7d('0x21')]=ami; \ No newline at end of file +var _0x75c8=['error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionSipPeerStatus','Action','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','actionDeviceStateList','then','catch','exports','bluebird','util','../../config/environment','port','asterisk','username','password','action'];(function(_0x90c9bd,_0x239952){var _0x33d18b=function(_0x4e0788){while(--_0x4e0788){_0x90c9bd['push'](_0x90c9bd['shift']());}};_0x33d18b(++_0x239952);}(_0x75c8,0x121));var _0x875c=function(_0x1bc294,_0x3121ba){_0x1bc294=_0x1bc294-0x0;var _0x591cef=_0x75c8[_0x1bc294];return _0x591cef;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x875c('0x0'));var util=require(_0x875c('0x1'));var logger=require('../../config/logger')('ami');var config=require(_0x875c('0x2'));var ami=new Manager(config['asterisk'][_0x875c('0x3')],config[_0x875c('0x4')]['ip'],config[_0x875c('0x4')][_0x875c('0x5')],config['asterisk'][_0x875c('0x6')],!![]);ami['keepConnected']();ami['Action']=BPromise['promisify'](ami[_0x875c('0x7')]);function error(_0x1ac9f7){logger[_0x875c('0x8')](util[_0x875c('0x9')](_0x875c('0xa'),config[_0x875c('0x4')]['username'],config[_0x875c('0x4')]['ip'],config[_0x875c('0x4')][_0x875c('0x3')],util['inspect'](_0x1ac9f7,![],null)));}function close(){logger[_0x875c('0x8')](util[_0x875c('0x9')](_0x875c('0xb'),config[_0x875c('0x4')][_0x875c('0x5')],config[_0x875c('0x4')]['ip'],config[_0x875c('0x4')][_0x875c('0x3')]));}ami[_0x875c('0xc')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x875c('0xd')]=function(){return function(){return ami[_0x875c('0xe')]({'action':_0x875c('0xf')});};};ami[_0x875c('0x10')]=function(){return function(){return ami['Action']({'action':_0x875c('0x11')});};};ami[_0x875c('0x12')]=function(){return function(){return ami[_0x875c('0xe')]({'action':_0x875c('0x13')});};};function connect(){logger['info'](util[_0x875c('0x9')](_0x875c('0x14'),config['asterisk'][_0x875c('0x5')],config[_0x875c('0x4')]['ip'],config[_0x875c('0x4')][_0x875c('0x3')]));ami[_0x875c('0x15')]('error',error);ami[_0x875c('0x15')](_0x875c('0x16'),close);}ami['on']('connect',connect);ami['on'](_0x875c('0x17'),function(_0x3bb9f0){logger[_0x875c('0x18')](util['format'](_0x875c('0x19'),config[_0x875c('0x4')][_0x875c('0x5')],config['asterisk']['ip'],config[_0x875c('0x4')][_0x875c('0x3')],util[_0x875c('0x1a')](_0x3bb9f0,![],null)));});ami['on'](_0x875c('0x1b'),function(){logger['info'](util[_0x875c('0x9')](_0x875c('0x1c'),config[_0x875c('0x4')][_0x875c('0x5')],config[_0x875c('0x4')]['ip'],config[_0x875c('0x4')][_0x875c('0x3')]));return Promise['resolve']()['then'](ami[_0x875c('0xc')]())['then'](ami[_0x875c('0x1d')]())[_0x875c('0x1e')](ami[_0x875c('0xd')]())[_0x875c('0x1e')](ami[_0x875c('0x10')]())[_0x875c('0x1e')](ami[_0x875c('0x12')]())[_0x875c('0x1f')](function(_0x182225){logger[_0x875c('0x8')]('[ami.js][fullybooted]',util[_0x875c('0x1a')](_0x182225,{'showHidden':![],'depth':null}));});});ami[_0x875c('0x15')](_0x875c('0x8'),error);ami['once'](_0x875c('0x16'),close);module[_0x875c('0x20')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index c094bb9..896c671 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 _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xda3f,0xec));var _0xfda3=function(_0x5e5420,_0x113913){_0x5e5420=_0x5e5420-0x0;var _0x2836dd=_0xda3f[_0x5e5420];return _0x2836dd;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x70e0,0x17b));var _0x070e=function(_0x26570a,_0xf75270){_0x26570a=_0x26570a-0x0;var _0x19a7f7=_0x70e0[_0x26570a];return _0x19a7f7;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 80e96c1..ad9ef4c 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 _0x5782=['Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','stack','error','inspect','contactsRescheduled','CONTACTS_RESCHEDULED','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','CAMPAIGN_STATUS','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20deactivated','Error','isTrunkReachable','active','status','reachable','unmonitored','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','timezones','content','indexOf','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','ivr','decrementOriginate','[syncAgentConnect]','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','outboundAnswerCallsDay','reason','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete]','type','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','queueCallerAbandonCreateState','rescheduleContact','add','ListId','CampaignId','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','voiceQueue','dialAbandonedMaxRetry','minutes','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','merge','idHopper','[syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','run','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','ContactId','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[booked][unlock3]','syncOriginateResponse','getQueue','response','Success','[syncOriginateResponse]','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','countbusyretry','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','dialQueueProject','[syncHangup]','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangup2]','outboundUnknownCallsDay','[syncHangup][createHistory]','syncQueueSummary','queuesSummary','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','clearZombieChannels','[uniqueid]','[actions]','enqueue','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerId','TrunkBackup','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','callProgressDetecting','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','getSeconds','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','checkIsBlackList','[actionOriginate]','[handlePredictive][limitChannel]','tryOriginatePredictive','checkContactLowerLimitOriginate','[countReScheduled]\x20','checkContactBlack','[actionOriginatePredictive]','[getContactCampaign2]','--------\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','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\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]','p\x20=\x20','Umin\x20=\x20','util','lodash','uuid','moment','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','bind','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5782,0x1d5));var _0x2578=function(_0x4791c6,_0x293adf){_0x4791c6=_0x4791c6-0x0;var _0x52b5d3=_0x5782[_0x4791c6];return _0x52b5d3;};'use strict';var util=require(_0x2578('0x0'));var _=require(_0x2578('0x1'));var uuid=require(_0x2578('0x2'));var moment=require(_0x2578('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require('./utils');var hopperUtils=require(_0x2578('0x4'));var ut=require(_0x2578('0x5'));var config=require(_0x2578('0x6'));var logger=require(_0x2578('0x7'))(_0x2578('0x8'));var loggerBooked=require(_0x2578('0x7'))(_0x2578('0x9'));var loggerPredictive=require(_0x2578('0x7'))(_0x2578('0xa'));var loggerPredictiveCalls=require(_0x2578('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require('../ami');config[_0x2578('0xb')]=_[_0x2578('0xc')](config['redis'],{'host':_0x2578('0xd'),'port':0x18eb});var io=require(_0x2578('0xe'))(new Redis(config[_0x2578('0xb')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x2578('0xf'));var RpcSetting=require(_0x2578('0x10'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0x2578('0x11'));var Final=require(_0x2578('0x12'));var AgentComplete=require(_0x2578('0x13'));var QueueCallerAbandon=require(_0x2578('0x14'));var Hangup=require(_0x2578('0x15'));var ipAgi=process[_0x2578('0x16')][_0x2578('0x17')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x2578('0x18')]['enqueue']=function(_0x901649){this[_0x2578('0x19')]=this['tail']?this[_0x2578('0x19')][_0x2578('0x1a')](_0x901649):_0x901649();};function Dialer(_0x27e78a,_0x23bc4b){this[_0x2578('0x1b')]=new Sequence();this[_0x2578('0x1c')]=_0x23bc4b;this['voiceQueues']=_0x27e78a[_0x2578('0x1d')];this[_0x2578('0x1e')]=_0x27e78a[_0x2578('0x1e')];this[_0x2578('0x1f')]=_0x27e78a[_0x2578('0x1f')];this[_0x2578('0x20')]=_0x27e78a['trunks'];this[_0x2578('0x21')]=config[_0x2578('0x21')]||0x2;this['channels']={};this[_0x2578('0x22')]={};this[_0x2578('0x23')]={};this[_0x2578('0x24')]={};this[_0x2578('0x25')]={};this[_0x2578('0x26')]={};this[_0x2578('0x27')]={};this[_0x2578('0x28')]={};this[_0x2578('0x29')]={};this[_0x2578('0x2a')]={};this['queuesSummary']={};ami['on']('agentconnect',this['syncAgentConnect'][_0x2578('0x2b')](this));ami['on'](_0x2578('0x2c'),this[_0x2578('0x2d')][_0x2578('0x2b')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x2578('0x2b')](this));ami['on'](_0x2578('0x2e'),this[_0x2578('0x2f')][_0x2578('0x2b')](this));ami['on'](_0x2578('0x30'),this['syncQueueSummary'][_0x2578('0x2b')](this));ami['on']('custom:queuesummarycomplete',this[_0x2578('0x31')][_0x2578('0x2b')](this));ami['on'](_0x2578('0x32'),this[_0x2578('0x33')]['bind'](this));ami['on'](_0x2578('0x34'),this[_0x2578('0x35')][_0x2578('0x2b')](this));ami['on'](_0x2578('0x36'),this[_0x2578('0x37')]['bind'](this));ami['on']('queuemember',this['syncQueueMember'][_0x2578('0x2b')](this));ami['on']('queuestatuscomplete',this[_0x2578('0x38')][_0x2578('0x2b')](this));this[_0x2578('0x39')]();this[_0x2578('0x3a')]();RpcSetting['getSettings']()[_0x2578('0x3b')](function(_0x502b79){previewRecallmeReminderInterval=_0x502b79[_0x2578('0x3c')];});}function isNotNull(_0x4e7f7e){return _0x4e7f7e!==null&&!_[_0x2578('0x3d')](_0x4e7f7e);}function msgResponse(_0x104d64,_0x38c1ea,_0x4631b3){return{'action':_0x104d64,'response':_0x38c1ea,'message':_0x4631b3,'stack':_0x4631b3};}function emit(_0x40aa99,_0x422c9d,_0x48957e){io['to'](_0x40aa99)[_0x2578('0x3e')](_0x422c9d,_0x48957e);}function emitOutboundVoiceQueueSummary(_0x432cd2){if(_0x432cd2['type']===_0x2578('0x3f')){logger[_0x2578('0x40')](_0x2578('0x41'),util['inspect'](_0x432cd2,{'showHidden':![],'depth':null}));emit(util[_0x2578('0x42')](_0x2578('0x43'),_0x432cd2[_0x2578('0x44')]),_0x2578('0x45'),_0x432cd2);}}function checkGetDataPredictive(_0x2e5198){if(isNotNull(_0x2e5198)&&!_[_0x2578('0x46')](_0x2e5198)){loggerPredictive[_0x2578('0x47')](_0x2578('0x48'));loggerPredictive['info'](_0x2578('0x49'),_0x2e5198[_0x2578('0x4a')]);loggerPredictive[_0x2578('0x47')](_0x2578('0x4b'),_0x2e5198[_0x2578('0x4c')]);loggerPredictive['info'](_0x2578('0x4d'),_0x2e5198[_0x2578('0x4e')]);loggerPredictive[_0x2578('0x47')](_0x2578('0x4f'),_0x2e5198['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x2578('0x50'),_0x2e5198[_0x2578('0x51')]);loggerPredictive[_0x2578('0x47')](_0x2578('0x52'),_0x2e5198[_0x2578('0x53')]);loggerPredictive['info'](_0x2578('0x54'));if(_0x2e5198['predictiveIntervalTotalCalls']>0x0){if(!_[_0x2578('0x3d')](_0x2e5198[_0x2578('0x53')])&&_0x2e5198[_0x2578('0x53')]>0x0){return!![];}loggerPredictive[_0x2578('0x47')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x2e5198['predictiveIntervalAvgHoldtime'])&&_0x2e5198['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x2578('0x47')](_0x2578('0x55'));}else{loggerPredictive['info'](_0x2578('0x56'));}}else{loggerPredictive[_0x2578('0x47')](_0x2578('0x57'));}return![];}function mergeDataErlangB(_0x2e0994){return function(_0x3e2f9f){loggerPredictive[_0x2578('0x47')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x2578('0x47')](_0x2578('0x58'),_0x3e2f9f[_0x2578('0x59')]);loggerPredictive['info'](_0x2578('0x5a'),_0x3e2f9f['erlangCallToSecond']);loggerPredictive[_0x2578('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e2f9f[_0x2578('0x5b')]);loggerPredictive[_0x2578('0x47')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e2f9f['erlangBusyFactor']);loggerPredictive[_0x2578('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e2f9f[_0x2578('0x5b')]);loggerPredictive['info']('---------------------------');_['merge'](_0x2e0994,_0x3e2f9f);};}function ifInterval(_0x5902ac,_0xb0793b){if(_['isUndefined'](_0xb0793b)){return![];}return utils['getSeconds'](undefined,_0xb0793b)<_0x5902ac*0x3c;}function clearPredictiveAttributes(_0x1cd7fb){if(_0x1cd7fb[_0x2578('0x27')]){_0x1cd7fb[_0x2578('0x27')]=undefined;loggerPredictive[_0x2578('0x40')](_0x1cd7fb['name'],_0x2578('0x5c'));}if(_0x1cd7fb[_0x2578('0x26')]){_0x1cd7fb[_0x2578('0x26')]=undefined;loggerPredictive[_0x2578('0x40')](_0x1cd7fb[_0x2578('0x44')],'startPredictive\x20value\x20cleared');}if(_0x1cd7fb[_0x2578('0x5d')]){clearInterval(_0x1cd7fb[_0x2578('0x5d')]);_0x1cd7fb[_0x2578('0x5d')]=undefined;loggerPredictive[_0x2578('0x40')](_0x1cd7fb[_0x2578('0x44')],_0x2578('0x5e'));}}function loggerCatchPredictive(_0x4ce5c6,_0x33df6a){return function(_0x17b2ba){loggerPredictive['error'](_0x33df6a['name'],_0x4ce5c6);loggerPredictive['error'](_0x17b2ba[_0x2578('0x5f')]);clearPredictiveAttributes(_0x33df6a);};}function loggerCatch(_0x117682){return function(_0x555ad2){logger[_0x2578('0x60')](_0x117682,util[_0x2578('0x61')](_0x555ad2,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3bd98e){return function(_0x3de3e7){if(isNotNull(_0x3de3e7)&&isNotNull(_0x3de3e7[0x0])){if(_0x3de3e7[0x0][_0x2578('0x62')]>0x0){_0x3bd98e['message']=utils['CAMPAIGN_STATUS'][_0x2578('0x63')];logger[_0x2578('0x47')]('[getContactDialer2][ReScheduled]'+_0x3bd98e['name'],_0x3de3e7[0x0][_0x2578('0x62')],_0x2578('0x64'));}else{_0x3bd98e[_0x2578('0x65')]=utils['CAMPAIGN_STATUS'][_0x2578('0x66')];logger[_0x2578('0x47')](_0x2578('0x67')+_0x3bd98e[_0x2578('0x44')]);}}};}function createObjHistory(_0x2e3f7b,_0x4d4da8,_0x1075a6,_0x371219,_0xda73aa){_0x2e3f7b[_0x2578('0x65')]=_0x1075a6;var _0x46e63b=new Action(_0x2e3f7b,_0x4d4da8);var _0x218488=new History(_0x46e63b);_0x218488[_0x2578('0x68')]=_0x371219;_0x218488[_0x2578('0x69')]=_0xda73aa;_0x218488['endtime']=_0x46e63b['starttime'];return _0x218488;}function unlockQueueStatus(_0x14f4d1,_0x42e490){setTimeout(function(){if(_['isUndefined'](_0x14f4d1[_0x2578('0x6a')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x42e490);}_0x14f4d1[_0x2578('0x6a')]=!![];loggerBooked[_0x2578('0x47')](_0x2578('0x6b'),_0x42e490,JSON[_0x2578('0x6c')](_[_0x2578('0x6d')](_0x14f4d1,[_0x2578('0x44'),_0x2578('0x6a')])));},0x1f3);}function checkInterval(_0x5de32b){return function(){if(!isNotNull(_0x5de32b[_0x2578('0x6e')])){_0x5de32b[_0x2578('0x65')]=utils[_0x2578('0x6f')][_0x2578('0x70')];throw _0x5de32b[_0x2578('0x44')]+_0x2578('0x71');}if(!isNotNull(_0x5de32b[_0x2578('0x6e')]['Intervals'])){_0x5de32b[_0x2578('0x65')]=utils['CAMPAIGN_STATUS'][_0x2578('0x70')];throw _0x5de32b[_0x2578('0x44')]+_0x2578('0x71');}if(!isNotNull(_['isEmpty'](_0x5de32b['Interval'][_0x2578('0x72')]))){_0x5de32b[_0x2578('0x65')]=utils[_0x2578('0x6f')][_0x2578('0x70')];throw _0x5de32b[_0x2578('0x44')]+_0x2578('0x71');}};}function checkIsIVRCampaignActive(_0x138f92){return function(){if(!utils[_0x2578('0x73')](_0x138f92)){_0x138f92[_0x2578('0x65')]=utils[_0x2578('0x6f')]['INACTIVE'];throw _0x138f92[_0x2578('0x44')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x3aec5d){if(utils[_0x2578('0x74')](_0x3aec5d)){emit(util[_0x2578('0x42')](_0x2578('0x75'),_0x3aec5d['name']),_0x2578('0x76'),_0x3aec5d);}}function loggerCatchQueueSummary(_0x43ed20,_0x249d52){return function(_0x1b36b3){clearPredictiveAttributes(_0x249d52);emitCampaignSummary(_0x249d52);loggerSyncQueueSummary[_0x2578('0x40')](_0x43ed20,util['inspect'](_0x1b36b3,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x15727c){if(_0x15727c[_0x2578('0x77')]){if(_0x15727c[_0x2578('0x78')]===0x0){_0x15727c['sendMessageOneNotActive']=![];_0x15727c[_0x2578('0x65')]=utils['CAMPAIGN_STATUS'][_0x2578('0x79')];loggerSyncQueueSummary[_0x2578('0x40')](_0x2578('0x7a'),_0x15727c[_0x2578('0x44')],'is\x20not\x20active');}else{_0x15727c[_0x2578('0x65')]=utils[_0x2578('0x6f')][_0x2578('0x7b')];loggerSyncQueueSummary[_0x2578('0x40')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x15727c[_0x2578('0x44')],_0x2578('0x7c'));}emitCampaignSummary(_0x15727c);}}function myreject(_0x385e2e){return function(_0x571992){return _0x385e2e(msgResponse('[ifTime][Action]',_0x2578('0x7d'),JSON[_0x2578('0x6c')](_0x571992)));};}Dialer[_0x2578('0x18')][_0x2578('0x7e')]=function(_0x2e97a7){return!_['isUndefined'](_0x2e97a7)&&_0x2e97a7&&!_[_0x2578('0x3d')](_0x2e97a7['name'])&&!_[_0x2578('0x3d')](_0x2e97a7[_0x2578('0x7f')])&&_0x2e97a7[_0x2578('0x7f')]&&(this[_0x2578('0x20')][util[_0x2578('0x42')]('SIP/%s',_0x2e97a7[_0x2578('0x44')])][_0x2578('0x80')]===_0x2578('0x81')||this['trunks'][util['format']('SIP/%s',_0x2e97a7[_0x2578('0x44')])][_0x2578('0x80')]===_0x2578('0x82'));};Dialer['prototype']['checkIsTrunkReachable']=function(_0x4692cf){var _0x5e9211=this;return function(){if(!_0x5e9211[_0x2578('0x7e')](_0x4692cf[_0x2578('0x83')])){if(!_0x5e9211['isTrunkReachable'](_0x4692cf['TrunkBackup'])){_0x4692cf['message']=utils[_0x2578('0x6f')][_0x2578('0x84')];throw _0x4692cf[_0x2578('0x44')]+_0x2578('0x85');}}};};Dialer[_0x2578('0x18')][_0x2578('0x86')]=function(_0x411619,_0x5b03eb,_0x2ae6ae,_0x24cbab){var _0x4793a0=this;return function(){var _0x52ecfd=!![];return _0x4793a0['ifTimeIvr'](_0x411619,_0x5b03eb,_0x2ae6ae,_0x24cbab,_0x52ecfd);};};Dialer['prototype'][_0x2578('0x87')]=function(_0x18351a,_0xb281db,_0x59f790,_0x5150a9){var _0x32fd02=this;return function(){var _0x5f25c0=![];return _0x32fd02[_0x2578('0x88')](_0x18351a[_0x2578('0x72')],_0xb281db,_0x59f790,_0x5150a9,_0x5f25c0);};};Dialer['prototype'][_0x2578('0x88')]=function(_0x31a11d,_0x3663dc,_0x344239,_0x590e0b,_0x4642e6){var _0x3a9e91=[];return new Promise(function(_0x5be480,_0x1f688b){if(!isNotNull(_0x31a11d)){_0x590e0b[_0x2578('0x65')]=utils[_0x2578('0x6f')][_0x2578('0x70')];return _0x1f688b(msgResponse(_0x2578('0x89'),'Failure',_0x344239+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x2578('0x46')](_0x31a11d)){_0x590e0b[_0x2578('0x65')]=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0x1f688b(msgResponse(_0x2578('0x89'),_0x2578('0x8a'),_0x344239+'\x20Intervals\x20is\x20empty\x20'));}if(_0x3663dc&&_['isUndefined'](config['timezones'][_0x3663dc])){_0x590e0b[_0x2578('0x65')]=utils['CAMPAIGN_STATUS'][_0x2578('0x8b')];return _0x1f688b(msgResponse(_0x2578('0x89'),_0x2578('0x8a'),_0x344239+_0x2578('0x8c')+_0x3663dc));}if(_[_0x2578('0x8d')](_0x31a11d)){for(var _0x218b52=0x0;_0x218b52<_0x31a11d[_0x2578('0x8e')];_0x218b52+=0x1){_0x3a9e91[_0x2578('0x8f')](ami[_0x2578('0x90')]({'action':_0x2578('0x91'),'command':util[_0x2578('0x42')]('iftime\x20%s,%s',_0x31a11d[_0x218b52][_0x2578('0x92')],!_[_0x2578('0x3d')](config[_0x2578('0x93')][_0x3663dc])?_0x3663dc:'')})[_0x2578('0x3b')](function(_0x23c852){return _0x23c852[_0x2578('0x94')][_0x2578('0x95')](_0x2578('0x96'))>=0x0;})[_0x2578('0x97')](myreject(_0x1f688b)));}}else{_0x3a9e91[_0x2578('0x8f')](ami[_0x2578('0x90')]({'action':_0x2578('0x91'),'command':util[_0x2578('0x42')]('iftime\x20%s,%s',_0x31a11d,!_[_0x2578('0x3d')](config[_0x2578('0x93')][_0x3663dc])?_0x3663dc:'')})[_0x2578('0x3b')](function(_0x147dd6){return _0x147dd6[_0x2578('0x94')][_0x2578('0x95')]('true')>=0x0;})['catch'](myreject(_0x1f688b)));}Promise[_0x2578('0x98')](_0x3a9e91)[_0x2578('0x3b')](function(_0x4997c8){var _0x17362d=_[_0x2578('0x99')](_0x4997c8);if(_0x17362d){return _0x5be480(_0x17362d);}else{_0x590e0b[_0x2578('0x65')]=_0x4642e6?utils[_0x2578('0x6f')][_0x2578('0x9a')]:utils[_0x2578('0x6f')][_0x2578('0x9b')];return _0x1f688b(msgResponse(_0x2578('0x9c'),_0x2578('0x8a'),_0x2578('0x9d')+_0x4642e6+'\x20'+_0x344239+_0x2578('0x9e')+util[_0x2578('0x61')](_0x31a11d,{'showHidden':![],'depth':null})+_0x2578('0x9f')+_0x3663dc));}})[_0x2578('0x97')](function(_0xdb9649){return _0x1f688b(msgResponse(_0x2578('0x89'),_0x2578('0x8a'),JSON['stringify'](_0xdb9649)));});});};Dialer[_0x2578('0x18')][_0x2578('0x39')]=function(){var _0x5f0da8=this;return cmHopper[_0x2578('0xa0')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x5f0da8[_0x2578('0xa1')]();},0x3e8);});};Dialer['prototype'][_0x2578('0xa1')]=function(){var _0x1d7b79=this;var _0x2452c0;for(var _0xbd7625 in this[_0x2578('0x1e')]){if(typeof this[_0x2578('0x1e')][_0xbd7625]!==_0x2578('0xa2')){_0x2452c0=this['campaigns'][_0xbd7625];if(utils[_0x2578('0x74')](_0x2452c0)&&utils[_0x2578('0x73')](_0x2452c0)){_0x2452c0[_0x2578('0x77')]=!![];Promise[_0x2578('0xa3')]()[_0x2578('0x3b')](checkIsIVRCampaignActive(_0x2452c0))[_0x2578('0x3b')](checkInterval(_0x2452c0))[_0x2578('0x3b')](_0x1d7b79[_0x2578('0xa4')](_0x2452c0))[_0x2578('0x3b')](_0x1d7b79[_0x2578('0x86')](_0x2452c0['dialGlobalInterval'],_0x2452c0[_0x2578('0xa5')],_0x2452c0['name'],_0x2452c0))[_0x2578('0x3b')](_0x1d7b79[_0x2578('0x87')](_0x2452c0[_0x2578('0x6e')],_0x2452c0['dialTimezone'],_0x2452c0[_0x2578('0x44')],_0x2452c0))['then'](_0x1d7b79['launchHandleIvr'](_0x2452c0))[_0x2578('0x97')](loggerCatchQueueSummary(_0x2578('0xa6'),_0x2452c0));}else{notSendMessagesCampaign(_0x2452c0);}}}};Dialer[_0x2578('0x18')][_0x2578('0xa7')]=function(_0x16e752){if(_0x16e752[_0x2578('0xa8')]!=='predictive'){clearPredictiveAttributes(_0x16e752);}switch(_0x16e752['dialMethod']){case _0x2578('0xa9'):this[_0x2578('0xaa')](_0x16e752,0x1);break;case _0x2578('0xab'):this[_0x2578('0xaa')](_0x16e752,_0x16e752[_0x2578('0xac')]);break;case'predictive':this[_0x2578('0xa')](_0x16e752);break;case _0x2578('0x9'):this['handlePower'](_0x16e752,0x1);break;default:logger[_0x2578('0x60')](_0x2578('0xad'),_0x16e752[_0x2578('0x44')],'method\x20not\x20recognized');}};Dialer[_0x2578('0x18')][_0x2578('0x89')]=function(_0x25732e,_0x41a614){var _0x26d09d=_0x25732e['dialTimezone'];var _0x291ba9=_0x41a614?_0x25732e[_0x2578('0xae')]:_0x25732e[_0x2578('0x6e')]['Intervals'];logger['silly'](_0x2578('0xaf'),_0x291ba9,_0x26d09d,_0x25732e[_0x2578('0x44')],util['format'](_0x2578('0xb0'),_0x25732e['name'],_0x25732e['id']));var _0x2c3542=null;return Interval['intervalIftime'](_0x291ba9,_0x26d09d)[_0x2578('0x3b')](function(_0x55775e){if(_0x55775e===!![]){return _0x55775e;}else{_0x25732e[_0x2578('0x65')]=_0x41a614?utils[_0x2578('0x6f')][_0x2578('0x9a')]:utils[_0x2578('0x6f')][_0x2578('0x9b')];_0x2c3542=msgResponse(_0x2578('0x9c'),'Failure',_0x2578('0x9d')+_0x41a614+'\x20'+_0x25732e[_0x2578('0x44')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x2578('0x61')](_0x291ba9,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x26d09d);}if(_0x2c3542!==null){logger[_0x2578('0xb1')](_0x2578('0xb2'),_0x2c3542);_0x2c3542[_0x2578('0xb3')]=_0x41a614;throw _0x2c3542;}})[_0x2578('0x97')](function(_0x174ee0){logger[_0x2578('0x60')](_0x2578('0xb4'),_0x174ee0);throw msgResponse(_0x2578('0xb5'),_0x2578('0x7d'),util[_0x2578('0x61')](_0x174ee0,{'showHidden':![],'depth':null}));});};Dialer[_0x2578('0x18')]['syncAgentConnect']=function(_0x472564){if(this['voiceQueues'][_0x472564['queue']]){if(this['uniqueId'][_0x472564['uniqueid']]&&this[_0x2578('0x24')][_0x472564['uniqueid']]['type']!==_0x2578('0xb6')){utils[_0x2578('0xb7')](this[_0x2578('0x1d')][_0x472564['queue']],_0x2578('0xb8'));this[_0x2578('0x24')][_0x472564[_0x2578('0xb9')]]['answertime']=moment()[_0x2578('0x42')](_0x2578('0xba'));}}};Dialer['prototype'][_0x2578('0x2f')]=function(_0x572991){var _0x5100cd=this[_0x2578('0x24')][_0x572991[_0x2578('0xb9')]];if(this[_0x2578('0x1d')][_0x572991[_0x2578('0xbb')]]){if(_0x5100cd&&_0x5100cd['type']!=='ivr'){delete this['uniqueId'][_0x572991[_0x2578('0xb9')]];this[_0x2578('0x1d')][_0x572991[_0x2578('0xbb')]][_0x2578('0xbc')]+=0x1;var _0x2b86f5=new AgentComplete(_0x5100cd,_0x572991);if(_0x572991[_0x2578('0xbd')]==='agent'){_0x2b86f5['agiafterat']=this[_0x2578('0x1d')][_0x572991[_0x2578('0xbb')]][_0x2578('0xbe')]&&this[_0x2578('0x1d')][_0x572991[_0x2578('0xbb')]][_0x2578('0xbf')]?moment()[_0x2578('0x42')](_0x2578('0xba')):undefined;}hopperUtils[_0x2578('0xc0')](_0x2b86f5)[_0x2578('0x97')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x2b86f5)['catch'](loggerCatch(_0x2578('0xc1')));}}};Dialer[_0x2578('0x18')]['syncQueueCallerAbandon']=function(_0x22f169){var _0x40c9e3=this['uniqueId'][_0x22f169[_0x2578('0xb9')]];var _0xdc811d=this;var _0x5ba940=![];var _0x25b6f7;var _0xd4fa16;if(this['voiceQueues'][_0x22f169[_0x2578('0xbb')]]){if(_0x40c9e3&&_0x40c9e3[_0x2578('0xc2')]!==_0x2578('0xb6')){delete this['uniqueId'][_0x22f169[_0x2578('0xb9')]];utils[_0x2578('0xb7')](this['voiceQueues'][_0x22f169[_0x2578('0xbb')]],_0x2578('0xc3'));_0x40c9e3[_0x2578('0xc4')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x563ef1=new QueueCallerAbandon(_0x40c9e3,_0x22f169);if(utils['getSeconds'](_0x40c9e3[_0x2578('0xc4')],_0x40c9e3[_0x2578('0xc5')])>=_0x40c9e3[_0x2578('0xc6')]){this['voiceQueues'][_0x22f169['queue']][_0x2578('0x4e')]+=0x1;this[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]][_0x2578('0xc7')]+=0x1;this[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]][_0x2578('0xc8')]+=0x1;_0x563ef1[_0x2578('0x68')]=0xa;_0x563ef1['statedesc']=_0x2578('0xc9');_0x563ef1[_0x2578('0xca')]='TIMEOUT';_0x563ef1['agiafterat']=this['voiceQueues'][_0x22f169[_0x2578('0xbb')]][_0x2578('0xbe')]?moment()[_0x2578('0x42')](_0x2578('0xba')):undefined;_0x563ef1[_0x2578('0xcb')]+=0x1;_0x563ef1[_0x2578('0xcc')]+=0x1;_0x25b6f7=this[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]][_0x2578('0xcd')];_0xd4fa16=this[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]][_0x2578('0xce')];hopperUtils[_0x2578('0xcf')](_0x563ef1,_0x563ef1['state'],_0x40c9e3['voiceQueue'])['then'](function(_0x500c68){_0x5ba940=_0x500c68[_0x2578('0xd0')]==0x1;if(_0x563ef1[_0x2578('0xcb')]>=_0xdc811d[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]]['dialDropMaxRetry']){_0xdc811d[_0x2578('0xd1')](_0x563ef1,_0x500c68[_0x2578('0xd0')]);}else{hopperUtils[_0x2578('0xd2')]({'active':![],'countdropretry':_0x563ef1[_0x2578('0xcb')],'scheduledat':moment()[_0x2578('0xd3')](_0xdc811d[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]]['dialDropRetryFrequency'],'minutes')[_0x2578('0x42')](_0x2578('0xba')),'ContactId':_0x40c9e3['ContactId'],'ListId':_0x40c9e3[_0x2578('0xd4')],'VoiceQueueId':_0x40c9e3['VoiceQueueId']||undefined,'CampaignId':_0x40c9e3[_0x2578('0xd5')]||undefined})['catch'](loggerCatch(_0x2578('0xd6')));var _0x14c4e6=new History(_0x563ef1);_0x14c4e6['state']=0xa;_0x14c4e6['statedesc']=_0x2578('0xc9');_0x14c4e6[_0x2578('0xd7')]=moment()[_0x2578('0x42')](_0x2578('0xba'));_0x14c4e6[_0x2578('0xd8')]=_0x14c4e6[_0x2578('0xd7')];_0x14c4e6[_0x2578('0xd9')]=_0x563ef1[_0x2578('0xd9')];_0x14c4e6[_0x2578('0xda')]=_0x563ef1[_0x2578('0xda')];hopperUtils[_0x2578('0xc0')](_0x14c4e6)[_0x2578('0x97')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x2578('0x3b')](function(){if(_0x5ba940)hopperUtils[_0x2578('0xdb')](_0x563ef1,_0x25b6f7,_0xd4fa16)[_0x2578('0x3b')](function(){return 0x1;});});}else{this[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]][_0x2578('0xdc')]+=0x1;this[_0x2578('0x1d')][_0x22f169['queue']][_0x2578('0xdd')]+=0x1;_0x563ef1[_0x2578('0x68')]=0xb;_0x563ef1[_0x2578('0x69')]=_0x2578('0xde');_0x563ef1[_0x2578('0xca')]=_0x2578('0xdf');_0x563ef1[_0x2578('0xe0')]+=0x1;_0x563ef1['countglobal']+=0x1;_0x25b6f7=this[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]][_0x2578('0xe1')];_0xd4fa16=this[_0x2578('0x1d')][_0x22f169['queue']][_0x2578('0xce')];hopperUtils[_0x2578('0xcf')](_0x563ef1,_0x563ef1[_0x2578('0x68')],_0x40c9e3[_0x2578('0xe2')])['then'](function(_0x1de9ca){if(_0x563ef1[_0x2578('0xe0')]>=_0xdc811d[_0x2578('0x1d')][_0x22f169[_0x2578('0xbb')]][_0x2578('0xe3')]){_0xdc811d[_0x2578('0xd1')](_0x563ef1,_0x1de9ca['additional']);}else{hopperUtils[_0x2578('0xd2')]({'active':![],'countabandonedretry':_0x563ef1[_0x2578('0xe0')],'scheduledat':moment()['add'](_0xdc811d[_0x2578('0x1d')][_0x22f169['queue']][_0x2578('0xe1')],_0x2578('0xe4'))[_0x2578('0x42')](_0x2578('0xba')),'ContactId':_0x40c9e3['ContactId'],'ListId':_0x40c9e3[_0x2578('0xd4')],'VoiceQueueId':_0x40c9e3[_0x2578('0xe5')]||undefined,'CampaignId':_0x40c9e3['CampaignId']||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0xe6')));var _0x38f673=new History(_0x563ef1);_0x38f673['state']=0xb;_0x38f673[_0x2578('0x69')]=_0x2578('0xde');_0x38f673['starttime']=moment()['format'](_0x2578('0xba'));_0x38f673[_0x2578('0xd8')]=_0x38f673[_0x2578('0xd7')];_0x38f673['calleridname']=_0x563ef1[_0x2578('0xd9')];_0x38f673[_0x2578('0xda')]=_0x563ef1['calleridnum'];hopperUtils[_0x2578('0xc0')](_0x38f673)[_0x2578('0x97')](loggerCatch(_0x2578('0xe7')));}})['then'](function(){if(_0x5ba940)hopperUtils[_0x2578('0xdb')](_0x563ef1,_0x25b6f7,_0xd4fa16)[_0x2578('0x3b')](function(){return 0x1;});});}}}};Dialer[_0x2578('0x18')][_0x2578('0x35')]=function(_0x597511){if(this[_0x2578('0x22')][_0x597511[_0x2578('0xb9')]]){this[_0x2578('0x22')][_0x597511[_0x2578('0xb9')]][_0x2578('0xe8')]=_0x597511[_0x2578('0xe8')];}if(this[_0x2578('0x24')][_0x597511[_0x2578('0xb9')]]){this[_0x2578('0x24')][_0x597511['uniqueid']][_0x2578('0xe8')]=_0x597511[_0x2578('0xe8')];}};Dialer['prototype'][_0x2578('0xe9')]=function(_0x140a6f){if(!this['actions'][_0x140a6f[_0x2578('0xea')]]){return;}var _0x4d8b6b=this[_0x2578('0x1d')][this[_0x2578('0x22')][_0x140a6f['actionid']][_0x2578('0xbb')]][_0x2578('0xeb')]||_0x2578('0xec');if(_0x4d8b6b===_0x2578('0xed')){if(this['actions'][_0x140a6f[_0x2578('0xea')]]&&_[_0x2578('0xee')](this[_0x2578('0x22')][_0x140a6f[_0x2578('0xea')]][_0x2578('0xef')])&&_0x140a6f[_0x2578('0x80')]==='1'&&_0x140a6f[_0x2578('0xf0')]==='0'){if(this[_0x2578('0x1f')][_0x140a6f[_0x2578('0xf1')]]){if(!this[_0x2578('0x1f')][_0x140a6f[_0x2578('0xf1')]][_0x2578('0xef')]){this['agents'][_0x140a6f[_0x2578('0xf1')]][_0x2578('0xef')]=!![];this['actions'][_0x140a6f['actionid']][_0x2578('0xef')]=!![];this['actions'][_0x140a6f[_0x2578('0xea')]][_0x2578('0xf1')]=_0x140a6f['stateinterface'];}}}}else if(_0x4d8b6b===_0x2578('0xec')){if(this[_0x2578('0x22')][_0x140a6f['actionid']]){if(this[_0x2578('0x1f')][_0x140a6f[_0x2578('0xf1')]]){this[_0x2578('0x22')][_0x140a6f[_0x2578('0xea')]]['stateinterface']=_0x140a6f[_0x2578('0xf1')];if(_[_0x2578('0xee')](this[_0x2578('0x29')][this['actions'][_0x140a6f[_0x2578('0xea')]][_0x2578('0xbb')]])){this[_0x2578('0x29')][this[_0x2578('0x22')][_0x140a6f['actionid']]['queue']]=[];}this[_0x2578('0x29')][this['actions'][_0x140a6f[_0x2578('0xea')]][_0x2578('0xbb')]]['push'](_[_0x2578('0xf2')](_['pick'](this['actions'][_0x140a6f[_0x2578('0xea')]],[_0x2578('0xf3'),_0x2578('0xf1')]),{'status':_0x140a6f[_0x2578('0x80')],'paused':_0x140a6f[_0x2578('0xf0')]}));}}}};Dialer[_0x2578('0x18')][_0x2578('0x38')]=function(_0x2bcb99){if(!this[_0x2578('0x22')][_0x2bcb99['actionid']]){return;}var _0x36cff2=this;var _0x393fe6=this[_0x2578('0x1d')][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xbb')]];var _0x50199d=_0x393fe6[_0x2578('0xeb')]||'rrmemory';if(_0x50199d==='roundrobin'){if(this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]]&&this[_0x2578('0x22')][_0x2bcb99['actionid']][_0x2578('0xf1')]){this[_0x2578('0x1c')]['run'](this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xf3')],this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xf1')])[_0x2578('0x97')](function(_0xf74a4c){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x2578('0x61')](_0xf74a4c,{'showHidden':![],'depth':null}));})[_0x2578('0x1a')](function(){utils[_0x2578('0xb7')](_0x36cff2['voiceQueues'][_0x36cff2[_0x2578('0x22')][_0x2bcb99['actionid']]['queue']],'[syncQueueStatusComplete]');_0x36cff2[_0x2578('0x1f')][_0x36cff2[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xf1')]][_0x2578('0xef')]=![];delete _0x36cff2[_0x2578('0x22')][_0x2bcb99['actionid']];unlockQueueStatus(_0x393fe6);});}else{utils[_0x2578('0xb7')](this[_0x2578('0x1d')][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xbb')]],_0x2578('0xf4'));hopperUtils[_0x2578('0xd2')]({'active':![],'ContactId':this[_0x2578('0x22')][_0x2bcb99['actionid']]['ContactId'],'ListId':this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xd4')],'VoiceQueueId':this['actions'][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xe5')]||undefined,'CampaignId':this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]]['CampaignId']||undefined})[_0x2578('0x97')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]];unlockQueueStatus(_0x393fe6);}}else if(_0x50199d==='rrmemory'){var _0x20eb2f;if(this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]]&&!_['isEmpty'](this[_0x2578('0x29')][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]]['queue']])){if(this[_0x2578('0x2a')][_0x36cff2[_0x2578('0x22')][_0x2bcb99['actionid']]['queue']]){this[_0x2578('0x2a')][_0x36cff2[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]]['queue']]=this['queueBookedRR'][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xbb')]]?this['queueBookedRR'][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xbb')]]:this[_0x2578('0x29')][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]]['queue']]?this[_0x2578('0x29')][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xbb')]]['_rr']||0x0:0x0;}this[_0x2578('0x29')][this[_0x2578('0x22')][_0x2bcb99[_0x2578('0xea')]][_0x2578('0xbb')]][_0x2578('0xf5')]=this['queueBookedRR'][this[_0x2578('0x22')][_0x2bcb99['actionid']]['queue']];for(var _0x54e1fc=0x0;_0x54e1fc=_0x358239[_0x2578('0x122')]){_0x388c3f[_0x2578('0x123')](_0x296212,_0x35fa32,_0x26a914,_0x2578('0x124'));}else{if(_0x296212[_0x2578('0x120')]>=_0x358239[_0x2578('0x125')]){_0x388c3f[_0x2578('0x126')](_0x296212,_0x35fa32,_0x26a914,_0x2578('0x127'));}else{hopperUtils[_0x2578('0xd2')]({'active':![],'countmachineretry':_0x296212['countmachineretry'],'scheduledat':moment()[_0x2578('0xd3')](_0x358239[_0x2578('0x128')],'minutes')['format'](_0x2578('0xba')),'ContactId':_0x296212['ContactId'],'ListId':_0x296212['ListId'],'VoiceQueueId':_0x296212[_0x2578('0xe5')]||undefined,'CampaignId':_0x296212[_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0x129')));_0x35fa32({'reschedule':0x1});}}});}if(_0x3604b9['type']===_0x2578('0xb6')&&this[_0x2578('0x1e')][_0x3604b9[_0x2578('0xbb')]]['dialAMDActive']&&_0x47fe30[_0x2578('0x10d')]===_0x2578('0x10e')){delete this[_0x2578('0x24')][_0x47fe30[_0x2578('0xb9')]];utils[_0x2578('0xb7')](this[_0x2578('0x1e')][_0x3604b9[_0x2578('0xbb')]],_0x2578('0x10f'));_0x4e76d0=new Hangup(_0x3604b9,_0x47fe30);_0x4e76d0[_0x2578('0x68')]=0x12;_0x4e76d0['statedesc']=_0x2578('0x111');_0x4e76d0[_0x2578('0x112')]=_0x2578('0x113');ami['emit'](_0x2578('0x114'),ut[_0x2578('0x115')](_0x4e76d0,_0x2578('0x116')));this[_0x2578('0x117')](_0x4e76d0,'[syncHangupInAMDIvr][createHistory]',_0x2578('0x12a'));}if(_0x3604b9[_0x2578('0xc2')]===_0x2578('0xb6')&&this['campaigns'][_0x3604b9[_0x2578('0xbb')]][_0x2578('0x10c')]&&_0x47fe30[_0x2578('0x10d')]===_0x2578('0x11a')){return new Promise(function(_0x4f3280,_0x196b0f){delete _0x388c3f[_0x2578('0x24')][_0x47fe30[_0x2578('0xb9')]];utils['decrementOriginate'](_0x388c3f[_0x2578('0x1e')][_0x3604b9[_0x2578('0xbb')]],_0x2578('0x10f'));_0x388c3f[_0x2578('0x1e')][_0x3604b9[_0x2578('0xbb')]][_0x2578('0xbc')]+=0x1;_0x388c3f[_0x2578('0x1e')][_0x3604b9['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x169978=_0x388c3f['campaigns'][_0x3604b9[_0x2578('0xbb')]];var _0x5992d0=new Hangup(_0x3604b9,_0x47fe30);_0x5992d0[_0x2578('0x68')]=0x13;_0x5992d0[_0x2578('0x69')]=_0x2578('0x11b');_0x5992d0[_0x2578('0x112')]=_0x2578('0x113');_0x5992d0[_0x2578('0x120')]+=0x1;_0x5992d0[_0x2578('0xcc')]+=0x1;_0x5992d0[_0x2578('0x116')]=!![];ami[_0x2578('0x3e')](_0x2578('0x114'),ut[_0x2578('0x115')](_0x5992d0,_0x2578('0x116')));hopperUtils[_0x2578('0xc0')](_0x5992d0)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5992d0[_0x2578('0x12b')]+_0x5992d0[_0x2578('0x11d')]+_0x5992d0[_0x2578('0x11e')]+_0x5992d0[_0x2578('0x11f')]+_0x5992d0[_0x2578('0xcb')]+_0x5992d0[_0x2578('0xe0')]+_0x5992d0[_0x2578('0x120')]+_0x5992d0[_0x2578('0x121')]>=_0x169978[_0x2578('0x122')]){_0x388c3f[_0x2578('0x123')](_0x5992d0,_0x4f3280,_0x196b0f,_0x2578('0x124'));}else{if(_0x5992d0['countmachineretry']>=_0x169978[_0x2578('0x125')]){_0x388c3f[_0x2578('0x126')](_0x5992d0,_0x4f3280,_0x196b0f,_0x2578('0x127'));}else{hopperUtils[_0x2578('0xd2')]({'active':![],'countmachineretry':_0x5992d0[_0x2578('0x120')],'scheduledat':moment()[_0x2578('0xd3')](_0x169978[_0x2578('0x128')],'minutes')[_0x2578('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5992d0[_0x2578('0xfe')],'ListId':_0x5992d0[_0x2578('0xd4')],'VoiceQueueId':_0x5992d0[_0x2578('0xe5')]||undefined,'CampaignId':_0x5992d0['CampaignId']||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0x129')));_0x4f3280({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x2578('0x33')]=function(_0x205411){var _0x35f507=this['uniqueId'][_0x205411['uniqueid']];var _0x3f24dc;if(!_0x35f507){return;}if(_0x35f507[_0x2578('0xc2')]===_0x2578('0xb6')){delete this[_0x2578('0x24')][_0x205411['uniqueid']];utils[_0x2578('0xb7')](this[_0x2578('0x1e')][_0x35f507[_0x2578('0xbb')]],'[syncHangup]');this[_0x2578('0x1e')][_0x35f507[_0x2578('0xbb')]][_0x2578('0x12c')]+=0x1;if(_0x205411[_0x2578('0x12d')]===_0x2578('0x12e')){const _0x110fb7=new AgentComplete(_0x35f507,_0x205411);_0x110fb7[_0x2578('0xd5')]=this['campaigns'][_0x35f507[_0x2578('0xbb')]]['id'];hopperUtils[_0x2578('0xc0')](_0x110fb7)['catch'](loggerCatch(_0x2578('0x12f')));hopperUtils['moveContactManagedDialer'](_0x110fb7)[_0x2578('0x97')](loggerCatch('[syncAgentCompleteIvr]'));}else{_0x3f24dc=new Hangup(_0x35f507,_0x205411);hopperUtils[_0x2578('0xc0')](_0x3f24dc)[_0x2578('0x97')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x2578('0x130')](_0x3f24dc)[_0x2578('0x97')](loggerCatch(_0x2578('0x131')));}}else{if(isNotNull(this[_0x2578('0x1d')][_0x35f507[_0x2578('0xbb')]][_0x2578('0x132')])){delete this[_0x2578('0x24')][_0x205411[_0x2578('0xb9')]];utils[_0x2578('0xb7')](this[_0x2578('0x1d')][_0x35f507[_0x2578('0xbb')]],_0x2578('0x133'));this[_0x2578('0x1d')][_0x35f507['queue']][_0x2578('0xbc')]+=0x1;this[_0x2578('0x1d')][_0x35f507[_0x2578('0xbb')]][_0x2578('0x110')]+=0x1;_0x3f24dc=new Hangup(_0x35f507,_0x205411);_0x3f24dc[_0x2578('0x68')]=0x10;_0x3f24dc[_0x2578('0x69')]=_0x2578('0x134');_0x3f24dc[_0x2578('0x112')]=_0x2578('0x135');hopperUtils[_0x2578('0xc0')](_0x3f24dc)[_0x2578('0x97')](loggerCatch(_0x2578('0x136')));hopperUtils[_0x2578('0x130')](_0x3f24dc)[_0x2578('0x97')](loggerCatch(_0x2578('0x131')));}else{delete this['uniqueId'][_0x205411[_0x2578('0xb9')]];utils[_0x2578('0xb7')](this[_0x2578('0x1d')][_0x35f507[_0x2578('0xbb')]],_0x2578('0x137'));if(_0x205411[_0x2578('0x12d')]===_0x2578('0x12e')){this[_0x2578('0x1d')][_0x35f507[_0x2578('0xbb')]]['outboundAnswerCallsDay']+=0x1;const _0x18e349=new AgentComplete(_0x35f507,_0x205411);_0x18e349[_0x2578('0xe5')]=this[_0x2578('0x1d')][_0x35f507['queue']]['id'];hopperUtils[_0x2578('0xc0')](_0x18e349)[_0x2578('0x97')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x2578('0x130')](_0x18e349)[_0x2578('0x97')](loggerCatch(_0x2578('0xc1')));}else{this[_0x2578('0x1d')][_0x35f507[_0x2578('0xbb')]][_0x2578('0x138')]+=0x1;_0x3f24dc=new Hangup(_0x35f507,_0x205411);_0x3f24dc[_0x2578('0x68')]=0xc;_0x3f24dc[_0x2578('0x69')]=_0x205411['cause-txt'];_0x3f24dc[_0x2578('0x112')]='Unknown';hopperUtils[_0x2578('0xc0')](_0x3f24dc)[_0x2578('0x97')](loggerCatch(_0x2578('0x139')));hopperUtils[_0x2578('0x130')](_0x3f24dc)['catch'](loggerCatch(_0x2578('0x133')));}}}};Dialer[_0x2578('0x18')][_0x2578('0x13a')]=function(_0x3e34ad){var _0x7b40a7=this;if(!_0x7b40a7['queuesSummary'][_0x3e34ad[_0x2578('0x44')]]){_0x7b40a7[_0x2578('0x13b')][_0x3e34ad[_0x2578('0x44')]]={'running':![]};}else if(_0x7b40a7[_0x2578('0x13b')][_0x3e34ad['name']][_0x2578('0x13c')]===!![]){return;}else if(_0x7b40a7[_0x2578('0x13b')][_0x3e34ad[_0x2578('0x44')]]['running']===![]){_0x7b40a7[_0x2578('0x13b')][_0x3e34ad['name']][_0x2578('0x13c')]=!![];}var _0x14b426=_0x7b40a7[_0x2578('0x1d')][_0x3e34ad[_0x2578('0x44')]];var _0x8d8a94=_0x14b426[_0x2578('0x65')]!==utils['CAMPAIGN_STATUS'][_0x2578('0x79')];var _0x232a04=utils[_0x2578('0x13d')](_0x14b426);_0x14b426['statusMessage']=utils[_0x2578('0x13e')](_0x14b426,_0x7b40a7['trunks']);Promise[_0x2578('0xa3')]()[_0x2578('0x3b')](function(){if(_0x14b426[_0x2578('0x13f')]===utils[_0x2578('0x6f')][_0x2578('0x79')]){if(_0x8d8a94){clearPredictiveAttributes(_0x14b426);_0x3e34ad[_0x2578('0x26')]=undefined;_0x3e34ad[_0x2578('0x27')]=undefined;}if(_0x14b426['statusMessage']===utils[_0x2578('0x6f')][_0x2578('0x79')]){_0x3e34ad[_0x2578('0x140')]=0x0;_0x3e34ad[_0x2578('0xf0')]=0x0;_0x3e34ad[_0x2578('0x141')]=0x0;_0x3e34ad[_0x2578('0x142')]=0x0;_0x3e34ad[_0x2578('0x143')]=0x0;}}else if(_0x14b426[_0x2578('0x13f')]===utils[_0x2578('0x6f')]['ACTIVE']&&!_0x232a04){return _0x7b40a7[_0x2578('0x89')](_0x14b426,!![])[_0x2578('0x3b')](function(){return _0x7b40a7[_0x2578('0x89')](_0x14b426,![]);})['then'](function(){return _0x7b40a7['checkDialMethod'](_0x14b426);})[_0x2578('0x97')](function(_0x428949){loggerSyncQueueSummary['debug'](_0x2578('0x144'),util[_0x2578('0x61')](_0x428949,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x14b426);});}else{clearPredictiveAttributes(_0x14b426);}})[_0x2578('0x3b')](function(){var _0x56a689=_0x3e34ad[_0x2578('0x145')](_0x14b426);if(_0x56a689||_0x14b426['queueSummaryCountersUpdated']){_0x14b426[_0x2578('0x146')]=![];_0x3e34ad[_0x2578('0x147')](_0x14b426);Object[_0x2578('0x148')](_0x14b426,_0x3e34ad);emitOutboundVoiceQueueSummary(_0x3e34ad);}_0x7b40a7[_0x2578('0x13b')][_0x14b426['name']][_0x2578('0x13c')]=![];})[_0x2578('0x97')](function(_0x54db80){logger[_0x2578('0x60')](_0x2578('0x144'),util[_0x2578('0x61')](_0x54db80,{'showHidden':![],'depth':null}));_0x7b40a7[_0x2578('0x13b')][_0x14b426[_0x2578('0x44')]][_0x2578('0x13c')]=![];});};Dialer[_0x2578('0x18')]['syncQueueSummaryComplete']=_['throttle'](function(){var _0x5e3b4f=_[_0x2578('0x149')](this[_0x2578('0x1d')],function(_0x487f11){return _0x487f11[_0x2578('0x14a')];});var _0x240bfa=_[_0x2578('0x149')](this[_0x2578('0x1f')],function(_0x2d8ba7){return _0x2d8ba7[_0x2578('0x14b')]&&_0x2d8ba7[_0x2578('0x80')]===_0x2578('0x81');});if(_0x5e3b4f[_0x2578('0x8e')]>0x0&&_0x240bfa['length']>0x0){return Promise[_0x2578('0xa3')]()[_0x2578('0x3b')](cmHopper[_0x2578('0x14c')](_['map'](_0x5e3b4f,'id'),previewRecallmeReminderInterval,_[_0x2578('0x14d')](_0x240bfa,'id')))['then'](function(_0x2db713){for(var _0x3807f4=0x0;_0x3807f4<_0x2db713['length'];_0x3807f4++){var _0x5b239c=_0x2db713[_0x3807f4][_0x2578('0x14e')]['name'];if(_0x5b239c)io['to'](util[_0x2578('0x42')](_0x2578('0x14f'),_0x5b239c))[_0x2578('0x3e')]('user:dialPreviewRecallReminder',{'hopper':_0x2db713[_0x3807f4]});}})['catch'](function(_0x514a62){logger['error']('checkPreviewRecallReminder',_0x514a62);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x2578('0x18')][_0x2578('0x3a')]=function(){var _0x3f63f4=this;setInterval(function(){_0x3f63f4[_0x2578('0x150')](_0x3f63f4[_0x2578('0x24')],_0x2578('0x151'));_0x3f63f4[_0x2578('0x150')](_0x3f63f4[_0x2578('0x22')],_0x2578('0x152'));},0x32c8);};Dialer[_0x2578('0x18')][_0x2578('0x150')]=function(_0x588b22,_0x4f37f3){var _0x14165d=this;for(var _0x198606 in _0x588b22){if(typeof _0x588b22[_0x198606]!==_0x2578('0xa2')){this[_0x2578('0x1b')][_0x2578('0x153')](function(){if(!_[_0x2578('0xee')](_0x588b22[_0x198606])){return ami[_0x2578('0x90')]({'action':_0x2578('0x80'),'channel':_0x588b22[_0x198606][_0x2578('0xe8')]})[_0x2578('0x97')](function(_0x58a3d4){if(_0x58a3d4['message']===_0x2578('0x154')){setTimeout(function(){if(_0x588b22[_0x198606]&&_0x588b22[_0x198606][_0x2578('0xc2')]!==_0x2578('0xb6')){utils[_0x2578('0xb7')](_0x14165d[_0x2578('0x1d')][_0x588b22[_0x198606]['queue']],_0x2578('0x155'));logger[_0x2578('0x60')](_0x2578('0x156'),_0x4f37f3,_0x198606,_0x588b22[_0x198606][_0x2578('0xbb')]);delete _0x588b22[_0x198606];}if(_0x588b22[_0x198606]&&_0x588b22[_0x198606][_0x2578('0xc2')]===_0x2578('0xb6')){utils[_0x2578('0xb7')](_0x14165d[_0x2578('0x1e')][_0x588b22[_0x198606][_0x2578('0xbb')]],_0x2578('0x155'));logger[_0x2578('0x60')](_0x2578('0x157'),_0x4f37f3,_0x198606,_0x588b22[_0x198606][_0x2578('0xbb')]);delete _0x588b22[_0x198606];}},0x2328);}});}});}}};Dialer[_0x2578('0x18')]['getVoiceQueueRtPauses']=function(_0x2545fd){return Promise[_0x2578('0xa3')]()['then'](voiceQueueRt[_0x2578('0x158')](_0x2545fd))[_0x2578('0x97')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x2578('0x18')][_0x2578('0x159')]=function(_0xe84b13,_0x3fb5c1,_0x4b0dd9){var _0x561370={'state':0x19,'statedesc':_0x2578('0x15a')};utils['decrementOriginate'](_0x3fb5c1,_0x2578('0x15b')+_0xe84b13);this[_0x2578('0x117')](_[_0x2578('0xf2')](_0x561370,_[_0x2578('0x6d')](_0x4b0dd9,[_0x2578('0xfe'),'ListId',_0x2578('0x15c'),_0x2578('0xe5'),_0x2578('0xd5')])),_0x2578('0x15d'),'[emptyContact]');logger['error'](_0xe84b13);};Dialer['prototype'][_0x2578('0x117')]=function(_0x547bf4,_0x55792f,_0x5c31b3){hopperUtils[_0x2578('0xc0')](_0x547bf4)[_0x2578('0x97')](loggerCatch(_0x55792f));hopperUtils['moveContactManagedDialer'](_0x547bf4)['catch'](loggerCatch(_0x5c31b3));};Dialer[_0x2578('0x18')][_0x2578('0xd1')]=function(_0x50f3de,_0x702025){hopperUtils[_0x2578('0xc0')](_0x50f3de)[_0x2578('0x97')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x702025==0x0){hopperUtils[_0x2578('0x130')](_0x50f3de)[_0x2578('0x97')](loggerCatch(_0x2578('0x15e')));}};Dialer['prototype'][_0x2578('0x15f')]=function(_0x29c427){return Promise[_0x2578('0xa3')]()[_0x2578('0x3b')](cmHopper[_0x2578('0x14c')](_0x29c427['id'],previewRecallmeReminderInterval))[_0x2578('0x3b')](function(_0x225dd3){for(var _0x57f18f=0x0;_0x57f18f<_0x225dd3[_0x2578('0x8e')];_0x57f18f++){var _0x59e9d7=_0x225dd3[_0x57f18f][_0x2578('0x14e')][_0x2578('0x44')];if(_0x59e9d7)io['to'](util[_0x2578('0x42')](_0x2578('0x14f'),_0x59e9d7))[_0x2578('0x3e')](_0x2578('0x160'),{'hopper':_0x225dd3[_0x57f18f]});}})[_0x2578('0x97')](function(){});};Dialer['prototype'][_0x2578('0x161')]=function(_0x2d4255){var _0x4f9ad4=this;return function(){_0x4f9ad4[_0x2578('0x162')](_0x2d4255);};};Dialer[_0x2578('0x18')][_0x2578('0x163')]=function(_0x22bc06,_0x1b8ab7){var _0x4a37cc=this;var _0xdbc1c7=uuid['v4']();this[_0x2578('0x22')][_0xdbc1c7]=new Action(_0x22bc06,_0x1b8ab7,_0xdbc1c7);return new Promise(function(_0x37c890,_0x409fc9){if(_[_0x2578('0x3d')](_0x22bc06)&&typeof _0x22bc06!==_0x2578('0x164')){return _0x409fc9(msgResponse(_0x2578('0x165'),_0x2578('0x8a'),'voiceQueue\x20is\x20undefine'));}if(_[_0x2578('0x3d')](_0x1b8ab7[_0x2578('0x166')])||_0x1b8ab7[_0x2578('0x166')]===null){return _0x409fc9(msgResponse(_0x2578('0x165'),_0x2578('0x8a'),_0x2578('0x167')));}var _0x15ff1f={'XMD-CALLERID':_0x4a37cc[_0x2578('0x22')][_0xdbc1c7]['getCaller'](),'XMD-AGI':_0x22bc06[_0x2578('0x132')]?util[_0x2578('0x42')]('\x22agi://%s/square,%s\x22',ipAgi,_0x22bc06[_0x2578('0x132')]):_0x2578('0x168'),'XMD-AGIAFTER':_0x22bc06[_0x2578('0xbe')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x22bc06['dialQueueProject2']):'NONE','XMD-QUEUE':utils[_0x2578('0x169')](_0x22bc06)?util[_0x2578('0x42')](_0x2578('0x16a'),_0x22bc06[_0x2578('0x44')],_0x22bc06[_0x2578('0x16b')]||'',_0x22bc06['dialAgiAfterHangupAgent']?'c':'',_0x22bc06[_0x2578('0xc6')]||0x3):_0x2578('0x168'),'XMD-CONTACTID':_0x1b8ab7[_0x2578('0xfe')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4a37cc[_0x2578('0x22')][_0xdbc1c7][_0x2578('0x16c')](),'XMD-AMD':_0x22bc06[_0x2578('0x10c')]?_0x2578('0x16d'):_0x2578('0x168'),'XMD-DESTINATION':_0x2578('0x10b')};if(_0x22bc06[_0x2578('0x10c')]){_0x15ff1f[_0x2578('0x16e')]=_0x22bc06[_0x2578('0x16f')]||0x9c4;_0x15ff1f[_0x2578('0x170')]=_0x22bc06[_0x2578('0x171')]||0x5dc;_0x15ff1f[_0x2578('0x172')]=_0x22bc06['dialAMDAfterGreetingSilence']||0x320;_0x15ff1f['XMD-AMDTOTALANALYSISTIME']=_0x22bc06['dialAMDTotalAnalysisTime']||0x1388;_0x15ff1f['XMD-AMDMINWORDLENGTH']=_0x22bc06['dialAMDMinWordLength']||0x64;_0x15ff1f[_0x2578('0x173')]=_0x22bc06[_0x2578('0x174')]||0x32;_0x15ff1f['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x22bc06[_0x2578('0x175')]||0x3;_0x15ff1f[_0x2578('0x176')]=_0x22bc06['dialAMDSilenceThreshold']||0x100;_0x15ff1f[_0x2578('0x177')]=_0x22bc06[_0x2578('0x178')]||0x1388;}if(utils[_0x2578('0x169')](_0x22bc06)){_0x15ff1f[_0x2578('0x179')]=_0x1b8ab7[_0x2578('0xe5')];}else{_0x15ff1f[_0x2578('0x17a')]=_0x1b8ab7[_0x2578('0xd5')];}var _0x1012b0=utils[_0x2578('0x17b')](_0x1b8ab7[_0x2578('0x17c')]);Object[_0x2578('0x148')](_0x15ff1f,_0x1012b0);var _0xcd31bd=_0x4a37cc['isTrunkReachable'](_0x22bc06[_0x2578('0x83')])?utils['getCallerId'](_0x22bc06[_0x2578('0x83')]['callerid'],_0x22bc06[_0x2578('0x17d')],_0x22bc06['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x2578('0x17e')](_0x22bc06[_0x2578('0x17f')],_0x22bc06[_0x2578('0x180')]):_0x22bc06[_0x2578('0x17f')]):utils[_0x2578('0x181')](_[_0x2578('0xee')](_0x22bc06[_0x2578('0x182')])?_0x22bc06[_0x2578('0x83')][_0x2578('0x183')]:_0x22bc06[_0x2578('0x182')][_0x2578('0x183')],_0x22bc06[_0x2578('0x17d')],_0x22bc06[_0x2578('0x180')]>0x0?utils[_0x2578('0x17e')](_0x22bc06[_0x2578('0x17f')],_0x22bc06[_0x2578('0x180')]):_0x22bc06[_0x2578('0x17f')]);if(_0xcd31bd){_0x15ff1f[_0x2578('0x184')]=_0x4a37cc[_0x2578('0x22')][_0xdbc1c7][_0x2578('0x185')]=utils['extractCalleridName'](_0xcd31bd);_0x15ff1f[_0x2578('0x186')]=_0x1b8ab7[_0x2578('0x166')];}_0x22bc06['variables']=_0x15ff1f;return ami['Action']({'actionid':_0xdbc1c7,'action':'originate','channel':_0x4a37cc[_0x2578('0x7e')](_0x22bc06[_0x2578('0x83')])?util['format'](_0x2578('0x187'),_0x22bc06[_0x2578('0x83')][_0x2578('0x44')],isNotNull(_0x22bc06[_0x2578('0x188')])?_0x22bc06[_0x2578('0x188')][_0x2578('0x189')]()||'':'',_0x22bc06[_0x2578('0x18a')]>0x0?_0x1b8ab7[_0x2578('0x166')][_0x2578('0x18b')](_0x22bc06[_0x2578('0x18a')]):_0x1b8ab7[_0x2578('0x166')]):util[_0x2578('0x42')]('SIP/%s/%s%s',_[_0x2578('0xee')](_0x22bc06[_0x2578('0x182')])?_0x22bc06[_0x2578('0x83')][_0x2578('0x44')]:_0x22bc06['TrunkBackup'][_0x2578('0x44')],isNotNull(_0x22bc06[_0x2578('0x188')])?_0x22bc06[_0x2578('0x188')][_0x2578('0x189')]()||'':'',_0x22bc06[_0x2578('0x18a')]>0x0?_0x1b8ab7['phone']['substring'](_0x22bc06[_0x2578('0x18a')]):_0x1b8ab7[_0x2578('0x166')]),'callerid':_0xcd31bd,'Exten':_0x2578('0x10b'),'Context':_0x2578('0x18c'),'Priority':'1','variable':_0x15ff1f,'timeout':(_0x22bc06[_0x2578('0x18d')]||0x1e)*0x3e8,'async':!![],'channelid':_0xdbc1c7})[_0x2578('0x3b')](function(_0x51dde8){return _0x37c890(_0x51dde8);})[_0x2578('0x97')](function(_0x43453e){_0x22bc06[_0x2578('0x18e')]+=0x1;var _0x28efd9=new History(_0x4a37cc['actions'][_0xdbc1c7]);logger[_0x2578('0x60')](util[_0x2578('0x42')](_0x2578('0x18f'),JSON['stringify'](_0x43453e)));_0x28efd9['state']=0xe;_0x28efd9[_0x2578('0x69')]='OriginateError';_0x28efd9['starttime']=moment()[_0x2578('0x42')](_0x2578('0xba'));_0x28efd9[_0x2578('0xd8')]=_0x28efd9[_0x2578('0xd7')];hopperUtils[_0x2578('0xc0')](_0x28efd9)[_0x2578('0x97')](loggerCatch(_0x2578('0x190')));_0x4a37cc['moveContactManagedDialer'](_0x28efd9)[_0x2578('0x97')](loggerCatch('[originate][error]'))[_0x2578('0x1a')](function(){delete _0x4a37cc[_0x2578('0x22')][_0xdbc1c7];return _0x409fc9(msgResponse('originate','Error',_0x2578('0x191')));});});});};Dialer[_0x2578('0x18')][_0x2578('0x192')]=function(_0x12b436,_0x3a8484,_0x19d264){var _0x44c0bc=new History(_0x3a8484);if(_0x44c0bc[_0x2578('0x12b')]+_0x44c0bc['countcongestionretry']+_0x44c0bc[_0x2578('0x11e')]+_0x44c0bc[_0x2578('0x11f')]+_0x44c0bc[_0x2578('0xcb')]+_0x44c0bc[_0x2578('0xe0')]+_0x44c0bc[_0x2578('0x120')]+_0x44c0bc['countagentrejectretry']>=_0x19d264[_0x2578('0x122')]-0x1){return!![];}switch(_0x12b436){case 0x3:if(_0x44c0bc[_0x2578('0x11e')]>=_0x19d264[_0x2578('0x193')]-0x1){return!![];}hopperUtils[_0x2578('0xd2')]({'active':![],'countnoanswerretry':_0x44c0bc['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x2578('0xd3')](_0x19d264[_0x2578('0x194')],_0x2578('0xe4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x44c0bc[_0x2578('0xfe')],'ListId':_0x44c0bc[_0x2578('0xd4')],'VoiceQueueId':_0x44c0bc[_0x2578('0xe5')]||undefined,'CampaignId':_0x44c0bc[_0x2578('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x44c0bc[_0x2578('0x12b')]>=_0x19d264[_0x2578('0x195')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x44c0bc['countbusyretry']+=0x1,'scheduledat':moment()[_0x2578('0xd3')](_0x19d264[_0x2578('0x196')],_0x2578('0xe4'))[_0x2578('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x44c0bc[_0x2578('0xfe')],'ListId':_0x44c0bc['ListId'],'VoiceQueueId':_0x44c0bc[_0x2578('0xe5')]||undefined,'CampaignId':_0x44c0bc[_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0x197')));break;case 0x8:if(_0x44c0bc[_0x2578('0x11d')]>=_0x19d264['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x2578('0xd2')]({'active':![],'countcongestionretry':_0x44c0bc[_0x2578('0x11d')]+=0x1,'scheduledat':moment()[_0x2578('0xd3')](_0x19d264['dialCongestionRetryFrequency'],'minutes')[_0x2578('0x42')](_0x2578('0xba')),'ContactId':_0x44c0bc[_0x2578('0xfe')],'ListId':_0x44c0bc['ListId'],'VoiceQueueId':_0x44c0bc[_0x2578('0xe5')]||undefined,'CampaignId':_0x44c0bc[_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0x198')));break;case 0x0:if(_0x44c0bc['countnosuchnumberretry']>=_0x19d264[_0x2578('0x199')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x44c0bc[_0x2578('0x11f')]+=0x1,'scheduledat':moment()[_0x2578('0xd3')](_0x19d264[_0x2578('0x19a')],_0x2578('0xe4'))[_0x2578('0x42')](_0x2578('0xba')),'ContactId':_0x44c0bc[_0x2578('0xfe')],'ListId':_0x44c0bc[_0x2578('0xd4')],'VoiceQueueId':_0x44c0bc[_0x2578('0xe5')]||undefined,'CampaignId':_0x44c0bc[_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x44c0bc[_0x2578('0xcb')]>=_0x19d264[_0x2578('0x19b')]-0x1){return!![];}hopperUtils[_0x2578('0xd2')]({'active':![],'countdropretry':_0x44c0bc[_0x2578('0xcb')]+=0x1,'scheduledat':moment()[_0x2578('0xd3')](_0x19d264[_0x2578('0xcd')],_0x2578('0xe4'))[_0x2578('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x44c0bc[_0x2578('0xfe')],'ListId':_0x44c0bc[_0x2578('0xd4')],'VoiceQueueId':_0x44c0bc[_0x2578('0xe5')]||undefined,'CampaignId':_0x44c0bc[_0x2578('0xd5')]||undefined})['catch'](loggerCatch(_0x2578('0xd6')));break;case 0xb:if(_0x44c0bc[_0x2578('0xe0')]>=_0x19d264[_0x2578('0xe3')]-0x1){return!![];}hopperUtils[_0x2578('0xd2')]({'active':![],'countabandonedretry':_0x44c0bc[_0x2578('0xe0')]+=0x1,'scheduledat':moment()['add'](_0x19d264[_0x2578('0xe1')],_0x2578('0xe4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x44c0bc[_0x2578('0xfe')],'ListId':_0x44c0bc[_0x2578('0xd4')],'VoiceQueueId':_0x44c0bc['VoiceQueueId']||undefined,'CampaignId':_0x44c0bc[_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0xe6')));break;case 0x13:if(_0x44c0bc[_0x2578('0x120')]>=_0x19d264[_0x2578('0x125')]-0x1){return!![];}hopperUtils[_0x2578('0xd2')]({'active':![],'countmachineretry':_0x44c0bc[_0x2578('0x120')]+=0x1,'scheduledat':moment()[_0x2578('0xd3')](_0x19d264['dialMachineRetryFrequency'],_0x2578('0xe4'))['format'](_0x2578('0xba')),'ContactId':_0x44c0bc['ContactId'],'ListId':_0x44c0bc[_0x2578('0xd4')],'VoiceQueueId':_0x44c0bc[_0x2578('0xe5')]||undefined,'CampaignId':_0x44c0bc[_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x44c0bc[_0x2578('0x121')]>=_0x19d264['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x2578('0xd2')]({'active':![],'countagentrejectretry':_0x44c0bc[_0x2578('0x121')]+=0x1,'scheduledat':moment()['add'](_0x19d264['dialAgentRejectRetryFrequency'],'minutes')[_0x2578('0x42')](_0x2578('0xba')),'ContactId':_0x44c0bc[_0x2578('0xfe')],'ListId':_0x44c0bc[_0x2578('0xd4')],'VoiceQueueId':_0x44c0bc['VoiceQueueId']||undefined,'CampaignId':_0x44c0bc['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x2578('0x18')][_0x2578('0x19c')]=function(_0x3aff76,_0x481b7a,_0x30c25a){var _0x529c93=this;var _0x3500db=new History(_0x3aff76);var _0x302ccb=![];var _0x28d85;var _0x12d160;return new Promise(function(_0x260f3d,_0x41b397){if(_[_0x2578('0x3d')](_0x481b7a)&&typeof _0x481b7a!==_0x2578('0x164')){return _0x41b397(msgResponse(_0x2578('0x19d'),_0x2578('0x8a'),'entity\x20is\x20undefine'));}if(_[_0x2578('0x3d')](_0x30c25a)&&typeof _0x30c25a!=='object'){return _0x41b397(msgResponse('[callProgressDetecting]','Failure','evt\x20is\x20undefine'));}hopperUtils[_0x2578('0xcf')](_0x3500db,_0x30c25a['reason'],_0x481b7a)[_0x2578('0x3b')](function(_0x6e3eff){if(_0x6e3eff['additional']==0x1)_0x302ccb=!![];switch(_0x30c25a[_0x2578('0xbd')]){case'0':_0x481b7a[_0x2578('0x19e')]+=0x1;_0x3500db['state']=0x0;_0x3500db[_0x2578('0x69')]=_0x2578('0x19f');_0x3500db[_0x2578('0x11f')]+=0x1;_0x3500db[_0x2578('0xcc')]+=0x1;ami[_0x2578('0x3e')]('custom:agentnosuchnumber',ut[_0x2578('0x115')](_0x3aff76,_0x2578('0x1a0')));_0x28d85=_0x481b7a[_0x2578('0x19a')];_0x12d160=_0x481b7a[_0x2578('0xce')];hopperUtils['createHistory'](_0x3500db)[_0x2578('0x97')](loggerCatch(_0x2578('0x11c')));if(_0x529c93[_0x2578('0x192')](0x0,_0x3aff76,_0x481b7a)&&!_0x302ccb){if(_0x3500db[_0x2578('0x11f')]>=_0x481b7a[_0x2578('0x199')]){_0x529c93['createStateFinal'](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1a1'));}else{_0x529c93[_0x2578('0x123')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1a1'));}}break;case'3':_0x481b7a[_0x2578('0x1a2')]+=0x1;_0x3500db[_0x2578('0x68')]=0x3;_0x3500db[_0x2578('0x69')]=_0x2578('0x1a3');_0x3500db[_0x2578('0x11e')]+=0x1;_0x3500db[_0x2578('0xcc')]+=0x1;var _0x5f2191=ut['buildNoAnswerEventPayload'](_0x3aff76,_0x481b7a);ami[_0x2578('0x3e')](_0x2578('0x1a4'),_0x5f2191);_0x28d85=_0x481b7a[_0x2578('0x194')];_0x12d160=_0x481b7a[_0x2578('0xce')];hopperUtils[_0x2578('0xc0')](_0x3500db)['catch'](loggerCatch(_0x2578('0x1a5')));if(_0x529c93[_0x2578('0x192')](0x3,_0x3aff76,_0x481b7a)&&!_0x302ccb){if(_0x3500db[_0x2578('0x11e')]>=_0x481b7a['dialNoAnswerMaxRetry']){_0x529c93['createStateFinal'](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1a6'));}else{_0x529c93[_0x2578('0x123')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1a6'));}}break;case'5':_0x481b7a['outboundBusyCallsDay']+=0x1;_0x3500db[_0x2578('0x68')]=0x5;_0x3500db[_0x2578('0x69')]=_0x2578('0x1a7');_0x3500db[_0x2578('0x12b')]+=0x1;_0x3500db['countglobal']+=0x1;ami[_0x2578('0x3e')](_0x2578('0x1a8'),ut[_0x2578('0x115')](_0x3aff76,_0x2578('0x1a9')));_0x28d85=_0x481b7a['dialBusyRetryFrequency'];_0x12d160=_0x481b7a['callAdditionalPhoneAfterMin'];hopperUtils[_0x2578('0xc0')](_0x3500db)[_0x2578('0x97')](loggerCatch(_0x2578('0x1aa')));if(_0x529c93[_0x2578('0x192')](0x5,_0x3aff76,_0x481b7a)&&!_0x302ccb){if(_0x3500db['countbusyretry']>=_0x481b7a[_0x2578('0x195')]){_0x529c93[_0x2578('0x126')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1ab'));}else{_0x529c93[_0x2578('0x123')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1ab'));}}break;case'8':_0x481b7a[_0x2578('0x1ac')]+=0x1;_0x3500db[_0x2578('0x68')]=0x8;_0x3500db[_0x2578('0x69')]=_0x2578('0x1ad');_0x3500db[_0x2578('0x11d')]+=0x1;_0x3500db[_0x2578('0xcc')]+=0x1;_0x28d85=_0x481b7a[_0x2578('0x1ae')];_0x12d160=_0x481b7a[_0x2578('0xce')];ami['emit'](_0x2578('0x1af'),ut['buildObj'](_0x3aff76,_0x2578('0x1b0')));hopperUtils[_0x2578('0xc0')](_0x3500db)[_0x2578('0x97')](loggerCatch(_0x2578('0x1b1')));if(_0x529c93[_0x2578('0x192')](0x8,_0x3aff76,_0x481b7a)&&!_0x302ccb){if(_0x3500db[_0x2578('0x11d')]>=_0x481b7a[_0x2578('0x1b2')]){_0x529c93[_0x2578('0x126')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1b3'));}else{_0x529c93[_0x2578('0x123')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1b3'));}}break;case'11':_0x481b7a[_0x2578('0x1b4')]+=0x1;_0x3500db[_0x2578('0x68')]=0xb;_0x3500db['statedesc']=_0x2578('0xde');_0x3500db['countabandonedretry']+=0x1;_0x3500db[_0x2578('0xcc')]+=0x1;_0x28d85=_0x481b7a[_0x2578('0xe1')];_0x12d160=_0x481b7a[_0x2578('0xce')];hopperUtils[_0x2578('0xc0')](_0x3500db)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x529c93[_0x2578('0x192')](0xb,_0x3aff76,_0x481b7a)&&!_0x302ccb){if(_0x3500db[_0x2578('0xe0')]>=_0x481b7a[_0x2578('0xe3')]){_0x529c93[_0x2578('0x126')](_0x3500db,_0x260f3d,_0x41b397,'reason\x2011\x20abandoned');}else{_0x529c93[_0x2578('0x123')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1b5'));}}break;case'20':_0x481b7a[_0x2578('0x1b6')]+=0x1;_0x3500db[_0x2578('0x68')]=0x14;_0x3500db[_0x2578('0x69')]=_0x2578('0x1b7');_0x3500db[_0x2578('0x121')]+=0x1;_0x3500db[_0x2578('0xcc')]+=0x1;_0x28d85=_0x481b7a[_0x2578('0x1b8')];_0x12d160=_0x481b7a[_0x2578('0xce')];ami['emit'](_0x2578('0x1b9'),ut['buildObj'](_0x3aff76,_0x2578('0x1ba')));hopperUtils['createHistory'](_0x3500db)[_0x2578('0x97')](loggerCatch(_0x2578('0x1bb')));if(_0x529c93['checkRetriveMax'](0x14,_0x3aff76,_0x481b7a)&&!_0x302ccb){if(_0x3500db[_0x2578('0x121')]>=_0x481b7a[_0x2578('0x1bc')]){_0x529c93[_0x2578('0x126')](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1bd'));}else{_0x529c93['stateGlobal'](_0x3500db,_0x260f3d,_0x41b397,_0x2578('0x1bd'));}}break;default:_0x481b7a[_0x2578('0x138')]+=0x1;_0x3500db[_0x2578('0x68')]=0xc;_0x3500db[_0x2578('0x69')]=_0x30c25a[_0x2578('0xbd')];_0x28d85=_0x481b7a[_0x2578('0x1b8')];_0x12d160=_0x481b7a[_0x2578('0xce')];hopperUtils[_0x2578('0xc0')](_0x3500db)[_0x2578('0x97')](loggerCatch(_0x2578('0x1be')));if(_0x529c93[_0x2578('0x192')](_0x30c25a[_0x2578('0xbd')],_0x3aff76,_0x481b7a)&&!_0x302ccb){if(_0x3500db[_0x2578('0x12b')]+_0x3500db['countcongestionretry']+_0x3500db['countnoanswerretry']+_0x3500db['countnosuchnumberretry']+_0x3500db[_0x2578('0xcb')]+_0x3500db[_0x2578('0xe0')]+_0x3500db[_0x2578('0x120')]+_0x3500db['countagentrejectretry']>=_0x481b7a[_0x2578('0x122')]){_0x529c93[_0x2578('0x123')](_0x3500db,_0x260f3d,_0x41b397,_0x30c25a['reason']);}else{_0x529c93[_0x2578('0x126')](_0x3500db,_0x260f3d,_0x41b397,_0x30c25a['reason']);}}}})[_0x2578('0x3b')](function(){if(_0x302ccb){hopperUtils[_0x2578('0xdb')](_0x3500db,_0x28d85,_0x12d160)['then'](function(){return _0x260f3d(0x1);});}});});};Dialer[_0x2578('0x18')][_0x2578('0x123')]=function(_0x2e3d9c,_0x39696a,_0x1bd0c3,_0xe43d4){var _0x309622=new Final(_0x2e3d9c);_0x309622[_0x2578('0x68')]=0xf;_0x309622[_0x2578('0x69')]=_0x2578('0x1bf');this[_0x2578('0x126')](_0x309622,_0x39696a,_0x1bd0c3,_0xe43d4);};Dialer[_0x2578('0x18')][_0x2578('0x126')]=function(_0x223a90,_0x1c83a2,_0x2dd2ca,_0x152475){hopperUtils[_0x2578('0x130')](_0x223a90)[_0x2578('0x3b')](function(){return _0x1c83a2(msgResponse(_0x2578('0x19d'),'Success',_0x152475));})['catch'](function(){return _0x2dd2ca(msgResponse(_0x2578('0x1c0'),_0x2578('0x8a'),_0x2578('0x1c1')));});};Dialer['prototype']['predictive']=function(_0x41df46){var _0x201df9=_0x41df46['dialPredictiveOptimizationPercentage']/0x64;var _0x47f2bd=_0x41df46[_0x2578('0xc7')]/(_0x41df46[_0x2578('0xc7')]+_0x41df46[_0x2578('0xbc')]);var _0x4d79ff=Math[_0x2578('0x1c2')](_0x41df46['predictiveIntervalAvailable']*(_0x41df46[_0x2578('0x1c3')]/0x64));var _0x29aa7d=Math[_0x2578('0x1c2')](_0x41df46[_0x2578('0x1c4')]*(_0x41df46[_0x2578('0x1c5')]/0x64));var _0x42dea7=_0x41df46[_0x2578('0x140')]+_0x41df46[_0x2578('0x142')];var _0x4427a4=Math[_0x2578('0x1c6')](_0x41df46[_0x2578('0x59')]*_0x41df46['erlangAbandonmentRate']*_0x41df46[_0x2578('0x1c7')]*_0x41df46[_0x2578('0x1c8')]);if(_['isUndefined'](_0x41df46[_0x2578('0x27')])){if(!_[_0x2578('0x3d')](_0x41df46[_0x2578('0x26')])){_0x41df46[_0x2578('0x26')]=undefined;loggerPredictive[_0x2578('0x60')](_0x2578('0x1c9'),_0x2578('0x1ca'));}if(!_[_0x2578('0x3d')](_0x41df46['handlePredictive'])){loggerPredictive[_0x2578('0x60')](_0x2578('0x1c9'),_0x2578('0x1cb'));clearInterval(_0x41df46[_0x2578('0x5d')]);_0x41df46['handlePredictive']=undefined;}_0x41df46['startProgressive']=moment()[_0x2578('0x42')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2578('0x47')](_0x41df46['name'],_0x2578('0x1cc'),_0x41df46['startProgressive']);this[_0x2578('0xaa')](_0x41df46,0x1);}else if(ifInterval(_0x41df46[_0x2578('0x1cd')],_0x41df46[_0x2578('0x27')])){this[_0x2578('0xaa')](_0x41df46,0x1);loggerPredictiveCalls[_0x2578('0x47')]('[startMethodPredictive][StartProgressive][Loop]',_0x41df46[_0x2578('0x27')],_0x41df46[_0x2578('0x44')]);_0x41df46[_0x2578('0x59')]=0x0;_0x41df46[_0x2578('0xc8')]=0x0;}else if(_0x201df9<_0x47f2bd&&_0x41df46[_0x2578('0x1ce')]===_0x2578('0x1cf')){clearPredictiveAttributes(_0x41df46);loggerPredictive[_0x2578('0x47')](_0x2578('0x1d0'),_0x2578('0x1d1'),_0x47f2bd,_0x2578('0x27'),_0x41df46[_0x2578('0x44')]);}else if(_0x4427a4<_0x41df46[_0x2578('0xc8')]&&_0x41df46[_0x2578('0x1ce')]===_0x2578('0x1cf')){clearPredictiveAttributes(_0x41df46);loggerPredictive[_0x2578('0x47')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x4427a4,_0x2578('0x1d2'),_0x41df46[_0x2578('0xc8')],_0x2578('0x27'),_0x41df46[_0x2578('0x44')]);}else if(!ifInterval(_0x41df46[_0x2578('0x1cd')],_0x41df46[_0x2578('0x27')])&&_[_0x2578('0x3d')](_0x41df46['startPredictive'])&&!_[_0x2578('0x3d')](_0x41df46[_0x2578('0x27')])){_0x41df46[_0x2578('0x26')]=moment()[_0x2578('0x42')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2578('0x47')](_0x41df46[_0x2578('0x44')],_0x2578('0x1d3'),_0x41df46[_0x2578('0x26')]);hopperUtils[_0x2578('0x1d4')](_0x41df46[_0x2578('0x1cd')])['then'](this[_0x2578('0x1d5')](_0x41df46))['then'](mergeDataErlangB(_0x41df46))[_0x2578('0x3b')](this[_0x2578('0x1d6')](_0x41df46))[_0x2578('0x97')](loggerCatchPredictive(_0x2578('0x1d7'),_0x41df46));}else if(!ifInterval(_0x41df46[_0x2578('0x1cd')],_0x41df46['startPredictive'])){_0x41df46['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x41df46[_0x2578('0x26')]=moment()[_0x2578('0x42')](_0x2578('0xba'));loggerPredictive['info'](_0x41df46[_0x2578('0x44')],_0x2578('0x1d8'),_0x41df46[_0x2578('0x26')]);clearInterval(_0x41df46[_0x2578('0x5d')]);_0x41df46[_0x2578('0x5d')]=undefined;hopperUtils[_0x2578('0x1d4')](_0x41df46['dialPredictiveInterval'])['then'](this[_0x2578('0x1d5')](_0x41df46))[_0x2578('0x3b')](mergeDataErlangB(_0x41df46))[_0x2578('0x3b')](this[_0x2578('0x1d6')](_0x41df46))[_0x2578('0x97')](loggerCatchPredictive(_0x2578('0x1d9'),_0x41df46));}else if(_0x41df46[_0x2578('0x1c4')]&&_0x42dea7<_0x41df46[_0x2578('0x1c4')]-_0x29aa7d){clearPredictiveAttributes(_0x41df46);loggerPredictive[_0x2578('0x47')](_0x41df46[_0x2578('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x42dea7,')\x20are\x20less\x20than\x20threshold\x20(',_0x41df46[_0x2578('0x1c4')],'-',_0x29aa7d,'=',_0x41df46[_0x2578('0x1c4')]-_0x29aa7d,')');}else if(_0x41df46[_0x2578('0x1c4')]&&_0x42dea7>_0x41df46['predictiveIntervalAvailable']+_0x4d79ff){clearPredictiveAttributes(_0x41df46);loggerPredictive[_0x2578('0x47')](_0x41df46[_0x2578('0x44')],_0x2578('0x1da'),_0x42dea7,_0x2578('0x1db'),_0x41df46[_0x2578('0x1c4')],'+',_0x4d79ff,'=',_0x41df46[_0x2578('0x1c4')]+_0x4d79ff,')');}};Dialer[_0x2578('0x18')][_0x2578('0x1d5')]=function(_0x4adf34){var _0x57b360=this;return function(_0x204b2d){return new Promise(function(_0x326319,_0x2ab559){_[_0x2578('0xf2')](_0x4adf34,_0x204b2d[0x0]);if(checkGetDataPredictive(_0x204b2d[0x0])){var _0x71c55d=_0x4adf34[_0x2578('0x1c4')]=_0x4adf34[_0x2578('0x142')]+_0x4adf34['available'];var _0x37b374=_0x4adf34[_0x2578('0x1cd')]*0x3c;var _0x4ae240=_0x204b2d[0x0][_0x2578('0x53')]+_0x204b2d[0x0][_0x2578('0x51')];var _0x5b1ebe=(_0x204b2d[0x0][_0x2578('0x4c')]+_0x204b2d[0x0][_0x2578('0x4e')]+_0x204b2d[0x0][_0x2578('0xdc')])/_0x204b2d[0x0][_0x2578('0x4a')];_0x4adf34[_0x2578('0x1c7')]=_0x5b1ebe>0x0?_0x5b1ebe:0x1;switch(_0x4adf34['dialPredictiveOptimization']){case _0x2578('0x1cf'):var _0x2f23ca=_0x4adf34[_0x2578('0x1dc')]/0x64;return _0x57b360[_0x2578('0x1dd')](_0x71c55d,_0x37b374,_0x4ae240,_0x5b1ebe,_0x2f23ca)[_0x2578('0x3b')](function(_0x158b47){return _0x326319(_0x158b47);});case _0x2578('0x1de'):var _0x36a460=_0x4adf34[_0x2578('0x1dc')]/0x64;return _0x57b360[_0x2578('0x1df')](_0x71c55d,_0x37b374,_0x4ae240,_0x5b1ebe,_0x36a460)[_0x2578('0x3b')](function(_0x37898d){return _0x326319(_0x37898d);});default:return _0x2ab559(msgResponse(_0x2578('0x1e0'),_0x2578('0x8a'),'Unknown\x20Predictive'));}}else{return _0x2ab559(msgResponse(_0x2578('0x1e0'),_0x2578('0x8a'),'check\x20failure'));}});};};Dialer[_0x2578('0x18')][_0x2578('0x1e1')]=function(_0x4dba75){var _0x1c411a=this;return function(_0x18d5fa){return new Promise(function(_0x47b12b,_0x5672d7){_[_0x2578('0xf2')](_0x4dba75,_0x18d5fa[0x0]);if(checkGetDataPredictive(_0x18d5fa[0x0])){loggerPredictive[_0x2578('0x47')](JSON['stringify'](_0x18d5fa[0x0]));if(_0x4dba75[_0x2578('0x1ce')]==='dropRate'){return _0x1c411a['getVoiceQueueRtPauses'](_0x4dba75['id'])[_0x2578('0x3b')](function(_0x344218){var _0x272972=_0x4dba75[_0x2578('0x1e2')]-_0x344218[0x0]['outboundQueuePauses'];var _0x570ed7=_0x4dba75[_0x2578('0x1cd')]*0x3c;var _0xbb0686=_0x18d5fa[0x0][_0x2578('0x53')]+_0x18d5fa[0x0]['predictiveIntervalAvgHoldtime'];var _0x35e511=(_0x18d5fa[0x0]['predictiveIntervalAnsweredCalls']+_0x18d5fa[0x0][_0x2578('0x4e')]+_0x18d5fa[0x0][_0x2578('0xdc')])/_0x18d5fa[0x0]['predictiveIntervalTotalCalls'];var _0xcc11f4=_0x4dba75[_0x2578('0x1dc')]/0x64;_0x4dba75[_0x2578('0x1e3')]=_0x344218[0x0][_0x2578('0x1e4')]||0x0;_0x4dba75[_0x2578('0x1c7')]=_0x35e511>0x0?_0x35e511:0x1;return _0x1c411a['abandonmentRate'](_0x272972,_0x570ed7,_0xbb0686,_0x35e511,_0xcc11f4);})[_0x2578('0x3b')](function(_0x413438){return _0x47b12b(_0x413438);})[_0x2578('0x97')](function(_0x7c3d7a){return _0x5672d7(msgResponse(_0x2578('0x1e5'),_0x2578('0x8a'),JSON[_0x2578('0x6c')](_0x7c3d7a)));});}if(_0x4dba75[_0x2578('0x1ce')]===_0x2578('0x1de')){return _0x1c411a['getVoiceQueueRtPauses'](_0x4dba75['id'])[_0x2578('0x3b')](function(_0x1ebbd5){var _0x1793bf=_0x4dba75[_0x2578('0x1e2')]-_0x1ebbd5[0x0][_0x2578('0x1e4')];var _0x61e255=_0x4dba75[_0x2578('0x1cd')]*0x3c;var _0x43ad90=_0x18d5fa[0x0]['predictiveIntervalAvgTalktime']+_0x18d5fa[0x0]['predictiveIntervalAvgHoldtime'];var _0x185cfb=(_0x18d5fa[0x0]['predictiveIntervalAnsweredCalls']+_0x18d5fa[0x0][_0x2578('0x4e')]+_0x18d5fa[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x18d5fa[0x0]['predictiveIntervalTotalCalls'];var _0xc39888=_0x4dba75[_0x2578('0x1dc')]/0x64;_0x4dba75['predictiveIntervalPauses']=_0x1ebbd5[0x0][_0x2578('0x1e4')]||0x0;_0x4dba75[_0x2578('0x1c7')]=_0x185cfb>0x0?_0x185cfb:0x1;return _0x1c411a['busyFactor'](_0x1793bf,_0x61e255,_0x43ad90,_0x185cfb,_0xc39888);})['then'](function(_0x15c5bd){return _0x47b12b(_0x15c5bd);})[_0x2578('0x97')](function(_0x32965b){return _0x5672d7(msgResponse(_0x2578('0x1e5'),'Failure',JSON[_0x2578('0x6c')](_0x32965b)));});}}else{return _0x5672d7(msgResponse(_0x2578('0x1e0'),_0x2578('0x8a'),'check\x20failure'));}});};};Dialer[_0x2578('0x18')]['startMethodPredictive']=function(_0x3fdc41){var _0x284236=this;return function(){var _0x3c23d8=0x0;var _0x2ae199=Math[_0x2578('0x1c6')](_0x3fdc41[_0x2578('0x1e6')]*0x3e8);if(_0x2ae199>0x0){_0x2ae199=_0x2ae199<0x64?0x64:_0x2ae199;loggerPredictive[_0x2578('0x47')](_0x3fdc41['name'],_0x2578('0x1e7'),_0x2ae199,_0x2578('0x1e8'));_0x3fdc41[_0x2578('0x5d')]=setInterval(function(){_0x284236[_0x2578('0x5d')](_0x3fdc41);loggerPredictiveCalls[_0x2578('0x47')](_0x2578('0x1e9'),_0x3c23d8+=0x1);},_0x2ae199);}else{loggerPredictive[_0x2578('0x47')](_0x3fdc41['name'],_0x2578('0x1ea'));}};};Dialer['prototype']['checkContactBlack']=function(_0x237139,_0x1bd7ba){var _0x538009=this;return function(_0x5d9287){if(_[_0x2578('0x46')](_0x5d9287)){if(_[_0x2578('0xee')](_0x1bd7ba['UserId'])||!_0x1bd7ba[_0x2578('0x1eb')]){if(_0x237139['dialMethod']===_0x2578('0x9')){_0x237139[_0x2578('0x6a')]=_[_0x2578('0x3d')](_0x237139[_0x2578('0x6a')])?!![]:_0x237139[_0x2578('0x6a')];var _0x212b86=uuid['v4']();_0x538009[_0x2578('0x22')][_0x212b86]=new Action(_0x237139,_0x1bd7ba,_0x212b86);loggerBooked[_0x2578('0x47')]('[booked][checkContactBlack]',_0x212b86,_0x2578('0x1ec'),JSON[_0x2578('0x6c')](_0x237139[_0x2578('0x6a')]),_0x2578('0x1ed'),_0x237139[_0x2578('0x44')]);if(_0x237139['queueStatusComplete']){_0x237139[_0x2578('0x6a')]=![];_0x538009[_0x2578('0x29')][_0x538009[_0x2578('0x22')][_0x212b86][_0x2578('0xbb')]]=[];ami[_0x2578('0x90')]({'actionid':_0x212b86,'action':_0x2578('0x1ee'),'queue':_0x237139[_0x2578('0x44')]})[_0x2578('0x97')](function(){utils[_0x2578('0xb7')](_0x237139,_0x2578('0x1ef'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x538009[_0x2578('0x22')][_0x212b86][_0x2578('0xfe')],'ListId':_0x538009[_0x2578('0x22')][_0x212b86][_0x2578('0xd4')],'VoiceQueueId':_0x538009['actions'][_0x212b86][_0x2578('0xe5')]||undefined,'CampaignId':_0x538009[_0x2578('0x22')][_0x212b86][_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0x1f0')));delete _0x538009[_0x2578('0x22')][_0x212b86];});}else{loggerBooked[_0x2578('0x47')](_0x2578('0x1f1'),JSON['stringify'](_0x237139[_0x2578('0x6a')]),_0x2578('0x1ed'),_0x237139[_0x2578('0x44')]);utils[_0x2578('0xb7')](_0x237139,'[checkContactBlack]');hopperUtils[_0x2578('0xd2')]({'active':![],'ContactId':_0x538009[_0x2578('0x22')][_0x212b86][_0x2578('0xfe')],'ListId':_0x538009[_0x2578('0x22')][_0x212b86][_0x2578('0xd4')],'VoiceQueueId':_0x538009[_0x2578('0x22')][_0x212b86][_0x2578('0xe5')]||undefined,'CampaignId':_0x538009['actions'][_0x212b86][_0x2578('0xd5')]||undefined})['catch'](loggerCatch(_0x2578('0x1f0')));delete _0x538009[_0x2578('0x22')][_0x212b86];}}else{return _0x538009['actionOriginate'](_0x237139,_0x1bd7ba);}}else{if(utils[_0x2578('0x1f2')](undefined,_0x1bd7ba['scheduledat'])<_0x237139[_0x2578('0x1f3')]*0x3c){if(_0x1bd7ba[_0x2578('0x14e')]&&!_0x1bd7ba[_0x2578('0x14e')][_0x2578('0x1f4')]){_0x538009['preview']['run'](_0x1bd7ba['id'])[_0x2578('0x1a')](function(){utils[_0x2578('0xb7')](_0x237139,_0x2578('0x1ef'));});}else{hopperUtils[_0x2578('0x1f5')]({'active':![]},_0x1bd7ba['id'],0x1)[_0x2578('0x1a')](function(){utils[_0x2578('0xb7')](_0x237139,_0x2578('0x1ef'));});}}else{_0x237139[_0x2578('0x1f6')]+=0x1;utils[_0x2578('0xb7')](_0x237139,'[checkContactBlack]');if(_0x237139['dialRecallInQueue']){hopperUtils[_0x2578('0xd2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1bd7ba[_0x2578('0xfe')],'ListId':_0x1bd7ba[_0x2578('0xd4')],'VoiceQueueId':_0x1bd7ba[_0x2578('0xe5')]||undefined,'CampaignId':_0x1bd7ba[_0x2578('0xd5')]||undefined})[_0x2578('0x97')](loggerCatch(_0x2578('0x1f7')));hopperUtils[_0x2578('0xc0')](createObjHistory(_0x237139,_0x1bd7ba,utils[_0x2578('0x6f')][_0x2578('0x1f8')],0x17,_0x2578('0x1f9')))[_0x2578('0x97')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x538009[_0x2578('0x117')](createObjHistory(_0x237139,_0x1bd7ba,utils[_0x2578('0x6f')][_0x2578('0x1fa')],0x16,_0x2578('0x1fb')),_0x2578('0x1fc'),'[Originate][HistoryRecallClose]');}}}}else{_0x237139[_0x2578('0x1fd')]+=0x1;_0x538009['saveInDb'](createObjHistory(_0x237139,_0x1bd7ba,utils[_0x2578('0x6f')][_0x2578('0x1fe')],0xd,_0x2578('0x1ff')),_0x2578('0x200'),_0x2578('0x201'));throw _0x2578('0x202');}};};Dialer['prototype'][_0x2578('0x162')]=function(_0x18391d){var _0x8033d9=this;var _0x167a93=_0x18391d['limitCalls']-_0x18391d[_0x2578('0x78')];emitCampaignSummary(_0x18391d);if(_0x167a93>0x0&&_0x18391d[_0x2578('0x203')]==0x0){if(_0x167a93>this[_0x2578('0x21')]){_0x167a93=this['maxNumberOriginate'];}_0x18391d[_0x2578('0x203')]=0x1;hopperUtils[_0x2578('0x204')](_0x18391d,_0x167a93)['then'](function(_0x40ec46){_0x18391d[_0x2578('0x203')]=0x0;if(_0x40ec46){if(!utils[_0x2578('0x205')](_0x40ec46)){_0x18391d[_0x2578('0x65')]=utils[_0x2578('0x6f')]['NO_AVAILABLE_CONTACTS'];logger[_0x2578('0x47')](_0x2578('0x206')+_0x18391d['name']);}else{_0x18391d['originated']+=_0x40ec46[_0x2578('0x8e')];_0x18391d[_0x2578('0x65')]=utils[_0x2578('0x6f')][_0x2578('0x207')];for(var _0xac2a22=0x0;_0xac2a22<_0x40ec46[_0x2578('0x8e')];_0xac2a22+=0x1){_0x18391d[_0x2578('0x208')]+=0x1;if(_['isNil'](_0x40ec46[_0xac2a22])||_[_0x2578('0xee')](_0x40ec46[_0xac2a22][_0x2578('0x17c')])||_[_0x2578('0xee')](_0x40ec46[_0xac2a22][_0x2578('0x166')])){_0x8033d9[_0x2578('0x159')](_0x2578('0x209'),_0x18391d,_0x40ec46[_0xac2a22]);}else{hopperUtils[_0x2578('0x20a')](_['pick'](_0x40ec46[_0xac2a22],[_0x2578('0xd5'),_0x2578('0x166')]))[_0x2578('0x3b')](_0x8033d9['checkContactBlack'](_0x18391d,_0x40ec46[_0xac2a22]))[_0x2578('0x97')](function(_0x337f54){logger[_0x2578('0x60')](_0x2578('0x20b'),_0x337f54);utils[_0x2578('0xb7')](_0x18391d,_0x2578('0x20c'));});}}}}})['catch'](function(_0x2ba169){_0x18391d[_0x2578('0x203')]=0x0;logger['error']('[getContactCampaign2]',_0x2ba169);});}};Dialer[_0x2578('0x18')][_0x2578('0xaa')]=function(_0x40f1a0,_0x122274){var _0x24e483=this;var _0x130a0f=[];if(_0x122274<0x1||_0x40f1a0['dialMethod']===_0x2578('0x9')){_0x122274=0x1;}var _0x322237=Math['floor'](_0x40f1a0[_0x2578('0x140')]*_0x122274)-_0x40f1a0[_0x2578('0x78')];if(_0x40f1a0['dialLimitQueue']>0x0){var _0x38f6c9=_0x40f1a0[_0x2578('0x20d')]-_0x40f1a0[_0x2578('0x78')]-_0x40f1a0[_0x2578('0x142')]-_0x40f1a0[_0x2578('0x143')];if(_0x322237>_0x38f6c9){_0x322237=_0x38f6c9;}}if(_0x322237>0x0&&_0x40f1a0[_0x2578('0x203')]==0x0){if(_0x40f1a0[_0x2578('0xa8')]===_0x2578('0x9')){_0x322237=0x1;}if(_0x322237>this[_0x2578('0x21')]){_0x322237=this[_0x2578('0x21')];}for(var _0x33a147 in this[_0x2578('0x1f')]){if(typeof this[_0x2578('0x1f')][_0x33a147]!==_0x2578('0xa2')){if(this['agents'][_0x33a147][_0x2578('0x68')]===_0x2578('0x20e')&&this[_0x2578('0x1f')][_0x33a147][_0x2578('0x80')]===_0x2578('0x81')){_0x130a0f[_0x2578('0x8f')](this['agents'][_0x33a147]['id']);}}}_0x40f1a0[_0x2578('0x203')]=0x1;hopperUtils[_0x2578('0x20f')](_0x40f1a0,_0x130a0f,_0x322237)[_0x2578('0x3b')](function(_0xa82ff9){_0x40f1a0[_0x2578('0x203')]=0x0;if(_0xa82ff9){if(!utils[_0x2578('0x205')](_0xa82ff9)){hopperUtils[_0x2578('0x210')](_0x40f1a0)[_0x2578('0x3b')](sendMessageReschedule(_0x40f1a0))[_0x2578('0x97')](loggerCatch('[countReScheduled]\x20'));}else{_0x40f1a0[_0x2578('0x78')]+=_0xa82ff9[_0x2578('0x8e')];_0x40f1a0[_0x2578('0x65')]=_0x40f1a0[_0x2578('0xa8')]===_0x2578('0x9')?utils[_0x2578('0x6f')][_0x2578('0x16d')]:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0xb2fefc=0x0;_0xb2fefc<_0xa82ff9[_0x2578('0x8e')];_0xb2fefc+=0x1){if(_[_0x2578('0xee')](_0xa82ff9[_0xb2fefc])||_[_0x2578('0xee')](_0xa82ff9[_0xb2fefc][_0x2578('0x17c')])||_[_0x2578('0xee')](_0xa82ff9[_0xb2fefc][_0x2578('0x166')])){_0x24e483[_0x2578('0x159')](_0x2578('0x209'),_0x40f1a0,_0xa82ff9[_0xb2fefc]);}else{hopperUtils[_0x2578('0x211')](_[_0x2578('0x6d')](_0xa82ff9[_0xb2fefc],['VoiceQueueId',_0x2578('0x166')]))['then'](_0x24e483['checkContactBlack'](_0x40f1a0,_0xa82ff9[_0xb2fefc]))[_0x2578('0x97')](function(_0x3aefa2){logger[_0x2578('0x60')](_0x2578('0x212'),_0x3aefa2);utils[_0x2578('0xb7')](_0x40f1a0,'[handlePower]');});}}}}})[_0x2578('0x97')](function(_0x36fce8){_0x40f1a0['temp']=0x0;logger[_0x2578('0x60')]('[getContactCampaign2]',_0x36fce8);});}};Dialer[_0x2578('0x18')][_0x2578('0x5d')]=function(_0x386468){if(_0x386468[_0x2578('0x20d')]>0x0){var _0x405bdd=_0x386468[_0x2578('0x20d')]-_0x386468['originated']-_0x386468[_0x2578('0x142')];if(_0x405bdd>0x0&&_0x386468['temp']==0x0){this['tryOriginatePredictive'](_0x386468);}else{loggerPredictiveCalls[_0x2578('0x47')](_0x2578('0x213'));}}else{this[_0x2578('0x214')](_0x386468);}};Dialer[_0x2578('0x18')][_0x2578('0x214')]=function(_0x272cab){var _0x51aeb6=this;var _0x5d7515=[];_0x272cab[_0x2578('0x78')]+=0x1;for(var _0x322554 in this[_0x2578('0x1f')]){if(typeof this[_0x2578('0x1f')][_0x322554]!==_0x2578('0xa2')){if(this['agents'][_0x322554][_0x2578('0x68')]===_0x2578('0x20e')&&this[_0x2578('0x1f')][_0x322554][_0x2578('0x80')]===_0x2578('0x81')){_0x5d7515['push'](this[_0x2578('0x1f')][_0x322554]['id']);}}}_0x272cab[_0x2578('0x203')]=0x1;return this[_0x2578('0x20f')](_0x272cab['id'],_0x5d7515,0x1,_0x272cab['dialOrderByScheduledAt'],_0x272cab)[_0x2578('0x3b')](function(_0x3fd71c){_0x272cab[_0x2578('0x203')]=0x1;if(_0x3fd71c){if(!utils[_0x2578('0x205')](_0x3fd71c)){utils[_0x2578('0x215')](_0x272cab,0x1,0x0);return hopperUtils[_0x2578('0x210')](_0x272cab)[_0x2578('0x3b')](sendMessageReschedule(_0x272cab))['catch'](loggerCatch(_0x2578('0x216')));}else{_0x272cab[_0x2578('0x65')]=utils[_0x2578('0x6f')][_0x2578('0x207')];if(_[_0x2578('0xee')](_0x3fd71c[0x0])||_[_0x2578('0xee')](_0x3fd71c[0x0][_0x2578('0x17c')])||_['isNil'](_0x3fd71c[0x0][_0x2578('0x166')])){_0x51aeb6[_0x2578('0x159')](_0x2578('0x209'),_0x272cab,_0x3fd71c[0x0]);}else{return hopperUtils[_0x2578('0x211')](_[_0x2578('0x6d')](_0x3fd71c[0x0],[_0x2578('0xe5'),_0x2578('0x166')]))[_0x2578('0x3b')](_0x51aeb6[_0x2578('0x217')](_0x272cab,_0x3fd71c[0x0]))[_0x2578('0x97')](function(_0x428ea0){logger[_0x2578('0x60')]('[actionOriginatePredictive]',_0x428ea0);utils['decrementOriginate'](_0x272cab,_0x2578('0x218'));});}}}})[_0x2578('0x97')](function(_0x1e932d){_0x272cab[_0x2578('0x203')]=0x0;logger[_0x2578('0x60')](_0x2578('0x219'),_0x1e932d);});};Dialer[_0x2578('0x18')][_0x2578('0x1dd')]=function(_0x544b01,_0x155710,_0x145cfa,_0x55a283,_0x36648d,_0x406cb4){loggerPredictive['info'](_0x2578('0x21a'));loggerPredictive['info'](_0x2578('0x21b'),_0x544b01);loggerPredictive[_0x2578('0x47')](_0x2578('0x21c'),_0x155710);loggerPredictive[_0x2578('0x47')](_0x2578('0x21d'),_0x145cfa);loggerPredictive[_0x2578('0x47')](_0x2578('0x21e'),_0x55a283);loggerPredictive[_0x2578('0x47')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x36648d);loggerPredictive[_0x2578('0x47')](_0x2578('0x54'));return new Promise(function(_0x194adb,_0x661f12){if(_0x544b01<=0x0||isNaN(_0x544b01)){return _0x661f12(msgResponse('[abandonmentRate]',_0x2578('0x7d'),_0x2578('0x21f')+_0x544b01));}if(_0x145cfa<=0x0||isNaN(_0x145cfa)){return _0x661f12(msgResponse(_0x2578('0x220'),'Error',_0x2578('0x221')+_0x145cfa));}if(_0x55a283<=0x0||isNaN(_0x55a283)){return _0x661f12(msgResponse(_0x2578('0x220'),'Error','p\x20=\x20'+_0x55a283));}if(_0x155710<=0x0||isNaN(_0x155710)){return _0x661f12(msgResponse('[abandonmentRate]',_0x2578('0x7d'),_0x2578('0x222')+_0x155710));}if(_0x36648d<=0x0||isNaN(_0x36648d)){return _0x661f12(msgResponse('[abandonmentRate]','Error',_0x2578('0x223')+_0x36648d));}_0x406cb4=_0x406cb4||0x0;var _0x45df5d=0x1/_0x145cfa;var _0x30fa62=0x0;var _0x3eed1c=0x0;var _0x387bf0=0x0;var _0x1db6bf=0x0;for(var _0x1af7c1=0x0;_0x387bf0<_0x36648d;_0x1af7c1+=0x1){_0x3eed1c=_0x1af7c1/_0x155710;_0x30fa62=(_0x55a283*_0x3eed1c+_0x406cb4)/_0x45df5d;_0x387bf0=utils['erlangb'](_0x30fa62,_0x544b01);_0x1db6bf=_0x30fa62/_0x544b01*(0x1-utils[_0x2578('0x224')](_0x30fa62,_0x544b01));}return _0x194adb({'erlangCalls':_0x1af7c1,'erlangCallToSecond':_0x155710/_0x1af7c1,'erlangAbandonmentRate':_0x387bf0,'erlangBusyFactor':_0x1db6bf});});};Dialer[_0x2578('0x18')]['busyFactor']=function(_0x3acc6d,_0x126ccd,_0xf1e5ad,_0x2f081e,_0x444354,_0x3845e8){loggerPredictive[_0x2578('0x47')](_0x2578('0x225'));loggerPredictive[_0x2578('0x47')](_0x2578('0x21b'),_0x3acc6d);loggerPredictive[_0x2578('0x47')](_0x2578('0x21c'),_0x126ccd);loggerPredictive[_0x2578('0x47')]('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',_0xf1e5ad);loggerPredictive[_0x2578('0x47')](_0x2578('0x21e'),_0x2f081e);loggerPredictive['info'](_0x2578('0x226'),_0x444354);loggerPredictive[_0x2578('0x47')]('---------------------------');return new Promise(function(_0x316a5f,_0xa361fe){if(_0x3acc6d<=0x0||isNaN(_0x3acc6d)){return _0xa361fe(msgResponse(_0x2578('0x227'),_0x2578('0x7d'),_0x2578('0x21f')+_0x3acc6d));}if(_0xf1e5ad<=0x0||isNaN(_0xf1e5ad)){return _0xa361fe(msgResponse('[busyFactor]',_0x2578('0x7d'),_0x2578('0x221')+_0xf1e5ad));}if(_0x2f081e<=0x0||isNaN(_0x2f081e)){return _0xa361fe(msgResponse('[busyFactor]','Error',_0x2578('0x228')+_0x2f081e));}if(_0x126ccd<=0x0||isNaN(_0x126ccd)){return _0xa361fe(msgResponse(_0x2578('0x227'),_0x2578('0x7d'),'interval\x20=\x20'+_0x126ccd));}if(_0x444354<=0x0||isNaN(_0x444354)){return _0xa361fe(msgResponse(_0x2578('0x227'),'Error',_0x2578('0x229')+_0x444354));}_0x3845e8=_0x3845e8||0x0;var _0x11b62c=0x1/_0xf1e5ad;var _0x373aa4=0x0;var _0x2d6b1e=0x0;var _0x3c99f9=0x0;var _0x32fa17=0x0;for(var _0x32a47f=0x0;_0x32fa17<_0x444354;_0x32a47f+=0x1){_0x2d6b1e=_0x32a47f/_0x126ccd;_0x373aa4=(_0x2f081e*_0x2d6b1e+_0x3845e8)/_0x11b62c;_0x3c99f9=utils[_0x2578('0x224')](_0x373aa4,_0x3acc6d);_0x32fa17=_0x373aa4/_0x3acc6d*(0x1-utils['erlangb'](_0x373aa4,_0x3acc6d));}return _0x316a5f({'erlangCalls':_0x32a47f,'erlangCallToSecond':_0x126ccd/_0x32a47f,'erlangAbandonmentRate':_0x3c99f9,'erlangBusyFactor':_0x32fa17});});};module['exports']=Dialer; \ No newline at end of file +var _0x530a=['nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','predictiveIntervalHitRate','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','getVoiceQueueRtPauses','loggedIn','outboundQueuePauses','agentBusyFactor','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','run','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','getContactDialer','[actionOriginate]\x20','[handlePower]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','checkIsBlackList','[actionOriginatePredictive]','--------\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','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','interval\x20=\x20','exports','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','booked','predictiveCalls','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/agentComplete','./models/hangup','env','prototype','enqueue','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','startPredictive','startProgressive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','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','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','debug','error','stack','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','queueStatusComplete','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20deactivated','[ifTime][Action]','Error','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','isTrunkReachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','ifTime','\x20Timezone\x20unknow\x20','length','push','command','iftime\x20%s,%s','interval','content','then','indexOf','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','predictive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueId','uniqueid','ivr','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','decrementOriginate','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','countdropretry','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','stateinterface','queueBooked','idHopper','finally','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','paused','unlockRR','[booked][RR]','pick','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','response','Success','callProgressDetecting','variable','exten','xcally-motion-dialer','dialAMDActive','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','value','MACHINE','outboundAnswerCallsDay','AMD','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','emit','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','[rescheduleContact][Machine]','[syncHangup]','cause-txt','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangup2]','Normal\x20Clearing','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','syncQueueSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','talking','pTalking','[syncQueueSummary]','queueSummaryCountersUpdated','assign','syncQueueSummaryComplete','filter','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','Action','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','user:%s','launchHandleIvr','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','Trunk','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','dialOriginateCallerIdName','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','substring','dialCutDigit','SIP/%s/%s%s','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][Abandoned]','dialMachineMaxRetry','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x530a,0x81));var _0xa530=function(_0x47a1b7,_0x5ca3ef){_0x47a1b7=_0x47a1b7-0x0;var _0x2d2767=_0x530a[_0x47a1b7];return _0x2d2767;};'use strict';var util=require('util');var _=require(_0xa530('0x0'));var uuid=require(_0xa530('0x1'));var moment=require(_0xa530('0x2'));var rr=require('rr');var Redis=require(_0xa530('0x3'));var utils=require(_0xa530('0x4'));var hopperUtils=require(_0xa530('0x5'));var ut=require('../preview/util/util');var config=require(_0xa530('0x6'));var logger=require(_0xa530('0x7'))('dialer');var loggerBooked=require('../../../config/logger')(_0xa530('0x8'));var loggerPredictive=require(_0xa530('0x7'))('predictive');var loggerPredictiveCalls=require(_0xa530('0x7'))(_0xa530('0x9'));var loggerSyncQueueSummary=require(_0xa530('0x7'))('syncQueueSummary');var ami=require(_0xa530('0xa'));config[_0xa530('0xb')]=_[_0xa530('0xc')](config[_0xa530('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xa530('0xd'))(new Redis(config['redis']));var cmHopper=require(_0xa530('0xe'));var voiceQueueRt=require(_0xa530('0xf'));var RpcSetting=require(_0xa530('0x10'));var Interval=require(_0xa530('0x11'));var Action=require('./models/action');var History=require(_0xa530('0x12'));var Final=require('./models/final');var AgentComplete=require(_0xa530('0x13'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0xa530('0x14'));var ipAgi=process[_0xa530('0x15')]['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xa530('0x16')][_0xa530('0x17')]=function(_0x31c88a){this[_0xa530('0x18')]=this[_0xa530('0x18')]?this['tail']['finally'](_0x31c88a):_0x31c88a();};function Dialer(_0x5ca62a,_0x27f3d1){this['sequence']=new Sequence();this[_0xa530('0x19')]=_0x27f3d1;this[_0xa530('0x1a')]=_0x5ca62a[_0xa530('0x1a')];this[_0xa530('0x1b')]=_0x5ca62a[_0xa530('0x1b')];this[_0xa530('0x1c')]=_0x5ca62a[_0xa530('0x1c')];this[_0xa530('0x1d')]=_0x5ca62a['trunks'];this[_0xa530('0x1e')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0xa530('0x1f')]={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this[_0xa530('0x20')]={};this[_0xa530('0x21')]={};this[_0xa530('0x22')]={};this['queueBooked']={};this[_0xa530('0x23')]={};this[_0xa530('0x24')]={};ami['on'](_0xa530('0x25'),this['syncAgentConnect'][_0xa530('0x26')](this));ami['on'](_0xa530('0x27'),this[_0xa530('0x28')][_0xa530('0x26')](this));ami['on'](_0xa530('0x29'),this[_0xa530('0x2a')][_0xa530('0x26')](this));ami['on'](_0xa530('0x2b'),this[_0xa530('0x2c')][_0xa530('0x26')](this));ami['on'](_0xa530('0x2d'),this['syncQueueSummary'][_0xa530('0x26')](this));ami['on'](_0xa530('0x2e'),this['syncQueueSummaryComplete'][_0xa530('0x26')](this));ami['on']('hangup',this[_0xa530('0x2f')][_0xa530('0x26')](this));ami['on'](_0xa530('0x30'),this[_0xa530('0x31')][_0xa530('0x26')](this));ami['on'](_0xa530('0x32'),this[_0xa530('0x33')][_0xa530('0x26')](this));ami['on'](_0xa530('0x34'),this[_0xa530('0x35')]['bind'](this));ami['on'](_0xa530('0x36'),this[_0xa530('0x37')][_0xa530('0x26')](this));this[_0xa530('0x38')]();this[_0xa530('0x39')]();RpcSetting[_0xa530('0x3a')]()['then'](function(_0x124534){previewRecallmeReminderInterval=_0x124534[_0xa530('0x3b')];});}function isNotNull(_0x5d4fad){return _0x5d4fad!==null&&!_[_0xa530('0x3c')](_0x5d4fad);}function msgResponse(_0xd86a0e,_0x333aed,_0x2c69c2){return{'action':_0xd86a0e,'response':_0x333aed,'message':_0x2c69c2,'stack':_0x2c69c2};}function emit(_0x579e99,_0x4798a2,_0x43d8cd){io['to'](_0x579e99)['emit'](_0x4798a2,_0x43d8cd);}function emitOutboundVoiceQueueSummary(_0x56e571){if(_0x56e571[_0xa530('0x3d')]===_0xa530('0x3e')){logger['debug'](_0xa530('0x3f'),util[_0xa530('0x40')](_0x56e571,{'showHidden':![],'depth':null}));emit(util['format'](_0xa530('0x41'),_0x56e571[_0xa530('0x42')]),_0xa530('0x43'),_0x56e571);}}function checkGetDataPredictive(_0x3c9035){if(isNotNull(_0x3c9035)&&!_[_0xa530('0x44')](_0x3c9035)){loggerPredictive[_0xa530('0x45')](_0xa530('0x46'));loggerPredictive[_0xa530('0x45')](_0xa530('0x47'),_0x3c9035[_0xa530('0x48')]);loggerPredictive[_0xa530('0x45')](_0xa530('0x49'),_0x3c9035['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xa530('0x45')](_0xa530('0x4a'),_0x3c9035[_0xa530('0x4b')]);loggerPredictive['info'](_0xa530('0x4c'),_0x3c9035[_0xa530('0x4d')]);loggerPredictive[_0xa530('0x45')](_0xa530('0x4e'),_0x3c9035['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xa530('0x45')](_0xa530('0x4f'),_0x3c9035[_0xa530('0x50')]);loggerPredictive[_0xa530('0x45')](_0xa530('0x51'));if(_0x3c9035[_0xa530('0x48')]>0x0){if(!_['isUndefined'](_0x3c9035[_0xa530('0x50')])&&_0x3c9035[_0xa530('0x50')]>0x0){return!![];}loggerPredictive[_0xa530('0x45')](_0xa530('0x52'));if(!_[_0xa530('0x3c')](_0x3c9035['predictiveIntervalAvgHoldtime'])&&_0x3c9035[_0xa530('0x53')]>0x0){return!![];}loggerPredictive[_0xa530('0x45')](_0xa530('0x54'));}else{loggerPredictive['info'](_0xa530('0x55'));}}else{loggerPredictive[_0xa530('0x45')](_0xa530('0x56'));}return![];}function mergeDataErlangB(_0x62c765){return function(_0x19ede2){loggerPredictive[_0xa530('0x45')](_0xa530('0x57'));loggerPredictive[_0xa530('0x45')](_0xa530('0x58'),_0x19ede2[_0xa530('0x59')]);loggerPredictive[_0xa530('0x45')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19ede2[_0xa530('0x5a')]);loggerPredictive[_0xa530('0x45')](_0xa530('0x5b'),_0x19ede2[_0xa530('0x5c')]);loggerPredictive[_0xa530('0x45')](_0xa530('0x5d'),_0x19ede2['erlangBusyFactor']);loggerPredictive[_0xa530('0x45')](_0xa530('0x5b'),_0x19ede2[_0xa530('0x5c')]);loggerPredictive[_0xa530('0x45')](_0xa530('0x51'));_[_0xa530('0x5e')](_0x62c765,_0x19ede2);};}function ifInterval(_0x2546a0,_0x3e3f74){if(_['isUndefined'](_0x3e3f74)){return![];}return utils[_0xa530('0x5f')](undefined,_0x3e3f74)<_0x2546a0*0x3c;}function clearPredictiveAttributes(_0x20e54f){if(_0x20e54f[_0xa530('0x21')]){_0x20e54f['startProgressive']=undefined;loggerPredictive['debug'](_0x20e54f[_0xa530('0x42')],_0xa530('0x60'));}if(_0x20e54f[_0xa530('0x20')]){_0x20e54f['startPredictive']=undefined;loggerPredictive['debug'](_0x20e54f[_0xa530('0x42')],_0xa530('0x61'));}if(_0x20e54f[_0xa530('0x62')]){clearInterval(_0x20e54f[_0xa530('0x62')]);_0x20e54f[_0xa530('0x62')]=undefined;loggerPredictive[_0xa530('0x63')](_0x20e54f['name'],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x5009d4,_0x474439){return function(_0x356548){loggerPredictive[_0xa530('0x64')](_0x474439[_0xa530('0x42')],_0x5009d4);loggerPredictive[_0xa530('0x64')](_0x356548[_0xa530('0x65')]);clearPredictiveAttributes(_0x474439);};}function loggerCatch(_0x2b9b22){return function(_0x36a4a4){logger[_0xa530('0x64')](_0x2b9b22,util[_0xa530('0x40')](_0x36a4a4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x281bc3){return function(_0xb9a906){if(isNotNull(_0xb9a906)&&isNotNull(_0xb9a906[0x0])){if(_0xb9a906[0x0][_0xa530('0x66')]>0x0){_0x281bc3[_0xa530('0x67')]=utils['CAMPAIGN_STATUS'][_0xa530('0x68')];logger[_0xa530('0x45')](_0xa530('0x69')+_0x281bc3[_0xa530('0x42')],_0xb9a906[0x0][_0xa530('0x66')],_0xa530('0x6a'));}else{_0x281bc3[_0xa530('0x67')]=utils[_0xa530('0x6b')][_0xa530('0x6c')];logger[_0xa530('0x45')]('[getContactDialer2][Empty]'+_0x281bc3[_0xa530('0x42')]);}}};}function createObjHistory(_0x29adc0,_0x39b625,_0x1ad448,_0x3062c5,_0x2c4595){_0x29adc0[_0xa530('0x67')]=_0x1ad448;var _0x200dbc=new Action(_0x29adc0,_0x39b625);var _0x345ee4=new History(_0x200dbc);_0x345ee4[_0xa530('0x6d')]=_0x3062c5;_0x345ee4[_0xa530('0x6e')]=_0x2c4595;_0x345ee4[_0xa530('0x6f')]=_0x200dbc['starttime'];return _0x345ee4;}function unlockQueueStatus(_0x17ef6b,_0x281f69){setTimeout(function(){if(_['isUndefined'](_0x17ef6b['queueStatusComplete'])){loggerBooked[_0xa530('0x64')](_0xa530('0x70'),_0x281f69);}_0x17ef6b['queueStatusComplete']=!![];loggerBooked['info'](_0xa530('0x71'),_0x281f69,JSON[_0xa530('0x72')](_['pick'](_0x17ef6b,[_0xa530('0x42'),_0xa530('0x73')])));},0x1f3);}function checkInterval(_0x831fe1){return function(){if(!isNotNull(_0x831fe1[_0xa530('0x74')])){_0x831fe1['message']=utils['CAMPAIGN_STATUS'][_0xa530('0x75')];throw _0x831fe1[_0xa530('0x42')]+_0xa530('0x76');}if(!isNotNull(_0x831fe1['Interval']['Intervals'])){_0x831fe1[_0xa530('0x67')]=utils['CAMPAIGN_STATUS'][_0xa530('0x75')];throw _0x831fe1[_0xa530('0x42')]+_0xa530('0x76');}if(!isNotNull(_[_0xa530('0x44')](_0x831fe1[_0xa530('0x74')][_0xa530('0x77')]))){_0x831fe1['message']=utils[_0xa530('0x6b')][_0xa530('0x75')];throw _0x831fe1[_0xa530('0x42')]+_0xa530('0x76');}};}function checkIsIVRCampaignActive(_0x2f14cd){return function(){if(!utils['isIVRCampaignActive'](_0x2f14cd)){_0x2f14cd[_0xa530('0x67')]=utils[_0xa530('0x6b')][_0xa530('0x78')];throw _0x2f14cd[_0xa530('0x42')]+_0xa530('0x79');}};}function emitCampaignSummary(_0x5e2e65){if(utils[_0xa530('0x7a')](_0x5e2e65)){emit(util[_0xa530('0x7b')](_0xa530('0x7c'),_0x5e2e65[_0xa530('0x42')]),_0xa530('0x7d'),_0x5e2e65);}}function loggerCatchQueueSummary(_0x1d199c,_0x454ce0){return function(_0x31ec9a){clearPredictiveAttributes(_0x454ce0);emitCampaignSummary(_0x454ce0);loggerSyncQueueSummary[_0xa530('0x63')](_0x1d199c,util[_0xa530('0x40')](_0x31ec9a,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x272710){if(_0x272710[_0xa530('0x7e')]){if(_0x272710[_0xa530('0x7f')]===0x0){_0x272710[_0xa530('0x7e')]=![];_0x272710[_0xa530('0x67')]=utils['CAMPAIGN_STATUS'][_0xa530('0x78')];loggerSyncQueueSummary[_0xa530('0x63')](_0xa530('0x80'),_0x272710['name'],'is\x20not\x20active');}else{_0x272710['message']=utils[_0xa530('0x6b')]['DISACTIVED'];loggerSyncQueueSummary['debug'](_0xa530('0x80'),_0x272710['name'],_0xa530('0x81'));}emitCampaignSummary(_0x272710);}}function myreject(_0x580356){return function(_0x4a6981){return _0x580356(msgResponse(_0xa530('0x82'),_0xa530('0x83'),JSON[_0xa530('0x72')](_0x4a6981)));};}Dialer[_0xa530('0x16')]['isTrunkReachable']=function(_0x5c75b5){return!_[_0xa530('0x3c')](_0x5c75b5)&&_0x5c75b5&&!_[_0xa530('0x3c')](_0x5c75b5[_0xa530('0x42')])&&!_[_0xa530('0x3c')](_0x5c75b5['active'])&&_0x5c75b5[_0xa530('0x84')]&&(this[_0xa530('0x1d')][util['format'](_0xa530('0x85'),_0x5c75b5['name'])][_0xa530('0x86')]===_0xa530('0x87')||this['trunks'][util[_0xa530('0x7b')](_0xa530('0x85'),_0x5c75b5[_0xa530('0x42')])][_0xa530('0x86')]===_0xa530('0x88'));};Dialer[_0xa530('0x16')][_0xa530('0x89')]=function(_0x18febe){var _0x4ca799=this;return function(){if(!_0x4ca799['isTrunkReachable'](_0x18febe['Trunk'])){if(!_0x4ca799[_0xa530('0x8a')](_0x18febe['TrunkBackup'])){_0x18febe[_0xa530('0x67')]=utils[_0xa530('0x6b')]['TRUNK_NOT_REACHABLE'];throw _0x18febe[_0xa530('0x42')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0xa530('0x8b')]=function(_0x529517,_0x981af,_0x380308,_0x561837){var _0x5ad7c3=this;return function(){var _0x3de147=!![];return _0x5ad7c3['ifTimeIvr'](_0x529517,_0x981af,_0x380308,_0x561837,_0x3de147);};};Dialer['prototype'][_0xa530('0x8c')]=function(_0x3e5d22,_0x5ddaa7,_0x51b681,_0x4e6edc){var _0x492fb3=this;return function(){var _0x317320=![];return _0x492fb3[_0xa530('0x8d')](_0x3e5d22[_0xa530('0x77')],_0x5ddaa7,_0x51b681,_0x4e6edc,_0x317320);};};Dialer[_0xa530('0x16')][_0xa530('0x8d')]=function(_0x49a92f,_0x523090,_0x3e03fc,_0x382677,_0x2c9c68){var _0x13cac1=[];return new Promise(function(_0x4869b0,_0x470c0b){if(!isNotNull(_0x49a92f)){_0x382677['message']=utils['CAMPAIGN_STATUS'][_0xa530('0x75')];return _0x470c0b(msgResponse('ifTime',_0xa530('0x8e'),_0x3e03fc+_0xa530('0x8f')));}if(_[_0xa530('0x44')](_0x49a92f)){_0x382677[_0xa530('0x67')]=utils[_0xa530('0x6b')][_0xa530('0x90')];return _0x470c0b(msgResponse('ifTime',_0xa530('0x8e'),_0x3e03fc+_0xa530('0x91')));}if(_0x523090&&_[_0xa530('0x3c')](config[_0xa530('0x92')][_0x523090])){_0x382677['message']=utils['CAMPAIGN_STATUS'][_0xa530('0x93')];return _0x470c0b(msgResponse(_0xa530('0x94'),'Failure',_0x3e03fc+_0xa530('0x95')+_0x523090));}if(_['isArray'](_0x49a92f)){for(var _0xbd4fa6=0x0;_0xbd4fa6<_0x49a92f[_0xa530('0x96')];_0xbd4fa6+=0x1){_0x13cac1[_0xa530('0x97')](ami['Action']({'action':_0xa530('0x98'),'command':util['format'](_0xa530('0x99'),_0x49a92f[_0xbd4fa6][_0xa530('0x9a')],!_[_0xa530('0x3c')](config[_0xa530('0x92')][_0x523090])?_0x523090:'')})['then'](function(_0x5869d1){return _0x5869d1[_0xa530('0x9b')]['indexOf']('true')>=0x0;})['catch'](myreject(_0x470c0b)));}}else{_0x13cac1[_0xa530('0x97')](ami['Action']({'action':'command','command':util[_0xa530('0x7b')](_0xa530('0x99'),_0x49a92f,!_[_0xa530('0x3c')](config['timezones'][_0x523090])?_0x523090:'')})[_0xa530('0x9c')](function(_0x144cf0){return _0x144cf0['content'][_0xa530('0x9d')](_0xa530('0x9e'))>=0x0;})[_0xa530('0x9f')](myreject(_0x470c0b)));}Promise[_0xa530('0xa0')](_0x13cac1)['then'](function(_0x45ad26){var _0x16b21a=_[_0xa530('0xa1')](_0x45ad26);if(_0x16b21a){return _0x4869b0(_0x16b21a);}else{_0x382677[_0xa530('0x67')]=_0x2c9c68?utils['CAMPAIGN_STATUS'][_0xa530('0xa2')]:utils[_0xa530('0x6b')][_0xa530('0xa3')];return _0x470c0b(msgResponse(_0xa530('0xa4'),_0xa530('0x8e'),_0xa530('0xa5')+_0x2c9c68+'\x20'+_0x3e03fc+_0xa530('0xa6')+util['inspect'](_0x49a92f,{'showHidden':![],'depth':null})+_0xa530('0xa7')+_0x523090));}})[_0xa530('0x9f')](function(_0x121033){return _0x470c0b(msgResponse(_0xa530('0x94'),_0xa530('0x8e'),JSON['stringify'](_0x121033)));});});};Dialer[_0xa530('0x16')][_0xa530('0x38')]=function(){var _0x478426=this;return cmHopper[_0xa530('0xa8')]({'active':![]},{'where':{'active':!![]}})[_0xa530('0x9c')](function(){setInterval(function(){_0x478426[_0xa530('0xa9')]();},0x3e8);});};Dialer[_0xa530('0x16')]['syncCampaigns']=function(){var _0x52069d=this;var _0x4e72eb;for(var _0x5597fc in this['campaigns']){if(typeof this['campaigns'][_0x5597fc]!==_0xa530('0xaa')){_0x4e72eb=this['campaigns'][_0x5597fc];if(utils[_0xa530('0x7a')](_0x4e72eb)&&utils['isIVRCampaignActive'](_0x4e72eb)){_0x4e72eb[_0xa530('0x7e')]=!![];Promise['resolve']()[_0xa530('0x9c')](checkIsIVRCampaignActive(_0x4e72eb))[_0xa530('0x9c')](checkInterval(_0x4e72eb))['then'](_0x52069d[_0xa530('0x89')](_0x4e72eb))[_0xa530('0x9c')](_0x52069d[_0xa530('0x8b')](_0x4e72eb[_0xa530('0xab')],_0x4e72eb[_0xa530('0xac')],_0x4e72eb[_0xa530('0x42')],_0x4e72eb))[_0xa530('0x9c')](_0x52069d[_0xa530('0x8c')](_0x4e72eb[_0xa530('0x74')],_0x4e72eb[_0xa530('0xac')],_0x4e72eb[_0xa530('0x42')],_0x4e72eb))[_0xa530('0x9c')](_0x52069d['launchHandleIvr'](_0x4e72eb))[_0xa530('0x9f')](loggerCatchQueueSummary(_0xa530('0xad'),_0x4e72eb));}else{notSendMessagesCampaign(_0x4e72eb);}}}};Dialer[_0xa530('0x16')][_0xa530('0xae')]=function(_0x303a09){if(_0x303a09[_0xa530('0xaf')]!==_0xa530('0xb0')){clearPredictiveAttributes(_0x303a09);}switch(_0x303a09[_0xa530('0xaf')]){case'progressive':this[_0xa530('0xb1')](_0x303a09,0x1);break;case _0xa530('0xb2'):this[_0xa530('0xb1')](_0x303a09,_0x303a09[_0xa530('0xb3')]);break;case'predictive':this['predictive'](_0x303a09);break;case _0xa530('0x8'):this['handlePower'](_0x303a09,0x1);break;default:logger[_0xa530('0x64')](_0xa530('0xb4'),_0x303a09['name'],_0xa530('0xb5'));}};Dialer['prototype'][_0xa530('0x94')]=function(_0x551db0,_0x1751ff){var _0x206a24=_0x551db0[_0xa530('0xac')];var _0x8a49f4=_0x1751ff?_0x551db0[_0xa530('0xab')]:_0x551db0[_0xa530('0x74')][_0xa530('0x77')];logger[_0xa530('0xb6')]('Dialer::ifTime()',_0x8a49f4,_0x206a24,_0x551db0[_0xa530('0x42')],util[_0xa530('0x7b')](_0xa530('0xb7'),_0x551db0[_0xa530('0x42')],_0x551db0['id']));var _0xe2ac01=null;return Interval['intervalIftime'](_0x8a49f4,_0x206a24)[_0xa530('0x9c')](function(_0x4c23a0){if(_0x4c23a0===!![]){return _0x4c23a0;}else{_0x551db0[_0xa530('0x67')]=_0x1751ff?utils[_0xa530('0x6b')][_0xa530('0xa2')]:utils[_0xa530('0x6b')][_0xa530('0xa3')];_0xe2ac01=msgResponse(_0xa530('0xa4'),_0xa530('0x8e'),'Global:\x20'+_0x1751ff+'\x20'+_0x551db0[_0xa530('0x42')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0xa530('0x40')](_0x8a49f4,{'showHidden':![],'depth':null})+_0xa530('0xa7')+_0x206a24);}if(_0xe2ac01!==null){logger[_0xa530('0xb6')](_0xa530('0xb8'),_0xe2ac01);_0xe2ac01[_0xa530('0xb9')]=_0x1751ff;throw _0xe2ac01;}})[_0xa530('0x9f')](function(_0x2d7f34){logger[_0xa530('0x64')](_0xa530('0xba'),_0x2d7f34);throw msgResponse(_0xa530('0x82'),_0xa530('0x83'),util[_0xa530('0x40')](_0x2d7f34,{'showHidden':![],'depth':null}));});};Dialer[_0xa530('0x16')][_0xa530('0xbb')]=function(_0x2baeaf){if(this[_0xa530('0x1a')][_0x2baeaf[_0xa530('0xbc')]]){if(this[_0xa530('0xbd')][_0x2baeaf[_0xa530('0xbe')]]&&this[_0xa530('0xbd')][_0x2baeaf[_0xa530('0xbe')]]['type']!==_0xa530('0xbf')){utils['decrementOriginate'](this[_0xa530('0x1a')][_0x2baeaf[_0xa530('0xbc')]],_0xa530('0xc0'));this[_0xa530('0xbd')][_0x2baeaf[_0xa530('0xbe')]][_0xa530('0xc1')]=moment()[_0xa530('0x7b')](_0xa530('0xc2'));}}};Dialer[_0xa530('0x16')][_0xa530('0x2c')]=function(_0x5570a6){var _0x57e968=this[_0xa530('0xbd')][_0x5570a6[_0xa530('0xbe')]];if(this[_0xa530('0x1a')][_0x5570a6[_0xa530('0xbc')]]){if(_0x57e968&&_0x57e968[_0xa530('0x3d')]!==_0xa530('0xbf')){delete this['uniqueId'][_0x5570a6[_0xa530('0xbe')]];this[_0xa530('0x1a')][_0x5570a6[_0xa530('0xbc')]]['outboundAnswerCallsDay']+=0x1;var _0x4ed67a=new AgentComplete(_0x57e968,_0x5570a6);if(_0x5570a6[_0xa530('0xc3')]===_0xa530('0xc4')){_0x4ed67a[_0xa530('0xc5')]=this[_0xa530('0x1a')][_0x5570a6[_0xa530('0xbc')]][_0xa530('0xc6')]&&this[_0xa530('0x1a')][_0x5570a6['queue']][_0xa530('0xc7')]?moment()[_0xa530('0x7b')](_0xa530('0xc2')):undefined;}hopperUtils[_0xa530('0xc8')](_0x4ed67a)[_0xa530('0x9f')](loggerCatch(_0xa530('0xc9')));hopperUtils[_0xa530('0xca')](_0x4ed67a)[_0xa530('0x9f')](loggerCatch(_0xa530('0xcb')));}}};Dialer[_0xa530('0x16')][_0xa530('0x28')]=function(_0x266c5f){var _0x3c63f2=this['uniqueId'][_0x266c5f['uniqueid']];var _0x29b77a=this;var _0x1772ec=![];var _0x4ea4aa;var _0x3f8e7d;if(this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]]){if(_0x3c63f2&&_0x3c63f2['type']!=='ivr'){delete this[_0xa530('0xbd')][_0x266c5f[_0xa530('0xbe')]];utils[_0xa530('0xcc')](this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]],_0xa530('0xcd'));_0x3c63f2[_0xa530('0xce')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x3b8947=new QueueCallerAbandon(_0x3c63f2,_0x266c5f);if(utils[_0xa530('0x5f')](_0x3c63f2[_0xa530('0xce')],_0x3c63f2[_0xa530('0xcf')])>=_0x3c63f2[_0xa530('0xd0')]){this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xa530('0x1a')][_0x266c5f['queue']][_0xa530('0xd1')]+=0x1;this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x3b8947[_0xa530('0x6d')]=0xa;_0x3b8947[_0xa530('0x6e')]=_0xa530('0xd2');_0x3b8947[_0xa530('0xd3')]=_0xa530('0xd4');_0x3b8947[_0xa530('0xc5')]=this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xc6')]?moment()[_0xa530('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x3b8947[_0xa530('0xd5')]+=0x1;_0x3b8947['countglobal']+=0x1;_0x4ea4aa=this['voiceQueues'][_0x266c5f[_0xa530('0xbc')]]['dialDropRetryFrequency'];_0x3f8e7d=this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xd6')];hopperUtils[_0xa530('0xd7')](_0x3b8947,_0x3b8947[_0xa530('0x6d')],_0x3c63f2[_0xa530('0xd8')])[_0xa530('0x9c')](function(_0x24ab6a){_0x1772ec=_0x24ab6a[_0xa530('0xd9')]==0x1;if(_0x3b8947[_0xa530('0xd5')]>=_0x29b77a['voiceQueues'][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xda')]){_0x29b77a[_0xa530('0xdb')](_0x3b8947,_0x24ab6a[_0xa530('0xd9')]);}else{hopperUtils[_0xa530('0xdc')]({'active':![],'countdropretry':_0x3b8947[_0xa530('0xd5')],'scheduledat':moment()[_0xa530('0xdd')](_0x29b77a[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xde')],_0xa530('0xdf'))[_0xa530('0x7b')](_0xa530('0xc2')),'ContactId':_0x3c63f2[_0xa530('0xe0')],'ListId':_0x3c63f2[_0xa530('0xe1')],'VoiceQueueId':_0x3c63f2[_0xa530('0xe2')]||undefined,'CampaignId':_0x3c63f2[_0xa530('0xe3')]||undefined})['catch'](loggerCatch(_0xa530('0xe4')));var _0x2308b5=new History(_0x3b8947);_0x2308b5['state']=0xa;_0x2308b5[_0xa530('0x6e')]=_0xa530('0xd2');_0x2308b5[_0xa530('0xe5')]=moment()[_0xa530('0x7b')](_0xa530('0xc2'));_0x2308b5[_0xa530('0x6f')]=_0x2308b5[_0xa530('0xe5')];_0x2308b5['calleridname']=_0x3b8947[_0xa530('0xe6')];_0x2308b5['calleridnum']=_0x3b8947[_0xa530('0xe7')];hopperUtils[_0xa530('0xc8')](_0x2308b5)['catch'](loggerCatch(_0xa530('0xe8')));}})[_0xa530('0x9c')](function(){if(_0x1772ec)hopperUtils[_0xa530('0xe9')](_0x3b8947,_0x4ea4aa,_0x3f8e7d)['then'](function(){return 0x1;});});}else{this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]][_0xa530('0x4d')]+=0x1;this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xea')]+=0x1;_0x3b8947['state']=0xb;_0x3b8947[_0xa530('0x6e')]=_0xa530('0xeb');_0x3b8947[_0xa530('0xd3')]=_0xa530('0xec');_0x3b8947[_0xa530('0xed')]+=0x1;_0x3b8947[_0xa530('0xee')]+=0x1;_0x4ea4aa=this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xef')];_0x3f8e7d=this[_0xa530('0x1a')][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xd6')];hopperUtils[_0xa530('0xd7')](_0x3b8947,_0x3b8947[_0xa530('0x6d')],_0x3c63f2[_0xa530('0xd8')])[_0xa530('0x9c')](function(_0x41d251){if(_0x3b8947[_0xa530('0xed')]>=_0x29b77a['voiceQueues'][_0x266c5f[_0xa530('0xbc')]][_0xa530('0xf0')]){_0x29b77a[_0xa530('0xdb')](_0x3b8947,_0x41d251[_0xa530('0xd9')]);}else{hopperUtils[_0xa530('0xdc')]({'active':![],'countabandonedretry':_0x3b8947[_0xa530('0xed')],'scheduledat':moment()['add'](_0x29b77a[_0xa530('0x1a')][_0x266c5f['queue']][_0xa530('0xef')],_0xa530('0xdf'))[_0xa530('0x7b')](_0xa530('0xc2')),'ContactId':_0x3c63f2[_0xa530('0xe0')],'ListId':_0x3c63f2[_0xa530('0xe1')],'VoiceQueueId':_0x3c63f2[_0xa530('0xe2')]||undefined,'CampaignId':_0x3c63f2[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4c2921=new History(_0x3b8947);_0x4c2921[_0xa530('0x6d')]=0xb;_0x4c2921[_0xa530('0x6e')]=_0xa530('0xeb');_0x4c2921[_0xa530('0xe5')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4c2921[_0xa530('0x6f')]=_0x4c2921[_0xa530('0xe5')];_0x4c2921[_0xa530('0xe6')]=_0x3b8947[_0xa530('0xe6')];_0x4c2921['calleridnum']=_0x3b8947[_0xa530('0xe7')];hopperUtils[_0xa530('0xc8')](_0x4c2921)[_0xa530('0x9f')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xa530('0x9c')](function(){if(_0x1772ec)hopperUtils['swapAdditionalPhones'](_0x3b8947,_0x4ea4aa,_0x3f8e7d)[_0xa530('0x9c')](function(){return 0x1;});});}}}};Dialer[_0xa530('0x16')][_0xa530('0x31')]=function(_0x36b881){if(this[_0xa530('0x1f')][_0x36b881['uniqueid']]){this[_0xa530('0x1f')][_0x36b881[_0xa530('0xbe')]][_0xa530('0xf1')]=_0x36b881['channel'];}if(this['uniqueId'][_0x36b881[_0xa530('0xbe')]]){this[_0xa530('0xbd')][_0x36b881[_0xa530('0xbe')]][_0xa530('0xf1')]=_0x36b881[_0xa530('0xf1')];}};Dialer[_0xa530('0x16')]['syncQueueMember']=function(_0x53a0dd){if(!this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]]){return;}var _0x188be2=this['voiceQueues'][this['actions'][_0x53a0dd[_0xa530('0xf2')]][_0xa530('0xbc')]][_0xa530('0xf3')]||_0xa530('0xf4');if(_0x188be2===_0xa530('0xf5')){if(this['actions'][_0x53a0dd[_0xa530('0xf2')]]&&_[_0xa530('0xf6')](this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]][_0xa530('0xf7')])&&_0x53a0dd['status']==='1'&&_0x53a0dd['paused']==='0'){if(this[_0xa530('0x1c')][_0x53a0dd[_0xa530('0xf8')]]){if(!this['agents'][_0x53a0dd[_0xa530('0xf8')]]['locked']){this['agents'][_0x53a0dd[_0xa530('0xf8')]][_0xa530('0xf7')]=!![];this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]][_0xa530('0xf7')]=!![];this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]][_0xa530('0xf8')]=_0x53a0dd[_0xa530('0xf8')];}}}}else if(_0x188be2===_0xa530('0xf4')){if(this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]]){if(this['agents'][_0x53a0dd[_0xa530('0xf8')]]){this['actions'][_0x53a0dd[_0xa530('0xf2')]][_0xa530('0xf8')]=_0x53a0dd[_0xa530('0xf8')];if(_['isNil'](this[_0xa530('0xf9')][this['actions'][_0x53a0dd['actionid']][_0xa530('0xbc')]])){this['queueBooked'][this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]][_0xa530('0xbc')]]=[];}this[_0xa530('0xf9')][this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]][_0xa530('0xbc')]][_0xa530('0x97')](_['merge'](_['pick'](this[_0xa530('0x1f')][_0x53a0dd[_0xa530('0xf2')]],[_0xa530('0xfa'),_0xa530('0xf8')]),{'status':_0x53a0dd[_0xa530('0x86')],'paused':_0x53a0dd['paused']}));}}}};Dialer[_0xa530('0x16')]['syncQueueStatusComplete']=function(_0x514155){if(!this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]]){return;}var _0x565b5d=this;var _0x4f861f=this[_0xa530('0x1a')][this['actions'][_0x514155[_0xa530('0xf2')]]['queue']];var _0x3f0cd6=_0x4f861f[_0xa530('0xf3')]||'rrmemory';if(_0x3f0cd6===_0xa530('0xf5')){if(this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]]&&this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xf8')]){this[_0xa530('0x19')]['run'](this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xfa')],this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xf8')])['catch'](function(_0x5241ef){logger[_0xa530('0x64')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xa530('0x40')](_0x5241ef,{'showHidden':![],'depth':null}));})[_0xa530('0xfb')](function(){utils[_0xa530('0xcc')](_0x565b5d[_0xa530('0x1a')][_0x565b5d[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]],_0xa530('0xfc'));_0x565b5d[_0xa530('0x1c')][_0x565b5d[_0xa530('0x1f')][_0x514155['actionid']][_0xa530('0xf8')]][_0xa530('0xf7')]=![];delete _0x565b5d['actions'][_0x514155['actionid']];unlockQueueStatus(_0x4f861f);});}else{utils[_0xa530('0xcc')](this[_0xa530('0x1a')][this[_0xa530('0x1f')][_0x514155['actionid']][_0xa530('0xbc')]],_0xa530('0xfc'));hopperUtils[_0xa530('0xdc')]({'active':![],'ContactId':this[_0xa530('0x1f')][_0x514155['actionid']]['ContactId'],'ListId':this[_0xa530('0x1f')][_0x514155['actionid']]['ListId'],'VoiceQueueId':this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xe2')]||undefined,'CampaignId':this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch(_0xa530('0xfd')));delete this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]];unlockQueueStatus(_0x4f861f);}}else if(_0x3f0cd6===_0xa530('0xf4')){var _0xfc7c18;if(this['actions'][_0x514155[_0xa530('0xf2')]]&&!_[_0xa530('0x44')](this['queueBooked'][this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]])){if(this[_0xa530('0x23')][_0x565b5d[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]]['queue']]){this[_0xa530('0x23')][_0x565b5d[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]]=this['queueBookedRR'][this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]]?this[_0xa530('0x23')][this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]]:this['queueBooked'][this[_0xa530('0x1f')][_0x514155['actionid']][_0xa530('0xbc')]]?this[_0xa530('0xf9')][this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]][_0xa530('0xfe')]||0x0:0x0;}this[_0xa530('0xf9')][this['actions'][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]][_0xa530('0xfe')]=this['queueBookedRR'][this[_0xa530('0x1f')][_0x514155[_0xa530('0xf2')]][_0xa530('0xbc')]];for(var _0x228dfe=0x0;_0x228dfe=_0x5b5516[_0xa530('0x126')]){_0x41d187[_0xa530('0x127')](_0x23eda3,_0x1cf858,_0x157803,_0xa530('0x128'));}else{if(_0x23eda3[_0xa530('0x120')]>=_0x5b5516['dialMachineMaxRetry']){_0x41d187[_0xa530('0x129')](_0x23eda3,_0x1cf858,_0x157803,_0xa530('0x12a'));}else{hopperUtils[_0xa530('0xdc')]({'active':![],'countmachineretry':_0x23eda3[_0xa530('0x120')],'scheduledat':moment()[_0xa530('0xdd')](_0x5b5516[_0xa530('0x12b')],_0xa530('0xdf'))[_0xa530('0x7b')](_0xa530('0xc2')),'ContactId':_0x23eda3['ContactId'],'ListId':_0x23eda3['ListId'],'VoiceQueueId':_0x23eda3['VoiceQueueId']||undefined,'CampaignId':_0x23eda3[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch('[rescheduleContact][Machine]'));_0x1cf858({'reschedule':0x1});}}});}if(_0x4bcf46['type']===_0xa530('0xbf')&&this[_0xa530('0x1b')][_0x4bcf46[_0xa530('0xbc')]][_0xa530('0x111')]&&_0x5e3121[_0xa530('0x11c')]==='HANGUP'){delete this['uniqueId'][_0x5e3121[_0xa530('0xbe')]];utils[_0xa530('0xcc')](this[_0xa530('0x1b')][_0x4bcf46[_0xa530('0xbc')]],_0xa530('0x113'));_0x30b680=new Hangup(_0x4bcf46,_0x5e3121);_0x30b680[_0xa530('0x6d')]=0x12;_0x30b680[_0xa530('0x6e')]=_0xa530('0x115');_0x30b680[_0xa530('0x116')]=_0xa530('0x11f');ami[_0xa530('0x12c')](_0xa530('0x117'),ut[_0xa530('0x118')](_0x30b680,_0xa530('0x119')));this[_0xa530('0x11a')](_0x30b680,_0xa530('0x12d'),_0xa530('0x12e'));}if(_0x4bcf46['type']==='ivr'&&this[_0xa530('0x1b')][_0x4bcf46[_0xa530('0xbc')]][_0xa530('0x111')]&&_0x5e3121[_0xa530('0x11c')]===_0xa530('0x11d')){return new Promise(function(_0x12af1d,_0x1ecc38){delete _0x41d187[_0xa530('0xbd')][_0x5e3121[_0xa530('0xbe')]];utils['decrementOriginate'](_0x41d187[_0xa530('0x1b')][_0x4bcf46[_0xa530('0xbc')]],_0xa530('0x113'));_0x41d187[_0xa530('0x1b')][_0x4bcf46[_0xa530('0xbc')]]['outboundAnswerCallsDay']+=0x1;_0x41d187[_0xa530('0x1b')][_0x4bcf46[_0xa530('0xbc')]][_0xa530('0x114')]+=0x1;var _0x5d0450=_0x41d187['campaigns'][_0x4bcf46[_0xa530('0xbc')]];var _0x14ac5a=new Hangup(_0x4bcf46,_0x5e3121);_0x14ac5a['state']=0x13;_0x14ac5a[_0xa530('0x6e')]='Machine';_0x14ac5a[_0xa530('0x116')]=_0xa530('0x11f');_0x14ac5a[_0xa530('0x120')]+=0x1;_0x14ac5a['countglobal']+=0x1;_0x14ac5a[_0xa530('0x119')]=!![];ami[_0xa530('0x12c')]('custom:amd',ut[_0xa530('0x118')](_0x14ac5a,'amd'));hopperUtils[_0xa530('0xc8')](_0x14ac5a)[_0xa530('0x9f')](loggerCatch(_0xa530('0x12f')));if(_0x14ac5a[_0xa530('0x121')]+_0x14ac5a[_0xa530('0x122')]+_0x14ac5a[_0xa530('0x123')]+_0x14ac5a[_0xa530('0x124')]+_0x14ac5a[_0xa530('0xd5')]+_0x14ac5a[_0xa530('0xed')]+_0x14ac5a[_0xa530('0x120')]+_0x14ac5a[_0xa530('0x125')]>=_0x5d0450[_0xa530('0x126')]){_0x41d187[_0xa530('0x127')](_0x14ac5a,_0x12af1d,_0x1ecc38,'reason19\x20machine....');}else{if(_0x14ac5a[_0xa530('0x120')]>=_0x5d0450['dialMachineMaxRetry']){_0x41d187['createStateFinal'](_0x14ac5a,_0x12af1d,_0x1ecc38,_0xa530('0x12a'));}else{hopperUtils[_0xa530('0xdc')]({'active':![],'countmachineretry':_0x14ac5a['countmachineretry'],'scheduledat':moment()[_0xa530('0xdd')](_0x5d0450['dialMachineRetryFrequency'],_0xa530('0xdf'))[_0xa530('0x7b')](_0xa530('0xc2')),'ContactId':_0x14ac5a['ContactId'],'ListId':_0x14ac5a[_0xa530('0xe1')],'VoiceQueueId':_0x14ac5a[_0xa530('0xe2')]||undefined,'CampaignId':_0x14ac5a[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch(_0xa530('0x130')));_0x12af1d({'reschedule':0x1});}}});}}};Dialer[_0xa530('0x16')][_0xa530('0x2f')]=function(_0x46b26){var _0x6fe97b=this[_0xa530('0xbd')][_0x46b26[_0xa530('0xbe')]];var _0x24ba83;if(!_0x6fe97b){return;}if(_0x6fe97b['type']==='ivr'){delete this[_0xa530('0xbd')][_0x46b26[_0xa530('0xbe')]];utils[_0xa530('0xcc')](this[_0xa530('0x1b')][_0x6fe97b[_0xa530('0xbc')]],_0xa530('0x131'));this[_0xa530('0x1b')][_0x6fe97b[_0xa530('0xbc')]]['ivrAnswerCallsDay']+=0x1;if(_0x46b26[_0xa530('0x132')]==='Normal\x20Clearing'){const _0x122816=new AgentComplete(_0x6fe97b,_0x46b26);_0x122816['CampaignId']=this[_0xa530('0x1b')][_0x6fe97b[_0xa530('0xbc')]]['id'];hopperUtils['createHistory'](_0x122816)[_0xa530('0x9f')](loggerCatch(_0xa530('0x133')));hopperUtils[_0xa530('0xca')](_0x122816)[_0xa530('0x9f')](loggerCatch(_0xa530('0x134')));}else{_0x24ba83=new Hangup(_0x6fe97b,_0x46b26);hopperUtils[_0xa530('0xc8')](_0x24ba83)[_0xa530('0x9f')](loggerCatch(_0xa530('0x135')));hopperUtils[_0xa530('0xca')](_0x24ba83)[_0xa530('0x9f')](loggerCatch(_0xa530('0x136')));}}else{if(isNotNull(this['voiceQueues'][_0x6fe97b[_0xa530('0xbc')]][_0xa530('0x137')])){delete this[_0xa530('0xbd')][_0x46b26[_0xa530('0xbe')]];utils[_0xa530('0xcc')](this[_0xa530('0x1a')][_0x6fe97b[_0xa530('0xbc')]],'[syncHangup]');this[_0xa530('0x1a')][_0x6fe97b[_0xa530('0xbc')]][_0xa530('0x11e')]+=0x1;this['voiceQueues'][_0x6fe97b['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x24ba83=new Hangup(_0x6fe97b,_0x46b26);_0x24ba83['state']=0x10;_0x24ba83['statedesc']=_0xa530('0x138');_0x24ba83['membername']=_0xa530('0x139');hopperUtils[_0xa530('0xc8')](_0x24ba83)[_0xa530('0x9f')](loggerCatch(_0xa530('0x135')));hopperUtils[_0xa530('0xca')](_0x24ba83)[_0xa530('0x9f')](loggerCatch(_0xa530('0x136')));}else{delete this['uniqueId'][_0x46b26['uniqueid']];utils[_0xa530('0xcc')](this[_0xa530('0x1a')][_0x6fe97b[_0xa530('0xbc')]],_0xa530('0x13a'));if(_0x46b26[_0xa530('0x132')]===_0xa530('0x13b')){this[_0xa530('0x1a')][_0x6fe97b['queue']]['outboundAnswerCallsDay']+=0x1;const _0x2d7926=new AgentComplete(_0x6fe97b,_0x46b26);_0x2d7926[_0xa530('0xe2')]=this['voiceQueues'][_0x6fe97b[_0xa530('0xbc')]]['id'];hopperUtils[_0xa530('0xc8')](_0x2d7926)[_0xa530('0x9f')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xa530('0xca')](_0x2d7926)[_0xa530('0x9f')](loggerCatch(_0xa530('0xcb')));}else{this['voiceQueues'][_0x6fe97b[_0xa530('0xbc')]][_0xa530('0x13c')]+=0x1;_0x24ba83=new Hangup(_0x6fe97b,_0x46b26);_0x24ba83['state']=0xc;_0x24ba83['statedesc']=_0x46b26['cause-txt'];_0x24ba83[_0xa530('0x116')]=_0xa530('0x13d');hopperUtils[_0xa530('0xc8')](_0x24ba83)[_0xa530('0x9f')](loggerCatch(_0xa530('0x13e')));hopperUtils[_0xa530('0xca')](_0x24ba83)[_0xa530('0x9f')](loggerCatch(_0xa530('0x131')));}}}};Dialer['prototype'][_0xa530('0x13f')]=function(_0x56dbf6){var _0xd43b73=this;if(!_0xd43b73[_0xa530('0x24')][_0x56dbf6[_0xa530('0x42')]]){_0xd43b73[_0xa530('0x24')][_0x56dbf6['name']]={'running':![]};}else if(_0xd43b73[_0xa530('0x24')][_0x56dbf6[_0xa530('0x42')]][_0xa530('0x140')]===!![]){return;}else if(_0xd43b73[_0xa530('0x24')][_0x56dbf6[_0xa530('0x42')]][_0xa530('0x140')]===![]){_0xd43b73[_0xa530('0x24')][_0x56dbf6['name']][_0xa530('0x140')]=!![];}var _0x5e89b2=_0xd43b73[_0xa530('0x1a')][_0x56dbf6[_0xa530('0x42')]];var _0x19f73a=_0x5e89b2['message']!==utils['CAMPAIGN_STATUS'][_0xa530('0x78')];var _0x35426d=utils[_0xa530('0x141')](_0x5e89b2);_0x5e89b2[_0xa530('0x142')]=utils[_0xa530('0x143')](_0x5e89b2,_0xd43b73[_0xa530('0x1d')]);Promise[_0xa530('0x144')]()['then'](function(){if(_0x5e89b2[_0xa530('0x142')]===utils[_0xa530('0x6b')][_0xa530('0x78')]){if(_0x19f73a){clearPredictiveAttributes(_0x5e89b2);_0x56dbf6[_0xa530('0x20')]=undefined;_0x56dbf6[_0xa530('0x21')]=undefined;}if(_0x5e89b2[_0xa530('0x142')]===utils[_0xa530('0x6b')][_0xa530('0x78')]){_0x56dbf6[_0xa530('0x145')]=0x0;_0x56dbf6[_0xa530('0xff')]=0x0;_0x56dbf6[_0xa530('0x146')]=0x0;_0x56dbf6[_0xa530('0x147')]=0x0;_0x56dbf6[_0xa530('0x148')]=0x0;}}else if(_0x5e89b2['statusMessage']===utils[_0xa530('0x6b')]['ACTIVE']&&!_0x35426d){return _0xd43b73[_0xa530('0x94')](_0x5e89b2,!![])[_0xa530('0x9c')](function(){return _0xd43b73[_0xa530('0x94')](_0x5e89b2,![]);})[_0xa530('0x9c')](function(){return _0xd43b73[_0xa530('0xae')](_0x5e89b2);})[_0xa530('0x9f')](function(_0x130b75){loggerSyncQueueSummary['debug'](_0xa530('0x149'),util[_0xa530('0x40')](_0x130b75,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5e89b2);});}else{clearPredictiveAttributes(_0x5e89b2);}})[_0xa530('0x9c')](function(){var _0x3676c2=_0x56dbf6['compareToOutboundQueue'](_0x5e89b2);if(_0x3676c2||_0x5e89b2['queueSummaryCountersUpdated']){_0x5e89b2[_0xa530('0x14a')]=![];_0x56dbf6['updateReportFromOutboundQueue'](_0x5e89b2);Object[_0xa530('0x14b')](_0x5e89b2,_0x56dbf6);emitOutboundVoiceQueueSummary(_0x56dbf6);}_0xd43b73['queuesSummary'][_0x5e89b2[_0xa530('0x42')]][_0xa530('0x140')]=![];})['catch'](function(_0x3c3f76){logger['error'](_0xa530('0x149'),util[_0xa530('0x40')](_0x3c3f76,{'showHidden':![],'depth':null}));_0xd43b73[_0xa530('0x24')][_0x5e89b2[_0xa530('0x42')]]['running']=![];});};Dialer['prototype'][_0xa530('0x14c')]=_['throttle'](function(){var _0x31315c=_[_0xa530('0x14d')](this['voiceQueues'],function(_0x4a4cdb){return _0x4a4cdb['dialPreviewRecallmeReminder'];});var _0x710ccb=_[_0xa530('0x14d')](this[_0xa530('0x1c')],function(_0x23effd){return _0x23effd['online']&&_0x23effd[_0xa530('0x86')]==='reachable';});if(_0x31315c[_0xa530('0x96')]>0x0&&_0x710ccb['length']>0x0){return Promise[_0xa530('0x144')]()[_0xa530('0x9c')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x31315c,'id'),previewRecallmeReminderInterval,_[_0xa530('0x14e')](_0x710ccb,'id')))['then'](function(_0x420a52){for(var _0x1477fc=0x0;_0x1477fc<_0x420a52[_0xa530('0x96')];_0x1477fc++){var _0x19f87d=_0x420a52[_0x1477fc][_0xa530('0x14f')][_0xa530('0x42')];if(_0x19f87d)io['to'](util[_0xa530('0x7b')]('user:%s',_0x19f87d))['emit'](_0xa530('0x150'),{'hopper':_0x420a52[_0x1477fc]});}})[_0xa530('0x9f')](function(_0x503ae7){logger[_0xa530('0x64')](_0xa530('0x151'),_0x503ae7);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xa530('0x16')][_0xa530('0x39')]=function(){var _0x41f9f0=this;setInterval(function(){_0x41f9f0[_0xa530('0x152')](_0x41f9f0[_0xa530('0xbd')],'[uniqueid]');_0x41f9f0[_0xa530('0x152')](_0x41f9f0[_0xa530('0x1f')],'[actions]');},0x32c8);};Dialer[_0xa530('0x16')][_0xa530('0x152')]=function(_0x410f05,_0x26a71a){var _0x4a0865=this;for(var _0x46cfcd in _0x410f05){if(typeof _0x410f05[_0x46cfcd]!==_0xa530('0xaa')){this['sequence']['enqueue'](function(){if(!_[_0xa530('0xf6')](_0x410f05[_0x46cfcd])){return ami[_0xa530('0x153')]({'action':_0xa530('0x86'),'channel':_0x410f05[_0x46cfcd][_0xa530('0xf1')]})[_0xa530('0x9f')](function(_0x596a1e){if(_0x596a1e[_0xa530('0x67')]===_0xa530('0x154')){setTimeout(function(){if(_0x410f05[_0x46cfcd]&&_0x410f05[_0x46cfcd][_0xa530('0x3d')]!==_0xa530('0xbf')){utils[_0xa530('0xcc')](_0x4a0865[_0xa530('0x1a')][_0x410f05[_0x46cfcd][_0xa530('0xbc')]],_0xa530('0x155'));logger[_0xa530('0x64')](_0xa530('0x156'),_0x26a71a,_0x46cfcd,_0x410f05[_0x46cfcd][_0xa530('0xbc')]);delete _0x410f05[_0x46cfcd];}if(_0x410f05[_0x46cfcd]&&_0x410f05[_0x46cfcd]['type']===_0xa530('0xbf')){utils['decrementOriginate'](_0x4a0865['campaigns'][_0x410f05[_0x46cfcd][_0xa530('0xbc')]],_0xa530('0x155'));logger[_0xa530('0x64')]('[Dialer][checkChannel][ivr]',_0x26a71a,_0x46cfcd,_0x410f05[_0x46cfcd]['queue']);delete _0x410f05[_0x46cfcd];}},0x2328);}});}});}}};Dialer[_0xa530('0x16')]['getVoiceQueueRtPauses']=function(_0x8ea0e0){return Promise[_0xa530('0x144')]()[_0xa530('0x9c')](voiceQueueRt['getVoiceQueueRtPauses'](_0x8ea0e0))['catch'](loggerCatch(_0xa530('0x157')));};Dialer[_0xa530('0x16')][_0xa530('0x158')]=function(_0x1e782c,_0x267db2,_0x50c5db){var _0x5e175={'state':0x19,'statedesc':_0xa530('0x159')};utils[_0xa530('0xcc')](_0x267db2,_0xa530('0x15a')+_0x1e782c);this['saveInDb'](_[_0xa530('0x5e')](_0x5e175,_[_0xa530('0x102')](_0x50c5db,['ContactId',_0xa530('0xe1'),_0xa530('0x15b'),_0xa530('0xe2'),_0xa530('0xe3')])),_0xa530('0x15c'),_0xa530('0x15a'));logger['error'](_0x1e782c);};Dialer[_0xa530('0x16')]['saveInDb']=function(_0x105016,_0x1ebe7a,_0x3b5ac9){hopperUtils[_0xa530('0xc8')](_0x105016)['catch'](loggerCatch(_0x1ebe7a));hopperUtils[_0xa530('0xca')](_0x105016)[_0xa530('0x9f')](loggerCatch(_0x3b5ac9));};Dialer[_0xa530('0x16')][_0xa530('0xdb')]=function(_0xf95f8c,_0x2b3d89){hopperUtils['createHistory'](_0xf95f8c)[_0xa530('0x9f')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x2b3d89==0x0){hopperUtils[_0xa530('0xca')](_0xf95f8c)[_0xa530('0x9f')](loggerCatch(_0xa530('0x15d')));}};Dialer[_0xa530('0x16')][_0xa530('0x151')]=function(_0x2fc94a){return Promise[_0xa530('0x144')]()[_0xa530('0x9c')](cmHopper['handlePreviewRecallNotifications'](_0x2fc94a['id'],previewRecallmeReminderInterval))[_0xa530('0x9c')](function(_0x287e4c){for(var _0x1405bb=0x0;_0x1405bb<_0x287e4c[_0xa530('0x96')];_0x1405bb++){var _0xdc794c=_0x287e4c[_0x1405bb][_0xa530('0x14f')][_0xa530('0x42')];if(_0xdc794c)io['to'](util[_0xa530('0x7b')](_0xa530('0x15e'),_0xdc794c))['emit'](_0xa530('0x150'),{'hopper':_0x287e4c[_0x1405bb]});}})[_0xa530('0x9f')](function(){});};Dialer[_0xa530('0x16')][_0xa530('0x15f')]=function(_0xdeef2){var _0x4d862b=this;return function(){_0x4d862b[_0xa530('0x160')](_0xdeef2);};};Dialer[_0xa530('0x16')][_0xa530('0x161')]=function(_0x25fea5,_0x5e4974){var _0x4cd8d2=this;var _0x162828=uuid['v4']();this['actions'][_0x162828]=new Action(_0x25fea5,_0x5e4974,_0x162828);return new Promise(function(_0x1e4866,_0x361a0a){if(_[_0xa530('0x3c')](_0x25fea5)&&typeof _0x25fea5!==_0xa530('0x162')){return _0x361a0a(msgResponse(_0xa530('0x163'),'Failure',_0xa530('0x164')));}if(_[_0xa530('0x3c')](_0x5e4974[_0xa530('0x165')])||_0x5e4974[_0xa530('0x165')]===null){return _0x361a0a(msgResponse(_0xa530('0x163'),'Failure',_0xa530('0x166')));}var _0x436d42={'XMD-CALLERID':_0x4cd8d2[_0xa530('0x1f')][_0x162828][_0xa530('0x167')](),'XMD-AGI':_0x25fea5[_0xa530('0x137')]?util[_0xa530('0x7b')](_0xa530('0x168'),ipAgi,_0x25fea5[_0xa530('0x137')]):_0xa530('0x169'),'XMD-AGIAFTER':_0x25fea5[_0xa530('0xc6')]?util[_0xa530('0x7b')](_0xa530('0x168'),ipAgi,_0x25fea5[_0xa530('0xc6')]):_0xa530('0x169'),'XMD-QUEUE':utils[_0xa530('0x16a')](_0x25fea5)?util[_0xa530('0x7b')](_0xa530('0x16b'),_0x25fea5['name'],_0x25fea5[_0xa530('0x16c')]||'',_0x25fea5['dialAgiAfterHangupAgent']?'c':'',_0x25fea5[_0xa530('0xd0')]||0x3):_0xa530('0x169'),'XMD-CONTACTID':_0x5e4974[_0xa530('0xe0')],'XMD-CDRTYPE':_0xa530('0x16d'),'CALLERID(all)':_0x4cd8d2[_0xa530('0x1f')][_0x162828]['getCaller'](),'XMD-AMD':_0x25fea5[_0xa530('0x111')]?_0xa530('0x16e'):_0xa530('0x169'),'XMD-DESTINATION':_0xa530('0x110')};if(_0x25fea5['dialAMDActive']){_0x436d42['XMD-AMDINITIALSILENCE']=_0x25fea5['dialAMDInitialSilence']||0x9c4;_0x436d42['XMD-AMDGREETING']=_0x25fea5[_0xa530('0x16f')]||0x5dc;_0x436d42[_0xa530('0x170')]=_0x25fea5[_0xa530('0x171')]||0x320;_0x436d42[_0xa530('0x172')]=_0x25fea5[_0xa530('0x173')]||0x1388;_0x436d42['XMD-AMDMINWORDLENGTH']=_0x25fea5[_0xa530('0x174')]||0x64;_0x436d42[_0xa530('0x175')]=_0x25fea5['dialAMDBetweenWordsSilence']||0x32;_0x436d42[_0xa530('0x176')]=_0x25fea5['dialAMDMaximumNumberOfWords']||0x3;_0x436d42[_0xa530('0x177')]=_0x25fea5[_0xa530('0x178')]||0x100;_0x436d42[_0xa530('0x179')]=_0x25fea5[_0xa530('0x17a')]||0x1388;}if(utils[_0xa530('0x16a')](_0x25fea5)){_0x436d42[_0xa530('0x17b')]=_0x5e4974[_0xa530('0xe2')];}else{_0x436d42[_0xa530('0x17c')]=_0x5e4974[_0xa530('0xe3')];}var _0x3812a9=utils[_0xa530('0x17d')](_0x5e4974[_0xa530('0x17e')]);Object[_0xa530('0x14b')](_0x436d42,_0x3812a9);var _0x1120ee=_0x4cd8d2[_0xa530('0x8a')](_0x25fea5[_0xa530('0x17f')])?utils['getCallerId'](_0x25fea5[_0xa530('0x17f')][_0xa530('0x180')],_0x25fea5['dialOriginateCallerIdName'],_0x25fea5[_0xa530('0x181')]>0x0?utils[_0xa530('0x182')](_0x25fea5['dialOriginateCallerIdNumber'],_0x25fea5['dialRandomLastDigitCallerIdNumber']):_0x25fea5[_0xa530('0x183')]):utils[_0xa530('0x184')](_[_0xa530('0xf6')](_0x25fea5['TrunkBackup'])?_0x25fea5[_0xa530('0x17f')][_0xa530('0x180')]:_0x25fea5[_0xa530('0x185')][_0xa530('0x180')],_0x25fea5[_0xa530('0x186')],_0x25fea5['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xa530('0x182')](_0x25fea5[_0xa530('0x183')],_0x25fea5[_0xa530('0x181')]):_0x25fea5['dialOriginateCallerIdNumber']);if(_0x1120ee){_0x436d42['XMD-ORIGINATECALLERIDNAME']=_0x4cd8d2[_0xa530('0x1f')][_0x162828]['originatecalleridname']=utils[_0xa530('0x187')](_0x1120ee);_0x436d42[_0xa530('0x188')]=_0x5e4974[_0xa530('0x165')];}_0x25fea5[_0xa530('0x189')]=_0x436d42;return ami['Action']({'actionid':_0x162828,'action':_0xa530('0x163'),'channel':_0x4cd8d2[_0xa530('0x8a')](_0x25fea5['Trunk'])?util['format']('SIP/%s/%s%s',_0x25fea5[_0xa530('0x17f')][_0xa530('0x42')],isNotNull(_0x25fea5[_0xa530('0x18a')])?_0x25fea5[_0xa530('0x18a')][_0xa530('0x18b')]()||'':'',_0x25fea5['dialCutDigit']>0x0?_0x5e4974[_0xa530('0x165')][_0xa530('0x18c')](_0x25fea5[_0xa530('0x18d')]):_0x5e4974[_0xa530('0x165')]):util[_0xa530('0x7b')](_0xa530('0x18e'),_['isNil'](_0x25fea5[_0xa530('0x185')])?_0x25fea5[_0xa530('0x17f')][_0xa530('0x42')]:_0x25fea5[_0xa530('0x185')][_0xa530('0x42')],isNotNull(_0x25fea5[_0xa530('0x18a')])?_0x25fea5['dialPrefix'][_0xa530('0x18b')]()||'':'',_0x25fea5[_0xa530('0x18d')]>0x0?_0x5e4974[_0xa530('0x165')]['substring'](_0x25fea5[_0xa530('0x18d')]):_0x5e4974[_0xa530('0x165')]),'callerid':_0x1120ee,'Exten':_0xa530('0x110'),'Context':_0xa530('0x18f'),'Priority':'1','variable':_0x436d42,'timeout':(_0x25fea5['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x162828})[_0xa530('0x9c')](function(_0x5d2c7c){return _0x1e4866(_0x5d2c7c);})['catch'](function(_0x28edfd){_0x25fea5['outboundOriginateFailureCallsDay']+=0x1;var _0xf5c805=new History(_0x4cd8d2[_0xa530('0x1f')][_0x162828]);logger[_0xa530('0x64')](util['format']('[originateError]:\x20%s',JSON[_0xa530('0x72')](_0x28edfd)));_0xf5c805[_0xa530('0x6d')]=0xe;_0xf5c805['statedesc']=_0xa530('0x190');_0xf5c805[_0xa530('0xe5')]=moment()['format'](_0xa530('0xc2'));_0xf5c805[_0xa530('0x6f')]=_0xf5c805['starttime'];hopperUtils[_0xa530('0xc8')](_0xf5c805)['catch'](loggerCatch(_0xa530('0x191')));_0x4cd8d2[_0xa530('0xca')](_0xf5c805)['catch'](loggerCatch(_0xa530('0x191')))[_0xa530('0xfb')](function(){delete _0x4cd8d2[_0xa530('0x1f')][_0x162828];return _0x361a0a(msgResponse(_0xa530('0x163'),'Error',_0xa530('0x192')));});});});};Dialer[_0xa530('0x16')][_0xa530('0x193')]=function(_0x4aa097,_0x225409,_0x153d6f){var _0x6bfff2=new History(_0x225409);if(_0x6bfff2[_0xa530('0x121')]+_0x6bfff2[_0xa530('0x122')]+_0x6bfff2[_0xa530('0x123')]+_0x6bfff2[_0xa530('0x124')]+_0x6bfff2['countdropretry']+_0x6bfff2['countabandonedretry']+_0x6bfff2[_0xa530('0x120')]+_0x6bfff2[_0xa530('0x125')]>=_0x153d6f['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x4aa097){case 0x3:if(_0x6bfff2[_0xa530('0x123')]>=_0x153d6f['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x6bfff2[_0xa530('0x123')]+=0x1,'scheduledat':moment()[_0xa530('0xdd')](_0x153d6f[_0xa530('0x194')],_0xa530('0xdf'))['format'](_0xa530('0xc2')),'ContactId':_0x6bfff2[_0xa530('0xe0')],'ListId':_0x6bfff2[_0xa530('0xe1')],'VoiceQueueId':_0x6bfff2[_0xa530('0xe2')]||undefined,'CampaignId':_0x6bfff2[_0xa530('0xe3')]||undefined})['catch'](loggerCatch(_0xa530('0x195')));break;case 0x5:if(_0x6bfff2[_0xa530('0x121')]>=_0x153d6f['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x6bfff2[_0xa530('0x121')]+=0x1,'scheduledat':moment()[_0xa530('0xdd')](_0x153d6f[_0xa530('0x196')],_0xa530('0xdf'))[_0xa530('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6bfff2['ContactId'],'ListId':_0x6bfff2[_0xa530('0xe1')],'VoiceQueueId':_0x6bfff2['VoiceQueueId']||undefined,'CampaignId':_0x6bfff2[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch(_0xa530('0x197')));break;case 0x8:if(_0x6bfff2[_0xa530('0x122')]>=_0x153d6f[_0xa530('0x198')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x6bfff2[_0xa530('0x122')]+=0x1,'scheduledat':moment()[_0xa530('0xdd')](_0x153d6f[_0xa530('0x199')],_0xa530('0xdf'))[_0xa530('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6bfff2['ContactId'],'ListId':_0x6bfff2[_0xa530('0xe1')],'VoiceQueueId':_0x6bfff2[_0xa530('0xe2')]||undefined,'CampaignId':_0x6bfff2[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch(_0xa530('0x19a')));break;case 0x0:if(_0x6bfff2[_0xa530('0x124')]>=_0x153d6f[_0xa530('0x19b')]-0x1){return!![];}else{hopperUtils[_0xa530('0xdc')]({'active':![],'countnosuchnumberretry':_0x6bfff2['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x153d6f['dialNoSuchNumberRetryFrequency'],_0xa530('0xdf'))[_0xa530('0x7b')](_0xa530('0xc2')),'ContactId':_0x6bfff2['ContactId'],'ListId':_0x6bfff2[_0xa530('0xe1')],'VoiceQueueId':_0x6bfff2[_0xa530('0xe2')]||undefined,'CampaignId':_0x6bfff2[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x6bfff2[_0xa530('0xd5')]>=_0x153d6f['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0xa530('0xdc')]({'active':![],'countdropretry':_0x6bfff2[_0xa530('0xd5')]+=0x1,'scheduledat':moment()[_0xa530('0xdd')](_0x153d6f[_0xa530('0xde')],'minutes')[_0xa530('0x7b')](_0xa530('0xc2')),'ContactId':_0x6bfff2[_0xa530('0xe0')],'ListId':_0x6bfff2['ListId'],'VoiceQueueId':_0x6bfff2[_0xa530('0xe2')]||undefined,'CampaignId':_0x6bfff2[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x6bfff2['countabandonedretry']>=_0x153d6f['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0xa530('0xdc')]({'active':![],'countabandonedretry':_0x6bfff2[_0xa530('0xed')]+=0x1,'scheduledat':moment()[_0xa530('0xdd')](_0x153d6f[_0xa530('0xef')],_0xa530('0xdf'))[_0xa530('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6bfff2[_0xa530('0xe0')],'ListId':_0x6bfff2[_0xa530('0xe1')],'VoiceQueueId':_0x6bfff2[_0xa530('0xe2')]||undefined,'CampaignId':_0x6bfff2['CampaignId']||undefined})[_0xa530('0x9f')](loggerCatch(_0xa530('0x19c')));break;case 0x13:if(_0x6bfff2[_0xa530('0x120')]>=_0x153d6f[_0xa530('0x19d')]-0x1){return!![];}hopperUtils[_0xa530('0xdc')]({'active':![],'countmachineretry':_0x6bfff2[_0xa530('0x120')]+=0x1,'scheduledat':moment()[_0xa530('0xdd')](_0x153d6f['dialMachineRetryFrequency'],_0xa530('0xdf'))['format'](_0xa530('0xc2')),'ContactId':_0x6bfff2[_0xa530('0xe0')],'ListId':_0x6bfff2['ListId'],'VoiceQueueId':_0x6bfff2[_0xa530('0xe2')]||undefined,'CampaignId':_0x6bfff2[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x6bfff2['countagentrejectretry']>=_0x153d6f[_0xa530('0x19e')]-0x1){return!![];}hopperUtils[_0xa530('0xdc')]({'active':![],'countagentrejectretry':_0x6bfff2[_0xa530('0x125')]+=0x1,'scheduledat':moment()[_0xa530('0xdd')](_0x153d6f['dialAgentRejectRetryFrequency'],_0xa530('0xdf'))['format'](_0xa530('0xc2')),'ContactId':_0x6bfff2['ContactId'],'ListId':_0x6bfff2['ListId'],'VoiceQueueId':_0x6bfff2['VoiceQueueId']||undefined,'CampaignId':_0x6bfff2['CampaignId']||undefined})['catch'](loggerCatch(_0xa530('0x19f')));break;default:return!![];}};Dialer[_0xa530('0x16')][_0xa530('0x10d')]=function(_0x572cde,_0x1df90b,_0x5ce76f){var _0x354b75=this;var _0x13c791=new History(_0x572cde);var _0x4eca8a=![];var _0x3708b7;var _0x169391;return new Promise(function(_0xae239a,_0x145fd2){if(_[_0xa530('0x3c')](_0x1df90b)&&typeof _0x1df90b!==_0xa530('0x162')){return _0x145fd2(msgResponse(_0xa530('0x1a0'),'Failure','entity\x20is\x20undefine'));}if(_['isUndefined'](_0x5ce76f)&&typeof _0x5ce76f!=='object'){return _0x145fd2(msgResponse(_0xa530('0x1a0'),'Failure',_0xa530('0x1a1')));}hopperUtils[_0xa530('0xd7')](_0x13c791,_0x5ce76f[_0xa530('0xc3')],_0x1df90b)[_0xa530('0x9c')](function(_0x47edb3){if(_0x47edb3['additional']==0x1)_0x4eca8a=!![];switch(_0x5ce76f[_0xa530('0xc3')]){case'0':_0x1df90b[_0xa530('0x1a2')]+=0x1;_0x13c791[_0xa530('0x6d')]=0x0;_0x13c791[_0xa530('0x6e')]=_0xa530('0x1a3');_0x13c791[_0xa530('0x124')]+=0x1;_0x13c791[_0xa530('0xee')]+=0x1;ami['emit'](_0xa530('0x1a4'),ut['buildObj'](_0x572cde,_0xa530('0x1a5')));_0x3708b7=_0x1df90b[_0xa530('0x1a6')];_0x169391=_0x1df90b[_0xa530('0xd6')];hopperUtils[_0xa530('0xc8')](_0x13c791)[_0xa530('0x9f')](loggerCatch(_0xa530('0x12f')));if(_0x354b75[_0xa530('0x193')](0x0,_0x572cde,_0x1df90b)&&!_0x4eca8a){if(_0x13c791[_0xa530('0x124')]>=_0x1df90b[_0xa530('0x19b')]){_0x354b75['createStateFinal'](_0x13c791,_0xae239a,_0x145fd2,'reason\x200\x20no\x20such\x20number....');}else{_0x354b75['stateGlobal'](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1a7'));}}break;case'3':_0x1df90b[_0xa530('0x1a8')]+=0x1;_0x13c791[_0xa530('0x6d')]=0x3;_0x13c791[_0xa530('0x6e')]='NoAnswer';_0x13c791[_0xa530('0x123')]+=0x1;_0x13c791['countglobal']+=0x1;var _0x38bc3a=ut[_0xa530('0x1a9')](_0x572cde,_0x1df90b);ami['emit'](_0xa530('0x1aa'),_0x38bc3a);_0x3708b7=_0x1df90b[_0xa530('0x194')];_0x169391=_0x1df90b[_0xa530('0xd6')];hopperUtils[_0xa530('0xc8')](_0x13c791)[_0xa530('0x9f')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x354b75[_0xa530('0x193')](0x3,_0x572cde,_0x1df90b)&&!_0x4eca8a){if(_0x13c791[_0xa530('0x123')]>=_0x1df90b[_0xa530('0x1ab')]){_0x354b75['createStateFinal'](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1ac'));}else{_0x354b75[_0xa530('0x127')](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1ac'));}}break;case'5':_0x1df90b[_0xa530('0x1ad')]+=0x1;_0x13c791[_0xa530('0x6d')]=0x5;_0x13c791['statedesc']='Busy';_0x13c791[_0xa530('0x121')]+=0x1;_0x13c791['countglobal']+=0x1;ami['emit'](_0xa530('0x1ae'),ut[_0xa530('0x118')](_0x572cde,_0xa530('0x1af')));_0x3708b7=_0x1df90b['dialBusyRetryFrequency'];_0x169391=_0x1df90b['callAdditionalPhoneAfterMin'];hopperUtils[_0xa530('0xc8')](_0x13c791)['catch'](loggerCatch(_0xa530('0x1b0')));if(_0x354b75['checkRetriveMax'](0x5,_0x572cde,_0x1df90b)&&!_0x4eca8a){if(_0x13c791[_0xa530('0x121')]>=_0x1df90b[_0xa530('0x1b1')]){_0x354b75['createStateFinal'](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1b2'));}else{_0x354b75['stateGlobal'](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1b2'));}}break;case'8':_0x1df90b['outboundCongestionCallsDay']+=0x1;_0x13c791[_0xa530('0x6d')]=0x8;_0x13c791[_0xa530('0x6e')]='Congestion';_0x13c791[_0xa530('0x122')]+=0x1;_0x13c791[_0xa530('0xee')]+=0x1;_0x3708b7=_0x1df90b[_0xa530('0x199')];_0x169391=_0x1df90b[_0xa530('0xd6')];ami[_0xa530('0x12c')](_0xa530('0x1b3'),ut['buildObj'](_0x572cde,'congestion'));hopperUtils[_0xa530('0xc8')](_0x13c791)[_0xa530('0x9f')](loggerCatch(_0xa530('0x1b4')));if(_0x354b75[_0xa530('0x193')](0x8,_0x572cde,_0x1df90b)&&!_0x4eca8a){if(_0x13c791[_0xa530('0x122')]>=_0x1df90b['dialCongestionMaxRetry']){_0x354b75[_0xa530('0x129')](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1b5'));}else{_0x354b75[_0xa530('0x127')](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1b5'));}}break;case'11':_0x1df90b[_0xa530('0x1b6')]+=0x1;_0x13c791['state']=0xb;_0x13c791[_0xa530('0x6e')]=_0xa530('0xeb');_0x13c791[_0xa530('0xed')]+=0x1;_0x13c791[_0xa530('0xee')]+=0x1;_0x3708b7=_0x1df90b[_0xa530('0xef')];_0x169391=_0x1df90b[_0xa530('0xd6')];hopperUtils[_0xa530('0xc8')](_0x13c791)['catch'](loggerCatch(_0xa530('0x1b7')));if(_0x354b75[_0xa530('0x193')](0xb,_0x572cde,_0x1df90b)&&!_0x4eca8a){if(_0x13c791[_0xa530('0xed')]>=_0x1df90b[_0xa530('0xf0')]){_0x354b75['createStateFinal'](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1b8'));}else{_0x354b75[_0xa530('0x127')](_0x13c791,_0xae239a,_0x145fd2,'reason\x2011\x20abandoned');}}break;case'20':_0x1df90b['outboundRejectCallsDay']+=0x1;_0x13c791[_0xa530('0x6d')]=0x14;_0x13c791[_0xa530('0x6e')]=_0xa530('0x1b9');_0x13c791['countagentrejectretry']+=0x1;_0x13c791[_0xa530('0xee')]+=0x1;_0x3708b7=_0x1df90b[_0xa530('0x1ba')];_0x169391=_0x1df90b[_0xa530('0xd6')];ami[_0xa530('0x12c')](_0xa530('0x1bb'),ut['buildObj'](_0x572cde,_0xa530('0x1bc')));hopperUtils[_0xa530('0xc8')](_0x13c791)[_0xa530('0x9f')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x354b75['checkRetriveMax'](0x14,_0x572cde,_0x1df90b)&&!_0x4eca8a){if(_0x13c791['countagentrejectretry']>=_0x1df90b[_0xa530('0x19e')]){_0x354b75['createStateFinal'](_0x13c791,_0xae239a,_0x145fd2,'reason\x2020\x20agentreject');}else{_0x354b75[_0xa530('0x127')](_0x13c791,_0xae239a,_0x145fd2,_0xa530('0x1bd'));}}break;default:_0x1df90b[_0xa530('0x13c')]+=0x1;_0x13c791[_0xa530('0x6d')]=0xc;_0x13c791['statedesc']=_0x5ce76f[_0xa530('0xc3')];_0x3708b7=_0x1df90b[_0xa530('0x1ba')];_0x169391=_0x1df90b[_0xa530('0xd6')];hopperUtils[_0xa530('0xc8')](_0x13c791)['catch'](loggerCatch(_0xa530('0x1be')));if(_0x354b75[_0xa530('0x193')](_0x5ce76f[_0xa530('0xc3')],_0x572cde,_0x1df90b)&&!_0x4eca8a){if(_0x13c791[_0xa530('0x121')]+_0x13c791['countcongestionretry']+_0x13c791[_0xa530('0x123')]+_0x13c791[_0xa530('0x124')]+_0x13c791[_0xa530('0xd5')]+_0x13c791['countabandonedretry']+_0x13c791['countmachineretry']+_0x13c791[_0xa530('0x125')]>=_0x1df90b[_0xa530('0x126')]){_0x354b75[_0xa530('0x127')](_0x13c791,_0xae239a,_0x145fd2,_0x5ce76f[_0xa530('0xc3')]);}else{_0x354b75[_0xa530('0x129')](_0x13c791,_0xae239a,_0x145fd2,_0x5ce76f['reason']);}}}})[_0xa530('0x9c')](function(){if(_0x4eca8a){hopperUtils[_0xa530('0xe9')](_0x13c791,_0x3708b7,_0x169391)[_0xa530('0x9c')](function(){return _0xae239a(0x1);});}});});};Dialer[_0xa530('0x16')][_0xa530('0x127')]=function(_0x55731a,_0x41ee66,_0x3a32fa,_0x164a9b){var _0x111445=new Final(_0x55731a);_0x111445[_0xa530('0x6d')]=0xf;_0x111445[_0xa530('0x6e')]=_0xa530('0x1bf');this[_0xa530('0x129')](_0x111445,_0x41ee66,_0x3a32fa,_0x164a9b);};Dialer[_0xa530('0x16')]['createStateFinal']=function(_0x17bfb6,_0x33cefa,_0x444ec5,_0x465dbe){hopperUtils[_0xa530('0xca')](_0x17bfb6)['then'](function(){return _0x33cefa(msgResponse('[callProgressDetecting]','Success',_0x465dbe));})['catch'](function(){return _0x444ec5(msgResponse('[moveContactManagedDialer][0]',_0xa530('0x8e'),_0xa530('0x1c0')));});};Dialer['prototype'][_0xa530('0xb0')]=function(_0x3798e3){var _0x7cd96f=_0x3798e3[_0xa530('0x1c1')]/0x64;var _0x305596=_0x3798e3[_0xa530('0xd1')]/(_0x3798e3[_0xa530('0xd1')]+_0x3798e3[_0xa530('0x11e')]);var _0x334c90=Math[_0xa530('0x1c2')](_0x3798e3[_0xa530('0x1c3')]*(_0x3798e3[_0xa530('0x1c4')]/0x64));var _0x3c1ea0=Math['round'](_0x3798e3[_0xa530('0x1c3')]*(_0x3798e3['predictiveIntervalMinThreshold']/0x64));var _0xd5c93=_0x3798e3['available']+_0x3798e3[_0xa530('0x147')];var _0x53e0dc=Math[_0xa530('0x1c5')](_0x3798e3[_0xa530('0x59')]*_0x3798e3['erlangAbandonmentRate']*_0x3798e3['predictiveIntervalHitRate']*_0x3798e3['predictiveIntervalMultiplicativeFactor']);if(_[_0xa530('0x3c')](_0x3798e3[_0xa530('0x21')])){if(!_['isUndefined'](_0x3798e3[_0xa530('0x20')])){_0x3798e3[_0xa530('0x20')]=undefined;loggerPredictive['error'](_0xa530('0x1c6'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xa530('0x3c')](_0x3798e3[_0xa530('0x62')])){loggerPredictive[_0xa530('0x64')](_0xa530('0x1c6'),_0xa530('0x1c7'));clearInterval(_0x3798e3[_0xa530('0x62')]);_0x3798e3[_0xa530('0x62')]=undefined;}_0x3798e3[_0xa530('0x21')]=moment()[_0xa530('0x7b')](_0xa530('0xc2'));loggerPredictive[_0xa530('0x45')](_0x3798e3[_0xa530('0x42')],'collection\x20data\x20in\x20progressive\x20at',_0x3798e3['startProgressive']);this[_0xa530('0xb1')](_0x3798e3,0x1);}else if(ifInterval(_0x3798e3[_0xa530('0x1c8')],_0x3798e3['startProgressive'])){this['handlePower'](_0x3798e3,0x1);loggerPredictiveCalls['info'](_0xa530('0x1c9'),_0x3798e3[_0xa530('0x21')],_0x3798e3[_0xa530('0x42')]);_0x3798e3['erlangCalls']=0x0;_0x3798e3[_0xa530('0x1ca')]=0x0;}else if(_0x7cd96f<_0x305596&&_0x3798e3[_0xa530('0x1cb')]===_0xa530('0x1cc')){clearPredictiveAttributes(_0x3798e3);loggerPredictive[_0xa530('0x45')](_0xa530('0x1cd'),_0xa530('0x1ce'),_0x305596,_0xa530('0x21'),_0x3798e3['name']);}else if(_0x53e0dc<_0x3798e3['predictiveIntervalErlangCallsDroppedCalls']&&_0x3798e3['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x3798e3);loggerPredictive[_0xa530('0x45')](_0xa530('0x1cf'),_0xa530('0x1d0'),_0x53e0dc,_0xa530('0x1d1'),_0x3798e3[_0xa530('0x1ca')],'startProgressive',_0x3798e3[_0xa530('0x42')]);}else if(!ifInterval(_0x3798e3[_0xa530('0x1c8')],_0x3798e3[_0xa530('0x21')])&&_['isUndefined'](_0x3798e3['startPredictive'])&&!_['isUndefined'](_0x3798e3[_0xa530('0x21')])){_0x3798e3[_0xa530('0x20')]=moment()[_0xa530('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xa530('0x45')](_0x3798e3[_0xa530('0x42')],'started\x20in\x20predictive\x20at',_0x3798e3[_0xa530('0x20')]);hopperUtils[_0xa530('0x1d2')](_0x3798e3[_0xa530('0x1c8')])[_0xa530('0x9c')](this[_0xa530('0x1d3')](_0x3798e3))[_0xa530('0x9c')](mergeDataErlangB(_0x3798e3))[_0xa530('0x9c')](this[_0xa530('0x1d4')](_0x3798e3))[_0xa530('0x9f')](loggerCatchPredictive(_0xa530('0x1d5'),_0x3798e3));}else if(!ifInterval(_0x3798e3[_0xa530('0x1c8')],_0x3798e3['startPredictive'])){_0x3798e3['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x3798e3[_0xa530('0x20')]=moment()[_0xa530('0x7b')](_0xa530('0xc2'));loggerPredictive[_0xa530('0x45')](_0x3798e3[_0xa530('0x42')],_0xa530('0x1d6'),_0x3798e3[_0xa530('0x20')]);clearInterval(_0x3798e3[_0xa530('0x62')]);_0x3798e3[_0xa530('0x62')]=undefined;hopperUtils[_0xa530('0x1d2')](_0x3798e3['dialPredictiveInterval'])['then'](this[_0xa530('0x1d3')](_0x3798e3))['then'](mergeDataErlangB(_0x3798e3))['then'](this[_0xa530('0x1d4')](_0x3798e3))[_0xa530('0x9f')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3798e3));}else if(_0x3798e3[_0xa530('0x1c3')]&&_0xd5c93<_0x3798e3[_0xa530('0x1c3')]-_0x3c1ea0){clearPredictiveAttributes(_0x3798e3);loggerPredictive[_0xa530('0x45')](_0x3798e3[_0xa530('0x42')],_0xa530('0x1d7'),_0xd5c93,_0xa530('0x1d8'),_0x3798e3[_0xa530('0x1c3')],'-',_0x3c1ea0,'=',_0x3798e3[_0xa530('0x1c3')]-_0x3c1ea0,')');}else if(_0x3798e3['predictiveIntervalAvailable']&&_0xd5c93>_0x3798e3[_0xa530('0x1c3')]+_0x334c90){clearPredictiveAttributes(_0x3798e3);loggerPredictive[_0xa530('0x45')](_0x3798e3[_0xa530('0x42')],_0xa530('0x1d7'),_0xd5c93,')\x20are\x20more\x20than\x20threshold\x20(',_0x3798e3[_0xa530('0x1c3')],'+',_0x334c90,'=',_0x3798e3[_0xa530('0x1c3')]+_0x334c90,')');}};Dialer[_0xa530('0x16')][_0xa530('0x1d3')]=function(_0x21fa8e){var _0xa970ee=this;return function(_0x272da3){return new Promise(function(_0x92a0f5,_0x5edfb5){_[_0xa530('0x5e')](_0x21fa8e,_0x272da3[0x0]);if(checkGetDataPredictive(_0x272da3[0x0])){var _0xea4ad5=_0x21fa8e['predictiveIntervalAvailable']=_0x21fa8e[_0xa530('0x147')]+_0x21fa8e['available'];var _0x4b463b=_0x21fa8e[_0xa530('0x1c8')]*0x3c;var _0x21b294=_0x272da3[0x0][_0xa530('0x50')]+_0x272da3[0x0]['predictiveIntervalAvgHoldtime'];var _0x289cd8=(_0x272da3[0x0][_0xa530('0x1d9')]+_0x272da3[0x0][_0xa530('0x4b')]+_0x272da3[0x0][_0xa530('0x4d')])/_0x272da3[0x0][_0xa530('0x48')];_0x21fa8e[_0xa530('0x1da')]=_0x289cd8>0x0?_0x289cd8:0x1;switch(_0x21fa8e['dialPredictiveOptimization']){case _0xa530('0x1cc'):var _0x2cd364=_0x21fa8e[_0xa530('0x1c1')]/0x64;return _0xa970ee[_0xa530('0x1db')](_0xea4ad5,_0x4b463b,_0x21b294,_0x289cd8,_0x2cd364)[_0xa530('0x9c')](function(_0x4b3f1a){return _0x92a0f5(_0x4b3f1a);});case'agentBusyFactor':var _0x1c062f=_0x21fa8e[_0xa530('0x1c1')]/0x64;return _0xa970ee[_0xa530('0x1dc')](_0xea4ad5,_0x4b463b,_0x21b294,_0x289cd8,_0x1c062f)[_0xa530('0x9c')](function(_0x4e9829){return _0x92a0f5(_0x4e9829);});default:return _0x5edfb5(msgResponse(_0xa530('0x1dd'),_0xa530('0x8e'),_0xa530('0x1de')));}}else{return _0x5edfb5(msgResponse(_0xa530('0x1dd'),'Failure',_0xa530('0x1df')));}});};};Dialer[_0xa530('0x16')][_0xa530('0x1e0')]=function(_0x2184a9){var _0x488a1b=this;return function(_0x5e8d19){return new Promise(function(_0x5511d8,_0x57470d){_[_0xa530('0x5e')](_0x2184a9,_0x5e8d19[0x0]);if(checkGetDataPredictive(_0x5e8d19[0x0])){loggerPredictive[_0xa530('0x45')](JSON[_0xa530('0x72')](_0x5e8d19[0x0]));if(_0x2184a9[_0xa530('0x1cb')]===_0xa530('0x1cc')){return _0x488a1b[_0xa530('0x1e1')](_0x2184a9['id'])[_0xa530('0x9c')](function(_0x53a64d){var _0x41f1f6=_0x2184a9[_0xa530('0x1e2')]-_0x53a64d[0x0][_0xa530('0x1e3')];var _0x4d68e1=_0x2184a9[_0xa530('0x1c8')]*0x3c;var _0x221673=_0x5e8d19[0x0][_0xa530('0x50')]+_0x5e8d19[0x0]['predictiveIntervalAvgHoldtime'];var _0x4a406b=(_0x5e8d19[0x0][_0xa530('0x1d9')]+_0x5e8d19[0x0][_0xa530('0x4b')]+_0x5e8d19[0x0][_0xa530('0x4d')])/_0x5e8d19[0x0][_0xa530('0x48')];var _0x1b9b82=_0x2184a9[_0xa530('0x1c1')]/0x64;_0x2184a9['predictiveIntervalPauses']=_0x53a64d[0x0][_0xa530('0x1e3')]||0x0;_0x2184a9[_0xa530('0x1da')]=_0x4a406b>0x0?_0x4a406b:0x1;return _0x488a1b['abandonmentRate'](_0x41f1f6,_0x4d68e1,_0x221673,_0x4a406b,_0x1b9b82);})['then'](function(_0x562c4c){return _0x5511d8(_0x562c4c);})['catch'](function(_0x4edf6f){return _0x57470d(msgResponse('[CatchErlangB]','Failure',JSON[_0xa530('0x72')](_0x4edf6f)));});}if(_0x2184a9[_0xa530('0x1cb')]===_0xa530('0x1e4')){return _0x488a1b[_0xa530('0x1e1')](_0x2184a9['id'])['then'](function(_0x4ac8aa){var _0x2bfbab=_0x2184a9[_0xa530('0x1e2')]-_0x4ac8aa[0x0][_0xa530('0x1e3')];var _0x2ed806=_0x2184a9[_0xa530('0x1c8')]*0x3c;var _0x53d02d=_0x5e8d19[0x0]['predictiveIntervalAvgTalktime']+_0x5e8d19[0x0][_0xa530('0x53')];var _0x2a0c34=(_0x5e8d19[0x0][_0xa530('0x1d9')]+_0x5e8d19[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5e8d19[0x0][_0xa530('0x4d')])/_0x5e8d19[0x0][_0xa530('0x48')];var _0xd7c099=_0x2184a9['dialPredictiveOptimizationPercentage']/0x64;_0x2184a9['predictiveIntervalPauses']=_0x4ac8aa[0x0][_0xa530('0x1e3')]||0x0;_0x2184a9[_0xa530('0x1da')]=_0x2a0c34>0x0?_0x2a0c34:0x1;return _0x488a1b['busyFactor'](_0x2bfbab,_0x2ed806,_0x53d02d,_0x2a0c34,_0xd7c099);})[_0xa530('0x9c')](function(_0x4011a3){return _0x5511d8(_0x4011a3);})[_0xa530('0x9f')](function(_0x3ae4b5){return _0x57470d(msgResponse(_0xa530('0x1e5'),_0xa530('0x8e'),JSON[_0xa530('0x72')](_0x3ae4b5)));});}}else{return _0x57470d(msgResponse('[getDataPredictive]',_0xa530('0x8e'),_0xa530('0x1df')));}});};};Dialer[_0xa530('0x16')][_0xa530('0x1d4')]=function(_0x53e8fd){var _0x5eeb18=this;return function(){var _0x1b7b25=0x0;var _0x56a61e=Math[_0xa530('0x1c5')](_0x53e8fd[_0xa530('0x5a')]*0x3e8);if(_0x56a61e>0x0){_0x56a61e=_0x56a61e<0x64?0x64:_0x56a61e;loggerPredictive[_0xa530('0x45')](_0x53e8fd[_0xa530('0x42')],_0xa530('0x1e6'),_0x56a61e,_0xa530('0x1e7'));_0x53e8fd['handlePredictive']=setInterval(function(){_0x5eeb18[_0xa530('0x62')](_0x53e8fd);loggerPredictiveCalls['info'](_0xa530('0x1e8'),_0x1b7b25+=0x1);},_0x56a61e);}else{loggerPredictive[_0xa530('0x45')](_0x53e8fd[_0xa530('0x42')],_0xa530('0x1e9'));}};};Dialer[_0xa530('0x16')]['checkContactBlack']=function(_0x2c400a,_0x472392){var _0x1d6fc7=this;return function(_0x15f589){if(_[_0xa530('0x44')](_0x15f589)){if(_['isNil'](_0x472392[_0xa530('0x15b')])||!_0x472392[_0xa530('0x1ea')]){if(_0x2c400a[_0xa530('0xaf')]===_0xa530('0x8')){_0x2c400a[_0xa530('0x73')]=_[_0xa530('0x3c')](_0x2c400a[_0xa530('0x73')])?!![]:_0x2c400a[_0xa530('0x73')];var _0x152943=uuid['v4']();_0x1d6fc7['actions'][_0x152943]=new Action(_0x2c400a,_0x472392,_0x152943);loggerBooked['info'](_0xa530('0x1eb'),_0x152943,_0xa530('0x1ec'),JSON[_0xa530('0x72')](_0x2c400a[_0xa530('0x73')]),_0xa530('0x1ed'),_0x2c400a[_0xa530('0x42')]);if(_0x2c400a[_0xa530('0x73')]){_0x2c400a[_0xa530('0x73')]=![];_0x1d6fc7[_0xa530('0xf9')][_0x1d6fc7[_0xa530('0x1f')][_0x152943][_0xa530('0xbc')]]=[];ami[_0xa530('0x153')]({'actionid':_0x152943,'action':_0xa530('0x1ee'),'queue':_0x2c400a[_0xa530('0x42')]})[_0xa530('0x9f')](function(){utils[_0xa530('0xcc')](_0x2c400a,_0xa530('0x1ef'));hopperUtils[_0xa530('0xdc')]({'active':![],'ContactId':_0x1d6fc7['actions'][_0x152943][_0xa530('0xe0')],'ListId':_0x1d6fc7[_0xa530('0x1f')][_0x152943]['ListId'],'VoiceQueueId':_0x1d6fc7[_0xa530('0x1f')][_0x152943][_0xa530('0xe2')]||undefined,'CampaignId':_0x1d6fc7['actions'][_0x152943][_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch(_0xa530('0x1f0')));delete _0x1d6fc7[_0xa530('0x1f')][_0x152943];});}else{loggerBooked[_0xa530('0x45')](_0xa530('0x1f1'),JSON[_0xa530('0x72')](_0x2c400a[_0xa530('0x73')]),_0xa530('0x1ed'),_0x2c400a[_0xa530('0x42')]);utils[_0xa530('0xcc')](_0x2c400a,'[checkContactBlack]');hopperUtils[_0xa530('0xdc')]({'active':![],'ContactId':_0x1d6fc7[_0xa530('0x1f')][_0x152943][_0xa530('0xe0')],'ListId':_0x1d6fc7[_0xa530('0x1f')][_0x152943][_0xa530('0xe1')],'VoiceQueueId':_0x1d6fc7[_0xa530('0x1f')][_0x152943][_0xa530('0xe2')]||undefined,'CampaignId':_0x1d6fc7['actions'][_0x152943][_0xa530('0xe3')]||undefined})['catch'](loggerCatch(_0xa530('0x1f0')));delete _0x1d6fc7['actions'][_0x152943];}}else{return _0x1d6fc7[_0xa530('0x161')](_0x2c400a,_0x472392);}}else{if(utils[_0xa530('0x5f')](undefined,_0x472392[_0xa530('0x1f2')])<_0x2c400a[_0xa530('0x1f3')]*0x3c){if(_0x472392[_0xa530('0x14f')]&&!_0x472392['Agent']['voicePause']){_0x1d6fc7['preview'][_0xa530('0x1f4')](_0x472392['id'])[_0xa530('0xfb')](function(){utils[_0xa530('0xcc')](_0x2c400a,_0xa530('0x1ef'));});}else{hopperUtils[_0xa530('0x1f5')]({'active':![]},_0x472392['id'],0x1)['finally'](function(){utils[_0xa530('0xcc')](_0x2c400a,_0xa530('0x1ef'));});}}else{_0x2c400a[_0xa530('0x1f6')]+=0x1;utils[_0xa530('0xcc')](_0x2c400a,_0xa530('0x1ef'));if(_0x2c400a[_0xa530('0x1f7')]){hopperUtils[_0xa530('0xdc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x472392[_0xa530('0xe0')],'ListId':_0x472392[_0xa530('0xe1')],'VoiceQueueId':_0x472392[_0xa530('0xe2')]||undefined,'CampaignId':_0x472392[_0xa530('0xe3')]||undefined})[_0xa530('0x9f')](loggerCatch(_0xa530('0x1f8')));hopperUtils[_0xa530('0xc8')](createObjHistory(_0x2c400a,_0x472392,utils[_0xa530('0x6b')][_0xa530('0x1f9')],0x17,'RecallInQueue'))[_0xa530('0x9f')](loggerCatch(_0xa530('0x1fa')));}else{_0x1d6fc7[_0xa530('0x11a')](createObjHistory(_0x2c400a,_0x472392,utils['CAMPAIGN_STATUS'][_0xa530('0x1fb')],0x16,_0xa530('0x1fc')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x2c400a[_0xa530('0x1fd')]+=0x1;_0x1d6fc7[_0xa530('0x11a')](createObjHistory(_0x2c400a,_0x472392,utils[_0xa530('0x6b')][_0xa530('0x1fe')],0xd,_0xa530('0x1ff')),_0xa530('0x200'),'[Originate][MoveBlacklist]');throw _0xa530('0x201');}};};Dialer[_0xa530('0x16')][_0xa530('0x160')]=function(_0x2b9f40){var _0x4aa6c4=this;var _0x3d4823=_0x2b9f40[_0xa530('0x202')]-_0x2b9f40['originated'];emitCampaignSummary(_0x2b9f40);if(_0x3d4823>0x0&&_0x2b9f40['temp']==0x0){if(_0x3d4823>this['maxNumberOriginate']){_0x3d4823=this['maxNumberOriginate'];}_0x2b9f40[_0xa530('0x203')]=0x1;hopperUtils[_0xa530('0x204')](_0x2b9f40,_0x3d4823)['then'](function(_0x56d858){_0x2b9f40['temp']=0x0;if(_0x56d858){if(!utils[_0xa530('0x205')](_0x56d858)){_0x2b9f40['message']=utils[_0xa530('0x6b')]['NO_AVAILABLE_CONTACTS'];logger['info']('[getContactCampaign2][Empty]'+_0x2b9f40[_0xa530('0x42')]);}else{_0x2b9f40['originated']+=_0x56d858[_0xa530('0x96')];_0x2b9f40[_0xa530('0x67')]=utils[_0xa530('0x6b')][_0xa530('0x206')];for(var _0x56d688=0x0;_0x56d688<_0x56d858[_0xa530('0x96')];_0x56d688+=0x1){_0x2b9f40[_0xa530('0x207')]+=0x1;if(_[_0xa530('0xf6')](_0x56d858[_0x56d688])||_[_0xa530('0xf6')](_0x56d858[_0x56d688][_0xa530('0x17e')])||_[_0xa530('0xf6')](_0x56d858[_0x56d688]['phone'])){_0x4aa6c4[_0xa530('0x158')]('[actionOriginate]\x20',_0x2b9f40,_0x56d858[_0x56d688]);}else{hopperUtils[_0xa530('0x208')](_['pick'](_0x56d858[_0x56d688],[_0xa530('0xe3'),_0xa530('0x165')]))[_0xa530('0x9c')](_0x4aa6c4[_0xa530('0x209')](_0x2b9f40,_0x56d858[_0x56d688]))[_0xa530('0x9f')](function(_0x46e255){logger[_0xa530('0x64')](_0xa530('0x20a'),_0x46e255);utils[_0xa530('0xcc')](_0x2b9f40,_0xa530('0x20b'));});}}}}})['catch'](function(_0x5b5bb6){_0x2b9f40[_0xa530('0x203')]=0x0;logger[_0xa530('0x64')](_0xa530('0x20c'),_0x5b5bb6);});}};Dialer[_0xa530('0x16')]['handlePower']=function(_0x43700c,_0x26e9f6){var _0x28603f=this;var _0xb482a2=[];if(_0x26e9f6<0x1||_0x43700c[_0xa530('0xaf')]===_0xa530('0x8')){_0x26e9f6=0x1;}var _0x9224d8=Math[_0xa530('0x1c5')](_0x43700c['available']*_0x26e9f6)-_0x43700c[_0xa530('0x7f')];if(_0x43700c[_0xa530('0x20d')]>0x0){var _0x1bf2ef=_0x43700c[_0xa530('0x20d')]-_0x43700c[_0xa530('0x7f')]-_0x43700c['talking']-_0x43700c[_0xa530('0x148')];if(_0x9224d8>_0x1bf2ef){_0x9224d8=_0x1bf2ef;}}if(_0x9224d8>0x0&&_0x43700c[_0xa530('0x203')]==0x0){if(_0x43700c[_0xa530('0xaf')]===_0xa530('0x8')){_0x9224d8=0x1;}if(_0x9224d8>this['maxNumberOriginate']){_0x9224d8=this[_0xa530('0x1e')];}for(var _0x4c757d in this['agents']){if(typeof this['agents'][_0x4c757d]!==_0xa530('0xaa')){if(this[_0xa530('0x1c')][_0x4c757d][_0xa530('0x6d')]==='not_inuse'&&this['agents'][_0x4c757d][_0xa530('0x86')]===_0xa530('0x87')){_0xb482a2[_0xa530('0x97')](this[_0xa530('0x1c')][_0x4c757d]['id']);}}}_0x43700c[_0xa530('0x203')]=0x1;hopperUtils[_0xa530('0x20e')](_0x43700c,_0xb482a2,_0x9224d8)[_0xa530('0x9c')](function(_0x47288d){_0x43700c[_0xa530('0x203')]=0x0;if(_0x47288d){if(!utils[_0xa530('0x205')](_0x47288d)){hopperUtils['countReScheduled'](_0x43700c)[_0xa530('0x9c')](sendMessageReschedule(_0x43700c))[_0xa530('0x9f')](loggerCatch('[countReScheduled]\x20'));}else{_0x43700c[_0xa530('0x7f')]+=_0x47288d[_0xa530('0x96')];_0x43700c[_0xa530('0x67')]=_0x43700c[_0xa530('0xaf')]===_0xa530('0x8')?utils[_0xa530('0x6b')][_0xa530('0x16e')]:utils[_0xa530('0x6b')][_0xa530('0x206')];for(var _0x5e8efd=0x0;_0x5e8efd<_0x47288d[_0xa530('0x96')];_0x5e8efd+=0x1){if(_[_0xa530('0xf6')](_0x47288d[_0x5e8efd])||_[_0xa530('0xf6')](_0x47288d[_0x5e8efd]['Contact'])||_[_0xa530('0xf6')](_0x47288d[_0x5e8efd][_0xa530('0x165')])){_0x28603f[_0xa530('0x158')](_0xa530('0x20f'),_0x43700c,_0x47288d[_0x5e8efd]);}else{hopperUtils['checkIsBlackList'](_[_0xa530('0x102')](_0x47288d[_0x5e8efd],[_0xa530('0xe2'),_0xa530('0x165')]))[_0xa530('0x9c')](_0x28603f[_0xa530('0x209')](_0x43700c,_0x47288d[_0x5e8efd]))['catch'](function(_0x5a7968){logger['error']('[actionOriginate]',_0x5a7968);utils['decrementOriginate'](_0x43700c,_0xa530('0x210'));});}}}}})[_0xa530('0x9f')](function(_0x327cf4){_0x43700c[_0xa530('0x203')]=0x0;logger[_0xa530('0x64')](_0xa530('0x20c'),_0x327cf4);});}};Dialer[_0xa530('0x16')]['handlePredictive']=function(_0x1d0662){if(_0x1d0662['dialLimitQueue']>0x0){var _0x5c42cf=_0x1d0662[_0xa530('0x20d')]-_0x1d0662[_0xa530('0x7f')]-_0x1d0662[_0xa530('0x147')];if(_0x5c42cf>0x0&&_0x1d0662[_0xa530('0x203')]==0x0){this['tryOriginatePredictive'](_0x1d0662);}else{loggerPredictiveCalls[_0xa530('0x45')](_0xa530('0x211'));}}else{this[_0xa530('0x212')](_0x1d0662);}};Dialer['prototype'][_0xa530('0x212')]=function(_0x2b4df5){var _0x5ce1f8=this;var _0x33e3e4=[];_0x2b4df5['originated']+=0x1;for(var _0x25f62b in this[_0xa530('0x1c')]){if(typeof this['agents'][_0x25f62b]!=='undefined'){if(this[_0xa530('0x1c')][_0x25f62b][_0xa530('0x6d')]===_0xa530('0x213')&&this[_0xa530('0x1c')][_0x25f62b][_0xa530('0x86')]===_0xa530('0x87')){_0x33e3e4['push'](this[_0xa530('0x1c')][_0x25f62b]['id']);}}}_0x2b4df5['temp']=0x1;return this[_0xa530('0x20e')](_0x2b4df5['id'],_0x33e3e4,0x1,_0x2b4df5[_0xa530('0x214')],_0x2b4df5)[_0xa530('0x9c')](function(_0xd3118b){_0x2b4df5['temp']=0x1;if(_0xd3118b){if(!utils[_0xa530('0x205')](_0xd3118b)){utils['checkContactLowerLimitOriginate'](_0x2b4df5,0x1,0x0);return hopperUtils['countReScheduled'](_0x2b4df5)['then'](sendMessageReschedule(_0x2b4df5))['catch'](loggerCatch(_0xa530('0x215')));}else{_0x2b4df5[_0xa530('0x67')]=utils[_0xa530('0x6b')][_0xa530('0x206')];if(_[_0xa530('0xf6')](_0xd3118b[0x0])||_[_0xa530('0xf6')](_0xd3118b[0x0][_0xa530('0x17e')])||_[_0xa530('0xf6')](_0xd3118b[0x0][_0xa530('0x165')])){_0x5ce1f8[_0xa530('0x158')](_0xa530('0x20f'),_0x2b4df5,_0xd3118b[0x0]);}else{return hopperUtils[_0xa530('0x216')](_[_0xa530('0x102')](_0xd3118b[0x0],[_0xa530('0xe2'),'phone']))[_0xa530('0x9c')](_0x5ce1f8[_0xa530('0x209')](_0x2b4df5,_0xd3118b[0x0]))[_0xa530('0x9f')](function(_0xb80bce){logger[_0xa530('0x64')](_0xa530('0x217'),_0xb80bce);utils[_0xa530('0xcc')](_0x2b4df5,_0xa530('0x217'));});}}}})['catch'](function(_0x2c76a2){_0x2b4df5[_0xa530('0x203')]=0x0;logger[_0xa530('0x64')](_0xa530('0x20c'),_0x2c76a2);});};Dialer[_0xa530('0x16')][_0xa530('0x1db')]=function(_0x1b9938,_0x42a190,_0x131493,_0x3be4c1,_0x447f5f,_0x4b205f){loggerPredictive[_0xa530('0x45')](_0xa530('0x218'));loggerPredictive[_0xa530('0x45')](_0xa530('0x219'),_0x1b9938);loggerPredictive[_0xa530('0x45')](_0xa530('0x21a'),_0x42a190);loggerPredictive[_0xa530('0x45')](_0xa530('0x21b'),_0x131493);loggerPredictive[_0xa530('0x45')](_0xa530('0x21c'),_0x3be4c1);loggerPredictive[_0xa530('0x45')](_0xa530('0x21d'),_0x447f5f);loggerPredictive[_0xa530('0x45')](_0xa530('0x51'));return new Promise(function(_0x1407a7,_0x1c36d9){if(_0x1b9938<=0x0||isNaN(_0x1b9938)){return _0x1c36d9(msgResponse(_0xa530('0x21e'),_0xa530('0x83'),'m\x20=\x20'+_0x1b9938));}if(_0x131493<=0x0||isNaN(_0x131493)){return _0x1c36d9(msgResponse('[abandonmentRate]','Error',_0xa530('0x21f')+_0x131493));}if(_0x3be4c1<=0x0||isNaN(_0x3be4c1)){return _0x1c36d9(msgResponse(_0xa530('0x21e'),_0xa530('0x83'),_0xa530('0x220')+_0x3be4c1));}if(_0x42a190<=0x0||isNaN(_0x42a190)){return _0x1c36d9(msgResponse(_0xa530('0x21e'),'Error','interval\x20=\x20'+_0x42a190));}if(_0x447f5f<=0x0||isNaN(_0x447f5f)){return _0x1c36d9(msgResponse(_0xa530('0x21e'),_0xa530('0x83'),'Amax\x20=\x20'+_0x447f5f));}_0x4b205f=_0x4b205f||0x0;var _0xc101ed=0x1/_0x131493;var _0x35e857=0x0;var _0x4bd675=0x0;var _0x1f8abe=0x0;var _0x79bdc8=0x0;for(var _0x4757a7=0x0;_0x1f8abe<_0x447f5f;_0x4757a7+=0x1){_0x4bd675=_0x4757a7/_0x42a190;_0x35e857=(_0x3be4c1*_0x4bd675+_0x4b205f)/_0xc101ed;_0x1f8abe=utils[_0xa530('0x221')](_0x35e857,_0x1b9938);_0x79bdc8=_0x35e857/_0x1b9938*(0x1-utils['erlangb'](_0x35e857,_0x1b9938));}return _0x1407a7({'erlangCalls':_0x4757a7,'erlangCallToSecond':_0x42a190/_0x4757a7,'erlangAbandonmentRate':_0x1f8abe,'erlangBusyFactor':_0x79bdc8});});};Dialer[_0xa530('0x16')][_0xa530('0x1dc')]=function(_0x415fdc,_0x579a9e,_0x2cef55,_0x38f4d6,_0x6707ea,_0x367c0b){loggerPredictive[_0xa530('0x45')](_0xa530('0x222'));loggerPredictive[_0xa530('0x45')](_0xa530('0x219'),_0x415fdc);loggerPredictive['info'](_0xa530('0x21a'),_0x579a9e);loggerPredictive[_0xa530('0x45')](_0xa530('0x21b'),_0x2cef55);loggerPredictive[_0xa530('0x45')](_0xa530('0x21c'),_0x38f4d6);loggerPredictive[_0xa530('0x45')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6707ea);loggerPredictive[_0xa530('0x45')](_0xa530('0x51'));return new Promise(function(_0x477f35,_0x5c2f28){if(_0x415fdc<=0x0||isNaN(_0x415fdc)){return _0x5c2f28(msgResponse(_0xa530('0x223'),_0xa530('0x83'),'m\x20=\x20'+_0x415fdc));}if(_0x2cef55<=0x0||isNaN(_0x2cef55)){return _0x5c2f28(msgResponse('[busyFactor]',_0xa530('0x83'),'Ts\x20=\x20'+_0x2cef55));}if(_0x38f4d6<=0x0||isNaN(_0x38f4d6)){return _0x5c2f28(msgResponse(_0xa530('0x223'),'Error','p\x20=\x20'+_0x38f4d6));}if(_0x579a9e<=0x0||isNaN(_0x579a9e)){return _0x5c2f28(msgResponse('[busyFactor]','Error',_0xa530('0x224')+_0x579a9e));}if(_0x6707ea<=0x0||isNaN(_0x6707ea)){return _0x5c2f28(msgResponse('[busyFactor]','Error','Umin\x20=\x20'+_0x6707ea));}_0x367c0b=_0x367c0b||0x0;var _0x772328=0x1/_0x2cef55;var _0x506f15=0x0;var _0x2a7d46=0x0;var _0x1efae5=0x0;var _0x36c1f0=0x0;for(var _0x58d2c0=0x0;_0x36c1f0<_0x6707ea;_0x58d2c0+=0x1){_0x2a7d46=_0x58d2c0/_0x579a9e;_0x506f15=(_0x38f4d6*_0x2a7d46+_0x367c0b)/_0x772328;_0x1efae5=utils[_0xa530('0x221')](_0x506f15,_0x415fdc);_0x36c1f0=_0x506f15/_0x415fdc*(0x1-utils[_0xa530('0x221')](_0x506f15,_0x415fdc));}return _0x477f35({'erlangCalls':_0x58d2c0,'erlangCallToSecond':_0x579a9e/_0x58d2c0,'erlangAbandonmentRate':_0x1efae5,'erlangBusyFactor':_0x36c1f0});});};module[_0xa530('0x225')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 0a94103..260a02d 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc423=['callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback'];(function(_0x5083cc,_0xcd1903){var _0x27e884=function(_0x14045d){while(--_0x14045d){_0x5083cc['push'](_0x5083cc['shift']());}};_0x27e884(++_0xcd1903);}(_0xc423,0x14d));var _0x3c42=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xc423[_0x27af45];return _0x18df21;};'use strict';var util=require(_0x3c42('0x0'));var _=require(_0x3c42('0x1'));var moment=require(_0x3c42('0x2'));function checkNameSurname(_0x44f194,_0x474838,_0x4eddc2){var _0x4f9eab='';if(!_[_0x3c42('0x3')](_0x474838)&&_0x3c42('0x4')===typeof _0x474838){_0x4f9eab+=_0x474838;}if(!_[_0x3c42('0x3')](_0x4eddc2)&&_0x3c42('0x4')===typeof _0x4eddc2){_0x4f9eab+='\x20'+_0x4eddc2;}if(_0x4f9eab!==''){return _0x4f9eab;}return _0x44f194;}function Action(_0x19da08,_0x531351,_0x33a5a8){this[_0x3c42('0x5')]=_0x19da08;this[_0x3c42('0x6')]=_0x33a5a8||undefined;this[_0x3c42('0x7')]=checkNameSurname(_0x531351[_0x3c42('0x8')][_0x3c42('0x9')],_0x531351[_0x3c42('0x8')][_0x3c42('0xa')],_0x531351[_0x3c42('0x8')][_0x3c42('0xb')]);this[_0x3c42('0xc')]=_0x531351[_0x3c42('0x9')];this[_0x3c42('0xd')]=_0x19da08[_0x3c42('0x7')];this['active']=_0x531351[_0x3c42('0xe')]||![];this[_0x3c42('0xf')]=_0x19da08['type'];this['dialQueueTimeout']=_0x19da08['dialQueueTimeout']||0x3;this['scheduledat']=_0x531351['scheduledat'];this[_0x3c42('0x10')]=_0x531351[_0x3c42('0x10')];this[_0x3c42('0x11')]=_0x531351[_0x3c42('0x11')];this[_0x3c42('0x12')]=_0x531351[_0x3c42('0x12')];this['countnosuchnumberretry']=_0x531351[_0x3c42('0x13')];this['countdropretry']=_0x531351[_0x3c42('0x14')];this[_0x3c42('0x15')]=_0x531351[_0x3c42('0x15')];this[_0x3c42('0x16')]=_0x531351[_0x3c42('0x16')];this[_0x3c42('0x17')]=_0x531351['countagentrejectretry'];this[_0x3c42('0x18')]=_0x531351[_0x3c42('0x18')];this[_0x3c42('0x19')]=_0x531351[_0x3c42('0x19')];this[_0x3c42('0x1a')]=_0x531351[_0x3c42('0x1a')];this[_0x3c42('0x1b')]=_0x531351['VoiceQueueId'];this[_0x3c42('0x1c')]=_0x531351[_0x3c42('0x1c')];this[_0x3c42('0x1d')]=_0x531351['id'];this[_0x3c42('0x1e')]=_0x531351[_0x3c42('0x8')][_0x3c42('0xa')]||'';this[_0x3c42('0x1f')]=moment()[_0x3c42('0x20')](_0x3c42('0x21'));this[_0x3c42('0x22')]=_0x531351['callback'];this['callbackuniqueid']=_0x531351[_0x3c42('0x23')];this[_0x3c42('0x24')]=_0x531351[_0x3c42('0x24')];this['recallme']=_0x531351[_0x3c42('0x25')];this[_0x3c42('0x26')]='';this['originatecalleridname']='';}Action[_0x3c42('0x27')][_0x3c42('0x28')]=function(){return util[_0x3c42('0x20')](_0x3c42('0x29'),this['name'],this[_0x3c42('0x5')][_0x3c42('0x2a')]>0x0?this['number'][_0x3c42('0x2b')](this[_0x3c42('0x5')][_0x3c42('0x2a')]):this[_0x3c42('0xc')]);};Action[_0x3c42('0x27')][_0x3c42('0x2c')]=function(){return this['queue'];};module[_0x3c42('0x2d')]=Action; \ No newline at end of file +var _0x14a1=['originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','number','getQueue','exports','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0x3f9a79,_0x240a33){var _0x2dfcc3=function(_0x2bb6f5){while(--_0x2bb6f5){_0x3f9a79['push'](_0x3f9a79['shift']());}};_0x2dfcc3(++_0x240a33);}(_0x14a1,0x168));var _0x114a=function(_0x30c80a,_0x8d6289){_0x30c80a=_0x30c80a-0x0;var _0x3c9c12=_0x14a1[_0x30c80a];return _0x3c9c12;};'use strict';var util=require('util');var _=require(_0x114a('0x0'));var moment=require('moment');function checkNameSurname(_0x521ad9,_0x3f7329,_0x2049c1){var _0x2e3f09='';if(!_[_0x114a('0x1')](_0x3f7329)&&'string'===typeof _0x3f7329){_0x2e3f09+=_0x3f7329;}if(!_[_0x114a('0x1')](_0x2049c1)&&_0x114a('0x2')===typeof _0x2049c1){_0x2e3f09+='\x20'+_0x2049c1;}if(_0x2e3f09!==''){return _0x2e3f09;}return _0x521ad9;}function Action(_0x5a460c,_0x103a31,_0x3cf757){this[_0x114a('0x3')]=_0x5a460c;this[_0x114a('0x4')]=_0x3cf757||undefined;this[_0x114a('0x5')]=checkNameSurname(_0x103a31[_0x114a('0x6')][_0x114a('0x7')],_0x103a31[_0x114a('0x6')][_0x114a('0x8')],_0x103a31[_0x114a('0x6')]['lastName']);this['number']=_0x103a31[_0x114a('0x7')];this[_0x114a('0x9')]=_0x5a460c['name'];this[_0x114a('0xa')]=_0x103a31['active']||![];this['type']=_0x5a460c[_0x114a('0xb')];this[_0x114a('0xc')]=_0x5a460c[_0x114a('0xc')]||0x3;this[_0x114a('0xd')]=_0x103a31[_0x114a('0xd')];this[_0x114a('0xe')]=_0x103a31[_0x114a('0xe')];this[_0x114a('0xf')]=_0x103a31[_0x114a('0xf')];this[_0x114a('0x10')]=_0x103a31[_0x114a('0x10')];this[_0x114a('0x11')]=_0x103a31[_0x114a('0x11')];this[_0x114a('0x12')]=_0x103a31[_0x114a('0x12')];this[_0x114a('0x13')]=_0x103a31['countabandonedretry'];this[_0x114a('0x14')]=_0x103a31[_0x114a('0x14')];this[_0x114a('0x15')]=_0x103a31[_0x114a('0x15')];this[_0x114a('0x16')]=_0x103a31['ContactId'];this[_0x114a('0x17')]=_0x103a31[_0x114a('0x17')];this['UserId']=_0x103a31[_0x114a('0x18')];this[_0x114a('0x19')]=_0x103a31[_0x114a('0x19')];this[_0x114a('0x1a')]=_0x103a31['CampaignId'];this[_0x114a('0x1b')]=_0x103a31['id'];this[_0x114a('0x1c')]=_0x103a31[_0x114a('0x6')]['firstName']||'';this[_0x114a('0x1d')]=moment()[_0x114a('0x1e')](_0x114a('0x1f'));this[_0x114a('0x20')]=_0x103a31['callback'];this[_0x114a('0x21')]=_0x103a31[_0x114a('0x21')];this['callbackat']=_0x103a31[_0x114a('0x22')];this[_0x114a('0x23')]=_0x103a31[_0x114a('0x23')];this[_0x114a('0x24')]='';this[_0x114a('0x25')]='';}Action[_0x114a('0x26')][_0x114a('0x27')]=function(){return util[_0x114a('0x1e')]('\x22%s\x22\x20<%s>',this['name'],this[_0x114a('0x3')][_0x114a('0x28')]>0x0?this[_0x114a('0x29')]['substring'](this[_0x114a('0x3')]['dialCutDigit']):this[_0x114a('0x29')]);};Action['prototype'][_0x114a('0x2a')]=function(){return this[_0x114a('0x9')];};module[_0x114a('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 3aa3543..93f1d84 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29d0=['starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','number'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x29d0,0x19b));var _0x029d=function(_0x4bf0e5,_0x1262b5){_0x4bf0e5=_0x4bf0e5-0x0;var _0x5af375=_0x29d0[_0x4bf0e5];return _0x5af375;};'use strict';var moment=require('moment');var utils=require(_0x029d('0x0'));function AgentComplete(_0x46cd2c,_0x69818a){this[_0x029d('0x1')]=0x4;this[_0x029d('0x2')]='Answer';this[_0x029d('0x3')]=_0x46cd2c[_0x029d('0x3')];this[_0x029d('0x4')]=_0x46cd2c[_0x029d('0x4')];this['campaigntype']=_0x46cd2c[_0x029d('0x4')]==='outbound'?_0x029d('0x5'):_0x46cd2c[_0x029d('0x4')];this[_0x029d('0x6')]=_0x46cd2c[_0x029d('0x6')];this['countcongestionretry']=_0x46cd2c[_0x029d('0x7')];this[_0x029d('0x8')]=_0x46cd2c[_0x029d('0x8')];this[_0x029d('0x9')]=_0x46cd2c[_0x029d('0x6')]+_0x46cd2c[_0x029d('0x7')]+_0x46cd2c[_0x029d('0x8')]+_0x46cd2c['countnosuchnumberretry']+_0x46cd2c[_0x029d('0xa')]+_0x46cd2c[_0x029d('0xb')]+_0x46cd2c['countmachineretry']+_0x46cd2c[_0x029d('0xc')];this[_0x029d('0xd')]=_0x46cd2c[_0x029d('0xd')];this['countdropretry']=_0x46cd2c[_0x029d('0xa')];this[_0x029d('0xb')]=_0x46cd2c[_0x029d('0xb')];this[_0x029d('0xe')]=_0x46cd2c[_0x029d('0xe')];this[_0x029d('0xc')]=_0x46cd2c[_0x029d('0xc')];this[_0x029d('0xf')]=_0x69818a[_0x029d('0xf')];this[_0x029d('0x10')]=_0x46cd2c[_0x029d('0x11')];this['calleridnum']=_0x46cd2c[_0x029d('0x12')];this['starttime']=_0x46cd2c[_0x029d('0x13')];this[_0x029d('0x14')]=_0x46cd2c[_0x029d('0x14')];this[_0x029d('0x15')]=_0x46cd2c[_0x029d('0x15')];this[_0x029d('0x16')]=moment()['format'](_0x029d('0x17'));this[_0x029d('0x18')]=utils[_0x029d('0x19')](_0x46cd2c['responsetime'],_0x46cd2c[_0x029d('0x13')]);this[_0x029d('0x1a')]=utils['getSeconds'](_0x46cd2c[_0x029d('0x15')],_0x46cd2c['responsetime']);this[_0x029d('0x1b')]=utils[_0x029d('0x19')](this[_0x029d('0x16')],_0x46cd2c[_0x029d('0x15')]);this[_0x029d('0x5')]=_0x69818a[_0x029d('0x5')];this[_0x029d('0x1c')]=_0x69818a[_0x029d('0x1c')];this['reason']=_0x69818a[_0x029d('0x1d')];this[_0x029d('0x1e')]=_0x46cd2c['callback'];this['callbackuniqueid']=_0x46cd2c[_0x029d('0x1f')];this[_0x029d('0x20')]=_0x46cd2c[_0x029d('0x20')];this['recallme']=_0x46cd2c[_0x029d('0x21')];this[_0x029d('0x22')]=_0x46cd2c[_0x029d('0x22')];this['ListId']=_0x46cd2c[_0x029d('0x23')];this[_0x029d('0x24')]=_0x46cd2c[_0x029d('0x24')];this['VoiceQueueId']=_0x46cd2c[_0x029d('0x25')];this['CampaignId']=_0x46cd2c[_0x029d('0x26')];this[_0x029d('0x27')]=_0x46cd2c['originatecalleridnum']||'';this[_0x029d('0x28')]=_0x46cd2c[_0x029d('0x28')]||'';this[_0x029d('0x29')]=_0x46cd2c[_0x029d('0x29')];}module[_0x029d('0x2a')]=AgentComplete; \ No newline at end of file +var _0x514c=['countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x5915e3,_0x27cc50){var _0xd6e25e=function(_0x1c3c92){while(--_0x1c3c92){_0x5915e3['push'](_0x5915e3['shift']());}};_0xd6e25e(++_0x27cc50);}(_0x514c,0xf5));var _0xc514=function(_0x40975a,_0x30bf2c){_0x40975a=_0x40975a-0x0;var _0x52f241=_0x514c[_0x40975a];return _0x52f241;};'use strict';var moment=require(_0xc514('0x0'));var utils=require('../utils');function AgentComplete(_0x2a499c,_0x5e362f){this[_0xc514('0x1')]=0x4;this[_0xc514('0x2')]=_0xc514('0x3');this[_0xc514('0x4')]=_0x2a499c['scheduledat'];this[_0xc514('0x5')]=_0x2a499c[_0xc514('0x5')];this[_0xc514('0x6')]=_0x2a499c['type']==='outbound'?_0xc514('0x7'):_0x2a499c[_0xc514('0x5')];this['countbusyretry']=_0x2a499c[_0xc514('0x8')];this[_0xc514('0x9')]=_0x2a499c[_0xc514('0x9')];this[_0xc514('0xa')]=_0x2a499c[_0xc514('0xa')];this[_0xc514('0xb')]=_0x2a499c[_0xc514('0x8')]+_0x2a499c[_0xc514('0x9')]+_0x2a499c[_0xc514('0xa')]+_0x2a499c[_0xc514('0xc')]+_0x2a499c[_0xc514('0xd')]+_0x2a499c['countabandonedretry']+_0x2a499c[_0xc514('0xe')]+_0x2a499c['countagentrejectretry'];this[_0xc514('0xc')]=_0x2a499c['countnosuchnumberretry'];this[_0xc514('0xd')]=_0x2a499c[_0xc514('0xd')];this[_0xc514('0xf')]=_0x2a499c[_0xc514('0xf')];this[_0xc514('0xe')]=_0x2a499c[_0xc514('0xe')];this[_0xc514('0x10')]=_0x2a499c[_0xc514('0x10')];this[_0xc514('0x11')]=_0x5e362f[_0xc514('0x11')];this['calleridname']=_0x2a499c[_0xc514('0x12')];this[_0xc514('0x13')]=_0x2a499c[_0xc514('0x14')];this[_0xc514('0x15')]=_0x2a499c['starttime'];this[_0xc514('0x16')]=_0x2a499c[_0xc514('0x16')];this[_0xc514('0x17')]=_0x2a499c['answertime'];this['endtime']=moment()[_0xc514('0x18')](_0xc514('0x19'));this['ringtime']=utils[_0xc514('0x1a')](_0x2a499c[_0xc514('0x16')],_0x2a499c['starttime']);this[_0xc514('0x1b')]=utils['getSeconds'](_0x2a499c['answertime'],_0x2a499c[_0xc514('0x16')]);this[_0xc514('0x1c')]=utils[_0xc514('0x1a')](this['endtime'],_0x2a499c[_0xc514('0x17')]);this['queue']=_0x5e362f[_0xc514('0x7')];this[_0xc514('0x1d')]=_0x5e362f[_0xc514('0x1d')];this[_0xc514('0x1e')]=_0x5e362f[_0xc514('0x1e')];this['callback']=_0x2a499c[_0xc514('0x1f')];this[_0xc514('0x20')]=_0x2a499c[_0xc514('0x20')];this[_0xc514('0x21')]=_0x2a499c[_0xc514('0x21')];this['recallme']=_0x2a499c[_0xc514('0x22')];this[_0xc514('0x23')]=_0x2a499c[_0xc514('0x23')];this[_0xc514('0x24')]=_0x2a499c['ListId'];this[_0xc514('0x25')]=_0x2a499c[_0xc514('0x25')];this[_0xc514('0x26')]=_0x2a499c[_0xc514('0x26')];this['CampaignId']=_0x2a499c[_0xc514('0x27')];this[_0xc514('0x28')]=_0x2a499c[_0xc514('0x28')]||'';this['originatecalleridname']=_0x2a499c[_0xc514('0x29')]||'';this[_0xc514('0x2a')]=_0x2a499c[_0xc514('0x2a')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 1991e38..d267650 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e65=['ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime'];(function(_0x5f5576,_0x2f54ed){var _0xf250d0=function(_0x125497){while(--_0x125497){_0x5f5576['push'](_0x5f5576['shift']());}};_0xf250d0(++_0x2f54ed);}(_0x3e65,0x183));var _0x53e6=function(_0x47fc43,_0x4e76ae){_0x47fc43=_0x47fc43-0x0;var _0x3ed408=_0x3e65[_0x47fc43];return _0x3ed408;};'use strict';function Final(_0x5c2037){this['uniqueid']=_0x5c2037[_0x53e6('0x0')];this['scheduledat']=_0x5c2037[_0x53e6('0x1')];this[_0x53e6('0x2')]=_0x5c2037[_0x53e6('0x2')];this[_0x53e6('0x3')]=_0x5c2037[_0x53e6('0x2')]===_0x53e6('0x4')?_0x53e6('0x5'):_0x5c2037['type'];this['countbusyretry']=_0x5c2037[_0x53e6('0x6')];this[_0x53e6('0x7')]=_0x5c2037[_0x53e6('0x7')];this[_0x53e6('0x8')]=_0x5c2037[_0x53e6('0x8')];this[_0x53e6('0x9')]=_0x5c2037[_0x53e6('0x6')]+_0x5c2037['countcongestionretry']+_0x5c2037[_0x53e6('0x8')]+_0x5c2037[_0x53e6('0xa')]+_0x5c2037[_0x53e6('0xb')]+_0x5c2037[_0x53e6('0xc')]+_0x5c2037[_0x53e6('0xd')]+_0x5c2037[_0x53e6('0xe')];this[_0x53e6('0xa')]=_0x5c2037[_0x53e6('0xa')];this[_0x53e6('0xb')]=_0x5c2037[_0x53e6('0xb')];this[_0x53e6('0xc')]=_0x5c2037['countabandonedretry'];this['countmachineretry']=_0x5c2037[_0x53e6('0xd')];this[_0x53e6('0xe')]=_0x5c2037[_0x53e6('0xe')];this[_0x53e6('0x5')]=_0x5c2037[_0x53e6('0x5')];this[_0x53e6('0xf')]=_0x5c2037['calleridname'];this[_0x53e6('0x10')]=_0x5c2037[_0x53e6('0x10')];this[_0x53e6('0x11')]=_0x5c2037['starttime'];this[_0x53e6('0x12')]=_0x5c2037[_0x53e6('0x12')];this[_0x53e6('0x13')]=_0x5c2037[_0x53e6('0x12')];this['ringtime']=_0x5c2037[_0x53e6('0x14')]||0x0;this[_0x53e6('0x15')]=_0x5c2037[_0x53e6('0x15')]||0x0;this[_0x53e6('0x16')]=_0x5c2037[_0x53e6('0x16')]||0x0;this[_0x53e6('0x17')]=_0x5c2037[_0x53e6('0x17')];this[_0x53e6('0x18')]=_0x5c2037[_0x53e6('0x18')];this[_0x53e6('0x19')]=_0x5c2037['callbackat'];this[_0x53e6('0x1a')]=_0x5c2037[_0x53e6('0x1a')];this[_0x53e6('0x1b')]=_0x5c2037[_0x53e6('0x1b')];this[_0x53e6('0x1c')]=_0x5c2037[_0x53e6('0x1c')];this[_0x53e6('0x1d')]=_0x5c2037[_0x53e6('0x1d')];this[_0x53e6('0x1e')]=_0x5c2037[_0x53e6('0x1e')];this[_0x53e6('0x1f')]=_0x5c2037[_0x53e6('0x1f')];this[_0x53e6('0x20')]=_0x5c2037[_0x53e6('0x20')]||'';this[_0x53e6('0x21')]=_0x5c2037[_0x53e6('0x21')]||'';this['state']=_0x5c2037[_0x53e6('0x22')];this[_0x53e6('0x23')]=_0x5c2037[_0x53e6('0x23')];}module[_0x53e6('0x24')]=Final; \ No newline at end of file +var _0xa353=['callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime'];(function(_0x1df308,_0x1ffea0){var _0x412321=function(_0x37f53f){while(--_0x37f53f){_0x1df308['push'](_0x1df308['shift']());}};_0x412321(++_0x1ffea0);}(_0xa353,0xf3));var _0x3a35=function(_0x1fcdc7,_0x56de24){_0x1fcdc7=_0x1fcdc7-0x0;var _0x4547a0=_0xa353[_0x1fcdc7];return _0x4547a0;};'use strict';function Final(_0x46362b){this[_0x3a35('0x0')]=_0x46362b[_0x3a35('0x0')];this[_0x3a35('0x1')]=_0x46362b['scheduledat'];this['type']=_0x46362b[_0x3a35('0x2')];this[_0x3a35('0x3')]=_0x46362b[_0x3a35('0x2')]===_0x3a35('0x4')?_0x3a35('0x5'):_0x46362b['type'];this[_0x3a35('0x6')]=_0x46362b[_0x3a35('0x6')];this[_0x3a35('0x7')]=_0x46362b[_0x3a35('0x7')];this['countnoanswerretry']=_0x46362b[_0x3a35('0x8')];this[_0x3a35('0x9')]=_0x46362b['countbusyretry']+_0x46362b[_0x3a35('0x7')]+_0x46362b[_0x3a35('0x8')]+_0x46362b[_0x3a35('0xa')]+_0x46362b[_0x3a35('0xb')]+_0x46362b[_0x3a35('0xc')]+_0x46362b[_0x3a35('0xd')]+_0x46362b[_0x3a35('0xe')];this[_0x3a35('0xa')]=_0x46362b[_0x3a35('0xa')];this[_0x3a35('0xb')]=_0x46362b[_0x3a35('0xb')];this[_0x3a35('0xc')]=_0x46362b[_0x3a35('0xc')];this[_0x3a35('0xd')]=_0x46362b[_0x3a35('0xd')];this[_0x3a35('0xe')]=_0x46362b['countagentrejectretry'];this[_0x3a35('0x5')]=_0x46362b['queue'];this[_0x3a35('0xf')]=_0x46362b[_0x3a35('0xf')];this[_0x3a35('0x10')]=_0x46362b[_0x3a35('0x10')];this[_0x3a35('0x11')]=_0x46362b[_0x3a35('0x11')];this[_0x3a35('0x12')]=_0x46362b['responsetime'];this['endtime']=_0x46362b[_0x3a35('0x12')];this[_0x3a35('0x13')]=_0x46362b['ringtime']||0x0;this['holdtime']=_0x46362b[_0x3a35('0x14')]||0x0;this['talktime']=_0x46362b['talktime']||0x0;this[_0x3a35('0x15')]=_0x46362b['callback'];this['callbackuniqueid']=_0x46362b['callbackuniqueid'];this['callbackat']=_0x46362b[_0x3a35('0x16')];this[_0x3a35('0x17')]=_0x46362b[_0x3a35('0x17')];this[_0x3a35('0x18')]=_0x46362b[_0x3a35('0x18')];this[_0x3a35('0x19')]=_0x46362b[_0x3a35('0x19')];this['UserId']=_0x46362b[_0x3a35('0x1a')];this['VoiceQueueId']=_0x46362b[_0x3a35('0x1b')];this[_0x3a35('0x1c')]=_0x46362b['CampaignId'];this['originatecalleridnum']=_0x46362b['originatecalleridnum']||'';this[_0x3a35('0x1d')]=_0x46362b[_0x3a35('0x1d')]||'';this[_0x3a35('0x1e')]=_0x46362b['state'];this[_0x3a35('0x1f')]=_0x46362b[_0x3a35('0x1f')];}module[_0x3a35('0x20')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 1a7f110..0f6730b 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe243=['callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','cause-txt','callback'];(function(_0x3d8c8b,_0x3acaae){var _0x5923ff=function(_0x292b51){while(--_0x292b51){_0x3d8c8b['push'](_0x3d8c8b['shift']());}};_0x5923ff(++_0x3acaae);}(_0xe243,0x1e7));var _0x3e24=function(_0x7d8e66,_0x599dbd){_0x7d8e66=_0x7d8e66-0x0;var _0x190e52=_0xe243[_0x7d8e66];return _0x190e52;};'use strict';var moment=require('moment');var utils=require(_0x3e24('0x0'));function Hangup(_0x44724d,_0x4e9c9f){this[_0x3e24('0x1')]=0x4;this['statedesc']=_0x3e24('0x2');this[_0x3e24('0x3')]=_0x44724d[_0x3e24('0x3')];this[_0x3e24('0x4')]=_0x44724d['type'];this[_0x3e24('0x5')]=_0x44724d['type']===_0x3e24('0x6')?_0x3e24('0x7'):_0x44724d[_0x3e24('0x4')];this['amd']=_0x44724d[_0x3e24('0x8')]||![];this['countbusyretry']=_0x44724d[_0x3e24('0x9')];this[_0x3e24('0xa')]=_0x44724d[_0x3e24('0xa')];this[_0x3e24('0xb')]=_0x44724d[_0x3e24('0xb')];this[_0x3e24('0xc')]=_0x44724d[_0x3e24('0x9')]+_0x44724d[_0x3e24('0xa')]+_0x44724d[_0x3e24('0xb')]+_0x44724d[_0x3e24('0xd')]+_0x44724d[_0x3e24('0xe')]+_0x44724d['countabandonedretry']+_0x44724d['countmachineretry']+_0x44724d[_0x3e24('0xf')];this[_0x3e24('0xd')]=_0x44724d[_0x3e24('0xd')];this[_0x3e24('0xe')]=_0x44724d[_0x3e24('0xe')];this[_0x3e24('0x10')]=_0x44724d[_0x3e24('0x10')];this[_0x3e24('0x11')]=_0x44724d[_0x3e24('0x11')];this[_0x3e24('0xf')]=_0x44724d['countagentrejectretry'];this['uniqueid']=_0x4e9c9f[_0x3e24('0x12')];this['calleridname']=_0x44724d[_0x3e24('0x13')];this[_0x3e24('0x14')]=_0x44724d[_0x3e24('0x15')];this[_0x3e24('0x16')]=_0x44724d['starttime'];this[_0x3e24('0x17')]=_0x44724d[_0x3e24('0x17')];this[_0x3e24('0x18')]=moment()[_0x3e24('0x19')](_0x3e24('0x1a'));this[_0x3e24('0x1b')]=utils[_0x3e24('0x1c')](_0x44724d[_0x3e24('0x17')],_0x44724d[_0x3e24('0x16')]);this['holdtime']=0x0;this[_0x3e24('0x1d')]=utils[_0x3e24('0x1c')](this[_0x3e24('0x18')],_0x44724d[_0x3e24('0x17')]);this[_0x3e24('0x7')]=_0x44724d[_0x3e24('0x7')];this[_0x3e24('0x1e')]='IVR';this['reason']=_0x4e9c9f[_0x3e24('0x1f')];this[_0x3e24('0x20')]=_0x44724d[_0x3e24('0x20')];this[_0x3e24('0x21')]=_0x44724d[_0x3e24('0x21')];this[_0x3e24('0x22')]=_0x44724d[_0x3e24('0x22')];this['recallme']=_0x44724d[_0x3e24('0x23')];this['ContactId']=_0x44724d[_0x3e24('0x24')];this['ListId']=_0x44724d['ListId'];this['UserId']=_0x44724d[_0x3e24('0x25')];this[_0x3e24('0x26')]=_0x44724d[_0x3e24('0x26')];this['CampaignId']=_0x44724d[_0x3e24('0x27')];}module['exports']=Hangup; \ No newline at end of file +var _0x8912=['UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x44aa71,_0x4b254d){var _0x322ef9=function(_0xf219a6){while(--_0xf219a6){_0x44aa71['push'](_0x44aa71['shift']());}};_0x322ef9(++_0x4b254d);}(_0x8912,0xef));var _0x2891=function(_0x233692,_0x3f1d70){_0x233692=_0x233692-0x0;var _0x43330f=_0x8912[_0x233692];return _0x43330f;};'use strict';var moment=require(_0x2891('0x0'));var utils=require(_0x2891('0x1'));function Hangup(_0x1c3df5,_0x4538a4){this[_0x2891('0x2')]=0x4;this[_0x2891('0x3')]=_0x2891('0x4');this['scheduledat']=_0x1c3df5[_0x2891('0x5')];this[_0x2891('0x6')]=_0x1c3df5[_0x2891('0x6')];this[_0x2891('0x7')]=_0x1c3df5[_0x2891('0x6')]===_0x2891('0x8')?_0x2891('0x9'):_0x1c3df5[_0x2891('0x6')];this['amd']=_0x1c3df5[_0x2891('0xa')]||![];this[_0x2891('0xb')]=_0x1c3df5[_0x2891('0xb')];this[_0x2891('0xc')]=_0x1c3df5[_0x2891('0xc')];this[_0x2891('0xd')]=_0x1c3df5[_0x2891('0xd')];this[_0x2891('0xe')]=_0x1c3df5[_0x2891('0xb')]+_0x1c3df5['countcongestionretry']+_0x1c3df5['countnoanswerretry']+_0x1c3df5[_0x2891('0xf')]+_0x1c3df5['countdropretry']+_0x1c3df5['countabandonedretry']+_0x1c3df5[_0x2891('0x10')]+_0x1c3df5[_0x2891('0x11')];this[_0x2891('0xf')]=_0x1c3df5[_0x2891('0xf')];this[_0x2891('0x12')]=_0x1c3df5[_0x2891('0x12')];this[_0x2891('0x13')]=_0x1c3df5[_0x2891('0x13')];this[_0x2891('0x10')]=_0x1c3df5[_0x2891('0x10')];this[_0x2891('0x11')]=_0x1c3df5['countagentrejectretry'];this[_0x2891('0x14')]=_0x4538a4[_0x2891('0x14')];this[_0x2891('0x15')]=_0x1c3df5[_0x2891('0x16')];this[_0x2891('0x17')]=_0x1c3df5[_0x2891('0x18')];this[_0x2891('0x19')]=_0x1c3df5[_0x2891('0x19')];this['responsetime']=_0x1c3df5[_0x2891('0x1a')];this[_0x2891('0x1b')]=moment()[_0x2891('0x1c')](_0x2891('0x1d'));this[_0x2891('0x1e')]=utils[_0x2891('0x1f')](_0x1c3df5[_0x2891('0x1a')],_0x1c3df5[_0x2891('0x19')]);this[_0x2891('0x20')]=0x0;this[_0x2891('0x21')]=utils[_0x2891('0x1f')](this[_0x2891('0x1b')],_0x1c3df5['responsetime']);this[_0x2891('0x9')]=_0x1c3df5['queue'];this['membername']=_0x2891('0x22');this[_0x2891('0x23')]=_0x4538a4[_0x2891('0x24')];this['callback']=_0x1c3df5[_0x2891('0x25')];this[_0x2891('0x26')]=_0x1c3df5[_0x2891('0x26')];this[_0x2891('0x27')]=_0x1c3df5['callbackat'];this[_0x2891('0x28')]=_0x1c3df5[_0x2891('0x28')];this[_0x2891('0x29')]=_0x1c3df5[_0x2891('0x29')];this[_0x2891('0x2a')]=_0x1c3df5[_0x2891('0x2a')];this[_0x2891('0x2b')]=_0x1c3df5[_0x2891('0x2b')];this[_0x2891('0x2c')]=_0x1c3df5['VoiceQueueId'];this[_0x2891('0x2d')]=_0x1c3df5[_0x2891('0x2d')];}module[_0x2891('0x2e')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index bd1b1f6..4a943af 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ac2=['responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','calleridnum','number','starttime'];(function(_0x37f83a,_0x327124){var _0x711177=function(_0x293295){while(--_0x293295){_0x37f83a['push'](_0x37f83a['shift']());}};_0x711177(++_0x327124);}(_0x8ac2,0x12f));var _0x28ac=function(_0x5bce18,_0x5b5c5f){_0x5bce18=_0x5bce18-0x0;var _0x1e5d5a=_0x8ac2[_0x5bce18];return _0x1e5d5a;};'use strict';var utils=require(_0x28ac('0x0'));function History(_0x224d2a){this[_0x28ac('0x1')]=_0x224d2a['uniqueid'];this[_0x28ac('0x2')]=_0x224d2a[_0x28ac('0x2')]||undefined;this['type']=_0x224d2a[_0x28ac('0x3')];this[_0x28ac('0x4')]=_0x224d2a['type']===_0x28ac('0x5')?_0x28ac('0x6'):_0x224d2a[_0x28ac('0x3')];this['countbusyretry']=_0x224d2a[_0x28ac('0x7')];this[_0x28ac('0x8')]=_0x224d2a[_0x28ac('0x8')];this[_0x28ac('0x9')]=_0x224d2a[_0x28ac('0x9')];this['countglobal']=_0x224d2a[_0x28ac('0x7')]+_0x224d2a[_0x28ac('0x8')]+_0x224d2a['countnoanswerretry']+_0x224d2a[_0x28ac('0xa')]+_0x224d2a[_0x28ac('0xb')]+_0x224d2a[_0x28ac('0xc')]+_0x224d2a[_0x28ac('0xd')]+_0x224d2a['countagentrejectretry'];this['countnosuchnumberretry']=_0x224d2a[_0x28ac('0xa')];this[_0x28ac('0xb')]=_0x224d2a['countdropretry'];this[_0x28ac('0xc')]=_0x224d2a['countabandonedretry'];this[_0x28ac('0xd')]=_0x224d2a[_0x28ac('0xd')];this['countagentrejectretry']=_0x224d2a['countagentrejectretry'];this[_0x28ac('0x6')]=_0x224d2a['queue'];this['calleridname']=_0x224d2a['name'];this[_0x28ac('0xe')]=_0x224d2a[_0x28ac('0xf')];this[_0x28ac('0x10')]=_0x224d2a[_0x28ac('0x10')];this[_0x28ac('0x11')]=_0x224d2a['responsetime'];this['endtime']=_0x224d2a[_0x28ac('0x11')];this[_0x28ac('0x12')]=utils['getSeconds'](_0x224d2a['responsetime'],_0x224d2a['starttime']);this[_0x28ac('0x13')]=0x0;this[_0x28ac('0x14')]=0x0;this[_0x28ac('0x15')]=_0x224d2a['callback'];this['callbackuniqueid']=_0x224d2a[_0x28ac('0x16')];this['callbackat']=_0x224d2a['callbackat'];this[_0x28ac('0x17')]=_0x224d2a[_0x28ac('0x17')];this[_0x28ac('0x18')]=_0x224d2a[_0x28ac('0x18')];this[_0x28ac('0x19')]=_0x224d2a[_0x28ac('0x19')];this['UserId']=_0x224d2a[_0x28ac('0x1a')];this[_0x28ac('0x1b')]=_0x224d2a[_0x28ac('0x1b')];this[_0x28ac('0x1c')]=_0x224d2a[_0x28ac('0x1c')];this[_0x28ac('0x1d')]=_0x224d2a[_0x28ac('0x1d')]||'';this['originatecalleridname']=_0x224d2a[_0x28ac('0x1e')]||'';this['state']=_0x224d2a['state'];this['statedesc']=_0x224d2a[_0x28ac('0x1f')];}module['exports']=History; \ No newline at end of file +var _0x8825=['name','calleridnum','number','starttime','responsetime','endtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry'];(function(_0x5e3811,_0xfa8c1c){var _0x349cef=function(_0x3f4bf0){while(--_0x3f4bf0){_0x5e3811['push'](_0x5e3811['shift']());}};_0x349cef(++_0xfa8c1c);}(_0x8825,0x85));var _0x5882=function(_0x429581,_0x2dee24){_0x429581=_0x429581-0x0;var _0x3f8080=_0x8825[_0x429581];return _0x3f8080;};'use strict';var utils=require('../utils');function History(_0x57f261){this[_0x5882('0x0')]=_0x57f261[_0x5882('0x0')];this[_0x5882('0x1')]=_0x57f261[_0x5882('0x1')]||undefined;this[_0x5882('0x2')]=_0x57f261[_0x5882('0x2')];this[_0x5882('0x3')]=_0x57f261[_0x5882('0x2')]===_0x5882('0x4')?_0x5882('0x5'):_0x57f261[_0x5882('0x2')];this[_0x5882('0x6')]=_0x57f261[_0x5882('0x6')];this['countcongestionretry']=_0x57f261[_0x5882('0x7')];this[_0x5882('0x8')]=_0x57f261[_0x5882('0x8')];this[_0x5882('0x9')]=_0x57f261[_0x5882('0x6')]+_0x57f261[_0x5882('0x7')]+_0x57f261[_0x5882('0x8')]+_0x57f261[_0x5882('0xa')]+_0x57f261['countdropretry']+_0x57f261[_0x5882('0xb')]+_0x57f261[_0x5882('0xc')]+_0x57f261[_0x5882('0xd')];this[_0x5882('0xa')]=_0x57f261['countnosuchnumberretry'];this['countdropretry']=_0x57f261[_0x5882('0xe')];this[_0x5882('0xb')]=_0x57f261[_0x5882('0xb')];this[_0x5882('0xc')]=_0x57f261[_0x5882('0xc')];this[_0x5882('0xd')]=_0x57f261[_0x5882('0xd')];this[_0x5882('0x5')]=_0x57f261[_0x5882('0x5')];this['calleridname']=_0x57f261[_0x5882('0xf')];this[_0x5882('0x10')]=_0x57f261[_0x5882('0x11')];this[_0x5882('0x12')]=_0x57f261[_0x5882('0x12')];this[_0x5882('0x13')]=_0x57f261['responsetime'];this[_0x5882('0x14')]=_0x57f261[_0x5882('0x13')];this['ringtime']=utils[_0x5882('0x15')](_0x57f261['responsetime'],_0x57f261[_0x5882('0x12')]);this[_0x5882('0x16')]=0x0;this['talktime']=0x0;this[_0x5882('0x17')]=_0x57f261[_0x5882('0x17')];this[_0x5882('0x18')]=_0x57f261[_0x5882('0x18')];this[_0x5882('0x19')]=_0x57f261[_0x5882('0x19')];this[_0x5882('0x1a')]=_0x57f261[_0x5882('0x1a')];this['ContactId']=_0x57f261[_0x5882('0x1b')];this['ListId']=_0x57f261[_0x5882('0x1c')];this[_0x5882('0x1d')]=_0x57f261[_0x5882('0x1d')];this[_0x5882('0x1e')]=_0x57f261[_0x5882('0x1e')];this[_0x5882('0x1f')]=_0x57f261['CampaignId'];this['originatecalleridnum']=_0x57f261[_0x5882('0x20')]||'';this[_0x5882('0x21')]=_0x57f261[_0x5882('0x21')]||'';this['state']=_0x57f261[_0x5882('0x22')];this['statedesc']=_0x57f261[_0x5882('0x23')];}module[_0x5882('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index e6cddee..94425e4 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6f3=['holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6f3,0xff));var _0x3b6f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb6f3[_0x21a9d9];return _0x46adce;};'use strict';var utils=require(_0x3b6f('0x0'));function QueueCallerAbandon(_0x377cc9,_0x32be4f){this['scheduledat']=_0x377cc9[_0x3b6f('0x1')];this['type']=_0x377cc9[_0x3b6f('0x2')];this[_0x3b6f('0x3')]=_0x377cc9[_0x3b6f('0x2')]===_0x3b6f('0x4')?_0x3b6f('0x5'):_0x377cc9[_0x3b6f('0x2')];this[_0x3b6f('0x6')]=_0x377cc9[_0x3b6f('0x6')];this[_0x3b6f('0x7')]=_0x377cc9[_0x3b6f('0x7')];this[_0x3b6f('0x8')]=_0x377cc9['countnoanswerretry'];this[_0x3b6f('0x9')]=_0x377cc9[_0x3b6f('0x6')]+_0x377cc9[_0x3b6f('0x7')]+_0x377cc9['countnoanswerretry']+_0x377cc9[_0x3b6f('0xa')]+_0x377cc9[_0x3b6f('0xb')]+_0x377cc9[_0x3b6f('0xc')]+_0x377cc9[_0x3b6f('0xd')]+_0x377cc9[_0x3b6f('0xe')];this['countnosuchnumberretry']=_0x377cc9['countnosuchnumberretry'];this['countdropretry']=_0x377cc9['countdropretry'];this['countabandonedretry']=_0x377cc9[_0x3b6f('0xc')];this[_0x3b6f('0xd')]=_0x377cc9[_0x3b6f('0xd')];this[_0x3b6f('0xe')]=_0x377cc9[_0x3b6f('0xe')];this[_0x3b6f('0xf')]=_0x32be4f[_0x3b6f('0xf')];this[_0x3b6f('0x10')]=_0x377cc9[_0x3b6f('0x11')];this[_0x3b6f('0x12')]=_0x377cc9[_0x3b6f('0x13')];this['starttime']=_0x377cc9[_0x3b6f('0x14')];this[_0x3b6f('0x15')]=_0x377cc9['responsetime'];this['droptime']=_0x377cc9[_0x3b6f('0x16')];this[_0x3b6f('0x17')]=_0x377cc9[_0x3b6f('0x17')];this[_0x3b6f('0x18')]=this[_0x3b6f('0x16')];this[_0x3b6f('0x19')]=utils[_0x3b6f('0x1a')](_0x377cc9['responsetime'],_0x377cc9[_0x3b6f('0x14')]);this[_0x3b6f('0x1b')]=utils[_0x3b6f('0x1a')](this['droptime'],_0x377cc9[_0x3b6f('0x15')]);this[_0x3b6f('0x1c')]=0x0;this[_0x3b6f('0x5')]=_0x32be4f['queue'];this[_0x3b6f('0x1d')]=_0x32be4f[_0x3b6f('0x1e')];this[_0x3b6f('0x1f')]=_0x32be4f[_0x3b6f('0x1f')];this['callback']=_0x377cc9[_0x3b6f('0x20')];this[_0x3b6f('0x21')]=_0x377cc9[_0x3b6f('0x21')];this[_0x3b6f('0x22')]=_0x377cc9['callbackat'];this[_0x3b6f('0x23')]=_0x377cc9[_0x3b6f('0x23')];this[_0x3b6f('0x24')]=_0x377cc9[_0x3b6f('0x24')];this[_0x3b6f('0x25')]=_0x377cc9[_0x3b6f('0x25')];this[_0x3b6f('0x26')]=_0x377cc9[_0x3b6f('0x26')];this[_0x3b6f('0x27')]=_0x377cc9['VoiceQueueId'];this[_0x3b6f('0x28')]=_0x377cc9[_0x3b6f('0x28')];this[_0x3b6f('0x29')]=_0x377cc9['originatecalleridnum']||'';this[_0x3b6f('0x2a')]=_0x377cc9[_0x3b6f('0x2a')]||'';this[_0x3b6f('0x2b')]=_0x377cc9[_0x3b6f('0x2b')];this['state']=_0x377cc9[_0x3b6f('0x2c')];this['statedesc']=_0x377cc9[_0x3b6f('0x2d')];}module[_0x3b6f('0x2e')]=QueueCallerAbandon; \ No newline at end of file +var _0xf107=['talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','starttime','responsetime','droptime','dropreason','endtime','getSeconds'];(function(_0x20e718,_0x24a497){var _0x486d38=function(_0x5aa3d4){while(--_0x5aa3d4){_0x20e718['push'](_0x20e718['shift']());}};_0x486d38(++_0x24a497);}(_0xf107,0xf5));var _0x7f10=function(_0x2da634,_0x545707){_0x2da634=_0x2da634-0x0;var _0x18855f=_0xf107[_0x2da634];return _0x18855f;};'use strict';var utils=require(_0x7f10('0x0'));function QueueCallerAbandon(_0x5312d5,_0x97f535){this[_0x7f10('0x1')]=_0x5312d5['scheduledat'];this[_0x7f10('0x2')]=_0x5312d5[_0x7f10('0x2')];this[_0x7f10('0x3')]=_0x5312d5['type']===_0x7f10('0x4')?'queue':_0x5312d5[_0x7f10('0x2')];this[_0x7f10('0x5')]=_0x5312d5[_0x7f10('0x5')];this[_0x7f10('0x6')]=_0x5312d5['countcongestionretry'];this[_0x7f10('0x7')]=_0x5312d5['countnoanswerretry'];this['countglobal']=_0x5312d5[_0x7f10('0x5')]+_0x5312d5[_0x7f10('0x6')]+_0x5312d5[_0x7f10('0x7')]+_0x5312d5['countnosuchnumberretry']+_0x5312d5[_0x7f10('0x8')]+_0x5312d5[_0x7f10('0x9')]+_0x5312d5[_0x7f10('0xa')]+_0x5312d5[_0x7f10('0xb')];this[_0x7f10('0xc')]=_0x5312d5[_0x7f10('0xc')];this[_0x7f10('0x8')]=_0x5312d5[_0x7f10('0x8')];this[_0x7f10('0x9')]=_0x5312d5[_0x7f10('0x9')];this[_0x7f10('0xa')]=_0x5312d5['countmachineretry'];this[_0x7f10('0xb')]=_0x5312d5[_0x7f10('0xb')];this['uniqueid']=_0x97f535[_0x7f10('0xd')];this[_0x7f10('0xe')]=_0x5312d5['name'];this['calleridnum']=_0x5312d5['number'];this[_0x7f10('0xf')]=_0x5312d5[_0x7f10('0xf')];this['responsetime']=_0x5312d5[_0x7f10('0x10')];this[_0x7f10('0x11')]=_0x5312d5[_0x7f10('0x11')];this[_0x7f10('0x12')]=_0x5312d5['dropreason'];this[_0x7f10('0x13')]=this['droptime'];this['ringtime']=utils['getSeconds'](_0x5312d5[_0x7f10('0x10')],_0x5312d5['starttime']);this['holdtime']=utils[_0x7f10('0x14')](this['droptime'],_0x5312d5[_0x7f10('0x10')]);this[_0x7f10('0x15')]=0x0;this[_0x7f10('0x16')]=_0x97f535[_0x7f10('0x16')];this[_0x7f10('0x17')]=_0x97f535['connectedlinename'];this['reason']=_0x97f535[_0x7f10('0x18')];this[_0x7f10('0x19')]=_0x5312d5[_0x7f10('0x19')];this[_0x7f10('0x1a')]=_0x5312d5[_0x7f10('0x1a')];this[_0x7f10('0x1b')]=_0x5312d5[_0x7f10('0x1b')];this[_0x7f10('0x1c')]=_0x5312d5[_0x7f10('0x1c')];this[_0x7f10('0x1d')]=_0x5312d5['ContactId'];this[_0x7f10('0x1e')]=_0x5312d5[_0x7f10('0x1e')];this[_0x7f10('0x1f')]=_0x5312d5[_0x7f10('0x1f')];this[_0x7f10('0x20')]=_0x5312d5[_0x7f10('0x20')];this[_0x7f10('0x21')]=_0x5312d5[_0x7f10('0x21')];this[_0x7f10('0x22')]=_0x5312d5[_0x7f10('0x22')]||'';this['originatecalleridname']=_0x5312d5[_0x7f10('0x23')]||'';this['agiafterat']=_0x5312d5['agiafterat'];this[_0x7f10('0x24')]=_0x5312d5[_0x7f10('0x24')];this['statedesc']=_0x5312d5['statedesc'];}module[_0x7f10('0x25')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 0a7299e..62d3cde 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf072=['dialer','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','[countReScheduled]','countReScheduled','[rescheduleContact]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger'];(function(_0x3df41c,_0x2c4f5c){var _0x56cc7b=function(_0xcba7af){while(--_0xcba7af){_0x3df41c['push'](_0x3df41c['shift']());}};_0x56cc7b(++_0x2c4f5c);}(_0xf072,0x1cf));var _0x2f07=function(_0x20e97a,_0x58ce8c){_0x20e97a=_0x20e97a-0x0;var _0x34ae8b=_0xf072[_0x20e97a];return _0x34ae8b;};'use strict';var util=require(_0x2f07('0x0'));var logger=require(_0x2f07('0x1'))(_0x2f07('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x2f07('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x2f07('0x4'));function inspectError(_0x432696){return util[_0x2f07('0x5')](_0x432696,{'showHidden':![],'depth':null});}function getContactDialer(_0x48d7b6,_0x1d5a33,_0x14d6e6){return cmHopper[_0x2f07('0x6')](_0x48d7b6['id'],_0x1d5a33,_0x14d6e6,_0x48d7b6[_0x2f07('0x7')])[_0x2f07('0x8')](function(_0xf73d1a){_0x48d7b6[_0x2f07('0x9')]=0x0;logger[_0x2f07('0xa')](_0x2f07('0xb'),inspectError(_0xf73d1a));});}exports[_0x2f07('0x6')]=getContactDialer;function getContactDialerIvr(_0x30c638,_0x2e372c){return cmHopper[_0x2f07('0xc')](_0x30c638['id'],_0x2e372c,_0x30c638[_0x2f07('0x7')])[_0x2f07('0x8')](function(_0x564260){_0x30c638[_0x2f07('0x9')]=0x0;logger[_0x2f07('0xa')](_0x2f07('0xd'),inspectError(_0x564260));});}exports[_0x2f07('0xc')]=getContactDialerIvr;function countReScheduled(_0x496d87){return cmHopper['countReScheduled'](_0x496d87)[_0x2f07('0x8')](function(_0x1e291d){logger['error'](_0x2f07('0xe'),inspectError(_0x1e291d));});}exports[_0x2f07('0xf')]=countReScheduled;function rescheduleContact(_0x26edfa){return cmHopper['rescheduleContact'](_0x26edfa)[_0x2f07('0x8')](function(_0x443fdc){logger[_0x2f07('0xa')](_0x2f07('0x10'),inspectError(_0x443fdc));});}exports[_0x2f07('0x11')]=rescheduleContact;function unlockContact(_0x309908,_0x5d32d6,_0x8475cf){return cmHopper['unlockContact'](_0x309908,_0x5d32d6,_0x8475cf)[_0x2f07('0x8')](function(_0xe8cf4d){logger[_0x2f07('0xa')](_0x2f07('0x12'),inspectError(_0xe8cf4d));});}exports[_0x2f07('0x13')]=unlockContact;function moveContactManagedDialer(_0x46c9b4){return cmHopper[_0x2f07('0x14')](_0x46c9b4)[_0x2f07('0x8')](function(_0x55bd60){logger[_0x2f07('0xa')]('[moveContactManagedDialer]',inspectError(_0x55bd60));});}exports[_0x2f07('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x2df6ed){return cmHopperBlack[_0x2f07('0x15')](_0x2df6ed)[_0x2f07('0x8')](function(_0x2ef47d){logger['error'](_0x2f07('0x16'),inspectError(_0x2ef47d));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x5db56b){return cmHopperBlack['checkIsBlackListIvr'](_0x5db56b)[_0x2f07('0x8')](function(_0x51c285){logger[_0x2f07('0xa')]('[checkIsBlackListIvr]',inspectError(_0x51c285));});}exports[_0x2f07('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2c495f,_0x12a2a5,_0x307888){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2c495f,_0x12a2a5,_0x307888)[_0x2f07('0x8')](function(_0x428d8c){logger[_0x2f07('0xa')]('[verifyAdditionalPhone]',inspectError(_0x428d8c));});}exports[_0x2f07('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x113916,_0x522006,_0x1dcedc){return cmHopperAdditionalPhone[_0x2f07('0x19')](_0x113916,_0x522006,_0x1dcedc)['catch'](function(_0x427e13){logger['error'](_0x2f07('0x1a'),inspectError(_0x427e13));});}exports[_0x2f07('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x27bd72){return cmHopperHistory[_0x2f07('0x1b')](_0x27bd72)[_0x2f07('0x8')](function(_0x139ea8){logger[_0x2f07('0xa')](_0x2f07('0x1c'),inspectError(_0x139ea8));});}exports[_0x2f07('0x1b')]=avgHandleTime;function createHistory(_0x468cd8){return cmHopperHistory[_0x2f07('0x1d')](_0x468cd8)[_0x2f07('0x8')](function(_0x4c607a){logger[_0x2f07('0xa')](_0x2f07('0x1e'),inspectError(_0x4c607a));});}exports[_0x2f07('0x1d')]=createHistory; \ No newline at end of file +var _0x9a5a=['../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[avgHandleTime]','createHistory','util'];(function(_0x4631eb,_0x55649e){var _0x562eca=function(_0x25a436){while(--_0x25a436){_0x4631eb['push'](_0x4631eb['shift']());}};_0x562eca(++_0x55649e);}(_0x9a5a,0x194));var _0xa9a5=function(_0x4d36d9,_0x3cf6d5){_0x4d36d9=_0x4d36d9-0x0;var _0x17f4c2=_0x9a5a[_0x4d36d9];return _0x17f4c2;};'use strict';var util=require(_0xa9a5('0x0'));var logger=require(_0xa9a5('0x1'))(_0xa9a5('0x2'));var cmHopper=require(_0xa9a5('0x3'));var cmHopperAdditionalPhone=require(_0xa9a5('0x4'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xa9a5('0x5'));function inspectError(_0x1e6fb1){return util[_0xa9a5('0x6')](_0x1e6fb1,{'showHidden':![],'depth':null});}function getContactDialer(_0x1080a9,_0x31e823,_0x1ae623){return cmHopper['getContactDialer'](_0x1080a9['id'],_0x31e823,_0x1ae623,_0x1080a9[_0xa9a5('0x7')])[_0xa9a5('0x8')](function(_0x20bbe8){_0x1080a9[_0xa9a5('0x9')]=0x0;logger[_0xa9a5('0xa')]('[getContactDialer]',inspectError(_0x20bbe8));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x57d90b,_0xc95120){return cmHopper[_0xa9a5('0xb')](_0x57d90b['id'],_0xc95120,_0x57d90b[_0xa9a5('0x7')])[_0xa9a5('0x8')](function(_0x158317){_0x57d90b[_0xa9a5('0x9')]=0x0;logger[_0xa9a5('0xa')]('[getContactDialerIvr]',inspectError(_0x158317));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x56f162){return cmHopper[_0xa9a5('0xc')](_0x56f162)[_0xa9a5('0x8')](function(_0x3a5084){logger[_0xa9a5('0xa')](_0xa9a5('0xd'),inspectError(_0x3a5084));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0xe6a34b){return cmHopper[_0xa9a5('0xe')](_0xe6a34b)[_0xa9a5('0x8')](function(_0x453b49){logger[_0xa9a5('0xa')](_0xa9a5('0xf'),inspectError(_0x453b49));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x30a479,_0x25c458,_0x476843){return cmHopper[_0xa9a5('0x10')](_0x30a479,_0x25c458,_0x476843)['catch'](function(_0x3353ca){logger[_0xa9a5('0xa')](_0xa9a5('0x11'),inspectError(_0x3353ca));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x3c505b){return cmHopper['moveContactManagedDialer'](_0x3c505b)['catch'](function(_0x2fb6bc){logger[_0xa9a5('0xa')]('[moveContactManagedDialer]',inspectError(_0x2fb6bc));});}exports[_0xa9a5('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x5d05d5){return cmHopperBlack[_0xa9a5('0x13')](_0x5d05d5)[_0xa9a5('0x8')](function(_0x3bd8e9){logger[_0xa9a5('0xa')](_0xa9a5('0x14'),inspectError(_0x3bd8e9));});}exports[_0xa9a5('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x21ea08){return cmHopperBlack[_0xa9a5('0x15')](_0x21ea08)[_0xa9a5('0x8')](function(_0x19d619){logger[_0xa9a5('0xa')](_0xa9a5('0x16'),inspectError(_0x19d619));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5c8314,_0x59b37c,_0x43017d){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x5c8314,_0x59b37c,_0x43017d)[_0xa9a5('0x8')](function(_0x198821){logger[_0xa9a5('0xa')]('[verifyAdditionalPhone]',inspectError(_0x198821));});}exports[_0xa9a5('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0xb37bcb,_0x341723,_0x4f1076){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xb37bcb,_0x341723,_0x4f1076)[_0xa9a5('0x8')](function(_0x19ccbd){logger[_0xa9a5('0xa')]('[swapAdditionalPhone]',inspectError(_0x19ccbd));});}exports[_0xa9a5('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x45afca){return cmHopperHistory['avgHandleTime'](_0x45afca)[_0xa9a5('0x8')](function(_0x474671){logger['error'](_0xa9a5('0x19'),inspectError(_0x474671));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x11366f){return cmHopperHistory['createHistory'](_0x11366f)[_0xa9a5('0x8')](function(_0x3b271d){logger['error']('[createHistory]',inspectError(_0x3b271d));});}exports[_0xa9a5('0x1a')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index e99b29a..1d2de9e 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9582=['createdAt','tags','updatedAt','undefined','XMD-','toString','substring','toUpperCase','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','message','available','loggedIn','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','Intervals','NULL_INTERVAL','isEmpty','Interval','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','format','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate'];(function(_0x2b4f28,_0x5bb87e){var _0x417534=function(_0x576345){while(--_0x576345){_0x2b4f28['push'](_0x2b4f28['shift']());}};_0x417534(++_0x5bb87e);}(_0x9582,0x1ac));var _0x2958=function(_0x45b069,_0x5e02fb){_0x45b069=_0x45b069-0x0;var _0x2d2f3d=_0x9582[_0x45b069];return _0x2d2f3d;};'use strict';var _=require(_0x2958('0x0'));var moment=require(_0x2958('0x1'));var util=require(_0x2958('0x2'));var logger=require(_0x2958('0x3'))('dialer');var timezones=require(_0x2958('0x4'))[_0x2958('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x2958('0x6'),'BLACKLIST':_0x2958('0x7'),'CONTACTS_RESCHEDULED':_0x2958('0x8'),'DEACTIVATED':_0x2958('0x9'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x2958('0xa'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x2958('0xb'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x2958('0xc'),'OVERTIME_INTERVAL':_0x2958('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x2958('0xe'),'QUEUE_RECALL':_0x2958('0xf'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x2958('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2eb179){return _0x2eb179['dialMethod']===_0x2958('0x11');}exports[_0x2958('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x38180a){return _0x38180a[_0x2958('0x13')]===_0x2958('0x14');}exports[_0x2958('0x15')]=isIVRCampaign;function isOutboundQueue(_0x4129a0){return _0x4129a0[_0x2958('0x13')]===_0x2958('0x16');}exports[_0x2958('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x3ec998){return _0x3ec998[_0x2958('0x18')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x5a5fdb){return _0x5a5fdb[_0x2958('0x19')];}exports[_0x2958('0x1a')]=isIVRCampaignActive;function getSeconds(_0xa497e2,_0x236010){var _0x5daa87=moment(_0xa497e2)['milliseconds'](0x0);var _0x1a4cc0=moment(_0x236010)[_0x2958('0x1b')](0x0);return _0x5daa87[_0x2958('0x1c')](_0x1a4cc0,_0x2958('0x1d'));}exports[_0x2958('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x17724a,_0x164d27){var _0x11a2e1=![];var _0x29b20a=_0x17724a[_0x2958('0x1f')]!==_0x164d27[_0x2958('0x1f')]||_0x17724a[_0x2958('0x18')]!==_0x164d27[_0x2958('0x18')]||_0x17724a[_0x2958('0x20')]!==_0x164d27[_0x2958('0x20')];var _0x5477f9=_0x17724a[_0x2958('0x21')]!==_0x164d27['available']||_0x17724a[_0x2958('0x22')]!==_0x164d27[_0x2958('0x22')]||_0x17724a['loggedInDb']!==_0x164d27['loggedInDb']||_0x17724a['paused']!==_0x164d27[_0x2958('0x23')]||_0x17724a[_0x2958('0x24')]!==_0x164d27['talking']||_0x17724a[_0x2958('0x25')]!==_0x164d27['pTalking']||_0x17724a['waiting']!==_0x164d27[_0x2958('0x26')]||_0x17724a[_0x2958('0x27')]!==_0x164d27[_0x2958('0x27')]||_0x17724a[_0x2958('0x28')]!==_0x164d27[_0x2958('0x28')];if(_0x17724a[_0x2958('0x29')]&&_0x164d27['Trunk']){_0x11a2e1=_0x17724a[_0x2958('0x29')][_0x2958('0x2a')]!==_0x164d27[_0x2958('0x29')]['name']||_0x17724a[_0x2958('0x29')][_0x2958('0x19')]!==_0x164d27[_0x2958('0x29')][_0x2958('0x19')];}return _0x29b20a||_0x5477f9||_0x11a2e1;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x17640c){var _0x321ab5=null;var _0x4c83cf=_0x17640c[_0x2958('0x2b')];if(_[_0x2958('0x2c')](_0x17640c['dialGlobalInterval'])||_[_0x2958('0x2c')](_0x17640c['Interval'])||_[_0x2958('0x2c')](_0x17640c['Interval'][_0x2958('0x2d')])){_0x321ab5=CAMPAIGN_STATUS[_0x2958('0x2e')];}else if(_[_0x2958('0x2f')](_0x17640c['dialGlobalInterval'])||_['isEmpty'](_0x17640c[_0x2958('0x30')][_0x2958('0x2d')])){_0x321ab5=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x4c83cf&&!timezones[_0x4c83cf]){_0x321ab5=CAMPAIGN_STATUS[_0x2958('0x31')];}return _0x321ab5;}function checkAnyValidTrunk(_0x424a75,_0x176f49){var _0x3a3d0c=null;var _0x2dda1f=_0x2958('0x32');var _0x3c433f=['reachable',_0x2958('0x33')];var _0x32c32d=!![];if(_0x424a75[_0x2958('0x29')]&&_0x424a75[_0x2958('0x29')][_0x2958('0x19')]){_0x2dda1f+=_0x424a75['Trunk'][_0x2958('0x2a')];_0x3a3d0c=_0x176f49[_0x2dda1f];_0x32c32d=_0x3c433f[_0x2958('0x34')](_0x3a3d0c['status']);}else if(_0x424a75[_0x2958('0x35')]&&_0x424a75[_0x2958('0x35')][_0x2958('0x19')]){_0x2dda1f+=_0x424a75[_0x2958('0x35')]['name'];_0x3a3d0c=_0x176f49[_0x2dda1f];_0x32c32d=_0x3c433f['includes'](_0x3a3d0c[_0x2958('0x36')]);}return _0x32c32d;}function getQueueCampaignStatusMessage(_0x3b9873,_0x138d78){var _0x571fb7=CAMPAIGN_STATUS[_0x2958('0x6')];var _0x5a2ff7=isPreviewCampaign(_0x3b9873);if(!isQueueCampaignActive(_0x3b9873)){if(_0x5a2ff7){_0x571fb7=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x3b9873[_0x2958('0x28')]===0x0&&_0x3b9873[_0x2958('0x24')]===0x0&&_0x3b9873[_0x2958('0x26')]===0x0&&(_0x3b9873[_0x2958('0x25')]||0x0)===0x0){_0x571fb7=CAMPAIGN_STATUS[_0x2958('0x37')];}else{_0x571fb7=CAMPAIGN_STATUS[_0x2958('0x38')];}}}else if(_0x3b9873[_0x2958('0x22')]===0x0){_0x571fb7=CAMPAIGN_STATUS[_0x2958('0x39')];}else if(!checkAnyValidTrunk(_0x3b9873,_0x138d78)){_0x571fb7=CAMPAIGN_STATUS[_0x2958('0x3a')];}else if(!isPreviewCampaign(_0x3b9873)){var _0x140ece=checkAnyValidQueueCampaignInterval(_0x3b9873);if(_0x140ece){_0x571fb7=_0x140ece;}}return _0x571fb7;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x27e0b0){var _0x44c331=CAMPAIGN_STATUS[_0x2958('0x38')];if(_0x27e0b0['originated']===0x0&&_0x27e0b0['talking']===0x0&&_0x27e0b0[_0x2958('0x26')]===0x0&&(_0x27e0b0['pTalking']||0x0)===0x0){_0x44c331=CAMPAIGN_STATUS[_0x2958('0x37')];}return _0x44c331;}exports[_0x2958('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x5d35e5){var _0xfff81a=_0x5d35e5['match'](/"(.*?)"/);return _0xfff81a?_0xfff81a[0x1]:_0x5d35e5;}exports[_0x2958('0x3c')]=extractCalleridName;function getCallerId(_0x488e55,_0x22e631,_0x3375bf){if(!_[_0x2958('0x3d')](_0x3375bf)&&typeof _0x3375bf===_0x2958('0x3e')&&!_[_0x2958('0x2f')](_0x3375bf)){if(!_[_0x2958('0x3d')](_0x22e631)&&typeof _0x22e631===_0x2958('0x3e')&&!_[_0x2958('0x2f')](_0x22e631)){return util['format'](_0x2958('0x3f'),_0x22e631,_0x3375bf);}return util[_0x2958('0x40')](_0x2958('0x3f'),_0x3375bf,_0x3375bf);}if(!_['isUndefined'](_0x488e55)&&typeof _0x488e55==='string'&&!_[_0x2958('0x2f')](_0x488e55)){return _0x488e55;}return'\x22\x22\x20<>';}exports[_0x2958('0x41')]=getCallerId;function getCallerIdRandom(_0x52684e,_0x1190b0){var _0x44d8ab;var _0xbd91e6;var _0x45b477;if(_0x1190b0<=0x0){_0x1190b0=0x1;}_0x44d8ab=new RegExp(_0x2958('0x42')+_0x1190b0+'}$');_0xbd91e6=Math[_0x2958('0x43')](0xa,_0x1190b0-0x1);_0x45b477=Math[_0x2958('0x43')](0xa,_0x1190b0)-0x1;return util[_0x2958('0x40')]('%s',_[_0x2958('0x44')](_0x52684e,_0x44d8ab,_[_0x2958('0x45')](_0xbd91e6,_0x45b477)['toString']()));}exports[_0x2958('0x46')]=getCallerIdRandom;function decrementOriginate(_0x53a165,_0x2775bb){if(_0x53a165[_0x2958('0x28')]&&_0x53a165[_0x2958('0x28')]>0x0){_0x53a165[_0x2958('0x28')]-=0x1;}else{logger[_0x2958('0x47')]('[decrementOriginate]\x20queue\x20originate\x20value',_0x2775bb);}}exports[_0x2958('0x48')]=decrementOriginate;function checkContactEmpty(_0x4dad7b){return _0x4dad7b&&_0x4dad7b['length']>0x0;}exports[_0x2958('0x49')]=checkContactEmpty;function erlangb(_0x26c1a8,_0x9a7bd3){if(_0x9a7bd3===0x0){return 0x0;}var _0x130efa=0x1;for(var _0x17feeb=0x1;_0x17feeb<=_0x9a7bd3;_0x17feeb+=0x1){_0x130efa=0x1+_0x130efa*_0x17feeb/_0x26c1a8;}return 0x1/_0x130efa;}exports[_0x2958('0x4a')]=erlangb;function checkContactLowerLimitOriginate(_0x5d31e9,_0x51abac,_0xcce0f2){if(_0x51abac>_0xcce0f2){for(var _0x536db5=0x0;_0x536db5<_0x51abac-_0xcce0f2;_0x536db5+=0x1){decrementOriginate(_0x5d31e9,'[checkContactLowerLimitOriginate]\x20');}}}exports[_0x2958('0x4b')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x16d8d3){var _0xdb3f8a={};var _0x1880bd=['id',_0x2958('0x4c'),_0x2958('0x4d'),_0x2958('0x4e')];const _0x8a8731=0xfa;if(_0x16d8d3){for(var _0x961cb5 in _0x16d8d3){if(typeof _0x16d8d3[_0x961cb5]!==_0x2958('0x4f')){if(!_['isNil'](_0x16d8d3[_0x961cb5])&&!_0x1880bd[_0x2958('0x34')](_0x961cb5)){if(_0x961cb5==='description'&&_0x16d8d3[_0x961cb5]['length']>_0x8a8731){_0xdb3f8a[_0x2958('0x50')+_0x961cb5['toUpperCase']()]=_0x16d8d3[_0x961cb5][_0x2958('0x51')]()[_0x2958('0x52')](0x0,_0x8a8731);}else{_0xdb3f8a[_0x2958('0x50')+_0x961cb5[_0x2958('0x53')]()]=_0x16d8d3[_0x961cb5];}}}}}return _0xdb3f8a;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x1f06=['unmonitored','name','includes','status','TrunkBackup','ACTIVE','INACTIVE','waiting','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22\x22\x20<>','getCallerId','\x5cw{0,','replace','random','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','createdAt','tags','updatedAt','description','toUpperCase','toString','substring','XMD-','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','inUse','originated','Trunk','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','dialGlobalInterval','SIP/','reachable'];(function(_0x3f3b53,_0x3d035f){var _0x3fa180=function(_0x194ff3){while(--_0x194ff3){_0x3f3b53['push'](_0x3f3b53['shift']());}};_0x3fa180(++_0x3d035f);}(_0x1f06,0x187));var _0x61f0=function(_0x561b49,_0x391670){_0x561b49=_0x561b49-0x0;var _0x353509=_0x1f06[_0x561b49];return _0x353509;};'use strict';var _=require(_0x61f0('0x0'));var moment=require(_0x61f0('0x1'));var util=require(_0x61f0('0x2'));var logger=require(_0x61f0('0x3'))(_0x61f0('0x4'));var timezones=require('../../../../config/environment/shared')['timezones'];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x61f0('0x5'),'CONTACTS_RESCHEDULED':_0x61f0('0x6'),'DEACTIVATED':_0x61f0('0x7'),'DISACTIVED':_0x61f0('0x8'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x61f0('0x9'),'NO_AGENTS_LOGGED':_0x61f0('0xa'),'NO_AVAILABLE_CONTACTS':_0x61f0('0xb'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x61f0('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0x61f0('0xd'),'QUEUE_RECALL':_0x61f0('0xe'),'RECALL_TIMEOUT':_0x61f0('0xf'),'RUNNING':_0x61f0('0x10'),'UNKNOWN_TIMEZONE':_0x61f0('0x11'),'UNREACHABLE_TRUNK':_0x61f0('0x12')};exports[_0x61f0('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x581520){return _0x581520[_0x61f0('0x14')]===_0x61f0('0x15');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x2538d4){return _0x2538d4[_0x61f0('0x16')]===_0x61f0('0x17');}exports[_0x61f0('0x18')]=isIVRCampaign;function isOutboundQueue(_0x2c2665){return _0x2c2665['type']===_0x61f0('0x19');}exports[_0x61f0('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x38489c){return _0x38489c[_0x61f0('0x1b')];}exports[_0x61f0('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x5730af){return _0x5730af[_0x61f0('0x1d')];}exports[_0x61f0('0x1e')]=isIVRCampaignActive;function getSeconds(_0x1f21a8,_0x3a2fb4){var _0x4108db=moment(_0x1f21a8)['milliseconds'](0x0);var _0x3ad4ee=moment(_0x3a2fb4)[_0x61f0('0x1f')](0x0);return _0x4108db[_0x61f0('0x20')](_0x3ad4ee,'seconds');}exports[_0x61f0('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x2d1983,_0x15df5e){var _0x174b97=![];var _0x116988=_0x2d1983[_0x61f0('0x14')]!==_0x15df5e[_0x61f0('0x14')]||_0x2d1983[_0x61f0('0x1b')]!==_0x15df5e[_0x61f0('0x1b')]||_0x2d1983[_0x61f0('0x22')]!==_0x15df5e['message'];var _0x4a735a=_0x2d1983[_0x61f0('0x23')]!==_0x15df5e['available']||_0x2d1983[_0x61f0('0x24')]!==_0x15df5e['loggedIn']||_0x2d1983['loggedInDb']!==_0x15df5e[_0x61f0('0x25')]||_0x2d1983[_0x61f0('0x26')]!==_0x15df5e[_0x61f0('0x26')]||_0x2d1983[_0x61f0('0x27')]!==_0x15df5e[_0x61f0('0x27')]||_0x2d1983[_0x61f0('0x28')]!==_0x15df5e[_0x61f0('0x28')]||_0x2d1983['waiting']!==_0x15df5e['waiting']||_0x2d1983[_0x61f0('0x29')]!==_0x15df5e[_0x61f0('0x29')]||_0x2d1983[_0x61f0('0x2a')]!==_0x15df5e[_0x61f0('0x2a')];if(_0x2d1983[_0x61f0('0x2b')]&&_0x15df5e['Trunk']){_0x174b97=_0x2d1983[_0x61f0('0x2b')]['name']!==_0x15df5e[_0x61f0('0x2b')]['name']||_0x2d1983[_0x61f0('0x2b')][_0x61f0('0x1d')]!==_0x15df5e[_0x61f0('0x2b')][_0x61f0('0x1d')];}return _0x116988||_0x4a735a||_0x174b97;}exports[_0x61f0('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x67c514){var _0x17c4c9=null;var _0xd3da53=_0x67c514[_0x61f0('0x2d')];if(_['isNil'](_0x67c514['dialGlobalInterval'])||_[_0x61f0('0x2e')](_0x67c514[_0x61f0('0x2f')])||_[_0x61f0('0x2e')](_0x67c514['Interval'][_0x61f0('0x30')])){_0x17c4c9=CAMPAIGN_STATUS[_0x61f0('0x31')];}else if(_[_0x61f0('0x32')](_0x67c514[_0x61f0('0x33')])||_[_0x61f0('0x32')](_0x67c514['Interval'][_0x61f0('0x30')])){_0x17c4c9=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0xd3da53&&!timezones[_0xd3da53]){_0x17c4c9=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x17c4c9;}function checkAnyValidTrunk(_0x1b7b24,_0x4655f4){var _0x1074f8=null;var _0x12e40d=_0x61f0('0x34');var _0x43a683=[_0x61f0('0x35'),_0x61f0('0x36')];var _0x2317f6=!![];if(_0x1b7b24[_0x61f0('0x2b')]&&_0x1b7b24[_0x61f0('0x2b')][_0x61f0('0x1d')]){_0x12e40d+=_0x1b7b24[_0x61f0('0x2b')][_0x61f0('0x37')];_0x1074f8=_0x4655f4[_0x12e40d];_0x2317f6=_0x43a683[_0x61f0('0x38')](_0x1074f8[_0x61f0('0x39')]);}else if(_0x1b7b24['TrunkBackup']&&_0x1b7b24[_0x61f0('0x3a')][_0x61f0('0x1d')]){_0x12e40d+=_0x1b7b24[_0x61f0('0x3a')][_0x61f0('0x37')];_0x1074f8=_0x4655f4[_0x12e40d];_0x2317f6=_0x43a683['includes'](_0x1074f8[_0x61f0('0x39')]);}return _0x2317f6;}function getQueueCampaignStatusMessage(_0x328316,_0x4a8c6e){var _0x4cafa4=CAMPAIGN_STATUS[_0x61f0('0x3b')];var _0x1102fe=isPreviewCampaign(_0x328316);if(!isQueueCampaignActive(_0x328316)){if(_0x1102fe){_0x4cafa4=CAMPAIGN_STATUS[_0x61f0('0x3c')];}else{if(_0x328316[_0x61f0('0x2a')]===0x0&&_0x328316['talking']===0x0&&_0x328316[_0x61f0('0x3d')]===0x0&&(_0x328316['pTalking']||0x0)===0x0){_0x4cafa4=CAMPAIGN_STATUS[_0x61f0('0x3c')];}else{_0x4cafa4=CAMPAIGN_STATUS[_0x61f0('0x3e')];}}}else if(_0x328316['loggedIn']===0x0){_0x4cafa4=CAMPAIGN_STATUS[_0x61f0('0x3f')];}else if(!checkAnyValidTrunk(_0x328316,_0x4a8c6e)){_0x4cafa4=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x328316)){var _0x120826=checkAnyValidQueueCampaignInterval(_0x328316);if(_0x120826){_0x4cafa4=_0x120826;}}return _0x4cafa4;}exports[_0x61f0('0x40')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2a80e2){var _0x562a90=CAMPAIGN_STATUS[_0x61f0('0x3e')];if(_0x2a80e2[_0x61f0('0x2a')]===0x0&&_0x2a80e2['talking']===0x0&&_0x2a80e2[_0x61f0('0x3d')]===0x0&&(_0x2a80e2['pTalking']||0x0)===0x0){_0x562a90=CAMPAIGN_STATUS[_0x61f0('0x3c')];}return _0x562a90;}exports[_0x61f0('0x41')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x49de91){var _0x9955d5=_0x49de91[_0x61f0('0x42')](/"(.*?)"/);return _0x9955d5?_0x9955d5[0x1]:_0x49de91;}exports[_0x61f0('0x43')]=extractCalleridName;function getCallerId(_0x2173ff,_0x3a020f,_0x5baa95){if(!_[_0x61f0('0x44')](_0x5baa95)&&typeof _0x5baa95===_0x61f0('0x45')&&!_['isEmpty'](_0x5baa95)){if(!_[_0x61f0('0x44')](_0x3a020f)&&typeof _0x3a020f==='string'&&!_[_0x61f0('0x32')](_0x3a020f)){return util[_0x61f0('0x46')]('\x22%s\x22\x20<%s>',_0x3a020f,_0x5baa95);}return util[_0x61f0('0x46')]('\x22%s\x22\x20<%s>',_0x5baa95,_0x5baa95);}if(!_['isUndefined'](_0x2173ff)&&typeof _0x2173ff===_0x61f0('0x45')&&!_['isEmpty'](_0x2173ff)){return _0x2173ff;}return _0x61f0('0x47');}exports[_0x61f0('0x48')]=getCallerId;function getCallerIdRandom(_0x370b7c,_0x2b4c2e){var _0xb07e2;var _0x27eab4;var _0x588288;if(_0x2b4c2e<=0x0){_0x2b4c2e=0x1;}_0xb07e2=new RegExp(_0x61f0('0x49')+_0x2b4c2e+'}$');_0x27eab4=Math['pow'](0xa,_0x2b4c2e-0x1);_0x588288=Math['pow'](0xa,_0x2b4c2e)-0x1;return util[_0x61f0('0x46')]('%s',_[_0x61f0('0x4a')](_0x370b7c,_0xb07e2,_[_0x61f0('0x4b')](_0x27eab4,_0x588288)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x58f04a,_0x1ef1ef){if(_0x58f04a['originated']&&_0x58f04a[_0x61f0('0x2a')]>0x0){_0x58f04a[_0x61f0('0x2a')]-=0x1;}else{logger['error']('[decrementOriginate]\x20queue\x20originate\x20value',_0x1ef1ef);}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x370873){return _0x370873&&_0x370873[_0x61f0('0x4c')]>0x0;}exports[_0x61f0('0x4d')]=checkContactEmpty;function erlangb(_0x1edf73,_0x1af7ff){if(_0x1af7ff===0x0){return 0x0;}var _0x2b8ca2=0x1;for(var _0x7b62bf=0x1;_0x7b62bf<=_0x1af7ff;_0x7b62bf+=0x1){_0x2b8ca2=0x1+_0x2b8ca2*_0x7b62bf/_0x1edf73;}return 0x1/_0x2b8ca2;}exports[_0x61f0('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x148a9b,_0x81f7a2,_0x1cf7dd){if(_0x81f7a2>_0x1cf7dd){for(var _0xc80a35=0x0;_0xc80a35<_0x81f7a2-_0x1cf7dd;_0xc80a35+=0x1){decrementOriginate(_0x148a9b,_0x61f0('0x4f'));}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x7dcf78){var _0x5d085b={};var _0x226fd2=['id',_0x61f0('0x50'),_0x61f0('0x51'),_0x61f0('0x52')];const _0x32adde=0xfa;if(_0x7dcf78){for(var _0x1a501b in _0x7dcf78){if(typeof _0x7dcf78[_0x1a501b]!=='undefined'){if(!_['isNil'](_0x7dcf78[_0x1a501b])&&!_0x226fd2[_0x61f0('0x38')](_0x1a501b)){if(_0x1a501b===_0x61f0('0x53')&&_0x7dcf78[_0x1a501b][_0x61f0('0x4c')]>_0x32adde){_0x5d085b['XMD-'+_0x1a501b[_0x61f0('0x54')]()]=_0x7dcf78[_0x1a501b][_0x61f0('0x55')]()[_0x61f0('0x56')](0x0,_0x32adde);}else{_0x5d085b[_0x61f0('0x57')+_0x1a501b[_0x61f0('0x54')]()]=_0x7dcf78[_0x1a501b];}}}}}return _0x5d085b;}exports[_0x61f0('0x58')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 5ec74b9..ed4fb68 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(_0x35bf9d,_0x266607){var _0x32c380=function(_0x1e3db5){while(--_0x1e3db5){_0x35bf9d['push'](_0x35bf9d['shift']());}};_0x32c380(++_0x266607);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x45d233,_0x37eb5b){var _0x352de3=function(_0x1edc91){while(--_0x1edc91){_0x45d233['push'](_0x45d233['shift']());}};_0x352de3(++_0x37eb5b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 05becda..70a6a63 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 _0xadaf=['Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','syncNewchannel','bind','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','actions','info','syncVarSet','variable','channelstate','channelstatedesc','value','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','Trunk\x20Reachable','execute','format','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]'];(function(_0x5beac4,_0x1f71d2){var _0x488a46=function(_0x3e72fa){while(--_0x3e72fa){_0x5beac4['push'](_0x5beac4['shift']());}};_0x488a46(++_0x1f71d2);}(_0xadaf,0x1e5));var _0xfada=function(_0x8f3e58,_0x304560){_0x8f3e58=_0x8f3e58-0x0;var _0x142ba0=_0xadaf[_0x8f3e58];return _0x142ba0;};'use strict';var util=require(_0xfada('0x0'));var _=require(_0xfada('0x1'));var BPromise=require(_0xfada('0x2'));var uuid=require(_0xfada('0x3'));var moment=require(_0xfada('0x4'));var path=require(_0xfada('0x5'));var tiff2pdf=require(_0xfada('0x6'));var gs=require(_0xfada('0x7'));var logger=require(_0xfada('0x8'))(_0xfada('0x9'));var ami=require(_0xfada('0xa'));var rpcDb=require(_0xfada('0xb'));var Channel=require('./channel');var ut=require(_0xfada('0xc'));var Action=require(_0xfada('0xd'));var faxAccount=require(_0xfada('0xe'));var attachment=require(_0xfada('0xf'));var faxMessage=require(_0xfada('0x10'));function Fax(_0x3895f3){this[_0xfada('0x11')]={};this[_0xfada('0x12')]=_0x3895f3[_0xfada('0x12')];this[_0xfada('0x13')]=_0x3895f3[_0xfada('0x13')];this['actions']={};ami['on']('newchannel',this[_0xfada('0x14')][_0xfada('0x15')](this));ami['on']('varset',this['syncVarSet'][_0xfada('0x15')](this));ami['on'](_0xfada('0x16'),this[_0xfada('0x17')][_0xfada('0x15')](this));ami['on'](_0xfada('0x18'),this[_0xfada('0x19')][_0xfada('0x15')](this));ami['on']('faxstatus',this[_0xfada('0x1a')][_0xfada('0x15')](this));ami['on'](_0xfada('0x1b'),this[_0xfada('0x1c')][_0xfada('0x15')](this));ami['on']('hangup',this[_0xfada('0x1d')][_0xfada('0x15')](this));ami['on'](_0xfada('0x1e'),this[_0xfada('0x1f')][_0xfada('0x15')](this));}Fax[_0xfada('0x20')][_0xfada('0x14')]=function(_0x4e1b6d){if(_0x4e1b6d[_0xfada('0x21')]===_0xfada('0x22')){for(var _0x15314b in this[_0xfada('0x12')]){if(this[_0xfada('0x12')][_0xfada('0x23')](_0x15314b)){if(_0x4e1b6d[_0xfada('0x24')]===this[_0xfada('0x12')][_0x15314b][_0xfada('0x25')]){this[_0xfada('0x11')][_0x4e1b6d[_0xfada('0x26')]]={};this[_0xfada('0x11')][_0x4e1b6d['uniqueid']][_0xfada('0x27')]=_0x4e1b6d[_0xfada('0x27')];this['channels'][_0x4e1b6d[_0xfada('0x26')]]['id']=this['faxAccounts'][_0x15314b]['id'];this['channels'][_0x4e1b6d[_0xfada('0x26')]][_0xfada('0x28')]=this[_0xfada('0x12')][_0x15314b][_0xfada('0x28')];logger['info'](_0x4e1b6d[_0xfada('0x26')],_0xfada('0x29'));}}}}if(this[_0xfada('0x2a')][_0x4e1b6d[_0xfada('0x26')]]){this[_0xfada('0x11')][_0x4e1b6d[_0xfada('0x26')]]={};this[_0xfada('0x11')][_0x4e1b6d['uniqueid']][_0xfada('0x27')]=_0x4e1b6d[_0xfada('0x27')];logger[_0xfada('0x2b')](_0x4e1b6d[_0xfada('0x26')],_0xfada('0x29'));}};Fax[_0xfada('0x20')][_0xfada('0x2c')]=function(_0x3b606f){if(this['channels'][_0x3b606f['uniqueid']]){for(var _0x2aecef in _0x3b606f['variable']){if(_0x3b606f[_0xfada('0x2d')][_0xfada('0x23')](_0x2aecef)){this[_0xfada('0x11')][_0x3b606f[_0xfada('0x26')]][_0x2aecef]=_0x3b606f['value'];}}}};Fax[_0xfada('0x20')][_0xfada('0x17')]=function(_0x4b598){if(this['channels'][_0x4b598[_0xfada('0x26')]]){this[_0xfada('0x11')][_0x4b598[_0xfada('0x26')]][_0xfada('0x2e')]=_0x4b598[_0xfada('0x2e')];this[_0xfada('0x11')][_0x4b598['uniqueid']][_0xfada('0x2f')]=_0x4b598[_0xfada('0x2f')];}};Fax[_0xfada('0x20')][_0xfada('0x19')]=function(_0x14edf5){if(this['channels'][_0x14edf5[_0xfada('0x26')]]){for(var _0x15d87e in _0x14edf5[_0xfada('0x2d')]){if(_0x14edf5['variable'][_0xfada('0x23')](_0x15d87e)){this[_0xfada('0x11')][_0x14edf5[_0xfada('0x26')]][_0x15d87e]=_0x14edf5[_0xfada('0x30')];}}}};Fax[_0xfada('0x20')]['syncFaxStatus']=function(_0x280b6d){if(this['channels'][_0x280b6d[_0xfada('0x26')]]){this[_0xfada('0x11')][_0x280b6d[_0xfada('0x26')]][_0xfada('0x31')]=_0x280b6d['operation'];this['channels'][_0x280b6d[_0xfada('0x26')]][_0xfada('0x32')]=_0x280b6d[_0xfada('0x32')];this['channels'][_0x280b6d['uniqueid']][_0xfada('0x25')]=_0x280b6d['localstationid'];this[_0xfada('0x11')][_0x280b6d[_0xfada('0x26')]][_0xfada('0x33')]=_0x280b6d['filename'];logger[_0xfada('0x2b')](_0x280b6d['uniqueid'],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0xfada('0x1c')]=function(_0x890e0b){var _0x2e1a60=this;if(this[_0xfada('0x11')][_0x890e0b['uniqueid']]){var _0xffa01b=this[_0xfada('0x11')][_0x890e0b['uniqueid']]['id'];this['channels'][_0x890e0b['uniqueid']]['remotestationid']=_0x890e0b[_0xfada('0x34')];this['channels'][_0x890e0b[_0xfada('0x26')]]['pagestransferred']=_0x890e0b[_0xfada('0x35')];this[_0xfada('0x11')][_0x890e0b[_0xfada('0x26')]][_0xfada('0x25')]=_0x890e0b[_0xfada('0x25')];this[_0xfada('0x11')][_0x890e0b[_0xfada('0x26')]][_0xfada('0x36')]=_0x890e0b[_0xfada('0x36')];this[_0xfada('0x11')][_0x890e0b[_0xfada('0x26')]][_0xfada('0x37')]=_0x890e0b[_0xfada('0x37')];this['channels'][_0x890e0b[_0xfada('0x26')]][_0xfada('0x33')]=_0x890e0b[_0xfada('0x33')];this['channels'][_0x890e0b[_0xfada('0x26')]][_0xfada('0x38')]=_0x890e0b['calleridnum'];if(this['channels'][_0x890e0b[_0xfada('0x26')]]['pagestransferred']>0x0){tiff2pdf(_0x890e0b[_0xfada('0x33')],'/var/opt/motion2/server/files/attachments/',function(_0x154dc9){logger[_0xfada('0x2b')](_0x890e0b['uniqueid'],_0xfada('0x39'),_0x154dc9['message']);attachment[_0xfada('0x3a')]({'name':path[_0xfada('0x3b')](_0x890e0b[_0xfada('0x33')])[_0xfada('0x28')],'basename':path[_0xfada('0x3b')](_0x890e0b[_0xfada('0x33')])[_0xfada('0x28')]+_0xfada('0x3c'),'type':'application/pdf'})[_0xfada('0x3d')](function(_0x361a59){faxAccount[_0xfada('0x3e')](_0xffa01b,{'from':_0x890e0b['calleridnum'],'mapKey':_0xfada('0x9'),'body':path['parse'](_0x890e0b['filename'])[_0xfada('0x28')]+'.pdf','AttachmentId':_0x361a59['id']})[_0xfada('0x3f')](function(_0x28751b){logger[_0xfada('0x40')](_0x890e0b[_0xfada('0x26')],_0xfada('0x41'),JSON[_0xfada('0x42')](_0x28751b));});})[_0xfada('0x3f')](function(_0x5bcb39){logger[_0xfada('0x40')](_0x890e0b['uniqueid'],'\x20receiveFax\x20',JSON[_0xfada('0x42')](_0x5bcb39));});});}logger['info'](_0x890e0b[_0xfada('0x26')],_0xfada('0x43'));}};Fax[_0xfada('0x20')][_0xfada('0x1f')]=function(_0x2352b6){if(this[_0xfada('0x2a')][_0x2352b6[_0xfada('0x26')]]){_[_0xfada('0x44')](this[_0xfada('0x11')][_0x2352b6[_0xfada('0x26')]],_[_0xfada('0x45')](_0x2352b6,['response','reason']));}};function updateStatus(_0x28a680){if(_0x28a680['AttachmentId']){faxMessage[_0xfada('0x46')](_0x28a680[_0xfada('0x47')],{'failMessage':_0xfada('0x48')})[_0xfada('0x3d')](function(_0x2312eb){ut[_0xfada('0x49')]('[Fax][Message][Error][Updated]',_0x2312eb);})[_0xfada('0x3f')](function(_0xf3af24){ut[_0xfada('0x49')](_0xfada('0x4a'),_0xf3af24);});}else{ut[_0xfada('0x49')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xfada('0x20')]['updateStatus']=function(_0x599129,_0x1ce541,_0x28b981){var _0x121f20=this;var _0x3bc793={};if(_0x1ce541){_0x3bc793={'read':_0x1ce541};}else{_0x3bc793={'failMessage':_0x28b981};}if(this[_0xfada('0x2a')][_0x599129]['AttachmentId']){faxMessage[_0xfada('0x46')](this['actions'][_0x599129][_0xfada('0x47')],_0x3bc793)[_0xfada('0x3d')](function(_0x7d476e){ut[_0xfada('0x49')](_0xfada('0x4b'),_0x7d476e);})['catch'](function(_0x152ab5){ut['logger'](_0xfada('0x4c'),_0x152ab5);})['finally'](function(){delete _0x121f20[_0xfada('0x11')][_0x599129];delete _0x121f20[_0xfada('0x2a')][_0x599129];});}else{ut['logger']('[Fax][Message][NoUpdate2]');this['deleteChannelAfterTimeout'](_0x599129);delete this[_0xfada('0x2a')][_0x599129];}};Fax[_0xfada('0x20')][_0xfada('0x1d')]=function(_0xaec4b0){var _0x4923d=this;if(this[_0xfada('0x11')][_0xaec4b0[_0xfada('0x26')]]){if(this[_0xfada('0x2a')][_0xaec4b0[_0xfada('0x26')]]){this[_0xfada('0x11')][_0xaec4b0['uniqueid']]['id']=this[_0xfada('0x2a')][_0xaec4b0[_0xfada('0x26')]]['id'];this[_0xfada('0x11')][_0xaec4b0[_0xfada('0x26')]][_0xfada('0x28')]=this[_0xfada('0x2a')][_0xaec4b0['uniqueid']][_0xfada('0x28')];}logger[_0xfada('0x2b')](_0xaec4b0[_0xfada('0x26')],this['actions'][_0xaec4b0[_0xfada('0x26')]]?_0xfada('0x4d'):_0xfada('0x4e'),JSON[_0xfada('0x42')](this[_0xfada('0x11')][_0xaec4b0['uniqueid']]));if(this['actions'][_0xaec4b0[_0xfada('0x26')]]){if(this[_0xfada('0x11')][_0xaec4b0[_0xfada('0x26')]][_0xfada('0x4f')]>0x0&&this[_0xfada('0x11')][_0xaec4b0['uniqueid']][_0xfada('0x50')]===_0xfada('0x51')){this[_0xfada('0x52')](_0xaec4b0[_0xfada('0x26')],!![]);}else{this[_0xfada('0x52')](_0xaec4b0[_0xfada('0x26')],![],this[_0xfada('0x11')][_0xaec4b0[_0xfada('0x26')]]['faxstatusstring']?_0xfada('0x53')+this['channels'][_0xaec4b0[_0xfada('0x26')]][_0xfada('0x54')]:_0xfada('0x55'));}}}};Fax['prototype'][_0xfada('0x56')]=function(_0x912cb0){var _0x38c2fa=this;return new BPromise(function(_0x160fde,_0x228fbb){_0x38c2fa['execOriginate'](_0x912cb0,_0x38c2fa[_0xfada('0x12')][_0x912cb0[_0xfada('0x57')]])[_0xfada('0x3d')](function(_0x40b0ba){ut['logger'](_0xfada('0x58'),_0x40b0ba);_0x160fde(ut[_0xfada('0x59')](_0xfada('0x5a')));})[_0xfada('0x3f')](function(_0x32bfc1){ut[_0xfada('0x49')](_0xfada('0x5b'),_0x32bfc1);updateStatus(_0x912cb0);_0x228fbb(ut['message'](_0xfada('0x5c')));});});};Fax[_0xfada('0x20')][_0xfada('0x5d')]=function(_0x3ec73a){var _0x392b22=this;return new BPromise(function(_0x33763a,_0x13075c){var _0x211748=_0x392b22['checkTrunk'](_0x392b22[_0xfada('0x12')][_0x3ec73a['FaxAccountId']][_0xfada('0x5e')],_0x3ec73a);if(_0x211748['isValid']){_0x33763a(ut[_0xfada('0x59')](_0xfada('0x5f')));}else{_0x13075c(ut[_0xfada('0x59')](_0x211748[_0xfada('0x59')]));}});};function originate(_0x246d20,_0x3cd2bb,_0xf8b83b){return new BPromise(function(_0x407f07,_0x2a5f6d){if(_0xf8b83b){var _0x6e3085=util['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[_0xfada('0x3b')](_0x246d20[_0xfada('0x5')])[_0xfada('0x28')],_0x246d20[_0xfada('0x5')]);gs[_0xfada('0x60')](_0x6e3085)[_0xfada('0x3d')](function(){_0x246d20['path']=util[_0xfada('0x61')]('%s/%s.tif',path[_0xfada('0x3b')](_0x246d20[_0xfada('0x5')])['dir'],path[_0xfada('0x3b')](_0x246d20[_0xfada('0x5')])['name']);_0x3cd2bb[_0xfada('0x62')]=_0x246d20[_0xfada('0x5')];ut['logger'](_0xfada('0x63'),'');ami[_0xfada('0x64')](ut[_0xfada('0x65')](_0x246d20,_0x3cd2bb))[_0xfada('0x3d')](function(_0x4bd4af){_0x407f07(_0x4bd4af);})[_0xfada('0x3f')](function(_0x3b2608){_0x2a5f6d(_0x3b2608);});})[_0xfada('0x3f')](function(_0x35d2c8){_0x2a5f6d(_0x35d2c8);});}else{ami[_0xfada('0x64')](ut[_0xfada('0x65')](_0x246d20,_0x3cd2bb))[_0xfada('0x3d')](function(_0x2ab338){_0x407f07(_0x2ab338);})[_0xfada('0x3f')](function(_0x22dd3f){_0x2a5f6d(_0x22dd3f);});}});}Fax[_0xfada('0x20')][_0xfada('0x66')]=function(_0x3bb90f,_0x327850){var _0x4319e8=this;return new BPromise(function(_0x2d1954,_0x309a66){var _0x2b369b=uuid['v4']();var _0x4bcaf9=ut[_0xfada('0x67')](_0x3bb90f,_0x327850);_0x4319e8[_0xfada('0x2a')][_0x2b369b]=new Action(_0x2b369b,_0x327850,_0x3bb90f);var _0x1f8f51=_0x4319e8['actions'][_0x2b369b];if(path['parse'](_0x3bb90f['path'])[_0xfada('0x68')]===_0xfada('0x3c')){originate(_0x1f8f51,_0x4bcaf9,!![])['then'](function(_0x33d69e){_0x2d1954(_0x33d69e);})[_0xfada('0x3f')](function(_0x3c8e61){_0x309a66(_0x3c8e61);});}else{originate(_0x1f8f51,_0x4bcaf9,![])[_0xfada('0x3d')](function(_0x2c4f16){_0x2d1954(_0x2c4f16);})[_0xfada('0x3f')](function(_0x35465c){_0x309a66(_0x35465c);});}});};Fax[_0xfada('0x20')]['isTrunkReachable']=function(_0x5845ff){return!_[_0xfada('0x69')](_0x5845ff)&&!_[_0xfada('0x69')](_0x5845ff['name'])&&!_[_0xfada('0x69')](_0x5845ff[_0xfada('0x6a')])&&_0x5845ff['active']&&!_[_0xfada('0x69')](this['trunks'][util[_0xfada('0x61')](_0xfada('0x6b'),_0x5845ff['name'])])&&!_[_0xfada('0x69')](this[_0xfada('0x13')][util[_0xfada('0x61')](_0xfada('0x6b'),_0x5845ff[_0xfada('0x28')])][_0xfada('0x32')])&&(this['trunks'][util[_0xfada('0x61')](_0xfada('0x6b'),_0x5845ff[_0xfada('0x28')])]['status']===_0xfada('0x6c')||this[_0xfada('0x13')][util['format'](_0xfada('0x6b'),_0x5845ff[_0xfada('0x28')])][_0xfada('0x32')]===_0xfada('0x6d'));};Fax[_0xfada('0x20')][_0xfada('0x6e')]=function(_0x54033d,_0x45867c){if(!this[_0xfada('0x6f')](_0x54033d)){ut[_0xfada('0x49')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0xfada('0x69')](_0x54033d)?'':_0x54033d[_0xfada('0x28')]+_0xfada('0x70'));return{'isValid':![],'message':_0xfada('0x71')};}if(_[_0xfada('0x69')](_0x45867c[_0xfada('0x9')])){ut[_0xfada('0x49')](_0xfada('0x72'),JSON[_0xfada('0x42')](_0x45867c));return{'isValid':![],'message':_0xfada('0x73')};}if(_[_0xfada('0x69')](_0x45867c[_0xfada('0x5')])){ut[_0xfada('0x49')](_0xfada('0x74'),JSON['stringify'](_0x45867c));return{'isValid':![],'message':_0xfada('0x75')};}return{'isValid':!![],'message':_0xfada('0x76')};};Fax[_0xfada('0x20')]['deleteChannelAfterTimeout']=function(_0x3938c7,_0x1f301a=0x2710){if(this[_0xfada('0x11')][_0x3938c7]){setTimeout(()=>{delete this[_0xfada('0x11')][_0x3938c7];},_0x1f301a);}};module[_0xfada('0x77')]=Fax; \ No newline at end of file +var _0xa88d=['isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','stringify','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','syncNewchannel','bind','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','channel','channels','uniqueid','name','\x20syncNewchannel\x20','actions','info','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','catch','error','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','Fax\x20failed','checkAfterSend','checkTrunk','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','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction'];(function(_0x18b6e8,_0x56c263){var _0x291ff5=function(_0x16984a){while(--_0x16984a){_0x18b6e8['push'](_0x18b6e8['shift']());}};_0x291ff5(++_0x56c263);}(_0xa88d,0x15d));var _0xda88=function(_0x384412,_0x6ad830){_0x384412=_0x384412-0x0;var _0x4c3e4f=_0xa88d[_0x384412];return _0x4c3e4f;};'use strict';var util=require(_0xda88('0x0'));var _=require(_0xda88('0x1'));var BPromise=require(_0xda88('0x2'));var uuid=require(_0xda88('0x3'));var moment=require('moment');var path=require(_0xda88('0x4'));var tiff2pdf=require(_0xda88('0x5'));var gs=require(_0xda88('0x6'));var logger=require(_0xda88('0x7'))(_0xda88('0x8'));var ami=require(_0xda88('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0xda88('0xa'));var ut=require(_0xda88('0xb'));var Action=require(_0xda88('0xc'));var faxAccount=require(_0xda88('0xd'));var attachment=require(_0xda88('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x436bdf){this['channels']={};this[_0xda88('0xf')]=_0x436bdf['faxAccounts'];this[_0xda88('0x10')]=_0x436bdf[_0xda88('0x10')];this['actions']={};ami['on']('newchannel',this[_0xda88('0x11')][_0xda88('0x12')](this));ami['on']('varset',this[_0xda88('0x13')][_0xda88('0x12')](this));ami['on']('newstate',this[_0xda88('0x14')]['bind'](this));ami['on'](_0xda88('0x15'),this[_0xda88('0x16')][_0xda88('0x12')](this));ami['on'](_0xda88('0x17'),this[_0xda88('0x18')][_0xda88('0x12')](this));ami['on'](_0xda88('0x19'),this['syncReceiveFax'][_0xda88('0x12')](this));ami['on'](_0xda88('0x1a'),this['syncHangup'][_0xda88('0x12')](this));ami['on'](_0xda88('0x1b'),this['syncOriginateResponse'][_0xda88('0x12')](this));}Fax[_0xda88('0x1c')][_0xda88('0x11')]=function(_0x3690ad){if(_0x3690ad[_0xda88('0x1d')]===_0xda88('0x1e')){for(var _0x4b0353 in this['faxAccounts']){if(this['faxAccounts'][_0xda88('0x1f')](_0x4b0353)){if(_0x3690ad[_0xda88('0x20')]===this[_0xda88('0xf')][_0x4b0353]['localstationid']){this['channels'][_0x3690ad['uniqueid']]={};this['channels'][_0x3690ad['uniqueid']][_0xda88('0x21')]=_0x3690ad[_0xda88('0x21')];this[_0xda88('0x22')][_0x3690ad[_0xda88('0x23')]]['id']=this['faxAccounts'][_0x4b0353]['id'];this[_0xda88('0x22')][_0x3690ad[_0xda88('0x23')]][_0xda88('0x24')]=this[_0xda88('0xf')][_0x4b0353][_0xda88('0x24')];logger['info'](_0x3690ad[_0xda88('0x23')],_0xda88('0x25'));}}}}if(this[_0xda88('0x26')][_0x3690ad[_0xda88('0x23')]]){this[_0xda88('0x22')][_0x3690ad[_0xda88('0x23')]]={};this['channels'][_0x3690ad['uniqueid']]['channel']=_0x3690ad[_0xda88('0x21')];logger[_0xda88('0x27')](_0x3690ad[_0xda88('0x23')],_0xda88('0x25'));}};Fax[_0xda88('0x1c')][_0xda88('0x13')]=function(_0x4d4b1d){if(this[_0xda88('0x22')][_0x4d4b1d[_0xda88('0x23')]]){for(var _0x31c473 in _0x4d4b1d[_0xda88('0x28')]){if(_0x4d4b1d[_0xda88('0x28')][_0xda88('0x1f')](_0x31c473)){this[_0xda88('0x22')][_0x4d4b1d[_0xda88('0x23')]][_0x31c473]=_0x4d4b1d[_0xda88('0x29')];}}}};Fax[_0xda88('0x1c')][_0xda88('0x14')]=function(_0x33bdf0){if(this[_0xda88('0x22')][_0x33bdf0['uniqueid']]){this[_0xda88('0x22')][_0x33bdf0[_0xda88('0x23')]][_0xda88('0x2a')]=_0x33bdf0['channelstate'];this[_0xda88('0x22')][_0x33bdf0[_0xda88('0x23')]]['channelstatedesc']=_0x33bdf0[_0xda88('0x2b')];}};Fax[_0xda88('0x1c')][_0xda88('0x16')]=function(_0x3b770b){if(this['channels'][_0x3b770b['uniqueid']]){for(var _0x38c721 in _0x3b770b[_0xda88('0x28')]){if(_0x3b770b[_0xda88('0x28')]['hasOwnProperty'](_0x38c721)){this[_0xda88('0x22')][_0x3b770b[_0xda88('0x23')]][_0x38c721]=_0x3b770b['value'];}}}};Fax[_0xda88('0x1c')]['syncFaxStatus']=function(_0x2a8bfe){if(this[_0xda88('0x22')][_0x2a8bfe[_0xda88('0x23')]]){this['channels'][_0x2a8bfe[_0xda88('0x23')]][_0xda88('0x2c')]=_0x2a8bfe[_0xda88('0x2c')];this[_0xda88('0x22')][_0x2a8bfe[_0xda88('0x23')]][_0xda88('0x2d')]=_0x2a8bfe[_0xda88('0x2d')];this[_0xda88('0x22')][_0x2a8bfe[_0xda88('0x23')]][_0xda88('0x2e')]=_0x2a8bfe[_0xda88('0x2e')];this[_0xda88('0x22')][_0x2a8bfe[_0xda88('0x23')]][_0xda88('0x2f')]=_0x2a8bfe[_0xda88('0x2f')];logger[_0xda88('0x27')](_0x2a8bfe[_0xda88('0x23')],_0xda88('0x30'));}};Fax[_0xda88('0x1c')][_0xda88('0x31')]=function(_0x1f63d7){var _0xa92071=this;if(this['channels'][_0x1f63d7[_0xda88('0x23')]]){var _0x1ba192=this['channels'][_0x1f63d7[_0xda88('0x23')]]['id'];this[_0xda88('0x22')][_0x1f63d7['uniqueid']][_0xda88('0x32')]=_0x1f63d7[_0xda88('0x32')];this[_0xda88('0x22')][_0x1f63d7[_0xda88('0x23')]]['pagestransferred']=_0x1f63d7[_0xda88('0x33')];this['channels'][_0x1f63d7[_0xda88('0x23')]][_0xda88('0x2e')]=_0x1f63d7[_0xda88('0x2e')];this['channels'][_0x1f63d7[_0xda88('0x23')]][_0xda88('0x34')]=_0x1f63d7[_0xda88('0x34')];this[_0xda88('0x22')][_0x1f63d7[_0xda88('0x23')]][_0xda88('0x35')]=_0x1f63d7[_0xda88('0x35')];this[_0xda88('0x22')][_0x1f63d7[_0xda88('0x23')]][_0xda88('0x2f')]=_0x1f63d7[_0xda88('0x2f')];this[_0xda88('0x22')][_0x1f63d7[_0xda88('0x23')]][_0xda88('0x36')]=_0x1f63d7['calleridnum'];if(this[_0xda88('0x22')][_0x1f63d7[_0xda88('0x23')]][_0xda88('0x33')]>0x0){tiff2pdf(_0x1f63d7[_0xda88('0x2f')],_0xda88('0x37'),function(_0xd178bb){logger['info'](_0x1f63d7['uniqueid'],_0xda88('0x38'),_0xd178bb[_0xda88('0x39')]);attachment[_0xda88('0x3a')]({'name':path[_0xda88('0x3b')](_0x1f63d7[_0xda88('0x2f')])[_0xda88('0x24')],'basename':path[_0xda88('0x3b')](_0x1f63d7[_0xda88('0x2f')])[_0xda88('0x24')]+_0xda88('0x3c'),'type':'application/pdf'})[_0xda88('0x3d')](function(_0x8706d9){faxAccount[_0xda88('0x3e')](_0x1ba192,{'from':_0x1f63d7['calleridnum'],'mapKey':_0xda88('0x8'),'body':path[_0xda88('0x3b')](_0x1f63d7[_0xda88('0x2f')])[_0xda88('0x24')]+_0xda88('0x3c'),'AttachmentId':_0x8706d9['id']})[_0xda88('0x3f')](function(_0x1fab74){logger['error'](_0x1f63d7[_0xda88('0x23')],'\x20notify\x20',JSON['stringify'](_0x1fab74));});})[_0xda88('0x3f')](function(_0x519656){logger[_0xda88('0x40')](_0x1f63d7[_0xda88('0x23')],_0xda88('0x41'),JSON['stringify'](_0x519656));});});}logger[_0xda88('0x27')](_0x1f63d7['uniqueid'],_0xda88('0x41'));}};Fax['prototype'][_0xda88('0x42')]=function(_0x27b358){if(this[_0xda88('0x26')][_0x27b358[_0xda88('0x23')]]){_[_0xda88('0x43')](this[_0xda88('0x22')][_0x27b358['uniqueid']],_[_0xda88('0x44')](_0x27b358,[_0xda88('0x45'),'reason']));}};function updateStatus(_0x5a8c20){if(_0x5a8c20['AttachmentId']){faxMessage['update'](_0x5a8c20[_0xda88('0x46')],{'failMessage':_0xda88('0x47')})[_0xda88('0x3d')](function(_0x5b3379){ut[_0xda88('0x48')](_0xda88('0x49'),_0x5b3379);})[_0xda88('0x3f')](function(_0x15f10d){ut[_0xda88('0x48')](_0xda88('0x4a'),_0x15f10d);});}else{ut[_0xda88('0x48')](_0xda88('0x4b'));}}Fax[_0xda88('0x1c')]['updateStatus']=function(_0x5984e6,_0x5286ba,_0x48992b){var _0x2a1060=this;var _0x2382d0={};if(_0x5286ba){_0x2382d0={'read':_0x5286ba};}else{_0x2382d0={'failMessage':_0x48992b};}if(this[_0xda88('0x26')][_0x5984e6][_0xda88('0x46')]){faxMessage['update'](this[_0xda88('0x26')][_0x5984e6][_0xda88('0x46')],_0x2382d0)[_0xda88('0x3d')](function(_0x8feb4c){ut['logger'](_0xda88('0x4c'),_0x8feb4c);})[_0xda88('0x3f')](function(_0x24501e){ut[_0xda88('0x48')](_0xda88('0x4d'),_0x24501e);})['finally'](function(){delete _0x2a1060['channels'][_0x5984e6];delete _0x2a1060[_0xda88('0x26')][_0x5984e6];});}else{ut[_0xda88('0x48')]('[Fax][Message][NoUpdate2]');this['deleteChannelAfterTimeout'](_0x5984e6);delete this[_0xda88('0x26')][_0x5984e6];}};Fax[_0xda88('0x1c')][_0xda88('0x4e')]=function(_0x583cdb){var _0x2f29fd=this;if(this[_0xda88('0x22')][_0x583cdb[_0xda88('0x23')]]){if(this[_0xda88('0x26')][_0x583cdb[_0xda88('0x23')]]){this[_0xda88('0x22')][_0x583cdb[_0xda88('0x23')]]['id']=this[_0xda88('0x26')][_0x583cdb['uniqueid']]['id'];this[_0xda88('0x22')][_0x583cdb[_0xda88('0x23')]][_0xda88('0x24')]=this['actions'][_0x583cdb[_0xda88('0x23')]][_0xda88('0x24')];}logger['info'](_0x583cdb[_0xda88('0x23')],this[_0xda88('0x26')][_0x583cdb[_0xda88('0x23')]]?_0xda88('0x4f'):_0xda88('0x50'),JSON['stringify'](this[_0xda88('0x22')][_0x583cdb[_0xda88('0x23')]]));if(this[_0xda88('0x26')][_0x583cdb[_0xda88('0x23')]]){if(this[_0xda88('0x22')][_0x583cdb[_0xda88('0x23')]]['faxpages']>0x0&&this[_0xda88('0x22')][_0x583cdb[_0xda88('0x23')]][_0xda88('0x17')]===_0xda88('0x51')){this['updateStatus'](_0x583cdb[_0xda88('0x23')],!![]);}else{this['updateStatus'](_0x583cdb['uniqueid'],![],this[_0xda88('0x22')][_0x583cdb[_0xda88('0x23')]][_0xda88('0x52')]?_0xda88('0x53')+this['channels'][_0x583cdb[_0xda88('0x23')]][_0xda88('0x52')]:'SENDING\x20FAILED');}}}};Fax[_0xda88('0x1c')][_0xda88('0x54')]=function(_0x27eec1){var _0x88d208=this;return new BPromise(function(_0x3f0aea,_0x5be506){_0x88d208[_0xda88('0x55')](_0x27eec1,_0x88d208['faxAccounts'][_0x27eec1[_0xda88('0x56')]])[_0xda88('0x3d')](function(_0x217f35){ut['logger']('[Fax][execOriginate][success]',_0x217f35);_0x3f0aea(ut[_0xda88('0x39')]('Fax\x20received'));})[_0xda88('0x3f')](function(_0x5bad5a){ut[_0xda88('0x48')]('[Fax][execOriginate][failure]',_0x5bad5a);updateStatus(_0x27eec1);_0x5be506(ut[_0xda88('0x39')](_0xda88('0x57')));});});};Fax[_0xda88('0x1c')][_0xda88('0x58')]=function(_0x3ea2d1){var _0x3a05ff=this;return new BPromise(function(_0x41d0c4,_0x228570){var _0x835b10=_0x3a05ff[_0xda88('0x59')](_0x3a05ff['faxAccounts'][_0x3ea2d1[_0xda88('0x56')]]['Trunk'],_0x3ea2d1);if(_0x835b10['isValid']){_0x41d0c4(ut['message'](_0xda88('0x5a')));}else{_0x228570(ut[_0xda88('0x39')](_0x835b10[_0xda88('0x39')]));}});};function originate(_0x19b8ae,_0x490624,_0x18bede){return new BPromise(function(_0x8d050b,_0x29f3db){if(_0x18bede){var _0x2f4b9a=util[_0xda88('0x5b')](_0xda88('0x5c'),path[_0xda88('0x3b')](_0x19b8ae['path'])['name'],_0x19b8ae[_0xda88('0x4')]);gs['execute'](_0x2f4b9a)[_0xda88('0x3d')](function(){_0x19b8ae[_0xda88('0x4')]=util[_0xda88('0x5b')](_0xda88('0x5d'),path[_0xda88('0x3b')](_0x19b8ae[_0xda88('0x4')])[_0xda88('0x5e')],path[_0xda88('0x3b')](_0x19b8ae['path'])['name']);_0x490624[_0xda88('0x5f')]=_0x19b8ae[_0xda88('0x4')];ut[_0xda88('0x48')](_0xda88('0x60'),'');ami[_0xda88('0x61')](ut[_0xda88('0x62')](_0x19b8ae,_0x490624))['then'](function(_0x3c6d32){_0x8d050b(_0x3c6d32);})[_0xda88('0x3f')](function(_0x5b1b5e){_0x29f3db(_0x5b1b5e);});})[_0xda88('0x3f')](function(_0x586ff6){_0x29f3db(_0x586ff6);});}else{ami[_0xda88('0x61')](ut[_0xda88('0x62')](_0x19b8ae,_0x490624))[_0xda88('0x3d')](function(_0x3a59a9){_0x8d050b(_0x3a59a9);})['catch'](function(_0x14393c){_0x29f3db(_0x14393c);});}});}Fax[_0xda88('0x1c')][_0xda88('0x55')]=function(_0xdb2571,_0x38c589){var _0x334399=this;return new BPromise(function(_0x47dabc,_0x5a2649){var _0x524f12=uuid['v4']();var _0x477b33=ut['addVariables'](_0xdb2571,_0x38c589);_0x334399['actions'][_0x524f12]=new Action(_0x524f12,_0x38c589,_0xdb2571);var _0x3a1178=_0x334399[_0xda88('0x26')][_0x524f12];if(path[_0xda88('0x3b')](_0xdb2571[_0xda88('0x4')])['ext']===_0xda88('0x3c')){originate(_0x3a1178,_0x477b33,!![])[_0xda88('0x3d')](function(_0x50431e){_0x47dabc(_0x50431e);})[_0xda88('0x3f')](function(_0x50d462){_0x5a2649(_0x50d462);});}else{originate(_0x3a1178,_0x477b33,![])[_0xda88('0x3d')](function(_0x4eaf95){_0x47dabc(_0x4eaf95);})[_0xda88('0x3f')](function(_0x65e84e){_0x5a2649(_0x65e84e);});}});};Fax[_0xda88('0x1c')]['isTrunkReachable']=function(_0x319904){return!_['isNil'](_0x319904)&&!_['isNil'](_0x319904[_0xda88('0x24')])&&!_[_0xda88('0x63')](_0x319904['active'])&&_0x319904[_0xda88('0x64')]&&!_[_0xda88('0x63')](this[_0xda88('0x10')][util[_0xda88('0x5b')](_0xda88('0x65'),_0x319904[_0xda88('0x24')])])&&!_[_0xda88('0x63')](this[_0xda88('0x10')][util['format']('SIP/%s',_0x319904[_0xda88('0x24')])]['status'])&&(this[_0xda88('0x10')][util[_0xda88('0x5b')](_0xda88('0x65'),_0x319904['name'])]['status']===_0xda88('0x66')||this[_0xda88('0x10')][util[_0xda88('0x5b')](_0xda88('0x65'),_0x319904[_0xda88('0x24')])][_0xda88('0x2d')]===_0xda88('0x67'));};Fax['prototype'][_0xda88('0x59')]=function(_0x525c33,_0x4b8981){if(!this[_0xda88('0x68')](_0x525c33)){ut['logger'](_0xda88('0x69'),_['isNil'](_0x525c33)?'':_0x525c33[_0xda88('0x24')]+_0xda88('0x6a'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xda88('0x63')](_0x4b8981[_0xda88('0x8')])){ut[_0xda88('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xda88('0x6b')](_0x4b8981));return{'isValid':![],'message':_0xda88('0x6c')};}if(_[_0xda88('0x63')](_0x4b8981['path'])){ut[_0xda88('0x48')](_0xda88('0x6d'),JSON[_0xda88('0x6b')](_0x4b8981));return{'isValid':![],'message':_0xda88('0x6e')};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0xda88('0x1c')]['deleteChannelAfterTimeout']=function(_0x2ad128,_0x41ca59=0x2710){if(this[_0xda88('0x22')][_0x2ad128]){setTimeout(()=>{delete this[_0xda88('0x22')][_0x2ad128];},_0x41ca59);}};module[_0xda88('0x6f')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 0c71108..a140eb3 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 _0x2c83=['util','bluebird','../../../config/logger','preview','../rpc/faxAccount','inspect','notify','then','catch'];(function(_0x547fea,_0x1012b5){var _0x15dfe3=function(_0x377c8f){while(--_0x377c8f){_0x547fea['push'](_0x547fea['shift']());}};_0x15dfe3(++_0x1012b5);}(_0x2c83,0x1dd));var _0x32c8=function(_0x2c9b5f,_0x35de67){_0x2c9b5f=_0x2c9b5f-0x0;var _0x321a60=_0x2c83[_0x2c9b5f];return _0x321a60;};'use strict';var util=require(_0x32c8('0x0'));var BPromise=require(_0x32c8('0x1'));var logger=require(_0x32c8('0x2'))(_0x32c8('0x3'));var _=require('lodash');var faxAccount=require(_0x32c8('0x4'));function loggerCatch(_0x381109){return function(_0xb40d10){logger['error'](_0x381109,util[_0x32c8('0x5')](_0xb40d10,{'showHidden':![],'depth':null}));};}exports[_0x32c8('0x6')]=function(_0x17a028,_0x5112a8){return BPromise['resolve']()[_0x32c8('0x7')](faxAccount['notify'](_0x17a028,_0x5112a8))[_0x32c8('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xc495=['util','bluebird','lodash','../rpc/faxAccount','notify','then','catch','[Notify]\x20'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xc495,0x1d0));var _0x5c49=function(_0x323385,_0x14f678){_0x323385=_0x323385-0x0;var _0x160def=_0xc495[_0x323385];return _0x160def;};'use strict';var util=require(_0x5c49('0x0'));var BPromise=require(_0x5c49('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x5c49('0x2'));var faxAccount=require(_0x5c49('0x3'));function loggerCatch(_0x1eb5c7){return function(_0x537831){logger['error'](_0x1eb5c7,util['inspect'](_0x537831,{'showHidden':![],'depth':null}));};}exports[_0x5c49('0x4')]=function(_0x5eb922,_0x57e3b3){return BPromise['resolve']()[_0x5c49('0x5')](faxAccount[_0x5c49('0x4')](_0x5eb922,_0x57e3b3))[_0x5c49('0x6')](loggerCatch(_0x5c49('0x7')));}; \ 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 f6f9060..5c3b382 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 _0x7d60=['inspect','util','../../../../config/logger','exec','info','Exec\x20gs'];(function(_0x4d69af,_0x479ebe){var _0x3f3b94=function(_0x27f104){while(--_0x27f104){_0x4d69af['push'](_0x4d69af['shift']());}};_0x3f3b94(++_0x479ebe);}(_0x7d60,0x199));var _0x07d6=function(_0x2cf1db,_0x322a8b){_0x2cf1db=_0x2cf1db-0x0;var _0x2aea4a=_0x7d60[_0x2cf1db];return _0x2aea4a;};'use strict';var util=require(_0x07d6('0x0'));var logger=require(_0x07d6('0x1'))('fax');var BPromise=require('bluebird');var exec=require('child_process')[_0x07d6('0x2')];exports['execute']=function(_0x1f4d14){return new BPromise(function(_0x59ac61,_0x2218a9){exec(_0x1f4d14,function(_0x462227,_0x48d2d5,_0x3b4383){logger[_0x07d6('0x3')](_0x07d6('0x4'),_0x48d2d5);if(_0x462227){logger[_0x07d6('0x3')](_0x07d6('0x4'),'\x20Error\x20:',util[_0x07d6('0x5')](_0x462227,{'showHidden':![],'depth':null}),_0x48d2d5,_0x3b4383);_0x2218a9(_0x462227);}_0x59ac61(_0x48d2d5);});});}; \ No newline at end of file +var _0x2bf8=['bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2bf8,0x11f));var _0x82bf=function(_0x40c99a,_0x56f60e){_0x40c99a=_0x40c99a-0x0;var _0x3d1d0a=_0x2bf8[_0x40c99a];return _0x3d1d0a;};'use strict';var util=require(_0x82bf('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x82bf('0x1'));var exec=require(_0x82bf('0x2'))[_0x82bf('0x3')];exports[_0x82bf('0x4')]=function(_0x30d322){return new BPromise(function(_0x5d0121,_0x1cc7ff){exec(_0x30d322,function(_0x47b022,_0x52d833,_0x15bf9d){logger[_0x82bf('0x5')](_0x82bf('0x6'),_0x52d833);if(_0x47b022){logger[_0x82bf('0x5')](_0x82bf('0x6'),_0x82bf('0x7'),util[_0x82bf('0x8')](_0x47b022,{'showHidden':![],'depth':null}),_0x52d833,_0x15bf9d);_0x1cc7ff(_0x47b022);}_0x5d0121(_0x52d833);});});}; \ 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 84f1cac..5daba9e 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 _0xc3a9=['maxrate','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','lodash','../../../../config/logger','fax','logger','info','inspect','addVariables','headerinfo','minrate'];(function(_0x96ad7d,_0x1017ba){var _0x32d63a=function(_0xb47ad9){while(--_0xb47ad9){_0x96ad7d['push'](_0x96ad7d['shift']());}};_0x32d63a(++_0x1017ba);}(_0xc3a9,0x6f));var _0x9c3a=function(_0x62c235,_0x53f660){_0x62c235=_0x62c235-0x0;var _0x279029=_0xc3a9[_0x62c235];return _0x279029;};'use strict';var util=require('util');var _=require(_0x9c3a('0x0'));var moment=require('moment');var logger=require(_0x9c3a('0x1'))(_0x9c3a('0x2'));exports['message']=function(_0x461870){return{'message':_0x461870};};exports[_0x9c3a('0x3')]=function(_0x2b1d39,_0x571dde){logger[_0x9c3a('0x4')](_0x2b1d39,util[_0x9c3a('0x5')](_0x571dde,{'showHidden':![],'depth':null}));};exports[_0x9c3a('0x6')]=function(_0x198e04,_0x53c1b){var _0x3909c8={'XMF-ECM':_0x53c1b['ecm'],'XMF-HEADERINFO':_0x53c1b[_0x9c3a('0x7')],'XMF-MINRATE':_0x53c1b[_0x9c3a('0x8')],'XMF-MAXRATE':_0x53c1b[_0x9c3a('0x9')],'XMF-MODEM':util['format'](_0x9c3a('0xa'),_0x53c1b[_0x9c3a('0xb')]),'XMF-GATEWAY':_0x53c1b[_0x9c3a('0xc')],'XMF-FAXDETECT':_0x53c1b[_0x9c3a('0xd')],'XMF-T38TIMEOUT':_0x53c1b['t38timeout'],'XMF-LOCALSTATIONID':_0x53c1b[_0x9c3a('0xe')],'XMF-PATH':_0x198e04[_0x9c3a('0xf')]};return _0x3909c8;};exports[_0x9c3a('0x10')]=function(_0x2fc9ce,_0x3b1d84){return{'actionid':_0x2fc9ce[_0x9c3a('0x11')],'action':_0x9c3a('0x12'),'channel':_0x2fc9ce[_0x9c3a('0x13')],'Exten':_0x9c3a('0x14'),'Context':_0x9c3a('0x15'),'Priority':'1','callerid':util[_0x9c3a('0x16')](_0x9c3a('0x17'),_0x2fc9ce[_0x9c3a('0x7')]?_0x2fc9ce[_0x9c3a('0x7')]:'',_0x2fc9ce[_0x9c3a('0xe')]),'variable':_0x3b1d84,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2fc9ce[_0x9c3a('0x11')]};}; \ No newline at end of file +var _0x09dc=['from-sip','\x22%s\x22\x20<%s>','moment','../../../../config/logger','fax','logger','inspect','addVariables','headerinfo','minrate','maxrate','format','modem','gateway','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax'];(function(_0x2972d6,_0x2cf4fb){var _0x3a4e7f=function(_0x2dd5b4){while(--_0x2dd5b4){_0x2972d6['push'](_0x2972d6['shift']());}};_0x3a4e7f(++_0x2cf4fb);}(_0x09dc,0xd4));var _0xc09d=function(_0x3653c7,_0xadb356){_0x3653c7=_0x3653c7-0x0;var _0x58a021=_0x09dc[_0x3653c7];return _0x58a021;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xc09d('0x0'));var logger=require(_0xc09d('0x1'))(_0xc09d('0x2'));exports['message']=function(_0x3c6801){return{'message':_0x3c6801};};exports[_0xc09d('0x3')]=function(_0x5f4ad6,_0x7d04db){logger['info'](_0x5f4ad6,util[_0xc09d('0x4')](_0x7d04db,{'showHidden':![],'depth':null}));};exports[_0xc09d('0x5')]=function(_0x1c3e1f,_0x225676){var _0x3b2581={'XMF-ECM':_0x225676['ecm'],'XMF-HEADERINFO':_0x225676[_0xc09d('0x6')],'XMF-MINRATE':_0x225676[_0xc09d('0x7')],'XMF-MAXRATE':_0x225676[_0xc09d('0x8')],'XMF-MODEM':util[_0xc09d('0x9')]('\x22%s\x22',_0x225676[_0xc09d('0xa')]),'XMF-GATEWAY':_0x225676[_0xc09d('0xb')],'XMF-FAXDETECT':_0x225676['faxdetect'],'XMF-T38TIMEOUT':_0x225676[_0xc09d('0xc')],'XMF-LOCALSTATIONID':_0x225676['localstationid'],'XMF-PATH':_0x1c3e1f[_0xc09d('0xd')]};return _0x3b2581;};exports[_0xc09d('0xe')]=function(_0x1b41df,_0x35d98e){return{'actionid':_0x1b41df[_0xc09d('0xf')],'action':_0xc09d('0x10'),'channel':_0x1b41df[_0xc09d('0x11')],'Exten':_0xc09d('0x12'),'Context':_0xc09d('0x13'),'Priority':'1','callerid':util[_0xc09d('0x9')](_0xc09d('0x14'),_0x1b41df[_0xc09d('0x6')]?_0x1b41df[_0xc09d('0x6')]:'',_0x1b41df['localstationid']),'variable':_0x35d98e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1b41df[_0xc09d('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 7920b6a..abf592a 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 _0x81e2=['initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','[index.js][main]','util','moment','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','../../config/logger','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory'];(function(_0x24cc3e,_0x3b2f20){var _0x299210=function(_0x19e3f5){while(--_0x19e3f5){_0x24cc3e['push'](_0x24cc3e['shift']());}};_0x299210(++_0x3b2f20);}(_0x81e2,0x120));var _0x281e=function(_0x4b295a,_0x4cf6f0){_0x4b295a=_0x4b295a-0x0;var _0x4881f7=_0x81e2[_0x4b295a];return _0x4881f7;};'use strict';var util=require(_0x281e('0x0'));var moment=require(_0x281e('0x1'));var server=require(_0x281e('0x2'));var Realtime=require(_0x281e('0x3'));var Report=require('./report');var Acw=require(_0x281e('0x4'));var Trigger=require(_0x281e('0x5'));var Dialer=require(_0x281e('0x6'));var Preview=require(_0x281e('0x7'));var Fax=require(_0x281e('0x8'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x281e('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x281e('0xa'));var trigger=require(_0x281e('0xb'));var template=require('./rpc/template');var cmHopperHistory=require(_0x281e('0xc'));var campaign=require(_0x281e('0xd'));var voiceExtension=require(_0x281e('0xe'));var faxAccount=require(_0x281e('0xf'));var zendesk=require(_0x281e('0x10'));var salesforce=require(_0x281e('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x281e('0x12'));var desk=require(_0x281e('0x13'));var zoho=require(_0x281e('0x14'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x281e('0x15'));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(_0x281e('0x16'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x281e('0x17')](_0x281e('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x281e('0x17')](_0x281e('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x281e('0x19')](user[_0x281e('0x1a')]())[_0x281e('0x19')](realtime[_0x281e('0x1b')]())['then'](user[_0x281e('0x1c')]())[_0x281e('0x19')](realtime[_0x281e('0x1d')]())[_0x281e('0x19')](trunk[_0x281e('0x1e')]())['then'](realtime[_0x281e('0x1f')]())['then'](voiceQueue[_0x281e('0x20')]())[_0x281e('0x19')](realtime['initVoiceQueues']())[_0x281e('0x19')](trigger[_0x281e('0x21')]())[_0x281e('0x19')](realtime[_0x281e('0x22')]())[_0x281e('0x19')](template[_0x281e('0x23')]())[_0x281e('0x19')](realtime[_0x281e('0x24')]())[_0x281e('0x19')](zendesk[_0x281e('0x25')]())[_0x281e('0x19')](realtime[_0x281e('0x26')]())[_0x281e('0x19')](salesforce[_0x281e('0x27')]())[_0x281e('0x19')](realtime[_0x281e('0x28')]())['then'](sugarcrm[_0x281e('0x29')]())[_0x281e('0x19')](realtime[_0x281e('0x2a')]())[_0x281e('0x19')](freshdesk[_0x281e('0x2b')]())['then'](realtime['initFreshdeskAccounts']())[_0x281e('0x19')](desk['getDeskAccounts']())[_0x281e('0x19')](realtime['initDeskAccounts']())['then'](zoho['getZohoAccounts']())[_0x281e('0x19')](realtime[_0x281e('0x2c')]())[_0x281e('0x19')](vtiger[_0x281e('0x2d')]())[_0x281e('0x19')](realtime['initVtigerAccounts']())['then'](freshsales[_0x281e('0x2e')]())[_0x281e('0x19')](realtime[_0x281e('0x2f')]())[_0x281e('0x19')](servicenow[_0x281e('0x30')]())[_0x281e('0x19')](realtime[_0x281e('0x31')]())[_0x281e('0x19')](dynamics365[_0x281e('0x32')]())[_0x281e('0x19')](realtime[_0x281e('0x33')]())['then'](campaign[_0x281e('0x34')]())['then'](realtime[_0x281e('0x35')]())[_0x281e('0x19')](voiceExtension['getVoiceExtensions']())[_0x281e('0x19')](realtime[_0x281e('0x36')]())[_0x281e('0x19')](faxAccount[_0x281e('0x37')]())[_0x281e('0x19')](realtime[_0x281e('0x38')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x281e('0x39')]()['then'](voiceQueueReport[_0x281e('0x3a')]())[_0x281e('0x19')](realtime[_0x281e('0x3b')]())[_0x281e('0x19')](cmHopperHistory[_0x281e('0x3c')]())[_0x281e('0x19')](realtime['initVoiceQueueHopperHistory']())[_0x281e('0x19')](cmHopperHistory[_0x281e('0x3d')]())['then'](realtime[_0x281e('0x3e')]())[_0x281e('0x19')](voiceCallReport[_0x281e('0x3f')]())[_0x281e('0x19')](realtime[_0x281e('0x40')]())['catch'](function(_0x3acbfa){logger[_0x281e('0x41')](_0x281e('0x42'),util[_0x281e('0x43')](_0x3acbfa,{'showHidden':![],'depth':null}));});}function main(){return server[_0x281e('0x44')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x281e('0x19')](function(){return initParams();})[_0x281e('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x1a4f0d){logger[_0x281e('0x41')](_0x281e('0x45'),util['inspect'](_0x1a4f0d,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xd9cb=['get','hour','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','moment','./server','./realtime','./report','./acw','./dialer','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger'];(function(_0x4c501c,_0x1c447d){var _0xd1c273=function(_0x58e285){while(--_0x58e285){_0x4c501c['push'](_0x4c501c['shift']());}};_0xd1c273(++_0x1c447d);}(_0xd9cb,0x6f));var _0xbd9c=function(_0x5bc1ea,_0xb4b383){_0x5bc1ea=_0x5bc1ea-0x0;var _0xf3d5b9=_0xd9cb[_0x5bc1ea];return _0xf3d5b9;};'use strict';var util=require('util');var moment=require(_0xbd9c('0x0'));var server=require(_0xbd9c('0x1'));var Realtime=require(_0xbd9c('0x2'));var Report=require(_0xbd9c('0x3'));var Acw=require(_0xbd9c('0x4'));var Trigger=require('./trigger');var Dialer=require(_0xbd9c('0x5'));var Preview=require(_0xbd9c('0x6'));var Fax=require('./fax');var user=require(_0xbd9c('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xbd9c('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xbd9c('0x9'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xbd9c('0xa'));var voiceExtension=require(_0xbd9c('0xb'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xbd9c('0xc'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xbd9c('0xd'));var desk=require(_0xbd9c('0xe'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xbd9c('0xf'));var servicenow=require(_0xbd9c('0x10'));var dynamics365=require(_0xbd9c('0x11'));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(_0xbd9c('0x12'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xbd9c('0x13')](_0xbd9c('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xbd9c('0x13')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0xbd9c('0x15')](user[_0xbd9c('0x16')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x17')]())[_0xbd9c('0x15')](user['getTelephones']())['then'](realtime[_0xbd9c('0x18')]())[_0xbd9c('0x15')](trunk[_0xbd9c('0x19')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x1a')]())['then'](voiceQueue[_0xbd9c('0x1b')]())[_0xbd9c('0x15')](realtime['initVoiceQueues']())['then'](trigger[_0xbd9c('0x1c')]())[_0xbd9c('0x15')](realtime['initTriggers']())['then'](template[_0xbd9c('0x1d')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x1e')]())[_0xbd9c('0x15')](zendesk[_0xbd9c('0x1f')]())[_0xbd9c('0x15')](realtime['initZendeskAccounts']())[_0xbd9c('0x15')](salesforce[_0xbd9c('0x20')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x21')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0xbd9c('0x15')](realtime[_0xbd9c('0x22')]())[_0xbd9c('0x15')](freshdesk[_0xbd9c('0x23')]())['then'](realtime[_0xbd9c('0x24')]())['then'](desk[_0xbd9c('0x25')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x26')]())[_0xbd9c('0x15')](zoho[_0xbd9c('0x27')]())[_0xbd9c('0x15')](realtime['initZohoAccounts']())['then'](vtiger[_0xbd9c('0x28')]())['then'](realtime[_0xbd9c('0x29')]())[_0xbd9c('0x15')](freshsales[_0xbd9c('0x2a')]())[_0xbd9c('0x15')](realtime['initFreshsalesAccounts']())[_0xbd9c('0x15')](servicenow[_0xbd9c('0x2b')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x2c')]())[_0xbd9c('0x15')](dynamics365[_0xbd9c('0x2d')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x2e')]())[_0xbd9c('0x15')](campaign[_0xbd9c('0x2f')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x30')]())[_0xbd9c('0x15')](voiceExtension['getVoiceExtensions']())[_0xbd9c('0x15')](realtime[_0xbd9c('0x31')]())[_0xbd9c('0x15')](faxAccount[_0xbd9c('0x32')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x33')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0xbd9c('0x34')]()[_0xbd9c('0x15')](voiceQueueReport['getVoiceQueueReports']())[_0xbd9c('0x15')](realtime[_0xbd9c('0x35')]())['then'](cmHopperHistory[_0xbd9c('0x36')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x37')]())['then'](cmHopperHistory[_0xbd9c('0x38')]())[_0xbd9c('0x15')](realtime['initCampaignHopperHistory']())[_0xbd9c('0x15')](voiceCallReport[_0xbd9c('0x39')]())[_0xbd9c('0x15')](realtime[_0xbd9c('0x3a')]())[_0xbd9c('0x3b')](function(_0x55dd64){logger[_0xbd9c('0x3c')]('[index.js][initParams]',util[_0xbd9c('0x3d')](_0x55dd64,{'showHidden':![],'depth':null}));});}function main(){return server[_0xbd9c('0x3e')](realtime,preview,fax)[_0xbd9c('0x15')](function(){return initRealtime();})[_0xbd9c('0x15')](function(){return initParams();})[_0xbd9c('0x15')](function(){report[_0xbd9c('0x3f')]();setInterval(initRealtime,0x1388);})[_0xbd9c('0x3b')](function(_0x4066df){logger[_0xbd9c('0x3c')](_0xbd9c('0x40'),util['inspect'](_0x4066df,{'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 1ec64f5..bebe467 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 _0xa258=['unknown','stateTime','status','address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','updateStatusRealtime','toLowerCase','talking','statePause','format','interface','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','moment','md5','../../../config/environment','defaults','redis','socket.io-emitter','name','email','accountcode','fullname','state'];(function(_0xdc2360,_0x4d5eaf){var _0x3e1264=function(_0x42c729){while(--_0x42c729){_0xdc2360['push'](_0xdc2360['shift']());}};_0x3e1264(++_0x4d5eaf);}(_0xa258,0xa3));var _0x8a25=function(_0x36039d,_0x2a8cd1){_0x36039d=_0x36039d-0x0;var _0x37b073=_0xa258[_0x36039d];return _0x37b073;};'use strict';var _=require(_0x8a25('0x0'));var util=require('util');var moment=require(_0x8a25('0x1'));var md5=require(_0x8a25('0x2'));var Redis=require('ioredis');var config=require(_0x8a25('0x3'));config['redis']=_[_0x8a25('0x4')](config[_0x8a25('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x8a25('0x6'))(new Redis(config['redis']));function Agent(_0x5c67b8){this['id']=_0x5c67b8['id']||0x0;this[_0x8a25('0x7')]=_0x5c67b8['name']||'';this[_0x8a25('0x8')]=_0x5c67b8[_0x8a25('0x8')]||'';this[_0x8a25('0x9')]=_0x5c67b8['accountcode']||'';this[_0x8a25('0xa')]=_0x5c67b8['fullname']||'';this[_0x8a25('0xb')]=_0x8a25('0xc');this[_0x8a25('0xd')]=0x0;this[_0x8a25('0xe')]=_0x8a25('0xc');this[_0x8a25('0xf')]='';this[_0x8a25('0x10')]='';this['mobile']='';this['interface']='';this[_0x8a25('0x11')]=_0x5c67b8[_0x8a25('0x11')]||![];this[_0x8a25('0x12')]=_0x8a25('0xc');this[_0x8a25('0x13')]=0x0;this[_0x8a25('0x14')]='';this[_0x8a25('0x15')]='';this['onhold']=![];this[_0x8a25('0x16')]=![];this['md5']='';}Agent['prototype'][_0x8a25('0x17')]=function(_0x30db50){var _0x3ecc4a;if(_0x30db50&&_0x30db50[_0x8a25('0xb')]){_0x3ecc4a=_0x30db50['state'][_0x8a25('0x18')]();switch(_0x3ecc4a){case'not_inuse':_0x3ecc4a='idle';break;case'inuse':_0x3ecc4a=_0x8a25('0x19');break;}}if(_0x3ecc4a&&this[_0x8a25('0x12')]!==_0x3ecc4a||_0x30db50[_0x8a25('0x1a')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x8a25('0x1b')]('x'));}if(_0x3ecc4a){this['voiceStatus']=_0x3ecc4a;}var _0x2f8de0={'id':this['id'],'name':this[_0x8a25('0x7')],'email':this[_0x8a25('0x8')],'accountcode':this[_0x8a25('0x9')],'fullname':this[_0x8a25('0xa')],'state':this[_0x8a25('0xb')],'stateTime':this['stateTime'],'status':this[_0x8a25('0xe')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x8a25('0x12')],'voiceStatusTime':this[_0x8a25('0x13')],'voiceStatusCallerIdNumber':this[_0x8a25('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x8a25('0x1c')],'onhold':this['onhold']};var _0x3dc64f=md5(JSON['stringify'](_0x2f8de0));if(this['md5']!==_0x3dc64f){this[_0x8a25('0x2')]=_0x3dc64f;io['to'](util['format'](_0x8a25('0x1d'),_0x2f8de0[_0x8a25('0x7')]))[_0x8a25('0x1e')](_0x8a25('0x1f'),_[_0x8a25('0x20')](_0x2f8de0,[_0x8a25('0x11')]));io[_0x8a25('0x1e')](_0x8a25('0x21'),_0x2f8de0);}};module[_0x8a25('0x22')]=Agent; \ No newline at end of file +var _0x2d62=['stringify','user:%s','emit','user:ami:update','omit','exports','lodash','util','moment','ioredis','../../../config/environment','defaults','redis','name','email','accountcode','fullname','state','unknown','stateTime','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','md5','prototype','updateStatusRealtime','not_inuse','idle','inuse','talking','statePause','toNumber','format','status'];(function(_0x5746a3,_0x3cc07d){var _0x30139e=function(_0x267950){while(--_0x267950){_0x5746a3['push'](_0x5746a3['shift']());}};_0x30139e(++_0x3cc07d);}(_0x2d62,0x146));var _0x22d6=function(_0x222c2b,_0x546501){_0x222c2b=_0x222c2b-0x0;var _0xe3adf0=_0x2d62[_0x222c2b];return _0xe3adf0;};'use strict';var _=require(_0x22d6('0x0'));var util=require(_0x22d6('0x1'));var moment=require(_0x22d6('0x2'));var md5=require('md5');var Redis=require(_0x22d6('0x3'));var config=require(_0x22d6('0x4'));config['redis']=_[_0x22d6('0x5')](config[_0x22d6('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x22d6('0x6')]));function Agent(_0x54557f){this['id']=_0x54557f['id']||0x0;this['name']=_0x54557f[_0x22d6('0x7')]||'';this[_0x22d6('0x8')]=_0x54557f[_0x22d6('0x8')]||'';this[_0x22d6('0x9')]=_0x54557f[_0x22d6('0x9')]||'';this[_0x22d6('0xa')]=_0x54557f[_0x22d6('0xa')]||'';this[_0x22d6('0xb')]=_0x22d6('0xc');this[_0x22d6('0xd')]=0x0;this['status']=_0x22d6('0xc');this[_0x22d6('0xe')]='';this['phone']='';this[_0x22d6('0xf')]='';this[_0x22d6('0x10')]='';this[_0x22d6('0x11')]=_0x54557f[_0x22d6('0x11')]||![];this[_0x22d6('0x12')]='unknown';this[_0x22d6('0x13')]=0x0;this[_0x22d6('0x14')]='';this[_0x22d6('0x15')]='';this[_0x22d6('0x16')]=![];this['local']=![];this[_0x22d6('0x17')]='';}Agent[_0x22d6('0x18')][_0x22d6('0x19')]=function(_0x2ec3aa){var _0x5b5838;if(_0x2ec3aa&&_0x2ec3aa['state']){_0x5b5838=_0x2ec3aa[_0x22d6('0xb')]['toLowerCase']();switch(_0x5b5838){case _0x22d6('0x1a'):_0x5b5838=_0x22d6('0x1b');break;case _0x22d6('0x1c'):_0x5b5838=_0x22d6('0x1d');break;}}if(_0x5b5838&&this[_0x22d6('0x12')]!==_0x5b5838||_0x2ec3aa[_0x22d6('0x1e')]){this['voiceStatusTime']=_[_0x22d6('0x1f')](moment()[_0x22d6('0x20')]('x'));}if(_0x5b5838){this[_0x22d6('0x12')]=_0x5b5838;}var _0x223b4c={'id':this['id'],'name':this[_0x22d6('0x7')],'email':this[_0x22d6('0x8')],'accountcode':this[_0x22d6('0x9')],'fullname':this[_0x22d6('0xa')],'state':this['state'],'stateTime':this['stateTime'],'status':this[_0x22d6('0x21')],'address':this[_0x22d6('0xe')],'online':this[_0x22d6('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x22d6('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x22d6('0x10')],'onhold':this['onhold']};var _0x5bf4c3=md5(JSON[_0x22d6('0x22')](_0x223b4c));if(this[_0x22d6('0x17')]!==_0x5bf4c3){this[_0x22d6('0x17')]=_0x5bf4c3;io['to'](util[_0x22d6('0x20')](_0x22d6('0x23'),_0x223b4c[_0x22d6('0x7')]))[_0x22d6('0x24')](_0x22d6('0x25'),_[_0x22d6('0x26')](_0x223b4c,[_0x22d6('0x11')]));io['emit']('user:presence',_0x223b4c);}};module[_0x22d6('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 1846c1e..502ea1e 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 _0x29a8=['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','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive'];(function(_0x7bd342,_0x132b66){var _0x16ab5c=function(_0x1fba30){while(--_0x1fba30){_0x7bd342['push'](_0x7bd342['shift']());}};_0x16ab5c(++_0x132b66);}(_0x29a8,0x97));var _0x829a=function(_0x3b2f28,_0xef1370){_0x3b2f28=_0x3b2f28-0x0;var _0x192dd4=_0x29a8[_0x3b2f28];return _0x192dd4;};'use strict';function Campaign(_0x416ddf){this['id']=_0x416ddf['id']||0x0;this[_0x829a('0x0')]=_0x416ddf[_0x829a('0x0')]||'';this[_0x829a('0x1')]=_0x416ddf[_0x829a('0x1')]||_0x829a('0x2');this[_0x829a('0x3')]=0x0;this['temp']=0x0;this[_0x829a('0x4')]=0x0;this[_0x829a('0x5')]=0x0;this[_0x829a('0x6')]='';this[_0x829a('0x7')]=!![];this[_0x829a('0x8')]=_0x416ddf[_0x829a('0x8')];this[_0x829a('0x9')]=_0x416ddf['limitCalls'];this[_0x829a('0xa')]=_0x416ddf[_0x829a('0xa')]||null;this[_0x829a('0xb')]=_0x416ddf[_0x829a('0xb')]?_0x416ddf[_0x829a('0xb')]:null;this['dialOriginateCallerIdName']=_0x416ddf[_0x829a('0xc')];this[_0x829a('0xd')]=_0x416ddf[_0x829a('0xd')];this[_0x829a('0xe')]=_0x416ddf[_0x829a('0xe')]||0x1e;this[_0x829a('0xf')]=_0x416ddf[_0x829a('0xf')];this[_0x829a('0x10')]=_0x416ddf[_0x829a('0x10')];this[_0x829a('0x11')]=_0x416ddf[_0x829a('0x11')];this[_0x829a('0x12')]=_0x416ddf[_0x829a('0x12')];this['dialNoAnswerMaxRetry']=_0x416ddf[_0x829a('0x13')];this[_0x829a('0x14')]=_0x416ddf[_0x829a('0x14')];this[_0x829a('0x15')]=_0x416ddf['dialGlobalMaxRetry'];this[_0x829a('0x16')]=_0x416ddf['dialNoSuchNumberMaxRetry']||0x3;this[_0x829a('0x17')]=_0x416ddf[_0x829a('0x17')]||0x96;this[_0x829a('0x18')]=_0x416ddf[_0x829a('0x18')]||0x3;this[_0x829a('0x19')]=_0x416ddf[_0x829a('0x19')]||0x96;this[_0x829a('0x1a')]=_0x416ddf[_0x829a('0x1a')]||0x3;this[_0x829a('0x1b')]=_0x416ddf[_0x829a('0x1b')]||0x96;this[_0x829a('0x1c')]=_0x416ddf[_0x829a('0x1c')]||0x3;this[_0x829a('0x1d')]=_0x416ddf['dialMachineRetryFrequency']||0x96;this[_0x829a('0x1e')]=_0x416ddf[_0x829a('0x1e')]||0x3;this[_0x829a('0x1f')]=_0x416ddf[_0x829a('0x1f')]||0x96;this[_0x829a('0x20')]=_0x416ddf['dialOrderByScheduledAt']||_0x829a('0x21');this[_0x829a('0x22')]=_0x416ddf[_0x829a('0x22')]||undefined;this[_0x829a('0x23')]=_0x416ddf['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x416ddf[_0x829a('0x24')]||undefined;this['TrunkBackup']=_0x416ddf[_0x829a('0x25')]?_0x416ddf['TrunkBackup']:undefined;this[_0x829a('0x26')]=_0x416ddf['Trunk']?_0x416ddf[_0x829a('0x26')]:undefined;this['Interval']=_0x416ddf[_0x829a('0x27')]?_0x416ddf[_0x829a('0x27')]:undefined;this[_0x829a('0x28')]=_0x416ddf[_0x829a('0x28')]?_0x416ddf['SquareProject']:undefined;this[_0x829a('0x29')]=_0x416ddf['SquareProject']?_0x416ddf[_0x829a('0x28')][_0x829a('0x0')]:undefined;this[_0x829a('0x2a')]=_0x416ddf['dialAMDActive']||![];this[_0x829a('0x2b')]=_0x416ddf[_0x829a('0x2b')];this['dialAMDGreeting']=_0x416ddf[_0x829a('0x2c')];this[_0x829a('0x2d')]=_0x416ddf[_0x829a('0x2d')];this['dialAMDTotalAnalysisTime']=_0x416ddf[_0x829a('0x2e')];this['dialAMDMinWordLength']=_0x416ddf[_0x829a('0x2f')];this[_0x829a('0x30')]=_0x416ddf[_0x829a('0x30')];this[_0x829a('0x31')]=_0x416ddf[_0x829a('0x31')];this[_0x829a('0x32')]=_0x416ddf[_0x829a('0x32')];this[_0x829a('0x33')]=_0x416ddf['dialAMDMaximumWordLength'];}module[_0x829a('0x34')]=Campaign; \ No newline at end of file +var _0x3668=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x3688e8,_0x5e1826){var _0x33c03d=function(_0x1a59e7){while(--_0x1a59e7){_0x3688e8['push'](_0x3688e8['shift']());}};_0x33c03d(++_0x5e1826);}(_0x3668,0x79));var _0x8366=function(_0x210796,_0x4a84ec){_0x210796=_0x210796-0x0;var _0x1b338e=_0x3668[_0x210796];return _0x1b338e;};'use strict';function Campaign(_0x1b3263){this['id']=_0x1b3263['id']||0x0;this[_0x8366('0x0')]=_0x1b3263[_0x8366('0x0')]||'';this[_0x8366('0x1')]=_0x1b3263['type']||_0x8366('0x2');this[_0x8366('0x3')]=0x0;this[_0x8366('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x8366('0x5')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x1b3263[_0x8366('0x6')];this[_0x8366('0x7')]=_0x1b3263[_0x8366('0x7')];this['dialTimezone']=_0x1b3263[_0x8366('0x8')]||null;this[_0x8366('0x9')]=_0x1b3263[_0x8366('0x9')]?_0x1b3263[_0x8366('0x9')]:null;this[_0x8366('0xa')]=_0x1b3263[_0x8366('0xa')];this[_0x8366('0xb')]=_0x1b3263[_0x8366('0xb')];this[_0x8366('0xc')]=_0x1b3263[_0x8366('0xc')]||0x1e;this[_0x8366('0xd')]=_0x1b3263[_0x8366('0xd')];this[_0x8366('0xe')]=_0x1b3263[_0x8366('0xe')];this[_0x8366('0xf')]=_0x1b3263['dialBusyMaxRetry'];this[_0x8366('0x10')]=_0x1b3263[_0x8366('0x10')];this[_0x8366('0x11')]=_0x1b3263[_0x8366('0x11')];this[_0x8366('0x12')]=_0x1b3263[_0x8366('0x12')];this[_0x8366('0x13')]=_0x1b3263[_0x8366('0x13')];this[_0x8366('0x14')]=_0x1b3263[_0x8366('0x14')]||0x3;this[_0x8366('0x15')]=_0x1b3263[_0x8366('0x15')]||0x96;this[_0x8366('0x16')]=_0x1b3263[_0x8366('0x16')]||0x3;this['dialDropRetryFrequency']=_0x1b3263[_0x8366('0x17')]||0x96;this[_0x8366('0x18')]=_0x1b3263[_0x8366('0x18')]||0x3;this[_0x8366('0x19')]=_0x1b3263[_0x8366('0x19')]||0x96;this[_0x8366('0x1a')]=_0x1b3263['dialMachineMaxRetry']||0x3;this[_0x8366('0x1b')]=_0x1b3263['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x1b3263[_0x8366('0x1c')]||0x3;this[_0x8366('0x1d')]=_0x1b3263[_0x8366('0x1d')]||0x96;this[_0x8366('0x1e')]=_0x1b3263[_0x8366('0x1e')]||_0x8366('0x1f');this['dialPrefix']=_0x1b3263[_0x8366('0x20')]||undefined;this[_0x8366('0x21')]=_0x1b3263['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x8366('0x22')]=_0x1b3263[_0x8366('0x22')]||undefined;this[_0x8366('0x23')]=_0x1b3263['TrunkBackup']?_0x1b3263[_0x8366('0x23')]:undefined;this[_0x8366('0x24')]=_0x1b3263[_0x8366('0x24')]?_0x1b3263[_0x8366('0x24')]:undefined;this[_0x8366('0x25')]=_0x1b3263[_0x8366('0x25')]?_0x1b3263[_0x8366('0x25')]:undefined;this['SquareProject']=_0x1b3263[_0x8366('0x26')]?_0x1b3263[_0x8366('0x26')]:undefined;this[_0x8366('0x27')]=_0x1b3263['SquareProject']?_0x1b3263['SquareProject']['name']:undefined;this[_0x8366('0x28')]=_0x1b3263[_0x8366('0x28')]||![];this[_0x8366('0x29')]=_0x1b3263[_0x8366('0x29')];this['dialAMDGreeting']=_0x1b3263['dialAMDGreeting'];this[_0x8366('0x2a')]=_0x1b3263['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x1b3263[_0x8366('0x2b')];this['dialAMDMinWordLength']=_0x1b3263[_0x8366('0x2c')];this[_0x8366('0x2d')]=_0x1b3263[_0x8366('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x1b3263[_0x8366('0x2e')];this[_0x8366('0x2f')]=_0x1b3263[_0x8366('0x2f')];this[_0x8366('0x30')]=_0x1b3263[_0x8366('0x30')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 0f27a66..2730c6c 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 _0x13ea=['abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferType','mohtime','exports','destinationchannel','calleridnum','calleridname','connectedlinename','context','linkedid','exten'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x13ea,0xa9));var _0xa13e=function(_0x58f245,_0x3e4f31){_0x58f245=_0x58f245-0x0;var _0x1f0cfb=_0x13ea[_0x58f245];return _0x1f0cfb;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0xa13e('0x0')]='';this[_0xa13e('0x1')]=0x0;this[_0xa13e('0x2')]='';this['connectedlinenum']=undefined;this[_0xa13e('0x3')]=undefined;this['accountcode']=0x0;this[_0xa13e('0x4')]='';this['uniqueid']=0x0;this[_0xa13e('0x5')]=0x0;this[_0xa13e('0x6')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this['unmanaged']=![];this[_0xa13e('0x7')]=![];this[_0xa13e('0x8')]='';this[_0xa13e('0x9')]='';this['duration']=0x0;this[_0xa13e('0xa')]=0x0;this[_0xa13e('0xb')]=0x0;this[_0xa13e('0xc')]=null;this[_0xa13e('0xd')]=null;this[_0xa13e('0xe')]=null;this['monitor']=![];this[_0xa13e('0xf')]=null;this[_0xa13e('0x10')]=null;this[_0xa13e('0x11')]=[];this[_0xa13e('0x12')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xa13e('0x13')]=undefined;this[_0xa13e('0x14')]=0x0;}module[_0xa13e('0x15')]=Channel; \ No newline at end of file +var _0x6a18=['calleridname','connectedlinenum','connectedlinename','accountcode','linkedid','exten','answered','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','calleridnum'];(function(_0x5e55c5,_0xf3d8ab){var _0x227355=function(_0x2d6c74){while(--_0x2d6c74){_0x5e55c5['push'](_0x5e55c5['shift']());}};_0x227355(++_0xf3d8ab);}(_0x6a18,0x114));var _0x86a1=function(_0x113828,_0x377874){_0x113828=_0x113828-0x0;var _0x3a930a=_0x6a18[_0x113828];return _0x3a930a;};'use strict';function Channel(){this[_0x86a1('0x0')]=null;this[_0x86a1('0x1')]='';this[_0x86a1('0x2')]='';this[_0x86a1('0x3')]=0x0;this[_0x86a1('0x4')]='';this[_0x86a1('0x5')]=undefined;this[_0x86a1('0x6')]=undefined;this[_0x86a1('0x7')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x86a1('0x8')]=0x0;this[_0x86a1('0x9')]=0x0;this[_0x86a1('0xa')]=![];this['answertime']=null;this[_0x86a1('0xb')]=null;this[_0x86a1('0xc')]=![];this[_0x86a1('0xd')]=![];this['lastapplication']='';this[_0x86a1('0xe')]='';this[_0x86a1('0xf')]=0x0;this[_0x86a1('0x10')]=0x0;this[_0x86a1('0x11')]=0x0;this[_0x86a1('0x12')]=null;this[_0x86a1('0x13')]=null;this['disposition']=null;this[_0x86a1('0x14')]=![];this[_0x86a1('0x15')]=null;this[_0x86a1('0x16')]=null;this[_0x86a1('0x17')]=[];this[_0x86a1('0x18')]=undefined;this[_0x86a1('0x19')]=undefined;this[_0x86a1('0x1a')]=undefined;this[_0x86a1('0x1b')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index df086b2..18603f1 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 _0xad69=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','password','consumerKey','consumerSecret'];(function(_0x5045e0,_0x1c3bbc){var _0x9f78f6=function(_0x2d3ebf){while(--_0x2d3ebf){_0x5045e0['push'](_0x5045e0['shift']());}};_0x9f78f6(++_0x1c3bbc);}(_0xad69,0x192));var _0x9ad6=function(_0x9cf6ed,_0x170ee8){_0x9cf6ed=_0x9cf6ed-0x0;var _0x978427=_0xad69[_0x9cf6ed];return _0x978427;};'use strict';function DeskAccount(_0x21c368){this['id']=_0x21c368['id']||0x0;this[_0x9ad6('0x0')]=_0x21c368[_0x9ad6('0x0')]||'';this[_0x9ad6('0x1')]=_0x21c368['username']||'';this['remoteUri']=_0x21c368[_0x9ad6('0x2')]||'';this['authType']=_0x21c368['authType']||'';this[_0x9ad6('0x3')]=_0x21c368[_0x9ad6('0x3')]||'';this['consumerKey']=_0x21c368[_0x9ad6('0x4')]||'';this[_0x9ad6('0x5')]=_0x21c368[_0x9ad6('0x5')]||'';this[_0x9ad6('0x6')]=_0x21c368[_0x9ad6('0x6')]||'';this[_0x9ad6('0x7')]=_0x21c368[_0x9ad6('0x7')]||'';this[_0x9ad6('0x8')]=_0x21c368[_0x9ad6('0x8')]||'';this['serverUrl']=_0x21c368[_0x9ad6('0x9')]||'';this[_0x9ad6('0xa')]=_0x21c368[_0x9ad6('0xa')]||{};}module[_0x9ad6('0xb')]=DeskAccount; \ No newline at end of file +var _0x5c4e=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x3362c2,_0x4d56ed){var _0x47c09f=function(_0x368a54){while(--_0x368a54){_0x3362c2['push'](_0x3362c2['shift']());}};_0x47c09f(++_0x4d56ed);}(_0x5c4e,0x18e));var _0xe5c4=function(_0x1548fa,_0x190c7f){_0x1548fa=_0x1548fa-0x0;var _0x3c473b=_0x5c4e[_0x1548fa];return _0x3c473b;};'use strict';function DeskAccount(_0xb11a){this['id']=_0xb11a['id']||0x0;this[_0xe5c4('0x0')]=_0xb11a[_0xe5c4('0x0')]||'';this['username']=_0xb11a[_0xe5c4('0x1')]||'';this[_0xe5c4('0x2')]=_0xb11a['remoteUri']||'';this[_0xe5c4('0x3')]=_0xb11a[_0xe5c4('0x3')]||'';this[_0xe5c4('0x4')]=_0xb11a[_0xe5c4('0x4')]||'';this[_0xe5c4('0x5')]=_0xb11a[_0xe5c4('0x5')]||'';this[_0xe5c4('0x6')]=_0xb11a[_0xe5c4('0x6')]||'';this['token']=_0xb11a[_0xe5c4('0x7')]||'';this[_0xe5c4('0x8')]=_0xb11a[_0xe5c4('0x8')]||'';this[_0xe5c4('0x9')]=_0xb11a[_0xe5c4('0x9')]||'';this[_0xe5c4('0xa')]=_0xb11a[_0xe5c4('0xa')]||'';this['Configurations']=_0xb11a[_0xe5c4('0xb')]||{};}module[_0xe5c4('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 5b48ae5..afccea1 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 _0x8cd6=['exports','name','username','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x461e81,_0x48d992){var _0x4e8ceb=function(_0x2f728e){while(--_0x2f728e){_0x461e81['push'](_0x461e81['shift']());}};_0x4e8ceb(++_0x48d992);}(_0x8cd6,0x1a3));var _0x68cd=function(_0x18f6ee,_0x241f93){_0x18f6ee=_0x18f6ee-0x0;var _0x42ac3f=_0x8cd6[_0x18f6ee];return _0x42ac3f;};'use strict';function Dynamics365Account(_0x1d991d){this['id']=_0x1d991d['id']||0x0;this[_0x68cd('0x0')]=_0x1d991d[_0x68cd('0x0')]||'';this[_0x68cd('0x1')]=_0x1d991d['username']||'';this['password']=_0x1d991d['password']||'';this[_0x68cd('0x2')]=_0x1d991d[_0x68cd('0x2')]||'';this[_0x68cd('0x3')]=_0x1d991d[_0x68cd('0x3')]||'';this[_0x68cd('0x4')]=_0x1d991d[_0x68cd('0x4')]||'';this[_0x68cd('0x5')]=_0x1d991d[_0x68cd('0x5')]||{};this['serverUrl']=_0x1d991d[_0x68cd('0x6')]||'';this[_0x68cd('0x7')]=_0x1d991d[_0x68cd('0x7')]||![];this[_0x68cd('0x8')]=_0x1d991d[_0x68cd('0x8')]||{};this[_0x68cd('0x9')]=_0x1d991d[_0x68cd('0x9')]||{};}module[_0x68cd('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x4397=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId'];(function(_0x23f5fe,_0x59d8f4){var _0x223184=function(_0x472dec){while(--_0x472dec){_0x23f5fe['push'](_0x23f5fe['shift']());}};_0x223184(++_0x59d8f4);}(_0x4397,0x157));var _0x7439=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x4397[_0x13ce0c];return _0x4388fb;};'use strict';function Dynamics365Account(_0xa34273){this['id']=_0xa34273['id']||0x0;this[_0x7439('0x0')]=_0xa34273[_0x7439('0x0')]||'';this[_0x7439('0x1')]=_0xa34273[_0x7439('0x1')]||'';this['password']=_0xa34273[_0x7439('0x2')]||'';this[_0x7439('0x3')]=_0xa34273[_0x7439('0x3')]||'';this[_0x7439('0x4')]=_0xa34273[_0x7439('0x4')]||'';this[_0x7439('0x5')]=_0xa34273[_0x7439('0x5')]||'';this[_0x7439('0x6')]=_0xa34273[_0x7439('0x6')]||{};this[_0x7439('0x7')]=_0xa34273[_0x7439('0x7')]||'';this[_0x7439('0x8')]=_0xa34273['modernAuthentication']||![];this[_0x7439('0x9')]=_0xa34273[_0x7439('0x9')]||{};this[_0x7439('0xa')]=_0xa34273['CloudProvider']||{};}module[_0x7439('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 8fee773..d6f1ee7 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 _0x3d45=['t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x3d45,0x1d2));var _0x53d4=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x3d45[_0x297fd3];return _0x2af381;};'use strict';function FaxAccount(_0x2001c1){this['id']=_0x2001c1['id']||0x0;this[_0x53d4('0x0')]=_0x2001c1[_0x53d4('0x0')]||'';this[_0x53d4('0x1')]=_0x2001c1[_0x53d4('0x1')];this['ecm']=_0x2001c1[_0x53d4('0x2')];this[_0x53d4('0x3')]=_0x2001c1['headerinfo'];this[_0x53d4('0x4')]=_0x2001c1['localstationid'];this['minrate']=_0x2001c1['minrate']||0x960;this['maxrate']=_0x2001c1[_0x53d4('0x5')]||0x3840;this[_0x53d4('0x6')]=_0x2001c1[_0x53d4('0x6')]||_0x53d4('0x7');this[_0x53d4('0x8')]=_0x2001c1['gateway']||'no';this[_0x53d4('0x9')]=_0x2001c1[_0x53d4('0x9')]||'no';this[_0x53d4('0xa')]=_0x2001c1['t38timeout']||0x1388;this[_0x53d4('0xb')]=_0x2001c1['tech']||_0x53d4('0xc');this[_0x53d4('0xd')]=_0x2001c1[_0x53d4('0xd')]?_0x2001c1[_0x53d4('0xd')]:undefined;this[_0x53d4('0xe')]=_0x2001c1['ListId'];this[_0x53d4('0xf')]=_0x2001c1[_0x53d4('0xf')];}module[_0x53d4('0x10')]=FaxAccount; \ No newline at end of file +var _0xaf21=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo'];(function(_0x33c622,_0x385ca9){var _0x8282d1=function(_0x19c9be){while(--_0x19c9be){_0x33c622['push'](_0x33c622['shift']());}};_0x8282d1(++_0x385ca9);}(_0xaf21,0x1a5));var _0x1af2=function(_0x368af8,_0xe79de0){_0x368af8=_0x368af8-0x0;var _0x2bb2a8=_0xaf21[_0x368af8];return _0x2bb2a8;};'use strict';function FaxAccount(_0x4afa02){this['id']=_0x4afa02['id']||0x0;this[_0x1af2('0x0')]=_0x4afa02[_0x1af2('0x0')]||'';this[_0x1af2('0x1')]=_0x4afa02[_0x1af2('0x1')];this['ecm']=_0x4afa02[_0x1af2('0x2')];this[_0x1af2('0x3')]=_0x4afa02[_0x1af2('0x3')];this[_0x1af2('0x4')]=_0x4afa02[_0x1af2('0x4')];this['minrate']=_0x4afa02[_0x1af2('0x5')]||0x960;this['maxrate']=_0x4afa02[_0x1af2('0x6')]||0x3840;this[_0x1af2('0x7')]=_0x4afa02['modem']||_0x1af2('0x8');this[_0x1af2('0x9')]=_0x4afa02['gateway']||'no';this['faxdetect']=_0x4afa02[_0x1af2('0xa')]||'no';this[_0x1af2('0xb')]=_0x4afa02['t38timeout']||0x1388;this[_0x1af2('0xc')]=_0x4afa02[_0x1af2('0xc')]||_0x1af2('0xd');this[_0x1af2('0xe')]=_0x4afa02[_0x1af2('0xe')]?_0x4afa02['Trunk']:undefined;this[_0x1af2('0xf')]=_0x4afa02[_0x1af2('0xf')];this[_0x1af2('0x10')]=_0x4afa02[_0x1af2('0x10')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 4dfccc5..23a9ffa 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 _0x6441=['serverUrl','Configurations','exports','username','apiKey','token','remoteUri'];(function(_0x29f80e,_0x9027ff){var _0x5c7eaa=function(_0x48ec7c){while(--_0x48ec7c){_0x29f80e['push'](_0x29f80e['shift']());}};_0x5c7eaa(++_0x9027ff);}(_0x6441,0x153));var _0x1644=function(_0x9f826b,_0x5358de){_0x9f826b=_0x9f826b-0x0;var _0x548441=_0x6441[_0x9f826b];return _0x548441;};'use strict';function FreshdeskAccount(_0x2e4061){this['id']=_0x2e4061['id']||0x0;this['name']=_0x2e4061['name']||'';this[_0x1644('0x0')]=_0x2e4061[_0x1644('0x0')]||'';this[_0x1644('0x1')]=_0x2e4061[_0x1644('0x2')]||'';this[_0x1644('0x3')]=_0x2e4061['remoteUri']||'';this[_0x1644('0x4')]=_0x2e4061[_0x1644('0x4')]||'';this[_0x1644('0x5')]=_0x2e4061[_0x1644('0x5')]||{};}module[_0x1644('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x6fe2=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x57d0d5,_0x54673a){var _0x26f844=function(_0x352b0f){while(--_0x352b0f){_0x57d0d5['push'](_0x57d0d5['shift']());}};_0x26f844(++_0x54673a);}(_0x6fe2,0x104));var _0x26fe=function(_0xbbcb0b,_0x5cebd6){_0xbbcb0b=_0xbbcb0b-0x0;var _0x3b3d01=_0x6fe2[_0xbbcb0b];return _0x3b3d01;};'use strict';function FreshdeskAccount(_0x332a79){this['id']=_0x332a79['id']||0x0;this[_0x26fe('0x0')]=_0x332a79[_0x26fe('0x0')]||'';this[_0x26fe('0x1')]=_0x332a79[_0x26fe('0x1')]||'';this[_0x26fe('0x2')]=_0x332a79[_0x26fe('0x3')]||'';this['remoteUri']=_0x332a79[_0x26fe('0x4')]||'';this[_0x26fe('0x5')]=_0x332a79[_0x26fe('0x5')]||'';this[_0x26fe('0x6')]=_0x332a79[_0x26fe('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index a0c39ea..49827fd 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 _0x5a5a=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x5a5a[_0x1e05c1];return _0x15f1ca;};'use strict';function FreshsalesAccount(_0x300328){this['id']=_0x300328['id']||0x0;this[_0xa5a5('0x0')]=_0x300328[_0xa5a5('0x0')]||'';this[_0xa5a5('0x1')]=_0x300328[_0xa5a5('0x1')]||'';this[_0xa5a5('0x2')]=_0x300328['token']||'';this[_0xa5a5('0x3')]=_0x300328[_0xa5a5('0x3')]||'';this[_0xa5a5('0x4')]=_0x300328['serverUrl']||'';this['Configurations']=_0x300328[_0xa5a5('0x5')]||{};}module[_0xa5a5('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xae35=['username','apiKey','token','remoteUri','serverUrl','Configurations','name'];(function(_0x373ae5,_0x5d2f48){var _0x33791e=function(_0x24c361){while(--_0x24c361){_0x373ae5['push'](_0x373ae5['shift']());}};_0x33791e(++_0x5d2f48);}(_0xae35,0x172));var _0x5ae3=function(_0xdabeaa,_0x32b44c){_0xdabeaa=_0xdabeaa-0x0;var _0x277065=_0xae35[_0xdabeaa];return _0x277065;};'use strict';function FreshsalesAccount(_0x5db315){this['id']=_0x5db315['id']||0x0;this[_0x5ae3('0x0')]=_0x5db315[_0x5ae3('0x0')]||'';this[_0x5ae3('0x1')]=_0x5db315[_0x5ae3('0x1')]||'';this[_0x5ae3('0x2')]=_0x5db315[_0x5ae3('0x3')]||'';this[_0x5ae3('0x4')]=_0x5db315['remoteUri']||'';this[_0x5ae3('0x5')]=_0x5db315['serverUrl']||'';this[_0x5ae3('0x6')]=_0x5db315[_0x5ae3('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 906d3dc..5a7a53a 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 _0x9783=['accountcode','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','inbound','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0xc8052d,_0xf4a4a6){var _0x2b6f49=function(_0x3f6c52){while(--_0x3f6c52){_0xc8052d['push'](_0xc8052d['shift']());}};_0x2b6f49(++_0xf4a4a6);}(_0x9783,0x8d));var _0x3978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9783[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this['type']=_0x3978('0x0');this['uniqueid']='';this[_0x3978('0x1')]='';this['calleridname']='';this[_0x3978('0x2')]='';this[_0x3978('0x3')]=null;this[_0x3978('0x4')]=null;this[_0x3978('0x5')]=0x1;this[_0x3978('0x6')]=0x1;this[_0x3978('0x7')]=![];this['queuecallerabandonAt']=null;this[_0x3978('0x8')]=![];this[_0x3978('0x9')]=null;this['queuecallerexit']=![];this[_0x3978('0xa')]=null;this[_0x3978('0xb')]=0x1;this[_0x3978('0xc')]='';this[_0x3978('0xd')]='';this[_0x3978('0xe')]='';this[_0x3978('0xf')]='';this[_0x3978('0x10')]='';this[_0x3978('0x11')]='';this[_0x3978('0x12')]='';this[_0x3978('0x13')]=0x0;this['assigned']=![];this[_0x3978('0x14')]='';this[_0x3978('0x15')]=_0x3978('0x16');this[_0x3978('0x17')]=0x0;this[_0x3978('0x18')]={};}module[_0x3978('0x19')]=QueueReport; \ No newline at end of file +var _0xc3aa=['voice','mohtime','variables','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','exten','assigned','motionChannel'];(function(_0x4af636,_0x223ee5){var _0x26c7f2=function(_0x5ccb3e){while(--_0x5ccb3e){_0x4af636['push'](_0x4af636['shift']());}};_0x26c7f2(++_0x223ee5);}(_0xc3aa,0xff));var _0xac3a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc3aa[_0x59ee6f];return _0x4c0979;};'use strict';function QueueReport(){this[_0xac3a('0x0')]='inbound';this[_0xac3a('0x1')]='';this[_0xac3a('0x2')]='';this[_0xac3a('0x3')]='';this[_0xac3a('0x4')]='';this['queuecallerjoinAt']=null;this[_0xac3a('0x5')]=null;this[_0xac3a('0x6')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xac3a('0x7')]=![];this['queuecallercompleteAt']=null;this[_0xac3a('0x8')]=![];this[_0xac3a('0x9')]=null;this[_0xac3a('0xa')]=0x1;this[_0xac3a('0xb')]='';this[_0xac3a('0xc')]='';this[_0xac3a('0xd')]='';this['accountcode']='';this[_0xac3a('0xe')]='';this[_0xac3a('0xf')]='';this['priority']='';this['holdtime']=0x0;this[_0xac3a('0x10')]=![];this['lastAssignedTo']='';this[_0xac3a('0x11')]=_0xac3a('0x12');this[_0xac3a('0x13')]=0x0;this[_0xac3a('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 de31f75..5a49bae 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 _0xe84a=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x303d9d,_0x363884){var _0x4ccd15=function(_0x1b497b){while(--_0x1b497b){_0x303d9d['push'](_0x303d9d['shift']());}};_0x4ccd15(++_0x363884);}(_0xe84a,0x113));var _0xae84=function(_0x363a7c,_0xc7228b){_0x363a7c=_0x363a7c-0x0;var _0x50e8e6=_0xe84a[_0x363a7c];return _0x50e8e6;};'use strict';function SalesforceAccount(_0x58b2bf){this['id']=_0x58b2bf['id']||0x0;this[_0xae84('0x0')]=_0x58b2bf[_0xae84('0x0')]||'';this[_0xae84('0x1')]=_0x58b2bf[_0xae84('0x1')]||'';this[_0xae84('0x2')]=_0x58b2bf[_0xae84('0x2')]||'';this[_0xae84('0x3')]=_0x58b2bf[_0xae84('0x3')]||'';this[_0xae84('0x4')]=_0x58b2bf['clientId']||'';this[_0xae84('0x5')]=_0x58b2bf['clientSecret']||'';this[_0xae84('0x6')]=_0x58b2bf[_0xae84('0x6')]||'';this['type']=_0x58b2bf[_0xae84('0x7')]||_0xae84('0x8');this[_0xae84('0x9')]=_0x58b2bf['serverUrl']||'';this[_0xae84('0xa')]=_0x58b2bf['Configurations']||{};}module[_0xae84('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x2c5e=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x4f5c40,_0x404350){var _0x37c6a5=function(_0x4542ad){while(--_0x4542ad){_0x4f5c40['push'](_0x4f5c40['shift']());}};_0x37c6a5(++_0x404350);}(_0x2c5e,0x139));var _0xe2c5=function(_0xc782ea,_0x403582){_0xc782ea=_0xc782ea-0x0;var _0x16d7c2=_0x2c5e[_0xc782ea];return _0x16d7c2;};'use strict';function SalesforceAccount(_0x3ec76a){this['id']=_0x3ec76a['id']||0x0;this[_0xe2c5('0x0')]=_0x3ec76a[_0xe2c5('0x0')]||'';this[_0xe2c5('0x1')]=_0x3ec76a[_0xe2c5('0x1')]||'';this[_0xe2c5('0x2')]=_0x3ec76a[_0xe2c5('0x2')]||'';this[_0xe2c5('0x3')]=_0x3ec76a['password']||'';this[_0xe2c5('0x4')]=_0x3ec76a[_0xe2c5('0x4')]||'';this[_0xe2c5('0x5')]=_0x3ec76a[_0xe2c5('0x5')]||'';this[_0xe2c5('0x6')]=_0x3ec76a[_0xe2c5('0x6')]||'';this[_0xe2c5('0x7')]=_0x3ec76a[_0xe2c5('0x7')]||_0xe2c5('0x8');this[_0xe2c5('0x9')]=_0x3ec76a[_0xe2c5('0x9')]||'';this[_0xe2c5('0xa')]=_0x3ec76a[_0xe2c5('0xa')]||{};}module[_0xe2c5('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 8590db3..4fee33e 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 _0x2bd0=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3be0c4,_0x5b7eff){var _0x11af9f=function(_0x3f5113){while(--_0x3f5113){_0x3be0c4['push'](_0x3be0c4['shift']());}};_0x11af9f(++_0x5b7eff);}(_0x2bd0,0x98));var _0x02bd=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x2bd0[_0x4dbaad];return _0x226c72;};'use strict';function ServicenowAccount(_0xfe200a){this['id']=_0xfe200a['id']||0x0;this['name']=_0xfe200a[_0x02bd('0x0')]||'';this[_0x02bd('0x1')]=_0xfe200a[_0x02bd('0x1')]||'';this[_0x02bd('0x2')]=_0xfe200a[_0x02bd('0x2')]||'';this[_0x02bd('0x3')]=_0xfe200a[_0x02bd('0x3')]||'';this[_0x02bd('0x4')]=_0xfe200a[_0x02bd('0x4')]||'';this[_0x02bd('0x5')]=_0xfe200a[_0x02bd('0x5')]||{};}module[_0x02bd('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x7257=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x1e11ac,_0x594f8d){var _0x2dd8cb=function(_0x3699a8){while(--_0x3699a8){_0x1e11ac['push'](_0x1e11ac['shift']());}};_0x2dd8cb(++_0x594f8d);}(_0x7257,0x17d));var _0x7725=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0x7257[_0x43fdf8];return _0x1160c6;};'use strict';function ServicenowAccount(_0x5534d4){this['id']=_0x5534d4['id']||0x0;this['name']=_0x5534d4[_0x7725('0x0')]||'';this[_0x7725('0x1')]=_0x5534d4[_0x7725('0x1')]||'';this[_0x7725('0x2')]=_0x5534d4[_0x7725('0x2')]||'';this[_0x7725('0x3')]=_0x5534d4['remoteUri']||'';this['serverUrl']=_0x5534d4[_0x7725('0x4')]||'';this[_0x7725('0x5')]=_0x5534d4[_0x7725('0x5')]||{};}module[_0x7725('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index d2c7310..2bf9591 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 _0x77cc=['name','username','password','serverUrl'];(function(_0x31a0a3,_0x2fecfe){var _0x3f0960=function(_0x494633){while(--_0x494633){_0x31a0a3['push'](_0x31a0a3['shift']());}};_0x3f0960(++_0x2fecfe);}(_0x77cc,0xf0));var _0xc77c=function(_0x27a45d,_0x14499a){_0x27a45d=_0x27a45d-0x0;var _0x5aee32=_0x77cc[_0x27a45d];return _0x5aee32;};'use strict';function SugarcrmAccount(_0x1b9ed3){this['id']=_0x1b9ed3['id']||0x0;this[_0xc77c('0x0')]=_0x1b9ed3[_0xc77c('0x0')]||'';this[_0xc77c('0x1')]=_0x1b9ed3['username']||'';this[_0xc77c('0x2')]=_0x1b9ed3[_0xc77c('0x2')]||'';this['remoteUri']=_0x1b9ed3['remoteUri']||'';this['serverUrl']=_0x1b9ed3[_0xc77c('0x3')]||'';this['Configurations']=_0x1b9ed3['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x5f1e=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x3b3687,_0xe0142b){var _0x371563=function(_0x316846){while(--_0x316846){_0x3b3687['push'](_0x3b3687['shift']());}};_0x371563(++_0xe0142b);}(_0x5f1e,0x1cf));var _0xe5f1=function(_0x4f7331,_0x3b64a9){_0x4f7331=_0x4f7331-0x0;var _0x4d3f32=_0x5f1e[_0x4f7331];return _0x4d3f32;};'use strict';function SugarcrmAccount(_0x569b10){this['id']=_0x569b10['id']||0x0;this['name']=_0x569b10[_0xe5f1('0x0')]||'';this[_0xe5f1('0x1')]=_0x569b10[_0xe5f1('0x1')]||'';this[_0xe5f1('0x2')]=_0x569b10[_0xe5f1('0x2')]||'';this[_0xe5f1('0x3')]=_0x569b10['remoteUri']||'';this[_0xe5f1('0x4')]=_0x569b10[_0xe5f1('0x4')]||'';this[_0xe5f1('0x5')]=_0x569b10[_0xe5f1('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 712f0a8..50ee033 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 _0x88c8=['address','exports','name','accountcode','stateTime','status'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x88c8,0x7a));var _0x888c=function(_0x3eb8eb,_0x3adc31){_0x3eb8eb=_0x3eb8eb-0x0;var _0x368b12=_0x88c8[_0x3eb8eb];return _0x368b12;};'use strict';function Telephone(_0x269c8a){this['id']=_0x269c8a['id']||0x0;this[_0x888c('0x0')]=_0x269c8a['name']||'';this['accountcode']=_0x269c8a[_0x888c('0x1')]||'';this['state']='unknown';this[_0x888c('0x2')]=0x0;this[_0x888c('0x3')]='unknown';this[_0x888c('0x4')]='';}module[_0x888c('0x5')]=Telephone; \ No newline at end of file +var _0xa8e2=['stateTime','status','unknown','address','exports','name','accountcode'];(function(_0x4430e7,_0x5387a1){var _0x24953a=function(_0x3308ac){while(--_0x3308ac){_0x4430e7['push'](_0x4430e7['shift']());}};_0x24953a(++_0x5387a1);}(_0xa8e2,0xa6));var _0x2a8e=function(_0x46e8a9,_0x1bd946){_0x46e8a9=_0x46e8a9-0x0;var _0x48a221=_0xa8e2[_0x46e8a9];return _0x48a221;};'use strict';function Telephone(_0x158cef){this['id']=_0x158cef['id']||0x0;this[_0x2a8e('0x0')]=_0x158cef[_0x2a8e('0x0')]||'';this[_0x2a8e('0x1')]=_0x158cef[_0x2a8e('0x1')]||'';this['state']='unknown';this[_0x2a8e('0x2')]=0x0;this[_0x2a8e('0x3')]=_0x2a8e('0x4');this[_0x2a8e('0x5')]='';}module[_0x2a8e('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 83d24b0..7d50a41 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x41ca37,_0x4d1998){var _0x461c74=function(_0x24cb64){while(--_0x24cb64){_0x41ca37['push'](_0x41ca37['shift']());}};_0x461c74(++_0x4d1998);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ddd52,_0x4e3b17){_0x2ddd52=_0x2ddd52-0x0;var _0x4bb4ec=_0xb10b[_0x2ddd52];return _0x4bb4ec;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x579c62,_0x1c4311){var _0x543436=function(_0x4ef593){while(--_0x4ef593){_0x579c62['push'](_0x579c62['shift']());}};_0x543436(++_0x1c4311);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 8ccf44e..1b30d75 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(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0x0b0e[_0x397f37];return _0x31cae6;};'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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x1b7eb4,_0x3612b7){var _0x156791=function(_0x5ecfdf){while(--_0x5ecfdf){_0x1b7eb4['push'](_0x1b7eb4['shift']());}};_0x156791(++_0x3612b7);}(_0x8603,0x190));var _0x3860=function(_0x221d0f,_0x37c51d){_0x221d0f=_0x221d0f-0x0;var _0x178f23=_0x8603[_0x221d0f];return _0x178f23;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index d46f0f9..b69dfa8 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 _0x2769=['name','state','stateTime','status','unknown','registry','split','host','defaultuser','exports','active'];(function(_0x1121f7,_0x389548){var _0xc8498a=function(_0x13847f){while(--_0x13847f){_0x1121f7['push'](_0x1121f7['shift']());}};_0xc8498a(++_0x389548);}(_0x2769,0x1cd));var _0x9276=function(_0x51739e,_0x1a2d90){_0x51739e=_0x51739e-0x0;var _0x364fc7=_0x2769[_0x51739e];return _0x364fc7;};'use strict';function Trunk(_0x51b939){this['id']=_0x51b939['id']||0x0;this[_0x9276('0x0')]=_0x51b939['active']||![];this[_0x9276('0x1')]=_0x51b939[_0x9276('0x1')]||'';this[_0x9276('0x2')]='unknown';this[_0x9276('0x3')]=0x0;this[_0x9276('0x4')]=_0x9276('0x5');this[_0x9276('0x6')]=_0x51b939[_0x9276('0x6')]&&_0x51b939[_0x9276('0x6')]['indexOf'](':')?_0x51b939[_0x9276('0x6')][_0x9276('0x7')](':')[0x0]:'';this[_0x9276('0x8')]='';this['port']='';this['domain']='';this['domainport']='';this['refresh']='';this['stateRegistry']=_0x9276('0x5');this['registrationtime']='';this['address']='';this[_0x9276('0x9')]=_0x51b939[_0x9276('0x9')]||'';}module[_0x9276('0xa')]=Trunk; \ No newline at end of file +var _0x63b9=['port','domain','refresh','stateRegistry','registrationtime','exports','active','name','unknown','stateTime','status','registry','indexOf','split','host'];(function(_0x246708,_0x480368){var _0x241f8c=function(_0x1c19bc){while(--_0x1c19bc){_0x246708['push'](_0x246708['shift']());}};_0x241f8c(++_0x480368);}(_0x63b9,0x1e6));var _0x963b=function(_0x3a486b,_0x2e2d67){_0x3a486b=_0x3a486b-0x0;var _0x15ab31=_0x63b9[_0x3a486b];return _0x15ab31;};'use strict';function Trunk(_0x4c3c6c){this['id']=_0x4c3c6c['id']||0x0;this['active']=_0x4c3c6c[_0x963b('0x0')]||![];this[_0x963b('0x1')]=_0x4c3c6c[_0x963b('0x1')]||'';this['state']=_0x963b('0x2');this[_0x963b('0x3')]=0x0;this[_0x963b('0x4')]='unknown';this['registry']=_0x4c3c6c['registry']&&_0x4c3c6c[_0x963b('0x5')][_0x963b('0x6')](':')?_0x4c3c6c[_0x963b('0x5')][_0x963b('0x7')](':')[0x0]:'';this[_0x963b('0x8')]='';this[_0x963b('0x9')]='';this[_0x963b('0xa')]='';this['domainport']='';this[_0x963b('0xb')]='';this[_0x963b('0xc')]=_0x963b('0x2');this[_0x963b('0xd')]='';this['address']='';this['defaultuser']=_0x4c3c6c['defaultuser']||'';}module[_0x963b('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index e074871..4bdb0a2 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 _0x7058=['none','exports','exten','recordingFormat'];(function(_0x377bda,_0x12d47e){var _0x2960b6=function(_0x1572fa){while(--_0x1572fa){_0x377bda['push'](_0x377bda['shift']());}};_0x2960b6(++_0x12d47e);}(_0x7058,0x142));var _0x8705=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x7058[_0x5d4607];return _0x5e4a86;};'use strict';function voiceExtension(_0xd56677){this['id']=_0xd56677['id']||0x0;this[_0x8705('0x0')]=_0xd56677['exten']||'';this[_0x8705('0x1')]=_0xd56677['recordingFormat']||_0x8705('0x2');this['mandatoryDisposition']=_0xd56677['mandatoryDisposition']||![];}module[_0x8705('0x3')]=voiceExtension; \ No newline at end of file +var _0x623a=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x1be6b9,_0x344c66){var _0x1d516b=function(_0x18cf2d){while(--_0x18cf2d){_0x1be6b9['push'](_0x1be6b9['shift']());}};_0x1d516b(++_0x344c66);}(_0x623a,0x131));var _0xa623=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x623a[_0xdea41a];return _0x15d0d8;};'use strict';function voiceExtension(_0xa9f86b){this['id']=_0xa9f86b['id']||0x0;this[_0xa623('0x0')]=_0xa9f86b[_0xa623('0x0')]||'';this[_0xa623('0x1')]=_0xa9f86b[_0xa623('0x1')]||'none';this[_0xa623('0x2')]=_0xa9f86b[_0xa623('0x2')]||![];}module[_0xa623('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 6360181..8a9c44e 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 _0x1a61=['queueSummaryCountersUpdated','exports','wav','gsm','leastrecent','linear','random','ringall','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','sumBillable','unmanaged','available','busy','inUse','invalid','loggedIn','notInUse','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause'];(function(_0x1b9107,_0x58c14f){var _0xdeffbe=function(_0x50c011){while(--_0x50c011){_0x1b9107['push'](_0x1b9107['shift']());}};_0xdeffbe(++_0x58c14f);}(_0x1a61,0x1e6));var _0x11a6=function(_0x2dde59,_0x5a93d7){_0x2dde59=_0x2dde59-0x0;var _0x45964f=_0x1a61[_0x2dde59];return _0x45964f;};'use strict';var monitorFormat={'wav':_0x11a6('0x0'),'wav49':'wav49','gsm':_0x11a6('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x11a6('0x2'),'linear':_0x11a6('0x3'),'random':_0x11a6('0x4'),'ringall':_0x11a6('0x5'),'rr':'roundrobin','rrmemory':'rrmemory','rrordered':_0x11a6('0x6'),'wrandom':_0x11a6('0x7')};function VoiceQueue(_0x5b72a1){this['id']=_0x5b72a1['id']||0x0;this[_0x11a6('0x8')]=_0x5b72a1[_0x11a6('0x8')]||'';this[_0x11a6('0x9')]=_0x5b72a1[_0x11a6('0x9')]||'';this[_0x11a6('0xa')]=_0x5b72a1[_0x11a6('0xa')]||_0x11a6('0xb');this[_0x11a6('0xc')]=0x0;this[_0x11a6('0xd')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x11a6('0xe')]=0x0;this[_0x11a6('0xf')]=0x0;this['abandoned']=0x0;this[_0x11a6('0x10')]=0x0;this[_0x11a6('0x11')]=0x0;this[_0x11a6('0x12')]=0x0;this[_0x11a6('0x13')]=0x0;this[_0x11a6('0x14')]=0x0;this[_0x11a6('0x15')]=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0x11a6('0x16')]=0x0;this[_0x11a6('0x17')]=0x0;this['talking']=0x0;this[_0x11a6('0x18')]=0x0;this[_0x11a6('0x19')]=0x0;this['acw']=_0x5b72a1[_0x11a6('0x1a')]||![];this[_0x11a6('0x1b')]=_0x5b72a1['acwTimeout']||0xa;this[_0x11a6('0x1c')]=_0x5b72a1[_0x11a6('0x1c')]||'no';this[_0x11a6('0x1d')]=!![];this[_0x11a6('0x1e')]='';this['statusMessage']='';this[_0x11a6('0x1f')]=0x0;this[_0x11a6('0x20')]=0x0;this[_0x11a6('0x21')]=_0x5b72a1[_0x11a6('0x21')]||null;this[_0x11a6('0x22')]=_0x5b72a1[_0x11a6('0x22')]?_0x5b72a1[_0x11a6('0x22')]:null;this[_0x11a6('0x23')]=_0x5b72a1[_0x11a6('0x23')];this[_0x11a6('0x24')]=_0x5b72a1[_0x11a6('0x24')]||_0x11a6('0x25');this[_0x11a6('0x26')]=_0x5b72a1[_0x11a6('0x26')]||0x0;this['dialLimitQueue']=_0x5b72a1[_0x11a6('0x27')]||0x0;this[_0x11a6('0x28')]=_0x5b72a1[_0x11a6('0x28')]||0x1;this[_0x11a6('0x29')]=_0x5b72a1['dialPredictiveOptimization']||'dropRate';this[_0x11a6('0x2a')]=_0x5b72a1['dialPredictiveOptimizationPercentage']||0.03;this[_0x11a6('0x2b')]=_0x5b72a1['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x5b72a1['dialOriginateCallerIdName']||'anonymous';this[_0x11a6('0x2c')]=_0x5b72a1['dialOriginateCallerIdNumber']||_0x11a6('0x2d');this[_0x11a6('0x2e')]=_0x5b72a1['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x5b72a1[_0x11a6('0x2f')]||_0x11a6('0x30');this[_0x11a6('0x31')]=_0x5b72a1[_0x11a6('0x31')]||0x3;this[_0x11a6('0x32')]=_0x5b72a1[_0x11a6('0x32')]||undefined;this[_0x11a6('0x33')]=_0x5b72a1[_0x11a6('0x33')]||0x3;this[_0x11a6('0x34')]=_0x5b72a1[_0x11a6('0x34')]||0x96;this[_0x11a6('0x35')]=_0x5b72a1[_0x11a6('0x35')]||0x3;this[_0x11a6('0x36')]=_0x5b72a1[_0x11a6('0x36')]||0x96;this[_0x11a6('0x37')]=_0x5b72a1[_0x11a6('0x37')]||0x3;this[_0x11a6('0x38')]=_0x5b72a1[_0x11a6('0x38')]||0x96;this[_0x11a6('0x39')]=_0x5b72a1[_0x11a6('0x39')]||0x3;this[_0x11a6('0x3a')]=_0x5b72a1[_0x11a6('0x3a')]||0x96;this[_0x11a6('0x3b')]=_0x5b72a1[_0x11a6('0x3b')]||0x3;this[_0x11a6('0x3c')]=_0x5b72a1['dialDropRetryFrequency']||0x96;this[_0x11a6('0x3d')]=_0x5b72a1['dialAbandonedMaxRetry']||0x3;this[_0x11a6('0x3e')]=_0x5b72a1[_0x11a6('0x3e')]||0x96;this[_0x11a6('0x3f')]=_0x5b72a1[_0x11a6('0x3f')]||0x3;this[_0x11a6('0x40')]=_0x5b72a1['dialMachineRetryFrequency']||0x96;this[_0x11a6('0x41')]=_0x5b72a1[_0x11a6('0x41')]||0x3;this['dialAgentRejectRetryFrequency']=_0x5b72a1['dialAgentRejectRetryFrequency']||0x96;this['callAdditionalPhoneAfterMin']=_0x5b72a1[_0x11a6('0x42')]||0x3;this[_0x11a6('0x43')]=_0x5b72a1['dialGlobalMaxRetry']||0x4;this[_0x11a6('0x44')]=_0x5b72a1[_0x11a6('0x44')]?_0x5b72a1[_0x11a6('0x44')]:undefined;this[_0x11a6('0x45')]=_0x5b72a1[_0x11a6('0x45')]?_0x5b72a1['TrunkBackup']:undefined;this[_0x11a6('0x46')]=_0x5b72a1[_0x11a6('0x46')]||undefined;this[_0x11a6('0x47')]=_0x5b72a1[_0x11a6('0x47')]?_0x5b72a1[_0x11a6('0x47')]:undefined;this[_0x11a6('0x48')]=_0x5b72a1[_0x11a6('0x48')]||_0x11a6('0x49');this[_0x11a6('0x4a')]=_0x5b72a1[_0x11a6('0x4a')]||undefined;this[_0x11a6('0x4b')]=_0x5b72a1[_0x11a6('0x4b')]||undefined;this[_0x11a6('0x4c')]=strategy[_0x5b72a1['strategy']];this[_0x11a6('0x4d')]=!![];this[_0x11a6('0x4e')]=_0x5b72a1[_0x11a6('0x4e')]||![];this[_0x11a6('0x4f')]=_0x5b72a1[_0x11a6('0x4f')];this[_0x11a6('0x50')]=_0x5b72a1[_0x11a6('0x50')];this[_0x11a6('0x51')]=_0x5b72a1[_0x11a6('0x51')];this['dialAMDTotalAnalysisTime']=_0x5b72a1[_0x11a6('0x52')];this[_0x11a6('0x53')]=_0x5b72a1['dialAMDMinWordLength'];this[_0x11a6('0x54')]=_0x5b72a1[_0x11a6('0x54')];this[_0x11a6('0x55')]=_0x5b72a1['dialAMDMaximumNumberOfWords'];this[_0x11a6('0x56')]=_0x5b72a1[_0x11a6('0x56')];this['dialAMDMaximumWordLength']=_0x5b72a1['dialAMDMaximumWordLength'];this[_0x11a6('0x57')]=0x0;this['pTalking']=0x0;this[_0x11a6('0x58')]=_0x5b72a1[_0x11a6('0x58')];this['outboundAnswerCallsDay']=0x0;this[_0x11a6('0x59')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x11a6('0x5a')]=0x0;this[_0x11a6('0x5b')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x11a6('0x5c')]=0x0;this[_0x11a6('0x5d')]=0x0;this[_0x11a6('0x5e')]=0x0;this[_0x11a6('0x5f')]=0x0;this[_0x11a6('0x60')]=0x0;this[_0x11a6('0x61')]=0x0;this[_0x11a6('0x62')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x11a6('0x63')]=undefined;this[_0x11a6('0x64')]=undefined;this['handlePredictive']=undefined;this[_0x11a6('0x65')]=1.05;this[_0x11a6('0x66')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x11a6('0x67')]=0x0;this[_0x11a6('0x68')]=0x0;this[_0x11a6('0x69')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x5b72a1[_0x11a6('0x6a')]||0x14;this['predictiveIntervalMinThreshold']=_0x5b72a1[_0x11a6('0x6a')]||0xa;this[_0x11a6('0x6b')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x11a6('0x6c')]=0x0;this[_0x11a6('0x6d')]=0x0;this['erlangBusyFactor']=0x0;this[_0x11a6('0x6e')]=_0x5b72a1['dialRecallMeTimeout']||0x1e;this[_0x11a6('0x6f')]=_0x5b72a1['dialRecallInQueue']||![];this[_0x11a6('0x70')]=!!_0x5b72a1[_0x11a6('0x70')]||![];this['dialPreviewRecallmeReminder']=!!_0x5b72a1[_0x11a6('0x71')]||![];this['dialQueueProject2']=_0x5b72a1[_0x11a6('0x72')]||undefined;this[_0x11a6('0x73')]=_0x5b72a1[_0x11a6('0x73')]||![];this[_0x11a6('0x74')]=_0x5b72a1['dialAgiAfterHangupAgent']||![];this[_0x11a6('0x9')]=monitorFormat[_0x5b72a1[_0x11a6('0x9')]]?monitorFormat[_0x5b72a1[_0x11a6('0x9')]]:undefined;this[_0x11a6('0x75')]=_0x5b72a1[_0x11a6('0x75')]||![];this[_0x11a6('0x76')]=_0x5b72a1['mandatoryDispositionPause']?_0x5b72a1[_0x11a6('0x76')]:undefined;this[_0x11a6('0x77')]=![];}module[_0x11a6('0x78')]=VoiceQueue; \ No newline at end of file +var _0x535d=['type','waiting','total','answered','sumDuration','sumBillable','unmanaged','abandoned','available','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','talking','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','ringall','roundrobin','rrmemory','rrordered','wrandom','monitor_format'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x535d,0xe8));var _0xd535=function(_0x139b59,_0x3d3687){_0x139b59=_0x139b59-0x0;var _0x96ea21=_0x535d[_0x139b59];return _0x96ea21;};'use strict';var monitorFormat={'wav':_0xd535('0x0'),'wav49':_0xd535('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0xd535('0x2'),'leastrecent':_0xd535('0x3'),'linear':'linear','random':'random','ringall':_0xd535('0x4'),'rr':_0xd535('0x5'),'rrmemory':_0xd535('0x6'),'rrordered':_0xd535('0x7'),'wrandom':_0xd535('0x8')};function VoiceQueue(_0xa9d48d){this['id']=_0xa9d48d['id']||0x0;this['name']=_0xa9d48d['name']||'';this[_0xd535('0x9')]=_0xa9d48d[_0xd535('0x9')]||'';this['type']=_0xa9d48d[_0xd535('0xa')]||'inbound';this[_0xd535('0xb')]=0x0;this[_0xd535('0xc')]=0x0;this[_0xd535('0xd')]=0x0;this[_0xd535('0xe')]=0x0;this['sumHoldTime']=0x0;this[_0xd535('0xf')]=0x0;this[_0xd535('0x10')]=0x0;this[_0xd535('0x11')]=0x0;this[_0xd535('0x12')]=0x0;this['busy']=0x0;this[_0xd535('0x13')]=0x0;this[_0xd535('0x14')]=0x0;this[_0xd535('0x15')]=0x0;this[_0xd535('0x16')]=0x0;this[_0xd535('0x17')]=0x0;this[_0xd535('0x18')]=0x0;this[_0xd535('0x19')]=0x0;this['ringInUse']=0x0;this[_0xd535('0x1a')]=0x0;this['unavailable']=0x0;this['unknown']=0x0;this[_0xd535('0x1b')]=_0xa9d48d[_0xd535('0x1b')]||![];this['acwTimeout']=_0xa9d48d[_0xd535('0x1c')]||0xa;this[_0xd535('0x1d')]=_0xa9d48d[_0xd535('0x1d')]||'no';this[_0xd535('0x1e')]=!![];this['message']='';this[_0xd535('0x1f')]='';this[_0xd535('0x20')]=0x0;this[_0xd535('0x21')]=0x0;this[_0xd535('0x22')]=_0xa9d48d['dialTimezone']||null;this[_0xd535('0x23')]=_0xa9d48d['dialGlobalInterval']?_0xa9d48d[_0xd535('0x23')]:null;this['dialActive']=_0xa9d48d[_0xd535('0x24')];this['dialMethod']=_0xa9d48d[_0xd535('0x25')]||_0xd535('0x26');this[_0xd535('0x27')]=_0xa9d48d[_0xd535('0x27')]||0x0;this['dialLimitQueue']=_0xa9d48d['dialLimitQueue']||0x0;this[_0xd535('0x28')]=_0xa9d48d['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0xa9d48d[_0xd535('0x29')]||_0xd535('0x2a');this[_0xd535('0x2b')]=_0xa9d48d[_0xd535('0x2b')]||0.03;this[_0xd535('0x2c')]=_0xa9d48d[_0xd535('0x2c')]||0x258;this['dialOriginateCallerIdName']=_0xa9d48d[_0xd535('0x2d')]||_0xd535('0x2e');this[_0xd535('0x2f')]=_0xa9d48d[_0xd535('0x2f')]||_0xd535('0x2e');this['dialOriginateTimeout']=_0xa9d48d['dialOriginateTimeout']||0x1e;this[_0xd535('0x30')]=_0xa9d48d[_0xd535('0x30')]||'tTxX';this['dialQueueTimeout']=_0xa9d48d[_0xd535('0x31')]||0x3;this[_0xd535('0x32')]=_0xa9d48d[_0xd535('0x32')]||undefined;this['dialCongestionMaxRetry']=_0xa9d48d['dialCongestionMaxRetry']||0x3;this[_0xd535('0x33')]=_0xa9d48d[_0xd535('0x33')]||0x96;this[_0xd535('0x34')]=_0xa9d48d[_0xd535('0x34')]||0x3;this[_0xd535('0x35')]=_0xa9d48d[_0xd535('0x35')]||0x96;this[_0xd535('0x36')]=_0xa9d48d['dialNoAnswerMaxRetry']||0x3;this[_0xd535('0x37')]=_0xa9d48d[_0xd535('0x37')]||0x96;this['dialNoSuchNumberMaxRetry']=_0xa9d48d['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0xa9d48d[_0xd535('0x38')]||0x96;this[_0xd535('0x39')]=_0xa9d48d[_0xd535('0x39')]||0x3;this[_0xd535('0x3a')]=_0xa9d48d[_0xd535('0x3a')]||0x96;this['dialAbandonedMaxRetry']=_0xa9d48d['dialAbandonedMaxRetry']||0x3;this[_0xd535('0x3b')]=_0xa9d48d[_0xd535('0x3b')]||0x96;this[_0xd535('0x3c')]=_0xa9d48d[_0xd535('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0xa9d48d[_0xd535('0x3d')]||0x96;this[_0xd535('0x3e')]=_0xa9d48d[_0xd535('0x3e')]||0x3;this[_0xd535('0x3f')]=_0xa9d48d[_0xd535('0x3f')]||0x96;this[_0xd535('0x40')]=_0xa9d48d['callAdditionalPhoneAfterMin']||0x3;this[_0xd535('0x41')]=_0xa9d48d[_0xd535('0x41')]||0x4;this[_0xd535('0x42')]=_0xa9d48d['Trunk']?_0xa9d48d[_0xd535('0x42')]:undefined;this[_0xd535('0x43')]=_0xa9d48d[_0xd535('0x43')]?_0xa9d48d[_0xd535('0x43')]:undefined;this[_0xd535('0x44')]=_0xa9d48d['dialPrefix']||undefined;this['Interval']=_0xa9d48d['Interval']?_0xa9d48d[_0xd535('0x45')]:undefined;this[_0xd535('0x46')]=_0xa9d48d[_0xd535('0x46')]||_0xd535('0x47');this[_0xd535('0x48')]=_0xa9d48d[_0xd535('0x48')]||undefined;this['dialCutDigit']=_0xa9d48d['dialCutDigit']||undefined;this[_0xd535('0x49')]=strategy[_0xa9d48d['strategy']];this[_0xd535('0x4a')]=!![];this['dialAMDActive']=_0xa9d48d[_0xd535('0x4b')]||![];this['dialAMDInitialSilence']=_0xa9d48d[_0xd535('0x4c')];this['dialAMDGreeting']=_0xa9d48d[_0xd535('0x4d')];this[_0xd535('0x4e')]=_0xa9d48d[_0xd535('0x4e')];this[_0xd535('0x4f')]=_0xa9d48d['dialAMDTotalAnalysisTime'];this[_0xd535('0x50')]=_0xa9d48d[_0xd535('0x50')];this['dialAMDBetweenWordsSilence']=_0xa9d48d[_0xd535('0x51')];this[_0xd535('0x52')]=_0xa9d48d[_0xd535('0x52')];this[_0xd535('0x53')]=_0xa9d48d[_0xd535('0x53')];this[_0xd535('0x54')]=_0xa9d48d[_0xd535('0x54')];this[_0xd535('0x55')]=0x0;this[_0xd535('0x56')]=0x0;this[_0xd535('0x57')]=_0xa9d48d['timeout'];this[_0xd535('0x58')]=0x0;this[_0xd535('0x59')]=0x0;this[_0xd535('0x5a')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xd535('0x5b')]=0x0;this[_0xd535('0x5c')]=0x0;this[_0xd535('0x5d')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xd535('0x5e')]=0x0;this[_0xd535('0x5f')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xd535('0x60')]=0x0;this['outboundReCallsDay']=0x0;this[_0xd535('0x61')]=0x0;this[_0xd535('0x62')]=undefined;this[_0xd535('0x63')]=undefined;this[_0xd535('0x64')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xd535('0x65')]=0x0;this[_0xd535('0x66')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xd535('0x67')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xd535('0x68')]=_0xa9d48d[_0xd535('0x69')]||0x14;this['predictiveIntervalMinThreshold']=_0xa9d48d['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xd535('0x6a')]=0x0;this[_0xd535('0x6b')]=0x0;this[_0xd535('0x6c')]=0x1;this['erlangCalls']=0x0;this[_0xd535('0x6d')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xd535('0x6e')]=0x0;this[_0xd535('0x6f')]=_0xa9d48d[_0xd535('0x6f')]||0x1e;this[_0xd535('0x70')]=_0xa9d48d[_0xd535('0x70')]||![];this[_0xd535('0x71')]=!!_0xa9d48d[_0xd535('0x71')]||![];this['dialPreviewRecallmeReminder']=!!_0xa9d48d['dialPreviewRecallmeReminder']||![];this[_0xd535('0x72')]=_0xa9d48d[_0xd535('0x72')]||undefined;this[_0xd535('0x73')]=_0xa9d48d['dialAgiAfterHangupClient']||![];this[_0xd535('0x74')]=_0xa9d48d['dialAgiAfterHangupAgent']||![];this[_0xd535('0x9')]=monitorFormat[_0xa9d48d[_0xd535('0x9')]]?monitorFormat[_0xa9d48d[_0xd535('0x9')]]:undefined;this[_0xd535('0x75')]=_0xa9d48d['mandatoryDisposition']||![];this[_0xd535('0x76')]=_0xa9d48d[_0xd535('0x76')]?_0xa9d48d[_0xd535('0x76')]:undefined;this[_0xd535('0x77')]=![];}module[_0xd535('0x78')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 25cfe1c..9350cdd 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9865=['xcally-motion-preview','compareToInboundQueue','some','active','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','name','strategy','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','loggedin','callers','length','online','incall','includes','status','booked','keys','queue','dialer'];(function(_0x6dc660,_0x5e63fb){var _0x4fa02a=function(_0x3351f3){while(--_0x3351f3){_0x6dc660['push'](_0x6dc660['shift']());}};_0x4fa02a(++_0x5e63fb);}(_0x9865,0x1ba));var _0x5986=function(_0x4f08b0,_0x337546){_0x4f08b0=_0x4f08b0-0x0;var _0x10659b=_0x9865[_0x4f08b0];return _0x10659b;};'use strict';var INBOUND_COUNTERS=[_0x5986('0x0'),_0x5986('0x1'),_0x5986('0x2'),_0x5986('0x3'),_0x5986('0x4'),_0x5986('0x5'),_0x5986('0x6')];var OUTBOUND_COUNTERS=[_0x5986('0x0'),_0x5986('0x7'),_0x5986('0x8'),'loggedIn',_0x5986('0x2'),_0x5986('0x9'),_0x5986('0xa'),_0x5986('0xb'),'outboundBlacklistCallsDay','outboundBusyCallsDay',_0x5986('0xc'),'outboundNoAnswerCallsDay',_0x5986('0xd'),_0x5986('0xe'),_0x5986('0xf'),_0x5986('0x10'),_0x5986('0x3'),'pTalking',_0x5986('0x5'),_0x5986('0x11'),_0x5986('0x12'),'total','waiting'];function VoiceQueueSummary(_0x410117){this['id']=_0x410117['id'];this[_0x5986('0x13')]=_0x410117[_0x5986('0x13')];this[_0x5986('0x14')]=_0x410117[_0x5986('0x14')];this['abandoned']=_0x410117['abandoned']||0x0;this[_0x5986('0x7')]=_0x410117['answered']||0x0;this[_0x5986('0x0')]=_0x410117[_0x5986('0x0')]||0x0;this[_0x5986('0x15')]=_0x410117[_0x5986('0x15')]||0x0;this[_0x5986('0x8')]=_0x410117['inUse']||0x0;this['invalid']=_0x410117[_0x5986('0x16')]||0x0;this['loggedIn']=_0x410117[_0x5986('0x1')]||0x0;this[_0x5986('0x2')]=_0x410117[_0x5986('0x2')]||0x0;this[_0x5986('0x17')]=_0x410117[_0x5986('0x17')]||0x0;this[_0x5986('0x18')]=_0x410117[_0x5986('0x18')]||0x0;this[_0x5986('0x3')]=_0x410117[_0x5986('0x3')]||0x0;this[_0x5986('0x4')]=_0x410117['ringing']||0x0;this['ringInUse']=_0x410117[_0x5986('0x19')];this[_0x5986('0x11')]=_0x410117['sumBillable'];this[_0x5986('0x12')]=_0x410117[_0x5986('0x12')];this[_0x5986('0x1a')]=_0x410117[_0x5986('0x1a')]||0x0;this[_0x5986('0x5')]=_0x410117[_0x5986('0x5')]||0x0;this[_0x5986('0x1b')]=_0x410117[_0x5986('0x1b')]||0x0;this[_0x5986('0x1c')]=_0x410117[_0x5986('0x1c')];this[_0x5986('0x1d')]=_0x410117['unavailable']||0x0;this[_0x5986('0x1e')]=_0x410117['unknown']||0x0;this[_0x5986('0x1f')]=_0x410117['unmanaged']||0x0;this['waiting']=_0x410117[_0x5986('0x6')]||0x0;if(_0x410117['type']===_0x5986('0x20')){this[_0x5986('0x21')]=_0x410117['pTalking']||0x0;this[_0x5986('0x22')]=_0x410117[_0x5986('0x22')];this[_0x5986('0x23')]=_0x410117[_0x5986('0x23')];this[_0x5986('0x24')]=_0x410117[_0x5986('0x24')];this[_0x5986('0x25')]=_0x410117['dialOriginateCallerIdNumber'];this[_0x5986('0x26')]=_0x410117[_0x5986('0x26')];this[_0x5986('0x27')]=_0x410117[_0x5986('0x27')];this['temp']=_0x410117[_0x5986('0x28')];this['outboundAnswerAgiCallsDay']=_0x410117['outboundAnswerAgiCallsDay'];this[_0x5986('0xb')]=_0x410117[_0x5986('0xb')];this['outboundBlacklistCallsDay']=_0x410117[_0x5986('0x29')];this['outboundBusyCallsDay']=_0x410117[_0x5986('0x2a')];this['outboundCongestionCallsDay']=_0x410117['outboundCongestionCallsDay'];this[_0x5986('0x2b')]=_0x410117[_0x5986('0x2b')];this['outboundDropCallsDayCallersExit']=_0x410117[_0x5986('0x2c')];this[_0x5986('0x2d')]=_0x410117[_0x5986('0x2d')];this[_0x5986('0x2e')]=_0x410117['outboundNoAnswerCallsDay'];this[_0x5986('0xd')]=_0x410117['outboundNoSuchCallsDay'];this[_0x5986('0x2f')]=_0x410117['outboundOriginateFailureCallsDay'];this['outboundReCallsDay']=_0x410117[_0x5986('0xe')];this[_0x5986('0xf')]=_0x410117[_0x5986('0xf')];this['outboundUnknownCallsDay']=_0x410117[_0x5986('0x10')];this[_0x5986('0x30')]=_0x410117[_0x5986('0x30')];this[_0x5986('0x31')]=_0x410117[_0x5986('0x31')];this['predictiveIntervalAvgTalktime']=_0x410117[_0x5986('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0x410117[_0x5986('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x410117[_0x5986('0x34')];this[_0x5986('0x35')]=_0x410117['predictiveIntervalErlangCalls'];this[_0x5986('0x36')]=_0x410117[_0x5986('0x36')];this[_0x5986('0x37')]=_0x410117[_0x5986('0x37')];this[_0x5986('0x38')]=_0x410117['predictiveIntervalMultiplicativeFactor'];this['predictiveIntervalPauses']=_0x410117['predictiveIntervalPauses'];this[_0x5986('0x39')]=_0x410117['predictiveIntervalAvailable'];this[_0x5986('0x3a')]=_0x410117[_0x5986('0x3a')];this['originated']=_0x410117[_0x5986('0x9')];this['erlangCalls']=_0x410117['erlangCalls'];this[_0x5986('0x3b')]=_0x410117['erlangCallToSecond'];this[_0x5986('0x3c')]=_0x410117[_0x5986('0x3c')];this['erlangBusyFactor']=_0x410117[_0x5986('0x3d')];this[_0x5986('0x3e')]=_0x410117[_0x5986('0x3e')];this[_0x5986('0x3f')]=_0x410117[_0x5986('0x3f')];this['message']=_0x410117[_0x5986('0x40')];this['statusMessage']=_0x410117[_0x5986('0x41')];}if(_0x410117[_0x5986('0x42')]){this[_0x5986('0x42')]={'id':_0x410117[_0x5986('0x42')]['id'],'name':_0x410117['Trunk']['name'],'active':_0x410117[_0x5986('0x42')]['active'],'callerid':_0x410117[_0x5986('0x42')][_0x5986('0x43')]};}}VoiceQueueSummary[_0x5986('0x44')]['createReport']=function(_0x1bfe45,_0x313b1b,_0x33e0a5,_0x445642){this['loggedInDb']=0x0;this[_0x5986('0x5')]=0x0;this[_0x5986('0x3')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0x5986('0x8')]=0x0;this[_0x5986('0x15')]=0x0;this[_0x5986('0x16')]=0x0;this['unavailable']=0x0;this[_0x5986('0x4')]=0x0;this['ringInUse']=0x0;this[_0x5986('0x17')]=0x0;if(_0x33e0a5){if(_0x33e0a5[_0x5986('0x0')]){this[_0x5986('0x0')]=Number(_0x33e0a5['available']);}if(_0x33e0a5[_0x5986('0x45')]){this[_0x5986('0x1')]=Number(_0x33e0a5[_0x5986('0x45')]);}if(_0x33e0a5[_0x5986('0x46')]){this[_0x5986('0x6')]=Number(_0x33e0a5['callers']);}}for(var _0x38eac7=0x0;_0x38eac7<_0x1bfe45[_0x5986('0x47')];_0x38eac7++){var _0x5853ef=_0x313b1b['SIP/'+_0x1bfe45[_0x38eac7][_0x5986('0x13')]];if(_0x5853ef&&_0x5853ef[_0x5986('0x48')]){this[_0x5986('0x2')]+=0x1;}if(_0x1bfe45[_0x38eac7][_0x5986('0x49')]==='1'){this[_0x5986('0x5')]+=0x1;}if(_0x1bfe45[_0x38eac7][_0x5986('0x3')]==='1'&&!['2','7','8'][_0x5986('0x4a')](_0x1bfe45[_0x38eac7][_0x5986('0x4b')])){this['paused']+=0x1;}switch(_0x1bfe45[_0x38eac7][_0x5986('0x4b')]){case'0':this[_0x5986('0x1e')]+=0x1;break;case'1':this[_0x5986('0x18')]+=0x1;break;case'2':this[_0x5986('0x8')]+=0x1;break;case'3':this[_0x5986('0x15')]+=0x1;break;case'4':this[_0x5986('0x16')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x5986('0x4')]+=0x1;break;case'7':this[_0x5986('0x19')]+=0x1;break;case'8':this[_0x5986('0x17')]+=0x1;break;}}if(this[_0x5986('0x23')]===_0x5986('0x4c')){var _0x474cee=Object[_0x5986('0x4d')](_0x445642);for(var _0x583b27=0x0;_0x583b27<_0x474cee[_0x5986('0x47')];_0x583b27++){var _0x515ad7=_0x474cee[_0x583b27];var _0x4ec154=_0x445642[_0x515ad7];if(_0x4ec154[_0x5986('0x4e')]===this[_0x5986('0x13')]&&_0x4ec154[_0x5986('0x1c')]===_0x5986('0x4f')&&_0x4ec154['exten']===_0x5986('0x50')){this['talking']+=0x1;}}if(this[_0x5986('0x5')]>this['inUse']){this['talking']=this['inUse'];}this[_0x5986('0x21')]=0x0;}return this;};VoiceQueueSummary[_0x5986('0x44')][_0x5986('0x51')]=function(_0x45419c){var _0x2de902=![];if(_0x45419c){_0x2de902=INBOUND_COUNTERS[_0x5986('0x52')](function(_0x8fc975){return this[_0x8fc975]!==_0x45419c[_0x8fc975];},this);}return _0x2de902;};VoiceQueueSummary[_0x5986('0x44')]['compareToOutboundQueue']=function(_0x5db167){var _0x1f16e2=![];var _0xbd9813=![];var _0xae00df=![];if(_0x5db167){_0x1f16e2=this[_0x5986('0x23')]!==_0x5db167[_0x5986('0x23')]||this['dialActive']!==_0x5db167['dialActive']||this['message']!==_0x5db167[_0x5986('0x40')]||this[_0x5986('0x41')]!==_0x5db167[_0x5986('0x41')];_0xbd9813=OUTBOUND_COUNTERS[_0x5986('0x52')](function(_0x378606){return this[_0x378606]!==_0x5db167[_0x378606];},this);if(this[_0x5986('0x42')]&&_0x5db167[_0x5986('0x42')]){_0xae00df=this[_0x5986('0x42')][_0x5986('0x13')]!==_0x5db167[_0x5986('0x42')][_0x5986('0x13')]||this[_0x5986('0x42')][_0x5986('0x53')]!==_0x5db167[_0x5986('0x42')][_0x5986('0x53')];}}return _0x1f16e2||_0xbd9813||_0xae00df;};VoiceQueueSummary[_0x5986('0x44')][_0x5986('0x54')]=function(_0x1c89a0){this[_0x5986('0x7')]=_0x1c89a0[_0x5986('0x7')];this[_0x5986('0x40')]=_0x1c89a0[_0x5986('0x40')];this['statusMessage']=_0x1c89a0[_0x5986('0x41')];this[_0x5986('0x9')]=_0x1c89a0[_0x5986('0x9')];this[_0x5986('0xa')]=_0x1c89a0[_0x5986('0xa')];this['outboundAnswerCallsDay']=_0x1c89a0['outboundAnswerCallsDay'];this[_0x5986('0x29')]=_0x1c89a0[_0x5986('0x29')];this[_0x5986('0x2a')]=_0x1c89a0[_0x5986('0x2a')];this[_0x5986('0xc')]=_0x1c89a0[_0x5986('0xc')];this[_0x5986('0x2e')]=_0x1c89a0[_0x5986('0x2e')];this[_0x5986('0xd')]=_0x1c89a0[_0x5986('0xd')];this['outboundReCallsDay']=_0x1c89a0[_0x5986('0xe')];this[_0x5986('0xf')]=_0x1c89a0[_0x5986('0xf')];this['outboundUnknownCallsDay']=_0x1c89a0[_0x5986('0x10')];this[_0x5986('0x11')]=_0x1c89a0[_0x5986('0x11')];this[_0x5986('0x12')]=_0x1c89a0[_0x5986('0x12')];this[_0x5986('0x1b')]=_0x1c89a0[_0x5986('0x1b')];if(this['dialMethod']===_0x5986('0x55')){this[_0x5986('0x21')]=_0x1c89a0[_0x5986('0x21')];}};module[_0x5986('0x56')]=VoiceQueueSummary; \ No newline at end of file +var _0x1bce=['erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','unavailable','callers','length','SIP/','online','incall','status','booked','keys','dialer','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','paused','ringing','talking','waiting','answered','inUse','loggedInDb','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','pTalking','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate'];(function(_0x54df1f,_0x163295){var _0x43c97a=function(_0x152598){while(--_0x152598){_0x54df1f['push'](_0x54df1f['shift']());}};_0x43c97a(++_0x163295);}(_0x1bce,0x73));var _0xe1bc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1bce[_0x2641f9];return _0x585741;};'use strict';var INBOUND_COUNTERS=[_0xe1bc('0x0'),_0xe1bc('0x1'),'loggedInDb',_0xe1bc('0x2'),_0xe1bc('0x3'),_0xe1bc('0x4'),_0xe1bc('0x5')];var OUTBOUND_COUNTERS=[_0xe1bc('0x0'),_0xe1bc('0x6'),_0xe1bc('0x7'),_0xe1bc('0x1'),_0xe1bc('0x8'),'originated','outboundAbandonedCallsDay',_0xe1bc('0x9'),_0xe1bc('0xa'),_0xe1bc('0xb'),_0xe1bc('0xc'),_0xe1bc('0xd'),_0xe1bc('0xe'),'outboundReCallsDay',_0xe1bc('0xf'),'outboundUnknownCallsDay',_0xe1bc('0x2'),_0xe1bc('0x10'),_0xe1bc('0x4'),'sumBillable',_0xe1bc('0x11'),_0xe1bc('0x12'),'waiting'];function VoiceQueueSummary(_0x44a556){this['id']=_0x44a556['id'];this[_0xe1bc('0x13')]=_0x44a556['name'];this['strategy']=_0x44a556[_0xe1bc('0x14')];this[_0xe1bc('0x15')]=_0x44a556[_0xe1bc('0x15')]||0x0;this['answered']=_0x44a556['answered']||0x0;this[_0xe1bc('0x0')]=_0x44a556[_0xe1bc('0x0')]||0x0;this[_0xe1bc('0x16')]=_0x44a556['busy']||0x0;this[_0xe1bc('0x7')]=_0x44a556[_0xe1bc('0x7')]||0x0;this[_0xe1bc('0x17')]=_0x44a556[_0xe1bc('0x17')]||0x0;this['loggedIn']=_0x44a556[_0xe1bc('0x1')]||0x0;this['loggedInDb']=_0x44a556[_0xe1bc('0x8')]||0x0;this[_0xe1bc('0x18')]=_0x44a556['onHold']||0x0;this[_0xe1bc('0x19')]=_0x44a556[_0xe1bc('0x19')]||0x0;this[_0xe1bc('0x2')]=_0x44a556[_0xe1bc('0x2')]||0x0;this[_0xe1bc('0x3')]=_0x44a556[_0xe1bc('0x3')]||0x0;this['ringInUse']=_0x44a556[_0xe1bc('0x1a')];this['sumBillable']=_0x44a556[_0xe1bc('0x1b')];this[_0xe1bc('0x11')]=_0x44a556[_0xe1bc('0x11')];this[_0xe1bc('0x1c')]=_0x44a556[_0xe1bc('0x1c')]||0x0;this['talking']=_0x44a556[_0xe1bc('0x4')]||0x0;this['total']=_0x44a556['total']||0x0;this[_0xe1bc('0x1d')]=_0x44a556[_0xe1bc('0x1d')];this['unavailable']=_0x44a556['unavailable']||0x0;this[_0xe1bc('0x1e')]=_0x44a556[_0xe1bc('0x1e')]||0x0;this[_0xe1bc('0x1f')]=_0x44a556[_0xe1bc('0x1f')]||0x0;this[_0xe1bc('0x5')]=_0x44a556[_0xe1bc('0x5')]||0x0;if(_0x44a556[_0xe1bc('0x1d')]===_0xe1bc('0x20')){this[_0xe1bc('0x10')]=_0x44a556[_0xe1bc('0x10')]||0x0;this[_0xe1bc('0x21')]=_0x44a556[_0xe1bc('0x21')];this[_0xe1bc('0x22')]=_0x44a556['dialMethod'];this['dialOriginateCallerIdName']=_0x44a556[_0xe1bc('0x23')];this['dialOriginateCallerIdNumber']=_0x44a556[_0xe1bc('0x24')];this['dialOriginateTimeout']=_0x44a556[_0xe1bc('0x25')];this['dialPrefix']=_0x44a556['dialPrefix'];this[_0xe1bc('0x26')]=_0x44a556[_0xe1bc('0x26')];this['outboundAnswerAgiCallsDay']=_0x44a556['outboundAnswerAgiCallsDay'];this[_0xe1bc('0x9')]=_0x44a556[_0xe1bc('0x9')];this[_0xe1bc('0xa')]=_0x44a556[_0xe1bc('0xa')];this[_0xe1bc('0xb')]=_0x44a556[_0xe1bc('0xb')];this[_0xe1bc('0xc')]=_0x44a556[_0xe1bc('0xc')];this[_0xe1bc('0x27')]=_0x44a556['outboundDropCallsDayACS'];this[_0xe1bc('0x28')]=_0x44a556[_0xe1bc('0x28')];this[_0xe1bc('0x29')]=_0x44a556['outboundDropCallsDayTimeout'];this[_0xe1bc('0xd')]=_0x44a556[_0xe1bc('0xd')];this[_0xe1bc('0xe')]=_0x44a556[_0xe1bc('0xe')];this[_0xe1bc('0x2a')]=_0x44a556['outboundOriginateFailureCallsDay'];this[_0xe1bc('0x2b')]=_0x44a556['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x44a556[_0xe1bc('0xf')];this[_0xe1bc('0x2c')]=_0x44a556[_0xe1bc('0x2c')];this['predictiveIntervalAnsweredCalls']=_0x44a556[_0xe1bc('0x2d')];this[_0xe1bc('0x2e')]=_0x44a556['predictiveIntervalAvgHoldtime'];this[_0xe1bc('0x2f')]=_0x44a556[_0xe1bc('0x2f')];this[_0xe1bc('0x30')]=_0x44a556[_0xe1bc('0x30')];this[_0xe1bc('0x31')]=_0x44a556[_0xe1bc('0x31')];this['predictiveIntervalErlangCalls']=_0x44a556[_0xe1bc('0x32')];this[_0xe1bc('0x33')]=_0x44a556['predictiveIntervalErlangCallsDroppedCalls'];this[_0xe1bc('0x34')]=_0x44a556['predictiveIntervalHitRate'];this[_0xe1bc('0x35')]=_0x44a556[_0xe1bc('0x35')];this[_0xe1bc('0x36')]=_0x44a556[_0xe1bc('0x36')];this['predictiveIntervalAvailable']=_0x44a556[_0xe1bc('0x37')];this[_0xe1bc('0x38')]=_0x44a556[_0xe1bc('0x38')];this[_0xe1bc('0x39')]=_0x44a556[_0xe1bc('0x39')];this[_0xe1bc('0x3a')]=_0x44a556[_0xe1bc('0x3a')];this[_0xe1bc('0x3b')]=_0x44a556[_0xe1bc('0x3b')];this[_0xe1bc('0x3c')]=_0x44a556[_0xe1bc('0x3c')];this[_0xe1bc('0x3d')]=_0x44a556[_0xe1bc('0x3d')];this[_0xe1bc('0x3e')]=_0x44a556['startPredictive'];this[_0xe1bc('0x3f')]=_0x44a556[_0xe1bc('0x3f')];this['message']=_0x44a556[_0xe1bc('0x40')];this['statusMessage']=_0x44a556[_0xe1bc('0x41')];}if(_0x44a556[_0xe1bc('0x42')]){this[_0xe1bc('0x42')]={'id':_0x44a556[_0xe1bc('0x42')]['id'],'name':_0x44a556[_0xe1bc('0x42')]['name'],'active':_0x44a556['Trunk'][_0xe1bc('0x43')],'callerid':_0x44a556[_0xe1bc('0x42')][_0xe1bc('0x44')]};}}VoiceQueueSummary[_0xe1bc('0x45')][_0xe1bc('0x46')]=function(_0xbe9e0e,_0x4e1479,_0x16d64c,_0x22bfd7){this[_0xe1bc('0x8')]=0x0;this['talking']=0x0;this[_0xe1bc('0x2')]=0x0;this['unknown']=0x0;this[_0xe1bc('0x19')]=0x0;this[_0xe1bc('0x7')]=0x0;this[_0xe1bc('0x16')]=0x0;this['invalid']=0x0;this[_0xe1bc('0x47')]=0x0;this[_0xe1bc('0x3')]=0x0;this[_0xe1bc('0x1a')]=0x0;this['onHold']=0x0;if(_0x16d64c){if(_0x16d64c[_0xe1bc('0x0')]){this['available']=Number(_0x16d64c['available']);}if(_0x16d64c['loggedin']){this['loggedIn']=Number(_0x16d64c['loggedin']);}if(_0x16d64c['callers']){this[_0xe1bc('0x5')]=Number(_0x16d64c[_0xe1bc('0x48')]);}}for(var _0x594ab5=0x0;_0x594ab5<_0xbe9e0e[_0xe1bc('0x49')];_0x594ab5++){var _0x3a2e0b=_0x4e1479[_0xe1bc('0x4a')+_0xbe9e0e[_0x594ab5]['name']];if(_0x3a2e0b&&_0x3a2e0b[_0xe1bc('0x4b')]){this[_0xe1bc('0x8')]+=0x1;}if(_0xbe9e0e[_0x594ab5][_0xe1bc('0x4c')]==='1'){this[_0xe1bc('0x4')]+=0x1;}if(_0xbe9e0e[_0x594ab5][_0xe1bc('0x2')]==='1'&&!['2','7','8']['includes'](_0xbe9e0e[_0x594ab5][_0xe1bc('0x4d')])){this[_0xe1bc('0x2')]+=0x1;}switch(_0xbe9e0e[_0x594ab5]['status']){case'0':this[_0xe1bc('0x1e')]+=0x1;break;case'1':this[_0xe1bc('0x19')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xe1bc('0x16')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xe1bc('0x47')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xe1bc('0x18')]+=0x1;break;}}if(this[_0xe1bc('0x22')]===_0xe1bc('0x4e')){var _0x1198d6=Object[_0xe1bc('0x4f')](_0x22bfd7);for(var _0x2dccb7=0x0;_0x2dccb7<_0x1198d6['length'];_0x2dccb7++){var _0x324740=_0x1198d6[_0x2dccb7];var _0x33c18e=_0x22bfd7[_0x324740];if(_0x33c18e['queue']===this[_0xe1bc('0x13')]&&_0x33c18e['type']===_0xe1bc('0x50')&&_0x33c18e['exten']===_0xe1bc('0x51')){this[_0xe1bc('0x4')]+=0x1;}}if(this[_0xe1bc('0x4')]>this['inUse']){this[_0xe1bc('0x4')]=this['inUse'];}this[_0xe1bc('0x10')]=0x0;}return this;};VoiceQueueSummary[_0xe1bc('0x45')][_0xe1bc('0x52')]=function(_0x58c3a9){var _0x167dd2=![];if(_0x58c3a9){_0x167dd2=INBOUND_COUNTERS['some'](function(_0x274131){return this[_0x274131]!==_0x58c3a9[_0x274131];},this);}return _0x167dd2;};VoiceQueueSummary[_0xe1bc('0x45')]['compareToOutboundQueue']=function(_0xca01ae){var _0x51d349=![];var _0x210b66=![];var _0x1c3b9c=![];if(_0xca01ae){_0x51d349=this['dialMethod']!==_0xca01ae[_0xe1bc('0x22')]||this[_0xe1bc('0x21')]!==_0xca01ae[_0xe1bc('0x21')]||this[_0xe1bc('0x40')]!==_0xca01ae[_0xe1bc('0x40')]||this[_0xe1bc('0x41')]!==_0xca01ae[_0xe1bc('0x41')];_0x210b66=OUTBOUND_COUNTERS[_0xe1bc('0x53')](function(_0x3edfb0){return this[_0x3edfb0]!==_0xca01ae[_0x3edfb0];},this);if(this['Trunk']&&_0xca01ae['Trunk']){_0x1c3b9c=this[_0xe1bc('0x42')][_0xe1bc('0x13')]!==_0xca01ae[_0xe1bc('0x42')][_0xe1bc('0x13')]||this[_0xe1bc('0x42')][_0xe1bc('0x43')]!==_0xca01ae['Trunk'][_0xe1bc('0x43')];}}return _0x51d349||_0x210b66||_0x1c3b9c;};VoiceQueueSummary[_0xe1bc('0x45')][_0xe1bc('0x54')]=function(_0x104d5f){this['answered']=_0x104d5f[_0xe1bc('0x6')];this[_0xe1bc('0x40')]=_0x104d5f[_0xe1bc('0x40')];this[_0xe1bc('0x41')]=_0x104d5f['statusMessage'];this[_0xe1bc('0x39')]=_0x104d5f['originated'];this[_0xe1bc('0x55')]=_0x104d5f['outboundAbandonedCallsDay'];this[_0xe1bc('0x9')]=_0x104d5f[_0xe1bc('0x9')];this[_0xe1bc('0xa')]=_0x104d5f[_0xe1bc('0xa')];this[_0xe1bc('0xb')]=_0x104d5f['outboundBusyCallsDay'];this[_0xe1bc('0xc')]=_0x104d5f['outboundCongestionCallsDay'];this[_0xe1bc('0xd')]=_0x104d5f[_0xe1bc('0xd')];this[_0xe1bc('0xe')]=_0x104d5f[_0xe1bc('0xe')];this[_0xe1bc('0x2b')]=_0x104d5f[_0xe1bc('0x2b')];this[_0xe1bc('0xf')]=_0x104d5f[_0xe1bc('0xf')];this[_0xe1bc('0x2c')]=_0x104d5f[_0xe1bc('0x2c')];this[_0xe1bc('0x1b')]=_0x104d5f['sumBillable'];this[_0xe1bc('0x11')]=_0x104d5f['sumDuration'];this[_0xe1bc('0x12')]=_0x104d5f[_0xe1bc('0x12')];if(this[_0xe1bc('0x22')]===_0xe1bc('0x56')){this[_0xe1bc('0x10')]=_0x104d5f['pTalking'];}};module[_0xe1bc('0x57')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index e359b4c..46f9eae 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 _0x83dd=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x297dcf,_0x448cf5){var _0xe1699b=function(_0x8b1e0f){while(--_0x8b1e0f){_0x297dcf['push'](_0x297dcf['shift']());}};_0xe1699b(++_0x448cf5);}(_0x83dd,0x12f));var _0xd83d=function(_0x191953,_0x19d9e3){_0x191953=_0x191953-0x0;var _0x2621a7=_0x83dd[_0x191953];return _0x2621a7;};'use strict';function VtigerAccount(_0x540116){this['id']=_0x540116['id']||0x0;this['name']=_0x540116[_0xd83d('0x0')]||'';this['username']=_0x540116[_0xd83d('0x1')]||'';this[_0xd83d('0x2')]=_0x540116[_0xd83d('0x2')]||'';this[_0xd83d('0x3')]=_0x540116[_0xd83d('0x3')]||'';this[_0xd83d('0x4')]=_0x540116[_0xd83d('0x4')]||'';this[_0xd83d('0x5')]=_0x540116[_0xd83d('0x5')]||{};}module[_0xd83d('0x6')]=VtigerAccount; \ No newline at end of file +var _0x2709=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2709,0x7c));var _0x9270=function(_0x176182,_0x1ea0f9){_0x176182=_0x176182-0x0;var _0x3ca33a=_0x2709[_0x176182];return _0x3ca33a;};'use strict';function VtigerAccount(_0x3a16eb){this['id']=_0x3a16eb['id']||0x0;this[_0x9270('0x0')]=_0x3a16eb[_0x9270('0x0')]||'';this[_0x9270('0x1')]=_0x3a16eb['username']||'';this[_0x9270('0x2')]=_0x3a16eb[_0x9270('0x2')]||'';this[_0x9270('0x3')]=_0x3a16eb[_0x9270('0x3')]||'';this['serverUrl']=_0x3a16eb[_0x9270('0x4')]||'';this[_0x9270('0x5')]=_0x3a16eb['Configurations']||{};}module[_0x9270('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 2a5d1fa..c515068 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 _0x9d6f=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x9d6f,0x142));var _0xf9d6=function(_0x2b42f8,_0x530453){_0x2b42f8=_0x2b42f8-0x0;var _0x1f21f6=_0x9d6f[_0x2b42f8];return _0x1f21f6;};'use strict';function ZendeskAccount(_0x3947e5){this['id']=_0x3947e5['id']||0x0;this[_0xf9d6('0x0')]=_0x3947e5['name']||'';this[_0xf9d6('0x1')]=_0x3947e5['username']||'';this[_0xf9d6('0x2')]=_0x3947e5[_0xf9d6('0x2')]||'';this['token']=_0x3947e5[_0xf9d6('0x3')]||'';this[_0xf9d6('0x4')]=_0x3947e5['remoteUri']||'';this[_0xf9d6('0x5')]=_0x3947e5['authType']||'';this[_0xf9d6('0x6')]=_0x3947e5[_0xf9d6('0x6')]||_0xf9d6('0x7');this[_0xf9d6('0x8')]=_0x3947e5[_0xf9d6('0x8')]||'';this[_0xf9d6('0x9')]=_0x3947e5[_0xf9d6('0x9')]||{};}module[_0xf9d6('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xb760=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x2d1bb6,_0x143353){var _0x163b98=function(_0x8a31df){while(--_0x8a31df){_0x2d1bb6['push'](_0x2d1bb6['shift']());}};_0x163b98(++_0x143353);}(_0xb760,0xd9));var _0x0b76=function(_0x159aac,_0x29ed63){_0x159aac=_0x159aac-0x0;var _0x3a8b01=_0xb760[_0x159aac];return _0x3a8b01;};'use strict';function ZendeskAccount(_0x172994){this['id']=_0x172994['id']||0x0;this[_0x0b76('0x0')]=_0x172994['name']||'';this[_0x0b76('0x1')]=_0x172994[_0x0b76('0x1')]||'';this[_0x0b76('0x2')]=_0x172994['password']||'';this[_0x0b76('0x3')]=_0x172994[_0x0b76('0x3')]||'';this[_0x0b76('0x4')]=_0x172994['remoteUri']||'';this['authType']=_0x172994[_0x0b76('0x5')]||'';this[_0x0b76('0x6')]=_0x172994['type']||_0x0b76('0x7');this[_0x0b76('0x8')]=_0x172994[_0x0b76('0x8')]||'';this[_0x0b76('0x9')]=_0x172994[_0x0b76('0x9')]||{};}module[_0x0b76('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 1331e2c..855a154 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 _0x47cb=['refreshToken','Configurations','host','zone','clientId','serverUrl','code'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x47cb,0x1e5));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';function ZohoAccount(_0x4ed94b){this['id']=_0x4ed94b['id']||0x0;this['name']=_0x4ed94b['name']||'';this['description']=_0x4ed94b['description']||'';this[_0xb47c('0x0')]=_0x4ed94b[_0xb47c('0x0')]||'';this[_0xb47c('0x1')]=_0x4ed94b[_0xb47c('0x1')]||'';this['clientId']=_0x4ed94b[_0xb47c('0x2')]||'';this['clientSecret']=_0x4ed94b['clientSecret']||'';this[_0xb47c('0x3')]=_0x4ed94b[_0xb47c('0x3')]||'';this[_0xb47c('0x4')]=_0x4ed94b[_0xb47c('0x4')]||'';this[_0xb47c('0x5')]=_0x4ed94b[_0xb47c('0x5')]||'';this['Configurations']=_0x4ed94b[_0xb47c('0x6')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xed63=['serverUrl','code','refreshToken','Configurations','exports','name','description','clientId','clientSecret'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xed63,0xf8));var _0x3ed6=function(_0xa9ca64,_0x5c2421){_0xa9ca64=_0xa9ca64-0x0;var _0x3b798b=_0xed63[_0xa9ca64];return _0x3b798b;};'use strict';function ZohoAccount(_0x3ffce9){this['id']=_0x3ffce9['id']||0x0;this[_0x3ed6('0x0')]=_0x3ffce9[_0x3ed6('0x0')]||'';this[_0x3ed6('0x1')]=_0x3ffce9[_0x3ed6('0x1')]||'';this['host']=_0x3ffce9['host']||'';this['zone']=_0x3ffce9['zone']||'';this['clientId']=_0x3ffce9[_0x3ed6('0x2')]||'';this['clientSecret']=_0x3ffce9[_0x3ed6('0x3')]||'';this[_0x3ed6('0x4')]=_0x3ffce9[_0x3ed6('0x4')]||'';this[_0x3ed6('0x5')]=_0x3ffce9[_0x3ed6('0x5')]||'';this['refreshToken']=_0x3ffce9[_0x3ed6('0x6')]||'';this[_0x3ed6('0x7')]=_0x3ffce9[_0x3ed6('0x7')]||{};}module[_0x3ed6('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 0a61882..2b4b79b 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 _0x627e=['SIP/%s','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','campaigntype','queue','Agent','channelAgent','membername','format'];(function(_0x103498,_0x3df764){var _0x192b3e=function(_0x4d3e25){while(--_0x4d3e25){_0x103498['push'](_0x103498['shift']());}};_0x192b3e(++_0x3df764);}(_0x627e,0x14a));var _0xe627=function(_0x127b92,_0x2bc850){_0x127b92=_0x127b92-0x0;var _0x5889ee=_0x627e[_0x127b92];return _0x5889ee;};'use strict';var util=require(_0xe627('0x0'));var _=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));function checkNameSurname(_0x18dba3,_0x3afa80,_0x48b97a){var _0x2b7158='';if(!_[_0xe627('0x3')](_0x3afa80)&&_0xe627('0x4')===typeof _0x3afa80){_0x2b7158+=_0x3afa80;}if(!_['isNil'](_0x48b97a)&&'string'===typeof _0x48b97a){_0x2b7158+='\x20'+_0x48b97a;}if(_0x2b7158!==''){return _0x2b7158;}return _0x18dba3;}function Action(_0x4efcad,_0x1a1a3d,_0x3f2791,_0x45e49a,_0x2d4f63){this[_0xe627('0x5')]=_0x3f2791||undefined;this[_0xe627('0x6')]=_0x4efcad['id'];this['queue']=_0x1a1a3d[_0xe627('0x7')];this['type']=_0x1a1a3d['type'];this[_0xe627('0x8')]=_0xe627('0x9');this['dialAnswer']=![];this['membername']=_[_0xe627('0x3')](_0x4efcad[_0xe627('0xa')])?undefined:_0x4efcad[_0xe627('0xa')][_0xe627('0x7')];this[_0xe627('0xb')]=this[_0xe627('0xc')]?util[_0xe627('0xd')](_0xe627('0xe'),this[_0xe627('0xc')]):_0x45e49a||undefined;this['calleridname']=checkNameSurname(_0x4efcad[_0xe627('0xf')][_0xe627('0x10')],_0x4efcad[_0xe627('0xf')]['firstName'],_0x4efcad[_0xe627('0xf')][_0xe627('0x11')]);this[_0xe627('0x12')]=_0x4efcad[_0xe627('0x12')]||![];this[_0xe627('0x13')]=_0x4efcad[_0xe627('0x10')];this[_0xe627('0x14')]=_0x4efcad['scheduledat'];this[_0xe627('0x15')]=_0x4efcad[_0xe627('0x15')]||0x0;this[_0xe627('0x16')]=_0x4efcad[_0xe627('0x16')]||0x0;this[_0xe627('0x17')]=_0x4efcad[_0xe627('0x17')]||0x0;this[_0xe627('0x18')]=(_0x4efcad[_0xe627('0x15')]||0x0)+(_0x4efcad['countcongestionretry']||0x0)+(_0x4efcad[_0xe627('0x17')]||0x0)+(_0x4efcad['countnosuchnumberretry']||0x0)+(_0x4efcad[_0xe627('0x19')]||0x0)+(_0x4efcad['countabandonedretry']||0x0)+(_0x4efcad['countmachineretry']||0x0)+(_0x4efcad[_0xe627('0x1a')]||0x0);this['countnosuchnumberretry']=_0x4efcad[_0xe627('0x1b')]||0x0;this[_0xe627('0x19')]=_0x4efcad['countdropretry']||0x0;this['countabandonedretry']=_0x4efcad['countabandonedretry']||0x0;this[_0xe627('0x1c')]=_0x4efcad[_0xe627('0x1c')]||0x0;this['countagentrejectretry']=_0x4efcad[_0xe627('0x1a')]||0x0;this[_0xe627('0x1d')]=_0x4efcad['callback'];this[_0xe627('0x1e')]=_0x4efcad[_0xe627('0x1e')];this['callbackat']=_0x4efcad[_0xe627('0x1f')];this[_0xe627('0x20')]=_0x4efcad[_0xe627('0x20')];this['ContactId']=_0x4efcad[_0xe627('0x21')];this[_0xe627('0x22')]=_0x4efcad[_0xe627('0x22')];this[_0xe627('0x23')]=_['isNil'](_0x4efcad[_0xe627('0xa')])?_0x4efcad[_0xe627('0x23')]:_0x4efcad[_0xe627('0xa')]['id'];this[_0xe627('0x24')]=_0x4efcad[_0xe627('0x24')];this[_0xe627('0x25')]='';this[_0xe627('0x26')]='';}Action[_0xe627('0x27')][_0xe627('0x28')]=function(){return util['format'](_0xe627('0x29'),this['calleridname'],this['number']);};module[_0xe627('0x2a')]=Action; \ No newline at end of file +var _0x4991=['ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','number','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','SIP/%s','calleridname','Contact','phone','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x5327c1,_0x207fe9){var _0x1a8bf9=function(_0x319cac){while(--_0x319cac){_0x5327c1['push'](_0x5327c1['shift']());}};_0x1a8bf9(++_0x207fe9);}(_0x4991,0xf7));var _0x1499=function(_0xe2de87,_0x5cf8b0){_0xe2de87=_0xe2de87-0x0;var _0x710203=_0x4991[_0xe2de87];return _0x710203;};'use strict';var util=require(_0x1499('0x0'));var _=require('lodash');var moment=require(_0x1499('0x1'));function checkNameSurname(_0x5bd577,_0x30d640,_0x256e41){var _0x16ac22='';if(!_[_0x1499('0x2')](_0x30d640)&&_0x1499('0x3')===typeof _0x30d640){_0x16ac22+=_0x30d640;}if(!_[_0x1499('0x2')](_0x256e41)&&_0x1499('0x3')===typeof _0x256e41){_0x16ac22+='\x20'+_0x256e41;}if(_0x16ac22!==''){return _0x16ac22;}return _0x5bd577;}function Action(_0x209616,_0x4b6154,_0x2a8e96,_0x1c3bd7,_0x1c65c3){this[_0x1499('0x4')]=_0x2a8e96||undefined;this[_0x1499('0x5')]=_0x209616['id'];this[_0x1499('0x6')]=_0x4b6154[_0x1499('0x7')];this[_0x1499('0x8')]=_0x4b6154['type'];this[_0x1499('0x9')]=_0x1499('0x6');this['dialAnswer']=![];this[_0x1499('0xa')]=_[_0x1499('0x2')](_0x209616['Agent'])?undefined:_0x209616[_0x1499('0xb')][_0x1499('0x7')];this['channelAgent']=this['membername']?util['format'](_0x1499('0xc'),this[_0x1499('0xa')]):_0x1c3bd7||undefined;this[_0x1499('0xd')]=checkNameSurname(_0x209616[_0x1499('0xe')][_0x1499('0xf')],_0x209616['Contact']['firstName'],_0x209616[_0x1499('0xe')]['lastName']);this[_0x1499('0x10')]=_0x209616[_0x1499('0x10')]||![];this[_0x1499('0x11')]=_0x209616[_0x1499('0xf')];this['scheduledat']=_0x209616[_0x1499('0x12')];this[_0x1499('0x13')]=_0x209616['countbusyretry']||0x0;this[_0x1499('0x14')]=_0x209616[_0x1499('0x14')]||0x0;this[_0x1499('0x15')]=_0x209616[_0x1499('0x15')]||0x0;this[_0x1499('0x16')]=(_0x209616[_0x1499('0x13')]||0x0)+(_0x209616['countcongestionretry']||0x0)+(_0x209616['countnoanswerretry']||0x0)+(_0x209616['countnosuchnumberretry']||0x0)+(_0x209616[_0x1499('0x17')]||0x0)+(_0x209616[_0x1499('0x18')]||0x0)+(_0x209616['countmachineretry']||0x0)+(_0x209616[_0x1499('0x19')]||0x0);this[_0x1499('0x1a')]=_0x209616[_0x1499('0x1a')]||0x0;this[_0x1499('0x17')]=_0x209616[_0x1499('0x17')]||0x0;this[_0x1499('0x18')]=_0x209616[_0x1499('0x18')]||0x0;this[_0x1499('0x1b')]=_0x209616[_0x1499('0x1b')]||0x0;this[_0x1499('0x19')]=_0x209616[_0x1499('0x19')]||0x0;this[_0x1499('0x1c')]=_0x209616[_0x1499('0x1c')];this[_0x1499('0x1d')]=_0x209616[_0x1499('0x1d')];this[_0x1499('0x1e')]=_0x209616[_0x1499('0x1e')];this['recallme']=_0x209616[_0x1499('0x1f')];this[_0x1499('0x20')]=_0x209616[_0x1499('0x20')];this[_0x1499('0x21')]=_0x209616[_0x1499('0x21')];this[_0x1499('0x22')]=_['isNil'](_0x209616['Agent'])?_0x209616[_0x1499('0x22')]:_0x209616[_0x1499('0xb')]['id'];this[_0x1499('0x23')]=_0x209616[_0x1499('0x23')];this[_0x1499('0x24')]='';this['originatecalleridname']='';}Action[_0x1499('0x25')]['getCaller']=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x1499('0xd')],this[_0x1499('0x26')]);};module[_0x1499('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 0c08cbe..ab784ac 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 _0xd4fe=['[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[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','TrunkBackup','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','Trunk','SIP/%s/%s%s','dialCutDigit','substring','dialPrefix','trim','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','Contact','assign','merge','toLowerVariables','starttime','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','lookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','Answer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','filterKey','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','ioredis','../../../config/environment','../../../config/logger','preview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','syncCampaigns','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','type','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','originated','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','Action','status','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','getDiff','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','format','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','countnosuchnumberretry','unlockAgent','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','complete','total','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','swapAdditionalPhones','CONGESTION','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','countcongestionretry','CANCEL','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countagentrejectretry','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]'];(function(_0x40527d,_0x311e0c){var _0x3f9a90=function(_0x202713){while(--_0x202713){_0x40527d['push'](_0x40527d['shift']());}};_0x3f9a90(++_0x311e0c);}(_0xd4fe,0x1c5));var _0xed4f=function(_0x14d112,_0x26a038){_0x14d112=_0x14d112-0x0;var _0x40bc7e=_0xd4fe[_0x14d112];return _0x40bc7e;};'use strict';var util=require(_0xed4f('0x0'));var _=require(_0xed4f('0x1'));var uuid=require('uuid');var moment=require(_0xed4f('0x2'));var Redis=require(_0xed4f('0x3'));var config=require(_0xed4f('0x4'));var logger=require(_0xed4f('0x5'))(_0xed4f('0x6'));var loggerAction=require(_0xed4f('0x5'))('actionPreview');var ami=require(_0xed4f('0x7'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xed4f('0x8'));var Action=require(_0xed4f('0x9'));var ut=require(_0xed4f('0xa'));var utils=require('../dialer/utils');config[_0xed4f('0xb')]=_[_0xed4f('0xc')](config[_0xed4f('0xb')],{'host':_0xed4f('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xed4f('0xb')]));var Sequence=function(){};Sequence[_0xed4f('0xe')][_0xed4f('0xf')]=function(_0x52ebb5){this[_0xed4f('0x10')]=this[_0xed4f('0x10')]?this[_0xed4f('0x10')][_0xed4f('0x11')](_0x52ebb5):_0x52ebb5();};function Preview(_0x32e5ed){this[_0xed4f('0x12')]=new Sequence();this[_0xed4f('0x13')]=_0x32e5ed[_0xed4f('0x14')];this[_0xed4f('0x15')]=_0x32e5ed[_0xed4f('0x15')];this[_0xed4f('0x16')]={};this[_0xed4f('0x17')]=_0x32e5ed[_0xed4f('0x17')];this[_0xed4f('0x18')]=0x0;ami['on'](_0xed4f('0x19'),this[_0xed4f('0x1a')][_0xed4f('0x1b')](this));ami['on']('hangup',this[_0xed4f('0x1c')][_0xed4f('0x1b')](this));ami['on'](_0xed4f('0x1d'),this['syncHangupRequest'][_0xed4f('0x1b')](this));ami['on'](_0xed4f('0x1e'),this[_0xed4f('0x1f')][_0xed4f('0x1b')](this));ami['on'](_0xed4f('0x20'),this['syncNewExten'][_0xed4f('0x1b')](this));ami['on'](_0xed4f('0x21'),this[_0xed4f('0x22')][_0xed4f('0x1b')](this));ami['on'](_0xed4f('0x23'),this[_0xed4f('0x24')][_0xed4f('0x1b')](this));ami['on'](_0xed4f('0x25'),this[_0xed4f('0x26')][_0xed4f('0x1b')](this));this[_0xed4f('0x27')](this[_0xed4f('0x13')]);}function emit(_0x289137,_0x534240,_0x11b7a9){io['to'](_0x289137)[_0xed4f('0x28')](_0x534240,_0x11b7a9);}function emitVoiceQueueChannelRemove(_0x201c80){logger[_0xed4f('0x29')](_0xed4f('0x2a'),JSON[_0xed4f('0x2b')](_0x201c80));emit(util['format'](_0xed4f('0x2c'),_0x201c80[_0xed4f('0x2d')]),_0xed4f('0x2e'),_0x201c80);io[_0xed4f('0x28')](_0xed4f('0x2f'),_0x201c80);}function notSendMessagesQueue(_0x3d054d){if(_0x3d054d[_0xed4f('0x30')]){if(_0x3d054d['originated']===0x0&&_0x3d054d[_0xed4f('0x31')]===0x0){_0x3d054d[_0xed4f('0x30')]=![];_0x3d054d[_0xed4f('0x32')]=0x0;_0x3d054d[_0xed4f('0x33')]=0x0;_0x3d054d[_0xed4f('0x34')]=utils[_0xed4f('0x35')][_0xed4f('0x36')];ut[_0xed4f('0x37')](_0xed4f('0x38'),_0x3d054d[_0xed4f('0x2d')]+'\x20is\x20not\x20active');}else{_0x3d054d['message']=utils[_0xed4f('0x35')][_0xed4f('0x39')];ut[_0xed4f('0x37')](_0xed4f('0x38'),_0x3d054d['name']+'\x20is\x20deactivated');}}}Preview[_0xed4f('0xe')][_0xed4f('0x27')]=function(){var _0x46252b=this;setInterval(function(){_0x46252b[_0xed4f('0x3a')]();},0x7cf);};Preview[_0xed4f('0xe')]['syncCampaigns']=function(){var _0x29b987=this['campaignsPreview'];this[_0xed4f('0x18')]+=0x1;for(var _0x4e72a4 in _0x29b987){if(_0x29b987[_0xed4f('0x3b')](_0x4e72a4)&&(_0x29b987[_0x4e72a4][_0xed4f('0x3c')]===_0xed4f('0x6')||_0x29b987[_0x4e72a4][_0xed4f('0x3c')]===_0xed4f('0x3d'))&&_0x29b987[_0x4e72a4]['type']===_0xed4f('0x3e')){if(this[_0xed4f('0x18')]>0x7){this[_0xed4f('0x18')]=0x0;this[_0xed4f('0x3f')]();}}if(_0x29b987[_0xed4f('0x3b')](_0x4e72a4)&&_0x29b987[_0x4e72a4][_0xed4f('0x3c')]===_0xed4f('0x6')&&_0x29b987[_0x4e72a4][_0xed4f('0x40')]===_0xed4f('0x3e')){if(_0x29b987[_0x4e72a4][_0xed4f('0x41')]){this[_0xed4f('0x42')](_0x29b987[_0x4e72a4]);if(_0x29b987[_0x4e72a4]['dialPreviewAutoRecallMe'])this[_0xed4f('0x43')](_0x29b987[_0x4e72a4]);}else{notSendMessagesQueue(_0x29b987[_0x4e72a4]);}}}};Preview['prototype'][_0xed4f('0x44')]=function(_0x4eff68){var _0x224782=this;this[_0xed4f('0x12')][_0xed4f('0xf')](function(){if(!_[_0xed4f('0x45')](_0x224782['actions'][_0x4eff68])){loggerAction[_0xed4f('0x29')](_0xed4f('0x46'),_0x4eff68,_0xed4f('0x47'),_0x224782[_0xed4f('0x16')][_0x4eff68][_0xed4f('0x48')],_0xed4f('0x49'),JSON['stringify'](_0x224782[_0xed4f('0x13')][_0x224782[_0xed4f('0x16')][_0x4eff68]['queue']][_0xed4f('0x4a')]),_0xed4f('0x4b'),JSON[_0xed4f('0x2b')](_0x224782['campaignsPreview'][_0x224782[_0xed4f('0x16')][_0x4eff68][_0xed4f('0x48')]][_0xed4f('0x31')]),JSON['stringify'](_0x224782['actions'][_0x4eff68][_0xed4f('0x4c')]),JSON[_0xed4f('0x2b')](_[_0xed4f('0x4d')](_0x224782[_0xed4f('0x16')][_0x4eff68],['contactId',_0xed4f('0x4e'),_0xed4f('0x4f'),'ListId'])));return ami[_0xed4f('0x50')]({'action':_0xed4f('0x51'),'channel':_0x224782[_0xed4f('0x16')][_0x4eff68]['channel']})[_0xed4f('0x52')](function(_0x19e7cf){if(_0x19e7cf['message']===_0xed4f('0x53')){setTimeout(function(){if(_0x224782[_0xed4f('0x16')][_0x4eff68]){utils[_0xed4f('0x54')](_0x224782[_0xed4f('0x13')][_0x224782[_0xed4f('0x16')][_0x4eff68]['queue']],_0xed4f('0x55'));if(_0x224782['actions'][_0x4eff68][_0xed4f('0x4c')]===!![]){ut[_0xed4f('0x56')](_0x224782[_0xed4f('0x13')][_0x224782[_0xed4f('0x16')][_0x4eff68][_0xed4f('0x48')]],_0xed4f('0x55'));ut[_0xed4f('0x57')](_0xed4f('0x58')+_0x4eff68,_0x224782[_0xed4f('0x16')][_0x4eff68][_0xed4f('0x48')]);}ut['loggerError'](_0xed4f('0x59')+_0x4eff68,_0x224782['actions'][_0x4eff68][_0xed4f('0x48')]);delete _0x224782[_0xed4f('0x16')][_0x4eff68];}},0x2328);}});}});};Preview[_0xed4f('0xe')][_0xed4f('0x3f')]=function(){var _0x12748a=this;loggerAction[_0xed4f('0x29')](_0xed4f('0x5a'),_[_0xed4f('0x5b')](this['actions']));for(var _0x5ef104 in this[_0xed4f('0x16')]){if(_0x12748a[_0xed4f('0x16')][_0xed4f('0x3b')](_0x5ef104)){_0x12748a[_0xed4f('0x44')](_0x5ef104);}}};Preview['prototype']['recallMe']=function(_0x1544cb){var _0x2b5874=this;rpcDb[_0xed4f('0x5c')](_0x1544cb['id'],ut['agentReadyId'](this['agents']))[_0xed4f('0x5d')](function(_0x3a1c58){if(!_[_0xed4f('0x45')](_0x3a1c58)){for(var _0x9cc2d7=0x0;_0x9cc2d7<_0x3a1c58['length'];_0x9cc2d7+=0x1){if(ut[_0xed4f('0x5e')](_0x3a1c58[_0x9cc2d7]['scheduledat'])<_0x1544cb[_0xed4f('0x5f')]*0x3c){if(_0x3a1c58[_0x9cc2d7][_0xed4f('0x60')]&&!_0x3a1c58[_0x9cc2d7][_0xed4f('0x60')][_0xed4f('0x61')]){_0x2b5874['run'](_0x3a1c58[_0x9cc2d7]['id'])[_0xed4f('0x5d')](ut[_0xed4f('0x62')]('[RecallMe]'))[_0xed4f('0x52')](ut[_0xed4f('0x62')](_0xed4f('0x63')));}else{rpcDb[_0xed4f('0x64')](_0x3a1c58[_0x9cc2d7]['id']);}}else{var _0x54296a=new Action(_0x3a1c58[_0x9cc2d7],_0x1544cb);_0x54296a['starttime']=moment()[_0xed4f('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x1544cb[_0xed4f('0x66')]+=0x1;ut[_0xed4f('0x67')](_0x54296a,0x17,_0xed4f('0x68'));if(_0x1544cb['dialRecallInQueue']){rpcDb[_0xed4f('0x69')](ut[_0xed4f('0x6a')](_0x3a1c58[_0x9cc2d7]));rpcDb[_0xed4f('0x6b')](_0x54296a,_0xed4f('0x6c'));}else{ut[_0xed4f('0x67')](_0x54296a,0x16,_0xed4f('0x6d'));rpcDb[_0xed4f('0x6b')](_0x54296a,_0xed4f('0x6e'));rpcDb[_0xed4f('0x6f')](_0x54296a,_0xed4f('0x6e'));}}}}})['catch'](ut[_0xed4f('0x62')](_0xed4f('0x70')));};Preview[_0xed4f('0xe')][_0xed4f('0x42')]=function(_0x58ec5a){_0x58ec5a[_0xed4f('0x30')]=!![];if(ut[_0xed4f('0x71')](_0x58ec5a[_0xed4f('0x72')])){_0x58ec5a['message']=utils[_0xed4f('0x35')][_0xed4f('0x73')];}else if(!ut[_0xed4f('0x74')](_0x58ec5a[_0xed4f('0x41')])){_0x58ec5a[_0xed4f('0x34')]=utils[_0xed4f('0x35')][_0xed4f('0x36')];}else if(!this[_0xed4f('0x75')](_0x58ec5a['Trunk'])){if(!this['isTrunkReachable'](_0x58ec5a['TrunkBackup'])){_0x58ec5a[_0xed4f('0x34')]=utils[_0xed4f('0x35')][_0xed4f('0x76')];}else{_0x58ec5a[_0xed4f('0x34')]=utils[_0xed4f('0x35')]['ACTIVE'];}}else{_0x58ec5a['message']=utils['CAMPAIGN_STATUS'][_0xed4f('0x77')];}};Preview['prototype'][_0xed4f('0x78')]=function(_0x4ebf12,_0x5a5bb0,_0x4c91eb){var _0x419c70=this;var _0xb82f2d=this[_0xed4f('0x16')][_0x5a5bb0];var _0x154f98=this['campaignsPreview'][_0xb82f2d[_0xed4f('0x48')]];var _0x457065;var _0x114d9a=![];var _0x2ba3a3=0x2;var _0x89f628=0x3;if(_0x154f98){switch(_0x4c91eb){case'1':_0x154f98[_0xed4f('0x79')]+=0x1;_0xb82f2d['countnosuchnumberretry']+=0x1;_0xb82f2d[_0xed4f('0x7a')]=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0x0,_0xed4f('0x7c'));ami[_0xed4f('0x28')]('custom:agentnosuchnumber',ut[_0xed4f('0x7d')](_0xb82f2d,_0xed4f('0x7e')));rpcDb['createCustomerHistory'](_0xb82f2d,_0xed4f('0x7f'));_0x419c70[_0xed4f('0x80')](_0xb82f2d,'0',_0x154f98)[_0xed4f('0x5d')](function(_0x1c7c47){_0x114d9a=_0x1c7c47[_0xed4f('0x81')]==0x1;_0x2ba3a3=_0x154f98[_0xed4f('0x82')];_0x89f628=_0x154f98['callAdditionalPhoneAfterMin'];if(!_0x114d9a){if(ut[_0xed4f('0x7b')](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0xf,_0xed4f('0x85'));rpcDb[_0xed4f('0x6f')](_0x457065,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0xb82f2d['countnosuchnumberretry']>=_0x154f98[_0xed4f('0x86')]){rpcDb[_0xed4f('0x6f')](_0xb82f2d,_0xed4f('0x87'));}else{rpcDb['rescheduleContact'](ut[_0xed4f('0x88')](_0xb82f2d,_0xed4f('0x89'),_0x154f98[_0xed4f('0x82')]),_0xb82f2d[_0xed4f('0x8a')],_0xb82f2d[_0xed4f('0x8b')]);}}delete this['actions'][_0x4ebf12[_0xed4f('0x8c')]];}else{_0xb82f2d[_0xed4f('0x89')]++;logger['info'](_0xed4f('0x8d'),_0xb82f2d[_0xed4f('0x89')]);logger['info']('id',_0xb82f2d['idContact']);_0x419c70[_0xed4f('0x8e')]({'id':_0xb82f2d[_0xed4f('0x8f')],'field':{'countnosuchnumberretry':_0xb82f2d[_0xed4f('0x89')]}})[_0xed4f('0x5d')](function(){_0x419c70['swapAdditionalPhones'](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});});}});break;case _0xed4f('0x90'):var _0x817bf3=moment()[_0xed4f('0x65')](_0xed4f('0x91'));_0xb82f2d[_0xed4f('0x92')]=_0x817bf3;_0xb82f2d[_0xed4f('0x93')]=_0x817bf3;_0xb82f2d[_0xed4f('0x4c')]=!![];_0x154f98[_0xed4f('0x31')]+=0x1;logger[_0xed4f('0x29')](_0xed4f('0x94'),_0xb82f2d[_0xed4f('0x95')],_0xed4f('0x96'),_0x154f98[_0xed4f('0x2d')],_0xed4f('0x4b'),_0x154f98[_0xed4f('0x31')]);ami['emit'](_0xed4f('0x97'),ut[_0xed4f('0x7d')](_0xb82f2d,_0xed4f('0x98'),this[_0xed4f('0x13')][_0xb82f2d[_0xed4f('0x48')]]));if(_0x154f98[_0xed4f('0x99')]||_0x154f98[_0xed4f('0x9a')]){ami[_0xed4f('0x28')](_0xed4f('0x9b'),{'queue':_0xb82f2d[_0xed4f('0x48')],'interface':_0xb82f2d[_0xed4f('0x9c')],'uniqueid':_0xb82f2d['uniqueid']});}break;case'16':ami['emit']('custom:agentcomplete',ut['buildObj'](_0xb82f2d,_0xed4f('0x9d'),this[_0xed4f('0x13')][_0xb82f2d[_0xed4f('0x48')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0xb82f2d,_0xed4f('0x9d')));_0x154f98['outboundAnswerCallsDay']+=0x1;_0x154f98[_0xed4f('0x9e')]+=0x1;_0x154f98['answered']+=0x1;ut['decrementTalking'](_0x154f98,'[16]');_0xb82f2d[_0xed4f('0x7a')]=ut['totalGlobal'](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0x4,'Answer');rpcDb['createCustomerHistory'](_0xb82f2d,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xed4f('0x6f')](_0xb82f2d,_0xed4f('0x9f'));rpcDb[_0xed4f('0xa0')](_0xb82f2d);_0x154f98[_0xed4f('0xa1')]+=_0xb82f2d[_0xed4f('0xa2')];_0x154f98['sumBillable']+=_0xb82f2d['talktime'];logger[_0xed4f('0x29')](_0xed4f('0xa3'),_0xb82f2d['uniqueid'],_0xed4f('0x96'),_0x154f98[_0xed4f('0x2d')],'pTalking:\x20',_0x154f98['pTalking']);delete this[_0xed4f('0x16')][_0x4ebf12[_0xed4f('0x8c')]];break;case _0xed4f('0xa4'):_0x154f98[_0xed4f('0xa5')]+=0x1;_0xb82f2d[_0xed4f('0xa6')]+=0x1;_0xb82f2d[_0xed4f('0x7a')]=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0x5,_0xed4f('0xa7'));_0x2ba3a3=_0x154f98['dialBusyRetryFrequency'];_0x89f628=_0x154f98[_0xed4f('0xa8')];ami[_0xed4f('0x28')](_0xed4f('0xa9'),ut['buildObj'](_0xb82f2d,_0xed4f('0xaa')));rpcDb[_0xed4f('0x6b')](_0xb82f2d,_0xed4f('0xab'));_0x419c70['verifyAdditionalPhones'](_0xb82f2d,'5',_0x154f98)['then'](function(_0x9b009a){_0x114d9a=_0x9b009a[_0xed4f('0x81')]==0x1;if(!_0x114d9a){if(ut[_0xed4f('0x7b')](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0xf,'Global');rpcDb[_0xed4f('0x6f')](_0x457065,_0xed4f('0xac'));}else{if(_0xb82f2d[_0xed4f('0xa6')]>=_0x154f98[_0xed4f('0xad')]){rpcDb[_0xed4f('0x6f')](_0xb82f2d,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xed4f('0xae')](ut[_0xed4f('0x88')](_0xb82f2d,_0xed4f('0xa6'),_0x154f98[_0xed4f('0xaf')]),_0xb82f2d[_0xed4f('0x8a')],_0xb82f2d[_0xed4f('0x8b')]);}}}else{_0xb82f2d[_0xed4f('0xa6')]++;_0x419c70[_0xed4f('0x8e')]({'id':_0xb82f2d[_0xed4f('0x8f')],'field':{'countbusyretry':_0xb82f2d[_0xed4f('0xa6')]}})[_0xed4f('0x5d')](function(){_0x419c70['swapAdditionalPhones'](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});});}});break;case _0xed4f('0xb0'):_0x154f98[_0xed4f('0xb1')]+=0x1;_0xb82f2d['countnoanswerretry']+=0x1;_0xb82f2d[_0xed4f('0x7a')]=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0x3,_0xed4f('0xb2'));_0x2ba3a3=_0x154f98[_0xed4f('0xb3')];_0x89f628=_0x154f98[_0xed4f('0xa8')];var _0x1843d9=ut[_0xed4f('0xb4')](_0xb82f2d,_0x154f98);ami[_0xed4f('0x28')](_0xed4f('0xb5'),_0x1843d9);rpcDb[_0xed4f('0x6b')](_0xb82f2d,_0xed4f('0xb6'));_0x419c70[_0xed4f('0x80')](_0xb82f2d,'3',_0x154f98)[_0xed4f('0x5d')](function(_0x329501){_0x114d9a=_0x329501['additional']==0x1;if(!_0x114d9a){if(ut['totalGlobal'](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0xf,'Global');rpcDb[_0xed4f('0x6f')](_0x457065,_0xed4f('0xb7'));}else{if(_0xb82f2d[_0xed4f('0xb8')]>=_0x154f98[_0xed4f('0xb9')]){rpcDb['createCustomerFinal'](_0xb82f2d,_0xed4f('0xb6'));}else{rpcDb['rescheduleContact'](ut[_0xed4f('0x88')](_0xb82f2d,_0xed4f('0xb8'),_0x154f98[_0xed4f('0xb3')]),_0xb82f2d['unlockAgent'],_0xb82f2d[_0xed4f('0x8b')]);}}}else{_0xb82f2d[_0xed4f('0xb8')]++;_0x419c70['incrementPreviewCounters']({'id':_0xb82f2d[_0xed4f('0x8f')],'field':{'countnoanswerretry':_0xb82f2d[_0xed4f('0xb8')]}})[_0xed4f('0x5d')](function(){_0x419c70[_0xed4f('0xba')](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});});}});break;case _0xed4f('0xbb'):_0x154f98[_0xed4f('0xbc')]+=0x1;_0xb82f2d['countcongestionretry']+=0x1;_0xb82f2d[_0xed4f('0x7a')]=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0x8,_0xed4f('0xbd'));_0x2ba3a3=_0x154f98[_0xed4f('0xbe')];_0x89f628=_0x154f98[_0xed4f('0xa8')];ami[_0xed4f('0x28')](_0xed4f('0xbf'),ut[_0xed4f('0x7d')](_0xb82f2d,_0xed4f('0xc0')));rpcDb[_0xed4f('0x6b')](_0xb82f2d,_0xed4f('0xc1'));_0x419c70[_0xed4f('0x80')](_0xb82f2d,'8',_0x154f98)[_0xed4f('0x5d')](function(_0x54367a){_0x114d9a=_0x54367a['additional']==0x1;if(!_0x114d9a){if(ut[_0xed4f('0x7b')](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0xf,_0xed4f('0x85'));rpcDb[_0xed4f('0x6f')](_0x457065,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0xb82f2d['countcongestionretry']>=_0x154f98[_0xed4f('0xc2')]){rpcDb[_0xed4f('0x6f')](_0xb82f2d,_0xed4f('0xc1'));}else{rpcDb[_0xed4f('0xae')](ut[_0xed4f('0x88')](_0xb82f2d,_0xed4f('0xc3'),_0x154f98[_0xed4f('0xaf')]),_0xb82f2d['unlockAgent'],_0xb82f2d[_0xed4f('0x8b')]);}}}else{_0xb82f2d[_0xed4f('0xc3')]++;_0x419c70[_0xed4f('0x8e')]({'id':_0xb82f2d['idContact'],'field':{'countcongestionretry':_0xb82f2d[_0xed4f('0xc3')]}})[_0xed4f('0x5d')](function(){_0x419c70[_0xed4f('0xba')](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});});}});break;case _0xed4f('0xc4'):_0x154f98['outboundRejectCallsDay']+=0x1;_0xb82f2d['countagentrejectretry']+=0x1;_0xb82f2d['countglobal']=ut[_0xed4f('0x7b')](_0xb82f2d);ut['logCustomer'](_0xb82f2d,0x14,'AgentReject');_0x2ba3a3=_0x154f98[_0xed4f('0xc5')];_0x89f628=_0x154f98[_0xed4f('0xa8')];ami[_0xed4f('0x28')]('custom:agentreject',ut[_0xed4f('0x7d')](_0xb82f2d,_0xed4f('0xc6')));rpcDb[_0xed4f('0x6b')](_0xb82f2d,_0xed4f('0xc7'));_0x419c70[_0xed4f('0x80')](_0xb82f2d,'20',_0x154f98)[_0xed4f('0x5d')](function(_0x5012c9){_0x114d9a=_0x5012c9['additional']==0x1;if(!_0x114d9a){if(ut['totalGlobal'](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x457065,_0xed4f('0xc8'));}else{if(_0xb82f2d['countagentrejectretry']>=_0x154f98[_0xed4f('0xc9')]){rpcDb[_0xed4f('0x6f')](_0xb82f2d,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xed4f('0xae')](ut[_0xed4f('0x88')](_0xb82f2d,_0xed4f('0xca'),_0x154f98[_0xed4f('0xc5')]),_0xb82f2d['unlockAgent'],_0xb82f2d[_0xed4f('0x8b')]);}}}else{_0xb82f2d[_0xed4f('0xb8')]++;_0x419c70[_0xed4f('0x8e')]({'id':_0xb82f2d[_0xed4f('0x8f')],'field':{'countnoanswerretry':_0xb82f2d[_0xed4f('0xb8')]}})[_0xed4f('0x5d')](function(){_0x419c70['swapAdditionalPhones'](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});});}});break;case'ABANDONED':_0x154f98[_0xed4f('0xcb')]+=0x1;_0xb82f2d[_0xed4f('0xcc')]+=0x1;_0xb82f2d[_0xed4f('0x7a')]=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0xb,_0xed4f('0xcd'));rpcDb['createCustomerHistory'](_0xb82f2d,_0xed4f('0xce'));_0x419c70[_0xed4f('0x80')](_0xb82f2d,'11',_0x154f98)[_0xed4f('0x5d')](function(_0x120da4){_0x114d9a=_0x120da4[_0xed4f('0x81')]==0x1;if(!_0x114d9a){if(ut['totalGlobal'](_0xb82f2d)>=_0x154f98['dialGlobalMaxRetry']){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0xf,'Global');rpcDb[_0xed4f('0x6f')](_0x457065,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0xb82f2d['countabandonedetry']>=_0x154f98[_0xed4f('0xcf')]){rpcDb[_0xed4f('0x6f')](_0xb82f2d,_0xed4f('0xce'));}else{rpcDb['rescheduleContact'](ut[_0xed4f('0x88')](_0xb82f2d,_0xed4f('0xcc'),_0x154f98[_0xed4f('0xd0')]),_0xb82f2d[_0xed4f('0x8a')],_0xb82f2d['activeContact']);}}}else{_0xb82f2d[_0xed4f('0xb8')]++;_0x419c70[_0xed4f('0x8e')]({'id':_0xb82f2d['idContact'],'field':{'countnoanswerretry':_0xb82f2d[_0xed4f('0xb8')]}})[_0xed4f('0x5d')](function(){_0x419c70['swapAdditionalPhones'](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});});}});break;case'18':_0x154f98[_0xed4f('0xd1')]+=0x1;_0xb82f2d[_0xed4f('0xd2')]+=0x1;_0xb82f2d['countglobal']=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0x12,_0x4ebf12[_0xed4f('0xd3')]||_0x4ebf12[_0xed4f('0xd4')]);ami[_0xed4f('0x28')](_0xed4f('0xd5'),ut[_0xed4f('0x7d')](_0xb82f2d,'amd'));rpcDb['createCustomerHistory'](_0xb82f2d,_0xed4f('0xd6'));_0x419c70[_0xed4f('0x80')](_0xb82f2d,'18',_0x154f98)[_0xed4f('0x5d')](function(_0x373527){_0x114d9a=_0x373527[_0xed4f('0x81')]==0x1;if(!_0x114d9a){if(ut[_0xed4f('0x7b')](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0x12,_0xed4f('0x85'));rpcDb[_0xed4f('0x6f')](_0x457065,_0xed4f('0xd6'));}else{rpcDb[_0xed4f('0x6f')](_0xb82f2d,_0xed4f('0xd6'));}}else{_0xb82f2d[_0xed4f('0xb8')]++;_0x419c70[_0xed4f('0x8e')]({'id':_0xb82f2d['idContact'],'field':{'countnoanswerretry':_0xb82f2d[_0xed4f('0xb8')]}})['then'](function(){_0x419c70['swapAdditionalPhones'](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});});}});delete this[_0xed4f('0x16')][_0x4ebf12[_0xed4f('0x8c')]];break;case'19':_0x154f98[_0xed4f('0xd1')]+=0x1;_0xb82f2d['countglobal']=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0x13,_0x4ebf12[_0xed4f('0xd3')]||_0x4ebf12[_0xed4f('0xd4')]);ami['emit'](_0xed4f('0xd5'),ut[_0xed4f('0x7d')](_0xb82f2d,_0xed4f('0xd7')));rpcDb[_0xed4f('0x6b')](_0xb82f2d,_0xed4f('0xd8'));_0x419c70[_0xed4f('0x80')](_0xb82f2d,'18',_0x154f98)['then'](function(_0x5a8ba0){_0x114d9a=_0x5a8ba0[_0xed4f('0x81')]==0x1;if(!_0x114d9a){if(ut[_0xed4f('0x7b')](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0xf,'Global');rpcDb['createCustomerFinal'](_0x457065,_0xed4f('0xd8'));}else{rpcDb[_0xed4f('0x6f')](_0xb82f2d,_0xed4f('0xd8'));}}else{_0xb82f2d[_0xed4f('0xb8')]++;_0x419c70[_0xed4f('0x8e')]({'id':_0xb82f2d[_0xed4f('0x8f')],'field':{'countnoanswerretry':_0xb82f2d['countnoanswerretry']}})[_0xed4f('0x5d')](function(){_0x419c70[_0xed4f('0xba')](_0xb82f2d,_0x2ba3a3,_0x89f628)['then'](function(){});});}});delete this[_0xed4f('0x16')][_0x4ebf12[_0xed4f('0x8c')]];break;default:if(_0xb82f2d[_0xed4f('0x4c')]){ut[_0xed4f('0x56')](_0x154f98,_0xed4f('0xd9'));ut[_0xed4f('0x57')](_0xed4f('0xda')+_0x154f98[_0xed4f('0x2d')],_0x4ebf12);}_0x154f98[_0xed4f('0xd1')]+=0x1;_0xb82f2d[_0xed4f('0x7a')]=ut[_0xed4f('0x7b')](_0xb82f2d);ut[_0xed4f('0x67')](_0xb82f2d,0xc,_0x4ebf12[_0xed4f('0xd3')]||_0x4ebf12[_0xed4f('0xd4')]);_0x2ba3a3=_0x154f98[_0xed4f('0xc5')];_0x89f628=_0x154f98[_0xed4f('0xa8')];rpcDb[_0xed4f('0x6b')](_0xb82f2d,'[callProgressDetectingCustomer][logUnknown]');_0x419c70[_0xed4f('0x80')](_0xb82f2d,'20',_0x154f98)[_0xed4f('0x5d')](function(_0x2b52b4){_0x114d9a=_0x2b52b4[_0xed4f('0x81')]==0x1;if(!_0x114d9a){if(ut['totalGlobal'](_0xb82f2d)>=_0x154f98[_0xed4f('0x83')]){_0x457065=ut[_0xed4f('0x84')](_0xb82f2d,0xf,_0xed4f('0x85'));rpcDb[_0xed4f('0x6f')](_0x457065,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xed4f('0x6f')](_0xb82f2d,_0xed4f('0xdb'));}delete this['actions'][_0x4ebf12['linkedid']];}else{_0x419c70[_0xed4f('0xba')](_0xb82f2d,_0x2ba3a3,_0x89f628)[_0xed4f('0x5d')](function(){});}});}if(!(_0xb82f2d['dialAnswer']&&_0x4c91eb==='16')){utils[_0xed4f('0x54')](_0x154f98,_0xed4f('0xdc'));logger['info'](_0xed4f('0xdd'),_0xb82f2d[_0xed4f('0x95')],_0xed4f('0x96'),_0x154f98[_0xed4f('0x2d')],_0xed4f('0x49'),_0x154f98[_0xed4f('0x4a')]);}if(_0x4c91eb!==_0xed4f('0x90')){delete this[_0xed4f('0x16')][_0x4ebf12[_0xed4f('0x8c')]];delete this[_0xed4f('0x16')][_0x4ebf12[_0xed4f('0xde')]];}_0x154f98[_0xed4f('0xdf')]=!![];}};Preview[_0xed4f('0xe')][_0xed4f('0xe0')]=function(_0x408b8f,_0x164018,_0x4bc7d7){if(_[_0xed4f('0xe1')](_0x164018)&&_0xed4f('0xe2')!==typeof _0x164018){return;}if(_[_0xed4f('0xe1')](_0x4bc7d7)&&_0xed4f('0xe2')!==typeof _0x4bc7d7){return;}switch(_0x4bc7d7[_0xed4f('0xe3')]){case'0':ut[_0xed4f('0xe4')](_0x408b8f,0x0,_0xed4f('0x7c'));rpcDb[_0xed4f('0xe5')](_0x408b8f,_0xed4f('0xe6'));break;case'3':ut['logAgent'](_0x408b8f,0x3,_0xed4f('0xb2'));rpcDb['createAgentHistory'](_0x408b8f,_0xed4f('0xe7'));break;case'5':ut[_0xed4f('0xe4')](_0x408b8f,0x5,_0xed4f('0xa7'));rpcDb[_0xed4f('0xe5')](_0x408b8f,_0xed4f('0xe8'));break;case'8':ut[_0xed4f('0xe4')](_0x408b8f,0x8,_0xed4f('0xbd'));rpcDb[_0xed4f('0xe5')](_0x408b8f,_0xed4f('0xe9'));break;case'22':ut[_0xed4f('0xe4')](_0x408b8f,0x16,_0xed4f('0xea'));rpcDb[_0xed4f('0xe5')](_0x408b8f,_0xed4f('0xeb'));break;default:ut[_0xed4f('0xe4')](_0x408b8f,0xc,_0x4bc7d7[_0xed4f('0xe3')]);rpcDb[_0xed4f('0xe5')](_0x408b8f,_0xed4f('0xe9'));}utils[_0xed4f('0x54')](_0x164018,_0xed4f('0xec'));logger[_0xed4f('0x29')](_0xed4f('0xed'),_0x408b8f[_0xed4f('0x95')],_0xed4f('0x96'),_0x164018['name'],_0xed4f('0x49'),_0x164018[_0xed4f('0x4a')]);delete this[_0xed4f('0x16')][_0x408b8f[_0xed4f('0x95')]];};Preview[_0xed4f('0xe')][_0xed4f('0x80')]=function(_0x37fd68,_0x24f784,_0x426e70){return cmHopperAdditionalPhone[_0xed4f('0x80')](_0x37fd68,_0x24f784,_0x426e70)[_0xed4f('0x52')](logger['info'](_0xed4f('0xee')));};Preview[_0xed4f('0xe')]['swapAdditionalPhones']=function(_0x2b021f,_0x2c764c,_0x232dd3){return cmHopperAdditionalPhone[_0xed4f('0xba')](_0x2b021f,_0x2c764c,_0x232dd3)[_0xed4f('0x52')](logger[_0xed4f('0x29')](_0xed4f('0xef')));};Preview[_0xed4f('0xe')]['incrementPreviewCounters']=function(_0x232a9d){return Promise[_0xed4f('0xf0')]()[_0xed4f('0x5d')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x232a9d))[_0xed4f('0x52')](logger[_0xed4f('0x29')](_0xed4f('0xf1')));};Preview[_0xed4f('0xe')][_0xed4f('0xf2')]=function(_0x49510e,_0x2efdd0,_0x52f915,_0x351447,_0x2f886b){var _0xa63256=this;return new Promise(function(_0x34ae0f,_0x3f0b6b){if(_[_0xed4f('0x45')](_0x2efdd0)||_['isNil'](_0x2efdd0['Contact'])||_[_0xed4f('0x45')](_0x2efdd0[_0xed4f('0xf3')])||_[_0xed4f('0x45')](_0x2efdd0[_0xed4f('0x4f')])){_0x3f0b6b(ut[_0xed4f('0x34')](_0xed4f('0xf4'),_0x351447,_0x2f886b));return;}var _0x3872a5=uuid['v4']();var _0x355b17=_0xa63256[_0xed4f('0x13')][_0x2efdd0[_0xed4f('0x47')][_0xed4f('0x2d')]];var _0x2c7ece=_0x52f915?_0xa63256['agents'][_0x52f915]['id']:undefined;_0xa63256[_0xed4f('0x16')][_0x3872a5]=new Action(_0x2efdd0,_0x355b17,_0x3872a5,_0x52f915,_0x2c7ece);var _0x70be57=_0xa63256[_0xed4f('0x16')][_0x3872a5];_0x70be57['unlockAgent']=_0x351447;_0x70be57[_0xed4f('0x8b')]=_0x2f886b;_0x70be57['lookAgent']=_0x52f915;if(_[_0xed4f('0xf5')](_0x49510e)){_0xa63256[_0xed4f('0xf6')](_0x70be57,_0x355b17,_0x2efdd0,_0x52f915)['then'](function(_0x180c28){logger[_0xed4f('0x29')](_0xed4f('0xf7'),_0xed4f('0xf8')+_0x70be57['queue']+_0xed4f('0xf9')+_0x70be57[_0xed4f('0x8f')],JSON[_0xed4f('0x2b')](_0x180c28));ami['emit'](_0xed4f('0xfa'),ut['buildObj'](_0x70be57,_0xed4f('0xfb'),_0xa63256['campaignsPreview'][_0x70be57['queue']]));_0x34ae0f(ut[_0xed4f('0x34')](_0xed4f('0xfc')));})['catch'](function(_0xd24a5f){ut[_0xed4f('0x37')](_0xed4f('0xfd'),_0xd24a5f);_0x3f0b6b(ut[_0xed4f('0x34')](_0xed4f('0xfe'),_0x351447,_0x2f886b));});}else{_0x355b17['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x70be57);rpcDb[_0xed4f('0xff')](_0x70be57,_0xed4f('0x100'));delete _0xa63256[_0xed4f('0x16')][_0x3872a5];_0x3f0b6b(ut[_0xed4f('0x34')](_0xed4f('0x101'),_0x351447,_0x2f886b));}});};Preview['prototype'][_0xed4f('0x75')]=function(_0x573c7b){return!_[_0xed4f('0x45')](_0x573c7b)&&!_['isNil'](_0x573c7b[_0xed4f('0x2d')])&&!_['isNil'](_0x573c7b[_0xed4f('0x102')])&&_0x573c7b['active']&&!_[_0xed4f('0x45')](this[_0xed4f('0x15')][util[_0xed4f('0x65')](_0xed4f('0x103'),_0x573c7b[_0xed4f('0x2d')])])&&!_[_0xed4f('0x45')](this['trunks'][util[_0xed4f('0x65')]('SIP/%s',_0x573c7b[_0xed4f('0x2d')])][_0xed4f('0x51')])&&(this[_0xed4f('0x15')][util[_0xed4f('0x65')]('SIP/%s',_0x573c7b['name'])][_0xed4f('0x51')]===_0xed4f('0x104')||this[_0xed4f('0x15')][util[_0xed4f('0x65')](_0xed4f('0x103'),_0x573c7b[_0xed4f('0x2d')])][_0xed4f('0x51')]===_0xed4f('0x105'));};Preview[_0xed4f('0xe')]['run']=function(_0x32d5a1,_0x38bc28){return this[_0xed4f('0x106')](_0x32d5a1,_0x38bc28)[_0xed4f('0x5d')](function(_0x4b89e2){return _[_0xed4f('0x4d')](_0x4b89e2,['message']);})['catch'](function(_0x218b8e){if(_0x218b8e[_0xed4f('0x107')]){rpcDb[_0xed4f('0x108')](_0x32d5a1);}if(_0x218b8e[_0xed4f('0x102')]){rpcDb['disableContact'](_0x32d5a1);}throw _[_0xed4f('0x4d')](_0x218b8e,[_0xed4f('0x34')]);});};Preview[_0xed4f('0xe')][_0xed4f('0x106')]=function(_0x302a27,_0x12a48c){var _0x1653b4=this;var _0x35d34d,_0x280172;return rpcDb[_0xed4f('0x109')](_0x302a27)[_0xed4f('0x5d')](function(_0x58d169){if(!_['isNil'](_0x58d169[0x0])){_0x280172=_0x58d169[0x0]['recallme']?![]:!![];_0x35d34d=_0x58d169[0x0][_0xed4f('0x10a')]?!![]:![];_0x35d34d=_0x12a48c?!![]:_0x35d34d;}var _0x79e2d=_0x1653b4[_0xed4f('0x10b')](_0x58d169);if(_0x79e2d[_0xed4f('0x10c')]){rpcDb[_0xed4f('0x10d')](_[_0xed4f('0x4d')](_0x58d169[0x0],['VoiceQueueId',_0xed4f('0xf3')]))[_0xed4f('0x5d')](function(_0x1f8fc7){_0x1653b4[_0xed4f('0xf2')](_0x1f8fc7,_0x58d169[0x0],_0x12a48c,_0x280172,_0x35d34d)['then'](function(_0x3f077e){return _0x3f077e;})['catch'](function(_0x51047f){throw _0x51047f;});})[_0xed4f('0x52')](function(_0x895bf5){ut[_0xed4f('0x37')]('[Preview][checkIsBlackList]',_0x895bf5);throw ut[_0xed4f('0x34')](_0xed4f('0x10e'),_0x280172,_0x35d34d);});}else{throw ut['message'](_0x79e2d['message'],_0x280172,_0x35d34d);}})[_0xed4f('0x52')](function(_0x4d0210){ut[_0xed4f('0x37')]('[Preview][getContactPreview]',_0x4d0210);throw ut[_0xed4f('0x34')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xed4f('0xe')][_0xed4f('0x10b')]=function(_0x2dd4fd){if(_[_0xed4f('0x45')](_0x2dd4fd)||_['isEmpty'](_0x2dd4fd)||!_[_0xed4f('0x45')](_0x2dd4fd[0x0][_0xed4f('0x60')])&&_[_0xed4f('0x45')](_0x2dd4fd[0x0][_0xed4f('0x60')][_0xed4f('0x2d')])){ut['logger'](_0xed4f('0x10f'),_0x2dd4fd);return{'isValid':![],'message':_0xed4f('0x110')};}var _0x47ed73=this[_0xed4f('0x13')][_0x2dd4fd[0x0][_0xed4f('0x47')][_0xed4f('0x2d')]];_0x47ed73[_0xed4f('0x34')]=utils[_0xed4f('0x35')][_0xed4f('0x77')];if(_['isNil'](_0x47ed73)){ut[_0xed4f('0x37')](_0xed4f('0x111'),_0x47ed73);return{'isValid':![],'message':_0xed4f('0x112')};}if(!this['isTrunkReachable'](_0x47ed73['Trunk'])){ut['logger'](_0xed4f('0x113'),_0xed4f('0x114')+_0x47ed73['name']+_0xed4f('0x115'));if(!this[_0xed4f('0x75')](_0x47ed73[_0xed4f('0x116')])){ut[_0xed4f('0x37')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x47ed73[_0xed4f('0x2d')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xed4f('0x117')};}}if(!ut[_0xed4f('0x74')](_0x47ed73[_0xed4f('0x41')])){ut[_0xed4f('0x37')](_0xed4f('0x118'),_0x47ed73[_0xed4f('0x2d')]+_0xed4f('0x119'));return{'isValid':![],'message':_0xed4f('0x114')+_0x47ed73[_0xed4f('0x2d')]+_0xed4f('0x119')};}return{'isValid':!![],'message':_0xed4f('0x11a')};};Preview[_0xed4f('0xe')]['execCall']=function(_0x320aee,_0x543cb8,_0x574955,_0x34aab0){var _0x5920f5=this;return new Promise(function(_0x9a5009,_0x42e682){var _0x15e576=_0x320aee[_0xed4f('0x95')];var _0x36b460=_0x5920f5['isTrunkReachable'](_0x543cb8[_0xed4f('0x11b')])?util['format'](_0xed4f('0x11c'),_0x543cb8[_0xed4f('0x11b')][_0xed4f('0x2d')],_[_0xed4f('0x45')](_0x543cb8['dialPrefix'])?'':_0x543cb8['dialPrefix']['trim']()||'',_0x543cb8[_0xed4f('0x11d')]>0x0?_0x574955[_0xed4f('0xf3')][_0xed4f('0x11e')](_0x543cb8[_0xed4f('0x11d')]):_0x574955[_0xed4f('0xf3')]):util[_0xed4f('0x65')](_0xed4f('0x11c'),_[_0xed4f('0x45')](_0x543cb8[_0xed4f('0x116')])?_0x543cb8[_0xed4f('0x11b')][_0xed4f('0x2d')]:_0x543cb8[_0xed4f('0x116')]['name'],_[_0xed4f('0x45')](_0x543cb8[_0xed4f('0x11f')])?'':_0x543cb8['dialPrefix'][_0xed4f('0x120')]()||'',_0x543cb8[_0xed4f('0x11d')]>0x0?_0x574955[_0xed4f('0xf3')][_0xed4f('0x11e')](_0x543cb8[_0xed4f('0x11d')]):_0x574955[_0xed4f('0xf3')]);var _0x1e3097=_0x5920f5['isTrunkReachable'](_0x543cb8[_0xed4f('0x11b')])?ut['getCallerId'](_0x543cb8[_0xed4f('0x11b')][_0xed4f('0x121')],_0x543cb8[_0xed4f('0x122')],_0x543cb8[_0xed4f('0x123')]>0x0?ut[_0xed4f('0x124')](_0x543cb8[_0xed4f('0x125')],_0x543cb8['dialRandomLastDigitCallerIdNumber']):_0x543cb8[_0xed4f('0x125')]):ut['getCallerId'](_[_0xed4f('0x45')](_0x543cb8[_0xed4f('0x116')])?_0x543cb8[_0xed4f('0x11b')][_0xed4f('0x121')]:_0x543cb8[_0xed4f('0x116')][_0xed4f('0x121')],_0x543cb8['dialOriginateCallerIdName'],_0x543cb8['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xed4f('0x124')](_0x543cb8['dialOriginateCallerIdNumber'],_0x543cb8['dialRandomLastDigitCallerIdNumber']):_0x543cb8[_0xed4f('0x125')]);if(_0x1e3097){_0x320aee[_0xed4f('0x126')]=ut[_0xed4f('0x127')](_0x1e3097);_0x320aee['originatecalleridnum']=ut[_0xed4f('0x128')](_0x1e3097);}var _0xdf55d8=ut[_0xed4f('0x129')](_0x543cb8,_0x574955,_0x36b460,_0x1e3097,_0x15e576,_0x320aee);var _0x4334d0=utils[_0xed4f('0x12a')](_0x574955[_0xed4f('0x12b')]);Object[_0xed4f('0x12c')](_0xdf55d8,_0x4334d0);_[_0xed4f('0x12d')](_0x320aee,ut[_0xed4f('0x12e')](_0xdf55d8));_0x320aee[_0xed4f('0x12f')]=moment()[_0xed4f('0x65')](_0xed4f('0x91'));_0x543cb8[_0xed4f('0x130')]=_0xdf55d8;var _0x129879=ut[_0xed4f('0x131')](_0x320aee,_0x543cb8,_0xdf55d8,_0x320aee[_0xed4f('0x8b')],_0x34aab0);return ami[_0xed4f('0x50')](_0x129879)[_0xed4f('0x5d')](function(_0x1213d6){_0x543cb8[_0xed4f('0x4a')]+=0x1;logger[_0xed4f('0x29')](_0xed4f('0x132'),_0x15e576,_0xed4f('0x96'),_0x543cb8[_0xed4f('0x2d')],_0xed4f('0x49'),_0x543cb8['originated']);_0x9a5009(_0x1213d6);})['catch'](function(_0xf3adce){ut['logAgent'](_0x320aee,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x320aee,_0xed4f('0x133'));_0x42e682(_0xf3adce);});});};Preview[_0xed4f('0xe')][_0xed4f('0x134')]=function(_0x3f2f8c){if(this['actions'][_0x3f2f8c[_0xed4f('0x8c')]]){this[_0xed4f('0x16')][_0x3f2f8c[_0xed4f('0x8c')]][_0xed4f('0x135')]=_0x3f2f8c[_0xed4f('0x135')];}};Preview[_0xed4f('0xe')]['syncOriginateResponse']=function(_0x41c181){var _0x248886=this;var _0xfe5ab6=this[_0xed4f('0x16')][_0x41c181[_0xed4f('0x136')]];if(_0xfe5ab6){if(_0xfe5ab6[_0xed4f('0x137')]&&this[_0xed4f('0x17')][_0xfe5ab6[_0xed4f('0x137')]]){ut['logLookAgent'](_0xfe5ab6,this[_0xed4f('0x17')][_0xfe5ab6['lookAgent']][_0xed4f('0x2d')],this[_0xed4f('0x17')][_0xfe5ab6[_0xed4f('0x137')]]['id']);}var _0x1f666e=_[_0xed4f('0x138')](_0xfe5ab6);_0x1f666e[_0xed4f('0x92')]=moment()[_0xed4f('0x65')](_0xed4f('0x91'));var _0x59f4a6=_0x248886[_0xed4f('0x13')][_0xfe5ab6[_0xed4f('0x48')]];if(ut[_0xed4f('0x139')](_0x41c181[_0xed4f('0x13a')])){if(_0xfe5ab6[_0xed4f('0x8a')]){rpcDb[_0xed4f('0x108')](_0xfe5ab6[_0xed4f('0x8f')]);}if(_0xfe5ab6[_0xed4f('0x8b')]){rpcDb[_0xed4f('0x64')](_0xfe5ab6[_0xed4f('0x8f')]);}ami[_0xed4f('0x28')](_0xed4f('0x13b'),ut[_0xed4f('0x7d')](_0xfe5ab6,_0xed4f('0x13c'),this[_0xed4f('0x13')][_0xfe5ab6[_0xed4f('0x48')]]));this[_0xed4f('0xe0')](_0x1f666e,_0x59f4a6,_0x41c181);}else{_0xfe5ab6[_0xed4f('0x12f')]=moment()[_0xed4f('0x65')](_0xed4f('0x91'));ut['logAgent'](_0x1f666e,0x4,_0xed4f('0x13d'));rpcDb[_0xed4f('0xe5')](_0x1f666e,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x54e8da){var _0x321205=this[_0xed4f('0x16')][_0x54e8da[_0xed4f('0x8c')]];var _0x6f600b;if(_0x321205){_0x6f600b=this[_0xed4f('0x13')][_0x321205[_0xed4f('0x48')]];logger[_0xed4f('0x29')](_0xed4f('0x13e'),_0x54e8da['linkedid'],'\x20Queue',_0x6f600b[_0xed4f('0x2d')],_0xed4f('0x4b'),_0x6f600b[_0xed4f('0x31')]);}if(this[_0xed4f('0x16')][_0x54e8da[_0xed4f('0x8c')]]&&_0x54e8da[_0xed4f('0x8c')]!==_0x54e8da[_0xed4f('0x95')]){if(_0x54e8da['cause']==='16'&&this[_0xed4f('0x16')][_0x54e8da[_0xed4f('0x8c')]][_0xed4f('0x4c')]){this[_0xed4f('0x78')](_0x54e8da,_0x54e8da[_0xed4f('0x8c')],_0x54e8da[_0xed4f('0x13f')]);}else if(this[_0xed4f('0x16')][_0x54e8da[_0xed4f('0x8c')]][_0xed4f('0x4c')]){logger[_0xed4f('0x29')](_0xed4f('0x140'),_0x54e8da[_0xed4f('0x8c')],_0x54e8da[_0xed4f('0x13f')],_0xed4f('0x96'),_0x6f600b[_0xed4f('0x2d')],'pTalking:\x20',_0x6f600b[_0xed4f('0x31')]);this[_0xed4f('0x78')](_0x54e8da,_0x54e8da['linkedid'],_0x54e8da[_0xed4f('0x13f')]);}}else if(_0x321205&&_[_0xed4f('0x45')](_0x321205[_0xed4f('0x141')])&&_0x6f600b[_0xed4f('0x142')]&&_0x54e8da[_0xed4f('0x8c')]===_0x54e8da['uniqueid']&&_[_0xed4f('0x45')](_0x54e8da[_0xed4f('0xe3')])&&_0x54e8da[_0xed4f('0x13f')]==='16'&&_0x54e8da[_0xed4f('0x143')]==='6'&&_[_0xed4f('0xe1')](_0x321205[_0xed4f('0x144')])){if(_0x321205[_0xed4f('0x8a')]){rpcDb[_0xed4f('0x108')](_0x321205[_0xed4f('0x8f')]);}if(_0x321205[_0xed4f('0x8b')]){rpcDb[_0xed4f('0x64')](_0x321205[_0xed4f('0x8f')]);}_0x54e8da['reason']='22';this[_0xed4f('0xe0')](_0x321205,_0x6f600b,_0x54e8da);}else if(_0x321205&&_0x321205['transfer']){if(_0x54e8da[_0xed4f('0x13f')]==='16'&&this[_0xed4f('0x16')][_0x54e8da[_0xed4f('0x8c')]][_0xed4f('0x4c')]){logger[_0xed4f('0x29')](_0xed4f('0x145'),_0x54e8da['linkedid'],_0x54e8da['cause'],_0xed4f('0x96'),_0x6f600b[_0xed4f('0x2d')],_0xed4f('0x4b'),_0x6f600b['pTalking']);this[_0xed4f('0x78')](_0x54e8da,_0x54e8da[_0xed4f('0x8c')],_0x54e8da[_0xed4f('0x13f')]);}else if(this['actions'][_0x54e8da[_0xed4f('0x8c')]][_0xed4f('0x4c')]){logger[_0xed4f('0x29')](_0xed4f('0x140'),_0x54e8da[_0xed4f('0x8c')],_0x54e8da[_0xed4f('0x13f')],_0xed4f('0x96'),_0x6f600b[_0xed4f('0x2d')],_0xed4f('0x4b'),_0x6f600b[_0xed4f('0x31')]);this[_0xed4f('0x78')](_0x54e8da,_0x54e8da['linkedid'],_0x54e8da[_0xed4f('0x13f')]);}}};Preview[_0xed4f('0xe')]['syncDialEnd']=function(_0x5c97c1){if(this[_0xed4f('0x16')][_0x5c97c1[_0xed4f('0xde')]]&&_0x5c97c1[_0xed4f('0xde')]!==_0x5c97c1['destuniqueid']){this['callProgressDetectingCustomer'](_0x5c97c1,_0x5c97c1[_0xed4f('0xde')],_0x5c97c1[_0xed4f('0xd4')]);}};Preview[_0xed4f('0xe')][_0xed4f('0x146')]=function(_0x4d75a8){if(this[_0xed4f('0x16')][_0x4d75a8['linkedid']]&&_0x4d75a8['linkedid']!==_0x4d75a8['uniqueid']&&!this['actions'][_0x4d75a8[_0xed4f('0x8c')]][_0xed4f('0x4c')]){if(_0x4d75a8[_0xed4f('0x13f')]==='1'){this[_0xed4f('0x78')](_0x4d75a8,_0x4d75a8[_0xed4f('0x8c')],_0x4d75a8[_0xed4f('0x13f')]);}}};Preview[_0xed4f('0xe')][_0xed4f('0x147')]=function(_0x452719,_0x10e245,_0x4b9965){if(this[_0xed4f('0x16')][_0x452719]){if(_['isNil'](this[_0xed4f('0x16')][_0x452719]['variables'])){this[_0xed4f('0x16')][_0x452719][_0xed4f('0x130')]={};}this[_0xed4f('0x16')][_0x452719][_0xed4f('0x130')][_0x10e245]=_0x4b9965;}};Preview['prototype'][_0xed4f('0x22')]=function(_0x41b4a0){try{if(!_[_0xed4f('0x45')](_0x41b4a0)){if(ut[_0xed4f('0x148')](_['keys'](_0x41b4a0[_0xed4f('0x149')])[0x0])){this[_0xed4f('0x147')](_0x41b4a0[_0xed4f('0x95')],_['keys'](_0x41b4a0['variable'])[0x0],_0x41b4a0[_0xed4f('0x14a')]);}}}catch(_0x543be7){logger[_0xed4f('0x14b')](_0xed4f('0x14c'),util[_0xed4f('0x14d')](_0x543be7,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xed4f('0x24')]=function(_0x2e3a1b){if(_0x2e3a1b){if(this[_0xed4f('0x16')][_0x2e3a1b[_0xed4f('0x14e')]]){this[_0xed4f('0x16')][_0x2e3a1b[_0xed4f('0x14e')]][_0xed4f('0x144')]=!![];}}};Preview[_0xed4f('0xe')]['syncBlindTransfer']=function(_0x11b283){if(_0x11b283){if(this[_0xed4f('0x16')][_0x11b283[_0xed4f('0x14f')]]){this[_0xed4f('0x16')][_0x11b283[_0xed4f('0x14f')]][_0xed4f('0x144')]=!![];}}};module[_0xed4f('0x150')]=Preview; \ No newline at end of file +var _0x9cee=['answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','scheduledAt','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','reason','createAgentHistory','logAgent','NoAnswer','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','Contact','phone','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','execRun','disableContact','getContactPreview','recallme','isValid','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','starttime','[syncHangup][talking]','callProgressDetectingCustomer','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','unlockContact','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','syncVarSet','filterKey','keys','variable','addVariable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','bind','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','sendMessageOneNotActive','originated','pTalking','available','message','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','prototype','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','isNil','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','pick','contactId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','dialActive','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','responsetime'];(function(_0x50de1a,_0x33ae09){var _0x4bada5=function(_0x3cdf0e){while(--_0x3cdf0e){_0x50de1a['push'](_0x50de1a['shift']());}};_0x4bada5(++_0x33ae09);}(_0x9cee,0x1f0));var _0xe9ce=function(_0x122a28,_0x42eab3){_0x122a28=_0x122a28-0x0;var _0x3710a6=_0x9cee[_0x122a28];return _0x3710a6;};'use strict';var util=require(_0xe9ce('0x0'));var _=require(_0xe9ce('0x1'));var uuid=require(_0xe9ce('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0xe9ce('0x3'));var logger=require('../../../config/logger')(_0xe9ce('0x4'));var loggerAction=require(_0xe9ce('0x5'))(_0xe9ce('0x6'));var ami=require(_0xe9ce('0x7'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xe9ce('0x8'));var Action=require(_0xe9ce('0x9'));var ut=require(_0xe9ce('0xa'));var utils=require(_0xe9ce('0xb'));config[_0xe9ce('0xc')]=_['defaults'](config[_0xe9ce('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xe9ce('0xd'))(new Redis(config[_0xe9ce('0xc')]));var Sequence=function(){};Sequence['prototype'][_0xe9ce('0xe')]=function(_0x2693dc){this['tail']=this['tail']?this[_0xe9ce('0xf')][_0xe9ce('0x10')](_0x2693dc):_0x2693dc();};function Preview(_0x9b486a){this[_0xe9ce('0x11')]=new Sequence();this[_0xe9ce('0x12')]=_0x9b486a['voiceQueues'];this[_0xe9ce('0x13')]=_0x9b486a[_0xe9ce('0x13')];this['actions']={};this['agents']=_0x9b486a[_0xe9ce('0x14')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0xe9ce('0x15')](this));ami['on']('hangup',this[_0xe9ce('0x16')][_0xe9ce('0x15')](this));ami['on'](_0xe9ce('0x17'),this['syncHangupRequest']['bind'](this));ami['on'](_0xe9ce('0x18'),this[_0xe9ce('0x19')][_0xe9ce('0x15')](this));ami['on'](_0xe9ce('0x1a'),this[_0xe9ce('0x1b')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0xe9ce('0x15')](this));ami['on'](_0xe9ce('0x1c'),this[_0xe9ce('0x1d')][_0xe9ce('0x15')](this));ami['on'](_0xe9ce('0x1e'),this['syncBlindTransfer']['bind'](this));this[_0xe9ce('0x1f')](this[_0xe9ce('0x12')]);}function emit(_0x4937b0,_0x340d60,_0x3a3865){io['to'](_0x4937b0)['emit'](_0x340d60,_0x3a3865);}function emitVoiceQueueChannelRemove(_0x203ee2){logger[_0xe9ce('0x20')](_0xe9ce('0x21'),JSON[_0xe9ce('0x22')](_0x203ee2));emit(util[_0xe9ce('0x23')](_0xe9ce('0x24'),_0x203ee2[_0xe9ce('0x25')]),'voice_queue_channel:remove',_0x203ee2);io['emit']('voice_queue_presence:remove',_0x203ee2);}function notSendMessagesQueue(_0x3b6812){if(_0x3b6812[_0xe9ce('0x26')]){if(_0x3b6812[_0xe9ce('0x27')]===0x0&&_0x3b6812[_0xe9ce('0x28')]===0x0){_0x3b6812[_0xe9ce('0x26')]=![];_0x3b6812[_0xe9ce('0x29')]=0x0;_0x3b6812['paused']=0x0;_0x3b6812[_0xe9ce('0x2a')]=utils[_0xe9ce('0x2b')]['INACTIVE'];ut[_0xe9ce('0x2c')](_0xe9ce('0x2d'),_0x3b6812[_0xe9ce('0x25')]+_0xe9ce('0x2e'));}else{_0x3b6812['message']=utils[_0xe9ce('0x2b')]['DEACTIVATED'];ut[_0xe9ce('0x2c')](_0xe9ce('0x2d'),_0x3b6812[_0xe9ce('0x25')]+_0xe9ce('0x2f'));}}}Preview[_0xe9ce('0x30')][_0xe9ce('0x1f')]=function(){var _0xbea253=this;setInterval(function(){_0xbea253['syncCampaigns']();},0x7cf);};Preview[_0xe9ce('0x30')][_0xe9ce('0x31')]=function(){var _0x3e8837=this[_0xe9ce('0x12')];this[_0xe9ce('0x32')]+=0x1;for(var _0x3a17ba in _0x3e8837){if(_0x3e8837[_0xe9ce('0x33')](_0x3a17ba)&&(_0x3e8837[_0x3a17ba][_0xe9ce('0x34')]===_0xe9ce('0x4')||_0x3e8837[_0x3a17ba][_0xe9ce('0x34')]===_0xe9ce('0x35'))&&_0x3e8837[_0x3a17ba][_0xe9ce('0x36')]===_0xe9ce('0x37')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0xe9ce('0x38')]();}}if(_0x3e8837[_0xe9ce('0x33')](_0x3a17ba)&&_0x3e8837[_0x3a17ba][_0xe9ce('0x34')]===_0xe9ce('0x4')&&_0x3e8837[_0x3a17ba][_0xe9ce('0x36')]===_0xe9ce('0x37')){if(_0x3e8837[_0x3a17ba]['dialActive']){this[_0xe9ce('0x39')](_0x3e8837[_0x3a17ba]);if(_0x3e8837[_0x3a17ba][_0xe9ce('0x3a')])this[_0xe9ce('0x3b')](_0x3e8837[_0x3a17ba]);}else{notSendMessagesQueue(_0x3e8837[_0x3a17ba]);}}}};Preview[_0xe9ce('0x30')]['clearZombieChannel']=function(_0x48c5de){var _0x26e69e=this;this[_0xe9ce('0x11')][_0xe9ce('0xe')](function(){if(!_[_0xe9ce('0x3c')](_0x26e69e[_0xe9ce('0x3d')][_0x48c5de])){loggerAction['info'](_0xe9ce('0x3e'),_0x48c5de,_0xe9ce('0x3f'),_0x26e69e['actions'][_0x48c5de][_0xe9ce('0x40')],_0xe9ce('0x41'),JSON['stringify'](_0x26e69e[_0xe9ce('0x12')][_0x26e69e[_0xe9ce('0x3d')][_0x48c5de][_0xe9ce('0x40')]][_0xe9ce('0x27')]),'pTalking:\x20',JSON[_0xe9ce('0x22')](_0x26e69e[_0xe9ce('0x12')][_0x26e69e[_0xe9ce('0x3d')][_0x48c5de][_0xe9ce('0x40')]][_0xe9ce('0x28')]),JSON[_0xe9ce('0x22')](_0x26e69e[_0xe9ce('0x3d')][_0x48c5de][_0xe9ce('0x42')]),JSON['stringify'](_[_0xe9ce('0x43')](_0x26e69e[_0xe9ce('0x3d')][_0x48c5de],[_0xe9ce('0x44'),'UserId',_0xe9ce('0x45'),'ListId'])));return ami[_0xe9ce('0x46')]({'action':_0xe9ce('0x47'),'channel':_0x26e69e['actions'][_0x48c5de][_0xe9ce('0x48')]})[_0xe9ce('0x49')](function(_0x254eb8){if(_0x254eb8[_0xe9ce('0x2a')]===_0xe9ce('0x4a')){setTimeout(function(){if(_0x26e69e[_0xe9ce('0x3d')][_0x48c5de]){utils[_0xe9ce('0x4b')](_0x26e69e[_0xe9ce('0x12')][_0x26e69e[_0xe9ce('0x3d')][_0x48c5de][_0xe9ce('0x40')]],_0xe9ce('0x4c'));if(_0x26e69e[_0xe9ce('0x3d')][_0x48c5de][_0xe9ce('0x42')]===!![]){ut[_0xe9ce('0x4d')](_0x26e69e['campaignsPreview'][_0x26e69e['actions'][_0x48c5de]['queue']],_0xe9ce('0x4c'));ut[_0xe9ce('0x4e')]('[Dialer][checkChannel][pTalking][Preview]'+_0x48c5de,_0x26e69e[_0xe9ce('0x3d')][_0x48c5de][_0xe9ce('0x40')]);}ut[_0xe9ce('0x4e')](_0xe9ce('0x4f')+_0x48c5de,_0x26e69e[_0xe9ce('0x3d')][_0x48c5de][_0xe9ce('0x40')]);delete _0x26e69e[_0xe9ce('0x3d')][_0x48c5de];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0xcf0549=this;loggerAction[_0xe9ce('0x20')]('[action]',_['size'](this[_0xe9ce('0x3d')]));for(var _0x47914e in this[_0xe9ce('0x3d')]){if(_0xcf0549[_0xe9ce('0x3d')][_0xe9ce('0x33')](_0x47914e)){_0xcf0549[_0xe9ce('0x50')](_0x47914e);}}};Preview[_0xe9ce('0x30')][_0xe9ce('0x3b')]=function(_0x24aa96){var _0x3f2068=this;rpcDb[_0xe9ce('0x51')](_0x24aa96['id'],ut[_0xe9ce('0x52')](this[_0xe9ce('0x14')]))[_0xe9ce('0x53')](function(_0x2a9065){if(!_[_0xe9ce('0x3c')](_0x2a9065)){for(var _0x1769ec=0x0;_0x1769ec<_0x2a9065[_0xe9ce('0x54')];_0x1769ec+=0x1){if(ut[_0xe9ce('0x55')](_0x2a9065[_0x1769ec][_0xe9ce('0x56')])<_0x24aa96[_0xe9ce('0x57')]*0x3c){if(_0x2a9065[_0x1769ec][_0xe9ce('0x58')]&&!_0x2a9065[_0x1769ec][_0xe9ce('0x58')]['voicePause']){_0x3f2068[_0xe9ce('0x59')](_0x2a9065[_0x1769ec]['id'])[_0xe9ce('0x53')](ut[_0xe9ce('0x5a')]('[RecallMe]'))[_0xe9ce('0x49')](ut[_0xe9ce('0x5a')](_0xe9ce('0x5b')));}else{rpcDb['disableContact'](_0x2a9065[_0x1769ec]['id']);}}else{var _0x3fd4ff=new Action(_0x2a9065[_0x1769ec],_0x24aa96);_0x3fd4ff['starttime']=moment()['format'](_0xe9ce('0x5c'));_0x24aa96[_0xe9ce('0x5d')]+=0x1;ut[_0xe9ce('0x5e')](_0x3fd4ff,0x17,'RecallInQueue');if(_0x24aa96[_0xe9ce('0x5f')]){rpcDb[_0xe9ce('0x60')](ut[_0xe9ce('0x61')](_0x2a9065[_0x1769ec]));rpcDb['createCustomerHistory'](_0x3fd4ff,_0xe9ce('0x62'));}else{ut['logCustomer'](_0x3fd4ff,0x16,_0xe9ce('0x63'));rpcDb[_0xe9ce('0x64')](_0x3fd4ff,_0xe9ce('0x65'));rpcDb[_0xe9ce('0x66')](_0x3fd4ff,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xe9ce('0x5a')](_0xe9ce('0x67')));};Preview['prototype'][_0xe9ce('0x39')]=function(_0x5c209e){_0x5c209e[_0xe9ce('0x26')]=!![];if(ut[_0xe9ce('0x68')](_0x5c209e[_0xe9ce('0x69')])){_0x5c209e[_0xe9ce('0x2a')]=utils[_0xe9ce('0x2b')][_0xe9ce('0x6a')];}else if(!ut[_0xe9ce('0x6b')](_0x5c209e[_0xe9ce('0x6c')])){_0x5c209e['message']=utils['CAMPAIGN_STATUS']['INACTIVE'];}else if(!this[_0xe9ce('0x6d')](_0x5c209e[_0xe9ce('0x6e')])){if(!this[_0xe9ce('0x6d')](_0x5c209e[_0xe9ce('0x6f')])){_0x5c209e[_0xe9ce('0x2a')]=utils[_0xe9ce('0x2b')]['UNREACHABLE_TRUNK'];}else{_0x5c209e['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];}}else{_0x5c209e[_0xe9ce('0x2a')]=utils[_0xe9ce('0x2b')][_0xe9ce('0x70')];}};Preview[_0xe9ce('0x30')]['callProgressDetectingCustomer']=function(_0x113421,_0x23b204,_0x4c1de0){var _0x272650=this;var _0x1e7b32=this[_0xe9ce('0x3d')][_0x23b204];var _0x20c63=this[_0xe9ce('0x12')][_0x1e7b32[_0xe9ce('0x40')]];var _0x44e46f;var _0x29db83=![];var _0x18fcd4=0x2;var _0x2b3620=0x3;if(_0x20c63){switch(_0x4c1de0){case'1':_0x20c63['outboundNoSuchCallsDay']+=0x1;_0x1e7b32[_0xe9ce('0x71')]+=0x1;_0x1e7b32[_0xe9ce('0x72')]=ut[_0xe9ce('0x73')](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0x0,_0xe9ce('0x74'));ami[_0xe9ce('0x75')](_0xe9ce('0x76'),ut[_0xe9ce('0x77')](_0x1e7b32,'nosuchnumber'));rpcDb[_0xe9ce('0x64')](_0x1e7b32,_0xe9ce('0x78'));_0x272650[_0xe9ce('0x79')](_0x1e7b32,'0',_0x20c63)[_0xe9ce('0x53')](function(_0x237c30){_0x29db83=_0x237c30[_0xe9ce('0x7a')]==0x1;_0x18fcd4=_0x20c63[_0xe9ce('0x7b')];_0x2b3620=_0x20c63[_0xe9ce('0x7c')];if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63['dialGlobalMaxRetry']){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0xf,_0xe9ce('0x7e'));rpcDb[_0xe9ce('0x66')](_0x44e46f,_0xe9ce('0x7f'));}else{if(_0x1e7b32[_0xe9ce('0x71')]>=_0x20c63[_0xe9ce('0x80')]){rpcDb[_0xe9ce('0x66')](_0x1e7b32,_0xe9ce('0x7f'));}else{rpcDb[_0xe9ce('0x81')](ut['scheduledAt'](_0x1e7b32,'countnosuchnumberretry',_0x20c63[_0xe9ce('0x7b')]),_0x1e7b32['unlockAgent'],_0x1e7b32[_0xe9ce('0x82')]);}}delete this['actions'][_0x113421[_0xe9ce('0x83')]];}else{_0x1e7b32[_0xe9ce('0x71')]++;logger['info'](_0xe9ce('0x84'),_0x1e7b32['countnosuchnumberretry']);logger[_0xe9ce('0x20')]('id',_0x1e7b32['idContact']);_0x272650[_0xe9ce('0x85')]({'id':_0x1e7b32[_0xe9ce('0x86')],'field':{'countnosuchnumberretry':_0x1e7b32[_0xe9ce('0x71')]}})[_0xe9ce('0x53')](function(){_0x272650[_0xe9ce('0x87')](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});});}});break;case _0xe9ce('0x88'):var _0x4575a5=moment()[_0xe9ce('0x23')](_0xe9ce('0x5c'));_0x1e7b32[_0xe9ce('0x89')]=_0x4575a5;_0x1e7b32[_0xe9ce('0x8a')]=_0x4575a5;_0x1e7b32['dialAnswer']=!![];_0x20c63[_0xe9ce('0x28')]+=0x1;logger[_0xe9ce('0x20')](_0xe9ce('0x8b'),_0x1e7b32[_0xe9ce('0x8c')],_0xe9ce('0x8d'),_0x20c63[_0xe9ce('0x25')],_0xe9ce('0x8e'),_0x20c63['pTalking']);ami['emit']('custom:agentconnect',ut[_0xe9ce('0x77')](_0x1e7b32,_0xe9ce('0x8f'),this[_0xe9ce('0x12')][_0x1e7b32[_0xe9ce('0x40')]]));if(_0x20c63[_0xe9ce('0x90')]||_0x20c63[_0xe9ce('0x91')]){ami[_0xe9ce('0x75')](_0xe9ce('0x92'),{'queue':_0x1e7b32['queue'],'interface':_0x1e7b32[_0xe9ce('0x93')],'uniqueid':_0x1e7b32['uniqueid']});}break;case'16':ami[_0xe9ce('0x75')](_0xe9ce('0x94'),ut[_0xe9ce('0x77')](_0x1e7b32,_0xe9ce('0x95'),this[_0xe9ce('0x12')][_0x1e7b32['queue']]));emitVoiceQueueChannelRemove(ut[_0xe9ce('0x77')](_0x1e7b32,_0xe9ce('0x95')));_0x20c63[_0xe9ce('0x96')]+=0x1;_0x20c63['total']+=0x1;_0x20c63[_0xe9ce('0x97')]+=0x1;ut['decrementTalking'](_0x20c63,'[16]');_0x1e7b32['countglobal']=ut[_0xe9ce('0x73')](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0x4,_0xe9ce('0x98'));rpcDb[_0xe9ce('0x64')](_0x1e7b32,_0xe9ce('0x99'));rpcDb[_0xe9ce('0x66')](_0x1e7b32,_0xe9ce('0x9a'));rpcDb['crateCustomerReportQueue'](_0x1e7b32);_0x20c63[_0xe9ce('0x9b')]+=_0x1e7b32[_0xe9ce('0x9c')];_0x20c63[_0xe9ce('0x9d')]+=_0x1e7b32[_0xe9ce('0x9c')];logger[_0xe9ce('0x20')](_0xe9ce('0x9e'),_0x1e7b32[_0xe9ce('0x8c')],_0xe9ce('0x8d'),_0x20c63['name'],'pTalking:\x20',_0x20c63['pTalking']);delete this[_0xe9ce('0x3d')][_0x113421[_0xe9ce('0x83')]];break;case _0xe9ce('0x9f'):_0x20c63[_0xe9ce('0xa0')]+=0x1;_0x1e7b32[_0xe9ce('0xa1')]+=0x1;_0x1e7b32[_0xe9ce('0x72')]=ut[_0xe9ce('0x73')](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0x5,_0xe9ce('0xa2'));_0x18fcd4=_0x20c63[_0xe9ce('0xa3')];_0x2b3620=_0x20c63[_0xe9ce('0x7c')];ami[_0xe9ce('0x75')](_0xe9ce('0xa4'),ut[_0xe9ce('0x77')](_0x1e7b32,'busy'));rpcDb[_0xe9ce('0x64')](_0x1e7b32,'[callProgressDetectingCustomer][logBusy]');_0x272650['verifyAdditionalPhones'](_0x1e7b32,'5',_0x20c63)['then'](function(_0x1fd1c2){_0x29db83=_0x1fd1c2[_0xe9ce('0x7a')]==0x1;if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63[_0xe9ce('0xa5')]){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0xf,'Global');rpcDb[_0xe9ce('0x66')](_0x44e46f,_0xe9ce('0xa6'));}else{if(_0x1e7b32[_0xe9ce('0xa1')]>=_0x20c63[_0xe9ce('0xa7')]){rpcDb[_0xe9ce('0x66')](_0x1e7b32,_0xe9ce('0xa8'));}else{rpcDb[_0xe9ce('0x81')](ut[_0xe9ce('0xa9')](_0x1e7b32,'countbusyretry',_0x20c63['dialBusyRetryFrequency']),_0x1e7b32[_0xe9ce('0xaa')],_0x1e7b32[_0xe9ce('0x82')]);}}}else{_0x1e7b32['countbusyretry']++;_0x272650['incrementPreviewCounters']({'id':_0x1e7b32['idContact'],'field':{'countbusyretry':_0x1e7b32[_0xe9ce('0xa1')]}})['then'](function(){_0x272650[_0xe9ce('0x87')](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});});}});break;case _0xe9ce('0xab'):_0x20c63[_0xe9ce('0xac')]+=0x1;_0x1e7b32[_0xe9ce('0xad')]+=0x1;_0x1e7b32[_0xe9ce('0x72')]=ut[_0xe9ce('0x73')](_0x1e7b32);ut['logCustomer'](_0x1e7b32,0x3,'NoAnswer');_0x18fcd4=_0x20c63[_0xe9ce('0xae')];_0x2b3620=_0x20c63[_0xe9ce('0x7c')];var _0x59ebd2=ut[_0xe9ce('0xaf')](_0x1e7b32,_0x20c63);ami[_0xe9ce('0x75')](_0xe9ce('0xb0'),_0x59ebd2);rpcDb[_0xe9ce('0x64')](_0x1e7b32,'[callProgressDetectingCustomer][logNoAnswer]');_0x272650[_0xe9ce('0x79')](_0x1e7b32,'3',_0x20c63)[_0xe9ce('0x53')](function(_0x3df2db){_0x29db83=_0x3df2db[_0xe9ce('0x7a')]==0x1;if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63[_0xe9ce('0xa5')]){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0xf,_0xe9ce('0x7e'));rpcDb[_0xe9ce('0x66')](_0x44e46f,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x1e7b32['countnoanswerretry']>=_0x20c63[_0xe9ce('0xb1')]){rpcDb['createCustomerFinal'](_0x1e7b32,_0xe9ce('0xb2'));}else{rpcDb[_0xe9ce('0x81')](ut[_0xe9ce('0xa9')](_0x1e7b32,_0xe9ce('0xad'),_0x20c63['dialNoAnswerRetryFrequency']),_0x1e7b32[_0xe9ce('0xaa')],_0x1e7b32[_0xe9ce('0x82')]);}}}else{_0x1e7b32[_0xe9ce('0xad')]++;_0x272650['incrementPreviewCounters']({'id':_0x1e7b32['idContact'],'field':{'countnoanswerretry':_0x1e7b32[_0xe9ce('0xad')]}})[_0xe9ce('0x53')](function(){_0x272650[_0xe9ce('0x87')](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});});}});break;case'CONGESTION':_0x20c63[_0xe9ce('0xb3')]+=0x1;_0x1e7b32[_0xe9ce('0xb4')]+=0x1;_0x1e7b32[_0xe9ce('0x72')]=ut[_0xe9ce('0x73')](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0x8,_0xe9ce('0xb5'));_0x18fcd4=_0x20c63['dialCongestionRetryFrequency'];_0x2b3620=_0x20c63[_0xe9ce('0x7c')];ami[_0xe9ce('0x75')](_0xe9ce('0xb6'),ut['buildObj'](_0x1e7b32,_0xe9ce('0xb7')));rpcDb[_0xe9ce('0x64')](_0x1e7b32,_0xe9ce('0xb8'));_0x272650[_0xe9ce('0x79')](_0x1e7b32,'8',_0x20c63)[_0xe9ce('0x53')](function(_0x2223f5){_0x29db83=_0x2223f5[_0xe9ce('0x7a')]==0x1;if(!_0x29db83){if(ut['totalGlobal'](_0x1e7b32)>=_0x20c63['dialGlobalMaxRetry']){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0xf,_0xe9ce('0x7e'));rpcDb[_0xe9ce('0x66')](_0x44e46f,_0xe9ce('0xb9'));}else{if(_0x1e7b32['countcongestionretry']>=_0x20c63[_0xe9ce('0xba')]){rpcDb['createCustomerFinal'](_0x1e7b32,_0xe9ce('0xb8'));}else{rpcDb[_0xe9ce('0x81')](ut[_0xe9ce('0xa9')](_0x1e7b32,'countcongestionretry',_0x20c63[_0xe9ce('0xa3')]),_0x1e7b32['unlockAgent'],_0x1e7b32[_0xe9ce('0x82')]);}}}else{_0x1e7b32['countcongestionretry']++;_0x272650['incrementPreviewCounters']({'id':_0x1e7b32[_0xe9ce('0x86')],'field':{'countcongestionretry':_0x1e7b32[_0xe9ce('0xb4')]}})[_0xe9ce('0x53')](function(){_0x272650[_0xe9ce('0x87')](_0x1e7b32,_0x18fcd4,_0x2b3620)['then'](function(){});});}});break;case _0xe9ce('0xbb'):_0x20c63['outboundRejectCallsDay']+=0x1;_0x1e7b32[_0xe9ce('0xbc')]+=0x1;_0x1e7b32[_0xe9ce('0x72')]=ut['totalGlobal'](_0x1e7b32);ut['logCustomer'](_0x1e7b32,0x14,'AgentReject');_0x18fcd4=_0x20c63[_0xe9ce('0xbd')];_0x2b3620=_0x20c63[_0xe9ce('0x7c')];ami['emit']('custom:agentreject',ut['buildObj'](_0x1e7b32,_0xe9ce('0xbe')));rpcDb['createCustomerHistory'](_0x1e7b32,_0xe9ce('0xbf'));_0x272650['verifyAdditionalPhones'](_0x1e7b32,'20',_0x20c63)[_0xe9ce('0x53')](function(_0x25d12d){_0x29db83=_0x25d12d['additional']==0x1;if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63[_0xe9ce('0xa5')]){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0x14,_0xe9ce('0xc0'));rpcDb['createCustomerFinal'](_0x44e46f,_0xe9ce('0xc1'));}else{if(_0x1e7b32[_0xe9ce('0xbc')]>=_0x20c63[_0xe9ce('0xc2')]){rpcDb['createCustomerFinal'](_0x1e7b32,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0xe9ce('0xa9')](_0x1e7b32,_0xe9ce('0xbc'),_0x20c63[_0xe9ce('0xbd')]),_0x1e7b32['unlockAgent'],_0x1e7b32[_0xe9ce('0x82')]);}}}else{_0x1e7b32[_0xe9ce('0xad')]++;_0x272650['incrementPreviewCounters']({'id':_0x1e7b32[_0xe9ce('0x86')],'field':{'countnoanswerretry':_0x1e7b32[_0xe9ce('0xad')]}})[_0xe9ce('0x53')](function(){_0x272650[_0xe9ce('0x87')](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});});}});break;case'ABANDONED':_0x20c63[_0xe9ce('0xc3')]+=0x1;_0x1e7b32[_0xe9ce('0xc4')]+=0x1;_0x1e7b32['countglobal']=ut['totalGlobal'](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0xb,'Abandoned');rpcDb[_0xe9ce('0x64')](_0x1e7b32,_0xe9ce('0xc5'));_0x272650[_0xe9ce('0x79')](_0x1e7b32,'11',_0x20c63)[_0xe9ce('0x53')](function(_0x2baf96){_0x29db83=_0x2baf96[_0xe9ce('0x7a')]==0x1;if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63[_0xe9ce('0xa5')]){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0xf,_0xe9ce('0x7e'));rpcDb[_0xe9ce('0x66')](_0x44e46f,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x1e7b32[_0xe9ce('0xc6')]>=_0x20c63[_0xe9ce('0xc7')]){rpcDb[_0xe9ce('0x66')](_0x1e7b32,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0xe9ce('0xa9')](_0x1e7b32,_0xe9ce('0xc4'),_0x20c63[_0xe9ce('0xc8')]),_0x1e7b32[_0xe9ce('0xaa')],_0x1e7b32[_0xe9ce('0x82')]);}}}else{_0x1e7b32[_0xe9ce('0xad')]++;_0x272650[_0xe9ce('0x85')]({'id':_0x1e7b32[_0xe9ce('0x86')],'field':{'countnoanswerretry':_0x1e7b32[_0xe9ce('0xad')]}})[_0xe9ce('0x53')](function(){_0x272650[_0xe9ce('0x87')](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});});}});break;case'18':_0x20c63[_0xe9ce('0xc9')]+=0x1;_0x1e7b32['countmachineretry']+=0x1;_0x1e7b32[_0xe9ce('0x72')]=ut[_0xe9ce('0x73')](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0x12,_0x113421[_0xe9ce('0xca')]||_0x113421[_0xe9ce('0xcb')]);ami[_0xe9ce('0x75')](_0xe9ce('0xcc'),ut['buildObj'](_0x1e7b32,_0xe9ce('0xcd')));rpcDb[_0xe9ce('0x64')](_0x1e7b32,_0xe9ce('0xce'));_0x272650[_0xe9ce('0x79')](_0x1e7b32,'18',_0x20c63)['then'](function(_0x30100e){_0x29db83=_0x30100e[_0xe9ce('0x7a')]==0x1;if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63[_0xe9ce('0xa5')]){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0x12,'Global');rpcDb['createCustomerFinal'](_0x44e46f,_0xe9ce('0xce'));}else{rpcDb[_0xe9ce('0x66')](_0x1e7b32,_0xe9ce('0xce'));}}else{_0x1e7b32[_0xe9ce('0xad')]++;_0x272650[_0xe9ce('0x85')]({'id':_0x1e7b32[_0xe9ce('0x86')],'field':{'countnoanswerretry':_0x1e7b32['countnoanswerretry']}})[_0xe9ce('0x53')](function(){_0x272650['swapAdditionalPhones'](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});});}});delete this['actions'][_0x113421[_0xe9ce('0x83')]];break;case'19':_0x20c63[_0xe9ce('0xc9')]+=0x1;_0x1e7b32['countglobal']=ut[_0xe9ce('0x73')](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0x13,_0x113421[_0xe9ce('0xca')]||_0x113421[_0xe9ce('0xcb')]);ami[_0xe9ce('0x75')]('custom:amd',ut[_0xe9ce('0x77')](_0x1e7b32,_0xe9ce('0xcd')));rpcDb[_0xe9ce('0x64')](_0x1e7b32,_0xe9ce('0xcf'));_0x272650[_0xe9ce('0x79')](_0x1e7b32,'18',_0x20c63)[_0xe9ce('0x53')](function(_0x5388d3){_0x29db83=_0x5388d3[_0xe9ce('0x7a')]==0x1;if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63['dialGlobalMaxRetry']){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0xf,_0xe9ce('0x7e'));rpcDb[_0xe9ce('0x66')](_0x44e46f,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xe9ce('0x66')](_0x1e7b32,'[callProgressDetectingCustomer][machine]');}}else{_0x1e7b32[_0xe9ce('0xad')]++;_0x272650[_0xe9ce('0x85')]({'id':_0x1e7b32['idContact'],'field':{'countnoanswerretry':_0x1e7b32[_0xe9ce('0xad')]}})[_0xe9ce('0x53')](function(){_0x272650['swapAdditionalPhones'](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});});}});delete this[_0xe9ce('0x3d')][_0x113421['linkedid']];break;default:if(_0x1e7b32['dialAnswer']){ut[_0xe9ce('0x4d')](_0x20c63,'[default]');ut[_0xe9ce('0x4e')]('[Dialer][decrementTalking][no\x20Hangup][Preview]'+_0x20c63[_0xe9ce('0x25')],_0x113421);}_0x20c63['outboundUnknownCallsDay']+=0x1;_0x1e7b32[_0xe9ce('0x72')]=ut[_0xe9ce('0x73')](_0x1e7b32);ut[_0xe9ce('0x5e')](_0x1e7b32,0xc,_0x113421[_0xe9ce('0xca')]||_0x113421[_0xe9ce('0xcb')]);_0x18fcd4=_0x20c63[_0xe9ce('0xbd')];_0x2b3620=_0x20c63[_0xe9ce('0x7c')];rpcDb[_0xe9ce('0x64')](_0x1e7b32,_0xe9ce('0xd0'));_0x272650[_0xe9ce('0x79')](_0x1e7b32,'20',_0x20c63)[_0xe9ce('0x53')](function(_0x412b26){_0x29db83=_0x412b26[_0xe9ce('0x7a')]==0x1;if(!_0x29db83){if(ut[_0xe9ce('0x73')](_0x1e7b32)>=_0x20c63['dialGlobalMaxRetry']){_0x44e46f=ut[_0xe9ce('0x7d')](_0x1e7b32,0xf,_0xe9ce('0x7e'));rpcDb[_0xe9ce('0x66')](_0x44e46f,_0xe9ce('0xd1'));}else{rpcDb[_0xe9ce('0x66')](_0x1e7b32,_0xe9ce('0xd1'));}delete this[_0xe9ce('0x3d')][_0x113421['linkedid']];}else{_0x272650[_0xe9ce('0x87')](_0x1e7b32,_0x18fcd4,_0x2b3620)[_0xe9ce('0x53')](function(){});}});}if(!(_0x1e7b32[_0xe9ce('0x42')]&&_0x4c1de0==='16')){utils[_0xe9ce('0x4b')](_0x20c63,_0xe9ce('0xd2'));logger[_0xe9ce('0x20')](_0xe9ce('0xd3'),_0x1e7b32[_0xe9ce('0x8c')],_0xe9ce('0x8d'),_0x20c63[_0xe9ce('0x25')],'originated:\x20',_0x20c63[_0xe9ce('0x27')]);}if(_0x4c1de0!==_0xe9ce('0x88')){delete this[_0xe9ce('0x3d')][_0x113421[_0xe9ce('0x83')]];delete this['actions'][_0x113421[_0xe9ce('0xd4')]];}_0x20c63[_0xe9ce('0xd5')]=!![];}};Preview[_0xe9ce('0x30')][_0xe9ce('0xd6')]=function(_0x2fb4d6,_0x1445ce,_0xb81a2f){if(_['isUndefined'](_0x1445ce)&&_0xe9ce('0xd7')!==typeof _0x1445ce){return;}if(_[_0xe9ce('0xd8')](_0xb81a2f)&&_0xe9ce('0xd7')!==typeof _0xb81a2f){return;}switch(_0xb81a2f[_0xe9ce('0xd9')]){case'0':ut['logAgent'](_0x2fb4d6,0x0,'NoSuchNumber');rpcDb[_0xe9ce('0xda')](_0x2fb4d6,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xe9ce('0xdb')](_0x2fb4d6,0x3,_0xe9ce('0xdc'));rpcDb[_0xe9ce('0xda')](_0x2fb4d6,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xe9ce('0xdb')](_0x2fb4d6,0x5,_0xe9ce('0xa2'));rpcDb[_0xe9ce('0xda')](_0x2fb4d6,_0xe9ce('0xdd'));break;case'8':ut[_0xe9ce('0xdb')](_0x2fb4d6,0x8,_0xe9ce('0xb5'));rpcDb[_0xe9ce('0xda')](_0x2fb4d6,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xe9ce('0xdb')](_0x2fb4d6,0x16,_0xe9ce('0xde'));rpcDb[_0xe9ce('0xda')](_0x2fb4d6,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x2fb4d6,0xc,_0xb81a2f['reason']);rpcDb[_0xe9ce('0xda')](_0x2fb4d6,_0xe9ce('0xdf'));}utils[_0xe9ce('0x4b')](_0x1445ce,_0xe9ce('0xe0'));logger[_0xe9ce('0x20')](_0xe9ce('0xe1'),_0x2fb4d6[_0xe9ce('0x8c')],_0xe9ce('0x8d'),_0x1445ce['name'],_0xe9ce('0x41'),_0x1445ce[_0xe9ce('0x27')]);delete this['actions'][_0x2fb4d6[_0xe9ce('0x8c')]];};Preview[_0xe9ce('0x30')]['verifyAdditionalPhones']=function(_0x31c6c2,_0x3293a1,_0x2b4eaa){return cmHopperAdditionalPhone[_0xe9ce('0x79')](_0x31c6c2,_0x3293a1,_0x2b4eaa)[_0xe9ce('0x49')](logger[_0xe9ce('0x20')](_0xe9ce('0xe2')));};Preview['prototype'][_0xe9ce('0x87')]=function(_0x13e0ae,_0x1197dc,_0x5a5d28){return cmHopperAdditionalPhone[_0xe9ce('0x87')](_0x13e0ae,_0x1197dc,_0x5a5d28)[_0xe9ce('0x49')](logger[_0xe9ce('0x20')]('[swapAdditionalPhone]\x20'));};Preview[_0xe9ce('0x30')][_0xe9ce('0x85')]=function(_0x5d13ef){return Promise['resolve']()[_0xe9ce('0x53')](cmHopperAdditionalPhone[_0xe9ce('0x85')](_0x5d13ef))['catch'](logger[_0xe9ce('0x20')]('[incrementPreviewCounters]\x20'));};Preview[_0xe9ce('0x30')]['checkInBlack']=function(_0x10def0,_0x10e37d,_0x158989,_0x385d5b,_0x1aed2f){var _0x9ef10=this;return new Promise(function(_0x66bf90,_0xafaade){if(_[_0xe9ce('0x3c')](_0x10e37d)||_['isNil'](_0x10e37d[_0xe9ce('0xe3')])||_[_0xe9ce('0x3c')](_0x10e37d[_0xe9ce('0xe4')])||_[_0xe9ce('0x3c')](_0x10e37d['VoiceQueueId'])){_0xafaade(ut['message']('Contact\x20is\x20undefined',_0x385d5b,_0x1aed2f));return;}var _0x309a97=uuid['v4']();var _0x184273=_0x9ef10[_0xe9ce('0x12')][_0x10e37d['Queue'][_0xe9ce('0x25')]];var _0x5f4867=_0x158989?_0x9ef10[_0xe9ce('0x14')][_0x158989]['id']:undefined;_0x9ef10['actions'][_0x309a97]=new Action(_0x10e37d,_0x184273,_0x309a97,_0x158989,_0x5f4867);var _0x5270b5=_0x9ef10[_0xe9ce('0x3d')][_0x309a97];_0x5270b5[_0xe9ce('0xaa')]=_0x385d5b;_0x5270b5['activeContact']=_0x1aed2f;_0x5270b5[_0xe9ce('0xe5')]=_0x158989;if(_[_0xe9ce('0xe6')](_0x10def0)){_0x9ef10[_0xe9ce('0xe7')](_0x5270b5,_0x184273,_0x10e37d,_0x158989)[_0xe9ce('0x53')](function(_0x1e654d){logger['info']('[Preview][execCall][success]',_0xe9ce('0xe8')+_0x5270b5[_0xe9ce('0x40')]+_0xe9ce('0xe9')+_0x5270b5[_0xe9ce('0x86')],JSON[_0xe9ce('0x22')](_0x1e654d));ami[_0xe9ce('0x75')](_0xe9ce('0xea'),ut[_0xe9ce('0x77')](_0x5270b5,'called',_0x9ef10[_0xe9ce('0x12')][_0x5270b5[_0xe9ce('0x40')]]));_0x66bf90(ut[_0xe9ce('0x2a')](_0xe9ce('0xeb')));})['catch'](function(_0x2b6120){ut[_0xe9ce('0x2c')](_0xe9ce('0xec'),_0x2b6120);_0xafaade(ut[_0xe9ce('0x2a')]('Call\x20failed',_0x385d5b,_0x1aed2f));});}else{_0x184273[_0xe9ce('0xed')]+=0x1;ut[_0xe9ce('0xee')](_0x5270b5);rpcDb[_0xe9ce('0xef')](_0x5270b5,_0xe9ce('0xf0'));delete _0x9ef10[_0xe9ce('0x3d')][_0x309a97];_0xafaade(ut[_0xe9ce('0x2a')](_0xe9ce('0xf1'),_0x385d5b,_0x1aed2f));}});};Preview['prototype'][_0xe9ce('0x6d')]=function(_0x58612d){return!_[_0xe9ce('0x3c')](_0x58612d)&&!_['isNil'](_0x58612d['name'])&&!_[_0xe9ce('0x3c')](_0x58612d['active'])&&_0x58612d[_0xe9ce('0xf2')]&&!_[_0xe9ce('0x3c')](this['trunks'][util[_0xe9ce('0x23')]('SIP/%s',_0x58612d['name'])])&&!_[_0xe9ce('0x3c')](this[_0xe9ce('0x13')][util[_0xe9ce('0x23')](_0xe9ce('0xf3'),_0x58612d[_0xe9ce('0x25')])][_0xe9ce('0x47')])&&(this[_0xe9ce('0x13')][util[_0xe9ce('0x23')]('SIP/%s',_0x58612d['name'])]['status']==='reachable'||this[_0xe9ce('0x13')][util[_0xe9ce('0x23')](_0xe9ce('0xf3'),_0x58612d['name'])][_0xe9ce('0x47')]===_0xe9ce('0xf4'));};Preview[_0xe9ce('0x30')]['run']=function(_0x307e73,_0x504848){return this[_0xe9ce('0xf5')](_0x307e73,_0x504848)[_0xe9ce('0x53')](function(_0x2b17da){return _[_0xe9ce('0x43')](_0x2b17da,[_0xe9ce('0x2a')]);})['catch'](function(_0x47cfdd){if(_0x47cfdd['unlock']){rpcDb['unlockContact'](_0x307e73);}if(_0x47cfdd[_0xe9ce('0xf2')]){rpcDb[_0xe9ce('0xf6')](_0x307e73);}throw _[_0xe9ce('0x43')](_0x47cfdd,[_0xe9ce('0x2a')]);});};Preview['prototype'][_0xe9ce('0xf5')]=function(_0x2fc33e,_0x2c1190){var _0x391560=this;var _0xc1f0ae,_0x284c67;return rpcDb[_0xe9ce('0xf7')](_0x2fc33e)[_0xe9ce('0x53')](function(_0x2f0c83){if(!_[_0xe9ce('0x3c')](_0x2f0c83[0x0])){_0x284c67=_0x2f0c83[0x0][_0xe9ce('0xf8')]?![]:!![];_0xc1f0ae=_0x2f0c83[0x0][_0xe9ce('0xf8')]?!![]:![];_0xc1f0ae=_0x2c1190?!![]:_0xc1f0ae;}var _0x2b1dce=_0x391560['validateContact'](_0x2f0c83);if(_0x2b1dce[_0xe9ce('0xf9')]){rpcDb['checkIsBlackList'](_[_0xe9ce('0x43')](_0x2f0c83[0x0],[_0xe9ce('0x45'),'phone']))[_0xe9ce('0x53')](function(_0x3db8b0){_0x391560[_0xe9ce('0xfa')](_0x3db8b0,_0x2f0c83[0x0],_0x2c1190,_0x284c67,_0xc1f0ae)[_0xe9ce('0x53')](function(_0x34a663){return _0x34a663;})['catch'](function(_0x1b2607){throw _0x1b2607;});})[_0xe9ce('0x49')](function(_0x528bfd){ut[_0xe9ce('0x2c')](_0xe9ce('0xfb'),_0x528bfd);throw ut[_0xe9ce('0x2a')](_0xe9ce('0xfc'),_0x284c67,_0xc1f0ae);});}else{throw ut[_0xe9ce('0x2a')](_0x2b1dce[_0xe9ce('0x2a')],_0x284c67,_0xc1f0ae);}})['catch'](function(_0x59f1d3){ut['logger'](_0xe9ce('0xfd'),_0x59f1d3);throw ut[_0xe9ce('0x2a')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xe9ce('0x30')][_0xe9ce('0xfe')]=function(_0x12c450){if(_[_0xe9ce('0x3c')](_0x12c450)||_['isEmpty'](_0x12c450)||!_[_0xe9ce('0x3c')](_0x12c450[0x0][_0xe9ce('0x58')])&&_[_0xe9ce('0x3c')](_0x12c450[0x0]['Agent'][_0xe9ce('0x25')])){ut['logger'](_0xe9ce('0xff'),_0x12c450);return{'isValid':![],'message':_0xe9ce('0x100')};}var _0x555e38=this[_0xe9ce('0x12')][_0x12c450[0x0][_0xe9ce('0x3f')][_0xe9ce('0x25')]];_0x555e38[_0xe9ce('0x2a')]=utils[_0xe9ce('0x2b')][_0xe9ce('0x70')];if(_[_0xe9ce('0x3c')](_0x555e38)){ut[_0xe9ce('0x2c')]('[Preview][validateContact][Empty\x20Campaign]',_0x555e38);return{'isValid':![],'message':_0xe9ce('0x101')};}if(!this[_0xe9ce('0x6d')](_0x555e38[_0xe9ce('0x6e')])){ut[_0xe9ce('0x2c')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xe9ce('0x102')+_0x555e38['name']+_0xe9ce('0x103'));if(!this['isTrunkReachable'](_0x555e38[_0xe9ce('0x6f')])){ut[_0xe9ce('0x2c')](_0xe9ce('0x104'),_0x555e38[_0xe9ce('0x25')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xe9ce('0x105')};}}if(!ut[_0xe9ce('0x6b')](_0x555e38[_0xe9ce('0x6c')])){ut[_0xe9ce('0x2c')]('[Preview][validateContact][Campaign\x20Active]',_0x555e38[_0xe9ce('0x25')]+_0xe9ce('0x106'));return{'isValid':![],'message':_0xe9ce('0x102')+_0x555e38['name']+_0xe9ce('0x106')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype']['execCall']=function(_0x526bbc,_0x5927a2,_0x261c4e,_0x3f40f7){var _0x19773c=this;return new Promise(function(_0x20d21d,_0x4a9c17){var _0x52be93=_0x526bbc['uniqueid'];var _0x5395ce=_0x19773c['isTrunkReachable'](_0x5927a2[_0xe9ce('0x6e')])?util[_0xe9ce('0x23')](_0xe9ce('0x107'),_0x5927a2['Trunk']['name'],_['isNil'](_0x5927a2[_0xe9ce('0x108')])?'':_0x5927a2[_0xe9ce('0x108')]['trim']()||'',_0x5927a2[_0xe9ce('0x109')]>0x0?_0x261c4e[_0xe9ce('0xe4')][_0xe9ce('0x10a')](_0x5927a2[_0xe9ce('0x109')]):_0x261c4e[_0xe9ce('0xe4')]):util['format'](_0xe9ce('0x107'),_['isNil'](_0x5927a2['TrunkBackup'])?_0x5927a2[_0xe9ce('0x6e')][_0xe9ce('0x25')]:_0x5927a2['TrunkBackup'][_0xe9ce('0x25')],_[_0xe9ce('0x3c')](_0x5927a2[_0xe9ce('0x108')])?'':_0x5927a2['dialPrefix'][_0xe9ce('0x10b')]()||'',_0x5927a2[_0xe9ce('0x109')]>0x0?_0x261c4e[_0xe9ce('0xe4')]['substring'](_0x5927a2[_0xe9ce('0x109')]):_0x261c4e[_0xe9ce('0xe4')]);var _0xf6e8bc=_0x19773c['isTrunkReachable'](_0x5927a2[_0xe9ce('0x6e')])?ut[_0xe9ce('0x10c')](_0x5927a2['Trunk'][_0xe9ce('0x10d')],_0x5927a2[_0xe9ce('0x10e')],_0x5927a2[_0xe9ce('0x10f')]>0x0?ut['getCallerIdRandom'](_0x5927a2[_0xe9ce('0x110')],_0x5927a2['dialRandomLastDigitCallerIdNumber']):_0x5927a2[_0xe9ce('0x110')]):ut[_0xe9ce('0x10c')](_['isNil'](_0x5927a2[_0xe9ce('0x6f')])?_0x5927a2[_0xe9ce('0x6e')][_0xe9ce('0x10d')]:_0x5927a2['TrunkBackup'][_0xe9ce('0x10d')],_0x5927a2['dialOriginateCallerIdName'],_0x5927a2[_0xe9ce('0x10f')]>0x0?ut[_0xe9ce('0x111')](_0x5927a2[_0xe9ce('0x110')],_0x5927a2['dialRandomLastDigitCallerIdNumber']):_0x5927a2[_0xe9ce('0x110')]);if(_0xf6e8bc){_0x526bbc['originatecalleridname']=ut[_0xe9ce('0x112')](_0xf6e8bc);_0x526bbc[_0xe9ce('0x113')]=ut['extractCalleridNumber'](_0xf6e8bc);}var _0x50ab03=ut['addVariables'](_0x5927a2,_0x261c4e,_0x5395ce,_0xf6e8bc,_0x52be93,_0x526bbc);var _0x2114f5=utils[_0xe9ce('0x114')](_0x261c4e[_0xe9ce('0xe3')]);Object[_0xe9ce('0x115')](_0x50ab03,_0x2114f5);_[_0xe9ce('0x116')](_0x526bbc,ut[_0xe9ce('0x117')](_0x50ab03));_0x526bbc['starttime']=moment()[_0xe9ce('0x23')]('YYYY-MM-DD\x20HH:mm:ss');_0x5927a2[_0xe9ce('0x118')]=_0x50ab03;var _0x451f9e=ut[_0xe9ce('0x119')](_0x526bbc,_0x5927a2,_0x50ab03,_0x526bbc[_0xe9ce('0x82')],_0x3f40f7);return ami[_0xe9ce('0x46')](_0x451f9e)[_0xe9ce('0x53')](function(_0x49006e){_0x5927a2[_0xe9ce('0x27')]+=0x1;logger[_0xe9ce('0x20')](_0xe9ce('0x11a'),_0x52be93,'\x20Queue',_0x5927a2[_0xe9ce('0x25')],'originated:\x20',_0x5927a2[_0xe9ce('0x27')]);_0x20d21d(_0x49006e);})[_0xe9ce('0x49')](function(_0x4a5180){ut[_0xe9ce('0xdb')](_0x526bbc,0xe,_0xe9ce('0x11b'));rpcDb[_0xe9ce('0xda')](_0x526bbc,_0xe9ce('0x11c'));_0x4a9c17(_0x4a5180);});});};Preview[_0xe9ce('0x30')]['syncNewExten']=function(_0x1998b1){if(this[_0xe9ce('0x3d')][_0x1998b1[_0xe9ce('0x83')]]){this[_0xe9ce('0x3d')][_0x1998b1[_0xe9ce('0x83')]]['channel']=_0x1998b1[_0xe9ce('0x48')];}};Preview[_0xe9ce('0x30')][_0xe9ce('0x11d')]=function(_0x15818a){var _0x160e1f=this;var _0x2640d1=this[_0xe9ce('0x3d')][_0x15818a[_0xe9ce('0x11e')]];if(_0x2640d1){if(_0x2640d1[_0xe9ce('0xe5')]&&this[_0xe9ce('0x14')][_0x2640d1['lookAgent']]){ut[_0xe9ce('0x11f')](_0x2640d1,this[_0xe9ce('0x14')][_0x2640d1[_0xe9ce('0xe5')]]['name'],this[_0xe9ce('0x14')][_0x2640d1[_0xe9ce('0xe5')]]['id']);}var _0x2e9926=_[_0xe9ce('0x120')](_0x2640d1);_0x2e9926[_0xe9ce('0x89')]=moment()['format'](_0xe9ce('0x5c'));var _0x3379a1=_0x160e1f[_0xe9ce('0x12')][_0x2640d1[_0xe9ce('0x40')]];if(ut[_0xe9ce('0x121')](_0x15818a[_0xe9ce('0x122')])){if(_0x2640d1[_0xe9ce('0xaa')]){rpcDb['unlockContact'](_0x2640d1[_0xe9ce('0x86')]);}if(_0x2640d1[_0xe9ce('0x82')]){rpcDb[_0xe9ce('0xf6')](_0x2640d1[_0xe9ce('0x86')]);}ami[_0xe9ce('0x75')](_0xe9ce('0x123'),ut[_0xe9ce('0x77')](_0x2640d1,_0xe9ce('0x124'),this[_0xe9ce('0x12')][_0x2640d1[_0xe9ce('0x40')]]));this[_0xe9ce('0xd6')](_0x2e9926,_0x3379a1,_0x15818a);}else{_0x2640d1[_0xe9ce('0x125')]=moment()[_0xe9ce('0x23')](_0xe9ce('0x5c'));ut[_0xe9ce('0xdb')](_0x2e9926,0x4,'Answer');rpcDb[_0xe9ce('0xda')](_0x2e9926,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xe9ce('0x30')][_0xe9ce('0x16')]=function(_0x21caba){var _0x558a1d=this[_0xe9ce('0x3d')][_0x21caba[_0xe9ce('0x83')]];var _0x38ae12;if(_0x558a1d){_0x38ae12=this[_0xe9ce('0x12')][_0x558a1d[_0xe9ce('0x40')]];logger[_0xe9ce('0x20')](_0xe9ce('0x126'),_0x21caba['linkedid'],_0xe9ce('0x8d'),_0x38ae12[_0xe9ce('0x25')],_0xe9ce('0x8e'),_0x38ae12[_0xe9ce('0x28')]);}if(this[_0xe9ce('0x3d')][_0x21caba['linkedid']]&&_0x21caba[_0xe9ce('0x83')]!==_0x21caba[_0xe9ce('0x8c')]){if(_0x21caba['cause']==='16'&&this[_0xe9ce('0x3d')][_0x21caba[_0xe9ce('0x83')]][_0xe9ce('0x42')]){this[_0xe9ce('0x127')](_0x21caba,_0x21caba[_0xe9ce('0x83')],_0x21caba[_0xe9ce('0x128')]);}else if(this[_0xe9ce('0x3d')][_0x21caba[_0xe9ce('0x83')]][_0xe9ce('0x42')]){logger[_0xe9ce('0x20')](_0xe9ce('0x129'),_0x21caba['linkedid'],_0x21caba['cause'],_0xe9ce('0x8d'),_0x38ae12[_0xe9ce('0x25')],_0xe9ce('0x8e'),_0x38ae12[_0xe9ce('0x28')]);this['callProgressDetectingCustomer'](_0x21caba,_0x21caba[_0xe9ce('0x83')],_0x21caba['cause']);}}else if(_0x558a1d&&_['isNil'](_0x558a1d[_0xe9ce('0x12a')])&&_0x38ae12[_0xe9ce('0x12b')]&&_0x21caba[_0xe9ce('0x83')]===_0x21caba['uniqueid']&&_['isNil'](_0x21caba[_0xe9ce('0xd9')])&&_0x21caba['cause']==='16'&&_0x21caba['channelstate']==='6'&&_['isUndefined'](_0x558a1d[_0xe9ce('0x12c')])){if(_0x558a1d[_0xe9ce('0xaa')]){rpcDb[_0xe9ce('0x12d')](_0x558a1d[_0xe9ce('0x86')]);}if(_0x558a1d[_0xe9ce('0x82')]){rpcDb[_0xe9ce('0xf6')](_0x558a1d['idContact']);}_0x21caba[_0xe9ce('0xd9')]='22';this[_0xe9ce('0xd6')](_0x558a1d,_0x38ae12,_0x21caba);}else if(_0x558a1d&&_0x558a1d['transfer']){if(_0x21caba[_0xe9ce('0x128')]==='16'&&this['actions'][_0x21caba['linkedid']][_0xe9ce('0x42')]){logger['info'](_0xe9ce('0x12e'),_0x21caba['linkedid'],_0x21caba[_0xe9ce('0x128')],_0xe9ce('0x8d'),_0x38ae12[_0xe9ce('0x25')],'pTalking:\x20',_0x38ae12[_0xe9ce('0x28')]);this[_0xe9ce('0x127')](_0x21caba,_0x21caba[_0xe9ce('0x83')],_0x21caba[_0xe9ce('0x128')]);}else if(this['actions'][_0x21caba[_0xe9ce('0x83')]][_0xe9ce('0x42')]){logger[_0xe9ce('0x20')](_0xe9ce('0x129'),_0x21caba[_0xe9ce('0x83')],_0x21caba['cause'],_0xe9ce('0x8d'),_0x38ae12[_0xe9ce('0x25')],'pTalking:\x20',_0x38ae12[_0xe9ce('0x28')]);this[_0xe9ce('0x127')](_0x21caba,_0x21caba[_0xe9ce('0x83')],_0x21caba[_0xe9ce('0x128')]);}}};Preview[_0xe9ce('0x30')]['syncDialEnd']=function(_0x5ce23b){if(this['actions'][_0x5ce23b[_0xe9ce('0xd4')]]&&_0x5ce23b[_0xe9ce('0xd4')]!==_0x5ce23b[_0xe9ce('0x12f')]){this[_0xe9ce('0x127')](_0x5ce23b,_0x5ce23b[_0xe9ce('0xd4')],_0x5ce23b[_0xe9ce('0xcb')]);}};Preview[_0xe9ce('0x30')][_0xe9ce('0x130')]=function(_0x425fc2){if(this[_0xe9ce('0x3d')][_0x425fc2[_0xe9ce('0x83')]]&&_0x425fc2[_0xe9ce('0x83')]!==_0x425fc2[_0xe9ce('0x8c')]&&!this['actions'][_0x425fc2[_0xe9ce('0x83')]][_0xe9ce('0x42')]){if(_0x425fc2['cause']==='1'){this[_0xe9ce('0x127')](_0x425fc2,_0x425fc2[_0xe9ce('0x83')],_0x425fc2[_0xe9ce('0x128')]);}}};Preview['prototype']['addVariable']=function(_0x26bbe,_0x5972e7,_0xd5cbaf){if(this[_0xe9ce('0x3d')][_0x26bbe]){if(_[_0xe9ce('0x3c')](this[_0xe9ce('0x3d')][_0x26bbe]['variables'])){this[_0xe9ce('0x3d')][_0x26bbe][_0xe9ce('0x118')]={};}this[_0xe9ce('0x3d')][_0x26bbe][_0xe9ce('0x118')][_0x5972e7]=_0xd5cbaf;}};Preview['prototype'][_0xe9ce('0x131')]=function(_0x2a354b){try{if(!_[_0xe9ce('0x3c')](_0x2a354b)){if(ut[_0xe9ce('0x132')](_[_0xe9ce('0x133')](_0x2a354b[_0xe9ce('0x134')])[0x0])){this[_0xe9ce('0x135')](_0x2a354b[_0xe9ce('0x8c')],_[_0xe9ce('0x133')](_0x2a354b['variable'])[0x0],_0x2a354b['value']);}}}catch(_0x6c0c88){logger[_0xe9ce('0x136')](_0xe9ce('0x137'),util[_0xe9ce('0x138')](_0x6c0c88,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x5523e0){if(_0x5523e0){if(this[_0xe9ce('0x3d')][_0x5523e0[_0xe9ce('0x139')]]){this['actions'][_0x5523e0['transfertargetlinkedid']][_0xe9ce('0x12c')]=!![];}}};Preview[_0xe9ce('0x30')][_0xe9ce('0x13a')]=function(_0x13ad13){if(_0x13ad13){if(this[_0xe9ce('0x3d')][_0x13ad13[_0xe9ce('0x13b')]]){this['actions'][_0x13ad13['transfererlinkedid']][_0xe9ce('0x12c')]=!![];}}};module[_0xe9ce('0x13c')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index f4c8117..2f457a2 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 _0xb1c7=['[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','then','catch','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact'];(function(_0x463231,_0x3ec1da){var _0x5369a2=function(_0x5ec21c){while(--_0x5ec21c){_0x463231['push'](_0x463231['shift']());}};_0x5369a2(++_0x3ec1da);}(_0xb1c7,0x119));var _0x7b1c=function(_0x4051be,_0x4e30dc){_0x4051be=_0x4051be-0x0;var _0x10d8e5=_0xb1c7[_0x4051be];return _0x10d8e5;};'use strict';var util=require(_0x7b1c('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b1c('0x1'))(_0x7b1c('0x2'));var cmHopper=require(_0x7b1c('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x7b1c('0x4'));var voiceQueueReport=require(_0x7b1c('0x5'));function loggerCatch(_0x5d69be){return function(_0x15a91a){logger[_0x7b1c('0x6')](_0x5d69be,util[_0x7b1c('0x7')](_0x15a91a,{'showHidden':![],'depth':null}));};}function create(_0xa4e24){return cmHopperHistory[_0x7b1c('0x8')](_0xa4e24)['catch'](loggerCatch(_0x7b1c('0x9')));}function createAgent(_0x32b083){return BPromise[_0x7b1c('0xa')]()[_0x7b1c('0xb')](agentReportPreview['createHistory'](_0x32b083))[_0x7b1c('0xc')](loggerCatch(_0x7b1c('0x9')));}function moveContact(_0x2cafdf){return cmHopper['moveContactManagedDialer'](_0x2cafdf,!![])[_0x7b1c('0xc')](loggerCatch(_0x7b1c('0xd')));}exports[_0x7b1c('0xe')]=function(_0x2fab53){return cmHopperBlack['checkIsBlackList'](_0x2fab53)[_0x7b1c('0xc')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0xf21a98){return BPromise[_0x7b1c('0xa')]()[_0x7b1c('0xb')](cmHopper[_0x7b1c('0xf')](_0xf21a98))[_0x7b1c('0xc')](loggerCatch(_0x7b1c('0x10')));};exports[_0x7b1c('0x8')]=function(_0x121d9d,_0x4c3e37){create(_0x121d9d)[_0x7b1c('0xc')](loggerCatch(_0x4c3e37));moveContact(_0x121d9d)[_0x7b1c('0xc')](loggerCatch(_0x4c3e37));};exports[_0x7b1c('0x11')]=function(_0x55c929,_0x320eab){createAgent(_0x55c929)[_0x7b1c('0xc')](loggerCatch(_0x320eab));};exports['createCustomerHistory']=function(_0x11f63a,_0x2cbffc){create(_0x11f63a)[_0x7b1c('0xc')](loggerCatch(_0x2cbffc));};exports[_0x7b1c('0x12')]=function(_0x25f229,_0x258282){moveContact(_0x25f229)[_0x7b1c('0xc')](loggerCatch(_0x258282));};exports[_0x7b1c('0x13')]=function(_0x50d32a,_0x4f3023,_0x507e99){if(_0x4f3023){_0x50d32a[_0x7b1c('0x14')]=null;}if(_0x507e99){_0x50d32a[_0x7b1c('0x15')]=![];}return cmHopper[_0x7b1c('0x13')](_0x50d32a)[_0x7b1c('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x7b1c('0x16')]=function(_0x3f7133){return cmHopper[_0x7b1c('0x16')](_0x3f7133)['catch'](loggerCatch(_0x7b1c('0x17')));};exports[_0x7b1c('0x18')]=function(_0x5a4475){return cmHopper['unlockContact']({'UserId':null},_0x5a4475,0x1)[_0x7b1c('0xc')](loggerCatch(_0x7b1c('0x19')));};exports[_0x7b1c('0x1a')]=function(_0xfbb767){return cmHopper[_0x7b1c('0x18')]({'active':![]},_0xfbb767,0x1)['catch'](loggerCatch(_0x7b1c('0x1b')));};exports[_0x7b1c('0x1c')]=function(_0xf3df56){var _0x59fbd4={};_0x59fbd4[_0x7b1c('0x1d')]=_0xf3df56[_0x7b1c('0x1d')];_0x59fbd4['uniqueid']=_0xf3df56[_0x7b1c('0x1e')];_0x59fbd4[_0x7b1c('0x1f')]=_0xf3df56[_0x7b1c('0x1f')];_0x59fbd4[_0x7b1c('0x20')]=_0xf3df56['calleridname'];_0x59fbd4['queue']=_0xf3df56[_0x7b1c('0x21')];_0x59fbd4['queuecallerjoinAt']=_0xf3df56[_0x7b1c('0x22')];_0x59fbd4[_0x7b1c('0x23')]=_0xf3df56['answertime'];_0x59fbd4[_0x7b1c('0x24')]=0x1;_0x59fbd4[_0x7b1c('0x25')]=_0xf3df56['endtime'];_0x59fbd4[_0x7b1c('0x26')]=_0xf3df56[_0x7b1c('0x27')];_0x59fbd4[_0x7b1c('0x28')]=_0x7b1c('0x29');_0x59fbd4[_0x7b1c('0x2a')]='xcally-motion-preview';_0x59fbd4[_0x7b1c('0x2b')]=0x0;_0x59fbd4[_0x7b1c('0x2c')]=0x1;_0x59fbd4[_0x7b1c('0x2d')]=_0xf3df56[_0x7b1c('0x27')];_0x59fbd4['queuecallerexitreason']=_0x7b1c('0x2e');return BPromise[_0x7b1c('0xa')]()[_0x7b1c('0xb')](voiceQueueReport[_0x7b1c('0x2f')](_0x59fbd4))[_0x7b1c('0xc')](loggerCatch(_0x7b1c('0x30')));};exports[_0x7b1c('0x31')]=function(_0x5e9f12,_0x35579c){return BPromise[_0x7b1c('0xa')]()[_0x7b1c('0xb')](cmHopper['getContactRecallMe'](_0x5e9f12,_0x35579c))[_0x7b1c('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x7b1c('0x32')]=function(_0x41b170){return cmHopper[_0x7b1c('0x13')](_0x41b170,!![],!![])[_0x7b1c('0xc')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x3b7a=['../rpc/agentReportPreview','error','inspect','createHistory','catch','[createHistory]\x20','resolve','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack'];(function(_0x406fbb,_0x1093e5){var _0x8e921d=function(_0x410517){while(--_0x410517){_0x406fbb['push'](_0x406fbb['shift']());}};_0x8e921d(++_0x1093e5);}(_0x3b7a,0x10e));var _0xa3b7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3b7a[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0xa3b7('0x0'));var BPromise=require('bluebird');var logger=require(_0xa3b7('0x1'))(_0xa3b7('0x2'));var cmHopper=require(_0xa3b7('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xa3b7('0x4'));var agentReportPreview=require(_0xa3b7('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x2b9e8a){return function(_0x2a3f42){logger[_0xa3b7('0x6')](_0x2b9e8a,util[_0xa3b7('0x7')](_0x2a3f42,{'showHidden':![],'depth':null}));};}function create(_0xe14882){return cmHopperHistory[_0xa3b7('0x8')](_0xe14882)[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0xa')));}function createAgent(_0x50143d){return BPromise[_0xa3b7('0xb')]()['then'](agentReportPreview['createHistory'](_0x50143d))[_0xa3b7('0x9')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x126f94){return cmHopper['moveContactManagedDialer'](_0x126f94,!![])[_0xa3b7('0x9')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xa3b7('0xc')]=function(_0x32480e){return cmHopperBlack[_0xa3b7('0xc')](_0x32480e)[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0xd')));};exports[_0xa3b7('0xe')]=function(_0x22745f){return BPromise['resolve']()[_0xa3b7('0xf')](cmHopper[_0xa3b7('0xe')](_0x22745f))[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0x10')));};exports[_0xa3b7('0x8')]=function(_0x2949f1,_0x483496){create(_0x2949f1)[_0xa3b7('0x9')](loggerCatch(_0x483496));moveContact(_0x2949f1)[_0xa3b7('0x9')](loggerCatch(_0x483496));};exports[_0xa3b7('0x11')]=function(_0x2a183c,_0x5095da){createAgent(_0x2a183c)[_0xa3b7('0x9')](loggerCatch(_0x5095da));};exports[_0xa3b7('0x12')]=function(_0x8983b,_0x87bc91){create(_0x8983b)[_0xa3b7('0x9')](loggerCatch(_0x87bc91));};exports['createCustomerFinal']=function(_0x288450,_0x13f165){moveContact(_0x288450)['catch'](loggerCatch(_0x13f165));};exports[_0xa3b7('0x13')]=function(_0x5d632c,_0x1bb86d,_0x49be42){if(_0x1bb86d){_0x5d632c[_0xa3b7('0x14')]=null;}if(_0x49be42){_0x5d632c[_0xa3b7('0x15')]=![];}return cmHopper[_0xa3b7('0x13')](_0x5d632c)[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0x16')));};exports[_0xa3b7('0x17')]=function(_0x35b980){return cmHopper[_0xa3b7('0x17')](_0x35b980)[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0x18')));};exports[_0xa3b7('0x19')]=function(_0x5ef4c3){return cmHopper['unlockContact']({'UserId':null},_0x5ef4c3,0x1)['catch'](loggerCatch(_0xa3b7('0x1a')));};exports['disableContact']=function(_0x6a1a06){return cmHopper[_0xa3b7('0x19')]({'active':![]},_0x6a1a06,0x1)[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0x1b')));};exports[_0xa3b7('0x1c')]=function(_0x43554c){var _0x414a4e={};_0x414a4e[_0xa3b7('0x1d')]=_0x43554c[_0xa3b7('0x1d')];_0x414a4e[_0xa3b7('0x1e')]=_0x43554c['uniqueid'];_0x414a4e['calleridnum']=_0x43554c[_0xa3b7('0x1f')];_0x414a4e[_0xa3b7('0x20')]=_0x43554c['calleridname'];_0x414a4e[_0xa3b7('0x21')]=_0x43554c[_0xa3b7('0x21')];_0x414a4e[_0xa3b7('0x22')]=_0x43554c[_0xa3b7('0x23')];_0x414a4e['queuecallerleaveAt']=_0x43554c[_0xa3b7('0x23')];_0x414a4e[_0xa3b7('0x24')]=0x1;_0x414a4e[_0xa3b7('0x25')]=_0x43554c[_0xa3b7('0x26')];_0x414a4e[_0xa3b7('0x27')]=_0x43554c[_0xa3b7('0x28')];_0x414a4e[_0xa3b7('0x29')]=_0xa3b7('0x2a');_0x414a4e[_0xa3b7('0x2b')]=_0xa3b7('0x2c');_0x414a4e[_0xa3b7('0x2d')]=0x0;_0x414a4e[_0xa3b7('0x2e')]=0x1;_0x414a4e[_0xa3b7('0x2f')]=_0x43554c[_0xa3b7('0x28')];_0x414a4e[_0xa3b7('0x30')]=_0xa3b7('0x31');return BPromise[_0xa3b7('0xb')]()[_0xa3b7('0xf')](voiceQueueReport['create'](_0x414a4e))[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0x32')));};exports[_0xa3b7('0x33')]=function(_0x2b6ba8,_0x37b90f){return BPromise[_0xa3b7('0xb')]()[_0xa3b7('0xf')](cmHopper[_0xa3b7('0x33')](_0x2b6ba8,_0x37b90f))[_0xa3b7('0x9')](loggerCatch(_0xa3b7('0x34')));};exports[_0xa3b7('0x35')]=function(_0x118746){return cmHopper['rescheduleContact'](_0x118746,!![],!![])[_0xa3b7('0x9')](loggerCatch(_0xa3b7('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 a15cec3..c3f0caa 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 _0x7969=['\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','scheduledAt','active','add','ListId','VoiceQueueId','decrementTalking','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','interface','channelAgent','motionChannel','mandatoryDisposition','not_inuse','status','reachable','push','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','calleridnum','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','preview','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','info','inspect','loggerError','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x7969,0x7c));var _0x9796=function(_0x4491c0,_0x276edc){_0x4491c0=_0x4491c0-0x0;var _0x3f164b=_0x7969[_0x4491c0];return _0x3f164b;};'use strict';var util=require(_0x9796('0x0'));var _=require(_0x9796('0x1'));var moment=require(_0x9796('0x2'));var logger=require('../../../../config/logger')(_0x9796('0x3'));var ipAgi=process[_0x9796('0x4')][_0x9796('0x5')]||'127.0.0.1';var utils=require(_0x9796('0x6'));exports[_0x9796('0x7')]=function(_0x3a2068){return function(_0x3c17bd){logger[_0x9796('0x8')](_0x3a2068,util['inspect'](_0x3c17bd,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2099db,_0x46b053){logger[_0x9796('0x9')](_0x2099db,util[_0x9796('0xa')](_0x46b053,{'showHidden':![],'depth':null}));};exports[_0x9796('0xb')]=function(_0x361fc6,_0x113334){logger['error'](_0x361fc6,util[_0x9796('0xa')](_0x113334,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x78c5e3){return function(_0x5062b4){logger['info'](_0x78c5e3,util[_0x9796('0xa')](_0x5062b4,{'showHidden':![],'depth':null}));};};exports[_0x9796('0xc')]=function(_0x5e114a,_0x28f10c,_0x157279){return{'message':_0x5e114a,'unlock':_0x28f10c,'active':_0x157279};};exports[_0x9796('0xd')]=function(_0x33433f,_0x7f6db6,_0x4f13a7){if(!_[_0x9796('0xe')](_0x4f13a7)&&_0x9796('0xf')===typeof _0x4f13a7&&!_[_0x9796('0x10')](_0x4f13a7)){if(!_[_0x9796('0xe')](_0x7f6db6)&&_0x9796('0xf')===typeof _0x7f6db6&&!_[_0x9796('0x10')](_0x7f6db6)){return util['format'](_0x9796('0x11'),_0x7f6db6,_0x4f13a7);}return util[_0x9796('0x12')](_0x9796('0x11'),_0x4f13a7,_0x4f13a7);}if(!_[_0x9796('0xe')](_0x33433f)&&_0x9796('0xf')===typeof _0x33433f&&!_['isEmpty'](_0x33433f)){return _0x33433f;}return _0x9796('0x13');};exports[_0x9796('0x14')]=function(_0x22159a){if(_[_0x9796('0x15')](_0x22159a)){return![];}return _0x22159a;};exports[_0x9796('0x16')]=function(_0xf41a65,_0xa4fdea,_0x59e73b,_0x59d8a1,_0x39dd2b,_0x28d58f){var _0x537e83={'XMD-QUEUE':_0xa4fdea[_0x9796('0x17')]?_0xa4fdea['Queue']['name']:'','XMD-CALLERID':_0x59d8a1,'XMD-CALLERID-PREVIEW':_0x28d58f?util[_0x9796('0x12')](_0x9796('0x11'),_0x28d58f[_0x9796('0x18')],_0x28d58f['calleridnum']):_0x59d8a1,'XMD-DIALID':_0x39dd2b,'XMD-CONTACTID':_0xa4fdea[_0x9796('0x19')],'XMD-CDRTYPE':_0x9796('0x1a'),'CALLERID(all)':_0x59d8a1,'XMD-VOICEQUEUEID':_0xa4fdea['VoiceQueueId'],'XMD-DIALCHANNEL':_0x59e73b,'XMD-DIALTIMEOUT':_0xf41a65[_0x9796('0x1b')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x9796('0x1c'),_0xf41a65[_0x9796('0x1d')]?'g':'',_[_0x9796('0x10')](_0xf41a65[_0x9796('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xf41a65[_0x9796('0x1f')]||'','XMD-AGI':_0xf41a65['dialQueueProject']?util[_0x9796('0x12')](_0x9796('0x20'),ipAgi,_0xf41a65[_0x9796('0x21')]):_0x9796('0x22'),'XMD-AGIAFTER':_0xf41a65[_0x9796('0x1d')]?util[_0x9796('0x12')](_0x9796('0x20'),ipAgi,_0xf41a65[_0x9796('0x1d')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x28d58f?_0x28d58f[_0x9796('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x28d58f?_0x28d58f[_0x9796('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x9796('0x25')};if(!_['isEmpty'](_0xf41a65['monitor_format'])){_0x537e83[util[_0x9796('0x12')]('%s',_0x9796('0x26'))]=_0xf41a65[_0x9796('0x1e')];_0x537e83[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x39dd2b;}return _0x537e83;};exports[_0x9796('0x27')]=function(_0x5c2506){var _0x1560b5={};for(var _0x15730f in _0x5c2506){if(_0x5c2506[_0x9796('0x28')](_0x15730f)){_0x1560b5[util['format']('%s',_[_0x9796('0x29')](_0x15730f))]=_0x5c2506[_0x15730f];}}return{'variables':_0x1560b5};};exports[_0x9796('0x2a')]=function(_0x103a0e){var _0x4b4c05=moment()[_0x9796('0x12')](_0x9796('0x2b'));_0x103a0e[_0x9796('0x2c')]=0xd;_0x103a0e[_0x9796('0x2d')]=_0x9796('0x2e');_0x103a0e[_0x9796('0x2f')]=_0x4b4c05;_0x103a0e[_0x9796('0x30')]=_0x4b4c05;_0x103a0e[_0x9796('0x31')]=_0x4b4c05;};exports[_0x9796('0x32')]=function(_0x639c26,_0x187cda,_0x182444){var _0x205516=moment()[_0x9796('0x12')](_0x9796('0x2b'));_0x639c26[_0x9796('0x2c')]=_0x187cda;_0x639c26[_0x9796('0x2d')]=_0x182444;_0x639c26['responsetime']=_0x205516;_0x639c26[_0x9796('0x33')]=utils[_0x9796('0x34')](_0x639c26[_0x9796('0x30')],_0x639c26[_0x9796('0x2f')]);};exports[_0x9796('0x35')]=function(_0x4c599a,_0x11755a,_0x15addb){_0x4c599a[_0x9796('0x36')]=_0x11755a;_0x4c599a[_0x9796('0x37')]=_0x15addb;};exports[_0x9796('0x38')]=function(_0x3d7e7f,_0x471fd4,_0x42b23){var _0x332dd3=moment()[_0x9796('0x12')](_0x9796('0x2b'));_0x3d7e7f[_0x9796('0x2c')]=_0x471fd4;_0x3d7e7f[_0x9796('0x2d')]=_0x42b23;_0x3d7e7f[_0x9796('0x30')]=_0x3d7e7f[_0x9796('0x30')]?_0x3d7e7f[_0x9796('0x30')]:_0x332dd3;_0x3d7e7f[_0x9796('0x31')]=_0x3d7e7f['endtime']?_0x3d7e7f['endtime']:_0x332dd3;_0x3d7e7f['ringtime']=utils[_0x9796('0x34')](_0x3d7e7f[_0x9796('0x30')]||0x0,_0x3d7e7f[_0x9796('0x2f')]||0x0);_0x3d7e7f[_0x9796('0x39')]=_0x3d7e7f[_0x9796('0x3a')]?utils[_0x9796('0x34')](_0x3d7e7f[_0x9796('0x31')],_0x3d7e7f['answertime']):0x0;};exports[_0x9796('0x3b')]=function(_0x3fa112){return _0x3fa112===_0x9796('0x3c');};exports[_0x9796('0x3d')]=function(_0x1bf6bc,_0x59690f,_0x3f6977,_0x31c8be,_0x1e7140){var _0x33fc8e=_0x31c8be?_0x9796('0x3e'):_0x1bf6bc['calleridname'];_0x33fc8e=_0x1e7140?'BOOKED':_0x33fc8e;return{'actionid':_0x1bf6bc[_0x9796('0x3f')],'action':_0x9796('0x40'),'channel':_0x1bf6bc['channelAgent'],'callerid':util[_0x9796('0x12')](_0x9796('0x11'),_0x33fc8e,_0x1bf6bc['calleridnum']),'Exten':_0x9796('0x41'),'Context':_0x9796('0x42'),'Priority':'1','variable':_0x3f6977,'timeout':(_0x59690f[_0x9796('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1bf6bc['uniqueid']};};exports[_0x9796('0x44')]=function(_0x5f2726){return _0x5f2726[_0x9796('0x45')]+_0x5f2726['countcongestionretry']+_0x5f2726[_0x9796('0x46')]+_0x5f2726[_0x9796('0x47')]+_0x5f2726['countnosuchnumberretry'];};exports[_0x9796('0x48')]=function(_0x51bac6){var _0x5efa39=_[_0x9796('0x49')](_0x51bac6);_0x5efa39[_0x9796('0x2c')]=0xf;_0x5efa39[_0x9796('0x2d')]='Global';return _0x5efa39;};exports[_0x9796('0x4a')]=function(_0x9d379b,_0xdcdc98,_0x923657){var _0x385db8={};_0x385db8[_0xdcdc98]=_0x9d379b[_0xdcdc98];_0x385db8[_0x9796('0x4b')]=![];_0x385db8['scheduledat']=moment()[_0x9796('0x4c')](_0x923657,'minutes')[_0x9796('0x12')](_0x9796('0x2b'));_0x385db8['ContactId']=_0x9d379b[_0x9796('0x19')];_0x385db8[_0x9796('0x4d')]=_0x9d379b[_0x9796('0x4d')];_0x385db8[_0x9796('0x4e')]=_0x9d379b['VoiceQueueId']||undefined;return _0x385db8;};exports[_0x9796('0x4f')]=function(_0x137ce7,_0x206591){if(!_[_0x9796('0x15')](_0x137ce7)){if(_0x137ce7[_0x9796('0x50')]>0x0){_0x137ce7[_0x9796('0x50')]-=0x1;}else{logger[_0x9796('0x9')](_0x206591,_0x9796('0x51'));}}else{logger[_0x9796('0x8')](_0x206591,_0x9796('0x52'));}};exports[_0x9796('0x53')]=function(_0x37379d){if(_0x37379d<=0x0){return!![];}return![];};function buildObj(_0x2e2855,_0x146875,_0x4063b1){_0x2e2855[_0x9796('0x54')]=_0x146875;_0x2e2855[_0x9796('0x55')]=_0x2e2855[_0x9796('0x56')];_0x2e2855[_0x9796('0x57')]=_0x2e2855[_0x9796('0x58')];_0x2e2855[_0x9796('0x59')]='voice';if(_0x4063b1){_0x2e2855[_0x9796('0x5a')]=_0x4063b1[_0x9796('0x5a')];}return _0x2e2855;}exports['buildObj']=buildObj;exports['agentReadyId']=function(_0x17a074){var _0x4f089f=[];for(var _0x20112d in _0x17a074){if(_0x17a074[_0x9796('0x28')](_0x20112d)){if(!_[_0x9796('0x15')](_0x17a074[_0x20112d])&&_0x17a074[_0x20112d][_0x9796('0x2c')]===_0x9796('0x5b')&&_0x17a074[_0x20112d][_0x9796('0x5c')]===_0x9796('0x5d')){_0x4f089f[_0x9796('0x5e')](_0x17a074[_0x20112d]['id']);}}}return _0x4f089f;};exports['getDiff']=function(_0x259f48){var _0x4f94cf=moment()[_0x9796('0x5f')](0x0);var _0x59e5d4=moment(_0x259f48)[_0x9796('0x5f')](0x0);return _0x4f94cf[_0x9796('0x60')](_0x59e5d4,_0x9796('0x61'));};exports[_0x9796('0x62')]=function(_0x3ae7f3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ae7f3[_0x9796('0x19')],'ListId':_0x3ae7f3[_0x9796('0x4d')],'VoiceQueueId':_0x3ae7f3[_0x9796('0x4e')]||undefined,'CampaignId':_0x3ae7f3[_0x9796('0x63')]||undefined};};exports[_0x9796('0x64')]=function(_0x40fe01){if(_0x40fe01==='uniqueid'||_0x40fe01===_0x9796('0x65')||_0x40fe01===_0x9796('0x56')||_0x40fe01===_0x9796('0x66')||_0x40fe01===_0x9796('0x67')||_0x40fe01===_0x9796('0x68')||_0x40fe01==='membername'||_0x40fe01===_0x9796('0x58')||_0x40fe01===_0x9796('0x18')||_0x40fe01==='active'||_0x40fe01===_0x9796('0x69')||_0x40fe01==='scheduledat'||_0x40fe01==='countbusyretry'||_0x40fe01===_0x9796('0x6a')||_0x40fe01===_0x9796('0x46')||_0x40fe01===_0x9796('0x6b')||_0x40fe01===_0x9796('0x6c')||_0x40fe01===_0x9796('0x6d')||_0x40fe01===_0x9796('0x6e')||_0x40fe01==='recallme'||_0x40fe01===_0x9796('0x19')||_0x40fe01===_0x9796('0x4d')||_0x40fe01===_0x9796('0x37')||_0x40fe01===_0x9796('0x4e')||_0x40fe01===_0x9796('0x6f')||_0x40fe01===_0x9796('0x70')||_0x40fe01==='xmd-queue'||_0x40fe01==='xmd-phone'||_0x40fe01==='xmd-listid'||_0x40fe01===_0x9796('0x71')||_0x40fe01===_0x9796('0x72')||_0x40fe01===_0x9796('0x73')||_0x40fe01==='xmd-dialid'||_0x40fe01===_0x9796('0x74')||_0x40fe01===_0x9796('0x75')||_0x40fe01===_0x9796('0x76')||_0x40fe01===_0x9796('0x77')||_0x40fe01===_0x9796('0x78')||_0x40fe01===_0x9796('0x79')||_0x40fe01===_0x9796('0x7a')||_0x40fe01===_0x9796('0x7b')||_0x40fe01==='rtpaudioqosjitter'||_0x40fe01===_0x9796('0x7c')||_0x40fe01===_0x9796('0x7d')||_0x40fe01==='rtpaudioqoslossbridged'||_0x40fe01===_0x9796('0x7e')||_0x40fe01===_0x9796('0x7f')||_0x40fe01===_0x9796('0x7a')||_0x40fe01===_0x9796('0x7b')||_0x40fe01==='rtpaudioqosjitter'||_0x40fe01===_0x9796('0x7c')||_0x40fe01===_0x9796('0x7d')||_0x40fe01===_0x9796('0x80')||_0x40fe01==='rtpaudioqosrtt'||_0x40fe01===_0x9796('0x7f')||_0x40fe01===_0x9796('0x81')||_0x40fe01===_0x9796('0x82')||_0x40fe01===_0x9796('0x2c')||_0x40fe01===_0x9796('0x2d')){return![];}return!![];};exports[_0x9796('0x83')]=function(_0x414e03,_0x3575f1){var _0x34193b,_0x245b15,_0x25a2d6;if(_0x3575f1<=0x0){_0x3575f1=0x1;}_0x34193b=new RegExp(_0x9796('0x84')+_0x3575f1+'}$');_0x245b15=Math[_0x9796('0x85')](0xa,_0x3575f1-0x1);_0x25a2d6=Math[_0x9796('0x85')](0xa,_0x3575f1)-0x1;return util['format']('%s',_[_0x9796('0x86')](_0x414e03,_0x34193b,_['random'](_0x245b15,_0x25a2d6)));};exports[_0x9796('0x87')]=function(_0x3ce94c){var _0x1cad0a=_0x3ce94c[_0x9796('0x88')](/"(.*?)"/);return _0x1cad0a?_0x1cad0a[0x1]:_0x3ce94c;};exports['extractCalleridNumber']=function(_0x3833d1){var _0x516d77=_0x3833d1[_0x9796('0x88')](/<(.*?)>/);return _0x516d77?_0x516d77[0x1]:_0x3833d1;};function buildNoAnswerEventPayload(_0x3f8051,_0x400c3f){var _0x5e5018=buildObj(_0x3f8051,_0x9796('0x89'));if(!_[_0x9796('0x10')](_0x400c3f[_0x9796('0x8a')])){Object[_0x9796('0x8b')](_0x400c3f[_0x9796('0x8a')])[_0x9796('0x8c')](function(_0x5a4319){_0x5e5018[_0x5a4319[_0x9796('0x8d')]()]=_0x400c3f[_0x9796('0x8a')][_0x5a4319];});}return _0x5e5018;}exports[_0x9796('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x36e3=['\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','variablesAction','BOOKED','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalking','pTalking','IsNotLoggedIn','lastevent','name','queue','mandatoryDisposition','agentReadyId','state','status','reachable','push','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','dialAnswer','countbusyretry','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout'];(function(_0x375492,_0x4ed149){var _0x18ba5b=function(_0x154a12){while(--_0x154a12){_0x375492['push'](_0x375492['shift']());}};_0x18ba5b(++_0x4ed149);}(_0x36e3,0xf2));var _0x336e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x36e3[_0x37bd26];return _0xe83dc4;};'use strict';var util=require(_0x336e('0x0'));var _=require(_0x336e('0x1'));var moment=require(_0x336e('0x2'));var logger=require(_0x336e('0x3'))('preview');var ipAgi=process[_0x336e('0x4')][_0x336e('0x5')]||_0x336e('0x6');var utils=require('../../dialer/utils');exports[_0x336e('0x7')]=function(_0x4eeffe){return function(_0x46b2ea){logger[_0x336e('0x8')](_0x4eeffe,util[_0x336e('0x9')](_0x46b2ea,{'showHidden':![],'depth':null}));};};exports[_0x336e('0xa')]=function(_0x31dd86,_0x2bd6ba){logger[_0x336e('0xb')](_0x31dd86,util[_0x336e('0x9')](_0x2bd6ba,{'showHidden':![],'depth':null}));};exports[_0x336e('0xc')]=function(_0x26a153,_0x25ad06){logger[_0x336e('0x8')](_0x26a153,util[_0x336e('0x9')](_0x25ad06,{'showHidden':![],'depth':null}));};exports[_0x336e('0xd')]=function(_0x48ddf3){return function(_0x1ffdd6){logger[_0x336e('0xb')](_0x48ddf3,util[_0x336e('0x9')](_0x1ffdd6,{'showHidden':![],'depth':null}));};};exports[_0x336e('0xe')]=function(_0x3b9a48,_0x2547f5,_0x19dcf5){return{'message':_0x3b9a48,'unlock':_0x2547f5,'active':_0x19dcf5};};exports[_0x336e('0xf')]=function(_0x42f8ee,_0x51516a,_0x318007){if(!_[_0x336e('0x10')](_0x318007)&&_0x336e('0x11')===typeof _0x318007&&!_[_0x336e('0x12')](_0x318007)){if(!_[_0x336e('0x10')](_0x51516a)&&_0x336e('0x11')===typeof _0x51516a&&!_[_0x336e('0x12')](_0x51516a)){return util[_0x336e('0x13')]('\x22%s\x22\x20<%s>',_0x51516a,_0x318007);}return util[_0x336e('0x13')](_0x336e('0x14'),_0x318007,_0x318007);}if(!_[_0x336e('0x10')](_0x42f8ee)&&_0x336e('0x11')===typeof _0x42f8ee&&!_[_0x336e('0x12')](_0x42f8ee)){return _0x42f8ee;}return _0x336e('0x15');};exports[_0x336e('0x16')]=function(_0x3cc216){if(_[_0x336e('0x17')](_0x3cc216)){return![];}return _0x3cc216;};exports[_0x336e('0x18')]=function(_0x4dda06,_0x3ae5ed,_0x192234,_0x48b086,_0x6b5172,_0x2d056e){var _0x23ee3a={'XMD-QUEUE':_0x3ae5ed[_0x336e('0x19')]?_0x3ae5ed[_0x336e('0x19')]['name']:'','XMD-CALLERID':_0x48b086,'XMD-CALLERID-PREVIEW':_0x2d056e?util[_0x336e('0x13')](_0x336e('0x14'),_0x2d056e[_0x336e('0x1a')],_0x2d056e[_0x336e('0x1b')]):_0x48b086,'XMD-DIALID':_0x6b5172,'XMD-CONTACTID':_0x3ae5ed['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x48b086,'XMD-VOICEQUEUEID':_0x3ae5ed[_0x336e('0x1c')],'XMD-DIALCHANNEL':_0x192234,'XMD-DIALTIMEOUT':_0x4dda06[_0x336e('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x336e('0x13')](_0x336e('0x1e'),_0x4dda06[_0x336e('0x1f')]?'g':'',_['isEmpty'](_0x4dda06[_0x336e('0x20')])?'':_0x336e('0x21')),'XMD-DIALURL':_0x4dda06[_0x336e('0x22')]||'','XMD-AGI':_0x4dda06[_0x336e('0x23')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x4dda06['dialQueueProject']):_0x336e('0x24'),'XMD-AGIAFTER':_0x4dda06[_0x336e('0x1f')]?util['format'](_0x336e('0x25'),ipAgi,_0x4dda06[_0x336e('0x1f')]):_0x336e('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x2d056e?_0x2d056e['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2d056e?_0x2d056e[_0x336e('0x26')]:'','XMD-DESTINATION':_0x336e('0x27'),'SIPADDHEADER':_0x336e('0x28')};if(!_[_0x336e('0x12')](_0x4dda06[_0x336e('0x20')])){_0x23ee3a[util['format']('%s',_0x336e('0x29'))]=_0x4dda06[_0x336e('0x20')];_0x23ee3a[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x6b5172;}return _0x23ee3a;};exports[_0x336e('0x2a')]=function(_0x2910f3){var _0x2e86f3={};for(var _0x47d1f0 in _0x2910f3){if(_0x2910f3[_0x336e('0x2b')](_0x47d1f0)){_0x2e86f3[util['format']('%s',_[_0x336e('0x2c')](_0x47d1f0))]=_0x2910f3[_0x47d1f0];}}return{'variables':_0x2e86f3};};exports['logBlacklist']=function(_0x21a189){var _0x21e369=moment()[_0x336e('0x13')](_0x336e('0x2d'));_0x21a189['state']=0xd;_0x21a189[_0x336e('0x2e')]=_0x336e('0x2f');_0x21a189[_0x336e('0x30')]=_0x21e369;_0x21a189[_0x336e('0x31')]=_0x21e369;_0x21a189['endtime']=_0x21e369;};exports['logAgent']=function(_0x449209,_0x50fb,_0x3485be){var _0x469e53=moment()[_0x336e('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x449209['state']=_0x50fb;_0x449209['statedesc']=_0x3485be;_0x449209['responsetime']=_0x469e53;_0x449209[_0x336e('0x32')]=utils[_0x336e('0x33')](_0x449209[_0x336e('0x31')],_0x449209[_0x336e('0x30')]);};exports[_0x336e('0x34')]=function(_0x257976,_0x21e7c8,_0xaa59cb){_0x257976[_0x336e('0x35')]=_0x21e7c8;_0x257976[_0x336e('0x36')]=_0xaa59cb;};exports[_0x336e('0x37')]=function(_0x59a14d,_0x4f968c,_0x1d0d57){var _0x5422eb=moment()[_0x336e('0x13')](_0x336e('0x2d'));_0x59a14d['state']=_0x4f968c;_0x59a14d['statedesc']=_0x1d0d57;_0x59a14d['responsetime']=_0x59a14d[_0x336e('0x31')]?_0x59a14d['responsetime']:_0x5422eb;_0x59a14d[_0x336e('0x38')]=_0x59a14d[_0x336e('0x38')]?_0x59a14d[_0x336e('0x38')]:_0x5422eb;_0x59a14d[_0x336e('0x32')]=utils[_0x336e('0x33')](_0x59a14d['responsetime']||0x0,_0x59a14d[_0x336e('0x30')]||0x0);_0x59a14d[_0x336e('0x39')]=_0x59a14d[_0x336e('0x3a')]?utils[_0x336e('0x33')](_0x59a14d[_0x336e('0x38')],_0x59a14d[_0x336e('0x3a')]):0x0;};exports['isFailure']=function(_0x572389){return _0x572389==='Failure';};exports[_0x336e('0x3b')]=function(_0x216513,_0x368ed2,_0x158f58,_0x3ca87c,_0x5ca513){var _0xa49777=_0x3ca87c?'RECALL':_0x216513[_0x336e('0x1a')];_0xa49777=_0x5ca513?_0x336e('0x3c'):_0xa49777;return{'actionid':_0x216513[_0x336e('0x3d')],'action':'originate','channel':_0x216513[_0x336e('0x3e')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0xa49777,_0x216513[_0x336e('0x1b')]),'Exten':_0x336e('0x27'),'Context':_0x336e('0x3f'),'Priority':'1','variable':_0x158f58,'timeout':(_0x368ed2[_0x336e('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x216513[_0x336e('0x3d')]};};exports[_0x336e('0x41')]=function(_0x467cc1){return _0x467cc1['countbusyretry']+_0x467cc1[_0x336e('0x42')]+_0x467cc1[_0x336e('0x43')]+_0x467cc1[_0x336e('0x44')]+_0x467cc1['countnosuchnumberretry'];};exports[_0x336e('0x45')]=function(_0x41d435){var _0x3cff43=_['clone'](_0x41d435);_0x3cff43['state']=0xf;_0x3cff43['statedesc']=_0x336e('0x46');return _0x3cff43;};exports[_0x336e('0x47')]=function(_0x42e4fb,_0x52222e,_0x5c60bc){var _0x296522={};_0x296522[_0x52222e]=_0x42e4fb[_0x52222e];_0x296522[_0x336e('0x48')]=![];_0x296522[_0x336e('0x49')]=moment()[_0x336e('0x4a')](_0x5c60bc,_0x336e('0x4b'))[_0x336e('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x296522[_0x336e('0x4c')]=_0x42e4fb[_0x336e('0x4c')];_0x296522[_0x336e('0x4d')]=_0x42e4fb['ListId'];_0x296522['VoiceQueueId']=_0x42e4fb[_0x336e('0x1c')]||undefined;return _0x296522;};exports[_0x336e('0x4e')]=function(_0x2b5f0c,_0x5eea72){if(!_[_0x336e('0x17')](_0x2b5f0c)){if(_0x2b5f0c[_0x336e('0x4f')]>0x0){_0x2b5f0c['pTalking']-=0x1;}else{logger[_0x336e('0xb')](_0x5eea72,'[decrementTalking]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x5eea72,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports[_0x336e('0x50')]=function(_0x4bff0c){if(_0x4bff0c<=0x0){return!![];}return![];};function buildObj(_0x29fff5,_0x350f03,_0xf7a742){_0x29fff5[_0x336e('0x51')]=_0x350f03;_0x29fff5[_0x336e('0x52')]=_0x29fff5[_0x336e('0x53')];_0x29fff5['interface']=_0x29fff5[_0x336e('0x3e')];_0x29fff5['motionChannel']='voice';if(_0xf7a742){_0x29fff5['mandatoryDisposition']=_0xf7a742[_0x336e('0x54')];}return _0x29fff5;}exports['buildObj']=buildObj;exports[_0x336e('0x55')]=function(_0x124450){var _0x40502c=[];for(var _0x2219f7 in _0x124450){if(_0x124450['hasOwnProperty'](_0x2219f7)){if(!_[_0x336e('0x17')](_0x124450[_0x2219f7])&&_0x124450[_0x2219f7][_0x336e('0x56')]==='not_inuse'&&_0x124450[_0x2219f7][_0x336e('0x57')]===_0x336e('0x58')){_0x40502c[_0x336e('0x59')](_0x124450[_0x2219f7]['id']);}}}return _0x40502c;};exports['getDiff']=function(_0x257f28){var _0x50f9af=moment()['milliseconds'](0x0);var _0x3cf1bb=moment(_0x257f28)[_0x336e('0x5a')](0x0);return _0x50f9af[_0x336e('0x5b')](_0x3cf1bb,_0x336e('0x5c'));};exports[_0x336e('0x5d')]=function(_0x41f8d1){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x41f8d1[_0x336e('0x4c')],'ListId':_0x41f8d1['ListId'],'VoiceQueueId':_0x41f8d1['VoiceQueueId']||undefined,'CampaignId':_0x41f8d1[_0x336e('0x5e')]||undefined};};exports[_0x336e('0x5f')]=function(_0x462cc5){if(_0x462cc5===_0x336e('0x3d')||_0x462cc5===_0x336e('0x60')||_0x462cc5==='queue'||_0x462cc5===_0x336e('0x61')||_0x462cc5==='campaigntype'||_0x462cc5===_0x336e('0x62')||_0x462cc5===_0x336e('0x35')||_0x462cc5===_0x336e('0x3e')||_0x462cc5===_0x336e('0x1a')||_0x462cc5===_0x336e('0x48')||_0x462cc5===_0x336e('0x1b')||_0x462cc5==='scheduledat'||_0x462cc5===_0x336e('0x63')||_0x462cc5==='countcongestionretry'||_0x462cc5==='countnoanswerretry'||_0x462cc5===_0x336e('0x64')||_0x462cc5===_0x336e('0x65')||_0x462cc5==='callbackuniqueid'||_0x462cc5===_0x336e('0x66')||_0x462cc5===_0x336e('0x67')||_0x462cc5===_0x336e('0x4c')||_0x462cc5==='ListId'||_0x462cc5===_0x336e('0x36')||_0x462cc5===_0x336e('0x1c')||_0x462cc5===_0x336e('0x68')||_0x462cc5===_0x336e('0x69')||_0x462cc5===_0x336e('0x6a')||_0x462cc5===_0x336e('0x6b')||_0x462cc5==='xmd-listid'||_0x462cc5===_0x336e('0x6c')||_0x462cc5===_0x336e('0x6d')||_0x462cc5===_0x336e('0x6e')||_0x462cc5==='xmd-dialid'||_0x462cc5===_0x336e('0x6f')||_0x462cc5===_0x336e('0x70')||_0x462cc5===_0x336e('0x71')||_0x462cc5===_0x336e('0x72')||_0x462cc5==='xmd-agiafter'||_0x462cc5==='xmd-agi'||_0x462cc5==='rtpaudioqos'||_0x462cc5===_0x336e('0x73')||_0x462cc5==='rtpaudioqosjitter'||_0x462cc5===_0x336e('0x74')||_0x462cc5===_0x336e('0x75')||_0x462cc5===_0x336e('0x76')||_0x462cc5==='rtpaudioqosrtt'||_0x462cc5==='rtpaudioqosrttbridged'||_0x462cc5==='rtpaudioqos'||_0x462cc5==='rtpaudioqosbridged'||_0x462cc5==='rtpaudioqosjitter'||_0x462cc5===_0x336e('0x74')||_0x462cc5===_0x336e('0x75')||_0x462cc5===_0x336e('0x76')||_0x462cc5===_0x336e('0x77')||_0x462cc5===_0x336e('0x78')||_0x462cc5===_0x336e('0x79')||_0x462cc5===_0x336e('0x7a')||_0x462cc5==='state'||_0x462cc5==='statedesc'){return![];}return!![];};exports[_0x336e('0x7b')]=function(_0x2f2fe8,_0xe7aced){var _0x1502c1,_0x310532,_0x572cbf;if(_0xe7aced<=0x0){_0xe7aced=0x1;}_0x1502c1=new RegExp(_0x336e('0x7c')+_0xe7aced+'}$');_0x310532=Math['pow'](0xa,_0xe7aced-0x1);_0x572cbf=Math[_0x336e('0x7d')](0xa,_0xe7aced)-0x1;return util['format']('%s',_[_0x336e('0x7e')](_0x2f2fe8,_0x1502c1,_['random'](_0x310532,_0x572cbf)));};exports[_0x336e('0x7f')]=function(_0x45cfe6){var _0x3d74b5=_0x45cfe6[_0x336e('0x80')](/"(.*?)"/);return _0x3d74b5?_0x3d74b5[0x1]:_0x45cfe6;};exports[_0x336e('0x81')]=function(_0x5e6127){var _0x55ad56=_0x5e6127['match'](/<(.*?)>/);return _0x55ad56?_0x55ad56[0x1]:_0x5e6127;};function buildNoAnswerEventPayload(_0x1e4501,_0x50a7e7){var _0x17848a=buildObj(_0x1e4501,_0x336e('0x82'));if(!_[_0x336e('0x12')](_0x50a7e7['variables'])){Object[_0x336e('0x83')](_0x50a7e7[_0x336e('0x84')])[_0x336e('0x85')](function(_0x28a920){_0x17848a[_0x28a920[_0x336e('0x86')]()]=_0x50a7e7[_0x336e('0x84')][_0x28a920];});}return _0x17848a;}exports[_0x336e('0x87')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 816f22e..c6f1342 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 _0x0a11=['string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','queueadd'];(function(_0x1417ba,_0x52e154){var _0x4f2213=function(_0x3a0aa5){while(--_0x3a0aa5){_0x1417ba['push'](_0x1417ba['shift']());}};_0x4f2213(++_0x52e154);}(_0x0a11,0x10f));var _0x10a1=function(_0x8550ba,_0x57c10d){_0x8550ba=_0x8550ba-0x0;var _0x432399=_0x0a11[_0x8550ba];return _0x432399;};'use strict';exports[_0x10a1('0x0')]={'queue':{'type':_0x10a1('0x1'),'required':!![]},'interface':{'type':_0x10a1('0x1'),'required':!![]},'membername':{'type':_0x10a1('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x10a1('0x2'),'required':![]}};exports[_0x10a1('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x10a1('0x1'),'required':!![]}};exports[_0x10a1('0x4')]={'interface':{'type':_0x10a1('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x10a1('0x1'),'required':![]}};exports[_0x10a1('0x5')]={'module':{'type':_0x10a1('0x1'),'required':![]}};exports[_0x10a1('0x6')]={'uniqueid':{'type':_0x10a1('0x1'),'required':!![]}};exports[_0x10a1('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x10a1('0x1')},'format':{'type':_0x10a1('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x10a1('0x1'),'required':!![]},'exten':{'type':_0x10a1('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x1c59=['voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1c59,0x160));var _0x91c5=function(_0x48cbbd,_0x5268fb){_0x48cbbd=_0x48cbbd-0x0;var _0x552b46=_0x1c59[_0x48cbbd];return _0x552b46;};'use strict';exports[_0x91c5('0x0')]={'queue':{'type':_0x91c5('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x91c5('0x1'),'required':!![]},'penalty':{'type':_0x91c5('0x2'),'required':![]},'paused':{'type':_0x91c5('0x3'),'required':![]}};exports[_0x91c5('0x4')]={'queue':{'type':_0x91c5('0x1'),'required':!![]},'interface':{'type':_0x91c5('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x91c5('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x91c5('0x1'),'required':![]}};exports[_0x91c5('0x5')]={'uniqueid':{'type':_0x91c5('0x1'),'required':!![]}};exports[_0x91c5('0x6')]={'uniqueid':{'type':_0x91c5('0x1'),'required':!![]},'filename':{'type':_0x91c5('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x91c5('0x1')}};exports[_0x91c5('0x7')]={'uniqueid':{'type':_0x91c5('0x1'),'required':!![]}};exports[_0x91c5('0x8')]={'uniqueid':{'type':_0x91c5('0x1'),'required':!![]},'exten':{'type':_0x91c5('0x1'),'required':!![]},'context':{'type':_0x91c5('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 4670acb..d54264f 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x2da1ef,_0x4c0fbd){var _0x5900a4=function(_0x51212c){while(--_0x51212c){_0x2da1ef['push'](_0x2da1ef['shift']());}};_0x5900a4(++_0x4c0fbd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x37ec3f,_0x843273){_0x37ec3f=_0x37ec3f-0x0;var _0x2051ab=_0x5f2f[_0x37ec3f];return _0x2051ab;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file +var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5a148f,_0x114dfa){_0x5a148f=_0x5a148f-0x0;var _0x5af2d4=_0x0b0e[_0x5a148f];return _0x5af2d4;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 7e48451..c4b7132 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0802=['assign','mergeDBDataToRealtime'];(function(_0x4c2bdc,_0x5915d7){var _0x5a3222=function(_0x2262dd){while(--_0x2262dd){_0x4c2bdc['push'](_0x4c2bdc['shift']());}};_0x5a3222(++_0x5915d7);}(_0x0802,0xe0));var _0x2080=function(_0x2ff769,_0x34155a){_0x2ff769=_0x2ff769-0x0;var _0x1dfaa7=_0x0802[_0x2ff769];return _0x1dfaa7;};'use strict';function mergeDBDataToRealtime(_0x2a0693,_0xb38db1){var _0x4b6b19=Object[_0x2080('0x0')]({},_0x2a0693);for(var _0x2f1e7a in _0xb38db1){if(_0x4b6b19['hasOwnProperty'](_0x2f1e7a)){_0x4b6b19[_0x2f1e7a]=_0xb38db1[_0x2f1e7a];}}return _0x4b6b19;}exports[_0x2080('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xc646=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x2ce8ac,_0x4c8c7b){var _0x565333=function(_0x4b9086){while(--_0x4b9086){_0x2ce8ac['push'](_0x2ce8ac['shift']());}};_0x565333(++_0x4c8c7b);}(_0xc646,0x1d1));var _0x6c64=function(_0x314bb5,_0x476e6a){_0x314bb5=_0x314bb5-0x0;var _0x32c85e=_0xc646[_0x314bb5];return _0x32c85e;};'use strict';function mergeDBDataToRealtime(_0x28a535,_0x345847){var _0x3825fe=Object[_0x6c64('0x0')]({},_0x28a535);for(var _0x136b0c in _0x345847){if(_0x3825fe[_0x6c64('0x1')](_0x136b0c)){_0x3825fe[_0x136b0c]=_0x345847[_0x136b0c];}}return _0x3825fe;}exports[_0x6c64('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 8994e62..a1b036c 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 _0x014b=['UserId','membername','monitors','monitorFilename','filename','calleridname','voiceAgentReport','forEach','startsWith','Local','substring','indexOf','blindTransfer','transfers','transfererlinkedid','exports','lodash','moment','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','find','name','isNil','accountcode','interface','SIP/%s','length','findAgent','connectedlinenum','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','outbound','destination','exten','lastapplication','queue','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','calleridnum','disposition','ANSWERED','linkedid','transfereelinkedid','uniqueid','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x014b,0x65));var _0xb014=function(_0x339f54,_0x3ff67e){_0x339f54=_0x339f54-0x0;var _0x23bb0a=_0x014b[_0x339f54];return _0x23bb0a;};'use strict';var _=require(_0xb014('0x0'));var moment=require(_0xb014('0x1'));var util=require('util');var config=require(_0xb014('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xb014('0x3'));var RpcVoiceDialReport=require(_0xb014('0x4'));var RpcMemberReport=require(_0xb014('0x5'));var RpcVoiceQueueReport=require(_0xb014('0x6'));var RpcVoiceRecording=require(_0xb014('0x7'));var RpcVoiceTransferReport=require(_0xb014('0x8'));var VoiceQueueReport=require(_0xb014('0x9'));var VoiceCallReport=require(_0xb014('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xb014('0xb'));function Report(_0x4555f3){this['realtime']=_0x4555f3;this[_0xb014('0xc')]=_0x4555f3[_0xb014('0xc')];this[_0xb014('0xd')]=_0x4555f3[_0xb014('0xd')];}Report[_0xb014('0xe')][_0xb014('0xf')]=function(_0x122b5a){var _0x33e882=new VoiceQueueReport(this[_0xb014('0x10')]);var _0x3bd00e=new VoiceAgentReport(this['realtime']);var _0x42d63a=new VoiceDialReport(this[_0xb014('0x10')]);var _0x25966f=new VoiceCallReport(this[_0xb014('0x10')]);var _0x29140=new UserReport(this[_0xb014('0x10')]);if(config[_0xb014('0x11')]&&config[_0xb014('0x11')]['disabled']){ami['on'](_0xb014('0x12'),this[_0xb014('0x13')][_0xb014('0x14')](this));ami['on']('custom:voiceCallReport',this[_0xb014('0x15')][_0xb014('0x14')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport']['bind'](this));ami['on'](_0xb014('0x16'),this[_0xb014('0x17')][_0xb014('0x14')](this));ami['on'](_0xb014('0x18'),this['blindTransfer']['bind'](this));ami['on'](_0xb014('0x19'),this[_0xb014('0x1a')][_0xb014('0x14')](this));}};Report[_0xb014('0xe')]['findAgent']=function(_0x377a38){var _0x4e9e7d;_0x4e9e7d=_[_0xb014('0x1b')](this[_0xb014('0xc')],function(_0x442361){return _0x442361['accountcode']==_0x377a38||_0x442361[_0xb014('0x1c')]==_0x377a38;});if(_[_0xb014('0x1d')](_0x4e9e7d)){var _0x2c0596=_[_0xb014('0x1b')](this['telephones'],function(_0x115d20){return _0x115d20[_0xb014('0x1e')]==_0x377a38||_0x115d20[_0xb014('0x1c')]==_0x377a38;});if(_0x2c0596){_0x4e9e7d=_[_0xb014('0x1b')](this['agents'],function(_0x931361){return _0x931361[_0xb014('0x1f')]==util['format'](_0xb014('0x20'),_0x2c0596[_0xb014('0x1c')]);});}}return _0x4e9e7d;};Report[_0xb014('0xe')]['voiceQueueReport']=function(_0x36c63d){for(var _0x444c70=0x0;_0x444c70<_0x36c63d[_0xb014('0x21')];_0x444c70+=0x1){var _0x4c6cb2=this[_0xb014('0x22')](_0x36c63d[_0x444c70][_0xb014('0x23')]);if(_0x4c6cb2){_0x36c63d[_0x444c70][_0xb014('0x1e')]=_0x4c6cb2[_0xb014('0x1e')];_0x36c63d[_0x444c70][_0xb014('0x24')]=!![];_0x36c63d[_0x444c70][_0xb014('0x25')]=_0x4c6cb2[_0xb014('0x1c')];_0x36c63d[_0x444c70][_0xb014('0x1f')]=_[_0xb014('0x1d')](_0x4c6cb2[_0xb014('0x1f')])?util[_0xb014('0x26')](_0xb014('0x20'),_0x4c6cb2[_0xb014('0x1c')]):_0x4c6cb2[_0xb014('0x1f')];if(_0x36c63d[_0x444c70][_0xb014('0x27')]){_0x36c63d[_0x444c70][_0xb014('0x28')]=moment()[_0xb014('0x26')](_0xb014('0x29'));}if(_0x36c63d[_0x444c70]['queuecallerexit']){_0x36c63d[_0x444c70][_0xb014('0x2a')]=moment()[_0xb014('0x26')](_0xb014('0x29'));}RpcMemberReport[_0xb014('0x13')](_0x36c63d[_0x444c70]);}RpcVoiceQueueReport[_0xb014('0x2b')](_0x36c63d[_0x444c70]);}};function extractCalleridNumber(_0x56cd18){var _0xabe623=_0x56cd18[_0xb014('0x2c')](/<(.*?)>/);return _0xabe623?_0xabe623[0x1]:_0x56cd18;}Report[_0xb014('0xe')][_0xb014('0x2d')]=function(_0x2cafe1){for(var _0x2d4ee9=0x0;_0x2d4ee9',_0x39a99b['calleridname'],_0x39a99b[_0xb014('0x3e')]);}if(RpcVoiceTransferReport['transfers'][_0x39a99b['linkedid']]){var _0x2b7ec4=RpcVoiceTransferReport['transfers'][_0x39a99b[_0xb014('0x41')]];_0x2b7ec4[_0xb014('0x42')]=_0x39a99b[_0xb014('0x43')];RpcVoiceTransferReport['blindTransfer'](_0x2b7ec4);delete RpcVoiceTransferReport['transfers'][_0x39a99b['linkedid']];}if(_['isNil'](_0x39a99b['type'])){_0x39a99b[_0xb014('0x44')]=this[_0xb014('0x2f')](_0x39a99b);}if(_[_0xb014('0x1d')](_0x39a99b[_0xb014('0x45')])){var _0x27b9c1=_0x39a99b[_0xb014('0x30')][_0xb014('0x31')]('-')[0x0];var _0x4943e7=this[_0xb014('0xc')][_0x27b9c1];if(!_0x4943e7)_0x4943e7=this[_0xb014('0x2d')](_0x39a99b[_0xb014('0x1e')]);if(_0x4943e7){_0x39a99b['UserId']=_0x4943e7['id'];_0x39a99b[_0xb014('0x46')]=_0x4943e7['name'];}}RpcVoiceCallReport['create'](_0x39a99b);if(_0x39a99b['monitor']){for(var _0xc47d6a=0x0;_0xc47d6a<_0x39a99b[_0xb014('0x47')]['length'];_0xc47d6a+=0x1){_0x39a99b[_0xb014('0x48')]=_0x39a99b[_0xb014('0x47')][_0xc47d6a][_0xb014('0x49')];_0x39a99b['createdAt']=_0x39a99b['monitors'][_0xc47d6a]['createdAt'];if(_0x39a99b[_0xb014('0x34')]==_0xb014('0x3a')){_0x39a99b[_0xb014('0x3e')]=_0x39a99b['connectedlinenum'];_0x39a99b[_0xb014('0x4a')]=_0x39a99b['connectedlinename'];_0x39a99b[_0xb014('0x23')]=_0x39a99b['accountcode'];_0x39a99b['connectedlinename']=_0x39a99b[_0xb014('0x46')];_0x39a99b['exten']=_0x39a99b[_0xb014('0x3c')];}else if(_0x39a99b[_0xb014('0x34')]=='xcally-motion-dialer'){_0x39a99b[_0xb014('0x3e')]=_0x39a99b[_0xb014('0x33')];_0x39a99b[_0xb014('0x34')]=_0x39a99b[_0xb014('0x3c')];}RpcVoiceRecording[_0xb014('0x2b')](_0x39a99b);}}};Report['prototype'][_0xb014('0x4b')]=function(_0x4cc6dd){if(_['isArray'](_0x4cc6dd)){_0x4cc6dd[_0xb014('0x4c')](function(_0x16886c){RpcVoiceAgentReport[_0xb014('0x2b')](_0x16886c);});}else{RpcVoiceAgentReport[_0xb014('0x2b')](_0x4cc6dd);}};Report['prototype'][_0xb014('0x17')]=function(_0x101f2e){RpcVoiceDialReport[_0xb014('0x2b')](_0x101f2e);var _0x3a06e2;var _0x4f3302;var _0x53a49f=_0x101f2e['channel'];if(_[_0xb014('0x4d')](_0x53a49f,_0xb014('0x4e'))){_0x4f3302=_0x53a49f[_0xb014('0x4f')](_0x53a49f[_0xb014('0x50')]('/')+0x1,_0x53a49f['indexOf']('@'));_0x3a06e2=_[_0xb014('0x1b')](this['agents'],function(_0x267033){return _0x267033['mobile']==_0x4f3302||_0x267033['phone']==_0x4f3302||_0x267033[_0xb014('0x1e')]==_0x4f3302;});}else{_0x4f3302=_0x53a49f[_0xb014('0x4f')](_0x53a49f[_0xb014('0x50')]('/')+0x1,_0x53a49f['lastIndexOf']('-'));_0x3a06e2=this[_0xb014('0x22')](_0x4f3302);}if(_0x3a06e2){_0x101f2e[_0xb014('0x1f')]=_[_0xb014('0x1d')](_0x3a06e2[_0xb014('0x1f')])?util[_0xb014('0x26')](_0xb014('0x20'),_0x3a06e2[_0xb014('0x1c')]):_0x3a06e2[_0xb014('0x1f')];_0x101f2e[_0xb014('0x46')]=_0x3a06e2[_0xb014('0x1c')];_0x101f2e[_0xb014('0x1e')]=_0x3a06e2[_0xb014('0x1e')];RpcMemberReport[_0xb014('0x17')](_0x101f2e);}};Report[_0xb014('0xe')][_0xb014('0x51')]=function(_0x1880da){RpcVoiceTransferReport[_0xb014('0x52')][_0x1880da[_0xb014('0x53')]]=_0x1880da;};Report['prototype'][_0xb014('0x1a')]=function(_0x3e5a27){RpcVoiceTransferReport[_0xb014('0x1a')](_0x3e5a27);};module[_0xb014('0x54')]=Report; \ No newline at end of file +var _0x3024=['voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','interface','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','keys','getCallType','channel','split','getAgentByInternal','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','realtime','agents','telephones','prototype','sync','xdr','disabled'];(function(_0xd0362f,_0x5e2b91){var _0x441f12=function(_0x548b49){while(--_0x548b49){_0xd0362f['push'](_0xd0362f['shift']());}};_0x441f12(++_0x5e2b91);}(_0x3024,0xab));var _0x4302=function(_0x13a832,_0x514084){_0x13a832=_0x13a832-0x0;var _0x18143e=_0x3024[_0x13a832];return _0x18143e;};'use strict';var _=require('lodash');var moment=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var config=require(_0x4302('0x2'));var ami=require(_0x4302('0x3'));var RpcVoiceAgentReport=require(_0x4302('0x4'));var RpcVoiceCallReport=require(_0x4302('0x5'));var RpcVoiceDialReport=require(_0x4302('0x6'));var RpcMemberReport=require(_0x4302('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x4302('0x8'));var VoiceQueueReport=require(_0x4302('0x9'));var VoiceCallReport=require(_0x4302('0xa'));var VoiceAgentReport=require(_0x4302('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x2e8895){this[_0x4302('0xc')]=_0x2e8895;this[_0x4302('0xd')]=_0x2e8895['agents'];this[_0x4302('0xe')]=_0x2e8895[_0x4302('0xe')];}Report[_0x4302('0xf')][_0x4302('0x10')]=function(_0x4db34a){var _0xcb42da=new VoiceQueueReport(this[_0x4302('0xc')]);var _0x1df8dd=new VoiceAgentReport(this[_0x4302('0xc')]);var _0x511424=new VoiceDialReport(this['realtime']);var _0x57fb78=new VoiceCallReport(this[_0x4302('0xc')]);var _0x28cc8d=new UserReport(this[_0x4302('0xc')]);if(config[_0x4302('0x11')]&&config['xdr'][_0x4302('0x12')]){ami['on']('custom:voiceQueueReport',this[_0x4302('0x13')]['bind'](this));ami['on'](_0x4302('0x14'),this[_0x4302('0x15')][_0x4302('0x16')](this));ami['on'](_0x4302('0x17'),this['voiceAgentReport']['bind'](this));ami['on']('custom:voiceDialReport',this[_0x4302('0x18')][_0x4302('0x16')](this));ami['on'](_0x4302('0x19'),this[_0x4302('0x1a')][_0x4302('0x16')](this));ami['on'](_0x4302('0x1b'),this[_0x4302('0x1c')][_0x4302('0x16')](this));}};Report[_0x4302('0xf')][_0x4302('0x1d')]=function(_0x4ac965){var _0x386c59;_0x386c59=_[_0x4302('0x1e')](this[_0x4302('0xd')],function(_0x53bc1b){return _0x53bc1b[_0x4302('0x1f')]==_0x4ac965||_0x53bc1b[_0x4302('0x20')]==_0x4ac965;});if(_[_0x4302('0x21')](_0x386c59)){var _0x1a3d51=_[_0x4302('0x1e')](this[_0x4302('0xe')],function(_0x4165d8){return _0x4165d8[_0x4302('0x1f')]==_0x4ac965||_0x4165d8[_0x4302('0x20')]==_0x4ac965;});if(_0x1a3d51){_0x386c59=_['find'](this[_0x4302('0xd')],function(_0x427ff1){return _0x427ff1['interface']==util[_0x4302('0x22')](_0x4302('0x23'),_0x1a3d51[_0x4302('0x20')]);});}}return _0x386c59;};Report['prototype'][_0x4302('0x13')]=function(_0x16125d){for(var _0x30ff04=0x0;_0x30ff04<_0x16125d[_0x4302('0x24')];_0x30ff04+=0x1){var _0x2c3dcd=this[_0x4302('0x1d')](_0x16125d[_0x30ff04][_0x4302('0x25')]);if(_0x2c3dcd){_0x16125d[_0x30ff04][_0x4302('0x1f')]=_0x2c3dcd[_0x4302('0x1f')];_0x16125d[_0x30ff04][_0x4302('0x26')]=!![];_0x16125d[_0x30ff04][_0x4302('0x27')]=_0x2c3dcd[_0x4302('0x20')];_0x16125d[_0x30ff04][_0x4302('0x28')]=_[_0x4302('0x21')](_0x2c3dcd[_0x4302('0x28')])?util[_0x4302('0x22')](_0x4302('0x23'),_0x2c3dcd[_0x4302('0x20')]):_0x2c3dcd[_0x4302('0x28')];if(_0x16125d[_0x30ff04][_0x4302('0x29')]){_0x16125d[_0x30ff04]['queuecallercompleteAt']=moment()[_0x4302('0x22')](_0x4302('0x2a'));}if(_0x16125d[_0x30ff04][_0x4302('0x2b')]){_0x16125d[_0x30ff04]['queuecallerexitAt']=moment()[_0x4302('0x22')](_0x4302('0x2a'));}RpcMemberReport[_0x4302('0x13')](_0x16125d[_0x30ff04]);}RpcVoiceQueueReport[_0x4302('0x2c')](_0x16125d[_0x30ff04]);}};function extractCalleridNumber(_0x5f05ca){var _0x5960a9=_0x5f05ca[_0x4302('0x2d')](/<(.*?)>/);return _0x5960a9?_0x5960a9[0x1]:_0x5f05ca;}Report[_0x4302('0xf')]['getAgentByInternal']=function(_0x3b90be){for(var _0x4fe1a1=0x0;_0x4fe1a1{delete this[_0xcd67('0xb')][_0x48893c];},_0x285464);}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x848f=['custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','custom:voiceAgentReport','values','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','agentconnectAt','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','interface','queue','format','mandatoryDisposition','type','inbound','voice','assign','omit','privilege','destuniqueid','debug','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','lastevent','connect','merge','pick','destconnectedlinenum','name','accountcode','exten'];(function(_0x3a0c13,_0x561d63){var _0x509811=function(_0x24c9a4){while(--_0x24c9a4){_0x3a0c13['push'](_0x3a0c13['shift']());}};_0x509811(++_0x561d63);}(_0x848f,0xfa));var _0xf848=function(_0x4c809f,_0x45daf7){_0x4c809f=_0x4c809f-0x0;var _0x195d9b=_0x848f[_0x4c809f];return _0x195d9b;};'use strict';var _=require(_0xf848('0x0'));var moment=require(_0xf848('0x1'));var util=require(_0xf848('0x2'));var Redis=require(_0xf848('0x3'));var config=require(_0xf848('0x4'));var logger=require(_0xf848('0x5'))('ami');var ami=require(_0xf848('0x6'));config[_0xf848('0x7')]=_[_0xf848('0x8')](config[_0xf848('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf848('0x7')]));function VoiceAgentReport(_0x173314){this[_0xf848('0x9')]={};this[_0xf848('0xa')]=_0x173314[_0xf848('0x9')];this[_0xf848('0xb')]=_0x173314[_0xf848('0xb')];this[_0xf848('0xc')]=_0x173314[_0xf848('0xc')];this[_0xf848('0xd')]={};ami['on'](_0xf848('0xe'),this[_0xf848('0xf')][_0xf848('0x10')](this));ami['on'](_0xf848('0x11'),this['syncAgentConnect'][_0xf848('0x10')](this));ami['on'](_0xf848('0x12'),this[_0xf848('0x13')]['bind'](this));ami['on'](_0xf848('0x14'),this[_0xf848('0x15')][_0xf848('0x10')](this));ami['on'](_0xf848('0x16'),this[_0xf848('0x17')][_0xf848('0x10')](this));ami['on']('varset',this[_0xf848('0x18')]['bind'](this));ami['on'](_0xf848('0x19'),this[_0xf848('0x1a')][_0xf848('0x10')](this));ami['on']('musiconholdstart',this[_0xf848('0x1b')]['bind'](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xf848('0x10')](this));ami['on'](_0xf848('0x1c'),this['syncAttendedTransfer'][_0xf848('0x10')](this));ami['on'](_0xf848('0x1d'),this[_0xf848('0x1e')][_0xf848('0x10')](this));}VoiceAgentReport[_0xf848('0x1f')]['emit']=function(_0x3bdfca,_0x4c7666,_0x53013e){io['to'](_0x3bdfca)[_0xf848('0x20')](_0x4c7666,_0x53013e);};VoiceAgentReport[_0xf848('0x1f')][_0xf848('0x21')]=function(_0x346cf7){return _0x346cf7!==null&&!_[_0xf848('0x22')](_0x346cf7);};VoiceAgentReport[_0xf848('0x1f')][_0xf848('0xf')]=function(_0x2a7bfc){try{if(this['isNotNull'](_0x2a7bfc)){logger[_0xf848('0x23')](_0xf848('0x24'),_0x2a7bfc['uniqueid'],_0x2a7bfc[_0xf848('0x25')],_0x2a7bfc['destuniqueid']);logger['debug'](_0xf848('0x26'),_0x2a7bfc[_0xf848('0x27')],util[_0xf848('0x28')](_0x2a7bfc,{'showHidden':![],'depth':null}));if(_[_0xf848('0x22')](this[_0xf848('0x9')][_0x2a7bfc[_0xf848('0x27')]])){this['channels'][_0x2a7bfc['uniqueid']]={};}var _0x162ba7=this[_0xf848('0xc')][_0x2a7bfc[_0xf848('0x29')]];var _0x147638=this['channels'][_0x2a7bfc[_0xf848('0x27')]][_0x2a7bfc['destuniqueid']];var _0x8b6f6d=this[_0xf848('0xb')][_0x2a7bfc[_0xf848('0x2a')]];var _0x445192=this[_0xf848('0xd')][_0x2a7bfc[_0xf848('0x27')]];if(_['isUndefined'](_0x147638)){_0x147638={'agentcalledAt':moment()[_0xf848('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','mandatoryDisposition':_0x8b6f6d&&_0x8b6f6d[_0xf848('0x2c')]?_0x8b6f6d['mandatoryDisposition']:![],'type':_0x8b6f6d&&_0x8b6f6d[_0xf848('0x2d')]?_0x8b6f6d[_0xf848('0x2d')]:_0xf848('0x2e'),'variables':_0x445192,'motionChannel':_0xf848('0x2f')};}Object[_0xf848('0x30')](_0x147638,_[_0xf848('0x31')](_0x2a7bfc,['event',_0xf848('0x32')]));this['channels'][_0x2a7bfc[_0xf848('0x27')]][_0x2a7bfc[_0xf848('0x33')]]=_0x147638;logger[_0xf848('0x34')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x2a7bfc[_0xf848('0x27')],util['inspect'](_0x147638,{'showHidden':![],'depth':null}));ami[_0xf848('0x20')](_0xf848('0x35'),_0x147638);var _0x1233e2={'id':_0x162ba7['id'],'calleridnum':_0x147638[_0xf848('0x36')],'queue':_0x147638[_0xf848('0x2a')],'variables':_0x147638[_0xf848('0xd')],'uniqueid':_0x2a7bfc[_0xf848('0x27')]};logger[_0xf848('0x34')](_0xf848('0x37'),_0x2a7bfc['uniqueid'],util['inspect'](_0x1233e2,{'showHidden':![],'depth':null}));this[_0xf848('0x20')](util[_0xf848('0x2b')](_0xf848('0x38'),_0x2a7bfc[_0xf848('0x25')]),_0xf848('0x39'),_0x1233e2);}}catch(_0x39a967){logger[_0xf848('0x3a')](_0xf848('0x3b'),_0x2a7bfc['uniqueid'],util['inspect'](_0x39a967,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xf848('0x3c')]=function(_0x14b26a){try{if(this[_0xf848('0x21')](_0x14b26a)){if(this['channels'][_0x14b26a['uniqueid']]){for(var _0x23bcac in this['channels'][_0x14b26a['uniqueid']]){if(this[_0xf848('0x9')][_0x14b26a[_0xf848('0x27')]][_0xf848('0x3d')](_0x23bcac)){if(_0x14b26a[_0xf848('0x33')]===_0x23bcac){logger[_0xf848('0x23')](_0xf848('0x3e'),_0x14b26a[_0xf848('0x27')],_0x14b26a['membername'],_0x14b26a[_0xf848('0x33')]);this[_0xf848('0x9')][_0x14b26a[_0xf848('0x27')]][_0x23bcac]['agentconnectAt']=moment()[_0xf848('0x2b')](_0xf848('0x3f'));this[_0xf848('0x9')][_0x14b26a[_0xf848('0x27')]][_0x23bcac]['connectedlinename']=_0x14b26a[_0xf848('0x40')];this[_0xf848('0x9')][_0x14b26a[_0xf848('0x27')]][_0x23bcac][_0xf848('0x41')]=_0x14b26a['connectedlinenum'];this[_0xf848('0x9')][_0x14b26a[_0xf848('0x27')]][_0x23bcac][_0xf848('0x42')]=_0x14b26a[_0xf848('0x42')];this[_0xf848('0x9')][_0x14b26a['uniqueid']][_0x23bcac]['destchannelstatedesc']=_0x14b26a[_0xf848('0x43')];this['channels'][_0x14b26a[_0xf848('0x27')]][_0x23bcac]['holdtime']=_0x14b26a['holdtime'];this[_0xf848('0x9')][_0x14b26a['uniqueid']][_0x23bcac][_0xf848('0x44')]=_0xf848('0x45');_[_0xf848('0x46')](this[_0xf848('0xc')][_0x14b26a[_0xf848('0x29')]],_[_0xf848('0x47')](_0x14b26a,[_0xf848('0x2a'),_0xf848('0x48')]));var _0x4f48e1=this['agents'][_0x14b26a[_0xf848('0x29')]];var _0x5d04d3={'id':_0x4f48e1['id'],'name':_0x4f48e1[_0xf848('0x49')],'agentconnected':!![],'destaccountcode':_0x4f48e1[_0xf848('0x4a')],'destconnectedlinenum':this[_0xf848('0x9')][_0x14b26a[_0xf848('0x27')]][_0x14b26a['destuniqueid']][_0xf848('0x4b')],'queue':this['channels'][_0x14b26a[_0xf848('0x27')]][_0x14b26a[_0xf848('0x33')]][_0xf848('0x2a')],'uniqueid':this[_0xf848('0x9')][_0x14b26a['uniqueid']][_0x14b26a[_0xf848('0x33')]]['uniqueid']};ami[_0xf848('0x20')](_0xf848('0x4c'),this[_0xf848('0x9')][_0x14b26a[_0xf848('0x27')]][_0x14b26a[_0xf848('0x33')]]);this['emit'](util[_0xf848('0x2b')]('user:%s',_0x14b26a['membername']),_0xf848('0x4d'),_0x5d04d3);}else if(!this[_0xf848('0x9')][_0x14b26a[_0xf848('0x27')]][_0x23bcac]['agentringnoanswer']&&!this[_0xf848('0x9')][_0x14b26a['uniqueid']][_0x23bcac][_0xf848('0x16')]){logger['info'](_0xf848('0x4e'),_0x14b26a[_0xf848('0x27')],this[_0xf848('0x9')][_0x14b26a['uniqueid']][_0x23bcac][_0xf848('0x25')],_0x23bcac);this['channels'][_0x14b26a[_0xf848('0x27')]][_0x23bcac][_0xf848('0x12')]=!![];this[_0xf848('0x9')][_0x14b26a[_0xf848('0x27')]][_0x23bcac][_0xf848('0x4f')]=moment()[_0xf848('0x2b')](_0xf848('0x3f'));this[_0xf848('0x9')][_0x14b26a[_0xf848('0x27')]][_0x23bcac][_0xf848('0x50')]=_0x14b26a[_0xf848('0x33')];this[_0xf848('0x9')][_0x14b26a[_0xf848('0x27')]][_0x23bcac][_0xf848('0x51')]=_0x14b26a[_0xf848('0x25')];this['channels'][_0x14b26a[_0xf848('0x27')]][_0x23bcac][_0xf848('0x44')]='answered_elsewhere';this[_0xf848('0x9')][_0x14b26a[_0xf848('0x27')]][_0x23bcac][_0xf848('0x52')]='answered_elsewhere';logger['debug'](_0xf848('0x53'),_0x14b26a[_0xf848('0x27')],util[_0xf848('0x28')](this['channels'][_0x14b26a['uniqueid']][_0x23bcac],{'showHidden':![],'depth':null}));ami['emit'](_0xf848('0x54'),this[_0xf848('0x9')][_0x14b26a[_0xf848('0x27')]][_0x23bcac]);}else{logger[_0xf848('0x34')](_0xf848('0x55'),_0x14b26a[_0xf848('0x27')]);}}}}}}catch(_0x26c7ae){logger['error'](_0xf848('0x56'),_0x14b26a[_0xf848('0x27')],util[_0xf848('0x28')](_0x26c7ae,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf848('0x1f')][_0xf848('0x13')]=function(_0x21b8ea){try{if(this['isNotNull'](_0x21b8ea)){logger[_0xf848('0x34')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x21b8ea[_0xf848('0x27')],util[_0xf848('0x28')](_0x21b8ea,{'showHidden':![],'depth':null}));if(this[_0xf848('0x9')][_0x21b8ea[_0xf848('0x27')]]&&this[_0xf848('0x9')][_0x21b8ea[_0xf848('0x27')]][_0x21b8ea[_0xf848('0x33')]]){logger[_0xf848('0x23')](_0xf848('0x57'),_0x21b8ea[_0xf848('0x27')],_0x21b8ea[_0xf848('0x25')],_0x21b8ea[_0xf848('0x33')]);var _0x1cf701=this[_0xf848('0xc')][_0x21b8ea['interface']];var _0x394cd7=this[_0xf848('0x9')][_0x21b8ea[_0xf848('0x27')]][_0x21b8ea[_0xf848('0x33')]];_0x394cd7[_0xf848('0x12')]=!![];_0x394cd7['agentringnoanswerAt']=moment()['format'](_0xf848('0x3f'));_0x394cd7[_0xf848('0x44')]=_0xf848('0x58');_0x394cd7[_0xf848('0x52')]=_0xf848('0x58');var _0x378147={'id':_0x1cf701['id'],'name':_0x1cf701['name'],'queue':_0x394cd7[_0xf848('0x2a')],'uniqueid':_0x394cd7['uniqueid']};logger[_0xf848('0x34')](_0xf848('0x59'),_0x21b8ea[_0xf848('0x27')],util[_0xf848('0x28')](_0x378147,{'showHidden':![],'depth':null}));this[_0xf848('0x20')](util[_0xf848('0x2b')](_0xf848('0x38'),_0x1cf701[_0xf848('0x49')]),_0xf848('0x5a'),_0x378147);ami[_0xf848('0x20')]('custom:agentringnoanswer',_0x394cd7);this[_0xf848('0x9')][_0x21b8ea['uniqueid']][_0x21b8ea[_0xf848('0x33')]]=Object[_0xf848('0x30')]({},_0x394cd7);}}}catch(_0x1e61e1){logger[_0xf848('0x3a')](_0xf848('0x5b'),_0x21b8ea[_0xf848('0x27')],util[_0xf848('0x28')](_0x1e61e1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf848('0x1f')][_0xf848('0x15')]=function(_0x5706cd){try{if(this[_0xf848('0x21')](_0x5706cd)){logger[_0xf848('0x34')](_0xf848('0x5c'),_0x5706cd[_0xf848('0x27')],util['inspect'](_0x5706cd,{'showHidden':![],'depth':null}));if(this[_0xf848('0x9')][_0x5706cd['uniqueid']]){for(var _0x9e6d92 in this[_0xf848('0x9')][_0x5706cd[_0xf848('0x27')]]){if(this[_0xf848('0x9')][_0x5706cd[_0xf848('0x27')]][_0xf848('0x3d')](_0x9e6d92)&&!this[_0xf848('0x9')][_0x5706cd[_0xf848('0x27')]][_0x9e6d92]['agentringnoanswer']&&!this[_0xf848('0x9')][_0x5706cd['uniqueid']][_0x9e6d92][_0xf848('0x16')]){logger[_0xf848('0x23')](_0xf848('0x5d'),_0x5706cd[_0xf848('0x27')],this[_0xf848('0x9')][_0x5706cd['uniqueid']][_0x9e6d92][_0xf848('0x25')],_0x9e6d92);this[_0xf848('0x9')][_0x5706cd[_0xf848('0x27')]][_0x9e6d92][_0xf848('0x12')]=!![];this[_0xf848('0x9')][_0x5706cd[_0xf848('0x27')]][_0x9e6d92][_0xf848('0x4f')]=moment()['format'](_0xf848('0x3f'));this[_0xf848('0x9')][_0x5706cd[_0xf848('0x27')]][_0x9e6d92][_0xf848('0x44')]=_0xf848('0x5e');this['channels'][_0x5706cd[_0xf848('0x27')]][_0x9e6d92][_0xf848('0x52')]=_0xf848('0x5e');logger['debug']('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5706cd[_0xf848('0x27')],util[_0xf848('0x28')](this[_0xf848('0x9')][_0x5706cd[_0xf848('0x27')]][_0x9e6d92],{'showHidden':![],'depth':null}));ami[_0xf848('0x20')](_0xf848('0x5f'),this[_0xf848('0x9')][_0x5706cd[_0xf848('0x27')]][_0x9e6d92]);}}}}}catch(_0xa778e0){logger[_0xf848('0x3a')]('[%s][voiceAgentReport][queuecallerabandon]',_0x5706cd[_0xf848('0x27')],util[_0xf848('0x28')](_0xa778e0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xf848('0x17')]=function(_0x118808){try{if(this[_0xf848('0x21')](_0x118808)){logger[_0xf848('0x34')](_0xf848('0x60'),_0x118808[_0xf848('0x27')],util[_0xf848('0x28')](_0x118808,{'showHidden':![],'depth':null}));if(this[_0xf848('0x9')][_0x118808[_0xf848('0x27')]]){for(var _0x502071 in this['channels'][_0x118808['uniqueid']]){if(this[_0xf848('0x9')][_0x118808[_0xf848('0x27')]][_0xf848('0x3d')](_0x502071)){if(this[_0xf848('0x9')][_0x118808[_0xf848('0x27')]][_0x502071]['agentconnectAt']&&!this['channels'][_0x118808[_0xf848('0x27')]][_0x502071]['agentcomplete']){logger[_0xf848('0x23')](_0xf848('0x61'),_0x118808[_0xf848('0x27')],this['channels'][_0x118808[_0xf848('0x27')]][_0x502071][_0xf848('0x25')],_0x502071);this['channels'][_0x118808[_0xf848('0x27')]][_0x502071][_0xf848('0x16')]=!![];this[_0xf848('0x9')][_0x118808[_0xf848('0x27')]][_0x502071][_0xf848('0x62')]=moment()[_0xf848('0x2b')](_0xf848('0x3f'));this['channels'][_0x118808[_0xf848('0x27')]][_0x502071][_0xf848('0x44')]='complete';this[_0xf848('0x9')][_0x118808[_0xf848('0x27')]][_0x502071][_0xf848('0x52')]=_0x118808[_0xf848('0x52')]==_0xf848('0x63')?_0xf848('0x64'):_0x118808[_0xf848('0x52')];this[_0xf848('0x9')][_0x118808[_0xf848('0x27')]][_0x502071][_0xf848('0x65')]=_0x118808[_0xf848('0x65')];if(this['voiceQueues'][_0x118808[_0xf848('0x2a')]]&&this[_0xf848('0xb')][_0x118808['queue']][_0xf848('0x66')]){this[_0xf848('0x9')][_0x118808['uniqueid']][_0x502071][_0xf848('0x67')]=this[_0xf848('0xb')][_0x118808[_0xf848('0x2a')]][_0xf848('0x68')];this[_0xf848('0x9')][_0x118808[_0xf848('0x27')]][_0x502071][_0xf848('0x69')]=!![];}this[_0xf848('0xc')][_0x118808[_0xf848('0x29')]]=_[_0xf848('0x31')](this[_0xf848('0xc')][_0x118808[_0xf848('0x29')]],[_0xf848('0x2a'),'destconnectedlinenum']);logger['debug'](_0xf848('0x6a'),_0x118808[_0xf848('0x27')],util[_0xf848('0x28')](this[_0xf848('0x9')][_0x118808['uniqueid']][_0x502071],{'showHidden':![],'depth':null}));ami['emit'](_0xf848('0x6b'),this[_0xf848('0x9')][_0x118808[_0xf848('0x27')]][_0x502071]);logger[_0xf848('0x34')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x118808['uniqueid'],util['inspect']({'id':this[_0xf848('0xc')][_0x118808[_0xf848('0x29')]]['id'],'destaccountcode':_0x118808['destaccountcode']},{'showHidden':![],'depth':null}));this[_0xf848('0x20')](util[_0xf848('0x2b')](_0xf848('0x38'),_0x118808[_0xf848('0x25')]),_0xf848('0x6c'),{'id':this[_0xf848('0xc')][_0x118808['interface']]['id'],'destaccountcode':Number(_0x118808[_0xf848('0x6d')])});}}}}}}catch(_0x32abc5){logger[_0xf848('0x3a')](_0xf848('0x6e'),_0x118808['uniqueid'],util[_0xf848('0x28')](_0x32abc5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf848('0x1f')][_0xf848('0x18')]=function(_0x3e795d){try{if(this[_0xf848('0x21')](_0x3e795d)){logger[_0xf848('0x34')](_0xf848('0x6f'),_0x3e795d[_0xf848('0x27')],util['inspect'](_0x3e795d,{'showHidden':![],'depth':null}));this['addVariable'](_0x3e795d[_0xf848('0x27')],_[_0xf848('0x70')](_0x3e795d[_0xf848('0x71')])[0x0],_0x3e795d[_0xf848('0x72')]);if(this[_0xf848('0x9')][_0x3e795d[_0xf848('0x27')]]){for(var _0x1c1ef0 in this['channels'][_0x3e795d[_0xf848('0x27')]]){if(this[_0xf848('0x9')][_0x3e795d[_0xf848('0x27')]][_0xf848('0x3d')](_0x1c1ef0)){logger[_0xf848('0x23')](_0xf848('0x73'),_0x3e795d[_0xf848('0x27')],_0x1c1ef0,_['keys'](_0x3e795d[_0xf848('0x71')])[0x0],_0x3e795d[_0xf848('0x72')]);if(_[_0xf848('0x22')](this[_0xf848('0x9')][_0x3e795d[_0xf848('0x27')]][_0x1c1ef0][_0xf848('0xd')])){this[_0xf848('0x9')][_0x3e795d[_0xf848('0x27')]][_0x1c1ef0][_0xf848('0xd')]={};}this[_0xf848('0x9')][_0x3e795d[_0xf848('0x27')]][_0x1c1ef0]['variables']=this['variables'][_0x3e795d[_0xf848('0x27')]];}}}}}catch(_0x2336be){logger['error'](_0xf848('0x74'),_0x3e795d[_0xf848('0x27')],util[_0xf848('0x28')](_0x2336be,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf848('0x1f')][_0xf848('0x75')]=function(_0x288f7e,_0x2622c4,_0x309d21){var _0x34c42f=[_0xf848('0x76'),'rtpaudioqosbridged',_0xf848('0x77'),'rtpaudioqosjitterbridged',_0xf848('0x78'),_0xf848('0x79'),_0xf848('0x7a'),_0xf848('0x7b'),_0xf848('0x7c'),'sipuri',_0xf848('0x7d'),_0xf848('0x7e'),_0xf848('0x7f'),_0xf848('0x80'),_0xf848('0x81'),_0xf848('0x82'),_0xf848('0x25'),'memberpenalty',_0xf848('0x83')];if(!_[_0xf848('0x84')](_0x2622c4)&&!_[_0xf848('0x85')](_0x34c42f,_0x2622c4)){if(_['isUndefined'](this[_0xf848('0xd')][_0x288f7e])){this[_0xf848('0xd')][_0x288f7e]={};}this[_0xf848('0xd')][_0x288f7e][_0x2622c4]=_0x309d21;}};VoiceAgentReport['prototype'][_0xf848('0x1a')]=function(_0x2478d8){try{if(this[_0xf848('0x21')](_0x2478d8)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x2478d8[_0xf848('0x27')],util['inspect'](_0x2478d8,{'showHidden':![],'depth':null}));if(this[_0xf848('0x9')][_0x2478d8['uniqueid']]){for(var _0x1987e7 in this['channels'][_0x2478d8[_0xf848('0x27')]]){if(this[_0xf848('0x9')][_0x2478d8[_0xf848('0x27')]][_0xf848('0x3d')](_0x1987e7)){if(this[_0xf848('0x9')][_0x2478d8[_0xf848('0x27')]][_0x1987e7][_0xf848('0x52')]==_0xf848('0x63')&&this['channels'][_0x2478d8[_0xf848('0x27')]][_0x1987e7][_0xf848('0x16')]){logger[_0xf848('0x23')](_0xf848('0x86'),_0x2478d8[_0xf848('0x27')],_0x1987e7);this[_0xf848('0x9')][_0x2478d8[_0xf848('0x27')]][_0x1987e7][_0xf848('0x62')]=moment()[_0xf848('0x2b')](_0xf848('0x3f'));}}}logger[_0xf848('0x34')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x2478d8[_0xf848('0x27')],util['inspect'](_['values'](this['channels'][_0x2478d8['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xf848('0x20')](_0xf848('0x87'),_[_0xf848('0x88')](this[_0xf848('0x9')][_0x2478d8[_0xf848('0x27')]]));this[_0xf848('0x89')](_0x2478d8[_0xf848('0x27')]);}if(this[_0xf848('0xd')][_0x2478d8[_0xf848('0x27')]]){delete this[_0xf848('0xd')][_0x2478d8[_0xf848('0x27')]];}}}catch(_0x498c6b){logger[_0xf848('0x3a')](_0xf848('0x8a'),_0x2478d8[_0xf848('0x27')],util[_0xf848('0x28')](_0x498c6b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xf848('0x8b')]=function(_0x3c1e19){try{if(this['isNotNull'](_0x3c1e19)){logger[_0xf848('0x34')](_0xf848('0x8c'),_0x3c1e19[_0xf848('0x27')],util['inspect'](_0x3c1e19,{'showHidden':![],'depth':null}));if(this[_0xf848('0x9')][_0x3c1e19[_0xf848('0x8d')]]){for(var _0x5626c9 in this[_0xf848('0x9')][_0x3c1e19[_0xf848('0x8d')]]){if(this[_0xf848('0x9')][_0x3c1e19[_0xf848('0x8d')]][_0xf848('0x3d')](_0x5626c9)){if(_0x3c1e19[_0xf848('0x8e')]===_0x5626c9){logger['info'](_0xf848('0x8f'),_0x3c1e19[_0xf848('0x27')],this[_0xf848('0x9')][_0x3c1e19['transfereeuniqueid']][_0x5626c9][_0xf848('0x25')],_0x5626c9);var _0x59f5ed=moment();this[_0xf848('0x9')][_0x3c1e19[_0xf848('0x8d')]][_0x5626c9][_0xf848('0x16')]=!![];this[_0xf848('0x9')][_0x3c1e19['transfereeuniqueid']][_0x5626c9][_0xf848('0x62')]=moment()[_0xf848('0x2b')](_0xf848('0x3f'));this['channels'][_0x3c1e19[_0xf848('0x8d')]][_0x5626c9][_0xf848('0x44')]=_0xf848('0x90');this[_0xf848('0x9')][_0x3c1e19[_0xf848('0x8d')]][_0x5626c9]['reason']='transfer';this[_0xf848('0x9')][_0x3c1e19[_0xf848('0x8d')]][_0x5626c9][_0xf848('0x65')]=_0x59f5ed['diff'](this[_0xf848('0x9')][_0x3c1e19['transfereeuniqueid']][_0x5626c9][_0xf848('0x91')],'seconds');}}}}if(this[_0xf848('0x9')][_0x3c1e19[_0xf848('0x92')]]){var _0x21c406=this[_0xf848('0x9')][_0x3c1e19[_0xf848('0x92')]];this[_0xf848('0x9')][_0x3c1e19[_0xf848('0x92')]]=this['channels'][_0x3c1e19['transfereeuniqueid']];this[_0xf848('0x9')][_0x3c1e19[_0xf848('0x8d')]]=_0x21c406;}}}catch(_0xa807cc){logger[_0xf848('0x3a')](_0xf848('0x93'),_0x3c1e19[_0xf848('0x27')],util['inspect'](_0xa807cc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf848('0x1f')][_0xf848('0x1e')]=function(_0x1383a8){try{if(this[_0xf848('0x21')](_0x1383a8)){logger['debug'](_0xf848('0x94'),_0x1383a8[_0xf848('0x27')],util[_0xf848('0x28')](_0x1383a8,{'showHidden':![],'depth':null}));if(this['channels'][_0x1383a8[_0xf848('0x8d')]]){for(var _0x712bc6 in this[_0xf848('0x9')][_0x1383a8[_0xf848('0x8d')]]){if(this[_0xf848('0x9')][_0x1383a8[_0xf848('0x8d')]][_0xf848('0x3d')](_0x712bc6)){if(_0x1383a8[_0xf848('0x95')]===_0x712bc6){logger[_0xf848('0x23')](_0xf848('0x96'),_0x1383a8[_0xf848('0x27')],this[_0xf848('0x9')][_0x1383a8[_0xf848('0x8d')]][_0x712bc6]['membername'],_0x712bc6);var _0xa6cd2a=moment();this[_0xf848('0x9')][_0x1383a8[_0xf848('0x8d')]][_0x712bc6][_0xf848('0x16')]=!![];this[_0xf848('0x9')][_0x1383a8[_0xf848('0x8d')]][_0x712bc6][_0xf848('0x62')]=_0xa6cd2a;this[_0xf848('0x9')][_0x1383a8['transfereeuniqueid']][_0x712bc6]['lastevent']=_0xf848('0x90');this[_0xf848('0x9')][_0x1383a8['transfereeuniqueid']][_0x712bc6]['reason']=_0xf848('0x63');this[_0xf848('0x9')][_0x1383a8[_0xf848('0x8d')]][_0x712bc6][_0xf848('0x65')]=_0xa6cd2a['diff'](this['channels'][_0x1383a8[_0xf848('0x8d')]][_0x712bc6]['agentconnectAt'],_0xf848('0x97'));}}}}}}catch(_0x15736c){logger[_0xf848('0x3a')]('[%s][voiceAgentReport][blindtransfer]',_0x1383a8['uniqueid'],util[_0xf848('0x28')](_0x15736c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf848('0x1f')][_0xf848('0x1b')]=function(_0x7cee1f){var _0x108566='';try{if(this[_0xf848('0x21')](_0x7cee1f)){logger[_0xf848('0x34')](_0xf848('0x98'),_0x7cee1f[_0xf848('0x27')],util[_0xf848('0x28')](_0x7cee1f,{'showHidden':![],'depth':null}));if(_0x7cee1f[_0xf848('0x99')]){_0x108566=_0x7cee1f[_0xf848('0x99')][_0xf848('0x9a')](0x0,_0x7cee1f[_0xf848('0x99')][_0xf848('0x9b')]('-'));if(this['agents'][_0x108566]){logger[_0xf848('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x7cee1f['uniqueid'],_0x108566);this[_0xf848('0xc')][_0x108566][_0xf848('0x9c')]=!![];}}}}catch(_0xaed457){logger[_0xf848('0x3a')](_0xf848('0x9d'),_0x7cee1f[_0xf848('0x27')],util[_0xf848('0x28')](_0xaed457,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf848('0x1f')][_0xf848('0x9e')]=function(_0x1d9e6f){var _0x35c972='';try{if(this['isNotNull'](_0x1d9e6f)){logger[_0xf848('0x34')](_0xf848('0x9f'),_0x1d9e6f[_0xf848('0x27')],util['inspect'](_0x1d9e6f,{'showHidden':![],'depth':null}));if(_0x1d9e6f[_0xf848('0x99')]){_0x35c972=_0x1d9e6f[_0xf848('0x99')][_0xf848('0x9a')](0x0,_0x1d9e6f[_0xf848('0x99')][_0xf848('0x9b')]('-'));if(this[_0xf848('0xc')][_0x35c972]){logger['info'](_0xf848('0xa0'),_0x1d9e6f['uniqueid'],_0x35c972);this[_0xf848('0xc')][_0x35c972][_0xf848('0x9c')]=![];}}}}catch(_0x27d42d){logger[_0xf848('0x3a')](_0xf848('0xa1'),_0x1d9e6f[_0xf848('0x27')],util[_0xf848('0x28')](_0x27d42d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xf848('0x1f')][_0xf848('0x89')]=function(_0x2cad50,_0x5c91ff=0x2710){if(this['channels'][_0x2cad50]){setTimeout(()=>{delete this['channels'][_0x2cad50];},_0x5c91ff);}};module[_0xf848('0xa2')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 23abb84..377f3c0 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81e2=['event','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','BlindTransfer','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','lodash','ioredis','../../../config/environment','../../../config/logger','ami','../ami','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newstate','syncNewState','varset','syncVarSet','hangup','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isUndefined','prototype','emit','isNotNull','info','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','from-sip','channel','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','YYYY-MM-DD\x20HH:mm:ss','channelstate','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastapplication','lastdata','cdr(','split','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','toNumber','UserId','membername','destinationchannel','disposition','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','endtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','transferType','then','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors'];(function(_0x408e22,_0x11f001){var _0x23d2bd=function(_0x3a2014){while(--_0x3a2014){_0x408e22['push'](_0x408e22['shift']());}};_0x23d2bd(++_0x11f001);}(_0x81e2,0x1b1));var _0x281e=function(_0x679374,_0x39f72a){_0x679374=_0x679374-0x0;var _0x31f720=_0x81e2[_0x679374];return _0x31f720;};'use strict';var _=require(_0x281e('0x0'));var moment=require('moment');var util=require('util');var path=require('path');var Redis=require(_0x281e('0x1'));var config=require(_0x281e('0x2'));var logger=require(_0x281e('0x3'))(_0x281e('0x4'));var ami=require(_0x281e('0x5'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var applications=[_0x281e('0x6'),_0x281e('0x7'),_0x281e('0x8'),_0x281e('0x9'),_0x281e('0xa'),_0x281e('0xb')];var dispositions=[_0x281e('0xc'),_0x281e('0xd'),_0x281e('0xd'),_0x281e('0xc'),_0x281e('0xc'),_0x281e('0xc'),'ANSWERED','BUSY',_0x281e('0xd'),_0x281e('0xd'),_0x281e('0xd')];config[_0x281e('0xe')]=_[_0x281e('0xf')](config[_0x281e('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x281e('0x10'))(new Redis(config[_0x281e('0xe')]));function VoiceCallReport(_0x131750){this[_0x281e('0x11')]=_0x131750[_0x281e('0x11')];this[_0x281e('0x12')]=_0x131750[_0x281e('0x12')];this[_0x281e('0x13')]={};ami['on'](_0x281e('0x14'),this[_0x281e('0x15')][_0x281e('0x16')](this));ami['on'](_0x281e('0x17'),this['syncNewExten'][_0x281e('0x16')](this));ami['on']('newchannel',this['syncNewChannel']['bind'](this));ami['on'](_0x281e('0x18'),this[_0x281e('0x19')]['bind'](this));ami['on'](_0x281e('0x1a'),this[_0x281e('0x1b')][_0x281e('0x16')](this));ami['on'](_0x281e('0x1c'),this['syncHangup']['bind'](this));ami['on']('newcallerid',this[_0x281e('0x1d')][_0x281e('0x16')](this));ami['on']('attendedtransfer',this[_0x281e('0x1e')][_0x281e('0x16')](this));ami['on'](_0x281e('0x1f'),this[_0x281e('0x20')][_0x281e('0x16')](this));ami['on'](_0x281e('0x21'),this[_0x281e('0x22')][_0x281e('0x16')](this));ami['on'](_0x281e('0x23'),this[_0x281e('0x24')][_0x281e('0x16')](this));try{logger['info'](_0x281e('0x25'));ami[_0x281e('0x26')]();}catch(_0x51507a){logger[_0x281e('0x27')](_0x281e('0x28'),util[_0x281e('0x29')](_0x51507a,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x36147a){return _0x36147a!==null&&!_[_0x281e('0x2a')](_0x36147a);};VoiceCallReport[_0x281e('0x2b')][_0x281e('0x2c')]=function(_0x122b8a,_0x12ab82,_0x201da0){io['to'](_0x122b8a)[_0x281e('0x2c')](_0x12ab82,_0x201da0);};VoiceCallReport['prototype'][_0x281e('0x1d')]=function(_0x5a0a88){try{if(this[_0x281e('0x2d')](_0x5a0a88)){logger[_0x281e('0x2e')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x5a0a88[_0x281e('0x2f')],_0x5a0a88[_0x281e('0x30')],_0x5a0a88[_0x281e('0x31')]);logger['debug'](_0x281e('0x32'),_0x5a0a88['uniqueid'],util[_0x281e('0x29')](_0x5a0a88,{'showHidden':![],'depth':null}));if(_0x5a0a88[_0x281e('0x2f')]===_0x5a0a88[_0x281e('0x33')]){if(!_['isUndefined'](this[_0x281e('0x11')][_0x5a0a88['uniqueid']])){_[_0x281e('0x34')](this[_0x281e('0x11')][_0x5a0a88[_0x281e('0x2f')]],_[_0x281e('0x35')](_0x5a0a88,_[_0x281e('0x36')](this[_0x281e('0x11')][_0x5a0a88['uniqueid']])));}}if(_0x5a0a88['context']===_0x281e('0x37')){var _0x2e9727=this['agents'][_0x5a0a88[_0x281e('0x38')]['split']('-')[0x0]];if(_0x2e9727){if(_0x5a0a88[_0x281e('0x39')]==_0x281e('0x3a')){_0x2e9727[_0x281e('0x3b')]=_0x5a0a88[_0x281e('0x3c')];this[_0x281e('0x2c')](util[_0x281e('0x3d')](_0x281e('0x3e'),_0x2e9727['name']),_0x281e('0x3f'),{'id':_0x2e9727['id'],'destaccountcode':_0x2e9727[_0x281e('0x40')],'destconnectedlinenum':_0x5a0a88[_0x281e('0x3c')]});}}}}}catch(_0x5251e6){logger[_0x281e('0x27')](_0x281e('0x41'),_0x5a0a88[_0x281e('0x2f')],util[_0x281e('0x29')](_0x5251e6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x3a9db0){try{if(this[_0x281e('0x2d')](_0x3a9db0)){logger[_0x281e('0x42')](_0x281e('0x43'),_0x3a9db0[_0x281e('0x2f')],util['inspect'](_0x3a9db0,{'showHidden':![],'depth':null}));if(this[_0x281e('0x11')][_0x3a9db0[_0x281e('0x2f')]]){return;}if(_0x3a9db0[_0x281e('0x38')]==='OutgoingSpoolFailed'){return;}if(_0x3a9db0[_0x281e('0x2f')]!==_0x3a9db0[_0x281e('0x33')]&&!this[_0x281e('0x13')][_0x3a9db0['linkedid']]){return;}logger[_0x281e('0x2e')](_0x281e('0x44'),_0x3a9db0[_0x281e('0x2f')],_0x3a9db0[_0x281e('0x45')],_0x3a9db0['exten']);this[_0x281e('0x11')][_0x3a9db0[_0x281e('0x2f')]]=new Channel();this[_0x281e('0x11')][_0x3a9db0[_0x281e('0x2f')]]['starttime']=moment()[_0x281e('0x3d')](_0x281e('0x46'));this[_0x281e('0x11')][_0x3a9db0[_0x281e('0x2f')]]['disposition']=dispositions[_['toNumber'](_0x3a9db0[_0x281e('0x47')])];_['merge'](this['channels'][_0x3a9db0[_0x281e('0x2f')]],_['pick'](_0x3a9db0,_['keys'](this['channels'][_0x3a9db0[_0x281e('0x2f')]])));if(_0x3a9db0['context']===_0x281e('0x37')){var _0x5f3d22=this['agents'][_0x3a9db0[_0x281e('0x38')]['split']('-')[0x0]];if(_0x5f3d22&&typeof _0x5f3d22[_0x281e('0x3b')]===_0x281e('0x48')){_0x5f3d22[_0x281e('0x3b')]=_0x3a9db0[_0x281e('0x39')];logger[_0x281e('0x42')](_0x281e('0x49'),_0x3a9db0[_0x281e('0x2f')],util[_0x281e('0x29')]({'id':_0x5f3d22['id'],'destaccountcode':_0x5f3d22[_0x281e('0x40')],'destconnectedlinenum':_0x3a9db0[_0x281e('0x39')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x281e('0x3d')]('user:%s',_0x5f3d22[_0x281e('0x4a')]),_0x281e('0x3f'),{'id':_0x5f3d22['id'],'destaccountcode':_0x5f3d22[_0x281e('0x40')],'destconnectedlinenum':_0x3a9db0[_0x281e('0x39')]});}}}}catch(_0xe6fe54){logger['error'](_0x281e('0x4b'),_0x3a9db0['uniqueid'],util['inspect'](_0xe6fe54,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x281e('0x2b')]['syncNewExten']=function(_0x931305){try{if(this[_0x281e('0x2d')](_0x931305)){logger[_0x281e('0x42')](_0x281e('0x4c'),_0x931305[_0x281e('0x2f')],util[_0x281e('0x29')](_0x931305,{'showHidden':![],'depth':null}));if(_0x931305[_0x281e('0x38')]===_0x281e('0x4d')||_0x931305['exten']==='h')return;if(_0x931305[_0x281e('0x2f')]===_0x931305[_0x281e('0x33')]||this[_0x281e('0x13')][_0x931305['linkedid']]){_0x931305[_0x281e('0x4e')]=_0x931305[_0x281e('0x4e')]?_0x931305[_0x281e('0x4e')][_0x281e('0x4f')]():undefined;_0x931305[_0x281e('0x50')]=_0x931305['appdata']||_0x931305['applicationdata'];if(_0x931305[_0x281e('0x51')]&&_0x931305[_0x281e('0x4e')]!=='queue'){_0x931305[_0x281e('0x50')]=_0x931305[_0x281e('0x50')][_0x281e('0x4f')]();}logger[_0x281e('0x2e')](_0x281e('0x52'),_0x931305[_0x281e('0x2f')],_0x931305['application'],_0x931305[_0x281e('0x50')]);if(_[_0x281e('0x2a')](this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]])){this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]]=new Channel();this['channels'][_0x931305[_0x281e('0x2f')]][_0x281e('0x53')]=_0x931305[_0x281e('0x54')]?moment()[_0x281e('0x55')](moment[_0x281e('0x54')](_0x931305['duration'])[_0x281e('0x56')](),'seconds')[_0x281e('0x3d')](_0x281e('0x46')):moment()['format'](_0x281e('0x46'));this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]]['disposition']=_0x281e('0xc');}_[_0x281e('0x34')](this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]],_['pick'](_0x931305,_[_0x281e('0x36')](this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]])));if(_[_0x281e('0x57')](applications,_0x931305['application'])){this[_0x281e('0x11')][_0x931305['uniqueid']][_0x281e('0x58')]=_0x931305[_0x281e('0x4e')];this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]][_0x281e('0x59')]=_0x931305[_0x281e('0x50')];if(_0x931305[_0x281e('0x4e')]===_0x281e('0x6')&&_['startsWith'](_0x931305['applicationdata'][_0x281e('0x4f')](),_0x281e('0x5a'))){var _0x46b3f4=_0x931305['applicationdata'][_0x281e('0x5b')]('=');var _0x27e799=_0x46b3f4[0x0][_0x281e('0x4f')]()[_0x281e('0x5c')](/cdr\((.*)\)/);if(_0x27e799){if(_0x27e799[0x1]===_0x281e('0x5d')&&!_[_0x281e('0x5e')](this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]][_0x27e799[0x1]]))return;this[_0x281e('0x11')][_0x931305[_0x281e('0x2f')]][_0x27e799[0x1]]=_0x46b3f4[0x1];}}else if(_0x931305[_0x281e('0x4e')]===_0x281e('0x7')){this['channels'][_0x931305[_0x281e('0x2f')]][_0x281e('0x7')]=_0x931305[_0x281e('0x50')][_0x281e('0x5b')](',')[0x0];}}}}}catch(_0x31ab51){logger[_0x281e('0x27')](_0x281e('0x5f'),_0x931305[_0x281e('0x2f')],util[_0x281e('0x29')](_0x31ab51,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x281e('0x2b')][_0x281e('0x19')]=function(_0x5b7ee0){try{if(this[_0x281e('0x2d')](_0x5b7ee0)){logger['info'](_0x281e('0x60'),_0x5b7ee0['uniqueid'],_0x5b7ee0['linkedid'],_0x5b7ee0[_0x281e('0x30')],_0x5b7ee0[_0x281e('0x31')]);logger['debug'](_0x281e('0x61'),_0x5b7ee0['uniqueid'],util[_0x281e('0x29')](_0x5b7ee0,{'showHidden':![],'depth':null}));if(_0x5b7ee0['channelstate']!=='6')return;var _0x2a375d=this['agents'][_0x5b7ee0[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]];if(_0x5b7ee0['uniqueid']!==_0x5b7ee0[_0x281e('0x33')]){var _0x4cd61c=moment();if(this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]]){if(!this['channels'][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x62')]){this[_0x281e('0x11')][_0x5b7ee0['linkedid']][_0x281e('0x62')]=!![];this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x63')]=_0x4cd61c['format'](_0x281e('0x46'));if(this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x53')]){this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x64')]=_0x4cd61c[_0x281e('0x65')](this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x53')],'seconds');}}this['channels'][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x33')]=_0x5b7ee0[_0x281e('0x2f')];if(_0x5b7ee0['calleridnum']!==_0x281e('0x3a')){this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x3c')]=_0x5b7ee0[_0x281e('0x31')];}this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x66')]=_0x5b7ee0[_0x281e('0x30')];this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]]['destinationchannel']=_0x5b7ee0[_0x281e('0x38')];this['channels'][_0x5b7ee0[_0x281e('0x33')]]['disposition']=dispositions[_[_0x281e('0x67')](_0x5b7ee0[_0x281e('0x47')])];if(_0x2a375d){this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]][_0x281e('0x68')]=_0x2a375d['id'];this[_0x281e('0x11')][_0x5b7ee0['linkedid']][_0x281e('0x69')]=_0x2a375d[_0x281e('0x4a')];}}if(this['channels'][_0x5b7ee0[_0x281e('0x2f')]]){if(!this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x62')]){this['channels'][_0x5b7ee0['uniqueid']][_0x281e('0x62')]=!![];this['channels'][_0x5b7ee0['uniqueid']][_0x281e('0x63')]=_0x4cd61c[_0x281e('0x3d')](_0x281e('0x46'));if(this['channels'][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x53')]){this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]]['holdtime']=_0x4cd61c[_0x281e('0x65')](this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]]['starttime'],_0x281e('0x56'));}}if(_0x5b7ee0[_0x281e('0x31')]!==_0x281e('0x3a')){this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x3c')]=_0x5b7ee0[_0x281e('0x31')];}this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x66')]=_0x5b7ee0[_0x281e('0x30')];this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x6a')]=_0x5b7ee0[_0x281e('0x38')];this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x6b')]=dispositions[_[_0x281e('0x67')](_0x5b7ee0[_0x281e('0x47')])];}}else{if(this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]]){if(_0x2a375d){this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x68')]=_0x2a375d['id'];this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x2f')]][_0x281e('0x69')]=_0x2a375d[_0x281e('0x4a')];}}}if(_0x5b7ee0['context']===_0x281e('0x37')){if(_0x2a375d){_0x2a375d['destconnectedlinenum']=_0x5b7ee0['exten'];var _0xc17290;if(this[_0x281e('0x11')][_0x5b7ee0['uniqueid']]){_0xc17290=this[_0x281e('0x11')][_0x5b7ee0['uniqueid']][_0x281e('0x7')];}else if(this[_0x281e('0x11')][_0x5b7ee0[_0x281e('0x33')]]){_0xc17290=this[_0x281e('0x11')][_0x5b7ee0['linkedid']]['queue'];}_0x2a375d['queue']=_0xc17290;var _0x4b5c9a={'id':_0x2a375d['id'],'name':_0x2a375d[_0x281e('0x4a')],'agentconnected':!![],'destaccountcode':_0x2a375d[_0x281e('0x40')],'destconnectedlinenum':_0x5b7ee0['exten'],'queue':_0xc17290||undefined,'uniqueid':_0x5b7ee0[_0x281e('0x33')]};logger['debug'](_0x281e('0x6c'),_0x5b7ee0[_0x281e('0x2f')],util['inspect'](_0x4b5c9a,{'showHidden':![],'depth':null}));this[_0x281e('0x2c')](util[_0x281e('0x3d')]('user:%s',_0x2a375d[_0x281e('0x4a')]),'user:agentconnect',_0x4b5c9a);}}}}catch(_0x1654a8){logger[_0x281e('0x27')](_0x281e('0x6d'),_0x5b7ee0[_0x281e('0x2f')],util[_0x281e('0x29')](_0x1654a8,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x281e('0x6e')]=function(_0x3e8936,_0x280d3b){try{if(this[_0x281e('0x11')][_0x3e8936]){logger[_0x281e('0x2e')](_0x281e('0x6f'),_0x3e8936,_0x280d3b);this[_0x281e('0x11')][_0x3e8936][_0x281e('0x70')]=!![];if(_[_0x281e('0x71')](_0x280d3b,'.wav49')){_0x280d3b=_0x280d3b['replace']('.wav49',_0x281e('0x72'));}this['channels'][_0x3e8936][_0x281e('0x73')]=_0x280d3b;var _0x43d206=_[_0x281e('0x74')](this['channels'][_0x3e8936]['monitors'],{'filename':_0x280d3b});if(_[_0x281e('0x5e')](_0x43d206)){this[_0x281e('0x11')][_0x3e8936][_0x281e('0x75')][_0x281e('0x76')]({'filename':_0x280d3b,'createdAt':moment()[_0x281e('0x3d')](_0x281e('0x46')),'mixmonitorid':'','status':_0x281e('0x77')});}}}catch(_0x73f1cc){logger[_0x281e('0x27')](_0x281e('0x78'),_0x3e8936,util[_0x281e('0x29')](_0x73f1cc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x281e('0x2b')]['syncVarSet']=function(_0x3dc237){try{if(this['isNotNull'](_0x3dc237)){logger['debug'](_0x281e('0x79'),_0x3dc237[_0x281e('0x2f')],util[_0x281e('0x29')](_0x3dc237,{'showHidden':![],'depth':null}));if(this[_0x281e('0x11')][_0x3dc237[_0x281e('0x2f')]]&&_0x3dc237[_0x281e('0x38')]!=_0x281e('0x4d')){if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')])){if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')][_0x281e('0x7b')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x3dc237[_0x281e('0x2f')],_0x3dc237['value']);this[_0x281e('0x6e')](_0x3dc237[_0x281e('0x2f')],_0x3dc237[_0x281e('0x7c')]);}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')][_0x281e('0x7d')])){logger[_0x281e('0x2e')](_0x281e('0x7e'),_0x3dc237['uniqueid'],_0x3dc237['value']);this[_0x281e('0x11')][_0x3dc237[_0x281e('0x2f')]]['calleridnum']=_0x3dc237[_0x281e('0x7c')];}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')][_0x281e('0x7f')])){logger[_0x281e('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x3dc237[_0x281e('0x2f')],_0x3dc237[_0x281e('0x7c')]);this[_0x281e('0x11')][_0x3dc237[_0x281e('0x2f')]][_0x281e('0x80')]=_0x3dc237[_0x281e('0x7c')];}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')]['xmd-cdrtype'])){logger[_0x281e('0x2e')](_0x281e('0x81'),_0x3dc237[_0x281e('0x2f')],_0x3dc237['value']);this['channels'][_0x3dc237['uniqueid']][_0x281e('0x5d')]=_0x3dc237[_0x281e('0x7c')];}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')]['xmd-queue'])){logger[_0x281e('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x3dc237[_0x281e('0x2f')],_0x3dc237[_0x281e('0x7c')]['split'](',')[0x0]);this[_0x281e('0x11')][_0x3dc237[_0x281e('0x2f')]]['queue']=_0x3dc237[_0x281e('0x7c')]['split'](',')[0x0];}else if(this[_0x281e('0x2d')](_0x3dc237['variable'][_0x281e('0x82')])){logger[_0x281e('0x2e')](_0x281e('0x83'),_0x3dc237[_0x281e('0x2f')],_0x3dc237[_0x281e('0x7c')]);this['channels'][_0x3dc237[_0x281e('0x2f')]][_0x281e('0x84')]=_0x3dc237[_0x281e('0x7c')];}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')][_0x281e('0x85')])){logger['info'](_0x281e('0x86'),_0x3dc237[_0x281e('0x2f')],_0x3dc237['value']);this[_0x281e('0x11')][_0x3dc237[_0x281e('0x2f')]]['destination']=_0x3dc237['value'];}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')]['xmd-callerid-preview'])){logger[_0x281e('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x3dc237[_0x281e('0x2f')],_0x3dc237[_0x281e('0x7c')]);this['channels'][_0x3dc237[_0x281e('0x2f')]][_0x281e('0x87')]=_0x3dc237['value'];}else if(this[_0x281e('0x2d')](_0x3dc237['variable'][_0x281e('0x88')])){logger['info'](_0x281e('0x89'),_0x3dc237[_0x281e('0x2f')],_0x3dc237[_0x281e('0x7c')]);this[_0x281e('0x11')][_0x3dc237[_0x281e('0x2f')]][_0x281e('0x7')]=_0x3dc237['value'];}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')]['sipcallid'])){logger[_0x281e('0x2e')](_0x281e('0x8a'),_0x3dc237[_0x281e('0x2f')],_0x3dc237['value']);this['channels'][_0x3dc237['uniqueid']]['sipcalluniqueid']=_0x3dc237[_0x281e('0x7c')];}}}else if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')][_0x281e('0x7b')])){if(_0x3dc237[_0x281e('0x7c')]){var _0x3413ed=path[_0x281e('0x8b')](_0x3dc237[_0x281e('0x7c')])[_0x281e('0x4a')];logger['info'](_0x281e('0x8c'),_0x3413ed,_0x3dc237[_0x281e('0x7c')]);this[_0x281e('0x6e')](_0x3413ed,_0x3dc237[_0x281e('0x7c')]);}}else if(this[_0x281e('0x11')][_0x3dc237[_0x281e('0x33')]]){if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')])){if(this[_0x281e('0x2d')](_0x3dc237[_0x281e('0x7a')][_0x281e('0x8d')])){logger[_0x281e('0x2e')](_0x281e('0x8a'),_0x3dc237['linkedid'],_0x3dc237[_0x281e('0x7c')]);this[_0x281e('0x11')][_0x3dc237[_0x281e('0x33')]]['sipcalllinkedid']=_0x3dc237[_0x281e('0x7c')];}}}}}catch(_0x5e8893){logger[_0x281e('0x27')](_0x281e('0x8e'),_0x3dc237['uniqueid'],util['inspect'](_0x5e8893,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x281e('0x2b')][_0x281e('0x8f')]=function(_0x2e67db){try{if(this[_0x281e('0x2d')](_0x2e67db)){logger['debug'](_0x281e('0x90'),_0x2e67db[_0x281e('0x2f')],util[_0x281e('0x29')](_0x2e67db,{'showHidden':![],'depth':null}));if(this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]]){if(this['channels'][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x33')]]){this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db['linkedid']][_0x281e('0x33')]][_0x281e('0x2f')]=_0x2e67db[_0x281e('0x2f')];this['channels'][this[_0x281e('0x13')][_0x2e67db['linkedid']][_0x281e('0x33')]]['answered']=this[_0x281e('0x11')][_0x2e67db[_0x281e('0x2f')]][_0x281e('0x62')];this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db['linkedid']][_0x281e('0x33')]][_0x281e('0x63')]=this['channels'][_0x2e67db[_0x281e('0x2f')]]['answertime'];this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db['linkedid']][_0x281e('0x33')]][_0x281e('0x6a')]=this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x33')]]['channel'];this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x33')]][_0x281e('0x6b')]=this[_0x281e('0x11')][_0x2e67db[_0x281e('0x2f')]]['disposition'];this[_0x281e('0x11')][_0x2e67db['uniqueid']]=this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]]['linkedid']];this[_0x281e('0x91')](this['blindTransfers'][_0x2e67db['linkedid']]['linkedid']);}else if(this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]]){this['channels'][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]][_0x281e('0x2f')]=[this[_0x281e('0x11')][this['blindTransfers'][_0x2e67db[_0x281e('0x33')]]['uniqueid']][_0x281e('0x33')],this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]][_0x281e('0x33')]=this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]][_0x281e('0x2f')]][0x0];this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]]['uniqueid']][_0x281e('0x62')]=this[_0x281e('0x11')][_0x2e67db['uniqueid']]['answered'];this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]][_0x281e('0x63')]=this[_0x281e('0x11')][_0x2e67db[_0x281e('0x2f')]]['answertime'];this['channels'][this[_0x281e('0x13')][_0x2e67db['linkedid']][_0x281e('0x2f')]][_0x281e('0x6a')]=this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]][_0x281e('0x38')];this[_0x281e('0x11')][this['blindTransfers'][_0x2e67db['linkedid']][_0x281e('0x2f')]][_0x281e('0x6b')]=this['channels'][_0x2e67db[_0x281e('0x2f')]][_0x281e('0x6b')];this[_0x281e('0x11')][_0x2e67db['uniqueid']]=this[_0x281e('0x11')][this[_0x281e('0x13')][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]];this[_0x281e('0x91')](this['blindTransfers'][_0x2e67db[_0x281e('0x33')]][_0x281e('0x2f')]);}}if(this[_0x281e('0x11')][_0x2e67db[_0x281e('0x2f')]]){logger[_0x281e('0x2e')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x2e67db['uniqueid'],_0x2e67db['cause-txt']);var _0x4aa7ba=moment();this[_0x281e('0x11')][_0x2e67db[_0x281e('0x2f')]][_0x281e('0x92')]=_0x4aa7ba['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x281e('0x11')][_0x2e67db['uniqueid']][_0x281e('0x54')]=_0x4aa7ba[_0x281e('0x65')](this[_0x281e('0x11')][_0x2e67db['uniqueid']][_0x281e('0x53')],_0x281e('0x56'));if(this[_0x281e('0x11')][_0x2e67db['uniqueid']][_0x281e('0x62')]){this[_0x281e('0x11')][_0x2e67db['uniqueid']]['billableseconds']=_0x4aa7ba[_0x281e('0x65')](this[_0x281e('0x11')][_0x2e67db[_0x281e('0x2f')]][_0x281e('0x63')],_0x281e('0x56'));this[_0x281e('0x11')][_0x2e67db[_0x281e('0x2f')]][_0x281e('0x64')]=this[_0x281e('0x11')][_0x2e67db['uniqueid']][_0x281e('0x54')]-this[_0x281e('0x11')][_0x2e67db['uniqueid']]['billableseconds'];}if(_0x2e67db['context']===_0x281e('0x37')){if(this[_0x281e('0x12')][_0x2e67db[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]]){this[_0x281e('0x12')][_0x2e67db[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]]=_[_0x281e('0x93')](this['agents'][_0x2e67db[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]],['destconnectedlinenum']);logger[_0x281e('0x42')](_0x281e('0x94'),_0x2e67db[_0x281e('0x2f')],util['inspect']({'id':this[_0x281e('0x12')][_0x2e67db[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]]['id'],'destaccountcode':this[_0x281e('0x12')][_0x2e67db[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]][_0x281e('0x40')]},{'showHidden':![],'depth':null}));this[_0x281e('0x2c')](util[_0x281e('0x3d')](_0x281e('0x3e'),this[_0x281e('0x12')][_0x2e67db[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]][_0x281e('0x4a')]),_0x281e('0x95'),{'id':this[_0x281e('0x12')][_0x2e67db[_0x281e('0x38')][_0x281e('0x5b')]('-')[0x0]]['id'],'destaccountcode':this[_0x281e('0x12')][_0x2e67db[_0x281e('0x38')]['split']('-')[0x0]][_0x281e('0x40')]});for(var _0x23c264=0x0;_0x23c264{delete this[_0x281e('0x11')][_0x4516ac];},_0x957b8f);}};module[_0x281e('0xc5')]=VoiceCallReport; \ No newline at end of file +var _0x8a3a=['[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','blindTransfers','info','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','from-sip','undefined','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','queue','toLowerCase','duration','subtract','seconds','disposition','includes','lastapplication','lastdata','startsWith','cdr(','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','channelstate','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','membername','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','push','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','user:agentcomplete','length','transferType','resolve','then','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','set','agi','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','agents','coreshowchannel','syncNewExten','bind','newchannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstop','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','channels','pick','keys','context','channel','split','destconnectedlinenum','connectedlinenum','format','user:%s','user:agentconnect','accountcode'];(function(_0x5ba581,_0x5d632e){var _0x4a30b2=function(_0x3ebe3d){while(--_0x3ebe3d){_0x5ba581['push'](_0x5ba581['shift']());}};_0x4a30b2(++_0x5d632e);}(_0x8a3a,0x155));var _0xa8a3=function(_0xa85d47,_0x386a18){_0xa85d47=_0xa85d47-0x0;var _0x1b8387=_0x8a3a[_0xa85d47];return _0x1b8387;};'use strict';var _=require(_0xa8a3('0x0'));var moment=require(_0xa8a3('0x1'));var util=require(_0xa8a3('0x2'));var path=require(_0xa8a3('0x3'));var Redis=require(_0xa8a3('0x4'));var config=require(_0xa8a3('0x5'));var logger=require(_0xa8a3('0x6'))(_0xa8a3('0x7'));var ami=require(_0xa8a3('0x8'));var Channel=require(_0xa8a3('0x9'));var RpcSetting=require('../rpc/setting');var applications=[_0xa8a3('0xa'),'queue',_0xa8a3('0xb'),_0xa8a3('0xc'),'playback',_0xa8a3('0xd')];var dispositions=[_0xa8a3('0xe'),_0xa8a3('0xf'),_0xa8a3('0xf'),'NO\x20ANSWER',_0xa8a3('0xe'),_0xa8a3('0xe'),_0xa8a3('0x10'),_0xa8a3('0x11'),_0xa8a3('0xf'),'FAILED','FAILED'];config[_0xa8a3('0x12')]=_[_0xa8a3('0x13')](config['redis'],{'host':_0xa8a3('0x14'),'port':0x18eb});var io=require(_0xa8a3('0x15'))(new Redis(config[_0xa8a3('0x12')]));function VoiceCallReport(_0x3d8e8f){this['channels']=_0x3d8e8f['channels'];this['agents']=_0x3d8e8f[_0xa8a3('0x16')];this['blindTransfers']={};ami['on'](_0xa8a3('0x17'),this[_0xa8a3('0x18')][_0xa8a3('0x19')](this));ami['on']('newexten',this[_0xa8a3('0x18')][_0xa8a3('0x19')](this));ami['on'](_0xa8a3('0x1a'),this['syncNewChannel'][_0xa8a3('0x19')](this));ami['on'](_0xa8a3('0x1b'),this[_0xa8a3('0x1c')][_0xa8a3('0x19')](this));ami['on'](_0xa8a3('0x1d'),this[_0xa8a3('0x1e')]['bind'](this));ami['on'](_0xa8a3('0x1f'),this[_0xa8a3('0x20')][_0xa8a3('0x19')](this));ami['on'](_0xa8a3('0x21'),this[_0xa8a3('0x22')]['bind'](this));ami['on'](_0xa8a3('0x23'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xa8a3('0x24'),this[_0xa8a3('0x25')][_0xa8a3('0x19')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xa8a3('0x19')](this));ami['on'](_0xa8a3('0x26'),this['syncMusicOnHoldStop'][_0xa8a3('0x19')](this));try{logger['info']('[voiceCallReport][coreshowchannels]\x20started');ami[_0xa8a3('0x27')]();}catch(_0x526e16){logger[_0xa8a3('0x28')](_0xa8a3('0x29'),util[_0xa8a3('0x2a')](_0x526e16,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xa8a3('0x2b')][_0xa8a3('0x2c')]=function(_0x436fe8){return _0x436fe8!==null&&!_[_0xa8a3('0x2d')](_0x436fe8);};VoiceCallReport[_0xa8a3('0x2b')][_0xa8a3('0x2e')]=function(_0x591bd3,_0x3a47e5,_0x5c4b74){io['to'](_0x591bd3)[_0xa8a3('0x2e')](_0x3a47e5,_0x5c4b74);};VoiceCallReport[_0xa8a3('0x2b')][_0xa8a3('0x22')]=function(_0x17b319){try{if(this[_0xa8a3('0x2c')](_0x17b319)){logger['info'](_0xa8a3('0x2f'),_0x17b319[_0xa8a3('0x30')],_0x17b319[_0xa8a3('0x31')],_0x17b319[_0xa8a3('0x32')]);logger[_0xa8a3('0x33')](_0xa8a3('0x34'),_0x17b319[_0xa8a3('0x30')],util[_0xa8a3('0x2a')](_0x17b319,{'showHidden':![],'depth':null}));if(_0x17b319[_0xa8a3('0x30')]===_0x17b319[_0xa8a3('0x35')]){if(!_[_0xa8a3('0x2d')](this['channels'][_0x17b319[_0xa8a3('0x30')]])){_[_0xa8a3('0x36')](this[_0xa8a3('0x37')][_0x17b319[_0xa8a3('0x30')]],_[_0xa8a3('0x38')](_0x17b319,_[_0xa8a3('0x39')](this[_0xa8a3('0x37')][_0x17b319['uniqueid']])));}}if(_0x17b319[_0xa8a3('0x3a')]==='from-sip'){var _0x233247=this[_0xa8a3('0x16')][_0x17b319[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]];if(_0x233247){if(_0x17b319['exten']=='xcally-motion-preview'){_0x233247[_0xa8a3('0x3d')]=_0x17b319[_0xa8a3('0x3e')];this[_0xa8a3('0x2e')](util[_0xa8a3('0x3f')](_0xa8a3('0x40'),_0x233247['name']),_0xa8a3('0x41'),{'id':_0x233247['id'],'destaccountcode':_0x233247[_0xa8a3('0x42')],'destconnectedlinenum':_0x17b319[_0xa8a3('0x3e')]});}}}}}catch(_0x1ed8b9){logger['error'](_0xa8a3('0x43'),_0x17b319[_0xa8a3('0x30')],util[_0xa8a3('0x2a')](_0x1ed8b9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa8a3('0x2b')]['syncNewChannel']=function(_0x317f46){try{if(this[_0xa8a3('0x2c')](_0x317f46)){logger[_0xa8a3('0x33')](_0xa8a3('0x44'),_0x317f46['uniqueid'],util[_0xa8a3('0x2a')](_0x317f46,{'showHidden':![],'depth':null}));if(this[_0xa8a3('0x37')][_0x317f46[_0xa8a3('0x30')]]){return;}if(_0x317f46['channel']===_0xa8a3('0x45')){return;}if(_0x317f46['uniqueid']!==_0x317f46['linkedid']&&!this[_0xa8a3('0x46')][_0x317f46[_0xa8a3('0x35')]]){return;}logger[_0xa8a3('0x47')](_0xa8a3('0x48'),_0x317f46[_0xa8a3('0x30')],_0x317f46[_0xa8a3('0x3a')],_0x317f46[_0xa8a3('0x49')]);this[_0xa8a3('0x37')][_0x317f46[_0xa8a3('0x30')]]=new Channel();this[_0xa8a3('0x37')][_0x317f46[_0xa8a3('0x30')]][_0xa8a3('0x4a')]=moment()['format'](_0xa8a3('0x4b'));this['channels'][_0x317f46[_0xa8a3('0x30')]]['disposition']=dispositions[_[_0xa8a3('0x4c')](_0x317f46['channelstate'])];_[_0xa8a3('0x36')](this[_0xa8a3('0x37')][_0x317f46[_0xa8a3('0x30')]],_[_0xa8a3('0x38')](_0x317f46,_[_0xa8a3('0x39')](this[_0xa8a3('0x37')][_0x317f46['uniqueid']])));if(_0x317f46[_0xa8a3('0x3a')]===_0xa8a3('0x4d')){var _0x1e85b8=this['agents'][_0x317f46[_0xa8a3('0x3b')]['split']('-')[0x0]];if(_0x1e85b8&&typeof _0x1e85b8[_0xa8a3('0x3d')]===_0xa8a3('0x4e')){_0x1e85b8[_0xa8a3('0x3d')]=_0x317f46[_0xa8a3('0x49')];logger['debug']('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x317f46[_0xa8a3('0x30')],util['inspect']({'id':_0x1e85b8['id'],'destaccountcode':_0x1e85b8[_0xa8a3('0x42')],'destconnectedlinenum':_0x317f46['exten']},{'showHidden':![],'depth':null}));this[_0xa8a3('0x2e')](util[_0xa8a3('0x3f')](_0xa8a3('0x40'),_0x1e85b8[_0xa8a3('0x4f')]),_0xa8a3('0x41'),{'id':_0x1e85b8['id'],'destaccountcode':_0x1e85b8['accountcode'],'destconnectedlinenum':_0x317f46[_0xa8a3('0x49')]});}}}}catch(_0x4c03ac){logger[_0xa8a3('0x28')](_0xa8a3('0x50'),_0x317f46['uniqueid'],util['inspect'](_0x4c03ac,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x2d3c90){try{if(this[_0xa8a3('0x2c')](_0x2d3c90)){logger[_0xa8a3('0x33')](_0xa8a3('0x51'),_0x2d3c90[_0xa8a3('0x30')],util['inspect'](_0x2d3c90,{'showHidden':![],'depth':null}));if(_0x2d3c90[_0xa8a3('0x3b')]==='OutgoingSpoolFailed'||_0x2d3c90[_0xa8a3('0x49')]==='h')return;if(_0x2d3c90['uniqueid']===_0x2d3c90[_0xa8a3('0x35')]||this[_0xa8a3('0x46')][_0x2d3c90[_0xa8a3('0x35')]]){_0x2d3c90[_0xa8a3('0x52')]=_0x2d3c90[_0xa8a3('0x52')]?_0x2d3c90[_0xa8a3('0x52')]['toLowerCase']():undefined;_0x2d3c90[_0xa8a3('0x53')]=_0x2d3c90[_0xa8a3('0x54')]||_0x2d3c90[_0xa8a3('0x53')];if(_0x2d3c90[_0xa8a3('0x54')]&&_0x2d3c90[_0xa8a3('0x52')]!==_0xa8a3('0x55')){_0x2d3c90['applicationdata']=_0x2d3c90[_0xa8a3('0x53')][_0xa8a3('0x56')]();}logger['info']('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x2d3c90[_0xa8a3('0x30')],_0x2d3c90[_0xa8a3('0x52')],_0x2d3c90['applicationdata']);if(_[_0xa8a3('0x2d')](this[_0xa8a3('0x37')][_0x2d3c90[_0xa8a3('0x30')]])){this['channels'][_0x2d3c90[_0xa8a3('0x30')]]=new Channel();this[_0xa8a3('0x37')][_0x2d3c90[_0xa8a3('0x30')]][_0xa8a3('0x4a')]=_0x2d3c90[_0xa8a3('0x57')]?moment()[_0xa8a3('0x58')](moment[_0xa8a3('0x57')](_0x2d3c90[_0xa8a3('0x57')])[_0xa8a3('0x59')](),_0xa8a3('0x59'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xa8a3('0x3f')](_0xa8a3('0x4b'));this[_0xa8a3('0x37')][_0x2d3c90[_0xa8a3('0x30')]][_0xa8a3('0x5a')]='NO\x20ANSWER';}_[_0xa8a3('0x36')](this[_0xa8a3('0x37')][_0x2d3c90['uniqueid']],_['pick'](_0x2d3c90,_[_0xa8a3('0x39')](this[_0xa8a3('0x37')][_0x2d3c90['uniqueid']])));if(_[_0xa8a3('0x5b')](applications,_0x2d3c90[_0xa8a3('0x52')])){this['channels'][_0x2d3c90[_0xa8a3('0x30')]][_0xa8a3('0x5c')]=_0x2d3c90[_0xa8a3('0x52')];this[_0xa8a3('0x37')][_0x2d3c90['uniqueid']][_0xa8a3('0x5d')]=_0x2d3c90[_0xa8a3('0x53')];if(_0x2d3c90[_0xa8a3('0x52')]===_0xa8a3('0xa')&&_[_0xa8a3('0x5e')](_0x2d3c90['applicationdata'][_0xa8a3('0x56')](),_0xa8a3('0x5f'))){var _0xace0de=_0x2d3c90[_0xa8a3('0x53')][_0xa8a3('0x3c')]('=');var _0x326e25=_0xace0de[0x0][_0xa8a3('0x56')]()['match'](/cdr\((.*)\)/);if(_0x326e25){if(_0x326e25[0x1]==='type'&&!_['isNil'](this[_0xa8a3('0x37')][_0x2d3c90[_0xa8a3('0x30')]][_0x326e25[0x1]]))return;this[_0xa8a3('0x37')][_0x2d3c90[_0xa8a3('0x30')]][_0x326e25[0x1]]=_0xace0de[0x1];}}else if(_0x2d3c90['application']==='queue'){this[_0xa8a3('0x37')][_0x2d3c90[_0xa8a3('0x30')]][_0xa8a3('0x55')]=_0x2d3c90[_0xa8a3('0x53')][_0xa8a3('0x3c')](',')[0x0];}}}}}catch(_0x4925c2){logger[_0xa8a3('0x28')](_0xa8a3('0x60'),_0x2d3c90[_0xa8a3('0x30')],util[_0xa8a3('0x2a')](_0x4925c2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa8a3('0x2b')]['syncNewState']=function(_0x471411){try{if(this[_0xa8a3('0x2c')](_0x471411)){logger['info'](_0xa8a3('0x61'),_0x471411[_0xa8a3('0x30')],_0x471411['linkedid'],_0x471411[_0xa8a3('0x31')],_0x471411[_0xa8a3('0x32')]);logger[_0xa8a3('0x33')]('[%s][voiceCallReport][newstate]\x20event:',_0x471411[_0xa8a3('0x30')],util['inspect'](_0x471411,{'showHidden':![],'depth':null}));if(_0x471411[_0xa8a3('0x62')]!=='6')return;var _0x1fa304=this[_0xa8a3('0x16')][_0x471411[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]];if(_0x471411['uniqueid']!==_0x471411[_0xa8a3('0x35')]){var _0x35fc7f=moment();if(this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]]){if(!this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]][_0xa8a3('0x63')]){this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]]['answered']=!![];this['channels'][_0x471411['linkedid']][_0xa8a3('0x64')]=_0x35fc7f[_0xa8a3('0x3f')](_0xa8a3('0x4b'));if(this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]][_0xa8a3('0x4a')]){this[_0xa8a3('0x37')][_0x471411['linkedid']][_0xa8a3('0x65')]=_0x35fc7f[_0xa8a3('0x66')](this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]][_0xa8a3('0x4a')],_0xa8a3('0x59'));}}this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]]['linkedid']=_0x471411['uniqueid'];if(_0x471411[_0xa8a3('0x32')]!==_0xa8a3('0x67')){this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]]['connectedlinenum']=_0x471411[_0xa8a3('0x32')];}this['channels'][_0x471411[_0xa8a3('0x35')]][_0xa8a3('0x68')]=_0x471411['calleridname'];this[_0xa8a3('0x37')][_0x471411['linkedid']][_0xa8a3('0x69')]=_0x471411[_0xa8a3('0x3b')];this['channels'][_0x471411['linkedid']]['disposition']=dispositions[_[_0xa8a3('0x4c')](_0x471411['channelstate'])];if(_0x1fa304){this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]]['UserId']=_0x1fa304['id'];this[_0xa8a3('0x37')][_0x471411['linkedid']][_0xa8a3('0x6a')]=_0x1fa304[_0xa8a3('0x4f')];}}if(this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]]){if(!this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]][_0xa8a3('0x63')]){this['channels'][_0x471411[_0xa8a3('0x30')]][_0xa8a3('0x63')]=!![];this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]]['answertime']=_0x35fc7f['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]]['starttime']){this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]][_0xa8a3('0x65')]=_0x35fc7f[_0xa8a3('0x66')](this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]][_0xa8a3('0x4a')],_0xa8a3('0x59'));}}if(_0x471411[_0xa8a3('0x32')]!==_0xa8a3('0x67')){this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]]['connectedlinenum']=_0x471411[_0xa8a3('0x32')];}this['channels'][_0x471411[_0xa8a3('0x30')]][_0xa8a3('0x68')]=_0x471411[_0xa8a3('0x31')];this['channels'][_0x471411[_0xa8a3('0x30')]]['destinationchannel']=_0x471411[_0xa8a3('0x3b')];this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]]['disposition']=dispositions[_[_0xa8a3('0x4c')](_0x471411[_0xa8a3('0x62')])];}}else{if(this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]]){if(_0x1fa304){this['channels'][_0x471411[_0xa8a3('0x30')]]['UserId']=_0x1fa304['id'];this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x30')]]['membername']=_0x1fa304[_0xa8a3('0x4f')];}}}if(_0x471411['context']===_0xa8a3('0x4d')){if(_0x1fa304){_0x1fa304[_0xa8a3('0x3d')]=_0x471411[_0xa8a3('0x49')];var _0x38e1e5;if(this['channels'][_0x471411[_0xa8a3('0x30')]]){_0x38e1e5=this[_0xa8a3('0x37')][_0x471411['uniqueid']][_0xa8a3('0x55')];}else if(this[_0xa8a3('0x37')][_0x471411[_0xa8a3('0x35')]]){_0x38e1e5=this[_0xa8a3('0x37')][_0x471411['linkedid']][_0xa8a3('0x55')];}_0x1fa304[_0xa8a3('0x55')]=_0x38e1e5;var _0x503a13={'id':_0x1fa304['id'],'name':_0x1fa304[_0xa8a3('0x4f')],'agentconnected':!![],'destaccountcode':_0x1fa304[_0xa8a3('0x42')],'destconnectedlinenum':_0x471411['exten'],'queue':_0x38e1e5||undefined,'uniqueid':_0x471411[_0xa8a3('0x35')]};logger['debug'](_0xa8a3('0x6b'),_0x471411[_0xa8a3('0x30')],util[_0xa8a3('0x2a')](_0x503a13,{'showHidden':![],'depth':null}));this[_0xa8a3('0x2e')](util[_0xa8a3('0x3f')](_0xa8a3('0x40'),_0x1fa304[_0xa8a3('0x4f')]),_0xa8a3('0x41'),_0x503a13);}}}}catch(_0x179e77){logger[_0xa8a3('0x28')]('[%s][voiceCallReport][newstate]',_0x471411[_0xa8a3('0x30')],util[_0xa8a3('0x2a')](_0x179e77,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa8a3('0x2b')]['syncMixMonitorFilename']=function(_0x484164,_0x4cb025){try{if(this[_0xa8a3('0x37')][_0x484164]){logger[_0xa8a3('0x47')](_0xa8a3('0x6c'),_0x484164,_0x4cb025);this[_0xa8a3('0x37')][_0x484164][_0xa8a3('0x6d')]=!![];if(_[_0xa8a3('0x6e')](_0x4cb025,_0xa8a3('0x6f'))){_0x4cb025=_0x4cb025[_0xa8a3('0x70')](_0xa8a3('0x6f'),_0xa8a3('0x71'));}this['channels'][_0x484164][_0xa8a3('0x72')]=_0x4cb025;var _0x2acc15=_['find'](this[_0xa8a3('0x37')][_0x484164][_0xa8a3('0x73')],{'filename':_0x4cb025});if(_['isNil'](_0x2acc15)){this[_0xa8a3('0x37')][_0x484164][_0xa8a3('0x73')][_0xa8a3('0x74')]({'filename':_0x4cb025,'createdAt':moment()[_0xa8a3('0x3f')](_0xa8a3('0x4b')),'mixmonitorid':'','status':'rec'});}}}catch(_0x3d6f64){logger[_0xa8a3('0x28')]('[%s][voiceCallReport][mixMonitorFilename]',_0x484164,util[_0xa8a3('0x2a')](_0x3d6f64,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa8a3('0x1e')]=function(_0x2beffa){try{if(this[_0xa8a3('0x2c')](_0x2beffa)){logger['debug'](_0xa8a3('0x75'),_0x2beffa['uniqueid'],util[_0xa8a3('0x2a')](_0x2beffa,{'showHidden':![],'depth':null}));if(this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]]&&_0x2beffa[_0xa8a3('0x3b')]!=_0xa8a3('0x45')){if(this[_0xa8a3('0x2c')](_0x2beffa[_0xa8a3('0x76')])){if(this[_0xa8a3('0x2c')](_0x2beffa[_0xa8a3('0x76')][_0xa8a3('0x77')])){logger[_0xa8a3('0x47')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x2beffa[_0xa8a3('0x30')],_0x2beffa[_0xa8a3('0x78')]);this[_0xa8a3('0x79')](_0x2beffa[_0xa8a3('0x30')],_0x2beffa[_0xa8a3('0x78')]);}else if(this['isNotNull'](_0x2beffa[_0xa8a3('0x76')][_0xa8a3('0x7a')])){logger[_0xa8a3('0x47')](_0xa8a3('0x7b'),_0x2beffa[_0xa8a3('0x30')],_0x2beffa[_0xa8a3('0x78')]);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]][_0xa8a3('0x32')]=_0x2beffa[_0xa8a3('0x78')];}else if(this[_0xa8a3('0x2c')](_0x2beffa[_0xa8a3('0x76')][_0xa8a3('0x7c')])){logger[_0xa8a3('0x47')](_0xa8a3('0x7d'),_0x2beffa[_0xa8a3('0x30')],_0x2beffa[_0xa8a3('0x78')]);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]][_0xa8a3('0x7e')]=_0x2beffa['value'];}else if(this[_0xa8a3('0x2c')](_0x2beffa['variable'][_0xa8a3('0x7f')])){logger[_0xa8a3('0x47')](_0xa8a3('0x80'),_0x2beffa['uniqueid'],_0x2beffa[_0xa8a3('0x78')]);this['channels'][_0x2beffa[_0xa8a3('0x30')]][_0xa8a3('0x81')]=_0x2beffa[_0xa8a3('0x78')];}else if(this['isNotNull'](_0x2beffa[_0xa8a3('0x76')][_0xa8a3('0x82')])){logger['info'](_0xa8a3('0x83'),_0x2beffa[_0xa8a3('0x30')],_0x2beffa[_0xa8a3('0x78')]['split'](',')[0x0]);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]][_0xa8a3('0x55')]=_0x2beffa[_0xa8a3('0x78')][_0xa8a3('0x3c')](',')[0x0];}else if(this['isNotNull'](_0x2beffa[_0xa8a3('0x76')]['xmd-originatecalleridnum'])){logger[_0xa8a3('0x47')](_0xa8a3('0x84'),_0x2beffa[_0xa8a3('0x30')],_0x2beffa['value']);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]][_0xa8a3('0x85')]=_0x2beffa['value'];}else if(this[_0xa8a3('0x2c')](_0x2beffa[_0xa8a3('0x76')][_0xa8a3('0x86')])){logger['info'](_0xa8a3('0x87'),_0x2beffa[_0xa8a3('0x30')],_0x2beffa['value']);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]][_0xa8a3('0x88')]=_0x2beffa[_0xa8a3('0x78')];}else if(this[_0xa8a3('0x2c')](_0x2beffa['variable'][_0xa8a3('0x89')])){logger[_0xa8a3('0x47')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x2beffa[_0xa8a3('0x30')],_0x2beffa[_0xa8a3('0x78')]);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]]['calleridpreview']=_0x2beffa['value'];}else if(this[_0xa8a3('0x2c')](_0x2beffa[_0xa8a3('0x76')][_0xa8a3('0x8a')])){logger[_0xa8a3('0x47')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x2beffa[_0xa8a3('0x30')],_0x2beffa[_0xa8a3('0x78')]);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x30')]]['queue']=_0x2beffa['value'];}else if(this[_0xa8a3('0x2c')](_0x2beffa[_0xa8a3('0x76')][_0xa8a3('0x8b')])){logger[_0xa8a3('0x47')](_0xa8a3('0x8c'),_0x2beffa[_0xa8a3('0x30')],_0x2beffa['value']);this[_0xa8a3('0x37')][_0x2beffa['uniqueid']][_0xa8a3('0x8d')]=_0x2beffa[_0xa8a3('0x78')];}}}else if(this['isNotNull'](_0x2beffa['variable'][_0xa8a3('0x77')])){if(_0x2beffa[_0xa8a3('0x78')]){var _0x40a7de=path[_0xa8a3('0x8e')](_0x2beffa[_0xa8a3('0x78')])[_0xa8a3('0x4f')];logger[_0xa8a3('0x47')](_0xa8a3('0x8f'),_0x40a7de,_0x2beffa[_0xa8a3('0x78')]);this[_0xa8a3('0x79')](_0x40a7de,_0x2beffa['value']);}}else if(this[_0xa8a3('0x37')][_0x2beffa['linkedid']]){if(this['isNotNull'](_0x2beffa[_0xa8a3('0x76')])){if(this[_0xa8a3('0x2c')](_0x2beffa['variable'][_0xa8a3('0x8b')])){logger[_0xa8a3('0x47')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x2beffa[_0xa8a3('0x35')],_0x2beffa['value']);this[_0xa8a3('0x37')][_0x2beffa[_0xa8a3('0x35')]][_0xa8a3('0x90')]=_0x2beffa[_0xa8a3('0x78')];}}}}}catch(_0x32b980){logger[_0xa8a3('0x28')](_0xa8a3('0x91'),_0x2beffa[_0xa8a3('0x30')],util[_0xa8a3('0x2a')](_0x32b980,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa8a3('0x2b')]['syncHangup']=function(_0x2cfb00){try{if(this[_0xa8a3('0x2c')](_0x2cfb00)){logger[_0xa8a3('0x33')](_0xa8a3('0x92'),_0x2cfb00[_0xa8a3('0x30')],util[_0xa8a3('0x2a')](_0x2cfb00,{'showHidden':![],'depth':null}));if(this[_0xa8a3('0x46')][_0x2cfb00['linkedid']]){if(this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x35')]]){this['channels'][this['blindTransfers'][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x35')]][_0xa8a3('0x30')]=_0x2cfb00[_0xa8a3('0x30')];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]]['linkedid']]['answered']=this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x63')];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x35')]][_0xa8a3('0x64')]=this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x64')];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00['linkedid']][_0xa8a3('0x35')]][_0xa8a3('0x69')]=this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x35')]]['channel'];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x35')]][_0xa8a3('0x5a')]=this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x5a')];this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]]=this['channels'][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x35')]];this[_0xa8a3('0x93')](this[_0xa8a3('0x46')][_0x2cfb00['linkedid']][_0xa8a3('0x35')]);}else if(this['channels'][this['blindTransfers'][_0x2cfb00['linkedid']]['uniqueid']]){this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x30')]]['uniqueid']=[this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00['linkedid']][_0xa8a3('0x30')]][_0xa8a3('0x35')],this[_0xa8a3('0x37')][this['blindTransfers'][_0x2cfb00[_0xa8a3('0x35')]]['uniqueid']][_0xa8a3('0x35')]=this[_0xa8a3('0x37')][this['blindTransfers'][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x30')]]['uniqueid']][0x0];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x30')]][_0xa8a3('0x63')]=this['channels'][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x63')];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00['linkedid']][_0xa8a3('0x30')]]['answertime']=this['channels'][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x64')];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x30')]]['destinationchannel']=this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00['linkedid']][_0xa8a3('0x30')]][_0xa8a3('0x3b')];this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x30')]][_0xa8a3('0x5a')]=this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x5a')];this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]]=this[_0xa8a3('0x37')][this[_0xa8a3('0x46')][_0x2cfb00[_0xa8a3('0x35')]][_0xa8a3('0x30')]];this[_0xa8a3('0x93')](this[_0xa8a3('0x46')][_0x2cfb00['linkedid']][_0xa8a3('0x30')]);}}if(this['channels'][_0x2cfb00[_0xa8a3('0x30')]]){logger[_0xa8a3('0x47')](_0xa8a3('0x94'),_0x2cfb00[_0xa8a3('0x30')],_0x2cfb00['cause-txt']);var _0x39aabe=moment();this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x95')]=_0x39aabe[_0xa8a3('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x57')]=_0x39aabe[_0xa8a3('0x66')](this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]]['starttime'],'seconds');if(this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x63')]){this['channels'][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x96')]=_0x39aabe[_0xa8a3('0x66')](this[_0xa8a3('0x37')][_0x2cfb00['uniqueid']][_0xa8a3('0x64')],_0xa8a3('0x59'));this['channels'][_0x2cfb00[_0xa8a3('0x30')]]['holdtime']=this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x57')]-this[_0xa8a3('0x37')][_0x2cfb00[_0xa8a3('0x30')]][_0xa8a3('0x96')];}if(_0x2cfb00[_0xa8a3('0x3a')]===_0xa8a3('0x4d')){if(this['agents'][_0x2cfb00[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]]){this['agents'][_0x2cfb00[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]]=_[_0xa8a3('0x97')](this['agents'][_0x2cfb00[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]],[_0xa8a3('0x3d')]);logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x2cfb00[_0xa8a3('0x30')],util[_0xa8a3('0x2a')]({'id':this[_0xa8a3('0x16')][_0x2cfb00[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xa8a3('0x16')][_0x2cfb00[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]][_0xa8a3('0x42')]},{'showHidden':![],'depth':null}));this[_0xa8a3('0x2e')](util[_0xa8a3('0x3f')](_0xa8a3('0x40'),this[_0xa8a3('0x16')][_0x2cfb00[_0xa8a3('0x3b')]['split']('-')[0x0]][_0xa8a3('0x4f')]),_0xa8a3('0x98'),{'id':this[_0xa8a3('0x16')][_0x2cfb00[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xa8a3('0x16')][_0x2cfb00[_0xa8a3('0x3b')][_0xa8a3('0x3c')]('-')[0x0]][_0xa8a3('0x42')]});for(var _0x3c2265=0x0;_0x3c2265{delete this[_0xa8a3('0x37')][_0x2615fd];},_0x1fb287);}};module[_0xa8a3('0xcb')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index d60b16b..2e7fcea 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe715=['voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','isNotNull','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','isUndefined','variables','info','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','starttime','seconds','complete','total','answered','holdtime','diff','sumHoldTime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','applications','dialbegin','bind','dialend','syncDialEnd','varset','syncVarSet','syncHangup','prototype','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','merge'];(function(_0x197344,_0x2a19a5){var _0x45088d=function(_0x559f71){while(--_0x559f71){_0x197344['push'](_0x197344['shift']());}};_0x45088d(++_0x2a19a5);}(_0xe715,0x153));var _0x5e71=function(_0x40fdec,_0x3ca33b){_0x40fdec=_0x40fdec-0x0;var _0x2a047c=_0xe715[_0x40fdec];return _0x2a047c;};'use strict';var _=require(_0x5e71('0x0'));var moment=require('moment');var util=require(_0x5e71('0x1'));var Redis=require(_0x5e71('0x2'));var config=require(_0x5e71('0x3'));var logger=require(_0x5e71('0x4'))(_0x5e71('0x5'));var ami=require(_0x5e71('0x6'));config[_0x5e71('0x7')]=_[_0x5e71('0x8')](config[_0x5e71('0x7')],{'host':_0x5e71('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x2f7eeb){this[_0x5e71('0xa')]=_0x2f7eeb[_0x5e71('0xb')];this['outbound']=_0x2f7eeb[_0x5e71('0xc')];this[_0x5e71('0xd')]={};this['variables']={};ami['on'](_0x5e71('0xe'),this['syncDialBegin'][_0x5e71('0xf')](this));ami['on'](_0x5e71('0x10'),this[_0x5e71('0x11')][_0x5e71('0xf')](this));ami['on'](_0x5e71('0x12'),this[_0x5e71('0x13')][_0x5e71('0xf')](this));ami['on']('hangup',this[_0x5e71('0x14')][_0x5e71('0xf')](this));}VoiceDialReport[_0x5e71('0x15')]['isNotNull']=function(_0x2195f1){return _0x2195f1!==null&&!_['isUndefined'](_0x2195f1);};VoiceDialReport[_0x5e71('0x15')]['emit']=function(_0x4f9a5f,_0x4edda2,_0x6ab9be){io['to'](_0x4f9a5f)[_0x5e71('0x16')](_0x4edda2,_0x6ab9be);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x2c6466){try{if(this['isNotNull'](_0x2c6466)){logger['debug'](_0x5e71('0x17'),_0x2c6466[_0x5e71('0x18')],util['inspect'](_0x2c6466,{'showHidden':![],'depth':null}));if(this['channels'][_0x2c6466[_0x5e71('0x18')]]){_['merge'](this[_0x5e71('0xa')][_0x2c6466['uniqueid']],{'starttime':moment()[_0x5e71('0x19')](_0x5e71('0x1a')),'lastevent':'called','interface':_0x2c6466[_0x5e71('0x1b')]['substring'](0x0,_0x2c6466[_0x5e71('0x1b')]['lastIndexOf']('-')),'membername':_0x2c6466[_0x5e71('0x1b')][_0x5e71('0x1c')](_0x2c6466[_0x5e71('0x1b')][_0x5e71('0x1d')]('/')+0x1,_0x2c6466[_0x5e71('0x1b')][_0x5e71('0x1d')]('-'))},_[_0x5e71('0x1e')](_0x2c6466,[_0x5e71('0x1f'),_0x5e71('0x20')]));logger['info'](_0x5e71('0x21'),_0x2c6466[_0x5e71('0x18')],this['channels'][_0x2c6466['uniqueid']]['membername'],this[_0x5e71('0xa')][_0x2c6466['uniqueid']][_0x5e71('0x22')]);logger[_0x5e71('0x23')](_0x5e71('0x24'),_0x2c6466[_0x5e71('0x18')],util[_0x5e71('0x25')](this[_0x5e71('0xa')][_0x2c6466['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x5e71('0xd')][_0x2c6466[_0x5e71('0x18')]])_[_0x5e71('0x26')](this['channels'][_0x2c6466['uniqueid']],this['applications'][_0x2c6466[_0x5e71('0x18')]]);this[_0x5e71('0x16')]('voice:outbound',_0x5e71('0x27'),this[_0x5e71('0xa')][_0x2c6466[_0x5e71('0x18')]]);logger[_0x5e71('0x23')](_0x5e71('0x28'),_0x2c6466['uniqueid'],util[_0x5e71('0x25')](this[_0x5e71('0xa')][_0x2c6466[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));ami[_0x5e71('0x16')](_0x5e71('0x29'),this[_0x5e71('0xa')][_0x2c6466[_0x5e71('0x18')]]);}}}catch(_0x2dd4df){logger[_0x5e71('0x2a')](_0x5e71('0x2b'),_0x2c6466['uniqueid'],util[_0x5e71('0x25')](_0x2dd4df,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5e71('0x15')][_0x5e71('0x11')]=function(_0x1b787c){try{if(this['isNotNull'](_0x1b787c)){logger[_0x5e71('0x23')](_0x5e71('0x2c'),_0x1b787c['uniqueid'],util['inspect'](_0x1b787c,{'showHidden':![],'depth':null}));if(this[_0x5e71('0xa')][_0x1b787c[_0x5e71('0x18')]]){this[_0x5e71('0xa')][_0x1b787c['uniqueid']]['dialstatus']=_0x1b787c[_0x5e71('0x2d')];if(_0x1b787c[_0x5e71('0x2d')]===_0x5e71('0x2e')){this[_0x5e71('0xa')][_0x1b787c[_0x5e71('0x18')]]['connectedlinenum']=_0x1b787c[_0x5e71('0x2f')];this['channels'][_0x1b787c['uniqueid']]['connectedlinename']=_0x1b787c['connectedlinename'];this['channels'][_0x1b787c[_0x5e71('0x18')]][_0x5e71('0x30')]=moment()['format'](_0x5e71('0x1a'));this[_0x5e71('0xa')][_0x1b787c[_0x5e71('0x18')]][_0x5e71('0x31')]=_0x5e71('0x32');logger['info'](_0x5e71('0x33'),_0x1b787c[_0x5e71('0x18')],_0x1b787c[_0x5e71('0x1b')][_0x5e71('0x1c')](_0x1b787c[_0x5e71('0x1b')][_0x5e71('0x1d')]('/')+0x1,_0x1b787c[_0x5e71('0x1b')][_0x5e71('0x1d')]('-')));logger[_0x5e71('0x23')](_0x5e71('0x34'),_0x1b787c[_0x5e71('0x18')],util[_0x5e71('0x25')](this['channels'][_0x1b787c[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));ami[_0x5e71('0x16')](_0x5e71('0x35'),this[_0x5e71('0xa')][_0x1b787c[_0x5e71('0x18')]]);}logger[_0x5e71('0x23')](_0x5e71('0x36'),_0x1b787c[_0x5e71('0x18')],util['inspect'](this['channels'][_0x1b787c[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x5e71('0x27'),this[_0x5e71('0xa')][_0x1b787c[_0x5e71('0x18')]]);}}}catch(_0x262fbe){logger['error']('[%s][voiceDialReport][dialend]',_0x1b787c[_0x5e71('0x18')],util[_0x5e71('0x25')](_0x262fbe,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5e71('0x15')][_0x5e71('0x13')]=function(_0x21a859){try{if(this[_0x5e71('0x37')](_0x21a859)){logger[_0x5e71('0x23')](_0x5e71('0x38'),_0x21a859[_0x5e71('0x18')],util[_0x5e71('0x25')](_0x21a859,{'showHidden':![],'depth':null}));this[_0x5e71('0x39')](_0x21a859[_0x5e71('0x18')],_[_0x5e71('0x3a')](_0x21a859[_0x5e71('0x3b')])[0x0],_0x21a859[_0x5e71('0x3c')]);if(this['isNotNull'](_0x21a859[_0x5e71('0x3b')])&&this[_0x5e71('0x37')](_0x21a859[_0x5e71('0x3b')][_0x5e71('0x3d')])){if(_[_0x5e71('0x3e')](this[_0x5e71('0xa')][_0x21a859[_0x5e71('0x18')]])){this[_0x5e71('0xa')][_0x21a859[_0x5e71('0x18')]]={'routeId':_0x21a859[_0x5e71('0x3c')],'variables':this[_0x5e71('0x3f')][_0x21a859['uniqueid']],'motionChannel':'voice'};logger[_0x5e71('0x40')](_0x5e71('0x41'),_0x21a859[_0x5e71('0x18')],_0x21a859[_0x5e71('0x3b')][_0x5e71('0x3d')],_['keys'](_0x21a859['variable'])[0x0],_0x21a859[_0x5e71('0x3c')]);logger[_0x5e71('0x23')](_0x5e71('0x42'),_0x21a859[_0x5e71('0x18')],util[_0x5e71('0x25')](this[_0x5e71('0xa')][_0x21a859[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));this[_0x5e71('0x16')](_0x5e71('0x43'),'voice_outbound_channel:save',this[_0x5e71('0xa')][_0x21a859[_0x5e71('0x18')]]);}}}}catch(_0x5b6400){logger[_0x5e71('0x2a')](_0x5e71('0x44'),_0x21a859['uniqueid'],util['inspect'](_0x5b6400,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5e71('0x15')]['addVariable']=function(_0x20cf06,_0xa9595f,_0x807aeb){var _0x5e4a61=[_0x5e71('0x45'),_0x5e71('0x46'),_0x5e71('0x47'),_0x5e71('0x48'),_0x5e71('0x49'),_0x5e71('0x4a'),_0x5e71('0x4b'),_0x5e71('0x4c'),_0x5e71('0x4d'),_0x5e71('0x4e'),_0x5e71('0x4f'),_0x5e71('0x50'),_0x5e71('0x51'),_0x5e71('0x52'),_0x5e71('0x53'),_0x5e71('0x54'),_0x5e71('0x55'),_0x5e71('0x56'),_0x5e71('0x57')];if(!_[_0x5e71('0x58')](_0xa9595f)&&!_[_0x5e71('0x59')](_0x5e4a61,_0xa9595f)){if(_[_0x5e71('0x3e')](this['variables'][_0x20cf06])){this['variables'][_0x20cf06]={};}this[_0x5e71('0x3f')][_0x20cf06][_0xa9595f]=_0x807aeb;}};VoiceDialReport[_0x5e71('0x15')]['syncHangup']=function(_0xfe9fdc){try{if(this[_0x5e71('0x37')](_0xfe9fdc)){logger[_0x5e71('0x23')]('[%s][voiceDialReport][hangup]\x20event:',_0xfe9fdc['uniqueid'],util[_0x5e71('0x25')](_0xfe9fdc,{'showHidden':![],'depth':null}));if(this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]]){logger[_0x5e71('0x40')](_0x5e71('0x5a'),_0xfe9fdc[_0x5e71('0x18')],_0xfe9fdc['cause-txt']);this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x5b')]=moment()['format'](_0x5e71('0x1a'));this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x5c')]=moment(this[_0x5e71('0xa')][_0xfe9fdc['uniqueid']][_0x5e71('0x5b')])['diff'](this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x5d')],_0x5e71('0x5e'));this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x31')]=_0x5e71('0x5f');this[_0x5e71('0xc')][_0x5e71('0x60')]+=0x1;if(this[_0x5e71('0xa')][_0xfe9fdc['uniqueid']][_0x5e71('0x30')]){this['outbound'][_0x5e71('0x61')]+=0x1;this['channels'][_0xfe9fdc['uniqueid']][_0x5e71('0x62')]=moment(this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x30')])[_0x5e71('0x63')](this['channels'][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x5d')],_0x5e71('0x5e'));this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]]['billableseconds']=moment(this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x5b')])['diff'](this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x30')],_0x5e71('0x5e'));this[_0x5e71('0xc')][_0x5e71('0x64')]+=this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x62')]||0x0;this[_0x5e71('0xc')][_0x5e71('0x65')]+=this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]][_0x5e71('0x66')];}this[_0x5e71('0xc')][_0x5e71('0x67')]+=this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]]['duration'];logger[_0x5e71('0x23')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0xfe9fdc[_0x5e71('0x18')],util[_0x5e71('0x25')](this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));ami[_0x5e71('0x16')]('custom:voiceDialReport',this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]]);logger['debug'](_0x5e71('0x68'),_0xfe9fdc[_0x5e71('0x18')],util[_0x5e71('0x25')](this['channels'][_0xfe9fdc[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialend',this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]]);logger['debug'](_0x5e71('0x69'),_0xfe9fdc['uniqueid'],util['inspect'](this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));this[_0x5e71('0x16')](_0x5e71('0x43'),_0x5e71('0x6a'),this[_0x5e71('0xc')]);logger[_0x5e71('0x40')](_0x5e71('0x6b'),JSON[_0x5e71('0x6c')](this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x18')]]));logger[_0x5e71('0x23')](_0x5e71('0x6d'),_0xfe9fdc[_0x5e71('0x18')],util[_0x5e71('0x25')](this['channels'][_0xfe9fdc[_0x5e71('0x18')]],{'showHidden':![],'depth':null}));this[_0x5e71('0x16')]('voice:outbound',_0x5e71('0x6e'),this[_0x5e71('0xa')][_0xfe9fdc['uniqueid']]);this[_0x5e71('0x6f')](_0xfe9fdc[_0x5e71('0x18')]);}else if(this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x70')]]){this[_0x5e71('0xa')][_0xfe9fdc[_0x5e71('0x70')]][_0x5e71('0x18')]=this['channels'][_0xfe9fdc[_0x5e71('0x70')]][_0x5e71('0x71')];}if(this[_0x5e71('0x3f')][_0xfe9fdc[_0x5e71('0x18')]]){delete this['variables'][_0xfe9fdc[_0x5e71('0x18')]];}}}catch(_0x412e78){logger[_0x5e71('0x2a')](_0x5e71('0x72'),_0xfe9fdc['uniqueid'],util[_0x5e71('0x25')](_0x412e78,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncNewExten']=function(_0x55c7e8){try{if(this[_0x5e71('0x37')](_0x55c7e8)){logger[_0x5e71('0x23')](_0x5e71('0x73'),_0x55c7e8['uniqueid'],util[_0x5e71('0x25')](_0x55c7e8,{'showHidden':![],'depth':null}));if(_0x55c7e8[_0x5e71('0x74')][_0x5e71('0x75')]()===_0x5e71('0x76')){_0x55c7e8[_0x5e71('0x77')]=(_0x55c7e8[_0x5e71('0x78')]||_0x55c7e8[_0x5e71('0x77')])['toLowerCase']();if(_[_0x5e71('0x79')](_0x55c7e8['applicationdata'],_0x5e71('0x7a'))){if(_['isUndefined'](this[_0x5e71('0xd')][_0x55c7e8['uniqueid']]))this[_0x5e71('0xd')][_0x55c7e8[_0x5e71('0x18')]]={};logger[_0x5e71('0x40')](_0x5e71('0x7b'),_0x55c7e8[_0x5e71('0x18')],_0x55c7e8[_0x5e71('0x74')],_0x55c7e8[_0x5e71('0x77')]);var _0x32bfea=_0x55c7e8[_0x5e71('0x77')][_0x5e71('0x7c')]('=');var _0x437f41=_0x32bfea[0x0]['match'](/cdr\((.*)\)/);if(_0x437f41)this['applications'][_0x55c7e8[_0x5e71('0x18')]][_0x437f41[0x1]]=_0x32bfea[0x1];}}}}catch(_0x264a4c){logger[_0x5e71('0x2a')]('[%s][voiceDialReport][newexten]',_0x55c7e8[_0x5e71('0x18')],util[_0x5e71('0x25')](_0x264a4c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5e71('0x15')][_0x5e71('0x6f')]=function(_0x592bb5,_0x17c093=0x2710){if(this[_0x5e71('0xa')][_0x592bb5]){setTimeout(()=>{delete this[_0x5e71('0xa')][_0x592bb5];},_0x17c093);}};module[_0x5e71('0x7d')]=VoiceDialReport; \ No newline at end of file +var _0x0360=['[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','keys','variable','outboundrouteid','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','starttime','total','answered','holdtime','diff','seconds','sumHoldTime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','match','exports','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','bind','dialend','syncDialEnd','varset','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','substring'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0360,0xae));var _0x0036=function(_0x5e6676,_0x219aa4){_0x5e6676=_0x5e6676-0x0;var _0x26199b=_0x0360[_0x5e6676];return _0x26199b;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var Redis=require(_0x0036('0x0'));var config=require(_0x0036('0x1'));var logger=require(_0x0036('0x2'))(_0x0036('0x3'));var ami=require('../ami');config[_0x0036('0x4')]=_[_0x0036('0x5')](config[_0x0036('0x4')],{'host':_0x0036('0x6'),'port':0x18eb});var io=require(_0x0036('0x7'))(new Redis(config[_0x0036('0x4')]));function VoiceDialReport(_0x29e43a){this[_0x0036('0x8')]=_0x29e43a[_0x0036('0x9')];this[_0x0036('0xa')]=_0x29e43a[_0x0036('0xa')];this[_0x0036('0xb')]={};this[_0x0036('0xc')]={};ami['on']('dialbegin',this['syncDialBegin'][_0x0036('0xd')](this));ami['on'](_0x0036('0xe'),this[_0x0036('0xf')]['bind'](this));ami['on'](_0x0036('0x10'),this['syncVarSet'][_0x0036('0xd')](this));ami['on'](_0x0036('0x11'),this[_0x0036('0x12')][_0x0036('0xd')](this));}VoiceDialReport[_0x0036('0x13')][_0x0036('0x14')]=function(_0x66f9ac){return _0x66f9ac!==null&&!_[_0x0036('0x15')](_0x66f9ac);};VoiceDialReport['prototype'][_0x0036('0x16')]=function(_0x1ddd1e,_0xf6a60e,_0x145faa){io['to'](_0x1ddd1e)[_0x0036('0x16')](_0xf6a60e,_0x145faa);};VoiceDialReport[_0x0036('0x13')]['syncDialBegin']=function(_0x4e4eba){try{if(this[_0x0036('0x14')](_0x4e4eba)){logger[_0x0036('0x17')](_0x0036('0x18'),_0x4e4eba[_0x0036('0x19')],util[_0x0036('0x1a')](_0x4e4eba,{'showHidden':![],'depth':null}));if(this[_0x0036('0x8')][_0x4e4eba[_0x0036('0x19')]]){_[_0x0036('0x1b')](this['channels'][_0x4e4eba[_0x0036('0x19')]],{'starttime':moment()[_0x0036('0x1c')](_0x0036('0x1d')),'lastevent':_0x0036('0x1e'),'interface':_0x4e4eba['channel']['substring'](0x0,_0x4e4eba[_0x0036('0x1f')][_0x0036('0x20')]('-')),'membername':_0x4e4eba[_0x0036('0x1f')]['substring'](_0x4e4eba['channel'][_0x0036('0x20')]('/')+0x1,_0x4e4eba[_0x0036('0x1f')][_0x0036('0x20')]('-'))},_[_0x0036('0x21')](_0x4e4eba,[_0x0036('0x22'),_0x0036('0x23')]));logger[_0x0036('0x24')](_0x0036('0x25'),_0x4e4eba['uniqueid'],this[_0x0036('0x8')][_0x4e4eba['uniqueid']][_0x0036('0x26')],this['channels'][_0x4e4eba[_0x0036('0x19')]]['interface']);logger[_0x0036('0x17')](_0x0036('0x27'),_0x4e4eba[_0x0036('0x19')],util[_0x0036('0x1a')](this[_0x0036('0x8')][_0x4e4eba['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x0036('0xb')][_0x4e4eba[_0x0036('0x19')]])_['merge'](this[_0x0036('0x8')][_0x4e4eba[_0x0036('0x19')]],this[_0x0036('0xb')][_0x4e4eba[_0x0036('0x19')]]);this[_0x0036('0x16')](_0x0036('0x28'),_0x0036('0x29'),this[_0x0036('0x8')][_0x4e4eba[_0x0036('0x19')]]);logger[_0x0036('0x17')](_0x0036('0x2a'),_0x4e4eba[_0x0036('0x19')],util[_0x0036('0x1a')](this['channels'][_0x4e4eba[_0x0036('0x19')]],{'showHidden':![],'depth':null}));ami[_0x0036('0x16')](_0x0036('0x2b'),this[_0x0036('0x8')][_0x4e4eba['uniqueid']]);}}}catch(_0x36b9c3){logger[_0x0036('0x2c')](_0x0036('0x2d'),_0x4e4eba[_0x0036('0x19')],util[_0x0036('0x1a')](_0x36b9c3,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0036('0xf')]=function(_0x7ddd10){try{if(this[_0x0036('0x14')](_0x7ddd10)){logger[_0x0036('0x17')](_0x0036('0x2e'),_0x7ddd10[_0x0036('0x19')],util[_0x0036('0x1a')](_0x7ddd10,{'showHidden':![],'depth':null}));if(this[_0x0036('0x8')][_0x7ddd10[_0x0036('0x19')]]){this['channels'][_0x7ddd10['uniqueid']][_0x0036('0x2f')]=_0x7ddd10[_0x0036('0x2f')];if(_0x7ddd10[_0x0036('0x2f')]==='ANSWER'){this[_0x0036('0x8')][_0x7ddd10[_0x0036('0x19')]][_0x0036('0x30')]=_0x7ddd10[_0x0036('0x30')];this[_0x0036('0x8')][_0x7ddd10[_0x0036('0x19')]]['connectedlinename']=_0x7ddd10['connectedlinename'];this[_0x0036('0x8')][_0x7ddd10[_0x0036('0x19')]][_0x0036('0x31')]=moment()[_0x0036('0x1c')](_0x0036('0x1d'));this[_0x0036('0x8')][_0x7ddd10[_0x0036('0x19')]][_0x0036('0x32')]=_0x0036('0x33');logger['info'](_0x0036('0x34'),_0x7ddd10[_0x0036('0x19')],_0x7ddd10[_0x0036('0x1f')][_0x0036('0x35')](_0x7ddd10[_0x0036('0x1f')][_0x0036('0x20')]('/')+0x1,_0x7ddd10[_0x0036('0x1f')][_0x0036('0x20')]('-')));logger[_0x0036('0x17')](_0x0036('0x36'),_0x7ddd10[_0x0036('0x19')],util['inspect'](this[_0x0036('0x8')][_0x7ddd10['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:dialconnect',this[_0x0036('0x8')][_0x7ddd10[_0x0036('0x19')]]);}logger[_0x0036('0x17')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x7ddd10[_0x0036('0x19')],util[_0x0036('0x1a')](this[_0x0036('0x8')][_0x7ddd10[_0x0036('0x19')]],{'showHidden':![],'depth':null}));this[_0x0036('0x16')]('voice:outbound',_0x0036('0x29'),this['channels'][_0x7ddd10[_0x0036('0x19')]]);}}}catch(_0x93b04f){logger[_0x0036('0x2c')](_0x0036('0x37'),_0x7ddd10[_0x0036('0x19')],util[_0x0036('0x1a')](_0x93b04f,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0036('0x38')]=function(_0x26f47b){try{if(this[_0x0036('0x14')](_0x26f47b)){logger['debug'](_0x0036('0x39'),_0x26f47b[_0x0036('0x19')],util[_0x0036('0x1a')](_0x26f47b,{'showHidden':![],'depth':null}));this['addVariable'](_0x26f47b['uniqueid'],_[_0x0036('0x3a')](_0x26f47b['variable'])[0x0],_0x26f47b['value']);if(this[_0x0036('0x14')](_0x26f47b['variable'])&&this[_0x0036('0x14')](_0x26f47b[_0x0036('0x3b')][_0x0036('0x3c')])){if(_[_0x0036('0x15')](this['channels'][_0x26f47b['uniqueid']])){this[_0x0036('0x8')][_0x26f47b[_0x0036('0x19')]]={'routeId':_0x26f47b[_0x0036('0x3d')],'variables':this['variables'][_0x26f47b[_0x0036('0x19')]],'motionChannel':_0x0036('0x3e')};logger['info'](_0x0036('0x3f'),_0x26f47b[_0x0036('0x19')],_0x26f47b[_0x0036('0x3b')][_0x0036('0x3c')],_['keys'](_0x26f47b['variable'])[0x0],_0x26f47b['value']);logger['debug'](_0x0036('0x40'),_0x26f47b[_0x0036('0x19')],util[_0x0036('0x1a')](this[_0x0036('0x8')][_0x26f47b[_0x0036('0x19')]],{'showHidden':![],'depth':null}));this['emit'](_0x0036('0x28'),_0x0036('0x29'),this[_0x0036('0x8')][_0x26f47b[_0x0036('0x19')]]);}}}}catch(_0x2afae1){logger['error']('[%s][voiceDialReport][varset]',_0x26f47b[_0x0036('0x19')],util[_0x0036('0x1a')](_0x2afae1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0036('0x13')][_0x0036('0x41')]=function(_0x3861df,_0x465830,_0x213a09){var _0x1d99c1=[_0x0036('0x42'),_0x0036('0x43'),_0x0036('0x44'),'rtpaudioqosjitterbridged',_0x0036('0x45'),_0x0036('0x46'),_0x0036('0x47'),_0x0036('0x48'),_0x0036('0x49'),'sipuri','bridgepeer',_0x0036('0x4a'),_0x0036('0x4b'),_0x0036('0x4c'),_0x0036('0x4d'),'memberlastcall',_0x0036('0x26'),_0x0036('0x4e'),_0x0036('0x4f')];if(!_[_0x0036('0x50')](_0x465830)&&!_['includes'](_0x1d99c1,_0x465830)){if(_[_0x0036('0x15')](this['variables'][_0x3861df])){this[_0x0036('0xc')][_0x3861df]={};}this[_0x0036('0xc')][_0x3861df][_0x465830]=_0x213a09;}};VoiceDialReport[_0x0036('0x13')][_0x0036('0x12')]=function(_0x3a3c6e){try{if(this[_0x0036('0x14')](_0x3a3c6e)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x3a3c6e[_0x0036('0x19')],util[_0x0036('0x1a')](_0x3a3c6e,{'showHidden':![],'depth':null}));if(this[_0x0036('0x8')][_0x3a3c6e['uniqueid']]){logger[_0x0036('0x24')](_0x0036('0x51'),_0x3a3c6e['uniqueid'],_0x3a3c6e['cause-txt']);this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x52')]=moment()[_0x0036('0x1c')](_0x0036('0x1d'));this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x53')]=moment(this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x52')])['diff'](this['channels'][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x54')],'seconds');this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x32')]='complete';this[_0x0036('0xa')][_0x0036('0x55')]+=0x1;if(this['channels'][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x31')]){this[_0x0036('0xa')][_0x0036('0x56')]+=0x1;this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x57')]=moment(this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]]['answertime'])[_0x0036('0x58')](this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x54')],_0x0036('0x59'));this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]]['billableseconds']=moment(this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x52')])[_0x0036('0x58')](this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x31')],_0x0036('0x59'));this[_0x0036('0xa')][_0x0036('0x5a')]+=this['channels'][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x57')]||0x0;this[_0x0036('0xa')][_0x0036('0x5b')]+=this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]][_0x0036('0x5c')];}this[_0x0036('0xa')][_0x0036('0x5d')]+=this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]]['duration'];logger[_0x0036('0x17')](_0x0036('0x5e'),_0x3a3c6e['uniqueid'],util[_0x0036('0x1a')](this['channels'][_0x3a3c6e[_0x0036('0x19')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceDialReport',this['channels'][_0x3a3c6e[_0x0036('0x19')]]);logger[_0x0036('0x17')](_0x0036('0x5f'),_0x3a3c6e[_0x0036('0x19')],util[_0x0036('0x1a')](this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0036('0x60'),this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]]);logger[_0x0036('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x3a3c6e[_0x0036('0x19')],util[_0x0036('0x1a')](this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x0036('0x61'),this[_0x0036('0xa')]);logger[_0x0036('0x24')](_0x0036('0x62'),JSON[_0x0036('0x63')](this['channels'][_0x3a3c6e['uniqueid']]));logger[_0x0036('0x17')](_0x0036('0x64'),_0x3a3c6e[_0x0036('0x19')],util['inspect'](this[_0x0036('0x8')][_0x3a3c6e[_0x0036('0x19')]],{'showHidden':![],'depth':null}));this['emit'](_0x0036('0x28'),_0x0036('0x65'),this['channels'][_0x3a3c6e['uniqueid']]);this[_0x0036('0x66')](_0x3a3c6e[_0x0036('0x19')]);}else if(this['channels'][_0x3a3c6e['linkedid']]){this['channels'][_0x3a3c6e[_0x0036('0x67')]][_0x0036('0x19')]=this['channels'][_0x3a3c6e[_0x0036('0x67')]][_0x0036('0x68')];}if(this['variables'][_0x3a3c6e['uniqueid']]){delete this[_0x0036('0xc')][_0x3a3c6e[_0x0036('0x19')]];}}}catch(_0x4de4dd){logger[_0x0036('0x2c')](_0x0036('0x69'),_0x3a3c6e[_0x0036('0x19')],util[_0x0036('0x1a')](_0x4de4dd,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0036('0x13')][_0x0036('0x6a')]=function(_0x2c71fa){try{if(this[_0x0036('0x14')](_0x2c71fa)){logger[_0x0036('0x17')](_0x0036('0x6b'),_0x2c71fa[_0x0036('0x19')],util[_0x0036('0x1a')](_0x2c71fa,{'showHidden':![],'depth':null}));if(_0x2c71fa[_0x0036('0x6c')][_0x0036('0x6d')]()===_0x0036('0x6e')){_0x2c71fa['applicationdata']=(_0x2c71fa['appdata']||_0x2c71fa[_0x0036('0x6f')])['toLowerCase']();if(_['startsWith'](_0x2c71fa[_0x0036('0x6f')],'cdr(')){if(_['isUndefined'](this['applications'][_0x2c71fa[_0x0036('0x19')]]))this[_0x0036('0xb')][_0x2c71fa['uniqueid']]={};logger[_0x0036('0x24')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x2c71fa[_0x0036('0x19')],_0x2c71fa[_0x0036('0x6c')],_0x2c71fa[_0x0036('0x6f')]);var _0x410570=_0x2c71fa['applicationdata']['split']('=');var _0x487084=_0x410570[0x0][_0x0036('0x70')](/cdr\((.*)\)/);if(_0x487084)this['applications'][_0x2c71fa['uniqueid']][_0x487084[0x1]]=_0x410570[0x1];}}}}catch(_0x486dbb){logger[_0x0036('0x2c')]('[%s][voiceDialReport][newexten]',_0x2c71fa[_0x0036('0x19')],util[_0x0036('0x1a')](_0x486dbb,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0036('0x66')]=function(_0x5b2b88,_0x367e4f=0x2710){if(this[_0x0036('0x8')][_0x5b2b88]){setTimeout(()=>{delete this['channels'][_0x5b2b88];},_0x367e4f);}};module[_0x0036('0x71')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 8b53d01..47c41ba 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b66=['queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','waiting','queueStatusComplete','queuecallerexit','queuecallercomplete','switch','enqueue','isNil','Action','status','channel','message','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','error','[%s][voiceQueueReport][checkQueueReport]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','agents','summary','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save','emitVoiceQueueChannelRemove','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','queues','catch','[voiceQueueReport][queues]','loopQueueSummary','isRunning','then','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','handleInboundQueueSummaryReport','assign','queuestatus','inbound','type','outbound','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','uniqueid','queuecallerjoinAt','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','syncAgentConnect','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','linkedid','FORWARD','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','addVariable','variable','value','CONTINUE','TIMEOUT','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','membername','memberpenalty','memberrealtime','includes','handleHangup','length','diff','sumDuration','milliseconds','total','answered','sumBillable','unmanaged','lastevent','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][hangup]','cause-txt','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertype','ATTENDED','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohtime','seconds','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][newexten]\x20event:','application','set','appdata','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','tail','sequence','realtime','channels','queueChannels','voiceQueues','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b66,0xd7));var _0x69b6=function(_0x47e4e9,_0x2f772a){_0x47e4e9=_0x47e4e9-0x0;var _0x492ed4=_0x9b66[_0x47e4e9];return _0x492ed4;};'use strict';var _=require(_0x69b6('0x0'));var moment=require(_0x69b6('0x1'));var util=require(_0x69b6('0x2'));var Redis=require(_0x69b6('0x3'));var config=require(_0x69b6('0x4'));var logger=require(_0x69b6('0x5'))(_0x69b6('0x6'));var ami=require(_0x69b6('0x7'));var QueueReport=require(_0x69b6('0x8'));var VoiceQueueSummary=require(_0x69b6('0x9'));config[_0x69b6('0xa')]=_[_0x69b6('0xb')](config[_0x69b6('0xa')],{'host':_0x69b6('0xc'),'port':0x18eb});var io=require(_0x69b6('0xd'))(new Redis(config[_0x69b6('0xa')]));var Sequence=function(){};Sequence[_0x69b6('0xe')]['enqueue']=function(_0x54294c){this[_0x69b6('0xf')]=this[_0x69b6('0xf')]?this[_0x69b6('0xf')]['finally'](_0x54294c):_0x54294c();};function VoiceQueueReport(_0x5110ad){this[_0x69b6('0x10')]=new Sequence();this['queueReports']={};this[_0x69b6('0x11')]=_0x5110ad;this['agents']=_0x5110ad['agents'];this[_0x69b6('0x12')]=_0x5110ad[_0x69b6('0x13')];this[_0x69b6('0x14')]=_0x5110ad[_0x69b6('0x14')];this[_0x69b6('0x15')]=_0x5110ad[_0x69b6('0x15')];this['summary']=initializeSummary();this[_0x69b6('0x16')]={};ami['on'](_0x69b6('0x17'),this[_0x69b6('0x18')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x1a'),this[_0x69b6('0x1b')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x1c'),this[_0x69b6('0x1d')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x1e'),this[_0x69b6('0x1f')]['bind'](this));ami['on'](_0x69b6('0x20'),this[_0x69b6('0x21')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x22'),this['syncQueueCallerAbandon'][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x23'),this[_0x69b6('0x24')]['bind'](this));ami['on'](_0x69b6('0x25'),this['syncAgentComplete'][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x26'),this['syncAgentConnect'][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x27'),this[_0x69b6('0x28')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x29'),this[_0x69b6('0x2a')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x2b'),this[_0x69b6('0x2c')][_0x69b6('0x19')](this));ami['on']('musiconholdstart',this[_0x69b6('0x2d')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x2e'),this[_0x69b6('0x2f')][_0x69b6('0x19')](this));ami['on'](_0x69b6('0x30'),this[_0x69b6('0x31')][_0x69b6('0x19')](this));ami['on']('blindtransfer',this[_0x69b6('0x32')][_0x69b6('0x19')](this));this['loopQueueSummary']();this[_0x69b6('0x33')]();}function clearChannels(_0x2696d1){if(!_[_0x69b6('0x34')](_0x2696d1)){for(var _0xf54fea in _0x2696d1){if(_0x2696d1[_0x69b6('0x35')](_0xf54fea)){delete _0x2696d1[_0xf54fea];}}}}function clearCampaigns(_0x652796){if(!_['isEmpty'](_0x652796)){for(var _0x312ed0 in _0x652796){if(_0x652796[_0x69b6('0x35')](_0x312ed0)){_0x652796[_0x312ed0]['originated']=0x0;}}}}function clearVoiceQueues(_0x2a5f4c){if(!_[_0x69b6('0x34')](_0x2a5f4c)){for(var _0x206c1e in _0x2a5f4c){if(_0x2a5f4c[_0x69b6('0x35')](_0x206c1e)){_0x2a5f4c[_0x206c1e][_0x69b6('0x36')]=0x0;_0x2a5f4c[_0x206c1e][_0x69b6('0x37')]=0x0;_0x2a5f4c[_0x206c1e]['pTalking']=0x0;_0x2a5f4c[_0x206c1e][_0x69b6('0x38')]=0x0;_0x2a5f4c[_0x206c1e][_0x69b6('0x39')]=!![];}}}}function clearAgentBooked(_0x44ee5d){if(!_[_0x69b6('0x34')](_0x44ee5d)){for(var _0x134c9e in _0x44ee5d){if(_0x44ee5d[_0x69b6('0x35')](_0x134c9e)){_0x44ee5d[_0x134c9e]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x5d31bd){return _0x5d31bd[_0x69b6('0x3a')]||_0x5d31bd[_0x69b6('0x22')]||_0x5d31bd[_0x69b6('0x3b')];}VoiceQueueReport['prototype']['clearZombieChannels']=function(){var _0x4e2588=this;for(var _0x55edd2 in this[_0x69b6('0x12')]){if(this[_0x69b6('0x12')][_0x69b6('0x35')](_0x55edd2)&&!this[_0x69b6('0x12')][_0x55edd2][_0x69b6('0x3c')]){this[_0x69b6('0x10')][_0x69b6('0x3d')](function(){if(!_[_0x69b6('0x3e')](_0x4e2588[_0x69b6('0x12')][_0x55edd2])){return ami[_0x69b6('0x3f')]({'action':_0x69b6('0x40'),'channel':_0x4e2588[_0x69b6('0x12')][_0x55edd2][_0x69b6('0x41')]})['catch'](function(_0x52b9e5){if(_0x52b9e5[_0x69b6('0x42')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4e2588[_0x69b6('0x12')][_0x55edd2]){delete _0x4e2588[_0x69b6('0x12')][_0x55edd2];logger['error'](_0x69b6('0x43'),_0x55edd2,util[_0x69b6('0x44')](_0x52b9e5,{'showHidden':![],'depth':null}));}if(_0x4e2588['queueReports'][_0x55edd2]){delete _0x4e2588[_0x69b6('0x45')][_0x55edd2];logger[_0x69b6('0x46')](_0x69b6('0x47'),_0x55edd2,util[_0x69b6('0x44')](_0x52b9e5,{'showHidden':![],'depth':null}));}if(_0x4e2588[_0x69b6('0x16')][_0x55edd2]){delete _0x4e2588['variables'][_0x55edd2];logger[_0x69b6('0x46')]('[%s][voiceQueueReport][checkVariables]',_0x55edd2,util[_0x69b6('0x44')](_0x52b9e5,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x69b6('0xe')]['syncFullyBooted']=function(){logger[_0x69b6('0x46')](_0x69b6('0x48'));clearChannels(this[_0x69b6('0x12')]);this[_0x69b6('0x49')](this[_0x69b6('0x45')]);clearAgentBooked(this[_0x69b6('0x4a')]);clearVoiceQueues(this[_0x69b6('0x14')]);clearCampaigns(this[_0x69b6('0x15')]);this[_0x69b6('0x4b')]=initializeSummary();};VoiceQueueReport['prototype'][_0x69b6('0x49')]=function(_0x16ef0d){var _0x10f6ea=this;if(!_[_0x69b6('0x34')](_0x16ef0d)){for(var _0xf57b04 in _0x16ef0d){if(_0x16ef0d['hasOwnProperty'](_0xf57b04)){_0x10f6ea['emitVoiceQueueChannelRemove'](_0x16ef0d[_0xf57b04],'clearqueuereport');delete _0x16ef0d[_0xf57b04];}}}};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0x4c')]=function(_0x4346d0,_0x1f1298,_0x49caaa){io['to'](_0x4346d0)[_0x69b6('0x4c')](_0x1f1298,_0x49caaa);};VoiceQueueReport['prototype'][_0x69b6('0x4d')]=function(_0x51f593,_0x1b32c6){logger[_0x69b6('0x4e')](_0x69b6('0x4f')+_0x1b32c6+_0x69b6('0x50'),_0x51f593['uniqueid'],util[_0x69b6('0x44')](_0x51f593,{'showHidden':![],'depth':null}));this[_0x69b6('0x4c')](util[_0x69b6('0x51')](_0x69b6('0x52'),_0x51f593[_0x69b6('0x53')]),_0x69b6('0x54'),_0x51f593);io[_0x69b6('0x4c')](_0x69b6('0x55'),_0x51f593);};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0x56')]=function(_0x11deda,_0x4205f4){logger['debug']('[%s][voiceQueueReport]['+_0x4205f4+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x11deda['uniqueid'],util['inspect'](_0x11deda,{'showHidden':![],'depth':null}));if(_0x11deda[_0x69b6('0x57')]===_0x69b6('0x58')){return;}this[_0x69b6('0x4c')](util[_0x69b6('0x51')](_0x69b6('0x52'),_0x11deda[_0x69b6('0x53')]),_0x69b6('0x59'),_0x11deda);io[_0x69b6('0x4c')](_0x69b6('0x5a'),_0x11deda);};VoiceQueueReport[_0x69b6('0xe')]['emitInboundVoiceQueueSummary']=function(_0x35e3cc){if(_0x35e3cc['type']==='inbound'){logger[_0x69b6('0x4e')](_0x69b6('0x5b'),util[_0x69b6('0x44')](_0x35e3cc,{'showHidden':![],'depth':null}));this['emit'](util[_0x69b6('0x51')](_0x69b6('0x52'),_0x35e3cc[_0x69b6('0x5c')]),_0x69b6('0x5d'),_0x35e3cc);}};VoiceQueueReport['prototype'][_0x69b6('0x5e')]=function(_0xfeb5ea){return _0xfeb5ea!==null&&!_[_0x69b6('0x5f')](_0xfeb5ea);};VoiceQueueReport['prototype']['loopQueueShow']=function(){var _0x2ffd6a=this;setInterval(function(){_0x2ffd6a[_0x69b6('0x60')]();ami[_0x69b6('0x3f')]({'action':_0x69b6('0x61')})[_0x69b6('0x62')](function(_0x5aa32b){logger[_0x69b6('0x46')](_0x69b6('0x63'),util['inspect'](_0x5aa32b,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x69b6('0x64')]=function(){var _0x1b5b93=this;setInterval(function(){if(!_0x1b5b93[_0x69b6('0x4b')][_0x69b6('0x65')]){return ami[_0x69b6('0x3f')]({'action':_0x69b6('0x17')})[_0x69b6('0x66')](function(_0x39446d){_0x1b5b93[_0x69b6('0x4b')]['id']=_0x39446d[_0x69b6('0x67')];_0x1b5b93[_0x69b6('0x4b')]['isRunning']=!![];_0x1b5b93[_0x69b6('0x4b')]['queuestatus'][_0x39446d[_0x69b6('0x67')]]={};})[_0x69b6('0x62')](function(_0x3ea2af){logger['error'](_0x69b6('0x68'),util[_0x69b6('0x44')](_0x3ea2af,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0x69')]=function(_0x51c84d,_0x3a6024){var _0x48bf49;if(this[_0x69b6('0x4b')]&&this[_0x69b6('0x4b')][_0x69b6('0x61')]&&this[_0x69b6('0x4b')][_0x69b6('0x61')][_0x51c84d['name']]){_0x48bf49=this[_0x69b6('0x4b')][_0x69b6('0x61')][_0x51c84d[_0x69b6('0x5c')]][_0x69b6('0x6a')];}var _0x303a48=new VoiceQueueSummary(_0x51c84d);return _0x303a48['createReport'](_0x3a6024[_0x69b6('0x4a')],this[_0x69b6('0x4a')],_0x48bf49,this[_0x69b6('0x11')]['channels']);};VoiceQueueReport['prototype'][_0x69b6('0x6b')]=function(_0x308f3d,_0x5dbd81){var _0x1c00f4=this['createQueueSummaryReport'](_0x308f3d,_0x5dbd81);var _0x267082=![];_0x267082=_0x1c00f4['compareToInboundQueue'](_0x308f3d);if(_0x267082){Object[_0x69b6('0x6c')](_0x308f3d,_0x1c00f4);this[_0x69b6('0x11')]['voiceQueues'][_0x308f3d['name']]=_0x308f3d;this['emitInboundVoiceQueueSummary'](_0x1c00f4);}};VoiceQueueReport['prototype'][_0x69b6('0x1f')]=function(_0x228c35){var _0x51cbc6=null;var _0x3fcf99=this['summary']['id'];if(this['summary'][_0x69b6('0x6d')][_0x3fcf99]){_0x51cbc6=this[_0x69b6('0x4b')][_0x69b6('0x6d')][_0x3fcf99][_0x228c35[_0x69b6('0x67')]];}if(!_0x51cbc6){this[_0x69b6('0x4b')]=initializeSummary();return;}var _0x287932=this['voiceQueues'][_0x51cbc6[_0x69b6('0x53')]];if(_0x287932['type']===_0x69b6('0x6e')){this[_0x69b6('0x6b')](_0x287932,_0x51cbc6);}else if(_0x287932[_0x69b6('0x6f')]===_0x69b6('0x70')){var _0x329f10=this[_0x69b6('0x69')](_0x287932,_0x51cbc6);ami[_0x69b6('0x4c')](_0x69b6('0x71'),_0x329f10);}this[_0x69b6('0x4b')][_0x69b6('0x72')]-=0x1;var _0x11ca6d=this[_0x69b6('0x4b')][_0x69b6('0x72')]>0x0?!![]:![];if(!_0x11ca6d){return this[_0x69b6('0x1b')](this[_0x69b6('0x4b')][_0x69b6('0x73')]);}};VoiceQueueReport[_0x69b6('0xe')]['syncQueueMember']=function(_0x133a7e){var _0x47253e=this[_0x69b6('0x4b')]['id'];if(this[_0x69b6('0x4b')][_0x69b6('0x6d')][_0x47253e]&&this[_0x69b6('0x4b')][_0x69b6('0x6d')][_0x47253e][_0x133a7e[_0x69b6('0x67')]]){this[_0x69b6('0x4b')][_0x69b6('0x6d')][_0x47253e][_0x133a7e[_0x69b6('0x67')]][_0x69b6('0x4a')][_0x69b6('0x74')](_0x133a7e);}};VoiceQueueReport[_0x69b6('0xe')]['syncQueueSummary']=function(_0x255198){var _0x41afa8=this;try{if(this[_0x69b6('0x5e')](_0x255198)&&this[_0x69b6('0x5e')](_0x255198[_0x69b6('0x53')])){logger[_0x69b6('0x4e')](_0x69b6('0x75'),util[_0x69b6('0x44')](_0x255198,{'showHidden':![],'depth':null}));var _0x869827=this[_0x69b6('0x14')][_0x255198['queue']];if(_0x869827){logger[_0x69b6('0x4e')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x869827[_0x69b6('0x5c')]);this[_0x69b6('0x4b')]['queues'][_0x869827[_0x69b6('0x5c')]]={'summaryEvent':_0x255198};this[_0x69b6('0x4b')][_0x69b6('0x72')]+=0x1;return ami[_0x69b6('0x3f')]({'action':_0x69b6('0x6d'),'queue':_0x869827[_0x69b6('0x5c')]})[_0x69b6('0x66')](function(_0x288aba){if(!_0x41afa8[_0x69b6('0x4b')]['queuestatus'][_0x255198[_0x69b6('0x67')]]){_0x41afa8[_0x69b6('0x4b')][_0x69b6('0x6d')][_0x255198[_0x69b6('0x67')]]={};}_0x41afa8[_0x69b6('0x4b')][_0x69b6('0x6d')][_0x255198['actionid']][_0x288aba[_0x69b6('0x67')]]={'queue':_0x869827[_0x69b6('0x5c')],'agents':[]};})[_0x69b6('0x62')](function(_0x13bbcf){throw _0x13bbcf;});}}}catch(_0x2c62a5){logger[_0x69b6('0x46')](_0x69b6('0x68'),util[_0x69b6('0x44')](_0x2c62a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x257034){if(this[_0x69b6('0x4b')][_0x69b6('0x72')]>0x0){this['summary'][_0x69b6('0x73')]=_0x257034;return;}logger[_0x69b6('0x4e')](_0x69b6('0x76'),util[_0x69b6('0x44')](_0x257034,{'showHidden':![],'depth':null}));this[_0x69b6('0x4b')]=initializeSummary();ami['emit'](_0x69b6('0x77'),{});};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0x21')]=function(_0x40f373){try{if(this[_0x69b6('0x5e')](_0x40f373)){logger[_0x69b6('0x4e')](_0x69b6('0x78'),_0x40f373[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x40f373,{'showHidden':![],'depth':null}));if(_[_0x69b6('0x5f')](this[_0x69b6('0x45')][_0x40f373[_0x69b6('0x79')]])){this[_0x69b6('0x45')][_0x40f373[_0x69b6('0x79')]]=[];}if(_[_0x69b6('0x5f')](this[_0x69b6('0x12')][_0x40f373[_0x69b6('0x79')]])){this['channels'][_0x40f373[_0x69b6('0x79')]]={};}var _0x48e08a=new QueueReport();_0x48e08a['queue']=_0x40f373[_0x69b6('0x53')];_0x48e08a[_0x69b6('0x6f')]=this[_0x69b6('0x14')][_0x48e08a[_0x69b6('0x53')]]&&this[_0x69b6('0x14')][_0x48e08a[_0x69b6('0x53')]][_0x69b6('0x6f')]?this[_0x69b6('0x14')][_0x48e08a[_0x69b6('0x53')]][_0x69b6('0x6f')]||_0x69b6('0x6e'):'inbound';_0x48e08a[_0x69b6('0x7a')]=moment()[_0x69b6('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x48e08a['position']=_0x40f373[_0x69b6('0x7b')];_0x48e08a[_0x69b6('0x7c')]=_0x40f373[_0x69b6('0x7c')];_0x48e08a[_0x69b6('0x79')]=_0x40f373[_0x69b6('0x79')];logger[_0x69b6('0x7d')](_0x69b6('0x7e'),_0x48e08a[_0x69b6('0x53')],_0x48e08a[_0x69b6('0x6f')]);Object['assign'](_0x48e08a,_[_0x69b6('0x7f')](_0x40f373,_[_0x69b6('0x80')](_0x48e08a)));this[_0x69b6('0x45')][_0x40f373['uniqueid']][_0x69b6('0x74')](_0x48e08a);this[_0x69b6('0x12')][_0x40f373[_0x69b6('0x79')]]=_0x48e08a;this[_0x69b6('0x4d')](_0x48e08a,_0x69b6('0x20'));}}catch(_0x1dab13){logger[_0x69b6('0x46')](_0x69b6('0x78'),_0x40f373[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x1dab13,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0x81')]=function(_0x5e5a7a){try{if(this[_0x69b6('0x5e')](_0x5e5a7a)){logger['debug'](_0x69b6('0x82'),_0x5e5a7a[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x5e5a7a,{'showHidden':![],'depth':null}));if(this[_0x69b6('0x45')][_0x5e5a7a[_0x69b6('0x79')]]){var _0x59be67=_[_0x69b6('0x83')](this[_0x69b6('0x45')][_0x5e5a7a['uniqueid']]);_0x59be67['queuecallercomplete']=![];_0x59be67[_0x69b6('0x84')]=null;_0x59be67[_0x69b6('0x85')]=_0x5e5a7a[_0x69b6('0x85')];_0x59be67['originalposition']=_0x5e5a7a[_0x69b6('0x86')];_0x59be67['queuecallerabandon']=!![];_0x59be67[_0x69b6('0x87')]=moment()[_0x69b6('0x51')](_0x69b6('0x88'));_0x59be67['queuecallerexitreason']=_0x69b6('0x89');_0x59be67[_0x69b6('0x8a')]=null;logger[_0x69b6('0x7d')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x59be67['queue'],_0x59be67[_0x69b6('0x6f')]);this[_0x69b6('0x12')][_0x5e5a7a[_0x69b6('0x79')]]=_0x59be67;this[_0x69b6('0x56')](_0x59be67,'queuecallerabandon');}}}catch(_0x17f6df){logger[_0x69b6('0x46')](_0x69b6('0x82'),_0x5e5a7a['uniqueid'],util[_0x69b6('0x44')](_0x17f6df,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0x24')]=function(_0x5ce700){try{if(this[_0x69b6('0x5e')](_0x5ce700)){logger[_0x69b6('0x4e')](_0x69b6('0x8b'),_0x5ce700[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x5ce700,{'showHidden':![],'depth':null}));if(this[_0x69b6('0x45')][_0x5ce700['uniqueid']]){var _0x50470c=_[_0x69b6('0x83')](this[_0x69b6('0x45')][_0x5ce700[_0x69b6('0x79')]]);_0x50470c[_0x69b6('0x8c')]=moment()[_0x69b6('0x51')](_0x69b6('0x88'));_0x50470c[_0x69b6('0x8d')]=_0x5ce700[_0x69b6('0x8d')];_0x50470c[_0x69b6('0x8e')]=_0x5ce700[_0x69b6('0x8e')];logger[_0x69b6('0x7d')](_0x69b6('0x8f'),_0x50470c[_0x69b6('0x53')],_0x50470c[_0x69b6('0x6f')],_0x5ce700[_0x69b6('0x8d')],_0x5ce700['connectedlinename']);this['channels'][_0x5ce700[_0x69b6('0x79')]]=_0x50470c;this[_0x69b6('0x4d')](_0x50470c,_0x69b6('0x23'));}}}catch(_0x114f8f){logger[_0x69b6('0x46')](_0x69b6('0x8b'),_0x5ce700['uniqueid'],util[_0x69b6('0x44')](_0x114f8f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0x90')]=function(_0x1891e6){try{if(this['isNotNull'](_0x1891e6)){logger[_0x69b6('0x4e')](_0x69b6('0x91'),_0x1891e6['uniqueid'],util['inspect'](_0x1891e6,{'showHidden':![],'depth':null}));if(this[_0x69b6('0x45')][_0x1891e6[_0x69b6('0x79')]]){var _0x44828b=_[_0x69b6('0x83')](this[_0x69b6('0x45')][_0x1891e6[_0x69b6('0x79')]]);_0x44828b[_0x69b6('0x3b')]=!![];_0x44828b[_0x69b6('0x57')]=_0x69b6('0x92');logger[_0x69b6('0x7d')](_0x69b6('0x93'),_0x44828b[_0x69b6('0x53')],_0x44828b[_0x69b6('0x6f')]);}}}catch(_0x321780){logger['error'](_0x69b6('0x91'),_0x1891e6[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x321780,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69b6('0xe')]['syncAgentComplete']=function(_0x3c0c7b){try{if(this['isNotNull'](_0x3c0c7b)){logger[_0x69b6('0x4e')](_0x69b6('0x94'),_0x3c0c7b[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x3c0c7b,{'showHidden':![],'depth':null}));if(this[_0x69b6('0x45')][_0x3c0c7b[_0x69b6('0x79')]]){var _0x5835a5=_[_0x69b6('0x83')](this[_0x69b6('0x45')][_0x3c0c7b[_0x69b6('0x79')]]);_0x5835a5['queuecallerabandon']=![];_0x5835a5['queuecallerabandonAt']=null;_0x5835a5[_0x69b6('0x95')]=!![];_0x5835a5[_0x69b6('0x8a')]=_0x3c0c7b['membername'];_0x5835a5[_0x69b6('0x85')]=_0x3c0c7b['holdtime'];_0x5835a5[_0x69b6('0x3b')]=!![];_0x5835a5[_0x69b6('0x3a')]=![];_0x5835a5[_0x69b6('0x96')]=null;if(!_0x5835a5[_0x69b6('0x97')]){if(_0x3c0c7b[_0x69b6('0x98')]==_0x69b6('0x97')){_0x5835a5[_0x69b6('0x57')]=_0x69b6('0x99');logger[_0x69b6('0x7d')](_0x69b6('0x9a'),_0x5835a5[_0x69b6('0x53')],_0x5835a5[_0x69b6('0x6f')]);}else{if(_[_0x69b6('0x9b')](_0x3c0c7b[_0x69b6('0x41')][_0x69b6('0x9c')](),'local/')){if(this[_0x69b6('0x45')][_0x3c0c7b['linkedid']]){var _0x7e10ca=_[_0x69b6('0x83')](this[_0x69b6('0x45')][_0x3c0c7b[_0x69b6('0x9d')]]);_0x7e10ca[_0x69b6('0x3b')]=![];_0x7e10ca[_0x69b6('0x3a')]=!![];_0x7e10ca[_0x69b6('0x96')]=moment(_0x5835a5['queuecallerjoinAt'])['add'](_0x3c0c7b[_0x69b6('0x85')],'seconds')['format'](_0x69b6('0x88'));_0x7e10ca[_0x69b6('0x57')]='FORWARDTRANSFER';_0x7e10ca[_0x69b6('0x97')]=!![];_0x7e10ca['transfertype']=_0x69b6('0x9e');_0x7e10ca['transferexten']=_0x3c0c7b[_0x69b6('0x9f')];_0x7e10ca['transferuniqueid']=_0x3c0c7b[_0x69b6('0x79')];logger[_0x69b6('0x7d')](_0x69b6('0xa0'),_0x7e10ca[_0x69b6('0x53')],_0x7e10ca['type']);var _0x4e25e8=this[_0x69b6('0x45')][_0x3c0c7b['linkedid']];this[_0x69b6('0x45')][_0x3c0c7b[_0x69b6('0x9d')]]=this[_0x69b6('0x45')][_0x3c0c7b[_0x69b6('0x79')]];this[_0x69b6('0x45')][_0x3c0c7b[_0x69b6('0x79')]]=_0x4e25e8;}}else{_0x5835a5[_0x69b6('0x57')]=_0x69b6('0xa1')+_0x3c0c7b['reason'][_0x69b6('0xa2')]();logger[_0x69b6('0x7d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x5835a5[_0x69b6('0x53')],_0x5835a5[_0x69b6('0x6f')],_0x5835a5['queuecallerexitreason']);}}}this[_0x69b6('0x12')][_0x3c0c7b['uniqueid']]=_0x5835a5;}}}catch(_0x7dad88){logger[_0x69b6('0x46')](_0x69b6('0x94'),_0x3c0c7b[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x7dad88,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x69b6('0x28')]=function(_0x39e683){try{if(this[_0x69b6('0x5e')](_0x39e683)){logger[_0x69b6('0x4e')]('[%s][voiceQueueReport][varset]',_0x39e683[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x39e683,{'showHidden':![],'depth':null}));this[_0x69b6('0xa3')](_0x39e683[_0x69b6('0x79')],_[_0x69b6('0x80')](_0x39e683['variable'])[0x0],_0x39e683['value']);if(this[_0x69b6('0x45')][_0x39e683['uniqueid']]){var _0x53d4fe=_[_0x69b6('0x83')](this[_0x69b6('0x45')][_0x39e683[_0x69b6('0x79')]]);if(_0x53d4fe){if(this[_0x69b6('0x5e')](_0x39e683[_0x69b6('0xa4')])&&this['isNotNull'](_0x39e683[_0x69b6('0xa4')][_0x69b6('0x6d')])){switch(_0x39e683[_0x69b6('0xa5')]){case _0x69b6('0xa6'):_0x53d4fe[_0x69b6('0x3a')]=![];_0x53d4fe['queuecallerexitAt']=null;break;case _0x69b6('0xa7'):_0x53d4fe['lastevent']=_0x69b6('0xa8');_0x53d4fe[_0x69b6('0x3a')]=!![];_0x53d4fe[_0x69b6('0x96')]=moment()[_0x69b6('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x53d4fe[_0x69b6('0x8c')]=moment()[_0x69b6('0x51')](_0x69b6('0x88'));logger['debug'](_0x69b6('0xa9'),_0x39e683[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x53d4fe,{'showHidden':![],'depth':null}));ami[_0x69b6('0x4c')](_0x69b6('0xaa'),_0x53d4fe);break;default:_0x53d4fe[_0x69b6('0x3a')]=!![];_0x53d4fe[_0x69b6('0x96')]=moment()[_0x69b6('0x51')](_0x69b6('0x88'));_0x53d4fe[_0x69b6('0x8c')]=moment()[_0x69b6('0x51')](_0x69b6('0x88'));}_0x53d4fe[_0x69b6('0x22')]=![];_0x53d4fe[_0x69b6('0x87')]=null;_0x53d4fe[_0x69b6('0x57')]=_0x39e683['value'];this[_0x69b6('0x12')][_0x39e683[_0x69b6('0x79')]]=_0x53d4fe;this['emitVoiceQueueChannelRemove'](_0x53d4fe,_0x69b6('0x27'));}else if(this['isNotNull'](_0x39e683[_0x69b6('0xa4')])&&this['isNotNull'](_0x39e683[_0x69b6('0xa4')][_0x69b6('0xab')])){if(!_0x53d4fe[_0x69b6('0x22')]){_0x53d4fe[_0x69b6('0x3a')]=!![];_0x53d4fe[_0x69b6('0x96')]=moment()['format'](_0x69b6('0x88'));_0x53d4fe[_0x69b6('0x57')]=_0x69b6('0xac');_0x53d4fe[_0x69b6('0x8c')]=moment()[_0x69b6('0x51')](_0x69b6('0x88'));this['channels'][_0x39e683[_0x69b6('0x79')]]=_0x53d4fe;}}logger['info'](_0x69b6('0xad'),_0x39e683[_0x69b6('0x79')],_0x53d4fe[_0x69b6('0x53')],_0x53d4fe['type'],_[_0x69b6('0x80')](_0x39e683['variable'])[0x0],_0x39e683[_0x69b6('0xa5')]);_0x53d4fe[_0x69b6('0x16')]=this[_0x69b6('0x16')][_0x39e683[_0x69b6('0x79')]];}}}}catch(_0x2f4dd7){logger['error']('[%s][voiceQueueReport][varset]',_0x39e683[_0x69b6('0x79')],util[_0x69b6('0x44')](_0x2f4dd7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0xa3')]=function(_0x3a2299,_0x2eca09,_0xd140b1){var _0x1d8c92=[_0x69b6('0xae'),'rtpaudioqosbridged',_0x69b6('0xaf'),'rtpaudioqosjitterbridged',_0x69b6('0xb0'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x69b6('0xb1'),_0x69b6('0xb2'),_0x69b6('0xb3'),_0x69b6('0xb4'),_0x69b6('0xb5'),_0x69b6('0xb6'),_0x69b6('0xb7'),'memberinterface',_0x69b6('0xb8'),_0x69b6('0xb9'),_0x69b6('0xba'),_0x69b6('0xbb')];if(!_[_0x69b6('0x3e')](_0x2eca09)&&!_[_0x69b6('0xbc')](_0x1d8c92,_0x2eca09)){if(_[_0x69b6('0x5f')](this[_0x69b6('0x16')][_0x3a2299])){this[_0x69b6('0x16')][_0x3a2299]={};}this['variables'][_0x3a2299][_0x2eca09]=_0xd140b1;}};VoiceQueueReport[_0x69b6('0xe')][_0x69b6('0xbd')]=function(_0x1a75c5,_0x30736c,_0x4fbd6d){try{var _0x3f2040={};if(this[_0x69b6('0x45')][_0x1a75c5]){for(var _0x3ffa8c=0x0;_0x3ffa8c{delete this[_0x69b6('0x12')][_0xf1611a];},_0x10f059);}};module['exports']=VoiceQueueReport; \ No newline at end of file +var _0x7789=['queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','assigned','lastAssignedTo','membername','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','add','FORWARDTRANSFER','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','keys','value','variable','CONTINUE','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','varset','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberrealtime','includes','length','seconds','COMPLETEDBYAGENT','milliseconds','diff','total','answered','sumBillable','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','syncHangup','[%s][voiceQueueReport][hangup]','handleHangup','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','transfertype','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','origtransfererexten','origtransfereruniqueid','transfertargetuniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','BlindTransfer','context','transfererchannel','syncMusicOnHoldStart','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstop]','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','[%s][voiceQueueReport][newexten]','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','queuesummary','bind','queuesummarycomplete','syncQueueMember','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart','musiconholdstop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','isEmpty','hasOwnProperty','originated','talking','waiting','unlockRR','queuecallerexit','queuecallerabandon','queuecallercomplete','prototype','clearZombieChannels','switch','enqueue','isNil','Action','channel','catch','message','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][','uniqueid','format','voice:queue:%s','queue','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','isNotNull','isUndefined','loopQueueShow','queues','[voiceQueueReport][queues]','summary','then','actionid','isRunning','queuestatus','[voiceQueueReport][queuesummary]','createReport','createQueueSummaryReport','statusRequests','syncQueueSummaryComplete','push','syncQueueSummary','[voiceQueueReport][queuesummary]\x20event:','completeEvent','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','inbound','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','assign','pick','last','queuecallercompleteAt','holdtime','originalposition','ABANDONED','info','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x7789,0x164));var _0x9778=function(_0x18614d,_0x5b87c1){_0x18614d=_0x18614d-0x0;var _0x394a51=_0x7789[_0x18614d];return _0x394a51;};'use strict';var _=require(_0x9778('0x0'));var moment=require(_0x9778('0x1'));var util=require(_0x9778('0x2'));var Redis=require(_0x9778('0x3'));var config=require('../../../config/environment');var logger=require(_0x9778('0x4'))(_0x9778('0x5'));var ami=require(_0x9778('0x6'));var QueueReport=require(_0x9778('0x7'));var VoiceQueueSummary=require('../model/voiceQueueSummary');config[_0x9778('0x8')]=_[_0x9778('0x9')](config[_0x9778('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9778('0x8')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x381be4){this['tail']=this['tail']?this[_0x9778('0xa')][_0x9778('0xb')](_0x381be4):_0x381be4();};function VoiceQueueReport(_0x25bc25){this[_0x9778('0xc')]=new Sequence();this[_0x9778('0xd')]={};this[_0x9778('0xe')]=_0x25bc25;this['agents']=_0x25bc25[_0x9778('0xf')];this[_0x9778('0x10')]=_0x25bc25[_0x9778('0x11')];this[_0x9778('0x12')]=_0x25bc25['voiceQueues'];this[_0x9778('0x13')]=_0x25bc25[_0x9778('0x13')];this['summary']=initializeSummary();this['variables']={};ami['on'](_0x9778('0x14'),this['syncQueueSummary'][_0x9778('0x15')](this));ami['on'](_0x9778('0x16'),this['syncQueueSummaryComplete']['bind'](this));ami['on']('queuemember',this[_0x9778('0x17')][_0x9778('0x15')](this));ami['on']('queuestatuscomplete',this[_0x9778('0x18')][_0x9778('0x15')](this));ami['on'](_0x9778('0x19'),this[_0x9778('0x1a')][_0x9778('0x15')](this));ami['on']('queuecallerabandon',this[_0x9778('0x1b')][_0x9778('0x15')](this));ami['on'](_0x9778('0x1c'),this[_0x9778('0x1d')]['bind'](this));ami['on'](_0x9778('0x1e'),this[_0x9778('0x1f')][_0x9778('0x15')](this));ami['on'](_0x9778('0x20'),this[_0x9778('0x21')]['bind'](this));ami['on']('varset',this[_0x9778('0x22')][_0x9778('0x15')](this));ami['on'](_0x9778('0x23'),this['syncHangup'][_0x9778('0x15')](this));ami['on'](_0x9778('0x24'),this[_0x9778('0x25')][_0x9778('0x15')](this));ami['on'](_0x9778('0x26'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x9778('0x27'),this['syncMusicOnHoldStop'][_0x9778('0x15')](this));ami['on']('attendedtransfer',this[_0x9778('0x28')]['bind'](this));ami['on'](_0x9778('0x29'),this[_0x9778('0x2a')]['bind'](this));this['loopQueueSummary']();this['loopQueueShow']();}function clearChannels(_0x27219d){if(!_[_0x9778('0x2b')](_0x27219d)){for(var _0x536bd3 in _0x27219d){if(_0x27219d[_0x9778('0x2c')](_0x536bd3)){delete _0x27219d[_0x536bd3];}}}}function clearCampaigns(_0x40a2fd){if(!_[_0x9778('0x2b')](_0x40a2fd)){for(var _0xa4827a in _0x40a2fd){if(_0x40a2fd[_0x9778('0x2c')](_0xa4827a)){_0x40a2fd[_0xa4827a][_0x9778('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x261828){if(!_[_0x9778('0x2b')](_0x261828)){for(var _0x2da0d9 in _0x261828){if(_0x261828[_0x9778('0x2c')](_0x2da0d9)){_0x261828[_0x2da0d9][_0x9778('0x2d')]=0x0;_0x261828[_0x2da0d9][_0x9778('0x2e')]=0x0;_0x261828[_0x2da0d9]['pTalking']=0x0;_0x261828[_0x2da0d9][_0x9778('0x2f')]=0x0;_0x261828[_0x2da0d9]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x2b695f){if(!_['isEmpty'](_0x2b695f)){for(var _0x275944 in _0x2b695f){if(_0x2b695f[_0x9778('0x2c')](_0x275944)){_0x2b695f[_0x275944][_0x9778('0x30')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x24e97c){return _0x24e97c[_0x9778('0x31')]||_0x24e97c[_0x9778('0x32')]||_0x24e97c[_0x9778('0x33')];}VoiceQueueReport[_0x9778('0x34')][_0x9778('0x35')]=function(){var _0x9dc29a=this;for(var _0x7bf96d in this['channels']){if(this[_0x9778('0x10')][_0x9778('0x2c')](_0x7bf96d)&&!this[_0x9778('0x10')][_0x7bf96d][_0x9778('0x36')]){this[_0x9778('0xc')][_0x9778('0x37')](function(){if(!_[_0x9778('0x38')](_0x9dc29a[_0x9778('0x10')][_0x7bf96d])){return ami[_0x9778('0x39')]({'action':'status','channel':_0x9dc29a['channels'][_0x7bf96d][_0x9778('0x3a')]})[_0x9778('0x3b')](function(_0xdf7994){if(_0xdf7994[_0x9778('0x3c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x9dc29a[_0x9778('0x10')][_0x7bf96d]){delete _0x9dc29a[_0x9778('0x10')][_0x7bf96d];logger[_0x9778('0x3d')](_0x9778('0x3e'),_0x7bf96d,util[_0x9778('0x3f')](_0xdf7994,{'showHidden':![],'depth':null}));}if(_0x9dc29a[_0x9778('0xd')][_0x7bf96d]){delete _0x9dc29a['queueReports'][_0x7bf96d];logger[_0x9778('0x3d')](_0x9778('0x40'),_0x7bf96d,util[_0x9778('0x3f')](_0xdf7994,{'showHidden':![],'depth':null}));}if(_0x9dc29a[_0x9778('0x41')][_0x7bf96d]){delete _0x9dc29a['variables'][_0x7bf96d];logger['error']('[%s][voiceQueueReport][checkVariables]',_0x7bf96d,util[_0x9778('0x3f')](_0xdf7994,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0x9778('0x3d')](_0x9778('0x42'));clearChannels(this['channels']);this[_0x9778('0x43')](this[_0x9778('0xd')]);clearAgentBooked(this[_0x9778('0xf')]);clearVoiceQueues(this[_0x9778('0x12')]);clearCampaigns(this[_0x9778('0x13')]);this['summary']=initializeSummary();};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x43')]=function(_0xa6714c){var _0x55be23=this;if(!_[_0x9778('0x2b')](_0xa6714c)){for(var _0x5dea89 in _0xa6714c){if(_0xa6714c[_0x9778('0x2c')](_0x5dea89)){_0x55be23[_0x9778('0x44')](_0xa6714c[_0x5dea89],'clearqueuereport');delete _0xa6714c[_0x5dea89];}}}};VoiceQueueReport[_0x9778('0x34')]['emit']=function(_0x273969,_0x5b55be,_0x23a616){io['to'](_0x273969)[_0x9778('0x45')](_0x5b55be,_0x23a616);};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x46')]=function(_0xd95146,_0x9fb73a){logger['debug'](_0x9778('0x47')+_0x9fb73a+']\x20sending\x20voice_queue_channel:save\x20event:',_0xd95146[_0x9778('0x48')],util[_0x9778('0x3f')](_0xd95146,{'showHidden':![],'depth':null}));this['emit'](util[_0x9778('0x49')](_0x9778('0x4a'),_0xd95146[_0x9778('0x4b')]),_0x9778('0x4c'),_0xd95146);io[_0x9778('0x45')]('voice_queue_presence:save',_0xd95146);};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x44')]=function(_0x221900,_0x208015){logger['debug'](_0x9778('0x47')+_0x208015+_0x9778('0x4d'),_0x221900['uniqueid'],util[_0x9778('0x3f')](_0x221900,{'showHidden':![],'depth':null}));if(_0x221900[_0x9778('0x4e')]===_0x9778('0x4f')){return;}this[_0x9778('0x45')](util[_0x9778('0x49')](_0x9778('0x4a'),_0x221900[_0x9778('0x4b')]),_0x9778('0x50'),_0x221900);io[_0x9778('0x45')](_0x9778('0x51'),_0x221900);};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x52')]=function(_0x2dc68d){if(_0x2dc68d[_0x9778('0x53')]==='inbound'){logger[_0x9778('0x54')](_0x9778('0x55'),util[_0x9778('0x3f')](_0x2dc68d,{'showHidden':![],'depth':null}));this[_0x9778('0x45')](util[_0x9778('0x49')](_0x9778('0x4a'),_0x2dc68d[_0x9778('0x56')]),'voice_queue:save',_0x2dc68d);}};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x57')]=function(_0x25edb4){return _0x25edb4!==null&&!_[_0x9778('0x58')](_0x25edb4);};VoiceQueueReport['prototype'][_0x9778('0x59')]=function(){var _0x3924d6=this;setInterval(function(){_0x3924d6[_0x9778('0x35')]();ami[_0x9778('0x39')]({'action':_0x9778('0x5a')})['catch'](function(_0x1c100e){logger[_0x9778('0x3d')](_0x9778('0x5b'),util['inspect'](_0x1c100e,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x9778('0x34')]['loopQueueSummary']=function(){var _0x5f1dc5=this;setInterval(function(){if(!_0x5f1dc5[_0x9778('0x5c')]['isRunning']){return ami[_0x9778('0x39')]({'action':_0x9778('0x14')})[_0x9778('0x5d')](function(_0x254ce3){_0x5f1dc5['summary']['id']=_0x254ce3[_0x9778('0x5e')];_0x5f1dc5[_0x9778('0x5c')][_0x9778('0x5f')]=!![];_0x5f1dc5['summary'][_0x9778('0x60')][_0x254ce3[_0x9778('0x5e')]]={};})[_0x9778('0x3b')](function(_0x51f353){logger['error'](_0x9778('0x61'),util[_0x9778('0x3f')](_0x51f353,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x9778('0x34')]['createQueueSummaryReport']=function(_0x738d44,_0x44d60d){var _0x1f7eaf;if(this['summary']&&this[_0x9778('0x5c')]['queues']&&this['summary'][_0x9778('0x5a')][_0x738d44[_0x9778('0x56')]]){_0x1f7eaf=this[_0x9778('0x5c')][_0x9778('0x5a')][_0x738d44[_0x9778('0x56')]]['summaryEvent'];}var _0x4c55dc=new VoiceQueueSummary(_0x738d44);return _0x4c55dc[_0x9778('0x62')](_0x44d60d['agents'],this[_0x9778('0xf')],_0x1f7eaf,this['realtime'][_0x9778('0x10')]);};VoiceQueueReport[_0x9778('0x34')]['handleInboundQueueSummaryReport']=function(_0xac36a1,_0x3438b7){var _0x950844=this[_0x9778('0x63')](_0xac36a1,_0x3438b7);var _0x2d9a3f=![];_0x2d9a3f=_0x950844['compareToInboundQueue'](_0xac36a1);if(_0x2d9a3f){Object['assign'](_0xac36a1,_0x950844);this['realtime'][_0x9778('0x12')][_0xac36a1[_0x9778('0x56')]]=_0xac36a1;this[_0x9778('0x52')](_0x950844);}};VoiceQueueReport['prototype'][_0x9778('0x18')]=function(_0x8bfeff){var _0x7aed81=null;var _0x2c3494=this[_0x9778('0x5c')]['id'];if(this[_0x9778('0x5c')]['queuestatus'][_0x2c3494]){_0x7aed81=this['summary'][_0x9778('0x60')][_0x2c3494][_0x8bfeff[_0x9778('0x5e')]];}if(!_0x7aed81){this[_0x9778('0x5c')]=initializeSummary();return;}var _0x46ac98=this[_0x9778('0x12')][_0x7aed81[_0x9778('0x4b')]];if(_0x46ac98['type']==='inbound'){this['handleInboundQueueSummaryReport'](_0x46ac98,_0x7aed81);}else if(_0x46ac98[_0x9778('0x53')]==='outbound'){var _0xfa49d5=this[_0x9778('0x63')](_0x46ac98,_0x7aed81);ami['emit']('custom:queuesummary',_0xfa49d5);}this[_0x9778('0x5c')][_0x9778('0x64')]-=0x1;var _0x8ce2e9=this[_0x9778('0x5c')]['statusRequests']>0x0?!![]:![];if(!_0x8ce2e9){return this[_0x9778('0x65')](this[_0x9778('0x5c')]['completeEvent']);}};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x17')]=function(_0xa84b3e){var _0x30de2e=this[_0x9778('0x5c')]['id'];if(this[_0x9778('0x5c')]['queuestatus'][_0x30de2e]&&this['summary'][_0x9778('0x60')][_0x30de2e][_0xa84b3e[_0x9778('0x5e')]]){this[_0x9778('0x5c')][_0x9778('0x60')][_0x30de2e][_0xa84b3e[_0x9778('0x5e')]][_0x9778('0xf')][_0x9778('0x66')](_0xa84b3e);}};VoiceQueueReport['prototype'][_0x9778('0x67')]=function(_0x5b0030){var _0x4f038b=this;try{if(this[_0x9778('0x57')](_0x5b0030)&&this['isNotNull'](_0x5b0030[_0x9778('0x4b')])){logger[_0x9778('0x54')](_0x9778('0x68'),util['inspect'](_0x5b0030,{'showHidden':![],'depth':null}));var _0x43420e=this[_0x9778('0x12')][_0x5b0030['queue']];if(_0x43420e){logger[_0x9778('0x54')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x43420e['name']);this[_0x9778('0x5c')]['queues'][_0x43420e[_0x9778('0x56')]]={'summaryEvent':_0x5b0030};this['summary'][_0x9778('0x64')]+=0x1;return ami[_0x9778('0x39')]({'action':_0x9778('0x60'),'queue':_0x43420e['name']})[_0x9778('0x5d')](function(_0x395c61){if(!_0x4f038b[_0x9778('0x5c')]['queuestatus'][_0x5b0030[_0x9778('0x5e')]]){_0x4f038b[_0x9778('0x5c')][_0x9778('0x60')][_0x5b0030[_0x9778('0x5e')]]={};}_0x4f038b[_0x9778('0x5c')][_0x9778('0x60')][_0x5b0030[_0x9778('0x5e')]][_0x395c61['actionid']]={'queue':_0x43420e[_0x9778('0x56')],'agents':[]};})[_0x9778('0x3b')](function(_0x415407){throw _0x415407;});}}}catch(_0x3dfc92){logger[_0x9778('0x3d')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x3dfc92,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9778('0x34')]['syncQueueSummaryComplete']=function(_0x4e3b54){if(this['summary']['statusRequests']>0x0){this[_0x9778('0x5c')][_0x9778('0x69')]=_0x4e3b54;return;}logger['debug'](_0x9778('0x6a'),util[_0x9778('0x3f')](_0x4e3b54,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x9778('0x45')](_0x9778('0x6b'),{});};VoiceQueueReport[_0x9778('0x34')]['syncQueueCallerJoin']=function(_0x13a630){try{if(this[_0x9778('0x57')](_0x13a630)){logger[_0x9778('0x54')](_0x9778('0x6c'),_0x13a630[_0x9778('0x48')],util[_0x9778('0x3f')](_0x13a630,{'showHidden':![],'depth':null}));if(_[_0x9778('0x58')](this[_0x9778('0xd')][_0x13a630[_0x9778('0x48')]])){this[_0x9778('0xd')][_0x13a630['uniqueid']]=[];}if(_[_0x9778('0x58')](this['channels'][_0x13a630['uniqueid']])){this['channels'][_0x13a630[_0x9778('0x48')]]={};}var _0x55554e=new QueueReport();_0x55554e[_0x9778('0x4b')]=_0x13a630[_0x9778('0x4b')];_0x55554e[_0x9778('0x53')]=this[_0x9778('0x12')][_0x55554e[_0x9778('0x4b')]]&&this['voiceQueues'][_0x55554e['queue']][_0x9778('0x53')]?this[_0x9778('0x12')][_0x55554e['queue']][_0x9778('0x53')]||'inbound':_0x9778('0x6d');_0x55554e[_0x9778('0x6e')]=moment()['format'](_0x9778('0x6f'));_0x55554e[_0x9778('0x70')]=_0x13a630['position'];_0x55554e[_0x9778('0x71')]=_0x13a630[_0x9778('0x71')];_0x55554e[_0x9778('0x48')]=_0x13a630[_0x9778('0x48')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x55554e['queue'],_0x55554e[_0x9778('0x53')]);Object[_0x9778('0x72')](_0x55554e,_[_0x9778('0x73')](_0x13a630,_['keys'](_0x55554e)));this['queueReports'][_0x13a630[_0x9778('0x48')]][_0x9778('0x66')](_0x55554e);this[_0x9778('0x10')][_0x13a630[_0x9778('0x48')]]=_0x55554e;this[_0x9778('0x46')](_0x55554e,_0x9778('0x19'));}}catch(_0x2ee939){logger[_0x9778('0x3d')](_0x9778('0x6c'),_0x13a630[_0x9778('0x48')],util[_0x9778('0x3f')](_0x2ee939,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x1b')]=function(_0x393bd5){try{if(this['isNotNull'](_0x393bd5)){logger[_0x9778('0x54')]('[%s][voiceQueueReport][queuecallerabandon]',_0x393bd5[_0x9778('0x48')],util['inspect'](_0x393bd5,{'showHidden':![],'depth':null}));if(this[_0x9778('0xd')][_0x393bd5[_0x9778('0x48')]]){var _0x1997d0=_[_0x9778('0x74')](this[_0x9778('0xd')][_0x393bd5[_0x9778('0x48')]]);_0x1997d0[_0x9778('0x33')]=![];_0x1997d0[_0x9778('0x75')]=null;_0x1997d0[_0x9778('0x76')]=_0x393bd5[_0x9778('0x76')];_0x1997d0[_0x9778('0x77')]=_0x393bd5[_0x9778('0x77')];_0x1997d0[_0x9778('0x32')]=!![];_0x1997d0['queuecallerabandonAt']=moment()[_0x9778('0x49')](_0x9778('0x6f'));_0x1997d0['queuecallerexitreason']=_0x9778('0x78');_0x1997d0['lastAssignedTo']=null;logger[_0x9778('0x79')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x1997d0['queue'],_0x1997d0['type']);this['channels'][_0x393bd5['uniqueid']]=_0x1997d0;this[_0x9778('0x44')](_0x1997d0,'queuecallerabandon');}}}catch(_0x4fd356){logger[_0x9778('0x3d')](_0x9778('0x7a'),_0x393bd5['uniqueid'],util[_0x9778('0x3f')](_0x4fd356,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9778('0x34')]['syncQueueCallerLeave']=function(_0x2ceced){try{if(this[_0x9778('0x57')](_0x2ceced)){logger[_0x9778('0x54')](_0x9778('0x7b'),_0x2ceced['uniqueid'],util['inspect'](_0x2ceced,{'showHidden':![],'depth':null}));if(this[_0x9778('0xd')][_0x2ceced[_0x9778('0x48')]]){var _0x1e87c6=_[_0x9778('0x74')](this['queueReports'][_0x2ceced['uniqueid']]);_0x1e87c6[_0x9778('0x7c')]=moment()[_0x9778('0x49')](_0x9778('0x6f'));_0x1e87c6[_0x9778('0x7d')]=_0x2ceced['connectedlinenum'];_0x1e87c6[_0x9778('0x7e')]=_0x2ceced['connectedlinename'];logger[_0x9778('0x79')](_0x9778('0x7f'),_0x1e87c6[_0x9778('0x4b')],_0x1e87c6[_0x9778('0x53')],_0x2ceced[_0x9778('0x7d')],_0x2ceced[_0x9778('0x7e')]);this[_0x9778('0x10')][_0x2ceced['uniqueid']]=_0x1e87c6;this[_0x9778('0x46')](_0x1e87c6,_0x9778('0x1c'));}}}catch(_0x341aae){logger[_0x9778('0x3d')](_0x9778('0x7b'),_0x2ceced['uniqueid'],util[_0x9778('0x3f')](_0x341aae,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x21')]=function(_0x2aa7b6){try{if(this[_0x9778('0x57')](_0x2aa7b6)){logger[_0x9778('0x54')]('[%s][voiceQueueReport][agentconnect]',_0x2aa7b6[_0x9778('0x48')],util[_0x9778('0x3f')](_0x2aa7b6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2aa7b6[_0x9778('0x48')]]){var _0x1da151=_['last'](this['queueReports'][_0x2aa7b6[_0x9778('0x48')]]);_0x1da151[_0x9778('0x33')]=!![];_0x1da151[_0x9778('0x4e')]='COMPLETEDBYAGENT';logger[_0x9778('0x79')](_0x9778('0x80'),_0x1da151[_0x9778('0x4b')],_0x1da151['type']);}}}catch(_0x2939b0){logger[_0x9778('0x3d')](_0x9778('0x81'),_0x2aa7b6['uniqueid'],util[_0x9778('0x3f')](_0x2939b0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x1f')]=function(_0x3b17df){try{if(this[_0x9778('0x57')](_0x3b17df)){logger['debug'](_0x9778('0x82'),_0x3b17df[_0x9778('0x48')],util[_0x9778('0x3f')](_0x3b17df,{'showHidden':![],'depth':null}));if(this[_0x9778('0xd')][_0x3b17df[_0x9778('0x48')]]){var _0x23c8fe=_['last'](this[_0x9778('0xd')][_0x3b17df[_0x9778('0x48')]]);_0x23c8fe[_0x9778('0x32')]=![];_0x23c8fe[_0x9778('0x83')]=null;_0x23c8fe[_0x9778('0x84')]=!![];_0x23c8fe[_0x9778('0x85')]=_0x3b17df[_0x9778('0x86')];_0x23c8fe['holdtime']=_0x3b17df[_0x9778('0x76')];_0x23c8fe['queuecallercomplete']=!![];_0x23c8fe[_0x9778('0x31')]=![];_0x23c8fe[_0x9778('0x87')]=null;if(!_0x23c8fe[_0x9778('0x88')]){if(_0x3b17df[_0x9778('0x89')]=='transfer'){_0x23c8fe[_0x9778('0x4e')]=_0x9778('0x8a');logger[_0x9778('0x79')](_0x9778('0x8b'),_0x23c8fe[_0x9778('0x4b')],_0x23c8fe['type']);}else{if(_['startsWith'](_0x3b17df['channel'][_0x9778('0x8c')](),_0x9778('0x8d'))){if(this[_0x9778('0xd')][_0x3b17df[_0x9778('0x8e')]]){var _0x26195f=_['last'](this[_0x9778('0xd')][_0x3b17df[_0x9778('0x8e')]]);_0x26195f[_0x9778('0x33')]=![];_0x26195f[_0x9778('0x31')]=!![];_0x26195f[_0x9778('0x87')]=moment(_0x23c8fe[_0x9778('0x6e')])[_0x9778('0x8f')](_0x3b17df[_0x9778('0x76')],'seconds')[_0x9778('0x49')](_0x9778('0x6f'));_0x26195f[_0x9778('0x4e')]=_0x9778('0x90');_0x26195f[_0x9778('0x88')]=!![];_0x26195f['transfertype']='FORWARD';_0x26195f[_0x9778('0x91')]=_0x3b17df[_0x9778('0x92')];_0x26195f[_0x9778('0x93')]=_0x3b17df[_0x9778('0x48')];logger[_0x9778('0x79')](_0x9778('0x94'),_0x26195f['queue'],_0x26195f[_0x9778('0x53')]);var _0x5985d0=this['queueReports'][_0x3b17df['linkedid']];this[_0x9778('0xd')][_0x3b17df[_0x9778('0x8e')]]=this[_0x9778('0xd')][_0x3b17df['uniqueid']];this[_0x9778('0xd')][_0x3b17df[_0x9778('0x48')]]=_0x5985d0;}}else{_0x23c8fe[_0x9778('0x4e')]=_0x9778('0x95')+_0x3b17df['reason'][_0x9778('0x96')]();logger[_0x9778('0x79')](_0x9778('0x97'),_0x23c8fe[_0x9778('0x4b')],_0x23c8fe[_0x9778('0x53')],_0x23c8fe[_0x9778('0x4e')]);}}}this[_0x9778('0x10')][_0x3b17df['uniqueid']]=_0x23c8fe;}}}catch(_0x1ecf5f){logger[_0x9778('0x3d')](_0x9778('0x82'),_0x3b17df[_0x9778('0x48')],util['inspect'](_0x1ecf5f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9778('0x34')][_0x9778('0x22')]=function(_0x19750d){try{if(this[_0x9778('0x57')](_0x19750d)){logger[_0x9778('0x54')](_0x9778('0x98'),_0x19750d[_0x9778('0x48')],util[_0x9778('0x3f')](_0x19750d,{'showHidden':![],'depth':null}));this['addVariable'](_0x19750d[_0x9778('0x48')],_[_0x9778('0x99')](_0x19750d['variable'])[0x0],_0x19750d[_0x9778('0x9a')]);if(this['queueReports'][_0x19750d[_0x9778('0x48')]]){var _0x575a89=_[_0x9778('0x74')](this[_0x9778('0xd')][_0x19750d[_0x9778('0x48')]]);if(_0x575a89){if(this['isNotNull'](_0x19750d['variable'])&&this[_0x9778('0x57')](_0x19750d[_0x9778('0x9b')]['queuestatus'])){switch(_0x19750d[_0x9778('0x9a')]){case _0x9778('0x9c'):_0x575a89[_0x9778('0x31')]=![];_0x575a89['queuecallerexitAt']=null;break;case'TIMEOUT':_0x575a89[_0x9778('0x9d')]=_0x9778('0x9e');_0x575a89[_0x9778('0x31')]=!![];_0x575a89[_0x9778('0x87')]=moment()[_0x9778('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x575a89[_0x9778('0x7c')]=moment()[_0x9778('0x49')](_0x9778('0x6f'));logger['debug'](_0x9778('0x9f'),_0x19750d[_0x9778('0x48')],util[_0x9778('0x3f')](_0x575a89,{'showHidden':![],'depth':null}));ami[_0x9778('0x45')](_0x9778('0xa0'),_0x575a89);break;default:_0x575a89[_0x9778('0x31')]=!![];_0x575a89[_0x9778('0x87')]=moment()[_0x9778('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x575a89['queuecallerleaveAt']=moment()[_0x9778('0x49')](_0x9778('0x6f'));}_0x575a89[_0x9778('0x32')]=![];_0x575a89['queuecallerabandonAt']=null;_0x575a89[_0x9778('0x4e')]=_0x19750d[_0x9778('0x9a')];this['channels'][_0x19750d[_0x9778('0x48')]]=_0x575a89;this['emitVoiceQueueChannelRemove'](_0x575a89,_0x9778('0xa1'));}else if(this[_0x9778('0x57')](_0x19750d[_0x9778('0x9b')])&&this[_0x9778('0x57')](_0x19750d[_0x9778('0x9b')][_0x9778('0xa2')])){if(!_0x575a89['queuecallerabandon']){_0x575a89[_0x9778('0x31')]=!![];_0x575a89[_0x9778('0x87')]=moment()[_0x9778('0x49')](_0x9778('0x6f'));_0x575a89['queuecallerexitreason']=_0x9778('0xa3');_0x575a89[_0x9778('0x7c')]=moment()[_0x9778('0x49')](_0x9778('0x6f'));this['channels'][_0x19750d['uniqueid']]=_0x575a89;}}logger[_0x9778('0x79')](_0x9778('0xa4'),_0x19750d[_0x9778('0x48')],_0x575a89['queue'],_0x575a89['type'],_[_0x9778('0x99')](_0x19750d['variable'])[0x0],_0x19750d[_0x9778('0x9a')]);_0x575a89[_0x9778('0x41')]=this[_0x9778('0x41')][_0x19750d[_0x9778('0x48')]];}}}}catch(_0x28d814){logger[_0x9778('0x3d')](_0x9778('0x98'),_0x19750d[_0x9778('0x48')],util[_0x9778('0x3f')](_0x28d814,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9778('0xa5')]=function(_0x348e0d,_0x4faa34,_0x184e99){var _0x5831ae=[_0x9778('0xa6'),_0x9778('0xa7'),_0x9778('0xa8'),_0x9778('0xa9'),'rtpaudioqosloss',_0x9778('0xaa'),_0x9778('0xab'),_0x9778('0xac'),'sipcallid',_0x9778('0xad'),_0x9778('0xae'),_0x9778('0xaf'),_0x9778('0xb0'),'memberdynamic','memberinterface',_0x9778('0xb1'),_0x9778('0x86'),'memberpenalty',_0x9778('0xb2')];if(!_[_0x9778('0x38')](_0x4faa34)&&!_[_0x9778('0xb3')](_0x5831ae,_0x4faa34)){if(_['isUndefined'](this['variables'][_0x348e0d])){this[_0x9778('0x41')][_0x348e0d]={};}this[_0x9778('0x41')][_0x348e0d][_0x4faa34]=_0x184e99;}};VoiceQueueReport[_0x9778('0x34')]['handleHangup']=function(_0x4c8df8,_0x1bc60c,_0x230d2f){try{var _0x3b31bd={};if(this[_0x9778('0xd')][_0x4c8df8]){for(var _0x1a650c=0x0;_0x1a650c{delete this[_0x9778('0x10')][_0x59c52a];},_0x590daa);}};module['exports']=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 1cc2553..e387aa8 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f25=['campaign','queue','Request','CreateReportAgentPreview','../client'];(function(_0x3bc1c5,_0x11adcf){var _0x39e334=function(_0x39975e){while(--_0x39975e){_0x3bc1c5['push'](_0x3bc1c5['shift']());}};_0x39e334(++_0x11adcf);}(_0x3f25,0xb8));var _0x53f2=function(_0x4e6185,_0x2b6343){_0x4e6185=_0x4e6185-0x0;var _0x50f0af=_0x3f25[_0x4e6185];return _0x50f0af;};'use strict';var client=require(_0x53f2('0x0'));exports['createHistory']=function(_0x594a76){return function(){_0x594a76[_0x53f2('0x1')]=_0x594a76[_0x53f2('0x2')];return client[_0x53f2('0x3')](_0x53f2('0x4'),{'body':_0x594a76,'log':_0x53f2('0x4')});};}; \ No newline at end of file +var _0xce88=['queue','Request','CreateReportAgentPreview','../client','campaign'];(function(_0x1c101f,_0x52141d){var _0xe02ee4=function(_0x1d9034){while(--_0x1d9034){_0x1c101f['push'](_0x1c101f['shift']());}};_0xe02ee4(++_0x52141d);}(_0xce88,0x189));var _0x8ce8=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xce88[_0x4709c0];return _0x13348b;};'use strict';var client=require(_0x8ce8('0x0'));exports['createHistory']=function(_0x3e487d){return function(){_0x3e487d[_0x8ce8('0x1')]=_0x3e487d[_0x8ce8('0x2')];return client[_0x8ce8('0x3')](_0x8ce8('0x4'),{'body':_0x3e487d,'log':_0x8ce8('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 3a0c6dc..3d9847f 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa2a1=['Request','CreateAttachment','create'];(function(_0x29f653,_0x15f527){var _0x5cc560=function(_0x3ea5a7){while(--_0x3ea5a7){_0x29f653['push'](_0x29f653['shift']());}};_0x5cc560(++_0x15f527);}(_0xa2a1,0x1b5));var _0x1a2a=function(_0x1d29bc,_0x3a79ab){_0x1d29bc=_0x1d29bc-0x0;var _0x63322d=_0xa2a1[_0x1d29bc];return _0x63322d;};'use strict';var client=require('../client');exports[_0x1a2a('0x0')]=function(_0x47f4e3){return client[_0x1a2a('0x1')](_0x1a2a('0x2'),{'body':_0x47f4e3,'log':_0x1a2a('0x2')});}; \ No newline at end of file +var _0xbe75=['CreateAttachment','../client','Request'];(function(_0x67f1b3,_0x57c488){var _0x2186a2=function(_0x28e716){while(--_0x28e716){_0x67f1b3['push'](_0x67f1b3['shift']());}};_0x2186a2(++_0x57c488);}(_0xbe75,0x193));var _0x5be7=function(_0xacc9f4,_0x3e2618){_0xacc9f4=_0xacc9f4-0x0;var _0x194c0c=_0xbe75[_0xacc9f4];return _0x194c0c;};'use strict';var client=require(_0x5be7('0x0'));exports['create']=function(_0x1befb1){return client[_0x5be7('0x1')](_0x5be7('0x2'),{'body':_0x1befb1,'log':_0x5be7('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index a5708ea..7adb11b 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialPrefix','Trunk','callerid','TrunkBackup','Interval','Intervals','SquareProject','../client','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName'];(function(_0xcaa0df,_0x106a18){var _0x5d8372=function(_0x4949da){while(--_0x4949da){_0xcaa0df['push'](_0xcaa0df['shift']());}};_0x5d8372(++_0x106a18);}(_0x326f,0xd1));var _0xf326=function(_0x4abe1c,_0x2c76bf){_0x4abe1c=_0x4abe1c-0x0;var _0x1f16d1=_0x326f[_0x4abe1c];return _0x1f16d1;};'use strict';var client=require(_0xf326('0x0'));exports['getCampaigns']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'raw':![],'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa'),'dialBusyMaxRetry',_0xf326('0xb'),_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xf326('0xf'),_0xf326('0x10'),_0xf326('0x11'),_0xf326('0x12'),_0xf326('0x13'),'dialAgentRejectMaxRetry',_0xf326('0x14'),'dialTimezone',_0xf326('0x15'),'dialAMDActive',_0xf326('0x16'),'dialAMDGreeting',_0xf326('0x17'),_0xf326('0x18'),'dialAMDMinWordLength',_0xf326('0x19'),_0xf326('0x1a'),_0xf326('0x1b'),_0xf326('0x1c'),'dialOrderByScheduledAt',_0xf326('0x1d'),'dialRandomLastDigitCallerIdNumber','dialCutDigit'],'include':[{'model':_0xf326('0x1e'),'as':_0xf326('0x1e'),'attributes':['id',_0xf326('0x2'),_0xf326('0x1f'),_0xf326('0x4')]},{'model':_0xf326('0x1e'),'as':_0xf326('0x20'),'attributes':['id',_0xf326('0x2'),'callerid',_0xf326('0x4')]},{'model':_0xf326('0x21'),'as':_0xf326('0x21'),'attributes':['id',_0xf326('0x2')],'include':[{'model':_0xf326('0x21'),'as':_0xf326('0x22'),'attributes':['id','name','interval']}]},{'model':'SquareProject','as':_0xf326('0x23'),'attributes':['id',_0xf326('0x2')]}]},'log':'getCampaign'});};}; \ No newline at end of file +var _0x2ef3=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','active','TrunkBackup','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0x2ef3,0xba));var _0x32ef=function(_0x410dd7,_0x3c8de2){_0x410dd7=_0x410dd7-0x0;var _0x5abe4c=_0x2ef3[_0x410dd7];return _0x5abe4c;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),_0x32ef('0x5'),'active',_0x32ef('0x6'),_0x32ef('0x7'),'dialOriginateCallerIdNumber',_0x32ef('0x8'),_0x32ef('0x9'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'dialAMDActive',_0x32ef('0x18'),'dialAMDGreeting',_0x32ef('0x19'),'dialAMDTotalAnalysisTime',_0x32ef('0x1a'),_0x32ef('0x1b'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x32ef('0x1c'),'dialOrderByScheduledAt',_0x32ef('0x1d'),_0x32ef('0x1e'),_0x32ef('0x1f')],'include':[{'model':_0x32ef('0x20'),'as':'Trunk','attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x20'),'as':_0x32ef('0x22'),'attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x23'),'as':_0x32ef('0x23'),'attributes':['id','name'],'include':[{'model':_0x32ef('0x23'),'as':_0x32ef('0x24'),'attributes':['id','name',_0x32ef('0x25')]}]},{'model':_0x32ef('0x26'),'as':_0x32ef('0x26'),'attributes':['id',_0x32ef('0x4')]}]},'log':_0x32ef('0x27')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 9e89f50..d5c84a5 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f78=['getContacts','Request','GetCmContact','CreateCmContact'];(function(_0x58d273,_0x3acead){var _0x39bc68=function(_0x36df36){while(--_0x36df36){_0x58d273['push'](_0x58d273['shift']());}};_0x39bc68(++_0x3acead);}(_0x4f78,0x1d3));var _0x84f7=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0x4f78[_0x26d386];return _0x4ef9a8;};'use strict';var client=require('../client');exports['createContact']=function(_0xcae259){return function(){return client['Request'](_0x84f7('0x0'),{'body':_0xcae259,'log':_0x84f7('0x0')});};};exports[_0x84f7('0x1')]=function(_0x3c5e34){return function(){return client[_0x84f7('0x2')](_0x84f7('0x3'),{'options':_0x3c5e34,'log':_0x84f7('0x3')});};}; \ No newline at end of file +var _0x2045=['CreateCmContact','getContacts','GetCmContact','Request'];(function(_0x314009,_0x228147){var _0x8c8955=function(_0x3ca44b){while(--_0x3ca44b){_0x314009['push'](_0x314009['shift']());}};_0x8c8955(++_0x228147);}(_0x2045,0x177));var _0x5204=function(_0x3b9c71,_0x52bd2f){_0x3b9c71=_0x3b9c71-0x0;var _0x419087=_0x2045[_0x3b9c71];return _0x419087;};'use strict';var client=require('../client');exports['createContact']=function(_0x349c4d){return function(){return client[_0x5204('0x0')](_0x5204('0x1'),{'body':_0x349c4d,'log':_0x5204('0x1')});};};exports[_0x5204('0x2')]=function(_0x420041){return function(){return client[_0x5204('0x0')](_0x5204('0x3'),{'options':_0x420041,'log':'GetCmContact'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index a525703..e5157d4 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6d2=['VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','GetContactDialer','DESC','scheduledat','ASC','getContactDialerIvr','CmContact','priority','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','ContactId','GetCmHopperPreview','Agent','name','VoiceQueue','Queue','unlockContact','getContactRecallMe','GetContactRecallMe','User','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','GetCmHopper','Contact','getCmHopper','updateContacts','Request','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ListId'];(function(_0x41a62a,_0x1112f9){var _0x4d9425=function(_0x3b1e41){while(--_0x3b1e41){_0x41a62a['push'](_0x41a62a['shift']());}};_0x4d9425(++_0x1112f9);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x12b427,_0x29f4c7){_0x12b427=_0x12b427-0x0;var _0x41a4be=_0xd6d2[_0x12b427];return _0x41a4be;};'use strict';var client=require(_0x2d6d('0x0'));var moment=require(_0x2d6d('0x1'));exports['getContacts']=function(_0x19be1a,_0x224caa){return function(){return client['Request'](_0x2d6d('0x2'),{'options':{'where':{'VoiceQueueId':_0x19be1a},'include':[{'model':'CmContact','as':_0x2d6d('0x3')}],'limit':_0x224caa,'raw':![]},'log':_0x2d6d('0x4')});};};exports[_0x2d6d('0x5')]=function(_0x4a4c5e,_0xfcdb1d,_0x132361){return function(){return client[_0x2d6d('0x6')](_0x2d6d('0x7'),{'body':_0x4a4c5e,'options':{'where':{'VoiceQueueId':_0xfcdb1d,'scheduledat':{'$lte':moment()[_0x2d6d('0x8')](_0x2d6d('0x9'))}},'limit':_0x132361},'log':_0x2d6d('0x7')});};};exports[_0x2d6d('0xa')]=function(_0x8e4be8){return client[_0x2d6d('0x6')](_0x2d6d('0x7'),{'body':_0x8e4be8,'options':{'where':{'ContactId':_0x8e4be8['ContactId'],'ListId':_0x8e4be8[_0x2d6d('0xb')],'VoiceQueueId':_0x8e4be8[_0x2d6d('0xc')],'CampaignId':_0x8e4be8[_0x2d6d('0xd')]}},'log':_0x2d6d('0xa')});};exports[_0x2d6d('0xe')]=function(_0x4f1a98,_0x131751,_0x171940){return function(){return client[_0x2d6d('0x6')](_0x2d6d('0xf'),{'options':{'where':{'VoiceQueueId':_0x4f1a98,'ListId':_0x131751,'ContactId':_0x171940}},'log':_0x2d6d('0xf')});};};exports['getContactDialer']=function(_0x1a2275,_0x156188,_0x46c909,_0x3528de){return client['Request'](_0x2d6d('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1a2275,'active':![],'scheduledat':{'$lte':moment()[_0x2d6d('0x8')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x156188}}]},'order':[['priority',_0x2d6d('0x11')],[_0x2d6d('0x12'),_0x3528de],['id',_0x2d6d('0x13')]],'raw':!![],'limit':_0x46c909},'log':'GetContactDialer'});};exports[_0x2d6d('0x14')]=function(_0x5b8d81,_0x55c1fc,_0x4c3092){return client[_0x2d6d('0x6')](_0x2d6d('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5b8d81,'active':![],'scheduledat':{'$lte':moment()[_0x2d6d('0x8')](_0x2d6d('0x9'))}},'include':[{'model':_0x2d6d('0x15'),'as':_0x2d6d('0x3')}],'order':[[_0x2d6d('0x16'),_0x2d6d('0x11')],[_0x2d6d('0x12'),_0x4c3092],['id','ASC']],'raw':!![],'limit':_0x55c1fc},'log':_0x2d6d('0x17')});};exports[_0x2d6d('0x18')]=function(_0x5b0c61,_0x227e44){_0x5b0c61[_0x2d6d('0x19')]=_0x5b0c61[_0x2d6d('0x1a')];return client[_0x2d6d('0x6')](_0x2d6d('0x1b'),{'body':_0x5b0c61,'options':{'where':{'ContactId':_0x5b0c61[_0x2d6d('0x1c')],'ListId':_0x5b0c61['ListId'],'VoiceQueueId':_0x5b0c61[_0x2d6d('0xc')],'CampaignId':_0x5b0c61[_0x2d6d('0xd')],'active':_0x227e44?undefined:!![]}},'log':_0x2d6d('0x1b')});};exports['countReScheduled']=function(_0x47eb0e){return client[_0x2d6d('0x6')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x47eb0e['id']?_0x47eb0e['id']||null:null}},'log':'countReScheduled'});};exports['getContactPreview']=function(_0x14f291){return function(){return client[_0x2d6d('0x6')](_0x2d6d('0x1d'),{'options':{'where':{'id':_0x14f291},'include':[{'model':_0x2d6d('0x15'),'as':_0x2d6d('0x3')},{'model':'User','as':_0x2d6d('0x1e'),'attributes':['id',_0x2d6d('0x1f')]},{'model':_0x2d6d('0x20'),'as':_0x2d6d('0x21'),'attributes':['id',_0x2d6d('0x1f')]}],'raw':!![]},'log':_0x2d6d('0x4')});};};exports[_0x2d6d('0x22')]=function(_0x28e182,_0x27b7d2,_0x4a1c30){return client[_0x2d6d('0x6')](_0x2d6d('0x7'),{'body':_0x28e182,'options':{'where':{'id':_0x27b7d2},'limit':_0x4a1c30},'log':_0x2d6d('0x7')});};exports[_0x2d6d('0x23')]=function(_0x486963,_0x317bde){return function(){return client['Request'](_0x2d6d('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x486963,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x317bde}},'order':[[_0x2d6d('0x16'),'DESC'],[_0x2d6d('0x12'),_0x2d6d('0x11')],['id','ASC']],'include':[{'model':_0x2d6d('0x15'),'as':'Contact'},{'model':_0x2d6d('0x25'),'as':_0x2d6d('0x1e'),'attributes':['id',_0x2d6d('0x1f'),_0x2d6d('0x26')]}],'group':_0x2d6d('0x27'),'raw':!![]},'log':_0x2d6d('0x10')});};};exports[_0x2d6d('0x28')]=function(_0x3450fc,_0x598d8b){return client[_0x2d6d('0x6')](_0x2d6d('0x29'),{'body':_0x3450fc,'options':_0x598d8b||{},'log':'ResetActiveCalls'});};exports[_0x2d6d('0x2a')]=function(_0xf2b497,_0x1d363a,_0x3aed80){return function(){return client[_0x2d6d('0x6')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0xf2b497,'interval':_0x1d363a,'availableAgentsIds':_0x3aed80}},'log':'handlePreviewRecallNotifications'});};}; \ No newline at end of file +var _0xff3c=['moment','CmContact','Contact','getCmHopper','updateContacts','UpdateCmHopper','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','Request','ContactId','ListId','VoiceQueueId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','format','DESC','ASC','getContactDialerIvr','scheduledat','moveContactManagedDialer','queue','MoveContactManagedDialer','countReScheduled','GetCmHopperPreview','Agent','VoiceQueue','Queue','name','unlockContact','getContactRecallMe','GetContactRecallMe','priority','User','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client'];(function(_0x5d82e6,_0x7bbef7){var _0x464c67=function(_0x254ae0){while(--_0x254ae0){_0x5d82e6['push'](_0x5d82e6['shift']());}};_0x464c67(++_0x7bbef7);}(_0xff3c,0x179));var _0xcff3=function(_0x30df14,_0x5034f4){_0x30df14=_0x30df14-0x0;var _0x3795c0=_0xff3c[_0x30df14];return _0x3795c0;};'use strict';var client=require(_0xcff3('0x0'));var moment=require(_0xcff3('0x1'));exports['getContacts']=function(_0x1c3482,_0x832575){return function(){return client['Request']('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x1c3482},'include':[{'model':_0xcff3('0x2'),'as':_0xcff3('0x3')}],'limit':_0x832575,'raw':![]},'log':_0xcff3('0x4')});};};exports[_0xcff3('0x5')]=function(_0x1279e5,_0x308a82,_0x47b899){return function(){return client['Request'](_0xcff3('0x6'),{'body':_0x1279e5,'options':{'where':{'VoiceQueueId':_0x308a82,'scheduledat':{'$lte':moment()['format'](_0xcff3('0x7'))}},'limit':_0x47b899},'log':'UpdateCmHopper'});};};exports[_0xcff3('0x8')]=function(_0x3d9aec){return client[_0xcff3('0x9')](_0xcff3('0x6'),{'body':_0x3d9aec,'options':{'where':{'ContactId':_0x3d9aec[_0xcff3('0xa')],'ListId':_0x3d9aec[_0xcff3('0xb')],'VoiceQueueId':_0x3d9aec[_0xcff3('0xc')],'CampaignId':_0x3d9aec['CampaignId']}},'log':'rescheduleContact'});};exports[_0xcff3('0xd')]=function(_0x26ce90,_0x3e5fbc,_0x3da4ca){return function(){return client[_0xcff3('0x9')](_0xcff3('0xe'),{'options':{'where':{'VoiceQueueId':_0x26ce90,'ListId':_0x3e5fbc,'ContactId':_0x3da4ca}},'log':_0xcff3('0xe')});};};exports[_0xcff3('0xf')]=function(_0xc7d33d,_0x3674cc,_0x2ac0fc,_0x155309){return client[_0xcff3('0x9')](_0xcff3('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xc7d33d,'active':![],'scheduledat':{'$lte':moment()[_0xcff3('0x11')](_0xcff3('0x7'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x3674cc}}]},'order':[['priority',_0xcff3('0x12')],['scheduledat',_0x155309],['id',_0xcff3('0x13')]],'raw':!![],'limit':_0x2ac0fc},'log':_0xcff3('0x10')});};exports[_0xcff3('0x14')]=function(_0x5d923e,_0xa95fcd,_0xb9df6e){return client['Request'](_0xcff3('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5d923e,'active':![],'scheduledat':{'$lte':moment()['format'](_0xcff3('0x7'))}},'include':[{'model':_0xcff3('0x2'),'as':_0xcff3('0x3')}],'order':[['priority','DESC'],[_0xcff3('0x15'),_0xb9df6e],['id',_0xcff3('0x13')]],'raw':!![],'limit':_0xa95fcd},'log':'GetContactDialerIvr'});};exports[_0xcff3('0x16')]=function(_0x517f33,_0x2a90d3){_0x517f33['campaign']=_0x517f33[_0xcff3('0x17')];return client['Request'](_0xcff3('0x18'),{'body':_0x517f33,'options':{'where':{'ContactId':_0x517f33['ContactId'],'ListId':_0x517f33[_0xcff3('0xb')],'VoiceQueueId':_0x517f33[_0xcff3('0xc')],'CampaignId':_0x517f33['CampaignId'],'active':_0x2a90d3?undefined:!![]}},'log':_0xcff3('0x18')});};exports[_0xcff3('0x19')]=function(_0x8025c2){return client[_0xcff3('0x9')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x8025c2['id']?_0x8025c2['id']||null:null}},'log':_0xcff3('0x19')});};exports['getContactPreview']=function(_0x51a872){return function(){return client[_0xcff3('0x9')](_0xcff3('0x1a'),{'options':{'where':{'id':_0x51a872},'include':[{'model':_0xcff3('0x2'),'as':_0xcff3('0x3')},{'model':'User','as':_0xcff3('0x1b'),'attributes':['id','name']},{'model':_0xcff3('0x1c'),'as':_0xcff3('0x1d'),'attributes':['id',_0xcff3('0x1e')]}],'raw':!![]},'log':_0xcff3('0x4')});};};exports[_0xcff3('0x1f')]=function(_0x145ac6,_0x4557d0,_0xb9c78b){return client[_0xcff3('0x9')](_0xcff3('0x6'),{'body':_0x145ac6,'options':{'where':{'id':_0x4557d0},'limit':_0xb9c78b},'log':_0xcff3('0x6')});};exports[_0xcff3('0x20')]=function(_0x400982,_0x3d1b5d){return function(){return client[_0xcff3('0x9')](_0xcff3('0x21'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x400982,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xcff3('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x3d1b5d}},'order':[[_0xcff3('0x22'),_0xcff3('0x12')],['scheduledat',_0xcff3('0x12')],['id','ASC']],'include':[{'model':_0xcff3('0x2'),'as':_0xcff3('0x3')},{'model':_0xcff3('0x23'),'as':_0xcff3('0x1b'),'attributes':['id',_0xcff3('0x1e'),_0xcff3('0x24')]}],'group':_0xcff3('0x25'),'raw':!![]},'log':_0xcff3('0x10')});};};exports[_0xcff3('0x26')]=function(_0x57c761,_0x142799){return client['Request'](_0xcff3('0x27'),{'body':_0x57c761,'options':_0x142799||{},'log':'ResetActiveCalls'});};exports[_0xcff3('0x28')]=function(_0x57af6b,_0x5f551a,_0x28152b){return function(){return client[_0xcff3('0x9')](_0xcff3('0x29'),{'body':{'where':{'voiceQueueIds':_0x57af6b,'interval':_0x5f551a,'availableAgentsIds':_0x28152b}},'log':_0xcff3('0x28')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 53c215d..62772b1 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedb6=['VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request'];(function(_0x2114ac,_0x5ac291){var _0x267b0b=function(_0x30ee68){while(--_0x30ee68){_0x2114ac['push'](_0x2114ac['shift']());}};_0x267b0b(++_0x5ac291);}(_0xedb6,0x155));var _0x6edb=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xedb6[_0x4c0622];return _0x1799d8;};'use strict';var client=require(_0x6edb('0x0'));exports[_0x6edb('0x1')]=function(_0x232f9b,_0x21556a,_0x32da95){return client[_0x6edb('0x2')](_0x6edb('0x3'),{'body':_0x232f9b,'reason':_0x21556a,'entity':_0x32da95,'log':_0x6edb('0x3')});};exports[_0x6edb('0x4')]=function(_0x45d562,_0x145867,_0x18bb96){return client[_0x6edb('0x2')](_0x6edb('0x5'),{'body':_0x45d562,'duration':_0x145867,'waitTime':_0x18bb96,'log':_0x6edb('0x5')});};exports[_0x6edb('0x6')]=function(_0x160191){return function(){return client[_0x6edb('0x2')](_0x6edb('0x7'),{'body':_0x160191,'log':_0x6edb('0x7')});};}; \ No newline at end of file +var _0x940d=['swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones'];(function(_0x522f2b,_0x95c3c1){var _0x2bb579=function(_0x1a0c88){while(--_0x1a0c88){_0x522f2b['push'](_0x522f2b['shift']());}};_0x2bb579(++_0x95c3c1);}(_0x940d,0x74));var _0xd940=function(_0x16086d,_0x275617){_0x16086d=_0x16086d-0x0;var _0x350bfa=_0x940d[_0x16086d];return _0x350bfa;};'use strict';var client=require(_0xd940('0x0'));exports[_0xd940('0x1')]=function(_0x12c71f,_0x1f567d,_0x143ced){return client[_0xd940('0x2')](_0xd940('0x3'),{'body':_0x12c71f,'reason':_0x1f567d,'entity':_0x143ced,'log':'VerifyAdditionalPhones'});};exports[_0xd940('0x4')]=function(_0x59933d,_0x76d1d9,_0x15c017){return client[_0xd940('0x2')](_0xd940('0x5'),{'body':_0x59933d,'duration':_0x76d1d9,'waitTime':_0x15c017,'log':_0xd940('0x5')});};exports[_0xd940('0x6')]=function(_0x5602b4){return function(){return client[_0xd940('0x2')]('IncrementPreviewCounters',{'body':_0x5602b4,'log':_0xd940('0x7')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 8275161..092b119 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8b5=['checkIsBlackList','Request','VoiceQueueId','phone','GetCmHopperBlack','checkIsBlackListIvr','CampaignId','../client'];(function(_0x590efc,_0x5e23b0){var _0x52524e=function(_0x50a1ae){while(--_0x50a1ae){_0x590efc['push'](_0x590efc['shift']());}};_0x52524e(++_0x5e23b0);}(_0xa8b5,0xdf));var _0x5a8b=function(_0x30586c,_0x71b06d){_0x30586c=_0x30586c-0x0;var _0x386dce=_0xa8b5[_0x30586c];return _0x386dce;};'use strict';var client=require(_0x5a8b('0x0'));exports[_0x5a8b('0x1')]=function(_0x3281fe){return client[_0x5a8b('0x2')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x3281fe[_0x5a8b('0x3')],'phone':_0x3281fe[_0x5a8b('0x4')]},'raw':![]},'log':_0x5a8b('0x5')});};exports[_0x5a8b('0x6')]=function(_0x583158){return client[_0x5a8b('0x2')](_0x5a8b('0x5'),{'options':{'where':{'CampaignId':_0x583158[_0x5a8b('0x7')],'phone':_0x583158['phone']},'raw':![]},'log':'GetCmHopperBlackIvr'});}; \ No newline at end of file +var _0xcdcc=['../client','checkIsBlackList','Request','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr','GetCmHopperBlackIvr'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xcdcc,0x138));var _0xccdc=function(_0x14ca78,_0x284b65){_0x14ca78=_0x14ca78-0x0;var _0x22b766=_0xcdcc[_0x14ca78];return _0x22b766;};'use strict';var client=require(_0xccdc('0x0'));exports[_0xccdc('0x1')]=function(_0x230b72){return client[_0xccdc('0x2')](_0xccdc('0x3'),{'options':{'where':{'VoiceQueueId':_0x230b72[_0xccdc('0x4')],'phone':_0x230b72[_0xccdc('0x5')]},'raw':![]},'log':_0xccdc('0x3')});};exports[_0xccdc('0x6')]=function(_0x213dd6){return client[_0xccdc('0x2')](_0xccdc('0x3'),{'options':{'where':{'CampaignId':_0x213dd6['CampaignId'],'phone':_0x213dd6[_0xccdc('0x5')]},'raw':![]},'log':_0xccdc('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 2444c0e..d63e80e 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57e7=['queue','Request','CreateCmHopperFinal','../client','campaign'];(function(_0x35fcb7,_0x70fe1b){var _0x112a86=function(_0x340ec4){while(--_0x340ec4){_0x35fcb7['push'](_0x35fcb7['shift']());}};_0x112a86(++_0x70fe1b);}(_0x57e7,0x152));var _0x757e=function(_0x3ac1fc,_0x1e9f4e){_0x3ac1fc=_0x3ac1fc-0x0;var _0x58d08f=_0x57e7[_0x3ac1fc];return _0x58d08f;};'use strict';var client=require(_0x757e('0x0'));exports['createContact']=function(_0x370389){return function(){_0x370389[_0x757e('0x1')]=_0x370389[_0x757e('0x2')];return client[_0x757e('0x3')](_0x757e('0x4'),{'body':_0x370389,'log':_0x757e('0x4')});};}; \ No newline at end of file +var _0xfd6a=['Request','CreateCmHopperFinal','../client','queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd6a,0x156));var _0xafd6=function(_0x5a2c9b,_0x4b27fb){_0x5a2c9b=_0x5a2c9b-0x0;var _0x5f5927=_0xfd6a[_0x5a2c9b];return _0x5f5927;};'use strict';var client=require(_0xafd6('0x0'));exports['createContact']=function(_0x37ff4f){return function(){_0x37ff4f['campaign']=_0x37ff4f[_0xafd6('0x1')];return client[_0xafd6('0x2')](_0xafd6('0x3'),{'body':_0x37ff4f,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 5ee2861..f0525e9 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34f3=['Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','day','getCampaignHopperHistory','startOf','endOf','ivr','GetCampaignHopperHistory','../client','campaign','queue'];(function(_0x1b7811,_0x2adcc3){var _0x409f6a=function(_0x50af29){while(--_0x50af29){_0x1b7811['push'](_0x1b7811['shift']());}};_0x409f6a(++_0x2adcc3);}(_0x34f3,0xbb));var _0x334f=function(_0x268d10,_0x290dd6){_0x268d10=_0x268d10-0x0;var _0x12cfe6=_0x34f3[_0x268d10];return _0x12cfe6;};'use strict';var client=require(_0x334f('0x0'));var moment=require('moment');exports['createHistory']=function(_0x5197eb){_0x5197eb[_0x334f('0x1')]=_0x5197eb[_0x334f('0x2')];return client[_0x334f('0x3')](_0x334f('0x4'),{'body':_0x5197eb,'log':_0x334f('0x4')});};exports[_0x334f('0x5')]=function(_0x1cfd62){return client['Request'](_0x334f('0x6'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x1cfd62,_0x334f('0x7'))[_0x334f('0x8')](_0x334f('0x9')),moment()['format'](_0x334f('0x9'))]}},'raw':![]},'log':_0x334f('0xa')});};exports[_0x334f('0xb')]=function(){return function(){return client[_0x334f('0x3')](_0x334f('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x334f('0xd'))['format'](_0x334f('0x9')),moment()['endOf'](_0x334f('0xd'))['format'](_0x334f('0x9'))]},'campaigntype':_0x334f('0x2')},'raw':![]},'log':_0x334f('0xc')});};};exports[_0x334f('0xe')]=function(){return function(){return client[_0x334f('0x3')]('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x334f('0xf')](_0x334f('0xd'))[_0x334f('0x8')](_0x334f('0x9')),moment()[_0x334f('0x10')](_0x334f('0xd'))[_0x334f('0x8')](_0x334f('0x9'))]},'campaigntype':_0x334f('0x11')},'raw':![]},'log':_0x334f('0x12')});};}; \ No newline at end of file +var _0xf418=['queue','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetVoiceQueueHopperHistory','startOf','endOf','getCampaignHopperHistory','GetCampaignHopperHistory','day','ivr','../client','createHistory','campaign'];(function(_0x47b7cb,_0x59ea30){var _0x1a8954=function(_0x55252d){while(--_0x55252d){_0x47b7cb['push'](_0x47b7cb['shift']());}};_0x1a8954(++_0x59ea30);}(_0xf418,0x1e3));var _0x8f41=function(_0x1836a3,_0x451c85){_0x1836a3=_0x1836a3-0x0;var _0x5af435=_0xf418[_0x1836a3];return _0x5af435;};'use strict';var client=require(_0x8f41('0x0'));var moment=require('moment');exports[_0x8f41('0x1')]=function(_0x5afe5c){_0x5afe5c[_0x8f41('0x2')]=_0x5afe5c[_0x8f41('0x3')];return client[_0x8f41('0x4')](_0x8f41('0x5'),{'body':_0x5afe5c,'log':'CreateCmHopperHistory'});};exports[_0x8f41('0x6')]=function(_0x1627bd){return client[_0x8f41('0x4')](_0x8f41('0x7'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x1627bd,_0x8f41('0x8'))[_0x8f41('0x9')](_0x8f41('0xa')),moment()[_0x8f41('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]}},'raw':![]},'log':'GetCmHopperHistory'});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0x8f41('0x4')](_0x8f41('0xb'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x8f41('0xc')]('day')[_0x8f41('0x9')](_0x8f41('0xa')),moment()[_0x8f41('0xd')]('day')[_0x8f41('0x9')](_0x8f41('0xa'))]},'campaigntype':_0x8f41('0x3')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0x8f41('0xe')]=function(){return function(){return client[_0x8f41('0x4')](_0x8f41('0xf'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x8f41('0xc')](_0x8f41('0x10'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')[_0x8f41('0x9')](_0x8f41('0xa'))]},'campaigntype':_0x8f41('0x11')},'raw':![]},'log':_0x8f41('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index a00cff9..b6365ea 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb8d=['notify','NotifyFaxAccount','../client','Request','ecm','headerinfo','localstationid','minrate','maxrate','gateway','faxdetect','t38timeout','tech','ListId','Trunk','callerid','active','getFaxAccount'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xbb8d,0x146));var _0xdbb8=function(_0x1182a4,_0x5cfa2f){_0x1182a4=_0x1182a4-0x0;var _0x444039=_0xbb8d[_0x1182a4];return _0x444039;};'use strict';var client=require(_0xdbb8('0x0'));exports['getFaxAccounts']=function(){return function(){return client[_0xdbb8('0x1')]('GetFaxAccount',{'options':{'raw':![],'attributes':['id','name','description',_0xdbb8('0x2'),_0xdbb8('0x3'),_0xdbb8('0x4'),_0xdbb8('0x5'),_0xdbb8('0x6'),'modem',_0xdbb8('0x7'),_0xdbb8('0x8'),_0xdbb8('0x9'),_0xdbb8('0xa'),'TrunkId',_0xdbb8('0xb'),'key'],'include':[{'model':_0xdbb8('0xc'),'as':_0xdbb8('0xc'),'attributes':['id','name',_0xdbb8('0xd'),_0xdbb8('0xe')]}]},'log':_0xdbb8('0xf')});};};exports[_0xdbb8('0x10')]=function(_0x2eb417,_0xee681f){return client[_0xdbb8('0x1')](_0xdbb8('0x11'),{'account':{'id':_0x2eb417},'body':_0xee681f,'log':_0xdbb8('0x11')});}; \ No newline at end of file +var _0x937d=['headerinfo','localstationid','minrate','modem','gateway','faxdetect','tech','TrunkId','key','Trunk','callerid','getFaxAccount','Request','NotifyFaxAccount','../client','name','description','ecm'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x937d,0x1f4));var _0xd937=function(_0x1a96dc,_0x2eb8ff){_0x1a96dc=_0x1a96dc-0x0;var _0x53c749=_0x937d[_0x1a96dc];return _0x53c749;};'use strict';var client=require(_0xd937('0x0'));exports['getFaxAccounts']=function(){return function(){return client['Request']('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0xd937('0x1'),_0xd937('0x2'),_0xd937('0x3'),_0xd937('0x4'),_0xd937('0x5'),_0xd937('0x6'),'maxrate',_0xd937('0x7'),_0xd937('0x8'),_0xd937('0x9'),'t38timeout',_0xd937('0xa'),_0xd937('0xb'),'ListId',_0xd937('0xc')],'include':[{'model':_0xd937('0xd'),'as':_0xd937('0xd'),'attributes':['id',_0xd937('0x1'),_0xd937('0xe'),'active']}]},'log':_0xd937('0xf')});};};exports['notify']=function(_0xd8f575,_0x4db1e1){return client[_0xd937('0x10')](_0xd937('0x11'),{'account':{'id':_0xd8f575},'body':_0x4db1e1,'log':_0xd937('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index ffceb53..c95cc69 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0f9=['UpdateFaxMessage','../client','Request'];(function(_0xaceaf3,_0x58d051){var _0x365b83=function(_0x910c40){while(--_0x910c40){_0xaceaf3['push'](_0xaceaf3['shift']());}};_0x365b83(++_0x58d051);}(_0xb0f9,0x1d2));var _0x9b0f=function(_0x581b73,_0x4fa43c){_0x581b73=_0x581b73-0x0;var _0x3ea0ec=_0xb0f9[_0x581b73];return _0x3ea0ec;};'use strict';var client=require(_0x9b0f('0x0'));exports['update']=function(_0x3205f5,_0x3df779){return client[_0x9b0f('0x1')](_0x9b0f('0x2'),{'body':_0x3df779,'options':{'where':{'AttachmentId':_0x3205f5}},'log':_0x9b0f('0x2')});}; \ No newline at end of file +var _0x20f1=['../client','update','Request','UpdateFaxMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x20f1,0x74));var _0x120f=function(_0x5aaf45,_0x2a0aed){_0x5aaf45=_0x5aaf45-0x0;var _0x44c6b5=_0x20f1[_0x5aaf45];return _0x44c6b5;};'use strict';var client=require(_0x120f('0x0'));exports[_0x120f('0x1')]=function(_0xaa5cfc,_0x68b5f1){return client[_0x120f('0x2')]('UpdateFaxMessage',{'body':_0x68b5f1,'options':{'where':{'AttachmentId':_0xaa5cfc}},'log':_0x120f('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index ad8bc10..3f2a783 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2322=['Subjects','content','variableName','Variable','Descriptions','key','keyType','Fields','idField','nameField','customField','Tag','Tags','../../client','Request','GetDeskAccount','username','password','remoteUri','authType','type','Configurations','name','DeskField'];(function(_0x13404a,_0xd9ad06){var _0x161d49=function(_0x5b23fd){while(--_0x5b23fd){_0x13404a['push'](_0x13404a['shift']());}};_0x161d49(++_0xd9ad06);}(_0x2322,0x85));var _0x2232=function(_0x220c4a,_0x8e56d3){_0x220c4a=_0x220c4a-0x0;var _0x1d8554=_0x2322[_0x220c4a];return _0x1d8554;};'use strict';var client=require(_0x2232('0x0'));exports['getDeskAccounts']=function(){return function(_0x18eb59){return client[_0x2232('0x1')](_0x2232('0x2'),{'options':{'raw':![],'attributes':['id','name','description',_0x2232('0x3'),_0x2232('0x4'),_0x2232('0x5'),_0x2232('0x6'),_0x2232('0x7'),'serverUrl'],'include':[{'model':'DeskConfiguration','as':_0x2232('0x8'),'attributes':['id',_0x2232('0x9')],'include':[{'model':_0x2232('0xa'),'as':_0x2232('0xb'),'attributes':['id',_0x2232('0x7'),_0x2232('0xc'),_0x2232('0xd')],'include':[{'model':_0x2232('0xe'),'as':_0x2232('0xe'),'attributes':['id',_0x2232('0x9')]}]},{'model':_0x2232('0xa'),'as':_0x2232('0xf'),'attributes':['id','type',_0x2232('0xc'),_0x2232('0x10'),_0x2232('0x11'),'keyContent',_0x2232('0xd')],'include':[{'model':_0x2232('0xe'),'as':_0x2232('0xe'),'attributes':['id','name']}]},{'model':'DeskField','as':_0x2232('0x12'),'attributes':['id',_0x2232('0x7'),_0x2232('0xc'),_0x2232('0x13'),_0x2232('0x14'),_0x2232('0x15'),_0x2232('0xd')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0x2232('0x16'),'as':_0x2232('0x17'),'attributes':['id',_0x2232('0x9')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file +var _0x0698=['name','description','username','password','remoteUri','type','serverUrl','DeskConfiguration','DeskField','Subjects','content','variableName','Variable','key','keyType','keyContent','Fields','idField','nameField','customField','Tag','../../client','getDeskAccounts','Request','GetDeskAccount'];(function(_0xb07df9,_0x327abe){var _0x5187f0=function(_0x4ec973){while(--_0x4ec973){_0xb07df9['push'](_0xb07df9['shift']());}};_0x5187f0(++_0x327abe);}(_0x0698,0xf6));var _0x8069=function(_0x303766,_0x55bdd2){_0x303766=_0x303766-0x0;var _0x184ea9=_0x0698[_0x303766];return _0x184ea9;};'use strict';var client=require(_0x8069('0x0'));exports[_0x8069('0x1')]=function(){return function(_0x533ec6){return client[_0x8069('0x2')](_0x8069('0x3'),{'options':{'raw':![],'attributes':['id',_0x8069('0x4'),_0x8069('0x5'),_0x8069('0x6'),_0x8069('0x7'),_0x8069('0x8'),'authType',_0x8069('0x9'),_0x8069('0xa')],'include':[{'model':_0x8069('0xb'),'as':'Configurations','attributes':['id',_0x8069('0x4')],'include':[{'model':_0x8069('0xc'),'as':_0x8069('0xd'),'attributes':['id',_0x8069('0x9'),_0x8069('0xe'),_0x8069('0xf')],'include':[{'model':_0x8069('0x10'),'as':_0x8069('0x10'),'attributes':['id',_0x8069('0x4')]}]},{'model':_0x8069('0xc'),'as':'Descriptions','attributes':['id',_0x8069('0x9'),_0x8069('0xe'),_0x8069('0x11'),_0x8069('0x12'),_0x8069('0x13'),'variableName'],'include':[{'model':_0x8069('0x10'),'as':'Variable','attributes':['id',_0x8069('0x4')]}]},{'model':'DeskField','as':_0x8069('0x14'),'attributes':['id',_0x8069('0x9'),_0x8069('0xe'),_0x8069('0x15'),_0x8069('0x16'),_0x8069('0x17'),'variableName'],'include':[{'model':_0x8069('0x10'),'as':_0x8069('0x10'),'attributes':['id',_0x8069('0x4')]}]},{'model':_0x8069('0x18'),'as':'Tags','attributes':['id',_0x8069('0x4')]}]}]},'log':_0x8069('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 3d8c440..72e661d 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bc6=['tenantId','clientId','clientSecret','serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','additionalSearchContact','Dynamics365Field','type','content','variableName','key','keyType','Variable','Fields','idField','nameField','customField','CloudProvider','data2','data5','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','remoteUri'];(function(_0x2fce80,_0x257022){var _0x200ea3=function(_0x1b1490){while(--_0x1b1490){_0x2fce80['push'](_0x2fce80['shift']());}};_0x200ea3(++_0x257022);}(_0x1bc6,0x94));var _0x61bc=function(_0x413f2a,_0x1006e4){_0x413f2a=_0x413f2a-0x0;var _0x1932ec=_0x1bc6[_0x413f2a];return _0x1932ec;};'use strict';var client=require(_0x61bc('0x0'));exports[_0x61bc('0x1')]=function(){return function(_0x396bc0){return client[_0x61bc('0x2')](_0x61bc('0x3'),{'options':{'raw':![],'attributes':['id',_0x61bc('0x4'),_0x61bc('0x5'),'password',_0x61bc('0x6'),_0x61bc('0x7'),_0x61bc('0x8'),_0x61bc('0x9'),_0x61bc('0xa'),_0x61bc('0xb'),_0x61bc('0xc')],'include':[{'model':_0x61bc('0xd'),'as':_0x61bc('0xe'),'attributes':['id','name',_0x61bc('0xf'),'moduleCreate',_0x61bc('0x10'),'openNewTab'],'include':[{'model':_0x61bc('0x11'),'as':'Subjects','attributes':['id',_0x61bc('0x12'),_0x61bc('0x13'),_0x61bc('0x14')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':'Dynamics365Field','as':'Descriptions','attributes':['id',_0x61bc('0x12'),'content',_0x61bc('0x15'),_0x61bc('0x16'),'keyContent','variableName'],'include':[{'model':'Variable','as':_0x61bc('0x17'),'attributes':['id',_0x61bc('0x4')]}]},{'model':'Dynamics365Field','as':_0x61bc('0x18'),'attributes':['id',_0x61bc('0x12'),_0x61bc('0x13'),_0x61bc('0x19'),_0x61bc('0x1a'),_0x61bc('0x1b'),'variableName'],'include':[{'model':_0x61bc('0x17'),'as':_0x61bc('0x17'),'attributes':['id','name']}]}]},{'model':'CloudProvider','as':_0x61bc('0x1c'),'attributes':['id',_0x61bc('0x1d'),_0x61bc('0x1e'),'data7']}]},'log':_0x61bc('0x3')});};}; \ No newline at end of file +var _0xd7d1=['Fields','nameField','customField','CloudProvider','data5','data7','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','type','variableName','Variable','Descriptions','content','keyContent'];(function(_0x31ed12,_0x2a38f9){var _0x1afd40=function(_0x23a8ca){while(--_0x23a8ca){_0x31ed12['push'](_0x31ed12['shift']());}};_0x1afd40(++_0x2a38f9);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x10090c,_0xa5d83a){_0x10090c=_0x10090c-0x0;var _0x4c2fe6=_0xd7d1[_0x10090c];return _0x4c2fe6;};'use strict';var client=require(_0x1d7d('0x0'));exports[_0x1d7d('0x1')]=function(){return function(_0xce4540){return client[_0x1d7d('0x2')](_0x1d7d('0x3'),{'options':{'raw':![],'attributes':['id',_0x1d7d('0x4'),_0x1d7d('0x5'),_0x1d7d('0x6'),_0x1d7d('0x7'),_0x1d7d('0x8'),_0x1d7d('0x9'),_0x1d7d('0xa'),_0x1d7d('0xb'),'description',_0x1d7d('0xc')],'include':[{'model':_0x1d7d('0xd'),'as':_0x1d7d('0xe'),'attributes':['id',_0x1d7d('0x4'),_0x1d7d('0xf'),_0x1d7d('0x10'),_0x1d7d('0x11'),_0x1d7d('0x12')],'include':[{'model':_0x1d7d('0x13'),'as':_0x1d7d('0x14'),'attributes':['id',_0x1d7d('0x15'),'content',_0x1d7d('0x16')],'include':[{'model':'Variable','as':_0x1d7d('0x17'),'attributes':['id',_0x1d7d('0x4')]}]},{'model':_0x1d7d('0x13'),'as':_0x1d7d('0x18'),'attributes':['id','type',_0x1d7d('0x19'),'key','keyType',_0x1d7d('0x1a'),_0x1d7d('0x16')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x1d7d('0x4')]}]},{'model':_0x1d7d('0x13'),'as':_0x1d7d('0x1b'),'attributes':['id',_0x1d7d('0x15'),_0x1d7d('0x19'),'idField',_0x1d7d('0x1c'),_0x1d7d('0x1d'),'variableName'],'include':[{'model':_0x1d7d('0x17'),'as':_0x1d7d('0x17'),'attributes':['id',_0x1d7d('0x4')]}]}]},{'model':_0x1d7d('0x1e'),'as':_0x1d7d('0x1e'),'attributes':['id','data2',_0x1d7d('0x1f'),_0x1d7d('0x20')]}]},'log':'GetDynamics365Account'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 78c71de..9325acf 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe486=['name','username','serverUrl','FreshdeskConfiguration','Configurations','FreshdeskField','Subjects','type','content','Variable','Descriptions','key','keyContent','Fields','idField','nameField','customField','variableName','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount'];(function(_0x3cc3da,_0x1f0ea6){var _0x51ddb1=function(_0x45b75d){while(--_0x45b75d){_0x3cc3da['push'](_0x3cc3da['shift']());}};_0x51ddb1(++_0x1f0ea6);}(_0xe486,0x6a));var _0x6e48=function(_0x5c8d6f,_0x3eb58){_0x5c8d6f=_0x5c8d6f-0x0;var _0x336076=_0xe486[_0x5c8d6f];return _0x336076;};'use strict';var client=require(_0x6e48('0x0'));exports[_0x6e48('0x1')]=function(){return function(_0x413074){return client[_0x6e48('0x2')](_0x6e48('0x3'),{'options':{'raw':![],'attributes':['id',_0x6e48('0x4'),_0x6e48('0x5'),'apiKey','remoteUri',_0x6e48('0x6')],'include':[{'model':_0x6e48('0x7'),'as':_0x6e48('0x8'),'attributes':['id',_0x6e48('0x4')],'include':[{'model':'Tag','attributes':['id',_0x6e48('0x4')]},{'model':_0x6e48('0x9'),'as':_0x6e48('0xa'),'attributes':['id',_0x6e48('0xb'),_0x6e48('0xc'),'variableName'],'include':[{'model':_0x6e48('0xd'),'as':'Variable','attributes':['id',_0x6e48('0x4')]}]},{'model':'FreshdeskField','as':_0x6e48('0xe'),'attributes':['id',_0x6e48('0xb'),_0x6e48('0xc'),_0x6e48('0xf'),'keyType',_0x6e48('0x10'),'variableName'],'include':[{'model':'Variable','as':_0x6e48('0xd'),'attributes':['id',_0x6e48('0x4')]}]},{'model':_0x6e48('0x9'),'as':_0x6e48('0x11'),'attributes':['id','type',_0x6e48('0xc'),_0x6e48('0x12'),_0x6e48('0x13'),_0x6e48('0x14'),_0x6e48('0x15')],'include':[{'model':_0x6e48('0xd'),'as':_0x6e48('0xd'),'attributes':['id',_0x6e48('0x4')]}]}]}]},'log':_0x6e48('0x3')});};}; \ No newline at end of file +var _0x2bb0=['serverUrl','FreshdeskConfiguration','Configurations','name','Tag','FreshdeskField','type','content','variableName','Variable','Descriptions','key','keyType','idField','customField','../../client','getFreshdeskAccounts','GetFreshdeskAccount','apiKey'];(function(_0x190140,_0x3cd521){var _0x5de288=function(_0x42a9e7){while(--_0x42a9e7){_0x190140['push'](_0x190140['shift']());}};_0x5de288(++_0x3cd521);}(_0x2bb0,0xf3));var _0x02bb=function(_0x306cb2,_0x49693f){_0x306cb2=_0x306cb2-0x0;var _0x5b744e=_0x2bb0[_0x306cb2];return _0x5b744e;};'use strict';var client=require(_0x02bb('0x0'));exports[_0x02bb('0x1')]=function(){return function(_0x3cad3f){return client['Request'](_0x02bb('0x2'),{'options':{'raw':![],'attributes':['id','name','username',_0x02bb('0x3'),'remoteUri',_0x02bb('0x4')],'include':[{'model':_0x02bb('0x5'),'as':_0x02bb('0x6'),'attributes':['id',_0x02bb('0x7')],'include':[{'model':_0x02bb('0x8'),'attributes':['id',_0x02bb('0x7')]},{'model':_0x02bb('0x9'),'as':'Subjects','attributes':['id',_0x02bb('0xa'),_0x02bb('0xb'),_0x02bb('0xc')],'include':[{'model':'Variable','as':_0x02bb('0xd'),'attributes':['id','name']}]},{'model':_0x02bb('0x9'),'as':_0x02bb('0xe'),'attributes':['id','type',_0x02bb('0xb'),_0x02bb('0xf'),_0x02bb('0x10'),'keyContent',_0x02bb('0xc')],'include':[{'model':'Variable','as':_0x02bb('0xd'),'attributes':['id',_0x02bb('0x7')]}]},{'model':_0x02bb('0x9'),'as':'Fields','attributes':['id',_0x02bb('0xa'),_0x02bb('0xb'),_0x02bb('0x11'),'nameField',_0x02bb('0x12'),'variableName'],'include':[{'model':_0x02bb('0xd'),'as':_0x02bb('0xd'),'attributes':['id',_0x02bb('0x7')]}]}]}]},'log':_0x02bb('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index 047fa55..6515d01 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9206=['name','remoteUri','serverUrl','Subjects','type','content','variableName','FreshsalesField','Descriptions','key','keyType','keyContent','Variable','GetFreshsalesccount','../../client','getFreshsalesAccounts','Request','GetFreshsalesAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9206,0x176));var _0x6920=function(_0x1e72c4,_0x39a448){_0x1e72c4=_0x1e72c4-0x0;var _0x376636=_0x9206[_0x1e72c4];return _0x376636;};'use strict';var client=require(_0x6920('0x0'));exports[_0x6920('0x1')]=function(){return function(_0x3896bc){return client[_0x6920('0x2')](_0x6920('0x3'),{'options':{'raw':![],'attributes':['id',_0x6920('0x4'),'username','apiKey',_0x6920('0x5'),_0x6920('0x6')],'include':[{'model':'FreshsalesConfiguration','as':'Configurations','attributes':['id',_0x6920('0x4')],'include':[{'model':'FreshsalesField','as':_0x6920('0x7'),'attributes':['id',_0x6920('0x8'),_0x6920('0x9'),_0x6920('0xa')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x6920('0x4')]}]},{'model':_0x6920('0xb'),'as':_0x6920('0xc'),'attributes':['id',_0x6920('0x8'),_0x6920('0x9'),_0x6920('0xd'),_0x6920('0xe'),_0x6920('0xf'),_0x6920('0xa')],'include':[{'model':_0x6920('0x10'),'as':_0x6920('0x10'),'attributes':['id',_0x6920('0x4')]}]}]}]},'log':_0x6920('0x11')});};}; \ No newline at end of file +var _0x2d72=['GetFreshsalesAccount','name','username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','type','content','Variable','key','keyType','keyContent','variableName','../../client','getFreshsalesAccounts','Request'];(function(_0x50093e,_0x50faf9){var _0x99d09f=function(_0x19cb0d){while(--_0x19cb0d){_0x50093e['push'](_0x50093e['shift']());}};_0x99d09f(++_0x50faf9);}(_0x2d72,0xa8));var _0x22d7=function(_0x2e62da,_0x2b1d64){_0x2e62da=_0x2e62da-0x0;var _0x23941e=_0x2d72[_0x2e62da];return _0x23941e;};'use strict';var client=require(_0x22d7('0x0'));exports[_0x22d7('0x1')]=function(){return function(_0x11448){return client[_0x22d7('0x2')](_0x22d7('0x3'),{'options':{'raw':![],'attributes':['id',_0x22d7('0x4'),_0x22d7('0x5'),_0x22d7('0x6'),_0x22d7('0x7'),_0x22d7('0x8')],'include':[{'model':_0x22d7('0x9'),'as':_0x22d7('0xa'),'attributes':['id',_0x22d7('0x4')],'include':[{'model':_0x22d7('0xb'),'as':'Subjects','attributes':['id',_0x22d7('0xc'),_0x22d7('0xd'),'variableName'],'include':[{'model':_0x22d7('0xe'),'as':_0x22d7('0xe'),'attributes':['id',_0x22d7('0x4')]}]},{'model':_0x22d7('0xb'),'as':'Descriptions','attributes':['id','type',_0x22d7('0xd'),_0x22d7('0xf'),_0x22d7('0x10'),_0x22d7('0x11'),_0x22d7('0x12')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x22d7('0x4')]}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 517f971..7af7af1 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x753c=['getSalesforceAccounts','Request','GetSalesforceAccount','name','username','password','remoteUri','clientId','clientSecret','securityToken','serverUrl','type','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Fields'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x753c,0x96));var _0xc753=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x753c[_0x2b4411];return _0x8e41ef;};'use strict';var client=require('../../client');exports[_0xc753('0x0')]=function(){return function(_0x506c39){return client[_0xc753('0x1')](_0xc753('0x2'),{'options':{'raw':![],'attributes':['id',_0xc753('0x3'),_0xc753('0x4'),_0xc753('0x5'),_0xc753('0x6'),_0xc753('0x7'),_0xc753('0x8'),_0xc753('0x9'),_0xc753('0xa'),_0xc753('0xb')],'include':[{'model':_0xc753('0xc'),'as':_0xc753('0xd'),'attributes':['id',_0xc753('0x3'),_0xc753('0xe'),_0xc753('0xf'),_0xc753('0x10'),_0xc753('0x11'),_0xc753('0x12'),_0xc753('0x13'),_0xc753('0x14')],'include':[{'model':_0xc753('0x15'),'as':_0xc753('0x16'),'include':[{'model':_0xc753('0x17'),'as':'Variable','attributes':['id',_0xc753('0x3')]}]},{'model':_0xc753('0x15'),'as':'Descriptions','include':[{'model':_0xc753('0x17'),'as':'Variable','attributes':['id',_0xc753('0x3')]}]},{'model':_0xc753('0x15'),'as':_0xc753('0x18'),'include':[{'model':'Variable','as':_0xc753('0x17'),'attributes':['id','name']}]}]}]},'log':_0xc753('0x2')});};}; \ No newline at end of file +var _0xbee0=['name','username','password','remoteUri','serverUrl','type','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions','Fields','getSalesforceAccounts','Request','GetSalesforceAccount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbee0,0x147));var _0x0bee=function(_0x4b22fd,_0x529a06){_0x4b22fd=_0x4b22fd-0x0;var _0x371fb4=_0xbee0[_0x4b22fd];return _0x371fb4;};'use strict';var client=require('../../client');exports[_0x0bee('0x0')]=function(){return function(_0x258133){return client[_0x0bee('0x1')](_0x0bee('0x2'),{'options':{'raw':![],'attributes':['id',_0x0bee('0x3'),_0x0bee('0x4'),_0x0bee('0x5'),_0x0bee('0x6'),'clientId','clientSecret','securityToken',_0x0bee('0x7'),_0x0bee('0x8')],'include':[{'model':_0x0bee('0x9'),'as':_0x0bee('0xa'),'attributes':['id','name',_0x0bee('0xb'),_0x0bee('0xc'),_0x0bee('0xd'),_0x0bee('0xe'),'additionalSearchAccount',_0x0bee('0xf'),_0x0bee('0x10')],'include':[{'model':_0x0bee('0x11'),'as':_0x0bee('0x12'),'include':[{'model':_0x0bee('0x13'),'as':_0x0bee('0x13'),'attributes':['id',_0x0bee('0x3')]}]},{'model':'SalesforceField','as':_0x0bee('0x14'),'include':[{'model':'Variable','as':_0x0bee('0x13'),'attributes':['id',_0x0bee('0x3')]}]},{'model':_0x0bee('0x11'),'as':_0x0bee('0x15'),'include':[{'model':_0x0bee('0x13'),'as':_0x0bee('0x13'),'attributes':['id','name']}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 4109f8d..47c2f1a 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['idField','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','type','content','variableName','Variable','ServicenowField','Descriptions','key','keyContent','Fields'];(function(_0xce26e0,_0x1f96ca){var _0x3fd222=function(_0x30e954){while(--_0x30e954){_0xce26e0['push'](_0xce26e0['shift']());}};_0x3fd222(++_0x1f96ca);}(_0xf494,0x1c6));var _0x4f49=function(_0x2e98d5,_0x1665f4){_0x2e98d5=_0x2e98d5-0x0;var _0x3f8ee4=_0xf494[_0x2e98d5];return _0x3f8ee4;};'use strict';var client=require(_0x4f49('0x0'));exports[_0x4f49('0x1')]=function(){return function(_0x3063f3){return client['Request'](_0x4f49('0x2'),{'options':{'raw':![],'attributes':['id',_0x4f49('0x3'),_0x4f49('0x4'),_0x4f49('0x5'),_0x4f49('0x6'),_0x4f49('0x7'),_0x4f49('0x8'),_0x4f49('0x9')],'include':[{'model':_0x4f49('0xa'),'as':_0x4f49('0xb'),'attributes':['id',_0x4f49('0x3')],'include':[{'model':'ServicenowField','as':'Subjects','attributes':['id',_0x4f49('0xc'),_0x4f49('0xd'),_0x4f49('0xe')],'include':[{'model':_0x4f49('0xf'),'as':_0x4f49('0xf'),'attributes':['id',_0x4f49('0x3')]}]},{'model':_0x4f49('0x10'),'as':_0x4f49('0x11'),'attributes':['id','type',_0x4f49('0xd'),_0x4f49('0x12'),'keyType',_0x4f49('0x13'),'variableName'],'include':[{'model':'Variable','as':_0x4f49('0xf'),'attributes':['id',_0x4f49('0x3')]}]},{'model':'ServicenowField','as':_0x4f49('0x14'),'attributes':['id',_0x4f49('0xc'),_0x4f49('0xd'),_0x4f49('0x15'),_0x4f49('0x16'),_0x4f49('0x17'),_0x4f49('0xe')],'include':[{'model':'Variable','as':_0x4f49('0xf'),'attributes':['id',_0x4f49('0x3')]}]}]}]},'log':_0x4f49('0x18')});};}; \ No newline at end of file +var _0x4975=['Descriptions','content','key','keyType','Fields','idField','nameField','customField','GetServicenowkAccount','../../client','Request','GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','Subjects','type','variableName','Variable'];(function(_0x328ff3,_0x361087){var _0x15c765=function(_0x5c4e3e){while(--_0x5c4e3e){_0x328ff3['push'](_0x328ff3['shift']());}};_0x15c765(++_0x361087);}(_0x4975,0x86));var _0x5497=function(_0x1ce895,_0x737de0){_0x1ce895=_0x1ce895-0x0;var _0x12ef0c=_0x4975[_0x1ce895];return _0x12ef0c;};'use strict';var client=require(_0x5497('0x0'));exports['getServicenowAccounts']=function(){return function(_0x474989){return client[_0x5497('0x1')](_0x5497('0x2'),{'options':{'raw':![],'attributes':['id',_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9')],'include':[{'model':'ServicenowConfiguration','as':_0x5497('0xa'),'attributes':['id','name'],'include':[{'model':_0x5497('0xb'),'as':_0x5497('0xc'),'attributes':['id',_0x5497('0xd'),'content',_0x5497('0xe')],'include':[{'model':'Variable','as':_0x5497('0xf'),'attributes':['id',_0x5497('0x3')]}]},{'model':_0x5497('0xb'),'as':_0x5497('0x10'),'attributes':['id',_0x5497('0xd'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),'keyContent','variableName'],'include':[{'model':'Variable','as':_0x5497('0xf'),'attributes':['id',_0x5497('0x3')]}]},{'model':_0x5497('0xb'),'as':_0x5497('0x14'),'attributes':['id',_0x5497('0xd'),_0x5497('0x11'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),_0x5497('0xe')],'include':[{'model':'Variable','as':_0x5497('0xf'),'attributes':['id','name']}]}]}]},'log':_0x5497('0x18')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 748434f..56d152a 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['GetSugarcrmAccount','getSugarcrmAccounts','Request','name','username','remoteUri','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','key','keyContent','customField'];(function(_0x561afe,_0x59829f){var _0x14913e=function(_0x2a967f){while(--_0x2a967f){_0x561afe['push'](_0x561afe['shift']());}};_0x14913e(++_0x59829f);}(_0x2032,0xd9));var _0x2203=function(_0x326971,_0x34c529){_0x326971=_0x326971-0x0;var _0x5d0d93=_0x2032[_0x326971];return _0x5d0d93;};'use strict';var client=require('../../client');exports[_0x2203('0x0')]=function(){return function(_0x1e103d){return client[_0x2203('0x1')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id',_0x2203('0x2'),_0x2203('0x3'),'password',_0x2203('0x4'),_0x2203('0x5')],'include':[{'model':_0x2203('0x6'),'as':_0x2203('0x7'),'attributes':['id',_0x2203('0x2')],'include':[{'model':_0x2203('0x8'),'as':_0x2203('0x9'),'attributes':['id',_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc')],'include':[{'model':_0x2203('0xd'),'as':'Variable','attributes':['id','name']}]},{'model':_0x2203('0x8'),'as':'Descriptions','attributes':['id',_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xe'),'keyType',_0x2203('0xf'),'variableName'],'include':[{'model':_0x2203('0xd'),'as':'Variable','attributes':['id',_0x2203('0x2')]}]},{'model':_0x2203('0x8'),'as':'Fields','attributes':['id','type','content','idField','nameField',_0x2203('0x10'),'variableName'],'include':[{'model':'Variable','as':_0x2203('0xd'),'attributes':['id',_0x2203('0x2')]}]}]}]},'log':_0x2203('0x11')});};}; \ No newline at end of file +var _0x7a54=['nameField','customField','../../client','getSugarcrmAccounts','GetSugarcrmAccount','name','password','remoteUri','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField','type','content','Variable','Descriptions','key','variableName','Fields','idField'];(function(_0x3e05e1,_0x535808){var _0x3741bd=function(_0x5d36d6){while(--_0x5d36d6){_0x3e05e1['push'](_0x3e05e1['shift']());}};_0x3741bd(++_0x535808);}(_0x7a54,0x106));var _0x47a5=function(_0x466b73,_0x2fda11){_0x466b73=_0x466b73-0x0;var _0x32cc2e=_0x7a54[_0x466b73];return _0x32cc2e;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(){return function(_0x44b31e){return client['Request'](_0x47a5('0x2'),{'options':{'raw':![],'attributes':['id',_0x47a5('0x3'),'username',_0x47a5('0x4'),_0x47a5('0x5'),_0x47a5('0x6')],'include':[{'model':_0x47a5('0x7'),'as':_0x47a5('0x8'),'attributes':['id','name'],'include':[{'model':_0x47a5('0x9'),'as':'Subjects','attributes':['id',_0x47a5('0xa'),_0x47a5('0xb'),'variableName'],'include':[{'model':_0x47a5('0xc'),'as':'Variable','attributes':['id','name']}]},{'model':'SugarcrmField','as':_0x47a5('0xd'),'attributes':['id',_0x47a5('0xa'),'content',_0x47a5('0xe'),'keyType','keyContent',_0x47a5('0xf')],'include':[{'model':_0x47a5('0xc'),'as':_0x47a5('0xc'),'attributes':['id',_0x47a5('0x3')]}]},{'model':_0x47a5('0x9'),'as':_0x47a5('0x10'),'attributes':['id',_0x47a5('0xa'),'content',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0xf')],'include':[{'model':_0x47a5('0xc'),'as':_0x47a5('0xc'),'attributes':['id',_0x47a5('0x3')]}]}]}]},'log':_0x47a5('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 040241a..a14c526 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa86a=['remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type','Variable','Descriptions','content','key','keyContent','variableName','Fields','idField','nameField','customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','accessKey'];(function(_0x20bf34,_0x56dc16){var _0x508033=function(_0x5ca569){while(--_0x5ca569){_0x20bf34['push'](_0x20bf34['shift']());}};_0x508033(++_0x56dc16);}(_0xa86a,0xa7));var _0xaa86=function(_0x54656a,_0x10f6d2){_0x54656a=_0x54656a-0x0;var _0x7137db=_0xa86a[_0x54656a];return _0x7137db;};'use strict';var client=require(_0xaa86('0x0'));exports[_0xaa86('0x1')]=function(){return function(_0x3cee2b){return client[_0xaa86('0x2')](_0xaa86('0x3'),{'options':{'raw':![],'attributes':['id',_0xaa86('0x4'),_0xaa86('0x5'),_0xaa86('0x6'),_0xaa86('0x7'),_0xaa86('0x8'),_0xaa86('0x9')],'include':[{'model':_0xaa86('0xa'),'as':_0xaa86('0xb'),'attributes':['id',_0xaa86('0x4')],'include':[{'model':_0xaa86('0xc'),'as':_0xaa86('0xd'),'attributes':['id',_0xaa86('0xe'),'content','variableName'],'include':[{'model':_0xaa86('0xf'),'as':'Variable','attributes':['id',_0xaa86('0x4')]}]},{'model':_0xaa86('0xc'),'as':_0xaa86('0x10'),'attributes':['id',_0xaa86('0xe'),_0xaa86('0x11'),_0xaa86('0x12'),'keyType',_0xaa86('0x13'),_0xaa86('0x14')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0xaa86('0xc'),'as':_0xaa86('0x15'),'attributes':['id',_0xaa86('0xe'),_0xaa86('0x11'),_0xaa86('0x16'),_0xaa86('0x17'),_0xaa86('0x18'),'variableName'],'include':[{'model':_0xaa86('0xf'),'as':_0xaa86('0xf'),'attributes':['id',_0xaa86('0x4')]}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file +var _0xae04=['GetVtigerAccount','name','description','remoteUri','VtigerConfiguration','Configurations','Subjects','type','Variable','VtigerField','Descriptions','keyContent','variableName','Fields','content','idField','nameField','../../client','getVtigerAccounts','Request'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xae04,0x151));var _0x4ae0=function(_0x58c50e,_0x573495){_0x58c50e=_0x58c50e-0x0;var _0x4a8199=_0xae04[_0x58c50e];return _0x4a8199;};'use strict';var client=require(_0x4ae0('0x0'));exports[_0x4ae0('0x1')]=function(){return function(_0xbab8cb){return client[_0x4ae0('0x2')](_0x4ae0('0x3'),{'options':{'raw':![],'attributes':['id',_0x4ae0('0x4'),_0x4ae0('0x5'),'username','accessKey',_0x4ae0('0x6'),'serverUrl'],'include':[{'model':_0x4ae0('0x7'),'as':_0x4ae0('0x8'),'attributes':['id',_0x4ae0('0x4')],'include':[{'model':'VtigerField','as':_0x4ae0('0x9'),'attributes':['id',_0x4ae0('0xa'),'content','variableName'],'include':[{'model':_0x4ae0('0xb'),'as':_0x4ae0('0xb'),'attributes':['id',_0x4ae0('0x4')]}]},{'model':_0x4ae0('0xc'),'as':_0x4ae0('0xd'),'attributes':['id',_0x4ae0('0xa'),'content','key','keyType',_0x4ae0('0xe'),_0x4ae0('0xf')],'include':[{'model':_0x4ae0('0xb'),'as':'Variable','attributes':['id','name']}]},{'model':_0x4ae0('0xc'),'as':_0x4ae0('0x10'),'attributes':['id',_0x4ae0('0xa'),_0x4ae0('0x11'),_0x4ae0('0x12'),_0x4ae0('0x13'),'customField',_0x4ae0('0xf')],'include':[{'model':_0x4ae0('0xb'),'as':_0x4ae0('0xb'),'attributes':['id',_0x4ae0('0x4')]}]}]}]},'log':_0x4ae0('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index b7aaa8c..064af9b 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa038=['username','password','token','authType','serverUrl','type','ZendeskConfiguration','Configurations','name','Tag','Subjects','content','variableName','Variable','ZendeskField','Descriptions','keyType','keyContent','Fields','idField','nameField','customField','getZendeskAccounts','Request','GetZendeskAccount'];(function(_0x577519,_0x346daf){var _0x5b12f7=function(_0x4aecb6){while(--_0x4aecb6){_0x577519['push'](_0x577519['shift']());}};_0x5b12f7(++_0x346daf);}(_0xa038,0x1bf));var _0x8a03=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xa038[_0x5f3f88];return _0xd08119;};'use strict';var client=require('../../client');exports[_0x8a03('0x0')]=function(){return function(_0x45bb7a){return client[_0x8a03('0x1')](_0x8a03('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x8a03('0x3'),_0x8a03('0x4'),_0x8a03('0x5'),'remoteUri',_0x8a03('0x6'),_0x8a03('0x7'),_0x8a03('0x8')],'include':[{'model':_0x8a03('0x9'),'as':_0x8a03('0xa'),'attributes':['id',_0x8a03('0xb')],'include':[{'model':_0x8a03('0xc'),'attributes':['id',_0x8a03('0xb')]},{'model':'ZendeskField','as':_0x8a03('0xd'),'attributes':['id',_0x8a03('0x8'),_0x8a03('0xe'),_0x8a03('0xf')],'include':[{'model':_0x8a03('0x10'),'as':'Variable','attributes':['id','name']}]},{'model':_0x8a03('0x11'),'as':_0x8a03('0x12'),'attributes':['id',_0x8a03('0x8'),_0x8a03('0xe'),'key',_0x8a03('0x13'),_0x8a03('0x14'),_0x8a03('0xf')],'include':[{'model':'Variable','as':_0x8a03('0x10'),'attributes':['id','name']}]},{'model':'ZendeskField','as':_0x8a03('0x15'),'attributes':['id',_0x8a03('0x8'),'content',_0x8a03('0x16'),_0x8a03('0x17'),_0x8a03('0x18'),'variableName'],'include':[{'model':'Variable','as':_0x8a03('0x10'),'attributes':['id',_0x8a03('0xb')]}]}]}]},'log':'GetZendeskAccount'});};}; \ No newline at end of file +var _0x8ebe=['username','password','token','remoteUri','serverUrl','type','Configurations','Tag','ZendeskField','variableName','Variable','Descriptions','content','key','keyType','keyContent','Fields','idField','nameField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name'];(function(_0x387784,_0x371269){var _0x4d8ac9=function(_0x409860){while(--_0x409860){_0x387784['push'](_0x387784['shift']());}};_0x4d8ac9(++_0x371269);}(_0x8ebe,0x103));var _0xe8eb=function(_0x55257d,_0x3998ec){_0x55257d=_0x55257d-0x0;var _0x4d296d=_0x8ebe[_0x55257d];return _0x4d296d;};'use strict';var client=require(_0xe8eb('0x0'));exports[_0xe8eb('0x1')]=function(){return function(_0x4f37f4){return client[_0xe8eb('0x2')](_0xe8eb('0x3'),{'options':{'raw':![],'attributes':['id',_0xe8eb('0x4'),_0xe8eb('0x5'),_0xe8eb('0x6'),_0xe8eb('0x7'),_0xe8eb('0x8'),'authType',_0xe8eb('0x9'),_0xe8eb('0xa')],'include':[{'model':'ZendeskConfiguration','as':_0xe8eb('0xb'),'attributes':['id',_0xe8eb('0x4')],'include':[{'model':_0xe8eb('0xc'),'attributes':['id','name']},{'model':_0xe8eb('0xd'),'as':'Subjects','attributes':['id','type','content',_0xe8eb('0xe')],'include':[{'model':_0xe8eb('0xf'),'as':_0xe8eb('0xf'),'attributes':['id',_0xe8eb('0x4')]}]},{'model':_0xe8eb('0xd'),'as':_0xe8eb('0x10'),'attributes':['id',_0xe8eb('0xa'),_0xe8eb('0x11'),_0xe8eb('0x12'),_0xe8eb('0x13'),_0xe8eb('0x14'),_0xe8eb('0xe')],'include':[{'model':'Variable','as':_0xe8eb('0xf'),'attributes':['id',_0xe8eb('0x4')]}]},{'model':_0xe8eb('0xd'),'as':_0xe8eb('0x15'),'attributes':['id',_0xe8eb('0xa'),_0xe8eb('0x11'),_0xe8eb('0x16'),_0xe8eb('0x17'),'customField',_0xe8eb('0xe')],'include':[{'model':_0xe8eb('0xf'),'as':_0xe8eb('0xf'),'attributes':['id','name']}]}]}]},'log':'GetZendeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index 4af714e..b7f6ace 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf111=['refreshToken','ZohoConfiguration','moduleCreate','description','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','Fields','idField','nameField','customField','GetZohoAccount','../../client','getZohoAccounts','Request','name','host','zone','clientId','clientSecret','serverUrl'];(function(_0x4727ce,_0x4ac2f5){var _0xf11217=function(_0x3ab1ef){while(--_0x3ab1ef){_0x4727ce['push'](_0x4727ce['shift']());}};_0xf11217(++_0x4ac2f5);}(_0xf111,0x120));var _0x1f11=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0xf111[_0x35f7f5];return _0x5567a4;};'use strict';var client=require(_0x1f11('0x0'));exports[_0x1f11('0x1')]=function(){return function(_0x2fb360){return client[_0x1f11('0x2')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0x1f11('0x3'),'description',_0x1f11('0x4'),_0x1f11('0x5'),_0x1f11('0x6'),_0x1f11('0x7'),_0x1f11('0x8'),'code',_0x1f11('0x9')],'include':[{'model':_0x1f11('0xa'),'as':'Configurations','attributes':['id',_0x1f11('0x3'),_0x1f11('0xb'),'moduleSearch',_0x1f11('0xc')],'include':[{'model':_0x1f11('0xd'),'as':_0x1f11('0xe'),'attributes':['id',_0x1f11('0xf'),_0x1f11('0x10'),_0x1f11('0x11')],'include':[{'model':_0x1f11('0x12'),'as':_0x1f11('0x12'),'attributes':['id',_0x1f11('0x3')]}]},{'model':_0x1f11('0xd'),'as':_0x1f11('0x13'),'attributes':['id',_0x1f11('0xf'),_0x1f11('0x10'),_0x1f11('0x14'),_0x1f11('0x15'),'keyContent',_0x1f11('0x11')],'include':[{'model':_0x1f11('0x12'),'as':'Variable','attributes':['id','name']}]},{'model':_0x1f11('0xd'),'as':_0x1f11('0x16'),'attributes':['id',_0x1f11('0xf'),_0x1f11('0x10'),_0x1f11('0x17'),_0x1f11('0x18'),_0x1f11('0x19'),_0x1f11('0x11')],'include':[{'model':_0x1f11('0x12'),'as':'Variable','attributes':['id',_0x1f11('0x3')]}]}]}]},'log':_0x1f11('0x1a')});};}; \ No newline at end of file +var _0xa0d6=['Configurations','moduleSearch','ZohoField','Subjects','type','content','Variable','Descriptions','keyType','variableName','Fields','idField','customField','../../client','getZohoAccounts','Request','GetZohoAccount','name','description','zone','code','refreshToken','ZohoConfiguration'];(function(_0x304bd5,_0xea943d){var _0x2bcd87=function(_0x53d3c5){while(--_0x53d3c5){_0x304bd5['push'](_0x304bd5['shift']());}};_0x2bcd87(++_0xea943d);}(_0xa0d6,0x1d9));var _0x6a0d=function(_0x1a11c2,_0x485a96){_0x1a11c2=_0x1a11c2-0x0;var _0x266cdf=_0xa0d6[_0x1a11c2];return _0x266cdf;};'use strict';var client=require(_0x6a0d('0x0'));exports[_0x6a0d('0x1')]=function(){return function(_0x10c206){return client[_0x6a0d('0x2')](_0x6a0d('0x3'),{'options':{'raw':![],'attributes':['id',_0x6a0d('0x4'),_0x6a0d('0x5'),'host',_0x6a0d('0x6'),'clientId','clientSecret','serverUrl',_0x6a0d('0x7'),_0x6a0d('0x8')],'include':[{'model':_0x6a0d('0x9'),'as':_0x6a0d('0xa'),'attributes':['id',_0x6a0d('0x4'),'moduleCreate',_0x6a0d('0xb'),'description'],'include':[{'model':_0x6a0d('0xc'),'as':_0x6a0d('0xd'),'attributes':['id',_0x6a0d('0xe'),_0x6a0d('0xf'),'variableName'],'include':[{'model':_0x6a0d('0x10'),'as':_0x6a0d('0x10'),'attributes':['id','name']}]},{'model':_0x6a0d('0xc'),'as':_0x6a0d('0x11'),'attributes':['id','type',_0x6a0d('0xf'),'key',_0x6a0d('0x12'),'keyContent',_0x6a0d('0x13')],'include':[{'model':_0x6a0d('0x10'),'as':_0x6a0d('0x10'),'attributes':['id',_0x6a0d('0x4')]}]},{'model':_0x6a0d('0xc'),'as':_0x6a0d('0x14'),'attributes':['id',_0x6a0d('0xe'),_0x6a0d('0xf'),_0x6a0d('0x15'),'nameField',_0x6a0d('0x16'),'variableName'],'include':[{'model':'Variable','as':_0x6a0d('0x10'),'attributes':['id','name']}]}]}]},'log':_0x6a0d('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 25880f1..6724a34 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8042=['replace','trim','intervalIftime\x20called\x20with','length','resolve','string','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','stack'];(function(_0x23d91f,_0x4d0607){var _0x486f4e=function(_0x765f24){while(--_0x765f24){_0x23d91f['push'](_0x23d91f['shift']());}};_0x486f4e(++_0x4d0607);}(_0x8042,0xac));var _0x2804=function(_0x3585fb,_0x5df075){_0x3585fb=_0x3585fb-0x0;var _0x48fb79=_0x8042[_0x3585fb];return _0x48fb79;};var logger=require(_0x2804('0x0'))(_0x2804('0x1'));var client=require(_0x2804('0x2'));function intervalIftime(_0x29837b,_0x46a8a4){const _0x170ded=new Error()[_0x2804('0x3')][_0x2804('0x4')](/^Error/,'')[_0x2804('0x5')]();logger['silly'](_0x2804('0x6'),_0x29837b,_0x46a8a4,_0x170ded);const _0x3d712e=Array['isArray'](_0x29837b);if(!_0x29837b||_0x3d712e&&_0x29837b[_0x2804('0x7')]===0x0){return Promise[_0x2804('0x8')](![]);}else{var _0xd7b217=[];var _0x1d64c3=[];var _0x3fa0a4=_0x3d712e?_0x29837b:[_0x29837b];var _0x599150=_0x3fa0a4['every'](function(_0x4f282c){return typeof _0x4f282c==='number';});var _0x557272=_0x3fa0a4['every'](function(_0x176b47){return typeof _0x176b47===_0x2804('0x9');});if(!_0x599150&&!_0x557272){_0xd7b217=_0x3fa0a4[_0x2804('0xa')](function(_0x336161){return _0x336161['id'];});if(_0xd7b217[_0x2804('0x7')]===0x0){_0x1d64c3=_0x3fa0a4[_0x2804('0xa')](function(_0x1dba50){return _0x1dba50[_0x2804('0xb')];});}}else{if(_0x599150){_0xd7b217=_0xd7b217[_0x2804('0xc')](_0x3fa0a4);}if(_0x557272){_0x1d64c3=_0x1d64c3[_0x2804('0xc')](_0x3fa0a4);}}return client[_0x2804('0xd')](_0x2804('0xe'),{'intervalIds':_0xd7b217,'intervals':_0x1d64c3,'timezone':_0x46a8a4,'log':_0x2804('0xe')});}}exports[_0x2804('0xf')]=intervalIftime; \ No newline at end of file +var _0xbce8=['IntervalIftime','intervalIftime','../../../config/logger','../client','stack','replace','intervalIftime\x20called\x20with','isArray','length','resolve','every','number','string','map','interval','concat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbce8,0x192));var _0x8bce=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0xbce8[_0x38eb23];return _0x48506a;};var logger=require(_0x8bce('0x0'))('dialer');var client=require(_0x8bce('0x1'));function intervalIftime(_0x44f71d,_0x1c67ec){const _0x189b76=new Error()[_0x8bce('0x2')][_0x8bce('0x3')](/^Error/,'')['trim']();logger['silly'](_0x8bce('0x4'),_0x44f71d,_0x1c67ec,_0x189b76);const _0x37f0e3=Array[_0x8bce('0x5')](_0x44f71d);if(!_0x44f71d||_0x37f0e3&&_0x44f71d[_0x8bce('0x6')]===0x0){return Promise[_0x8bce('0x7')](![]);}else{var _0x126126=[];var _0x296ac9=[];var _0x3d976c=_0x37f0e3?_0x44f71d:[_0x44f71d];var _0x1aa380=_0x3d976c[_0x8bce('0x8')](function(_0x564a5d){return typeof _0x564a5d===_0x8bce('0x9');});var _0x54efbe=_0x3d976c[_0x8bce('0x8')](function(_0x18e1af){return typeof _0x18e1af===_0x8bce('0xa');});if(!_0x1aa380&&!_0x54efbe){_0x126126=_0x3d976c[_0x8bce('0xb')](function(_0x48c03d){return _0x48c03d['id'];});if(_0x126126[_0x8bce('0x6')]===0x0){_0x296ac9=_0x3d976c[_0x8bce('0xb')](function(_0x22f2e7){return _0x22f2e7[_0x8bce('0xc')];});}}else{if(_0x1aa380){_0x126126=_0x126126[_0x8bce('0xd')](_0x3d976c);}if(_0x54efbe){_0x296ac9=_0x296ac9[_0x8bce('0xd')](_0x3d976c);}}return client['Request']('IntervalIftime',{'intervalIds':_0x126126,'intervals':_0x296ac9,'timezone':_0x1c67ec,'log':_0x8bce('0xe')});}}exports[_0x8bce('0xf')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index b2baa52..532d609 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf253=['agent','accountcode','toNumber','CreateMemberReport','TALKING','endtime','starttime','dialstring','moment','lodash','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format','SIP/%s','queuecallerleaveAt','seconds','inbound','exten','queue'];(function(_0x5d7701,_0x494f71){var _0x269483=function(_0x39ae7c){while(--_0x39ae7c){_0x5d7701['push'](_0x5d7701['shift']());}};_0x269483(++_0x494f71);}(_0xf253,0x1b1));var _0x3f25=function(_0x5a361d,_0x259dfc){_0x5a361d=_0x5a361d-0x0;var _0x24a315=_0xf253[_0x5a361d];return _0x24a315;};'use strict';var moment=require(_0x3f25('0x0'));var _=require(_0x3f25('0x1'));var util=require('util');var client=require('../client');exports[_0x3f25('0x2')]=function(_0x3fa183){var _0x3f4fdc=_0x3fa183[_0x3f25('0x3')]||_0x3fa183[_0x3f25('0x4')];return client[_0x3f25('0x5')]('CreateMemberReport',{'body':{'channel':_0x3f25('0x6'),'membername':_0x3fa183[_0x3f25('0x7')],'interface':_[_0x3f25('0x8')](_0x3fa183[_0x3f25('0x9')])?util[_0x3f25('0xa')](_0x3f25('0xb'),_0x3fa183[_0x3f25('0x7')]):_0x3fa183[_0x3f25('0x9')],'type':'TALKING','enterAt':_0x3fa183[_0x3f25('0xc')],'exitAt':_0x3f4fdc,'duration':moment(_0x3f4fdc)['diff'](_0x3fa183[_0x3f25('0xc')],_0x3f25('0xd')),'data1':_0x3f25('0xe'),'data2':_0x3fa183['calleridnum'],'data3':_0x3fa183[_0x3f25('0xf')],'data4':null,'data5':_0x3fa183[_0x3f25('0x10')],'role':_0x3f25('0x11'),'internal':_0x3fa183[_0x3f25('0x12')]?_[_0x3f25('0x13')](_0x3fa183[_0x3f25('0x12')]):undefined,'uniqueid':_0x3fa183['uniqueid']},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x23d890){return client[_0x3f25('0x5')](_0x3f25('0x14'),{'body':{'channel':_0x3f25('0x6'),'membername':_0x23d890['membername'],'interface':_0x23d890['interface'],'type':_0x3f25('0x15'),'enterAt':_0x23d890['starttime'],'exitAt':_0x23d890[_0x3f25('0x16')],'duration':moment(_0x23d890[_0x3f25('0x16')])['diff'](_0x23d890['starttime'],_0x3f25('0xd'))>=0x0?moment(_0x23d890[_0x3f25('0x16')])['diff'](_0x23d890[_0x3f25('0x17')],'seconds'):null,'data1':'outbound','data2':_0x23d890[_0x3f25('0x12')],'data3':_0x23d890['exten'],'data4':_0x23d890[_0x3f25('0x18')]||null,'role':_0x3f25('0x11'),'internal':_0x23d890[_0x3f25('0x12')]?_[_0x3f25('0x13')](_0x23d890[_0x3f25('0x12')]):undefined,'uniqueid':_0x23d890['uniqueid']},'log':_0x3f25('0x14')});}; \ No newline at end of file +var _0x514e=['seconds','inbound','exten','agent','toNumber','accountcode','uniqueid','voiceDialReport','membername','TALKING','starttime','endtime','moment','util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','interface','format','SIP/%s','lastAssignedTo','diff'];(function(_0x59307b,_0x34ed0e){var _0x5d722d=function(_0x392642){while(--_0x392642){_0x59307b['push'](_0x59307b['shift']());}};_0x5d722d(++_0x34ed0e);}(_0x514e,0x106));var _0xe514=function(_0x527266,_0x4ed87c){_0x527266=_0x527266-0x0;var _0x47ca88=_0x514e[_0x527266];return _0x47ca88;};'use strict';var moment=require(_0xe514('0x0'));var _=require('lodash');var util=require(_0xe514('0x1'));var client=require(_0xe514('0x2'));exports[_0xe514('0x3')]=function(_0x38a4a2){var _0x2b30bd=_0x38a4a2[_0xe514('0x4')]||_0x38a4a2['queuecallerexitAt'];return client[_0xe514('0x5')](_0xe514('0x6'),{'body':{'channel':_0xe514('0x7'),'membername':_0x38a4a2['lastAssignedTo'],'interface':_['isNil'](_0x38a4a2[_0xe514('0x8')])?util[_0xe514('0x9')](_0xe514('0xa'),_0x38a4a2[_0xe514('0xb')]):_0x38a4a2[_0xe514('0x8')],'type':'TALKING','enterAt':_0x38a4a2['queuecallerleaveAt'],'exitAt':_0x2b30bd,'duration':moment(_0x2b30bd)[_0xe514('0xc')](_0x38a4a2['queuecallerleaveAt'],_0xe514('0xd')),'data1':_0xe514('0xe'),'data2':_0x38a4a2['calleridnum'],'data3':_0x38a4a2[_0xe514('0xf')],'data4':null,'data5':_0x38a4a2['queue'],'role':_0xe514('0x10'),'internal':_0x38a4a2['accountcode']?_[_0xe514('0x11')](_0x38a4a2[_0xe514('0x12')]):undefined,'uniqueid':_0x38a4a2[_0xe514('0x13')]},'log':_0xe514('0x6')});};exports[_0xe514('0x14')]=function(_0x15c8b0){return client[_0xe514('0x5')](_0xe514('0x6'),{'body':{'channel':_0xe514('0x7'),'membername':_0x15c8b0[_0xe514('0x15')],'interface':_0x15c8b0[_0xe514('0x8')],'type':_0xe514('0x16'),'enterAt':_0x15c8b0[_0xe514('0x17')],'exitAt':_0x15c8b0[_0xe514('0x18')],'duration':moment(_0x15c8b0[_0xe514('0x18')])['diff'](_0x15c8b0[_0xe514('0x17')],_0xe514('0xd'))>=0x0?moment(_0x15c8b0[_0xe514('0x18')])[_0xe514('0xc')](_0x15c8b0[_0xe514('0x17')],_0xe514('0xd')):null,'data1':'outbound','data2':_0x15c8b0[_0xe514('0x12')],'data3':_0x15c8b0[_0xe514('0xf')],'data4':_0x15c8b0['dialstring']||null,'role':_0xe514('0x10'),'internal':_0x15c8b0[_0xe514('0x12')]?_['toNumber'](_0x15c8b0[_0xe514('0x12')]):undefined,'uniqueid':_0x15c8b0[_0xe514('0x13')]},'log':_0xe514('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 92a2d19..7a1cccc 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 _0x9652=['GetSettings','../client','getSettings','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x44acce,_0x2ee76d){var _0x3c6072=function(_0x52c10e){while(--_0x52c10e){_0x44acce['push'](_0x44acce['shift']());}};_0x3c6072(++_0x2ee76d);}(_0x9652,0xaf));var _0x2965=function(_0x38de33,_0x4361bb){_0x38de33=_0x38de33-0x0;var _0x40f16d=_0x9652[_0x38de33];return _0x40f16d;};'use strict';var client=require(_0x2965('0x0'));exports[_0x2965('0x1')]=function(){return client['Request'](_0x2965('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2965('0x3'),_0x2965('0x4')]},'log':_0x2965('0x5')});}; \ No newline at end of file +var _0xade9=['GetSettings','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x25d849,_0x5e9271){var _0x2e6886=function(_0x642ae9){while(--_0x642ae9){_0x25d849['push'](_0x25d849['shift']());}};_0x2e6886(++_0x5e9271);}(_0xade9,0x1e7));var _0x9ade=function(_0x4d3924,_0x327b56){_0x4d3924=_0x4d3924-0x0;var _0x844555=_0xade9[_0x4d3924];return _0x844555;};'use strict';var client=require('../client');exports[_0x9ade('0x0')]=function(){return client[_0x9ade('0x1')](_0x9ade('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9ade('0x3'),_0x9ade('0x4')]},'log':_0x9ade('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 62607db..9e1ee05 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 _0xfd6f=['getTemplates','Request','name','html','GetTemplate','../client'];(function(_0x436167,_0x30772e){var _0x1ecf11=function(_0x4325ca){while(--_0x4325ca){_0x436167['push'](_0x436167['shift']());}};_0x1ecf11(++_0x30772e);}(_0xfd6f,0x19d));var _0xffd6=function(_0xcb007,_0x1a9fb5){_0xcb007=_0xcb007-0x0;var _0x10fb56=_0xfd6f[_0xcb007];return _0x10fb56;};'use strict';var client=require(_0xffd6('0x0'));exports[_0xffd6('0x1')]=function(_0x29b163){return function(_0x45ddb9){return client[_0xffd6('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xffd6('0x3'),_0xffd6('0x4')]},'log':_0xffd6('0x5')});};}; \ No newline at end of file +var _0x8bf1=['html','../client','Request','GetTemplate','name'];(function(_0x5bf86f,_0x318ec1){var _0x53069c=function(_0x57b268){while(--_0x57b268){_0x5bf86f['push'](_0x5bf86f['shift']());}};_0x53069c(++_0x318ec1);}(_0x8bf1,0x65));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x18bf('0x0'));exports['getTemplates']=function(_0x3d7fa8){return function(_0x1d04b3){return client[_0x18bf('0x1')](_0x18bf('0x2'),{'options':{'raw':!![],'attributes':['id',_0x18bf('0x3'),_0x18bf('0x4')]},'log':_0x18bf('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index d99684a..b66cc81 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 _0x90bd=['data5','data6','getTriggers','Request','name','channel','status','Condition','AllConditions','value','AnyConditions','Action','Actions','action','data1','data2','data3','data4'];(function(_0x93b411,_0x4263ca){var _0x14ce11=function(_0x3f71c4){while(--_0x3f71c4){_0x93b411['push'](_0x93b411['shift']());}};_0x14ce11(++_0x4263ca);}(_0x90bd,0x17c));var _0xd90b=function(_0x35fb56,_0x5dadff){_0x35fb56=_0x35fb56-0x0;var _0x2fd52c=_0x90bd[_0x35fb56];return _0x2fd52c;};'use strict';var client=require('../client');exports[_0xd90b('0x0')]=function(_0x99d9f){return function(_0x27129a){return client[_0xd90b('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xd90b('0x2'),_0xd90b('0x3'),_0xd90b('0x4')],'include':[{'model':_0xd90b('0x5'),'as':_0xd90b('0x6'),'attributes':['id','field','operator',_0xd90b('0x7')]},{'model':_0xd90b('0x5'),'as':_0xd90b('0x8'),'attributes':['id','field','operator',_0xd90b('0x7')]},{'model':_0xd90b('0x9'),'as':_0xd90b('0xa'),'attributes':['id',_0xd90b('0xb'),_0xd90b('0xc'),_0xd90b('0xd'),_0xd90b('0xe'),_0xd90b('0xf'),_0xd90b('0x10'),_0xd90b('0x11'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x0c38=['Request','GetTrigger','channel','status','AllConditions','field','operator','value','Condition','AnyConditions','Action','Actions','action','data1','data2','data4','data5','data6','../client','getTriggers'];(function(_0x2e0ab6,_0x414625){var _0x123553=function(_0x4bddfb){while(--_0x4bddfb){_0x2e0ab6['push'](_0x2e0ab6['shift']());}};_0x123553(++_0x414625);}(_0x0c38,0x1ca));var _0x80c3=function(_0x25dc22,_0x2df570){_0x25dc22=_0x25dc22-0x0;var _0x27c746=_0x0c38[_0x25dc22];return _0x27c746;};'use strict';var client=require(_0x80c3('0x0'));exports[_0x80c3('0x1')]=function(_0x2b9fcd){return function(_0x53e3f8){return client[_0x80c3('0x2')](_0x80c3('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x80c3('0x4'),_0x80c3('0x5')],'include':[{'model':'Condition','as':_0x80c3('0x6'),'attributes':['id',_0x80c3('0x7'),_0x80c3('0x8'),_0x80c3('0x9')]},{'model':_0x80c3('0xa'),'as':_0x80c3('0xb'),'attributes':['id',_0x80c3('0x7'),_0x80c3('0x8'),_0x80c3('0x9')]},{'model':_0x80c3('0xc'),'as':_0x80c3('0xd'),'attributes':['id',_0x80c3('0xe'),_0x80c3('0xf'),_0x80c3('0x10'),'data3',_0x80c3('0x11'),_0x80c3('0x12'),_0x80c3('0x13'),'data7']}]},'log':_0x80c3('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 23d3976..c7121ca 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 _0xe198=['getTrunks','Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x27a1eb,_0x40e51a){var _0x3e443b=function(_0xd1ab39){while(--_0xd1ab39){_0x27a1eb['push'](_0x27a1eb['shift']());}};_0x3e443b(++_0x40e51a);}(_0xe198,0x6f));var _0x8e19=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xe198[_0x465a0c];return _0x1e202e;};'use strict';var client=require(_0x8e19('0x0'));exports[_0x8e19('0x1')]=function(_0x5330b8){return function(_0x488972){return client[_0x8e19('0x2')](_0x8e19('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x8e19('0x4'),_0x8e19('0x5'),_0x8e19('0x6')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xf150=['Request','registry','defaultuser','GetTrunk','../client','getTrunks'];(function(_0x2fab3f,_0x198503){var _0x5cb4ce=function(_0x312023){while(--_0x312023){_0x2fab3f['push'](_0x2fab3f['shift']());}};_0x5cb4ce(++_0x198503);}(_0xf150,0x196));var _0x0f15=function(_0x52ae7c,_0x238fc5){_0x52ae7c=_0x52ae7c-0x0;var _0xaddb28=_0xf150[_0x52ae7c];return _0xaddb28;};'use strict';var client=require(_0x0f15('0x0'));exports[_0x0f15('0x1')]=function(_0x315b37){return function(_0x360011){return client[_0x0f15('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x0f15('0x3'),_0x0f15('0x4')]},'log':_0x0f15('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 4daea58..1187acd 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 _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe706,0xa3));var _0x6e70=function(_0x24e0c9,_0x284109){_0x24e0c9=_0x24e0c9-0x0;var _0x4448f0=_0xe706[_0x24e0c9];return _0x4448f0;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x4163ff,_0x4b9d78){var _0x59e164=function(_0x464da4){while(--_0x464da4){_0x4163ff['push'](_0x4163ff['shift']());}};_0x59e164(++_0x4b9d78);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 43abdc5..4e38e10 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 _0x5b81=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','create'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x5b81,0x18f));var _0x15b8=function(_0x12a7c2,_0x36cebc){_0x12a7c2=_0x12a7c2-0x0;var _0x18b2ca=_0x5b81[_0x12a7c2];return _0x18b2ca;};'use strict';var client=require('../client');exports[_0x15b8('0x0')]=function(_0x44d206){return client['Request'](_0x15b8('0x1'),{'body':_0x44d206,'log':_0x15b8('0x1')});};exports[_0x15b8('0x2')]=function(_0x1dcb85,_0x2da364,_0x5f263c){return client[_0x15b8('0x3')](_0x15b8('0x4'),{'body':_0x1dcb85,'options':{'where':{'uniqueid':_0x2da364,'interface':_0x5f263c,'agentcomplete':!![]}},'log':_0x15b8('0x4')});}; \ No newline at end of file +var _0x1b5c=['CreateVoiceAgentReport','Request','UpdateVoiceAgentReport','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b5c,0x12a));var _0xc1b5=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x1b5c[_0x36c6eb];return _0x30675b;};'use strict';var client=require(_0xc1b5('0x0'));exports[_0xc1b5('0x1')]=function(_0x14415d){return client['Request'](_0xc1b5('0x2'),{'body':_0x14415d,'log':_0xc1b5('0x2')});};exports['update']=function(_0x1c441f,_0x587981,_0x2befc6){return client[_0xc1b5('0x3')](_0xc1b5('0x4'),{'body':_0x1c441f,'options':{'where':{'uniqueid':_0x587981,'interface':_0x2befc6,'agentcomplete':!![]}},'log':_0xc1b5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3c1e895..e51ff5c 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 _0x0924=['getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','DOCUMENTATION'];(function(_0x1b11a2,_0x1b37d0){var _0x1f2afa=function(_0xc068e1){while(--_0xc068e1){_0x1b11a2['push'](_0x1b11a2['shift']());}};_0x1f2afa(++_0x1b37d0);}(_0x0924,0x83));var _0x4092=function(_0x98197,_0xea7356){_0x98197=_0x98197-0x0;var _0x5d9199=_0x0924[_0x98197];return _0x5d9199;};'use strict';var moment=require('moment');var util=require(_0x4092('0x0'));var _=require(_0x4092('0x1'));var client=require(_0x4092('0x2'));exports[_0x4092('0x3')]=function(_0x584a29){return client[_0x4092('0x4')](_0x4092('0x5'),{'body':_[_0x4092('0x6')](_0x584a29,{'source':_0x584a29['calleridnum'],'destinationcontext':_0x584a29[_0x4092('0x7')],'callerid':_0x584a29['callerid'],'amaflags':_0x4092('0x8')}),'log':_0x4092('0x5')});};exports[_0x4092('0x9')]=function(){return function(){return client[_0x4092('0x4')](_0x4092('0xa'),{'options':{'where':{'type':[_0x4092('0xb')],'createdAt':{'$between':[moment()[_0x4092('0xc')](_0x4092('0xd'))[_0x4092('0xe')](_0x4092('0xf')),moment()['endOf']('day')[_0x4092('0xe')](_0x4092('0xf'))]}},'attributes':[_0x4092('0x10'),_0x4092('0x11'),_0x4092('0x12'),'billableseconds']},'log':_0x4092('0x13')});};}; \ No newline at end of file +var _0xf41c=['getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','type','billableseconds','GetVoiceCallReports','moment','../client','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION'];(function(_0x2b81a8,_0x30b798){var _0x131a94=function(_0x480239){while(--_0x480239){_0x2b81a8['push'](_0x2b81a8['shift']());}};_0x131a94(++_0x30b798);}(_0xf41c,0x186));var _0xcf41=function(_0x146a71,_0x302112){_0x146a71=_0x146a71-0x0;var _0x5a6387=_0xf41c[_0x146a71];return _0x5a6387;};'use strict';var moment=require(_0xcf41('0x0'));var util=require('util');var _=require('lodash');var client=require(_0xcf41('0x1'));exports['create']=function(_0x35c7d6){return client[_0xcf41('0x2')](_0xcf41('0x3'),{'body':_[_0xcf41('0x4')](_0x35c7d6,{'source':_0x35c7d6[_0xcf41('0x5')],'destinationcontext':_0x35c7d6[_0xcf41('0x6')],'callerid':_0x35c7d6[_0xcf41('0x7')],'amaflags':_0xcf41('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0xcf41('0x9')]=function(){return function(){return client[_0xcf41('0x2')](_0xcf41('0xa'),{'options':{'where':{'type':[_0xcf41('0xb')],'createdAt':{'$between':[moment()[_0xcf41('0xc')](_0xcf41('0xd'))['format'](_0xcf41('0xe')),moment()[_0xcf41('0xf')](_0xcf41('0xd'))['format'](_0xcf41('0xe'))]}},'attributes':[_0xcf41('0x10'),'disposition','duration',_0xcf41('0x11')]},'log':_0xcf41('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 546abdb..f97bbdd 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 _0x2340=['Request','CreateVoiceDialReport','../client','create'];(function(_0x17392e,_0x425148){var _0x16514a=function(_0x1a049c){while(--_0x1a049c){_0x17392e['push'](_0x17392e['shift']());}};_0x16514a(++_0x425148);}(_0x2340,0x9e));var _0x0234=function(_0x228e8b,_0x2500de){_0x228e8b=_0x228e8b-0x0;var _0x23cd63=_0x2340[_0x228e8b];return _0x23cd63;};'use strict';var client=require(_0x0234('0x0'));exports[_0x0234('0x1')]=function(_0x4151a2){return client[_0x0234('0x2')]('CreateVoiceDialReport',{'body':_0x4151a2,'log':_0x0234('0x3')});}; \ No newline at end of file +var _0x8b29=['CreateVoiceDialReport','../client','create'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8b29,0x1b1));var _0x98b2=function(_0x52fbe3,_0x1d5719){_0x52fbe3=_0x52fbe3-0x0;var _0x46b33c=_0x8b29[_0x52fbe3];return _0x46b33c;};'use strict';var client=require(_0x98b2('0x0'));exports[_0x98b2('0x1')]=function(_0x1125cb){return client['Request'](_0x98b2('0x2'),{'body':_0x1125cb,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index e18ba0e..e35fe53 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 _0xc874=['../client','Request','GetVoiceExtension','getVoiceExtensions'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0xc874,0x154));var _0x4c87=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0xc874[_0xa9a245];return _0x2d0eaa;};'use strict';var client=require(_0x4c87('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x4c87('0x1')](_0x4c87('0x2'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x4c87('0x3')});};}; \ No newline at end of file +var _0x0102=['GetVoiceExtension','exten','getVoiceExtensions','Request'];(function(_0x4b5a7d,_0x1a4bad){var _0x4c8c23=function(_0x2e180d){while(--_0x2e180d){_0x4b5a7d['push'](_0x4b5a7d['shift']());}};_0x4c8c23(++_0x1a4bad);}(_0x0102,0x186));var _0x2010=function(_0x1ce8df,_0x40eea1){_0x1ce8df=_0x1ce8df-0x0;var _0x4b6b7a=_0x0102[_0x1ce8df];return _0x4b6b7a;};'use strict';var client=require('../client');exports[_0x2010('0x0')]=function(){return function(){return client[_0x2010('0x1')](_0x2010('0x2'),{'options':{'raw':!![],'attributes':['id',_0x2010('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 51f8c29..d310987 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 _0x8bcd=['callerid','active','mandatoryDispositionPause','name','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk'];(function(_0x388a4f,_0x1b56be){var _0x1079b8=function(_0x5dd574){while(--_0x5dd574){_0x388a4f['push'](_0x388a4f['shift']());}};_0x1079b8(++_0x1b56be);}(_0x8bcd,0x18e));var _0xd8bc=function(_0x3e0596,_0x2a8953){_0x3e0596=_0x3e0596-0x0;var _0x2a0668=_0x8bcd[_0x3e0596];return _0x2a0668;};'use strict';var client=require(_0xd8bc('0x0'));exports[_0xd8bc('0x1')]=function(){return function(){return client[_0xd8bc('0x2')](_0xd8bc('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xd8bc('0x4'),_0xd8bc('0x5'),'autopause',_0xd8bc('0x6'),_0xd8bc('0x7'),_0xd8bc('0x8'),_0xd8bc('0x9'),_0xd8bc('0xa'),_0xd8bc('0xb'),_0xd8bc('0xc'),_0xd8bc('0xd'),_0xd8bc('0xe'),'dialPredictiveInterval',_0xd8bc('0xf'),_0xd8bc('0x10'),_0xd8bc('0x11'),_0xd8bc('0x12'),_0xd8bc('0x13'),_0xd8bc('0x14'),'dialCongestionMaxRetry',_0xd8bc('0x15'),_0xd8bc('0x16'),_0xd8bc('0x17'),_0xd8bc('0x18'),_0xd8bc('0x19'),_0xd8bc('0x1a'),_0xd8bc('0x1b'),_0xd8bc('0x1c'),'dialPrefix',_0xd8bc('0x1d'),'dialAMDActive',_0xd8bc('0x1e'),_0xd8bc('0x1f'),_0xd8bc('0x20'),'dialAMDTotalAnalysisTime',_0xd8bc('0x21'),_0xd8bc('0x22'),_0xd8bc('0x23'),_0xd8bc('0x24'),_0xd8bc('0x25'),'timeout',_0xd8bc('0x26'),_0xd8bc('0x27'),_0xd8bc('0x28'),_0xd8bc('0x29'),_0xd8bc('0x2a'),_0xd8bc('0x2b'),_0xd8bc('0x6'),'strategy',_0xd8bc('0x2c'),_0xd8bc('0x2d'),_0xd8bc('0x2e'),_0xd8bc('0x2f'),'dialDropMaxRetry',_0xd8bc('0x30'),'dialAbandonedMaxRetry',_0xd8bc('0x31'),_0xd8bc('0x32'),_0xd8bc('0x33'),_0xd8bc('0x34'),_0xd8bc('0x35'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0xd8bc('0x36'),_0xd8bc('0x37'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0xd8bc('0x38'),'attributes':['id','name',_0xd8bc('0x39'),_0xd8bc('0x3a')]},{'model':'Pause','as':_0xd8bc('0x3b'),'attributes':['id',_0xd8bc('0x3c')]},{'model':_0xd8bc('0x38'),'as':_0xd8bc('0x3d'),'attributes':['id',_0xd8bc('0x3c'),'callerid',_0xd8bc('0x3a')]},{'model':_0xd8bc('0x3e'),'as':'Interval','attributes':['id',_0xd8bc('0x3c')],'include':[{'model':'Interval','as':_0xd8bc('0x3f'),'attributes':['id','name',_0xd8bc('0x40')]}]}]},'log':_0xd8bc('0x1')});};}; \ No newline at end of file +var _0xdc40=['dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold'];(function(_0x393327,_0x6c6934){var _0x35e528=function(_0x2fcaaa){while(--_0x2fcaaa){_0x393327['push'](_0x393327['shift']());}};_0x35e528(++_0x6c6934);}(_0xdc40,0x118));var _0x0dc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdc40[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0dc4('0x0'));exports[_0x0dc4('0x1')]=function(){return function(){return client[_0x0dc4('0x2')](_0x0dc4('0x3'),{'options':{'raw':![],'attributes':['id',_0x0dc4('0x4'),_0x0dc4('0x5'),_0x0dc4('0x6'),_0x0dc4('0x7'),_0x0dc4('0x8'),'type',_0x0dc4('0x9'),_0x0dc4('0xa'),_0x0dc4('0xb'),_0x0dc4('0xc'),_0x0dc4('0xd'),'dialPredictiveOptimization',_0x0dc4('0xe'),_0x0dc4('0xf'),_0x0dc4('0x10'),_0x0dc4('0x11'),'dialOriginateTimeout',_0x0dc4('0x12'),_0x0dc4('0x13'),'dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x0dc4('0x14'),'dialBusyRetryFrequency',_0x0dc4('0x15'),_0x0dc4('0x16'),_0x0dc4('0x17'),_0x0dc4('0x18'),'dialGlobalInterval',_0x0dc4('0x19'),'dialCheckDuplicateType',_0x0dc4('0x1a'),_0x0dc4('0x1b'),_0x0dc4('0x1c'),_0x0dc4('0x1d'),_0x0dc4('0x1e'),_0x0dc4('0x1f'),_0x0dc4('0x20'),_0x0dc4('0x21'),_0x0dc4('0x22'),_0x0dc4('0x23'),_0x0dc4('0x24'),_0x0dc4('0x25'),_0x0dc4('0x26'),_0x0dc4('0x27'),'dialAgiAfterHangupAgent',_0x0dc4('0x28'),_0x0dc4('0x29'),_0x0dc4('0x8'),_0x0dc4('0x2a'),_0x0dc4('0x2b'),_0x0dc4('0x2c'),_0x0dc4('0x2d'),_0x0dc4('0x2e'),_0x0dc4('0x2f'),'dialDropRetryFrequency',_0x0dc4('0x30'),_0x0dc4('0x31'),_0x0dc4('0x32'),_0x0dc4('0x33'),_0x0dc4('0x34'),_0x0dc4('0x35'),'mandatoryDisposition',_0x0dc4('0x36'),_0x0dc4('0x37'),_0x0dc4('0x38'),_0x0dc4('0x39')],'include':[{'model':_0x0dc4('0x3a'),'as':_0x0dc4('0x3a'),'attributes':['id',_0x0dc4('0x4'),_0x0dc4('0x3b'),_0x0dc4('0x3c')]},{'model':_0x0dc4('0x3d'),'as':_0x0dc4('0x3e'),'attributes':['id','name']},{'model':_0x0dc4('0x3a'),'as':_0x0dc4('0x3f'),'attributes':['id',_0x0dc4('0x4'),_0x0dc4('0x3b'),_0x0dc4('0x3c')]},{'model':'Interval','as':_0x0dc4('0x40'),'attributes':['id',_0x0dc4('0x4')],'include':[{'model':_0x0dc4('0x40'),'as':_0x0dc4('0x41'),'attributes':['id','name',_0x0dc4('0x42')]}]}]},'log':_0x0dc4('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 71921fc..fcbd978 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(_0x39621b,_0x525571){var _0x37feba=function(_0x3504eb){while(--_0x3504eb){_0x39621b['push'](_0x39621b['shift']());}};_0x37feba(++_0x525571);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x285bba,_0x2e2ad7){var _0x206af0=function(_0x5445f1){while(--_0x5445f1){_0x285bba['push'](_0x285bba['shift']());}};_0x206af0(++_0x2e2ad7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 cc3a0fe..e25c768 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 _0x2cbd=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x2cbd,0x108));var _0xd2cb=function(_0x47bc5e,_0x6fc500){_0x47bc5e=_0x47bc5e-0x0;var _0x323a59=_0x2cbd[_0x47bc5e];return _0x323a59;};'use strict';var client=require(_0xd2cb('0x0'));exports[_0xd2cb('0x1')]=function(_0x1404aa){return function(){return client[_0xd2cb('0x2')](_0xd2cb('0x3'),{'options':{'where':{'VoiceQueueId':_0x1404aa,'paused':!![]},'raw':!![]},'log':_0xd2cb('0x1')});};}; \ No newline at end of file +var _0x1a4b=['Request','../client'];(function(_0x492000,_0x2aaffb){var _0x341d28=function(_0x26e7cd){while(--_0x26e7cd){_0x492000['push'](_0x492000['shift']());}};_0x341d28(++_0x2aaffb);}(_0x1a4b,0x177));var _0xb1a4=function(_0x33b9be,_0x138040){_0x33b9be=_0x33b9be-0x0;var _0x497455=_0x1a4b[_0x33b9be];return _0x497455;};'use strict';var client=require(_0xb1a4('0x0'));exports['getVoiceQueueRtPauses']=function(_0x38871f){return function(){return client[_0xb1a4('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x38871f,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 322d4af..846a8c7 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(_0x55a078,_0x548edf){var _0x50920b=function(_0x3c57a8){while(--_0x3c57a8){_0x55a078['push'](_0x55a078['shift']());}};_0x50920b(++_0x548edf);}(_0x7a54,0x106));var _0x47a5=function(_0xd74c5c,_0x438922){_0xd74c5c=_0xd74c5c-0x0;var _0x4ee40f=_0x7a54[_0xd74c5c];return _0x4ee40f;};'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(_0x130f1e,_0x574358){var _0x3d0a77=function(_0x200968){while(--_0x200968){_0x130f1e['push'](_0x130f1e['shift']());}};_0x3d0a77(++_0x574358);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 ca1b9b8..a07c73f 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 _0x8fae=['transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','Request','result','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridnum'];(function(_0x3d6db1,_0x4358f8){var _0x5e1cc3=function(_0x3ad5af){while(--_0x3ad5af){_0x3d6db1['push'](_0x3d6db1['shift']());}};_0x5e1cc3(++_0x4358f8);}(_0x8fae,0xeb));var _0xe8fa=function(_0x20fa63,_0x65c8d3){_0x20fa63=_0x20fa63-0x0;var _0x4c37ae=_0x8fae[_0x20fa63];return _0x4c37ae;};'use strict';var client=require('../client');exports[_0xe8fa('0x0')]={};exports[_0xe8fa('0x1')]=function(_0x33abdb){return client['Request'](_0xe8fa('0x2'),{'body':{'result':_0x33abdb['result'],'transfererchannel':_0x33abdb[_0xe8fa('0x3')],'transferercalleridnum':_0x33abdb['transferercalleridnum'],'transferercalleridname':_0x33abdb[_0xe8fa('0x4')],'transfererconnectedlinenum':_0x33abdb['transfererconnectedlinenum'],'transfererconnectedlinename':_0x33abdb[_0xe8fa('0x5')],'transfereraccountcode':_0x33abdb[_0xe8fa('0x6')],'transferercontext':_0x33abdb['transferercontext'],'transfererexten':_0x33abdb['transfererexten'],'transfererlinkedid':_0x33abdb[_0xe8fa('0x7')],'transfereechannel':_0x33abdb[_0xe8fa('0x8')],'transfereecalleridnum':_0x33abdb[_0xe8fa('0x9')],'transfereecalleridname':_0x33abdb[_0xe8fa('0xa')],'transfereeconnectedlinenum':_0x33abdb[_0xe8fa('0xb')],'transfereeconnectedlinename':_0x33abdb[_0xe8fa('0xc')],'transfereeaccountcode':_0x33abdb[_0xe8fa('0xd')],'transfereecontext':_0x33abdb['transfereecontext'],'transfereeexten':_0x33abdb['transfereeexten'],'transfereelinkedid':_0x33abdb[_0xe8fa('0xe')],'isexternal':_0x33abdb[_0xe8fa('0xf')],'context':_0x33abdb[_0xe8fa('0x10')],'extension':_0x33abdb[_0xe8fa('0x11')],'type':_0xe8fa('0x12')},'log':_0xe8fa('0x2')});};exports[_0xe8fa('0x13')]=function(_0x36560a){return client[_0xe8fa('0x14')](_0xe8fa('0x2'),{'body':{'result':_0x36560a[_0xe8fa('0x15')],'transfererchannel':_0x36560a['origtransfererchannel'],'transferercalleridnum':_0x36560a[_0xe8fa('0x16')],'transferercalleridname':_0x36560a['origtransferercalleridname'],'transfererconnectedlinenum':_0x36560a[_0xe8fa('0x17')],'transfererconnectedlinename':_0x36560a[_0xe8fa('0x18')],'transfereraccountcode':_0x36560a[_0xe8fa('0x19')],'transferercontext':_0x36560a['secondtransferercontext'],'transfererexten':_0x36560a[_0xe8fa('0x1a')],'transfererlinkedid':_0x36560a[_0xe8fa('0x1b')],'transfereechannel':_0x36560a[_0xe8fa('0x1c')],'transfereecalleridnum':_0x36560a['transfertargetcalleridnum'],'transfereecalleridname':_0x36560a['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x36560a['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x36560a[_0xe8fa('0x1d')],'transfereeaccountcode':_0x36560a['transfertargetaccountcode'],'transfereecontext':_0x36560a['transfertargetcontext'],'transfereeexten':_0x36560a[_0xe8fa('0x1e')],'transfereelinkedid':_0x36560a[_0xe8fa('0x1f')],'isexternal':_0x36560a['isexternal'],'context':_0x36560a[_0xe8fa('0x20')],'extension':_0x36560a[_0xe8fa('0x21')],'type':_0xe8fa('0x22')},'log':_0xe8fa('0x2')});}; \ No newline at end of file +var _0xd7dc=['transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','isexternal','blind','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten'];(function(_0x27d503,_0x2402d8){var _0x61179c=function(_0x53eecb){while(--_0x53eecb){_0x27d503['push'](_0x27d503['shift']());}};_0x61179c(++_0x2402d8);}(_0xd7dc,0x1cb));var _0xcd7d=function(_0x37ace5,_0x5546de){_0x37ace5=_0x37ace5-0x0;var _0x235299=_0xd7dc[_0x37ace5];return _0x235299;};'use strict';var client=require('../client');exports[_0xcd7d('0x0')]={};exports['blindTransfer']=function(_0x189155){return client['Request'](_0xcd7d('0x1'),{'body':{'result':_0x189155['result'],'transfererchannel':_0x189155[_0xcd7d('0x2')],'transferercalleridnum':_0x189155[_0xcd7d('0x3')],'transferercalleridname':_0x189155[_0xcd7d('0x4')],'transfererconnectedlinenum':_0x189155['transfererconnectedlinenum'],'transfererconnectedlinename':_0x189155[_0xcd7d('0x5')],'transfereraccountcode':_0x189155[_0xcd7d('0x6')],'transferercontext':_0x189155[_0xcd7d('0x7')],'transfererexten':_0x189155['transfererexten'],'transfererlinkedid':_0x189155[_0xcd7d('0x8')],'transfereechannel':_0x189155[_0xcd7d('0x9')],'transfereecalleridnum':_0x189155[_0xcd7d('0xa')],'transfereecalleridname':_0x189155[_0xcd7d('0xb')],'transfereeconnectedlinenum':_0x189155[_0xcd7d('0xc')],'transfereeconnectedlinename':_0x189155[_0xcd7d('0xd')],'transfereeaccountcode':_0x189155['transfereeaccountcode'],'transfereecontext':_0x189155[_0xcd7d('0xe')],'transfereeexten':_0x189155['transfereeexten'],'transfereelinkedid':_0x189155['transfereelinkedid'],'isexternal':_0x189155[_0xcd7d('0xf')],'context':_0x189155['context'],'extension':_0x189155['extension'],'type':_0xcd7d('0x10')},'log':_0xcd7d('0x1')});};exports[_0xcd7d('0x11')]=function(_0x194de9){return client[_0xcd7d('0x12')](_0xcd7d('0x1'),{'body':{'result':_0x194de9[_0xcd7d('0x13')],'transfererchannel':_0x194de9[_0xcd7d('0x14')],'transferercalleridnum':_0x194de9['origtransferercalleridnum'],'transferercalleridname':_0x194de9[_0xcd7d('0x15')],'transfererconnectedlinenum':_0x194de9[_0xcd7d('0x16')],'transfererconnectedlinename':_0x194de9[_0xcd7d('0x17')],'transfereraccountcode':_0x194de9[_0xcd7d('0x18')],'transferercontext':_0x194de9[_0xcd7d('0x19')],'transfererexten':_0x194de9[_0xcd7d('0x1a')],'transfererlinkedid':_0x194de9[_0xcd7d('0x1b')],'transfereechannel':_0x194de9['transfertargetchannel'],'transfereecalleridnum':_0x194de9['transfertargetcalleridnum'],'transfereecalleridname':_0x194de9['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x194de9['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x194de9[_0xcd7d('0x1c')],'transfereeaccountcode':_0x194de9[_0xcd7d('0x1d')],'transfereecontext':_0x194de9['transfertargetcontext'],'transfereeexten':_0x194de9[_0xcd7d('0x1e')],'transfereelinkedid':_0x194de9[_0xcd7d('0x1f')],'isexternal':_0x194de9['isexternal'],'context':_0x194de9[_0xcd7d('0x20')],'extension':_0x194de9[_0xcd7d('0x21')],'type':_0xcd7d('0x22')},'log':_0xcd7d('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index f18e19a..d9a9245 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 _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x5a937b,_0x21e561){var _0x11718f=function(_0x50c4f4){while(--_0x50c4f4){_0x5a937b['push'](_0x5a937b['shift']());}};_0x11718f(++_0x21e561);}(_0xb10b,0x12a));var _0xbb10=function(_0x23118b,_0x562da3){_0x23118b=_0x23118b-0x0;var _0x3636cf=_0xb10b[_0x23118b];return _0x3636cf;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0xa65403,_0x19b508){var _0x2363b3=function(_0xe4e947){while(--_0xe4e947){_0xa65403['push'](_0xa65403['shift']());}};_0x2363b3(++_0x19b508);}(_0x7a54,0x106));var _0x47a5=function(_0xf91d73,_0x428090){_0xf91d73=_0xf91d73-0x0;var _0x42f0e1=_0x7a54[_0xf91d73];return _0x42f0e1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index c81cf6d..b4c3121 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 _0x1507=['localhost','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','fax','createdAt','scheduledAt','updatedAt','union','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','info','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','resolve','then','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis'];(function(_0x134158,_0x31322c){var _0x23cda6=function(_0x9d0c71){while(--_0x9d0c71){_0x134158['push'](_0x134158['shift']());}};_0x23cda6(++_0x31322c);}(_0x1507,0x1bf));var _0x7150=function(_0x12723c,_0x148a5a){_0x12723c=_0x12723c-0x0;var _0x3fc804=_0x1507[_0x12723c];return _0x3fc804;};'use strict';var _=require(_0x7150('0x0'));var BPromise=require(_0x7150('0x1'));var Redis=require(_0x7150('0x2'));var util=require(_0x7150('0x3'));var config=require(_0x7150('0x4'));var logger=require(_0x7150('0x5'))(_0x7150('0x6'));var cmContactRpc=require(_0x7150('0x7'));config['redis']=_['defaults'](config[_0x7150('0x8')],{'host':_0x7150('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4781d6,_0x5e0b48,_0x5e1fa2,_0x30422b,_0x4c5b4f){logger['info'](_0x7150('0xa'),_0x4781d6,_0x5e0b48['id'],_0x5e1fa2,_0x30422b,JSON[_0x7150('0xb')](_0x4c5b4f));io['to'](_0x5e1fa2)[_0x7150('0xc')](_0x30422b,_0x4c5b4f);}exports[_0x7150('0xd')]=function(_0x31d2af,_0x505ccc,_0x4dcdce,_0x1db048){var _0x4bcc11,_0x5e67ad;var _0x442f1a={};var _0x5e410c;var _0x33334c=Number(_0x4dcdce[_0x7150('0xe')]);var _0x21870a=_0x4dcdce[_0x7150('0xf')]?Boolean(Number(_0x4dcdce[_0x7150('0xf')])):![];var _0x947a22;var _0x58a4e5=![];if(!_[_0x7150('0x10')](_0x4dcdce[_0x7150('0x11')])){if(_0x4dcdce[_0x7150('0x11')]=='1')_0x58a4e5=!![];}if(!_0x58a4e5){if(_0x1db048['xmd-contactid']){_0x442f1a['id']=_0x1db048[_0x7150('0x12')];}}if(!_0x442f1a['id']){_0x442f1a[_0x7150('0x13')]=_0x33334c;_0x947a22=_0x4dcdce[_0x7150('0x14')]&&_0x4dcdce['data3']!=='0'?_0x4dcdce[_0x7150('0x14')]['split'](','):[_0x7150('0x15')];_0x442f1a[_0x7150('0x16')]=_[_0x7150('0x17')](_0x947a22,function(_0x3a4ac8){var _0x2367e8={};_0x2367e8[_0x3a4ac8]=_0x1db048[_0x7150('0x18')]?_0x1db048[_0x7150('0x19')]:_0x1db048[_0x7150('0x1a')];return _0x2367e8;});_0x5e410c=_0x1db048['routeId']?_0x1db048[_0x7150('0x19')]:_0x1db048['calleridnum'];}var _0x1284b6=['id',_0x7150('0x1b'),'lastName',_0x7150('0x15'),'mobile',_0x7150('0x1c'),'ListId',_0x7150('0x1d'),_0x7150('0x1e'),_0x7150('0x1f')];var _0x4dcf0f=_[_0x7150('0x20')](_0x1284b6,_0x947a22);BPromise['resolve']()['then'](cmContactRpc[_0x7150('0x21')]({'attributes':_0x4dcf0f,'where':_0x442f1a,'phone':_0x5e410c}))['then'](function(_0x485b05){_0x5e67ad=_0x485b05;if(!_['isEmpty'](_0x5e67ad)){if(_0x5e67ad[_0x7150('0x22')]===0x1){_0x4bcc11=_0x5e67ad[0x0];logger['info'](_0x7150('0x23'),_0x1db048[_0x7150('0x24')],_0x505ccc['id'],_0x4bcc11['id']);}else{logger[_0x7150('0x25')](_0x7150('0x26'),_0x1db048[_0x7150('0x24')],_0x505ccc['id'],_[_0x7150('0x17')](_0x5e67ad,'id')[_0x7150('0x27')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x1db048[_0x7150('0x24')],_0x505ccc['id']);var _0x423483={'ListId':_0x33334c};var _0x49ed5=_0x4dcdce[_0x7150('0x28')]&&_0x4dcdce['data4']!=='0'?_0x4dcdce[_0x7150('0x28')]:'phone';if(_0x21870a){logger[_0x7150('0x25')](_0x7150('0x29'),_0x1db048['uniqueid'],_0x505ccc['id']);_0x423483[_0x49ed5]=_[_0x7150('0x10')](_0x1db048['routeId'])?_0x1db048[_0x7150('0x1a')]:_0x1db048[_0x7150('0x19')];if(_[_0x7150('0x10')](_0x1db048[_0x7150('0x18')])){_0x423483[_0x7150('0x1b')]=_0x1db048[_0x7150('0x2a')]&&_0x1db048['calleridname']!==_0x7150('0x2b')?_0x1db048['calleridname']:_0x7150('0x2c');}else{_0x423483[_0x7150('0x1b')]=_0x1db048[_0x7150('0x2d')]&&_0x1db048[_0x7150('0x2d')]!==_0x7150('0x2b')?_0x1db048['destcalleridname']:_0x7150('0x2c');}return BPromise[_0x7150('0x2e')]()[_0x7150('0x2f')](cmContactRpc[_0x7150('0x30')](_0x423483))[_0x7150('0x2f')](function(_0x394eff){_0x4bcc11=_0x394eff;_0x5e67ad[_0x7150('0x31')](_0x394eff);if(_0x4bcc11){logger[_0x7150('0x25')](_0x7150('0x32'),_0x1db048[_0x7150('0x24')],_0x505ccc['id'],_0x4bcc11['id']);}return;});}else{logger[_0x7150('0x25')](_0x7150('0x33'),_0x1db048['uniqueid'],_0x505ccc['id']);_0x423483[_0x49ed5]=_[_0x7150('0x10')](_0x1db048[_0x7150('0x18')])?_0x1db048['calleridnum']:_0x1db048['destcalleridnum'];if(_[_0x7150('0x10')](_0x1db048[_0x7150('0x18')])){_0x423483[_0x7150('0x1b')]=_0x1db048['calleridname']&&_0x1db048[_0x7150('0x2a')]!==_0x7150('0x2b')?_0x1db048[_0x7150('0x2a')]:_0x7150('0x2c');}else{_0x423483['firstName']=_0x1db048[_0x7150('0x2d')]&&_0x1db048[_0x7150('0x2d')]!==''?_0x1db048['destcalleridname']:_0x7150('0x2c');}_0x4bcc11=_0x423483;_0x5e67ad['push'](_0x423483);return;}}})[_0x7150('0x2f')](function(){if(_0x31d2af){emit(_0x1db048[_0x7150('0x24')],_0x505ccc,util[_0x7150('0x34')]('user:%s',_0x31d2af[_0x7150('0x35')]),util[_0x7150('0x34')](_0x7150('0x36'),_0x4dcdce[_0x7150('0x37')]['toLowerCase']()),{'evt':_[_0x7150('0x38')](_0x1db048,{'autoCreate':_0x21870a}),'contact':_0x4bcc11===undefined?{}:_0x4bcc11,'contacts':_0x5e67ad[_0x7150('0x22')]===0x0?undefined:_0x5e67ad});}});}; \ No newline at end of file +var _0x5a7e=['then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','destcalleridnum','calleridname','','destcalleridname','Unknown','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','util','../../../../config/environment','../../../../config/logger','trigger','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','data5','xmd-contactid','ListId','data3','split','phone','map','routeId','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts'];(function(_0x46d73e,_0x5dcde4){var _0x5025fa=function(_0x3b9eba){while(--_0x3b9eba){_0x46d73e['push'](_0x46d73e['shift']());}};_0x5025fa(++_0x5dcde4);}(_0x5a7e,0x8a));var _0xe5a7=function(_0x3c166e,_0x4b3e17){_0x3c166e=_0x3c166e-0x0;var _0x3a1a3c=_0x5a7e[_0x3c166e];return _0x3a1a3c;};'use strict';var _=require(_0xe5a7('0x0'));var BPromise=require('bluebird');var Redis=require('ioredis');var util=require(_0xe5a7('0x1'));var config=require(_0xe5a7('0x2'));var logger=require(_0xe5a7('0x3'))(_0xe5a7('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0xe5a7('0x5')]=_['defaults'](config['redis'],{'host':_0xe5a7('0x6'),'port':0x18eb});var io=require(_0xe5a7('0x7'))(new Redis(config[_0xe5a7('0x5')]));function emit(_0x19adac,_0x262c9b,_0x519916,_0x2290a2,_0x3946b8){logger[_0xe5a7('0x8')](_0xe5a7('0x9'),_0x19adac,_0x262c9b['id'],_0x519916,_0x2290a2,JSON[_0xe5a7('0xa')](_0x3946b8));io['to'](_0x519916)['emit'](_0x2290a2,_0x3946b8);}exports[_0xe5a7('0xb')]=function(_0x589d84,_0x5eb582,_0x4217ad,_0x3355b1){var _0x345ddc,_0x618353;var _0x3d69ad={};var _0x292ebb;var _0x2b52dd=Number(_0x4217ad[_0xe5a7('0xc')]);var _0x2ee2cd=_0x4217ad[_0xe5a7('0xd')]?Boolean(Number(_0x4217ad['data2'])):![];var _0x3b95ff;var _0x2d682e=![];if(!_['isNil'](_0x4217ad[_0xe5a7('0xe')])){if(_0x4217ad[_0xe5a7('0xe')]=='1')_0x2d682e=!![];}if(!_0x2d682e){if(_0x3355b1[_0xe5a7('0xf')]){_0x3d69ad['id']=_0x3355b1[_0xe5a7('0xf')];}}if(!_0x3d69ad['id']){_0x3d69ad[_0xe5a7('0x10')]=_0x2b52dd;_0x3b95ff=_0x4217ad[_0xe5a7('0x11')]&&_0x4217ad[_0xe5a7('0x11')]!=='0'?_0x4217ad[_0xe5a7('0x11')][_0xe5a7('0x12')](','):[_0xe5a7('0x13')];_0x3d69ad['$or']=_[_0xe5a7('0x14')](_0x3b95ff,function(_0x5bf443){var _0x52a288={};_0x52a288[_0x5bf443]=_0x3355b1[_0xe5a7('0x15')]?_0x3355b1['destcalleridnum']:_0x3355b1[_0xe5a7('0x16')];return _0x52a288;});_0x292ebb=_0x3355b1[_0xe5a7('0x15')]?_0x3355b1['destcalleridnum']:_0x3355b1[_0xe5a7('0x16')];}var _0x10b9f8=['id',_0xe5a7('0x17'),_0xe5a7('0x18'),_0xe5a7('0x13'),_0xe5a7('0x19'),_0xe5a7('0x1a'),'ListId',_0xe5a7('0x1b'),_0xe5a7('0x1c'),_0xe5a7('0x1d')];var _0x45cd85=_[_0xe5a7('0x1e')](_0x10b9f8,_0x3b95ff);BPromise[_0xe5a7('0x1f')]()['then'](cmContactRpc[_0xe5a7('0x20')]({'attributes':_0x45cd85,'where':_0x3d69ad,'phone':_0x292ebb}))[_0xe5a7('0x21')](function(_0x55428c){_0x618353=_0x55428c;if(!_[_0xe5a7('0x22')](_0x618353)){if(_0x618353[_0xe5a7('0x23')]===0x1){_0x345ddc=_0x618353[0x0];logger[_0xe5a7('0x8')](_0xe5a7('0x24'),_0x3355b1[_0xe5a7('0x25')],_0x5eb582['id'],_0x345ddc['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x3355b1[_0xe5a7('0x25')],_0x5eb582['id'],_[_0xe5a7('0x14')](_0x618353,'id')[_0xe5a7('0x26')](','));}return;}else{logger[_0xe5a7('0x8')](_0xe5a7('0x27'),_0x3355b1[_0xe5a7('0x25')],_0x5eb582['id']);var _0x4472a2={'ListId':_0x2b52dd};var _0x5452f6=_0x4217ad[_0xe5a7('0x28')]&&_0x4217ad['data4']!=='0'?_0x4217ad[_0xe5a7('0x28')]:_0xe5a7('0x13');if(_0x2ee2cd){logger[_0xe5a7('0x8')](_0xe5a7('0x29'),_0x3355b1[_0xe5a7('0x25')],_0x5eb582['id']);_0x4472a2[_0x5452f6]=_[_0xe5a7('0x2a')](_0x3355b1[_0xe5a7('0x15')])?_0x3355b1['calleridnum']:_0x3355b1[_0xe5a7('0x2b')];if(_[_0xe5a7('0x2a')](_0x3355b1[_0xe5a7('0x15')])){_0x4472a2[_0xe5a7('0x17')]=_0x3355b1[_0xe5a7('0x2c')]&&_0x3355b1['calleridname']!==_0xe5a7('0x2d')?_0x3355b1[_0xe5a7('0x2c')]:'Unknown';}else{_0x4472a2[_0xe5a7('0x17')]=_0x3355b1[_0xe5a7('0x2e')]&&_0x3355b1[_0xe5a7('0x2e')]!==_0xe5a7('0x2d')?_0x3355b1['destcalleridname']:_0xe5a7('0x2f');}return BPromise[_0xe5a7('0x1f')]()[_0xe5a7('0x21')](cmContactRpc['createContact'](_0x4472a2))['then'](function(_0x180aaa){_0x345ddc=_0x180aaa;_0x618353[_0xe5a7('0x30')](_0x180aaa);if(_0x345ddc){logger[_0xe5a7('0x8')](_0xe5a7('0x31'),_0x3355b1[_0xe5a7('0x25')],_0x5eb582['id'],_0x345ddc['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x3355b1[_0xe5a7('0x25')],_0x5eb582['id']);_0x4472a2[_0x5452f6]=_[_0xe5a7('0x2a')](_0x3355b1[_0xe5a7('0x15')])?_0x3355b1[_0xe5a7('0x16')]:_0x3355b1[_0xe5a7('0x2b')];if(_[_0xe5a7('0x2a')](_0x3355b1[_0xe5a7('0x15')])){_0x4472a2[_0xe5a7('0x17')]=_0x3355b1[_0xe5a7('0x2c')]&&_0x3355b1['calleridname']!==_0xe5a7('0x2d')?_0x3355b1[_0xe5a7('0x2c')]:'Unknown';}else{_0x4472a2[_0xe5a7('0x17')]=_0x3355b1[_0xe5a7('0x2e')]&&_0x3355b1['destcalleridname']!==_0xe5a7('0x2d')?_0x3355b1[_0xe5a7('0x2e')]:_0xe5a7('0x2f');}_0x345ddc=_0x4472a2;_0x618353[_0xe5a7('0x30')](_0x4472a2);return;}}})[_0xe5a7('0x21')](function(){if(_0x589d84){emit(_0x3355b1[_0xe5a7('0x25')],_0x5eb582,util[_0xe5a7('0x32')](_0xe5a7('0x33'),_0x589d84[_0xe5a7('0x34')]),util[_0xe5a7('0x32')](_0xe5a7('0x35'),_0x4217ad[_0xe5a7('0x36')][_0xe5a7('0x37')]()),{'evt':_[_0xe5a7('0x38')](_0x3355b1,{'autoCreate':_0x2ee2cd}),'contact':_0x345ddc===undefined?{}:_0x345ddc,'contacts':_0x618353[_0xe5a7('0x23')]===0x0?undefined:_0x618353});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 64f9775..5f2122b 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 _0x1989=['custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','stringify','clone','motionChannel','undefined','voice','debug','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','Actions','length','action','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','isNil','data3','data4','location','windowWidth','data5','windowHeight','data6','winArguments','user:%s','name','trigger:%s:%s','jscripty','format','toLowerCase','trigger:%s','exec','integration','queue','routeId','urlforward','script','buildUri','query','channel','AllConditions','every','AnyConditions','some','checkConditions','inspect','evt','field','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','substatus','offlineMessage','created','equals','exports','url','mustache','./urlforward','./integration','./script','../../../config/logger','trigger','redis','defaults','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:closedinteraction','custom:substatus'];(function(_0x42e854,_0x397d0e){var _0x3c2b92=function(_0x2e0aac){while(--_0x2e0aac){_0x42e854['push'](_0x42e854['shift']());}};_0x3c2b92(++_0x397d0e);}(_0x1989,0x149));var _0x9198=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1989[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var url=require(_0x9198('0x0'));var Mustache=require(_0x9198('0x1'));var Redis=require('ioredis');var urlforward=require(_0x9198('0x2'));var integration=require(_0x9198('0x3'));var cmContact=require('./cmContact');var script=require(_0x9198('0x4'));var config=require('../../../config/environment');var logger=require(_0x9198('0x5'))(_0x9198('0x6'));var ami=require('../ami');config[_0x9198('0x7')]=_[_0x9198('0x8')](config[_0x9198('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x9198('0x9'))(new Redis(config[_0x9198('0x7')]));var operators={'equals':function(_0xf7d7ba,_0x283243){return _0xf7d7ba==_0x283243;},'not_equals':function(_0x150e2a,_0x580fec){return _0x150e2a!=_0x580fec;}};var barAndWebActions=[_0x9198('0xa'),'url',_0x9198('0xb')];function Trigger(_0xe7f4a1){this['triggers']=_0xe7f4a1[_0x9198('0xc')];this[_0x9198('0xd')]=_0xe7f4a1[_0x9198('0xd')];this['voiceQueues']=_0xe7f4a1[_0x9198('0xe')];this[_0x9198('0xf')]=_0xe7f4a1[_0x9198('0xf')];this['voiceExtensions']=_0xe7f4a1[_0x9198('0x10')];this[_0x9198('0x11')]=_0xe7f4a1['zendeskAccounts'];this[_0x9198('0x12')]=_0xe7f4a1[_0x9198('0x12')];this[_0x9198('0x13')]=_0xe7f4a1[_0x9198('0x13')];this[_0x9198('0x14')]=_0xe7f4a1[_0x9198('0x14')];this['zohoAccounts']=_0xe7f4a1[_0x9198('0x15')];this[_0x9198('0x16')]=_0xe7f4a1[_0x9198('0x16')];this[_0x9198('0x17')]=_0xe7f4a1[_0x9198('0x17')];this[_0x9198('0x18')]=_0xe7f4a1['servicenowAccounts'];this[_0x9198('0x19')]=_0xe7f4a1[_0x9198('0x19')];this[_0x9198('0x1a')]=_0xe7f4a1[_0x9198('0x1a')];this[_0x9198('0x1b')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x9198('0x13')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x9198('0x14')],'zoho':this[_0x9198('0x15')],'desk':this[_0x9198('0x16')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x9198('0x19')],'freshsales':this[_0x9198('0x1a')],'servicenow':this['servicenowAccounts']};ami['on'](_0x9198('0x1c'),this[_0x9198('0x1d')][_0x9198('0x1e')](this));ami['on'](_0x9198('0x1f'),this[_0x9198('0x1d')]['bind'](this));ami['on'](_0x9198('0x20'),this[_0x9198('0x1d')][_0x9198('0x1e')](this));ami['on']('custom:agentcomplete',this[_0x9198('0x1d')]['bind'](this));ami['on'](_0x9198('0x21'),this[_0x9198('0x1d')][_0x9198('0x1e')](this));ami['on'](_0x9198('0x22'),this[_0x9198('0x1d')][_0x9198('0x1e')](this));ami['on'](_0x9198('0x23'),this[_0x9198('0x1d')][_0x9198('0x1e')](this));ami['on']('custom:agentcongestion',this[_0x9198('0x1d')][_0x9198('0x1e')](this));ami['on'](_0x9198('0x24'),this[_0x9198('0x1d')][_0x9198('0x1e')](this));ami['on']('custom:amd',this[_0x9198('0x1d')]['bind'](this));ami['on']('custom:queuecallerabandon',this[_0x9198('0x1d')][_0x9198('0x1e')](this));ami['on'](_0x9198('0x25'),this['syncCustomEvent'][_0x9198('0x1e')](this));ami['on'](_0x9198('0x26'),this['syncAgentDial'][_0x9198('0x1e')](this));ami['on'](_0x9198('0x27'),this['syncAgentDial'][_0x9198('0x1e')](this));ami['on']('custom:dialend',this[_0x9198('0x28')][_0x9198('0x1e')](this));ami['on']('custom:newinteraction',this[_0x9198('0x1d')][_0x9198('0x1e')](this));ami['on'](_0x9198('0x29'),this['syncCustomEvent']['bind'](this));ami['on'](_0x9198('0x2a'),this[_0x9198('0x1d')][_0x9198('0x1e')](this));ami['on'](_0x9198('0x2b'),this[_0x9198('0x1d')][_0x9198('0x1e')](this));ami['on'](_0x9198('0x2c'),this['syncCustomEvent']['bind'](this));ami['on'](_0x9198('0x2d'),this[_0x9198('0x1d')][_0x9198('0x1e')](this));ami['on'](_0x9198('0x2e'),this[_0x9198('0x1d')][_0x9198('0x1e')](this));ami['on'](_0x9198('0x2f'),this[_0x9198('0x1d')][_0x9198('0x1e')](this));}Trigger[_0x9198('0x30')][_0x9198('0x31')]=function(_0x482fb3,_0x4ed541,_0x133cf8){logger['info'](_0x482fb3,_0x4ed541,JSON[_0x9198('0x32')](_0x133cf8));io['to'](_0x482fb3)[_0x9198('0x31')](_0x4ed541,_0x133cf8);};Trigger[_0x9198('0x30')][_0x9198('0x1d')]=function(_0x4248ce){var _0x556ef4=_[_0x9198('0x33')](_0x4248ce);if(typeof _0x556ef4[_0x9198('0x34')]===_0x9198('0x35')){_0x556ef4['motionChannel']=_0x9198('0x36');}logger[_0x9198('0x37')]('syncCustomEvent',util['inspect'](_0x556ef4,{'showHidden':!![],'depth':null}));this[_0x9198('0x38')](_0x556ef4);};Trigger['prototype'][_0x9198('0x28')]=function(_0x1efac3){if(this[_0x9198('0xd')][_0x1efac3[_0x9198('0x39')]]){this[_0x9198('0x1d')](_0x1efac3);}};Trigger[_0x9198('0x30')][_0x9198('0x38')]=function(_0x230a79){var _0x54a82e;for(var _0x348c2c in this[_0x9198('0xc')]){if(this['triggers'][_0x9198('0x3a')](_0x348c2c)){if(this[_0x9198('0xc')][_0x348c2c]['status']){_0x54a82e=this[_0x9198('0x3b')](this[_0x9198('0xc')][_0x348c2c],_0x230a79);if(_0x54a82e){_[_0x9198('0x3c')](_0x230a79,_0x230a79['variables']);for(var _0x3519b7=0x0,_0x573ef0,_0x8e006a,_0x5042cb;_0x3519b70x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','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','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x279f6b,_0x24dbf2){var _0x5c04db=function(_0x4f22ed){while(--_0x4f22ed){_0x279f6b['push'](_0x279f6b['shift']());}};_0x5c04db(++_0x24dbf2);}(_0x814b,0x1a2));var _0xb814=function(_0x3f4a8e,_0x507c39){_0x3f4a8e=_0x3f4a8e-0x0;var _0x7f68fd=_0x814b[_0x3f4a8e];return _0x7f68fd;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ 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 54eb138..83a96c0 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 _0x949e=['ticketType','incident','incidents','getString','Subjects','Fields','phonecall','callDirection','queue','/contacts(','phonecalls','assign','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','email','length','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','catch','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','nameField','customField','idField'];(function(_0x354d5b,_0x4aa2be){var _0x46aeed=function(_0x539412){while(--_0x539412){_0x354d5b['push'](_0x354d5b['shift']());}};_0x46aeed(++_0x4aa2be);}(_0x949e,0x169));var _0xe949=function(_0x35b958,_0x34c97c){_0x35b958=_0x35b958-0x0;var _0xb0daed=_0x949e[_0x35b958];return _0xb0daed;};'use strict';var _=require(_0xe949('0x0'));var rp=require('request-promise');var util=require(_0xe949('0x1'));var intUtil=require(_0xe949('0x2'));var md5=require(_0xe949('0x3'));var Redis=require(_0xe949('0x4'));var logger=require(_0xe949('0x5'))(_0xe949('0x6'));var config=require(_0xe949('0x7'));config['redis']=_['defaults'](config[_0xe949('0x8')],{'host':_0xe949('0x9'),'port':0x18eb});var io=require(_0xe949('0xa'))(new Redis(config[_0xe949('0x8')]));function getAuthToken(_0x9db3f6,_0x1b86fe,_0x49b0d6){if(_0x9db3f6[_0xe949('0xb')]){_0x9db3f6[_0xe949('0xc')]=_0x9db3f6[_0xe949('0xd')][_0xe949('0xe')];_0x9db3f6[_0xe949('0xf')]=_0x9db3f6[_0xe949('0xd')]['data2'];return Promise[_0xe949('0x10')](_0x9db3f6[_0xe949('0xd')][_0xe949('0x11')]);}var _0x3462c8={'method':_0xe949('0x12'),'uri':_0x1b86fe,'form':{'client_id':_0x9db3f6[_0xe949('0x13')],'resource':_0x9db3f6[_0xe949('0xc')],'username':_0x9db3f6[_0xe949('0x14')],'password':_0x9db3f6[_0xe949('0x15')],'grant_type':_0xe949('0x15'),'client_secret':_0x9db3f6[_0xe949('0x16')]},'json':!![]};return rp(_0x3462c8)[_0xe949('0x17')](function(_0x285384){return _0x285384[_0xe949('0x18')];})['catch'](function(_0x878b7c){logger[_0xe949('0x19')]('['+[_0x49b0d6['toUpperCase']()]+_0xe949('0x1a'));return _0x878b7c[_0xe949('0x1b')];});}function getUser(_0x5233c2,_0x3cd87a,_0x202565,_0x304057,_0x1d2f86,_0x2cd23d){return new Promise(function(_0x2bb3d2,_0x2934ad){return getAuthToken(_0x3cd87a,_0x304057,_0x2cd23d)['then'](function(_0xe96797){var _0x2c0eee={'method':_0xe949('0x1c'),'uri':_0x1d2f86+_0xe949('0x1d'),'headers':{'Authorization':_0xe949('0x1e')+_0xe96797,'OData-Version':_0xe949('0x1f')},'json':!![]};return rp(_0x2c0eee);})[_0xe949('0x17')](function(_0x4b558a){var _0x4e5700=_0x4b558a[_0xe949('0x20')];var _0x1ddb0d=![];var _0x347f52=null;if(!_[_0xe949('0x21')](_0x202565)){if(intUtil[_0xe949('0x22')](_0x202565['email'])){_0x5233c2[_0xe949('0x23')]=_0x202565[_0xe949('0x24')];for(_0x347f52=0x0;_0x347f52<_0x4e5700[_0xe949('0x25')];_0x347f52++){if(_0x4e5700[_0x347f52]['internalemailaddress']===_0x202565[_0xe949('0x24')]&&!_0x4e5700[_0x347f52]['isdisabled']){_0x1ddb0d=!![];logger[_0xe949('0x26')]('['+[_0x2cd23d[_0xe949('0x27')]()]+_0xe949('0x28')+_0x4e5700[_0x347f52][_0xe949('0x29')]+'!');_0x5233c2[_0xe949('0x2a')]=_0x4e5700[_0x347f52][_0xe949('0x29')];}}}}if(!_0x1ddb0d){logger[_0xe949('0x26')]('['+[_0x2cd23d['toUpperCase']()]+_0xe949('0x2b'));_0x5233c2[_0xe949('0x23')]=_0x3cd87a['username'];for(_0x347f52=0x0;_0x347f52<_0x4e5700[_0xe949('0x25')];_0x347f52++){if(_0x4e5700[_0x347f52]['internalemailaddress']===_0x3cd87a[_0xe949('0x14')]){_0x5233c2['userId']=_0x4e5700[_0x347f52][_0xe949('0x29')];}}}_0x2bb3d2(_0x5233c2);})['catch'](function(_0x376240){_0x2934ad(_0x376240['message']);});});}function createEndUser(_0x4a054a,_0x4a5039,_0x11e867,_0x18b1e0,_0x149338,_0x1cc436,_0x4aed0c){return new Promise(function(_0x354876,_0x324640){return getAuthToken(_0x4a5039,_0x11e867,_0x1cc436)['then'](function(_0xfa6bbd){var _0x417eb0=_0x1cc436[_0xe949('0x2c')]()===_0xe949('0x2d')?_0x149338[_0xe949('0x2e')]:_0x149338[_0xe949('0x2f')];var _0x2705db={'method':_0xe949('0x12'),'uri':_0x18b1e0+_0xe949('0x30'),'body':{'fullname':_0x417eb0,'firstname':_0x417eb0,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe949('0x31')+_0x4a054a[_0xe949('0x2a')]+')'},'headers':{'Authorization':_0xe949('0x1e')+_0xfa6bbd,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x2705db['body'][_0x4aed0c]=_0x417eb0;return rp(_0x2705db);})[_0xe949('0x17')](function(_0x1c720a){var _0x548308=_0x1c720a[_0xe949('0x32')][_0xe949('0x33')];var _0x1f1d6e=_0x548308[_0xe949('0x34')](_0x548308[_0xe949('0x35')]('(')+0x1,_0x548308[_0xe949('0x35')](')'));_0x4a054a[_0xe949('0x36')]=_0x1f1d6e;_0x354876(_0x4a054a);})[_0xe949('0x37')](function(_0xd0caf6){_0x324640(_0xd0caf6[_0xe949('0x1b')]);});});}function getEndUser(_0x5fcbad,_0x251ac5,_0x3e3c22,_0x38878d,_0x1da49e,_0x44b9b9,_0x42121f,_0x63b199){var _0x13cdd6=_0x44b9b9[_0xe949('0x2c')]()==='outbound'?_0x1da49e[_0xe949('0x2e')]:_0x1da49e[_0xe949('0x2f')];return getAuthToken(_0x251ac5,_0x3e3c22,_0x44b9b9)[_0xe949('0x17')](function(_0xaa0d58){_0x63b199=_0x63b199?_0x63b199:'telephone1';var _0x52c9f9={'method':_0xe949('0x1c'),'uri':_0x38878d+_0xe949('0x38')+_0x63b199+_0xe949('0x39')+_0x63b199+_0xe949('0x3a')+_0x13cdd6[_0xe949('0x3b')]('+',_0xe949('0x3c'))+'\x27','headers':{'Authorization':_0xe949('0x1e')+_0xaa0d58,'If-None-Match':null,'OData-Version':_0xe949('0x1f')},'json':!![]};return rp(_0x52c9f9);})[_0xe949('0x17')](function(_0x3f7bb6){var _0x4598c1=![];if(!_0x3f7bb6)return _0x4598c1;var _0x3725ab=_0x3f7bb6[_0xe949('0x20')];for(var _0x161c95=0x0;_0x161c95<_0x3725ab['length'];_0x161c95++){if(_0x3725ab[_0x161c95][_0x63b199]===_0x13cdd6){_0x4598c1=!![];_0x5fcbad[_0xe949('0x36')]=_0x3725ab[_0x161c95][_0xe949('0x3d')];}}return _0x4598c1;})[_0xe949('0x17')](function(_0x2a18b0){if(_0x2a18b0)return _0x5fcbad;if(_0x42121f===_0xe949('0x3e')){logger['info']('['+[_0x44b9b9[_0xe949('0x27')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x5fcbad;}return createEndUser(_0x5fcbad,_0x251ac5,_0x3e3c22,_0x38878d,_0x1da49e,_0x44b9b9,_0x63b199)[_0xe949('0x17')](function(_0x43e8af){logger[_0xe949('0x26')]('['+[_0x44b9b9[_0xe949('0x27')]()]+_0xe949('0x3f'),_0x43e8af[_0xe949('0x36')]);return _0x43e8af;});});}function getCustomFields(_0x5e5ebe,_0x44294a,_0x7c0369){var _0x54e866={};if(_0x5e5ebe['length']>0x0){_[_0xe949('0x40')](_0x5e5ebe,function(_0x22ed10){if(_['includes']([_0xe949('0x41'),_0xe949('0x42')],_0x22ed10[_0xe949('0x43')])&&_0x22ed10[_0xe949('0x44')]&&!_0x22ed10[_0xe949('0x45')]){var _0x2be0a2=_0x22ed10[_0xe949('0x46')][_0xe949('0x2c')]();var _0x3e8017=_0x2be0a2[_0xe949('0x34')](0x0,_0x2be0a2['indexOf']('_'));var _0x595dac=_0x2be0a2[_0xe949('0x34')](_0x2be0a2['indexOf']('_')+0x1);if(_0x3e8017===_0x7c0369){_0x54e866[_0x595dac]=_0x22ed10['content'];}}});}return _0x54e866;}function getTicket(_0x3e7f35,_0x4a1220,_0x1c6f0b,_0x1d8f9e,_0x579389,_0x5b8963,_0x35d044){return new Promise(function(_0x1d780e,_0x411fd4){var _0x3ff764;return getAuthToken(_0x4a1220,_0x1c6f0b,_0x35d044)[_0xe949('0x17')](function(_0x517b32){if(_0x5b8963[_0xe949('0x47')]===_0xe949('0x48')){_0x3ff764={'method':_0xe949('0x12'),'uri':_0x1d8f9e+_0xe949('0x49'),'body':Object['assign']({},{'title':intUtil[_0xe949('0x4a')](_0x5b8963[_0xe949('0x4b')],_0x579389,'\x20'),'description':intUtil['getString'](_0x5b8963['Descriptions'],_0x579389,'\x0a'),'customerid_contact@odata.bind':_0x3e7f35[_0xe949('0x36')]?'/contacts('+_0x3e7f35['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x3e7f35[_0xe949('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x5b8963[_0xe949('0x4c')],_0x579389,_0x5b8963[_0xe949('0x47')])),'headers':{'Authorization':_0xe949('0x1e')+_0x517b32,'OData-Version':_0xe949('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5b8963['ticketType']===_0xe949('0x4d')){var _0x4ee648=_0x3e7f35[_0xe949('0x36')]?[{'partyid_systemuser@odata.bind':_0xe949('0x31')+_0x3e7f35[_0xe949('0x2a')]+')','participationtypemask':_0x3e7f35[_0xe949('0x4e')]===_0xe949('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0xe949('0x50')+_0x3e7f35[_0xe949('0x36')]+')','participationtypemask':_0x3e7f35[_0xe949('0x4e')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xe949('0x31')+_0x3e7f35[_0xe949('0x2a')]+')','participationtypemask':_0x3e7f35[_0xe949('0x4e')]===_0xe949('0x4f')?0x2:0x1}];_0x3ff764={'method':_0xe949('0x12'),'uri':_0x1d8f9e+_0xe949('0x51'),'body':Object[_0xe949('0x52')]({},{'subject':intUtil[_0xe949('0x4a')](_0x5b8963[_0xe949('0x4b')],_0x579389,'\x20'),'phonenumber':String(_0x579389[_0xe949('0x2f')]),'description':intUtil[_0xe949('0x4a')](_0x5b8963['Descriptions'],_0x579389,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3e7f35[_0xe949('0x36')]?_0xe949('0x50')+_0x3e7f35[_0xe949('0x36')]+')':undefined,'ownerid@odata.bind':_0xe949('0x31')+_0x3e7f35[_0xe949('0x2a')]+')','directioncode':_0x3e7f35[_0xe949('0x4e')]===_0xe949('0x4f')?![]:!![],'phonecall_activity_parties':_0x4ee648},getCustomFields(_0x5b8963[_0xe949('0x4c')],_0x579389,_0x5b8963[_0xe949('0x47')])),'headers':{'Authorization':_0xe949('0x1e')+_0x517b32,'OData-Version':_0xe949('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3ff764);})[_0xe949('0x17')](function(_0x53a5e8){var _0x20910c=_0x53a5e8[_0xe949('0x32')]['odata-entityid'];var _0x5f4016=_0x20910c[_0xe949('0x34')](_0x20910c[_0xe949('0x35')]('(')+0x1,_0x20910c['lastIndexOf'](')'));_0x3e7f35['ticketId']=_0x5f4016;_0x1d780e(_0x3e7f35);})[_0xe949('0x37')](function(_0x47c8f8){_0x411fd4(_0x47c8f8['message']);});});}function emit(_0x1dceab,_0x1b426c,_0x27a172,_0x518d3b){var _0x468f0e={'uri':util[_0xe949('0x53')](_0xe949('0x54'),_0x1dceab,_0x27a172,_0x518d3b)};io['to'](util['format'](_0xe949('0x55'),_0x1b426c))['emit'](_0xe949('0x56'),_0x468f0e);}exports['cs']=function(_0x13d75b,_0xe3f746,_0xb25f20,_0x2fbc86,_0x402eda,_0x26b7c8,_0x46894f,_0x4febc0){var _0x42d271={};_0x26b7c8[_0xe949('0xc')]=_0x26b7c8['modernAuthentication']?intUtil['stripTrailingSlash'](_0x26b7c8[_0xe949('0xd')][_0xe949('0xe')]):intUtil[_0xe949('0x57')](_0x26b7c8['remoteUri']);_0x26b7c8['serverUrl']=intUtil[_0xe949('0x57')](_0x26b7c8['serverUrl']);_0x42d271[_0xe949('0x4e')]=_0x4febc0===_0xe949('0x4f')||_0x4febc0===_0xe949('0x58')?_0xe949('0x4f'):_0xe949('0x2d');var _0x46df50=_0x26b7c8[_0xe949('0xb')]?util[_0xe949('0x53')](_0xe949('0x59'),_0x26b7c8[_0xe949('0xd')][_0xe949('0xe')]):util[_0xe949('0x53')](_0xe949('0x59'),_0x26b7c8[_0xe949('0xc')]);var _0xa95ce2=util['format'](_0xe949('0x5a'),_0x26b7c8[_0xe949('0xf')]);var _0x3aed95=util[_0xe949('0x53')](_0xe949('0x5b'),_0x26b7c8['serverUrl'],_0xe3f746[_0xe949('0x5c')],md5(_0xe3f746['uniqueid']));if(_0x402eda&&_0x402eda[_0xe949('0x5d')]){logger[_0xe949('0x26')](_0xe949('0x5e'),'Recording\x20is\x20enabled!');_0xe3f746[_0xe949('0x5f')]=_0x3aed95;}else if(_0x46894f&&_0x46894f['recordingFormat']&&_0x46894f[_0xe949('0x60')]!==_0xe949('0x61')){logger[_0xe949('0x26')](_0xe949('0x62'),'Recording\x20is\x20enabled!');_0xe3f746[_0xe949('0x5f')]=_0x3aed95;}else{_0xe3f746[_0xe949('0x5f')]='';}return getUser(_0x42d271,_0x26b7c8,_0x2fbc86,_0xa95ce2,_0x46df50,_0x4febc0)[_0xe949('0x17')](function(_0x492594){logger['info']('['+_0x4febc0[_0xe949('0x27')]()+']\x20The\x20User\x20ID\x20is:',_0x492594[_0xe949('0x2a')]);logger[_0xe949('0x26')]('['+_0x4febc0[_0xe949('0x27')]()+_0xe949('0x63'),_0x492594[_0xe949('0x23')]);return getEndUser(_0x492594,_0x26b7c8,_0xa95ce2,_0x46df50,_0xe3f746,_0x4febc0,_0xb25f20[_0xe949('0x64')],_0xb25f20[_0xe949('0x65')]);})[_0xe949('0x17')](function(_0x4a52ed){logger['info']('['+_0x4febc0[_0xe949('0x27')]()+_0xe949('0x66'),_0x4a52ed[_0xe949('0x36')]);logger[_0xe949('0x26')]('['+_0x4febc0[_0xe949('0x27')]()+_0xe949('0x67'),_0xe3f746[_0xe949('0x2f')]);return getTicket(_0x4a52ed,_0x26b7c8,_0xa95ce2,_0x46df50,_0xe3f746,_0xb25f20,_0x4febc0);})[_0xe949('0x17')](function(_0x5d7416){logger['info'](util['format']('['+_0x4febc0[_0xe949('0x27')]()+_0xe949('0x68'),_0xb25f20['ticketType'],_0x5d7416[_0xe949('0x69')]));logger[_0xe949('0x26')](util[_0xe949('0x53')]('['+_0x4febc0[_0xe949('0x27')]()+_0xe949('0x6a'),_0x4febc0));if(_0x4febc0!==_0xe949('0x58')&&_0xb25f20['openNewTab']){logger['info']('['+_0x4febc0[_0xe949('0x27')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x26b7c8[_0xe949('0xc')],_0x2fbc86['name'],_0xb25f20['ticketType'],_0x5d7416[_0xe949('0x69')]);}})[_0xe949('0x37')](function(_0x26d42e){logger['error']('['+_0x4febc0[_0xe949('0x27')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x26d42e[_0xe949('0x1b')]);console['error'](_0xe949('0x6b'),_0x26d42e);});}; \ No newline at end of file +var _0xe249=[']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','message','toLowerCase','outbound','calleridnum','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','contacts?$select=','&$filter=','replace','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','length','includes','picklist','type','nameField','idField','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','callDirection','queue','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','then','access_token','catch','error',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','userId','systemuserid'];(function(_0x2a0439,_0x5c45bb){var _0x21c22a=function(_0x505299){while(--_0x505299){_0x2a0439['push'](_0x2a0439['shift']());}};_0x21c22a(++_0x5c45bb);}(_0xe249,0x195));var _0x9e24=function(_0x5d4d09,_0x436d6e){_0x5d4d09=_0x5d4d09-0x0;var _0xebe078=_0xe249[_0x5d4d09];return _0xebe078;};'use strict';var _=require(_0x9e24('0x0'));var rp=require(_0x9e24('0x1'));var util=require(_0x9e24('0x2'));var intUtil=require('./util');var md5=require(_0x9e24('0x3'));var Redis=require(_0x9e24('0x4'));var logger=require(_0x9e24('0x5'))(_0x9e24('0x6'));var config=require(_0x9e24('0x7'));config['redis']=_[_0x9e24('0x8')](config[_0x9e24('0x9')],{'host':_0x9e24('0xa'),'port':0x18eb});var io=require(_0x9e24('0xb'))(new Redis(config[_0x9e24('0x9')]));function getAuthToken(_0x36d018,_0x296481,_0x37e5f4){if(_0x36d018[_0x9e24('0xc')]){_0x36d018[_0x9e24('0xd')]=_0x36d018[_0x9e24('0xe')][_0x9e24('0xf')];_0x36d018[_0x9e24('0x10')]=_0x36d018[_0x9e24('0xe')][_0x9e24('0x11')];return Promise[_0x9e24('0x12')](_0x36d018[_0x9e24('0xe')][_0x9e24('0x13')]);}var _0x1290c2={'method':_0x9e24('0x14'),'uri':_0x296481,'form':{'client_id':_0x36d018[_0x9e24('0x15')],'resource':_0x36d018['remoteUri'],'username':_0x36d018[_0x9e24('0x16')],'password':_0x36d018['password'],'grant_type':_0x9e24('0x17'),'client_secret':_0x36d018['clientSecret']},'json':!![]};return rp(_0x1290c2)[_0x9e24('0x18')](function(_0x64c2cb){return _0x64c2cb[_0x9e24('0x19')];})[_0x9e24('0x1a')](function(_0x331cd2){logger[_0x9e24('0x1b')]('['+[_0x37e5f4['toUpperCase']()]+_0x9e24('0x1c'));return _0x331cd2['message'];});}function getUser(_0x2f006a,_0x5d79ee,_0x581ffd,_0x1e4de0,_0x397366,_0xbf60ea){return new Promise(function(_0x3c38bc,_0x2e6724){return getAuthToken(_0x5d79ee,_0x1e4de0,_0xbf60ea)[_0x9e24('0x18')](function(_0x3c1106){var _0x3e134c={'method':_0x9e24('0x1d'),'uri':_0x397366+_0x9e24('0x1e'),'headers':{'Authorization':_0x9e24('0x1f')+_0x3c1106,'OData-Version':_0x9e24('0x20')},'json':!![]};return rp(_0x3e134c);})['then'](function(_0x4ccf27){var _0x426e01=_0x4ccf27[_0x9e24('0x21')];var _0x2b750e=![];var _0x3f8e9d=null;if(!_['isNil'](_0x581ffd)){if(intUtil[_0x9e24('0x22')](_0x581ffd[_0x9e24('0x23')])){_0x2f006a[_0x9e24('0x24')]=_0x581ffd[_0x9e24('0x23')];for(_0x3f8e9d=0x0;_0x3f8e9d<_0x426e01['length'];_0x3f8e9d++){if(_0x426e01[_0x3f8e9d]['internalemailaddress']===_0x581ffd[_0x9e24('0x23')]&&!_0x426e01[_0x3f8e9d][_0x9e24('0x25')]){_0x2b750e=!![];logger[_0x9e24('0x26')]('['+[_0xbf60ea[_0x9e24('0x27')]()]+_0x9e24('0x28')+_0x426e01[_0x3f8e9d]['systemuserid']+'!');_0x2f006a[_0x9e24('0x29')]=_0x426e01[_0x3f8e9d][_0x9e24('0x2a')];}}}}if(!_0x2b750e){logger[_0x9e24('0x26')]('['+[_0xbf60ea[_0x9e24('0x27')]()]+_0x9e24('0x2b'));_0x2f006a[_0x9e24('0x24')]=_0x5d79ee[_0x9e24('0x16')];for(_0x3f8e9d=0x0;_0x3f8e9d<_0x426e01['length'];_0x3f8e9d++){if(_0x426e01[_0x3f8e9d][_0x9e24('0x2c')]===_0x5d79ee['username']){_0x2f006a[_0x9e24('0x29')]=_0x426e01[_0x3f8e9d][_0x9e24('0x2a')];}}}_0x3c38bc(_0x2f006a);})['catch'](function(_0x494f08){_0x2e6724(_0x494f08[_0x9e24('0x2d')]);});});}function createEndUser(_0x1a03f4,_0x4b7370,_0x39b47e,_0x5ab8be,_0x185bbe,_0x3fc63c,_0x54e40e){return new Promise(function(_0x506e8f,_0x114ed8){return getAuthToken(_0x4b7370,_0x39b47e,_0x3fc63c)[_0x9e24('0x18')](function(_0x4b61a5){var _0x2bb34b=_0x3fc63c[_0x9e24('0x2e')]()===_0x9e24('0x2f')?_0x185bbe['destcalleridnum']:_0x185bbe[_0x9e24('0x30')];var _0x37b8a0={'method':_0x9e24('0x14'),'uri':_0x5ab8be+'contacts','body':{'fullname':_0x2bb34b,'firstname':_0x2bb34b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x9e24('0x31')+_0x1a03f4[_0x9e24('0x29')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4b61a5,'OData-Version':_0x9e24('0x20')},'json':!![],'resolveWithFullResponse':!![]};_0x37b8a0[_0x9e24('0x32')][_0x54e40e]=_0x2bb34b;return rp(_0x37b8a0);})[_0x9e24('0x18')](function(_0x34052d){var _0x20d4c2=_0x34052d[_0x9e24('0x33')][_0x9e24('0x34')];var _0x4c6c98=_0x20d4c2[_0x9e24('0x35')](_0x20d4c2['lastIndexOf']('(')+0x1,_0x20d4c2[_0x9e24('0x36')](')'));_0x1a03f4[_0x9e24('0x37')]=_0x4c6c98;_0x506e8f(_0x1a03f4);})[_0x9e24('0x1a')](function(_0x4306d0){_0x114ed8(_0x4306d0[_0x9e24('0x2d')]);});});}function getEndUser(_0x494fe2,_0x1e70d4,_0x3c1830,_0x510d3e,_0x503e4e,_0x31ff73,_0x329b17,_0x2da9ce){var _0x292d18=_0x31ff73[_0x9e24('0x2e')]()==='outbound'?_0x503e4e[_0x9e24('0x38')]:_0x503e4e[_0x9e24('0x30')];return getAuthToken(_0x1e70d4,_0x3c1830,_0x31ff73)['then'](function(_0x5dc3e5){_0x2da9ce=_0x2da9ce?_0x2da9ce:_0x9e24('0x39');var _0x40b529={'method':_0x9e24('0x1d'),'uri':_0x510d3e+_0x9e24('0x3a')+_0x2da9ce+_0x9e24('0x3b')+_0x2da9ce+'\x20eq\x20\x27'+_0x292d18[_0x9e24('0x3c')]('+','%2b')+'\x27','headers':{'Authorization':_0x9e24('0x1f')+_0x5dc3e5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x40b529);})[_0x9e24('0x18')](function(_0x29acc9){var _0x35a3bc=![];if(!_0x29acc9)return _0x35a3bc;var _0x3faf69=_0x29acc9['value'];for(var _0x2b0e87=0x0;_0x2b0e87<_0x3faf69['length'];_0x2b0e87++){if(_0x3faf69[_0x2b0e87][_0x2da9ce]===_0x292d18){_0x35a3bc=!![];_0x494fe2[_0x9e24('0x37')]=_0x3faf69[_0x2b0e87][_0x9e24('0x3d')];}}return _0x35a3bc;})['then'](function(_0x277d65){if(_0x277d65)return _0x494fe2;if(_0x329b17==='nothing'){logger['info']('['+[_0x31ff73[_0x9e24('0x27')]()]+_0x9e24('0x3e'));return _0x494fe2;}return createEndUser(_0x494fe2,_0x1e70d4,_0x3c1830,_0x510d3e,_0x503e4e,_0x31ff73,_0x2da9ce)[_0x9e24('0x18')](function(_0xd6b4a8){logger[_0x9e24('0x26')]('['+[_0x31ff73[_0x9e24('0x27')]()]+']\x20Enduser\x20created!',_0xd6b4a8[_0x9e24('0x37')]);return _0xd6b4a8;});});}function getCustomFields(_0x52a389,_0x80baf4,_0x276ebc){var _0x18acd8={};if(_0x52a389[_0x9e24('0x3f')]>0x0){_['forEach'](_0x52a389,function(_0x5961f6){if(_[_0x9e24('0x40')](['string',_0x9e24('0x41')],_0x5961f6[_0x9e24('0x42')])&&_0x5961f6[_0x9e24('0x43')]&&!_0x5961f6['customField']){var _0x569dbd=_0x5961f6[_0x9e24('0x44')][_0x9e24('0x2e')]();var _0x36a0bd=_0x569dbd[_0x9e24('0x35')](0x0,_0x569dbd[_0x9e24('0x45')]('_'));var _0x2505a9=_0x569dbd[_0x9e24('0x35')](_0x569dbd[_0x9e24('0x45')]('_')+0x1);if(_0x36a0bd===_0x276ebc){_0x18acd8[_0x2505a9]=_0x5961f6[_0x9e24('0x46')];}}});}return _0x18acd8;}function getTicket(_0x4b1492,_0x28104a,_0x5edcf0,_0x6e5e88,_0x2ef6a5,_0x448d9d,_0x27096f){return new Promise(function(_0x3c408b,_0x5e34ed){var _0x4009bf;return getAuthToken(_0x28104a,_0x5edcf0,_0x27096f)[_0x9e24('0x18')](function(_0x3bb2b1){if(_0x448d9d[_0x9e24('0x47')]==='incident'){_0x4009bf={'method':_0x9e24('0x14'),'uri':_0x6e5e88+_0x9e24('0x48'),'body':Object[_0x9e24('0x49')]({},{'title':intUtil[_0x9e24('0x4a')](_0x448d9d[_0x9e24('0x4b')],_0x2ef6a5,'\x20'),'description':intUtil['getString'](_0x448d9d[_0x9e24('0x4c')],_0x2ef6a5,'\x0a'),'customerid_contact@odata.bind':_0x4b1492[_0x9e24('0x37')]?_0x9e24('0x4d')+_0x4b1492[_0x9e24('0x37')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4b1492[_0x9e24('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x448d9d[_0x9e24('0x4e')],_0x2ef6a5,_0x448d9d['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x3bb2b1,'OData-Version':_0x9e24('0x20')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x448d9d[_0x9e24('0x47')]==='phonecall'){var _0x313136=_0x4b1492[_0x9e24('0x37')]?[{'partyid_systemuser@odata.bind':_0x9e24('0x31')+_0x4b1492[_0x9e24('0x29')]+')','participationtypemask':_0x4b1492[_0x9e24('0x4f')]===_0x9e24('0x50')?0x2:0x1},{'partyid_contact@odata.bind':_0x9e24('0x4d')+_0x4b1492[_0x9e24('0x37')]+')','participationtypemask':_0x4b1492['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x9e24('0x31')+_0x4b1492[_0x9e24('0x29')]+')','participationtypemask':_0x4b1492[_0x9e24('0x4f')]==='queue'?0x2:0x1}];_0x4009bf={'method':'POST','uri':_0x6e5e88+_0x9e24('0x51'),'body':Object['assign']({},{'subject':intUtil[_0x9e24('0x4a')](_0x448d9d[_0x9e24('0x4b')],_0x2ef6a5,'\x20'),'phonenumber':String(_0x2ef6a5['calleridnum']),'description':intUtil['getString'](_0x448d9d[_0x9e24('0x4c')],_0x2ef6a5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4b1492['enduserId']?'/contacts('+_0x4b1492['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4b1492[_0x9e24('0x29')]+')','directioncode':_0x4b1492[_0x9e24('0x4f')]==='queue'?![]:!![],'phonecall_activity_parties':_0x313136},getCustomFields(_0x448d9d[_0x9e24('0x4e')],_0x2ef6a5,_0x448d9d['ticketType'])),'headers':{'Authorization':_0x9e24('0x1f')+_0x3bb2b1,'OData-Version':_0x9e24('0x20')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4009bf);})['then'](function(_0x2401c5){var _0x40a783=_0x2401c5[_0x9e24('0x33')]['odata-entityid'];var _0x2d71f8=_0x40a783[_0x9e24('0x35')](_0x40a783['lastIndexOf']('(')+0x1,_0x40a783[_0x9e24('0x36')](')'));_0x4b1492[_0x9e24('0x52')]=_0x2d71f8;_0x3c408b(_0x4b1492);})[_0x9e24('0x1a')](function(_0x3e440b){_0x5e34ed(_0x3e440b['message']);});});}function emit(_0x362020,_0x21a3c3,_0x36a781,_0x27eaf3){var _0x5ad14a={'uri':util[_0x9e24('0x53')](_0x9e24('0x54'),_0x362020,_0x36a781,_0x27eaf3)};io['to'](util['format'](_0x9e24('0x55'),_0x21a3c3))[_0x9e24('0x56')](_0x9e24('0x57'),_0x5ad14a);}exports['cs']=function(_0x4a9377,_0x5788cd,_0x932cd4,_0x46cd18,_0x11d2a5,_0x167d8f,_0x53b0e6,_0x3dedf8){var _0x563779={};_0x167d8f['remoteUri']=_0x167d8f[_0x9e24('0xc')]?intUtil['stripTrailingSlash'](_0x167d8f[_0x9e24('0xe')][_0x9e24('0xf')]):intUtil[_0x9e24('0x58')](_0x167d8f[_0x9e24('0xd')]);_0x167d8f[_0x9e24('0x59')]=intUtil[_0x9e24('0x58')](_0x167d8f[_0x9e24('0x59')]);_0x563779['callDirection']=_0x3dedf8===_0x9e24('0x50')||_0x3dedf8===_0x9e24('0x5a')?_0x9e24('0x50'):'outbound';var _0x5a5516=_0x167d8f[_0x9e24('0xc')]?util['format'](_0x9e24('0x5b'),_0x167d8f[_0x9e24('0xe')]['data7']):util['format'](_0x9e24('0x5b'),_0x167d8f[_0x9e24('0xd')]);var _0x311dde=util['format'](_0x9e24('0x5c'),_0x167d8f['tenantId']);var _0x1df6c5=util['format'](_0x9e24('0x5d'),_0x167d8f[_0x9e24('0x59')],_0x5788cd[_0x9e24('0x5e')],md5(_0x5788cd['uniqueid']));if(_0x11d2a5&&_0x11d2a5[_0x9e24('0x5f')]){logger[_0x9e24('0x26')](_0x9e24('0x60'),_0x9e24('0x61'));_0x5788cd[_0x9e24('0x62')]=_0x1df6c5;}else if(_0x53b0e6&&_0x53b0e6['recordingFormat']&&_0x53b0e6[_0x9e24('0x63')]!==_0x9e24('0x64')){logger[_0x9e24('0x26')]('[OUTBOUND]',_0x9e24('0x61'));_0x5788cd['recordingURL']=_0x1df6c5;}else{_0x5788cd[_0x9e24('0x62')]='';}return getUser(_0x563779,_0x167d8f,_0x46cd18,_0x311dde,_0x5a5516,_0x3dedf8)[_0x9e24('0x18')](function(_0x3146ab){logger['info']('['+_0x3dedf8[_0x9e24('0x27')]()+_0x9e24('0x65'),_0x3146ab[_0x9e24('0x29')]);logger[_0x9e24('0x26')]('['+_0x3dedf8[_0x9e24('0x27')]()+_0x9e24('0x66'),_0x3146ab[_0x9e24('0x24')]);return getEndUser(_0x3146ab,_0x167d8f,_0x311dde,_0x5a5516,_0x5788cd,_0x3dedf8,_0x932cd4[_0x9e24('0x67')],_0x932cd4[_0x9e24('0x68')]);})[_0x9e24('0x18')](function(_0x3536b7){logger[_0x9e24('0x26')]('['+_0x3dedf8[_0x9e24('0x27')]()+_0x9e24('0x69'),_0x3536b7[_0x9e24('0x37')]);logger['info']('['+_0x3dedf8[_0x9e24('0x27')]()+_0x9e24('0x6a'),_0x5788cd[_0x9e24('0x30')]);return getTicket(_0x3536b7,_0x167d8f,_0x311dde,_0x5a5516,_0x5788cd,_0x932cd4,_0x3dedf8);})[_0x9e24('0x18')](function(_0x46179e){logger[_0x9e24('0x26')](util[_0x9e24('0x53')]('['+_0x3dedf8[_0x9e24('0x27')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x932cd4[_0x9e24('0x47')],_0x46179e[_0x9e24('0x52')]));logger['info'](util[_0x9e24('0x53')]('['+_0x3dedf8[_0x9e24('0x27')]()+_0x9e24('0x6b'),_0x3dedf8));if(_0x3dedf8!==_0x9e24('0x5a')&&_0x932cd4[_0x9e24('0x6c')]){logger['info']('['+_0x3dedf8['toUpperCase']()+']',_0x9e24('0x6d'));emit(_0x167d8f[_0x9e24('0xd')],_0x46cd18[_0x9e24('0x6e')],_0x932cd4[_0x9e24('0x47')],_0x46179e['ticketId']);}})[_0x9e24('0x1a')](function(_0x872ac4){logger['error']('['+_0x3dedf8[_0x9e24('0x27')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x872ac4['message']);console[_0x9e24('0x1b')](_0x9e24('0x6f'),_0x872ac4);});}; \ 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 33b4106..3dddc8c 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 _0xb189=['The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridnum','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization'];(function(_0x1805c5,_0x1edf00){var _0x49a42d=function(_0x4b2b5c){while(--_0x4b2b5c){_0x1805c5['push'](_0x1805c5['shift']());}};_0x49a42d(++_0x1edf00);}(_0xb189,0x198));var _0x9b18=function(_0x25f2b1,_0x26381c){_0x25f2b1=_0x25f2b1-0x0;var _0x87b785=_0xb189[_0x25f2b1];return _0x87b785;};'use strict';var _=require(_0x9b18('0x0'));var rp=require(_0x9b18('0x1'));var md5=require(_0x9b18('0x2'));var util=require('util');var Redis=require(_0x9b18('0x3'));var intUtil=require(_0x9b18('0x4'));var config=require(_0x9b18('0x5'));var logger=require(_0x9b18('0x6'))(_0x9b18('0x7'));config[_0x9b18('0x8')]=_[_0x9b18('0x9')](config[_0x9b18('0x8')],{'host':_0x9b18('0xa'),'port':0x18eb});var io=require(_0x9b18('0xb'))(new Redis(config[_0x9b18('0x8')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x306999,_0x12ec5f,_0x1ec777){io['to'](_0x306999)[_0x9b18('0xc')](_0x12ec5f,_0x1ec777);}function getTicket(_0x15a55f,_0x339ec8,_0x4e034f,_0xaff0f6,_0x3aac93){logger[_0x9b18('0xd')]('Creating\x20new\x20ticket...');var _0x178fcd=_[_0x9b18('0xe')]({'responder_id':_0x339ec8['id'],'requester_id':_0x4e034f['id'],'name':util[_0x9b18('0xf')](_0x9b18('0x10'),_0x3aac93[_0x9b18('0x11')]),'phone':_0x3aac93[_0x9b18('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9b18('0x13')](_0xaff0f6[_0x9b18('0x14')],_0x3aac93,'\x20'),'description':intUtil['getString'](_0xaff0f6[_0x9b18('0x15')],_0x3aac93,_0x9b18('0x16')),'tags':getTags(_0xaff0f6[_0x9b18('0x17')],_0x9b18('0x18'))},getCustomFields(_0xaff0f6[_0x9b18('0x19')],_0x3aac93));_0x178fcd[_0x9b18('0x1a')]=_[_0x9b18('0x1b')](_[_0x9b18('0x1c')](_0x178fcd[_0x9b18('0x1a')],'id'),'value');return request({'uri':util[_0x9b18('0xf')](_0x9b18('0x1d'),_0x15a55f['remoteUri']),'method':_0x9b18('0x1e'),'body':_0x178fcd})['then'](function(_0x535955){logger[_0x9b18('0xd')](_0x9b18('0x1f'));return _0x535955;});}function getUser(_0x49f232,_0x41f026){if(intUtil[_0x9b18('0x20')](_0x41f026)){return request({'uri':util[_0x9b18('0xf')](_0x9b18('0x21'),_0x49f232['remoteUri']),'qs':{'email':_0x41f026}})[_0x9b18('0x22')](function(_0x2b2f59){if(_0x2b2f59['length']){logger['info']('Agent\x20found!');return _[_0x9b18('0x23')](_0x2b2f59,function(_0x3c23bc){return _0x3c23bc[_0x9b18('0x24')][_0x9b18('0x25')]===_0x41f026;});}else{logger[_0x9b18('0xd')](_0x9b18('0x26'));return request({'uri':util[_0x9b18('0xf')](_0x9b18('0x27'),_0x49f232[_0x9b18('0x28')])})[_0x9b18('0x22')](function(_0x2c4211){logger[_0x9b18('0xd')](_0x9b18('0x29'));return _0x2c4211;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9b18('0xf')](_0x9b18('0x27'),_0x49f232[_0x9b18('0x28')])})['then'](function(_0x5646d2){logger[_0x9b18('0xd')](_0x9b18('0x29'));return _0x5646d2;});}}function getEndUser(_0x55b553,_0x47e0ae,_0x2b93c6){logger[_0x9b18('0xd')](_0x9b18('0x2a'),_0x2b93c6);return request({'uri':util['format']('%s/api/v2/contacts',_0x55b553[_0x9b18('0x28')]),'qs':{'phone':_0x2b93c6}})[_0x9b18('0x22')](function(_0x403d49){if(_0x403d49[_0x9b18('0x2b')]){logger['info'](_0x9b18('0x2c'));return _[_0x9b18('0x23')](_0x403d49,{'phone':_0x2b93c6});}else{logger[_0x9b18('0xd')](_0x9b18('0x2d'));return request({'uri':util[_0x9b18('0xf')]('%s/api/v2/contacts',_0x55b553[_0x9b18('0x28')]),'method':_0x9b18('0x1e'),'body':{'name':_0x47e0ae,'phone':_0x2b93c6}})[_0x9b18('0x22')](function(_0x1230af){logger[_0x9b18('0xd')](_0x9b18('0x2e'));return _0x1230af;});}});}function getAuth(_0x41dd15){return util[_0x9b18('0xf')](_0x9b18('0x2f'),new Buffer(_0x41dd15['apiKey']+':X')[_0x9b18('0x30')](_0x9b18('0x31')));}function request(_0x374f2a){logger[_0x9b18('0x32')](_0x9b18('0x33'),JSON['stringify'](_0x374f2a));return rp(_['defaults'](_0x374f2a,{'method':_0x9b18('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x3d8512,_0x415374){var _0x5bea55=[];if(_0x3d8512&&_0x3d8512[_0x9b18('0x2b')]>0x0){_0x5bea55=_[_0x9b18('0x35')](_0x3d8512,_0x415374);}return _0x5bea55;}function getCustomFields(_0x183821,_0x3ecb95){var _0xd3b19a=[];var _0xdc79ee={'custom_fields':[]};if(_0x183821[_0x9b18('0x2b')]>0x0){_[_0x9b18('0x36')](_0x183821,function(_0x491af7){if(_[_0x9b18('0x37')](['string',_0x9b18('0x38')],_0x491af7[_0x9b18('0x39')])&&_0x491af7[_0x9b18('0x3a')]&&!_0x491af7[_0x9b18('0x3b')]){_0xdc79ee[_0x491af7['nameField'][_0x9b18('0x3c')]()]=_0x491af7[_0x9b18('0x3d')][_0x9b18('0x30')]();}else if(_[_0x9b18('0x37')]([_0x9b18('0x3e'),_0x9b18('0x38')],_0x491af7[_0x9b18('0x39')])&&_0x491af7[_0x9b18('0x3f')]&&_0x491af7[_0x9b18('0x3b')]){_0xdc79ee['custom_fields'][_0x9b18('0x40')]({'id':_0x491af7[_0x9b18('0x3f')],'value':_0x491af7['content'][_0x9b18('0x30')]()});}else if(_0x491af7[_0x9b18('0x39')]===_0x9b18('0x41')&&_0x491af7[_0x9b18('0x42')]&&_0x491af7[_0x9b18('0x3f')]&&_0x491af7[_0x9b18('0x3b')]){_0x3ecb95[_0x491af7[_0x9b18('0x42')]]&&_0xdc79ee[_0x9b18('0x1a')]['push']({'id':_0x491af7[_0x9b18('0x3f')],'value':_0x3ecb95[_0x491af7[_0x9b18('0x42')]]['toString']()});}else if(_0x491af7[_0x9b18('0x39')]===_0x9b18('0x43')&&_0x491af7[_0x9b18('0x44')]&&_0x491af7['Variable'][_0x9b18('0x18')]&&_0x491af7['idField']&&_0x491af7['customField']){_0x3ecb95[_0x491af7[_0x9b18('0x44')][_0x9b18('0x18')][_0x9b18('0x3c')]()]&&_0xdc79ee['custom_fields'][_0x9b18('0x40')]({'id':_0x491af7[_0x9b18('0x3f')],'value':_0x3ecb95[_0x491af7['Variable'][_0x9b18('0x18')][_0x9b18('0x3c')]()][_0x9b18('0x30')]()});}});}return _0xdc79ee;}exports[_0x9b18('0x45')]=function(_0x2c9335,_0x2a0bac,_0x2d1fe0,_0x12ffe6,_0x2ebdde,_0x47955b){var _0x5b8834,_0x552e70;_0x47955b[_0x9b18('0x28')]=intUtil[_0x9b18('0x46')](_0x47955b[_0x9b18('0x28')]);_0x47955b[_0x9b18('0x47')]=intUtil[_0x9b18('0x46')](_0x47955b[_0x9b18('0x47')]);if(_0x2ebdde&&_0x2ebdde['monitor_format']){logger[_0x9b18('0xd')](_0x9b18('0x48'),'Recording\x20is\x20enabled!');_0x2a0bac[_0x9b18('0x49')]=util[_0x9b18('0xf')](_0x9b18('0x4a'),_0x47955b[_0x9b18('0x47')],_0x2a0bac[_0x9b18('0x4b')],md5(_0x2a0bac[_0x9b18('0x4b')]));}else{_0x2a0bac[_0x9b18('0x49')]='';}headers[_0x9b18('0x4c')]=getAuth(_0x47955b);return getUser(_0x47955b,_0x12ffe6[_0x9b18('0x25')])[_0x9b18('0x22')](function(_0x57c6ea){_0x5b8834=_0x57c6ea;logger[_0x9b18('0xd')]('The\x20User\x20ID\x20is:',_0x5b8834['id']);return getEndUser(_0x47955b,_0x2a0bac[_0x9b18('0x11')],_0x2a0bac[_0x9b18('0x12')]);})[_0x9b18('0x22')](function(_0x42456f){_0x552e70=_0x42456f;logger['info'](_0x9b18('0x4d'),_0x552e70['id']);return getTicket(_0x47955b,_0x5b8834,_0x552e70,_0x2d1fe0,_0x2a0bac);})[_0x9b18('0x22')](function(_0x4b07c1){if(_0x4b07c1&&_0x4b07c1['id']){logger['info'](_0x9b18('0x1f'));logger['info'](_0x9b18('0x4e'),_0x4b07c1['id']);logger['info'](_0x9b18('0x48'),_0x9b18('0x4f'));emit(util[_0x9b18('0xf')](_0x9b18('0x50'),_0x12ffe6['name']),_0x9b18('0x51'),{'uri':util['format'](_0x9b18('0x52'),_0x47955b['remoteUri'],_0x4b07c1['id'])});}})[_0x9b18('0x53')](function(_0x432bd0){logger[_0x9b18('0x54')](_0x9b18('0x48'),JSON[_0x9b18('0x55')](_0x432bd0));});};exports[_0x9b18('0x56')]=function(_0x436479,_0x27aa8f,_0xf6738,_0x3d08cc,_0x35e7cc,_0x3d39bb,_0x2db5f0){var _0x236828,_0x540476;_0x3d39bb['remoteUri']=intUtil[_0x9b18('0x46')](_0x3d39bb[_0x9b18('0x28')]);_0x3d39bb['serverUrl']=intUtil[_0x9b18('0x46')](_0x3d39bb[_0x9b18('0x47')]);if(_0x2db5f0&&_0x2db5f0[_0x9b18('0x57')]&&_0x2db5f0[_0x9b18('0x57')]!==_0x9b18('0x58')){logger[_0x9b18('0xd')](_0x9b18('0x59'),_0x9b18('0x5a'));_0x27aa8f[_0x9b18('0x49')]=util['format'](_0x9b18('0x4a'),_0x3d39bb[_0x9b18('0x47')],_0x27aa8f['uniqueid'],md5(_0x27aa8f[_0x9b18('0x4b')]));}headers['Authorization']=getAuth(_0x3d39bb);return getUser(_0x3d39bb,_0x3d08cc['email'])[_0x9b18('0x22')](function(_0x27d661){_0x236828=_0x27d661;logger['info'](_0x9b18('0x5b'),_0x236828['id']);return getEndUser(_0x3d39bb,_0x27aa8f['destcalleridname'],_0x27aa8f[_0x9b18('0x5c')]);})[_0x9b18('0x22')](function(_0x21db7e){_0x540476=_0x21db7e;logger['info'](_0x9b18('0x4d'),_0x540476['id']);return getTicket(_0x3d39bb,_0x236828,_0x540476,_0xf6738,_0x27aa8f);})[_0x9b18('0x22')](function(_0x522394){if(_0x522394&&_0x522394['id']){logger[_0x9b18('0xd')](_0x9b18('0x1f'));logger[_0x9b18('0xd')](_0x9b18('0x4e'),_0x522394['id']);logger[_0x9b18('0xd')]('[OUTBOUND]',_0x9b18('0x4f'));emit(util['format'](_0x9b18('0x50'),_0x3d08cc[_0x9b18('0x18')]),'trigger:browser:url',{'uri':util[_0x9b18('0xf')](_0x9b18('0x52'),_0x3d39bb[_0x9b18('0x28')],_0x522394['id'])});}})[_0x9b18('0x53')](function(_0x4bea1d){logger['error'](_0x9b18('0x59'),JSON[_0x9b18('0x55')](_0x4bea1d));});};exports[_0x9b18('0x5d')]=function(_0x2da528,_0x5c696d,_0x305a66,_0x4a0b76,_0x130ee2,_0x88a6ba){var _0x3376d0,_0x1f3a26;_0x88a6ba[_0x9b18('0x28')]=intUtil['stripTrailingSlash'](_0x88a6ba[_0x9b18('0x28')]);_0x88a6ba['serverUrl']=intUtil['stripTrailingSlash'](_0x88a6ba['serverUrl']);if(_0x130ee2&&_0x130ee2[_0x9b18('0x5e')]){logger[_0x9b18('0xd')]('['+_0x5c696d[_0x9b18('0x5f')][_0x9b18('0x60')]()+']',_0x9b18('0x5a'));_0x5c696d[_0x9b18('0x49')]=util[_0x9b18('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x88a6ba[_0x9b18('0x47')],_0x5c696d[_0x9b18('0x4b')],md5(_0x5c696d[_0x9b18('0x4b')]));}else{_0x5c696d[_0x9b18('0x49')]='';}headers[_0x9b18('0x4c')]=getAuth(_0x88a6ba);return getUser(_0x88a6ba,'')[_0x9b18('0x22')](function(_0x237600){_0x3376d0=_0x237600;logger['info']('The\x20User\x20ID\x20is:',_0x3376d0['id']);return getEndUser(_0x88a6ba,_0x5c696d[_0x9b18('0x11')],_0x5c696d[_0x9b18('0x12')]);})['then'](function(_0x5d1116){_0x1f3a26=_0x5d1116;logger[_0x9b18('0xd')](_0x9b18('0x4d'),_0x1f3a26['id']);return getTicket(_0x88a6ba,_0x3376d0,_0x1f3a26,_0x305a66,_0x5c696d);})[_0x9b18('0x22')](function(_0x411d00){if(_0x411d00){logger['info'](_0x9b18('0x1f'));logger['info'](_0x9b18('0x4e'),_0x411d00['id']);}})[_0x9b18('0x53')](function(_0x56093d){logger[_0x9b18('0x54')]('['+_0x5c696d[_0x9b18('0x5f')][_0x9b18('0x60')]()+']',JSON['stringify'](_0x56093d));});}; \ No newline at end of file +var _0x56b0=['request-promise','md5','ioredis','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','Subjects','getString','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','value','format','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','customField','idField','variable','variableName','push','Variable','name','toLowerCase','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','catch','error','lastevent','lodash'];(function(_0x58d97a,_0x34ecfd){var _0x64558f=function(_0x103cba){while(--_0x103cba){_0x58d97a['push'](_0x58d97a['shift']());}};_0x64558f(++_0x34ecfd);}(_0x56b0,0x16f));var _0x056b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56b0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x056b('0x0'));var rp=require(_0x056b('0x1'));var md5=require(_0x056b('0x2'));var util=require('util');var Redis=require(_0x056b('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x056b('0x4'));config['redis']=_[_0x056b('0x5')](config[_0x056b('0x6')],{'host':_0x056b('0x7'),'port':0x18eb});var io=require(_0x056b('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0x056b('0x9'),'Accept':_0x056b('0x9')};function emit(_0xb0cd17,_0x8b4121,_0xc876f5){io['to'](_0xb0cd17)[_0x056b('0xa')](_0x8b4121,_0xc876f5);}function getTicket(_0x26d082,_0x53dde8,_0x36135f,_0x403ac8,_0x15a8d0){logger[_0x056b('0xb')](_0x056b('0xc'));var _0x1bec67=_[_0x056b('0xd')]({'responder_id':_0x53dde8['id'],'requester_id':_0x36135f['id'],'name':util['format'](_0x056b('0xe'),_0x15a8d0['calleridname']),'phone':_0x15a8d0[_0x056b('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x403ac8[_0x056b('0x10')],_0x15a8d0,'\x20'),'description':intUtil[_0x056b('0x11')](_0x403ac8[_0x056b('0x12')],_0x15a8d0,_0x056b('0x13')),'tags':getTags(_0x403ac8[_0x056b('0x14')],'name')},getCustomFields(_0x403ac8[_0x056b('0x15')],_0x15a8d0));_0x1bec67[_0x056b('0x16')]=_[_0x056b('0x17')](_[_0x056b('0x18')](_0x1bec67[_0x056b('0x16')],'id'),_0x056b('0x19'));return request({'uri':util[_0x056b('0x1a')]('%s/api/v2/tickets',_0x26d082[_0x056b('0x1b')]),'method':_0x056b('0x1c'),'body':_0x1bec67})['then'](function(_0x3e5ede){logger[_0x056b('0xb')](_0x056b('0x1d'));return _0x3e5ede;});}function getUser(_0x274f27,_0x134c3f){if(intUtil[_0x056b('0x1e')](_0x134c3f)){return request({'uri':util[_0x056b('0x1a')](_0x056b('0x1f'),_0x274f27[_0x056b('0x1b')]),'qs':{'email':_0x134c3f}})['then'](function(_0x563f7c){if(_0x563f7c[_0x056b('0x20')]){logger['info'](_0x056b('0x21'));return _[_0x056b('0x22')](_0x563f7c,function(_0xfc8c3b){return _0xfc8c3b[_0x056b('0x23')][_0x056b('0x24')]===_0x134c3f;});}else{logger[_0x056b('0xb')](_0x056b('0x25'));return request({'uri':util[_0x056b('0x1a')](_0x056b('0x26'),_0x274f27[_0x056b('0x1b')])})[_0x056b('0x27')](function(_0x23b890){logger[_0x056b('0xb')](_0x056b('0x28'));return _0x23b890;});}});}else{logger[_0x056b('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x056b('0x26'),_0x274f27[_0x056b('0x1b')])})[_0x056b('0x27')](function(_0x3cd65b){logger[_0x056b('0xb')](_0x056b('0x28'));return _0x3cd65b;});}}function getEndUser(_0x950da2,_0x28b8ac,_0x9dcb07){logger[_0x056b('0xb')](_0x056b('0x29'),_0x9dcb07);return request({'uri':util[_0x056b('0x1a')](_0x056b('0x2a'),_0x950da2['remoteUri']),'qs':{'phone':_0x9dcb07}})[_0x056b('0x27')](function(_0x47a7f9){if(_0x47a7f9[_0x056b('0x20')]){logger[_0x056b('0xb')]('Enduser\x20found!');return _['find'](_0x47a7f9,{'phone':_0x9dcb07});}else{logger[_0x056b('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x056b('0x1a')](_0x056b('0x2a'),_0x950da2[_0x056b('0x1b')]),'method':_0x056b('0x1c'),'body':{'name':_0x28b8ac,'phone':_0x9dcb07}})[_0x056b('0x27')](function(_0x3c15c8){logger[_0x056b('0xb')](_0x056b('0x2b'));return _0x3c15c8;});}});}function getAuth(_0x4873ed){return util['format'](_0x056b('0x2c'),new Buffer(_0x4873ed[_0x056b('0x2d')]+':X')[_0x056b('0x2e')](_0x056b('0x2f')));}function request(_0x378b4c){logger[_0x056b('0x30')](_0x056b('0x31'),JSON[_0x056b('0x32')](_0x378b4c));return rp(_[_0x056b('0x5')](_0x378b4c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x33630d,_0x2677a4){var _0x4bdce0=[];if(_0x33630d&&_0x33630d['length']>0x0){_0x4bdce0=_[_0x056b('0x33')](_0x33630d,_0x2677a4);}return _0x4bdce0;}function getCustomFields(_0x59fcfd,_0x473d5c){var _0x3187df=[];var _0x3bff3d={'custom_fields':[]};if(_0x59fcfd['length']>0x0){_[_0x056b('0x34')](_0x59fcfd,function(_0x44d072){if(_[_0x056b('0x35')]([_0x056b('0x36'),_0x056b('0x37')],_0x44d072[_0x056b('0x38')])&&_0x44d072[_0x056b('0x39')]&&!_0x44d072[_0x056b('0x3a')]){_0x3bff3d[_0x44d072[_0x056b('0x39')]['toLowerCase']()]=_0x44d072['content'][_0x056b('0x2e')]();}else if(_[_0x056b('0x35')]([_0x056b('0x36'),_0x056b('0x37')],_0x44d072['type'])&&_0x44d072[_0x056b('0x3b')]&&_0x44d072[_0x056b('0x3a')]){_0x3bff3d[_0x056b('0x16')]['push']({'id':_0x44d072['idField'],'value':_0x44d072['content'][_0x056b('0x2e')]()});}else if(_0x44d072['type']===_0x056b('0x3c')&&_0x44d072['variableName']&&_0x44d072[_0x056b('0x3b')]&&_0x44d072[_0x056b('0x3a')]){_0x473d5c[_0x44d072[_0x056b('0x3d')]]&&_0x3bff3d[_0x056b('0x16')][_0x056b('0x3e')]({'id':_0x44d072['idField'],'value':_0x473d5c[_0x44d072[_0x056b('0x3d')]]['toString']()});}else if(_0x44d072[_0x056b('0x38')]==='customVariable'&&_0x44d072[_0x056b('0x3f')]&&_0x44d072[_0x056b('0x3f')][_0x056b('0x40')]&&_0x44d072['idField']&&_0x44d072[_0x056b('0x3a')]){_0x473d5c[_0x44d072['Variable'][_0x056b('0x40')][_0x056b('0x41')]()]&&_0x3bff3d[_0x056b('0x16')]['push']({'id':_0x44d072[_0x056b('0x3b')],'value':_0x473d5c[_0x44d072[_0x056b('0x3f')][_0x056b('0x40')][_0x056b('0x41')]()][_0x056b('0x2e')]()});}});}return _0x3bff3d;}exports['queue']=function(_0x5a1dab,_0x3de3de,_0x54c163,_0xaabc19,_0x2bc66d,_0x2a167e){var _0x59a03b,_0x3898f8;_0x2a167e[_0x056b('0x1b')]=intUtil['stripTrailingSlash'](_0x2a167e['remoteUri']);_0x2a167e[_0x056b('0x42')]=intUtil[_0x056b('0x43')](_0x2a167e[_0x056b('0x42')]);if(_0x2bc66d&&_0x2bc66d[_0x056b('0x44')]){logger[_0x056b('0xb')](_0x056b('0x45'),'Recording\x20is\x20enabled!');_0x3de3de[_0x056b('0x46')]=util[_0x056b('0x1a')](_0x056b('0x47'),_0x2a167e[_0x056b('0x42')],_0x3de3de[_0x056b('0x48')],md5(_0x3de3de['uniqueid']));}else{_0x3de3de[_0x056b('0x46')]='';}headers[_0x056b('0x49')]=getAuth(_0x2a167e);return getUser(_0x2a167e,_0xaabc19[_0x056b('0x24')])[_0x056b('0x27')](function(_0x4a73a8){_0x59a03b=_0x4a73a8;logger['info'](_0x056b('0x4a'),_0x59a03b['id']);return getEndUser(_0x2a167e,_0x3de3de[_0x056b('0x4b')],_0x3de3de[_0x056b('0xf')]);})[_0x056b('0x27')](function(_0x1b4ecb){_0x3898f8=_0x1b4ecb;logger[_0x056b('0xb')](_0x056b('0x4c'),_0x3898f8['id']);return getTicket(_0x2a167e,_0x59a03b,_0x3898f8,_0x54c163,_0x3de3de);})['then'](function(_0x2ed93b){if(_0x2ed93b&&_0x2ed93b['id']){logger['info']('Ticket\x20created!');logger[_0x056b('0xb')](_0x056b('0x4d'),_0x2ed93b['id']);logger['info'](_0x056b('0x45'),_0x056b('0x4e'));emit(util[_0x056b('0x1a')](_0x056b('0x4f'),_0xaabc19[_0x056b('0x40')]),_0x056b('0x50'),{'uri':util[_0x056b('0x1a')](_0x056b('0x51'),_0x2a167e[_0x056b('0x1b')],_0x2ed93b['id'])});}})['catch'](function(_0x6f58ca){logger['error'](_0x056b('0x45'),JSON[_0x056b('0x32')](_0x6f58ca));});};exports[_0x056b('0x52')]=function(_0x242d78,_0x58f410,_0x48172f,_0x33d9de,_0x38c6a0,_0x17ea15,_0x42c38f){var _0x25541f,_0x6908c7;_0x17ea15['remoteUri']=intUtil[_0x056b('0x43')](_0x17ea15[_0x056b('0x1b')]);_0x17ea15['serverUrl']=intUtil[_0x056b('0x43')](_0x17ea15[_0x056b('0x42')]);if(_0x42c38f&&_0x42c38f[_0x056b('0x53')]&&_0x42c38f[_0x056b('0x53')]!==_0x056b('0x54')){logger[_0x056b('0xb')](_0x056b('0x55'),_0x056b('0x56'));_0x58f410['recordingURL']=util[_0x056b('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x17ea15['serverUrl'],_0x58f410[_0x056b('0x48')],md5(_0x58f410[_0x056b('0x48')]));}headers[_0x056b('0x49')]=getAuth(_0x17ea15);return getUser(_0x17ea15,_0x33d9de[_0x056b('0x24')])['then'](function(_0x2d92a3){_0x25541f=_0x2d92a3;logger[_0x056b('0xb')](_0x056b('0x4a'),_0x25541f['id']);return getEndUser(_0x17ea15,_0x58f410[_0x056b('0x57')],_0x58f410[_0x056b('0x58')]);})[_0x056b('0x27')](function(_0x386495){_0x6908c7=_0x386495;logger[_0x056b('0xb')](_0x056b('0x4c'),_0x6908c7['id']);return getTicket(_0x17ea15,_0x25541f,_0x6908c7,_0x48172f,_0x58f410);})['then'](function(_0x34800a){if(_0x34800a&&_0x34800a['id']){logger[_0x056b('0xb')](_0x056b('0x1d'));logger[_0x056b('0xb')]('The\x20Ticket\x20ID\x20is:',_0x34800a['id']);logger['info'](_0x056b('0x55'),_0x056b('0x4e'));emit(util['format'](_0x056b('0x4f'),_0x33d9de[_0x056b('0x40')]),_0x056b('0x50'),{'uri':util[_0x056b('0x1a')](_0x056b('0x51'),_0x17ea15[_0x056b('0x1b')],_0x34800a['id'])});}})[_0x056b('0x59')](function(_0x1c70aa){logger[_0x056b('0x5a')]('[OUTBOUND]',JSON[_0x056b('0x32')](_0x1c70aa));});};exports['unmanaged']=function(_0x43cea0,_0x181c80,_0x2a90b2,_0x32cef5,_0x1cdb14,_0x5c6d6d){var _0x1a5b38,_0x14b004;_0x5c6d6d['remoteUri']=intUtil['stripTrailingSlash'](_0x5c6d6d[_0x056b('0x1b')]);_0x5c6d6d['serverUrl']=intUtil[_0x056b('0x43')](_0x5c6d6d[_0x056b('0x42')]);if(_0x1cdb14&&_0x1cdb14[_0x056b('0x44')]){logger[_0x056b('0xb')]('['+_0x181c80[_0x056b('0x5b')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x181c80['recordingURL']=util['format'](_0x056b('0x47'),_0x5c6d6d[_0x056b('0x42')],_0x181c80[_0x056b('0x48')],md5(_0x181c80[_0x056b('0x48')]));}else{_0x181c80[_0x056b('0x46')]='';}headers['Authorization']=getAuth(_0x5c6d6d);return getUser(_0x5c6d6d,'')[_0x056b('0x27')](function(_0xbb4614){_0x1a5b38=_0xbb4614;logger[_0x056b('0xb')](_0x056b('0x4a'),_0x1a5b38['id']);return getEndUser(_0x5c6d6d,_0x181c80[_0x056b('0x4b')],_0x181c80[_0x056b('0xf')]);})[_0x056b('0x27')](function(_0x3f5aab){_0x14b004=_0x3f5aab;logger[_0x056b('0xb')](_0x056b('0x4c'),_0x14b004['id']);return getTicket(_0x5c6d6d,_0x1a5b38,_0x14b004,_0x2a90b2,_0x181c80);})[_0x056b('0x27')](function(_0x309451){if(_0x309451){logger['info'](_0x056b('0x1d'));logger[_0x056b('0xb')](_0x056b('0x4d'),_0x309451['id']);}})['catch'](function(_0x4fd797){logger[_0x056b('0x5a')]('['+_0x181c80['lastevent']['toUpperCase']()+']',JSON[_0x056b('0x32')](_0x4fd797));});}; \ 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 eedf881..34ffc01 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 _0xd103=['Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','toUpperCase','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','stripTrailingSlash','remoteUri','serverUrl','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','GET','headers','then','agentEmail','userEmail','userId','Admin\x20selected','/api/lookup?q=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20found\x20work_number:','/api/contacts'];(function(_0x42e98c,_0x1c6bb9){var _0x59803e=function(_0x3a587e){while(--_0x3a587e){_0x42e98c['push'](_0x42e98c['shift']());}};_0x59803e(++_0x1c6bb9);}(_0xd103,0x7e));var _0x3d10=function(_0x4e299f,_0x8aec26){_0x4e299f=_0x4e299f-0x0;var _0x2c53ee=_0xd103[_0x4e299f];return _0x2c53ee;};'use strict';var _=require(_0x3d10('0x0'));var rp=require(_0x3d10('0x1'));var md5=require(_0x3d10('0x2'));var util=require(_0x3d10('0x3'));var moment=require(_0x3d10('0x4'));var Promise=require(_0x3d10('0x5'));var Redis=require('ioredis');var intUtil=require(_0x3d10('0x6'));var config=require(_0x3d10('0x7'));var logger=require(_0x3d10('0x8'))(_0x3d10('0x9'));config[_0x3d10('0xa')]=_[_0x3d10('0xb')](config[_0x3d10('0xa')],{'host':_0x3d10('0xc'),'port':0x18eb});var io=require(_0x3d10('0xd'))(new Redis(config[_0x3d10('0xa')]));function getAdminId(_0x592b3e,_0x1a9005,_0xc3032e,_0x379749){return new Promise(function(_0xeeaced,_0x28e9ed){var _0x2028fd=![];var _0x43d021={'method':'GET','uri':_0x379749+_0x3d10('0xe'),'json':!![]};_0x43d021['headers']=_0xc3032e;logger[_0x3d10('0xf')](_0x3d10('0x10'));return rp(_0x43d021)['then'](function(_0x5195a5){if(_0x5195a5){var _0x4a3713=_0x5195a5[_0x3d10('0x11')];var _0x3f42fb=null;for(_0x3f42fb=0x0;_0x3f42fb<_0x4a3713[_0x3d10('0x12')];_0x3f42fb++){if(_0x4a3713[_0x3f42fb][_0x3d10('0x13')]===_0x592b3e[_0x3d10('0x14')]){_0x592b3e[_0x3d10('0x15')]=_0x4a3713[_0x3f42fb]['id'];_0x2028fd=!![];}}if(_0x2028fd){logger[_0x3d10('0xf')](_0x3d10('0x16'),_0x592b3e[_0x3d10('0x15')]);_0xeeaced(_0x592b3e);}else{_0x28e9ed({'statusCode':0x194,'message':_0x3d10('0x17')});}}else{_0x28e9ed({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x3d10('0x18')](function(_0x4acf84){logger[_0x3d10('0x19')]('['+[_0x1a9005['toUpperCase']()]+']',_0x4acf84[_0x3d10('0x1a')]);_0x28e9ed(_0x4acf84);});});}function getUser(_0x5b167f,_0x1f5988,_0x25eadc){return function(_0x38da83){return new Promise(function(_0x54dc3f,_0x54d63f){var _0xbdf215={'method':_0x3d10('0x1b'),'uri':_0x25eadc+_0x3d10('0xe'),'json':!![]};_0xbdf215[_0x3d10('0x1c')]=_0x1f5988;logger[_0x3d10('0xf')]('Getting\x20user\x20list');return rp(_0xbdf215)[_0x3d10('0x1d')](function(_0x1ddcdb){if(_0x1ddcdb){var _0x1b6fcd=_0x1ddcdb[_0x3d10('0x11')];var _0x169e1c=![];var _0xb4b413=null;if(_0x38da83['agentEmail']!==null){logger[_0x3d10('0xf')]('Getting\x20user\x20with\x20email',_0x38da83[_0x3d10('0x1e')]);_0x38da83[_0x3d10('0x1f')]=_0x38da83[_0x3d10('0x1e')];for(_0xb4b413=0x0;_0xb4b413<_0x1b6fcd[_0x3d10('0x12')];_0xb4b413++){if(_0x1b6fcd[_0xb4b413][_0x3d10('0x13')]===_0x38da83[_0x3d10('0x1e')]){_0x169e1c=!![];_0x38da83[_0x3d10('0x20')]=_0x1b6fcd[_0xb4b413]['id'];logger[_0x3d10('0xf')]('User\x20found:',_0x38da83[_0x3d10('0x20')]);}}}if(!_0x169e1c){logger[_0x3d10('0xf')](_0x3d10('0x21'));_0x38da83[_0x3d10('0x1f')]=_0x38da83[_0x3d10('0x14')];_0x38da83[_0x3d10('0x20')]=_0x38da83['adminId'];_0x169e1c=!![];}if(_0x169e1c){_0x54dc3f(_0x38da83);}else{_0x54d63f({'statusCode':0x194,'message':_0x3d10('0x17')});}}else{_0x54d63f({'statusCode':0x194,'message':_0x3d10('0x17')});}})['catch'](function(_0x21f201){logger[_0x3d10('0x19')]('['+[_0x5b167f['toUpperCase']()]+']',_0x21f201[_0x3d10('0x1a')]);_0x54d63f(_0x21f201);});});};}function searchContact(_0x1023c3,_0x4fac8b,_0x5de0f0,_0xb39657){return new Promise(function(_0x34bad1,_0x3771db){var _0x3adc5c={'method':_0x3d10('0x1b'),'headers':_0x4fac8b,'uri':_0x1023c3+_0x3d10('0x22')+_0xb39657+'&f='+_0x5de0f0+'&entities=contact','json':!![]};rp(_0x3adc5c)[_0x3d10('0x1d')](function(_0x5c1712){var _0x428903=_[_0x3d10('0x23')](_0x5c1712[_0x3d10('0x24')][_0x3d10('0x24')],[_0x5de0f0,_0xb39657]);_0x34bad1(_0x428903);})[_0x3d10('0x18')](function(_0x5479d4){_0x3771db(_0x5479d4);});});}function getEndUser(_0x56bf55,_0x213eda,_0x35c9c8){return function(_0xa5ef5e){return new Promise(function(_0x56f40a,_0x2dc69d){logger[_0x3d10('0xf')](util[_0x3d10('0x25')](_0x3d10('0x26'),_0xa5ef5e[_0x3d10('0x27')]));searchContact(_0x35c9c8,_0x213eda,_0x3d10('0x28'),_0xa5ef5e[_0x3d10('0x27')])[_0x3d10('0x1d')](function(_0x15b3ac){if(_0x15b3ac){_0xa5ef5e['endUserId']=_0x15b3ac['id'];logger[_0x3d10('0xf')](_0x3d10('0x29'),_0xa5ef5e['endUserId']);return _0x56f40a(_0xa5ef5e);}searchContact(_0x35c9c8,_0x213eda,_0x3d10('0x2a'),_0xa5ef5e[_0x3d10('0x27')])['then'](function(_0x11eef1){if(_0x11eef1){_0xa5ef5e[_0x3d10('0x2b')]=_0x11eef1['id'];logger['info'](_0x3d10('0x2c'),_0xa5ef5e[_0x3d10('0x2b')]);return _0x56f40a(_0xa5ef5e);}createEndUser(_0xa5ef5e,_0x56bf55,_0x213eda,_0x35c9c8)['then'](function(_0x455dda){logger['info']('Contact\x20created:',_0x455dda['endUserId']);return _0x56f40a(_0x455dda);});});})[_0x3d10('0x18')](function(_0x437b3c){_0x2dc69d(_0x437b3c);});});};}function createEndUser(_0x3b5212,_0x17991f,_0x3d013a,_0x38ff4b){return new Promise(function(_0x45cad9,_0x404705){var _0x3c3198=moment();var _0x4e99cb={'method':'POST','uri':_0x38ff4b+_0x3d10('0x2d'),'body':{'contact':{'last_name':_0x3b5212[_0x3d10('0x27')],'work_number':_0x3b5212[_0x3d10('0x27')],'mobile_number':_0x3b5212['contactNumber'],'owner_id':_0x3b5212[_0x3d10('0x20')],'created_at':_0x3c3198[_0x3d10('0x25')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4e99cb[_0x3d10('0x1c')]=_0x3d013a;logger[_0x3d10('0xf')](_0x3d10('0x2e'));return rp(_0x4e99cb)[_0x3d10('0x1d')](function(_0x1ff4bc){_0x3b5212[_0x3d10('0x2b')]=_0x1ff4bc[_0x3d10('0x2f')]['id'];_0x45cad9(_0x3b5212);})['catch'](function(_0x1e196f){logger[_0x3d10('0x19')]('['+[_0x17991f[_0x3d10('0x30')]()]+']',_0x1e196f[_0x3d10('0x1a')]);_0x404705(_0x1e196f['message']);});});}function getTicket(_0x2c0255,_0x27985c,_0x4344c8,_0x3377f1,_0x572f26){return function(_0x38482a){logger[_0x3d10('0xf')](_0x3d10('0x31'));return new Promise(function(_0x2ced57,_0x3d7dc0){var _0x40b132=moment();var _0x1203c8={'method':_0x3d10('0x32'),'uri':_0x4344c8+_0x3d10('0x33'),'body':{'title':intUtil[_0x3d10('0x34')](_0x3377f1[_0x3d10('0x35')],_0x572f26,'\x20'),'description':intUtil[_0x3d10('0x34')](_0x3377f1[_0x3d10('0x36')],_0x572f26,'\x0a'),'owner_id':_0x38482a[_0x3d10('0x20')],'creater_id':_0x38482a[_0x3d10('0x15')],'targetable_id':_0x38482a['endUserId'],'targetable_type':_0x3d10('0x37'),'created_at':_0x40b132[_0x3d10('0x25')](_0x3d10('0x38')),'due_date':_0x40b132[_0x3d10('0x39')](0x1e,'m')[_0x3d10('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x1203c8[_0x3d10('0x1c')]=_0x27985c;return rp(_0x1203c8)['then'](function(_0x1fd8f8){_0x38482a[_0x3d10('0x3a')]=_0x1fd8f8[_0x3d10('0x3b')]['id'];logger['info'](_0x3d10('0x3c'),_0x38482a[_0x3d10('0x3a')]);_0x2ced57(_0x38482a);})[_0x3d10('0x18')](function(_0x5bd671){logger[_0x3d10('0x19')]('['+[_0x2c0255[_0x3d10('0x30')]()]+']',_0x5bd671['message']);_0x3d7dc0(_0x5bd671[_0x3d10('0x1a')]);});});};}function emit(_0x23c2ef,_0x592660,_0x283ee7){var _0x57c808={'uri':_0x23c2ef+_0x3d10('0x3d')+_0x283ee7};io['to'](util[_0x3d10('0x25')](_0x3d10('0x3e'),_0x592660))[_0x3d10('0x3f')](_0x3d10('0x40'),_0x57c808);}exports['cs']=function(_0x404959,_0x15ee38,_0x8b6d6c,_0x4c6680,_0x564184,_0x2497d5,_0x281c85,_0x3ac578){var _0x296b87={};var _0x5e5be3={'Authorization':_0x3d10('0x41')+_0x2497d5['apiKey']};_0x2497d5['remoteUri']=intUtil[_0x3d10('0x42')](_0x2497d5[_0x3d10('0x43')]);_0x2497d5[_0x3d10('0x44')]=intUtil[_0x3d10('0x42')](_0x2497d5[_0x3d10('0x44')]);var _0x2dedbd=_0x2497d5[_0x3d10('0x43')];_0x296b87[_0x3d10('0x14')]=_0x2497d5['username'];_0x296b87['contactNumber']=_0x3ac578['toLowerCase']()===_0x3d10('0x45')?_0x15ee38[_0x3d10('0x46')]:_0x15ee38['calleridnum'];_0x296b87[_0x3d10('0x47')]=_0x3ac578===_0x3d10('0x48')||_0x3ac578===_0x3d10('0x49')?_0x3d10('0x48'):'outbound';if(_0x4c6680){_0x296b87[_0x3d10('0x1e')]=_0x4c6680[_0x3d10('0x13')];}var _0x33b646=util['format'](_0x3d10('0x4a'),_0x2497d5['serverUrl'],_0x15ee38[_0x3d10('0x4b')],md5(_0x15ee38[_0x3d10('0x4b')]));if(_0x564184&&_0x564184[_0x3d10('0x4c')]){logger[_0x3d10('0xf')]('[QUEUE]',_0x3d10('0x4d'));_0x15ee38[_0x3d10('0x4e')]=_0x33b646;}else if(_0x281c85&&_0x281c85[_0x3d10('0x4f')]&&_0x281c85[_0x3d10('0x4f')]!==_0x3d10('0x50')){logger[_0x3d10('0xf')](_0x3d10('0x51'),_0x3d10('0x4d'));_0x15ee38[_0x3d10('0x4e')]=_0x33b646;}else{_0x15ee38[_0x3d10('0x4e')]='';}return getAdminId(_0x296b87,_0x3ac578,_0x5e5be3,_0x2dedbd)[_0x3d10('0x1d')](getUser(_0x3ac578,_0x5e5be3,_0x2dedbd))[_0x3d10('0x1d')](getEndUser(_0x3ac578,_0x5e5be3,_0x2dedbd))[_0x3d10('0x1d')](getTicket(_0x3ac578,_0x5e5be3,_0x2dedbd,_0x8b6d6c,_0x15ee38))[_0x3d10('0x1d')](function(_0x151a18){logger['info'](util['format'](_0x3d10('0x52'),_0x151a18[_0x3d10('0x3a')]));if(_0x3ac578!==_0x3d10('0x49')){logger['info']('['+[_0x3ac578['toUpperCase']()]+']',_0x3d10('0x53'));emit(_0x2dedbd,_0x4c6680['name'],_0x151a18['endUserId']);}})[_0x3d10('0x18')](function(_0x4dc8fb){logger[_0x3d10('0x19')]('['+[_0x3ac578['toUpperCase']()]+_0x3d10('0x54'),util[_0x3d10('0x55')](_0x4dc8fb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x368c=['defaults','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','agentEmail','userEmail','email','User\x20found:','userId','Admin\x20selected','/api/lookup?q=','find','contacts','format','contactNumber','mobile_number','endUserId','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis'];(function(_0x26234e,_0x5f35da){var _0x547c65=function(_0x3dad57){while(--_0x3dad57){_0x26234e['push'](_0x26234e['shift']());}};_0x547c65(++_0x5f35da);}(_0x368c,0x8f));var _0xc368=function(_0x20717d,_0x5b0cbf){_0x20717d=_0x20717d-0x0;var _0x444002=_0x368c[_0x20717d];return _0x444002;};'use strict';var _=require(_0xc368('0x0'));var rp=require(_0xc368('0x1'));var md5=require(_0xc368('0x2'));var util=require(_0xc368('0x3'));var moment=require(_0xc368('0x4'));var Promise=require(_0xc368('0x5'));var Redis=require(_0xc368('0x6'));var intUtil=require(_0xc368('0x7'));var config=require('../../../../config/environment');var logger=require(_0xc368('0x8'))(_0xc368('0x9'));config[_0xc368('0xa')]=_[_0xc368('0xb')](config['redis'],{'host':_0xc368('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc368('0xa')]));function getAdminId(_0x691481,_0x3ff25f,_0x5e6c9f,_0x57c637){return new Promise(function(_0x265555,_0x48d172){var _0x4dca5a=![];var _0x3a7949={'method':_0xc368('0xd'),'uri':_0x57c637+_0xc368('0xe'),'json':!![]};_0x3a7949[_0xc368('0xf')]=_0x5e6c9f;logger[_0xc368('0x10')](_0xc368('0x11'));return rp(_0x3a7949)[_0xc368('0x12')](function(_0x18a883){if(_0x18a883){var _0x3f5248=_0x18a883[_0xc368('0x13')];var _0x153590=null;for(_0x153590=0x0;_0x153590<_0x3f5248[_0xc368('0x14')];_0x153590++){if(_0x3f5248[_0x153590]['email']===_0x691481[_0xc368('0x15')]){_0x691481[_0xc368('0x16')]=_0x3f5248[_0x153590]['id'];_0x4dca5a=!![];}}if(_0x4dca5a){logger[_0xc368('0x10')](_0xc368('0x17'),_0x691481[_0xc368('0x16')]);_0x265555(_0x691481);}else{_0x48d172({'statusCode':0x194,'message':_0xc368('0x18')});}}else{_0x48d172({'statusCode':0x194,'message':_0xc368('0x18')});}})[_0xc368('0x19')](function(_0x3ef846){logger[_0xc368('0x1a')]('['+[_0x3ff25f[_0xc368('0x1b')]()]+']',_0x3ef846[_0xc368('0x1c')]);_0x48d172(_0x3ef846);});});}function getUser(_0x58e142,_0x33e621,_0x2e28ab){return function(_0x3abc2e){return new Promise(function(_0x504733,_0x46a1c1){var _0x489f27={'method':'GET','uri':_0x2e28ab+_0xc368('0xe'),'json':!![]};_0x489f27['headers']=_0x33e621;logger[_0xc368('0x10')]('Getting\x20user\x20list');return rp(_0x489f27)[_0xc368('0x12')](function(_0x55b898){if(_0x55b898){var _0x7d9840=_0x55b898[_0xc368('0x13')];var _0x27e36f=![];var _0x3843df=null;if(_0x3abc2e[_0xc368('0x1d')]!==null){logger[_0xc368('0x10')]('Getting\x20user\x20with\x20email',_0x3abc2e[_0xc368('0x1d')]);_0x3abc2e[_0xc368('0x1e')]=_0x3abc2e[_0xc368('0x1d')];for(_0x3843df=0x0;_0x3843df<_0x7d9840[_0xc368('0x14')];_0x3843df++){if(_0x7d9840[_0x3843df][_0xc368('0x1f')]===_0x3abc2e[_0xc368('0x1d')]){_0x27e36f=!![];_0x3abc2e['userId']=_0x7d9840[_0x3843df]['id'];logger[_0xc368('0x10')](_0xc368('0x20'),_0x3abc2e[_0xc368('0x21')]);}}}if(!_0x27e36f){logger['info'](_0xc368('0x22'));_0x3abc2e['userEmail']=_0x3abc2e['adminEmail'];_0x3abc2e[_0xc368('0x21')]=_0x3abc2e['adminId'];_0x27e36f=!![];}if(_0x27e36f){_0x504733(_0x3abc2e);}else{_0x46a1c1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x46a1c1({'statusCode':0x194,'message':_0xc368('0x18')});}})[_0xc368('0x19')](function(_0x361143){logger[_0xc368('0x1a')]('['+[_0x58e142[_0xc368('0x1b')]()]+']',_0x361143[_0xc368('0x1c')]);_0x46a1c1(_0x361143);});});};}function searchContact(_0x3c2f21,_0x16df1b,_0x212e5c,_0x4c8c3a){return new Promise(function(_0x4e1b99,_0x50d99b){var _0x4cd825={'method':_0xc368('0xd'),'headers':_0x16df1b,'uri':_0x3c2f21+_0xc368('0x23')+_0x4c8c3a+'&f='+_0x212e5c+'&entities=contact','json':!![]};rp(_0x4cd825)['then'](function(_0xb251f6){var _0x1f38b7=_[_0xc368('0x24')](_0xb251f6[_0xc368('0x25')][_0xc368('0x25')],[_0x212e5c,_0x4c8c3a]);_0x4e1b99(_0x1f38b7);})[_0xc368('0x19')](function(_0x54426c){_0x50d99b(_0x54426c);});});}function getEndUser(_0x2e22ee,_0x52a056,_0xd208f){return function(_0x51ed9e){return new Promise(function(_0x157a24,_0x399783){logger[_0xc368('0x10')](util[_0xc368('0x26')]('Searching\x20contact\x20with\x20phone\x20%s',_0x51ed9e[_0xc368('0x27')]));searchContact(_0xd208f,_0x52a056,_0xc368('0x28'),_0x51ed9e['contactNumber'])[_0xc368('0x12')](function(_0x263278){if(_0x263278){_0x51ed9e[_0xc368('0x29')]=_0x263278['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x51ed9e[_0xc368('0x29')]);return _0x157a24(_0x51ed9e);}searchContact(_0xd208f,_0x52a056,_0xc368('0x2a'),_0x51ed9e[_0xc368('0x27')])[_0xc368('0x12')](function(_0x1a43ee){if(_0x1a43ee){_0x51ed9e[_0xc368('0x29')]=_0x1a43ee['id'];logger[_0xc368('0x10')]('Contact\x20found\x20work_number:',_0x51ed9e[_0xc368('0x29')]);return _0x157a24(_0x51ed9e);}createEndUser(_0x51ed9e,_0x2e22ee,_0x52a056,_0xd208f)[_0xc368('0x12')](function(_0x1d4a67){logger['info'](_0xc368('0x2b'),_0x1d4a67[_0xc368('0x29')]);return _0x157a24(_0x1d4a67);});});})[_0xc368('0x19')](function(_0x567441){_0x399783(_0x567441);});});};}function createEndUser(_0x463200,_0x4568a0,_0x35c589,_0x36f46b){return new Promise(function(_0x5e64f1,_0x4eeb62){var _0x2caf01=moment();var _0xb390ca={'method':_0xc368('0x2c'),'uri':_0x36f46b+_0xc368('0x2d'),'body':{'contact':{'last_name':_0x463200['contactNumber'],'work_number':_0x463200['contactNumber'],'mobile_number':_0x463200[_0xc368('0x27')],'owner_id':_0x463200[_0xc368('0x21')],'created_at':_0x2caf01[_0xc368('0x26')](_0xc368('0x2e'))}},'json':!![]};_0xb390ca[_0xc368('0xf')]=_0x35c589;logger['info'](_0xc368('0x2f'));return rp(_0xb390ca)[_0xc368('0x12')](function(_0x48390b){_0x463200['endUserId']=_0x48390b['contact']['id'];_0x5e64f1(_0x463200);})['catch'](function(_0x58a1fe){logger[_0xc368('0x1a')]('['+[_0x4568a0[_0xc368('0x1b')]()]+']',_0x58a1fe[_0xc368('0x1c')]);_0x4eeb62(_0x58a1fe['message']);});});}function getTicket(_0x63538,_0x10d648,_0x40c651,_0xed3a33,_0x531c55){return function(_0x427760){logger[_0xc368('0x10')](_0xc368('0x30'));return new Promise(function(_0x38f90e,_0x51e9c7){var _0x1802cf=moment();var _0x44a069={'method':_0xc368('0x2c'),'uri':_0x40c651+_0xc368('0x31'),'body':{'title':intUtil[_0xc368('0x32')](_0xed3a33[_0xc368('0x33')],_0x531c55,'\x20'),'description':intUtil['getString'](_0xed3a33[_0xc368('0x34')],_0x531c55,'\x0a'),'owner_id':_0x427760[_0xc368('0x21')],'creater_id':_0x427760[_0xc368('0x16')],'targetable_id':_0x427760[_0xc368('0x29')],'targetable_type':'Contact','created_at':_0x1802cf[_0xc368('0x26')](_0xc368('0x2e')),'due_date':_0x1802cf[_0xc368('0x35')](0x1e,'m')['format'](_0xc368('0x2e'))},'json':!![]};_0x44a069[_0xc368('0xf')]=_0x10d648;return rp(_0x44a069)['then'](function(_0x4b7d74){_0x427760[_0xc368('0x36')]=_0x4b7d74[_0xc368('0x37')]['id'];logger[_0xc368('0x10')](_0xc368('0x38'),_0x427760[_0xc368('0x36')]);_0x38f90e(_0x427760);})[_0xc368('0x19')](function(_0xa67c3e){logger['error']('['+[_0x63538['toUpperCase']()]+']',_0xa67c3e['message']);_0x51e9c7(_0xa67c3e[_0xc368('0x1c')]);});});};}function emit(_0x35abb4,_0x313fab,_0x7030e6){var _0x5152af={'uri':_0x35abb4+'/contacts/'+_0x7030e6};io['to'](util[_0xc368('0x26')]('user:%s',_0x313fab))[_0xc368('0x39')](_0xc368('0x3a'),_0x5152af);}exports['cs']=function(_0x5166d2,_0x4e71b2,_0x525eac,_0x59c5f6,_0x42aece,_0x3998b2,_0x13fd2e,_0x49cced){var _0x5e1563={};var _0x30a509={'Authorization':'Token\x20token='+_0x3998b2['apiKey']};_0x3998b2[_0xc368('0x3b')]=intUtil[_0xc368('0x3c')](_0x3998b2['remoteUri']);_0x3998b2[_0xc368('0x3d')]=intUtil[_0xc368('0x3c')](_0x3998b2['serverUrl']);var _0xbd15be=_0x3998b2[_0xc368('0x3b')];_0x5e1563[_0xc368('0x15')]=_0x3998b2[_0xc368('0x3e')];_0x5e1563['contactNumber']=_0x49cced[_0xc368('0x3f')]()===_0xc368('0x40')?_0x4e71b2['destcalleridnum']:_0x4e71b2['calleridnum'];_0x5e1563[_0xc368('0x41')]=_0x49cced===_0xc368('0x42')||_0x49cced===_0xc368('0x43')?_0xc368('0x42'):'outbound';if(_0x59c5f6){_0x5e1563[_0xc368('0x1d')]=_0x59c5f6['email'];}var _0x49619f=util[_0xc368('0x26')](_0xc368('0x44'),_0x3998b2[_0xc368('0x3d')],_0x4e71b2[_0xc368('0x45')],md5(_0x4e71b2[_0xc368('0x45')]));if(_0x42aece&&_0x42aece[_0xc368('0x46')]){logger[_0xc368('0x10')]('[QUEUE]',_0xc368('0x47'));_0x4e71b2['recordingURL']=_0x49619f;}else if(_0x13fd2e&&_0x13fd2e[_0xc368('0x48')]&&_0x13fd2e[_0xc368('0x48')]!==_0xc368('0x49')){logger['info'](_0xc368('0x4a'),_0xc368('0x47'));_0x4e71b2['recordingURL']=_0x49619f;}else{_0x4e71b2['recordingURL']='';}return getAdminId(_0x5e1563,_0x49cced,_0x30a509,_0xbd15be)[_0xc368('0x12')](getUser(_0x49cced,_0x30a509,_0xbd15be))[_0xc368('0x12')](getEndUser(_0x49cced,_0x30a509,_0xbd15be))['then'](getTicket(_0x49cced,_0x30a509,_0xbd15be,_0x525eac,_0x4e71b2))['then'](function(_0x2352c0){logger[_0xc368('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x2352c0[_0xc368('0x36')]));if(_0x49cced!==_0xc368('0x43')){logger[_0xc368('0x10')]('['+[_0x49cced[_0xc368('0x1b')]()]+']',_0xc368('0x4b'));emit(_0xbd15be,_0x59c5f6['name'],_0x2352c0['endUserId']);}})['catch'](function(_0x2ff44f){logger[_0xc368('0x1a')]('['+[_0x49cced[_0xc368('0x1b')]()]+_0xc368('0x4c'),util['inspect'](_0x2ff44f,{'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 d5d5307..018499e 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 _0xcd9b=['lodash','util','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./freshsales','zendesk','sugarcrm','freshdesk','zoho','vtiger','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','freshsales','servicenow','dynamics365','unknown\x20integration','../../../../config/logger','[EXEC]','error','format','%s\x20account\x20#%s\x20not\x20found'];(function(_0x1f0724,_0x3a58bf){var _0x253ffb=function(_0x3b4c72){while(--_0x3b4c72){_0x1f0724['push'](_0x1f0724['shift']());}};_0x253ffb(++_0x3a58bf);}(_0xcd9b,0x14d));var _0xbcd9=function(_0x2b95f1,_0x3aec6a){_0x2b95f1=_0x2b95f1-0x0;var _0x2aa366=_0xcd9b[_0x2b95f1];return _0x2aa366;};'use strict';var _=require(_0xbcd9('0x0'));var util=require(_0xbcd9('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0xbcd9('0x2'));var freshdesk=require(_0xbcd9('0x3'));var zoho=require(_0xbcd9('0x4'));var desk=require(_0xbcd9('0x5'));var vtiger=require(_0xbcd9('0x6'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0xbcd9('0x7'));var integrations=[_0xbcd9('0x8'),'salesforce',_0xbcd9('0x9'),_0xbcd9('0xa'),_0xbcd9('0xb'),'desk',_0xbcd9('0xc'),'dynamics365','freshsales','servicenow'];exports[_0xbcd9('0xd')]=function(_0x2e470c,_0x59c48b,_0x4deb0c,_0x3e0d3c,_0x581d77,_0x37048c){if(_0x4deb0c){if(_[_0xbcd9('0xe')](integrations,_0x2e470c[_0xbcd9('0xf')][_0xbcd9('0x10')]())){try{var _0x13a347=null;var _0x557417='';var _0x4869f2=_0x4deb0c[_0x2e470c[_0xbcd9('0xf')][_0xbcd9('0x10')]()];if(_0x4869f2){var _0x258837=_0x4869f2[_0x2e470c[_0xbcd9('0x11')]];if(_0x258837){var _0x4185ce=_[_0xbcd9('0x12')](_0x258837[_0xbcd9('0x13')],{'id':parseInt(_0x2e470c[_0xbcd9('0x14')],0xa)});if(_0x4185ce){if(_0x3e0d3c){if(_0x581d77&&_0x59c48b['queue']){_0x557417=_0xbcd9('0x15');}else if(_0x59c48b[_0xbcd9('0x16')]){_0x557417=_0xbcd9('0x17');}else{console[_0xbcd9('0x18')](_0xbcd9('0x19'),_0x59c48b);}}else{_0x557417=_0xbcd9('0x1a');}switch(_0x2e470c['data1'][_0xbcd9('0x10')]()){case _0xbcd9('0x8'):zendesk[_0x557417](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c);break;case _0xbcd9('0x1b'):salesforce[_0x557417](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c);break;case'sugarcrm':sugarcrm[_0x557417](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c);break;case _0xbcd9('0xa'):freshdesk[_0x557417](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c);break;case _0xbcd9('0xb'):zoho[_0x557417](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c);break;case'desk':desk[_0x557417](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c);break;case'vtiger':vtiger[_0x557417](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c);break;case _0xbcd9('0x1c'):freshsales['cs'](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c,_0x557417);break;case _0xbcd9('0x1d'):servicenow['cs'](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c,_0x557417);break;case _0xbcd9('0x1e'):dynamics365['cs'](_0x2e470c,_0x59c48b,_0x4185ce,_0x3e0d3c,_0x581d77,_0x258837,_0x37048c,_0x557417);break;default:console['log'](_0xbcd9('0x1f'));}}else{_0x13a347=require(_0xbcd9('0x20'))(_0x2e470c[_0xbcd9('0xf')][_0xbcd9('0x10')]());_0x13a347['error'](_0xbcd9('0x21'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x2e470c[_0xbcd9('0xf')][_0xbcd9('0x10')](),_0x2e470c[_0xbcd9('0x14')]));}}else{_0x13a347=require(_0xbcd9('0x20'))(_0x2e470c['data1']['toLowerCase']());_0x13a347[_0xbcd9('0x22')](_0xbcd9('0x21'),util[_0xbcd9('0x23')](_0xbcd9('0x24'),_0x2e470c['data1'][_0xbcd9('0x10')](),_0x2e470c['data2']));}}else{}}catch(_0x9da343){console[_0xbcd9('0x22')](_0x9da343);}}}}; \ No newline at end of file +var _0xfae7=['freshsales','servicenow','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','unknown\x20integration','../../../../config/logger','toLowerCase','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./servicenow','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365'];(function(_0x5a636f,_0x3fec2b){var _0x6a8cfb=function(_0x20e6ca){while(--_0x20e6ca){_0x5a636f['push'](_0x5a636f['shift']());}};_0x6a8cfb(++_0x3fec2b);}(_0xfae7,0x120));var _0x7fae=function(_0x43db89,_0x225a65){_0x43db89=_0x43db89-0x0;var _0x285936=_0xfae7[_0x43db89];return _0x285936;};'use strict';var _=require(_0x7fae('0x0'));var util=require(_0x7fae('0x1'));var zendesk=require(_0x7fae('0x2'));var salesforce=require(_0x7fae('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x7fae('0x4'));var zoho=require(_0x7fae('0x5'));var desk=require(_0x7fae('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0x7fae('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x7fae('0x8'));var integrations=['zendesk',_0x7fae('0x9'),_0x7fae('0xa'),_0x7fae('0xb'),_0x7fae('0xc'),_0x7fae('0xd'),_0x7fae('0xe'),_0x7fae('0xf'),_0x7fae('0x10'),_0x7fae('0x11')];exports['exec']=function(_0x3c63e9,_0x491ee6,_0x25be2f,_0x1bebd8,_0x4b3a9a,_0x5f01bc){if(_0x25be2f){if(_['includes'](integrations,_0x3c63e9[_0x7fae('0x12')]['toLowerCase']())){try{var _0x596063=null;var _0x1184fb='';var _0x211ecc=_0x25be2f[_0x3c63e9['data1']['toLowerCase']()];if(_0x211ecc){var _0x104937=_0x211ecc[_0x3c63e9[_0x7fae('0x13')]];if(_0x104937){var _0x497bf3=_[_0x7fae('0x14')](_0x104937[_0x7fae('0x15')],{'id':parseInt(_0x3c63e9[_0x7fae('0x16')],0xa)});if(_0x497bf3){if(_0x1bebd8){if(_0x4b3a9a&&_0x491ee6[_0x7fae('0x17')]){_0x1184fb=_0x7fae('0x17');}else if(_0x491ee6[_0x7fae('0x18')]){_0x1184fb=_0x7fae('0x19');}else{console[_0x7fae('0x1a')](_0x7fae('0x1b'),_0x491ee6);}}else{_0x1184fb=_0x7fae('0x1c');}switch(_0x3c63e9[_0x7fae('0x12')]['toLowerCase']()){case _0x7fae('0x1d'):zendesk[_0x1184fb](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc);break;case _0x7fae('0x9'):salesforce[_0x1184fb](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc);break;case _0x7fae('0xa'):sugarcrm[_0x1184fb](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc);break;case _0x7fae('0xb'):freshdesk[_0x1184fb](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc);break;case'zoho':zoho[_0x1184fb](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc);break;case'desk':desk[_0x1184fb](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc);break;case _0x7fae('0xe'):vtiger[_0x1184fb](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc);break;case _0x7fae('0x10'):freshsales['cs'](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc,_0x1184fb);break;case _0x7fae('0x11'):servicenow['cs'](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc,_0x1184fb);break;case'dynamics365':dynamics365['cs'](_0x3c63e9,_0x491ee6,_0x497bf3,_0x1bebd8,_0x4b3a9a,_0x104937,_0x5f01bc,_0x1184fb);break;default:console[_0x7fae('0x1a')](_0x7fae('0x1e'));}}else{_0x596063=require(_0x7fae('0x1f'))(_0x3c63e9['data1'][_0x7fae('0x20')]());_0x596063['error'](_0x7fae('0x21'),util[_0x7fae('0x22')](_0x7fae('0x23'),_0x3c63e9[_0x7fae('0x12')][_0x7fae('0x20')](),_0x3c63e9[_0x7fae('0x16')]));}}else{_0x596063=require('../../../../config/logger')(_0x3c63e9[_0x7fae('0x12')][_0x7fae('0x20')]());_0x596063[_0x7fae('0x24')](_0x7fae('0x21'),util[_0x7fae('0x22')](_0x7fae('0x25'),_0x3c63e9[_0x7fae('0x12')][_0x7fae('0x20')](),_0x3c63e9[_0x7fae('0x13')]));}}else{}}catch(_0x172943){console[_0x7fae('0x24')](_0x172943);}}}}; \ 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 9b8afca..56f8ccf 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 _0xa8c8=['User','find','then','Email','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','execute','length','additionalSearchLead','Lead','additionalSearchAccount','Account','merge','Name','Phone','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','[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','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsRecurrence','endUserType','contact','WhoId','WhatId','ContactId','account','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail'];(function(_0x50551e,_0x4ceff3){var _0x5a08c1=function(_0x888236){while(--_0x888236){_0x50551e['push'](_0x50551e['shift']());}};_0x5a08c1(++_0x4ceff3);}(_0xa8c8,0xdf));var _0x8a8c=function(_0x4e2f8d,_0x449bd0){_0x4e2f8d=_0x4e2f8d-0x0;var _0x404bb9=_0xa8c8[_0x4e2f8d];return _0x404bb9;};'use strict';var _=require('lodash');var rp=require(_0x8a8c('0x0'));var moment=require(_0x8a8c('0x1'));var BPromise=require(_0x8a8c('0x2'));var md5=require(_0x8a8c('0x3'));var jsforce=require(_0x8a8c('0x4'));var util=require(_0x8a8c('0x5'));var Redis=require(_0x8a8c('0x6'));var intUtil=require(_0x8a8c('0x7'));var config=require(_0x8a8c('0x8'));var logger=require(_0x8a8c('0x9'))(_0x8a8c('0xa'));config[_0x8a8c('0xb')]=_['defaults'](config[_0x8a8c('0xb')],{'host':_0x8a8c('0xc'),'port':0x18eb});var io=require(_0x8a8c('0xd'))(new Redis(config[_0x8a8c('0xb')]));function emit(_0x4ad4d5,_0x415436,_0x16d653){io['to'](_0x4ad4d5)[_0x8a8c('0xe')](_0x415436,_0x16d653);}function getTicket(_0x26a27f,_0xfc6a49,_0x47a884,_0x476ace,_0x22cc4e,_0x568645,_0x414b76,_0x1bd411){var _0x34798c=Object['assign']({},{'OwnerId':_0xfc6a49['id'],'Subject':intUtil[_0x8a8c('0xf')](_0x476ace[_0x8a8c('0x10')],_0x22cc4e,'\x20'),'Description':intUtil[_0x8a8c('0xf')](_0x476ace[_0x8a8c('0x11')],_0x22cc4e,'\x0a')},getCustomFields(_0x568645,_0x22cc4e));if(_0x47a884){if(_0x476ace[_0x8a8c('0x12')]==='Task'){_0x34798c[_0x8a8c('0x13')]=moment[_0x8a8c('0x14')]();_0x34798c['IsReminderSet']=![];_0x34798c[_0x8a8c('0x15')]=![];if(_0x47a884[_0x8a8c('0x16')]===_0x8a8c('0x17')||_0x47a884['endUserType']==='lead'){_0x34798c[_0x8a8c('0x18')]=_0x47a884['id'];}else if(_0x47a884[_0x8a8c('0x16')]==='account'){_0x34798c[_0x8a8c('0x19')]=_0x47a884['id'];}}else if(_0x476ace['ticketType']==='Case'){if(_0x47a884[_0x8a8c('0x16')]===_0x8a8c('0x17')){_0x34798c[_0x8a8c('0x1a')]=_0x47a884['id'];}else if(_0x47a884['endUserType']===_0x8a8c('0x1b')){_0x34798c['AccountId']=_0x47a884['id'];}else if(_0x47a884[_0x8a8c('0x16')]==='lead'&&_0x476ace[_0x8a8c('0x1c')]){_0x34798c[_0x476ace[_0x8a8c('0x1c')]]=_0x47a884['id'];}else{logger[_0x8a8c('0x1d')](_0x8a8c('0x1e'));}}}return _0x414b76[_0x8a8c('0x1f')](_0x476ace[_0x8a8c('0x12')])[_0x8a8c('0x20')](_0x34798c);}function getUser(_0x5aa42e,_0x7d09d5,_0x31fc57){if(!_[_0x8a8c('0x21')](_0x7d09d5)&&intUtil[_0x8a8c('0x22')](_0x7d09d5)){var _0x33ee75={'Email':_0x7d09d5};var _0x5ac39c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x31fc57[_0x8a8c('0x1f')](_0x8a8c('0x23'))[_0x8a8c('0x24')](_0x33ee75,_0x5ac39c)['execute']()[_0x8a8c('0x25')](function(_0x1439c2){if(_0x1439c2['length']){var _0x2ce72c=_['find'](_0x1439c2,function(_0x4ed01f){return _0x4ed01f[_0x8a8c('0x26')]===_0x7d09d5;});if(_0x2ce72c){logger['info']('Agent\x20%s\x20found.',_0x7d09d5);return BPromise['resolve']({'id':_0x2ce72c['Id'],'name':_0x2ce72c['Name']});}}else{logger[_0x8a8c('0x1d')](_0x8a8c('0x27'),_0x7d09d5);return _0x31fc57[_0x8a8c('0x28')]()[_0x8a8c('0x25')](function(_0x13e8c8){return BPromise[_0x8a8c('0x29')]({'id':_0x13e8c8[_0x8a8c('0x2a')],'name':_0x13e8c8[_0x8a8c('0x2b')]});});}});}else{logger[_0x8a8c('0x1d')](_0x8a8c('0x27'),_0x7d09d5);return _0x31fc57['identity']()['then'](function(_0x5169ff){return BPromise[_0x8a8c('0x29')]({'id':_0x5169ff[_0x8a8c('0x2a')],'name':_0x5169ff[_0x8a8c('0x2b')]});});}}function getEndUser(_0xaa3f71,_0x238e6c,_0x402ad9,_0x42e807,_0x3ac6f3){var _0x3fea52={'$or':{'Phone':_0x42e807}};var _0x413503={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8a8c('0x29')]()[_0x8a8c('0x25')](function(){logger[_0x8a8c('0x1d')](_0x8a8c('0x2c'),_0x42e807,_0x238e6c[_0x8a8c('0x2d')]);switch(_0x238e6c[_0x8a8c('0x2d')]){case _0x8a8c('0x2e'):var _0x32e838=_[_0x8a8c('0x2f')](_0x3fea52);if(_0x238e6c[_0x8a8c('0x30')]){var _0x56e6fc={};_0x56e6fc[_0x238e6c['additionalSearchContact']]=_0x42e807;_['merge'](_0x32e838[_0x8a8c('0x31')],_0x56e6fc);}return _0x3ac6f3[_0x8a8c('0x1f')](_0x8a8c('0x32'))['find'](_0x32e838,_0x413503)[_0x8a8c('0x33')]()['then'](function(_0x14d06c){if(_0x14d06c&&_0x14d06c[_0x8a8c('0x34')]){return _0x14d06c;}else{var _0x3caafc=_['cloneDeep'](_0x3fea52);if(_0x238e6c[_0x8a8c('0x35')]){var _0x282ee9={};_0x282ee9[_0x238e6c['additionalSearchLead']]=_0x42e807;_['merge'](_0x3caafc[_0x8a8c('0x31')],_0x282ee9);}return _0x3ac6f3['sobject'](_0x8a8c('0x36'))[_0x8a8c('0x24')](_0x3caafc,_0x413503);}});case'account_contact_lead':var _0x125543=_['cloneDeep'](_0x3fea52);if(_0x238e6c[_0x8a8c('0x37')]){var _0x56e6fc={};_0x56e6fc[_0x238e6c[_0x8a8c('0x37')]]=_0x42e807;_['merge'](_0x125543[_0x8a8c('0x31')],_0x56e6fc);}return _0x3ac6f3[_0x8a8c('0x1f')](_0x8a8c('0x38'))['find'](_0x125543,_0x413503)['execute']()['then'](function(_0x212706){if(_0x212706&&_0x212706[_0x8a8c('0x34')]){return _0x212706;}else{var _0x1ab7bc=_[_0x8a8c('0x2f')](_0x3fea52);if(_0x238e6c[_0x8a8c('0x30')]){var _0x455f7c={};_0x455f7c[_0x238e6c['additionalSearchContact']]=_0x42e807;_[_0x8a8c('0x39')](_0x1ab7bc[_0x8a8c('0x31')],_0x455f7c);}return _0x3ac6f3[_0x8a8c('0x1f')](_0x8a8c('0x32'))[_0x8a8c('0x24')](_0x1ab7bc,_0x413503)[_0x8a8c('0x25')](function(_0x4c47e3){if(_0x4c47e3&&_0x4c47e3[_0x8a8c('0x34')]){return _0x4c47e3;}else{var _0x421bef=_[_0x8a8c('0x2f')](_0x3fea52);if(_0x238e6c[_0x8a8c('0x35')]){var _0x34f22b={};_0x34f22b[_0x238e6c[_0x8a8c('0x35')]]=_0x42e807;_[_0x8a8c('0x39')](_0x421bef[_0x8a8c('0x31')],_0x34f22b);}return _0x3ac6f3[_0x8a8c('0x1f')](_0x8a8c('0x36'))[_0x8a8c('0x24')](_0x421bef,_0x413503);}});}});case'contact':var _0x32e838=_[_0x8a8c('0x2f')](_0x3fea52);if(_0x238e6c[_0x8a8c('0x30')]){var _0x56e6fc={};_0x56e6fc[_0x238e6c[_0x8a8c('0x30')]]=_0x42e807;_['merge'](_0x32e838[_0x8a8c('0x31')],_0x56e6fc);}return _0x3ac6f3['sobject']('Contact')[_0x8a8c('0x24')](_0x32e838,_0x413503)[_0x8a8c('0x33')]();case'lead':var _0x5c2ef2=_[_0x8a8c('0x2f')](_0x3fea52);if(_0x238e6c['additionalSearchLead']){var _0x56e6fc={};_0x56e6fc[_0x238e6c[_0x8a8c('0x35')]]=_0x42e807;_['merge'](_0x5c2ef2['$or'],_0x56e6fc);}return _0x3ac6f3[_0x8a8c('0x1f')]('Lead')['find'](_0x5c2ef2,_0x413503);case _0x8a8c('0x1b'):var _0x125543=_[_0x8a8c('0x2f')](_0x3fea52);if(_0x238e6c['additionalSearchAccount']){var _0x56e6fc={};_0x56e6fc[_0x238e6c[_0x8a8c('0x37')]]=_0x42e807;_[_0x8a8c('0x39')](_0x125543[_0x8a8c('0x31')],_0x56e6fc);}return _0x3ac6f3[_0x8a8c('0x1f')](_0x8a8c('0x38'))['find'](_0x125543,_0x413503);default:return null;}})['then'](function(_0x151c30){if(_0x151c30&&_0x151c30['length']){var _0x5a8ce8=_['first'](_0x151c30);if(_0x5a8ce8){return BPromise[_0x8a8c('0x29')]({'id':_0x5a8ce8['Id'],'name':_0x5a8ce8[_0x8a8c('0x3a')],'phone':_0x5a8ce8[_0x8a8c('0x3b')],'endUserType':_0x5a8ce8['attributes'][_0x8a8c('0x3c')]['toLowerCase']()});}}})[_0x8a8c('0x25')](function(_0x14679b){if(_0x14679b){logger[_0x8a8c('0x1d')](_0x8a8c('0x3d'),_0x14679b[_0x8a8c('0x16')],_0x42e807);return BPromise[_0x8a8c('0x29')](_0x14679b);}else{logger[_0x8a8c('0x1d')](_0x8a8c('0x3e'),_0x42e807);var _0x434f39={'Phone':_0x42e807};if(_0x238e6c[_0x8a8c('0x3f')]){if(_0x238e6c[_0x8a8c('0x3f')]===_0x8a8c('0x17')){logger[_0x8a8c('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x42e807,_0x238e6c['moduleCreate']);_0x434f39[_0x8a8c('0x40')]=_0x402ad9!==_0x8a8c('0x41')?_0x402ad9:util['format'](_0x8a8c('0x42'),_0x42e807);}else if(_0x238e6c[_0x8a8c('0x3f')]==='lead'){logger['info'](_0x8a8c('0x43'),_0x42e807,_0x238e6c[_0x8a8c('0x3f')]);_0x434f39[_0x8a8c('0x40')]=_0x402ad9!==''?_0x402ad9:util[_0x8a8c('0x44')](_0x8a8c('0x42'),_0x42e807);_0x434f39['Company']=_0x8a8c('0x45');}else if(_0x238e6c[_0x8a8c('0x3f')]===_0x8a8c('0x1b')){logger[_0x8a8c('0x1d')](_0x8a8c('0x43'),_0x42e807,_0x238e6c[_0x8a8c('0x3f')]);_0x434f39[_0x8a8c('0x3a')]=_0x402ad9!==_0x8a8c('0x41')?_0x402ad9:util[_0x8a8c('0x44')](_0x8a8c('0x42'),_0x42e807);}else{return null;}}return _0x3ac6f3[_0x8a8c('0x1f')](_[_0x8a8c('0x46')](_0x238e6c[_0x8a8c('0x3f')]))[_0x8a8c('0x20')](_0x434f39)['then'](function(_0x497829){return BPromise['resolve']({'id':_0x497829['id'],'endUserType':_0x238e6c['moduleCreate']});});}});}function getCustomFields(_0x3c899b,_0x242157){var _0x14839b={};if(_0x3c899b[_0x8a8c('0x34')]>0x0){_[_0x8a8c('0x47')](_0x3c899b,function(_0x875cf4){if(_[_0x8a8c('0x48')]([_0x8a8c('0x49'),_0x8a8c('0x4a')],_0x875cf4[_0x8a8c('0x3c')])&&_0x875cf4[_0x8a8c('0x4b')]){_0x14839b[_0x875cf4['idField']]=_0x875cf4[_0x8a8c('0x4c')]['toString']();}else if(_0x875cf4['type']===_0x8a8c('0x4d')&&_0x875cf4[_0x8a8c('0x4e')]&&_0x875cf4[_0x8a8c('0x4b')]){_0x242157[_0x875cf4[_0x8a8c('0x4e')]]&&(_0x14839b[_0x875cf4['idField']]=_0x242157[_0x875cf4[_0x8a8c('0x4e')]]['toString']());}else if(_0x875cf4[_0x8a8c('0x3c')]===_0x8a8c('0x4f')&&_0x875cf4['Variable']&&_0x875cf4[_0x8a8c('0x50')]['name']&&_0x875cf4[_0x8a8c('0x4b')]){_0x242157[_0x875cf4[_0x8a8c('0x50')][_0x8a8c('0x51')][_0x8a8c('0x52')]()]&&(_0x14839b[_0x875cf4['idField']]=_0x242157[_0x875cf4[_0x8a8c('0x50')][_0x8a8c('0x51')][_0x8a8c('0x52')]()][_0x8a8c('0x53')]());}});}return _0x14839b;}function getConnection(_0x1ac1b3){var _0x3d6b67=_0x1ac1b3['password'][_0x8a8c('0x54')](_0x1ac1b3[_0x8a8c('0x55')]);var _0x2aa8fa=new jsforce[(_0x8a8c('0x56'))]({'oauth2':{'loginUrl':_0x1ac1b3[_0x8a8c('0x57')]||_0x8a8c('0x58'),'clientId':_0x1ac1b3[_0x8a8c('0x59')],'clientSecret':_0x1ac1b3['clientSecret']}});return _0x2aa8fa[_0x8a8c('0x5a')](_0x1ac1b3[_0x8a8c('0x5b')],_0x3d6b67)[_0x8a8c('0x25')](function(){logger['info'](_0x8a8c('0x5c'));return _0x2aa8fa;});}exports[_0x8a8c('0x5d')]=function(_0x236426,_0x2f6508,_0x59a8ed,_0x56c2ec,_0x33ed34,_0x63b400){var _0x35d11a,_0x33817f,_0x51b68a,_0x137205;_0x63b400[_0x8a8c('0x5e')]=intUtil[_0x8a8c('0x5f')](_0x63b400[_0x8a8c('0x5e')]);_0x63b400['remoteUri']=intUtil[_0x8a8c('0x5f')](_0x63b400[_0x8a8c('0x57')]);if(_0x33ed34&&_0x33ed34['monitor_format']){logger['info'](_0x8a8c('0x60'),_0x8a8c('0x61'));_0x2f6508[_0x8a8c('0x62')]=util[_0x8a8c('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x63b400[_0x8a8c('0x5e')],_0x2f6508['uniqueid'],md5(_0x2f6508[_0x8a8c('0x63')]));}else{_0x2f6508[_0x8a8c('0x62')]='';}return getConnection(_0x63b400)[_0x8a8c('0x25')](function(_0x3937e8){_0x137205=_0x3937e8;return getUser(_0x63b400,_0x56c2ec['email'],_0x137205);})[_0x8a8c('0x25')](function(_0x3dcd33){_0x35d11a=_0x3dcd33;return getEndUser(_0x63b400,_0x59a8ed,_0x2f6508[_0x8a8c('0x64')],_0x2f6508[_0x8a8c('0x65')],_0x137205);})[_0x8a8c('0x25')](function(_0x3d7786){_0x33817f=_0x3d7786;return getTicket(_0x63b400,_0x35d11a,_0x33817f,_0x59a8ed,_0x2f6508,_0x59a8ed['Fields'],_0x137205,'queue');})[_0x8a8c('0x25')](function(_0x137f7c){_0x51b68a=_0x137f7c;logger[_0x8a8c('0x1d')](_0x8a8c('0x66'),_0x51b68a['id']);logger['info'](_0x8a8c('0x67'),_0x51b68a['id'],_0x56c2ec[_0x8a8c('0x51')],_0x63b400[_0x8a8c('0x3c')]);switch(_0x63b400[_0x8a8c('0x3c')]){case _0x8a8c('0x68'):emit(util[_0x8a8c('0x44')](_0x8a8c('0x69'),_0x56c2ec[_0x8a8c('0x51')]),_0x8a8c('0x6a'),{'recordId':_0x51b68a['id']});break;case _0x8a8c('0x6b'):emit(util['format'](_0x8a8c('0x69'),_0x56c2ec[_0x8a8c('0x51')]),_0x8a8c('0x6c'),{'uri':util['format'](_0x8a8c('0x6d'),_0x137205['instanceUrl'],_0x51b68a['id'])});break;default:logger[_0x8a8c('0x6e')](_0x8a8c('0x6f'));}})[_0x8a8c('0x70')](function(_0x556df5){logger[_0x8a8c('0x6e')](_0x8a8c('0x60'),_0x556df5);});};exports[_0x8a8c('0x71')]=function(_0x1ad39a,_0x12b372,_0x4fe79c,_0x5b9150,_0x53b99b,_0x343cae,_0x300678){var _0x19abc7,_0x1b66d6,_0x3daf8c,_0x2232b8;_0x343cae['serverUrl']=intUtil[_0x8a8c('0x5f')](_0x343cae[_0x8a8c('0x5e')]);_0x343cae[_0x8a8c('0x57')]=intUtil[_0x8a8c('0x5f')](_0x343cae['remoteUri']);if(_0x300678&&_0x300678[_0x8a8c('0x72')]&&_0x300678[_0x8a8c('0x72')]!=='none'){logger[_0x8a8c('0x1d')](_0x8a8c('0x73'),'Recording\x20is\x20enabled!');_0x12b372['recordingURL']=util[_0x8a8c('0x44')](_0x8a8c('0x74'),_0x343cae[_0x8a8c('0x5e')],_0x12b372[_0x8a8c('0x63')],md5(_0x12b372['uniqueid']));}return getConnection(_0x343cae)[_0x8a8c('0x25')](function(_0x1e1d13){_0x2232b8=_0x1e1d13;return getUser(_0x343cae,_0x5b9150[_0x8a8c('0x75')],_0x2232b8);})['then'](function(_0x326e0d){_0x19abc7=_0x326e0d;return getEndUser(_0x343cae,_0x4fe79c,_0x12b372[_0x8a8c('0x76')],_0x12b372['destcalleridnum'],_0x2232b8);})[_0x8a8c('0x25')](function(_0x971f10){_0x1b66d6=_0x971f10;return getTicket(_0x343cae,_0x19abc7,_0x1b66d6,_0x4fe79c,_0x12b372,_0x4fe79c[_0x8a8c('0x77')],_0x2232b8,_0x8a8c('0x71'));})[_0x8a8c('0x25')](function(_0x352dbf){_0x3daf8c=_0x352dbf;logger[_0x8a8c('0x1d')](_0x8a8c('0x78'),_0x3daf8c['id']);logger[_0x8a8c('0x1d')](_0x8a8c('0x79'),_0x3daf8c['id'],_0x5b9150[_0x8a8c('0x51')],_0x343cae[_0x8a8c('0x3c')]);switch(_0x343cae[_0x8a8c('0x3c')]){case _0x8a8c('0x68'):emit(util[_0x8a8c('0x44')]('user:%s',_0x5b9150[_0x8a8c('0x51')]),_0x8a8c('0x6a'),{'recordId':_0x3daf8c['id']});break;case _0x8a8c('0x6b'):emit(util[_0x8a8c('0x44')](_0x8a8c('0x69'),_0x5b9150[_0x8a8c('0x51')]),_0x8a8c('0x6c'),{'uri':util[_0x8a8c('0x44')](_0x8a8c('0x6d'),_0x2232b8['instanceUrl'],_0x3daf8c['id'])});break;default:logger[_0x8a8c('0x6e')](_0x8a8c('0x73'),_0x8a8c('0x7a'));}})[_0x8a8c('0x70')](function(_0x559ffd){logger['error'](_0x8a8c('0x73'),_0x559ffd);});};exports[_0x8a8c('0x7b')]=function(_0xcda186,_0x1e59d0,_0x3eb309,_0x448fa7,_0x597b39,_0x489f79){var _0x225bdf,_0x37ec36,_0x516a2a,_0x56c368;_0x489f79[_0x8a8c('0x5e')]=intUtil[_0x8a8c('0x5f')](_0x489f79[_0x8a8c('0x5e')]);_0x489f79['remoteUri']=intUtil[_0x8a8c('0x5f')](_0x489f79[_0x8a8c('0x57')]);if(_0x597b39&&_0x597b39[_0x8a8c('0x7c')]){logger[_0x8a8c('0x1d')]('['+_0x1e59d0[_0x8a8c('0x7d')]['toUpperCase']()+']',_0x8a8c('0x61'));_0x1e59d0[_0x8a8c('0x62')]=util[_0x8a8c('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x489f79['serverUrl'],_0x1e59d0[_0x8a8c('0x63')],md5(_0x1e59d0[_0x8a8c('0x63')]));}else{_0x1e59d0[_0x8a8c('0x62')]='';}return getConnection(_0x489f79)[_0x8a8c('0x25')](function(_0x52f111){_0x56c368=_0x52f111;if(!_[_0x8a8c('0x21')](_0x448fa7)){return getUser(_0x489f79,_0x448fa7['name'],_0x56c368);}else{return getUser(_0x489f79,null,_0x56c368);}})[_0x8a8c('0x25')](function(_0x3de446){_0x225bdf=_0x3de446;return getEndUser(_0x489f79,_0x3eb309,_0x1e59d0[_0x8a8c('0x64')],_0x1e59d0['calleridnum'],_0x56c368);})[_0x8a8c('0x25')](function(_0x3ff203){_0x37ec36=_0x3ff203;return getTicket(_0x489f79,_0x225bdf,_0x37ec36,_0x3eb309,_0x1e59d0,_0x3eb309['Fields'],_0x56c368);})[_0x8a8c('0x25')](function(_0x412f9b){_0x516a2a=_0x412f9b;logger[_0x8a8c('0x1d')]('['+_0x1e59d0[_0x8a8c('0x7d')][_0x8a8c('0x7e')]()+_0x8a8c('0x7f'),_0x516a2a['id']);logger[_0x8a8c('0x1d')]('['+_0x1e59d0['lastevent'][_0x8a8c('0x7e')]()+_0x8a8c('0x80'),_0x489f79[_0x8a8c('0x3c')]);})[_0x8a8c('0x70')](function(_0x191f0f){logger[_0x8a8c('0x6e')]('['+_0x1e59d0[_0x8a8c('0x7d')][_0x8a8c('0x7e')]()+']',_0x191f0f);});}; \ No newline at end of file +var _0x5d29=['account','AccountId','leadId','sobject','create','validateEmail','find','then','length','Email','info','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Name','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','string','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','monitor_format','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','ContactId'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x5d29,0x15f));var _0x95d2=function(_0x1ab097,_0x4e4c94){_0x1ab097=_0x1ab097-0x0;var _0x2232f4=_0x5d29[_0x1ab097];return _0x2232f4;};'use strict';var _=require(_0x95d2('0x0'));var rp=require(_0x95d2('0x1'));var moment=require(_0x95d2('0x2'));var BPromise=require(_0x95d2('0x3'));var md5=require('md5');var jsforce=require(_0x95d2('0x4'));var util=require('util');var Redis=require(_0x95d2('0x5'));var intUtil=require('./util');var config=require(_0x95d2('0x6'));var logger=require(_0x95d2('0x7'))(_0x95d2('0x8'));config[_0x95d2('0x9')]=_['defaults'](config[_0x95d2('0x9')],{'host':_0x95d2('0xa'),'port':0x18eb});var io=require(_0x95d2('0xb'))(new Redis(config[_0x95d2('0x9')]));function emit(_0x5ae79b,_0x458f48,_0x2a4c9f){io['to'](_0x5ae79b)[_0x95d2('0xc')](_0x458f48,_0x2a4c9f);}function getTicket(_0x1fe1d1,_0x35a514,_0x1c3429,_0x2a0fb8,_0x8deb6e,_0x25bb9e,_0x58bb3a,_0xb08772){var _0x37c85b=Object[_0x95d2('0xd')]({},{'OwnerId':_0x35a514['id'],'Subject':intUtil[_0x95d2('0xe')](_0x2a0fb8[_0x95d2('0xf')],_0x8deb6e,'\x20'),'Description':intUtil[_0x95d2('0xe')](_0x2a0fb8[_0x95d2('0x10')],_0x8deb6e,'\x0a')},getCustomFields(_0x25bb9e,_0x8deb6e));if(_0x1c3429){if(_0x2a0fb8[_0x95d2('0x11')]===_0x95d2('0x12')){_0x37c85b[_0x95d2('0x13')]=moment['utc']();_0x37c85b['IsReminderSet']=![];_0x37c85b[_0x95d2('0x14')]=![];if(_0x1c3429[_0x95d2('0x15')]===_0x95d2('0x16')||_0x1c3429[_0x95d2('0x15')]===_0x95d2('0x17')){_0x37c85b[_0x95d2('0x18')]=_0x1c3429['id'];}else if(_0x1c3429[_0x95d2('0x15')]==='account'){_0x37c85b[_0x95d2('0x19')]=_0x1c3429['id'];}}else if(_0x2a0fb8[_0x95d2('0x11')]==='Case'){if(_0x1c3429[_0x95d2('0x15')]===_0x95d2('0x16')){_0x37c85b[_0x95d2('0x1a')]=_0x1c3429['id'];}else if(_0x1c3429[_0x95d2('0x15')]===_0x95d2('0x1b')){_0x37c85b[_0x95d2('0x1c')]=_0x1c3429['id'];}else if(_0x1c3429[_0x95d2('0x15')]===_0x95d2('0x17')&&_0x2a0fb8[_0x95d2('0x1d')]){_0x37c85b[_0x2a0fb8[_0x95d2('0x1d')]]=_0x1c3429['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x58bb3a[_0x95d2('0x1e')](_0x2a0fb8[_0x95d2('0x11')])[_0x95d2('0x1f')](_0x37c85b);}function getUser(_0x3cbee4,_0x21551d,_0x543ef9){if(!_['isNil'](_0x21551d)&&intUtil[_0x95d2('0x20')](_0x21551d)){var _0x1d7612={'Email':_0x21551d};var _0x5834e3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x543ef9[_0x95d2('0x1e')]('User')[_0x95d2('0x21')](_0x1d7612,_0x5834e3)['execute']()[_0x95d2('0x22')](function(_0x312881){if(_0x312881[_0x95d2('0x23')]){var _0x3323d1=_['find'](_0x312881,function(_0xeaa6e9){return _0xeaa6e9[_0x95d2('0x24')]===_0x21551d;});if(_0x3323d1){logger[_0x95d2('0x25')]('Agent\x20%s\x20found.',_0x21551d);return BPromise[_0x95d2('0x26')]({'id':_0x3323d1['Id'],'name':_0x3323d1['Name']});}}else{logger[_0x95d2('0x25')](_0x95d2('0x27'),_0x21551d);return _0x543ef9[_0x95d2('0x28')]()['then'](function(_0x21928e){return BPromise[_0x95d2('0x26')]({'id':_0x21928e[_0x95d2('0x29')],'name':_0x21928e[_0x95d2('0x2a')]});});}});}else{logger[_0x95d2('0x25')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x21551d);return _0x543ef9[_0x95d2('0x28')]()[_0x95d2('0x22')](function(_0x2ea27f){return BPromise[_0x95d2('0x26')]({'id':_0x2ea27f[_0x95d2('0x29')],'name':_0x2ea27f[_0x95d2('0x2a')]});});}}function getEndUser(_0x250112,_0x586eb9,_0x3c13d0,_0x258401,_0x5af7d7){var _0x4c7f7e={'$or':{'Phone':_0x258401}};var _0x13a3ae={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x95d2('0x26')]()['then'](function(){logger[_0x95d2('0x25')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x258401,_0x586eb9['moduleSearch']);switch(_0x586eb9[_0x95d2('0x2b')]){case _0x95d2('0x2c'):var _0x13230a=_[_0x95d2('0x2d')](_0x4c7f7e);if(_0x586eb9[_0x95d2('0x2e')]){var _0x253d30={};_0x253d30[_0x586eb9['additionalSearchContact']]=_0x258401;_[_0x95d2('0x2f')](_0x13230a[_0x95d2('0x30')],_0x253d30);}return _0x5af7d7[_0x95d2('0x1e')](_0x95d2('0x31'))[_0x95d2('0x21')](_0x13230a,_0x13a3ae)[_0x95d2('0x32')]()[_0x95d2('0x22')](function(_0x5090fb){if(_0x5090fb&&_0x5090fb[_0x95d2('0x23')]){return _0x5090fb;}else{var _0x57322a=_[_0x95d2('0x2d')](_0x4c7f7e);if(_0x586eb9[_0x95d2('0x33')]){var _0x503dfb={};_0x503dfb[_0x586eb9[_0x95d2('0x33')]]=_0x258401;_[_0x95d2('0x2f')](_0x57322a[_0x95d2('0x30')],_0x503dfb);}return _0x5af7d7[_0x95d2('0x1e')](_0x95d2('0x34'))[_0x95d2('0x21')](_0x57322a,_0x13a3ae);}});case _0x95d2('0x35'):var _0x5dd1e6=_[_0x95d2('0x2d')](_0x4c7f7e);if(_0x586eb9['additionalSearchAccount']){var _0x253d30={};_0x253d30[_0x586eb9[_0x95d2('0x36')]]=_0x258401;_[_0x95d2('0x2f')](_0x5dd1e6[_0x95d2('0x30')],_0x253d30);}return _0x5af7d7['sobject'](_0x95d2('0x37'))[_0x95d2('0x21')](_0x5dd1e6,_0x13a3ae)['execute']()[_0x95d2('0x22')](function(_0x168fc6){if(_0x168fc6&&_0x168fc6['length']){return _0x168fc6;}else{var _0x34f9bf=_[_0x95d2('0x2d')](_0x4c7f7e);if(_0x586eb9[_0x95d2('0x2e')]){var _0x1e834f={};_0x1e834f[_0x586eb9[_0x95d2('0x2e')]]=_0x258401;_[_0x95d2('0x2f')](_0x34f9bf['$or'],_0x1e834f);}return _0x5af7d7['sobject']('Contact')[_0x95d2('0x21')](_0x34f9bf,_0x13a3ae)[_0x95d2('0x22')](function(_0x53ba67){if(_0x53ba67&&_0x53ba67['length']){return _0x53ba67;}else{var _0x539de2=_[_0x95d2('0x2d')](_0x4c7f7e);if(_0x586eb9[_0x95d2('0x33')]){var _0x8a6361={};_0x8a6361[_0x586eb9['additionalSearchLead']]=_0x258401;_['merge'](_0x539de2[_0x95d2('0x30')],_0x8a6361);}return _0x5af7d7[_0x95d2('0x1e')](_0x95d2('0x34'))[_0x95d2('0x21')](_0x539de2,_0x13a3ae);}});}});case'contact':var _0x13230a=_['cloneDeep'](_0x4c7f7e);if(_0x586eb9[_0x95d2('0x2e')]){var _0x253d30={};_0x253d30[_0x586eb9[_0x95d2('0x2e')]]=_0x258401;_[_0x95d2('0x2f')](_0x13230a[_0x95d2('0x30')],_0x253d30);}return _0x5af7d7[_0x95d2('0x1e')](_0x95d2('0x31'))['find'](_0x13230a,_0x13a3ae)['execute']();case _0x95d2('0x17'):var _0x33daf9=_['cloneDeep'](_0x4c7f7e);if(_0x586eb9['additionalSearchLead']){var _0x253d30={};_0x253d30[_0x586eb9['additionalSearchLead']]=_0x258401;_[_0x95d2('0x2f')](_0x33daf9[_0x95d2('0x30')],_0x253d30);}return _0x5af7d7[_0x95d2('0x1e')](_0x95d2('0x34'))[_0x95d2('0x21')](_0x33daf9,_0x13a3ae);case _0x95d2('0x1b'):var _0x5dd1e6=_[_0x95d2('0x2d')](_0x4c7f7e);if(_0x586eb9[_0x95d2('0x36')]){var _0x253d30={};_0x253d30[_0x586eb9[_0x95d2('0x36')]]=_0x258401;_[_0x95d2('0x2f')](_0x5dd1e6[_0x95d2('0x30')],_0x253d30);}return _0x5af7d7[_0x95d2('0x1e')]('Account')['find'](_0x5dd1e6,_0x13a3ae);default:return null;}})[_0x95d2('0x22')](function(_0x10e1f1){if(_0x10e1f1&&_0x10e1f1[_0x95d2('0x23')]){var _0x520cdc=_['first'](_0x10e1f1);if(_0x520cdc){return BPromise['resolve']({'id':_0x520cdc['Id'],'name':_0x520cdc[_0x95d2('0x38')],'phone':_0x520cdc[_0x95d2('0x39')],'endUserType':_0x520cdc['attributes'][_0x95d2('0x3a')][_0x95d2('0x3b')]()});}}})['then'](function(_0x2229fa){if(_0x2229fa){logger[_0x95d2('0x25')](_0x95d2('0x3c'),_0x2229fa[_0x95d2('0x15')],_0x258401);return BPromise[_0x95d2('0x26')](_0x2229fa);}else{logger['info'](_0x95d2('0x3d'),_0x258401);var _0x53e80b={'Phone':_0x258401};if(_0x586eb9[_0x95d2('0x3e')]){if(_0x586eb9[_0x95d2('0x3e')]==='contact'){logger['info'](_0x95d2('0x3f'),_0x258401,_0x586eb9[_0x95d2('0x3e')]);_0x53e80b[_0x95d2('0x40')]=_0x3c13d0!==_0x95d2('0x41')?_0x3c13d0:util[_0x95d2('0x42')](_0x95d2('0x43'),_0x258401);}else if(_0x586eb9[_0x95d2('0x3e')]===_0x95d2('0x17')){logger[_0x95d2('0x25')](_0x95d2('0x3f'),_0x258401,_0x586eb9[_0x95d2('0x3e')]);_0x53e80b[_0x95d2('0x40')]=_0x3c13d0!==_0x95d2('0x41')?_0x3c13d0:util[_0x95d2('0x42')](_0x95d2('0x43'),_0x258401);_0x53e80b[_0x95d2('0x44')]=_0x95d2('0x45');}else if(_0x586eb9[_0x95d2('0x3e')]===_0x95d2('0x1b')){logger[_0x95d2('0x25')](_0x95d2('0x3f'),_0x258401,_0x586eb9[_0x95d2('0x3e')]);_0x53e80b['Name']=_0x3c13d0!==''?_0x3c13d0:util[_0x95d2('0x42')](_0x95d2('0x43'),_0x258401);}else{return null;}}return _0x5af7d7[_0x95d2('0x1e')](_[_0x95d2('0x46')](_0x586eb9['moduleCreate']))[_0x95d2('0x1f')](_0x53e80b)[_0x95d2('0x22')](function(_0x546659){return BPromise['resolve']({'id':_0x546659['id'],'endUserType':_0x586eb9['moduleCreate']});});}});}function getCustomFields(_0xb7f7e9,_0x3638ad){var _0x30c73e={};if(_0xb7f7e9[_0x95d2('0x23')]>0x0){_[_0x95d2('0x47')](_0xb7f7e9,function(_0xef72bf){if(_['includes']([_0x95d2('0x48'),'picklist'],_0xef72bf[_0x95d2('0x3a')])&&_0xef72bf['idField']){_0x30c73e[_0xef72bf[_0x95d2('0x49')]]=_0xef72bf['content'][_0x95d2('0x4a')]();}else if(_0xef72bf[_0x95d2('0x3a')]===_0x95d2('0x4b')&&_0xef72bf[_0x95d2('0x4c')]&&_0xef72bf['idField']){_0x3638ad[_0xef72bf['variableName']]&&(_0x30c73e[_0xef72bf[_0x95d2('0x49')]]=_0x3638ad[_0xef72bf[_0x95d2('0x4c')]][_0x95d2('0x4a')]());}else if(_0xef72bf[_0x95d2('0x3a')]===_0x95d2('0x4d')&&_0xef72bf[_0x95d2('0x4e')]&&_0xef72bf[_0x95d2('0x4e')][_0x95d2('0x4f')]&&_0xef72bf[_0x95d2('0x49')]){_0x3638ad[_0xef72bf[_0x95d2('0x4e')][_0x95d2('0x4f')][_0x95d2('0x3b')]()]&&(_0x30c73e[_0xef72bf[_0x95d2('0x49')]]=_0x3638ad[_0xef72bf['Variable']['name'][_0x95d2('0x3b')]()][_0x95d2('0x4a')]());}});}return _0x30c73e;}function getConnection(_0x38d663){var _0xf70ae7=_0x38d663[_0x95d2('0x50')][_0x95d2('0x51')](_0x38d663['securityToken']);var _0xc8820b=new jsforce[(_0x95d2('0x52'))]({'oauth2':{'loginUrl':_0x38d663[_0x95d2('0x53')]||'https://login.salesforce.com','clientId':_0x38d663[_0x95d2('0x54')],'clientSecret':_0x38d663[_0x95d2('0x55')]}});return _0xc8820b[_0x95d2('0x56')](_0x38d663[_0x95d2('0x57')],_0xf70ae7)[_0x95d2('0x22')](function(){logger[_0x95d2('0x25')](_0x95d2('0x58'));return _0xc8820b;});}exports[_0x95d2('0x59')]=function(_0x52d89c,_0x1af2fb,_0x203fbd,_0x36e608,_0x3a5ad0,_0x3b819a){var _0x1fc646,_0x3bcbea,_0x3448e9,_0x33e948;_0x3b819a[_0x95d2('0x5a')]=intUtil[_0x95d2('0x5b')](_0x3b819a[_0x95d2('0x5a')]);_0x3b819a[_0x95d2('0x53')]=intUtil[_0x95d2('0x5b')](_0x3b819a[_0x95d2('0x53')]);if(_0x3a5ad0&&_0x3a5ad0['monitor_format']){logger[_0x95d2('0x25')](_0x95d2('0x5c'),_0x95d2('0x5d'));_0x1af2fb['recordingURL']=util[_0x95d2('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3b819a[_0x95d2('0x5a')],_0x1af2fb[_0x95d2('0x5e')],md5(_0x1af2fb[_0x95d2('0x5e')]));}else{_0x1af2fb['recordingURL']='';}return getConnection(_0x3b819a)[_0x95d2('0x22')](function(_0x34bac9){_0x33e948=_0x34bac9;return getUser(_0x3b819a,_0x36e608['email'],_0x33e948);})[_0x95d2('0x22')](function(_0x3066c5){_0x1fc646=_0x3066c5;return getEndUser(_0x3b819a,_0x203fbd,_0x1af2fb[_0x95d2('0x5f')],_0x1af2fb[_0x95d2('0x60')],_0x33e948);})[_0x95d2('0x22')](function(_0x37c124){_0x3bcbea=_0x37c124;return getTicket(_0x3b819a,_0x1fc646,_0x3bcbea,_0x203fbd,_0x1af2fb,_0x203fbd[_0x95d2('0x61')],_0x33e948,_0x95d2('0x59'));})['then'](function(_0x30b7f0){_0x3448e9=_0x30b7f0;logger[_0x95d2('0x25')](_0x95d2('0x62'),_0x3448e9['id']);logger[_0x95d2('0x25')](_0x95d2('0x63'),_0x3448e9['id'],_0x36e608[_0x95d2('0x4f')],_0x3b819a[_0x95d2('0x3a')]);switch(_0x3b819a[_0x95d2('0x3a')]){case _0x95d2('0x64'):emit(util['format']('user:%s',_0x36e608['name']),_0x95d2('0x65'),{'recordId':_0x3448e9['id']});break;case'newTab':emit(util['format'](_0x95d2('0x66'),_0x36e608[_0x95d2('0x4f')]),'trigger:browser:url',{'uri':util[_0x95d2('0x42')](_0x95d2('0x67'),_0x33e948[_0x95d2('0x68')],_0x3448e9['id'])});break;default:logger[_0x95d2('0x69')](_0x95d2('0x6a'));}})[_0x95d2('0x6b')](function(_0x367789){logger['error'](_0x95d2('0x5c'),_0x367789);});};exports[_0x95d2('0x6c')]=function(_0x1cd593,_0x2b20f2,_0x3a9133,_0x252f1f,_0x382bf6,_0x1e841b,_0x16f09f){var _0x4bc865,_0x2edc7e,_0x36bb22,_0x1662e9;_0x1e841b[_0x95d2('0x5a')]=intUtil[_0x95d2('0x5b')](_0x1e841b[_0x95d2('0x5a')]);_0x1e841b['remoteUri']=intUtil['stripTrailingSlash'](_0x1e841b[_0x95d2('0x53')]);if(_0x16f09f&&_0x16f09f[_0x95d2('0x6d')]&&_0x16f09f[_0x95d2('0x6d')]!==_0x95d2('0x6e')){logger[_0x95d2('0x25')](_0x95d2('0x6f'),'Recording\x20is\x20enabled!');_0x2b20f2[_0x95d2('0x70')]=util[_0x95d2('0x42')](_0x95d2('0x71'),_0x1e841b[_0x95d2('0x5a')],_0x2b20f2[_0x95d2('0x5e')],md5(_0x2b20f2[_0x95d2('0x5e')]));}return getConnection(_0x1e841b)['then'](function(_0x27f840){_0x1662e9=_0x27f840;return getUser(_0x1e841b,_0x252f1f[_0x95d2('0x72')],_0x1662e9);})['then'](function(_0x4d9a4d){_0x4bc865=_0x4d9a4d;return getEndUser(_0x1e841b,_0x3a9133,_0x2b20f2[_0x95d2('0x73')],_0x2b20f2[_0x95d2('0x74')],_0x1662e9);})[_0x95d2('0x22')](function(_0x330b09){_0x2edc7e=_0x330b09;return getTicket(_0x1e841b,_0x4bc865,_0x2edc7e,_0x3a9133,_0x2b20f2,_0x3a9133[_0x95d2('0x61')],_0x1662e9,_0x95d2('0x6c'));})[_0x95d2('0x22')](function(_0xdcc52e){_0x36bb22=_0xdcc52e;logger[_0x95d2('0x25')](_0x95d2('0x75'),_0x36bb22['id']);logger[_0x95d2('0x25')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x36bb22['id'],_0x252f1f[_0x95d2('0x4f')],_0x1e841b['type']);switch(_0x1e841b[_0x95d2('0x3a')]){case'integrationTab':emit(util[_0x95d2('0x42')](_0x95d2('0x66'),_0x252f1f[_0x95d2('0x4f')]),_0x95d2('0x65'),{'recordId':_0x36bb22['id']});break;case'newTab':emit(util[_0x95d2('0x42')](_0x95d2('0x66'),_0x252f1f[_0x95d2('0x4f')]),_0x95d2('0x76'),{'uri':util[_0x95d2('0x42')]('%s/%s/e',_0x1662e9[_0x95d2('0x68')],_0x36bb22['id'])});break;default:logger['error'](_0x95d2('0x6f'),_0x95d2('0x77'));}})[_0x95d2('0x6b')](function(_0x35000c){logger[_0x95d2('0x69')]('[OUTBOUND]',_0x35000c);});};exports['unmanaged']=function(_0x381ab6,_0x2d5f53,_0x4bbac1,_0x191059,_0x30f59c,_0x15ac42){var _0x55d7f5,_0x534c06,_0x140c7b,_0x2b04a2;_0x15ac42[_0x95d2('0x5a')]=intUtil[_0x95d2('0x5b')](_0x15ac42['serverUrl']);_0x15ac42[_0x95d2('0x53')]=intUtil[_0x95d2('0x5b')](_0x15ac42[_0x95d2('0x53')]);if(_0x30f59c&&_0x30f59c[_0x95d2('0x78')]){logger['info']('['+_0x2d5f53[_0x95d2('0x79')][_0x95d2('0x7a')]()+']',_0x95d2('0x5d'));_0x2d5f53['recordingURL']=util[_0x95d2('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x15ac42[_0x95d2('0x5a')],_0x2d5f53['uniqueid'],md5(_0x2d5f53['uniqueid']));}else{_0x2d5f53[_0x95d2('0x70')]='';}return getConnection(_0x15ac42)[_0x95d2('0x22')](function(_0x51af08){_0x2b04a2=_0x51af08;if(!_[_0x95d2('0x7b')](_0x191059)){return getUser(_0x15ac42,_0x191059[_0x95d2('0x4f')],_0x2b04a2);}else{return getUser(_0x15ac42,null,_0x2b04a2);}})[_0x95d2('0x22')](function(_0x1f1304){_0x55d7f5=_0x1f1304;return getEndUser(_0x15ac42,_0x4bbac1,_0x2d5f53['calleridname'],_0x2d5f53[_0x95d2('0x60')],_0x2b04a2);})[_0x95d2('0x22')](function(_0x3b57f8){_0x534c06=_0x3b57f8;return getTicket(_0x15ac42,_0x55d7f5,_0x534c06,_0x4bbac1,_0x2d5f53,_0x4bbac1['Fields'],_0x2b04a2);})[_0x95d2('0x22')](function(_0x540eda){_0x140c7b=_0x540eda;logger[_0x95d2('0x25')]('['+_0x2d5f53[_0x95d2('0x79')][_0x95d2('0x7a')]()+_0x95d2('0x7c'),_0x140c7b['id']);logger[_0x95d2('0x25')]('['+_0x2d5f53[_0x95d2('0x79')][_0x95d2('0x7a')]()+_0x95d2('0x7d'),_0x15ac42[_0x95d2('0x3a')]);})['catch'](function(_0x2e8cd9){logger['error']('['+_0x2d5f53[_0x95d2('0x79')][_0x95d2('0x7a')]()+']',_0x2e8cd9);});}; \ 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 b2e59cb..a0db89e 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 _0xbef9=['util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','info','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','customField','nameField','content','toString','toLowerCase','variable','idField','customVariable','Variable','name','outbound','incident','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xbef9,0x6b));var _0x9bef=function(_0x20e375,_0xdc0dde){_0x20e375=_0x20e375-0x0;var _0x55ac5d=_0xbef9[_0x20e375];return _0x55ac5d;};'use strict';var _=require('lodash');var Promise=require(_0x9bef('0x0'));var rp=require('request-promise');var util=require(_0x9bef('0x1'));var md5=require('md5');var Redis=require(_0x9bef('0x2'));var intUtil=require(_0x9bef('0x3'));var config=require(_0x9bef('0x4'));var logger=require(_0x9bef('0x5'))(_0x9bef('0x6'));config[_0x9bef('0x7')]=_[_0x9bef('0x8')](config[_0x9bef('0x7')],{'host':_0x9bef('0x9'),'port':0x18eb});var io=require(_0x9bef('0xa'))(new Redis(config['redis']));function getAdminUser(_0x24bab4,_0x2590a0,_0x4ac1c7,_0x36604e,_0x181de8,_0x10fe02){return new Promise(function(_0x561a7c,_0x532369){var _0x55da40={'method':_0x9bef('0xb'),'uri':_0x36604e+_0x9bef('0xc')+'&'+_0x181de8+'&'+_0x10fe02,'auth':_0x2590a0,'json':!![]};return rp(_0x55da40)[_0x9bef('0xd')](function(_0x8aff68){if(_0x8aff68[_0x9bef('0xe')]['length']>0x0){_0x4ac1c7[_0x9bef('0xf')]=_0x8aff68[_0x9bef('0xe')][0x0]['sys_id'];}logger['info']('['+[_0x24bab4['toUpperCase']()]+_0x9bef('0x10'),_0x4ac1c7);_0x561a7c(_0x4ac1c7);})[_0x9bef('0x11')](function(_0x5801cb){logger[_0x9bef('0x12')]('['+[_0x24bab4[_0x9bef('0x13')]()]+']',_0x5801cb[_0x9bef('0x14')]);_0x532369(_0x5801cb[_0x9bef('0x14')]);});});}function getUser(_0x254e14,_0x8d087f,_0x4360aa,_0x1c4c4a,_0x4d68da){return function(_0x594ab3){logger[_0x9bef('0x15')]('['+[_0x254e14['toUpperCase']()]+_0x9bef('0x16'),_0x594ab3);return new Promise(function(_0x3e8ada,_0x115e3d){if(intUtil[_0x9bef('0x17')](_0x594ab3['userEmail'])){var _0x449e1d={'method':_0x9bef('0xb'),'uri':_0x4360aa+_0x9bef('0x18')+_0x594ab3[_0x9bef('0x19')]+'&'+_0x1c4c4a+'&'+_0x4d68da,'auth':_0x8d087f,'json':!![]};logger[_0x9bef('0x15')]('['+[_0x254e14[_0x9bef('0x13')]()]+_0x9bef('0x1a'),_0x449e1d);return rp(_0x449e1d)[_0x9bef('0xd')](function(_0x26188e){logger[_0x9bef('0x15')]('['+[_0x254e14['toUpperCase']()]+_0x9bef('0x1b'),_0x26188e);if(_0x26188e[_0x9bef('0xe')][_0x9bef('0x1c')]>0x0&&String(_0x26188e[_0x9bef('0xe')][0x0]['active'])===_0x9bef('0x1d')){_0x594ab3[_0x9bef('0x1e')]=_0x26188e[_0x9bef('0xe')][0x0][_0x9bef('0x1f')];}else{_0x594ab3[_0x9bef('0x1e')]=_0x594ab3[_0x9bef('0xf')];_0x594ab3[_0x9bef('0x19')]=_0x594ab3[_0x9bef('0x20')];}logger[_0x9bef('0x15')]('['+[_0x254e14[_0x9bef('0x13')]()]+_0x9bef('0x21'),_0x594ab3);_0x3e8ada(_0x594ab3);})[_0x9bef('0x11')](function(_0xb7f2f3){logger[_0x9bef('0x12')]('['+[_0x254e14[_0x9bef('0x13')]()]+']',_0xb7f2f3[_0x9bef('0x14')]);_0x115e3d(_0xb7f2f3['message']);});}else{logger[_0x9bef('0x15')]('['+[_0x254e14[_0x9bef('0x13')]()]+']\x20using\x20admin\x20profile');_0x594ab3[_0x9bef('0x1e')]=_0x594ab3['adminId'];_0x594ab3[_0x9bef('0x19')]=_0x594ab3[_0x9bef('0x20')];_0x3e8ada(_0x594ab3);}});};}function createEndUser(_0x11430c,_0x2c2d8b,_0x331419,_0x521f36,_0x54cfc1){logger[_0x9bef('0x15')]('['+[_0x11430c[_0x9bef('0x13')]()]+_0x9bef('0x22'),_0x331419);return new Promise(function(_0x37d708,_0x4d188d){var _0x400ab7={'method':_0x9bef('0x23'),'uri':_0x521f36+'sys_user?'+_0x54cfc1,'body':{'user_name':_0x331419[_0x9bef('0x24')],'roles':'user','first_name':_0x331419['endUserNumber'],'active':'true','date_format':_0x9bef('0x25'),'phone':_0x331419['endUserNumber']},'auth':_0x2c2d8b,'json':!![]};return rp(_0x400ab7)[_0x9bef('0xd')](function(_0x4b36b1){logger[_0x9bef('0x15')]('['+[_0x11430c[_0x9bef('0x13')]()]+_0x9bef('0x26'),_0x4b36b1['result']);_0x331419['endUserId']=_0x4b36b1['result'][_0x9bef('0x1f')];_0x37d708(_0x331419);})[_0x9bef('0x11')](function(_0x6e30c2){logger[_0x9bef('0x12')]('['+[_0x11430c[_0x9bef('0x13')]()]+']',_0x6e30c2[_0x9bef('0x14')]);_0x4d188d(_0x6e30c2[_0x9bef('0x14')]);});});}function getEndUser(_0x119c91,_0x2be1b1,_0x2bc869,_0x2e19dd,_0x1796cb){return function(_0x4c0905){logger[_0x9bef('0x15')]('['+[_0x119c91[_0x9bef('0x13')]()]+_0x9bef('0x27'),_0x4c0905);return new Promise(function(_0x253a07,_0x1643b2){var _0x575f1d={'method':_0x9bef('0xb'),'uri':_0x2bc869+_0x9bef('0x28')+_0x4c0905['endUserNumber']+'&'+_0x2e19dd+'&'+_0x1796cb,'auth':_0x2be1b1,'json':!![]};return rp(_0x575f1d)['then'](function(_0x349e5e){if(_0x349e5e[_0x9bef('0xe')][_0x9bef('0x1c')]>0x0){_0x4c0905['endUserId']=_0x349e5e[_0x9bef('0xe')][0x0]['sys_id'];logger[_0x9bef('0x15')]('['+[_0x119c91['toUpperCase']()]+_0x9bef('0x29'),_0x4c0905);_0x253a07(_0x4c0905);}else{return createEndUser(_0x119c91,_0x2be1b1,_0x4c0905,_0x2bc869,_0x2e19dd)[_0x9bef('0xd')](function(_0x1eed40){logger[_0x9bef('0x15')]('['+[_0x119c91['toUpperCase']()]+_0x9bef('0x2a'),_0x1eed40);_0x253a07(_0x1eed40);});}})[_0x9bef('0x11')](function(_0x53f8b6){logger[_0x9bef('0x12')]('['+[_0x119c91[_0x9bef('0x13')]()]+']',_0x53f8b6[_0x9bef('0x14')]);_0x1643b2(_0x53f8b6['message']);});});};}function getCustomFields(_0x2e8b02,_0x534624){var _0x5768d2={};if(_0x2e8b02[_0x9bef('0x1c')]>0x0){_[_0x9bef('0x2b')](_0x2e8b02,function(_0x33c8f2){if(_[_0x9bef('0x2c')]([_0x9bef('0x2d'),_0x9bef('0x2e')],_0x33c8f2[_0x9bef('0x2f')])&&_0x33c8f2['nameField']&&!_0x33c8f2[_0x9bef('0x30')]){_0x5768d2[_0x33c8f2[_0x9bef('0x31')]['toLowerCase']()]=_0x33c8f2[_0x9bef('0x32')][_0x9bef('0x33')]();}else if(_['includes']([_0x9bef('0x2d'),_0x9bef('0x2e')],_0x33c8f2[_0x9bef('0x2f')])&&_0x33c8f2['idField']&&_0x33c8f2['customField']){_0x5768d2[_0x33c8f2['idField'][_0x9bef('0x34')]()]=_0x33c8f2[_0x9bef('0x32')][_0x9bef('0x33')]();}else if(_0x33c8f2[_0x9bef('0x2f')]===_0x9bef('0x35')&&_0x33c8f2['variableName']&&_0x33c8f2[_0x9bef('0x36')]&&_0x33c8f2[_0x9bef('0x30')]){_0x5768d2[_0x33c8f2[_0x9bef('0x36')]['toLowerCase']()]=_0x534624[_0x33c8f2['variableName']][_0x9bef('0x33')]();}else if(_0x33c8f2[_0x9bef('0x2f')]===_0x9bef('0x37')&&_0x33c8f2[_0x9bef('0x38')]&&_0x33c8f2['Variable'][_0x9bef('0x39')]&&_0x33c8f2[_0x9bef('0x36')]&&_0x33c8f2[_0x9bef('0x30')]){_0x5768d2[_0x33c8f2[_0x9bef('0x36')][_0x9bef('0x34')]()]=_0x534624[_0x33c8f2[_0x9bef('0x38')][_0x9bef('0x39')][_0x9bef('0x34')]()][_0x9bef('0x33')]();}});}return _0x5768d2;}function getTicket(_0x483239,_0x4a2945,_0x5b0c5f,_0x5882de,_0x1fc591,_0x5918ed){return function(_0xe874fa){logger['info']('['+[_0x483239['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0xe874fa);return new Promise(function(_0x2681f0,_0x35dddc){var _0x285a8c=_0x483239[_0x9bef('0x34')]()===_0x9bef('0x3a')?_0xe874fa[_0x9bef('0x1e')]:_0xe874fa['endUserId'];var _0x44ca2b={'method':'POST','uri':_0x5b0c5f+_0x9bef('0x3b')+'?'+_0x5918ed,'body':Object['assign']({},{'active':_0x9bef('0x1d'),'caller_id':_0x285a8c,'assigned_to':_0xe874fa[_0x9bef('0x1e')],'short_description':intUtil[_0x9bef('0x3c')](_0x5882de[_0x9bef('0x3d')],_0x1fc591,'\x20'),'description':intUtil[_0x9bef('0x3c')](_0x5882de[_0x9bef('0x3e')],_0x1fc591,'\x0a')},getCustomFields(_0x5882de['Fields'],_0x1fc591)),'auth':_0x4a2945,'json':!![]};return rp(_0x44ca2b)[_0x9bef('0xd')](function(_0x38f6aa){logger['info']('['+[_0x483239[_0x9bef('0x13')]()]+_0x9bef('0x3f'),_0x38f6aa['result']);_0xe874fa[_0x9bef('0x40')]=_0x38f6aa[_0x9bef('0xe')][_0x9bef('0x1f')];_0xe874fa[_0x9bef('0x41')]=_0x38f6aa[_0x9bef('0xe')]['number'];logger[_0x9bef('0x15')]('['+[_0x483239[_0x9bef('0x13')]()]+_0x9bef('0x42'),_0xe874fa);_0x2681f0(_0xe874fa);})[_0x9bef('0x11')](function(_0x162af9){logger['error']('['+[_0x483239[_0x9bef('0x13')]()]+']',_0x162af9[_0x9bef('0x14')]);_0x35dddc(_0x162af9[_0x9bef('0x14')]);});});};}function createRemoteTag(_0x5dee2b,_0x879933,_0x1870cb,_0x49da8f){return new Promise(function(_0x57ca94,_0x4d9245){var _0x3be1b3={'method':_0x9bef('0x23'),'uri':_0x1870cb+_0x9bef('0x43')+'?'+_0x49da8f,'body':{'short_description':_0x5dee2b,'global':!![],'active':!![],'name':_0x5dee2b},'auth':_0x879933,'json':!![]};return rp(_0x3be1b3)[_0x9bef('0xd')](function(_0x587461){var _0x13f192=_0x587461[_0x9bef('0xe')][_0x9bef('0x1f')];_0x57ca94(_0x13f192);});});}function getRemoteTag(_0x3a4b0b,_0x2af325,_0x328cf7,_0x411ce2,_0x448c05){return new Promise(function(_0x211c77,_0x3587c7){var _0x5bb3c9={'method':_0x9bef('0xb'),'uri':_0x328cf7+_0x9bef('0x43')+_0x9bef('0x44')+_0x3a4b0b+'&'+_0x411ce2,'auth':_0x2af325,'json':!![]};return rp(_0x5bb3c9)[_0x9bef('0xd')](function(_0x587564){if(_0x587564['result'][_0x9bef('0x1c')]>0x0){var _0x230121=_0x587564[_0x9bef('0xe')][0x0][_0x9bef('0x1f')];_0x211c77(_0x230121);}else{return createRemoteTag(_0x3a4b0b,_0x2af325,_0x328cf7,_0x411ce2)[_0x9bef('0xd')](function(_0xaffd7d){_0x211c77(_0xaffd7d);});}});});}function assignTagToIncident(_0x3b5aee,_0x2ff569,_0x18d235,_0x51f1c6,_0x4a2654){return new Promise(function(_0x4012f0,_0xa57cfe){var _0x4ed9ba={'method':_0x9bef('0x23'),'uri':_0x18d235+_0x9bef('0x45')+'?'+_0x4a2654,'body':{'label':_0x3b5aee,'table':_0x9bef('0x3b'),'id_type':_0x9bef('0x46'),'table_key':_0x51f1c6[_0x9bef('0x40')],'title':'Incident\x20-\x20'+_0x51f1c6[_0x9bef('0x41')],'id_display':_0x51f1c6[_0x9bef('0x41')]},'auth':_0x2ff569,'json':!![]};return rp(_0x4ed9ba)['then'](function(_0x5d9960){_0x4012f0();})[_0x9bef('0x11')](function(){_0x4012f0();});});}function manageTags(_0x15cc78,_0x196747,_0x14d82c,_0x5ade99,_0x476d7a,_0xdf8d18,_0x434fc3){return new Promise(function(_0x4bda05,_0x177680){var _0x401c0a=[];_0x196747[_0x9bef('0x2b')](function(_0x3ae47e){_0x401c0a[_0x9bef('0x47')](getRemoteTag(_0x3ae47e,_0x14d82c,_0x5ade99,_0xdf8d18,_0x434fc3));});return Promise[_0x9bef('0x48')](_0x401c0a)[_0x9bef('0xd')](function(_0x232f85){if(_0x232f85[_0x9bef('0x1c')]){logger[_0x9bef('0x15')]('['+[_0x15cc78[_0x9bef('0x13')]()]+_0x9bef('0x49'),_0x232f85);var _0x553842=[];_0x232f85['forEach'](function(_0x5ba72a){_0x553842['push'](assignTagToIncident(_0x5ba72a,_0x14d82c,_0x5ade99,_0x476d7a,_0xdf8d18));});return Promise[_0x9bef('0x48')](_0x553842)['then'](function(){_0x4bda05();})['catch'](function(){_0x4bda05();});}else{_0x4bda05();}});});}function getTags(_0x5d1e83,_0x4f9e3a,_0x21549b,_0x399951,_0xbc20e7,_0x209c91){return function(_0xc382d8){return new Promise(function(_0x2382f4,_0xa074e5){var _0x446c1b=[];var _0x1faef5=_0x399951[_0x9bef('0x4a')];if(_0x1faef5&&_0x1faef5[_0x9bef('0x1c')]>0x0){_0x446c1b=_[_0x9bef('0x4b')](_0x1faef5,_0x9bef('0x39'));}if(_0x446c1b[_0x9bef('0x1c')]>0x0){return manageTags(_0x5d1e83,_0x446c1b,_0x4f9e3a,_0x21549b,_0xc382d8,_0xbc20e7,_0x209c91)[_0x9bef('0xd')](function(){_0x2382f4(_0xc382d8);});}else{_0x2382f4(_0xc382d8);}});};}function emit(_0x16a3fd,_0x55b703,_0x5b51a8){var _0x1a2166=_0x9bef('0x4c')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x9bef('0x4d')+'%255EORDERBYDESCnumber';var _0x3db5c9={'uri':_0x16a3fd+_0x9bef('0x4e')+_0x5b51a8+_0x1a2166};io['to'](util[_0x9bef('0x4f')](_0x9bef('0x50'),_0x55b703))[_0x9bef('0x51')](_0x9bef('0x52'),_0x3db5c9);}exports['cs']=function(_0x1e2ff4,_0x3a623b,_0x361cf3,_0x332cc3,_0x15ed2e,_0x135826,_0x416b57,_0x363e66){var _0x2de75e={};var _0x42de13={'user':_0x135826[_0x9bef('0x53')],'pass':_0x135826[_0x9bef('0x54')]};var _0x59fcf8=_0x9bef('0x55');var _0x499c66=_0x9bef('0x56');_0x135826[_0x9bef('0x57')]=intUtil['stripTrailingSlash'](_0x135826[_0x9bef('0x57')]);_0x135826['serverUrl']=intUtil['stripTrailingSlash'](_0x135826[_0x9bef('0x58')]);var _0x2ae3bd=util[_0x9bef('0x4f')](_0x9bef('0x59'),_0x135826['remoteUri']);_0x2de75e['userEmail']=!_[_0x9bef('0x5a')](_0x332cc3)?_0x332cc3[_0x9bef('0x5b')]:null;_0x2de75e['adminEmail']=_0x135826['email'];_0x2de75e[_0x9bef('0x24')]=_0x363e66[_0x9bef('0x34')]()===_0x9bef('0x3a')?_0x3a623b[_0x9bef('0x5c')]:_0x3a623b[_0x9bef('0x5d')];_0x2de75e[_0x9bef('0x5e')]=_0x363e66===_0x9bef('0x5f')||_0x363e66==='unmanaged'?_0x9bef('0x5f'):'outbound';var _0xc7338e=util[_0x9bef('0x4f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x135826['serverUrl'],_0x3a623b[_0x9bef('0x60')],md5(_0x3a623b['uniqueid']));if(_0x15ed2e&&_0x15ed2e['monitor_format']){logger[_0x9bef('0x15')](_0x9bef('0x61'),_0x9bef('0x62'));_0x3a623b[_0x9bef('0x63')]=_0xc7338e;}else if(_0x416b57&&_0x416b57['recordingFormat']&&_0x416b57['recordingFormat']!==_0x9bef('0x64')){logger['info'](_0x9bef('0x65'),_0x9bef('0x62'));_0x3a623b[_0x9bef('0x63')]=_0xc7338e;}else{_0x3a623b['recordingURL']='';}return getAdminUser(_0x363e66,_0x42de13,_0x2de75e,_0x2ae3bd,_0x499c66,_0x59fcf8)['then'](getUser(_0x363e66,_0x42de13,_0x2ae3bd,_0x499c66,_0x59fcf8))[_0x9bef('0xd')](getEndUser(_0x363e66,_0x42de13,_0x2ae3bd,_0x499c66,_0x59fcf8))[_0x9bef('0xd')](getTicket(_0x363e66,_0x42de13,_0x2ae3bd,_0x361cf3,_0x3a623b,_0x499c66))[_0x9bef('0xd')](function(_0x399857){logger[_0x9bef('0x15')](util[_0x9bef('0x4f')](_0x9bef('0x66'),_0x399857[_0x9bef('0x40')]));logger[_0x9bef('0x15')](util[_0x9bef('0x4f')](_0x9bef('0x67'),_0x363e66));if(_0x363e66!==_0x9bef('0x68')){logger[_0x9bef('0x15')]('['+[_0x363e66[_0x9bef('0x13')]()]+']',_0x9bef('0x69'));emit(_0x135826['remoteUri'],_0x332cc3[_0x9bef('0x39')],_0x399857[_0x9bef('0x40')]);}})[_0x9bef('0x11')](function(_0x69a07f){logger[_0x9bef('0x12')]('['+[_0x363e66[_0x9bef('0x13')]()]+_0x9bef('0x6a'),util[_0x9bef('0x6b')](_0x69a07f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x18a6=['localhost','redis','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','message','info','],\x20getUser\x20input\x20crm','validateEmail','GET','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','],\x20getUser\x20crm','adminEmail','POST','endUserNumber','user','System','then','],\x20EndUser\x20schema','endUserId','error','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','toString','variable','variableName','customVariable','Variable','name','outbound','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','ticketNumber','push','all','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','userEmail','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','ticketId','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','defaults'];(function(_0x4cb1a9,_0x384b63){var _0x26c2fe=function(_0xb559e7){while(--_0xb559e7){_0x4cb1a9['push'](_0x4cb1a9['shift']());}};_0x26c2fe(++_0x384b63);}(_0x18a6,0x12d));var _0x618a=function(_0x5d7339,_0x3d01f6){_0x5d7339=_0x5d7339-0x0;var _0x8580ec=_0x18a6[_0x5d7339];return _0x8580ec;};'use strict';var _=require(_0x618a('0x0'));var Promise=require('bluebird');var rp=require(_0x618a('0x1'));var util=require('util');var md5=require(_0x618a('0x2'));var Redis=require(_0x618a('0x3'));var intUtil=require('./util');var config=require(_0x618a('0x4'));var logger=require(_0x618a('0x5'))(_0x618a('0x6'));config['redis']=_[_0x618a('0x7')](config['redis'],{'host':_0x618a('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x618a('0x9')]));function getAdminUser(_0x2ad2cc,_0xb555ab,_0x9cc3d,_0x2faf65,_0x734c38,_0x3e341e){return new Promise(function(_0x321e94,_0x5bdef1){var _0x126f38={'method':'GET','uri':_0x2faf65+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x734c38+'&'+_0x3e341e,'auth':_0xb555ab,'json':!![]};return rp(_0x126f38)['then'](function(_0x1a5945){if(_0x1a5945[_0x618a('0xa')]['length']>0x0){_0x9cc3d[_0x618a('0xb')]=_0x1a5945[_0x618a('0xa')][0x0][_0x618a('0xc')];}logger['info']('['+[_0x2ad2cc[_0x618a('0xd')]()]+_0x618a('0xe'),_0x9cc3d);_0x321e94(_0x9cc3d);})[_0x618a('0xf')](function(_0x3999d1){logger['error']('['+[_0x2ad2cc[_0x618a('0xd')]()]+']',_0x3999d1[_0x618a('0x10')]);_0x5bdef1(_0x3999d1['message']);});});}function getUser(_0x4f01ee,_0x4b6391,_0x5b9cd2,_0x53cfcc,_0x55255c){return function(_0x5808f6){logger[_0x618a('0x11')]('['+[_0x4f01ee[_0x618a('0xd')]()]+_0x618a('0x12'),_0x5808f6);return new Promise(function(_0x4bc1cd,_0x1c636e){if(intUtil[_0x618a('0x13')](_0x5808f6['userEmail'])){var _0x3de506={'method':_0x618a('0x14'),'uri':_0x5b9cd2+'sys_user?sysparm_query=email%3D'+_0x5808f6['userEmail']+'&'+_0x53cfcc+'&'+_0x55255c,'auth':_0x4b6391,'json':!![]};logger['info']('['+[_0x4f01ee[_0x618a('0xd')]()]+_0x618a('0x15'),_0x3de506);return rp(_0x3de506)['then'](function(_0x12cf88){logger['info']('['+[_0x4f01ee[_0x618a('0xd')]()]+_0x618a('0x16'),_0x12cf88);if(_0x12cf88['result'][_0x618a('0x17')]>0x0&&String(_0x12cf88[_0x618a('0xa')][0x0]['active'])===_0x618a('0x18')){_0x5808f6['userId']=_0x12cf88[_0x618a('0xa')][0x0][_0x618a('0xc')];}else{_0x5808f6[_0x618a('0x19')]=_0x5808f6[_0x618a('0xb')];_0x5808f6['userEmail']=_0x5808f6['adminEmail'];}logger[_0x618a('0x11')]('['+[_0x4f01ee[_0x618a('0xd')]()]+_0x618a('0x1a'),_0x5808f6);_0x4bc1cd(_0x5808f6);})['catch'](function(_0x48b075){logger['error']('['+[_0x4f01ee[_0x618a('0xd')]()]+']',_0x48b075['message']);_0x1c636e(_0x48b075[_0x618a('0x10')]);});}else{logger[_0x618a('0x11')]('['+[_0x4f01ee[_0x618a('0xd')]()]+']\x20using\x20admin\x20profile');_0x5808f6[_0x618a('0x19')]=_0x5808f6[_0x618a('0xb')];_0x5808f6['userEmail']=_0x5808f6[_0x618a('0x1b')];_0x4bc1cd(_0x5808f6);}});};}function createEndUser(_0x1e93a4,_0x5bbc5d,_0x513dc0,_0x29c98a,_0x4b3d94){logger[_0x618a('0x11')]('['+[_0x1e93a4['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x513dc0);return new Promise(function(_0x5def0f,_0x2104e6){var _0x241f77={'method':_0x618a('0x1c'),'uri':_0x29c98a+'sys_user?'+_0x4b3d94,'body':{'user_name':_0x513dc0[_0x618a('0x1d')],'roles':_0x618a('0x1e'),'first_name':_0x513dc0[_0x618a('0x1d')],'active':_0x618a('0x18'),'date_format':_0x618a('0x1f'),'phone':_0x513dc0[_0x618a('0x1d')]},'auth':_0x5bbc5d,'json':!![]};return rp(_0x241f77)[_0x618a('0x20')](function(_0x68458d){logger[_0x618a('0x11')]('['+[_0x1e93a4['toUpperCase']()]+_0x618a('0x21'),_0x68458d[_0x618a('0xa')]);_0x513dc0[_0x618a('0x22')]=_0x68458d[_0x618a('0xa')][_0x618a('0xc')];_0x5def0f(_0x513dc0);})[_0x618a('0xf')](function(_0x46ed83){logger[_0x618a('0x23')]('['+[_0x1e93a4[_0x618a('0xd')]()]+']',_0x46ed83[_0x618a('0x10')]);_0x2104e6(_0x46ed83[_0x618a('0x10')]);});});}function getEndUser(_0x5cfda3,_0x3775cc,_0x1f54a6,_0x37cebe,_0x490800){return function(_0x3a2c60){logger[_0x618a('0x11')]('['+[_0x5cfda3[_0x618a('0xd')]()]+_0x618a('0x24'),_0x3a2c60);return new Promise(function(_0x54f9a5,_0x3adb5d){var _0x566fd9={'method':'GET','uri':_0x1f54a6+_0x618a('0x25')+_0x3a2c60[_0x618a('0x1d')]+'&'+_0x37cebe+'&'+_0x490800,'auth':_0x3775cc,'json':!![]};return rp(_0x566fd9)[_0x618a('0x20')](function(_0x33850b){if(_0x33850b[_0x618a('0xa')][_0x618a('0x17')]>0x0){_0x3a2c60['endUserId']=_0x33850b[_0x618a('0xa')][0x0]['sys_id'];logger[_0x618a('0x11')]('['+[_0x5cfda3[_0x618a('0xd')]()]+_0x618a('0x26'),_0x3a2c60);_0x54f9a5(_0x3a2c60);}else{return createEndUser(_0x5cfda3,_0x3775cc,_0x3a2c60,_0x1f54a6,_0x37cebe)[_0x618a('0x20')](function(_0x56a43b){logger[_0x618a('0x11')]('['+[_0x5cfda3[_0x618a('0xd')]()]+_0x618a('0x27'),_0x56a43b);_0x54f9a5(_0x56a43b);});}})[_0x618a('0xf')](function(_0x4967de){logger['error']('['+[_0x5cfda3[_0x618a('0xd')]()]+']',_0x4967de[_0x618a('0x10')]);_0x3adb5d(_0x4967de[_0x618a('0x10')]);});});};}function getCustomFields(_0x42ac3f,_0x375a9b){var _0x2d7f2b={};if(_0x42ac3f[_0x618a('0x17')]>0x0){_[_0x618a('0x28')](_0x42ac3f,function(_0xd887aa){if(_[_0x618a('0x29')]([_0x618a('0x2a'),_0x618a('0x2b')],_0xd887aa[_0x618a('0x2c')])&&_0xd887aa[_0x618a('0x2d')]&&!_0xd887aa[_0x618a('0x2e')]){_0x2d7f2b[_0xd887aa['nameField'][_0x618a('0x2f')]()]=_0xd887aa[_0x618a('0x30')]['toString']();}else if(_[_0x618a('0x29')]([_0x618a('0x2a'),_0x618a('0x2b')],_0xd887aa['type'])&&_0xd887aa[_0x618a('0x31')]&&_0xd887aa[_0x618a('0x2e')]){_0x2d7f2b[_0xd887aa[_0x618a('0x31')][_0x618a('0x2f')]()]=_0xd887aa[_0x618a('0x30')][_0x618a('0x32')]();}else if(_0xd887aa[_0x618a('0x2c')]===_0x618a('0x33')&&_0xd887aa[_0x618a('0x34')]&&_0xd887aa[_0x618a('0x31')]&&_0xd887aa[_0x618a('0x2e')]){_0x2d7f2b[_0xd887aa[_0x618a('0x31')][_0x618a('0x2f')]()]=_0x375a9b[_0xd887aa[_0x618a('0x34')]][_0x618a('0x32')]();}else if(_0xd887aa['type']===_0x618a('0x35')&&_0xd887aa[_0x618a('0x36')]&&_0xd887aa[_0x618a('0x36')]['name']&&_0xd887aa[_0x618a('0x31')]&&_0xd887aa[_0x618a('0x2e')]){_0x2d7f2b[_0xd887aa['idField'][_0x618a('0x2f')]()]=_0x375a9b[_0xd887aa['Variable'][_0x618a('0x37')][_0x618a('0x2f')]()][_0x618a('0x32')]();}});}return _0x2d7f2b;}function getTicket(_0x3eed45,_0x3e0509,_0x3b09e4,_0x57a407,_0xa77a0,_0x12f614){return function(_0x509837){logger[_0x618a('0x11')]('['+[_0x3eed45[_0x618a('0xd')]()]+']\x20getTicket\x20input\x20crm',_0x509837);return new Promise(function(_0x22178c,_0x2362ae){var _0x2ae496=_0x3eed45[_0x618a('0x2f')]()===_0x618a('0x38')?_0x509837[_0x618a('0x19')]:_0x509837[_0x618a('0x22')];var _0x2087d0={'method':_0x618a('0x1c'),'uri':_0x3b09e4+_0x618a('0x39')+'?'+_0x12f614,'body':Object['assign']({},{'active':_0x618a('0x18'),'caller_id':_0x2ae496,'assigned_to':_0x509837[_0x618a('0x19')],'short_description':intUtil[_0x618a('0x3a')](_0x57a407['Subjects'],_0xa77a0,'\x20'),'description':intUtil[_0x618a('0x3a')](_0x57a407[_0x618a('0x3b')],_0xa77a0,'\x0a')},getCustomFields(_0x57a407[_0x618a('0x3c')],_0xa77a0)),'auth':_0x3e0509,'json':!![]};return rp(_0x2087d0)[_0x618a('0x20')](function(_0x416b20){logger[_0x618a('0x11')]('['+[_0x3eed45[_0x618a('0xd')]()]+_0x618a('0x3d'),_0x416b20[_0x618a('0xa')]);_0x509837['ticketId']=_0x416b20[_0x618a('0xa')][_0x618a('0xc')];_0x509837['ticketNumber']=_0x416b20[_0x618a('0xa')][_0x618a('0x3e')];logger[_0x618a('0x11')]('['+[_0x3eed45[_0x618a('0xd')]()]+_0x618a('0x3f'),_0x509837);_0x22178c(_0x509837);})[_0x618a('0xf')](function(_0x1b0fbe){logger['error']('['+[_0x3eed45[_0x618a('0xd')]()]+']',_0x1b0fbe[_0x618a('0x10')]);_0x2362ae(_0x1b0fbe['message']);});});};}function createRemoteTag(_0x2aa03e,_0x3809ab,_0x1579ae,_0x206375){return new Promise(function(_0x2e70d1,_0x19c155){var _0x5f1d5c={'method':_0x618a('0x1c'),'uri':_0x1579ae+'label'+'?'+_0x206375,'body':{'short_description':_0x2aa03e,'global':!![],'active':!![],'name':_0x2aa03e},'auth':_0x3809ab,'json':!![]};return rp(_0x5f1d5c)['then'](function(_0x381ad0){var _0x5da97b=_0x381ad0[_0x618a('0xa')][_0x618a('0xc')];_0x2e70d1(_0x5da97b);});});}function getRemoteTag(_0xdfafc,_0xf27f61,_0x3a426a,_0x185031,_0x9c0b9c){return new Promise(function(_0x5e382b,_0xd3d657){var _0xe16536={'method':_0x618a('0x14'),'uri':_0x3a426a+_0x618a('0x40')+_0x618a('0x41')+_0xdfafc+'&'+_0x185031,'auth':_0xf27f61,'json':!![]};return rp(_0xe16536)['then'](function(_0x6c0de){if(_0x6c0de[_0x618a('0xa')]['length']>0x0){var _0x2de299=_0x6c0de[_0x618a('0xa')][0x0]['sys_id'];_0x5e382b(_0x2de299);}else{return createRemoteTag(_0xdfafc,_0xf27f61,_0x3a426a,_0x185031)[_0x618a('0x20')](function(_0x4e2433){_0x5e382b(_0x4e2433);});}});});}function assignTagToIncident(_0x2e238a,_0x4bfdd3,_0x5aa0c9,_0x21dfea,_0x2c3df2){return new Promise(function(_0x40504f,_0x56a24d){var _0x3ec66c={'method':_0x618a('0x1c'),'uri':_0x5aa0c9+'label_entry'+'?'+_0x2c3df2,'body':{'label':_0x2e238a,'table':_0x618a('0x39'),'id_type':'Incident','table_key':_0x21dfea['ticketId'],'title':_0x618a('0x42')+_0x21dfea[_0x618a('0x43')],'id_display':_0x21dfea[_0x618a('0x43')]},'auth':_0x4bfdd3,'json':!![]};return rp(_0x3ec66c)[_0x618a('0x20')](function(_0x5d7bf7){_0x40504f();})[_0x618a('0xf')](function(){_0x40504f();});});}function manageTags(_0x4d3c81,_0x29fe94,_0x483760,_0x16f5d3,_0x3b62c0,_0x14d7e9,_0x327c00){return new Promise(function(_0x4728f2,_0x56c3fb){var _0x45bfd8=[];_0x29fe94[_0x618a('0x28')](function(_0x5c3bd6){_0x45bfd8[_0x618a('0x44')](getRemoteTag(_0x5c3bd6,_0x483760,_0x16f5d3,_0x14d7e9,_0x327c00));});return Promise[_0x618a('0x45')](_0x45bfd8)[_0x618a('0x20')](function(_0x230e53){if(_0x230e53[_0x618a('0x17')]){logger['info']('['+[_0x4d3c81[_0x618a('0xd')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x230e53);var _0x42f551=[];_0x230e53[_0x618a('0x28')](function(_0x2e066a){_0x42f551[_0x618a('0x44')](assignTagToIncident(_0x2e066a,_0x483760,_0x16f5d3,_0x3b62c0,_0x14d7e9));});return Promise[_0x618a('0x45')](_0x42f551)[_0x618a('0x20')](function(){_0x4728f2();})[_0x618a('0xf')](function(){_0x4728f2();});}else{_0x4728f2();}});});}function getTags(_0x2cccf6,_0x4d87f0,_0x5f3c79,_0x4ca58e,_0x6b9b0,_0x18d9c7){return function(_0x5d6f1b){return new Promise(function(_0xc45c38,_0x4acbe6){var _0x49a039=[];var _0x3432bc=_0x4ca58e['Tags'];if(_0x3432bc&&_0x3432bc['length']>0x0){_0x49a039=_['map'](_0x3432bc,'name');}if(_0x49a039[_0x618a('0x17')]>0x0){return manageTags(_0x2cccf6,_0x49a039,_0x4d87f0,_0x5f3c79,_0x5d6f1b,_0x6b9b0,_0x18d9c7)[_0x618a('0x20')](function(){_0xc45c38(_0x5d6f1b);});}else{_0xc45c38(_0x5d6f1b);}});};}function emit(_0xbcaab7,_0x4a46a1,_0x3bf359){var _0x2432a5='%26sysparm_record_target%3Dincident'+_0x618a('0x46')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x618a('0x47');var _0x427da3={'uri':_0xbcaab7+_0x618a('0x48')+_0x3bf359+_0x2432a5};io['to'](util['format'](_0x618a('0x49'),_0x4a46a1))[_0x618a('0x4a')](_0x618a('0x4b'),_0x427da3);}exports['cs']=function(_0x2a3549,_0x196fec,_0x59294a,_0x3e60fc,_0x3e92c0,_0x50c354,_0x33473e,_0x2a8a22){var _0x1c92d0={};var _0x7ae920={'user':_0x50c354[_0x618a('0x4c')],'pass':_0x50c354[_0x618a('0x4d')]};var _0x4c68d8=_0x618a('0x4e');var _0x25f2ac=_0x618a('0x4f');_0x50c354[_0x618a('0x50')]=intUtil[_0x618a('0x51')](_0x50c354['remoteUri']);_0x50c354[_0x618a('0x52')]=intUtil[_0x618a('0x51')](_0x50c354[_0x618a('0x52')]);var _0x5dd5a6=util[_0x618a('0x53')](_0x618a('0x54'),_0x50c354[_0x618a('0x50')]);_0x1c92d0[_0x618a('0x55')]=!_['isNil'](_0x3e60fc)?_0x3e60fc[_0x618a('0x56')]:null;_0x1c92d0[_0x618a('0x1b')]=_0x50c354[_0x618a('0x56')];_0x1c92d0[_0x618a('0x1d')]=_0x2a8a22[_0x618a('0x2f')]()===_0x618a('0x38')?_0x196fec[_0x618a('0x57')]:_0x196fec[_0x618a('0x58')];_0x1c92d0[_0x618a('0x59')]=_0x2a8a22==='queue'||_0x2a8a22==='unmanaged'?_0x618a('0x5a'):_0x618a('0x38');var _0x5d8443=util[_0x618a('0x53')](_0x618a('0x5b'),_0x50c354[_0x618a('0x52')],_0x196fec[_0x618a('0x5c')],md5(_0x196fec[_0x618a('0x5c')]));if(_0x3e92c0&&_0x3e92c0['monitor_format']){logger[_0x618a('0x11')]('[QUEUE]',_0x618a('0x5d'));_0x196fec[_0x618a('0x5e')]=_0x5d8443;}else if(_0x33473e&&_0x33473e[_0x618a('0x5f')]&&_0x33473e[_0x618a('0x5f')]!=='none'){logger[_0x618a('0x11')](_0x618a('0x60'),'Recording\x20is\x20enabled!');_0x196fec[_0x618a('0x5e')]=_0x5d8443;}else{_0x196fec[_0x618a('0x5e')]='';}return getAdminUser(_0x2a8a22,_0x7ae920,_0x1c92d0,_0x5dd5a6,_0x25f2ac,_0x4c68d8)[_0x618a('0x20')](getUser(_0x2a8a22,_0x7ae920,_0x5dd5a6,_0x25f2ac,_0x4c68d8))[_0x618a('0x20')](getEndUser(_0x2a8a22,_0x7ae920,_0x5dd5a6,_0x25f2ac,_0x4c68d8))[_0x618a('0x20')](getTicket(_0x2a8a22,_0x7ae920,_0x5dd5a6,_0x59294a,_0x196fec,_0x25f2ac))[_0x618a('0x20')](function(_0x546af5){logger[_0x618a('0x11')](util[_0x618a('0x53')](_0x618a('0x61'),_0x546af5[_0x618a('0x62')]));logger[_0x618a('0x11')](util['format'](_0x618a('0x63'),_0x2a8a22));if(_0x2a8a22!==_0x618a('0x64')){logger['info']('['+[_0x2a8a22[_0x618a('0xd')]()]+']',_0x618a('0x65'));emit(_0x50c354[_0x618a('0x50')],_0x3e60fc[_0x618a('0x37')],_0x546af5['ticketId']);}})[_0x618a('0xf')](function(_0x2d0d41){logger[_0x618a('0x23')]('['+[_0x2a8a22[_0x618a('0xd')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x618a('0x66')](_0x2d0d41,{'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 fce0b73..a0c5a8a 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 _0x821d=['format','Basic\x20%s','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','get_entry_list','Contacts','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','The\x20Ticket\x20ID\x20is:','version','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','users','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','trigger:browser:url','monitor_format','lastevent','isNil','contacts','lodash','request-promise','bluebird','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_minutes','parent_id','parent_type','parent_name','direction','forEach','variableName','push','set_entry','JSON','stringify','Calls'];(function(_0x5efa8b,_0x5950cf){var _0x563412=function(_0x256953){while(--_0x256953){_0x5efa8b['push'](_0x5efa8b['shift']());}};_0x563412(++_0x5950cf);}(_0x821d,0x14f));var _0xd821=function(_0x152496,_0x4ecfc9){_0x152496=_0x152496-0x0;var _0x30c567=_0x821d[_0x152496];return _0x30c567;};'use strict';var _=require(_0xd821('0x0'));var rp=require(_0xd821('0x1'));var BPromise=require(_0xd821('0x2'));var md5=require('md5');var util=require(_0xd821('0x3'));var Redis=require(_0xd821('0x4'));var intUtil=require('./util');var config=require(_0xd821('0x5'));var logger=require(_0xd821('0x6'))(_0xd821('0x7'));config[_0xd821('0x8')]=_[_0xd821('0x9')](config[_0xd821('0x8')],{'host':_0xd821('0xa'),'port':0x18eb});var io=require(_0xd821('0xb'))(new Redis(config[_0xd821('0x8')]));var def={'method':_0xd821('0xc'),'json':!![]};function emit(_0x1a096c,_0x15fadb,_0x47fade){io['to'](_0x1a096c)[_0xd821('0xd')](_0x15fadb,_0x47fade);}function getTicket(_0x210bcf,_0x2e7d7e,_0x456b8a,_0x433be3,_0x4cb09c,_0x46b52a,_0x3f765d,_0x2c16c4){logger[_0xd821('0xe')]('Creating\x20new\x20ticket...');var _0x12c303=new Date();var _0x26f663=[{'name':_0xd821('0xf'),'value':intUtil[_0xd821('0x10')](_0x433be3[_0xd821('0x11')],_0x4cb09c,'\x20')},{'name':_0xd821('0x12'),'value':_0x2e7d7e['id']},{'name':_0xd821('0x13'),'value':_0x2e7d7e['id']},{'name':_0xd821('0x14'),'value':intUtil[_0xd821('0x10')](_0x433be3[_0xd821('0x15')],_0x4cb09c,'\x0a')},{'name':_0xd821('0x16'),'value':_0x12c303[_0xd821('0x17')]()['slice'](0x0,0x13)[_0xd821('0x18')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xd821('0x19'),'value':'15'},{'name':_0xd821('0x1a'),'value':_0x456b8a['id']},{'name':_0xd821('0x1b'),'value':'Contacts'},{'name':_0xd821('0x1c'),'value':_0x456b8a[_0xd821('0xf')]},{'name':_0xd821('0x1d'),'value':_0x2c16c4}];if(_0x46b52a['length']){_[_0xd821('0x1e')](_0x46b52a,function(_0x17c6e5){if(_0x4cb09c[_0x17c6e5[_0xd821('0x1f')]]){_0x26f663[_0xd821('0x20')]({'name':_0x17c6e5['idField'],'value':_0x4cb09c[_0x17c6e5['variableName']]});}});}return request({'form':{'method':_0xd821('0x21'),'input_type':_0xd821('0x22'),'response_type':_0xd821('0x22'),'rest_data':JSON[_0xd821('0x23')]({'session':_0x3f765d['id'],'module_name':_0xd821('0x24'),'name_value_list':_0x26f663})}});}function getAuth(_0x34e163){return util[_0xd821('0x25')](_0xd821('0x26'),new Buffer(_0x34e163['apiKey']+':X')[_0xd821('0x27')](_0xd821('0x28')));}function getServerInfo(_0x598e46){return request({'form':{'method':_0xd821('0x29'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xd821('0x23')]({'session':_0x598e46['id']})}});}function getUser(_0x2838ac,_0x3a88f1,_0x3382ef){if(!_['isNil'](_0x3a88f1)){logger[_0xd821('0xe')](_0xd821('0x2a'),_0x3a88f1);return request({'form':{'method':'get_entry_list','input_type':_0xd821('0x22'),'response_type':'JSON','rest_data':JSON[_0xd821('0x23')]({'session':_0x3382ef['id'],'module_name':_0xd821('0x2b'),'query':util[_0xd821('0x25')](_0xd821('0x2c'),_0x3a88f1),'order_by':'','offset':'0','select_fields':['id',_0xd821('0xf'),_0xd821('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd821('0x2e')](function(_0x45d4aa){if(_0x45d4aa[_0xd821('0x2f')][_0xd821('0x30')]){var _0x2ffcfb=_[_0xd821('0x31')](_0x45d4aa[_0xd821('0x2f')],function(_0x1c3842){return _0x1c3842[_0xd821('0x32')]['user_name'][_0xd821('0x33')]===_0x3a88f1;});if(_0x2ffcfb){logger[_0xd821('0xe')]('Agent\x20found!');return BPromise[_0xd821('0x34')]({'id':_0x2ffcfb[_0xd821('0x32')]['id'][_0xd821('0x33')],'name':_0x2ffcfb[_0xd821('0x32')][_0xd821('0xf')][_0xd821('0x33')]});}}logger[_0xd821('0xe')](_0xd821('0x35'));return BPromise[_0xd821('0x34')]({'id':_0x3382ef[_0xd821('0x32')][_0xd821('0x36')]['value'],'name':_0x3382ef[_0xd821('0x32')][_0xd821('0x2d')][_0xd821('0x33')]});});}else{logger[_0xd821('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xd821('0x34')]({'id':_0x3382ef['name_value_list'][_0xd821('0x36')][_0xd821('0x33')],'name':_0x3382ef['name_value_list'][_0xd821('0x2d')][_0xd821('0x33')]});}}function getEndUser(_0x51a732,_0x2ddafa,_0x151f0b,_0x3daf42){logger['info']('Searching\x20enduser\x20with\x20phone',_0x151f0b);return request({'form':{'method':_0xd821('0x37'),'input_type':_0xd821('0x22'),'response_type':'JSON','rest_data':JSON[_0xd821('0x23')]({'session':_0x3daf42['id'],'module_name':_0xd821('0x38'),'query':util[_0xd821('0x25')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x151f0b),'order_by':'','offset':'0','select_fields':['id',_0xd821('0xf'),_0xd821('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd821('0x2e')](function(_0x34989f){if(_0x34989f['entry_list'][_0xd821('0x30')]){var _0x153610=_[_0xd821('0x31')](_0x34989f['entry_list'],function(_0x532c19){return _0x532c19[_0xd821('0x32')][_0xd821('0x39')][_0xd821('0x33')]===_0x151f0b;});if(_0x153610){logger[_0xd821('0xe')](_0xd821('0x3a'));return BPromise[_0xd821('0x34')]({'id':_0x153610[_0xd821('0x32')]['id'][_0xd821('0x33')],'name':_0x153610['name_value_list'][_0xd821('0xf')][_0xd821('0x33')],'phone':_0x153610[_0xd821('0x32')][_0xd821('0x39')]['value']});}}else{logger['info'](_0xd821('0x3b'));return request({'form':{'method':_0xd821('0x21'),'input_type':'JSON','response_type':_0xd821('0x22'),'rest_data':JSON[_0xd821('0x23')]({'session':_0x3daf42['id'],'module_name':_0xd821('0x38'),'name_value_list':[{'name':_0xd821('0x3c'),'value':_0x2ddafa!==_0xd821('0x3d')?_0x2ddafa:util['format'](_0xd821('0x3e'),_0x151f0b)},{'name':_0xd821('0x39'),'value':_0x151f0b}]})}})[_0xd821('0x2e')](function(_0x1fc23d){logger[_0xd821('0xe')](_0xd821('0x3f'));return BPromise[_0xd821('0x34')]({'id':_0x1fc23d['id'],'name':_0x1fc23d['entry_list'][_0xd821('0x3c')]['value'],'phone':_0x1fc23d[_0xd821('0x2f')][_0xd821('0x39')][_0xd821('0x33')]});});}});}function request(_0x3ac942){logger[_0xd821('0x40')](_0xd821('0x41'),JSON[_0xd821('0x23')](_0x3ac942));return rp(_[_0xd821('0x42')](def,_0x3ac942));}function getTags(_0x5960d5,_0x4f76ae){var _0x441791=[];if(_0x5960d5&&_0x5960d5[_0xd821('0x30')]>0x0){_0x441791=_[_0xd821('0x43')](_0x5960d5,_0x4f76ae);}return _0x441791;}function getCustomFields(_0x2cc486,_0x416802){var _0x1b1441=[];var _0x58073f={'custom_fields':[]};if(_0x2cc486[_0xd821('0x30')]>0x0){_['forEach'](_0x2cc486,function(_0x23c16d){if(_0x23c16d[_0xd821('0x44')]===_0xd821('0x45')&&_0x23c16d[_0xd821('0x46')]&&!_0x23c16d[_0xd821('0x47')]){_0x58073f[_0x23c16d[_0xd821('0x46')][_0xd821('0x48')]()]=_0x23c16d[_0xd821('0x49')]['toString']();}else if(_0x23c16d[_0xd821('0x44')]===_0xd821('0x45')&&_0x23c16d[_0xd821('0x4a')]&&_0x23c16d[_0xd821('0x47')]){_0x58073f[_0xd821('0x4b')][_0xd821('0x20')]({'id':_0x23c16d[_0xd821('0x4a')],'value':_0x23c16d[_0xd821('0x49')]['toString']()});}else if(_0x23c16d[_0xd821('0x44')]===_0xd821('0x4c')&&_0x23c16d['variableName']&&_0x23c16d[_0xd821('0x4a')]&&_0x23c16d['customField']){_0x416802[_0x23c16d['variableName']]&&_0x58073f[_0xd821('0x4b')][_0xd821('0x20')]({'id':_0x23c16d['idField'],'value':_0x416802[_0x23c16d[_0xd821('0x1f')]][_0xd821('0x27')]()});}else if(_0x23c16d[_0xd821('0x44')]===_0xd821('0x4d')&&_0x23c16d[_0xd821('0x4e')]&&_0x23c16d['Variable']['name']&&_0x23c16d[_0xd821('0x4a')]&&_0x23c16d[_0xd821('0x47')]){_0x416802[_0x23c16d['Variable']['name']['toLowerCase']()]&&_0x58073f[_0xd821('0x4b')][_0xd821('0x20')]({'id':_0x23c16d[_0xd821('0x4a')],'value':_0x416802[_0x23c16d[_0xd821('0x4e')]['name'][_0xd821('0x48')]()][_0xd821('0x27')]()});}});}return _0x58073f;}function getConnection(_0x3e268f){return request({'method':_0xd821('0xc'),'form':{'method':_0xd821('0x4f'),'input_type':_0xd821('0x22'),'response_type':_0xd821('0x22'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3e268f[_0xd821('0x50')],'password':_0x3e268f[_0xd821('0x51')],'encryption':_0xd821('0x52')},'application':_0xd821('0x53')})}})[_0xd821('0x2e')](function(_0x26e070){var _0x3adc56=_0x26e070;if(_0x3adc56['id']){def[_0xd821('0x54')]=_0x3adc56['id'];return BPromise[_0xd821('0x34')](_0x3adc56);}else{throw new Error(util['format'](_0xd821('0x55'),_0x3e268f['id']));}});}function setRelationship(_0x3da7de,_0x419add,_0x2ce81c,_0x23af7d){return request({'form':{'method':'set_relationship','input_type':_0xd821('0x22'),'response_type':_0xd821('0x22'),'rest_data':JSON['stringify']({'session':_0x3da7de['id'],'module_name':_0xd821('0x24'),'module_id':_0x2ce81c['id'],'link_field_name':_0x23af7d,'related_ids':[_0x419add['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xd821('0x56')]=function(_0xbebf80,_0x2ed202,_0xd9a701,_0x1ee065,_0x5a40d1,_0x47dafa){var _0x3b0272,_0x41b12a,_0x664c9f,_0x7151e0;_0x47dafa[_0xd821('0x57')]=intUtil[_0xd821('0x58')](_0x47dafa[_0xd821('0x57')]);_0x47dafa[_0xd821('0x59')]=intUtil['stripTrailingSlash'](_0x47dafa[_0xd821('0x59')]);def[_0xd821('0x5a')]=util[_0xd821('0x25')](_0xd821('0x5b'),_0x47dafa[_0xd821('0x57')]);if(_0x5a40d1&&_0x5a40d1['monitor_format']){logger[_0xd821('0xe')](_0xd821('0x5c'),_0xd821('0x5d'));_0x2ed202['recordingURL']=util[_0xd821('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x47dafa[_0xd821('0x59')],_0x2ed202[_0xd821('0x5e')],md5(_0x2ed202['uniqueid']));}else{_0x2ed202[_0xd821('0x5f')]='';}return getConnection(_0x47dafa)[_0xd821('0x2e')](function(_0x77ac5a){_0x7151e0=_0x77ac5a;return getUser(_0x47dafa,_0x1ee065[_0xd821('0xf')],_0x7151e0);})['then'](function(_0x126f49){_0x3b0272=_0x126f49;logger[_0xd821('0xe')](_0xd821('0x60'),_0x3b0272['id']);return getEndUser(_0x47dafa,_0x2ed202[_0xd821('0x61')],_0x2ed202[_0xd821('0x62')],_0x7151e0);})[_0xd821('0x2e')](function(_0x375bf7){_0x41b12a=_0x375bf7;logger['info']('The\x20Enduser\x20ID\x20is:',_0x41b12a['id']);return getTicket(_0x47dafa,_0x3b0272,_0x41b12a,_0xd9a701,_0x2ed202,_0xd9a701[_0xd821('0x63')],_0x7151e0,_0xd821('0x64'));})['then'](function(_0xf76e56){_0x664c9f=_0xf76e56;logger['info']('Ticket\x20created!');logger[_0xd821('0xe')](_0xd821('0x65'),_0x664c9f['id']);return setRelationship(_0x7151e0,_0x3b0272,_0x664c9f,'users');})[_0xd821('0x2e')](function(){return setRelationship(_0x7151e0,_0x41b12a,_0x664c9f,'contacts');})[_0xd821('0x2e')](function(){return getServerInfo(_0x7151e0);})['then'](function(_0x319825){var _0x520032=parseInt(_0x319825[_0xd821('0x66')][_0xd821('0x67')](0x0));var _0x17b89f=util[_0xd821('0x25')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x47dafa['remoteUri'],_0x664c9f['id']);if(_0x520032>0x6){_0x17b89f=util[_0xd821('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x47dafa[_0xd821('0x57')],_0x664c9f['id']);}logger['info'](_0xd821('0x5c'),_0xd821('0x68'));emit(util[_0xd821('0x25')](_0xd821('0x69'),_0x1ee065[_0xd821('0xf')]),'trigger:browser:url',{'uri':_0x17b89f});})[_0xd821('0x6a')](function(_0x48c9a7){logger[_0xd821('0x6b')](_0xd821('0x5c'),JSON[_0xd821('0x23')](_0x48c9a7));});};exports[_0xd821('0x6c')]=function(_0x2b8dc7,_0x59110f,_0x54e558,_0x74373,_0x299c01,_0x3d6691,_0x5ac535){var _0x5623ee,_0xf2e62d,_0x51df94,_0x2a86e5;_0x3d6691[_0xd821('0x57')]=intUtil[_0xd821('0x58')](_0x3d6691[_0xd821('0x57')]);_0x3d6691[_0xd821('0x59')]=intUtil['stripTrailingSlash'](_0x3d6691['serverUrl']);def[_0xd821('0x5a')]=util['format']('%s/service/v4_1/rest.php',_0x3d6691[_0xd821('0x57')]);if(_0x5ac535&&_0x5ac535[_0xd821('0x6d')]&&_0x5ac535[_0xd821('0x6d')]!==_0xd821('0x6e')){logger[_0xd821('0xe')](_0xd821('0x6f'),_0xd821('0x5d'));_0x59110f['recordingURL']=util[_0xd821('0x25')](_0xd821('0x70'),_0x3d6691[_0xd821('0x59')],_0x59110f[_0xd821('0x5e')],md5(_0x59110f[_0xd821('0x5e')]));}return getConnection(_0x3d6691)[_0xd821('0x2e')](function(_0x550bed){_0x2a86e5=_0x550bed;return getUser(_0x3d6691,_0x74373[_0xd821('0xf')],_0x2a86e5);})[_0xd821('0x2e')](function(_0x55be89){_0x5623ee=_0x55be89;logger[_0xd821('0xe')](_0xd821('0x60'),_0x5623ee['id']);return getEndUser(_0x3d6691,_0x59110f[_0xd821('0x71')],_0x59110f[_0xd821('0x72')],_0x2a86e5);})['then'](function(_0x107fbd){_0xf2e62d=_0x107fbd;logger[_0xd821('0xe')](_0xd821('0x73'),_0xf2e62d['id']);return getTicket(_0x3d6691,_0x5623ee,_0xf2e62d,_0x54e558,_0x59110f,_0x54e558[_0xd821('0x63')],_0x2a86e5,'Outbound');})[_0xd821('0x2e')](function(_0x521dff){_0x51df94=_0x521dff;logger['info'](_0xd821('0x74'));logger[_0xd821('0xe')](_0xd821('0x65'),_0x51df94['id']);return setRelationship(_0x2a86e5,_0x5623ee,_0x51df94,_0xd821('0x75'));})[_0xd821('0x2e')](function(){return setRelationship(_0x2a86e5,_0xf2e62d,_0x51df94,'contacts');})['then'](function(){return getServerInfo(_0x2a86e5);})[_0xd821('0x2e')](function(_0x3b2a45){var _0x2a0f97=parseInt(_0x3b2a45[_0xd821('0x66')]['charAt'](0x0));var _0x3c7a86=util[_0xd821('0x25')](_0xd821('0x76'),_0x3d6691[_0xd821('0x57')],_0x51df94['id']);if(_0x2a0f97>0x6){_0x3c7a86=util[_0xd821('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3d6691[_0xd821('0x57')],_0x51df94['id']);}logger['info'](_0xd821('0x6f'),_0xd821('0x68'));emit(util[_0xd821('0x25')](_0xd821('0x69'),_0x74373[_0xd821('0xf')]),_0xd821('0x77'),{'uri':_0x3c7a86});})['catch'](function(_0x12dfcb){logger[_0xd821('0x6b')](_0xd821('0x6f'),JSON[_0xd821('0x23')](_0x12dfcb));});};exports['unmanaged']=function(_0x4123de,_0x1a8d55,_0x53c7ae,_0x41ca28,_0x584039,_0x41a50f){var _0x5c3647,_0x50fcd,_0x3560c0,_0x4a32a1;_0x41a50f['remoteUri']=intUtil[_0xd821('0x58')](_0x41a50f[_0xd821('0x57')]);_0x41a50f[_0xd821('0x59')]=intUtil['stripTrailingSlash'](_0x41a50f['serverUrl']);def['uri']=util[_0xd821('0x25')](_0xd821('0x5b'),_0x41a50f[_0xd821('0x57')]);if(_0x584039&&_0x584039[_0xd821('0x78')]){logger[_0xd821('0xe')]('['+_0x1a8d55[_0xd821('0x79')]['toUpperCase']()+']',_0xd821('0x5d'));_0x1a8d55[_0xd821('0x5f')]=util[_0xd821('0x25')](_0xd821('0x70'),_0x41a50f[_0xd821('0x59')],_0x1a8d55['uniqueid'],md5(_0x1a8d55[_0xd821('0x5e')]));}else{_0x1a8d55[_0xd821('0x5f')]='';}return getConnection(_0x41a50f)['then'](function(_0x1097ac){_0x4a32a1=_0x1097ac;if(!_[_0xd821('0x7a')](_0x41ca28)){return getUser(_0x41a50f,_0x41ca28[_0xd821('0xf')],_0x4a32a1);}else{return getUser(_0x41a50f,null,_0x4a32a1);}})[_0xd821('0x2e')](function(_0x4ca2f3){_0x5c3647=_0x4ca2f3;logger['info'](_0xd821('0x60'),_0x5c3647['id']);return getEndUser(_0x41a50f,_0x1a8d55['calleridname'],_0x1a8d55[_0xd821('0x62')],_0x4a32a1);})[_0xd821('0x2e')](function(_0x3802bf){_0x50fcd=_0x3802bf;logger[_0xd821('0xe')](_0xd821('0x73'),_0x50fcd['id']);return getTicket(_0x41a50f,_0x5c3647,_0x50fcd,_0x53c7ae,_0x1a8d55,_0x53c7ae[_0xd821('0x63')],_0x4a32a1,_0xd821('0x64'));})[_0xd821('0x2e')](function(_0x1841bb){_0x3560c0=_0x1841bb;logger[_0xd821('0xe')](_0xd821('0x74'));logger['info'](_0xd821('0x65'),_0x3560c0['id']);return setRelationship(_0x4a32a1,_0x5c3647,_0x3560c0,_0xd821('0x75'));})[_0xd821('0x2e')](function(){return setRelationship(_0x4a32a1,_0x50fcd,_0x3560c0,_0xd821('0x7b'));})['then'](function(){return getServerInfo(_0x4a32a1);})['catch'](function(_0x36752a){logger[_0xd821('0x6b')]('['+_0x1a8d55['lastevent']['toUpperCase']()+']',JSON[_0xd821('0x23')](_0x36752a));});}; \ No newline at end of file +var _0x2d37=['getString','Subjects','created_by','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','set_entry','JSON','format','Basic\x20%s','toString','base64','get_server_info','stringify','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','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','idField','variableName','Variable','POST','login','username','password','set_relationship','Calls','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','isNil','lodash','md5','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name'];(function(_0x4cf8bb,_0x12c8fe){var _0x555be3=function(_0x31c2e8){while(--_0x31c2e8){_0x4cf8bb['push'](_0x4cf8bb['shift']());}};_0x555be3(++_0x12c8fe);}(_0x2d37,0xe0));var _0x72d3=function(_0x39b552,_0x2949ea){_0x39b552=_0x39b552-0x0;var _0x35d4d1=_0x2d37[_0x39b552];return _0x35d4d1;};'use strict';var _=require(_0x72d3('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x72d3('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x72d3('0x2'));var config=require(_0x72d3('0x3'));var logger=require(_0x72d3('0x4'))('sugarcrm');config[_0x72d3('0x5')]=_['defaults'](config[_0x72d3('0x5')],{'host':_0x72d3('0x6'),'port':0x18eb});var io=require(_0x72d3('0x7'))(new Redis(config[_0x72d3('0x5')]));var def={'method':'POST','json':!![]};function emit(_0x17e907,_0x72dba8,_0x3f3503){io['to'](_0x17e907)[_0x72d3('0x8')](_0x72dba8,_0x3f3503);}function getTicket(_0x5da36a,_0x5b511a,_0x3f9a85,_0xf7710c,_0x333b2e,_0x36fd57,_0x3f8701,_0x1f5d65){logger[_0x72d3('0x9')](_0x72d3('0xa'));var _0x36bc1=new Date();var _0x1e770b=[{'name':_0x72d3('0xb'),'value':intUtil[_0x72d3('0xc')](_0xf7710c[_0x72d3('0xd')],_0x333b2e,'\x20')},{'name':'assigned_user_id','value':_0x5b511a['id']},{'name':_0x72d3('0xe'),'value':_0x5b511a['id']},{'name':'description','value':intUtil[_0x72d3('0xc')](_0xf7710c[_0x72d3('0xf')],_0x333b2e,'\x0a')},{'name':_0x72d3('0x10'),'value':_0x36bc1['toISOString']()[_0x72d3('0x11')](0x0,0x13)[_0x72d3('0x12')]('T','\x20')},{'name':_0x72d3('0x13'),'value':'0'},{'name':_0x72d3('0x14'),'value':'15'},{'name':_0x72d3('0x15'),'value':_0x3f9a85['id']},{'name':_0x72d3('0x16'),'value':_0x72d3('0x17')},{'name':_0x72d3('0x18'),'value':_0x3f9a85[_0x72d3('0xb')]},{'name':_0x72d3('0x19'),'value':_0x1f5d65}];if(_0x36fd57[_0x72d3('0x1a')]){_[_0x72d3('0x1b')](_0x36fd57,function(_0x28af10){if(_0x333b2e[_0x28af10['variableName']]){_0x1e770b[_0x72d3('0x1c')]({'name':_0x28af10['idField'],'value':_0x333b2e[_0x28af10['variableName']]});}});}return request({'form':{'method':_0x72d3('0x1d'),'input_type':'JSON','response_type':_0x72d3('0x1e'),'rest_data':JSON['stringify']({'session':_0x3f8701['id'],'module_name':'Calls','name_value_list':_0x1e770b})}});}function getAuth(_0x40e399){return util[_0x72d3('0x1f')](_0x72d3('0x20'),new Buffer(_0x40e399['apiKey']+':X')[_0x72d3('0x21')](_0x72d3('0x22')));}function getServerInfo(_0x45fd45){return request({'form':{'method':_0x72d3('0x23'),'input_type':'JSON','response_type':_0x72d3('0x1e'),'rest_data':JSON[_0x72d3('0x24')]({'session':_0x45fd45['id']})}});}function getUser(_0x4e9406,_0x391998,_0x30295e){if(!_['isNil'](_0x391998)){logger['info'](_0x72d3('0x25'),_0x391998);return request({'form':{'method':_0x72d3('0x26'),'input_type':_0x72d3('0x1e'),'response_type':_0x72d3('0x1e'),'rest_data':JSON['stringify']({'session':_0x30295e['id'],'module_name':_0x72d3('0x27'),'query':util['format'](_0x72d3('0x28'),_0x391998),'order_by':'','offset':'0','select_fields':['id','name',_0x72d3('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x72d3('0x2a')](function(_0xaafe53){if(_0xaafe53[_0x72d3('0x2b')][_0x72d3('0x1a')]){var _0x33fc64=_[_0x72d3('0x2c')](_0xaafe53[_0x72d3('0x2b')],function(_0x3be408){return _0x3be408[_0x72d3('0x2d')][_0x72d3('0x29')]['value']===_0x391998;});if(_0x33fc64){logger[_0x72d3('0x9')](_0x72d3('0x2e'));return BPromise[_0x72d3('0x2f')]({'id':_0x33fc64[_0x72d3('0x2d')]['id'][_0x72d3('0x30')],'name':_0x33fc64[_0x72d3('0x2d')][_0x72d3('0xb')][_0x72d3('0x30')]});}}logger[_0x72d3('0x9')](_0x72d3('0x31'));return BPromise[_0x72d3('0x2f')]({'id':_0x30295e[_0x72d3('0x2d')]['user_id']['value'],'name':_0x30295e['name_value_list'][_0x72d3('0x29')]['value']});});}else{logger[_0x72d3('0x9')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x30295e[_0x72d3('0x2d')][_0x72d3('0x32')][_0x72d3('0x30')],'name':_0x30295e[_0x72d3('0x2d')][_0x72d3('0x29')][_0x72d3('0x30')]});}}function getEndUser(_0x48d306,_0x935a7d,_0x6ba79d,_0x1beddc){logger[_0x72d3('0x9')](_0x72d3('0x33'),_0x6ba79d);return request({'form':{'method':_0x72d3('0x26'),'input_type':'JSON','response_type':_0x72d3('0x1e'),'rest_data':JSON['stringify']({'session':_0x1beddc['id'],'module_name':'Contacts','query':util['format'](_0x72d3('0x34'),_0x6ba79d),'order_by':'','offset':'0','select_fields':['id','name',_0x72d3('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x865ce){if(_0x865ce[_0x72d3('0x2b')][_0x72d3('0x1a')]){var _0x575e4c=_[_0x72d3('0x2c')](_0x865ce[_0x72d3('0x2b')],function(_0xd67a08){return _0xd67a08[_0x72d3('0x2d')][_0x72d3('0x35')][_0x72d3('0x30')]===_0x6ba79d;});if(_0x575e4c){logger[_0x72d3('0x9')](_0x72d3('0x36'));return BPromise[_0x72d3('0x2f')]({'id':_0x575e4c['name_value_list']['id'][_0x72d3('0x30')],'name':_0x575e4c[_0x72d3('0x2d')][_0x72d3('0xb')]['value'],'phone':_0x575e4c[_0x72d3('0x2d')][_0x72d3('0x35')][_0x72d3('0x30')]});}}else{logger[_0x72d3('0x9')](_0x72d3('0x37'));return request({'form':{'method':_0x72d3('0x1d'),'input_type':_0x72d3('0x1e'),'response_type':'JSON','rest_data':JSON[_0x72d3('0x24')]({'session':_0x1beddc['id'],'module_name':_0x72d3('0x17'),'name_value_list':[{'name':_0x72d3('0x38'),'value':_0x935a7d!==_0x72d3('0x39')?_0x935a7d:util['format'](_0x72d3('0x3a'),_0x6ba79d)},{'name':_0x72d3('0x35'),'value':_0x6ba79d}]})}})[_0x72d3('0x2a')](function(_0xe2cc52){logger[_0x72d3('0x9')](_0x72d3('0x3b'));return BPromise[_0x72d3('0x2f')]({'id':_0xe2cc52['id'],'name':_0xe2cc52[_0x72d3('0x2b')]['first_name'][_0x72d3('0x30')],'phone':_0xe2cc52['entry_list'][_0x72d3('0x35')][_0x72d3('0x30')]});});}});}function request(_0x47905f){logger[_0x72d3('0x3c')](_0x72d3('0x3d'),JSON[_0x72d3('0x24')](_0x47905f));return rp(_[_0x72d3('0x3e')](def,_0x47905f));}function getTags(_0x10874c,_0x14be40){var _0x4f766e=[];if(_0x10874c&&_0x10874c['length']>0x0){_0x4f766e=_[_0x72d3('0x3f')](_0x10874c,_0x14be40);}return _0x4f766e;}function getCustomFields(_0xf1b214,_0x27be34){var _0x5bde4a=[];var _0x4442b9={'custom_fields':[]};if(_0xf1b214[_0x72d3('0x1a')]>0x0){_[_0x72d3('0x1b')](_0xf1b214,function(_0x41d5aa){if(_0x41d5aa[_0x72d3('0x40')]===_0x72d3('0x41')&&_0x41d5aa[_0x72d3('0x42')]&&!_0x41d5aa[_0x72d3('0x43')]){_0x4442b9[_0x41d5aa[_0x72d3('0x42')][_0x72d3('0x44')]()]=_0x41d5aa[_0x72d3('0x45')][_0x72d3('0x21')]();}else if(_0x41d5aa['type']==='string'&&_0x41d5aa[_0x72d3('0x46')]&&_0x41d5aa[_0x72d3('0x43')]){_0x4442b9['custom_fields']['push']({'id':_0x41d5aa['idField'],'value':_0x41d5aa[_0x72d3('0x45')][_0x72d3('0x21')]()});}else if(_0x41d5aa['type']==='variable'&&_0x41d5aa['variableName']&&_0x41d5aa[_0x72d3('0x46')]&&_0x41d5aa['customField']){_0x27be34[_0x41d5aa[_0x72d3('0x47')]]&&_0x4442b9['custom_fields']['push']({'id':_0x41d5aa[_0x72d3('0x46')],'value':_0x27be34[_0x41d5aa['variableName']][_0x72d3('0x21')]()});}else if(_0x41d5aa[_0x72d3('0x40')]==='customVariable'&&_0x41d5aa['Variable']&&_0x41d5aa[_0x72d3('0x48')][_0x72d3('0xb')]&&_0x41d5aa[_0x72d3('0x46')]&&_0x41d5aa[_0x72d3('0x43')]){_0x27be34[_0x41d5aa[_0x72d3('0x48')][_0x72d3('0xb')][_0x72d3('0x44')]()]&&_0x4442b9['custom_fields'][_0x72d3('0x1c')]({'id':_0x41d5aa[_0x72d3('0x46')],'value':_0x27be34[_0x41d5aa[_0x72d3('0x48')]['name'][_0x72d3('0x44')]()][_0x72d3('0x21')]()});}});}return _0x4442b9;}function getConnection(_0x168f3a){return request({'method':_0x72d3('0x49'),'form':{'method':_0x72d3('0x4a'),'input_type':_0x72d3('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x168f3a[_0x72d3('0x4b')],'password':_0x168f3a[_0x72d3('0x4c')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x72d3('0x2a')](function(_0x32810a){var _0x523fc4=_0x32810a;if(_0x523fc4['id']){def['sessionID']=_0x523fc4['id'];return BPromise[_0x72d3('0x2f')](_0x523fc4);}else{throw new Error(util[_0x72d3('0x1f')]('Account\x20%d\x20is\x20not\x20valid',_0x168f3a['id']));}});}function setRelationship(_0x5cae47,_0x40de4e,_0x2061f1,_0x973243){return request({'form':{'method':_0x72d3('0x4d'),'input_type':_0x72d3('0x1e'),'response_type':_0x72d3('0x1e'),'rest_data':JSON[_0x72d3('0x24')]({'session':_0x5cae47['id'],'module_name':_0x72d3('0x4e'),'module_id':_0x2061f1['id'],'link_field_name':_0x973243,'related_ids':[_0x40de4e['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x72d3('0x4f')]=function(_0x3b6a19,_0x119c74,_0x112633,_0x38ca23,_0x206b66,_0x1950a5){var _0x54f3b5,_0x5e2f23,_0x48cf67,_0x448c24;_0x1950a5['remoteUri']=intUtil[_0x72d3('0x50')](_0x1950a5[_0x72d3('0x51')]);_0x1950a5[_0x72d3('0x52')]=intUtil[_0x72d3('0x50')](_0x1950a5[_0x72d3('0x52')]);def[_0x72d3('0x53')]=util['format'](_0x72d3('0x54'),_0x1950a5[_0x72d3('0x51')]);if(_0x206b66&&_0x206b66[_0x72d3('0x55')]){logger['info'](_0x72d3('0x56'),_0x72d3('0x57'));_0x119c74[_0x72d3('0x58')]=util[_0x72d3('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1950a5[_0x72d3('0x52')],_0x119c74[_0x72d3('0x59')],md5(_0x119c74[_0x72d3('0x59')]));}else{_0x119c74[_0x72d3('0x58')]='';}return getConnection(_0x1950a5)[_0x72d3('0x2a')](function(_0x60cd04){_0x448c24=_0x60cd04;return getUser(_0x1950a5,_0x38ca23[_0x72d3('0xb')],_0x448c24);})[_0x72d3('0x2a')](function(_0x29da50){_0x54f3b5=_0x29da50;logger['info'](_0x72d3('0x5a'),_0x54f3b5['id']);return getEndUser(_0x1950a5,_0x119c74[_0x72d3('0x5b')],_0x119c74[_0x72d3('0x5c')],_0x448c24);})[_0x72d3('0x2a')](function(_0x4c9657){_0x5e2f23=_0x4c9657;logger[_0x72d3('0x9')](_0x72d3('0x5d'),_0x5e2f23['id']);return getTicket(_0x1950a5,_0x54f3b5,_0x5e2f23,_0x112633,_0x119c74,_0x112633[_0x72d3('0x5e')],_0x448c24,_0x72d3('0x5f'));})[_0x72d3('0x2a')](function(_0xd25de5){_0x48cf67=_0xd25de5;logger[_0x72d3('0x9')](_0x72d3('0x60'));logger[_0x72d3('0x9')](_0x72d3('0x61'),_0x48cf67['id']);return setRelationship(_0x448c24,_0x54f3b5,_0x48cf67,_0x72d3('0x62'));})['then'](function(){return setRelationship(_0x448c24,_0x5e2f23,_0x48cf67,_0x72d3('0x63'));})[_0x72d3('0x2a')](function(){return getServerInfo(_0x448c24);})['then'](function(_0x577415){var _0x30d2b9=parseInt(_0x577415[_0x72d3('0x64')][_0x72d3('0x65')](0x0));var _0x4dba58=util[_0x72d3('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1950a5[_0x72d3('0x51')],_0x48cf67['id']);if(_0x30d2b9>0x6){_0x4dba58=util[_0x72d3('0x1f')](_0x72d3('0x66'),_0x1950a5[_0x72d3('0x51')],_0x48cf67['id']);}logger[_0x72d3('0x9')](_0x72d3('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x72d3('0x67'),_0x38ca23[_0x72d3('0xb')]),_0x72d3('0x68'),{'uri':_0x4dba58});})[_0x72d3('0x69')](function(_0x5041e6){logger[_0x72d3('0x6a')](_0x72d3('0x56'),JSON['stringify'](_0x5041e6));});};exports[_0x72d3('0x6b')]=function(_0x5ebd5e,_0x2a0fc0,_0xd9e252,_0x12cca8,_0x5243b2,_0x201980,_0x2cc9d0){var _0x56b27a,_0x40279d,_0x3c3d25,_0x1bda1c;_0x201980[_0x72d3('0x51')]=intUtil[_0x72d3('0x50')](_0x201980[_0x72d3('0x51')]);_0x201980[_0x72d3('0x52')]=intUtil[_0x72d3('0x50')](_0x201980['serverUrl']);def[_0x72d3('0x53')]=util[_0x72d3('0x1f')]('%s/service/v4_1/rest.php',_0x201980[_0x72d3('0x51')]);if(_0x2cc9d0&&_0x2cc9d0[_0x72d3('0x6c')]&&_0x2cc9d0['recordingFormat']!==_0x72d3('0x6d')){logger[_0x72d3('0x9')]('[OUTBOUND]',_0x72d3('0x57'));_0x2a0fc0[_0x72d3('0x58')]=util[_0x72d3('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x201980[_0x72d3('0x52')],_0x2a0fc0[_0x72d3('0x59')],md5(_0x2a0fc0[_0x72d3('0x59')]));}return getConnection(_0x201980)['then'](function(_0x119d61){_0x1bda1c=_0x119d61;return getUser(_0x201980,_0x12cca8[_0x72d3('0xb')],_0x1bda1c);})[_0x72d3('0x2a')](function(_0x359cfc){_0x56b27a=_0x359cfc;logger[_0x72d3('0x9')]('The\x20User\x20ID\x20is:',_0x56b27a['id']);return getEndUser(_0x201980,_0x2a0fc0['destcalleridname'],_0x2a0fc0[_0x72d3('0x6e')],_0x1bda1c);})[_0x72d3('0x2a')](function(_0x340875){_0x40279d=_0x340875;logger[_0x72d3('0x9')](_0x72d3('0x5d'),_0x40279d['id']);return getTicket(_0x201980,_0x56b27a,_0x40279d,_0xd9e252,_0x2a0fc0,_0xd9e252['Fields'],_0x1bda1c,_0x72d3('0x6f'));})[_0x72d3('0x2a')](function(_0x2f59b8){_0x3c3d25=_0x2f59b8;logger[_0x72d3('0x9')](_0x72d3('0x60'));logger[_0x72d3('0x9')](_0x72d3('0x61'),_0x3c3d25['id']);return setRelationship(_0x1bda1c,_0x56b27a,_0x3c3d25,_0x72d3('0x62'));})[_0x72d3('0x2a')](function(){return setRelationship(_0x1bda1c,_0x40279d,_0x3c3d25,_0x72d3('0x63'));})[_0x72d3('0x2a')](function(){return getServerInfo(_0x1bda1c);})[_0x72d3('0x2a')](function(_0x4d9056){var _0xa94e0b=parseInt(_0x4d9056[_0x72d3('0x64')][_0x72d3('0x65')](0x0));var _0x1ab9d4=util[_0x72d3('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x201980['remoteUri'],_0x3c3d25['id']);if(_0xa94e0b>0x6){_0x1ab9d4=util[_0x72d3('0x1f')](_0x72d3('0x66'),_0x201980[_0x72d3('0x51')],_0x3c3d25['id']);}logger[_0x72d3('0x9')](_0x72d3('0x70'),_0x72d3('0x71'));emit(util[_0x72d3('0x1f')](_0x72d3('0x67'),_0x12cca8[_0x72d3('0xb')]),_0x72d3('0x68'),{'uri':_0x1ab9d4});})['catch'](function(_0x46798a){logger['error'](_0x72d3('0x70'),JSON[_0x72d3('0x24')](_0x46798a));});};exports['unmanaged']=function(_0x2594fe,_0x39c665,_0x532f2a,_0x3427b2,_0x5a8f0d,_0x474d21){var _0x4e3c6c,_0xa80d57,_0x444559,_0x25ebcb;_0x474d21[_0x72d3('0x51')]=intUtil[_0x72d3('0x50')](_0x474d21[_0x72d3('0x51')]);_0x474d21['serverUrl']=intUtil['stripTrailingSlash'](_0x474d21['serverUrl']);def[_0x72d3('0x53')]=util[_0x72d3('0x1f')](_0x72d3('0x54'),_0x474d21[_0x72d3('0x51')]);if(_0x5a8f0d&&_0x5a8f0d[_0x72d3('0x55')]){logger[_0x72d3('0x9')]('['+_0x39c665[_0x72d3('0x72')][_0x72d3('0x73')]()+']',_0x72d3('0x57'));_0x39c665[_0x72d3('0x58')]=util[_0x72d3('0x1f')](_0x72d3('0x74'),_0x474d21['serverUrl'],_0x39c665[_0x72d3('0x59')],md5(_0x39c665['uniqueid']));}else{_0x39c665[_0x72d3('0x58')]='';}return getConnection(_0x474d21)[_0x72d3('0x2a')](function(_0x543730){_0x25ebcb=_0x543730;if(!_[_0x72d3('0x75')](_0x3427b2)){return getUser(_0x474d21,_0x3427b2[_0x72d3('0xb')],_0x25ebcb);}else{return getUser(_0x474d21,null,_0x25ebcb);}})['then'](function(_0x417ca0){_0x4e3c6c=_0x417ca0;logger[_0x72d3('0x9')]('The\x20User\x20ID\x20is:',_0x4e3c6c['id']);return getEndUser(_0x474d21,_0x39c665['calleridname'],_0x39c665[_0x72d3('0x5c')],_0x25ebcb);})[_0x72d3('0x2a')](function(_0x18aa03){_0xa80d57=_0x18aa03;logger[_0x72d3('0x9')](_0x72d3('0x5d'),_0xa80d57['id']);return getTicket(_0x474d21,_0x4e3c6c,_0xa80d57,_0x532f2a,_0x39c665,_0x532f2a['Fields'],_0x25ebcb,'Inbound');})[_0x72d3('0x2a')](function(_0x1ca762){_0x444559=_0x1ca762;logger[_0x72d3('0x9')](_0x72d3('0x60'));logger[_0x72d3('0x9')]('The\x20Ticket\x20ID\x20is:',_0x444559['id']);return setRelationship(_0x25ebcb,_0x4e3c6c,_0x444559,'users');})[_0x72d3('0x2a')](function(){return setRelationship(_0x25ebcb,_0xa80d57,_0x444559,_0x72d3('0x63'));})[_0x72d3('0x2a')](function(){return getServerInfo(_0x25ebcb);})[_0x72d3('0x69')](function(_0x15d097){logger[_0x72d3('0x6a')]('['+_0x39c665[_0x72d3('0x72')][_0x72d3('0x73')]()+']',JSON[_0x72d3('0x24')](_0x15d097));});}; \ 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 1840abd..4940189 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 _0x0d9d=['format','%s:\x20%s','keyContent','variable','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','length','type','string','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key'];(function(_0x10a5bd,_0x194959){var _0x5daeaf=function(_0x11579c){while(--_0x11579c){_0x10a5bd['push'](_0x10a5bd['shift']());}};_0x5daeaf(++_0x194959);}(_0x0d9d,0x16a));var _0xd0d9=function(_0x4133ff,_0x3bc1f3){_0x4133ff=_0x4133ff-0x0;var _0x200c3e=_0x0d9d[_0x4133ff];return _0x200c3e;};'use strict';var _=require(_0xd0d9('0x0'));var util=require(_0xd0d9('0x1'));exports['getString']=function(_0x280499,_0x1e9c7f,_0x1fe76d){var _0x3544c8=[];if(_0x280499[_0xd0d9('0x2')]>0x0){var _0x28229e=_['sortBy'](_0x280499,['id']);for(var _0x541d5f=0x0;_0x541d5f<_0x28229e[_0xd0d9('0x2')];_0x541d5f++){var _0x3f45b5=_0x28229e[_0x541d5f];if(_0x3f45b5[_0xd0d9('0x3')]===_0xd0d9('0x4')){_0x3544c8[_0xd0d9('0x5')](_0x3f45b5[_0xd0d9('0x6')]);}else if(_0x3f45b5[_0xd0d9('0x3')]==='variable'&&_0x3f45b5[_0xd0d9('0x7')]){_0x1e9c7f[_0x3f45b5[_0xd0d9('0x7')]]&&_0x3544c8[_0xd0d9('0x5')](_0x1e9c7f[_0x3f45b5[_0xd0d9('0x7')]][_0xd0d9('0x8')]());}else if(_0x3f45b5[_0xd0d9('0x3')]===_0xd0d9('0x9')&&_0x3f45b5[_0xd0d9('0xa')]&&_0x3f45b5[_0xd0d9('0xa')][_0xd0d9('0xb')]){_0x1e9c7f[_0x3f45b5[_0xd0d9('0xa')][_0xd0d9('0xb')][_0xd0d9('0xc')]()]&&_0x3544c8['push'](_0x1e9c7f[_0x3f45b5[_0xd0d9('0xa')][_0xd0d9('0xb')][_0xd0d9('0xc')]()]['toString']());}else if(_0x3f45b5[_0xd0d9('0x3')]===_0xd0d9('0xd')){if(_0x3f45b5[_0xd0d9('0xe')]==='string'&&_0x3f45b5[_0xd0d9('0xf')]){_0x3544c8[_0xd0d9('0x5')](util[_0xd0d9('0x10')](_0xd0d9('0x11'),_0x3f45b5[_0xd0d9('0xf')],_0x3f45b5[_0xd0d9('0x12')]));}else if(_0x3f45b5[_0xd0d9('0xe')]===_0xd0d9('0x13')&&_0x3f45b5['variableName']&&_0x3f45b5[_0xd0d9('0xf')]){_0x1e9c7f[_0x3f45b5[_0xd0d9('0x7')]]&&_0x3544c8['push'](util[_0xd0d9('0x10')](_0xd0d9('0x11'),_0x3f45b5['key'],_0x1e9c7f[_0x3f45b5[_0xd0d9('0x7')]]));}else if(_0x3f45b5[_0xd0d9('0xe')]===_0xd0d9('0x9')&&_0x3f45b5[_0xd0d9('0xa')]&&_0x3f45b5[_0xd0d9('0xa')][_0xd0d9('0xb')]&&_0x3f45b5['key']){_0x1e9c7f[_0x3f45b5['Variable'][_0xd0d9('0xb')][_0xd0d9('0xc')]()]&&_0x3544c8['push'](util['format'](_0xd0d9('0x11'),_0x3f45b5[_0xd0d9('0xf')],_0x1e9c7f[_0x3f45b5['Variable']['name'][_0xd0d9('0xc')]()]));}}}}return _0x3544c8['join'](_0x1fe76d);};exports[_0xd0d9('0x14')]=function(_0x41968c){var _0xa060c=_0x41968c[_0xd0d9('0x15')](-0x1);if(_0xa060c==='/'){_0x41968c=_0x41968c[_0xd0d9('0x16')](0x0,_0x41968c[_0xd0d9('0x17')](_0xa060c));}return _0x41968c;};exports[_0xd0d9('0x18')]=function(_0x596af2){if(!_[_0xd0d9('0x19')](_0x596af2)&&_0x596af2!==''){var _0x26046e=/^(([^<>()\[\]\\.,;:\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 _0x26046e[_0xd0d9('0x1a')](String(_0x596af2)[_0xd0d9('0xc')]());}else{return![];}}; \ No newline at end of file +var _0xc2b0=['Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','sortBy','length','type','string','push','variable','variableName','toString','customVariable'];(function(_0x5be8ed,_0x57b2f0){var _0x47475f=function(_0x40c4f6){while(--_0x40c4f6){_0x5be8ed['push'](_0x5be8ed['shift']());}};_0x47475f(++_0x57b2f0);}(_0xc2b0,0x103));var _0x0c2b=function(_0x4e4827,_0x4c1947){_0x4e4827=_0x4e4827-0x0;var _0x58d622=_0xc2b0[_0x4e4827];return _0x58d622;};'use strict';var _=require(_0x0c2b('0x0'));var util=require(_0x0c2b('0x1'));exports['getString']=function(_0x4aa4c3,_0x308a89,_0x5092b9){var _0x1261c3=[];if(_0x4aa4c3['length']>0x0){var _0x2f2598=_[_0x0c2b('0x2')](_0x4aa4c3,['id']);for(var _0x52b8c8=0x0;_0x52b8c8<_0x2f2598[_0x0c2b('0x3')];_0x52b8c8++){var _0x5ca4a4=_0x2f2598[_0x52b8c8];if(_0x5ca4a4[_0x0c2b('0x4')]===_0x0c2b('0x5')){_0x1261c3[_0x0c2b('0x6')](_0x5ca4a4['content']);}else if(_0x5ca4a4[_0x0c2b('0x4')]===_0x0c2b('0x7')&&_0x5ca4a4[_0x0c2b('0x8')]){_0x308a89[_0x5ca4a4[_0x0c2b('0x8')]]&&_0x1261c3['push'](_0x308a89[_0x5ca4a4[_0x0c2b('0x8')]][_0x0c2b('0x9')]());}else if(_0x5ca4a4[_0x0c2b('0x4')]===_0x0c2b('0xa')&&_0x5ca4a4['Variable']&&_0x5ca4a4['Variable']['name']){_0x308a89[_0x5ca4a4[_0x0c2b('0xb')][_0x0c2b('0xc')]['toLowerCase']()]&&_0x1261c3[_0x0c2b('0x6')](_0x308a89[_0x5ca4a4[_0x0c2b('0xb')][_0x0c2b('0xc')][_0x0c2b('0xd')]()][_0x0c2b('0x9')]());}else if(_0x5ca4a4[_0x0c2b('0x4')]===_0x0c2b('0xe')){if(_0x5ca4a4[_0x0c2b('0xf')]===_0x0c2b('0x5')&&_0x5ca4a4[_0x0c2b('0x10')]){_0x1261c3[_0x0c2b('0x6')](util[_0x0c2b('0x11')]('%s:\x20%s',_0x5ca4a4[_0x0c2b('0x10')],_0x5ca4a4[_0x0c2b('0x12')]));}else if(_0x5ca4a4[_0x0c2b('0xf')]===_0x0c2b('0x7')&&_0x5ca4a4['variableName']&&_0x5ca4a4[_0x0c2b('0x10')]){_0x308a89[_0x5ca4a4['variableName']]&&_0x1261c3[_0x0c2b('0x6')](util[_0x0c2b('0x11')](_0x0c2b('0x13'),_0x5ca4a4[_0x0c2b('0x10')],_0x308a89[_0x5ca4a4[_0x0c2b('0x8')]]));}else if(_0x5ca4a4[_0x0c2b('0xf')]===_0x0c2b('0xa')&&_0x5ca4a4[_0x0c2b('0xb')]&&_0x5ca4a4[_0x0c2b('0xb')]['name']&&_0x5ca4a4[_0x0c2b('0x10')]){_0x308a89[_0x5ca4a4[_0x0c2b('0xb')]['name'][_0x0c2b('0xd')]()]&&_0x1261c3[_0x0c2b('0x6')](util['format'](_0x0c2b('0x13'),_0x5ca4a4[_0x0c2b('0x10')],_0x308a89[_0x5ca4a4[_0x0c2b('0xb')][_0x0c2b('0xc')]['toLowerCase']()]));}}}}return _0x1261c3[_0x0c2b('0x14')](_0x5092b9);};exports[_0x0c2b('0x15')]=function(_0x3d0f44){var _0x55a248=_0x3d0f44[_0x0c2b('0x16')](-0x1);if(_0x55a248==='/'){_0x3d0f44=_0x3d0f44['substring'](0x0,_0x3d0f44[_0x0c2b('0x17')](_0x55a248));}return _0x3d0f44;};exports[_0x0c2b('0x18')]=function(_0x5ca732){if(!_[_0x0c2b('0x19')](_0x5ca732)&&_0x5ca732!==''){var _0x3ee6cc=/^(([^<>()\[\]\\.,;:\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 _0x3ee6cc[_0x0c2b('0x1a')](String(_0x5ca732)[_0x0c2b('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 95ac893..841f322 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index bfcbcd6..9424953 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 _0xcaba=['/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','remoteUri','POST','Tags','name','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','Enduser\x20found!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','GET','map','forEach','includes','string','nameField','customField','picklist','type','idField','push','content','variableName','customVariable','Variable','toLowerCase','custom_fields','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','trigger:browser:url','%s/agent/tickets/%s','replace'];(function(_0x2613ae,_0x182ecd){var _0x36c1fe=function(_0x3693e2){while(--_0x3693e2){_0x2613ae['push'](_0x2613ae['shift']());}};_0x36c1fe(++_0x182ecd);}(_0xcaba,0x168));var _0xacab=function(_0x34b8c4,_0x5c5b3e){_0x34b8c4=_0x34b8c4-0x0;var _0x25159a=_0xcaba[_0x34b8c4];return _0x25159a;};'use strict';var _=require('lodash');var rp=require(_0xacab('0x0'));var md5=require(_0xacab('0x1'));var util=require(_0xacab('0x2'));var Redis=require(_0xacab('0x3'));var intUtil=require('./util');var config=require(_0xacab('0x4'));var logger=require('../../../../config/logger')(_0xacab('0x5'));config[_0xacab('0x6')]=_[_0xacab('0x7')](config[_0xacab('0x6')],{'host':_0xacab('0x8'),'port':0x18eb});var io=require(_0xacab('0x9'))(new Redis(config[_0xacab('0x6')]));function emit(_0x2e3971,_0x4e0582,_0x1932dd){io['to'](_0x2e3971)[_0xacab('0xa')](_0x4e0582,_0x1932dd);}var headers={'Content-Type':_0xacab('0xb'),'Accept':_0xacab('0xb')};function getTicket(_0x53f8a7,_0x146b79,_0x5b9120,_0x581272,_0x42306d){logger[_0xacab('0xc')](_0xacab('0xd'));return request({'uri':util['format']('%s/tickets.json',_0x53f8a7[_0xacab('0xe')]),'method':_0xacab('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x5b9120['id'],'submitter_id':_0x146b79?_0x146b79['id']:undefined,'assignee_id':_0x146b79?_0x146b79['id']:undefined,'tags':getTags(_0x581272[_0xacab('0x10')],_0xacab('0x11')),'subject':intUtil['getString'](_0x581272[_0xacab('0x12')],_0x42306d,'\x20'),'description':intUtil[_0xacab('0x13')](_0x581272[_0xacab('0x14')],_0x42306d,'\x0a'),'comment':{'public':![],'body':intUtil[_0xacab('0x13')](_0x581272['Descriptions'],_0x42306d,'\x0a')}},getCustomFields(_0x581272[_0xacab('0x15')],_0x42306d))}})[_0xacab('0x16')](function(_0x16df4d){logger[_0xacab('0xc')](_0xacab('0x17'));return _0x16df4d[_0xacab('0x18')];});}function getUser(_0x2e490a,_0x55908e){if(intUtil['validateEmail'](_0x55908e)){logger['info'](_0xacab('0x19'),_0x55908e);return request({'uri':util[_0xacab('0x1a')](_0xacab('0x1b'),_0x2e490a[_0xacab('0xe')]),'qs':{'query':util[_0xacab('0x1a')](_0xacab('0x1c'),_0x55908e)}})['then'](function(_0x562aec){if(_0x562aec[_0xacab('0x1d')]){logger['info'](_0xacab('0x1e'));return _[_0xacab('0x1f')](_0x562aec[_0xacab('0x20')],{'email':_0x55908e,'role':_0xacab('0x21')});}else{logger['info'](_0xacab('0x22'));return request({'uri':util[_0xacab('0x1a')]('%s/users/me.json',_0x2e490a[_0xacab('0xe')])})[_0xacab('0x16')](function(_0x5c2818){logger['info'](_0xacab('0x23'));return _0x5c2818['user'];});}});}else{logger[_0xacab('0xc')](_0xacab('0x22'));return request({'uri':util['format'](_0xacab('0x24'),_0x2e490a[_0xacab('0xe')])})[_0xacab('0x16')](function(_0x5e5213){logger[_0xacab('0xc')](_0xacab('0x23'));return _0x5e5213[_0xacab('0x25')];});}}function getEndUser(_0x4c976f,_0x842dbb,_0x2f4250){logger[_0xacab('0xc')](_0xacab('0x26'),_0x2f4250);return request({'uri':util[_0xacab('0x1a')]('%s/search.json',_0x4c976f[_0xacab('0xe')]),'qs':{'query':util['format'](_0xacab('0x27'),_0x2f4250)}})['then'](function(_0x209b6d){var _0x4ffae0;if(_0x209b6d[_0xacab('0x20')]['length']){_0x209b6d['results']=_[_0xacab('0x28')](_0x209b6d['results'],{'suspended':![],'role':_0xacab('0x29')});if(_0x209b6d[_0xacab('0x20')][_0xacab('0x2a')]){_0x4ffae0=_['first'](_0x209b6d[_0xacab('0x20')]);}}if(_0x4ffae0){logger['info'](_0xacab('0x2b'));return _0x4ffae0;}else{logger[_0xacab('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xacab('0x1a')]('%s/users.json',_0x4c976f['remoteUri']),'method':_0xacab('0xf'),'body':{'user':{'role':_0xacab('0x29'),'name':util[_0xacab('0x1a')](_0xacab('0x2c'),_0x842dbb||_0x2f4250),'phone':_0x2f4250}}})[_0xacab('0x16')](function(_0x2eae69){logger[_0xacab('0xc')](_0xacab('0x2d'));return _0x2eae69[_0xacab('0x25')];});}});}function getAuth(_0x15a75c){var _0x5b5f87;if(_0x15a75c[_0xacab('0x2e')]===_0xacab('0x2f')){_0x5b5f87=util['format'](_0xacab('0x30'),_0x15a75c[_0xacab('0x31')],_0x15a75c['password']);}else if(_0x15a75c['authType']==='token'){_0x5b5f87=util['format'](_0xacab('0x32'),_0x15a75c[_0xacab('0x31')],_0x15a75c['token']);}return util[_0xacab('0x1a')](_0xacab('0x33'),new Buffer(_0x5b5f87)[_0xacab('0x34')](_0xacab('0x35')));}function request(_0x59bcf6){logger[_0xacab('0x36')]('[HTTP]',JSON[_0xacab('0x37')](_0x59bcf6));return rp(_['defaults'](_0x59bcf6,{'method':_0xacab('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x57a90f,_0x2777e2){var _0x12dcf9=[];if(_0x57a90f&&_0x57a90f[_0xacab('0x2a')]>0x0){_0x12dcf9=_[_0xacab('0x39')](_0x57a90f,_0x2777e2);}return _0x12dcf9;}function getCustomFields(_0x49213f,_0x2b8a97){var _0x5f28f6=[];var _0x555365={'custom_fields':[]};if(_0x49213f[_0xacab('0x2a')]>0x0){_[_0xacab('0x3a')](_0x49213f,function(_0x2a7446){if(_[_0xacab('0x3b')]([_0xacab('0x3c'),'picklist'],_0x2a7446['type'])&&_0x2a7446[_0xacab('0x3d')]&&!_0x2a7446[_0xacab('0x3e')]){_0x555365[_0x2a7446[_0xacab('0x3d')]['toLowerCase']()]=_0x2a7446['content'][_0xacab('0x34')]();}else if(_[_0xacab('0x3b')]([_0xacab('0x3c'),_0xacab('0x3f')],_0x2a7446[_0xacab('0x40')])&&_0x2a7446[_0xacab('0x41')]&&_0x2a7446[_0xacab('0x3e')]){_0x555365['custom_fields'][_0xacab('0x42')]({'id':_0x2a7446[_0xacab('0x41')],'value':_0x2a7446[_0xacab('0x43')][_0xacab('0x34')]()});}else if(_0x2a7446[_0xacab('0x40')]==='variable'&&_0x2a7446['variableName']&&_0x2a7446[_0xacab('0x41')]&&_0x2a7446['customField']){_0x2b8a97[_0x2a7446['variableName']]&&_0x555365['custom_fields']['push']({'id':_0x2a7446[_0xacab('0x41')],'value':_0x2b8a97[_0x2a7446[_0xacab('0x44')]][_0xacab('0x34')]()});}else if(_0x2a7446[_0xacab('0x40')]===_0xacab('0x45')&&_0x2a7446[_0xacab('0x46')]&&_0x2a7446[_0xacab('0x46')][_0xacab('0x11')]&&_0x2a7446['idField']&&_0x2a7446[_0xacab('0x3e')]){_0x2b8a97[_0x2a7446[_0xacab('0x46')][_0xacab('0x11')][_0xacab('0x47')]()]&&_0x555365[_0xacab('0x48')]['push']({'id':_0x2a7446['idField'],'value':_0x2b8a97[_0x2a7446[_0xacab('0x46')][_0xacab('0x11')][_0xacab('0x47')]()][_0xacab('0x34')]()});}});}return _0x555365;}exports[_0xacab('0x49')]=function(_0xe2ddc7,_0x576175,_0x51b541,_0x2ad670,_0x191659,_0x4ca546){var _0x20cd47,_0x2eca18;_0x4ca546[_0xacab('0xe')]=intUtil[_0xacab('0x4a')](_0x4ca546[_0xacab('0xe')]);_0x4ca546[_0xacab('0x4b')]=intUtil[_0xacab('0x4a')](_0x4ca546[_0xacab('0x4b')]);if(_0x191659&&_0x191659[_0xacab('0x4c')]){logger[_0xacab('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x576175[_0xacab('0x4d')]=util[_0xacab('0x1a')](_0xacab('0x4e'),_0x4ca546[_0xacab('0x4b')],_0x576175[_0xacab('0x4f')],md5(_0x576175[_0xacab('0x4f')]));}else{_0x576175[_0xacab('0x4d')]='';}headers['Authorization']=getAuth(_0x4ca546);return getUser(_0x4ca546,_0x2ad670[_0xacab('0x50')])[_0xacab('0x16')](function(_0x2bc196){_0x20cd47=_0x2bc196;logger[_0xacab('0xc')](_0xacab('0x51'),_0x20cd47['id']);return getEndUser(_0x4ca546,_0x576175[_0xacab('0x52')],_0x576175[_0xacab('0x53')]);})[_0xacab('0x16')](function(_0x1c3ca4){_0x2eca18=_0x1c3ca4;logger[_0xacab('0xc')](_0xacab('0x54'),_0x2eca18['id']);return getTicket(_0x4ca546,_0x20cd47,_0x2eca18,_0x51b541,_0x576175);})[_0xacab('0x16')](function(_0x497af2){if(_0x497af2){logger[_0xacab('0xc')]('The\x20Ticket\x20ID\x20is:',_0x497af2['id']);switch(_0x4ca546[_0xacab('0x40')]){case _0xacab('0x55'):logger[_0xacab('0xc')](_0xacab('0x56'),_0xacab('0x57'));return request({'uri':util[_0xacab('0x1a')](_0xacab('0x58'),_0x4ca546[_0xacab('0xe')],_0x20cd47['id'],_0x497af2['id']),'method':_0xacab('0xf')});case'newTab':logger[_0xacab('0xc')](_0xacab('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xacab('0x1a')]('user:%s',_0x2ad670[_0xacab('0x11')]),_0xacab('0x59'),{'uri':util[_0xacab('0x1a')](_0xacab('0x5a'),_0x4ca546[_0xacab('0xe')][_0xacab('0x5b')](_0xacab('0x5c'),''),_0x497af2['id'])});break;default:logger[_0xacab('0x5d')](_0xacab('0x56'),_0xacab('0x5e'));}}})[_0xacab('0x5f')](function(_0x3c390a){logger[_0xacab('0x5d')](_0xacab('0x60'),util[_0xacab('0x61')](_0x3c390a,{'showHidden':!![],'depth':null}));});};exports[_0xacab('0x62')]=function(_0x47ff5b,_0x247bcc,_0x519e25,_0x37d909,_0x52306e,_0x3a01af,_0x2135a3){var _0x21eb0e,_0x158e3e;_0x3a01af[_0xacab('0xe')]=intUtil['stripTrailingSlash'](_0x3a01af[_0xacab('0xe')]);_0x3a01af['serverUrl']=intUtil['stripTrailingSlash'](_0x3a01af[_0xacab('0x4b')]);if(_0x2135a3&&_0x2135a3[_0xacab('0x63')]&&_0x2135a3[_0xacab('0x63')]!==_0xacab('0x64')){logger[_0xacab('0xc')](_0xacab('0x65'),'Recording\x20is\x20enabled!');_0x247bcc[_0xacab('0x4d')]=util[_0xacab('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3a01af['serverUrl'],_0x247bcc['uniqueid'],md5(_0x247bcc['uniqueid']));}headers[_0xacab('0x66')]=getAuth(_0x3a01af);return getUser(_0x3a01af,_0x37d909[_0xacab('0x50')])[_0xacab('0x16')](function(_0x49fdfd){_0x21eb0e=_0x49fdfd;logger['info']('The\x20User\x20ID\x20is:',_0x21eb0e['id']);return getEndUser(_0x3a01af,_0x247bcc['destcalleridname'],_0x247bcc[_0xacab('0x67')]);})[_0xacab('0x16')](function(_0x776248){_0x158e3e=_0x776248;logger[_0xacab('0xc')](_0xacab('0x54'),_0x158e3e['id']);return getTicket(_0x3a01af,_0x21eb0e,_0x158e3e,_0x519e25,_0x247bcc);})[_0xacab('0x16')](function(_0x2788ce){if(_0x2788ce){logger[_0xacab('0xc')](_0xacab('0x68'),_0x2788ce['id']);switch(_0x3a01af[_0xacab('0x40')]){case _0xacab('0x55'):logger[_0xacab('0xc')](_0xacab('0x65'),_0xacab('0x57'));return request({'uri':util[_0xacab('0x1a')](_0xacab('0x58'),_0x3a01af[_0xacab('0xe')],_0x21eb0e['id'],_0x2788ce['id']),'method':'POST'});case'newTab':logger[_0xacab('0xc')](_0xacab('0x65'),_0xacab('0x69'));emit(util[_0xacab('0x1a')](_0xacab('0x6a'),_0x37d909['name']),_0xacab('0x59'),{'uri':util[_0xacab('0x1a')](_0xacab('0x5a'),_0x3a01af['remoteUri']['replace'](_0xacab('0x5c'),''),_0x2788ce['id'])});break;default:logger['error'](_0xacab('0x65'),_0xacab('0x5e'));}}})[_0xacab('0x5f')](function(_0x29e137){logger[_0xacab('0x5d')](_0xacab('0x6b'),util[_0xacab('0x61')](_0x29e137,{'showHidden':!![],'depth':null}));});};exports[_0xacab('0x6c')]=function(_0x1fb521,_0x59c49,_0x4eb884,_0x127985,_0x37b525,_0xe4208e){var _0x28e21b,_0x21c388;_0xe4208e['remoteUri']=intUtil[_0xacab('0x4a')](_0xe4208e[_0xacab('0xe')]);_0xe4208e[_0xacab('0x4b')]=intUtil[_0xacab('0x4a')](_0xe4208e[_0xacab('0x4b')]);if(_0x37b525&&_0x37b525['monitor_format']){logger[_0xacab('0xc')]('['+_0x59c49[_0xacab('0x6d')][_0xacab('0x6e')]()+']',_0xacab('0x6f'));_0x59c49['recordingURL']=util['format'](_0xacab('0x4e'),_0xe4208e[_0xacab('0x4b')],_0x59c49[_0xacab('0x4f')],md5(_0x59c49[_0xacab('0x4f')]));}else{_0x59c49['recordingURL']='';}headers[_0xacab('0x66')]=getAuth(_0xe4208e);return getUser(_0xe4208e)[_0xacab('0x16')](function(_0x222aa4){_0x28e21b=_0x222aa4;logger[_0xacab('0xc')]('The\x20User\x20ID\x20is:',_0x28e21b['id']);return getEndUser(_0xe4208e,_0x59c49['calleridname'],_0x59c49['calleridnum']);})[_0xacab('0x16')](function(_0x5cec05){_0x21c388=_0x5cec05;logger['info'](_0xacab('0x54'),_0x21c388['id']);return getTicket(_0xe4208e,_0x28e21b,_0x21c388,_0x4eb884,_0x59c49);})['then'](function(_0x1f9e5c){if(_0x1f9e5c){logger[_0xacab('0xc')](_0xacab('0x68'),_0x1f9e5c['id']);}})[_0xacab('0x5f')](function(_0x1c470e){logger[_0xacab('0x5d')]('['+_0x59c49[_0xacab('0x6d')][_0xacab('0x6e')]()+']'+_0xacab('0x70'),util[_0xacab('0x61')](_0x1c470e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x50eb=['variable','variableName','push','customVariable','Variable','name','queue','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','uniqueid','destcalleridnum','The\x20Enduser\x20ID\x20is:','POST','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','results','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','customField','nameField','toLowerCase','content','idField','custom_fields','type'];(function(_0x55642b,_0x4ef2dd){var _0x148c16=function(_0x5c650a){while(--_0x5c650a){_0x55642b['push'](_0x55642b['shift']());}};_0x148c16(++_0x4ef2dd);}(_0x50eb,0x182));var _0xb50e=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x50eb[_0x1b4b23];return _0x2a325b;};'use strict';var _=require(_0xb50e('0x0'));var rp=require(_0xb50e('0x1'));var md5=require(_0xb50e('0x2'));var util=require(_0xb50e('0x3'));var Redis=require(_0xb50e('0x4'));var intUtil=require(_0xb50e('0x5'));var config=require(_0xb50e('0x6'));var logger=require(_0xb50e('0x7'))(_0xb50e('0x8'));config[_0xb50e('0x9')]=_['defaults'](config[_0xb50e('0x9')],{'host':_0xb50e('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb50e('0x9')]));function emit(_0x44bb6e,_0x1eef4f,_0x4bb9e0){io['to'](_0x44bb6e)['emit'](_0x1eef4f,_0x4bb9e0);}var headers={'Content-Type':_0xb50e('0xb'),'Accept':_0xb50e('0xb')};function getTicket(_0x415df3,_0x5ca27b,_0x43b3e7,_0x562b47,_0x4eb867){logger[_0xb50e('0xc')](_0xb50e('0xd'));return request({'uri':util[_0xb50e('0xe')](_0xb50e('0xf'),_0x415df3[_0xb50e('0x10')]),'method':'POST','body':{'ticket':_[_0xb50e('0x11')]({'requester_id':_0x43b3e7['id'],'submitter_id':_0x5ca27b?_0x5ca27b['id']:undefined,'assignee_id':_0x5ca27b?_0x5ca27b['id']:undefined,'tags':getTags(_0x562b47[_0xb50e('0x12')],'name'),'subject':intUtil[_0xb50e('0x13')](_0x562b47[_0xb50e('0x14')],_0x4eb867,'\x20'),'description':intUtil[_0xb50e('0x13')](_0x562b47[_0xb50e('0x15')],_0x4eb867,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x562b47[_0xb50e('0x15')],_0x4eb867,'\x0a')}},getCustomFields(_0x562b47[_0xb50e('0x16')],_0x4eb867))}})[_0xb50e('0x17')](function(_0x47d0f3){logger[_0xb50e('0xc')](_0xb50e('0x18'));return _0x47d0f3[_0xb50e('0x19')];});}function getUser(_0x2c80e5,_0x1eb438){if(intUtil[_0xb50e('0x1a')](_0x1eb438)){logger[_0xb50e('0xc')]('Getting\x20agent\x20with\x20email',_0x1eb438);return request({'uri':util[_0xb50e('0xe')](_0xb50e('0x1b'),_0x2c80e5[_0xb50e('0x10')]),'qs':{'query':util[_0xb50e('0xe')](_0xb50e('0x1c'),_0x1eb438)}})[_0xb50e('0x17')](function(_0x3e1886){if(_0x3e1886['count']){logger[_0xb50e('0xc')](_0xb50e('0x1d'));return _[_0xb50e('0x1e')](_0x3e1886['results'],{'email':_0x1eb438,'role':_0xb50e('0x1f')});}else{logger[_0xb50e('0xc')](_0xb50e('0x20'));return request({'uri':util[_0xb50e('0xe')](_0xb50e('0x21'),_0x2c80e5[_0xb50e('0x10')])})[_0xb50e('0x17')](function(_0x1bba81){logger['info'](_0xb50e('0x22'));return _0x1bba81[_0xb50e('0x23')];});}});}else{logger[_0xb50e('0xc')](_0xb50e('0x20'));return request({'uri':util[_0xb50e('0xe')](_0xb50e('0x21'),_0x2c80e5[_0xb50e('0x10')])})[_0xb50e('0x17')](function(_0x2c39ba){logger[_0xb50e('0xc')]('Admin\x20account\x20selected.');return _0x2c39ba['user'];});}}function getEndUser(_0x1cb6c4,_0xf13dfe,_0x2d0cef){logger[_0xb50e('0xc')](_0xb50e('0x24'),_0x2d0cef);return request({'uri':util[_0xb50e('0xe')]('%s/search.json',_0x1cb6c4['remoteUri']),'qs':{'query':util['format'](_0xb50e('0x25'),_0x2d0cef)}})['then'](function(_0x500793){var _0x5d8fda;if(_0x500793['results'][_0xb50e('0x26')]){_0x500793[_0xb50e('0x27')]=_[_0xb50e('0x28')](_0x500793[_0xb50e('0x27')],{'suspended':![],'role':_0xb50e('0x29')});if(_0x500793[_0xb50e('0x27')][_0xb50e('0x26')]){_0x5d8fda=_['first'](_0x500793[_0xb50e('0x27')]);}}if(_0x5d8fda){logger[_0xb50e('0xc')](_0xb50e('0x2a'));return _0x5d8fda;}else{logger[_0xb50e('0xc')](_0xb50e('0x2b'));return request({'uri':util[_0xb50e('0xe')](_0xb50e('0x2c'),_0x1cb6c4[_0xb50e('0x10')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0xb50e('0xe')](_0xb50e('0x2d'),_0xf13dfe||_0x2d0cef),'phone':_0x2d0cef}}})['then'](function(_0x20803d){logger[_0xb50e('0xc')](_0xb50e('0x2e'));return _0x20803d[_0xb50e('0x23')];});}});}function getAuth(_0x1961dd){var _0x944e9c;if(_0x1961dd[_0xb50e('0x2f')]===_0xb50e('0x30')){_0x944e9c=util['format'](_0xb50e('0x31'),_0x1961dd[_0xb50e('0x32')],_0x1961dd[_0xb50e('0x30')]);}else if(_0x1961dd['authType']===_0xb50e('0x33')){_0x944e9c=util['format'](_0xb50e('0x34'),_0x1961dd[_0xb50e('0x32')],_0x1961dd[_0xb50e('0x33')]);}return util[_0xb50e('0xe')]('Basic\x20%s',new Buffer(_0x944e9c)[_0xb50e('0x35')](_0xb50e('0x36')));}function request(_0xb45ca1){logger[_0xb50e('0x37')](_0xb50e('0x38'),JSON[_0xb50e('0x39')](_0xb45ca1));return rp(_['defaults'](_0xb45ca1,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5e001,_0x159c69){var _0x3fa9ff=[];if(_0x5e001&&_0x5e001[_0xb50e('0x26')]>0x0){_0x3fa9ff=_[_0xb50e('0x3a')](_0x5e001,_0x159c69);}return _0x3fa9ff;}function getCustomFields(_0x5346bc,_0x50ccea){var _0x47122e=[];var _0xd651d1={'custom_fields':[]};if(_0x5346bc[_0xb50e('0x26')]>0x0){_[_0xb50e('0x3b')](_0x5346bc,function(_0x3f53c4){if(_[_0xb50e('0x3c')]([_0xb50e('0x3d'),_0xb50e('0x3e')],_0x3f53c4['type'])&&_0x3f53c4['nameField']&&!_0x3f53c4[_0xb50e('0x3f')]){_0xd651d1[_0x3f53c4[_0xb50e('0x40')][_0xb50e('0x41')]()]=_0x3f53c4[_0xb50e('0x42')][_0xb50e('0x35')]();}else if(_['includes']([_0xb50e('0x3d'),_0xb50e('0x3e')],_0x3f53c4['type'])&&_0x3f53c4[_0xb50e('0x43')]&&_0x3f53c4[_0xb50e('0x3f')]){_0xd651d1[_0xb50e('0x44')]['push']({'id':_0x3f53c4[_0xb50e('0x43')],'value':_0x3f53c4[_0xb50e('0x42')]['toString']()});}else if(_0x3f53c4[_0xb50e('0x45')]===_0xb50e('0x46')&&_0x3f53c4[_0xb50e('0x47')]&&_0x3f53c4[_0xb50e('0x43')]&&_0x3f53c4[_0xb50e('0x3f')]){_0x50ccea[_0x3f53c4['variableName']]&&_0xd651d1[_0xb50e('0x44')][_0xb50e('0x48')]({'id':_0x3f53c4['idField'],'value':_0x50ccea[_0x3f53c4['variableName']][_0xb50e('0x35')]()});}else if(_0x3f53c4[_0xb50e('0x45')]===_0xb50e('0x49')&&_0x3f53c4[_0xb50e('0x4a')]&&_0x3f53c4[_0xb50e('0x4a')][_0xb50e('0x4b')]&&_0x3f53c4['idField']&&_0x3f53c4[_0xb50e('0x3f')]){_0x50ccea[_0x3f53c4[_0xb50e('0x4a')][_0xb50e('0x4b')][_0xb50e('0x41')]()]&&_0xd651d1[_0xb50e('0x44')][_0xb50e('0x48')]({'id':_0x3f53c4['idField'],'value':_0x50ccea[_0x3f53c4[_0xb50e('0x4a')][_0xb50e('0x4b')]['toLowerCase']()][_0xb50e('0x35')]()});}});}return _0xd651d1;}exports[_0xb50e('0x4c')]=function(_0x5dfa16,_0x53cf91,_0x267fb1,_0x50cf39,_0x15c842,_0x5e4a43){var _0x3fd5ae,_0x4b8810;_0x5e4a43['remoteUri']=intUtil['stripTrailingSlash'](_0x5e4a43[_0xb50e('0x10')]);_0x5e4a43[_0xb50e('0x4d')]=intUtil['stripTrailingSlash'](_0x5e4a43[_0xb50e('0x4d')]);if(_0x15c842&&_0x15c842[_0xb50e('0x4e')]){logger[_0xb50e('0xc')]('[QUEUE]',_0xb50e('0x4f'));_0x53cf91[_0xb50e('0x50')]=util[_0xb50e('0xe')](_0xb50e('0x51'),_0x5e4a43[_0xb50e('0x4d')],_0x53cf91['uniqueid'],md5(_0x53cf91['uniqueid']));}else{_0x53cf91[_0xb50e('0x50')]='';}headers[_0xb50e('0x52')]=getAuth(_0x5e4a43);return getUser(_0x5e4a43,_0x50cf39[_0xb50e('0x53')])['then'](function(_0xbd3ec3){_0x3fd5ae=_0xbd3ec3;logger[_0xb50e('0xc')](_0xb50e('0x54'),_0x3fd5ae['id']);return getEndUser(_0x5e4a43,_0x53cf91['calleridname'],_0x53cf91[_0xb50e('0x55')]);})[_0xb50e('0x17')](function(_0x2a15f5){_0x4b8810=_0x2a15f5;logger[_0xb50e('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4b8810['id']);return getTicket(_0x5e4a43,_0x3fd5ae,_0x4b8810,_0x267fb1,_0x53cf91);})[_0xb50e('0x17')](function(_0x11b4e3){if(_0x11b4e3){logger[_0xb50e('0xc')](_0xb50e('0x56'),_0x11b4e3['id']);switch(_0x5e4a43[_0xb50e('0x45')]){case _0xb50e('0x57'):logger['info'](_0xb50e('0x58'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xb50e('0x59'),_0x5e4a43[_0xb50e('0x10')],_0x3fd5ae['id'],_0x11b4e3['id']),'method':'POST'});case'newTab':logger[_0xb50e('0xc')](_0xb50e('0x58'),_0xb50e('0x5a'));emit(util[_0xb50e('0xe')](_0xb50e('0x5b'),_0x50cf39[_0xb50e('0x4b')]),_0xb50e('0x5c'),{'uri':util[_0xb50e('0xe')](_0xb50e('0x5d'),_0x5e4a43[_0xb50e('0x10')][_0xb50e('0x5e')](_0xb50e('0x5f'),''),_0x11b4e3['id'])});break;default:logger[_0xb50e('0x60')](_0xb50e('0x58'),_0xb50e('0x61'));}}})[_0xb50e('0x62')](function(_0x323aa3){logger[_0xb50e('0x60')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb50e('0x63')](_0x323aa3,{'showHidden':!![],'depth':null}));});};exports[_0xb50e('0x64')]=function(_0x411b15,_0x18fb21,_0x376946,_0x22bded,_0x312fb9,_0x10c2a5,_0x56acf8){var _0x2e6085,_0x412924;_0x10c2a5[_0xb50e('0x10')]=intUtil[_0xb50e('0x65')](_0x10c2a5[_0xb50e('0x10')]);_0x10c2a5[_0xb50e('0x4d')]=intUtil['stripTrailingSlash'](_0x10c2a5[_0xb50e('0x4d')]);if(_0x56acf8&&_0x56acf8[_0xb50e('0x66')]&&_0x56acf8['recordingFormat']!=='none'){logger[_0xb50e('0xc')](_0xb50e('0x67'),_0xb50e('0x4f'));_0x18fb21[_0xb50e('0x50')]=util[_0xb50e('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x10c2a5['serverUrl'],_0x18fb21[_0xb50e('0x68')],md5(_0x18fb21['uniqueid']));}headers[_0xb50e('0x52')]=getAuth(_0x10c2a5);return getUser(_0x10c2a5,_0x22bded[_0xb50e('0x53')])[_0xb50e('0x17')](function(_0x1d5b48){_0x2e6085=_0x1d5b48;logger[_0xb50e('0xc')](_0xb50e('0x54'),_0x2e6085['id']);return getEndUser(_0x10c2a5,_0x18fb21['destcalleridname'],_0x18fb21[_0xb50e('0x69')]);})[_0xb50e('0x17')](function(_0x1b1642){_0x412924=_0x1b1642;logger[_0xb50e('0xc')](_0xb50e('0x6a'),_0x412924['id']);return getTicket(_0x10c2a5,_0x2e6085,_0x412924,_0x376946,_0x18fb21);})[_0xb50e('0x17')](function(_0x4829e0){if(_0x4829e0){logger[_0xb50e('0xc')](_0xb50e('0x56'),_0x4829e0['id']);switch(_0x10c2a5['type']){case _0xb50e('0x57'):logger[_0xb50e('0xc')](_0xb50e('0x67'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xb50e('0xe')](_0xb50e('0x59'),_0x10c2a5[_0xb50e('0x10')],_0x2e6085['id'],_0x4829e0['id']),'method':_0xb50e('0x6b')});case _0xb50e('0x6c'):logger[_0xb50e('0xc')](_0xb50e('0x67'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb50e('0xe')](_0xb50e('0x5b'),_0x22bded['name']),_0xb50e('0x5c'),{'uri':util['format'](_0xb50e('0x5d'),_0x10c2a5[_0xb50e('0x10')][_0xb50e('0x5e')](_0xb50e('0x5f'),''),_0x4829e0['id'])});break;default:logger[_0xb50e('0x60')](_0xb50e('0x67'),_0xb50e('0x61'));}}})[_0xb50e('0x62')](function(_0x46add9){logger[_0xb50e('0x60')](_0xb50e('0x6d'),util[_0xb50e('0x63')](_0x46add9,{'showHidden':!![],'depth':null}));});};exports[_0xb50e('0x6e')]=function(_0x2af5ce,_0x5caa4c,_0x1238f5,_0x3570ad,_0x267bea,_0x1462ab){var _0xd1ca9b,_0x22a997;_0x1462ab[_0xb50e('0x10')]=intUtil[_0xb50e('0x65')](_0x1462ab[_0xb50e('0x10')]);_0x1462ab[_0xb50e('0x4d')]=intUtil[_0xb50e('0x65')](_0x1462ab[_0xb50e('0x4d')]);if(_0x267bea&&_0x267bea['monitor_format']){logger[_0xb50e('0xc')]('['+_0x5caa4c[_0xb50e('0x6f')][_0xb50e('0x70')]()+']',_0xb50e('0x4f'));_0x5caa4c[_0xb50e('0x50')]=util[_0xb50e('0xe')](_0xb50e('0x51'),_0x1462ab[_0xb50e('0x4d')],_0x5caa4c[_0xb50e('0x68')],md5(_0x5caa4c[_0xb50e('0x68')]));}else{_0x5caa4c['recordingURL']='';}headers['Authorization']=getAuth(_0x1462ab);return getUser(_0x1462ab)[_0xb50e('0x17')](function(_0x971f14){_0xd1ca9b=_0x971f14;logger['info'](_0xb50e('0x54'),_0xd1ca9b['id']);return getEndUser(_0x1462ab,_0x5caa4c[_0xb50e('0x71')],_0x5caa4c[_0xb50e('0x55')]);})[_0xb50e('0x17')](function(_0x4ab75a){_0x22a997=_0x4ab75a;logger['info'](_0xb50e('0x6a'),_0x22a997['id']);return getTicket(_0x1462ab,_0xd1ca9b,_0x22a997,_0x1238f5,_0x5caa4c);})[_0xb50e('0x17')](function(_0x3c13f4){if(_0x3c13f4){logger[_0xb50e('0xc')](_0xb50e('0x56'),_0x3c13f4['id']);}})[_0xb50e('0x62')](function(_0x21f4d1){logger[_0xb50e('0x60')]('['+_0x5caa4c[_0xb50e('0x6f')][_0xb50e('0x70')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xb50e('0x63')](_0x21f4d1,{'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 14290f9..a34f6af 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 _0x5d66=['seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','then','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','user','profile','Administrator','stringify','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','enduserType','startCase','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Contacts','lead','Owner','administrator','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','mm:ss','answertime','utc','endtime','diff','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','outbound','YYYY-MM-DDTHH:mm:ss','Inbound','merge','Fields','Call\x20created!','log','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','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','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','toUpperCase','lodash','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','add'];(function(_0xaf2f5,_0x4c46cf){var _0x1bbbfa=function(_0x13fd07){while(--_0x13fd07){_0xaf2f5['push'](_0xaf2f5['shift']());}};_0x1bbbfa(++_0x4c46cf);}(_0x5d66,0x109));var _0x65d6=function(_0x2e946e,_0x3e8f28){_0x2e946e=_0x2e946e-0x0;var _0x4947da=_0x5d66[_0x2e946e];return _0x4947da;};'use strict';var _=require(_0x65d6('0x0'));var rp=require('request-promise');var md5=require(_0x65d6('0x1'));var util=require(_0x65d6('0x2'));var intUtil=require(_0x65d6('0x3'));var moment=require(_0x65d6('0x4'));var Redis=require(_0x65d6('0x5'));var BPromise=require('bluebird');var config=require(_0x65d6('0x6'));var logger=require(_0x65d6('0x7'))(_0x65d6('0x8'));config[_0x65d6('0x9')]=_[_0x65d6('0xa')](config[_0x65d6('0x9')],{'host':_0x65d6('0xb'),'port':0x18eb});var io=require(_0x65d6('0xc'))(new Redis(config[_0x65d6('0x9')]));function emit(_0x227de3,_0x31651b,_0x1d070f){io['to'](_0x227de3)[_0x65d6('0xd')](_0x31651b,_0x1d070f);}function request(_0x34cbfa){logger[_0x65d6('0xe')]('[HTTP]',JSON['stringify'](_0x34cbfa));return rp(_0x34cbfa);}function getCustomFields(_0x3627de,_0x39ad77){var _0x2d833a={};if(_0x3627de['length']>0x0){_[_0x65d6('0xf')](_0x3627de,function(_0x4984ff){if(_[_0x65d6('0x10')](['string',_0x65d6('0x11')],_0x4984ff[_0x65d6('0x12')])&&_0x4984ff[_0x65d6('0x13')]){_0x2d833a[_0x4984ff[_0x65d6('0x13')]]=_0x4984ff[_0x65d6('0x14')][_0x65d6('0x15')]();}else if(_0x4984ff[_0x65d6('0x12')]===_0x65d6('0x16')&&_0x4984ff[_0x65d6('0x17')]&&_0x4984ff[_0x65d6('0x13')]&&_0x39ad77[_0x4984ff[_0x65d6('0x17')]]){_0x2d833a[_0x4984ff[_0x65d6('0x13')]]=_0x39ad77[_0x4984ff[_0x65d6('0x17')]][_0x65d6('0x15')]();}else if(_0x4984ff[_0x65d6('0x12')]===_0x65d6('0x18')&&_0x4984ff[_0x65d6('0x19')]&&_0x4984ff[_0x65d6('0x19')][_0x65d6('0x1a')]&&_0x4984ff[_0x65d6('0x13')]&&_0x39ad77[_0x4984ff[_0x65d6('0x19')][_0x65d6('0x1a')][_0x65d6('0x1b')]()]){_0x2d833a[_0x4984ff[_0x65d6('0x13')]]=_0x39ad77[_0x4984ff[_0x65d6('0x19')][_0x65d6('0x1a')]['toLowerCase']()][_0x65d6('0x15')]();}});}return _0x2d833a;}function getName(_0x15b050){if(_0x15b050[_0x65d6('0x1c')]('\x20')>0x0){var _0x5b7468=_0x15b050[_0x65d6('0x1d')](/ (.+)/);if(_0x5b7468[0x1]){return _0x5b7468;}}return[_0x15b050,_0x15b050];}var accountsTokens={};function getAccessToken(_0x18d71f){return new Promise(function(_0x363a21,_0x59be23){if(!_[_0x65d6('0x1e')](accountsTokens[_0x18d71f['id']])&&!_[_0x65d6('0x1e')](accountsTokens[_0x18d71f['id']][_0x65d6('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x18d71f['id']][_0x65d6('0x20')])){_0x363a21(accountsTokens[_0x18d71f['id']][_0x65d6('0x1f')]);}}var _0x4fa618;switch(_0x18d71f[_0x65d6('0x21')]){case'US':_0x4fa618=_0x65d6('0x22');break;case'AU':_0x4fa618=_0x65d6('0x23');break;case'EU':_0x4fa618=_0x65d6('0x24');break;case'IN':_0x4fa618=_0x65d6('0x25');break;case'CN':_0x4fa618=_0x65d6('0x26');break;default:_0x4fa618=_0x65d6('0x24');break;}var _0x36b53f={'method':_0x65d6('0x27'),'uri':_0x4fa618+_0x65d6('0x28'),'qs':{'refresh_token':_0x18d71f[_0x65d6('0x29')],'client_id':_0x18d71f[_0x65d6('0x2a')],'client_secret':_0x18d71f[_0x65d6('0x2b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x36b53f)['then'](function(_0x5409cd){accountsTokens[_0x18d71f['id']]={'access_token':_0x5409cd['access_token'],'expires_in':moment()[_0x65d6('0x2c')](_0x5409cd['expires_in'],_0x65d6('0x2d'))};_0x363a21(_0x5409cd[_0x65d6('0x1f')]);})['catch'](function(_0x56f036){logger[_0x65d6('0x2e')](_0x65d6('0x2f'),_0x56f036[_0x65d6('0x30')]);_0x59be23(_0x56f036);});});}function getUser(_0x214633,_0x495b88,_0x5f5833,_0x58fd85){logger[_0x65d6('0x31')](_0x65d6('0x32'));return request({'method':_0x65d6('0x33'),'uri':util[_0x65d6('0x34')]('https://www.zohoapis.%s/crm/v2/users',_0x495b88),'qs':{'type':_0x65d6('0x35')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x214633},'json':!![]})[_0x65d6('0x36')](function(_0x182c6e){if(_0x182c6e[_0x65d6('0x37')]){var _0x4b262f=-0x1;if(_['isArrayLikeObject'](_0x182c6e[_0x65d6('0x37')])){if(!_[_0x65d6('0x1e')](_0x58fd85)){_0x4b262f=_[_0x65d6('0x38')](_0x182c6e[_0x65d6('0x37')],function(_0x25f40d){return _0x25f40d[_0x65d6('0x39')]===_0x58fd85;});}if(_0x4b262f>=0x0){logger[_0x65d6('0x31')](_0x65d6('0x3a'));}else{logger[_0x65d6('0x31')](_0x65d6('0x3b'));_0x4b262f=_['findIndex'](_0x182c6e[_0x65d6('0x37')],function(_0x1a9411){return _0x1a9411['profile'][_0x65d6('0x1a')]==='Administrator';});}return _0x182c6e[_0x65d6('0x37')][_0x4b262f];}else{if(_0x182c6e[_0x65d6('0x3c')][_0x65d6('0x3d')]['name']===_0x65d6('0x3e')){logger[_0x65d6('0x31')](_0x65d6('0x3b'));user=_0x182c6e['user'];return user;}else{logger[_0x65d6('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x65d6('0x3f')](_0x182c6e));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x65d6('0x3f')](_0x182c6e));}}}else{logger[_0x65d6('0x2e')](_0x65d6('0x40'),JSON['stringify'](_0x182c6e));throw new Error(_0x65d6('0x41')+JSON['stringify'](_0x182c6e));}})[_0x65d6('0x42')](function(_0x53d065){console[_0x65d6('0x2e')](_0x53d065);});}function getZohoUser(_0x3a21fb,_0x5d65c4){return new BPromise(function(_0x5daaa4,_0x296b95){request(_0x3a21fb)['then'](function(_0x1b6f93){var _0x1eab8d=null;if(_0x1b6f93){_0x1eab8d=_0x1b6f93[_0x65d6('0x43')][0x0];_0x1eab8d['enduserType']=_0x5d65c4;}_0x5daaa4(_0x1eab8d);})[_0x65d6('0x42')](function(_0x566f70){_0x296b95(_0x566f70);});});}function createEndUser(_0x3cf235,_0x2214bd,_0x380b2a,_0x4b32a4,_0x289de5,_0x45d8e1){var _0x380b2a=getName(_0x380b2a);return request({'method':_0x65d6('0x27'),'uri':_0x65d6('0x44')+_0x2214bd+_0x65d6('0x45')+_['startCase'](_0x45d8e1[_0x65d6('0x46')])+'s','body':{'data':[{'Last_Name':_0x380b2a[0x1],'First_Name':_0x380b2a[0x0],'Phone':_0x4b32a4,'Owner':{'name':!_[_0x65d6('0x1e')](_0x289de5[_0x65d6('0x47')][_0x65d6('0x1a')])?_0x289de5[_0x65d6('0x47')][_0x65d6('0x1a')]:!_[_0x65d6('0x1e')](_0x289de5[_0x65d6('0x48')])?_0x289de5['first_name']+'\x20'+_0x289de5[_0x65d6('0x49')]:_0x289de5[_0x65d6('0x49')],'id':_0x289de5['id']}}]},'headers':{'Authorization':_0x65d6('0x4a')+_0x3cf235},'json':!![]})['then'](function(_0x48d6c8){if(_0x48d6c8&&_0x48d6c8[_0x65d6('0x43')][0x0][_0x65d6('0x4b')]===_0x65d6('0x4c')){var _0xef63aa=_0x48d6c8[_0x65d6('0x43')][0x0][_0x65d6('0x4d')];_0xef63aa[_0x65d6('0x4e')]=_[_0x65d6('0x4f')](_0x45d8e1['moduleCreate'])+'s';return _0xef63aa;}logger[_0x65d6('0x2e')](_0x65d6('0x40'),JSON[_0x65d6('0x3f')](data));throw new Error(_0x65d6('0x50')+JSON[_0x65d6('0x3f')](data));})[_0x65d6('0x42')](function(_0x170b8e){console['log'](_0x65d6('0x51'),_0x170b8e);});}function getEndUser(_0x1ca0b6,_0x8d4a40,_0x181a2a,_0x5084e3,_0x42b2d2,_0x2b9df,_0x31964){var _0x1df2b2={'method':_0x65d6('0x33'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1ca0b6},'json':!![]};switch(_0x31964[_0x65d6('0x52')]){case _0x65d6('0x53'):_0x1df2b2[_0x65d6('0x54')]=_0x65d6('0x44')+_0x8d4a40+_0x65d6('0x55')+_0x42b2d2+'))';return getZohoUser(_0x1df2b2,'Contacts')['then'](function(_0x1f6071){if(_0x1f6071)return _0x1f6071;_0x1df2b2[_0x65d6('0x54')]=_0x65d6('0x44')+_0x8d4a40+_0x65d6('0x56')+_0x42b2d2+'))';return getZohoUser(_0x1df2b2,_0x65d6('0x57'))['then'](function(_0x4351b){if(_0x4351b)return _0x4351b;if(_0x31964[_0x65d6('0x46')]!=_0x65d6('0x58')){return createEndUser(_0x1ca0b6,_0x8d4a40,_0x5084e3,_0x42b2d2,_0x2b9df,_0x31964);}else{return{};}});});break;case'contact':_0x1df2b2[_0x65d6('0x54')]=_0x65d6('0x44')+_0x8d4a40+_0x65d6('0x55')+_0x42b2d2+'))';return getZohoUser(_0x1df2b2,_0x65d6('0x59'))[_0x65d6('0x36')](function(_0x2f0ebb){if(_0x2f0ebb)return _0x2f0ebb;if(_0x31964['moduleCreate']!=_0x65d6('0x58')){return createEndUser(_0x1ca0b6,_0x8d4a40,_0x5084e3,_0x42b2d2,_0x2b9df,_0x31964);}else{return{};}});break;case _0x65d6('0x5a'):_0x1df2b2[_0x65d6('0x54')]=_0x65d6('0x44')+_0x8d4a40+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x42b2d2+'))';return getZohoUser(_0x1df2b2,_0x65d6('0x57'))[_0x65d6('0x36')](function(_0x4cd5e0){if(_0x4cd5e0)return _0x4cd5e0;if(_0x31964[_0x65d6('0x46')]!=_0x65d6('0x58')){return createEndUser(_0x1ca0b6,_0x8d4a40,_0x5084e3,_0x42b2d2,_0x2b9df,_0x31964);}else{return{};}});break;}}function getCall(_0x2c0597,_0x271e07,_0x28026a,_0x30027b,_0x7f960b,_0x57cf5c,_0x27a729,_0x255c54){logger['info']('Creating\x20new\x20call...');var _0x5a1520={};_0x5a1520[_0x65d6('0x5b')]={'name':!_[_0x65d6('0x1e')](_0x30027b[_0x65d6('0x47')][_0x65d6('0x1a')])&&!_['isNil'](_0x30027b['profile'][_0x65d6('0x1a')])&&_0x30027b[_0x65d6('0x3d')]['name']===_0x65d6('0x5c')?_0x30027b[_0x65d6('0x47')]['name']:!_[_0x65d6('0x1e')](_0x30027b[_0x65d6('0x48')])?_0x30027b[_0x65d6('0x48')]+'\x20'+_0x30027b[_0x65d6('0x49')]:_0x30027b['last_name'],'id':_0x30027b['id']};_0x5a1520[_0x65d6('0x5d')]=intUtil[_0x65d6('0x5e')](_0x57cf5c['Subjects'],_0x27a729,'\x20');_0x5a1520['Description']=intUtil['getString'](_0x57cf5c[_0x65d6('0x5f')],_0x27a729,'\x0a');if(_0x7f960b[_0x65d6('0x4e')]==='Contacts'){_0x5a1520[_0x65d6('0x60')]={'name':!_['isNil'](_0x7f960b[_0x65d6('0x61')])?_0x7f960b[_0x65d6('0x61')]:!_[_0x65d6('0x1e')](_0x7f960b['First_Name'])?_0x7f960b[_0x65d6('0x62')]+'\x20'+_0x7f960b['Last_Name']:_0x7f960b[_0x65d6('0x63')],'id':_0x7f960b['id']};}if(_0x7f960b['enduserType']===_0x65d6('0x57')){_0x5a1520['What_Id']={'name':!_[_0x65d6('0x1e')](_0x7f960b[_0x65d6('0x61')])?_0x7f960b[_0x65d6('0x61')]:!_[_0x65d6('0x1e')](_0x7f960b[_0x65d6('0x62')])?_0x7f960b[_0x65d6('0x62')]+'\x20'+_0x7f960b[_0x65d6('0x63')]:_0x7f960b[_0x65d6('0x63')],'id':_0x7f960b['id']};_0x5a1520[_0x65d6('0x64')]=_[_0x65d6('0x4f')](_0x7f960b[_0x65d6('0x4e')]);}if(_0x27a729[_0x65d6('0x65')]){_0x5a1520[_0x65d6('0x66')]=moment['utc'](parseInt(_0x27a729['talktime'])*0x3e8)[_0x65d6('0x34')](_0x65d6('0x67'));}else if(_0x27a729[_0x65d6('0x68')]&&_0x27a729['endtime']){_0x5a1520[_0x65d6('0x66')]=moment[_0x65d6('0x69')](moment(_0x27a729[_0x65d6('0x6a')],'YYYY-MM-DDTHH:mm:ss')[_0x65d6('0x6b')](moment(_0x27a729['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0x65d6('0x34')](_0x65d6('0x67'));}switch(_0x27a729[_0x65d6('0x6c')]){case _0x65d6('0x6d'):_0x5a1520['Call_Result']=_0x65d6('0x6e');break;case _0x65d6('0x6f'):case _0x65d6('0x70'):_0x5a1520[_0x65d6('0x71')]=_0x65d6('0x72');break;case _0x65d6('0x73'):_0x5a1520[_0x65d6('0x71')]=_0x65d6('0x74');break;case _0x65d6('0x75'):_0x5a1520[_0x65d6('0x71')]=_0x65d6('0x76');break;case'timeout':_0x5a1520[_0x65d6('0x71')]=_0x65d6('0x77');default:}_0x5a1520['Call_Start_Time']=(_0x255c54===_0x65d6('0x78')?moment(_0x27a729['starttime'])[_0x65d6('0x34')](_0x65d6('0x79')):moment(_0x27a729['agentcalledAt'])[_0x65d6('0x34')](_0x65d6('0x79')))||moment()['format'](_0x65d6('0x79'));_0x5a1520['Call_Type']=_0x255c54||_0x65d6('0x7a');_0x5a1520=_[_0x65d6('0x7b')](_0x5a1520,getCustomFields(_0x57cf5c[_0x65d6('0x7c')],_0x27a729));return request({'method':'POST','uri':_0x65d6('0x44')+_0x271e07+'/crm/v2/Calls','headers':{'Authorization':_0x65d6('0x4a')+_0x2c0597},'body':{'data':[_0x5a1520]},'json':!![]})[_0x65d6('0x36')](function(_0x3c114e){if(_0x3c114e&&_0x3c114e[_0x65d6('0x43')][0x0][_0x65d6('0x4b')]===_0x65d6('0x4c')){logger[_0x65d6('0x31')](_0x65d6('0x7d'));return{'id':_0x3c114e[_0x65d6('0x43')][0x0]['details']['id']};}})[_0x65d6('0x42')](function(_0x30a455){logger[_0x65d6('0x31')]('err',_0x30a455['stack']);console[_0x65d6('0x7e')](_0x65d6('0x7f'),_0x30a455);});}exports[_0x65d6('0x80')]=function(_0x407136,_0x3b7061,_0x3e2035,_0x35700b,_0x15733e,_0x3fb37b){var _0xe0e61b,_0x10ace5,_0x5e4998;_0x3fb37b[_0x65d6('0x81')]=intUtil[_0x65d6('0x82')](_0x3fb37b[_0x65d6('0x81')]);_0x3fb37b[_0x65d6('0x83')]=intUtil[_0x65d6('0x82')](_0x3fb37b[_0x65d6('0x83')]);if(_0x15733e&&_0x15733e['monitor_format']){logger[_0x65d6('0x31')](_0x65d6('0x84'),_0x65d6('0x85'));_0x3b7061[_0x65d6('0x86')]=_0x3fb37b[_0x65d6('0x83')]+_0x65d6('0x87')+_0x3b7061[_0x65d6('0x88')]+_0x65d6('0x89')+md5(_0x3b7061[_0x65d6('0x88')]);}else{_0x3b7061['recordingURL']='';}var _0x14c923=_0x3fb37b[_0x65d6('0x81')]===_0x65d6('0x8a')?'eu':_0x65d6('0x8b');return getAccessToken(_0x3fb37b)[_0x65d6('0x36')](function(_0x44eb9){_0x5e4998=_0x44eb9;return getUser(_0x5e4998,_0x14c923,_0x3fb37b,_0x35700b[_0x65d6('0x39')]);})[_0x65d6('0x36')](function(_0x5030d5){_0xe0e61b=_0x5030d5;logger[_0x65d6('0x31')]('The\x20User\x20ID\x20is:',_0xe0e61b['id']);return getEndUser(_0x5e4998,_0x14c923,_0x3fb37b,_0x3b7061[_0x65d6('0x8c')],_0x3b7061['calleridnum'],_0xe0e61b,_0x3e2035);})['then'](function(_0x3f87be){_0x10ace5=_0x3f87be;return getCall(_0x5e4998,_0x14c923,_0x3fb37b,_0xe0e61b,_0x10ace5,_0x3e2035,_0x3b7061,_0x65d6('0x7a'));})[_0x65d6('0x36')](function(_0x399003){if(_0x399003){logger[_0x65d6('0x31')](_0x65d6('0x8d'),_0x399003['id']);logger[_0x65d6('0x31')](_0x65d6('0x84'),_0x65d6('0x8e'));emit(util[_0x65d6('0x34')](_0x65d6('0x8f'),_0x35700b[_0x65d6('0x1a')]),_0x65d6('0x90'),{'uri':_0x65d6('0x91')+_0x3fb37b['host']+_0x65d6('0x92')+_0x399003['id']});}})['catch'](function(_0x66dc5e){logger['error'](_0x65d6('0x84'),JSON[_0x65d6('0x3f')](_0x66dc5e));});};exports[_0x65d6('0x78')]=function(_0x33924d,_0x47142a,_0x5560d0,_0x20a3dd,_0x12aa36,_0x2ba1ee,_0xf50553){var _0x8a4ceb,_0x3d65db,_0x2272ce;_0x2ba1ee[_0x65d6('0x81')]=intUtil['stripTrailingSlash'](_0x2ba1ee[_0x65d6('0x81')]);_0x2ba1ee['serverUrl']=intUtil[_0x65d6('0x82')](_0x2ba1ee['serverUrl']);if(_0xf50553&&_0xf50553[_0x65d6('0x93')]&&_0xf50553[_0x65d6('0x93')]!==_0x65d6('0x94')){logger['info']('[OUTBOUND]',_0x65d6('0x85'));_0x47142a[_0x65d6('0x86')]=_0x2ba1ee[_0x65d6('0x83')]+_0x65d6('0x87')+_0x47142a[_0x65d6('0x88')]+_0x65d6('0x89')+md5(_0x47142a[_0x65d6('0x88')]);}var _0x3afe34=_0x2ba1ee[_0x65d6('0x81')]===_0x65d6('0x8a')?'eu':_0x65d6('0x8b');return getAccessToken(_0x2ba1ee)[_0x65d6('0x36')](function(_0x492c79){_0x2272ce=_0x492c79;return getUser(_0x2272ce,_0x3afe34,_0x2ba1ee,_0x20a3dd[_0x65d6('0x39')]);})[_0x65d6('0x36')](function(_0x5d1b31){_0x8a4ceb=_0x5d1b31;logger[_0x65d6('0x31')](_0x65d6('0x95'),_0x8a4ceb['id']);return getEndUser(_0x2272ce,_0x3afe34,_0x2ba1ee,_0x47142a[_0x65d6('0x96')],_0x47142a[_0x65d6('0x97')],_0x8a4ceb,_0x5560d0);})[_0x65d6('0x36')](function(_0x44956c){_0x3d65db=_0x44956c;return getCall(_0x2272ce,_0x3afe34,_0x2ba1ee,_0x8a4ceb,_0x3d65db,_0x5560d0,_0x47142a,'Outbound');})[_0x65d6('0x36')](function(_0x452403){if(_0x452403){logger[_0x65d6('0x31')](_0x65d6('0x8d'),_0x452403['id']);logger['info'](_0x65d6('0x98'),_0x65d6('0x8e'));emit(util[_0x65d6('0x34')](_0x65d6('0x8f'),_0x20a3dd[_0x65d6('0x1a')]),_0x65d6('0x90'),{'uri':'https://crm.'+_0x2ba1ee[_0x65d6('0x81')]+'/crm/EntityInfo.do?module=Calls&id='+_0x452403['id']});}})['catch'](function(_0x2ee05a){logger[_0x65d6('0x2e')]('[OUTBOUND]',JSON[_0x65d6('0x3f')](_0x2ee05a));});};exports[_0x65d6('0x99')]=function(_0x2726cf,_0x5e9865,_0x8b54a0,_0xff881b,_0x420ea4,_0x4f85a1){var _0x37218d,_0x4ad136,_0x573cf6;_0x4f85a1[_0x65d6('0x81')]=intUtil['stripTrailingSlash'](_0x4f85a1[_0x65d6('0x81')]);_0x4f85a1[_0x65d6('0x83')]=intUtil[_0x65d6('0x82')](_0x4f85a1[_0x65d6('0x83')]);if(_0x420ea4&&_0x420ea4['monitor_format']){logger[_0x65d6('0x31')]('['+_0x5e9865[_0x65d6('0x6c')][_0x65d6('0x9a')]()+']','Recording\x20is\x20enabled!');_0x5e9865[_0x65d6('0x86')]=_0x4f85a1['serverUrl']+_0x65d6('0x87')+_0x5e9865[_0x65d6('0x88')]+_0x65d6('0x89')+md5(_0x5e9865[_0x65d6('0x88')]);}else{_0x5e9865['recordingURL']='';}var _0x53d24d=_0x4f85a1[_0x65d6('0x81')]===_0x65d6('0x8a')?'eu':_0x65d6('0x8b');return getAccessToken(_0x4f85a1)[_0x65d6('0x36')](function(_0x3b51ad){_0x573cf6=_0x3b51ad;return getUser(_0x573cf6,_0x53d24d,_0x4f85a1);})[_0x65d6('0x36')](function(_0x570b87){_0x37218d=_0x570b87;logger['info'](_0x65d6('0x95'),_0x37218d['id']);return getEndUser(_0x573cf6,_0x53d24d,_0x4f85a1,_0x5e9865[_0x65d6('0x8c')],_0x5e9865['calleridnum'],_0x37218d,_0x8b54a0);})['then'](function(_0x2b8e85){_0x4ad136=_0x2b8e85;return getCall(_0x573cf6,_0x53d24d,_0x4f85a1,_0x37218d,_0x4ad136,_0x8b54a0,_0x5e9865,'Inbound');})[_0x65d6('0x36')](function(_0x86aac9){if(_0x86aac9){logger[_0x65d6('0x31')](_0x65d6('0x8d'),_0x86aac9['id']);}})['catch'](function(_0x494947){logger['error']('['+_0x5e9865[_0x65d6('0x6c')][_0x65d6('0x9a')]()+']',JSON['stringify'](_0x494947));});}; \ No newline at end of file +var _0xf505=['lastevent','called','Call_Result','complete','connect','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','recordingURL','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/downloads?type=uniqueid&token=','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','string','picklist','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','nothing','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime'];(function(_0x1ac9be,_0x529cba){var _0x5482db=function(_0x47e6e5){while(--_0x47e6e5){_0x1ac9be['push'](_0x1ac9be['shift']());}};_0x5482db(++_0x529cba);}(_0xf505,0x172));var _0x5f50=function(_0x2a6501,_0x9c5a0e){_0x2a6501=_0x2a6501-0x0;var _0x34d3ae=_0xf505[_0x2a6501];return _0x34d3ae;};'use strict';var _=require(_0x5f50('0x0'));var rp=require('request-promise');var md5=require(_0x5f50('0x1'));var util=require(_0x5f50('0x2'));var intUtil=require(_0x5f50('0x3'));var moment=require(_0x5f50('0x4'));var Redis=require(_0x5f50('0x5'));var BPromise=require(_0x5f50('0x6'));var config=require(_0x5f50('0x7'));var logger=require('../../../../config/logger')('zoho');config[_0x5f50('0x8')]=_[_0x5f50('0x9')](config[_0x5f50('0x8')],{'host':_0x5f50('0xa'),'port':0x18eb});var io=require(_0x5f50('0xb'))(new Redis(config[_0x5f50('0x8')]));function emit(_0x157a3a,_0x4740e8,_0x7dcb7a){io['to'](_0x157a3a)[_0x5f50('0xc')](_0x4740e8,_0x7dcb7a);}function request(_0x4dbac5){logger[_0x5f50('0xd')](_0x5f50('0xe'),JSON[_0x5f50('0xf')](_0x4dbac5));return rp(_0x4dbac5);}function getCustomFields(_0x408cf9,_0x184cbb){var _0x593ec6={};if(_0x408cf9[_0x5f50('0x10')]>0x0){_[_0x5f50('0x11')](_0x408cf9,function(_0x5d0c0){if(_['includes']([_0x5f50('0x12'),_0x5f50('0x13')],_0x5d0c0['type'])&&_0x5d0c0['idField']){_0x593ec6[_0x5d0c0[_0x5f50('0x14')]]=_0x5d0c0['content'][_0x5f50('0x15')]();}else if(_0x5d0c0['type']===_0x5f50('0x16')&&_0x5d0c0[_0x5f50('0x17')]&&_0x5d0c0[_0x5f50('0x14')]&&_0x184cbb[_0x5d0c0[_0x5f50('0x17')]]){_0x593ec6[_0x5d0c0[_0x5f50('0x14')]]=_0x184cbb[_0x5d0c0[_0x5f50('0x17')]][_0x5f50('0x15')]();}else if(_0x5d0c0['type']===_0x5f50('0x18')&&_0x5d0c0[_0x5f50('0x19')]&&_0x5d0c0[_0x5f50('0x19')]['name']&&_0x5d0c0['idField']&&_0x184cbb[_0x5d0c0[_0x5f50('0x19')]['name']['toLowerCase']()]){_0x593ec6[_0x5d0c0[_0x5f50('0x14')]]=_0x184cbb[_0x5d0c0[_0x5f50('0x19')][_0x5f50('0x1a')][_0x5f50('0x1b')]()][_0x5f50('0x15')]();}});}return _0x593ec6;}function getName(_0x81fe12){if(_0x81fe12['indexOf']('\x20')>0x0){var _0x208ea0=_0x81fe12[_0x5f50('0x1c')](/ (.+)/);if(_0x208ea0[0x1]){return _0x208ea0;}}return[_0x81fe12,_0x81fe12];}var accountsTokens={};function getAccessToken(_0x30cfcf){return new Promise(function(_0x287af5,_0xb436be){if(!_[_0x5f50('0x1d')](accountsTokens[_0x30cfcf['id']])&&!_['isNil'](accountsTokens[_0x30cfcf['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x30cfcf['id']][_0x5f50('0x1e')])){_0x287af5(accountsTokens[_0x30cfcf['id']][_0x5f50('0x1f')]);}}var _0x4c6d49;switch(_0x30cfcf[_0x5f50('0x20')]){case'US':_0x4c6d49=_0x5f50('0x21');break;case'AU':_0x4c6d49=_0x5f50('0x22');break;case'EU':_0x4c6d49=_0x5f50('0x23');break;case'IN':_0x4c6d49=_0x5f50('0x24');break;case'CN':_0x4c6d49=_0x5f50('0x25');break;default:_0x4c6d49='https://accounts.zoho.eu';break;}var _0x346a2d={'method':_0x5f50('0x26'),'uri':_0x4c6d49+_0x5f50('0x27'),'qs':{'refresh_token':_0x30cfcf[_0x5f50('0x28')],'client_id':_0x30cfcf[_0x5f50('0x29')],'client_secret':_0x30cfcf[_0x5f50('0x2a')],'grant_type':_0x5f50('0x2b')},'json':!![]};return rp(_0x346a2d)[_0x5f50('0x2c')](function(_0x4dda3a){accountsTokens[_0x30cfcf['id']]={'access_token':_0x4dda3a[_0x5f50('0x1f')],'expires_in':moment()['add'](_0x4dda3a[_0x5f50('0x1e')],_0x5f50('0x2d'))};_0x287af5(_0x4dda3a['access_token']);})['catch'](function(_0x3aa8e1){logger[_0x5f50('0x2e')](_0x5f50('0x2f'),_0x3aa8e1[_0x5f50('0x30')]);_0xb436be(_0x3aa8e1);});});}function getUser(_0xa1f83b,_0x3ac3fd,_0x2e31d7,_0x151e01){logger['info'](_0x5f50('0x31'));return request({'method':'GET','uri':util[_0x5f50('0x32')](_0x5f50('0x33'),_0x3ac3fd),'qs':{'type':_0x5f50('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xa1f83b},'json':!![]})[_0x5f50('0x2c')](function(_0x5c8c52){if(_0x5c8c52[_0x5f50('0x35')]){var _0x5cf945=-0x1;if(_[_0x5f50('0x36')](_0x5c8c52[_0x5f50('0x35')])){if(!_[_0x5f50('0x1d')](_0x151e01)){_0x5cf945=_['findIndex'](_0x5c8c52[_0x5f50('0x35')],function(_0xd849ef){return _0xd849ef['email']===_0x151e01;});}if(_0x5cf945>=0x0){logger[_0x5f50('0x37')](_0x5f50('0x38'));}else{logger[_0x5f50('0x37')](_0x5f50('0x39'));_0x5cf945=_['findIndex'](_0x5c8c52[_0x5f50('0x35')],function(_0x14eaa4){return _0x14eaa4[_0x5f50('0x3a')][_0x5f50('0x1a')]===_0x5f50('0x3b');});}return _0x5c8c52[_0x5f50('0x35')][_0x5cf945];}else{if(_0x5c8c52[_0x5f50('0x3c')]['profile'][_0x5f50('0x1a')]===_0x5f50('0x3b')){logger[_0x5f50('0x37')]('Using\x20the\x20admin\x20account!');user=_0x5c8c52[_0x5f50('0x3c')];return user;}else{logger[_0x5f50('0x2e')](_0x5f50('0x3d'),JSON[_0x5f50('0xf')](_0x5c8c52));throw new Error(_0x5f50('0x3e')+JSON[_0x5f50('0xf')](_0x5c8c52));}}}else{logger[_0x5f50('0x2e')](_0x5f50('0x3d'),JSON[_0x5f50('0xf')](_0x5c8c52));throw new Error(_0x5f50('0x3e')+JSON['stringify'](_0x5c8c52));}})[_0x5f50('0x3f')](function(_0x391735){console[_0x5f50('0x2e')](_0x391735);});}function getZohoUser(_0x5b46fa,_0x10a647){return new BPromise(function(_0x1a3d9c,_0x299c23){request(_0x5b46fa)[_0x5f50('0x2c')](function(_0x44a678){var _0x568a13=null;if(_0x44a678){_0x568a13=_0x44a678[_0x5f50('0x40')][0x0];_0x568a13[_0x5f50('0x41')]=_0x10a647;}_0x1a3d9c(_0x568a13);})['catch'](function(_0x328c73){_0x299c23(_0x328c73);});});}function createEndUser(_0x5f4ced,_0x2275f1,_0x21b47,_0x45c6ad,_0x159c55,_0x45ad18){var _0x21b47=getName(_0x21b47);return request({'method':'POST','uri':_0x5f50('0x42')+_0x2275f1+_0x5f50('0x43')+_[_0x5f50('0x44')](_0x45ad18[_0x5f50('0x45')])+'s','body':{'data':[{'Last_Name':_0x21b47[0x1],'First_Name':_0x21b47[0x0],'Phone':_0x45c6ad,'Owner':{'name':!_[_0x5f50('0x1d')](_0x159c55[_0x5f50('0x46')][_0x5f50('0x1a')])?_0x159c55[_0x5f50('0x46')][_0x5f50('0x1a')]:!_[_0x5f50('0x1d')](_0x159c55[_0x5f50('0x47')])?_0x159c55[_0x5f50('0x47')]+'\x20'+_0x159c55[_0x5f50('0x48')]:_0x159c55[_0x5f50('0x48')],'id':_0x159c55['id']}}]},'headers':{'Authorization':_0x5f50('0x49')+_0x5f4ced},'json':!![]})[_0x5f50('0x2c')](function(_0x4e4a0d){if(_0x4e4a0d&&_0x4e4a0d[_0x5f50('0x40')][0x0][_0x5f50('0x4a')]===_0x5f50('0x4b')){var _0x320d34=_0x4e4a0d[_0x5f50('0x40')][0x0][_0x5f50('0x4c')];_0x320d34[_0x5f50('0x41')]=_[_0x5f50('0x44')](_0x45ad18[_0x5f50('0x45')])+'s';return _0x320d34;}logger['error'](_0x5f50('0x3d'),JSON[_0x5f50('0xf')](data));throw new Error(_0x5f50('0x4d')+JSON['stringify'](data));})[_0x5f50('0x3f')](function(_0x1ab118){console[_0x5f50('0x4e')](_0x5f50('0x4f'),_0x1ab118);});}function getEndUser(_0x1787b2,_0xd7b976,_0x46ee80,_0x5a7aff,_0x258d87,_0x5229ec,_0x5c6668){var _0x4a8a7b={'method':_0x5f50('0x50'),'uri':'','headers':{'Authorization':_0x5f50('0x49')+_0x1787b2},'json':!![]};switch(_0x5c6668[_0x5f50('0x51')]){case _0x5f50('0x52'):_0x4a8a7b[_0x5f50('0x53')]='https://www.zohoapis.'+_0xd7b976+_0x5f50('0x54')+_0x258d87+'))';return getZohoUser(_0x4a8a7b,'Contacts')[_0x5f50('0x2c')](function(_0x503b64){if(_0x503b64)return _0x503b64;_0x4a8a7b['uri']=_0x5f50('0x42')+_0xd7b976+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x258d87+'))';return getZohoUser(_0x4a8a7b,_0x5f50('0x55'))[_0x5f50('0x2c')](function(_0x5c9292){if(_0x5c9292)return _0x5c9292;if(_0x5c6668[_0x5f50('0x45')]!=_0x5f50('0x56')){return createEndUser(_0x1787b2,_0xd7b976,_0x5a7aff,_0x258d87,_0x5229ec,_0x5c6668);}else{return{};}});});break;case'contact':_0x4a8a7b[_0x5f50('0x53')]=_0x5f50('0x42')+_0xd7b976+_0x5f50('0x54')+_0x258d87+'))';return getZohoUser(_0x4a8a7b,_0x5f50('0x57'))[_0x5f50('0x2c')](function(_0x598da2){if(_0x598da2)return _0x598da2;if(_0x5c6668[_0x5f50('0x45')]!=_0x5f50('0x56')){return createEndUser(_0x1787b2,_0xd7b976,_0x5a7aff,_0x258d87,_0x5229ec,_0x5c6668);}else{return{};}});break;case _0x5f50('0x58'):_0x4a8a7b[_0x5f50('0x53')]=_0x5f50('0x42')+_0xd7b976+_0x5f50('0x59')+_0x258d87+'))';return getZohoUser(_0x4a8a7b,_0x5f50('0x55'))[_0x5f50('0x2c')](function(_0x4aebb1){if(_0x4aebb1)return _0x4aebb1;if(_0x5c6668[_0x5f50('0x45')]!=_0x5f50('0x56')){return createEndUser(_0x1787b2,_0xd7b976,_0x5a7aff,_0x258d87,_0x5229ec,_0x5c6668);}else{return{};}});break;}}function getCall(_0x224cea,_0x588490,_0x42f4be,_0x53f337,_0x288324,_0x2ebbee,_0x2ad1ba,_0x356c28){logger[_0x5f50('0x37')](_0x5f50('0x5a'));var _0x5bd7a2={};_0x5bd7a2[_0x5f50('0x5b')]={'name':!_[_0x5f50('0x1d')](_0x53f337[_0x5f50('0x46')][_0x5f50('0x1a')])&&!_['isNil'](_0x53f337['profile'][_0x5f50('0x1a')])&&_0x53f337[_0x5f50('0x3a')]['name']===_0x5f50('0x5c')?_0x53f337[_0x5f50('0x46')][_0x5f50('0x1a')]:!_['isNil'](_0x53f337[_0x5f50('0x47')])?_0x53f337['first_name']+'\x20'+_0x53f337[_0x5f50('0x48')]:_0x53f337[_0x5f50('0x48')],'id':_0x53f337['id']};_0x5bd7a2[_0x5f50('0x5d')]=intUtil[_0x5f50('0x5e')](_0x2ebbee[_0x5f50('0x5f')],_0x2ad1ba,'\x20');_0x5bd7a2[_0x5f50('0x60')]=intUtil[_0x5f50('0x5e')](_0x2ebbee[_0x5f50('0x61')],_0x2ad1ba,'\x0a');if(_0x288324[_0x5f50('0x41')]===_0x5f50('0x57')){_0x5bd7a2[_0x5f50('0x62')]={'name':!_[_0x5f50('0x1d')](_0x288324['Full_Name'])?_0x288324['Full_Name']:!_[_0x5f50('0x1d')](_0x288324['First_Name'])?_0x288324[_0x5f50('0x63')]+'\x20'+_0x288324[_0x5f50('0x64')]:_0x288324[_0x5f50('0x64')],'id':_0x288324['id']};}if(_0x288324['enduserType']===_0x5f50('0x55')){_0x5bd7a2[_0x5f50('0x65')]={'name':!_[_0x5f50('0x1d')](_0x288324[_0x5f50('0x66')])?_0x288324[_0x5f50('0x66')]:!_[_0x5f50('0x1d')](_0x288324[_0x5f50('0x63')])?_0x288324[_0x5f50('0x63')]+'\x20'+_0x288324[_0x5f50('0x64')]:_0x288324[_0x5f50('0x64')],'id':_0x288324['id']};_0x5bd7a2[_0x5f50('0x67')]=_[_0x5f50('0x44')](_0x288324[_0x5f50('0x41')]);}if(_0x2ad1ba[_0x5f50('0x68')]){_0x5bd7a2['Call_Duration']=moment[_0x5f50('0x69')](parseInt(_0x2ad1ba['talktime'])*0x3e8)[_0x5f50('0x32')](_0x5f50('0x6a'));}else if(_0x2ad1ba[_0x5f50('0x6b')]&&_0x2ad1ba[_0x5f50('0x6c')]){_0x5bd7a2[_0x5f50('0x6d')]=moment['utc'](moment(_0x2ad1ba[_0x5f50('0x6c')],_0x5f50('0x6e'))[_0x5f50('0x6f')](moment(_0x2ad1ba[_0x5f50('0x70')],_0x5f50('0x6e'))))[_0x5f50('0x32')](_0x5f50('0x6a'));}switch(_0x2ad1ba[_0x5f50('0x71')]){case _0x5f50('0x72'):_0x5bd7a2[_0x5f50('0x73')]='Called';break;case _0x5f50('0x74'):case _0x5f50('0x75'):_0x5bd7a2['Call_Result']=_0x5f50('0x76');break;case'rejected':_0x5bd7a2[_0x5f50('0x73')]=_0x5f50('0x77');break;case _0x5f50('0x78'):_0x5bd7a2[_0x5f50('0x73')]=_0x5f50('0x79');break;case _0x5f50('0x7a'):_0x5bd7a2['Call_Result']=_0x5f50('0x7b');default:}_0x5bd7a2['Call_Start_Time']=(_0x356c28===_0x5f50('0x7c')?moment(_0x2ad1ba['starttime'])[_0x5f50('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x2ad1ba[_0x5f50('0x7d')])['format'](_0x5f50('0x6e')))||moment()[_0x5f50('0x32')](_0x5f50('0x6e'));_0x5bd7a2['Call_Type']=_0x356c28||_0x5f50('0x7e');_0x5bd7a2=_['merge'](_0x5bd7a2,getCustomFields(_0x2ebbee[_0x5f50('0x7f')],_0x2ad1ba));return request({'method':_0x5f50('0x26'),'uri':'https://www.zohoapis.'+_0x588490+_0x5f50('0x80'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x224cea},'body':{'data':[_0x5bd7a2]},'json':!![]})[_0x5f50('0x2c')](function(_0x474355){if(_0x474355&&_0x474355[_0x5f50('0x40')][0x0]['code']===_0x5f50('0x4b')){logger[_0x5f50('0x37')](_0x5f50('0x81'));return{'id':_0x474355[_0x5f50('0x40')][0x0][_0x5f50('0x4c')]['id']};}})[_0x5f50('0x3f')](function(_0x45a2f0){logger['info'](_0x5f50('0x82'),_0x45a2f0[_0x5f50('0x30')]);console['log']('err',_0x45a2f0);});}exports[_0x5f50('0x83')]=function(_0x5d892e,_0x2b2266,_0x28bd2c,_0x48598e,_0x502a1a,_0x12459b){var _0x543b66,_0x628683,_0x1ac3c6;_0x12459b[_0x5f50('0x84')]=intUtil[_0x5f50('0x85')](_0x12459b[_0x5f50('0x84')]);_0x12459b[_0x5f50('0x86')]=intUtil['stripTrailingSlash'](_0x12459b[_0x5f50('0x86')]);if(_0x502a1a&&_0x502a1a['monitor_format']){logger[_0x5f50('0x37')](_0x5f50('0x87'),_0x5f50('0x88'));_0x2b2266['recordingURL']=_0x12459b[_0x5f50('0x86')]+_0x5f50('0x89')+_0x2b2266['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x2b2266[_0x5f50('0x8a')]);}else{_0x2b2266[_0x5f50('0x8b')]='';}var _0x2d6340=_0x12459b[_0x5f50('0x84')]===_0x5f50('0x8c')?'eu':_0x5f50('0x8d');return getAccessToken(_0x12459b)[_0x5f50('0x2c')](function(_0x3c4223){_0x1ac3c6=_0x3c4223;return getUser(_0x1ac3c6,_0x2d6340,_0x12459b,_0x48598e[_0x5f50('0x8e')]);})[_0x5f50('0x2c')](function(_0xc74a4b){_0x543b66=_0xc74a4b;logger[_0x5f50('0x37')](_0x5f50('0x8f'),_0x543b66['id']);return getEndUser(_0x1ac3c6,_0x2d6340,_0x12459b,_0x2b2266[_0x5f50('0x90')],_0x2b2266[_0x5f50('0x91')],_0x543b66,_0x28bd2c);})[_0x5f50('0x2c')](function(_0x1282eb){_0x628683=_0x1282eb;return getCall(_0x1ac3c6,_0x2d6340,_0x12459b,_0x543b66,_0x628683,_0x28bd2c,_0x2b2266,_0x5f50('0x7e'));})[_0x5f50('0x2c')](function(_0x309778){if(_0x309778){logger[_0x5f50('0x37')]('The\x20Call\x20ID\x20is:',_0x309778['id']);logger['info'](_0x5f50('0x87'),_0x5f50('0x92'));emit(util[_0x5f50('0x32')](_0x5f50('0x93'),_0x48598e[_0x5f50('0x1a')]),_0x5f50('0x94'),{'uri':_0x5f50('0x95')+_0x12459b[_0x5f50('0x84')]+_0x5f50('0x96')+_0x309778['id']});}})[_0x5f50('0x3f')](function(_0x10394a){logger[_0x5f50('0x2e')](_0x5f50('0x87'),JSON['stringify'](_0x10394a));});};exports[_0x5f50('0x7c')]=function(_0x40c402,_0x354d94,_0x487efe,_0x35e69e,_0x3773e4,_0x327c51,_0x5ebc14){var _0x189b10,_0x5c39cd,_0x1091f4;_0x327c51[_0x5f50('0x84')]=intUtil[_0x5f50('0x85')](_0x327c51[_0x5f50('0x84')]);_0x327c51[_0x5f50('0x86')]=intUtil['stripTrailingSlash'](_0x327c51[_0x5f50('0x86')]);if(_0x5ebc14&&_0x5ebc14[_0x5f50('0x97')]&&_0x5ebc14[_0x5f50('0x97')]!==_0x5f50('0x98')){logger[_0x5f50('0x37')]('[OUTBOUND]',_0x5f50('0x88'));_0x354d94[_0x5f50('0x8b')]=_0x327c51[_0x5f50('0x86')]+_0x5f50('0x89')+_0x354d94[_0x5f50('0x8a')]+_0x5f50('0x99')+md5(_0x354d94[_0x5f50('0x8a')]);}var _0x4f50d2=_0x327c51['host']===_0x5f50('0x8c')?'eu':_0x5f50('0x8d');return getAccessToken(_0x327c51)[_0x5f50('0x2c')](function(_0x451906){_0x1091f4=_0x451906;return getUser(_0x1091f4,_0x4f50d2,_0x327c51,_0x35e69e['email']);})[_0x5f50('0x2c')](function(_0xa95179){_0x189b10=_0xa95179;logger[_0x5f50('0x37')](_0x5f50('0x8f'),_0x189b10['id']);return getEndUser(_0x1091f4,_0x4f50d2,_0x327c51,_0x354d94['destcalleridname'],_0x354d94[_0x5f50('0x9a')],_0x189b10,_0x487efe);})[_0x5f50('0x2c')](function(_0x278aea){_0x5c39cd=_0x278aea;return getCall(_0x1091f4,_0x4f50d2,_0x327c51,_0x189b10,_0x5c39cd,_0x487efe,_0x354d94,_0x5f50('0x9b'));})[_0x5f50('0x2c')](function(_0x3efa0b){if(_0x3efa0b){logger[_0x5f50('0x37')](_0x5f50('0x9c'),_0x3efa0b['id']);logger[_0x5f50('0x37')](_0x5f50('0x9d'),_0x5f50('0x92'));emit(util['format']('user:%s',_0x35e69e[_0x5f50('0x1a')]),'trigger:browser:url',{'uri':_0x5f50('0x95')+_0x327c51[_0x5f50('0x84')]+_0x5f50('0x96')+_0x3efa0b['id']});}})['catch'](function(_0x3adc27){logger[_0x5f50('0x2e')]('[OUTBOUND]',JSON[_0x5f50('0xf')](_0x3adc27));});};exports[_0x5f50('0x9e')]=function(_0x4b788f,_0x351d7f,_0x40a1b9,_0x251038,_0x3eb7bb,_0x50cdbd){var _0x53bac8,_0x37cc85,_0x2fb5fe;_0x50cdbd['host']=intUtil[_0x5f50('0x85')](_0x50cdbd[_0x5f50('0x84')]);_0x50cdbd['serverUrl']=intUtil['stripTrailingSlash'](_0x50cdbd['serverUrl']);if(_0x3eb7bb&&_0x3eb7bb[_0x5f50('0x9f')]){logger[_0x5f50('0x37')]('['+_0x351d7f['lastevent'][_0x5f50('0xa0')]()+']',_0x5f50('0x88'));_0x351d7f[_0x5f50('0x8b')]=_0x50cdbd[_0x5f50('0x86')]+_0x5f50('0x89')+_0x351d7f[_0x5f50('0x8a')]+_0x5f50('0x99')+md5(_0x351d7f[_0x5f50('0x8a')]);}else{_0x351d7f[_0x5f50('0x8b')]='';}var _0x5d5764=_0x50cdbd[_0x5f50('0x84')]==='zoho.eu'?'eu':_0x5f50('0x8d');return getAccessToken(_0x50cdbd)[_0x5f50('0x2c')](function(_0x2e8902){_0x2fb5fe=_0x2e8902;return getUser(_0x2fb5fe,_0x5d5764,_0x50cdbd);})[_0x5f50('0x2c')](function(_0x5a8554){_0x53bac8=_0x5a8554;logger[_0x5f50('0x37')]('The\x20User\x20ID\x20is:',_0x53bac8['id']);return getEndUser(_0x2fb5fe,_0x5d5764,_0x50cdbd,_0x351d7f['calleridname'],_0x351d7f[_0x5f50('0x91')],_0x53bac8,_0x40a1b9);})[_0x5f50('0x2c')](function(_0x256470){_0x37cc85=_0x256470;return getCall(_0x2fb5fe,_0x5d5764,_0x50cdbd,_0x53bac8,_0x37cc85,_0x40a1b9,_0x351d7f,'Inbound');})[_0x5f50('0x2c')](function(_0x16647f){if(_0x16647f){logger[_0x5f50('0x37')]('The\x20Call\x20ID\x20is:',_0x16647f['id']);}})['catch'](function(_0x3df080){logger[_0x5f50('0x2e')]('['+_0x351d7f[_0x5f50('0x71')][_0x5f50('0xa0')]()+']',JSON[_0x5f50('0xf')](_0x3df080));});}; \ 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 1655ec9..2263845 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 _0xad48=['util','shelljs','mustache','../../../../config/logger','data2','render','exec','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x211cad,_0x393dde){var _0x351ca4=function(_0x1cd61d){while(--_0x1cd61d){_0x211cad['push'](_0x211cad['shift']());}};_0x351ca4(++_0x393dde);}(_0xad48,0x10e));var _0x8ad4=function(_0x7e6fc5,_0x359bf2){_0x7e6fc5=_0x7e6fc5-0x0;var _0x4e5ca7=_0xad48[_0x7e6fc5];return _0x4e5ca7;};'use strict';var util=require(_0x8ad4('0x0'));var sh=require(_0x8ad4('0x1'));var Mustache=require(_0x8ad4('0x2'));var logger=require(_0x8ad4('0x3'))('trigger');exports['exec']=function(_0x3e91ce,_0x42e77f){var _0x496cbb=_0x3e91ce[_0x8ad4('0x4')]?_0x3e91ce[_0x8ad4('0x4')]:'Script';var _0x54646b=_0x3e91ce['data3']?Mustache[_0x8ad4('0x5')](_0x3e91ce['data3'],_0x42e77f):_0x42e77f;sh[_0x8ad4('0x6')](_0x54646b,function(_0x380ad3,_0x35d330,_0x3203d1){if(_0x380ad3!==0x0){logger['error'](util[_0x8ad4('0x7')](_0x8ad4('0x8'),_0x496cbb,_0x54646b,_0x380ad3,_0x3203d1));}else{logger[_0x8ad4('0x9')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x496cbb,_0x54646b,_0x35d330));}});}; \ No newline at end of file +var _0xe676=['data2','data3','render','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','shelljs','../../../../config/logger'];(function(_0x49b27e,_0x527d7a){var _0x112144=function(_0x209e70){while(--_0x209e70){_0x49b27e['push'](_0x49b27e['shift']());}};_0x112144(++_0x527d7a);}(_0xe676,0x85));var _0x6e67=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xe676[_0x172747];return _0x509692;};'use strict';var util=require('util');var sh=require(_0x6e67('0x0'));var Mustache=require('mustache');var logger=require(_0x6e67('0x1'))('trigger');exports['exec']=function(_0x28d2e7,_0x19f9aa){var _0x29e34f=_0x28d2e7[_0x6e67('0x2')]?_0x28d2e7[_0x6e67('0x2')]:'Script';var _0x4b0e33=_0x28d2e7[_0x6e67('0x3')]?Mustache[_0x6e67('0x4')](_0x28d2e7[_0x6e67('0x3')],_0x19f9aa):_0x19f9aa;sh[_0x6e67('0x5')](_0x4b0e33,function(_0x26874d,_0x59cb18,_0x214494){if(_0x26874d!==0x0){logger[_0x6e67('0x6')](util[_0x6e67('0x7')](_0x6e67('0x8'),_0x29e34f,_0x4b0e33,_0x26874d,_0x214494));}else{logger['info'](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x29e34f,_0x4b0e33,_0x59cb18));}});}; \ 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 4091d61..3238c3c 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 _0x2114=['exec','data1','toUpperCase','render','data5','number','headers','parse','data6','error','stack','GET','PUT','data7','body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','then',',\x20request\x20body:\x20','object','stringify','info','statusCode','catch','message','request-promise','util','lodash','trigger'];(function(_0x5e1e6e,_0x2d0556){var _0x3a9908=function(_0x808d12){while(--_0x808d12){_0x5e1e6e['push'](_0x5e1e6e['shift']());}};_0x3a9908(++_0x2d0556);}(_0x2114,0x1a0));var _0x4211=function(_0x5cbd7b,_0x207439){_0x5cbd7b=_0x5cbd7b-0x0;var _0x3fdfb8=_0x2114[_0x5cbd7b];return _0x3fdfb8;};'use strict';var rp=require(_0x4211('0x0'));var util=require(_0x4211('0x1'));var _=require(_0x4211('0x2'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x4211('0x3'));exports[_0x4211('0x4')]=function(_0x3dd2a1,_0x31cfa3){var _0x142a88,_0x3b2e35;var _0x54d547={'method':_0x3dd2a1[_0x4211('0x5')][_0x4211('0x6')](),'uri':Mustache[_0x4211('0x7')](_0x3dd2a1['data2'],_0x31cfa3),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3dd2a1[_0x4211('0x8')])===_0x4211('0x9')&&parseInt(_0x3dd2a1['data5'])>=0x1&&parseInt(_0x3dd2a1[_0x4211('0x8')])<=0xa?parseInt(_0x3dd2a1[_0x4211('0x8')])*0x3e8:0x5*0x3e8};try{_0x54d547[_0x4211('0xa')]=_0x3dd2a1['data6']?JSON[_0x4211('0xb')](Mustache['render'](_0x3dd2a1[_0x4211('0xc')],_0x31cfa3)):{};}catch(_0x20a322){logger[_0x4211('0xd')](_0x20a322[_0x4211('0xe')]);}switch(_0x3dd2a1[_0x4211('0x5')][_0x4211('0x6')]()){case _0x4211('0xf'):case'DELETE':_0x142a88=null;_0x54d547['qs']=_0x31cfa3;break;case'POST':case _0x4211('0x10'):if(_0x3dd2a1['data7']){try{_0x142a88=JSON[_0x4211('0xb')](Mustache[_0x4211('0x7')](_0x3dd2a1[_0x4211('0x11')],_0x31cfa3));_0x54d547[_0x4211('0x12')]=_0x142a88;}catch(_0x3f8bfb){logger[_0x4211('0xd')](_0x3f8bfb[_0x4211('0xe')]);logger[_0x4211('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x142a88=_0x31cfa3;_0x54d547[_0x4211('0x12')]=_0x142a88;}break;}logger['info'](util[_0x4211('0x13')](_0x4211('0x14'),_0x3dd2a1[_0x4211('0x5')],_0x3dd2a1[_0x4211('0x15')],JSON['stringify'](_0x54d547)));rp(_0x54d547)[_0x4211('0x16')](function(_0x18b9b){_0x142a88=!_['isNil'](_0x142a88)?_0x4211('0x17')+_0x142a88:'';_0x3b2e35=typeof _0x18b9b[_0x4211('0x12')]===_0x4211('0x18')?JSON[_0x4211('0x19')](_0x18b9b[_0x4211('0x12')]):_0x18b9b[_0x4211('0x12')];logger[_0x4211('0x1a')](util[_0x4211('0x13')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x3dd2a1['data1'],_0x3dd2a1['data2'],_0x18b9b[_0x4211('0x1b')],_0x3b2e35));})[_0x4211('0x1c')](function(_0x2111b2){logger['error'](util[_0x4211('0x13')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3dd2a1[_0x4211('0x5')],_0x3dd2a1['data2'],_0x2111b2[_0x4211('0x1b')],_0x2111b2['name'],_0x2111b2[_0x4211('0x1d')]));});}; \ No newline at end of file +var _0xb81c=['POST','PUT','data7','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','trigger','exec','data1','render','data2','data5','number','data6','parse','error','stack','toUpperCase','GET','DELETE'];(function(_0x3919ed,_0x5b640b){var _0x87d716=function(_0xb97ece){while(--_0xb97ece){_0x3919ed['push'](_0x3919ed['shift']());}};_0x87d716(++_0x5b640b);}(_0xb81c,0x164));var _0xcb81=function(_0x109520,_0x5d2d1b){_0x109520=_0x109520-0x0;var _0x4b06b9=_0xb81c[_0x109520];return _0x4b06b9;};'use strict';var rp=require(_0xcb81('0x0'));var util=require(_0xcb81('0x1'));var _=require(_0xcb81('0x2'));var Mustache=require(_0xcb81('0x3'));var logger=require('../../../../config/logger')(_0xcb81('0x4'));exports[_0xcb81('0x5')]=function(_0x1325ff,_0x5dfb1f){var _0x3c460f,_0x522b56;var _0x2e8ada={'method':_0x1325ff[_0xcb81('0x6')]['toUpperCase'](),'uri':Mustache[_0xcb81('0x7')](_0x1325ff[_0xcb81('0x8')],_0x5dfb1f),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1325ff[_0xcb81('0x9')])===_0xcb81('0xa')&&parseInt(_0x1325ff[_0xcb81('0x9')])>=0x1&&parseInt(_0x1325ff['data5'])<=0xa?parseInt(_0x1325ff['data5'])*0x3e8:0x5*0x3e8};try{_0x2e8ada['headers']=_0x1325ff[_0xcb81('0xb')]?JSON[_0xcb81('0xc')](Mustache['render'](_0x1325ff[_0xcb81('0xb')],_0x5dfb1f)):{};}catch(_0x689b50){logger[_0xcb81('0xd')](_0x689b50[_0xcb81('0xe')]);}switch(_0x1325ff[_0xcb81('0x6')][_0xcb81('0xf')]()){case _0xcb81('0x10'):case _0xcb81('0x11'):_0x3c460f=null;_0x2e8ada['qs']=_0x5dfb1f;break;case _0xcb81('0x12'):case _0xcb81('0x13'):if(_0x1325ff[_0xcb81('0x14')]){try{_0x3c460f=JSON[_0xcb81('0xc')](Mustache[_0xcb81('0x7')](_0x1325ff[_0xcb81('0x14')],_0x5dfb1f));_0x2e8ada['body']=_0x3c460f;}catch(_0x5dbb31){logger['error'](_0x5dbb31[_0xcb81('0xe')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x3c460f=_0x5dfb1f;_0x2e8ada[_0xcb81('0x15')]=_0x3c460f;}break;}logger[_0xcb81('0x16')](util[_0xcb81('0x17')](_0xcb81('0x18'),_0x1325ff[_0xcb81('0x6')],_0x1325ff[_0xcb81('0x8')],JSON['stringify'](_0x2e8ada)));rp(_0x2e8ada)[_0xcb81('0x19')](function(_0x559bee){_0x3c460f=!_[_0xcb81('0x1a')](_0x3c460f)?_0xcb81('0x1b')+_0x3c460f:'';_0x522b56=typeof _0x559bee['body']==='object'?JSON[_0xcb81('0x1c')](_0x559bee[_0xcb81('0x15')]):_0x559bee[_0xcb81('0x15')];logger['info'](util['format'](_0xcb81('0x1d'),_0x1325ff[_0xcb81('0x6')],_0x1325ff['data2'],_0x559bee[_0xcb81('0x1e')],_0x522b56));})['catch'](function(_0x2912c2){logger['error'](util['format'](_0xcb81('0x1f'),_0x1325ff[_0xcb81('0x6')],_0x1325ff[_0xcb81('0x8')],_0x2912c2[_0xcb81('0x1e')],_0x2912c2[_0xcb81('0x20')],_0x2912c2[_0xcb81('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index be0e2a6..ea5caa7 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 _0xe371=['jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','rpc','error','result','catch','exports'];(function(_0x29baaa,_0x18d913){var _0x4da9ff=function(_0xb23cf7){while(--_0xb23cf7){_0x29baaa['push'](_0x29baaa['shift']());}};_0x4da9ff(++_0x18d913);}(_0xe371,0x15e));var _0x1e37=function(_0x5a1cfd,_0x195d93){_0x5a1cfd=_0x5a1cfd-0x0;var _0xc77e80=_0xe371[_0x5a1cfd];return _0xc77e80;};'use strict';var jayson=require(_0x1e37('0x0'));var BPromise=require(_0x1e37('0x1'));var logger=require(_0x1e37('0x2'))(_0x1e37('0x3'));var client=jayson[_0x1e37('0x4')][_0x1e37('0x5')]({'port':0x2329});client[_0x1e37('0x6')]=function(_0x4a75aa,_0xcd4329){return new BPromise(function(_0x3fd72e,_0x5b4597){return client[_0x1e37('0x7')](_0x4a75aa,_0xcd4329)[_0x1e37('0x8')](function(_0x32e5bb){logger['debug'](_0x1e37('0x9'),_0x1e37('0x3'),_0x4a75aa,_0xcd4329,_0x32e5bb);if(_0x32e5bb[_0x1e37('0xa')]){logger[_0x1e37('0xa')](_0x1e37('0x9'),'routing',_0x4a75aa,_0x32e5bb['error']['message'],_0xcd4329);return _0x5b4597(_0x32e5bb[_0x1e37('0xa')]['message']);}else{return _0x3fd72e(_0x32e5bb[_0x1e37('0xb')]);}})[_0x1e37('0xc')](function(_0x2fea5e){logger['error'](_0x1e37('0x9'),_0x1e37('0x3'),_0x4a75aa,_0x2fea5e,_0xcd4329);return _0x5b4597(_0x2fea5e);});});};module[_0x1e37('0xd')]=client; \ No newline at end of file +var _0xe0a6=['debug','rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then'];(function(_0x4a4b60,_0x2ce8ad){var _0x501fc4=function(_0x39c428){while(--_0x39c428){_0x4a4b60['push'](_0x4a4b60['shift']());}};_0x501fc4(++_0x2ce8ad);}(_0xe0a6,0x114));var _0x6e0a=function(_0xa53f5f,_0x339ebe){_0xa53f5f=_0xa53f5f-0x0;var _0x18b241=_0xe0a6[_0xa53f5f];return _0x18b241;};'use strict';var jayson=require(_0x6e0a('0x0'));var BPromise=require(_0x6e0a('0x1'));var logger=require(_0x6e0a('0x2'))(_0x6e0a('0x3'));var client=jayson[_0x6e0a('0x4')][_0x6e0a('0x5')]({'port':0x2329});client[_0x6e0a('0x6')]=function(_0x542f2c,_0x23d3a4){return new BPromise(function(_0x4961d8,_0x24af43){return client[_0x6e0a('0x7')](_0x542f2c,_0x23d3a4)[_0x6e0a('0x8')](function(_0x441866){logger[_0x6e0a('0x9')](_0x6e0a('0xa'),_0x6e0a('0x3'),_0x542f2c,_0x23d3a4,_0x441866);if(_0x441866[_0x6e0a('0xb')]){logger[_0x6e0a('0xb')](_0x6e0a('0xa'),'routing',_0x542f2c,_0x441866[_0x6e0a('0xb')]['message'],_0x23d3a4);return _0x24af43(_0x441866[_0x6e0a('0xb')][_0x6e0a('0xc')]);}else{return _0x4961d8(_0x441866[_0x6e0a('0xd')]);}})[_0x6e0a('0xe')](function(_0x471a3d){logger['error'](_0x6e0a('0xa'),_0x6e0a('0x3'),_0x542f2c,_0x471a3d,_0x23d3a4);return _0x24af43(_0x471a3d);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index bd3e18c..52a9870 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 _0x1277=['./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','listen','getSettings','catch','error','./realtime'];(function(_0x2bb7d9,_0x369b40){var _0x33568b=function(_0x188493){while(--_0x188493){_0x2bb7d9['push'](_0x2bb7d9['shift']());}};_0x33568b(++_0x369b40);}(_0x1277,0x141));var _0x7127=function(_0x268456,_0x8f7b38){_0x268456=_0x268456-0x0;var _0x4bffb2=_0x1277[_0x268456];return _0x4bffb2;};'use strict';var server=require('./server');var Realtime=require(_0x7127('0x0'));var EmailChannel=require(_0x7127('0x1'));var mailAccount=require(_0x7127('0x2'));var setting=require(_0x7127('0x3'));var logger=require(_0x7127('0x4'))(_0x7127('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x7127('0x6')]()[_0x7127('0x7')](mailAccount[_0x7127('0x8')]())[_0x7127('0x7')](realtime[_0x7127('0x9')]())[_0x7127('0x7')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x7127('0xa')](realtime,email)[_0x7127('0x7')](function(){return initRealtime();})[_0x7127('0x7')](function(){return setting[_0x7127('0xb')]();})[_0x7127('0x7')](function(_0x9e2215){return setInterval(initRealtime,_0x9e2215['loginMailFrequency']*0x3e8);})[_0x7127('0xc')](function(_0xc91b29){logger[_0x7127('0xd')]('Email\x20service\x20initialization',_0xc91b29);});}main(); \ No newline at end of file +var _0x0bad=['then','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./realtime','../../config/logger','email'];(function(_0x1d196b,_0x1e4a01){var _0x23b6ae=function(_0x5cf9f1){while(--_0x5cf9f1){_0x1d196b['push'](_0x1d196b['shift']());}};_0x23b6ae(++_0x1e4a01);}(_0x0bad,0x17e));var _0xd0ba=function(_0x43a5ec,_0x2d24ea){_0x43a5ec=_0x43a5ec-0x0;var _0x60c3f9=_0x0bad[_0x43a5ec];return _0x60c3f9;};'use strict';var server=require('./server');var Realtime=require(_0xd0ba('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0xd0ba('0x1'))(_0xd0ba('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xd0ba('0x3')](mailAccount['getMailAccounts']())[_0xd0ba('0x3')](realtime['initMailAccounts']())[_0xd0ba('0x3')](function(){email[_0xd0ba('0x4')](realtime[_0xd0ba('0x5')]);return realtime;});}function main(){return server[_0xd0ba('0x6')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0xd0ba('0x7')]();})['then'](function(_0x2cc925){return setInterval(initRealtime,_0x2cc925[_0xd0ba('0x8')]*0x3e8);})[_0xd0ba('0x9')](function(_0x136ba9){logger['error'](_0xd0ba('0xa'),_0x136ba9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 481774a..4c0b28d 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 _0x1802=['Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','socket.io-emitter','smtp','prototype','emit','mailAccounts','name','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','hasOwnProperty','service','provider','custom','imapAccounts','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','handleImapError','status','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp'];(function(_0x4eab87,_0x380d40){var _0x2dc823=function(_0x2fcad7){while(--_0x2fcad7){_0x4eab87['push'](_0x4eab87['shift']());}};_0x2dc823(++_0x380d40);}(_0x1802,0xd8));var _0x2180=function(_0x58f264,_0x2494b9){_0x58f264=_0x58f264-0x0;var _0x561c72=_0x1802[_0x58f264];return _0x561c72;};'use strict';var _=require(_0x2180('0x0'));var moment=require(_0x2180('0x1'));var BPromise=require(_0x2180('0x2'));var md5=require(_0x2180('0x3'));var Redis=require(_0x2180('0x4'));var config=require(_0x2180('0x5'));var logger=require('../../../config/logger')(_0x2180('0x6'));config[_0x2180('0x7')]=_['defaults'](config[_0x2180('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x2180('0x8'))(new Redis(config[_0x2180('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x22b390){logger['info']('start\x20email\x20channel');this['mailAccounts']=_0x22b390['mailAccounts'];this['imapAccounts']={};this[_0x2180('0x9')]=new EmailSmtp();}EmailChannel[_0x2180('0xa')][_0x2180('0xb')]=function(_0x11904d){var _0x5d9efa=this[_0x2180('0xc')][_0x11904d];var _0x2a46d2={'id':_0x5d9efa['id'],'name':_0x5d9efa[_0x2180('0xd')],'key':_0x5d9efa[_0x2180('0xe')],'active':_0x5d9efa[_0x2180('0xf')],'Imap':{'status':_0x5d9efa[_0x2180('0x10')]['status'],'messageStatus':_0x5d9efa['Imap'][_0x2180('0x11')],'total':_0x5d9efa[_0x2180('0x10')][_0x2180('0x12')]}};if(_[_0x2180('0x13')](md5Accounts[_0x11904d])){md5Accounts[_0x11904d]={};}var _0x4c95ac=md5(JSON[_0x2180('0x14')](_0x2a46d2));if(md5Accounts[_0x11904d][_0x2180('0x3')]!==_0x4c95ac){md5Accounts[_0x11904d][_0x2180('0x3')]=_0x4c95ac;io[_0x2180('0xb')](_0x2180('0x15'),_0x2a46d2);}};EmailChannel['prototype']['refresh']=function(_0x15e497){for(var _0x359965 in _0x15e497){if(_0x15e497[_0x2180('0x16')](_0x359965)){if(_0x15e497[_0x359965][_0x2180('0x10')]&&_0x15e497[_0x359965][_0x2180('0xf')]){var _0x82aa4e=_0x15e497[_0x359965][_0x2180('0x10')];if(!_0x82aa4e[_0x2180('0x17')]&&_0x15e497[_0x359965][_0x2180('0x18')]!==_0x2180('0x19'))_0x82aa4e[_0x2180('0x17')]=_0x15e497[_0x359965][_0x2180('0x18')];if(!this['imapAccounts']['hasOwnProperty'](_0x82aa4e['id'])){this[_0x2180('0x1a')][_0x82aa4e['id']]=new EmailImap(_0x82aa4e,_0x15e497[_0x359965][_0x2180('0x6')]);this[_0x2180('0x1a')][_0x82aa4e['id']]['on'](_0x2180('0x1b'),this[_0x2180('0x1c')]['bind'](this,_0x359965));this[_0x2180('0x1a')][_0x82aa4e['id']]['on'](_0x2180('0x6'),this[_0x2180('0x1d')][_0x2180('0x1e')](this,_0x359965));this[_0x2180('0x1a')][_0x82aa4e['id']]['on'](_0x2180('0x1f'),this[_0x2180('0x20')][_0x2180('0x1e')](this,_0x359965));this[_0x2180('0x1a')][_0x82aa4e['id']]['on']('error',this[_0x2180('0x21')][_0x2180('0x1e')](this,_0x359965));}}else{if(_[_0x2180('0x13')](this[_0x2180('0xc')][_0x359965][_0x2180('0x10')])){this[_0x2180('0xc')][_0x359965][_0x2180('0x10')]={};}this[_0x2180('0xc')][_0x359965][_0x2180('0x10')][_0x2180('0x22')]='disabled';this['mailAccounts'][_0x359965][_0x2180('0x10')][_0x2180('0x11')]='';this['emit'](_0x359965);}}}};EmailChannel[_0x2180('0xa')][_0x2180('0x1c')]=function(_0x5a8d1e,_0x78e071){if(this['mailAccounts'][_0x5a8d1e]){this[_0x2180('0xc')][_0x5a8d1e][_0x2180('0x10')][_0x2180('0x22')]='connected';this[_0x2180('0xc')][_0x5a8d1e][_0x2180('0x10')]['messageStatus']=_0x78e071[_0x2180('0xd')];if(_0x78e071[_0x2180('0x23')]){this['mailAccounts'][_0x5a8d1e]['Imap']['total']=_0x78e071[_0x2180('0x23')]['total'];}return this[_0x2180('0xb')](_0x5a8d1e);}};EmailChannel[_0x2180('0xa')]['handleImapEmail']=function(_0x312abb,_0x22d24a){logger[_0x2180('0x24')](_0x2180('0x25'),_0x22d24a['firstName'],_0x22d24a[_0x2180('0x26')],_0x22d24a[_0x2180('0x27')],_0x312abb);if(this[_0x2180('0xc')][_0x312abb]){return mailAccount[_0x2180('0x28')](_0x312abb,_0x22d24a)['then'](function(_0x187d64){if(_0x187d64){logger[_0x2180('0x24')](_0x2180('0x29'));}})[_0x2180('0x2a')](function(_0x381d1b){logger[_0x2180('0x2b')](_0x2180('0x2c'),JSON[_0x2180('0x14')](_0x381d1b));});}};EmailChannel[_0x2180('0xa')][_0x2180('0x20')]=function(_0x38e96b){if(this[_0x2180('0xc')][_0x38e96b]&&this[_0x2180('0xc')][_0x38e96b][_0x2180('0x10')]){if(this['imapAccounts'][this['mailAccounts'][_0x38e96b][_0x2180('0x10')]['id']]){delete this[_0x2180('0x1a')][this[_0x2180('0xc')][_0x38e96b][_0x2180('0x10')]['id']];}this['mailAccounts'][_0x38e96b]['Imap'][_0x2180('0x2d')]=moment();this[_0x2180('0xb')](_0x38e96b);}};EmailChannel['prototype'][_0x2180('0x21')]=function(_0xcccf63,_0x26de34){if(this[_0x2180('0xc')][_0xcccf63]){this[_0x2180('0xc')][_0xcccf63][_0x2180('0x10')][_0x2180('0x22')]=_0x2180('0x2b');this['mailAccounts'][_0xcccf63][_0x2180('0x10')][_0x2180('0x11')]=_0x26de34;return this[_0x2180('0xb')](_0xcccf63);}};EmailChannel[_0x2180('0xa')][_0x2180('0x2e')]=function(_0x79e4bd,_0x5752d5){return this[_0x2180('0x9')][_0x2180('0x2f')](_0x79e4bd,_0x5752d5);};EmailChannel[_0x2180('0xa')][_0x2180('0x30')]=function(_0x14fc35){var _0x349541=this;if(this['mailAccounts'][_0x14fc35['id']]){if(_['isNil'](this[_0x2180('0xc')][_0x14fc35['id']][_0x2180('0x31')])){this['mailAccounts'][_0x14fc35['id']][_0x2180('0x31')]={};}this[_0x2180('0xc')][_0x14fc35['id']][_0x2180('0x31')][_0x2180('0x2d')]=moment();return new BPromise(function(_0x2be563,_0x1255d1){return _0x349541['smtp'][_0x2180('0x32')](_0x14fc35)['then'](function(_0x266090){_0x349541['mailAccounts'][_0x14fc35['id']][_0x2180('0x31')][_0x2180('0x22')]=_0x2180('0x33');_0x349541[_0x2180('0xc')][_0x14fc35['id']]['Smtp']['messageStatus']='';_0x349541[_0x2180('0xb')](_0x14fc35['id']);_0x2be563(_0x266090);})[_0x2180('0x2a')](function(_0x15b311){_0x349541[_0x2180('0xc')][_0x14fc35['id']][_0x2180('0x31')][_0x2180('0x22')]='error';_0x349541['mailAccounts'][_0x14fc35['id']][_0x2180('0x31')][_0x2180('0x11')]=_0x15b311;_0x349541[_0x2180('0xb')](_0x14fc35['id']);_0x1255d1(_0x15b311);});});}return this[_0x2180('0x9')]['verify'](_0x14fc35);};module[_0x2180('0x34')]=EmailChannel; \ No newline at end of file +var _0x592a=['notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','Smtp','verified','verify','exports','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','status','messageStatus','total','prototype','refresh','hasOwnProperty','service','custom','provider','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','disabled','connected','messages','from'];(function(_0x3e7dd5,_0x5e6857){var _0x815404=function(_0x179abe){while(--_0x179abe){_0x3e7dd5['push'](_0x3e7dd5['shift']());}};_0x815404(++_0x5e6857);}(_0x592a,0x17e));var _0xa592=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x592a[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xa592('0x0'));var md5=require(_0xa592('0x1'));var Redis=require(_0xa592('0x2'));var config=require(_0xa592('0x3'));var logger=require(_0xa592('0x4'))(_0xa592('0x5'));config[_0xa592('0x6')]=_[_0xa592('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa592('0x8'))(new Redis(config[_0xa592('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xa592('0x9'));var mailAccount=require(_0xa592('0xa'));var md5Accounts={};function EmailChannel(_0x15cf85){logger[_0xa592('0xb')]('start\x20email\x20channel');this[_0xa592('0xc')]=_0x15cf85[_0xa592('0xc')];this[_0xa592('0xd')]={};this[_0xa592('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0xa592('0xf')]=function(_0x93b424){var _0x2583a1=this[_0xa592('0xc')][_0x93b424];var _0x1890b0={'id':_0x2583a1['id'],'name':_0x2583a1[_0xa592('0x10')],'key':_0x2583a1[_0xa592('0x11')],'active':_0x2583a1[_0xa592('0x12')],'Imap':{'status':_0x2583a1[_0xa592('0x13')][_0xa592('0x14')],'messageStatus':_0x2583a1[_0xa592('0x13')][_0xa592('0x15')],'total':_0x2583a1[_0xa592('0x13')][_0xa592('0x16')]}};if(_['isNil'](md5Accounts[_0x93b424])){md5Accounts[_0x93b424]={};}var _0x32badf=md5(JSON['stringify'](_0x1890b0));if(md5Accounts[_0x93b424][_0xa592('0x1')]!==_0x32badf){md5Accounts[_0x93b424][_0xa592('0x1')]=_0x32badf;io[_0xa592('0xf')]('mailAccount:update',_0x1890b0);}};EmailChannel[_0xa592('0x17')][_0xa592('0x18')]=function(_0x4f3f7f){for(var _0x2b34fe in _0x4f3f7f){if(_0x4f3f7f[_0xa592('0x19')](_0x2b34fe)){if(_0x4f3f7f[_0x2b34fe][_0xa592('0x13')]&&_0x4f3f7f[_0x2b34fe][_0xa592('0x12')]){var _0x244ac3=_0x4f3f7f[_0x2b34fe][_0xa592('0x13')];if(!_0x244ac3[_0xa592('0x1a')]&&_0x4f3f7f[_0x2b34fe]['provider']!==_0xa592('0x1b'))_0x244ac3['service']=_0x4f3f7f[_0x2b34fe][_0xa592('0x1c')];if(!this[_0xa592('0xd')][_0xa592('0x19')](_0x244ac3['id'])){this[_0xa592('0xd')][_0x244ac3['id']]=new EmailImap(_0x244ac3,_0x4f3f7f[_0x2b34fe][_0xa592('0x5')]);this['imapAccounts'][_0x244ac3['id']]['on'](_0xa592('0x1d'),this[_0xa592('0x1e')][_0xa592('0x1f')](this,_0x2b34fe));this[_0xa592('0xd')][_0x244ac3['id']]['on'](_0xa592('0x5'),this[_0xa592('0x20')][_0xa592('0x1f')](this,_0x2b34fe));this[_0xa592('0xd')][_0x244ac3['id']]['on'](_0xa592('0x21'),this[_0xa592('0x22')]['bind'](this,_0x2b34fe));this['imapAccounts'][_0x244ac3['id']]['on'](_0xa592('0x23'),this[_0xa592('0x24')]['bind'](this,_0x2b34fe));}}else{if(_[_0xa592('0x25')](this[_0xa592('0xc')][_0x2b34fe]['Imap'])){this[_0xa592('0xc')][_0x2b34fe][_0xa592('0x13')]={};}this[_0xa592('0xc')][_0x2b34fe][_0xa592('0x13')]['status']=_0xa592('0x26');this[_0xa592('0xc')][_0x2b34fe][_0xa592('0x13')]['messageStatus']='';this['emit'](_0x2b34fe);}}}};EmailChannel[_0xa592('0x17')][_0xa592('0x1e')]=function(_0x2435c9,_0x2db7dc){if(this[_0xa592('0xc')][_0x2435c9]){this[_0xa592('0xc')][_0x2435c9][_0xa592('0x13')]['status']=_0xa592('0x27');this[_0xa592('0xc')][_0x2435c9]['Imap'][_0xa592('0x15')]=_0x2db7dc[_0xa592('0x10')];if(_0x2db7dc[_0xa592('0x28')]){this['mailAccounts'][_0x2435c9][_0xa592('0x13')][_0xa592('0x16')]=_0x2db7dc[_0xa592('0x28')][_0xa592('0x16')];}return this['emit'](_0x2435c9);}};EmailChannel[_0xa592('0x17')]['handleImapEmail']=function(_0x5de0c0,_0x118f42){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x118f42['firstName'],_0x118f42['lastName'],_0x118f42[_0xa592('0x29')],_0x5de0c0);if(this[_0xa592('0xc')][_0x5de0c0]){return mailAccount[_0xa592('0x2a')](_0x5de0c0,_0x118f42)[_0xa592('0x2b')](function(_0x4b0fff){if(_0x4b0fff){logger[_0xa592('0xb')](_0xa592('0x2c'));}})['catch'](function(_0x3fc15b){logger[_0xa592('0x23')](_0xa592('0x2d'),JSON[_0xa592('0x2e')](_0x3fc15b));});}};EmailChannel[_0xa592('0x17')][_0xa592('0x22')]=function(_0x34a733){if(this[_0xa592('0xc')][_0x34a733]&&this[_0xa592('0xc')][_0x34a733][_0xa592('0x13')]){if(this[_0xa592('0xd')][this[_0xa592('0xc')][_0x34a733][_0xa592('0x13')]['id']]){delete this[_0xa592('0xd')][this['mailAccounts'][_0x34a733][_0xa592('0x13')]['id']];}this[_0xa592('0xc')][_0x34a733][_0xa592('0x13')][_0xa592('0x2f')]=moment();this[_0xa592('0xf')](_0x34a733);}};EmailChannel['prototype'][_0xa592('0x24')]=function(_0x3ed3d7,_0x5985f8){if(this[_0xa592('0xc')][_0x3ed3d7]){this[_0xa592('0xc')][_0x3ed3d7][_0xa592('0x13')][_0xa592('0x14')]='error';this[_0xa592('0xc')][_0x3ed3d7][_0xa592('0x13')][_0xa592('0x15')]=_0x5985f8;return this['emit'](_0x3ed3d7);}};EmailChannel[_0xa592('0x17')][_0xa592('0x30')]=function(_0x2080a5,_0xacf4bd){return this[_0xa592('0xe')]['send'](_0x2080a5,_0xacf4bd);};EmailChannel['prototype']['verifySmtp']=function(_0x57f42a){var _0x4b045e=this;if(this[_0xa592('0xc')][_0x57f42a['id']]){if(_[_0xa592('0x25')](this[_0xa592('0xc')][_0x57f42a['id']][_0xa592('0x31')])){this[_0xa592('0xc')][_0x57f42a['id']][_0xa592('0x31')]={};}this[_0xa592('0xc')][_0x57f42a['id']][_0xa592('0x31')][_0xa592('0x2f')]=moment();return new BPromise(function(_0x3bd556,_0xc2cece){return _0x4b045e[_0xa592('0xe')]['verify'](_0x57f42a)[_0xa592('0x2b')](function(_0x2c5ea4){_0x4b045e[_0xa592('0xc')][_0x57f42a['id']]['Smtp'][_0xa592('0x14')]=_0xa592('0x32');_0x4b045e[_0xa592('0xc')][_0x57f42a['id']][_0xa592('0x31')]['messageStatus']='';_0x4b045e[_0xa592('0xf')](_0x57f42a['id']);_0x3bd556(_0x2c5ea4);})['catch'](function(_0x40e364){_0x4b045e[_0xa592('0xc')][_0x57f42a['id']][_0xa592('0x31')][_0xa592('0x14')]='error';_0x4b045e[_0xa592('0xc')][_0x57f42a['id']]['Smtp']['messageStatus']=_0x40e364;_0x4b045e[_0xa592('0xf')](_0x57f42a['id']);_0xc2cece(_0x40e364);});});}return this['smtp'][_0xa592('0x33')](_0x57f42a);};module[_0xa592('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 30f7aab..f52c68f 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 _0x81a0=['emailMaxHTMLbytesLimit','mailbox','account','getAccount','once','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','generateXOAuth2Token','CloudProvider','data5','password','anonymous@xcally.com','host','tls','autotls','required','handleReady','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','message','handleFetchMessage','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','length','parser','warn','Email\x20text\x20truncated,\x20max\x20HTML\x20size\x20','\x20bytes,\x20email\x20size:\x20','\x20bytes','text','substring','html','handleFetchEnd','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','../../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81a0,0x104));var _0x081a=function(_0x52b703,_0x5d7154){_0x52b703=_0x52b703-0x0;var _0x2608fa=_0x81a0[_0x52b703];return _0x2608fa;};'use strict';var _=require(_0x081a('0x0'));var util=require(_0x081a('0x1'));var Imap=require(_0x081a('0x2'));var simpleParser=require(_0x081a('0x3'))[_0x081a('0x4')];var Iconv=require(_0x081a('0x5'))[_0x081a('0x6')];var EventEmitter=require('events')[_0x081a('0x7')];var utils=require(_0x081a('0x8'));var logger=require(_0x081a('0x9'))(_0x081a('0xa'));var config=require(_0x081a('0xb'));const MAX_HTML_BYTES_SIZE=config[_0x081a('0xc')]||0xee6b2800;function EmailImap(_0x264298,_0x333d4a){this[_0x081a('0xd')]=_0x264298[_0x081a('0xd')];this[_0x081a('0xe')]=this[_0x081a('0xf')](_0x264298,_0x333d4a);this[_0x081a('0x2')]=new Imap(this[_0x081a('0xe')]);this[_0x081a('0x2')][_0x081a('0x10')]('ready',this['handleReady'][_0x081a('0x11')](this));this[_0x081a('0x2')][_0x081a('0x10')]('end',this['handleEnd'][_0x081a('0x11')](this));this[_0x081a('0x2')]['on'](_0x081a('0x12'),this[_0x081a('0x13')][_0x081a('0x11')](this));this[_0x081a('0x2')][_0x081a('0x14')]();}util[_0x081a('0x15')](EmailImap,EventEmitter);EmailImap[_0x081a('0x16')]['getAccount']=function(_0x2e967f,_0xd6a294){var _0x490ed2={'connTimeout':_0x2e967f[_0x081a('0x17')]?_0x2e967f['connTimeout']*0x3e8:0x2710,'authTimeout':_0x2e967f[_0x081a('0x18')]?_0x2e967f[_0x081a('0x18')]*0x3e8:0x1388};if(_0x2e967f['service']){_0x490ed2[_0x081a('0x19')]=_0x2e967f[_0x081a('0x19')];if(_0x2e967f['modernAuthentication']){_0x490ed2['xoauth2']=utils[_0x081a('0x1a')](_0x2e967f[_0x081a('0x1b')][_0x081a('0x1c')],_0x2e967f[_0x081a('0x19')]);}else{_0x490ed2[_0x081a('0x1d')]=_0x2e967f[_0x081a('0x1d')];}}else{if(_0x2e967f['authentication']){_0x490ed2['user']=_0x2e967f['user'];_0x490ed2[_0x081a('0x1d')]=_0x2e967f[_0x081a('0x1d')];}}_0x490ed2[_0x081a('0xa')]=_0xd6a294||_0x2e967f[_0x081a('0x19')]||_0x081a('0x1e');_0x490ed2['host']=_0x2e967f[_0x081a('0x1f')];_0x490ed2['port']=_0x2e967f['port']||0x3e1;if(_0x2e967f[_0x081a('0x20')]){_0x490ed2[_0x081a('0x20')]=!![];}else{_0x490ed2[_0x081a('0x20')]=![];_0x490ed2[_0x081a('0x21')]=_0x081a('0x22');}return _0x490ed2;};EmailImap[_0x081a('0x16')][_0x081a('0x23')]=function(){this[_0x081a('0x2')][_0x081a('0x24')](this['mailbox'],![],this[_0x081a('0x25')][_0x081a('0x11')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x4524d4,_0x2bbf7c){if(_0x4524d4){this[_0x081a('0x13')](_0x4524d4,!![]);}else{this[_0x081a('0x26')](_0x081a('0x27'),_0x2bbf7c);this[_0x081a('0x28')]();}};EmailImap[_0x081a('0x16')][_0x081a('0x29')]=function(_0x57c8ec){if(_0x57c8ec){this[_0x081a('0x13')](_0x57c8ec,!![]);}else{this['imap'][_0x081a('0x2a')]();}};EmailImap['prototype']['readUnseen']=function(){this['imap'][_0x081a('0x2b')]([_0x081a('0x2c')],this[_0x081a('0x2d')]['bind'](this));};EmailImap[_0x081a('0x16')][_0x081a('0x2d')]=function(_0x5876af,_0x3cfebf){if(_0x5876af){this[_0x081a('0x13')](_0x5876af,!![]);}else{if(_0x3cfebf['length']){try{var _0x33f1ab=this[_0x081a('0x2')]['fetch'](_0x3cfebf['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x33f1ab['on'](_0x081a('0x2e'),this[_0x081a('0x2f')][_0x081a('0x11')](this));_0x33f1ab[_0x081a('0x10')](_0x081a('0x12'),this['handleFetchError'][_0x081a('0x11')](this));_0x33f1ab[_0x081a('0x10')](_0x081a('0x2a'),this['handleFetchEnd'][_0x081a('0x11')](this));}catch(_0xd6d073){logger[_0x081a('0x12')](_0xd6d073);}}else{this['imap'][_0x081a('0x30')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0x081a('0x16')][_0x081a('0x2f')]=function(_0x18b34f){_0x18b34f['on'](_0x081a('0x31'),this[_0x081a('0x32')][_0x081a('0x11')](this));_0x18b34f['once']('attributes',this[_0x081a('0x33')][_0x081a('0x11')](this));_0x18b34f['once']('end',this[_0x081a('0x34')][_0x081a('0x11')](this));};EmailImap['prototype'][_0x081a('0x32')]=function(_0x1ec116){simpleParser(_0x1ec116,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap['prototype'][_0x081a('0x33')]=function(){};EmailImap[_0x081a('0x16')]['handleMessageEnd']=function(){};EmailImap[_0x081a('0x16')]['handleSimpleParser']=function(_0x29067b,_0x42d20f){if(_0x29067b){logger[_0x081a('0x12')](_0x29067b);}else{var _0x4c3ec8=this;const _0x5db357=_0x42d20f['html'][_0x081a('0x35')];if(_0x5db357\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString'];(function(_0x16fbd2,_0x2661ec){var _0x2e513b=function(_0x2a898a){while(--_0x2a898a){_0x16fbd2['push'](_0x16fbd2['shift']());}};_0x2e513b(++_0x2661ec);}(_0x918a,0xdc));var _0xa918=function(_0x1ddfe3,_0x5e50e5){_0x1ddfe3=_0x1ddfe3-0x0;var _0x708a39=_0x918a[_0x1ddfe3];return _0x708a39;};'use strict';var _=require(_0xa918('0x0'));var moment=require(_0xa918('0x1'));var random=require(_0xa918('0x2'));var fs=require('fs');var path=require(_0xa918('0x3'));var util=require(_0xa918('0x4'));var tnef=require(_0xa918('0x5'));var logger=require('../../../config/logger')(_0xa918('0x6'));var config=require(_0xa918('0x7'));function getAddress(_0x2c260b){var _0x4908b7=_[_0xa918('0x8')](_0x2c260b['value']);return _0x4908b7&&_0x4908b7[_0xa918('0x9')]?_0x4908b7['address']:_0xa918('0xa')+random[_0xa918('0xb')](0x6)+_0xa918('0xc');}function getFirstName(_0x3d2139){var _0x81c92a=_[_0xa918('0x8')](_0x3d2139[_0xa918('0xd')]);if(_0x81c92a&&_0x81c92a[_0xa918('0xe')]){if(_0x81c92a[_0xa918('0xe')]==_0x81c92a[_0xa918('0x9')]){return _0x81c92a[_0xa918('0xe')]['substring'](0x0,_0x81c92a[_0xa918('0xe')]['indexOf']('@'));}var _0x4740bd=_0x81c92a[_0xa918('0xe')][_0xa918('0xf')](/\s+/);return _0x4740bd[_0xa918('0x10')]>0x1?_0x4740bd[_0xa918('0x11')](0x0,-0x1)['join']('\x20'):_0x81c92a[_0xa918('0xe')];}return'Anonymous';}function getLastName(_0x322d6f){var _0x12f301=_[_0xa918('0x8')](_0x322d6f[_0xa918('0xd')]);if(_0x12f301&&_0x12f301[_0xa918('0xe')]){var _0xb7f3fa=_0x12f301[_0xa918('0xe')][_0xa918('0xf')](/\s+/);return _0xb7f3fa[_0xa918('0x10')]>0x1?_0xb7f3fa[_0xa918('0x12')]():'';}return'';}function getMails(_0x58fbc7,_0x321d71){var _0x463c0a='';for(var _0x36f8e6=0x0;_0x36f8e6<_0x321d71[_0xa918('0xd')][_0xa918('0x10')];_0x36f8e6+=0x1){if(_0x321d71['value'][_0x36f8e6][_0xa918('0x9')]!==_0x58fbc7){if(!_['isEmpty'](_0x463c0a)){_0x463c0a+=',';}_0x463c0a+=_0x321d71[_0xa918('0xd')][_0x36f8e6][_0xa918('0xe')]||_0x321d71['value'][_0x36f8e6][_0xa918('0x9')]||'';_0x463c0a+='\x20<';_0x463c0a+=_0x321d71['value'][_0x36f8e6][_0xa918('0x9')]?_0x321d71[_0xa918('0xd')][_0x36f8e6]['address']:_0xa918('0xa')+random[_0xa918('0xb')](0x6)+_0xa918('0xc');_0x463c0a+='>';}}return _0x463c0a;}function parseEmail(_0x29f9c7,_0x4198a7,_0x1aef17){if(_0x4198a7['html']){var _0x6ad525=/)<[^<]*)*<\/script>/gi;while(_0x6ad525[_0xa918('0x13')](_0x4198a7['html'])){_0x4198a7[_0xa918('0x14')]=_0x4198a7[_0xa918('0x14')][_0xa918('0x15')](_0x6ad525,'');}if(_0x4198a7[_0xa918('0x14')][_0xa918('0x16')](_0xa918('0x17'))){var _0x44452d=[];_0x4198a7['attachments'][_0xa918('0x18')](_0x100dba=>{_0x44452d[_0xa918('0x19')](_0x100dba[_0xa918('0x1a')]);});var _0x353a1a=/]+>/g;var _0x4a9320=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x421698=_0x4198a7[_0xa918('0x14')][_0xa918('0x15')](_0x4a9320,_0xa918('0x1b'));var _0x104423=_0x421698[_0xa918('0x15')](_0x353a1a,_0xa918('0x1c'));for(let _0x3a6a4b=0x0;_0x3a6a4b<_0x44452d[_0xa918('0x10')];_0x3a6a4b++){var _0x7ba086=_0x104423[_0xa918('0x15')](_0xa918('0x1c'),_0xa918('0x1d')+_0x44452d[_0x3a6a4b]+'\x20]');_0x104423=_0x7ba086;}_0x4198a7['html']=_0x104423;}_0x1aef17[_0xa918('0x1e')]=_0x4198a7[_0xa918('0x14')];}else{_0x1aef17[_0xa918('0x1e')]=_0x4198a7[_0xa918('0x1f')];}if(_0x1aef17[_0xa918('0x1e')]){_0x1aef17['body']=_0x1aef17[_0xa918('0x1e')][_0xa918('0x15')](/0x0){var _0x336b77=[_0xa918('0x32'),_0xa918('0x33'),_0xa918('0x34')];for(var _0x2f2434=0x0;_0x2f2434<_0x4198a7[_0xa918('0x31')]['length'];_0x2f2434++){var _0x19e7e9=_[_0xa918('0x35')](_0x336b77,_0x4198a7['headerLines'][_0x2f2434]['line']);if(_0x19e7e9>=0x0){_0x1aef17['isAutoreply']=!![];}}}return _0x1aef17;}exports[_0xa918('0x36')]=function(_0x46303b,_0x390bc8,_0x4b1a3f){var _0x5b4597={'from':getAddress(_0x390bc8['from']),'firstName':getFirstName(_0x390bc8['from']),'lastName':getLastName(_0x390bc8[_0xa918('0x37')]),'mapKey':_0xa918('0x6'),'message':{'from':getMails(_0x46303b[_0xa918('0x6')],_0x390bc8[_0xa918('0x37')]),'to':_0x46303b[_0xa918('0x6')],'cc':'','subject':_0x390bc8[_0xa918('0x38')]||'','messageId':_0x390bc8[_0xa918('0x39')],'inReplyTo':_0x390bc8[_0xa918('0x3a')],'sentAt':moment(_0x390bc8['date'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x390bc8['html']&&!_0x390bc8['textAsHtml']){var _0x35cf7d=_[_0xa918('0x3b')](_0x390bc8[_0xa918('0x26')],{'contentType':_0xa918('0x3c')});if(_0x35cf7d['length']){logger[_0xa918('0x3d')](util[_0xa918('0x29')](_0xa918('0x3e'),_0x390bc8[_0xa918('0x39')]));tnef[_0xa918('0x3f')](_['first'](_0x35cf7d)['content'],function(_0x16a156,_0x135f6c){if(_0x135f6c){_0x390bc8[_0xa918('0x14')]=_0x135f6c['BodyHTML']||_0xa918('0x40');if(_0x135f6c[_0xa918('0x41')]){for(var _0xcbad85=0x0;_0xcbad85<_0x135f6c[_0xa918('0x41')][_0xa918('0x10')];_0xcbad85++){var _0x3cb8a3=_0x135f6c[_0xa918('0x41')][_0xcbad85];_0x5b4597[_0xa918('0x21')][_0xa918('0x26')]['push']({'filename':_0x3cb8a3[_0xa918('0x42')],'content':Buffer[_0xa918('0x37')](_0x3cb8a3[_0xa918('0x43')])});}}}_0x4b1a3f(parseEmail(_0x46303b,_0x390bc8,_0x5b4597));});}else{_0x390bc8[_0xa918('0x14')]=_0xa918('0x40');_0x4b1a3f(parseEmail(_0x46303b,_0x390bc8,_0x5b4597));}}else{_0x4b1a3f(parseEmail(_0x46303b,_0x390bc8,_0x5b4597));}};exports[_0xa918('0x44')]=function(_0x570090,_0x255961){var _0x54fa25=['user='+(_0x255961||''),_0xa918('0x45')+_0x570090,'',''];return Buffer[_0xa918('0x37')](_0x54fa25[_0xa918('0x2c')](''),_0xa918('0x46'))[_0xa918('0x47')](_0xa918('0x48'));}; \ No newline at end of file +var _0xf85e=['writeFileSync','content','contentType','headerLines','indexOf','isAutoreply','parser','from','subject','inReplyTo','date','textAsHtml','filter','info','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','generate','@xcally.com','name','substring','split','length','slice','join','Anonymous','pop','isEmpty','html','includes','\x20[Attachment:\x20','body','originTo','message','originCc','attachment','attachment-','%s-%s','now','root','server/files/attachments/'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xf85e,0x16f));var _0xef85=function(_0x3f1c21,_0x6c4dd3){_0x3f1c21=_0x3f1c21-0x0;var _0x3ebc10=_0xf85e[_0x3f1c21];return _0x3ebc10;};'use strict';var _=require(_0xef85('0x0'));var moment=require(_0xef85('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0xef85('0x2'));var tnef=require(_0xef85('0x3'));var logger=require(_0xef85('0x4'))(_0xef85('0x5'));var config=require(_0xef85('0x6'));function getAddress(_0x2bb8fd){var _0x2f1ecf=_[_0xef85('0x7')](_0x2bb8fd[_0xef85('0x8')]);return _0x2f1ecf&&_0x2f1ecf[_0xef85('0x9')]?_0x2f1ecf[_0xef85('0x9')]:'anonymous'+random[_0xef85('0xa')](0x6)+_0xef85('0xb');}function getFirstName(_0xcd8b4b){var _0x373fa8=_[_0xef85('0x7')](_0xcd8b4b[_0xef85('0x8')]);if(_0x373fa8&&_0x373fa8[_0xef85('0xc')]){if(_0x373fa8[_0xef85('0xc')]==_0x373fa8['address']){return _0x373fa8['name'][_0xef85('0xd')](0x0,_0x373fa8[_0xef85('0xc')]['indexOf']('@'));}var _0x47846c=_0x373fa8[_0xef85('0xc')][_0xef85('0xe')](/\s+/);return _0x47846c[_0xef85('0xf')]>0x1?_0x47846c[_0xef85('0x10')](0x0,-0x1)[_0xef85('0x11')]('\x20'):_0x373fa8[_0xef85('0xc')];}return _0xef85('0x12');}function getLastName(_0x154608){var _0x126a3a=_['head'](_0x154608[_0xef85('0x8')]);if(_0x126a3a&&_0x126a3a[_0xef85('0xc')]){var _0x30b119=_0x126a3a[_0xef85('0xc')][_0xef85('0xe')](/\s+/);return _0x30b119['length']>0x1?_0x30b119[_0xef85('0x13')]():'';}return'';}function getMails(_0x32f220,_0x5c7f69){var _0x20c30b='';for(var _0x42bd4e=0x0;_0x42bd4e<_0x5c7f69[_0xef85('0x8')]['length'];_0x42bd4e+=0x1){if(_0x5c7f69[_0xef85('0x8')][_0x42bd4e]['address']!==_0x32f220){if(!_[_0xef85('0x14')](_0x20c30b)){_0x20c30b+=',';}_0x20c30b+=_0x5c7f69['value'][_0x42bd4e][_0xef85('0xc')]||_0x5c7f69[_0xef85('0x8')][_0x42bd4e][_0xef85('0x9')]||'';_0x20c30b+='\x20<';_0x20c30b+=_0x5c7f69[_0xef85('0x8')][_0x42bd4e][_0xef85('0x9')]?_0x5c7f69[_0xef85('0x8')][_0x42bd4e][_0xef85('0x9')]:'anonymous'+random[_0xef85('0xa')](0x6)+_0xef85('0xb');_0x20c30b+='>';}}return _0x20c30b;}function parseEmail(_0x1050b8,_0x2a4654,_0x32990b){if(_0x2a4654['html']){var _0x571556=/)<[^<]*)*<\/script>/gi;while(_0x571556['test'](_0x2a4654['html'])){_0x2a4654[_0xef85('0x15')]=_0x2a4654[_0xef85('0x15')]['replace'](_0x571556,'');}if(_0x2a4654[_0xef85('0x15')][_0xef85('0x16')](_0xef85('0x17'))){var _0x550fd3=[];_0x2a4654[_0xef85('0x18')][_0xef85('0x19')](_0x1fa1f1=>{_0x550fd3[_0xef85('0x1a')](_0x1fa1f1['filename']);});var _0x2a7f78=/]+>/g;var _0x2c251a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1f3577=_0x2a4654[_0xef85('0x15')][_0xef85('0x1b')](_0x2c251a,_0xef85('0x1c'));var _0x3bd153=_0x1f3577[_0xef85('0x1b')](_0x2a7f78,_0xef85('0x1d'));for(let _0xf3c949=0x0;_0xf3c949<_0x550fd3[_0xef85('0xf')];_0xf3c949++){var _0x384f01=_0x3bd153[_0xef85('0x1b')]('_IMG',_0xef85('0x1e')+_0x550fd3[_0xf3c949]+'\x20]');_0x3bd153=_0x384f01;}_0x2a4654['html']=_0x3bd153;}_0x32990b[_0xef85('0x1f')]=_0x2a4654['html'];}else{_0x32990b['body']=_0x2a4654['textAsHtml'];}if(_0x32990b[_0xef85('0x1f')]){_0x32990b[_0xef85('0x1f')]=_0x32990b[_0xef85('0x1f')][_0xef85('0x1b')](/0x0){var _0x5ae853=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0xa3d77c=0x0;_0xa3d77c<_0x2a4654[_0xef85('0x2c')]['length'];_0xa3d77c++){var _0x563250=_[_0xef85('0x2d')](_0x5ae853,_0x2a4654['headerLines'][_0xa3d77c]['line']);if(_0x563250>=0x0){_0x32990b[_0xef85('0x2e')]=!![];}}}return _0x32990b;}exports[_0xef85('0x2f')]=function(_0x226bf9,_0x1490f7,_0x5f2f45){var _0x1e1649={'from':getAddress(_0x1490f7[_0xef85('0x30')]),'firstName':getFirstName(_0x1490f7[_0xef85('0x30')]),'lastName':getLastName(_0x1490f7['from']),'mapKey':_0xef85('0x5'),'message':{'from':getMails(_0x226bf9[_0xef85('0x5')],_0x1490f7[_0xef85('0x30')]),'to':_0x226bf9['email'],'cc':'','subject':_0x1490f7[_0xef85('0x31')]||'','messageId':_0x1490f7['messageId'],'inReplyTo':_0x1490f7[_0xef85('0x32')],'sentAt':moment(_0x1490f7[_0xef85('0x33')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x1490f7[_0xef85('0x15')]&&!_0x1490f7[_0xef85('0x34')]){var _0x5f0e5d=_[_0xef85('0x35')](_0x1490f7[_0xef85('0x18')],{'contentType':'application/ms-tnef'});if(_0x5f0e5d['length']){logger[_0xef85('0x36')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x1490f7[_0xef85('0x37')]));tnef[_0xef85('0x38')](_[_0xef85('0x39')](_0x5f0e5d)['content'],function(_0x2402ec,_0x11f241){if(_0x11f241){_0x1490f7[_0xef85('0x15')]=_0x11f241[_0xef85('0x3a')]||_0xef85('0x3b');if(_0x11f241[_0xef85('0x3c')]){for(var _0x2b8134=0x0;_0x2b8134<_0x11f241[_0xef85('0x3c')]['length'];_0x2b8134++){var _0x28b2da=_0x11f241['Attachments'][_0x2b8134];_0x1e1649['message'][_0xef85('0x18')][_0xef85('0x1a')]({'filename':_0x28b2da['Title'],'content':Buffer[_0xef85('0x30')](_0x28b2da[_0xef85('0x3d')])});}}}_0x5f2f45(parseEmail(_0x226bf9,_0x1490f7,_0x1e1649));});}else{_0x1490f7[_0xef85('0x15')]='

Empty\x20message

';_0x5f2f45(parseEmail(_0x226bf9,_0x1490f7,_0x1e1649));}}else{_0x5f2f45(parseEmail(_0x226bf9,_0x1490f7,_0x1e1649));}};exports[_0xef85('0x3e')]=function(_0x2fce18,_0x494aa6){var _0x1ba302=[_0xef85('0x3f')+(_0x494aa6||''),_0xef85('0x40')+_0x2fce18,'',''];return Buffer[_0xef85('0x30')](_0x1ba302[_0xef85('0x11')](''),_0xef85('0x41'))[_0xef85('0x42')](_0xef85('0x43'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index e98db2e..7742c64 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 _0xa12f=['exports','lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x5c0232,_0x1c449f){var _0x589366=function(_0x31cd62){while(--_0x31cd62){_0x5c0232['push'](_0x5c0232['shift']());}};_0x589366(++_0x1c449f);}(_0xa12f,0x121));var _0xfa12=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa12f[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xfa12('0x0'));function MailAccount(_0x571fd0){this['id']=_0x571fd0['id']||0x0;this[_0xfa12('0x1')]=_0x571fd0[_0xfa12('0x1')]||_0xfa12('0x2');this[_0xfa12('0x3')]=_0x571fd0['key']||_0xfa12('0x4');this[_0xfa12('0x5')]=_0x571fd0['active']||![];this[_0xfa12('0x6')]=_0x571fd0[_0xfa12('0x6')]||[];this[_0xfa12('0x7')]=_0x571fd0[_0xfa12('0x7')]||[];}module[_0xfa12('0x8')]=MailAccount; \ No newline at end of file +var _0xfba9=['active','Imap','Smtp','exports','lodash','name','key','SERV'];(function(_0x1aac1d,_0x1dca6c){var _0x140f0d=function(_0x3e4db4){while(--_0x3e4db4){_0x1aac1d['push'](_0x1aac1d['shift']());}};_0x140f0d(++_0x1dca6c);}(_0xfba9,0x1bc));var _0x9fba=function(_0x5b1097,_0x3ed62f){_0x5b1097=_0x5b1097-0x0;var _0x57979c=_0xfba9[_0x5b1097];return _0x57979c;};'use strict';var _=require(_0x9fba('0x0'));function MailAccount(_0x3d403a){this['id']=_0x3d403a['id']||0x0;this[_0x9fba('0x1')]=_0x3d403a[_0x9fba('0x1')]||'Service';this['key']=_0x3d403a[_0x9fba('0x2')]||_0x9fba('0x3');this[_0x9fba('0x4')]=_0x3d403a[_0x9fba('0x4')]||![];this[_0x9fba('0x5')]=_0x3d403a['Imap']||[];this[_0x9fba('0x6')]=_0x3d403a['Smtp']||[];}module[_0x9fba('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 3f5b16b..57a4f07 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 _0x5efd=['../model/mailAccount','mailAccounts','hasOwnProperty','prototype','initMailAccounts','length','merge','lodash'];(function(_0x336b4e,_0x377680){var _0x1716ae=function(_0x46d67c){while(--_0x46d67c){_0x336b4e['push'](_0x336b4e['shift']());}};_0x1716ae(++_0x377680);}(_0x5efd,0xf7));var _0xd5ef=function(_0x493673,_0x414f6c){_0x493673=_0x493673-0x0;var _0x5dde55=_0x5efd[_0x493673];return _0x5dde55;};'use strict';var _=require(_0xd5ef('0x0'));var MailAccount=require(_0xd5ef('0x1'));var Realtime=function(){this[_0xd5ef('0x2')]={};};function freeIsNotKey(_0x597579,_0x48817d,_0x375ae6){var _0x4900bc=_['mapKeys'](_0x597579,function(_0x512948,_0x503592){return _0x512948[_0x375ae6];});for(var _0x3a9ff6 in _0x48817d){if(_0x48817d[_0xd5ef('0x3')](_0x3a9ff6)){if(!_0x4900bc[_0x3a9ff6]){delete _0x48817d[_0x3a9ff6];}}}}Realtime[_0xd5ef('0x4')]['mergeFromDatabase']=function(_0x4c5a1f,_0x4823e6){for(var _0x557152 in _0x4823e6){if(_0x4c5a1f[_0xd5ef('0x3')](_0x557152)){_0x4c5a1f[_0x557152]=_0x4823e6[_0x557152];}}};Realtime[_0xd5ef('0x4')][_0xd5ef('0x5')]=function(){var _0x339e2d=this;return function(_0x2034c1){if(_0x2034c1){freeIsNotKey(_0x2034c1,_0x339e2d[_0xd5ef('0x2')],'id');for(var _0x2b9c91=0x0,_0x14d058={},_0x1237fe={};_0x2b9c91<_0x2034c1[_0xd5ef('0x6')];_0x2b9c91+=0x1){_0x14d058=_0x2034c1[_0x2b9c91];if(_['isUndefined'](_0x339e2d[_0xd5ef('0x2')][_0x14d058['id']])){_0x339e2d[_0xd5ef('0x2')][_0x14d058['id']]=new MailAccount(_0x14d058);}else{_[_0xd5ef('0x7')](_0x339e2d[_0xd5ef('0x2')][_0x14d058['id']],_0x14d058);}}}return _0x339e2d['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0x8e3d=['exports','lodash','../model/mailAccount','mailAccounts','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','merge'];(function(_0x1cdc9b,_0x3a97df){var _0x5c4ee7=function(_0x3a328e){while(--_0x3a328e){_0x1cdc9b['push'](_0x1cdc9b['shift']());}};_0x5c4ee7(++_0x3a97df);}(_0x8e3d,0x1a8));var _0xd8e3=function(_0x23cc7d,_0x553e85){_0x23cc7d=_0x23cc7d-0x0;var _0x41abb3=_0x8e3d[_0x23cc7d];return _0x41abb3;};'use strict';var _=require(_0xd8e3('0x0'));var MailAccount=require(_0xd8e3('0x1'));var Realtime=function(){this[_0xd8e3('0x2')]={};};function freeIsNotKey(_0x3a6c8c,_0x1866e1,_0xb34f62){var _0x5b1263=_['mapKeys'](_0x3a6c8c,function(_0x269dd4,_0x56547b){return _0x269dd4[_0xb34f62];});for(var _0x41844d in _0x1866e1){if(_0x1866e1['hasOwnProperty'](_0x41844d)){if(!_0x5b1263[_0x41844d]){delete _0x1866e1[_0x41844d];}}}}Realtime['prototype'][_0xd8e3('0x3')]=function(_0x51eb32,_0x372e8e){for(var _0x1d13cb in _0x372e8e){if(_0x51eb32[_0xd8e3('0x4')](_0x1d13cb)){_0x51eb32[_0x1d13cb]=_0x372e8e[_0x1d13cb];}}};Realtime['prototype'][_0xd8e3('0x5')]=function(){var _0x4bb8b8=this;return function(_0x3c8d31){if(_0x3c8d31){freeIsNotKey(_0x3c8d31,_0x4bb8b8[_0xd8e3('0x2')],'id');for(var _0x462836=0x0,_0x5d80a7={},_0x24353e={};_0x462836<_0x3c8d31[_0xd8e3('0x6')];_0x462836+=0x1){_0x5d80a7=_0x3c8d31[_0x462836];if(_['isUndefined'](_0x4bb8b8[_0xd8e3('0x2')][_0x5d80a7['id']])){_0x4bb8b8[_0xd8e3('0x2')][_0x5d80a7['id']]=new MailAccount(_0x5d80a7);}else{_[_0xd8e3('0x7')](_0x4bb8b8[_0xd8e3('0x2')][_0x5d80a7['id']],_0x5d80a7);}}}return _0x4bb8b8[_0xd8e3('0x2')];};};module[_0xd8e3('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index d0442ac..57e9e6e 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 _0x2f3d=['Request','GetMailAccount','name','provider','active','key','ListId','MailServerIn','Imap','CloudProvider','service','type','data5','MailServerOut','Smtp','NotifyMailAccount','getMailAccounts'];(function(_0x4599d7,_0x3fa5d1){var _0x5c89d3=function(_0x4577d1){while(--_0x4577d1){_0x4599d7['push'](_0x4599d7['shift']());}};_0x5c89d3(++_0x3fa5d1);}(_0x2f3d,0x1a8));var _0xd2f3=function(_0x288adc,_0x46f0ce){_0x288adc=_0x288adc-0x0;var _0x5a690a=_0x2f3d[_0x288adc];return _0x5a690a;};'use strict';var client=require('../client');exports[_0xd2f3('0x0')]=function(){return function(){return client[_0xd2f3('0x1')](_0xd2f3('0x2'),{'options':{'attributes':['id',_0xd2f3('0x3'),_0xd2f3('0x4'),'service','email',_0xd2f3('0x5'),_0xd2f3('0x6'),_0xd2f3('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0xd2f3('0x8'),'as':_0xd2f3('0x9'),'include':[{'model':_0xd2f3('0xa'),'attributes':['id',_0xd2f3('0x3'),_0xd2f3('0xb'),_0xd2f3('0xc'),_0xd2f3('0xd')],'as':'CloudProvider'}]},{'model':_0xd2f3('0xe'),'as':_0xd2f3('0xf'),'include':[{'model':'CloudProvider','attributes':['id',_0xd2f3('0x3'),_0xd2f3('0xb'),_0xd2f3('0xc'),_0xd2f3('0xd')],'as':_0xd2f3('0xa')}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x49fba6,_0x44509e){return client[_0xd2f3('0x1')]('NotifyMailAccount',{'account':{'id':_0x49fba6},'body':_0x44509e,'log':_0xd2f3('0x10')});}; \ No newline at end of file +var _0xd9ef=['name','service','type','data5','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider'];(function(_0x1835b3,_0x3c01f0){var _0x28d5c5=function(_0x273b11){while(--_0x273b11){_0x1835b3['push'](_0x1835b3['shift']());}};_0x28d5c5(++_0x3c01f0);}(_0xd9ef,0x95));var _0xfd9e=function(_0x211a65,_0x30d3a7){_0x211a65=_0x211a65-0x0;var _0x9c6615=_0xd9ef[_0x211a65];return _0x9c6615;};'use strict';var client=require(_0xfd9e('0x0'));exports[_0xfd9e('0x1')]=function(){return function(){return client['Request'](_0xfd9e('0x2'),{'options':{'attributes':['id','name','provider','service',_0xfd9e('0x3'),_0xfd9e('0x4'),_0xfd9e('0x5'),_0xfd9e('0x6'),_0xfd9e('0x7')],'raw':![],'include':[{'model':_0xfd9e('0x8'),'as':_0xfd9e('0x9'),'include':[{'model':_0xfd9e('0xa'),'attributes':['id',_0xfd9e('0xb'),_0xfd9e('0xc'),_0xfd9e('0xd'),_0xfd9e('0xe')],'as':_0xfd9e('0xa')}]},{'model':'MailServerOut','as':_0xfd9e('0xf'),'include':[{'model':_0xfd9e('0xa'),'attributes':['id','name',_0xfd9e('0xc'),_0xfd9e('0xd'),_0xfd9e('0xe')],'as':'CloudProvider'}]}]},'log':_0xfd9e('0x10')});};};exports[_0xfd9e('0x11')]=function(_0x339901,_0x44a97a){return client[_0xfd9e('0x12')]('NotifyMailAccount',{'account':{'id':_0x339901},'body':_0x44a97a,'log':_0xfd9e('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 1fcc1fc..6700976 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 _0xf4f0=['../client','getSettings','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x1142f8,_0x13b4c0){var _0x506352=function(_0x21ecb5){while(--_0x21ecb5){_0x1142f8['push'](_0x1142f8['shift']());}};_0x506352(++_0x13b4c0);}(_0xf4f0,0x113));var _0x0f4f=function(_0x10aa73,_0xc744f4){_0x10aa73=_0x10aa73-0x0;var _0x3496d9=_0xf4f0[_0x10aa73];return _0x3496d9;};'use strict';var client=require(_0x0f4f('0x0'));exports[_0x0f4f('0x1')]=function(){return client['Request'](_0x0f4f('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0f4f('0x3')]},'log':_0x0f4f('0x4')});}; \ No newline at end of file +var _0x93d3=['getSettings','Request','loginMailFrequency','GetSettings'];(function(_0x10b4f2,_0x2d4ec8){var _0x1d9640=function(_0x5a55ab){while(--_0x5a55ab){_0x10b4f2['push'](_0x10b4f2['shift']());}};_0x1d9640(++_0x2d4ec8);}(_0x93d3,0xd8));var _0x393d=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x93d3[_0x255d5b];return _0x3e141a;};'use strict';var client=require('../client');exports[_0x393d('0x0')]=function(){return client[_0x393d('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x393d('0x2')]},'log':_0x393d('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 7c62af3..94a7ffa 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 372f3c5..ff4f70b 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 _0x8d86=['listen','port','websocket','redis','defaults','localhost','socket.io-redis','../../config/socketio','default','once','listening','log','exports','lodash','express','../../config/environment','createServer','timeout'];(function(_0x4bf83e,_0x429223){var _0x5647c9=function(_0x195bae){while(--_0x195bae){_0x4bf83e['push'](_0x4bf83e['shift']());}};_0x5647c9(++_0x429223);}(_0x8d86,0x163));var _0x68d8=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x8d86[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x68d8('0x0'));var http=require('http');var express=require(_0x68d8('0x1'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x68d8('0x2'));var app=express();var server=http[_0x68d8('0x3')](app);server[_0x68d8('0x4')]=0xdbba0;if(sticky[_0x68d8('0x5')](server,config[_0x68d8('0x6')])){var socketio=require('socket.io')(server,{'transports':[_0x68d8('0x7'),'polling']});config[_0x68d8('0x8')]=_[_0x68d8('0x9')](config[_0x68d8('0x8')],{'host':_0x68d8('0xa'),'port':0x18eb});socketio['adapter'](require(_0x68d8('0xb'))({'pubClient':new Redis(config[_0x68d8('0x8')]),'subClient':new Redis(config[_0x68d8('0x8')])}));require('../../config/triggers')['default']();require(_0x68d8('0xc'))['default'](socketio);require('../../config/express')[_0x68d8('0xd')](app);require('../../routes')['default'](app);}else{server[_0x68d8('0xe')](_0x68d8('0xf'),function(){console[_0x68d8('0x10')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module[_0x68d8('0x11')]=app; \ No newline at end of file +var _0xbf03=['log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','http','sticky-session','../../config/environment','createServer','timeout','listen','socket.io','websocket','redis','defaults','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening'];(function(_0x239f8b,_0x1ef629){var _0x5532f5=function(_0x48b5da){while(--_0x48b5da){_0x239f8b['push'](_0x239f8b['shift']());}};_0x5532f5(++_0x1ef629);}(_0xbf03,0xb4));var _0x3bf0=function(_0x2abb22,_0x67d69){_0x2abb22=_0x2abb22-0x0;var _0x5bde9b=_0xbf03[_0x2abb22];return _0x5bde9b;};'use strict';var _=require('lodash');var http=require(_0x3bf0('0x0'));var express=require('express');var sticky=require(_0x3bf0('0x1'));var Redis=require('ioredis');var config=require(_0x3bf0('0x2'));var app=express();var server=http[_0x3bf0('0x3')](app);server[_0x3bf0('0x4')]=0xdbba0;if(sticky[_0x3bf0('0x5')](server,config['port'])){var socketio=require(_0x3bf0('0x6'))(server,{'transports':[_0x3bf0('0x7'),'polling']});config[_0x3bf0('0x8')]=_[_0x3bf0('0x9')](config['redis'],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0x3bf0('0xa'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x3bf0('0x8')])}));require(_0x3bf0('0xb'))[_0x3bf0('0xc')]();require(_0x3bf0('0xd'))[_0x3bf0('0xc')](socketio);require(_0x3bf0('0xe'))[_0x3bf0('0xc')](app);require(_0x3bf0('0xf'))[_0x3bf0('0xc')](app);}else{server[_0x3bf0('0x10')](_0x3bf0('0x11'),function(){console[_0x3bf0('0x12')](_0x3bf0('0x13'),config[_0x3bf0('0x14')]);});}exports=module[_0x3bf0('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index b4162a9..c411595 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 _0x2490=['http','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0x52cc84,_0x54793e){var _0x4cea2f=function(_0x41eb1f){while(--_0x41eb1f){_0x52cc84['push'](_0x52cc84['shift']());}};_0x4cea2f(++_0x54793e);}(_0x2490,0xb1));var _0x0249=function(_0x48011a,_0x30afc0){_0x48011a=_0x48011a-0x0;var _0x53a661=_0x2490[_0x48011a];return _0x53a661;};'use strict';var jayson=require(_0x0249('0x0'));var BPromise=require(_0x0249('0x1'));var logger=require(_0x0249('0x2'))(_0x0249('0x3'));var client=jayson[_0x0249('0x4')][_0x0249('0x5')]({'port':0x2329});client['Request']=function(_0x49fb3a,_0x176e62){return new BPromise(function(_0x58020b,_0x54b395){return client['request'](_0x49fb3a,_0x176e62)[_0x0249('0x6')](function(_0x175864){logger[_0x0249('0x7')](_0x0249('0x8'),'routing',_0x49fb3a,_0x176e62,_0x175864);if(_0x175864['error']){logger['error'](_0x0249('0x8'),_0x0249('0x3'),_0x49fb3a,_0x175864[_0x0249('0x9')][_0x0249('0xa')],_0x176e62);return _0x54b395(_0x175864[_0x0249('0x9')][_0x0249('0xa')]);}else{return _0x58020b(_0x175864[_0x0249('0xb')]);}})[_0x0249('0xc')](function(_0x5525b6){logger[_0x0249('0x9')]('rpc',_0x0249('0x3'),_0x49fb3a,_0x5525b6,_0x176e62);return _0x54b395(_0x5525b6);});});};module[_0x0249('0xd')]=client; \ No newline at end of file +var _0x8ea1=['../../config/logger','routing','http','Request','then','debug','rpc','error','message','result','exports','jayson/promise'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8ea1,0xa7));var _0x18ea=function(_0x3a441a,_0x43eb56){_0x3a441a=_0x3a441a-0x0;var _0x3128a2=_0x8ea1[_0x3a441a];return _0x3128a2;};'use strict';var jayson=require(_0x18ea('0x0'));var BPromise=require('bluebird');var logger=require(_0x18ea('0x1'))(_0x18ea('0x2'));var client=jayson['client'][_0x18ea('0x3')]({'port':0x2329});client[_0x18ea('0x4')]=function(_0x118df3,_0x1774f1){return new BPromise(function(_0xc421b7,_0x1644d4){return client['request'](_0x118df3,_0x1774f1)[_0x18ea('0x5')](function(_0x231610){logger[_0x18ea('0x6')](_0x18ea('0x7'),_0x18ea('0x2'),_0x118df3,_0x1774f1,_0x231610);if(_0x231610[_0x18ea('0x8')]){logger[_0x18ea('0x8')]('rpc','routing',_0x118df3,_0x231610[_0x18ea('0x8')][_0x18ea('0x9')],_0x1774f1);return _0x1644d4(_0x231610[_0x18ea('0x8')]['message']);}else{return _0xc421b7(_0x231610[_0x18ea('0xa')]);}})['catch'](function(_0x4f522b){logger[_0x18ea('0x8')]('rpc',_0x18ea('0x2'),_0x118df3,_0x4f522b,_0x1774f1);return _0x1644d4(_0x4f522b);});});};module[_0x18ea('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index f5b20ac..a89cae9 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 _0xe1cd=['listen','log','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues'];(function(_0x3990fa,_0x4d8071){var _0x297cac=function(_0x36e918){while(--_0x36e918){_0x3990fa['push'](_0x3990fa['shift']());}};_0x297cac(++_0x4d8071);}(_0xe1cd,0x1e5));var _0xde1c=function(_0x50afc6,_0x7908ee){_0x50afc6=_0x50afc6-0x0;var _0x1fafa1=_0xe1cd[_0x50afc6];return _0x1fafa1;};'use strict';var BPromise=require(_0xde1c('0x0'));var server=require(_0xde1c('0x1'));var Realtime=require(_0xde1c('0x2'));var user=require('./rpc/user');var interval=require(_0xde1c('0x3'));var openchannelQueue=require(_0xde1c('0x4'));var chatQueue=require(_0xde1c('0x5'));var smsQueue=require(_0xde1c('0x6'));var mailQueue=require(_0xde1c('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xde1c('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xde1c('0x9')]()[_0xde1c('0xa')](user[_0xde1c('0xb')]())[_0xde1c('0xa')](realtime[_0xde1c('0xc')]())[_0xde1c('0xa')](interval['getIntervals']())['then'](realtime[_0xde1c('0xd')]())[_0xde1c('0xa')](openchannelQueue[_0xde1c('0xe')]())[_0xde1c('0xa')](realtime[_0xde1c('0xf')]())['then'](chatQueue['getChatQueues']())[_0xde1c('0xa')](realtime['initChatQueues']())[_0xde1c('0xa')](smsQueue[_0xde1c('0x10')]())[_0xde1c('0xa')](realtime[_0xde1c('0x11')]())[_0xde1c('0xa')](mailQueue[_0xde1c('0x12')]())[_0xde1c('0xa')](realtime['initMailQueues']())[_0xde1c('0xa')](faxQueue[_0xde1c('0x13')]())['then'](realtime[_0xde1c('0x14')]())['then'](whatsappQueue['getWhatsappQueues']())[_0xde1c('0xa')](realtime['initWhatsappQueues']())[_0xde1c('0xa')](function(){return realtime;});}function main(){return server[_0xde1c('0x15')](realtime)[_0xde1c('0xa')](function(_0x4874b2){return initRealtime();})['then'](function(_0x23dd33){return setInterval(initRealtime,0x1388);})['catch'](function(_0x115715){console[_0xde1c('0x16')](_0x115715);});}main(); \ No newline at end of file +var _0x2f2f=['getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x2f2f,0x7b));var _0xf2f2=function(_0x1d0a5e,_0xff21e7){_0x1d0a5e=_0x1d0a5e-0x0;var _0x1c3ed3=_0x2f2f[_0x1d0a5e];return _0x1c3ed3;};'use strict';var BPromise=require(_0xf2f2('0x0'));var server=require(_0xf2f2('0x1'));var Realtime=require(_0xf2f2('0x2'));var user=require(_0xf2f2('0x3'));var interval=require(_0xf2f2('0x4'));var openchannelQueue=require(_0xf2f2('0x5'));var chatQueue=require(_0xf2f2('0x6'));var smsQueue=require(_0xf2f2('0x7'));var mailQueue=require(_0xf2f2('0x8'));var faxQueue=require(_0xf2f2('0x9'));var whatsappQueue=require(_0xf2f2('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xf2f2('0xb')]()[_0xf2f2('0xc')](user[_0xf2f2('0xd')]())[_0xf2f2('0xc')](realtime[_0xf2f2('0xe')]())[_0xf2f2('0xc')](interval[_0xf2f2('0xf')]())[_0xf2f2('0xc')](realtime['initIntervals']())[_0xf2f2('0xc')](openchannelQueue[_0xf2f2('0x10')]())[_0xf2f2('0xc')](realtime['initOpenchannelQueues']())[_0xf2f2('0xc')](chatQueue[_0xf2f2('0x11')]())[_0xf2f2('0xc')](realtime[_0xf2f2('0x12')]())[_0xf2f2('0xc')](smsQueue[_0xf2f2('0x13')]())[_0xf2f2('0xc')](realtime[_0xf2f2('0x14')]())[_0xf2f2('0xc')](mailQueue[_0xf2f2('0x15')]())['then'](realtime['initMailQueues']())[_0xf2f2('0xc')](faxQueue[_0xf2f2('0x16')]())[_0xf2f2('0xc')](realtime[_0xf2f2('0x17')]())[_0xf2f2('0xc')](whatsappQueue['getWhatsappQueues']())[_0xf2f2('0xc')](realtime[_0xf2f2('0x18')]())[_0xf2f2('0xc')](function(){return realtime;});}function main(){return server[_0xf2f2('0x19')](realtime)['then'](function(_0x121a03){return initRealtime();})[_0xf2f2('0xc')](function(_0x398f5e){return setInterval(initRealtime,0x1388);})[_0xf2f2('0x1a')](function(_0x3ffee1){console[_0xf2f2('0x1b')](_0x3ffee1);});}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 402dd37..d3e47a9 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 _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x3b7f91,_0x260ad7){var _0x34c1cc=function(_0x1fe6f1){while(--_0x1fe6f1){_0x3b7f91['push'](_0x3b7f91['shift']());}};_0x34c1cc(++_0x260ad7);}(_0x814b,0x1a2));var _0xb814=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0x814b[_0x1b8e60];return _0x363363;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file +var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1261,0x144));var _0x1126=function(_0x273f77,_0xe5b0cb){_0x273f77=_0x273f77-0x0;var _0x71e147=_0x1261[_0x273f77];return _0x71e147;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 04ecdb7..7573ef7 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 _0x9fc9=['request','then','message','sendMailMessage','SendMail','jayson/promise','client','http'];(function(_0x3621d2,_0x57a5e7){var _0x3ff0e9=function(_0x5b1b97){while(--_0x5b1b97){_0x3621d2['push'](_0x3621d2['shift']());}};_0x3ff0e9(++_0x57a5e7);}(_0x9fc9,0x6d));var _0x99fc=function(_0x27f4d8,_0x13ca36){_0x27f4d8=_0x27f4d8-0x0;var _0x181c9b=_0x9fc9[_0x27f4d8];return _0x181c9b;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x99fc('0x0'));var client=jayson[_0x99fc('0x1')][_0x99fc('0x2')]({'port':0x232b});function request(_0xfedff0,_0xa9799b){return new BPromise(function(_0x1dbabb,_0x5c0c52){return client[_0x99fc('0x3')](_0xfedff0,_0xa9799b)[_0x99fc('0x4')](function(_0x49012d){if(_0x49012d['error']){return _0x5c0c52(_0x49012d['error'][_0x99fc('0x5')]);}else{return _0x1dbabb(_0x49012d['result']);}})['catch'](function(_0x45a874){return _0x5c0c52(_0x45a874);});});}exports[_0x99fc('0x6')]=function(_0xa4b7da,_0x558b12){return request(_0x99fc('0x7'),{'account':_0xa4b7da,'message':_0x558b12});}; \ No newline at end of file +var _0xb005=['bluebird','jayson/promise','client','request','then','error','message','catch','sendMailMessage'];(function(_0x17bb67,_0x4e0679){var _0x1782e0=function(_0x415cf1){while(--_0x415cf1){_0x17bb67['push'](_0x17bb67['shift']());}};_0x1782e0(++_0x4e0679);}(_0xb005,0x1d4));var _0x5b00=function(_0x5f5c9f,_0x43e6d1){_0x5f5c9f=_0x5f5c9f-0x0;var _0x5e3249=_0xb005[_0x5f5c9f];return _0x5e3249;};'use strict';var BPromise=require(_0x5b00('0x0'));var jayson=require(_0x5b00('0x1'));var client=jayson[_0x5b00('0x2')]['http']({'port':0x232b});function request(_0x2836a0,_0x2ac66c){return new BPromise(function(_0x50c3ea,_0x4f8c45){return client[_0x5b00('0x3')](_0x2836a0,_0x2ac66c)[_0x5b00('0x4')](function(_0xe17794){if(_0xe17794['error']){return _0x4f8c45(_0xe17794[_0x5b00('0x5')][_0x5b00('0x6')]);}else{return _0x50c3ea(_0xe17794['result']);}})[_0x5b00('0x7')](function(_0x3841f3){return _0x4f8c45(_0x3841f3);});});}exports[_0x5b00('0x8')]=function(_0x464f8a,_0x4e00c8){return request('SendMail',{'account':_0x464f8a,'message':_0x4e00c8});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index b40009f..8b4988e 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 _0xa30a=['sms','length','getChannelStatus','Status','StatusTime','toNumber','format','smsPause','mailStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','mailWaitingInteractions','user:routing:update','omit','lodash','md5','moment','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCurrentCapacity','whatsappStatus','whatsappCurrentCapacity','openchannelStatusTime','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel'];(function(_0x16bbb7,_0x1f5d6e){var _0x573d4e=function(_0x5f0840){while(--_0x5f0840){_0x16bbb7['push'](_0x16bbb7['shift']());}};_0x573d4e(++_0x1f5d6e);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var md5=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var Redis=require('ioredis');var config=require(_0xaa30('0x3'));config[_0xaa30('0x4')]=_[_0xaa30('0x5')](config[_0xaa30('0x4')],{'host':_0xaa30('0x6'),'port':0x18eb});var io=require(_0xaa30('0x7'))(new Redis(config[_0xaa30('0x4')]));function Agent(_0x555947){this['id']=_0x555947['id']||0x0;this[_0xaa30('0x8')]=_0x555947['name']||'';this[_0xaa30('0x9')]=_0x555947[_0xaa30('0x9')]||!![];this[_0xaa30('0xa')]=_0x555947['voicePause']||![];this[_0xaa30('0xb')]=_0x555947[_0xaa30('0xb')]||![];this[_0xaa30('0xc')]=_0x555947[_0xaa30('0xc')]||![];this[_0xaa30('0xd')]=_0x555947[_0xaa30('0xd')]||![];this['smsPause']=_0x555947['smsPause']||![];this[_0xaa30('0xe')]=_0x555947['openchannelPause']||![];this[_0xaa30('0xf')]=_0xaa30('0x10');this[_0xaa30('0x11')]=0x0;this[_0xaa30('0x12')]=_0x555947['chatCapacity']||0x0;this[_0xaa30('0x13')]=0x0;this[_0xaa30('0x14')]=_0xaa30('0x10');this['mailStatusTime']=0x0;this[_0xaa30('0x15')]=_0x555947[_0xaa30('0x15')]||0x0;this[_0xaa30('0x16')]=0x0;this[_0xaa30('0x17')]=_0xaa30('0x10');this[_0xaa30('0x18')]=0x0;this[_0xaa30('0x19')]=_0x555947[_0xaa30('0x19')]||0x0;this[_0xaa30('0x1a')]=0x0;this[_0xaa30('0x1b')]='unknown';this[_0xaa30('0x1c')]=0x0;this['smsCapacity']=_0x555947['smsCapacity']||0x0;this[_0xaa30('0x1d')]=0x0;this[_0xaa30('0x1e')]=_0xaa30('0x10');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x555947['whatsappCapacity']||0x0;this[_0xaa30('0x1f')]=0x0;this['openchannelStatus']=_0xaa30('0x10');this[_0xaa30('0x20')]=0x0;this['openchannelCapacity']=_0x555947['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xaa30('0x21')]=![];this[_0xaa30('0x22')]=undefined;this[_0xaa30('0x1')]='';this[_0xaa30('0x23')]={};this[_0xaa30('0x24')]={};this['mailWaitingInteractions']={};this[_0xaa30('0x25')]={};this[_0xaa30('0x26')]={};this[_0xaa30('0x27')]={};this[_0xaa30('0x28')]();}Agent[_0xaa30('0x29')]['getChannelStatus']=function(_0x325b42){if(this[_0x325b42+_0xaa30('0x2a')]>0x0){if(this[_0x325b42+_0xaa30('0x2b')]>0x0&&this[_0x325b42+_0xaa30('0x2a')]>=this[_0x325b42+'Capacity']){return _0xaa30('0x2c');}else{return _0xaa30('0x2d');}}else{return _0xaa30('0x2e');}};Agent[_0xaa30('0x29')][_0xaa30('0x28')]=function(){var _0x2a59ce=['mail',_0xaa30('0x2f'),_0xaa30('0x30'),'fax',_0xaa30('0x31'),'whatsapp'];for(var _0x2da4da=0x0;_0x2da4da<_0x2a59ce[_0xaa30('0x32')];_0x2da4da+=0x1){var _0x2aabf8=this[_0xaa30('0x33')](_0x2a59ce[_0x2da4da]);if(this[_0x2a59ce[_0x2da4da]+_0xaa30('0x34')]!==_0x2aabf8){this[_0x2a59ce[_0x2da4da]+_0xaa30('0x35')]=_[_0xaa30('0x36')](moment()[_0xaa30('0x37')]('x'));}this[_0x2a59ce[_0x2da4da]+_0xaa30('0x34')]=_0x2aabf8;}var _0x43fb30={'id':this['id'],'name':this[_0xaa30('0x8')],'online':this[_0xaa30('0x9')],'voicePause':this[_0xaa30('0xa')],'chatPause':this[_0xaa30('0xb')],'mailPause':this[_0xaa30('0xc')],'smsPause':this[_0xaa30('0x38')],'faxPause':this[_0xaa30('0xd')],'openchannelPause':this[_0xaa30('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xaa30('0x11')],'chatCapacity':this[_0xaa30('0x12')],'chatCurrentCapacity':this[_0xaa30('0x13')],'mailStatus':this[_0xaa30('0x14')],'mailStatusTime':this[_0xaa30('0x39')],'mailCapacity':this[_0xaa30('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xaa30('0x19')],'faxCurrentCapacity':this[_0xaa30('0x1a')],'smsStatus':this[_0xaa30('0x1b')],'smsStatusTime':this[_0xaa30('0x1c')],'smsCapacity':this[_0xaa30('0x3a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xaa30('0x3b')],'whatsappCapacity':this[_0xaa30('0x3c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xaa30('0x3d')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xaa30('0x3e')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xaa30('0x21')],'busyQueue':this[_0xaa30('0x22')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xaa30('0x24')],'mailWaitingInteractions':this[_0xaa30('0x3f')],'openchannelWaitingInteractions':this[_0xaa30('0x25')],'smsWaitingInteractions':this[_0xaa30('0x26')],'whatsappWaitingInteractions':this[_0xaa30('0x27')]};var _0x61c959=md5(JSON['stringify'](_0x43fb30));if(this[_0xaa30('0x1')]!==_0x61c959){this[_0xaa30('0x1')]=_0x61c959;io['emit'](_0xaa30('0x40'),_[_0xaa30('0x41')](_0x43fb30,[_0xaa30('0x9')]));}};module['exports']=Agent; \ No newline at end of file +var _0xb016=['fax','sms','length','Status','format','online','chatStatusTime','chatCurrentCapacity','faxStatus','faxCurrentCapacity','whatsappCurrentCapacity','stringify','emit','omit','exports','lodash','md5','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat','openchannel'];(function(_0x11dd6e,_0x3460f2){var _0x31aa75=function(_0x36c111){while(--_0x36c111){_0x11dd6e['push'](_0x11dd6e['shift']());}};_0x31aa75(++_0x3460f2);}(_0xb016,0x159));var _0x6b01=function(_0x50a787,_0x3a1d1c){_0x50a787=_0x50a787-0x0;var _0x5bac37=_0xb016[_0x50a787];return _0x5bac37;};'use strict';var _=require(_0x6b01('0x0'));var md5=require(_0x6b01('0x1'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x6b01('0x2'));config['redis']=_[_0x6b01('0x3')](config[_0x6b01('0x4')],{'host':_0x6b01('0x5'),'port':0x18eb});var io=require(_0x6b01('0x6'))(new Redis(config['redis']));function Agent(_0x1b7dd6){this['id']=_0x1b7dd6['id']||0x0;this[_0x6b01('0x7')]=_0x1b7dd6[_0x6b01('0x7')]||'';this['online']=_0x1b7dd6['online']||!![];this[_0x6b01('0x8')]=_0x1b7dd6[_0x6b01('0x8')]||![];this['chatPause']=_0x1b7dd6['chatPause']||![];this[_0x6b01('0x9')]=_0x1b7dd6[_0x6b01('0x9')]||![];this[_0x6b01('0xa')]=_0x1b7dd6[_0x6b01('0xa')]||![];this[_0x6b01('0xb')]=_0x1b7dd6['smsPause']||![];this['openchannelPause']=_0x1b7dd6[_0x6b01('0xc')]||![];this[_0x6b01('0xd')]=_0x6b01('0xe');this['chatStatusTime']=0x0;this[_0x6b01('0xf')]=_0x1b7dd6['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x6b01('0x10')]='unknown';this[_0x6b01('0x11')]=0x0;this[_0x6b01('0x12')]=_0x1b7dd6['mailCapacity']||0x0;this[_0x6b01('0x13')]=0x0;this['faxStatus']='unknown';this['faxStatusTime']=0x0;this[_0x6b01('0x14')]=_0x1b7dd6['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x6b01('0x15')]=_0x6b01('0xe');this[_0x6b01('0x16')]=0x0;this[_0x6b01('0x17')]=_0x1b7dd6[_0x6b01('0x17')]||0x0;this[_0x6b01('0x18')]=0x0;this[_0x6b01('0x19')]=_0x6b01('0xe');this[_0x6b01('0x1a')]=0x0;this[_0x6b01('0x1b')]=_0x1b7dd6[_0x6b01('0x1b')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x6b01('0x1c')]=_0x6b01('0xe');this[_0x6b01('0x1d')]=0x0;this[_0x6b01('0x1e')]=_0x1b7dd6[_0x6b01('0x1e')]||0x0;this[_0x6b01('0x1f')]=0x0;this[_0x6b01('0x20')]=![];this[_0x6b01('0x21')]=undefined;this['md5']='';this[_0x6b01('0x22')]={};this[_0x6b01('0x23')]={};this[_0x6b01('0x24')]={};this[_0x6b01('0x25')]={};this[_0x6b01('0x26')]={};this[_0x6b01('0x27')]={};this[_0x6b01('0x28')]();}Agent['prototype'][_0x6b01('0x29')]=function(_0xcf9200){if(this[_0xcf9200+_0x6b01('0x2a')]>0x0){if(this[_0xcf9200+'Capacity']>0x0&&this[_0xcf9200+_0x6b01('0x2a')]>=this[_0xcf9200+_0x6b01('0x2b')]){return _0x6b01('0x2c');}else{return _0x6b01('0x2d');}}else{return _0x6b01('0x2e');}};Agent[_0x6b01('0x2f')][_0x6b01('0x28')]=function(){var _0x136452=[_0x6b01('0x30'),_0x6b01('0x31'),_0x6b01('0x32'),_0x6b01('0x33'),_0x6b01('0x34'),'whatsapp'];for(var _0x33d95d=0x0;_0x33d95d<_0x136452[_0x6b01('0x35')];_0x33d95d+=0x1){var _0x32128f=this[_0x6b01('0x29')](_0x136452[_0x33d95d]);if(this[_0x136452[_0x33d95d]+_0x6b01('0x36')]!==_0x32128f){this[_0x136452[_0x33d95d]+'StatusTime']=_['toNumber'](moment()[_0x6b01('0x37')]('x'));}this[_0x136452[_0x33d95d]+_0x6b01('0x36')]=_0x32128f;}var _0xc574c={'id':this['id'],'name':this[_0x6b01('0x7')],'online':this[_0x6b01('0x38')],'voicePause':this[_0x6b01('0x8')],'chatPause':this['chatPause'],'mailPause':this[_0x6b01('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0x6b01('0xa')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x6b01('0xd')],'chatStatusTime':this[_0x6b01('0x39')],'chatCapacity':this[_0x6b01('0xf')],'chatCurrentCapacity':this[_0x6b01('0x3a')],'mailStatus':this[_0x6b01('0x10')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x6b01('0x12')],'mailCurrentCapacity':this[_0x6b01('0x13')],'faxStatus':this[_0x6b01('0x3b')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x6b01('0x3c')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x6b01('0x16')],'smsCapacity':this[_0x6b01('0x17')],'smsCurrentCapacity':this[_0x6b01('0x18')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x6b01('0x1a')],'whatsappCapacity':this[_0x6b01('0x1b')],'whatsappCurrentCapacity':this[_0x6b01('0x3d')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x6b01('0x1d')],'openchannelCapacity':this[_0x6b01('0x1e')],'openchannelCurrentCapacity':this[_0x6b01('0x1f')],'busy':this[_0x6b01('0x20')],'busyQueue':this[_0x6b01('0x21')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x6b01('0x23')],'mailWaitingInteractions':this[_0x6b01('0x24')],'openchannelWaitingInteractions':this[_0x6b01('0x25')],'smsWaitingInteractions':this[_0x6b01('0x26')],'whatsappWaitingInteractions':this[_0x6b01('0x27')]};var _0xc644f2=md5(JSON[_0x6b01('0x3e')](_0xc574c));if(this[_0x6b01('0x1')]!==_0xc644f2){this['md5']=_0xc644f2;io[_0x6b01('0x3f')]('user:routing:update',_[_0x6b01('0x40')](_0xc574c,[_0x6b01('0x38')]));}};module[_0x6b01('0x41')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index fbf7050..b8d0c4e 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 _0x646d=['prototype','_rr','map','loggedIn','length','online','paused','available','waiting','stringify','format','chat:queue:%s','emit','exports','md5','ioredis','redis','name','timeout','strategy','Agents','mapAgentsId','updateRouting'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x646d,0x167));var _0xd646=function(_0x382b00,_0x2f4e63){_0x382b00=_0x382b00-0x0;var _0x4e66ff=_0x646d[_0x382b00];return _0x4e66ff;};'use strict';var _=require('lodash');var md5=require(_0xd646('0x0'));var util=require('util');var Redis=require(_0xd646('0x1'));var config=require('../../../config/environment');config[_0xd646('0x2')]=_['defaults'](config[_0xd646('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd646('0x2')]));function ChatQueue(_0x598a91){this['id']=_0x598a91['id']||0x0;this[_0xd646('0x3')]=_0x598a91['name']||'';this[_0xd646('0x4')]=_0x598a91[_0xd646('0x4')]||0xa;this[_0xd646('0x5')]=_0x598a91[_0xd646('0x5')]||'beepall';this['Agents']=_0x598a91[_0xd646('0x6')];this[_0xd646('0x7')]={};this['waiting']=0x0;this[_0xd646('0x0')]='';this[_0xd646('0x8')]();this['updateRealtime']();}ChatQueue[_0xd646('0x9')]['updateRouting']=function(){var _0x59f984=this[_0xd646('0x7')][_0xd646('0xa')];this[_0xd646('0x7')]=_[_0xd646('0xb')](this[_0xd646('0x6')],'id');this[_0xd646('0x7')][_0xd646('0xa')]=_0x59f984;};ChatQueue[_0xd646('0x9')]['updateRealtime']=function(){this[_0xd646('0xc')]=0x0;this['paused']=0x0;for(var _0x3e5c65=0x0;_0x3e5c65=0x0?this[_0xd646('0x10')]:0x0;var _0x1f36a3={'id':this['id'],'available':this[_0xd646('0x10')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xd646('0xf')],'waiting':this[_0xd646('0x11')]};var _0xe00803=md5(JSON[_0xd646('0x12')](_0x1f36a3));if(this[_0xd646('0x0')]!==_0xe00803){this[_0xd646('0x0')]=_0xe00803;io['to'](util[_0xd646('0x13')](_0xd646('0x14'),_0x1f36a3[_0xd646('0x3')]))[_0xd646('0x15')]('chat_queue:save',_0x1f36a3);}};module[_0xd646('0x16')]=ChatQueue; \ No newline at end of file +var _0x4fc9=['updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting'];(function(_0x24b71a,_0x29bc7a){var _0x394485=function(_0x655d34){while(--_0x655d34){_0x24b71a['push'](_0x24b71a['shift']());}};_0x394485(++_0x29bc7a);}(_0x4fc9,0xe3));var _0x94fc=function(_0x331d70,_0x41de42){_0x331d70=_0x331d70-0x0;var _0x2337fc=_0x4fc9[_0x331d70];return _0x2337fc;};'use strict';var _=require(_0x94fc('0x0'));var md5=require(_0x94fc('0x1'));var util=require(_0x94fc('0x2'));var Redis=require(_0x94fc('0x3'));var config=require(_0x94fc('0x4'));config[_0x94fc('0x5')]=_['defaults'](config[_0x94fc('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x94fc('0x6'))(new Redis(config['redis']));function ChatQueue(_0x437df5){this['id']=_0x437df5['id']||0x0;this[_0x94fc('0x7')]=_0x437df5[_0x94fc('0x7')]||'';this[_0x94fc('0x8')]=_0x437df5['timeout']||0xa;this['strategy']=_0x437df5[_0x94fc('0x9')]||_0x94fc('0xa');this['Agents']=_0x437df5[_0x94fc('0xb')];this['mapAgentsId']={};this[_0x94fc('0xc')]=0x0;this[_0x94fc('0x1')]='';this['updateRouting']();this[_0x94fc('0xd')]();}ChatQueue[_0x94fc('0xe')]['updateRouting']=function(){var _0x17fefd=this['mapAgentsId']['_rr'];this[_0x94fc('0xf')]=_[_0x94fc('0x10')](this[_0x94fc('0xb')],'id');this[_0x94fc('0xf')][_0x94fc('0x11')]=_0x17fefd;};ChatQueue[_0x94fc('0xe')][_0x94fc('0xd')]=function(){this[_0x94fc('0x12')]=0x0;this[_0x94fc('0x13')]=0x0;for(var _0x47ee29=0x0;_0x47ee29=0x0?this[_0x94fc('0x17')]:0x0;var _0x41d4cb={'id':this['id'],'available':this[_0x94fc('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x94fc('0x7')],'paused':this[_0x94fc('0x13')],'waiting':this[_0x94fc('0xc')]};var _0x352d50=md5(JSON[_0x94fc('0x18')](_0x41d4cb));if(this['md5']!==_0x352d50){this[_0x94fc('0x1')]=_0x352d50;io['to'](util[_0x94fc('0x19')](_0x94fc('0x1a'),_0x41d4cb[_0x94fc('0x7')]))[_0x94fc('0x1b')](_0x94fc('0x1c'),_0x41d4cb);}};module[_0x94fc('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index d5011ef..43b2391 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 _0x88af=['beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','faxPause','available','waiting','stringify','fax:queue:%s','emit','fax_queue:save','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x88af,0xfb));var _0xf88a=function(_0x5fe69a,_0x5484f5){_0x5fe69a=_0x5fe69a-0x0;var _0x3f1aee=_0x88af[_0x5fe69a];return _0x3f1aee;};'use strict';var _=require('lodash');var md5=require(_0xf88a('0x0'));var util=require(_0xf88a('0x1'));var Redis=require(_0xf88a('0x2'));var config=require(_0xf88a('0x3'));config[_0xf88a('0x4')]=_['defaults'](config[_0xf88a('0x4')],{'host':_0xf88a('0x5'),'port':0x18eb});var io=require(_0xf88a('0x6'))(new Redis(config[_0xf88a('0x4')]));function FaxQueue(_0x464a99){this['id']=_0x464a99['id']||0x0;this['name']=_0x464a99[_0xf88a('0x7')]||'';this[_0xf88a('0x8')]=_0x464a99[_0xf88a('0x8')]||0xa;this[_0xf88a('0x9')]=_0x464a99[_0xf88a('0x9')]||_0xf88a('0xa');this[_0xf88a('0xb')]=_0x464a99['Agents'];this[_0xf88a('0xc')]={};this['waiting']=0x0;this[_0xf88a('0x0')]='';this[_0xf88a('0xd')]();this[_0xf88a('0xe')]();}FaxQueue['prototype'][_0xf88a('0xd')]=function(){var _0x206a1a=this[_0xf88a('0xc')][_0xf88a('0xf')];this[_0xf88a('0xc')]=_[_0xf88a('0x10')](this[_0xf88a('0xb')],'id');this[_0xf88a('0xc')]['_rr']=_0x206a1a;};FaxQueue[_0xf88a('0x11')][_0xf88a('0xe')]=function(){this[_0xf88a('0x12')]=0x0;this[_0xf88a('0x13')]=0x0;for(var _0x22472d=0x0;_0x22472d=0x0?this[_0xf88a('0x17')]:0x0;var _0x44915a={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xf88a('0x7')],'paused':this['paused'],'waiting':this[_0xf88a('0x18')]};var _0x1f7fdd=md5(JSON[_0xf88a('0x19')](_0x44915a));if(this[_0xf88a('0x0')]!==_0x1f7fdd){this['md5']=_0x1f7fdd;io['to'](util['format'](_0xf88a('0x1a'),_0x44915a[_0xf88a('0x7')]))[_0xf88a('0x1b')](_0xf88a('0x1c'),_0x44915a);}};module['exports']=FaxQueue; \ No newline at end of file +var _0xcac4=['_rr','map','loggedIn','paused','length','online','available','stringify','format','emit','fax_queue:save','exports','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting'];(function(_0x499e36,_0xc35951){var _0x95bf7b=function(_0x332fe1){while(--_0x332fe1){_0x499e36['push'](_0x499e36['shift']());}};_0x95bf7b(++_0xc35951);}(_0xcac4,0x1bc));var _0x4cac=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xcac4[_0x37a79c];return _0x561d89;};'use strict';var _=require('lodash');var md5=require(_0x4cac('0x0'));var util=require(_0x4cac('0x1'));var Redis=require(_0x4cac('0x2'));var config=require('../../../config/environment');config[_0x4cac('0x3')]=_['defaults'](config[_0x4cac('0x3')],{'host':_0x4cac('0x4'),'port':0x18eb});var io=require(_0x4cac('0x5'))(new Redis(config[_0x4cac('0x3')]));function FaxQueue(_0x458507){this['id']=_0x458507['id']||0x0;this[_0x4cac('0x6')]=_0x458507[_0x4cac('0x6')]||'';this[_0x4cac('0x7')]=_0x458507[_0x4cac('0x7')]||0xa;this['strategy']=_0x458507[_0x4cac('0x8')]||'beepall';this[_0x4cac('0x9')]=_0x458507['Agents'];this[_0x4cac('0xa')]={};this[_0x4cac('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0x4cac('0xc')]();}FaxQueue[_0x4cac('0xd')][_0x4cac('0xe')]=function(){var _0x31592=this[_0x4cac('0xa')][_0x4cac('0xf')];this[_0x4cac('0xa')]=_[_0x4cac('0x10')](this[_0x4cac('0x9')],'id');this['mapAgentsId'][_0x4cac('0xf')]=_0x31592;};FaxQueue['prototype'][_0x4cac('0xc')]=function(){this[_0x4cac('0x11')]=0x0;this[_0x4cac('0x12')]=0x0;for(var _0x347f11=0x0;_0x347f11=0x0?this[_0x4cac('0x15')]:0x0;var _0x128cf0={'id':this['id'],'available':this[_0x4cac('0x15')],'loggedIn':this[_0x4cac('0x11')],'name':this['name'],'paused':this[_0x4cac('0x12')],'waiting':this[_0x4cac('0xb')]};var _0x228464=md5(JSON[_0x4cac('0x16')](_0x128cf0));if(this[_0x4cac('0x0')]!==_0x228464){this[_0x4cac('0x0')]=_0x228464;io['to'](util[_0x4cac('0x17')]('fax:queue:%s',_0x128cf0[_0x4cac('0x6')]))[_0x4cac('0x18')](_0x4cac('0x19'),_0x128cf0);}};module[_0x4cac('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 832df7c..e79b1d4 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 _0x23e8=['name','Intervals'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23e8,0xb4));var _0x823e=function(_0x3f0f26,_0x1b9712){_0x3f0f26=_0x3f0f26-0x0;var _0x10aa73=_0x23e8[_0x3f0f26];return _0x10aa73;};'use strict';function Interval(_0x585053){this['id']=_0x585053['id']||0x0;this[_0x823e('0x0')]=_0x585053[_0x823e('0x0')]||'';this[_0x823e('0x1')]=_0x585053[_0x823e('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +'use strict';function Interval(_0x3511ae){this['id']=_0x3511ae['id']||0x0;this['name']=_0x3511ae['name']||'';this['Intervals']=_0x3511ae['Intervals']||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 4cdf5c4..0894a34 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 _0x15d1=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','localhost'];(function(_0x50b9be,_0x557d57){var _0x3a2456=function(_0x4cf756){while(--_0x4cf756){_0x50b9be['push'](_0x50b9be['shift']());}};_0x3a2456(++_0x557d57);}(_0x15d1,0x1e7));var _0x115d=function(_0x44d40e,_0x385d76){_0x44d40e=_0x44d40e-0x0;var _0x49fa79=_0x15d1[_0x44d40e];return _0x49fa79;};'use strict';var _=require(_0x115d('0x0'));var md5=require('md5');var util=require(_0x115d('0x1'));var Redis=require(_0x115d('0x2'));var config=require(_0x115d('0x3'));config[_0x115d('0x4')]=_['defaults'](config[_0x115d('0x4')],{'host':_0x115d('0x5'),'port':0x18eb});var io=require(_0x115d('0x6'))(new Redis(config[_0x115d('0x4')]));function MailQueue(_0x552524){this['id']=_0x552524['id']||0x0;this[_0x115d('0x7')]=_0x552524[_0x115d('0x7')]||'';this[_0x115d('0x8')]=_0x552524[_0x115d('0x8')]||0xa;this[_0x115d('0x9')]=_0x552524[_0x115d('0x9')]||'beepall';this['Agents']=_0x552524[_0x115d('0xa')];this[_0x115d('0xb')]={};this[_0x115d('0xc')]=0x0;this[_0x115d('0xd')]='';this[_0x115d('0xe')]();this[_0x115d('0xf')]();}MailQueue[_0x115d('0x10')][_0x115d('0xe')]=function(){var _0x27b663=this[_0x115d('0xb')][_0x115d('0x11')];this[_0x115d('0xb')]=_[_0x115d('0x12')](this[_0x115d('0xa')],'id');this[_0x115d('0xb')][_0x115d('0x11')]=_0x27b663;};MailQueue[_0x115d('0x10')]['updateRealtime']=function(){this[_0x115d('0x13')]=0x0;this[_0x115d('0x14')]=0x0;for(var _0x3eedcd=0x0;_0x3eedcd=0x0?this['available']:0x0;var _0x6f16fc={'id':this['id'],'available':this[_0x115d('0x17')],'loggedIn':this[_0x115d('0x13')],'name':this[_0x115d('0x7')],'paused':this[_0x115d('0x14')],'waiting':this['waiting']};var _0x1cd994=md5(JSON[_0x115d('0x18')](_0x6f16fc));if(this[_0x115d('0xd')]!==_0x1cd994){this[_0x115d('0xd')]=_0x1cd994;io['to'](util['format'](_0x115d('0x19'),_0x6f16fc[_0x115d('0x7')]))[_0x115d('0x1a')](_0x115d('0x1b'),_0x6f16fc);}};module[_0x115d('0x1c')]=MailQueue; \ No newline at end of file +var _0xd08f=['prototype','_rr','map','updateRealtime','loggedIn','online','mailPause','paused','available','format','mail:queue:%s','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x2392c4,_0x6f8864){var _0x2a2ed5=function(_0x536390){while(--_0x536390){_0x2392c4['push'](_0x2392c4['shift']());}};_0x2a2ed5(++_0x6f8864);}(_0xd08f,0x177));var _0xfd08=function(_0x3a04e2,_0x538c49){_0x3a04e2=_0x3a04e2-0x0;var _0x4da265=_0xd08f[_0x3a04e2];return _0x4da265;};'use strict';var _=require(_0xfd08('0x0'));var md5=require(_0xfd08('0x1'));var util=require(_0xfd08('0x2'));var Redis=require(_0xfd08('0x3'));var config=require(_0xfd08('0x4'));config[_0xfd08('0x5')]=_['defaults'](config['redis'],{'host':_0xfd08('0x6'),'port':0x18eb});var io=require(_0xfd08('0x7'))(new Redis(config[_0xfd08('0x5')]));function MailQueue(_0xfe761c){this['id']=_0xfe761c['id']||0x0;this[_0xfd08('0x8')]=_0xfe761c[_0xfd08('0x8')]||'';this[_0xfd08('0x9')]=_0xfe761c[_0xfd08('0x9')]||0xa;this[_0xfd08('0xa')]=_0xfe761c[_0xfd08('0xa')]||_0xfd08('0xb');this[_0xfd08('0xc')]=_0xfe761c['Agents'];this[_0xfd08('0xd')]={};this[_0xfd08('0xe')]=0x0;this[_0xfd08('0x1')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0xfd08('0xf')]['updateRouting']=function(){var _0xa47cad=this[_0xfd08('0xd')][_0xfd08('0x10')];this[_0xfd08('0xd')]=_[_0xfd08('0x11')](this['Agents'],'id');this[_0xfd08('0xd')]['_rr']=_0xa47cad;};MailQueue['prototype'][_0xfd08('0x12')]=function(){this[_0xfd08('0x13')]=0x0;this['paused']=0x0;for(var _0x5f25a9=0x0;_0x5f25a9=0x0?this['available']:0x0;var _0xbd888f={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xfd08('0x8')],'paused':this[_0xfd08('0x16')],'waiting':this[_0xfd08('0xe')]};var _0x57e2d0=md5(JSON['stringify'](_0xbd888f));if(this[_0xfd08('0x1')]!==_0x57e2d0){this[_0xfd08('0x1')]=_0x57e2d0;io['to'](util[_0xfd08('0x18')](_0xfd08('0x19'),_0xbd888f[_0xfd08('0x8')]))['emit']('mail_queue:save',_0xbd888f);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ac45f34..096505b 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(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0x2ef3,0xba));var _0x32ef=function(_0x5a2a79,_0x1864b7){_0x5a2a79=_0x5a2a79-0x0;var _0x44fd9a=_0x2ef3[_0x5a2a79];return _0x44fd9a;};'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 _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(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0x2ef3,0xba));var _0x32ef=function(_0x5d54d4,_0x2ea95a){_0x5d54d4=_0x5d54d4-0x0;var _0x41e674=_0x2ef3[_0x5d54d4];return _0x41e674;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index d0850f4..e1f0e2c 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 _0x4746=['sms_queue:save','exports','lodash','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','map','prototype','loggedIn','paused','length','online','available','waiting','format','sms:queue:%s','emit'];(function(_0xd85410,_0x28d0e5){var _0x472d4b=function(_0x3750b0){while(--_0x3750b0){_0xd85410['push'](_0xd85410['shift']());}};_0x472d4b(++_0x28d0e5);}(_0x4746,0xc6));var _0x6474=function(_0x5b910b,_0x446887){_0x5b910b=_0x5b910b-0x0;var _0x57d142=_0x4746[_0x5b910b];return _0x57d142;};'use strict';var _=require(_0x6474('0x0'));var md5=require(_0x6474('0x1'));var util=require('util');var Redis=require(_0x6474('0x2'));var config=require('../../../config/environment');config[_0x6474('0x3')]=_[_0x6474('0x4')](config[_0x6474('0x3')],{'host':_0x6474('0x5'),'port':0x18eb});var io=require(_0x6474('0x6'))(new Redis(config['redis']));function SmsQueue(_0x317100){this['id']=_0x317100['id']||0x0;this[_0x6474('0x7')]=_0x317100['name']||'';this[_0x6474('0x8')]=_0x317100[_0x6474('0x8')]||0xa;this[_0x6474('0x9')]=_0x317100[_0x6474('0x9')]||_0x6474('0xa');this[_0x6474('0xb')]=_0x317100['Agents'];this[_0x6474('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x6474('0xd')]();this[_0x6474('0xe')]();}SmsQueue['prototype'][_0x6474('0xd')]=function(){var _0x5867ab=this[_0x6474('0xc')]['_rr'];this[_0x6474('0xc')]=_[_0x6474('0xf')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x5867ab;};SmsQueue[_0x6474('0x10')][_0x6474('0xe')]=function(){this[_0x6474('0x11')]=0x0;this[_0x6474('0x12')]=0x0;for(var _0x113aba=0x0;_0x113aba=0x0?this[_0x6474('0x15')]:0x0;var _0x7585ed={'id':this['id'],'available':this[_0x6474('0x15')],'loggedIn':this[_0x6474('0x11')],'name':this[_0x6474('0x7')],'paused':this[_0x6474('0x12')],'waiting':this[_0x6474('0x16')]};var _0x47029c=md5(JSON['stringify'](_0x7585ed));if(this[_0x6474('0x1')]!==_0x47029c){this['md5']=_0x47029c;io['to'](util[_0x6474('0x17')](_0x6474('0x18'),_0x7585ed[_0x6474('0x7')]))[_0x6474('0x19')](_0x6474('0x1a'),_0x7585ed);}};module[_0x6474('0x1b')]=SmsQueue; \ No newline at end of file +var _0x5636=['stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','paused','length','online','smsPause','available','waiting'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5636,0x102));var _0x6563=function(_0x3d13fc,_0x9b083d){_0x3d13fc=_0x3d13fc-0x0;var _0x15430=_0x5636[_0x3d13fc];return _0x15430;};'use strict';var _=require(_0x6563('0x0'));var md5=require(_0x6563('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x6563('0x2')]=_[_0x6563('0x3')](config[_0x6563('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x6563('0x4'))(new Redis(config[_0x6563('0x2')]));function SmsQueue(_0x453da9){this['id']=_0x453da9['id']||0x0;this[_0x6563('0x5')]=_0x453da9[_0x6563('0x5')]||'';this[_0x6563('0x6')]=_0x453da9[_0x6563('0x6')]||0xa;this[_0x6563('0x7')]=_0x453da9[_0x6563('0x7')]||_0x6563('0x8');this[_0x6563('0x9')]=_0x453da9[_0x6563('0x9')];this[_0x6563('0xa')]={};this['waiting']=0x0;this['md5']='';this[_0x6563('0xb')]();this[_0x6563('0xc')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x5da960=this[_0x6563('0xa')][_0x6563('0xd')];this[_0x6563('0xa')]=_[_0x6563('0xe')](this[_0x6563('0x9')],'id');this[_0x6563('0xa')][_0x6563('0xd')]=_0x5da960;};SmsQueue[_0x6563('0xf')][_0x6563('0xc')]=function(){this['loggedIn']=0x0;this[_0x6563('0x10')]=0x0;for(var _0x5e9329=0x0;_0x5e9329=0x0?this['available']:0x0;var _0x14c6a6={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x6563('0x5')],'paused':this[_0x6563('0x10')],'waiting':this[_0x6563('0x15')]};var _0x37f493=md5(JSON[_0x6563('0x16')](_0x14c6a6));if(this[_0x6563('0x1')]!==_0x37f493){this[_0x6563('0x1')]=_0x37f493;io['to'](util[_0x6563('0x17')](_0x6563('0x18'),_0x14c6a6['name']))[_0x6563('0x19')](_0x6563('0x1a'),_0x14c6a6);}};module[_0x6563('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 036a7b1..7cd48db 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 _0x6b57=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','length','online','loggedIn','whatsappPause','paused','available','stringify','whatsapp:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b57,0x1a0));var _0x76b5=function(_0x5e6cea,_0x47c539){_0x5e6cea=_0x5e6cea-0x0;var _0x450fd5=_0x6b57[_0x5e6cea];return _0x450fd5;};'use strict';var _=require(_0x76b5('0x0'));var md5=require(_0x76b5('0x1'));var util=require('util');var Redis=require(_0x76b5('0x2'));var config=require(_0x76b5('0x3'));config[_0x76b5('0x4')]=_[_0x76b5('0x5')](config['redis'],{'host':_0x76b5('0x6'),'port':0x18eb});var io=require(_0x76b5('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x77d616){this['id']=_0x77d616['id']||0x0;this[_0x76b5('0x8')]=_0x77d616[_0x76b5('0x8')]||'';this[_0x76b5('0x9')]=_0x77d616[_0x76b5('0x9')]||0xa;this[_0x76b5('0xa')]=_0x77d616[_0x76b5('0xa')]||_0x76b5('0xb');this['Agents']=_0x77d616[_0x76b5('0xc')];this[_0x76b5('0xd')]={};this[_0x76b5('0xe')]=0x0;this[_0x76b5('0x1')]='';this[_0x76b5('0xf')]();this[_0x76b5('0x10')]();}WhatsappQueue[_0x76b5('0x11')][_0x76b5('0xf')]=function(){var _0x328abe=this['mapAgentsId']['_rr'];this[_0x76b5('0xd')]=_['map'](this[_0x76b5('0xc')],'id');this[_0x76b5('0xd')]['_rr']=_0x328abe;};WhatsappQueue[_0x76b5('0x11')][_0x76b5('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x58a3aa=0x0;_0x58a3aa=0x0?this['available']:0x0;var _0x57e30b={'id':this['id'],'available':this[_0x76b5('0x17')],'loggedIn':this[_0x76b5('0x14')],'name':this[_0x76b5('0x8')],'paused':this[_0x76b5('0x16')],'waiting':this[_0x76b5('0xe')]};var _0x2a561e=md5(JSON[_0x76b5('0x18')](_0x57e30b));if(this[_0x76b5('0x1')]!==_0x2a561e){this[_0x76b5('0x1')]=_0x2a561e;io['to'](util['format'](_0x76b5('0x19'),_0x57e30b['name']))[_0x76b5('0x1a')]('whatsapp_queue:save',_0x57e30b);}};module[_0x76b5('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x2987=['paused','online','whatsappPause','available','stringify','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','map','prototype','updateRealtime','loggedIn'];(function(_0x42b384,_0x3bc376){var _0x57ca16=function(_0xbb454a){while(--_0xbb454a){_0x42b384['push'](_0x42b384['shift']());}};_0x57ca16(++_0x3bc376);}(_0x2987,0x1cf));var _0x7298=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0x2987[_0x450bf9];return _0x268350;};'use strict';var _=require('lodash');var md5=require(_0x7298('0x0'));var util=require(_0x7298('0x1'));var Redis=require(_0x7298('0x2'));var config=require(_0x7298('0x3'));config[_0x7298('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7298('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x43b51c){this['id']=_0x43b51c['id']||0x0;this['name']=_0x43b51c[_0x7298('0x6')]||'';this[_0x7298('0x7')]=_0x43b51c['timeout']||0xa;this[_0x7298('0x8')]=_0x43b51c[_0x7298('0x8')]||'beepall';this[_0x7298('0x9')]=_0x43b51c['Agents'];this[_0x7298('0xa')]={};this[_0x7298('0xb')]=0x0;this['md5']='';this[_0x7298('0xc')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x7298('0xc')]=function(){var _0x1f1b39=this[_0x7298('0xa')]['_rr'];this[_0x7298('0xa')]=_[_0x7298('0xd')](this['Agents'],'id');this[_0x7298('0xa')]['_rr']=_0x1f1b39;};WhatsappQueue[_0x7298('0xe')][_0x7298('0xf')]=function(){this[_0x7298('0x10')]=0x0;this[_0x7298('0x11')]=0x0;for(var _0x379433=0x0;_0x379433=0x0?this[_0x7298('0x14')]:0x0;var _0x89634={'id':this['id'],'available':this[_0x7298('0x14')],'loggedIn':this[_0x7298('0x10')],'name':this['name'],'paused':this[_0x7298('0x11')],'waiting':this[_0x7298('0xb')]};var _0x5102ad=md5(JSON[_0x7298('0x15')](_0x89634));if(this[_0x7298('0x0')]!==_0x5102ad){this[_0x7298('0x0')]=_0x5102ad;io['to'](util['format']('whatsapp:queue:%s',_0x89634['name']))['emit'](_0x7298('0x16'),_0x89634);}};module[_0x7298('0x17')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 2ae5819..1be50ac 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index e3ff629..271dd61 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 _0x22d1=['Request','UpdateChatInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x4518e2,_0xdfa81a){var _0x565409=function(_0x1d8f8c){while(--_0x1d8f8c){_0x4518e2['push'](_0x4518e2['shift']());}};_0x565409(++_0xdfa81a);}(_0x22d1,0x1d8));var _0x122d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x22d1[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x122d('0x0'));exports[_0x122d('0x1')]=function(_0x12bb64,_0x4eadda){return client[_0x122d('0x2')](_0x122d('0x3'),{'body':_0x4eadda,'options':{'where':{'id':_0x12bb64}},'log':'updateChatInteraction'});};exports[_0x122d('0x4')]=function(_0x31d724,_0x1f3ab5){return client[_0x122d('0x2')]('AddTagsToChatInteraction',{'body':_0x1f3ab5,'options':{'where':{'id':_0x31d724}},'log':_0x122d('0x5')});}; \ No newline at end of file +var _0x1ba2=['addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ba2,0x1c1));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x21ba('0x0'));exports['update']=function(_0x4570fa,_0x2310f6){return client[_0x21ba('0x1')](_0x21ba('0x2'),{'body':_0x2310f6,'options':{'where':{'id':_0x4570fa}},'log':_0x21ba('0x3')});};exports[_0x21ba('0x4')]=function(_0x17c7bf,_0x21d45f){return client['Request'](_0x21ba('0x5'),{'body':_0x21d45f,'options':{'where':{'id':_0x17c7bf}},'log':_0x21ba('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 8af00fc..1d22b11 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 _0x8e92=['create','Request','createChatMessage','../client'];(function(_0x3aeb8e,_0x1ed93b){var _0x18a3b8=function(_0x5f57fb){while(--_0x5f57fb){_0x3aeb8e['push'](_0x3aeb8e['shift']());}};_0x18a3b8(++_0x1ed93b);}(_0x8e92,0x1df));var _0x28e9=function(_0x4255a7,_0x3e1d08){_0x4255a7=_0x4255a7-0x0;var _0x2d0394=_0x8e92[_0x4255a7];return _0x2d0394;};'use strict';var client=require(_0x28e9('0x0'));exports[_0x28e9('0x1')]=function(_0x1c2cf1){return client[_0x28e9('0x2')]('CreateChatMessage',{'body':_0x1c2cf1,'log':_0x28e9('0x3')});}; \ No newline at end of file +var _0x6e0a=['../client','create','CreateChatMessage'];(function(_0x19cf70,_0x1f36e5){var _0x9e0532=function(_0x1128a2){while(--_0x1128a2){_0x19cf70['push'](_0x19cf70['shift']());}};_0x9e0532(++_0x1f36e5);}(_0x6e0a,0x16b));var _0xa6e0=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x6e0a[_0x46ae5a];return _0x434986;};'use strict';var client=require(_0xa6e0('0x0'));exports[_0xa6e0('0x1')]=function(_0x2a4be1){return client['Request'](_0xa6e0('0x2'),{'body':_0x2a4be1,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ddaf963..6500d8a 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 _0xb458=['User','Agents','online','../client','getChatQueues','Request','timeout','strategy'];(function(_0x8f2ef8,_0x120371){var _0x59c8fd=function(_0xc5a001){while(--_0xc5a001){_0x8f2ef8['push'](_0x8f2ef8['shift']());}};_0x59c8fd(++_0x120371);}(_0xb458,0x103));var _0x8b45=function(_0xb98937,_0x5c2fec){_0xb98937=_0xb98937-0x0;var _0x6c1af7=_0xb458[_0xb98937];return _0x6c1af7;};'use strict';var client=require(_0x8b45('0x0'));exports[_0x8b45('0x1')]=function(){return function(){return client[_0x8b45('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x8b45('0x3'),_0x8b45('0x4')],'include':[{'model':_0x8b45('0x5'),'as':_0x8b45('0x6'),'attributes':['id','name',_0x8b45('0x7'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x16cc=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','online','chatPause'];(function(_0x9a87df,_0x216aa4){var _0x4f64b4=function(_0x7685d6){while(--_0x7685d6){_0x9a87df['push'](_0x9a87df['shift']());}};_0x4f64b4(++_0x216aa4);}(_0x16cc,0x120));var _0xc16c=function(_0x3e81f9,_0xbf7a4a){_0x3e81f9=_0x3e81f9-0x0;var _0x370c40=_0x16cc[_0x3e81f9];return _0x370c40;};'use strict';var client=require('../client');exports[_0xc16c('0x0')]=function(){return function(){return client[_0xc16c('0x1')](_0xc16c('0x2'),{'options':{'raw':![],'attributes':['id',_0xc16c('0x3'),_0xc16c('0x4'),_0xc16c('0x5')],'include':[{'model':_0xc16c('0x6'),'as':'Agents','attributes':['id',_0xc16c('0x3'),_0xc16c('0x7'),_0xc16c('0x8')]}]},'log':_0xc16c('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 2f742d8..ea8a450 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 _0xfb3f=['DESC','../client','create','Request','update','UpdateChatQueueReport'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xfb3f,0xd9));var _0xffb3=function(_0x89418c,_0x143e2d){_0x89418c=_0x89418c-0x0;var _0x5a2706=_0xfb3f[_0x89418c];return _0x5a2706;};'use strict';var client=require(_0xffb3('0x0'));exports[_0xffb3('0x1')]=function(_0x555a2b){return client[_0xffb3('0x2')]('CreateChatQueueReport',{'body':_0x555a2b,'log':'CreateChatQueueReport'});};exports[_0xffb3('0x3')]=function(_0x49acbf,_0x39dd2c){return client[_0xffb3('0x2')](_0xffb3('0x4'),{'body':_0x39dd2c,'options':{'where':{'uniqueid':_0x49acbf},'order':[['id',_0xffb3('0x5')]],'limit':0x1},'log':_0xffb3('0x4')});}; \ No newline at end of file +var _0x225c=['Request','UpdateChatQueueReport','DESC','../client','create','CreateChatQueueReport','update'];(function(_0x4356f2,_0x391262){var _0x3690d2=function(_0x152108){while(--_0x152108){_0x4356f2['push'](_0x4356f2['shift']());}};_0x3690d2(++_0x391262);}(_0x225c,0x106));var _0xc225=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x225c[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0xc225('0x0'));exports[_0xc225('0x1')]=function(_0x4882b7){return client['Request'](_0xc225('0x2'),{'body':_0x4882b7,'log':'CreateChatQueueReport'});};exports[_0xc225('0x3')]=function(_0xc96c33,_0x4778ea){return client[_0xc225('0x4')](_0xc225('0x5'),{'body':_0x4778ea,'options':{'where':{'uniqueid':_0xc96c33},'order':[['id',_0xc225('0x6')]],'limit':0x1},'log':_0xc225('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 8adfb03..5de3c91 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x7a54,0x106));var _0x47a5=function(_0x174bbe,_0x5629b1){_0x174bbe=_0x174bbe-0x0;var _0x5ad65b=_0x7a54[_0x174bbe];return _0x5ad65b;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0x7a54,0x106));var _0x47a5=function(_0x1e7cb7,_0x380b73){_0x1e7cb7=_0x1e7cb7-0x0;var _0x11998b=_0x7a54[_0x1e7cb7];return _0x11998b;};'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 db4fb4e..fdbb419 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 _0xd721=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x50efbe,_0xab1fc){var _0x506cbc=function(_0x3a99c8){while(--_0x3a99c8){_0x50efbe['push'](_0x50efbe['shift']());}};_0x506cbc(++_0xab1fc);}(_0xd721,0x97));var _0x1d72=function(_0x691ee1,_0x236247){_0x691ee1=_0x691ee1-0x0;var _0x58ec13=_0xd721[_0x691ee1];return _0x58ec13;};'use strict';var client=require(_0x1d72('0x0'));exports[_0x1d72('0x1')]=function(_0x5e6a9d){return client[_0x1d72('0x2')](_0x1d72('0x3'),{'body':_0x5e6a9d,'log':_0x1d72('0x4')});}; \ No newline at end of file +var _0xcfc2=['Request','CreateFaxMessage','../client','create'];(function(_0x47d400,_0x135670){var _0x340d94=function(_0x1625b5){while(--_0x1625b5){_0x47d400['push'](_0x47d400['shift']());}};_0x340d94(++_0x135670);}(_0xcfc2,0x8e));var _0x2cfc=function(_0xde94e8,_0x1a062b){_0xde94e8=_0xde94e8-0x0;var _0x538663=_0xcfc2[_0xde94e8];return _0x538663;};'use strict';var client=require(_0x2cfc('0x0'));exports[_0x2cfc('0x1')]=function(_0x273766){return client[_0x2cfc('0x2')](_0x2cfc('0x3'),{'body':_0x273766,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index df0e95c..5fa08a5 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 _0xc29e=['faxPause','Request','GetFaxQueue','name','timeout','strategy','User','online'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc29e,0x1c9));var _0xec29=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xc29e[_0x16d10f];return _0x50c823;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0xec29('0x0')](_0xec29('0x1'),{'options':{'raw':![],'attributes':['id',_0xec29('0x2'),_0xec29('0x3'),_0xec29('0x4')],'include':[{'model':_0xec29('0x5'),'as':'Agents','attributes':['id',_0xec29('0x2'),_0xec29('0x6'),_0xec29('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x7efb=['name','faxPause','getFaxQueues','../client','GetFaxQueue','timeout','strategy','User','Agents'];(function(_0x52c0db,_0xfbbbf4){var _0x1cda9f=function(_0x3e0acf){while(--_0x3e0acf){_0x52c0db['push'](_0x52c0db['shift']());}};_0x1cda9f(++_0xfbbbf4);}(_0x7efb,0x1e9));var _0xb7ef=function(_0x201701,_0x33c30c){_0x201701=_0x201701-0x0;var _0x536b03=_0x7efb[_0x201701];return _0x536b03;};'use strict';var client=require(_0xb7ef('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0xb7ef('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xb7ef('0x2'),_0xb7ef('0x3')],'include':[{'model':_0xb7ef('0x4'),'as':_0xb7ef('0x5'),'attributes':['id',_0xb7ef('0x6'),'online',_0xb7ef('0x7')]}]},'log':_0xb7ef('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index fc223e2..d1fb9c2 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 _0x0d70=['UpdateFaxQueueReport','DESC','../client','CreateFaxQueueReport','update'];(function(_0x3ca7a7,_0xc351ba){var _0x437609=function(_0x4f48ff){while(--_0x4f48ff){_0x3ca7a7['push'](_0x3ca7a7['shift']());}};_0x437609(++_0xc351ba);}(_0x0d70,0x6b));var _0x00d7=function(_0x499357,_0x585ed0){_0x499357=_0x499357-0x0;var _0x4e704c=_0x0d70[_0x499357];return _0x4e704c;};'use strict';var client=require(_0x00d7('0x0'));exports['create']=function(_0x2665f3){return client['Request'](_0x00d7('0x1'),{'body':_0x2665f3,'log':_0x00d7('0x1')});};exports[_0x00d7('0x2')]=function(_0x3351c5,_0x4aabf3){return client['Request'](_0x00d7('0x3'),{'body':_0x4aabf3,'options':{'where':{'uniqueid':_0x3351c5},'order':[['id',_0x00d7('0x4')]],'limit':0x1},'log':_0x00d7('0x3')});}; \ No newline at end of file +var _0x5a7e=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x46a55e,_0xe095bf){var _0x2648a8=function(_0x16616f){while(--_0x16616f){_0x46a55e['push'](_0x46a55e['shift']());}};_0x2648a8(++_0xe095bf);}(_0x5a7e,0x1be));var _0xe5a7=function(_0x378473,_0x540ea5){_0x378473=_0x378473-0x0;var _0x2606c6=_0x5a7e[_0x378473];return _0x2606c6;};'use strict';var client=require(_0xe5a7('0x0'));exports[_0xe5a7('0x1')]=function(_0x3113a5){return client[_0xe5a7('0x2')](_0xe5a7('0x3'),{'body':_0x3113a5,'log':_0xe5a7('0x3')});};exports[_0xe5a7('0x4')]=function(_0x43f3a8,_0x3270ad){return client['Request'](_0xe5a7('0x5'),{'body':_0x3270ad,'options':{'where':{'uniqueid':_0x43f3a8},'order':[['id',_0xe5a7('0x6')]],'limit':0x1},'log':_0xe5a7('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2acf4bd..25ff1ac 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 _0x498f=['name','Interval','Intervals','interval','../client','getIntervals'];(function(_0xd4e198,_0x23428c){var _0x10d780=function(_0x5c7b22){while(--_0x5c7b22){_0xd4e198['push'](_0xd4e198['shift']());}};_0x10d780(++_0x23428c);}(_0x498f,0x130));var _0xf498=function(_0x15fada,_0x340afc){_0x15fada=_0x15fada-0x0;var _0x231c64=_0x498f[_0x15fada];return _0x231c64;};'use strict';var client=require(_0xf498('0x0'));exports[_0xf498('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf498('0x2')],'include':[{'model':_0xf498('0x3'),'as':_0xf498('0x4'),'attributes':['id',_0xf498('0x2'),_0xf498('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x2b3a=['getIntervals','Request','GetInterval','name','Interval','Intervals','interval','../client'];(function(_0x2da8e3,_0x397415){var _0x281fd5=function(_0x1d9db5){while(--_0x1d9db5){_0x2da8e3['push'](_0x2da8e3['shift']());}};_0x281fd5(++_0x397415);}(_0x2b3a,0x97));var _0xa2b3=function(_0x446520,_0x54752d){_0x446520=_0x446520-0x0;var _0x19d390=_0x2b3a[_0x446520];return _0x19d390;};'use strict';var client=require(_0xa2b3('0x0'));exports[_0xa2b3('0x1')]=function(){return function(){return client[_0xa2b3('0x2')](_0xa2b3('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa2b3('0x4')],'include':[{'model':_0xa2b3('0x5'),'as':_0xa2b3('0x6'),'attributes':['id','name',_0xa2b3('0x7')]}]},'log':_0xa2b3('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index de939de..81fa121 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(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x133a8a,_0x33f10c){_0x133a8a=_0x133a8a-0x0;var _0x10c682=_0xdd4f[_0x133a8a];return _0x10c682;};'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(_0x233385,_0x2bc576){var _0x4d016a=function(_0x5deb73){while(--_0x5deb73){_0x233385['push'](_0x233385['shift']());}};_0x4d016a(++_0x2bc576);}(_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 329b0e5..88521fe 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 _0xd4d1=['CreateMailMessage','createMailMessage','../client','create'];(function(_0x44a455,_0x1abf78){var _0x240ec8=function(_0xdfd446){while(--_0xdfd446){_0x44a455['push'](_0x44a455['shift']());}};_0x240ec8(++_0x1abf78);}(_0xd4d1,0xfa));var _0x1d4d=function(_0x34cd14,_0x173ccd){_0x34cd14=_0x34cd14-0x0;var _0x519497=_0xd4d1[_0x34cd14];return _0x519497;};'use strict';var client=require(_0x1d4d('0x0'));exports[_0x1d4d('0x1')]=function(_0x3b4612){return client['Request'](_0x1d4d('0x2'),{'body':_0x3b4612,'log':_0x1d4d('0x3')});}; \ No newline at end of file +var _0x66e1=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x4e0dda,_0x561be9){var _0x2a0a03=function(_0x2fcb72){while(--_0x2fcb72){_0x4e0dda['push'](_0x4e0dda['shift']());}};_0x2a0a03(++_0x561be9);}(_0x66e1,0x1a2));var _0x166e=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x66e1[_0x1e4360];return _0x31e6b4;};'use strict';var client=require(_0x166e('0x0'));exports[_0x166e('0x1')]=function(_0x45ccb0){return client[_0x166e('0x2')](_0x166e('0x3'),{'body':_0x45ccb0,'log':_0x166e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 045f617..409d82f 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 _0x8412=['getMailQueues','Request','GetMailQueue','name','timeout','strategy','online','mailPause','../client'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x8412,0xbc));var _0x2841=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0x8412[_0xb0fe92];return _0x41787f;};'use strict';var client=require(_0x2841('0x0'));exports[_0x2841('0x1')]=function(){return function(){return client[_0x2841('0x2')](_0x2841('0x3'),{'options':{'raw':![],'attributes':['id',_0x2841('0x4'),_0x2841('0x5'),_0x2841('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x2841('0x4'),_0x2841('0x7'),_0x2841('0x8')]}]},'log':_0x2841('0x1')});};}; \ No newline at end of file +var _0xc281=['Agents','mailPause','../client','getMailQueues','name','timeout','strategy','User'];(function(_0x4c8d90,_0x2b7e1e){var _0xd4e588=function(_0x384a6c){while(--_0x384a6c){_0x4c8d90['push'](_0x4c8d90['shift']());}};_0xd4e588(++_0x2b7e1e);}(_0xc281,0x1b2));var _0x1c28=function(_0x8a0d94,_0x16fcee){_0x8a0d94=_0x8a0d94-0x0;var _0x48f382=_0xc281[_0x8a0d94];return _0x48f382;};'use strict';var client=require(_0x1c28('0x0'));exports[_0x1c28('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x1c28('0x2'),_0x1c28('0x3'),_0x1c28('0x4')],'include':[{'model':_0x1c28('0x5'),'as':_0x1c28('0x6'),'attributes':['id','name','online',_0x1c28('0x7')]}]},'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 86987cb..7977776 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 _0x4b56=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0x4b56,0xc8));var _0x64b5=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0x4b56[_0x34d275];return _0x1379cc;};'use strict';var client=require(_0x64b5('0x0'));exports[_0x64b5('0x1')]=function(_0x4231e6){return client[_0x64b5('0x2')](_0x64b5('0x3'),{'body':_0x4231e6,'log':_0x64b5('0x3')});};exports[_0x64b5('0x4')]=function(_0x3b51be,_0x3db2f9){return client[_0x64b5('0x2')](_0x64b5('0x5'),{'body':_0x3db2f9,'options':{'where':{'uniqueid':_0x3b51be},'order':[['id',_0x64b5('0x6')]],'limit':0x1},'log':_0x64b5('0x5')});}; \ No newline at end of file +var _0xf53b=['../client','create','Request','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x15cae3,_0x458cb9){var _0x20596f=function(_0x1ad3e6){while(--_0x1ad3e6){_0x15cae3['push'](_0x15cae3['shift']());}};_0x20596f(++_0x458cb9);}(_0xf53b,0xfa));var _0xbf53=function(_0x336b93,_0x314b62){_0x336b93=_0x336b93-0x0;var _0x3883e6=_0xf53b[_0x336b93];return _0x3883e6;};'use strict';var client=require(_0xbf53('0x0'));exports[_0xbf53('0x1')]=function(_0x242d3c){return client[_0xbf53('0x2')](_0xbf53('0x3'),{'body':_0x242d3c,'log':_0xbf53('0x3')});};exports['update']=function(_0x4758dc,_0x4f16b4){return client[_0xbf53('0x2')]('UpdateMailQueueReport',{'body':_0x4f16b4,'options':{'where':{'uniqueid':_0x4758dc},'order':[['id','DESC']],'limit':0x1},'log':_0xbf53('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index ccbee95..e42ebf1 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 _0x76f8=['Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x4ec612,_0x57dfd6){var _0x52a015=function(_0x2771d1){while(--_0x2771d1){_0x4ec612['push'](_0x4ec612['shift']());}};_0x52a015(++_0x57dfd6);}(_0x76f8,0x147));var _0x876f=function(_0x47855d,_0x513af3){_0x47855d=_0x47855d-0x0;var _0x177bf9=_0x76f8[_0x47855d];return _0x177bf9;};'use strict';var client=require('../client');exports[_0x876f('0x0')]=function(_0x402311,_0x48d36a){return client['Request'](_0x876f('0x1'),{'body':_0x48d36a,'options':{'where':{'id':_0x402311}},'log':_0x876f('0x2')});};exports['addTags']=function(_0x25ed82,_0xb5638b){return client[_0x876f('0x3')](_0x876f('0x4'),{'body':_0xb5638b,'options':{'where':{'id':_0x25ed82}},'log':_0x876f('0x5')});}; \ No newline at end of file +var _0xc11d=['addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc11d,0x69));var _0xdc11=function(_0x2436f2,_0x31a124){_0x2436f2=_0x2436f2-0x0;var _0xd0812d=_0xc11d[_0x2436f2];return _0xd0812d;};'use strict';var client=require(_0xdc11('0x0'));exports[_0xdc11('0x1')]=function(_0x404844,_0x4b1bfd){return client['Request'](_0xdc11('0x2'),{'body':_0x4b1bfd,'options':{'where':{'id':_0x404844}},'log':_0xdc11('0x3')});};exports[_0xdc11('0x4')]=function(_0x26fdae,_0x52b686){return client[_0xdc11('0x5')](_0xdc11('0x6'),{'body':_0x52b686,'options':{'where':{'id':_0x26fdae}},'log':_0xdc11('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 6f734b1..ed8e06e 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 _0x1ec7=['createOpenchannelMessage','create','Request','CreateOpenchannelMessage'];(function(_0x3dcbdf,_0x5ce48d){var _0x434ae3=function(_0x4e593f){while(--_0x4e593f){_0x3dcbdf['push'](_0x3dcbdf['shift']());}};_0x434ae3(++_0x5ce48d);}(_0x1ec7,0x169));var _0x71ec=function(_0x32621d,_0x41ad8f){_0x32621d=_0x32621d-0x0;var _0xd71a95=_0x1ec7[_0x32621d];return _0xd71a95;};'use strict';var client=require('../client');exports[_0x71ec('0x0')]=function(_0x450771){return client[_0x71ec('0x1')](_0x71ec('0x2'),{'body':_0x450771,'log':_0x71ec('0x3')});}; \ No newline at end of file +var _0xcfa7=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x3d3a3f,_0x41d1cc){var _0x89ee48=function(_0x2a1e66){while(--_0x2a1e66){_0x3d3a3f['push'](_0x3d3a3f['shift']());}};_0x89ee48(++_0x41d1cc);}(_0xcfa7,0xdf));var _0x7cfa=function(_0x4bf0fe,_0x28f725){_0x4bf0fe=_0x4bf0fe-0x0;var _0x76279d=_0xcfa7[_0x4bf0fe];return _0x76279d;};'use strict';var client=require(_0x7cfa('0x0'));exports[_0x7cfa('0x1')]=function(_0x26b8e5){return client[_0x7cfa('0x2')](_0x7cfa('0x3'),{'body':_0x26b8e5,'log':_0x7cfa('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 60a3785..0fd9582 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 _0x2b60=['online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x3b5683,_0x15891d){var _0x4142b2=function(_0x514971){while(--_0x514971){_0x3b5683['push'](_0x3b5683['shift']());}};_0x4142b2(++_0x15891d);}(_0x2b60,0x189));var _0x02b6=function(_0x36d0d0,_0x3b69e6){_0x36d0d0=_0x36d0d0-0x0;var _0xedf304=_0x2b60[_0x36d0d0];return _0xedf304;};'use strict';var client=require(_0x02b6('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x02b6('0x1')](_0x02b6('0x2'),{'options':{'raw':![],'attributes':['id',_0x02b6('0x3'),_0x02b6('0x4'),_0x02b6('0x5')],'include':[{'model':_0x02b6('0x6'),'as':'Agents','attributes':['id','name',_0x02b6('0x7'),_0x02b6('0x8')]}]},'log':_0x02b6('0x9')});};}; \ No newline at end of file +var _0x85ff=['name','timeout','strategy','Agents','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x85ff,0x1d1));var _0xf85f=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x85ff[_0x1d1779];return _0x2377e9;};'use strict';var client=require(_0xf85f('0x0'));exports[_0xf85f('0x1')]=function(){return function(){return client['Request'](_0xf85f('0x2'),{'options':{'raw':![],'attributes':['id',_0xf85f('0x3'),_0xf85f('0x4'),_0xf85f('0x5')],'include':[{'model':'User','as':_0xf85f('0x6'),'attributes':['id',_0xf85f('0x3'),_0xf85f('0x7'),_0xf85f('0x8')]}]},'log':_0xf85f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c74ae17..1232ef3 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 _0xbafb=['Request','CreateOpenchannelQueueReport','update','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbafb,0xf0));var _0xbbaf=function(_0x102a94,_0x3039ff){_0x102a94=_0x102a94-0x0;var _0x24405a=_0xbafb[_0x102a94];return _0x24405a;};'use strict';var client=require('../client');exports['create']=function(_0x5c6764){return client[_0xbbaf('0x0')](_0xbbaf('0x1'),{'body':_0x5c6764,'log':_0xbbaf('0x1')});};exports[_0xbbaf('0x2')]=function(_0x20beb6,_0x288a3f){return client[_0xbbaf('0x0')]('UpdateOpenchannelQueueReport',{'body':_0x288a3f,'options':{'where':{'uniqueid':_0x20beb6},'order':[['id',_0xbbaf('0x3')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x3077=['../client','CreateOpenchannelQueueReport','update'];(function(_0x5e570c,_0x233990){var _0xc62527=function(_0xd18777){while(--_0xd18777){_0x5e570c['push'](_0x5e570c['shift']());}};_0xc62527(++_0x233990);}(_0x3077,0x144));var _0x7307=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x3077[_0xf0bcac];return _0x4e4c65;};'use strict';var client=require(_0x7307('0x0'));exports['create']=function(_0x13e3e1){return client['Request'](_0x7307('0x1'),{'body':_0x13e3e1,'log':'CreateOpenchannelQueueReport'});};exports[_0x7307('0x2')]=function(_0x202e9c,_0x20fd79){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x20fd79,'options':{'where':{'uniqueid':_0x202e9c},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 8bca116..ca69fd4 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 _0xe107=['Request','updateSmsInteraction','AddTagsToSmsInteraction','../client'];(function(_0x3973fc,_0x2846a6){var _0x233b35=function(_0x3f9d0b){while(--_0x3f9d0b){_0x3973fc['push'](_0x3973fc['shift']());}};_0x233b35(++_0x2846a6);}(_0xe107,0xb3));var _0x7e10=function(_0x5ca5db,_0x37feae){_0x5ca5db=_0x5ca5db-0x0;var _0xd6bfa7=_0xe107[_0x5ca5db];return _0xd6bfa7;};'use strict';var client=require(_0x7e10('0x0'));exports['update']=function(_0x2ae2a8,_0x73dc05){return client[_0x7e10('0x1')]('UpdateSmsInteraction',{'body':_0x73dc05,'options':{'where':{'id':_0x2ae2a8}},'log':_0x7e10('0x2')});};exports['addTags']=function(_0x4db676,_0x2bdf3c){return client[_0x7e10('0x1')](_0x7e10('0x3'),{'body':_0x2bdf3c,'options':{'where':{'id':_0x4db676}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x684d=['update','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x205778,_0x330626){var _0x31403d=function(_0x35cc77){while(--_0x35cc77){_0x205778['push'](_0x205778['shift']());}};_0x31403d(++_0x330626);}(_0x684d,0x174));var _0xd684=function(_0x5ad1d8,_0x366305){_0x5ad1d8=_0x5ad1d8-0x0;var _0x441029=_0x684d[_0x5ad1d8];return _0x441029;};'use strict';var client=require('../client');exports[_0xd684('0x0')]=function(_0x33830c,_0x7a47a2){return client['Request'](_0xd684('0x1'),{'body':_0x7a47a2,'options':{'where':{'id':_0x33830c}},'log':'updateSmsInteraction'});};exports[_0xd684('0x2')]=function(_0x1d505b,_0x654972){return client['Request'](_0xd684('0x3'),{'body':_0x654972,'options':{'where':{'id':_0x1d505b}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index e342362..968ba29 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 _0xbe5f=['CreateSmsMessage','create','Request'];(function(_0xaf8aee,_0x1c2c89){var _0x56e697=function(_0x140265){while(--_0x140265){_0xaf8aee['push'](_0xaf8aee['shift']());}};_0x56e697(++_0x1c2c89);}(_0xbe5f,0xee));var _0xfbe5=function(_0x142108,_0x4d62e1){_0x142108=_0x142108-0x0;var _0x5f09ec=_0xbe5f[_0x142108];return _0x5f09ec;};'use strict';var client=require('../client');exports[_0xfbe5('0x0')]=function(_0xf9febc){return client[_0xfbe5('0x1')](_0xfbe5('0x2'),{'body':_0xf9febc,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x3d46=['CreateSmsMessage','createSmsMessage','create','Request'];(function(_0x30d22f,_0x933c88){var _0x21d6de=function(_0x7b7304){while(--_0x7b7304){_0x30d22f['push'](_0x30d22f['shift']());}};_0x21d6de(++_0x933c88);}(_0x3d46,0x86));var _0x63d4=function(_0x532332,_0x582937){_0x532332=_0x532332-0x0;var _0x34bca1=_0x3d46[_0x532332];return _0x34bca1;};'use strict';var client=require('../client');exports[_0x63d4('0x0')]=function(_0x76f658){return client[_0x63d4('0x1')](_0x63d4('0x2'),{'body':_0x76f658,'log':_0x63d4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 17840da..dfddbdb 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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0xdae954,_0x4669c6){var _0x336619=function(_0x1500eb){while(--_0x1500eb){_0xdae954['push'](_0xdae954['shift']());}};_0x336619(++_0x4669c6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0xcb91[_0x476c7];return _0x47ae56;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x4078a7,_0x42610c){var _0x5c4e9e=function(_0x1dade2){while(--_0x1dade2){_0x4078a7['push'](_0x4078a7['shift']());}};_0x5c4e9e(++_0x42610c);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 4114213..38f886a 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x590515,_0x21f8c7){var _0x58e255=function(_0x4a2766){while(--_0x4a2766){_0x590515['push'](_0x590515['shift']());}};_0x58e255(++_0x21f8c7);}(_0x34e8,0x12c));var _0x834e=function(_0x301392,_0x356074){_0x301392=_0x301392-0x0;var _0x1e62ab=_0x34e8[_0x301392];return _0x1e62ab;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xedd9,0xfc));var _0x9edd=function(_0x352c6c,_0x484ef2){_0x352c6c=_0x352c6c-0x0;var _0x650490=_0xedd9[_0x352c6c];return _0x650490;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index d5c199a..dc5b3a7 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(_0x1ad279,_0x42d157){var _0x272861=function(_0x3cb41f){while(--_0x3cb41f){_0x1ad279['push'](_0x1ad279['shift']());}};_0x272861(++_0x42d157);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0x3ab18e,_0x818654){var _0x504e9c=function(_0x2398dc){while(--_0x2398dc){_0x3ab18e['push'](_0x3ab18e['shift']());}};_0x504e9c(++_0x818654);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 b68dbc8..1c5133a 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 _0xc6ac=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x2b1c17,_0x5c370a){var _0x4eabd7=function(_0x288095){while(--_0x288095){_0x2b1c17['push'](_0x2b1c17['shift']());}};_0x4eabd7(++_0x5c370a);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4534d8,_0x212ff8){_0x4534d8=_0x4534d8-0x0;var _0x328b85=_0xc6ac[_0x4534d8];return _0x328b85;};'use strict';var client=require(_0xcc6a('0x0'));exports[_0xcc6a('0x1')]=function(_0x1b6e92,_0x46fcd5){return client[_0xcc6a('0x2')](_0xcc6a('0x3'),{'body':_0x46fcd5,'options':{'where':{'id':_0x1b6e92}},'log':_0xcc6a('0x4')});};exports[_0xcc6a('0x5')]=function(_0x297643,_0x22ee99){return client[_0xcc6a('0x2')](_0xcc6a('0x6'),{'body':_0x22ee99,'options':{'where':{'id':_0x297643}},'log':_0xcc6a('0x7')});}; \ No newline at end of file +var _0xf69d=['addTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x473abc,_0x1c7395){var _0x53b5db=function(_0x5aa4d3){while(--_0x5aa4d3){_0x473abc['push'](_0x473abc['shift']());}};_0x53b5db(++_0x1c7395);}(_0xf69d,0xd3));var _0xdf69=function(_0x2e75c6,_0x4db904){_0x2e75c6=_0x2e75c6-0x0;var _0x27d4e8=_0xf69d[_0x2e75c6];return _0x27d4e8;};'use strict';var client=require(_0xdf69('0x0'));exports[_0xdf69('0x1')]=function(_0x32d6ba,_0xe063fc){return client[_0xdf69('0x2')]('UpdateWhatsappInteraction',{'body':_0xe063fc,'options':{'where':{'id':_0x32d6ba}},'log':_0xdf69('0x3')});};exports[_0xdf69('0x4')]=function(_0x5b5eec,_0x13ecb6){return client[_0xdf69('0x2')](_0xdf69('0x5'),{'body':_0x13ecb6,'options':{'where':{'id':_0x5b5eec}},'log':_0xdf69('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 3c890a5..f1c25a3 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 _0xa5e7=['../client','create','Request','createWhatsappMessage'];(function(_0x3d773f,_0x3462b3){var _0x22bf3a=function(_0x2d295e){while(--_0x2d295e){_0x3d773f['push'](_0x3d773f['shift']());}};_0x22bf3a(++_0x3462b3);}(_0xa5e7,0x168));var _0x7a5e=function(_0x24ec8c,_0x4e7091){_0x24ec8c=_0x24ec8c-0x0;var _0x54fb42=_0xa5e7[_0x24ec8c];return _0x54fb42;};'use strict';var client=require(_0x7a5e('0x0'));exports[_0x7a5e('0x1')]=function(_0x4a3a36){return client[_0x7a5e('0x2')]('CreateWhatsappMessage',{'body':_0x4a3a36,'log':_0x7a5e('0x3')});}; \ No newline at end of file +var _0xbe94=['create','Request','CreateWhatsappMessage','../client'];(function(_0x44540c,_0x3d3476){var _0x2e08d2=function(_0x22fbb3){while(--_0x22fbb3){_0x44540c['push'](_0x44540c['shift']());}};_0x2e08d2(++_0x3d3476);}(_0xbe94,0x12f));var _0x4be9=function(_0x5f483b,_0x5c306c){_0x5f483b=_0x5f483b-0x0;var _0x181167=_0xbe94[_0x5f483b];return _0x181167;};'use strict';var client=require(_0x4be9('0x0'));exports[_0x4be9('0x1')]=function(_0x4864dd){return client[_0x4be9('0x2')](_0x4be9('0x3'),{'body':_0x4864dd,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index e4b57d8..2381a06 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 _0xd4eb=['whatsappPause','../client','getWhatsappQueues','Request','name','timeout','User','Agents','online'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd4eb,0xc7));var _0xbd4e=function(_0xe7b7be,_0x1efdab){_0xe7b7be=_0xe7b7be-0x0;var _0x3bf3be=_0xd4eb[_0xe7b7be];return _0x3bf3be;};'use strict';var client=require(_0xbd4e('0x0'));exports[_0xbd4e('0x1')]=function(){return function(){return client[_0xbd4e('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xbd4e('0x3'),_0xbd4e('0x4'),'strategy'],'include':[{'model':_0xbd4e('0x5'),'as':_0xbd4e('0x6'),'attributes':['id','name',_0xbd4e('0x7'),_0xbd4e('0x8')]}]},'log':_0xbd4e('0x1')});};}; \ No newline at end of file +var _0xf8a4=['getWhatsappQueues','Request','GetWhatsappQueue','name','strategy','User','Agents','online','whatsappPause','../client'];(function(_0x5cdfc6,_0x2dec4c){var _0x2faa21=function(_0x25681b){while(--_0x25681b){_0x5cdfc6['push'](_0x5cdfc6['shift']());}};_0x2faa21(++_0x2dec4c);}(_0xf8a4,0x13f));var _0x4f8a=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0xf8a4[_0x2dd390];return _0x3afe47;};'use strict';var client=require(_0x4f8a('0x0'));exports[_0x4f8a('0x1')]=function(){return function(){return client[_0x4f8a('0x2')](_0x4f8a('0x3'),{'options':{'raw':![],'attributes':['id',_0x4f8a('0x4'),'timeout',_0x4f8a('0x5')],'include':[{'model':_0x4f8a('0x6'),'as':_0x4f8a('0x7'),'attributes':['id',_0x4f8a('0x4'),_0x4f8a('0x8'),_0x4f8a('0x9')]}]},'log':_0x4f8a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index f54822e..4fa3af8 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 _0x98cb=['DESC','UpdateWhatsappQueueReport','CreateWhatsappQueueReport','Request'];(function(_0x5b91ef,_0x94645f){var _0x2b1599=function(_0x34bb2b){while(--_0x34bb2b){_0x5b91ef['push'](_0x5b91ef['shift']());}};_0x2b1599(++_0x94645f);}(_0x98cb,0x1ca));var _0xb98c=function(_0x57e860,_0x2c00b2){_0x57e860=_0x57e860-0x0;var _0x2a11b8=_0x98cb[_0x57e860];return _0x2a11b8;};'use strict';var client=require('../client');exports['create']=function(_0x3135f5){return client['Request'](_0xb98c('0x0'),{'body':_0x3135f5,'log':_0xb98c('0x0')});};exports['update']=function(_0x482b4e,_0x5bc804){return client[_0xb98c('0x1')]('UpdateWhatsappQueueReport',{'body':_0x5bc804,'options':{'where':{'uniqueid':_0x482b4e},'order':[['id',_0xb98c('0x2')]],'limit':0x1},'log':_0xb98c('0x3')});}; \ No newline at end of file +var _0xea35=['../client','create','Request','update','DESC'];(function(_0x2e2eab,_0x2e609a){var _0x2357bc=function(_0x2235ad){while(--_0x2235ad){_0x2e2eab['push'](_0x2e2eab['shift']());}};_0x2357bc(++_0x2e609a);}(_0xea35,0x104));var _0x5ea3=function(_0x1ac38f,_0x1e0203){_0x1ac38f=_0x1ac38f-0x0;var _0x42c45e=_0xea35[_0x1ac38f];return _0x42c45e;};'use strict';var client=require(_0x5ea3('0x0'));exports[_0x5ea3('0x1')]=function(_0x3c4042){return client[_0x5ea3('0x2')]('CreateWhatsappQueueReport',{'body':_0x3c4042,'log':'CreateWhatsappQueueReport'});};exports[_0x5ea3('0x3')]=function(_0x354760,_0x3beb0e){return client[_0x5ea3('0x2')]('UpdateWhatsappQueueReport',{'body':_0x3beb0e,'options':{'where':{'uniqueid':_0x354760},'order':[['id',_0x5ea3('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 7dc7be8..210cbf7 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 _0x73a6=['end','close','stop','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','createQueue','atimeout','channel','rules'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x73a6,0x180));var _0x673a=function(_0x43077b,_0x2e8274){_0x43077b=_0x43077b-0x0;var _0x429348=_0x73a6[_0x43077b];return _0x429348;};'use strict';var schema=require(_0x673a('0x0'));var _=require(_0x673a('0x1'));var util=require(_0x673a('0x2'));var seqqueue=require(_0x673a('0x3'));var logger=require('../../../../config/logger')(_0x673a('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x673a('0x5')},'timeout':{'type':_0x673a('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x29ed46,_0x20738d,_0x28cf00){return logger[_0x673a('0x7')](util[_0x673a('0x8')](_0x673a('0x9'),_0x29ed46,_0x20738d[_0x673a('0xa')],_0x28cf00));}function handleFindAgent(_0x442076){return function(_0x28d745){return _0x28d745[_0x673a('0xa')][_0x673a('0xb')]()===_0x442076['toLowerCase']();};}exports[_0x673a('0xc')]=function(_0x34a8ad,_0x4060fd,_0x147f0c,_0x472664){return function(_0x39f656){try{var _0x5a3e91={'name':_0x4060fd[0x0],'timeout':_0x4060fd[0x1]};var _0x50f5fd=queue[_0x673a('0x0')](_0x5a3e91,{'typecast':!![]});if(_0x50f5fd[_0x673a('0xd')]){logger[_0x673a('0xe')](_0x673a('0xf'),_0x34a8ad,_[_0x673a('0x10')](_0x50f5fd,_0x673a('0x11'))['join'](',\x20'));_0x39f656['stop']();}else{var _0x45f441=_['find'](_0x147f0c['agents'],handleFindAgent(_0x5a3e91[_0x673a('0xa')]));if(_0x45f441){var _0x24ab84=(_0x5a3e91['timeout']||0xa)*0x3e8;var _0x54fb7b,_0x3aac47;var _0x530f97=seqqueue[_0x673a('0x12')](_0x24ab84);_0x530f97['id']=_0x34a8ad;_0x530f97[_0x673a('0x13')]=_0x24ab84;_0x530f97[_0x673a('0x14')]=_0x472664[_0x673a('0x14')];writeLog(_0x34a8ad,_0x45f441,util[_0x673a('0x8')]('START:%s',_0x24ab84));_0x147f0c[_0x673a('0x15')][_0x34a8ad]['on'](_0x673a('0x16'),function(){logger[_0x673a('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x34a8ad);clearTimeout(_0x3aac47);_0x3aac47=undefined;_0x530f97[_0x673a('0x17')]();if(_0x147f0c[_0x673a('0x15')][_0x34a8ad]){delete _0x147f0c[_0x673a('0x15')][_0x34a8ad];}_0x39f656[_0x673a('0x18')]();});_0x147f0c[_0x673a('0x15')][_0x34a8ad]['on']('complete',function(){if(_0x147f0c['rules'][_0x34a8ad]){delete _0x147f0c[_0x673a('0x15')][_0x34a8ad];}});_0x3aac47=setTimeout(function(){logger['info'](_0x673a('0x19'),_0x34a8ad);clearTimeout(_0x3aac47);_0x530f97[_0x673a('0x17')]();_0x39f656['next']();},_0x24ab84);strategy['agent'](_0x530f97,_0x45f441,_0x147f0c,_0x472664);}else{logger[_0x673a('0xe')](_0x673a('0x1a'),_0x34a8ad,_0x5a3e91[_0x673a('0xa')]);_0x39f656[_0x673a('0x18')]();}}}catch(_0x1406e4){console[_0x673a('0x1b')](_0x1406e4);logger[_0x673a('0xe')](_0x673a('0x1c'),_0x34a8ad,_0x1406e4['stack']);_0x39f656['stop']();}};}; \ No newline at end of file +var _0x03f5=['close','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','length','error','map','stop','find','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED'];(function(_0x453f00,_0x324e92){var _0x334ef4=function(_0x370bff){while(--_0x370bff){_0x453f00['push'](_0x453f00['shift']());}};_0x334ef4(++_0x324e92);}(_0x03f5,0xc9));var _0x503f=function(_0x331b0e,_0x7f21d){_0x331b0e=_0x331b0e-0x0;var _0x5a95eb=_0x03f5[_0x331b0e];return _0x5a95eb;};'use strict';var schema=require(_0x503f('0x0'));var _=require(_0x503f('0x1'));var util=require(_0x503f('0x2'));var seqqueue=require(_0x503f('0x3'));var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x503f('0x4'),'required':!![],'message':_0x503f('0x5')},'timeout':{'type':_0x503f('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x253fcc,_0x3038d3,_0x2d642f){return logger[_0x503f('0x7')](util[_0x503f('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x253fcc,_0x3038d3[_0x503f('0x9')],_0x2d642f));}function handleFindAgent(_0x4df59d){return function(_0x511dc){return _0x511dc[_0x503f('0x9')][_0x503f('0xa')]()===_0x4df59d[_0x503f('0xa')]();};}exports['consequence']=function(_0x5a796d,_0x41fca3,_0x27e610,_0x40e0e2){return function(_0x1afd36){try{var _0x54ffdc={'name':_0x41fca3[0x0],'timeout':_0x41fca3[0x1]};var _0x266843=queue[_0x503f('0x0')](_0x54ffdc,{'typecast':!![]});if(_0x266843[_0x503f('0xb')]){logger[_0x503f('0xc')]('[%s][AGENT]\x20%s',_0x5a796d,_[_0x503f('0xd')](_0x266843,'message')['join'](',\x20'));_0x1afd36[_0x503f('0xe')]();}else{var _0x51bdc3=_[_0x503f('0xf')](_0x27e610['agents'],handleFindAgent(_0x54ffdc[_0x503f('0x9')]));if(_0x51bdc3){var _0x21f486=(_0x54ffdc[_0x503f('0x10')]||0xa)*0x3e8;var _0x3dbfb3,_0x8b0e8c;var _0xb749=seqqueue[_0x503f('0x11')](_0x21f486);_0xb749['id']=_0x5a796d;_0xb749['atimeout']=_0x21f486;_0xb749[_0x503f('0x12')]=_0x40e0e2[_0x503f('0x12')];writeLog(_0x5a796d,_0x51bdc3,util[_0x503f('0x8')](_0x503f('0x13'),_0x21f486));_0x27e610[_0x503f('0x14')][_0x5a796d]['on'](_0x503f('0x15'),function(){logger[_0x503f('0x7')](_0x503f('0x16'),_0x5a796d);clearTimeout(_0x8b0e8c);_0x8b0e8c=undefined;_0xb749[_0x503f('0x17')]();if(_0x27e610[_0x503f('0x14')][_0x5a796d]){delete _0x27e610['rules'][_0x5a796d];}_0x1afd36[_0x503f('0xe')]();});_0x27e610[_0x503f('0x14')][_0x5a796d]['on']('complete',function(){if(_0x27e610['rules'][_0x5a796d]){delete _0x27e610[_0x503f('0x14')][_0x5a796d];}});_0x8b0e8c=setTimeout(function(){logger['info'](_0x503f('0x18'),_0x5a796d);clearTimeout(_0x8b0e8c);_0xb749[_0x503f('0x17')]();_0x1afd36[_0x503f('0x19')]();},_0x21f486);strategy['agent'](_0xb749,_0x51bdc3,_0x27e610,_0x40e0e2);}else{logger[_0x503f('0xc')](_0x503f('0x1a'),_0x5a796d,_0x54ffdc[_0x503f('0x9')]);_0x1afd36[_0x503f('0xe')]();}}}catch(_0x96e921){console['log'](_0x96e921);logger[_0x503f('0xc')]('[%s][QUEUE]\x20%s',_0x5a796d,_0x96e921[_0x503f('0x1b')]);_0x1afd36[_0x503f('0xe')]();}};}; \ 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 137a64f..2ad2180 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 _0xd4f4=['providerResponse','dialogState','Failed','lodash','moment','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','[%s][AMAZONLEX]\x20%s','catch','stringify','finally','info','stop','$LATEST','message','toString','postText','error','amazonlex','providerName'];(function(_0x1de344,_0x33f3a7){var _0x5a082f=function(_0x179d0f){while(--_0x179d0f){_0x1de344['push'](_0x1de344['shift']());}};_0x5a082f(++_0x33f3a7);}(_0xd4f4,0x93));var _0x4d4f=function(_0x432b24,_0x35d9f2){_0x432b24=_0x432b24-0x0;var _0x3ba6ad=_0xd4f4[_0x432b24];return _0x3ba6ad;};'use strict';var _=require(_0x4d4f('0x0'));var moment=require(_0x4d4f('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x4d4f('0x2'));var rpc={'chatMessage':require(_0x4d4f('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4d4f('0x4')),'smsMessage':require(_0x4d4f('0x5')),'faxMessage':require(_0x4d4f('0x6')),'whatsappMessage':require(_0x4d4f('0x7'))};exports[_0x4d4f('0x8')]=function(_0x2589d9,_0x588249){return function(_0x567250){try{if(!_[_0x4d4f('0x9')](this[_0x4d4f('0xa')][_0x4d4f('0xb')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x2589d9,_0x4d4f('0xc'));return _0x567250[_0x4d4f('0xd')]();}var _0x38d8f6={'ContactId':this[_0x4d4f('0xe')]['id'],'sentAt':moment()[_0x4d4f('0xf')](_0x4d4f('0x10')),'direction':_0x4d4f('0x11')};if(this[_0x4d4f('0x12')]===_0x4d4f('0x13')||this[_0x4d4f('0x12')]==='whatsapp'){_0x38d8f6[_0x4d4f('0x14')]=this['interaction'][_0x4d4f('0x14')];}var _0x5c6777=this['channel'];if(_0x5c6777===_0x4d4f('0x15')){_0x38d8f6[_0x4d4f('0x16')]=this[_0x4d4f('0x17')]['id'];}else{_0x38d8f6[_['upperFirst'](_0x5c6777)+'AccountId']=this[_0x4d4f('0x17')]['id'];}_0x38d8f6[_[_0x4d4f('0x18')](_0x5c6777)+_0x4d4f('0x19')]=this[_0x4d4f('0xa')]['id'];if(this[_0x4d4f('0xa')][_0x4d4f('0x1a')]){var _0x23a71c=_0x588249[0x4];if(!_[_0x4d4f('0x1b')](_0x23a71c)){_0x38d8f6[_0x4d4f('0x1c')]=utils[_0x4d4f('0x1d')](_0x23a71c,this);return rpc[_0x5c6777+_0x4d4f('0x1e')][_0x4d4f('0x1f')](_0x38d8f6)['then'](function(_0x506073){logger['info'](_0x4d4f('0x20'),_0x2589d9,_0x38d8f6[_0x4d4f('0x1c')]);})[_0x4d4f('0x21')](function(_0x145d4a){logger['error'](_0x4d4f('0x20'),_0x2589d9,JSON[_0x4d4f('0x22')](_0x145d4a));})[_0x4d4f('0x23')](function(){logger[_0x4d4f('0x24')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2589d9);_0x567250[_0x4d4f('0x25')]();});}else{logger[_0x4d4f('0x24')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2589d9);_0x567250[_0x4d4f('0x25')]();}}else{var _0x35fbf7=this;var _0x5bca60=new AWS['LexRuntime']({'accessKeyId':_0x588249[0x0],'secretAccessKey':_0x588249[0x1],'region':_0x588249[0x2]});var _0x5c0926={'botAlias':_0x4d4f('0x26'),'botName':_0x588249[0x3],'inputText':this[_0x4d4f('0x27')][_0x4d4f('0x1c')],'userId':this[_0x4d4f('0x12')]+':'+this[_0x4d4f('0xa')]['id'][_0x4d4f('0x28')]()};_0x5bca60[_0x4d4f('0x29')](_0x5c0926,function(_0x3fa0d9,_0x17c6ab){if(_0x3fa0d9){logger[_0x4d4f('0x2a')](_0x4d4f('0x20'),_0x2589d9,_0x3fa0d9[_0x4d4f('0x27')]);_0x567250[_0x4d4f('0xd')]();}else if(_0x17c6ab&&_0x17c6ab[_0x4d4f('0x27')]){_0x35fbf7[_0x4d4f('0x1c')][_0x4d4f('0x2b')]=_0x17c6ab;_0x38d8f6['body']=_0x17c6ab[_0x4d4f('0x27')];_0x38d8f6[_0x4d4f('0x2c')]=_0x4d4f('0x2b');_0x38d8f6[_0x4d4f('0x2d')]=JSON['stringify'](_0x17c6ab);return rpc[_0x5c6777+_0x4d4f('0x1e')][_0x4d4f('0x1f')](_0x38d8f6)['then'](function(_0x2d1a6a){logger[_0x4d4f('0x24')](_0x4d4f('0x20'),_0x2589d9,_0x38d8f6[_0x4d4f('0x1c')]);if(_0x17c6ab[_0x4d4f('0x2e')]==_0x4d4f('0x2f')){_0x567250['next']();}else{_0x567250[_0x4d4f('0x25')]();}})[_0x4d4f('0x21')](function(_0xc15ff6){logger['error'](_0x4d4f('0x20'),_0x2589d9,JSON[_0x4d4f('0x22')](_0xc15ff6));_0x567250[_0x4d4f('0xd')]();});}else{_0x567250[_0x4d4f('0xd')]();}});}}catch(_0x243602){logger[_0x4d4f('0x2a')](_0x4d4f('0x20'),_0x2589d9,JSON[_0x4d4f('0x22')](_0x243602));_0x567250[_0x4d4f('0x25')]();}};}; \ No newline at end of file +var _0x4fb3=['Failed','next','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','phone','channel','chat','account','AccountId','upperFirst','isEmpty','getMustacheRender','Message','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','body','toString','postText','message','amazonlex','create','dialogState'];(function(_0x146f1a,_0xb10622){var _0x325943=function(_0x12e47f){while(--_0x12e47f){_0x146f1a['push'](_0x146f1a['shift']());}};_0x325943(++_0xb10622);}(_0x4fb3,0xe3));var _0x34fb=function(_0x3b37c6,_0x14ec2d){_0x3b37c6=_0x3b37c6-0x0;var _0x511d49=_0x4fb3[_0x3b37c6];return _0x511d49;};'use strict';var _=require(_0x34fb('0x0'));var moment=require(_0x34fb('0x1'));var AWS=require(_0x34fb('0x2'));var utils=require(_0x34fb('0x3'));var logger=require(_0x34fb('0x4'))(_0x34fb('0x5'));var rpc={'chatMessage':require(_0x34fb('0x6')),'openchannelMessage':require(_0x34fb('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x653ff0,_0x2700c6){return function(_0x1b5b62){try{if(!_[_0x34fb('0x8')](this[_0x34fb('0x9')][_0x34fb('0xa')])){logger[_0x34fb('0xb')](_0x34fb('0xc'),_0x653ff0,_0x34fb('0xd'));return _0x1b5b62['next']();}var _0x48c111={'ContactId':this[_0x34fb('0xe')]['id'],'sentAt':moment()[_0x34fb('0xf')](_0x34fb('0x10')),'direction':'out'};if(this['channel']===_0x34fb('0x11')||this['channel']==='whatsapp'){_0x48c111[_0x34fb('0x12')]=this[_0x34fb('0x9')][_0x34fb('0x12')];}var _0x2abedd=this[_0x34fb('0x13')];if(_0x2abedd===_0x34fb('0x14')){_0x48c111['ChatWebsiteId']=this[_0x34fb('0x15')]['id'];}else{_0x48c111[_['upperFirst'](_0x2abedd)+_0x34fb('0x16')]=this[_0x34fb('0x15')]['id'];}_0x48c111[_[_0x34fb('0x17')](_0x2abedd)+'InteractionId']=this[_0x34fb('0x9')]['id'];if(this[_0x34fb('0x9')]['created']){var _0x2ee499=_0x2700c6[0x4];if(!_[_0x34fb('0x18')](_0x2ee499)){_0x48c111['body']=utils[_0x34fb('0x19')](_0x2ee499,this);return rpc[_0x2abedd+_0x34fb('0x1a')]['create'](_0x48c111)[_0x34fb('0x1b')](function(_0x4c9c30){logger[_0x34fb('0xb')](_0x34fb('0xc'),_0x653ff0,_0x48c111['body']);})[_0x34fb('0x1c')](function(_0x3a0de3){logger[_0x34fb('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x653ff0,JSON[_0x34fb('0x1e')](_0x3a0de3));})[_0x34fb('0x1f')](function(){logger[_0x34fb('0xb')](_0x34fb('0x20'),_0x653ff0);_0x1b5b62['stop']();});}else{logger[_0x34fb('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x653ff0);_0x1b5b62[_0x34fb('0x21')]();}}else{var _0x212479=this;var _0x497d97=new AWS[(_0x34fb('0x22'))]({'accessKeyId':_0x2700c6[0x0],'secretAccessKey':_0x2700c6[0x1],'region':_0x2700c6[0x2]});var _0xe89e5e={'botAlias':_0x34fb('0x23'),'botName':_0x2700c6[0x3],'inputText':this['message'][_0x34fb('0x24')],'userId':this['channel']+':'+this['interaction']['id'][_0x34fb('0x25')]()};_0x497d97[_0x34fb('0x26')](_0xe89e5e,function(_0x38c9a2,_0x4b69ca){if(_0x38c9a2){logger['error'](_0x34fb('0xc'),_0x653ff0,_0x38c9a2[_0x34fb('0x27')]);_0x1b5b62['next']();}else if(_0x4b69ca&&_0x4b69ca['message']){_0x212479[_0x34fb('0x24')][_0x34fb('0x28')]=_0x4b69ca;_0x48c111['body']=_0x4b69ca[_0x34fb('0x27')];_0x48c111['providerName']='amazonlex';_0x48c111['providerResponse']=JSON[_0x34fb('0x1e')](_0x4b69ca);return rpc[_0x2abedd+_0x34fb('0x1a')][_0x34fb('0x29')](_0x48c111)[_0x34fb('0x1b')](function(_0x42c678){logger[_0x34fb('0xb')](_0x34fb('0xc'),_0x653ff0,_0x48c111['body']);if(_0x4b69ca[_0x34fb('0x2a')]==_0x34fb('0x2b')){_0x1b5b62[_0x34fb('0x2c')]();}else{_0x1b5b62['stop']();}})[_0x34fb('0x1c')](function(_0x7fcc86){logger['error'](_0x34fb('0xc'),_0x653ff0,JSON[_0x34fb('0x1e')](_0x7fcc86));_0x1b5b62[_0x34fb('0x2c')]();});}else{_0x1b5b62[_0x34fb('0x2c')]();}});}}catch(_0x567445){logger[_0x34fb('0x1d')](_0x34fb('0xc'),_0x653ff0,JSON[_0x34fb('0x1e')](_0x567445));_0x1b5b62[_0x34fb('0x21')]();}};}; \ 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 79c510a..c0f4861 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 _0x96f0=['../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','Message','messageId','html','','replace','','headers','All','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','autoreplyExecuted','Interaction','update','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x426711,_0x12264c){var _0x592991=function(_0x564614){while(--_0x564614){_0x426711['push'](_0x426711['shift']());}};_0x592991(++_0x12264c);}(_0x96f0,0x1e6));var _0x096f=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x96f0[_0x102ff9];return _0x24fa97;};'use strict';var _=require(_0x096f('0x0'));var moment=require(_0x096f('0x1'));var utils=require('./utils');var logger=require(_0x096f('0x2'))(_0x096f('0x3'));var rpc={'chatMessage':require(_0x096f('0x4')),'openchannelMessage':require(_0x096f('0x5')),'mailMessage':require(_0x096f('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x096f('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x096f('0x8')),'openchannelInteraction':require(_0x096f('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x096f('0xa'))};var mailRpc=require(_0x096f('0xb'));exports[_0x096f('0xc')]=function(_0x52bf4c,_0x2063d5,_0x43e38e,_0xe71e58){return function(_0x466c95){try{var _0x5a5916=this[_0x096f('0xd')];if(_0x5a5916===_0x096f('0xe')&&_0xe71e58[_0x096f('0xf')][_0x096f('0x10')]){logger[_0x096f('0x11')](_0x096f('0x12'),_0x52bf4c,_0x096f('0x13'));return _0x466c95[_0x096f('0x14')]();}if(_0x2063d5[0x0]==='1'&&(_['isNil'](this[_0x096f('0x15')][_0x096f('0x16')])||!this[_0x096f('0x15')][_0x096f('0x16')])){logger[_0x096f('0x11')](_0x096f('0x12'),_0x52bf4c,'Autoreply\x20already\x20sent');return _0x466c95[_0x096f('0x14')]();}if(_0x2063d5[0x0]==='2'&&this[_0x096f('0x15')]['autoreplyExecuted']){logger[_0x096f('0x11')](_0x096f('0x17'),_0x52bf4c,'One\x20Time\x20already\x20sent');return _0x466c95[_0x096f('0x14')]();}var _0x5c362e={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x096f('0x18')};if(this[_0x096f('0xd')]===_0x096f('0xe')){_0x5c362e[_0x096f('0xf')]=utils[_0x096f('0x19')](_0x2063d5[0x2],this);}else{_0x5c362e[_0x096f('0xf')]=utils[_0x096f('0x19')](_0x2063d5[0x1],this);}if(this[_0x096f('0x1a')]){_0x5c362e['to']=this[_0x096f('0x1a')]['from']||'';if(this[_0x096f('0xd')]===_0x096f('0xe')&&_0x2063d5[0x1]==='1'){_0x5c362e['cc']=this['message']['cc']||'';}_0x5c362e[_0x096f('0x1b')]=this[_0x096f('0x1a')]['to']||'';_0x5c362e[_0x096f('0x1c')]=this[_0x096f('0x1a')][_0x096f('0x1c')]||'';_0x5c362e[_0x096f('0x1d')]=!![];if(this[_0x096f('0x1a')][_0x096f('0x1e')]){_0x5c362e['subject']='';_0x5c362e['subject']+=_[_0x096f('0x1f')](this[_0x096f('0x1a')][_0x096f('0x1e')],_0x096f('0x20'))?'':'Re:\x20';_0x5c362e[_0x096f('0x1e')]+=this[_0x096f('0x1a')][_0x096f('0x1e')];}}if(this[_0x096f('0xd')]===_0x096f('0x21')){_0x5c362e[_0x096f('0x22')]=this[_0x096f('0x23')]['id'];}else{_0x5c362e[_[_0x096f('0x24')](this[_0x096f('0xd')])+'AccountId']=this[_0x096f('0x23')]['id'];}_0x5c362e[_[_0x096f('0x24')](this[_0x096f('0xd')])+'InteractionId']=this['interaction']['id'];var _0x41575c=this['interaction'];if(rpc[this[_0x096f('0xd')]+_0x096f('0x25')]){if(this['channel']===_0x096f('0xe')){_0x5c362e['inReplyTo']=this[_0x096f('0x1a')][_0x096f('0x26')];_0x5c362e[_0x096f('0x27')]=_0x096f('0x28')+_[_0x096f('0x29')](_0x5c362e[_0x096f('0xf')],_0x096f('0x2a'),'','replace','','headers','auto-replied','All','smtpOptions','then','Message','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','stop','lodash','moment','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0x21b400,_0x42f5a2){var _0x37f5a6=function(_0x2e3cc8){while(--_0x2e3cc8){_0x21b400['push'](_0x21b400['shift']());}};_0x37f5a6(++_0x42f5a2);}(_0xfe06,0x1cb));var _0x6fe0=function(_0x333974,_0x1d6e0c){_0x333974=_0x333974-0x0;var _0x3c45a5=_0xfe06[_0x333974];return _0x3c45a5;};'use strict';var _=require(_0x6fe0('0x0'));var moment=require(_0x6fe0('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x6fe0('0x2')),'openchannelMessage':require(_0x6fe0('0x3')),'mailMessage':require(_0x6fe0('0x4')),'smsMessage':require(_0x6fe0('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x6fe0('0x6')),'chatInteraction':require(_0x6fe0('0x7')),'openchannelInteraction':require(_0x6fe0('0x8')),'mailInteraction':require(_0x6fe0('0x9')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x6fe0('0xa')),'whatsappInteraction':require(_0x6fe0('0xb'))};var mailRpc=require(_0x6fe0('0xc'));exports['consequence']=function(_0x1febd6,_0x52ecf5,_0x594206,_0x3efc50){return function(_0x54b467){try{var _0x2007b1=this['channel'];if(_0x2007b1===_0x6fe0('0xd')&&_0x3efc50['body'][_0x6fe0('0xe')]){logger[_0x6fe0('0xf')](_0x6fe0('0x10'),_0x1febd6,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x54b467[_0x6fe0('0x11')]();}if(_0x52ecf5[0x0]==='1'&&(_[_0x6fe0('0x12')](this[_0x6fe0('0x13')][_0x6fe0('0x14')])||!this[_0x6fe0('0x13')][_0x6fe0('0x14')])){logger[_0x6fe0('0xf')](_0x6fe0('0x10'),_0x1febd6,_0x6fe0('0x15'));return _0x54b467[_0x6fe0('0x11')]();}if(_0x52ecf5[0x0]==='2'&&this[_0x6fe0('0x13')][_0x6fe0('0x16')]){logger['info'](_0x6fe0('0x17'),_0x1febd6,_0x6fe0('0x18'));return _0x54b467[_0x6fe0('0x11')]();}var _0x1b1503={'ContactId':this[_0x6fe0('0x19')]['id'],'sentAt':moment()[_0x6fe0('0x1a')](_0x6fe0('0x1b')),'direction':_0x6fe0('0x1c')};if(this[_0x6fe0('0x1d')]===_0x6fe0('0xd')){_0x1b1503[_0x6fe0('0x1e')]=utils[_0x6fe0('0x1f')](_0x52ecf5[0x2],this);}else{_0x1b1503[_0x6fe0('0x1e')]=utils[_0x6fe0('0x1f')](_0x52ecf5[0x1],this);}if(this[_0x6fe0('0x20')]){_0x1b1503['to']=this[_0x6fe0('0x20')][_0x6fe0('0x21')]||'';if(this[_0x6fe0('0x1d')]==='mail'&&_0x52ecf5[0x1]==='1'){_0x1b1503['cc']=this[_0x6fe0('0x20')]['cc']||'';}_0x1b1503['from']=this[_0x6fe0('0x20')]['to']||'';_0x1b1503[_0x6fe0('0x22')]=this[_0x6fe0('0x20')]['phone']||'';_0x1b1503[_0x6fe0('0x23')]=!![];if(this[_0x6fe0('0x20')]['subject']){_0x1b1503[_0x6fe0('0x24')]='';_0x1b1503[_0x6fe0('0x24')]+=_[_0x6fe0('0x25')](this[_0x6fe0('0x20')][_0x6fe0('0x24')],_0x6fe0('0x26'))?'':_0x6fe0('0x27');_0x1b1503[_0x6fe0('0x24')]+=this[_0x6fe0('0x20')]['subject'];}}if(this[_0x6fe0('0x1d')]===_0x6fe0('0x28')){_0x1b1503[_0x6fe0('0x29')]=this[_0x6fe0('0x2a')]['id'];}else{_0x1b1503[_['upperFirst'](this['channel'])+_0x6fe0('0x2b')]=this['account']['id'];}_0x1b1503[_['upperFirst'](this[_0x6fe0('0x1d')])+_0x6fe0('0x2c')]=this[_0x6fe0('0x13')]['id'];var _0x49fe7a=this[_0x6fe0('0x13')];if(rpc[this['channel']+'Message']){if(this[_0x6fe0('0x1d')]===_0x6fe0('0xd')){_0x1b1503[_0x6fe0('0x2d')]=this[_0x6fe0('0x20')][_0x6fe0('0x2e')];_0x1b1503[_0x6fe0('0x2f')]=_0x6fe0('0x30')+_[_0x6fe0('0x31')](_0x1b1503[_0x6fe0('0x1e')],_0x6fe0('0x32'),_0x6fe0('0x33'))+_0x6fe0('0x34');_0x1b1503[_0x6fe0('0x35')]={'Auto-Submitted':_0x6fe0('0x36'),'X-Auto-Response-Suppress':_0x6fe0('0x37'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x6fe0('0x2a')][_0x6fe0('0x38')],_0x1b1503)[_0x6fe0('0x39')](function(_0x128bbe){logger[_0x6fe0('0xf')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x1febd6);_0x1b1503['messageId']=_0x128bbe[_0x6fe0('0x20')]['messageId'];return rpc[_0x2007b1+_0x6fe0('0x3a')]['create'](_0x1b1503);})[_0x6fe0('0x39')](function(_0x4cdd2f){logger['info']('[%s][AUTOREPLY]\x20%s',_0x1febd6,JSON[_0x6fe0('0x3b')](_0x4cdd2f));})[_0x6fe0('0x3c')](function(_0x3b4d9e){logger[_0x6fe0('0x3d')](_0x6fe0('0x3e'),_0x1febd6,JSON[_0x6fe0('0x3b')](_0x3b4d9e));})[_0x6fe0('0x3f')](function(){Promise['resolve']()[_0x6fe0('0x39')](function(){if(_0x52ecf5[0x0]!=='2'||_0x49fe7a[_0x6fe0('0x16')])return;return rpc[_0x2007b1+_0x6fe0('0x40')][_0x6fe0('0x41')](_0x49fe7a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x56b83c){logger[_0x6fe0('0xf')](_0x6fe0('0x17'),_0x1febd6,JSON[_0x6fe0('0x3b')](_0x56b83c));})[_0x6fe0('0x3c')](function(_0x429722){logger[_0x6fe0('0x3d')](_0x6fe0('0x42'),_0x1febd6,JSON[_0x6fe0('0x3b')](_0x429722));});})[_0x6fe0('0x39')](function(){_0x54b467['next']();});});}else{return rpc[this[_0x6fe0('0x1d')]+'Message'][_0x6fe0('0x43')](_0x1b1503)[_0x6fe0('0x39')](function(){logger[_0x6fe0('0xf')](_0x6fe0('0x10'),_0x1febd6,_0x1b1503[_0x6fe0('0x1e')]);})[_0x6fe0('0x3c')](function(_0x2bcb09){logger[_0x6fe0('0x3d')](_0x6fe0('0x10'),_0x1febd6,JSON[_0x6fe0('0x3b')](_0x2bcb09));})[_0x6fe0('0x3f')](function(){Promise['resolve']()[_0x6fe0('0x39')](function(){if(_0x52ecf5[0x0]!=='2'||_0x49fe7a[_0x6fe0('0x16')])return;return rpc[_0x2007b1+_0x6fe0('0x40')][_0x6fe0('0x41')](_0x49fe7a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x156c2b){logger[_0x6fe0('0xf')](_0x6fe0('0x17'),_0x1febd6,JSON[_0x6fe0('0x3b')](_0x156c2b));})[_0x6fe0('0x3c')](function(_0x22c391){logger[_0x6fe0('0x3d')](_0x6fe0('0x42'),_0x1febd6,JSON[_0x6fe0('0x3b')](_0x22c391));});})[_0x6fe0('0x39')](function(){_0x54b467[_0x6fe0('0x11')]();});});}}}catch(_0xbb1398){logger['error']('[%s][AUTOREPLY]\x20%s',_0x1febd6,JSON[_0x6fe0('0x3b')](_0xbb1398));_0x54b467[_0x6fe0('0x44')]();}};}; \ 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 6be66e2..81e4e1f 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 _0xe49a=['finally','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','Interaction','channel','update','interaction','then','catch','error','[%s][CLOSE]\x20%s','stringify'];(function(_0x4a662d,_0x1c3104){var _0x4bcbf7=function(_0x44b74b){while(--_0x44b74b){_0x4a662d['push'](_0x4a662d['shift']());}};_0x4bcbf7(++_0x1c3104);}(_0xe49a,0x152));var _0xae49=function(_0x337dd7,_0x2b4f7c){_0x337dd7=_0x337dd7-0x0;var _0x539e7d=_0xe49a[_0x337dd7];return _0x539e7d;};'use strict';var moment=require(_0xae49('0x0'));var logger=require('../../../../config/logger')(_0xae49('0x1'));var rpc={'chatInteraction':require(_0xae49('0x2')),'openchannelInteraction':require(_0xae49('0x3')),'smsInteraction':require(_0xae49('0x4')),'mailInteraction':require(_0xae49('0x5')),'faxInteraction':require(_0xae49('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xae49('0x7')]=function(_0x251151,_0x4523b5,_0x14fd42,_0x1d4ec6){return function(_0xd3f308){try{logger[_0xae49('0x8')](_0xae49('0x9'),_0x251151,_0x4523b5[0x0]);var _0x3042ac={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x4523b5[0x0]};if(rpc[_0x1d4ec6['channel']+_0xae49('0xa')]){rpc[_0x1d4ec6[_0xae49('0xb')]+'Interaction'][_0xae49('0xc')](_0x1d4ec6[_0xae49('0xd')]['id'],_0x3042ac)[_0xae49('0xe')](function(_0x4c06e5){logger[_0xae49('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x251151,_0x1d4ec6[_0xae49('0xd')]['id']);})[_0xae49('0xf')](function(_0x4bbe53){logger[_0xae49('0x10')](_0xae49('0x11'),_0x251151,JSON[_0xae49('0x12')](_0x4bbe53));})[_0xae49('0x13')](function(){_0xd3f308[_0xae49('0x14')]();});}}catch(_0x1ae909){logger[_0xae49('0x10')](_0xae49('0x11'),_0x251151,JSON[_0xae49('0x12')](_0x1ae909));_0xd3f308[_0xae49('0x14')]();}};}; \ No newline at end of file +var _0xe795=['consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','update','interaction','then','catch','stringify','stop','error','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe795,0x1c7));var _0x5e79=function(_0x1b3a0f,_0x1316ae){_0x1b3a0f=_0x1b3a0f-0x0;var _0x1ef8c0=_0xe795[_0x1b3a0f];return _0x1ef8c0;};'use strict';var moment=require(_0x5e79('0x0'));var logger=require(_0x5e79('0x1'))(_0x5e79('0x2'));var rpc={'chatInteraction':require(_0x5e79('0x3')),'openchannelInteraction':require(_0x5e79('0x4')),'smsInteraction':require(_0x5e79('0x5')),'mailInteraction':require(_0x5e79('0x6')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x5e79('0x7')]=function(_0x66186e,_0x38a90c,_0x1f0eb7,_0x240b3c){return function(_0x454b6f){try{logger[_0x5e79('0x8')](_0x5e79('0x9'),_0x66186e,_0x38a90c[0x0]);var _0x26f785={'closed':0x1,'closedAt':moment()[_0x5e79('0xa')](_0x5e79('0xb')),'closeReason':_0x5e79('0xc'),'disposition':_0x38a90c[0x0]};if(rpc[_0x240b3c['channel']+'Interaction']){rpc[_0x240b3c['channel']+_0x5e79('0xd')][_0x5e79('0xe')](_0x240b3c[_0x5e79('0xf')]['id'],_0x26f785)[_0x5e79('0x10')](function(_0x2ab629){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x66186e,_0x240b3c['interaction']['id']);})[_0x5e79('0x11')](function(_0x4a3a43){logger['error']('[%s][CLOSE]\x20%s',_0x66186e,JSON[_0x5e79('0x12')](_0x4a3a43));})['finally'](function(){_0x454b6f[_0x5e79('0x13')]();});}}catch(_0xd134a5){logger[_0x5e79('0x14')]('[%s][CLOSE]\x20%s',_0x66186e,JSON['stringify'](_0xd134a5));_0x454b6f['stop']();}};}; \ 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 e21df75..43536db 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 _0x36bb=['phone','chat','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','providerResponse','create','metadata','endConversation','next','catch','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out','channel','sms','whatsapp'];(function(_0x4fe1dd,_0x46b692){var _0x15014e=function(_0x4d37d4){while(--_0x4d37d4){_0x4fe1dd['push'](_0x4fe1dd['shift']());}};_0x15014e(++_0x46b692);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb36b('0x0'));var moment=require(_0xb36b('0x1'));var apiai=require(_0xb36b('0x2'));var md5=require('md5');var utils=require(_0xb36b('0x3'));var logger=require(_0xb36b('0x4'))(_0xb36b('0x5'));var rpc={'chatMessage':require(_0xb36b('0x6')),'openchannelMessage':require(_0xb36b('0x7')),'mailMessage':require(_0xb36b('0x8')),'smsMessage':require(_0xb36b('0x9')),'faxMessage':require(_0xb36b('0xa')),'whatsappMessage':require(_0xb36b('0xb'))};exports[_0xb36b('0xc')]=function(_0x181f45,_0x2e9885){return function(_0x229483){try{if(!_[_0xb36b('0xd')](this[_0xb36b('0xe')][_0xb36b('0xf')])){logger[_0xb36b('0x10')](_0xb36b('0x11'),_0x181f45,_0xb36b('0x12'));return _0x229483['next']();}var _0x2323b0={'ContactId':this[_0xb36b('0x13')]['id'],'sentAt':moment()[_0xb36b('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xb36b('0x15')};if(this[_0xb36b('0x16')]===_0xb36b('0x17')||this[_0xb36b('0x16')]===_0xb36b('0x18')){_0x2323b0[_0xb36b('0x19')]=this[_0xb36b('0xe')][_0xb36b('0x19')];}var _0x1e686b=this[_0xb36b('0x16')];if(_0x1e686b===_0xb36b('0x1a')){_0x2323b0['ChatWebsiteId']=this[_0xb36b('0x1b')]['id'];}else{_0x2323b0[_['upperFirst'](_0x1e686b)+'AccountId']=this[_0xb36b('0x1b')]['id'];}_0x2323b0[_[_0xb36b('0x1c')](_0x1e686b)+_0xb36b('0x1d')]=this[_0xb36b('0xe')]['id'];if(this[_0xb36b('0xe')][_0xb36b('0x1e')]){var _0x5ad8c8=_0x2e9885[0x2];if(!_[_0xb36b('0x1f')](_0x5ad8c8)){_0x2323b0[_0xb36b('0x20')]=utils[_0xb36b('0x21')](_0x5ad8c8,this);return rpc[_0x1e686b+_0xb36b('0x22')]['create'](_0x2323b0)[_0xb36b('0x23')](function(_0x211a91){logger[_0xb36b('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x181f45,_0x2323b0[_0xb36b('0x20')]);})['catch'](function(_0xcb8893){logger[_0xb36b('0x24')](_0xb36b('0x11'),_0x181f45,JSON[_0xb36b('0x25')](_0xcb8893));})[_0xb36b('0x26')](function(){logger[_0xb36b('0x10')](_0xb36b('0x27'),_0x181f45);_0x229483['stop']();});}else{logger[_0xb36b('0x10')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x181f45);_0x229483[_0xb36b('0x28')]();}}else{var _0x52b74f=this;var _0x3b8030=apiai(_0x2e9885[0x0],{'language':_0x2e9885[0x1]||'en'});return _0x3b8030[_0xb36b('0x29')](this[_0xb36b('0x2a')][_0xb36b('0x20')],{'sessionId':md5(this[_0xb36b('0xe')]['id'])})['then'](function(_0x474083){_0x52b74f[_0xb36b('0x20')][_0xb36b('0x2b')]=_0x474083;_0x2323b0['body']=_0x474083[_0xb36b('0x2c')]['fulfillment']['speech'];_0x2323b0['providerName']=_0xb36b('0x2b');_0x2323b0[_0xb36b('0x2d')]=JSON[_0xb36b('0x25')](_0x474083);return rpc[_0x1e686b+_0xb36b('0x22')][_0xb36b('0x2e')](_0x2323b0)[_0xb36b('0x23')](function(_0xd28a27){logger[_0xb36b('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x181f45,_0x2323b0['body']);if(_0x474083[_0xb36b('0x2c')][_0xb36b('0x2f')][_0xb36b('0x30')]){_0x229483[_0xb36b('0x31')]();}else{_0x229483['stop']();}})['catch'](function(_0x14d3f1){logger['error'](_0xb36b('0x11'),_0x181f45,JSON[_0xb36b('0x25')](_0x14d3f1));_0x229483['next']();});})[_0xb36b('0x32')](function(_0x24f8bc){logger[_0xb36b('0x24')](_0xb36b('0x11'),_0x181f45,_0x24f8bc[_0xb36b('0x2a')]);_0x229483[_0xb36b('0x31')]();});}}catch(_0x2e8349){logger[_0xb36b('0x24')](_0xb36b('0x11'),_0x181f45,JSON[_0xb36b('0x25')](_0x2e8349));_0x229483[_0xb36b('0x28')]();}};}; \ No newline at end of file +var _0xc1c6=['stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','lodash','moment','apiai-promise','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','create','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!'];(function(_0x59fbb2,_0x82c0b1){var _0x48d869=function(_0x1edd39){while(--_0x1edd39){_0x59fbb2['push'](_0x59fbb2['shift']());}};_0x48d869(++_0x82c0b1);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x1fe17f,_0x18bf1d){_0x1fe17f=_0x1fe17f-0x0;var _0x37dd0c=_0xc1c6[_0x1fe17f];return _0x37dd0c;};'use strict';var _=require(_0x6c1c('0x0'));var moment=require(_0x6c1c('0x1'));var apiai=require(_0x6c1c('0x2'));var md5=require('md5');var utils=require(_0x6c1c('0x3'));var logger=require('../../../../config/logger')(_0x6c1c('0x4'));var rpc={'chatMessage':require(_0x6c1c('0x5')),'openchannelMessage':require(_0x6c1c('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6c1c('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x6c1c('0x8')]=function(_0x582bec,_0xe510ca){return function(_0x2eb1ba){try{if(!_[_0x6c1c('0x9')](this[_0x6c1c('0xa')]['UserId'])){logger[_0x6c1c('0xb')](_0x6c1c('0xc'),_0x582bec,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2eb1ba[_0x6c1c('0xd')]();}var _0x36275f={'ContactId':this[_0x6c1c('0xe')]['id'],'sentAt':moment()[_0x6c1c('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6c1c('0x10')};if(this[_0x6c1c('0x11')]===_0x6c1c('0x12')||this['channel']===_0x6c1c('0x13')){_0x36275f[_0x6c1c('0x14')]=this[_0x6c1c('0xa')]['phone'];}var _0x2e82e9=this['channel'];if(_0x2e82e9===_0x6c1c('0x15')){_0x36275f[_0x6c1c('0x16')]=this[_0x6c1c('0x17')]['id'];}else{_0x36275f[_[_0x6c1c('0x18')](_0x2e82e9)+_0x6c1c('0x19')]=this[_0x6c1c('0x17')]['id'];}_0x36275f[_[_0x6c1c('0x18')](_0x2e82e9)+_0x6c1c('0x1a')]=this[_0x6c1c('0xa')]['id'];if(this['interaction'][_0x6c1c('0x1b')]){var _0x174657=_0xe510ca[0x2];if(!_['isEmpty'](_0x174657)){_0x36275f[_0x6c1c('0x1c')]=utils[_0x6c1c('0x1d')](_0x174657,this);return rpc[_0x2e82e9+'Message'][_0x6c1c('0x1e')](_0x36275f)['then'](function(_0x338dc2){logger[_0x6c1c('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x582bec,_0x36275f[_0x6c1c('0x1c')]);})['catch'](function(_0x2db60e){logger[_0x6c1c('0x1f')](_0x6c1c('0xc'),_0x582bec,JSON[_0x6c1c('0x20')](_0x2db60e));})[_0x6c1c('0x21')](function(){logger[_0x6c1c('0xb')](_0x6c1c('0x22'),_0x582bec);_0x2eb1ba[_0x6c1c('0x23')]();});}else{logger[_0x6c1c('0xb')](_0x6c1c('0x24'),_0x582bec);_0x2eb1ba[_0x6c1c('0x23')]();}}else{var _0x450b1f=this;var _0x2382c0=apiai(_0xe510ca[0x0],{'language':_0xe510ca[0x1]||'en'});return _0x2382c0[_0x6c1c('0x25')](this[_0x6c1c('0x26')][_0x6c1c('0x1c')],{'sessionId':md5(this[_0x6c1c('0xa')]['id'])})[_0x6c1c('0x27')](function(_0x3a3f13){_0x450b1f[_0x6c1c('0x1c')][_0x6c1c('0x28')]=_0x3a3f13;_0x36275f[_0x6c1c('0x1c')]=_0x3a3f13[_0x6c1c('0x29')][_0x6c1c('0x2a')][_0x6c1c('0x2b')];_0x36275f[_0x6c1c('0x2c')]=_0x6c1c('0x28');_0x36275f[_0x6c1c('0x2d')]=JSON[_0x6c1c('0x20')](_0x3a3f13);return rpc[_0x2e82e9+'Message'][_0x6c1c('0x1e')](_0x36275f)['then'](function(_0x10e9f7){logger['info'](_0x6c1c('0xc'),_0x582bec,_0x36275f['body']);if(_0x3a3f13[_0x6c1c('0x29')][_0x6c1c('0x2e')]['endConversation']){_0x2eb1ba[_0x6c1c('0xd')]();}else{_0x2eb1ba[_0x6c1c('0x23')]();}})['catch'](function(_0x3b319a){logger[_0x6c1c('0x1f')](_0x6c1c('0xc'),_0x582bec,JSON[_0x6c1c('0x20')](_0x3b319a));_0x2eb1ba['next']();});})['catch'](function(_0x3cba17){logger[_0x6c1c('0x1f')](_0x6c1c('0xc'),_0x582bec,_0x3cba17[_0x6c1c('0x26')]);_0x2eb1ba[_0x6c1c('0xd')]();});}}catch(_0x3d2ff7){logger['error'](_0x6c1c('0xc'),_0x582bec,JSON[_0x6c1c('0x20')](_0x3d2ff7));_0x2eb1ba['stop']();}};}; \ 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 361d9df..7417c27 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 _0x0d5a=['catch','error','stringify','consequence','interaction','UserId','next','contact','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','isEmpty','getMustacheRender','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','length','fulfillmentText','push','dialogflow','md5','moment','../../../../config/logger','./utils','../../rpc/mailMessage','../../rpc/smsMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s'];(function(_0x3f19b4,_0x175ce3){var _0x201c59=function(_0x25bb3b){while(--_0x25bb3b){_0x3f19b4['push'](_0x3f19b4['shift']());}};_0x201c59(++_0x175ce3);}(_0x0d5a,0x173));var _0xa0d5=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x0d5a[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var dialogflow=require(_0xa0d5('0x0'));var md5=require(_0xa0d5('0x1'));var moment=require(_0xa0d5('0x2'));var Promise=require('bluebird');var logger=require(_0xa0d5('0x3'))('routing');var utils=require(_0xa0d5('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa0d5('0x5')),'smsMessage':require(_0xa0d5('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x19fbd2,_0x40020a,_0x455168,_0x47d844){return new Promise(function(_0x5d9b15,_0x1e4816){var _0x99890b=_['clone'](_0x455168);_0x99890b[_0xa0d5('0x7')]=_0x47d844;return rpc[_0x40020a+_0xa0d5('0x8')][_0xa0d5('0x9')](_0x99890b)[_0xa0d5('0xa')](function(){logger[_0xa0d5('0xb')](_0xa0d5('0xc'),_0x19fbd2,_0x99890b['body']);_0x5d9b15();})[_0xa0d5('0xd')](function(_0x1f4a1b){logger[_0xa0d5('0xe')](_0xa0d5('0xc'),_0x19fbd2,JSON[_0xa0d5('0xf')](_0x1f4a1b));_0x1e4816(_0x1f4a1b);});});}exports[_0xa0d5('0x10')]=function(_0x384005,_0x3a5a5f){return function(_0x428c76){try{if(!_['isNil'](this[_0xa0d5('0x11')][_0xa0d5('0x12')])){logger[_0xa0d5('0xb')](_0xa0d5('0xc'),_0x384005,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x428c76[_0xa0d5('0x13')]();}var _0x5fd304={'ContactId':this[_0xa0d5('0x14')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa0d5('0x15')};if(this[_0xa0d5('0x16')]===_0xa0d5('0x17')||this[_0xa0d5('0x16')]===_0xa0d5('0x18')){_0x5fd304[_0xa0d5('0x19')]=this['interaction'][_0xa0d5('0x19')];}var _0x314412=this['channel'];if(_0x314412===_0xa0d5('0x1a')){_0x5fd304[_0xa0d5('0x1b')]=this[_0xa0d5('0x1c')]['id'];}else{_0x5fd304[_[_0xa0d5('0x1d')](_0x314412)+'AccountId']=this[_0xa0d5('0x1c')]['id'];}_0x5fd304[_[_0xa0d5('0x1d')](_0x314412)+'InteractionId']=this[_0xa0d5('0x11')]['id'];if(this['interaction']['created']){var _0xa2ae3c=_0x3a5a5f[0x4];if(!_[_0xa0d5('0x1e')](_0xa2ae3c)){_0x5fd304[_0xa0d5('0x7')]=utils[_0xa0d5('0x1f')](_0xa2ae3c,this);return rpc[_0x314412+_0xa0d5('0x8')][_0xa0d5('0x9')](_0x5fd304)[_0xa0d5('0xa')](function(_0x3262f3){logger[_0xa0d5('0xb')](_0xa0d5('0xc'),_0x384005,_0x5fd304[_0xa0d5('0x7')]);})[_0xa0d5('0xd')](function(_0x48c973){logger['error'](_0xa0d5('0xc'),_0x384005,JSON['stringify'](_0x48c973));})['finally'](function(){logger[_0xa0d5('0xb')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x384005);_0x428c76[_0xa0d5('0x20')]();});}else{logger[_0xa0d5('0xb')](_0xa0d5('0x21'),_0x384005);_0x428c76['stop']();}}else{var _0x2d60c0=this;var _0x517267=_0x3a5a5f[0x2][_0xa0d5('0x22')](/\\n/g,'\x0a');var _0x2ba6e6={'credentials':{'private_key':_0x517267,'client_email':_0x3a5a5f[0x1]}};var _0x2d0083=new dialogflow[(_0xa0d5('0x23'))](_0x2ba6e6);var _0x2824d0=_0x2d0083[_0xa0d5('0x24')](_0x3a5a5f[0x0],md5(_0x2d60c0[_0xa0d5('0x11')]['id']));var _0x3a21f4={'session':_0x2824d0,'queryInput':{'text':{'text':_0x2d60c0[_0xa0d5('0x25')][_0xa0d5('0x7')],'languageCode':_0x3a5a5f[0x3]||'en'}}};return _0x2d0083[_0xa0d5('0x26')](_0x3a21f4)[_0xa0d5('0xa')](function(_0x3321c8){if(_0x3321c8&&_0x3321c8['length']){_0x2d60c0[_0xa0d5('0x7')][_0xa0d5('0x27')]=_0x3321c8;var _0x47ea84=_0x3321c8[0x0];var _0x16280a=_0x47ea84[_0xa0d5('0x28')][_0xa0d5('0x29')]&&_0x47ea84[_0xa0d5('0x28')][_0xa0d5('0x29')][_0xa0d5('0x2a')]?_0x47ea84[_0xa0d5('0x28')][_0xa0d5('0x29')][_0xa0d5('0x2a')][_0xa0d5('0x2b')][_0xa0d5('0x2c')]:![];_0x2d60c0[_0xa0d5('0x7')][_0xa0d5('0x2d')]=_0x47ea84['queryResult'][_0xa0d5('0x2e')];_0x2d60c0[_0xa0d5('0x7')][_0xa0d5('0x2f')]=_0x47ea84[_0xa0d5('0x28')][_0xa0d5('0x30')];_0x2d60c0[_0xa0d5('0x7')][_0xa0d5('0x31')]=_0x47ea84[_0xa0d5('0x28')]['diagnosticInfo']&&_0x47ea84[_0xa0d5('0x28')][_0xa0d5('0x29')][_0xa0d5('0x2a')]?_0x47ea84['queryResult'][_0xa0d5('0x29')][_0xa0d5('0x2a')][_0xa0d5('0x2b')][_0xa0d5('0x2c')]:![];_0x2d60c0[_0xa0d5('0x7')][_0xa0d5('0x32')]=_0x47ea84[_0xa0d5('0x28')][_0xa0d5('0x33')]['name'];_0x2d60c0['body'][_0xa0d5('0x34')]=_0x47ea84['queryResult'][_0xa0d5('0x33')][_0xa0d5('0x35')];_0x2d60c0['body'][_0xa0d5('0x36')]=_0x47ea84['queryResult'][_0xa0d5('0x33')][_0xa0d5('0x37')];_0x2d60c0[_0xa0d5('0x7')]['DIALOGFLOWV2_LANGUAGECODE']=_0x47ea84[_0xa0d5('0x28')][_0xa0d5('0x38')];_0x2d60c0[_0xa0d5('0x7')]['DIALOGFLOWV2_QUERYTEXT']=_0x47ea84[_0xa0d5('0x28')][_0xa0d5('0x39')];_0x2d60c0[_0xa0d5('0x7')][_0xa0d5('0x3a')]=_0x47ea84['queryResult'][_0xa0d5('0x3b')];_0x5fd304[_0xa0d5('0x3c')]=_0xa0d5('0x27');_0x5fd304['providerResponse']=JSON[_0xa0d5('0xf')](_0x3321c8);var _0xc0963f=[];for(var _0x46ad51=0x0;_0x46ad51<_0x3321c8[_0xa0d5('0x3d')];_0x46ad51++){var _0x1db788=_0x3321c8[_0x46ad51];if(_0x1db788&&_0x1db788[_0xa0d5('0x28')]&&_0x1db788[_0xa0d5('0x28')][_0xa0d5('0x3e')]){_0xc0963f[_0xa0d5('0x3f')](createMessage(_0x384005,_0x314412,_0x5fd304,_0x1db788[_0xa0d5('0x28')]['fulfillmentText']));}}return Promise['all'](_0xc0963f)[_0xa0d5('0xa')](function(){if(_0x16280a){_0x428c76[_0xa0d5('0x13')]();}else{_0x428c76[_0xa0d5('0x20')]();}})[_0xa0d5('0xd')](function(_0x5959e4){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x384005,JSON['stringify'](_0x5959e4));_0x428c76[_0xa0d5('0x13')]();});}})[_0xa0d5('0xd')](function(_0x5a22ff){logger[_0xa0d5('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x384005,_0x5a22ff[_0xa0d5('0x25')],_0x5a22ff['stack']);_0x428c76['next']();});}}catch(_0xc1ef30){logger[_0xa0d5('0xe')](_0xa0d5('0xc'),_0x384005,JSON[_0xa0d5('0xf')](_0xc1ef30));_0x428c76['stop']();}};}; \ No newline at end of file +var _0x2819=['stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','push','fulfillmentText','all','next','stack','lodash','md5','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','clone','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','chat','account','upperFirst','AccountId','InteractionId','getMustacheRender','error'];(function(_0x9130dc,_0x3b4604){var _0x20a214=function(_0x51d38f){while(--_0x51d38f){_0x9130dc['push'](_0x9130dc['shift']());}};_0x20a214(++_0x3b4604);}(_0x2819,0x182));var _0x9281=function(_0x58a636,_0x1e9e4e){_0x58a636=_0x58a636-0x0;var _0x371610=_0x2819[_0x58a636];return _0x371610;};'use strict';var _=require(_0x9281('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x9281('0x1'));var moment=require(_0x9281('0x2'));var Promise=require('bluebird');var logger=require(_0x9281('0x3'))(_0x9281('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x9281('0x5')),'openchannelMessage':require(_0x9281('0x6')),'mailMessage':require(_0x9281('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9281('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x3fbb8d,_0x593a12,_0x5a29fa,_0x321312){return new Promise(function(_0x210a8c,_0x5cf023){var _0x5397d6=_[_0x9281('0x9')](_0x5a29fa);_0x5397d6[_0x9281('0xa')]=_0x321312;return rpc[_0x593a12+_0x9281('0xb')]['create'](_0x5397d6)[_0x9281('0xc')](function(){logger[_0x9281('0xd')](_0x9281('0xe'),_0x3fbb8d,_0x5397d6['body']);_0x210a8c();})[_0x9281('0xf')](function(_0x25622b){logger['error'](_0x9281('0xe'),_0x3fbb8d,JSON['stringify'](_0x25622b));_0x5cf023(_0x25622b);});});}exports[_0x9281('0x10')]=function(_0x1449c0,_0x2572f3){return function(_0x485eb7){try{if(!_[_0x9281('0x11')](this[_0x9281('0x12')][_0x9281('0x13')])){logger[_0x9281('0xd')](_0x9281('0xe'),_0x1449c0,_0x9281('0x14'));return _0x485eb7['next']();}var _0x20b072={'ContactId':this[_0x9281('0x15')]['id'],'sentAt':moment()[_0x9281('0x16')](_0x9281('0x17')),'direction':_0x9281('0x18')};if(this[_0x9281('0x19')]===_0x9281('0x1a')||this[_0x9281('0x19')]==='whatsapp'){_0x20b072['phone']=this[_0x9281('0x12')]['phone'];}var _0x54ae84=this[_0x9281('0x19')];if(_0x54ae84===_0x9281('0x1b')){_0x20b072['ChatWebsiteId']=this[_0x9281('0x1c')]['id'];}else{_0x20b072[_[_0x9281('0x1d')](_0x54ae84)+_0x9281('0x1e')]=this['account']['id'];}_0x20b072[_[_0x9281('0x1d')](_0x54ae84)+_0x9281('0x1f')]=this[_0x9281('0x12')]['id'];if(this['interaction']['created']){var _0x3fee87=_0x2572f3[0x4];if(!_['isEmpty'](_0x3fee87)){_0x20b072[_0x9281('0xa')]=utils[_0x9281('0x20')](_0x3fee87,this);return rpc[_0x54ae84+_0x9281('0xb')]['create'](_0x20b072)[_0x9281('0xc')](function(_0x21da81){logger[_0x9281('0xd')](_0x9281('0xe'),_0x1449c0,_0x20b072[_0x9281('0xa')]);})[_0x9281('0xf')](function(_0x26711c){logger[_0x9281('0x21')](_0x9281('0xe'),_0x1449c0,JSON[_0x9281('0x22')](_0x26711c));})[_0x9281('0x23')](function(){logger['info'](_0x9281('0x24'),_0x1449c0);_0x485eb7[_0x9281('0x25')]();});}else{logger[_0x9281('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1449c0);_0x485eb7[_0x9281('0x25')]();}}else{var _0x22ab99=this;var _0x22816e=_0x2572f3[0x2][_0x9281('0x26')](/\\n/g,'\x0a');var _0x6e33ee={'credentials':{'private_key':_0x22816e,'client_email':_0x2572f3[0x1]}};var _0x20d4db=new dialogflow['SessionsClient'](_0x6e33ee);var _0x1b9684=_0x20d4db[_0x9281('0x27')](_0x2572f3[0x0],md5(_0x22ab99[_0x9281('0x12')]['id']));var _0x583356={'session':_0x1b9684,'queryInput':{'text':{'text':_0x22ab99[_0x9281('0x28')][_0x9281('0xa')],'languageCode':_0x2572f3[0x3]||'en'}}};return _0x20d4db[_0x9281('0x29')](_0x583356)[_0x9281('0xc')](function(_0x377f90){if(_0x377f90&&_0x377f90[_0x9281('0x2a')]){_0x22ab99['body'][_0x9281('0x2b')]=_0x377f90;var _0x4321c7=_0x377f90[0x0];var _0x5b4e02=_0x4321c7[_0x9281('0x2c')][_0x9281('0x2d')]&&_0x4321c7[_0x9281('0x2c')][_0x9281('0x2d')][_0x9281('0x2e')]?_0x4321c7[_0x9281('0x2c')][_0x9281('0x2d')][_0x9281('0x2e')][_0x9281('0x2f')][_0x9281('0x30')]:![];_0x22ab99['body'][_0x9281('0x31')]=_0x4321c7[_0x9281('0x2c')][_0x9281('0x32')];_0x22ab99[_0x9281('0xa')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x4321c7[_0x9281('0x2c')][_0x9281('0x33')];_0x22ab99[_0x9281('0xa')][_0x9281('0x34')]=_0x4321c7[_0x9281('0x2c')][_0x9281('0x2d')]&&_0x4321c7[_0x9281('0x2c')][_0x9281('0x2d')][_0x9281('0x2e')]?_0x4321c7['queryResult']['diagnosticInfo'][_0x9281('0x2e')][_0x9281('0x2f')]['boolValue']:![];_0x22ab99['body'][_0x9281('0x35')]=_0x4321c7[_0x9281('0x2c')]['intent'][_0x9281('0x36')];_0x22ab99[_0x9281('0xa')][_0x9281('0x37')]=_0x4321c7[_0x9281('0x2c')]['intent'][_0x9281('0x38')];_0x22ab99[_0x9281('0xa')][_0x9281('0x39')]=_0x4321c7[_0x9281('0x2c')][_0x9281('0x3a')][_0x9281('0x3b')];_0x22ab99[_0x9281('0xa')][_0x9281('0x3c')]=_0x4321c7[_0x9281('0x2c')]['languageCode'];_0x22ab99[_0x9281('0xa')][_0x9281('0x3d')]=_0x4321c7[_0x9281('0x2c')]['queryText'];_0x22ab99[_0x9281('0xa')][_0x9281('0x3e')]=_0x4321c7[_0x9281('0x2c')][_0x9281('0x3f')];_0x20b072[_0x9281('0x40')]=_0x9281('0x2b');_0x20b072['providerResponse']=JSON['stringify'](_0x377f90);var _0x3e4a2e=[];for(var _0x21eb2d=0x0;_0x21eb2d<_0x377f90[_0x9281('0x2a')];_0x21eb2d++){var _0x62def=_0x377f90[_0x21eb2d];if(_0x62def&&_0x62def['queryResult']&&_0x62def[_0x9281('0x2c')]['fulfillmentText']){_0x3e4a2e[_0x9281('0x41')](createMessage(_0x1449c0,_0x54ae84,_0x20b072,_0x62def['queryResult'][_0x9281('0x42')]));}}return Promise[_0x9281('0x43')](_0x3e4a2e)[_0x9281('0xc')](function(){if(_0x5b4e02){_0x485eb7[_0x9281('0x44')]();}else{_0x485eb7[_0x9281('0x25')]();}})[_0x9281('0xf')](function(_0x287147){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x1449c0,JSON[_0x9281('0x22')](_0x287147));_0x485eb7[_0x9281('0x44')]();});}})[_0x9281('0xf')](function(_0x324084){logger[_0x9281('0x21')](_0x9281('0xe'),_0x1449c0,_0x324084['message'],_0x324084[_0x9281('0x45')]);_0x485eb7[_0x9281('0x44')]();});}}catch(_0x169d49){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x1449c0,JSON[_0x9281('0x22')](_0x169d49));_0x485eb7[_0x9281('0x25')]();}};}; \ 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 f5c8115..e5503b7 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 _0x4250=['error','[%s][GOTOIF]\x20%s','map','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString'];(function(_0x2b4a59,_0x4dfbd6){var _0x84b9c1=function(_0x12a486){while(--_0x12a486){_0x2b4a59['push'](_0x2b4a59['shift']());}};_0x84b9c1(++_0x4dfbd6);}(_0x4250,0x1b5));var _0x0425=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x4250[_0x28947d];return _0x12d2ee;};'use strict';var schema=require(_0x0425('0x0'));var _=require(_0x0425('0x1'));var htmlToText=require(_0x0425('0x2'));var utils=require(_0x0425('0x3'));var logger=require('../../../../config/logger')(_0x0425('0x4'));var gotoif=schema({'condition':{'type':_0x0425('0x5'),'required':!![],'message':_0x0425('0x6')},'priorityTrue':{'type':_0x0425('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x0425('0x7'),'message':_0x0425('0x8')}});exports[_0x0425('0x9')]=function(_0x2eb03a,_0x28ed84){return function(_0x9932b){try{var _0x1dbd99={'condition':htmlToText[_0x0425('0xa')](utils['getMustacheRender'](_0x28ed84[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x28ed84[0x1],'priorityFalse':_0x28ed84[0x2]};var _0xbd92e6=gotoif[_0x0425('0x0')](_0x1dbd99,{'typecast':!![]});if(_0xbd92e6['length']){logger[_0x0425('0xb')](_0x0425('0xc'),_0x2eb03a,_[_0x0425('0xd')](_0xbd92e6,'message')[_0x0425('0xe')](',\x20'));_0x9932b[_0x0425('0xf')]();}else{try{var _0xff9682=eval('('+_0x1dbd99['condition']+')');var _0x2d0c1=_0xff9682?_0x1dbd99[_0x0425('0x10')]:_0x1dbd99[_0x0425('0x11')];logger[_0x0425('0x12')](_0x0425('0x13'),_0x2eb03a,_0x1dbd99['condition'],_0xff9682,_0x2d0c1||_0x0425('0x14'));if(_0x2d0c1){var _0x7844fd=_[_0x0425('0x15')](_0x9932b[_0x0425('0x16')](),{'p':_0x2d0c1});if(_0x7844fd>=0x0){logger[_0x0425('0x12')](_0x0425('0x17'),_0x2eb03a,_0x2d0c1||_0x0425('0x14'),_0x7844fd);_0x9932b['next'](_0x7844fd);}else{logger[_0x0425('0x12')](_0x0425('0x18'),_0x2eb03a,_0x2d0c1||'next');_0x9932b[_0x0425('0xf')]();}}else{_0x9932b[_0x0425('0x14')]();}}catch(_0x49f8ce){logger[_0x0425('0xb')](_0x0425('0x19'),_0x2eb03a,_0x49f8ce[_0x0425('0x1a')]);_0x9932b[_0x0425('0xf')]();}}}catch(_0xd14765){logger[_0x0425('0xb')](_0x0425('0xc'),_0x2eb03a,JSON[_0x0425('0x1b')](_0xd14765));_0x9932b[_0x0425('0xf')]();}};}; \ No newline at end of file +var _0x5ea5=['[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','fromString','replace','length','error','map','message','join','stop','condition','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex'];(function(_0x36d5e3,_0x12c0a9){var _0x2d5150=function(_0x2dda91){while(--_0x2dda91){_0x36d5e3['push'](_0x36d5e3['shift']());}};_0x2d5150(++_0x12c0a9);}(_0x5ea5,0x123));var _0x55ea=function(_0x2f169c,_0x130a86){_0x2f169c=_0x2f169c-0x0;var _0x39937f=_0x5ea5[_0x2f169c];return _0x39937f;};'use strict';var schema=require(_0x55ea('0x0'));var _=require('lodash');var htmlToText=require(_0x55ea('0x1'));var utils=require(_0x55ea('0x2'));var logger=require(_0x55ea('0x3'))(_0x55ea('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x55ea('0x5')},'priorityTrue':{'type':_0x55ea('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x55ea('0x6'),'message':_0x55ea('0x7')}});exports['consequence']=function(_0x5cfd33,_0xca44d1){return function(_0x18971e){try{var _0x38c418={'condition':htmlToText[_0x55ea('0x8')](utils['getMustacheRender'](_0xca44d1[0x0],this),{'wordwrap':![]})[_0x55ea('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xca44d1[0x1],'priorityFalse':_0xca44d1[0x2]};var _0x332273=gotoif[_0x55ea('0x0')](_0x38c418,{'typecast':!![]});if(_0x332273[_0x55ea('0xa')]){logger[_0x55ea('0xb')]('[%s][GOTOIF]\x20%s',_0x5cfd33,_[_0x55ea('0xc')](_0x332273,_0x55ea('0xd'))[_0x55ea('0xe')](',\x20'));_0x18971e[_0x55ea('0xf')]();}else{try{var _0x231aba=eval('('+_0x38c418[_0x55ea('0x10')]+')');var _0x2e10fb=_0x231aba?_0x38c418['priorityTrue']:_0x38c418['priorityFalse'];logger[_0x55ea('0x11')](_0x55ea('0x12'),_0x5cfd33,_0x38c418[_0x55ea('0x10')],_0x231aba,_0x2e10fb||_0x55ea('0x13'));if(_0x2e10fb){var _0x22e819=_[_0x55ea('0x14')](_0x18971e['rules'](),{'p':_0x2e10fb});if(_0x22e819>=0x0){logger[_0x55ea('0x11')](_0x55ea('0x15'),_0x5cfd33,_0x2e10fb||_0x55ea('0x13'),_0x22e819);_0x18971e[_0x55ea('0x13')](_0x22e819);}else{logger[_0x55ea('0x11')](_0x55ea('0x16'),_0x5cfd33,_0x2e10fb||'next');_0x18971e['stop']();}}else{_0x18971e[_0x55ea('0x13')]();}}catch(_0x230655){logger[_0x55ea('0xb')](_0x55ea('0x17'),_0x5cfd33,_0x230655[_0x55ea('0xd')]);_0x18971e['stop']();}}}catch(_0x1209a2){logger['error'](_0x55ea('0x18'),_0x5cfd33,JSON[_0x55ea('0x19')](_0x1209a2));_0x18971e[_0x55ea('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 7b1f416..ec215fc 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 _0xc063=['stop','error','[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','map','message','join','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found'];(function(_0x32eb20,_0x3366c2){var _0x1492b5=function(_0x17b654){while(--_0x17b654){_0x32eb20['push'](_0x32eb20['shift']());}};_0x1492b5(++_0x3366c2);}(_0xc063,0x1cc));var _0x3c06=function(_0x460ae8,_0x3f0ee9){_0x460ae8=_0x460ae8-0x0;var _0x4d2a87=_0xc063[_0x460ae8];return _0x4d2a87;};'use strict';var schema=require(_0x3c06('0x0'));var _=require(_0x3c06('0x1'));var logger=require(_0x3c06('0x2'))('routing');var gotop=schema({'priority':{'type':_0x3c06('0x3'),'required':!![],'message':_0x3c06('0x4')}});exports['consequence']=function(_0x555710,_0x5b7c20){return function(_0x47ae30){try{var _0x597086={'priority':_0x5b7c20[0x0]};var _0xd66893=gotop[_0x3c06('0x0')](_0x597086,{'typecast':!![]});if(_0xd66893[_0x3c06('0x5')]){logger['error']('[%s][GOTOP]\x20%s',_0x555710,_[_0x3c06('0x6')](_0xd66893,_0x3c06('0x7'))[_0x3c06('0x8')](',\x20'));_0x47ae30['stop']();}else{logger[_0x3c06('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x555710,_0x597086['priority']);if(_0x597086[_0x3c06('0xa')]){var _0x4a4435=_[_0x3c06('0xb')](_0x47ae30['rules'](),{'p':_0x597086[_0x3c06('0xa')]});if(_0x4a4435>=0x0){logger['info'](_0x3c06('0xc'),_0x555710,_0x597086['priority']||_0x3c06('0xd'),_0x4a4435);_0x47ae30[_0x3c06('0xd')](_0x4a4435);}else{logger[_0x3c06('0x9')](_0x3c06('0xe'),_0x555710,_0x597086[_0x3c06('0xa')]||_0x3c06('0xd'));_0x47ae30[_0x3c06('0xf')]();}}else{_0x47ae30[_0x3c06('0xd')]();}}}catch(_0x29e721){logger[_0x3c06('0x10')](_0x3c06('0x11'),_0x555710,JSON[_0x3c06('0x12')](_0x29e721));_0x47ae30['stop']();}};}; \ No newline at end of file +var _0x56f2=['priority','findIndex','rules','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','join','stop','[%s][GOTOP]\x20priority\x20%s'];(function(_0x2fcbce,_0x1d72c4){var _0x346691=function(_0x5dcb52){while(--_0x5dcb52){_0x2fcbce['push'](_0x2fcbce['shift']());}};_0x346691(++_0x1d72c4);}(_0x56f2,0x1ab));var _0x256f=function(_0x42e41d,_0x2c8ca4){_0x42e41d=_0x42e41d-0x0;var _0x3c220b=_0x56f2[_0x42e41d];return _0x3c220b;};'use strict';var schema=require(_0x256f('0x0'));var _=require(_0x256f('0x1'));var logger=require(_0x256f('0x2'))(_0x256f('0x3'));var gotop=schema({'priority':{'type':_0x256f('0x4'),'required':!![],'message':_0x256f('0x5')}});exports[_0x256f('0x6')]=function(_0xc2b878,_0x18387){return function(_0x2c87cc){try{var _0x472585={'priority':_0x18387[0x0]};var _0x5a3d54=gotop[_0x256f('0x0')](_0x472585,{'typecast':!![]});if(_0x5a3d54[_0x256f('0x7')]){logger['error'](_0x256f('0x8'),_0xc2b878,_[_0x256f('0x9')](_0x5a3d54,'message')[_0x256f('0xa')](',\x20'));_0x2c87cc[_0x256f('0xb')]();}else{logger['info'](_0x256f('0xc'),_0xc2b878,_0x472585[_0x256f('0xd')]);if(_0x472585['priority']){var _0x464556=_[_0x256f('0xe')](_0x2c87cc[_0x256f('0xf')](),{'p':_0x472585[_0x256f('0xd')]});if(_0x464556>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xc2b878,_0x472585[_0x256f('0xd')]||'next',_0x464556);_0x2c87cc[_0x256f('0x10')](_0x464556);}else{logger[_0x256f('0x11')](_0x256f('0x12'),_0xc2b878,_0x472585[_0x256f('0xd')]||_0x256f('0x10'));_0x2c87cc['stop']();}}else{_0x2c87cc['next']();}}}catch(_0x2e9ea){logger['error'](_0x256f('0x8'),_0xc2b878,JSON[_0x256f('0x13')](_0x2e9ea));_0x2c87cc['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 7a2acf2..607a8b3 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 _0x73f5=['lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','catch','error','stringify','[%s][MESSAGE]\x20%s','stop'];(function(_0x32efcb,_0x55523f){var _0x1dae88=function(_0x11c606){while(--_0x11c606){_0x32efcb['push'](_0x32efcb['shift']());}};_0x1dae88(++_0x55523f);}(_0x73f5,0x1cb));var _0x573f=function(_0x16e874,_0x154da0){_0x16e874=_0x16e874-0x0;var _0x5460d4=_0x73f5[_0x16e874];return _0x5460d4;};'use strict';var _=require(_0x573f('0x0'));var utils=require(_0x573f('0x1'));var logger=require(_0x573f('0x2'))(_0x573f('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x573f('0x4')),'mailMessage':require(_0x573f('0x5')),'smsMessage':require(_0x573f('0x6')),'faxMessage':require(_0x573f('0x7')),'whatsappMessage':require(_0x573f('0x8'))};exports[_0x573f('0x9')]=function(_0x242662,_0x511645){return function(_0x2e7512){try{var _0x507ca6={'body':utils[_0x573f('0xa')](_0x511645[0x0],this),'ContactId':this['contact']['id']};if(this[_0x573f('0xb')]==='chat'){_0x507ca6[_0x573f('0xc')]=this[_0x573f('0xd')]['id'];}else{_0x507ca6[_[_0x573f('0xe')](this['channel'])+_0x573f('0xf')]=this['account']['id'];}_0x507ca6[_[_0x573f('0xe')](this[_0x573f('0xb')])+_0x573f('0x10')]=this[_0x573f('0x11')]['id'];if(rpc[this['channel']+'Message']){return rpc[this['channel']+_0x573f('0x12')][_0x573f('0x13')](_0x507ca6)[_0x573f('0x14')](function(_0x322304){logger[_0x573f('0x15')]('[%s][MESSAGE]\x20%s',_0x242662,_0x507ca6['body']);_0x2e7512['next']();})[_0x573f('0x16')](function(_0x149144){logger[_0x573f('0x17')]('[%s][MESSAGE]\x20%s',_0x242662,JSON[_0x573f('0x18')](_0x149144));_0x2e7512['stop']();});}}catch(_0x55d73f){logger['error'](_0x573f('0x19'),_0x242662,JSON[_0x573f('0x18')](_0x55d73f));_0x2e7512[_0x573f('0x1a')]();}};}; \ No newline at end of file +var _0xa9ba=['../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','chat','ChatWebsiteId','channel','AccountId','account','upperFirst','InteractionId','interaction','then','info','[%s][MESSAGE]\x20%s','error','stringify','stop','lodash'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa9ba,0x1e2));var _0xaa9b=function(_0x485128,_0xcd1787){_0x485128=_0x485128-0x0;var _0x4d4375=_0xa9ba[_0x485128];return _0x4d4375;};'use strict';var _=require(_0xaa9b('0x0'));var utils=require('./utils');var logger=require(_0xaa9b('0x1'))('routing');var rpc={'chatMessage':require(_0xaa9b('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xaa9b('0x3')),'smsMessage':require(_0xaa9b('0x4')),'faxMessage':require(_0xaa9b('0x5')),'whatsappMessage':require(_0xaa9b('0x6'))};exports['consequence']=function(_0x44a011,_0x9f0e1b){return function(_0x5e16fe){try{var _0x388d89={'body':utils[_0xaa9b('0x7')](_0x9f0e1b[0x0],this),'ContactId':this[_0xaa9b('0x8')]['id']};if(this['channel']===_0xaa9b('0x9')){_0x388d89[_0xaa9b('0xa')]=this['account']['id'];}else{_0x388d89[_['upperFirst'](this[_0xaa9b('0xb')])+_0xaa9b('0xc')]=this[_0xaa9b('0xd')]['id'];}_0x388d89[_[_0xaa9b('0xe')](this[_0xaa9b('0xb')])+_0xaa9b('0xf')]=this[_0xaa9b('0x10')]['id'];if(rpc[this[_0xaa9b('0xb')]+'Message']){return rpc[this[_0xaa9b('0xb')]+'Message']['create'](_0x388d89)[_0xaa9b('0x11')](function(_0x451771){logger[_0xaa9b('0x12')](_0xaa9b('0x13'),_0x44a011,_0x388d89['body']);_0x5e16fe['next']();})['catch'](function(_0x1f6a72){logger[_0xaa9b('0x14')]('[%s][MESSAGE]\x20%s',_0x44a011,JSON[_0xaa9b('0x15')](_0x1f6a72));_0x5e16fe[_0xaa9b('0x16')]();});}}catch(_0x466ae9){logger[_0xaa9b('0x14')](_0xaa9b('0x13'),_0x44a011,JSON['stringify'](_0x466ae9));_0x5e16fe[_0xaa9b('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 844a9ba..617e96f 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 _0x9306=['next','stringify','stop','./utils','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9306,0x17b));var _0x6930=function(_0xcc4bfe,_0x20bbc1){_0xcc4bfe=_0xcc4bfe-0x0;var _0x3b9903=_0x9306[_0xcc4bfe];return _0x3b9903;};'use strict';var utils=require(_0x6930('0x0'));var logger=require('../../../../config/logger')('routing');exports[_0x6930('0x1')]=function(_0x314597,_0x236536){return function(_0x383a3a){try{logger[_0x6930('0x2')](_0x6930('0x3'),_0x314597,utils[_0x6930('0x4')](_0x236536[0x0],this));_0x383a3a[_0x6930('0x5')]();}catch(_0x59bde5){logger['error'](_0x6930('0x3'),_0x314597,JSON[_0x6930('0x6')](_0x59bde5));_0x383a3a[_0x6930('0x7')]();}};}; \ No newline at end of file +var _0x9b61=['stop','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error','stringify'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0x9b61,0x1f0));var _0x19b6=function(_0xa834d7,_0x35afa4){_0xa834d7=_0xa834d7-0x0;var _0x3ffa0d=_0x9b61[_0xa834d7];return _0x3ffa0d;};'use strict';var utils=require('./utils');var logger=require(_0x19b6('0x0'))(_0x19b6('0x1'));exports[_0x19b6('0x2')]=function(_0x56238f,_0x51ce85){return function(_0x104cf2){try{logger[_0x19b6('0x3')](_0x19b6('0x4'),_0x56238f,utils[_0x19b6('0x5')](_0x51ce85[0x0],this));_0x104cf2['next']();}catch(_0x3ca80c){logger[_0x19b6('0x6')]('[%s][NOOP]\x20%s',_0x56238f,JSON[_0x19b6('0x7')](_0x3ca80c));_0x104cf2[_0x19b6('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 f727b71..2dd2571 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 _0x3c45=['../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','upperFirst','interaction','message','WebsiteId','account','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','join','find','Queues','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue','from','joinAt','emit','queue_id','push','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x3c45,0x1d5));var _0x53c4=function(_0x207a0a,_0x10eceb){_0x207a0a=_0x207a0a-0x0;var _0x50445c=_0x3c45[_0x207a0a];return _0x50445c;};'use strict';var schema=require(_0x53c4('0x0'));var _=require('lodash');var util=require(_0x53c4('0x1'));var seqqueue=require('seq-queue');var moment=require(_0x53c4('0x2'));var Redis=require(_0x53c4('0x3'));var config=require(_0x53c4('0x4'));var logger=require(_0x53c4('0x5'))(_0x53c4('0x6'));var strategy=require(_0x53c4('0x7'));config[_0x53c4('0x8')]=_[_0x53c4('0x9')](config[_0x53c4('0x8')],{'host':_0x53c4('0xa'),'port':0x18eb});var io=require(_0x53c4('0xb'))(new Redis(config[_0x53c4('0x8')]));var attributes=['id','queue_id','account',_0x53c4('0xc'),_0x53c4('0xd'),_0x53c4('0xe')];function emit(_0xdc93ea,_0x3c312c,_0x1eeb2a){io['to'](_0xdc93ea)[_0x53c4('0xf')](_0x3c312c,_0x1eeb2a);}function emitChannelQueueInteraction(_0xae9de5,_0x2a4719,_0x5074ce,_0x49d832,_0x8cd175,_0x8eb2a1,_0x167ff0,_0x59b062){var _0x365e21=_['clone'](_0x5074ce);_0x365e21[_0x53c4('0x10')]=_0x59b062;_0x365e21[_0x53c4('0xc')]=_0x2a4719;_0x365e21['account']=_0x49d832;_0x365e21['id']=_0x8cd175;if(_0x8eb2a1){attributes[_0x53c4('0x11')](_['capitalize'](_0xae9de5)+_0x53c4('0x12'));_0x167ff0[util[_0x53c4('0x13')](_0x53c4('0x14'),_0xae9de5)][_0x8cd175]=_['pick'](_0x365e21,attributes);}else{delete _0x167ff0[util[_0x53c4('0x13')](_0x53c4('0x14'),_0xae9de5)][_0x8cd175];}emit(util[_0x53c4('0x13')](_0x53c4('0x15'),_0xae9de5,_0x2a4719),util['format'](_0x53c4('0x16'),_0xae9de5,_0x8eb2a1?_0x53c4('0x17'):_0x53c4('0x18')),_[_0x53c4('0x19')](_0x365e21,attributes));}var rpc={'openchannelQueueReport':require(_0x53c4('0x1a')),'mailQueueReport':require(_0x53c4('0x1b')),'chatQueueReport':require(_0x53c4('0x1c')),'smsQueueReport':require(_0x53c4('0x1d')),'faxQueueReport':require(_0x53c4('0x1e')),'whatsappQueueReport':require(_0x53c4('0x1f')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x53c4('0x20')),'openchannelInteraction':require(_0x53c4('0x21')),'smsInteraction':require(_0x53c4('0x22')),'whatsappInteraction':require(_0x53c4('0x23'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x53c4('0x24'),'message':_0x53c4('0x25')}});function startRouting(_0x3ead91,_0x31edc4,_0x3d45c8,_0x6fe425){if(_0x3ead91&&_0x31edc4&&_0x3d45c8){_0x31edc4[_0x53c4('0x26')]+=0x1;var _0x343d3f={'uniqueid':_0x3ead91,'from':_0x3d45c8[_0x53c4('0x27')]?_0x3d45c8[_0x53c4('0x27')][_0x53c4('0xd')]:'','joinAt':moment()[_0x53c4('0x13')](_0x53c4('0x28')),'ContactId':_0x3d45c8[_0x53c4('0x29')]?_0x3d45c8['contact']['id']:null,'ListId':_0x3d45c8[_0x53c4('0x2a')]?_0x3d45c8[_0x53c4('0x2a')]['id']:null};_0x343d3f[_['upperFirst'](_0x3d45c8[_0x53c4('0x2b')])+'QueueId']=_0x31edc4['id']||null;_0x343d3f[_[_0x53c4('0x2c')](_0x3d45c8[_0x53c4('0x2b')])+'InteractionId']=_0x3d45c8[_0x53c4('0x2d')]?_0x3d45c8[_0x53c4('0x2d')]['id']:null;_0x343d3f[_[_0x53c4('0x2c')](_0x3d45c8[_0x53c4('0x2b')])+'MessageId']=_0x3d45c8[_0x53c4('0x2e')]?_0x3d45c8['message']['id']:null;_0x343d3f[_['upperFirst'](_0x3d45c8[_0x53c4('0x2b')])+(_0x3d45c8[_0x53c4('0x2b')]!=='chat'?'AccountId':_0x53c4('0x2f'))]=_0x3d45c8[_0x53c4('0x30')]?_0x3d45c8[_0x53c4('0x30')]['id']:null;logger[_0x53c4('0x31')](util[_0x53c4('0x13')](_0x53c4('0x32'),_0x3ead91,_0x31edc4[_0x53c4('0x33')]));emitChannelQueueInteraction(_0x3d45c8['channel'],_0x31edc4[_0x53c4('0x33')],_0x343d3f,_0x3d45c8[_0x53c4('0x30')]['name'],_0x3d45c8[_0x53c4('0x2e')]['id'],!![],_0x6fe425,_0x31edc4['id']);if(rpc[_0x3d45c8[_0x53c4('0x2b')]+'QueueReport']){return rpc[_0x3d45c8[_0x53c4('0x2b')]+_0x53c4('0x34')][_0x53c4('0x35')](_0x343d3f)[_0x53c4('0x36')](function(_0x1722c8){logger['error'](_0x53c4('0x37'),_0x1722c8);});}}}function stopRouting(_0x1fef8d,_0xbc23a6,_0x1f510d,_0x19f3d4){if(_0x1fef8d&&_0xbc23a6){_0xbc23a6['waiting']-=0x1;var _0x5a09f6={'leaveAt':moment()[_0x53c4('0x13')](_0x53c4('0x28')),'acceptAt':moment()[_0x53c4('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x53c4('0x38')};logger[_0x53c4('0x31')](util['format'](_0x53c4('0x39'),_0x1fef8d,_0xbc23a6[_0x53c4('0x33')]));emitChannelQueueInteraction(_0x1f510d['channel'],_0xbc23a6[_0x53c4('0x33')],_0x1f510d[_0x53c4('0x27')],_0x1f510d['account'][_0x53c4('0x33')],_0x1f510d[_0x53c4('0x2e')]['id'],![],_0x19f3d4,_0xbc23a6['id']);return rpc[_0x1f510d[_0x53c4('0x2b')]+_0x53c4('0x3a')][_0x53c4('0x3b')](_0x1f510d['interaction']['id'],{'queueId':_0xbc23a6['id']})[_0x53c4('0x3c')](function(){if(rpc[_0x1f510d['channel']+_0x53c4('0x34')]){return rpc[_0x1f510d[_0x53c4('0x2b')]+_0x53c4('0x34')][_0x53c4('0x3b')](_0x1fef8d,_0x5a09f6)[_0x53c4('0x36')](function(_0x567281){logger[_0x53c4('0x3d')](_0x53c4('0x3e'),_0x567281);});}});}}function endRouting(_0x42349b,_0x5b557e,_0x9bd394,_0xb18a0f){if(_0x42349b&&_0x5b557e){_0x5b557e[_0x53c4('0x26')]-=0x1;var _0x1b2ba6={'leaveAt':moment()[_0x53c4('0x13')](_0x53c4('0x28')),'exitAt':moment()[_0x53c4('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x53c4('0x3f')};logger[_0x53c4('0x31')](util['format'](_0x53c4('0x40'),_0x42349b,_0x5b557e[_0x53c4('0x33')]));emitChannelQueueInteraction(_0x9bd394[_0x53c4('0x2b')],_0x5b557e[_0x53c4('0x33')],_0x9bd394['body'],_0x9bd394['account'][_0x53c4('0x33')],_0x9bd394[_0x53c4('0x2e')]['id'],![],_0xb18a0f);if(rpc[_0x9bd394[_0x53c4('0x2b')]+_0x53c4('0x34')]){return rpc[_0x9bd394[_0x53c4('0x2b')]+_0x53c4('0x34')][_0x53c4('0x3b')](_0x42349b,_0x1b2ba6)[_0x53c4('0x36')](function(_0x4da9f2){logger['error']('update\x20queue\x20report',_0x4da9f2);});}}}function handleFindQueue(_0x24ffe4){return function(_0x542572){return _0x542572['name'][_0x53c4('0x41')]()===_0x24ffe4[_0x53c4('0x41')]();};}exports['consequence']=function(_0x5784d7,_0x3453ed,_0x3141de,_0x478222){return function(_0x5ecd46){try{var _0xced003={'name':_0x3453ed[0x0],'timeout':_0x3453ed[0x1]};var _0x12c397=queue[_0x53c4('0x0')](_0xced003,{'typecast':!![]});if(_0x12c397[_0x53c4('0x42')]){logger[_0x53c4('0x3d')](_0x53c4('0x43'),_0x5784d7,_['map'](_0x12c397,_0x53c4('0x2e'))[_0x53c4('0x44')](',\x20'));_0x5ecd46['stop']();}else{var _0x3747ae=_[_0x53c4('0x45')](_0x3141de[_0x478222[_0x53c4('0x2b')]+_0x53c4('0x46')],handleFindQueue(_0xced003[_0x53c4('0x33')]));if(_0x3747ae){startRouting(_0x5784d7,_0x3747ae,_0x478222,_0x3141de);var _0x6b948d=(_0x3747ae[_0x53c4('0x3f')]||0xa)*0x3e8;var _0x22637b=(_0xced003['timeout']||0x14)*0x3e8;var _0x57b1e4;if(_0x6b948d>_0x22637b){_0x22637b=_0x6b948d;}var _0x32b6b6=seqqueue['createQueue'](_0x6b948d);_0x32b6b6['id']=_0x5784d7;_0x32b6b6[_0x53c4('0x47')]=_0x6b948d;_0x32b6b6[_0x53c4('0x48')]=_0x22637b;_0x32b6b6['channel']=_0x478222[_0x53c4('0x2b')];_0x3141de[_0x53c4('0x49')][_0x5784d7]['on']('end',function(){logger[_0x53c4('0x31')](_0x53c4('0x4a'),_0x5784d7);stopRouting(_0x5784d7,_0x3747ae,_0x478222,_0x3141de);clearTimeout(_0x57b1e4);_0x57b1e4=undefined;_0x32b6b6[_0x53c4('0x4b')](!![]);if(_0x3141de['rules'][_0x5784d7]){delete _0x3141de[_0x53c4('0x49')][_0x5784d7];}_0x5ecd46[_0x53c4('0x4c')]();});_0x3141de[_0x53c4('0x49')][_0x5784d7]['on'](_0x53c4('0x4d'),function(){if(_0x3141de['rules'][_0x5784d7]){delete _0x3141de['rules'][_0x5784d7];}});_0x57b1e4=setTimeout(function(){logger[_0x53c4('0x31')](_0x53c4('0x4e'),_0x5784d7);endRouting(_0x5784d7,_0x3747ae,_0x478222,_0x3141de);clearTimeout(_0x57b1e4);_0x32b6b6[_0x53c4('0x4b')](!![]);_0x5ecd46[_0x53c4('0x4f')]();},_0x22637b);switch(_0x3747ae['strategy']){case _0x53c4('0x50'):strategy['rrmemory'](_0x32b6b6,_0x3747ae,_0x3141de,_0x478222);break;default:strategy[_0x53c4('0x51')](_0x32b6b6,_0x3747ae,_0x3141de,_0x478222);}}else{logger[_0x53c4('0x3d')](_0x53c4('0x52'),_0x5784d7,_0xced003[_0x53c4('0x33')]);_0x5ecd46[_0x53c4('0x4c')]();}}}catch(_0x42f009){logger[_0x53c4('0x3d')]('[%s][QUEUE]\x20%s',_0x5784d7,_0x42f009['stack']);_0x5ecd46[_0x53c4('0x4c')]();}};}; \ No newline at end of file +var _0x64d9=['name','QueueReport','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','defaults','redis','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','push','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x64d9,0xcb));var _0x964d=function(_0x34e76b,_0x402494){_0x34e76b=_0x34e76b-0x0;var _0xdcb6bd=_0x64d9[_0x34e76b];return _0xdcb6bd;};'use strict';var schema=require(_0x964d('0x0'));var _=require(_0x964d('0x1'));var util=require(_0x964d('0x2'));var seqqueue=require(_0x964d('0x3'));var moment=require(_0x964d('0x4'));var Redis=require(_0x964d('0x5'));var config=require(_0x964d('0x6'));var logger=require(_0x964d('0x7'))(_0x964d('0x8'));var strategy=require('./strategy');config['redis']=_[_0x964d('0x9')](config[_0x964d('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x964d('0xb'))(new Redis(config['redis']));var attributes=['id',_0x964d('0xc'),_0x964d('0xd'),_0x964d('0xe'),_0x964d('0xf'),_0x964d('0x10')];function emit(_0x553560,_0x43b3a1,_0xc5f7f4){io['to'](_0x553560)['emit'](_0x43b3a1,_0xc5f7f4);}function emitChannelQueueInteraction(_0x6e72ec,_0x3fef2e,_0x5d55fe,_0x17484a,_0x3e90cb,_0x18addc,_0x31421d,_0x57827f){var _0x1d3cba=_[_0x964d('0x11')](_0x5d55fe);_0x1d3cba[_0x964d('0xc')]=_0x57827f;_0x1d3cba[_0x964d('0xe')]=_0x3fef2e;_0x1d3cba[_0x964d('0xd')]=_0x17484a;_0x1d3cba['id']=_0x3e90cb;if(_0x18addc){attributes[_0x964d('0x12')](_['capitalize'](_0x6e72ec)+_0x964d('0x13'));_0x31421d[util[_0x964d('0x14')](_0x964d('0x15'),_0x6e72ec)][_0x3e90cb]=_[_0x964d('0x16')](_0x1d3cba,attributes);}else{delete _0x31421d[util[_0x964d('0x14')](_0x964d('0x15'),_0x6e72ec)][_0x3e90cb];}emit(util[_0x964d('0x14')](_0x964d('0x17'),_0x6e72ec,_0x3fef2e),util[_0x964d('0x14')](_0x964d('0x18'),_0x6e72ec,_0x18addc?_0x964d('0x19'):_0x964d('0x1a')),_[_0x964d('0x16')](_0x1d3cba,attributes));}var rpc={'openchannelQueueReport':require(_0x964d('0x1b')),'mailQueueReport':require(_0x964d('0x1c')),'chatQueueReport':require(_0x964d('0x1d')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x964d('0x1e')),'whatsappQueueReport':require(_0x964d('0x1f')),'chatInteraction':require(_0x964d('0x20')),'faxInteraction':require(_0x964d('0x21')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x964d('0x22')),'whatsappInteraction':require(_0x964d('0x23'))};var queue=schema({'name':{'type':_0x964d('0x24'),'required':!![],'message':_0x964d('0x25')},'timeout':{'type':_0x964d('0x26'),'message':_0x964d('0x27')}});function startRouting(_0x17b1db,_0x4be4e7,_0x5e5404,_0x1aa0bb){if(_0x17b1db&&_0x4be4e7&&_0x5e5404){_0x4be4e7[_0x964d('0x28')]+=0x1;var _0x2b0791={'uniqueid':_0x17b1db,'from':_0x5e5404['body']?_0x5e5404[_0x964d('0x29')][_0x964d('0xf')]:'','joinAt':moment()[_0x964d('0x14')](_0x964d('0x2a')),'ContactId':_0x5e5404[_0x964d('0x2b')]?_0x5e5404['contact']['id']:null,'ListId':_0x5e5404[_0x964d('0x2c')]?_0x5e5404[_0x964d('0x2c')]['id']:null};_0x2b0791[_[_0x964d('0x2d')](_0x5e5404['channel'])+_0x964d('0x2e')]=_0x4be4e7['id']||null;_0x2b0791[_[_0x964d('0x2d')](_0x5e5404[_0x964d('0x2f')])+_0x964d('0x13')]=_0x5e5404[_0x964d('0x30')]?_0x5e5404[_0x964d('0x30')]['id']:null;_0x2b0791[_['upperFirst'](_0x5e5404[_0x964d('0x2f')])+_0x964d('0x31')]=_0x5e5404['message']?_0x5e5404[_0x964d('0x32')]['id']:null;_0x2b0791[_['upperFirst'](_0x5e5404['channel'])+(_0x5e5404['channel']!=='chat'?_0x964d('0x33'):_0x964d('0x34'))]=_0x5e5404[_0x964d('0xd')]?_0x5e5404[_0x964d('0xd')]['id']:null;logger[_0x964d('0x35')](util[_0x964d('0x14')](_0x964d('0x36'),_0x17b1db,_0x4be4e7['name']));emitChannelQueueInteraction(_0x5e5404['channel'],_0x4be4e7[_0x964d('0x37')],_0x2b0791,_0x5e5404[_0x964d('0xd')][_0x964d('0x37')],_0x5e5404[_0x964d('0x32')]['id'],!![],_0x1aa0bb,_0x4be4e7['id']);if(rpc[_0x5e5404[_0x964d('0x2f')]+_0x964d('0x38')]){return rpc[_0x5e5404[_0x964d('0x2f')]+_0x964d('0x38')][_0x964d('0x39')](_0x2b0791)[_0x964d('0x3a')](function(_0x134f60){logger[_0x964d('0x3b')]('create\x20queue\x20report',_0x134f60);});}}}function stopRouting(_0x57b545,_0x57e1c5,_0x2eedf1,_0x59ea3c){if(_0x57b545&&_0x57e1c5){_0x57e1c5['waiting']-=0x1;var _0x2e1b0f={'leaveAt':moment()[_0x964d('0x14')](_0x964d('0x2a')),'acceptAt':moment()[_0x964d('0x14')](_0x964d('0x2a')),'reason':_0x964d('0x3c')};logger[_0x964d('0x35')](util[_0x964d('0x14')](_0x964d('0x3d'),_0x57b545,_0x57e1c5[_0x964d('0x37')]));emitChannelQueueInteraction(_0x2eedf1[_0x964d('0x2f')],_0x57e1c5[_0x964d('0x37')],_0x2eedf1[_0x964d('0x29')],_0x2eedf1[_0x964d('0xd')]['name'],_0x2eedf1[_0x964d('0x32')]['id'],![],_0x59ea3c,_0x57e1c5['id']);return rpc[_0x2eedf1['channel']+_0x964d('0x3e')][_0x964d('0x3f')](_0x2eedf1[_0x964d('0x30')]['id'],{'queueId':_0x57e1c5['id']})[_0x964d('0x40')](function(){if(rpc[_0x2eedf1[_0x964d('0x2f')]+_0x964d('0x38')]){return rpc[_0x2eedf1['channel']+'QueueReport'][_0x964d('0x3f')](_0x57b545,_0x2e1b0f)[_0x964d('0x3a')](function(_0x40d840){logger[_0x964d('0x3b')](_0x964d('0x41'),_0x40d840);});}});}}function endRouting(_0x416919,_0x15aab8,_0x5358cc,_0x11ed4e){if(_0x416919&&_0x15aab8){_0x15aab8[_0x964d('0x28')]-=0x1;var _0x57c6cf={'leaveAt':moment()[_0x964d('0x14')](_0x964d('0x2a')),'exitAt':moment()[_0x964d('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x964d('0x42')};logger[_0x964d('0x35')](util['format'](_0x964d('0x43'),_0x416919,_0x15aab8[_0x964d('0x37')]));emitChannelQueueInteraction(_0x5358cc[_0x964d('0x2f')],_0x15aab8[_0x964d('0x37')],_0x5358cc[_0x964d('0x29')],_0x5358cc[_0x964d('0xd')][_0x964d('0x37')],_0x5358cc[_0x964d('0x32')]['id'],![],_0x11ed4e);if(rpc[_0x5358cc[_0x964d('0x2f')]+_0x964d('0x38')]){return rpc[_0x5358cc[_0x964d('0x2f')]+_0x964d('0x38')]['update'](_0x416919,_0x57c6cf)[_0x964d('0x3a')](function(_0x2139be){logger[_0x964d('0x3b')]('update\x20queue\x20report',_0x2139be);});}}}function handleFindQueue(_0x33acae){return function(_0x3974b3){return _0x3974b3['name']['toLowerCase']()===_0x33acae[_0x964d('0x44')]();};}exports[_0x964d('0x45')]=function(_0xc704d0,_0x86014e,_0x349670,_0x486e51){return function(_0x57eff3){try{var _0x4d4d9a={'name':_0x86014e[0x0],'timeout':_0x86014e[0x1]};var _0x1abbc9=queue[_0x964d('0x0')](_0x4d4d9a,{'typecast':!![]});if(_0x1abbc9[_0x964d('0x46')]){logger[_0x964d('0x3b')](_0x964d('0x47'),_0xc704d0,_[_0x964d('0x48')](_0x1abbc9,_0x964d('0x32'))[_0x964d('0x49')](',\x20'));_0x57eff3[_0x964d('0x4a')]();}else{var _0x51efbe=_[_0x964d('0x4b')](_0x349670[_0x486e51['channel']+_0x964d('0x4c')],handleFindQueue(_0x4d4d9a[_0x964d('0x37')]));if(_0x51efbe){startRouting(_0xc704d0,_0x51efbe,_0x486e51,_0x349670);var _0x4370e6=(_0x51efbe[_0x964d('0x42')]||0xa)*0x3e8;var _0x503b73=(_0x4d4d9a[_0x964d('0x42')]||0x14)*0x3e8;var _0x3c979e;if(_0x4370e6>_0x503b73){_0x503b73=_0x4370e6;}var _0x331216=seqqueue[_0x964d('0x4d')](_0x4370e6);_0x331216['id']=_0xc704d0;_0x331216['atimeout']=_0x4370e6;_0x331216[_0x964d('0x4e')]=_0x503b73;_0x331216['channel']=_0x486e51[_0x964d('0x2f')];_0x349670[_0x964d('0x4f')][_0xc704d0]['on'](_0x964d('0x50'),function(){logger[_0x964d('0x35')](_0x964d('0x51'),_0xc704d0);stopRouting(_0xc704d0,_0x51efbe,_0x486e51,_0x349670);clearTimeout(_0x3c979e);_0x3c979e=undefined;_0x331216['close'](!![]);if(_0x349670[_0x964d('0x4f')][_0xc704d0]){delete _0x349670[_0x964d('0x4f')][_0xc704d0];}_0x57eff3[_0x964d('0x4a')]();});_0x349670['rules'][_0xc704d0]['on']('complete',function(){if(_0x349670[_0x964d('0x4f')][_0xc704d0]){delete _0x349670[_0x964d('0x4f')][_0xc704d0];}});_0x3c979e=setTimeout(function(){logger[_0x964d('0x35')]('[%s][QUEUE]\x20APPLICATION\x20END',_0xc704d0);endRouting(_0xc704d0,_0x51efbe,_0x486e51,_0x349670);clearTimeout(_0x3c979e);_0x331216['close'](!![]);_0x57eff3[_0x964d('0x52')]();},_0x503b73);switch(_0x51efbe['strategy']){case _0x964d('0x53'):strategy[_0x964d('0x53')](_0x331216,_0x51efbe,_0x349670,_0x486e51);break;default:strategy[_0x964d('0x54')](_0x331216,_0x51efbe,_0x349670,_0x486e51);}}else{logger['error'](_0x964d('0x55'),_0xc704d0,_0x4d4d9a[_0x964d('0x37')]);_0x57eff3[_0x964d('0x4a')]();}}}catch(_0x36efa8){logger[_0x964d('0x3b')](_0x964d('0x47'),_0xc704d0,_0x36efa8['stack']);_0x57eff3[_0x964d('0x4a')]();}};}; \ 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 1d40d11..92e7ce2 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 _0xb458=['[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','squeue','routing','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','agent','isNil','realtime','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','notificationId','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x564390,_0x309f73){var _0x1c740f=function(_0x52b076){while(--_0x52b076){_0x564390['push'](_0x564390['shift']());}};_0x1c740f(++_0x309f73);}(_0xb458,0x103));var _0x8b45=function(_0x9e1984,_0xb2f245){_0x9e1984=_0x9e1984-0x0;var _0x1b0b0b=_0xb458[_0x9e1984];return _0x1b0b0b;};'use strict';var _=require(_0x8b45('0x0'));var uuid=require(_0x8b45('0x1'));var util=require(_0x8b45('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0xdf89d4,_0x93d9cd,_0x141a44,_0x13a8c6){this['notificationId']=uuid['v4']();this[_0x8b45('0x3')]=_0xdf89d4;this['agent']=_0x93d9cd;this['realtime']=_0x141a44;this[_0x8b45('0x4')]=_0x13a8c6;this[_0x8b45('0x3')][_0x8b45('0x5')](this[_0x8b45('0x6')][_0x8b45('0x7')](this),this['handleTimeout'][_0x8b45('0x7')](this));this[_0x8b45('0x3')]['on'](_0x8b45('0x8'),this[_0x8b45('0x9')][_0x8b45('0x7')](this));this['squeue']['on'](_0x8b45('0xa'),this[_0x8b45('0xb')]['bind'](this));};Agent['prototype']['push']=function(){this['squeue'][_0x8b45('0x5')](this[_0x8b45('0x6')][_0x8b45('0x7')](this),this['handleTimeout'][_0x8b45('0x7')](this));};Agent[_0x8b45('0xc')][_0x8b45('0xb')]=function(){this[_0x8b45('0x9')](!![]);};Agent[_0x8b45('0xc')][_0x8b45('0x6')]=function(){logger['debug']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x8b45('0x3')]['id'],this[_0x8b45('0xd')]['id']);if(_[_0x8b45('0xe')](this[_0x8b45('0xf')][_0x8b45('0x10')][this[_0x8b45('0xd')]['id']])){logger[_0x8b45('0x11')](_0x8b45('0x12'),this[_0x8b45('0x3')]['id'],this[_0x8b45('0xd')]['id']);setTimeout(this[_0x8b45('0x5')][_0x8b45('0x7')](this),0x3e8);}else{if(this[_0x8b45('0x4')][_0x8b45('0x13')]||util[_0x8b45('0x14')](this[_0x8b45('0x3')]['id'],this[_0x8b45('0xf')][_0x8b45('0x10')][this['agent']['id']],this[_0x8b45('0x3')][_0x8b45('0x15')],![])){this[_0x8b45('0xf')][_0x8b45('0x10')][this[_0x8b45('0xd')]['id']][_0x8b45('0x16')]=!![];this[_0x8b45('0xf')][_0x8b45('0x10')][this['agent']['id']]['busyQueue']=undefined;util[_0x8b45('0x17')](this['realtime'],this[_0x8b45('0x4')],this[_0x8b45('0xd')],this[_0x8b45('0x3')][_0x8b45('0x15')]);util[_0x8b45('0x18')](this[_0x8b45('0x19')],this[_0x8b45('0x3')]['id'],this['realtime']['agents'][this[_0x8b45('0xd')]['id']],null,this[_0x8b45('0x4')]);util['writeLog'](this['squeue']['id'],this[_0x8b45('0xf')][_0x8b45('0x10')][this[_0x8b45('0xd')]['id']],_0x8b45('0x1a')+(this['routing'][_0x8b45('0x13')]?_0x8b45('0x1b'):''));}else{logger[_0x8b45('0x11')](_0x8b45('0x1c'),this[_0x8b45('0x3')]['id'],this[_0x8b45('0xd')]['id']);setTimeout(this[_0x8b45('0x5')][_0x8b45('0x7')](this),0x3e8);}}};Agent[_0x8b45('0xc')][_0x8b45('0x9')]=function(_0x339c73){if(_[_0x8b45('0xe')](this[_0x8b45('0xf')]['agents'][this[_0x8b45('0xd')]['id']])){return logger[_0x8b45('0x11')](_0x8b45('0x12'),this[_0x8b45('0x3')]['id'],this[_0x8b45('0xd')]['id']);}else{logger[_0x8b45('0x11')](_0x8b45('0x1d'),this[_0x8b45('0x3')]['id'],this['agent']['id']);util[_0x8b45('0x1e')](this[_0x8b45('0x19')],this[_0x8b45('0x3')]['id'],this[_0x8b45('0xf')][_0x8b45('0x10')][this['agent']['id']],null,this[_0x8b45('0x4')]);this['realtime']['agents'][this[_0x8b45('0xd')]['id']][_0x8b45('0x16')]=![];this[_0x8b45('0xf')][_0x8b45('0x10')][this[_0x8b45('0xd')]['id']][_0x8b45('0x1f')]=undefined;util['removeWaitingNotification'](this[_0x8b45('0xf')],this[_0x8b45('0x4')],this[_0x8b45('0xd')],this[_0x8b45('0x3')]['channel']);util[_0x8b45('0x20')](this[_0x8b45('0x3')]['id'],this[_0x8b45('0xf')]['agents'][this[_0x8b45('0xd')]['id']],_0x339c73?_0x8b45('0x21'):_0x8b45('0x22'));}if(!_0x339c73){setTimeout(this['push'][_0x8b45('0x7')](this),0x3e8);}};function agent(_0x348a13,_0x3452fb,_0x4016b7,_0x58d94f){return new Agent(_0x348a13,_0x3452fb,_0x4016b7,_0x58d94f);}module[_0x8b45('0x23')]=agent; \ No newline at end of file +var _0xd0bb=['RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','agent','realtime','squeue','push','bind','handleTimeout','timeout','drained','prototype','handleRun','handleDrained','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','writeLog'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x4c41c4,_0x75bc8a){_0x4c41c4=_0x4c41c4-0x0;var _0x2bdc48=_0xd0bb[_0x4c41c4];return _0x2bdc48;};'use strict';var _=require(_0xbd0b('0x0'));var uuid=require(_0xbd0b('0x1'));var util=require(_0xbd0b('0x2'));var logger=require('../../../../../config/logger')(_0xbd0b('0x3'));var Agent=function(_0x4ab08f,_0x39b03a,_0x1f6ec3,_0x53e6ce){this[_0xbd0b('0x4')]=uuid['v4']();this['squeue']=_0x4ab08f;this[_0xbd0b('0x5')]=_0x39b03a;this[_0xbd0b('0x6')]=_0x1f6ec3;this[_0xbd0b('0x3')]=_0x53e6ce;this[_0xbd0b('0x7')][_0xbd0b('0x8')](this['handleRun'][_0xbd0b('0x9')](this),this[_0xbd0b('0xa')][_0xbd0b('0x9')](this));this[_0xbd0b('0x7')]['on'](_0xbd0b('0xb'),this['handleTimeout']['bind'](this));this[_0xbd0b('0x7')]['on'](_0xbd0b('0xc'),this['handleDrained'][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xd')]['push']=function(){this[_0xbd0b('0x7')][_0xbd0b('0x8')](this[_0xbd0b('0xe')][_0xbd0b('0x9')](this),this[_0xbd0b('0xa')][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xd')][_0xbd0b('0xf')]=function(){this[_0xbd0b('0xa')](!![]);};Agent[_0xbd0b('0xd')][_0xbd0b('0xe')]=function(){logger['debug'](_0xbd0b('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0xbd0b('0x11')](this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']])){logger[_0xbd0b('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xbd0b('0x5')]['id']);setTimeout(this[_0xbd0b('0x8')][_0xbd0b('0x9')](this),0x3e8);}else{if(this[_0xbd0b('0x3')][_0xbd0b('0x14')]||util[_0xbd0b('0x15')](this['squeue']['id'],this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']],this[_0xbd0b('0x7')][_0xbd0b('0x16')],![])){this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x17')]=!![];this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']]['busyQueue']=undefined;util[_0xbd0b('0x18')](this[_0xbd0b('0x6')],this[_0xbd0b('0x3')],this[_0xbd0b('0x5')],this[_0xbd0b('0x7')]['channel']);util[_0xbd0b('0x19')](this['notificationId'],this[_0xbd0b('0x7')]['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],null,this[_0xbd0b('0x3')]);util[_0xbd0b('0x1a')](this['squeue']['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],_0xbd0b('0x1b')+(this[_0xbd0b('0x3')][_0xbd0b('0x14')]?':FORCED':''));}else{logger[_0xbd0b('0x13')](_0xbd0b('0x1c'),this[_0xbd0b('0x7')]['id'],this['agent']['id']);setTimeout(this['push'][_0xbd0b('0x9')](this),0x3e8);}}};Agent[_0xbd0b('0xd')][_0xbd0b('0xa')]=function(_0xf4ba04){if(_[_0xbd0b('0x11')](this[_0xbd0b('0x6')][_0xbd0b('0x12')][this['agent']['id']])){return logger[_0xbd0b('0x13')](_0xbd0b('0x1d'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xbd0b('0x13')](_0xbd0b('0x1e'),this['squeue']['id'],this[_0xbd0b('0x5')]['id']);util[_0xbd0b('0x1f')](this[_0xbd0b('0x4')],this[_0xbd0b('0x7')]['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this['agent']['id']],null,this[_0xbd0b('0x3')]);this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x17')]=![];this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x20')]=undefined;util[_0xbd0b('0x21')](this[_0xbd0b('0x6')],this[_0xbd0b('0x3')],this[_0xbd0b('0x5')],this[_0xbd0b('0x7')]['channel']);util[_0xbd0b('0x1a')](this[_0xbd0b('0x7')]['id'],this['realtime'][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],_0xf4ba04?_0xbd0b('0x22'):_0xbd0b('0x23'));}if(!_0xf4ba04){setTimeout(this[_0xbd0b('0x8')][_0xbd0b('0x9')](this),0x3e8);}};function agent(_0x4c8ff5,_0x327425,_0x11cf5a,_0x3b5098){return new Agent(_0x4c8ff5,_0x327425,_0x11cf5a,_0x3b5098);}module[_0xbd0b('0x24')]=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 7ef4b9b..6e7183a 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 _0xc175=['showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','TIMEOUT','busy','removeWaitingNotification','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','isNil','Agents','length','agents','debug','isAgentAvailable','channel','writeLog','RINGING','busyQueue','saveWaitingNotification'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xc175,0x14d));var _0x5c17=function(_0x359592,_0x26f0ec){_0x359592=_0x359592-0x0;var _0x273847=_0xc175[_0x359592];return _0x273847;};'use strict';var _=require('lodash');var uuid=require(_0x5c17('0x0'));var util=require(_0x5c17('0x1'));var logger=require(_0x5c17('0x2'))(_0x5c17('0x3'));var Beepall=function(_0x233886,_0x4dc744,_0x213b18,_0x4a729a){this[_0x5c17('0x4')]=uuid['v4']();this[_0x5c17('0x5')]=_0x233886;this[_0x5c17('0x6')]=_0x4dc744;this[_0x5c17('0x7')]=_0x213b18;this[_0x5c17('0x3')]=_0x4a729a;this[_0x5c17('0x5')]['push'](this[_0x5c17('0x8')][_0x5c17('0x9')](this),this[_0x5c17('0xa')][_0x5c17('0x9')](this));this[_0x5c17('0x5')]['on'](_0x5c17('0xb'),this['handleTimeout'][_0x5c17('0x9')](this));this[_0x5c17('0x5')]['on'](_0x5c17('0xc'),this[_0x5c17('0xd')][_0x5c17('0x9')](this));};Beepall[_0x5c17('0xe')]['push']=function(){this['squeue'][_0x5c17('0xf')](this[_0x5c17('0x8')][_0x5c17('0x9')](this),this[_0x5c17('0xa')][_0x5c17('0x9')](this));};Beepall[_0x5c17('0xe')][_0x5c17('0xd')]=function(){this[_0x5c17('0xa')](!![]);};Beepall['prototype']['handleRun']=function(){var _0x1742df=!![];if(!_[_0x5c17('0x10')](this['queue'])&&!_[_0x5c17('0x10')](this[_0x5c17('0x6')]['Agents'])&&this[_0x5c17('0x6')][_0x5c17('0x11')]['length']>0x0){for(var _0x433c3a=0x0,_0x55b1f7;_0x433c3a0x0){for(var _0x25e80b=0x0,_0x3852e3;_0x25e80b0x0&&_0x10bfe8[_0x1abbdf+'CurrentCapacity']>=_0x10bfe8[_0x1abbdf+_0xfdef('0x22')]){writeLog(_0x237819,_0x10bfe8,_0x1abbdf['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xfdef('0x24')]=function(_0x5a9f4c,_0x40361f,_0x1fdca3,_0x362c58,_0x355fec){return sendNotification(!![],_0x5a9f4c,_0x40361f,_0x1fdca3,_0x362c58,_0x355fec);};exports['hideNotification']=function(_0xfe4a40,_0x20648e,_0x138647,_0xb67935,_0x20c895){return sendNotification(![],_0xfe4a40,_0x20648e,_0x138647,_0xb67935,_0x20c895);};exports[_0xfdef('0x25')]=function(_0x51fc9b,_0x88c145,_0x5ed5c0){var _0x59f831=_0x88c145['interaction'][_0xfdef('0x26')];if(!_0x59f831&&_0x5ed5c0){_0x59f831=_0x5ed5c0['id'];}var _0x3448a1=_[_0xfdef('0x27')](_0x51fc9b[_0x88c145['channel']+_0xfdef('0x28')],function(_0x406214){var _0x1d852d=_['capitalize'](_0x88c145[_0xfdef('0x29')])+_0xfdef('0x2a');return _0x406214[_0x1d852d]===_0x88c145[_0xfdef('0x2b')]['id'];});if(!_0x3448a1&&_0x59f831&&_0x51fc9b[_0xfdef('0x2c')][_0x59f831]){_0x3448a1=_[_0xfdef('0x27')](_0x51fc9b['agents'][_0x59f831][_0x88c145[_0xfdef('0x29')]+'WaitingInteractions'],function(_0x2ddacd){return _0x2ddacd['id']===_0x88c145[_0xfdef('0x2b')]['id'];});}return _0x3448a1;};exports[_0xfdef('0x2d')]=function(_0x1a2c92,_0x352ee5,_0x24dd44,_0x569572){if(_0x24dd44&&_0x24dd44['id']&&_0x1a2c92['agents']&&_0x1a2c92[_0xfdef('0x2c')][_0x24dd44['id']]){_0x1a2c92[_0xfdef('0x2c')][_0x24dd44['id']][_0x569572+_0xfdef('0x2e')][_0x352ee5[_0xfdef('0x16')]['id']]={'id':_0x352ee5['interaction']['id']};}};exports['removeWaitingNotification']=function(_0x5aaaa3,_0x9d6c80,_0x2a49f9,_0x37a3eb){if(_0x2a49f9&&_0x2a49f9['id']&&_0x5aaaa3[_0xfdef('0x2c')]&&_0x5aaaa3[_0xfdef('0x2c')][_0x2a49f9['id']]){delete _0x5aaaa3[_0xfdef('0x2c')][_0x2a49f9['id']][_0x37a3eb+_0xfdef('0x2e')][_0x9d6c80[_0xfdef('0x16')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file +var _0xef74=['account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','format','[%s][QUEUE]\x20%s','message','user:%s','emit','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','some','channel','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','split','\x20interaction','name'];(function(_0xd202dc,_0x2f2bfb){var _0x16ad38=function(_0x521998){while(--_0x521998){_0xd202dc['push'](_0xd202dc['shift']());}};_0x16ad38(++_0x2f2bfb);}(_0xef74,0x8d));var _0x4ef7=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xef74[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x4ef7('0x0'));var util=require(_0x4ef7('0x1'));var utils=require(_0x4ef7('0x2'));var Redis=require(_0x4ef7('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x4ef7('0x4'))(_0x4ef7('0x5'));config['redis']=_['defaults'](config[_0x4ef7('0x6')],{'host':_0x4ef7('0x7'),'port':0x18eb});var io=require(_0x4ef7('0x8'))(new Redis(config[_0x4ef7('0x6')]));function sendNotification(_0x36ced0,_0xbebde,_0x15626f,_0x39cdff,_0x30a89a,_0x26dd95){var _0x513760=_0x26dd95||{};var _0x2d4f25=_0x15626f[_0x4ef7('0x9')]('.');var _0xbc780a={'uniqueid':_0xbebde,'channel':_0x2d4f25[0x0],'id':_0x2d4f25[0x1],'title':_0x2d4f25[0x0]+_0x4ef7('0xa'),'interactionId':_0x2d4f25[0x2],'queue':_0x30a89a?_0x30a89a[_0x4ef7('0xb')]:null,'sound':_0x513760[_0x4ef7('0xc')][_0x4ef7('0xd')],'shake':_0x513760['account'][_0x4ef7('0xe')]};try{if(!_0x513760[_0x4ef7('0xf')]){_0x513760[_0x4ef7('0xf')]={};}if(_0x30a89a){_0x513760['body']['queue']=_0x30a89a;}else if(_0x513760['body'][_0x4ef7('0x10')]){delete _0x513760[_0x4ef7('0xf')]['queue'];}_0xbc780a[_0x4ef7('0x11')]=utils[_0x4ef7('0x12')](_0x513760['account'][_0x4ef7('0x13')],_0x513760);}catch(_0x1dda61){_0xbc780a['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0x4ef7('0x14')](util[_0x4ef7('0x15')](_0x4ef7('0x16'),_0xbebde,_0x1dda61[_0x4ef7('0x17')]));}io['to'](util[_0x4ef7('0x15')](_0x4ef7('0x18'),_0x39cdff[_0x4ef7('0xb')]))[_0x4ef7('0x19')](util[_0x4ef7('0x15')]('notification:%s',_0x36ced0?_0x4ef7('0x1a'):_0x4ef7('0x1b')),_0xbc780a);}function writeLog(_0x43331d,_0x647e4e,_0x40fd77){return logger[_0x4ef7('0x1c')](util[_0x4ef7('0x15')](_0x4ef7('0x1d'),_0x43331d,_0x647e4e['name'],_0x40fd77));}exports[_0x4ef7('0x1e')]=function(_0x4faff3,_0x34745d,_0x2c21fa,_0xa80ea5){if(_0x34745d['busy']){writeLog(_0x4faff3,_0x34745d,_0x4ef7('0x1f'));return![];}if(!_0x34745d[_0x4ef7('0x20')]){writeLog(_0x4faff3,_0x34745d,_0x4ef7('0x21'));return![];}if(_0x34745d[_0x2c21fa+'Pause']){writeLog(_0x4faff3,_0x34745d,_0x4ef7('0x22'));return![];}if(_0xa80ea5&&_0x34745d[_0x4ef7('0x23')](_0x2c21fa+'Capacity')&&_0x34745d['hasOwnProperty'](_0x2c21fa+_0x4ef7('0x24'))){if(_0x34745d[_0x2c21fa+'Capacity']>0x0&&_0x34745d[_0x2c21fa+_0x4ef7('0x24')]>=_0x34745d[_0x2c21fa+'Capacity']){writeLog(_0x4faff3,_0x34745d,_0x2c21fa['toUpperCase']()+_0x4ef7('0x25'));return![];}}return!![];};exports[_0x4ef7('0x26')]=function(_0x596c1f,_0x1dde22,_0x60a27e,_0x6bf767,_0xfe558e){return sendNotification(!![],_0x596c1f,_0x1dde22,_0x60a27e,_0x6bf767,_0xfe558e);};exports[_0x4ef7('0x27')]=function(_0x4ab1bf,_0x4433c2,_0x132c4d,_0x467601,_0x289389){return sendNotification(![],_0x4ab1bf,_0x4433c2,_0x132c4d,_0x467601,_0x289389);};exports[_0x4ef7('0x28')]=function(_0x4ccf19,_0x345876,_0x21a84f){var _0x29d6a5=_0x345876[_0x4ef7('0x29')][_0x4ef7('0x2a')];if(!_0x29d6a5&&_0x21a84f){_0x29d6a5=_0x21a84f['id'];}var _0x2d1c05=_[_0x4ef7('0x2b')](_0x4ccf19[_0x345876[_0x4ef7('0x2c')]+'QueuesWaitingInteractions'],function(_0x182afe){var _0x32fbbb=_['capitalize'](_0x345876[_0x4ef7('0x2c')])+_0x4ef7('0x2d');return _0x182afe[_0x32fbbb]===_0x345876[_0x4ef7('0x29')]['id'];});if(!_0x2d1c05&&_0x29d6a5&&_0x4ccf19['agents'][_0x29d6a5]){_0x2d1c05=_['some'](_0x4ccf19[_0x4ef7('0x2e')][_0x29d6a5][_0x345876[_0x4ef7('0x2c')]+_0x4ef7('0x2f')],function(_0x18d42e){return _0x18d42e['id']===_0x345876['interaction']['id'];});}return _0x2d1c05;};exports[_0x4ef7('0x30')]=function(_0x1afe82,_0x57e649,_0x4c0052,_0x34cc30){if(_0x4c0052&&_0x4c0052['id']&&_0x1afe82[_0x4ef7('0x2e')]&&_0x1afe82[_0x4ef7('0x2e')][_0x4c0052['id']]){_0x1afe82[_0x4ef7('0x2e')][_0x4c0052['id']][_0x34cc30+'WaitingInteractions'][_0x57e649['message']['id']]={'id':_0x57e649['interaction']['id']};}};exports[_0x4ef7('0x31')]=function(_0x532341,_0x485c1d,_0x1e22aa,_0x1d9ca4){if(_0x1e22aa&&_0x1e22aa['id']&&_0x532341[_0x4ef7('0x2e')]&&_0x532341[_0x4ef7('0x2e')][_0x1e22aa['id']]){delete _0x532341['agents'][_0x1e22aa['id']][_0x1d9ca4+_0x4ef7('0x2f')][_0x485c1d[_0x4ef7('0x17')]['id']];}};exports[_0x4ef7('0x32')]=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 73db976..1987dca 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 _0x79f9=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','next','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x1faec5,_0x4208cd){var _0x5851e5=function(_0x1f3ff8){while(--_0x1f3ff8){_0x1faec5['push'](_0x1faec5['shift']());}};_0x5851e5(++_0x4208cd);}(_0x79f9,0xbd));var _0x979f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x79f9[_0x57b54c];return _0x59cc19;};'use strict';var schema=require(_0x979f('0x0'));var sh=require(_0x979f('0x1'));var _=require(_0x979f('0x2'));var utils=require(_0x979f('0x3'));var logger=require(_0x979f('0x4'))(_0x979f('0x5'));var system=schema({'command':{'type':_0x979f('0x6'),'required':!![],'message':_0x979f('0x7')}});exports[_0x979f('0x8')]=function(_0x2ab8fe,_0x56913f){return function(_0xbcf116){try{var _0x192820={'command':_0x56913f[0x0]};var _0xc4e47=system['validate'](_0x192820,{'typecast':!![]});if(_0xc4e47[_0x979f('0x9')]){logger[_0x979f('0xa')](_0x979f('0xb'),_0x2ab8fe,_[_0x979f('0xc')](_0xc4e47,_0x979f('0xd'))[_0x979f('0xe')](',\x20'));logger['info'](_0x979f('0xf'),_0x2ab8fe);_0xbcf116['next']();}else{var _0x5d1815=this;var _0xdb2bfa=utils[_0x979f('0x10')](_0x56913f[0x0],this);logger[_0x979f('0x11')](_0x979f('0x12'),_0x2ab8fe,_0xdb2bfa);sh[_0x979f('0x13')](_['trim'](_0xdb2bfa),function(_0x310804,_0x44a586){logger[_0x979f('0x11')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x2ab8fe,_0x310804);if(_0x310804==0x0){var _0x204c0f=_0x44a586[_0x979f('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x56913f[0x1])||_[_0x979f('0x15')](_0x56913f[0x1])){logger[_0x979f('0x11')](_0x979f('0x16'),_0x2ab8fe);_0x5d1815['body'][_0x56913f[0x1]]=_0x204c0f;}else{logger[_0x979f('0x11')](_0x979f('0x17'),_0x2ab8fe,_0x56913f[0x1],_0x204c0f);_0x5d1815[_0x979f('0x18')][_0x56913f[0x1]]=_0x204c0f;}}_0xbcf116[_0x979f('0x19')]();});}}catch(_0x2de146){logger[_0x979f('0xa')](_0x979f('0xb'),_0x2ab8fe,_[_0x979f('0x1a')](_0x2de146)?JSON[_0x979f('0x1b')](_0x2de146):_0x2de146);logger['info'](_0x979f('0xf'),_0x2ab8fe);_0xbcf116[_0x979f('0x19')]();}};}; \ No newline at end of file +var _0x7074=['validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','stringify'];(function(_0x588a5a,_0x141bff){var _0x34b660=function(_0x30916e){while(--_0x30916e){_0x588a5a['push'](_0x588a5a['shift']());}};_0x34b660(++_0x141bff);}(_0x7074,0xdc));var _0x4707=function(_0x4275fe,_0x3f88f5){_0x4275fe=_0x4275fe-0x0;var _0x349e7c=_0x7074[_0x4275fe];return _0x349e7c;};'use strict';var schema=require(_0x4707('0x0'));var sh=require(_0x4707('0x1'));var _=require(_0x4707('0x2'));var utils=require(_0x4707('0x3'));var logger=require(_0x4707('0x4'))('routing');var system=schema({'command':{'type':_0x4707('0x5'),'required':!![],'message':_0x4707('0x6')}});exports[_0x4707('0x7')]=function(_0x2ee1f4,_0x541505){return function(_0x54e950){try{var _0x506d85={'command':_0x541505[0x0]};var _0x392cc8=system[_0x4707('0x0')](_0x506d85,{'typecast':!![]});if(_0x392cc8['length']){logger[_0x4707('0x8')](_0x4707('0x9'),_0x2ee1f4,_[_0x4707('0xa')](_0x392cc8,_0x4707('0xb'))['join'](',\x20'));logger[_0x4707('0xc')](_0x4707('0xd'),_0x2ee1f4);_0x54e950['next']();}else{var _0x1ed731=this;var _0x4d6fa0=utils['getMustacheRender'](_0x541505[0x0],this);logger[_0x4707('0xc')](_0x4707('0xe'),_0x2ee1f4,_0x4d6fa0);sh['exec'](_['trim'](_0x4d6fa0),function(_0x1adea3,_0x467442){logger['info'](_0x4707('0xf'),_0x2ee1f4,_0x1adea3);if(_0x1adea3==0x0){var _0x2be748=_0x467442['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x4707('0x10')](_0x541505[0x1])||_['isEmpty'](_0x541505[0x1])){logger[_0x4707('0xc')](_0x4707('0x11'),_0x2ee1f4);_0x1ed731[_0x4707('0x12')][_0x541505[0x1]]=_0x2be748;}else{logger['info'](_0x4707('0x13'),_0x2ee1f4,_0x541505[0x1],_0x2be748);_0x1ed731[_0x4707('0x12')][_0x541505[0x1]]=_0x2be748;}}_0x54e950[_0x4707('0x14')]();});}}catch(_0x51f841){logger[_0x4707('0x8')]('[%s][SYSTEM]\x20%s',_0x2ee1f4,_['isObject'](_0x51f841)?JSON[_0x4707('0x15')](_0x51f841):_0x51f841);logger[_0x4707('0xc')](_0x4707('0xd'),_0x2ee1f4);_0x54e950[_0x4707('0x14')]();}};}; \ 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 efdcb22..574d88b 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 _0xa157=['isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','catch','next'];(function(_0x2f238e,_0x21b4ee){var _0x497caa=function(_0x2fa9f5){while(--_0x2fa9f5){_0x2f238e['push'](_0x2f238e['shift']());}};_0x497caa(++_0x21b4ee);}(_0xa157,0x1e2));var _0x7a15=function(_0x3e90ab,_0x3f4826){_0x3e90ab=_0x3e90ab-0x0;var _0x1b52f9=_0xa157[_0x3e90ab];return _0x1b52f9;};'use strict';var schema=require(_0x7a15('0x0'));var _=require(_0x7a15('0x1'));var rpc={'chatInteraction':require(_0x7a15('0x2')),'openchannelInteraction':require(_0x7a15('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x7a15('0x4')),'whatsappInteraction':require(_0x7a15('0x5'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x7a15('0x6'),'required':!![],'message':_0x7a15('0x7')}});exports[_0x7a15('0x8')]=function(_0x243a32,_0xfe13fa,_0x5fbca2,_0x495806){return function(_0xaf856d){try{var _0x462765={'tag':_0xfe13fa[0x0]};var _0x26fdd0=tag[_0x7a15('0x0')](_0x462765,{'typecast':!![]});if(_0x26fdd0['length']){logger[_0x7a15('0x9')](_0x7a15('0xa'),_0x243a32,_[_0x7a15('0xb')](_0x26fdd0,_0x7a15('0xc'))['join'](',\x20'));logger[_0x7a15('0xd')](_0x7a15('0xe'),_0x243a32);_0xaf856d['next']();}else{var _0x49e0cd={'ids':[_0xfe13fa[0x0]]};if(rpc[_0x495806[_0x7a15('0xf')]+_0x7a15('0x10')]){rpc[_0x495806[_0x7a15('0xf')]+_0x7a15('0x10')][_0x7a15('0x11')](_0x495806[_0x7a15('0x12')]['id'],_0x49e0cd)[_0x7a15('0x13')](function(_0x35ecdb){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x243a32,_0xfe13fa[0x1],_0x495806[_0x7a15('0xf')],_0x495806[_0x7a15('0x12')]['id']);})[_0x7a15('0x14')](function(_0x51744f){logger['error'](_0x7a15('0xa'),_0x243a32,JSON['stringify'](_0x51744f));logger[_0x7a15('0xd')](_0x7a15('0xe'),_0x243a32);})['finally'](function(){_0xaf856d[_0x7a15('0x15')]();});}}}catch(_0x42fdd9){logger[_0x7a15('0x9')]('[%s][TAG]\x20%s',_0x243a32,_[_0x7a15('0x16')](_0x42fdd9)?JSON[_0x7a15('0x17')](_0x42fdd9):_0x42fdd9);logger[_0x7a15('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x243a32);_0xaf856d[_0x7a15('0x15')]();}};}; \ No newline at end of file +var _0xd0a5=['interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','stringify','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','info','next','channel','addTags'];(function(_0x5d1df9,_0x4a95bf){var _0x5d4feb=function(_0x37b443){while(--_0x37b443){_0x5d1df9['push'](_0x5d1df9['shift']());}};_0x5d4feb(++_0x4a95bf);}(_0xd0a5,0xc5));var _0x5d0a=function(_0x209584,_0x48b48c){_0x209584=_0x209584-0x0;var _0x3b5ea6=_0xd0a5[_0x209584];return _0x3b5ea6;};'use strict';var schema=require(_0x5d0a('0x0'));var _=require(_0x5d0a('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x5d0a('0x2')),'smsInteraction':require(_0x5d0a('0x3')),'mailInteraction':require(_0x5d0a('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x5d0a('0x5'))(_0x5d0a('0x6'));var tag=schema({'tag':{'type':_0x5d0a('0x7'),'required':!![],'message':_0x5d0a('0x8')}});exports[_0x5d0a('0x9')]=function(_0x4b1a19,_0x5b5f44,_0x5679e8,_0x38d4ff){return function(_0x24edc5){try{var _0x53673c={'tag':_0x5b5f44[0x0]};var _0x524e86=tag[_0x5d0a('0x0')](_0x53673c,{'typecast':!![]});if(_0x524e86[_0x5d0a('0xa')]){logger[_0x5d0a('0xb')](_0x5d0a('0xc'),_0x4b1a19,_[_0x5d0a('0xd')](_0x524e86,_0x5d0a('0xe'))['join'](',\x20'));logger[_0x5d0a('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4b1a19);_0x24edc5[_0x5d0a('0x10')]();}else{var _0x378243={'ids':[_0x5b5f44[0x0]]};if(rpc[_0x38d4ff[_0x5d0a('0x11')]+'Interaction']){rpc[_0x38d4ff[_0x5d0a('0x11')]+'Interaction'][_0x5d0a('0x12')](_0x38d4ff[_0x5d0a('0x13')]['id'],_0x378243)[_0x5d0a('0x14')](function(_0x4252a6){logger['info'](_0x5d0a('0x15'),_0x4b1a19,_0x5b5f44[0x1],_0x38d4ff['channel'],_0x38d4ff[_0x5d0a('0x13')]['id']);})[_0x5d0a('0x16')](function(_0x15ff3c){logger[_0x5d0a('0xb')](_0x5d0a('0xc'),_0x4b1a19,JSON['stringify'](_0x15ff3c));logger[_0x5d0a('0xf')](_0x5d0a('0x17'),_0x4b1a19);})[_0x5d0a('0x18')](function(){_0x24edc5[_0x5d0a('0x10')]();});}}}catch(_0x1ab843){logger['error'](_0x5d0a('0xc'),_0x4b1a19,_[_0x5d0a('0x19')](_0x1ab843)?JSON[_0x5d0a('0x1a')](_0x1ab843):_0x1ab843);logger[_0x5d0a('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4b1a19);_0x24edc5['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 1ebbc6c..a95d6e4 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 _0x4a68=['then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','&sessionId=','&data=','info','stop','catch','error','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','urlOnRing','?params=','title','2.0','login','params','stringify','utf8','POST','application/json-rpc'];(function(_0x20a086,_0x15cef2){var _0x379cc3=function(_0xe4c176){while(--_0xe4c176){_0x20a086['push'](_0x20a086['shift']());}};_0x379cc3(++_0x15cef2);}(_0x4a68,0xfc));var _0x84a6=function(_0x425540,_0x97a491){_0x425540=_0x425540-0x0;var _0x117693=_0x4a68[_0x425540];return _0x117693;};'use strict';var rp=require(_0x84a6('0x0'));var logger=require(_0x84a6('0x1'))('routing');var _=require(_0x84a6('0x2'));var arr=[];exports[_0x84a6('0x3')]=function(_0x5300b6,_0x1b528e){return function(_0x206fd3){var _0xd1278a=_0x1b528e[0xa];var _0x615bf5=_0x1b528e[0xb];var _0x4c943a=_0x1b528e[0xc];var _0x11a24a=_0x1b528e[0xd];var _0x1adfb9=_0x1b528e[0xe];var _0x212d38=_0x1b528e[0xf][_0x84a6('0x4')](/\n/g,_0x84a6('0x5'));var _0x169047=_0x1b528e[0x10][_0x84a6('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x615bf5)){arr[_0x84a6('0x6')](_0x615bf5);var _0x2d0ab6=_0x1b528e[0x3];var _0x233217=_0x1b528e[0x4];var _0x3c9c4d=_0x1b528e[0x1];var _0xb6b21f=_0x1b528e[0x0];var _0x19531b={};_0x19531b[_0x84a6('0x7')]=_0x1b528e[0x8]+'?params='+_0x4c943a+'|'+_0xd1278a+'|'+_0x11a24a+'|'+_0x615bf5+'|'+_0x1adfb9;_0x19531b[_0x84a6('0x8')]=_0x1b528e[0x7]+_0x84a6('0x9')+_0x4c943a+'|'+_0xd1278a+'|'+_0x11a24a+'|'+_0x615bf5+'|'+_0x1adfb9+'|'+_0x212d38+'|'+_0x169047;_0x19531b[_0x84a6('0xa')]=_0x1b528e[0x9];var _0x5b4838={};_0x5b4838['jsonrpc']=_0x84a6('0xb');_0x5b4838['method']=_0x84a6('0xc');var _0x174768=[];_0x174768[_0x84a6('0x6')](_0x1b528e[0x2]);_0x174768['push'](_0x1b528e[0x5]);_0x174768['push'](_0x1b528e[0x6]);_0x5b4838[_0x84a6('0xd')]=_0x174768;_0x5b4838['id']=0x1;var _0x3468e6=JSON[_0x84a6('0xe')](_0x5b4838);var _0x3f9dec={'encoding':_0x84a6('0xf'),'method':_0x84a6('0x10'),'timeout':0x2710,'url':_0x2d0ab6,'headers':{'Content-Type':_0x84a6('0x11')},'body':_0x3468e6};return rp(_0x3f9dec)[_0x84a6('0x12')](function(_0x2a4f73){const _0x22a964=JSON[_0x84a6('0x13')](_0x2a4f73);if(!_0x22a964[_0x84a6('0x14')]['logged']){throw new Error(_0x84a6('0x15'));}var _0x2f54df=_0x615bf5;var _0x22441c='channelId='+_0x3c9c4d+'&serviceId='+_0xb6b21f+_0x84a6('0x16')+_0x2f54df+_0x84a6('0x17')+JSON[_0x84a6('0xe')](_0x19531b);var _0x2f25c9=_0x233217+'?'+_0x22441c;return rp(_0x2f25c9);})[_0x84a6('0x12')](function(_0x451f8e){logger[_0x84a6('0x18')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x5300b6,_0x451f8e);_0x206fd3[_0x84a6('0x19')]();})[_0x84a6('0x1a')](function(_0x44aa23){logger[_0x84a6('0x1b')]('[%s][TVOX]\x20%s',_0x5300b6,_['isObject'](_0x44aa23)?JSON[_0x84a6('0xe')](_0x44aa23):_0x44aa23);_0x206fd3[_0x84a6('0x19')]();});}else{logger['info'](_0x84a6('0x1c'),_0x5300b6);_0x206fd3[_0x84a6('0x1d')]();}};}; \ No newline at end of file +var _0xfcc3=['utf8','application/json-rpc','then','parse','result','logged','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','isObject','info','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','2.0','method','login','stringify'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0xfcc3,0xf7));var _0x3fcc=function(_0x13a410,_0x446eae){_0x13a410=_0x13a410-0x0;var _0x181bd9=_0xfcc3[_0x13a410];return _0x181bd9;};'use strict';var rp=require(_0x3fcc('0x0'));var logger=require(_0x3fcc('0x1'))(_0x3fcc('0x2'));var _=require(_0x3fcc('0x3'));var arr=[];exports[_0x3fcc('0x4')]=function(_0x137f6b,_0x201059){return function(_0x2d1675){var _0x2fd81a=_0x201059[0xa];var _0x1b30ed=_0x201059[0xb];var _0x8e151d=_0x201059[0xc];var _0x5f01bf=_0x201059[0xd];var _0x2f733e=_0x201059[0xe];var _0x5f4cf9=_0x201059[0xf][_0x3fcc('0x5')](/\n/g,_0x3fcc('0x6'));var _0x42a2c7=_0x201059[0x10][_0x3fcc('0x5')](/\n/g,'\x20');if(!arr[_0x3fcc('0x7')](_0x1b30ed)){arr[_0x3fcc('0x8')](_0x1b30ed);var _0x5c08c8=_0x201059[0x3];var _0x592b09=_0x201059[0x4];var _0x5f4f16=_0x201059[0x1];var _0x518a93=_0x201059[0x0];var _0x233c6f={};_0x233c6f[_0x3fcc('0x9')]=_0x201059[0x8]+_0x3fcc('0xa')+_0x8e151d+'|'+_0x2fd81a+'|'+_0x5f01bf+'|'+_0x1b30ed+'|'+_0x2f733e;_0x233c6f[_0x3fcc('0xb')]=_0x201059[0x7]+'?params='+_0x8e151d+'|'+_0x2fd81a+'|'+_0x5f01bf+'|'+_0x1b30ed+'|'+_0x2f733e+'|'+_0x5f4cf9+'|'+_0x42a2c7;_0x233c6f[_0x3fcc('0xc')]=_0x201059[0x9];var _0x525ace={};_0x525ace['jsonrpc']=_0x3fcc('0xd');_0x525ace[_0x3fcc('0xe')]=_0x3fcc('0xf');var _0x453404=[];_0x453404['push'](_0x201059[0x2]);_0x453404[_0x3fcc('0x8')](_0x201059[0x5]);_0x453404['push'](_0x201059[0x6]);_0x525ace['params']=_0x453404;_0x525ace['id']=0x1;var _0x1ad817=JSON[_0x3fcc('0x10')](_0x525ace);var _0x5d86db={'encoding':_0x3fcc('0x11'),'method':'POST','timeout':0x2710,'url':_0x5c08c8,'headers':{'Content-Type':_0x3fcc('0x12')},'body':_0x1ad817};return rp(_0x5d86db)[_0x3fcc('0x13')](function(_0x136e15){const _0x3d3157=JSON[_0x3fcc('0x14')](_0x136e15);if(!_0x3d3157[_0x3fcc('0x15')][_0x3fcc('0x16')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x122421=_0x1b30ed;var _0x85f82b=_0x3fcc('0x17')+_0x5f4f16+_0x3fcc('0x18')+_0x518a93+_0x3fcc('0x19')+_0x122421+_0x3fcc('0x1a')+JSON[_0x3fcc('0x10')](_0x233c6f);var _0xbbf6cc=_0x592b09+'?'+_0x85f82b;return rp(_0xbbf6cc);})['then'](function(_0x2dbd8d){logger['info'](_0x3fcc('0x1b'),_0x137f6b,_0x2dbd8d);_0x2d1675[_0x3fcc('0x1c')]();})['catch'](function(_0x5e9507){logger[_0x3fcc('0x1d')](_0x3fcc('0x1e'),_0x137f6b,_[_0x3fcc('0x1f')](_0x5e9507)?JSON[_0x3fcc('0x10')](_0x5e9507):_0x5e9507);_0x2d1675['stop']();});}else{logger[_0x3fcc('0x20')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x137f6b);_0x2d1675['next']();}};}; \ 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 41a1424..0828e17 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x2603a7,_0x487e7e){var _0x43ecca=function(_0x2c082c){while(--_0x2c082c){_0x2603a7['push'](_0x2603a7['shift']());}};_0x43ecca(++_0x487e7e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x75e394,_0x155d10){var _0x21f86e=function(_0x4d83fb){while(--_0x4d83fb){_0x75e394['push'](_0x75e394['shift']());}};_0x21f86e(++_0x155d10);}(_0xe706,0xa3));var _0x6e70=function(_0x402b7e,_0x35fdf7){_0x402b7e=_0x402b7e-0x0;var _0x55f359=_0xe706[_0x402b7e];return _0x55f359;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 65dba43..7d1b71c 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 _0x7896=['routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','transfer','applications','isArray','length','existsSync','join','app','.js','appdata','split','mail','push','slice','dialogflowv2','tag','getMustacheRender','account','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','complete','Skipped\x20routing\x20for\x20%s','error','routing\x20is\x20empty','agent','agents','busy','emit','end','update','UserId','error\x20update\x20queue\x20report','stack','busyQueue','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger'];(function(_0x1ac41c,_0x1dacbf){var _0x561d64=function(_0x2654df){while(--_0x2654df){_0x1ac41c['push'](_0x1ac41c['shift']());}};_0x561d64(++_0x1dacbf);}(_0x7896,0x127));var _0x6789=function(_0x14a62c,_0x5c77e1){_0x14a62c=_0x14a62c-0x0;var _0x5bab14=_0x7896[_0x14a62c];return _0x5bab14;};'use strict';var _=require(_0x6789('0x0'));var util=require(_0x6789('0x1'));var path=require(_0x6789('0x2'));var fs=require('fs');var jayson=require(_0x6789('0x3'));var BPromise=require(_0x6789('0x4'));var utils=require(_0x6789('0x5'));var sUtils=require(_0x6789('0x6'));var logger=require(_0x6789('0x7'))(_0x6789('0x8'));var rpc={'openchannelQueueReport':require(_0x6789('0x9')),'mailQueueReport':require(_0x6789('0xa')),'chatQueueReport':require(_0x6789('0xb')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x6789('0xc')),'whatsappQueueReport':require(_0x6789('0xd'))};var RuleEngine=require(_0x6789('0xe'));function getId(_0x4e3d8c,_0x19723d,_0x59ef90){return util[_0x6789('0xf')](_0x6789('0x10'),_0x4e3d8c,_0x19723d||0x0,_0x59ef90||0x0);}function getIntervals(_0x4d648e,_0x21864f){var _0x54aca8=[];if(!_[_0x6789('0x11')](_0x21864f['IntervalId'])&&!_[_0x6789('0x11')](_0x4d648e[_0x21864f['IntervalId']])&&!_[_0x6789('0x11')](_0x4d648e[_0x21864f[_0x6789('0x12')]][_0x6789('0x13')])){_0x54aca8=_[_0x6789('0x14')](_0x4d648e[_0x21864f[_0x6789('0x12')]][_0x6789('0x13')],_0x6789('0x15'));}else if(!_[_0x6789('0x11')](_0x21864f[_0x6789('0x15')])){_0x54aca8=[_0x21864f[_0x6789('0x15')]];}return _0x54aca8;}exports['listen']=function(_0x4343d2){_0x4343d2[_0x6789('0x16')]={};return new BPromise(function(_0x289e64,_0x3481ba){var _0x339798={'Start':function(_0x28cc02){var _0x53b1e7=this;return new Promise(function(_0x4da8a6,_0x35a190){if(_0x28cc02){try{var _0x19ae62=[];var _0x21e4f9=getId(_0x28cc02[_0x6789('0x17')],_0x28cc02[_0x6789('0x18')]?_0x28cc02[_0x6789('0x18')]['id']:0x0,_0x28cc02[_0x6789('0x19')]?_0x28cc02['interaction']['id']:0x0);var _0xef13e7=sUtils['checkWaitingNotifications'](_0x4343d2,_0x28cc02);if(_0x28cc02[_0x6789('0x1a')]||!_0xef13e7&&_0x28cc02[_0x6789('0x1b')]&&_[_0x6789('0x1c')](_0x28cc02[_0x6789('0x1b')])&&_0x28cc02[_0x6789('0x1b')]['length']){for(var _0x13a341=0x0;_0x13a341<_0x28cc02['applications'][_0x6789('0x1d')];_0x13a341+=0x1){var _0x41de66=_0x28cc02[_0x6789('0x1b')][_0x13a341];if(fs[_0x6789('0x1e')](path[_0x6789('0x1f')](__dirname,_0x6789('0x1b'),_0x41de66[_0x6789('0x20')]+_0x6789('0x21')))){var _0x592758=[];switch(_0x41de66[_0x6789('0x20')]['toLowerCase']()){case'autoreply':var _0x6b17f=_0x41de66[_0x6789('0x22')][_0x6789('0x23')](',');if(_0x28cc02[_0x6789('0x17')]===_0x6789('0x24')){_0x592758[_0x6789('0x25')](_0x6b17f[0x0]);_0x592758[_0x6789('0x25')](_0x6b17f[0x1]);_0x592758[_0x6789('0x25')](_0x6b17f['slice'](0x2,_0x6b17f[_0x6789('0x1d')])[_0x6789('0x1f')](','));}else{_0x592758[_0x6789('0x25')](_0x6b17f[0x0]);_0x592758[_0x6789('0x25')](_0x6b17f[_0x6789('0x26')](0x1,_0x6b17f[_0x6789('0x1d')])[_0x6789('0x1f')](','));}break;case'dialogflow':var _0x4389a2=_0x41de66[_0x6789('0x22')]['split'](',');_0x592758[_0x6789('0x25')](_0x4389a2[0x0]);_0x592758[_0x6789('0x25')](_0x4389a2[0x1]);_0x592758[_0x6789('0x25')](_0x4389a2['slice'](0x2,_0x4389a2[_0x6789('0x1d')])[_0x6789('0x1f')](','));break;case _0x6789('0x27'):var _0xc63bbd=_0x41de66[_0x6789('0x22')][_0x6789('0x23')](',');_0x592758[_0x6789('0x25')](_0xc63bbd[0x0]);_0x592758[_0x6789('0x25')](_0xc63bbd[0x1]);_0x592758[_0x6789('0x25')](_0xc63bbd[0x2]);_0x592758[_0x6789('0x25')](_0xc63bbd[0x3]);_0x592758[_0x6789('0x25')](_0xc63bbd[_0x6789('0x26')](0x4,_0xc63bbd[_0x6789('0x1d')])[_0x6789('0x1f')](','));break;case'amazonlex':var _0x1439f1=_0x41de66[_0x6789('0x22')][_0x6789('0x23')](',');_0x592758[_0x6789('0x25')](_0x1439f1[0x0]);_0x592758[_0x6789('0x25')](_0x1439f1[0x1]);_0x592758[_0x6789('0x25')](_0x1439f1[0x2]);_0x592758['push'](_0x1439f1[0x3]);_0x592758[_0x6789('0x25')](_0x1439f1[_0x6789('0x26')](0x4,_0x1439f1['length'])[_0x6789('0x1f')](','));break;case _0x6789('0x18'):_0x592758[_0x6789('0x25')](_0x41de66[_0x6789('0x22')]);break;case _0x6789('0x28'):_0x592758['push'](_0x41de66['TagId']);_0x592758[_0x6789('0x25')](_0x41de66['appdata']);break;case'tvox':var _0x31541e=utils[_0x6789('0x29')](_0x28cc02[_0x6789('0x2a')]['notificationTemplate'],_0x28cc02);var _0x190fc1=_0x41de66[_0x6789('0x22')][_0x6789('0x23')](',');_0x592758[_0x6789('0x25')](_0x190fc1[0x0]);_0x592758[_0x6789('0x25')](_0x190fc1[0x1]);_0x592758[_0x6789('0x25')](_0x190fc1[0x2]);_0x592758['push'](_0x190fc1[0x3]);_0x592758[_0x6789('0x25')](_0x190fc1[0x4]);_0x592758['push'](_0x190fc1[0x5]);_0x592758[_0x6789('0x25')](_0x190fc1[0x6]);_0x592758[_0x6789('0x25')](_0x190fc1[0x7]);_0x592758['push'](_0x190fc1[0x8]);_0x592758[_0x6789('0x25')](_0x190fc1[0x9]);_0x592758['push'](_0x190fc1[0xa]);_0x592758[_0x6789('0x25')](_0x28cc02['interaction']['id']);_0x592758[_0x6789('0x25')](_0x28cc02[_0x6789('0x18')]['id']);_0x592758[_0x6789('0x25')](_0x41de66[_0x6789('0x2b')]);_0x592758['push'](_0x28cc02[_0x6789('0x19')]['ContactId']);_0x592758[_0x6789('0x25')](_0x28cc02[_0x6789('0x2c')][_0x6789('0x2c')]);_0x592758['push'](_0x31541e);break;default:_0x592758=_[_0x6789('0x11')](_0x41de66[_0x6789('0x22')])?[]:_0x41de66[_0x6789('0x22')]['split'](',');}var _0x254cbd={'id':util['format'](_0x6789('0x2d'),_0x21e4f9,_0x41de66['id'],_0x41de66[_0x6789('0x20')]),'condition':require(_0x6789('0x2e'))[_0x6789('0x2f')](_0x21e4f9,getIntervals(_0x4343d2[_0x6789('0x30')],_0x41de66),_0x4343d2),'consequence':require(_0x6789('0x31')+_0x41de66[_0x6789('0x20')])[_0x6789('0x32')](_0x21e4f9,_0x592758,_0x4343d2,_0x28cc02),'p':_0x41de66[_0x6789('0x33')]||0x0};logger[_0x6789('0x34')](_0x6789('0x35'),_0x254cbd['id'],_0x6789('0x36'),getIntervals(_0x4343d2[_0x6789('0x30')],_0x41de66)[_0x6789('0x1f')](_0x6789('0x37')));_0x19ae62[_0x6789('0x25')](_0x254cbd);}else{logger['error'](_0x6789('0x38'),path[_0x6789('0x1f')](__dirname,'applications',_0x41de66[_0x6789('0x20')]+'.js'));}}_0x4343d2['rules'][_0x21e4f9]=new RuleEngine(_0x19ae62);_0x4343d2[_0x6789('0x16')][_0x21e4f9]['execute'](_0x28cc02,function(_0x244b04){logger['info'](_0x6789('0x39'),JSON[_0x6789('0x3a')](_0x244b04['matchPath']));if(_0x4343d2[_0x6789('0x16')][_0x21e4f9]){_0x4343d2['rules'][_0x21e4f9]['emit'](_0x6789('0x3b'));}});return _0x4da8a6({'code':0xc8,'message':_0x28cc02});}else{if(_0xef13e7){logger[_0x6789('0x34')](util[_0x6789('0xf')](_0x6789('0x3c'),_0x21e4f9));}else{logger['info']('No\x20applications\x20to\x20execute');}return _0x4da8a6({'code':0xc8,'message':_0x28cc02});}}catch(_0x2b6127){logger[_0x6789('0x3d')](_0x2b6127['stack']);return _0x35a190(_0x53b1e7['error'](0x1f4,_0x2b6127));}}return _0x35a190(_0x6789('0x3e'));});},'AcceptMessage':function(_0x90b80f){var _0x20eb14=this;return new Promise(function(_0x52ec58,_0x2911bc){if(_0x90b80f[_0x6789('0x3f')]&&_0x90b80f[_0x6789('0x3f')]['id']){if(_0x4343d2['agents'][_0x90b80f[_0x6789('0x3f')]['id']]){_0x4343d2[_0x6789('0x40')][_0x90b80f[_0x6789('0x3f')]['id']][_0x6789('0x41')]=![];_0x4343d2[_0x6789('0x40')][_0x90b80f[_0x6789('0x3f')]['id']]['busyQueue']=undefined;}}if(_0x90b80f['message']&&_0x90b80f[_0x6789('0x18')]['id']){try{var _0x5ca054=getId(_0x90b80f[_0x6789('0x17')],_0x90b80f['message']?_0x90b80f[_0x6789('0x18')]['id']:0x0,_0x90b80f[_0x6789('0x19')]?_0x90b80f[_0x6789('0x19')]['id']:0x0);if(_0x4343d2[_0x6789('0x16')][_0x5ca054]){_0x4343d2[_0x6789('0x16')][_0x5ca054][_0x6789('0x42')](_0x6789('0x43'));if(rpc[_0x90b80f[_0x6789('0x17')]+'QueueReport']){rpc[_0x90b80f[_0x6789('0x17')]+'QueueReport'][_0x6789('0x44')](_0x5ca054,{'UserId':_0x90b80f[_0x6789('0x18')][_0x6789('0x45')]})['catch'](function(){logger[_0x6789('0x3d')](_0x6789('0x46'));});}}return _0x52ec58({'code':0xc8,'message':_0x90b80f});}catch(_0x2b2199){logger['error'](_0x2b2199[_0x6789('0x47')]);return _0x2911bc(_0x20eb14[_0x6789('0x3d')](0x1f4,_0x2b2199));}}logger[_0x6789('0x3d')]('message\x20is\x20empty');return _0x2911bc(_0x20eb14['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x1a0990){var _0x4d5f28=this;return new Promise(function(_0x456f2d,_0x78e799){if(_0x1a0990[_0x6789('0x3f')]&&_0x1a0990[_0x6789('0x3f')]['id']){try{if(_0x4343d2[_0x6789('0x40')][_0x1a0990[_0x6789('0x3f')]['id']]){_0x4343d2[_0x6789('0x40')][_0x1a0990['agent']['id']][_0x6789('0x41')]=![];_0x4343d2[_0x6789('0x40')][_0x1a0990[_0x6789('0x3f')]['id']][_0x6789('0x48')]=undefined;}return _0x456f2d({'code':0xc8,'message':_0x1a0990});}catch(_0x6cdec7){logger[_0x6789('0x3d')](_0x6cdec7[_0x6789('0x47')]);return _0x78e799(_0x4d5f28[_0x6789('0x3d')](0x1f4,_0x6cdec7));}}logger['error'](_0x6789('0x49'));return _0x78e799(_0x4d5f28[_0x6789('0x3d')](0x1f4,_0x6789('0x49')));});},'AbandonInteraction':function(_0x1e0ddc){var _0x3988aa=this;return new Promise(function(_0x2431e7,_0x4e1d05){if(_0x1e0ddc['channel']&&_0x1e0ddc['interaction']&&_0x1e0ddc[_0x6789('0x19')]['id']){try{var _0x5cb0d1=getId(_0x1e0ddc[_0x6789('0x17')],_0x1e0ddc[_0x6789('0x18')]?_0x1e0ddc['message']['id']:0x0,_0x1e0ddc[_0x6789('0x19')]?_0x1e0ddc[_0x6789('0x19')]['id']:0x0);if(_0x4343d2[_0x6789('0x16')][_0x5cb0d1]){_0x4343d2['rules'][_0x5cb0d1][_0x6789('0x42')](_0x6789('0x43'));}return _0x2431e7({'code':0xc8,'message':_0x1e0ddc});}catch(_0x50b870){logger[_0x6789('0x3d')](_0x50b870[_0x6789('0x47')]);return _0x4e1d05(_0x3988aa[_0x6789('0x3d')](0x1f4,_0x50b870));}}logger[_0x6789('0x3d')](_0x6789('0x49'));return _0x4e1d05(_0x3988aa[_0x6789('0x3d')](0x1f4,_0x6789('0x49')));});},'AgentCapacity':function(_0x232f88){var _0x5aff16=this;return new Promise(function(_0x1f3d1c,_0x22de63){if(_0x4343d2[_0x6789('0x40')]['hasOwnProperty'](_0x232f88['id'])){for(var _0x3cc11b in _0x232f88['capacity']){if(_0x232f88['capacity']['hasOwnProperty'](_0x3cc11b)){if(_0x4343d2[_0x6789('0x40')][_0x232f88['id']][_0x6789('0x4a')](_0x3cc11b+_0x6789('0x4b'))){_0x4343d2[_0x6789('0x40')][_0x232f88['id']][_0x3cc11b+'CurrentCapacity']=parseInt(_0x232f88[_0x6789('0x4c')][_0x3cc11b],0xa);}}}_0x4343d2[_0x6789('0x40')][_0x232f88['id']][_0x6789('0x4d')]();return _0x1f3d1c({'code':0xc8,'message':_0x4343d2['agents'][_0x232f88['id']]});}else{return _0x22de63(_0x5aff16[_0x6789('0x3d')](0x1f4,_0x6789('0x4e')));}});},'Agents':function(_0x4d65e5){return new Promise(function(_0x258472){var _0x37f20f=_['values'](_0x4343d2[_0x6789('0x40')]);if(_0x4d65e5&&_0x4d65e5['id']){var _0x34d9c5=_[_0x6789('0x4f')](_0x37f20f,function(_0xecf405){return _0xecf405['id']===_0x4d65e5['id'];});_0x258472(_0x34d9c5);}else{_0x258472({'count':_0x37f20f[_0x6789('0x1d')],'rows':_0x37f20f});}});},'ChatQueues':function(){return new Promise(function(_0x542f22){var _0x174e17=[];for(var _0x2da1a6 in _0x4343d2[_0x6789('0x50')]){if(_0x4343d2[_0x6789('0x50')][_0x6789('0x4a')](_0x2da1a6)){var _0x4acef1=_0x4343d2['chatQueues'][_0x2da1a6];var _0x373532={'id':_0x4acef1['id'],'available':_0x4acef1[_0x6789('0x51')],'loggedIn':_0x4acef1[_0x6789('0x52')],'name':_0x4acef1[_0x6789('0x53')],'paused':_0x4acef1[_0x6789('0x54')],'waiting':_0x4acef1[_0x6789('0x55')]};_0x174e17['push'](_0x373532);}}_0x542f22({'count':_0x174e17['length'],'rows':_0x174e17});});},'MailQueues':function(){return new Promise(function(_0x25dc0f){var _0x1c8e75=[];for(var _0x49d2c5 in _0x4343d2['mailQueues']){if(_0x4343d2[_0x6789('0x56')][_0x6789('0x4a')](_0x49d2c5)){var _0x1a2175=_0x4343d2['mailQueues'][_0x49d2c5];var _0x51a700={'id':_0x1a2175['id'],'available':_0x1a2175['available'],'loggedIn':_0x1a2175['loggedIn'],'name':_0x1a2175[_0x6789('0x53')],'paused':_0x1a2175[_0x6789('0x54')],'waiting':_0x1a2175['waiting']};_0x1c8e75['push'](_0x51a700);}}_0x25dc0f({'count':_0x1c8e75[_0x6789('0x1d')],'rows':_0x1c8e75});});},'OpenchannelQueues':function(){return new Promise(function(_0x4c5234){var _0x33d809=[];for(var _0x54aa6f in _0x4343d2[_0x6789('0x57')]){if(_0x4343d2['openchannelQueues'][_0x6789('0x4a')](_0x54aa6f)){var _0x2f42af=_0x4343d2[_0x6789('0x57')][_0x54aa6f];var _0x13625a={'id':_0x2f42af['id'],'available':_0x2f42af[_0x6789('0x51')],'loggedIn':_0x2f42af['loggedIn'],'name':_0x2f42af[_0x6789('0x53')],'paused':_0x2f42af['paused'],'waiting':_0x2f42af['waiting']};_0x33d809[_0x6789('0x25')](_0x13625a);}}_0x4c5234({'count':_0x33d809[_0x6789('0x1d')],'rows':_0x33d809});});},'SmsQueues':function(){return new Promise(function(_0x33dd13){var _0x4112ce=[];for(var _0x4cb947 in _0x4343d2[_0x6789('0x58')]){if(_0x4343d2[_0x6789('0x58')][_0x6789('0x4a')](_0x4cb947)){var _0x201411=_0x4343d2['smsQueues'][_0x4cb947];var _0x5b6f30={'id':_0x201411['id'],'available':_0x201411[_0x6789('0x51')],'loggedIn':_0x201411['loggedIn'],'name':_0x201411[_0x6789('0x53')],'paused':_0x201411[_0x6789('0x54')],'waiting':_0x201411[_0x6789('0x55')]};_0x4112ce[_0x6789('0x25')](_0x5b6f30);}}_0x33dd13({'count':_0x4112ce[_0x6789('0x1d')],'rows':_0x4112ce});});},'FaxQueues':function(){return new Promise(function(_0x3a48c8){var _0x1e71e8=[];for(var _0x4b1076 in _0x4343d2[_0x6789('0x59')]){if(_0x4343d2[_0x6789('0x59')]['hasOwnProperty'](_0x4b1076)){var _0x22656d=_0x4343d2[_0x6789('0x59')][_0x4b1076];var _0x44a725={'id':_0x22656d['id'],'available':_0x22656d[_0x6789('0x51')],'loggedIn':_0x22656d[_0x6789('0x52')],'name':_0x22656d[_0x6789('0x53')],'paused':_0x22656d[_0x6789('0x54')],'waiting':_0x22656d[_0x6789('0x55')]};_0x1e71e8[_0x6789('0x25')](_0x44a725);}}_0x3a48c8({'count':_0x1e71e8['length'],'rows':_0x1e71e8});});},'WhatsappQueues':function(){return new Promise(function(_0x191265){var _0x28960d=[];for(var _0x41b4a2 in _0x4343d2[_0x6789('0x5a')]){if(_0x4343d2['whatsappQueues'][_0x6789('0x4a')](_0x41b4a2)){var _0x229186=_0x4343d2[_0x6789('0x5a')][_0x41b4a2];var _0x1061bc={'id':_0x229186['id'],'available':_0x229186[_0x6789('0x51')],'loggedIn':_0x229186['loggedIn'],'name':_0x229186['name'],'paused':_0x229186['paused'],'waiting':_0x229186[_0x6789('0x55')]};_0x28960d['push'](_0x1061bc);}}_0x191265({'count':_0x28960d[_0x6789('0x1d')],'rows':_0x28960d});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x141a2d){var _0x2e9755=_[_0x6789('0x5b')](_0x4343d2[_0x6789('0x5c')]);_0x141a2d({'count':_0x2e9755[_0x6789('0x1d')],'rows':_0x2e9755});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x14a242){var _0x446efb=_[_0x6789('0x5b')](_0x4343d2[_0x6789('0x5d')]);_0x14a242({'count':_0x446efb[_0x6789('0x1d')],'rows':_0x446efb});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xcdf72){var _0x5b0181=_[_0x6789('0x5b')](_0x4343d2['openchannelQueuesWaitingInteractions']);_0xcdf72({'count':_0x5b0181[_0x6789('0x1d')],'rows':_0x5b0181});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x395eff){var _0x4b91ce=_[_0x6789('0x5b')](_0x4343d2[_0x6789('0x5e')]);_0x395eff({'count':_0x4b91ce[_0x6789('0x1d')],'rows':_0x4b91ce});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x2f1e1e){var _0x53bfd3=_[_0x6789('0x5b')](_0x4343d2[_0x6789('0x5f')]);_0x2f1e1e({'count':_0x53bfd3[_0x6789('0x1d')],'rows':_0x53bfd3});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x59ee01){var _0x396ad7=_['values'](_0x4343d2[_0x6789('0x60')]);_0x59ee01({'count':_0x396ad7[_0x6789('0x1d')],'rows':_0x396ad7});});}};var _0x25bebf=jayson[_0x6789('0x61')](_0x339798)['http']();_0x25bebf['on'](_0x6789('0x3d'),function(_0x5da57f){logger[_0x6789('0x3d')](JSON[_0x6789('0x3a')](_0x5da57f));return _0x3481ba(_0x5da57f);});_0x25bebf['listen'](0x232c,_0x6789('0x62'),function(){console['log'](_0x6789('0x63'),0x232c);return _0x289e64(_0x6789('0x64')+0x232c);});});}; \ No newline at end of file +var _0x5204=['capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','.js','app','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','tag','TagId','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','./interval','condition','intervals','./applications/','priority','info','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','agent','agents','busy','busyQueue','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','end'];(function(_0xb49d10,_0x103e8c){var _0x2a8e96=function(_0x11308f){while(--_0x11308f){_0xb49d10['push'](_0xb49d10['shift']());}};_0x2a8e96(++_0x103e8c);}(_0x5204,0xdf));var _0x4520=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0x5204[_0x4aa838];return _0x3abff0;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x4520('0x2'));var BPromise=require(_0x4520('0x3'));var utils=require(_0x4520('0x4'));var sUtils=require(_0x4520('0x5'));var logger=require(_0x4520('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x4520('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x4520('0x8')),'smsQueueReport':require(_0x4520('0x9')),'faxQueueReport':require(_0x4520('0xa')),'whatsappQueueReport':require(_0x4520('0xb'))};var RuleEngine=require(_0x4520('0xc'));function getId(_0x446dc9,_0x27890f,_0x55b44f){return util[_0x4520('0xd')]('%s.%s.%s',_0x446dc9,_0x27890f||0x0,_0x55b44f||0x0);}function getIntervals(_0x168e62,_0x37a617){var _0x1a5324=[];if(!_[_0x4520('0xe')](_0x37a617[_0x4520('0xf')])&&!_[_0x4520('0xe')](_0x168e62[_0x37a617[_0x4520('0xf')]])&&!_[_0x4520('0xe')](_0x168e62[_0x37a617[_0x4520('0xf')]][_0x4520('0x10')])){_0x1a5324=_[_0x4520('0x11')](_0x168e62[_0x37a617[_0x4520('0xf')]][_0x4520('0x10')],_0x4520('0x12'));}else if(!_[_0x4520('0xe')](_0x37a617[_0x4520('0x12')])){_0x1a5324=[_0x37a617[_0x4520('0x12')]];}return _0x1a5324;}exports[_0x4520('0x13')]=function(_0x426836){_0x426836[_0x4520('0x14')]={};return new BPromise(function(_0x32950a,_0x48b3e7){var _0x3e53e5={'Start':function(_0x20de6b){var _0x1ab841=this;return new Promise(function(_0x15a31f,_0x32d8aa){if(_0x20de6b){try{var _0x51d85f=[];var _0x2c1805=getId(_0x20de6b[_0x4520('0x15')],_0x20de6b[_0x4520('0x16')]?_0x20de6b[_0x4520('0x16')]['id']:0x0,_0x20de6b[_0x4520('0x17')]?_0x20de6b[_0x4520('0x17')]['id']:0x0);var _0x1dcf51=sUtils[_0x4520('0x18')](_0x426836,_0x20de6b);if(_0x20de6b[_0x4520('0x19')]||!_0x1dcf51&&_0x20de6b[_0x4520('0x1a')]&&_[_0x4520('0x1b')](_0x20de6b[_0x4520('0x1a')])&&_0x20de6b['applications'][_0x4520('0x1c')]){for(var _0x52ca8c=0x0;_0x52ca8c<_0x20de6b['applications']['length'];_0x52ca8c+=0x1){var _0x2b9456=_0x20de6b['applications'][_0x52ca8c];if(fs[_0x4520('0x1d')](path[_0x4520('0x1e')](__dirname,_0x4520('0x1a'),_0x2b9456['app']+_0x4520('0x1f')))){var _0x4000d4=[];switch(_0x2b9456[_0x4520('0x20')]['toLowerCase']()){case _0x4520('0x21'):var _0x847d15=_0x2b9456[_0x4520('0x22')][_0x4520('0x23')](',');if(_0x20de6b[_0x4520('0x15')]==='mail'){_0x4000d4[_0x4520('0x24')](_0x847d15[0x0]);_0x4000d4[_0x4520('0x24')](_0x847d15[0x1]);_0x4000d4[_0x4520('0x24')](_0x847d15[_0x4520('0x25')](0x2,_0x847d15['length'])[_0x4520('0x1e')](','));}else{_0x4000d4[_0x4520('0x24')](_0x847d15[0x0]);_0x4000d4[_0x4520('0x24')](_0x847d15[_0x4520('0x25')](0x1,_0x847d15[_0x4520('0x1c')])[_0x4520('0x1e')](','));}break;case _0x4520('0x26'):var _0x195c58=_0x2b9456[_0x4520('0x22')][_0x4520('0x23')](',');_0x4000d4['push'](_0x195c58[0x0]);_0x4000d4[_0x4520('0x24')](_0x195c58[0x1]);_0x4000d4['push'](_0x195c58[_0x4520('0x25')](0x2,_0x195c58[_0x4520('0x1c')])[_0x4520('0x1e')](','));break;case _0x4520('0x27'):var _0x1da740=_0x2b9456[_0x4520('0x22')]['split'](',');_0x4000d4[_0x4520('0x24')](_0x1da740[0x0]);_0x4000d4['push'](_0x1da740[0x1]);_0x4000d4[_0x4520('0x24')](_0x1da740[0x2]);_0x4000d4['push'](_0x1da740[0x3]);_0x4000d4[_0x4520('0x24')](_0x1da740['slice'](0x4,_0x1da740[_0x4520('0x1c')])['join'](','));break;case'amazonlex':var _0x18d6e9=_0x2b9456[_0x4520('0x22')][_0x4520('0x23')](',');_0x4000d4['push'](_0x18d6e9[0x0]);_0x4000d4[_0x4520('0x24')](_0x18d6e9[0x1]);_0x4000d4[_0x4520('0x24')](_0x18d6e9[0x2]);_0x4000d4[_0x4520('0x24')](_0x18d6e9[0x3]);_0x4000d4[_0x4520('0x24')](_0x18d6e9['slice'](0x4,_0x18d6e9['length'])[_0x4520('0x1e')](','));break;case _0x4520('0x16'):_0x4000d4['push'](_0x2b9456[_0x4520('0x22')]);break;case _0x4520('0x28'):_0x4000d4[_0x4520('0x24')](_0x2b9456[_0x4520('0x29')]);_0x4000d4[_0x4520('0x24')](_0x2b9456[_0x4520('0x22')]);break;case'tvox':var _0x21e895=utils[_0x4520('0x2a')](_0x20de6b['account'][_0x4520('0x2b')],_0x20de6b);var _0x5ee87d=_0x2b9456[_0x4520('0x22')][_0x4520('0x23')](',');_0x4000d4['push'](_0x5ee87d[0x0]);_0x4000d4['push'](_0x5ee87d[0x1]);_0x4000d4['push'](_0x5ee87d[0x2]);_0x4000d4[_0x4520('0x24')](_0x5ee87d[0x3]);_0x4000d4[_0x4520('0x24')](_0x5ee87d[0x4]);_0x4000d4[_0x4520('0x24')](_0x5ee87d[0x5]);_0x4000d4[_0x4520('0x24')](_0x5ee87d[0x6]);_0x4000d4[_0x4520('0x24')](_0x5ee87d[0x7]);_0x4000d4[_0x4520('0x24')](_0x5ee87d[0x8]);_0x4000d4[_0x4520('0x24')](_0x5ee87d[0x9]);_0x4000d4['push'](_0x5ee87d[0xa]);_0x4000d4[_0x4520('0x24')](_0x20de6b[_0x4520('0x17')]['id']);_0x4000d4[_0x4520('0x24')](_0x20de6b['message']['id']);_0x4000d4[_0x4520('0x24')](_0x2b9456[_0x4520('0x2c')]);_0x4000d4['push'](_0x20de6b['interaction'][_0x4520('0x2d')]);_0x4000d4[_0x4520('0x24')](_0x20de6b[_0x4520('0x2e')][_0x4520('0x2e')]);_0x4000d4[_0x4520('0x24')](_0x21e895);break;default:_0x4000d4=_['isNil'](_0x2b9456['appdata'])?[]:_0x2b9456['appdata'][_0x4520('0x23')](',');}var _0x516993={'id':util[_0x4520('0xd')]('%s:%s:%s',_0x2c1805,_0x2b9456['id'],_0x2b9456['app']),'condition':require(_0x4520('0x2f'))[_0x4520('0x30')](_0x2c1805,getIntervals(_0x426836[_0x4520('0x31')],_0x2b9456),_0x426836),'consequence':require(_0x4520('0x32')+_0x2b9456[_0x4520('0x20')])['consequence'](_0x2c1805,_0x4000d4,_0x426836,_0x20de6b),'p':_0x2b9456[_0x4520('0x33')]||0x0};logger[_0x4520('0x34')]('Push\x20new\x20rule',_0x516993['id'],'on\x20interval',getIntervals(_0x426836[_0x4520('0x31')],_0x2b9456)[_0x4520('0x1e')]('\x20|\x20'));_0x51d85f[_0x4520('0x24')](_0x516993);}else{logger[_0x4520('0x35')](_0x4520('0x36'),path[_0x4520('0x1e')](__dirname,'applications',_0x2b9456[_0x4520('0x20')]+_0x4520('0x1f')));}}_0x426836[_0x4520('0x14')][_0x2c1805]=new RuleEngine(_0x51d85f);_0x426836[_0x4520('0x14')][_0x2c1805][_0x4520('0x37')](_0x20de6b,function(_0x16630c){logger[_0x4520('0x34')](_0x4520('0x38'),JSON[_0x4520('0x39')](_0x16630c[_0x4520('0x3a')]));if(_0x426836[_0x4520('0x14')][_0x2c1805]){_0x426836[_0x4520('0x14')][_0x2c1805][_0x4520('0x3b')](_0x4520('0x3c'));}});return _0x15a31f({'code':0xc8,'message':_0x20de6b});}else{if(_0x1dcf51){logger[_0x4520('0x34')](util[_0x4520('0xd')](_0x4520('0x3d'),_0x2c1805));}else{logger['info'](_0x4520('0x3e'));}return _0x15a31f({'code':0xc8,'message':_0x20de6b});}}catch(_0x15d57e){logger['error'](_0x15d57e['stack']);return _0x32d8aa(_0x1ab841['error'](0x1f4,_0x15d57e));}}return _0x32d8aa('routing\x20is\x20empty');});},'AcceptMessage':function(_0x22e62d){var _0x5b96f8=this;return new Promise(function(_0x2f16f4,_0x23c421){if(_0x22e62d[_0x4520('0x3f')]&&_0x22e62d[_0x4520('0x3f')]['id']){if(_0x426836[_0x4520('0x40')][_0x22e62d[_0x4520('0x3f')]['id']]){_0x426836[_0x4520('0x40')][_0x22e62d[_0x4520('0x3f')]['id']][_0x4520('0x41')]=![];_0x426836[_0x4520('0x40')][_0x22e62d[_0x4520('0x3f')]['id']][_0x4520('0x42')]=undefined;}}if(_0x22e62d[_0x4520('0x16')]&&_0x22e62d[_0x4520('0x16')]['id']){try{var _0x17e353=getId(_0x22e62d[_0x4520('0x15')],_0x22e62d[_0x4520('0x16')]?_0x22e62d[_0x4520('0x16')]['id']:0x0,_0x22e62d['interaction']?_0x22e62d['interaction']['id']:0x0);if(_0x426836[_0x4520('0x14')][_0x17e353]){_0x426836[_0x4520('0x14')][_0x17e353][_0x4520('0x3b')]('end');if(rpc[_0x22e62d[_0x4520('0x15')]+_0x4520('0x43')]){rpc[_0x22e62d[_0x4520('0x15')]+'QueueReport'][_0x4520('0x44')](_0x17e353,{'UserId':_0x22e62d[_0x4520('0x16')][_0x4520('0x45')]})['catch'](function(){logger['error'](_0x4520('0x46'));});}}return _0x2f16f4({'code':0xc8,'message':_0x22e62d});}catch(_0x24a6a4){logger[_0x4520('0x35')](_0x24a6a4[_0x4520('0x47')]);return _0x23c421(_0x5b96f8[_0x4520('0x35')](0x1f4,_0x24a6a4));}}logger[_0x4520('0x35')](_0x4520('0x48'));return _0x23c421(_0x5b96f8[_0x4520('0x35')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x38a28d){var _0x293b46=this;return new Promise(function(_0x14e663,_0x8b1c3a){if(_0x38a28d[_0x4520('0x3f')]&&_0x38a28d[_0x4520('0x3f')]['id']){try{if(_0x426836[_0x4520('0x40')][_0x38a28d[_0x4520('0x3f')]['id']]){_0x426836[_0x4520('0x40')][_0x38a28d[_0x4520('0x3f')]['id']][_0x4520('0x41')]=![];_0x426836[_0x4520('0x40')][_0x38a28d[_0x4520('0x3f')]['id']][_0x4520('0x42')]=undefined;}return _0x14e663({'code':0xc8,'message':_0x38a28d});}catch(_0x2d2e04){logger[_0x4520('0x35')](_0x2d2e04[_0x4520('0x47')]);return _0x8b1c3a(_0x293b46['error'](0x1f4,_0x2d2e04));}}logger['error'](_0x4520('0x48'));return _0x8b1c3a(_0x293b46[_0x4520('0x35')](0x1f4,_0x4520('0x48')));});},'AbandonInteraction':function(_0x30e255){var _0x265bb4=this;return new Promise(function(_0x2f071e,_0x54372b){if(_0x30e255[_0x4520('0x15')]&&_0x30e255[_0x4520('0x17')]&&_0x30e255['interaction']['id']){try{var _0x3697c2=getId(_0x30e255[_0x4520('0x15')],_0x30e255[_0x4520('0x16')]?_0x30e255[_0x4520('0x16')]['id']:0x0,_0x30e255['interaction']?_0x30e255[_0x4520('0x17')]['id']:0x0);if(_0x426836[_0x4520('0x14')][_0x3697c2]){_0x426836['rules'][_0x3697c2]['emit'](_0x4520('0x49'));}return _0x2f071e({'code':0xc8,'message':_0x30e255});}catch(_0x83cac1){logger[_0x4520('0x35')](_0x83cac1[_0x4520('0x47')]);return _0x54372b(_0x265bb4[_0x4520('0x35')](0x1f4,_0x83cac1));}}logger[_0x4520('0x35')]('message\x20is\x20empty');return _0x54372b(_0x265bb4[_0x4520('0x35')](0x1f4,_0x4520('0x48')));});},'AgentCapacity':function(_0x2f4cb7){var _0x11966f=this;return new Promise(function(_0x4a1f1d,_0x3cf30d){if(_0x426836[_0x4520('0x40')]['hasOwnProperty'](_0x2f4cb7['id'])){for(var _0x20a517 in _0x2f4cb7['capacity']){if(_0x2f4cb7[_0x4520('0x4a')][_0x4520('0x4b')](_0x20a517)){if(_0x426836[_0x4520('0x40')][_0x2f4cb7['id']][_0x4520('0x4b')](_0x20a517+'CurrentCapacity')){_0x426836[_0x4520('0x40')][_0x2f4cb7['id']][_0x20a517+_0x4520('0x4c')]=parseInt(_0x2f4cb7[_0x4520('0x4a')][_0x20a517],0xa);}}}_0x426836[_0x4520('0x40')][_0x2f4cb7['id']]['updateRealtime']();return _0x4a1f1d({'code':0xc8,'message':_0x426836[_0x4520('0x40')][_0x2f4cb7['id']]});}else{return _0x3cf30d(_0x11966f[_0x4520('0x35')](0x1f4,_0x4520('0x4d')));}});},'Agents':function(_0x2d5bf6){return new Promise(function(_0x196763){var _0x8d166=_['values'](_0x426836[_0x4520('0x40')]);if(_0x2d5bf6&&_0x2d5bf6['id']){var _0x5aa552=_[_0x4520('0x4e')](_0x8d166,function(_0x22e363){return _0x22e363['id']===_0x2d5bf6['id'];});_0x196763(_0x5aa552);}else{_0x196763({'count':_0x8d166[_0x4520('0x1c')],'rows':_0x8d166});}});},'ChatQueues':function(){return new Promise(function(_0x22c06f){var _0x393da3=[];for(var _0x41a204 in _0x426836['chatQueues']){if(_0x426836['chatQueues'][_0x4520('0x4b')](_0x41a204)){var _0x4ee3aa=_0x426836[_0x4520('0x4f')][_0x41a204];var _0x2271f8={'id':_0x4ee3aa['id'],'available':_0x4ee3aa[_0x4520('0x50')],'loggedIn':_0x4ee3aa[_0x4520('0x51')],'name':_0x4ee3aa[_0x4520('0x52')],'paused':_0x4ee3aa[_0x4520('0x53')],'waiting':_0x4ee3aa[_0x4520('0x54')]};_0x393da3[_0x4520('0x24')](_0x2271f8);}}_0x22c06f({'count':_0x393da3[_0x4520('0x1c')],'rows':_0x393da3});});},'MailQueues':function(){return new Promise(function(_0x596404){var _0x199d4c=[];for(var _0x47b717 in _0x426836[_0x4520('0x55')]){if(_0x426836[_0x4520('0x55')][_0x4520('0x4b')](_0x47b717)){var _0x2cf7fc=_0x426836[_0x4520('0x55')][_0x47b717];var _0x5dff10={'id':_0x2cf7fc['id'],'available':_0x2cf7fc[_0x4520('0x50')],'loggedIn':_0x2cf7fc[_0x4520('0x51')],'name':_0x2cf7fc[_0x4520('0x52')],'paused':_0x2cf7fc[_0x4520('0x53')],'waiting':_0x2cf7fc['waiting']};_0x199d4c['push'](_0x5dff10);}}_0x596404({'count':_0x199d4c['length'],'rows':_0x199d4c});});},'OpenchannelQueues':function(){return new Promise(function(_0x2bf316){var _0x14bd13=[];for(var _0x390835 in _0x426836['openchannelQueues']){if(_0x426836[_0x4520('0x56')][_0x4520('0x4b')](_0x390835)){var _0x609b8e=_0x426836[_0x4520('0x56')][_0x390835];var _0x163ff6={'id':_0x609b8e['id'],'available':_0x609b8e['available'],'loggedIn':_0x609b8e[_0x4520('0x51')],'name':_0x609b8e[_0x4520('0x52')],'paused':_0x609b8e[_0x4520('0x53')],'waiting':_0x609b8e['waiting']};_0x14bd13[_0x4520('0x24')](_0x163ff6);}}_0x2bf316({'count':_0x14bd13[_0x4520('0x1c')],'rows':_0x14bd13});});},'SmsQueues':function(){return new Promise(function(_0x2ed1d7){var _0xcefdc7=[];for(var _0x2e8474 in _0x426836[_0x4520('0x57')]){if(_0x426836[_0x4520('0x57')][_0x4520('0x4b')](_0x2e8474)){var _0x524942=_0x426836['smsQueues'][_0x2e8474];var _0x2d9f05={'id':_0x524942['id'],'available':_0x524942[_0x4520('0x50')],'loggedIn':_0x524942['loggedIn'],'name':_0x524942[_0x4520('0x52')],'paused':_0x524942['paused'],'waiting':_0x524942[_0x4520('0x54')]};_0xcefdc7[_0x4520('0x24')](_0x2d9f05);}}_0x2ed1d7({'count':_0xcefdc7['length'],'rows':_0xcefdc7});});},'FaxQueues':function(){return new Promise(function(_0x112419){var _0x3844ba=[];for(var _0x5bacc8 in _0x426836[_0x4520('0x58')]){if(_0x426836[_0x4520('0x58')]['hasOwnProperty'](_0x5bacc8)){var _0x30ba25=_0x426836[_0x4520('0x58')][_0x5bacc8];var _0x23011d={'id':_0x30ba25['id'],'available':_0x30ba25['available'],'loggedIn':_0x30ba25[_0x4520('0x51')],'name':_0x30ba25[_0x4520('0x52')],'paused':_0x30ba25[_0x4520('0x53')],'waiting':_0x30ba25[_0x4520('0x54')]};_0x3844ba[_0x4520('0x24')](_0x23011d);}}_0x112419({'count':_0x3844ba[_0x4520('0x1c')],'rows':_0x3844ba});});},'WhatsappQueues':function(){return new Promise(function(_0x2f91c0){var _0x2a1503=[];for(var _0x2acde8 in _0x426836[_0x4520('0x59')]){if(_0x426836[_0x4520('0x59')][_0x4520('0x4b')](_0x2acde8)){var _0x519042=_0x426836['whatsappQueues'][_0x2acde8];var _0x3d4262={'id':_0x519042['id'],'available':_0x519042['available'],'loggedIn':_0x519042[_0x4520('0x51')],'name':_0x519042[_0x4520('0x52')],'paused':_0x519042[_0x4520('0x53')],'waiting':_0x519042[_0x4520('0x54')]};_0x2a1503[_0x4520('0x24')](_0x3d4262);}}_0x2f91c0({'count':_0x2a1503['length'],'rows':_0x2a1503});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4bff46){var _0x3f01c9=_[_0x4520('0x5a')](_0x426836[_0x4520('0x5b')]);_0x4bff46({'count':_0x3f01c9[_0x4520('0x1c')],'rows':_0x3f01c9});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x27fc96){var _0x2bfafb=_['values'](_0x426836[_0x4520('0x5c')]);_0x27fc96({'count':_0x2bfafb[_0x4520('0x1c')],'rows':_0x2bfafb});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x55f3ab){var _0x7e89d=_['values'](_0x426836['openchannelQueuesWaitingInteractions']);_0x55f3ab({'count':_0x7e89d['length'],'rows':_0x7e89d});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x13dbd0){var _0xc0a9b2=_[_0x4520('0x5a')](_0x426836[_0x4520('0x5d')]);_0x13dbd0({'count':_0xc0a9b2[_0x4520('0x1c')],'rows':_0xc0a9b2});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5108cd){var _0x39f79b=_[_0x4520('0x5a')](_0x426836['faxQueuesWaitingInteractions']);_0x5108cd({'count':_0x39f79b['length'],'rows':_0x39f79b});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1fdd7a){var _0x1757fc=_[_0x4520('0x5a')](_0x426836['whatsappQueuesWaitingInteractions']);_0x1fdd7a({'count':_0x1757fc[_0x4520('0x1c')],'rows':_0x1757fc});});}};var _0x341b55=jayson[_0x4520('0x5e')](_0x3e53e5)['http']();_0x341b55['on'](_0x4520('0x35'),function(_0x468115){logger['error'](JSON[_0x4520('0x39')](_0x468115));return _0x48b3e7(_0x468115);});_0x341b55['listen'](0x232c,_0x4520('0x5f'),function(){console[_0x4520('0x60')](_0x4520('0x61'),0x232c);return _0x32950a(_0x4520('0x62')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index e37fa5e..3bfbf65 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 _0x3e74=['then','error','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','iftime\x20%s','message','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util','bluebird','jayson/promise','../../../config/logger'];(function(_0xca247b,_0x2608f6){var _0x5ba66a=function(_0x27b243){while(--_0x27b243){_0xca247b['push'](_0xca247b['shift']());}};_0x5ba66a(++_0x2608f6);}(_0x3e74,0x1dc));var _0x43e7=function(_0x3be8a5,_0x3a68ae){_0x3be8a5=_0x3be8a5-0x0;var _0x36d8b7=_0x3e74[_0x3be8a5];return _0x36d8b7;};'use strict';var util=require(_0x43e7('0x0'));var BPromise=require(_0x43e7('0x1'));var jayson=require(_0x43e7('0x2'));var _=require('lodash');var logger=require(_0x43e7('0x3'))('routing');var client=jayson['client']['http']({'port':0x232a});function request(_0x3ef4c7,_0xca2162){return new BPromise(function(_0x37b3ff,_0x328aea){return client['request'](_0x3ef4c7,_0xca2162)[_0x43e7('0x4')](function(_0x540dae){if(_0x540dae[_0x43e7('0x5')]){return _0x328aea(_0x540dae[_0x43e7('0x5')]['message']);}else{return _0x37b3ff(_0x540dae['result']);}})['catch'](function(_0x11112f){return _0x328aea(_0x11112f);});});}exports[_0x43e7('0x6')]=function(_0x16f50e,_0x1e061d,_0x295e65){return function(_0x228550){if(_0x295e65[_0x43e7('0x7')]&&!_0x295e65[_0x43e7('0x7')][_0x16f50e]){logger['info'](_0x43e7('0x8'),_0x16f50e);return _0x228550[_0x43e7('0x9')]();}var _0x4aaf53=[];for(var _0x10a6a1=0x0;_0x10a6a1<_0x1e061d['length'];_0x10a6a1+=0x1){_0x4aaf53[_0x43e7('0xa')](request(_0x43e7('0xb'),{'command':util['format'](_0x43e7('0xc'),_0x1e061d[_0x10a6a1])})[_0x43e7('0x4')](function(_0x5233c3){return _0x5233c3&&_0x5233c3['message']&&_0x5233c3[_0x43e7('0xd')][_0x43e7('0xe')](_0x43e7('0xf'))>=0x0?!![]:![];})[_0x43e7('0x10')](function(){logger[_0x43e7('0x5')](_0x43e7('0x11'),_0x16f50e,_0x1e061d[_0x10a6a1]);}));}BPromise[_0x43e7('0x12')](_0x4aaf53)[_0x43e7('0x4')](function(_0x1e9e1e){var _0x1166da=_['some'](_0x1e9e1e);logger[_0x43e7('0x13')](_0x43e7('0x14'),_0x16f50e,_0x1e061d[_0x43e7('0x15')](_0x43e7('0x16')),_0x1166da);_0x228550['when'](_0x1166da);})['catch'](function(_0x2f4754){logger[_0x43e7('0x5')](_0x43e7('0x14'),_0x16f50e,_0x1e061d[_0x43e7('0x15')](_0x43e7('0x16')),_0x2f4754[_0x43e7('0x17')]);_0x228550[_0x43e7('0x9')]();});};}; \ No newline at end of file +var _0x3e16=['indexOf','[%s][INTERVAL]\x20%s','all','join','\x20|\x20','[%s][INTERVAL]\x20%s\x20%s','stack','util','jayson/promise','lodash','routing','client','http','request','then','error','message','result','catch','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x3e16,0x1ab));var _0x63e1=function(_0x3095c7,_0x4a7663){_0x3095c7=_0x3095c7-0x0;var _0x4c678c=_0x3e16[_0x3095c7];return _0x4c678c;};'use strict';var util=require(_0x63e1('0x0'));var BPromise=require('bluebird');var jayson=require(_0x63e1('0x1'));var _=require(_0x63e1('0x2'));var logger=require('../../../config/logger')(_0x63e1('0x3'));var client=jayson[_0x63e1('0x4')][_0x63e1('0x5')]({'port':0x232a});function request(_0x3099c5,_0x47024c){return new BPromise(function(_0x546178,_0x3cd035){return client[_0x63e1('0x6')](_0x3099c5,_0x47024c)[_0x63e1('0x7')](function(_0x53b7b5){if(_0x53b7b5['error']){return _0x3cd035(_0x53b7b5[_0x63e1('0x8')][_0x63e1('0x9')]);}else{return _0x546178(_0x53b7b5[_0x63e1('0xa')]);}})[_0x63e1('0xb')](function(_0x20caf4){return _0x3cd035(_0x20caf4);});});}exports[_0x63e1('0xc')]=function(_0x13d88b,_0x36deea,_0x20f687){return function(_0xc31648){if(_0x20f687['rules']&&!_0x20f687['rules'][_0x13d88b]){logger[_0x63e1('0xd')](_0x63e1('0xe'),_0x13d88b);return _0xc31648[_0x63e1('0xf')]();}var _0x530f82=[];for(var _0x59e4db=0x0;_0x59e4db<_0x36deea[_0x63e1('0x10')];_0x59e4db+=0x1){_0x530f82[_0x63e1('0x11')](request(_0x63e1('0x12'),{'command':util[_0x63e1('0x13')](_0x63e1('0x14'),_0x36deea[_0x59e4db])})['then'](function(_0x8123ae){return _0x8123ae&&_0x8123ae[_0x63e1('0x9')]&&_0x8123ae[_0x63e1('0x9')][_0x63e1('0x15')]('true')>=0x0?!![]:![];})[_0x63e1('0xb')](function(){logger[_0x63e1('0x8')](_0x63e1('0x16'),_0x13d88b,_0x36deea[_0x59e4db]);}));}BPromise[_0x63e1('0x17')](_0x530f82)[_0x63e1('0x7')](function(_0x5b197d){var _0x4a6a8e=_['some'](_0x5b197d);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x13d88b,_0x36deea[_0x63e1('0x18')](_0x63e1('0x19')),_0x4a6a8e);_0xc31648['when'](_0x4a6a8e);})[_0x63e1('0xb')](function(_0x408253){logger[_0x63e1('0x8')](_0x63e1('0x1a'),_0x13d88b,_0x36deea[_0x63e1('0x18')](_0x63e1('0x19')),_0x408253[_0x63e1('0x1b')]);_0xc31648[_0x63e1('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index cd96ef3..adf556e 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 _0xbb53=['agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','holdtime','connect','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentconnectAt','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','calleridnum','connectedlinenum','lastevent','queue','type','agentcomplete','agentacw','acwTimeout','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','called','connectedlinename','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','reason','timeout','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','agentringnoanswerAt','abandoned'];(function(_0x434be7,_0x3c46e6){var _0x3b420b=function(_0x118c41){while(--_0x118c41){_0x434be7['push'](_0x434be7['shift']());}};_0x3b420b(++_0x3c46e6);}(_0xbb53,0x121));var _0x3bb5=function(_0x232fad,_0x3481c5){_0x232fad=_0x232fad-0x0;var _0x4f82af=_0xbb53[_0x232fad];return _0x4f82af;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var utils=require(_0x3bb5('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xa71c15,_0x20c8b6){utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')](_0x3bb5('0x5'),_0xa71c15[_0x3bb5('0x6')],_0xa71c15[_0x3bb5('0x7')],_0xa71c15['queue'],_0xa71c15['membername'],_0xa71c15[_0x3bb5('0x8')],_0xa71c15[_0x3bb5('0x9')],_0xa71c15[_0x3bb5('0xa')],_0xa71c15[_0x3bb5('0xb')]));if(_0xa71c15[_0x3bb5('0xc')]){utils['getVoiceQueueByName'](_0xa71c15['queue'])['then'](function(_0x10ddfb){if(_0x10ddfb){_0xa71c15[_0x3bb5('0xd')]=_0x10ddfb[_0x3bb5('0xd')];_0xa71c15['agentacw']=_0xa71c15[_0x3bb5('0xe')]?_0x10ddfb['acw']:![];_0xa71c15['acwtime']=_0xa71c15[_0x3bb5('0xf')]?_0x10ddfb[_0x3bb5('0x10')]:0x0;}utils['request'](_0x3bb5('0x11'),_0xa71c15);});}else{utils['request'](_0x3bb5('0x11'),_0xa71c15);}if(_0x20c8b6){delete transfers[_0xa71c15['uniqueid']];}else{delete agents[_0xa71c15['destuniqueid']];}}exports[_0x3bb5('0x12')]=function(_0x35a99b){try{utils[_0x3bb5('0x13')](util['format'](_0x3bb5('0x14'),_0x35a99b[_0x3bb5('0x6')]),_0x35a99b);agents[_0x35a99b['destuniqueid']]=_0x35a99b;agents[_0x35a99b[_0x3bb5('0x15')]][_0x3bb5('0x16')]=utils['now']();agents[_0x35a99b['destuniqueid']]['lastevent']=_0x3bb5('0x17');agents[_0x35a99b[_0x3bb5('0x15')]]['connectedlinenum']=null;agents[_0x35a99b[_0x3bb5('0x15')]][_0x3bb5('0x18')]=null;utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x35a99b[_0x3bb5('0x6')],agents[_0x35a99b[_0x3bb5('0x15')]][_0x3bb5('0x19')],_0x35a99b['destuniqueid']));}catch(_0x5efea4){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x14'),_0x35a99b['uniqueid']),_0x5efea4);}};exports[_0x3bb5('0x1b')]=function(_0x2afe6e){try{if(!_[_0x3bb5('0x1c')](agents[_0x2afe6e[_0x3bb5('0x15')]])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')]('[%s][agents][agentringnoanswer]',_0x2afe6e[_0x3bb5('0x6')]),_0x2afe6e);utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')](_0x3bb5('0x1d'),_0x2afe6e[_0x3bb5('0x6')],agents[_0x2afe6e[_0x3bb5('0x15')]][_0x3bb5('0x19')],_0x2afe6e['destuniqueid']));agents[_0x2afe6e[_0x3bb5('0x15')]][_0x3bb5('0x1b')]=!![];agents[_0x2afe6e['destuniqueid']]['agentringnoanswerAt']=utils[_0x3bb5('0x1e')]();agents[_0x2afe6e[_0x3bb5('0x15')]]['lastevent']='timeout';agents[_0x2afe6e[_0x3bb5('0x15')]][_0x3bb5('0x1f')]=_0x3bb5('0x20');agents[_0x2afe6e[_0x3bb5('0x15')]]['holdtime']=_0x2afe6e['ringtime']?parseInt(_0x2afe6e[_0x3bb5('0x21')])/0x3e8:0x0;agents[_0x2afe6e['destuniqueid']][_0x3bb5('0x22')]=0x0;unanswered[_0x3bb5('0x23')](_0x2afe6e[_0x3bb5('0x15')]);}}catch(_0x534b15){utils['error'](util[_0x3bb5('0x4')](_0x3bb5('0x24'),_0x2afe6e[_0x3bb5('0x6')]),_0x534b15);}};exports[_0x3bb5('0x25')]=function(_0x311680){try{_[_0x3bb5('0x26')](agents,function(_0x3ed2cc,_0x5ce225){if(_0x3ed2cc[_0x3bb5('0x6')]==_0x311680[_0x3bb5('0x6')]&&!_[_0x3bb5('0x27')](unanswered,_0x3ed2cc[_0x3bb5('0x15')])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')](_0x3bb5('0x28'),_0x311680['uniqueid']),_0x311680);utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x311680[_0x3bb5('0x6')],_0x3ed2cc[_0x3bb5('0x19')],_0x3ed2cc[_0x3bb5('0x15')]));_0x3ed2cc[_0x3bb5('0x1b')]=!![];_0x3ed2cc[_0x3bb5('0x29')]=utils['now']();_0x3ed2cc[_0x3bb5('0xb')]=_0x3bb5('0x2a');_0x3ed2cc[_0x3bb5('0x1f')]=_0x3bb5('0x2a');_0x3ed2cc['holdtime']=_0x311680['holdtime'];_0x3ed2cc[_0x3bb5('0x22')]=0x0;writeDB(_0x3ed2cc);}});}catch(_0xeeb452){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x28'),_0x311680[_0x3bb5('0x6')]),_0xeeb452);}};exports[_0x3bb5('0x2b')]=function(_0x2a0a19){try{if(agents[_0x2a0a19[_0x3bb5('0x15')]]){utils['debug'](util[_0x3bb5('0x4')](_0x3bb5('0x2c'),_0x2a0a19['uniqueid']),_0x2a0a19);utils['info'](util[_0x3bb5('0x4')](_0x3bb5('0x2d'),_0x2a0a19[_0x3bb5('0x6')],agents[_0x2a0a19[_0x3bb5('0x15')]]['membername'],_0x2a0a19['destuniqueid']));agents[_0x2a0a19[_0x3bb5('0x15')]]['agentconnectAt']=utils[_0x3bb5('0x1e')]();agents[_0x2a0a19['destuniqueid']]['connectedlinenum']=_0x2a0a19[_0x3bb5('0xa')];agents[_0x2a0a19['destuniqueid']]['connectedlinename']=_0x2a0a19[_0x3bb5('0x18')];agents[_0x2a0a19[_0x3bb5('0x15')]][_0x3bb5('0x2e')]=_0x2a0a19['ringtime'];agents[_0x2a0a19[_0x3bb5('0x15')]]['lastevent']=_0x3bb5('0x2f');_['forIn'](agents,function(_0x235e3,_0x35bc81){if(_0x235e3[_0x3bb5('0x15')]!=_0x2a0a19[_0x3bb5('0x15')]&&_0x235e3[_0x3bb5('0x6')]==_0x2a0a19[_0x3bb5('0x6')]){_0x235e3['talktime']=0x0;_0x235e3[_0x3bb5('0x2e')]=_0x2a0a19[_0x3bb5('0x21')];_0x235e3['agentringnoanswer']=!![];_0x235e3[_0x3bb5('0x29')]=utils[_0x3bb5('0x1e')]();_0x235e3[_0x3bb5('0xb')]='answered_elsewhere';_0x235e3[_0x3bb5('0x1f')]=_0x3bb5('0x30');_0x235e3['answeredelsewheredestinationuniqueid']=_0x2a0a19[_0x3bb5('0x15')];_0x235e3[_0x3bb5('0x31')]=_0x2a0a19[_0x3bb5('0x19')];writeDB(_0x235e3);}});}}catch(_0x2291e9){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x2c'),_0x2a0a19[_0x3bb5('0x6')]),_0x2291e9);}};exports[_0x3bb5('0xe')]=function(_0x42676d){try{if(!_[_0x3bb5('0x1c')](agents[_0x42676d[_0x3bb5('0x15')]])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')]('[%s][agents][agentcomplete]',_0x42676d[_0x3bb5('0x6')]),_0x42676d);utils[_0x3bb5('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x42676d[_0x3bb5('0x6')],agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0x19')],_0x42676d[_0x3bb5('0x15')]));agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0xe')]=!![];agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0x32')]=utils['now']();agents[_0x42676d['destuniqueid']][_0x3bb5('0x22')]=utils[_0x3bb5('0x33')](agents[_0x42676d[_0x3bb5('0x15')]]['agentcompleteAt'],agents[_0x42676d[_0x3bb5('0x15')]]['agentconnectAt']);agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0x1f')]=_0x42676d[_0x3bb5('0x1f')];agents[_0x42676d[_0x3bb5('0x15')]][_0x3bb5('0xb')]=_0x3bb5('0x34');writeDB(agents[_0x42676d['destuniqueid']]);}}catch(_0x2efd7c){utils[_0x3bb5('0x1a')](util['format'](_0x3bb5('0x35'),_0x42676d[_0x3bb5('0x6')]),_0x2efd7c);}};exports['blindtransfer']=function(_0x41edf7){try{if(!_[_0x3bb5('0x1c')](agents[_0x41edf7[_0x3bb5('0x36')]])){utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')]('[%s][agents][blindtransfer]',_0x41edf7[_0x3bb5('0x6')]),_0x41edf7);utils[_0x3bb5('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x41edf7[_0x3bb5('0x6')],agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x19')],agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x6')]));agents[_0x41edf7['transfereruniqueid']][_0x3bb5('0x37')]=!![];agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x38')]=_0x3bb5('0x39');agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x3a')]=_0x41edf7[_0x3bb5('0x3b')];agents[_0x41edf7['transfereruniqueid']][_0x3bb5('0x3c')]=agents[_0x41edf7[_0x3bb5('0x36')]][_0x3bb5('0x6')];}}catch(_0x239a34){utils[_0x3bb5('0x1a')](util['format'](_0x3bb5('0x3d'),_0x41edf7[_0x3bb5('0x6')]),_0x239a34);}};exports[_0x3bb5('0x3e')]=function(_0x1ff862){try{utils[_0x3bb5('0x13')](util[_0x3bb5('0x4')](_0x3bb5('0x3f'),_0x1ff862[_0x3bb5('0x40')]),_0x1ff862);if(_0x1ff862['origtransfereruniqueid']==_0x1ff862[_0x3bb5('0x41')]){if(!_[_0x3bb5('0x1c')](agents[_0x1ff862[_0x3bb5('0x42')]])){utils[_0x3bb5('0x3')](util['format'](_0x3bb5('0x43'),_0x1ff862['origtransfereruniqueid'],agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x19')]));agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x37')]=!![];agents[_0x1ff862[_0x3bb5('0x42')]]['transfertype']=_0x3bb5('0x44');agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x3a')]=_0x1ff862[_0x3bb5('0x45')];agents[_0x1ff862['secondtransfereruniqueid']][_0x3bb5('0x3c')]=_0x1ff862[_0x3bb5('0x40')];}if(_0x1ff862[_0x3bb5('0x46')]&&agents[_0x1ff862[_0x3bb5('0x46')]]){agents[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x47')]=0x1;transfers[_0x1ff862[_0x3bb5('0x46')]]=_[_0x3bb5('0x48')](agents[_0x1ff862['transfereeuniqueid']]);transfers[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x9')]=agents[_0x1ff862[_0x3bb5('0x42')]]['calleridnum'];transfers[_0x1ff862['transfereeuniqueid']][_0x3bb5('0x49')]=agents[_0x1ff862[_0x3bb5('0x42')]][_0x3bb5('0x49')];transfers[_0x1ff862['transfereeuniqueid']][_0x3bb5('0x16')]=utils[_0x3bb5('0x1e')]();transfers[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x4a')]=utils[_0x3bb5('0x1e')]();transfers[_0x1ff862[_0x3bb5('0x46')]][_0x3bb5('0x2e')]=0x0;transfers[_0x1ff862['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x1ff862[_0x3bb5('0x42')]==_0x1ff862[_0x3bb5('0x4b')]){if(!_[_0x3bb5('0x1c')](agents[_0x1ff862[_0x3bb5('0x40')]])){utils[_0x3bb5('0x3')](util[_0x3bb5('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x1ff862[_0x3bb5('0x40')],agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x19')]));agents[_0x1ff862[_0x3bb5('0x40')]]['transfer']=!![];agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x38')]=_0x3bb5('0x44');agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x3a')]=_0x1ff862[_0x3bb5('0x4c')];agents[_0x1ff862[_0x3bb5('0x40')]][_0x3bb5('0x3c')]=_0x1ff862['secondtransfereruniqueid'];}if(_0x1ff862[_0x3bb5('0x4d')]&&agents[_0x1ff862[_0x3bb5('0x4d')]]){agents[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x47')]=0x1;transfers[_0x1ff862[_0x3bb5('0x4d')]]=_['clone'](agents[_0x1ff862[_0x3bb5('0x4d')]]);transfers[_0x1ff862['transfertargetuniqueid']][_0x3bb5('0x9')]=agents[_0x1ff862['origtransfereruniqueid']][_0x3bb5('0x9')];transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x49')]=agents[_0x1ff862['origtransfereruniqueid']][_0x3bb5('0x49')];transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x16')]=utils['now']();transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x4a')]=utils[_0x3bb5('0x1e')]();transfers[_0x1ff862['transfertargetuniqueid']][_0x3bb5('0x2e')]=0x0;transfers[_0x1ff862[_0x3bb5('0x4d')]][_0x3bb5('0x47')]=0x2;}}}catch(_0xc34441){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x3f'),_0x1ff862['origtransfereruniqueid']),_0xc34441);}};exports['hangup']=function(_0x2b3ed8){try{utils[_0x3bb5('0x13')](util['format'](_0x3bb5('0x4e'),_0x2b3ed8['uniqueid']),_0x2b3ed8);if(agents[_0x2b3ed8[_0x3bb5('0x6')]]&&agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x1f')]===_0x3bb5('0x20')){if(_0x2b3ed8['cause']==='21'){agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x1f')]=_0x3bb5('0x4f');agents[_0x2b3ed8['uniqueid']][_0x3bb5('0xb')]=_0x3bb5('0x4f');}utils['info'](util[_0x3bb5('0x4')](_0x3bb5('0x50'),_0x2b3ed8[_0x3bb5('0x6')],agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x19')],agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x1f')],agents[_0x2b3ed8['uniqueid']]['lastevent']));writeDB(agents[_0x2b3ed8['uniqueid']]);var _0x5bfdf2=unanswered['indexOf'](_0x2b3ed8[_0x3bb5('0x6')]);if(_0x5bfdf2>-0x1){unanswered[_0x3bb5('0x51')](_0x5bfdf2,0x1);}}if(transfers[_0x2b3ed8[_0x3bb5('0x6')]]){transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0xe')]=!![];transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x32')]=utils[_0x3bb5('0x1e')]();transfers[_0x2b3ed8['uniqueid']][_0x3bb5('0x22')]=utils[_0x3bb5('0x33')](transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x32')],transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x4a')]);transfers[_0x2b3ed8[_0x3bb5('0x6')]]['reason']=_0x3bb5('0x52');transfers[_0x2b3ed8['uniqueid']][_0x3bb5('0xb')]=_0x3bb5('0x34');utils[_0x3bb5('0x3')](util['format'](_0x3bb5('0x50'),_0x2b3ed8[_0x3bb5('0x6')],transfers[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x19')],transfers[_0x2b3ed8['uniqueid']][_0x3bb5('0x1f')],transfers[_0x2b3ed8['uniqueid']]['lastevent']));writeDB(transfers[_0x2b3ed8[_0x3bb5('0x6')]],!![]);}if(agents[_0x2b3ed8[_0x3bb5('0x6')]]&&agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x4a')]){agents[_0x2b3ed8['uniqueid']][_0x3bb5('0xe')]=!![];agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x32')]=utils[_0x3bb5('0x1e')]();agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x22')]=utils[_0x3bb5('0x33')](agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x32')],agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x4a')]);agents[_0x2b3ed8['uniqueid']][_0x3bb5('0x1f')]=agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x37')]?_0x3bb5('0x37'):_0x3bb5('0x52');agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0xb')]='complete';utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2b3ed8[_0x3bb5('0x6')],agents[_0x2b3ed8[_0x3bb5('0x6')]][_0x3bb5('0x19')],agents[_0x2b3ed8[_0x3bb5('0x6')]]['reason'],agents[_0x2b3ed8[_0x3bb5('0x6')]]['lastevent']));writeDB(agents[_0x2b3ed8[_0x3bb5('0x6')]]);}}catch(_0xb3572){utils[_0x3bb5('0x1a')](util[_0x3bb5('0x4')](_0x3bb5('0x4e'),_0x2b3ed8[_0x3bb5('0x6')]),_0xb3572);}}; \ No newline at end of file +var _0xae60=['transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','lodash','util','./utils','info','format','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','secondtransfererexten'];(function(_0x5d7cd4,_0x35470c){var _0x58b4b2=function(_0x47f8c7){while(--_0x47f8c7){_0x5d7cd4['push'](_0x5d7cd4['shift']());}};_0x58b4b2(++_0x35470c);}(_0xae60,0x1c7));var _0x0ae6=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xae60[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var utils=require(_0x0ae6('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x52d7cd,_0x267ad6){utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x52d7cd[_0x0ae6('0x5')],_0x52d7cd[_0x0ae6('0x6')],_0x52d7cd['queue'],_0x52d7cd[_0x0ae6('0x7')],_0x52d7cd[_0x0ae6('0x8')],_0x52d7cd[_0x0ae6('0x9')],_0x52d7cd[_0x0ae6('0xa')],_0x52d7cd[_0x0ae6('0xb')]));if(_0x52d7cd[_0x0ae6('0xc')]){utils[_0x0ae6('0xd')](_0x52d7cd[_0x0ae6('0xc')])['then'](function(_0x3b3fc3){if(_0x3b3fc3){_0x52d7cd[_0x0ae6('0xe')]=_0x3b3fc3[_0x0ae6('0xe')];_0x52d7cd[_0x0ae6('0xf')]=_0x52d7cd['agentcomplete']?_0x3b3fc3[_0x0ae6('0x10')]:![];_0x52d7cd[_0x0ae6('0x11')]=_0x52d7cd[_0x0ae6('0xf')]?_0x3b3fc3[_0x0ae6('0x12')]:0x0;}utils[_0x0ae6('0x13')](_0x0ae6('0x14'),_0x52d7cd);});}else{utils[_0x0ae6('0x13')](_0x0ae6('0x14'),_0x52d7cd);}if(_0x267ad6){delete transfers[_0x52d7cd[_0x0ae6('0x5')]];}else{delete agents[_0x52d7cd[_0x0ae6('0x15')]];}}exports[_0x0ae6('0x16')]=function(_0xf86cad){try{utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][agentcalled]',_0xf86cad[_0x0ae6('0x5')]),_0xf86cad);agents[_0xf86cad[_0x0ae6('0x15')]]=_0xf86cad;agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x18')]=utils[_0x0ae6('0x19')]();agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0xb')]=_0x0ae6('0x1a');agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0xa')]=null;agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x1b')]=null;utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x1c'),_0xf86cad[_0x0ae6('0x5')],agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x7')],_0xf86cad[_0x0ae6('0x15')]));}catch(_0x9e2c46){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][agentcalled]',_0xf86cad[_0x0ae6('0x5')]),_0x9e2c46);}};exports[_0x0ae6('0x1e')]=function(_0x140a3b){try{if(!_[_0x0ae6('0x1f')](agents[_0x140a3b[_0x0ae6('0x15')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')](_0x0ae6('0x20'),_0x140a3b['uniqueid']),_0x140a3b);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x21'),_0x140a3b[_0x0ae6('0x5')],agents[_0x140a3b[_0x0ae6('0x15')]]['membername'],_0x140a3b[_0x0ae6('0x15')]));agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x1e')]=!![];agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();agents[_0x140a3b['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x23');agents[_0x140a3b['destuniqueid']]['reason']=_0x0ae6('0x23');agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x24')]=_0x140a3b['ringtime']?parseInt(_0x140a3b[_0x0ae6('0x25')])/0x3e8:0x0;agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x26')]=0x0;unanswered['push'](_0x140a3b[_0x0ae6('0x15')]);}}catch(_0x29fef3){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x20'),_0x140a3b[_0x0ae6('0x5')]),_0x29fef3);}};exports['queuecallerabandon']=function(_0x5b2ad6){try{_[_0x0ae6('0x27')](agents,function(_0x419384,_0x4e6df8){if(_0x419384['uniqueid']==_0x5b2ad6[_0x0ae6('0x5')]&&!_[_0x0ae6('0x28')](unanswered,_0x419384[_0x0ae6('0x15')])){utils[_0x0ae6('0x17')](util['format'](_0x0ae6('0x29'),_0x5b2ad6[_0x0ae6('0x5')]),_0x5b2ad6);utils[_0x0ae6('0x3')](util['format'](_0x0ae6('0x2a'),_0x5b2ad6[_0x0ae6('0x5')],_0x419384[_0x0ae6('0x7')],_0x419384[_0x0ae6('0x15')]));_0x419384[_0x0ae6('0x1e')]=!![];_0x419384[_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();_0x419384[_0x0ae6('0xb')]=_0x0ae6('0x2b');_0x419384[_0x0ae6('0x2c')]='abandoned';_0x419384[_0x0ae6('0x24')]=_0x5b2ad6[_0x0ae6('0x24')];_0x419384['talktime']=0x0;writeDB(_0x419384);}});}catch(_0x3264d5){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][queuecallerabandon]',_0x5b2ad6[_0x0ae6('0x5')]),_0x3264d5);}};exports['agentconnect']=function(_0x59e388){try{if(agents[_0x59e388[_0x0ae6('0x15')]]){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')](_0x0ae6('0x2d'),_0x59e388[_0x0ae6('0x5')]),_0x59e388);utils['info'](util['format'](_0x0ae6('0x2e'),_0x59e388['uniqueid'],agents[_0x59e388[_0x0ae6('0x15')]]['membername'],_0x59e388[_0x0ae6('0x15')]));agents[_0x59e388['destuniqueid']][_0x0ae6('0x2f')]=utils[_0x0ae6('0x19')]();agents[_0x59e388[_0x0ae6('0x15')]][_0x0ae6('0xa')]=_0x59e388['connectedlinenum'];agents[_0x59e388['destuniqueid']][_0x0ae6('0x1b')]=_0x59e388[_0x0ae6('0x1b')];agents[_0x59e388[_0x0ae6('0x15')]]['holdtime']=_0x59e388[_0x0ae6('0x25')];agents[_0x59e388['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x30');_[_0x0ae6('0x27')](agents,function(_0x19403c,_0x450f00){if(_0x19403c[_0x0ae6('0x15')]!=_0x59e388['destuniqueid']&&_0x19403c[_0x0ae6('0x5')]==_0x59e388[_0x0ae6('0x5')]){_0x19403c[_0x0ae6('0x26')]=0x0;_0x19403c[_0x0ae6('0x24')]=_0x59e388[_0x0ae6('0x25')];_0x19403c[_0x0ae6('0x1e')]=!![];_0x19403c[_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();_0x19403c['lastevent']=_0x0ae6('0x31');_0x19403c[_0x0ae6('0x2c')]=_0x0ae6('0x31');_0x19403c[_0x0ae6('0x32')]=_0x59e388[_0x0ae6('0x15')];_0x19403c[_0x0ae6('0x33')]=_0x59e388[_0x0ae6('0x7')];writeDB(_0x19403c);}});}}catch(_0x21431e){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x2d'),_0x59e388[_0x0ae6('0x5')]),_0x21431e);}};exports[_0x0ae6('0x34')]=function(_0x85d9ce){try{if(!_[_0x0ae6('0x1f')](agents[_0x85d9ce[_0x0ae6('0x15')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][agentcomplete]',_0x85d9ce[_0x0ae6('0x5')]),_0x85d9ce);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x35'),_0x85d9ce[_0x0ae6('0x5')],agents[_0x85d9ce[_0x0ae6('0x15')]]['membername'],_0x85d9ce[_0x0ae6('0x15')]));agents[_0x85d9ce[_0x0ae6('0x15')]][_0x0ae6('0x34')]=!![];agents[_0x85d9ce[_0x0ae6('0x15')]]['agentcompleteAt']=utils['now']();agents[_0x85d9ce['destuniqueid']][_0x0ae6('0x26')]=utils[_0x0ae6('0x36')](agents[_0x85d9ce[_0x0ae6('0x15')]]['agentcompleteAt'],agents[_0x85d9ce[_0x0ae6('0x15')]][_0x0ae6('0x2f')]);agents[_0x85d9ce['destuniqueid']][_0x0ae6('0x2c')]=_0x85d9ce[_0x0ae6('0x2c')];agents[_0x85d9ce['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x37');writeDB(agents[_0x85d9ce['destuniqueid']]);}}catch(_0x76e561){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][agentcomplete]',_0x85d9ce[_0x0ae6('0x5')]),_0x76e561);}};exports[_0x0ae6('0x38')]=function(_0x46075a){try{if(!_[_0x0ae6('0x1f')](agents[_0x46075a[_0x0ae6('0x39')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][blindtransfer]',_0x46075a['uniqueid']),_0x46075a);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x3a'),_0x46075a['uniqueid'],agents[_0x46075a[_0x0ae6('0x39')]]['membername'],agents[_0x46075a['transfereruniqueid']][_0x0ae6('0x5')]));agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x3b')]=!![];agents[_0x46075a['transfereruniqueid']][_0x0ae6('0x3c')]=_0x0ae6('0x3d');agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x3e')]=_0x46075a[_0x0ae6('0x3f')];agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x40')]=agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x5')];}}catch(_0x117d24){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x41'),_0x46075a[_0x0ae6('0x5')]),_0x117d24);}};exports[_0x0ae6('0x42')]=function(_0x5c4785){try{utils['debug'](util[_0x0ae6('0x4')](_0x0ae6('0x43'),_0x5c4785[_0x0ae6('0x44')]),_0x5c4785);if(_0x5c4785[_0x0ae6('0x44')]==_0x5c4785[_0x0ae6('0x45')]){if(!_[_0x0ae6('0x1f')](agents[_0x5c4785[_0x0ae6('0x46')]])){utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x47'),_0x5c4785[_0x0ae6('0x44')],agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x7')]));agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x3b')]=!![];agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x3c')]=_0x0ae6('0x48');agents[_0x5c4785['secondtransfereruniqueid']][_0x0ae6('0x3e')]=_0x5c4785[_0x0ae6('0x49')];agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x40')]=_0x5c4785[_0x0ae6('0x44')];}if(_0x5c4785[_0x0ae6('0x4a')]&&agents[_0x5c4785[_0x0ae6('0x4a')]]){agents[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4b')]=0x1;transfers[_0x5c4785[_0x0ae6('0x4a')]]=_['clone'](agents[_0x5c4785[_0x0ae6('0x4a')]]);transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x9')]=agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x9')];transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4c')]=agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x4c')];transfers[_0x5c4785['transfereeuniqueid']]['agentcalledAt']=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4a')]]['agentconnectAt']=utils['now']();transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x24')]=0x0;transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4b')]=0x2;}}else if(_0x5c4785[_0x0ae6('0x46')]==_0x5c4785[_0x0ae6('0x4d')]){if(!_[_0x0ae6('0x1f')](agents[_0x5c4785['origtransfereruniqueid']])){utils[_0x0ae6('0x3')](util['format'](_0x0ae6('0x47'),_0x5c4785[_0x0ae6('0x44')],agents[_0x5c4785['origtransfereruniqueid']][_0x0ae6('0x7')]));agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x3b')]=!![];agents[_0x5c4785['origtransfereruniqueid']][_0x0ae6('0x3c')]='ATTENDED';agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x3e')]=_0x5c4785[_0x0ae6('0x4e')];agents[_0x5c4785[_0x0ae6('0x44')]]['transferuniqueid']=_0x5c4785['secondtransfereruniqueid'];}if(_0x5c4785[_0x0ae6('0x4f')]&&agents[_0x5c4785[_0x0ae6('0x4f')]]){agents[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x4b')]=0x1;transfers[_0x5c4785[_0x0ae6('0x4f')]]=_[_0x0ae6('0x50')](agents[_0x5c4785['transfertargetuniqueid']]);transfers[_0x5c4785['transfertargetuniqueid']][_0x0ae6('0x9')]=agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x9')];transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x4c')]=agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x4c')];transfers[_0x5c4785[_0x0ae6('0x4f')]]['agentcalledAt']=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x2f')]=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x24')]=0x0;transfers[_0x5c4785['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x35068d){utils[_0x0ae6('0x1d')](util['format'](_0x0ae6('0x43'),_0x5c4785[_0x0ae6('0x44')]),_0x35068d);}};exports[_0x0ae6('0x51')]=function(_0x37ad9b){try{utils['debug'](util[_0x0ae6('0x4')](_0x0ae6('0x52'),_0x37ad9b[_0x0ae6('0x5')]),_0x37ad9b);if(agents[_0x37ad9b[_0x0ae6('0x5')]]&&agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')]===_0x0ae6('0x23')){if(_0x37ad9b[_0x0ae6('0x53')]==='21'){agents[_0x37ad9b['uniqueid']][_0x0ae6('0x2c')]=_0x0ae6('0x54');agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x54');}utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x55'),_0x37ad9b[_0x0ae6('0x5')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x7')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(agents[_0x37ad9b[_0x0ae6('0x5')]]);var _0x346d19=unanswered[_0x0ae6('0x56')](_0x37ad9b[_0x0ae6('0x5')]);if(_0x346d19>-0x1){unanswered[_0x0ae6('0x57')](_0x346d19,0x1);}}if(transfers[_0x37ad9b[_0x0ae6('0x5')]]){transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x34')]=!![];transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')]=utils[_0x0ae6('0x19')]();transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x26')]=utils[_0x0ae6('0x36')](transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2f')]);transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x2c')]='agent';transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x37');utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x55'),_0x37ad9b[_0x0ae6('0x5')],transfers[_0x37ad9b['uniqueid']]['membername'],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(transfers[_0x37ad9b['uniqueid']],!![]);}if(agents[_0x37ad9b[_0x0ae6('0x5')]]&&agents[_0x37ad9b[_0x0ae6('0x5')]]['agentconnectAt']){agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x34')]=!![];agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')]=utils[_0x0ae6('0x19')]();agents[_0x37ad9b[_0x0ae6('0x5')]]['talktime']=utils['diffTime'](agents[_0x37ad9b['uniqueid']][_0x0ae6('0x58')],agents[_0x37ad9b['uniqueid']]['agentconnectAt']);agents[_0x37ad9b['uniqueid']]['reason']=agents[_0x37ad9b[_0x0ae6('0x5')]]['transfer']?_0x0ae6('0x3b'):'agent';agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x37');utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x37ad9b[_0x0ae6('0x5')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x7')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(agents[_0x37ad9b['uniqueid']]);}}catch(_0x435707){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x52'),_0x37ad9b[_0x0ae6('0x5')]),_0x435707);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index a294d0e..b9468e1 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 _0x4089=['appdata','split','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','format','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','calleridnum','exten','context','now','DOCUMENTATION','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','xmd-callerid','xmd-callerid-preview','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr'];(function(_0x392a4b,_0x3116ae){var _0x17c077=function(_0x3a5fc1){while(--_0x3a5fc1){_0x392a4b['push'](_0x392a4b['shift']());}};_0x17c077(++_0x3116ae);}(_0x4089,0xdd));var _0x9408=function(_0x26ac05,_0x5beb9d){_0x26ac05=_0x26ac05-0x0;var _0x2a09c4=_0x4089[_0x26ac05];return _0x2a09c4;};'use strict';var _=require(_0x9408('0x0'));var util=require(_0x9408('0x1'));var utils=require(_0x9408('0x2'));var dispositions=['NO\x20ANSWER',_0x9408('0x3'),_0x9408('0x3'),'NO\x20ANSWER','NO\x20ANSWER',_0x9408('0x4'),_0x9408('0x5'),_0x9408('0x6'),'FAILED','FAILED','FAILED'];var channels={};function writeDB(_0x37f454){utils[_0x9408('0x7')](util['format'](_0x9408('0x8'),_0x37f454[_0x9408('0x9')],_0x37f454[_0x9408('0xa')],_0x37f454[_0x9408('0xb')],_0x37f454[_0x9408('0xc')],_0x37f454[_0x9408('0xd')],_0x37f454['calleridnum'],_0x37f454[_0x9408('0xe')],_0x37f454['lastevent']));if(_0x37f454['accountcode']){utils[_0x9408('0xf')](_0x37f454[_0x9408('0x10')])[_0x9408('0x11')](function(_0x571aea){if(_0x571aea){_0x37f454[_0x9408('0x12')]=_0x571aea['id'];}utils[_0x9408('0x13')](_0x9408('0x14'),_0x37f454);});}else{utils[_0x9408('0x13')]('CreateVoiceCallReport',_0x37f454);}if(channels[_0x37f454[_0x9408('0x9')]]){delete channels[_0x37f454[_0x9408('0x9')]];}}exports[_0x9408('0x15')]=function(_0x112031){try{utils['debug'](util[_0x9408('0x16')](_0x9408('0x17'),_0x112031[_0x9408('0x9')]),_0x112031);if(_0x112031[_0x9408('0x9')]==_0x112031['linkedid']&&_0x112031[_0x9408('0xa')]!=_0x9408('0x18')){utils['info'](util[_0x9408('0x16')](_0x9408('0x19'),_0x112031[_0x9408('0x9')],_0x112031['context'],_0x112031['exten']));channels[_0x112031[_0x9408('0x9')]]={'uniqueid':_0x112031[_0x9408('0x9')],'accountcode':_0x112031[_0x9408('0x10')],'source':_0x112031[_0x9408('0x1a')],'destination':_0x112031[_0x9408('0x1b')],'destinationcontext':_0x112031[_0x9408('0x1c')],'channel':_0x112031['channel'],'starttime':utils[_0x9408('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9408('0x4'),'amaflags':_0x9408('0x1e')};}}catch(_0x44fbec){utils['error'](util['format'](_0x9408('0x17'),_0x112031[_0x9408('0x9')]),_0x44fbec);}};exports['newstate']=function(_0x531051){try{utils[_0x9408('0x1f')](util[_0x9408('0x16')](_0x9408('0x20'),_0x531051[_0x9408('0x9')]),_0x531051);if(!_[_0x9408('0x21')](channels[_0x531051['uniqueid']])&&_0x531051[_0x9408('0x22')]==0x6){utils[_0x9408('0x7')](util[_0x9408('0x16')](_0x9408('0x23'),_0x531051[_0x9408('0x9')],_0x531051[_0x9408('0x1c')],_0x531051[_0x9408('0xa')]));if(_[_0x9408('0x21')](channels[_0x531051[_0x9408('0x9')]][_0x9408('0x24')])){channels[_0x531051[_0x9408('0x9')]][_0x9408('0x24')]=utils['now']();}}else if(!_['isNil'](channels[_0x531051[_0x9408('0x25')]])&&_0x531051['channelstate']==0x6&&_0x531051[_0x9408('0x1c')]!=_0x9408('0x26')){utils['info'](util[_0x9408('0x16')](_0x9408('0x27'),_0x531051[_0x9408('0x9')],_0x531051['linkedid'],_0x531051[_0x9408('0x1c')],_0x531051[_0x9408('0xa')]));channels[_0x531051[_0x9408('0x25')]][_0x9408('0x10')]=_0x531051[_0x9408('0x10')];channels[_0x531051[_0x9408('0x25')]][_0x9408('0x28')]=_0x531051[_0x9408('0xa')];if(_[_0x9408('0x21')](channels[_0x531051['linkedid']][_0x9408('0x29')])){channels[_0x531051[_0x9408('0x25')]]['answertime']=utils[_0x9408('0x1d')]();}channels[_0x531051[_0x9408('0x25')]][_0x9408('0x2a')]=dispositions[_[_0x9408('0x2b')](_0x531051[_0x9408('0x22')])]||_0x9408('0x5');}}catch(_0xc25b7){utils[_0x9408('0x2c')](util['format'](_0x9408('0x20'),_0x531051[_0x9408('0x9')]),_0xc25b7);}};exports[_0x9408('0x2d')]=function(_0x171796){try{if(!_[_0x9408('0x21')](channels[_0x171796[_0x9408('0x9')]])){utils[_0x9408('0x1f')](util[_0x9408('0x16')](_0x9408('0x2e'),_0x171796[_0x9408('0x9')]),_0x171796);if(_['isNil'](channels[_0x171796[_0x9408('0x9')]][_0x9408('0x2f')])){channels[_0x171796[_0x9408('0x9')]][_0x9408('0x2f')]=_0x171796[_0x9408('0x30')]+'\x20<'+_0x171796['calleridnum']+'>';}utils[_0x9408('0x7')](util[_0x9408('0x16')](_0x9408('0x31'),_0x171796['uniqueid'],channels[_0x171796[_0x9408('0x9')]][_0x9408('0x2f')],_0x171796[_0x9408('0x32')]));channels[_0x171796['uniqueid']][_0x9408('0x33')]=utils[_0x9408('0x1d')]();channels[_0x171796[_0x9408('0x9')]][_0x9408('0x34')]=utils[_0x9408('0x35')](channels[_0x171796[_0x9408('0x9')]][_0x9408('0x33')],channels[_0x171796[_0x9408('0x9')]][_0x9408('0x36')]);channels[_0x171796[_0x9408('0x9')]][_0x9408('0x37')]=channels[_0x171796['uniqueid']]['answertime']?utils[_0x9408('0x35')](channels[_0x171796[_0x9408('0x9')]][_0x9408('0x33')],channels[_0x171796['uniqueid']][_0x9408('0x29')]):0x0;writeDB(channels[_0x171796[_0x9408('0x9')]]);}}catch(_0x7a04d8){utils[_0x9408('0x2c')](util['format']('[%s][calls][hangup]',_0x171796['uniqueid']),_0x7a04d8);}};exports['attendedtransfer']=function(_0x14bb74){try{if(!_['isNil'](channels[_0x14bb74[_0x9408('0x38')]])){utils[_0x9408('0x1f')](util[_0x9408('0x16')](_0x9408('0x39'),_0x14bb74[_0x9408('0x3a')]),_0x14bb74);if(channels[_0x14bb74[_0x9408('0x38')]][_0x9408('0xa')]==_0x14bb74['transfereechannel']){utils['info'](util[_0x9408('0x16')](_0x9408('0x3b'),_0x14bb74[_0x9408('0x3a')],_0x14bb74[_0x9408('0x38')],_0x14bb74[_0x9408('0x3c')]));channels[_0x14bb74[_0x9408('0x38')]][_0x9408('0x28')]=_0x14bb74[_0x9408('0x3c')];channels[_0x14bb74[_0x9408('0x38')]][_0x9408('0x3d')]=_0x9408('0x3e');}else if(channels[_0x14bb74['localtwolinkedid']][_0x9408('0xa')]=_0x14bb74['transfertargetchannel']){utils['info'](util[_0x9408('0x16')](_0x9408('0x3b'),_0x14bb74[_0x9408('0x3a')],_0x14bb74['localtwolinkedid'],_0x14bb74[_0x9408('0x3f')]));channels[_0x14bb74[_0x9408('0x38')]][_0x9408('0x28')]=_0x14bb74[_0x9408('0x3f')];channels[_0x14bb74['localtwolinkedid']][_0x9408('0x3d')]=_0x9408('0x3e');}}}catch(_0x705e26){utils['error'](util[_0x9408('0x16')](_0x9408('0x39'),_0x14bb74['origtransfereruniqueid']),_0x705e26);}};exports[_0x9408('0x40')]=function(_0x3cd97a){try{if(!_[_0x9408('0x21')](channels[_0x3cd97a['uniqueid']])){utils[_0x9408('0x1f')](util['format'](_0x9408('0x41'),_0x3cd97a[_0x9408('0x9')]),_0x3cd97a);channels[_0x3cd97a['uniqueid']][_0x9408('0x42')]=utils[_0x9408('0x1d')]();utils[_0x9408('0x7')](util['format'](_0x9408('0x43'),_0x3cd97a[_0x9408('0x9')],channels[_0x3cd97a[_0x9408('0x9')]][_0x9408('0x42')]));}}catch(_0x2a9eea){utils[_0x9408('0x2c')](util[_0x9408('0x16')](_0x9408('0x41'),_0x3cd97a[_0x9408('0x9')]),_0x2a9eea);}};exports[_0x9408('0x44')]=function(_0x1d026e){try{if(!_['isNil'](channels[_0x1d026e[_0x9408('0x9')]])){utils['debug'](util[_0x9408('0x16')](_0x9408('0x45'),_0x1d026e[_0x9408('0x9')]),_0x1d026e);if(!_[_0x9408('0x21')](channels[_0x1d026e['uniqueid']]['musiconholdstartAt'])){channels[_0x1d026e[_0x9408('0x9')]][_0x9408('0x46')]+=utils[_0x9408('0x35')](utils[_0x9408('0x1d')](),channels[_0x1d026e[_0x9408('0x9')]][_0x9408('0x42')]);utils[_0x9408('0x7')](util[_0x9408('0x16')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x1d026e['uniqueid'],channels[_0x1d026e[_0x9408('0x9')]][_0x9408('0x46')]));delete channels[_0x1d026e[_0x9408('0x9')]][_0x9408('0x42')];}}}catch(_0xdc9efd){utils[_0x9408('0x2c')](util[_0x9408('0x16')](_0x9408('0x45'),_0x1d026e[_0x9408('0x9')]),_0xdc9efd);}};exports[_0x9408('0x47')]=function(_0x508595){try{if(!_['isNil'](channels[_0x508595[_0x9408('0x9')]])){utils[_0x9408('0x1f')](util['format'](_0x9408('0x48'),_0x508595[_0x9408('0x9')]),_0x508595);if(!_['isNil'](_0x508595[_0x9408('0x49')][_0x9408('0x4a')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x508595[_0x9408('0x9')],_0x508595[_0x9408('0x4b')]));channels[_0x508595[_0x9408('0x9')]]['source']=_0x508595[_0x9408('0x4b')];}if(!_['isNil'](_0x508595[_0x9408('0x49')]['xmd-phone'])){utils['info'](util[_0x9408('0x16')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x508595[_0x9408('0x9')],_0x508595[_0x9408('0x4b')]));channels[_0x508595[_0x9408('0x9')]]['destination']=_0x508595[_0x9408('0x4b')];channels[_0x508595['uniqueid']][_0x9408('0x2f')]='\x22'+_0x508595[_0x9408('0x4b')]+'\x22\x20<'+_0x508595[_0x9408('0x4b')]+'>';}if(!_[_0x9408('0x21')](_0x508595[_0x9408('0x49')]['xmd-callerid-preview'])||!_[_0x9408('0x21')](_0x508595['variable'][_0x9408('0x4c')])){utils[_0x9408('0x7')](util[_0x9408('0x16')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x508595[_0x9408('0x9')],!_['isNil'](_0x508595['variable'][_0x9408('0x4d')])?_0x9408('0x4d'):_0x9408('0x4c'),_0x508595['value']));channels[_0x508595[_0x9408('0x9')]][_0x9408('0x2f')]=_0x508595[_0x9408('0x4b')];}if(!_['isNil'](_0x508595[_0x9408('0x49')][_0x9408('0x4e')])||!_[_0x9408('0x21')](_0x508595['variable'][_0x9408('0x4f')])){utils[_0x9408('0x7')](util['format'](_0x9408('0x50'),_0x508595[_0x9408('0x9')],!_['isNil'](_0x508595['variable'][_0x9408('0x4e')])?_0x9408('0x4e'):_0x9408('0x4f'),_0x508595[_0x9408('0x4b')]));channels[_0x508595[_0x9408('0x9')]][_0x9408('0x51')]=_0x9408('0x52');channels[_0x508595[_0x9408('0x9')]][_0x9408('0x53')]=_0x508595['value'];channels[_0x508595[_0x9408('0x9')]][_0x9408('0xb')]=!![];}if(!_['isNil'](_0x508595[_0x9408('0x49')][_0x9408('0x54')])){utils[_0x9408('0x7')](util[_0x9408('0x16')](_0x9408('0x55'),_0x508595[_0x9408('0x9')],_0x508595['value']));channels[_0x508595[_0x9408('0x9')]][_0x9408('0x56')]=_0x508595['value'];}if(!_[_0x9408('0x21')](_0x508595['variable'][_0x9408('0x57')])){utils['info'](util[_0x9408('0x16')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x508595[_0x9408('0x9')],_0x508595['value']));channels[_0x508595[_0x9408('0x9')]][_0x9408('0x58')]=_0x508595[_0x9408('0x4b')];}if(!_[_0x9408('0x21')](_0x508595[_0x9408('0x49')][_0x9408('0x59')])){utils[_0x9408('0x7')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x508595[_0x9408('0x9')],_0x508595[_0x9408('0x4b')]));channels[_0x508595[_0x9408('0x9')]][_0x9408('0x5a')]=_0x508595[_0x9408('0x4b')];}if(!_[_0x9408('0x21')](_0x508595[_0x9408('0x49')]['sipcallid'])){utils[_0x9408('0x7')](util['format'](_0x9408('0x5b'),_0x508595[_0x9408('0x9')],_0x508595['value']));channels[_0x508595[_0x9408('0x9')]][_0x9408('0x5c')]=_0x508595[_0x9408('0x4b')];}}}catch(_0x2d9b9b){utils['error'](util['format'](_0x9408('0x48'),_0x508595[_0x9408('0x9')]),_0x2d9b9b);}};exports['newexten']=function(_0x3c2bea){try{if(!_['isNil'](channels[_0x3c2bea['uniqueid']])){utils[_0x9408('0x1f')](util[_0x9408('0x16')](_0x9408('0x5d'),_0x3c2bea[_0x9408('0x9')]),_0x3c2bea);utils[_0x9408('0x7')](util['format'](_0x9408('0x5e'),_0x3c2bea[_0x9408('0x9')],_0x3c2bea[_0x9408('0x5f')],_0x3c2bea['appdata']));if(_0x3c2bea[_0x9408('0x5f')][_0x9408('0x60')]()==_0x9408('0x61')&&_[_0x9408('0x62')](_0x3c2bea['appdata'][_0x9408('0x60')](),_0x9408('0x63'))){var _0x3f1067=_0x3c2bea[_0x9408('0x64')][_0x9408('0x65')]('=');var _0x52b84d=_0x3f1067[0x0]['substring'](_0x3f1067[0x0][_0x9408('0x66')]('(')+0x1,_0x3f1067[0x0]['lastIndexOf'](')'));var _0x3f60a1=_0x3f1067[0x1];channels[_0x3c2bea[_0x9408('0x9')]][_0x52b84d]=_0x3f60a1;}if(!_[_0x9408('0x67')]([_0x9408('0x2d'),_0x9408('0x68'),_0x9408('0x69'),'set',_0x9408('0x6a')],_0x3c2bea[_0x9408('0x5f')]['toLowerCase']())){channels[_0x3c2bea[_0x9408('0x9')]][_0x9408('0x51')]=_0x3c2bea[_0x9408('0x5f')];channels[_0x3c2bea[_0x9408('0x9')]][_0x9408('0x53')]=_0x3c2bea[_0x9408('0x64')];}}}catch(_0x15c1ed){utils[_0x9408('0x2c')](util['format']('[%s][calls][newexten]',_0x3c2bea[_0x9408('0x9')]),_0x15c1ed);}}; \ No newline at end of file +var _0xdbd9=['[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','toLowerCase','appdata','cdr','split','lastIndexOf','noop','set','gotoif','application','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','uniqueid','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','DOCUMENTATION','error','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','now','disposition','toNumber','channelstate','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','billableseconds','diffTime','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype'];(function(_0x2a416a,_0x2f0660){var _0x52bb59=function(_0x411290){while(--_0x411290){_0x2a416a['push'](_0x2a416a['shift']());}};_0x52bb59(++_0x2f0660);}(_0xdbd9,0x145));var _0x9dbd=function(_0x1dd35f,_0x2d5d24){_0x1dd35f=_0x1dd35f-0x0;var _0x5823dd=_0xdbd9[_0x1dd35f];return _0x5823dd;};'use strict';var _=require(_0x9dbd('0x0'));var util=require(_0x9dbd('0x1'));var utils=require(_0x9dbd('0x2'));var dispositions=[_0x9dbd('0x3'),_0x9dbd('0x4'),'FAILED',_0x9dbd('0x3'),'NO\x20ANSWER',_0x9dbd('0x3'),_0x9dbd('0x5'),_0x9dbd('0x6'),'FAILED','FAILED',_0x9dbd('0x4')];var channels={};function writeDB(_0x22c2fa){utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x9'),_0x22c2fa['uniqueid'],_0x22c2fa[_0x9dbd('0xa')],_0x22c2fa[_0x9dbd('0xb')],_0x22c2fa[_0x9dbd('0xc')],_0x22c2fa[_0x9dbd('0xd')],_0x22c2fa[_0x9dbd('0xe')],_0x22c2fa[_0x9dbd('0xf')],_0x22c2fa['lastevent']));if(_0x22c2fa[_0x9dbd('0x10')]){utils[_0x9dbd('0x11')](_0x22c2fa[_0x9dbd('0x10')])[_0x9dbd('0x12')](function(_0x20e61d){if(_0x20e61d){_0x22c2fa[_0x9dbd('0x13')]=_0x20e61d['id'];}utils['request']('CreateVoiceCallReport',_0x22c2fa);});}else{utils[_0x9dbd('0x14')]('CreateVoiceCallReport',_0x22c2fa);}if(channels[_0x22c2fa[_0x9dbd('0x15')]]){delete channels[_0x22c2fa['uniqueid']];}}exports[_0x9dbd('0x16')]=function(_0x13bf07){try{utils[_0x9dbd('0x17')](util[_0x9dbd('0x8')](_0x9dbd('0x18'),_0x13bf07[_0x9dbd('0x15')]),_0x13bf07);if(_0x13bf07['uniqueid']==_0x13bf07[_0x9dbd('0x19')]&&_0x13bf07[_0x9dbd('0xa')]!=_0x9dbd('0x1a')){utils['info'](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x13bf07[_0x9dbd('0x15')],_0x13bf07[_0x9dbd('0x1b')],_0x13bf07['exten']));channels[_0x13bf07['uniqueid']]={'uniqueid':_0x13bf07[_0x9dbd('0x15')],'accountcode':_0x13bf07[_0x9dbd('0x10')],'source':_0x13bf07[_0x9dbd('0xe')],'destination':_0x13bf07[_0x9dbd('0x1c')],'destinationcontext':_0x13bf07[_0x9dbd('0x1b')],'channel':_0x13bf07['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9dbd('0x3'),'amaflags':_0x9dbd('0x1d')};}}catch(_0x2af646){utils[_0x9dbd('0x1e')](util['format'](_0x9dbd('0x18'),_0x13bf07['uniqueid']),_0x2af646);}};exports['newstate']=function(_0xae35fd){try{utils[_0x9dbd('0x17')](util[_0x9dbd('0x8')](_0x9dbd('0x1f'),_0xae35fd[_0x9dbd('0x15')]),_0xae35fd);if(!_[_0x9dbd('0x20')](channels[_0xae35fd['uniqueid']])&&_0xae35fd['channelstate']==0x6){utils[_0x9dbd('0x7')](util['format'](_0x9dbd('0x21'),_0xae35fd[_0x9dbd('0x15')],_0xae35fd['context'],_0xae35fd[_0x9dbd('0xa')]));if(_[_0x9dbd('0x20')](channels[_0xae35fd[_0x9dbd('0x15')]][_0x9dbd('0x22')])){channels[_0xae35fd[_0x9dbd('0x15')]]['systemanswertime']=utils['now']();}}else if(!_[_0x9dbd('0x20')](channels[_0xae35fd[_0x9dbd('0x19')]])&&_0xae35fd['channelstate']==0x6&&_0xae35fd[_0x9dbd('0x1b')]!='transfer'){utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x23'),_0xae35fd[_0x9dbd('0x15')],_0xae35fd[_0x9dbd('0x19')],_0xae35fd[_0x9dbd('0x1b')],_0xae35fd[_0x9dbd('0xa')]));channels[_0xae35fd['linkedid']][_0x9dbd('0x10')]=_0xae35fd['accountcode'];channels[_0xae35fd[_0x9dbd('0x19')]][_0x9dbd('0x24')]=_0xae35fd[_0x9dbd('0xa')];if(_[_0x9dbd('0x20')](channels[_0xae35fd[_0x9dbd('0x19')]][_0x9dbd('0x25')])){channels[_0xae35fd['linkedid']][_0x9dbd('0x25')]=utils[_0x9dbd('0x26')]();}channels[_0xae35fd[_0x9dbd('0x19')]][_0x9dbd('0x27')]=dispositions[_[_0x9dbd('0x28')](_0xae35fd[_0x9dbd('0x29')])]||_0x9dbd('0x5');}}catch(_0x3bf888){utils[_0x9dbd('0x1e')](util[_0x9dbd('0x8')]('[%s][calls][newstate]',_0xae35fd[_0x9dbd('0x15')]),_0x3bf888);}};exports[_0x9dbd('0x2a')]=function(_0x36dd93){try{if(!_[_0x9dbd('0x20')](channels[_0x36dd93['uniqueid']])){utils[_0x9dbd('0x17')](util[_0x9dbd('0x8')](_0x9dbd('0x2b'),_0x36dd93[_0x9dbd('0x15')]),_0x36dd93);if(_[_0x9dbd('0x20')](channels[_0x36dd93[_0x9dbd('0x15')]][_0x9dbd('0x2c')])){channels[_0x36dd93['uniqueid']]['callerid']=_0x36dd93[_0x9dbd('0x2d')]+'\x20<'+_0x36dd93['calleridnum']+'>';}utils['info'](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x36dd93['uniqueid'],channels[_0x36dd93['uniqueid']]['callerid'],_0x36dd93[_0x9dbd('0x2e')]));channels[_0x36dd93[_0x9dbd('0x15')]][_0x9dbd('0x2f')]=utils[_0x9dbd('0x26')]();channels[_0x36dd93[_0x9dbd('0x15')]][_0x9dbd('0x30')]=utils['diffTime'](channels[_0x36dd93[_0x9dbd('0x15')]][_0x9dbd('0x2f')],channels[_0x36dd93['uniqueid']]['starttime']);channels[_0x36dd93[_0x9dbd('0x15')]][_0x9dbd('0x31')]=channels[_0x36dd93[_0x9dbd('0x15')]][_0x9dbd('0x25')]?utils[_0x9dbd('0x32')](channels[_0x36dd93['uniqueid']][_0x9dbd('0x2f')],channels[_0x36dd93['uniqueid']][_0x9dbd('0x25')]):0x0;writeDB(channels[_0x36dd93[_0x9dbd('0x15')]]);}}catch(_0x354012){utils[_0x9dbd('0x1e')](util['format'](_0x9dbd('0x2b'),_0x36dd93['uniqueid']),_0x354012);}};exports['attendedtransfer']=function(_0x34c155){try{if(!_[_0x9dbd('0x20')](channels[_0x34c155[_0x9dbd('0x33')]])){utils['debug'](util[_0x9dbd('0x8')](_0x9dbd('0x34'),_0x34c155['origtransfereruniqueid']),_0x34c155);if(channels[_0x34c155['localtwolinkedid']]['channel']==_0x34c155[_0x9dbd('0x35')]){utils[_0x9dbd('0x7')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x34c155[_0x9dbd('0x36')],_0x34c155['localtwolinkedid'],_0x34c155[_0x9dbd('0x37')]));channels[_0x34c155[_0x9dbd('0x33')]]['destinationchannel']=_0x34c155[_0x9dbd('0x37')];channels[_0x34c155[_0x9dbd('0x33')]]['userfield']='_attended';}else if(channels[_0x34c155[_0x9dbd('0x33')]]['channel']=_0x34c155['transfertargetchannel']){utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x38'),_0x34c155[_0x9dbd('0x36')],_0x34c155[_0x9dbd('0x33')],_0x34c155[_0x9dbd('0x39')]));channels[_0x34c155[_0x9dbd('0x33')]][_0x9dbd('0x24')]=_0x34c155['origtransfererchannel'];channels[_0x34c155[_0x9dbd('0x33')]]['userfield']=_0x9dbd('0x3a');}}}catch(_0x2d97a5){utils[_0x9dbd('0x1e')](util[_0x9dbd('0x8')](_0x9dbd('0x34'),_0x34c155[_0x9dbd('0x36')]),_0x2d97a5);}};exports['musiconholdstart']=function(_0x5c0286){try{if(!_[_0x9dbd('0x20')](channels[_0x5c0286[_0x9dbd('0x15')]])){utils[_0x9dbd('0x17')](util[_0x9dbd('0x8')]('[%s][calls][musiconholdstart]',_0x5c0286[_0x9dbd('0x15')]),_0x5c0286);channels[_0x5c0286[_0x9dbd('0x15')]][_0x9dbd('0x3b')]=utils[_0x9dbd('0x26')]();utils['info'](util[_0x9dbd('0x8')](_0x9dbd('0x3c'),_0x5c0286[_0x9dbd('0x15')],channels[_0x5c0286[_0x9dbd('0x15')]][_0x9dbd('0x3b')]));}}catch(_0x207f34){utils[_0x9dbd('0x1e')](util[_0x9dbd('0x8')]('[%s][calls][musiconholdstart]',_0x5c0286[_0x9dbd('0x15')]),_0x207f34);}};exports[_0x9dbd('0x3d')]=function(_0x3870c8){try{if(!_[_0x9dbd('0x20')](channels[_0x3870c8[_0x9dbd('0x15')]])){utils[_0x9dbd('0x17')](util[_0x9dbd('0x8')](_0x9dbd('0x3e'),_0x3870c8[_0x9dbd('0x15')]),_0x3870c8);if(!_[_0x9dbd('0x20')](channels[_0x3870c8['uniqueid']][_0x9dbd('0x3b')])){channels[_0x3870c8[_0x9dbd('0x15')]][_0x9dbd('0x3f')]+=utils[_0x9dbd('0x32')](utils['now'](),channels[_0x3870c8[_0x9dbd('0x15')]][_0x9dbd('0x3b')]);utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x40'),_0x3870c8[_0x9dbd('0x15')],channels[_0x3870c8[_0x9dbd('0x15')]][_0x9dbd('0x3f')]));delete channels[_0x3870c8[_0x9dbd('0x15')]][_0x9dbd('0x3b')];}}}catch(_0xd6c4fe){utils['error'](util[_0x9dbd('0x8')](_0x9dbd('0x3e'),_0x3870c8[_0x9dbd('0x15')]),_0xd6c4fe);}};exports[_0x9dbd('0x41')]=function(_0x13c70f){try{if(!_['isNil'](channels[_0x13c70f['uniqueid']])){utils[_0x9dbd('0x17')](util['format']('[%s][calls][varset]',_0x13c70f[_0x9dbd('0x15')]),_0x13c70f);if(!_[_0x9dbd('0x20')](_0x13c70f['variable']['xmd-originatecalleridnum'])){utils[_0x9dbd('0x7')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x13c70f[_0x9dbd('0x15')],_0x13c70f[_0x9dbd('0x42')]));channels[_0x13c70f[_0x9dbd('0x15')]][_0x9dbd('0x43')]=_0x13c70f[_0x9dbd('0x42')];}if(!_['isNil'](_0x13c70f[_0x9dbd('0x44')][_0x9dbd('0x45')])){utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x46'),_0x13c70f[_0x9dbd('0x15')],_0x13c70f[_0x9dbd('0x42')]));channels[_0x13c70f[_0x9dbd('0x15')]][_0x9dbd('0x47')]=_0x13c70f[_0x9dbd('0x42')];channels[_0x13c70f[_0x9dbd('0x15')]]['callerid']='\x22'+_0x13c70f[_0x9dbd('0x42')]+_0x9dbd('0x48')+_0x13c70f['value']+'>';}if(!_[_0x9dbd('0x20')](_0x13c70f[_0x9dbd('0x44')]['xmd-callerid-preview'])||!_[_0x9dbd('0x20')](_0x13c70f[_0x9dbd('0x44')]['xmd-callerid'])){utils[_0x9dbd('0x7')](util['format'](_0x9dbd('0x49'),_0x13c70f[_0x9dbd('0x15')],!_[_0x9dbd('0x20')](_0x13c70f['variable'][_0x9dbd('0x4a')])?_0x9dbd('0x4a'):_0x9dbd('0x4b'),_0x13c70f['value']));channels[_0x13c70f['uniqueid']]['callerid']=_0x13c70f[_0x9dbd('0x42')];}if(!_[_0x9dbd('0x20')](_0x13c70f[_0x9dbd('0x44')][_0x9dbd('0x4c')])||!_[_0x9dbd('0x20')](_0x13c70f[_0x9dbd('0x44')][_0x9dbd('0x4d')])){utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x13c70f[_0x9dbd('0x15')],!_[_0x9dbd('0x20')](_0x13c70f[_0x9dbd('0x44')][_0x9dbd('0x4c')])?_0x9dbd('0x4c'):_0x9dbd('0x4d'),_0x13c70f[_0x9dbd('0x42')]));channels[_0x13c70f['uniqueid']][_0x9dbd('0x4e')]=_0x9dbd('0x4f');channels[_0x13c70f['uniqueid']][_0x9dbd('0x50')]=_0x13c70f[_0x9dbd('0x42')];channels[_0x13c70f['uniqueid']][_0x9dbd('0xb')]=!![];}if(!_['isNil'](_0x13c70f[_0x9dbd('0x44')]['xmd-contactid'])){utils[_0x9dbd('0x7')](util['format'](_0x9dbd('0x51'),_0x13c70f[_0x9dbd('0x15')],_0x13c70f[_0x9dbd('0x42')]));channels[_0x13c70f[_0x9dbd('0x15')]]['ContactId']=_0x13c70f['value'];}if(!_['isNil'](_0x13c70f[_0x9dbd('0x44')][_0x9dbd('0x52')])){utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x53'),_0x13c70f[_0x9dbd('0x15')],_0x13c70f[_0x9dbd('0x42')]));channels[_0x13c70f[_0x9dbd('0x15')]][_0x9dbd('0x54')]=_0x13c70f[_0x9dbd('0x42')];}if(!_[_0x9dbd('0x20')](_0x13c70f[_0x9dbd('0x44')][_0x9dbd('0x55')])){utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x56'),_0x13c70f[_0x9dbd('0x15')],_0x13c70f[_0x9dbd('0x42')]));channels[_0x13c70f['uniqueid']][_0x9dbd('0x57')]=_0x13c70f[_0x9dbd('0x42')];}if(!_[_0x9dbd('0x20')](_0x13c70f[_0x9dbd('0x44')]['sipcallid'])){utils[_0x9dbd('0x7')](util['format'](_0x9dbd('0x58'),_0x13c70f[_0x9dbd('0x15')],_0x13c70f['value']));channels[_0x13c70f['uniqueid']]['sipcallid']=_0x13c70f['value'];}}}catch(_0x38c71b){utils[_0x9dbd('0x1e')](util['format'](_0x9dbd('0x59'),_0x13c70f[_0x9dbd('0x15')]),_0x38c71b);}};exports[_0x9dbd('0x5a')]=function(_0x7c2e88){try{if(!_[_0x9dbd('0x20')](channels[_0x7c2e88[_0x9dbd('0x15')]])){utils[_0x9dbd('0x17')](util[_0x9dbd('0x8')](_0x9dbd('0x5b'),_0x7c2e88[_0x9dbd('0x15')]),_0x7c2e88);utils[_0x9dbd('0x7')](util[_0x9dbd('0x8')](_0x9dbd('0x5c'),_0x7c2e88['uniqueid'],_0x7c2e88['application'],_0x7c2e88['appdata']));if(_0x7c2e88['application'][_0x9dbd('0x5d')]()=='set'&&_['startsWith'](_0x7c2e88[_0x9dbd('0x5e')][_0x9dbd('0x5d')](),_0x9dbd('0x5f'))){var _0x546981=_0x7c2e88[_0x9dbd('0x5e')][_0x9dbd('0x60')]('=');var _0x529db4=_0x546981[0x0]['substring'](_0x546981[0x0][_0x9dbd('0x61')]('(')+0x1,_0x546981[0x0]['lastIndexOf'](')'));var _0x42b099=_0x546981[0x1];channels[_0x7c2e88[_0x9dbd('0x15')]][_0x529db4]=_0x42b099;}if(!_['includes']([_0x9dbd('0x2a'),_0x9dbd('0x62'),'execif',_0x9dbd('0x63'),_0x9dbd('0x64')],_0x7c2e88['application'][_0x9dbd('0x5d')]())){channels[_0x7c2e88[_0x9dbd('0x15')]][_0x9dbd('0x4e')]=_0x7c2e88[_0x9dbd('0x65')];channels[_0x7c2e88[_0x9dbd('0x15')]]['lastdata']=_0x7c2e88['appdata'];}}}catch(_0x21e803){utils[_0x9dbd('0x1e')](util[_0x9dbd('0x8')](_0x9dbd('0x5b'),_0x7c2e88[_0x9dbd('0x15')]),_0x21e803);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index e419fa0..ca52bbb 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 _0x4afd=['fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','./utils','connect','[core]\x20connected','[core]\x20shutdown'];(function(_0x2d0669,_0x2a9c6e){var _0x1712e4=function(_0x4267fc){while(--_0x4267fc){_0x2d0669['push'](_0x2d0669['shift']());}};_0x1712e4(++_0x2a9c6e);}(_0x4afd,0x75));var _0xd4af=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4afd[_0x2b4411];return _0x8e41ef;};'use strict';var utils=require(_0xd4af('0x0'));exports[_0xd4af('0x1')]=function(){utils['info'](_0xd4af('0x2'));};exports['shutdown']=function(){utils['info'](_0xd4af('0x3'));};exports[_0xd4af('0x4')]=function(){utils[_0xd4af('0x5')](_0xd4af('0x6'));};exports[_0xd4af('0x7')]=function(_0x20e077){utils[_0xd4af('0x7')](_0xd4af('0x8'),_0x20e077);};exports[_0xd4af('0x9')]=function(){utils[_0xd4af('0x5')](_0xd4af('0xa'));};exports['managerevent']=function(_0x5a212d){}; \ No newline at end of file +var _0xd2df=['managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','error','[core]\x20error','close'];(function(_0x778318,_0x5b29c3){var _0x12942e=function(_0x4d17c8){while(--_0x4d17c8){_0x778318['push'](_0x778318['shift']());}};_0x12942e(++_0x5b29c3);}(_0xd2df,0xc9));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0xfd2d('0x0'));exports[_0xfd2d('0x1')]=function(){utils[_0xfd2d('0x2')](_0xfd2d('0x3'));};exports[_0xfd2d('0x4')]=function(){utils[_0xfd2d('0x2')](_0xfd2d('0x5'));};exports['fullybooted']=function(){utils[_0xfd2d('0x2')]('[core]\x20fullybooted');};exports[_0xfd2d('0x6')]=function(_0x2ed76b){utils['error'](_0xfd2d('0x7'),_0x2ed76b);};exports[_0xfd2d('0x8')]=function(){utils['info']('[core]\x20close');};exports[_0xfd2d('0x9')]=function(_0x414871){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 2007743..2b2a565 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 _0x7158=['startsWith','toLowerCase','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][dialend]','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','now','complete','duration','diffTime','endtime','billableseconds','[%s][dials][hangup]','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','set'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7158,0x147));var _0x8715=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x7158[_0x1e3671];return _0x48d5f5;};'use strict';var _=require(_0x8715('0x0'));var util=require(_0x8715('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x3105d3){utils[_0x8715('0x2')](util[_0x8715('0x3')](_0x8715('0x4'),_0x3105d3['uniqueid'],_0x3105d3['channel'],_0x3105d3[_0x8715('0x5')],_0x3105d3[_0x8715('0x6')],_0x3105d3[_0x8715('0x7')],_0x3105d3['dialstatus']));utils[_0x8715('0x8')](_0x8715('0x9'),_0x3105d3);delete dials[_0x3105d3[_0x8715('0xa')]];}exports[_0x8715('0xb')]=function(_0x5790a9){try{utils[_0x8715('0xc')](util[_0x8715('0x3')]('[%s][dials][newexten]',_0x5790a9[_0x8715('0xa')]),_0x5790a9);utils[_0x8715('0x2')](util[_0x8715('0x3')](_0x8715('0xd'),_0x5790a9[_0x8715('0xa')],_0x5790a9['application'],_0x5790a9[_0x8715('0xe')]));if(_0x5790a9['application']['toLowerCase']()==_0x8715('0xf')&&_[_0x8715('0x10')](_0x5790a9[_0x8715('0xe')][_0x8715('0x11')](),_0x8715('0x12'))){var _0x3d349f=_0x5790a9[_0x8715('0xe')][_0x8715('0x13')]('=');dials[_0x5790a9[_0x8715('0xa')]]={'routeId':_0x3d349f[0x1]};}}catch(_0x1b00c5){utils[_0x8715('0x14')](util['format']('[%s][dials][newexten]',_0x5790a9['uniqueid']),_0x1b00c5);}};exports[_0x8715('0x15')]=function(_0x11f9eb){try{utils[_0x8715('0xc')](util['format'](_0x8715('0x16'),_0x11f9eb['uniqueid']),_0x11f9eb);if(!_[_0x8715('0x17')](_0x11f9eb[_0x8715('0x18')][_0x8715('0x19')])){utils[_0x8715('0x2')](util[_0x8715('0x3')](_0x8715('0x1a'),_0x11f9eb[_0x8715('0xa')],_0x11f9eb['value']));dials[_0x11f9eb[_0x8715('0xa')]]={'routeId':_0x11f9eb[_0x8715('0x1b')]};}}catch(_0x4fc3c9){utils['error'](util[_0x8715('0x3')](_0x8715('0x16'),_0x11f9eb[_0x8715('0xa')]),_0x4fc3c9);}};exports[_0x8715('0x1c')]=function(_0x44c4d4){try{if(!_[_0x8715('0x17')](dials[_0x44c4d4[_0x8715('0xa')]])){utils[_0x8715('0xc')](util[_0x8715('0x3')](_0x8715('0x1d'),_0x44c4d4['uniqueid']),_0x44c4d4);dials[_0x44c4d4['uniqueid']]=_[_0x8715('0x1e')](dials[_0x44c4d4[_0x8715('0xa')]],_0x44c4d4);dials[_0x44c4d4[_0x8715('0xa')]][_0x8715('0x1f')]=utils['now']();dials[_0x44c4d4[_0x8715('0xa')]][_0x8715('0x20')]=_0x8715('0x21');utils[_0x8715('0x2')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x44c4d4[_0x8715('0xa')],dials[_0x44c4d4[_0x8715('0xa')]]['starttime']));}}catch(_0x315e1f){utils[_0x8715('0x14')](util['format'](_0x8715('0x1d'),_0x44c4d4['uniqueid']),_0x315e1f);}};exports['dialend']=function(_0x3214c3){try{if(!_['isNil'](dials[_0x3214c3[_0x8715('0xa')]])){utils[_0x8715('0xc')](util[_0x8715('0x3')](_0x8715('0x22'),_0x3214c3[_0x8715('0xa')]),_0x3214c3);dials[_0x3214c3['uniqueid']][_0x8715('0x23')]=_0x3214c3[_0x8715('0x23')];if(_0x3214c3[_0x8715('0x23')]==_0x8715('0x24')){dials[_0x3214c3['uniqueid']]=_['assign'](dials[_0x3214c3[_0x8715('0xa')]],_0x3214c3);dials[_0x3214c3[_0x8715('0xa')]][_0x8715('0x25')]=utils['now']();dials[_0x3214c3[_0x8715('0xa')]][_0x8715('0x20')]=_0x8715('0x26');utils[_0x8715('0x2')](util[_0x8715('0x3')](_0x8715('0x27'),_0x3214c3['uniqueid'],_0x3214c3[_0x8715('0x23')],dials[_0x3214c3['uniqueid']]['answertime']));}else{utils[_0x8715('0x2')](util[_0x8715('0x3')](_0x8715('0x28'),_0x3214c3[_0x8715('0xa')],_0x3214c3[_0x8715('0x23')]));}}}catch(_0x41f5bc){utils[_0x8715('0x14')](util[_0x8715('0x3')]('[%s][dials][dialend]',_0x3214c3[_0x8715('0xa')]),_0x41f5bc);}};exports[_0x8715('0x29')]=function(_0x3fe2c9){try{if(!_[_0x8715('0x17')](dials[_0x3fe2c9[_0x8715('0xa')]])){utils[_0x8715('0xc')](util[_0x8715('0x3')]('[%s][dials][hangup]',_0x3fe2c9[_0x8715('0xa')]),_0x3fe2c9);utils[_0x8715('0x2')](util[_0x8715('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x3fe2c9[_0x8715('0xa')],_0x3fe2c9[_0x8715('0x6')],_0x3fe2c9['calleridname'],_0x3fe2c9['cause-txt']));dials[_0x3fe2c9[_0x8715('0xa')]]=_['assign'](dials[_0x3fe2c9[_0x8715('0xa')]],{'endtime':utils[_0x8715('0x2a')](),'lastevent':_0x8715('0x2b')});dials[_0x3fe2c9['uniqueid']][_0x8715('0x2c')]=utils[_0x8715('0x2d')](dials[_0x3fe2c9[_0x8715('0xa')]][_0x8715('0x2e')],dials[_0x3fe2c9[_0x8715('0xa')]][_0x8715('0x1f')]);dials[_0x3fe2c9[_0x8715('0xa')]]['holdtime']=utils[_0x8715('0x2d')](dials[_0x3fe2c9[_0x8715('0xa')]][_0x8715('0x25')]||dials[_0x3fe2c9['uniqueid']][_0x8715('0x2e')],dials[_0x3fe2c9[_0x8715('0xa')]][_0x8715('0x1f')]);dials[_0x3fe2c9[_0x8715('0xa')]][_0x8715('0x2f')]=dials[_0x3fe2c9[_0x8715('0xa')]][_0x8715('0x25')]?utils[_0x8715('0x2d')](dials[_0x3fe2c9[_0x8715('0xa')]][_0x8715('0x2e')],dials[_0x3fe2c9[_0x8715('0xa')]]['answertime']):0x0;writeDB(dials[_0x3fe2c9['uniqueid']]);}}catch(_0x3c8c86){utils['error'](util['format'](_0x8715('0x30'),_0x3fe2c9[_0x8715('0xa')]),_0x3c8c86);}}; \ No newline at end of file +var _0xf82d=['calleridname','cause-txt','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','error','[%s][dials][varset]','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','isNil','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf82d,0x13f));var _0xdf82=function(_0x201fb1,_0x3543fd){_0x201fb1=_0x201fb1-0x0;var _0x5d0968=_0xf82d[_0x201fb1];return _0x5d0968;};'use strict';var _=require(_0xdf82('0x0'));var util=require(_0xdf82('0x1'));var utils=require(_0xdf82('0x2'));var dials={};function writeDB(_0x5aa722){utils[_0xdf82('0x3')](util[_0xdf82('0x4')](_0xdf82('0x5'),_0x5aa722[_0xdf82('0x6')],_0x5aa722[_0xdf82('0x7')],_0x5aa722['dialstring'],_0x5aa722['calleridnum'],_0x5aa722[_0xdf82('0x8')],_0x5aa722[_0xdf82('0x9')]));utils[_0xdf82('0xa')](_0xdf82('0xb'),_0x5aa722);delete dials[_0x5aa722['uniqueid']];}exports[_0xdf82('0xc')]=function(_0x537f73){try{utils[_0xdf82('0xd')](util[_0xdf82('0x4')](_0xdf82('0xe'),_0x537f73['uniqueid']),_0x537f73);utils['info'](util[_0xdf82('0x4')](_0xdf82('0xf'),_0x537f73[_0xdf82('0x6')],_0x537f73[_0xdf82('0x10')],_0x537f73[_0xdf82('0x11')]));if(_0x537f73[_0xdf82('0x10')][_0xdf82('0x12')]()==_0xdf82('0x13')&&_[_0xdf82('0x14')](_0x537f73[_0xdf82('0x11')][_0xdf82('0x12')](),'cdr(routeid)')){var _0x905253=_0x537f73['appdata'][_0xdf82('0x15')]('=');dials[_0x537f73[_0xdf82('0x6')]]={'routeId':_0x905253[0x1]};}}catch(_0x479672){utils[_0xdf82('0x16')](util[_0xdf82('0x4')](_0xdf82('0xe'),_0x537f73[_0xdf82('0x6')]),_0x479672);}};exports['varset']=function(_0x274a13){try{utils['debug'](util['format'](_0xdf82('0x17'),_0x274a13[_0xdf82('0x6')]),_0x274a13);if(!_['isNil'](_0x274a13['variable'][_0xdf82('0x18')])){utils[_0xdf82('0x3')](util[_0xdf82('0x4')](_0xdf82('0x19'),_0x274a13[_0xdf82('0x6')],_0x274a13[_0xdf82('0x1a')]));dials[_0x274a13['uniqueid']]={'routeId':_0x274a13[_0xdf82('0x1a')]};}}catch(_0x2fc14a){utils['error'](util[_0xdf82('0x4')](_0xdf82('0x17'),_0x274a13[_0xdf82('0x6')]),_0x2fc14a);}};exports[_0xdf82('0x1b')]=function(_0x3cb5ed){try{if(!_['isNil'](dials[_0x3cb5ed['uniqueid']])){utils['debug'](util[_0xdf82('0x4')](_0xdf82('0x1c'),_0x3cb5ed[_0xdf82('0x6')]),_0x3cb5ed);dials[_0x3cb5ed[_0xdf82('0x6')]]=_[_0xdf82('0x1d')](dials[_0x3cb5ed[_0xdf82('0x6')]],_0x3cb5ed);dials[_0x3cb5ed[_0xdf82('0x6')]][_0xdf82('0x1e')]=utils['now']();dials[_0x3cb5ed['uniqueid']][_0xdf82('0x1f')]=_0xdf82('0x20');utils[_0xdf82('0x3')](util[_0xdf82('0x4')](_0xdf82('0x21'),_0x3cb5ed[_0xdf82('0x6')],dials[_0x3cb5ed['uniqueid']][_0xdf82('0x1e')]));}}catch(_0x5b53cf){utils[_0xdf82('0x16')](util[_0xdf82('0x4')](_0xdf82('0x1c'),_0x3cb5ed[_0xdf82('0x6')]),_0x5b53cf);}};exports[_0xdf82('0x22')]=function(_0x168dea){try{if(!_['isNil'](dials[_0x168dea[_0xdf82('0x6')]])){utils[_0xdf82('0xd')](util[_0xdf82('0x4')]('[%s][dials][dialend]',_0x168dea[_0xdf82('0x6')]),_0x168dea);dials[_0x168dea['uniqueid']]['dialstatus']=_0x168dea['dialstatus'];if(_0x168dea['dialstatus']=='ANSWER'){dials[_0x168dea[_0xdf82('0x6')]]=_['assign'](dials[_0x168dea['uniqueid']],_0x168dea);dials[_0x168dea[_0xdf82('0x6')]][_0xdf82('0x23')]=utils[_0xdf82('0x24')]();dials[_0x168dea[_0xdf82('0x6')]][_0xdf82('0x1f')]=_0xdf82('0x25');utils['info'](util[_0xdf82('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x168dea[_0xdf82('0x6')],_0x168dea[_0xdf82('0x9')],dials[_0x168dea[_0xdf82('0x6')]][_0xdf82('0x23')]));}else{utils[_0xdf82('0x3')](util['format'](_0xdf82('0x26'),_0x168dea[_0xdf82('0x6')],_0x168dea['dialstatus']));}}}catch(_0x598591){utils[_0xdf82('0x16')](util[_0xdf82('0x4')](_0xdf82('0x27'),_0x168dea['uniqueid']),_0x598591);}};exports[_0xdf82('0x28')]=function(_0x45475f){try{if(!_[_0xdf82('0x29')](dials[_0x45475f[_0xdf82('0x6')]])){utils[_0xdf82('0xd')](util[_0xdf82('0x4')](_0xdf82('0x2a'),_0x45475f[_0xdf82('0x6')]),_0x45475f);utils[_0xdf82('0x3')](util['format'](_0xdf82('0x2b'),_0x45475f['uniqueid'],_0x45475f[_0xdf82('0x2c')],_0x45475f[_0xdf82('0x2d')],_0x45475f[_0xdf82('0x2e')]));dials[_0x45475f[_0xdf82('0x6')]]=_['assign'](dials[_0x45475f[_0xdf82('0x6')]],{'endtime':utils[_0xdf82('0x24')](),'lastevent':'complete'});dials[_0x45475f[_0xdf82('0x6')]][_0xdf82('0x2f')]=utils[_0xdf82('0x30')](dials[_0x45475f[_0xdf82('0x6')]][_0xdf82('0x31')],dials[_0x45475f['uniqueid']]['starttime']);dials[_0x45475f[_0xdf82('0x6')]][_0xdf82('0x32')]=utils[_0xdf82('0x30')](dials[_0x45475f['uniqueid']][_0xdf82('0x23')]||dials[_0x45475f[_0xdf82('0x6')]][_0xdf82('0x31')],dials[_0x45475f[_0xdf82('0x6')]]['starttime']);dials[_0x45475f['uniqueid']][_0xdf82('0x33')]=dials[_0x45475f[_0xdf82('0x6')]][_0xdf82('0x23')]?utils[_0xdf82('0x30')](dials[_0x45475f[_0xdf82('0x6')]][_0xdf82('0x31')],dials[_0x45475f['uniqueid']][_0xdf82('0x23')]):0x0;writeDB(dials[_0x45475f[_0xdf82('0x6')]]);}}catch(_0x1122f6){utils[_0xdf82('0x16')](util[_0xdf82('0x4')](_0xdf82('0x2a'),_0x45475f['uniqueid']),_0x1122f6);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 7c4d0e7..e9126a6 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 _0x0120=['origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x0120,0x172));var _0x0012=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x0120[_0x164eca];return _0x2ce562;};var AsteriskManager=require(_0x0012('0x0'));var config=require(_0x0012('0x1'));var utils=require(_0x0012('0x2'));var util=require(_0x0012('0x3'));var isXDREnabled=config[_0x0012('0x4')]&&config[_0x0012('0x4')][_0x0012('0x5')]?!config[_0x0012('0x4')][_0x0012('0x5')]:!![];var isProduction=config['env']===_0x0012('0x6')||![];var isLocalAsterisk=config[_0x0012('0x4')]&&config[_0x0012('0x4')][_0x0012('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x0012('0x8')][_0x0012('0x9')],config[_0x0012('0x8')]['ip'],config[_0x0012('0x8')][_0x0012('0xa')],config[_0x0012('0x8')][_0x0012('0xb')],!![]);ami[_0x0012('0xc')]();if(!isXDREnabled){utils[_0x0012('0xd')](_0x0012('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x0012('0xd')](_0x0012('0xf'));}else{var agents=require(_0x0012('0x10'));var calls=require('./calls.controller');var queues=require(_0x0012('0x11'));var recordings=require(_0x0012('0x12'));var members=require(_0x0012('0x13'));var dials=require(_0x0012('0x14'));var transfers=require(_0x0012('0x15'));var core=require(_0x0012('0x16'));ami['on'](_0x0012('0x17'),core[_0x0012('0x17')]);ami['on'](_0x0012('0x18'),core[_0x0012('0x18')]);ami['on'](_0x0012('0x19'),core[_0x0012('0x19')]);ami['on']('error',core[_0x0012('0x1a')]);ami['on'](_0x0012('0x1b'),core[_0x0012('0x1b')]);ami['on'](_0x0012('0x1c'),core[_0x0012('0x1c')]);ami['on'](_0x0012('0x1d'),function(_0x5c2dd7){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x20'),_0x5c2dd7[_0x0012('0x21')]),_0x5c2dd7);members['devicestatechange'](_0x5c2dd7);}catch(_0x522a48){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x20'),_0x5c2dd7['device']),_0x522a48);}});ami['on'](_0x0012('0x22'),function(_0x1d891b){try{utils[_0x0012('0x1e')](util['format'](_0x0012('0x23'),_0x1d891b['uniqueid']),_0x1d891b);agents[_0x0012('0x22')](_0x1d891b);}catch(_0x366db5){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x23'),_0x1d891b[_0x0012('0x24')]),_0x366db5);}});ami['on'](_0x0012('0x25'),function(_0xb46c54){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')]('[%s][index][agentringnoanswer]',_0xb46c54[_0x0012('0x24')]),_0xb46c54);agents[_0x0012('0x25')](_0xb46c54);}catch(_0x9ea0ed){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x26'),_0xb46c54[_0x0012('0x24')]),_0x9ea0ed);}});ami['on']('agentconnect',function(_0x1632c9){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x27'),_0x1632c9[_0x0012('0x24')]),_0x1632c9);agents[_0x0012('0x28')](_0x1632c9);queues[_0x0012('0x28')](_0x1632c9);}catch(_0x1d7ad8){utils['error'](util[_0x0012('0x1f')](_0x0012('0x27'),_0x1632c9[_0x0012('0x24')]),_0x1d7ad8);}});ami['on']('agentcomplete',function(_0x2e52bb){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x29'),_0x2e52bb[_0x0012('0x24')]),_0x2e52bb);agents['agentcomplete'](_0x2e52bb);queues[_0x0012('0x2a')](_0x2e52bb);members[_0x0012('0x2a')](_0x2e52bb);}catch(_0x2c6853){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x29'),_0x2e52bb['uniqueid']),_0x2c6853);}});ami['on'](_0x0012('0x2b'),function(_0x4829f8){try{utils['debug'](util['format'](_0x0012('0x2c'),_0x4829f8[_0x0012('0x24')]),_0x4829f8);agents[_0x0012('0x2b')](_0x4829f8);queues[_0x0012('0x2b')](_0x4829f8);}catch(_0x3e56d8){utils[_0x0012('0x1a')](util['format'](_0x0012('0x2c'),_0x4829f8[_0x0012('0x24')]),_0x3e56d8);}});ami['on'](_0x0012('0x2d'),function(_0x508294){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x2e'),_0x508294['uniqueid']),_0x508294);queues[_0x0012('0x2d')](_0x508294);recordings[_0x0012('0x2d')](_0x508294);}catch(_0x396d30){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x2e'),_0x508294[_0x0012('0x24')]),_0x396d30);}});ami['on'](_0x0012('0x2f'),function(_0x3f1bce){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x30'),_0x3f1bce[_0x0012('0x24')]),_0x3f1bce);queues['queuecallerleave'](_0x3f1bce);}catch(_0x556a90){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x30'),_0x3f1bce['uniqueid']),_0x556a90);}});ami['on'](_0x0012('0x31'),function(_0x227cda){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')]('[%s][index][musiconholdstart]',_0x227cda[_0x0012('0x24')]),_0x227cda);queues[_0x0012('0x31')](_0x227cda);calls[_0x0012('0x31')](_0x227cda);}catch(_0x51e4d8){utils[_0x0012('0x1a')](util['format'](_0x0012('0x32'),_0x227cda[_0x0012('0x24')]),_0x51e4d8);}});ami['on']('musiconholdstop',function(_0xb9ad14){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x33'),_0xb9ad14[_0x0012('0x24')]),_0xb9ad14);queues[_0x0012('0x34')](_0xb9ad14);calls['musiconholdstop'](_0xb9ad14);}catch(_0x24f1fe){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x33'),_0xb9ad14[_0x0012('0x24')]),_0x24f1fe);}});ami['on'](_0x0012('0x35'),function(_0x129a22){try{utils[_0x0012('0x1e')](util['format']('[%s][index][newstate]',_0x129a22['uniqueid']),_0x129a22);calls['newstate'](_0x129a22);recordings['newstate'](_0x129a22);}catch(_0x4c24ca){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x36'),_0x129a22[_0x0012('0x24')]),_0x4c24ca);}});ami['on'](_0x0012('0x37'),function(_0x46259a){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x38'),_0x46259a[_0x0012('0x24')]),_0x46259a);calls[_0x0012('0x37')](_0x46259a);recordings[_0x0012('0x37')](_0x46259a);dials[_0x0012('0x37')](_0x46259a);agents[_0x0012('0x37')](_0x46259a);queues[_0x0012('0x37')](_0x46259a);}catch(_0x1ebb8d){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x38'),_0x46259a[_0x0012('0x24')]),_0x1ebb8d);}});ami['on']('cdr',function(_0x5e6168){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x39'),_0x5e6168[_0x0012('0x24')]),_0x5e6168);members[_0x0012('0x3a')](_0x5e6168);}catch(_0x130d5f){utils[_0x0012('0x1a')](util[_0x0012('0x1f')](_0x0012('0x39'),_0x5e6168['uniqueid']),_0x130d5f);}});ami['on'](_0x0012('0x3b'),function(_0x37ad8b){try{utils[_0x0012('0x1e')](util['format'](_0x0012('0x3c'),_0x37ad8b[_0x0012('0x24')]),_0x37ad8b);queues[_0x0012('0x3b')](_0x37ad8b);agents[_0x0012('0x3b')](_0x37ad8b);transfers[_0x0012('0x3b')](_0x37ad8b);}catch(_0x22c68a){utils[_0x0012('0x1a')](util['format'](_0x0012('0x3c'),_0x37ad8b[_0x0012('0x24')]),_0x22c68a);}});ami['on'](_0x0012('0x3d'),function(_0x2110dd){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')]('[%s][index][attendedtransfer]',_0x2110dd[_0x0012('0x3e')]),_0x2110dd);queues[_0x0012('0x3d')](_0x2110dd);transfers[_0x0012('0x3d')](_0x2110dd);agents['attendedtransfer'](_0x2110dd);calls[_0x0012('0x3d')](_0x2110dd);}catch(_0xbd8d85){utils['error'](util['format']('[%s][index][attendedtransfer]',_0x2110dd[_0x0012('0x3e')]),_0xbd8d85);}});ami['on'](_0x0012('0x3f'),function(_0x4a9b80){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x40'),_0x4a9b80[_0x0012('0x24')]),_0x4a9b80);queues[_0x0012('0x3f')](_0x4a9b80);recordings['varset'](_0x4a9b80);calls[_0x0012('0x3f')](_0x4a9b80);dials['varset'](_0x4a9b80);}catch(_0x31a0b3){utils[_0x0012('0x1a')](util['format'](_0x0012('0x40'),_0x4a9b80['uniqueid']),_0x31a0b3);}});ami['on'](_0x0012('0x41'),function(_0x448063){try{utils['debug'](util['format']('[%s][index][newexten]',_0x448063[_0x0012('0x24')]),_0x448063);calls[_0x0012('0x41')](_0x448063);recordings[_0x0012('0x41')](_0x448063);dials[_0x0012('0x41')](_0x448063);}catch(_0x499be2){utils['error'](util['format'](_0x0012('0x42'),_0x448063[_0x0012('0x24')]),_0x499be2);}});ami['on']('newchannel',function(_0x1bf03f){try{utils[_0x0012('0x1e')](util[_0x0012('0x1f')](_0x0012('0x43'),_0x1bf03f[_0x0012('0x24')]),_0x1bf03f);calls[_0x0012('0x44')](_0x1bf03f);recordings[_0x0012('0x44')](_0x1bf03f);}catch(_0x1e909d){utils[_0x0012('0x1a')](util['format'](_0x0012('0x43'),_0x1bf03f[_0x0012('0x24')]),_0x1e909d);}});ami['on'](_0x0012('0x45'),function(_0x5bf175){try{utils['debug'](util[_0x0012('0x1f')](_0x0012('0x46'),_0x5bf175[_0x0012('0x24')]),_0x5bf175);dials['dialbegin'](_0x5bf175);}catch(_0x50c3dc){utils[_0x0012('0x1a')](util[_0x0012('0x1f')]('[%s]dialbegin',_0x5bf175[_0x0012('0x24')]),_0x50c3dc);}});ami['on'](_0x0012('0x47'),function(_0xa59f32){try{utils['debug'](util['format']('[%s][index][dialend]',_0xa59f32[_0x0012('0x24')]),_0xa59f32);dials[_0x0012('0x47')](_0xa59f32);}catch(_0x391a2c){utils[_0x0012('0x1a')](util[_0x0012('0x1f')]('[%s][index][dialend]',_0xa59f32['uniqueid']),_0x391a2c);}});} \ No newline at end of file +var _0x513f=['[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','[%s][index][dialbegin]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','env','production','local','asterisk','username','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]'];(function(_0x8895d8,_0x397458){var _0x16144b=function(_0x3d70ce){while(--_0x3d70ce){_0x8895d8['push'](_0x8895d8['shift']());}};_0x16144b(++_0x397458);}(_0x513f,0x13c));var _0xf513=function(_0x3b22e6,_0x3acc05){_0x3b22e6=_0x3b22e6-0x0;var _0x3809b0=_0x513f[_0x3b22e6];return _0x3809b0;};var AsteriskManager=require(_0xf513('0x0'));var config=require(_0xf513('0x1'));var utils=require('./utils');var util=require(_0xf513('0x2'));var isXDREnabled=config[_0xf513('0x3')]&&config[_0xf513('0x3')][_0xf513('0x4')]?!config[_0xf513('0x3')][_0xf513('0x4')]:!![];var isProduction=config[_0xf513('0x5')]===_0xf513('0x6')||![];var isLocalAsterisk=config[_0xf513('0x3')]&&config[_0xf513('0x3')][_0xf513('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xf513('0x8')]['port'],config[_0xf513('0x8')]['ip'],config['asterisk'][_0xf513('0x9')],config[_0xf513('0x8')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0xf513('0xa')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xf513('0xa')](_0xf513('0xb'));}else{var agents=require(_0xf513('0xc'));var calls=require(_0xf513('0xd'));var queues=require('./queues.controller');var recordings=require(_0xf513('0xe'));var members=require(_0xf513('0xf'));var dials=require(_0xf513('0x10'));var transfers=require(_0xf513('0x11'));var core=require(_0xf513('0x12'));ami['on'](_0xf513('0x13'),core[_0xf513('0x13')]);ami['on'](_0xf513('0x14'),core[_0xf513('0x14')]);ami['on'](_0xf513('0x15'),core[_0xf513('0x15')]);ami['on'](_0xf513('0x16'),core[_0xf513('0x16')]);ami['on'](_0xf513('0x17'),core[_0xf513('0x17')]);ami['on'](_0xf513('0x18'),core[_0xf513('0x18')]);ami['on'](_0xf513('0x19'),function(_0x139b6a){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x1c'),_0x139b6a['device']),_0x139b6a);members[_0xf513('0x19')](_0x139b6a);}catch(_0x5c7034){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x1c'),_0x139b6a['device']),_0x5c7034);}});ami['on']('agentcalled',function(_0xded58a){try{utils['debug'](util[_0xf513('0x1b')](_0xf513('0x1d'),_0xded58a[_0xf513('0x1e')]),_0xded58a);agents[_0xf513('0x1f')](_0xded58a);}catch(_0x3a5d9e){utils['error'](util[_0xf513('0x1b')](_0xf513('0x1d'),_0xded58a[_0xf513('0x1e')]),_0x3a5d9e);}});ami['on'](_0xf513('0x20'),function(_0x313d40){try{utils[_0xf513('0x1a')](util['format'](_0xf513('0x21'),_0x313d40['uniqueid']),_0x313d40);agents[_0xf513('0x20')](_0x313d40);}catch(_0x4410d9){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x21'),_0x313d40[_0xf513('0x1e')]),_0x4410d9);}});ami['on'](_0xf513('0x22'),function(_0x25e8c3){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')]('[%s][index][agentconnect]',_0x25e8c3[_0xf513('0x1e')]),_0x25e8c3);agents[_0xf513('0x22')](_0x25e8c3);queues[_0xf513('0x22')](_0x25e8c3);}catch(_0x5c7f3a){utils['error'](util[_0xf513('0x1b')](_0xf513('0x23'),_0x25e8c3['uniqueid']),_0x5c7f3a);}});ami['on'](_0xf513('0x24'),function(_0x1b27f3){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x25'),_0x1b27f3[_0xf513('0x1e')]),_0x1b27f3);agents['agentcomplete'](_0x1b27f3);queues[_0xf513('0x24')](_0x1b27f3);members[_0xf513('0x24')](_0x1b27f3);}catch(_0x3cc9a1){utils[_0xf513('0x16')](util['format'](_0xf513('0x25'),_0x1b27f3[_0xf513('0x1e')]),_0x3cc9a1);}});ami['on'](_0xf513('0x26'),function(_0x1b805a){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')]('[%s][index][queuecallerabandon]',_0x1b805a['uniqueid']),_0x1b805a);agents['queuecallerabandon'](_0x1b805a);queues[_0xf513('0x26')](_0x1b805a);}catch(_0x27ebb6){utils[_0xf513('0x16')](util['format'](_0xf513('0x27'),_0x1b805a['uniqueid']),_0x27ebb6);}});ami['on']('queuecallerjoin',function(_0x2845df){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')]('[%s][index][queuecallerjoin]',_0x2845df['uniqueid']),_0x2845df);queues[_0xf513('0x28')](_0x2845df);recordings[_0xf513('0x28')](_0x2845df);}catch(_0x3fdc26){utils['error'](util[_0xf513('0x1b')](_0xf513('0x29'),_0x2845df[_0xf513('0x1e')]),_0x3fdc26);}});ami['on'](_0xf513('0x2a'),function(_0x144cfb){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x2b'),_0x144cfb['uniqueid']),_0x144cfb);queues[_0xf513('0x2a')](_0x144cfb);}catch(_0x410789){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x2b'),_0x144cfb['uniqueid']),_0x410789);}});ami['on'](_0xf513('0x2c'),function(_0x3f4755){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x2d'),_0x3f4755[_0xf513('0x1e')]),_0x3f4755);queues[_0xf513('0x2c')](_0x3f4755);calls[_0xf513('0x2c')](_0x3f4755);}catch(_0x5dd220){utils[_0xf513('0x16')](util['format'](_0xf513('0x2d'),_0x3f4755[_0xf513('0x1e')]),_0x5dd220);}});ami['on'](_0xf513('0x2e'),function(_0x223de2){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x2f'),_0x223de2[_0xf513('0x1e')]),_0x223de2);queues[_0xf513('0x2e')](_0x223de2);calls[_0xf513('0x2e')](_0x223de2);}catch(_0x59142b){utils[_0xf513('0x16')](util[_0xf513('0x1b')]('[%s][index][musiconholdstop]',_0x223de2[_0xf513('0x1e')]),_0x59142b);}});ami['on']('newstate',function(_0x362e09){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x30'),_0x362e09[_0xf513('0x1e')]),_0x362e09);calls[_0xf513('0x31')](_0x362e09);recordings[_0xf513('0x31')](_0x362e09);}catch(_0x32b5b7){utils[_0xf513('0x16')](util[_0xf513('0x1b')]('[%s][index][newstate]',_0x362e09[_0xf513('0x1e')]),_0x32b5b7);}});ami['on'](_0xf513('0x32'),function(_0x252fd8){try{utils['debug'](util[_0xf513('0x1b')]('[%s][index][hangup]',_0x252fd8[_0xf513('0x1e')]),_0x252fd8);calls[_0xf513('0x32')](_0x252fd8);recordings[_0xf513('0x32')](_0x252fd8);dials[_0xf513('0x32')](_0x252fd8);agents[_0xf513('0x32')](_0x252fd8);queues[_0xf513('0x32')](_0x252fd8);}catch(_0x2c4dbf){utils['error'](util[_0xf513('0x1b')](_0xf513('0x33'),_0x252fd8['uniqueid']),_0x2c4dbf);}});ami['on'](_0xf513('0x34'),function(_0x3ede9e){try{utils['debug'](util[_0xf513('0x1b')](_0xf513('0x35'),_0x3ede9e['uniqueid']),_0x3ede9e);members[_0xf513('0x34')](_0x3ede9e);}catch(_0x1ded9a){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x35'),_0x3ede9e[_0xf513('0x1e')]),_0x1ded9a);}});ami['on'](_0xf513('0x36'),function(_0x5d3b66){try{utils['debug'](util[_0xf513('0x1b')](_0xf513('0x37'),_0x5d3b66[_0xf513('0x1e')]),_0x5d3b66);queues[_0xf513('0x36')](_0x5d3b66);agents['blindtransfer'](_0x5d3b66);transfers['blindtransfer'](_0x5d3b66);}catch(_0x21f167){utils['error'](util['format'](_0xf513('0x37'),_0x5d3b66[_0xf513('0x1e')]),_0x21f167);}});ami['on']('attendedtransfer',function(_0x256e0e){try{utils['debug'](util[_0xf513('0x1b')]('[%s][index][attendedtransfer]',_0x256e0e['origtransfereruniqueid']),_0x256e0e);queues[_0xf513('0x38')](_0x256e0e);transfers[_0xf513('0x38')](_0x256e0e);agents[_0xf513('0x38')](_0x256e0e);calls[_0xf513('0x38')](_0x256e0e);}catch(_0x397816){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x39'),_0x256e0e[_0xf513('0x3a')]),_0x397816);}});ami['on'](_0xf513('0x3b'),function(_0x524d7f){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x3c'),_0x524d7f[_0xf513('0x1e')]),_0x524d7f);queues[_0xf513('0x3b')](_0x524d7f);recordings[_0xf513('0x3b')](_0x524d7f);calls[_0xf513('0x3b')](_0x524d7f);dials['varset'](_0x524d7f);}catch(_0x5b03e3){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x3c'),_0x524d7f[_0xf513('0x1e')]),_0x5b03e3);}});ami['on'](_0xf513('0x3d'),function(_0x2addf9){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x3e'),_0x2addf9[_0xf513('0x1e')]),_0x2addf9);calls['newexten'](_0x2addf9);recordings[_0xf513('0x3d')](_0x2addf9);dials[_0xf513('0x3d')](_0x2addf9);}catch(_0x22b09b){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x3e'),_0x2addf9[_0xf513('0x1e')]),_0x22b09b);}});ami['on']('newchannel',function(_0x58cc25){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x3f'),_0x58cc25[_0xf513('0x1e')]),_0x58cc25);calls[_0xf513('0x40')](_0x58cc25);recordings['newchannel'](_0x58cc25);}catch(_0x504481){utils['error'](util['format']('[%s][index][newchannel]',_0x58cc25[_0xf513('0x1e')]),_0x504481);}});ami['on']('dialbegin',function(_0x318e93){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')](_0xf513('0x41'),_0x318e93['uniqueid']),_0x318e93);dials[_0xf513('0x42')](_0x318e93);}catch(_0x1ca99c){utils['error'](util['format']('[%s]dialbegin',_0x318e93[_0xf513('0x1e')]),_0x1ca99c);}});ami['on'](_0xf513('0x43'),function(_0x427760){try{utils[_0xf513('0x1a')](util[_0xf513('0x1b')]('[%s][index][dialend]',_0x427760[_0xf513('0x1e')]),_0x427760);dials[_0xf513('0x43')](_0x427760);}catch(_0x262346){utils[_0xf513('0x16')](util[_0xf513('0x1b')](_0xf513('0x44'),_0x427760[_0xf513('0x1e')]),_0x262346);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index f5f8d27..bcb57ff 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 _0x94b6=['isNil','duration','diffTime','exitAt','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','source','destination','data1','destinationchannel','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','catch','error','[%s][members][writeDB]','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','now','agent','NOT_INUSE'];(function(_0x77e0eb,_0x18a068){var _0x1c7991=function(_0x235fc3){while(--_0x235fc3){_0x77e0eb['push'](_0x77e0eb['shift']());}};_0x1c7991(++_0x18a068);}(_0x94b6,0x143));var _0x694b=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0x94b6[_0x291f8b];return _0x275171;};'use strict';var _=require(_0x694b('0x0'));var util=require(_0x694b('0x1'));var utils=require('./utils');var members={};var exclude=[_0x694b('0x2'),_0x694b('0x3')];function writeDB(_0x22f97c){utils[_0x694b('0x4')](util[_0x694b('0x5')](_0x694b('0x6'),_0x22f97c[_0x694b('0x7')],_0x22f97c['interface'],_0x22f97c[_0x694b('0x8')],_0x22f97c[_0x694b('0x9')],_0x22f97c[_0x694b('0xa')],_0x22f97c[_0x694b('0xb')]));if(_0x22f97c[_0x694b('0xc')]){utils[_0x694b('0xd')](_0x22f97c['interface'])[_0x694b('0xe')](function(_0x5be999){if(_0x5be999){_0x22f97c['membername']=_0x5be999[_0x694b('0xf')];_0x22f97c[_0x694b('0x10')]=_0x5be999[_0x694b('0x10')];utils[_0x694b('0x11')](_0x694b('0x12'),_0x22f97c);}else{utils[_0x694b('0x13')](_0x22f97c[_0x694b('0xc')]['split']('/')[0x1])[_0x694b('0xe')](function(_0x454a83){if(_0x454a83){_0x22f97c[_0x694b('0xa')]=_0x454a83[_0x694b('0xf')];_0x22f97c[_0x694b('0x10')]=_0x454a83['internal'];utils[_0x694b('0x11')](_0x694b('0x12'),_0x22f97c);}});}})[_0x694b('0x14')](function(_0x435706){utils[_0x694b('0x15')](util[_0x694b('0x5')](_0x694b('0x16'),_0x22f97c[_0x694b('0x7')]),_0x435706);});}delete members[_0x22f97c[_0x694b('0xc')]];}function startsWith(_0x21e6af,_0x257621){return _[_0x694b('0x17')](_0x21e6af,function(_0x199b16){return _['startsWith'](_0x257621,_0x199b16);});}exports['devicestatechange']=function(_0x42915c){try{utils[_0x694b('0x18')](util[_0x694b('0x5')](_0x694b('0x19'),members[_0x42915c[_0x694b('0x1a')]]?members[_0x42915c[_0x694b('0x1a')]][_0x694b('0x7')]:_0x42915c['device']),_0x42915c);utils[_0x694b('0x4')](util['format'](_0x694b('0x1b'),members[_0x42915c[_0x694b('0x1a')]]?members[_0x42915c['device']][_0x694b('0x7')]:_0x42915c[_0x694b('0x1a')],_0x42915c['state'],_0x42915c['device']));switch(_0x42915c[_0x694b('0x1c')]){case _0x694b('0x1d'):case _0x694b('0x1e'):if(!startsWith(exclude,_0x42915c['device'])){members[_0x42915c[_0x694b('0x1a')]]={'channel':'voice','interface':_0x42915c[_0x694b('0x1a')],'type':'TALKING','enterAt':utils[_0x694b('0x1f')](),'role':_0x694b('0x20')};}break;case _0x694b('0x21'):if(!_[_0x694b('0x22')](members[_0x42915c[_0x694b('0x1a')]])){members[_0x42915c[_0x694b('0x1a')]]['exitAt']=utils['now']();members[_0x42915c[_0x694b('0x1a')]][_0x694b('0x23')]=utils[_0x694b('0x24')](members[_0x42915c[_0x694b('0x1a')]][_0x694b('0x25')],members[_0x42915c[_0x694b('0x1a')]][_0x694b('0x26')]);if(members[_0x42915c[_0x694b('0x1a')]][_0x694b('0x7')]){writeDB(members[_0x42915c['device']]);}}break;default:break;}}catch(_0x1dd3cf){utils[_0x694b('0x15')](util[_0x694b('0x5')]('[%s][members][devicestatechange]',members[_0x42915c['device']]?members[_0x42915c[_0x694b('0x1a')]][_0x694b('0x7')]:_0x42915c[_0x694b('0x1a')]),_0x1dd3cf);}};exports['agentcomplete']=function(_0x28df30){try{if(!_[_0x694b('0x22')](members[_0x28df30[_0x694b('0xc')]])){utils[_0x694b('0x18')](util[_0x694b('0x5')](_0x694b('0x27'),_0x28df30[_0x694b('0x7')]),_0x28df30);utils['info'](util[_0x694b('0x5')](_0x694b('0x28'),_0x28df30[_0x694b('0x7')],_0x28df30[_0x694b('0xc')],_0x28df30['queue']));members[_0x28df30[_0x694b('0xc')]]=_[_0x694b('0x29')](members[_0x28df30[_0x694b('0xc')]],{'data4':_0x28df30[_0x694b('0x2a')],'uniqueid':_0x28df30[_0x694b('0x7')]});}}catch(_0x683205){utils[_0x694b('0x15')](util['format'](_0x694b('0x27'),_0x28df30[_0x694b('0x7')]),_0x683205);}};exports[_0x694b('0x2b')]=function(_0x246250){try{utils['debug'](util[_0x694b('0x5')](_0x694b('0x2c'),_0x246250[_0x694b('0x7')]),_0x246250);if(_0x246250[_0x694b('0x8')]){var _0x2c0220=_0x246250['channel']['split']('-')[0x0];if(!_[_0x694b('0x22')](members[_0x2c0220])){members[_0x2c0220]=_[_0x694b('0x29')](members[_0x2c0220],{'data1':members[_0x2c0220]['data1']||_0x246250[_0x694b('0xb')],'data2':members[_0x2c0220][_0x694b('0x9')]||_0x246250[_0x694b('0x2d')],'data3':members[_0x2c0220]['data3']||_0x246250[_0x694b('0x2e')],'uniqueid':members[_0x2c0220]['uniqueid']||_0x246250[_0x694b('0x7')]});utils[_0x694b('0x4')](util[_0x694b('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x246250[_0x694b('0x7')],members[_0x2c0220][_0x694b('0x2f')],members[_0x2c0220][_0x694b('0x9')],members[_0x2c0220]['data3']));if(members[_0x2c0220][_0x694b('0x25')]){writeDB(members[_0x2c0220]);}}}if(_0x246250[_0x694b('0x30')]){var _0x8f52a=_0x246250[_0x694b('0x30')]['split']('-')[0x0];if(!_[_0x694b('0x22')](members[_0x8f52a])){members[_0x8f52a]=_['assign'](members[_0x8f52a],{'data1':members[_0x8f52a]['data1']||_0x246250[_0x694b('0xb')],'data2':members[_0x8f52a][_0x694b('0x9')]||_0x246250[_0x694b('0x2d')],'data3':members[_0x8f52a][_0x694b('0x31')]||_0x246250[_0x694b('0x2e')],'uniqueid':members[_0x8f52a][_0x694b('0x7')]||_0x246250[_0x694b('0x7')]});utils[_0x694b('0x4')](util[_0x694b('0x5')](_0x694b('0x32'),_0x246250['uniqueid'],members[_0x8f52a]['data1'],members[_0x8f52a][_0x694b('0x9')],members[_0x8f52a][_0x694b('0x31')]));if(members[_0x8f52a][_0x694b('0x25')]){writeDB(members[_0x8f52a]);}}}}catch(_0x111972){utils['error'](util[_0x694b('0x5')]('[%s][members][cdr]',_0x246250[_0x694b('0x7')]),_0x111972);}}; \ No newline at end of file +var _0x14ac=['getUserByName','then','request','catch','error','[%s][members][writeDB]','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','diffTime','agentcomplete','[%s][members][agentcomplete]','queue','channel','assign','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','split','[%s][members][cdr]','util','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','getUserByInterface','name','internal','CreateMemberReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14ac,0x13b));var _0xc14a=function(_0x2e51f9,_0x320019){_0x2e51f9=_0x2e51f9-0x0;var _0xb560e3=_0x14ac[_0x2e51f9];return _0xb560e3;};'use strict';var _=require('lodash');var util=require(_0xc14a('0x0'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0xc14a('0x1')];function writeDB(_0x234a77){utils[_0xc14a('0x2')](util[_0xc14a('0x3')](_0xc14a('0x4'),_0x234a77[_0xc14a('0x5')],_0x234a77[_0xc14a('0x6')],_0x234a77['channel'],_0x234a77[_0xc14a('0x7')],_0x234a77[_0xc14a('0x8')],_0x234a77[_0xc14a('0x9')]));if(_0x234a77[_0xc14a('0x6')]){utils[_0xc14a('0xa')](_0x234a77[_0xc14a('0x6')])['then'](function(_0x6f7e14){if(_0x6f7e14){_0x234a77['membername']=_0x6f7e14[_0xc14a('0xb')];_0x234a77['internal']=_0x6f7e14[_0xc14a('0xc')];utils['request'](_0xc14a('0xd'),_0x234a77);}else{utils[_0xc14a('0xe')](_0x234a77['interface']['split']('/')[0x1])[_0xc14a('0xf')](function(_0x4399c9){if(_0x4399c9){_0x234a77[_0xc14a('0x8')]=_0x4399c9['name'];_0x234a77[_0xc14a('0xc')]=_0x4399c9[_0xc14a('0xc')];utils[_0xc14a('0x10')](_0xc14a('0xd'),_0x234a77);}});}})[_0xc14a('0x11')](function(_0x50ca6a){utils[_0xc14a('0x12')](util['format'](_0xc14a('0x13'),_0x234a77[_0xc14a('0x5')]),_0x50ca6a);});}delete members[_0x234a77['interface']];}function startsWith(_0x5e836a,_0x2dd203){return _['some'](_0x5e836a,function(_0x23f59b){return _[_0xc14a('0x14')](_0x2dd203,_0x23f59b);});}exports['devicestatechange']=function(_0x55b0d6){try{utils[_0xc14a('0x15')](util[_0xc14a('0x3')](_0xc14a('0x16'),members[_0x55b0d6[_0xc14a('0x17')]]?members[_0x55b0d6[_0xc14a('0x17')]][_0xc14a('0x5')]:_0x55b0d6[_0xc14a('0x17')]),_0x55b0d6);utils[_0xc14a('0x2')](util[_0xc14a('0x3')](_0xc14a('0x18'),members[_0x55b0d6[_0xc14a('0x17')]]?members[_0x55b0d6['device']][_0xc14a('0x5')]:_0x55b0d6['device'],_0x55b0d6[_0xc14a('0x19')],_0x55b0d6[_0xc14a('0x17')]));switch(_0x55b0d6[_0xc14a('0x19')]){case'INUSE':case _0xc14a('0x1a'):if(!startsWith(exclude,_0x55b0d6[_0xc14a('0x17')])){members[_0x55b0d6[_0xc14a('0x17')]]={'channel':_0xc14a('0x1b'),'interface':_0x55b0d6[_0xc14a('0x17')],'type':'TALKING','enterAt':utils[_0xc14a('0x1c')](),'role':_0xc14a('0x1d')};}break;case _0xc14a('0x1e'):if(!_[_0xc14a('0x1f')](members[_0x55b0d6['device']])){members[_0x55b0d6[_0xc14a('0x17')]][_0xc14a('0x20')]=utils[_0xc14a('0x1c')]();members[_0x55b0d6['device']]['duration']=utils[_0xc14a('0x21')](members[_0x55b0d6[_0xc14a('0x17')]][_0xc14a('0x20')],members[_0x55b0d6[_0xc14a('0x17')]]['enterAt']);if(members[_0x55b0d6['device']][_0xc14a('0x5')]){writeDB(members[_0x55b0d6[_0xc14a('0x17')]]);}}break;default:break;}}catch(_0x42a0b1){utils[_0xc14a('0x12')](util['format']('[%s][members][devicestatechange]',members[_0x55b0d6[_0xc14a('0x17')]]?members[_0x55b0d6[_0xc14a('0x17')]][_0xc14a('0x5')]:_0x55b0d6[_0xc14a('0x17')]),_0x42a0b1);}};exports[_0xc14a('0x22')]=function(_0x8aef2a){try{if(!_[_0xc14a('0x1f')](members[_0x8aef2a[_0xc14a('0x6')]])){utils[_0xc14a('0x15')](util[_0xc14a('0x3')](_0xc14a('0x23'),_0x8aef2a[_0xc14a('0x5')]),_0x8aef2a);utils[_0xc14a('0x2')](util[_0xc14a('0x3')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x8aef2a[_0xc14a('0x5')],_0x8aef2a[_0xc14a('0x6')],_0x8aef2a[_0xc14a('0x24')]));members[_0x8aef2a[_0xc14a('0x6')]]=_['assign'](members[_0x8aef2a[_0xc14a('0x6')]],{'data4':_0x8aef2a[_0xc14a('0x24')],'uniqueid':_0x8aef2a[_0xc14a('0x5')]});}}catch(_0x22c1c4){utils[_0xc14a('0x12')](util['format'](_0xc14a('0x23'),_0x8aef2a[_0xc14a('0x5')]),_0x22c1c4);}};exports['cdr']=function(_0x155e2){try{utils[_0xc14a('0x15')](util['format']('[%s][members][cdr]',_0x155e2[_0xc14a('0x5')]),_0x155e2);if(_0x155e2[_0xc14a('0x25')]){var _0x313aaa=_0x155e2['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x313aaa])){members[_0x313aaa]=_[_0xc14a('0x26')](members[_0x313aaa],{'data1':members[_0x313aaa][_0xc14a('0x27')]||_0x155e2[_0xc14a('0x9')],'data2':members[_0x313aaa][_0xc14a('0x7')]||_0x155e2[_0xc14a('0x28')],'data3':members[_0x313aaa][_0xc14a('0x29')]||_0x155e2[_0xc14a('0x2a')],'uniqueid':members[_0x313aaa]['uniqueid']||_0x155e2['uniqueid']});utils[_0xc14a('0x2')](util[_0xc14a('0x3')](_0xc14a('0x2b'),_0x155e2[_0xc14a('0x5')],members[_0x313aaa][_0xc14a('0x27')],members[_0x313aaa]['data2'],members[_0x313aaa][_0xc14a('0x29')]));if(members[_0x313aaa][_0xc14a('0x20')]){writeDB(members[_0x313aaa]);}}}if(_0x155e2[_0xc14a('0x2c')]){var _0x14ddcb=_0x155e2[_0xc14a('0x2c')][_0xc14a('0x2d')]('-')[0x0];if(!_['isNil'](members[_0x14ddcb])){members[_0x14ddcb]=_[_0xc14a('0x26')](members[_0x14ddcb],{'data1':members[_0x14ddcb]['data1']||_0x155e2[_0xc14a('0x9')],'data2':members[_0x14ddcb]['data2']||_0x155e2[_0xc14a('0x28')],'data3':members[_0x14ddcb]['data3']||_0x155e2['destination'],'uniqueid':members[_0x14ddcb][_0xc14a('0x5')]||_0x155e2[_0xc14a('0x5')]});utils['info'](util[_0xc14a('0x3')](_0xc14a('0x2b'),_0x155e2[_0xc14a('0x5')],members[_0x14ddcb][_0xc14a('0x27')],members[_0x14ddcb]['data2'],members[_0x14ddcb][_0xc14a('0x29')]));if(members[_0x14ddcb]['exitAt']){writeDB(members[_0x14ddcb]);}}}}catch(_0x3610ed){utils[_0xc14a('0x12')](util[_0xc14a('0x3')](_0xc14a('0x2e'),_0x155e2[_0xc14a('0x5')]),_0x3610ed);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 21b611d..f303da0 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 _0x4f43=['variable','queuestatus','value','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','transfer','TRANSFER','COMPLETEDBY','reason','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfertype','BLIND','transfereeuniqueid','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfererlinkedid','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','assign','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][varset]'];(function(_0x329a33,_0x585897){var _0x2bef80=function(_0x213b94){while(--_0x213b94){_0x329a33['push'](_0x329a33['shift']());}};_0x2bef80(++_0x585897);}(_0x4f43,0x187));var _0x34f4=function(_0x27dd43,_0x50ffba){_0x27dd43=_0x27dd43-0x0;var _0x46f8d7=_0x4f43[_0x27dd43];return _0x46f8d7;};'use strict';var _=require(_0x34f4('0x0'));var util=require('util');var utils=require(_0x34f4('0x1'));var queues={};function writeDB(_0x172e8f){utils['info'](util[_0x34f4('0x2')](_0x34f4('0x3'),_0x172e8f[_0x34f4('0x4')],_0x172e8f[_0x34f4('0x5')],_0x172e8f[_0x34f4('0x6')],_0x172e8f[_0x34f4('0x7')],_0x172e8f[_0x34f4('0x8')],_0x172e8f[_0x34f4('0x9')],_0x172e8f[_0x34f4('0xa')]));if(_0x172e8f[_0x34f4('0x6')]){utils[_0x34f4('0xb')](_0x172e8f[_0x34f4('0x6')])[_0x34f4('0xc')](function(_0x790c8){if(_0x790c8){_0x172e8f[_0x34f4('0xd')]=_0x790c8['type'];}utils[_0x34f4('0xe')](_0x34f4('0xf'),_0x172e8f);});}else{utils[_0x34f4('0xe')](_0x34f4('0xf'),_0x172e8f);}if(_0x172e8f[_0x34f4('0x10')]){delete queues[_0x172e8f[_0x34f4('0x10')]];}else{delete queues[_0x172e8f[_0x34f4('0x4')]];}}exports[_0x34f4('0x11')]=function(_0x5c0877){try{utils[_0x34f4('0x12')](util[_0x34f4('0x2')](_0x34f4('0x13'),_0x5c0877[_0x34f4('0x4')]),_0x5c0877);utils[_0x34f4('0x14')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x5c0877[_0x34f4('0x4')],_0x5c0877['queue'],_0x5c0877['position']));queues[_0x5c0877[_0x34f4('0x4')]]=_[_0x34f4('0x15')](_0x5c0877,{'originalposition':_0x5c0877[_0x34f4('0x16')],'queuecallerjoinAt':utils[_0x34f4('0x17')](),'mohtime':0x0});}catch(_0x146dd5){utils[_0x34f4('0x18')](util[_0x34f4('0x2')]('[%s][queues][queuecallerjoin]',_0x5c0877[_0x34f4('0x4')]),_0x146dd5);}};exports[_0x34f4('0x19')]=function(_0x441f2e){try{if(!_[_0x34f4('0x1a')](queues[_0x441f2e[_0x34f4('0x4')]])){utils[_0x34f4('0x12')](util[_0x34f4('0x2')](_0x34f4('0x1b'),_0x441f2e[_0x34f4('0x4')]),_0x441f2e);if(queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0x1c')]){if(!queues[_0x441f2e['uniqueid']][_0x34f4('0x1d')]&&!queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0x1e')]){queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0x1f')]=!![];queues[_0x441f2e[_0x34f4('0x4')]]['queuecallercompleteAt']=utils[_0x34f4('0x17')]();queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0xa')]=_0x34f4('0x20');}utils[_0x34f4('0x14')](util[_0x34f4('0x2')](_0x34f4('0x21'),_0x441f2e[_0x34f4('0x4')],queues[_0x441f2e['uniqueid']][_0x34f4('0x22')],queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0xa')]));writeDB(queues[_0x441f2e[_0x34f4('0x4')]]);}else if(queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0x10')]){utils[_0x34f4('0x14')](util[_0x34f4('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x441f2e['uniqueid'],queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0x22')],queues[_0x441f2e[_0x34f4('0x4')]]['transfereduniqueid']));queues[queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0x10')]]=queues[_0x441f2e['uniqueid']];queues[queues[_0x441f2e[_0x34f4('0x4')]][_0x34f4('0x10')]][_0x34f4('0x23')]=0x2;delete queues[_0x441f2e[_0x34f4('0x4')]];}}}catch(_0x12fd88){utils['error'](util[_0x34f4('0x2')]('[%s][queues][hangup]',_0x441f2e['uniqueid']),_0x12fd88);}};exports['varset']=function(_0x26fc3b){try{utils['debug'](util[_0x34f4('0x2')](_0x34f4('0x24'),_0x26fc3b['uniqueid']),_0x26fc3b);if(!_[_0x34f4('0x1a')](_0x26fc3b[_0x34f4('0x25')][_0x34f4('0x26')])&&_0x26fc3b[_0x34f4('0x27')]['toUpperCase']()!==_0x34f4('0x28')){if(!_[_0x34f4('0x1a')](queues[_0x26fc3b[_0x34f4('0x4')]])){queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0x1d')]=![];queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0x29')]=null;queues[_0x26fc3b[_0x34f4('0x4')]]['queuecallerexit']=!![];queues[_0x26fc3b[_0x34f4('0x4')]]['queuecallerexitAt']=utils[_0x34f4('0x17')]();queues[_0x26fc3b['uniqueid']][_0x34f4('0xa')]=_0x26fc3b[_0x34f4('0x27')]['toUpperCase']();utils['info'](util[_0x34f4('0x2')](_0x34f4('0x2a'),_0x26fc3b[_0x34f4('0x4')],queues[_0x26fc3b['uniqueid']][_0x34f4('0x22')],_0x26fc3b[_0x34f4('0x27')],queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0xa')]));writeDB(queues[_0x26fc3b[_0x34f4('0x4')]]);}}else if(!_[_0x34f4('0x1a')](_0x26fc3b[_0x34f4('0x25')][_0x34f4('0x2b')])){if(!_['isNil'](queues[_0x26fc3b[_0x34f4('0x4')]])&&!queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0x1d')]){queues[_0x26fc3b[_0x34f4('0x4')]]['queuecallerabandon']=![];queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0x29')]=null;queues[_0x26fc3b[_0x34f4('0x4')]]['queuecallerexit']=!![];queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0x2c')]=utils[_0x34f4('0x17')]();queues[_0x26fc3b['uniqueid']][_0x34f4('0xa')]=_0x34f4('0x2d');utils[_0x34f4('0x14')](util[_0x34f4('0x2')](_0x34f4('0x2e'),_0x26fc3b[_0x34f4('0x4')],queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0x22')],_0x26fc3b[_0x34f4('0x27')],queues[_0x26fc3b[_0x34f4('0x4')]][_0x34f4('0xa')]));}}}catch(_0x5311d9){utils[_0x34f4('0x18')](util[_0x34f4('0x2')]('[%s][queues][varset]',_0x26fc3b[_0x34f4('0x4')]),_0x5311d9);}};exports[_0x34f4('0x1d')]=function(_0x27bcff){try{if(!_[_0x34f4('0x1a')](queues[_0x27bcff[_0x34f4('0x4')]])){utils[_0x34f4('0x12')](util[_0x34f4('0x2')]('[%s][queues][queuecallerabandon]',_0x27bcff[_0x34f4('0x4')]),_0x27bcff);queues[_0x27bcff[_0x34f4('0x4')]]['queuecallerexit']=![];queues[_0x27bcff[_0x34f4('0x4')]][_0x34f4('0x2c')]=null;queues[_0x27bcff[_0x34f4('0x4')]][_0x34f4('0x1d')]=!![];queues[_0x27bcff[_0x34f4('0x4')]][_0x34f4('0x29')]=utils[_0x34f4('0x17')]();queues[_0x27bcff[_0x34f4('0x4')]][_0x34f4('0xa')]=_0x34f4('0x2f');utils['info'](util[_0x34f4('0x2')](_0x34f4('0x30'),_0x27bcff[_0x34f4('0x4')],queues[_0x27bcff[_0x34f4('0x4')]][_0x34f4('0x22')],queues[_0x27bcff['uniqueid']][_0x34f4('0xa')]));}}catch(_0xab2424){utils[_0x34f4('0x18')](util[_0x34f4('0x2')](_0x34f4('0x31'),_0x27bcff[_0x34f4('0x4')]),_0xab2424);}};exports[_0x34f4('0x32')]=function(_0x12353e){try{if(!_[_0x34f4('0x1a')](queues[_0x12353e[_0x34f4('0x4')]])){utils[_0x34f4('0x12')](util[_0x34f4('0x2')](_0x34f4('0x33'),_0x12353e['uniqueid']),_0x12353e);utils['info'](util[_0x34f4('0x2')](_0x34f4('0x34'),_0x12353e[_0x34f4('0x4')],queues[_0x12353e[_0x34f4('0x4')]][_0x34f4('0x22')],_0x12353e[_0x34f4('0x35')],_0x12353e[_0x34f4('0x36')]));queues[_0x12353e['uniqueid']][_0x34f4('0x32')]=!![];queues[_0x12353e[_0x34f4('0x4')]][_0x34f4('0x1c')]=utils['now']();queues[_0x12353e['uniqueid']][_0x34f4('0x37')]=utils[_0x34f4('0x38')](queues[_0x12353e[_0x34f4('0x4')]][_0x34f4('0x1c')],queues[_0x12353e[_0x34f4('0x4')]][_0x34f4('0x39')]);queues[_0x12353e['uniqueid']][_0x34f4('0x16')]=_0x12353e[_0x34f4('0x16')];queues[_0x12353e[_0x34f4('0x4')]][_0x34f4('0x3a')]=_0x12353e[_0x34f4('0x3a')];queues[_0x12353e['uniqueid']][_0x34f4('0x35')]=_0x12353e['connectedlinenum'];queues[_0x12353e['uniqueid']][_0x34f4('0x36')]=_0x12353e[_0x34f4('0x36')];}}catch(_0x2aadb8){utils[_0x34f4('0x18')](util[_0x34f4('0x2')]('[%s][queues][queuecallerleave]',_0x12353e[_0x34f4('0x4')]),_0x2aadb8);}};exports[_0x34f4('0x3b')]=function(_0x357765){try{if(!_[_0x34f4('0x1a')](queues[_0x357765['uniqueid']])){utils[_0x34f4('0x12')](util[_0x34f4('0x2')](_0x34f4('0x3c'),_0x357765[_0x34f4('0x4')]),_0x357765);utils[_0x34f4('0x14')](util['format'](_0x34f4('0x3d'),_0x357765[_0x34f4('0x4')],queues[_0x357765['uniqueid']][_0x34f4('0x22')],_0x357765[_0x34f4('0x3e')],_0x357765[_0x34f4('0x3f')]));queues[_0x357765[_0x34f4('0x4')]][_0x34f4('0x1d')]=![];queues[_0x357765[_0x34f4('0x4')]][_0x34f4('0x1d')]=![];queues[_0x357765[_0x34f4('0x4')]]['queuecallerabandonAt']=null;queues[_0x357765[_0x34f4('0x4')]]['queuecallerexit']=![];queues[_0x357765[_0x34f4('0x4')]][_0x34f4('0xa')]=null;queues[_0x357765['uniqueid']]['queuecallerexitAt']=null;queues[_0x357765[_0x34f4('0x4')]][_0x34f4('0x40')]=!![];queues[_0x357765[_0x34f4('0x4')]][_0x34f4('0x9')]=_0x357765[_0x34f4('0x3f')];queues[_0x357765[_0x34f4('0x4')]]['lastAssignedTo']=_0x357765[_0x34f4('0x3e')];}}catch(_0xe2d4b){utils[_0x34f4('0x18')](util[_0x34f4('0x2')](_0x34f4('0x3c'),_0x357765[_0x34f4('0x4')]),_0xe2d4b);}};exports[_0x34f4('0x41')]=function(_0x279eaa){try{if(!_[_0x34f4('0x1a')](queues[_0x279eaa[_0x34f4('0x4')]])){if(queues[_0x279eaa[_0x34f4('0x4')]][_0x34f4('0x1c')]){utils[_0x34f4('0x12')](util['format'](_0x34f4('0x42'),_0x279eaa[_0x34f4('0x4')]),_0x279eaa);queues[_0x279eaa['uniqueid']][_0x34f4('0x1d')]=![];queues[_0x279eaa['uniqueid']][_0x34f4('0x1d')]=![];queues[_0x279eaa[_0x34f4('0x4')]][_0x34f4('0x29')]=null;queues[_0x279eaa['uniqueid']][_0x34f4('0x1e')]=![];queues[_0x279eaa[_0x34f4('0x4')]]['queuecallerexitAt']=null;queues[_0x279eaa[_0x34f4('0x4')]]['assigned']=!![];queues[_0x279eaa['uniqueid']]['lastAssignedTo']=_0x279eaa[_0x34f4('0x3e')];queues[_0x279eaa[_0x34f4('0x4')]][_0x34f4('0x1f')]=!![];queues[_0x279eaa[_0x34f4('0x4')]][_0x34f4('0x43')]=utils[_0x34f4('0x17')]();if(_0x279eaa['reason']==_0x34f4('0x44')){if(!queues[_0x279eaa[_0x34f4('0x4')]][_0x34f4('0x44')]){queues[_0x279eaa['uniqueid']][_0x34f4('0xa')]=_0x34f4('0x45');}}else{queues[_0x279eaa['uniqueid']][_0x34f4('0xa')]=_0x34f4('0x46')+_0x279eaa[_0x34f4('0x47')][_0x34f4('0x48')]();}utils['info'](util[_0x34f4('0x2')](_0x34f4('0x49'),_0x279eaa[_0x34f4('0x4')],queues[_0x279eaa[_0x34f4('0x4')]][_0x34f4('0x22')],_0x279eaa[_0x34f4('0x3e')],queues[_0x279eaa[_0x34f4('0x4')]][_0x34f4('0xa')]));writeDB(queues[_0x279eaa[_0x34f4('0x4')]]);}}}catch(_0x1be7e8){utils[_0x34f4('0x18')](util[_0x34f4('0x2')](_0x34f4('0x42'),_0x279eaa[_0x34f4('0x4')]),_0x1be7e8);}};exports[_0x34f4('0x4a')]=function(_0x4e3529){try{if(!_[_0x34f4('0x1a')](queues[_0x4e3529['transfereeuniqueid']])){utils[_0x34f4('0x12')](util['format'](_0x34f4('0x4b'),_0x4e3529[_0x34f4('0x4')]),_0x4e3529);queues[_0x4e3529['transfereeuniqueid']][_0x34f4('0x44')]=!![];queues[_0x4e3529['transfereeuniqueid']][_0x34f4('0x4c')]=_0x34f4('0x4d');queues[_0x4e3529[_0x34f4('0x4e')]][_0x34f4('0x4f')]=_0x4e3529[_0x34f4('0x50')];queues[_0x4e3529[_0x34f4('0x4e')]][_0x34f4('0x51')]=_0x4e3529[_0x34f4('0x4e')];queues[_0x4e3529[_0x34f4('0x4e')]][_0x34f4('0xa')]=_0x34f4('0x52');utils[_0x34f4('0x14')](util['format'](_0x34f4('0x53'),_0x4e3529[_0x34f4('0x4')],queues[_0x4e3529[_0x34f4('0x4e')]][_0x34f4('0x22')],_0x4e3529[_0x34f4('0x4e')],_0x4e3529[_0x34f4('0x50')]));}}catch(_0x457434){utils[_0x34f4('0x18')](util[_0x34f4('0x2')](_0x34f4('0x4b'),_0x4e3529[_0x34f4('0x4')]),_0x457434);}};exports[_0x34f4('0x54')]=function(_0x3dfb4c){try{utils[_0x34f4('0x12')](util['format'](_0x34f4('0x55'),_0x3dfb4c['origtransfereruniqueid']),_0x3dfb4c);if(_0x3dfb4c['origtransfereruniqueid']==_0x3dfb4c['origtransfererlinkedid']){if(!_[_0x34f4('0x1a')](queues[_0x3dfb4c[_0x34f4('0x56')]])){utils['info'](util[_0x34f4('0x2')](_0x34f4('0x57'),_0x3dfb4c[_0x34f4('0x58')],queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0x22')],_0x3dfb4c[_0x34f4('0x59')]));queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0x44')]=!![];queues[_0x3dfb4c['secondtransfererlinkedid']][_0x34f4('0x4c')]=_0x34f4('0x5a');queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0x4f')]=_0x3dfb4c['origtransfererexten'];queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0x51')]=_0x3dfb4c[_0x34f4('0x58')];queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0xa')]=_0x34f4('0x5b');}if(!_['isNil'](queues[_0x3dfb4c['origtransfererlinkedid']])){if(_0x3dfb4c['transfereelinkedid']&&queues[_0x3dfb4c[_0x34f4('0x5c')]]){queues[_0x3dfb4c[_0x34f4('0x5c')]][_0x34f4('0x23')]=0x1;queues[_0x3dfb4c['transfereeuniqueid']]=_['clone'](queues[_0x3dfb4c[_0x34f4('0x5c')]]);queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x10')]=_0x3dfb4c[_0x34f4('0x5d')];queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x23')]=0x2;queues[_0x3dfb4c[_0x34f4('0x4e')]]['calleridnum']=queues[_0x3dfb4c[_0x34f4('0x56')]]['calleridnum'];queues[_0x3dfb4c['transfereeuniqueid']]['calleridname']=queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0x5e')];queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x39')]=utils['now']();queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x1c')]=utils['now']();queues[_0x3dfb4c[_0x34f4('0x4e')]]['holdtime']=0x0;queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x5f')]=0x0;utils[_0x34f4('0x14')](util[_0x34f4('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x3dfb4c[_0x34f4('0x58')],queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x22')],queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x8')],queues[_0x3dfb4c[_0x34f4('0x4e')]][_0x34f4('0x5e')]));}else{utils[_0x34f4('0x14')](util['format'](_0x34f4('0x60'),_0x3dfb4c[_0x34f4('0x58')],queues[_0x3dfb4c['origtransfererlinkedid']][_0x34f4('0x22')],_0x3dfb4c['secondtransfererlinkedid']));queues[_0x3dfb4c[_0x34f4('0x61')]][_0x34f4('0x10')]=_0x3dfb4c[_0x34f4('0x56')];}}}else if(_0x3dfb4c[_0x34f4('0x62')]==_0x3dfb4c[_0x34f4('0x56')]){if(!_[_0x34f4('0x1a')](queues[_0x3dfb4c[_0x34f4('0x61')]])){utils[_0x34f4('0x14')](util[_0x34f4('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3dfb4c[_0x34f4('0x58')],queues[_0x3dfb4c[_0x34f4('0x61')]][_0x34f4('0x22')],_0x3dfb4c['secondtransfereruniqueid'],_0x3dfb4c[_0x34f4('0x63')]));queues[_0x3dfb4c[_0x34f4('0x61')]]['transfer']=!![];queues[_0x3dfb4c[_0x34f4('0x61')]][_0x34f4('0x4c')]='ATTENDED';queues[_0x3dfb4c[_0x34f4('0x61')]][_0x34f4('0x4f')]=_0x3dfb4c['secondtransfererexten'];queues[_0x3dfb4c[_0x34f4('0x61')]]['transferuniqueid']=_0x3dfb4c[_0x34f4('0x62')];queues[_0x3dfb4c[_0x34f4('0x61')]][_0x34f4('0xa')]=_0x34f4('0x5b');}if(!_[_0x34f4('0x1a')](queues[_0x3dfb4c[_0x34f4('0x56')]])){if(_0x3dfb4c['transfertargetlinkedid']&&queues[_0x3dfb4c['transfertargetlinkedid']]){queues[_0x3dfb4c[_0x34f4('0x64')]][_0x34f4('0x23')]=0x1;queues[_0x3dfb4c[_0x34f4('0x5d')]]=_[_0x34f4('0x65')](queues[_0x3dfb4c['transfertargetlinkedid']]);queues[_0x3dfb4c[_0x34f4('0x5d')]]['transfereduniqueid']=_0x3dfb4c['transfertargetuniqueid'];queues[_0x3dfb4c['transfertargetuniqueid']][_0x34f4('0x23')]=0x2;queues[_0x3dfb4c[_0x34f4('0x5d')]][_0x34f4('0x8')]=queues[_0x3dfb4c['origtransfererlinkedid']][_0x34f4('0x8')];queues[_0x3dfb4c['transfertargetuniqueid']][_0x34f4('0x5e')]=queues[_0x3dfb4c['origtransfererlinkedid']][_0x34f4('0x5e')];queues[_0x3dfb4c[_0x34f4('0x5d')]][_0x34f4('0x39')]=utils['now']();queues[_0x3dfb4c[_0x34f4('0x5d')]][_0x34f4('0x1c')]=utils[_0x34f4('0x17')]();queues[_0x3dfb4c['transfertargetuniqueid']][_0x34f4('0x37')]=0x0;queues[_0x3dfb4c[_0x34f4('0x5d')]][_0x34f4('0x5f')]=0x0;utils['info'](util['format'](_0x34f4('0x66'),_0x3dfb4c[_0x34f4('0x58')],queues[_0x3dfb4c[_0x34f4('0x5d')]]['name'],queues[_0x3dfb4c['transfertargetuniqueid']][_0x34f4('0x10')],queues[_0x3dfb4c['transfertargetuniqueid']]['calleridnum'],queues[_0x3dfb4c[_0x34f4('0x5d')]]['calleridname']));}else{utils[_0x34f4('0x14')](util['format'](_0x34f4('0x60'),_0x3dfb4c['origtransfereruniqueid'],queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0x22')],_0x3dfb4c[_0x34f4('0x61')]));queues[_0x3dfb4c[_0x34f4('0x56')]][_0x34f4('0x10')]=_0x3dfb4c[_0x34f4('0x61')];}}}}catch(_0x2a90ac){utils[_0x34f4('0x18')](util['format'](_0x34f4('0x55'),_0x3dfb4c[_0x34f4('0x58')]),_0x2a90ac);}};exports['musiconholdstart']=function(_0x514480){try{if(!_[_0x34f4('0x1a')](queues[_0x514480['uniqueid']])){utils[_0x34f4('0x12')](util[_0x34f4('0x2')](_0x34f4('0x67'),_0x514480[_0x34f4('0x4')]),_0x514480);queues[_0x514480[_0x34f4('0x4')]]['musiconholdstartAt']=utils[_0x34f4('0x17')]();utils[_0x34f4('0x14')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x514480[_0x34f4('0x4')],queues[_0x514480[_0x34f4('0x4')]][_0x34f4('0x22')],queues[_0x514480['uniqueid']]['musiconholdstartAt']));}}catch(_0xd39f2c){utils[_0x34f4('0x18')](util[_0x34f4('0x2')]('[%s][queues][musiconholdstart]',_0x514480[_0x34f4('0x4')]),_0xd39f2c);}};exports[_0x34f4('0x68')]=function(_0x5e4a96){try{if(!_[_0x34f4('0x1a')](queues[_0x5e4a96[_0x34f4('0x4')]])){if(!_['isNil'](queues[_0x5e4a96['uniqueid']][_0x34f4('0x69')])){utils['debug'](util['format'](_0x34f4('0x6a'),_0x5e4a96[_0x34f4('0x4')]),_0x5e4a96);queues[_0x5e4a96[_0x34f4('0x4')]][_0x34f4('0x5f')]+=utils[_0x34f4('0x38')](utils[_0x34f4('0x17')](),queues[_0x5e4a96[_0x34f4('0x4')]]['musiconholdstartAt']);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x5e4a96['uniqueid'],queues[_0x5e4a96[_0x34f4('0x4')]][_0x34f4('0x22')],queues[_0x5e4a96[_0x34f4('0x4')]][_0x34f4('0x5f')]));delete queues[_0x5e4a96['uniqueid']]['musiconholdstartAt'];}}}catch(_0x5212c7){utils['error'](util[_0x34f4('0x2')](_0x34f4('0x6a'),_0x5e4a96[_0x34f4('0x4')]),_0x5212c7);}}; \ No newline at end of file +var _0xd3b9=['format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','type','CreateVoiceQueueReport','request','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','transfereduniqueid','queuecallerenterreason','varset','variable','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','queueposition','value','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xd3b9,0x184));var _0x9d3b=function(_0x25bcd4,_0x199c1c){_0x25bcd4=_0x25bcd4-0x0;var _0x41e804=_0xd3b9[_0x25bcd4];return _0x41e804;};'use strict';var _=require(_0x9d3b('0x0'));var util=require(_0x9d3b('0x1'));var utils=require(_0x9d3b('0x2'));var queues={};function writeDB(_0x3daaba){utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')](_0x9d3b('0x5'),_0x3daaba[_0x9d3b('0x6')],_0x3daaba[_0x9d3b('0x7')],_0x3daaba[_0x9d3b('0x8')],_0x3daaba[_0x9d3b('0x9')],_0x3daaba[_0x9d3b('0xa')],_0x3daaba[_0x9d3b('0xb')],_0x3daaba['queuecallerexitreason']));if(_0x3daaba[_0x9d3b('0x8')]){utils[_0x9d3b('0xc')](_0x3daaba[_0x9d3b('0x8')])['then'](function(_0x16e83e){if(_0x16e83e){_0x3daaba[_0x9d3b('0xd')]=_0x16e83e[_0x9d3b('0xd')];}utils['request'](_0x9d3b('0xe'),_0x3daaba);});}else{utils[_0x9d3b('0xf')](_0x9d3b('0xe'),_0x3daaba);}if(_0x3daaba['transfereduniqueid']){delete queues[_0x3daaba['transfereduniqueid']];}else{delete queues[_0x3daaba[_0x9d3b('0x6')]];}}exports[_0x9d3b('0x10')]=function(_0x419b39){try{utils[_0x9d3b('0x11')](util[_0x9d3b('0x4')](_0x9d3b('0x12'),_0x419b39['uniqueid']),_0x419b39);utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')](_0x9d3b('0x13'),_0x419b39['uniqueid'],_0x419b39['queue'],_0x419b39[_0x9d3b('0x14')]));queues[_0x419b39[_0x9d3b('0x6')]]=_[_0x9d3b('0x15')](_0x419b39,{'originalposition':_0x419b39['position'],'queuecallerjoinAt':utils[_0x9d3b('0x16')](),'mohtime':0x0});}catch(_0x37cced){utils[_0x9d3b('0x17')](util[_0x9d3b('0x4')](_0x9d3b('0x12'),_0x419b39[_0x9d3b('0x6')]),_0x37cced);}};exports[_0x9d3b('0x18')]=function(_0x2ee704){try{if(!_[_0x9d3b('0x19')](queues[_0x2ee704[_0x9d3b('0x6')]])){utils[_0x9d3b('0x11')](util[_0x9d3b('0x4')](_0x9d3b('0x1a'),_0x2ee704[_0x9d3b('0x6')]),_0x2ee704);if(queues[_0x2ee704[_0x9d3b('0x6')]]['queuecallerleaveAt']){if(!queues[_0x2ee704[_0x9d3b('0x6')]]['queuecallerabandon']&&!queues[_0x2ee704[_0x9d3b('0x6')]][_0x9d3b('0x1b')]){queues[_0x2ee704['uniqueid']][_0x9d3b('0x1c')]=!![];queues[_0x2ee704[_0x9d3b('0x6')]][_0x9d3b('0x1d')]=utils[_0x9d3b('0x16')]();queues[_0x2ee704['uniqueid']][_0x9d3b('0x1e')]=_0x9d3b('0x1f');}utils[_0x9d3b('0x3')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x2ee704['uniqueid'],queues[_0x2ee704[_0x9d3b('0x6')]]['name'],queues[_0x2ee704['uniqueid']][_0x9d3b('0x1e')]));writeDB(queues[_0x2ee704['uniqueid']]);}else if(queues[_0x2ee704[_0x9d3b('0x6')]]['transfereduniqueid']){utils['info'](util[_0x9d3b('0x4')](_0x9d3b('0x20'),_0x2ee704['uniqueid'],queues[_0x2ee704[_0x9d3b('0x6')]][_0x9d3b('0x21')],queues[_0x2ee704['uniqueid']][_0x9d3b('0x22')]));queues[queues[_0x2ee704[_0x9d3b('0x6')]]['transfereduniqueid']]=queues[_0x2ee704[_0x9d3b('0x6')]];queues[queues[_0x2ee704[_0x9d3b('0x6')]][_0x9d3b('0x22')]][_0x9d3b('0x23')]=0x2;delete queues[_0x2ee704['uniqueid']];}}}catch(_0x54a43a){utils[_0x9d3b('0x17')](util['format'](_0x9d3b('0x1a'),_0x2ee704[_0x9d3b('0x6')]),_0x54a43a);}};exports[_0x9d3b('0x24')]=function(_0x4b1b43){try{utils[_0x9d3b('0x11')](util['format']('[%s][queues][varset]',_0x4b1b43[_0x9d3b('0x6')]),_0x4b1b43);if(!_[_0x9d3b('0x19')](_0x4b1b43[_0x9d3b('0x25')]['queuestatus'])&&_0x4b1b43['value'][_0x9d3b('0x26')]()!==_0x9d3b('0x27')){if(!_[_0x9d3b('0x19')](queues[_0x4b1b43[_0x9d3b('0x6')]])){queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x28')]=![];queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x29')]=null;queues[_0x4b1b43['uniqueid']]['queuecallerexit']=!![];queues[_0x4b1b43['uniqueid']][_0x9d3b('0x2a')]=utils[_0x9d3b('0x16')]();queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x1e')]=_0x4b1b43['value'][_0x9d3b('0x26')]();utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4b1b43[_0x9d3b('0x6')],queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x21')],_0x4b1b43['value'],queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x1e')]));writeDB(queues[_0x4b1b43['uniqueid']]);}}else if(!_[_0x9d3b('0x19')](_0x4b1b43[_0x9d3b('0x25')][_0x9d3b('0x2b')])){if(!_['isNil'](queues[_0x4b1b43[_0x9d3b('0x6')]])&&!queues[_0x4b1b43[_0x9d3b('0x6')]]['queuecallerabandon']){queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x28')]=![];queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x29')]=null;queues[_0x4b1b43['uniqueid']]['queuecallerexit']=!![];queues[_0x4b1b43['uniqueid']][_0x9d3b('0x2a')]=utils[_0x9d3b('0x16')]();queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x1e')]='EXITWITHKEY';utils[_0x9d3b('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4b1b43[_0x9d3b('0x6')],queues[_0x4b1b43['uniqueid']][_0x9d3b('0x21')],_0x4b1b43[_0x9d3b('0x2c')],queues[_0x4b1b43[_0x9d3b('0x6')]][_0x9d3b('0x1e')]));}}}catch(_0xbc3401){utils['error'](util[_0x9d3b('0x4')]('[%s][queues][varset]',_0x4b1b43[_0x9d3b('0x6')]),_0xbc3401);}};exports[_0x9d3b('0x28')]=function(_0x1e9562){try{if(!_['isNil'](queues[_0x1e9562[_0x9d3b('0x6')]])){utils[_0x9d3b('0x11')](util['format']('[%s][queues][queuecallerabandon]',_0x1e9562[_0x9d3b('0x6')]),_0x1e9562);queues[_0x1e9562[_0x9d3b('0x6')]]['queuecallerexit']=![];queues[_0x1e9562[_0x9d3b('0x6')]][_0x9d3b('0x2a')]=null;queues[_0x1e9562[_0x9d3b('0x6')]][_0x9d3b('0x28')]=!![];queues[_0x1e9562[_0x9d3b('0x6')]][_0x9d3b('0x29')]=utils[_0x9d3b('0x16')]();queues[_0x1e9562['uniqueid']][_0x9d3b('0x1e')]='ABANDONED';utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1e9562['uniqueid'],queues[_0x1e9562[_0x9d3b('0x6')]][_0x9d3b('0x21')],queues[_0x1e9562[_0x9d3b('0x6')]]['queuecallerexitreason']));}}catch(_0x496df4){utils[_0x9d3b('0x17')](util['format']('[%s][queues][queuecallerabandon]',_0x1e9562[_0x9d3b('0x6')]),_0x496df4);}};exports[_0x9d3b('0x2d')]=function(_0x37a5dd){try{if(!_['isNil'](queues[_0x37a5dd[_0x9d3b('0x6')]])){utils[_0x9d3b('0x11')](util[_0x9d3b('0x4')](_0x9d3b('0x2e'),_0x37a5dd[_0x9d3b('0x6')]),_0x37a5dd);utils[_0x9d3b('0x3')](util['format'](_0x9d3b('0x2f'),_0x37a5dd[_0x9d3b('0x6')],queues[_0x37a5dd[_0x9d3b('0x6')]][_0x9d3b('0x21')],_0x37a5dd[_0x9d3b('0x30')],_0x37a5dd[_0x9d3b('0x31')]));queues[_0x37a5dd[_0x9d3b('0x6')]][_0x9d3b('0x2d')]=!![];queues[_0x37a5dd[_0x9d3b('0x6')]][_0x9d3b('0x32')]=utils[_0x9d3b('0x16')]();queues[_0x37a5dd[_0x9d3b('0x6')]][_0x9d3b('0x33')]=utils['diffTime'](queues[_0x37a5dd[_0x9d3b('0x6')]][_0x9d3b('0x32')],queues[_0x37a5dd[_0x9d3b('0x6')]]['queuecallerjoinAt']);queues[_0x37a5dd[_0x9d3b('0x6')]][_0x9d3b('0x14')]=_0x37a5dd[_0x9d3b('0x14')];queues[_0x37a5dd['uniqueid']][_0x9d3b('0x34')]=_0x37a5dd[_0x9d3b('0x34')];queues[_0x37a5dd[_0x9d3b('0x6')]]['connectedlinenum']=_0x37a5dd[_0x9d3b('0x30')];queues[_0x37a5dd[_0x9d3b('0x6')]][_0x9d3b('0x31')]=_0x37a5dd[_0x9d3b('0x31')];}}catch(_0x4411f4){utils[_0x9d3b('0x17')](util[_0x9d3b('0x4')]('[%s][queues][queuecallerleave]',_0x37a5dd['uniqueid']),_0x4411f4);}};exports[_0x9d3b('0x35')]=function(_0x495503){try{if(!_[_0x9d3b('0x19')](queues[_0x495503['uniqueid']])){utils[_0x9d3b('0x11')](util[_0x9d3b('0x4')](_0x9d3b('0x36'),_0x495503[_0x9d3b('0x6')]),_0x495503);utils[_0x9d3b('0x3')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x495503[_0x9d3b('0x6')],queues[_0x495503[_0x9d3b('0x6')]][_0x9d3b('0x21')],_0x495503[_0x9d3b('0x37')],_0x495503[_0x9d3b('0x38')]));queues[_0x495503[_0x9d3b('0x6')]][_0x9d3b('0x28')]=![];queues[_0x495503[_0x9d3b('0x6')]][_0x9d3b('0x28')]=![];queues[_0x495503[_0x9d3b('0x6')]][_0x9d3b('0x29')]=null;queues[_0x495503[_0x9d3b('0x6')]][_0x9d3b('0x1b')]=![];queues[_0x495503[_0x9d3b('0x6')]]['queuecallerexitreason']=null;queues[_0x495503['uniqueid']][_0x9d3b('0x2a')]=null;queues[_0x495503['uniqueid']][_0x9d3b('0x39')]=!![];queues[_0x495503[_0x9d3b('0x6')]][_0x9d3b('0xb')]=_0x495503[_0x9d3b('0x38')];queues[_0x495503[_0x9d3b('0x6')]][_0x9d3b('0x9')]=_0x495503['membername'];}}catch(_0x4288e7){utils[_0x9d3b('0x17')](util[_0x9d3b('0x4')](_0x9d3b('0x36'),_0x495503[_0x9d3b('0x6')]),_0x4288e7);}};exports[_0x9d3b('0x3a')]=function(_0x21d218){try{if(!_[_0x9d3b('0x19')](queues[_0x21d218['uniqueid']])){if(queues[_0x21d218['uniqueid']][_0x9d3b('0x32')]){utils[_0x9d3b('0x11')](util[_0x9d3b('0x4')](_0x9d3b('0x3b'),_0x21d218[_0x9d3b('0x6')]),_0x21d218);queues[_0x21d218['uniqueid']][_0x9d3b('0x28')]=![];queues[_0x21d218['uniqueid']][_0x9d3b('0x28')]=![];queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x29')]=null;queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x1b')]=![];queues[_0x21d218[_0x9d3b('0x6')]]['queuecallerexitAt']=null;queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x39')]=!![];queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x9')]=_0x21d218[_0x9d3b('0x37')];queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x1c')]=!![];queues[_0x21d218[_0x9d3b('0x6')]]['queuecallercompleteAt']=utils['now']();if(_0x21d218[_0x9d3b('0x3c')]=='transfer'){if(!queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x3d')]){queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x1e')]=_0x9d3b('0x3e');}}else{queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x1e')]=_0x9d3b('0x3f')+_0x21d218[_0x9d3b('0x3c')]['toUpperCase']();}utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x21d218[_0x9d3b('0x6')],queues[_0x21d218[_0x9d3b('0x6')]][_0x9d3b('0x21')],_0x21d218[_0x9d3b('0x37')],queues[_0x21d218[_0x9d3b('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x21d218['uniqueid']]);}}}catch(_0xc784d3){utils['error'](util[_0x9d3b('0x4')](_0x9d3b('0x3b'),_0x21d218[_0x9d3b('0x6')]),_0xc784d3);}};exports[_0x9d3b('0x40')]=function(_0x4add60){try{if(!_[_0x9d3b('0x19')](queues[_0x4add60[_0x9d3b('0x41')]])){utils['debug'](util['format']('[%s][queues][blindtransfer]',_0x4add60[_0x9d3b('0x6')]),_0x4add60);queues[_0x4add60[_0x9d3b('0x41')]][_0x9d3b('0x3d')]=!![];queues[_0x4add60[_0x9d3b('0x41')]][_0x9d3b('0x42')]='BLIND';queues[_0x4add60[_0x9d3b('0x41')]][_0x9d3b('0x43')]=_0x4add60[_0x9d3b('0x44')];queues[_0x4add60['transfereeuniqueid']][_0x9d3b('0x45')]=_0x4add60[_0x9d3b('0x41')];queues[_0x4add60[_0x9d3b('0x41')]][_0x9d3b('0x1e')]=_0x9d3b('0x46');utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')](_0x9d3b('0x47'),_0x4add60[_0x9d3b('0x6')],queues[_0x4add60['transfereeuniqueid']][_0x9d3b('0x21')],_0x4add60[_0x9d3b('0x41')],_0x4add60['extension']));}}catch(_0xdcefb5){utils['error'](util[_0x9d3b('0x4')](_0x9d3b('0x48'),_0x4add60[_0x9d3b('0x6')]),_0xdcefb5);}};exports[_0x9d3b('0x49')]=function(_0x7977b9){try{utils[_0x9d3b('0x11')](util[_0x9d3b('0x4')]('[%s][queues][attendedtransfer]',_0x7977b9[_0x9d3b('0x4a')]),_0x7977b9);if(_0x7977b9[_0x9d3b('0x4a')]==_0x7977b9['origtransfererlinkedid']){if(!_[_0x9d3b('0x19')](queues[_0x7977b9[_0x9d3b('0x4b')]])){utils[_0x9d3b('0x3')](util['format'](_0x9d3b('0x4c'),_0x7977b9[_0x9d3b('0x4a')],queues[_0x7977b9['secondtransfererlinkedid']][_0x9d3b('0x21')],_0x7977b9[_0x9d3b('0x4d')]));queues[_0x7977b9[_0x9d3b('0x4b')]]['transfer']=!![];queues[_0x7977b9[_0x9d3b('0x4b')]][_0x9d3b('0x42')]=_0x9d3b('0x4e');queues[_0x7977b9['secondtransfererlinkedid']]['transferexten']=_0x7977b9[_0x9d3b('0x4d')];queues[_0x7977b9[_0x9d3b('0x4b')]][_0x9d3b('0x45')]=_0x7977b9[_0x9d3b('0x4a')];queues[_0x7977b9[_0x9d3b('0x4b')]]['queuecallerexitreason']=_0x9d3b('0x4f');}if(!_[_0x9d3b('0x19')](queues[_0x7977b9['origtransfererlinkedid']])){if(_0x7977b9['transfereelinkedid']&&queues[_0x7977b9[_0x9d3b('0x50')]]){queues[_0x7977b9['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x7977b9['transfereeuniqueid']]=_[_0x9d3b('0x51')](queues[_0x7977b9[_0x9d3b('0x50')]]);queues[_0x7977b9[_0x9d3b('0x41')]][_0x9d3b('0x22')]=_0x7977b9[_0x9d3b('0x52')];queues[_0x7977b9[_0x9d3b('0x41')]][_0x9d3b('0x23')]=0x2;queues[_0x7977b9[_0x9d3b('0x41')]]['calleridnum']=queues[_0x7977b9[_0x9d3b('0x4b')]]['calleridnum'];queues[_0x7977b9['transfereeuniqueid']][_0x9d3b('0x53')]=queues[_0x7977b9[_0x9d3b('0x4b')]]['calleridname'];queues[_0x7977b9[_0x9d3b('0x41')]][_0x9d3b('0x54')]=utils[_0x9d3b('0x16')]();queues[_0x7977b9[_0x9d3b('0x41')]][_0x9d3b('0x32')]=utils['now']();queues[_0x7977b9['transfereeuniqueid']][_0x9d3b('0x33')]=0x0;queues[_0x7977b9[_0x9d3b('0x41')]]['mohtime']=0x0;utils['info'](util[_0x9d3b('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x7977b9[_0x9d3b('0x4a')],queues[_0x7977b9[_0x9d3b('0x41')]]['name'],queues[_0x7977b9[_0x9d3b('0x41')]][_0x9d3b('0xa')],queues[_0x7977b9['transfereeuniqueid']][_0x9d3b('0x53')]));}else{utils['info'](util[_0x9d3b('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x7977b9['origtransfereruniqueid'],queues[_0x7977b9[_0x9d3b('0x55')]][_0x9d3b('0x21')],_0x7977b9['secondtransfererlinkedid']));queues[_0x7977b9[_0x9d3b('0x55')]][_0x9d3b('0x22')]=_0x7977b9[_0x9d3b('0x4b')];}}}else if(_0x7977b9[_0x9d3b('0x56')]==_0x7977b9['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x7977b9['origtransfererlinkedid']])){utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')](_0x9d3b('0x57'),_0x7977b9[_0x9d3b('0x4a')],queues[_0x7977b9['origtransfererlinkedid']][_0x9d3b('0x21')],_0x7977b9[_0x9d3b('0x56')],_0x7977b9['secondtransfererexten']));queues[_0x7977b9['origtransfererlinkedid']]['transfer']=!![];queues[_0x7977b9[_0x9d3b('0x55')]][_0x9d3b('0x42')]='ATTENDED';queues[_0x7977b9[_0x9d3b('0x55')]][_0x9d3b('0x43')]=_0x7977b9['secondtransfererexten'];queues[_0x7977b9[_0x9d3b('0x55')]][_0x9d3b('0x45')]=_0x7977b9['secondtransfereruniqueid'];queues[_0x7977b9['origtransfererlinkedid']][_0x9d3b('0x1e')]=_0x9d3b('0x4f');}if(!_[_0x9d3b('0x19')](queues[_0x7977b9[_0x9d3b('0x4b')]])){if(_0x7977b9[_0x9d3b('0x58')]&&queues[_0x7977b9[_0x9d3b('0x58')]]){queues[_0x7977b9[_0x9d3b('0x58')]][_0x9d3b('0x23')]=0x1;queues[_0x7977b9[_0x9d3b('0x52')]]=_[_0x9d3b('0x51')](queues[_0x7977b9[_0x9d3b('0x58')]]);queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0x22')]=_0x7977b9[_0x9d3b('0x52')];queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0x23')]=0x2;queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0xa')]=queues[_0x7977b9['origtransfererlinkedid']]['calleridnum'];queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0x53')]=queues[_0x7977b9[_0x9d3b('0x55')]]['calleridname'];queues[_0x7977b9['transfertargetuniqueid']][_0x9d3b('0x54')]=utils[_0x9d3b('0x16')]();queues[_0x7977b9['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0x9d3b('0x16')]();queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0x33')]=0x0;queues[_0x7977b9['transfertargetuniqueid']][_0x9d3b('0x59')]=0x0;utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x7977b9['origtransfereruniqueid'],queues[_0x7977b9['transfertargetuniqueid']][_0x9d3b('0x21')],queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0x22')],queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0xa')],queues[_0x7977b9[_0x9d3b('0x52')]][_0x9d3b('0x53')]));}else{utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')](_0x9d3b('0x5a'),_0x7977b9[_0x9d3b('0x4a')],queues[_0x7977b9[_0x9d3b('0x4b')]][_0x9d3b('0x21')],_0x7977b9[_0x9d3b('0x55')]));queues[_0x7977b9[_0x9d3b('0x4b')]][_0x9d3b('0x22')]=_0x7977b9[_0x9d3b('0x55')];}}}}catch(_0x2961a1){utils[_0x9d3b('0x17')](util[_0x9d3b('0x4')](_0x9d3b('0x5b'),_0x7977b9['origtransfereruniqueid']),_0x2961a1);}};exports['musiconholdstart']=function(_0x57fc4c){try{if(!_[_0x9d3b('0x19')](queues[_0x57fc4c[_0x9d3b('0x6')]])){utils['debug'](util[_0x9d3b('0x4')]('[%s][queues][musiconholdstart]',_0x57fc4c[_0x9d3b('0x6')]),_0x57fc4c);queues[_0x57fc4c[_0x9d3b('0x6')]][_0x9d3b('0x5c')]=utils[_0x9d3b('0x16')]();utils['info'](util[_0x9d3b('0x4')](_0x9d3b('0x5d'),_0x57fc4c['uniqueid'],queues[_0x57fc4c[_0x9d3b('0x6')]][_0x9d3b('0x21')],queues[_0x57fc4c['uniqueid']][_0x9d3b('0x5c')]));}}catch(_0x4c51a6){utils[_0x9d3b('0x17')](util[_0x9d3b('0x4')]('[%s][queues][musiconholdstart]',_0x57fc4c[_0x9d3b('0x6')]),_0x4c51a6);}};exports[_0x9d3b('0x5e')]=function(_0x3f8d1e){try{if(!_[_0x9d3b('0x19')](queues[_0x3f8d1e[_0x9d3b('0x6')]])){if(!_['isNil'](queues[_0x3f8d1e[_0x9d3b('0x6')]][_0x9d3b('0x5c')])){utils['debug'](util[_0x9d3b('0x4')](_0x9d3b('0x5f'),_0x3f8d1e['uniqueid']),_0x3f8d1e);queues[_0x3f8d1e[_0x9d3b('0x6')]][_0x9d3b('0x59')]+=utils[_0x9d3b('0x60')](utils[_0x9d3b('0x16')](),queues[_0x3f8d1e[_0x9d3b('0x6')]][_0x9d3b('0x5c')]);utils[_0x9d3b('0x3')](util[_0x9d3b('0x4')](_0x9d3b('0x61'),_0x3f8d1e[_0x9d3b('0x6')],queues[_0x3f8d1e[_0x9d3b('0x6')]][_0x9d3b('0x21')],queues[_0x3f8d1e[_0x9d3b('0x6')]][_0x9d3b('0x59')]));delete queues[_0x3f8d1e[_0x9d3b('0x6')]][_0x9d3b('0x5c')];}}}catch(_0x2eed28){utils[_0x9d3b('0x17')](util['format']('[%s][queues][musiconholdstop]',_0x3f8d1e[_0x9d3b('0x6')]),_0x2eed28);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 681ba3f..74bc33b 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 _0xfc88=['calleridname','cause-txt','connectedlinename','type','outbound','connectedlinenum','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','accountcode','getUserByInternal','then','membername','UserId','CreateVoiceRecording','request','newchannel','debug','format','uniqueid','linkedid','context','exten','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum'];(function(_0x3c0df9,_0x1bd56e){var _0xc0bffe=function(_0x52e798){while(--_0x52e798){_0x3c0df9['push'](_0x3c0df9['shift']());}};_0xc0bffe(++_0x1bd56e);}(_0xfc88,0xca));var _0x8fc8=function(_0x19dd84,_0x21a62c){_0x19dd84=_0x19dd84-0x0;var _0x2c4682=_0xfc88[_0x19dd84];return _0x2c4682;};'use strict';var _=require(_0x8fc8('0x0'));var util=require(_0x8fc8('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x3fc4c9){utils[_0x8fc8('0x2')](util['format']('[%s][recordings][writeDB]',_0x3fc4c9['uniqueid']));if(_0x3fc4c9[_0x8fc8('0x3')]){utils[_0x8fc8('0x4')](_0x3fc4c9[_0x8fc8('0x3')])[_0x8fc8('0x5')](function(_0x3eaa32){if(_0x3eaa32){_0x3fc4c9[_0x8fc8('0x6')]=_0x3eaa32['name'];_0x3fc4c9[_0x8fc8('0x7')]=_0x3eaa32['id'];}utils['request'](_0x8fc8('0x8'),_0x3fc4c9);});}else{utils[_0x8fc8('0x9')]('CreateVoiceRecording',_0x3fc4c9);}}exports[_0x8fc8('0xa')]=function(_0x3f8518){try{utils[_0x8fc8('0xb')](util[_0x8fc8('0xc')]('[%s][recordings][newchannel]',_0x3f8518[_0x8fc8('0xd')]),_0x3f8518);if(_0x3f8518[_0x8fc8('0xd')]==_0x3f8518[_0x8fc8('0xe')]){utils[_0x8fc8('0x2')](util[_0x8fc8('0xc')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x3f8518['uniqueid'],_0x3f8518[_0x8fc8('0xf')],_0x3f8518[_0x8fc8('0x10')]));recordings[_0x3f8518[_0x8fc8('0xd')]]={'uniqueid':_0x3f8518[_0x8fc8('0xd')],'accountcode':_0x3f8518[_0x8fc8('0x3')],'exten':_0x3f8518[_0x8fc8('0x10')],'context':_0x3f8518[_0x8fc8('0xf')],'channel':_0x3f8518[_0x8fc8('0x11')],'monitors':[]};}}catch(_0x28d74d){utils[_0x8fc8('0x12')](util[_0x8fc8('0xc')](_0x8fc8('0x13'),_0x3f8518['uniqueid']),_0x28d74d);}};exports[_0x8fc8('0x14')]=function(_0x1e0211){try{utils[_0x8fc8('0xb')](util[_0x8fc8('0xc')](_0x8fc8('0x15'),_0x1e0211[_0x8fc8('0xd')]),_0x1e0211);if(!_[_0x8fc8('0x16')](recordings[_0x1e0211[_0x8fc8('0xd')]])&&_0x1e0211[_0x8fc8('0x17')]==0x6){utils['info'](util[_0x8fc8('0xc')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x1e0211[_0x8fc8('0xd')],_0x1e0211['context'],_0x1e0211[_0x8fc8('0x11')]));}else if(!_[_0x8fc8('0x16')](recordings[_0x1e0211['linkedid']])&&_0x1e0211['channelstate']==0x6&&_0x1e0211['context']!=_0x8fc8('0x18')){utils[_0x8fc8('0x2')](util[_0x8fc8('0xc')](_0x8fc8('0x19'),_0x1e0211[_0x8fc8('0xd')],_0x1e0211[_0x8fc8('0xe')],_0x1e0211[_0x8fc8('0xf')],_0x1e0211[_0x8fc8('0x11')]));recordings[_0x1e0211[_0x8fc8('0xe')]][_0x8fc8('0x3')]=_0x1e0211['accountcode'];}}catch(_0x4e9dbe){utils[_0x8fc8('0x12')](util[_0x8fc8('0xc')](_0x8fc8('0x15'),_0x1e0211[_0x8fc8('0xd')]),_0x4e9dbe);}};exports[_0x8fc8('0x1a')]=function(_0x2ec5a0){try{if(!_['isNil'](_0x2ec5a0['variable'])&&!_[_0x8fc8('0x16')](_0x2ec5a0[_0x8fc8('0x1b')][_0x8fc8('0x1c')])){utils[_0x8fc8('0xb')](util[_0x8fc8('0xc')](_0x8fc8('0x1d'),_0x2ec5a0[_0x8fc8('0xd')]),_0x2ec5a0);utils[_0x8fc8('0x2')](util[_0x8fc8('0xc')](_0x8fc8('0x1e'),_0x2ec5a0[_0x8fc8('0xd')],_0x2ec5a0[_0x8fc8('0x1b')],_0x2ec5a0[_0x8fc8('0x1f')]));if(_[_0x8fc8('0x20')](_0x2ec5a0['value'],_0x8fc8('0x21'))){_0x2ec5a0[_0x8fc8('0x1f')]=_0x2ec5a0[_0x8fc8('0x1f')][_0x8fc8('0x22')](_0x8fc8('0x21'),_0x8fc8('0x23'));}if(recordings[_0x2ec5a0[_0x8fc8('0xe')]]){var _0x4c3498=_['find'](recordings[_0x2ec5a0['linkedid']][_0x8fc8('0x24')],{'value':_0x2ec5a0['value']});if(_[_0x8fc8('0x16')](_0x4c3498)){recordings[_0x2ec5a0[_0x8fc8('0xe')]]['monitors'][_0x8fc8('0x25')]({'value':_0x2ec5a0[_0x8fc8('0x1f')]});}}}}catch(_0x16ac66){utils[_0x8fc8('0x12')](util[_0x8fc8('0xc')](_0x8fc8('0x1d'),_0x2ec5a0[_0x8fc8('0xd')]),_0x16ac66);}};exports[_0x8fc8('0x26')]=function(_0x13809a){try{if(!_[_0x8fc8('0x16')](recordings[_0x13809a['uniqueid']])){utils['debug'](util[_0x8fc8('0xc')](_0x8fc8('0x27'),_0x13809a['uniqueid']),_0x13809a);utils[_0x8fc8('0x2')](util['format'](_0x8fc8('0x28'),_0x13809a[_0x8fc8('0xd')],_0x13809a[_0x8fc8('0x29')],_0x13809a[_0x8fc8('0x2a')],_0x13809a[_0x8fc8('0x2b')]));recordings[_0x13809a[_0x8fc8('0xd')]][_0x8fc8('0x29')]=_0x13809a[_0x8fc8('0x29')];recordings[_0x13809a['uniqueid']][_0x8fc8('0x2a')]=_0x13809a[_0x8fc8('0x2a')];recordings[_0x13809a[_0x8fc8('0xd')]]['connectedlinenum']=_0x13809a['connectedlinenum'];recordings[_0x13809a[_0x8fc8('0xd')]][_0x8fc8('0x2c')]=_0x13809a[_0x8fc8('0x2c')];if(recordings[_0x13809a[_0x8fc8('0xd')]][_0x8fc8('0x2d')]==_0x8fc8('0x2e')&&recordings[_0x13809a[_0x8fc8('0xd')]][_0x8fc8('0x3')]){recordings[_0x13809a['uniqueid']][_0x8fc8('0x2f')]=recordings[_0x13809a[_0x8fc8('0xd')]][_0x8fc8('0x3')];recordings[_0x13809a[_0x8fc8('0xd')]]['connectedlinename']='';}recordings[_0x13809a['uniqueid']][_0x8fc8('0x24')]['forEach'](function(_0x17a066){var _0x4a3059=_[_0x8fc8('0x30')](recordings[_0x13809a[_0x8fc8('0xd')]]);_0x4a3059[_0x8fc8('0x1f')]=_0x17a066[_0x8fc8('0x1f')];writeDB(_0x4a3059);});delete recordings[_0x13809a[_0x8fc8('0xd')]];}}catch(_0x3684c8){utils['error'](util[_0x8fc8('0xc')](_0x8fc8('0x27'),_0x13809a['uniqueid']),_0x3684c8);}};exports['newexten']=function(_0x5c4f65){try{if(!_[_0x8fc8('0x16')](recordings[_0x5c4f65[_0x8fc8('0xd')]])){utils[_0x8fc8('0xb')](util[_0x8fc8('0xc')](_0x8fc8('0x31'),_0x5c4f65[_0x8fc8('0xd')]),_0x5c4f65);utils[_0x8fc8('0x2')](util[_0x8fc8('0xc')](_0x8fc8('0x32'),_0x5c4f65[_0x8fc8('0xd')],_0x5c4f65['application'],_0x5c4f65[_0x8fc8('0x33')]));if(_0x5c4f65[_0x8fc8('0x34')][_0x8fc8('0x35')]()=='set'&&_[_0x8fc8('0x36')](_0x5c4f65[_0x8fc8('0x33')][_0x8fc8('0x35')](),_0x8fc8('0x37'))){var _0x19d1d6=_0x5c4f65[_0x8fc8('0x33')]['split']('=');var _0x46f878=_0x19d1d6[0x0][_0x8fc8('0x38')](_0x19d1d6[0x0][_0x8fc8('0x39')]('(')+0x1,_0x19d1d6[0x0][_0x8fc8('0x39')](')'));var _0x5a4a1e=_0x19d1d6[0x1];recordings[_0x5c4f65[_0x8fc8('0xd')]][_0x46f878]=_0x5a4a1e;}}}catch(_0x351bb7){utils['error'](util['format'](_0x8fc8('0x31'),_0x5c4f65[_0x8fc8('0xd')]),_0x351bb7);}};exports['queuecallerjoin']=function(_0x2c7ab2){try{if(!_[_0x8fc8('0x16')](recordings[_0x2c7ab2[_0x8fc8('0xd')]])){utils[_0x8fc8('0xb')](util[_0x8fc8('0xc')](_0x8fc8('0x3a'),_0x2c7ab2[_0x8fc8('0xd')]),_0x2c7ab2);utils[_0x8fc8('0x2')](util[_0x8fc8('0xc')](_0x8fc8('0x3b'),_0x2c7ab2[_0x8fc8('0xd')],_0x2c7ab2[_0x8fc8('0x3c')]));recordings[_0x2c7ab2[_0x8fc8('0xd')]][_0x8fc8('0x3c')]=_0x2c7ab2[_0x8fc8('0x3c')];}}catch(_0x13d608){utils[_0x8fc8('0x12')](util[_0x8fc8('0xc')](_0x8fc8('0x3a'),_0x2c7ab2['uniqueid']),_0x13d608);}}; \ No newline at end of file +var _0xdc60=['application','toLowerCase','set','startsWith','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','isNil','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','push','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','appdata'];(function(_0x50eb3f,_0x44231f){var _0xcad21c=function(_0x52942a){while(--_0x52942a){_0x50eb3f['push'](_0x50eb3f['shift']());}};_0xcad21c(++_0x44231f);}(_0xdc60,0x168));var _0x0dc6=function(_0x2af0bd,_0x30c3ac){_0x2af0bd=_0x2af0bd-0x0;var _0x1f52cd=_0xdc60[_0x2af0bd];return _0x1f52cd;};'use strict';var _=require(_0x0dc6('0x0'));var util=require('util');var utils=require(_0x0dc6('0x1'));var recordings={};function writeDB(_0x2e86f5){utils[_0x0dc6('0x2')](util['format'](_0x0dc6('0x3'),_0x2e86f5[_0x0dc6('0x4')]));if(_0x2e86f5[_0x0dc6('0x5')]){utils[_0x0dc6('0x6')](_0x2e86f5['accountcode'])['then'](function(_0x37e5ea){if(_0x37e5ea){_0x2e86f5[_0x0dc6('0x7')]=_0x37e5ea['name'];_0x2e86f5['UserId']=_0x37e5ea['id'];}utils[_0x0dc6('0x8')](_0x0dc6('0x9'),_0x2e86f5);});}else{utils[_0x0dc6('0x8')](_0x0dc6('0x9'),_0x2e86f5);}}exports['newchannel']=function(_0x44764b){try{utils[_0x0dc6('0xa')](util['format'](_0x0dc6('0xb'),_0x44764b['uniqueid']),_0x44764b);if(_0x44764b[_0x0dc6('0x4')]==_0x44764b[_0x0dc6('0xc')]){utils[_0x0dc6('0x2')](util[_0x0dc6('0xd')](_0x0dc6('0xe'),_0x44764b[_0x0dc6('0x4')],_0x44764b[_0x0dc6('0xf')],_0x44764b[_0x0dc6('0x10')]));recordings[_0x44764b['uniqueid']]={'uniqueid':_0x44764b[_0x0dc6('0x4')],'accountcode':_0x44764b[_0x0dc6('0x5')],'exten':_0x44764b['exten'],'context':_0x44764b[_0x0dc6('0xf')],'channel':_0x44764b[_0x0dc6('0x11')],'monitors':[]};}}catch(_0x47983a){utils[_0x0dc6('0x12')](util[_0x0dc6('0xd')](_0x0dc6('0xb'),_0x44764b[_0x0dc6('0x4')]),_0x47983a);}};exports['newstate']=function(_0x23e8c0){try{utils[_0x0dc6('0xa')](util[_0x0dc6('0xd')]('[%s][recordings][newstate]',_0x23e8c0['uniqueid']),_0x23e8c0);if(!_[_0x0dc6('0x13')](recordings[_0x23e8c0['uniqueid']])&&_0x23e8c0[_0x0dc6('0x14')]==0x6){utils[_0x0dc6('0x2')](util[_0x0dc6('0xd')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x23e8c0[_0x0dc6('0x4')],_0x23e8c0[_0x0dc6('0xf')],_0x23e8c0['channel']));}else if(!_[_0x0dc6('0x13')](recordings[_0x23e8c0[_0x0dc6('0xc')]])&&_0x23e8c0[_0x0dc6('0x14')]==0x6&&_0x23e8c0[_0x0dc6('0xf')]!='transfer'){utils['info'](util['format'](_0x0dc6('0x15'),_0x23e8c0['uniqueid'],_0x23e8c0['linkedid'],_0x23e8c0[_0x0dc6('0xf')],_0x23e8c0[_0x0dc6('0x11')]));recordings[_0x23e8c0[_0x0dc6('0xc')]][_0x0dc6('0x5')]=_0x23e8c0['accountcode'];}}catch(_0x3811d8){utils[_0x0dc6('0x12')](util[_0x0dc6('0xd')]('[%s][recordings][newstate]',_0x23e8c0['uniqueid']),_0x3811d8);}};exports[_0x0dc6('0x16')]=function(_0x1da4e5){try{if(!_[_0x0dc6('0x13')](_0x1da4e5[_0x0dc6('0x17')])&&!_[_0x0dc6('0x13')](_0x1da4e5[_0x0dc6('0x17')][_0x0dc6('0x18')])){utils[_0x0dc6('0xa')](util['format'](_0x0dc6('0x19'),_0x1da4e5['uniqueid']),_0x1da4e5);utils[_0x0dc6('0x2')](util[_0x0dc6('0xd')](_0x0dc6('0x1a'),_0x1da4e5[_0x0dc6('0x4')],_0x1da4e5['variable'],_0x1da4e5[_0x0dc6('0x1b')]));if(_[_0x0dc6('0x1c')](_0x1da4e5[_0x0dc6('0x1b')],'.wav49')){_0x1da4e5['value']=_0x1da4e5['value'][_0x0dc6('0x1d')](_0x0dc6('0x1e'),_0x0dc6('0x1f'));}if(recordings[_0x1da4e5[_0x0dc6('0xc')]]){var _0x5d46cb=_[_0x0dc6('0x20')](recordings[_0x1da4e5[_0x0dc6('0xc')]]['monitors'],{'value':_0x1da4e5[_0x0dc6('0x1b')]});if(_[_0x0dc6('0x13')](_0x5d46cb)){recordings[_0x1da4e5[_0x0dc6('0xc')]][_0x0dc6('0x21')][_0x0dc6('0x22')]({'value':_0x1da4e5[_0x0dc6('0x1b')]});}}}}catch(_0x39d7c1){utils['error'](util['format'](_0x0dc6('0x19'),_0x1da4e5['uniqueid']),_0x39d7c1);}};exports['hangup']=function(_0x46b85e){try{if(!_['isNil'](recordings[_0x46b85e[_0x0dc6('0x4')]])){utils[_0x0dc6('0xa')](util[_0x0dc6('0xd')](_0x0dc6('0x23'),_0x46b85e['uniqueid']),_0x46b85e);utils[_0x0dc6('0x2')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x46b85e[_0x0dc6('0x4')],_0x46b85e[_0x0dc6('0x24')],_0x46b85e[_0x0dc6('0x25')],_0x46b85e[_0x0dc6('0x26')]));recordings[_0x46b85e[_0x0dc6('0x4')]][_0x0dc6('0x24')]=_0x46b85e['calleridnum'];recordings[_0x46b85e[_0x0dc6('0x4')]][_0x0dc6('0x25')]=_0x46b85e[_0x0dc6('0x25')];recordings[_0x46b85e[_0x0dc6('0x4')]][_0x0dc6('0x27')]=_0x46b85e['connectedlinenum'];recordings[_0x46b85e[_0x0dc6('0x4')]][_0x0dc6('0x28')]=_0x46b85e[_0x0dc6('0x28')];if(recordings[_0x46b85e[_0x0dc6('0x4')]][_0x0dc6('0x29')]==_0x0dc6('0x2a')&&recordings[_0x46b85e[_0x0dc6('0x4')]][_0x0dc6('0x5')]){recordings[_0x46b85e['uniqueid']][_0x0dc6('0x27')]=recordings[_0x46b85e['uniqueid']]['accountcode'];recordings[_0x46b85e['uniqueid']]['connectedlinename']='';}recordings[_0x46b85e[_0x0dc6('0x4')]][_0x0dc6('0x21')][_0x0dc6('0x2b')](function(_0xd544b){var _0x4450f9=_['clone'](recordings[_0x46b85e[_0x0dc6('0x4')]]);_0x4450f9[_0x0dc6('0x1b')]=_0xd544b[_0x0dc6('0x1b')];writeDB(_0x4450f9);});delete recordings[_0x46b85e[_0x0dc6('0x4')]];}}catch(_0xafd0af){utils[_0x0dc6('0x12')](util[_0x0dc6('0xd')](_0x0dc6('0x23'),_0x46b85e['uniqueid']),_0xafd0af);}};exports[_0x0dc6('0x2c')]=function(_0x5a72fd){try{if(!_['isNil'](recordings[_0x5a72fd[_0x0dc6('0x4')]])){utils['debug'](util[_0x0dc6('0xd')]('[%s][recordings][newexten]',_0x5a72fd[_0x0dc6('0x4')]),_0x5a72fd);utils[_0x0dc6('0x2')](util[_0x0dc6('0xd')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x5a72fd[_0x0dc6('0x4')],_0x5a72fd['application'],_0x5a72fd[_0x0dc6('0x2d')]));if(_0x5a72fd[_0x0dc6('0x2e')][_0x0dc6('0x2f')]()==_0x0dc6('0x30')&&_[_0x0dc6('0x31')](_0x5a72fd[_0x0dc6('0x2d')][_0x0dc6('0x2f')](),'cdr')){var _0x1b1e52=_0x5a72fd[_0x0dc6('0x2d')][_0x0dc6('0x32')]('=');var _0x1a7ad4=_0x1b1e52[0x0][_0x0dc6('0x33')](_0x1b1e52[0x0][_0x0dc6('0x34')]('(')+0x1,_0x1b1e52[0x0][_0x0dc6('0x34')](')'));var _0x206d33=_0x1b1e52[0x1];recordings[_0x5a72fd[_0x0dc6('0x4')]][_0x1a7ad4]=_0x206d33;}}}catch(_0x4c783f){utils[_0x0dc6('0x12')](util['format'](_0x0dc6('0x35'),_0x5a72fd['uniqueid']),_0x4c783f);}};exports[_0x0dc6('0x36')]=function(_0x561870){try{if(!_[_0x0dc6('0x13')](recordings[_0x561870[_0x0dc6('0x4')]])){utils[_0x0dc6('0xa')](util[_0x0dc6('0xd')](_0x0dc6('0x37'),_0x561870[_0x0dc6('0x4')]),_0x561870);utils[_0x0dc6('0x2')](util[_0x0dc6('0xd')](_0x0dc6('0x38'),_0x561870['uniqueid'],_0x561870[_0x0dc6('0x39')]));recordings[_0x561870['uniqueid']][_0x0dc6('0x39')]=_0x561870[_0x0dc6('0x39')];}}catch(_0x51865c){utils[_0x0dc6('0x12')](util[_0x0dc6('0xd')]('[%s][recordings][queuecallerjoin]',_0x561870[_0x0dc6('0x4')]),_0x51865c);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a7efc9f..934af8f 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 _0x9990=['secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','error','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode'];(function(_0x488de1,_0x23eb71){var _0x12b10b=function(_0x599ee3){while(--_0x599ee3){_0x488de1['push'](_0x488de1['shift']());}};_0x12b10b(++_0x23eb71);}(_0x9990,0xf6));var _0x0999=function(_0x4d3a2b,_0x32a224){_0x4d3a2b=_0x4d3a2b-0x0;var _0xdd32c8=_0x9990[_0x4d3a2b];return _0xdd32c8;};'use strict';var _=require('lodash');var util=require(_0x0999('0x0'));var utils=require(_0x0999('0x1'));function writeDB(_0xbbb89f){utils[_0x0999('0x2')](util[_0x0999('0x3')](_0x0999('0x4'),_0xbbb89f[_0x0999('0x5')]===_0x0999('0x6')?_0xbbb89f['origtransfereruniqueid']:_0xbbb89f[_0x0999('0x7')],_0xbbb89f[_0x0999('0x5')]));utils[_0x0999('0x8')]('CreateVoiceTransferReport',_0xbbb89f);}exports[_0x0999('0x9')]=function(_0xb1d8f9){try{utils[_0x0999('0xa')](util[_0x0999('0x3')](_0x0999('0xb'),_0xb1d8f9[_0x0999('0x7')]),_0xb1d8f9);utils[_0x0999('0x2')](util['format'](_0x0999('0xc'),_0xb1d8f9[_0x0999('0x7')],_0xb1d8f9[_0x0999('0xd')],_0xb1d8f9['transferercalleridname'],_0xb1d8f9[_0x0999('0xe')],_0xb1d8f9[_0x0999('0xf')]));_0xb1d8f9[_0x0999('0x5')]='blind';writeDB(_0xb1d8f9);}catch(_0x43f15c){utils['error'](util[_0x0999('0x3')](_0x0999('0xb'),_0xb1d8f9[_0x0999('0x7')]),_0x43f15c);}};exports[_0x0999('0x10')]=function(_0x1a7598){try{utils['debug'](util[_0x0999('0x3')](_0x0999('0x11'),_0x1a7598[_0x0999('0x12')]),_0x1a7598);utils[_0x0999('0x2')](util[_0x0999('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1a7598[_0x0999('0x12')],_0x1a7598[_0x0999('0x13')],_0x1a7598[_0x0999('0x14')],_0x1a7598[_0x0999('0x15')],_0x1a7598[_0x0999('0x16')]));_0x1a7598=_[_0x0999('0x17')](_0x1a7598,{'transfererchannel':_0x1a7598[_0x0999('0x18')],'transferercalleridnum':_0x1a7598['origtransferercalleridnum'],'transferercalleridname':_0x1a7598[_0x0999('0x14')],'transfererconnectedlinenum':_0x1a7598[_0x0999('0x19')],'transfererconnectedlinename':_0x1a7598['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1a7598[_0x0999('0x1a')],'transferercontext':_0x1a7598[_0x0999('0x1b')],'transfererexten':_0x1a7598['secondtransfererexten'],'transfererlinkedid':_0x1a7598[_0x0999('0x1c')],'context':_0x1a7598[_0x0999('0x1d')],'extension':_0x1a7598[_0x0999('0x1e')],'type':_0x0999('0x6')});if(_[_0x0999('0x1f')](_0x1a7598[_0x0999('0x20')])){_0x1a7598=_[_0x0999('0x17')](_0x1a7598,{'transfereechannel':_0x1a7598[_0x0999('0x21')],'transfereecalleridnum':_0x1a7598[_0x0999('0x15')],'transfereecalleridname':_0x1a7598['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1a7598[_0x0999('0x22')],'transfereeconnectedlinename':_0x1a7598[_0x0999('0x23')],'transfereeaccountcode':_0x1a7598['transfertargetaccountcode'],'transfereecontext':_0x1a7598['transfertargetcontext'],'transfereeexten':_0x1a7598[_0x0999('0x24')],'transfereelinkedid':_0x1a7598[_0x0999('0x25')]});}writeDB(_0x1a7598);}catch(_0x2404be){utils[_0x0999('0x26')](util[_0x0999('0x3')](_0x0999('0x11'),_0x1a7598['origtransfereruniqueid']),_0x2404be);}}; \ No newline at end of file +var _0xad13=['info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','lodash','./utils'];(function(_0x4805be,_0x459696){var _0x222db3=function(_0x446fff){while(--_0x446fff){_0x4805be['push'](_0x4805be['shift']());}};_0x222db3(++_0x459696);}(_0xad13,0x79));var _0x3ad1=function(_0x278bce,_0x3b0dee){_0x278bce=_0x278bce-0x0;var _0xf355d6=_0xad13[_0x278bce];return _0xf355d6;};'use strict';var _=require(_0x3ad1('0x0'));var util=require('util');var utils=require(_0x3ad1('0x1'));function writeDB(_0x201a15){utils[_0x3ad1('0x2')](util[_0x3ad1('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x201a15[_0x3ad1('0x4')]===_0x3ad1('0x5')?_0x201a15[_0x3ad1('0x6')]:_0x201a15[_0x3ad1('0x7')],_0x201a15[_0x3ad1('0x4')]));utils[_0x3ad1('0x8')](_0x3ad1('0x9'),_0x201a15);}exports[_0x3ad1('0xa')]=function(_0x44fd50){try{utils[_0x3ad1('0xb')](util['format'](_0x3ad1('0xc'),_0x44fd50[_0x3ad1('0x7')]),_0x44fd50);utils[_0x3ad1('0x2')](util['format'](_0x3ad1('0xd'),_0x44fd50[_0x3ad1('0x7')],_0x44fd50['transferercalleridnum'],_0x44fd50[_0x3ad1('0xe')],_0x44fd50[_0x3ad1('0xf')],_0x44fd50[_0x3ad1('0x10')]));_0x44fd50[_0x3ad1('0x4')]=_0x3ad1('0x11');writeDB(_0x44fd50);}catch(_0x3bcab7){utils['error'](util['format'](_0x3ad1('0xc'),_0x44fd50[_0x3ad1('0x7')]),_0x3bcab7);}};exports[_0x3ad1('0x12')]=function(_0x3eadf8){try{utils['debug'](util[_0x3ad1('0x3')]('[%s][transfers][attendedtransfer]',_0x3eadf8[_0x3ad1('0x6')]),_0x3eadf8);utils[_0x3ad1('0x2')](util[_0x3ad1('0x3')](_0x3ad1('0x13'),_0x3eadf8[_0x3ad1('0x6')],_0x3eadf8[_0x3ad1('0x14')],_0x3eadf8[_0x3ad1('0x15')],_0x3eadf8[_0x3ad1('0x16')],_0x3eadf8[_0x3ad1('0x17')]));_0x3eadf8=_[_0x3ad1('0x18')](_0x3eadf8,{'transfererchannel':_0x3eadf8[_0x3ad1('0x19')],'transferercalleridnum':_0x3eadf8[_0x3ad1('0x14')],'transferercalleridname':_0x3eadf8['origtransferercalleridname'],'transfererconnectedlinenum':_0x3eadf8[_0x3ad1('0x1a')],'transfererconnectedlinename':_0x3eadf8[_0x3ad1('0x1b')],'transfereraccountcode':_0x3eadf8[_0x3ad1('0x1c')],'transferercontext':_0x3eadf8[_0x3ad1('0x1d')],'transfererexten':_0x3eadf8[_0x3ad1('0x1e')],'transfererlinkedid':_0x3eadf8['origtransfererlinkedid'],'context':_0x3eadf8[_0x3ad1('0x1f')],'extension':_0x3eadf8[_0x3ad1('0x20')],'type':'attended'});if(_[_0x3ad1('0x21')](_0x3eadf8[_0x3ad1('0x22')])){_0x3eadf8=_[_0x3ad1('0x18')](_0x3eadf8,{'transfereechannel':_0x3eadf8[_0x3ad1('0x23')],'transfereecalleridnum':_0x3eadf8[_0x3ad1('0x16')],'transfereecalleridname':_0x3eadf8[_0x3ad1('0x17')],'transfereeconnectedlinenum':_0x3eadf8['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3eadf8[_0x3ad1('0x24')],'transfereeaccountcode':_0x3eadf8['transfertargetaccountcode'],'transfereecontext':_0x3eadf8[_0x3ad1('0x25')],'transfereeexten':_0x3eadf8['transfertargetexten'],'transfereelinkedid':_0x3eadf8[_0x3ad1('0x26')]});}writeDB(_0x3eadf8);}catch(_0x34df3d){utils[_0x3ad1('0x27')](util[_0x3ad1('0x3')](_0x3ad1('0x28'),_0x3eadf8[_0x3ad1('0x6')]),_0x34df3d);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 0c67fa3..9f832db 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 _0xe1e6=['getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','util','client','../../config/logger','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','name','then','[utils][getUser]\x20where:%s','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]'];(function(_0x3ed6d5,_0x207bae){var _0x298086=function(_0x19f25d){while(--_0x19f25d){_0x3ed6d5['push'](_0x3ed6d5['shift']());}};_0x298086(++_0x207bae);}(_0xe1e6,0x67));var _0x6e1e=function(_0x19613b,_0x3350b7){_0x19613b=_0x19613b-0x0;var _0xa4c014=_0xe1e6[_0x19613b];return _0xa4c014;};'use strict';var BPromise=require(_0x6e1e('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0x6e1e('0x1'));var client=jayson[_0x6e1e('0x2')]['http']({'port':0x2329});var logger=require(_0x6e1e('0x3'))('xdr');exports[_0x6e1e('0x4')]=function(_0x5f0abf,_0x69521c){logger[_0x6e1e('0x4')](_0x5f0abf,_0x69521c?util[_0x6e1e('0x5')](_0x69521c,{'showHidden':![],'depth':null}):'');};exports[_0x6e1e('0x6')]=function(_0x50e059,_0x4560da){logger['debug'](_0x50e059,_0x4560da?util[_0x6e1e('0x5')](_0x4560da,{'showHidden':![],'depth':null}):'');};exports[_0x6e1e('0x7')]=function(_0x55f776,_0x34d2ec){logger[_0x6e1e('0x7')](_0x55f776,_0x34d2ec?util[_0x6e1e('0x5')](_0x34d2ec,{'showHidden':![],'depth':null}):'');};exports[_0x6e1e('0x8')]=function(_0x43716a,_0x2fc20d){return client['request'](_0x43716a,{'body':_0x2fc20d})['then'](function(_0x32f5d9){logger['debug'](_0x6e1e('0x9'),_0x43716a,_0x32f5d9?util[_0x6e1e('0x5')](_0x32f5d9,{'showHidden':![],'depth':null}):'');})[_0x6e1e('0xa')](function(_0x38a84f){logger[_0x6e1e('0x7')](_0x6e1e('0x9'),_0x43716a,_0x38a84f?util[_0x6e1e('0x5')](_0x38a84f,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3e54f1){return client['request'](_0x6e1e('0xb'),{'options':{'raw':!![],'attributes':['id','internal',_0x6e1e('0xc'),'interface'],'where':_0x3e54f1,'limit':0x1}})[_0x6e1e('0xd')](function(_0x1d4cb4){logger[_0x6e1e('0x6')](_0x6e1e('0xe'),JSON['stringify'](_0x3e54f1),_0x1d4cb4?util[_0x6e1e('0x5')](_0x1d4cb4,{'showHidden':![],'depth':null}):'');return _0x1d4cb4[_0x6e1e('0xf')][_0x6e1e('0x10')]?_0x1d4cb4[_0x6e1e('0xf')][0x0]:null;});}exports['getUserByInternal']=function(_0x328a2d){return new BPromise(function(_0x28108b,_0x2ae0ff){if(_0x328a2d){return getUser({'internal':_0x328a2d})['then'](function(_0x1f0349){logger['info'](_0x6e1e('0x11'),_0x328a2d,_0x1f0349?_0x6e1e('0x12'):_0x6e1e('0x13'));return _0x28108b(_0x1f0349);})['catch'](function(_0x56511e){logger['error'](_0x6e1e('0x14'),_0x56511e?util[_0x6e1e('0x5')](_0x56511e,{'showHidden':![],'depth':null}):'');return _0x28108b(null);});}return _0x28108b(null);});};exports[_0x6e1e('0x15')]=function(_0x174263){return new BPromise(function(_0x1d243e,_0xf4e164){if(_0x174263){return getUser({'interface':_0x174263})[_0x6e1e('0xd')](function(_0x43d15d){logger[_0x6e1e('0x4')](_0x6e1e('0x16'),_0x174263,_0x43d15d?_0x6e1e('0x12'):_0x6e1e('0x13'));return _0x1d243e(_0x43d15d);})[_0x6e1e('0xa')](function(_0x4f44e1){logger[_0x6e1e('0x7')](_0x6e1e('0x17'),_0x4f44e1?util[_0x6e1e('0x5')](_0x4f44e1,{'showHidden':![],'depth':null}):'');return _0x1d243e(null);});}return _0x1d243e(null);});};exports['getUserByName']=function(_0x26b7dc){return new BPromise(function(_0x5c5e29,_0x457456){if(_0x26b7dc){return getUser({'name':_0x26b7dc})[_0x6e1e('0xd')](function(_0x23caf5){logger[_0x6e1e('0x4')](_0x6e1e('0x18'),_0x26b7dc,_0x23caf5?_0x6e1e('0x12'):_0x6e1e('0x13'));return _0x5c5e29(_0x23caf5);})[_0x6e1e('0xa')](function(_0xbad71f){logger[_0x6e1e('0x7')](_0x6e1e('0x19'),_0xbad71f?util[_0x6e1e('0x5')](_0xbad71f,{'showHidden':![],'depth':null}):'');return _0x5c5e29(null);});}return _0x5c5e29(null);});};exports[_0x6e1e('0x1a')]=function(_0x2becfe){return new BPromise(function(_0x5e3a69,_0x5b7532){if(_0x2becfe){return client[_0x6e1e('0x8')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x6e1e('0x1b'),_0x6e1e('0x1c'),'acwTimeout'],'where':{'name':_0x2becfe},'limit':0x1}})['then'](function(_0x56d449){logger['debug'](_0x6e1e('0x1d'),_0x2becfe,_0x56d449?util[_0x6e1e('0x5')](_0x56d449,{'showHidden':![],'depth':null}):'');logger[_0x6e1e('0x4')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x2becfe,_0x56d449?_0x6e1e('0x12'):_0x6e1e('0x13'));return _0x5e3a69(_0x56d449[_0x6e1e('0xf')][_0x6e1e('0x10')]?_0x56d449[_0x6e1e('0xf')][0x0]:null);})[_0x6e1e('0xa')](function(_0xf22466){logger[_0x6e1e('0x7')]('[utils][getVoiceQueueByName]',_0xf22466?util['inspect'](_0xf22466,{'showHidden':![],'depth':null}):'');return _0x5e3a69(null);});}return _0x5e3a69(null);});};exports[_0x6e1e('0x1e')]=function(_0x53b294,_0x4e6dfb){return moment(_0x53b294)[_0x6e1e('0x1f')](_0x4e6dfb,_0x6e1e('0x20'))[_0x6e1e('0x21')](_0x6e1e('0x22'));};exports[_0x6e1e('0x23')]=function(_0xc18386,_0x1ec6f1){return moment(_0xc18386)[_0x6e1e('0x24')](_0x1ec6f1,_0x6e1e('0x20'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x6e1e('0x25')]=function(_0x20b608,_0x296912){return moment(_0x20b608)[_0x6e1e('0x26')](moment(_0x296912),_0x6e1e('0x20'));};exports[_0x6e1e('0x27')]=function(_0x460ad0,_0x1b11c2){return parseInt(_0x460ad0,0xa)+parseInt(_0x1b11c2,0xa);};exports[_0x6e1e('0x28')]=function(){return moment()[_0x6e1e('0x21')](_0x6e1e('0x22'));};exports[_0x6e1e('0x29')]=function(_0x33c0e6,_0x51196f){if(_0x51196f){return moment(_0x33c0e6)['isAfter'](_0x51196f);}return!![];};exports[_0x6e1e('0x2a')]=function(_0x2bf842,_0x5d8510){if(_0x5d8510){return moment(_0x2bf842)[_0x6e1e('0x2a')](_0x5d8510);}else if(_0x2bf842){return!![];}return![];}; \ No newline at end of file +var _0xabec=['add','YYYY-MM-DD\x20HH:mm:ss','subtract','seconds','format','diffTime','sumTime','now','isAfter','isBefore','jayson/promise','client','http','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime'];(function(_0x4585ee,_0x2f4a68){var _0x14db51=function(_0x35f3f6){while(--_0x35f3f6){_0x4585ee['push'](_0x4585ee['shift']());}};_0x14db51(++_0x2f4a68);}(_0xabec,0x15a));var _0xcabe=function(_0x395928,_0x51afb0){_0x395928=_0x395928-0x0;var _0x4efda4=_0xabec[_0x395928];return _0x4efda4;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xcabe('0x0'));var moment=require('moment');var util=require('util');var client=jayson[_0xcabe('0x1')][_0xcabe('0x2')]({'port':0x2329});var logger=require('../../config/logger')(_0xcabe('0x3'));exports[_0xcabe('0x4')]=function(_0x54e505,_0x27c9fe){logger[_0xcabe('0x4')](_0x54e505,_0x27c9fe?util['inspect'](_0x27c9fe,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x31f103,_0x26099f){logger[_0xcabe('0x5')](_0x31f103,_0x26099f?util[_0xcabe('0x6')](_0x26099f,{'showHidden':![],'depth':null}):'');};exports[_0xcabe('0x7')]=function(_0x5ea1c5,_0x39aff9){logger[_0xcabe('0x7')](_0x5ea1c5,_0x39aff9?util[_0xcabe('0x6')](_0x39aff9,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4d9cdf,_0x4dddd0){return client[_0xcabe('0x8')](_0x4d9cdf,{'body':_0x4dddd0})[_0xcabe('0x9')](function(_0x860756){logger[_0xcabe('0x5')](_0xcabe('0xa'),_0x4d9cdf,_0x860756?util['inspect'](_0x860756,{'showHidden':![],'depth':null}):'');})[_0xcabe('0xb')](function(_0x8484cf){logger[_0xcabe('0x7')](_0xcabe('0xa'),_0x4d9cdf,_0x8484cf?util[_0xcabe('0x6')](_0x8484cf,{'showHidden':![],'depth':null}):'');});};function getUser(_0x41c205){return client[_0xcabe('0x8')](_0xcabe('0xc'),{'options':{'raw':!![],'attributes':['id',_0xcabe('0xd'),_0xcabe('0xe'),_0xcabe('0xf')],'where':_0x41c205,'limit':0x1}})[_0xcabe('0x9')](function(_0x2790fa){logger[_0xcabe('0x5')](_0xcabe('0x10'),JSON[_0xcabe('0x11')](_0x41c205),_0x2790fa?util[_0xcabe('0x6')](_0x2790fa,{'showHidden':![],'depth':null}):'');return _0x2790fa[_0xcabe('0x12')]['length']?_0x2790fa['result'][0x0]:null;});}exports[_0xcabe('0x13')]=function(_0x497c45){return new BPromise(function(_0x5ef260,_0xf8c687){if(_0x497c45){return getUser({'internal':_0x497c45})['then'](function(_0x445fe5){logger['info'](_0xcabe('0x14'),_0x497c45,_0x445fe5?_0xcabe('0x15'):'notfound');return _0x5ef260(_0x445fe5);})[_0xcabe('0xb')](function(_0xba0085){logger[_0xcabe('0x7')](_0xcabe('0x16'),_0xba0085?util[_0xcabe('0x6')](_0xba0085,{'showHidden':![],'depth':null}):'');return _0x5ef260(null);});}return _0x5ef260(null);});};exports[_0xcabe('0x17')]=function(_0x2a7432){return new BPromise(function(_0x28a672,_0x20c7fc){if(_0x2a7432){return getUser({'interface':_0x2a7432})[_0xcabe('0x9')](function(_0x5f3a1f){logger['info'](_0xcabe('0x18'),_0x2a7432,_0x5f3a1f?_0xcabe('0x15'):_0xcabe('0x19'));return _0x28a672(_0x5f3a1f);})[_0xcabe('0xb')](function(_0x495102){logger[_0xcabe('0x7')](_0xcabe('0x1a'),_0x495102?util[_0xcabe('0x6')](_0x495102,{'showHidden':![],'depth':null}):'');return _0x28a672(null);});}return _0x28a672(null);});};exports[_0xcabe('0x1b')]=function(_0x7e26e8){return new BPromise(function(_0x4fc2f9,_0x4240bd){if(_0x7e26e8){return getUser({'name':_0x7e26e8})[_0xcabe('0x9')](function(_0x341fa2){logger['info'](_0xcabe('0x1c'),_0x7e26e8,_0x341fa2?'found':_0xcabe('0x19'));return _0x4fc2f9(_0x341fa2);})['catch'](function(_0x1ecc74){logger[_0xcabe('0x7')](_0xcabe('0x1d'),_0x1ecc74?util['inspect'](_0x1ecc74,{'showHidden':![],'depth':null}):'');return _0x4fc2f9(null);});}return _0x4fc2f9(null);});};exports['getVoiceQueueByName']=function(_0x38a9c3){return new BPromise(function(_0x838bd8,_0x34b32f){if(_0x38a9c3){return client[_0xcabe('0x8')](_0xcabe('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xcabe('0xe'),_0xcabe('0x1f'),_0xcabe('0x20'),_0xcabe('0x21')],'where':{'name':_0x38a9c3},'limit':0x1}})[_0xcabe('0x9')](function(_0x257edd){logger[_0xcabe('0x5')]('[utils][getVoiceQueueByName]\x20name:%s',_0x38a9c3,_0x257edd?util['inspect'](_0x257edd,{'showHidden':![],'depth':null}):'');logger['info'](_0xcabe('0x22'),_0x38a9c3,_0x257edd?_0xcabe('0x15'):_0xcabe('0x19'));return _0x838bd8(_0x257edd['result'][_0xcabe('0x23')]?_0x257edd[_0xcabe('0x12')][0x0]:null);})[_0xcabe('0xb')](function(_0x39f0be){logger[_0xcabe('0x7')](_0xcabe('0x24'),_0x39f0be?util[_0xcabe('0x6')](_0x39f0be,{'showHidden':![],'depth':null}):'');return _0x838bd8(null);});}return _0x838bd8(null);});};exports[_0xcabe('0x25')]=function(_0x398e19,_0x47662f){return moment(_0x398e19)[_0xcabe('0x26')](_0x47662f,'seconds')['format'](_0xcabe('0x27'));};exports['subtractTime']=function(_0x59db8e,_0x334dae){return moment(_0x59db8e)[_0xcabe('0x28')](_0x334dae,_0xcabe('0x29'))[_0xcabe('0x2a')](_0xcabe('0x27'));};exports[_0xcabe('0x2b')]=function(_0xbee8be,_0x2ff90d){return moment(_0xbee8be)['diff'](moment(_0x2ff90d),_0xcabe('0x29'));};exports[_0xcabe('0x2c')]=function(_0x161399,_0x2ccf1d){return parseInt(_0x161399,0xa)+parseInt(_0x2ccf1d,0xa);};exports[_0xcabe('0x2d')]=function(){return moment()['format'](_0xcabe('0x27'));};exports[_0xcabe('0x2e')]=function(_0x1adfda,_0x6cc521){if(_0x6cc521){return moment(_0x1adfda)[_0xcabe('0x2e')](_0x6cc521);}return!![];};exports[_0xcabe('0x2f')]=function(_0x5612c4,_0x41c7e6){if(_0x41c7e6){return moment(_0x5612c4)[_0xcabe('0x2f')](_0x41c7e6);}else if(_0x5612c4){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 32e9f7c..95c0a7f 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 _0xbc11=['user','no-user','data','timestamp','error','api','auth','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','url','device','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','role','name','then','client','catch'];(function(_0x2233de,_0x505be1){var _0x10d4ba=function(_0x366db7){while(--_0x366db7){_0x2233de['push'](_0x2233de['shift']());}};_0x10d4ba(++_0x505be1);}(_0xbc11,0xa3));var _0x1bc1=function(_0x3ad1db,_0x5b36d9){_0x3ad1db=_0x3ad1db-0x0;var _0x4aa9bc=_0xbc11[_0x3ad1db];return _0x4aa9bc;};var fs=require(_0x1bc1('0x0'));var _=require(_0x1bc1('0x1'));var ewinston=require(_0x1bc1('0x2'));var path=require(_0x1bc1('0x3'));var util=require(_0x1bc1('0x4'));var fileLogger=require(_0x1bc1('0x5'))[_0x1bc1('0x6')];var safeTemplate=require(_0x1bc1('0x7'))[_0x1bc1('0x8')];var maskSensitiveData=require(_0x1bc1('0x9'))[_0x1bc1('0xa')];function ClientSideLogger(){function _0x306a6e(_0x121657){var _0x262a74=path[_0x1bc1('0xb')]('/var','log','xcally');var _0x227f46=path[_0x1bc1('0xb')]('client',_0x121657[_0x1bc1('0xc')]+'-'+_0x121657[_0x1bc1('0xd')]);return fs['ensureDir'](path[_0x1bc1('0xb')](_0x262a74,_0x227f46))[_0x1bc1('0xe')](function(){var _0x1f3d98=fileLogger(_0x1bc1('0xf'),path[_0x1bc1('0xb')](_0x262a74,_0x227f46));return _0x1f3d98;})[_0x1bc1('0x10')](function(_0x5d7c1c){throw _0x5d7c1c;});}this['log']=function(_0xda9180,_0x4d777c,_0x588787,_0x9069c2){return _0x306a6e(_0xda9180[_0x1bc1('0x11')])[_0x1bc1('0xe')](function(_0x46c3a5){var _0x552c7b=_0x46c3a5[_0x4d777c];return _0x552c7b;})['then'](function(_0x2b7509){var _0x974978=_0xda9180['user']?_0xda9180[_0x1bc1('0x11')]['id']:_0x1bc1('0x12');var _0x4c1493=_0x9069c2[_0x1bc1('0x13')];var _0xeeec02=_0x9069c2[_0x1bc1('0x14')];var _0x35a6d3=new Date(Number(_0xeeec02));return _0x2b7509(_0x974978,_0x35a6d3,_0x588787,_0x4c1493);})[_0x1bc1('0x10')](function(_0x5e765c){fileLogger(_0x1bc1('0xf'))[_0x1bc1('0x15')](_0x5e765c);});};}function setupLoggers(_0x2df203){return new Promise(function(_0x23bddb){var _0x1ab5f6=new ClientSideLogger();var _0x115107=fileLogger(_0x1bc1('0x16'));var _0x48d6cf=fileLogger(_0x1bc1('0x17'));_0x2df203['set']('client-side-logger',_0x1ab5f6);_0x2df203[_0x1bc1('0x18')](ewinston[_0x1bc1('0x19')]({'winstonInstance':_0x115107,'meta':![],'statusLevels':!![],'msg':function(_0x12eef0,_0x2c1316){var _0x3e87f3=_0x1bc1('0x1a');if(!_['isEmpty'](_0x12eef0[_0x1bc1('0x1b')])){_0x3e87f3+=_0x1bc1('0x1c');var _0x2221fc=_0x12eef0[_0x1bc1('0x1b')];maskSensitiveData(_0x2221fc);}return safeTemplate(util[_0x1bc1('0x1d')](_0x3e87f3,_0x12eef0[_0x1bc1('0x1e')],_0x12eef0[_0x1bc1('0x1f')][_0x1bc1('0x20')]?_0x12eef0[_0x1bc1('0x1f')][_0x1bc1('0x20')]:_0x12eef0[_0x1bc1('0x21')][_0x1bc1('0x22')]||_0x12eef0['ip'],_0x12eef0['url'],_0x2c1316[_0x1bc1('0x23')],_0x2c1316[_0x1bc1('0x24')],_0x12eef0['user']?_0x12eef0[_0x1bc1('0x11')]['id']:null,_0x12eef0[_0x1bc1('0x11')]?_0x12eef0[_0x1bc1('0x11')]['name']:null,_0x12eef0['user']?_0x12eef0['user'][_0x1bc1('0xc')]:null,_0x2221fc?util[_0x1bc1('0x25')](_0x2221fc,![],null):''));}}));_0x2df203[_0x1bc1('0x18')](ewinston['logger']({'winstonInstance':_0x48d6cf,'meta':![],'statusLevels':!![],'msg':function(_0x2ac2b9,_0x290e0d){var _0x3e87db=_0x1bc1('0x26');if(_0x2ac2b9[_0x1bc1('0x1b')]&&_0x2ac2b9[_0x1bc1('0x1b')]['device']&&_0x2ac2b9[_0x1bc1('0x1b')][_0x1bc1('0x27')]){_0x3e87db='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x3e87db,_0x2ac2b9[_0x1bc1('0x1e')],_0x2ac2b9[_0x1bc1('0x1f')][_0x1bc1('0x20')]?_0x2ac2b9[_0x1bc1('0x1f')][_0x1bc1('0x20')]:_0x2ac2b9[_0x1bc1('0x21')][_0x1bc1('0x22')]||_0x2ac2b9['ip'],_0x2ac2b9[_0x1bc1('0x28')],_0x290e0d[_0x1bc1('0x23')],_0x290e0d['responseTime'],_0x2ac2b9[_0x1bc1('0x11')]?_0x2ac2b9[_0x1bc1('0x11')]['id']:null,_0x2ac2b9['user']?_0x2ac2b9['user'][_0x1bc1('0xd')]:null,_0x2ac2b9[_0x1bc1('0x11')]?_0x2ac2b9[_0x1bc1('0x11')]['role']:null,_0x2ac2b9['body']&&_0x2ac2b9[_0x1bc1('0x1b')][_0x1bc1('0x29')]?_0x2ac2b9['body'][_0x1bc1('0x29')]:_0x1bc1('0x2a'),_0x2ac2b9[_0x1bc1('0x1b')]&&_0x2ac2b9[_0x1bc1('0x1b')][_0x1bc1('0x27')]?_0x2ac2b9[_0x1bc1('0x1b')][_0x1bc1('0x27')]:'',_0x2ac2b9[_0x1bc1('0x1b')]&&_0x2ac2b9['body']['agent_name']?_0x2ac2b9[_0x1bc1('0x1b')][_0x1bc1('0x2b')]:'');},'ignoreRoute':function(_0x499d5d){var _0x1f8b1e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1f8b1e['test'](_0x499d5d[_0x1bc1('0x28')]);}}));return _0x23bddb();});}exports[_0x1bc1('0x2c')]=setupLoggers; \ No newline at end of file +var _0x65ed=['logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','x-forwarded-for','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','client','name','user','data','api','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','headers','connection','remoteAddress','url','statusCode','responseTime','role'];(function(_0x2a610e,_0x22b737){var _0x257194=function(_0x271f9e){while(--_0x271f9e){_0x2a610e['push'](_0x2a610e['shift']());}};_0x257194(++_0x22b737);}(_0x65ed,0x131));var _0xd65e=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0x65ed[_0x25fa5c];return _0x1bade2;};var fs=require(_0xd65e('0x0'));var _=require(_0xd65e('0x1'));var ewinston=require(_0xd65e('0x2'));var path=require(_0xd65e('0x3'));var util=require(_0xd65e('0x4'));var fileLogger=require(_0xd65e('0x5'))[_0xd65e('0x6')];var safeTemplate=require(_0xd65e('0x7'))[_0xd65e('0x8')];var maskSensitiveData=require(_0xd65e('0x9'))['maskSensitiveData'];function ClientSideLogger(){function _0x5d2239(_0x167175){var _0x276a0d=path[_0xd65e('0xa')](_0xd65e('0xb'),_0xd65e('0xc'),'xcally');var _0x55fdd5=path[_0xd65e('0xa')](_0xd65e('0xd'),_0x167175['role']+'-'+_0x167175[_0xd65e('0xe')]);return fs['ensureDir'](path[_0xd65e('0xa')](_0x276a0d,_0x55fdd5))['then'](function(){var _0x235ba6=fileLogger(_0xd65e('0xd'),path[_0xd65e('0xa')](_0x276a0d,_0x55fdd5));return _0x235ba6;})['catch'](function(_0x45022e){throw _0x45022e;});}this['log']=function(_0x585bb1,_0xceb5ec,_0x3b42e3,_0x215c12){return _0x5d2239(_0x585bb1[_0xd65e('0xf')])['then'](function(_0x36999b){var _0x341ba1=_0x36999b[_0xceb5ec];return _0x341ba1;})['then'](function(_0x3ff1b7){var _0x24fae2=_0x585bb1['user']?_0x585bb1['user']['id']:'no-user';var _0x3a016e=_0x215c12[_0xd65e('0x10')];var _0x489685=_0x215c12['timestamp'];var _0x5b7c3a=new Date(Number(_0x489685));return _0x3ff1b7(_0x24fae2,_0x5b7c3a,_0x3b42e3,_0x3a016e);})['catch'](function(_0x242b7d){fileLogger(_0xd65e('0xd'))['error'](_0x242b7d);});};}function setupLoggers(_0x13a4d3){return new Promise(function(_0x5563b9){var _0x266748=new ClientSideLogger();var _0x19e8f2=fileLogger(_0xd65e('0x11'));var _0x5993d5=fileLogger('auth');_0x13a4d3[_0xd65e('0x12')](_0xd65e('0x13'),_0x266748);_0x13a4d3[_0xd65e('0x14')](ewinston['logger']({'winstonInstance':_0x19e8f2,'meta':![],'statusLevels':!![],'msg':function(_0x187c83,_0x423457){var _0x594b72=_0xd65e('0x15');if(!_[_0xd65e('0x16')](_0x187c83[_0xd65e('0x17')])){_0x594b72+='\x20body=%s';var _0x1240f2=_0x187c83[_0xd65e('0x17')];maskSensitiveData(_0x1240f2);}return safeTemplate(util['format'](_0x594b72,_0x187c83['method'],_0x187c83[_0xd65e('0x18')]['x-forwarded-for']?_0x187c83[_0xd65e('0x18')]['x-forwarded-for']:_0x187c83[_0xd65e('0x19')][_0xd65e('0x1a')]||_0x187c83['ip'],_0x187c83[_0xd65e('0x1b')],_0x423457[_0xd65e('0x1c')],_0x423457[_0xd65e('0x1d')],_0x187c83[_0xd65e('0xf')]?_0x187c83['user']['id']:null,_0x187c83[_0xd65e('0xf')]?_0x187c83[_0xd65e('0xf')]['name']:null,_0x187c83[_0xd65e('0xf')]?_0x187c83[_0xd65e('0xf')][_0xd65e('0x1e')]:null,_0x1240f2?util['inspect'](_0x1240f2,![],null):''));}}));_0x13a4d3['use'](ewinston[_0xd65e('0x1f')]({'winstonInstance':_0x5993d5,'meta':![],'statusLevels':!![],'msg':function(_0x260eae,_0x1db0f2){var _0x14ff05=_0xd65e('0x20');if(_0x260eae[_0xd65e('0x17')]&&_0x260eae[_0xd65e('0x17')][_0xd65e('0x21')]&&_0x260eae['body'][_0xd65e('0x22')]){_0x14ff05=_0xd65e('0x23');}return util[_0xd65e('0x24')](_0x14ff05,_0x260eae[_0xd65e('0x25')],_0x260eae['headers'][_0xd65e('0x26')]?_0x260eae[_0xd65e('0x18')][_0xd65e('0x26')]:_0x260eae[_0xd65e('0x19')][_0xd65e('0x1a')]||_0x260eae['ip'],_0x260eae['url'],_0x1db0f2[_0xd65e('0x1c')],_0x1db0f2[_0xd65e('0x1d')],_0x260eae[_0xd65e('0xf')]?_0x260eae[_0xd65e('0xf')]['id']:null,_0x260eae[_0xd65e('0xf')]?_0x260eae['user'][_0xd65e('0xe')]:null,_0x260eae[_0xd65e('0xf')]?_0x260eae[_0xd65e('0xf')][_0xd65e('0x1e')]:null,_0x260eae[_0xd65e('0x17')]&&_0x260eae['body']['device']?_0x260eae['body'][_0xd65e('0x21')]:_0xd65e('0x27'),_0x260eae['body']&&_0x260eae[_0xd65e('0x17')][_0xd65e('0x22')]?_0x260eae[_0xd65e('0x17')][_0xd65e('0x22')]:'',_0x260eae['body']&&_0x260eae[_0xd65e('0x17')][_0xd65e('0x28')]?_0x260eae['body'][_0xd65e('0x28')]:'');},'ignoreRoute':function(_0x54b728){var _0x19e317=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x19e317['test'](_0x54b728[_0xd65e('0x1b')]);}}));return _0x5563b9();});}exports[_0xd65e('0x29')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 8f5b18b..65487f8 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93a6=['test','padStart','length','iftime','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','map','locale','weekdaysShort','toLowerCase','indexOf','slice','circularDoWInterval','concat','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','format','ddd','date','daysInMonth','max','min','MMM','includes','monthCompare','guess'];(function(_0xd54653,_0x101a89){var _0x5c1786=function(_0x390e22){while(--_0x390e22){_0xd54653['push'](_0xd54653['shift']());}};_0x5c1786(++_0x101a89);}(_0x93a6,0x1c0));var _0x693a=function(_0x56b891,_0x2f117e){_0x56b891=_0x56b891-0x0;var _0x41d994=_0x93a6[_0x56b891];return _0x41d994;};var _=require('lodash');var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x34e18a){return _0x34e18a[_0x693a('0x0')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x693a('0x1');var EINVALID_DATE=_0x693a('0x2');function throwIfDateNotValid(_0x2cc022){if(!_0x2cc022[_0x693a('0x3')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x488380){var _0x26e799=_0x488380[_0x693a('0x4')](':')[_0x693a('0x5')](function(_0x1a8bda){return parseInt(_0x1a8bda,0xa);});var _0x12aad5=_0x26e799[0x0];var _0x30d498=_0x26e799[0x1];if(_0x12aad5<0x0||_0x12aad5>0x17||_0x30d498<0x0||_0x30d498>0x3b){throw new Error(EINVALID_DATE);}return[_0x12aad5,_0x30d498];}function circularDoWInterval(_0x4b7aad,_0x32e20a){if(_0x4b7aad===_0x32e20a){return[_0x4b7aad];}else{var _0x854937=moment[_0x693a('0x6')]();moment['locale']('en');var _0x212eb9=moment[_0x693a('0x7')]()[_0x693a('0x5')](function(_0x5843d2){return _0x5843d2[_0x693a('0x8')]();});moment[_0x693a('0x6')](_0x854937);var _0x2076f4=_0x212eb9[_0x693a('0x9')](_0x4b7aad);var _0x59f316=_0x212eb9[_0x693a('0x9')](_0x32e20a);if(_0x59f316>_0x2076f4){return _0x212eb9[_0x693a('0xa')](_0x2076f4,_0x59f316+0x1);}else{var _0x27bfaa=_0x212eb9['slice'](0x0,_0x59f316+0x1);var _0x14f593=_0x212eb9[_0x693a('0xa')](_0x2076f4);return _0x14f593['concat'](_0x27bfaa);}}}module['exports'][_0x693a('0xb')]=circularDoWInterval;function circularMonthInterval(_0x3eb4dc,_0x540a20){if(_0x3eb4dc===_0x540a20){return[_0x3eb4dc];}else{var _0x59fde4=moment['locale']();moment[_0x693a('0x6')]('en');var _0x1a61b6=moment['monthsShort']()[_0x693a('0x5')](function(_0x249cb1){return _0x249cb1[_0x693a('0x8')]();});moment[_0x693a('0x6')](_0x59fde4);var _0x59b18d=_0x1a61b6['indexOf'](_0x3eb4dc);var _0x23b784=_0x1a61b6[_0x693a('0x9')](_0x540a20);if(_0x23b784>_0x59b18d){return _0x1a61b6[_0x693a('0xa')](_0x59b18d,_0x23b784+0x1);}else{var _0x28419a=_0x1a61b6[_0x693a('0xa')](0x0,_0x23b784+0x1);var _0x221240=_0x1a61b6['slice'](_0x59b18d);return _0x221240[_0x693a('0xc')](_0x28419a);}}}module[_0x693a('0xd')][_0x693a('0xe')]=circularMonthInterval;function parseDom(_0x1a3b6){var _0x5f3aee=parseInt(_0x1a3b6,0xa);if(_0x5f3aee<0x1||_0x5f3aee>0x1f){throw new Error(EINVALID_DATE);}return _0x5f3aee;}function timeCompare(_0x52a903,_0x393755,_0x575ad6){var _0x4290b9=_0x52a903[_0x693a('0xf')]();var _0x19e6a4=extractTime(_0x393755);var _0x4994fd=_0x19e6a4[0x0];var _0x234df4=_0x19e6a4[0x1];var _0x21f818=_0x52a903[_0x693a('0xf')]()[_0x693a('0x10')](_0x4994fd)[_0x693a('0x11')](_0x234df4);throwIfDateNotValid(_0x21f818);var _0x2ce0ab=extractTime(_0x575ad6);var _0x3791b3=_0x2ce0ab[0x0];var _0x581fee=_0x2ce0ab[0x1];var _0x2fcaf4=_0x52a903[_0x693a('0xf')]()[_0x693a('0x10')](_0x3791b3)[_0x693a('0x11')](_0x581fee);throwIfDateNotValid(_0x2fcaf4);if(_0x2fcaf4[_0x693a('0x12')](_0x21f818)){var _0x9748fe=_0x4290b9[_0x693a('0xf')]()[_0x693a('0x13')](_0x693a('0x14'));var _0x15527f=_0x4290b9[_0x693a('0xf')]()[_0x693a('0x15')](_0x693a('0x14'));return _0x4290b9[_0x693a('0x16')](_0x21f818,_0x15527f,undefined,'[]')||_0x4290b9['isBetween'](_0x9748fe,_0x2fcaf4,undefined,'[]');}else{return _0x4290b9[_0x693a('0x16')](_0x21f818,_0x2fcaf4,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x10eee4,_0x2c897c,_0x82a15d){var _0xdfb128=_0x10eee4[_0x693a('0x6')]('en')[_0x693a('0x17')](_0x693a('0x18'))[_0x693a('0x8')]();return circularDoWInterval(_0x2c897c,_0x82a15d)['includes'](_0xdfb128);}module[_0x693a('0xd')]['dowCompare']=dowCompare;function domCompare(_0x564ac6,_0x4117b6,_0x5b0c1f){var _0x5200ea=_0x564ac6[_0x693a('0x19')]();if(_0x4117b6===_0x5b0c1f){return _0x5200ea===_0x4117b6;}else{var _0x3c176a=_0x564ac6[_0x693a('0x1a')]();var _0x5b5e18=_0x4117b6<_0x5b0c1f;let _0x5a09f2=![];var _0x6fef69=0x0;var _0x497114=0x0;if(_0x5b5e18){_0x6fef69=Math[_0x693a('0x1b')](0x1,_0x4117b6);_0x497114=Math[_0x693a('0x1c')](_0x5b0c1f,_0x3c176a);_0x5a09f2=_0x5200ea>=_0x6fef69&&_0x5200ea<=_0x497114;}else{_0x6fef69=Math[_0x693a('0x1c')](_0x4117b6,_0x3c176a);_0x497114=Math['max'](0x1,_0x5b0c1f);_0x5a09f2=_0x5200ea>=_0x6fef69||_0x5200ea<=_0x497114;}return _0x5a09f2;}}module[_0x693a('0xd')]['domCompare']=domCompare;function monthCompare(_0x561195,_0x310867,_0x5a2574){var _0x1606a1=_0x561195[_0x693a('0x6')]('en')['format'](_0x693a('0x1d'))['toLowerCase']();return circularMonthInterval(_0x310867,_0x5a2574)[_0x693a('0x1e')](_0x1606a1);}module['exports'][_0x693a('0x1f')]=monthCompare;function iftime(_0x5ced6b,_0x5eec83=moment['tz'][_0x693a('0x20')](),_0x5f283d=moment()){if(!validateRx[_0x693a('0x21')](_0x5ced6b)){throw new Error(EINVALID_STRING);}else{var _0x32d88f=(moment['isMoment'](_0x5f283d)?_0x5f283d['clone']():moment(_0x5f283d))['tz'](_0x5eec83)[_0x693a('0x6')]('en');throwIfDateNotValid(_0x32d88f);var _0x4b9b55=_0x5ced6b[_0x693a('0x4')](',');var _0x37f127=_0x4b9b55[0x0];var _0x1015ff=_0x4b9b55[0x1];var _0x1cf8b4=_0x4b9b55[0x2];var _0x56f91f=_0x4b9b55[0x3];let _0x27816d=!![];if(_0x37f127!=='*'){var _0x18341e=_0x37f127['split']('-');var _0x205c33=_[_0x693a('0x22')](_0x18341e[0x0],0x5,'0');var _0xa80282=_0x18341e[_0x693a('0x23')]===0x2?_['padStart'](_0x18341e[0x1],0x5,'0'):_0x205c33;_0x27816d=timeCompare(_0x32d88f,_0x205c33,_0xa80282);}let _0x24aa34=!![];if(_0x1015ff!=='*'){var _0x2c6e4f=_0x1015ff[_0x693a('0x4')]('-');var _0x56ada1=_0x2c6e4f[0x0];var _0x21c89d=_0x2c6e4f[_0x693a('0x23')]===0x2?_0x2c6e4f[0x1]:_0x56ada1;_0x24aa34=dowCompare(_0x32d88f,_0x56ada1,_0x21c89d);}let _0x1698ee=!![];if(_0x1cf8b4!=='*'){var _0xdb22f6=_0x1cf8b4['split']('-');var _0x51bd3b=parseDom(_0xdb22f6[0x0]);var _0x2919db=_0xdb22f6[_0x693a('0x23')]===0x2?parseDom(_0xdb22f6[0x1]):_0x51bd3b;_0x1698ee=domCompare(_0x32d88f,_0x51bd3b,_0x2919db);}let _0x3ee6b4=!![];if(_0x56f91f!=='*'){var _0xd7d5=_0x56f91f[_0x693a('0x4')]('-');var _0x4a2a34=_0xd7d5[0x0];var _0x2f1c1e=_0xd7d5[_0x693a('0x23')]===0x2?_0xd7d5[0x1]:_0xd7d5[0x0];_0x3ee6b4=monthCompare(_0x32d88f,_0x4a2a34,_0x2f1c1e);}return _0x27816d&&_0x24aa34&&_0x1698ee&&_0x3ee6b4;}}module[_0x693a('0xd')][_0x693a('0x24')]=iftime; \ No newline at end of file +var _0x258f=['includes','date','daysInMonth','max','min','format','monthCompare','isMoment','split','padStart','length','iftime','lodash','moment-timezone','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','toLowerCase','indexOf','slice','monthsShort','exports','clone','hours','minutes','isBefore','startOf','day','endOf','timeCompare','ddd'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x258f,0xd8));var _0xf258=function(_0x49e59d,_0x3c2a43){_0x49e59d=_0x49e59d-0x0;var _0x2e1f9e=_0x258f[_0x49e59d];return _0x2e1f9e;};var _=require(_0xf258('0x0'));var moment=require(_0xf258('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xf258('0x2')](function(_0x56fb08){return _0x56fb08[_0xf258('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xf258('0x4');var EINVALID_DATE=_0xf258('0x5');function throwIfDateNotValid(_0x4373de){if(!_0x4373de[_0xf258('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xf81ffb){var _0x25811e=_0xf81ffb['split'](':')[_0xf258('0x2')](function(_0x47b9a9){return parseInt(_0x47b9a9,0xa);});var _0x1916cb=_0x25811e[0x0];var _0x151d87=_0x25811e[0x1];if(_0x1916cb<0x0||_0x1916cb>0x17||_0x151d87<0x0||_0x151d87>0x3b){throw new Error(EINVALID_DATE);}return[_0x1916cb,_0x151d87];}function circularDoWInterval(_0xb988e6,_0x43fe0e){if(_0xb988e6===_0x43fe0e){return[_0xb988e6];}else{var _0x504b94=moment[_0xf258('0x7')]();moment[_0xf258('0x7')]('en');var _0x541fec=moment['weekdaysShort']()['map'](function(_0x4bbdef){return _0x4bbdef[_0xf258('0x8')]();});moment[_0xf258('0x7')](_0x504b94);var _0x24e516=_0x541fec[_0xf258('0x9')](_0xb988e6);var _0x3974ed=_0x541fec[_0xf258('0x9')](_0x43fe0e);if(_0x3974ed>_0x24e516){return _0x541fec[_0xf258('0xa')](_0x24e516,_0x3974ed+0x1);}else{var _0x19c777=_0x541fec['slice'](0x0,_0x3974ed+0x1);var _0x5b0e35=_0x541fec[_0xf258('0xa')](_0x24e516);return _0x5b0e35['concat'](_0x19c777);}}}module['exports']['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x356a52,_0x1fadd8){if(_0x356a52===_0x1fadd8){return[_0x356a52];}else{var _0x209dd9=moment[_0xf258('0x7')]();moment[_0xf258('0x7')]('en');var _0xfae27d=moment[_0xf258('0xb')]()[_0xf258('0x2')](function(_0x56c854){return _0x56c854['toLowerCase']();});moment['locale'](_0x209dd9);var _0x357d4f=_0xfae27d[_0xf258('0x9')](_0x356a52);var _0x1a4b6d=_0xfae27d[_0xf258('0x9')](_0x1fadd8);if(_0x1a4b6d>_0x357d4f){return _0xfae27d[_0xf258('0xa')](_0x357d4f,_0x1a4b6d+0x1);}else{var _0x4a62e8=_0xfae27d['slice'](0x0,_0x1a4b6d+0x1);var _0x728c72=_0xfae27d[_0xf258('0xa')](_0x357d4f);return _0x728c72['concat'](_0x4a62e8);}}}module[_0xf258('0xc')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x348739){var _0x2dfe6f=parseInt(_0x348739,0xa);if(_0x2dfe6f<0x1||_0x2dfe6f>0x1f){throw new Error(EINVALID_DATE);}return _0x2dfe6f;}function timeCompare(_0x55f965,_0x5b6c12,_0x8d25a4){var _0x5ada49=_0x55f965['clone']();var _0x462081=extractTime(_0x5b6c12);var _0x1e62b1=_0x462081[0x0];var _0x5b1bc3=_0x462081[0x1];var _0x2fc497=_0x55f965[_0xf258('0xd')]()[_0xf258('0xe')](_0x1e62b1)[_0xf258('0xf')](_0x5b1bc3);throwIfDateNotValid(_0x2fc497);var _0x1753df=extractTime(_0x8d25a4);var _0x52632c=_0x1753df[0x0];var _0x48848f=_0x1753df[0x1];var _0x359fb5=_0x55f965[_0xf258('0xd')]()['hours'](_0x52632c)['minutes'](_0x48848f);throwIfDateNotValid(_0x359fb5);if(_0x359fb5[_0xf258('0x10')](_0x2fc497)){var _0x1656c4=_0x5ada49['clone']()[_0xf258('0x11')](_0xf258('0x12'));var _0x433e3a=_0x5ada49[_0xf258('0xd')]()[_0xf258('0x13')](_0xf258('0x12'));return _0x5ada49['isBetween'](_0x2fc497,_0x433e3a,undefined,'[]')||_0x5ada49['isBetween'](_0x1656c4,_0x359fb5,undefined,'[]');}else{return _0x5ada49['isBetween'](_0x2fc497,_0x359fb5,undefined,'[]');}}module['exports'][_0xf258('0x14')]=timeCompare;function dowCompare(_0x5e55a6,_0xaa6811,_0x5cdaf2){var _0x484ad1=_0x5e55a6[_0xf258('0x7')]('en')['format'](_0xf258('0x15'))[_0xf258('0x8')]();return circularDoWInterval(_0xaa6811,_0x5cdaf2)[_0xf258('0x16')](_0x484ad1);}module[_0xf258('0xc')]['dowCompare']=dowCompare;function domCompare(_0x27c223,_0x4cf691,_0x4a900c){var _0x587ed9=_0x27c223[_0xf258('0x17')]();if(_0x4cf691===_0x4a900c){return _0x587ed9===_0x4cf691;}else{var _0xeb077d=_0x27c223[_0xf258('0x18')]();var _0x57daee=_0x4cf691<_0x4a900c;let _0x5786db=![];var _0x49be33=0x0;var _0x4f5d38=0x0;if(_0x57daee){_0x49be33=Math[_0xf258('0x19')](0x1,_0x4cf691);_0x4f5d38=Math[_0xf258('0x1a')](_0x4a900c,_0xeb077d);_0x5786db=_0x587ed9>=_0x49be33&&_0x587ed9<=_0x4f5d38;}else{_0x49be33=Math[_0xf258('0x1a')](_0x4cf691,_0xeb077d);_0x4f5d38=Math['max'](0x1,_0x4a900c);_0x5786db=_0x587ed9>=_0x49be33||_0x587ed9<=_0x4f5d38;}return _0x5786db;}}module[_0xf258('0xc')]['domCompare']=domCompare;function monthCompare(_0x2ab2c4,_0x4c83ea,_0x5e6e50){var _0x206c41=_0x2ab2c4[_0xf258('0x7')]('en')[_0xf258('0x1b')]('MMM')[_0xf258('0x8')]();return circularMonthInterval(_0x4c83ea,_0x5e6e50)[_0xf258('0x16')](_0x206c41);}module[_0xf258('0xc')][_0xf258('0x1c')]=monthCompare;function iftime(_0x313514,_0x1d5adf=moment['tz']['guess'](),_0x4887b7=moment()){if(!validateRx['test'](_0x313514)){throw new Error(EINVALID_STRING);}else{var _0x2c42a5=(moment[_0xf258('0x1d')](_0x4887b7)?_0x4887b7[_0xf258('0xd')]():moment(_0x4887b7))['tz'](_0x1d5adf)['locale']('en');throwIfDateNotValid(_0x2c42a5);var _0x2aa171=_0x313514[_0xf258('0x1e')](',');var _0x14037b=_0x2aa171[0x0];var _0x9a60ab=_0x2aa171[0x1];var _0x9f8d11=_0x2aa171[0x2];var _0x134141=_0x2aa171[0x3];let _0x3ad5c6=!![];if(_0x14037b!=='*'){var _0x3b10c9=_0x14037b[_0xf258('0x1e')]('-');var _0x1719cc=_[_0xf258('0x1f')](_0x3b10c9[0x0],0x5,'0');var _0x6c9c97=_0x3b10c9[_0xf258('0x20')]===0x2?_[_0xf258('0x1f')](_0x3b10c9[0x1],0x5,'0'):_0x1719cc;_0x3ad5c6=timeCompare(_0x2c42a5,_0x1719cc,_0x6c9c97);}let _0x2ae7a6=!![];if(_0x9a60ab!=='*'){var _0xa93b17=_0x9a60ab['split']('-');var _0x5c5b10=_0xa93b17[0x0];var _0x44c553=_0xa93b17[_0xf258('0x20')]===0x2?_0xa93b17[0x1]:_0x5c5b10;_0x2ae7a6=dowCompare(_0x2c42a5,_0x5c5b10,_0x44c553);}let _0x656507=!![];if(_0x9f8d11!=='*'){var _0x1ff1f7=_0x9f8d11[_0xf258('0x1e')]('-');var _0x26db11=parseDom(_0x1ff1f7[0x0]);var _0x591bb1=_0x1ff1f7[_0xf258('0x20')]===0x2?parseDom(_0x1ff1f7[0x1]):_0x26db11;_0x656507=domCompare(_0x2c42a5,_0x26db11,_0x591bb1);}let _0x33f7e4=!![];if(_0x134141!=='*'){var _0xa86300=_0x134141['split']('-');var _0x2947fd=_0xa86300[0x0];var _0x1e5ee4=_0xa86300[_0xf258('0x20')]===0x2?_0xa86300[0x1]:_0xa86300[0x0];_0x33f7e4=monthCompare(_0x2c42a5,_0x2947fd,_0x1e5ee4);}return _0x3ad5c6&&_0x2ae7a6&&_0x656507&&_0x33f7e4;}}module[_0xf258('0xc')][_0xf258('0x21')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 46f377b..3f8a293 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x272a=['winston','../config/environment','debugLevel','redBG\x20white','red','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','util','moment'];(function(_0x38736d,_0x5a54fc){var _0x56af43=function(_0x3fd4d7){while(--_0x3fd4d7){_0x38736d['push'](_0x38736d['shift']());}};_0x56af43(++_0x5a54fc);}(_0x272a,0xe2));var _0xa272=function(_0x5a66c5,_0x1c6773){_0x5a66c5=_0x5a66c5-0x0;var _0x385a9d=_0x272a[_0x5a66c5];return _0x385a9d;};'use strict';var path=require('path');var util=require(_0xa272('0x0'));var moment=require(_0xa272('0x1'));var winston=require(_0xa272('0x2'));var config=require(_0xa272('0x3'));var debugLevel=config[_0xa272('0x4')]?config[_0xa272('0x4')]['toLowerCase']():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xa272('0x5'),'error':_0xa272('0x6'),'warn':'bold\x20yellow','info':_0xa272('0x7'),'print':_0xa272('0x8'),'success':_0xa272('0x9'),'http':_0xa272('0xa'),'verbose':_0xa272('0xb'),'debug':_0xa272('0xc'),'silly':_0xa272('0xd')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x2732a1,_0x1503e5,_0x71d6cc){var _0x33ee69=_0x2732a1||_0xa272('0xe');return path[_0xa272('0xf')](_0x33ee69,util[_0xa272('0x10')](_0xa272('0x11'),_0x1503e5,_0x71d6cc));}function formatter(_0x56a977,_0x581c37){_0x581c37['message']=_0x581c37[_0xa272('0x12')][_0xa272('0x13')](/@@{/g,_0xa272('0x14'))[_0xa272('0x13')](/}@@/g,_0xa272('0x15'))[_0xa272('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xa272('0x10')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xa272('0x10')](_0xa272('0x16')),_0x581c37[_0xa272('0x17')][_0xa272('0x18')](),_0x56a977,_0x581c37['message']);}function fileFormat(_0x1b5feb,_0x1479b1){_0x1479b1[_0xa272('0x12')]=_0x1479b1[_0xa272('0x12')][_0xa272('0x13')](/@@{/g,_0xa272('0x14'))[_0xa272('0x13')](/}@@/g,'}}}')[_0xa272('0x13')](/@{/g,'{{')[_0xa272('0x13')](/}@/g,'}}');var _0x36237a=_0x1479b1[_0xa272('0x19')]&&Object['keys'](_0x1479b1[_0xa272('0x19')])[_0xa272('0x1a')]?'\x0a\x09'+JSON[_0xa272('0x1b')](_0x1479b1['meta']):'';return util['format'](_0xa272('0x1c'),moment()[_0xa272('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x1479b1[_0xa272('0x17')][_0xa272('0x18')](),_0x1b5feb,_0x1479b1[_0xa272('0x12')],_0x36237a);}function consoleLogger(){var _0x2a7d5a=new winston[(_0xa272('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa272('0x1e'))][(_0xa272('0x1f'))]({'level':_0xa272('0x20'),'json':![],'formatter':function(_0x28f578){return formatter('',_0x28f578);}})]});return _0x2a7d5a;}function fileLogger(_0x159566,_0x4eb3e1){var _0x13f548=new winston[(_0xa272('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa272('0x1e'))][(_0xa272('0x21'))]({'name':util['format'](_0xa272('0x22'),_0x159566,_0xa272('0x23')),'filename':getLogFileName(_0x4eb3e1,_0x159566,_0xa272('0x23')),'level':_0xa272('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1db524){return fileFormat(_0x159566,_0x1db524);}}),new winston['transports'][(_0xa272('0x21'))]({'name':util[_0xa272('0x10')](_0xa272('0x22'),_0x159566,debugLevel),'filename':getLogFileName(_0x4eb3e1,_0x159566,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x48fbed){return fileFormat(_0x159566,_0x48fbed);}}),new winston[(_0xa272('0x1e'))][(_0xa272('0x1f'))]({'level':_0xa272('0x20'),'json':![],'formatter':function(_0x457149){return fileFormat(_0x159566,_0x457149);}})]});return _0x13f548;}exports[_0xa272('0x24')]=consoleLogger;exports[_0xa272('0x25')]=fileLogger; \ No newline at end of file +var _0x5c16=['fileLogger','path','moment','winston','debugLevel','toLowerCase','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','format','%s-%s.log','message','{{{','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','}}}','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','transports','Console','warn','File','%s-%s','error','consoleLogger'];(function(_0x2dbdc9,_0x8e3c4){var _0x4521ec=function(_0x4af19e){while(--_0x4af19e){_0x2dbdc9['push'](_0x2dbdc9['shift']());}};_0x4521ec(++_0x8e3c4);}(_0x5c16,0x1bd));var _0x65c1=function(_0xfd433d,_0x206aa2){_0xfd433d=_0xfd433d-0x0;var _0x318571=_0x5c16[_0xfd433d];return _0x318571;};'use strict';var path=require(_0x65c1('0x0'));var util=require('util');var moment=require(_0x65c1('0x1'));var winston=require(_0x65c1('0x2'));var config=require('../config/environment');var debugLevel=config[_0x65c1('0x3')]?config[_0x65c1('0x3')][_0x65c1('0x4')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x65c1('0x5'),'error':'red','warn':_0x65c1('0x6'),'info':_0x65c1('0x7'),'print':_0x65c1('0x8'),'success':_0x65c1('0x9'),'http':_0x65c1('0xa'),'verbose':_0x65c1('0xb'),'debug':_0x65c1('0xc'),'silly':'bold\x20cyan'};winston[_0x65c1('0xd')](XC_LOG_COLORS);function getLogFileName(_0x5af649,_0x35a555,_0x178941){var _0x1a062b=_0x5af649||_0x65c1('0xe');return path['join'](_0x1a062b,util[_0x65c1('0xf')](_0x65c1('0x10'),_0x35a555,_0x178941));}function formatter(_0x42f1ed,_0x1cf318){_0x1cf318[_0x65c1('0x11')]=_0x1cf318[_0x65c1('0x11')]['replace'](/@@{/g,_0x65c1('0x12'))[_0x65c1('0x13')](/}@@/g,'}}}')[_0x65c1('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x65c1('0x14'),moment()['format'](_0x65c1('0x15')),_0x1cf318['level'][_0x65c1('0x16')](),_0x42f1ed,_0x1cf318[_0x65c1('0x11')]);}function fileFormat(_0x2c4b2d,_0x22c442){_0x22c442['message']=_0x22c442[_0x65c1('0x11')]['replace'](/@@{/g,_0x65c1('0x12'))[_0x65c1('0x13')](/}@@/g,_0x65c1('0x17'))[_0x65c1('0x13')](/@{/g,'{{')[_0x65c1('0x13')](/}@/g,'}}');var _0x4165eb=_0x22c442[_0x65c1('0x18')]&&Object[_0x65c1('0x19')](_0x22c442['meta'])['length']?'\x0a\x09'+JSON[_0x65c1('0x1a')](_0x22c442[_0x65c1('0x18')]):'';return util[_0x65c1('0xf')](_0x65c1('0x1b'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x22c442[_0x65c1('0x1c')]['toUpperCase'](),_0x2c4b2d,_0x22c442[_0x65c1('0x11')],_0x4165eb);}function consoleLogger(){var _0x3673b6=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x65c1('0x1d'))][(_0x65c1('0x1e'))]({'level':_0x65c1('0x1f'),'json':![],'formatter':function(_0x3c6b98){return formatter('',_0x3c6b98);}})]});return _0x3673b6;}function fileLogger(_0x59d94,_0x2e3c6c){var _0x53d889=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x65c1('0x1d'))][(_0x65c1('0x20'))]({'name':util[_0x65c1('0xf')](_0x65c1('0x21'),_0x59d94,_0x65c1('0x22')),'filename':getLogFileName(_0x2e3c6c,_0x59d94,'error'),'level':_0x65c1('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x38faa2){return fileFormat(_0x59d94,_0x38faa2);}}),new winston[(_0x65c1('0x1d'))]['File']({'name':util[_0x65c1('0xf')](_0x65c1('0x21'),_0x59d94,debugLevel),'filename':getLogFileName(_0x2e3c6c,_0x59d94,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x53c7bc){return fileFormat(_0x59d94,_0x53c7bc);}}),new winston['transports'][(_0x65c1('0x1e'))]({'level':_0x65c1('0x1f'),'json':![],'formatter':function(_0x4d7172){return fileFormat(_0x59d94,_0x4d7172);}})]});return _0x53d889;}exports[_0x65c1('0x23')]=consoleLogger;exports[_0x65c1('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index fa4cf94..59bcf9a 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 _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x0295,0x1f0));var _0x5029=function(_0x24e3f0,_0x291458){_0x24e3f0=_0x24e3f0-0x0;var _0x36b770=_0x0295[_0x24e3f0];return _0x36b770;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x1261=['fax','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','consumerSecret','calleridname','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','oldPassword','length','isPlainObject','replace','@@{','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile'];(function(_0x3ed049,_0x19da21){var _0x3d9597=function(_0x874e1f){while(--_0x874e1f){_0x3ed049['push'](_0x3ed049['shift']());}};_0x3d9597(++_0x19da21);}(_0x1261,0x144));var _0x1126=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x1261[_0x4cbf20];return _0x582ae4;};var _=require('lodash');var sensitiveFields=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2'),_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'email','clientId',_0x1126('0xa'),_0x1126('0xb'),'code',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'accessTokenSecret',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'membername',_0x1126('0x14'),'calleridnum','exten',_0x1126('0x15'),'clientEmail',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'secret','registry',_0x1126('0x1f')];function maskSensitiveData(_0x154e20){const _0x279455=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x154e20)){for(const _0x45149c in _0x154e20){if(_['isArray'](_0x154e20[_0x45149c])){for(let _0x35fe9f=0x0;_0x35fe9f<_0x154e20[_0x45149c][_0x1126('0x20')];_0x35fe9f++){maskSensitiveData(_0x154e20[_0x45149c][_0x35fe9f]);}}else if(_[_0x1126('0x21')](_0x154e20[_0x45149c])){maskSensitiveData(_0x154e20[_0x45149c]);}else if(_['isString'](_0x154e20[_0x45149c])){_0x154e20[_0x45149c]=_0x154e20[_0x45149c][_0x1126('0x22')](/{{{/g,_0x1126('0x23'))['replace'](/}}}/g,'}@@')[_0x1126('0x22')](/{{/g,'@{')[_0x1126('0x22')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x45149c)){_0x154e20[_0x45149c]=_0x154e20[_0x45149c]['replace'](_0x279455,'*');}}}}}module[_0x1126('0x24')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 091e4d2..c522721 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['exports','replace','\x5c$&'];(function(_0x1f3c56,_0x598757){var _0x569524=function(_0x345301){while(--_0x345301){_0x1f3c56['push'](_0x1f3c56['shift']());}};_0x569524(++_0x598757);}(_0x5fab,0x177));var _0xb5fa=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0x5fab[_0x5c883f];return _0x4210cc;};module[_0xb5fa('0x0')]={'escapeRegExp'(_0x1c67fb,_0x4c67f9=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1c67fb[_0xb5fa('0x1')](_0x4c67f9,_0xb5fa('0x2'));}}; \ No newline at end of file +var _0x7a54=['exports','\x5c$&'];(function(_0x598667,_0x53bb03){var _0x3ac5cf=function(_0x571398){while(--_0x571398){_0x598667['push'](_0x598667['shift']());}};_0x3ac5cf(++_0x53bb03);}(_0x7a54,0x106));var _0x47a5=function(_0x1a4112,_0x15fccb){_0x1a4112=_0x1a4112-0x0;var _0x51b729=_0x7a54[_0x1a4112];return _0x51b729;};module[_0x47a5('0x0')]={'escapeRegExp'(_0x46f3fa,_0x44b31e=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x46f3fa['replace'](_0x44b31e,_0x47a5('0x1'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 0aee1f6..357625e 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 _0x9348=['isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map'];(function(_0x3a5ef3,_0x10be0d){var _0x5e96fc=function(_0x430df4){while(--_0x430df4){_0x3a5ef3['push'](_0x3a5ef3['shift']());}};_0x5e96fc(++_0x10be0d);}(_0x9348,0x10d));var _0x8934=function(_0xfd400a,_0x5c1af3){_0xfd400a=_0xfd400a-0x0;var _0x48846a=_0x9348[_0xfd400a];return _0x48846a;};var _=require(_0x8934('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x23f716){return _0x23f716==='{{'?_0x8934('0x1'):_0x8934('0x2');}function safeTemplate(_0x46a231){var _0x4a2577=_0x46a231;if(typeof _0x46a231===_0x8934('0x3')){_0x4a2577=_0x46a231[_0x8934('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x46a231)){_0x4a2577=_0x46a231[_0x8934('0x5')](function(_0x923aa3){return safeTemplate(_0x923aa3);});}else if(_[_0x8934('0x6')](_0x46a231)){_0x4a2577=Object[_0x8934('0x7')](_0x46a231)[_0x8934('0x8')](function(_0x3ee9b9,_0x512f30){_0x3ee9b9[_0x512f30]=safeTemplate(_0x46a231[_0x512f30]);return _0x3ee9b9;},{});}return _0x4a2577;}module[_0x8934('0x9')][_0x8934('0xa')]=safeTemplate; \ No newline at end of file +var _0xefda=['replace','isArray','map','isPlainObject','reduce','exports','lodash','\x20}\x20}','string'];(function(_0x326ff9,_0x51cf6d){var _0x2118fd=function(_0x1b93d5){while(--_0x1b93d5){_0x326ff9['push'](_0x326ff9['shift']());}};_0x2118fd(++_0x51cf6d);}(_0xefda,0x96));var _0xaefd=function(_0x59626f,_0x5d0ff5){_0x59626f=_0x59626f-0x0;var _0x291ae7=_0xefda[_0x59626f];return _0x291ae7;};var _=require(_0xaefd('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4ae616){return _0x4ae616==='{{'?'{\x20{\x20':_0xaefd('0x1');}function safeTemplate(_0x2ccc67){var _0x4ae272=_0x2ccc67;if(typeof _0x2ccc67===_0xaefd('0x2')){_0x4ae272=_0x2ccc67[_0xaefd('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xaefd('0x4')](_0x2ccc67)){_0x4ae272=_0x2ccc67[_0xaefd('0x5')](function(_0x1ef6b4){return safeTemplate(_0x1ef6b4);});}else if(_[_0xaefd('0x6')](_0x2ccc67)){_0x4ae272=Object['keys'](_0x2ccc67)[_0xaefd('0x7')](function(_0x3b9736,_0x24d10c){_0x3b9736[_0x24d10c]=safeTemplate(_0x2ccc67[_0x24d10c]);return _0x3b9736;},{});}return _0x4ae272;}module[_0xaefd('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 1dff615..e63a8a3 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88a4=['env','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','path','../config/environment','root','resolve','legacy-libs','isArray','apps','findIndex','motion2'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x88a4,0x1d2));var _0x488a=function(_0x248d88,_0x74b152){_0x248d88=_0x248d88-0x0;var _0x1da541=_0x88a4[_0x248d88];return _0x1da541;};var fs=require('fs-extra');var path=require(_0x488a('0x0'));var config=require(_0x488a('0x1'));var root=config[_0x488a('0x2')];var APP_JSON_PATH=path[_0x488a('0x3')](root,'server/app.json');var NODEPATH=path[_0x488a('0x3')](root,_0x488a('0x4'));function setLegacyLibsNodeEnvPath(_0x28cf6e){let _0x6abaa0=![];if(Array[_0x488a('0x5')](_0x28cf6e[_0x488a('0x6')])){var _0x44a740=_0x28cf6e['apps'][_0x488a('0x7')](function(_0x59243f){return _0x59243f['name']===_0x488a('0x8');});if(_0x44a740>-0x1){var _0x9f5708=_0x28cf6e[_0x488a('0x6')][_0x44a740];if(typeof _0x9f5708[_0x488a('0x9')][_0x488a('0xa')]!==_0x488a('0xb')){_0x9f5708['env'][_0x488a('0xa')]=NODEPATH;_0x6abaa0=!![];}}return{'appConfig':_0x28cf6e,'updated':_0x6abaa0};}}function updateAppConfig(_0x1a1d02){return fs[_0x488a('0xc')](APP_JSON_PATH)[_0x488a('0xd')](function(_0x365162){if(_0x365162){return fs[_0x488a('0xe')](APP_JSON_PATH)[_0x488a('0xd')](function(_0x247040){var _0xfa88f4=setLegacyLibsNodeEnvPath(_0x247040);if(_0xfa88f4[_0x488a('0xf')]){_0x1a1d02[_0x488a('0x10')](_0x488a('0x11'));return fs[_0x488a('0x12')](APP_JSON_PATH,_0x247040,{'spaces':0x2});}else{return Promise[_0x488a('0x3')]();}});}else{return Promise[_0x488a('0x3')]();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0xa364=['Updating\x20app.json','writeJSON','exports','../config/environment','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','motion2','NODE_PATH','string','env','pathExists','then','readJSON','info'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xa364,0x135));var _0x4a36=function(_0x2f75b3,_0x588b53){_0x2f75b3=_0x2f75b3-0x0;var _0x3ba2fe=_0xa364[_0x2f75b3];return _0x3ba2fe;};var fs=require('fs-extra');var path=require('path');var config=require(_0x4a36('0x0'));var root=config['root'];var APP_JSON_PATH=path[_0x4a36('0x1')](root,_0x4a36('0x2'));var NODEPATH=path[_0x4a36('0x1')](root,_0x4a36('0x3'));function setLegacyLibsNodeEnvPath(_0x2562e4){let _0x55b0b9=![];if(Array[_0x4a36('0x4')](_0x2562e4[_0x4a36('0x5')])){var _0xeb2d22=_0x2562e4[_0x4a36('0x5')][_0x4a36('0x6')](function(_0x390ab4){return _0x390ab4['name']===_0x4a36('0x7');});if(_0xeb2d22>-0x1){var _0x797952=_0x2562e4[_0x4a36('0x5')][_0xeb2d22];if(typeof _0x797952['env'][_0x4a36('0x8')]!==_0x4a36('0x9')){_0x797952[_0x4a36('0xa')]['NODE_PATH']=NODEPATH;_0x55b0b9=!![];}}return{'appConfig':_0x2562e4,'updated':_0x55b0b9};}}function updateAppConfig(_0x4bb872){return fs[_0x4a36('0xb')](APP_JSON_PATH)[_0x4a36('0xc')](function(_0x34605){if(_0x34605){return fs[_0x4a36('0xd')](APP_JSON_PATH)[_0x4a36('0xc')](function(_0x2495df){var _0x540fe2=setLegacyLibsNodeEnvPath(_0x2495df);if(_0x540fe2['updated']){_0x4bb872[_0x4a36('0xe')](_0x4a36('0xf'));return fs[_0x4a36('0x10')](APP_JSON_PATH,_0x2495df,{'spaces':0x2});}else{return Promise[_0x4a36('0x1')]();}});}else{return Promise[_0x4a36('0x1')]();}});}module[_0x4a36('0x11')]=updateAppConfig; \ No newline at end of file